tscircuit 0.0.1189-libonly → 0.0.1190-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.
@@ -5317,7 +5317,7 @@ svg { font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif; }
5317
5317
  `+a+" | "+uhA("",o.column-1," ")+uhA("",c,"^")}else A+=`
5318
5318
  at `+s}return A},oZ.buildMessage=function(t,A){var e={literal:function(g){return'"'+o(g.text)+'"'},class:function(g){var I=g.parts.map(function(c){return Array.isArray(c)?n(c[0])+"-"+n(c[1]):n(c)});return"["+(g.inverted?"^":"")+I.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(g){return g.description}};function i(g){return g.charCodeAt(0).toString(16).toUpperCase()}function o(g){return g.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(I){return"\\x0"+i(I)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(I){return"\\x"+i(I)})}function n(g){return g.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(I){return"\\x0"+i(I)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(I){return"\\x"+i(I)})}function s(g){return e[g.type](g)}function r(g){var I=g.map(s),c,B;if(I.sort(),I.length>0){for(c=1,B=1;c<I.length;c++)I[c-1]!==I[c]&&(I[B]=I[c],B++);I.length=B}switch(I.length){case 1:return I[0];case 2:return I[0]+" or "+I[1];default:return I.slice(0,-1).join(", ")+", or "+I[I.length-1]}}function a(g){return g?'"'+o(g)+'"':"end of input"}return"Expected "+r(t)+" but "+a(A)+" found."};const WH=t=>typeof t=="number"&&!isNaN(t),KF=t=>typeof t=="string",f0=t=>typeof t=="function",nZ=t=>KF(t)||f0(t)?t:null,dhA=t=>j.isValidElement(t)||KF(t)||f0(t)||WH(t);function nUt(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 sZ(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=j.useRef(0);return j.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)},[]),j.useEffect(()=>{const h=c.current,u=()=>{h.removeEventListener("animationend",u),o?nUt(h,I,n):I()};B||(g?u():(E.current=1,h.className+=` ${Q}`,h.addEventListener("animationend",u)))},[B]),Xi.createElement(Xi.Fragment,null,r)}}function uee(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 _d=new Map;let ZH=[];const phA=new Set,sUt=t=>phA.forEach(A=>A(t)),dee=()=>_d.size>0;function pee(t,A){var e;if(A)return!((e=_d.get(A))==null||!e.isToastActive(t));let i=!1;return _d.forEach(o=>{o.isToastActive(t)&&(i=!0)}),i}function fee(t,A){dhA(t)&&(dee()||ZH.push({content:t,options:A}),_d.forEach(e=>{e.buildToast(t,A)}))}function yee(t,A){_d.forEach(e=>{A!=null&&A!=null&&A.containerId?A?.containerId===e.id&&e.toggle(t,A?.id):e.toggle(t,A?.id)})}function rUt(t){const{subscribe:A,getSnapshot:e,setProps:i}=j.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,m=()=>{h=Array.from(d.values()),f.forEach(x=>x())},S=x=>{E=x==null?[]:E.filter(F=>F!==x),m()},D=x=>{const{toastId:F,onOpen:k,updateId:v,children:_}=x.props,H=v==null;x.staleId&&d.delete(x.staleId),d.set(F,x),E=[...E,x.props.toastId].filter(P=>P!==x.staleId),m(),B(uee(x,H?"added":"updated")),H&&f0(k)&&k(j.isValidElement(_)&&_.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||f0(k.toggle)&&k.toggle(x)})},removeToast:S,toasts:d,clearQueue:()=>{C-=Q.length,Q=[]},buildToast:(x,F)=>{if((iA=>{let{containerId:rA,toastId:CA,updateId:dA}=iA;const SA=rA?rA!==I:I!==1,xA=d.has(CA)&&dA==null;return SA||xA})(F))return;const{toastId:k,updateId:v,data:_,staleId:H,delay:P}=F,J=()=>{S(k)},W=v==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:v,data:_,closeToast:J,isIn:!1,className:nZ(F.className||u.toastClassName),bodyClassName:nZ(F.bodyClassName||u.bodyClassName),progressClassName:nZ(F.progressClassName||u.progressClassName),autoClose:!F.isLoading&&(AA=F.autoClose,nA=u.autoClose,AA===!1||WH(AA)&&AA>0?AA:nA),deleteToast(){const iA=d.get(k),{onClose:rA,children:CA}=iA.props;f0(rA)&&rA(j.isValidElement(CA)&&CA.props),B(uee(iA,"removed")),d.delete(k),C--,C<0&&(C=0),Q.length>0?D(Q.shift()):m()}};var AA,nA;Z.closeButton=u.closeButton,F.closeButton===!1||dhA(F.closeButton)?Z.closeButton=F.closeButton:F.closeButton===!0&&(Z.closeButton=!dhA(u.closeButton)||u.closeButton);let gA=x;j.isValidElement(x)&&!KF(x.type)?gA=j.cloneElement(x,{closeToast:J,toastProps:Z,data:_}):f0(x)&&(gA=x({closeToast:J,toastProps:Z,data:_}));const tA={content:gA,props:Z,staleId:H};u.limit&&u.limit>0&&C>u.limit&&W?Q.push(tA):WH(P)?setTimeout(()=>{D(tA)},P):D(tA)},setProps(x){u=x},setToggle:(x,F)=>{d.get(x).toggle=F},isToastActive:x=>E.some(F=>F===x),getSnapshot:()=>h}})(s,n,sUt);_d.set(s,a);const g=a.observe(r);return ZH.forEach(I=>fee(I.content,I.options)),ZH=[],()=>{g(),_d.delete(s)}},setProps(r){var a;(a=_d.get(s))==null||a.setProps(r)},getSnapshot(){var r;return(r=_d.get(s))==null?void 0:r.getSnapshot()}}})(t)).current;i(t);const o=j.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:pee,count:o?.length}}function aUt(t){const[A,e]=j.useState(!1),[i,o]=j.useState(!1),n=j.useRef(null),s=j.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=_d.get((B={id:t.toastId,containerId:t.containerId,fn:e}).containerId||1))==null||l.setToggle(B.id,B.fn),j.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:m,left:S,right:D}=n.current.getBoundingClientRect();d.nativeEvent.type!=="touchend"&&t.pauseOnHover&&d.clientX>=S&&d.clientX<=D&&d.clientY>=f&&d.clientY<=m?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 gUt(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=dw("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=f0(s)?s({rtl:I,type:o,defaultClassName:Q}):dw(Q,s),h={[a&&g>=1?"onTransitionEnd":"onAnimationEnd"]:a&&g<1?null:()=>{c&&i()}};return Xi.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":l},Xi.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${B} Toastify__progress-bar--${o}`}),Xi.createElement("div",{role:"progressbar","aria-hidden":l?"true":"false","aria-label":"notification timer",className:E,style:C,...h}))}let IUt=1;const wee=()=>""+IUt++;function cUt(t){return t&&(KF(t.toastId)||WH(t.toastId))?t.toastId:wee()}function VH(t,A){return fee(t,A),A.toastId}function rZ(t,A){return{...A,type:A&&A.type||t,toastId:cUt(A)}}function aZ(t){return(A,e)=>VH(A,rZ(t,e))}function Zg(t,A){return VH(t,rZ("default",A))}Zg.loading=(t,A)=>VH(t,rZ("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...A})),Zg.promise=function(t,A,e){let i,{pending:o,error:n,success:s}=A;o&&(i=KF(o)?Zg.loading(o,e):Zg.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 Zg.dismiss(i);const l={type:I,...r,...e,data:B},C=KF(c)?{render:c}:c;return i?Zg.update(i,{...l,...C}):Zg(C.render,{...l,...C}),B},g=f0(t)?t():t;return g.then(I=>a("success",s,I)).catch(I=>a("error",n,I)),g},Zg.success=aZ("success"),Zg.info=aZ("info"),Zg.error=aZ("error"),Zg.warning=aZ("warning"),Zg.warn=Zg.warning,Zg.dark=(t,A)=>VH(t,rZ("default",{theme:"dark",...A})),Zg.dismiss=function(t){(function(A){var e;if(dee()){if(A==null||KF(e=A)||WH(e))_d.forEach(i=>{i.removeToast(A)});else if(A&&("containerId"in A||"id"in A)){const i=_d.get(A.containerId);i?i.removeToast(A.id):_d.forEach(o=>{o.removeToast(A.id)})}}else ZH=ZH.filter(i=>A!=null&&i.options.toastId!==A)})(t)},Zg.clearWaitingQueue=function(t){t===void 0&&(t={}),_d.forEach(A=>{!A.props.limit||t.containerId&&A.id!==t.containerId||A.clearQueue()})},Zg.isActive=pee,Zg.update=function(t,A){A===void 0&&(A={});const e=((i,o)=>{var n;let{containerId:s}=o;return(n=_d.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:wee()};n.toastId!==t&&(n.staleId=t);const s=n.render||o;delete n.render,VH(s,n)}},Zg.done=t=>{Zg.update(t,{progress:1})},Zg.onChange=function(t){return phA.add(t),()=>{phA.delete(t)}},Zg.play=t=>yee(!0,t),Zg.pause=t=>yee(!1,t);const BUt=typeof window<"u"?j.useLayoutEffect:j.useEffect,gZ=t=>{let{theme:A,type:e,isLoading:i,...o}=t;return Xi.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:A==="colored"?"currentColor":`var(--toastify-icon-color-${e})`,...o})},fhA={info:function(t){return Xi.createElement(gZ,{...t},Xi.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 Xi.createElement(gZ,{...t},Xi.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 Xi.createElement(gZ,{...t},Xi.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 Xi.createElement(gZ,{...t},Xi.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 Xi.createElement("div",{className:"Toastify__spinner"})}},lUt=t=>{const{isRunning:A,preventExitTransition:e,toastRef:i,eventHandlers:o,playToast:n}=aUt(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:m,role:S,progress:D,rtl:x,toastId:F,deleteToast:k,isIn:v,isLoading:_,closeOnClick:H,theme:P}=t,J=dw("Toastify__toast",`Toastify__toast-theme--${P}`,`Toastify__toast--${I}`,{"Toastify__toast--rtl":x},{"Toastify__toast--close-on-click":H}),W=f0(Q)?Q({rtl:x,position:C,type:I,defaultClassName:J}):dw(J,Q),Z=(function(tA){let{theme:iA,type:rA,isLoading:CA,icon:dA}=tA,SA=null;const xA={theme:iA,type:rA};return dA===!1||(f0(dA)?SA=dA({...xA,isLoading:CA}):j.isValidElement(dA)?SA=j.cloneElement(dA,xA):CA?SA=fhA.spinner():(JA=>JA in fhA)(rA)&&(SA=fhA[rA](xA))),SA})(t),AA=!!D||!a,nA={closeToast:B,type:I,theme:P};let gA=null;return s===!1||(gA=f0(s)?s(nA):j.isValidElement(s)?j.cloneElement(s,nA):(function(tA){let{closeToast:iA,theme:rA,ariaLabel:CA="close"}=tA;return Xi.createElement("button",{className:`Toastify__close-button Toastify__close-button--${rA}`,type:"button",onClick:dA=>{dA.stopPropagation(),iA(dA)},"aria-label":CA},Xi.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},Xi.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)),Xi.createElement(l,{isIn:v,done:k,position:C,preventExitTransition:e,nodeRef:i,playToast:n},Xi.createElement("div",{id:F,onClick:g,"data-in":v,className:W,...o,style:E,ref:i},Xi.createElement("div",{...v&&{role:S},className:f0(h)?h({type:I}):dw("Toastify__toast-body",h),style:u},Z!=null&&Xi.createElement("div",{className:dw("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!_})},Z),Xi.createElement("div",null,r)),gA,Xi.createElement(gUt,{...m&&!AA?{key:`pb-${m}`}:{},rtl:x,theme:P,delay:a,isRunning:A,isIn:v,closeToast:B,hide:c,type:I,style:f,className:d,controlledProgress:AA,progress:D||0})))},IZ=function(t,A){return A===void 0&&(A=!1),{enter:`Toastify--animate Toastify__${t}-enter`,exit:`Toastify--animate Toastify__${t}-exit`,appendPosition:A}},CUt=sZ(IZ("bounce",!0));sZ(IZ("slide",!0)),sZ(IZ("zoom")),sZ(IZ("flip"));const QUt={position:"top-right",transition:CUt,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};function EUt(t){let A={...QUt,...t};const e=t.stacked,[i,o]=j.useState(!0),n=j.useRef(null),{getToastToRender:s,isToastActive:r,count:a}=rUt(A),{className:g,style:I,rtl:c,containerId:B}=A;function l(Q){const E=dw("Toastify__toast-container",`Toastify__toast-container--${Q}`,{"Toastify__toast-container--rtl":c});return f0(g)?g({position:Q,rtl:c,defaultClassName:E}):dw(E,nZ(g))}function C(){e&&(o(!0),Zg.play())}return BUt(()=>{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((m,S)=>{const D=m;D.classList.add("Toastify__toast--stacked"),S>0&&(D.dataset.collapsed=`${i}`),D.dataset.pos||(D.dataset.pos=u?"top":"bot");const x=d*(i?.2:1)+(i?0:h*S);D.style.setProperty("--y",`${u?x:-1*x}px`),D.style.setProperty("--g",`${h}`),D.style.setProperty("--s",""+(1-(i?f:0))),d+=D.offsetHeight,f+=.025})}},[i,a,e]),Xi.createElement("div",{ref:n,className:"Toastify",id:B,onMouseEnter:()=>{e&&(o(!1),Zg.pause())},onMouseLeave:C},s((Q,E)=>{const h=E.length?{...I}:{...I,pointerEvents:"none"};return Xi.createElement("div",{className:l(Q),style:h,key:`container-${Q}`},E.map(u=>{let{content:d,props:f}=u;return Xi.createElement(lUt,{...f,stacked:e,collapseAll:C,isIn:r(f.toastId,f.containerId),style:f.style,key:`toast-${f.key}`},d)}))}))}function hUt(){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)}var yhA={exports:{}},whA,mee;function Dee(){return mee||(mee=1,whA={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]}),whA}var mhA={exports:{}},DhA,See;function uUt(){return See||(See=1,DhA=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")}),DhA}var bee;function dUt(){if(bee)return mhA.exports;bee=1;var t=uUt(),A=Array.prototype.concat,e=Array.prototype.slice,i=mhA.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))}},mhA.exports}var xee;function pUt(){if(xee)return yhA.exports;xee=1;var t=Dee(),A=dUt(),e=Object.hasOwnProperty,i=Object.create(null);for(var o in t)e.call(t,o)&&(i[t[o]]=o);var n=yhA.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 yhA.exports}var ShA,kee;function Gee(){if(kee)return ShA;kee=1;const t=Dee(),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"]}};ShA=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]},ShA}var bhA,Fee;function fUt(){if(Fee)return bhA;Fee=1;const t=Gee();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 bhA=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},bhA}var xhA,Ree;function yUt(){if(Ree)return xhA;Ree=1;const t=Gee(),A=fUt(),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)})}),xhA=e,xhA}var khA,Mee;function wUt(){if(Mee)return khA;Mee=1;const t=pUt(),A=yUt(),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 khA=n,khA}var mUt=wUt();const If=A0(mUt);function ao(t,A){return Array.isArray(A)?[t.a*A[0]+t.c*A[1]+t.e,t.b*A[0]+t.d*A[1]+t.f]:{x:t.a*A.x+t.c*A.y+t.e,y:t.b*A.x+t.d*A.y+t.f}}function DUt(){return{a:1,c:0,e:0,b:0,d:1,f:0}}function GhA(t){return typeof t>"u"}function cZ(t,A=0){return{a:1,c:0,e:t,b:0,d:1,f:A}}function FhA(...t){t=Array.isArray(t[0])?t[0]:t;const A=(e,i)=>({a:e.a*i.a+e.c*i.b,c:e.a*i.c+e.c*i.d,e:e.a*i.e+e.c*i.f+e.e,b:e.b*i.a+e.d*i.b,d:e.b*i.c+e.d*i.d,f:e.b*i.e+e.d*i.f+e.f});switch(t.length){case 0:throw new Error("no matrices provided");case 1:return t[0];case 2:return A(t[0],t[1]);default:{const[e,i,...o]=t,n=A(e,i);return FhA(n,...o)}}}function SUt(...t){return FhA(...t)}function bUt(t,A=void 0,e=void 0,i=void 0){GhA(A)&&(A=t);const o={a:t,c:0,e:0,b:0,d:A,f:0};return GhA(e)||GhA(i)?o:FhA([cZ(e,i),o,cZ(-e,-i)])}function BZ(t){const{ctx:A,points:e,fill:i,stroke:o,strokeWidth:n=1,realToCanvasMat:s,closePath:r=!1}=t;if(e.length<2)return;A.beginPath();const a=e.map(B=>ao(s,[B.x,B.y])),g=a[0];if(!g)return;const[I,c]=g;A.moveTo(I,c);for(let B=1;B<a.length;B++){const l=a[B];if(!l)continue;const[C,Q]=l;A.lineTo(C,Q)}if(r&&A.closePath(),i&&(A.fillStyle=i,A.fill()),o){const B=n*Math.abs(s.a);A.strokeStyle=o,A.lineWidth=B,A.stroke()}}function y0(t){const{ctx:A,center:e,width:i,height:o,fill:n,realToCanvasMat:s,borderRadius:r=0,rotation:a=0,stroke:g,strokeWidth:I,isStrokeDashed:c=!1}=t,[B,l]=ao(s,[e.x,e.y]),C=i*Math.abs(s.a),Q=o*Math.abs(s.a),E=r*Math.abs(s.a),h=I?I*Math.abs(s.a):void 0;if(A.save(),A.translate(B,l),a!==0&&A.rotate(-a*(Math.PI/180)),A.beginPath(),E>0){const u=-C/2,d=-Q/2,f=Math.min(E,C/2,Q/2);A.moveTo(u+f,d),A.lineTo(u+C-f,d),A.arcTo(u+C,d,u+C,d+f,f),A.lineTo(u+C,d+Q-f),A.arcTo(u+C,d+Q,u+C-f,d+Q,f),A.lineTo(u+f,d+Q),A.arcTo(u,d+Q,u,d+Q-f,f),A.lineTo(u,d+f),A.arcTo(u,d,u+f,d,f)}else A.rect(-C/2,-Q/2,C,Q);n&&(A.fillStyle=n,A.fill()),g&&h&&(c?A.setLineDash([h*3,h*2]):A.setLineDash([]),A.strokeStyle=g,A.lineWidth=h,A.stroke()),A.restore()}function xUt(t){const{ctx:A,board:e,realToCanvasMat:i,colorMap:o,drawBoardMaterial:n}=t,{width:s,height:r,center:a,outline:g}=e;if(g&&Array.isArray(g)&&g.length>=3){n&&BZ({ctx:A,points:g.map(I=>({x:I.x,y:I.y})),fill:o.substrate,realToCanvasMat:i,closePath:!0}),BZ({ctx:A,points:g.map(I=>({x:I.x,y:I.y})),stroke:o.boardOutline,strokeWidth:.1,realToCanvasMat:i,closePath:!0});return}if(s!==void 0&&r!==void 0&&a){n&&y0({ctx:A,center:a,width:s,height:r,fill:o.substrate,realToCanvasMat:i});const I=s/2,c=r/2,B=[{x:a.x-I,y:a.y-c},{x:a.x+I,y:a.y-c},{x:a.x+I,y:a.y+c},{x:a.x-I,y:a.y+c}];BZ({ctx:A,points:B,stroke:o.boardOutline,strokeWidth:.1,realToCanvasMat:i,closePath:!0})}}function lZ(t){const{ctx:A,points:e,fill:i,realToCanvasMat:o}=t;if(e.length<3)return;A.beginPath();const n=e.map(g=>ao(o,[g.x,g.y])),s=n[0];if(!s)return;const[r,a]=s;A.moveTo(r,a);for(let g=1;g<n.length;g++){const I=n[g];if(!I)continue;const[c,B]=I;A.lineTo(c,B)}A.closePath(),A.fillStyle=i,A.fill()}function kUt(t,A){return A.copper[t]??A.copper.top}function GUt(t,A,e,i,o){if(Math.abs(o)<1e-10)return null;const n=e-t,s=i-A,r=Math.hypot(n,s);if(r<1e-10)return null;const a=Math.abs(o)*(r/2),g=r/2,I=(a*a+g*g)/(2*a),c=I-a,B=(t+e)/2,l=(A+i)/2,C=-s/r,Q=n/r,E=o>0?-1:1,h=B+E*C*c,u=l+E*Q*c;return{centerX:h,centerY:u,radius:I}}function RhA(t,A,e,i,o,n,s){if(Math.abs(n)<1e-10){const[f,m]=ao(s,[i,o]);t.lineTo(f,m);return}const r=GUt(A,e,i,o,n);if(!r){const[f,m]=ao(s,[i,o]);t.lineTo(f,m);return}const[a,g]=ao(s,[A,e]),[I,c]=ao(s,[i,o]),[B,l]=ao(s,[r.centerX,r.centerY]),C=Math.hypot(a-B,g-l),Q=Math.atan2(g-l,a-B),E=Math.atan2(c-l,I-B),u=s.a*s.d-s.b*s.c<0,d=n>0?!u:u;t.arc(B,l,C,Q,E,d)}function Nee(t,A,e){if(A.vertices.length<2)return;if(A.vertices.length===2){const s=A.vertices[0],r=A.vertices[1];if(s&&r&&Math.abs((s.bulge??0)-1)<1e-10&&Math.abs((r.bulge??0)-1)<1e-10){const[a,g]=ao(e,[s.x,s.y]);t.moveTo(a,g),RhA(t,s.x,s.y,r.x,r.y,1,e),RhA(t,r.x,r.y,s.x,s.y,1,e);return}}const i=A.vertices[0];if(!i)return;const[o,n]=ao(e,[i.x,i.y]);t.moveTo(o,n);for(let s=0;s<A.vertices.length;s++){const r=A.vertices[s],a=(s+1)%A.vertices.length,g=A.vertices[a];if(!r||!g)continue;const I=r.bulge??0;if(Math.abs(I)<1e-10){const[c,B]=ao(e,[g.x,g.y]);t.lineTo(c,B)}else RhA(t,r.x,r.y,g.x,g.y,I,e)}}function FUt(t){const{ctx:A,pour:e,realToCanvasMat:i,colorMap:o}=t,n=kUt(e.layer,o);if(A.save(),e.shape==="rect"){const[s,r]=ao(i,[e.center.x,e.center.y]),a=e.width*Math.abs(i.a),g=e.height*Math.abs(i.a);A.translate(s,r),e.rotation&&A.rotate(-e.rotation*(Math.PI/180)),A.beginPath(),A.rect(-a/2,-g/2,a,g),A.fillStyle=n,A.globalAlpha=.5,A.fill(),A.restore();return}if(e.shape==="polygon"){if(e.points&&e.points.length>=3){const s=e.points.map(I=>ao(i,[I.x,I.y])),r=s[0];if(!r){A.restore();return}A.beginPath();const[a,g]=r;A.moveTo(a,g);for(let I=1;I<s.length;I++){const c=s[I];if(!c)continue;const[B,l]=c;A.lineTo(B,l)}A.closePath(),A.fillStyle=n,A.globalAlpha=.5,A.fill()}A.restore();return}if(e.shape==="brep"){if(A.beginPath(),Nee(A,e.brep_shape.outer_ring,i),e.brep_shape.inner_rings)for(const s of e.brep_shape.inner_rings)Nee(A,s,i);A.fillStyle=n,A.globalAlpha=.5,A.fill("evenodd"),A.restore();return}A.restore()}var RUt=.62,MUt=.3,NUt=1,_Ut=.13,vUt=1.2;function CZ(t,A){const e=A*RUt,i=e*MUt,o=e*NUt,n=Math.max(A*_Ut,.35),s=A*vUt,r=t.replace(/\\n/g,`
5319
5319
  `).split(`
5320
- `),a=[];let g=0;for(const c of r){const B=Array.from(c);let l=0;B.forEach((C,Q)=>{l+=C===" "?o:e,Q<B.length-1&&(l+=i)}),a.push(l),l>g&&(g=l)}const I=r.length>1?A+(r.length-1)*s:A;return{width:g,height:I,glyphWidth:e,letterSpacing:i,spaceWidth:o,strokeWidth:n,lineHeight:s,lines:r,lineWidths:a}}function MhA(t,A){const e=A.width+A.strokeWidth,i=A.height+A.strokeWidth;let o=0,n=0;return t==="center"||t==="top_center"||t==="bottom_center"?o=-e/2:t==="top_left"||t==="bottom_left"||t==="center_left"?o=0:t==="top_right"||t==="bottom_right"||t==="center_right"?o=-e:(t==="top_center"||t==="bottom_center")&&(o=-e/2),t==="center"||t==="center_left"||t==="center_right"?n=-i/2:t==="top_left"||t==="top_right"||t==="top_center"?n=0:(t==="bottom_left"||t==="bottom_right"||t==="bottom_center")&&(n=-i),{x:o,y:n}}function NhA(t){const{alignment:A,lineWidth:e,maxWidth:i,strokeWidth:o}=t,n=e+o,s=i+o;return A==="top_left"||A==="bottom_left"||A==="center_left"?0:A==="top_right"||A==="bottom_right"||A==="center_right"?s-n:(s-n)/2}var UUt=t=>Jm[t]??Jm[t.toUpperCase()];function _hA(t){const{ctx:A,line:e,fontSize:i,startX:o,startY:n,layout:s}=t,{glyphWidth:r,letterSpacing:a,spaceWidth:g,strokeWidth:I}=s,c=i,B=n,l=Array.from(e);let C=o+I/2;l.forEach((Q,E)=>{const h=UUt(Q),u=Q===" "?g:r;if(h?.length){A.beginPath();for(const d of h){const f=C+d.x1*r,m=B+(1-d.y1)*c,S=C+d.x2*r,D=B+(1-d.y2)*c;A.moveTo(f,m),A.lineTo(S,D)}A.stroke()}C+=u,E<l.length-1&&(C+=a)})}function LUt(t){const{ctx:A,text:e,fontSize:i,startX:o,startY:n,anchorAlignment:s="center"}=t,r=CZ(e,i),{lines:a,lineWidths:g,lineHeight:I,width:c,strokeWidth:B}=r;a.forEach((l,C)=>{const Q=o+NhA({alignment:s,lineWidth:g[C],maxWidth:c,strokeWidth:B}),E=n+C*I;_hA({ctx:A,line:l,fontSize:i,startX:Q,startY:E,layout:r})})}function vhA(t){const{ctx:A,text:e,x:i,y:o,fontSize:n,color:s,realToCanvasMat:r,anchorAlignment:a,rotation:g=0}=t;if(!e)return;const[I,c]=ao(r,[i,o]),B=Math.abs(r.a),l=n*B,C=CZ(e,l),Q=MhA(a,C);A.save(),A.translate(I,c),g!==0&&A.rotate(-g*(Math.PI/180)),A.lineWidth=C.strokeWidth,A.lineCap="round",A.lineJoin="round",A.strokeStyle=s;const{lines:E,lineWidths:h,lineHeight:u,width:d,strokeWidth:f}=C;E.forEach((m,S)=>{const D=Q.x+NhA({alignment:a,lineWidth:h[S],maxWidth:d,strokeWidth:f}),x=Q.y+S*u;_hA({ctx:A,line:m,fontSize:l,startX:D,startY:x,layout:C})}),A.restore()}var HUt={left:.2,right:.2,top:.2,bottom:.2};function YUt(t){return t?t.includes("left")?"center_left":t.includes("right")?"center_right":"center":"center"}function JUt(t){const{ctx:A,text:e,realToCanvasMat:i,colorMap:o}=t,n=e.text??"";if(!n)return;const[s,r]=ao(i,[e.anchor_position.x,e.anchor_position.y]),a=Math.abs(i.a),g=(e.font_size??1)*a,I=e.ccw_rotation??0,c={...HUt,...e.knockout_padding},B=o.copper[e.layer]??o.copper.top,l=CZ(n,g),C=l.width+l.strokeWidth,Q=YUt(e.anchor_alignment),E=MhA(Q,l);if(A.save(),A.translate(s,r),e.is_mirrored&&A.scale(-1,1),I!==0&&A.rotate(-I*(Math.PI/180)),A.lineWidth=l.strokeWidth,A.lineCap="round",A.lineJoin="round",e.is_knockout){const h=c.left*a,u=c.right*a,d=c.top*a,f=c.bottom*a,m=E.x-h*4,S=E.y-d*4,D=C+h*2+u*2,x=l.height+l.strokeWidth+d*2+f*2;A.fillStyle=B,A.fillRect(m,S,D,x)}else A.strokeStyle=B;LUt({ctx:A,text:n,fontSize:g,startX:E.x,startY:E.y,anchorAlignment:Q}),A.restore()}function ID(t){const{ctx:A,center:e,radius:i,fill:o,realToCanvasMat:n}=t,[s,r]=ao(n,[e.x,e.y]),a=i*Math.abs(n.a);A.beginPath(),A.arc(s,r,a,0,Math.PI*2),A.fillStyle=o,A.fill()}function TUt(t){const{ctx:A,cutout:e,realToCanvasMat:i,colorMap:o}=t;if(e.shape==="rect"){y0({ctx:A,center:e.center,width:e.width,height:e.height,fill:o.drill,realToCanvasMat:i,rotation:e.rotation??0,borderRadius:e.corner_radius??0});return}if(e.shape==="circle"){ID({ctx:A,center:e.center,radius:e.radius,fill:o.drill,realToCanvasMat:i});return}if(e.shape==="polygon"){e.points&&e.points.length>=3&&lZ({ctx:A,points:e.points,fill:o.drill,realToCanvasMat:i});return}}var KUt=1.5,qUt=.6,PUt=.3;function UhA(t){const A=Math.hypot(t.x,t.y)||1;return{x:t.x/A,y:t.y/A}}function _ee(t){const{ctx:A,from:e,to:i,realToCanvasMat:o,color:n,fontSize:s,arrowSize:r=1,strokeWidth:a,text:g,textRotation:I,offset:c}=t,B=UhA({x:i.x-e.x,y:i.y-e.y}),l={x:-B.y,y:B.x},C=c?.direction&&typeof c.direction.x=="number"&&typeof c.direction.y=="number",Q=C?UhA(c.direction):{x:0,y:0},E=c?.distance??0,h={x:Q.x*E,y:Q.y*E},u={x:e.x+h.x,y:e.y+h.y},d={x:i.x+h.x,y:i.y+h.y},f={x:u.x+B.x*r,y:u.y+B.y*r},m={x:d.x-B.x*r,y:d.y-B.y*r};Math.abs(o.a);const S=a??r/5,D=n||"rgba(255,255,255,0.5)",x=C&&(Math.abs(Q.x)>Number.EPSILON||Math.abs(Q.y)>Number.EPSILON)?Q:l,F=E+.5,k=[],v=P=>{const J={x:P.x+x.x*F,y:P.y+x.y*F},W=S/2,Z={x:-x.y,y:x.x};return[{x:P.x+Z.x*W,y:P.y+Z.y*W},{x:P.x-Z.x*W,y:P.y-Z.y*W},{x:J.x-Z.x*W,y:J.y-Z.y*W},{x:J.x+Z.x*W,y:J.y+Z.y*W}]};k.push(u),k.push({x:f.x+l.x*(r/2),y:f.y+l.y*(r/2)}),k.push({x:f.x+l.x*(S/2),y:f.y+l.y*(S/2)}),k.push({x:m.x+l.x*(S/2),y:m.y+l.y*(S/2)}),k.push({x:m.x+l.x*(r/2),y:m.y+l.y*(r/2)}),k.push(d),k.push({x:m.x-l.x*(r/2),y:m.y-l.y*(r/2)}),k.push({x:m.x-l.x*(S/2),y:m.y-l.y*(S/2)}),k.push({x:f.x-l.x*(S/2),y:f.y-l.y*(S/2)}),k.push({x:f.x-l.x*(r/2),y:f.y-l.y*(r/2)}),k.push(u);const _=k[0],H=P=>{const J=v(P);k.push(_),k.push(J[0]),k.push(...J),k.push(J[0]),k.push(_)};if(H(e),H(i),lZ({ctx:A,points:k,fill:D,realToCanvasMat:o}),g){const P={x:(e.x+i.x)/2+h.x,y:(e.y+i.y)/2+h.y},[J,W]=ao(o,[u.x,u.y]),[Z,AA]=ao(o,[d.x,d.y]),nA=UhA({x:Z-J,y:AA-W});let gA=Math.atan2(nA.y,nA.x)*180/Math.PI;(gA>90||gA<-90)&&(gA+=180);const tA=typeof I=="number"&&Number.isFinite(I)?gA-I:gA;let iA=0;if(g&&typeof I=="number"&&Number.isFinite(I)){const dA=g.length*s*qUt,SA=s,xA=I*Math.PI/180,JA=Math.abs(Math.sin(xA)),lA=Math.abs(Math.cos(xA)),RA=dA/2,uA=SA/2;iA=RA*JA+uA*lA+s*PUt}const rA=r*KUt+iA,CA={x:P.x+l.x*rA,y:P.y+l.y*rA};vhA({ctx:A,text:g,x:CA.x,y:CA.y,fontSize:s,color:D,realToCanvasMat:o,anchorAlignment:"center",rotation:-tA})}}var OUt="rgba(255,255,255,0.5)";function WUt(t){const{ctx:A,pcbFabricationNoteDimension:e,realToCanvasMat:i}=t,o=e.color??OUt;_ee({ctx:A,from:e.from,to:e.to,realToCanvasMat:i,color:o,fontSize:e.font_size??1,arrowSize:e.arrow_size??1,text:e.text,textRotation:e.text_ccw_rotation,offset:e.offset_distance&&e.offset_direction?{distance:e.offset_distance,direction:e.offset_direction}:void 0})}function jH(t){const{ctx:A,start:e,end:i,strokeWidth:o,stroke:n,realToCanvasMat:s,lineCap:r="round"}=t,[a,g]=ao(s,[e.x,e.y]),[I,c]=ao(s,[i.x,i.y]),B=o*Math.abs(s.a);A.beginPath(),A.moveTo(a,g),A.lineTo(I,c),A.lineWidth=B,A.strokeStyle=n,A.lineCap=r,A.stroke()}function ZUt(t){const{ctx:A,path:e,realToCanvasMat:i}=t,n=e.color??"rgba(255,255,255,0.5)";if(!(!e.route||e.route.length<2))for(let s=0;s<e.route.length-1;s++){const r=e.route[s],a=e.route[s+1];!r||!a||jH({ctx:A,start:{x:r.x,y:r.y},end:{x:a.x,y:a.y},strokeWidth:e.stroke_width??.1,stroke:n,realToCanvasMat:i})}}function VUt(t){const{ctx:A,rect:e,realToCanvasMat:i}=t,n=e.color??"rgba(255,255,255,0.5)",s=e.is_filled??!1,r=e.has_stroke??!0,a=e.is_stroke_dashed??!1;y0({ctx:A,center:e.center,width:e.width,height:e.height,fill:s?n:void 0,stroke:r?n:void 0,strokeWidth:r?e.stroke_width:void 0,borderRadius:e.corner_radius,realToCanvasMat:i,isStrokeDashed:a})}var jUt="rgba(255,255,255,0.5)";function zUt(t,A){return jUt}function XUt(t){const{ctx:A,text:e,realToCanvasMat:i}=t,o=zUt(e.layer),n=e.color??o,s=e.font_size;vhA({ctx:A,text:e.text,x:e.anchor_position.x,y:e.anchor_position.y,fontSize:s,color:n,realToCanvasMat:i,anchorAlignment:e.anchor_alignment})}function zH(t){const{ctx:A,center:e,radius_x:i,radius_y:o,fill:n,stroke:s,strokeWidth:r=.1,realToCanvasMat:a,rotation:g=0}=t,[I,c]=ao(a,[e.x,e.y]),B=i*Math.abs(a.a),l=o*Math.abs(a.a),C=r*Math.abs(a.a);A.save(),A.translate(I,c),g!==0&&A.rotate(-g*(Math.PI/180)),A.beginPath(),A.ellipse(0,0,B,l,0,0,Math.PI*2),n&&(A.fillStyle=n,A.fill()),s&&(A.strokeStyle=s,A.lineWidth=C,A.stroke()),A.restore()}function cD(t){const{ctx:A,center:e,width:i,height:o,fill:n,realToCanvasMat:s,rotation:r=0,stroke:a,strokeWidth:g}=t,[I,c]=ao(s,[e.x,e.y]),B=i*Math.abs(s.a),l=o*Math.abs(s.a),C=g?g*Math.abs(s.a):void 0;if(A.save(),A.translate(I,c),r!==0&&A.rotate(-r*(Math.PI/180)),A.beginPath(),B>l){const Q=l/2,E=B-l;A.moveTo(-E/2,-Q),A.lineTo(E/2,-Q),A.arc(E/2,0,Q,-Math.PI/2,Math.PI/2),A.lineTo(-E/2,Q),A.arc(-E/2,0,Q,Math.PI/2,-Math.PI/2)}else if(l>B){const Q=B/2,E=l-B;A.moveTo(Q,-E/2),A.lineTo(Q,E/2),A.arc(0,E/2,Q,0,Math.PI),A.lineTo(-Q,-E/2),A.arc(0,-E/2,Q,Math.PI,0)}else A.arc(0,0,B/2,0,Math.PI*2);A.closePath(),n&&(A.fillStyle=n,A.fill()),a&&C&&(A.strokeStyle=a,A.lineWidth=C,A.stroke()),A.restore()}function QZ(t){return"ccw_rotation"in t&&typeof t.ccw_rotation=="number"?t.ccw_rotation:0}function $Ut(t){const{ctx:A,hole:e,realToCanvasMat:i,colorMap:o,soldermaskMargin:n=0}=t;if(e.is_covered_with_solder_mask===!0)return;const s=n<0?Math.abs(n):0;if(e.hole_shape==="circle"){ID({ctx:A,center:{x:e.x,y:e.y},radius:e.hole_diameter/2-s,fill:o.drill,realToCanvasMat:i});return}if(e.hole_shape==="square"){const r=QZ(e);y0({ctx:A,center:{x:e.x,y:e.y},width:e.hole_diameter-s*2,height:e.hole_diameter-s*2,fill:o.drill,realToCanvasMat:i,rotation:r});return}if(e.hole_shape==="oval"){const r=QZ(e);zH({ctx:A,center:{x:e.x,y:e.y},radius_x:e.hole_width/2-s,radius_y:e.hole_height/2-s,fill:o.drill,realToCanvasMat:i,rotation:r});return}if(e.hole_shape==="rect"){const r=QZ(e);y0({ctx:A,center:{x:e.x,y:e.y},width:e.hole_width-s*2,height:e.hole_height-s*2,fill:o.drill,realToCanvasMat:i,rotation:r});return}if(e.hole_shape==="pill"||e.hole_shape==="rotated_pill"){const r=QZ(e);cD({ctx:A,center:{x:e.x,y:e.y},width:e.hole_width-s*2,height:e.hole_height-s*2,fill:o.drill,realToCanvasMat:i,rotation:r});return}}function ALt(t,A){const e=parseInt(t.slice(1,3),16),i=parseInt(t.slice(3,5),16),o=parseInt(t.slice(5,7),16);return`rgba(${e}, ${i}, ${o}, ${A})`}function eLt(t){const{ctx:A,keepout:e,realToCanvasMat:i,colorMap:o}=t,n=o.keepout,s=ALt(o.keepout,.2),r=1;if(e.shape==="rect"){const[a,g]=ao(i,[e.center.x,e.center.y]),I=e.width*Math.abs(i.a),c=e.height*Math.abs(i.a),B=e.rotation??0;A.save(),A.translate(a,g),B!==0&&A.rotate(-B*(Math.PI/180)),A.beginPath(),A.rect(-I/2,-c/2,I,c),A.fillStyle=s,A.fill(),A.beginPath(),A.rect(-I/2,-c/2,I,c),A.clip();const l=r*Math.abs(i.a),C=Math.sqrt(I*I+c*c),Q=I/2,E=c/2;A.strokeStyle=n,A.lineWidth=.15*Math.abs(i.a),A.setLineDash([]);for(let h=-C;h<C*2;h+=l){A.beginPath();const u=-Q+h,d=-E,f=-Q+h+C,m=-E+C;A.moveTo(u,d),A.lineTo(f,m),A.stroke()}A.restore();return}if(e.shape==="circle"){const[a,g]=ao(i,[e.center.x,e.center.y]),I=e.radius*Math.abs(i.a),c=r*Math.abs(i.a);A.save(),A.translate(a,g),A.beginPath(),A.arc(0,0,I,0,Math.PI*2),A.fillStyle=s,A.fill(),A.beginPath(),A.arc(0,0,I,0,Math.PI*2),A.clip();const B=I*2;A.strokeStyle=n,A.lineWidth=.15*Math.abs(i.a),A.setLineDash([]);for(let l=-B;l<B*2;l+=c)A.beginPath(),A.moveTo(l-B,-B),A.lineTo(l+B,B),A.stroke();A.restore();return}}var tLt="rgba(255,255,255,0.5)";function iLt(t){const{ctx:A,pcbNoteDimension:e,realToCanvasMat:i}=t,o=e.color??tLt;_ee({ctx:A,from:e.from,to:e.to,realToCanvasMat:i,color:o,fontSize:e.font_size,arrowSize:e.arrow_size,text:e.text,textRotation:e.text_ccw_rotation,offset:e.offset_distance&&e.offset_direction?{distance:e.offset_distance,direction:e.offset_direction}:void 0})}function oLt(t){const{ctx:A,line:e,realToCanvasMat:i}=t,n=e.color??"rgb(89, 148, 220)",s=e.stroke_width??.1,r=e.is_dashed??!1,[a,g]=ao(i,[e.x1,e.y1]),[I,c]=ao(i,[e.x2,e.y2]),B=s*Math.abs(i.a);A.save(),r?A.setLineDash([B*2,B*2]):A.setLineDash([]),A.beginPath(),A.moveTo(a,g),A.lineTo(I,c),A.lineWidth=B,A.strokeStyle=n,A.lineCap="round",A.stroke(),A.restore()}function nLt(t){const{ctx:A,path:e,realToCanvasMat:i}=t,n=e.color??"rgb(89, 148, 220)";if(!(!e.route||e.route.length<2))for(let s=0;s<e.route.length-1;s++){const r=e.route[s],a=e.route[s+1];!r||!a||jH({ctx:A,start:{x:r.x,y:r.y},end:{x:a.x,y:a.y},strokeWidth:e.stroke_width??.1,stroke:n,realToCanvasMat:i})}}function sLt(t){const{ctx:A,rect:e,realToCanvasMat:i}=t,n=e.color??"rgb(89, 148, 220)",s=e.is_filled??!1,r=e.has_stroke??!0,a=e.is_stroke_dashed??!1;y0({ctx:A,center:e.center,width:e.width,height:e.height,fill:s?n:void 0,stroke:r?n:void 0,strokeWidth:r?e.stroke_width:void 0,borderRadius:e.corner_radius,realToCanvasMat:i,isStrokeDashed:a})}var rLt="rgb(89, 148, 220)";function aLt(t){const{ctx:A,text:e,realToCanvasMat:i}=t,o=rLt,n=e.color??o,s=e.font_size??1;vhA({ctx:A,text:e.text??"",x:e.anchor_position.x,y:e.anchor_position.y,fontSize:s,color:n,realToCanvasMat:i,anchorAlignment:e.anchor_alignment??"center"})}function gLt(t){const{ctx:A,panel:e,realToCanvasMat:i,colorMap:o,drawBoardMaterial:n}=t,{width:s,height:r,center:a}=e;if(s!==void 0&&r!==void 0&&a){n&&y0({ctx:A,center:a,width:s,height:r,fill:o.substrate,realToCanvasMat:i});const g=s/2,I=r/2,c=[{x:a.x-g,y:a.y-I},{x:a.x+g,y:a.y-I},{x:a.x+g,y:a.y+I},{x:a.x-g,y:a.y+I}];BZ({ctx:A,points:c,stroke:o.boardOutline,strokeWidth:.5,realToCanvasMat:i,closePath:!0})}}function XH(t,A){if(t.length<3||A===0)return t;let e=0,i=0;for(const n of t)e+=n.x,i+=n.y;e/=t.length,i/=t.length;const o=[];for(const n of t){const s=n.x-e,r=n.y-i,a=Math.sqrt(s*s+r*r);if(a>0){const g=s/a,I=r/a;o.push({x:n.x+g*A,y:n.y+I*A})}else o.push({x:n.x+A,y:n.y})}return o}function ILt(t){const{ctx:A,hole:e,realToCanvasMat:i,colorMap:o,soldermaskMargin:n=0,drawSoldermask:s}=t;if(e.is_covered_with_solder_mask===!0&&s)return;const r=o.copper.top,a=n<0?Math.abs(n):0;if(e.shape==="circle"){ID({ctx:A,center:{x:e.x,y:e.y},radius:e.outer_diameter/2-a,fill:r,realToCanvasMat:i}),ID({ctx:A,center:{x:e.x,y:e.y},radius:e.hole_diameter/2,fill:o.drill,realToCanvasMat:i});return}if(e.shape==="oval"){zH({ctx:A,center:{x:e.x,y:e.y},radius_x:e.outer_width/2-a,radius_y:e.outer_height/2-a,fill:r,realToCanvasMat:i,rotation:e.ccw_rotation}),zH({ctx:A,center:{x:e.x,y:e.y},radius_x:e.hole_width/2,radius_y:e.hole_height/2,fill:o.drill,realToCanvasMat:i,rotation:e.ccw_rotation});return}if(e.shape==="pill"){cD({ctx:A,center:{x:e.x,y:e.y},width:e.outer_width-a*2,height:e.outer_height-a*2,fill:r,realToCanvasMat:i,rotation:e.ccw_rotation}),cD({ctx:A,center:{x:e.x,y:e.y},width:e.hole_width,height:e.hole_height,fill:o.drill,realToCanvasMat:i,rotation:e.ccw_rotation});return}if(e.shape==="circular_hole_with_rect_pad"){y0({ctx:A,center:{x:e.x,y:e.y},width:e.rect_pad_width-a*2,height:e.rect_pad_height-a*2,fill:r,realToCanvasMat:i,borderRadius:e.rect_border_radius?Math.max(0,e.rect_border_radius-a):0});const g=e.x+(e.hole_offset_x??0),I=e.y+(e.hole_offset_y??0);ID({ctx:A,center:{x:g,y:I},radius:e.hole_diameter/2,fill:o.drill,realToCanvasMat:i});return}if(e.shape==="pill_hole_with_rect_pad"){y0({ctx:A,center:{x:e.x,y:e.y},width:e.rect_pad_width-a*2,height:e.rect_pad_height-a*2,fill:r,realToCanvasMat:i,borderRadius:e.rect_border_radius?Math.max(0,e.rect_border_radius-a):0});const g=e.x+(e.hole_offset_x??0),I=e.y+(e.hole_offset_y??0);cD({ctx:A,center:{x:g,y:I},width:e.hole_width,height:e.hole_height,fill:o.drill,realToCanvasMat:i});return}if(e.shape==="rotated_pill_hole_with_rect_pad"){y0({ctx:A,center:{x:e.x,y:e.y},width:e.rect_pad_width-a*2,height:e.rect_pad_height-a*2,fill:r,realToCanvasMat:i,borderRadius:e.rect_border_radius?Math.max(0,e.rect_border_radius-a):0,rotation:e.rect_ccw_rotation});const g=e.x+(e.hole_offset_x??0),I=e.y+(e.hole_offset_y??0);cD({ctx:A,center:{x:g,y:I},width:e.hole_width,height:e.hole_height,fill:o.drill,realToCanvasMat:i,rotation:e.hole_ccw_rotation});return}if(e.shape==="hole_with_polygon_pad"){const g=e.pad_outline;if(g&&g.length>=3){const l=g.map(Q=>({x:e.x+Q.x,y:e.y+Q.y})),C=a>0?XH(l,-a):l;C.length>=3&&lZ({ctx:A,points:C,fill:r,realToCanvasMat:i})}const I=e.x+(e.hole_offset_x??0),c=e.y+(e.hole_offset_y??0),B=e.hole_shape;B==="circle"?ID({ctx:A,center:{x:I,y:c},radius:(e.hole_diameter??0)/2,fill:o.drill,realToCanvasMat:i}):B==="oval"?zH({ctx:A,center:{x:I,y:c},radius_x:(e.hole_width??0)/2,radius_y:(e.hole_height??0)/2,fill:o.drill,realToCanvasMat:i}):B==="pill"?cD({ctx:A,center:{x:I,y:c},width:e.hole_width??0,height:e.hole_height??0,fill:o.drill,realToCanvasMat:i}):B==="rotated_pill"&&cD({ctx:A,center:{x:I,y:c},width:e.hole_width??0,height:e.hole_height??0,fill:o.drill,realToCanvasMat:i});return}}function cLt(t,A){return t==="bottom"?A.silkscreen.bottom:A.silkscreen.top}function BLt(t){const{ctx:A,circle:e,realToCanvasMat:i,colorMap:o}=t,n=cLt(e.layer,o);ID({ctx:A,center:e.center,radius:e.radius,fill:n,realToCanvasMat:i})}function lLt(t,A){return t==="bottom"?A.silkscreen.bottom:A.silkscreen.top}function CLt(t){const{ctx:A,line:e,realToCanvasMat:i,colorMap:o}=t,n=lLt(e.layer,o);jH({ctx:A,start:{x:e.x1,y:e.y1},end:{x:e.x2,y:e.y2},strokeWidth:e.stroke_width??.1,stroke:n,realToCanvasMat:i})}function QLt(t,A){return t==="bottom"?A.silkscreen.bottom:A.silkscreen.top}function ELt(t){const{ctx:A,oval:e,realToCanvasMat:i,colorMap:o}=t,n=QLt(e.layer,o);zH({ctx:A,center:e.center,radius_x:e.radius_x,radius_y:e.radius_y,stroke:n,strokeWidth:.1,realToCanvasMat:i,rotation:e.ccw_rotation??0})}function hLt(t,A){return t==="bottom"?A.silkscreen.bottom:A.silkscreen.top}function uLt(t){const{ctx:A,path:e,realToCanvasMat:i,colorMap:o}=t,n=hLt(e.layer,o);if(!(!e.route||e.route.length<2))for(let s=0;s<e.route.length-1;s++){const r=e.route[s],a=e.route[s+1];!r||!a||jH({ctx:A,start:{x:r.x,y:r.y},end:{x:a.x,y:a.y},strokeWidth:e.stroke_width??.1,stroke:n,realToCanvasMat:i})}}function dLt(t,A){return t==="bottom"?A.silkscreen.bottom:A.silkscreen.top}function pLt(t){const{ctx:A,pill:e,realToCanvasMat:i,colorMap:o}=t,n=dLt(e.layer,o);cD({ctx:A,center:e.center,width:e.width,height:e.height,stroke:n,strokeWidth:.2,realToCanvasMat:i})}function fLt(t,A){return t==="bottom"?A.silkscreen.bottom:A.silkscreen.top}function yLt(t){const{ctx:A,rect:e,realToCanvasMat:i,colorMap:o}=t,n=fLt(e.layer,o);y0({ctx:A,center:e.center,width:e.width,height:e.height,fill:n,realToCanvasMat:i})}function wLt(t,A){return t==="bottom"?A.silkscreen.bottom:A.silkscreen.top}function mLt(t){return t||"center"}function DLt(t){const{ctx:A,text:e,realToCanvasMat:i,colorMap:o}=t,n=e.text??"";if(!n)return;const s=wLt(e.layer,o),[r,a]=ao(i,[e.anchor_position.x,e.anchor_position.y]),g=Math.abs(i.a),I=(e.font_size??1)*g,c=e.ccw_rotation??0,B=CZ(n,I),l=mLt(e.anchor_alignment),C=MhA(l,B);A.save(),A.translate(r,a),c!==0&&A.rotate(-c*(Math.PI/180)),e.layer==="bottom"&&A.scale(-1,1),A.lineWidth=B.strokeWidth,A.lineCap="round",A.lineJoin="round",A.strokeStyle=s;const{lines:Q,lineWidths:E,lineHeight:h,width:u,strokeWidth:d}=B;Q.forEach((f,m)=>{const S=C.x+NhA({alignment:l,lineWidth:E[m],maxWidth:u,strokeWidth:d}),D=C.y+m*h;_hA({ctx:A,line:f,fontSize:I,startX:S,startY:D,layout:B})}),A.restore()}function SLt(t,A){return A.copper[t]??A.copper.top}function vee(t){return t.shape==="rect"||t.shape==="rotated_rect"?t.corner_radius??t.rect_border_radius??0:0}function bLt(t){const{ctx:A,pad:e,realToCanvasMat:i,colorMap:o}=t,n=SLt(e.layer,o);if(e.shape==="rect"){y0({ctx:A,center:{x:e.x,y:e.y},width:e.width,height:e.height,fill:n,realToCanvasMat:i,borderRadius:vee(e)});return}if(e.shape==="rotated_rect"){y0({ctx:A,center:{x:e.x,y:e.y},width:e.width,height:e.height,fill:n,realToCanvasMat:i,borderRadius:vee(e),rotation:e.ccw_rotation??0});return}if(e.shape==="circle"){ID({ctx:A,center:{x:e.x,y:e.y},radius:e.radius,fill:n,realToCanvasMat:i});return}if(e.shape==="pill"){cD({ctx:A,center:{x:e.x,y:e.y},width:e.width,height:e.height,fill:n,realToCanvasMat:i});return}if(e.shape==="rotated_pill"){cD({ctx:A,center:{x:e.x,y:e.y},width:e.width,height:e.height,fill:n,realToCanvasMat:i,rotation:e.ccw_rotation??0});return}if(e.shape==="polygon"){e.points&&e.points.length>=3&&lZ({ctx:A,points:e.points,fill:n,realToCanvasMat:i});return}}function Ik(t){const{ctx:A,points:e}=t;if(e.length<3)return;const i=e[0];if(i){A.moveTo(i.x,i.y);for(let o=1;o<e.length;o++){const n=e[o];n&&A.lineTo(n.x,n.y)}A.closePath()}}function xLt(t){const{ctx:A,board:e,realToCanvasMat:i,soldermaskColor:o}=t,{width:n,height:s,center:r,outline:a}=e;if(a&&Array.isArray(a)&&a.length>=3){const g=a.map(I=>{const[c,B]=ao(i,[I.x,I.y]);return{x:c,y:B}});A.beginPath(),Ik({ctx:A,points:g}),A.fillStyle=o,A.fill()}else if(n!==void 0&&s!==void 0&&r){const[g,I]=ao(i,[r.x,r.y]),c=n*Math.abs(i.a),B=s*Math.abs(i.a);A.fillStyle=o,A.fillRect(g-c/2,I-B/2,c,B)}}function ck(t){const{ctx:A,cx:e,cy:i,width:o,height:n,radius:s}=t,r=e-o/2,a=i-n/2,g=Math.min(s,o/2,n/2);g>0?(A.moveTo(r+g,a),A.lineTo(r+o-g,a),A.arcTo(r+o,a,r+o,a+g,g),A.lineTo(r+o,a+n-g),A.arcTo(r+o,a+n,r+o-g,a+n,g),A.lineTo(r+g,a+n),A.arcTo(r,a+n,r,a+n-g,g),A.lineTo(r,a+g),A.arcTo(r,a,r+g,a,g)):A.rect(r,a,o,n),A.closePath()}function kLt(t){const{ctx:A,cutout:e,realToCanvasMat:i,colorMap:o}=t;if(A.fillStyle=o.drill,e.shape==="rect"){const[n,s]=ao(i,[e.center?.x??0,e.center?.y??0]),r=e.width*Math.abs(i.a),a=e.height*Math.abs(i.a),g=(e.corner_radius??0)*Math.abs(i.a);A.save(),A.translate(n,s),e.rotation&&A.rotate(-e.rotation*Math.PI/180),A.beginPath(),ck({ctx:A,cx:0,cy:0,width:r,height:a,radius:g}),A.restore(),A.fill()}else if(e.shape==="circle"){const[n,s]=ao(i,[e.center?.x??0,e.center?.y??0]),r=e.radius*Math.abs(i.a);A.beginPath(),A.arc(n,s,r,0,Math.PI*2),A.closePath(),A.fill()}else if(e.shape==="polygon"&&e.points&&e.points.length>=3){const n=e.points.map(s=>{const[r,a]=ao(i,[s.x,s.y]);return{x:r,y:a}});A.beginPath(),Ik({ctx:A,points:n}),A.fill()}}function OS(t){const{ctx:A,cx:e,cy:i,width:o,height:n}=t;if(o>n){const s=n/2,r=o-n;A.moveTo(e-r/2,i-s),A.lineTo(e+r/2,i-s),A.arc(e+r/2,i,s,-Math.PI/2,Math.PI/2),A.lineTo(e-r/2,i+s),A.arc(e-r/2,i,s,Math.PI/2,-Math.PI/2)}else if(n>o){const s=o/2,r=n-o;A.moveTo(e+s,i-r/2),A.lineTo(e+s,i+r/2),A.arc(e,i+r/2,s,0,Math.PI),A.lineTo(e-s,i-r/2),A.arc(e,i-r/2,s,Math.PI,0)}else A.arc(e,i,o/2,0,Math.PI*2);A.closePath()}function GLt(t){const{ctx:A,hole:e,realToCanvasMat:i,colorMap:o,soldermaskOverCopperColor:n,drawSoldermask:s}=t,r=s&&e.is_covered_with_solder_mask===!0,a=s?e.soldermask_margin??0:0;r?(A.fillStyle=n,$H({ctx:A,hole:e,realToCanvasMat:i,margin:0}),A.fill()):a<0?(A.fillStyle=o.drill,$H({ctx:A,hole:e,realToCanvasMat:i,margin:0}),A.fill(),FLt({ctx:A,hole:e,realToCanvasMat:i,soldermaskOverCopperColor:n,margin:a})):a>0?(A.fillStyle=o.substrate,$H({ctx:A,hole:e,realToCanvasMat:i,margin:a}),A.fill(),A.fillStyle=o.drill,$H({ctx:A,hole:e,realToCanvasMat:i,margin:0}),A.fill()):(A.fillStyle=o.drill,$H({ctx:A,hole:e,realToCanvasMat:i,margin:0}),A.fill())}function Uee(t){return"ccw_rotation"in t&&typeof t.ccw_rotation=="number"?t.ccw_rotation:0}function $H(t){const{ctx:A,hole:e,realToCanvasMat:i,margin:o}=t,n=Uee(e);if(e.hole_shape==="circle"){const[s,r]=ao(i,[e.x,e.y]),a=(e.hole_diameter/2+o)*Math.abs(i.a);A.beginPath(),A.arc(s,r,a,0,Math.PI*2),A.closePath()}else if(e.hole_shape==="square"){const[s,r]=ao(i,[e.x,e.y]),a=(e.hole_diameter+o*2)*Math.abs(i.a);A.save(),A.translate(s,r),n!==0&&A.rotate(-n*Math.PI/180),A.beginPath(),A.rect(-a/2,-a/2,a,a),A.closePath(),A.restore()}else if(e.hole_shape==="oval"){const[s,r]=ao(i,[e.x,e.y]),a=(e.hole_width/2+o)*Math.abs(i.a),g=(e.hole_height/2+o)*Math.abs(i.a);A.save(),A.translate(s,r),n!==0&&A.rotate(-n*Math.PI/180),A.beginPath(),A.ellipse(0,0,a,g,0,0,Math.PI*2),A.closePath(),A.restore()}else if(e.hole_shape==="rect"){const[s,r]=ao(i,[e.x,e.y]),a=(e.hole_width+o*2)*Math.abs(i.a),g=(e.hole_height+o*2)*Math.abs(i.a);A.save(),A.translate(s,r),n!==0&&A.rotate(-n*Math.PI/180),A.beginPath(),A.rect(-a/2,-g/2,a,g),A.closePath(),A.restore()}else if(e.hole_shape==="pill"||e.hole_shape==="rotated_pill"){const[s,r]=ao(i,[e.x,e.y]),a=(e.hole_width+o*2)*Math.abs(i.a),g=(e.hole_height+o*2)*Math.abs(i.a);A.save(),A.translate(s,r),n!==0&&A.rotate(-n*Math.PI/180),A.beginPath(),OS({ctx:A,cx:0,cy:0,width:a,height:g}),A.restore()}}function FLt(t){const{ctx:A,hole:e,realToCanvasMat:i,soldermaskOverCopperColor:o,margin:n}=t,s=Math.abs(n),r=Uee(e);if(A.fillStyle=o,e.hole_shape==="circle"){const[a,g]=ao(i,[e.x,e.y]),I=e.hole_diameter/2*Math.abs(i.a),c=s*Math.abs(i.a),B=Math.max(0,I-c);A.save(),A.beginPath(),A.arc(a,g,I,0,Math.PI*2),B>0&&A.arc(a,g,B,0,Math.PI*2,!0),A.fill("evenodd"),A.restore()}else if(e.hole_shape==="square"){const[a,g]=ao(i,[e.x,e.y]),I=e.hole_diameter*Math.abs(i.a),c=s*Math.abs(i.a),B=Math.max(0,I-c*2);A.save(),A.translate(a,g),r!==0&&A.rotate(-r*Math.PI/180),A.beginPath(),A.rect(-I/2,-I/2,I,I),B>0&&A.rect(-B/2,-B/2,B,B),A.fill("evenodd"),A.restore()}else if(e.hole_shape==="oval"){const[a,g]=ao(i,[e.x,e.y]),I=e.hole_width/2*Math.abs(i.a),c=e.hole_height/2*Math.abs(i.a),B=s*Math.abs(i.a),l=Math.max(0,I-B),C=Math.max(0,c-B);A.save(),A.translate(a,g),r!==0&&A.rotate(-r*Math.PI/180),A.beginPath(),A.ellipse(0,0,I,c,0,0,Math.PI*2),l>0&&C>0&&(A.moveTo(l,0),A.ellipse(0,0,l,C,0,0,Math.PI*2)),A.fill("evenodd"),A.restore()}else if(e.hole_shape==="rect"){const[a,g]=ao(i,[e.x,e.y]),I=e.hole_width*Math.abs(i.a),c=e.hole_height*Math.abs(i.a),B=s*Math.abs(i.a),l=Math.max(0,I-B*2),C=Math.max(0,c-B*2);A.save(),A.translate(a,g),r!==0&&A.rotate(-r*Math.PI/180),A.beginPath(),A.rect(-I/2,-c/2,I,c),l>0&&C>0&&A.rect(-l/2,-C/2,l,C),A.fill("evenodd"),A.restore()}else if(e.hole_shape==="pill"||e.hole_shape==="rotated_pill"){const[a,g]=ao(i,[e.x,e.y]),I=e.hole_width*Math.abs(i.a),c=e.hole_height*Math.abs(i.a),B=s*Math.abs(i.a);A.save(),A.translate(a,g),r!==0&&A.rotate(-r*Math.PI/180),A.beginPath(),OS({ctx:A,cx:0,cy:0,width:I,height:c});const l=I-B*2,C=c-B*2;l>0&&C>0&&OS({ctx:A,cx:0,cy:0,width:l,height:C}),A.fill("evenodd"),A.restore()}}function RLt(t){const{ctx:A,hole:e,realToCanvasMat:i,colorMap:o,soldermaskOverCopperColor:n,layer:s,drawSoldermask:r}=t;if(e.layers&&!e.layers.includes(s))return;const a=r&&e.is_covered_with_solder_mask===!0,g=r?e.soldermask_margin??0:0,I=o.copper.top;a?(A.fillStyle=n,AY({ctx:A,hole:e,realToCanvasMat:i,margin:0}),A.fill()):g<0?(A.fillStyle=I,AY({ctx:A,hole:e,realToCanvasMat:i,margin:0}),A.fill(),MLt({ctx:A,hole:e,realToCanvasMat:i,soldermaskOverCopperColor:n,margin:g})):g>0?(A.fillStyle=o.substrate,AY({ctx:A,hole:e,realToCanvasMat:i,margin:g}),A.fill(),A.fillStyle=I,AY({ctx:A,hole:e,realToCanvasMat:i,margin:0}),A.fill()):(A.fillStyle=I,AY({ctx:A,hole:e,realToCanvasMat:i,margin:0}),A.fill())}function AY(t){const{ctx:A,hole:e,realToCanvasMat:i,margin:o}=t;if(e.shape==="circle"){const[n,s]=ao(i,[e.x,e.y]),r=(e.outer_diameter/2+o)*Math.abs(i.a);A.beginPath(),A.arc(n,s,r,0,Math.PI*2),A.closePath()}else if(e.shape==="oval"){const[n,s]=ao(i,[e.x,e.y]),r=(e.outer_width/2+o)*Math.abs(i.a),a=(e.outer_height/2+o)*Math.abs(i.a);A.save(),A.translate(n,s),e.ccw_rotation&&e.ccw_rotation!==0&&A.rotate(-(e.ccw_rotation*Math.PI)/180),A.beginPath(),A.ellipse(0,0,r,a,0,0,Math.PI*2),A.closePath(),A.restore()}else if(e.shape==="pill"){const[n,s]=ao(i,[e.x,e.y]),r=(e.outer_width+o*2)*Math.abs(i.a),a=(e.outer_height+o*2)*Math.abs(i.a);A.save(),A.translate(n,s),e.ccw_rotation&&e.ccw_rotation!==0&&A.rotate(-(e.ccw_rotation*Math.PI)/180),A.beginPath(),OS({ctx:A,cx:0,cy:0,width:r,height:a}),A.restore()}else if(e.shape==="circular_hole_with_rect_pad"||e.shape==="pill_hole_with_rect_pad"){const[n,s]=ao(i,[e.x,e.y]),r=(e.rect_pad_width+o*2)*Math.abs(i.a),a=(e.rect_pad_height+o*2)*Math.abs(i.a),g=(e.rect_border_radius??0)*Math.abs(i.a);A.beginPath(),ck({ctx:A,cx:n,cy:s,width:r,height:a,radius:g})}else if(e.shape==="rotated_pill_hole_with_rect_pad"){const[n,s]=ao(i,[e.x,e.y]),r=(e.rect_pad_width+o*2)*Math.abs(i.a),a=(e.rect_pad_height+o*2)*Math.abs(i.a),g=(e.rect_border_radius??0)*Math.abs(i.a);A.save(),A.translate(n,s),e.rect_ccw_rotation&&A.rotate(-e.rect_ccw_rotation*Math.PI/180),A.beginPath(),ck({ctx:A,cx:0,cy:0,width:r,height:a,radius:g}),A.restore()}else if(e.shape==="hole_with_polygon_pad"&&e.pad_outline&&e.pad_outline.length>=3){const n=e.pad_outline.map(a=>({x:e.x+a.x,y:e.y+a.y})),r=(o!==0?XH(n,o):n).map(a=>{const[g,I]=ao(i,[a.x,a.y]);return{x:g,y:I}});A.beginPath(),Ik({ctx:A,points:r})}}function MLt(t){const{ctx:A,hole:e,realToCanvasMat:i,soldermaskOverCopperColor:o,margin:n}=t,s=Math.abs(n);if(A.fillStyle=o,e.shape==="circle"){const[r,a]=ao(i,[e.x,e.y]),g=e.outer_diameter/2*Math.abs(i.a),I=s*Math.abs(i.a),c=Math.max(0,g-I);A.save(),A.beginPath(),A.arc(r,a,g,0,Math.PI*2),c>0&&A.arc(r,a,c,0,Math.PI*2,!0),A.fill("evenodd"),A.restore()}else if(e.shape==="oval"){const[r,a]=ao(i,[e.x,e.y]),g=e.outer_width/2*Math.abs(i.a),I=e.outer_height/2*Math.abs(i.a),c=s*Math.abs(i.a),B=Math.max(0,g-c),l=Math.max(0,I-c);A.save(),A.translate(r,a),e.ccw_rotation&&e.ccw_rotation!==0&&A.rotate(-(e.ccw_rotation*Math.PI)/180),A.beginPath(),A.ellipse(0,0,g,I,0,0,Math.PI*2),B>0&&l>0&&(A.moveTo(B,0),A.ellipse(0,0,B,l,0,0,Math.PI*2)),A.fill("evenodd"),A.restore()}else if(e.shape==="pill"){const[r,a]=ao(i,[e.x,e.y]),g=e.outer_width*Math.abs(i.a),I=e.outer_height*Math.abs(i.a),c=s*Math.abs(i.a);A.save(),A.translate(r,a),e.ccw_rotation&&e.ccw_rotation!==0&&A.rotate(-(e.ccw_rotation*Math.PI)/180),A.beginPath(),OS({ctx:A,cx:0,cy:0,width:g,height:I});const B=g-c*2,l=I-c*2;B>0&&l>0&&OS({ctx:A,cx:0,cy:0,width:B,height:l}),A.fill("evenodd"),A.restore()}else if(e.shape==="circular_hole_with_rect_pad"||e.shape==="pill_hole_with_rect_pad"||e.shape==="rotated_pill_hole_with_rect_pad"){const[r,a]=ao(i,[e.x,e.y]),g=e.rect_pad_width*Math.abs(i.a),I=e.rect_pad_height*Math.abs(i.a),c=s*Math.abs(i.a);A.save(),A.translate(r,a),e.shape==="rotated_pill_hole_with_rect_pad"&&e.rect_ccw_rotation&&A.rotate(-e.rect_ccw_rotation*Math.PI/180);const B=e.rect_border_radius?e.rect_border_radius*Math.abs(i.a):0;A.beginPath(),ck({ctx:A,cx:0,cy:0,width:g,height:I,radius:B});const l=g-c*2,C=I-c*2;if(l>0&&C>0){const Q=Math.max(0,B-c);ck({ctx:A,cx:0,cy:0,width:l,height:C,radius:Q})}A.fill("evenodd"),A.restore()}else if(e.shape==="hole_with_polygon_pad"&&e.pad_outline&&e.pad_outline.length>=3){const r=e.pad_outline.map(I=>({x:e.x+I.x,y:e.y+I.y}));A.save(),A.beginPath();const a=r.map(I=>{const[c,B]=ao(i,[I.x,I.y]);return{x:c,y:B}});Ik({ctx:A,points:a});const g=XH(r,-s);if(g.length>=3){const I=g.map(c=>{const[B,l]=ao(i,[c.x,c.y]);return{x:B,y:l}});Ik({ctx:A,points:I})}A.fill("evenodd"),A.restore()}}function NLt(t){const{ctx:A,pad:e,realToCanvasMat:i,colorMap:o,soldermaskOverCopperColor:n,layer:s,drawSoldermask:r}=t;if(e.layer!==s)return;const a=r&&e.is_covered_with_solder_mask===!0,g=r?e.soldermask_margin??0:0;let I=g,c=g,B=g,l=g;(e.shape==="rect"||e.shape==="rotated_rect")&&(I=e.soldermask_margin_left??g,c=e.soldermask_margin_right??g,B=e.soldermask_margin_top??g,l=e.soldermask_margin_bottom??g);const C=o.copper[e.layer]||o.copper.top;a?(A.fillStyle=n,eY({ctx:A,pad:e,realToCanvasMat:i,ml:0,mr:0,mt:0,mb:0}),A.fill()):I<0||c<0||B<0||l<0?(A.fillStyle=C,eY({ctx:A,pad:e,realToCanvasMat:i,ml:0,mr:0,mt:0,mb:0}),A.fill(),_Lt({ctx:A,pad:e,realToCanvasMat:i,soldermaskOverCopperColor:n,ml:I,mr:c,mt:B,mb:l})):I>0||c>0||B>0||l>0?(A.fillStyle=o.substrate,eY({ctx:A,pad:e,realToCanvasMat:i,ml:I,mr:c,mt:B,mb:l}),A.fill(),A.fillStyle=C,eY({ctx:A,pad:e,realToCanvasMat:i,ml:0,mr:0,mt:0,mb:0}),A.fill()):(A.fillStyle=C,eY({ctx:A,pad:e,realToCanvasMat:i,ml:0,mr:0,mt:0,mb:0}),A.fill())}function eY(t){const{ctx:A,pad:e,realToCanvasMat:i,ml:o,mr:n,mt:s,mb:r}=t,a=e.shape==="rotated_rect"||e.shape==="rotated_pill"?e.ccw_rotation??0:0;if(e.shape==="rect"||e.shape==="rotated_rect"){const g=e.corner_radius??e.rect_border_radius??0,I=a*Math.PI/180,c=(n-o)/2,B=(s-r)/2,l=c*Math.cos(I)-B*Math.sin(I),C=c*Math.sin(I)+B*Math.cos(I),[Q,E]=ao(i,[e.x+l,e.y+C]),h=(e.width+o+n)*Math.abs(i.a),u=(e.height+s+r)*Math.abs(i.a),d=g*Math.abs(i.a);A.save(),A.translate(Q,E),a!==0&&A.rotate(-a*Math.PI/180),A.beginPath(),ck({ctx:A,cx:0,cy:0,width:h,height:u,radius:d}),A.restore()}else if(e.shape==="circle"){const g=(o+n+s+r)/4,[I,c]=ao(i,[e.x,e.y]),B=(e.radius+g)*Math.abs(i.a);A.beginPath(),A.arc(I,c,B,0,Math.PI*2),A.closePath()}else if(e.shape==="pill"||e.shape==="rotated_pill"){const g=(o+n)/2,[I,c]=ao(i,[e.x,e.y]),B=(e.width+g*2)*Math.abs(i.a),l=(e.height+g*2)*Math.abs(i.a);A.save(),A.translate(I,c),a!==0&&A.rotate(-a*Math.PI/180),A.beginPath(),OS({ctx:A,cx:0,cy:0,width:B,height:l}),A.restore()}else if(e.shape==="polygon"&&e.points&&e.points.length>=3){const g=(o+n+s+r)/4,c=(g!==0?XH(e.points,g):e.points).map(B=>{const[l,C]=ao(i,[B.x,B.y]);return{x:l,y:C}});A.beginPath(),Ik({ctx:A,points:c})}}function _Lt(t){const{ctx:A,pad:e,realToCanvasMat:i,soldermaskOverCopperColor:o,ml:n,mr:s,mt:r,mb:a}=t,g=e.shape==="rotated_rect"||e.shape==="rotated_pill"?e.ccw_rotation??0:0,I=Math.max(0,-n),c=Math.max(0,-s),B=Math.max(0,-r),l=Math.max(0,-a);if(A.fillStyle=o,e.shape==="rect"||e.shape==="rotated_rect"){const C=e.corner_radius??e.rect_border_radius??0,[Q,E]=ao(i,[e.x,e.y]),h=e.width*Math.abs(i.a),u=e.height*Math.abs(i.a),d=C*Math.abs(i.a),f=I*Math.abs(i.a),m=c*Math.abs(i.a),S=B*Math.abs(i.a),D=l*Math.abs(i.a);A.save(),A.translate(Q,E),g!==0&&A.rotate(-g*Math.PI/180),A.beginPath(),ck({ctx:A,cx:0,cy:0,width:h,height:u,radius:d});const x=h-f-m,F=u-S-D,k=(f-m)/2,v=(S-D)/2,_=Math.max(0,d-(f+m+S+D)/4);x>0&&F>0&&ck({ctx:A,cx:k,cy:v,width:x,height:F,radius:_}),A.fill("evenodd"),A.restore()}else if(e.shape==="circle"){const C=Math.max(I,c,B,l),[Q,E]=ao(i,[e.x,e.y]),h=e.radius*Math.abs(i.a),u=C*Math.abs(i.a),d=Math.max(0,h-u);A.save(),A.beginPath(),A.arc(Q,E,h,0,Math.PI*2),d>0&&A.arc(Q,E,d,0,Math.PI*2,!0),A.fill("evenodd"),A.restore()}else if(e.shape==="pill"||e.shape==="rotated_pill"){const C=Math.max(I,c,B,l),[Q,E]=ao(i,[e.x,e.y]),h=e.width*Math.abs(i.a),u=e.height*Math.abs(i.a),d=C*Math.abs(i.a);A.save(),A.translate(Q,E),g!==0&&A.rotate(-g*Math.PI/180),A.beginPath(),OS({ctx:A,cx:0,cy:0,width:h,height:u});const f=h-d*2,m=u-d*2;f>0&&m>0&&OS({ctx:A,cx:0,cy:0,width:f,height:m}),A.fill("evenodd"),A.restore()}else if(e.shape==="polygon"&&e.points&&e.points.length>=3){const C=Math.max(I,c,B,l);A.save(),A.beginPath();const Q=e.points.map(h=>{const[u,d]=ao(i,[h.x,h.y]);return{x:u,y:d}});Ik({ctx:A,points:Q});const E=XH(e.points,-C);if(E.length>=3){const h=E.map(u=>{const[d,f]=ao(i,[u.x,u.y]);return{x:d,y:f}});Ik({ctx:A,points:h})}A.fill("evenodd"),A.restore()}}function vLt(t){const{ctx:A,via:e,realToCanvasMat:i,colorMap:o}=t,[n,s]=ao(i,[e.x,e.y]),r=e.outer_diameter/2*Math.abs(i.a);A.fillStyle=o.substrate,A.beginPath(),A.arc(n,s,r,0,Math.PI*2),A.closePath(),A.fill()}function ULt(t){const{ctx:A,board:e,elements:i,realToCanvasMat:o,colorMap:n,layer:s,drawSoldermask:r}=t,a=n.soldermask[s]??n.soldermask.top,g=n.soldermaskOverCopper[s]??n.soldermaskOverCopper.top;r&&xLt({ctx:A,board:e,realToCanvasMat:o,soldermaskColor:a});for(const I of i)LLt({ctx:A,element:I,realToCanvasMat:o,colorMap:n,soldermaskOverCopperColor:g,layer:s,drawSoldermask:r})}function LLt(t){const{ctx:A,element:e,realToCanvasMat:i,colorMap:o,soldermaskOverCopperColor:n,layer:s,drawSoldermask:r}=t;e.type==="pcb_smtpad"?NLt({ctx:A,pad:e,realToCanvasMat:i,colorMap:o,soldermaskOverCopperColor:n,layer:s,drawSoldermask:r}):e.type==="pcb_plated_hole"?RLt({ctx:A,hole:e,realToCanvasMat:i,colorMap:o,soldermaskOverCopperColor:n,layer:s,drawSoldermask:r}):e.type==="pcb_hole"?GLt({ctx:A,hole:e,realToCanvasMat:i,colorMap:o,soldermaskOverCopperColor:n,drawSoldermask:r}):e.type==="pcb_via"?vLt({ctx:A,via:e,realToCanvasMat:i,colorMap:o}):e.type==="pcb_cutout"&&kLt({ctx:A,cutout:e,realToCanvasMat:i,colorMap:o})}function HLt(t,A){return A.copper[t]??A.copper.top}function YLt(t){const{ctx:A,trace:e,realToCanvasMat:i,colorMap:o}=t;if(!(!e.route||!Array.isArray(e.route)||e.route.length<2))for(let n=0;n<e.route.length-1;n++){const s=e.route[n],r=e.route[n+1];if(!s||!r)continue;const a="layer"in s?s.layer:"layer"in r?r.layer:null;if(!a)continue;const g=HLt(a,o),I="width"in s?s.width:"width"in r?r.width:.1;jH({ctx:A,start:{x:s.x,y:s.y},end:{x:r.x,y:r.y},strokeWidth:I,stroke:g,realToCanvasMat:i,lineCap:"round"})}}function JLt(t){const{ctx:A,via:e,realToCanvasMat:i,colorMap:o}=t;ID({ctx:A,center:{x:e.x,y:e.y},radius:e.outer_diameter/2,fill:o.copper.top,realToCanvasMat:i}),ID({ctx:A,center:{x:e.x,y:e.y},radius:e.hole_diameter/2,fill:o.drill,realToCanvasMat:i})}function ov(t,A){if(!A.layers||A.layers.length===0)return!0;const e=JRA(t);return e.length===0?!0:e.some(i=>A.layers.includes(i))}var WS={copper:{top:"rgb(200, 52, 52)",inner1:"rgb(255, 140, 0)",inner2:"rgb(255, 215, 0)",inner3:"rgb(50, 205, 50)",inner4:"rgb(64, 224, 208)",inner5:"rgb(138, 43, 226)",inner6:"rgb(255, 105, 180)",bottom:"rgb(77, 127, 196)"},soldermaskWithCopperUnderneath:{top:"rgb(18, 82, 50)",bottom:"rgb(77, 127, 196)"},soldermask:{top:"rgb(12, 55, 33)",bottom:"rgb(12, 55, 33)"},soldermaskOverCopper:{top:"rgb(52, 135, 73)",bottom:"rgb(52, 135, 73)"},substrate:"rgb(201, 162, 110)",drill:"#FF26E2",silkscreen:{top:"#f2eda1",bottom:"#5da9e9"},boardOutline:"rgba(255, 255, 255, 0.5)",courtyard:"#FF00FF",keepout:"#FF6B6B"},cf=class{ctx;colorMap;realToCanvasMat;constructor(t){if("getContext"in t&&typeof t.getContext=="function"){const A=t.getContext("2d");if(!A)throw new Error("Failed to get 2D rendering context from canvas");this.ctx=A}else this.ctx=t;this.colorMap={...WS},this.realToCanvasMat=DUt()}configure(t){t.colorOverrides&&(this.colorMap={...this.colorMap,...t.colorOverrides,copper:{...this.colorMap.copper,...t.colorOverrides.copper},silkscreen:{...this.colorMap.silkscreen,...t.colorOverrides.silkscreen},soldermask:{...this.colorMap.soldermask,...t.colorOverrides.soldermask},soldermaskWithCopperUnderneath:{...this.colorMap.soldermaskWithCopperUnderneath,...t.colorOverrides.soldermaskWithCopperUnderneath},soldermaskOverCopper:{...this.colorMap.soldermaskOverCopper,...t.colorOverrides.soldermaskOverCopper}})}setCameraBounds(t){const A=this.ctx.canvas,e=A.width,i=A.height,o=t.maxX-t.minX,n=t.maxY-t.minY,s=e/o,r=i/n,a=Math.min(s,r),g=(e-o*a)/2,I=(i-n*a)/2;this.realToCanvasMat=SUt(cZ(g,I),bUt(a,-a),cZ(-t.minX,-t.maxY))}drawElements(t,A={}){const e=t.find(n=>n.type==="pcb_board"),i=t.find(n=>n.type==="pcb_panel");i&&gLt({ctx:this.ctx,panel:i,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,drawBoardMaterial:A.drawBoardMaterial??!1}),e&&xUt({ctx:this.ctx,board:e,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,drawBoardMaterial:A.drawBoardMaterial??!1});for(const n of t)ov(n,A)&&(n.type==="pcb_smtpad"&&bLt({ctx:this.ctx,pad:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_copper_text"&&JUt({ctx:this.ctx,text:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}));const o=A.drawSoldermask??!1;e&&ULt({ctx:this.ctx,board:e,elements:t,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,layer:"top",drawSoldermask:o});for(const n of t)ov(n,A)&&(n.type==="pcb_silkscreen_text"&&DLt({ctx:this.ctx,text:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_silkscreen_rect"&&yLt({ctx:this.ctx,rect:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_silkscreen_circle"&&BLt({ctx:this.ctx,circle:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_silkscreen_line"&&CLt({ctx:this.ctx,line:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_silkscreen_path"&&uLt({ctx:this.ctx,path:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_silkscreen_pill"&&pLt({ctx:this.ctx,pill:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_silkscreen_oval"&&ELt({ctx:this.ctx,oval:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}));for(const n of t)ov(n,A)&&(n.type==="pcb_copper_pour"&&FUt({ctx:this.ctx,pour:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_trace"&&YLt({ctx:this.ctx,trace:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}));for(const n of t)ov(n,A)&&(n.type==="pcb_plated_hole"&&ILt({ctx:this.ctx,hole:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,soldermaskMargin:o?n.soldermask_margin:void 0,drawSoldermask:o}),n.type==="pcb_via"&&JLt({ctx:this.ctx,via:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}));for(const n of t)ov(n,A)&&(n.type==="pcb_hole"&&$Ut({ctx:this.ctx,hole:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,soldermaskMargin:o?n.soldermask_margin:void 0}),n.type==="pcb_cutout"&&TUt({ctx:this.ctx,cutout:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}));for(const n of t)ov(n,A)&&(n.type==="pcb_keepout"&&eLt({ctx:this.ctx,keepout:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_fabrication_note_text"&&XUt({ctx:this.ctx,text:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_fabrication_note_rect"&&VUt({ctx:this.ctx,rect:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_note_rect"&&sLt({realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,ctx:this.ctx,rect:n}),n.type==="pcb_fabrication_note_path"&&ZUt({ctx:this.ctx,path:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_note_path"&&nLt({ctx:this.ctx,path:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_note_text"&&aLt({ctx:this.ctx,text:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_note_line"&&oLt({ctx:this.ctx,line:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_note_dimension"&&iLt({ctx:this.ctx,pcbNoteDimension:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_fabrication_note_dimension"&&WUt({ctx:this.ctx,pcbFabricationNoteDimension:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}))}};const TLt=khe(NNe);var LhA,Lee;function KLt(){if(Lee)return LhA;Lee=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}),LhA=s(r);var a=e0(),g=TLt,I=XwA(),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:m="rgba(0,0,0,0.2)",minorColor:S="rgba(0,0,0,0.1)",textColor:D=(h=E.majorColor)!=null?h:"rgba(0,0,0,0.5)",width:x,height:F,screenSpaceCellSize:k=200,stringifyCoord:v=(J,W,Z)=>`${l(J,Z)}, ${l(W,Z)}`}=E,_=Math.ceil(x/k)+2,H=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 gA(RA,uA,KA){const $A=RA;let ge,yA,qA;for(ge=uA.x;ge<=KA.x;ge+=$A)yA=(0,g.applyToPoint)(E.transform,{x:ge,y:uA.y}),qA=(0,g.applyToPoint)(E.transform,{x:ge,y:KA.y}),J.beginPath(),J.moveTo(yA.x,yA.y),J.lineTo(qA.x,qA.y),J.stroke();const YA=c(uA.y,KA.y,$A*Z);for(const UA of YA)yA=(0,g.applyToPoint)(E.transform,{x:uA.x,y:UA}),qA=(0,g.applyToPoint)(E.transform,{x:KA.x,y:UA}),J.beginPath(),J.moveTo(yA.x,yA.y),J.lineTo(qA.x,qA.y),J.stroke()}function tA(RA,uA,KA){const $A=RA;let ge;for(ge=uA.x;ge<=KA.x;ge+=$A)for(const yA of c(uA.y,KA.y,$A*Z)){const qA=(0,g.applyToPoint)(E.transform,{x:ge,y:yA});J.fillStyle=D,J.font="12px sans-serif",J.fillText(v(ge,yA,RA),qA.x+2,qA.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*_,y:rA.y+W*H*Z},SA=W*5,xA={x:Math.floor((iA.x-SA)/SA)*SA,y:Math.floor((iA.y-SA)/SA+(Z==-1?2:0))*SA},JA={x:xA.x+SA*_,y:xA.y+SA*H*Z};J.globalAlpha=1,J.strokeStyle=m,gA(W,rA,CA),tA(SA,xA,JA),J.globalAlpha=1-nA,gA(SA/10,xA,JA),J.globalAlpha=1-nA,J.strokeStyle=S,gA(W/10,rA,CA),J.globalAlpha=Math.max(((1-nA)*10-5)/5,0),tA(SA/10,xA,JA),J.globalAlpha=1;const lA=(0,g.applyToPoint)(E.transform,d);J.font="12px sans-serif",J.fillStyle=D,J.fillText(v(d.x,d.y,W),lA.x+2,lA.y-2),J.strokeStyle=m,J.strokeRect(lA.x-5,lA.y-5,10,10)},[u,E.transform,d,x,F]);const P=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&&P(J)},onDoubleClick:P,ref:u,width:E.width,height:E.height})};return LhA}var EZ=KLt();function qLt(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 PLt(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 OLt=(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(PLt(this));var o=this.tags[this.tags.length-1];if(this.isSpeedy){var n=qLt(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})(),Uu="-ms-",hZ="-moz-",Ta="-webkit-",Hee="comm",HhA="rule",YhA="decl",WLt="@import",Yee="@keyframes",ZLt="@layer",VLt=Math.abs,uZ=String.fromCharCode,jLt=Object.assign;function zLt(t,A){return yh(t,0)^45?(((A<<2^yh(t,0))<<2^yh(t,1))<<2^yh(t,2))<<2^yh(t,3):0}function Jee(t){return t.trim()}function XLt(t,A){return(t=A.exec(t))?t[0]:t}function Ka(t,A,e){return t.replace(A,e)}function JhA(t,A){return t.indexOf(A)}function yh(t,A){return t.charCodeAt(A)|0}function tY(t,A,e){return t.slice(A,e)}function BD(t){return t.length}function ThA(t){return t.length}function dZ(t,A){return A.push(t),t}function $Lt(t,A){return t.map(A).join("")}var pZ=1,nv=1,Tee=0,Bf=0,FC=0,sv="";function fZ(t,A,e,i,o,n,s){return{value:t,root:A,parent:e,type:i,props:o,children:n,line:pZ,column:nv,length:s,return:""}}function iY(t,A){return jLt(fZ("",null,null,"",null,null,0),t,{length:-t.length},A)}function AHt(){return FC}function eHt(){return FC=Bf>0?yh(sv,--Bf):0,nv--,FC===10&&(nv=1,pZ--),FC}function w0(){return FC=Bf<Tee?yh(sv,Bf++):0,nv++,FC===10&&(nv=1,pZ++),FC}function lD(){return yh(sv,Bf)}function yZ(){return Bf}function oY(t,A){return tY(sv,t,A)}function nY(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 Kee(t){return pZ=nv=1,Tee=BD(sv=t),Bf=0,[]}function qee(t){return sv="",t}function wZ(t){return Jee(oY(Bf-1,KhA(t===91?t+2:t===40?t+1:t)))}function tHt(t){for(;(FC=lD())&&FC<33;)w0();return nY(t)>2||nY(FC)>3?"":" "}function iHt(t,A){for(;--A&&w0()&&!(FC<48||FC>102||FC>57&&FC<65||FC>70&&FC<97););return oY(t,yZ()+(A<6&&lD()==32&&w0()==32))}function KhA(t){for(;w0();)switch(FC){case t:return Bf;case 34:case 39:t!==34&&t!==39&&KhA(FC);break;case 40:t===41&&KhA(t);break;case 92:w0();break}return Bf}function oHt(t,A){for(;w0()&&t+FC!==57;)if(t+FC===84&&lD()===47)break;return"/*"+oY(A,Bf-1)+"*"+uZ(t===47?t:w0())}function nHt(t){for(;!nY(lD());)w0();return oY(t,Bf)}function sHt(t){return qee(mZ("",null,null,null,[""],t=Kee(t),0,[0],t))}function mZ(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,m=n,S=i,D=d;E;)switch(C=u,u=w0()){case 40:if(C!=108&&yh(D,c-1)==58){JhA(D+=Ka(wZ(u),"&","&\f"),"&\f")!=-1&&(h=-1);break}case 34:case 39:case 91:D+=wZ(u);break;case 9:case 10:case 13:case 32:D+=tHt(C);break;case 92:D+=iHt(yZ()-1,7);continue;case 47:switch(lD()){case 42:case 47:dZ(rHt(oHt(w0(),yZ()),A,e),a);break;default:D+="/"}break;case 123*Q:r[g++]=BD(D)*h;case 125*Q:case 59:case 0:switch(u){case 0:case 125:E=0;case 59+I:h==-1&&(D=Ka(D,/\f/g,"")),l>0&&BD(D)-c&&dZ(l>32?Oee(D+";",i,e,c-1):Oee(Ka(D," ","")+";",i,e,c-2),a);break;case 59:D+=";";default:if(dZ(S=Pee(D,A,e,g,I,o,r,d,f=[],m=[],c),n),u===123)if(I===0)mZ(D,A,S,S,f,n,c,r,m);else switch(B===99&&yh(D,3)===110?100:B){case 100:case 108:case 109:case 115:mZ(t,S,S,i&&dZ(Pee(t,S,S,0,0,o,r,d,o,f=[],c),m),o,m,c,r,i?f:m);break;default:mZ(D,S,S,S,[""],m,0,r,m)}}g=I=l=0,Q=h=1,d=D="",c=s;break;case 58:c=1+BD(D),l=C;default:if(Q<1){if(u==123)--Q;else if(u==125&&Q++==0&&eHt()==125)continue}switch(D+=uZ(u),u*Q){case 38:h=I>0?1:(D+="\f",-1);break;case 44:r[g++]=(BD(D)-1)*h,h=1;break;case 64:lD()===45&&(D+=wZ(w0())),B=lD(),I=c=BD(d=D+=nHt(yZ())),u++;break;case 45:C===45&&BD(D)==2&&(Q=0)}}return n}function Pee(t,A,e,i,o,n,s,r,a,g,I){for(var c=o-1,B=o===0?n:[""],l=ThA(B),C=0,Q=0,E=0;C<i;++C)for(var h=0,u=tY(t,c+1,c=VLt(Q=s[C])),d=t;h<l;++h)(d=Jee(Q>0?B[h]+" "+u:Ka(u,/&\f/g,B[h])))&&(a[E++]=d);return fZ(t,A,e,o===0?HhA:r,a,g,I)}function rHt(t,A,e){return fZ(t,A,e,Hee,uZ(AHt()),tY(t,2,-2),0)}function Oee(t,A,e,i){return fZ(t,A,e,YhA,tY(t,0,i),tY(t,i+1,-1),i)}function rv(t,A){for(var e="",i=ThA(t),o=0;o<i;o++)e+=A(t[o],o,t,A)||"";return e}function aHt(t,A,e,i){switch(t.type){case ZLt:if(t.children.length)break;case WLt:case YhA:return t.return=t.return||t.value;case Hee:return"";case Yee:return t.return=t.value+"{"+rv(t.children,i)+"}";case HhA:t.value=t.props.join(",")}return BD(e=rv(t.children,i))?t.return=t.value+"{"+e+"}":""}function gHt(t){var A=ThA(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 IHt(t){return function(A){A.root||(A=A.return)&&t(A)}}function cHt(t){var A=Object.create(null);return function(e){return A[e]===void 0&&(A[e]=t(e)),A[e]}}var BHt=function(A,e,i){for(var o=0,n=0;o=n,n=lD(),o===38&&n===12&&(e[i]=1),!nY(n);)w0();return oY(A,Bf)},lHt=function(A,e){var i=-1,o=44;do switch(nY(o)){case 0:o===38&&lD()===12&&(e[i]=1),A[i]+=BHt(Bf-1,e,i);break;case 2:A[i]+=wZ(o);break;case 4:if(o===44){A[++i]=lD()===58?"&\f":"",e[i]=A[i].length;break}default:A[i]+=uZ(o)}while(o=w0());return A},CHt=function(A,e){return qee(lHt(Kee(A),e))},Wee=new WeakMap,QHt=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&&!Wee.get(i))&&!o){Wee.set(A,!0);for(var n=[],s=CHt(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]}}},EHt=function(A){if(A.type==="decl"){var e=A.value;e.charCodeAt(0)===108&&e.charCodeAt(2)===98&&(A.return="",A.value="")}};function Zee(t,A){switch(zLt(t,A)){case 5103:return Ta+"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 Ta+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return Ta+t+hZ+t+Uu+t+t;case 6828:case 4268:return Ta+t+Uu+t+t;case 6165:return Ta+t+Uu+"flex-"+t+t;case 5187:return Ta+t+Ka(t,/(\w+).+(:[^]+)/,Ta+"box-$1$2"+Uu+"flex-$1$2")+t;case 5443:return Ta+t+Uu+"flex-item-"+Ka(t,/flex-|-self/,"")+t;case 4675:return Ta+t+Uu+"flex-line-pack"+Ka(t,/align-content|flex-|-self/,"")+t;case 5548:return Ta+t+Uu+Ka(t,"shrink","negative")+t;case 5292:return Ta+t+Uu+Ka(t,"basis","preferred-size")+t;case 6060:return Ta+"box-"+Ka(t,"-grow","")+Ta+t+Uu+Ka(t,"grow","positive")+t;case 4554:return Ta+Ka(t,/([^-])(transform)/g,"$1"+Ta+"$2")+t;case 6187:return Ka(Ka(Ka(t,/(zoom-|grab)/,Ta+"$1"),/(image-set)/,Ta+"$1"),t,"")+t;case 5495:case 3959:return Ka(t,/(image-set\([^]*)/,Ta+"$1$`$1");case 4968:return Ka(Ka(t,/(.+:)(flex-)?(.*)/,Ta+"box-pack:$3"+Uu+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Ta+t+t;case 4095:case 3583:case 4068:case 2532:return Ka(t,/(.+)-inline(.+)/,Ta+"$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(BD(t)-1-A>6)switch(yh(t,A+1)){case 109:if(yh(t,A+4)!==45)break;case 102:return Ka(t,/(.+:)(.+)-([^]+)/,"$1"+Ta+"$2-$3$1"+hZ+(yh(t,A+3)==108?"$3":"$2-$3"))+t;case 115:return~JhA(t,"stretch")?Zee(Ka(t,"stretch","fill-available"),A)+t:t}break;case 4949:if(yh(t,A+1)!==115)break;case 6444:switch(yh(t,BD(t)-3-(~JhA(t,"!important")&&10))){case 107:return Ka(t,":",":"+Ta)+t;case 101:return Ka(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Ta+(yh(t,14)===45?"inline-":"")+"box$3$1"+Ta+"$2$3$1"+Uu+"$2box$3")+t}break;case 5936:switch(yh(t,A+11)){case 114:return Ta+t+Uu+Ka(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return Ta+t+Uu+Ka(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return Ta+t+Uu+Ka(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return Ta+t+Uu+t+t}return t}var hHt=function(A,e,i,o){if(A.length>-1&&!A.return)switch(A.type){case YhA:A.return=Zee(A.value,A.length);break;case Yee:return rv([iY(A,{value:Ka(A.value,"@","@"+Ta)})],o);case HhA:if(A.length)return $Lt(A.props,function(n){switch(XLt(n,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return rv([iY(A,{props:[Ka(n,/:(read-\w+)/,":"+hZ+"$1")]})],o);case"::placeholder":return rv([iY(A,{props:[Ka(n,/:(plac\w+)/,":"+Ta+"input-$1")]}),iY(A,{props:[Ka(n,/:(plac\w+)/,":"+hZ+"$1")]}),iY(A,{props:[Ka(n,/:(plac\w+)/,Uu+"input-$1")]})],o)}return""})}},uHt=[hHt],dHt=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||uHt,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=[QHt,EHt];{var I,c=[aHt,IHt(function(Q){I.insert(Q)})],B=gHt(g.concat(o,c)),l=function(E){return rv(sHt(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 OLt({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 pHt(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 fHt={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},yHt=/[A-Z]|^ms/g,wHt=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Vee=function(A){return A.charCodeAt(1)===45},jee=function(A){return A!=null&&typeof A!="boolean"},qhA=cHt(function(t){return Vee(t)?t:t.replace(yHt,"-$&").toLowerCase()}),zee=function(A,e){switch(A){case"animation":case"animationName":if(typeof e=="string")return e.replace(wHt,function(i,o,n){return Bk={name:o,styles:n,next:Bk},o})}return fHt[A]!==1&&!Vee(A)&&typeof e=="number"&&e!==0?e+"px":e};function DZ(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 Bk={name:o.name,styles:o.styles,next:Bk},o.name;var n=e;if(n.styles!==void 0){var s=n.next;if(s!==void 0)for(;s!==void 0;)Bk={name:s.name,styles:s.styles,next:Bk},s=s.next;var r=n.styles+";";return r}return mHt(t,A,e)}}var a=e;if(A==null)return a;var g=A[a];return g!==void 0?g:a}function mHt(t,A,e){var i="";if(Array.isArray(e))for(var o=0;o<e.length;o++)i+=DZ(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]+"}":jee(r)&&(i+=qhA(n)+":"+zee(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++)jee(s[a])&&(i+=qhA(n)+":"+zee(n,s[a])+";");else{var g=DZ(t,A,s);switch(n){case"animation":case"animationName":{i+=qhA(n)+":"+g+";";break}default:i+=n+"{"+g+"}"}}}return i}var Xee=/label:\s*([^\s;{]+)\s*(;|$)/g,Bk;function PhA(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="";Bk=void 0;var n=t[0];if(n==null||n.raw===void 0)i=!1,o+=DZ(e,A,n);else{var s=n;o+=s[0]}for(var r=1;r<t.length;r++)if(o+=DZ(e,A,t[r]),i){var a=n;o+=a[r]}Xee.lastIndex=0;for(var g="",I;(I=Xee.exec(o))!==null;)g+="-"+I[1];var c=pHt(o)+g;return{name:c,styles:o,next:Bk}}function $ee(t,A,e){var i="";return e.split(" ").forEach(function(o){t[o]!==void 0?A.push(t[o]+";"):o&&(i+=o+" ")}),i}var DHt=function(A,e,i){var o=A.key+"-"+e.name;A.registered[o]===void 0&&(A.registered[o]=e.styles)},SHt=function(A,e,i){DHt(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 Ate(t,A){if(t.inserted[A.name]===void 0)return t.insert("",A,t.sheet,!0)}function ete(t,A,e){var i=[],o=$ee(t,i,e);return i.length<2?e:o+A(i)}var bHt=function(A){var e=dHt(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=PhA(g,e.registered,void 0);return SHt(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=PhA(g,e.registered),B="animation-"+c.name;return Ate(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=PhA(g,e.registered);Ate(e,c)},s=function(){for(var a=arguments.length,g=new Array(a),I=0;I<a;I++)g[I]=arguments[I];return ete(e.registered,i,xHt(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:$ee.bind(null,e.registered),merge:ete.bind(null,e.registered,i)}},xHt=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},kHt=bHt({key:"css"}),av=kHt.css,GHt=Object.create,tte=Object.defineProperty,FHt=Object.getOwnPropertyDescriptor,ite=Object.getOwnPropertyNames,RHt=Object.getPrototypeOf,MHt=Object.prototype.hasOwnProperty,ba=(t,A)=>function(){return A||(0,t[ite(t)[0]])((A={exports:{}}).exports,A),A.exports},NHt=(t,A,e,i)=>{if(A&&typeof A=="object"||typeof A=="function")for(let o of ite(A))!MHt.call(t,o)&&o!==e&&tte(t,o,{get:()=>A[o],enumerable:!(i=FHt(A,o))||i.enumerable});return t},ote=(t,A,e)=>(e=t!=null?GHt(RHt(t)):{},NHt(tte(e,"default",{value:t,enumerable:!0}),t)),_Ht=ba({"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 dA={};for(var SA in rA)Object.prototype.hasOwnProperty.call(rA,SA)&&(dA[CA(SA,rA[SA])||SA]=rA[SA]);return dA}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 dA=[];CA==="object"&&(iA=a(iA,rA),dA={});for(var SA in iA)if(iA.hasOwnProperty(SA)){var xA=iA[SA];s(xA)==="object"||s(xA)==="array"?dA[SA]=tA(xA,rA):dA[SA]=xA}return dA},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 dA(xA,JA,lA){this.fn=xA,this.context=JA,this.once=lA||!1}function SA(){this._events=new CA,this._eventsCount=0}SA.prototype.eventNames=function(){var JA=[],lA,RA;if(this._eventsCount===0)return JA;for(RA in lA=this._events)iA.call(lA,RA)&&JA.push(rA?RA.slice(1):RA);return Object.getOwnPropertySymbols?JA.concat(Object.getOwnPropertySymbols(lA)):JA},SA.prototype.listeners=function(JA,lA){var RA=rA?rA+JA:JA,uA=this._events[RA];if(lA)return!!uA;if(!uA)return[];if(uA.fn)return[uA.fn];for(var KA=0,$A=uA.length,ge=new Array($A);KA<$A;KA++)ge[KA]=uA[KA].fn;return ge},SA.prototype.emit=function(JA,lA,RA,uA,KA,$A){var ge=rA?rA+JA:JA;if(!this._events[ge])return!1;var yA=this._events[ge],qA=arguments.length,YA,UA;if(yA.fn){switch(yA.once&&this.removeListener(JA,yA.fn,void 0,!0),qA){case 1:return yA.fn.call(yA.context),!0;case 2:return yA.fn.call(yA.context,lA),!0;case 3:return yA.fn.call(yA.context,lA,RA),!0;case 4:return yA.fn.call(yA.context,lA,RA,uA),!0;case 5:return yA.fn.call(yA.context,lA,RA,uA,KA),!0;case 6:return yA.fn.call(yA.context,lA,RA,uA,KA,$A),!0}for(UA=1,YA=new Array(qA-1);UA<qA;UA++)YA[UA-1]=arguments[UA];yA.fn.apply(yA.context,YA)}else{var OA=yA.length,FA;for(UA=0;UA<OA;UA++)switch(yA[UA].once&&this.removeListener(JA,yA[UA].fn,void 0,!0),qA){case 1:yA[UA].fn.call(yA[UA].context);break;case 2:yA[UA].fn.call(yA[UA].context,lA);break;case 3:yA[UA].fn.call(yA[UA].context,lA,RA);break;case 4:yA[UA].fn.call(yA[UA].context,lA,RA,uA);break;default:if(!YA)for(FA=1,YA=new Array(qA-1);FA<qA;FA++)YA[FA-1]=arguments[FA];yA[UA].fn.apply(yA[UA].context,YA)}}return!0},SA.prototype.on=function(JA,lA,RA){var uA=new dA(lA,RA||this),KA=rA?rA+JA:JA;return this._events[KA]?this._events[KA].fn?this._events[KA]=[this._events[KA],uA]:this._events[KA].push(uA):(this._events[KA]=uA,this._eventsCount++),this},SA.prototype.once=function(JA,lA,RA){var uA=new dA(lA,RA||this,!0),KA=rA?rA+JA:JA;return this._events[KA]?this._events[KA].fn?this._events[KA]=[this._events[KA],uA]:this._events[KA].push(uA):(this._events[KA]=uA,this._eventsCount++),this},SA.prototype.removeListener=function(JA,lA,RA,uA){var KA=rA?rA+JA:JA;if(!this._events[KA])return this;if(!lA)return--this._eventsCount===0?this._events=new CA:delete this._events[KA],this;var $A=this._events[KA];if($A.fn)$A.fn===lA&&(!uA||$A.once)&&(!RA||$A.context===RA)&&(--this._eventsCount===0?this._events=new CA:delete this._events[KA]);else{for(var ge=0,yA=[],qA=$A.length;ge<qA;ge++)($A[ge].fn!==lA||uA&&!$A[ge].once||RA&&$A[ge].context!==RA)&&yA.push($A[ge]);yA.length?this._events[KA]=yA.length===1?yA[0]:yA:--this._eventsCount===0?this._events=new CA:delete this._events[KA]}return this},SA.prototype.removeAllListeners=function(JA){var lA;return JA?(lA=rA?rA+JA:JA,this._events[lA]&&(--this._eventsCount===0?this._events=new CA:delete this._events[lA])):(this._events=new CA,this._eventsCount=0),this},SA.prototype.off=SA.prototype.removeListener,SA.prototype.addListener=SA.prototype.on,SA.prototype.setMaxListeners=function(){return this},SA.prefixed=rA,SA.EventEmitter=SA,tA.exports=SA});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,dA,SA,xA,JA,lA,RA,uA,KA;iA=Object.assign({debug:!1},iA);var $A=new I,ge=l.data,yA="",qA="",YA="",UA="",OA="",FA="",DA=function(LA,PA){if(!(qA[0]==="?"||qA[0]==="!")){var ie={type:LA,value:PA};iA.debug&&console.log("emit:",ie),$A.emit("data",ie)}};$A.stateMachine=(KA={},c(KA,l.data,(rA={},c(rA,C.lt,function(){yA.trim()&&DA(Q.text,yA),qA="",OA=!1,ge=l.tagBegin}),c(rA,C.char,function(GA){yA+=GA}),rA)),c(KA,l.cdata,c({},C.char,function(GA){yA+=GA,yA.substr(-3)==="]]>"&&(DA(Q.text,yA.slice(0,-3)),yA="",ge=l.data)})),c(KA,l.tagBegin,(CA={},c(CA,C.space,B),c(CA,C.char,function(GA){qA=GA,ge=l.tagName}),c(CA,C.slash,function(){qA="",OA=!0}),CA)),c(KA,l.tagName,(dA={},c(dA,C.space,function(){OA?ge=l.tagEnd:(ge=l.attributeNameStart,DA(Q.openTag,qA))}),c(dA,C.gt,function(){DA(OA?Q.closeTag:Q.openTag,qA),yA="",ge=l.data}),c(dA,C.slash,function(){ge=l.tagEnd,DA(Q.openTag,qA)}),c(dA,C.char,function(GA){qA+=GA,qA==="![CDATA["&&(ge=l.cdata,yA="",qA="")}),dA)),c(KA,l.tagEnd,(SA={},c(SA,C.gt,function(){DA(Q.closeTag,qA),yA="",ge=l.data}),c(SA,C.char,B),SA)),c(KA,l.attributeNameStart,(xA={},c(xA,C.char,function(GA){YA=GA,ge=l.attributeName}),c(xA,C.gt,function(){yA="",ge=l.data}),c(xA,C.space,B),c(xA,C.slash,function(){OA=!0,ge=l.tagEnd}),xA)),c(KA,l.attributeName,(JA={},c(JA,C.space,function(){ge=l.attributeNameEnd}),c(JA,C.equal,function(){DA(Q.attributeName,YA),ge=l.attributeValueBegin}),c(JA,C.gt,function(){UA="",DA(Q.attributeName,YA),DA(Q.attributeValue,UA),yA="",ge=l.data}),c(JA,C.slash,function(){OA=!0,UA="",DA(Q.attributeName,YA),DA(Q.attributeValue,UA),ge=l.tagEnd}),c(JA,C.char,function(GA){YA+=GA}),JA)),c(KA,l.attributeNameEnd,(lA={},c(lA,C.space,B),c(lA,C.equal,function(){DA(Q.attributeName,YA),ge=l.attributeValueBegin}),c(lA,C.gt,function(){UA="",DA(Q.attributeName,YA),DA(Q.attributeValue,UA),yA="",ge=l.data}),c(lA,C.char,function(GA){UA="",DA(Q.attributeName,YA),DA(Q.attributeValue,UA),YA=GA,ge=l.attributeName}),lA)),c(KA,l.attributeValueBegin,(RA={},c(RA,C.space,B),c(RA,C.quote,function(GA){FA=GA,UA="",ge=l.attributeValue}),c(RA,C.gt,function(){UA="",DA(Q.attributeValue,UA),yA="",ge=l.data}),c(RA,C.char,function(GA){FA="",UA=GA,ge=l.attributeValue}),RA)),c(KA,l.attributeValue,(uA={},c(uA,C.space,function(GA){FA?UA+=GA:(DA(Q.attributeValue,UA),ge=l.attributeNameStart)}),c(uA,C.quote,function(GA){FA===GA?(DA(Q.attributeValue,UA),ge=l.attributeNameStart):UA+=GA}),c(uA,C.gt,function(GA){FA?UA+=GA:(DA(Q.attributeValue,UA),yA="",ge=l.data)}),c(uA,C.slash,function(GA){FA?UA+=GA:(DA(Q.attributeValue,UA),OA=!0,ge=l.tagEnd)}),c(uA,C.char,function(GA){UA+=GA}),uA)),KA);var TA=function(LA){iA.debug&&console.log(ge,LA);var PA=$A.stateMachine[ge],ie=PA[h(LA)]||PA[C.error]||PA[C.char];ie(LA)};return $A.write=function(GA){for(var LA=GA.length,PA=0;PA<LA;PA++)TA(GA[PA])},$A},d={State:l,Action:C,Type:Q,create:u},f=d.Type,m={element:"element",text:"text"},S=function(iA){return Object.assign({name:"",type:m.element,value:"",parent:null,attributes:{},children:[]},iA)},D=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,dA=void 0,SA=void 0,xA=new I,JA=function(RA){switch(RA.type){case f.openTag:if(dA===null)dA=CA,dA.name=RA.value;else{var uA=S({name:RA.value,parent:dA});dA.children.push(uA),dA=uA}break;case f.closeTag:var KA=dA.parent;if(iA.parentNodes||(dA.parent=null),dA.name!==RA.value)break;iA.stream&&KA===CA&&(CA.children=[],dA.parent=null),(!iA.emitTopLevelOnly||KA===CA)&&(xA.emit(iA.tagPrefix+dA.name,dA),xA.emit("tag",dA.name,dA)),dA===CA&&(rA.removeAllListeners("data"),xA.emit(iA.doneEvent,dA),CA=null),dA=KA;break;case f.text:dA&&dA.children.push(S({type:m.text,value:RA.value,parent:iA.parentNodes?dA:null}));break;case f.attributeName:SA=RA.value,dA.attributes[SA]="";break;case f.attributeValue:dA.attributes[SA]=RA.value;break}};return xA.reset=function(){rA=d.create({debug:iA.debug}),rA.on("data",JA),CA=S(),dA=null,SA="",xA.parse=rA.write},xA.reset(),xA},x=function(iA,rA){rA=Object.assign({},rA,{stream:!1,tagPrefix:":"});var CA=D(rA),dA=void 0;return CA.on("done",function(SA){dA=SA}),CA.parse(iA),dA},F={parseSync:x},k=F.parseSync,v=function(iA){var rA=k("<root>".concat(iA,"</root>"),{parentNodes:!1}),CA=rA.children&&rA.children.length>0&&rA.children.every(function(dA){return dA.name==="svg"});if(CA)return rA.children.length===1?rA.children[0]:rA.children;throw Error("nothing to parse")},_=function(iA){return g(iA,function(rA){return P(rA)?rA:H(rA)})},H=function(iA){return iA.replace(/[-|:]([a-z])/gi,function(rA,CA){return CA.toUpperCase()})},P=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,dA=CA===void 0?function(lA){return lA}:CA,SA=rA.camelcase,xA=SA===void 0?!1:SA,JA=function(RA){var uA;return uA=dA(RA),xA&&(uA=_(uA)),uA};return JA(v(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,dA){try{var SA=Z.apply(void 0,iA);CA(SA)}catch(xA){dA(xA)}})}var nA=function tA(iA){var rA=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},CA=rA.transformAttr,dA=CA===void 0?function(ge,yA,qA){return"".concat(ge,'="').concat(qA(yA),'"')}:CA,SA=rA.transformNode,xA=SA===void 0?function(ge){return ge}:SA,JA=rA.selfClose,lA=JA===void 0?!0:JA;if(Array.isArray(iA))return iA.map(function(ge){return tA(ge,{transformAttr:dA,selfClose:lA,transformNode:xA})}).join("");var RA=xA(iA);if(RA.type==="text")return J(RA.value);var uA="";for(var KA in RA.attributes){var $A=dA(KA,RA.attributes[KA],W,RA.name);uA+=$A?" ".concat($A):""}return RA.children&&RA.children.length>0||!lA?"<".concat(RA.name).concat(uA,">").concat(tA(RA.children,{transformAttr:dA,transformNode:xA,selfClose:lA}),"</").concat(RA.name,">"):"<".concat(RA.name).concat(uA,"/>")},gA=Object.assign({},{parse:AA,parseSync:Z,stringify:nA});return gA})}}),OhA=ba({"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(`
5320
+ `),a=[];let g=0;for(const c of r){const B=Array.from(c);let l=0;B.forEach((C,Q)=>{l+=C===" "?o:e,Q<B.length-1&&(l+=i)}),a.push(l),l>g&&(g=l)}const I=r.length>1?A+(r.length-1)*s:A;return{width:g,height:I,glyphWidth:e,letterSpacing:i,spaceWidth:o,strokeWidth:n,lineHeight:s,lines:r,lineWidths:a}}function MhA(t,A){const e=A.width+A.strokeWidth,i=A.height+A.strokeWidth;let o=0,n=0;return t==="center"||t==="top_center"||t==="bottom_center"?o=-e/2:t==="top_left"||t==="bottom_left"||t==="center_left"?o=0:t==="top_right"||t==="bottom_right"||t==="center_right"?o=-e:(t==="top_center"||t==="bottom_center")&&(o=-e/2),t==="center"||t==="center_left"||t==="center_right"?n=-i/2:t==="top_left"||t==="top_right"||t==="top_center"?n=0:(t==="bottom_left"||t==="bottom_right"||t==="bottom_center")&&(n=-i),{x:o,y:n}}function NhA(t){const{alignment:A,lineWidth:e,maxWidth:i,strokeWidth:o}=t,n=e+o,s=i+o;return A==="top_left"||A==="bottom_left"||A==="center_left"?0:A==="top_right"||A==="bottom_right"||A==="center_right"?s-n:(s-n)/2}var UUt=t=>Jm[t]??Jm[t.toUpperCase()];function _hA(t){const{ctx:A,line:e,fontSize:i,startX:o,startY:n,layout:s}=t,{glyphWidth:r,letterSpacing:a,spaceWidth:g,strokeWidth:I}=s,c=i,B=n,l=Array.from(e);let C=o+I/2;l.forEach((Q,E)=>{const h=UUt(Q),u=Q===" "?g:r;if(h?.length){A.beginPath();for(const d of h){const f=C+d.x1*r,m=B+(1-d.y1)*c,S=C+d.x2*r,D=B+(1-d.y2)*c;A.moveTo(f,m),A.lineTo(S,D)}A.stroke()}C+=u,E<l.length-1&&(C+=a)})}function LUt(t){const{ctx:A,text:e,fontSize:i,startX:o,startY:n,anchorAlignment:s="center"}=t,r=CZ(e,i),{lines:a,lineWidths:g,lineHeight:I,width:c,strokeWidth:B}=r;a.forEach((l,C)=>{const Q=o+NhA({alignment:s,lineWidth:g[C],maxWidth:c,strokeWidth:B}),E=n+C*I;_hA({ctx:A,line:l,fontSize:i,startX:Q,startY:E,layout:r})})}function vhA(t){const{ctx:A,text:e,x:i,y:o,fontSize:n,color:s,realToCanvasMat:r,anchorAlignment:a,rotation:g=0}=t;if(!e)return;const[I,c]=ao(r,[i,o]),B=Math.abs(r.a),l=n*B,C=CZ(e,l),Q=MhA(a,C);A.save(),A.translate(I,c),g!==0&&A.rotate(-g*(Math.PI/180)),A.lineWidth=C.strokeWidth,A.lineCap="round",A.lineJoin="round",A.strokeStyle=s;const{lines:E,lineWidths:h,lineHeight:u,width:d,strokeWidth:f}=C;E.forEach((m,S)=>{const D=Q.x+NhA({alignment:a,lineWidth:h[S],maxWidth:d,strokeWidth:f}),x=Q.y+S*u;_hA({ctx:A,line:m,fontSize:l,startX:D,startY:x,layout:C})}),A.restore()}var HUt={left:.2,right:.2,top:.2,bottom:.2};function YUt(t){return t?t.includes("left")?"center_left":t.includes("right")?"center_right":"center":"center"}function JUt(t){const{ctx:A,text:e,realToCanvasMat:i,colorMap:o}=t,n=e.text??"";if(!n)return;const[s,r]=ao(i,[e.anchor_position.x,e.anchor_position.y]),a=Math.abs(i.a),g=(e.font_size??1)*a,I=e.ccw_rotation??0,c={...HUt,...e.knockout_padding},B=o.copper[e.layer]??o.copper.top,l=CZ(n,g),C=l.width+l.strokeWidth,Q=YUt(e.anchor_alignment),E=MhA(Q,l);if(A.save(),A.translate(s,r),e.is_mirrored&&A.scale(-1,1),I!==0&&A.rotate(-I*(Math.PI/180)),A.lineWidth=l.strokeWidth,A.lineCap="round",A.lineJoin="round",e.is_knockout){const h=c.left*a,u=c.right*a,d=c.top*a,f=c.bottom*a,m=E.x-h*4,S=E.y-d*4,D=C+h*2+u*2,x=l.height+l.strokeWidth+d*2+f*2;A.fillStyle=B,A.fillRect(m,S,D,x)}else A.strokeStyle=B;LUt({ctx:A,text:n,fontSize:g,startX:E.x,startY:E.y,anchorAlignment:Q}),A.restore()}function ID(t){const{ctx:A,center:e,radius:i,fill:o,realToCanvasMat:n,stroke:s,strokeWidth:r,isStrokeDashed:a=!1}=t,[g,I]=ao(n,[e.x,e.y]),c=i*Math.abs(n.a),B=r?r*Math.abs(n.a):void 0;A.beginPath(),A.arc(g,I,c,0,Math.PI*2),o&&(A.fillStyle=o,A.fill()),s&&B&&(a?A.setLineDash([B*3,B*2]):A.setLineDash([]),A.strokeStyle=s,A.lineWidth=B,A.stroke())}function TUt(t){const{ctx:A,cutout:e,realToCanvasMat:i,colorMap:o}=t;if(e.shape==="rect"){y0({ctx:A,center:e.center,width:e.width,height:e.height,fill:o.drill,realToCanvasMat:i,rotation:e.rotation??0,borderRadius:e.corner_radius??0});return}if(e.shape==="circle"){ID({ctx:A,center:e.center,radius:e.radius,fill:o.drill,realToCanvasMat:i});return}if(e.shape==="polygon"){e.points&&e.points.length>=3&&lZ({ctx:A,points:e.points,fill:o.drill,realToCanvasMat:i});return}}var KUt=1.5,qUt=.6,PUt=.3;function UhA(t){const A=Math.hypot(t.x,t.y)||1;return{x:t.x/A,y:t.y/A}}function _ee(t){const{ctx:A,from:e,to:i,realToCanvasMat:o,color:n,fontSize:s,arrowSize:r=1,strokeWidth:a,text:g,textRotation:I,offset:c}=t,B=UhA({x:i.x-e.x,y:i.y-e.y}),l={x:-B.y,y:B.x},C=c?.direction&&typeof c.direction.x=="number"&&typeof c.direction.y=="number",Q=C?UhA(c.direction):{x:0,y:0},E=c?.distance??0,h={x:Q.x*E,y:Q.y*E},u={x:e.x+h.x,y:e.y+h.y},d={x:i.x+h.x,y:i.y+h.y},f={x:u.x+B.x*r,y:u.y+B.y*r},m={x:d.x-B.x*r,y:d.y-B.y*r};Math.abs(o.a);const S=a??r/5,D=n||"rgba(255,255,255,0.5)",x=C&&(Math.abs(Q.x)>Number.EPSILON||Math.abs(Q.y)>Number.EPSILON)?Q:l,F=E+.5,k=[],v=P=>{const J={x:P.x+x.x*F,y:P.y+x.y*F},W=S/2,Z={x:-x.y,y:x.x};return[{x:P.x+Z.x*W,y:P.y+Z.y*W},{x:P.x-Z.x*W,y:P.y-Z.y*W},{x:J.x-Z.x*W,y:J.y-Z.y*W},{x:J.x+Z.x*W,y:J.y+Z.y*W}]};k.push(u),k.push({x:f.x+l.x*(r/2),y:f.y+l.y*(r/2)}),k.push({x:f.x+l.x*(S/2),y:f.y+l.y*(S/2)}),k.push({x:m.x+l.x*(S/2),y:m.y+l.y*(S/2)}),k.push({x:m.x+l.x*(r/2),y:m.y+l.y*(r/2)}),k.push(d),k.push({x:m.x-l.x*(r/2),y:m.y-l.y*(r/2)}),k.push({x:m.x-l.x*(S/2),y:m.y-l.y*(S/2)}),k.push({x:f.x-l.x*(S/2),y:f.y-l.y*(S/2)}),k.push({x:f.x-l.x*(r/2),y:f.y-l.y*(r/2)}),k.push(u);const _=k[0],H=P=>{const J=v(P);k.push(_),k.push(J[0]),k.push(...J),k.push(J[0]),k.push(_)};if(H(e),H(i),lZ({ctx:A,points:k,fill:D,realToCanvasMat:o}),g){const P={x:(e.x+i.x)/2+h.x,y:(e.y+i.y)/2+h.y},[J,W]=ao(o,[u.x,u.y]),[Z,AA]=ao(o,[d.x,d.y]),nA=UhA({x:Z-J,y:AA-W});let gA=Math.atan2(nA.y,nA.x)*180/Math.PI;(gA>90||gA<-90)&&(gA+=180);const tA=typeof I=="number"&&Number.isFinite(I)?gA-I:gA;let iA=0;if(g&&typeof I=="number"&&Number.isFinite(I)){const dA=g.length*s*qUt,SA=s,xA=I*Math.PI/180,JA=Math.abs(Math.sin(xA)),lA=Math.abs(Math.cos(xA)),RA=dA/2,uA=SA/2;iA=RA*JA+uA*lA+s*PUt}const rA=r*KUt+iA,CA={x:P.x+l.x*rA,y:P.y+l.y*rA};vhA({ctx:A,text:g,x:CA.x,y:CA.y,fontSize:s,color:D,realToCanvasMat:o,anchorAlignment:"center",rotation:-tA})}}var OUt="rgba(255,255,255,0.5)";function WUt(t){const{ctx:A,pcbFabricationNoteDimension:e,realToCanvasMat:i}=t,o=e.color??OUt;_ee({ctx:A,from:e.from,to:e.to,realToCanvasMat:i,color:o,fontSize:e.font_size??1,arrowSize:e.arrow_size??1,text:e.text,textRotation:e.text_ccw_rotation,offset:e.offset_distance&&e.offset_direction?{distance:e.offset_distance,direction:e.offset_direction}:void 0})}function jH(t){const{ctx:A,start:e,end:i,strokeWidth:o,stroke:n,realToCanvasMat:s,lineCap:r="round"}=t,[a,g]=ao(s,[e.x,e.y]),[I,c]=ao(s,[i.x,i.y]),B=o*Math.abs(s.a);A.beginPath(),A.moveTo(a,g),A.lineTo(I,c),A.lineWidth=B,A.strokeStyle=n,A.lineCap=r,A.stroke()}function ZUt(t){const{ctx:A,path:e,realToCanvasMat:i}=t,n=e.color??"rgba(255,255,255,0.5)";if(!(!e.route||e.route.length<2))for(let s=0;s<e.route.length-1;s++){const r=e.route[s],a=e.route[s+1];!r||!a||jH({ctx:A,start:{x:r.x,y:r.y},end:{x:a.x,y:a.y},strokeWidth:e.stroke_width??.1,stroke:n,realToCanvasMat:i})}}function VUt(t){const{ctx:A,rect:e,realToCanvasMat:i}=t,n=e.color??"rgba(255,255,255,0.5)",s=e.is_filled??!1,r=e.has_stroke??!0,a=e.is_stroke_dashed??!1;y0({ctx:A,center:e.center,width:e.width,height:e.height,fill:s?n:void 0,stroke:r?n:void 0,strokeWidth:r?e.stroke_width:void 0,borderRadius:e.corner_radius,realToCanvasMat:i,isStrokeDashed:a})}var jUt="rgba(255,255,255,0.5)";function zUt(t,A){return jUt}function XUt(t){const{ctx:A,text:e,realToCanvasMat:i}=t,o=zUt(e.layer),n=e.color??o,s=e.font_size;vhA({ctx:A,text:e.text,x:e.anchor_position.x,y:e.anchor_position.y,fontSize:s,color:n,realToCanvasMat:i,anchorAlignment:e.anchor_alignment})}function zH(t){const{ctx:A,center:e,radius_x:i,radius_y:o,fill:n,stroke:s,strokeWidth:r=.1,realToCanvasMat:a,rotation:g=0}=t,[I,c]=ao(a,[e.x,e.y]),B=i*Math.abs(a.a),l=o*Math.abs(a.a),C=r*Math.abs(a.a);A.save(),A.translate(I,c),g!==0&&A.rotate(-g*(Math.PI/180)),A.beginPath(),A.ellipse(0,0,B,l,0,0,Math.PI*2),n&&(A.fillStyle=n,A.fill()),s&&(A.strokeStyle=s,A.lineWidth=C,A.stroke()),A.restore()}function cD(t){const{ctx:A,center:e,width:i,height:o,fill:n,realToCanvasMat:s,rotation:r=0,stroke:a,strokeWidth:g}=t,[I,c]=ao(s,[e.x,e.y]),B=i*Math.abs(s.a),l=o*Math.abs(s.a),C=g?g*Math.abs(s.a):void 0;if(A.save(),A.translate(I,c),r!==0&&A.rotate(-r*(Math.PI/180)),A.beginPath(),B>l){const Q=l/2,E=B-l;A.moveTo(-E/2,-Q),A.lineTo(E/2,-Q),A.arc(E/2,0,Q,-Math.PI/2,Math.PI/2),A.lineTo(-E/2,Q),A.arc(-E/2,0,Q,Math.PI/2,-Math.PI/2)}else if(l>B){const Q=B/2,E=l-B;A.moveTo(Q,-E/2),A.lineTo(Q,E/2),A.arc(0,E/2,Q,0,Math.PI),A.lineTo(-Q,-E/2),A.arc(0,-E/2,Q,Math.PI,0)}else A.arc(0,0,B/2,0,Math.PI*2);A.closePath(),n&&(A.fillStyle=n,A.fill()),a&&C&&(A.strokeStyle=a,A.lineWidth=C,A.stroke()),A.restore()}function QZ(t){return"ccw_rotation"in t&&typeof t.ccw_rotation=="number"?t.ccw_rotation:0}function $Ut(t){const{ctx:A,hole:e,realToCanvasMat:i,colorMap:o,soldermaskMargin:n=0}=t;if(e.is_covered_with_solder_mask===!0)return;const s=n<0?Math.abs(n):0;if(e.hole_shape==="circle"){ID({ctx:A,center:{x:e.x,y:e.y},radius:e.hole_diameter/2-s,fill:o.drill,realToCanvasMat:i});return}if(e.hole_shape==="square"){const r=QZ(e);y0({ctx:A,center:{x:e.x,y:e.y},width:e.hole_diameter-s*2,height:e.hole_diameter-s*2,fill:o.drill,realToCanvasMat:i,rotation:r});return}if(e.hole_shape==="oval"){const r=QZ(e);zH({ctx:A,center:{x:e.x,y:e.y},radius_x:e.hole_width/2-s,radius_y:e.hole_height/2-s,fill:o.drill,realToCanvasMat:i,rotation:r});return}if(e.hole_shape==="rect"){const r=QZ(e);y0({ctx:A,center:{x:e.x,y:e.y},width:e.hole_width-s*2,height:e.hole_height-s*2,fill:o.drill,realToCanvasMat:i,rotation:r});return}if(e.hole_shape==="pill"||e.hole_shape==="rotated_pill"){const r=QZ(e);cD({ctx:A,center:{x:e.x,y:e.y},width:e.hole_width-s*2,height:e.hole_height-s*2,fill:o.drill,realToCanvasMat:i,rotation:r});return}}function ALt(t,A){const e=parseInt(t.slice(1,3),16),i=parseInt(t.slice(3,5),16),o=parseInt(t.slice(5,7),16);return`rgba(${e}, ${i}, ${o}, ${A})`}function eLt(t){const{ctx:A,keepout:e,realToCanvasMat:i,colorMap:o}=t,n=o.keepout,s=ALt(o.keepout,.2),r=1;if(e.shape==="rect"){const[a,g]=ao(i,[e.center.x,e.center.y]),I=e.width*Math.abs(i.a),c=e.height*Math.abs(i.a),B=e.rotation??0;A.save(),A.translate(a,g),B!==0&&A.rotate(-B*(Math.PI/180)),A.beginPath(),A.rect(-I/2,-c/2,I,c),A.fillStyle=s,A.fill(),A.beginPath(),A.rect(-I/2,-c/2,I,c),A.clip();const l=r*Math.abs(i.a),C=Math.sqrt(I*I+c*c),Q=I/2,E=c/2;A.strokeStyle=n,A.lineWidth=.15*Math.abs(i.a),A.setLineDash([]);for(let h=-C;h<C*2;h+=l){A.beginPath();const u=-Q+h,d=-E,f=-Q+h+C,m=-E+C;A.moveTo(u,d),A.lineTo(f,m),A.stroke()}A.restore();return}if(e.shape==="circle"){const[a,g]=ao(i,[e.center.x,e.center.y]),I=e.radius*Math.abs(i.a),c=r*Math.abs(i.a);A.save(),A.translate(a,g),A.beginPath(),A.arc(0,0,I,0,Math.PI*2),A.fillStyle=s,A.fill(),A.beginPath(),A.arc(0,0,I,0,Math.PI*2),A.clip();const B=I*2;A.strokeStyle=n,A.lineWidth=.15*Math.abs(i.a),A.setLineDash([]);for(let l=-B;l<B*2;l+=c)A.beginPath(),A.moveTo(l-B,-B),A.lineTo(l+B,B),A.stroke();A.restore();return}}var tLt="rgba(255,255,255,0.5)";function iLt(t){const{ctx:A,pcbNoteDimension:e,realToCanvasMat:i}=t,o=e.color??tLt;_ee({ctx:A,from:e.from,to:e.to,realToCanvasMat:i,color:o,fontSize:e.font_size,arrowSize:e.arrow_size,text:e.text,textRotation:e.text_ccw_rotation,offset:e.offset_distance&&e.offset_direction?{distance:e.offset_distance,direction:e.offset_direction}:void 0})}function oLt(t){const{ctx:A,line:e,realToCanvasMat:i}=t,n=e.color??"rgb(89, 148, 220)",s=e.stroke_width??.1,r=e.is_dashed??!1,[a,g]=ao(i,[e.x1,e.y1]),[I,c]=ao(i,[e.x2,e.y2]),B=s*Math.abs(i.a);A.save(),r?A.setLineDash([B*2,B*2]):A.setLineDash([]),A.beginPath(),A.moveTo(a,g),A.lineTo(I,c),A.lineWidth=B,A.strokeStyle=n,A.lineCap="round",A.stroke(),A.restore()}function nLt(t){const{ctx:A,path:e,realToCanvasMat:i}=t,n=e.color??"rgb(89, 148, 220)";if(!(!e.route||e.route.length<2))for(let s=0;s<e.route.length-1;s++){const r=e.route[s],a=e.route[s+1];!r||!a||jH({ctx:A,start:{x:r.x,y:r.y},end:{x:a.x,y:a.y},strokeWidth:e.stroke_width??.1,stroke:n,realToCanvasMat:i})}}function sLt(t){const{ctx:A,rect:e,realToCanvasMat:i}=t,n=e.color??"rgb(89, 148, 220)",s=e.is_filled??!1,r=e.has_stroke??!0,a=e.is_stroke_dashed??!1;y0({ctx:A,center:e.center,width:e.width,height:e.height,fill:s?n:void 0,stroke:r?n:void 0,strokeWidth:r?e.stroke_width:void 0,borderRadius:e.corner_radius,realToCanvasMat:i,isStrokeDashed:a})}var rLt="rgb(89, 148, 220)";function aLt(t){const{ctx:A,text:e,realToCanvasMat:i}=t,o=rLt,n=e.color??o,s=e.font_size??1;vhA({ctx:A,text:e.text??"",x:e.anchor_position.x,y:e.anchor_position.y,fontSize:s,color:n,realToCanvasMat:i,anchorAlignment:e.anchor_alignment??"center"})}function gLt(t){const{ctx:A,panel:e,realToCanvasMat:i,colorMap:o,drawBoardMaterial:n}=t,{width:s,height:r,center:a}=e;if(s!==void 0&&r!==void 0&&a){n&&y0({ctx:A,center:a,width:s,height:r,fill:o.substrate,realToCanvasMat:i});const g=s/2,I=r/2,c=[{x:a.x-g,y:a.y-I},{x:a.x+g,y:a.y-I},{x:a.x+g,y:a.y+I},{x:a.x-g,y:a.y+I}];BZ({ctx:A,points:c,stroke:o.boardOutline,strokeWidth:.5,realToCanvasMat:i,closePath:!0})}}function XH(t,A){if(t.length<3||A===0)return t;let e=0,i=0;for(const n of t)e+=n.x,i+=n.y;e/=t.length,i/=t.length;const o=[];for(const n of t){const s=n.x-e,r=n.y-i,a=Math.sqrt(s*s+r*r);if(a>0){const g=s/a,I=r/a;o.push({x:n.x+g*A,y:n.y+I*A})}else o.push({x:n.x+A,y:n.y})}return o}function ILt(t){const{ctx:A,hole:e,realToCanvasMat:i,colorMap:o,soldermaskMargin:n=0,drawSoldermask:s}=t;if(e.is_covered_with_solder_mask===!0&&s)return;const r=o.copper.top,a=n<0?Math.abs(n):0;if(e.shape==="circle"){ID({ctx:A,center:{x:e.x,y:e.y},radius:e.outer_diameter/2-a,fill:r,realToCanvasMat:i}),ID({ctx:A,center:{x:e.x,y:e.y},radius:e.hole_diameter/2,fill:o.drill,realToCanvasMat:i});return}if(e.shape==="oval"){zH({ctx:A,center:{x:e.x,y:e.y},radius_x:e.outer_width/2-a,radius_y:e.outer_height/2-a,fill:r,realToCanvasMat:i,rotation:e.ccw_rotation}),zH({ctx:A,center:{x:e.x,y:e.y},radius_x:e.hole_width/2,radius_y:e.hole_height/2,fill:o.drill,realToCanvasMat:i,rotation:e.ccw_rotation});return}if(e.shape==="pill"){cD({ctx:A,center:{x:e.x,y:e.y},width:e.outer_width-a*2,height:e.outer_height-a*2,fill:r,realToCanvasMat:i,rotation:e.ccw_rotation}),cD({ctx:A,center:{x:e.x,y:e.y},width:e.hole_width,height:e.hole_height,fill:o.drill,realToCanvasMat:i,rotation:e.ccw_rotation});return}if(e.shape==="circular_hole_with_rect_pad"){y0({ctx:A,center:{x:e.x,y:e.y},width:e.rect_pad_width-a*2,height:e.rect_pad_height-a*2,fill:r,realToCanvasMat:i,borderRadius:e.rect_border_radius?Math.max(0,e.rect_border_radius-a):0});const g=e.x+(e.hole_offset_x??0),I=e.y+(e.hole_offset_y??0);ID({ctx:A,center:{x:g,y:I},radius:e.hole_diameter/2,fill:o.drill,realToCanvasMat:i});return}if(e.shape==="pill_hole_with_rect_pad"){y0({ctx:A,center:{x:e.x,y:e.y},width:e.rect_pad_width-a*2,height:e.rect_pad_height-a*2,fill:r,realToCanvasMat:i,borderRadius:e.rect_border_radius?Math.max(0,e.rect_border_radius-a):0});const g=e.x+(e.hole_offset_x??0),I=e.y+(e.hole_offset_y??0);cD({ctx:A,center:{x:g,y:I},width:e.hole_width,height:e.hole_height,fill:o.drill,realToCanvasMat:i});return}if(e.shape==="rotated_pill_hole_with_rect_pad"){y0({ctx:A,center:{x:e.x,y:e.y},width:e.rect_pad_width-a*2,height:e.rect_pad_height-a*2,fill:r,realToCanvasMat:i,borderRadius:e.rect_border_radius?Math.max(0,e.rect_border_radius-a):0,rotation:e.rect_ccw_rotation});const g=e.x+(e.hole_offset_x??0),I=e.y+(e.hole_offset_y??0);cD({ctx:A,center:{x:g,y:I},width:e.hole_width,height:e.hole_height,fill:o.drill,realToCanvasMat:i,rotation:e.hole_ccw_rotation});return}if(e.shape==="hole_with_polygon_pad"){const g=e.pad_outline;if(g&&g.length>=3){const l=g.map(Q=>({x:e.x+Q.x,y:e.y+Q.y})),C=a>0?XH(l,-a):l;C.length>=3&&lZ({ctx:A,points:C,fill:r,realToCanvasMat:i})}const I=e.x+(e.hole_offset_x??0),c=e.y+(e.hole_offset_y??0),B=e.hole_shape;B==="circle"?ID({ctx:A,center:{x:I,y:c},radius:(e.hole_diameter??0)/2,fill:o.drill,realToCanvasMat:i}):B==="oval"?zH({ctx:A,center:{x:I,y:c},radius_x:(e.hole_width??0)/2,radius_y:(e.hole_height??0)/2,fill:o.drill,realToCanvasMat:i}):B==="pill"?cD({ctx:A,center:{x:I,y:c},width:e.hole_width??0,height:e.hole_height??0,fill:o.drill,realToCanvasMat:i}):B==="rotated_pill"&&cD({ctx:A,center:{x:I,y:c},width:e.hole_width??0,height:e.hole_height??0,fill:o.drill,realToCanvasMat:i});return}}function cLt(t,A){return t==="bottom"?A.silkscreen.bottom:A.silkscreen.top}function BLt(t){const{ctx:A,circle:e,realToCanvasMat:i,colorMap:o}=t,n=cLt(e.layer,o);ID({ctx:A,center:e.center,radius:e.radius,stroke:n,strokeWidth:e.stroke_width,realToCanvasMat:i})}function lLt(t,A){return t==="bottom"?A.silkscreen.bottom:A.silkscreen.top}function CLt(t){const{ctx:A,line:e,realToCanvasMat:i,colorMap:o}=t,n=lLt(e.layer,o);jH({ctx:A,start:{x:e.x1,y:e.y1},end:{x:e.x2,y:e.y2},strokeWidth:e.stroke_width??.1,stroke:n,realToCanvasMat:i})}function QLt(t,A){return t==="bottom"?A.silkscreen.bottom:A.silkscreen.top}function ELt(t){const{ctx:A,oval:e,realToCanvasMat:i,colorMap:o}=t,n=QLt(e.layer,o);zH({ctx:A,center:e.center,radius_x:e.radius_x,radius_y:e.radius_y,stroke:n,strokeWidth:.1,realToCanvasMat:i,rotation:e.ccw_rotation??0})}function hLt(t,A){return t==="bottom"?A.silkscreen.bottom:A.silkscreen.top}function uLt(t){const{ctx:A,path:e,realToCanvasMat:i,colorMap:o}=t,n=hLt(e.layer,o);if(!(!e.route||e.route.length<2))for(let s=0;s<e.route.length-1;s++){const r=e.route[s],a=e.route[s+1];!r||!a||jH({ctx:A,start:{x:r.x,y:r.y},end:{x:a.x,y:a.y},strokeWidth:e.stroke_width??.1,stroke:n,realToCanvasMat:i})}}function dLt(t,A){return t==="bottom"?A.silkscreen.bottom:A.silkscreen.top}function pLt(t){const{ctx:A,pill:e,realToCanvasMat:i,colorMap:o}=t,n=dLt(e.layer,o);cD({ctx:A,center:e.center,width:e.width,height:e.height,stroke:n,strokeWidth:.2,realToCanvasMat:i})}function fLt(t,A){return t==="bottom"?A.silkscreen.bottom:A.silkscreen.top}function yLt(t){const{ctx:A,rect:e,realToCanvasMat:i,colorMap:o}=t,n=fLt(e.layer,o);y0({ctx:A,center:e.center,width:e.width,height:e.height,fill:e.is_filled?n:"transparent",stroke:n,strokeWidth:e.stroke_width,realToCanvasMat:i})}function wLt(t,A){return t==="bottom"?A.silkscreen.bottom:A.silkscreen.top}function mLt(t){return t||"center"}function DLt(t){const{ctx:A,text:e,realToCanvasMat:i,colorMap:o}=t,n=e.text??"";if(!n)return;const s=wLt(e.layer,o),[r,a]=ao(i,[e.anchor_position.x,e.anchor_position.y]),g=Math.abs(i.a),I=(e.font_size??1)*g,c=e.ccw_rotation??0,B=CZ(n,I),l=mLt(e.anchor_alignment),C=MhA(l,B);A.save(),A.translate(r,a),c!==0&&A.rotate(-c*(Math.PI/180)),e.layer==="bottom"&&A.scale(-1,1),A.lineWidth=B.strokeWidth,A.lineCap="round",A.lineJoin="round",A.strokeStyle=s;const{lines:Q,lineWidths:E,lineHeight:h,width:u,strokeWidth:d}=B;Q.forEach((f,m)=>{const S=C.x+NhA({alignment:l,lineWidth:E[m],maxWidth:u,strokeWidth:d}),D=C.y+m*h;_hA({ctx:A,line:f,fontSize:I,startX:S,startY:D,layout:B})}),A.restore()}function SLt(t,A){return A.copper[t]??A.copper.top}function vee(t){return t.shape==="rect"||t.shape==="rotated_rect"?t.corner_radius??t.rect_border_radius??0:0}function bLt(t){const{ctx:A,pad:e,realToCanvasMat:i,colorMap:o}=t,n=SLt(e.layer,o);if(e.shape==="rect"){y0({ctx:A,center:{x:e.x,y:e.y},width:e.width,height:e.height,fill:n,realToCanvasMat:i,borderRadius:vee(e)});return}if(e.shape==="rotated_rect"){y0({ctx:A,center:{x:e.x,y:e.y},width:e.width,height:e.height,fill:n,realToCanvasMat:i,borderRadius:vee(e),rotation:e.ccw_rotation??0});return}if(e.shape==="circle"){ID({ctx:A,center:{x:e.x,y:e.y},radius:e.radius,fill:n,realToCanvasMat:i});return}if(e.shape==="pill"){cD({ctx:A,center:{x:e.x,y:e.y},width:e.width,height:e.height,fill:n,realToCanvasMat:i});return}if(e.shape==="rotated_pill"){cD({ctx:A,center:{x:e.x,y:e.y},width:e.width,height:e.height,fill:n,realToCanvasMat:i,rotation:e.ccw_rotation??0});return}if(e.shape==="polygon"){e.points&&e.points.length>=3&&lZ({ctx:A,points:e.points,fill:n,realToCanvasMat:i});return}}function Ik(t){const{ctx:A,points:e}=t;if(e.length<3)return;const i=e[0];if(i){A.moveTo(i.x,i.y);for(let o=1;o<e.length;o++){const n=e[o];n&&A.lineTo(n.x,n.y)}A.closePath()}}function xLt(t){const{ctx:A,board:e,realToCanvasMat:i,soldermaskColor:o}=t,{width:n,height:s,center:r,outline:a}=e;if(a&&Array.isArray(a)&&a.length>=3){const g=a.map(I=>{const[c,B]=ao(i,[I.x,I.y]);return{x:c,y:B}});A.beginPath(),Ik({ctx:A,points:g}),A.fillStyle=o,A.fill()}else if(n!==void 0&&s!==void 0&&r){const[g,I]=ao(i,[r.x,r.y]),c=n*Math.abs(i.a),B=s*Math.abs(i.a);A.fillStyle=o,A.fillRect(g-c/2,I-B/2,c,B)}}function ck(t){const{ctx:A,cx:e,cy:i,width:o,height:n,radius:s}=t,r=e-o/2,a=i-n/2,g=Math.min(s,o/2,n/2);g>0?(A.moveTo(r+g,a),A.lineTo(r+o-g,a),A.arcTo(r+o,a,r+o,a+g,g),A.lineTo(r+o,a+n-g),A.arcTo(r+o,a+n,r+o-g,a+n,g),A.lineTo(r+g,a+n),A.arcTo(r,a+n,r,a+n-g,g),A.lineTo(r,a+g),A.arcTo(r,a,r+g,a,g)):A.rect(r,a,o,n),A.closePath()}function kLt(t){const{ctx:A,cutout:e,realToCanvasMat:i,colorMap:o}=t;if(A.fillStyle=o.drill,e.shape==="rect"){const[n,s]=ao(i,[e.center?.x??0,e.center?.y??0]),r=e.width*Math.abs(i.a),a=e.height*Math.abs(i.a),g=(e.corner_radius??0)*Math.abs(i.a);A.save(),A.translate(n,s),e.rotation&&A.rotate(-e.rotation*Math.PI/180),A.beginPath(),ck({ctx:A,cx:0,cy:0,width:r,height:a,radius:g}),A.restore(),A.fill()}else if(e.shape==="circle"){const[n,s]=ao(i,[e.center?.x??0,e.center?.y??0]),r=e.radius*Math.abs(i.a);A.beginPath(),A.arc(n,s,r,0,Math.PI*2),A.closePath(),A.fill()}else if(e.shape==="polygon"&&e.points&&e.points.length>=3){const n=e.points.map(s=>{const[r,a]=ao(i,[s.x,s.y]);return{x:r,y:a}});A.beginPath(),Ik({ctx:A,points:n}),A.fill()}}function OS(t){const{ctx:A,cx:e,cy:i,width:o,height:n}=t;if(o>n){const s=n/2,r=o-n;A.moveTo(e-r/2,i-s),A.lineTo(e+r/2,i-s),A.arc(e+r/2,i,s,-Math.PI/2,Math.PI/2),A.lineTo(e-r/2,i+s),A.arc(e-r/2,i,s,Math.PI/2,-Math.PI/2)}else if(n>o){const s=o/2,r=n-o;A.moveTo(e+s,i-r/2),A.lineTo(e+s,i+r/2),A.arc(e,i+r/2,s,0,Math.PI),A.lineTo(e-s,i-r/2),A.arc(e,i-r/2,s,Math.PI,0)}else A.arc(e,i,o/2,0,Math.PI*2);A.closePath()}function GLt(t){const{ctx:A,hole:e,realToCanvasMat:i,colorMap:o,soldermaskOverCopperColor:n,drawSoldermask:s}=t,r=s&&e.is_covered_with_solder_mask===!0,a=s?e.soldermask_margin??0:0;r?(A.fillStyle=n,$H({ctx:A,hole:e,realToCanvasMat:i,margin:0}),A.fill()):a<0?(A.fillStyle=o.drill,$H({ctx:A,hole:e,realToCanvasMat:i,margin:0}),A.fill(),FLt({ctx:A,hole:e,realToCanvasMat:i,soldermaskOverCopperColor:n,margin:a})):a>0?(A.fillStyle=o.substrate,$H({ctx:A,hole:e,realToCanvasMat:i,margin:a}),A.fill(),A.fillStyle=o.drill,$H({ctx:A,hole:e,realToCanvasMat:i,margin:0}),A.fill()):(A.fillStyle=o.drill,$H({ctx:A,hole:e,realToCanvasMat:i,margin:0}),A.fill())}function Uee(t){return"ccw_rotation"in t&&typeof t.ccw_rotation=="number"?t.ccw_rotation:0}function $H(t){const{ctx:A,hole:e,realToCanvasMat:i,margin:o}=t,n=Uee(e);if(e.hole_shape==="circle"){const[s,r]=ao(i,[e.x,e.y]),a=(e.hole_diameter/2+o)*Math.abs(i.a);A.beginPath(),A.arc(s,r,a,0,Math.PI*2),A.closePath()}else if(e.hole_shape==="square"){const[s,r]=ao(i,[e.x,e.y]),a=(e.hole_diameter+o*2)*Math.abs(i.a);A.save(),A.translate(s,r),n!==0&&A.rotate(-n*Math.PI/180),A.beginPath(),A.rect(-a/2,-a/2,a,a),A.closePath(),A.restore()}else if(e.hole_shape==="oval"){const[s,r]=ao(i,[e.x,e.y]),a=(e.hole_width/2+o)*Math.abs(i.a),g=(e.hole_height/2+o)*Math.abs(i.a);A.save(),A.translate(s,r),n!==0&&A.rotate(-n*Math.PI/180),A.beginPath(),A.ellipse(0,0,a,g,0,0,Math.PI*2),A.closePath(),A.restore()}else if(e.hole_shape==="rect"){const[s,r]=ao(i,[e.x,e.y]),a=(e.hole_width+o*2)*Math.abs(i.a),g=(e.hole_height+o*2)*Math.abs(i.a);A.save(),A.translate(s,r),n!==0&&A.rotate(-n*Math.PI/180),A.beginPath(),A.rect(-a/2,-g/2,a,g),A.closePath(),A.restore()}else if(e.hole_shape==="pill"||e.hole_shape==="rotated_pill"){const[s,r]=ao(i,[e.x,e.y]),a=(e.hole_width+o*2)*Math.abs(i.a),g=(e.hole_height+o*2)*Math.abs(i.a);A.save(),A.translate(s,r),n!==0&&A.rotate(-n*Math.PI/180),A.beginPath(),OS({ctx:A,cx:0,cy:0,width:a,height:g}),A.restore()}}function FLt(t){const{ctx:A,hole:e,realToCanvasMat:i,soldermaskOverCopperColor:o,margin:n}=t,s=Math.abs(n),r=Uee(e);if(A.fillStyle=o,e.hole_shape==="circle"){const[a,g]=ao(i,[e.x,e.y]),I=e.hole_diameter/2*Math.abs(i.a),c=s*Math.abs(i.a),B=Math.max(0,I-c);A.save(),A.beginPath(),A.arc(a,g,I,0,Math.PI*2),B>0&&A.arc(a,g,B,0,Math.PI*2,!0),A.fill("evenodd"),A.restore()}else if(e.hole_shape==="square"){const[a,g]=ao(i,[e.x,e.y]),I=e.hole_diameter*Math.abs(i.a),c=s*Math.abs(i.a),B=Math.max(0,I-c*2);A.save(),A.translate(a,g),r!==0&&A.rotate(-r*Math.PI/180),A.beginPath(),A.rect(-I/2,-I/2,I,I),B>0&&A.rect(-B/2,-B/2,B,B),A.fill("evenodd"),A.restore()}else if(e.hole_shape==="oval"){const[a,g]=ao(i,[e.x,e.y]),I=e.hole_width/2*Math.abs(i.a),c=e.hole_height/2*Math.abs(i.a),B=s*Math.abs(i.a),l=Math.max(0,I-B),C=Math.max(0,c-B);A.save(),A.translate(a,g),r!==0&&A.rotate(-r*Math.PI/180),A.beginPath(),A.ellipse(0,0,I,c,0,0,Math.PI*2),l>0&&C>0&&(A.moveTo(l,0),A.ellipse(0,0,l,C,0,0,Math.PI*2)),A.fill("evenodd"),A.restore()}else if(e.hole_shape==="rect"){const[a,g]=ao(i,[e.x,e.y]),I=e.hole_width*Math.abs(i.a),c=e.hole_height*Math.abs(i.a),B=s*Math.abs(i.a),l=Math.max(0,I-B*2),C=Math.max(0,c-B*2);A.save(),A.translate(a,g),r!==0&&A.rotate(-r*Math.PI/180),A.beginPath(),A.rect(-I/2,-c/2,I,c),l>0&&C>0&&A.rect(-l/2,-C/2,l,C),A.fill("evenodd"),A.restore()}else if(e.hole_shape==="pill"||e.hole_shape==="rotated_pill"){const[a,g]=ao(i,[e.x,e.y]),I=e.hole_width*Math.abs(i.a),c=e.hole_height*Math.abs(i.a),B=s*Math.abs(i.a);A.save(),A.translate(a,g),r!==0&&A.rotate(-r*Math.PI/180),A.beginPath(),OS({ctx:A,cx:0,cy:0,width:I,height:c});const l=I-B*2,C=c-B*2;l>0&&C>0&&OS({ctx:A,cx:0,cy:0,width:l,height:C}),A.fill("evenodd"),A.restore()}}function RLt(t){const{ctx:A,hole:e,realToCanvasMat:i,colorMap:o,soldermaskOverCopperColor:n,layer:s,drawSoldermask:r}=t;if(e.layers&&!e.layers.includes(s))return;const a=r&&e.is_covered_with_solder_mask===!0,g=r?e.soldermask_margin??0:0,I=o.copper.top;a?(A.fillStyle=n,AY({ctx:A,hole:e,realToCanvasMat:i,margin:0}),A.fill()):g<0?(A.fillStyle=I,AY({ctx:A,hole:e,realToCanvasMat:i,margin:0}),A.fill(),MLt({ctx:A,hole:e,realToCanvasMat:i,soldermaskOverCopperColor:n,margin:g})):g>0?(A.fillStyle=o.substrate,AY({ctx:A,hole:e,realToCanvasMat:i,margin:g}),A.fill(),A.fillStyle=I,AY({ctx:A,hole:e,realToCanvasMat:i,margin:0}),A.fill()):(A.fillStyle=I,AY({ctx:A,hole:e,realToCanvasMat:i,margin:0}),A.fill())}function AY(t){const{ctx:A,hole:e,realToCanvasMat:i,margin:o}=t;if(e.shape==="circle"){const[n,s]=ao(i,[e.x,e.y]),r=(e.outer_diameter/2+o)*Math.abs(i.a);A.beginPath(),A.arc(n,s,r,0,Math.PI*2),A.closePath()}else if(e.shape==="oval"){const[n,s]=ao(i,[e.x,e.y]),r=(e.outer_width/2+o)*Math.abs(i.a),a=(e.outer_height/2+o)*Math.abs(i.a);A.save(),A.translate(n,s),e.ccw_rotation&&e.ccw_rotation!==0&&A.rotate(-(e.ccw_rotation*Math.PI)/180),A.beginPath(),A.ellipse(0,0,r,a,0,0,Math.PI*2),A.closePath(),A.restore()}else if(e.shape==="pill"){const[n,s]=ao(i,[e.x,e.y]),r=(e.outer_width+o*2)*Math.abs(i.a),a=(e.outer_height+o*2)*Math.abs(i.a);A.save(),A.translate(n,s),e.ccw_rotation&&e.ccw_rotation!==0&&A.rotate(-(e.ccw_rotation*Math.PI)/180),A.beginPath(),OS({ctx:A,cx:0,cy:0,width:r,height:a}),A.restore()}else if(e.shape==="circular_hole_with_rect_pad"||e.shape==="pill_hole_with_rect_pad"){const[n,s]=ao(i,[e.x,e.y]),r=(e.rect_pad_width+o*2)*Math.abs(i.a),a=(e.rect_pad_height+o*2)*Math.abs(i.a),g=(e.rect_border_radius??0)*Math.abs(i.a);A.beginPath(),ck({ctx:A,cx:n,cy:s,width:r,height:a,radius:g})}else if(e.shape==="rotated_pill_hole_with_rect_pad"){const[n,s]=ao(i,[e.x,e.y]),r=(e.rect_pad_width+o*2)*Math.abs(i.a),a=(e.rect_pad_height+o*2)*Math.abs(i.a),g=(e.rect_border_radius??0)*Math.abs(i.a);A.save(),A.translate(n,s),e.rect_ccw_rotation&&A.rotate(-e.rect_ccw_rotation*Math.PI/180),A.beginPath(),ck({ctx:A,cx:0,cy:0,width:r,height:a,radius:g}),A.restore()}else if(e.shape==="hole_with_polygon_pad"&&e.pad_outline&&e.pad_outline.length>=3){const n=e.pad_outline.map(a=>({x:e.x+a.x,y:e.y+a.y})),r=(o!==0?XH(n,o):n).map(a=>{const[g,I]=ao(i,[a.x,a.y]);return{x:g,y:I}});A.beginPath(),Ik({ctx:A,points:r})}}function MLt(t){const{ctx:A,hole:e,realToCanvasMat:i,soldermaskOverCopperColor:o,margin:n}=t,s=Math.abs(n);if(A.fillStyle=o,e.shape==="circle"){const[r,a]=ao(i,[e.x,e.y]),g=e.outer_diameter/2*Math.abs(i.a),I=s*Math.abs(i.a),c=Math.max(0,g-I);A.save(),A.beginPath(),A.arc(r,a,g,0,Math.PI*2),c>0&&A.arc(r,a,c,0,Math.PI*2,!0),A.fill("evenodd"),A.restore()}else if(e.shape==="oval"){const[r,a]=ao(i,[e.x,e.y]),g=e.outer_width/2*Math.abs(i.a),I=e.outer_height/2*Math.abs(i.a),c=s*Math.abs(i.a),B=Math.max(0,g-c),l=Math.max(0,I-c);A.save(),A.translate(r,a),e.ccw_rotation&&e.ccw_rotation!==0&&A.rotate(-(e.ccw_rotation*Math.PI)/180),A.beginPath(),A.ellipse(0,0,g,I,0,0,Math.PI*2),B>0&&l>0&&(A.moveTo(B,0),A.ellipse(0,0,B,l,0,0,Math.PI*2)),A.fill("evenodd"),A.restore()}else if(e.shape==="pill"){const[r,a]=ao(i,[e.x,e.y]),g=e.outer_width*Math.abs(i.a),I=e.outer_height*Math.abs(i.a),c=s*Math.abs(i.a);A.save(),A.translate(r,a),e.ccw_rotation&&e.ccw_rotation!==0&&A.rotate(-(e.ccw_rotation*Math.PI)/180),A.beginPath(),OS({ctx:A,cx:0,cy:0,width:g,height:I});const B=g-c*2,l=I-c*2;B>0&&l>0&&OS({ctx:A,cx:0,cy:0,width:B,height:l}),A.fill("evenodd"),A.restore()}else if(e.shape==="circular_hole_with_rect_pad"||e.shape==="pill_hole_with_rect_pad"||e.shape==="rotated_pill_hole_with_rect_pad"){const[r,a]=ao(i,[e.x,e.y]),g=e.rect_pad_width*Math.abs(i.a),I=e.rect_pad_height*Math.abs(i.a),c=s*Math.abs(i.a);A.save(),A.translate(r,a),e.shape==="rotated_pill_hole_with_rect_pad"&&e.rect_ccw_rotation&&A.rotate(-e.rect_ccw_rotation*Math.PI/180);const B=e.rect_border_radius?e.rect_border_radius*Math.abs(i.a):0;A.beginPath(),ck({ctx:A,cx:0,cy:0,width:g,height:I,radius:B});const l=g-c*2,C=I-c*2;if(l>0&&C>0){const Q=Math.max(0,B-c);ck({ctx:A,cx:0,cy:0,width:l,height:C,radius:Q})}A.fill("evenodd"),A.restore()}else if(e.shape==="hole_with_polygon_pad"&&e.pad_outline&&e.pad_outline.length>=3){const r=e.pad_outline.map(I=>({x:e.x+I.x,y:e.y+I.y}));A.save(),A.beginPath();const a=r.map(I=>{const[c,B]=ao(i,[I.x,I.y]);return{x:c,y:B}});Ik({ctx:A,points:a});const g=XH(r,-s);if(g.length>=3){const I=g.map(c=>{const[B,l]=ao(i,[c.x,c.y]);return{x:B,y:l}});Ik({ctx:A,points:I})}A.fill("evenodd"),A.restore()}}function NLt(t){const{ctx:A,pad:e,realToCanvasMat:i,colorMap:o,soldermaskOverCopperColor:n,layer:s,drawSoldermask:r}=t;if(e.layer!==s)return;const a=r&&e.is_covered_with_solder_mask===!0,g=r?e.soldermask_margin??0:0;let I=g,c=g,B=g,l=g;(e.shape==="rect"||e.shape==="rotated_rect")&&(I=e.soldermask_margin_left??g,c=e.soldermask_margin_right??g,B=e.soldermask_margin_top??g,l=e.soldermask_margin_bottom??g);const C=o.copper[e.layer]||o.copper.top;a?(A.fillStyle=n,eY({ctx:A,pad:e,realToCanvasMat:i,ml:0,mr:0,mt:0,mb:0}),A.fill()):I<0||c<0||B<0||l<0?(A.fillStyle=C,eY({ctx:A,pad:e,realToCanvasMat:i,ml:0,mr:0,mt:0,mb:0}),A.fill(),_Lt({ctx:A,pad:e,realToCanvasMat:i,soldermaskOverCopperColor:n,ml:I,mr:c,mt:B,mb:l})):I>0||c>0||B>0||l>0?(A.fillStyle=o.substrate,eY({ctx:A,pad:e,realToCanvasMat:i,ml:I,mr:c,mt:B,mb:l}),A.fill(),A.fillStyle=C,eY({ctx:A,pad:e,realToCanvasMat:i,ml:0,mr:0,mt:0,mb:0}),A.fill()):(A.fillStyle=C,eY({ctx:A,pad:e,realToCanvasMat:i,ml:0,mr:0,mt:0,mb:0}),A.fill())}function eY(t){const{ctx:A,pad:e,realToCanvasMat:i,ml:o,mr:n,mt:s,mb:r}=t,a=e.shape==="rotated_rect"||e.shape==="rotated_pill"?e.ccw_rotation??0:0;if(e.shape==="rect"||e.shape==="rotated_rect"){const g=e.corner_radius??e.rect_border_radius??0,I=a*Math.PI/180,c=(n-o)/2,B=(s-r)/2,l=c*Math.cos(I)-B*Math.sin(I),C=c*Math.sin(I)+B*Math.cos(I),[Q,E]=ao(i,[e.x+l,e.y+C]),h=(e.width+o+n)*Math.abs(i.a),u=(e.height+s+r)*Math.abs(i.a),d=g*Math.abs(i.a);A.save(),A.translate(Q,E),a!==0&&A.rotate(-a*Math.PI/180),A.beginPath(),ck({ctx:A,cx:0,cy:0,width:h,height:u,radius:d}),A.restore()}else if(e.shape==="circle"){const g=(o+n+s+r)/4,[I,c]=ao(i,[e.x,e.y]),B=(e.radius+g)*Math.abs(i.a);A.beginPath(),A.arc(I,c,B,0,Math.PI*2),A.closePath()}else if(e.shape==="pill"||e.shape==="rotated_pill"){const g=(o+n)/2,[I,c]=ao(i,[e.x,e.y]),B=(e.width+g*2)*Math.abs(i.a),l=(e.height+g*2)*Math.abs(i.a);A.save(),A.translate(I,c),a!==0&&A.rotate(-a*Math.PI/180),A.beginPath(),OS({ctx:A,cx:0,cy:0,width:B,height:l}),A.restore()}else if(e.shape==="polygon"&&e.points&&e.points.length>=3){const g=(o+n+s+r)/4,c=(g!==0?XH(e.points,g):e.points).map(B=>{const[l,C]=ao(i,[B.x,B.y]);return{x:l,y:C}});A.beginPath(),Ik({ctx:A,points:c})}}function _Lt(t){const{ctx:A,pad:e,realToCanvasMat:i,soldermaskOverCopperColor:o,ml:n,mr:s,mt:r,mb:a}=t,g=e.shape==="rotated_rect"||e.shape==="rotated_pill"?e.ccw_rotation??0:0,I=Math.max(0,-n),c=Math.max(0,-s),B=Math.max(0,-r),l=Math.max(0,-a);if(A.fillStyle=o,e.shape==="rect"||e.shape==="rotated_rect"){const C=e.corner_radius??e.rect_border_radius??0,[Q,E]=ao(i,[e.x,e.y]),h=e.width*Math.abs(i.a),u=e.height*Math.abs(i.a),d=C*Math.abs(i.a),f=I*Math.abs(i.a),m=c*Math.abs(i.a),S=B*Math.abs(i.a),D=l*Math.abs(i.a);A.save(),A.translate(Q,E),g!==0&&A.rotate(-g*Math.PI/180),A.beginPath(),ck({ctx:A,cx:0,cy:0,width:h,height:u,radius:d});const x=h-f-m,F=u-S-D,k=(f-m)/2,v=(S-D)/2,_=Math.max(0,d-(f+m+S+D)/4);x>0&&F>0&&ck({ctx:A,cx:k,cy:v,width:x,height:F,radius:_}),A.fill("evenodd"),A.restore()}else if(e.shape==="circle"){const C=Math.max(I,c,B,l),[Q,E]=ao(i,[e.x,e.y]),h=e.radius*Math.abs(i.a),u=C*Math.abs(i.a),d=Math.max(0,h-u);A.save(),A.beginPath(),A.arc(Q,E,h,0,Math.PI*2),d>0&&A.arc(Q,E,d,0,Math.PI*2,!0),A.fill("evenodd"),A.restore()}else if(e.shape==="pill"||e.shape==="rotated_pill"){const C=Math.max(I,c,B,l),[Q,E]=ao(i,[e.x,e.y]),h=e.width*Math.abs(i.a),u=e.height*Math.abs(i.a),d=C*Math.abs(i.a);A.save(),A.translate(Q,E),g!==0&&A.rotate(-g*Math.PI/180),A.beginPath(),OS({ctx:A,cx:0,cy:0,width:h,height:u});const f=h-d*2,m=u-d*2;f>0&&m>0&&OS({ctx:A,cx:0,cy:0,width:f,height:m}),A.fill("evenodd"),A.restore()}else if(e.shape==="polygon"&&e.points&&e.points.length>=3){const C=Math.max(I,c,B,l);A.save(),A.beginPath();const Q=e.points.map(h=>{const[u,d]=ao(i,[h.x,h.y]);return{x:u,y:d}});Ik({ctx:A,points:Q});const E=XH(e.points,-C);if(E.length>=3){const h=E.map(u=>{const[d,f]=ao(i,[u.x,u.y]);return{x:d,y:f}});Ik({ctx:A,points:h})}A.fill("evenodd"),A.restore()}}function vLt(t){const{ctx:A,via:e,realToCanvasMat:i,colorMap:o}=t,[n,s]=ao(i,[e.x,e.y]),r=e.outer_diameter/2*Math.abs(i.a);A.fillStyle=o.substrate,A.beginPath(),A.arc(n,s,r,0,Math.PI*2),A.closePath(),A.fill()}function ULt(t){const{ctx:A,board:e,elements:i,realToCanvasMat:o,colorMap:n,layer:s,drawSoldermask:r}=t,a=n.soldermask[s]??n.soldermask.top,g=n.soldermaskOverCopper[s]??n.soldermaskOverCopper.top;r&&xLt({ctx:A,board:e,realToCanvasMat:o,soldermaskColor:a});for(const I of i)LLt({ctx:A,element:I,realToCanvasMat:o,colorMap:n,soldermaskOverCopperColor:g,layer:s,drawSoldermask:r})}function LLt(t){const{ctx:A,element:e,realToCanvasMat:i,colorMap:o,soldermaskOverCopperColor:n,layer:s,drawSoldermask:r}=t;e.type==="pcb_smtpad"?NLt({ctx:A,pad:e,realToCanvasMat:i,colorMap:o,soldermaskOverCopperColor:n,layer:s,drawSoldermask:r}):e.type==="pcb_plated_hole"?RLt({ctx:A,hole:e,realToCanvasMat:i,colorMap:o,soldermaskOverCopperColor:n,layer:s,drawSoldermask:r}):e.type==="pcb_hole"?GLt({ctx:A,hole:e,realToCanvasMat:i,colorMap:o,soldermaskOverCopperColor:n,drawSoldermask:r}):e.type==="pcb_via"?vLt({ctx:A,via:e,realToCanvasMat:i,colorMap:o}):e.type==="pcb_cutout"&&kLt({ctx:A,cutout:e,realToCanvasMat:i,colorMap:o})}function HLt(t,A){return A.copper[t]??A.copper.top}function YLt(t){const{ctx:A,trace:e,realToCanvasMat:i,colorMap:o}=t;if(!(!e.route||!Array.isArray(e.route)||e.route.length<2))for(let n=0;n<e.route.length-1;n++){const s=e.route[n],r=e.route[n+1];if(!s||!r)continue;const a="layer"in s?s.layer:"layer"in r?r.layer:null;if(!a)continue;const g=HLt(a,o),I="width"in s?s.width:"width"in r?r.width:.1;jH({ctx:A,start:{x:s.x,y:s.y},end:{x:r.x,y:r.y},strokeWidth:I,stroke:g,realToCanvasMat:i,lineCap:"round"})}}function JLt(t){const{ctx:A,via:e,realToCanvasMat:i,colorMap:o}=t;ID({ctx:A,center:{x:e.x,y:e.y},radius:e.outer_diameter/2,fill:o.copper.top,realToCanvasMat:i}),ID({ctx:A,center:{x:e.x,y:e.y},radius:e.hole_diameter/2,fill:o.drill,realToCanvasMat:i})}function ov(t,A){if(!A.layers||A.layers.length===0)return!0;const e=JRA(t);return e.length===0?!0:e.some(i=>A.layers.includes(i))}var WS={copper:{top:"rgb(200, 52, 52)",inner1:"rgb(255, 140, 0)",inner2:"rgb(255, 215, 0)",inner3:"rgb(50, 205, 50)",inner4:"rgb(64, 224, 208)",inner5:"rgb(138, 43, 226)",inner6:"rgb(255, 105, 180)",bottom:"rgb(77, 127, 196)"},soldermaskWithCopperUnderneath:{top:"rgb(18, 82, 50)",bottom:"rgb(77, 127, 196)"},soldermask:{top:"rgb(12, 55, 33)",bottom:"rgb(12, 55, 33)"},soldermaskOverCopper:{top:"rgb(52, 135, 73)",bottom:"rgb(52, 135, 73)"},substrate:"rgb(201, 162, 110)",drill:"#FF26E2",silkscreen:{top:"#f2eda1",bottom:"#5da9e9"},boardOutline:"rgba(255, 255, 255, 0.5)",courtyard:"#FF00FF",keepout:"#FF6B6B"},cf=class{ctx;colorMap;realToCanvasMat;constructor(t){if("getContext"in t&&typeof t.getContext=="function"){const A=t.getContext("2d");if(!A)throw new Error("Failed to get 2D rendering context from canvas");this.ctx=A}else this.ctx=t;this.colorMap={...WS},this.realToCanvasMat=DUt()}configure(t){t.colorOverrides&&(this.colorMap={...this.colorMap,...t.colorOverrides,copper:{...this.colorMap.copper,...t.colorOverrides.copper},silkscreen:{...this.colorMap.silkscreen,...t.colorOverrides.silkscreen},soldermask:{...this.colorMap.soldermask,...t.colorOverrides.soldermask},soldermaskWithCopperUnderneath:{...this.colorMap.soldermaskWithCopperUnderneath,...t.colorOverrides.soldermaskWithCopperUnderneath},soldermaskOverCopper:{...this.colorMap.soldermaskOverCopper,...t.colorOverrides.soldermaskOverCopper}})}setCameraBounds(t){const A=this.ctx.canvas,e=A.width,i=A.height,o=t.maxX-t.minX,n=t.maxY-t.minY,s=e/o,r=i/n,a=Math.min(s,r),g=(e-o*a)/2,I=(i-n*a)/2;this.realToCanvasMat=SUt(cZ(g,I),bUt(a,-a),cZ(-t.minX,-t.maxY))}drawElements(t,A={}){const e=t.find(n=>n.type==="pcb_board"),i=t.find(n=>n.type==="pcb_panel");i&&gLt({ctx:this.ctx,panel:i,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,drawBoardMaterial:A.drawBoardMaterial??!1}),e&&xUt({ctx:this.ctx,board:e,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,drawBoardMaterial:A.drawBoardMaterial??!1});for(const n of t)ov(n,A)&&(n.type==="pcb_smtpad"&&bLt({ctx:this.ctx,pad:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_copper_text"&&JUt({ctx:this.ctx,text:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}));const o=A.drawSoldermask??!1;e&&ULt({ctx:this.ctx,board:e,elements:t,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,layer:"top",drawSoldermask:o});for(const n of t)ov(n,A)&&(n.type==="pcb_silkscreen_text"&&DLt({ctx:this.ctx,text:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_silkscreen_rect"&&yLt({ctx:this.ctx,rect:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_silkscreen_circle"&&BLt({ctx:this.ctx,circle:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_silkscreen_line"&&CLt({ctx:this.ctx,line:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_silkscreen_path"&&uLt({ctx:this.ctx,path:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_silkscreen_pill"&&pLt({ctx:this.ctx,pill:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_silkscreen_oval"&&ELt({ctx:this.ctx,oval:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}));for(const n of t)ov(n,A)&&(n.type==="pcb_copper_pour"&&FUt({ctx:this.ctx,pour:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_trace"&&YLt({ctx:this.ctx,trace:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}));for(const n of t)ov(n,A)&&(n.type==="pcb_plated_hole"&&ILt({ctx:this.ctx,hole:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,soldermaskMargin:o?n.soldermask_margin:void 0,drawSoldermask:o}),n.type==="pcb_via"&&JLt({ctx:this.ctx,via:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}));for(const n of t)ov(n,A)&&(n.type==="pcb_hole"&&$Ut({ctx:this.ctx,hole:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,soldermaskMargin:o?n.soldermask_margin:void 0}),n.type==="pcb_cutout"&&TUt({ctx:this.ctx,cutout:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}));for(const n of t)ov(n,A)&&(n.type==="pcb_keepout"&&eLt({ctx:this.ctx,keepout:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_fabrication_note_text"&&XUt({ctx:this.ctx,text:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_fabrication_note_rect"&&VUt({ctx:this.ctx,rect:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_note_rect"&&sLt({realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,ctx:this.ctx,rect:n}),n.type==="pcb_fabrication_note_path"&&ZUt({ctx:this.ctx,path:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_note_path"&&nLt({ctx:this.ctx,path:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_note_text"&&aLt({ctx:this.ctx,text:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_note_line"&&oLt({ctx:this.ctx,line:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_note_dimension"&&iLt({ctx:this.ctx,pcbNoteDimension:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),n.type==="pcb_fabrication_note_dimension"&&WUt({ctx:this.ctx,pcbFabricationNoteDimension:n,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}))}};const TLt=khe(NNe);var LhA,Lee;function KLt(){if(Lee)return LhA;Lee=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}),LhA=s(r);var a=e0(),g=TLt,I=XwA(),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:m="rgba(0,0,0,0.2)",minorColor:S="rgba(0,0,0,0.1)",textColor:D=(h=E.majorColor)!=null?h:"rgba(0,0,0,0.5)",width:x,height:F,screenSpaceCellSize:k=200,stringifyCoord:v=(J,W,Z)=>`${l(J,Z)}, ${l(W,Z)}`}=E,_=Math.ceil(x/k)+2,H=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 gA(RA,uA,KA){const $A=RA;let ge,yA,qA;for(ge=uA.x;ge<=KA.x;ge+=$A)yA=(0,g.applyToPoint)(E.transform,{x:ge,y:uA.y}),qA=(0,g.applyToPoint)(E.transform,{x:ge,y:KA.y}),J.beginPath(),J.moveTo(yA.x,yA.y),J.lineTo(qA.x,qA.y),J.stroke();const YA=c(uA.y,KA.y,$A*Z);for(const UA of YA)yA=(0,g.applyToPoint)(E.transform,{x:uA.x,y:UA}),qA=(0,g.applyToPoint)(E.transform,{x:KA.x,y:UA}),J.beginPath(),J.moveTo(yA.x,yA.y),J.lineTo(qA.x,qA.y),J.stroke()}function tA(RA,uA,KA){const $A=RA;let ge;for(ge=uA.x;ge<=KA.x;ge+=$A)for(const yA of c(uA.y,KA.y,$A*Z)){const qA=(0,g.applyToPoint)(E.transform,{x:ge,y:yA});J.fillStyle=D,J.font="12px sans-serif",J.fillText(v(ge,yA,RA),qA.x+2,qA.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*_,y:rA.y+W*H*Z},SA=W*5,xA={x:Math.floor((iA.x-SA)/SA)*SA,y:Math.floor((iA.y-SA)/SA+(Z==-1?2:0))*SA},JA={x:xA.x+SA*_,y:xA.y+SA*H*Z};J.globalAlpha=1,J.strokeStyle=m,gA(W,rA,CA),tA(SA,xA,JA),J.globalAlpha=1-nA,gA(SA/10,xA,JA),J.globalAlpha=1-nA,J.strokeStyle=S,gA(W/10,rA,CA),J.globalAlpha=Math.max(((1-nA)*10-5)/5,0),tA(SA/10,xA,JA),J.globalAlpha=1;const lA=(0,g.applyToPoint)(E.transform,d);J.font="12px sans-serif",J.fillStyle=D,J.fillText(v(d.x,d.y,W),lA.x+2,lA.y-2),J.strokeStyle=m,J.strokeRect(lA.x-5,lA.y-5,10,10)},[u,E.transform,d,x,F]);const P=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&&P(J)},onDoubleClick:P,ref:u,width:E.width,height:E.height})};return LhA}var EZ=KLt();function qLt(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 PLt(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 OLt=(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(PLt(this));var o=this.tags[this.tags.length-1];if(this.isSpeedy){var n=qLt(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})(),Uu="-ms-",hZ="-moz-",Ta="-webkit-",Hee="comm",HhA="rule",YhA="decl",WLt="@import",Yee="@keyframes",ZLt="@layer",VLt=Math.abs,uZ=String.fromCharCode,jLt=Object.assign;function zLt(t,A){return yh(t,0)^45?(((A<<2^yh(t,0))<<2^yh(t,1))<<2^yh(t,2))<<2^yh(t,3):0}function Jee(t){return t.trim()}function XLt(t,A){return(t=A.exec(t))?t[0]:t}function Ka(t,A,e){return t.replace(A,e)}function JhA(t,A){return t.indexOf(A)}function yh(t,A){return t.charCodeAt(A)|0}function tY(t,A,e){return t.slice(A,e)}function BD(t){return t.length}function ThA(t){return t.length}function dZ(t,A){return A.push(t),t}function $Lt(t,A){return t.map(A).join("")}var pZ=1,nv=1,Tee=0,Bf=0,FC=0,sv="";function fZ(t,A,e,i,o,n,s){return{value:t,root:A,parent:e,type:i,props:o,children:n,line:pZ,column:nv,length:s,return:""}}function iY(t,A){return jLt(fZ("",null,null,"",null,null,0),t,{length:-t.length},A)}function AHt(){return FC}function eHt(){return FC=Bf>0?yh(sv,--Bf):0,nv--,FC===10&&(nv=1,pZ--),FC}function w0(){return FC=Bf<Tee?yh(sv,Bf++):0,nv++,FC===10&&(nv=1,pZ++),FC}function lD(){return yh(sv,Bf)}function yZ(){return Bf}function oY(t,A){return tY(sv,t,A)}function nY(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 Kee(t){return pZ=nv=1,Tee=BD(sv=t),Bf=0,[]}function qee(t){return sv="",t}function wZ(t){return Jee(oY(Bf-1,KhA(t===91?t+2:t===40?t+1:t)))}function tHt(t){for(;(FC=lD())&&FC<33;)w0();return nY(t)>2||nY(FC)>3?"":" "}function iHt(t,A){for(;--A&&w0()&&!(FC<48||FC>102||FC>57&&FC<65||FC>70&&FC<97););return oY(t,yZ()+(A<6&&lD()==32&&w0()==32))}function KhA(t){for(;w0();)switch(FC){case t:return Bf;case 34:case 39:t!==34&&t!==39&&KhA(FC);break;case 40:t===41&&KhA(t);break;case 92:w0();break}return Bf}function oHt(t,A){for(;w0()&&t+FC!==57;)if(t+FC===84&&lD()===47)break;return"/*"+oY(A,Bf-1)+"*"+uZ(t===47?t:w0())}function nHt(t){for(;!nY(lD());)w0();return oY(t,Bf)}function sHt(t){return qee(mZ("",null,null,null,[""],t=Kee(t),0,[0],t))}function mZ(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,m=n,S=i,D=d;E;)switch(C=u,u=w0()){case 40:if(C!=108&&yh(D,c-1)==58){JhA(D+=Ka(wZ(u),"&","&\f"),"&\f")!=-1&&(h=-1);break}case 34:case 39:case 91:D+=wZ(u);break;case 9:case 10:case 13:case 32:D+=tHt(C);break;case 92:D+=iHt(yZ()-1,7);continue;case 47:switch(lD()){case 42:case 47:dZ(rHt(oHt(w0(),yZ()),A,e),a);break;default:D+="/"}break;case 123*Q:r[g++]=BD(D)*h;case 125*Q:case 59:case 0:switch(u){case 0:case 125:E=0;case 59+I:h==-1&&(D=Ka(D,/\f/g,"")),l>0&&BD(D)-c&&dZ(l>32?Oee(D+";",i,e,c-1):Oee(Ka(D," ","")+";",i,e,c-2),a);break;case 59:D+=";";default:if(dZ(S=Pee(D,A,e,g,I,o,r,d,f=[],m=[],c),n),u===123)if(I===0)mZ(D,A,S,S,f,n,c,r,m);else switch(B===99&&yh(D,3)===110?100:B){case 100:case 108:case 109:case 115:mZ(t,S,S,i&&dZ(Pee(t,S,S,0,0,o,r,d,o,f=[],c),m),o,m,c,r,i?f:m);break;default:mZ(D,S,S,S,[""],m,0,r,m)}}g=I=l=0,Q=h=1,d=D="",c=s;break;case 58:c=1+BD(D),l=C;default:if(Q<1){if(u==123)--Q;else if(u==125&&Q++==0&&eHt()==125)continue}switch(D+=uZ(u),u*Q){case 38:h=I>0?1:(D+="\f",-1);break;case 44:r[g++]=(BD(D)-1)*h,h=1;break;case 64:lD()===45&&(D+=wZ(w0())),B=lD(),I=c=BD(d=D+=nHt(yZ())),u++;break;case 45:C===45&&BD(D)==2&&(Q=0)}}return n}function Pee(t,A,e,i,o,n,s,r,a,g,I){for(var c=o-1,B=o===0?n:[""],l=ThA(B),C=0,Q=0,E=0;C<i;++C)for(var h=0,u=tY(t,c+1,c=VLt(Q=s[C])),d=t;h<l;++h)(d=Jee(Q>0?B[h]+" "+u:Ka(u,/&\f/g,B[h])))&&(a[E++]=d);return fZ(t,A,e,o===0?HhA:r,a,g,I)}function rHt(t,A,e){return fZ(t,A,e,Hee,uZ(AHt()),tY(t,2,-2),0)}function Oee(t,A,e,i){return fZ(t,A,e,YhA,tY(t,0,i),tY(t,i+1,-1),i)}function rv(t,A){for(var e="",i=ThA(t),o=0;o<i;o++)e+=A(t[o],o,t,A)||"";return e}function aHt(t,A,e,i){switch(t.type){case ZLt:if(t.children.length)break;case WLt:case YhA:return t.return=t.return||t.value;case Hee:return"";case Yee:return t.return=t.value+"{"+rv(t.children,i)+"}";case HhA:t.value=t.props.join(",")}return BD(e=rv(t.children,i))?t.return=t.value+"{"+e+"}":""}function gHt(t){var A=ThA(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 IHt(t){return function(A){A.root||(A=A.return)&&t(A)}}function cHt(t){var A=Object.create(null);return function(e){return A[e]===void 0&&(A[e]=t(e)),A[e]}}var BHt=function(A,e,i){for(var o=0,n=0;o=n,n=lD(),o===38&&n===12&&(e[i]=1),!nY(n);)w0();return oY(A,Bf)},lHt=function(A,e){var i=-1,o=44;do switch(nY(o)){case 0:o===38&&lD()===12&&(e[i]=1),A[i]+=BHt(Bf-1,e,i);break;case 2:A[i]+=wZ(o);break;case 4:if(o===44){A[++i]=lD()===58?"&\f":"",e[i]=A[i].length;break}default:A[i]+=uZ(o)}while(o=w0());return A},CHt=function(A,e){return qee(lHt(Kee(A),e))},Wee=new WeakMap,QHt=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&&!Wee.get(i))&&!o){Wee.set(A,!0);for(var n=[],s=CHt(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]}}},EHt=function(A){if(A.type==="decl"){var e=A.value;e.charCodeAt(0)===108&&e.charCodeAt(2)===98&&(A.return="",A.value="")}};function Zee(t,A){switch(zLt(t,A)){case 5103:return Ta+"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 Ta+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return Ta+t+hZ+t+Uu+t+t;case 6828:case 4268:return Ta+t+Uu+t+t;case 6165:return Ta+t+Uu+"flex-"+t+t;case 5187:return Ta+t+Ka(t,/(\w+).+(:[^]+)/,Ta+"box-$1$2"+Uu+"flex-$1$2")+t;case 5443:return Ta+t+Uu+"flex-item-"+Ka(t,/flex-|-self/,"")+t;case 4675:return Ta+t+Uu+"flex-line-pack"+Ka(t,/align-content|flex-|-self/,"")+t;case 5548:return Ta+t+Uu+Ka(t,"shrink","negative")+t;case 5292:return Ta+t+Uu+Ka(t,"basis","preferred-size")+t;case 6060:return Ta+"box-"+Ka(t,"-grow","")+Ta+t+Uu+Ka(t,"grow","positive")+t;case 4554:return Ta+Ka(t,/([^-])(transform)/g,"$1"+Ta+"$2")+t;case 6187:return Ka(Ka(Ka(t,/(zoom-|grab)/,Ta+"$1"),/(image-set)/,Ta+"$1"),t,"")+t;case 5495:case 3959:return Ka(t,/(image-set\([^]*)/,Ta+"$1$`$1");case 4968:return Ka(Ka(t,/(.+:)(flex-)?(.*)/,Ta+"box-pack:$3"+Uu+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Ta+t+t;case 4095:case 3583:case 4068:case 2532:return Ka(t,/(.+)-inline(.+)/,Ta+"$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(BD(t)-1-A>6)switch(yh(t,A+1)){case 109:if(yh(t,A+4)!==45)break;case 102:return Ka(t,/(.+:)(.+)-([^]+)/,"$1"+Ta+"$2-$3$1"+hZ+(yh(t,A+3)==108?"$3":"$2-$3"))+t;case 115:return~JhA(t,"stretch")?Zee(Ka(t,"stretch","fill-available"),A)+t:t}break;case 4949:if(yh(t,A+1)!==115)break;case 6444:switch(yh(t,BD(t)-3-(~JhA(t,"!important")&&10))){case 107:return Ka(t,":",":"+Ta)+t;case 101:return Ka(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Ta+(yh(t,14)===45?"inline-":"")+"box$3$1"+Ta+"$2$3$1"+Uu+"$2box$3")+t}break;case 5936:switch(yh(t,A+11)){case 114:return Ta+t+Uu+Ka(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return Ta+t+Uu+Ka(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return Ta+t+Uu+Ka(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return Ta+t+Uu+t+t}return t}var hHt=function(A,e,i,o){if(A.length>-1&&!A.return)switch(A.type){case YhA:A.return=Zee(A.value,A.length);break;case Yee:return rv([iY(A,{value:Ka(A.value,"@","@"+Ta)})],o);case HhA:if(A.length)return $Lt(A.props,function(n){switch(XLt(n,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return rv([iY(A,{props:[Ka(n,/:(read-\w+)/,":"+hZ+"$1")]})],o);case"::placeholder":return rv([iY(A,{props:[Ka(n,/:(plac\w+)/,":"+Ta+"input-$1")]}),iY(A,{props:[Ka(n,/:(plac\w+)/,":"+hZ+"$1")]}),iY(A,{props:[Ka(n,/:(plac\w+)/,Uu+"input-$1")]})],o)}return""})}},uHt=[hHt],dHt=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||uHt,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=[QHt,EHt];{var I,c=[aHt,IHt(function(Q){I.insert(Q)})],B=gHt(g.concat(o,c)),l=function(E){return rv(sHt(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 OLt({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 pHt(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 fHt={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},yHt=/[A-Z]|^ms/g,wHt=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Vee=function(A){return A.charCodeAt(1)===45},jee=function(A){return A!=null&&typeof A!="boolean"},qhA=cHt(function(t){return Vee(t)?t:t.replace(yHt,"-$&").toLowerCase()}),zee=function(A,e){switch(A){case"animation":case"animationName":if(typeof e=="string")return e.replace(wHt,function(i,o,n){return Bk={name:o,styles:n,next:Bk},o})}return fHt[A]!==1&&!Vee(A)&&typeof e=="number"&&e!==0?e+"px":e};function DZ(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 Bk={name:o.name,styles:o.styles,next:Bk},o.name;var n=e;if(n.styles!==void 0){var s=n.next;if(s!==void 0)for(;s!==void 0;)Bk={name:s.name,styles:s.styles,next:Bk},s=s.next;var r=n.styles+";";return r}return mHt(t,A,e)}}var a=e;if(A==null)return a;var g=A[a];return g!==void 0?g:a}function mHt(t,A,e){var i="";if(Array.isArray(e))for(var o=0;o<e.length;o++)i+=DZ(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]+"}":jee(r)&&(i+=qhA(n)+":"+zee(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++)jee(s[a])&&(i+=qhA(n)+":"+zee(n,s[a])+";");else{var g=DZ(t,A,s);switch(n){case"animation":case"animationName":{i+=qhA(n)+":"+g+";";break}default:i+=n+"{"+g+"}"}}}return i}var Xee=/label:\s*([^\s;{]+)\s*(;|$)/g,Bk;function PhA(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="";Bk=void 0;var n=t[0];if(n==null||n.raw===void 0)i=!1,o+=DZ(e,A,n);else{var s=n;o+=s[0]}for(var r=1;r<t.length;r++)if(o+=DZ(e,A,t[r]),i){var a=n;o+=a[r]}Xee.lastIndex=0;for(var g="",I;(I=Xee.exec(o))!==null;)g+="-"+I[1];var c=pHt(o)+g;return{name:c,styles:o,next:Bk}}function $ee(t,A,e){var i="";return e.split(" ").forEach(function(o){t[o]!==void 0?A.push(t[o]+";"):o&&(i+=o+" ")}),i}var DHt=function(A,e,i){var o=A.key+"-"+e.name;A.registered[o]===void 0&&(A.registered[o]=e.styles)},SHt=function(A,e,i){DHt(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 Ate(t,A){if(t.inserted[A.name]===void 0)return t.insert("",A,t.sheet,!0)}function ete(t,A,e){var i=[],o=$ee(t,i,e);return i.length<2?e:o+A(i)}var bHt=function(A){var e=dHt(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=PhA(g,e.registered,void 0);return SHt(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=PhA(g,e.registered),B="animation-"+c.name;return Ate(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=PhA(g,e.registered);Ate(e,c)},s=function(){for(var a=arguments.length,g=new Array(a),I=0;I<a;I++)g[I]=arguments[I];return ete(e.registered,i,xHt(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:$ee.bind(null,e.registered),merge:ete.bind(null,e.registered,i)}},xHt=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},kHt=bHt({key:"css"}),av=kHt.css,GHt=Object.create,tte=Object.defineProperty,FHt=Object.getOwnPropertyDescriptor,ite=Object.getOwnPropertyNames,RHt=Object.getPrototypeOf,MHt=Object.prototype.hasOwnProperty,ba=(t,A)=>function(){return A||(0,t[ite(t)[0]])((A={exports:{}}).exports,A),A.exports},NHt=(t,A,e,i)=>{if(A&&typeof A=="object"||typeof A=="function")for(let o of ite(A))!MHt.call(t,o)&&o!==e&&tte(t,o,{get:()=>A[o],enumerable:!(i=FHt(A,o))||i.enumerable});return t},ote=(t,A,e)=>(e=t!=null?GHt(RHt(t)):{},NHt(tte(e,"default",{value:t,enumerable:!0}),t)),_Ht=ba({"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 dA={};for(var SA in rA)Object.prototype.hasOwnProperty.call(rA,SA)&&(dA[CA(SA,rA[SA])||SA]=rA[SA]);return dA}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 dA=[];CA==="object"&&(iA=a(iA,rA),dA={});for(var SA in iA)if(iA.hasOwnProperty(SA)){var xA=iA[SA];s(xA)==="object"||s(xA)==="array"?dA[SA]=tA(xA,rA):dA[SA]=xA}return dA},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 dA(xA,JA,lA){this.fn=xA,this.context=JA,this.once=lA||!1}function SA(){this._events=new CA,this._eventsCount=0}SA.prototype.eventNames=function(){var JA=[],lA,RA;if(this._eventsCount===0)return JA;for(RA in lA=this._events)iA.call(lA,RA)&&JA.push(rA?RA.slice(1):RA);return Object.getOwnPropertySymbols?JA.concat(Object.getOwnPropertySymbols(lA)):JA},SA.prototype.listeners=function(JA,lA){var RA=rA?rA+JA:JA,uA=this._events[RA];if(lA)return!!uA;if(!uA)return[];if(uA.fn)return[uA.fn];for(var KA=0,$A=uA.length,ge=new Array($A);KA<$A;KA++)ge[KA]=uA[KA].fn;return ge},SA.prototype.emit=function(JA,lA,RA,uA,KA,$A){var ge=rA?rA+JA:JA;if(!this._events[ge])return!1;var yA=this._events[ge],qA=arguments.length,YA,UA;if(yA.fn){switch(yA.once&&this.removeListener(JA,yA.fn,void 0,!0),qA){case 1:return yA.fn.call(yA.context),!0;case 2:return yA.fn.call(yA.context,lA),!0;case 3:return yA.fn.call(yA.context,lA,RA),!0;case 4:return yA.fn.call(yA.context,lA,RA,uA),!0;case 5:return yA.fn.call(yA.context,lA,RA,uA,KA),!0;case 6:return yA.fn.call(yA.context,lA,RA,uA,KA,$A),!0}for(UA=1,YA=new Array(qA-1);UA<qA;UA++)YA[UA-1]=arguments[UA];yA.fn.apply(yA.context,YA)}else{var OA=yA.length,FA;for(UA=0;UA<OA;UA++)switch(yA[UA].once&&this.removeListener(JA,yA[UA].fn,void 0,!0),qA){case 1:yA[UA].fn.call(yA[UA].context);break;case 2:yA[UA].fn.call(yA[UA].context,lA);break;case 3:yA[UA].fn.call(yA[UA].context,lA,RA);break;case 4:yA[UA].fn.call(yA[UA].context,lA,RA,uA);break;default:if(!YA)for(FA=1,YA=new Array(qA-1);FA<qA;FA++)YA[FA-1]=arguments[FA];yA[UA].fn.apply(yA[UA].context,YA)}}return!0},SA.prototype.on=function(JA,lA,RA){var uA=new dA(lA,RA||this),KA=rA?rA+JA:JA;return this._events[KA]?this._events[KA].fn?this._events[KA]=[this._events[KA],uA]:this._events[KA].push(uA):(this._events[KA]=uA,this._eventsCount++),this},SA.prototype.once=function(JA,lA,RA){var uA=new dA(lA,RA||this,!0),KA=rA?rA+JA:JA;return this._events[KA]?this._events[KA].fn?this._events[KA]=[this._events[KA],uA]:this._events[KA].push(uA):(this._events[KA]=uA,this._eventsCount++),this},SA.prototype.removeListener=function(JA,lA,RA,uA){var KA=rA?rA+JA:JA;if(!this._events[KA])return this;if(!lA)return--this._eventsCount===0?this._events=new CA:delete this._events[KA],this;var $A=this._events[KA];if($A.fn)$A.fn===lA&&(!uA||$A.once)&&(!RA||$A.context===RA)&&(--this._eventsCount===0?this._events=new CA:delete this._events[KA]);else{for(var ge=0,yA=[],qA=$A.length;ge<qA;ge++)($A[ge].fn!==lA||uA&&!$A[ge].once||RA&&$A[ge].context!==RA)&&yA.push($A[ge]);yA.length?this._events[KA]=yA.length===1?yA[0]:yA:--this._eventsCount===0?this._events=new CA:delete this._events[KA]}return this},SA.prototype.removeAllListeners=function(JA){var lA;return JA?(lA=rA?rA+JA:JA,this._events[lA]&&(--this._eventsCount===0?this._events=new CA:delete this._events[lA])):(this._events=new CA,this._eventsCount=0),this},SA.prototype.off=SA.prototype.removeListener,SA.prototype.addListener=SA.prototype.on,SA.prototype.setMaxListeners=function(){return this},SA.prefixed=rA,SA.EventEmitter=SA,tA.exports=SA});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,dA,SA,xA,JA,lA,RA,uA,KA;iA=Object.assign({debug:!1},iA);var $A=new I,ge=l.data,yA="",qA="",YA="",UA="",OA="",FA="",DA=function(LA,PA){if(!(qA[0]==="?"||qA[0]==="!")){var ie={type:LA,value:PA};iA.debug&&console.log("emit:",ie),$A.emit("data",ie)}};$A.stateMachine=(KA={},c(KA,l.data,(rA={},c(rA,C.lt,function(){yA.trim()&&DA(Q.text,yA),qA="",OA=!1,ge=l.tagBegin}),c(rA,C.char,function(GA){yA+=GA}),rA)),c(KA,l.cdata,c({},C.char,function(GA){yA+=GA,yA.substr(-3)==="]]>"&&(DA(Q.text,yA.slice(0,-3)),yA="",ge=l.data)})),c(KA,l.tagBegin,(CA={},c(CA,C.space,B),c(CA,C.char,function(GA){qA=GA,ge=l.tagName}),c(CA,C.slash,function(){qA="",OA=!0}),CA)),c(KA,l.tagName,(dA={},c(dA,C.space,function(){OA?ge=l.tagEnd:(ge=l.attributeNameStart,DA(Q.openTag,qA))}),c(dA,C.gt,function(){DA(OA?Q.closeTag:Q.openTag,qA),yA="",ge=l.data}),c(dA,C.slash,function(){ge=l.tagEnd,DA(Q.openTag,qA)}),c(dA,C.char,function(GA){qA+=GA,qA==="![CDATA["&&(ge=l.cdata,yA="",qA="")}),dA)),c(KA,l.tagEnd,(SA={},c(SA,C.gt,function(){DA(Q.closeTag,qA),yA="",ge=l.data}),c(SA,C.char,B),SA)),c(KA,l.attributeNameStart,(xA={},c(xA,C.char,function(GA){YA=GA,ge=l.attributeName}),c(xA,C.gt,function(){yA="",ge=l.data}),c(xA,C.space,B),c(xA,C.slash,function(){OA=!0,ge=l.tagEnd}),xA)),c(KA,l.attributeName,(JA={},c(JA,C.space,function(){ge=l.attributeNameEnd}),c(JA,C.equal,function(){DA(Q.attributeName,YA),ge=l.attributeValueBegin}),c(JA,C.gt,function(){UA="",DA(Q.attributeName,YA),DA(Q.attributeValue,UA),yA="",ge=l.data}),c(JA,C.slash,function(){OA=!0,UA="",DA(Q.attributeName,YA),DA(Q.attributeValue,UA),ge=l.tagEnd}),c(JA,C.char,function(GA){YA+=GA}),JA)),c(KA,l.attributeNameEnd,(lA={},c(lA,C.space,B),c(lA,C.equal,function(){DA(Q.attributeName,YA),ge=l.attributeValueBegin}),c(lA,C.gt,function(){UA="",DA(Q.attributeName,YA),DA(Q.attributeValue,UA),yA="",ge=l.data}),c(lA,C.char,function(GA){UA="",DA(Q.attributeName,YA),DA(Q.attributeValue,UA),YA=GA,ge=l.attributeName}),lA)),c(KA,l.attributeValueBegin,(RA={},c(RA,C.space,B),c(RA,C.quote,function(GA){FA=GA,UA="",ge=l.attributeValue}),c(RA,C.gt,function(){UA="",DA(Q.attributeValue,UA),yA="",ge=l.data}),c(RA,C.char,function(GA){FA="",UA=GA,ge=l.attributeValue}),RA)),c(KA,l.attributeValue,(uA={},c(uA,C.space,function(GA){FA?UA+=GA:(DA(Q.attributeValue,UA),ge=l.attributeNameStart)}),c(uA,C.quote,function(GA){FA===GA?(DA(Q.attributeValue,UA),ge=l.attributeNameStart):UA+=GA}),c(uA,C.gt,function(GA){FA?UA+=GA:(DA(Q.attributeValue,UA),yA="",ge=l.data)}),c(uA,C.slash,function(GA){FA?UA+=GA:(DA(Q.attributeValue,UA),OA=!0,ge=l.tagEnd)}),c(uA,C.char,function(GA){UA+=GA}),uA)),KA);var TA=function(LA){iA.debug&&console.log(ge,LA);var PA=$A.stateMachine[ge],ie=PA[h(LA)]||PA[C.error]||PA[C.char];ie(LA)};return $A.write=function(GA){for(var LA=GA.length,PA=0;PA<LA;PA++)TA(GA[PA])},$A},d={State:l,Action:C,Type:Q,create:u},f=d.Type,m={element:"element",text:"text"},S=function(iA){return Object.assign({name:"",type:m.element,value:"",parent:null,attributes:{},children:[]},iA)},D=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,dA=void 0,SA=void 0,xA=new I,JA=function(RA){switch(RA.type){case f.openTag:if(dA===null)dA=CA,dA.name=RA.value;else{var uA=S({name:RA.value,parent:dA});dA.children.push(uA),dA=uA}break;case f.closeTag:var KA=dA.parent;if(iA.parentNodes||(dA.parent=null),dA.name!==RA.value)break;iA.stream&&KA===CA&&(CA.children=[],dA.parent=null),(!iA.emitTopLevelOnly||KA===CA)&&(xA.emit(iA.tagPrefix+dA.name,dA),xA.emit("tag",dA.name,dA)),dA===CA&&(rA.removeAllListeners("data"),xA.emit(iA.doneEvent,dA),CA=null),dA=KA;break;case f.text:dA&&dA.children.push(S({type:m.text,value:RA.value,parent:iA.parentNodes?dA:null}));break;case f.attributeName:SA=RA.value,dA.attributes[SA]="";break;case f.attributeValue:dA.attributes[SA]=RA.value;break}};return xA.reset=function(){rA=d.create({debug:iA.debug}),rA.on("data",JA),CA=S(),dA=null,SA="",xA.parse=rA.write},xA.reset(),xA},x=function(iA,rA){rA=Object.assign({},rA,{stream:!1,tagPrefix:":"});var CA=D(rA),dA=void 0;return CA.on("done",function(SA){dA=SA}),CA.parse(iA),dA},F={parseSync:x},k=F.parseSync,v=function(iA){var rA=k("<root>".concat(iA,"</root>"),{parentNodes:!1}),CA=rA.children&&rA.children.length>0&&rA.children.every(function(dA){return dA.name==="svg"});if(CA)return rA.children.length===1?rA.children[0]:rA.children;throw Error("nothing to parse")},_=function(iA){return g(iA,function(rA){return P(rA)?rA:H(rA)})},H=function(iA){return iA.replace(/[-|:]([a-z])/gi,function(rA,CA){return CA.toUpperCase()})},P=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,dA=CA===void 0?function(lA){return lA}:CA,SA=rA.camelcase,xA=SA===void 0?!1:SA,JA=function(RA){var uA;return uA=dA(RA),xA&&(uA=_(uA)),uA};return JA(v(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,dA){try{var SA=Z.apply(void 0,iA);CA(SA)}catch(xA){dA(xA)}})}var nA=function tA(iA){var rA=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},CA=rA.transformAttr,dA=CA===void 0?function(ge,yA,qA){return"".concat(ge,'="').concat(qA(yA),'"')}:CA,SA=rA.transformNode,xA=SA===void 0?function(ge){return ge}:SA,JA=rA.selfClose,lA=JA===void 0?!0:JA;if(Array.isArray(iA))return iA.map(function(ge){return tA(ge,{transformAttr:dA,selfClose:lA,transformNode:xA})}).join("");var RA=xA(iA);if(RA.type==="text")return J(RA.value);var uA="";for(var KA in RA.attributes){var $A=dA(KA,RA.attributes[KA],W,RA.name);uA+=$A?" ".concat($A):""}return RA.children&&RA.children.length>0||!lA?"<".concat(RA.name).concat(uA,">").concat(tA(RA.children,{transformAttr:dA,transformNode:xA,selfClose:lA}),"</").concat(RA.name,">"):"<".concat(RA.name).concat(uA,"/>")},gA=Object.assign({},{parse:AA,parseSync:Z,stringify:nA});return gA})}}),OhA=ba({"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(`
5321
5321
  `);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]===`
5322
5322
  `&&(s=s.replace(/\n+$/g,"")),this.current_line.push(s)),this._end_with_newline&&this.__add_outputline();var r=this.__lines.join(`
5323
5323
  `);return n!==`
@@ -5402,7 +5402,7 @@ $1`).replace(/>(\s*)(?=<!--\s*\/)/g,"> ")}}});function lte(t,A,e){if(!A||!e)retu
5402
5402
  transition: opacity 0.2s;
5403
5403
  margin-bottom: 10px;
5404
5404
  color: red;
5405
- `,RJt=({children:t,transform:A=qS(),elements:e})=>{const i=j.useRef(null),{isShowingDRCErrors:o,hoveredErrorId:n}=Wl(g=>({isShowingDRCErrors:g.is_showing_drc_errors,hoveredErrorId:g.hovered_error_id}));if(!e)return O.jsx("div",{style:{position:"relative"},ref:i,children:t});const s=e.filter(g=>g.type==="pcb_trace_error"),r=e.filter(g=>g.type==="pcb_trace_error"&&g.message?.includes("Multiple components found with name")),a=new Map;return e.forEach(g=>{g.type==="pcb_port"&&a.set(g.pcb_port_id,g)}),O.jsxs("div",{style:{position:"relative"},ref:i,children:[t,s.map((g,I)=>{const{pcb_port_ids:c,pcb_trace_id:B}=g,l=c?.[0]?a.get(c[0]):void 0,C=c?.[1]?a.get(c[1]):void 0,Q=e?ZS(e).pcb_trace.get(B):void 0,E=g.pcb_trace_error_id||`error_${I}_${g.error_type}_${g.message?.slice(0,20)}`,h=n===E;if(l&&C){const u=Hi(A,{x:l.x,y:l.y}),d=Hi(A,{x:C.x,y:C.y}),f=!(isNaN(u.x)||isNaN(u.y)||isNaN(d.x)||isNaN(d.y)),m={x:(u.x+d.x)/2,y:(u.y+d.y)/2};if(isNaN(m.x)||isNaN(m.y))return null;const S=$hA(m,i);return O.jsxs(j.Fragment,{children:[O.jsx(GJt,{screenPort1:u,screenPort2:d,errorCenter:m,canLineBeDrawn:f,isHighlighted:h}),O.jsx("div",{style:{position:"absolute",left:m.x-15,top:m.y-15,width:30,height:30,zIndex:QI.errorOverlay+5,cursor:"pointer",borderRadius:"50%"},onMouseEnter:D=>{const x=D.currentTarget.nextElementSibling;if(x){const F=x.querySelector(".error-message");F&&(F.style.opacity="1")}},onMouseLeave:D=>{if(!h){const x=D.currentTarget.nextElementSibling;if(x){const F=x.querySelector(".error-message");F&&(F.style.opacity="0")}}}}),O.jsx("div",{style:{position:"absolute",zIndex:h?200:100,left:S.left,top:S.top,color:h?"#ff4444":"red",textAlign:"center",fontFamily:"sans-serif",fontSize:12,display:o||h?"flex":"none",flexDirection:"column",alignItems:"center",pointerEvents:"none",transform:S.transform},children:O.jsx("div",{className:`error-message ${AuA}`,style:{opacity:h?1:0,border:`1px solid ${h?"#ff4444":"red"}`},children:g.message})})]},E)}if(Q?.route&&(o||h)){const u=Q.route.map(S=>Hi(A,{x:S.x,y:S.y}));if(u.some(S=>isNaN(S.x)||isNaN(S.y)))return null;const d=Math.floor(u.length/2),f=u[d],m=$hA(f,i);return O.jsxs(j.Fragment,{children:[O.jsx(FJt,{points:u,errorCenter:f,isHighlighted:h}),O.jsx("div",{style:{position:"absolute",left:f.x-15,top:f.y-15,width:30,height:30,zIndex:QI.errorOverlay+5,cursor:"pointer",borderRadius:"50%"},onMouseEnter:S=>{const D=S.currentTarget.nextElementSibling;if(D){const x=D.querySelector(".error-message");x&&(x.style.opacity="1")}},onMouseLeave:S=>{if(!h){const D=S.currentTarget.nextElementSibling;if(D){const x=D.querySelector(".error-message");x&&(x.style.opacity="0")}}}}),O.jsx("div",{style:{position:"absolute",zIndex:h?QI.errorOverlay+10:QI.errorOverlay+1,left:m.left,top:m.top,color:h?"#ff4444":"red",textAlign:"center",fontFamily:"sans-serif",fontSize:12,display:"flex",flexDirection:"column",alignItems:"center",pointerEvents:"none",transform:m.transform},children:O.jsx("div",{className:`error-message ${AuA}`,style:{opacity:h?1:0,border:`1px solid ${h?"#ff4444":"red"}`},children:g.message})})]},E)}return null}),r.map((g,I)=>{const c=g.component_name||g.message?.match(/name "([^"]+)"/)?.[1];if(!c)return null;const B=e?.filter(Q=>Q.type==="source_component"&&Q.name===c||Q.type==="pcb_component"&&e?.find(E=>E.type==="source_component"&&E.source_component_id===Q.source_component_id&&E.name===c))||[],l=g.pcb_trace_error_id||`error_${I}_${g.error_type}_${g.message?.slice(0,20)}`,C=n===l;return!C&&!o?null:B.map((Q,E)=>{let h={x:0,y:0};if(Q.type==="pcb_component")h=Q.center||{x:0,y:0};else if(Q.type==="source_component"){const F=e?.find(k=>k.type==="pcb_component"&&k.source_component_id===Q.source_component_id);F&&F.type==="pcb_component"&&(h=F.center||{x:0,y:0})}const u=Hi(A,h);if(isNaN(u.x)||isNaN(u.y))return null;const d=Math.abs(A.a),D=Math.max(8,Math.min(30,.5*d)),x=$hA(u,i);return O.jsxs(j.Fragment,{children:[O.jsx("svg",{style:{position:"absolute",left:0,top:0,pointerEvents:"none",mixBlendMode:"difference",zIndex:QI.errorOverlay},width:"100%",height:"100%",children:C?O.jsx("polygon",{points:`${u.x},${u.y-D*1.25} ${u.x+D},${u.y} ${u.x},${u.y+D*1.25} ${u.x-D},${u.y}`,fill:"#ff4444"}):O.jsx("circle",{cx:u.x,cy:u.y,r:D,fill:"none",stroke:C?"#ff4444":"red",strokeWidth:C?Math.max(2,D*.15):Math.max(1,D*.1),opacity:1})}),O.jsx("div",{style:{position:"absolute",left:u.x-(D+10),top:u.y-(D+10),width:(D+10)*2,height:(D+10)*2,zIndex:QI.errorOverlay+5,cursor:"pointer",borderRadius:"50%"},onMouseEnter:F=>{const k=F.currentTarget.nextElementSibling;if(k){const v=k.querySelector(".error-message");v&&(v.style.opacity="1")}},onMouseLeave:F=>{if(!C){const k=F.currentTarget.nextElementSibling;if(k){const v=k.querySelector(".error-message");v&&(v.style.opacity="0")}}}}),O.jsx("div",{style:{position:"absolute",zIndex:C?QI.errorOverlay+20:QI.errorOverlay+10,left:x.left,top:x.top,color:C?"#ff4444":"red",textAlign:"center",fontFamily:"sans-serif",fontSize:12,display:o||C?"flex":"none",flexDirection:"column",alignItems:"center",pointerEvents:"none",transform:x.transform},children:O.jsx("div",{className:`error-message ${AuA}`,style:{opacity:C?1:0,border:`1px solid ${C?"#ff4444":"red"}`},children:g.message})})]},`${l}_${E}`)})})]})};function MJt(t,A){return t.size!==A.size?!1:Array.from(t).every(e=>A.has(e))}function NJt({primitiveElement:t,elements:A}){let e=t.trace_length?`${t.trace_length.toFixed(3)}`:"";const i=ZS(A).source_trace.get(t?.source_trace_id);if(i?.display_name&&(i?.max_length?e+=` / ${i.max_length}mm `:e+=" mm ",e+=`(${i.display_name})`),!e)return null;const o=t.trace_length&&i?.max_length&&t.trace_length>i.max_length;return{text:e,isOverLength:o}}function _Jt(t){const{primitives:A,is_showing_multiple_traces_length:e,elements:i}=t,o=A.filter(a=>a._element.type==="pcb_trace"),n=i.filter(a=>a.type==="source_trace"),s=A.filter(a=>a._element.type!=="pcb_trace"),r=o.filter(a=>n.some(g=>a._element.type==="pcb_trace"&&a._element.source_trace_id===g.source_trace_id&&g.max_length!==void 0));if(!e)return[...s,...r];if(o.length>1){const a=o.reduce((g,I)=>{const c=g._element.trace_length;return I._element.trace_length<c?I:g},o[0]);return[...s,a]}return A}var vJt={position:"absolute",left:0,top:0,pointerEvents:"none",color:"red",fontFamily:"sans-serif",fontSize:12,textShadow:"0 0 2px black"},UJt=t=>{const{_element:A,_parent_pcb_component:e,_parent_source_component:i,_source_port:o}=t;switch(A.type){case"pcb_trace":return A.trace_length?`${A.trace_length.toFixed(3)}`:"";case"pcb_smtpad":case"pcb_plated_hole":{const n=[],s=Array.from(new Set((A.port_hints??[]).concat(o?.port_hints??[]))).filter(a=>!/^[0-9]+$/.test(a)).filter(a=>!a.includes("unnamed_")).sort((a,g)=>g.localeCompare(a)),r=i&&"name"in i&&i.name&&!i.name.includes("unnamed_")?i.name:null;return s.length>0?r?n.push(...s.map(a=>`${r}.${a}`)):n.push(...s):r&&n.push(r),n.join(", ")}default:return""}},LJt={top:"red",bottom:"aqua"},HJt=({primitive:t,mousePos:A,elements:e})=>{const[i,o]=j.useState(!1),n=t._element;j.useEffect(()=>{setTimeout(()=>{o(!0)},100)},[]);const[s,r,a,g]=[t.screen_x,t.screen_y,t.screen_w,t.screen_h],I=t.same_space_index??0,c=26,B=LJt[t?._element?.layer]??"red";let l=0;if(n.type==="pcb_smtpad"&&n?.shape==="rotated_rect"?l=n?.ccw_rotation??0:(n.type==="pcb_smtpad"&&(n?.shape==="pill"||n?.shape==="rotated_pill")&&"ccw_rotation"in t||n.type==="pcb_plated_hole"&&(n?.shape==="pill"||n?.shape==="oval")&&"ccw_rotation"in t)&&(l=n.ccw_rotation??0),n.type==="pcb_trace"){const E=NJt({primitiveElement:n,elements:e});if(!E)return null;const h=A.y-35;return O.jsx("div",{style:{zIndex:QI.elementOverlay,position:"absolute",left:A.x,top:h,color:B,pointerEvents:"none",transform:"translateX(-50%)"},children:O.jsx("div",{style:{backgroundColor:"#f2efcc",color:E.isOverLength?"red":"black",textShadow:"none",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",padding:"6px 6px",borderRadius:"6px",fontSize:"14px",minWidth:"45px",textAlign:"center",whiteSpace:"nowrap"},children:E.text})})}const C=UJt(t);return C.trim().length===0?null:O.jsx("div",{style:{zIndex:QI.elementOverlay,position:"absolute",left:s-a/2-8,top:r-g/2-8,width:a+16,height:g+16,color:B,transform:`rotate(${-l}deg)`,transformOrigin:"center center"},children:O.jsx("div",{style:{width:i?`calc(100% + ${c*2*I}px)`:"100%",height:i?`calc(100% + ${c*2*I}px)`:"100%",marginLeft:i?`${-c*I}px`:0,marginTop:i?`${-c*I}px`:0,border:`1px solid ${B}`,opacity:i||I===0?1:0,transition:"width 0.2s, height 0.2s, margin-left 0.2s, margin-top 0.2s, opacity 0.2s"},children:O.jsx("div",{style:{position:"absolute",bottom:g+20+c*I,marginRight:i?`${-c*I}px`:0,marginBottom:i?0:-c*I,transition:"margin-right 0.2s, margin-bottom 0.2s",backgroundColor:"#f2efcc",color:"black",textShadow:"none",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",padding:"6px 6px",borderRadius:"6px",fontSize:"14px",transform:`rotate(${l}deg)`,minWidth:"45px",textAlign:"center"},children:C})})})},YJt=({highlightedPrimitives:t,mousePos:A,elements:e})=>{const[i,o]=Wl(r=>[r.is_moving_component,r.is_showing_multiple_traces_length]),n=t.some(r=>r._element.type==="pcb_smtpad")&&t.some(r=>r._element.type==="pcb_trace");let s=t;return n&&(s=s.filter(r=>r._element.type==="pcb_smtpad")),s=_Jt({primitives:s,is_showing_multiple_traces_length:o,elements:e}),O.jsx("div",{style:vJt,children:!i&&s.map((r,a)=>O.jsx(HJt,{primitive:r,mousePos:A,elements:e},a))})},Ck=t=>t?.type==="pcb_component",Jte=t=>t?.type==="pcb_group",JJt=t=>t?.type==="pcb_panel",euA=t=>t?.type==="pcb_board",qI={MIN_LINE_LENGTH_FOR_LABEL:40,LABEL_OFFSET_ABOVE:2,LABEL_OFFSET_BELOW:-18,LABEL_OFFSET_RIGHT:8,LABEL_OFFSET_LEFT:-120,Y_LABEL_MIN_WIDTH:110,LINE_STROKE_WIDTH:1.5,LINE_DASH_PATTERN:"4,4",COMPONENT_MARKER_RADIUS:3,LABEL_FONT_SIZE:11,ANCHOR_MARKER_SIZE:6,ANCHOR_MARKER_STROKE_WIDTH:1.5},m0={OFFSET_LINE:"white",COMPONENT_MARKER_FILL:"#66ccff",COMPONENT_MARKER_STROKE:"white",LABEL_TEXT:"white"},tuA=({targets:t,transform:A,containerWidth:e,containerHeight:i})=>{if(t.length===0)return null;const o={color:m0.LABEL_TEXT,mixBlendMode:"difference",pointerEvents:"none",fontSize:qI.LABEL_FONT_SIZE,fontFamily:"monospace",fontWeight:"bold"},n=new Map;return t.forEach(s=>{if(!n.has(s.anchor_id)){const r=Hi(A,s.anchor);n.set(s.anchor_id,r)}}),O.jsx("div",{style:{position:"absolute",left:0,top:0,width:e,height:i,overflow:"hidden",pointerEvents:"none",zIndex:QI.dimensionOverlay},children:O.jsxs("svg",{style:{position:"absolute",left:0,top:0,pointerEvents:"none"},width:e,height:i,children:[t.map(s=>{const r=s.anchor,a=s.anchor_id,g=s.target,I=n.get(a),c=Hi(A,g),B=g.x-r.x,l=g.y-r.y,C=Math.abs(c.x-I.x),Q=Math.abs(c.y-I.y),E=c.y<I.y,h=c.x>I.x,u=E?qI.LABEL_OFFSET_ABOVE:qI.LABEL_OFFSET_BELOW,d=h?qI.LABEL_OFFSET_RIGHT:qI.LABEL_OFFSET_LEFT,f=C>qI.MIN_LINE_LENGTH_FOR_LABEL,m=Q>qI.MIN_LINE_LENGTH_FOR_LABEL,S=`${s.display_offset_x??B.toFixed(2)}mm`,D=`${s.display_offset_y??l.toFixed(2)}mm`;return O.jsxs("g",{children:[O.jsx("line",{x1:I.x,y1:I.y,x2:c.x,y2:I.y,stroke:m0.OFFSET_LINE,strokeWidth:qI.LINE_STROKE_WIDTH,strokeDasharray:qI.LINE_DASH_PATTERN}),O.jsx("line",{x1:c.x,y1:I.y,x2:c.x,y2:c.y,stroke:m0.OFFSET_LINE,strokeWidth:qI.LINE_STROKE_WIDTH,strokeDasharray:qI.LINE_DASH_PATTERN}),s.type==="component"||s.type==="board"?O.jsx("circle",{cx:c.x,cy:c.y,r:qI.COMPONENT_MARKER_RADIUS,fill:m0.COMPONENT_MARKER_FILL,stroke:m0.COMPONENT_MARKER_STROKE,strokeWidth:1}):O.jsxs(O.Fragment,{children:[O.jsx("line",{x1:c.x-qI.ANCHOR_MARKER_SIZE,y1:c.y,x2:c.x+qI.ANCHOR_MARKER_SIZE,y2:c.y,stroke:m0.OFFSET_LINE,strokeWidth:qI.ANCHOR_MARKER_STROKE_WIDTH}),O.jsx("line",{x1:c.x,y1:c.y-qI.ANCHOR_MARKER_SIZE,x2:c.x,y2:c.y+qI.ANCHOR_MARKER_SIZE,stroke:m0.OFFSET_LINE,strokeWidth:qI.ANCHOR_MARKER_STROKE_WIDTH})]}),f&&O.jsx("foreignObject",{x:Math.min(I.x,c.x),y:I.y+u,width:Math.abs(c.x-I.x),height:20,style:{overflow:"visible"},children:O.jsx("div",{style:{...o,textAlign:"center"},children:S})}),m&&O.jsx("foreignObject",{x:c.x+d,y:Math.min(I.y,c.y),width:qI.Y_LABEL_MIN_WIDTH,height:Math.abs(c.y-I.y),style:{overflow:"visible"},children:O.jsx("div",{style:{...o,display:"flex",alignItems:"center",justifyContent:h?"flex-start":"flex-end",whiteSpace:"nowrap",padding:"0 4px",height:"100%"},children:D})})]},s.id)}),Array.from(n.entries()).map(([s,r])=>O.jsxs("g",{children:[O.jsx("line",{x1:r.x-qI.ANCHOR_MARKER_SIZE,y1:r.y,x2:r.x+qI.ANCHOR_MARKER_SIZE,y2:r.y,stroke:m0.OFFSET_LINE,strokeWidth:qI.ANCHOR_MARKER_STROKE_WIDTH}),O.jsx("line",{x1:r.x,y1:r.y-qI.ANCHOR_MARKER_SIZE,x2:r.x,y2:r.y+qI.ANCHOR_MARKER_SIZE,stroke:m0.OFFSET_LINE,strokeWidth:qI.ANCHOR_MARKER_STROKE_WIDTH})]},`anchor-${s}`))]})})},TJt=({elements:t,highlightedPrimitives:A,transform:e,containerWidth:i,containerHeight:o})=>{const n=t.filter(h=>euA(h)),s=t.filter(h=>Ck(h)),r=t.filter(h=>Jte(h)),a=A.map(h=>Ck(h._parent_pcb_component)?h._parent_pcb_component.pcb_component_id:Ck(h._element)?h._element.pcb_component_id:null).filter(h=>!!h),g=new Set;if(a.forEach(h=>{const u=s.find(d=>d.pcb_component_id===h);u?.pcb_group_id&&g.add(u.pcb_group_id)}),!Wl(h=>h.is_showing_group_anchor_offsets)&&a.length===0)return null;const c=s.map(h=>{const u=h.positioned_relative_to_pcb_board_id;if(!u)return null;const d=n.find(f=>f.pcb_board_id===u);return d?{component:h,board:d,type:"component"}:null}).filter(h=>!!h),B=r.map(h=>{const u=h.positioned_relative_to_pcb_board_id;if(!u||!h.center)return null;const d=n.find(f=>f.pcb_board_id===u);return d?{group:h,board:d,type:"group"}:null}).filter(h=>!!h),l=[...c,...B];if(l.length===0)return null;const C=a.length===0,Q=l.filter(h=>h.type==="component"?C||a.includes(h.component.pcb_component_id):C||g.has(h.group.pcb_group_id));if(Q.length===0)return null;const E=Q.map(h=>h.type==="component"?{id:`${h.board.pcb_board_id}-${h.component.pcb_component_id}-${h.type}`,anchor:h.board.center,anchor_id:h.board.pcb_board_id,target:h.component.center,type:"component",display_offset_x:h.component.display_offset_x,display_offset_y:h.component.display_offset_y}:{id:`${h.board.pcb_board_id}-${h.group.pcb_group_id}-${h.type}`,anchor:h.board.center,anchor_id:h.board.pcb_board_id,target:{x:h.group.anchor_position?.x??h.group.center.x,y:h.group.anchor_position?.y??h.group.center.y},type:"group",display_offset_x:h.group.display_offset_x,display_offset_y:h.group.display_offset_y}).filter(h=>!!h);return O.jsx(tuA,{targets:E,transform:e,containerWidth:i,containerHeight:o})},KJt=({elements:t,highlightedPrimitives:A,transform:e,containerWidth:i,containerHeight:o})=>{const n=t.filter(h=>Jte(h)),s=t.filter(h=>Ck(h)),r=A.map(h=>Ck(h._parent_pcb_component)?h._parent_pcb_component.pcb_component_id:Ck(h._element)?h._element.pcb_component_id:null).filter(h=>!!h),a=(h,u)=>{if(u.has(h))return;u.add(h);const d=n.find(f=>f.pcb_group_id===h);d?.position_mode==="relative_to_group_anchor"&&d.positioned_relative_to_pcb_group_id&&a(d.positioned_relative_to_pcb_group_id,u)},g=new Set;if(r.forEach(h=>{const u=s.find(d=>d.pcb_component_id===h);u&&(u.position_mode==="relative_to_group_anchor"&&u.positioned_relative_to_pcb_group_id&&a(u.positioned_relative_to_pcb_group_id,g),u.pcb_group_id&&a(u.pcb_group_id,g))}),!Wl(h=>h.is_showing_group_anchor_offsets)&&r.length===0)return null;const c=s.map(h=>{if(h.position_mode==="relative_to_group_anchor"&&h.positioned_relative_to_pcb_group_id){const u=n.find(d=>d.pcb_group_id===h.positioned_relative_to_pcb_group_id);return u&&u.anchor_position?{component:h,parentGroup:u,type:"component"}:null}if(h.pcb_group_id){const u=n.find(d=>d.pcb_group_id===h.pcb_group_id);return u&&u.anchor_position?{component:h,parentGroup:u,type:"component"}:null}return null}).filter(h=>!!h),B=n.map(h=>{if(h.position_mode==="relative_to_group_anchor"&&h.positioned_relative_to_pcb_group_id){const u=n.find(d=>d.pcb_group_id===h.positioned_relative_to_pcb_group_id);if(u&&u.anchor_position&&h.anchor_position)return{group:h,parentGroup:u,type:"group"}}return null}).filter(h=>!!h),l=[...c,...B];if(l.length===0)return null;const C=r.length===0,Q=l.filter(h=>h.type==="component"?C||r.includes(h.component.pcb_component_id):C||g.has(h.group.pcb_group_id)||g.has(h.parentGroup.pcb_group_id));if(Q.length===0)return null;const E=Q.map(h=>{const u=h.parentGroup.anchor_position;return u?h.type==="component"?h.component.center?{id:`${h.parentGroup.pcb_group_id}-${h.component.pcb_component_id}-${h.type}`,anchor:u,anchor_id:h.parentGroup.pcb_group_id,target:h.component.center,type:"component",display_offset_x:h.component.display_offset_x,display_offset_y:h.component.display_offset_y}:null:h.group.anchor_position?{id:`${h.parentGroup.pcb_group_id}-${h.group.pcb_group_id}-${h.type}`,anchor:u,anchor_id:h.parentGroup.pcb_group_id,target:h.group.anchor_position,type:"group",display_offset_x:h.group.display_offset_x,display_offset_y:h.group.display_offset_y}:null:null}).filter(h=>!!h);return O.jsx(tuA,{targets:E,transform:e,containerWidth:i,containerHeight:o})},qJt=(t,A)=>{const e=t.pcb_component_id,i=A.filter(o=>(o.type==="pcb_smtpad"||o.type==="pcb_plated_hole")&&o.pcb_component_id===e||o.type==="pcb_hole"&&o.pcb_component_id===e);return i.length===0?zhA([t]):zhA(i)},PJt=({elements:t,highlightedPrimitives:A,transform:e,containerWidth:i,containerHeight:o})=>{const n=new Map;for(const r of A)Ck(r._parent_pcb_component)&&n.set(r._parent_pcb_component.pcb_component_id,r._parent_pcb_component),Ck(r._element)&&n.set(r._element.pcb_component_id,r._element);if(n.size===0)return null;const s=[];for(const r of n.values()){const a=qJt(r,t);if(!a)continue;const g=r.positioned_relative_to_pcb_group_id??r.pcb_group_id,I=g?ZS(t).pcb_group.get(g):null;s.push({component:r,bbox:a,group:I})}return s.length===0?null:O.jsx("div",{style:{position:"absolute",left:0,top:0,width:i,height:o,overflow:"hidden",pointerEvents:"none",zIndex:QI.dimensionOverlay},children:O.jsx("svg",{style:{position:"absolute",left:0,top:0,pointerEvents:"none"},width:i,height:o,children:s.map(({component:r,bbox:a,group:g})=>{const I=Hi(e,{x:a.minX,y:a.maxY}),c=Hi(e,{x:a.maxX,y:a.minY}),B={x:Math.min(I.x,c.x),y:Math.min(I.y,c.y),width:Math.abs(c.x-I.x),height:Math.abs(c.y-I.y)},l=r.center??{x:(a.minX+a.maxX)/2,y:(a.minY+a.maxY)/2},C=Hi(e,l);return O.jsxs("g",{children:[O.jsx("rect",{x:B.x,y:B.y,width:B.width,height:B.height,fill:"none",stroke:"white",strokeWidth:1.5,strokeDasharray:"4,4"}),O.jsx("line",{x1:C.x-6,y1:C.y,x2:C.x+6,y2:C.y,stroke:m0.COMPONENT_MARKER_STROKE,strokeWidth:1.5}),O.jsx("line",{x1:C.x,y1:C.y-6,x2:C.x,y2:C.y+6,stroke:m0.COMPONENT_MARKER_STROKE,strokeWidth:1.5}),O.jsx("circle",{cx:C.x,cy:C.y,r:qI.COMPONENT_MARKER_RADIUS,fill:m0.COMPONENT_MARKER_FILL,stroke:m0.COMPONENT_MARKER_STROKE,strokeWidth:1})]},r.pcb_component_id)})})})},OJt=({elements:t,highlightedPrimitives:A,transform:e,containerWidth:i,containerHeight:o})=>{const n=t.filter(l=>JJt(l)),s=t.filter(l=>euA(l)),r=A.map(l=>euA(l._element)?l._element.pcb_board_id:null).filter(l=>!!l);if(!Wl(l=>l.is_showing_group_anchor_offsets)&&r.length===0)return null;const g=s.map(l=>{const C=l.pcb_panel_id,Q=l.position_mode;if(!C||Q!=="relative_to_panel_anchor")return null;const E=n.find(h=>h.pcb_panel_id===C);return E?{board:l,panel:E,type:"board"}:null}).filter(l=>!!l);if(g.length===0)return null;const I=r.length===0,c=g.filter(l=>I||r.includes(l.board.pcb_board_id));if(c.length===0)return null;const B=c.map(l=>l.board.center?{id:`${l.panel.pcb_panel_id}-${l.board.pcb_board_id}-${l.type}`,anchor:l.panel.center,anchor_id:l.panel.pcb_panel_id,target:l.board.center,type:"board",display_offset_x:l.board.display_offset_x,display_offset_y:l.board.display_offset_y}:null).filter(l=>!!l);return O.jsx(tuA,{targets:B,transform:e,containerWidth:i,containerHeight:o})},_Z=t=>{if(t.length===0)return null;let A=t[0].x,e=t[0].y,i=t[0].x,o=t[0].y;for(const n of t)n.x<A&&(A=n.x),n.y<e&&(e=n.y),n.x>i&&(i=n.x),n.y>o&&(o=n.y);return{center:{x:(A+i)/2,y:(e+o)/2},width:i-A,height:o-e}},Tte=(t,A)=>{if(A.length<3)return!1;let e=!1;for(let i=0,o=A.length-1;i<A.length;o=i++){const n=A[i].x,s=A[i].y,r=A[o].x,a=A[o].y;s>t.y!=a>t.y&&t.x<(r-n)*(t.y-s)/(a-s||Number.EPSILON)+n&&(e=!e)}return e},WJt=(t,A,e)=>{const i=[];for(const o of t){if(!o._element)continue;if("x1"in o&&o._element?.type==="pcb_trace"){const r=gh({x:A.x,y:A.y},{x:o.x1,y:o.y1},{x:o.x2,y:o.y2}),a=o.width||.5,g=Math.max(a*25,2)/e.a;r<g&&i.push(o);continue}if(o.pcb_drawing_type==="polygon"){const r=o.points.map(g=>({x:ae.parse(g.x),y:ae.parse(g.y)})),a=_Z(r);if(!a||A.x<a.center.x-a.width/2||A.x>a.center.x+a.width/2||A.y<a.center.y-a.height/2||A.y>a.center.y+a.height/2)continue;Tte(A,r)&&i.push(o);continue}if(o.pcb_drawing_type==="polygon_with_arcs"){const r=o.brep_shape.outer_ring.vertices.map(g=>({x:ae.parse(g.x),y:ae.parse(g.y)})),a=_Z(r);if(!a||A.x<a.center.x-a.width/2||A.x>a.center.x+a.width/2||A.y<a.center.y-a.height/2||A.y>a.center.y+a.height/2)continue;Tte(A,r)&&i.push(o);continue}if(!("x"in o&&"y"in o))continue;let n=0,s=0;if("w"in o&&"h"in o)n=o.w,s=o.h;else if("r"in o)n=o.r*2,s=o.r*2;else if("rX"in o&&"rY"in o)n=o.rX*2,s=o.rY*2;else continue;Math.abs(o.x-A.x)<n/2&&Math.abs(o.y-A.y)<s/2&&i.push(o)}return i},ZJt=({elements:t,children:A,transform:e,primitives:i,onMouseHoverOverPrimitives:o})=>{const[n,s]=j.useState([]),[r,a]=j.useState({x:0,y:0}),[g,{width:I,height:c}]=sY(),B=j.useMemo(()=>{const C=[];for(const Q of n){if(Q._element?.type==="pcb_via"||Q._element?.type==="pcb_component"||Q?.layer==="drill")continue;let E=null,h=0,u=0;if(Q.pcb_drawing_type==="polygon"){const S=_Z(Q.points);if(!S)continue;E=S.center,h=S.width,u=S.height}else if(Q.pcb_drawing_type==="polygon_with_arcs"){const S=Q.brep_shape.outer_ring.vertices.map(x=>({x:x.x,y:x.y})),D=_Z(S);if(!D)continue;E=D.center,h=D.width,u=D.height}else"x"in Q&&"y"in Q&&(E={x:Q.x,y:Q.y},h="w"in Q?Q.w:"r"in Q?Q.r*2:"rX"in Q&&"rY"in Q?Q.rX*2:0,u="h"in Q?Q.h:"r"in Q?Q.r*2:"rX"in Q&&"rY"in Q?Q.rY*2:0);if(!E)continue;const d=Hi(e,E),f={w:h*e.a,h:u*e.a},m=C.filter(S=>d.x===S.screen_x&&d.y===S.screen_y&&f.w===S.screen_w&&f.h===S.screen_h).length;C.push({...Q,x:E.x,y:E.y,w:h,h:u,screen_x:d.x,screen_y:d.y,screen_w:f.w,screen_h:f.h,same_space_index:m})}return C},[n,e]),l=(C,Q,E,h)=>{a({x:C,y:Q});const u=Hi(PS(E),{x:C,y:Q}),d=WJt(h,u,E);MJt(new Set(d.map(f=>f._pcb_drawing_object_id)),new Set(n.map(f=>f._pcb_drawing_object_id)))||(s(d),o(d))};return O.jsxs("div",{ref:g,style:{position:"relative",width:"100%",height:"100%"},onMouseMove:C=>{if(e){const Q=C.currentTarget.getBoundingClientRect(),E=C.clientX-Q.left,h=C.clientY-Q.top;l(E,h,e,i)}},onTouchStart:C=>{if(e){const Q=C.touches[0],E=C.currentTarget.getBoundingClientRect(),h=Q.clientX-E.left,u=Q.clientY-E.top;l(h,u,e,i)}},children:[A,O.jsx(YJt,{elements:t,mousePos:r,highlightedPrimitives:B}),e&&O.jsxs(O.Fragment,{children:[O.jsx(TJt,{elements:t,highlightedPrimitives:B,transform:e,containerWidth:I,containerHeight:c}),O.jsx(KJt,{elements:t,highlightedPrimitives:B,transform:e,containerWidth:I,containerHeight:c}),O.jsx(PJt,{elements:t,highlightedPrimitives:B,transform:e,containerWidth:I,containerHeight:c}),O.jsx(OJt,{elements:t,highlightedPrimitives:B,transform:e,containerWidth:I,containerHeight:c})]})]})},Kte=["rgb(255, 100, 100)","rgb(100, 255, 100)","rgb(100, 100, 255)","rgb(255, 255, 100)","rgb(255, 100, 255)","rgb(100, 255, 255)","rgb(255, 150, 100)","rgb(150, 100, 255)","rgb(100, 255, 150)","rgb(255, 100, 150)"],VJt=({children:t,transform:A=qS(),elements:e=[],hoveredComponentIds:i=[]})=>{const[o,{width:n,height:s}]=sY(),r=j.useRef(null),{is_showing_pcb_groups:a,pcb_group_view_mode:g,is_showing_group_anchor_offsets:I}=Wl(c=>({is_showing_pcb_groups:c.is_showing_pcb_groups,pcb_group_view_mode:c.pcb_group_view_mode,is_showing_group_anchor_offsets:c.is_showing_group_anchor_offsets}));return j.useEffect(()=>{const c=r.current;if(!c||!n||!s)return;c.width=n,c.height=s;const B=c.getContext("2d");if(!B||(B.clearRect(0,0,n,s),!a))return;const l=e.filter(S=>S.type==="pcb_group"),C=e.filter(S=>S.type==="pcb_component"),Q=e.filter(S=>S.type==="source_group"),E=new Map(Q.map(S=>[S.source_group_id,S])),h=l.filter(S=>{if(g==="all")return!0;if(!S.source_group_id)return!1;const D=E.get(S.source_group_id);return D?D.was_automatically_named!==!0:!1}),u=new Map;Q.forEach(S=>{const D=S;if(D.parent_source_group_id){const x=u.get(D.parent_source_group_id)||[];x.push(S.source_group_id),u.set(D.parent_source_group_id,x)}});const d=S=>{const D=[],x=u.get(S)||[];for(const F of x)D.push(F),D.push(...d(F));return D},f=S=>{const D=Q.find(x=>x.source_group_id===S);return D?.parent_source_group_id?1+f(D.parent_source_group_id):0},m=new Set;if(i.length>0)for(const S of C){if(!i.includes(S.pcb_component_id))continue;const D=S.positioned_relative_to_pcb_group_id??S.pcb_group_id;D&&m.add(D)}h.forEach((S,D)=>{let x=C.filter(UA=>UA.pcb_group_id===S.pcb_group_id);if(S.source_group_id){const UA=d(S.source_group_id),OA=l.filter(FA=>FA.source_group_id&&UA.includes(FA.source_group_id));for(const FA of OA){const DA=C.filter(TA=>TA.pcb_group_id===FA.pcb_group_id);x=[...x,...DA]}}let F,k,v,_,H=!1;if(S.center&&S.width&&S.height){H=!0;const UA=S.width/2,OA=S.height/2;F=S.center.x-UA,v=S.center.x+UA,k=S.center.y-OA,_=S.center.y+OA}else if(x.length===0||(F=1/0,k=1/0,v=-1/0,_=-1/0,x.forEach(UA=>{if(UA.center&&typeof UA.width=="number"&&typeof UA.height=="number"){const OA=UA.center.x-UA.width/2,FA=UA.center.x+UA.width/2,DA=UA.center.y+UA.height/2,TA=UA.center.y-UA.height/2;F=Math.min(F,OA),v=Math.max(v,FA),k=Math.min(k,TA),_=Math.max(_,DA)}}),F===1/0||v===-1/0))return;const P=S.source_group_id?f(S.source_group_id):0,J=S.source_group_id?d(S.source_group_id).length>0:!1;if(!H){const FA=1+(J?.5:0);F-=FA,v+=FA,k-=FA,_+=FA}const W=Hi(A,{x:F,y:_}),Z=Hi(A,{x:v,y:_}),AA=Hi(A,{x:F,y:k}),nA=Hi(A,{x:v,y:k}),gA=Kte[D%Kte.length];B.strokeStyle=gA,B.lineWidth=2;const tA=Math.max(4,Math.min(12,8*Math.abs(A.a))),iA=Math.max(2,Math.min(6,4*Math.abs(A.a))),CA=tA*(J?1.3:1),dA=iA;B.setLineDash([CA,dA]),B.beginPath(),B.moveTo(W.x,W.y),B.lineTo(Z.x,Z.y),B.lineTo(nA.x,nA.y),B.lineTo(AA.x,AA.y),B.closePath(),B.stroke();const SA=Math.max(8,Math.min(12,10*Math.abs(A.a))),xA=P==0||P==1?0:P*.11,JA=SA*(1-xA),lA=4,RA=S.name||`Group ${D+1}`;B.font=`${JA}px sans-serif`,B.setLineDash([]);const KA=B.measureText(RA).width+lA*2,$A=JA+lA*2,ge=W.x-5,yA=W.y-5,qA=3;if(B.fillStyle="rgba(0, 0, 0, 0.8)",B.beginPath(),B.roundRect(ge,yA-$A,KA,$A,qA),B.fill(),B.fillStyle=gA,B.textAlign="left",B.textBaseline="middle",B.fillText(RA,ge+lA,yA-$A/2),I&&m.has(S.pcb_group_id)&&!!S.anchor_position&&S.anchor_position){const UA=Array.isArray(S.anchor_position)?{x:S.anchor_position[0]??0,y:S.anchor_position[1]??0}:{x:S.anchor_position.x,y:S.anchor_position.y},OA=Hi(A,UA);B.strokeStyle="white",B.lineWidth=1.5,B.setLineDash([]);const FA=Math.max(4,Math.min(8,6*Math.abs(A.a)));B.beginPath(),B.moveTo(OA.x-FA,OA.y),B.lineTo(OA.x+FA,OA.y),B.stroke(),B.beginPath(),B.moveTo(OA.x,OA.y-FA),B.lineTo(OA.x,OA.y+FA),B.stroke()}})},[e,A,n,s,a,g,I,i]),O.jsxs("div",{ref:o,style:{position:"relative",width:"100%",height:"100%"},children:[t,O.jsx("canvas",{ref:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none",zIndex:QI.pcbGroupOverlay,display:a?"block":"none"}})]})},jJt=({transform:t,soup:A,children:e})=>{const i=Wl(r=>r.is_showing_rats_nest),{netMap:o,idToNetMap:n}=j.useMemo(()=>pte(A||[]),[A]),s=j.useMemo(()=>{if(!A||!i)return[];const r=B=>{const l=ZS(A)[B.replace(/_\d+$/,"")].get(B);return l&&"x"in l&&"y"in l?{x:l.x,y:l.y}:null},a=(B,l)=>{const C=o[l]||[];let Q=null,E=1/0;return C.forEach(h=>{const u=r(h);if(u){const d=Math.sqrt((B.x-u.x)**2+(B.y-u.y)**2);d<E&&d>0&&(E=d,Q=u)}}),Q},g=ZS(A).pcb_port.list(),I=ZS(A).source_trace.list(),c=[];return g.forEach((B,l)=>{const C=n[B.pcb_port_id];let Q=!1;for(const u of I)u.connected_source_port_ids.includes(B.source_port_id)&&u.connected_source_net_ids.length>0&&(Q=!0);if(!C)return;const E={x:B.x,y:B.y},h=a(E,C);h&&c.push({key:`${B.pcb_port_id}-${l}`,startPoint:E,endPoint:h,isInNet:Q})}),c},[A,o,n,i]);return!A||!i?e:(t||(t=qS()),O.jsxs("div",{style:{position:"relative"},children:[e,O.jsx("svg",{style:{position:"absolute",left:0,top:0,width:"100%",height:"100%",pointerEvents:"none",opacity:.5,zIndex:QI.ratsNestOverlay},children:s.map(({key:r,startPoint:a,endPoint:g,isInNet:I})=>{const c=Hi(t,a),B=Hi(t,g);return O.jsx("line",{x1:c.x,y1:c.y,x2:B.x,y2:B.y,stroke:"white",strokeWidth:"1",strokeDasharray:I?"6,6":void 0},r)})})]}))},zJt={version:"1.11.319"},Qk=(t,A,e)=>{const i=Wl(s=>s.is_mouse_over_container),o=j.useRef(i),n=j.useRef(A);j.useEffect(()=>{o.current=i},[i]),j.useEffect(()=>{n.current=A},[A]),j.useEffect(()=>{if(!t)return;const s=r=>{const a=r.target;if(a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.isContentEditable)return;const g=t.split("+"),I=g.includes("ctrl"),c=g.includes("shift"),B=g.includes("alt"),l=g.includes("meta"),C=g[g.length-1],Q=e?.current?e.current.contains(document.activeElement)||document.activeElement===e.current:!1;(o.current||Q)&&(!I||r.ctrlKey)&&(!c||r.shiftKey)&&(!B||r.altKey)&&(!l||r.metaKey)&&r.key.toLowerCase()===C.toLowerCase()&&(r.preventDefault(),n.current())};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s)}},[t])},XJt=()=>{const[t,A]=j.useState(!1);return j.useEffect(()=>{const e=()=>{A(window.innerWidth<=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),t},$Jt=({name:t,selected:A,onClick:e})=>O.jsxs("div",{className:av`
5405
+ `,RJt=({children:t,transform:A=qS(),elements:e})=>{const i=j.useRef(null),{isShowingDRCErrors:o,hoveredErrorId:n}=Wl(g=>({isShowingDRCErrors:g.is_showing_drc_errors,hoveredErrorId:g.hovered_error_id}));if(!e)return O.jsx("div",{style:{position:"relative"},ref:i,children:t});const s=e.filter(g=>g.type==="pcb_trace_error"),r=e.filter(g=>g.type==="pcb_trace_error"&&g.message?.includes("Multiple components found with name")),a=new Map;return e.forEach(g=>{g.type==="pcb_port"&&a.set(g.pcb_port_id,g)}),O.jsxs("div",{style:{position:"relative"},ref:i,children:[t,s.map((g,I)=>{const{pcb_port_ids:c,pcb_trace_id:B}=g,l=c?.[0]?a.get(c[0]):void 0,C=c?.[1]?a.get(c[1]):void 0,Q=e?ZS(e).pcb_trace.get(B):void 0,E=g.pcb_trace_error_id||`error_${I}_${g.error_type}_${g.message?.slice(0,20)}`,h=n===E;if(l&&C){const u=Hi(A,{x:l.x,y:l.y}),d=Hi(A,{x:C.x,y:C.y}),f=!(isNaN(u.x)||isNaN(u.y)||isNaN(d.x)||isNaN(d.y)),m={x:(u.x+d.x)/2,y:(u.y+d.y)/2};if(isNaN(m.x)||isNaN(m.y))return null;const S=$hA(m,i);return O.jsxs(j.Fragment,{children:[O.jsx(GJt,{screenPort1:u,screenPort2:d,errorCenter:m,canLineBeDrawn:f,isHighlighted:h}),O.jsx("div",{style:{position:"absolute",left:m.x-15,top:m.y-15,width:30,height:30,zIndex:QI.errorOverlay+5,cursor:"pointer",borderRadius:"50%"},onMouseEnter:D=>{const x=D.currentTarget.nextElementSibling;if(x){const F=x.querySelector(".error-message");F&&(F.style.opacity="1")}},onMouseLeave:D=>{if(!h){const x=D.currentTarget.nextElementSibling;if(x){const F=x.querySelector(".error-message");F&&(F.style.opacity="0")}}}}),O.jsx("div",{style:{position:"absolute",zIndex:h?200:100,left:S.left,top:S.top,color:h?"#ff4444":"red",textAlign:"center",fontFamily:"sans-serif",fontSize:12,display:o||h?"flex":"none",flexDirection:"column",alignItems:"center",pointerEvents:"none",transform:S.transform},children:O.jsx("div",{className:`error-message ${AuA}`,style:{opacity:h?1:0,border:`1px solid ${h?"#ff4444":"red"}`},children:g.message})})]},E)}if(Q?.route&&(o||h)){const u=Q.route.map(S=>Hi(A,{x:S.x,y:S.y}));if(u.some(S=>isNaN(S.x)||isNaN(S.y)))return null;const d=Math.floor(u.length/2),f=u[d],m=$hA(f,i);return O.jsxs(j.Fragment,{children:[O.jsx(FJt,{points:u,errorCenter:f,isHighlighted:h}),O.jsx("div",{style:{position:"absolute",left:f.x-15,top:f.y-15,width:30,height:30,zIndex:QI.errorOverlay+5,cursor:"pointer",borderRadius:"50%"},onMouseEnter:S=>{const D=S.currentTarget.nextElementSibling;if(D){const x=D.querySelector(".error-message");x&&(x.style.opacity="1")}},onMouseLeave:S=>{if(!h){const D=S.currentTarget.nextElementSibling;if(D){const x=D.querySelector(".error-message");x&&(x.style.opacity="0")}}}}),O.jsx("div",{style:{position:"absolute",zIndex:h?QI.errorOverlay+10:QI.errorOverlay+1,left:m.left,top:m.top,color:h?"#ff4444":"red",textAlign:"center",fontFamily:"sans-serif",fontSize:12,display:"flex",flexDirection:"column",alignItems:"center",pointerEvents:"none",transform:m.transform},children:O.jsx("div",{className:`error-message ${AuA}`,style:{opacity:h?1:0,border:`1px solid ${h?"#ff4444":"red"}`},children:g.message})})]},E)}return null}),r.map((g,I)=>{const c=g.component_name||g.message?.match(/name "([^"]+)"/)?.[1];if(!c)return null;const B=e?.filter(Q=>Q.type==="source_component"&&Q.name===c||Q.type==="pcb_component"&&e?.find(E=>E.type==="source_component"&&E.source_component_id===Q.source_component_id&&E.name===c))||[],l=g.pcb_trace_error_id||`error_${I}_${g.error_type}_${g.message?.slice(0,20)}`,C=n===l;return!C&&!o?null:B.map((Q,E)=>{let h={x:0,y:0};if(Q.type==="pcb_component")h=Q.center||{x:0,y:0};else if(Q.type==="source_component"){const F=e?.find(k=>k.type==="pcb_component"&&k.source_component_id===Q.source_component_id);F&&F.type==="pcb_component"&&(h=F.center||{x:0,y:0})}const u=Hi(A,h);if(isNaN(u.x)||isNaN(u.y))return null;const d=Math.abs(A.a),D=Math.max(8,Math.min(30,.5*d)),x=$hA(u,i);return O.jsxs(j.Fragment,{children:[O.jsx("svg",{style:{position:"absolute",left:0,top:0,pointerEvents:"none",mixBlendMode:"difference",zIndex:QI.errorOverlay},width:"100%",height:"100%",children:C?O.jsx("polygon",{points:`${u.x},${u.y-D*1.25} ${u.x+D},${u.y} ${u.x},${u.y+D*1.25} ${u.x-D},${u.y}`,fill:"#ff4444"}):O.jsx("circle",{cx:u.x,cy:u.y,r:D,fill:"none",stroke:C?"#ff4444":"red",strokeWidth:C?Math.max(2,D*.15):Math.max(1,D*.1),opacity:1})}),O.jsx("div",{style:{position:"absolute",left:u.x-(D+10),top:u.y-(D+10),width:(D+10)*2,height:(D+10)*2,zIndex:QI.errorOverlay+5,cursor:"pointer",borderRadius:"50%"},onMouseEnter:F=>{const k=F.currentTarget.nextElementSibling;if(k){const v=k.querySelector(".error-message");v&&(v.style.opacity="1")}},onMouseLeave:F=>{if(!C){const k=F.currentTarget.nextElementSibling;if(k){const v=k.querySelector(".error-message");v&&(v.style.opacity="0")}}}}),O.jsx("div",{style:{position:"absolute",zIndex:C?QI.errorOverlay+20:QI.errorOverlay+10,left:x.left,top:x.top,color:C?"#ff4444":"red",textAlign:"center",fontFamily:"sans-serif",fontSize:12,display:o||C?"flex":"none",flexDirection:"column",alignItems:"center",pointerEvents:"none",transform:x.transform},children:O.jsx("div",{className:`error-message ${AuA}`,style:{opacity:C?1:0,border:`1px solid ${C?"#ff4444":"red"}`},children:g.message})})]},`${l}_${E}`)})})]})};function MJt(t,A){return t.size!==A.size?!1:Array.from(t).every(e=>A.has(e))}function NJt({primitiveElement:t,elements:A}){let e=t.trace_length?`${t.trace_length.toFixed(3)}`:"";const i=ZS(A).source_trace.get(t?.source_trace_id);if(i?.display_name&&(i?.max_length?e+=` / ${i.max_length}mm `:e+=" mm ",e+=`(${i.display_name})`),!e)return null;const o=t.trace_length&&i?.max_length&&t.trace_length>i.max_length;return{text:e,isOverLength:o}}function _Jt(t){const{primitives:A,is_showing_multiple_traces_length:e,elements:i}=t,o=A.filter(a=>a._element.type==="pcb_trace"),n=i.filter(a=>a.type==="source_trace"),s=A.filter(a=>a._element.type!=="pcb_trace"),r=o.filter(a=>n.some(g=>a._element.type==="pcb_trace"&&a._element.source_trace_id===g.source_trace_id&&g.max_length!==void 0));if(!e)return[...s,...r];if(o.length>1){const a=o.reduce((g,I)=>{const c=g._element.trace_length;return I._element.trace_length<c?I:g},o[0]);return[...s,a]}return A}var vJt={position:"absolute",left:0,top:0,pointerEvents:"none",color:"red",fontFamily:"sans-serif",fontSize:12,textShadow:"0 0 2px black"},UJt=t=>{const{_element:A,_parent_pcb_component:e,_parent_source_component:i,_source_port:o}=t;switch(A.type){case"pcb_trace":return A.trace_length?`${A.trace_length.toFixed(3)}`:"";case"pcb_smtpad":case"pcb_plated_hole":{const n=[],s=Array.from(new Set((A.port_hints??[]).concat(o?.port_hints??[]))).filter(a=>!/^[0-9]+$/.test(a)).filter(a=>!a.includes("unnamed_")).sort((a,g)=>g.localeCompare(a)),r=i&&"name"in i&&i.name&&!i.name.includes("unnamed_")?i.name:null;return s.length>0?r?n.push(...s.map(a=>`${r}.${a}`)):n.push(...s):r&&n.push(r),n.join(", ")}default:return""}},LJt={top:"red",bottom:"aqua"},HJt=({primitive:t,mousePos:A,elements:e})=>{const[i,o]=j.useState(!1),n=t._element;j.useEffect(()=>{setTimeout(()=>{o(!0)},100)},[]);const[s,r,a,g]=[t.screen_x,t.screen_y,t.screen_w,t.screen_h],I=t.same_space_index??0,c=26,B=LJt[t?._element?.layer]??"red";let l=0;if(n.type==="pcb_smtpad"&&n?.shape==="rotated_rect"?l=n?.ccw_rotation??0:(n.type==="pcb_smtpad"&&(n?.shape==="pill"||n?.shape==="rotated_pill")&&"ccw_rotation"in t||n.type==="pcb_plated_hole"&&(n?.shape==="pill"||n?.shape==="oval")&&"ccw_rotation"in t)&&(l=n.ccw_rotation??0),n.type==="pcb_trace"){const E=NJt({primitiveElement:n,elements:e});if(!E)return null;const h=A.y-35;return O.jsx("div",{style:{zIndex:QI.elementOverlay,position:"absolute",left:A.x,top:h,color:B,pointerEvents:"none",transform:"translateX(-50%)"},children:O.jsx("div",{style:{backgroundColor:"#f2efcc",color:E.isOverLength?"red":"black",textShadow:"none",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",padding:"6px 6px",borderRadius:"6px",fontSize:"14px",minWidth:"45px",textAlign:"center",whiteSpace:"nowrap"},children:E.text})})}const C=UJt(t);return C.trim().length===0?null:O.jsx("div",{style:{zIndex:QI.elementOverlay,position:"absolute",left:s-a/2-8,top:r-g/2-8,width:a+16,height:g+16,color:B,transform:`rotate(${-l}deg)`,transformOrigin:"center center"},children:O.jsx("div",{style:{width:i?`calc(100% + ${c*2*I}px)`:"100%",height:i?`calc(100% + ${c*2*I}px)`:"100%",marginLeft:i?`${-c*I}px`:0,marginTop:i?`${-c*I}px`:0,border:`1px solid ${B}`,opacity:i||I===0?1:0,transition:"width 0.2s, height 0.2s, margin-left 0.2s, margin-top 0.2s, opacity 0.2s"},children:O.jsx("div",{style:{position:"absolute",bottom:g+20+c*I,marginRight:i?`${-c*I}px`:0,marginBottom:i?0:-c*I,transition:"margin-right 0.2s, margin-bottom 0.2s",backgroundColor:"#f2efcc",color:"black",textShadow:"none",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",padding:"6px 6px",borderRadius:"6px",fontSize:"14px",transform:`rotate(${l}deg)`,minWidth:"45px",textAlign:"center"},children:C})})})},YJt=({highlightedPrimitives:t,mousePos:A,elements:e})=>{const[i,o]=Wl(r=>[r.is_moving_component,r.is_showing_multiple_traces_length]),n=t.some(r=>r._element.type==="pcb_smtpad")&&t.some(r=>r._element.type==="pcb_trace");let s=t;return n&&(s=s.filter(r=>r._element.type==="pcb_smtpad")),s=_Jt({primitives:s,is_showing_multiple_traces_length:o,elements:e}),O.jsx("div",{style:vJt,children:!i&&s.map((r,a)=>O.jsx(HJt,{primitive:r,mousePos:A,elements:e},a))})},Ck=t=>t?.type==="pcb_component",Jte=t=>t?.type==="pcb_group",JJt=t=>t?.type==="pcb_panel",euA=t=>t?.type==="pcb_board",qI={MIN_LINE_LENGTH_FOR_LABEL:40,LABEL_OFFSET_ABOVE:2,LABEL_OFFSET_BELOW:-18,LABEL_OFFSET_RIGHT:8,LABEL_OFFSET_LEFT:-120,Y_LABEL_MIN_WIDTH:110,LINE_STROKE_WIDTH:1.5,LINE_DASH_PATTERN:"4,4",COMPONENT_MARKER_RADIUS:3,LABEL_FONT_SIZE:11,ANCHOR_MARKER_SIZE:6,ANCHOR_MARKER_STROKE_WIDTH:1.5},m0={OFFSET_LINE:"white",COMPONENT_MARKER_FILL:"#66ccff",COMPONENT_MARKER_STROKE:"white",LABEL_TEXT:"white"},tuA=({targets:t,transform:A,containerWidth:e,containerHeight:i})=>{if(t.length===0)return null;const o={color:m0.LABEL_TEXT,mixBlendMode:"difference",pointerEvents:"none",fontSize:qI.LABEL_FONT_SIZE,fontFamily:"monospace",fontWeight:"bold"},n=new Map;return t.forEach(s=>{if(!n.has(s.anchor_id)){const r=Hi(A,s.anchor);n.set(s.anchor_id,r)}}),O.jsx("div",{style:{position:"absolute",left:0,top:0,width:e,height:i,overflow:"hidden",pointerEvents:"none",zIndex:QI.dimensionOverlay},children:O.jsxs("svg",{style:{position:"absolute",left:0,top:0,pointerEvents:"none"},width:e,height:i,children:[t.map(s=>{const r=s.anchor,a=s.anchor_id,g=s.target,I=n.get(a),c=Hi(A,g),B=g.x-r.x,l=g.y-r.y,C=Math.abs(c.x-I.x),Q=Math.abs(c.y-I.y),E=c.y<I.y,h=c.x>I.x,u=E?qI.LABEL_OFFSET_ABOVE:qI.LABEL_OFFSET_BELOW,d=h?qI.LABEL_OFFSET_RIGHT:qI.LABEL_OFFSET_LEFT,f=C>qI.MIN_LINE_LENGTH_FOR_LABEL,m=Q>qI.MIN_LINE_LENGTH_FOR_LABEL,S=`${s.display_offset_x??B.toFixed(2)}mm`,D=`${s.display_offset_y??l.toFixed(2)}mm`;return O.jsxs("g",{children:[O.jsx("line",{x1:I.x,y1:I.y,x2:c.x,y2:I.y,stroke:m0.OFFSET_LINE,strokeWidth:qI.LINE_STROKE_WIDTH,strokeDasharray:qI.LINE_DASH_PATTERN}),O.jsx("line",{x1:c.x,y1:I.y,x2:c.x,y2:c.y,stroke:m0.OFFSET_LINE,strokeWidth:qI.LINE_STROKE_WIDTH,strokeDasharray:qI.LINE_DASH_PATTERN}),s.type==="component"||s.type==="board"?O.jsx("circle",{cx:c.x,cy:c.y,r:qI.COMPONENT_MARKER_RADIUS,fill:m0.COMPONENT_MARKER_FILL,stroke:m0.COMPONENT_MARKER_STROKE,strokeWidth:1}):O.jsxs(O.Fragment,{children:[O.jsx("line",{x1:c.x-qI.ANCHOR_MARKER_SIZE,y1:c.y,x2:c.x+qI.ANCHOR_MARKER_SIZE,y2:c.y,stroke:m0.OFFSET_LINE,strokeWidth:qI.ANCHOR_MARKER_STROKE_WIDTH}),O.jsx("line",{x1:c.x,y1:c.y-qI.ANCHOR_MARKER_SIZE,x2:c.x,y2:c.y+qI.ANCHOR_MARKER_SIZE,stroke:m0.OFFSET_LINE,strokeWidth:qI.ANCHOR_MARKER_STROKE_WIDTH})]}),f&&O.jsx("foreignObject",{x:Math.min(I.x,c.x),y:I.y+u,width:Math.abs(c.x-I.x),height:20,style:{overflow:"visible"},children:O.jsx("div",{style:{...o,textAlign:"center"},children:S})}),m&&O.jsx("foreignObject",{x:c.x+d,y:Math.min(I.y,c.y),width:qI.Y_LABEL_MIN_WIDTH,height:Math.abs(c.y-I.y),style:{overflow:"visible"},children:O.jsx("div",{style:{...o,display:"flex",alignItems:"center",justifyContent:h?"flex-start":"flex-end",whiteSpace:"nowrap",padding:"0 4px",height:"100%"},children:D})})]},s.id)}),Array.from(n.entries()).map(([s,r])=>O.jsxs("g",{children:[O.jsx("line",{x1:r.x-qI.ANCHOR_MARKER_SIZE,y1:r.y,x2:r.x+qI.ANCHOR_MARKER_SIZE,y2:r.y,stroke:m0.OFFSET_LINE,strokeWidth:qI.ANCHOR_MARKER_STROKE_WIDTH}),O.jsx("line",{x1:r.x,y1:r.y-qI.ANCHOR_MARKER_SIZE,x2:r.x,y2:r.y+qI.ANCHOR_MARKER_SIZE,stroke:m0.OFFSET_LINE,strokeWidth:qI.ANCHOR_MARKER_STROKE_WIDTH})]},`anchor-${s}`))]})})},TJt=({elements:t,highlightedPrimitives:A,transform:e,containerWidth:i,containerHeight:o})=>{const n=t.filter(h=>euA(h)),s=t.filter(h=>Ck(h)),r=t.filter(h=>Jte(h)),a=A.map(h=>Ck(h._parent_pcb_component)?h._parent_pcb_component.pcb_component_id:Ck(h._element)?h._element.pcb_component_id:null).filter(h=>!!h),g=new Set;if(a.forEach(h=>{const u=s.find(d=>d.pcb_component_id===h);u?.pcb_group_id&&g.add(u.pcb_group_id)}),!Wl(h=>h.is_showing_group_anchor_offsets)&&a.length===0)return null;const c=s.map(h=>{const u=h.positioned_relative_to_pcb_board_id;if(!u)return null;const d=n.find(f=>f.pcb_board_id===u);return d?{component:h,board:d,type:"component"}:null}).filter(h=>!!h),B=r.map(h=>{const u=h.positioned_relative_to_pcb_board_id;if(!u||!h.center)return null;const d=n.find(f=>f.pcb_board_id===u);return d?{group:h,board:d,type:"group"}:null}).filter(h=>!!h),l=[...c,...B];if(l.length===0)return null;const C=a.length===0,Q=l.filter(h=>h.type==="component"?C||a.includes(h.component.pcb_component_id):C||g.has(h.group.pcb_group_id));if(Q.length===0)return null;const E=Q.map(h=>h.type==="component"?{id:`${h.board.pcb_board_id}-${h.component.pcb_component_id}-${h.type}`,anchor:h.board.center,anchor_id:h.board.pcb_board_id,target:h.component.center,type:"component",display_offset_x:h.component.display_offset_x,display_offset_y:h.component.display_offset_y}:{id:`${h.board.pcb_board_id}-${h.group.pcb_group_id}-${h.type}`,anchor:h.board.center,anchor_id:h.board.pcb_board_id,target:{x:h.group.anchor_position?.x??h.group.center.x,y:h.group.anchor_position?.y??h.group.center.y},type:"group",display_offset_x:h.group.display_offset_x,display_offset_y:h.group.display_offset_y}).filter(h=>!!h);return O.jsx(tuA,{targets:E,transform:e,containerWidth:i,containerHeight:o})},KJt=({elements:t,highlightedPrimitives:A,transform:e,containerWidth:i,containerHeight:o})=>{const n=t.filter(h=>Jte(h)),s=t.filter(h=>Ck(h)),r=A.map(h=>Ck(h._parent_pcb_component)?h._parent_pcb_component.pcb_component_id:Ck(h._element)?h._element.pcb_component_id:null).filter(h=>!!h),a=(h,u)=>{if(u.has(h))return;u.add(h);const d=n.find(f=>f.pcb_group_id===h);d?.position_mode==="relative_to_group_anchor"&&d.positioned_relative_to_pcb_group_id&&a(d.positioned_relative_to_pcb_group_id,u)},g=new Set;if(r.forEach(h=>{const u=s.find(d=>d.pcb_component_id===h);u&&(u.position_mode==="relative_to_group_anchor"&&u.positioned_relative_to_pcb_group_id&&a(u.positioned_relative_to_pcb_group_id,g),u.pcb_group_id&&a(u.pcb_group_id,g))}),!Wl(h=>h.is_showing_group_anchor_offsets)&&r.length===0)return null;const c=s.map(h=>{if(h.position_mode==="relative_to_group_anchor"&&h.positioned_relative_to_pcb_group_id){const u=n.find(d=>d.pcb_group_id===h.positioned_relative_to_pcb_group_id);return u&&u.anchor_position?{component:h,parentGroup:u,type:"component"}:null}if(h.pcb_group_id){const u=n.find(d=>d.pcb_group_id===h.pcb_group_id);return u&&u.anchor_position?{component:h,parentGroup:u,type:"component"}:null}return null}).filter(h=>!!h),B=n.map(h=>{if(h.position_mode==="relative_to_group_anchor"&&h.positioned_relative_to_pcb_group_id){const u=n.find(d=>d.pcb_group_id===h.positioned_relative_to_pcb_group_id);if(u&&u.anchor_position&&h.anchor_position)return{group:h,parentGroup:u,type:"group"}}return null}).filter(h=>!!h),l=[...c,...B];if(l.length===0)return null;const C=r.length===0,Q=l.filter(h=>h.type==="component"?C||r.includes(h.component.pcb_component_id):C||g.has(h.group.pcb_group_id)||g.has(h.parentGroup.pcb_group_id));if(Q.length===0)return null;const E=Q.map(h=>{const u=h.parentGroup.anchor_position;return u?h.type==="component"?h.component.center?{id:`${h.parentGroup.pcb_group_id}-${h.component.pcb_component_id}-${h.type}`,anchor:u,anchor_id:h.parentGroup.pcb_group_id,target:h.component.center,type:"component",display_offset_x:h.component.display_offset_x,display_offset_y:h.component.display_offset_y}:null:h.group.anchor_position?{id:`${h.parentGroup.pcb_group_id}-${h.group.pcb_group_id}-${h.type}`,anchor:u,anchor_id:h.parentGroup.pcb_group_id,target:h.group.anchor_position,type:"group",display_offset_x:h.group.display_offset_x,display_offset_y:h.group.display_offset_y}:null:null}).filter(h=>!!h);return O.jsx(tuA,{targets:E,transform:e,containerWidth:i,containerHeight:o})},qJt=(t,A)=>{const e=t.pcb_component_id,i=A.filter(o=>(o.type==="pcb_smtpad"||o.type==="pcb_plated_hole")&&o.pcb_component_id===e||o.type==="pcb_hole"&&o.pcb_component_id===e);return i.length===0?zhA([t]):zhA(i)},PJt=({elements:t,highlightedPrimitives:A,transform:e,containerWidth:i,containerHeight:o})=>{const n=new Map;for(const r of A)Ck(r._parent_pcb_component)&&n.set(r._parent_pcb_component.pcb_component_id,r._parent_pcb_component),Ck(r._element)&&n.set(r._element.pcb_component_id,r._element);if(n.size===0)return null;const s=[];for(const r of n.values()){const a=qJt(r,t);if(!a)continue;const g=r.positioned_relative_to_pcb_group_id??r.pcb_group_id,I=g?ZS(t).pcb_group.get(g):null;s.push({component:r,bbox:a,group:I})}return s.length===0?null:O.jsx("div",{style:{position:"absolute",left:0,top:0,width:i,height:o,overflow:"hidden",pointerEvents:"none",zIndex:QI.dimensionOverlay},children:O.jsx("svg",{style:{position:"absolute",left:0,top:0,pointerEvents:"none"},width:i,height:o,children:s.map(({component:r,bbox:a,group:g})=>{const I=Hi(e,{x:a.minX,y:a.maxY}),c=Hi(e,{x:a.maxX,y:a.minY}),B={x:Math.min(I.x,c.x),y:Math.min(I.y,c.y),width:Math.abs(c.x-I.x),height:Math.abs(c.y-I.y)},l=r.center??{x:(a.minX+a.maxX)/2,y:(a.minY+a.maxY)/2},C=Hi(e,l);return O.jsxs("g",{children:[O.jsx("rect",{x:B.x,y:B.y,width:B.width,height:B.height,fill:"none",stroke:"white",strokeWidth:1.5,strokeDasharray:"4,4"}),O.jsx("line",{x1:C.x-6,y1:C.y,x2:C.x+6,y2:C.y,stroke:m0.COMPONENT_MARKER_STROKE,strokeWidth:1.5}),O.jsx("line",{x1:C.x,y1:C.y-6,x2:C.x,y2:C.y+6,stroke:m0.COMPONENT_MARKER_STROKE,strokeWidth:1.5}),O.jsx("circle",{cx:C.x,cy:C.y,r:qI.COMPONENT_MARKER_RADIUS,fill:m0.COMPONENT_MARKER_FILL,stroke:m0.COMPONENT_MARKER_STROKE,strokeWidth:1})]},r.pcb_component_id)})})})},OJt=({elements:t,highlightedPrimitives:A,transform:e,containerWidth:i,containerHeight:o})=>{const n=t.filter(l=>JJt(l)),s=t.filter(l=>euA(l)),r=A.map(l=>euA(l._element)?l._element.pcb_board_id:null).filter(l=>!!l);if(!Wl(l=>l.is_showing_group_anchor_offsets)&&r.length===0)return null;const g=s.map(l=>{const C=l.pcb_panel_id,Q=l.position_mode;if(!C||Q!=="relative_to_panel_anchor")return null;const E=n.find(h=>h.pcb_panel_id===C);return E?{board:l,panel:E,type:"board"}:null}).filter(l=>!!l);if(g.length===0)return null;const I=r.length===0,c=g.filter(l=>I||r.includes(l.board.pcb_board_id));if(c.length===0)return null;const B=c.map(l=>l.board.center?{id:`${l.panel.pcb_panel_id}-${l.board.pcb_board_id}-${l.type}`,anchor:l.panel.center,anchor_id:l.panel.pcb_panel_id,target:l.board.center,type:"board",display_offset_x:l.board.display_offset_x,display_offset_y:l.board.display_offset_y}:null).filter(l=>!!l);return O.jsx(tuA,{targets:B,transform:e,containerWidth:i,containerHeight:o})},_Z=t=>{if(t.length===0)return null;let A=t[0].x,e=t[0].y,i=t[0].x,o=t[0].y;for(const n of t)n.x<A&&(A=n.x),n.y<e&&(e=n.y),n.x>i&&(i=n.x),n.y>o&&(o=n.y);return{center:{x:(A+i)/2,y:(e+o)/2},width:i-A,height:o-e}},Tte=(t,A)=>{if(A.length<3)return!1;let e=!1;for(let i=0,o=A.length-1;i<A.length;o=i++){const n=A[i].x,s=A[i].y,r=A[o].x,a=A[o].y;s>t.y!=a>t.y&&t.x<(r-n)*(t.y-s)/(a-s||Number.EPSILON)+n&&(e=!e)}return e},WJt=(t,A,e)=>{const i=[];for(const o of t){if(!o._element)continue;if("x1"in o&&o._element?.type==="pcb_trace"){const r=gh({x:A.x,y:A.y},{x:o.x1,y:o.y1},{x:o.x2,y:o.y2}),a=o.width||.5,g=Math.max(a*25,2)/e.a;r<g&&i.push(o);continue}if(o.pcb_drawing_type==="polygon"){const r=o.points.map(g=>({x:ae.parse(g.x),y:ae.parse(g.y)})),a=_Z(r);if(!a||A.x<a.center.x-a.width/2||A.x>a.center.x+a.width/2||A.y<a.center.y-a.height/2||A.y>a.center.y+a.height/2)continue;Tte(A,r)&&i.push(o);continue}if(o.pcb_drawing_type==="polygon_with_arcs"){const r=o.brep_shape.outer_ring.vertices.map(g=>({x:ae.parse(g.x),y:ae.parse(g.y)})),a=_Z(r);if(!a||A.x<a.center.x-a.width/2||A.x>a.center.x+a.width/2||A.y<a.center.y-a.height/2||A.y>a.center.y+a.height/2)continue;Tte(A,r)&&i.push(o);continue}if(!("x"in o&&"y"in o))continue;let n=0,s=0;if("w"in o&&"h"in o)n=o.w,s=o.h;else if("r"in o)n=o.r*2,s=o.r*2;else if("rX"in o&&"rY"in o)n=o.rX*2,s=o.rY*2;else continue;Math.abs(o.x-A.x)<n/2&&Math.abs(o.y-A.y)<s/2&&i.push(o)}return i},ZJt=({elements:t,children:A,transform:e,primitives:i,onMouseHoverOverPrimitives:o})=>{const[n,s]=j.useState([]),[r,a]=j.useState({x:0,y:0}),[g,{width:I,height:c}]=sY(),B=j.useMemo(()=>{const C=[];for(const Q of n){if(Q._element?.type==="pcb_via"||Q._element?.type==="pcb_component"||Q?.layer==="drill")continue;let E=null,h=0,u=0;if(Q.pcb_drawing_type==="polygon"){const S=_Z(Q.points);if(!S)continue;E=S.center,h=S.width,u=S.height}else if(Q.pcb_drawing_type==="polygon_with_arcs"){const S=Q.brep_shape.outer_ring.vertices.map(x=>({x:x.x,y:x.y})),D=_Z(S);if(!D)continue;E=D.center,h=D.width,u=D.height}else"x"in Q&&"y"in Q&&(E={x:Q.x,y:Q.y},h="w"in Q?Q.w:"r"in Q?Q.r*2:"rX"in Q&&"rY"in Q?Q.rX*2:0,u="h"in Q?Q.h:"r"in Q?Q.r*2:"rX"in Q&&"rY"in Q?Q.rY*2:0);if(!E)continue;const d=Hi(e,E),f={w:h*e.a,h:u*e.a},m=C.filter(S=>d.x===S.screen_x&&d.y===S.screen_y&&f.w===S.screen_w&&f.h===S.screen_h).length;C.push({...Q,x:E.x,y:E.y,w:h,h:u,screen_x:d.x,screen_y:d.y,screen_w:f.w,screen_h:f.h,same_space_index:m})}return C},[n,e]),l=(C,Q,E,h)=>{a({x:C,y:Q});const u=Hi(PS(E),{x:C,y:Q}),d=WJt(h,u,E);MJt(new Set(d.map(f=>f._pcb_drawing_object_id)),new Set(n.map(f=>f._pcb_drawing_object_id)))||(s(d),o(d))};return O.jsxs("div",{ref:g,style:{position:"relative",width:"100%",height:"100%"},onMouseMove:C=>{if(e){const Q=C.currentTarget.getBoundingClientRect(),E=C.clientX-Q.left,h=C.clientY-Q.top;l(E,h,e,i)}},onTouchStart:C=>{if(e){const Q=C.touches[0],E=C.currentTarget.getBoundingClientRect(),h=Q.clientX-E.left,u=Q.clientY-E.top;l(h,u,e,i)}},children:[A,O.jsx(YJt,{elements:t,mousePos:r,highlightedPrimitives:B}),e&&O.jsxs(O.Fragment,{children:[O.jsx(TJt,{elements:t,highlightedPrimitives:B,transform:e,containerWidth:I,containerHeight:c}),O.jsx(KJt,{elements:t,highlightedPrimitives:B,transform:e,containerWidth:I,containerHeight:c}),O.jsx(PJt,{elements:t,highlightedPrimitives:B,transform:e,containerWidth:I,containerHeight:c}),O.jsx(OJt,{elements:t,highlightedPrimitives:B,transform:e,containerWidth:I,containerHeight:c})]})]})},Kte=["rgb(255, 100, 100)","rgb(100, 255, 100)","rgb(100, 100, 255)","rgb(255, 255, 100)","rgb(255, 100, 255)","rgb(100, 255, 255)","rgb(255, 150, 100)","rgb(150, 100, 255)","rgb(100, 255, 150)","rgb(255, 100, 150)"],VJt=({children:t,transform:A=qS(),elements:e=[],hoveredComponentIds:i=[]})=>{const[o,{width:n,height:s}]=sY(),r=j.useRef(null),{is_showing_pcb_groups:a,pcb_group_view_mode:g,is_showing_group_anchor_offsets:I}=Wl(c=>({is_showing_pcb_groups:c.is_showing_pcb_groups,pcb_group_view_mode:c.pcb_group_view_mode,is_showing_group_anchor_offsets:c.is_showing_group_anchor_offsets}));return j.useEffect(()=>{const c=r.current;if(!c||!n||!s)return;c.width=n,c.height=s;const B=c.getContext("2d");if(!B||(B.clearRect(0,0,n,s),!a))return;const l=e.filter(S=>S.type==="pcb_group"),C=e.filter(S=>S.type==="pcb_component"),Q=e.filter(S=>S.type==="source_group"),E=new Map(Q.map(S=>[S.source_group_id,S])),h=l.filter(S=>{if(g==="all")return!0;if(!S.source_group_id)return!1;const D=E.get(S.source_group_id);return D?D.was_automatically_named!==!0:!1}),u=new Map;Q.forEach(S=>{const D=S;if(D.parent_source_group_id){const x=u.get(D.parent_source_group_id)||[];x.push(S.source_group_id),u.set(D.parent_source_group_id,x)}});const d=S=>{const D=[],x=u.get(S)||[];for(const F of x)D.push(F),D.push(...d(F));return D},f=S=>{const D=Q.find(x=>x.source_group_id===S);return D?.parent_source_group_id?1+f(D.parent_source_group_id):0},m=new Set;if(i.length>0)for(const S of C){if(!i.includes(S.pcb_component_id))continue;const D=S.positioned_relative_to_pcb_group_id??S.pcb_group_id;D&&m.add(D)}h.forEach((S,D)=>{let x=C.filter(UA=>UA.pcb_group_id===S.pcb_group_id);if(S.source_group_id){const UA=d(S.source_group_id),OA=l.filter(FA=>FA.source_group_id&&UA.includes(FA.source_group_id));for(const FA of OA){const DA=C.filter(TA=>TA.pcb_group_id===FA.pcb_group_id);x=[...x,...DA]}}let F,k,v,_,H=!1;if(S.center&&S.width&&S.height){H=!0;const UA=S.width/2,OA=S.height/2;F=S.center.x-UA,v=S.center.x+UA,k=S.center.y-OA,_=S.center.y+OA}else if(x.length===0||(F=1/0,k=1/0,v=-1/0,_=-1/0,x.forEach(UA=>{if(UA.center&&typeof UA.width=="number"&&typeof UA.height=="number"){const OA=UA.center.x-UA.width/2,FA=UA.center.x+UA.width/2,DA=UA.center.y+UA.height/2,TA=UA.center.y-UA.height/2;F=Math.min(F,OA),v=Math.max(v,FA),k=Math.min(k,TA),_=Math.max(_,DA)}}),F===1/0||v===-1/0))return;const P=S.source_group_id?f(S.source_group_id):0,J=S.source_group_id?d(S.source_group_id).length>0:!1;if(!H){const FA=1+(J?.5:0);F-=FA,v+=FA,k-=FA,_+=FA}const W=Hi(A,{x:F,y:_}),Z=Hi(A,{x:v,y:_}),AA=Hi(A,{x:F,y:k}),nA=Hi(A,{x:v,y:k}),gA=Kte[D%Kte.length];B.strokeStyle=gA,B.lineWidth=2;const tA=Math.max(4,Math.min(12,8*Math.abs(A.a))),iA=Math.max(2,Math.min(6,4*Math.abs(A.a))),CA=tA*(J?1.3:1),dA=iA;B.setLineDash([CA,dA]),B.beginPath(),B.moveTo(W.x,W.y),B.lineTo(Z.x,Z.y),B.lineTo(nA.x,nA.y),B.lineTo(AA.x,AA.y),B.closePath(),B.stroke();const SA=Math.max(8,Math.min(12,10*Math.abs(A.a))),xA=P==0||P==1?0:P*.11,JA=SA*(1-xA),lA=4,RA=S.name||`Group ${D+1}`;B.font=`${JA}px sans-serif`,B.setLineDash([]);const KA=B.measureText(RA).width+lA*2,$A=JA+lA*2,ge=W.x-5,yA=W.y-5,qA=3;if(B.fillStyle="rgba(0, 0, 0, 0.8)",B.beginPath(),B.roundRect(ge,yA-$A,KA,$A,qA),B.fill(),B.fillStyle=gA,B.textAlign="left",B.textBaseline="middle",B.fillText(RA,ge+lA,yA-$A/2),I&&m.has(S.pcb_group_id)&&!!S.anchor_position&&S.anchor_position){const UA=Array.isArray(S.anchor_position)?{x:S.anchor_position[0]??0,y:S.anchor_position[1]??0}:{x:S.anchor_position.x,y:S.anchor_position.y},OA=Hi(A,UA);B.strokeStyle="white",B.lineWidth=1.5,B.setLineDash([]);const FA=Math.max(4,Math.min(8,6*Math.abs(A.a)));B.beginPath(),B.moveTo(OA.x-FA,OA.y),B.lineTo(OA.x+FA,OA.y),B.stroke(),B.beginPath(),B.moveTo(OA.x,OA.y-FA),B.lineTo(OA.x,OA.y+FA),B.stroke()}})},[e,A,n,s,a,g,I,i]),O.jsxs("div",{ref:o,style:{position:"relative",width:"100%",height:"100%"},children:[t,O.jsx("canvas",{ref:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none",zIndex:QI.pcbGroupOverlay,display:a?"block":"none"}})]})},jJt=({transform:t,soup:A,children:e})=>{const i=Wl(r=>r.is_showing_rats_nest),{netMap:o,idToNetMap:n}=j.useMemo(()=>pte(A||[]),[A]),s=j.useMemo(()=>{if(!A||!i)return[];const r=B=>{const l=ZS(A)[B.replace(/_\d+$/,"")].get(B);return l&&"x"in l&&"y"in l?{x:l.x,y:l.y}:null},a=(B,l)=>{const C=o[l]||[];let Q=null,E=1/0;return C.forEach(h=>{const u=r(h);if(u){const d=Math.sqrt((B.x-u.x)**2+(B.y-u.y)**2);d<E&&d>0&&(E=d,Q=u)}}),Q},g=ZS(A).pcb_port.list(),I=ZS(A).source_trace.list(),c=[];return g.forEach((B,l)=>{const C=n[B.pcb_port_id];let Q=!1;for(const u of I)u.connected_source_port_ids.includes(B.source_port_id)&&u.connected_source_net_ids.length>0&&(Q=!0);if(!C)return;const E={x:B.x,y:B.y},h=a(E,C);h&&c.push({key:`${B.pcb_port_id}-${l}`,startPoint:E,endPoint:h,isInNet:Q})}),c},[A,o,n,i]);return!A||!i?e:(t||(t=qS()),O.jsxs("div",{style:{position:"relative"},children:[e,O.jsx("svg",{style:{position:"absolute",left:0,top:0,width:"100%",height:"100%",pointerEvents:"none",opacity:.5,zIndex:QI.ratsNestOverlay},children:s.map(({key:r,startPoint:a,endPoint:g,isInNet:I})=>{const c=Hi(t,a),B=Hi(t,g);return O.jsx("line",{x1:c.x,y1:c.y,x2:B.x,y2:B.y,stroke:"white",strokeWidth:"1",strokeDasharray:I?"6,6":void 0},r)})})]}))},zJt={version:"1.11.320"},Qk=(t,A,e)=>{const i=Wl(s=>s.is_mouse_over_container),o=j.useRef(i),n=j.useRef(A);j.useEffect(()=>{o.current=i},[i]),j.useEffect(()=>{n.current=A},[A]),j.useEffect(()=>{if(!t)return;const s=r=>{const a=r.target;if(a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.isContentEditable)return;const g=t.split("+"),I=g.includes("ctrl"),c=g.includes("shift"),B=g.includes("alt"),l=g.includes("meta"),C=g[g.length-1],Q=e?.current?e.current.contains(document.activeElement)||document.activeElement===e.current:!1;(o.current||Q)&&(!I||r.ctrlKey)&&(!c||r.shiftKey)&&(!B||r.altKey)&&(!l||r.metaKey)&&r.key.toLowerCase()===C.toLowerCase()&&(r.preventDefault(),n.current())};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s)}},[t])},XJt=()=>{const[t,A]=j.useState(!1);return j.useEffect(()=>{const e=()=>{A(window.innerWidth<=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),t},$Jt=({name:t,selected:A,onClick:e})=>O.jsxs("div",{className:av`
5406
5406
  margin-top: 2px;
5407
5407
  padding: 4px;
5408
5408
  padding-left: 8px;
@@ -5619,7 +5619,7 @@ test("${g} should solve problem correctly", () => {
5619
5619
  // Add more specific assertions based on expected output
5620
5620
  // expect(solver.netLabelPlacementSolver!.netLabelPlacements).toMatchInlineSnapshot()
5621
5621
  })
5622
- `,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"})]})]})},$te=t=>t.activeSubSolver?[t,...$te(t.activeSubSolver)]:[t],bKt=({solver:t})=>{const A=$te(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(SKt,{solver:e})]},e.constructor.name))})},xKt=({solver:t,triggerRender:A,animationSpeed:e=25,onSolverStarted:i,onSolverCompleted:o})=>{const[n,s]=j.useReducer(Q=>!Q,!1),r=j.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)};j.useEffect(()=>()=>{r.current&&clearInterval(r.current)},[]),j.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(bKt,{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]})]})},kKt=(t,A,e)=>{const i=t.currentPipelineStepIndex;return A<i?"Completed":A===i&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},GKt=(t,A)=>{const i=t.pipelineDef[A].solverName,o=kKt(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}},FKt=({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})},RKt=({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,"%"]})]})},MKt=t=>Object.entries(t).map(([A,e])=>`${A}: ${e}`).join(", "),NKt=({stats:t})=>{if(!t||Object.keys(t).length===0)return O.jsx("span",{children:"-"});const A=Object.entries(t),e=MKt(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))})]})},IuA=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(IuA);const A={};for(const[e,i]of Object.entries(t))e.startsWith("_")||(A[e]=IuA(i));return A},_Kt=(t,A)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${A}`);return}const e=IuA(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)}`)}},vKt=({solver:t,onStepUntilPhase:A,onDownloadInput:e})=>{const i=t.pipelineDef.map((r,a)=>GKt(t,a)),o=r=>{A?.(r)},n=r=>{r.solverInstance&&(e?e(r.solverInstance,r.name):_Kt(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(FKt,{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(RKt,{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(NKt,{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))})]})})]})},UKt=class extends Xi.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 LKt({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 HKt=({solver:t,animationSpeed:A=25,onSolverStarted:e,onSolverCompleted:i})=>{const[o,n]=j.useReducer(I=>I+1,0),s=j.useMemo(()=>{try{return t.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(I){return console.error("Visualization error:",I),{points:[],lines:[],rects:[],circles:[]}}},[t,o]),r=j.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);j.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(xKt,{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(UKt,{fallback:O.jsx(LKt,{graphics:s}),children:O.jsx(DKt,{graphics:s})}),a&&O.jsx(vKt,{solver:t,onStepUntilPhase:g})]})};const YKt=()=>{j.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)},[])},JKt=t=>t.toLowerCase().includes("pack")?XSt:t.toLowerCase().includes("rout")?ibt:USt,TKt=({solverEvents:t=[]})=>{const[A,e]=j.useState(null);YKt();const i=j.useMemo(()=>{const r=new Map;for(const a of t){const g=`${a.componentName}-${a.solverName}`;r.set(g,a)}return r},[t]),o=j.useMemo(()=>Array.from(i.keys()),[i]),n=A?i.get(A):null,s=j.useMemo(()=>{if(!n)return{instance:null,error:null,classFound:!1};const r=jeA[n.solverName];if(!r)return{instance:null,error:`Solver class "${n.solverName}" not found in SOLVERS registry. Available: ${Object.keys(jeA).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=JKt(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(ky,{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(HKt,{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"})})})]})},Aie=({errorMessage:t,errorStack:A,circuitJsonErrors:e})=>{j.useEffect(()=>{if(t){const i=new Error(t);A&&(i.stack=A);try{z3.captureException(i)}catch{}}},[t,A]),j.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{z3.captureException(o,{error_type:i.type})}catch{}}},[e])},eie="0.0.1508",KKt={version:eie},JZ=D1A()(S1A(t=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:A=>{t({lastRunEvalVersion:A})}}),{name:"runframe-runner-store"})),qKt=t=>{const[A,e]=j.useState([]),[i,o]=j.useState(null),[n,s]=j.useState(""),[r,a]=gv("eval-version-selection",null),g=JZ(l=>l.setLastRunEvalVersion),I=JZ(l=>l.lastRunEvalVersion);return j.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]),j.useEffect(()=>{t&&(r?(window.TSCIRCUIT_LATEST_EVAL_VERSION=r,g(r)):i&&(window.TSCIRCUIT_LATEST_EVAL_VERSION=i,g(i)))},[t,r,i]),{versions:j.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("")}}},PKt=({snippetNames:t,onSelect:A,onCancel:e,isOpen:i})=>{const[o,n]=j.useState(""),[s,r]=j.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}`})]})]})})},OKt=t=>{const A=j.useRef(null),e=Yc(i=>i.recentEvents);j.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 WKt(t){const A=ZKt(t),e=j.forwardRef((i,o)=>{const{children:n,...s}=i,r=j.Children.toArray(n),a=r.find(jKt);if(a){const g=a.props.children,I=r.map(c=>c===a?j.Children.count(g)>1?j.Children.only(null):j.isValidElement(g)?g.props.children:null:c);return O.jsx(A,{...s,ref:o,children:j.isValidElement(g)?j.cloneElement(g,void 0,I):null})}return O.jsx(A,{...s,ref:o,children:n})});return e.displayName=`${t}.Slot`,e}function ZKt(t){const A=j.forwardRef((e,i)=>{const{children:o,...n}=e;if(j.isValidElement(o)){const s=XKt(o),r=zKt(n,o.props);return o.type!==j.Fragment&&(r.ref=i?Vp(i,s):s),j.cloneElement(o,r)}return j.Children.count(o)>1?j.Children.only(null):null});return A.displayName=`${t}.SlotClone`,A}var VKt=Symbol("radix.slottable");function jKt(t){return j.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===VKt}function zKt(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 XKt(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 TZ="Dialog",[tie,iie]=uw(TZ),[$Kt,Pw]=tie(TZ),oie=t=>{const{__scopeDialog:A,children:e,open:i,defaultOpen:o,onOpenChange:n,modal:s=!0}=t,r=j.useRef(null),a=j.useRef(null),[g,I]=sx({prop:i,defaultProp:o??!1,onChange:n,caller:TZ});return O.jsx($Kt,{scope:A,triggerRef:r,contentRef:a,contentId:Bh(),titleId:Bh(),descriptionId:Bh(),open:g,onOpenChange:I,onOpenToggle:j.useCallback(()=>I(c=>!c),[I]),modal:s,children:e})};oie.displayName=TZ;var nie="DialogTrigger",sie=j.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Pw(nie,e),n=Bc(A,o.triggerRef);return O.jsx(Ha.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":luA(o.open),...i,ref:n,onClick:vo(t.onClick,o.onOpenToggle)})});sie.displayName=nie;var cuA="DialogPortal",[Aqt,rie]=tie(cuA,{forceMount:void 0}),aie=t=>{const{__scopeDialog:A,forceMount:e,children:i,container:o}=t,n=Pw(cuA,A);return O.jsx(Aqt,{scope:A,forceMount:e,children:j.Children.map(i,s=>O.jsx(s0,{present:e||n.open,children:O.jsx(nW,{asChild:!0,container:o,children:s})}))})};aie.displayName=cuA;var KZ="DialogOverlay",gie=j.forwardRef((t,A)=>{const e=rie(KZ,t.__scopeDialog),{forceMount:i=e.forceMount,...o}=t,n=Pw(KZ,t.__scopeDialog);return n.modal?O.jsx(s0,{present:i||n.open,children:O.jsx(tqt,{...o,ref:A})}):null});gie.displayName=KZ;var eqt=WKt("DialogOverlay.RemoveScroll"),tqt=j.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Pw(KZ,e);return O.jsx(lW,{as:eqt,allowPinchZoom:!0,shards:[o.contentRef],children:O.jsx(Ha.div,{"data-state":luA(o.open),...i,ref:A,style:{pointerEvents:"auto",...i.style}})})}),VF="DialogContent",Iie=j.forwardRef((t,A)=>{const e=rie(VF,t.__scopeDialog),{forceMount:i=e.forceMount,...o}=t,n=Pw(VF,t.__scopeDialog);return O.jsx(s0,{present:i||n.open,children:n.modal?O.jsx(iqt,{...o,ref:A}):O.jsx(oqt,{...o,ref:A})})});Iie.displayName=VF;var iqt=j.forwardRef((t,A)=>{const e=Pw(VF,t.__scopeDialog),i=j.useRef(null),o=Bc(A,e.contentRef,i);return j.useEffect(()=>{const n=i.current;if(n)return tEA(n)},[]),O.jsx(cie,{...t,ref:o,trapFocus:e.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:vo(t.onCloseAutoFocus,n=>{n.preventDefault(),e.triggerRef.current?.focus()}),onPointerDownOutside:vo(t.onPointerDownOutside,n=>{const s=n.detail.originalEvent,r=s.button===0&&s.ctrlKey===!0;(s.button===2||r)&&n.preventDefault()}),onFocusOutside:vo(t.onFocusOutside,n=>n.preventDefault())})}),oqt=j.forwardRef((t,A)=>{const e=Pw(VF,t.__scopeDialog),i=j.useRef(!1),o=j.useRef(!1);return O.jsx(cie,{...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()}})}),cie=j.forwardRef((t,A)=>{const{__scopeDialog:e,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:n,...s}=t,r=Pw(VF,e),a=j.useRef(null),g=Bc(A,a);return UQA(),O.jsxs(O.Fragment,{children:[O.jsx(O8,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:n,children:O.jsx(oH,{role:"dialog",id:r.contentId,"aria-describedby":r.descriptionId,"aria-labelledby":r.titleId,"data-state":luA(r.open),...s,ref:g,onDismiss:()=>r.onOpenChange(!1)})}),O.jsxs(O.Fragment,{children:[O.jsx(sqt,{titleId:r.titleId}),O.jsx(aqt,{contentRef:a,descriptionId:r.descriptionId})]})]})}),BuA="DialogTitle",Bie=j.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Pw(BuA,e);return O.jsx(Ha.h2,{id:o.titleId,...i,ref:A})});Bie.displayName=BuA;var lie="DialogDescription",Cie=j.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Pw(lie,e);return O.jsx(Ha.p,{id:o.descriptionId,...i,ref:A})});Cie.displayName=lie;var Qie="DialogClose",Eie=j.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Pw(Qie,e);return O.jsx(Ha.button,{type:"button",...i,ref:A,onClick:vo(t.onClick,()=>o.onOpenChange(!1))})});Eie.displayName=Qie;function luA(t){return t?"open":"closed"}var hie="DialogTitleWarning",[nqt,uie]=_3e(hie,{contentName:VF,titleName:BuA,docsSlug:"dialog"}),sqt=({titleId:t})=>{const A=uie(hie),e=`\`${A.contentName}\` requires a \`${A.titleName}\` for the component to be accessible for screen reader users.
5622
+ `,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"})]})]})},$te=t=>t.activeSubSolver?[t,...$te(t.activeSubSolver)]:[t],bKt=({solver:t})=>{const A=$te(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(SKt,{solver:e})]},e.constructor.name))})},xKt=({solver:t,triggerRender:A,animationSpeed:e=25,onSolverStarted:i,onSolverCompleted:o})=>{const[n,s]=j.useReducer(Q=>!Q,!1),r=j.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)};j.useEffect(()=>()=>{r.current&&clearInterval(r.current)},[]),j.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(bKt,{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]})]})},kKt=(t,A,e)=>{const i=t.currentPipelineStepIndex;return A<i?"Completed":A===i&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},GKt=(t,A)=>{const i=t.pipelineDef[A].solverName,o=kKt(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}},FKt=({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})},RKt=({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,"%"]})]})},MKt=t=>Object.entries(t).map(([A,e])=>`${A}: ${e}`).join(", "),NKt=({stats:t})=>{if(!t||Object.keys(t).length===0)return O.jsx("span",{children:"-"});const A=Object.entries(t),e=MKt(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))})]})},IuA=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(IuA);const A={};for(const[e,i]of Object.entries(t))e.startsWith("_")||(A[e]=IuA(i));return A},_Kt=(t,A)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${A}`);return}const e=IuA(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)}`)}},vKt=({solver:t,onStepUntilPhase:A,onDownloadInput:e})=>{const i=t.pipelineDef.map((r,a)=>GKt(t,a)),o=r=>{A?.(r)},n=r=>{r.solverInstance&&(e?e(r.solverInstance,r.name):_Kt(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(FKt,{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(RKt,{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(NKt,{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))})]})})]})},UKt=class extends Xi.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 LKt({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 HKt=({solver:t,animationSpeed:A=25,onSolverStarted:e,onSolverCompleted:i})=>{const[o,n]=j.useReducer(I=>I+1,0),s=j.useMemo(()=>{try{return t.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(I){return console.error("Visualization error:",I),{points:[],lines:[],rects:[],circles:[]}}},[t,o]),r=j.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);j.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(xKt,{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(UKt,{fallback:O.jsx(LKt,{graphics:s}),children:O.jsx(DKt,{graphics:s})}),a&&O.jsx(vKt,{solver:t,onStepUntilPhase:g})]})};const YKt=()=>{j.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)},[])},JKt=t=>t.toLowerCase().includes("pack")?XSt:t.toLowerCase().includes("rout")?ibt:USt,TKt=({solverEvents:t=[]})=>{const[A,e]=j.useState(null);YKt();const i=j.useMemo(()=>{const r=new Map;for(const a of t){const g=`${a.componentName}-${a.solverName}`;r.set(g,a)}return r},[t]),o=j.useMemo(()=>Array.from(i.keys()),[i]),n=A?i.get(A):null,s=j.useMemo(()=>{if(!n)return{instance:null,error:null,classFound:!1};const r=jeA[n.solverName];if(!r)return{instance:null,error:`Solver class "${n.solverName}" not found in SOLVERS registry. Available: ${Object.keys(jeA).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=JKt(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(ky,{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(HKt,{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"})})})]})},Aie=({errorMessage:t,errorStack:A,circuitJsonErrors:e})=>{j.useEffect(()=>{if(t){const i=new Error(t);A&&(i.stack=A);try{z3.captureException(i)}catch{}}},[t,A]),j.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{z3.captureException(o,{error_type:i.type})}catch{}}},[e])},eie="0.0.1509",KKt={version:eie},JZ=D1A()(S1A(t=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:A=>{t({lastRunEvalVersion:A})}}),{name:"runframe-runner-store"})),qKt=t=>{const[A,e]=j.useState([]),[i,o]=j.useState(null),[n,s]=j.useState(""),[r,a]=gv("eval-version-selection",null),g=JZ(l=>l.setLastRunEvalVersion),I=JZ(l=>l.lastRunEvalVersion);return j.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]),j.useEffect(()=>{t&&(r?(window.TSCIRCUIT_LATEST_EVAL_VERSION=r,g(r)):i&&(window.TSCIRCUIT_LATEST_EVAL_VERSION=i,g(i)))},[t,r,i]),{versions:j.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("")}}},PKt=({snippetNames:t,onSelect:A,onCancel:e,isOpen:i})=>{const[o,n]=j.useState(""),[s,r]=j.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}`})]})]})})},OKt=t=>{const A=j.useRef(null),e=Yc(i=>i.recentEvents);j.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 WKt(t){const A=ZKt(t),e=j.forwardRef((i,o)=>{const{children:n,...s}=i,r=j.Children.toArray(n),a=r.find(jKt);if(a){const g=a.props.children,I=r.map(c=>c===a?j.Children.count(g)>1?j.Children.only(null):j.isValidElement(g)?g.props.children:null:c);return O.jsx(A,{...s,ref:o,children:j.isValidElement(g)?j.cloneElement(g,void 0,I):null})}return O.jsx(A,{...s,ref:o,children:n})});return e.displayName=`${t}.Slot`,e}function ZKt(t){const A=j.forwardRef((e,i)=>{const{children:o,...n}=e;if(j.isValidElement(o)){const s=XKt(o),r=zKt(n,o.props);return o.type!==j.Fragment&&(r.ref=i?Vp(i,s):s),j.cloneElement(o,r)}return j.Children.count(o)>1?j.Children.only(null):null});return A.displayName=`${t}.SlotClone`,A}var VKt=Symbol("radix.slottable");function jKt(t){return j.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===VKt}function zKt(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 XKt(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 TZ="Dialog",[tie,iie]=uw(TZ),[$Kt,Pw]=tie(TZ),oie=t=>{const{__scopeDialog:A,children:e,open:i,defaultOpen:o,onOpenChange:n,modal:s=!0}=t,r=j.useRef(null),a=j.useRef(null),[g,I]=sx({prop:i,defaultProp:o??!1,onChange:n,caller:TZ});return O.jsx($Kt,{scope:A,triggerRef:r,contentRef:a,contentId:Bh(),titleId:Bh(),descriptionId:Bh(),open:g,onOpenChange:I,onOpenToggle:j.useCallback(()=>I(c=>!c),[I]),modal:s,children:e})};oie.displayName=TZ;var nie="DialogTrigger",sie=j.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Pw(nie,e),n=Bc(A,o.triggerRef);return O.jsx(Ha.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":luA(o.open),...i,ref:n,onClick:vo(t.onClick,o.onOpenToggle)})});sie.displayName=nie;var cuA="DialogPortal",[Aqt,rie]=tie(cuA,{forceMount:void 0}),aie=t=>{const{__scopeDialog:A,forceMount:e,children:i,container:o}=t,n=Pw(cuA,A);return O.jsx(Aqt,{scope:A,forceMount:e,children:j.Children.map(i,s=>O.jsx(s0,{present:e||n.open,children:O.jsx(nW,{asChild:!0,container:o,children:s})}))})};aie.displayName=cuA;var KZ="DialogOverlay",gie=j.forwardRef((t,A)=>{const e=rie(KZ,t.__scopeDialog),{forceMount:i=e.forceMount,...o}=t,n=Pw(KZ,t.__scopeDialog);return n.modal?O.jsx(s0,{present:i||n.open,children:O.jsx(tqt,{...o,ref:A})}):null});gie.displayName=KZ;var eqt=WKt("DialogOverlay.RemoveScroll"),tqt=j.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Pw(KZ,e);return O.jsx(lW,{as:eqt,allowPinchZoom:!0,shards:[o.contentRef],children:O.jsx(Ha.div,{"data-state":luA(o.open),...i,ref:A,style:{pointerEvents:"auto",...i.style}})})}),VF="DialogContent",Iie=j.forwardRef((t,A)=>{const e=rie(VF,t.__scopeDialog),{forceMount:i=e.forceMount,...o}=t,n=Pw(VF,t.__scopeDialog);return O.jsx(s0,{present:i||n.open,children:n.modal?O.jsx(iqt,{...o,ref:A}):O.jsx(oqt,{...o,ref:A})})});Iie.displayName=VF;var iqt=j.forwardRef((t,A)=>{const e=Pw(VF,t.__scopeDialog),i=j.useRef(null),o=Bc(A,e.contentRef,i);return j.useEffect(()=>{const n=i.current;if(n)return tEA(n)},[]),O.jsx(cie,{...t,ref:o,trapFocus:e.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:vo(t.onCloseAutoFocus,n=>{n.preventDefault(),e.triggerRef.current?.focus()}),onPointerDownOutside:vo(t.onPointerDownOutside,n=>{const s=n.detail.originalEvent,r=s.button===0&&s.ctrlKey===!0;(s.button===2||r)&&n.preventDefault()}),onFocusOutside:vo(t.onFocusOutside,n=>n.preventDefault())})}),oqt=j.forwardRef((t,A)=>{const e=Pw(VF,t.__scopeDialog),i=j.useRef(!1),o=j.useRef(!1);return O.jsx(cie,{...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()}})}),cie=j.forwardRef((t,A)=>{const{__scopeDialog:e,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:n,...s}=t,r=Pw(VF,e),a=j.useRef(null),g=Bc(A,a);return UQA(),O.jsxs(O.Fragment,{children:[O.jsx(O8,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:n,children:O.jsx(oH,{role:"dialog",id:r.contentId,"aria-describedby":r.descriptionId,"aria-labelledby":r.titleId,"data-state":luA(r.open),...s,ref:g,onDismiss:()=>r.onOpenChange(!1)})}),O.jsxs(O.Fragment,{children:[O.jsx(sqt,{titleId:r.titleId}),O.jsx(aqt,{contentRef:a,descriptionId:r.descriptionId})]})]})}),BuA="DialogTitle",Bie=j.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Pw(BuA,e);return O.jsx(Ha.h2,{id:o.titleId,...i,ref:A})});Bie.displayName=BuA;var lie="DialogDescription",Cie=j.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Pw(lie,e);return O.jsx(Ha.p,{id:o.descriptionId,...i,ref:A})});Cie.displayName=lie;var Qie="DialogClose",Eie=j.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Pw(Qie,e);return O.jsx(Ha.button,{type:"button",...i,ref:A,onClick:vo(t.onClick,()=>o.onOpenChange(!1))})});Eie.displayName=Qie;function luA(t){return t?"open":"closed"}var hie="DialogTitleWarning",[nqt,uie]=_3e(hie,{contentName:VF,titleName:BuA,docsSlug:"dialog"}),sqt=({titleId:t})=>{const A=uie(hie),e=`\`${A.contentName}\` requires a \`${A.titleName}\` for the component to be accessible for screen reader users.
5623
5623
 
5624
5624
  If you want to hide the \`${A.titleName}\`, you can wrap it with our VisuallyHidden component.
5625
5625
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "main": "dist/index.js",
4
4
  "types": "dist/index.d.ts",
5
5
  "type": "module",
6
- "version": "0.0.1189-libonly",
6
+ "version": "0.0.1190-libonly",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/tscircuit/tscircuit"
@@ -59,7 +59,7 @@
59
59
  "@tscircuit/miniflex": "^0.0.4",
60
60
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
61
61
  "@tscircuit/props": "^0.0.448",
62
- "@tscircuit/runframe": "^0.0.1509",
62
+ "@tscircuit/runframe": "^0.0.1510",
63
63
  "@tscircuit/schematic-match-adapt": "^0.0.16",
64
64
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
65
65
  "@tscircuit/simple-3d-svg": "^0.0.41",