tscircuit 0.0.1048 → 0.0.1049

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.
@@ -5884,7 +5884,7 @@ $1`).replace(/>(\s*)(?=<!--\s*\/)/g,"> ")}}});function Nee(t,A,e){if(!A||!e)retu
5884
5884
  * Copyright (c) 2013-2015, 2017, Jon Schlinkert.
5885
5885
  * Released under the MIT License.
5886
5886
  *)
5887
- */const kMt=({containerClassName:t,...A})=>{const e=$.useRef(null),[i,n]=$.useState(620);return $.useLayoutEffect(()=>{const o=()=>{if(e.current){const r=e.current.clientHeight,g=window.innerHeight;n(Math.min(Math.max(r,620),g))}};o();const s=new ResizeObserver(o);return e.current&&s.observe(e.current),window.addEventListener("resize",o),()=>{s.disconnect(),window.removeEventListener("resize",o)}},[]),Z.jsx("div",{ref:e,className:t||"rf-w-full rf-h-full",children:Z.jsx(bMt,{...A,height:i})})},GMt='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.18 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--radius:0.5rem}.rf-pointer-events-none{pointer-events:none}.rf-invisible{visibility:hidden}.rf-fixed{position:fixed}.rf-absolute{position:absolute}.rf-relative{position:relative}.rf-inset-0{inset:0}.-rf-left-2{left:-.5rem}.-rf-right-10{right:-2.5rem}.-rf-right-2{right:-.5rem}.-rf-right-4{right:-1rem}.-rf-right-6{right:-1.5rem}.-rf-right-7{right:-1.75rem}.-rf-right-8{right:-2rem}.-rf-right-9{right:-2.25rem}.rf-bottom-full{bottom:100%}.rf-left-0{left:0}.rf-left-1{left:.25rem}.rf-left-1\\/2{left:50%}.rf-left-2{left:.5rem}.rf-left-\\[50\\%\\]{left:50%}.rf-right-0{right:0}.rf-right-1{right:.25rem}.rf-right-4{right:1rem}.rf-right-\\[4px\\]{right:4px}.rf-top-0{top:0}.rf-top-1{top:.25rem}.rf-top-2{top:.5rem}.rf-top-2\\.5{top:.625rem}.rf-top-\\[50\\%\\]{top:50%}.rf-top-\\[6px\\]{top:6px}.\\!rf-z-\\[101\\]{z-index:101!important}.\\!rf-z-\\[200\\]{z-index:200!important}.rf-z-10{z-index:10}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.rf-z-\\[101\\]{z-index:101}.rf-order-1{order:1}.rf-order-2{order:2}.rf-order-3{order:3}.rf-m-1{margin:.25rem}.rf-m-6{margin:1.5rem}.-rf-mx-1,.rf--mx-1{margin-left:-.25rem;margin-right:-.25rem}.rf-mx-1{margin-left:.25rem;margin-right:.25rem}.rf-mx-2{margin-left:.5rem;margin-right:.5rem}.rf-mx-4{margin-left:1rem;margin-right:1rem}.rf-mx-auto{margin-left:auto;margin-right:auto}.rf-my-1{margin-bottom:.25rem;margin-top:.25rem}.rf-my-12{margin-bottom:3rem;margin-top:3rem}.rf-my-4{margin-bottom:1rem;margin-top:1rem}.rf-my-auto{margin-bottom:auto;margin-top:auto}.rf-mb-0{margin-bottom:0}.rf-mb-0\\.5{margin-bottom:.125rem}.rf-mb-1{margin-bottom:.25rem}.rf-mb-12{margin-bottom:3rem}.rf-mb-2{margin-bottom:.5rem}.rf-mb-3{margin-bottom:.75rem}.rf-mb-4{margin-bottom:1rem}.rf-mb-6{margin-bottom:1.5rem}.rf-mb-8{margin-bottom:2rem}.rf-ml-1{margin-left:.25rem}.rf-ml-2{margin-left:.5rem}.rf-ml-6{margin-left:1.5rem}.rf-ml-auto{margin-left:auto}.rf-mr-1{margin-right:.25rem}.rf-mr-2{margin-right:.5rem}.rf-mr-4{margin-right:1rem}.rf-mt-0{margin-top:0}.rf-mt-0\\.5{margin-top:.125rem}.rf-mt-1{margin-top:.25rem}.rf-mt-2{margin-top:.5rem}.rf-mt-3{margin-top:.75rem}.rf-mt-4{margin-top:1rem}.rf-mt-5{margin-top:1.25rem}.rf-mt-auto{margin-top:auto}.rf-block{display:block}.rf-inline-block{display:inline-block}.rf-inline{display:inline}.rf-flex{display:flex}.rf-inline-flex{display:inline-flex}.rf-grid{display:grid}.rf-hidden{display:none}.rf-aspect-square{aspect-ratio:1/1}.rf-aspect-video{aspect-ratio:16/9}.rf-size-14{height:3.5rem;width:3.5rem}.rf-size-4{height:1rem;width:1rem}.\\!rf-h-2{height:.5rem!important}.\\!rf-h-2\\.5{height:.625rem!important}.\\!rf-h-3{height:.75rem!important}.\\!rf-h-full{height:100%!important}.rf-h-1{height:.25rem}.rf-h-10{height:2.5rem}.rf-h-12{height:3rem}.rf-h-2{height:.5rem}.rf-h-2\\.5{height:.625rem}.rf-h-20{height:5rem}.rf-h-24{height:6rem}.rf-h-3{height:.75rem}.rf-h-3\\.5{height:.875rem}.rf-h-4{height:1rem}.rf-h-5{height:1.25rem}.rf-h-6{height:1.5rem}.rf-h-60{height:15rem}.rf-h-64{height:16rem}.rf-h-7{height:1.75rem}.rf-h-8{height:2rem}.rf-h-9{height:2.25rem}.rf-h-\\[400px\\]{height:400px}.rf-h-\\[calc\\(100vh-52px\\)\\]{height:calc(100vh - 52px)}.rf-h-\\[calc\\(100vh-60px\\)\\]{height:calc(100vh - 60px)}.rf-h-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.rf-h-auto{height:auto}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.rf-h-screen{height:100vh}.\\!rf-max-h-\\[40vh\\]{max-height:40vh!important}.rf-max-h-16{max-height:4rem}.rf-max-h-20{max-height:5rem}.rf-max-h-24{max-height:6rem}.rf-max-h-28{max-height:7rem}.rf-max-h-32{max-height:8rem}.rf-max-h-96{max-height:24rem}.rf-max-h-\\[120px\\]{max-height:120px}.rf-max-h-\\[150px\\]{max-height:150px}.rf-max-h-\\[200px\\]{max-height:200px}.rf-max-h-\\[300px\\]{max-height:300px}.rf-max-h-\\[70vh\\]{max-height:70vh}.rf-max-h-\\[90vh\\]{max-height:90vh}.rf-max-h-full{max-height:100%}.rf-min-h-0{min-height:0}.rf-min-h-\\[100px\\]{min-height:100px}.rf-min-h-\\[200px\\]{min-height:200px}.rf-min-h-\\[300px\\]{min-height:300px}.rf-min-h-\\[620px\\]{min-height:620px}.rf-min-h-\\[calc\\(100vh-240px\\)\\]{min-height:calc(100vh - 240px)}.rf-min-h-full{min-height:100%}.\\!rf-w-2{width:.5rem!important}.\\!rf-w-2\\.5{width:.625rem!important}.\\!rf-w-\\[95vw\\]{width:95vw!important}.rf-w-1{width:.25rem}.rf-w-10{width:2.5rem}.rf-w-11{width:2.75rem}.rf-w-11\\/12{width:91.666667%}.rf-w-12{width:3rem}.rf-w-16{width:4rem}.rf-w-2{width:.5rem}.rf-w-2\\.5{width:.625rem}.rf-w-20{width:5rem}.rf-w-24{width:6rem}.rf-w-28{width:7rem}.rf-w-3{width:.75rem}.rf-w-3\\.5{width:.875rem}.rf-w-32{width:8rem}.rf-w-4{width:1rem}.rf-w-40{width:10rem}.rf-w-48{width:12rem}.rf-w-5{width:1.25rem}.rf-w-6{width:1.5rem}.rf-w-64{width:16rem}.rf-w-72{width:18rem}.rf-w-8{width:2rem}.rf-w-80{width:20rem}.rf-w-9{width:2.25rem}.rf-w-96{width:24rem}.rf-w-fit{width:-moz-fit-content;width:fit-content}.rf-w-full{width:100%}.rf-w-screen{width:100vw}.rf-min-w-0{min-width:0}.rf-min-w-10{min-width:2.5rem}.rf-min-w-16{min-width:4rem}.rf-min-w-32{min-width:8rem}.rf-min-w-80{min-width:20rem}.rf-min-w-96{min-width:24rem}.rf-min-w-\\[148px\\]{min-width:148px}.rf-min-w-\\[600px\\]{min-width:600px}.rf-min-w-\\[8rem\\]{min-width:8rem}.rf-min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.\\!rf-max-w-\\[95vw\\]{max-width:95vw!important}.rf-max-w-2xl{max-width:42rem}.rf-max-w-3xl{max-width:48rem}.rf-max-w-4xl{max-width:56rem}.rf-max-w-5xl{max-width:64rem}.rf-max-w-64{max-width:16rem}.rf-max-w-96{max-width:24rem}.rf-max-w-\\[1000px\\]{max-width:1000px}.rf-max-w-\\[150px\\]{max-width:150px}.rf-max-w-\\[200px\\]{max-width:200px}.rf-max-w-\\[40\\%\\]{max-width:40%}.rf-max-w-\\[600px\\]{max-width:600px}.rf-max-w-full{max-width:100%}.rf-max-w-lg{max-width:32rem}.rf-max-w-md{max-width:28rem}.rf-max-w-none{max-width:none}.rf-max-w-xl{max-width:36rem}.rf-max-w-xs{max-width:20rem}.rf-flex-1{flex:1 1 0%}.rf-flex-shrink-0,.rf-shrink-0{flex-shrink:0}.rf-flex-grow{flex-grow:1}.rf-table-auto{table-layout:auto}.rf-origin-\\[--radix-popover-content-transform-origin\\]{transform-origin:var(--radix-popover-content-transform-origin)}.-rf-translate-x-1{--tw-translate-x:-0.25rem}.-rf-translate-x-1,.-rf-translate-x-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rf-translate-x-1\\/2{--tw-translate-x:-50%}.-rf-translate-y-1{--tw-translate-y:-0.25rem}.-rf-translate-y-1,.rf--translate-x-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-x-1{--tw-translate-x:-0.25rem}.rf--translate-x-1\\/2{--tw-translate-x:-50%}.rf--translate-x-1\\/2,.rf--translate-y-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-y-1{--tw-translate-y:-0.25rem}.rf-translate-x-\\[-50\\%\\]{--tw-translate-x:-50%}.rf-translate-x-\\[-50\\%\\],.rf-translate-y-\\[-50\\%\\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf-translate-y-\\[-50\\%\\]{--tw-translate-y:-50%}.rf-rotate-90{--tw-rotate:90deg}.rf-rotate-90,.rf-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes rf-pulse{50%{opacity:.5}}.rf-animate-pulse{animation:rf-pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes rf-spin{to{transform:rotate(1turn)}}.rf-animate-spin{animation:rf-spin 1s linear infinite}.rf-cursor-default{cursor:default}.rf-cursor-not-allowed{cursor:not-allowed}.rf-cursor-pointer{cursor:pointer}.rf-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.rf-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.rf-grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.rf-flex-row{flex-direction:row}.rf-flex-col{flex-direction:column}.rf-flex-col-reverse{flex-direction:column-reverse}.rf-flex-wrap{flex-wrap:wrap}.rf-place-content-center{place-content:center}.rf-place-items-center{place-items:center}.rf-items-start{align-items:flex-start}.rf-items-end{align-items:flex-end}.rf-items-center{align-items:center}.rf-items-baseline{align-items:baseline}.rf-items-stretch{align-items:stretch}.rf-justify-end{justify-content:flex-end}.rf-justify-center{justify-content:center}.rf-justify-between{justify-content:space-between}.rf-gap-0{gap:0}.rf-gap-1{gap:.25rem}.rf-gap-2{gap:.5rem}.rf-gap-3{gap:.75rem}.rf-gap-4{gap:1rem}.rf-gap-5{gap:1.25rem}.rf-gap-6{gap:1.5rem}.rf-gap-8{gap:2rem}.rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.rf-space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.25rem*var(--tw-space-y-reverse));margin-top:calc(.25rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.rf-divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.rf-overflow-auto{overflow:auto}.\\!rf-overflow-hidden{overflow:hidden!important}.rf-overflow-hidden{overflow:hidden}.rf-overflow-visible{overflow:visible}.rf-overflow-x-auto{overflow-x:auto}.\\!rf-overflow-y-auto{overflow-y:auto!important}.rf-overflow-y-auto{overflow-y:auto}.rf-overflow-x-hidden{overflow-x:hidden}.rf-overflow-x-clip{overflow-x:clip}.rf-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rf-whitespace-normal{white-space:normal}.rf-whitespace-nowrap{white-space:nowrap}.rf-whitespace-pre-wrap{white-space:pre-wrap}.rf-text-nowrap{text-wrap:nowrap}.rf-break-words{overflow-wrap:break-word}.rf-break-all{word-break:break-all}.rf-rounded{border-radius:.25rem}.rf-rounded-2xl{border-radius:1rem}.rf-rounded-full{border-radius:9999px}.rf-rounded-lg{border-radius:var(--radius)}.rf-rounded-md{border-radius:calc(var(--radius) - 2px)}.rf-rounded-sm{border-radius:calc(var(--radius) - 4px)}.rf-rounded-xl{border-radius:.75rem}.rf-border{border-width:1px}.rf-border-2{border-width:2px}.rf-border-b{border-bottom-width:1px}.rf-border-l-2{border-left-width:2px}.rf-border-l-4{border-left-width:4px}.rf-border-t{border-top-width:1px}.rf-border-none{border-style:none}.rf-border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}.rf-border-blue-300{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.rf-border-blue-400{--tw-border-opacity:1;border-color:rgb(96 165 250/var(--tw-border-opacity,1))}.rf-border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.rf-border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.rf-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.rf-border-green-200{--tw-border-opacity:1;border-color:rgb(187 247 208/var(--tw-border-opacity,1))}.rf-border-green-400{--tw-border-opacity:1;border-color:rgb(74 222 128/var(--tw-border-opacity,1))}.rf-border-input{border-color:hsl(var(--input))}.rf-border-neutral-200{--tw-border-opacity:1;border-color:rgb(229 229 229/var(--tw-border-opacity,1))}.rf-border-orange-100{--tw-border-opacity:1;border-color:rgb(255 237 213/var(--tw-border-opacity,1))}.rf-border-orange-200{--tw-border-opacity:1;border-color:rgb(254 215 170/var(--tw-border-opacity,1))}.rf-border-orange-500{--tw-border-opacity:1;border-color:rgb(249 115 22/var(--tw-border-opacity,1))}.rf-border-primary{border-color:hsl(var(--primary))}.rf-border-red-100{--tw-border-opacity:1;border-color:rgb(254 226 226/var(--tw-border-opacity,1))}.rf-border-red-200{--tw-border-opacity:1;border-color:rgb(254 202 202/var(--tw-border-opacity,1))}.rf-border-red-400{--tw-border-opacity:1;border-color:rgb(248 113 113/var(--tw-border-opacity,1))}.rf-border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.rf-border-red-600{--tw-border-opacity:1;border-color:rgb(220 38 38/var(--tw-border-opacity,1))}.rf-border-red-700{--tw-border-opacity:1;border-color:rgb(185 28 28/var(--tw-border-opacity,1))}.rf-border-red-800{--tw-border-opacity:1;border-color:rgb(153 27 27/var(--tw-border-opacity,1))}.rf-border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity,1))}.rf-border-zinc-900{--tw-border-opacity:1;border-color:rgb(24 24 27/var(--tw-border-opacity,1))}.rf-border-t-blue-600{--tw-border-opacity:1;border-top-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-bg-amber-50{--tw-bg-opacity:1;background-color:rgb(255 251 235/var(--tw-bg-opacity,1))}.rf-bg-amber-50\\/30{background-color:rgba(255,251,235,.3)}.rf-bg-background{background-color:hsl(var(--background))}.rf-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.rf-bg-black\\/80{background-color:rgba(0,0,0,.8)}.rf-bg-blue-100{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity,1))}.rf-bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.rf-bg-blue-50\\/30{background-color:rgba(239,246,255,.3)}.rf-bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.rf-bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.rf-bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.rf-bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.rf-bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity,1))}.rf-bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}.rf-bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.rf-bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.rf-bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.rf-bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.rf-bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.rf-bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity,1))}.rf-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.rf-bg-muted{background-color:hsl(var(--muted))}.rf-bg-neutral-100{--tw-bg-opacity:1;background-color:rgb(245 245 245/var(--tw-bg-opacity,1))}.rf-bg-neutral-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38/var(--tw-bg-opacity,1))}.rf-bg-neutral-900{--tw-bg-opacity:1;background-color:rgb(23 23 23/var(--tw-bg-opacity,1))}.rf-bg-orange-400{--tw-bg-opacity:1;background-color:rgb(251 146 60/var(--tw-bg-opacity,1))}.rf-bg-orange-50{--tw-bg-opacity:1;background-color:rgb(255 247 237/var(--tw-bg-opacity,1))}.rf-bg-orange-50\\/50{background-color:rgba(255,247,237,.5)}.rf-bg-orange-500{--tw-bg-opacity:1;background-color:rgb(249 115 22/var(--tw-bg-opacity,1))}.rf-bg-popover{background-color:hsl(var(--popover))}.rf-bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.rf-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.rf-bg-red-50\\/50{background-color:hsla(0,86%,97%,.5)}.rf-bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.rf-bg-red-600{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}.rf-bg-red-900{--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.rf-bg-red-950{--tw-bg-opacity:1;background-color:rgb(69 10 10/var(--tw-bg-opacity,1))}.rf-bg-slate-50{--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity,1))}.rf-bg-transparent{background-color:transparent}.rf-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.rf-bg-yellow-100{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity,1))}.rf-bg-zinc-100{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.rf-bg-zinc-200{--tw-bg-opacity:1;background-color:rgb(228 228 231/var(--tw-bg-opacity,1))}.rf-bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-zinc-800{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.rf-bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.rf-bg-zinc-950{--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.rf-bg-opacity-50{--tw-bg-opacity:0.5}.rf-fill-amber-500{fill:#f59e0b}.rf-fill-current{fill:currentColor}.rf-object-contain{-o-object-fit:contain;object-fit:contain}.rf-object-cover{-o-object-fit:cover;object-fit:cover}.\\!rf-p-0{padding:0!important}.rf-p-0{padding:0}.rf-p-1{padding:.25rem}.rf-p-2{padding:.5rem}.rf-p-3{padding:.75rem}.rf-p-4{padding:1rem}.rf-p-5{padding:1.25rem}.rf-p-6{padding:1.5rem}.rf-p-8{padding:2rem}.rf-px-1{padding-left:.25rem;padding-right:.25rem}.rf-px-2{padding-left:.5rem;padding-right:.5rem}.rf-px-3{padding-left:.75rem;padding-right:.75rem}.rf-px-4{padding-left:1rem;padding-right:1rem}.rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.rf-px-8{padding-left:2rem;padding-right:2rem}.rf-py-0{padding-bottom:0;padding-top:0}.rf-py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.rf-py-1{padding-bottom:.25rem;padding-top:.25rem}.rf-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.rf-py-10{padding-bottom:2.5rem;padding-top:2.5rem}.rf-py-12{padding-bottom:3rem;padding-top:3rem}.rf-py-2{padding-bottom:.5rem;padding-top:.5rem}.rf-py-3{padding-bottom:.75rem;padding-top:.75rem}.rf-py-4{padding-bottom:1rem;padding-top:1rem}.rf-py-6{padding-bottom:1.5rem;padding-top:1.5rem}.rf-py-8{padding-bottom:2rem;padding-top:2rem}.rf-pb-0{padding-bottom:0}.rf-pb-1{padding-bottom:.25rem}.rf-pb-2{padding-bottom:.5rem}.rf-pb-3{padding-bottom:.75rem}.rf-pb-4{padding-bottom:1rem}.rf-pb-px{padding-bottom:1px}.rf-pl-10{padding-left:2.5rem}.rf-pl-11{padding-left:2.75rem}.rf-pl-12{padding-left:3rem}.rf-pl-2{padding-left:.5rem}.rf-pl-4{padding-left:1rem}.rf-pl-8{padding-left:2rem}.rf-pr-2{padding-right:.5rem}.rf-pt-0{padding-top:0}.rf-pt-1{padding-top:.25rem}.rf-pt-2{padding-top:.5rem}.rf-pt-4{padding-top:1rem}.rf-text-left{text-align:left}.rf-text-center{text-align:center}.rf-text-right{text-align:right}.rf-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.rf-text-2xl{font-size:1.5rem;line-height:2rem}.rf-text-3xl{font-size:1.875rem;line-height:2.25rem}.rf-text-\\[8px\\]{font-size:8px}.rf-text-base{font-size:1rem;line-height:1.5rem}.rf-text-lg{font-size:1.125rem;line-height:1.75rem}.rf-text-sm{font-size:.875rem;line-height:1.25rem}.rf-text-xl{font-size:1.25rem;line-height:1.75rem}.rf-text-xs{font-size:.75rem;line-height:1rem}.\\!rf-font-normal{font-weight:400!important}.rf-font-bold{font-weight:700}.rf-font-medium{font-weight:500}.rf-font-semibold{font-weight:600}.rf-uppercase{text-transform:uppercase}.rf-capitalize{text-transform:capitalize}.rf-tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.rf-leading-5{line-height:1.25rem}.rf-leading-\\[0\\.95rem\\]{line-height:.95rem}.rf-leading-\\[1rem\\]{line-height:1rem}.rf-leading-none{line-height:1}.rf-leading-relaxed{line-height:1.625}.rf-leading-tight{line-height:1.25}.rf-tracking-wide{letter-spacing:.025em}.rf-tracking-widest{letter-spacing:.1em}.rf-text-amber-500{--tw-text-opacity:1;color:rgb(245 158 11/var(--tw-text-opacity,1))}.rf-text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.rf-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.rf-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.rf-text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.rf-text-blue-800{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.rf-text-blue-900{--tw-text-opacity:1;color:rgb(30 58 138/var(--tw-text-opacity,1))}.rf-text-current{color:currentColor}.rf-text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.rf-text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.rf-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.rf-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.rf-text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.rf-text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}.rf-text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.rf-text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.rf-text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity,1))}.rf-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.rf-text-green-800{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity,1))}.rf-text-green-900{--tw-text-opacity:1;color:rgb(20 83 45/var(--tw-text-opacity,1))}.rf-text-muted-foreground{color:hsl(var(--muted-foreground))}.rf-text-neutral-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-neutral-500{--tw-text-opacity:1;color:rgb(115 115 115/var(--tw-text-opacity,1))}.rf-text-neutral-900{--tw-text-opacity:1;color:rgb(23 23 23/var(--tw-text-opacity,1))}.rf-text-neutral-950{--tw-text-opacity:1;color:rgb(10 10 10/var(--tw-text-opacity,1))}.rf-text-orange-400{--tw-text-opacity:1;color:rgb(251 146 60/var(--tw-text-opacity,1))}.rf-text-orange-500{--tw-text-opacity:1;color:rgb(249 115 22/var(--tw-text-opacity,1))}.rf-text-orange-600{--tw-text-opacity:1;color:rgb(234 88 12/var(--tw-text-opacity,1))}.rf-text-orange-700{--tw-text-opacity:1;color:rgb(194 65 12/var(--tw-text-opacity,1))}.rf-text-orange-800{--tw-text-opacity:1;color:rgb(154 52 18/var(--tw-text-opacity,1))}.rf-text-popover-foreground{color:hsl(var(--popover-foreground))}.rf-text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.rf-text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.rf-text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.rf-text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.rf-text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.rf-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.rf-text-red-800{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity,1))}.rf-text-red-900{--tw-text-opacity:1;color:rgb(127 29 29/var(--tw-text-opacity,1))}.rf-text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity,1))}.rf-text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.rf-text-slate-600{--tw-text-opacity:1;color:rgb(71 85 105/var(--tw-text-opacity,1))}.rf-text-slate-800{--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity,1))}.rf-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.rf-text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}.rf-text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity,1))}.rf-text-yellow-600{--tw-text-opacity:1;color:rgb(202 138 4/var(--tw-text-opacity,1))}.rf-text-yellow-900{--tw-text-opacity:1;color:rgb(113 63 18/var(--tw-text-opacity,1))}.rf-text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.rf-text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.rf-text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.rf-text-zinc-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.rf-text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.rf-text-zinc-950{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.rf-underline{text-decoration-line:underline}.rf-line-through{text-decoration-line:line-through}.rf-underline-offset-4{text-underline-offset:4px}.rf-opacity-0{opacity:0}.rf-opacity-100{opacity:1}.rf-opacity-25{opacity:.25}.rf-opacity-30{opacity:.3}.rf-opacity-50{opacity:.5}.rf-opacity-60{opacity:.6}.rf-opacity-70{opacity:.7}.rf-opacity-75{opacity:.75}.rf-shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.rf-shadow,.rf-shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.rf-shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.rf-shadow-md,.rf-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.rf-outline-none{outline:2px solid transparent;outline-offset:2px}.rf-ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.rf-ring-blue-500{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.rf-ring-primary{--tw-ring-color:hsl(var(--primary))}.rf-ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.rf-ring-offset-white{--tw-ring-offset-color:#fff}.rf-transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-duration-150{transition-duration:.15s}.rf-duration-200{transition-duration:.2s}.rf-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.rf-slide-in-from-left-1{--tw-enter-translate-x:-0.25rem}.rf-slide-out-to-left-1{--tw-exit-translate-x:-0.25rem}.rf-duration-150{animation-duration:.15s}.rf-duration-200{animation-duration:.2s}.rf-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}.file\\:rf-border-0::file-selector-button{border-width:0}.file\\:rf-bg-transparent::file-selector-button{background-color:transparent}.file\\:rf-text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\\:rf-font-medium::file-selector-button{font-weight:500}.placeholder\\:rf-text-zinc-500::-moz-placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.placeholder\\:rf-text-zinc-500::placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.hover\\:rf-border-blue-300:hover{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.hover\\:\\!rf-bg-transparent:hover{background-color:transparent!important}.hover\\:rf-bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\\:rf-bg-orange-100:hover{--tw-bg-opacity:1;background-color:rgb(255 237 213/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-100:hover{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-500\\/90:hover{background-color:rgba(239,68,68,.9)}.hover\\:rf-bg-slate-200:hover{--tw-bg-opacity:1;background-color:rgb(226 232 240/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100:hover{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100\\/80:hover{background-color:hsla(240,5%,96%,.8)}.hover\\:rf-bg-zinc-900\\/90:hover{background-color:rgba(24,24,27,.9)}.hover\\:rf-text-blue-800:hover{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.hover\\:rf-text-gray-700:hover{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.hover\\:rf-text-red-400:hover{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.hover\\:rf-text-slate-800:hover{--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity,1))}.hover\\:rf-text-slate-900:hover{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity,1))}.hover\\:rf-text-zinc-900:hover{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.hover\\:rf-underline:hover{text-decoration-line:underline}.focus\\:rf-bg-gray-100:focus{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.focus\\:rf-bg-zinc-100:focus{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.focus\\:rf-text-gray-900:focus{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.focus\\:rf-text-zinc-900:focus{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.focus\\:rf-outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:rf-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:rf-ring-blue-500:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.focus\\:rf-ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\\:rf-ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:rf-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:rf-ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-zinc-950:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(9 9 11/var(--tw-ring-opacity,1))}.focus-visible\\:rf-ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.disabled\\:rf-pointer-events-none:disabled{pointer-events:none}.disabled\\:rf-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:rf-opacity-50:disabled{opacity:.5}.rf-group:hover .group-hover\\:rf-opacity-100,.rf-group\\/bar:hover .group-hover\\/bar\\:rf-opacity-100{opacity:1}.rf-peer:disabled~.peer-disabled\\:rf-cursor-not-allowed{cursor:not-allowed}.rf-peer:disabled~.peer-disabled\\:rf-opacity-70{opacity:.7}.data-\\[disabled\\=true\\]\\:rf-pointer-events-none[data-disabled=true],.data-\\[disabled\\]\\:rf-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom]{--tw-translate-y:0.25rem}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom],.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{--tw-translate-x:-0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right]{--tw-translate-x:0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right],.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{--tw-translate-y:-0.25rem}.data-\\[selected\\=true\\]\\:rf-bg-zinc-100[data-selected=true]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[state\\=active\\]\\:rf-bg-white[data-state=active]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.data-\\[state\\=checked\\]\\:rf-bg-zinc-900[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.data-\\[state\\=open\\]\\:rf-bg-zinc-100[data-state=open]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[selected\\=true\\]\\:rf-text-zinc-900[data-selected=true]{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.data-\\[state\\=active\\]\\:rf-text-zinc-950[data-state=active]{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.data-\\[state\\=checked\\]\\:rf-text-zinc-50[data-state=checked]{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.data-\\[disabled\\=true\\]\\:rf-opacity-50[data-disabled=true],.data-\\[disabled\\]\\:rf-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=active\\]\\:rf-shadow[data-state=active]{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.data-\\[state\\=open\\]\\:rf-animate-in[data-state=open]{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-animate-out[data-state=closed]{animation-duration:.15s;animation-name:exit;--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:rf-fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:rf-zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:rf-zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:rf-slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:rf-slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:rf-slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:rf-slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.data-\\[state\\=closed\\]\\:rf-slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:rf-slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:rf-slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:rf-slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y:-48%}.dark\\:rf-border-zinc-50:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(250 250 250/var(--tw-border-opacity,1))}.dark\\:rf-border-zinc-800:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.dark\\:rf-bg-gray-700:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.dark\\:rf-bg-gray-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.dark\\:rf-bg-red-900:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-50:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-950:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:rf-text-gray-500:is(.rf-dark *){--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-400:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-50:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-900:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-ring-offset-zinc-950:is(.rf-dark *){--tw-ring-offset-color:#09090b}.dark\\:placeholder\\:rf-text-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:placeholder\\:rf-text-zinc-400:is(.rf-dark *)::placeholder{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:hover\\:rf-bg-red-900\\/90:hover:is(.rf-dark *){background-color:rgba(127,29,29,.9)}.dark\\:hover\\:rf-bg-zinc-50\\/90:hover:is(.rf-dark *){background-color:hsla(0,0%,98%,.9)}.dark\\:hover\\:rf-bg-zinc-800:hover:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:hover\\:rf-bg-zinc-800\\/80:hover:is(.rf-dark *){background-color:rgba(39,39,42,.8)}.dark\\:hover\\:rf-text-zinc-50:hover:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus\\:rf-bg-zinc-800:focus:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:focus\\:rf-text-zinc-50:focus:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus-visible\\:rf-ring-zinc-300:focus-visible:is(.rf-dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(212 212 216/var(--tw-ring-opacity,1))}.dark\\:data-\\[selected\\=true\\]\\:rf-bg-zinc-800[data-selected=true]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-bg-zinc-950[data-state=active]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-bg-zinc-50[data-state=checked]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=open\\]\\:rf-bg-zinc-800[data-state=open]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[selected\\=true\\]\\:rf-text-zinc-50[data-selected=true]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-text-zinc-50[data-state=active]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-text-zinc-900[data-state=checked]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}@media (min-width:640px){.sm\\:rf-order-1{order:1}.sm\\:rf-order-2{order:2}.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-mt-4{margin-top:1rem}.sm\\:rf-block{display:block}.sm\\:rf-inline{display:inline}.sm\\:rf-grid{display:grid}.sm\\:rf-hidden{display:none}.sm\\:rf-h-5{height:1.25rem}.sm\\:rf-w-1\\/2{width:50%}.sm\\:rf-w-5{width:1.25rem}.sm\\:rf-w-\\[90vw\\]{width:90vw}.sm\\:rf-w-auto{width:auto}.sm\\:rf-max-w-\\[500px\\]{max-width:500px}.sm\\:rf-max-w-md{max-width:28rem}.sm\\:rf-grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\\:rf-grid-cols-\\[1fr_auto\\]{grid-template-columns:1fr auto}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-items-center{align-items:center}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-gap-3{gap:.75rem}.sm\\:rf-gap-4{gap:1rem}.sm\\:rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.sm\\:rf-justify-self-end{justify-self:end}.sm\\:rf-rounded-lg{border-radius:var(--radius)}.sm\\:rf-p-3{padding:.75rem}.sm\\:rf-p-6{padding:1.5rem}.sm\\:rf-px-4{padding-left:1rem;padding-right:1rem}.sm\\:rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\\:rf-py-6{padding-bottom:1.5rem;padding-top:1.5rem}.sm\\:rf-text-left{text-align:left}.sm\\:rf-text-right{text-align:right}.sm\\:rf-text-2xl{font-size:1.5rem;line-height:2rem}.sm\\:rf-text-base{font-size:1rem;line-height:1.5rem}.sm\\:rf-text-sm{font-size:.875rem;line-height:1.25rem}.sm\\:rf-text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width:768px){.md\\:rf-w-auto{width:auto}.md\\:rf-max-w-\\[660px\\]{max-width:660px}.md\\:rf-max-w-lg{max-width:32rem}.md\\:rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\\:rf-p-8{padding:2rem}.md\\:rf-py-8{padding-bottom:2rem;padding-top:2rem}.md\\:rf-text-3xl{font-size:1.875rem;line-height:2.25rem}}@media (min-width:1024px){.lg\\:rf-max-w-\\[720px\\]{max-width:720px}.lg\\:rf-max-w-xl{max-width:36rem}}@media (min-width:1280px){.xl\\:rf-max-w-\\[800px\\]{max-width:800px}}.\\[\\&\\>span\\]\\:rf-line-clamp-1>span{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\\[\\&\\>svg\\]\\:rf-size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:rf-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:rf-text-red-300>svg{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.\\[\\&\\>svg\\]\\:hover\\:rf-text-red-400:hover>svg{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-py-1\\.5 [cmdk-group-heading]{padding-bottom:.375rem;padding-top:.375rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-font-medium [cmdk-group-heading]{font-weight:500}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-zinc-500 [cmdk-group-heading]{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.dark\\:\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-zinc-400 [cmdk-group-heading]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.\\[\\&_\\[cmdk-group\\]\\:not\\(\\[hidden\\]\\)_\\~\\[cmdk-group\\]\\]\\:rf-pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\\[\\&_\\[cmdk-group\\]\\]\\:rf-px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-input-wrapper\\]_svg\\]\\:rf-h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\\[\\&_\\[cmdk-input-wrapper\\]_svg\\]\\:rf-w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\\[\\&_\\[cmdk-input\\]\\]\\:rf-h-12 [cmdk-input]{height:3rem}.\\[\\&_\\[cmdk-item\\]\\]\\:rf-px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-item\\]\\]\\:rf-py-3 [cmdk-item]{padding-bottom:.75rem;padding-top:.75rem}.\\[\\&_\\[cmdk-item\\]_svg\\]\\:rf-h-5 [cmdk-item] svg{height:1.25rem}.\\[\\&_\\[cmdk-item\\]_svg\\]\\:rf-w-5 [cmdk-item] svg{width:1.25rem}.\\[\\&_svg\\]\\:rf-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:rf-size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:rf-shrink-0 svg{flex-shrink:0}',k5=()=>{$.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const A=document.createElement("style");A.setAttribute("data-styles","tscircuit-runframe"),A.textContent=GMt,document.head.appendChild(A)},[])},xMt=t=>{$.useEffect(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t])};function ON(t,A){const[e,i]=$.useState(()=>{try{const n=window.localStorage.getItem(t);return n?JSON.parse(n):A}catch(n){return console.error("Error reading from localStorage:",n),A}});return $.useEffect(()=>{try{window.localStorage.setItem(t,JSON.stringify(e))}catch(n){console.error("Error writing to localStorage:",n)}},[t,e]),[e,i]}const ste=t=>`hsl(${Dp.indexOf(t)*137.5%360}, 70%, 50%)`,FMt=({phaseTimings:t})=>{if(!t)return null;const A=Object.values(t).reduce((e,i)=>e+i,0);return Z.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[Z.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:Dp.map(e=>{const i=t[e]||0,n=i/A*100;return Z.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${n}%`,backgroundColor:ste(e)},children:Z.jsxs("div",{className:"rf-opacity-0 group-hover/bar:rf-opacity-100 rf-transition-opacity rf-absolute rf-bottom-full rf-left-1/2 rf-transform -rf-translate-x-1/2 rf-mb-2 rf-px-2 rf-py-1 rf-text-xs rf-whitespace-nowrap rf-rounded rf-bg-gray-900 rf-text-white rf-pointer-events-none",children:[e,": ",i.toFixed(1),"ms"]})},e)})}),Z.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",A.toFixed(2),"ms"]})]})},_Mt=t=>{if(t instanceof Blob)return t;if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{return String(t)}return String(t)},RMt=({renderLog:t,onRerunWithDebug:A})=>{const[e,i]=$.useState("chronological"),[n,o]=$.useState(""),s=[{value:"",label:"None"},{value:"DEBUG=Group_doInitialSchematicTraceRender",label:"DEBUG=Group_doInitialSchematicTraceRender"},{value:"DEBUG=Group_doInitialSchematicLayoutMatchpack",label:"DEBUG=Group_doInitialSchematicLayoutMatchpack"},{value:"DEBUG=Group_doInitialPcbLayoutPack",label:"DEBUG=Group_doInitialPcbLayoutPack"}];if(!t)return Z.jsxs("div",{className:"rf-p-4 rf-bg-gray-100 rf-rounded-md",children:[Z.jsx("div",{className:"rf-mb-4",children:"No render log, make sure this tab is open when you render"}),A&&Z.jsxs("div",{className:"rf-flex rf-gap-2 rf-items-center",children:[Z.jsx("select",{value:n,onChange:a=>o(a.target.value),className:"rf-px-3 rf-py-1 rf-border rf-rounded rf-text-xs rf-bg-white",children:s.map(a=>Z.jsx("option",{value:a.value,children:a.label},a.value))}),Z.jsx(Ng,{onClick:()=>A(n),size:"sm",className:"rf-text-xs",children:"Rerun Render with Debug"})]})]});const r=Object.entries(t?.phaseTimings??{});e==="chronological"?r.sort((a,I)=>Dp.indexOf(a[0])-Dp.indexOf(I[0])):r.sort((a,I)=>I[1]-a[1]);const g=r.reduce((a,[I,c])=>a+c,0);return Z.jsxs("div",{className:"rf-bg-white",children:[Z.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center rf-mb-4",children:[Z.jsx("div",{children:"Render Logs"}),Z.jsxs("div",{className:"rf-flex rf-gap-4 rf-items-center",children:[A&&Z.jsxs("div",{className:"rf-flex rf-gap-2 rf-items-center",children:[Z.jsx("select",{value:n,onChange:a=>o(a.target.value),className:"rf-px-3 rf-py-1 rf-border rf-rounded rf-text-xs rf-bg-white",children:s.map(a=>Z.jsx("option",{value:a.value,children:a.label},a.value))}),Z.jsx(Ng,{onClick:()=>A(n),size:"sm",className:"rf-text-xs",children:"Rerun Render with Debug"})]}),Z.jsx("div",{className:"rf-flex rf-gap-2 rf-items-center",children:Z.jsxs("select",{onChange:a=>{if(a.target.value){const I=t?.debugOutputs?.find(c=>c.name===a.target.value);if(I){const c=_Mt(I.content),B=c instanceof Blob?c:new Blob([c],{type:"text/plain"}),C=URL.createObjectURL(B),Q=document.createElement("a");Q.href=C,Q.download=`debug-${I.name}.txt`,document.body.appendChild(Q),Q.click(),document.body.removeChild(Q),URL.revokeObjectURL(C)}a.target.value=""}},disabled:!t?.debugOutputs||t.debugOutputs.length===0,className:"rf-px-3 rf-py-1 rf-border rf-rounded rf-text-xs rf-bg-white disabled:rf-opacity-50 disabled:rf-cursor-not-allowed",children:[Z.jsx("option",{value:"",children:"Download Debug Output"}),t?.debugOutputs?.map(a=>Z.jsx("option",{value:a.name,children:a.name},a.name))]})}),Z.jsxs("div",{className:"rf-flex rf-text-xs rf-items-center",children:[Z.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),Z.jsxs("select",{value:e,onChange:a=>i(a.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[Z.jsx("option",{value:"chronological",children:"Phase Order"}),Z.jsx("option",{value:"longest",children:"Duration"})]})]})]})]}),Z.jsx(FMt,{phaseTimings:t.phaseTimings}),Z.jsxs("table",{className:"rf-w-full rf-text-xs",children:[Z.jsx("thead",{children:Z.jsxs("tr",{children:[Z.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),Z.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),Z.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),Z.jsx("tbody",{children:r.map(([a,I])=>Z.jsxs("tr",{children:[Z.jsx("td",{className:"rf-p-2",children:Dp.indexOf(a)}),Z.jsx("td",{className:"rf-p-2",children:a}),Z.jsx("td",{className:"rf-p-2",children:Z.jsx("div",{className:"rf-w-8",children:Z.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:ste(a),width:`${I/g*100}%`}})})}),Z.jsx("td",{className:"rf-p-2",children:Z.jsxs("div",{className:"rf-flex w-full",children:[Z.jsxs("span",{className:"rf-flex-grow",children:[I,"ms"]}),Z.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(I/g*100).toFixed(1),"%"]})]})})]},a))})]})]})},rte=({errorMessage:t,errorStack:A,circuitJsonErrors:e})=>{$.useEffect(()=>{if(t){const i=new Error(t);A&&(i.stack=A);try{Z4.captureException(i)}catch{}}},[t,A]),$.useEffect(()=>{if(e&&e.length>0)for(const i of e){const n=new Error(i.message||"Circuit JSON Error");i.stack&&(n.stack=i.stack);try{Z4.captureException(n,{error_type:i.type})}catch{}}},[e])},gte="0.0.1393",NMt={version:gte},G5=ZNA()(VNA(t=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:A=>{t({lastRunEvalVersion:A})}}),{name:"runframe-runner-store"})),MMt=t=>{const[A,e]=$.useState([]),[i,n]=$.useState(null),[o,s]=$.useState(""),[r,g]=ON("eval-version-selection",null),a=G5(C=>C.setLastRunEvalVersion),I=G5(C=>C.lastRunEvalVersion);return $.useEffect(()=>{t&&fetch("https://data.jsdelivr.com/v1/package/npm/@tscircuit/eval").then(C=>C.json()).then(C=>{if(Array.isArray(C?.versions)){let Q=[...C.versions];C.tags?.latest&&(n(C.tags.latest),Q=Q.filter(l=>l!==C.tags.latest)),e(Q)}}).catch(()=>{})},[t]),$.useEffect(()=>{t&&(r?(window.TSCIRCUIT_LATEST_EVAL_VERSION=r,a(r)):i&&(window.TSCIRCUIT_LATEST_EVAL_VERSION=i,a(i)))},[t,r,i]),{versions:$.useMemo(()=>A.filter(C=>C.includes(o)).slice(0,50),[A,o]),latestVersion:i,lastRunEvalVersion:I,search:o,setSearch:s,selectVersion:C=>{g(C),s("")}}},vMt=({snippetNames:t,onSelect:A,onCancel:e,isOpen:i})=>{const[n,o]=$.useState(""),[s,r]=$.useState("");if(!i)return null;const g=t.filter(c=>c.toLowerCase().includes(s.toLowerCase())),a=s&&!t.includes(s),I=c=>{c.key==="Enter"&&(g.length===1?o(g[0]):a&&o(s))};return Z.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:Z.jsxs("div",{className:"rf-bg-white rf-rounded-lg rf-p-6 rf-w-96",children:[Z.jsx("h2",{className:"rf-text-lg rf-font-semibold rf-mb-4",children:"Select Snippet"}),Z.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}),Z.jsxs("div",{className:"rf-h-60 rf-overflow-y-auto",children:[g.map(c=>Z.jsx("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 ${n===c?"bg-blue-50":""}`,onClick:()=>o(c),children:c},c)),a&&Z.jsxs("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 text-blue-500 ${n===s?"bg-blue-50":""}`,onClick:()=>o(s),children:['Create new "',s,'"']})]}),Z.jsxs("div",{className:"rf-mt-4 rf-flex rf-justify-end rf-gap-2",children:[Z.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-text-gray-600 rf-hover:text-gray-800",onClick:e,children:"Cancel"}),Z.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:()=>n&&A(n),disabled:!n,children:n===s?`Create "${n}"`:`Save to ${n}`})]})]})})},UMt=t=>{const A=$.useRef(null),e=Fc(i=>i.recentEvents);$.useEffect(()=>{if(e.length===0)return;const i=e[0];i.event_id!==A.current&&(t(i),A.current=i.event_id)},[e,t])};var x5="Dialog",[ate,Ite]=jw(x5),[LMt,Qw]=ate(x5),cte=t=>{const{__scopeDialog:A,children:e,open:i,defaultOpen:n,onOpenChange:o,modal:s=!0}=t,r=$.useRef(null),g=$.useRef(null),[a,I]=SG({prop:i,defaultProp:n??!1,onChange:o,caller:x5});return Z.jsx(LMt,{scope:A,triggerRef:r,contentRef:g,contentId:su(),titleId:su(),descriptionId:su(),open:a,onOpenChange:I,onOpenToggle:$.useCallback(()=>I(c=>!c),[I]),modal:s,children:e})};cte.displayName=x5;var Bte="DialogTrigger",Cte=$.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,n=Qw(Bte,e),o=CB(A,n.triggerRef);return Z.jsx(gr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":AEA(n.open),...i,ref:o,onClick:ao(t.onClick,n.onOpenToggle)})});Cte.displayName=Bte;var XlA="DialogPortal",[HMt,Qte]=ate(XlA,{forceMount:void 0}),lte=t=>{const{__scopeDialog:A,forceMount:e,children:i,container:n}=t,o=Qw(XlA,A);return Z.jsx(HMt,{scope:A,forceMount:e,children:$.Children.map(i,s=>Z.jsx(q0,{present:e||o.open,children:Z.jsx(A8,{asChild:!0,container:n,children:s})}))})};lte.displayName=XlA;var F5="DialogOverlay",Ete=$.forwardRef((t,A)=>{const e=Qte(F5,t.__scopeDialog),{forceMount:i=e.forceMount,...n}=t,o=Qw(F5,t.__scopeDialog);return o.modal?Z.jsx(q0,{present:i||o.open,children:Z.jsx(JMt,{...n,ref:A})}):null});Ete.displayName=F5;var YMt=mG("DialogOverlay.RemoveScroll"),JMt=$.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,n=Qw(F5,e);return Z.jsx(g8,{as:YMt,allowPinchZoom:!0,shards:[n.contentRef],children:Z.jsx(gr.div,{"data-state":AEA(n.open),...i,ref:A,style:{pointerEvents:"auto",...i.style}})})}),Nx="DialogContent",hte=$.forwardRef((t,A)=>{const e=Qte(Nx,t.__scopeDialog),{forceMount:i=e.forceMount,...n}=t,o=Qw(Nx,t.__scopeDialog);return Z.jsx(q0,{present:i||o.open,children:o.modal?Z.jsx(KMt,{...n,ref:A}):Z.jsx(TMt,{...n,ref:A})})});hte.displayName=Nx;var KMt=$.forwardRef((t,A)=>{const e=Qw(Nx,t.__scopeDialog),i=$.useRef(null),n=CB(A,e.contentRef,i);return $.useEffect(()=>{const o=i.current;if(o)return qCA(o)},[]),Z.jsx(ute,{...t,ref:n,trapFocus:e.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ao(t.onCloseAutoFocus,o=>{o.preventDefault(),e.triggerRef.current?.focus()}),onPointerDownOutside:ao(t.onPointerDownOutside,o=>{const s=o.detail.originalEvent,r=s.button===0&&s.ctrlKey===!0;(s.button===2||r)&&o.preventDefault()}),onFocusOutside:ao(t.onFocusOutside,o=>o.preventDefault())})}),TMt=$.forwardRef((t,A)=>{const e=Qw(Nx,t.__scopeDialog),i=$.useRef(!1),n=$.useRef(!1);return Z.jsx(ute,{...t,ref:A,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{t.onCloseAutoFocus?.(o),o.defaultPrevented||(i.current||e.triggerRef.current?.focus(),o.preventDefault()),i.current=!1,n.current=!1},onInteractOutside:o=>{t.onInteractOutside?.(o),o.defaultPrevented||(i.current=!0,o.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const s=o.target;e.triggerRef.current?.contains(s)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&n.current&&o.preventDefault()}})}),ute=$.forwardRef((t,A)=>{const{__scopeDialog:e,trapFocus:i,onOpenAutoFocus:n,onCloseAutoFocus:o,...s}=t,r=Qw(Nx,e),g=$.useRef(null),a=CB(A,g);return mCA(),Z.jsxs(Z.Fragment,{children:[Z.jsx(KO,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:n,onUnmountAutoFocus:o,children:Z.jsx(JO,{role:"dialog",id:r.contentId,"aria-describedby":r.descriptionId,"aria-labelledby":r.titleId,"data-state":AEA(r.open),...s,ref:a,onDismiss:()=>r.onOpenChange(!1)})}),Z.jsxs(Z.Fragment,{children:[Z.jsx(PMt,{titleId:r.titleId}),Z.jsx(WMt,{contentRef:g,descriptionId:r.descriptionId})]})]})}),$lA="DialogTitle",dte=$.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,n=Qw($lA,e);return Z.jsx(gr.h2,{id:n.titleId,...i,ref:A})});dte.displayName=$lA;var pte="DialogDescription",fte=$.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,n=Qw(pte,e);return Z.jsx(gr.p,{id:n.descriptionId,...i,ref:A})});fte.displayName=pte;var yte="DialogClose",wte=$.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,n=Qw(yte,e);return Z.jsx(gr.button,{type:"button",...i,ref:A,onClick:ao(t.onClick,()=>n.onOpenChange(!1))})});wte.displayName=yte;function AEA(t){return t?"open":"closed"}var Dte="DialogTitleWarning",[qMt,mte]=VTe(Dte,{contentName:Nx,titleName:$lA,docsSlug:"dialog"}),PMt=({titleId:t})=>{const A=mte(Dte),e=`\`${A.contentName}\` requires a \`${A.titleName}\` for the component to be accessible for screen reader users.
5887
+ */const kMt=({containerClassName:t,...A})=>{const e=$.useRef(null),[i,n]=$.useState(620);return $.useLayoutEffect(()=>{const o=()=>{if(e.current){const r=e.current.clientHeight,g=window.innerHeight;n(Math.min(Math.max(r,620),g))}};o();const s=new ResizeObserver(o);return e.current&&s.observe(e.current),window.addEventListener("resize",o),()=>{s.disconnect(),window.removeEventListener("resize",o)}},[]),Z.jsx("div",{ref:e,className:t||"rf-w-full rf-h-full",children:Z.jsx(bMt,{...A,height:i})})},GMt='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.18 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--radius:0.5rem}.rf-pointer-events-none{pointer-events:none}.rf-invisible{visibility:hidden}.rf-fixed{position:fixed}.rf-absolute{position:absolute}.rf-relative{position:relative}.rf-inset-0{inset:0}.-rf-left-2{left:-.5rem}.-rf-right-10{right:-2.5rem}.-rf-right-2{right:-.5rem}.-rf-right-4{right:-1rem}.-rf-right-6{right:-1.5rem}.-rf-right-7{right:-1.75rem}.-rf-right-8{right:-2rem}.-rf-right-9{right:-2.25rem}.rf-bottom-full{bottom:100%}.rf-left-0{left:0}.rf-left-1{left:.25rem}.rf-left-1\\/2{left:50%}.rf-left-2{left:.5rem}.rf-left-\\[50\\%\\]{left:50%}.rf-right-0{right:0}.rf-right-1{right:.25rem}.rf-right-4{right:1rem}.rf-right-\\[4px\\]{right:4px}.rf-top-0{top:0}.rf-top-1{top:.25rem}.rf-top-2{top:.5rem}.rf-top-2\\.5{top:.625rem}.rf-top-\\[50\\%\\]{top:50%}.rf-top-\\[6px\\]{top:6px}.\\!rf-z-\\[101\\]{z-index:101!important}.\\!rf-z-\\[200\\]{z-index:200!important}.rf-z-10{z-index:10}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.rf-z-\\[101\\]{z-index:101}.rf-order-1{order:1}.rf-order-2{order:2}.rf-order-3{order:3}.rf-m-1{margin:.25rem}.rf-m-6{margin:1.5rem}.-rf-mx-1,.rf--mx-1{margin-left:-.25rem;margin-right:-.25rem}.rf-mx-1{margin-left:.25rem;margin-right:.25rem}.rf-mx-2{margin-left:.5rem;margin-right:.5rem}.rf-mx-4{margin-left:1rem;margin-right:1rem}.rf-mx-auto{margin-left:auto;margin-right:auto}.rf-my-1{margin-bottom:.25rem;margin-top:.25rem}.rf-my-12{margin-bottom:3rem;margin-top:3rem}.rf-my-4{margin-bottom:1rem;margin-top:1rem}.rf-my-auto{margin-bottom:auto;margin-top:auto}.rf-mb-0{margin-bottom:0}.rf-mb-0\\.5{margin-bottom:.125rem}.rf-mb-1{margin-bottom:.25rem}.rf-mb-12{margin-bottom:3rem}.rf-mb-2{margin-bottom:.5rem}.rf-mb-3{margin-bottom:.75rem}.rf-mb-4{margin-bottom:1rem}.rf-mb-6{margin-bottom:1.5rem}.rf-mb-8{margin-bottom:2rem}.rf-ml-1{margin-left:.25rem}.rf-ml-2{margin-left:.5rem}.rf-ml-6{margin-left:1.5rem}.rf-ml-auto{margin-left:auto}.rf-mr-1{margin-right:.25rem}.rf-mr-2{margin-right:.5rem}.rf-mr-4{margin-right:1rem}.rf-mt-0{margin-top:0}.rf-mt-0\\.5{margin-top:.125rem}.rf-mt-1{margin-top:.25rem}.rf-mt-2{margin-top:.5rem}.rf-mt-3{margin-top:.75rem}.rf-mt-4{margin-top:1rem}.rf-mt-5{margin-top:1.25rem}.rf-mt-auto{margin-top:auto}.rf-block{display:block}.rf-inline-block{display:inline-block}.rf-inline{display:inline}.rf-flex{display:flex}.rf-inline-flex{display:inline-flex}.rf-grid{display:grid}.rf-hidden{display:none}.rf-aspect-square{aspect-ratio:1/1}.rf-aspect-video{aspect-ratio:16/9}.rf-size-14{height:3.5rem;width:3.5rem}.rf-size-4{height:1rem;width:1rem}.\\!rf-h-2{height:.5rem!important}.\\!rf-h-2\\.5{height:.625rem!important}.\\!rf-h-3{height:.75rem!important}.\\!rf-h-full{height:100%!important}.rf-h-1{height:.25rem}.rf-h-10{height:2.5rem}.rf-h-12{height:3rem}.rf-h-2{height:.5rem}.rf-h-2\\.5{height:.625rem}.rf-h-20{height:5rem}.rf-h-24{height:6rem}.rf-h-3{height:.75rem}.rf-h-3\\.5{height:.875rem}.rf-h-4{height:1rem}.rf-h-5{height:1.25rem}.rf-h-6{height:1.5rem}.rf-h-60{height:15rem}.rf-h-64{height:16rem}.rf-h-7{height:1.75rem}.rf-h-8{height:2rem}.rf-h-9{height:2.25rem}.rf-h-\\[400px\\]{height:400px}.rf-h-\\[calc\\(100vh-52px\\)\\]{height:calc(100vh - 52px)}.rf-h-\\[calc\\(100vh-60px\\)\\]{height:calc(100vh - 60px)}.rf-h-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.rf-h-auto{height:auto}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.rf-h-screen{height:100vh}.\\!rf-max-h-\\[40vh\\]{max-height:40vh!important}.rf-max-h-16{max-height:4rem}.rf-max-h-20{max-height:5rem}.rf-max-h-24{max-height:6rem}.rf-max-h-28{max-height:7rem}.rf-max-h-32{max-height:8rem}.rf-max-h-96{max-height:24rem}.rf-max-h-\\[120px\\]{max-height:120px}.rf-max-h-\\[150px\\]{max-height:150px}.rf-max-h-\\[200px\\]{max-height:200px}.rf-max-h-\\[300px\\]{max-height:300px}.rf-max-h-\\[70vh\\]{max-height:70vh}.rf-max-h-\\[90vh\\]{max-height:90vh}.rf-max-h-full{max-height:100%}.rf-min-h-0{min-height:0}.rf-min-h-\\[100px\\]{min-height:100px}.rf-min-h-\\[200px\\]{min-height:200px}.rf-min-h-\\[300px\\]{min-height:300px}.rf-min-h-\\[620px\\]{min-height:620px}.rf-min-h-\\[calc\\(100vh-240px\\)\\]{min-height:calc(100vh - 240px)}.rf-min-h-full{min-height:100%}.\\!rf-w-2{width:.5rem!important}.\\!rf-w-2\\.5{width:.625rem!important}.\\!rf-w-\\[95vw\\]{width:95vw!important}.rf-w-1{width:.25rem}.rf-w-10{width:2.5rem}.rf-w-11{width:2.75rem}.rf-w-11\\/12{width:91.666667%}.rf-w-12{width:3rem}.rf-w-16{width:4rem}.rf-w-2{width:.5rem}.rf-w-2\\.5{width:.625rem}.rf-w-20{width:5rem}.rf-w-24{width:6rem}.rf-w-28{width:7rem}.rf-w-3{width:.75rem}.rf-w-3\\.5{width:.875rem}.rf-w-32{width:8rem}.rf-w-4{width:1rem}.rf-w-40{width:10rem}.rf-w-48{width:12rem}.rf-w-5{width:1.25rem}.rf-w-6{width:1.5rem}.rf-w-64{width:16rem}.rf-w-72{width:18rem}.rf-w-8{width:2rem}.rf-w-80{width:20rem}.rf-w-9{width:2.25rem}.rf-w-96{width:24rem}.rf-w-fit{width:-moz-fit-content;width:fit-content}.rf-w-full{width:100%}.rf-w-screen{width:100vw}.rf-min-w-0{min-width:0}.rf-min-w-10{min-width:2.5rem}.rf-min-w-16{min-width:4rem}.rf-min-w-32{min-width:8rem}.rf-min-w-80{min-width:20rem}.rf-min-w-96{min-width:24rem}.rf-min-w-\\[148px\\]{min-width:148px}.rf-min-w-\\[600px\\]{min-width:600px}.rf-min-w-\\[8rem\\]{min-width:8rem}.rf-min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.\\!rf-max-w-\\[95vw\\]{max-width:95vw!important}.rf-max-w-2xl{max-width:42rem}.rf-max-w-3xl{max-width:48rem}.rf-max-w-4xl{max-width:56rem}.rf-max-w-5xl{max-width:64rem}.rf-max-w-64{max-width:16rem}.rf-max-w-96{max-width:24rem}.rf-max-w-\\[1000px\\]{max-width:1000px}.rf-max-w-\\[150px\\]{max-width:150px}.rf-max-w-\\[200px\\]{max-width:200px}.rf-max-w-\\[40\\%\\]{max-width:40%}.rf-max-w-\\[600px\\]{max-width:600px}.rf-max-w-full{max-width:100%}.rf-max-w-lg{max-width:32rem}.rf-max-w-md{max-width:28rem}.rf-max-w-none{max-width:none}.rf-max-w-xl{max-width:36rem}.rf-max-w-xs{max-width:20rem}.rf-flex-1{flex:1 1 0%}.rf-flex-shrink-0,.rf-shrink-0{flex-shrink:0}.rf-flex-grow{flex-grow:1}.rf-table-auto{table-layout:auto}.rf-origin-\\[--radix-popover-content-transform-origin\\]{transform-origin:var(--radix-popover-content-transform-origin)}.-rf-translate-x-1{--tw-translate-x:-0.25rem}.-rf-translate-x-1,.-rf-translate-x-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rf-translate-x-1\\/2{--tw-translate-x:-50%}.-rf-translate-y-1{--tw-translate-y:-0.25rem}.-rf-translate-y-1,.rf--translate-x-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-x-1{--tw-translate-x:-0.25rem}.rf--translate-x-1\\/2{--tw-translate-x:-50%}.rf--translate-x-1\\/2,.rf--translate-y-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-y-1{--tw-translate-y:-0.25rem}.rf-translate-x-\\[-50\\%\\]{--tw-translate-x:-50%}.rf-translate-x-\\[-50\\%\\],.rf-translate-y-\\[-50\\%\\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf-translate-y-\\[-50\\%\\]{--tw-translate-y:-50%}.rf-rotate-90{--tw-rotate:90deg}.rf-rotate-90,.rf-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes rf-pulse{50%{opacity:.5}}.rf-animate-pulse{animation:rf-pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes rf-spin{to{transform:rotate(1turn)}}.rf-animate-spin{animation:rf-spin 1s linear infinite}.rf-cursor-default{cursor:default}.rf-cursor-not-allowed{cursor:not-allowed}.rf-cursor-pointer{cursor:pointer}.rf-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.rf-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.rf-grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.rf-flex-row{flex-direction:row}.rf-flex-col{flex-direction:column}.rf-flex-col-reverse{flex-direction:column-reverse}.rf-flex-wrap{flex-wrap:wrap}.rf-place-content-center{place-content:center}.rf-place-items-center{place-items:center}.rf-items-start{align-items:flex-start}.rf-items-end{align-items:flex-end}.rf-items-center{align-items:center}.rf-items-baseline{align-items:baseline}.rf-items-stretch{align-items:stretch}.rf-justify-end{justify-content:flex-end}.rf-justify-center{justify-content:center}.rf-justify-between{justify-content:space-between}.rf-gap-0{gap:0}.rf-gap-1{gap:.25rem}.rf-gap-2{gap:.5rem}.rf-gap-3{gap:.75rem}.rf-gap-4{gap:1rem}.rf-gap-5{gap:1.25rem}.rf-gap-6{gap:1.5rem}.rf-gap-8{gap:2rem}.rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.rf-space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.25rem*var(--tw-space-y-reverse));margin-top:calc(.25rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.rf-divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.rf-overflow-auto{overflow:auto}.\\!rf-overflow-hidden{overflow:hidden!important}.rf-overflow-hidden{overflow:hidden}.rf-overflow-visible{overflow:visible}.rf-overflow-x-auto{overflow-x:auto}.\\!rf-overflow-y-auto{overflow-y:auto!important}.rf-overflow-y-auto{overflow-y:auto}.rf-overflow-x-hidden{overflow-x:hidden}.rf-overflow-x-clip{overflow-x:clip}.rf-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rf-whitespace-normal{white-space:normal}.rf-whitespace-nowrap{white-space:nowrap}.rf-whitespace-pre-wrap{white-space:pre-wrap}.rf-text-nowrap{text-wrap:nowrap}.rf-break-words{overflow-wrap:break-word}.rf-break-all{word-break:break-all}.rf-rounded{border-radius:.25rem}.rf-rounded-2xl{border-radius:1rem}.rf-rounded-full{border-radius:9999px}.rf-rounded-lg{border-radius:var(--radius)}.rf-rounded-md{border-radius:calc(var(--radius) - 2px)}.rf-rounded-sm{border-radius:calc(var(--radius) - 4px)}.rf-rounded-xl{border-radius:.75rem}.rf-border{border-width:1px}.rf-border-2{border-width:2px}.rf-border-b{border-bottom-width:1px}.rf-border-l-2{border-left-width:2px}.rf-border-l-4{border-left-width:4px}.rf-border-t{border-top-width:1px}.rf-border-none{border-style:none}.rf-border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}.rf-border-blue-300{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.rf-border-blue-400{--tw-border-opacity:1;border-color:rgb(96 165 250/var(--tw-border-opacity,1))}.rf-border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.rf-border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.rf-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.rf-border-green-200{--tw-border-opacity:1;border-color:rgb(187 247 208/var(--tw-border-opacity,1))}.rf-border-green-400{--tw-border-opacity:1;border-color:rgb(74 222 128/var(--tw-border-opacity,1))}.rf-border-input{border-color:hsl(var(--input))}.rf-border-neutral-200{--tw-border-opacity:1;border-color:rgb(229 229 229/var(--tw-border-opacity,1))}.rf-border-orange-100{--tw-border-opacity:1;border-color:rgb(255 237 213/var(--tw-border-opacity,1))}.rf-border-orange-200{--tw-border-opacity:1;border-color:rgb(254 215 170/var(--tw-border-opacity,1))}.rf-border-orange-500{--tw-border-opacity:1;border-color:rgb(249 115 22/var(--tw-border-opacity,1))}.rf-border-primary{border-color:hsl(var(--primary))}.rf-border-red-100{--tw-border-opacity:1;border-color:rgb(254 226 226/var(--tw-border-opacity,1))}.rf-border-red-200{--tw-border-opacity:1;border-color:rgb(254 202 202/var(--tw-border-opacity,1))}.rf-border-red-400{--tw-border-opacity:1;border-color:rgb(248 113 113/var(--tw-border-opacity,1))}.rf-border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.rf-border-red-600{--tw-border-opacity:1;border-color:rgb(220 38 38/var(--tw-border-opacity,1))}.rf-border-red-700{--tw-border-opacity:1;border-color:rgb(185 28 28/var(--tw-border-opacity,1))}.rf-border-red-800{--tw-border-opacity:1;border-color:rgb(153 27 27/var(--tw-border-opacity,1))}.rf-border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity,1))}.rf-border-zinc-900{--tw-border-opacity:1;border-color:rgb(24 24 27/var(--tw-border-opacity,1))}.rf-border-t-blue-600{--tw-border-opacity:1;border-top-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-bg-amber-50{--tw-bg-opacity:1;background-color:rgb(255 251 235/var(--tw-bg-opacity,1))}.rf-bg-amber-50\\/30{background-color:rgba(255,251,235,.3)}.rf-bg-background{background-color:hsl(var(--background))}.rf-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.rf-bg-black\\/80{background-color:rgba(0,0,0,.8)}.rf-bg-blue-100{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity,1))}.rf-bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.rf-bg-blue-50\\/30{background-color:rgba(239,246,255,.3)}.rf-bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.rf-bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.rf-bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.rf-bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.rf-bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity,1))}.rf-bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}.rf-bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.rf-bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.rf-bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.rf-bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.rf-bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.rf-bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity,1))}.rf-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.rf-bg-muted{background-color:hsl(var(--muted))}.rf-bg-neutral-100{--tw-bg-opacity:1;background-color:rgb(245 245 245/var(--tw-bg-opacity,1))}.rf-bg-neutral-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38/var(--tw-bg-opacity,1))}.rf-bg-neutral-900{--tw-bg-opacity:1;background-color:rgb(23 23 23/var(--tw-bg-opacity,1))}.rf-bg-orange-400{--tw-bg-opacity:1;background-color:rgb(251 146 60/var(--tw-bg-opacity,1))}.rf-bg-orange-50{--tw-bg-opacity:1;background-color:rgb(255 247 237/var(--tw-bg-opacity,1))}.rf-bg-orange-50\\/50{background-color:rgba(255,247,237,.5)}.rf-bg-orange-500{--tw-bg-opacity:1;background-color:rgb(249 115 22/var(--tw-bg-opacity,1))}.rf-bg-popover{background-color:hsl(var(--popover))}.rf-bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.rf-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.rf-bg-red-50\\/50{background-color:hsla(0,86%,97%,.5)}.rf-bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.rf-bg-red-600{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}.rf-bg-red-900{--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.rf-bg-red-950{--tw-bg-opacity:1;background-color:rgb(69 10 10/var(--tw-bg-opacity,1))}.rf-bg-slate-50{--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity,1))}.rf-bg-transparent{background-color:transparent}.rf-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.rf-bg-yellow-100{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity,1))}.rf-bg-zinc-100{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.rf-bg-zinc-200{--tw-bg-opacity:1;background-color:rgb(228 228 231/var(--tw-bg-opacity,1))}.rf-bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-zinc-800{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.rf-bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.rf-bg-zinc-950{--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.rf-bg-opacity-50{--tw-bg-opacity:0.5}.rf-fill-amber-500{fill:#f59e0b}.rf-fill-current{fill:currentColor}.rf-object-contain{-o-object-fit:contain;object-fit:contain}.rf-object-cover{-o-object-fit:cover;object-fit:cover}.\\!rf-p-0{padding:0!important}.rf-p-0{padding:0}.rf-p-1{padding:.25rem}.rf-p-2{padding:.5rem}.rf-p-3{padding:.75rem}.rf-p-4{padding:1rem}.rf-p-5{padding:1.25rem}.rf-p-6{padding:1.5rem}.rf-p-8{padding:2rem}.rf-px-1{padding-left:.25rem;padding-right:.25rem}.rf-px-2{padding-left:.5rem;padding-right:.5rem}.rf-px-3{padding-left:.75rem;padding-right:.75rem}.rf-px-4{padding-left:1rem;padding-right:1rem}.rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.rf-px-8{padding-left:2rem;padding-right:2rem}.rf-py-0{padding-bottom:0;padding-top:0}.rf-py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.rf-py-1{padding-bottom:.25rem;padding-top:.25rem}.rf-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.rf-py-10{padding-bottom:2.5rem;padding-top:2.5rem}.rf-py-12{padding-bottom:3rem;padding-top:3rem}.rf-py-2{padding-bottom:.5rem;padding-top:.5rem}.rf-py-3{padding-bottom:.75rem;padding-top:.75rem}.rf-py-4{padding-bottom:1rem;padding-top:1rem}.rf-py-6{padding-bottom:1.5rem;padding-top:1.5rem}.rf-py-8{padding-bottom:2rem;padding-top:2rem}.rf-pb-0{padding-bottom:0}.rf-pb-1{padding-bottom:.25rem}.rf-pb-2{padding-bottom:.5rem}.rf-pb-3{padding-bottom:.75rem}.rf-pb-4{padding-bottom:1rem}.rf-pb-px{padding-bottom:1px}.rf-pl-10{padding-left:2.5rem}.rf-pl-11{padding-left:2.75rem}.rf-pl-12{padding-left:3rem}.rf-pl-2{padding-left:.5rem}.rf-pl-4{padding-left:1rem}.rf-pl-8{padding-left:2rem}.rf-pr-2{padding-right:.5rem}.rf-pt-0{padding-top:0}.rf-pt-1{padding-top:.25rem}.rf-pt-2{padding-top:.5rem}.rf-pt-4{padding-top:1rem}.rf-text-left{text-align:left}.rf-text-center{text-align:center}.rf-text-right{text-align:right}.rf-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.rf-text-2xl{font-size:1.5rem;line-height:2rem}.rf-text-3xl{font-size:1.875rem;line-height:2.25rem}.rf-text-\\[8px\\]{font-size:8px}.rf-text-base{font-size:1rem;line-height:1.5rem}.rf-text-lg{font-size:1.125rem;line-height:1.75rem}.rf-text-sm{font-size:.875rem;line-height:1.25rem}.rf-text-xl{font-size:1.25rem;line-height:1.75rem}.rf-text-xs{font-size:.75rem;line-height:1rem}.\\!rf-font-normal{font-weight:400!important}.rf-font-bold{font-weight:700}.rf-font-medium{font-weight:500}.rf-font-semibold{font-weight:600}.rf-uppercase{text-transform:uppercase}.rf-capitalize{text-transform:capitalize}.rf-tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.rf-leading-5{line-height:1.25rem}.rf-leading-\\[0\\.95rem\\]{line-height:.95rem}.rf-leading-\\[1rem\\]{line-height:1rem}.rf-leading-none{line-height:1}.rf-leading-relaxed{line-height:1.625}.rf-leading-tight{line-height:1.25}.rf-tracking-wide{letter-spacing:.025em}.rf-tracking-widest{letter-spacing:.1em}.rf-text-amber-500{--tw-text-opacity:1;color:rgb(245 158 11/var(--tw-text-opacity,1))}.rf-text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.rf-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.rf-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.rf-text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.rf-text-blue-800{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.rf-text-blue-900{--tw-text-opacity:1;color:rgb(30 58 138/var(--tw-text-opacity,1))}.rf-text-current{color:currentColor}.rf-text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.rf-text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.rf-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.rf-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.rf-text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.rf-text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}.rf-text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.rf-text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.rf-text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity,1))}.rf-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.rf-text-green-800{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity,1))}.rf-text-green-900{--tw-text-opacity:1;color:rgb(20 83 45/var(--tw-text-opacity,1))}.rf-text-muted-foreground{color:hsl(var(--muted-foreground))}.rf-text-neutral-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-neutral-500{--tw-text-opacity:1;color:rgb(115 115 115/var(--tw-text-opacity,1))}.rf-text-neutral-900{--tw-text-opacity:1;color:rgb(23 23 23/var(--tw-text-opacity,1))}.rf-text-neutral-950{--tw-text-opacity:1;color:rgb(10 10 10/var(--tw-text-opacity,1))}.rf-text-orange-400{--tw-text-opacity:1;color:rgb(251 146 60/var(--tw-text-opacity,1))}.rf-text-orange-500{--tw-text-opacity:1;color:rgb(249 115 22/var(--tw-text-opacity,1))}.rf-text-orange-600{--tw-text-opacity:1;color:rgb(234 88 12/var(--tw-text-opacity,1))}.rf-text-orange-700{--tw-text-opacity:1;color:rgb(194 65 12/var(--tw-text-opacity,1))}.rf-text-orange-800{--tw-text-opacity:1;color:rgb(154 52 18/var(--tw-text-opacity,1))}.rf-text-popover-foreground{color:hsl(var(--popover-foreground))}.rf-text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.rf-text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.rf-text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.rf-text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.rf-text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.rf-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.rf-text-red-800{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity,1))}.rf-text-red-900{--tw-text-opacity:1;color:rgb(127 29 29/var(--tw-text-opacity,1))}.rf-text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity,1))}.rf-text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.rf-text-slate-600{--tw-text-opacity:1;color:rgb(71 85 105/var(--tw-text-opacity,1))}.rf-text-slate-800{--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity,1))}.rf-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.rf-text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}.rf-text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity,1))}.rf-text-yellow-600{--tw-text-opacity:1;color:rgb(202 138 4/var(--tw-text-opacity,1))}.rf-text-yellow-900{--tw-text-opacity:1;color:rgb(113 63 18/var(--tw-text-opacity,1))}.rf-text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.rf-text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.rf-text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.rf-text-zinc-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.rf-text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.rf-text-zinc-950{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.rf-underline{text-decoration-line:underline}.rf-line-through{text-decoration-line:line-through}.rf-underline-offset-4{text-underline-offset:4px}.rf-opacity-0{opacity:0}.rf-opacity-100{opacity:1}.rf-opacity-25{opacity:.25}.rf-opacity-30{opacity:.3}.rf-opacity-50{opacity:.5}.rf-opacity-60{opacity:.6}.rf-opacity-70{opacity:.7}.rf-opacity-75{opacity:.75}.rf-shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.rf-shadow,.rf-shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.rf-shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.rf-shadow-md,.rf-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.rf-outline-none{outline:2px solid transparent;outline-offset:2px}.rf-ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.rf-ring-blue-500{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.rf-ring-primary{--tw-ring-color:hsl(var(--primary))}.rf-ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.rf-ring-offset-white{--tw-ring-offset-color:#fff}.rf-transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-duration-150{transition-duration:.15s}.rf-duration-200{transition-duration:.2s}.rf-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.rf-slide-in-from-left-1{--tw-enter-translate-x:-0.25rem}.rf-slide-out-to-left-1{--tw-exit-translate-x:-0.25rem}.rf-duration-150{animation-duration:.15s}.rf-duration-200{animation-duration:.2s}.rf-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}.file\\:rf-border-0::file-selector-button{border-width:0}.file\\:rf-bg-transparent::file-selector-button{background-color:transparent}.file\\:rf-text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\\:rf-font-medium::file-selector-button{font-weight:500}.placeholder\\:rf-text-zinc-500::-moz-placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.placeholder\\:rf-text-zinc-500::placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.hover\\:rf-border-blue-300:hover{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.hover\\:\\!rf-bg-transparent:hover{background-color:transparent!important}.hover\\:rf-bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\\:rf-bg-orange-100:hover{--tw-bg-opacity:1;background-color:rgb(255 237 213/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-100:hover{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-500\\/90:hover{background-color:rgba(239,68,68,.9)}.hover\\:rf-bg-slate-200:hover{--tw-bg-opacity:1;background-color:rgb(226 232 240/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100:hover{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100\\/80:hover{background-color:hsla(240,5%,96%,.8)}.hover\\:rf-bg-zinc-900\\/90:hover{background-color:rgba(24,24,27,.9)}.hover\\:rf-text-blue-800:hover{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.hover\\:rf-text-gray-700:hover{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.hover\\:rf-text-red-400:hover{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.hover\\:rf-text-slate-800:hover{--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity,1))}.hover\\:rf-text-slate-900:hover{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity,1))}.hover\\:rf-text-zinc-900:hover{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.hover\\:rf-underline:hover{text-decoration-line:underline}.focus\\:rf-bg-gray-100:focus{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.focus\\:rf-bg-zinc-100:focus{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.focus\\:rf-text-gray-900:focus{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.focus\\:rf-text-zinc-900:focus{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.focus\\:rf-outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:rf-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:rf-ring-blue-500:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.focus\\:rf-ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\\:rf-ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:rf-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:rf-ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-zinc-950:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(9 9 11/var(--tw-ring-opacity,1))}.focus-visible\\:rf-ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.disabled\\:rf-pointer-events-none:disabled{pointer-events:none}.disabled\\:rf-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:rf-opacity-50:disabled{opacity:.5}.rf-group:hover .group-hover\\:rf-opacity-100,.rf-group\\/bar:hover .group-hover\\/bar\\:rf-opacity-100{opacity:1}.rf-peer:disabled~.peer-disabled\\:rf-cursor-not-allowed{cursor:not-allowed}.rf-peer:disabled~.peer-disabled\\:rf-opacity-70{opacity:.7}.data-\\[disabled\\=true\\]\\:rf-pointer-events-none[data-disabled=true],.data-\\[disabled\\]\\:rf-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom]{--tw-translate-y:0.25rem}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom],.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{--tw-translate-x:-0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right]{--tw-translate-x:0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right],.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{--tw-translate-y:-0.25rem}.data-\\[selected\\=true\\]\\:rf-bg-zinc-100[data-selected=true]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[state\\=active\\]\\:rf-bg-white[data-state=active]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.data-\\[state\\=checked\\]\\:rf-bg-zinc-900[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.data-\\[state\\=open\\]\\:rf-bg-zinc-100[data-state=open]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[selected\\=true\\]\\:rf-text-zinc-900[data-selected=true]{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.data-\\[state\\=active\\]\\:rf-text-zinc-950[data-state=active]{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.data-\\[state\\=checked\\]\\:rf-text-zinc-50[data-state=checked]{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.data-\\[disabled\\=true\\]\\:rf-opacity-50[data-disabled=true],.data-\\[disabled\\]\\:rf-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=active\\]\\:rf-shadow[data-state=active]{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.data-\\[state\\=open\\]\\:rf-animate-in[data-state=open]{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-animate-out[data-state=closed]{animation-duration:.15s;animation-name:exit;--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:rf-fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:rf-zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:rf-zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:rf-slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:rf-slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:rf-slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:rf-slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.data-\\[state\\=closed\\]\\:rf-slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:rf-slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:rf-slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:rf-slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y:-48%}.dark\\:rf-border-zinc-50:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(250 250 250/var(--tw-border-opacity,1))}.dark\\:rf-border-zinc-800:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.dark\\:rf-bg-gray-700:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.dark\\:rf-bg-gray-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.dark\\:rf-bg-red-900:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-50:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-950:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:rf-text-gray-500:is(.rf-dark *){--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-400:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-50:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-900:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-ring-offset-zinc-950:is(.rf-dark *){--tw-ring-offset-color:#09090b}.dark\\:placeholder\\:rf-text-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:placeholder\\:rf-text-zinc-400:is(.rf-dark *)::placeholder{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:hover\\:rf-bg-red-900\\/90:hover:is(.rf-dark *){background-color:rgba(127,29,29,.9)}.dark\\:hover\\:rf-bg-zinc-50\\/90:hover:is(.rf-dark *){background-color:hsla(0,0%,98%,.9)}.dark\\:hover\\:rf-bg-zinc-800:hover:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:hover\\:rf-bg-zinc-800\\/80:hover:is(.rf-dark *){background-color:rgba(39,39,42,.8)}.dark\\:hover\\:rf-text-zinc-50:hover:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus\\:rf-bg-zinc-800:focus:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:focus\\:rf-text-zinc-50:focus:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus-visible\\:rf-ring-zinc-300:focus-visible:is(.rf-dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(212 212 216/var(--tw-ring-opacity,1))}.dark\\:data-\\[selected\\=true\\]\\:rf-bg-zinc-800[data-selected=true]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-bg-zinc-950[data-state=active]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-bg-zinc-50[data-state=checked]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=open\\]\\:rf-bg-zinc-800[data-state=open]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[selected\\=true\\]\\:rf-text-zinc-50[data-selected=true]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-text-zinc-50[data-state=active]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-text-zinc-900[data-state=checked]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}@media (min-width:640px){.sm\\:rf-order-1{order:1}.sm\\:rf-order-2{order:2}.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-mt-4{margin-top:1rem}.sm\\:rf-block{display:block}.sm\\:rf-inline{display:inline}.sm\\:rf-grid{display:grid}.sm\\:rf-hidden{display:none}.sm\\:rf-h-5{height:1.25rem}.sm\\:rf-w-1\\/2{width:50%}.sm\\:rf-w-5{width:1.25rem}.sm\\:rf-w-\\[90vw\\]{width:90vw}.sm\\:rf-w-auto{width:auto}.sm\\:rf-max-w-\\[500px\\]{max-width:500px}.sm\\:rf-max-w-md{max-width:28rem}.sm\\:rf-grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\\:rf-grid-cols-\\[1fr_auto\\]{grid-template-columns:1fr auto}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-items-center{align-items:center}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-gap-3{gap:.75rem}.sm\\:rf-gap-4{gap:1rem}.sm\\:rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.sm\\:rf-justify-self-end{justify-self:end}.sm\\:rf-rounded-lg{border-radius:var(--radius)}.sm\\:rf-p-3{padding:.75rem}.sm\\:rf-p-6{padding:1.5rem}.sm\\:rf-px-4{padding-left:1rem;padding-right:1rem}.sm\\:rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\\:rf-py-6{padding-bottom:1.5rem;padding-top:1.5rem}.sm\\:rf-text-left{text-align:left}.sm\\:rf-text-right{text-align:right}.sm\\:rf-text-2xl{font-size:1.5rem;line-height:2rem}.sm\\:rf-text-base{font-size:1rem;line-height:1.5rem}.sm\\:rf-text-sm{font-size:.875rem;line-height:1.25rem}.sm\\:rf-text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width:768px){.md\\:rf-w-auto{width:auto}.md\\:rf-max-w-\\[660px\\]{max-width:660px}.md\\:rf-max-w-lg{max-width:32rem}.md\\:rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\\:rf-p-8{padding:2rem}.md\\:rf-py-8{padding-bottom:2rem;padding-top:2rem}.md\\:rf-text-3xl{font-size:1.875rem;line-height:2.25rem}}@media (min-width:1024px){.lg\\:rf-max-w-\\[720px\\]{max-width:720px}.lg\\:rf-max-w-xl{max-width:36rem}}@media (min-width:1280px){.xl\\:rf-max-w-\\[800px\\]{max-width:800px}}.\\[\\&\\>span\\]\\:rf-line-clamp-1>span{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\\[\\&\\>svg\\]\\:rf-size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:rf-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:rf-text-red-300>svg{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.\\[\\&\\>svg\\]\\:hover\\:rf-text-red-400:hover>svg{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-py-1\\.5 [cmdk-group-heading]{padding-bottom:.375rem;padding-top:.375rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-font-medium [cmdk-group-heading]{font-weight:500}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-zinc-500 [cmdk-group-heading]{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.dark\\:\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-zinc-400 [cmdk-group-heading]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.\\[\\&_\\[cmdk-group\\]\\:not\\(\\[hidden\\]\\)_\\~\\[cmdk-group\\]\\]\\:rf-pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\\[\\&_\\[cmdk-group\\]\\]\\:rf-px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-input-wrapper\\]_svg\\]\\:rf-h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\\[\\&_\\[cmdk-input-wrapper\\]_svg\\]\\:rf-w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\\[\\&_\\[cmdk-input\\]\\]\\:rf-h-12 [cmdk-input]{height:3rem}.\\[\\&_\\[cmdk-item\\]\\]\\:rf-px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-item\\]\\]\\:rf-py-3 [cmdk-item]{padding-bottom:.75rem;padding-top:.75rem}.\\[\\&_\\[cmdk-item\\]_svg\\]\\:rf-h-5 [cmdk-item] svg{height:1.25rem}.\\[\\&_\\[cmdk-item\\]_svg\\]\\:rf-w-5 [cmdk-item] svg{width:1.25rem}.\\[\\&_svg\\]\\:rf-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:rf-size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:rf-shrink-0 svg{flex-shrink:0}',k5=()=>{$.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const A=document.createElement("style");A.setAttribute("data-styles","tscircuit-runframe"),A.textContent=GMt,document.head.appendChild(A)},[])},xMt=t=>{$.useEffect(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t])};function ON(t,A){const[e,i]=$.useState(()=>{try{const n=window.localStorage.getItem(t);return n?JSON.parse(n):A}catch(n){return console.error("Error reading from localStorage:",n),A}});return $.useEffect(()=>{try{window.localStorage.setItem(t,JSON.stringify(e))}catch(n){console.error("Error writing to localStorage:",n)}},[t,e]),[e,i]}const ste=t=>`hsl(${Dp.indexOf(t)*137.5%360}, 70%, 50%)`,FMt=({phaseTimings:t})=>{if(!t)return null;const A=Object.values(t).reduce((e,i)=>e+i,0);return Z.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[Z.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:Dp.map(e=>{const i=t[e]||0,n=i/A*100;return Z.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${n}%`,backgroundColor:ste(e)},children:Z.jsxs("div",{className:"rf-opacity-0 group-hover/bar:rf-opacity-100 rf-transition-opacity rf-absolute rf-bottom-full rf-left-1/2 rf-transform -rf-translate-x-1/2 rf-mb-2 rf-px-2 rf-py-1 rf-text-xs rf-whitespace-nowrap rf-rounded rf-bg-gray-900 rf-text-white rf-pointer-events-none",children:[e,": ",i.toFixed(1),"ms"]})},e)})}),Z.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",A.toFixed(2),"ms"]})]})},_Mt=t=>{if(t instanceof Blob)return t;if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{return String(t)}return String(t)},RMt=({renderLog:t,onRerunWithDebug:A})=>{const[e,i]=$.useState("chronological"),[n,o]=$.useState(""),s=[{value:"",label:"None"},{value:"DEBUG=Group_doInitialSchematicTraceRender",label:"DEBUG=Group_doInitialSchematicTraceRender"},{value:"DEBUG=Group_doInitialSchematicLayoutMatchpack",label:"DEBUG=Group_doInitialSchematicLayoutMatchpack"},{value:"DEBUG=Group_doInitialPcbLayoutPack",label:"DEBUG=Group_doInitialPcbLayoutPack"}];if(!t)return Z.jsxs("div",{className:"rf-p-4 rf-bg-gray-100 rf-rounded-md",children:[Z.jsx("div",{className:"rf-mb-4",children:"No render log, make sure this tab is open when you render"}),A&&Z.jsxs("div",{className:"rf-flex rf-gap-2 rf-items-center",children:[Z.jsx("select",{value:n,onChange:a=>o(a.target.value),className:"rf-px-3 rf-py-1 rf-border rf-rounded rf-text-xs rf-bg-white",children:s.map(a=>Z.jsx("option",{value:a.value,children:a.label},a.value))}),Z.jsx(Ng,{onClick:()=>A(n),size:"sm",className:"rf-text-xs",children:"Rerun Render with Debug"})]})]});const r=Object.entries(t?.phaseTimings??{});e==="chronological"?r.sort((a,I)=>Dp.indexOf(a[0])-Dp.indexOf(I[0])):r.sort((a,I)=>I[1]-a[1]);const g=r.reduce((a,[I,c])=>a+c,0);return Z.jsxs("div",{className:"rf-bg-white",children:[Z.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center rf-mb-4",children:[Z.jsx("div",{children:"Render Logs"}),Z.jsxs("div",{className:"rf-flex rf-gap-4 rf-items-center",children:[A&&Z.jsxs("div",{className:"rf-flex rf-gap-2 rf-items-center",children:[Z.jsx("select",{value:n,onChange:a=>o(a.target.value),className:"rf-px-3 rf-py-1 rf-border rf-rounded rf-text-xs rf-bg-white",children:s.map(a=>Z.jsx("option",{value:a.value,children:a.label},a.value))}),Z.jsx(Ng,{onClick:()=>A(n),size:"sm",className:"rf-text-xs",children:"Rerun Render with Debug"})]}),Z.jsx("div",{className:"rf-flex rf-gap-2 rf-items-center",children:Z.jsxs("select",{onChange:a=>{if(a.target.value){const I=t?.debugOutputs?.find(c=>c.name===a.target.value);if(I){const c=_Mt(I.content),B=c instanceof Blob?c:new Blob([c],{type:"text/plain"}),C=URL.createObjectURL(B),Q=document.createElement("a");Q.href=C,Q.download=`debug-${I.name}.txt`,document.body.appendChild(Q),Q.click(),document.body.removeChild(Q),URL.revokeObjectURL(C)}a.target.value=""}},disabled:!t?.debugOutputs||t.debugOutputs.length===0,className:"rf-px-3 rf-py-1 rf-border rf-rounded rf-text-xs rf-bg-white disabled:rf-opacity-50 disabled:rf-cursor-not-allowed",children:[Z.jsx("option",{value:"",children:"Download Debug Output"}),t?.debugOutputs?.map(a=>Z.jsx("option",{value:a.name,children:a.name},a.name))]})}),Z.jsxs("div",{className:"rf-flex rf-text-xs rf-items-center",children:[Z.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),Z.jsxs("select",{value:e,onChange:a=>i(a.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[Z.jsx("option",{value:"chronological",children:"Phase Order"}),Z.jsx("option",{value:"longest",children:"Duration"})]})]})]})]}),Z.jsx(FMt,{phaseTimings:t.phaseTimings}),Z.jsxs("table",{className:"rf-w-full rf-text-xs",children:[Z.jsx("thead",{children:Z.jsxs("tr",{children:[Z.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),Z.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),Z.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),Z.jsx("tbody",{children:r.map(([a,I])=>Z.jsxs("tr",{children:[Z.jsx("td",{className:"rf-p-2",children:Dp.indexOf(a)}),Z.jsx("td",{className:"rf-p-2",children:a}),Z.jsx("td",{className:"rf-p-2",children:Z.jsx("div",{className:"rf-w-8",children:Z.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:ste(a),width:`${I/g*100}%`}})})}),Z.jsx("td",{className:"rf-p-2",children:Z.jsxs("div",{className:"rf-flex w-full",children:[Z.jsxs("span",{className:"rf-flex-grow",children:[I,"ms"]}),Z.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(I/g*100).toFixed(1),"%"]})]})})]},a))})]})]})},rte=({errorMessage:t,errorStack:A,circuitJsonErrors:e})=>{$.useEffect(()=>{if(t){const i=new Error(t);A&&(i.stack=A);try{Z4.captureException(i)}catch{}}},[t,A]),$.useEffect(()=>{if(e&&e.length>0)for(const i of e){const n=new Error(i.message||"Circuit JSON Error");i.stack&&(n.stack=i.stack);try{Z4.captureException(n,{error_type:i.type})}catch{}}},[e])},gte="0.0.1394",NMt={version:gte},G5=ZNA()(VNA(t=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:A=>{t({lastRunEvalVersion:A})}}),{name:"runframe-runner-store"})),MMt=t=>{const[A,e]=$.useState([]),[i,n]=$.useState(null),[o,s]=$.useState(""),[r,g]=ON("eval-version-selection",null),a=G5(C=>C.setLastRunEvalVersion),I=G5(C=>C.lastRunEvalVersion);return $.useEffect(()=>{t&&fetch("https://data.jsdelivr.com/v1/package/npm/@tscircuit/eval").then(C=>C.json()).then(C=>{if(Array.isArray(C?.versions)){let Q=[...C.versions];C.tags?.latest&&(n(C.tags.latest),Q=Q.filter(l=>l!==C.tags.latest)),e(Q)}}).catch(()=>{})},[t]),$.useEffect(()=>{t&&(r?(window.TSCIRCUIT_LATEST_EVAL_VERSION=r,a(r)):i&&(window.TSCIRCUIT_LATEST_EVAL_VERSION=i,a(i)))},[t,r,i]),{versions:$.useMemo(()=>A.filter(C=>C.includes(o)).slice(0,50),[A,o]),latestVersion:i,lastRunEvalVersion:I,search:o,setSearch:s,selectVersion:C=>{g(C),s("")}}},vMt=({snippetNames:t,onSelect:A,onCancel:e,isOpen:i})=>{const[n,o]=$.useState(""),[s,r]=$.useState("");if(!i)return null;const g=t.filter(c=>c.toLowerCase().includes(s.toLowerCase())),a=s&&!t.includes(s),I=c=>{c.key==="Enter"&&(g.length===1?o(g[0]):a&&o(s))};return Z.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:Z.jsxs("div",{className:"rf-bg-white rf-rounded-lg rf-p-6 rf-w-96",children:[Z.jsx("h2",{className:"rf-text-lg rf-font-semibold rf-mb-4",children:"Select Snippet"}),Z.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}),Z.jsxs("div",{className:"rf-h-60 rf-overflow-y-auto",children:[g.map(c=>Z.jsx("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 ${n===c?"bg-blue-50":""}`,onClick:()=>o(c),children:c},c)),a&&Z.jsxs("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 text-blue-500 ${n===s?"bg-blue-50":""}`,onClick:()=>o(s),children:['Create new "',s,'"']})]}),Z.jsxs("div",{className:"rf-mt-4 rf-flex rf-justify-end rf-gap-2",children:[Z.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-text-gray-600 rf-hover:text-gray-800",onClick:e,children:"Cancel"}),Z.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:()=>n&&A(n),disabled:!n,children:n===s?`Create "${n}"`:`Save to ${n}`})]})]})})},UMt=t=>{const A=$.useRef(null),e=Fc(i=>i.recentEvents);$.useEffect(()=>{if(e.length===0)return;const i=e[0];i.event_id!==A.current&&(t(i),A.current=i.event_id)},[e,t])};var x5="Dialog",[ate,Ite]=jw(x5),[LMt,Qw]=ate(x5),cte=t=>{const{__scopeDialog:A,children:e,open:i,defaultOpen:n,onOpenChange:o,modal:s=!0}=t,r=$.useRef(null),g=$.useRef(null),[a,I]=SG({prop:i,defaultProp:n??!1,onChange:o,caller:x5});return Z.jsx(LMt,{scope:A,triggerRef:r,contentRef:g,contentId:su(),titleId:su(),descriptionId:su(),open:a,onOpenChange:I,onOpenToggle:$.useCallback(()=>I(c=>!c),[I]),modal:s,children:e})};cte.displayName=x5;var Bte="DialogTrigger",Cte=$.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,n=Qw(Bte,e),o=CB(A,n.triggerRef);return Z.jsx(gr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":AEA(n.open),...i,ref:o,onClick:ao(t.onClick,n.onOpenToggle)})});Cte.displayName=Bte;var XlA="DialogPortal",[HMt,Qte]=ate(XlA,{forceMount:void 0}),lte=t=>{const{__scopeDialog:A,forceMount:e,children:i,container:n}=t,o=Qw(XlA,A);return Z.jsx(HMt,{scope:A,forceMount:e,children:$.Children.map(i,s=>Z.jsx(q0,{present:e||o.open,children:Z.jsx(A8,{asChild:!0,container:n,children:s})}))})};lte.displayName=XlA;var F5="DialogOverlay",Ete=$.forwardRef((t,A)=>{const e=Qte(F5,t.__scopeDialog),{forceMount:i=e.forceMount,...n}=t,o=Qw(F5,t.__scopeDialog);return o.modal?Z.jsx(q0,{present:i||o.open,children:Z.jsx(JMt,{...n,ref:A})}):null});Ete.displayName=F5;var YMt=mG("DialogOverlay.RemoveScroll"),JMt=$.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,n=Qw(F5,e);return Z.jsx(g8,{as:YMt,allowPinchZoom:!0,shards:[n.contentRef],children:Z.jsx(gr.div,{"data-state":AEA(n.open),...i,ref:A,style:{pointerEvents:"auto",...i.style}})})}),Nx="DialogContent",hte=$.forwardRef((t,A)=>{const e=Qte(Nx,t.__scopeDialog),{forceMount:i=e.forceMount,...n}=t,o=Qw(Nx,t.__scopeDialog);return Z.jsx(q0,{present:i||o.open,children:o.modal?Z.jsx(KMt,{...n,ref:A}):Z.jsx(TMt,{...n,ref:A})})});hte.displayName=Nx;var KMt=$.forwardRef((t,A)=>{const e=Qw(Nx,t.__scopeDialog),i=$.useRef(null),n=CB(A,e.contentRef,i);return $.useEffect(()=>{const o=i.current;if(o)return qCA(o)},[]),Z.jsx(ute,{...t,ref:n,trapFocus:e.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ao(t.onCloseAutoFocus,o=>{o.preventDefault(),e.triggerRef.current?.focus()}),onPointerDownOutside:ao(t.onPointerDownOutside,o=>{const s=o.detail.originalEvent,r=s.button===0&&s.ctrlKey===!0;(s.button===2||r)&&o.preventDefault()}),onFocusOutside:ao(t.onFocusOutside,o=>o.preventDefault())})}),TMt=$.forwardRef((t,A)=>{const e=Qw(Nx,t.__scopeDialog),i=$.useRef(!1),n=$.useRef(!1);return Z.jsx(ute,{...t,ref:A,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{t.onCloseAutoFocus?.(o),o.defaultPrevented||(i.current||e.triggerRef.current?.focus(),o.preventDefault()),i.current=!1,n.current=!1},onInteractOutside:o=>{t.onInteractOutside?.(o),o.defaultPrevented||(i.current=!0,o.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const s=o.target;e.triggerRef.current?.contains(s)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&n.current&&o.preventDefault()}})}),ute=$.forwardRef((t,A)=>{const{__scopeDialog:e,trapFocus:i,onOpenAutoFocus:n,onCloseAutoFocus:o,...s}=t,r=Qw(Nx,e),g=$.useRef(null),a=CB(A,g);return mCA(),Z.jsxs(Z.Fragment,{children:[Z.jsx(KO,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:n,onUnmountAutoFocus:o,children:Z.jsx(JO,{role:"dialog",id:r.contentId,"aria-describedby":r.descriptionId,"aria-labelledby":r.titleId,"data-state":AEA(r.open),...s,ref:a,onDismiss:()=>r.onOpenChange(!1)})}),Z.jsxs(Z.Fragment,{children:[Z.jsx(PMt,{titleId:r.titleId}),Z.jsx(WMt,{contentRef:g,descriptionId:r.descriptionId})]})]})}),$lA="DialogTitle",dte=$.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,n=Qw($lA,e);return Z.jsx(gr.h2,{id:n.titleId,...i,ref:A})});dte.displayName=$lA;var pte="DialogDescription",fte=$.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,n=Qw(pte,e);return Z.jsx(gr.p,{id:n.descriptionId,...i,ref:A})});fte.displayName=pte;var yte="DialogClose",wte=$.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,n=Qw(yte,e);return Z.jsx(gr.button,{type:"button",...i,ref:A,onClick:ao(t.onClick,()=>n.onOpenChange(!1))})});wte.displayName=yte;function AEA(t){return t?"open":"closed"}var Dte="DialogTitleWarning",[qMt,mte]=VTe(Dte,{contentName:Nx,titleName:$lA,docsSlug:"dialog"}),PMt=({titleId:t})=>{const A=mte(Dte),e=`\`${A.contentName}\` requires a \`${A.titleName}\` for the component to be accessible for screen reader users.
5888
5888
 
5889
5889
  If you want to hide the \`${A.titleName}\`, you can wrap it with our VisuallyHidden component.
5890
5890
 
@@ -6048,7 +6048,7 @@ ${this.args[0].slice(2,-2).trim().split(/\s+(?=[A-Z_])/g).join(`
6048
6048
  `)}
6049
6049
  )`:`${this.type}(${this.args.join(",")})`}}function q4t(t){const A=[],e=t.indexOf("DATA;"),i=t.indexOf("ENDSEC;",e);if(e===-1||i===-1)throw new Error("Could not find DATA section in STEP file");const n=t.substring(e+5,i),o=/#(\d+)\s*=\s*/g;let s;const r=[];for(;(s=o.exec(n))!==null;)r.push({index:s.index,id:parseInt(s[1],10)});for(let g=0;g<r.length;g++){const a=r[g],I=g+1<r.length?r[g+1].index:n.length,c=n.substring(a.index,I),B=c.indexOf(";");if(B===-1)throw new Error(`Could not find closing semicolon for entity #${a.id}`);const C=c.substring(0,B+1);if(C.match(/#\d+\s*=\s*\(/)){const Q=C.match(/#\d+\s*=\s*\(([\s\S]*)\);/);if(!Q)throw new Error(`Could not parse complex entity: ${C.substring(0,100)}`);A.push({id:Px(a.id),type:"Unknown",args:[`( ${Q[1].trim()} )`]})}else{const Q=C.match(/#\d+\s*=\s*([A-Z0-9_]+)\s*\(([\s\S]*)\);/);if(!Q)throw new Error(`Could not parse entity: ${C.substring(0,100)}`);const l=Q[1].trim(),E=Q[2].trim(),h=P4t(E);A.push({id:Px(a.id),type:l,args:h})}}return A}function P4t(t){const A=[];let e="",i=0,n=!1;for(let o=0;o<t.length;o++){const s=t[o];if(s==="'"&&t[o-1]!=="\\"&&(n=!n),!n&&(s==="("&&i++,s===")"&&i--,s===","&&i===0)){A.push(e.trim()),e="";continue}e+=s}return e.trim()&&A.push(e.trim()),A}function O4t(t){const A=new Aae,e={repo:A,parseRef(i){const n=+i.replace("#","").trim();return new $L(Px(n))},parseNumber(i){return Number(i)},parseString(i){const n=i.match(/^'(.*)'$/);if(!n)throw new Error(`Expected string: ${i}`);return n[1].replace(/''/g,"'")}};for(const i of q4t(t)){const n=T4t(i.type);if(!n){A.set(i.id,new pk(i.type,i.args));continue}const o=n(i.args,e);A.set(i.id,o)}return A}function W4t(t,A,e){const{transform:i,shouldDrawErrors:n}=e;if(!n)return[];const{pcb_port_ids:o}=t,s=A.find(B=>B.type==="pcb_port"&&B.pcb_port_id===o?.[0]),r=A.find(B=>B.type==="pcb_port"&&B.pcb_port_id===o?.[1]);if(!s||!r){const C=t.message?.match(/pcb_via\[#?(pcb_via_\d+)\]/)?.[1],Q=A.find(l=>l.type==="pcb_via"&&l.pcb_via_id===C);if(Q&&Q.type==="pcb_via")return Z4t(t,Q,e);if(t.center){const l=Ce(i,{x:t.center.x,y:t.center.y});return NpA([{name:"rect",type:"element",attributes:{x:(l.x-5).toString(),y:(l.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${l.x} ${l.y})`},children:[],value:""},{name:"text",type:"element",attributes:{x:l.x.toString(),y:(l.y-15).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",value:t.message||"Pcb Trace Error",name:"",attributes:{},children:[]}],value:""}])}else return[]}const g=Ce(i,{x:s.x,y:s.y}),a=Ce(i,{x:r.x,y:r.y}),I={x:(g.x+a.x)/2,y:(g.y+a.y)/2};if(isNaN(g.x)||isNaN(g.y)||isNaN(a.x)||isNaN(a.y)||isNaN(I.x)||isNaN(I.y))return[];const c=[{name:"line",type:"element",attributes:{x1:g.x.toString(),y1:g.y.toString(),x2:I.x.toString(),y2:I.y.toString(),stroke:"red","stroke-width":"1.5","stroke-dasharray":"2,2"},children:[],value:""},{name:"line",type:"element",attributes:{x1:I.x.toString(),y1:I.y.toString(),x2:a.x.toString(),y2:a.y.toString(),stroke:"red","stroke-width":"1.5","stroke-dasharray":"2,2"},children:[],value:""},{name:"rect",type:"element",attributes:{x:(I.x-5).toString(),y:(I.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${I.x} ${I.y})`},children:[],value:""},{name:"text",type:"element",attributes:{x:I.x.toString(),y:(I.y-15).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",value:t.message||"Pcb Trace Error",name:"",attributes:{},children:[]}],value:""}];return NpA(c)}function Z4t(t,A,e){const{transform:i}=e;if(t.center&&A){const n=Ce(i,{x:t.center.x,y:t.center.y}),o=Ce(i,{x:A.x,y:A.y}),s=o.x-n.x,r=o.y-n.y,g=Math.sqrt(s*s+r*r),a=Math.atan2(r,s)*180/Math.PI,c=g+10*2,B=20,C=(n.x+o.x)/2,Q=(n.y+o.y)/2;return NpA([{name:"rect",type:"element",attributes:{x:(C-c/2).toString(),y:(Q-B/2).toString(),width:c.toString(),height:B.toString(),fill:"none",stroke:"red","stroke-width":"1","stroke-dasharray":"3,2",transform:`rotate(${a} ${C} ${Q})`},children:[],value:""},{name:"rect",type:"element",attributes:{x:(C-5).toString(),y:(Q-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${C} ${Q})`},children:[],value:""},{name:"text",type:"element",attributes:{x:C.toString(),y:(Q-B/2-5).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",value:t.message||"Pcb Trace Error",name:"",attributes:{},children:[]}],value:""}])}return[]}function NpA(t){return t.map(A=>({...A,attributes:{...A.attributes??{},"data-type":A.attributes?.["data-type"]??"pcb_trace_error","data-pcb-layer":A.attributes?.["data-pcb-layer"]??"overlay"},children:(A.children??[]).map(e=>e?.type==="element"?{...e,attributes:{...e.attributes??{},"data-type":e.attributes?.["data-type"]??"pcb_trace_error","data-pcb-layer":e.attributes?.["data-pcb-layer"]??"overlay"}}:e)}))}function V4t(t){return t.map(A=>({...A,attributes:{...A.attributes??{},"data-type":A.attributes?.["data-type"]??"pcb_footprint_overlap_error","data-pcb-layer":A.attributes?.["data-pcb-layer"]??"overlay"},children:(A.children??[]).map(e=>e?.type==="element"?{...e,attributes:{...e.attributes??{},"data-type":e.attributes?.["data-type"]??"pcb_footprint_overlap_error","data-pcb-layer":e.attributes?.["data-pcb-layer"]??"overlay"}}:e)}))}function j4t(t,A,e){const{transform:i,shouldDrawErrors:n}=e;if(!n)return[];const o=[],s=[];let r=[];if(t.pcb_smtpad_ids)for(const I of t.pcb_smtpad_ids){const c=A.find(B=>B.type==="pcb_smtpad"&&B.pcb_smtpad_id===I);c&&(s.push({x:c.x,y:c.y,type:"pcb_smtpad",id:I,pcb_port_id:c.pcb_port_id}),c.pcb_port_id&&r.push(c.pcb_port_id))}const g=r.length>1&&r.every(I=>I===r[0]);let a=s;if(g&&(a=s.filter(I=>I.type!=="pcb_smtpad")),t.pcb_plated_hole_ids)for(const I of t.pcb_plated_hole_ids){const c=A.find(B=>B.type==="pcb_plated_hole"&&B.pcb_plated_hole_id===I);c&&a.push({x:c.x,y:c.y,type:"pcb_plated_hole",id:I})}if(t.pcb_hole_ids)for(const I of t.pcb_hole_ids){const c=A.find(B=>B.type==="pcb_hole"&&B.pcb_hole_id===I);c&&a.push({x:c.x,y:c.y,type:"pcb_hole",id:I})}if(a.length>0){const I=a.reduce((C,Q)=>C+Q.x,0)/a.length,c=a.reduce((C,Q)=>C+Q.y,0)/a.length,B=Ce(i,{x:I,y:c});o.push({name:"rect",type:"element",attributes:{x:(B.x-5).toString(),y:(B.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${B.x} ${B.y})`},children:[],value:""}),o.push({name:"text",type:"element",attributes:{x:B.x.toString(),y:(B.y-15).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",value:t.message||"PCB Footprint Overlap Error",name:"",attributes:{},children:[]}],value:""});for(const C of a){const Q=Ce(i,{x:C.x,y:C.y});o.push({name:"rect",type:"element",attributes:{x:(Q.x-5).toString(),y:(Q.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${Q.x} ${Q.y})`},children:[],value:""}),a.length>1&&o.push({name:"line",type:"element",attributes:{x1:B.x.toString(),y1:B.y.toString(),x2:Q.x.toString(),y2:Q.y.toString(),stroke:"red","stroke-width":"1.5","stroke-dasharray":"2,2"},children:[],value:""})}}return V4t(o)}function z4t(t,A){const{transform:e,layer:i}=A;if(!t.route||!Array.isArray(t.route))return[];const n=t.route[0],o=t.route[t.route.length-1],s=n.x===o.x&&n.y===o.y,r=t.route.slice(0,s?-1:void 0).map((g,a)=>{const[I,c]=Ce(e,[g.x,g.y]);return a===0?`M ${I} ${c}`:`L ${I} ${c}`}).join(" ")+(s?" Z":"");return[{name:"path",type:"element",attributes:{class:"pcb-fabrication-note-path",stroke:t.color||"rgba(255,255,255,0.5)",fill:"none",d:r,"stroke-width":(t.stroke_width*Math.abs(e.a)).toString(),"data-pcb-component-id":t.pcb_component_id,"data-pcb-fabrication-note-path-id":t.pcb_fabrication_note_path_id,"data-type":"pcb_fabrication_note_path","data-pcb-layer":"overlay"},value:"",children:[]}]}function X4t(t,A){const{transform:e,layer:i}=A,{anchor_position:n,anchor_alignment:o,text:s,font_size:r=1,layer:g="top",color:a}=t;if(i&&g!==i)return[];if(!n||typeof n.x!="number"||typeof n.y!="number")return console.error("Invalid anchor_position:",n),[];const[I,c]=Ce(e,[n.x,n.y]),B=r*Math.abs(e.a),C=Xi(gn(I,c),IB(Math.PI/180));return[{name:"text",type:"element",attributes:{x:"0",y:"0","font-family":"Arial, sans-serif","font-size":B.toString(),"text-anchor":"middle","dominant-baseline":"central",transform:pp(C),class:"pcb-fabrication-note-text",fill:a||"rgba(255,255,255,0.5)","data-type":"pcb_fabrication_note_text","data-pcb-layer":"overlay"},children:[{type:"text",value:s,name:"",attributes:{},children:[]}],value:""}]}var $4t="rgba(255,255,255,0.5)",A3t="rgba(255,255,255,0.2)";function e3t(t,A){const{transform:e,layer:i}=A,{center:n,width:o,height:s,stroke_width:r,is_filled:g,has_stroke:a,is_stroke_dashed:I,color:c,layer:B="top",pcb_component_id:C,pcb_fabrication_note_rect_id:Q}=t;if(i&&B!==i)return[];if(!n||typeof n.x!="number"||typeof n.y!="number"||typeof o!="number"||typeof s!="number")return console.error("Invalid pcb_fabrication_note_rect data",{center:n,width:o,height:s}),[];const l=o/2,E=s/2,[h,u]=Ce(e,[n.x-l,n.y+E]),[p,f]=Ce(e,[n.x+l,n.y-E]),b=Math.min(h,p),D=Math.min(u,f),k=Math.abs(p-h),m=Math.abs(f-u),G=(typeof r=="number"?r:0)*Math.abs(e.a),U=c??$4t,M={x:b.toString(),y:D.toString(),width:k.toString(),height:m.toString(),class:"pcb-fabrication-note-rect","data-type":"pcb_fabrication_note_rect","data-pcb-fabrication-note-rect-id":Q,"data-pcb-layer":"overlay"};if(C!==void 0&&(M["data-pcb-component-id"]=C),g?M.fill=c??A3t:M.fill="none",a??G>0){if(M.stroke=U,M["stroke-width"]=G.toString(),I){const q=.2*Math.abs(e.a),O=.1*Math.abs(e.a);M["stroke-dasharray"]=`${q} ${O}`}}else M.stroke="none";return[{name:"rect",type:"element",value:"",attributes:M,children:[]}]}function t3t(t){const A=Math.hypot(t.x,t.y)||1;return{x:t.x/A,y:t.y/A}}function tae(t){return t.map((A,e)=>e===0?`M ${A.x} ${A.y}`:`L ${A.x} ${A.y}`).join(" ")}function i3t(t,A){const{transform:e,layer:i}=A,{from:n,to:o,text:s,font_size:r=1,color:g,arrow_size:a,layer:I,pcb_component_id:c,pcb_fabrication_note_dimension_id:B}=t;if(i&&I&&I!==i)return[];if(!n||!o||typeof n!="object"||typeof o!="object")return console.error("Invalid pcb_fabrication_note_dimension endpoints",{from:n,to:o}),[];if(typeof n.x!="number"||typeof n.y!="number"||typeof o.x!="number"||typeof o.y!="number")return console.error("Invalid pcb_fabrication_note_dimension point values",{from:n,to:o}),[];const C=typeof a=="number"?a:void 0;if(C===void 0||!Number.isFinite(C)||C<=0)return console.error("Invalid pcb_fabrication_note_dimension arrow_size",a),[];const Q=C,l=t3t({x:o.x-n.x,y:o.y-n.y});if(Number.isNaN(l.x)||Number.isNaN(l.y))return[];const E={x:-l.y,y:l.x},h=Q/2,u={x:n.x+l.x*Q,y:n.y+l.y*Q},p={x:o.x-l.x*Q,y:o.y-l.y*Q},f=[IA(n),IA({x:u.x+E.x*h,y:u.y+E.y*h}),IA({x:u.x-E.x*h,y:u.y-E.y*h})],b=[IA(o),IA({x:p.x+E.x*h,y:p.y+E.y*h}),IA({x:p.x-E.x*h,y:p.y-E.y*h})],[D,k]=Ce(e,[u.x,u.y]),[m,F]=Ce(e,[p.x,p.y]),G=Q/5*Math.abs(e.a),U=g||"rgba(255,255,255,0.5)",M={x:(n.x+o.x)/2,y:(n.y+o.y)/2},J=Q*1.5,P={x:M.x+E.x*J,y:M.y+E.y*J},[q,O]=Ce(e,[P.x,P.y]),j=r*Math.abs(e.a),eA=[{name:"path",type:"element",value:"",attributes:{d:`M ${D} ${k} L ${m} ${F}`,stroke:U,fill:"none","stroke-width":G.toString(),"stroke-linecap":"round",class:"pcb-fabrication-note-dimension-line"},children:[]},{name:"path",type:"element",value:"",attributes:{d:`${tae(f)} Z`,fill:U,class:"pcb-fabrication-note-dimension-arrow"},children:[]},{name:"path",type:"element",value:"",attributes:{d:`${tae(b)} Z`,fill:U,class:"pcb-fabrication-note-dimension-arrow"},children:[]}];s&&eA.push({name:"text",type:"element",value:"",attributes:{x:q.toString(),y:O.toString(),fill:U,"font-size":j.toString(),"font-family":"Arial, sans-serif","text-anchor":"middle","dominant-baseline":"central",class:"pcb-fabrication-note-dimension-text"},children:[{type:"text",name:"",value:s,attributes:{},children:[]}]});const oA={class:"pcb-fabrication-note-dimension","data-type":"pcb_fabrication_note_dimension","data-pcb-fabrication-note-dimension-id":B,"data-pcb-layer":I??"overlay"};return c!==void 0&&(oA["data-pcb-component-id"]=c),[{name:"g",type:"element",value:"",attributes:oA,children:eA}];function IA(iA){const[nA,gA]=Ce(e,[iA.x,iA.y]);return{x:nA,y:gA}}}var mM={board:{user_2:"rgb(89, 148, 220)"}};function n3t(t){const A=Math.hypot(t.x,t.y)||1;return{x:t.x/A,y:t.y/A}}function iae(t){return t.map((A,e)=>e===0?`M ${A.x} ${A.y}`:`L ${A.x} ${A.y}`).join(" ")}function o3t(t,A){const{transform:e}=A,{from:i,to:n,text:o,font_size:s=1,color:r,arrow_size:g}=t;if(!i||!n)return console.error("Invalid pcb_note_dimension endpoints",{from:i,to:n}),[];if(!Number.isFinite(g)||g<=0)return console.error("Invalid pcb_note_dimension arrow_size",g),[];const a=n3t({x:n.x-i.x,y:n.y-i.y});if(Number.isNaN(a.x)||Number.isNaN(a.y))return[];const I={x:-a.y,y:a.x},c=g/2,B={x:i.x+a.x*g,y:i.y+a.y*g},C={x:n.x-a.x*g,y:n.y-a.y*g},Q=[J(i),J({x:B.x+I.x*c,y:B.y+I.y*c}),J({x:B.x-I.x*c,y:B.y-I.y*c})],l=[J(n),J({x:C.x+I.x*c,y:C.y+I.y*c}),J({x:C.x-I.x*c,y:C.y-I.y*c})],[E,h]=Ce(e,[B.x,B.y]),[u,p]=Ce(e,[C.x,C.y]),f=g/5*Math.abs(e.a),b=r||mM.board.user_2,D={x:(i.x+n.x)/2,y:(i.y+n.y)/2},k=g*1.5,m={x:D.x+I.x*k,y:D.y+I.y*k},[F,G]=Ce(e,[m.x,m.y]),U=s*Math.abs(e.a),M=[{name:"path",type:"element",value:"",attributes:{d:`M ${E} ${h} L ${u} ${p}`,stroke:b,fill:"none","stroke-width":f.toString(),"stroke-linecap":"round",class:"pcb-note-dimension-line"},children:[]},{name:"path",type:"element",value:"",attributes:{d:`${iae(Q)} Z`,fill:b,class:"pcb-note-dimension-arrow"},children:[]},{name:"path",type:"element",value:"",attributes:{d:`${iae(l)} Z`,fill:b,class:"pcb-note-dimension-arrow"},children:[]}];return o&&M.push({name:"text",type:"element",value:"",attributes:{x:F.toString(),y:G.toString(),fill:b,"font-size":U.toString(),"font-family":"Arial, sans-serif","text-anchor":"middle","dominant-baseline":"central",class:"pcb-note-dimension-text"},children:[{type:"text",name:"",value:o,attributes:{},children:[]}]}),[{name:"g",type:"element",value:"",attributes:{class:"pcb-note-dimension","data-type":"pcb_note_dimension","data-pcb-note-dimension-id":t.pcb_note_dimension_id,"data-pcb-layer":"overlay"},children:M}];function J(P){const[q,O]=Ce(e,[P.x,P.y]);return{x:q,y:O}}}var s3t=mM.board.user_2;function r3t(t,A){const{transform:e}=A,{anchor_position:i,text:n,font_size:o=1,anchor_alignment:s="center",color:r}=t;if(!i||typeof i.x!="number"||typeof i.y!="number")return console.error("Invalid pcb_note_text anchor_position",i),[];if(typeof n!="string"||n.length===0)return console.error("Invalid pcb_note_text text",n),[];const[g,a]=Ce(e,[i.x,i.y]),I=o*Math.abs(e.a);let c="middle",B="central";switch(s){case"top_left":c="start",B="text-before-edge";break;case"top_right":c="end",B="text-before-edge";break;case"bottom_left":c="start",B="text-after-edge";break;case"bottom_right":c="end",B="text-after-edge";break;case"center":default:c="middle",B="central";break}return[{name:"text",type:"element",value:"",attributes:{x:g.toString(),y:a.toString(),fill:r??s3t,"font-family":"Arial, sans-serif","font-size":I.toString(),"text-anchor":c,"dominant-baseline":B,class:"pcb-note-text","data-type":"pcb_note_text","data-pcb-note-text-id":t.pcb_note_text_id,"data-pcb-layer":"overlay"},children:[{type:"text",name:"",value:n,attributes:{},children:[]}]}]}var g3t=mM.board.user_2,a3t=mM.board.user_2;function I3t(t,A){const{transform:e}=A,{center:i,width:n,height:o,stroke_width:s,is_filled:r,has_stroke:g,is_stroke_dashed:a,color:I}=t;if(!i||typeof i.x!="number"||typeof i.y!="number"||typeof n!="number"||typeof o!="number")return console.error("Invalid pcb_note_rect data",{center:i,width:n,height:o}),[];const c=n/2,B=o/2,[C,Q]=Ce(e,[i.x-c,i.y+B]),[l,E]=Ce(e,[i.x+c,i.y-B]),h=Math.min(C,l),u=Math.min(Q,E),p=Math.abs(l-C),f=Math.abs(E-Q),D=(typeof s=="number"?s:0)*Math.abs(e.a),k=I??g3t,m={x:h.toString(),y:u.toString(),width:p.toString(),height:f.toString(),class:"pcb-note-rect","data-type":"pcb_note_rect","data-pcb-note-rect-id":t.pcb_note_rect_id,"data-pcb-layer":"overlay"};if(r?m.fill=I??a3t:m.fill="none",g??D>0){if(m.stroke=k,m["stroke-width"]=D.toString(),a){const U=.2*Math.abs(e.a),M=.1*Math.abs(e.a);m["stroke-dasharray"]=`${U} ${M}`}}else m.stroke="none";return[{name:"rect",type:"element",value:"",attributes:m,children:[]}]}var c3t=mM.board.user_2;function B3t(t,A){const{transform:e}=A;if(!Array.isArray(t.route)||t.route.length===0)return console.error("Invalid pcb_note_path route",t.route),[];for(const s of t.route)if(typeof s.x!="number"||typeof s.y!="number")return console.error("Invalid point in pcb_note_path",s),[];const i=t.route.map((s,r)=>{const[g,a]=Ce(e,[s.x,s.y]);return r===0?`M ${g} ${a}`:`L ${g} ${a}`}).join(" "),n=t.stroke_width*Math.abs(e.a);return[{name:"path",type:"element",value:"",attributes:{d:i,stroke:t.color??c3t,fill:"none","stroke-width":n.toString(),class:"pcb-note-path","data-type":"pcb_note_path","data-pcb-note-path-id":t.pcb_note_path_id,"data-pcb-layer":"overlay"},children:[]}]}var C3t=mM.board.user_2;function Q3t(t,A){const{transform:e}=A,{x1:i,y1:n,x2:o,y2:s,stroke_width:r,color:g,is_dashed:a}=t;if(typeof i!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number")return console.error("Invalid pcb_note_line coordinates",{x1:i,y1:n,x2:o,y2:s}),[];const[I,c]=Ce(e,[i,n]),[B,C]=Ce(e,[o,s]),l=(typeof r=="number"?r:0)*Math.abs(e.a),E={x1:I.toString(),y1:c.toString(),x2:B.toString(),y2:C.toString(),stroke:g??C3t,"stroke-width":l.toString(),"stroke-linecap":"round",class:"pcb-note-line","data-type":"pcb_note_line","data-pcb-note-line-id":t.pcb_note_line_id,"data-pcb-layer":"overlay"};if(a){const u=.2*Math.abs(e.a),p=.1*Math.abs(e.a);E["stroke-dasharray"]=`${u} ${p}`}return[{name:"line",type:"element",value:"",attributes:E,children:[]}]}function l3t(t,A){const{transform:e,colorMap:i}=A,[n,o]=Ce(e,[t.x,t.y]),s=Array.isArray(t.layers)&&t.layers[0]||t.layer||"top";if(t.shape==="pill"){const r=t.outer_width*Math.abs(e.a),g=t.outer_height*Math.abs(e.a),a=t.hole_width*Math.abs(e.a),I=t.hole_height*Math.abs(e.a),c=r/2,B=a/2,C=g-r,Q=t.ccw_rotation||0,l=Q?`translate(${n} ${o}) rotate(${-Q})`:`translate(${n} ${o})`,E=Q?`translate(${n} ${o}) rotate(${-Q})`:`translate(${n} ${o})`;return[{name:"g",type:"element",attributes:{"data-type":"pcb_plated_hole","data-pcb-layer":"through"},children:[{name:"path",type:"element",attributes:{class:"pcb-hole-outer",fill:i.copper.top,d:`M${-c},${-C/2} v${C} a${c},${c} 0 0 0 ${r},0 v-${C} a${c},${c} 0 0 0 -${r},0 z`,transform:l,"data-type":"pcb_plated_hole","data-pcb-layer":s},value:"",children:[]},{name:"path",type:"element",attributes:{class:"pcb-hole-inner",fill:i.drill,d:`M${-B},${-(I-a)/2} v${I-a} a${B},${B} 0 0 0 ${a},0 v-${I-a} a${B},${B} 0 0 0 -${a},0 z`,transform:E,"data-type":"pcb_plated_hole_drill","data-pcb-layer":"drill"},value:"",children:[]}],value:""}]}if(t.shape==="circle"){const r=t.outer_diameter*Math.abs(e.a),g=t.outer_diameter*Math.abs(e.a),a=t.hole_diameter*Math.abs(e.a),I=t.hole_diameter*Math.abs(e.a),c=Math.min(r,g)/2,B=Math.min(a,I)/2;return[{name:"g",type:"element",attributes:{"data-type":"pcb_plated_hole","data-pcb-layer":"through"},children:[{name:"circle",type:"element",attributes:{class:"pcb-hole-outer",fill:i.copper.top,cx:n.toString(),cy:o.toString(),r:c.toString(),"data-type":"pcb_plated_hole","data-pcb-layer":s},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"pcb-hole-inner",fill:i.drill,cx:n.toString(),cy:o.toString(),r:B.toString(),"data-type":"pcb_plated_hole_drill","data-pcb-layer":"drill"},value:"",children:[]}],value:""}]}if(t.shape==="circular_hole_with_rect_pad"){const r=t,g=t.hole_diameter*Math.abs(e.a),a=t.rect_pad_width*Math.abs(e.a),I=t.rect_pad_height*Math.abs(e.a),c=(t.rect_border_radius??0)*Math.abs(e.a),B=g/2,[C,Q]=Ce(e,[r.x+(r.hole_offset_x??0),r.y+(r.hole_offset_y??0)]);return[{name:"g",type:"element",attributes:{"data-type":"pcb_plated_hole","data-pcb-layer":"through"},children:[{name:"rect",type:"element",attributes:{class:"pcb-hole-outer-pad",fill:i.copper.top,x:(n-a/2).toString(),y:(o-I/2).toString(),width:a.toString(),height:I.toString(),...c?{rx:c.toString(),ry:c.toString()}:{},"data-type":"pcb_plated_hole","data-pcb-layer":s},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"pcb-hole-inner",fill:i.drill,cx:C.toString(),cy:Q.toString(),r:B.toString(),"data-type":"pcb_plated_hole_drill","data-pcb-layer":"drill"},value:"",children:[]}],value:""}]}if(t.shape==="pill_hole_with_rect_pad"){const r=t,g=r.rect_pad_width*Math.abs(e.a),a=r.rect_pad_height*Math.abs(e.a),I=(r.rect_border_radius??0)*Math.abs(e.a),c=r.hole_height*Math.abs(e.a),B=r.hole_width*Math.abs(e.a),C=r,Q=C.hole_offset_x??0,l=C.hole_offset_y??0,[E,h]=Ce(e,[r.x+Q,r.y+l]),u=Math.min(c,B)/2;return[{name:"g",type:"element",attributes:{"data-type":"pcb_plated_hole","data-pcb-layer":"through"},children:[{name:"rect",type:"element",attributes:{class:"pcb-hole-outer-pad",fill:i.copper.top,x:(n-g/2).toString(),y:(o-a/2).toString(),width:g.toString(),height:a.toString(),...I?{rx:I.toString(),ry:I.toString()}:{},"data-type":"pcb_plated_hole","data-pcb-layer":s},value:"",children:[]},{name:"rect",type:"element",attributes:{class:"pcb-hole-inner",fill:i.drill,x:(E-B/2).toString(),y:(h-c/2).toString(),width:B.toString(),height:c.toString(),rx:u.toString(),ry:u.toString(),"data-type":"pcb_plated_hole_drill","data-pcb-layer":"drill"},value:"",children:[]}],value:""}]}if(t.shape==="rotated_pill_hole_with_rect_pad"){const r=t,g=r.rect_pad_width*Math.abs(e.a),a=r.rect_pad_height*Math.abs(e.a),I=(r.rect_border_radius??0)*Math.abs(e.a),c=r.hole_height*Math.abs(e.a),B=r.hole_width*Math.abs(e.a),C=r,Q=C.hole_offset_x??0,l=C.hole_offset_y??0,[E,h]=Ce(e,[r.x+Q,r.y+l]),u=Math.min(c,B)/2;return[{name:"g",type:"element",attributes:{"data-type":"pcb_plated_hole","data-pcb-layer":"through"},children:[{name:"rect",type:"element",attributes:{class:"pcb-hole-outer-pad",fill:i.copper.top,x:(-g/2).toString(),y:(-a/2).toString(),width:g.toString(),height:a.toString(),transform:`translate(${n} ${o}) rotate(${-r.rect_ccw_rotation})`,...I?{rx:I.toString(),ry:I.toString()}:{},"data-type":"pcb_plated_hole","data-pcb-layer":s},value:"",children:[]},{name:"rect",type:"element",attributes:{class:"pcb-hole-inner",fill:i.drill,x:(-B/2).toString(),y:(-c/2).toString(),width:B.toString(),height:c.toString(),rx:u.toString(),ry:u.toString(),transform:`translate(${E} ${h}) rotate(${-r.hole_ccw_rotation})`,"data-type":"pcb_plated_hole_drill","data-pcb-layer":"drill"},value:"",children:[]}],value:""}]}return[]}function E3t(t,A){const{transform:e,layer:i,colorMap:n}=A;if(!t.route||!Array.isArray(t.route))return[];let o=t.route.map((I,c)=>{const[B,C]=Ce(e,[I.x,I.y]);return c===0?`M ${B} ${C}`:`L ${B} ${C}`}).join(" ");const s=t.route[0],r=t.route[t.route.length-1];s&&r&&s.x===r.x&&s.y===r.y&&(o+=" Z");const g=t.layer||"top";if(i&&g!==i)return[];const a=g==="bottom"?n.silkscreen.bottom:n.silkscreen.top;return[{name:"path",type:"element",attributes:{class:`pcb-silkscreen pcb-silkscreen-${g}`,d:o,fill:"none",stroke:a,"stroke-width":(t.stroke_width*Math.abs(e.a)).toString(),"stroke-linecap":"round","stroke-linejoin":"round","data-pcb-component-id":t.pcb_component_id,"data-pcb-silkscreen-path-id":t.pcb_silkscreen_path_id,"data-type":"pcb_silkscreen_path","data-pcb-layer":g},value:"",children:[]}]}function h3t(t,A){const{transform:e,layer:i,colorMap:n}=A,{anchor_position:o,text:s,font_size:r=1,layer:g="top",ccw_rotation:a=0,anchor_alignment:I="center"}=t;if(i&&g!==i)return[];if(!o||typeof o.x!="number"||typeof o.y!="number")return console.error("Invalid anchor_position:",o),[];const[c,B]=Ce(e,[o.x,o.y]),C=r*Math.abs(e.a);let Q="middle",l="central";const E=0,h=0;switch(I){case"top_left":Q="start",l="text-before-edge";break;case"top_center":Q="middle",l="text-before-edge";break;case"top_right":Q="end",l="text-before-edge";break;case"center_left":Q="start",l="central";break;case"center_right":Q="end",l="central";break;case"bottom_left":Q="start",l="text-after-edge";break;case"bottom_center":Q="middle",l="text-after-edge";break;case"bottom_right":Q="end",l="text-after-edge";break;case"center":default:Q="middle",l="central";break}const u=Xi(gn(c,B),IB(-a*Math.PI/180),...g==="bottom"?[Ra(-1,1)]:[]),p=g==="bottom"?n.silkscreen.bottom:n.silkscreen.top,f=s.split(`
6050
6050
  `),b=f.length===1?[{type:"text",value:s,name:"",attributes:{},children:[]}]:f.map((k,m)=>({type:"element",name:"tspan",value:"",attributes:{x:"0",...m>0?{dy:C.toString()}:{}},children:[{type:"text",value:k,name:"",attributes:{},children:[]}]}));return[{name:"text",type:"element",attributes:{x:"0",y:"0",dx:E.toString(),dy:h.toString(),fill:p,"font-family":"Arial, sans-serif","font-size":C.toString(),"text-anchor":Q,"dominant-baseline":l,transform:pp(u),class:`pcb-silkscreen-text pcb-silkscreen-${g}`,"data-pcb-silkscreen-text-id":t.pcb_component_id,stroke:"none","data-type":"pcb_silkscreen_text","data-pcb-layer":g},children:b,value:""}]}function u3t(t,A){const{transform:e,layer:i,colorMap:n}=A,{center:o,width:s,height:r,layer:g="top",pcb_silkscreen_rect_id:a,stroke_width:I,is_filled:c,has_stroke:B,is_stroke_dashed:C}=t;if(i&&g!==i)return[];if(!o||typeof o.x!="number"||typeof o.y!="number"||typeof s!="number"||typeof r!="number")return console.error("Invalid rectangle data:",{center:o,width:s,height:r}),[];const[Q,l]=Ce(e,[o.x,o.y]),E=s*Math.abs(e.a),h=r*Math.abs(e.d),u=I*Math.abs(e.a),p=g==="bottom"?n.silkscreen.bottom:n.silkscreen.top,f={x:(Q-E/2).toString(),y:(l-h/2).toString(),width:E.toString(),height:h.toString(),class:`pcb-silkscreen-rect pcb-silkscreen-${g}`,"data-pcb-silkscreen-rect-id":a,"data-type":"pcb_silkscreen_rect","data-pcb-layer":g};f.fill=c?p:"none";let b;if(B===void 0?b=u>0:b=B,b){if(f.stroke=p,f["stroke-width"]=u.toString(),C){const k=.1*Math.abs(e.a),m=.05*Math.abs(e.a);f["stroke-dasharray"]=`${k} ${m}`}}else f.stroke="none";return[{name:"rect",type:"element",attributes:f,value:"",children:[]}]}function d3t(t,A){const{transform:e,layer:i,colorMap:n}=A,{center:o,radius:s,layer:r="top",pcb_silkscreen_circle_id:g,stroke_width:a=1}=t;if(i&&r!==i)return[];if(!o||typeof o.x!="number"||typeof o.y!="number"||typeof s!="number")return console.error("Invalid PCB Silkscreen Circle data:",{center:o,radius:s}),[];const[I,c]=Ce(e,[o.x,o.y]),B=s*Math.abs(e.a),C=a*Math.abs(e.a),Q=r==="bottom"?n.silkscreen.bottom:n.silkscreen.top;return[{name:"circle",type:"element",attributes:{cx:I.toString(),cy:c.toString(),r:B.toString(),class:`pcb-silkscreen-circle pcb-silkscreen-${r}`,stroke:Q,"stroke-width":C.toString(),"data-pcb-silkscreen-circle-id":g,"data-type":"pcb_silkscreen_circle","data-pcb-layer":r},value:"",children:[]}]}function p3t(t,A){const{transform:e,layer:i,colorMap:n}=A,{x1:o,y1:s,x2:r,y2:g,stroke_width:a,layer:I="top",pcb_silkscreen_line_id:c}=t;if(i&&I!==i)return[];if(typeof o!="number"||typeof s!="number"||typeof r!="number"||typeof g!="number")return console.error("Invalid coordinates:",{x1:o,y1:s,x2:r,y2:g}),[];const[B,C]=Ce(e,[o,s]),[Q,l]=Ce(e,[r,g]),E=a*Math.abs(e.a),h=I==="bottom"?n.silkscreen.bottom:n.silkscreen.top;return[{name:"line",type:"element",attributes:{x1:B.toString(),y1:C.toString(),x2:Q.toString(),y2:l.toString(),stroke:h,"stroke-width":E.toString(),class:`pcb-silkscreen-line pcb-silkscreen-${I}`,"data-pcb-silkscreen-line-id":c,"data-type":"pcb_silkscreen_line","data-pcb-layer":I},value:"",children:[]}]}function f3t(t){const A=[];for(let e=0;e<t.length-1;e++)A.push([t[e],t[e+1]]);return A}var qp={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)"},soldermask:{top:"rgb(200, 52, 52)",bottom:"rgb(77, 127, 196)"},drill:"#FF26E2",silkscreen:{top:"#f2eda1",bottom:"#5da9e9"},boardOutline:"rgba(255, 255, 255, 0.5)",debugComponent:{fill:null,stroke:null}};qp.drill,qp.silkscreen.top,qp.silkscreen.bottom,{...qp.copper};function Wx(t,A=qp){return A.copper[t]??"white"}function y3t(t,A){const{transform:e,layer:i,colorMap:n,renderSolderMask:o}=A;if(!t.route||!Array.isArray(t.route)||t.route.length<2)return[];const s=f3t(t.route),r=[];for(const[g,a]of s){const I=Ce(e,[g.x,g.y]),c=Ce(e,[a.x,a.y]),B="layer"in g?g.layer:"layer"in a?a.layer:null;if(!B||i&&B!==i)continue;const C=Wx(B,n),Q=n.soldermask[B]??C,l="width"in g?g.width:"width"in a?a.width:null,E=l?(l*Math.abs(e.a)).toString():"0.3";if(o){const h={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-trace",stroke:C,fill:"none",d:`M ${I[0]} ${I[1]} L ${c[0]} ${c[1]}`,"stroke-width":E,"stroke-linecap":"round","stroke-linejoin":"round","shape-rendering":"crispEdges","data-type":"pcb_trace","data-pcb-layer":B}},u={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-soldermask",stroke:Q,fill:"none",d:`M ${I[0]} ${I[1]} L ${c[0]} ${c[1]}`,"stroke-width":E,"stroke-linecap":"round","stroke-linejoin":"round","shape-rendering":"crispEdges","data-type":"pcb_soldermask","data-pcb-layer":B}};r.push(u,h)}else{const h={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-trace",stroke:Q,fill:"none",d:`M ${I[0]} ${I[1]} L ${c[0]} ${c[1]}`,"stroke-width":E,"stroke-linecap":"round","stroke-linejoin":"round","shape-rendering":"crispEdges","data-type":o?"pcb_soldermask":"pcb_trace","data-pcb-layer":B}};r.push(h)}}return r}function w3t(t,A){const{transform:e,layer:i,colorMap:n,renderSolderMask:o}=A;if(i&&t.layer!==i)return[];const s=!!t?.is_covered_with_solder_mask,r=o&&s,g=n.soldermask[t.layer]??n.soldermask.top;if(t.shape==="rect"||t.shape==="rotated_rect"){const a=t.width*Math.abs(e.a),I=t.height*Math.abs(e.d),[c,B]=Ce(e,[t.x,t.y]),Q=(t.corner_radius??t.rect_border_radius??0)*Math.abs(e.a);if(t.shape==="rotated_rect"&&t.ccw_rotation){const h={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad",fill:Wx(t.layer,n),x:(-a/2).toString(),y:(-I/2).toString(),width:a.toString(),height:I.toString(),transform:`translate(${c} ${B}) rotate(${-t.ccw_rotation})`,"data-type":"pcb_smtpad","data-pcb-layer":t.layer,...Q?{rx:Q.toString(),ry:Q.toString()}:{}}};if(!r)return[h];const u={name:h.name,type:h.type,value:"",children:[],attributes:{...h.attributes,class:"pcb-solder-mask",fill:g,"data-type":"pcb_soldermask"}};return[h,u]}const l={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad",fill:Wx(t.layer,n),x:(c-a/2).toString(),y:(B-I/2).toString(),width:a.toString(),height:I.toString(),"data-type":"pcb_smtpad","data-pcb-layer":t.layer,...Q?{rx:Q.toString(),ry:Q.toString()}:{}}};if(!r)return[l];const E={name:l.name,type:l.type,value:"",children:[],attributes:{...l.attributes,class:"pcb-solder-mask",fill:g,"data-type":"pcb_soldermask"}};return[l,E]}if(t.shape==="pill"){const a=t.width*Math.abs(e.a),I=t.height*Math.abs(e.d),c=t.radius*Math.abs(e.a),[B,C]=Ce(e,[t.x,t.y]),Q={name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-pad",fill:Wx(t.layer,n),x:(B-a/2).toString(),y:(C-I/2).toString(),width:a.toString(),height:I.toString(),rx:c.toString(),ry:c.toString(),"data-type":"pcb_smtpad","data-pcb-layer":t.layer}};if(!r)return[Q];const l={name:Q.name,type:Q.type,value:"",children:[],attributes:{...Q.attributes,class:"pcb-solder-mask",fill:g,"data-type":"pcb_soldermask"}};return[Q,l]}if(t.shape==="circle"){const a=t.radius*Math.abs(e.a),[I,c]=Ce(e,[t.x,t.y]),B={name:"circle",type:"element",value:"",children:[],attributes:{class:"pcb-pad",fill:Wx(t.layer,n),cx:I.toString(),cy:c.toString(),r:a.toString(),"data-type":"pcb_smtpad","data-pcb-layer":t.layer}};if(!r)return[B];const C={name:B.name,type:B.type,value:"",children:[],attributes:{...B.attributes,class:"pcb-solder-mask",fill:g,"data-type":"pcb_soldermask"}};return[B,C]}if(t.shape==="polygon"){const a=(t.points??[]).map(B=>Ce(e,[B.x,B.y])),I={name:"polygon",type:"element",value:"",children:[],attributes:{class:"pcb-pad",fill:Wx(t.layer,n),points:a.map(B=>B.join(",")).join(" "),"data-type":"pcb_smtpad","data-pcb-layer":t.layer}};if(!r)return[I];const c={name:I.name,type:I.type,value:"",children:[],attributes:{...I.attributes,class:"pcb-solder-mask",fill:g,"data-type":"pcb_soldermask"}};return[I,c]}return[]}function D3t(t,A){const{transform:e,colorMap:i}=A,{width:n,height:o,center:s,outline:r}=t;let g;if(r&&Array.isArray(r)&&r.length>=3)g=r.map((a,I)=>{const[c,B]=Ce(e,[a.x,a.y]);return I===0?`M ${c} ${B}`:`L ${c} ${B}`}).join(" ");else{const a=n/2,I=o/2,c=Ce(e,[s.x-a,s.y-I]),B=Ce(e,[s.x+a,s.y-I]),C=Ce(e,[s.x+a,s.y+I]),Q=Ce(e,[s.x-a,s.y+I]);g=`M ${c[0]} ${c[1]} L ${B[0]} ${B[1]} L ${C[0]} ${C[1]} L ${Q[0]} ${Q[1]}`}return g+=" Z",[{name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-board",d:g,fill:"none",stroke:i.boardOutline,"stroke-width":(.1*Math.abs(e.a)).toString(),"data-type":"pcb_board","data-pcb-layer":"board"}}]}function m3t(t,A){const{transform:e,colorMap:i,renderSolderMask:n}=A,o=Number(t.width),s=Number(t.height),r=Ce(e,[0,0]),g=Ce(e,[o,0]),a=Ce(e,[o,s]),I=Ce(e,[0,s]),c=`M ${r[0]} ${r[1]} L ${g[0]} ${g[1]} L ${a[0]} ${a[1]} L ${I[0]} ${I[1]} Z`;return t.covered_with_solder_mask,[{name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-panel",d:c,fill:"none",stroke:i.boardOutline,"stroke-width":(.1*Math.abs(e.a)).toString(),"data-type":"pcb_panel","data-pcb-layer":"board"}}]}function S3t(t,A){const{transform:e,colorMap:i}=A,[n,o]=Ce(e,[t.x,t.y]),s=t.outer_diameter*Math.abs(e.a),r=t.outer_diameter*Math.abs(e.a),g=t.hole_diameter*Math.abs(e.a),a=t.hole_diameter*Math.abs(e.a),I=Math.min(s,r)/2,c=Math.min(g,a)/2;return{name:"g",type:"element",attributes:{"data-type":"pcb_via","data-pcb-layer":"through"},children:[{name:"circle",type:"element",attributes:{class:"pcb-hole-outer",fill:i.copper.top,cx:n.toString(),cy:o.toString(),r:I.toString(),"data-type":"pcb_via","data-pcb-layer":"top"}},{name:"circle",type:"element",attributes:{class:"pcb-hole-inner",fill:i.drill,cx:n.toString(),cy:o.toString(),r:c.toString(),"data-type":"pcb_via","data-pcb-layer":"drill"}}]}}function b3t(t,A){const{transform:e,colorMap:i}=A,[n,o]=Ce(e,[t.x,t.y]);if(t.hole_shape==="circle"||t.hole_shape==="square"){const s=t.hole_diameter*Math.abs(e.a),r=s/2;return t.hole_shape==="circle"?[{name:"circle",type:"element",attributes:{class:"pcb-hole",cx:n.toString(),cy:o.toString(),r:r.toString(),fill:i.drill,"data-type":"pcb_hole","data-pcb-layer":"drill"},children:[],value:""}]:[{name:"rect",type:"element",attributes:{class:"pcb-hole",x:(n-r).toString(),y:(o-r).toString(),width:s.toString(),height:s.toString(),fill:i.drill,"data-type":"pcb_hole","data-pcb-layer":"drill"},children:[],value:""}]}if(t.hole_shape==="oval"){const s=t.hole_width*Math.abs(e.a),r=t.hole_height*Math.abs(e.a),g=s/2,a=r/2;return[{name:"ellipse",type:"element",attributes:{class:"pcb-hole",cx:n.toString(),cy:o.toString(),rx:g.toString(),ry:a.toString(),fill:i.drill,"data-type":"pcb_hole","data-pcb-layer":"drill"},children:[],value:""}]}if(t.hole_shape==="pill"){const s=t.hole_width*Math.abs(e.a),r=t.hole_height*Math.abs(e.a),g=s>r,a=Math.min(s,r)/2,I=Math.abs(g?s-r:r-s),c=g?`M${n-I/2},${o-a} h${I} a${a},${a} 0 0 1 0,${r} h-${I} a${a},${a} 0 0 1 0,-${r} z`:`M${n-a},${o-I/2} v${I} a${a},${a} 0 0 0 ${s},0 v-${I} a${a},${a} 0 0 0 -${s},0 z`;return[{name:"path",type:"element",attributes:{class:"pcb-hole",fill:i.drill,d:c,"data-type":"pcb_hole","data-pcb-layer":"drill"},children:[],value:""}]}if(t.hole_shape==="rotated_pill"){const s=t.hole_width*Math.abs(e.a),r=t.hole_height*Math.abs(e.a),g="ccw_rotation"in t?t.ccw_rotation??0:0,a=s>r,I=Math.min(s,r)/2,c=Math.abs(a?s-r:r-s),B=a?`M${-c/2},${-I} h${c} a${I},${I} 0 0 1 0,${r} h-${c} a${I},${I} 0 0 1 0,-${r} z`:`M${-I},${-c/2} v${c} a${I},${I} 0 0 0 ${s},0 v-${c} a${I},${I} 0 0 0 -${s},0 z`;return[{name:"path",type:"element",attributes:{class:"pcb-hole",fill:i.drill,d:B,transform:`translate(${n} ${o}) rotate(${-g})`,"data-type":"pcb_hole","data-pcb-layer":"drill"},children:[],value:""}]}return[]}var k3t=(t,A)=>{const e=Fi(A).pcb_smtpad.get(t);if(e&&"x"in e&&"y"in e)return{x:e.x,y:e.y};const i=Fi(A).pcb_plated_hole.get(t);return i&&"x"in i&&"y"in i?{x:i.x,y:i.y}:null},G3t=(t,A,e,i)=>{const n=e.getIdsConnectedToNet(A);let o=null,s=1/0;for(const r of n){const g=k3t(r,i);if(g){const a=t.x-g.x,I=t.y-g.y,c=Math.sqrt(a*a+I*I);c>0&&c<s&&(s=c,o=g)}}return o};function x3t(t,A){const{transform:e}=A,i=WS(t),n=t.filter(g=>g.type==="pcb_port"),o=t.filter(g=>g.type==="source_trace"),s=[];n.forEach((g,a)=>{const I=g.pcb_port_id;if(!I)return;const c=i.getNetConnectedToId(I);if(!c)return;let B=!1;const C=Fi(t).source_port.getWhere({pcb_port_id:I});if(C&&C.source_port_id){const E=C.source_port_id;for(const h of o)if(Array.isArray(h.connected_source_port_ids)&&h.connected_source_port_ids.includes(E)&&Array.isArray(h.connected_source_net_ids)&&h.connected_source_net_ids.length>0){B=!0;break}}const Q={x:g.x,y:g.y},l=G3t(Q,c,i,t);l&&s.push({key:`${I}-${a}`,startPoint:Q,endPoint:l,isInNet:B})});const r=[];for(const g of s){const a=Ce(e,[g.startPoint.x,g.startPoint.y]),I=Ce(e,[g.endPoint.x,g.endPoint.y]),c={x1:a[0].toString(),y1:a[1].toString(),x2:I[0].toString(),y2:I[1].toString(),stroke:"white","stroke-width":"1","stroke-dasharray":"6,6","data-type":"pcb_rats_nest","data-pcb-layer":"overlay"};r.push({name:"line",type:"element",attributes:c,value:"",children:[]})}return r}function F3t(t,A){const{transform:e,colorMap:i}=A;if(t.shape==="rect"){const n=t,[o,s]=Ce(e,[n.center.x,n.center.y]),r=n.width*Math.abs(e.a),g=n.height*Math.abs(e.d),a=-(n.rotation??0);return[{name:"rect",type:"element",attributes:{class:"pcb-cutout pcb-cutout-rect",x:(-r/2).toString(),y:(-g/2).toString(),width:r.toString(),height:g.toString(),fill:i.drill,transform:pp(Xi(gn(o,s),IB(a*Math.PI/180))),"data-type":"pcb_cutout","data-pcb-layer":"drill"},children:[],value:""}]}if(t.shape==="circle"){const n=t,[o,s]=Ce(e,[n.center.x,n.center.y]),r=n.radius*Math.abs(e.a);return[{name:"circle",type:"element",attributes:{class:"pcb-cutout pcb-cutout-circle",cx:o.toString(),cy:s.toString(),r:r.toString(),fill:i.drill,"data-type":"pcb_cutout","data-pcb-layer":"drill"},children:[],value:""}]}if(t.shape==="polygon"){const n=t;return!n.points||n.points.length===0?[]:[{name:"polygon",type:"element",attributes:{class:"pcb-cutout pcb-cutout-polygon",points:n.points.map(r=>Ce(e,[r.x,r.y])).map(r=>`${r[0]},${r[1]}`).join(" "),fill:i.drill,"data-type":"pcb_cutout","data-pcb-layer":"drill"},children:[],value:""}]}return[]}function nae(t,A){if(t.length===0)return"";const e=t.map(n=>{const[o,s]=Ce(A,[n.x,n.y]);return{...n,x:o,y:s}});let i=`M ${e[0].x} ${e[0].y}`;for(let n=0;n<e.length;n++){const o=e[n],s=e[(n+1)%e.length];if(o.bulge){if(Math.hypot(s.x-o.x,s.y-o.y)<1e-9)continue;const r=o.bulge,g=s.x-o.x,a=s.y-o.y,I=Math.hypot(g,a),c=Math.abs(I/4/r*(r*r+1)),B=r<0?1:0,C=Math.abs(r)>1?1:0;i+=` A ${c} ${c} 0 ${C} ${B} ${s.x} ${s.y}`}else i+=` L ${s.x} ${s.y}`}return i+=" Z",i}function _3t(t,A){const{transform:e,layer:i,colorMap:n}=A,{layer:o}=t;if(i&&o!==i)return[];const s=Wx(o,n),r="0.5";if(t.shape==="rect"){const[g,a]=Ce(e,[t.center.x,t.center.y]),I=t.width*Math.abs(e.a),c=t.height*Math.abs(e.d),B=-(t.rotation??0);return[{name:"rect",type:"element",attributes:{class:"pcb-copper-pour pcb-copper-pour-rect",x:(-I/2).toString(),y:(-c/2).toString(),width:I.toString(),height:c.toString(),fill:s,"fill-opacity":r,transform:pp(Xi(gn(g,a),IB(B*Math.PI/180))),"data-type":"pcb_copper_pour","data-pcb-layer":o},children:[],value:""}]}if(t.shape==="polygon")return!t.points||t.points.length===0?[]:[{name:"polygon",type:"element",attributes:{class:"pcb-copper-pour pcb-copper-pour-polygon",points:t.points.map(I=>Ce(e,[I.x,I.y])).map(I=>`${I[0]},${I[1]}`).join(" "),fill:s,"fill-opacity":r,"data-type":"pcb_copper_pour","data-pcb-layer":o},children:[],value:""}];if(t.shape==="brep"){const{brep_shape:g}=t;let a=nae(g.outer_ring.vertices,e);for(const I of g.inner_rings??[])a+=` ${nae(I.vertices,e)}`;return[{name:"path",type:"element",attributes:{class:"pcb-copper-pour pcb-copper-pour-brep",d:a,fill:s,"fill-rule":"evenodd","fill-opacity":r,"data-type":"pcb_copper_pour","data-pcb-layer":o},children:[],value:""}]}return[]}var R3t="rgba(255, 255, 255, 0.5)",oae="pcb-grid-pattern";function N3t({grid:t,svgWidth:A,svgHeight:e}){if(!t)return{};const i=t.lineColor??R3t,n=t.cellSize,o=t.majorCellSize,s=t.majorLineColor??i;if(o!==void 0){if(!n||n<=0)throw new Error("grid.majorCellSize requires a positive grid.cellSize");if(o<=0)throw new Error("grid.majorCellSize must be a positive multiple of grid.cellSize");const c=o/n,B=Math.round(c);if(!Number.isFinite(c)||Math.abs(c-B)>1e-6)throw new Error("grid.majorCellSize must be a positive multiple of grid.cellSize")}if(!n||n<=0)return{};const r=o!==void 0,g=r?M3t(n,o,i,s):[{name:"path",type:"element",value:"",attributes:{d:`M ${n} 0 L 0 0 0 ${n}`,fill:"none",stroke:i,"stroke-width":"1","shape-rendering":"crispEdges"},children:[]}],a={name:"defs",type:"element",value:"",attributes:{},children:[{name:"pattern",type:"element",value:"",attributes:{id:oae,width:r?o.toString():n.toString(),height:r?o.toString():n.toString(),patternUnits:"userSpaceOnUse"},children:g}]},I={name:"rect",type:"element",value:"",attributes:{x:"0",y:"0",width:A.toString(),height:e.toString(),fill:`url(#${oae})`,"pointer-events":"none","data-type":"pcb_grid","data-pcb-layer":"global"},children:[]};return{defs:a,rect:I}}function M3t(t,A,e,i){const n=[],o=Math.round(A/t);for(let s=0;s<o;s+=1){const g=Number((s*t).toFixed(6)).toString(),a=s===0?i:e,I=A.toString();n.push({name:"line",type:"element",value:"",attributes:{x1:g,y1:"0",x2:g,y2:I,stroke:a,"stroke-width":"1","shape-rendering":"crispEdges"},children:[]}),n.push({name:"line",type:"element",value:"",attributes:{x1:"0",y1:g,x2:I,y2:g,stroke:a,"stroke-width":"1","shape-rendering":"crispEdges"},children:[]})}return n}function v3t(t,A){const{transform:e}=A,{center:i,width:n,height:o,rotation:s=0}=t,[r,g]=Ce(e,[i.x,i.y]),a=n*Math.abs(e.a),I=o*Math.abs(e.d),c=`translate(${r}, ${g}) rotate(${-s}) scale(1, -1)`;return!A.colorMap.debugComponent?.fill&&!A.colorMap.debugComponent?.stroke?[]:[{name:"g",type:"element",attributes:{transform:c,"data-type":"pcb_component","data-pcb-layer":t.layer??"top"},children:[{name:"rect",type:"element",attributes:{class:"pcb-component",x:(-a/2).toString(),y:(-I/2).toString(),width:a.toString(),height:I.toString(),fill:A.colorMap.debugComponent.fill??"transparent",stroke:A.colorMap.debugComponent.stroke??"transparent","data-type":"pcb_component","data-pcb-layer":t.layer??"top"}}],value:""}]}var U3t="rgba(100, 200, 255, 0.6)",L3t=.1;function H3t(t,A){const{transform:e}=A,{center:i,width:n,height:o}=t,s=Array.isArray(t.outline)?t.outline:void 0,r=L3t*Math.abs(e.a),g=.3*Math.abs(e.a),a=.15*Math.abs(e.a),I={class:"pcb-group",fill:"none",stroke:U3t,"stroke-width":r.toString(),"stroke-dasharray":`${g} ${a}`,"data-type":"pcb_group","data-pcb-group-id":t.pcb_group_id,"data-pcb-layer":"overlay"};if(t.name&&(I["data-group-name"]=t.name),s&&s.length>=3&&s.every(D=>D&&typeof D.x=="number"&&typeof D.y=="number")){const D=s.map((k,m)=>{const[F,G]=Ce(e,[k.x,k.y]);return m===0?`M ${F} ${G}`:`L ${F} ${G}`}).join(" ");return[{name:"path",type:"element",value:"",children:[],attributes:{...I,d:`${D} Z`}}]}if(!i||typeof i.x!="number"||typeof i.y!="number"||typeof n!="number"||typeof o!="number")return console.error("Invalid pcb_group data",{center:i,width:n,height:o}),[];const c=n/2,B=o/2,[C,Q]=Ce(e,[i.x-c,i.y+B]),[l,E]=Ce(e,[i.x+c,i.y-B]),h=Math.min(C,l),u=Math.min(Q,E),p=Math.abs(l-C),f=Math.abs(E-Q);return[{name:"rect",type:"element",value:"",attributes:{...I,x:h.toString(),y:u.toString(),width:p.toString(),height:f.toString()},children:[]}]}function Y3t(t){return t.find(e=>e.type==="project_software_metadata"||e.type==="source_project_metadata")?.software_used_string}var J3t={version:"0.0.247"},K3t=J3t.version,T3t={pcb_background:0,pcb_boundary:1,pcb_panel:5,pcb_board:10,pcb_cutout:15,pcb_hole:18,pcb_plated_hole_drill:19,pcb_plated_hole:20,pcb_trace:30,pcb_smtpad:30,pcb_copper_pour:35,pcb_via:36,pcb_soldermask:40,pcb_solder_paste:45,pcb_silkscreen_text:50,pcb_silkscreen_path:50,pcb_silkscreen_rect:50,pcb_silkscreen_circle:50,pcb_silkscreen_line:50,pcb_component:60,pcb_fabrication_note_text:70,pcb_fabrication_note_path:70,pcb_fabrication_note_rect:70,pcb_fabrication_note_dimension:70,pcb_note_dimension:70,pcb_note_text:70,pcb_note_rect:70,pcb_note_path:70,pcb_note_line:70,pcb_trace_error:80,pcb_rats_nest:85},sae=100;function rae(t){return t.map((A,e)=>({object:A,index:e,layerPriority:q3t(A.attributes?.["data-pcb-layer"]??void 0),typePriority:P3t(A.attributes?.["data-type"]??void 0)})).sort((A,e)=>A.layerPriority!==e.layerPriority?A.layerPriority-e.layerPriority:A.typePriority!==e.typePriority?A.typePriority-e.typePriority:A.index-e.index).map(({object:A})=>A)}function q3t(t){if(!t)return 500;const A=t.toLowerCase();if(A==="global")return-100;if(A==="bottom")return 0;if(A==="board")return 2;if(A.startsWith("inner")){const e=A.match(/\d+/);return 5+(e?parseInt(e[0],10):0)}return A==="through"?18:A==="top"?20:A==="drill"?30:A==="overlay"?40:10}function P3t(t){return t?T3t[t]??sae:sae}function O3t(t,A){const e=A?.drawPaddingOutsideBoard??!0,i=A?.layer,n=A?.colorOverrides,o={...qp.copper};if(n?.copper)for(const[QA,kA]of Object.entries(n.copper))kA!==void 0&&(o[QA]=kA);const s={copper:o,drill:n?.drill??qp.drill,silkscreen:{top:n?.silkscreen?.top??qp.silkscreen.top,bottom:n?.silkscreen?.bottom??qp.silkscreen.bottom},boardOutline:n?.boardOutline??qp.boardOutline,soldermask:{top:n?.soldermask?.top??qp.soldermask.top,bottom:n?.soldermask?.bottom??qp.soldermask.bottom},debugComponent:{fill:n?.debugComponent?.fill??qp.debugComponent.fill,stroke:n?.debugComponent?.stroke??qp.debugComponent.stroke}};let r=Number.POSITIVE_INFINITY,g=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,I=Number.NEGATIVE_INFINITY,c=Number.POSITIVE_INFINITY,B=Number.POSITIVE_INFINITY,C=Number.NEGATIVE_INFINITY,Q=Number.NEGATIVE_INFINITY;for(const QA of t)if(QA.type==="pcb_panel"){const kA=QA,SA=Number(kA.width),qA=Number(kA.height),te={x:SA/2,y:qA/2};gA(te,SA,qA),lA(te,SA,qA)}else if(QA.type==="pcb_board")QA.outline&&Array.isArray(QA.outline)&&QA.outline.length>=3?(yA(QA.outline),xA(QA.outline)):"center"in QA&&"width"in QA&&"height"in QA&&(gA(QA.center,QA.width,QA.height),lA(QA.center,QA.width,QA.height));else if("x"in QA&&"y"in QA)gA({x:QA.x,y:QA.y},0,0);else if(QA.type==="pcb_smtpad"){const kA=QA;kA.shape==="rect"||kA.shape==="rotated_rect"||kA.shape==="pill"?gA({x:kA.x,y:kA.y},kA.width,kA.height):kA.shape==="circle"?gA({x:kA.x,y:kA.y},kA.radius*2,kA.radius*2):kA.shape==="polygon"&&MA(kA.points)}else if("route"in QA)MA(QA.route);else if(QA.type==="pcb_note_rect"||QA.type==="pcb_fabrication_note_rect")gA(QA.center,QA.width,QA.height);else if(QA.type==="pcb_cutout"){const kA=QA;kA.shape==="rect"?gA(kA.center,kA.width,kA.height):kA.shape==="circle"?gA(kA.center,kA.radius*2,kA.radius*2):kA.shape==="polygon"&&MA(kA.points)}else QA.type==="pcb_silkscreen_text"||QA.type==="pcb_silkscreen_rect"||QA.type==="pcb_silkscreen_circle"||QA.type==="pcb_silkscreen_line"?vA(QA):QA.type==="pcb_copper_pour"&&(QA.shape==="rect"?gA(QA.center,QA.width,QA.height):QA.shape==="polygon"&&MA(QA.points));const l=e?1:0,E=e||!Number.isFinite(c)?r:c,h=e||!Number.isFinite(B)?g:B,u=e||!Number.isFinite(C)?a:C,p=e||!Number.isFinite(Q)?I:Q,f=u-E+2*l,b=p-h+2*l;let D=A?.width??800,k=A?.height??600;if(A?.matchBoardAspectRatio){const QA=C-c,kA=Q-B;if(QA>0&&kA>0){const SA=QA/kA;A?.width&&!A?.height?k=A.width/SA:A?.height&&!A?.width?D=A.height*SA:k=D/SA}}const m=[];for(const QA of t)"route"in QA&&QA.route!==void 0&&m.push(QA.route);const F=D/f,G=k/b,U=Math.min(F,G),M=(D-f*U)/2,J=(k-b*U)/2,P=Xi(gn(M-E*U+l*U,k-J+h*U-l*U),Ra(U,-U)),q={transform:P,layer:i,shouldDrawErrors:A?.shouldDrawErrors,showPcbGroups:A?.showPcbGroups,drawPaddingOutsideBoard:e,colorMap:s,renderSolderMask:A?.renderSolderMask},O=t.flatMap(QA=>W3t({elm:QA,circuitJson:t,ctx:q}));let j=rae(O);for(const QA of t)if("stroke_width"in QA){String(U*QA.stroke_width);break}if(A?.shouldDrawRatsNest){const QA=x3t(t,q);j=rae([...j,...QA])}const eA=[{name:"style",type:"element",value:"",attributes:{},children:[{type:"text",value:"",name:"",attributes:{},children:[]}]}],oA=N3t({grid:A?.grid,svgWidth:D,svgHeight:k});oA.defs&&eA.push(oA.defs),eA.push({name:"rect",type:"element",value:"",attributes:{class:"boundary",x:"0",y:"0",fill:A?.backgroundColor??"#000",width:D.toString(),height:k.toString(),"data-type":"pcb_background","data-pcb-layer":"global"},children:[]}),e&&eA.push(Z3t(P,r,g,a,I)),eA.push(...j),oA.rect&&eA.push(oA.rect);const IA=Y3t(t),iA=K3t,nA={name:"svg",type:"element",attributes:{xmlns:"http://www.w3.org/2000/svg",width:D.toString(),height:k.toString(),...IA&&{"data-software-used-string":IA},...A?.includeVersion&&{"data-circuit-to-svg-version":iA}},value:"",children:eA.filter(QA=>QA!==null)};try{return g_(nA)}catch(QA){throw console.error("Error stringifying SVG object:",QA),QA}function gA(QA,kA,SA){const qA=kA/2,te=SA/2;r=Math.min(r,QA.x-qA),g=Math.min(g,QA.y-te),a=Math.max(a,QA.x+qA),I=Math.max(I,QA.y+te)}function lA(QA,kA,SA){const qA=kA/2,te=SA/2;c=Math.min(c,QA.x-qA),B=Math.min(B,QA.y-te),C=Math.max(C,QA.x+qA),Q=Math.max(Q,QA.y+te)}function yA(QA){for(const kA of QA)r=Math.min(r,kA.x),g=Math.min(g,kA.y),a=Math.max(a,kA.x),I=Math.max(I,kA.y)}function xA(QA){for(const kA of QA)c=Math.min(c,kA.x),B=Math.min(B,kA.y),C=Math.max(C,kA.x),Q=Math.max(Q,kA.y)}function MA(QA){for(const kA of QA)r=Math.min(r,kA.x),g=Math.min(g,kA.y),a=Math.max(a,kA.x),I=Math.max(I,kA.y)}function vA(QA){if(QA.type==="pcb_silkscreen_text")gA(QA.anchor_position,0,0);else if(QA.type==="pcb_silkscreen_path")MA(QA.route);else if(QA.type==="pcb_silkscreen_rect")gA(QA.center,QA.width,QA.height);else if(QA.type==="pcb_silkscreen_circle")gA(QA.center,QA.radius*2,QA.radius*2);else if(QA.type==="pcb_silkscreen_line")gA({x:QA.x1,y:QA.y1},0,0),gA({x:QA.x2,y:QA.y2},0,0);else if(QA.type==="pcb_cutout"){const kA=QA;kA.shape==="rect"?gA(kA.center,kA.width,kA.height):kA.shape==="circle"?gA(kA.center,kA.radius*2,kA.radius*2):kA.shape==="polygon"&&MA(kA.points)}}}function W3t({elm:t,circuitJson:A,ctx:e}){switch(t.type){case"pcb_trace_error":return W4t(t,A,e).filter(Boolean);case"pcb_footprint_overlap_error":return j4t(t,A,e).filter(Boolean);case"pcb_component":return v3t(t,e).filter(Boolean);case"pcb_trace":return y3t(t,e);case"pcb_copper_pour":return _3t(t,e);case"pcb_plated_hole":return l3t(t,e).filter(Boolean);case"pcb_hole":return b3t(t,e);case"pcb_smtpad":return w3t(t,e);case"pcb_silkscreen_text":return h3t(t,e);case"pcb_silkscreen_rect":return u3t(t,e);case"pcb_silkscreen_circle":return d3t(t,e);case"pcb_silkscreen_line":return p3t(t,e);case"pcb_fabrication_note_path":return z4t(t,e);case"pcb_fabrication_note_text":return X4t(t,e);case"pcb_fabrication_note_rect":return e3t(t,e);case"pcb_fabrication_note_dimension":return i3t(t,e);case"pcb_note_dimension":return o3t(t,e);case"pcb_note_text":return r3t(t,e);case"pcb_note_rect":return I3t(t,e);case"pcb_note_path":return B3t(t,e);case"pcb_note_line":return Q3t(t,e);case"pcb_silkscreen_path":return E3t(t,e);case"pcb_panel":return e.drawPaddingOutsideBoard?m3t(t,e):[];case"pcb_board":return e.drawPaddingOutsideBoard?D3t(t,e):[];case"pcb_via":return S3t(t,e);case"pcb_cutout":return F3t(t,e);case"pcb_group":return e.showPcbGroups?H3t(t,e):[];default:return[]}}function Z3t(t,A,e,i,n){const[o,s]=Ce(t,[A,e]),[r,g]=Ce(t,[i,n]),a=Math.abs(r-o),I=Math.abs(g-s),c=Math.min(o,r),B=Math.min(s,g);return{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-boundary",fill:"none",stroke:"#fff","stroke-width":"0.3",x:c.toString(),y:B.toString(),width:a.toString(),height:I.toString(),"data-type":"pcb_boundary","data-pcb-layer":"global"}}}var MpA=ZPA(),ZW=_3A(),SM=pOA(),V3t=bPA(),gae=Lo(),j3t=Lb();const z3t=kf(j3t);function aae(t,A){let{x:e,y:i,z:n}=t;if(A.axisMapping){const o={x:e,y:i,z:n};A.axisMapping.x&&(e=vpA(o,A.axisMapping.x)),A.axisMapping.y&&(i=vpA(o,A.axisMapping.y)),A.axisMapping.z&&(n=vpA(o,A.axisMapping.z))}if(e*=A.flipX??1,i*=A.flipY??1,n*=A.flipZ??1,A.rotation){if(A.rotation.x){const o=A.rotation.x*Math.PI/180,s=Math.cos(o),r=Math.sin(o),g=i*s-n*r,a=i*r+n*s;i=g,n=a}if(A.rotation.y){const o=A.rotation.y*Math.PI/180,s=Math.cos(o),r=Math.sin(o),g=e*s+n*r,a=-e*r+n*s;e=g,n=a}if(A.rotation.z){const o=A.rotation.z*Math.PI/180,s=Math.cos(o),r=Math.sin(o),g=e*s-i*r,a=e*r+i*s;e=g,i=a}}return{x:e,y:i,z:n}}function vpA(t,A){switch(A){case"x":return t.x;case"y":return t.y;case"z":return t.z;case"-x":return-t.x;case"-y":return-t.y;case"-z":return-t.z;default:return 0}}function VW(t,A){return t.map(e=>({...e,vertices:e.vertices.map(i=>aae(i,A)),normal:aae(e.normal,A)}))}var jW={Z_UP_TO_Y_UP:{axisMapping:{x:"x",y:"-z",z:"y"}},Z_UP_TO_Y_UP_USB_FIX:{axisMapping:{x:"x",y:"-z",z:"y"},flipZ:-1},IDENTITY:{}},UpA=new Map;async function X3t(t,A){const e=`${t}:${JSON.stringify(A??{})}`;if(UpA.has(e))return UpA.get(e);const n=await(await fetch(t)).arrayBuffer(),o=$3t(n,A);return UpA.set(e,o),o}function $3t(t,A){const e=new DataView(t);return new TextDecoder().decode(t.slice(0,5)).toLowerCase()==="solid"?APt(t,A):ePt(e,A)}function APt(t,A){const i=new TextDecoder().decode(t).split(`
6051
- `).map(g=>g.trim()),n=[];let o=0;for(;o<i.length;){const g=i[o];if(g&&g.startsWith("facet normal")){const a=g.match(/facet normal\s+([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)\s+([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)\s+([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)/),I=a?{x:parseFloat(a[1]),y:parseFloat(a[2]),z:parseFloat(a[3])}:{x:0,y:0,z:1};o++;const c=[];for(;o<i.length&&i[o]&&!i[o].startsWith("endfacet");){const B=i[o];if(B.startsWith("vertex")){const C=B.match(/vertex\s+([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)\s+([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)\s+([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)/);C&&c.push({x:parseFloat(C[1]),y:parseFloat(C[2]),z:parseFloat(C[3])})}o++}c.length===3&&n.push({vertices:[c[0],c[1],c[2]],normal:I})}o++}const s=A??jW.Z_UP_TO_Y_UP,r=VW(n,s);return{triangles:r,boundingBox:Iae(r)}}function ePt(t,A){let e=80;const i=t.getUint32(e,!0);e+=4;const n=[];for(let r=0;r<i;r++){const g={x:t.getFloat32(e,!0),y:t.getFloat32(e+4,!0),z:t.getFloat32(e+8,!0)};e+=12;const a=[{x:t.getFloat32(e,!0),y:t.getFloat32(e+4,!0),z:t.getFloat32(e+8,!0)},{x:t.getFloat32(e+12,!0),y:t.getFloat32(e+16,!0),z:t.getFloat32(e+20,!0)},{x:t.getFloat32(e+24,!0),y:t.getFloat32(e+28,!0),z:t.getFloat32(e+32,!0)}];e+=36,e+=2,n.push({vertices:a,normal:g})}const o=A??jW.Z_UP_TO_Y_UP,s=VW(n,o);return{triangles:s,boundingBox:Iae(s)}}function Iae(t){if(t.length===0)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}};let A=1/0,e=1/0,i=1/0,n=-1/0,o=-1/0,s=-1/0;for(const r of t)for(const g of r.vertices)A=Math.min(A,g.x),e=Math.min(e,g.y),i=Math.min(i,g.z),n=Math.max(n,g.x),o=Math.max(o,g.y),s=Math.max(s,g.z);return{min:{x:A,y:e,z:i},max:{x:n,y:o,z:s}}}var LpA=new Map;async function tPt(t,A){const e=`${t}:${JSON.stringify(A??{})}`;if(LpA.has(e))return LpA.get(e);const n=await(await fetch(t)).text(),o=iPt(n,A);return LpA.set(e,o),o}function iPt(t,A){const e=t.split(/\r?\n/),i=[],n=[],o=[],s=[],r=new Map;let g,a=0;const I=new Map;for(const C of e){const Q=C.trim();if(Q.startsWith("v ")){const l=Q.split(/\s+/),E=l[1],h=l[2],u=l[3];if(i.push({x:parseFloat(E),y:parseFloat(h),z:parseFloat(u)}),l.length>=7){const[p,f,b]=l.slice(4,7);let D=Number(p),k=Number(f),m=Number(b);D<=1&&k<=1&&m<=1&&(D*=255,k*=255,m*=255),n.push([D,k,m,1])}else n.push(void 0)}else if(Q.startsWith("vn ")){const l=Q.split(/\s+/),E=l[1],h=l[2],u=l[3];o.push({x:parseFloat(E),y:parseFloat(h),z:parseFloat(u)})}else if(Q.startsWith("newmtl ")){const l=Q.split(/\s+/)[1];r.set(l,{name:l}),I.set(l,a++),g=l}else if(Q.startsWith("Kd ")&&g){const l=Q.split(/\s+/),E=l[1],h=l[2],u=l[3];let p=parseFloat(E),f=parseFloat(h),b=parseFloat(u);p<=1&&f<=1&&b<=1&&(p*=255,f*=255,b*=255);const D=r.get(g);D.color=[p,f,b,1]}else if(Q.startsWith("Ka ")&&g){const l=Q.split(/\s+/),E=l[1],h=l[2],u=l[3];let p=parseFloat(E),f=parseFloat(h),b=parseFloat(u);p<=1&&f<=1&&b<=1&&(p*=255,f*=255,b*=255);const D=r.get(g);D.ambient=[p,f,b,1]}else if(Q.startsWith("Ks ")&&g){const l=Q.split(/\s+/),E=l[1],h=l[2],u=l[3];let p=parseFloat(E),f=parseFloat(h),b=parseFloat(u);p<=1&&f<=1&&b<=1&&(p*=255,f*=255,b*=255);const D=r.get(g);D.specular=[p,f,b,1]}else if(Q.startsWith("Ns ")&&g){const l=parseFloat(Q.split(/\s+/)[1]),E=r.get(g);E.shininess=l}else if(Q.startsWith("d ")&&g){const l=parseFloat(Q.split(/\s+/)[1]),E=r.get(g);E.dissolve=l}else if(Q==="endmtl")g=void 0;else if(Q.startsWith("usemtl "))g=Q.split(/\s+/)[1];else if(Q.startsWith("f ")){const E=Q.slice(2).trim().split(/\s+/).map(h=>{const[u,p,f]=h.split("/");return{v:parseInt(u)-1,n:f?parseInt(f)-1:void 0}});for(let h=1;h<E.length-1;h++){const u=E[0],p=E[h],f=E[h+1],b=i[u.v],D=i[p.v],k=i[f.v];let m;if(u.n!==void 0&&o[u.n])m=o[u.n];else if(p.n!==void 0&&o[p.n])m=o[p.n];else if(f.n!==void 0&&o[f.n])m=o[f.n];else{const U={x:D.x-b.x,y:D.y-b.y,z:D.z-b.z},M={x:k.x-b.x,y:k.y-b.y,z:k.z-b.z};m={x:U.y*M.z-U.z*M.y,y:U.z*M.x-U.x*M.z,z:U.x*M.y-U.y*M.x}}const F={vertices:[b,D,k],normal:m};g&&I.has(g)&&(F.materialIndex=I.get(g));const G=n[u.v]??n[p.v]??n[f.v];G&&(F.color=G),s.push(F)}}}const c=A??jW.IDENTITY,B=VW(s,c);return{triangles:B,boundingBox:nPt(B),materials:r.size>0?r:void 0,materialIndexMap:r.size>0?I:void 0}}function nPt(t){if(t.length===0)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}};let A=1/0,e=1/0,i=1/0,n=-1/0,o=-1/0,s=-1/0;for(const r of t)for(const g of r.vertices)g.x<A&&(A=g.x),g.y<e&&(e=g.y),g.z<i&&(i=g.z),g.x>n&&(n=g.x),g.y>o&&(o=g.y),g.z>s&&(s=g.z);return{min:{x:A,y:e,z:i},max:{x:n,y:o,z:s}}}var HpA=new Map;async function oPt(t,A){const e=`${t}:${JSON.stringify(A??{})}`;if(HpA.has(e))return HpA.get(e);const n=await(await fetch(t)).arrayBuffer(),o=cae(n,A);return HpA.set(e,o),o}function cae(t,A){const e=new DataView(t);let i=0;const n=e.getUint32(i,!0);if(i+=4,n!==1179937895)throw new Error("Invalid GLB file: incorrect magic number");const o=e.getUint32(i,!0);if(i+=4,o!==2)throw new Error(`Unsupported GLB version: ${o}`);const s=e.getUint32(i,!0);i+=4;const r=e.getUint32(i,!0);i+=4;const g=e.getUint32(i,!0);if(i+=4,g!==1313821514)throw new Error("Expected JSON chunk");const a=new Uint8Array(t,i,r),I=new TextDecoder().decode(a),c=JSON.parse(I);i+=r;let B;if(i<s){const h=e.getUint32(i,!0);i+=4;const u=e.getUint32(i,!0);i+=4,u===5130562&&(B=t.slice(i,i+h))}const C=rPt(c,B),l=VW(C,A??{axisMapping:{x:"x",y:"z",z:"y"}});return l.some(h=>h.color!==void 0)?sPt(l):{triangles:l,boundingBox:Cae(l)}}function sPt(t){const A=new Map;for(const s of t){const r=s.color?JSON.stringify(s.color):"default";A.has(r)||A.set(r,[]),A.get(r).push(s)}const e=new Map,i=new Map;let n=0;const o=[];for(const[s,r]of A){const g=`Material_${n}`;if(i.set(g,n),s==="default")e.set(g,{name:g,color:[179,179,179,1]});else{const a=JSON.parse(s);e.set(g,{name:g,color:a})}for(const a of r)o.push({...a,materialIndex:n});n++}return{triangles:o,boundingBox:Cae(o),materials:e,materialIndexMap:i}}function rPt(t,A){const e=[];if(!t.meshes||!t.accessors||!t.bufferViews)return e;for(const i of t.meshes)for(const n of i.primitives){if((n.mode??4)!==4)continue;const s=n.attributes.POSITION;if(s===void 0)continue;const r=t.accessors[s],g=zW(r,t.bufferViews,A);let a;const I=n.attributes.NORMAL;if(I!==void 0){const E=t.accessors[I];a=zW(E,t.bufferViews,A)}let c;const B=n.attributes.COLOR_0;if(B!==void 0){const E=t.accessors[B];c=zW(E,t.bufferViews,A)}let C;if(!c&&n.material!==void 0&&t.materials){const E=t.materials[n.material];if(E?.pbrMetallicRoughness?.baseColorFactor){const h=E.pbrMetallicRoughness.baseColorFactor;C=[Math.round(h[0]*255),Math.round(h[1]*255),Math.round(h[2]*255),h[3]]}}let Q;if(n.indices!==void 0){const E=t.accessors[n.indices],h=zW(E,t.bufferViews,A);Q=E.componentType===5123?new Uint16Array(h.buffer,h.byteOffset,h.length):new Uint32Array(h.buffer,h.byteOffset,h.length)}const l=g.length/3;if(Q)for(let E=0;E<Q.length;E+=3){const h=Q[E],u=Q[E+1],p=Q[E+2],f={x:g[h*3],y:g[h*3+1],z:g[h*3+2]},b={x:g[u*3],y:g[u*3+1],z:g[u*3+2]},D={x:g[p*3],y:g[p*3+1],z:g[p*3+2]};let k;a?k={x:(a[h*3]+a[u*3]+a[p*3])/3,y:(a[h*3+1]+a[u*3+1]+a[p*3+1])/3,z:(a[h*3+2]+a[u*3+2]+a[p*3+2])/3}:k=Bae(f,b,D);let m;if(c){const F=c.length/l;F===3?m=[Math.round((c[h*3]+c[u*3]+c[p*3])/3*255),Math.round((c[h*3+1]+c[u*3+1]+c[p*3+1])/3*255),Math.round((c[h*3+2]+c[u*3+2]+c[p*3+2])/3*255),1]:F===4&&(m=[Math.round((c[h*4]+c[u*4]+c[p*4])/3*255),Math.round((c[h*4+1]+c[u*4+1]+c[p*4+1])/3*255),Math.round((c[h*4+2]+c[u*4+2]+c[p*4+2])/3*255),(c[h*4+3]+c[u*4+3]+c[p*4+3])/3])}else m=C;e.push({vertices:[f,b,D],normal:k,color:m})}else for(let E=0;E<l;E+=3){const h={x:g[E*3],y:g[E*3+1],z:g[E*3+2]},u={x:g[(E+1)*3],y:g[(E+1)*3+1],z:g[(E+1)*3+2]},p={x:g[(E+2)*3],y:g[(E+2)*3+1],z:g[(E+2)*3+2]};let f;a?f={x:(a[E*3]+a[(E+1)*3]+a[(E+2)*3])/3,y:(a[E*3+1]+a[(E+1)*3+1]+a[(E+2)*3+1])/3,z:(a[E*3+2]+a[(E+1)*3+2]+a[(E+2)*3+2])/3}:f=Bae(h,u,p);let b;if(c){const D=c.length/l;D===3?b=[Math.round((c[E*3]+c[(E+1)*3]+c[(E+2)*3])/3*255),Math.round((c[E*3+1]+c[(E+1)*3+1]+c[(E+2)*3+1])/3*255),Math.round((c[E*3+2]+c[(E+1)*3+2]+c[(E+2)*3+2])/3*255),1]:D===4&&(b=[Math.round((c[E*4]+c[(E+1)*4]+c[(E+2)*4])/3*255),Math.round((c[E*4+1]+c[(E+1)*4+1]+c[(E+2)*4+1])/3*255),Math.round((c[E*4+2]+c[(E+1)*4+2]+c[(E+2)*4+2])/3*255),(c[E*4+3]+c[(E+1)*4+3]+c[(E+2)*4+3])/3])}else b=C;e.push({vertices:[h,u,p],normal:f,color:b})}}return e}function zW(t,A,e){const i=A[t.bufferView];if(!i||!e)throw new Error("Missing buffer data");const n=(i.byteOffset??0)+(t.byteOffset??0),o=t.componentType,s=t.count,r=t.type,a=s*(r==="SCALAR"?1:r==="VEC2"?2:r==="VEC3"?3:r==="VEC4"?4:1);if(o===5126)return new Float32Array(e,n,a);if(o===5123){const I=new Uint16Array(e,n,a);return new Float32Array(I)}else if(o===5125){const I=new Uint32Array(e,n,a);return new Float32Array(I)}else if(o===5122){const I=new Int16Array(e,n,a);return new Float32Array(I)}else if(o===5124){const I=new Int32Array(e,n,a);return new Float32Array(I)}else if(o===5121){const I=new Uint8Array(e,n,a);return new Float32Array(I)}else if(o===5120){const I=new Int8Array(e,n,a);return new Float32Array(I)}throw new Error(`Unsupported component type: ${o}`)}function Bae(t,A,e){const i={x:A.x-t.x,y:A.y-t.y,z:A.z-t.z},n={x:e.x-t.x,y:e.y-t.y,z:e.z-t.z};return{x:i.y*n.z-i.z*n.y,y:i.z*n.x-i.x*n.z,z:i.x*n.y-i.y*n.x}}function Cae(t){if(t.length===0)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}};let A=1/0,e=1/0,i=1/0,n=-1/0,o=-1/0,s=-1/0;for(const r of t)for(const g of r.vertices)A=Math.min(A,g.x),e=Math.min(e,g.y),i=Math.min(i,g.z),n=Math.max(n,g.x),o=Math.max(o,g.y),s=Math.max(s,g.z);return{min:{x:A,y:e,z:i},max:{x:n,y:o,z:s}}}async function gPt(t){const A=await fetch(t);if(!A.ok)throw new Error(`Failed to fetch ${t}: ${A.statusText}`);return A.arrayBuffer()}function aPt(t){const A=t.split(","),e=atob(A[1]),i=new ArrayBuffer(e.length),n=new Uint8Array(i);for(let o=0;o<e.length;o++)n[o]=e.charCodeAt(o);return i}async function IPt(t){const A=await fetch(t);if(!A.ok)throw new Error(`Failed to fetch glTF file: ${A.statusText}`);const e=await A.json(),i=[];if(e.buffers){for(const Q of e.buffers)if(Q.uri)if(Q.uri.startsWith("data:"))i.push(Promise.resolve(aPt(Q.uri)));else{const l=new URL(Q.uri,t).toString();i.push(gPt(l))}}const n=await Promise.all(i);let o=new ArrayBuffer(0);n.length>0&&n[0]&&(o=n[0]),e.buffers&&e.buffers.length>0&&(delete e.buffers[0].uri,e.buffers[0].byteLength=o.byteLength);const s=JSON.stringify(e),r=new TextEncoder().encode(s),g=(4-r.length%4)%4,a=(4-o.byteLength%4)%4,I=12+(8+r.length+g)+(o.byteLength>0?8+o.byteLength+a:0),c=new ArrayBuffer(I),B=new DataView(c);let C=0;B.setUint32(C,1179937895,!0),C+=4,B.setUint32(C,2,!0),C+=4,B.setUint32(C,I,!0),C+=4,B.setUint32(C,r.length+g,!0),C+=4,B.setUint32(C,1313821514,!0),C+=4,new Uint8Array(c,C).set(r),C+=r.length;for(let Q=0;Q<g;Q++)B.setUint8(C++,32);if(o.byteLength>0){B.setUint32(C,o.byteLength+a,!0),C+=4,B.setUint32(C,5130562,!0),C+=4,new Uint8Array(c,C).set(new Uint8Array(o)),C+=o.byteLength;for(let Q=0;Q<a;Q++)B.setUint8(C++,0)}return c}async function cPt(t,A){const e=await IPt(t);return cae(e,A)}async function Qae(t,A){const{layer:e,resolution:i=1024,backgroundColor:n="transparent",copperColor:o="#ffe066",silkscreenColor:s="#ffffff",drillColor:r="rgba(0,0,0,0.5)"}=A,a=O3t(t,{layer:e,matchBoardAspectRatio:!0,backgroundColor:n,drawPaddingOutsideBoard:!1,colorOverrides:{soldermask:{top:"#4CAF50",bottom:"#4CAF50"},copper:{top:o,bottom:o},silkscreen:{top:s,bottom:s},drill:r}});return await BPt(a,i,n)}async function BPt(t,A,e){if(typeof window<"u"&&typeof document<"u")return lae(t,A,e);try{const{svgToPngDataUrl:i}=await Promise.resolve().then(()=>KVt);return await i(t,{width:A,background:e})}catch(i){return console.warn("Failed to load native svg-to-png, falling back to browser method:",i),lae(t,A,e)}}async function lae(t,A,e){return new Promise((i,n)=>{const o=document.createElement("canvas");o.width=A,o.height=A;const s=o.getContext("2d");s.fillStyle=e,s.fillRect(0,0,A,A);const r=`data:image/svg+xml;base64,${btoa(t)}`,g=new Image;g.onload=()=>{try{s.drawImage(g,0,0,A,A),i(o.toDataURL("image/png"))}catch(a){n(a)}},g.onerror=a=>{console.error("Failed to load SVG image:",a),n(a)},g.src=r})}async function CPt(t,A=1024){console.log("Generating PCB texture...");const[e,i]=await Promise.all([Qae(t,{layer:"top",resolution:A,backgroundColor:"#008C00"}),Qae(t,{layer:"bottom",resolution:A,backgroundColor:"#006600"})]);return console.log("PCB texture generated:",{topLength:e.length,bottomLength:i.length}),{top:e,bottom:i}}var Eae=64,QPt=1e-4,lPt=(t,A)=>[t.x-A.x,t.y-A.y],EPt=t=>{let A=0;for(let i=0;i<t.length;i++){const n=(i+1)%t.length;A+=t[i][0]*t[n][1],A-=t[n][0]*t[i][1]}return A/2<=0},fk=(t,A)=>{const e=t[A];return typeof e=="number"?e:void 0},hPt=(t,A,e)=>{if(t.outline&&t.outline.length>=3){let o=t.outline.map(g=>lPt(g,A));EPt(o)&&(o=o.slice().reverse());const s=ZW.polygon({points:o});let r=MpA.extrudeLinear({height:e},s);return r=SM.translate([0,0,-e/2],r),r}const i=ZW.rectangle({size:[t.width,t.height]});let n=MpA.extrudeLinear({height:e},i);return n=SM.translate([0,0,-e/2],n),n},hae=(t,A,e,i)=>ZW.cylinder({center:[t,A,0],height:i+1,radius:e,segments:Eae}),uPt=(t,A,e,i,n,o)=>{const s=Math.min(e,i),r=Math.max(0,s/2-QPt),g=r<=0?0:Math.min(i/2,r),a=ZW.roundedRectangle({size:[e,i],roundRadius:g,segments:Eae});let I=MpA.extrudeLinear({height:n+1},a);return I=SM.translate([0,0,-(n+1)/2],I),o&&(I=SM.rotateZ(Math.PI/2,I)),SM.translate([t,A,0],I)},dPt=(t,A,e=[],i=[])=>{const n=[];for(const o of e){const s=o,r=fk(s,"hole_diameter")??fk(s,"diameter");if(!r)continue;const g=r/2,a=o.x-t.x,I=-(o.y-t.y);n.push(hae(a,I,g,A))}for(const o of i){const s=o.x-t.x,r=-(o.y-t.y),g=o;if(o.shape==="pill"||o.shape==="pill_hole_with_rect_pad"){const I=fk(g,"hole_width")??fk(g,"outer_diameter")??0,c=fk(g,"hole_height")??fk(g,"hole_diameter")??0;if(!I||!c)continue;const B=c>I,C=B?c:I,Q=B?I:c;n.push(uPt(s,r,C,Q,A,B));continue}const a=fk(g,"hole_diameter")??fk(g,"outer_diameter");a&&n.push(hae(s,r,a/2,A))}return n},pPt=(t,A)=>{const e=A??gae.toPolygons(t),i=[];for(const n of e){if(!n||n.vertices.length<3)continue;const o=n.vertices[0],s=n.vertices[1],r=n.vertices[2],g=[s[0]-o[0],s[1]-o[1],s[2]-o[2]],a=[r[0]-o[0],r[1]-o[1],r[2]-o[2]],I=[g[1]*a[2]-g[2]*a[1],g[2]*a[0]-g[0]*a[2],g[0]*a[1]-g[1]*a[0]],c=Math.sqrt(I[0]**2+I[1]**2+I[2]**2)||1,B={x:I[0]/c,y:I[1]/c,z:I[2]/c};for(let C=1;C<n.vertices.length-1;C++){const Q=n.vertices[C],l=n.vertices[C+1],E={vertices:[{x:o[0],y:o[1],z:o[2]},{x:Q[0],y:Q[1],z:Q[2]},{x:l[0],y:l[1],z:l[2]}],normal:B};i.push(E)}}return i},fPt=t=>{const[A,e]=t;return{min:{x:A[0],y:A[1],z:A[2]},max:{x:e[0],y:e[1],z:e[2]}}},yPt=(t,A)=>{const{thickness:e,holes:i=[],platedHoles:n=[]}=A,o=t.center??{x:0,y:0};let s=hPt(t,o,e);const r=dPt(o,e,i,n);r.length>0&&(s=V3t.subtract(s,...r)),s=SM.rotateX(-Math.PI/2,s);const g=gae.toPolygons(s),a=pPt(s,g),I=z3t(s),c=fPt(I);return{triangles:a,boundingBox:c}},wPt=1.6,DPt=2;function XW(t){return{x:t.x*Math.PI/180,y:t.y*Math.PI/180,z:t.z*Math.PI/180}}async function mPt(t,A={}){const{pcbColor:e="rgba(0,140,0,0.8)",componentColor:i="rgba(128,128,128,0.5)",boardThickness:n=wPt,defaultComponentHeight:o=DPt,renderBoardTextures:s=!0,textureResolution:r=1024,coordinateTransform:g}=A,a=oI(t),I=[],c=a.pcb_board?.list?.()[0],B=c?.thickness??n;if(c){const h=a.pcb_hole?.list?.()??[],u=a.pcb_plated_hole?.list?.()??[],p=yPt(c,{thickness:B,holes:h,platedHoles:u}),f=p.boundingBox.max.x-p.boundingBox.min.x,b=p.boundingBox.max.z-p.boundingBox.min.z,D={center:{x:c.center.x,y:0,z:c.center.y},size:{x:Number.isFinite(f)?f:c.width,y:B,z:Number.isFinite(b)?b:c.height},mesh:p,color:e};if(s&&r>0)try{const k=await CPt(t,r);D.texture={top:k.top,bottom:k.bottom}}catch(k){console.warn("Failed to render board textures:",k),D.color=e}else D.color=e;I.push(D)}const C=a.cad_component?.list?.()??[],Q=new Set;for(const h of C){let{model_stl_url:u,model_obj_url:p,model_glb_url:f,model_gltf_url:b}=h,D=!!(u||p||f||b);if(!D&&h.footprinter_string&&(f=`https://modelcdn.tscircuit.com/jscad_models/${h.footprinter_string}.glb`,D=!0),!D)continue;Q.add(h.pcb_component_id);const k=a.pcb_component.get(h.pcb_component_id),m=k?.layer==="bottom",F=h.size??{x:k?.width??2,y:o,z:k?.height??2},M={center:h.position?{x:h.position.x,y:m?-Math.abs(h.position.z):h.position.z,z:h.position.y}:{x:k?.center.x??0,y:m?-(B/2+F.y/2):B/2+F.y/2,z:k?.center.y??0},size:F,meshUrl:u||p||f||b,meshType:u?"stl":p?"obj":b?"gltf":"glb"};h.rotation?f||b?M.rotation=XW({x:m?h.rotation.x+180:h.rotation.x,y:h.rotation.z,z:h.rotation.y}):M.rotation=XW({x:m?h.rotation.x+180:h.rotation.x,y:h.rotation.y,z:h.rotation.z}):m&&(f||b?M.rotation=XW({x:180,y:0,z:0}):M.rotation=XW({x:180,y:0,z:0}));const J=g??(f||b?void 0:jW.Z_UP_TO_Y_UP_USB_FIX);u?M.mesh=await X3t(u,J):p?M.mesh=await tPt(p,J):f?M.mesh=await oPt(f,J):b&&(M.mesh=await cPt(b,J)),M.mesh||(M.color=i),I.push(M)}for(const h of a.pcb_component.list()){if(Q.has(h.pcb_component_id))continue;const u=a.source_component.get(h.source_component_id),p=Math.min(Math.min(h.width,h.height),o),f=h.layer==="bottom";I.push({center:{x:h.center.x,y:f?-(B/2+p/2):B/2+p/2,z:h.center.y},size:{x:h.width,y:p,z:h.height},color:i,label:u?.name??"?",labelColor:"white"})}let l;if(c){const u=Math.sqrt(c.width*c.width+c.height*c.height)*1.5;l={position:{x:c.center.x+u*.5,y:u*.7,z:c.center.y+u*.5},target:{x:c.center.x,y:0,z:c.center.y},up:{x:0,y:1,z:0},fov:50,near:.1,far:u*4}}else if(I.length>0){let u=1/0,p=1/0,f=-1/0,b=-1/0;for(const M of I){const J=(M.size?.x??0)/2,P=(M.size?.z??0)/2;u=Math.min(u,M.center.x-J),f=Math.max(f,M.center.x+J),p=Math.min(p,M.center.z-P),b=Math.max(b,M.center.z+P)}const D=Math.max(f-u,1),k=Math.max(b-p,1),F=Math.sqrt(D*D+k*k)*1.5,G=(u+f)/2,U=(p+b)/2;l={position:{x:G+F*.5,y:F*.7,z:U+F*.5},target:{x:G,y:0,z:U},up:{x:0,y:1,z:0},fov:50,near:.1,far:F*4}}else l={position:{x:30,y:30,z:25},target:{x:0,y:0,z:0},up:{x:0,y:1,z:0},fov:50,near:.1,far:120};return{boxes:I,camera:l,lights:[{type:"ambient",color:"white",intensity:.5},{type:"directional",color:"white",intensity:.5,direction:{x:-1,y:-1,z:-1}}]}}function SPt(t){const{center:A,size:e}=t,i=e.x/2,n=e.y/2,o=e.z/2,s=[{x:-i,y:-n,z:-o},{x:i,y:-n,z:-o},{x:i,y:n,z:-o},{x:-i,y:n,z:-o},{x:-i,y:-n,z:o},{x:i,y:-n,z:o},{x:i,y:n,z:o},{x:-i,y:n,z:o}].map(g=>({x:g.x+A.x,y:g.y+A.y,z:g.z+A.z}));return[{vertices:[s[0],s[1],s[2]],normal:{x:0,y:0,z:-1}},{vertices:[s[0],s[2],s[3]],normal:{x:0,y:0,z:-1}},{vertices:[s[4],s[6],s[5]],normal:{x:0,y:0,z:1}},{vertices:[s[4],s[7],s[6]],normal:{x:0,y:0,z:1}},{vertices:[s[0],s[5],s[1]],normal:{x:0,y:-1,z:0}},{vertices:[s[0],s[4],s[5]],normal:{x:0,y:-1,z:0}},{vertices:[s[2],s[6],s[7]],normal:{x:0,y:1,z:0}},{vertices:[s[2],s[7],s[3]],normal:{x:0,y:1,z:0}},{vertices:[s[0],s[3],s[7]],normal:{x:-1,y:0,z:0}},{vertices:[s[0],s[7],s[4]],normal:{x:-1,y:0,z:0}},{vertices:[s[1],s[6],s[2]],normal:{x:1,y:0,z:0}},{vertices:[s[1],s[5],s[6]],normal:{x:1,y:0,z:0}}]}function bPt(t,A){const e=[];for(const i of A){const n=t.add(new Tp("",t.add(new VB("",i.vertices[0].x,i.vertices[0].y,i.vertices[0].z)))),o=t.add(new Tp("",t.add(new VB("",i.vertices[1].x,i.vertices[1].y,i.vertices[1].z)))),s=t.add(new Tp("",t.add(new VB("",i.vertices[2].x,i.vertices[2].y,i.vertices[2].z)))),r=n.resolve(t).pnt.resolve(t),g=o.resolve(t).pnt.resolve(t),a=(D,k)=>{const m=D.resolve(t).pnt.resolve(t),F=k.resolve(t).pnt.resolve(t),G=t.add(new pu("",F.x-m.x,F.y-m.y,F.z-m.z)),U=t.add(new yM("",G,1)),M=t.add(new fM("",D.resolve(t).pnt,U));return t.add(new KD("",D,k,M,!0))},I=a(n,o),c=a(o,s),B=a(s,n),C=t.add(new Ew("",[t.add(new rh("",I,!0)),t.add(new rh("",c,!0)),t.add(new rh("",B,!0))])),Q=t.add(new pu("",i.normal.x,i.normal.y,i.normal.z)),l=g.x-r.x,E=g.y-r.y,h=g.z-r.z,u=t.add(new pu("",l,E,h)),p=t.add(new jf("",n.resolve(t).pnt,Q,u)),f=t.add(new dk("",p)),b=t.add(new lS("",[t.add(new ES("",C,!0))],f,!0));e.push(b)}return e}async function kPt(t){const{repo:A,circuitJson:e,boardThickness:i,includeExternalMeshes:n=!1,excludeCadComponentIds:o,excludePcbComponentIds:s,pcbComponentIdsWithStepUrl:r}=t,g=[];try{const a=e.filter(B=>!(B.type==="pcb_board"||B.type==="cad_component"&&B.cad_component_id&&o?.has(B.cad_component_id)||B.type==="pcb_component"&&B.pcb_component_id&&s?.has(B.pcb_component_id)||B.type==="cad_component"&&B.model_step_url||B.type==="cad_component"&&B.pcb_component_id&&r?.has(B.pcb_component_id))).map(B=>!n&&B.type==="cad_component"?{...B,model_3mf_url:void 0,model_obj_url:void 0,model_stl_url:void 0,model_glb_url:void 0,model_gltf_url:void 0}:B),I=await mPt(a,{boardThickness:i,renderBoardTextures:!1}),c=[];for(const B of I.boxes)if(B.mesh&&"triangles"in B.mesh)c.push(...B.mesh.triangles);else{const C=SPt(B);c.push(...C)}if(c.length>0){const B=c.map(E=>({vertices:E.vertices.map(h=>({x:h.x,y:h.z,z:h.y})),normal:{x:E.normal.x,y:E.normal.z,z:E.normal.y}})),C=bPt(A,B),Q=A.add(new wM("",C)),l=A.add(new Ox("Components",Q));g.push(l)}}catch(a){console.warn("Failed to generate component mesh:",a)}return g}var GPt=new Set(["APPLICATION_CONTEXT","APPLICATION_PROTOCOL_DEFINITION","PRODUCT","PRODUCT_CONTEXT","PRODUCT_DEFINITION","PRODUCT_DEFINITION_FORMATION","PRODUCT_DEFINITION_CONTEXT","PRODUCT_DEFINITION_SHAPE","SHAPE_DEFINITION_REPRESENTATION","ADVANCED_BREP_SHAPE_REPRESENTATION","MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION","PRESENTATION_STYLE_ASSIGNMENT","SURFACE_STYLE_USAGE","SURFACE_SIDE_STYLE","SURFACE_STYLE_FILL_AREA","FILL_AREA_STYLE","FILL_AREA_STYLE_COLOUR","COLOUR_RGB","STYLED_ITEM","CURVE_STYLE","DRAUGHTING_PRE_DEFINED_CURVE_FONT","PRODUCT_RELATED_PRODUCT_CATEGORY","NEXT_ASSEMBLY_USAGE_OCCURRENCE","CONTEXT_DEPENDENT_SHAPE_REPRESENTATION","ITEM_DEFINED_TRANSFORMATION"]);function uae(t){return{x:t?.x??0,y:t?.y??0,z:t?.z??0}}function dae(t){const A=Math.PI/180;return{x:t.x*A,y:t.y*A,z:t.z*A}}function xPt(t,A,e){const i=YpA(t,A);return[i[0]+e.x,i[1]+e.y,i[2]+e.z]}function FPt(t,A){return YpA(t,A)}function YpA(t,A){let[e,i,n]=t;if(A.x!==0){const o=Math.cos(A.x),s=Math.sin(A.x),r=i*o-n*s,g=i*s+n*o;i=r,n=g}if(A.y!==0){const o=Math.cos(A.y),s=Math.sin(A.y),r=e*o+n*s,g=-e*s+n*o;e=r,n=g}if(A.z!==0){const o=Math.cos(A.z),s=Math.sin(A.z),r=e*o-i*s,g=e*s+i*o;e=r,i=g}return[e,i,n]}async function _Pt(t){if(!/^https?:\/\//i.test(t))throw new Error(`Only HTTP(S) URLs are supported. For local files, read the file content and pass it directly. Received: ${t}`);const A=globalThis.fetch;if(!A)throw new Error("fetch is not available in this environment");const e=await A(t);if(!e.ok)throw new Error(`HTTP ${e.status} ${e.statusText}`);return await e.text()}async function RPt(t){const{repo:A,circuitJson:e,boardThickness:i,fsMap:n}=t,o=e.filter(I=>I?.type==="cad_component"&&typeof I.model_step_url=="string"),s=new Map;for(const I of e)I?.type==="pcb_component"&&I.pcb_component_id&&s.set(I.pcb_component_id,I);const r=[],g=new Set,a=new Set;for(const I of o){const c=I.cad_component_id??"",B=I.model_step_url;try{const C=n?.[B]??await _Pt(B);if(!C.trim())throw new Error("STEP file is empty");const l=(I.pcb_component_id?s.get(I.pcb_component_id):void 0)?.layer?.toLowerCase(),E={translation:uae(I.position),rotation:uae(I.rotation)},h=NPt(A,C,E,{layer:l,boardThickness:i});if(h.length>0){c&&g.add(c);const u=I.pcb_component_id;u&&a.add(u)}r.push(...h)}catch(C){console.warn(`Failed to merge STEP model from ${B}:`,C)}}return{solids:r,handledComponentIds:g,handledPcbComponentIds:a}}function NPt(t,A,e,i){let o=O4t(A).entries().map(([g,a])=>[Number(g),a]).filter(([,g])=>!GPt.has(g.type));o=UPt(o),MPt(o,e,i),HPt(o,e);const s=YPt(t,o);KPt(o,s);for(const[g,a]of o){const I=s.get(g);I!==void 0&&t.set(Px(I),a)}const r=[];for(const[g,a]of o)if(a instanceof Ox){const I=s.get(g);I!==void 0&&r.push(new $L(Px(I)))}return r}function MPt(t,A,e){if(!e)return;const i=[];for(const[,p]of t)p instanceof VB&&i.push([p.x,p.y,p.z]);if(!i.length)return;const n=dae(A.rotation);let o=1/0,s=1/0,r=1/0,g=-1/0,a=-1/0,I=-1/0;for(const p of i){const[f,b,D]=YpA(p,n);f<o&&(o=f),b<s&&(s=b),D<r&&(r=D),f>g&&(g=f),b>a&&(a=b),D>I&&(I=D)}if(!Number.isFinite(o))return;const c={x:(o+g)/2,y:(s+a)/2,z:(r+I)/2},B=e.layer?.toLowerCase()==="bottom"?"bottom":"top",C=e.boardThickness??0,Q=A.translation.x,l=A.translation.y,E=A.translation.z,h=.001,u=r<-h&&I>h;if(A.translation.x=Q-c.x,A.translation.y=l-c.y,u&&(A.translation.z=E+C),!u&&C>0){const p=C/2,f=E-p;B==="bottom"?(A.translation.z=-I+f,A.rotation.x=vPt(A.rotation.x+180)):A.translation.z=C-r+f}else u||(A.translation.z=E-c.z)}function vPt(t){const A=t%360;return A<0?A+360:A}function UPt(t){let A=t.slice(),e=new Set(A.map(([n])=>n)),i=!0;for(;i;){i=!1;const n=new Set;for(const[o,s]of A){const r=LPt(s);for(const g of r)if(!e.has(g)){n.add(o);break}}n.size>0&&(i=!0,A=A.filter(([o])=>!n.has(o)),e=new Set(A.map(([o])=>o)))}return A}function LPt(t){const A=new Set;return JpA(t,A,new Set),A}function JpA(t,A,e){if(t){if(t instanceof $L){A.add(Number(t.id));return}if(t instanceof pk){for(const i of t.args)i.replace(/#(\d+)/g,(n,o)=>(A.add(Number(o)),n));return}if(Array.isArray(t)){for(const i of t)JpA(i,A,e);return}if(typeof t=="object"){if(e.has(t))return;e.add(t);for(const i of Object.values(t))JpA(i,A,e)}}}function HPt(t,A){const e=dae(A.rotation);for(const[,i]of t)if(i instanceof VB){const[n,o,s]=xPt([i.x,i.y,i.z],e,A.translation);i.x=n,i.y=o,i.z=s}else if(i instanceof pu){const[n,o,s]=FPt([i.dx,i.dy,i.dz],e),r=Math.hypot(n,o,s);r>0&&(i.dx=n/r,i.dy=o/r,i.dz=s/r)}}function YPt(t,A){let e=JPt(t);const i=new Map;for(const[n]of A)i.set(n,e),e+=1;return i}function JPt(t){let A=0;for(const[e]of t.entries()){const i=Number(e);i>A&&(A=i)}return A+1}function KPt(t,A){for(const[,e]of t)KpA(e,A,new Set)}function KpA(t,A,e){if(t){if(t instanceof $L){const i=A.get(Number(t.id));i!==void 0&&(t.id=Px(i));return}if(t instanceof pk){t.args=t.args.map(i=>i.replace(/#(\d+)/g,(n,o)=>{const s=A.get(Number(o));return s!==void 0?`#${s}`:n}));return}if(Array.isArray(t)){for(const i of t)KpA(i,A,e);return}if(typeof t=="object"){if(e.has(t))return;e.add(t);for(const i of Object.keys(t))KpA(t[i],A,e)}}}function TPt(t){return t.replace(/(-?(?:\d+\.\d*|\.\d+|\d+))e([+-]?\d+)/g,(A,e,i)=>`${e}E${i}`)}async function qPt(t,A={}){const e=new Aae,i=t.find(wA=>wA.type==="pcb_board"),n=t.filter(wA=>wA.type==="pcb_hole"||wA.type==="pcb_plated_hole"),o=A.boardWidth??i?.width,s=A.boardHeight??i?.height,r=A.boardThickness??i?.thickness??1.6,g=A.productName??"PCB",a=i?.center?.x??0,I=i?.center?.y??0;if(!o||!s)throw new Error("Board dimensions not found. Either provide boardWidth and boardHeight in options, or include a pcb_board in the circuit JSON with width and height properties.");const c=e.add(new cH("core data for automotive mechanical design processes"));e.add(new BH("international standard","automotive_design",2010,c));const B=e.add(new QH("",c,"mechanical")),C=e.add(new CH(g,g,"",[B])),Q=e.add(new EH("part definition",c,"design")),l=e.add(new hH("","",C)),E=e.add(new lH("","",l,Q)),h=e.add(new uH("","",E)),u=e.add(new pk("",["( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.) )"])),p=e.add(new pk("",["( NAMED_UNIT(*) PLANE_ANGLE_UNIT() SI_UNIT($,.RADIAN.) )"])),f=e.add(new pk("",["( NAMED_UNIT(*) SI_UNIT($,.STERADIAN.) SOLID_ANGLE_UNIT() )"])),b=e.add(new pk("UNCERTAINTY_MEASURE_WITH_UNIT",["LENGTH_MEASURE(1.E-07)",`${u}`,"'distance_accuracy_value'","'Maximum Tolerance'"])),D=e.add(new pk("",[`( GEOMETRIC_REPRESENTATION_CONTEXT(3) GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((${b})) GLOBAL_UNIT_ASSIGNED_CONTEXT((${u},${p},${f})) REPRESENTATION_CONTEXT('${g}','3D') )`])),k=i?.outline;let m,F;if(k&&Array.isArray(k)&&k.length>=3)m=k.map(wA=>e.add(new Tp("",e.add(new VB("",wA.x,wA.y,0))))),F=k.map(wA=>e.add(new Tp("",e.add(new VB("",wA.x,wA.y,r)))));else{const wA=o/2,bA=s/2,NA=[[a-wA,I-bA,0],[a+wA,I-bA,0],[a+wA,I+bA,0],[a-wA,I+bA,0],[a-wA,I-bA,r],[a+wA,I-bA,r],[a+wA,I+bA,r],[a-wA,I+bA,r]].map(([FA,KA,TA])=>e.add(new Tp("",e.add(new VB("",FA,KA,TA)))));m=[NA[0],NA[1],NA[2],NA[3]],F=[NA[4],NA[5],NA[6],NA[7]]}function G(wA,bA){const EA=wA.resolve(e).pnt.resolve(e),NA=bA.resolve(e).pnt.resolve(e),FA=e.add(new pu("",NA.x-EA.x,NA.y-EA.y,NA.z-EA.z)),KA=e.add(new yM("",FA,1)),TA=e.add(new fM("",wA.resolve(e).pnt,KA));return e.add(new KD("",wA,bA,TA,!0))}const U=[],M=[],J=[];for(let wA=0;wA<m.length;wA++){const bA=m[wA],EA=m[(wA+1)%m.length];U.push(G(bA,EA))}for(let wA=0;wA<F.length;wA++){const bA=F[wA],EA=F[(wA+1)%F.length];M.push(G(bA,EA))}for(let wA=0;wA<m.length;wA++)J.push(G(m[wA],F[wA]));const P=e.add(new VB("",0,0,0)),q=e.add(new pu("",1,0,0)),O=e.add(new pu("",0,0,1)),j=e.add(new jf("",P,e.add(new pu("",0,0,-1)),q)),eA=e.add(new dk("",j)),oA=e.add(new Ew("",U.map(wA=>e.add(new rh("",wA,!0))))),IA=[];for(const wA of n)if((wA.hole_shape||wA.shape)==="circle"){const EA=typeof wA.x=="number"?wA.x:wA.x.value,NA=typeof wA.y=="number"?wA.y:wA.y.value,FA=wA.hole_diameter/2,KA=e.add(new VB("",EA,NA,0)),TA=e.add(new Tp("",e.add(new VB("",EA+FA,NA,0)))),XA=e.add(new jf("",KA,e.add(new pu("",0,0,-1)),q)),Ae=e.add(new uk("",XA,FA)),$A=e.add(new KD("",TA,TA,Ae,!0)),re=e.add(new Ew("",[e.add(new rh("",$A,!1))]));IA.push(e.add(new DM("",re,!0)))}const iA=e.add(new lS("",[e.add(new ES("",oA,!0)),...IA],eA,!0)),nA=e.add(new VB("",0,0,r)),gA=e.add(new jf("",nA,O,q)),lA=e.add(new dk("",gA)),yA=e.add(new Ew("",M.map(wA=>e.add(new rh("",wA,!1))))),xA=[];for(const wA of n)if((wA.hole_shape||wA.shape)==="circle"){const EA=typeof wA.x=="number"?wA.x:wA.x.value,NA=typeof wA.y=="number"?wA.y:wA.y.value,FA=wA.hole_diameter/2,KA=e.add(new VB("",EA,NA,r)),TA=e.add(new Tp("",e.add(new VB("",EA+FA,NA,r)))),XA=e.add(new jf("",KA,O,q)),Ae=e.add(new uk("",XA,FA)),$A=e.add(new KD("",TA,TA,Ae,!0)),re=e.add(new Ew("",[e.add(new rh("",$A,!0))]));xA.push(e.add(new DM("",re,!0)))}const MA=e.add(new lS("",[e.add(new ES("",yA,!0)),...xA],lA,!0)),vA=[];for(let wA=0;wA<U.length;wA++){const bA=(wA+1)%U.length,EA=m[wA].resolve(e).pnt,NA=m[bA].resolve(e).pnt,FA=EA.resolve(e),KA=NA.resolve(e),TA={x:KA.x-FA.x,y:KA.y-FA.y},XA=e.add(new pu("",TA.y,-TA.x,0)),Ae=e.add(new pu("",TA.x,TA.y,0)),$A=e.add(new jf("",EA,XA,Ae)),re=e.add(new dk("",$A)),ue=e.add(new Ew("",[e.add(new rh("",U[wA],!0)),e.add(new rh("",J[bA],!0)),e.add(new rh("",M[wA],!1)),e.add(new rh("",J[wA],!1))])),Ge=e.add(new lS("",[e.add(new ES("",ue,!0))],re,!0));vA.push(Ge)}const QA=[];for(const wA of n)if((wA.hole_shape||wA.shape)==="circle"){const EA=typeof wA.x=="number"?wA.x:wA.x.value,NA=typeof wA.y=="number"?wA.y:wA.y.value,FA=wA.hole_diameter/2,KA=e.add(new VB("",EA,NA,0)),TA=e.add(new Tp("",e.add(new VB("",EA+FA,NA,0)))),XA=e.add(new jf("",KA,e.add(new pu("",0,0,-1)),q)),Ae=e.add(new uk("",XA,FA)),$A=e.add(new KD("",TA,TA,Ae,!0)),re=e.add(new VB("",EA,NA,r)),ue=e.add(new Tp("",e.add(new VB("",EA+FA,NA,r)))),Ge=e.add(new jf("",re,O,q)),Te=e.add(new uk("",Ge,FA)),et=e.add(new KD("",ue,ue,Te,!0)),Le=e.add(new Ew("",[e.add(new rh("",$A,!0)),e.add(new rh("",et,!1))])),Bt=e.add(new jf("",KA,O,q)),ct=e.add(new AH("",Bt,FA)),xt=e.add(new lS("",[e.add(new ES("",Le,!0))],ct,!1));QA.push(xt)}const kA=[iA,MA,...vA,...QA],SA=e.add(new wM("",kA)),te=[e.add(new Ox(g,SA))];let ge=new Set,DA=new Set;if(A.includeComponents&&A.includeExternalMeshes){const wA=await RPt({repo:e,circuitJson:t,boardThickness:r,fsMap:A.fsMap});ge=wA.handledComponentIds,DA=wA.handledPcbComponentIds,te.push(...wA.solids)}if(A.includeComponents){const wA=new Set;for(const EA of t)EA.type==="cad_component"&&EA.model_step_url&&EA.pcb_component_id&&wA.add(EA.pcb_component_id);if(t.some(EA=>EA.type==="cad_component"?EA.cad_component_id&&ge.has(EA.cad_component_id)||EA.pcb_component_id&&wA.has(EA.pcb_component_id)?!1:!EA.model_step_url:EA.type==="pcb_component"?!(EA.pcb_component_id&&DA.has(EA.pcb_component_id)||EA.pcb_component_id&&wA.has(EA.pcb_component_id)):!1)){const EA=await kPt({repo:e,circuitJson:t,boardThickness:r,includeExternalMeshes:A.includeExternalMeshes,excludeCadComponentIds:ge,excludePcbComponentIds:DA,pcbComponentIdsWithStepUrl:wA});te.push(...EA)}}const _A=[];te.forEach((wA,bA)=>{const EA=bA===0,[NA,FA,KA]=EA?[.2,.6,.2]:[.75,.75,.75],TA=e.add(new eH("",NA,FA,KA)),XA=e.add(new iH("",TA)),Ae=e.add(new tH("",[XA])),$A=e.add(new gH(Ae)),re=e.add(new rH("",[$A])),ue=e.add(new aH(".BOTH.",re)),Ge=e.add(new oH([ue])),Te=e.add(new sH("",[Ge],wA));_A.push(Te)}),e.add(new nH("",_A,D));const CA=e.add(new IH(g,te,D));e.add(new dH(h,CA));const BA=e.toPartFile({name:g});return TPt(BA)}const PPt=async({circuitJson:t,projectName:A})=>{const e=t.find(g=>g.type==="pcb_board"),i=e&&"width"in e?e.width:void 0,n=e&&"height"in e?e.height:void 0,o=e&&"thickness"in e?e.thickness:void 0;if(i===void 0||n===void 0||o===void 0){Bs.error("Board dimensions not found. Please add a pcb_board with width, height, and thickness to your circuit.");return}let s;try{s=await qPt(t,{boardWidth:i,boardHeight:n,boardThickness:o,productName:A,includeComponents:!0,includeExternalMeshes:!0})}catch(g){const a=g instanceof Error?g.message:"Unknown error";Bs.error(`Failed to convert circuit to STEP format: ${a}`);return}const r=new Blob([s],{type:"application/step"});try{Yx(r,{fileName:`${A}.step`})}catch(g){const a=g instanceof Error?g.message:"Unknown error";Bs.error(`Failed to download STEP file: ${a}`)}},pae=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",OPt=pae+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",WPt="["+pae+"]["+OPt+"]*",ZPt=new RegExp("^"+WPt+"$");function fae(t,A){const e=[];let i=A.exec(t);for(;i;){const n=[];n.startIndex=A.lastIndex-i[0].length;const o=i.length;for(let s=0;s<o;s++)n.push(i[s]);e.push(n),i=A.exec(t)}return e}const $W=function(t){const A=ZPt.exec(t);return!(A===null||typeof A>"u")};function VPt(t){return typeof t<"u"}const jPt={allowBooleanAttributes:!1,unpairedTags:[]};function zPt(t,A){A=Object.assign({},jPt,A);const e=[];let i=!1,n=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let o=0;o<t.length;o++)if(t[o]==="<"&&t[o+1]==="?"){if(o+=2,o=wae(t,o),o.err)return o}else if(t[o]==="<"){let s=o;if(o++,t[o]==="!"){o=Dae(t,o);continue}else{let r=!1;t[o]==="/"&&(r=!0,o++);let g="";for(;o<t.length&&t[o]!==">"&&t[o]!==" "&&t[o]!==" "&&t[o]!==`
6051
+ `).map(g=>g.trim()),n=[];let o=0;for(;o<i.length;){const g=i[o];if(g&&g.startsWith("facet normal")){const a=g.match(/facet normal\s+([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)\s+([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)\s+([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)/),I=a?{x:parseFloat(a[1]),y:parseFloat(a[2]),z:parseFloat(a[3])}:{x:0,y:0,z:1};o++;const c=[];for(;o<i.length&&i[o]&&!i[o].startsWith("endfacet");){const B=i[o];if(B.startsWith("vertex")){const C=B.match(/vertex\s+([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)\s+([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)\s+([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)/);C&&c.push({x:parseFloat(C[1]),y:parseFloat(C[2]),z:parseFloat(C[3])})}o++}c.length===3&&n.push({vertices:[c[0],c[1],c[2]],normal:I})}o++}const s=A??jW.Z_UP_TO_Y_UP,r=VW(n,s);return{triangles:r,boundingBox:Iae(r)}}function ePt(t,A){let e=80;const i=t.getUint32(e,!0);e+=4;const n=[];for(let r=0;r<i;r++){const g={x:t.getFloat32(e,!0),y:t.getFloat32(e+4,!0),z:t.getFloat32(e+8,!0)};e+=12;const a=[{x:t.getFloat32(e,!0),y:t.getFloat32(e+4,!0),z:t.getFloat32(e+8,!0)},{x:t.getFloat32(e+12,!0),y:t.getFloat32(e+16,!0),z:t.getFloat32(e+20,!0)},{x:t.getFloat32(e+24,!0),y:t.getFloat32(e+28,!0),z:t.getFloat32(e+32,!0)}];e+=36,e+=2,n.push({vertices:a,normal:g})}const o=A??jW.Z_UP_TO_Y_UP,s=VW(n,o);return{triangles:s,boundingBox:Iae(s)}}function Iae(t){if(t.length===0)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}};let A=1/0,e=1/0,i=1/0,n=-1/0,o=-1/0,s=-1/0;for(const r of t)for(const g of r.vertices)A=Math.min(A,g.x),e=Math.min(e,g.y),i=Math.min(i,g.z),n=Math.max(n,g.x),o=Math.max(o,g.y),s=Math.max(s,g.z);return{min:{x:A,y:e,z:i},max:{x:n,y:o,z:s}}}var LpA=new Map;async function tPt(t,A){const e=`${t}:${JSON.stringify(A??{})}`;if(LpA.has(e))return LpA.get(e);const n=await(await fetch(t)).text(),o=iPt(n,A);return LpA.set(e,o),o}function iPt(t,A){const e=t.split(/\r?\n/),i=[],n=[],o=[],s=[],r=new Map;let g,a=0;const I=new Map;for(const C of e){const Q=C.trim();if(Q.startsWith("v ")){const l=Q.split(/\s+/),E=l[1],h=l[2],u=l[3];if(i.push({x:parseFloat(E),y:parseFloat(h),z:parseFloat(u)}),l.length>=7){const[p,f,b]=l.slice(4,7);let D=Number(p),k=Number(f),m=Number(b);D<=1&&k<=1&&m<=1&&(D*=255,k*=255,m*=255),n.push([D,k,m,1])}else n.push(void 0)}else if(Q.startsWith("vn ")){const l=Q.split(/\s+/),E=l[1],h=l[2],u=l[3];o.push({x:parseFloat(E),y:parseFloat(h),z:parseFloat(u)})}else if(Q.startsWith("newmtl ")){const l=Q.split(/\s+/)[1];r.set(l,{name:l}),I.set(l,a++),g=l}else if(Q.startsWith("Kd ")&&g){const l=Q.split(/\s+/),E=l[1],h=l[2],u=l[3];let p=parseFloat(E),f=parseFloat(h),b=parseFloat(u);p<=1&&f<=1&&b<=1&&(p*=255,f*=255,b*=255);const D=r.get(g);D.color=[p,f,b,1]}else if(Q.startsWith("Ka ")&&g){const l=Q.split(/\s+/),E=l[1],h=l[2],u=l[3];let p=parseFloat(E),f=parseFloat(h),b=parseFloat(u);p<=1&&f<=1&&b<=1&&(p*=255,f*=255,b*=255);const D=r.get(g);D.ambient=[p,f,b,1]}else if(Q.startsWith("Ks ")&&g){const l=Q.split(/\s+/),E=l[1],h=l[2],u=l[3];let p=parseFloat(E),f=parseFloat(h),b=parseFloat(u);p<=1&&f<=1&&b<=1&&(p*=255,f*=255,b*=255);const D=r.get(g);D.specular=[p,f,b,1]}else if(Q.startsWith("Ns ")&&g){const l=parseFloat(Q.split(/\s+/)[1]),E=r.get(g);E.shininess=l}else if(Q.startsWith("d ")&&g){const l=parseFloat(Q.split(/\s+/)[1]),E=r.get(g);E.dissolve=l}else if(Q==="endmtl")g=void 0;else if(Q.startsWith("usemtl "))g=Q.split(/\s+/)[1];else if(Q.startsWith("f ")){const E=Q.slice(2).trim().split(/\s+/).map(h=>{const[u,p,f]=h.split("/");return{v:parseInt(u)-1,n:f?parseInt(f)-1:void 0}});for(let h=1;h<E.length-1;h++){const u=E[0],p=E[h],f=E[h+1],b=i[u.v],D=i[p.v],k=i[f.v];let m;if(u.n!==void 0&&o[u.n])m=o[u.n];else if(p.n!==void 0&&o[p.n])m=o[p.n];else if(f.n!==void 0&&o[f.n])m=o[f.n];else{const U={x:D.x-b.x,y:D.y-b.y,z:D.z-b.z},M={x:k.x-b.x,y:k.y-b.y,z:k.z-b.z};m={x:U.y*M.z-U.z*M.y,y:U.z*M.x-U.x*M.z,z:U.x*M.y-U.y*M.x}}const F={vertices:[b,D,k],normal:m};g&&I.has(g)&&(F.materialIndex=I.get(g));const G=n[u.v]??n[p.v]??n[f.v];G&&(F.color=G),s.push(F)}}}const c=A??jW.IDENTITY,B=VW(s,c);return{triangles:B,boundingBox:nPt(B),materials:r.size>0?r:void 0,materialIndexMap:r.size>0?I:void 0}}function nPt(t){if(t.length===0)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}};let A=1/0,e=1/0,i=1/0,n=-1/0,o=-1/0,s=-1/0;for(const r of t)for(const g of r.vertices)g.x<A&&(A=g.x),g.y<e&&(e=g.y),g.z<i&&(i=g.z),g.x>n&&(n=g.x),g.y>o&&(o=g.y),g.z>s&&(s=g.z);return{min:{x:A,y:e,z:i},max:{x:n,y:o,z:s}}}var HpA=new Map;async function oPt(t,A){const e=`${t}:${JSON.stringify(A??{})}`;if(HpA.has(e))return HpA.get(e);const n=await(await fetch(t)).arrayBuffer(),o=cae(n,A);return HpA.set(e,o),o}function cae(t,A){const e=new DataView(t);let i=0;const n=e.getUint32(i,!0);if(i+=4,n!==1179937895)throw new Error("Invalid GLB file: incorrect magic number");const o=e.getUint32(i,!0);if(i+=4,o!==2)throw new Error(`Unsupported GLB version: ${o}`);const s=e.getUint32(i,!0);i+=4;const r=e.getUint32(i,!0);i+=4;const g=e.getUint32(i,!0);if(i+=4,g!==1313821514)throw new Error("Expected JSON chunk");const a=new Uint8Array(t,i,r),I=new TextDecoder().decode(a),c=JSON.parse(I);i+=r;let B;if(i<s){const h=e.getUint32(i,!0);i+=4;const u=e.getUint32(i,!0);i+=4,u===5130562&&(B=t.slice(i,i+h))}const C=rPt(c,B),l=VW(C,A??{axisMapping:{x:"x",y:"z",z:"y"}});return l.some(h=>h.color!==void 0)?sPt(l):{triangles:l,boundingBox:Cae(l)}}function sPt(t){const A=new Map;for(const s of t){const r=s.color?JSON.stringify(s.color):"default";A.has(r)||A.set(r,[]),A.get(r).push(s)}const e=new Map,i=new Map;let n=0;const o=[];for(const[s,r]of A){const g=`Material_${n}`;if(i.set(g,n),s==="default")e.set(g,{name:g,color:[179,179,179,1]});else{const a=JSON.parse(s);e.set(g,{name:g,color:a})}for(const a of r)o.push({...a,materialIndex:n});n++}return{triangles:o,boundingBox:Cae(o),materials:e,materialIndexMap:i}}function rPt(t,A){const e=[];if(!t.meshes||!t.accessors||!t.bufferViews)return e;for(const i of t.meshes)for(const n of i.primitives){if((n.mode??4)!==4)continue;const s=n.attributes.POSITION;if(s===void 0)continue;const r=t.accessors[s],g=zW(r,t.bufferViews,A);let a;const I=n.attributes.NORMAL;if(I!==void 0){const E=t.accessors[I];a=zW(E,t.bufferViews,A)}let c;const B=n.attributes.COLOR_0;if(B!==void 0){const E=t.accessors[B];c=zW(E,t.bufferViews,A)}let C;if(!c&&n.material!==void 0&&t.materials){const E=t.materials[n.material];if(E?.pbrMetallicRoughness?.baseColorFactor){const h=E.pbrMetallicRoughness.baseColorFactor;C=[Math.round(h[0]*255),Math.round(h[1]*255),Math.round(h[2]*255),h[3]]}}let Q;if(n.indices!==void 0){const E=t.accessors[n.indices],h=zW(E,t.bufferViews,A);Q=E.componentType===5123?new Uint16Array(h.buffer,h.byteOffset,h.length):new Uint32Array(h.buffer,h.byteOffset,h.length)}const l=g.length/3;if(Q)for(let E=0;E<Q.length;E+=3){const h=Q[E],u=Q[E+1],p=Q[E+2],f={x:g[h*3],y:g[h*3+1],z:g[h*3+2]},b={x:g[u*3],y:g[u*3+1],z:g[u*3+2]},D={x:g[p*3],y:g[p*3+1],z:g[p*3+2]};let k;a?k={x:(a[h*3]+a[u*3]+a[p*3])/3,y:(a[h*3+1]+a[u*3+1]+a[p*3+1])/3,z:(a[h*3+2]+a[u*3+2]+a[p*3+2])/3}:k=Bae(f,b,D);let m;if(c){const F=c.length/l;F===3?m=[Math.round((c[h*3]+c[u*3]+c[p*3])/3*255),Math.round((c[h*3+1]+c[u*3+1]+c[p*3+1])/3*255),Math.round((c[h*3+2]+c[u*3+2]+c[p*3+2])/3*255),1]:F===4&&(m=[Math.round((c[h*4]+c[u*4]+c[p*4])/3*255),Math.round((c[h*4+1]+c[u*4+1]+c[p*4+1])/3*255),Math.round((c[h*4+2]+c[u*4+2]+c[p*4+2])/3*255),(c[h*4+3]+c[u*4+3]+c[p*4+3])/3])}else m=C;e.push({vertices:[f,b,D],normal:k,color:m})}else for(let E=0;E<l;E+=3){const h={x:g[E*3],y:g[E*3+1],z:g[E*3+2]},u={x:g[(E+1)*3],y:g[(E+1)*3+1],z:g[(E+1)*3+2]},p={x:g[(E+2)*3],y:g[(E+2)*3+1],z:g[(E+2)*3+2]};let f;a?f={x:(a[E*3]+a[(E+1)*3]+a[(E+2)*3])/3,y:(a[E*3+1]+a[(E+1)*3+1]+a[(E+2)*3+1])/3,z:(a[E*3+2]+a[(E+1)*3+2]+a[(E+2)*3+2])/3}:f=Bae(h,u,p);let b;if(c){const D=c.length/l;D===3?b=[Math.round((c[E*3]+c[(E+1)*3]+c[(E+2)*3])/3*255),Math.round((c[E*3+1]+c[(E+1)*3+1]+c[(E+2)*3+1])/3*255),Math.round((c[E*3+2]+c[(E+1)*3+2]+c[(E+2)*3+2])/3*255),1]:D===4&&(b=[Math.round((c[E*4]+c[(E+1)*4]+c[(E+2)*4])/3*255),Math.round((c[E*4+1]+c[(E+1)*4+1]+c[(E+2)*4+1])/3*255),Math.round((c[E*4+2]+c[(E+1)*4+2]+c[(E+2)*4+2])/3*255),(c[E*4+3]+c[(E+1)*4+3]+c[(E+2)*4+3])/3])}else b=C;e.push({vertices:[h,u,p],normal:f,color:b})}}return e}function zW(t,A,e){const i=A[t.bufferView];if(!i||!e)throw new Error("Missing buffer data");const n=(i.byteOffset??0)+(t.byteOffset??0),o=t.componentType,s=t.count,r=t.type,a=s*(r==="SCALAR"?1:r==="VEC2"?2:r==="VEC3"?3:r==="VEC4"?4:1);if(o===5126)return new Float32Array(e,n,a);if(o===5123){const I=new Uint16Array(e,n,a);return new Float32Array(I)}else if(o===5125){const I=new Uint32Array(e,n,a);return new Float32Array(I)}else if(o===5122){const I=new Int16Array(e,n,a);return new Float32Array(I)}else if(o===5124){const I=new Int32Array(e,n,a);return new Float32Array(I)}else if(o===5121){const I=new Uint8Array(e,n,a);return new Float32Array(I)}else if(o===5120){const I=new Int8Array(e,n,a);return new Float32Array(I)}throw new Error(`Unsupported component type: ${o}`)}function Bae(t,A,e){const i={x:A.x-t.x,y:A.y-t.y,z:A.z-t.z},n={x:e.x-t.x,y:e.y-t.y,z:e.z-t.z};return{x:i.y*n.z-i.z*n.y,y:i.z*n.x-i.x*n.z,z:i.x*n.y-i.y*n.x}}function Cae(t){if(t.length===0)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}};let A=1/0,e=1/0,i=1/0,n=-1/0,o=-1/0,s=-1/0;for(const r of t)for(const g of r.vertices)A=Math.min(A,g.x),e=Math.min(e,g.y),i=Math.min(i,g.z),n=Math.max(n,g.x),o=Math.max(o,g.y),s=Math.max(s,g.z);return{min:{x:A,y:e,z:i},max:{x:n,y:o,z:s}}}async function gPt(t){const A=await fetch(t);if(!A.ok)throw new Error(`Failed to fetch ${t}: ${A.statusText}`);return A.arrayBuffer()}function aPt(t){const A=t.split(","),e=atob(A[1]),i=new ArrayBuffer(e.length),n=new Uint8Array(i);for(let o=0;o<e.length;o++)n[o]=e.charCodeAt(o);return i}async function IPt(t){const A=await fetch(t);if(!A.ok)throw new Error(`Failed to fetch glTF file: ${A.statusText}`);const e=await A.json(),i=[];if(e.buffers){for(const Q of e.buffers)if(Q.uri)if(Q.uri.startsWith("data:"))i.push(Promise.resolve(aPt(Q.uri)));else{const l=new URL(Q.uri,t).toString();i.push(gPt(l))}}const n=await Promise.all(i);let o=new ArrayBuffer(0);n.length>0&&n[0]&&(o=n[0]),e.buffers&&e.buffers.length>0&&(delete e.buffers[0].uri,e.buffers[0].byteLength=o.byteLength);const s=JSON.stringify(e),r=new TextEncoder().encode(s),g=(4-r.length%4)%4,a=(4-o.byteLength%4)%4,I=12+(8+r.length+g)+(o.byteLength>0?8+o.byteLength+a:0),c=new ArrayBuffer(I),B=new DataView(c);let C=0;B.setUint32(C,1179937895,!0),C+=4,B.setUint32(C,2,!0),C+=4,B.setUint32(C,I,!0),C+=4,B.setUint32(C,r.length+g,!0),C+=4,B.setUint32(C,1313821514,!0),C+=4,new Uint8Array(c,C).set(r),C+=r.length;for(let Q=0;Q<g;Q++)B.setUint8(C++,32);if(o.byteLength>0){B.setUint32(C,o.byteLength+a,!0),C+=4,B.setUint32(C,5130562,!0),C+=4,new Uint8Array(c,C).set(new Uint8Array(o)),C+=o.byteLength;for(let Q=0;Q<a;Q++)B.setUint8(C++,0)}return c}async function cPt(t,A){const e=await IPt(t);return cae(e,A)}async function Qae(t,A){const{layer:e,resolution:i=1024,backgroundColor:n="transparent",copperColor:o="#ffe066",silkscreenColor:s="#ffffff",drillColor:r="rgba(0,0,0,0.5)"}=A,a=O3t(t,{layer:e,matchBoardAspectRatio:!0,backgroundColor:n,drawPaddingOutsideBoard:!1,colorOverrides:{soldermask:{top:"#4CAF50",bottom:"#4CAF50"},copper:{top:o,bottom:o},silkscreen:{top:s,bottom:s},drill:r}});return await BPt(a,i,n)}async function BPt(t,A,e){if(typeof window<"u"&&typeof document<"u")return lae(t,A,e);try{const{svgToPngDataUrl:i}=await Promise.resolve().then(()=>KVt);return await i(t,{width:A,background:e})}catch(i){return console.warn("Failed to load native svg-to-png, falling back to browser method:",i),lae(t,A,e)}}async function lae(t,A,e){return new Promise((i,n)=>{const o=document.createElement("canvas");o.width=A,o.height=A;const s=o.getContext("2d");s.fillStyle=e,s.fillRect(0,0,A,A);const r=`data:image/svg+xml;base64,${btoa(t)}`,g=new Image;g.onload=()=>{try{s.drawImage(g,0,0,A,A),i(o.toDataURL("image/png"))}catch(a){n(a)}},g.onerror=a=>{console.error("Failed to load SVG image:",a),n(a)},g.src=r})}async function CPt(t,A=1024){console.log("Generating PCB texture...");const[e,i]=await Promise.all([Qae(t,{layer:"top",resolution:A,backgroundColor:"#008C00"}),Qae(t,{layer:"bottom",resolution:A,backgroundColor:"#006600"})]);return console.log("PCB texture generated:",{topLength:e.length,bottomLength:i.length}),{top:e,bottom:i}}var Eae=64,QPt=1e-4,lPt=(t,A)=>[t.x-A.x,t.y-A.y],EPt=t=>{let A=0;for(let i=0;i<t.length;i++){const n=(i+1)%t.length;A+=t[i][0]*t[n][1],A-=t[n][0]*t[i][1]}return A/2<=0},fk=(t,A)=>{const e=t[A];return typeof e=="number"?e:void 0},hPt=(t,A,e)=>{if(t.outline&&t.outline.length>=3){let o=t.outline.map(g=>lPt(g,A));EPt(o)&&(o=o.slice().reverse());const s=ZW.polygon({points:o});let r=MpA.extrudeLinear({height:e},s);return r=SM.translate([0,0,-e/2],r),r}const i=ZW.rectangle({size:[t.width,t.height]});let n=MpA.extrudeLinear({height:e},i);return n=SM.translate([0,0,-e/2],n),n},hae=(t,A,e,i)=>ZW.cylinder({center:[t,A,0],height:i+1,radius:e,segments:Eae}),uPt=(t,A,e,i,n,o)=>{const s=Math.min(e,i),r=Math.max(0,s/2-QPt),g=r<=0?0:Math.min(i/2,r),a=ZW.roundedRectangle({size:[e,i],roundRadius:g,segments:Eae});let I=MpA.extrudeLinear({height:n+1},a);return I=SM.translate([0,0,-(n+1)/2],I),o&&(I=SM.rotateZ(Math.PI/2,I)),SM.translate([t,A,0],I)},dPt=(t,A,e=[],i=[])=>{const n=[];for(const o of e){const s=o,r=fk(s,"hole_diameter")??fk(s,"diameter");if(!r)continue;const g=r/2,a=o.x-t.x,I=-(o.y-t.y);n.push(hae(a,I,g,A))}for(const o of i){const s=o.x-t.x,r=-(o.y-t.y),g=o;if(o.shape==="pill"||o.shape==="pill_hole_with_rect_pad"){const I=fk(g,"hole_width")??fk(g,"outer_diameter")??0,c=fk(g,"hole_height")??fk(g,"hole_diameter")??0;if(!I||!c)continue;const B=c>I,C=B?c:I,Q=B?I:c;n.push(uPt(s,r,C,Q,A,B));continue}const a=fk(g,"hole_diameter")??fk(g,"outer_diameter");a&&n.push(hae(s,r,a/2,A))}return n},pPt=(t,A)=>{const e=A??gae.toPolygons(t),i=[];for(const n of e){if(!n||n.vertices.length<3)continue;const o=n.vertices[0],s=n.vertices[1],r=n.vertices[2],g=[s[0]-o[0],s[1]-o[1],s[2]-o[2]],a=[r[0]-o[0],r[1]-o[1],r[2]-o[2]],I=[g[1]*a[2]-g[2]*a[1],g[2]*a[0]-g[0]*a[2],g[0]*a[1]-g[1]*a[0]],c=Math.sqrt(I[0]**2+I[1]**2+I[2]**2)||1,B={x:I[0]/c,y:I[1]/c,z:I[2]/c};for(let C=1;C<n.vertices.length-1;C++){const Q=n.vertices[C],l=n.vertices[C+1],E={vertices:[{x:o[0],y:o[1],z:o[2]},{x:Q[0],y:Q[1],z:Q[2]},{x:l[0],y:l[1],z:l[2]}],normal:B};i.push(E)}}return i},fPt=t=>{const[A,e]=t;return{min:{x:A[0],y:A[1],z:A[2]},max:{x:e[0],y:e[1],z:e[2]}}},yPt=(t,A)=>{const{thickness:e,holes:i=[],platedHoles:n=[]}=A,o=t.center??{x:0,y:0};let s=hPt(t,o,e);const r=dPt(o,e,i,n);r.length>0&&(s=V3t.subtract(s,...r)),s=SM.rotateX(-Math.PI/2,s);const g=gae.toPolygons(s),a=pPt(s,g),I=z3t(s),c=fPt(I);return{triangles:a,boundingBox:c}},wPt=1.6,DPt=2;function XW(t){return{x:t.x*Math.PI/180,y:t.y*Math.PI/180,z:t.z*Math.PI/180}}async function mPt(t,A={}){const{pcbColor:e="rgba(0,140,0,0.8)",componentColor:i="rgba(128,128,128,0.5)",boardThickness:n=wPt,defaultComponentHeight:o=DPt,renderBoardTextures:s=!0,textureResolution:r=1024,coordinateTransform:g}=A,a=oI(t),I=[],c=a.pcb_board?.list?.()[0],B=c?.thickness??n;if(c){const h=a.pcb_hole?.list?.()??[],u=a.pcb_plated_hole?.list?.()??[],p=yPt(c,{thickness:B,holes:h,platedHoles:u}),f=p.boundingBox.max.x-p.boundingBox.min.x,b=p.boundingBox.max.z-p.boundingBox.min.z,D={center:{x:c.center.x,y:0,z:c.center.y},size:{x:Number.isFinite(f)?f:c.width,y:B,z:Number.isFinite(b)?b:c.height},mesh:p,color:e};if(s&&r>0)try{const k=await CPt(t,r);D.texture={top:k.top,bottom:k.bottom}}catch(k){console.warn("Failed to render board textures:",k),D.color=e}else D.color=e;I.push(D)}const C=a.cad_component?.list?.()??[],Q=new Set;for(const h of C){let{model_stl_url:u,model_obj_url:p,model_glb_url:f,model_gltf_url:b}=h,D=!!(u||p||f||b);if(!D&&h.footprinter_string&&(f=`https://modelcdn.tscircuit.com/jscad_models/${h.footprinter_string}.glb`,D=!0),!D)continue;Q.add(h.pcb_component_id);const k=a.pcb_component.get(h.pcb_component_id),m=k?.layer==="bottom",F=h.size??{x:k?.width??2,y:o,z:k?.height??2},M={center:h.position?{x:h.position.x,y:m?-Math.abs(h.position.z):h.position.z,z:h.position.y}:{x:k?.center.x??0,y:m?-(B/2+F.y/2):B/2+F.y/2,z:k?.center.y??0},size:F,meshUrl:u||p||f||b,meshType:u?"stl":p?"obj":b?"gltf":"glb"};h.rotation?f||b?M.rotation=XW({x:m?h.rotation.x+180:h.rotation.x,y:h.rotation.z,z:h.rotation.y}):M.rotation=XW({x:m?h.rotation.x+180:h.rotation.x,y:h.rotation.y,z:h.rotation.z}):m&&(f||b?M.rotation=XW({x:180,y:0,z:0}):M.rotation=XW({x:180,y:0,z:0}));const J=g??(f||b?void 0:jW.Z_UP_TO_Y_UP_USB_FIX);u?M.mesh=await X3t(u,J):p?M.mesh=await tPt(p,J):f?M.mesh=await oPt(f,J):b&&(M.mesh=await cPt(b,J)),M.mesh||(M.color=i),I.push(M)}for(const h of a.pcb_component.list()){if(Q.has(h.pcb_component_id))continue;const u=a.source_component.get(h.source_component_id),p=Math.min(Math.min(h.width,h.height),o),f=h.layer==="bottom";I.push({center:{x:h.center.x,y:f?-(B/2+p/2):B/2+p/2,z:h.center.y},size:{x:h.width,y:p,z:h.height},color:i,label:u?.name??"?",labelColor:"white"})}let l;if(c){const u=Math.sqrt(c.width*c.width+c.height*c.height)*1.5;l={position:{x:c.center.x+u*.5,y:u*.7,z:c.center.y+u*.5},target:{x:c.center.x,y:0,z:c.center.y},up:{x:0,y:1,z:0},fov:50,near:.1,far:u*4}}else if(I.length>0){let u=1/0,p=1/0,f=-1/0,b=-1/0;for(const M of I){const J=(M.size?.x??0)/2,P=(M.size?.z??0)/2;u=Math.min(u,M.center.x-J),f=Math.max(f,M.center.x+J),p=Math.min(p,M.center.z-P),b=Math.max(b,M.center.z+P)}const D=Math.max(f-u,1),k=Math.max(b-p,1),F=Math.sqrt(D*D+k*k)*1.5,G=(u+f)/2,U=(p+b)/2;l={position:{x:G+F*.5,y:F*.7,z:U+F*.5},target:{x:G,y:0,z:U},up:{x:0,y:1,z:0},fov:50,near:.1,far:F*4}}else l={position:{x:30,y:30,z:25},target:{x:0,y:0,z:0},up:{x:0,y:1,z:0},fov:50,near:.1,far:120};return{boxes:I,camera:l,lights:[{type:"ambient",color:"white",intensity:.5},{type:"directional",color:"white",intensity:.5,direction:{x:-1,y:-1,z:-1}}]}}function SPt(t){const{center:A,size:e}=t,i=e.x/2,n=e.y/2,o=e.z/2,s=[{x:-i,y:-n,z:-o},{x:i,y:-n,z:-o},{x:i,y:n,z:-o},{x:-i,y:n,z:-o},{x:-i,y:-n,z:o},{x:i,y:-n,z:o},{x:i,y:n,z:o},{x:-i,y:n,z:o}].map(g=>({x:g.x+A.x,y:g.y+A.y,z:g.z+A.z}));return[{vertices:[s[0],s[1],s[2]],normal:{x:0,y:0,z:-1}},{vertices:[s[0],s[2],s[3]],normal:{x:0,y:0,z:-1}},{vertices:[s[4],s[6],s[5]],normal:{x:0,y:0,z:1}},{vertices:[s[4],s[7],s[6]],normal:{x:0,y:0,z:1}},{vertices:[s[0],s[5],s[1]],normal:{x:0,y:-1,z:0}},{vertices:[s[0],s[4],s[5]],normal:{x:0,y:-1,z:0}},{vertices:[s[2],s[6],s[7]],normal:{x:0,y:1,z:0}},{vertices:[s[2],s[7],s[3]],normal:{x:0,y:1,z:0}},{vertices:[s[0],s[3],s[7]],normal:{x:-1,y:0,z:0}},{vertices:[s[0],s[7],s[4]],normal:{x:-1,y:0,z:0}},{vertices:[s[1],s[6],s[2]],normal:{x:1,y:0,z:0}},{vertices:[s[1],s[5],s[6]],normal:{x:1,y:0,z:0}}]}function bPt(t,A){const e=[];for(const i of A){const n=t.add(new Tp("",t.add(new VB("",i.vertices[0].x,i.vertices[0].y,i.vertices[0].z)))),o=t.add(new Tp("",t.add(new VB("",i.vertices[1].x,i.vertices[1].y,i.vertices[1].z)))),s=t.add(new Tp("",t.add(new VB("",i.vertices[2].x,i.vertices[2].y,i.vertices[2].z)))),r=n.resolve(t).pnt.resolve(t),g=o.resolve(t).pnt.resolve(t),a=(D,k)=>{const m=D.resolve(t).pnt.resolve(t),F=k.resolve(t).pnt.resolve(t),G=t.add(new pu("",F.x-m.x,F.y-m.y,F.z-m.z)),U=t.add(new yM("",G,1)),M=t.add(new fM("",D.resolve(t).pnt,U));return t.add(new KD("",D,k,M,!0))},I=a(n,o),c=a(o,s),B=a(s,n),C=t.add(new Ew("",[t.add(new rh("",I,!0)),t.add(new rh("",c,!0)),t.add(new rh("",B,!0))])),Q=t.add(new pu("",i.normal.x,i.normal.y,i.normal.z)),l=g.x-r.x,E=g.y-r.y,h=g.z-r.z,u=t.add(new pu("",l,E,h)),p=t.add(new jf("",n.resolve(t).pnt,Q,u)),f=t.add(new dk("",p)),b=t.add(new lS("",[t.add(new ES("",C,!0))],f,!0));e.push(b)}return e}async function kPt(t){const{repo:A,circuitJson:e,boardThickness:i,includeExternalMeshes:n=!1,excludeCadComponentIds:o,excludePcbComponentIds:s,pcbComponentIdsWithStepUrl:r}=t,g=[];try{const a=e.filter(B=>!(B.type==="pcb_board"||B.type==="cad_component"&&B.cad_component_id&&o?.has(B.cad_component_id)||B.type==="pcb_component"&&B.pcb_component_id&&s?.has(B.pcb_component_id)||B.type==="cad_component"&&B.model_step_url||B.type==="cad_component"&&B.pcb_component_id&&r?.has(B.pcb_component_id))).map(B=>!n&&B.type==="cad_component"?{...B,model_3mf_url:void 0,model_obj_url:void 0,model_stl_url:void 0,model_glb_url:void 0,model_gltf_url:void 0}:B),I=await mPt(a,{boardThickness:i,renderBoardTextures:!1}),c=[];for(const B of I.boxes)if(B.mesh&&"triangles"in B.mesh)c.push(...B.mesh.triangles);else{const C=SPt(B);c.push(...C)}if(c.length>0){const B=c.map(E=>({vertices:E.vertices.map(h=>({x:h.x,y:h.z,z:h.y})),normal:{x:E.normal.x,y:E.normal.z,z:E.normal.y}})),C=bPt(A,B),Q=A.add(new wM("",C)),l=A.add(new Ox("Components",Q));g.push(l)}}catch(a){console.warn("Failed to generate component mesh:",a)}return g}var GPt=new Set(["APPLICATION_CONTEXT","APPLICATION_PROTOCOL_DEFINITION","PRODUCT","PRODUCT_CONTEXT","PRODUCT_DEFINITION","PRODUCT_DEFINITION_FORMATION","PRODUCT_DEFINITION_CONTEXT","PRODUCT_DEFINITION_SHAPE","SHAPE_DEFINITION_REPRESENTATION","ADVANCED_BREP_SHAPE_REPRESENTATION","MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION","PRESENTATION_STYLE_ASSIGNMENT","SURFACE_STYLE_USAGE","SURFACE_SIDE_STYLE","SURFACE_STYLE_FILL_AREA","FILL_AREA_STYLE","FILL_AREA_STYLE_COLOUR","COLOUR_RGB","STYLED_ITEM","CURVE_STYLE","DRAUGHTING_PRE_DEFINED_CURVE_FONT","PRODUCT_RELATED_PRODUCT_CATEGORY","NEXT_ASSEMBLY_USAGE_OCCURRENCE","CONTEXT_DEPENDENT_SHAPE_REPRESENTATION","ITEM_DEFINED_TRANSFORMATION"]);function uae(t){return{x:t?.x??0,y:t?.y??0,z:t?.z??0}}function dae(t){const A=Math.PI/180;return{x:t.x*A,y:t.y*A,z:t.z*A}}function xPt(t,A,e){const i=YpA(t,A);return[i[0]+e.x,i[1]+e.y,i[2]+e.z]}function FPt(t,A){return YpA(t,A)}function YpA(t,A){let[e,i,n]=t;if(A.x!==0){const o=Math.cos(A.x),s=Math.sin(A.x),r=i*o-n*s,g=i*s+n*o;i=r,n=g}if(A.y!==0){const o=Math.cos(A.y),s=Math.sin(A.y),r=e*o+n*s,g=-e*s+n*o;e=r,n=g}if(A.z!==0){const o=Math.cos(A.z),s=Math.sin(A.z),r=e*o-i*s,g=e*s+i*o;e=r,i=g}return[e,i,n]}async function _Pt(t){if(!/^https?:\/\//i.test(t))throw new Error(`Only HTTP(S) URLs are supported. For local files, read the file content and pass it directly. Received: ${t}`);const A=globalThis.fetch;if(!A)throw new Error("fetch is not available in this environment");const e=await A(t);if(!e.ok)throw new Error(`HTTP ${e.status} ${e.statusText}`);return await e.text()}async function RPt(t){const{repo:A,circuitJson:e,boardThickness:i,fsMap:n}=t,o=e.filter(I=>I?.type==="cad_component"&&typeof I.model_step_url=="string"),s=new Map;for(const I of e)I?.type==="pcb_component"&&I.pcb_component_id&&s.set(I.pcb_component_id,I);const r=[],g=new Set,a=new Set;for(const I of o){const c=I.cad_component_id??"",B=I.model_step_url;try{const C=n?.[B]??await _Pt(B);if(!C.trim())throw new Error("STEP file is empty");const l=(I.pcb_component_id?s.get(I.pcb_component_id):void 0)?.layer?.toLowerCase(),E={translation:uae(I.position),rotation:uae(I.rotation)},h=NPt(A,C,E,{layer:l,boardThickness:i});if(h.length>0){c&&g.add(c);const u=I.pcb_component_id;u&&a.add(u)}r.push(...h)}catch(C){console.warn(`Failed to merge STEP model from ${B}:`,C)}}return{solids:r,handledComponentIds:g,handledPcbComponentIds:a}}function NPt(t,A,e,i){let o=O4t(A).entries().map(([g,a])=>[Number(g),a]).filter(([,g])=>!GPt.has(g.type));o=UPt(o),MPt(o,e,i),HPt(o,e);const s=YPt(t,o);KPt(o,s);for(const[g,a]of o){const I=s.get(g);I!==void 0&&t.set(Px(I),a)}const r=[];for(const[g,a]of o)if(a instanceof Ox){const I=s.get(g);I!==void 0&&r.push(new $L(Px(I)))}return r}function MPt(t,A,e){if(!e)return;const i=[];for(const[,p]of t)p instanceof VB&&i.push([p.x,p.y,p.z]);if(!i.length)return;const n=dae(A.rotation);let o=1/0,s=1/0,r=1/0,g=-1/0,a=-1/0,I=-1/0;for(const p of i){const[f,b,D]=YpA(p,n);f<o&&(o=f),b<s&&(s=b),D<r&&(r=D),f>g&&(g=f),b>a&&(a=b),D>I&&(I=D)}if(!Number.isFinite(o))return;const c={x:(o+g)/2,y:(s+a)/2,z:(r+I)/2},B=e.layer?.toLowerCase()==="bottom"?"bottom":"top",C=e.boardThickness??0,Q=A.translation.x,l=A.translation.y,E=A.translation.z,h=.001,u=r<-h&&I>h;if(A.translation.x=Q-c.x,A.translation.y=l-c.y,u&&(A.translation.z=C),!u&&C>0){const p=C/2,f=E-p;B==="bottom"?(A.translation.z=-I+f,A.rotation.x=vPt(A.rotation.x+180)):A.translation.z=C-r+f}else u||(A.translation.z=E-c.z)}function vPt(t){const A=t%360;return A<0?A+360:A}function UPt(t){let A=t.slice(),e=new Set(A.map(([n])=>n)),i=!0;for(;i;){i=!1;const n=new Set;for(const[o,s]of A){const r=LPt(s);for(const g of r)if(!e.has(g)){n.add(o);break}}n.size>0&&(i=!0,A=A.filter(([o])=>!n.has(o)),e=new Set(A.map(([o])=>o)))}return A}function LPt(t){const A=new Set;return JpA(t,A,new Set),A}function JpA(t,A,e){if(t){if(t instanceof $L){A.add(Number(t.id));return}if(t instanceof pk){for(const i of t.args)i.replace(/#(\d+)/g,(n,o)=>(A.add(Number(o)),n));return}if(Array.isArray(t)){for(const i of t)JpA(i,A,e);return}if(typeof t=="object"){if(e.has(t))return;e.add(t);for(const i of Object.values(t))JpA(i,A,e)}}}function HPt(t,A){const e=dae(A.rotation);for(const[,i]of t)if(i instanceof VB){const[n,o,s]=xPt([i.x,i.y,i.z],e,A.translation);i.x=n,i.y=o,i.z=s}else if(i instanceof pu){const[n,o,s]=FPt([i.dx,i.dy,i.dz],e),r=Math.hypot(n,o,s);r>0&&(i.dx=n/r,i.dy=o/r,i.dz=s/r)}}function YPt(t,A){let e=JPt(t);const i=new Map;for(const[n]of A)i.set(n,e),e+=1;return i}function JPt(t){let A=0;for(const[e]of t.entries()){const i=Number(e);i>A&&(A=i)}return A+1}function KPt(t,A){for(const[,e]of t)KpA(e,A,new Set)}function KpA(t,A,e){if(t){if(t instanceof $L){const i=A.get(Number(t.id));i!==void 0&&(t.id=Px(i));return}if(t instanceof pk){t.args=t.args.map(i=>i.replace(/#(\d+)/g,(n,o)=>{const s=A.get(Number(o));return s!==void 0?`#${s}`:n}));return}if(Array.isArray(t)){for(const i of t)KpA(i,A,e);return}if(typeof t=="object"){if(e.has(t))return;e.add(t);for(const i of Object.keys(t))KpA(t[i],A,e)}}}function TPt(t){return t.replace(/(-?(?:\d+\.\d*|\.\d+|\d+))e([+-]?\d+)/g,(A,e,i)=>`${e}E${i}`)}async function qPt(t,A={}){const e=new Aae,i=t.find(wA=>wA.type==="pcb_board"),n=t.filter(wA=>wA.type==="pcb_hole"||wA.type==="pcb_plated_hole"),o=A.boardWidth??i?.width,s=A.boardHeight??i?.height,r=A.boardThickness??i?.thickness??1.6,g=A.productName??"PCB",a=i?.center?.x??0,I=i?.center?.y??0;if(!o||!s)throw new Error("Board dimensions not found. Either provide boardWidth and boardHeight in options, or include a pcb_board in the circuit JSON with width and height properties.");const c=e.add(new cH("core data for automotive mechanical design processes"));e.add(new BH("international standard","automotive_design",2010,c));const B=e.add(new QH("",c,"mechanical")),C=e.add(new CH(g,g,"",[B])),Q=e.add(new EH("part definition",c,"design")),l=e.add(new hH("","",C)),E=e.add(new lH("","",l,Q)),h=e.add(new uH("","",E)),u=e.add(new pk("",["( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.) )"])),p=e.add(new pk("",["( NAMED_UNIT(*) PLANE_ANGLE_UNIT() SI_UNIT($,.RADIAN.) )"])),f=e.add(new pk("",["( NAMED_UNIT(*) SI_UNIT($,.STERADIAN.) SOLID_ANGLE_UNIT() )"])),b=e.add(new pk("UNCERTAINTY_MEASURE_WITH_UNIT",["LENGTH_MEASURE(1.E-07)",`${u}`,"'distance_accuracy_value'","'Maximum Tolerance'"])),D=e.add(new pk("",[`( GEOMETRIC_REPRESENTATION_CONTEXT(3) GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((${b})) GLOBAL_UNIT_ASSIGNED_CONTEXT((${u},${p},${f})) REPRESENTATION_CONTEXT('${g}','3D') )`])),k=i?.outline;let m,F;if(k&&Array.isArray(k)&&k.length>=3)m=k.map(wA=>e.add(new Tp("",e.add(new VB("",wA.x,wA.y,0))))),F=k.map(wA=>e.add(new Tp("",e.add(new VB("",wA.x,wA.y,r)))));else{const wA=o/2,bA=s/2,NA=[[a-wA,I-bA,0],[a+wA,I-bA,0],[a+wA,I+bA,0],[a-wA,I+bA,0],[a-wA,I-bA,r],[a+wA,I-bA,r],[a+wA,I+bA,r],[a-wA,I+bA,r]].map(([FA,KA,TA])=>e.add(new Tp("",e.add(new VB("",FA,KA,TA)))));m=[NA[0],NA[1],NA[2],NA[3]],F=[NA[4],NA[5],NA[6],NA[7]]}function G(wA,bA){const EA=wA.resolve(e).pnt.resolve(e),NA=bA.resolve(e).pnt.resolve(e),FA=e.add(new pu("",NA.x-EA.x,NA.y-EA.y,NA.z-EA.z)),KA=e.add(new yM("",FA,1)),TA=e.add(new fM("",wA.resolve(e).pnt,KA));return e.add(new KD("",wA,bA,TA,!0))}const U=[],M=[],J=[];for(let wA=0;wA<m.length;wA++){const bA=m[wA],EA=m[(wA+1)%m.length];U.push(G(bA,EA))}for(let wA=0;wA<F.length;wA++){const bA=F[wA],EA=F[(wA+1)%F.length];M.push(G(bA,EA))}for(let wA=0;wA<m.length;wA++)J.push(G(m[wA],F[wA]));const P=e.add(new VB("",0,0,0)),q=e.add(new pu("",1,0,0)),O=e.add(new pu("",0,0,1)),j=e.add(new jf("",P,e.add(new pu("",0,0,-1)),q)),eA=e.add(new dk("",j)),oA=e.add(new Ew("",U.map(wA=>e.add(new rh("",wA,!0))))),IA=[];for(const wA of n)if((wA.hole_shape||wA.shape)==="circle"){const EA=typeof wA.x=="number"?wA.x:wA.x.value,NA=typeof wA.y=="number"?wA.y:wA.y.value,FA=wA.hole_diameter/2,KA=e.add(new VB("",EA,NA,0)),TA=e.add(new Tp("",e.add(new VB("",EA+FA,NA,0)))),XA=e.add(new jf("",KA,e.add(new pu("",0,0,-1)),q)),Ae=e.add(new uk("",XA,FA)),$A=e.add(new KD("",TA,TA,Ae,!0)),re=e.add(new Ew("",[e.add(new rh("",$A,!1))]));IA.push(e.add(new DM("",re,!0)))}const iA=e.add(new lS("",[e.add(new ES("",oA,!0)),...IA],eA,!0)),nA=e.add(new VB("",0,0,r)),gA=e.add(new jf("",nA,O,q)),lA=e.add(new dk("",gA)),yA=e.add(new Ew("",M.map(wA=>e.add(new rh("",wA,!1))))),xA=[];for(const wA of n)if((wA.hole_shape||wA.shape)==="circle"){const EA=typeof wA.x=="number"?wA.x:wA.x.value,NA=typeof wA.y=="number"?wA.y:wA.y.value,FA=wA.hole_diameter/2,KA=e.add(new VB("",EA,NA,r)),TA=e.add(new Tp("",e.add(new VB("",EA+FA,NA,r)))),XA=e.add(new jf("",KA,O,q)),Ae=e.add(new uk("",XA,FA)),$A=e.add(new KD("",TA,TA,Ae,!0)),re=e.add(new Ew("",[e.add(new rh("",$A,!0))]));xA.push(e.add(new DM("",re,!0)))}const MA=e.add(new lS("",[e.add(new ES("",yA,!0)),...xA],lA,!0)),vA=[];for(let wA=0;wA<U.length;wA++){const bA=(wA+1)%U.length,EA=m[wA].resolve(e).pnt,NA=m[bA].resolve(e).pnt,FA=EA.resolve(e),KA=NA.resolve(e),TA={x:KA.x-FA.x,y:KA.y-FA.y},XA=e.add(new pu("",TA.y,-TA.x,0)),Ae=e.add(new pu("",TA.x,TA.y,0)),$A=e.add(new jf("",EA,XA,Ae)),re=e.add(new dk("",$A)),ue=e.add(new Ew("",[e.add(new rh("",U[wA],!0)),e.add(new rh("",J[bA],!0)),e.add(new rh("",M[wA],!1)),e.add(new rh("",J[wA],!1))])),Ge=e.add(new lS("",[e.add(new ES("",ue,!0))],re,!0));vA.push(Ge)}const QA=[];for(const wA of n)if((wA.hole_shape||wA.shape)==="circle"){const EA=typeof wA.x=="number"?wA.x:wA.x.value,NA=typeof wA.y=="number"?wA.y:wA.y.value,FA=wA.hole_diameter/2,KA=e.add(new VB("",EA,NA,0)),TA=e.add(new Tp("",e.add(new VB("",EA+FA,NA,0)))),XA=e.add(new jf("",KA,e.add(new pu("",0,0,-1)),q)),Ae=e.add(new uk("",XA,FA)),$A=e.add(new KD("",TA,TA,Ae,!0)),re=e.add(new VB("",EA,NA,r)),ue=e.add(new Tp("",e.add(new VB("",EA+FA,NA,r)))),Ge=e.add(new jf("",re,O,q)),Te=e.add(new uk("",Ge,FA)),et=e.add(new KD("",ue,ue,Te,!0)),Le=e.add(new Ew("",[e.add(new rh("",$A,!0)),e.add(new rh("",et,!1))])),Bt=e.add(new jf("",KA,O,q)),ct=e.add(new AH("",Bt,FA)),xt=e.add(new lS("",[e.add(new ES("",Le,!0))],ct,!1));QA.push(xt)}const kA=[iA,MA,...vA,...QA],SA=e.add(new wM("",kA)),te=[e.add(new Ox(g,SA))];let ge=new Set,DA=new Set;if(A.includeComponents&&A.includeExternalMeshes){const wA=await RPt({repo:e,circuitJson:t,boardThickness:r,fsMap:A.fsMap});ge=wA.handledComponentIds,DA=wA.handledPcbComponentIds,te.push(...wA.solids)}if(A.includeComponents){const wA=new Set;for(const EA of t)EA.type==="cad_component"&&EA.model_step_url&&EA.pcb_component_id&&wA.add(EA.pcb_component_id);if(t.some(EA=>EA.type==="cad_component"?EA.cad_component_id&&ge.has(EA.cad_component_id)||EA.pcb_component_id&&wA.has(EA.pcb_component_id)?!1:!EA.model_step_url:EA.type==="pcb_component"?!(EA.pcb_component_id&&DA.has(EA.pcb_component_id)||EA.pcb_component_id&&wA.has(EA.pcb_component_id)):!1)){const EA=await kPt({repo:e,circuitJson:t,boardThickness:r,includeExternalMeshes:A.includeExternalMeshes,excludeCadComponentIds:ge,excludePcbComponentIds:DA,pcbComponentIdsWithStepUrl:wA});te.push(...EA)}}const _A=[];te.forEach((wA,bA)=>{const EA=bA===0,[NA,FA,KA]=EA?[.2,.6,.2]:[.75,.75,.75],TA=e.add(new eH("",NA,FA,KA)),XA=e.add(new iH("",TA)),Ae=e.add(new tH("",[XA])),$A=e.add(new gH(Ae)),re=e.add(new rH("",[$A])),ue=e.add(new aH(".BOTH.",re)),Ge=e.add(new oH([ue])),Te=e.add(new sH("",[Ge],wA));_A.push(Te)}),e.add(new nH("",_A,D));const CA=e.add(new IH(g,te,D));e.add(new dH(h,CA));const BA=e.toPartFile({name:g});return TPt(BA)}const PPt=async({circuitJson:t,projectName:A})=>{const e=t.find(g=>g.type==="pcb_board"),i=e&&"width"in e?e.width:void 0,n=e&&"height"in e?e.height:void 0,o=e&&"thickness"in e?e.thickness:void 0;if(i===void 0||n===void 0||o===void 0){Bs.error("Board dimensions not found. Please add a pcb_board with width, height, and thickness to your circuit.");return}let s;try{s=await qPt(t,{boardWidth:i,boardHeight:n,boardThickness:o,productName:A,includeComponents:!0,includeExternalMeshes:!0})}catch(g){const a=g instanceof Error?g.message:"Unknown error";Bs.error(`Failed to convert circuit to STEP format: ${a}`);return}const r=new Blob([s],{type:"application/step"});try{Yx(r,{fileName:`${A}.step`})}catch(g){const a=g instanceof Error?g.message:"Unknown error";Bs.error(`Failed to download STEP file: ${a}`)}},pae=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",OPt=pae+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",WPt="["+pae+"]["+OPt+"]*",ZPt=new RegExp("^"+WPt+"$");function fae(t,A){const e=[];let i=A.exec(t);for(;i;){const n=[];n.startIndex=A.lastIndex-i[0].length;const o=i.length;for(let s=0;s<o;s++)n.push(i[s]);e.push(n),i=A.exec(t)}return e}const $W=function(t){const A=ZPt.exec(t);return!(A===null||typeof A>"u")};function VPt(t){return typeof t<"u"}const jPt={allowBooleanAttributes:!1,unpairedTags:[]};function zPt(t,A){A=Object.assign({},jPt,A);const e=[];let i=!1,n=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let o=0;o<t.length;o++)if(t[o]==="<"&&t[o+1]==="?"){if(o+=2,o=wae(t,o),o.err)return o}else if(t[o]==="<"){let s=o;if(o++,t[o]==="!"){o=Dae(t,o);continue}else{let r=!1;t[o]==="/"&&(r=!0,o++);let g="";for(;o<t.length&&t[o]!==">"&&t[o]!==" "&&t[o]!==" "&&t[o]!==`
6052
6052
  `&&t[o]!=="\r";o++)g+=t[o];if(g=g.trim(),g[g.length-1]==="/"&&(g=g.substring(0,g.length-1),o--),!oOt(g)){let c;return g.trim().length===0?c="Invalid space after '<'.":c="Tag '"+g+"' is an invalid name.",MC("InvalidTag",c,Ed(t,o))}const a=AOt(t,o);if(a===!1)return MC("InvalidAttr","Attributes for '"+g+"' have open quote.",Ed(t,o));let I=a.value;if(o=a.index,I[I.length-1]==="/"){const c=o-I.length;I=I.substring(0,I.length-1);const B=mae(I,A);if(B===!0)i=!0;else return MC(B.err.code,B.err.msg,Ed(t,c+B.err.line))}else if(r)if(a.tagClosed){if(I.trim().length>0)return MC("InvalidTag","Closing tag '"+g+"' can't have attributes or invalid starting.",Ed(t,s));if(e.length===0)return MC("InvalidTag","Closing tag '"+g+"' has not been opened.",Ed(t,s));{const c=e.pop();if(g!==c.tagName){let B=Ed(t,c.tagStartPos);return MC("InvalidTag","Expected closing tag '"+c.tagName+"' (opened in line "+B.line+", col "+B.col+") instead of closing tag '"+g+"'.",Ed(t,s))}e.length==0&&(n=!0)}}else return MC("InvalidTag","Closing tag '"+g+"' doesn't have proper closing.",Ed(t,o));else{const c=mae(I,A);if(c!==!0)return MC(c.err.code,c.err.msg,Ed(t,o-I.length+c.err.line));if(n===!0)return MC("InvalidXml","Multiple possible root nodes found.",Ed(t,o));A.unpairedTags.indexOf(g)!==-1||e.push({tagName:g,tagStartPos:s}),i=!0}for(o++;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="!"){o++,o=Dae(t,o);continue}else if(t[o+1]==="?"){if(o=wae(t,++o),o.err)return o}else break;else if(t[o]==="&"){const c=iOt(t,o);if(c==-1)return MC("InvalidChar","char '&' is not expected.",Ed(t,o));o=c}else if(n===!0&&!yae(t[o]))return MC("InvalidXml","Extra text at the end",Ed(t,o));t[o]==="<"&&o--}}else{if(yae(t[o]))continue;return MC("InvalidChar","char '"+t[o]+"' is not expected.",Ed(t,o))}if(i){if(e.length==1)return MC("InvalidTag","Unclosed tag '"+e[0].tagName+"'.",Ed(t,e[0].tagStartPos));if(e.length>0)return MC("InvalidXml","Invalid '"+JSON.stringify(e.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return MC("InvalidXml","Start tag expected.",1);return!0}function yae(t){return t===" "||t===" "||t===`
6053
6053
  `||t==="\r"}function wae(t,A){const e=A;for(;A<t.length;A++)if(t[A]=="?"||t[A]==" "){const i=t.substr(e,A-e);if(A>5&&i==="xml")return MC("InvalidXml","XML declaration allowed only at the start of the document.",Ed(t,A));if(t[A]=="?"&&t[A+1]==">"){A++;break}else continue}return A}function Dae(t,A){if(t.length>A+5&&t[A+1]==="-"&&t[A+2]==="-"){for(A+=3;A<t.length;A++)if(t[A]==="-"&&t[A+1]==="-"&&t[A+2]===">"){A+=2;break}}else if(t.length>A+8&&t[A+1]==="D"&&t[A+2]==="O"&&t[A+3]==="C"&&t[A+4]==="T"&&t[A+5]==="Y"&&t[A+6]==="P"&&t[A+7]==="E"){let e=1;for(A+=8;A<t.length;A++)if(t[A]==="<")e++;else if(t[A]===">"&&(e--,e===0))break}else if(t.length>A+9&&t[A+1]==="["&&t[A+2]==="C"&&t[A+3]==="D"&&t[A+4]==="A"&&t[A+5]==="T"&&t[A+6]==="A"&&t[A+7]==="["){for(A+=8;A<t.length;A++)if(t[A]==="]"&&t[A+1]==="]"&&t[A+2]===">"){A+=2;break}}return A}const XPt='"',$Pt="'";function AOt(t,A){let e="",i="",n=!1;for(;A<t.length;A++){if(t[A]===XPt||t[A]===$Pt)i===""?i=t[A]:i!==t[A]||(i="");else if(t[A]===">"&&i===""){n=!0;break}e+=t[A]}return i!==""?!1:{value:e,index:A,tagClosed:n}}const eOt=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function mae(t,A){const e=fae(t,eOt),i={};for(let n=0;n<e.length;n++){if(e[n][1].length===0)return MC("InvalidAttr","Attribute '"+e[n][2]+"' has no space in starting.",pH(e[n]));if(e[n][3]!==void 0&&e[n][4]===void 0)return MC("InvalidAttr","Attribute '"+e[n][2]+"' is without value.",pH(e[n]));if(e[n][3]===void 0&&!A.allowBooleanAttributes)return MC("InvalidAttr","boolean attribute '"+e[n][2]+"' is not allowed.",pH(e[n]));const o=e[n][2];if(!nOt(o))return MC("InvalidAttr","Attribute '"+o+"' is an invalid name.",pH(e[n]));if(!i.hasOwnProperty(o))i[o]=1;else return MC("InvalidAttr","Attribute '"+o+"' is repeated.",pH(e[n]))}return!0}function tOt(t,A){let e=/\d/;for(t[A]==="x"&&(A++,e=/[\da-fA-F]/);A<t.length;A++){if(t[A]===";")return A;if(!t[A].match(e))break}return-1}function iOt(t,A){if(A++,t[A]===";")return-1;if(t[A]==="#")return A++,tOt(t,A);let e=0;for(;A<t.length;A++,e++)if(!(t[A].match(/\w/)&&e<20)){if(t[A]===";")break;return-1}return A}function MC(t,A,e){return{err:{code:t,msg:A,line:e.line||e,col:e.col}}}function nOt(t){return $W(t)}function oOt(t){return $W(t)}function Ed(t,A){const e=t.substring(0,A).split(/\r?\n/);return{line:e.length,col:e[e.length-1].length+1}}function pH(t){return t.startIndex+t[1].length}const sOt={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,A){return A},attributeValueProcessor:function(t,A){return A},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,A,e){return t},captureMetaData:!1},rOt=function(t){return Object.assign({},sOt,t)};let AZ;typeof Symbol!="function"?AZ="@@xmlMetadata":AZ=Symbol("XML Node Metadata");class Zx{constructor(A){this.tagname=A,this.child=[],this[":@"]={}}add(A,e){A==="__proto__"&&(A="#__proto__"),this.child.push({[A]:e})}addChild(A,e){A.tagname==="__proto__"&&(A.tagname="#__proto__"),A[":@"]&&Object.keys(A[":@"]).length>0?this.child.push({[A.tagname]:A.child,":@":A[":@"]}):this.child.push({[A.tagname]:A.child}),e!==void 0&&(this.child[this.child.length-1][AZ]={startIndex:e})}static getMetaDataSymbol(){return AZ}}class gOt{constructor(A){this.suppressValidationErr=!A}readDocType(A,e){const i={};if(A[e+3]==="O"&&A[e+4]==="C"&&A[e+5]==="T"&&A[e+6]==="Y"&&A[e+7]==="P"&&A[e+8]==="E"){e=e+9;let n=1,o=!1,s=!1,r="";for(;e<A.length;e++)if(A[e]==="<"&&!s){if(o&&Vx(A,"!ENTITY",e)){e+=7;let g,a;[g,a,e]=this.readEntityExp(A,e+1,this.suppressValidationErr),a.indexOf("&")===-1&&(i[g]={regx:RegExp(`&${g};`,"g"),val:a})}else if(o&&Vx(A,"!ELEMENT",e)){e+=8;const{index:g}=this.readElementExp(A,e+1);e=g}else if(o&&Vx(A,"!ATTLIST",e))e+=8;else if(o&&Vx(A,"!NOTATION",e)){e+=9;const{index:g}=this.readNotationExp(A,e+1,this.suppressValidationErr);e=g}else if(Vx(A,"!--",e))s=!0;else throw new Error("Invalid DOCTYPE");n++,r=""}else if(A[e]===">"){if(s?A[e-1]==="-"&&A[e-2]==="-"&&(s=!1,n--):n--,n===0)break}else A[e]==="["?o=!0:r+=A[e];if(n!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:i,i:e}}readEntityExp(A,e){e=Pp(A,e);let i="";for(;e<A.length&&!/\s/.test(A[e])&&A[e]!=='"'&&A[e]!=="'";)i+=A[e],e++;if(fH(i),e=Pp(A,e),!this.suppressValidationErr){if(A.substring(e,e+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(A[e]==="%")throw new Error("Parameter entities are not supported")}let n="";return[e,n]=this.readIdentifierVal(A,e,"entity"),e--,[i,n,e]}readNotationExp(A,e){e=Pp(A,e);let i="";for(;e<A.length&&!/\s/.test(A[e]);)i+=A[e],e++;!this.suppressValidationErr&&fH(i),e=Pp(A,e);const n=A.substring(e,e+6).toUpperCase();if(!this.suppressValidationErr&&n!=="SYSTEM"&&n!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${n}"`);e+=n.length,e=Pp(A,e);let o=null,s=null;if(n==="PUBLIC")[e,o]=this.readIdentifierVal(A,e,"publicIdentifier"),e=Pp(A,e),(A[e]==='"'||A[e]==="'")&&([e,s]=this.readIdentifierVal(A,e,"systemIdentifier"));else if(n==="SYSTEM"&&([e,s]=this.readIdentifierVal(A,e,"systemIdentifier"),!this.suppressValidationErr&&!s))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:i,publicIdentifier:o,systemIdentifier:s,index:--e}}readIdentifierVal(A,e,i){let n="";const o=A[e];if(o!=='"'&&o!=="'")throw new Error(`Expected quoted string, found "${o}"`);for(e++;e<A.length&&A[e]!==o;)n+=A[e],e++;if(A[e]!==o)throw new Error(`Unterminated ${i} value`);return e++,[e,n]}readElementExp(A,e){e=Pp(A,e);let i="";for(;e<A.length&&!/\s/.test(A[e]);)i+=A[e],e++;if(!this.suppressValidationErr&&!$W(i))throw new Error(`Invalid element name: "${i}"`);e=Pp(A,e);let n="";if(A[e]==="E"&&Vx(A,"MPTY",e))e+=4;else if(A[e]==="A"&&Vx(A,"NY",e))e+=2;else if(A[e]==="("){for(e++;e<A.length&&A[e]!==")";)n+=A[e],e++;if(A[e]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${A[e]}"`);return{elementName:i,contentModel:n.trim(),index:e}}readAttlistExp(A,e){e=Pp(A,e);let i="";for(;e<A.length&&!/\s/.test(A[e]);)i+=A[e],e++;fH(i),e=Pp(A,e);let n="";for(;e<A.length&&!/\s/.test(A[e]);)n+=A[e],e++;if(!fH(n))throw new Error(`Invalid attribute name: "${n}"`);e=Pp(A,e);let o="";if(A.substring(e,e+8).toUpperCase()==="NOTATION"){if(o="NOTATION",e+=8,e=Pp(A,e),A[e]!=="(")throw new Error(`Expected '(', found "${A[e]}"`);e++;let r=[];for(;e<A.length&&A[e]!==")";){let g="";for(;e<A.length&&A[e]!=="|"&&A[e]!==")";)g+=A[e],e++;if(g=g.trim(),!fH(g))throw new Error(`Invalid notation name: "${g}"`);r.push(g),A[e]==="|"&&(e++,e=Pp(A,e))}if(A[e]!==")")throw new Error("Unterminated list of notations");e++,o+=" ("+r.join("|")+")"}else{for(;e<A.length&&!/\s/.test(A[e]);)o+=A[e],e++;const r=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!r.includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}e=Pp(A,e);let s="";return A.substring(e,e+8).toUpperCase()==="#REQUIRED"?(s="#REQUIRED",e+=8):A.substring(e,e+7).toUpperCase()==="#IMPLIED"?(s="#IMPLIED",e+=7):[e,s]=this.readIdentifierVal(A,e,"ATTLIST"),{elementName:i,attributeName:n,attributeType:o,defaultValue:s,index:e}}}const Pp=(t,A)=>{for(;A<t.length&&/\s/.test(t[A]);)A++;return A};function Vx(t,A,e){for(let i=0;i<A.length;i++)if(A[i]!==t[e+i+1])return!1;return!0}function fH(t){if($W(t))return t;throw new Error(`Invalid entity name ${t}`)}const aOt=/^[-+]?0x[a-fA-F0-9]+$/,IOt=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,cOt={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function BOt(t,A={}){if(A=Object.assign({},cOt,A),!t||typeof t!="string")return t;let e=t.trim();if(A.skipLike!==void 0&&A.skipLike.test(e))return t;if(t==="0")return 0;if(A.hex&&aOt.test(e))return EOt(e,16);if(e.search(/.+[eE].+/)!==-1)return QOt(t,e,A);{const i=IOt.exec(e);if(i){const n=i[1]||"",o=i[2];let s=lOt(i[3]);const r=n?t[o.length+1]===".":t[o.length]===".";if(!A.leadingZeros&&(o.length>1||o.length===1&&!r))return t;{const g=Number(e),a=String(g);if(g===0)return g;if(a.search(/[eE]/)!==-1)return A.eNotation?g:t;if(e.indexOf(".")!==-1)return a==="0"||a===s||a===`${n}${s}`?g:t;let I=o?s:e;return o?I===a||n+I===a?g:t:I===a||I===n+a?g:t}}else return t}}const COt=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function QOt(t,A,e){if(!e.eNotation)return t;const i=A.match(COt);if(i){let n=i[1]||"";const o=i[3].indexOf("e")===-1?"E":"e",s=i[2],r=n?t[s.length+1]===o:t[s.length]===o;return s.length>1&&r?t:s.length===1&&(i[3].startsWith(`.${o}`)||i[3][0]===o)?Number(A):e.leadingZeros&&!r?(A=(i[1]||"")+i[3],Number(A)):t}else return t}function lOt(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substring(0,t.length-1))),t}function EOt(t,A){if(parseInt)return parseInt(t,A);if(Number.parseInt)return Number.parseInt(t,A);if(window&&window.parseInt)return window.parseInt(t,A);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function hOt(t){return typeof t=="function"?t:Array.isArray(t)?A=>{for(const e of t)if(typeof e=="string"&&A===e||e instanceof RegExp&&e.test(A))return!0}:()=>!1}class uOt{constructor(A){if(this.options=A,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,i)=>String.fromCodePoint(Number.parseInt(i,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,i)=>String.fromCodePoint(Number.parseInt(i,16))}},this.addExternalEntities=dOt,this.parseXml=DOt,this.parseTextData=pOt,this.resolveNameSpace=fOt,this.buildAttributesMap=wOt,this.isItStopNode=kOt,this.replaceEntitiesValue=SOt,this.readStopNodeData=xOt,this.saveTextToParentTag=bOt,this.addChild=mOt,this.ignoreAttributesFn=hOt(this.options.ignoreAttributes),this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let e=0;e<this.options.stopNodes.length;e++){const i=this.options.stopNodes[e];typeof i=="string"&&(i.startsWith("*.")?this.stopNodesWildcard.add(i.substring(2)):this.stopNodesExact.add(i))}}}}function dOt(t){const A=Object.keys(t);for(let e=0;e<A.length;e++){const i=A[e];this.lastEntities[i]={regex:new RegExp("&"+i+";","g"),val:t[i]}}}function pOt(t,A,e,i,n,o,s){if(t!==void 0&&(this.options.trimValues&&!i&&(t=t.trim()),t.length>0)){s||(t=this.replaceEntitiesValue(t));const r=this.options.tagValueProcessor(A,t,e,n,o);return r==null?t:typeof r!=typeof t||r!==t?r:this.options.trimValues?qpA(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?qpA(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function fOt(t){if(this.options.removeNSPrefix){const A=t.split(":"),e=t.charAt(0)==="/"?"/":"";if(A[0]==="xmlns")return"";A.length===2&&(t=e+A[1])}return t}const yOt=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function wOt(t,A,e){if(this.options.ignoreAttributes!==!0&&typeof t=="string"){const i=fae(t,yOt),n=i.length,o={};for(let s=0;s<n;s++){const r=this.resolveNameSpace(i[s][1]);if(this.ignoreAttributesFn(r,A))continue;let g=i[s][4],a=this.options.attributeNamePrefix+r;if(r.length)if(this.options.transformAttributeName&&(a=this.options.transformAttributeName(a)),a==="__proto__"&&(a="#__proto__"),g!==void 0){this.options.trimValues&&(g=g.trim()),g=this.replaceEntitiesValue(g);const I=this.options.attributeValueProcessor(r,g,A);I==null?o[a]=g:typeof I!=typeof g||I!==g?o[a]=I:o[a]=qpA(g,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[a]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const s={};return s[this.options.attributesGroupName]=o,s}return o}}const DOt=function(t){t=t.replace(/\r\n?/g,`
6054
6054
  `);const A=new Zx("!xml");let e=A,i="",n="";const o=new gOt(this.options.processEntities);for(let s=0;s<t.length;s++)if(t[s]==="<")if(t[s+1]==="/"){const g=jx(t,">",s,"Closing Tag is not closed.");let a=t.substring(s+2,g).trim();if(this.options.removeNSPrefix){const B=a.indexOf(":");B!==-1&&(a=a.substr(B+1))}this.options.transformTagName&&(a=this.options.transformTagName(a)),e&&(i=this.saveTextToParentTag(i,e,n));const I=n.substring(n.lastIndexOf(".")+1);if(a&&this.options.unpairedTags.indexOf(a)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${a}>`);let c=0;I&&this.options.unpairedTags.indexOf(I)!==-1?(c=n.lastIndexOf(".",n.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=n.lastIndexOf("."),n=n.substring(0,c),e=this.tagsNodeStack.pop(),i="",s=g}else if(t[s+1]==="?"){let g=TpA(t,s,!1,"?>");if(!g)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,e,n),!(this.options.ignoreDeclaration&&g.tagName==="?xml"||this.options.ignorePiTags)){const a=new Zx(g.tagName);a.add(this.options.textNodeName,""),g.tagName!==g.tagExp&&g.attrExpPresent&&(a[":@"]=this.buildAttributesMap(g.tagExp,n,g.tagName)),this.addChild(e,a,n,s)}s=g.closeIndex+1}else if(t.substr(s+1,3)==="!--"){const g=jx(t,"-->",s+4,"Comment is not closed.");if(this.options.commentPropName){const a=t.substring(s+4,g-2);i=this.saveTextToParentTag(i,e,n),e.add(this.options.commentPropName,[{[this.options.textNodeName]:a}])}s=g}else if(t.substr(s+1,2)==="!D"){const g=o.readDocType(t,s);this.docTypeEntities=g.entities,s=g.i}else if(t.substr(s+1,2)==="!["){const g=jx(t,"]]>",s,"CDATA is not closed.")-2,a=t.substring(s+9,g);i=this.saveTextToParentTag(i,e,n);let I=this.parseTextData(a,e.tagname,n,!0,!1,!0,!0);I==null&&(I=""),this.options.cdataPropName?e.add(this.options.cdataPropName,[{[this.options.textNodeName]:a}]):e.add(this.options.textNodeName,I),s=g+2}else{let g=TpA(t,s,this.options.removeNSPrefix),a=g.tagName;const I=g.rawTagName;let c=g.tagExp,B=g.attrExpPresent,C=g.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),e&&i&&e.tagname!=="!xml"&&(i=this.saveTextToParentTag(i,e,n,!1));const Q=e;Q&&this.options.unpairedTags.indexOf(Q.tagname)!==-1&&(e=this.tagsNodeStack.pop(),n=n.substring(0,n.lastIndexOf("."))),a!==A.tagname&&(n+=n?"."+a:a);const l=s;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,n,a)){let E="";if(c.length>0&&c.lastIndexOf("/")===c.length-1)a[a.length-1]==="/"?(a=a.substr(0,a.length-1),n=n.substr(0,n.length-1),c=a):c=c.substr(0,c.length-1),s=g.closeIndex;else if(this.options.unpairedTags.indexOf(a)!==-1)s=g.closeIndex;else{const u=this.readStopNodeData(t,I,C+1);if(!u)throw new Error(`Unexpected end of ${I}`);s=u.i,E=u.tagContent}const h=new Zx(a);a!==c&&B&&(h[":@"]=this.buildAttributesMap(c,n,a)),E&&(E=this.parseTextData(E,a,n,!0,B,!0,!0)),n=n.substr(0,n.lastIndexOf(".")),h.add(this.options.textNodeName,E),this.addChild(e,h,n,l)}else{if(c.length>0&&c.lastIndexOf("/")===c.length-1){a[a.length-1]==="/"?(a=a.substr(0,a.length-1),n=n.substr(0,n.length-1),c=a):c=c.substr(0,c.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));const E=new Zx(a);a!==c&&B&&(E[":@"]=this.buildAttributesMap(c,n,a)),this.addChild(e,E,n,l),n=n.substr(0,n.lastIndexOf("."))}else{const E=new Zx(a);this.tagsNodeStack.push(e),a!==c&&B&&(E[":@"]=this.buildAttributesMap(c,n,a)),this.addChild(e,E,n,l),e=E}i="",s=C}}else i+=t[s];return A.child};function mOt(t,A,e,i){this.options.captureMetaData||(i=void 0);const n=this.options.updateTag(A.tagname,e,A[":@"]);n===!1||(typeof n=="string"&&(A.tagname=n),t.addChild(A,i))}const SOt=function(t){if(this.options.processEntities){for(let A in this.docTypeEntities){const e=this.docTypeEntities[A];t=t.replace(e.regx,e.val)}for(let A in this.lastEntities){const e=this.lastEntities[A];t=t.replace(e.regex,e.val)}if(this.options.htmlEntities)for(let A in this.htmlEntities){const e=this.htmlEntities[A];t=t.replace(e.regex,e.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function bOt(t,A,e,i){return t&&(i===void 0&&(i=A.child.length===0),t=this.parseTextData(t,A.tagname,e,!1,A[":@"]?Object.keys(A[":@"]).length!==0:!1,i),t!==void 0&&t!==""&&A.add(this.options.textNodeName,t),t=""),t}function kOt(t,A,e,i){return!!(A&&A.has(i)||t&&t.has(e))}function GOt(t,A,e=">"){let i,n="";for(let o=A;o<t.length;o++){let s=t[o];if(i)s===i&&(i="");else if(s==='"'||s==="'")i=s;else if(s===e[0])if(e[1]){if(t[o+1]===e[1])return{data:n,index:o}}else return{data:n,index:o};else s===" "&&(s=" ");n+=s}}function jx(t,A,e,i){const n=t.indexOf(A,e);if(n===-1)throw new Error(i);return n+A.length-1}function TpA(t,A,e,i=">"){const n=GOt(t,A+1,i);if(!n)return;let o=n.data;const s=n.index,r=o.search(/\s/);let g=o,a=!0;r!==-1&&(g=o.substring(0,r),o=o.substring(r+1).trimStart());const I=g;if(e){const c=g.indexOf(":");c!==-1&&(g=g.substr(c+1),a=g!==n.data.substr(c+1))}return{tagName:g,tagExp:o,closeIndex:s,attrExpPresent:a,rawTagName:I}}function xOt(t,A,e){const i=e;let n=1;for(;e<t.length;e++)if(t[e]==="<")if(t[e+1]==="/"){const o=jx(t,">",e,`${A} is not closed`);if(t.substring(e+2,o).trim()===A&&(n--,n===0))return{tagContent:t.substring(i,e),i:o};e=o}else if(t[e+1]==="?")e=jx(t,"?>",e+1,"StopNode is not closed.");else if(t.substr(e+1,3)==="!--")e=jx(t,"-->",e+3,"StopNode is not closed.");else if(t.substr(e+1,2)==="![")e=jx(t,"]]>",e,"StopNode is not closed.")-2;else{const o=TpA(t,e,">");o&&((o&&o.tagName)===A&&o.tagExp[o.tagExp.length-1]!=="/"&&n++,e=o.closeIndex)}}function qpA(t,A,e){if(A&&typeof t=="string"){const i=t.trim();return i==="true"?!0:i==="false"?!1:BOt(t,e)}else return VPt(t)?t:""}const PpA=Zx.getMetaDataSymbol();function FOt(t,A){return Sae(t,A)}function Sae(t,A,e){let i;const n={};for(let o=0;o<t.length;o++){const s=t[o],r=_Ot(s);let g="";if(e===void 0?g=r:g=e+"."+r,r===A.textNodeName)i===void 0?i=s[r]:i+=""+s[r];else{if(r===void 0)continue;if(s[r]){let a=Sae(s[r],A,g);const I=NOt(a,A);s[PpA]!==void 0&&(a[PpA]=s[PpA]),s[":@"]?ROt(a,s[":@"],g,A):Object.keys(a).length===1&&a[A.textNodeName]!==void 0&&!A.alwaysCreateTextNode?a=a[A.textNodeName]:Object.keys(a).length===0&&(A.alwaysCreateTextNode?a[A.textNodeName]="":a=""),n[r]!==void 0&&n.hasOwnProperty(r)?(Array.isArray(n[r])||(n[r]=[n[r]]),n[r].push(a)):A.isArray(r,g,I)?n[r]=[a]:n[r]=a}}}return typeof i=="string"?i.length>0&&(n[A.textNodeName]=i):i!==void 0&&(n[A.textNodeName]=i),n}function _Ot(t){const A=Object.keys(t);for(let e=0;e<A.length;e++){const i=A[e];if(i!==":@")return i}}function ROt(t,A,e,i){if(A){const n=Object.keys(A),o=n.length;for(let s=0;s<o;s++){const r=n[s];i.isArray(r,e+"."+r,!0,!0)?t[r]=[A[r]]:t[r]=A[r]}}}function NOt(t,A){const{textNodeName:e}=A,i=Object.keys(t).length;return!!(i===0||i===1&&(t[e]||typeof t[e]=="boolean"||t[e]===0))}class MOt{constructor(A){this.externalEntities={},this.options=rOt(A)}parse(A,e){if(typeof A!="string"&&A.toString)A=A.toString();else if(typeof A!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(e){e===!0&&(e={});const o=zPt(A,e);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}const i=new uOt(this.options);i.addExternalEntities(this.externalEntities);const n=i.parseXml(A);return this.options.preserveOrder||n===void 0?n:FOt(n,this.options)}addEntity(A,e){if(e.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(A.indexOf("&")!==-1||A.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(e==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[A]=e}static getMetaDataSymbol(){return Zx.getMetaDataSymbol()}}var vOt=new MOt({ignoreAttributes:!1,attributeNamePrefix:"@_",allowBooleanAttributes:!0,parseAttributeValue:!1,ignoreDeclaration:!0}),UOt=t=>{const A=vOt.parse(t);function e(o){if(o===null||typeof o!="object")return o;if(Array.isArray(o))return o.map(e);const s={},r={};for(const[g,a]of Object.entries(o))g.startsWith("@_")?r[g.slice(2)]=a:g==="#text"?s._=a:s[g]=e(a);return Object.keys(r).length&&(s.$=r),s}const i=Object.keys(A)[0];if(!i)throw new Error("Failed to parse XML: no root element found");const n=e(A[i]);return{[i]:n}},aI=class nm{token;static token;getChildren(){return[]}getXmlAttributes(){return{}}getXmlTag(){return this.token.startsWith("Shape.")?"Shape":this.token}toXml(A=0){const e=" ".repeat(A),i=this.getXmlTag(),n=this.getXmlAttributes(),o=[];for(const[a,I]of Object.entries(n))I!=null&&(typeof I=="boolean"?o.push(`${a}="${I?"True":"False"}"`):o.push(`${a}="${I}"`));const s=o.length>0?" "+o.join(" "):"",r=this.getChildren();if(r.length===0)return`${e}<${i}${s}/>`;const g=[`${e}<${i}${s}>`];for(const a of r)g.push(a.toXml(A+1));return g.push(`${e}</${i}>`),g.join(`
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.1048",
6
+ "version": "0.0.1049",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/tscircuit/tscircuit"
@@ -54,7 +54,7 @@
54
54
  "@tscircuit/checks": "^0.0.87",
55
55
  "@tscircuit/circuit-json-flex": "^0.0.3",
56
56
  "@tscircuit/circuit-json-util": "^0.0.73",
57
- "@tscircuit/cli": "^0.1.643",
57
+ "@tscircuit/cli": "^0.1.644",
58
58
  "@tscircuit/copper-pour-solver": "^0.0.14",
59
59
  "@tscircuit/core": "^0.0.927",
60
60
  "@tscircuit/eval": "^0.0.537",
@@ -65,7 +65,7 @@
65
65
  "@tscircuit/miniflex": "^0.0.4",
66
66
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
67
67
  "@tscircuit/props": "^0.0.428",
68
- "@tscircuit/runframe": "^0.0.1394",
68
+ "@tscircuit/runframe": "^0.0.1395",
69
69
  "@tscircuit/schematic-match-adapt": "^0.0.16",
70
70
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
71
71
  "@tscircuit/simple-3d-svg": "^0.0.41",