astra/am3352-sbc
A 4-layer AM3352 single-board computer with 128‑MiB DDR3, PMIC power regulation, USB‑C 5‑V PD input, dual USB host ports, HDMI output with ESD protection, microSD/UART/JTAG interfaces, addressable RGB indicators, and a PWM-driven buzzer.
- Version
- 0.1.19
- License
- unset
- Stars
- 0
dist/viewer-part-08.txt
.is_inside_copper_pour||QY({ctx:e,start:{x:u.x,y:u.y},end:{x:g.x,y:g.y},strokeWidth:u.width,stroke:c,realToCanvasMat:o,lineCap:"round"})}}Hon({ctx:e,trace:n,realToCanvasMat:o,vias:t.vias??[],platedHoles:t.platedHoles??[],layer:r})}function Kon(t){const{ctx:e,traces:n,copperPours:o,realToCanvasMat:i,colorMap:r,vias:s,platedHoles:a,renderLayers:A}=t;for(const c of Q0i(n,A)){const l=o.filter(g=>g.layer===c);if(l.length===0){rVe({ctx:e,traces:n,layer:c,realToCanvasMat:i,colorMap:r,vias:s,platedHoles:a});continue}const u=Don(e,e.canvas.width,e.canvas.height);u&&(rVe({ctx:u,traces:n,layer:c,realToCanvasMat:i,colorMap:r,vias:s,platedHoles:a}),S0i({ctx:u,copperPours:l,realToCanvasMat:i}),Non(e,u))||(e.save(),v0i({ctx:e,copperPours:l,realToCanvasMat:i}),rVe({ctx:e,traces:n,layer:c,realToCanvasMat:i,colorMap:r,vias:s,platedHoles:a}),e.restore())}}function rVe(t){const{ctx:e,traces:n,layer:o,realToCanvasMat:i,colorMap:r,vias:s,platedHoles:a}=t;for(const A of n)b0i({ctx:e,trace:A,realToCanvasMat:i,colorMap:r,vias:s,platedHoles:a,layer:o})}function S0i(t){const{ctx:e,copperPours:n,realToCanvasMat:o}=t;if(n.length!==0){e.save(),e.globalCompositeOperation="destination-out",e.fillStyle="#000";for(const i of n)e.beginPath(),qKe({ctx:e,pour:i,realToCanvasMat:o}),e.fill(i.shape==="brep"?"evenodd":"nonzero");e.restore()}}function Q0i(t,e){const n=new Set;for(const o of t)for(const i of o.route??[])i.route_type!=="wire"||!i.layer||e?.length&&!e.includes(`${i.layer}_copper`)||n.add(i.layer);return[...n]}function v0i(t){const{ctx:e,copperPours:n,realToCanvasMat:o}=t;if(n.length!==0){e.beginPath(),e.rect(0,0,e.canvas.width,e.canvas.height);for(const i of n)qKe({ctx:e,pour:i,realToCanvasMat:o});e.clip("evenodd")}}function w0i(t,e,n=[]){const o=[...t,...n].filter(a=>a.type==="pcb_via"),i=new Map;for(const a of o){const c=`${e.boardOwnerMap?.get(a.pcb_via_id)?.pcb_board_id??""}:${a.x}:${a.y}`,l=i.get(c)??[];l.push(a),i.set(c,l)}const r=t.filter(a=>a.type==="pcb_trace"),s=[];for(const a of r){const A=e.boardOwnerMap?.get(a.pcb_trace_id);for(const[c,l]of a.route.entries()){if(l.route_type!=="via")continue;const u=`${A?.pcb_board_id??""}:${l.x}:${l.y}`,g=i.get(u)??[];if(g.some(p=>p.layers.includes(l.from_layer)&&p.layers.includes(l.to_layer)))continue;const d={type:"pcb_via",pcb_via_id:`${a.pcb_trace_id}_route_via_${c}`,pcb_trace_id:a.pcb_trace_id,subcircuit_id:a.subcircuit_id,pcb_group_id:a.pcb_group_id,x:l.x,y:l.y,layers:[l.from_layer,l.to_layer],hole_diameter:l.hole_diameter??A?.min_via_hole_diameter??.25,outer_diameter:l.outer_diameter??A?.min_via_pad_diameter??.6,tented_on_top:l.tented_on_top,tented_on_bottom:l.tented_on_bottom};s.push(d),g.push(d),i.set(u,g)}}return s}function Von(t){const{ctx:e,via:n,realToCanvasMat:o,colorMap:i,layer:r}=t;dm({ctx:e,center:{x:n.x,y:n.y},radius:n.outer_diameter/2,fill:i.copper[r??"top"],realToCanvasMat:o}),e.save(),e.globalCompositeOperation="destination-out",dm({ctx:e,center:{x:n.x,y:n.y},radius:n.hole_diameter/2,fill:"#000",realToCanvasMat:o}),e.restore(),dm({ctx:e,center:{x:n.x,y:n.y},radius:n.hole_diameter/2,fill:i.drill,realToCanvasMat:o})}function Kx(t,e){if(!e.layers||e.layers.length===0)return!0;if(t.type==="pcb_silkscreen_graphic")return e.layers.some(o=>o===`${t.layer}_silkscreen`);const n=umt(t);return n.length===0?!0:n.some(o=>e.layers.includes(o))}var i2={copper:{top:"rgb(200, 52, 52)",inner1:"rgb(127, 200, 127)",inner2:"rgb(206, 125, 44)",inner3:"rgb(79, 203, 203)",inner4:"rgb(219, 98, 139)",inner5:"rgb(167, 165, 198)",inner6:"rgb(40, 204, 217)",inner7:"rgb(232, 178, 167)",inner8:"rgb(242, 237, 161)",bottom:"rgb(77, 127, 196)"},copperPour:{top:"rgb(230, 95, 95)",bottom:"rgb(122, 162, 222)"},soldermaskWithCopperUnderneath:{top:"rgb(18, 82, 50)",bottom:"rgb(77, 127, 196)"},soldermask:{top:"rgb(12, 55, 33)",bottom:"rgb(12, 55, 33)"},soldermaskOverCopper:{top:"rgb(52, 135, 73)",bottom:"rgb(52, 135, 73)"},substrate:"rgb(201, 162, 110)",drill:"#FF26E2",silkscreen:{top:"#f2eda1",bottom:"#5da9e9"},boardOutline:"rgba(255, 255, 255, 0.5)",courtyard:{top:"#FF00FF",bottom:"rgb(38, 233, 255)"},keepout:{top:"#FF6B6B",bottom:"#5da9e9"},fabricationNote:"rgba(255, 255, 255, 0.5)"};function P0i(t){return!t||t.length===0?"top":(t.find(n=>n.endsWith("_copper"))??t[0]??"top_copper").split("_")[0]}var wY=(t,e)=>t.layers?.includes(e)??!0,xl=class f4n{ctx;colorMap;realToCanvasMat;constructor(e){if("getContext"in e&&typeof e.getContext=="function"){const n=e.getContext("2d");if(!n)throw new Error("Failed to get 2D rendering context from canvas");this.ctx=n}else this.ctx=e;this.colorMap={...i2},this.realToCanvasMat=QQ()}configure(e){e.colorOverrides&&(this.colorMap={...this.colorMap,...e.colorOverrides,copper:{...this.colorMap.copper,...e.colorOverrides.copper},copperPour:{...this.colorMap.copperPour,...e.colorOverrides.copperPour},silkscreen:{...this.colorMap.silkscreen,...e.colorOverrides.silkscreen},soldermask:{...this.colorMap.soldermask,...e.colorOverrides.soldermask},soldermaskWithCopperUnderneath:{...this.colorMap.soldermaskWithCopperUnderneath,...e.colorOverrides.soldermaskWithCopperUnderneath},soldermaskOverCopper:{...this.colorMap.soldermaskOverCopper,...e.colorOverrides.soldermaskOverCopper}})}setCameraBounds(e){const n=this.ctx.canvas,o=n.width,i=n.height,r=e.maxX-e.minX,s=e.maxY-e.minY,a=o/r,A=i/s,c=Math.min(a,A),l=(o-r*c)/2,u=(i-s*c)/2;this.realToCanvasMat=Ad(pA(l,u),dC(c,-c),pA(-e.minX,-e.maxY))}drawElements(e,n={}){this.ctx.boardOwnerMap=omt([...n.clipContextElements??[],...e]),e=[...e,...w0i(e,this.ctx,n.clipContextElements)];const o=P0i(n.layers),i=e.find(x=>x.type==="pcb_board"),r=e.find(x=>x.type==="pcb_panel");r&&Oli({ctx:this.ctx,panel:r,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap});const s=n.drawBoardMaterial??!1,a=n.drawSoldermask??!1,A=n.drawSolderPaste??!1,c=n.drawSoldermaskTop!==void 0||n.drawSoldermaskBottom!==void 0,l=n.drawSolderPasteTop!==void 0||n.drawSolderPasteBottom!==void 0,u=a&&(n.drawSoldermaskTop??!c),g=a&&(n.drawSoldermaskBottom??!1),h=A&&(n.drawSolderPasteTop??!l)&&e.some(x=>x.type==="pcb_solder_paste"&&x.layer==="top"),d=A&&(n.drawSolderPasteBottom??!1)&&e.some(x=>x.type==="pcb_solder_paste"&&x.layer==="bottom"),p=u||h,m=e.filter(x=>Kx(x,n)&&x.type==="pcb_via"&&wY(x,o)),_=e.filter(x=>Kx(x,n)&&x.type==="pcb_hole"),f=e.filter(x=>Kx(x,n)&&x.type==="pcb_plated_hole"&&wY(x,o)),I=e.filter(x=>Kx(x,n)&&x.type==="pcb_cutout"),C=(n.clipContextElements??e).filter(x=>Kx(x,n)&&x.type==="pcb_copper_pour"),y=e.filter(x=>Kx(x,n)&&x.type==="pcb_trace");i&&wci({ctx:this.ctx,board:i,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,drawBoardMaterial:s,minBoardOutlineStrokePx:n.minBoardOutlineStrokePx});for(const x of e)Kx(x,n)&&x.type==="pcb_copper_pour"&&Dci({ctx:this.ctx,pour:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap});for(const x of e)Kx(x,n)&&(x.type==="pcb_smtpad"&&i0i({ctx:this.ctx,pad:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,holes:_,platedHoles:f,vias:m,cutouts:I}),x.type==="pcb_copper_text"&&Xci({ctx:this.ctx,text:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}));if(p){Kon({ctx:this.ctx,traces:y,copperPours:C,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,vias:m,platedHoles:f,renderLayers:n.layers});for(const x of e)Kx(x,n)&&(x.type==="pcb_hole"&&fon({ctx:this.ctx,hole:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,soldermaskMargin:u?x.soldermask_margin:void 0,drawSoldermask:u}),x.type==="pcb_plated_hole"&&wY(x,o)&&won({ctx:this.ctx,hole:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,soldermaskMargin:u?x.soldermask_margin:void 0,drawSoldermask:u,layer:o}),x.type==="pcb_via"&&wY(x,o)&&Von({ctx:this.ctx,via:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,layer:o}))}if(u&&Uon({ctx:this.ctx,elements:e,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,layer:"top",drawSoldermask:!0}),h)for(const x of e)x.type!=="pcb_solder_paste"||x.layer!=="top"||Mon({ctx:this.ctx,solderPaste:x,realToCanvasMat:this.realToCanvasMat});for(const x of e)Kx(x,n)&&(x.type==="pcb_silkscreen_text"&&n0i({ctx:this.ctx,text:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),x.type==="pcb_silkscreen_rect"&&Zli({ctx:this.ctx,rect:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),x.type==="pcb_silkscreen_circle"&&Yli({ctx:this.ctx,circle:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),x.type==="pcb_silkscreen_line"&&Vli({ctx:this.ctx,line:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),x.type==="pcb_silkscreen_path"&&jli({ctx:this.ctx,path:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),x.type==="pcb_silkscreen_pill"&&qli({ctx:this.ctx,pill:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),x.type==="pcb_silkscreen_oval"&&Jli({ctx:this.ctx,oval:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),x.type==="pcb_silkscreen_graphic"&&Uli({ctx:this.ctx,graphic:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}));p||Kon({ctx:this.ctx,traces:y,copperPours:C,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,vias:m,platedHoles:f,renderLayers:n.layers});for(const x of e)Kx(x,n)&&x.type==="pcb_hole"&&!p&&fon({ctx:this.ctx,hole:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,soldermaskMargin:u?x.soldermask_margin:void 0,drawSoldermask:u});for(const x of e)Kx(x,n)&&(x.type==="pcb_plated_hole"&&!p&&wY(x,o)&&won({ctx:this.ctx,hole:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,soldermaskMargin:u?x.soldermask_margin:void 0,drawSoldermask:u,layer:o}),x.type==="pcb_via"&&!p&&wY(x,o)&&Von({ctx:this.ctx,via:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,layer:o}));if(g&&Uon({ctx:this.ctx,elements:e,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,layer:"bottom",drawSoldermask:!0}),d)for(const x of e)x.type!=="pcb_solder_paste"||x.layer!=="bottom"||Mon({ctx:this.ctx,solderPaste:x,realToCanvasMat:this.realToCanvasMat});for(const x of e)Kx(x,n)&&x.type==="pcb_cutout"&&rli({ctx:this.ctx,cutout:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap});for(const x of e){if(!Kx(x,n))continue;x.type==="pcb_keepout"&&Dli({ctx:this.ctx,keepout:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),x.type==="pcb_fabrication_note_text"&&mli({ctx:this.ctx,text:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),x.type==="pcb_fabrication_note_rect"&&hli({ctx:this.ctx,rect:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap});const E=n.showPcbNotes??!0;E&&x.type==="pcb_note_rect"&&Fli({realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,ctx:this.ctx,rect:x}),x.type==="pcb_fabrication_note_path"&&dli({ctx:this.ctx,path:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),E&&x.type==="pcb_note_path"&&kli({ctx:this.ctx,path:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),E&&x.type==="pcb_note_text"&&Hli({ctx:this.ctx,text:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),E&&x.type==="pcb_note_line"&&Tli({ctx:this.ctx,line:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),E&&x.type==="pcb_note_dimension"&&Rli({ctx:this.ctx,pcbNoteDimension:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),x.type==="pcb_fabrication_note_dimension"&&gli({ctx:this.ctx,pcbFabricationNoteDimension:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),x.type==="pcb_courtyard_circle"&&eli({ctx:this.ctx,circle:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),x.type==="pcb_courtyard_rect"&&ili({ctx:this.ctx,rect:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),x.type==="pcb_courtyard_outline"&&nli({ctx:this.ctx,outline:x,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap})}if(n.clearDrillHoles&&this.clearDrillHoles(e,o),n.showDebugObjects){const x=new Map;for(const E of e){if(E.type!=="pcb_debug_object")continue;const B=E.shape==="rect"?`${E.center.x}:${E.center.y}:${E.size.width}:${E.size.height}`:void 0,S=B?x.get(B)??0:0;Ali({ctx:this.ctx,debugObject:E,realToCanvasMat:this.realToCanvasMat,labelStackIndex:S}),B&&x.set(B,S+1)}}}clearDrillHoles(e,n){const o=e.filter(a=>a.type==="pcb_hole"||a.type==="pcb_plated_hole"||a.type==="pcb_via"||a.type==="pcb_cutout");if(o.length===0)return;const i="rgba(0,0,0,0)",r=new f4n(this.ctx);r.realToCanvasMat=this.realToCanvasMat,r.configure({colorOverrides:{copper:{top:i,bottom:i,inner1:i,inner2:i,inner3:i,inner4:i,inner5:i,inner6:i,inner7:i,inner8:i},drill:"#000"}}),this.ctx.save(),this.ctx.globalCompositeOperation="destination-out";const s=this.ctx.boardOwnerMap;r.drawElements(o,{layers:[`${n}_copper`],showPcbNotes:!1}),this.ctx.boardOwnerMap=s,this.ctx.restore()}};let M0i={data:""},D0i=t=>{if(typeof window=="object"){let e=(t?t.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return e.nonce=window.__nonce__,e.parentNode||(t||document.head).appendChild(e),e.firstChild}return t||M0i},N0i=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,R0i=/\/\*[^]*?\*\/| +/g,zon=/\n+/g,cP=(t,e)=>{let n="",o="",i="";for(let r in t){let s=t[r];r[0]=="@"?r[1]=="i"?n=r+" "+s+";":o+=r[1]=="f"?cP(s,r):r+"{"+cP(s,r[1]=="k"?"":e)+"}":typeof s=="object"?o+=cP(s,e?e.replace(/([^,])+/g,a=>r.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,A=>/&/.test(A)?A.replace(/&/g,a):a?a+" "+A:A)):r):s!=null&&(r=r[1]=="-"?r:r.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=cP.p?cP.p(r,s):r+":"+s+";")}return n+(e&&i?e+"{"+i+"}":i)+o},lP={},Jon=t=>{if(typeof t=="object"){let e="";for(let n in t)e+=n+Jon(t[n]);return e}return t},T0i=(t,e,n,o,i)=>{let r=Jon(t),s=lP[r]||(lP[r]=(A=>{let c=0,l=11;for(;c<A.length;)l=101*l+A.charCodeAt(c++)>>>0;return"go"+l})(r));if(!lP[s]){let A=r!==t?t:(c=>{let l,u,g=[{}];for(;l=N0i.exec(c.replace(R0i,""));)l[4]?g.shift():l[3]?(u=l[3].replace(zon," ").trim(),g.unshift(g[0][u]=g[0][u]||{})):g[0][l[1]]=l[2].replace(zon," ").trim();return g[0]})(t);lP[s]=cP(i?{["@keyframes "+s]:A}:A,n?"":"."+s)}let a=n&&lP.g;return n&&(lP.g=lP[s]),((A,c,l,u)=>{u?c.data=c.data.replace(u,A):c.data.indexOf(A)===-1&&(c.data=l?A+c.data:c.data+A)})(lP[s],e,o,a),s},k0i=(t,e,n)=>t.reduce((o,i,r)=>{let s=e[r];if(s&&s.call){let a=s(n),A=a&&a.props&&a.props.className||/^go/.test(a)&&a;s=A?"."+A:a&&typeof a=="object"?a.props?"":cP(a,""):a===!1?"":a}return o+i+(s??"")},"");function Yhe(t){let e=this||{},n=t.call?t(e.p):t;return T0i(n.unshift?n.raw?k0i(n,[].slice.call(arguments,1),e.p):n.reduce((o,i)=>Object.assign(o,i&&i.call?i(e.p):i),{}):n,D0i(e.target),e.g,e.o,e.k)}let Won,sVe,aVe;Yhe.bind({g:1});let AS=Yhe.bind({k:1});function F0i(t,e,n,o){cP.p=e,Won=t,sVe=n,aVe=o}function uP(t,e){let n=this||{};return function(){let o=arguments;function i(r,s){let a=Object.assign({},r),A=a.className||i.className;n.p=Object.assign({theme:sVe&&sVe()},a),n.o=/go\d/.test(A),a.className=Yhe.apply(n,o)+(A?" "+A:"");let c=t;return t[0]&&(c=a.as||t,delete a.as),aVe&&c[0]&&aVe(a),Won(c,a)}return i}}var L0i=t=>typeof t=="function",Uhe=(t,e)=>L0i(t)?t(e):t,H0i=(()=>{let t=0;return()=>(++t).toString()})(),jon=(()=>{let t;return()=>{if(t===void 0&&typeof window<"u"){let e=matchMedia("(prefers-reduced-motion: reduce)");t=!e||e.matches}return t}})(),O0i=20,AVe="default",$on=(t,e)=>{let{toastLimit:n}=t.settings;switch(e.type){case 0:return{...t,toasts:[e.toast,...t.toasts].slice(0,n)};case 1:return{...t,toasts:t.toasts.map(s=>s.id===e.toast.id?{...s,...e.toast}:s)};case 2:let{toast:o}=e;return $on(t,{type:t.toasts.find(s=>s.id===o.id)?1:0,toast:o});case 3:let{toastId:i}=e;return{...t,toasts:t.toasts.map(s=>s.id===i||i===void 0?{...s,dismissed:!0,visible:!1}:s)};case 4:return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(s=>s.id!==e.toastId)};case 5:return{...t,pausedAt:e.time};case 6:let r=e.time-(t.pausedAt||0);return{...t,pausedAt:void 0,toasts:t.toasts.map(s=>({...s,pauseDuration:s.pauseDuration+r}))}}},Khe=[],qon={toasts:[],pausedAt:void 0,settings:{toastLimit:O0i}},b6={},Xon=(t,e=AVe)=>{b6[e]=$on(b6[e]||qon,t),Khe.forEach(([n,o])=>{n===e&&o(b6[e])})},Zon=t=>Object.keys(b6).forEach(e=>Xon(t,e)),G0i=t=>Object.keys(b6).find(e=>b6[e].toasts.some(n=>n.id===t)),Vhe=(t=AVe)=>e=>{Xon(e,t)},Y0i={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},U0i=(t={},e=AVe)=>{let[n,o]=ee.useState(b6[e]||qon),i=ee.useRef(b6[e]);ee.useEffect(()=>(i.current!==b6[e]&&o(b6[e]),Khe.push([e,o]),()=>{let s=Khe.findIndex(([a])=>a===e);s>-1&&Khe.splice(s,1)}),[e]);let r=n.toasts.map(s=>{var a,A,c;return{...t,...t[s.type],...s,removeDelay:s.removeDelay||((a=t[s.type])==null?void 0:a.removeDelay)||t?.removeDelay,duration:s.duration||((A=t[s.type])==null?void 0:A.duration)||t?.duration||Y0i[s.type],style:{...t.style,...(c=t[s.type])==null?void 0:c.style,...s.style}}});return{...n,toasts:r}},K0i=(t,e="blank",n)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:e,ariaProps:{role:"status","aria-live":"polite"},message:t,pauseDuration:0,...n,id:n?.id||H0i()}),xX=t=>(e,n)=>{let o=K0i(e,t,n);return Vhe(o.toasterId||G0i(o.id))({type:2,toast:o}),o.id},ua=(t,e)=>xX("blank")(t,e);ua.error=xX("error"),ua.success=xX("success"),ua.loading=xX("loading"),ua.custom=xX("custom"),ua.dismiss=(t,e)=>{let n={type:3,toastId:t};e?Vhe(e)(n):Zon(n)},ua.dismissAll=t=>ua.dismiss(void 0,t),ua.remove=(t,e)=>{let n={type:4,toastId:t};e?Vhe(e)(n):Zon(n)},ua.removeAll=t=>ua.remove(void 0,t),ua.promise=(t,e,n)=>{let o=ua.loading(e.loading,{...n,...n?.loading});return typeof t=="function"&&(t=t()),t.then(i=>{let r=e.success?Uhe(e.success,i):void 0;return r?ua.success(r,{id:o,...n,...n?.success}):ua.dismiss(o),i}).catch(i=>{let r=e.error?Uhe(e.error,i):void 0;r?ua.error(r,{id:o,...n,...n?.error}):ua.dismiss(o)}),t};var V0i=1e3,z0i=(t,e="default")=>{let{toasts:n,pausedAt:o}=U0i(t,e),i=ee.useRef(new Map).current,r=ee.useCallback((u,g=V0i)=>{if(i.has(u))return;let h=setTimeout(()=>{i.delete(u),s({type:4,toastId:u})},g);i.set(u,h)},[]);ee.useEffect(()=>{if(o)return;let u=Date.now(),g=n.map(h=>{if(h.duration===1/0)return;let d=(h.duration||0)+h.pauseDuration-(u-h.createdAt);if(d<0){h.visible&&ua.dismiss(h.id);return}return setTimeout(()=>ua.dismiss(h.id,e),d)});return()=>{g.forEach(h=>h&&clearTimeout(h))}},[n,o,e]);let s=ee.useCallback(Vhe(e),[e]),a=ee.useCallback(()=>{s({type:5,time:Date.now()})},[s]),A=ee.useCallback((u,g)=>{s({type:1,toast:{id:u,height:g}})},[s]),c=ee.useCallback(()=>{o&&s({type:6,time:Date.now()})},[o,s]),l=ee.useCallback((u,g)=>{let{reverseOrder:h=!1,gutter:d=8,defaultPosition:p}=g||{},m=n.filter(I=>(I.position||p)===(u.position||p)&&I.height),_=m.findIndex(I=>I.id===u.id),f=m.filter((I,C)=>C<_&&I.visible).length;return m.filter(I=>I.visible).slice(...h?[f+1]:[0,f]).reduce((I,C)=>I+(C.height||0)+d,0)},[n]);return ee.useEffect(()=>{n.forEach(u=>{if(u.dismissed)r(u.id,u.removeDelay);else{let g=i.get(u.id);g&&(clearTimeout(g),i.delete(u.id))}})},[n,r]),{toasts:n,handlers:{updateHeight:A,startPause:a,endPause:c,calculateOffset:l}}},J0i=AS` from { transform: scale(0) rotate(45deg); opacity: 0; } to { transform: scale(1) rotate(45deg); opacity: 1; }`,W0i=AS` from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; }`,j0i=AS` from { transform: scale(0) rotate(90deg); opacity: 0; } to { transform: scale(1) rotate(90deg); opacity: 1; }`,$0i=uP("div")` width: 20px; opacity: 0; height: 20px; border-radius: 10px; background: ${t=>t.primary||"#ff4b4b"}; position: relative; transform: rotate(45deg); animation: ${J0i} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; animation-delay: 100ms; &:after, &:before { content: ''; animation: ${W0i} 0.15s ease-out forwards; animation-delay: 150ms; position: absolute; border-radius: 3px; opacity: 0; background: ${t=>t.secondary||"#fff"}; bottom: 9px; left: 4px; height: 2px; width: 12px; } &:before { animation: ${j0i} 0.15s ease-out forwards; animation-delay: 180ms; transform: rotate(90deg); } `,q0i=AS` from { transform: rotate(0deg); } to { transform: rotate(360deg); } `,X0i=uP("div")` width: 12px; height: 12px; box-sizing: border-box; border: 2px solid; border-radius: 100%; border-color: ${t=>t.secondary||"#e0e0e0"}; border-right-color: ${t=>t.primary||"#616161"}; animation: ${q0i} 1s linear infinite; `,Z0i=AS` from { transform: scale(0) rotate(45deg); opacity: 0; } to { transform: scale(1) rotate(45deg); opacity: 1; }`,eui=AS` 0% { height: 0; width: 0; opacity: 0; } 40% { height: 0; width: 6px; opacity: 1; } 100% { opacity: 1; height: 10px; }`,tui=uP("div")` width: 20px; opacity: 0; height: 20px; border-radius: 10px; background: ${t=>t.primary||"#61d345"}; position: relative; transform: rotate(45deg); animation: ${Z0i} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; animation-delay: 100ms; &:after { content: ''; box-sizing: border-box; animation: ${eui} 0.2s ease-out forwards; opacity: 0; animation-delay: 200ms; position: absolute; border-right: 2px solid; border-bottom: 2px solid; border-color: ${t=>t.secondary||"#fff"}; bottom: 6px; left: 6px; height: 10px; width: 6px; } `,nui=uP("div")` position: absolute; `,oui=uP("div")` position: relative; display: flex; justify-content: center; align-items: center; min-width: 20px; min-height: 20px; `,iui=AS` from { transform: scale(0.6); opacity: 0.4; } to { transform: scale(1); opacity: 1; }`,rui=uP("div")` position: relative; transform: scale(0.6); opacity: 0.4; min-width: 20px; animation: ${iui} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; `,sui=({toast:t})=>{let{icon:e,type:n,iconTheme:o}=t;return e!==void 0?typeof e=="string"?ee.createElement(rui,null,e):e:n==="blank"?null:ee.createElement(oui,null,ee.createElement(X0i,{...o}),n!=="loading"&&ee.createElement(nui,null,n==="error"?ee.createElement($0i,{...o}):ee.createElement(tui,{...o})))},aui=t=>` 0% {transform: translate3d(0,${t*-200}%,0) scale(.6); opacity:.5;} 100% {transform: translate3d(0,0,0) scale(1); opacity:1;} `,Aui=t=>` 0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;} 100% {transform: translate3d(0,${t*-150}%,-1px) scale(.6); opacity:0;} `,cui="0%{opacity:0;} 100%{opacity:1;}",lui="0%{opacity:1;} 100%{opacity:0;}",uui=uP("div")` :where(&) { display: flex; align-items: center; background: #fff; color: #363636; line-height: 1.3; will-change: transform; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05); max-width: 350px; pointer-events: auto; padding: 8px 10px; border-radius: 8px; } `,gui=uP("div")` display: flex; justify-content: center; margin: 4px 10px; color: inherit; flex: 1 1 auto; white-space: pre-line; `,dui=(t,e)=>{let n=t.includes("top")?1:-1,[o,i]=jon()?[cui,lui]:[aui(n),Aui(n)];return{animation:e?`${AS(o)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${AS(i)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},hui=ee.memo(({toast:t,position:e,style:n,children:o})=>{let i=t.height?dui(t.position||e||"top-center",t.visible):{opacity:0},r=ee.createElement(sui,{toast:t}),s=ee.createElement(gui,{...t.ariaProps},Uhe(t.message,t));return ee.createElement(uui,{className:t.className,style:{...i,...n,...t.style}},typeof o=="function"?o({icon:r,message:s}):ee.createElement(ee.Fragment,null,r,s))});F0i(ee.createElement);var pui=({id:t,className:e,style:n,onHeightUpdate:o,children:i})=>{let r=ee.useCallback(s=>{if(s){let a=()=>{let A=s.getBoundingClientRect().height;o(t,A)};a(),new MutationObserver(a).observe(s,{subtree:!0,childList:!0,characterData:!0})}},[t,o]);return ee.createElement("div",{ref:r,className:e,style:n},i)},mui=(t,e)=>{let n=t.includes("top"),o=n?{top:0}:{bottom:0},i=t.includes("center")?{justifyContent:"center"}:t.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:jon()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${e*(n?1:-1)}px)`,...o,...i}},_ui=Yhe` z-index: 9999; > * { pointer-events: auto; } `,zhe=16,ein=({reverseOrder:t,position:e="top-center",toastOptions:n,gutter:o,children:i,toasterId:r,containerStyle:s,containerClassName:a})=>{let{toasts:A,handlers:c}=z0i(n,r);return ee.createElement("div",{"data-rht-toaster":r||"",style:{position:"fixed",zIndex:9999,top:zhe,left:zhe,right:zhe,bottom:zhe,pointerEvents:"none",...s},className:a,onMouseEnter:c.startPause,onMouseLeave:c.endPause},A.map(l=>{let u=l.position||e,g=c.calculateOffset(l,{reverseOrder:t,gutter:o,defaultPosition:e}),h=mui(u,g);return ee.createElement(pui,{id:l.id,key:l.id,onHeightUpdate:c.updateHeight,className:l.visible?_ui:"",style:h},l.type==="custom"?Uhe(l.message,l):i?i(l):ee.createElement(hui,{toast:l,position:u}))}))},cVe={env:{},version:""},fui=Object.create,tin=Object.defineProperty,Iui=Object.getOwnPropertyDescriptor,nin=Object.getOwnPropertyNames,Cui=Object.getPrototypeOf,yui=Object.prototype.hasOwnProperty,yt=(t,e)=>function(){return e||(0,t[nin(t)[0]])((e={exports:{}}).exports,e),e.exports},xui=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of nin(e))!yui.call(t,i)&&i!==n&&tin(t,i,{get:()=>e[i],enumerable:!(o=Iui(e,i))||o.enumerable});return t},_0=(t,e,n)=>(n=t!=null?fui(Cui(t)):{},xui(tin(n,"default",{value:t,enumerable:!0}),t)),ga=yt({"node_modules/@jscad/modeling/src/utils/flatten.js"(t,e){var n=o=>o.flat(1/0);e.exports=n}}),Eui=yt({"node_modules/@jscad/modeling/src/geometries/geom2/clone.js"(t,e){var n=o=>Object.assign({},o);e.exports=n}}),Bui=yt({"node_modules/@jscad/modeling/src/maths/mat4/add.js"(t,e){var n=(o,i,r)=>(o[0]=i[0]+r[0],o[1]=i[1]+r[1],o[2]=i[2]+r[2],o[3]=i[3]+r[3],o[4]=i[4]+r[4],o[5]=i[5]+r[5],o[6]=i[6]+r[6],o[7]=i[7]+r[7],o[8]=i[8]+r[8],o[9]=i[9]+r[9],o[10]=i[10]+r[10],o[11]=i[11]+r[11],o[12]=i[12]+r[12],o[13]=i[13]+r[13],o[14]=i[14]+r[14],o[15]=i[15]+r[15],o);e.exports=n}}),lVe=yt({"node_modules/@jscad/modeling/src/maths/mat4/create.js"(t,e){var n=()=>[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=n}}),bui=yt({"node_modules/@jscad/modeling/src/maths/mat4/clone.js"(t,e){var n=lVe(),o=i=>{const r=n();return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],r};e.exports=o}}),oin=yt({"node_modules/@jscad/modeling/src/maths/mat4/copy.js"(t,e){var n=(o,i)=>(o[0]=i[0],o[1]=i[1],o[2]=i[2],o[3]=i[3],o[4]=i[4],o[5]=i[5],o[6]=i[6],o[7]=i[7],o[8]=i[8],o[9]=i[9],o[10]=i[10],o[11]=i[11],o[12]=i[12],o[13]=i[13],o[14]=i[14],o[15]=i[15],o);e.exports=n}}),Sui=yt({"node_modules/@jscad/modeling/src/maths/mat4/invert.js"(t,e){var n=(o,i)=>{const r=i[0],s=i[1],a=i[2],A=i[3],c=i[4],l=i[5],u=i[6],g=i[7],h=i[8],d=i[9],p=i[10],m=i[11],_=i[12],f=i[13],I=i[14],C=i[15],y=r*l-s*c,x=r*u-a*c,E=r*g-A*c,B=s*u-a*l,S=s*g-A*l,Q=a*g-A*u,w=h*f-d*_,M=h*I-p*_,k=h*C-m*_,R=d*I-p*f,F=d*C-m*f,O=p*C-m*I;let U=y*O-x*F+E*R+B*k-S*M+Q*w;return U?(U=1/U,o[0]=(l*O-u*F+g*R)*U,o[1]=(a*F-s*O-A*R)*U,o[2]=(f*Q-I*S+C*B)*U,o[3]=(p*S-d*Q-m*B)*U,o[4]=(u*k-c*O-g*M)*U,o[5]=(r*O-a*k+A*M)*U,o[6]=(I*E-_*Q-C*x)*U,o[7]=(h*Q-p*E+m*x)*U,o[8]=(c*F-l*k+g*w)*U,o[9]=(s*k-r*F-A*w)*U,o[10]=(_*S-f*E+C*y)*U,o[11]=(d*E-h*S-m*y)*U,o[12]=(l*M-c*R-u*w)*U,o[13]=(r*R-s*M+a*w)*U,o[14]=(f*x-_*B-I*y)*U,o[15]=(h*B-d*x+p*y)*U,o):null};e.exports=n}}),Qui=yt({"node_modules/@jscad/modeling/src/maths/mat4/equals.js"(t,e){var n=(o,i)=>o[0]===i[0]&&o[1]===i[1]&&o[2]===i[2]&&o[3]===i[3]&&o[4]===i[4]&&o[5]===i[5]&&o[6]===i[6]&&o[7]===i[7]&&o[8]===i[8]&&o[9]===i[9]&&o[10]===i[10]&&o[11]===i[11]&&o[12]===i[12]&&o[13]===i[13]&&o[14]===i[14]&&o[15]===i[15];e.exports=n}}),mc=yt({"node_modules/@jscad/modeling/src/maths/constants.js"(t,e){var n=1e5,o=1e-5,i=1e-13,r=Math.PI*2;e.exports={EPS:o,NEPS:i,TAU:r,spatialResolution:n}}}),hI=yt({"node_modules/@jscad/modeling/src/maths/utils/trigonometry.js"(t,e){var{NEPS:n}=mc(),o=s=>Math.abs(s)<n?0:s,i=s=>o(Math.sin(s)),r=s=>o(Math.cos(s));e.exports={sin:i,cos:r}}}),iin=yt({"node_modules/@jscad/modeling/src/maths/mat4/identity.js"(t,e){var n=o=>(o[0]=1,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=1,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=1,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o);e.exports=n}}),rin=yt({"node_modules/@jscad/modeling/src/maths/mat4/fromRotation.js"(t,e){var{EPS:n}=mc(),{sin:o,cos:i}=hI(),r=iin(),s=(a,A,c)=>{let[l,u,g]=c;const h=l*l+u*u+g*g;if(Math.abs(h)<n)return r(a);const d=1/Math.sqrt(h);l*=d,u*=d,g*=d;const p=o(A),m=i(A),_=1-m;return a[0]=l*l*_+m,a[1]=u*l*_+g*p,a[2]=g*l*_-u*p,a[3]=0,a[4]=l*u*_-g*p,a[5]=u*u*_+m,a[6]=g*u*_+l*p,a[7]=0,a[8]=l*g*_+u*p,a[9]=u*g*_-l*p,a[10]=g*g*_+m,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a};e.exports=s}}),vui=yt({"node_modules/@jscad/modeling/src/maths/mat4/fromScaling.js"(t,e){var n=(o,i)=>(o[0]=i[0],o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=i[1],o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=i[2],o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o);e.exports=n}}),wui=yt({"node_modules/@jscad/modeling/src/maths/mat4/fromTaitBryanRotation.js"(t,e){var{sin:n,cos:o}=hI(),i=(r,s,a,A)=>{const c=n(s),l=o(s),u=n(a),g=o(a),h=n(A),d=o(A);return r[0]=g*l,r[1]=g*c,r[2]=-u,r[3]=0,r[4]=h*u*l-d*c,r[5]=d*l+h*u*c,r[6]=h*g,r[7]=0,r[8]=h*c+d*u*l,r[9]=d*u*c-h*l,r[10]=d*g,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r};e.exports=i}}),Pui=yt({"node_modules/@jscad/modeling/src/maths/mat4/fromTranslation.js"(t,e){var n=(o,i)=>(o[0]=1,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=1,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=1,o[11]=0,o[12]=i[0],o[13]=i[1],o[14]=i[2],o[15]=1,o);e.exports=n}}),Mui=yt({"node_modules/@jscad/modeling/src/maths/mat4/fromValues.js"(t,e){var n=lVe(),o=(i,r,s,a,A,c,l,u,g,h,d,p,m,_,f,I)=>{const C=n();return C[0]=i,C[1]=r,C[2]=s,C[3]=a,C[4]=A,C[5]=c,C[6]=l,C[7]=u,C[8]=g,C[9]=h,C[10]=d,C[11]=p,C[12]=m,C[13]=_,C[14]=f,C[15]=I,C};e.exports=o}}),sin=yt({"node_modules/@jscad/modeling/src/maths/vec3/abs.js"(t,e){var n=(o,i)=>(o[0]=Math.abs(i[0]),o[1]=Math.abs(i[1]),o[2]=Math.abs(i[2]),o);e.exports=n}}),ain=yt({"node_modules/@jscad/modeling/src/maths/vec3/add.js"(t,e){var n=(o,i,r)=>(o[0]=i[0]+r[0],o[1]=i[1]+r[1],o[2]=i[2]+r[2],o);e.exports=n}}),Jhe=yt({"node_modules/@jscad/modeling/src/maths/vec3/dot.js"(t,e){var n=(o,i)=>o[0]*i[0]+o[1]*i[1]+o[2]*i[2];e.exports=n}}),Dui=yt({"node_modules/@jscad/modeling/src/maths/vec3/angle.js"(t,e){var n=Jhe(),o=(i,r)=>{const s=i[0],a=i[1],A=i[2],c=r[0],l=r[1],u=r[2],g=Math.sqrt(s*s+a*a+A*A),h=Math.sqrt(c*c+l*l+u*u),d=g*h,p=d&&n(i,r)/d;return Math.acos(Math.min(Math.max(p,-1),1))};e.exports=o}}),Whe=yt({"node_modules/@jscad/modeling/src/maths/vec3/create.js"(t,e){var n=()=>[0,0,0];e.exports=n}}),Nui=yt({"node_modules/@jscad/modeling/src/maths/vec3/clone.js"(t,e){var n=Whe(),o=i=>{const r=n();return r[0]=i[0],r[1]=i[1],r[2]=i[2],r};e.exports=o}}),Ain=yt({"node_modules/@jscad/modeling/src/maths/vec3/copy.js"(t,e){var n=(o,i)=>(o[0]=i[0],o[1]=i[1],o[2]=i[2],o);e.exports=n}}),EX=yt({"node_modules/@jscad/modeling/src/maths/vec3/cross.js"(t,e){var n=(o,i,r)=>{const s=i[0],a=i[1],A=i[2],c=r[0],l=r[1],u=r[2];return o[0]=a*u-A*l,o[1]=A*c-s*u,o[2]=s*l-a*c,o};e.exports=n}}),cin=yt({"node_modules/@jscad/modeling/src/maths/vec3/distance.js"(t,e){var n=(o,i)=>{const r=i[0]-o[0],s=i[1]-o[1],a=i[2]-o[2];return Math.sqrt(r*r+s*s+a*a)};e.exports=n}}),Rui=yt({"node_modules/@jscad/modeling/src/maths/vec3/divide.js"(t,e){var n=(o,i,r)=>(o[0]=i[0]/r[0],o[1]=i[1]/r[1],o[2]=i[2]/r[2],o);e.exports=n}}),Tui=yt({"node_modules/@jscad/modeling/src/maths/vec3/equals.js"(t,e){var n=(o,i)=>o[0]===i[0]&&o[1]===i[1]&&o[2]===i[2];e.exports=n}}),kui=yt({"node_modules/@jscad/modeling/src/maths/vec3/fromScalar.js"(t,e){var n=(o,i)=>(o[0]=i,o[1]=i,o[2]=i,o);e.exports=n}}),Fui=yt({"node_modules/@jscad/modeling/src/maths/vec3/fromValues.js"(t,e){var n=Whe(),o=(i,r,s)=>{const a=n();return a[0]=i,a[1]=r,a[2]=s,a};e.exports=o}}),Lui=yt({"node_modules/@jscad/modeling/src/maths/vec3/fromVec2.js"(t,e){var n=(o,i,r=0)=>(o[0]=i[0],o[1]=i[1],o[2]=r,o);e.exports=n}}),lin=yt({"node_modules/@jscad/modeling/src/maths/vec3/length.js"(t,e){var n=o=>{const i=o[0],r=o[1],s=o[2];return Math.sqrt(i*i+r*r+s*s)};e.exports=n}}),Hui=yt({"node_modules/@jscad/modeling/src/maths/vec3/lerp.js"(t,e){var n=(o,i,r,s)=>(o[0]=i[0]+s*(r[0]-i[0]),o[1]=i[1]+s*(r[1]-i[1]),o[2]=i[2]+s*(r[2]-i[2]),o);e.exports=n}}),uin=yt({"node_modules/@jscad/modeling/src/maths/vec3/max.js"(t,e){var n=(o,i,r)=>(o[0]=Math.max(i[0],r[0]),o[1]=Math.max(i[1],r[1]),o[2]=Math.max(i[2],r[2]),o);e.exports=n}}),gin=yt({"node_modules/@jscad/modeling/src/maths/vec3/min.js"(t,e){var n=(o,i,r)=>(o[0]=Math.min(i[0],r[0]),o[1]=Math.min(i[1],r[1]),o[2]=Math.min(i[2],r[2]),o);e.exports=n}}),Oui=yt({"node_modules/@jscad/modeling/src/maths/vec3/multiply.js"(t,e){var n=(o,i,r)=>(o[0]=i[0]*r[0],o[1]=i[1]*r[1],o[2]=i[2]*r[2],o);e.exports=n}}),Gui=yt({"node_modules/@jscad/modeling/src/maths/vec3/negate.js"(t,e){var n=(o,i)=>(o[0]=-i[0],o[1]=-i[1],o[2]=-i[2],o);e.exports=n}}),uVe=yt({"node_modules/@jscad/modeling/src/maths/vec3/normalize.js"(t,e){var n=(o,i)=>{const r=i[0],s=i[1],a=i[2];let A=r*r+s*s+a*a;return A>0&&(A=1/Math.sqrt(A)),o[0]=r*A,o[1]=s*A,o[2]=a*A,o};e.exports=n}}),Yui=yt({"node_modules/@jscad/modeling/src/maths/vec3/orthogonal.js"(t,e){var n=sin(),o=Whe(),i=EX(),r=(s,a)=>{const A=n(o(),a),c=0+(A[0]<A[1]&&A[0]<A[2]),l=0+(A[1]<=A[0]&&A[1]<A[2]),u=0+(A[2]<=A[0]&&A[2]<=A[1]);return i(s,a,[c,l,u])};e.exports=r}}),Uui=yt({"node_modules/@jscad/modeling/src/maths/vec3/rotateX.js"(t,e){var n=(o,i,r,s)=>{const a=[],A=[];return a[0]=i[0]-r[0],a[1]=i[1]-r[1],a[2]=i[2]-r[2],A[0]=a[0],A[1]=a[1]*Math.cos(s)-a[2]*Math.sin(s),A[2]=a[1]*Math.sin(s)+a[2]*Math.cos(s),o[0]=A[0]+r[0],o[1]=A[1]+r[1],o[2]=A[2]+r[2],o};e.exports=n}}),Kui=yt({"node_modules/@jscad/modeling/src/maths/vec3/rotateY.js"(t,e){var n=(o,i,r,s)=>{const a=[],A=[];return a[0]=i[0]-r[0],a[1]=i[1]-r[1],a[2]=i[2]-r[2],A[0]=a[2]*Math.sin(s)+a[0]*Math.cos(s),A[1]=a[1],A[2]=a[2]*Math.cos(s)-a[0]*Math.sin(s),o[0]=A[0]+r[0],o[1]=A[1]+r[1],o[2]=A[2]+r[2],o};e.exports=n}}),Vui=yt({"node_modules/@jscad/modeling/src/maths/vec3/rotateZ.js"(t,e){var n=(o,i,r,s)=>{const a=[],A=[];return a[0]=i[0]-r[0],a[1]=i[1]-r[1],A[0]=a[0]*Math.cos(s)-a[1]*Math.sin(s),A[1]=a[0]*Math.sin(s)+a[1]*Math.cos(s),o[0]=A[0]+r[0],o[1]=A[1]+r[1],o[2]=i[2],o};e.exports=n}}),din=yt({"node_modules/@jscad/modeling/src/maths/vec3/scale.js"(t,e){var n=(o,i,r)=>(o[0]=i[0]*r,o[1]=i[1]*r,o[2]=i[2]*r,o);e.exports=n}}),zui=yt({"node_modules/@jscad/modeling/src/maths/vec3/snap.js"(t,e){var n=(o,i,r)=>(o[0]=Math.round(i[0]/r)*r+0,o[1]=Math.round(i[1]/r)*r+0,o[2]=Math.round(i[2]/r)*r+0,o);e.exports=n}}),hin=yt({"node_modules/@jscad/modeling/src/maths/vec3/squaredDistance.js"(t,e){var n=(o,i)=>{const r=i[0]-o[0],s=i[1]-o[1],a=i[2]-o[2];return r*r+s*s+a*a};e.exports=n}}),pin=yt({"node_modules/@jscad/modeling/src/maths/vec3/squaredLength.js"(t,e){var n=o=>{const i=o[0],r=o[1],s=o[2];return i*i+r*r+s*s};e.exports=n}}),jhe=yt({"node_modules/@jscad/modeling/src/maths/vec3/subtract.js"(t,e){var n=(o,i,r)=>(o[0]=i[0]-r[0],o[1]=i[1]-r[1],o[2]=i[2]-r[2],o);e.exports=n}}),Jui=yt({"node_modules/@jscad/modeling/src/maths/vec3/toString.js"(t,e){var n=o=>`[${o[0].toFixed(7)}, ${o[1].toFixed(7)}, ${o[2].toFixed(7)}]`;e.exports=n}}),Wui=yt({"node_modules/@jscad/modeling/src/maths/vec3/transform.js"(t,e){var n=(o,i,r)=>{const s=i[0],a=i[1],A=i[2];let c=r[3]*s+r[7]*a+r[11]*A+r[15];return c=c||1,o[0]=(r[0]*s+r[4]*a+r[8]*A+r[12])/c,o[1]=(r[1]*s+r[5]*a+r[9]*A+r[13])/c,o[2]=(r[2]*s+r[6]*a+r[10]*A+r[14])/c,o};e.exports=n}}),$r=yt({"node_modules/@jscad/modeling/src/maths/vec3/index.js"(t,e){e.exports={abs:sin(),add:ain(),angle:Dui(),clone:Nui(),copy:Ain(),create:Whe(),cross:EX(),distance:cin(),divide:Rui(),dot:Jhe(),equals:Tui(),fromScalar:kui(),fromValues:Fui(),fromVec2:Lui(),length:lin(),lerp:Hui(),max:uin(),min:gin(),multiply:Oui(),negate:Gui(),normalize:uVe(),orthogonal:Yui(),rotateX:Uui(),rotateY:Kui(),rotateZ:Vui(),scale:din(),snap:zui(),squaredDistance:hin(),squaredLength:pin(),subtract:jhe(),toString:Jui(),transform:Wui()}}}),jui=yt({"node_modules/@jscad/modeling/src/maths/mat4/fromVectorRotation.js"(t,e){var n=$r(),o=rin(),i=(r,s,a)=>{const A=n.normalize(n.create(),s),c=n.normalize(n.create(),a),l=n.cross(n.create(),c,A),u=n.dot(c,A);if(u===-1)return o(r,Math.PI,n.orthogonal(l,A));const g=1/(1+u);return r[0]=l[0]*l[0]*g+u,r[1]=l[1]*l[0]*g-l[2],r[2]=l[2]*l[0]*g+l[1],r[3]=0,r[4]=l[0]*l[1]*g+l[2],r[5]=l[1]*l[1]*g+u,r[6]=l[2]*l[1]*g-l[0],r[7]=0,r[8]=l[0]*l[2]*g-l[1],r[9]=l[1]*l[2]*g+l[0],r[10]=l[2]*l[2]*g+u,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r};e.exports=i}}),$ui=yt({"node_modules/@jscad/modeling/src/maths/mat4/fromXRotation.js"(t,e){var{sin:n,cos:o}=hI(),i=(r,s)=>{const a=n(s),A=o(s);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=A,r[6]=a,r[7]=0,r[8]=0,r[9]=-a,r[10]=A,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r};e.exports=i}}),qui=yt({"node_modules/@jscad/modeling/src/maths/mat4/fromYRotation.js"(t,e){var{sin:n,cos:o}=hI(),i=(r,s)=>{const a=n(s),A=o(s);return r[0]=A,r[1]=0,r[2]=-a,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=a,r[9]=0,r[10]=A,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r};e.exports=i}}),Xui=yt({"node_modules/@jscad/modeling/src/maths/mat4/fromZRotation.js"(t,e){var{sin:n,cos:o}=hI(),i=(r,s)=>{const a=n(s),A=o(s);return r[0]=A,r[1]=a,r[2]=0,r[3]=0,r[4]=-a,r[5]=A,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r};e.exports=i}}),Zui=yt({"node_modules/@jscad/modeling/src/maths/mat4/isIdentity.js"(t,e){var n=o=>o[0]===1&&o[1]===0&&o[2]===0&&o[3]===0&&o[4]===0&&o[5]===1&&o[6]===0&&o[7]===0&&o[8]===0&&o[9]===0&&o[10]===1&&o[11]===0&&o[12]===0&&o[13]===0&&o[14]===0&&o[15]===1;e.exports=n}}),egi=yt({"node_modules/@jscad/modeling/src/maths/mat4/isOnlyTransformScale.js"(t,e){var n=i=>o(i[1])&&o(i[2])&&o(i[3])&&o(i[4])&&o(i[6])&&o(i[7])&&o(i[8])&&o(i[9])&&o(i[11])&&i[15]===1,o=i=>Math.abs(i)<Number.EPSILON;e.exports=n}}),tgi=yt({"node_modules/@jscad/modeling/src/maths/mat4/isMirroring.js"(t,e){var n=o=>{const i=o[4]*o[9]-o[8]*o[5],r=o[8]*o[1]-o[0]*o[9],s=o[0]*o[5]-o[4]*o[1];return i*o[2]+r*o[6]+s*o[10]<0};e.exports=n}}),ngi=yt({"node_modules/@jscad/modeling/src/maths/mat4/mirrorByPlane.js"(t,e){var n=(o,i)=>{const[r,s,a,A]=i;return o[0]=1-2*r*r,o[1]=-2*s*r,o[2]=-2*a*r,o[3]=0,o[4]=-2*r*s,o[5]=1-2*s*s,o[6]=-2*a*s,o[7]=0,o[8]=-2*r*a,o[9]=-2*s*a,o[10]=1-2*a*a,o[11]=0,o[12]=2*r*A,o[13]=2*s*A,o[14]=2*a*A,o[15]=1,o};e.exports=n}}),ogi=yt({"node_modules/@jscad/modeling/src/maths/mat4/multiply.js"(t,e){var n=(o,i,r)=>{const s=i[0],a=i[1],A=i[2],c=i[3],l=i[4],u=i[5],g=i[6],h=i[7],d=i[8],p=i[9],m=i[10],_=i[11],f=i[12],I=i[13],C=i[14],y=i[15];let x=r[0],E=r[1],B=r[2],S=r[3];return o[0]=x*s+E*l+B*d+S*f,o[1]=x*a+E*u+B*p+S*I,o[2]=x*A+E*g+B*m+S*C,o[3]=x*c+E*h+B*_+S*y,x=r[4],E=r[5],B=r[6],S=r[7],o[4]=x*s+E*l+B*d+S*f,o[5]=x*a+E*u+B*p+S*I,o[6]=x*A+E*g+B*m+S*C,o[7]=x*c+E*h+B*_+S*y,x=r[8],E=r[9],B=r[10],S=r[11],o[8]=x*s+E*l+B*d+S*f,o[9]=x*a+E*u+B*p+S*I,o[10]=x*A+E*g+B*m+S*C,o[11]=x*c+E*h+B*_+S*y,x=r[12],E=r[13],B=r[14],S=r[15],o[12]=x*s+E*l+B*d+S*f,o[13]=x*a+E*u+B*p+S*I,o[14]=x*A+E*g+B*m+S*C,o[15]=x*c+E*h+B*_+S*y,o};e.exports=n}}),igi=yt({"node_modules/@jscad/modeling/src/maths/mat4/rotate.js"(t,e){var{EPS:n}=mc(),{sin:o,cos:i}=hI(),r=oin(),s=(a,A,c,l)=>{let[u,g,h]=l;const d=u*u+g*g+h*h;if(Math.abs(d)<n)return r(a,A);const p=1/Math.sqrt(d);u*=p,g*=p,h*=p;const m=o(c),_=i(c),f=1-_,I=A[0],C=A[1],y=A[2],x=A[3],E=A[4],B=A[5],S=A[6],Q=A[7],w=A[8],M=A[9],k=A[10],R=A[11],F=u*u*f+_,O=g*u*f+h*m,U=h*u*f-g*m,Y=u*g*f-h*m,W=g*g*f+_,te=h*g*f+u*m,j=u*h*f+g*m,J=g*h*f-u*m,oe=h*h*f+_;return a[0]=I*F+E*O+w*U,a[1]=C*F+B*O+M*U,a[2]=y*F+S*O+k*U,a[3]=x*F+Q*O+R*U,a[4]=I*Y+E*W+w*te,a[5]=C*Y+B*W+M*te,a[6]=y*Y+S*W+k*te,a[7]=x*Y+Q*W+R*te,a[8]=I*j+E*J+w*oe,a[9]=C*j+B*J+M*oe,a[10]=y*j+S*J+k*oe,a[11]=x*j+Q*J+R*oe,A!==a&&(a[12]=A[12],a[13]=A[13],a[14]=A[14],a[15]=A[15]),a};e.exports=s}}),rgi=yt({"node_modules/@jscad/modeling/src/maths/mat4/rotateX.js"(t,e){var{sin:n,cos:o}=hI(),i=(r,s,a)=>{const A=n(a),c=o(a),l=s[4],u=s[5],g=s[6],h=s[7],d=s[8],p=s[9],m=s[10],_=s[11];return s!==r&&(r[0]=s[0],r[1]=s[1],r[2]=s[2],r[3]=s[3],r[12]=s[12],r[13]=s[13],r[14]=s[14],r[15]=s[15]),r[4]=l*c+d*A,r[5]=u*c+p*A,r[6]=g*c+m*A,r[7]=h*c+_*A,r[8]=d*c-l*A,r[9]=p*c-u*A,r[10]=m*c-g*A,r[11]=_*c-h*A,r};e.exports=i}}),sgi=yt({"node_modules/@jscad/modeling/src/maths/mat4/rotateY.js"(t,e){var{sin:n,cos:o}=hI(),i=(r,s,a)=>{const A=n(a),c=o(a),l=s[0],u=s[1],g=s[2],h=s[3],d=s[8],p=s[9],m=s[10],_=s[11];return s!==r&&(r[4]=s[4],r[5]=s[5],r[6]=s[6],r[7]=s[7],r[12]=s[12],r[13]=s[13],r[14]=s[14],r[15]=s[15]),r[0]=l*c-d*A,r[1]=u*c-p*A,r[2]=g*c-m*A,r[3]=h*c-_*A,r[8]=l*A+d*c,r[9]=u*A+p*c,r[10]=g*A+m*c,r[11]=h*A+_*c,r};e.exports=i}}),agi=yt({"node_modules/@jscad/modeling/src/maths/mat4/rotateZ.js"(t,e){var{sin:n,cos:o}=hI(),i=(r,s,a)=>{const A=n(a),c=o(a),l=s[0],u=s[1],g=s[2],h=s[3],d=s[4],p=s[5],m=s[6],_=s[7];return s!==r&&(r[8]=s[8],r[9]=s[9],r[10]=s[10],r[11]=s[11],r[12]=s[12],r[13]=s[13],r[14]=s[14],r[15]=s[15]),r[0]=l*c+d*A,r[1]=u*c+p*A,r[2]=g*c+m*A,r[3]=h*c+_*A,r[4]=d*c-l*A,r[5]=p*c-u*A,r[6]=m*c-g*A,r[7]=_*c-h*A,r};e.exports=i}}),Agi=yt({"node_modules/@jscad/modeling/src/maths/mat4/scale.js"(t,e){var n=(o,i,r)=>{const s=r[0],a=r[1],A=r[2];return o[0]=i[0]*s,o[1]=i[1]*s,o[2]=i[2]*s,o[3]=i[3]*s,o[4]=i[4]*a,o[5]=i[5]*a,o[6]=i[6]*a,o[7]=i[7]*a,o[8]=i[8]*A,o[9]=i[9]*A,o[10]=i[10]*A,o[11]=i[11]*A,o[12]=i[12],o[13]=i[13],o[14]=i[14],o[15]=i[15],o};e.exports=n}}),cgi=yt({"node_modules/@jscad/modeling/src/maths/mat4/subtract.js"(t,e){var n=(o,i,r)=>(o[0]=i[0]-r[0],o[1]=i[1]-r[1],o[2]=i[2]-r[2],o[3]=i[3]-r[3],o[4]=i[4]-r[4],o[5]=i[5]-r[5],o[6]=i[6]-r[6],o[7]=i[7]-r[7],o[8]=i[8]-r[8],o[9]=i[9]-r[9],o[10]=i[10]-r[10],o[11]=i[11]-r[11],o[12]=i[12]-r[12],o[13]=i[13]-r[13],o[14]=i[14]-r[14],o[15]=i[15]-r[15],o);e.exports=n}}),lgi=yt({"node_modules/@jscad/modeling/src/maths/mat4/toString.js"(t,e){var n=o=>o.map(i=>i.toFixed(7)).toString();e.exports=n}}),ugi=yt({"node_modules/@jscad/modeling/src/maths/mat4/translate.js"(t,e){var n=(o,i,r)=>{const s=r[0],a=r[1],A=r[2];let c,l,u,g,h,d,p,m,_,f,I,C;return i===o?(o[12]=i[0]*s+i[4]*a+i[8]*A+i[12],o[13]=i[1]*s+i[5]*a+i[9]*A+i[13],o[14]=i[2]*s+i[6]*a+i[10]*A+i[14],o[15]=i[3]*s+i[7]*a+i[11]*A+i[15]):(c=i[0],l=i[1],u=i[2],g=i[3],h=i[4],d=i[5],p=i[6],m=i[7],_=i[8],f=i[9],I=i[10],C=i[11],o[0]=c,o[1]=l,o[2]=u,o[3]=g,o[4]=h,o[5]=d,o[6]=p,o[7]=m,o[8]=_,o[9]=f,o[10]=I,o[11]=C,o[12]=c*s+h*a+_*A+i[12],o[13]=l*s+d*a+f*A+i[13],o[14]=u*s+p*a+I*A+i[14],o[15]=g*s+m*a+C*A+i[15]),o};e.exports=n}}),Du=yt({"node_modules/@jscad/modeling/src/maths/mat4/index.js"(t,e){e.exports={add:Bui(),clone:bui(),copy:oin(),create:lVe(),invert:Sui(),equals:Qui(),fromRotation:rin(),fromScaling:vui(),fromTaitBryanRotation:wui(),fromTranslation:Pui(),fromValues:Mui(),fromVectorRotation:jui(),fromXRotation:$ui(),fromYRotation:qui(),fromZRotation:Xui(),identity:iin(),isIdentity:Zui(),isOnlyTransformScale:egi(),isMirroring:tgi(),mirrorByPlane:ngi(),multiply:ogi(),rotate:igi(),rotateX:rgi(),rotateY:sgi(),rotateZ:agi(),scale:Agi(),subtract:cgi(),toString:lgi(),translate:ugi()}}}),$he=yt({"node_modules/@jscad/modeling/src/geometries/geom2/create.js"(t,e){var n=Du(),o=i=>(i===void 0&&(i=[]),{sides:i,transforms:n.create()});e.exports=o}}),ggi=yt({"node_modules/@jscad/modeling/src/maths/vec2/abs.js"(t,e){var n=(o,i)=>(o[0]=Math.abs(i[0]),o[1]=Math.abs(i[1]),o);e.exports=n}}),dgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/add.js"(t,e){var n=(o,i,r)=>(o[0]=i[0]+r[0],o[1]=i[1]+r[1],o);e.exports=n}}),gVe=yt({"node_modules/@jscad/modeling/src/maths/vec2/angleRadians.js"(t,e){var n=o=>Math.atan2(o[1],o[0]);e.exports=n}}),hgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/angle.js"(t,e){e.exports=gVe()}}),pgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/angleDegrees.js"(t,e){var n=gVe(),o=i=>n(i)*57.29577951308232;e.exports=o}}),qhe=yt({"node_modules/@jscad/modeling/src/maths/vec2/create.js"(t,e){var n=()=>[0,0];e.exports=n}}),mgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/clone.js"(t,e){var n=qhe(),o=i=>{const r=n();return r[0]=i[0],r[1]=i[1],r};e.exports=o}}),_gi=yt({"node_modules/@jscad/modeling/src/maths/vec2/copy.js"(t,e){var n=(o,i)=>(o[0]=i[0],o[1]=i[1],o);e.exports=n}}),fgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/cross.js"(t,e){var n=(o,i,r)=>(o[0]=0,o[1]=0,o[2]=i[0]*r[1]-i[1]*r[0],o);e.exports=n}}),Igi=yt({"node_modules/@jscad/modeling/src/maths/vec2/distance.js"(t,e){var n=(o,i)=>{const r=i[0]-o[0],s=i[1]-o[1];return Math.sqrt(r*r+s*s)};e.exports=n}}),Cgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/divide.js"(t,e){var n=(o,i,r)=>(o[0]=i[0]/r[0],o[1]=i[1]/r[1],o);e.exports=n}}),ygi=yt({"node_modules/@jscad/modeling/src/maths/vec2/dot.js"(t,e){var n=(o,i)=>o[0]*i[0]+o[1]*i[1];e.exports=n}}),xgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/equals.js"(t,e){var n=(o,i)=>o[0]===i[0]&&o[1]===i[1];e.exports=n}}),min=yt({"node_modules/@jscad/modeling/src/maths/vec2/fromAngleRadians.js"(t,e){var{sin:n,cos:o}=hI(),i=(r,s)=>(r[0]=o(s),r[1]=n(s),r);e.exports=i}}),Egi=yt({"node_modules/@jscad/modeling/src/maths/vec2/fromAngleDegrees.js"(t,e){var n=min(),o=(i,r)=>n(i,r*.017453292519943295);e.exports=o}}),Bgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/fromScalar.js"(t,e){var n=(o,i)=>(o[0]=i,o[1]=i,o);e.exports=n}}),bgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/fromValues.js"(t,e){var n=qhe(),o=(i,r)=>{const s=n();return s[0]=i,s[1]=r,s};e.exports=o}}),Sgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/length.js"(t,e){var n=o=>Math.sqrt(o[0]*o[0]+o[1]*o[1]);e.exports=n}}),Qgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/lerp.js"(t,e){var n=(o,i,r,s)=>{const a=i[0],A=i[1];return o[0]=a+s*(r[0]-a),o[1]=A+s*(r[1]-A),o};e.exports=n}}),vgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/max.js"(t,e){var n=(o,i,r)=>(o[0]=Math.max(i[0],r[0]),o[1]=Math.max(i[1],r[1]),o);e.exports=n}}),wgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/min.js"(t,e){var n=(o,i,r)=>(o[0]=Math.min(i[0],r[0]),o[1]=Math.min(i[1],r[1]),o);e.exports=n}}),Pgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/multiply.js"(t,e){var n=(o,i,r)=>(o[0]=i[0]*r[0],o[1]=i[1]*r[1],o);e.exports=n}}),Mgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/negate.js"(t,e){var n=(o,i)=>(o[0]=-i[0],o[1]=-i[1],o);e.exports=n}}),_in=yt({"node_modules/@jscad/modeling/src/maths/vec2/rotate.js"(t,e){var n=(o,i,r,s)=>{const a=i[0]-r[0],A=i[1]-r[1],c=Math.cos(s),l=Math.sin(s);return o[0]=a*c-A*l+r[0],o[1]=a*l+A*c+r[1],o};e.exports=n}}),Dgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/normal.js"(t,e){var{TAU:n}=mc(),o=qhe(),i=_in(),r=(s,a)=>i(s,a,o(),n/4);e.exports=r}}),Ngi=yt({"node_modules/@jscad/modeling/src/maths/vec2/normalize.js"(t,e){var n=(o,i)=>{const r=i[0],s=i[1];let a=r*r+s*s;return a>0&&(a=1/Math.sqrt(a)),o[0]=r*a,o[1]=s*a,o};e.exports=n}}),Rgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/scale.js"(t,e){var n=(o,i,r)=>(o[0]=i[0]*r,o[1]=i[1]*r,o);e.exports=n}}),Tgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/snap.js"(t,e){var n=(o,i,r)=>(o[0]=Math.round(i[0]/r)*r+0,o[1]=Math.round(i[1]/r)*r+0,o);e.exports=n}}),kgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/squaredDistance.js"(t,e){var n=(o,i)=>{const r=i[0]-o[0],s=i[1]-o[1];return r*r+s*s};e.exports=n}}),Fgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/squaredLength.js"(t,e){var n=o=>{const i=o[0],r=o[1];return i*i+r*r};e.exports=n}}),Lgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/subtract.js"(t,e){var n=(o,i,r)=>(o[0]=i[0]-r[0],o[1]=i[1]-r[1],o);e.exports=n}}),Hgi=yt({"node_modules/@jscad/modeling/src/maths/vec2/toString.js"(t,e){var n=o=>`[${o[0].toFixed(7)}, ${o[1].toFixed(7)}]`;e.exports=n}}),Ogi=yt({"node_modules/@jscad/modeling/src/maths/vec2/transform.js"(t,e){var n=(o,i,r)=>{const s=i[0],a=i[1];return o[0]=r[0]*s+r[4]*a+r[12],o[1]=r[1]*s+r[5]*a+r[13],o};e.exports=n}}),_A=yt({"node_modules/@jscad/modeling/src/maths/vec2/index.js"(t,e){e.exports={abs:ggi(),add:dgi(),angle:hgi(),angleDegrees:pgi(),angleRadians:gVe(),clone:mgi(),copy:_gi(),create:qhe(),cross:fgi(),distance:Igi(),divide:Cgi(),dot:ygi(),equals:xgi(),fromAngleDegrees:Egi(),fromAngleRadians:min(),fromScalar:Bgi(),fromValues:bgi(),length:Sgi(),lerp:Qgi(),max:vgi(),min:wgi(),multiply:Pgi(),negate:Mgi(),normal:Dgi(),normalize:Ngi(),rotate:_in(),scale:Rgi(),snap:Tgi(),squaredDistance:kgi(),squaredLength:Fgi(),subtract:Lgi(),toString:Hgi(),transform:Ogi()}}}),Ggi=yt({"node_modules/@jscad/modeling/src/geometries/geom2/fromPoints.js"(t,e){var n=_A(),o=$he(),i=r=>{if(!Array.isArray(r))throw new Error("the given points must be an array");let s=r.length;if(s<3)throw new Error("the given points must define a closed geometry with three or more points");n.equals(r[0],r[s-1])&&--s;const a=[];let A=r[s-1];for(let c=0;c<s;c++){const l=r[c];a.push([n.clone(A),n.clone(l)]),A=l}return o(a)};e.exports=i}}),Ygi=yt({"node_modules/@jscad/modeling/src/geometries/geom2/fromCompactBinary.js"(t,e){var n=Du(),o=_A(),i=$he(),r=s=>{if(s[0]!==0)throw new Error("invalid compact binary data");const a=i();a.transforms=n.clone(s.slice(1,17));for(let A=21;A<s.length;A+=4){const c=o.fromValues(s[A+0],s[A+1]),l=o.fromValues(s[A+2],s[A+3]);a.sides.push([c,l])}return s[17]>=0&&(a.color=[s[17],s[18],s[19],s[20]]),a};e.exports=r}}),fin=yt({"node_modules/@jscad/modeling/src/geometries/geom2/isA.js"(t,e){var n=o=>!!(o&&typeof o=="object"&&"sides"in o&&"transforms"in o&&Array.isArray(o.sides)&&"length"in o.transforms);e.exports=n}}),Ugi=yt({"node_modules/@jscad/modeling/src/geometries/geom2/applyTransforms.js"(t,e){var n=Du(),o=_A(),i=r=>(n.isIdentity(r.transforms)||(r.sides=r.sides.map(s=>{const a=o.transform(o.create(),s[0],r.transforms),A=o.transform(o.create(),s[1],r.transforms);return[a,A]}),r.transforms=n.create()),r);e.exports=i}}),BX=yt({"node_modules/@jscad/modeling/src/geometries/geom2/toSides.js"(t,e){var n=Ugi(),o=i=>n(i).sides;e.exports=o}}),Iin=yt({"node_modules/@jscad/modeling/src/geometries/geom2/reverse.js"(t,e){var n=$he(),o=BX(),i=r=>{const a=o(r).map(A=>[A[1],A[0]]);return a.reverse(),n(a)};e.exports=i}}),Cin=yt({"node_modules/@jscad/modeling/src/geometries/geom2/toOutlines.js"(t,e){var n=_A(),o=BX(),i=A=>{const c=new Map,l=u=>{const g=u.toString();return c.has(g)?c.get(g):(c.set(g,u),u)};return A.map(u=>u.map(l))},r=A=>{const c=new Map;return i(A).forEach(u=>{c.has(u[0])?c.get(u[0]).push(u):c.set(u[0],[u])}),c},s=A=>{const c=r(o(A)),l=[];for(;;){let u;for(const[d,p]of c){if(u=p.shift(),!u){c.delete(d);continue}break}if(u===void 0)break;const g=[],h=u[0];for(;;){g.push(u[0]);const d=u[1];if(d===h)break;const p=c.get(d);if(!p)throw new Error(`geometry is not closed at vertex ${d}`);const m=a(u,p);p.length===0&&c.delete(d),u=m}g.length>0&&g.push(g.shift()),l.push(g)}return c.clear(),l},a=(A,c)=>{if(c.length===1)return c.pop();const l=n.create(),u=n.angleDegrees(n.subtract(l,A[1],A[0]));let g,h;c.forEach((p,m)=>{let f=n.angleDegrees(n.subtract(l,p[1],p[0]))-u;f<-180&&(f+=360),f>=180&&(f-=360),(h===void 0||f>g)&&(h=m,g=f)});const d=c[h];return c.splice(h,1),d};e.exports=s}}),Kgi=yt({"node_modules/@jscad/modeling/src/geometries/geom2/toPoints.js"(t,e){var n=BX(),o=i=>{const s=n(i).map(a=>a[0]);return s.length>0&&s.push(s.shift()),s};e.exports=o}}),Vgi=yt({"node_modules/@jscad/modeling/src/geometries/geom2/toString.js"(t,e){var n=_A(),o=BX(),i=r=>{const s=o(r);let a="geom2 ("+s.length+` sides):
[
`;return s.forEach(A=>{a+=" ["+n.toString(A[0])+", "+n.toString(A[1])+`]
`}),a+=`]
`,a};e.exports=i}}),zgi=yt({"node_modules/@jscad/modeling/src/geometries/geom2/toCompactBinary.js"(t,e){var n=o=>{const i=o.sides,r=o.transforms;let s=[-1,-1,-1,-1];o.color&&(s=o.color);const a=new Float32Array(21+i.length*4);a[0]=0,a[1]=r[0],a[2]=r[1],a[3]=r[2],a[4]=r[3],a[5]=r[4],a[6]=r[5],a[7]=r[6],a[8]=r[7],a[9]=r[8],a[10]=r[9],a[11]=r[10],a[12]=r[11],a[13]=r[12],a[14]=r[13],a[15]=r[14],a[16]=r[15],a[17]=s[0],a[18]=s[1],a[19]=s[2],a[20]=s[3];for(let A=0;A<i.length;A++){const c=A*4+21,l=i[A][0],u=i[A][1];a[c+0]=l[0],a[c+1]=l[1],a[c+2]=u[0],a[c+3]=u[1]}return a};e.exports=n}}),Jgi=yt({"node_modules/@jscad/modeling/src/geometries/geom2/transform.js"(t,e){var n=Du(),o=Iin(),i=(r,s)=>{const a=n.multiply(n.create(),r,s.transforms),A=Object.assign({},s,{transforms:a});return r[0]*r[5]-r[4]*r[1]<0?o(A):A};e.exports=i}}),Wgi=yt({"node_modules/@jscad/modeling/src/geometries/geom2/validate.js"(t,e){var n=_A(),o=fin(),i=Cin(),r=s=>{if(!o(s))throw new Error("invalid geom2 structure");if(i(s),s.sides.forEach(a=>{if(n.equals(a[0],a[1]))throw new Error(`geom2 self-edge ${a[0]}`)}),!s.transforms.every(Number.isFinite))throw new Error(`geom2 invalid transforms ${s.transforms}`)};e.exports=r}}),Ya=yt({"node_modules/@jscad/modeling/src/geometries/geom2/index.js"(t,e){e.exports={clone:Eui(),create:$he(),fromPoints:Ggi(),fromCompactBinary:Ygi(),isA:fin(),reverse:Iin(),toOutlines:Cin(),toPoints:Kgi(),toSides:BX(),toString:Vgi(),toCompactBinary:zgi(),transform:Jgi(),validate:Wgi()}}}),jgi=yt({"node_modules/@jscad/modeling/src/geometries/geom3/clone.js"(t,e){var n=o=>Object.assign({},o);e.exports=n}}),bX=yt({"node_modules/@jscad/modeling/src/geometries/geom3/create.js"(t,e){var n=Du(),o=i=>(i===void 0&&(i=[]),{polygons:i,transforms:n.create()});e.exports=o}}),$gi=yt({"node_modules/@jscad/modeling/src/operations/hulls/quickhull/point-line-distance.js"(t,e){var n=EX(),o=jhe(),i=pin(),r=(a,A,c)=>{const l=[],u=[],g=[];o(l,c,A),o(u,a,A);const h=i(n(g,u,l)),d=i(l);if(d===0)throw Error("a and b are the same point");return h/d},s=(a,A,c)=>Math.sqrt(r(a,A,c));e.exports=s}}),qgi=yt({"node_modules/@jscad/modeling/src/operations/hulls/quickhull/get-plane-normal.js"(t,e){var n=EX(),o=uVe(),i=jhe(),r=(s,a,A,c)=>{const l=[0,0,0];return i(s,a,A),i(l,A,c),n(s,s,l),o(s,s)};e.exports=r}}),Xgi=yt({"node_modules/@jscad/modeling/src/operations/hulls/quickhull/VertexList.js"(t,e){var n=class{constructor(){this.head=null,this.tail=null}clear(){this.head=this.tail=null}insertBefore(o,i){i.prev=o.prev,i.next=o,i.prev?i.prev.next=i:this.head=i,o.prev=i}insertAfter(o,i){i.prev=o,i.next=o.next,i.next?i.next.prev=i:this.tail=i,o.next=i}add(o){this.head?this.tail.next=o:this.head=o,o.prev=this.tail,o.next=null,this.tail=o}addAll(o){for(this.head?this.tail.next=o:this.head=o,o.prev=this.tail;o.next;)o=o.next;this.tail=o}remove(o){o.prev?o.prev.next=o.next:this.head=o.next,o.next?o.next.prev=o.prev:this.tail=o.prev}removeChain(o,i){o.prev?o.prev.next=i.next:this.head=i.next,i.next?i.next.prev=o.prev:this.tail=o.prev}first(){return this.head}isEmpty(){return!this.head}};e.exports=n}}),Zgi=yt({"node_modules/@jscad/modeling/src/operations/hulls/quickhull/Vertex.js"(t,e){var n=class{constructor(o,i){this.point=o,this.index=i,this.next=null,this.prev=null,this.face=null}};e.exports=n}}),edi=yt({"node_modules/@jscad/modeling/src/operations/hulls/quickhull/HalfEdge.js"(t,e){var n=cin(),o=hin(),i=class{constructor(r,s){this.vertex=r,this.face=s,this.next=null,this.prev=null,this.opposite=null}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){return this.tail()?n(this.tail().point,this.head().point):-1}lengthSquared(){return this.tail()?o(this.tail().point,this.head().point):-1}setOpposite(r){this.opposite=r,r.opposite=this}};e.exports=i}}),tdi=yt({"node_modules/@jscad/modeling/src/operations/hulls/quickhull/Face.js"(t,e){var n=ain(),o=Ain(),i=EX(),r=Jhe(),s=lin(),a=uVe(),A=din(),c=jhe(),l=edi(),u=0,g=1,h=2,d=class I4n{constructor(){this.normal=[],this.centroid=[],this.offset=0,this.outside=null,this.mark=u,this.edge=null,this.nVertices=0}getEdge(m){if(typeof m!="number")throw Error("requires a number");let _=this.edge;for(;m>0;)_=_.next,m-=1;for(;m<0;)_=_.prev,m+=1;return _}computeNormal(){const m=this.edge,_=m.next;let f=_.next;const I=c([],_.head().point,m.head().point),C=[],y=[];for(this.nVertices=2,this.normal=[0,0,0];f!==m;)o(y,I),c(I,f.head().point,m.head().point),n(this.normal,this.normal,i(C,y,I)),f=f.next,this.nVertices+=1;this.area=s(this.normal),this.normal=A(this.normal,this.normal,1/this.area)}computeNormalMinArea(m){if(this.computeNormal(),this.area<m){let _,f=0,I=this.edge;do{const S=I.lengthSquared();S>f&&(_=I,f=S),I=I.next}while(I!==this.edge);const C=_.tail().point,y=_.head().point,x=c([],y,C),E=Math.sqrt(f);A(x,x,1/E);const B=r(this.normal,x);A(x,x,-B),n(this.normal,this.normal,x),a(this.normal,this.normal)}}computeCentroid(){this.centroid=[0,0,0];let m=this.edge;do n(this.centroid,this.centroid,m.head().point),m=m.next;while(m!==this.edge);A(this.centroid,this.centroid,1/this.nVertices)}computeNormalAndCentroid(m){typeof m<"u"?this.computeNormalMinArea(m):this.computeNormal(),this.computeCentroid(),this.offset=r(this.normal,this.centroid)}distanceToPlane(m){return r(this.normal,m)-this.offset}connectHalfEdges(m,_){let f;if(m.opposite.face===_.opposite.face){const I=_.opposite.face;let C;m===this.edge&&(this.edge=_),I.nVertices===3?(C=_.opposite.prev.opposite,I.mark=h,f=I):(C=_.opposite.next,I.edge===C.prev&&(I.edge=C),C.prev=C.prev.prev,C.prev.next=C),_.prev=m.prev,_.prev.next=_,_.setOpposite(C),I.computeNormalAndCentroid()}else m.next=_,_.prev=m;return f}mergeAdjacentFaces(m,_){const f=m.opposite,I=f.face;_.push(I),I.mark=h;let C=m.prev,y=m.next,x=f.prev,E=f.next;for(;C.opposite.face===I;)C=C.prev,E=E.next;for(;y.opposite.face===I;)y=y.next,x=x.prev;let B;for(B=E;B!==x.next;B=B.next)B.face=this;this.edge=y;let S;return S=this.connectHalfEdges(x,y),S&&_.push(S),S=this.connectHalfEdges(C,E),S&&_.push(S),this.computeNormalAndCentroid(),_}collectIndices(){const m=[];let _=this.edge;do m.push(_.head().index),_=_.next;while(_!==this.edge);return m}static createTriangle(m,_,f,I=0){const C=new I4n,y=new l(m,C),x=new l(_,C),E=new l(f,C);return y.next=E.prev=x,x.next=y.prev=E,E.next=x.prev=y,C.edge=y,C.computeNormalAndCentroid(I),C}};e.exports={VISIBLE:u,NON_CONVEX:g,DELETED:h,Face:d}}}),ndi=yt({"node_modules/@jscad/modeling/src/operations/hulls/quickhull/QuickHull.js"(t,e){var n=Jhe(),o=$gi(),i=qgi(),r=Xgi(),s=Zgi(),{Face:a,VISIBLE:A,NON_CONVEX:c,DELETED:l}=tdi(),u=1,g=2,h=class{constructor(d){if(!Array.isArray(d))throw TypeError("input is not a valid array");if(d.length<4)throw Error("cannot build a simplex out of <4 points");this.tolerance=-1,this.nFaces=0,this.nPoints=d.length,this.faces=[],this.newFaces=[],this.claimed=new r,this.unclaimed=new r,this.vertices=[];for(let p=0;p<d.length;p+=1)this.vertices.push(new s(d[p],p));this.discardedFaces=[],this.vertexPointIndices=[]}addVertexToFace(d,p){d.face=p,p.outside?this.claimed.insertBefore(p.outside,d):this.claimed.add(d),p.outside=d}removeVertexFromFace(d,p){d===p.outside&&(d.next&&d.next.face===p?p.outside=d.next:p.outside=null),this.claimed.remove(d)}removeAllVerticesFromFace(d){if(d.outside){let p=d.outside;for(;p.next&&p.next.face===d;)p=p.next;return this.claimed.removeChain(d.outside,p),p.next=null,d.outside}}deleteFaceVertices(d,p){const m=this.removeAllVerticesFromFace(d);if(m)if(!p)this.unclaimed.addAll(m);else{let _;for(let f=m;f;f=_)_=f.next,p.distanceToPlane(f.point)>this.tolerance?this.addVertexToFace(f,p):this.unclaimed.add(f)}}resolveUnclaimedPoints(d){let p=this.unclaimed.first();for(let m=p;m;m=p){p=m.next;let _=this.tolerance,f;for(let I=0;I<d.length;I+=1){const C=d[I];if(C.mark===A){const y=C.distanceToPlane(m.point);if(y>_&&(_=y,f=C),_>1e3*this.tolerance)break}}f&&this.addVertexToFace(m,f)}}computeExtremes(){const d=[],p=[],m=[],_=[];let f,I;for(f=0;f<3;f+=1)m[f]=_[f]=this.vertices[0];for(f=0;f<3;f+=1)d[f]=p[f]=this.vertices[0].point[f];for(f=1;f<this.vertices.length;f+=1){const C=this.vertices[f],y=C.point;for(I=0;I<3;I+=1)y[I]<d[I]&&(d[I]=y[I],m[I]=C);for(I=0;I<3;I+=1)y[I]>p[I]&&(p[I]=y[I],_[I]=C)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(d[0]),Math.abs(p[0]))+Math.max(Math.abs(d[1]),Math.abs(p[1]))+Math.max(Math.abs(d[2]),Math.abs(p[2]))),[m,_]}createInitialSimplex(){const d=this.vertices,[p,m]=this.computeExtremes();let _,f,I,C,y=0,x=0;for(I=0;I<3;I+=1){const M=m[I].point[I]-p[I].point[I];M>y&&(y=M,x=I)}const E=p[x],B=m[x];for(y=0,I=0;I<this.vertices.length;I+=1){const M=this.vertices[I];if(M!==E&&M!==B){const k=o(M.point,E.point,B.point);k>y&&(y=k,_=M)}}const S=i([],E.point,B.point,_.point),Q=n(E.point,S);for(y=-1,I=0;I<this.vertices.length;I+=1){const M=this.vertices[I];if(M!==E&&M!==B&&M!==_){const k=Math.abs(n(S,M.point)-Q);k>y&&(y=k,f=M)}}const w=[];if(n(f.point,S)-Q<0)for(w.push(a.createTriangle(E,B,_),a.createTriangle(f,B,E),a.createTriangle(f,_,B),a.createTriangle(f,E,_)),I=0;I<3;I+=1){const M=(I+1)%3;w[I+1].getEdge(2).setOpposite(w[0].getEdge(M)),w[I+1].getEdge(1).setOpposite(w[M+1].getEdge(0))}else for(w.push(a.createTriangle(E,_,B),a.createTriangle(f,E,B),a.createTriangle(f,B,_),a.createTriangle(f,_,E)),I=0;I<3;I+=1){const M=(I+1)%3;w[I+1].getEdge(2).setOpposite(w[0].getEdge((3-I)%3)),w[I+1].getEdge(0).setOpposite(w[M+1].getEdge(1))}for(I=0;I<4;I+=1)this.faces.push(w[I]);for(I=0;I<d.length;I+=1){const M=d[I];if(M!==E&&M!==B&&M!==_&&M!==f){y=this.tolerance;let k;for(C=0;C<4;C+=1){const R=w[C].distanceToPlane(M.point);R>y&&(y=R,k=w[C])}k&&this.addVertexToFace(M,k)}}}reindexFaceAndVertices(){const d=[];for(let p=0;p<this.faces.length;p+=1){const m=this.faces[p];m.mark===A&&d.push(m)}this.faces=d}collectFaces(d){const p=[];for(let m=0;m<this.faces.length;m+=1){if(this.faces[m].mark!==A)throw Error("attempt to include a destroyed face in the hull");const _=this.faces[m].collectIndices();if(d)p.push(_);else for(let f=0;f<_.length-2;f+=1)p.push([_[0],_[f+1],_[f+2]])}return p}nextVertexToAdd(){if(!this.claimed.isEmpty()){let d,p,m=0;const _=this.claimed.first().face;for(p=_.outside;p&&p.face===_;p=p.next){const f=_.distanceToPlane(p.point);f>m&&(m=f,d=p)}return d}}computeHorizon(d,p,m,_){this.deleteFaceVertices(m),m.mark=l;let f;p?f=p.next:f=p=m.getEdge(0);do{const I=f.opposite,C=I.face;C.mark===A&&(C.distanceToPlane(d)>this.tolerance?this.computeHorizon(d,I,C,_):_.push(f)),f=f.next}while(f!==p)}addAdjoiningFace(d,p){const m=a.createTriangle(d,p.tail(),p.head());return this.faces.push(m),m.getEdge(-1).setOpposite(p.opposite),m.getEdge(0)}addNewFaces(d,p){this.newFaces=[];let m,_;for(let f=0;f<p.length;f+=1){const I=p[f],C=this.addAdjoiningFace(d,I);m?C.next.setOpposite(_):m=C,this.newFaces.push(C.face),_=C}m.next.setOpposite(_)}oppositeFaceDistance(d){return d.face.distanceToPlane(d.opposite.face.centroid)}doAdjacentMerge(d,p){let m=d.edge,_=!0,f=0;do{if(f>=d.nVertices)throw Error("merge recursion limit exceeded");const I=m.opposite.face;let C=!1;if(p===g?(this.oppositeFaceDistance(m)>-this.tolerance||this.oppositeFaceDistance(m.opposite)>-this.tolerance)&&(C=!0):d.area>I.area?this.oppositeFaceDistance(m)>-this.tolerance?C=!0:this.oppositeFaceDistance(m.opposite)>-this.tolerance&&(_=!1):this.oppositeFaceDistance(m.opposite)>-this.tolerance?C=!0:this.oppositeFaceDistance(m)>-this.tolerance&&(_=!1),C){const y=d.mergeAdjacentFaces(m,[]);for(let x=0;x<y.length;x+=1)this.deleteFaceVertices(y[x],d);return!0}m=m.next,f+=1}while(m!==d.edge);return _||(d.mark=c),!1}addVertexToHull(d){const p=[];this.unclaimed.clear(),this.removeVertexFromFace(d,d.face),this.computeHorizon(d.point,null,d.face,p),this.addNewFaces(d,p);for(let m=0;m<this.newFaces.length;m+=1){const _=this.newFaces[m];if(_.mark===A)for(;this.doAdjacentMerge(_,u););}for(let m=0;m<this.newFaces.length;m+=1){const _=this.newFaces[m];if(_.mark===c)for(_.mark=A;this.doAdjacentMerge(_,g););}this.resolveUnclaimedPoints(this.newFaces)}build(){let d;for(this.createInitialSimplex();d=this.nextVertexToAdd();)this.addVertexToHull(d);this.reindexFaceAndVertices()}};e.exports=h}}),yin=yt({"node_modules/@jscad/modeling/src/operations/hulls/quickhull/index.js"(t,e){var n=ndi(),o=(i,r={})=>{const s=new n(i);return s.build(),s.collectFaces(r.skipTriangulation)};e.exports=o}}),PY=yt({"node_modules/@jscad/modeling/src/geometries/poly3/create.js"(t,e){var n=o=>((o===void 0||o.length<3)&&(o=[]),{vertices:o});e.exports=n}}),odi=yt({"node_modules/@jscad/modeling/src/geometries/poly3/clone.js"(t,e){var n=PY(),o=$r(),i=(...r)=>{let s,a;return r.length===1?(s=n(),a=r[0]):(s=r[0],a=r[1]),s.vertices=a.vertices.map(A=>o.clone(A)),s};e.exports=i}}),idi=yt({"node_modules/@jscad/modeling/src/geometries/poly3/fromPoints.js"(t,e){var n=$r(),o=PY(),i=r=>{const s=r.map(a=>n.clone(a));return o(s)};e.exports=i}}),rdi=yt({"node_modules/@jscad/modeling/src/geometries/poly3/fromPointsAndPlane.js"(t,e){var n=PY(),o=(i,r)=>{const s=n(i);return s.plane=r,s};e.exports=o}}),Xhe=yt({"node_modules/@jscad/modeling/src/maths/vec4/create.js"(t,e){var n=()=>[0,0,0,0];e.exports=n}}),xin=yt({"node_modules/@jscad/modeling/src/maths/vec4/clone.js"(t,e){var n=Xhe(),o=i=>{const r=n();return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r};e.exports=o}}),Ein=yt({"node_modules/@jscad/modeling/src/maths/vec4/copy.js"(t,e){var n=(o,i)=>(o[0]=i[0],o[1]=i[1],o[2]=i[2],o[3]=i[3],o);e.exports=n}}),Bin=yt({"node_modules/@jscad/modeling/src/maths/vec4/equals.js"(t,e){var n=(o,i)=>o[0]===i[0]&&o[1]===i[1]&&o[2]===i[2]&&o[3]===i[3];e.exports=n}}),bin=yt({"node_modules/@jscad/modeling/src/maths/plane/flip.js"(t,e){var n=(o,i)=>(o[0]=-i[0],o[1]=-i[1],o[2]=-i[2],o[3]=-i[3],o);e.exports=n}}),Sin=yt({"node_modules/@jscad/modeling/src/maths/plane/fromNormalAndPoint.js"(t,e){var n=$r(),o=(i,r,s)=>{const a=n.normalize(n.create(),r),A=n.dot(s,a);return i[0]=a[0],i[1]=a[1],i[2]=a[2],i[3]=A,i};e.exports=o}}),Qin=yt({"node_modules/@jscad/modeling/src/maths/vec4/fromValues.js"(t,e){var n=Xhe(),o=(i,r,s,a)=>{const A=n();return A[0]=i,A[1]=r,A[2]=s,A[3]=a,A};e.exports=o}}),sdi=yt({"node_modules/@jscad/modeling/src/maths/plane/fromNoisyPoints.js"(t,e){var n=$r(),o=Sin(),i=(r,...s)=>{r[0]=0,r[1]=0,r[2]=0,r[3]=0;const a=s.length;s.forEach(f=>{n.add(r,r,f)}),n.scale(r,r,1/a);let A=0,c=0,l=0,u=0,g=0,h=0;const d=n.create();s.forEach(f=>{n.subtract(d,f,r),A+=d[0]*d[0],c+=d[0]*d[1],l+=d[0]*d[2],u+=d[1]*d[1],g+=d[1]*d[2],h+=d[2]*d[2]}),A/=a,c/=a,l/=a,u/=a,g/=a,h/=a,d[0]=0,d[1]=0,d[2]=0;const p=n.create();let m=u*h-g*g;p[0]=m,p[1]=l*g-c*h,p[2]=c*g-l*u;let _=m*m;return n.add(d,d,n.scale(p,p,_)),m=A*h-l*l,p[0]=l*g-c*h,p[1]=m,p[2]=c*l-g*A,_=m*m,n.dot(d,p)<0&&(_=-_),n.add(d,d,n.scale(p,p,_)),m=A*u-c*c,p[0]=c*g-l*u,p[1]=c*l-g*A,p[2]=m,_=m*m,n.dot(d,p)<0&&(_=-_),n.add(d,d,n.scale(p,p,_)),o(r,d,r)};e.exports=i}}),vin=yt({"node_modules/@jscad/modeling/src/maths/plane/fromPoints.js"(t,e){var n=$r(),o=(i,...r)=>{const s=r.length,a=n.create(),A=n.create(),c=l=>{const u=r[l],g=r[(l+1)%s],h=r[(l+2)%s];return n.subtract(a,g,u),n.subtract(A,h,u),n.cross(a,a,A),n.normalize(a,a),a};return i[0]=0,i[1]=0,i[2]=0,s===3?n.copy(i,c(0)):(r.forEach((l,u)=>{n.add(i,i,c(u))}),n.normalize(i,i)),i[3]=n.dot(i,r[0]),i};e.exports=o}}),adi=yt({"node_modules/@jscad/modeling/src/maths/plane/fromPointsRandom.js"(t,e){var{EPS:n}=mc(),o=$r(),i=(r,s,a,A)=>{let c=o.subtract(o.create(),a,s),l=o.subtract(o.create(),A,s);o.length(c)<n&&(c=o.orthogonal(c,l)),o.length(l)<n&&(l=o.orthogonal(l,c));let u=o.cross(o.create(),c,l);o.length(u)<n&&(l=o.orthogonal(l,c),u=o.cross(u,c,l)),u=o.normalize(u,u);const g=o.dot(u,s);return r[0]=u[0],r[1]=u[1],r[2]=u[2],r[3]=g,r};e.exports=i}}),Adi=yt({"node_modules/@jscad/modeling/src/maths/plane/projectionOfPoint.js"(t,e){var n=$r(),o=(i,r)=>{const s=r[0]*i[0]+r[1]*i[1]+r[2]*i[2]-i[3],a=r[0]-s*i[0],A=r[1]-s*i[1],c=r[2]-s*i[2];return n.fromValues(a,A,c)};e.exports=o}}),win=yt({"node_modules/@jscad/modeling/src/maths/plane/signedDistanceToPoint.js"(t,e){var n=$r(),o=(i,r)=>n.dot(i,r)-i[3];e.exports=o}}),Pin=yt({"node_modules/@jscad/modeling/src/maths/vec4/toString.js"(t,e){var n=o=>`(${o[0].toFixed(9)}, ${o[1].toFixed(9)}, ${o[2].toFixed(9)}, ${o[3].toFixed(9)})`;e.exports=n}}),cdi=yt({"node_modules/@jscad/modeling/src/maths/plane/transform.js"(t,e){var n=Du(),o=$r(),i=vin(),r=bin(),s=(a,A,c)=>{const l=n.isMirroring(c),u=o.orthogonal(o.create(),A),g=o.cross(u,A,u),h=o.cross(o.create(),A,g);let d=o.fromScalar(o.create(),A[3]);o.multiply(d,d,A);let p=o.add(o.create(),d,g),m=o.add(o.create(),d,h);return d=o.transform(d,d,c),p=o.transform(p,p,c),m=o.transform(m,m,c),i(a,d,p,m),l&&r(a,a),a};e.exports=s}}),S6=yt({"node_modules/@jscad/modeling/src/maths/plane/index.js"(t,e){e.exports={clone:xin(),copy:Ein(),create:Xhe(),equals:Bin(),flip:bin(),fromNormalAndPoint:Sin(),fromValues:Qin(),fromNoisyPoints:sdi(),fromPoints:vin(),fromPointsRandom:adi(),projectionOfPoint:Adi(),signedDistanceToPoint:win(),toString:Pin(),transform:cdi()}}}),ldi=yt({"node_modules/@jscad/modeling/src/geometries/poly3/invert.js"(t,e){var n=S6(),o=PY(),i=r=>{const s=r.vertices.slice().reverse(),a=o(s);return r.plane&&(a.plane=n.flip(n.create(),r.plane)),a};e.exports=i}}),Min=yt({"node_modules/@jscad/modeling/src/geometries/poly3/isA.js"(t,e){var n=o=>!!(o&&typeof o=="object"&&"vertices"in o&&Array.isArray(o.vertices));e.exports=n}}),Din=yt({"node_modules/@jscad/modeling/src/geometries/poly3/isConvex.js"(t,e){var n=S6(),o=$r(),i=a=>r(a.vertices),r=a=>{const A=a.length;if(A>2){const c=n.fromPoints(n.create(),...a);let l=a[A-2],u=a[A-1];for(let g=0;g<A;g++){const h=a[g];if(!s(l,u,h,c))return!1;l=u,u=h}}return!0},s=(a,A,c,l)=>{const u=o.cross(o.create(),o.subtract(o.create(),A,a),o.subtract(o.create(),c,A));return o.dot(u,l)>=0};e.exports=i}}),dVe=yt({"node_modules/@jscad/modeling/src/geometries/poly3/plane.js"(t,e){var n=S6(),o=i=>(i.plane||(i.plane=n.fromPoints(n.create(),...i.vertices)),i.plane);e.exports=o}}),Nin=yt({"node_modules/@jscad/modeling/src/geometries/poly3/measureArea.js"(t,e){var n=dVe(),o=i=>{const r=i.vertices.length;if(r<3)return 0;const s=i.vertices,a=n(i),A=Math.abs(a[0]),c=Math.abs(a[1]),l=Math.abs(a[2]);if(A+c+l===0)return 0;let u=3;A>c&&A>l?u=1:c>l&&(u=2);let g=0,h=0,d=1,p=2;switch(u){case 1:for(d=1;d<r;d++)h=d-1,p=(d+1)%r,g+=s[d][1]*(s[p][2]-s[h][2]);g+=s[0][1]*(s[1][2]-s[r-1][2]),g/=2*a[0];break;case 2:for(d=1;d<r;d++)h=d-1,p=(d+1)%r,g+=s[d][2]*(s[p][0]-s[h][0]);g+=s[0][2]*(s[1][0]-s[r-1][0]),g/=2*a[1];break;default:for(d=1;d<r;d++)h=d-1,p=(d+1)%r,g+=s[d][0]*(s[p][1]-s[h][1]);g+=s[0][0]*(s[1][1]-s[r-1][1]),g/=2*a[2];break}return g};e.exports=o}}),udi=yt({"node_modules/@jscad/modeling/src/geometries/poly3/measureBoundingBox.js"(t,e){var n=$r(),o=i=>{const r=i.vertices,s=r.length,a=s===0?n.create():n.clone(r[0]),A=n.clone(a);for(let c=1;c<s;c++)n.min(a,a,r[c]),n.max(A,A,r[c]);return[a,A]};e.exports=o}}),gdi=yt({"node_modules/@jscad/modeling/src/maths/vec4/dot.js"(t,e){var n=(o,i)=>o[0]*i[0]+o[1]*i[1]+o[2]*i[2]+o[3]*i[3];e.exports=n}}),ddi=yt({"node_modules/@jscad/modeling/src/maths/vec4/fromScalar.js"(t,e){var n=(o,i)=>(o[0]=i,o[1]=i,o[2]=i,o[3]=i,o);e.exports=n}}),hdi=yt({"node_modules/@jscad/modeling/src/maths/vec4/transform.js"(t,e){var n=(o,i,r)=>{const[s,a,A,c]=i;return o[0]=r[0]*s+r[4]*a+r[8]*A+r[12]*c,o[1]=r[1]*s+r[5]*a+r[9]*A+r[13]*c,o[2]=r[2]*s+r[6]*a+r[10]*A+r[14]*c,o[3]=r[3]*s+r[7]*a+r[11]*A+r[15]*c,o};e.exports=n}}),Rin=yt({"node_modules/@jscad/modeling/src/maths/vec4/index.js"(t,e){e.exports={clone:xin(),copy:Ein(),create:Xhe(),dot:gdi(),equals:Bin(),fromScalar:ddi(),fromValues:Qin(),toString:Pin(),transform:hdi()}}}),pdi=yt({"node_modules/@jscad/modeling/src/geometries/poly3/measureBoundingSphere.js"(t,e){var n=Rin(),o=new WeakMap,i=r=>{const s=o.get(r);if(s)return s;const a=r.vertices,A=n.create();if(a.length===0)return A[0]=0,A[1]=0,A[2]=0,A[3]=0,A;let c=a[0],l=c,u=c,g=c,h=c,d=c;a.forEach(f=>{c[0]>f[0]&&(c=f),l[1]>f[1]&&(l=f),u[2]>f[2]&&(u=f),g[0]<f[0]&&(g=f),h[1]<f[1]&&(h=f),d[2]<f[2]&&(d=f)}),A[0]=(c[0]+g[0])*.5,A[1]=(l[1]+h[1])*.5,A[2]=(u[2]+d[2])*.5;const p=A[0]-g[0],m=A[1]-h[1],_=A[2]-d[2];return A[3]=Math.sqrt(p*p+m*m+_*_),o.set(r,A),A};e.exports=i}}),mdi=yt({"node_modules/@jscad/modeling/src/geometries/poly3/measureSignedVolume.js"(t,e){var n=$r(),o=i=>{let r=0;const s=i.vertices,a=n.create();for(let A=0;A<s.length-2;A++)n.cross(a,s[A+1],s[A+2]),r+=n.dot(s[0],a);return r/=6,r};e.exports=o}}),_di=yt({"node_modules/@jscad/modeling/src/geometries/poly3/toPoints.js"(t,e){var n=o=>o.vertices;e.exports=n}}),fdi=yt({"node_modules/@jscad/modeling/src/geometries/poly3/toString.js"(t,e){var n=$r(),o=i=>{let r="poly3: vertices: [";return i.vertices.forEach(s=>{r+=`${n.toString(s)}, `}),r+="]",r};e.exports=o}}),Idi=yt({"node_modules/@jscad/modeling/src/geometries/poly3/transform.js"(t,e){var n=Du(),o=$r(),i=PY(),r=(s,a)=>{const A=a.vertices.map(c=>o.transform(o.create(),c,s));return n.isMirroring(s)&&A.reverse(),i(A)};e.exports=r}}),Cdi=yt({"node_modules/@jscad/modeling/src/geometries/poly3/validate.js"(t,e){var n=win(),{NEPS:o}=mc(),i=$r(),r=Min(),s=Din(),a=Nin(),A=dVe(),c=l=>{if(!r(l))throw new Error("invalid poly3 structure");if(l.vertices.length<3)throw new Error(`poly3 not enough vertices ${l.vertices.length}`);if(a(l)<=0)throw new Error("poly3 area must be greater than zero");for(let u=0;u<l.vertices.length;u++)if(i.equals(l.vertices[u],l.vertices[(u+1)%l.vertices.length]))throw new Error(`poly3 duplicate vertex ${l.vertices[u]}`);if(!s(l))throw new Error("poly3 must be convex");if(l.vertices.forEach(u=>{if(!u.every(Number.isFinite))throw new Error(`poly3 invalid vertex ${u}`)}),l.vertices.length>3){const u=A(l);l.vertices.forEach(g=>{const h=Math.abs(n(u,g));if(h>o)throw new Error(`poly3 must be coplanar: vertex ${g} distance ${h}`)})}};e.exports=c}}),XA=yt({"node_modules/@jscad/modeling/src/geometries/poly3/index.js"(t,e){e.exports={clone:odi(),create:PY(),fromPoints:idi(),fromPointsAndPlane:rdi(),invert:ldi(),isA:Min(),isConvex:Din(),measureArea:Nin(),measureBoundingBox:udi(),measureBoundingSphere:pdi(),measureSignedVolume:mdi(),plane:dVe(),toPoints:_di(),toString:fdi(),transform:Idi(),validate:Cdi()}}}),ydi=yt({"node_modules/@jscad/modeling/src/geometries/geom3/fromPointsConvex.js"(t,e){var n=yin(),o=bX(),i=XA(),r=s=>{if(!Array.isArray(s))throw new Error("the given points must be an array");const A=n(s,{skipTriangulation:!0}).map(c=>{const l=c.map(u=>s[u]);return i.create(l)});return o(A)};e.exports=r}}),xdi=yt({"node_modules/@jscad/modeling/src/geometries/geom3/fromPoints.js"(t,e){var n=XA(),o=bX(),i=r=>{if(!Array.isArray(r))throw new Error("the given points must be an array");const s=r.map((A,c)=>n.create(A));return o(s)};e.exports=i}}),Edi=yt({"node_modules/@jscad/modeling/src/geometries/geom3/fromCompactBinary.js"(t,e){var n=$r(),o=Du(),i=XA(),r=bX(),s=a=>{if(a[0]!==1)throw new Error("invalid compact binary data");const A=r();A.transforms=o.clone(a.slice(1,17));const c=a[21];let l=22,u=a.length-c*3;for(;u<a.length;){const g=a[l];l++;const h=[];for(let d=0;d<g;d++)h.push(n.fromValues(a[u],a[u+1],a[u+2])),u+=3;A.polygons.push(i.create(h))}return a[17]>=0&&(A.color=[a[17],a[18],a[19],a[20]]),A};e.exports=s}}),Bdi=yt({"node_modules/@jscad/modeling/src/geometries/geom3/applyTransforms.js"(t,e){var n=Du(),o=XA(),i=r=>(n.isIdentity(r.transforms)||(r.polygons=r.polygons.map(s=>o.transform(r.transforms,s)),r.transforms=n.create()),r);e.exports=i}}),SX=yt({"node_modules/@jscad/modeling/src/geometries/geom3/toPolygons.js"(t,e){var n=Bdi(),o=i=>n(i).polygons;e.exports=o}}),bdi=yt({"node_modules/@jscad/modeling/src/geometries/geom3/invert.js"(t,e){var n=XA(),o=bX(),i=SX(),r=s=>{const A=i(s).map(c=>n.invert(c));return o(A)};e.exports=r}}),hVe=yt({"node_modules/@jscad/modeling/src/geometries/geom3/isA.js"(t,e){var n=o=>!!(o&&typeof o=="object"&&"polygons"in o&&"transforms"in o&&Array.isArray(o.polygons)&&"length"in o.transforms);e.exports=n}}),Sdi=yt({"node_modules/@jscad/modeling/src/geometries/geom3/isConvex.js"(t,e){var{EPS:n}=mc(),o=$r(),i=hVe(),r=SX(),s=XA(),a=A=>{if(!i(A))throw new Error("isConvex requires a geom3 geometry");const c=r(A);if(c.length===0)return!0;const l=[],u=new Set;for(let g=0;g<c.length;g++){const h=c[g].vertices;for(let d=0;d<h.length;d++){const p=h[d],m=`${p[0]},${p[1]},${p[2]}`;u.has(m)||(u.add(m),l.push(p))}}for(let g=0;g<c.length;g++){const h=s.plane(c[g]);for(let d=0;d<l.length;d++){const p=l[d];if(o.dot(h,p)-h[3]>n)return!1}}return!0};e.exports=a}}),Qdi=yt({"node_modules/@jscad/modeling/src/geometries/geom3/toPoints.js"(t,e){var n=XA(),o=SX(),i=r=>o(r).map(A=>n.toPoints(A));e.exports=i}}),vdi=yt({"node_modules/@jscad/modeling/src/geometries/geom3/toString.js"(t,e){var n=XA(),o=SX(),i=r=>{const s=o(r);let a="geom3 ("+s.length+` polygons):
`;return s.forEach(A=>{a+=" "+n.toString(A)+`
`}),a};e.exports=i}}),wdi=yt({"node_modules/@jscad/modeling/src/geometries/geom3/toCompactBinary.js"(t,e){var n=XA(),o=i=>{const r=i.polygons,s=i.transforms,a=r.length,A=r.reduce((h,d)=>h+d.vertices.length,0);let c=[-1,-1,-1,-1];i.color&&(c=i.color);const l=new Float32Array(22+a+A*3);l[0]=1,l[1]=s[0],l[2]=s[1],l[3]=s[2],l[4]=s[3],l[5]=s[4],l[6]=s[5],l[7]=s[6],l[8]=s[7],l[9]=s[8],l[10]=s[9],l[11]=s[10],l[12]=s[11],l[13]=s[12],l[14]=s[13],l[15]=s[14],l[16]=s[15],l[17]=c[0],l[18]=c[1],l[19]=c[2],l[20]=c[3],l[21]=A;let u=22,g=u+a;return r.forEach(h=>{const d=n.toPoints(h);l[u]=d.length,u++;for(let p=0;p<d.length;p++){const m=d[p];l[g+0]=m[0],l[g+1]=m[1],l[g+2]=m[2],g+=3}}),l};e.exports=o}}),Pdi=yt({"node_modules/@jscad/modeling/src/geometries/geom3/transform.js"(t,e){var n=Du(),o=(i,r)=>{const s=n.multiply(n.create(),i,r.transforms);return Object.assign({},r,{transforms:s})};e.exports=o}}),Mdi=yt({"node_modules/@jscad/modeling/src/geometries/geom3/validate.js"(t,e){var n=XA(),o=hVe(),i=s=>{if(!o(s))throw new Error("invalid geom3 structure");if(s.polygons.forEach(n.validate),r(s),!s.transforms.every(Number.isFinite))throw new Error(`geom3 invalid transforms ${s.transforms}`)},r=s=>{const a=new Map;s.polygons.forEach(({vertices:c})=>{c.forEach((l,u)=>{const g=`${l}`,h=`${c[(u+1)%c.length]}`,d=`${g}/${h}`,p=a.has(d)?a.get(d):0;a.set(d,p+1)})});const A=[];if(a.forEach((c,l)=>{const u=l.split("/").reverse().join("/"),g=a.get(u);c!==g&&A.push(l.replace("/"," -> "))}),A.length>0)throw new Error(`non-manifold edges ${A.length}
${A.join(`
`)}`)};e.exports=i}}),Ta=yt({"node_modules/@jscad/modeling/src/geometries/geom3/index.js"(t,e){e.exports={clone:jgi(),create:bX(),fromPointsConvex:ydi(),fromPoints:xdi(),fromCompactBinary:Edi(),invert:bdi(),isA:hVe(),isConvex:Sdi(),toPoints:Qdi(),toPolygons:SX(),toString:vdi(),toCompactBinary:wdi(),transform:Pdi(),validate:Mdi()}}}),pVe=yt({"node_modules/@jscad/modeling/src/geometries/path2/clone.js"(t,e){var n=o=>Object.assign({},o);e.exports=n}}),Tin=yt({"node_modules/@jscad/modeling/src/geometries/path2/close.js"(t,e){var{EPS:n}=mc(),o=_A(),i=pVe(),r=s=>{if(s.isClosed)return s;const a=i(s);if(a.isClosed=!0,a.points.length>1){const A=a.points,c=A[0];let l=A[A.length-1];for(;o.distance(c,l)<n*n&&(A.pop(),A.length!==1);)l=A[A.length-1]}return a};e.exports=r}}),Zhe=yt({"node_modules/@jscad/modeling/src/geometries/path2/create.js"(t,e){var n=Du(),o=i=>(i===void 0&&(i=[]),{points:i,isClosed:!1,transforms:n.create()});e.exports=o}}),mVe=yt({"node_modules/@jscad/modeling/src/geometries/path2/fromPoints.js"(t,e){var{EPS:n}=mc(),o=_A(),i=Tin(),r=Zhe(),s=(a,A)=>{const c={closed:!1};let{closed:l}=Object.assign({},c,a),u=r();if(u.points=A.map(g=>o.clone(g)),u.points.length>1){const g=u.points[0],h=u.points[u.points.length-1];o.distance(g,h)<n*n&&(l=!0)}return l===!0&&(u=i(u)),u};e.exports=s}}),Ddi=yt({"node_modules/@jscad/modeling/src/geometries/path2/applyTransforms.js"(t,e){var n=Du(),o=_A(),i=r=>(n.isIdentity(r.transforms)||(r.points=r.points.map(s=>o.transform(o.create(),s,r.transforms)),r.transforms=n.create()),r);e.exports=i}}),MY=yt({"node_modules/@jscad/modeling/src/geometries/path2/toPoints.js"(t,e){var n=Ddi(),o=i=>n(i).points;e.exports=o}}),Ndi=yt({"node_modules/@jscad/modeling/src/geometries/path2/appendArc.js"(t,e){var{TAU:n}=mc(),o=_A(),i=mVe(),r=MY(),s=(a,A)=>{const c={radius:[0,0],xaxisrotation:0,clockwise:!1,large:!1,segments:16};let{endpoint:l,radius:u,xaxisrotation:g,clockwise:h,large:d,segments:p}=Object.assign({},c,a);if(!Array.isArray(l))throw new Error("endpoint must be an array of X and Y values");if(l.length<2)throw new Error("endpoint must contain X and Y values");if(l=o.clone(l),!Array.isArray(u))throw new Error("radius must be an array of X and Y values");if(u.length<2)throw new Error("radius must contain X and Y values");if(p<4)throw new Error("segments must be four or more");const m=1e5;if(A.isClosed)throw new Error("the given path cannot be closed");const _=r(A);if(_.length<1)throw new Error("the given path must contain one or more points (as the starting point for the arc)");let f=u[0],I=u[1];const C=_[_.length-1];f=Math.round(f*m)/m,I=Math.round(I*m)/m,l=o.fromValues(Math.round(l[0]*m)/m,Math.round(l[1]*m)/m);const y=!h;let x=[];if(f===0||I===0)x.push(l);else{f=Math.abs(f),I=Math.abs(I);const B=g,S=Math.cos(B),Q=Math.sin(B),w=o.subtract(o.create(),C,l);o.scale(w,w,.5);const M=Math.round((S*w[0]+Q*w[1])*m)/m,k=Math.round((-Q*w[0]+S*w[1])*m)/m,R=o.fromValues(M,k),F=R[0]*R[0]/(f*f)+R[1]*R[1]/(I*I);if(F>1){const ne=Math.sqrt(F);f*=ne,I*=ne,f=Math.round(f*m)/m,I=Math.round(I*m)/m}let O=Math.sqrt((f*f*I*I-f*f*R[1]*R[1]-I*I*R[0]*R[0])/(f*f*R[1]*R[1]+I*I*R[0]*R[0]));y===d&&(O=-O);const U=o.fromValues(f*R[1]/I,-I*R[0]/f);o.scale(U,U,O);let Y=o.fromValues(S*U[0]-Q*U[1],Q*U[0]+S*U[1]);Y=o.add(Y,Y,o.scale(o.create(),o.add(o.create(),C,l),.5));const W=o.fromValues((R[0]-U[0])/f,(R[1]-U[1])/I),te=o.fromValues((-R[0]-U[0])/f,(-R[1]-U[1])/I),j=o.angleRadians(W);let oe=o.angleRadians(te)-j;oe=oe%n,!y&&oe>0?oe-=n:y&&oe<0&&(oe+=n);let ie=Math.floor(p*(Math.abs(oe)/n));ie<1&&(ie=1);for(let ne=1;ne<ie;ne++){const le=j+ne/ie*oe,ge=Math.cos(le),_e=Math.sin(le),ue=o.fromValues(S*f*ge-Q*I*_e,Q*f*ge+S*I*_e);o.add(ue,ue,Y),x.push(ue)}ie&&x.push(a.endpoint)}return x=_.concat(x),i({},x)};e.exports=s}}),kin=yt({"node_modules/@jscad/modeling/src/geometries/path2/concat.js"(t,e){var n=mVe(),o=MY(),{equals:i}=_A(),r=(...s)=>{let a=!1,A=[];return s.forEach((c,l)=>{const u=o(c).slice();if(A.length>0&&u.length>0&&i(u[0],A[A.length-1])&&u.shift(),u.length>0&&a)throw new Error(`Cannot concatenate to a closed path; check the ${l}th path`);a=c.isClosed,A=A.concat(u)}),n({closed:a},A)};e.exports=r}}),Fin=yt({"node_modules/@jscad/modeling/src/geometries/path2/appendPoints.js"(t,e){var n=kin(),o=Zhe(),i=(r,s)=>n(s,o(r));e.exports=i}}),Rdi=yt({"node_modules/@jscad/modeling/src/geometries/path2/appendBezier.js"(t,e){var{TAU:n}=mc(),o=_A(),i=_A(),r=Fin(),s=MY(),a=(A,c)=>{const l={segments:16};let{controlPoints:u,segments:g}=Object.assign({},l,A);if(!Array.isArray(u))throw new Error("controlPoints must be an array of one or more points");if(u.length<1)throw new Error("controlPoints must be an array of one or more points");if(g<4)throw new Error("segments must be four or more");if(c.isClosed)throw new Error("the given geometry cannot be closed");const h=s(c);if(h.length<1)throw new Error("the given path must contain one or more points (as the starting point for the bezier curve)");if(u=u.slice(),u[0]===null){if(u.length<2)throw new Error("a null control point must be passed with one more control points");let R=h[h.length-2];if("lastBezierControlPoint"in c&&(R=c.lastBezierControlPoint),!Array.isArray(R))throw new Error("the given path must contain TWO or more points if given a null control point");const F=o.scale(o.create(),h[h.length-1],2);o.subtract(F,F,R),u[0]=F}u.unshift(h[h.length-1]);const p=u.length-1,m=[];let _=1;for(let R=0;R<=p;++R)R>0&&(_*=R),m.push(_);const f=[];for(let R=0;R<=p;++R){const F=m[p]/(m[R]*m[p-R]);f.push(F)}const I=o.create(),C=o.create(),y=i.create(),x=R=>{let F=1,O=Math.pow(1-R,p);const U=R!==1?1/(1-R):1,Y=o.create();for(let W=0;W<=p;++W){W===p&&(O=1);const te=f[W]*F*O,j=o.scale(I,u[W],te);o.add(Y,Y,j),F*=R,O*=U}return Y},E=[],B=[],S=p+1;for(let R=0;R<S;++R){const F=R/(S-1),O=x(F);E.push(O),B.push(F)}let Q=1;const w=n/g,M=Math.sin(w);for(;Q<E.length-1;){const R=o.subtract(I,E[Q],E[Q-1]);o.normalize(R,R);const F=o.subtract(C,E[Q+1],E[Q]);o.normalize(F,F);const O=o.cross(y,R,F);if(Math.abs(O[2])>M){const U=B[Q-1],Y=B[Q+1],W=U+(Y-U)*1/3,te=U+(Y-U)*2/3,j=x(W),J=x(te);E.splice(Q,1,j,J),B.splice(Q,1,W,te),Q--,Q<1&&(Q=1)}else++Q}E.shift();const k=r(E,c);return k.lastBezierControlPoint=u[u.length-2],k};e.exports=a}}),Tdi=yt({"node_modules/@jscad/modeling/src/geometries/path2/equals.js"(t,e){var n=_A(),o=MY(),i=(r,s)=>{if(r.isClosed!==s.isClosed||r.points.length!==s.points.length)return!1;const a=o(r),A=o(s),c=a.length;let l=0;do{let u=!1;for(let g=0;g<c;g++)if(!n.equals(a[g],A[(g+l)%c])){u=!0;break}if(u===!1)return!0;if(!r.isClosed)return!1}while(++l<c);return!1};e.exports=i}}),kdi=yt({"node_modules/@jscad/modeling/src/geometries/path2/fromCompactBinary.js"(t,e){var n=Du(),o=_A(),i=Zhe(),r=s=>{if(s[0]!==2)throw new Error("invalid compact binary data");const a=i();a.transforms=n.clone(s.slice(1,17)),a.isClosed=!!s[17];for(let A=22;A<s.length;A+=2){const c=o.fromValues(s[A],s[A+1]);a.points.push(c)}return s[18]>=0&&(a.color=[s[18],s[19],s[20],s[21]]),a};e.exports=r}}),Lin=yt({"node_modules/@jscad/modeling/src/geometries/path2/isA.js"(t,e){var n=o=>!!(o&&typeof o=="object"&&"points"in o&&"transforms"in o&&"isClosed"in o&&Array.isArray(o.points)&&"length"in o.transforms);e.exports=n}}),Fdi=yt({"node_modules/@jscad/modeling/src/geometries/path2/reverse.js"(t,e){var n=pVe(),o=i=>{const r=n(i);return r.points=i.points.slice().reverse(),r};e.exports=o}}),Ldi=yt({"node_modules/@jscad/modeling/src/geometries/path2/toString.js"(t,e){var n=_A(),o=MY(),i=r=>{const s=o(r);let a="path ("+s.length+" points, "+r.isClosed+`):
[
`;return s.forEach(A=>{a+=" "+n.toString(A)+`,
`}),a+=`]
`,a};e.exports=i}}),Hdi=yt({"node_modules/@jscad/modeling/src/geometries/path2/toCompactBinary.js"(t,e){var n=o=>{const i=o.points,r=o.transforms;let s=[-1,-1,-1,-1];o.color&&(s=o.color);const a=new Float32Array(22+i.length*2);a[0]=2,a[1]=r[0],a[2]=r[1],a[3]=r[2],a[4]=r[3],a[5]=r[4],a[6]=r[5],a[7]=r[6],a[8]=r[7],a[9]=r[8],a[10]=r[9],a[11]=r[10],a[12]=r[11],a[13]=r[12],a[14]=r[13],a[15]=r[14],a[16]=r[15],a[17]=o.isClosed?1:0,a[18]=s[0],a[19]=s[1],a[20]=s[2],a[21]=s[3];for(let A=0;A<i.length;A++){const c=A*2+22,l=i[A];a[c]=l[0],a[c+1]=l[1]}return a};e.exports=n}}),Odi=yt({"node_modules/@jscad/modeling/src/geometries/path2/transform.js"(t,e){var n=Du(),o=(i,r)=>{const s=n.multiply(n.create(),i,r.transforms);return Object.assign({},r,{transforms:s})};e.exports=o}}),Gdi=yt({"node_modules/@jscad/modeling/src/geometries/path2/validate.js"(t,e){var n=_A(),o=Lin(),i=r=>{if(!o(r))throw new Error("invalid path2 structure");if(r.points.length>1){for(let s=0;s<r.points.length;s++)if(n.equals(r.points[s],r.points[(s+1)%r.points.length]))throw new Error(`path2 duplicate points ${r.points[s]}`)}if(r.points.forEach(s=>{if(!s.every(Number.isFinite))throw new Error(`path2 invalid point ${s}`)}),!r.transforms.every(Number.isFinite))throw new Error(`path2 invalid transforms ${r.transforms}`)};e.exports=i}}),Au=yt({"node_modules/@jscad/modeling/src/geometries/path2/index.js"(t,e){e.exports={appendArc:Ndi(),appendBezier:Rdi(),appendPoints:Fin(),clone:pVe(),close:Tin(),concat:kin(),create:Zhe(),equals:Tdi(),fromPoints:mVe(),fromCompactBinary:kdi(),isA:Lin(),reverse:Fdi(),toPoints:MY(),toString:Ldi(),toCompactBinary:Hdi(),transform:Odi(),validate:Gdi()}}}),Ydi=yt({"node_modules/@jscad/modeling/src/colors/colorize.js"(t,e){var n=ga(),o=Ya(),i=Ta(),r=Au(),s=XA(),a=(g,h)=>{const d=o.clone(h);return d.color=g,d},A=(g,h)=>{const d=i.clone(h);return d.color=g,d},c=(g,h)=>{const d=r.clone(h);return d.color=g,d},l=(g,h)=>{const d=s.clone(h);return d.color=g,d},u=(g,...h)=>{if(!Array.isArray(g))throw new Error("color must be an array");if(g.length<3)throw new Error("color must contain R, G and B values");if(g.length===3&&(g=[g[0],g[1],g[2],1]),h=n(h),h.length===0)throw new Error("wrong number of arguments");const d=h.map(p=>o.isA(p)?a(g,p):i.isA(p)?A(g,p):r.isA(p)?c(g,p):s.isA(p)?l(g,p):(p.color=g,p));return d.length===1?d[0]:d};e.exports=u}}),Hin=yt({"node_modules/@jscad/modeling/src/colors/cssColors.js"(t,e){var n={black:[0,0,0],silver:[.7529411764705882,.7529411764705882,.7529411764705882],gray:[.5019607843137255,.5019607843137255,.5019607843137255],white:[1,1,1],maroon:[.5019607843137255,0,0],red:[1,0,0],purple:[.5019607843137255,0,.5019607843137255],fuchsia:[1,0,1],green:[0,.5019607843137255,0],lime:[0,1,0],olive:[.5019607843137255,.5019607843137255,0],yellow:[1,1,0],navy:[0,0,.5019607843137255],blue:[0,0,1],teal:[0,.5019607843137255,.5019607843137255],aqua:[0,1,1],aliceblue:[.9411764705882353,.9725490196078431,1],antiquewhite:[.9803921568627451,.9215686274509803,.8431372549019608],aquamarine:[.4980392156862745,1,.8313725490196079],azure:[.9411764705882353,1,1],beige:[.9607843137254902,.9607843137254902,.8627450980392157],bisque:[1,.8941176470588236,.7686274509803922],blanchedalmond:[1,.9215686274509803,.803921568627451],blueviolet:[.5411764705882353,.16862745098039217,.8862745098039215],brown:[.6470588235294118,.16470588235294117,.16470588235294117],burlywood:[.8705882352941177,.7215686274509804,.5294117647058824],cadetblue:[.37254901960784315,.6196078431372549,.6274509803921569],chartreuse:[.4980392156862745,1,0],chocolate:[.8235294117647058,.4117647058823529,.11764705882352941],coral:[1,.4980392156862745,.3137254901960784],cornflowerblue:[.39215686274509803,.5843137254901961,.9294117647058824],cornsilk:[1,.9725490196078431,.8627450980392157],crimson:[.8627450980392157,.0784313725490196,.23529411764705882],cyan:[0,1,1],darkblue:[0,0,.5450980392156862],darkcyan:[0,.5450980392156862,.5450980392156862],darkgoldenrod:[.7215686274509804,.5254901960784314,.043137254901960784],darkgray:[.6627450980392157,.6627450980392157,.6627450980392157],darkgreen:[0,.39215686274509803,0],darkgrey:[.6627450980392157,.6627450980392157,.6627450980392157],darkkhaki:[.7411764705882353,.7176470588235294,.4196078431372549],darkmagenta:[.5450980392156862,0,.5450980392156862],darkolivegreen:[.3333333333333333,.4196078431372549,.1843137254901961],darkorange:[1,.5490196078431373,0],darkorchid:[.6,.19607843137254902,.8],darkred:[.5450980392156862,0,0],darksalmon:[.9137254901960784,.5882352941176471,.47843137254901963],darkseagreen:[.5607843137254902,.7372549019607844,.5607843137254902],darkslateblue:[.2823529411764706,.23921568627450981,.5450980392156862],darkslategray:[.1843137254901961,.30980392156862746,.30980392156862746],darkslategrey:[.1843137254901961,.30980392156862746,.30980392156862746],darkturquoise:[0,.807843137254902,.8196078431372549],darkviolet:[.5803921568627451,0,.8274509803921568],deeppink:[1,.0784313725490196,.5764705882352941],deepskyblue:[0,.7490196078431373,1],dimgray:[.4117647058823529,.4117647058823529,.4117647058823529],dimgrey:[.4117647058823529,.4117647058823529,.4117647058823529],dodgerblue:[.11764705882352941,.5647058823529412,1],firebrick:[.6980392156862745,.13333333333333333,.13333333333333333],floralwhite:[1,.9803921568627451,.9411764705882353],forestgreen:[.13333333333333333,.5450980392156862,.13333333333333333],gainsboro:[.8627450980392157,.8627450980392157,.8627450980392157],ghostwhite:[.9725490196078431,.9725490196078431,1],gold:[1,.8431372549019608,0],goldenrod:[.8549019607843137,.6470588235294118,.12549019607843137],greenyellow:[.6784313725490196,1,.1843137254901961],grey:[.5019607843137255,.5019607843137255,.5019607843137255],honeydew:[.9411764705882353,1,.9411764705882353],hotpink:[1,.4117647058823529,.7058823529411765],indianred:[.803921568627451,.3607843137254902,.3607843137254902],indigo:[.29411764705882354,0,.5098039215686274],ivory:[1,1,.9411764705882353],khaki:[.9411764705882353,.9019607843137255,.5490196078431373],lavender:[.9019607843137255,.9019607843137255,.9803921568627451],lavenderblush:[1,.9411764705882353,.9607843137254902],lawngreen:[.48627450980392156,.9882352941176471,0],lemonchiffon:[1,.9803921568627451,.803921568627451],lightblue:[.6784313725490196,.8470588235294118,.9019607843137255],lightcoral:[.9411764705882353,.5019607843137255,.5019607843137255],lightcyan:[.8784313725490196,1,1],lightgoldenrodyellow:[.9803921568627451,.9803921568627451,.8235294117647058],lightgray:[.8274509803921568,.8274509803921568,.8274509803921568],lightgreen:[.5647058823529412,.9333333333333333,.5647058823529412],lightgrey:[.8274509803921568,.8274509803921568,.8274509803921568],lightpink:[1,.7137254901960784,.7568627450980392],lightsalmon:[1,.6274509803921569,.47843137254901963],lightseagreen:[.12549019607843137,.6980392156862745,.6666666666666666],lightskyblue:[.5294117647058824,.807843137254902,.9803921568627451],lightslategray:[.4666666666666667,.5333333333333333,.6],lightslategrey:[.4666666666666667,.5333333333333333,.6],lightsteelblue:[.6901960784313725,.7686274509803922,.8705882352941177],lightyellow:[1,1,.8784313725490196],limegreen:[.19607843137254902,.803921568627451,.19607843137254902],linen:[.9803921568627451,.9411764705882353,.9019607843137255],magenta:[1,0,1],mediumaquamarine:[.4,.803921568627451,.6666666666666666],mediumblue:[0,0,.803921568627451],mediumorchid:[.7294117647058823,.3333333333333333,.8274509803921568],mediumpurple:[.5764705882352941,.4392156862745098,.8588235294117647],mediumseagreen:[.23529411764705882,.7019607843137254,.44313725490196076],mediumslateblue:[.4823529411764706,.40784313725490196,.9333333333333333],mediumspringgreen:[0,.9803921568627451,.6039215686274509],mediumturquoise:[.2823529411764706,.8196078431372549,.8],mediumvioletred:[.7803921568627451,.08235294117647059,.5215686274509804],midnightblue:[.09803921568627451,.09803921568627451,.4392156862745098],mintcream:[.9607843137254902,1,.9803921568627451],mistyrose:[1,.8941176470588236,.8823529411764706],moccasin:[1,.8941176470588236,.7098039215686275],navajowhite:[1,.8705882352941177,.6784313725490196],oldlace:[.9921568627450981,.9607843137254902,.9019607843137255],olivedrab:[.4196078431372549,.5568627450980392,.13725490196078433],orange:[1,.6470588235294118,0],orangered:[1,.27058823529411763,0],orchid:[.8549019607843137,.4392156862745098,.8392156862745098],palegoldenrod:[.9333333333333333,.9098039215686274,.6666666666666666],palegreen:[.596078431372549,.984313725490196,.596078431372549],paleturquoise:[.6862745098039216,.9333333333333333,.9333333333333333],palevioletred:[.8588235294117647,.4392156862745098,.5764705882352941],papayawhip:[1,.9372549019607843,.8352941176470589],peachpuff:[1,.8549019607843137,.7254901960784313],peru:[.803921568627451,.5215686274509804,.24705882352941178],pink:[1,.7529411764705882,.796078431372549],plum:[.8666666666666667,.6274509803921569,.8666666666666667],powderblue:[.6901960784313725,.8784313725490196,.9019607843137255],rosybrown:[.7372549019607844,.5607843137254902,.5607843137254902],royalblue:[.2549019607843137,.4117647058823529,.8823529411764706],saddlebrown:[.5450980392156862,.27058823529411763,.07450980392156863],salmon:[.9803921568627451,.5019607843137255,.4470588235294118],sandybrown:[.9568627450980393,.6431372549019608,.3764705882352941],seagreen:[.1803921568627451,.5450980392156862,.3411764705882353],seashell:[1,.9607843137254902,.9333333333333333],sienna:[.6274509803921569,.3215686274509804,.17647058823529413],skyblue:[.5294117647058824,.807843137254902,.9215686274509803],slateblue:[.41568627450980394,.35294117647058826,.803921568627451],slategray:[.4392156862745098,.5019607843137255,.5647058823529412],slategrey:[.4392156862745098,.5019607843137255,.5647058823529412],snow:[1,.9803921568627451,.9803921568627451],springgreen:[0,1,.4980392156862745],steelblue:[.27450980392156865,.5098039215686274,.7058823529411765],tan:[.8235294117647058,.7058823529411765,.5490196078431373],thistle:[.8470588235294118,.7490196078431373,.8470588235294118],tomato:[1,.38823529411764707,.2784313725490196],turquoise:[.25098039215686274,.8784313725490196,.8156862745098039],violet:[.9333333333333333,.5098039215686274,.9333333333333333],wheat:[.9607843137254902,.8705882352941177,.7019607843137254],whitesmoke:[.9607843137254902,.9607843137254902,.9607843137254902],yellowgreen:[.6039215686274509,.803921568627451,.19607843137254902]};e.exports=n}}),Udi=yt({"node_modules/@jscad/modeling/src/colors/colorNameToRgb.js"(t,e){var n=Hin(),o=i=>n[i.toLowerCase()];e.exports=o}}),Kdi=yt({"node_modules/@jscad/modeling/src/colors/hexToRgb.js"(t,e){var n=o=>{if(o=o.replace("#",""),o.length<6)throw new Error("the given notation must contain 3 or more hex values");const i=parseInt(o.substring(0,2),16)/255,r=parseInt(o.substring(2,4),16)/255,s=parseInt(o.substring(4,6),16)/255;if(o.length>=8){const a=parseInt(o.substring(6,8),16)/255;return[i,r,s,a]}return[i,r,s]};e.exports=n}}),Oin=yt({"node_modules/@jscad/modeling/src/colors/hueToColorComponent.js"(t,e){var n=(o,i,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<.16666666666666666?o+(i-o)*6*r:r<.5?i:r<.6666666666666666?o+(i-o)*(.6666666666666666-r)*6:o);e.exports=n}}),Vdi=yt({"node_modules/@jscad/modeling/src/colors/hslToRgb.js"(t,e){var n=ga(),o=Oin(),i=(...r)=>{if(r=n(r),r.length<3)throw new Error("values must contain H, S and L values");const s=r[0],a=r[1],A=r[2];let c=A,l=A,u=A;if(a!==0){const g=A<.5?A*(1+a):A+a-A*a,h=2*A-g;c=o(h,g,s+1/3),l=o(h,g,s),u=o(h,g,s-1/3)}if(r.length>3){const g=r[3];return[c,l,u,g]}return[c,l,u]};e.exports=i}}),zdi=yt({"node_modules/@jscad/modeling/src/colors/hsvToRgb.js"(t,e){var n=ga(),o=(...i)=>{if(i=n(i),i.length<3)throw new Error("values must contain H, S and V values");const r=i[0],s=i[1],a=i[2];let A=0,c=0,l=0;const u=Math.floor(r*6),g=r*6-u,h=a*(1-s),d=a*(1-g*s),p=a*(1-(1-g)*s);switch(u%6){case 0:A=a,c=p,l=h;break;case 1:A=d,c=a,l=h;break;case 2:A=h,c=a,l=p;break;case 3:A=h,c=d,l=a;break;case 4:A=p,c=h,l=a;break;case 5:A=a,c=h,l=d;break}if(i.length>3){const m=i[3];return[A,c,l,m]}return[A,c,l]};e.exports=o}}),Jdi=yt({"node_modules/@jscad/modeling/src/colors/rgbToHex.js"(t,e){var n=ga(),o=(...i)=>{if(i=n(i),i.length<3)throw new Error("values must contain R, G and B values");const r=i[0]*255,s=i[1]*255,a=i[2]*255;let A=`#${Number(16777216+r*65536+s*256+a).toString(16).substring(1,7)}`;return i.length>3&&(A=A+Number(i[3]*255).toString(16)),A};e.exports=o}}),Wdi=yt({"node_modules/@jscad/modeling/src/colors/rgbToHsl.js"(t,e){var n=ga(),o=(...i)=>{if(i=n(i),i.length<3)throw new Error("values must contain R, G and B values");const r=i[0],s=i[1],a=i[2],A=Math.max(r,s,a),c=Math.min(r,s,a);let l,u;const g=(A+c)/2;if(A===c)l=u=0;else{const h=A-c;switch(u=g>.5?h/(2-A-c):h/(A+c),A){case r:l=(s-a)/h+(s<a?6:0);break;case s:l=(a-r)/h+2;break;case a:l=(r-s)/h+4;break}l/=6}if(i.length>3){const h=i[3];return[l,u,g,h]}return[l,u,g]};e.exports=o}}),jdi=yt({"node_modules/@jscad/modeling/src/colors/rgbToHsv.js"(t,e){var n=ga(),o=(...i)=>{if(i=n(i),i.length<3)throw new Error("values must contain R, G and B values");const r=i[0],s=i[1],a=i[2],A=Math.max(r,s,a),c=Math.min(r,s,a);let l;const u=A,g=A-c,h=A===0?0:g/A;if(A===c)l=0;else{switch(A){case r:l=(s-a)/g+(s<a?6:0);break;case s:l=(a-r)/g+2;break;case a:l=(r-s)/g+4;break}l/=6}if(i.length>3){const d=i[3];return[l,h,u,d]}return[l,h,u]};e.exports=o}}),epe=yt({"node_modules/@jscad/modeling/src/colors/index.js"(t,e){e.exports={colorize:Ydi(),colorNameToRgb:Udi(),cssColors:Hin(),hexToRgb:Kdi(),hslToRgb:Vdi(),hsvToRgb:zdi(),hueToColorComponent:Oin(),rgbToHex:Jdi(),rgbToHsl:Wdi(),rgbToHsv:jdi()}}}),$di=yt({"node_modules/@jscad/modeling/src/curves/bezier/create.js"(t,e){var n=s=>{if(!Array.isArray(s))throw new Error("Bezier points must be a valid array/");if(s.length<2)throw new Error("Bezier points must contain at least 2 values.");const a=o(s);return{points:s,pointType:a,dimensions:a==="float_single"?0:s[0].length,permutations:i(s.length-1),tangentPermutations:i(s.length-2)}},o=function(s){let a=null;return s.forEach(A=>{let c="";if(Number.isFinite(A))c="float_single";else if(Array.isArray(A))A.forEach(l=>{if(!Number.isFinite(l))throw new Error("Bezier point values must all be numbers.")}),c="float_"+A.length;else throw new Error("Bezier points must all be numbers or arrays of number.");if(a==null)a=c;else if(a!==c)throw new Error("Bezier points must be either all numbers or all arrays of numbers of the same size.")}),a},i=function(s){const a=[];for(let A=0;A<=s;A++)a.push(r(s)/(r(A)*r(s-A)));return a},r=function(s){let a=1;for(let A=2;A<=s;A++)a*=A;return a};e.exports=n}}),Gin=yt({"node_modules/@jscad/modeling/src/curves/bezier/valueAt.js"(t,e){var n=(i,r)=>{if(i<0||i>1)throw new Error("Bezier valueAt() input must be between 0 and 1");if(r.pointType==="float_single")return o(r,r.points,i);{const s=[];for(let a=0;a<r.dimensions;a++){const A=[];for(let c=0;c<r.points.length;c++)A.push(r.points[c][a]);s.push(o(r,A,i))}return s}},o=function(i,r,s){const a=r.length-1;let A=0;for(let c=0;c<=a;c++)A+=i.permutations[c]*Math.pow(1-s,a-c)*Math.pow(s,c)*r[c];return A};e.exports=n}}),qdi=yt({"node_modules/@jscad/modeling/src/curves/bezier/tangentAt.js"(t,e){var n=(i,r)=>{if(i<0||i>1)throw new Error("Bezier tangentAt() input must be between 0 and 1");if(r.pointType==="float_single")return o(r,r.points,i);{const s=[];for(let a=0;a<r.dimensions;a++){const A=[];for(let c=0;c<r.points.length;c++)A.push(r.points[c][a]);s.push(o(r,A,i))}return s}},o=function(i,r,s){const a=r.length-1;let A=0;for(let c=0;c<a;c++){const l=a*(r[c+1]-r[c]);A+=i.tangentPermutations[c]*Math.pow(1-s,a-1-c)*Math.pow(s,c)*l}return A};e.exports=n}}),_Ve=yt({"node_modules/@jscad/modeling/src/curves/bezier/lengths.js"(t,e){var n=Gin(),o=(r,s)=>{let a=0;const A=[0];let c=n(0,s);for(let l=1;l<=r;l++){const u=n(l/r,s);a+=i(u,c),A.push(a),c=u}return A},i=(r,s)=>{if(Number.isFinite(r)&&Number.isFinite(s))return Math.abs(r-s);if(Array.isArray(r)&&Array.isArray(s)){if(r.length!==s.length)throw new Error("The operands must have the same number of dimensions.");let a=0;for(let A=0;A<r.length;A++)a+=(s[A]-r[A])*(s[A]-r[A]);return Math.sqrt(a)}else throw new Error("The operands must be of the same type, either number or array.")};e.exports=o}}),Xdi=yt({"node_modules/@jscad/modeling/src/curves/bezier/length.js"(t,e){var n=_Ve(),o=(i,r)=>n(i,r)[i];e.exports=o}}),Zdi=yt({"node_modules/@jscad/modeling/src/curves/bezier/arcLengthToT.js"(t,e){var n=_Ve(),o=(i,r)=>{const s={distance:0,segments:100},{distance:a,segments:A}=Object.assign({},s,i),c=n(A,r);let l=0,u=A;for(;l<=u;){const _=Math.floor(l+(u-l)/2),f=c[_]-a;if(f<0)l=_+1;else if(f>0)u=_-1;else{u=_;break}}const g=u;if(c[g]===a)return g/A;const h=c[g],p=c[g+1]-h,m=(a-h)/p;return(g+m)/A};e.exports=o}}),ehi=yt({"node_modules/@jscad/modeling/src/curves/bezier/index.js"(t,e){e.exports={create:$di(),valueAt:Gin(),tangentAt:qdi(),lengths:_Ve(),length:Xdi(),arcLengthToT:Zdi()}}}),thi=yt({"node_modules/@jscad/modeling/src/curves/index.js"(t,e){e.exports={bezier:ehi()}}}),tpe=yt({"node_modules/@jscad/modeling/src/maths/utils/area.js"(t,e){var n=o=>{let i=0;for(let r=0;r<o.length;r++){const s=(r+1)%o.length;i+=o[r][0]*o[s][1],i-=o[s][0]*o[r][1]}return i/2};e.exports=n}}),Yin=yt({"node_modules/@jscad/modeling/src/geometries/poly2/measureArea.js"(t,e){var n=tpe(),o=i=>n(i.vertices);e.exports=o}}),Uin=yt({"node_modules/@jscad/modeling/src/geometries/poly2/create.js"(t,e){var n=o=>((o===void 0||o.length<3)&&(o=[]),{vertices:o});e.exports=n}}),Kin=yt({"node_modules/@jscad/modeling/src/geometries/poly2/flip.js"(t,e){var n=Uin(),o=i=>{const r=i.vertices.slice().reverse();return n(r)};e.exports=o}}),nhi=yt({"node_modules/@jscad/modeling/src/geometries/poly2/arePointsInside.js"(t,e){var n=Yin(),o=Kin(),i=(s,a)=>{if(s.length===0)return 0;const A=a.vertices;return A.length<3?0:(n(a)<0&&(a=o(a)),s.reduce((l,u)=>l+r(u,A),0)===s.length?1:0)},r=(s,a)=>{const A=a.length,c=s[0],l=s[1];let u=a[A-1],g=a[0],h=u[1]>l,d=0,p=0;for(let m=A+1;--m;){const _=g[1]>l;if(h!==_){const f=u[0]>c,I=g[0]>c;(f&&I||g[0]-(g[1]-l)*(u[0]-g[0])/(u[1]-g[1])>=c)&&(d=!d)}h=_,u=g,g=a[++p]}return d};e.exports=i}}),fVe=yt({"node_modules/@jscad/modeling/src/geometries/poly2/index.js"(t,e){e.exports={arePointsInside:nhi(),create:Uin(),flip:Kin(),measureArea:Yin()}}}),IVe=yt({"node_modules/@jscad/modeling/src/geometries/index.js"(t,e){e.exports={geom2:Ya(),geom3:Ta(),path2:Au(),poly2:fVe(),poly3:XA()}}}),CVe=yt({"node_modules/@jscad/modeling/src/maths/line2/create.js"(t,e){var n=()=>[0,1,0];e.exports=n}}),ohi=yt({"node_modules/@jscad/modeling/src/maths/line2/clone.js"(t,e){var n=CVe(),o=i=>{const r=n();return r[0]=i[0],r[1]=i[1],r[2]=i[2],r};e.exports=o}}),yVe=yt({"node_modules/@jscad/modeling/src/maths/line2/direction.js"(t,e){var n=_A(),o=i=>{const r=n.normal(n.create(),i);return n.negate(r,r),r};e.exports=o}}),npe=yt({"node_modules/@jscad/modeling/src/maths/line2/origin.js"(t,e){var n=_A(),o=i=>n.scale(n.create(),i,i[2]);e.exports=o}}),ihi=yt({"node_modules/@jscad/modeling/src/maths/line2/closestPoint.js"(t,e){var n=_A(),o=yVe(),i=npe(),r=(s,a)=>{const A=i(s),c=o(s),l=n.subtract(n.create(),a,A),u=n.dot(l,c);return n.scale(l,c,u),n.add(l,l,A),l};e.exports=r}}),Vin=yt({"node_modules/@jscad/modeling/src/maths/line2/copy.js"(t,e){var n=(o,i)=>(o[0]=i[0],o[1]=i[1],o[2]=i[2],o);e.exports=n}}),rhi=yt({"node_modules/@jscad/modeling/src/maths/line2/distanceToPoint.js"(t,e){var n=_A(),o=(i,r)=>{let s=n.dot(r,i);return s=Math.abs(s-i[2]),s};e.exports=o}}),shi=yt({"node_modules/@jscad/modeling/src/maths/line2/equals.js"(t,e){var n=(o,i)=>o[0]===i[0]&&o[1]===i[1]&&o[2]===i[2];e.exports=n}}),zin=yt({"node_modules/@jscad/modeling/src/maths/line2/fromPoints.js"(t,e){var n=_A(),o=(i,r,s)=>{const a=n.subtract(n.create(),s,r);n.normal(a,a),n.normalize(a,a);const A=n.dot(r,a);return i[0]=a[0],i[1]=a[1],i[2]=A,i};e.exports=o}}),Jin=yt({"node_modules/@jscad/modeling/src/maths/line2/fromValues.js"(t,e){var n=CVe(),o=(i,r,s)=>{const a=n();return a[0]=i,a[1]=r,a[2]=s,a};e.exports=o}}),xVe=yt({"node_modules/@jscad/modeling/src/maths/utils/aboutEqualNormals.js"(t,e){var{NEPS:n}=mc(),o=(i,r)=>Math.abs(i[0]-r[0])<=n&&Math.abs(i[1]-r[1])<=n&&Math.abs(i[2]-r[2])<=n;e.exports=o}}),Win=yt({"node_modules/@jscad/modeling/src/maths/utils/interpolateBetween2DPointsForY.js"(t,e){var n=(o,i,r)=>{let s=r-o[1],a=i[1]-o[1];a<0&&(s=-s,a=-a);let A;return s<=0?A=0:s>=a?A=1:a<1e-10?A=.5:A=s/a,o[0]+A*(i[0]-o[0])};e.exports=n}}),jin=yt({"node_modules/@jscad/modeling/src/maths/utils/intersect.js"(t,e){var n=(o,i,r,s)=>{if(o[0]===i[0]&&o[1]===i[1]||r[0]===s[0]&&r[1]===s[1])return;const a=(s[1]-r[1])*(i[0]-o[0])-(s[0]-r[0])*(i[1]-o[1]);if(Math.abs(a)<Number.MIN_VALUE)return;const A=((s[0]-r[0])*(o[1]-r[1])-(s[1]-r[1])*(o[0]-r[0]))/a,c=((i[0]-o[0])*(o[1]-r[1])-(i[1]-o[1])*(o[0]-r[0]))/a;if(A<0||A>1||c<0||c>1)return;const l=o[0]+A*(i[0]-o[0]),u=o[1]+A*(i[1]-o[1]);return[l,u]};e.exports=n}}),ahi=yt({"node_modules/@jscad/modeling/src/maths/utils/solve2Linear.js"(t,e){var n=(o,i,r,s,a,A)=>{const l=1/(o*s-i*r);let u=a*s-i*A,g=-a*r+o*A;return u*=l,g*=l,[u,g]};e.exports=n}}),QX=yt({"node_modules/@jscad/modeling/src/maths/utils/index.js"(t,e){e.exports={aboutEqualNormals:xVe(),area:tpe(),cos:hI().cos,interpolateBetween2DPointsForY:Win(),intersect:jin(),sin:hI().sin,solve2Linear:ahi()}}}),Ahi=yt({"node_modules/@jscad/modeling/src/maths/line2/intersectPointOfLines.js"(t,e){var n=_A(),{solve2Linear:o}=QX(),i=(r,s)=>{const a=o(r[0],r[1],s[0],s[1],r[2],s[2]);return n.clone(a)};e.exports=i}}),chi=yt({"node_modules/@jscad/modeling/src/maths/line2/reverse.js"(t,e){var n=_A(),o=Vin(),i=Jin(),r=(s,a)=>{const A=n.negate(n.create(),a),c=-a[2];return o(s,i(A[0],A[1],c))};e.exports=r}}),lhi=yt({"node_modules/@jscad/modeling/src/maths/line2/toString.js"(t,e){var n=o=>`line2: (${o[0].toFixed(7)}, ${o[1].toFixed(7)}, ${o[2].toFixed(7)})`;e.exports=n}}),uhi=yt({"node_modules/@jscad/modeling/src/maths/line2/transform.js"(t,e){var n=_A(),o=zin(),i=npe(),r=yVe(),s=(a,A,c)=>{const l=i(A),u=r(A);return n.transform(l,l,c),n.transform(u,u,c),o(a,l,u)};e.exports=s}}),ghi=yt({"node_modules/@jscad/modeling/src/maths/line2/xAtY.js"(t,e){var n=npe(),o=(i,r)=>{let s=(i[2]-i[1]*r)/i[0];return Number.isNaN(s)&&(s=n(i)[0]),s};e.exports=o}}),EVe=yt({"node_modules/@jscad/modeling/src/maths/line2/index.js"(t,e){e.exports={clone:ohi(),closestPoint:ihi(),copy:Vin(),create:CVe(),direction:yVe(),distanceToPoint:rhi(),equals:shi(),fromPoints:zin(),fromValues:Jin(),intersectPointOfLines:Ahi(),origin:npe(),reverse:chi(),toString:lhi(),transform:uhi(),xAtY:ghi()}}}),$in=yt({"node_modules/@jscad/modeling/src/maths/line3/create.js"(t,e){var n=$r(),o=()=>[n.fromValues(0,0,0),n.fromValues(0,0,1)];e.exports=o}}),dhi=yt({"node_modules/@jscad/modeling/src/maths/line3/clone.js"(t,e){var n=$r(),o=$in(),i=r=>{const s=o();return n.copy(s[0],r[0]),n.copy(s[1],r[1]),s};e.exports=i}}),qin=yt({"node_modules/@jscad/modeling/src/maths/line3/closestPoint.js"(t,e){var n=$r(),o=(i,r)=>{const s=i[0],a=i[1],A=n.dot(n.subtract(n.create(),r,s),a),c=n.dot(a,a),l=A/c,u=n.scale(n.create(),a,l);return n.add(u,u,s),u};e.exports=o}}),hhi=yt({"node_modules/@jscad/modeling/src/maths/line3/copy.js"(t,e){var n=$r(),o=(i,r)=>(n.copy(i[0],r[0]),n.copy(i[1],r[1]),i);e.exports=o}}),phi=yt({"node_modules/@jscad/modeling/src/maths/line3/direction.js"(t,e){var n=o=>o[1];e.exports=n}}),mhi=yt({"node_modules/@jscad/modeling/src/maths/line3/distanceToPoint.js"(t,e){var n=$r(),o=qin(),i=(r,s)=>{const a=o(r,s),A=n.subtract(n.create(),s,a);return n.length(A)};e.exports=i}}),_hi=yt({"node_modules/@jscad/modeling/src/maths/line3/equals.js"(t,e){var n=$r(),o=(i,r)=>!(!n.equals(i[1],r[1])||!n.equals(i[0],r[0]));e.exports=o}}),vX=yt({"node_modules/@jscad/modeling/src/maths/line3/fromPointAndDirection.js"(t,e){var n=$r(),o=(i,r,s)=>{const a=n.normalize(n.create(),s);return n.copy(i[0],r),n.copy(i[1],a),i};e.exports=o}}),fhi=yt({"node_modules/@jscad/modeling/src/maths/line3/fromPlanes.js"(t,e){var n=$r(),{solve2Linear:o}=QX(),{EPS:i}=mc(),r=vX(),s=(a,A,c)=>{let l=n.cross(n.create(),A,c),u=n.length(l);if(u<i)throw new Error("parallel planes do not intersect");u=1/u,l=n.scale(l,l,u);const g=Math.abs(l[0]),h=Math.abs(l[1]),d=Math.abs(l[2]);let p,m;return g>=h&&g>=d?(m=o(A[1],A[2],c[1],c[2],A[3],c[3]),p=n.fromValues(0,m[0],m[1])):h>=g&&h>=d?(m=o(A[0],A[2],c[0],c[2],A[3],c[3]),p=n.fromValues(m[0],0,m[1])):(m=o(A[0],A[1],c[0],c[1],A[3],c[3]),p=n.fromValues(m[0],m[1],0)),r(a,p,l)};e.exports=s}}),Ihi=yt({"node_modules/@jscad/modeling/src/maths/line3/fromPoints.js"(t,e){var n=$r(),o=vX(),i=(r,s,a)=>{const A=n.subtract(n.create(),a,s);return o(r,s,A)};e.exports=i}}),Chi=yt({"node_modules/@jscad/modeling/src/maths/line3/intersectPointOfLineAndPlane.js"(t,e){var n=$r(),o=(i,r)=>{const s=r,a=r[3],A=i[0],c=i[1],l=(a-n.dot(s,A))/n.dot(s,c);return n.add(n.create(),A,n.scale(n.create(),c,l))};e.exports=o}}),yhi=yt({"node_modules/@jscad/modeling/src/maths/line3/origin.js"(t,e){var n=o=>o[0];e.exports=n}}),xhi=yt({"node_modules/@jscad/modeling/src/maths/line3/reverse.js"(t,e){var n=$r(),o=vX(),i=(r,s)=>{const a=n.clone(s[0]),A=n.negate(n.create(),s[1]);return o(r,a,A)};e.exports=i}}),Ehi=yt({"node_modules/@jscad/modeling/src/maths/line3/toString.js"(t,e){var n=o=>{const i=o[0],r=o[1];return`line3: point: (${i[0].toFixed(7)}, ${i[1].toFixed(7)}, ${i[2].toFixed(7)}) direction: (${r[0].toFixed(7)}, ${r[1].toFixed(7)}, ${r[2].toFixed(7)})`};e.exports=n}}),Bhi=yt({"node_modules/@jscad/modeling/src/maths/line3/transform.js"(t,e){var n=$r(),o=vX(),i=(r,s,a)=>{const A=s[0],c=s[1],l=n.add(n.create(),A,c),u=n.transform(n.create(),A,a),g=n.transform(l,l,a),h=n.subtract(g,g,u);return o(r,u,h)};e.exports=i}}),bhi=yt({"node_modules/@jscad/modeling/src/maths/line3/index.js"(t,e){e.exports={clone:dhi(),closestPoint:qin(),copy:hhi(),create:$in(),direction:phi(),distanceToPoint:mhi(),equals:_hi(),fromPlanes:fhi(),fromPointAndDirection:vX(),fromPoints:Ihi(),intersectPointOfLineAndPlane:Chi(),origin:yhi(),reverse:xhi(),toString:Ehi(),transform:Bhi()}}}),Shi=yt({"node_modules/@jscad/modeling/src/maths/index.js"(t,e){e.exports={constants:mc(),line2:EVe(),line3:bhi(),mat4:Du(),plane:S6(),utils:QX(),vec2:_A(),vec3:$r(),vec4:Rin()}}}),Xin=yt({"node_modules/@jscad/modeling/src/measurements/measureArea.js"(t,e){var n=ga(),o=Ya(),i=Ta(),r=Au(),s=XA(),a=new WeakMap,A=()=>0,c=g=>{let h=a.get(g);return h||(h=o.toSides(g).reduce((p,m)=>p+(m[0][0]*m[1][1]-m[0][1]*m[1][0]),0),h*=.5,a.set(g,h),h)},l=g=>{let h=a.get(g);return h||(h=i.toPolygons(g).reduce((p,m)=>p+s.measureArea(m),0),a.set(g,h),h)},u=(...g)=>{if(g=n(g),g.length===0)throw new Error("wrong number of arguments");const h=g.map(d=>r.isA(d)?A():o.isA(d)?c(d):i.isA(d)?l(d):0);return h.length===1?h[0]:h};e.exports=u}}),Qhi=yt({"node_modules/@jscad/modeling/src/measurements/measureAggregateArea.js"(t,e){var n=ga(),o=Xin(),i=(...r)=>{if(r=n(r),r.length===0)throw new Error("measureAggregateArea: no geometries supplied");const s=o(r);return r.length===1?s:s.reduce((A,c)=>A+c,0)};e.exports=i}}),oT=yt({"node_modules/@jscad/modeling/src/measurements/measureBoundingBox.js"(t,e){var n=ga(),o=_A(),i=$r(),r=Ya(),s=Ta(),a=Au(),A=XA(),c=new WeakMap,l=d=>{let p=c.get(d);if(p)return p;const m=a.toPoints(d);let _;m.length===0?_=o.create():_=o.clone(m[0]);let f=o.clone(_);return m.forEach(I=>{o.min(_,_,I),o.max(f,f,I)}),_=[_[0],_[1],0],f=[f[0],f[1],0],p=[_,f],c.set(d,p),p},u=d=>{let p=c.get(d);if(p)return p;const m=r.toPoints(d);let _;m.length===0?_=o.create():_=o.clone(m[0]);let f=o.clone(_);return m.forEach(I=>{o.min(_,_,I),o.max(f,f,I)}),_=[_[0],_[1],0],f=[f[0],f[1],0],p=[_,f],c.set(d,p),p},g=d=>{let p=c.get(d);if(p)return p;const m=s.toPolygons(d);let _=i.create();if(m.length>0){const I=A.toPoints(m[0]);i.copy(_,I[0])}let f=i.clone(_);return m.forEach(I=>{A.toPoints(I).forEach(C=>{i.min(_,_,C),i.max(f,f,C)})}),_=[_[0],_[1],_[2]],f=[f[0],f[1],f[2]],p=[_,f],c.set(d,p),p},h=(...d)=>{if(d=n(d),d.length===0)throw new Error("wrong number of arguments");const p=d.map(m=>a.isA(m)?l(m):r.isA(m)?u(m):s.isA(m)?g(m):[[0,0,0],[0,0,0]]);return p.length===1?p[0]:p};e.exports=h}}),BVe=yt({"node_modules/@jscad/modeling/src/measurements/measureAggregateBoundingBox.js"(t,e){var n=ga(),o=gin(),i=uin(),r=oT(),s=(...a)=>{if(a=n(a),a.length===0)throw new Error("measureAggregateBoundingBox: no geometries supplied");const A=r(a);if(a.length===1)return A;const c=[[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],[-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE]];return A.reduce((l,u)=>(l=[o(l[0],l[0],u[0]),i(l[1],l[1],u[1])],l),c)};e.exports=s}}),Zin=yt({"node_modules/@jscad/modeling/src/measurements/calculateEpsilonFromBounds.js"(t,e){var{EPS:n}=mc(),o=(i,r)=>{let s=0;for(let a=0;a<r;a++)s+=i[1][a]-i[0][a];return n*s/r};e.exports=o}}),vhi=yt({"node_modules/@jscad/modeling/src/measurements/measureAggregateEpsilon.js"(t,e){var n=ga(),o=BVe(),i=Zin(),{geom2:r,geom3:s,path2:a}=IVe(),A=(...c)=>{if(c=n(c),c.length===0)throw new Error("measureAggregateEpsilon: no geometries supplied");const l=o(c);let u=0;return u=c.reduce((g,h)=>a.isA(h)||r.isA(h)?Math.max(g,2):s.isA(h)?Math.max(g,3):0,u),i(l,u)};e.exports=A}}),ern=yt({"node_modules/@jscad/modeling/src/measurements/measureVolume.js"(t,e){var n=ga(),o=Ya(),i=Ta(),r=Au(),s=XA(),a=new WeakMap,A=()=>0,c=()=>0,l=g=>{let h=a.get(g);return h||(h=i.toPolygons(g).reduce((p,m)=>p+s.measureSignedVolume(m),0),a.set(g,h),h)},u=(...g)=>{if(g=n(g),g.length===0)throw new Error("wrong number of arguments");const h=g.map(d=>r.isA(d)?A():o.isA(d)?c():i.isA(d)?l(d):0);return h.length===1?h[0]:h};e.exports=u}}),whi=yt({"node_modules/@jscad/modeling/src/measurements/measureAggregateVolume.js"(t,e){var n=ga(),o=ern(),i=(...r)=>{if(r=n(r),r.length===0)throw new Error("measureAggregateVolume: no geometries supplied");const s=o(r);return r.length===1?s:s.reduce((A,c)=>A+c,0)};e.exports=i}}),Phi=yt({"node_modules/@jscad/modeling/src/measurements/measureBoundingSphere.js"(t,e){var n=ga(),o=_A(),i=$r(),r=Ya(),s=Ta(),a=Au(),A=XA(),c=new WeakMap,l=d=>{let p=c.get(d);if(p!==void 0)return p;const m=i.create();let _=0;const f=a.toPoints(d);if(f.length>0){let I=0;const C=i.create();f.forEach(y=>{i.add(m,m,i.fromVec2(C,y,0)),I++}),i.scale(m,m,1/I),f.forEach(y=>{_=Math.max(_,o.squaredDistance(m,y))}),_=Math.sqrt(_)}return p=[m,_],c.set(d,p),p},u=d=>{let p=c.get(d);if(p!==void 0)return p;const m=i.create();let _=0;const f=r.toSides(d);if(f.length>0){let I=0;const C=i.create();f.forEach(y=>{i.add(m,m,i.fromVec2(C,y[0],0)),I++}),i.scale(m,m,1/I),f.forEach(y=>{_=Math.max(_,o.squaredDistance(m,y[0]))}),_=Math.sqrt(_)}return p=[m,_],c.set(d,p),p},g=d=>{let p=c.get(d);if(p!==void 0)return p;const m=i.create();let _=0;const f=s.toPolygons(d);if(f.length>0){let I=0;f.forEach(C=>{A.toPoints(C).forEach(y=>{i.add(m,m,y),I++})}),i.scale(m,m,1/I),f.forEach(C=>{A.toPoints(C).forEach(y=>{_=Math.max(_,i.squaredDistance(m,y))})}),_=Math.sqrt(_)}return p=[m,_],c.set(d,p),p},h=(...d)=>{d=n(d);const p=d.map(m=>a.isA(m)?l(m):r.isA(m)?u(m):s.isA(m)?g(m):[[0,0,0],0]);return p.length===1?p[0]:p};e.exports=h}}),Mhi=yt({"node_modules/@jscad/modeling/src/measurements/measureCenter.js"(t,e){var n=ga(),o=oT(),i=(...r)=>{r=n(r);const s=r.map(a=>{const A=o(a);return[A[0][0]+(A[1][0]-A[0][0])/2,A[0][1]+(A[1][1]-A[0][1])/2,A[0][2]+(A[1][2]-A[0][2])/2]});return s.length===1?s[0]:s};e.exports=i}}),Dhi=yt({"node_modules/@jscad/modeling/src/measurements/measureCenterOfMass.js"(t,e){var n=ga(),o=$r(),i=Ya(),r=Ta(),s=new WeakMap,a=l=>{let u=s.get(l);if(u!==void 0)return u;const g=i.toSides(l);let h=0,d=0,p=0;if(g.length>0){for(let _=0;_<g.length;_++){const f=g[_][0],I=g[_][1],C=f[0]*I[1]-f[1]*I[0];h+=C,d+=(f[0]+I[0])*C,p+=(f[1]+I[1])*C}h/=2;const m=1/(h*6);d*=m,p*=m}return u=o.fromValues(d,p,0),s.set(l,u),u},A=l=>{let u=s.get(l);if(u!==void 0)return u;u=o.create();const g=r.toPolygons(l);if(g.length===0)return u;let h=0;const d=o.create();return g.forEach(p=>{const m=p.vertices;for(let _=0;_<m.length-2;_++){o.cross(d,m[_+1],m[_+2]);const f=o.dot(m[0],d)/6;h+=f,o.add(d,m[0],m[_+1]),o.add(d,d,m[_+2]);const I=o.scale(d,d,1/4*f);o.add(u,u,I)}}),o.scale(u,u,1/h),s.set(l,u),u},c=(...l)=>{l=n(l);const u=l.map(g=>i.isA(g)?a(g):r.isA(g)?A(g):[0,0,0]);return u.length===1?u[0]:u};e.exports=c}}),Nhi=yt({"node_modules/@jscad/modeling/src/measurements/measureDimensions.js"(t,e){var n=ga(),o=oT(),i=(...r)=>{r=n(r);const s=r.map(a=>{const A=o(a);return[A[1][0]-A[0][0],A[1][1]-A[0][1],A[1][2]-A[0][2]]});return s.length===1?s[0]:s};e.exports=i}}),gP=yt({"node_modules/@jscad/modeling/src/measurements/measureEpsilon.js"(t,e){var n=ga(),{geom2:o,geom3:i,path2:r}=IVe(),s=Zin(),a=oT(),A=g=>s(a(g),2),c=g=>s(a(g),2),l=g=>s(a(g),3),u=(...g)=>{if(g=n(g),g.length===0)throw new Error("wrong number of arguments");const h=g.map(d=>r.isA(d)?A(d):o.isA(d)?c(d):i.isA(d)?l(d):0);return h.length===1?h[0]:h};e.exports=u}}),Rhi=yt({"node_modules/@jscad/modeling/src/measurements/index.js"(t,e){e.exports={measureAggregateArea:Qhi(),measureAggregateBoundingBox:BVe(),measureAggregateEpsilon:vhi(),measureAggregateVolume:whi(),measureArea:Xin(),measureBoundingBox:oT(),measureBoundingSphere:Phi(),measureCenter:Mhi(),measureCenterOfMass:Dhi(),measureDimensions:Nhi(),measureEpsilon:gP(),measureVolume:ern()}}}),lf=yt({"node_modules/@jscad/modeling/src/primitives/commonChecks.js"(t,e){var n=(r,s)=>Array.isArray(r)&&r.length>=s?r.every(a=>Number.isFinite(a)):!1,o=(r,s)=>Number.isFinite(r)&&r>s,i=(r,s)=>Number.isFinite(r)&&r>=s;e.exports={isNumberArray:n,isGT:o,isGTE:i}}}),Thi=yt({"node_modules/@jscad/modeling/src/primitives/arc.js"(t,e){var{EPS:n,TAU:o}=mc(),i=_A(),r=Au(),{isGT:s,isGTE:a,isNumberArray:A}=lf(),c=l=>{const u={center:[0,0],radius:1,startAngle:0,endAngle:o,makeTangent:!1,segments:32};let{center:g,radius:h,startAngle:d,endAngle:p,makeTangent:m,segments:_}=Object.assign({},u,l);if(!A(g,2))throw new Error("center must be an array of X and Y values");if(!s(h,0))throw new Error("radius must be greater than zero");if(!a(d,0))throw new Error("startAngle must be positive");if(!a(p,0))throw new Error("endAngle must be positive");if(!a(_,4))throw new Error("segments must be four or more");d=d%o,p=p%o;let f=o;d<p&&(f=p-d),d>p&&(f=p+(o-d));const I=Math.acos((h*h+h*h-n*n)/(2*h*h)),C=i.clone(g);let y;const x=[];if(f<I)y=i.fromAngleRadians(i.create(),d),i.scale(y,y,h),i.add(y,y,C),x.push(y);else{const E=Math.floor(_*(Math.abs(f)/o));let B=E*.5/f;B>.25&&(B=.25);const S=m?E+2:E;for(let Q=0;Q<=S;Q++){let w=Q;m&&(w=(Q-1)*(E-2*B)/E+B,w<0&&(w=0),w>E&&(w=E));const M=d+w*(f/E);y=i.fromAngleRadians(i.create(),M),i.scale(y,y,h),i.add(y,y,C),x.push(y)}}return r.fromPoints({closed:!1},x)};e.exports=c}}),trn=yt({"node_modules/@jscad/modeling/src/primitives/ellipse.js"(t,e){var{EPS:n,TAU:o}=mc(),i=_A(),r=Ya(),{sin:s,cos:a}=hI(),{isGTE:A,isNumberArray:c}=lf(),l=u=>{const g={center:[0,0],radius:[1,1],startAngle:0,endAngle:o,segments:32};let{center:h,radius:d,startAngle:p,endAngle:m,segments:_}=Object.assign({},g,u);if(!c(h,2))throw new Error("center must be an array of X and Y values");if(!c(d,2))throw new Error("radius must be an array of X and Y values");if(!d.every(B=>B>=0))throw new Error("radius values must be positive");if(!A(p,0))throw new Error("startAngle must be positive");if(!A(m,0))throw new Error("endAngle must be positive");if(!A(_,3))throw new Error("segments must be three or more");if(d[0]===0||d[1]===0)return r.create();p=p%o,m=m%o;let f=o;p<m&&(f=m-p),p>m&&(f=m+(o-p));const I=Math.min(d[0],d[1]),C=Math.acos((I*I+I*I-n*n)/(2*I*I));if(f<C)throw new Error("startAngle and endAngle do not define a significant rotation");_=Math.floor(_*(f/o));const y=i.clone(h),x=f/_,E=[];_=f<o?_+1:_;for(let B=0;B<_;B++){const S=x*B+p,Q=i.fromValues(d[0]*a(S),d[1]*s(S));i.add(Q,y,Q),E.push(Q)}return f<o&&E.push(y),r.fromPoints(E)};e.exports=l}}),nrn=yt({"node_modules/@jscad/modeling/src/primitives/circle.js"(t,e){var{TAU:n}=mc(),o=trn(),{isGTE:i}=lf(),r=s=>{const a={center:[0,0],radius:1,startAngle:0,endAngle:n,segments:32};let{center:A,radius:c,startAngle:l,endAngle:u,segments:g}=Object.assign({},a,s);if(!i(c,0))throw new Error("radius must be positive");return c=[c,c],o({center:A,radius:c,startAngle:l,endAngle:u,segments:g})};e.exports=r}}),bVe=yt({"node_modules/@jscad/modeling/src/primitives/cuboid.js"(t,e){var n=Ta(),o=XA(),{isNumberArray:i}=lf(),r=s=>{const a={center:[0,0,0],size:[2,2,2]},{center:A,size:c}=Object.assign({},a,s);if(!i(A,3))throw new Error("center must be an array of X, Y and Z values");if(!i(c,3))throw new Error("size must be an array of width, depth and height values");if(!c.every(u=>u>=0))throw new Error("size values must be positive");return c[0]===0||c[1]===0||c[2]===0?n.create():n.create([[[0,4,6,2],[-1,0,0]],[[1,3,7,5],[1,0,0]],[[0,1,5,4],[0,-1,0]],[[2,6,7,3],[0,1,0]],[[0,2,3,1],[0,0,-1]],[[4,5,7,6],[0,0,1]]].map(u=>{const g=u[0].map(h=>[A[0]+c[0]/2*(2*!!(h&1)-1),A[1]+c[1]/2*(2*!!(h&2)-1),A[2]+c[2]/2*(2*!!(h&4)-1)]);return o.create(g)}))};e.exports=r}}),khi=yt({"node_modules/@jscad/modeling/src/primitives/cube.js"(t,e){var n=bVe(),{isGTE:o}=lf(),i=r=>{const s={center:[0,0,0],size:2};let{center:a,size:A}=Object.assign({},s,r);if(!o(A,0))throw new Error("size must be positive");return A=[A,A,A],n({center:a,size:A})};e.exports=i}}),orn=yt({"node_modules/@jscad/modeling/src/primitives/cylinderElliptic.js"(t,e){var{EPS:n,TAU:o}=mc(),i=$r(),r=Ta(),s=XA(),{sin:a,cos:A}=hI(),{isGT:c,isGTE:l,isNumberArray:u}=lf(),g=h=>{const d={center:[0,0,0],height:2,startRadius:[1,1],startAngle:0,endRadius:[1,1],endAngle:o,segments:32};let{center:p,height:m,startRadius:_,startAngle:f,endRadius:I,endAngle:C,segments:y}=Object.assign({},d,h);if(!u(p,3))throw new Error("center must be an array of X, Y and Z values");if(!c(m,0))throw new Error("height must be greater then zero");if(!u(_,2))throw new Error("startRadius must be an array of X and Y values");if(!_.every(J=>J>=0))throw new Error("startRadius values must be positive");if(!u(I,2))throw new Error("endRadius must be an array of X and Y values");if(!I.every(J=>J>=0))throw new Error("endRadius values must be positive");if(I.every(J=>J===0)&&_.every(J=>J===0))throw new Error("at least one radius must be positive");if(!l(f,0))throw new Error("startAngle must be positive");if(!l(C,0))throw new Error("endAngle must be positive");if(!l(y,4))throw new Error("segments must be four or more");f=f%o,C=C%o;let x=o;f<C&&(x=C-f),f>C&&(x=C+(o-f));const E=Math.min(_[0],_[1],I[0],I[1]),B=Math.acos((E*E+E*E-n*n)/(2*E*E));if(x<B)throw new Error("startAngle and endAngle do not define a significant rotation");const S=Math.floor(y*(x/o)),Q=i.fromValues(0,0,-(m/2)),w=i.fromValues(0,0,m/2),M=i.subtract(i.create(),w,Q),k=i.fromValues(1,0,0),R=i.fromValues(0,1,0),F=i.create(),O=i.create(),U=i.create(),Y=(J,oe,ie)=>{const ne=oe*x+f;return i.scale(F,k,ie[0]*A(ne)),i.scale(O,R,ie[1]*a(ne)),i.add(F,F,O),i.scale(U,M,J),i.add(U,U,Q),i.add(i.create(),F,U)},W=(...J)=>{const oe=J.map(ie=>i.add(i.create(),ie,p));return s.create(oe)},te=[];for(let J=0;J<S;J++){const oe=J/S;let ie=(J+1)/S;x===o&&J===S-1&&(ie=0),I[0]===_[0]&&I[1]===_[1]?(te.push(W(Q,Y(0,ie,I),Y(0,oe,I))),te.push(W(Y(0,ie,I),Y(1,ie,I),Y(1,oe,I),Y(0,oe,I))),te.push(W(w,Y(1,oe,I),Y(1,ie,I)))):(_[0]>0&&_[1]>0&&te.push(W(Q,Y(0,ie,_),Y(0,oe,_))),(_[0]>0||_[1]>0)&&te.push(W(Y(0,oe,_),Y(0,ie,_),Y(1,oe,I))),I[0]>0&&I[1]>0&&te.push(W(w,Y(1,oe,I),Y(1,ie,I))),(I[0]>0||I[1]>0)&&te.push(W(Y(1,oe,I),Y(0,ie,_),Y(1,ie,I))))}return x<o&&(te.push(W(Q,Y(0,0,_),w)),te.push(W(Y(0,0,_),Y(1,0,I),w)),te.push(W(Q,w,Y(0,1,_))),te.push(W(Y(0,1,_),w,Y(1,1,I)))),r.create(te)};e.exports=g}}),irn=yt({"node_modules/@jscad/modeling/src/primitives/cylinder.js"(t,e){var n=Ta(),o=orn(),{isGTE:i}=lf(),r=s=>{const a={center:[0,0,0],height:2,radius:1,segments:32},{center:A,height:c,radius:l,segments:u}=Object.assign({},a,s);if(!i(l,0))throw new Error("radius must be positive");return c===0||l===0?n.create():o({center:A,height:c,startRadius:[l,l],endRadius:[l,l],segments:u})};e.exports=r}}),rrn=yt({"node_modules/@jscad/modeling/src/primitives/ellipsoid.js"(t,e){var{TAU:n}=mc(),o=$r(),i=Ta(),r=XA(),{sin:s,cos:a}=hI(),{isGTE:A,isNumberArray:c}=lf(),l=u=>{const g={center:[0,0,0],radius:[1,1,1],segments:32,axes:[[1,0,0],[0,-1,0],[0,0,1]]},{center:h,radius:d,segments:p,axes:m}=Object.assign({},g,u);if(!c(h,3))throw new Error("center must be an array of X, Y and Z values");if(!c(d,3))throw new Error("radius must be an array of X, Y and Z values");if(!d.every(S=>S>=0))throw new Error("radius values must be positive");if(!A(p,4))throw new Error("segments must be four or more");if(d[0]===0||d[1]===0||d[2]===0)return i.create();const _=o.scale(o.create(),o.normalize(o.create(),m[0]),d[0]),f=o.scale(o.create(),o.normalize(o.create(),m[1]),d[1]),I=o.scale(o.create(),o.normalize(o.create(),m[2]),d[2]),C=Math.round(p/4);let y;const x=[],E=o.create(),B=o.create();for(let S=0;S<=p;S++){const Q=n*S/p,w=o.add(o.create(),o.scale(E,_,a(Q)),o.scale(B,f,s(Q)));if(S>0){let M,k;for(let R=0;R<=C;R++){const F=n/4*R/C,O=a(F),U=s(F);if(R>0){let Y=[],W;W=o.subtract(o.create(),o.scale(E,y,M),o.scale(B,I,k)),Y.push(o.add(W,W,h)),W=o.subtract(o.create(),o.scale(E,w,M),o.scale(B,I,k)),Y.push(o.add(W,W,h)),R<C&&(W=o.subtract(o.create(),o.scale(E,w,O),o.scale(B,I,U)),Y.push(o.add(W,W,h))),W=o.subtract(o.create(),o.scale(E,y,O),o.scale(B,I,U)),Y.push(o.add(W,W,h)),x.push(r.create(Y)),Y=[],W=o.add(o.create(),o.scale(E,y,M),o.scale(B,I,k)),Y.push(o.add(o.create(),h,W)),W=o.add(W,o.scale(E,w,M),o.scale(B,I,k)),Y.push(o.add(o.create(),h,W)),R<C&&(W=o.add(W,o.scale(E,w,O),o.scale(B,I,U)),Y.push(o.add(o.create(),h,W))),W=o.add(W,o.scale(E,y,O),o.scale(B,I,U)),Y.push(o.add(o.create(),h,W)),Y.reverse(),x.push(r.create(Y))}M=O,k=U}}y=w}return i.create(x)};e.exports=l}}),srn=yt({"node_modules/@jscad/modeling/src/primitives/polyhedron.js"(t,e){var n=Ta(),o=XA(),{isNumberArray:i}=lf(),r=s=>{const a={points:[],faces:[],colors:void 0,orientation:"outward"},{points:A,faces:c,colors:l,orientation:u}=Object.assign({},a,s);if(!(Array.isArray(A)&&Array.isArray(c)))throw new Error("points and faces must be arrays");if(A.length<3)throw new Error("three or more points are required");if(c.length<1)throw new Error("one or more faces are required");if(l){if(!Array.isArray(l))throw new Error("colors must be an array");if(l.length!==c.length)throw new Error("faces and colors must have the same length")}A.forEach((h,d)=>{if(!i(h,3))throw new Error(`point ${d} must be an array of X, Y, Z values`)}),c.forEach((h,d)=>{if(h.length<3)throw new Error(`face ${d} must contain 3 or more indexes`);if(!i(h,h.length))throw new Error(`face ${d} must be an array of numbers`)}),u!=="outward"&&c.forEach(h=>h.reverse());const g=c.map((h,d)=>{const p=o.create(h.map(m=>A[m]));return l&&l[d]&&(p.color=l[d]),p});return n.create(g)};e.exports=r}}),Fhi=yt({"node_modules/@jscad/modeling/src/primitives/geodesicSphere.js"(t,e){var n=Du(),o=$r(),i=Ta(),r=srn(),{isGTE:s}=lf(),a=A=>{const c={radius:1,frequency:6};let{radius:l,frequency:u}=Object.assign({},c,A);if(!s(l,0))throw new Error("radius must be positive");if(!s(u,6))throw new Error("frequency must be six or more");if(l===0)return i.create();u=Math.floor(u/6);const g=[[.850651,0,-.525731],[.850651,-0,.525731],[-.850651,-0,.525731],[-.850651,0,-.525731],[0,-.525731,.850651],[0,.525731,.850651],[0,.525731,-.850651],[0,-.525731,-.850651],[-.525731,-.850651,-0],[.525731,-.850651,-0],[.525731,.850651,0],[-.525731,.850651,0]],h=[[0,9,1],[1,10,0],[6,7,0],[10,6,0],[7,9,0],[5,1,4],[4,1,9],[5,10,1],[2,8,3],[3,11,2],[2,5,4],[4,8,2],[2,11,5],[3,7,6],[6,11,3],[8,7,3],[9,8,4],[11,10,5],[10,11,6],[8,9,7]],d=(C,y,x)=>{const E=C[0],B=C[1],S=C[2];let Q=x;const w=[],M=[];for(let k=0;k<y;k++)for(let R=0;R<y-k;R++){const F=k/y,O=(k+1)/y,U=R/(y-k),Y=(R+1)/(y-k),W=y-k-1?R/(y-k-1):1,te=[];te[0]=p(p(E,B,U),S,F),te[1]=p(p(E,B,Y),S,F),te[2]=p(p(E,B,W),S,O);for(let j=0;j<3;j++){const J=o.length(te[j]);for(let oe=0;oe<3;oe++)te[j][oe]/=J}if(w.push(te[0],te[1],te[2]),M.push([Q,Q+1,Q+2]),Q+=3,R<y-k-1){const j=y-k-1?(R+1)/(y-k-1):1;te[0]=p(p(E,B,Y),S,F),te[1]=p(p(E,B,j),S,O),te[2]=p(p(E,B,W),S,O);for(let J=0;J<3;J++){const oe=o.length(te[J]);for(let ie=0;ie<3;ie++)te[J][ie]/=oe}w.push(te[0],te[1],te[2]),M.push([Q,Q+1,Q+2]),Q+=3}}return{points:w,triangles:M,offset:Q}},p=(C,y,x)=>{const E=1-x,B=[];for(let S=0;S<3;S++)B[S]=C[S]*E+y[S]*x;return B};let m=[],_=[],f=0;for(let C=0;C<h.length;C++){const y=d([g[h[C][0]],g[h[C][1]],g[h[C][2]]],u,f);m=m.concat(y.points),_=_.concat(y.triangles),f=y.offset}let I=r({points:m,faces:_,orientation:"inward"});return l!==1&&(I=i.transform(n.fromScaling(n.create(),[l,l,l]),I)),I};e.exports=a}}),Lhi=yt({"node_modules/@jscad/modeling/src/primitives/line.js"(t,e){var n=Au(),o=i=>{if(!Array.isArray(i))throw new Error("points must be an array");return n.fromPoints({},i)};e.exports=o}}),Hhi=yt({"node_modules/@jscad/modeling/src/primitives/polygon.js"(t,e){var n=Ya(),o=i=>{const r={points:[],paths:[],orientation:"counterclockwise"},{points:s,paths:a,orientation:A}=Object.assign({},r,i);if(!(Array.isArray(s)&&Array.isArray(a)))throw new Error("points and paths must be arrays");let c=s;Array.isArray(s[0])&&(Array.isArray(s[0][0])||(c=[s])),c.forEach((d,p)=>{if(!Array.isArray(d))throw new Error("list of points "+p+" must be an array");if(d.length<3)throw new Error("list of points "+p+" must contain three or more points");d.forEach((m,_)=>{if(!Array.isArray(m))throw new Error("list of points "+p+", point "+_+" must be an array");if(m.length<2)throw new Error("list of points "+p+", point "+_+" must contain by X and Y values")})});let l=a;if(a.length===0){let d=0;l=c.map(p=>p.map(m=>d++))}const u=[];c.forEach(d=>d.forEach(p=>u.push(p)));let g=[];l.forEach(d=>{const p=d.map(_=>u[_]),m=n.fromPoints(p);g=g.concat(n.toSides(m))});let h=n.create(g);return A==="clockwise"&&(h=n.reverse(h)),h};e.exports=o}}),SVe=yt({"node_modules/@jscad/modeling/src/primitives/rectangle.js"(t,e){var n=_A(),o=Ya(),{isNumberArray:i}=lf(),r=s=>{const a={center:[0,0],size:[2,2]},{center:A,size:c}=Object.assign({},a,s);if(!i(A,2))throw new Error("center must be an array of X and Y values");if(!i(c,2))throw new Error("size must be an array of X and Y values");if(!c.every(h=>h>=0))throw new Error("size values must be positive");if(c[0]===0||c[1]===0)return o.create();const l=[c[0]/2,c[1]/2],u=[l[0],-l[1]],g=[n.subtract(n.create(),A,l),n.add(n.create(),A,u),n.add(n.create(),A,l),n.subtract(n.create(),A,u)];return o.fromPoints(g)};e.exports=r}}),Ohi=yt({"node_modules/@jscad/modeling/src/primitives/roundedCuboid.js"(t,e){var{EPS:n,TAU:o}=mc(),i=_A(),r=$r(),s=Ta(),a=XA(),{sin:A,cos:c}=hI(),{isGTE:l,isNumberArray:u}=lf(),g=bVe(),h=(f,I,C,y,x,E)=>{const B=o/4*x/y,S=c(B),Q=A(B),w=y-x;let M=C*S,k=I[2]-(C-C*Q);E||(k=C-C*Q-I[2]),M=M>n?M:0;const R=r.add(r.create(),f,[I[0]-C,I[1]-C,k]),F=r.add(r.create(),f,[C-I[0],I[1]-C,k]),O=r.add(r.create(),f,[C-I[0],C-I[1],k]),U=r.add(r.create(),f,[I[0]-C,C-I[1],k]),Y=[],W=[],te=[],j=[];for(let J=0;J<=w;J++){const oe=w>0?o/4*J/w:0,ie=i.fromAngleRadians(i.create(),oe);i.scale(ie,ie,M);const ne=r.fromVec2(r.create(),ie);Y.push(r.add(r.create(),R,ne)),r.rotateZ(ne,ne,[0,0,0],o/4),W.push(r.add(r.create(),F,ne)),r.rotateZ(ne,ne,[0,0,0],o/4),te.push(r.add(r.create(),O,ne)),r.rotateZ(ne,ne,[0,0,0],o/4),j.push(r.add(r.create(),U,ne))}return E?[Y,W,te,j]:(Y.reverse(),W.reverse(),te.reverse(),j.reverse(),[j,te,W,Y])},d=(f,I)=>{const C=[];for(let y=0;y<f.length;y++){const x=f[y],E=I[y];for(let B=0;B<x.length-1;B++)C.push(a.create([x[B],x[B+1],E[B]])),B<E.length-1&&C.push(a.create([E[B],x[B+1],E[B+1]]))}return C},p=(f,I)=>{const C=[];for(let y=0;y<f.length;y++){let x=f[y],E=I[y];const B=x[x.length-1],S=E[E.length-1],Q=(y+1)%f.length;x=f[Q],E=I[Q];const w=x[0],M=E[0];C.push(a.create([B,w,M,S]))}return C},m=(f,I)=>{f=[f[3],f[2],f[1],f[0]],f=f.map(E=>E.slice().reverse());const C=[];f.forEach(E=>{E.forEach(B=>C.push(B))});const y=[];I.forEach(E=>{E.forEach(B=>y.push(B))});const x=[];for(let E=0;E<y.length;E++){const B=(E+1)%y.length;x.push(a.create([C[E],C[B],y[B],y[E]]))}return x},_=f=>{const I={center:[0,0,0],size:[2,2,2],roundRadius:.2,segments:32};let{center:C,size:y,roundRadius:x,segments:E}=Object.assign({},I,f);if(!u(C,3))throw new Error("center must be an array of X, Y and Z values");if(!u(y,3))throw new Error("size must be an array of X, Y and Z values");if(!y.every(w=>w>=0))throw new Error("size values must be positive");if(!l(x,0))throw new Error("roundRadius must be positive");if(!l(E,4))throw new Error("segments must be four or more");if(y[0]===0||y[1]===0||y[2]===0)return s.create();if(x===0)return g({center:C,size:y});if(y=y.map(w=>w/2),x>y[0]-n||x>y[1]-n||x>y[2]-n)throw new Error("roundRadius must be smaller than the radius of all dimensions");E=Math.floor(E/4);let B=null,S=null,Q=[];for(let w=0;w<=E;w++){const M=h(C,y,x,E,w,!0),k=h(C,y,x,E,w,!1);if(w===0&&(Q=Q.concat(m(k,M))),B&&(Q=Q.concat(d(B,M),p(B,M))),S&&(Q=Q.concat(d(S,k),p(S,k))),w===E){let R=M.map(F=>F[0]);Q.push(a.create(R)),R=k.map(F=>F[0]),Q.push(a.create(R))}B=M,S=k}return s.create(Q)};e.exports=_}}),Ghi=yt({"node_modules/@jscad/modeling/src/primitives/roundedCylinder.js"(t,e){var{EPS:n,TAU:o}=mc(),i=$r(),r=Ta(),s=XA(),{sin:a,cos:A}=hI(),{isGTE:c,isNumberArray:l}=lf(),u=irn(),g=h=>{const d={center:[0,0,0],height:2,radius:1,roundRadius:.2,segments:32},{center:p,height:m,radius:_,roundRadius:f,segments:I}=Object.assign({},d,h);if(!l(p,3))throw new Error("center must be an array of X, Y and Z values");if(!c(m,0))throw new Error("height must be positive");if(!c(_,0))throw new Error("radius must be positive");if(!c(f,0))throw new Error("roundRadius must be positive");if(f>_)throw new Error("roundRadius must be smaller than the radius");if(!c(I,4))throw new Error("segments must be four or more");if(m===0||_===0)return r.create();if(f===0)return u({center:p,height:m,radius:_});const C=[0,0,-(m/2)],y=[0,0,m/2],x=i.subtract(i.create(),y,C),E=i.length(x);if(2*f>E-n)throw new Error("height must be larger than twice roundRadius");let B;Math.abs(x[0])>Math.abs(x[1])?B=i.fromValues(0,1,0):B=i.fromValues(1,0,0);const S=i.scale(i.create(),i.normalize(i.create(),x),f),Q=i.scale(i.create(),i.normalize(i.create(),i.cross(i.create(),S,B)),_),w=i.scale(i.create(),i.normalize(i.create(),i.cross(i.create(),Q,S)),_);i.add(C,C,S),i.subtract(y,y,S);const M=Math.floor(.25*I),k=W=>{const te=W.map(j=>i.add(j,j,p));return s.create(te)},R=[],F=i.create(),O=i.create();let U;for(let W=0;W<=I;W++){const te=o*W/I,j=i.add(i.create(),i.scale(F,Q,A(te)),i.scale(O,w,a(te)));if(W>0){let J=[];J.push(i.add(i.create(),C,j)),J.push(i.add(i.create(),C,U)),J.push(i.add(i.create(),y,U)),J.push(i.add(i.create(),y,j)),R.push(k(J));let oe,ie;for(let ne=0;ne<=M;ne++){const le=o/4*ne/M,ge=A(le),_e=a(le);if(ne>0){J=[];let ue;ue=i.add(i.create(),C,i.subtract(F,i.scale(F,U,oe),i.scale(O,S,ie))),J.push(ue),ue=i.add(i.create(),C,i.subtract(F,i.scale(F,j,oe),i.scale(O,S,ie))),J.push(ue),ne<M&&(ue=i.add(i.create(),C,i.subtract(F,i.scale(F,j,ge),i.scale(O,S,_e))),J.push(ue)),ue=i.add(i.create(),C,i.subtract(F,i.scale(F,U,ge),i.scale(O,S,_e))),J.push(ue),R.push(k(J)),J=[],ue=i.add(i.create(),i.scale(F,U,oe),i.scale(O,S,ie)),i.add(ue,ue,y),J.push(ue),ue=i.add(i.create(),i.scale(F,j,oe),i.scale(O,S,ie)),i.add(ue,ue,y),J.push(ue),ne<M&&(ue=i.add(i.create(),i.scale(F,j,ge),i.scale(O,S,_e)),i.add(ue,ue,y),J.push(ue)),ue=i.add(i.create(),i.scale(F,U,ge),i.scale(O,S,_e)),i.add(ue,ue,y),J.push(ue),J.reverse(),R.push(k(J))}oe=ge,ie=_e}}U=j}return r.create(R)};e.exports=g}}),Yhi=yt({"node_modules/@jscad/modeling/src/primitives/roundedRectangle.js"(t,e){var{EPS:n,TAU:o}=mc(),i=_A(),r=Ya(),{isGTE:s,isNumberArray:a}=lf(),A=SVe(),c=l=>{const u={center:[0,0],size:[2,2],roundRadius:.2,segments:32};let{center:g,size:h,roundRadius:d,segments:p}=Object.assign({},u,l);if(!a(g,2))throw new Error("center must be an array of X and Y values");if(!a(h,2))throw new Error("size must be an array of X and Y values");if(!h.every(S=>S>=0))throw new Error("size values must be positive");if(!s(d,0))throw new Error("roundRadius must be positive");if(!s(p,4))throw new Error("segments must be four or more");if(h[0]===0||h[1]===0)return r.create();if(d===0)return A({center:g,size:h});if(h=h.map(S=>S/2),d>h[0]-n||d>h[1]-n)throw new Error("roundRadius must be smaller than the radius of all dimensions");const m=Math.floor(p/4),_=i.add(i.create(),g,[h[0]-d,h[1]-d]),f=i.add(i.create(),g,[d-h[0],h[1]-d]),I=i.add(i.create(),g,[d-h[0],d-h[1]]),C=i.add(i.create(),g,[h[0]-d,d-h[1]]),y=[],x=[],E=[],B=[];for(let S=0;S<=m;S++){const Q=o/4*S/m,w=i.fromAngleRadians(i.create(),Q);i.scale(w,w,d),y.push(i.add(i.create(),_,w)),i.rotate(w,w,i.create(),o/4),x.push(i.add(i.create(),f,w)),i.rotate(w,w,i.create(),o/4),E.push(i.add(i.create(),I,w)),i.rotate(w,w,i.create(),o/4),B.push(i.add(i.create(),C,w))}return r.fromPoints(y.concat(x,E,B))};e.exports=c}}),arn=yt({"node_modules/@jscad/modeling/src/primitives/sphere.js"(t,e){var n=rrn(),{isGTE:o}=lf(),i=r=>{const s={center:[0,0,0],radius:1,segments:32,axes:[[1,0,0],[0,-1,0],[0,0,1]]};let{center:a,radius:A,segments:c,axes:l}=Object.assign({},s,r);if(!o(A,0))throw new Error("radius must be positive");return A=[A,A,A],n({center:a,radius:A,segments:c,axes:l})};e.exports=i}}),Uhi=yt({"node_modules/@jscad/modeling/src/primitives/square.js"(t,e){var n=SVe(),{isGTE:o}=lf(),i=r=>{const s={center:[0,0],size:2};let{center:a,size:A}=Object.assign({},s,r);if(!o(A,0))throw new Error("size must be positive");return A=[A,A],n({center:a,size:A})};e.exports=i}}),Khi=yt({"node_modules/@jscad/modeling/src/primitives/star.js"(t,e){var{TAU:n}=mc(),o=_A(),i=Ya(),{isGT:r,isGTE:s,isNumberArray:a}=lf(),A=(u,g)=>u>0&&g>1&&g<u/2?Math.cos(Math.PI*g/u)/Math.cos(Math.PI*(g-1)/u):0,c=(u,g,h,d)=>{const p=n/u,m=[];for(let _=0;_<u;_++){const f=o.fromAngleRadians(o.create(),p*_+h);o.scale(f,f,g),o.add(f,d,f),m.push(f)}return m},l=u=>{const g={center:[0,0],vertices:5,outerRadius:1,innerRadius:0,density:2,startAngle:0};let{center:h,vertices:d,outerRadius:p,innerRadius:m,density:_,startAngle:f}=Object.assign({},g,u);if(!a(h,2))throw new Error("center must be an array of X and Y values");if(!s(d,2))throw new Error("vertices must be two or more");if(!r(p,0))throw new Error("outerRadius must be greater than zero");if(!s(m,0))throw new Error("innerRadius must be greater than zero");if(!s(f,0))throw new Error("startAngle must be greater than zero");if(d=Math.floor(d),_=Math.floor(_),f=f%n,m===0){if(!s(_,2))throw new Error("density must be two or more");m=p*A(d,_)}const I=o.clone(h),C=c(d,p,f,I),y=c(d,m,f+Math.PI/d,I),x=[];for(let E=0;E<d;E++)x.push(C[E]),x.push(y[E]);return i.fromPoints(x)};e.exports=l}}),wX=yt({"node_modules/@jscad/modeling/src/operations/transforms/mirror.js"(t,e){var n=ga(),o=Du(),i=S6(),r=Ya(),s=Ta(),a=Au(),A=(g,...h)=>{const d={origin:[0,0,0],normal:[0,0,1]},{origin:p,normal:m}=Object.assign({},d,g);if(h=n(h),h.length===0)throw new Error("wrong number of arguments");const _=i.fromNormalAndPoint(i.create(),m,p);if(Number.isNaN(_[0]))throw new Error("the given origin and normal do not define a proper plane");const f=o.mirrorByPlane(o.create(),_),I=h.map(C=>a.isA(C)?a.transform(f,C):r.isA(C)?r.transform(f,C):s.isA(C)?s.transform(f,C):C);return I.length===1?I[0]:I},c=(...g)=>A({normal:[1,0,0]},g),l=(...g)=>A({normal:[0,1,0]},g),u=(...g)=>A({normal:[0,0,1]},g);e.exports={mirror:A,mirrorX:c,mirrorY:l,mirrorZ:u}}}),Arn=yt({"node_modules/@jscad/modeling/src/operations/extrusions/slice/calculatePlane.js"(t,e){var n=S6(),o=$r(),i=r=>{const s=r.edges;if(s.length<3)throw new Error("slices must have 3 or more edges to calculate a plane");const a=s.reduce((u,g)=>o.add(o.create(),u,g[0]),o.create());o.scale(a,a,1/s.length);let A,c=0;s.forEach(u=>{if(!o.equals(u[0],u[1])){const g=o.squaredDistance(a,u[0]);g>c&&(A=u,c=g)}});const l=s.find(u=>o.equals(u[1],A[0]));return n.fromPoints(n.create(),l[0],A[0],A[1])};e.exports=i}}),iT=yt({"node_modules/@jscad/modeling/src/operations/extrusions/slice/create.js"(t,e){var n=o=>(o||(o=[]),{edges:o});e.exports=n}}),Vhi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/slice/clone.js"(t,e){var n=iT(),o=$r(),i=(...r)=>{let s,a;return r.length===1?(s=n(),a=r[0]):(s=r[0],a=r[1]),s.edges=a.edges.map(A=>[o.clone(A[0]),o.clone(A[1])]),s};e.exports=i}}),zhi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/slice/equals.js"(t,e){var n=$r(),o=(i,r)=>{const s=i.edges,a=r.edges;return s.length!==a.length?!1:s.reduce((c,l,u)=>{const g=a[u],h=n.squaredDistance(l[0],g[0]);return c&&h<Number.EPSILON},!0)};e.exports=o}}),Jhi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/slice/fromPoints.js"(t,e){var n=$r(),o=iT(),i=r=>{if(!Array.isArray(r))throw new Error("the given points must be an array");if(r.length<3)throw new Error("the given points must contain THREE or more points");const s=[];let a=r[r.length-1];return r.forEach(A=>{A.length===2&&s.push([n.fromVec2(n.create(),a),n.fromVec2(n.create(),A)]),A.length===3&&s.push([a,A]),a=A}),o(s)};e.exports=i}}),Whi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/slice/fromSides.js"(t,e){var n=$r(),o=iT(),i=r=>{if(!Array.isArray(r))throw new Error("the given sides must be an array");const s=[];return r.forEach(a=>{s.push([n.fromVec2(n.create(),a[0]),n.fromVec2(n.create(),a[1])])}),o(s)};e.exports=i}}),jhi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/slice/isA.js"(t,e){var n=o=>!!(o&&typeof o=="object"&&"edges"in o&&Array.isArray(o.edges));e.exports=n}}),$hi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/slice/reverse.js"(t,e){var n=iT(),o=(...i)=>{let r,s;return i.length===1?(r=n(),s=i[0]):(r=i[0],s=i[1]),r.edges=s.edges.map(a=>[a[1],a[0]]),r};e.exports=o}}),qhi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/slice/toEdges.js"(t,e){var n=o=>o.edges;e.exports=n}}),Xhi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/earcut/linkedListSort.js"(t,e){var n=(o,i)=>{let r,s,a,A,c,l=1;do{s=o,o=null;let u=null;for(c=0;s;){c++,a=s;let g=0;for(r=0;r<l&&(g++,a=a.nextZ,!!a);r++);let h=l;for(;g>0||h>0&&a;)g!==0&&(h===0||!a||i(s)<=i(a))?(A=s,s=s.nextZ,g--):(A=a,a=a.nextZ,h--),u?u.nextZ=A:o=A,A.prevZ=u,u=A;s=a}u.nextZ=null,l*=2}while(c>1);return o};e.exports=n}}),crn=yt({"node_modules/@jscad/modeling/src/operations/extrusions/earcut/linkedList.js"(t,e){var n=Xhi(),o=class{constructor(s,a,A){this.i=s,this.x=a,this.y=A,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}},i=(s,a,A,c)=>{const l=new o(s,a,A);return c?(l.next=c.next,l.prev=c,c.next.prev=l,c.next=l):(l.prev=l,l.next=l),l},r=s=>{s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)};e.exports={Node:o,insertNode:i,removeNode:r,sortLinked:n}}}),QVe=yt({"node_modules/@jscad/modeling/src/operations/extrusions/earcut/triangle.js"(t,e){var n=(i,r,s,a,A,c,l,u)=>(A-l)*(r-u)-(i-l)*(c-u)>=0&&(i-l)*(a-u)-(s-l)*(r-u)>=0&&(s-l)*(c-u)-(A-l)*(a-u)>=0,o=(i,r,s)=>(r.y-i.y)*(s.x-r.x)-(r.x-i.x)*(s.y-r.y);e.exports={area:o,pointInTriangle:n}}}),lrn=yt({"node_modules/@jscad/modeling/src/operations/extrusions/earcut/linkedPolygon.js"(t,e){var{Node:n,insertNode:o,removeNode:i}=crn(),{area:r}=QVe(),s=(f,I,C,y,x)=>{let E;if(x===m(f,I,C,y)>0)for(let B=I;B<C;B+=y)E=o(B,f[B],f[B+1],E);else for(let B=C-y;B>=I;B-=y)E=o(B,f[B],f[B+1],E);return E&&_(E,E.next)&&(i(E),E=E.next),E},a=(f,I)=>{if(!f)return f;I||(I=f);let C=f,y;do if(y=!1,!C.steiner&&(_(C,C.next)||r(C.prev,C,C.next)===0)){if(i(C),C=I=C.prev,C===C.next)break;y=!0}else C=C.next;while(y||C!==I);return I},A=(f,I,C)=>{let y=f;do{const x=y.prev,E=y.next.next;!_(x,E)&&d(x,y,y.next,E)&&l(x,E)&&l(E,x)&&(I.push(x.i/C),I.push(y.i/C),I.push(E.i/C),i(y),i(y.next),y=f=E),y=y.next}while(y!==f);return a(y)},c=(f,I)=>{let C=f;do{if(C.i!==f.i&&C.next.i!==f.i&&C.i!==I.i&&C.next.i!==I.i&&d(C,C.next,f,I))return!0;C=C.next}while(C!==f);return!1},l=(f,I)=>r(f.prev,f,f.next)<0?r(f,I,f.next)>=0&&r(f,f.prev,I)>=0:r(f,I,f.prev)<0||r(f,f.next,I)<0,u=(f,I)=>{let C=f,y=!1;const x=(f.x+I.x)/2,E=(f.y+I.y)/2;do C.y>E!=C.next.y>E&&C.next.y!==C.y&&x<(C.next.x-C.x)*(E-C.y)/(C.next.y-C.y)+C.x&&(y=!y),C=C.next;while(C!==f);return y},g=(f,I)=>{const C=new n(f.i,f.x,f.y),y=new n(I.i,I.x,I.y),x=f.next,E=I.prev;return f.next=I,I.prev=f,C.next=x,x.prev=C,y.next=C,C.prev=y,E.next=y,y.prev=E,y},h=(f,I)=>f.next.i!==I.i&&f.prev.i!==I.i&&!c(f,I)&&(l(f,I)&&l(I,f)&&u(f,I)&&(r(f.prev,f,I.prev)||r(f,I.prev,I))||_(f,I)&&r(f.prev,f,f.next)>0&&r(I.prev,I,I.next)>0),d=(f,I,C,y)=>{const x=Math.sign(r(f,I,C)),E=Math.sign(r(f,I,y)),B=Math.sign(r(C,y,f)),S=Math.sign(r(C,y,I));return!!(x!==E&&B!==S||x===0&&p(f,C,I)||E===0&&p(f,y,I)||B===0&&p(C,f,y)||S===0&&p(C,I,y))},p=(f,I,C)=>I.x<=Math.max(f.x,C.x)&&I.x>=Math.min(f.x,C.x)&&I.y<=Math.max(f.y,C.y)&&I.y>=Math.min(f.y,C.y),m=(f,I,C,y)=>{let x=0;for(let E=I,B=C-y;E<C;E+=y)x+=(f[B]-f[E])*(f[E+1]+f[B+1]),B=E;return x},_=(f,I)=>f.x===I.x&&f.y===I.y;e.exports={cureLocalIntersections:A,filterPoints:a,isValidDiagonal:h,linkedPolygon:s,locallyInside:l,splitPolygon:g}}}),Zhi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/earcut/eliminateHoles.js"(t,e){var{filterPoints:n,linkedPolygon:o,locallyInside:i,splitPolygon:r}=lrn(),{area:s,pointInTriangle:a}=QVe(),A=(h,d,p,m)=>{const _=[];for(let f=0,I=d.length;f<I;f++){const C=d[f]*m,y=f<I-1?d[f+1]*m:h.length,x=o(h,C,y,m,!1);x===x.next&&(x.steiner=!0),_.push(g(x))}_.sort((f,I)=>f.x-I.x);for(let f=0;f<_.length;f++)p=c(_[f],p),p=n(p,p.next);return p},c=(h,d)=>{const p=l(h,d);if(!p)return d;const m=r(p,h),_=n(p,p.next);return n(m,m.next),d===p?_:d},l=(h,d)=>{let p=d;const m=h.x,_=h.y;let f=-1/0,I;do{if(_<=p.y&&_>=p.next.y&&p.next.y!==p.y){const B=p.x+(_-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(B<=m&&B>f){if(f=B,B===m){if(_===p.y)return p;if(_===p.next.y)return p.next}I=p.x<p.next.x?p:p.next}}p=p.next}while(p!==d);if(!I)return null;if(m===f)return I;const C=I,y=I.x,x=I.y;let E=1/0;p=I;do{if(m>=p.x&&p.x>=y&&m!==p.x&&a(_<x?m:f,_,y,x,_<x?f:m,_,p.x,p.y)){const B=Math.abs(_-p.y)/(m-p.x);i(p,h)&&(B<E||B===E&&(p.x>I.x||p.x===I.x&&u(I,p)))&&(I=p,E=B)}p=p.next}while(p!==C);return I},u=(h,d)=>s(h.prev,h,d.prev)<0&&s(d.next,h,h.next)<0,g=h=>{let d=h,p=h;do(d.x<p.x||d.x===p.x&&d.y<p.y)&&(p=d),d=d.next;while(d!==h);return p};e.exports=A}}),epi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/earcut/index.js"(t,e){var n=Zhi(),{removeNode:o,sortLinked:i}=crn(),{cureLocalIntersections:r,filterPoints:s,isValidDiagonal:a,linkedPolygon:A,splitPolygon:c}=lrn(),{area:l,pointInTriangle:u}=QVe(),g=(I,C,y=2)=>{const x=C&&C.length,E=x?C[0]*y:I.length;let B=A(I,0,E,y,!0);const S=[];if(!B||B.next===B.prev)return S;let Q,w,M,k,R;if(x&&(B=n(I,C,B,y)),I.length>80*y){Q=M=I[0],w=k=I[1];for(let F=y;F<E;F+=y){const O=I[F],U=I[F+1];O<Q&&(Q=O),U<w&&(w=U),O>M&&(M=O),U>k&&(k=U)}R=Math.max(M-Q,k-w),R=R!==0?1/R:0}return h(B,S,y,Q,w,R),S},h=(I,C,y,x,E,B,S)=>{if(!I)return;!S&&B&&_(I,x,E,B);let Q=I,w,M;for(;I.prev!==I.next;){if(w=I.prev,M=I.next,B?p(I,x,E,B):d(I)){C.push(w.i/y),C.push(I.i/y),C.push(M.i/y),o(I),I=M.next,Q=M.next;continue}if(I=M,I===Q){S?S===1?(I=r(s(I),C,y),h(I,C,y,x,E,B,2)):S===2&&m(I,C,y,x,E,B):h(s(I),C,y,x,E,B,1);break}}},d=I=>{const C=I.prev,y=I,x=I.next;if(l(C,y,x)>=0)return!1;let E=I.next.next;for(;E!==I.prev;){if(u(C.x,C.y,y.x,y.y,x.x,x.y,E.x,E.y)&&l(E.prev,E,E.next)>=0)return!1;E=E.next}return!0},p=(I,C,y,x)=>{const E=I.prev,B=I,S=I.next;if(l(E,B,S)>=0)return!1;const Q=E.x<B.x?E.x<S.x?E.x:S.x:B.x<S.x?B.x:S.x,w=E.y<B.y?E.y<S.y?E.y:S.y:B.y<S.y?B.y:S.y,M=E.x>B.x?E.x>S.x?E.x:S.x:B.x>S.x?B.x:S.x,k=E.y>B.y?E.y>S.y?E.y:S.y:B.y>S.y?B.y:S.y,R=f(Q,w,C,y,x),F=f(M,k,C,y,x);let O=I.prevZ,U=I.nextZ;for(;O&&O.z>=R&&U&&U.z<=F;){if(O!==I.prev&&O!==I.next&&u(E.x,E.y,B.x,B.y,S.x,S.y,O.x,O.y)&&l(O.prev,O,O.next)>=0||(O=O.prevZ,U!==I.prev&&U!==I.next&&u(E.x,E.y,B.x,B.y,S.x,S.y,U.x,U.y)&&l(U.prev,U,U.next)>=0))return!1;U=U.nextZ}for(;O&&O.z>=R;){if(O!==I.prev&&O!==I.next&&u(E.x,E.y,B.x,B.y,S.x,S.y,O.x,O.y)&&l(O.prev,O,O.next)>=0)return!1;O=O.prevZ}for(;U&&U.z<=F;){if(U!==I.prev&&U!==I.next&&u(E.x,E.y,B.x,B.y,S.x,S.y,U.x,U.y)&&l(U.prev,U,U.next)>=0)return!1;U=U.nextZ}return!0},m=(I,C,y,x,E,B)=>{let S=I;do{let Q=S.next.next;for(;Q!==S.prev;){if(S.i!==Q.i&&a(S,Q)){let w=c(S,Q);S=s(S,S.next),w=s(w,w.next),h(S,C,y,x,E,B),h(w,C,y,x,E,B);return}Q=Q.next}S=S.next}while(S!==I)},_=(I,C,y,x)=>{let E=I;do E.z===null&&(E.z=f(E.x,E.y,C,y,x)),E.prevZ=E.prev,E.nextZ=E.next,E=E.next;while(E!==I);E.prevZ.nextZ=null,E.prevZ=null,i(E,B=>B.z)},f=(I,C,y,x,E)=>(I=32767*(I-y)*E,C=32767*(C-x)*E,I=(I|I<<8)&16711935,I=(I|I<<4)&252645135,I=(I|I<<2)&858993459,I=(I|I<<1)&1431655765,C=(C|C<<8)&16711935,C=(C|C<<4)&252645135,C=(C|C<<2)&858993459,C=(C|C<<1)&1431655765,I|C<<1);e.exports=g}}),tpi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/earcut/assignHoles.js"(t,e){var{area:n}=QX(),{toOutlines:o}=Ya(),{arePointsInside:i}=fVe(),r=a=>{const A=o(a),c=[],l=[];A.forEach((h,d)=>{const p=n(h);p<0?l.push(d):p>0&&c.push(d)});const u=[],g=[];return c.forEach((h,d)=>{const p=A[h];u[d]=[],l.forEach((m,_)=>{const f=A[m];i([f[0]],{vertices:p})&&(u[d].push(m),g[_]||(g[_]=[]),g[_].push(d))})}),l.forEach((h,d)=>{if(g[d]&&g[d].length>1){const p=s(g[d],m=>u[m].length);g[d].forEach((m,_)=>{_!==p&&(u[m]=u[m].filter(f=>f!==h))})}}),u.map((h,d)=>({solid:A[c[d]],holes:h.map(p=>A[p])}))},s=(a,A)=>{let c,l;return a.forEach((u,g)=>{const h=A(u);(l===void 0||h<l)&&(c=g,l=h)}),c};e.exports=r}}),npi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/earcut/polygonHierarchy.js"(t,e){var n=Ya(),o=S6(),i=_A(),r=$r(),s=Arn(),a=tpi(),A=class{constructor(c){this.plane=s(c);const l=r.orthogonal(r.create(),this.plane),u=r.cross(r.create(),this.plane,l);this.v=r.normalize(u,u),this.u=r.cross(r.create(),this.v,this.plane),this.basisMap=new Map;const g=c.edges.map(d=>d.map(p=>this.to2D(p))),h=n.create(g);this.roots=a(h)}to2D(c){const l=i.fromValues(r.dot(c,this.u),r.dot(c,this.v));return this.basisMap.set(l,c),l}to3D(c){const l=this.basisMap.get(c);if(l)return l;{console.log("Warning: point not in original slice");const u=r.scale(r.create(),this.u,c[0]),g=r.scale(r.create(),this.v,c[1]),h=r.scale(r.create(),o,o[3]),d=r.add(u,u,h);return r.add(g,g,d)}}};e.exports=A}}),opi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/slice/toPolygons.js"(t,e){var n=XA(),o=epi(),i=npi(),r=s=>{const a=new i(s),A=[];return a.roots.forEach(({solid:c,holes:l})=>{let u=c.length;const g=[];l.forEach((_,f)=>{g.push(u),u+=_.length});const h=[c,...l].flat(),d=h.flat(),p=_=>a.to3D(h[_]),m=o(d,g);for(let _=0;_<m.length;_+=3){const f=m.slice(_,_+3).map(p);A.push(n.fromPointsAndPlane(f,a.plane))}}),A};e.exports=r}}),ipi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/slice/toString.js"(t,e){var n=$r(),o=r=>r.reduce((s,a)=>s+=`[${n.toString(a[0])}, ${n.toString(a[1])}], `,""),i=r=>`[${o(r.edges)}]`;e.exports=i}}),rpi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/slice/transform.js"(t,e){var n=$r(),o=iT(),i=(r,s)=>{const a=s.edges.map(A=>[n.transform(n.create(),A[0],r),n.transform(n.create(),A[1],r)]);return o(a)};e.exports=i}}),DY=yt({"node_modules/@jscad/modeling/src/operations/extrusions/slice/index.js"(t,e){e.exports={calculatePlane:Arn(),clone:Vhi(),create:iT(),equals:zhi(),fromPoints:Jhi(),fromSides:Whi(),isA:jhi(),reverse:$hi(),toEdges:qhi(),toPolygons:opi(),toString:ipi(),transform:rpi()}}}),spi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/slice/repair.js"(t,e){var n=$r(),o=iT(),i=r=>{if(!r.edges)return r;let s=r.edges;const a=new Map,A=new Map;s=s.filter(u=>!n.equals(u[0],u[1])),s.forEach(u=>{const g=u[0].toString(),h=u[1].toString();a.set(g,u[0]),a.set(h,u[1]),A.set(g,(A.get(g)||0)+1),A.set(h,(A.get(h)||0)-1)});const c=[],l=[];return A.forEach((u,g)=>{u<0&&c.push(g),u>0&&l.push(g)}),c.forEach(u=>{const g=a.get(u);let h=1/0,d;l.forEach(p=>{const m=a.get(p),_=n.distance(g,m);_<h&&(h=_,d=m)}),console.warn(`slice.repair: repairing vertex gap ${g} to ${d} distance ${h}`),s=s.map(p=>p[0].toString()===u?[d,p[1]]:p[1].toString()===u?[p[0],d]:p)}),o(s)};e.exports=i}}),api=yt({"node_modules/@jscad/modeling/src/operations/extrusions/extrudeWalls.js"(t,e){var{EPS:n}=mc(),o=$r(),i=XA(),r=DY(),s=(u,g)=>u===g?u:u<g?s(g,u):g===1?1:g===0?u:s(g,u%g),a=(u,g)=>u*g/s(u,g),A=(u,g)=>{const h=u/g.length;if(h===1)return g;const d=o.fromValues(h,h,h),p=o.create(),m=[];return g.forEach(_=>{o.subtract(p,_[1],_[0]),o.divide(p,p,d);let f=_[0];for(let I=1;I<=h;++I){const C=o.add(o.create(),f,p);m.push([f,C]),f=C}}),m},c=n*n/2*Math.sin(Math.PI/3),l=(u,g)=>{let h=r.toEdges(u),d=r.toEdges(g);if(h.length!==d.length){const m=a(h.length,d.length);m!==h.length&&(h=A(m,h)),m!==d.length&&(d=A(m,d))}const p=[];return h.forEach((m,_)=>{const f=d[_],I=i.create([m[0],m[1],f[1]]),C=i.measureArea(I);Number.isFinite(C)&&C>c&&p.push(I);const y=i.create([m[0],f[1],f[0]]),x=i.measureArea(y);Number.isFinite(x)&&x>c&&p.push(y)}),p};e.exports=l}}),ope=yt({"node_modules/@jscad/modeling/src/operations/extrusions/extrudeFromSlices.js"(t,e){var n=Du(),o=Ya(),i=Ta(),r=XA(),s=DY(),a=spi(),A=api(),c=(u,g,h)=>{let d=null;return o.isA(h)&&(d=s.fromSides(o.toSides(h))),r.isA(h)&&(d=s.fromPoints(r.toPoints(h))),u===0||u===1?s.transform(n.fromTranslation(n.create(),[0,0,u]),d):null},l=(u,g)=>{const h={numberOfSlices:2,capStart:!0,capEnd:!0,close:!1,repair:!0,callback:c},{numberOfSlices:d,capStart:p,capEnd:m,close:_,repair:f,callback:I}=Object.assign({},h,u);if(d<2)throw new Error("numberOfSlices must be 2 or more");f&&(g=a(g));const C=d-1;let y=null,x=null,E=null,B=[];for(let S=0;S<d;S++){const Q=I(S/C,S,g);if(Q){if(!s.isA(Q))throw new Error("the callback function must return slice objects");if(s.toEdges(Q).length===0)throw new Error("the callback function must return slices with one or more edges");if(E){const M=A(E,Q);for(let k=0;k<M.length;k++)B.push(M[k])}S===0&&(y=Q),S===d-1&&(x=Q),E=Q}}if(m){const S=s.toPolygons(x);for(let Q=0;Q<S.length;Q++)B.push(S[Q])}if(p){const S=s.toPolygons(y).map(r.invert);for(let Q=0;Q<S.length;Q++)B.push(S[Q])}if(!p&&!m&&_&&!s.equals(x,y)){const S=A(x,y);for(let Q=0;Q<S.length;Q++)B.push(S[Q])}return i.create(B)};e.exports=l}}),urn=yt({"node_modules/@jscad/modeling/src/operations/extrusions/extrudeRotate.js"(t,e){var{TAU:n}=mc(),o=Du(),{mirrorX:i}=wX(),r=Ya(),s=DY(),a=ope(),A=(c,l)=>{const u={segments:12,startAngle:0,angle:n,overflow:"cap"};let{segments:g,startAngle:h,angle:d,overflow:p}=Object.assign({},u,c);if(g<3)throw new Error("segments must be greater then 3");h=Math.abs(h)>n?h%n:h,d=Math.abs(d)>n?d%n:d;let m=h+d;if(m=Math.abs(m)>n?m%n:m,m<h){const k=h;h=m,m=k}let _=m-h;if(_<=0&&(_=n),Math.abs(_)<n){const k=n/g;g=Math.floor(Math.abs(_)/k),Math.abs(_)>g*k&&g++}let f=r.toSides(l);if(f.length===0)throw new Error("the given geometry cannot be empty");const I=f.filter(k=>k[0][0]<0),C=f.filter(k=>k[0][0]>=0);I.length>0&&C.length>0&&p==="cap"&&(I.length>C.length?(f=f.map(k=>{let R=k[0],F=k[1];return R=[Math.min(R[0],0),R[1]],F=[Math.min(F[0],0),F[1]],[R,F]}),l=r.create(f),l=i(l)):C.length>=I.length&&(f=f.map(k=>{let R=k[0],F=k[1];return R=[Math.max(R[0],0),R[1]],F=[Math.max(F[0],0),F[1]],[R,F]}),l=r.create(f)));const x=_/g,E=Math.abs(_)<n,B=s.fromSides(r.toSides(l));s.reverse(B,B);const S=o.create(),Q=o.fromXRotation(o.create(),n/4),w=o.create(),M=(k,R,F)=>{let O=x*R+h;return _===n&&R===g&&(O=h),o.fromZRotation(w,O),o.multiply(S,w,Q),s.transform(S,F)};return c={numberOfSlices:g+1,capStart:E,capEnd:E,close:!E,callback:M},a(c,B)};e.exports=A}}),PX=yt({"node_modules/@jscad/modeling/src/operations/transforms/rotate.js"(t,e){var n=ga(),o=Du(),i=Ya(),r=Ta(),s=Au(),a=(u,...g)=>{if(!Array.isArray(u))throw new Error("angles must be an array");if(g=n(g),g.length===0)throw new Error("wrong number of arguments");for(u=u.slice();u.length<3;)u.push(0);const h=u[2],d=u[1],p=u[0],m=o.fromTaitBryanRotation(o.create(),h,d,p),_=g.map(f=>s.isA(f)?s.transform(m,f):i.isA(f)?i.transform(m,f):r.isA(f)?r.transform(m,f):f);return _.length===1?_[0]:_},A=(u,...g)=>a([u,0,0],g),c=(u,...g)=>a([0,u,0],g),l=(u,...g)=>a([0,0,u],g);e.exports={rotate:a,rotateX:A,rotateY:c,rotateZ:l}}}),rT=yt({"node_modules/@jscad/modeling/src/operations/transforms/translate.js"(t,e){var n=ga(),o=Du(),i=Ya(),r=Ta(),s=Au(),a=(u,...g)=>{if(!Array.isArray(u))throw new Error("offset must be an array");if(g=n(g),g.length===0)throw new Error("wrong number of arguments");for(u=u.slice();u.length<3;)u.push(0);const h=o.fromTranslation(o.create(),u),d=g.map(p=>s.isA(p)?s.transform(h,p):i.isA(p)?i.transform(h,p):r.isA(p)?r.transform(h,p):p);return d.length===1?d[0]:d},A=(u,...g)=>a([u,0,0],g),c=(u,...g)=>a([0,u,0],g),l=(u,...g)=>a([0,0,u],g);e.exports={translate:a,translateX:A,translateY:c,translateZ:l}}}),Api=yt({"node_modules/@jscad/modeling/src/primitives/torus.js"(t,e){var{TAU:n}=mc(),o=urn(),{rotate:i}=PX(),{translate:r}=rT(),s=nrn(),{isGT:a,isGTE:A}=lf(),c=l=>{const u={innerRadius:1,innerSegments:32,outerRadius:4,outerSegments:32,innerRotation:0,startAngle:0,outerRotation:n},{innerRadius:g,innerSegments:h,outerRadius:d,outerSegments:p,innerRotation:m,startAngle:_,outerRotation:f}=Object.assign({},u,l);if(!a(g,0))throw new Error("innerRadius must be greater than zero");if(!A(h,3))throw new Error("innerSegments must be three or more");if(!a(d,0))throw new Error("outerRadius must be greater than zero");if(!A(p,3))throw new Error("outerSegments must be three or more");if(!A(_,0))throw new Error("startAngle must be positive");if(!a(f,0))throw new Error("outerRotation must be greater than zero");if(g>=d)throw new Error("inner circle is too large to rotate about the outer circle");let I=s({radius:g,segments:h});return m!==0&&(I=i([0,0,m],I)),I=r([d,0],I),o({startAngle:_,angle:f,segments:p},I)};e.exports=c}}),cpi=yt({"node_modules/@jscad/modeling/src/primitives/triangle.js"(t,e){var{NEPS:n}=mc(),o=_A(),i=Ya(),{isNumberArray:r}=lf(),s=(m,_,f)=>Math.acos((m*m+_*_-f*f)/(2*m*_)),a=(m,_,f)=>_>n?Math.sqrt(m*m+f*f-2*m*f*Math.cos(_)):Math.sqrt((m-f)*(m-f)+m*f*_*_*(1-_*_/12)),A=m=>{if(Math.abs(m[0]+m[1]+m[2]-Math.PI)>n)throw new Error("AAA triangles require angles that sum to PI");const f=m[0],I=m[1],C=Math.PI-f-I,y=1,x=y/Math.sin(C)*Math.sin(f),E=y/Math.sin(C)*Math.sin(I);return d(f,I,C,x,E,y)},c=m=>{const _=m[0],f=m[1],I=Math.PI+n-_-f;if(I<n)throw new Error("AAS triangles require angles that sum to PI");const C=m[2],y=C/Math.sin(_)*Math.sin(f),x=C/Math.sin(_)*Math.sin(I);return d(_,f,I,C,y,x)},l=m=>{const _=m[0],f=m[2],I=Math.PI+n-_-f;if(I<n)throw new Error("ASA triangles require angles that sum to PI");const C=m[1],y=C/Math.sin(I)*Math.sin(_),x=C/Math.sin(I)*Math.sin(f);return d(_,f,I,y,x,C)},u=m=>{const _=m[0],f=m[1],I=m[2],C=a(_,f,I),y=s(C,_,I),x=Math.PI-y-f;return d(y,f,x,I,C,_)},g=m=>{const _=m[0],f=m[1],I=m[2],C=Math.asin(f*Math.sin(I)/_),y=Math.PI-C-I,x=_/Math.sin(I)*Math.sin(y);return d(C,y,I,f,x,_)},h=m=>{const _=m[1],f=m[2],I=m[0];if(_+f<=I||f+I<=_||I+_<=f)throw new Error("SSS triangle is incorrect, as the longest side is longer than the sum of the other sides");const C=s(f,I,_),y=s(I,_,f),x=Math.PI-C-y;return d(C,y,x,_,f,I)},d=(m,_,f,I,C,y)=>{const x=o.fromValues(0,0),E=o.fromValues(y,0),B=o.fromValues(I,0);return o.add(B,o.rotate(B,B,[0,0],Math.PI-_),E),i.fromPoints([x,E,B])},p=m=>{const _={type:"SSS",values:[1,1,1]};let{type:f,values:I}=Object.assign({},_,m);if(typeof f!="string")throw new Error("triangle type must be a string");if(f=f.toUpperCase(),!((f[0]==="A"||f[0]==="S")&&(f[1]==="A"||f[1]==="S")&&(f[2]==="A"||f[2]==="S")))throw new Error("triangle type must contain three letters; A or S");if(!r(I,3))throw new Error("triangle values must contain three values");if(!I.every(C=>C>0))throw new Error("triangle values must be greater than zero");switch(f){case"AAA":return A(I);case"AAS":return c(I);case"ASA":return l(I);case"SAS":return u(I);case"SSA":return g(I);case"SSS":return h(I);default:throw new Error("invalid triangle type, try again")}};e.exports=p}}),sT=yt({"node_modules/@jscad/modeling/src/primitives/index.js"(t,e){e.exports={arc:Thi(),circle:nrn(),cube:khi(),cuboid:bVe(),cylinder:irn(),cylinderElliptic:orn(),ellipse:trn(),ellipsoid:rrn(),geodesicSphere:Fhi(),line:Lhi(),polygon:Hhi(),polyhedron:srn(),rectangle:SVe(),roundedCuboid:Ohi(),roundedCylinder:Ghi(),roundedRectangle:Yhi(),sphere:arn(),square:Uhi(),star:Khi(),torus:Api(),triangle:cpi()}}}),lpi=yt({"node_modules/@jscad/modeling/src/text/fonts/single-line/hershey/simplex.js"(t,e){e.exports={height:14,32:[16],33:[10,5,21,5,7,void 0,5,2,4,1,5,0,6,1,5,2],34:[16,4,21,4,14,void 0,12,21,12,14],35:[21,11,25,4,-7,void 0,17,25,10,-7,void 0,4,12,18,12,void 0,3,6,17,6],36:[20,8,25,8,-4,void 0,12,25,12,-4,void 0,17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3],37:[24,21,21,3,0,void 0,8,21,10,19,10,17,9,15,7,14,5,14,3,16,3,18,4,20,6,21,8,21,10,20,13,19,16,19,19,20,21,21,void 0,17,7,15,6,14,4,14,2,16,0,18,0,20,1,21,3,21,5,19,7,17,7],38:[26,23,12,23,13,22,14,21,14,20,13,19,11,17,6,15,3,13,1,11,0,7,0,5,1,4,2,3,4,3,6,4,8,5,9,12,13,13,14,14,16,14,18,13,20,11,21,9,20,8,18,8,16,9,13,11,10,16,3,18,1,20,0,22,0,23,1,23,2],39:[10,5,19,4,20,5,21,6,20,6,18,5,16,4,15],40:[14,11,25,9,23,7,20,5,16,4,11,4,7,5,2,7,-2,9,-5,11,-7],41:[14,3,25,5,23,7,20,9,16,10,11,10,7,9,2,7,-2,5,-5,3,-7],42:[16,8,21,8,9,void 0,3,18,13,12,void 0,13,18,3,12],43:[26,13,18,13,0,void 0,4,9,22,9],44:[10,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4],45:[26,4,9,22,9],46:[10,5,2,4,1,5,0,6,1,5,2],47:[22,20,25,2,-7],48:[20,9,21,6,20,4,17,3,12,3,9,4,4,6,1,9,0,11,0,14,1,16,4,17,9,17,12,16,17,14,20,11,21,9,21],49:[20,6,17,8,18,11,21,11,0],50:[20,4,16,4,17,5,19,6,20,8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,10,3,0,17,0],51:[20,5,21,16,21,10,13,13,13,15,12,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4],52:[20,13,21,3,7,18,7,void 0,13,21,13,0],53:[20,15,21,5,21,4,12,5,13,8,14,11,14,14,13,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4],54:[20,16,18,15,20,12,21,10,21,7,20,5,17,4,12,4,7,5,3,7,1,10,0,11,0,14,1,16,3,17,6,17,7,16,10,14,12,11,13,10,13,7,12,5,10,4,7],55:[20,17,21,7,0,void 0,3,21,17,21],56:[20,8,21,5,20,4,18,4,16,5,14,7,13,11,12,14,11,16,9,17,7,17,4,16,2,15,1,12,0,8,0,5,1,4,2,3,4,3,7,4,9,6,11,9,12,13,13,15,14,16,16,16,18,15,20,12,21,8,21],57:[20,16,14,15,11,13,9,10,8,9,8,6,9,4,11,3,14,3,15,4,18,6,20,9,21,10,21,13,20,15,18,16,14,16,9,15,4,13,1,10,0,8,0,5,1,4,3],58:[10,5,14,4,13,5,12,6,13,5,14,void 0,5,2,4,1,5,0,6,1,5,2],59:[10,5,14,4,13,5,12,6,13,5,14,void 0,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4],60:[24,20,18,4,9,20,0],61:[26,4,12,22,12,void 0,4,6,22,6],62:[24,4,18,20,9,4,0],63:[18,3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,void 0,9,2,8,1,9,0,10,1,9,2],64:[27,18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,void 0,12,16,10,14,9,11,9,8,10,6,11,5,void 0,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,void 0,19,16,18,8,18,6,19,5],65:[18,9,21,1,0,void 0,9,21,17,0,void 0,4,7,14,7],66:[21,4,21,4,0,void 0,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,void 0,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0],67:[21,18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5],68:[21,4,21,4,0,void 0,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0],69:[19,4,21,4,0,void 0,4,21,17,21,void 0,4,11,12,11,void 0,4,0,17,0],70:[18,4,21,4,0,void 0,4,21,17,21,void 0,4,11,12,11],71:[21,18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,void 0,13,8,18,8],72:[22,4,21,4,0,void 0,18,21,18,0,void 0,4,11,18,11],73:[8,4,21,4,0],74:[16,12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7],75:[21,4,21,4,0,void 0,18,21,4,7,void 0,9,12,18,0],76:[17,4,21,4,0,void 0,4,0,16,0],77:[24,4,21,4,0,void 0,4,21,12,0,void 0,20,21,12,0,void 0,20,21,20,0],78:[22,4,21,4,0,void 0,4,21,18,0,void 0,18,21,18,0],79:[22,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21],80:[21,4,21,4,0,void 0,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10],81:[22,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,void 0,12,4,18,-2],82:[21,4,21,4,0,void 0,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,void 0,11,11,18,0],83:[20,17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3],84:[16,8,21,8,0,void 0,1,21,15,21],85:[22,4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21],86:[18,1,21,9,0,void 0,17,21,9,0],87:[24,2,21,7,0,void 0,12,21,7,0,void 0,12,21,17,0,void 0,22,21,17,0],88:[20,3,21,17,0,void 0,17,21,3,0],89:[18,1,21,9,11,9,0,void 0,17,21,9,11],90:[20,17,21,3,0,void 0,3,21,17,21,void 0,3,0,17,0],91:[14,4,25,4,-7,void 0,5,25,5,-7,void 0,4,25,11,25,void 0,4,-7,11,-7],92:[14,0,21,14,-3],93:[14,9,25,9,-7,void 0,10,25,10,-7,void 0,3,25,10,25,void 0,3,-7,10,-7],94:[16,6,15,8,18,10,15,void 0,3,12,8,17,13,12,void 0,8,17,8,0],95:[16,0,-2,16,-2],96:[10,6,21,5,20,4,18,4,16,5,15,6,16,5,17],97:[19,15,14,15,0,void 0,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3],98:[19,4,21,4,0,void 0,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3],99:[18,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3],100:[19,15,21,15,0,void 0,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3],101:[18,3,8,15,8,15,10,14,12,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3],102:[12,10,21,8,21,6,20,5,17,5,0,void 0,2,14,9,14],103:[19,15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,void 0,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3],104:[19,4,21,4,0,void 0,4,10,7,13,9,14,12,14,14,13,15,10,15,0],105:[8,3,21,4,20,5,21,4,22,3,21,void 0,4,14,4,0],106:[10,5,21,6,20,7,21,6,22,5,21,void 0,6,14,6,-3,5,-6,3,-7,1,-7],107:[17,4,21,4,0,void 0,14,14,4,4,void 0,8,8,15,0],108:[8,4,21,4,0],109:[30,4,14,4,0,void 0,4,10,7,13,9,14,12,14,14,13,15,10,15,0,void 0,15,10,18,13,20,14,23,14,25,13,26,10,26,0],110:[19,4,14,4,0,void 0,4,10,7,13,9,14,12,14,14,13,15,10,15,0],111:[19,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14],112:[19,4,14,4,-7,void 0,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3],113:[19,15,14,15,-7,void 0,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3],114:[13,4,14,4,0,void 0,4,8,5,11,7,13,9,14,12,14],115:[17,14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3],116:[12,5,21,5,4,6,1,8,0,10,0,void 0,2,14,9,14],117:[19,4,14,4,4,5,1,7,0,10,0,12,1,15,4,void 0,15,14,15,0],118:[16,2,14,8,0,void 0,14,14,8,0],119:[22,3,14,7,0,void 0,11,14,7,0,void 0,11,14,15,0,void 0,19,14,15,0],120:[17,3,14,14,0,void 0,14,14,3,0],121:[16,2,14,8,0,void 0,14,14,8,0,6,-4,4,-6,2,-7,1,-7],122:[17,14,14,3,0,void 0,3,14,14,14,void 0,3,0,14,0],123:[14,9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,void 0,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,void 0,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7],124:[8,4,25,4,-7],125:[14,5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,void 0,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,void 0,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7],126:[24,3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,void 0,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]}}}),grn=yt({"node_modules/@jscad/modeling/src/text/vectorParams.js"(t,e){var n=lpi(),o={xOffset:0,yOffset:0,input:"?",align:"left",font:n,height:14,lineSpacing:2.142857142857143,letterSpacing:1,extrudeOffset:0},i=(r,s)=>{!s&&typeof r=="string"&&(r={input:r}),r=r||{};const a=Object.assign({},o,r);return a.input=s||a.input,a};e.exports=i}}),drn=yt({"node_modules/@jscad/modeling/src/text/vectorChar.js"(t,e){var n=grn(),o=(i,r)=>{const{xOffset:s,yOffset:a,input:A,font:c,height:l,extrudeOffset:u}=n(i,r);let g=A.charCodeAt(0);(!g||!c[g])&&(g=63);const h=[].concat(c[g]),d=(l-u)/c.height,p=u/2,m=h.shift()*d,_=[];let f=[];for(let I=0,C=h.length;I<C;I+=2){const y=d*h[I]+s,x=d*h[I+1]+a+p;if(h[I]!==void 0){f.push([y,x]);continue}_.push(f),f=[],I--}return f.length&&_.push(f),{width:m,height:l,segments:_}};e.exports=o}}),upi=yt({"node_modules/@jscad/modeling/src/text/vectorText.js"(t,e){var n=drn(),o=grn(),i=(s,a)=>{const{x:A,y:c}=Object.assign({x:0,y:0},s||{}),l=a.segments;let u=null,g=null;for(let h=0,d=l.length;h<d;h++){u=l[h];for(let p=0,m=u.length;p<m;p++)g=u[p],u[p]=[g[0]+A,g[1]+c]}return a},r=(s,a)=>{const{xOffset:A,yOffset:c,input:l,font:u,height:g,align:h,extrudeOffset:d,lineSpacing:p,letterSpacing:m}=o(s,a);let[_,f]=[A,c],I,C,y,x,E,B,S={width:0,segments:[]};const Q=[];let w=[],M=0;const k=_,R=()=>{Q.push(S),M=Math.max(M,S.width),S={width:0,segments:[]}};for(I=0,C=l.length;I<C;I++){if(y=l[I],x=n({xOffset:_,yOffset:f,font:u,height:g,extrudeOffset:d},y),y===`
`){_=k,f-=x.height*p,R();continue}E=x.width*m,S.width+=E,_+=E,y!==" "&&(S.segments=S.segments.concat(x.segments))}for(S.segments.length&&R(),I=0,C=Q.length;I<C;I++)S=Q[I],M>S.width&&(B=M-S.width,h==="right"?S=i({x:B},S):h==="center"&&(S=i({x:B/2},S))),w=w.concat(S.segments);return w};e.exports=r}}),gpi=yt({"node_modules/@jscad/modeling/src/text/index.js"(t,e){e.exports={vectorChar:drn(),vectorText:upi()}}}),MX=yt({"node_modules/@jscad/modeling/src/utils/areAllShapesTheSameType.js"(t,e){var n=Ya(),o=Ta(),i=Au(),r=s=>{let a;for(const A of s){let c=0;if(n.isA(A)&&(c=1),o.isA(A)&&(c=2),i.isA(A)&&(c=3),a&&c!==a)return!1;a=c}return!0};e.exports=r}}),dpi=yt({"node_modules/@jscad/modeling/src/utils/degToRad.js"(t,e){var n=o=>o*.017453292519943295;e.exports=n}}),hrn=yt({"node_modules/@jscad/modeling/src/utils/fnNumberSort.js"(t,e){var n=(o,i)=>o-i;e.exports=n}}),hpi=yt({"node_modules/@jscad/modeling/src/utils/insertSorted.js"(t,e){var n=(o,i,r)=>{let s=0,a=o.length;for(;a>s;){const A=Math.floor((s+a)/2),c=o[A];r(i,c)>0?s=A+1:a=A}o.splice(s,0,i)};e.exports=n}}),ppi=yt({"node_modules/@jscad/modeling/src/utils/radiusToSegments.js"(t,e){var{TAU:n}=mc(),o=(i,r,s)=>{const a=r>0?i*n/r:0,A=s>0?n/s:0;return Math.ceil(Math.max(a,A,4))};e.exports=o}}),mpi=yt({"node_modules/@jscad/modeling/src/utils/radToDeg.js"(t,e){var n=o=>o*57.29577951308232;e.exports=n}}),prn=yt({"node_modules/@jscad/modeling/src/utils/index.js"(t,e){e.exports={areAllShapesTheSameType:MX(),degToRad:dpi(),flatten:ga(),fnNumberSort:hrn(),insertSorted:hpi(),radiusToSegments:ppi(),radToDeg:mpi()}}}),vVe=yt({"node_modules/@jscad/modeling/src/operations/booleans/fromFakePolygons.js"(t,e){var n=_A(),o=Ya(),i=(s,a)=>{if(a.vertices.length<4)return null;const A=[],c=a.vertices.filter((g,h)=>g[2]>0?(A.push(h),!0):!1);if(c.length!==2)throw new Error("Assertion failed: fromFakePolygon: not enough points found");const l=c.map(g=>{const h=Math.round(g[0]/s)*s+0,d=Math.round(g[1]/s)*s+0;return n.fromValues(h,d)});if(n.equals(l[0],l[1]))return null;const u=A[1]-A[0];if(u===1||u===3)u===1&&l.reverse();else throw new Error("Assertion failed: fromFakePolygon: unknown index ordering");return l},r=(s,a)=>{const A=a.map(c=>i(s,c)).filter(c=>c!==null);return o.create(A)};e.exports=r}}),wVe=yt({"node_modules/@jscad/modeling/src/operations/booleans/to3DWalls.js"(t,e){var n=$r(),o=Ya(),i=Ta(),r=XA(),s=(A,c,l)=>{const u=[n.fromVec2(n.create(),l[0],A),n.fromVec2(n.create(),l[1],A),n.fromVec2(n.create(),l[1],c),n.fromVec2(n.create(),l[0],c)];return r.create(u)},a=(A,c)=>{const u=o.toSides(c).map(h=>s(A.z0,A.z1,h));return i.create(u)};e.exports=a}}),_pi=yt({"node_modules/@jscad/modeling/src/maths/OrthoNormalBasis.js"(t,e){var n=Du(),o=_A(),i=$r(),r=function(s,a){arguments.length<2&&(a=i.orthogonal(i.create(),s)),this.v=i.normalize(i.create(),i.cross(i.create(),s,a)),this.u=i.cross(i.create(),this.v,s),this.plane=s,this.planeorigin=i.scale(i.create(),s,s[3])};r.prototype={getProjectionMatrix:function(){return n.fromValues(this.u[0],this.v[0],this.plane[0],0,this.u[1],this.v[1],this.plane[1],0,this.u[2],this.v[2],this.plane[2],0,0,0,-this.plane[3],1)},getInverseProjectionMatrix:function(){const s=i.scale(i.create(),this.plane,this.plane[3]);return n.fromValues(this.u[0],this.u[1],this.u[2],0,this.v[0],this.v[1],this.v[2],0,this.plane[0],this.plane[1],this.plane[2],0,s[0],s[1],s[2],1)},to2D:function(s){return o.fromValues(i.dot(s,this.u),i.dot(s,this.v))},to3D:function(s){const a=i.scale(i.create(),this.u,s[0]),A=i.scale(i.create(),this.v,s[1]),c=i.add(a,a,this.planeorigin);return i.add(A,A,c)}},e.exports=r}}),fpi=yt({"node_modules/@jscad/modeling/src/operations/modifiers/reTesselateCoplanarPolygons.js"(t,e){var{EPS:n}=mc(),o=EVe(),i=_A(),r=_pi(),s=Win(),{insertSorted:a,fnNumberSort:A}=prn(),c=XA(),l=u=>{if(u.length<2)return u;const g=[],h=u.length,d=c.plane(u[0]),p=new r(d),m=[],_=[],f=new Map,I=new Map,C=new Map,y=10/n;for(let S=0;S<h;S++){const Q=u[S];let w=[],M=Q.vertices.length,k=-1;if(M>0){let R,F;for(let O=0;O<M;O++){let U=p.to2D(Q.vertices[O]);const Y=Math.floor(U[1]*y);let W;C.has(Y)?W=C.get(Y):C.has(Y+1)?W=C.get(Y+1):C.has(Y-1)?W=C.get(Y-1):(W=U[1],C.set(Y,U[1])),U=i.fromValues(U[0],W),w.push(U);const te=U[1];(O===0||te<R)&&(R=te,k=O),(O===0||te>F)&&(F=te);let j=I.get(te);j||(j={},I.set(te,j)),j[S]=!0}if(R>=F)w=[],M=0,k=-1;else{let O=f.get(R);O||(O=[],f.set(R,O)),O.push(S)}}w.reverse(),k=M-k-1,m.push(w),_.push(k)}const x=[];I.forEach((S,Q)=>x.push(Q)),x.sort(A);let E=[],B=[];for(let S=0;S<x.length;S++){const Q=[],w=x[S],M=I.get(w);let k=0;for(let F=0;F<E.length;++F){const O=E[F],U=O.polygonindex;if(M[U]){const Y=m[U],W=Y.length;let te=O.leftvertexindex,j=O.rightvertexindex;for(;;){let oe=te+1;if(oe>=W&&(oe=0),Y[oe][1]!==w)break;te=oe}let J=j-1;if(J<0&&(J=W-1),Y[J][1]===w&&(j=J),te!==O.leftvertexindex&&te===j)O._remove=!0,k++;else{O.leftvertexindex=te,O.rightvertexindex=j,O.topleft=Y[te],O.topright=Y[j];let oe=te+1;oe>=W&&(oe=0),O.bottomleft=Y[oe];let ie=j-1;ie<0&&(ie=W-1),O.bottomright=Y[ie]}}}k>0&&(E=E.filter(F=>!F._remove));let R;if(S>=x.length-1)E=[],R=null;else{R=Number(x[S+1]);const F=.5*(w+R),O=f.get(w);for(const U in O){const Y=O[U],W=m[Y],te=W.length,j=_[Y];let J=j;for(;;){let ge=J+1;if(ge>=te&&(ge=0),W[ge][1]!==w||ge===j)break;J=ge}let oe=j;for(;;){let ge=oe-1;if(ge<0&&(ge=te-1),W[ge][1]!==w||ge===J)break;oe=ge}let ie=J+1;ie>=te&&(ie=0);let ne=oe-1;ne<0&&(ne=te-1);const le={polygonindex:Y,leftvertexindex:J,rightvertexindex:oe,topleft:W[J],topright:W[oe],bottomleft:W[ie],bottomright:W[ne]};a(E,le,(ge,_e)=>{const ue=s(ge.topleft,ge.bottomleft,F),fe=s(_e.topleft,_e.bottomleft,F);return ue>fe?1:ue<fe?-1:0})}}for(const F in E){const O=E[F];let U=s(O.topleft,O.bottomleft,w);const Y=i.fromValues(U,w);U=s(O.topright,O.bottomright,w);const W=i.fromValues(U,w);U=s(O.topleft,O.bottomleft,R);const te=i.fromValues(U,R);U=s(O.topright,O.bottomright,R);const j=i.fromValues(U,R),J={topleft:Y,topright:W,bottomleft:te,bottomright:j,leftline:o.fromPoints(o.create(),Y,te),rightline:o.fromPoints(o.create(),j,W)};if(Q.length>0){const oe=Q[Q.length-1],ie=i.distance(J.topleft,oe.topright),ne=i.distance(J.bottomleft,oe.bottomright);ie<n&&ne<n&&(J.topleft=oe.topleft,J.leftline=oe.leftline,J.bottomleft=oe.bottomleft,Q.splice(Q.length-1,1))}Q.push(J)}if(S>0){const F=new Set,O=new Set;for(let U=0;U<Q.length;U++){const Y=Q[U];for(let W=0;W<B.length;W++)if(!O.has(W)){const te=B[W];if(i.distance(te.bottomleft,Y.topleft)<n&&i.distance(te.bottomright,Y.topright)<n){O.add(W);const j=o.direction(Y.leftline),J=o.direction(te.leftline),oe=j[0]-J[0],ie=o.direction(Y.rightline),ne=o.direction(te.rightline),le=ie[0]-ne[0],ge=Math.abs(oe)<n,_e=Math.abs(le)<n,ue=ge||oe>=0,fe=_e||le>=0;ue&&fe&&(Y.outpolygon=te.outpolygon,Y.leftlinecontinues=ge,Y.rightlinecontinues=_e,F.add(W));break}}}for(let U=0;U<B.length;U++)if(!F.has(U)){const Y=B[U];Y.outpolygon.rightpoints.push(Y.bottomright),i.distance(Y.bottomright,Y.bottomleft)>n&&Y.outpolygon.leftpoints.push(Y.bottomleft),Y.outpolygon.leftpoints.reverse();const te=Y.outpolygon.rightpoints.concat(Y.outpolygon.leftpoints).map(J=>p.to3D(J)),j=c.fromPointsAndPlane(te,d);j.vertices.length&&g.push(j)}}for(let F=0;F<Q.length;F++){const O=Q[F];O.outpolygon?(O.leftlinecontinues||O.outpolygon.leftpoints.push(O.topleft),O.rightlinecontinues||O.outpolygon.rightpoints.push(O.topright)):(O.outpolygon={leftpoints:[],rightpoints:[]},O.outpolygon.leftpoints.push(O.topleft),i.distance(O.topleft,O.topright)>n&&O.outpolygon.rightpoints.push(O.topright))}B=Q}return g};e.exports=l}}),DX=yt({"node_modules/@jscad/modeling/src/operations/modifiers/retessellate.js"(t,e){var n=Ta(),o=XA(),{NEPS:i}=mc(),r=fpi(),s=c=>{if(c.isRetesselated)return c;const l=n.toPolygons(c).map((d,p)=>({vertices:d.vertices,plane:o.plane(d),index:p})),u=a(l),g=[];u.forEach(d=>{if(Array.isArray(d)){const p=r(d);for(let m=0;m<p.length;m++)g.push(p[m])}else g.push(d)});const h=n.create(g);return h.isRetesselated=!0,h},a=c=>{let l=[c];const u=[];for(let h=3;h>=0;h--){const d=[],p=h===3?15e-9:i;l.forEach(m=>{m.sort(A(h,p));let _=0;for(let f=1;f<m.length;f++)m[f].plane[h]-m[_].plane[h]>p&&(f-_===1?u.push(m[_]):d.push(m.slice(_,f)),_=f);m.length-_===1?u.push(m[_]):d.push(m.slice(_))}),l=d}const g=[];return l.forEach(h=>{h[0]&&(g[h[0].index]=h)}),u.forEach(h=>{g[h.index]=h}),g},A=(c,l)=>(u,g)=>u.plane[c]-g.plane[c]>l?1:g.plane[c]-u.plane[c]>l?-1:0;e.exports=s}}),PVe=yt({"node_modules/@jscad/modeling/src/operations/booleans/mayOverlap.js"(t,e){var{EPS:n}=mc(),o=oT(),i=(r,s)=>{if(r.polygons.length===0||s.polygons.length===0)return!1;const a=o(r),A=a[0],c=a[1],l=o(s),u=l[0],g=l[1];return!(u[0]-c[0]>n||A[0]-g[0]>n||u[1]-c[1]>n||A[1]-g[1]>n||u[2]-c[2]>n||A[2]-g[2]>n)};e.exports=i}}),Ipi=yt({"node_modules/@jscad/modeling/src/operations/booleans/trees/Node.js"(t,e){var n=S6(),o=XA(),i=class bit{constructor(s){this.plane=null,this.front=null,this.back=null,this.polygontreenodes=[],this.parent=s}invert(){const s=[this];let a;for(let A=0;A<s.length;A++){a=s[A],a.plane&&(a.plane=n.flip(n.create(),a.plane)),a.front&&s.push(a.front),a.back&&s.push(a.back);const c=a.front;a.front=a.back,a.back=c}}clipPolygons(s,a){let A={node:this,polygontreenodes:s},c;const l=[];do{if(c=A.node,s=A.polygontreenodes,c.plane){const u=c.plane,g=[],h=[],d=a?g:h,p=s.length;for(let _=0;_<p;_++){const f=s[_];f.isRemoved()||f.splitByPlane(u,d,g,h,g)}c.front&&h.length>0&&l.push({node:c.front,polygontreenodes:h});const m=g.length;if(c.back&&m>0)l.push({node:c.back,polygontreenodes:g});else for(let _=0;_<m;_++)g[_].remove()}A=l.pop()}while(A!==void 0)}clipTo(s,a){let A=this;const c=[];do A.polygontreenodes.length>0&&s.rootnode.clipPolygons(A.polygontreenodes,a),A.front&&c.push(A.front),A.back&&c.push(A.back),A=c.pop();while(A!==void 0)}addPolygonTreeNodes(s){let a={node:this,polygontreenodes:s};const A=[];do{const c=a.node,l=a.polygontreenodes;if(l.length===0){a=A.pop();continue}if(!c.plane){let d=0;d=Math.floor(l.length/2);const p=l[d].getPolygon();c.plane=o.plane(p)}const u=[],g=[],h=l.length;for(let d=0;d<h;++d)l[d].splitByPlane(c.plane,c.polygontreenodes,g,u,g);u.length>0&&(c.front||(c.front=new bit(c)),h===u.length&&g.length===0?c.front.polygontreenodes=u:A.push({node:c.front,polygontreenodes:u})),g.length>0&&(c.back||(c.back=new bit(c)),h===g.length&&u.length===0?c.back.polygontreenodes=g:A.push({node:c.back,polygontreenodes:g})),a=A.pop()}while(a!==void 0)}};e.exports=i}}),Cpi=yt({"node_modules/@jscad/modeling/src/operations/booleans/trees/splitLineSegmentByPlane.js"(t,e){var n=$r(),o=(i,r,s)=>{const a=n.subtract(n.create(),s,r);let A=(i[3]-n.dot(i,r))/n.dot(i,a);return Number.isNaN(A)&&(A=0),A>1&&(A=1),A<0&&(A=0),n.scale(a,a,A),n.add(a,r,a),a};e.exports=o}}),ypi=yt({"node_modules/@jscad/modeling/src/operations/booleans/trees/splitPolygonByPlane.js"(t,e){var{EPS:n}=mc(),o=S6(),i=$r(),r=XA(),s=Cpi(),a=n*n,A=l=>{const u=[];let g=l[l.length-1];for(let h=0;h<l.length;h++){const d=l[h];i.squaredDistance(d,g)>=a&&u.push(d),g=d}return u},c=(l,u)=>{const g={type:null,front:null,back:null},h=u.vertices,d=h.length,p=r.plane(u);if(o.equals(p,l))g.type=0;else{let m=!1,_=!1;const f=[],I=-n;for(let C=0;C<d;C++){const y=i.dot(l,h[C])-l[3],x=y<I;f.push(x),y>n&&(m=!0),y<I&&(_=!0)}if(!m&&!_){const C=i.dot(l,p);g.type=C>=0?0:1}else if(!_)g.type=2;else if(!m)g.type=3;else{g.type=4;const C=[],y=[];let x=f[0];for(let E=0;E<d;E++){const B=h[E];let S=E+1;S>=d&&(S=0);const Q=f[S];if(x===Q)x?y.push(B):C.push(B);else{const w=h[S],M=s(l,B,w);x?(y.push(B),y.push(M),C.push(M)):(C.push(B),C.push(M),y.push(M))}x=Q}if(C.length>=3){const E=A(C);E.length>=3&&(g.front=r.fromPointsAndPlane(E,p))}if(y.length>=3){const E=A(y);E.length>=3&&(g.back=r.fromPointsAndPlane(E,p))}}}return g};e.exports=c}}),xpi=yt({"node_modules/@jscad/modeling/src/operations/booleans/trees/PolygonTreeNode.js"(t,e){var{EPS:n}=mc(),o=$r(),i=XA(),r=ypi(),s=class C4n{constructor(A,c){this.parent=A,this.children=[],this.polygon=c,this.removed=!1}addPolygons(A){if(!this.isRootNode())throw new Error("Assertion failed");const c=this;A.forEach(l=>{c.addChild(l)})}remove(){this.removed||(this.removed=!0,this.polygon=null,this.parent.recursivelyInvalidatePolygon())}isRemoved(){return this.removed}isRootNode(){return!this.parent}invert(){if(!this.isRootNode())throw new Error("Assertion failed");this.invertSub()}getPolygon(){if(!this.polygon)throw new Error("Assertion failed");return this.polygon}getPolygons(A){if(this.isRootNode()&&this.children.length>0){const p=[];for(let m=0;m<this.children.length;m++)this.children[m].removed||p.push(this.children[m]);this.children=p}let c=[this];const l=[c];let u,g,h,d;for(u=0;u<l.length;++u)for(c=l[u],g=0,h=c.length;g<h;g++)d=c[g],d.polygon?A.push(d.polygon):d.children.length>0&&l.push(d.children)}splitByPlane(A,c,l,u,g){if(this.children.length){const h=[this.children];let d,p,m,_,f;for(d=0;d<h.length;d++)for(f=h[d],p=0,m=f.length;p<m;p++)_=f[p],_.children.length>0?h.push(_.children):_._splitByPlane(A,c,l,u,g)}else this._splitByPlane(A,c,l,u,g)}_splitByPlane(A,c,l,u,g){const h=this.polygon;if(h){const d=i.measureBoundingSphere(h),p=d[3]+n,m=d,_=o.dot(A,m)-A[3];if(_>p)u.push(this);else if(_<-p)g.push(this);else{const f=r(A,h);switch(f.type){case 0:c.push(this);break;case 1:l.push(this);break;case 2:u.push(this);break;case 3:g.push(this);break;case 4:if(f.front){const I=this.addChild(f.front);u.push(I)}if(f.back){const I=this.addChild(f.back);g.push(I)}break}}}}addChild(A){const c=new C4n(this,A);return this.children.push(c),c}invertSub(){let A=[this];const c=[A];let l,u,g,h;for(l=0;l<c.length;l++)for(A=c[l],u=0,g=A.length;u<g;u++)h=A[u],h.polygon&&(h.polygon=i.invert(h.polygon)),h.children.length>0&&c.push(h.children)}recursivelyInvalidatePolygon(){this.polygon=null,this.parent&&this.parent.recursivelyInvalidatePolygon()}clear(){let A=[this];const c=[A];for(let l=0;l<c.length;++l){A=c[l];const u=A.length;for(let g=0;g<u;g++){const h=A[g];h.polygon&&(h.polygon=null),h.parent&&(h.parent=null),h.children.length>0&&c.push(h.children),h.children=[]}}}toString(){let A="",c=[this];const l=[c];let u,g,h,d;for(u=0;u<l.length;++u){c=l[u];const p=" ".repeat(u);for(g=0,h=c.length;g<h;g++)d=c[g],A+=`${p}PolygonTreeNode (${d.isRootNode()}): ${d.children.length}`,d.polygon?A+=`
${p}polygon: ${d.polygon.vertices}
`:A+=`
`,d.children.length>0&&l.push(d.children)}return A}};e.exports=s}}),Epi=yt({"node_modules/@jscad/modeling/src/operations/booleans/trees/Tree.js"(t,e){var n=Ipi(),o=xpi(),i=class{constructor(r){this.polygonTree=new o,this.rootnode=new n(null),r&&this.addPolygons(r)}invert(){this.polygonTree.invert(),this.rootnode.invert()}clipTo(r,s=!1){this.rootnode.clipTo(r,s)}allPolygons(){const r=[];return this.polygonTree.getPolygons(r),r}addPolygons(r){const s=new Array(r.length);for(let a=0;a<r.length;a++)s[a]=this.polygonTree.addChild(r[a]);this.rootnode.addPolygonTreeNodes(s)}clear(){this.polygonTree.clear()}toString(){return"Tree: "+this.polygonTree.toString("")}};e.exports=i}}),MVe=yt({"node_modules/@jscad/modeling/src/operations/booleans/trees/index.js"(t,e){e.exports={Tree:Epi()}}}),Bpi=yt({"node_modules/@jscad/modeling/src/operations/booleans/intersectGeom3Sub.js"(t,e){var n=Ta(),o=PVe(),{Tree:i}=MVe(),r=(s,a)=>{if(!o(s,a))return n.create();const A=new i(n.toPolygons(s)),c=new i(n.toPolygons(a));A.invert(),c.clipTo(A),c.invert(),A.clipTo(c),c.clipTo(A),A.addPolygons(c.allPolygons()),A.invert();const l=A.allPolygons();return n.create(l)};e.exports=r}}),mrn=yt({"node_modules/@jscad/modeling/src/operations/booleans/intersectGeom3.js"(t,e){var n=ga(),o=DX(),i=Bpi(),r=(...s)=>{s=n(s);let a=s.shift();return s.forEach(A=>{a=i(a,A)}),a=o(a),a};e.exports=r}}),bpi=yt({"node_modules/@jscad/modeling/src/operations/booleans/intersectGeom2.js"(t,e){var n=ga(),o=Ta(),i=gP(),r=vVe(),s=wVe(),a=mrn(),A=(...c)=>{c=n(c);const l=c.map(h=>s({z0:-1,z1:1},h)),u=a(l),g=i(u);return r(g,o.toPolygons(u))};e.exports=A}}),Spi=yt({"node_modules/@jscad/modeling/src/operations/booleans/intersect.js"(t,e){var n=ga(),o=MX(),i=Ya(),r=Ta(),s=bpi(),a=mrn(),A=(...c)=>{if(c=n(c),c.length===0)throw new Error("wrong number of arguments");if(!o(c))throw new Error("only intersect of the types are supported");const l=c[0];return i.isA(l)?s(c):r.isA(l)?a(c):l};e.exports=A}}),DVe=yt({"node_modules/@jscad/modeling/src/operations/hulls/hullPoints3.js"(t,e){var n=XA(),o=yin(),i=r=>o(r,{skipTriangulation:!0}).map(A=>{const c=A.map(l=>r[l]);return n.create(c)});e.exports=i}}),_rn=yt({"node_modules/@jscad/modeling/src/operations/booleans/unionGeom3Sub.js"(t,e){var n=Ta(),o=PVe(),{Tree:i}=MVe(),r=(a,A)=>{if(!o(a,A))return s(a,A);const c=new i(n.toPolygons(a)),l=new i(n.toPolygons(A));c.clipTo(l,!1),l.clipTo(c),l.invert(),l.clipTo(c),l.invert();const u=c.allPolygons().concat(l.allPolygons());return n.create(u)},s=(a,A)=>{let c=n.toPolygons(a);return c=c.concat(n.toPolygons(A)),n.create(c)};e.exports=r}}),NVe=yt({"node_modules/@jscad/modeling/src/operations/booleans/unionGeom3.js"(t,e){var n=ga(),o=DX(),i=_rn(),r=(...s)=>{s=n(s);let a;for(a=1;a<s.length;a+=2)s.push(i(s[a-1],s[a]));let A=s[a-1];return A=o(A),A};e.exports=r}}),frn=yt({"node_modules/@jscad/modeling/src/operations/minkowski/minkowskiSum.js"(t,e){var n=ga(),o=Ta(),i=XA(),r=DVe(),s=NVe(),a=(...h)=>{if(h=n(h),h.length!==2)throw new Error("minkowskiSum requires exactly two geometries");const[d,p]=h;if(!o.isA(d)||!o.isA(p))throw new Error("minkowskiSum requires geom3 geometries");const m=o.isConvex(d),_=o.isConvex(p);if(m&&_)return u(d,p);if(!m&&_)return A(d,p);if(m&&!_)return A(p,d);throw new Error("minkowskiSum of two non-convex geometries is not yet supported")},A=(h,d)=>{const p=c(h);if(p.length===0)return o.create();const m=p.map(_=>u(_,d));return m.length===1?m[0]:s(m)},c=h=>{const d=o.toPolygons(h);if(d.length===0)return[];const p=[];for(let m=0;m<d.length;m++){const _=d[m],f=_.vertices;let I=0,C=0,y=0;for(let M=0;M<f.length;M++)I+=f[M][0],C+=f[M][1],y+=f[M][2];I/=f.length,C/=f.length,y/=f.length;const x=i.plane(_),E=x[0],B=x[1],S=x[2],Q=.1,w=[I-E*Q,C-B*Q,y-S*Q];for(let M=1;M<f.length-1;M++){const k=f[0],R=f[M],F=f[M+1],O=l(w,k,R,F);p.push(o.create(O))}}return p},l=(h,d,p,m)=>[i.create([h,p,d]),i.create([h,d,m]),i.create([d,p,m]),i.create([p,h,m])],u=(h,d)=>{const p=g(h),m=g(d);if(p.length===0||m.length===0)return o.create();const _=[];for(let I=0;I<p.length;I++){const C=p[I];for(let y=0;y<m.length;y++){const x=m[y];_.push([C[0]+x[0],C[1]+x[1],C[2]+x[2]])}}const f=r(_);return o.create(f)},g=h=>{const d=new Set,p=[],m=o.toPolygons(h);for(let _=0;_<m.length;_++){const f=m[_].vertices;for(let I=0;I<f.length;I++){const C=f[I],y=`${C[0]},${C[1]},${C[2]}`;d.has(y)||(d.add(y),p.push(C))}}return p};e.exports=a}}),Qpi=yt({"node_modules/@jscad/modeling/src/operations/booleans/scissionGeom3.js"(t,e){var n=$r(),o=gP(),i=Ta(),r=c=>c.sort((l,u)=>l-u).filter((l,u,g)=>!u||l!==g[u-1]),s=(c,l,u)=>{const g=`${l}`,h=c.get(g);h===void 0?c.set(g,[u]):h.push(u)},a=(c,l)=>{const u=`${l}`;return c.get(u)},A=c=>{const l=o(c),u=i.toPolygons(c),g=u.length,h=new Map,d=n.create();u.forEach((I,C)=>{I.vertices.forEach(y=>{s(h,n.snap(d,y,l),C)})});const p=u.map(I=>{let C=[];return I.vertices.forEach(y=>{C=C.concat(a(h,n.snap(d,y,l)))}),{e:1,d:r(C)}});h.clear();let m=0;const _=p.length;for(let I=0;I<_;I++){const C=p[I];if(C.e>0){const y=new Array(g);y[I]=!0;do m=0,y.forEach((x,E)=>{const B=p[E];if(B.e>0){B.e=-1;for(let S=0;S<B.d.length;S++)y[B.d[S]]=!0;m++}});while(m>0);C.indexes=y}}const f=[];for(let I=0;I<_;I++)if(p[I].indexes){const C=[];p[I].indexes.forEach((y,x)=>C.push(u[x])),f.push(i.create(C))}return f};e.exports=A}}),vpi=yt({"node_modules/@jscad/modeling/src/operations/booleans/scission.js"(t,e){var n=ga(),o=Ta(),i=Qpi(),r=(...s)=>{if(s=n(s),s.length===0)throw new Error("wrong number of arguments");const a=s.map(A=>o.isA(A)?i(A):A);return a.length===1?a[0]:a};e.exports=r}}),wpi=yt({"node_modules/@jscad/modeling/src/operations/booleans/subtractGeom3Sub.js"(t,e){var n=Ta(),o=PVe(),{Tree:i}=MVe(),r=(s,a)=>{if(!o(s,a))return n.clone(s);const A=new i(n.toPolygons(s)),c=new i(n.toPolygons(a));A.invert(),A.clipTo(c),c.clipTo(A,!0),A.addPolygons(c.allPolygons()),A.invert();const l=A.allPolygons();return n.create(l)};e.exports=r}}),Irn=yt({"node_modules/@jscad/modeling/src/operations/booleans/subtractGeom3.js"(t,e){var n=ga(),o=DX(),i=wpi(),r=(...s)=>{s=n(s);let a=s.shift();return s.forEach(A=>{a=i(a,A)}),a=o(a),a};e.exports=r}}),Ppi=yt({"node_modules/@jscad/modeling/src/operations/booleans/subtractGeom2.js"(t,e){var n=ga(),o=Ta(),i=gP(),r=vVe(),s=wVe(),a=Irn(),A=(...c)=>{c=n(c);const l=c.map(h=>s({z0:-1,z1:1},h)),u=a(l),g=i(u);return r(g,o.toPolygons(u))};e.exports=A}}),Mpi=yt({"node_modules/@jscad/modeling/src/operations/booleans/subtract.js"(t,e){var n=ga(),o=MX(),i=Ya(),r=Ta(),s=Ppi(),a=Irn(),A=(...c)=>{if(c=n(c),c.length===0)throw new Error("wrong number of arguments");if(!o(c))throw new Error("only subtract of the types are supported");const l=c[0];return i.isA(l)?s(c):r.isA(l)?a(c):l};e.exports=A}}),Crn=yt({"node_modules/@jscad/modeling/src/operations/booleans/unionGeom2.js"(t,e){var n=ga(),o=Ta(),i=gP(),r=vVe(),s=wVe(),a=NVe(),A=(...c)=>{c=n(c);const l=c.map(h=>s({z0:-1,z1:1},h)),u=a(l),g=i(u);return r(g,o.toPolygons(u))};e.exports=A}}),RVe=yt({"node_modules/@jscad/modeling/src/operations/booleans/union.js"(t,e){var n=ga(),o=MX(),i=Ya(),r=Ta(),s=Crn(),a=NVe(),A=(...c)=>{if(c=n(c),c.length===0)throw new Error("wrong number of arguments");if(!o(c))throw new Error("only unions of the same type are supported");const l=c[0];return i.isA(l)?s(c):r.isA(l)?a(c):l};e.exports=A}}),NX=yt({"node_modules/@jscad/modeling/src/operations/booleans/index.js"(t,e){e.exports={intersect:Spi(),minkowski:frn(),scission:vpi(),subtract:Mpi(),union:RVe()}}}),ipe=yt({"node_modules/@jscad/modeling/src/operations/expansions/offsetFromPoints.js"(t,e){var{EPS:n,TAU:o}=mc(),i=jin(),r=EVe(),s=_A(),a=tpe(),A=(c,l)=>{const u={delta:1,corners:"edge",closed:!1,segments:16};let{delta:g,corners:h,closed:d,segments:p}=Object.assign({},u,c);if(Math.abs(g)<n)return l;let m=c.closed?a(l):1;m===0&&(m=1);const _=m>0&&g>=0||m<0&&g<0;g=Math.abs(g);let f=null,I=[];const C=[],y=s.create(),x=l.length;for(let E=0;E<x;E++){const B=(E+1)%x,S=l[E],Q=l[B];_?s.subtract(y,S,Q):s.subtract(y,Q,S),s.normal(y,y),s.normalize(y,y),s.scale(y,y,g);const w=s.add(s.create(),S,y),M=s.add(s.create(),Q,y),k=[w,M];if(f!=null&&(d||!d&&B!==0)){const R=i(f[0],f[1],k[0],k[1]);R?(I.pop(),k[0]=R):C.push({c:S,s0:f,s1:k})}f=[w,M],!(B===0&&!d)&&(I.push(k[0]),I.push(k[1]))}if(d&&f!=null){const E=I[0],B=I[1],S=i(f[0],f[1],E,B);if(S)I[0]=S,I.pop();else{const Q=l[0],w=[E,B];C.push({c:Q,s0:f,s1:w})}}if(h==="edge"){const E=new Map;I.forEach((Q,w)=>E.set(Q,w));const B=r.create(),S=r.create();C.forEach(Q=>{r.fromPoints(B,Q.s0[0],Q.s0[1]),r.fromPoints(S,Q.s1[0],Q.s1[1]);const w=r.intersectPointOfLines(B,S);if(Number.isFinite(w[0])&&Number.isFinite(w[1])){const M=Q.s0[1],k=E.get(M);I[k]=w,I[(k+1)%I.length]=void 0}else{const M=Q.s1[0],k=E.get(M);I[k]=void 0}}),I=I.filter(Q=>Q!==void 0)}if(h==="round"){let E=Math.floor(p/4);const B=s.create();C.forEach(S=>{let Q=s.angle(s.subtract(B,S.s1[0],S.c));if(Q-=s.angle(s.subtract(B,S.s0[1],S.c)),_&&Q<0&&(Q=Q+Math.PI,Q<0&&(Q=Q+Math.PI)),!_&&Q>0&&(Q=Q-Math.PI,Q>0&&(Q=Q-Math.PI)),Q!==0){E=Math.floor(p*(Math.abs(Q)/o));const w=Q/E,M=s.angle(s.subtract(B,S.s0[1],S.c)),k=[];for(let R=1;R<E;R++){const F=M+w*R,O=s.fromAngleRadians(s.create(),F);s.scale(O,O,g),s.add(O,O,S.c),k.push(O)}if(k.length>0){const R=S.s0[1];let F=I.findIndex(O=>s.equals(R,O));F=(F+1)%I.length,I.splice(F,0,...k)}}else{const w=S.s1[0],M=I.findIndex(k=>s.equals(w,k));I.splice(M,1)}})}return I};e.exports=A}}),Dpi=yt({"node_modules/@jscad/modeling/src/operations/expansions/expandGeom2.js"(t,e){var n=Ya(),o=ipe(),i=(r,s)=>{const a={delta:1,corners:"edge",segments:16},{delta:A,corners:c,segments:l}=Object.assign({},a,r);if(!(c==="edge"||c==="chamfer"||c==="round"))throw new Error('corners must be "edge", "chamfer", or "round"');const h=n.toOutlines(s).map(d=>(r={delta:A,corners:c,closed:!0,segments:l},o(r,d))).reduce((d,p)=>d.concat(n.toSides(n.fromPoints(p))),[]);return n.create(h)};e.exports=i}}),Npi=yt({"node_modules/@jscad/modeling/src/operations/expansions/extrudePolygon.js"(t,e){var n=Du(),o=$r(),i=Ta(),r=XA(),s=(a,A)=>{o.dot(r.plane(A),a)>0&&(A=r.invert(A));const l=[A],u=r.transform(n.fromTranslation(n.create(),a),A),g=A.vertices.length;for(let h=0;h<g;h++){const d=h<g-1?h+1:0,p=r.create([A.vertices[h],u.vertices[h],u.vertices[d],A.vertices[d]]);l.push(p)}return l.push(r.invert(u)),i.create(l)};e.exports=s}}),Rpi=yt({"node_modules/@jscad/modeling/src/operations/expansions/expandShell.js"(t,e){var{EPS:n,TAU:o}=mc(),i=Du(),r=$r(),s=hrn(),a=Ta(),A=XA(),c=arn(),l=DX(),u=_rn(),g=Npi(),h=(_,f,I)=>{const C=f.toString();if(_.has(C))_.get(C)[1].push(I);else{const y=[f,[I]];_.set(C,y)}},d=(_,f,I)=>{const C=f[0].toString(),y=f[1].toString(),x=C<y?`${C},${y}`:`${y},${C}`;if(_.has(x))_.get(x)[1].push(I);else{const E=[f,[I]];_.set(x,E)}},p=(_,f)=>{_.findIndex(C=>C===f)<0&&_.push(f)},m=(_,f)=>{const I={delta:1,segments:12},{delta:C,segments:y}=Object.assign({},I,_);let x=a.create();const E=new Map,B=new Map,S=r.create(),Q=r.create();return a.toPolygons(f).forEach((M,k)=>{const R=r.scale(r.create(),A.plane(M),2*C),F=A.transform(i.fromTranslation(i.create(),r.scale(r.create(),R,-.5)),M),O=g(R,F);x=u(x,O);const U=M.vertices;for(let Y=0;Y<U.length;Y++){h(E,U[Y],A.plane(M));const W=(Y+1)%U.length,te=[U[Y],U[W]];d(B,te,A.plane(M))}}),B.forEach(M=>{const k=M[0],R=M[1],F=k[0],O=k[1],U=r.subtract(r.create(),O,F);r.normalize(U,U);const Y=R[0],W=r.cross(r.create(),Y,U);let te=[];for(let _e=0;_e<y;_e++)p(te,_e*o/y);for(let _e=0,ue=R.length;_e<ue;_e++){const fe=R[_e],pe=r.dot(W,fe),ye=r.dot(Y,fe);let Me=Math.atan2(pe,ye);Me<0&&(Me+=o),p(te,Me),Me=Math.atan2(-pe,-ye),Me<0&&(Me+=o),p(te,Me)}te=te.sort(s);const j=te.length;let J,oe;const ie=[],ne=[],le=[];for(let _e=-1;_e<j;_e++){const ue=te[_e<0?_e+j:_e],fe=Math.sin(ue),pe=Math.cos(ue);r.scale(S,Y,pe*C),r.scale(Q,W,fe*C),r.add(S,S,Q);const ye=r.add(r.create(),F,S),Me=r.add(r.create(),O,S);let ve=!1;if(_e>=0&&r.distance(ye,J)<n&&(ve=!0),!ve){if(_e>=0){ie.push(ye),ne.push(Me);const he=[oe,Me,ye,J],Qe=A.create(he);le.push(Qe)}J=ye,oe=Me}}ne.reverse(),le.push(A.create(ie)),le.push(A.create(ne));const ge=a.create(le);x=u(x,ge)}),E.forEach(M=>{const k=M[0],R=M[1],F=R[0];let O=null,U=0;for(let j=1;j<R.length;j++){const J=R[j],oe=r.cross(S,F,J),ie=r.length(oe);ie>.05&&ie>U&&(U=ie,O=J)}O||(O=r.orthogonal(S,F));const Y=r.cross(S,F,O);r.normalize(Y,Y);const W=r.cross(Q,Y,F),te=c({center:[k[0],k[1],k[2]],radius:C,segments:y,axes:[F,Y,W]});x=u(x,te)}),l(x)};e.exports=m}}),Tpi=yt({"node_modules/@jscad/modeling/src/operations/expansions/expandGeom3.js"(t,e){var n=Ta(),o=RVe(),i=Rpi(),r=(s,a)=>{const A={delta:1,corners:"round",segments:12},{delta:c,corners:l,segments:u}=Object.assign({},A,s);if(l!=="round")throw new Error('corners must be "round" for 3D geometries');if(n.toPolygons(a).length===0)throw new Error("the given geometry cannot be empty");s={delta:c,corners:l,segments:u};const h=i(s,a);return o(a,h)};e.exports=r}}),kpi=yt({"node_modules/@jscad/modeling/src/operations/expansions/expandPath2.js"(t,e){var n=tpe(),o=_A(),i=Ya(),r=Au(),s=ipe(),a=l=>{let{external:u,internal:g}=l;n(u)<0?u=u.reverse():g=g.reverse();const h=r.fromPoints({closed:!0},u),d=r.fromPoints({closed:!0},g),p=i.toSides(i.fromPoints(r.toPoints(h))),m=i.toSides(i.fromPoints(r.toPoints(d)));return p.push(...m),i.create(p)},A=(l,u,g,h)=>{const{points:d,external:p,internal:m}=l,_=Math.floor(u/2),f=[],I=[];if(g==="round"&&_>0){const y=Math.PI/_,x=d[d.length-1],E=o.angle(o.subtract(o.create(),p[p.length-1],x)),B=d[0],S=o.angle(o.subtract(o.create(),m[0],B));for(let Q=1;Q<_;Q++){let w=E+y*Q,M=o.fromAngleRadians(o.create(),w);o.scale(M,M,h),o.add(M,M,x),f.push(M),w=S+y*Q,M=o.fromAngleRadians(o.create(),w),o.scale(M,M,h),o.add(M,M,B),I.push(M)}}const C=[];return C.push(...p,...f,...m.reverse(),...I),i.fromPoints(C)},c=(l,u)=>{l=Object.assign({},{delta:1,corners:"edge",segments:16},l);const{delta:h,corners:d,segments:p}=l;if(h<=0)throw new Error("the given delta must be positive for paths");if(!(d==="edge"||d==="chamfer"||d==="round"))throw new Error('corners must be "edge", "chamfer", or "round"');const m=u.isClosed,_=r.toPoints(u);if(_.length===0)throw new Error("the given geometry cannot be empty");const f={points:_,external:s({delta:h,corners:d,segments:p,closed:m},_),internal:s({delta:-h,corners:d,segments:p,closed:m},_)};return u.isClosed?a(f):A(f,p,d,h)};e.exports=c}}),TVe=yt({"node_modules/@jscad/modeling/src/operations/expansions/expand.js"(t,e){var n=ga(),o=Ya(),i=Ta(),r=Au(),s=Dpi(),a=Tpi(),A=kpi(),c=(l,...u)=>{if(u=n(u),u.length===0)throw new Error("wrong number of arguments");const g=u.map(h=>r.isA(h)?A(l,h):o.isA(h)?s(l,h):i.isA(h)?a(l,h):h);return g.length===1?g[0]:g};e.exports=c}}),Fpi=yt({"node_modules/@jscad/modeling/src/operations/expansions/offsetGeom2.js"(t,e){var n=Ya(),o=fVe(),i=ipe(),r=(s,a)=>{const A={delta:1,corners:"edge",segments:0},{delta:c,corners:l,segments:u}=Object.assign({},A,s);if(!(l==="edge"||l==="chamfer"||l==="round"))throw new Error('corners must be "edge", "chamfer", or "round"');const g=n.toOutlines(a),d=g.map(p=>(s={delta:g.reduce((f,I)=>f+o.arePointsInside(p,o.create(I)),0)%2===0?c:-c,corners:l,closed:!0,segments:u},i(s,p))).reduce((p,m)=>p.concat(n.toSides(n.fromPoints(m))),[]);return n.create(d)};e.exports=r}}),Lpi=yt({"node_modules/@jscad/modeling/src/operations/expansions/offsetPath2.js"(t,e){var n=Au(),o=ipe(),i=(r,s)=>{const a={delta:1,corners:"edge",closed:s.isClosed,segments:16},{delta:A,corners:c,closed:l,segments:u}=Object.assign({},a,r);if(!(c==="edge"||c==="chamfer"||c==="round"))throw new Error('corners must be "edge", "chamfer", or "round"');r={delta:A,corners:c,closed:l,segments:u};const g=o(r,n.toPoints(s));return n.fromPoints({closed:l},g)};e.exports=i}}),Hpi=yt({"node_modules/@jscad/modeling/src/operations/expansions/offset.js"(t,e){var n=ga(),o=Ya(),i=Au(),r=Fpi(),s=Lpi(),a=(A,...c)=>{if(c=n(c),c.length===0)throw new Error("wrong number of arguments");const l=c.map(u=>i.isA(u)?s(A,u):o.isA(u)?r(A,u):u);return l.length===1?l[0]:l};e.exports=a}}),yrn=yt({"node_modules/@jscad/modeling/src/operations/expansions/index.js"(t,e){e.exports={expand:TVe(),offset:Hpi()}}}),rpe=yt({"node_modules/@jscad/modeling/src/operations/extrusions/extrudeLinearGeom2.js"(t,e){var n=Du(),o=$r(),i=Ya(),r=DY(),s=ope(),a=(A,c)=>{const l={offset:[0,0,1],twistAngle:0,twistSteps:12,repair:!0};let{offset:u,twistAngle:g,twistSteps:h,repair:d}=Object.assign({},l,A);if(h<1)throw new Error("twistSteps must be 1 or more");g===0&&(h=1);const p=o.clone(u),m=i.toSides(c);if(m.length===0)throw new Error("the given geometry cannot be empty");const _=r.fromSides(m);p[2]<0&&r.reverse(_,_);const f=n.create(),I=(C,y,x)=>{const E=y/h*g,B=o.scale(o.create(),p,y/h);return n.multiply(f,n.fromZRotation(f,E),n.fromTranslation(n.create(),B)),r.transform(f,x)};return A={numberOfSlices:h+1,capStart:!0,capEnd:!0,repair:d,callback:I},s(A,_)};e.exports=a}}),Opi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/extrudeLinearPath2.js"(t,e){var n=Ya(),o=Au(),i=rpe(),r=(s,a)=>{if(!a.isClosed)throw new Error("extruded path must be closed");const A=o.toPoints(a),c=n.fromPoints(A);return i(s,c)};e.exports=r}}),Gpi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/extrudeLinear.js"(t,e){var n=ga(),o=Ya(),i=Au(),r=rpe(),s=Opi(),a=(A,...c)=>{const l={height:1,twistAngle:0,twistSteps:1,repair:!0},{height:u,twistAngle:g,twistSteps:h,repair:d}=Object.assign({},l,A);if(c=n(c),c.length===0)throw new Error("wrong number of arguments");A={offset:[0,0,u],twistAngle:g,twistSteps:h,repair:d};const p=c.map(m=>i.isA(m)?s(A,m):o.isA(m)?r(A,m):m);return p.length===1?p[0]:p};e.exports=a}}),Ypi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/extrudeRectangularPath2.js"(t,e){var n=Au(),o=TVe(),i=rpe(),r=(s,a)=>{const A={size:1,height:1},{size:c,height:l}=Object.assign({},A,s);if(s.delta=c,s.offset=[0,0,l],n.toPoints(a).length===0)throw new Error("the given geometry cannot be empty");const g=o(s,a);return i(s,g)};e.exports=r}}),Upi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/extrudeRectangularGeom2.js"(t,e){var{area:n}=QX(),o=Ya(),i=Au(),r=TVe(),s=rpe(),a=(A,c)=>{const l={size:1,height:1},{size:u,height:g}=Object.assign({},l,A);A.delta=u,A.offset=[0,0,g];const h=o.toOutlines(c);if(h.length===0)throw new Error("the given geometry cannot be empty");const p=h.map(_=>(n(_)<0&&_.reverse(),r(A,i.fromPoints({closed:!0},_)))).reduce((_,f)=>_.concat(o.toSides(f)),[]),m=o.create(p);return s(A,m)};e.exports=a}}),Kpi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/extrudeRectangular.js"(t,e){var n=ga(),o=Ya(),i=Au(),r=Ypi(),s=Upi(),a=(A,...c)=>{const l={size:1,height:1},{size:u,height:g}=Object.assign({},l,A);if(c=n(c),c.length===0)throw new Error("wrong number of arguments");if(u<=0)throw new Error("size must be positive");if(g<=0)throw new Error("height must be positive");const h=c.map(d=>i.isA(d)?r(A,d):o.isA(d)?s(A,d):d);return h.length===1?h[0]:h};e.exports=a}}),Vpi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/extrudeHelical.js"(t,e){var{TAU:n}=mc(),o=Du(),i=Ya(),r=ope(),s=DY(),a=(A,c)=>{const l={angle:n,startAngle:0,pitch:10,height:0,endOffset:0,segmentsPerRotation:32};let{angle:u,startAngle:g,pitch:h,height:d,endOffset:p,segmentsPerRotation:m}=Object.assign({},l,A);if(d!=0&&(h=d/(u/n)),m<3)throw new Error("The number of segments per rotation needs to be at least 3.");const f=i.toSides(c);if(f.length===0)throw new Error("The given geometry cannot be empty");const I=f.filter(Q=>Q[0][0]>=0);let C=s.fromSides(f);I.length===0&&(C=s.reverse(C));const y=Math.round(m/n*Math.abs(u)),x=y>=2?y:2,E=o.create(),B=o.create(),S=(Q,w,M)=>{const k=g+u/x*w,R=p/x*w,F=(k-g)/n*h;return o.multiply(E,o.fromTranslation(o.create(),[R,0,F*Math.sign(u)]),o.fromXRotation(o.create(),-n/4*Math.sign(u))),o.multiply(B,o.fromZRotation(o.create(),k),E),s.transform(B,M)};return r({numberOfSlices:x+1,callback:S},C)};e.exports=a}}),zpi=yt({"node_modules/@jscad/modeling/src/operations/extrusions/project.js"(t,e){var n=ga(),o=xVe(),i=S6(),r=Du(),s=Ya(),a=Ta(),A=XA(),c=gP(),l=Crn(),u=(h,d)=>{const p=i.fromNormalAndPoint(i.create(),h.axis,h.origin);if(Number.isNaN(p[0])||Number.isNaN(p[1])||Number.isNaN(p[2])||Number.isNaN(p[3]))throw new Error("project: invalid axis or origin");const m=c(d),_=m*m*Math.sqrt(3)/4;if(m===0)return s.create();const f=a.toPolygons(d);let I=[];for(let y=0;y<f.length;y++){const x=f[y].vertices.map(S=>i.projectionOfPoint(p,S)),E=A.create(x),B=A.plane(E);o(p,B)&&(A.measureArea(E)<_||I.push(E))}if(!o(p,[0,0,1])){const y=r.fromVectorRotation(r.create(),p,[0,0,1]);I=I.map(x=>A.transform(y,x))}I=I.sort((y,x)=>A.measureArea(x)-A.measureArea(y));const C=I.map(y=>s.fromPoints(y.vertices));return l(C)},g=(h,...d)=>{const p={axis:[0,0,1],origin:[0,0,0]},{axis:m,origin:_}=Object.assign({},p,h);if(d=n(d),d.length===0)throw new Error("wrong number of arguments");h={axis:m,origin:_};const f=d.map(I=>a.isA(I)?u(h,I):I);return f.length===1?f[0]:f};e.exports=g}}),RX=yt({"node_modules/@jscad/modeling/src/operations/extrusions/index.js"(t,e){e.exports={extrudeFromSlices:ope(),extrudeLinear:Gpi(),extrudeRectangular:Kpi(),extrudeRotate:urn(),extrudeHelical:Vpi(),project:zpi(),slice:DY()}}}),kVe=yt({"node_modules/@jscad/modeling/src/operations/hulls/hullPoints2.js"(t,e){var n=_A(),o=s=>{let a=n.fromValues(1/0,1/0);s.forEach(l=>{(l[1]<a[1]||l[1]===a[1]&&l[0]<a[0])&&(a=l)});const A=[];s.forEach(l=>{const u=r(l[1]-a[1],l[0]-a[0]),g=n.squaredDistance(l,a);A.push({point:l,angle:u,distSq:g})}),A.sort((l,u)=>l.angle!==u.angle?l.angle-u.angle:l.distSq-u.distSq);const c=[];return A.forEach(l=>{let u=c.length;for(;u>1&&i(c[u-2],c[u-1],l.point)<=Number.EPSILON;)c.pop(),u=c.length;c.push(l.point)}),c},i=(s,a,A)=>(a[0]-s[0])*(A[1]-s[1])-(a[1]-s[1])*(A[0]-s[0]),r=(s,a)=>s===0&&a===0?-1/0:-a/s;e.exports=o}}),FVe=yt({"node_modules/@jscad/modeling/src/operations/hulls/toUniquePoints.js"(t,e){var n=Ya(),o=Ta(),i=Au(),r=s=>{const a=new Set,A=[],c=l=>{const u=l.toString();a.has(u)||(A.push(l),a.add(u))};return s.forEach(l=>{n.isA(l)?n.toPoints(l).forEach(c):o.isA(l)?o.toPoints(l).forEach(u=>u.forEach(c)):i.isA(l)&&i.toPoints(l).forEach(c)}),A};e.exports=r}}),Jpi=yt({"node_modules/@jscad/modeling/src/operations/hulls/hullPath2.js"(t,e){var n=ga(),o=Au(),i=kVe(),r=FVe(),s=(...a)=>{a=n(a);const A=r(a),c=i(A);return o.fromPoints({closed:!0},c)};e.exports=s}}),Wpi=yt({"node_modules/@jscad/modeling/src/operations/hulls/hullGeom2.js"(t,e){var n=ga(),o=Ya(),i=kVe(),r=FVe(),s=(...a)=>{a=n(a);const A=r(a),c=i(A);return c.length<3?o.create():o.fromPoints(c)};e.exports=s}}),jpi=yt({"node_modules/@jscad/modeling/src/operations/hulls/hullGeom3.js"(t,e){var n=ga(),o=Ta(),i=FVe(),r=DVe(),s=(...a)=>{a=n(a);const A=i(a);return A.length===0?o.create():o.create(r(A))};e.exports=s}}),xrn=yt({"node_modules/@jscad/modeling/src/operations/hulls/hull.js"(t,e){var n=ga(),o=MX(),i=Ya(),r=Ta(),s=Au(),a=Jpi(),A=Wpi(),c=jpi(),l=(...u)=>{if(u=n(u),u.length===0)throw new Error("wrong number of arguments");if(!o(u))throw new Error("only hulls of the same type are supported");const g=u[0];return s.isA(g)?a(u):i.isA(g)?A(u):r.isA(g)?c(u):g};e.exports=l}}),$pi=yt({"node_modules/@jscad/modeling/src/operations/hulls/hullChain.js"(t,e){var n=ga(),o=RVe(),i=xrn(),r=(...s)=>{if(s=n(s),s.length<2)throw new Error("wrong number of arguments");const a=[];for(let A=1;A<s.length;A++)a.push(i(s[A-1],s[A]));return o(a)};e.exports=r}}),qpi=yt({"node_modules/@jscad/modeling/src/operations/hulls/index.js"(t,e){e.exports={hull:xrn(),hullChain:$pi(),hullPoints2:kVe(),hullPoints3:DVe()}}}),Xpi=yt({"node_modules/@jscad/modeling/src/operations/minkowski/index.js"(t,e){e.exports={minkowskiSum:frn()}}}),Ern=yt({"node_modules/@jscad/modeling/src/operations/modifiers/snapPolygons.js"(t,e){var n=$r(),o=XA(),i=(s,a)=>{const A=Math.abs(o.measureArea(a));return Number.isFinite(A)&&A>s},r=(s,a)=>{let A=a.map(l=>{const u=l.vertices.map(d=>n.snap(n.create(),d,s)),g=[];for(let d=0;d<u.length;d++){const p=(d+1)%u.length;n.equals(u[d],u[p])||g.push(u[d])}const h=o.create(g);return l.color&&(h.color=l.color),h});const c=s*s*Math.sqrt(3)/4;return A=A.filter(l=>i(c,l)),A};e.exports=r}}),Zpi=yt({"node_modules/@jscad/modeling/src/operations/modifiers/mergePolygons.js"(t,e){var n=xVe(),o=$r(),i=XA(),r=_=>{const f=i.toPoints(_),I=[];for(let C=0;C<f.length;C++){const y=(C+1)%f.length,x={v1:f[C],v2:f[y]};I.push(x)}for(let C=0;C<I.length;C++){const y=(C+1)%f.length;I[C].next=I[y],I[y].prev=I[C]}return I},s=(_,f)=>{const I=`${f.v1}:${f.v2}`;_.set(I,f)},a=(_,f)=>{const I=`${f.v1}:${f.v2}`;_.delete(I)},A=(_,f)=>{const I=`${f.v2}:${f.v1}`;return _.get(I)},c=(_,f,I)=>{let C=_.prev.v1,y=_.prev.v2,x=f.next.v2;const E=g(C,y,x,I);C=f.prev.v1,y=f.prev.v2,x=_.next.v2;const B=g(C,y,x,I);return[E,B]},l=o.create(),u=o.create(),g=(_,f,I,C)=>{const y=o.subtract(l,f,_),x=o.subtract(u,I,f);return o.cross(y,y,x),o.dot(y,C)},h=_=>{let f;const I=[];for(;_.next;){const C=_.next;I.push(_.v1),_.v1=null,_.v2=null,_.next=null,_.prev=null,_=C}return I.length>0&&(f=i.create(I)),f},d=_=>{if(_.length<2)return _;const f=_[0].plane,I=_.slice(),C=new Map;for(;I.length>0;){const x=I.shift(),E=r(x);for(let B=0;B<E.length;B++){const S=E[B],Q=A(C,S);if(Q){const w=c(S,Q,f);if(w[0]>=0&&w[1]>=0){const M=Q.next,k=S.next;S.prev.next=Q.next,S.next.prev=Q.prev,Q.prev.next=S.next,Q.next.prev=S.prev,S.v1=null,S.v2=null,S.next=null,S.prev=null,a(C,Q),Q.v1=null,Q.v2=null,Q.next=null,Q.prev=null;const R=(F,O,U)=>{const Y={v1:U.v1,v2:O.v2,next:O.next,prev:U.prev};U.prev.next=Y,O.next.prev=Y,a(F,O),O.v1=null,O.v2=null,O.next=null,O.prev=null,a(F,U),U.v1=null,U.v2=null,U.next=null,U.prev=null};w[0]===0&&R(C,M,M.prev),w[1]===0&&R(C,k,k.prev)}}else S.next&&s(C,S)}}const y=[];return C.forEach(x=>{const E=h(x);E&&y.push(E)}),C.clear(),y},p=(_,f)=>Math.abs(_[3]-f[3])<15e-8?n(_,f):!1,m=(_,f)=>{const I=[];f.forEach(y=>{const x=I.find(E=>p(E[0],i.plane(y)));x?x[1].push(y):I.push([i.plane(y),[y]])});let C=[];return I.forEach(y=>{const x=y[1],E=d(x);C=C.concat(E)}),C};e.exports=m}}),emi=yt({"node_modules/@jscad/modeling/src/operations/modifiers/insertTjunctions.js"(t,e){var n=mc(),o=$r(),i=XA(),r=c=>`${c}`,s=(c,l,u,g,h,d)=>{const p=r(g),m=r(h),_=`${p}/${m}`,f=`${m}/${p}`;if(c.has(f))return a(c,l,u,h,g,null),null;const I={vertex0:g,vertex1:h,polygonindex:d};return c.has(_)?c.get(_).push(I):c.set(_,[I]),l.has(p)?l.get(p).push(_):l.set(p,[_]),u.has(m)?u.get(m).push(_):u.set(m,[_]),_},a=(c,l,u,g,h,d)=>{const p=r(g),m=r(h),_=`${p}/${m}`;let f=-1;const I=c.get(_);for(let C=0;C<I.length;C++){const y=I[C];let x=r(y.vertex0);if(x===p&&(x=r(y.vertex1),x===m&&!(d!==null&&y.polygonindex!==d))){f=C;break}}I.splice(f,1),I.length===0&&c.delete(_),f=l.get(p).indexOf(_),l.get(p).splice(f,1),l.get(p).length===0&&l.delete(p),f=u.get(m).indexOf(_),u.get(m).splice(f,1),u.get(m).length===0&&u.delete(m)},A=c=>{const l=new Map;for(let u=0;u<c.length;u++){const g=c[u],h=g.vertices.length;if(h>=3){let d=g.vertices[0],p=r(d);for(let m=0;m<h;m++){let _=m+1;_===h&&(_=0);const f=g.vertices[_],I=r(f),C=`${p}/${I}`,y=`${I}/${p}`;if(l.has(y)){const x=l.get(y);x.splice(-1,1),x.length===0&&l.delete(y)}else{const x={vertex0:d,vertex1:f,polygonindex:u};l.has(C)?l.get(C).push(x):l.set(C,[x])}d=f,p=I}}else console.warn("warning: invalid polygon found during insertTjunctions")}if(l.size>0){const u=new Map,g=new Map,h=new Map;for(const[p,m]of l)h.set(p,!0),m.forEach(_=>{const f=r(_.vertex0),I=r(_.vertex1);u.has(f)?u.get(f).push(p):u.set(f,[p]),g.has(I)?g.get(I).push(p):g.set(I,[p])});const d=c.slice(0);for(;l.size!==0;){for(const m of l.keys())h.set(m,!0);let p=!1;for(;;){const m=Array.from(h.keys());if(m.length===0)break;const _=m[0];let f=!0;if(l.has(_)){const C=l.get(_)[0];for(let y=0;y<2;y++){const x=y===0?C.vertex0:C.vertex1,E=y===0?C.vertex1:C.vertex0,B=r(x),S=r(E);let Q=[];y===0?g.has(B)&&(Q=g.get(B)):u.has(B)&&(Q=u.get(B));for(let w=0;w<Q.length;w++){const M=Q[w],k=l.get(M)[0],R=y===0?k.vertex0:k.vertex1;if(y===0?k.vertex1:k.vertex0,r(R)===S){a(l,u,g,x,E,null),a(l,u,g,E,x,null),f=!1,y=2,p=!0;break}else{const O=x,U=E,Y=R,W=o.subtract(o.create(),Y,O),te=o.dot(o.subtract(o.create(),U,O),W)/o.dot(W,W);if(te>0&&te<1){const j=o.scale(o.create(),W,te);if(o.add(j,j,O),o.squaredDistance(j,U)<n.EPS*n.EPS){const oe=k.polygonindex,ie=d[oe],ne=r(k.vertex1);let le=-1;for(let pe=0;pe<ie.vertices.length;pe++)if(r(ie.vertices[pe])===ne){le=pe;break}const ge=ie.vertices.slice(0);ge.splice(le,0,E);const _e=i.create(ge);d[oe]=_e,a(l,u,g,k.vertex0,k.vertex1,oe);const ue=s(l,u,g,k.vertex0,E,oe),fe=s(l,u,g,E,k.vertex1,oe);ue!==null&&h.set(ue,!0),fe!==null&&h.set(fe,!0),f=!1,y=2,p=!0;break}}}}}}f&&h.delete(_)}if(!p)break}c=d}return l.clear(),c};e.exports=A}}),tmi=yt({"node_modules/@jscad/modeling/src/operations/modifiers/triangulatePolygons.js"(t,e){var n=$r(),o=XA(),i=(s,a,A)=>{const c=a.vertices.length;if(c>3){if(c>4){const g=[0,0,0];a.vertices.forEach(h=>n.add(g,g,h)),n.snap(g,n.divide(g,g,[c,c,c]),s);for(let h=0;h<c;h++){const d=o.create([g,a.vertices[h],a.vertices[(h+1)%c]]);a.color&&(d.color=a.color),A.push(d)}return}const l=o.create([a.vertices[0],a.vertices[1],a.vertices[2]]),u=o.create([a.vertices[0],a.vertices[2],a.vertices[3]]);a.color&&(l.color=a.color,u.color=a.color),A.push(l,u);return}A.push(a)},r=(s,a)=>{const A=[];return a.forEach(c=>{i(s,c,A)}),A};e.exports=r}}),nmi=yt({"node_modules/@jscad/modeling/src/operations/modifiers/generalize.js"(t,e){var n=ga(),o=gP(),i=Ya(),r=Ta(),s=Au(),a=Ern(),A=Zpi(),c=emi(),l=tmi(),u=(p,m)=>m,g=(p,m)=>m,h=(p,m)=>{const _={snap:!1,simplify:!1,triangulate:!1},{snap:f,simplify:I,triangulate:C}=Object.assign({},_,p),y=o(m);let x=r.toPolygons(m);f&&(x=a(y,x)),I&&(x=A(y,x)),C&&(x=c(x),x=l(y,x));const E=Object.assign({},m);return E.polygons=x,E},d=(p,...m)=>{if(m=n(m),m.length===0)throw new Error("wrong number of arguments");const _=m.map(f=>{if(s.isA(f))return u(p,f);if(i.isA(f))return g(p,f);if(r.isA(f))return h(p,f);throw new Error("invalid geometry")});return _.length===1?_[0]:_};e.exports=d}}),omi=yt({"node_modules/@jscad/modeling/src/operations/modifiers/snap.js"(t,e){var n=ga(),o=_A(),i=Ya(),r=Ta(),s=Au(),a=gP(),A=Ern(),c=h=>{const d=a(h),m=s.toPoints(h).map(_=>o.snap(o.create(),_,d));return s.create(m)},l=h=>{const d=a(h);let m=i.toSides(h).map(_=>[o.snap(o.create(),_[0],d),o.snap(o.create(),_[1],d)]);return m=m.filter(_=>!o.equals(_[0],_[1])),i.create(m)},u=h=>{const d=a(h),p=r.toPolygons(h),m=A(d,p);return r.create(m)},g=(...h)=>{if(h=n(h),h.length===0)throw new Error("wrong number of arguments");const d=h.map(p=>s.isA(p)?c(p):i.isA(p)?l(p):r.isA(p)?u(p):p);return d.length===1?d[0]:d};e.exports=g}}),imi=yt({"node_modules/@jscad/modeling/src/operations/modifiers/index.js"(t,e){e.exports={generalize:nmi(),snap:omi(),retessellate:DX()}}}),rmi=yt({"node_modules/@jscad/modeling/src/utils/padArrayToLength.js"(t,e){var n=(o,i,r)=>{for(o=o.slice();o.length<r;)o.push(i);return o};e.exports=n}}),smi=yt({"node_modules/@jscad/modeling/src/operations/transforms/align.js"(t,e){var n=ga(),o=rmi(),i=BVe(),{translate:r}=rT(),s=l=>{if(!Array.isArray(l.modes)||l.modes.length>3)throw new Error("align(): modes must be an array of length <= 3");if(l.modes=o(l.modes,"none",3),l.modes.filter(u=>["center","max","min","none"].includes(u)).length!==3)throw new Error('align(): all modes must be one of "center", "max" or "min"');if(!Array.isArray(l.relativeTo)||l.relativeTo.length>3)throw new Error("align(): relativeTo must be an array of length <= 3");if(l.relativeTo=o(l.relativeTo,0,3),l.relativeTo.filter(u=>Number.isFinite(u)||u==null).length!==3)throw new Error("align(): all relativeTo values must be a number, or null.");if(typeof l.grouped!="boolean")throw new Error("align(): grouped must be a boolean value.");return l},a=(l,u,g)=>{for(let h=0;h<3;h++)l[h]==null&&(u[h]==="center"?l[h]=(g[0][h]+g[1][h])/2:u[h]==="max"?l[h]=g[1][h]:u[h]==="min"&&(l[h]=g[0][h]));return l},A=(l,u,g)=>{const h=i(l),d=[0,0,0];for(let p=0;p<3;p++)u[p]==="center"?d[p]=g[p]-(h[0][p]+h[1][p])/2:u[p]==="max"?d[p]=g[p]-h[1][p]:u[p]==="min"&&(d[p]=g[p]-h[0][p]);return r(d,l)},c=(l,...u)=>{l=Object.assign({},{modes:["center","center","min"],relativeTo:[0,0,0],grouped:!1},l),l=s(l);let{modes:h,relativeTo:d,grouped:p}=l;if(u=n(u),u.length===0)throw new Error("align(): No geometries were provided to act upon");if(d.filter(m=>m==null).length){const m=i(u);d=a(d,h,m)}return p?u=A(u,h,d):u=u.map(m=>A(m,h,d)),u.length===1?u[0]:u};e.exports=c}}),spe=yt({"node_modules/@jscad/modeling/src/operations/transforms/center.js"(t,e){var n=ga(),o=Ya(),i=Ta(),r=Au(),s=oT(),{translate:a}=rT(),A=(h,d)=>{const p={axes:[!0,!0,!0],relativeTo:[0,0,0]},{axes:m,relativeTo:_}=Object.assign({},p,h),f=s(d),I=[0,0,0];return m[0]&&(I[0]=_[0]-(f[0][0]+(f[1][0]-f[0][0])/2)),m[1]&&(I[1]=_[1]-(f[0][1]+(f[1][1]-f[0][1])/2)),m[2]&&(I[2]=_[2]-(f[0][2]+(f[1][2]-f[0][2])/2)),a(I,d)},c=(h,...d)=>{const p={axes:[!0,!0,!0],relativeTo:[0,0,0]},{axes:m,relativeTo:_}=Object.assign({},p,h);if(d=n(d),d.length===0)throw new Error("wrong number of arguments");if(_.length!==3)throw new Error("relativeTo must be an array of length 3");h={axes:m,relativeTo:_};const f=d.map(I=>r.isA(I)||o.isA(I)||i.isA(I)?A(h,I):I);return f.length===1?f[0]:f},l=(...h)=>c({axes:[!0,!1,!1]},h),u=(...h)=>c({axes:[!1,!0,!1]},h),g=(...h)=>c({axes:[!1,!1,!0]},h);e.exports={center:c,centerX:l,centerY:u,centerZ:g}}}),ape=yt({"node_modules/@jscad/modeling/src/operations/transforms/scale.js"(t,e){var n=ga(),o=Du(),i=Ya(),r=Ta(),s=Au(),a=(u,...g)=>{if(!Array.isArray(u))throw new Error("factors must be an array");if(g=n(g),g.length===0)throw new Error("wrong number of arguments");for(u=u.slice();u.length<3;)u.push(1);if(u[0]<=0||u[1]<=0||u[2]<=0)throw new Error("factors must be positive");const h=o.fromScaling(o.create(),u),d=g.map(p=>s.isA(p)?s.transform(h,p):i.isA(p)?i.transform(h,p):r.isA(p)?r.transform(h,p):p);return d.length===1?d[0]:d},A=(u,...g)=>a([u,1,1],g),c=(u,...g)=>a([1,u,1],g),l=(u,...g)=>a([1,1,u],g);e.exports={scale:a,scaleX:A,scaleY:c,scaleZ:l}}}),ami=yt({"node_modules/@jscad/modeling/src/operations/transforms/transform.js"(t,e){var n=ga(),o=Ya(),i=Ta(),r=Au(),s=(a,...A)=>{if(A=n(A),A.length===0)throw new Error("wrong number of arguments");const c=A.map(l=>r.isA(l)?r.transform(a,l):o.isA(l)?o.transform(a,l):i.isA(l)?i.transform(a,l):l);return c.length===1?c[0]:c};e.exports=s}}),aT=yt({"node_modules/@jscad/modeling/src/operations/transforms/index.js"(t,e){e.exports={align:smi(),center:spe().center,centerX:spe().centerX,centerY:spe().centerY,centerZ:spe().centerZ,mirror:wX().mirror,mirrorX:wX().mirrorX,mirrorY:wX().mirrorY,mirrorZ:wX().mirrorZ,rotate:PX().rotate,rotateX:PX().rotateX,rotateY:PX().rotateY,rotateZ:PX().rotateZ,scale:ape().scale,scaleX:ape().scaleX,scaleY:ape().scaleY,scaleZ:ape().scaleZ,transform:ami(),translate:rT().translate,translateX:rT().translateX,translateY:rT().translateY,translateZ:rT().translateZ}}}),Ape=yt({"node_modules/@jscad/modeling/src/index.js"(t,e){e.exports={colors:epe(),curves:thi(),geometries:IVe(),maths:Shi(),measurements:Rhi(),primitives:sT(),text:gpi(),utils:prn(),booleans:NX(),expansions:yrn(),extrusions:RX(),hulls:qpi(),minkowski:Xpi(),modifiers:imi(),transforms:aT()}}}),Brn=yt({"node_modules/jscad-planner/dist/index.cjs"(t,e){var n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,s=(g,h)=>{for(var d in h)n(g,d,{get:h[d],enumerable:!0})},a=(g,h,d,p)=>{if(h&&typeof h=="object"||typeof h=="function")for(let m of i(h))!r.call(g,m)&&m!==d&&n(g,m,{get:()=>h[m],enumerable:!(p=o(h,m))||p.enumerable});return g},A=g=>a(n({},"__esModule",{value:!0}),g),c={};s(c,{executeJscadOperations:()=>u,jscadPlanner:()=>l}),e.exports=A(c);var l={booleans:{intersect:(...g)=>({type:"intersect",shapes:g}),subtract:(...g)=>({type:"subtract",shapes:g}),union:(...g)=>({type:"union",shapes:g})},hulls:{hull:(...g)=>({type:"hull",shapes:g.flat()}),hullChain:(...g)=>({type:"hullChain",shapes:g.flat()})},colors:{colorize:(g,h)=>({type:"colorize",color:g,shape:h})},primitives:{cube:g=>({type:"cube",...g}),sphere:g=>({type:"sphere",...g}),cylinder:g=>({type:"cylinder",...g}),polygon:g=>({type:"polygon",...g}),cuboid:g=>({type:"cuboid",...g}),roundedCuboid:g=>({type:"roundedCuboid",...g})},transforms:{rotate:(g,h)=>({type:"rotate",angles:g,shape:h}),scale:(g,h)=>({type:"scale",factors:g,shape:h}),translate:(g,h)=>({type:"translate",vector:g,shape:h})},extrusions:{extrudeLinear:(g,h)=>({type:"extrudeLinear",options:g,shape:h}),extrudeRotate:(g,h)=>({type:"extrudeRotate",options:g,shape:h})},maths:{vec2:{create:(g,h)=>[g,h],fromValues:(g,h)=>[g,h]},vec3:{create:(g,h,d)=>[g,h,d],fromValues:(g,h,d)=>[g,h,d]}},geometries:{geom2:{create:g=>({type:"createGeom2",points:g})},geom3:{create:g=>({type:"createGeom3",polygons:g})},path2:{create:g=>({type:"createPath2",points:g})}},measurements:{measureBoundingBox:g=>({type:"measureBoundingBox",shape:g}),measureArea:g=>({type:"measureArea",shape:g}),measureVolume:g=>({type:"measureVolume",shape:g})},utils:{degToRad:g=>g*Math.PI/180,radToDeg:g=>g*180/Math.PI}},u=(g,h)=>{if(Array.isArray(h)&&h.length===1)return u(g,h[0]);if(Array.isArray(h))throw new Error("executeJscadOperations currently doesn't support Array<JscadOperation>, try adding a root union or or executing each element individually");const d=_=>u(g,_),{type:p,...m}=h;switch(p){case"intersect":return g.booleans.intersect(...h.shapes.map(d));case"subtract":return g.booleans.subtract(...h.shapes.map(d));case"union":return g.booleans.union(...h.shapes.map(d));case"hull":return g.hulls.hull(...h.shapes.map(d));case"hullChain":return g.hulls.hullChain(...h.shapes.map(d));case"colorize":return g.colors.colorize(h.color,d(h.shape));case"cube":return g.primitives.cube(m);case"sphere":return g.primitives.sphere(m);case"cylinder":return g.primitives.cylinder(m);case"polygon":return g.primitives.polygon(m);case"cuboid":return g.primitives.cuboid(m);case"roundedCuboid":return g.primitives.roundedCuboid(m);case"rotate":return g.transforms.rotate(h.angles,d(h.shape));case"scale":return g.transforms.scale(h.factors,d(h.shape));case"translate":return g.transforms.translate(h.vector,d(h.shape));case"extrudeLinear":return g.extrusions.extrudeLinear(h.options,d(h.shape));case"extrudeRotate":return g.extrusions.extrudeRotate(h.options,d(h.shape));case"createGeom2":return g.geometries.geom2.create(h.points);case"createGeom3":return g.geometries.geom3.create(h.polygons);case"createPath2":return g.geometries.path2.create(h.points);case"measureBoundingBox":return g.measurements.measureBoundingBox(d(h.shape));case"measureArea":return g.measurements.measureArea(d(h.shape));case"measureVolume":return g.measurements.measureVolume(d(h.shape));case"degToRad":return g.utils.degToRad(h.degrees);case"radToDeg":return g.utils.radToDeg(h.radians);default:throw h.type===void 0?new Error(`Operation type is undefined. This usually means the operation object is malformed or not properly initialized. Operation: ${JSON.stringify(h,null,2).slice(0,200)}...`):new Error(`Unsupported operation type: ${h.type}. Operation: ${JSON.stringify(h,null,2)}`)}}}}),Ami=yt({"node_modules/ms/index.js"(t,e){var n=1e3,o=n*60,i=o*60,r=i*24,s=r*7,a=r*365.25;e.exports=function(g,h){h=h||{};var d=typeof g;if(d==="string"&&g.length>0)return A(g);if(d==="number"&&isFinite(g))return h.long?l(g):c(g);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(g))};function A(g){if(g=String(g),!(g.length>100)){var h=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(g);if(h){var d=parseFloat(h[1]),p=(h[2]||"ms").toLowerCase();switch(p){case"years":case"year":case"yrs":case"yr":case"y":return d*a;case"weeks":case"week":case"w":return d*s;case"days":case"day":case"d":return d*r;case"hours":case"hour":case"hrs":case"hr":case"h":return d*i;case"minutes":case"minute":case"mins":case"min":case"m":return d*o;case"seconds":case"second":case"secs":case"sec":case"s":return d*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return d;default:return}}}}function c(g){var h=Math.abs(g);return h>=r?Math.round(g/r)+"d":h>=i?Math.round(g/i)+"h":h>=o?Math.round(g/o)+"m":h>=n?Math.round(g/n)+"s":g+"ms"}function l(g){var h=Math.abs(g);return h>=r?u(g,h,r,"day"):h>=i?u(g,h,i,"hour"):h>=o?u(g,h,o,"minute"):h>=n?u(g,h,n,"second"):g+" ms"}function u(g,h,d,p){var m=h>=d*1.5;return Math.round(g/d)+" "+p+(m?"s":"")}}}),cmi=yt({"node_modules/debug/src/common.js"(t,e){function n(o){r.debug=r,r.default=r,r.coerce=u,r.disable=c,r.enable=a,r.enabled=l,r.humanize=Ami(),r.destroy=g,Object.keys(o).forEach(h=>{r[h]=o[h]}),r.names=[],r.skips=[],r.formatters={};function i(h){let d=0;for(let p=0;p<h.length;p++)d=(d<<5)-d+h.charCodeAt(p),d|=0;return r.colors[Math.abs(d)%r.colors.length]}r.selectColor=i;function r(h){let d,p=null,m,_;function f(...I){if(!f.enabled)return;const C=f,y=Number(new Date),x=y-(d||y);C.diff=x,C.prev=d,C.curr=y,d=y,I[0]=r.coerce(I[0]),typeof I[0]!="string"&&I.unshift("%O");let E=0;I[0]=I[0].replace(/%([a-zA-Z%])/g,(S,Q)=>{if(S==="%%")return"%";E++;const w=r.formatters[Q];if(typeof w=="function"){const M=I[E];S=w.call(C,M),I.splice(E,1),E--}return S}),r.formatArgs.call(C,I),(C.log||r.log).apply(C,I)}return f.namespace=h,f.useColors=r.useColors(),f.color=r.selectColor(h),f.extend=s,f.destroy=r.destroy,Object.defineProperty(f,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(m!==r.namespaces&&(m=r.namespaces,_=r.enabled(h)),_),set:I=>{p=I}}),typeof r.init=="function"&&r.init(f),f}function s(h,d){const p=r(this.namespace+(typeof d>"u"?":":d)+h);return p.log=this.log,p}function a(h){r.save(h),r.namespaces=h,r.names=[],r.skips=[];const d=(typeof h=="string"?h:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const p of d)p[0]==="-"?r.skips.push(p.slice(1)):r.names.push(p)}function A(h,d){let p=0,m=0,_=-1,f=0;for(;p<h.length;)if(m<d.length&&(d[m]===h[p]||d[m]==="*"))d[m]==="*"?(_=m,f=p,m++):(p++,m++);else if(_!==-1)m=_+1,f++,p=f;else return!1;for(;m<d.length&&d[m]==="*";)m++;return m===d.length}function c(){const h=[...r.names,...r.skips.map(d=>"-"+d)].join(",");return r.enable(""),h}function l(h){for(const d of r.skips)if(A(h,d))return!1;for(const d of r.names)if(A(h,d))return!0;return!1}function u(h){return h instanceof Error?h.stack||h.message:h}function g(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}e.exports=n}}),lmi=yt({"node_modules/debug/src/browser.js"(t,e){t.formatArgs=o,t.save=i,t.load=r,t.useColors=n,t.storage=s(),t.destroy=(()=>{let A=!1;return()=>{A||(A=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function n(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let A;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(A=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(A[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(A){if(A[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+A[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const c="color: "+this.color;A.splice(1,0,c,"color: inherit");let l=0,u=0;A[0].replace(/%[a-zA-Z%]/g,g=>{g!=="%%"&&(l++,g==="%c"&&(u=l))}),A.splice(u,0,c)}t.log=console.debug||console.log||(()=>{});function i(A){try{A?t.storage.setItem("debug",A):t.storage.removeItem("debug")}catch{}}function r(){let A;try{A=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!A&&typeof cVe<"u"&&"env"in cVe&&(A=cVe.env.DEBUG),A}function s(){try{return localStorage}catch{}}e.exports=cmi()(t);var{formatters:a}=e.exports;a.j=function(A){try{return JSON.stringify(A)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}}}),LVe=ee.createContext(null),uf=()=>{const t=ee.useContext(LVe);if(!t)throw new Error("useThree must be used within a ThreeProvider");return t},TX=(t,e=[])=>{const{addFrameListener:n,removeFrameListener:o}=uf();Fs.useEffect(()=>(n(t),()=>o(t)),[n,o,...e])},HVe=ee.createContext(null),umi=()=>{const t=ee.useContext(HVe),e=uf();return ee.useEffect(()=>{if(t)return t.current=e,()=>{t.current=null}},[t,e]),null},gmi=({cadComponent:t,children:e})=>{const n=uf(),o=ee.useMemo(()=>new lh,[]);o.userData.cad_component_id=t.cad_component_id,o.userData.pcb_component_id=t.pcb_component_id,ee.useEffect(()=>(n.rootObject.add(o),()=>{n.rootObject.remove(o)}),[n.rootObject,o]);const i=ee.useMemo(()=>({...n,rootObject:o}),[n,o]);return K.jsx(LVe.Provider,{value:i,children:e})},brn=(t,e)=>{if(!t)return;const{camera:n,rootObject:o,renderer:i}=t,r=i.domElement.getBoundingClientRect();if(!r.width||!r.height||e.x<r.left||e.x>r.right||e.y<r.top||e.y>r.bottom)return;const s=new uJt;n.updateWorldMatrix(!0,!1),o.updateWorldMatrix(!0,!0),s.setFromCamera(new ni((e.x-r.left)/r.width*2-1,-((e.y-r.top)/r.height)*2+1),n);for(const a of s.intersectObject(o,!0)){if(!(a.object instanceof Er))continue;let A=a.object,c=!0;for(;A;)A.visible||(c=!1),A=A.parent;if(c)return a.object}},dmi=(t,e,n)=>{let o=brn(t,e)??null,i;for(;o;)i??=o.userData.pcb_component_id,o=o.parent;if(!i)return;const r=n.find(a=>a.type==="pcb_component"&&a.pcb_component_id===i);if(r?.type!=="pcb_component")return;const s=n.find(a=>a.type==="source_component"&&a.source_component_id===r.source_component_id);if(s?.type==="source_component")return{source_component_id:s.source_component_id,pcb_component_id:r.pcb_component_id,refdes:s.name}};function Srn(t,e){return e??t.some(n=>n.type==="cad_component"&&n.is_on_folded_board===!0)}var hmi=(t,e,n)=>{let o=brn(t,e)??null;for(;o;){const i=o.userData.cad_component_id;if(i){const r=n.find(a=>a.type==="cad_component"&&a.cad_component_id===i);if(r?.type!=="cad_component")return;const s=n.find(a=>a.type==="source_component"&&a.source_component_id===r.source_component_id);return{cad_component_id:r.cad_component_id,componentName:s?.type==="source_component"?s.name:r.cad_component_id}}o=o.parent}},cpe=new Set,pmi=t=>{const[e,n]=ee.useState({circuitKey:t,ids:cpe}),o=e.circuitKey===t?e.ids:cpe;return e.circuitKey!==t&&n({circuitKey:t,ids:cpe}),{hiddenCadComponentIds:o,hideComponent:i=>{n(r=>({circuitKey:t,ids:new Set([...r.circuitKey===t?r.ids:[],i])}))},unhideAllComponents:()=>{n({circuitKey:t,ids:cpe})}}},OVe=t=>ee.useMemo(()=>{if(!t)return[];const e=new SFo;return e.add(t),e.render(),e.getCircuitJson()},[t]),mmi=(t,e)=>{const n=t.pcb_component_id?e.find(o=>o.type==="pcb_component"&&o.pcb_component_id===t.pcb_component_id):void 0;return{pcbComponent:n,layer:t.layer??n?.layer??"top",isThroughHole:!!(n&&e.some(o=>o.type==="pcb_plated_hole"&&o.pcb_component_id===n.pcb_component_id))}},GVe=["translucent","opaque","hidden"],_mi=t=>GVe[(GVe.indexOf(t)+1)%GVe.length],Qrn={boardBody:!0,topCopper:!0,bottomCopper:!0,keepout:!0,adhesive:!1,solderPaste:!1,topSilkscreen:!0,bottomSilkscreen:!0,topMask:!0,bottomMask:!0,throughHoleModels:!0,smtModels:!0,translucentModels:!0,modelsNotInPosFile:!1,modelsMarkedDNP:!1,modelBoundingBoxes:!1,threedAxis:!1,pcbNotes:!1,backgroundStart:!0,backgroundEnd:!0,enclosure:"translucent"},vrn=ee.createContext(void 0),fmi=({children:t})=>{const[e,n]=ee.useState(Qrn),o=ee.useCallback((s,a)=>{n(A=>({...A,[s]:a}))},[]),i=ee.useCallback(()=>{n(Qrn)},[]),r=ee.useMemo(()=>({visibility:e,setLayerVisibility:o,resetToDefaults:i}),[e,o,i]);return K.jsx(vrn.Provider,{value:r,children:t})},AT=()=>{const t=ee.useContext(vrn);if(!t)throw new Error("useLayerVisibility must be used within a LayerVisibilityProvider");return t},YVe=1.2;function wrn(t){return ee.useMemo(()=>{if(!t)return YVe;try{return Mr(t).pcb_board.list()[0]?.thickness??YVe}catch{return YVe}},[t])}var kX={clickToInteractOverlay:100,htmlElements:95,orientationCube:95,contextMenu:110,appearanceMenu:111},Prn=({children:t,position:e,style:n})=>{const{camera:o,renderer:i}=uf(),r=ee.useRef(document.createElement("div")),[s,a]=ee.useState(null);return ee.useEffect(()=>{const A=i?.domElement.parentNode;if(A)return A.style.position!=="relative"&&A.style.position!=="absolute"&&(A.style.position="relative"),A.appendChild(r.current),a(NFt.createPortal(t,r.current)),()=>{A.contains(r.current)&&A.removeChild(r.current)}},[i,t]),TX(()=>{if(!o||!r.current||!i)return;const A=new jt(...e);A.project(o);const c=i.domElement.getBoundingClientRect(),l=Math.round((A.x+1)/2*c.width),u=Math.round((-A.y+1)/2*c.height);r.current.style.position="absolute",r.current.style.left=`${l}px`,r.current.style.top=`${u}px`,r.current.style.pointerEvents="none",r.current.style.zIndex=kX.htmlElements.toString(),n&&Object.assign(r.current.style,n)},[o,i,e,n]),s},Mrn={in:25.4,inch:25.4,mil:.0254,mm:1,m:1e3,cm:10,ft:304.8,feet:304.8},Ua=t=>{let e=typeof t=="number"?"mm":t.replace(/^[^a-zA-Z]+/g,"").toLowerCase();e||(e="mm");const n=typeof t=="number"?t:Number.parseFloat(t.split(e)[0]);if(e in Mrn)return n*Mrn[e];throw new Error(`Unsupported unit: ${e}`)},Bd=Ua,Imi=Object.defineProperty,Cmi=(t,e)=>{for(var n in e)Imi(t,n,{get:e[n],enumerable:!0})},cS={};Cmi(cS,{axial:()=>dfi,bga:()=>h_i,breakoutheaders:()=>Pfi,cap:()=>Lmi,crystal:()=>Omi,d2pak:()=>krn,dfn:()=>W_i,diode:()=>Fmi,dip:()=>Qmi,dpak:()=>Trn,electrolytic:()=>vCi,fpc:()=>MCi,hc49:()=>Nfi,headermodule:()=>$_i,jst:()=>UIi,lcc:()=>yyi,led:()=>Gmi,led2835:()=>Umi,led5050:()=>Vmi,lga:()=>vfi,lqfp:()=>Sfi,m2host:()=>gyi,melf:()=>q1i,micromelf:()=>tIi,minimelf:()=>U1i,mlp:()=>b_i,mountedpcbmodule:()=>hyi,ms012:()=>tfi,ms013:()=>ofi,msop:()=>ZIi,pad:()=>Rfi,pinrow:()=>Zrn,platedhole:()=>eyi,potentiometer:()=>bCi,pushbutton:()=>Cfi,qfn:()=>x_i,qfp:()=>B_i,quad:()=>uT,radial:()=>mfi,res:()=>g_i,rj45:()=>ffi,sma:()=>rIi,smb:()=>dIi,smbf:()=>NCi,smc:()=>_Ii,smdpads:()=>KCi,smdpinheader:()=>XCi,smdpushbutton:()=>zCi,smdslideswitch:()=>$Ci,smf:()=>cIi,smtpad:()=>YCi,sod110:()=>VIi,sod123:()=>cfi,sod123f:()=>m1i,sod123fl:()=>C1i,sod123w:()=>$fi,sod128:()=>v1i,sod323:()=>e1i,sod323f:()=>g1i,sod323fl:()=>rCi,sod323w:()=>tCi,sod523:()=>Ofi,sod723:()=>B1i,sod80:()=>zfi,sod882:()=>A1i,sod882d:()=>J1i,sod923:()=>i1i,soic:()=>m_i,solderjumper:()=>mCi,son:()=>cCi,sop8:()=>Kfi,sot:()=>nyi,sot143:()=>ryi,sot223:()=>yIi,sot23:()=>G_i,sot23w:()=>PIi,sot25:()=>V_i,sot323:()=>LCi,sot343:()=>Ayi,sot363:()=>R_i,sot457:()=>ICi,sot563:()=>Z_i,sot723:()=>rfi,sot886:()=>F_i,sot89:()=>L1i,sot963:()=>xCi,ssop:()=>v_i,stampboard:()=>xfi,stampreceiver:()=>bfi,to220:()=>rsn,to220f:()=>G1i,to252:()=>Mmi,to263:()=>Dmi,to92:()=>Lfi,to92l:()=>fyi,to92s:()=>kIi,tqfp:()=>E_i,tssop:()=>M_i,usbcmidmount:()=>Cyi,vson:()=>uCi,vssop:()=>$Ii,wson:()=>pCi});var xi=(t,e,n)=>({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:"silkscreen_text_1",font:"tscircuit2024",font_size:n,pcb_component_id:"pcb_component_1",text:"{REF}",layer:"top",anchor_position:{x:t,y:e},anchor_alignment:"center"}),FX=Z().or(dn(rd())).transform(t=>Array.isArray(t)?t:(t.startsWith("(")&&t.endsWith(")")&&(t=t.slice(1,-1)),t.split(",").map(e=>{const n=Number(e);return isNaN(n)?e:n}))).pipe(dn(Z().or(_t()))),ymi=Kn(["leftside","rightside"]),xmi=Kn(["topside","bottomside"]),Emi=Kn(["left","right"]),Bmi=Kn(["top","bottom"]),Drn=FX.pipe(xo([fQ([ymi,Bmi]),fQ([xmi,Emi])])),Ci=Pt({norefdes:je().optional().describe("disable reference designator label"),invert:je().optional().describe("install the part backwards: for a pin header, the LONG pins pass through the board instead of the short ones. It does not change which side of the board the part is on — that is the component's `layer`"),faceup:je().optional().describe("DEPRECATED, and a no-op for through-hole parts. It meant 'the male pin header should face upwards, out of the top layer', which is what a correctly mounted header does by default; its other effect was to delete the pins below the board, leaving a through-hole part that cannot be soldered into its own plated holes. Use `layer` for which side of the board a part is on, and `invert` to install it backwards"),nosilkscreen:je().optional().describe("omit all silkscreen elements from the footprint"),rounded:ce.refine(t=>t>=0,{message:"rounded radius must be non-negative"}).optional().describe("corner radius applied to all rectangular copper pads"),pin1location:Drn.optional().describe("rotate the footprint to place pin 1 on a requested side"),cathodepin:S5.number().pipe(xo([$e(1),$e(2)])).optional().describe("identify which diode pad is the cathode"),anodepin:S5.number().pipe(xo([$e(1),$e(2)])).optional().describe("identify which diode pad is the anode")}),Os=(t,e,n,o,i)=>({pcb_plated_hole_id:"",type:"pcb_plated_hole",shape:"circle",x:e,y:n,hole_diameter:Ua(o),outer_diameter:Ua(i),pcb_port_id:"",layers:["top","bottom"],port_hints:[t.toString()]}),r2=t=>{const{pn:e,x:n,y:o,holeDiameter:i,rectPadWidth:r,rectPadHeight:s,holeOffsetX:a=0,holeOffsetY:A=0,rectBorderRadius:c}=t;return{pcb_plated_hole_id:"",type:"pcb_plated_hole",shape:"circular_hole_with_rect_pad",x:n,y:o,hole_diameter:Ua(i),hole_shape:"circle",pad_shape:"rect",rect_pad_width:Ua(r),rect_pad_height:Ua(s),...c!==void 0&&{rect_border_radius:c},pcb_port_id:"",layers:["top","bottom"],port_hints:[e.toString()],hole_offset_x:a,hole_offset_y:A}},lpe=Array.from({length:9},(t,e)=>Math.cos(e/8*Math.PI-Math.PI)).map(t=>({x:t,y:-Math.sqrt(1-t**2)})),s2=t=>{if(t.length<2)throw new Error("Rect union outline requires at least two bounds");for(const c of t)if(c.minX>=c.maxX||c.minY>=c.maxY)throw new Error("Each rectangle bound must have min < max on both axes");for(let c=1;c<t.length;c++){const l=t[c-1],u=t[c];if(u.minX<l.minX||u.maxX>l.maxX||u.minY>l.minY||u.maxY<l.maxY)throw new Error("Bounds must be ordered outer-to-inner with tighter X and larger Y span")}const e=()=>{const c=[];let l=t.length-1;for(c.push({x:t[l].minX,y:t[l].maxY});l>0;){const u=t[l],g=t[l-1];c.push({x:u.minX,y:g.maxY}),c.push({x:g.minX,y:g.maxY}),l-=1}return c},n=()=>{const c=[];let l=t.length-1;for(c.push({x:t[l].maxX,y:t[l].maxY});l>0;){const u=t[l],g=t[l-1];c.push({x:u.maxX,y:g.maxY}),c.push({x:g.maxX,y:g.maxY}),l-=1}return c},o=()=>{const c=[];let l=t.length-1;for(c.push({x:t[l].maxX,y:t[l].minY});l>0;){const u=t[l],g=t[l-1];c.push({x:u.maxX,y:g.minY}),c.push({x:g.maxX,y:g.minY}),l-=1}return c},i=()=>{const c=[];let l=t.length-1;for(c.push({x:t[l].minX,y:t[l].minY});l>0;){const u=t[l],g=t[l-1];c.push({x:u.minX,y:g.minY}),c.push({x:g.minX,y:g.minY}),l-=1}return c},r=e(),s=n(),a=o(),A=i();return[...r.reverse(),...s,...a.reverse(),...A]};function dP(t){return typeof t=="string"?t.trim().toLowerCase().endsWith("mil")?parseFloat(t)*.0254:parseFloat(t):Number(t)}var upe=xo([Z(),_t()]).transform(t=>dP(t)),bmi=t=>Ci.extend({fn:Z(),num_pins:_t().optional().default(6),wide:je().optional(),narrow:je().optional(),w:upe.optional(),p:upe.default(t.p??"2.54mm"),id:upe.optional(),od:upe.optional(),nosquareplating:je().optional().default(!1).describe("do not use rectangular pad for pin 1")}).transform(e=>(!e.id&&!e.od?Math.abs(e.p-1.27)<.01?(e.id=dP("0.55mm"),e.od=dP("0.95mm")):(e.id=dP("0.8mm"),e.od=dP("1.6mm")):e.id?e.od||(e.od=e.id*(1.5/1)):e.id=e.od*(1/1.5),e.w||(e.wide?e.w=dP("600mil"):e.narrow?e.w=dP("300mil"):e.w=dP(t.w??"300mil")),e)),Smi=bmi({}),Nrn=(t,e,n,o,i)=>{const r=t/2,s=e<=r,a=r-1,A=o,c=A*a;return s?{x:-n/2,y:c/2-(e-1)*A}:{x:n/2,y:-c/2+(e-r-1)*A}},Qmi=t=>{const e=Smi.parse(t),n=[];for(let _=0;_<e.num_pins;_++){const{x:f,y:I}=Nrn(e.num_pins,_+1,e.w,e.p??2.54,e.nosquareplating);if(_===0&&!e.nosquareplating){n.push(r2({pn:_+1,x:f,y:I,holeDiameter:e.id??"0.8mm",rectPadWidth:e.od??"1mm",rectPadHeight:e.od??"1mm"}));continue}n.push(Os(_+1,f,I,e.id??"0.8mm",e.od??"1mm"))}const o=(e.num_pins/2-1)*e.p+e.od,r=e.w-e.od-1,s=(e.num_pins/2-1)*e.p+e.od+.4,a={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-r/2,y:-s/2},{x:-r/2,y:s/2},...lpe.map(({x:_,y:f})=>({x:_*r/6,y:f*r/6+s/2})),{x:r/2,y:s/2},{x:r/2,y:-s/2},{x:-r/2,y:-s/2}],type:"pcb_silkscreen_path",stroke_width:.1},A=[];for(let _=0;_<e.num_pins;_++){const f=_+1,I=f<=e.num_pins/2,C=Nrn(e.num_pins,f,e.w,e.p??2.54,e.nosquareplating),y=.6,x=I?C.x-e.od/2-y:C.x+e.od/2+y,E=.3;A.push({type:"pcb_fabrication_note_text",pcb_fabrication_note_text_id:`pin_${f}`,layer:"top",pcb_component_id:`pin_${f}`,text:`{pin${f}}`,anchor_position:{x,y:C.y+E/2},font_size:E,font:"tscircuit2024",anchor_alignment:I?"top_right":"top_left"})}const c=xi(0,s/2+.5,.4),l=e.w+e.od,u=o,g=l/2+.25,h=g,d=u/2+.72,p=d,m={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:s2([{minX:-g,maxX:g,minY:-p,maxY:p},{minX:-h,maxX:h,minY:-d,maxY:d}]),layer:"top"};return{circuitJson:[...n,a,c,...A,m],parameters:e}},Wo=(t,e,n,o,i,r)=>({type:"pcb_smtpad",x:e,y:n,width:o,height:i,layer:"top",shape:"rect",...r!==void 0&&{corner_radius:r},pcb_smtpad_id:"",port_hints:Array.isArray(t)?t.map(s=>s.toString()):[t.toString()]}),sA=(t,e={})=>({type:"pcb_silkscreen_path",layer:e.layer||"top",pcb_component_id:e.pcb_component_id||"",pcb_silkscreen_path_id:e.pcb_silkscreen_path_id||"",route:t,stroke_width:e.stroke_width||.1}),vmi=Ci.extend({fn:Z(),num_pins:xo([$e(3),$e(6)]).default(3),p:ce.default("2.29mm").describe("pitch between adjacent lead positions"),pw:ce.default("1.6mm").describe("lead pad width along the pin column"),pl:ce.default("3mm").describe("lead pad length toward the package"),tabw:ce.default("6.2mm").describe("large tab pad width"),tabh:ce.default("5.8mm").describe("large tab pad height"),span:ce.default("6.85mm").describe("center-to-center distance from the leads to the tab"),w:ce.default("6.6mm").describe("package body width"),h:ce.default("6.5mm").describe("package body height"),string:Z().optional()}),wmi={p:"2.54mm",pw:"1.5mm",pl:"3.5mm",tabw:"8.38mm",tabh:"10.7mm",span:"10.21mm",w:"10.1mm",h:"10.1mm"},Pmi=t=>{if(t.num_pins===3||t.num_pins===6)return t.num_pins;const e=t.string?.match(/^(?:d2pak|to252|to263)_(\d+)/i),n=Number.parseInt(e?.[1]??"3",10);return n===5||n===6?6:3},Rrn=(t,e)=>{const n=vmi.parse({...e,...t,num_pins:Pmi(t)}),{num_pins:o,p:i,pw:r,pl:s,tabw:a,tabh:A,span:c,w:l,h:u}=n,g=o===3?2:5,h=-c/2,d=c/2,p=[];for(let M=0;M<g;M++){const k=o===3?M*2+1:M+1,R=o===3?(1-M*2)*i:((g-1)/2-M)*i;p.push(Wo(k,h,R,s,r))}p.push(Wo(o===3?2:6,d,0,a,A));const m=-l/2,_=l/2,f=Math.min(h-s/2,d-a/2),I=Math.max(h+s/2,d+a/2),C=(o===3?i:(g-1)/2*i)+r/2,y=Math.max(C,A/2),x=Math.max(y,u/2)+.2,E=[sA([{x:m,y:x},{x:_,y:x}]),sA([{x:m,y:-x},{x:_,y:-x}]),sA([{x:h-.3,y:x+.15},{x:h,y:x+.45},{x:h+.3,y:x+.15}])],B=Math.min(f,m)-.25,S=Math.max(I,_)+.25,Q=Math.max(y,u/2)+.25,w={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:(B+S)/2,y:0},width:S-B,height:Q*2,layer:"top"};return{circuitJson:[...p,...E,xi(0,Q+.55,.5),w],parameters:n}},Trn=t=>Rrn(t),krn=t=>Rrn(t,wmi),Mmi=Trn,Dmi=krn,Frn=[{imperial:"01005",metric:"0402",p_mm_min:.5,pw_mm_min:.4,ph_mm_min:.3,w_mm_min:.58,h_mm_min:.21,courtyard_width_mm:1.2,courtyard_height_mm:.6},{imperial:"0504",metric:"1310",p_mm_min:1.1,pw_mm_min:.65,ph_mm_min:1.3,w_mm_min:.58,h_mm_min:.21},{imperial:"1812",metric:"4532",p_mm_min:4.275,pw_mm_min:1.125,ph_mm_min:3.4,w_mm_min:5.4,h_mm_min:3.4,courtyard_width_mm:5.9,courtyard_height_mm:3.9,rounded_pads:!0,nonpolarizedSilkscreen:{line_half_length_mm:1.386252,line_y_mm:1.71,stroke_width_mm:.12}},{imperial:"0201",metric:"0603",p_mm_min:.66,pw_mm_min:.46,ph_mm_min:.4,w_mm_min:.9,h_mm_min:.3,courtyard_width_mm:1.4,courtyard_height_mm:.7,rounded_pads:!0},{imperial:"0402",metric:"1005",p_mm_min:1.02,pw_mm_min:.54,ph_mm_min:.64,w_mm_min:1.56,h_mm_min:.64,courtyard_width_mm:1.86,courtyard_height_mm:.94,rounded_pads:!0,nonpolarizedSilkscreen:{line_half_length_mm:.153641,line_y_mm:.38,stroke_width_mm:.12}},{imperial:"0603",metric:"1608",p_mm_min:1.65,pw_mm_min:.8,ph_mm_min:.95,w_mm_min:2.45,h_mm_min:.95,courtyard_width_mm:2.96,courtyard_height_mm:1.46,rounded_pads:!0,nonpolarizedSilkscreen:{line_half_length_mm:.237258,line_y_mm:.5225,stroke_width_mm:.12}},{imperial:"0805",metric:"2012",p_mm_min:1.825,pw_mm_min:1.025,ph_mm_min:1.4,w_mm_min:2.8499999999999996,h_mm_min:1.4,courtyard_width_mm:3.36,courtyard_height_mm:1.9,rounded_pads:!0,nonpolarizedSilkscreen:{line_half_length_mm:.227064,line_y_mm:.735,stroke_width_mm:.12}},{imperial:"1206",metric:"3216",p_mm_min:2.925,pw_mm_min:1.125,ph_mm_min:1.75,w_mm_min:4.05,h_mm_min:1.75,courtyard_width_mm:4.56,courtyard_height_mm:2.26,rounded_pads:!0,nonpolarizedSilkscreen:{line_half_length_mm:.727064,line_y_mm:.91,stroke_width_mm:.12}},{imperial:"1210",metric:"3225",p_mm_min:2.925,pw_mm_min:1.125,ph_mm_min:2.65,w_mm_min:4.05,h_mm_min:2.65,courtyard_width_mm:4.56,courtyard_height_mm:3.16,rounded_pads:!0,nonpolarizedSilkscreen:{line_half_length_mm:.723737,line_y_mm:1.355,stroke_width_mm:.12}},{imperial:"2010",metric:"5025",p_mm_min:4.625,pw_mm_min:1.225,ph_mm_min:2.65,w_mm_min:5.85,h_mm_min:2.65,courtyard_width_mm:6.36,courtyard_height_mm:3.16,rounded_pads:!0,nonpolarizedSilkscreen:{line_half_length_mm:1.527064,line_y_mm:1.36,stroke_width_mm:.12}},{imperial:"2512",metric:"6332",p_mm_min:5.925,pw_mm_min:1.225,ph_mm_min:3.35,w_mm_min:7.15,h_mm_min:3.35,courtyard_width_mm:7.66,courtyard_height_mm:3.86,rounded_pads:!0,nonpolarizedSilkscreen:{line_half_length_mm:2.177064,line_y_mm:1.71,stroke_width_mm:.12}}],Nmi=Object.fromEntries(Frn.map(t=>[t.metric,t])),Rmi=Object.fromEntries(Frn.map(t=>[t.imperial,t])),Lrn=(t,e)=>({type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:t,height:e,layer:"top"});Ci.extend({fn:Z().optional(),string:Z().optional(),tht:je(),p:ce.optional(),pw:ce.optional(),ph:ce.optional(),metric:lt.optional(),imperial:lt.optional(),w:ce.optional(),h:ce.optional(),cyw:ce.optional().describe("courtyard width"),cyh:ce.optional().describe("courtyard height"),nonpolarized:je().optional(),textbottom:je().optional(),roundedPads:je().optional()});var gpe=t=>{let{fn:e,tht:n,p:o,pw:i,ph:r,metric:s,imperial:a,w:A,h:c,cyw:l,cyh:u,nonpolarized:g,textbottom:h,roundedPads:d,string:p}=t;if(typeof A=="string"&&(A=Bd(A)),typeof c=="string"&&(c=Bd(c)),typeof l=="string"&&(l=Bd(l)),typeof u=="string"&&(u=Bd(u)),typeof o=="string"&&(o=Bd(o)),typeof i=="string"&&(i=Bd(i)),typeof r=="string"&&(r=Bd(r)),c!==void 0&&A!==void 0&&c>A)throw new Error("height cannot be greater than width (rotated footprint not yet implemented)");let m;if(s&&(m=Nmi[s]),a&&(m=Rmi[a]),m&&(A=m.w_mm_min,c=m.h_mm_min,o=m.p_mm_min,i=m.pw_mm_min,r=m.ph_mm_min),o===void 0||i===void 0||r===void 0)throw new Error("Could not determine required pad dimensions (p, pw, ph)");let _=[];const f=e==="res"&&(g===!0||typeof p!="string"||/^res(?:\d{4}|\d{5})(?:_|$)/i.test(p))?m?.nonpolarizedSilkscreen:void 0;if(f?.stroke_width_mm){const{line_half_length_mm:B=0,line_y_mm:S=0,stroke_width_mm:Q}=f;_=[{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-B,y:S},{x:B,y:S}],stroke_width:Q,pcb_silkscreen_path_id:""},{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-B,y:-S},{x:B,y:-S}],stroke_width:Q,pcb_silkscreen_path_id:""}]}else _=[{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:o/2,y:r/2+.4},{x:-o/2-i/2-.2,y:r/2+.4},{x:-o/2-i/2-.2,y:-r/2-.4},{x:o/2,y:-r/2-.4}],stroke_width:.1,pcb_silkscreen_path_id:""}];const I=h?-r/2-.9:r/2+.9,C=xi(0,I,.2),y=m?.courtyard_width_mm&&m.courtyard_height_mm?Lrn(m.courtyard_width_mm,m.courtyard_height_mm):l!==void 0&&u!==void 0?Lrn(l,u):null,E=d??m?.rounded_pads??!1?Math.min(.125,Math.min(i,r)/8):void 0;return n?[Os(1,-o/2,0,i,i*1/.8),Os(2,o/2,0,i,i*1/.8),..._,C,...y?[y]:[]]:[Wo(["1","left"],-o/2,0,i,r,E),Wo(["2","right"],o/2,0,i,r,E),..._,C,...y?[y]:[]]},Tmi=t=>{let e=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const r of t)r.type==="pcb_smtpad"&&(e=Math.min(e,r.x-r.width/2),n=Math.max(n,r.x+r.width/2),o=Math.min(o,r.y-r.height/2),i=Math.max(i,r.y+r.height/2)),r.type==="pcb_plated_hole"&&(e=Math.min(e,r.x-r.outer_diameter/2),n=Math.max(n,r.x+r.outer_diameter/2),o=Math.min(o,r.y-r.outer_diameter/2),i=Math.max(i,r.y+r.outer_diameter/2));if(!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(i))throw new Error("Could not determine diode copper bounds");return{minX:e,maxX:n,minY:o,maxY:i}},Hrn=(t,e={})=>dpe(Tmi(t),e),kmi=({anodePin:t,cathodePin:e})=>{if(t!==void 0&&t!==1&&t!==2)throw new Error("Diode anode pin must be 1 or 2");if(e!==void 0&&e!==1&&e!==2)throw new Error("Diode cathode pin must be 1 or 2");if(t!==void 0&&e!==void 0){if(t===e)throw new Error("Diode anode and cathode cannot use the same pin");return e}if(e!==void 0)return e;if(t===1)return 2;if(t===2)return 1},uh=t=>{const e=t.p??t.pad_spacing;if(e===void 0||t.pl===void 0||t.pw===void 0)throw new Error("Diode fabrication note requires p or pad_spacing, pl, and pw");const n=ce.parse(e),o=ce.parse(t.pl),i=ce.parse(t.pw);return dpe({minX:-n/2-o/2,maxX:n/2+o/2,minY:-i/2,maxY:i/2},{anodePin:t.anodepin,cathodePin:t.cathodepin})},dpe=(t,e={})=>{const n=[],o=t.maxX-t.minX,i=t.maxY-t.minY,r=(t.minX+t.maxX)/2,s=(t.minY+t.maxY)/2,A=kmi(e)===1?x=>2*r-x:x=>x,c=i*.28,l=c*2,u=o*.2,h=Math.min(u,l*1.25),d=r-h/2,p=r+h/2,m=h*.18,_=d+m,f=p-m,I=Math.max(Math.min(o,i)*.035,.01),C=Math.max(Math.min(o,i)*.25,.1),y=x=>e.idSuffix?`${x}_${e.idSuffix}`:x;return n.push({type:"pcb_fabrication_note_path",pcb_fabrication_note_path_id:y("diode_fabrication_note_anode_leg"),pcb_component_id:"",layer:"top",stroke_width:I,route:[{x:A(d),y:s},{x:A(_),y:s}]},{type:"pcb_fabrication_note_path",pcb_fabrication_note_path_id:y("diode_fabrication_note_triangle"),pcb_component_id:"",layer:"top",stroke_width:I,route:[{x:A(_),y:s+c},{x:A(f),y:s},{x:A(_),y:s-c},{x:A(_),y:s+c}]},{type:"pcb_fabrication_note_path",pcb_fabrication_note_path_id:y("diode_fabrication_note_cathode"),pcb_component_id:"",layer:"top",stroke_width:I,route:[{x:A(f),y:s+c},{x:A(f),y:s-c}]},{type:"pcb_fabrication_note_path",pcb_fabrication_note_path_id:y("diode_fabrication_note_cathode_leg"),pcb_component_id:"",layer:"top",stroke_width:I,route:[{x:A(f),y:s},{x:A(p),y:s}]},{type:"pcb_fabrication_note_text",pcb_fabrication_note_text_id:y("diode_fabrication_note_positive"),pcb_component_id:"",layer:"top",font:"tscircuit2024",font_size:C,text:"+",anchor_position:{x:A(t.minX+o*.125),y:s},anchor_alignment:"center"},{type:"pcb_fabrication_note_text",pcb_fabrication_note_text_id:y("diode_fabrication_note_negative"),pcb_component_id:"",layer:"top",font:"tscircuit2024",font_size:C,text:"-",anchor_position:{x:A(t.maxX-o*.125),y:s},anchor_alignment:"center"}),n},Fmi=t=>{const e=gpe({...t,roundedPads:!0});return{circuitJson:e.concat(Hrn(e,{anodePin:t.anodepin,cathodePin:t.cathodepin})),parameters:t}},Lmi=t=>({circuitJson:gpe(t),parameters:t}),Hmi=Ci.extend({fn:$e("crystal"),num_pins:$e(4).default(4),px:ce.default("2.2mm").describe("horizontal pad center pitch"),py:ce.default("1.7mm").describe("vertical pad center pitch"),pw:ce.default("1.4mm").describe("pad width"),ph:ce.default("1.2mm").describe("pad height")}),Omi=t=>{const e=Hmi.parse(t),{px:n,py:o,pw:i,ph:r}=e,s=[Wo(1,-n/2,-o/2,i,r),Wo(2,n/2,-o/2,i,r),Wo(3,n/2,o/2,i,r),Wo(4,-n/2,o/2,i,r)],a=(n+i)/2+.2,A=(o+r)/2+.2,c=sA([{x:-a,y:-A},{x:a,y:-A},{x:a,y:A},{x:-a,y:A},{x:-a,y:-A}]),l=xi(0,A+.6,.5),u={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:n+i+.5,height:o+r+.5,layer:"top"};return{circuitJson:[...s,c,l,u],parameters:e}},Gmi=t=>{const e=gpe(t);return{circuitJson:e.concat(Hrn(e,{anodePin:t.anodepin,cathodePin:t.cathodepin})).map(o=>o.type!=="pcb_silkscreen_path"?o:{...o,route:o.route.map(i=>({...i,x:-i.x}))}),parameters:t}},Ymi=Ci.extend({fn:$e("led2835"),num_pins:$e(2).default(2),p1w:ce.default("2.2mm").describe("pin 1 (anode) pad width"),p2w:ce.default("1.25mm").describe("pin 2 (cathode) pad width"),ph:ce.default("2.2mm").describe("pad height"),p1x:ce.default("-0.9mm").describe("pin 1 pad center x"),p2x:ce.default("1.375mm").describe("pin 2 pad center x"),w:ce.default("3.5mm").describe("package body width"),h:ce.default("2.8mm").describe("package body height")}),Umi=t=>{const e=Ymi.parse(t),{p1w:n,p2w:o,ph:i,p1x:r,p2x:s,w:a,h:A}=e,c=[Wo(1,r,0,n,i),Wo(2,s,0,o,i)],l=a/2+.45,u=A/2+.2,g=[sA([{x:s-o/2,y:-u},{x:-l,y:-u},{x:-l,y:u},{x:s-o/2,y:u}])],h=xi(0,u+.8,.5),d={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:(r-n/2+s+o/2)/2,y:0},width:s+o/2-(r-n/2)+.5,height:Math.max(A,i)+.5,layer:"top"},p=dpe({minX:Math.min(r-n/2,s-o/2),maxX:Math.max(r+n/2,s+o/2),minY:-i/2,maxY:i/2},{anodePin:e.anodepin,cathodePin:e.cathodepin});return{circuitJson:[...c,...g,h,d,...p],parameters:e}},Kmi=Ci.extend({fn:$e("led5050"),num_pins:$e(6).default(6),p:ce.default("1.7mm").describe("pin pitch along each column"),rowspan:ce.default("4.8mm").describe("distance between pad columns"),pl:ce.default("2mm").describe("pad length across the package edge"),pw:ce.default("1.1mm").describe("pad width along the pin column"),w:ce.default("5mm").describe("package body width"),h:ce.default("5mm").describe("package body height")}),Vmi=t=>{const e=Kmi.parse(t),{p:n,rowspan:o,pl:i,pw:r,w:s,h:a}=e,A=[];for(let m=0;m<3;m++)A.push(Wo(m+1,-o/2,n-m*n,i,r)),A.push(Wo(6-m,o/2,n-m*n,i,r));const c=s/2,l=a/2+.2,u=[sA([{x:-c,y:l},{x:c,y:l}]),sA([{x:-c,y:-l},{x:c,y:-l}]),sA([{x:-o/2-i/2-.4,y:n+r/2},{x:-o/2-i/2-.4,y:n-r/2}])],g=xi(0,l+.8,.5),h={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:o+i+.5,height:Math.max(a,2*n+r)+.5,layer:"top"},p=[{color:"green",y:n},{color:"red",y:0},{color:"blue",y:-n}].flatMap(({color:m,y:_})=>dpe({minX:-o/2-i/2,maxX:o/2+i/2,minY:_-r/2,maxY:_+r/2},{idSuffix:m}));return{circuitJson:[...A,...u,g,h,...p],parameters:e}},NY=t=>{const{padSpacing:e,padWidth:n,padHeight:o,padPitch:i,numRows:r,textbottom:s,courtyardOutline:a}=t,A=[],c=(r-1)*(i/2);for(let Q=0;Q<r;Q++)A.push(c-Q*i);const l=[];A.forEach((Q,w)=>{l.push(Wo(w+1,-e/2,Q,n,o))}),A.slice().reverse().forEach((Q,w)=>{l.push(Wo(w+r+1,e/2,Q,n,o))});const u=Math.max(...A)+o/2+.4,g=Math.min(...A)-o/2-.4,h=-e/2-n/2-.4,d=e/2+n/2+.4,p={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:d*.5,y:u},{x:h*.5,y:u}],stroke_width:.12,pcb_silkscreen_path_id:"silkscreen_top"},m={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:d*.5,y:g},{x:h*.5,y:g}],stroke_width:.12,pcb_silkscreen_path_id:"silkscreen_bottom"},_=-e/2,f=Math.max(...A),I=.2,C=_-n/2-.1,y=f+o/2+.1,x={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_marker",route:[{x:C,y},{x:C-I,y},{x:C,y:y+I},{x:C,y}],stroke_width:.1},E=s?g-.9:u+.9,B=xi(0,E,.2),S=a?{type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",layer:"top",outline:a}:null;return[...l,p,m,x,B,...S?[S]:[]]},zmi=Ci.extend({pw:ce.default("0.5mm"),ph:ce.default("0.4mm"),p:ce.default("0.7mm"),textbottom:je().optional(),convex:je().optional(),concave:je().optional()}),Jmi=1,Wmi=t=>{const e=zmi.parse(t);if(e.concave===!0)return[];const n=Bd(e.pw),o=Bd(e.ph),i=Bd(e.p);return NY({padSpacing:Jmi,padWidth:n,padHeight:o,padPitch:i,numRows:2,textbottom:e.textbottom,convex:e.convex,concave:e.concave,courtyardOutline:[{x:-1,y:.95},{x:-1,y:-.95},{x:1,y:-.95},{x:1,y:.95}]})},jmi=Ci.extend({pw:ce.default("0.5mm"),ph:ce.default("0.32mm"),p:ce.default("0.5mm"),textbottom:je().optional(),convex:je().optional(),concave:je().optional()}),$mi=1,qmi=t=>{const e=jmi.parse(t),n=Bd(e.pw),o=Bd(e.ph),i=Bd(e.p);return NY({padSpacing:$mi,padWidth:n,padHeight:o,padPitch:i,numRows:4,textbottom:e.textbottom,convex:e.convex,concave:e.concave,courtyardOutline:[{x:-1,y:1.25},{x:-1,y:-1.25},{x:1,y:-1.25},{x:1,y:1.25}]})},Xmi=Ci.extend({pw:ce.default("0.9mm"),ph:ce.default("0.4mm"),p:ce.default("0.8mm"),textbottom:je().optional(),convex:je().optional(),concave:je().optional()}),Zmi=1.7,e_i=t=>{const e=Xmi.parse(t),n=Bd(e.pw),o=Bd(e.ph),i=Bd(e.p);return NY({padSpacing:Zmi,padWidth:n,padHeight:o,padPitch:i,numRows:2,textbottom:e.textbottom,convex:e.convex,concave:e.concave,courtyardOutline:[{x:-1.55,y:1.05},{x:-1.55,y:-1.05},{x:1.55,y:-1.05},{x:1.55,y:1.05}]})},t_i=Ci.extend({pw:ce.default("0.9mm"),ph:ce.default("0.4mm"),p:ce.default("0.8mm"),textbottom:je().optional(),convex:je().optional(),concave:je().optional()}),n_i=1.7,o_i=t=>{const e=t_i.parse(t),n=Bd(e.pw),o=Bd(e.ph),i=Bd(e.p);return NY({padSpacing:n_i,padWidth:n,padHeight:o,padPitch:i,numRows:4,textbottom:e.textbottom,convex:e.convex,concave:e.concave,courtyardOutline:[{x:-1.55,y:1.88},{x:-1.55,y:-1.87},{x:1.55,y:-1.87},{x:1.55,y:1.88}]})},i_i=Ci.extend({pw:ce.default("0.7mm"),ph:ce.default("0.64mm"),p:ce.default("0.94mm"),textbottom:je().optional(),convex:je().optional(),concave:je().optional()}),r_i=1.4,s_i=t=>{const e=i_i.parse(t),n=Bd(e.pw),o=Bd(e.ph),i=Bd(e.p);return NY({padSpacing:r_i,padWidth:n,padHeight:o,padPitch:i,numRows:2,textbottom:e.textbottom,convex:e.convex,concave:e.concave,courtyardOutline:[{x:-1.3,y:1.05},{x:-1.3,y:-1.05},{x:1.3,y:-1.05},{x:1.3,y:1.05}]})},a_i=Ci.extend({pw:ce.default("0.9mm"),ph:ce.default("0.9mm"),p:ce.default("1.34mm"),textbottom:je().optional(),convex:je().optional(),concave:je().optional()}),A_i=3,c_i=t=>{const e=a_i.parse(t),n=Bd(e.pw),o=Bd(e.ph),i=Bd(e.p);return NY({padSpacing:A_i,padWidth:n,padHeight:o,padPitch:i,numRows:4,textbottom:e.textbottom,convex:e.convex,concave:e.concave,courtyardOutline:[{x:-2.21,y:2.85},{x:-2.21,y:-2.85},{x:2.2,y:-2.85},{x:2.2,y:2.85}]})},l_i=t=>{const e=t.array??t.x;if(typeof e=="number")return Number.isNaN(e)?void 0:e;if(typeof e=="string"){const n=Number.parseInt(e,10);return Number.isNaN(n)?void 0:n}if(typeof t.imperial=="string"){const o=t.imperial.match(/x(2|4)$/)?.[1];if(o)return Number.parseInt(o,10)}},u_i=t=>t?(typeof t=="number"?`${t}`:t).split(/[_x]/)[0]:void 0,g_i=t=>{const e=l_i(t),n=u_i(t.imperial);return e===2&&n==="0402"?{circuitJson:Wmi(t),parameters:t}:e===4&&n==="0402"?{circuitJson:qmi(t),parameters:t}:e===2&&n==="0603"?{circuitJson:e_i(t),parameters:t}:e===4&&n==="0603"?{circuitJson:o_i(t),parameters:t}:e===2&&n==="0606"?{circuitJson:s_i(t),parameters:t}:e===4&&n==="1206"?{circuitJson:c_i(t),parameters:t}:{circuitJson:gpe(t),parameters:t}},Orn=(t,{x:e,y:n,radius:o})=>({type:"pcb_smtpad",x:e,y:n,radius:o,layer:"top",shape:"circle",pcb_smtpad_id:"",port_hints:Array.isArray(t)?t.map(i=>i.toString()):[t.toString()]}),Grn="ABCDEFGHIJKLMNOPQRSTUVWXYZ",WB=Z().transform(t=>{const[e,n]=t.split(/[x ]/);return{x:parseFloat(e??""),y:parseFloat(n??"")}}).pipe(Pt({x:_t(),y:_t()})),d_i=Ci.extend({fn:Z(),num_pins:_t().optional().default(64),grid:WB.optional(),p:lt.default("0.8mm"),w:ce.optional(),h:ce.optional(),ball:ce.optional().describe("ball diameter"),pad:ce.optional().describe("pad width/height"),circularpads:je().optional().default(!0).describe("use circular pads"),tlorigin:je().optional(),blorigin:je().optional(),trorigin:je().optional(),brorigin:je().optional(),missing:FX.default([])}).transform(t=>{let e="tl";if(t.blorigin&&(e="bl"),t.trorigin&&(e="tr"),t.brorigin&&(e="br"),!t.grid){const o=Math.ceil(Math.sqrt(t.num_pins));t.grid={x:o,y:o}}return t.missing&&(t.missing=t.missing.map(o=>{if(typeof o=="number")return o;if(o==="center")return"center";if(o==="topleft")return"topleft";const i=o.match(/([A-Z]+)(\d+)/);if(!i)return o;const r=Grn.indexOf(i[1]),s=Number.parseInt(i[2])-1;return r*t.grid.x+s+1})),{...t,origin:e}}),h_i=t=>{const e=d_i.parse(t);let{num_pins:n,grid:o,p:i,w:r,h:s,ball:a,pad:A,missing:c}=e;a??=.75/1.27*i,A??=e.ball===void 0?i*.5:a*.8;const l=[],u=(c??[]).filter(Y=>typeof Y=="number"),g=o.x*o.y-n;if(c.length===0&&g>0&&(Math.sqrt(g)%1===0?c.push("center"):g===1&&c.push("topleft")),c?.includes("center")){const Y=Math.floor(Math.sqrt(g)),W=Math.floor((o.x-Y)/2),te=Math.floor((o.y-Y)/2);for(let j=te;j<te+Y;j++)for(let J=W;J<W+Y;J++)u.push(j*o.x+J+1)}c?.includes("topleft")&&u.push(1);const h=new Set(u);let d=0;for(let Y=0;Y<o.y;Y++)for(let W=0;W<o.x;W++){const te=(W-(o.x-1)/2)*i,j=(Y-(o.y-1)/2)*i;let J=W,oe=Y;switch(e.origin){case"bl":J=W,oe=o.y-1-Y;break;case"br":J=o.x-1-W,oe=o.y-1-Y;break;case"tr":J=o.x-1-W,oe=Y;break}let ie=oe*o.x+J+1;if(h.has(ie)){d++;continue}ie-=d;const ne=[ie,`${Grn[oe]}${J+1}`];l.push(e.circularpads?Orn(ne,{x:te,y:j,radius:A/2}):Wo(ne,te,j,A,A))}const p=xi(0,o.y*i/2,.2),m=i/6;let _;const f=o.x*i/2,I=o.y*i/2;switch(e.origin){case"bl":_=[{x:-f,y:-I},{x:-f,y:-I-m},{x:-f-m,y:-I},{x:-f,y:-I}];break;case"br":_=[{x:f,y:-I},{x:f,y:-I-m},{x:f+m,y:-I},{x:f,y:-I}];break;case"tr":_=[{x:f,y:I},{x:f,y:I+m},{x:f+m,y:I},{x:f,y:I}];break;default:_=[{x:-f,y:I},{x:-f,y:I+m},{x:-f-m,y:I},{x:-f,y:I}];break}const C={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_marker",route:_,stroke_width:.05},y=(o.x-1)*i+A,x=(o.y-1)*i+A,E=r??y,B=s??x,S=Math.max(y/2,E/2),Q=Math.max(x/2,B/2),w=1.715,M=1.765,k=S+w,R=k,F=Q+M,O=F,U={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:s2([{minX:-k,maxX:k,minY:-O,maxY:O},{minX:-R,maxX:R,minY:-F,maxY:F}]),layer:"top"};return{circuitJson:[...l,p,C,U],parameters:e}},cT=(t,e,n,o,i)=>({type:"pcb_smtpad",x:e,y:n,width:o,height:i,radius:Math.min(o,i)/2,layer:"top",shape:"pill",pcb_smtpad_id:"",port_hints:Array.isArray(t)?t.map(r=>r.toString()):[t.toString()]}),RY={thermalpadcenteroffsetx:ce.optional().default(0),thermalpadcenteroffsety:ce.optional().default(0)},hP=(t,e)=>Wo(["thermalpad"],e.x,e.y,t.x,t.y),lT=t=>Ci.extend({fn:Z(),num_pins:_t().optional().default(8),w:ce.default(ce.parse(t.w??"5.3mm")),p:ce.default(ce.parse(t.p??"1.27mm")),pw:ce.default(ce.parse(t.pw??"0.6mm")),pl:ce.default(ce.parse(t.pl??"1.0mm")),legsoutside:je().optional().default(t.legsoutside??!1),pillpads:je().optional().default(t.pillpads??!1),thermalpad:WB.optional(),...RY,silkscreen_stroke_width:_t().optional().default(.1)}).transform(e=>(!e.pw&&!e.pl?(e.pw=ce.parse("0.6mm"),e.pl=ce.parse("1.0mm")):e.pw?e.pl||(e.pl=e.pw*(1/.6)):e.pw=e.pl*(.6/1),e)),p_i=lT({}),UVe=t=>{t.widthincludeslegs!==void 0&&(t.legsoutside=!t.widthincludeslegs);const{num_pins:e,pn:n,w:o,p:i,pl:r,legsoutside:s}=t,a=e/2,A=n<=a,c=a-1,l=i,u=l*c,g=s?r/2:-r/2;return A?{x:-o/2-g,y:u/2-(n-1)*l}:{x:o/2+g,y:-u/2+(n-a-1)*l}},m_i=t=>{const e=p_i.parse(t);return{circuitJson:LX(e),parameters:e}},LX=t=>{const e=[],n=Math.min(t.pl,t.pw)/8;let o=0,i=0;for(let _=0;_<t.num_pins;_++){const{x:f,y:I}=UVe({num_pins:t.num_pins,pn:_+1,w:t.w,p:t.p,pl:t.pl,legsoutside:t.legsoutside});o=Math.max(o,Math.abs(f)+t.pl/2),i=Math.max(i,Math.abs(I)+t.pw/2),t.pillpads?e.push(cT(_+1,f,I,t.pl,t.pw)):e.push(Wo(_+1,f,I,t.pl,t.pw,n))}t.thermalpad&&e.push(hP(t.thermalpad,{x:t.thermalpadcenteroffsetx,y:t.thermalpadcenteroffsety}));const r=Math.min(1,t.p/2),s=t.w-(t.legsoutside?0:t.pl*2)-.2,a=(t.num_pins/2-1)*t.p+t.pw+r,A=xi(0,a/2+.4,a/12),c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",stroke_width:t.silkscreen_stroke_width??.1,route:[{x:-s/2,y:-a/2},{x:-s/2,y:a/2},...lpe.map(({x:_,y:f})=>({x:_*s/6,y:f*s/6+a/2})),{x:s/2,y:a/2},{x:s/2,y:-a/2},{x:-s/2,y:-a/2}]},l=t.w/2,u=a/2,g=Math.max(o,l)+.25,h=Math.min(i,u)+.25,d=Math.min(o,l)+.25,p=Math.max(i,u)+.25,m={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",layer:"top",outline:s2([{minX:-g,maxX:g,minY:-h,maxY:h},{minX:-d,maxX:d,minY:-p,maxY:p}])};return[...e,c,A,m]},__i=({num_pins:t,sidePinCounts:e,cw:n,ccw:o,startingpin:i})=>{const r=[],s=e.left,a=s+1,A=e.left+e.bottom,c=A+1,l=e.left+e.bottom+e.right,u=l+1;let g=1;const h={};for(const d of i??[])h[d]=!0;!h.leftside&&!h.topside&&!h.rightside&&!h.bottomside&&(h.leftside=!0),!h.bottompin&&!h.leftpin&&!h.rightpin&&!h.toppin&&(h.leftside?h.toppin=!0:h.topside?h.rightpin=!0:h.rightside?h.bottompin=!0:h.bottomside&&(h.leftpin=!0)),h.leftside&&h.toppin?g=1:h.leftside&&h.bottompin?g=s:h.bottomside&&h.leftpin?g=a:h.bottomside&&h.rightpin?g=A:h.rightside&&h.bottompin?g=c:h.rightside&&h.toppin?g=l:h.topside&&h.rightpin?g=u:h.topside&&h.leftpin&&(g=t),r.push(-1);for(let d=0;d<t;d++)r[g]=d+1,o||!n?(g++,g>t&&(g=1)):(g--,g<1&&(g=t));return r},Yrn=(t,e,n,o)=>{if(e!==void 0&&o!==void 0&&e!==o)throw new Error(`Conflicting ${t} (${e}) and ${n} (${o})`);return o??e},Urn=t=>{const e=Yrn("lrpins",t.lrpins,"leftrightpins",t.leftrightpins),n=Yrn("tbpins",t.tbpins,"topbottompins",t.topbottompins),o=t.num_pins/4,i={left:t.leftpins??e??o,top:t.toppins??n??o,right:t.rightpins??e??o,bottom:t.bottompins??n??o};if([t.leftpins,t.toppins,t.rightpins,t.bottompins,t.lrpins,t.leftrightpins,t.tbpins,t.topbottompins].some(s=>s!==void 0)){const s=Object.entries(i),a=s.find(([,c])=>!Number.isInteger(c)||c<1);if(a)throw new Error(`Quad ${a[0]} pin count must be a positive integer, got ${a[1]}`);const A=s.reduce((c,[,l])=>c+l,0);if(A!==t.num_pins)throw new Error(`Quad side pin counts left=${i.left}, top=${i.top}, right=${i.right}, bottom=${i.bottom} require ${A} pins, got ${t.num_pins}`)}return i},Krn=Kn(["leftside","topside","rightside","bottomside","toppin","bottompin","leftpin","rightpin"]),pP=S5.number().int().positive().optional(),hpe=Ci.extend({fn:Z(),cc:je().default(!0).optional(),ccw:je().default(!0).optional(),startingpin:Z().or(dn(Krn)).transform(t=>typeof t=="string"?t.slice(1,-1).split(","):t).pipe(dn(Krn)).optional(),num_pins:_t().optional().default(64),leftpins:pP,toppins:pP,rightpins:pP,bottompins:pP,lrpins:pP,leftrightpins:pP,tbpins:pP,topbottompins:pP,w:ce.optional(),h:ce.optional(),p:ce.default(ce.parse("0.5mm")),px:ce.optional().describe("top and bottom side pad pitch"),py:ce.optional().describe("left and right side pad pitch"),pw:ce.optional(),pl:ce.optional(),lrpw:ce.optional().describe("alias for leftrightpadwidth"),lrpl:ce.optional().describe("alias for leftrightpadlength"),leftrightpadwidth:ce.optional().describe("left and right side pad width"),leftrightpadlength:ce.optional().describe("left and right side pad length"),thermalpad:xo([$e(!0),WB]).optional(),...RY,pillpads:je().optional().default(!1),legsoutside:je().default(!1)}),ppe=t=>{if(t.lrpw!==void 0&&t.leftrightpadwidth!==void 0&&t.lrpw!==t.leftrightpadwidth)throw new Error(`Conflicting lrpw (${t.lrpw}) and leftrightpadwidth (${t.leftrightpadwidth})`);if(t.lrpl!==void 0&&t.leftrightpadlength!==void 0&&t.lrpl!==t.leftrightpadlength)throw new Error(`Conflicting lrpl (${t.lrpl}) and leftrightpadlength (${t.leftrightpadlength})`);t.leftrightpadwidth=t.leftrightpadwidth??t.lrpw,t.leftrightpadlength=t.leftrightpadlength??t.lrpl,t.w&&!t.h?t.h=t.w:!t.w&&t.h&&(t.w=t.h);const e=Urn(t),n=Math.max(e.top,e.bottom),o=Math.max(e.left,e.right),i=t.px??t.p,r=t.py??t.p;if(!t.p&&!t.pw&&!t.pl&&t.w){const s=n+4;t.p=t.w/s}if(!t.p&&t.w&&t.h&&t.pw&&t.pl){const s=(t.w-t.pl*2)/Math.max(n-1,1),a=(t.h-t.pl*2)/Math.max(o-1,1);t.p=(s+a)/2}return!t.w&&!t.h&&t.p&&(t.w=i*(n+4),t.h=r*(o+4)),t.p&&!t.pw&&!t.pl?(t.pw=t.p/2,t.pl=t.p/2):t.pw?t.pl||(t.pl=t.pw*(1/.6)):t.pw=t.pl*(.6/1),t},Vrn=hpe.transform(ppe),f_i=["left","bottom","right","top"],I_i=t=>{const{sidePinCounts:e,pn:n,w:o,h:i,p:r,px:s,py:a,pl:A,leftRightPadLength:c,legsoutside:l}=t,u=[e.left,e.bottom,e.right,e.top];let g=0,h=n-1;for(;g<u.length-1&&h>=u[g];)h-=u[g],g+=1;const d=u[g],p=f_i[g],m=p==="left"||p==="right"?a??r:s??r,_=p==="left"||p==="right"?c??A:A,f=m*(d-1),I=m*(d-1),C=l?_/2:-_/2;switch(p){case"left":return{x:-o/2-C+.1,y:I/2-h*m,o:"vert"};case"bottom":return{x:-f/2+h*m,y:-i/2-C+.1,o:"horz"};case"right":return{x:o/2+C-.1,y:-I/2+h*m,o:"vert"};case"top":return{x:f/2-h*m,y:i/2+C-.1,o:"horz"};default:throw new Error("Invalid pin number")}},uT=t=>{const e=Vrn.parse(t),n=e.leftrightpadwidth??e.lrpw??e.pw,o=e.leftrightpadlength??e.lrpl??e.pl,i=Urn(e),r=[];let s=0,a=0;const A=__i({...e,sidePinCounts:i}),c=Math.max(i.left,i.right),l=Math.max(i.top,i.bottom),u=i.left,g=u+1,h=i.left+i.bottom,d=h+1,p=i.left+i.bottom+i.right,m=p+1,_=e.num_pins;for(let R=0;R<e.num_pins;R++){const{x:F,y:O,o:U}=I_i({sidePinCounts:i,pin_count:e.num_pins,pn:R+1,w:e.w,h:e.h,p:e.p??.5,px:e.px,py:e.py,pl:e.pl,leftRightPadLength:o,legsoutside:e.legsoutside}),Y=U==="vert";let W=Y?n:e.pw,te=Y?o:e.pl;U==="vert"&&([W,te]=[te,W]);const j=Math.min(W,te)/8,J=A[R+1];s=Math.max(s,Math.abs(F)+W/2),a=Math.max(a,Math.abs(O)+te/2),r.push(e.pillpads?cT(J,F,O,W,te):Wo(J,F,O,W,te,j))}if(e.thermalpad){const R={x:e.thermalpadcenteroffsetx,y:e.thermalpadcenteroffsety};if(typeof e.thermalpad=="boolean"){const F=(e.px??e.p)*(l-1)+e.pw,O=(e.py??e.p)*(c-1)+n;s=Math.max(s,Math.abs(R.x)+F/2),a=Math.max(a,Math.abs(R.y)+O/2),r.push(hP({x:F,y:O},R))}else s=Math.max(s,Math.abs(R.x)+e.thermalpad.x/2),a=Math.max(a,Math.abs(R.y)+e.thermalpad.y/2),r.push(hP(e.thermalpad,R))}const f=[];for(const[R,F,O]of[["top-left",-1,1],["bottom-left",-1,-1],["bottom-right",1,-1],["top-right",1,1]]){const U=e.w/2*F,Y=e.h/2*O;let W="none",te=U,j=Y;const J=e.pw*2;A[1]===1&&R==="top-left"?W="in1":A[_]===1&&R==="top-left"||A[m]===1&&R==="top-right"?W="in2":A[p]===1&&R==="top-right"||A[u]===1&&R==="bottom-left"?W="in1":A[g]===1&&R==="bottom-left"?W="in2":A[h]===1&&R==="bottom-right"?W="in1":A[d]===1&&R==="bottom-right"&&(W="in2");const oe=W==="in1"?1:-1;if(e.legsoutside){const ie=W==="in1"?e.pl/2:e.pw/2,ne=W==="in1"?e.pw/2:e.pl/2;te+=ie*F*oe,j-=ne*O*oe}(W==="none"||e.legsoutside)&&f.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${R}`,route:[{x:U-J*F,y:Y},{x:U,y:Y},{x:U,y:Y-J*O}],type:"pcb_silkscreen_path",stroke_width:.1}),(W==="in1"||W==="in2")&&!e.legsoutside&&f.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${R}_1`,route:[{x:U-J*F,y:Y},{x:U-J*F/2,y:Y}],type:"pcb_silkscreen_path",stroke_width:0},{layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${R}_2`,route:[{x:U,y:Y-J*O/2},{x:U,y:Y-J*O}],type:"pcb_silkscreen_path",stroke_width:.1}),(W==="in1"||W==="in2")&&f.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${R}_3`,route:[{x:te-.2*-F,y:j+.2*oe},{x:te,y:j},{x:te+.2*oe*-F,y:j+.2},{x:te-.2*-F,y:j+.2*oe}],type:"pcb_silkscreen_path",stroke_width:.1})}const I=xi(0,e.h/2+(e.legsoutside?e.pl*1.2:.5),.3),C=R=>Math.ceil(R/.05)*.05,y=(l-1)*(e.px??e.p)+e.pw,x=(c-1)*(e.py??e.p)+n,E=y/2+.25,B=x/2+.25,S=e.w/2+.25,Q=e.h/2+.25,w=Math.max(S,C(s+.25)),M=Math.max(Q,C(a+.25)),k={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",layer:"top",outline:s2([{minX:-w,maxX:w,minY:-B,maxY:B},{minX:-S,maxX:S,minY:-Q,maxY:Q},{minX:-E,maxX:E,minY:-M,maxY:M}])};return{circuitJson:[...r,...f,I,k],parameters:e}},C_i=WB.refine(({x:t,y:e})=>Number.isInteger(t)&&Number.isInteger(e)&&t>0&&e>0,"thermal via grid dimensions must be positive integers"),KVe=ce.refine(t=>t>0,{message:"thermal via dimensions must be positive"}),VVe=Pt({thermalvias:xo([$e(!0),C_i]).optional(),thermalviapitch:KVe.optional(),thermalviaid:KVe.optional().describe("thermal via inner (hole) diameter"),thermalviaod:KVe.optional().describe("thermal via outer diameter")}),mpe={grid:{x:4,y:4},pitch:ce.parse("1mm"),holeDiameter:ce.parse("0.3048mm"),outerDiameter:ce.parse("0.6096mm")},y_i=(t,e)=>{if(!t.thermalvias)return[];const n=t.thermalvias===!0?mpe.grid:t.thermalvias,o=t.thermalviapitch??mpe.pitch,i=t.thermalviaid??mpe.holeDiameter,r=t.thermalviaod??mpe.outerDiameter;if(r<i)throw new Error("thermalviaod must be greater than or equal to thermalviaid");const s=(n.x-1)*o+r,a=(n.y-1)*o+r;if(s>e.width||a>e.height)throw new Error("thermal via grid must fit inside thermalpad");return Array.from({length:n.x*n.y},(A,c)=>{const l=c%n.x,u=Math.floor(c/n.x);return{pcb_via_id:"",type:"pcb_via",x:e.x+(l-(n.x-1)/2)*o,y:e.y+(u-(n.y-1)/2)*o,hole_diameter:i,outer_diameter:r,layers:["top","bottom"]}})},zrn=(t,e)=>{if(!e.thermalvias)return t;const n=t.find(o=>o.type==="pcb_smtpad"&&o.port_hints.includes("thermalpad"));if(!n)throw new Error("thermalvias requires a thermalpad");return[...t,...y_i(e,n)]};hpe.extend(VVe.shape).transform(ppe);var x_i=t=>{const e={...t,legsoutside:!1,pl:t.pl??.875,pw:t.pw??.25},n=uT(e),o=VVe.parse(t);return{circuitJson:zrn(n.circuitJson,o),parameters:{...n.parameters,...o}}},E_i=t=>{if(t.legsoutside=!0,!t.p)switch(t.num_pins){case 32:t.p=.8;break;case 44:case 48:t.p=.5;break;case 64:case 80:case 100:t.p=.5;break;case 144:t.p=.5;break}if(!t.pl)switch(t.num_pins){case 32:case 44:case 48:case 64:case 80:case 100:t.pl=1.475;break;case 144:t.pl=1.6;break}if(!t.pw)switch(t.num_pins){case 32:t.pw=.55;break;case 44:case 48:case 64:case 80:case 100:t.pw=.3;break;case 144:t.pw=.25;break}return uT(t)},B_i=t=>{t.legsoutside=!0;const e=Vrn.parse(t);if(!t.p)switch(t.num_pins){case 44:case 64:t.p=.8;break;case 52:t.w===14?t.p=1:t.p=.65;break;case 208:t.p=.5;break}if(!t.pl)switch(t.num_pins){case 44:case 52:case 64:t.pl=2.25;break;case 208:t.pl=1.65;break;default:t.pl=e.pl*4;break}if(!t.pw)switch(t.num_pins){case 44:case 64:t.pw=.5;break;case 52:t.w===14?t.pw=.45:t.pw=.55;break;case 208:t.pw=.3;break;default:t.pw=e.pw;break}return uT(t)};hpe.extend({}).transform(ppe);var b_i=t=>(t.legsoutside=!1,t.thermalpad===void 0&&(t.thermalpad=!0),uT(t)),S_i=Ci.extend({fn:Z(),num_pins:_t().optional().default(8),w:ce.default(ce.parse("3.9mm")),p:ce.default(ce.parse("1.27mm")),pw:ce.optional(),pl:ce.optional(),legsoutside:je().optional().default(!1),thermalpad:WB.optional(),...RY,silkscreen_stroke_width:_t().optional().default(.1)}).transform(t=>(t.pw==null&&t.pl==null?(t.pw=ce.parse("0.51mm"),t.pl=ce.parse("1.1mm")):t.pw==null?t.pw=t.pl*(.51/1.1):t.pl==null&&(t.pl=t.pw*(1.1/.51)),t)),Q_i=t=>{const{num_pins:e,pn:n,w:o,p:i}=t,r=e/2,s=n<=r,a=r-1,A=i,c=A*a,l=o+ce.parse("0.2mm"),u=(s?-1:1)*(l/2);return s?{x:u,y:c/2-(n-1)*A}:{x:u,y:-c/2+(n-r-1)*A}},v_i=t=>{const e=S_i.parse(t),n=[],o=Math.min(e.pl,e.pw)/8;for(let _=0;_<e.num_pins;_++){const{x:f,y:I}=Q_i({num_pins:e.num_pins,pn:_+1,w:e.w,p:e.p,pl:e.pl,legsoutside:e.legsoutside});n.push(Wo(_+1,f,I,e.pl,e.pw,o))}e.thermalpad&&n.push(hP(e.thermalpad,{x:e.thermalpadcenteroffsetx,y:e.thermalpadcenteroffsety}));const i=Math.min(1,e.p/2),r=e.w-(e.legsoutside?0:e.pl)-.2,s=(e.num_pins/2-1)*e.p+e.pw+i,a=xi(0,s/2+.4,s/12),A={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",stroke_width:e.silkscreen_stroke_width??.1,route:[{x:-r/2,y:-s/2},{x:-r/2,y:s/2},...lpe.map(({x:_,y:f})=>({x:_*r/6,y:f*r/6+s/2})),{x:r/2,y:s/2},{x:r/2,y:-s/2},{x:-r/2,y:-s/2}]},c=(e.num_pins/2-1)*e.p+e.pw,l=e.legsoutside?e.w/2+e.pl:(e.w+.2)/2+e.pl/2,u=c/2,g=l+.25,h=g,d=u+.445,p=d,m={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:s2([{minX:-g,maxX:g,minY:-p,maxY:p},{minX:-h,maxX:h,minY:-d,maxY:d}]),layer:"top"};return{circuitJson:[...n,A,a,m],parameters:e}},w_i=Ci.extend({fn:Z(),num_pins:_t().optional().default(8),w:ce.default(ce.parse("3.0mm")),p:ce.default(ce.parse("0.5mm")),pw:ce.default(ce.parse("0.30mm")),pl:ce.default(ce.parse("1.45mm")),legsoutside:je().optional().default(!0),thermalpad:WB.optional(),...RY,silkscreen_stroke_width:_t().optional().default(.1)}),P_i=t=>{const{num_pins:e,pn:n,w:o,p:i,pl:r,legsoutside:s}=t,a=e/2,A=n<=a,c=a-1,l=i*c,u=s?r/2:-r/2;return A?{x:-o/2-u,y:l/2-(n-1)*i}:{x:o/2+u,y:-l/2+(n-a-1)*i}},M_i=t=>{const e={...t},n=e.p,o=typeof n=="string"||typeof n=="number"?ce.parse(n):void 0,i=o!=null&&o<=ce.parse("0.5mm"),r=w_i.parse(e),s=[],a=r.rounded??Math.min(r.pl,r.pw)/8,A=i?r.w-ce.parse("0.15mm"):r.w;for(let y=0;y<r.num_pins;y++){const{x,y:E}=P_i({num_pins:r.num_pins,pn:y+1,w:A,p:r.p,pl:r.pl,legsoutside:r.legsoutside});s.push(Wo(y+1,x,E,r.pl,r.pw,a))}r.thermalpad&&s.push(hP(r.thermalpad,{x:r.thermalpadcenteroffsetx,y:r.thermalpadcenteroffsety}));const c=Math.min(1,r.p/2),l=r.w-(r.legsoutside?0:r.pl*2)-.2,u=(r.num_pins/2-1)*r.p+r.pw+c,g=xi(0,u/2+.4,u/12),h={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",stroke_width:r.silkscreen_stroke_width??.1,route:[{x:-l/2,y:-u/2},{x:-l/2,y:u/2},...lpe.map(({x:y,y:x})=>({x:y*l/6,y:x*l/6+u/2})),{x:l/2,y:u/2},{x:l/2,y:-u/2},{x:-l/2,y:-u/2}]},d=(r.num_pins/2-1)*r.p+r.pw,p=r.w/2+(r.legsoutside?r.pl:0),m=r.w/2+.25,_=p+.18,f=d/2+.25,I=f+.35,C={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",layer:"top",outline:s2([{minX:-_,maxX:_,minY:-f,maxY:f},{minX:-m,maxX:m,minY:-I,maxY:I}])};return{circuitJson:[...s,h,g,C],parameters:r}},D_i=[{x:-1.45,y:.93},{x:-.73,y:.93},{x:-.73,y:1.1},{x:.73,y:1.1},{x:.73,y:.93},{x:1.45,y:.93},{x:1.45,y:-.93},{x:.73,y:-.93},{x:.73,y:-1.1},{x:-.73,y:-1.1},{x:-.73,y:-.93},{x:-1.45,y:-.93}],N_i=Ci.extend({fn:Z(),num_pins:$e(6).default(6),w:Z().default("3.1mm"),h:Z().default("2.0mm"),p:Z().default("0.65mm"),pl:Z().default("1.03mm"),pw:Z().default("0.35mm"),string:Z().optional()}),R_i=t=>{const e=N_i.parse({...t,fn:"sot363"}),n=ce.parse(e.w),o=ce.parse(e.h),i=ce.parse(e.p),r=ce.parse(e.pl),s=ce.parse(e.pw),a=Math.min(r,s)/8,A=[];for(let p=0;p<6;p++){const{x:m,y:_}=Jrn(p+1,n,i);A.push(Wo(p+1,m,_,r,s,a))}const c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-n/4,y:o/2+.1},{x:n/4,y:o/2+.1}],stroke_width:.05,pcb_silkscreen_path_id:""},l={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-n/4,y:-o/2-.1},{x:n/4,y:-o/2-.1}],stroke_width:.05,pcb_silkscreen_path_id:""},u=Jrn(1,n,i),g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:u.x-r/2-.3,y:u.y},{x:u.x-r/2-.45,y:u.y+.15},{x:u.x-r/2-.45,y:u.y-.15},{x:u.x-r/2-.3,y:u.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},h=xi(0,o/2+.4,.25),d={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:D_i,layer:"top"};return{circuitJson:[...A,c,l,h,g,d],parameters:e}},Jrn=(t,e,n,o)=>t<=3?{x:-.84,y:n-(t-1)*n}:{x:.84,y:-n+(t-4)*n},T_i=[{x:-.75,y:1},{x:-.75,y:-1},{x:.75,y:-1},{x:.75,y:1}],k_i=Ci.extend({fn:Z(),num_pins:$e(6).default(6),w:Z().default("1.01mm"),h:Z().default("1.45mm"),p:Z().default("0.5mm"),pl:Z().default("0.33mm"),pw:Z().default("0.27mm"),string:Z().optional()}),F_i=t=>{const e=k_i.parse({...t,fn:"sot886"}),n=ce.parse(e.w),o=ce.parse(e.h),i=ce.parse(e.p),r=ce.parse(e.pl),s=ce.parse(e.pw),a=Math.min(r,s)/8,A=[];for(let p=0;p<6;p++){const{x:m,y:_}=Wrn(p+1,n,i,r);A.push(Wo(p+1,m,_,r,s,a))}const c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-n/2,y:o/2},{x:n/2,y:o/2}],stroke_width:.05,pcb_silkscreen_path_id:""},l={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-n/2,y:-o/2},{x:n/2,y:-o/2}],stroke_width:.05,pcb_silkscreen_path_id:""},u=Wrn(1,n,i,r),g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:u.x-r/2-.3,y:u.y},{x:u.x-r/2-.45,y:u.y+.15},{x:u.x-r/2-.45,y:u.y-.15},{x:u.x-r/2-.3,y:u.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},h=xi(0,o/2+.4,.25),d={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:T_i,layer:"top"};return{circuitJson:[...A,c,l,h,g,d],parameters:e}},Wrn=(t,e,n,o)=>{const i=e/2-o/2;return t<=3?{x:-i,y:n-(t-1)*n}:{x:i,y:-n+(t-4)*n}},L_i=[{x:-2.05,y:1.5},{x:-1.05,y:1.5},{x:-1.05,y:1.7},{x:1.05,y:1.7},{x:1.05,y:.55},{x:2.05,y:.55},{x:2.05,y:-.55},{x:1.05,y:-.55},{x:1.05,y:-1.7},{x:-1.05,y:-1.7},{x:-1.05,y:-1.5},{x:-2.05,y:-1.5},{x:-2.05,y:-.39},{x:-1.05,y:-.39},{x:-1.05,y:.39},{x:-2.05,y:.39}],H_i=[{x:-2.05,y:1.5},{x:-1.05,y:1.5},{x:-1.05,y:1.7},{x:1.05,y:1.7},{x:1.05,y:1.5},{x:2.05,y:1.5},{x:2.05,y:.39},{x:1.05,y:.39},{x:1.05,y:-.39},{x:2.05,y:-.39},{x:2.05,y:-1.5},{x:1.05,y:-1.5},{x:1.05,y:-1.7},{x:-1.05,y:-1.7},{x:-1.05,y:-1.5},{x:-2.05,y:-1.5}],jrn=Ci.extend({fn:Z(),num_pins:_t().default(3),w:Z().default("2.275mm"),h:Z().default("2.74mm"),pl:Z().default("1.325mm"),pw:Z().default("0.6mm"),p:Z().default("0.95mm"),string:Z().optional()}),O_i=lT({p:"0.95mm",w:"1.6mm",legsoutside:!0}),G_i=t=>{const e=t.string?.match(/^sot23_(\d+)/),n=e?Number.parseInt(e[1],10):3;if(n===6||n===8){const i=O_i.parse({...t,num_pins:n});return{circuitJson:LX(i),parameters:i}}const o=jrn.parse({...t,num_pins:n});if(o.num_pins===3)return{circuitJson:U_i(o),parameters:o};if(o.num_pins===5)return{circuitJson:qrn(o),parameters:o};throw new Error("Invalid number of pins")},Y_i=t=>{const{pn:e,w:n,p:o}=t;return e===1?{x:-n/2,y:o}:e===2?{x:-n/2,y:-o}:{x:n/2,y:0}},U_i=t=>{const e=[],n=Number.parseFloat(t.w);Number.parseFloat(t.h);const o=Number.parseFloat(t.pl),i=Number.parseFloat(t.pw),r=Number.parseFloat(t.p),s=t.rounded??Math.min(o,i)/8;for(let c=0;c<t.num_pins;c++){const{x:l,y:u}=Y_i({num_pins:t.num_pins,pn:c+1,w:n,p:r});e.push(Wo(c+1,l,u,o,i,s))}const a=xi(0,Number.parseInt(t.h),.3),A={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:L_i,layer:"top"};return[...e,a,A]},$rn=t=>{const{w:e,p:n,h:o,pn:i}=t;if(i===1)return{x:-e/2,y:n};if(i===2)return{x:-e/2,y:0};if(i===3)return{x:-e/2,y:-n};if(i===4)return{x:e/2,y:-n};if(i===5)return{x:e/2,y:n};throw new Error("Invalid pin number")},qrn=t=>{const e=[],n=Number.parseFloat(t.w),o=Number.parseFloat(t.h),i=Number.parseFloat(t.p),r=Number.parseFloat(t.pl),s=Number.parseFloat(t.pw),a=t.rounded??Math.min(r,s)/8;for(let f=1;f<=t.num_pins;f++){const{x:I,y:C}=$rn({w:n,h:o,p:i,pn:f});e.push(Wo(f,I,C,r,s,a))}const A=(t.num_pins+1)/2*i,c=o,l={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-A/3,y:c/2+i/1.3},{x:A/3,y:c/2+i/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},u={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-A/3,y:-c/2-i/1.3},{x:A/3,y:-c/2-i/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},g=xi(0,c+.3,.3),h=$rn({w:n,h:o,p:i,pn:1});h.x=h.x-s*1.5;const d=.3,p=.4,m={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:h.x+d/2,y:h.y},{x:h.x-d/2,y:h.y+p/2},{x:h.x-d/2,y:h.y-p/2},{x:h.x+d/2,y:h.y}],stroke_width:.05},_={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:H_i,layer:"top"};return[...e,g,l,u,m,_]},K_i=jrn.extend({}),V_i=t=>{const e=K_i.parse({...t,num_pins:5});return{circuitJson:qrn(e),parameters:e}},z_i=[{name:"top-left",dx:-1,dy:1},{name:"top-right",dx:1,dy:1},{name:"bottom-left",dx:-1,dy:-1},{name:"bottom-right",dx:1,dy:-1}],zVe=(t,e)=>({type:"pcb_smtpad",points:e,layer:"top",shape:"polygon",pcb_smtpad_id:"",port_hints:Array.isArray(t)?t.map(n=>n.toString()):[t.toString()]}),J_i=lT({}).and(VVe),W_i=t=>{const e=je().optional().parse(t.cornerpads),n=t.cornerpadcutlength===void 0?void 0:ce.parse(t.cornerpadcutlength),o=FX.parse(t.missing??[]);if(o.some(S=>typeof S!="number"))throw new Error("DFN missing positions must be pad numbers");const i=[...new Set(o)];if(i.length!==o.length)throw new Error("DFN missing positions must not contain duplicates");const r={...J_i.parse(t),cornerpads:e,cornerpadcutlength:n,missing:i},s=r.num_pins;if(i.some(S=>S<1||S>s))throw new Error("DFN missing position is outside the nominal pad range");if(e){if(s!==4||i.length>0||r.pillpads)throw new Error("DFN corner pads require four nominal pads with none missing");if(n===void 0||n<=0||n>Math.min(r.pl,r.pw))throw new Error("DFN corner pads require a valid cornerpadcutlength")}const a=new Set(i),A=[],c=Math.min(r.pl,r.pw)/8;let l=0,u=1;for(let S=1;S<=s;S+=1){if(a.has(S))continue;const{x:Q,y:w}=UVe({num_pins:s,pn:S,w:r.w,p:r.p??1.27,pl:r.pl,widthincludeslegs:!0});if(l=Math.max(l,Math.abs(w)+r.pw/2),e){const M=Math.sign(Q),k=Math.sign(w),R=Q-M*r.pl/2,F=w-k*r.pw/2,O=Q+M*r.pl/2,U=w+k*r.pw/2;A.push(zVe(u,[{x:R,y:F+k*n},{x:R,y:U},{x:O,y:U},{x:O,y:F},{x:R+M*n,y:F}]))}else A.push((r.pillpads?cT:Wo)(u,Q,w,r.pl??"1mm",r.pw??"0.6mm",c));u+=1}r.thermalpad&&A.push(hP(r.thermalpad,{x:r.thermalpadcenteroffsetx,y:r.thermalpadcenteroffsety}));const g=Math.min(1,r.p/2),h=r.w+g,d=l*2+g,p=[];for(const S of z_i){const{dx:Q,dy:w}=S;p.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",route:[{x:Q*h/2-Q*r.p,y:w*d/2},{x:Q*h/2,y:w*d/2},{x:Q*h/2,y:w*d/2-w*r.p}],type:"pcb_silkscreen_path",stroke_width:.1})}const m=r.p/4,_=-h/2-m/2,f=d/2-r.p/2;p.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:_,y:f},{x:_-m,y:f+m},{x:_-m,y:f-m},{x:_,y:f}],stroke_width:.1});const I=xi(0,d/2+.4,d/12),C=S=>Math.ceil(S/.05)*.05,y=C(r.w/2+.25),x=C(l+.45),E={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:y*2,height:x*2,layer:"top"},B=[...A,I,...p,E];return{circuitJson:zrn(B,r),parameters:r}};function Xrn({pinlabeltextalignleft:t,pinlabeltextalignright:e,pinlabelorthogonal:n}){let o="top";return n?o="left":o="top",t&&(n?o="bottom":o="right"),e&&(n?o="top":o="left"),o}var gT=({fs:t,pn:e,anchor_x:n,anchor_y:o,textalign:i="center",anchorplacement:r,orthogonal:s=!1,verticallyinverted:a=!1,layer:A="top"})=>{let c=0;s&&a?c=270:a?c=180:s?c=90:c=0;let l="center";if(i!=="center"&&(l=i==="left"?a?"center_right":"center_left":a?"center_left":"center_right",r)){const g={top:{x:0,y:1},bottom:{x:0,y:-1},left:{x:-1,y:0},right:{x:1,y:0}}[r],h=c*Math.PI/180,d={x:Math.cos(h),y:Math.sin(h)},p=g.x*d.x+g.y*d.y;Math.abs(p)>.5&&(l=p>0?"center_left":"center_right")}return A==="bottom"&&(l==="center_left"?l="center_right":l==="center_right"&&(l="center_left")),{type:"pcb_silkscreen_text",pcb_silkscreen_text_id:"silkscreen_text_1",font:"tscircuit2024",font_size:t,pcb_component_id:"pcb_component_1",text:`{PIN${e}}`,layer:A,anchor_position:{x:n,y:o},anchor_alignment:l,ccw_rotation:c}},j_i=Ci.extend({fn:Z(),num_pins:_t().optional().default(6),rows:xo([Z(),_t()]).transform(t=>Number(t)).optional().default(1).describe("number of rows"),cols:xo([Z(),_t()]).transform(t=>Number(t)).optional().describe("number of nominal columns in a sparse grid"),p:ce.default("0.1in").describe("pitch"),py:ce.optional().describe("vertical row pitch"),id:ce.default("1.0mm").describe("inner diameter"),od:ce.default("1.5mm").describe("outer diameter"),missing:FX.default([]).describe("row-major nominal grid positions to omit"),male:je().optional().describe("for male pin headers"),female:je().optional().describe("for female pin headers"),smd:je().optional().describe("surface mount device"),surfacemount:je().optional().describe("surface mount device (verbose)"),rightangle:je().optional().describe("right angle"),pw:ce.optional().default("1.0mm").describe("pad width for SMD"),pl:ce.optional().default("2.0mm").describe("pad length for SMD"),pinlabeltextalignleft:je().optional().default(!1),pinlabeltextaligncenter:je().optional().default(!1),pinlabeltextalignright:je().optional().default(!1),pinlabelverticallyinverted:je().optional().default(!1),pinlabelorthogonal:je().optional().default(!1),nosquareplating:je().optional().default(!1).describe("do not use rectangular pad for pin 1"),nopinlabels:je().optional().default(!1).describe("omit silkscreen pin labels"),doublesidedpinlabel:je().optional().default(!1).describe("add silkscreen pins in top and bottom layers"),bottomsidepinlabel:je().optional().default(!1).describe("place the silkscreen reference text on the bottom layer instead of top"),silkscreenborder:je().optional().default(!1).describe("add a rectangular silkscreen border around the pin row"),silkscreenlabel:Z().transform(t=>t.startsWith("(")&&t.endsWith(")")?t.slice(1,-1):t).optional().describe("replace the reference designator with a custom silkscreen label")}).transform(t=>{const e=Xrn(t);return{...t,pinlabelAnchorSide:e,male:t.male??!t.female,female:t.female??!1,smd:t.smd??t.surfacemount??!1,rightangle:t.rightangle??!1}}).superRefine((t,e)=>{t.male&&t.female&&e.addIssue({code:lo.custom,message:"'male' and 'female' cannot both be true; it should be male or female.",path:["male","female"]}),t.cols!==void 0&&(!Number.isInteger(t.cols)||t.cols<1)&&e.addIssue({code:lo.custom,message:"'cols' must be a positive integer",path:["cols"]}),t.missing.some(n=>typeof n!="number")&&e.addIssue({code:lo.custom,message:"'missing' positions must be pad numbers",path:["missing"]})}),Zrn=t=>{const e=j_i.parse(t),{p:n,py:o,id:i,od:r,rows:s,cols:a,num_pins:A,missing:c,pinlabelAnchorSide:l,pinlabelverticallyinverted:u,pinlabelorthogonal:g,pinlabeltextalignleft:h,pinlabeltextalignright:d,nopinlabels:p,doublesidedpinlabel:m,bottomsidepinlabel:_,silkscreenborder:f,silkscreenlabel:I}=e;let C="center";h?C="left":d&&(C="right");const y=[];let x=null;const E=c,B=new Set(E);if(B.size!==E.length)throw new Error("Pinrow missing positions must not contain duplicates");const S=A+E.length,Q=a??Math.ceil(S/s),w=Q*s,M=a!==void 0||E.length>0;if(M&&w!==S)throw new Error(`Pinrow grid has ${w} positions, but ${S} are required for ${A} pins and ${E.length} missing positions`);if(E.some(he=>!Number.isInteger(he)||he<1||he>w))throw new Error("Pinrow missing position is outside the nominal grid");const k=o??n,R=(s-1)*k,F=R/2,O=-k,U=({xoff:he,yoff:Qe,od:Pe,anchorSide:we,smd:Te,pw:Re,pl:Ee})=>{let ke=0,Ce=0;if(Te){const Le=Pe/5;switch(we){case"right":ke=Re/2+Le;break;case"top":Ce=Ee/2+Le;break;case"bottom":Ce=-(Ee/2+Le);break;case"left":ke=-(Re/2+Le);break}}else{const Le=Pe/2+.6;switch(we){case"right":ke=Le;break;case"top":Ce=Le;break;case"bottom":Ce=-Le;break;case"left":ke=-Le;break}}return{anchor_x:he+ke,anchor_y:Qe+Ce}},Y=(he,Qe,Pe)=>{he===1&&(x={x:Qe,y:Pe}),e.smd?y.push(Wo(he,Qe,Pe,e.pw,e.pl)):he===1&&!e.nosquareplating?y.push(r2({pn:he,x:Qe,y:Pe,holeDiameter:i,rectPadWidth:r,rectPadHeight:r})):y.push(Os(he,Qe,Pe,i,r));const{anchor_x:we,anchor_y:Te}=U({xoff:Qe,yoff:Pe,od:r,anchorSide:l,smd:e.smd,pw:e.pw,pl:e.pl});p||(_?y.push(gT({fs:r/5,pn:he,anchor_x:we,anchor_y:Te,anchorplacement:l,textalign:C,orthogonal:g,verticallyinverted:u,layer:"bottom"})):y.push(gT({fs:r/5,pn:he,anchor_x:we,anchor_y:Te,anchorplacement:l,textalign:C,orthogonal:g,verticallyinverted:u,layer:"top"})),m&&y.push(gT({fs:r/5,pn:he,anchor_x:we,anchor_y:Te,anchorplacement:l,textalign:C,orthogonal:g,verticallyinverted:u,layer:"bottom"})))},W=new Set;if(M){const he=-((Q-1)/2)*n;let Qe=1;for(let Pe=0;Pe<s;Pe++)for(let we=0;we<Q;we++){const Te=Pe*Q+we+1;if(B.has(Te))continue;const Re=he+we*n,Ee=F+Pe*O,ke=`${Re},${Ee}`;if(W.has(ke))throw new Error(`Overlap at ${ke}`);W.add(ke),Y(Qe++,Re,Ee)}}else if(s===1){const he=-((A-1)/2)*n;for(let Qe=0;Qe<A;Qe++){const Pe=Qe+1,we=he+Qe*n,Te=`${we},0`;if(W.has(Te))throw new Error(`Overlap at ${Te}`);W.add(Te),Y(Pe,we,0)}}else if(s>2&&Q>2){const Qe=-((Q-1)/2)*n;let Pe=1;for(let we=0;we<s&&Pe<=A;we++)for(let Te=0;Te<Q&&Pe<=A;Te++){const Re=Qe+Te*n,Ee=F+we*O,ke=`${Re},${Ee}`;if(W.has(ke))throw new Error(`Overlap at ${ke}`);W.add(ke),Y(Pe++,Re,Ee)}}else{const Qe=-((Q-1)/2)*n;let Pe=1,we=0,Te=s-1,Re=0,Ee=Q-1;for(;Pe<=A&&we<=Te&&Re<=Ee;){for(let ke=we;ke<=Te&&Pe<=A;ke++){const Ce=Qe+Re*n,Le=F+ke*O,Ye=`${Ce},${Le}`;if(W.has(Ye))throw new Error(`Overlap at ${Ye}`);W.add(Ye),Y(Pe++,Ce,Le)}Re++;for(let ke=Re;ke<=Ee&&Pe<=A;ke++){const Ce=Qe+ke*n,Le=F+Te*O,Ye=`${Ce},${Le}`;if(W.has(Ye))throw new Error(`Overlap at ${Ye}`);W.add(Ye),Y(Pe++,Ce,Le)}if(Te--,Re<=Ee){for(let ke=Te;ke>=we&&Pe<=A;ke--){const Ce=Qe+Ee*n,Le=F+ke*O,Ye=`${Ce},${Le}`;if(W.has(Ye))throw new Error(`Overlap at ${Ye}`);W.add(Ye),Y(Pe++,Ce,Le)}Ee--}if(we<=Te){for(let ke=Ee;ke>=Re&&Pe<=A;ke--){const Ce=Qe+ke*n,Le=F+we*O,Ye=`${Ce},${Le}`;if(W.has(Ye))throw new Error(`Overlap at ${Ye}`);W.add(Ye),Y(Pe++,Ce,Le)}we++}}if(Pe-1<A)throw new Error(`Missing pins: assigned ${Pe-1}, expected ${A}`)}const te=e.smd?e.pw/2:r/2,j=e.smd?e.pl/2:r/2,J=(Q-1)*n,oe=J/2+n/2+1,ie=Math.max(R/2+j+1,n/2+1),ne=f?sA([{x:-oe,y:-ie},{x:oe,y:-ie},{x:oe,y:ie},{x:-oe,y:ie},{x:-oe,y:-ie}]):null,le=(()=>{if(e.fn!=="headermodule"||!x)return null;const he=Math.max(.3,Math.min(.6,n/4)),Qe=.15;if(l==="top"||l==="bottom"){const Ee=Math.sign(x.x)||(l==="top"?-1:1),ke=x.x+Ee*(te+Qe),Ce=ke+Ee*he;return sA([{x:ke,y:x.y},{x:Ce,y:x.y-he},{x:Ce,y:x.y+he},{x:ke,y:x.y}],{pcb_component_id:"pin_marker_1",pcb_silkscreen_path_id:"pin_marker_1"})}const we=Math.sign(x.y)||1,Te=x.y+we*(j+Qe),Re=Te+we*he;return sA([{x:x.x,y:Te},{x:x.x-he,y:Re},{x:x.x+he,y:Re},{x:x.x,y:Te}],{pcb_component_id:"pin_marker_1",pcb_silkscreen_path_id:"pin_marker_1"})})(),ge=I?{type:"pcb_silkscreen_text",pcb_silkscreen_text_id:"silkscreen_text_1",font:"tscircuit2024",font_size:.8,pcb_component_id:"pcb_component_1",text:I,layer:"top",anchor_position:{x:0,y:0},anchor_alignment:"center"}:xi(0,R/2+n,.5),_e=J/2+te,ue=R/2+j,fe=J/2+n/2,pe=R/2+n/2,ye=Math.max(_e+.25,fe+.5),Me=Math.max(ue+.25,pe+.5),ve={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:2*ye,height:2*Me,layer:"top"};return{circuitJson:[...y,...ne?[ne]:[],...le?[le]:[],ge,ve],parameters:e}},$_i=t=>Zrn({...t,fn:"headermodule"}),q_i=[{x:-1.2,y:.83},{x:-.75,y:.83},{x:-.75,y:.95},{x:.75,y:.95},{x:.75,y:.83},{x:1.2,y:.83},{x:1.2,y:-.83},{x:.75,y:-.83},{x:.75,y:-.95},{x:-.75,y:-.95},{x:-.75,y:-.83},{x:-1.2,y:-.83}],X_i=Ci.extend({fn:Z(),num_pins:$e(6).default(6),w:Z().default("2.1mm"),h:Z().default("2.45mm"),p:Z().default("0.5mm"),pl:Z().default("0.675mm"),pw:Z().default("0.35mm"),string:Z().optional()}),Z_i=t=>{const e=X_i.parse({...t,fn:"sot563"}),n=ce.parse(e.w),o=ce.parse(e.h),i=ce.parse(e.p),r=ce.parse(e.pl),s=ce.parse(e.pw),a=Math.min(r,s)/8,A=[];for(let p=0;p<6;p++){const{x:m,y:_}=esn(p+1,n,i,r);A.push(Wo(p+1,m,_,r,s,a))}const c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-n/2,y:o/2},{x:n/2,y:o/2}],stroke_width:.05,pcb_silkscreen_path_id:""},l={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-n/2,y:-o/2},{x:n/2,y:-o/2}],stroke_width:.05,pcb_silkscreen_path_id:""},u=esn(1,n,i,r),g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:u.x-r/2-.3,y:u.y},{x:u.x-r/2-.45,y:u.y+.15},{x:u.x-r/2-.45,y:u.y-.15},{x:u.x-r/2-.3,y:u.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},h=xi(0,o/2+.4,.25),d={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:q_i,layer:"top"};return{circuitJson:[...A,c,l,h,g,d],parameters:e}},esn=(t,e,n,o)=>{const i=e/2-o/2;return t<=3?{x:-i,y:n-(t-1)*n}:{x:i,y:-n+(t-4)*n}},efi=lT({p:"1.27mm",w:"3.9mm",legsoutside:!0}),tfi=t=>{const e=efi.parse({...t,num_pins:8});return{circuitJson:LX(e),parameters:e}},nfi=lT({p:"1.27mm",w:"7.5mm",legsoutside:!0}),ofi=t=>{const e=nfi.parse({...t,num_pins:16});return{circuitJson:LX(e),parameters:e}},ifi=Ci.extend({fn:Z(),num_pins:$e(3).default(3),w:Z().default("1.2mm"),h:Z().default("1.2mm"),pw:Z().default("0.40mm"),pl:Z().default("0.45mm"),p:Z().default("0.575mm")}),rfi=t=>{const e=ifi.parse(t),n=afi(e),o=xi(0,ce.parse(e.h),.2),i=1.8,r=1.8,s={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:[{x:-i/2,y:r/2},{x:i/2,y:r/2},{x:i/2,y:-r/2},{x:-i/2,y:-r/2}],layer:"top"};return{circuitJson:[...n,o,s],parameters:e}},sfi=t=>{const{pn:e,p:n}=t;return e===1?{x:n,y:0}:e===2?{x:-n,y:-.4}:{x:-n,y:.4}},afi=t=>{const e=[];Number.parseFloat(t.w),Number.parseFloat(t.h);const n=Number.parseFloat(t.pl),o=Number.parseFloat(t.pw),i=Number.parseFloat(t.p),r=Math.min(n,o)/8;for(let s=0;s<3;s++){const{x:a,y:A}=sfi({num_pins:t.num_pins,pn:s+1,p:i});e.push(Wo(s+1,a,A,n,o,r))}return e},Afi=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("2.36mm"),h:Z().default("1.22mm"),pl:Z().default("0.9mm"),pw:Z().default("1.2mm"),p:Z().default("3.30mm")}),cfi=t=>{const e=Afi.parse(t),n=ce.parse(e.h),o=xi(0,n/4+.4,.3),s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:4.7,height:2.3,layer:"top"};return{circuitJson:ufi(e).concat(...uh(e),o,s),parameters:e}},lfi=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},ufi=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=lfi({pn:n,p:Number.parseFloat(t.p)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw),.1125))}return e},gfi=Ci.extend({fn:Z(),p:ce.optional().default("2.54mm"),id:ce.optional().default("0.7mm"),od:ce.optional().default("1.4mm")}),dfi=t=>{const e=gfi.parse(t),{p:n,id:o,od:i}=e,r=[Os(1,-n/2,0,o,i),Os(2,n/2,0,o,i)],s={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-n/2+i+o/2,y:0},{x:n/2-i-o/2,y:0}],stroke_width:.1,pcb_silkscreen_path_id:""},a=xi(0,1.5,.5),A=-n/2,c=n/2,l=i/2,u=i/2,g=A-l-.35,h=c+l+.26,d=u+.35,p=g,m=h,_=d,f={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:s2([{minX:g,maxX:h,minY:-_,maxY:_},{minX:p,maxX:m,minY:-d,maxY:d}]),layer:"top"};return{circuitJson:[...r,s,a,f],parameters:e}},hfi=(t,e,n,o,i,r=.1)=>{const s=[],a=[],A=Math.max(1,Math.ceil(Math.PI*n/r)),c=Math.PI/A;for(let l=0;l<=A;l++){const u=l*c,g=t+Math.cos(u)*n,h=e+Math.sin(u)*n;g<t-o&&h>=e-i/2&&h<=e+i/2||s.push({x:g,y:h})}for(let l=0;l<=A;l++){const u=Math.PI+l*c,g=t+Math.cos(u)*n,h=e+Math.sin(u)*n;g<t-o&&h>=e-i/2&&h<=e+i/2||a.push({x:g,y:h})}return{topArc:s,bottomArc:a}},pfi=Ci.extend({fn:Z(),p:ce.optional().default("5mm"),id:ce.optional().default("0.8mm"),od:ce.optional().default("1.6mm"),ceramic:je().optional(),electrolytic:je().optional(),polarized:je().optional()}),mfi=t=>{const e=pfi.parse(t),{p:n,id:o,od:i}=e;o===.8&&i===1.6&&(e.id=n===5?.8:n*.25,e.od=n===5?1.6:n*.5);const r=[Os(1,-n/2,0,e.id,e.od),Os(2,n/2,0,e.id,e.od)],s=n+.1,{topArc:a,bottomArc:A}=hfi(0,0,s,e.od/2,e.od),c=.02*n,l={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:a,stroke_width:c,pcb_silkscreen_path_id:""},u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:A,stroke_width:c,pcb_silkscreen_path_id:""},g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:0,y:s},{x:0,y:-s}],stroke_width:c,pcb_silkscreen_path_id:""},h=.1*n,d=-(n+h+.04*n),p=s-h-.08*n,m={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:d-h,y:p},{x:d+h,y:p}],stroke_width:c,pcb_silkscreen_path_id:""},_={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:d,y:p-h},{x:d,y:p+h}],stroke_width:c,pcb_silkscreen_path_id:""},f=xi(0,s+.12*n,.1*n),I=[...r,l,u,g,f];(e.electrolytic===!0||e.polarized===!0)&&I.push(m,_);const y=n+.25,x={type:"pcb_courtyard_circle",pcb_courtyard_circle_id:"",pcb_component_id:"",center:{x:0,y:0},radius:y,layer:"top"};return I.push(x),{circuitJson:I,parameters:e}},_fi=Ci.extend({fn:$e("rj45"),num_pins:xo([$e(10),$e(14)]).default(10),ledpins:je().default(!1).describe("add the four through-hole LED connections as pins 9 through 12"),firstpinleft:je().default(!1).describe("mirror the eight signal pins so pin 1 is on the left"),firstpintop:je().default(!1).describe("mirror the eight signal pins so pin 1 is in the top row"),p:ce.default("1.02mm").describe("horizontal signal-pin pitch"),py:ce.default("1.78mm").describe("signal-row pitch"),id:ce.default("0.9144mm").describe("signal and LED hole diameter"),od:ce.default("1.524mm").describe("signal and LED outer diameter"),shieldx:ce.default("8.13mm").describe("shield-pin x offset from the footprint center"),shieldy:ce.default("0.13mm").describe("signed shield-pin y offset from the signal-row center"),shieldid:ce.default("1.8mm").describe("shield-pin hole diameter"),shieldod:ce.default("2.5mm").describe("shield-pin outer diameter"),holex:ce.default("6.35mm").describe("locator-hole x offset from the footprint center"),holey:ce.default("-3.43mm").describe("signed locator-hole y offset from the signal-row center"),holed:ce.default("3.25mm").describe("locator-hole diameter"),ledx:ce.default("4.57mm").describe("inner LED-pin x offset from the footprint center"),ledp:ce.default("2.29mm").describe("pitch within each LED-pin pair"),ledy:ce.default("5.7mm").describe("signed LED-pin y offset from the signal-row center"),w:ce.default("16.26mm").describe("connector body width"),h:ce.default("15.88mm").describe("connector body height"),bodyy:ce.default("-0.96mm").describe("signed connector body center y offset")}),ffi=t=>{const e=t.ledpins===!0||t.num_pins===14,n=_fi.parse({...t,ledpins:e,num_pins:e?14:10}),{ledpins:o,firstpinleft:i,firstpintop:r,p:s,py:a,id:A,od:c,shieldx:l,shieldy:u,shieldid:g,shieldod:h,holex:d,holey:p,holed:m,ledx:_,ledp:f,ledy:I,w:C,h:y,bodyy:x}=n,E=Me=>Number(Me.toFixed(12)),B=Array.from({length:8},(Me,ve)=>{const he=ve+1,Qe=(3.5-ve)*s,Pe=ve%2===0?-a/2:a/2,we=E(i?-Qe:Qe),Te=E(r?-Pe:Pe);return Os(he,we,Te,A,c)}),S=o?[Os(9,E(-_-f),I,A,c),Os(10,-_,I,A,c),Os(11,_,I,A,c),Os(12,E(_+f),I,A,c)]:[],Q=o?14:9,w=o?13:10,M=i!==r,k=M?w:Q,R=M?Q:w,F=[Os(k,-l,u,g,h),Os(R,l,u,g,h)],O=[-d,d].map(Me=>({type:"pcb_hole",pcb_hole_id:"",pcb_component_id:"",hole_shape:"circle",hole_diameter:m,x:Me,y:p})),U=-C/2,Y=C/2,W=x-y/2,te=x+y/2,j=h/2+.2,J=[[W,Math.min(te,u-j)],[Math.max(W,u+j),te]].filter(([Me,ve])=>ve-Me>.01),oe=[sA([{x:U,y:W},{x:Y,y:W}]),sA([{x:U,y:te},{x:Y,y:te}]),...J.flatMap(([Me,ve])=>[sA([{x:U,y:Me},{x:U,y:ve}]),sA([{x:Y,y:Me},{x:Y,y:ve}])])],ie=Math.min(-l-h/2,-d-m/2,o?-_-f-c/2:0),ne=-ie,le=Math.min(u-h/2,p-m/2,-a/2-c/2,o?I-c/2:Number.POSITIVE_INFINITY),ge=Math.max(u+h/2,p+m/2,a/2+c/2,o?I+c/2:Number.NEGATIVE_INFINITY),_e=Math.min(U,ie)-.25,ue=Math.max(Y,ne)+.25,fe=Math.min(W,le)-.25,pe=Math.max(te,ge)+.25,ye={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:(_e+ue)/2,y:(fe+pe)/2},width:ue-_e,height:pe-fe,layer:"top"};return{circuitJson:[...O,...B,...S,...F,...oe,xi(0,pe+.55,.5),ye],parameters:n}},Ifi=Ci.extend({fn:$e("pushbutton"),w:ce.default(4.5),h:ce.default(6.5),id:ce.default(1),od:ce.default(1.2)}),Cfi=t=>{const e=Ifi.parse(t),n=e.w,o=e.h,i=e.id,r=[Os(1,-n/2,o/2,i,i*1.5),Os(2,-n/2,-o/2,i,i*1.5),Os(3,n/2,-o/2,i,i*1.5),Os(4,n/2,o/2,i,i*1.5)],s=[sA([{x:-n/2,y:-o/2},{x:-n/2,y:o/2}]),sA([{x:n/2,y:-o/2},{x:n/2,y:o/2}]),sA([{x:-n/2,y:0},{x:-n/5,y:0},{x:n/5*1/Math.sqrt(2),y:o/8}]),sA([{x:n/2,y:0},{x:n/5,y:0}])],a=xi(0,o/2+.4,.5),A=i*1.5/2,c=n,l=o,u=c/2+A,g=l/2+A,h=u+.5,d=g+.5,p={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:2*h,height:2*d,layer:"top"};return{circuitJson:[...r,...s,a,p],parameters:e}},tsn=Ci.extend({fn:Z(),w:ce.default("22.58mm"),h:ce.optional(),left:ce.optional().default(20),right:ce.optional().default(20),top:ce.optional().default(2),bottom:ce.optional().default(2),p:ce.default(ce.parse("2.54mm")),pw:ce.default(ce.parse("1.6mm")),pl:ce.default(ce.parse("2.4mm")),innerhole:je().default(!1),innerholeedgedistance:ce.default(ce.parse("1.61mm")),silkscreenlabels:je().default(!1),silkscreenlabelmargin:ce.default(ce.parse("0.1mm"))}),yfi=t=>{const e=tsn.parse(t);return e.left&&e.right?Math.max(e.left,e.right)*e.p:e.left?e.left*e.p:e.right?e.right*e.p:51},_pe=(t,e,n)=>{let o=[];return n==="right"&&(o=[{x:t+1/2,y:e},{x:t-1/2,y:e+.6/2},{x:t-1/2,y:e-.6/2},{x:t+1/2,y:e}]),n==="left"&&(o=[{x:t-1/2,y:e},{x:t+1/2,y:e+.6/2},{x:t+1/2,y:e-.6/2},{x:t-1/2,y:e}]),n==="top"&&(o=[{x:t,y:e+1/2},{x:t-.6/2,y:e-1/2},{x:t+.6/2,y:e-1/2},{x:t,y:e+1/2}]),n==="bottom"&&(o=[{x:t,y:e-1/2},{x:t-.6/2,y:e+1/2},{x:t+.6/2,y:e+1/2},{x:t,y:e-1/2}]),o},xfi=t=>{const e=tsn.parse(t),n=e.h??yfi(e),o=[],i=[],r=[];let s=[];const a=1,A=a,c=e.left+e.right+(e.bottom??0)+(e.top??0),u=`pin${c}`.length*.7/2;if(e.right){const p=-((e.right-1)/2)*e.p;for(let m=0;m<e.right;m++){if(m===0&&!e.left&&!e.bottom&&!e.silkscreenlabels&&(s=_pe(e.w/2-e.pl*1.4,p+m*e.p,"right")),o.push(Wo(m+1+e.left+(e.bottom??0),e.w/2-e.pl/2,p+m*e.p,e.pl,e.pw)),e.silkscreenlabels){const _=m+1+e.left+(e.bottom??0),f=`pin${_}`;r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${_}`,pcb_component_id:"1",layer:"top",anchor_position:{x:e.w/2-e.pl-(u+e.silkscreenlabelmargin),y:p+m*e.p},text:f,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"})}e.innerhole&&(i.push(Os(m+1+e.left+(e.bottom??0)+c,e.w/2,p+m*e.p,a,A)),i.push(Os(m+1+e.left+(e.bottom??0)+c*2,e.w/2-e.innerholeedgedistance,p+m*e.p,a,A)))}}if(e.left){const p=(e.left-1)/2*e.p;for(let m=0;m<e.left;m++){if(m===0&&!e.silkscreenlabels&&(s=_pe(-e.w/2+e.pl*1.4,p-m*e.p,"left")),o.push(Wo(m+1,-e.w/2+e.pl/2,p-m*e.p,e.pl,e.pw)),e.silkscreenlabels){const _=m+1,f=`pin${_}`;r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${_}`,pcb_component_id:"1",layer:"top",anchor_position:{x:-e.w/2+e.pl+(u+e.silkscreenlabelmargin),y:p-m*e.p},text:f,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"})}e.innerhole&&(i.push(Os(m+1+c,-e.w/2,p-m*e.p,a,A)),i.push(Os(m+1+c*2,-e.w/2+e.innerholeedgedistance,p-m*e.p,a,A)))}}if(e.top){const p=(e.top-1)/2*e.p;for(let m=0;m<e.top;m++){if(m===0&&!e.left&&!e.bottom&&!e.right&&!e.silkscreenlabels&&(s=_pe(p-m*e.p,n/2-e.pl*1.4,"top")),o.push(Wo(m+1+e.left+e.right+(e.bottom??0),p-m*e.p,n/2-e.pl/2,e.pw,e.pl)),e.silkscreenlabels){const _=m+1+e.left+e.right+(e.bottom??0),f=`pin${_}`;r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${_}`,pcb_component_id:"1",layer:"top",anchor_position:{x:p-m*e.p,y:n/2-e.pl-(u+e.silkscreenlabelmargin)},text:f,font_size:.7,font:"tscircuit2024",anchor_alignment:"center",ccw_rotation:270})}e.innerhole&&(i.push(Os(m+1+e.left+e.right+(e.bottom??0)+c,p-m*e.p,n/2,a,A)),i.push(Os(m+1+e.left+e.right+(e.bottom??0)+c*2,p-m*e.p,n/2-e.innerholeedgedistance,a,A)))}}if(e.bottom){const p=-((e.bottom-1)/2)*e.p;for(let m=0;m<e.bottom;m++){if(m===0&&!e.left&&!e.silkscreenlabels&&(s=_pe(p+m*e.p,-n/2+e.pl*1.4,"bottom")),o.push(Wo(m+1+e.left,p+m*e.p,-n/2+e.pl/2,e.pw,e.pl)),e.silkscreenlabels){const _=m+1+e.left,f=`pin${_}`;r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${_}`,pcb_component_id:"1",layer:"top",anchor_position:{x:p+m*e.p,y:-n/2+e.pl+(u+e.silkscreenlabelmargin)},text:f,font_size:.7,font:"tscircuit2024",anchor_alignment:"center",ccw_rotation:90})}e.innerhole&&(i.push(Os(m+1+e.left+c,p+m*e.p,-n/2,a,A)),i.push(Os(m+1+e.left+c*2,p+m*e.p,-n/2+e.innerholeedgedistance,a,A)))}}const g={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_triangle_1",pcb_component_id:"2",route:s,stroke_width:.1,layer:"top"},h={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-e.w/2,y:n/2},{x:e.w/2,y:n/2},{x:e.w/2,y:-n/2},{x:-e.w/2,y:-n/2},{x:-e.w/2,y:n/2}],stroke_width:.1,layer:"top"},d=xi(0,n/1.8,n/25);return{circuitJson:[...o,...i,...r,h,...e.silkscreenlabels?[]:[g],d],parameters:e}},nsn=Ci.extend({fn:Z(),w:ce.default("22.58mm"),h:ce.optional(),left:ce.optional().default(20),right:ce.optional().default(20),top:ce.optional().default(2),bottom:ce.optional().default(2),p:ce.default(ce.parse("2.54mm")),pw:ce.default(ce.parse("1.6mm")),pl:ce.default(ce.parse("3.2mm")),innerhole:je().default(!1),innerholeedgedistance:ce.default(ce.parse("1.61mm"))}),Efi=t=>{const e=nsn.parse(t);return e.left&&e.right?Math.max(e.left,e.right)*e.p:e.left?e.left*e.p:e.right?e.right*e.p:51},Bfi=(t,e,n,o=1,i=.6)=>{const r=o/2,s=i/2;return{left:[{x:t+r,y:e},{x:t-r,y:e+s},{x:t-r,y:e-s},{x:t+r,y:e}],right:[{x:t-r,y:e},{x:t+r,y:e+s},{x:t+r,y:e-s},{x:t-r,y:e}],top:[{x:t,y:e-r},{x:t-s,y:e+r},{x:t+s,y:e+r},{x:t,y:e-r}],bottom:[{x:t,y:e+r},{x:t-s,y:e-r},{x:t+s,y:e-r},{x:t,y:e+r}]}[n]},bfi=t=>{const e=nsn.parse(t),n=e.h??Efi(e),o=[],i=[],r=[],s=1,a=1.2,A=e.left+e.right+(e.bottom??0)+(e.top??0);let c=[],l=1;if(e.left){const d=(e.left-1)/2*e.p;for(let p=0;p<e.left;p++)p===0&&(c=Bfi(-e.w/2-e.pl/2,d-p*e.p,"left")),o.push(Wo(l,-e.w/2+e.pl/2,d-p*e.p,e.pl,e.pw)),i.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${l}`,pcb_component_id:"1",layer:"top",anchor_position:{x:-e.w/2+e.pl/2-4.5,y:d-p*e.p},text:`pin${l}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),l++,e.innerhole&&r.push(Os(l+A,-e.w/2+e.innerholeedgedistance,d-p*e.p,s,a))}if(e.bottom){const d=(e.bottom-1)/2*e.p;for(let p=e.bottom-1;p>=0;p--)o.push(Wo(l,d-p*e.p,-n/2+e.pl/2,e.pw,e.pl)),i.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${l}`,pcb_component_id:"1",layer:"top",anchor_position:{x:d-p*e.p,y:-n/2+e.pl/2-3.2},text:`pin${l}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),l++,e.innerhole&&r.push(Os(l+A,d-p*e.p,-n/2+e.innerholeedgedistance,s,a))}if(e.right){const d=-((e.right-1)/2)*e.p;for(let p=0;p<e.right;p++)o.push(Wo(l,e.w/2-e.pl/2,d+p*e.p,e.pl,e.pw)),i.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${l}`,pcb_component_id:"1",layer:"top",anchor_position:{x:e.w/2-e.pl/2+3.7,y:d+p*e.p},text:`pin${l}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),l++,e.innerhole&&r.push(Os(l+A,e.w/2-e.innerholeedgedistance,d+p*e.p,s,a))}if(e.top){const d=-((e.top-1)/2)*e.p;for(let p=e.top-1;p>=0;p--)o.push(Wo(l,d+p*e.p,n/2-e.pl/2,e.pw,e.pl)),i.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${l}`,pcb_component_id:"1",layer:"top",anchor_position:{x:d+p*e.p,y:n/2-e.pl/2+3.2},text:`pin${l}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),l++,e.innerhole&&r.push(Os(l+A,d+p*e.p,n/2-e.innerholeedgedistance,s,a))}const u={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"1",pcb_component_id:"1",layer:"top",route:c,stroke_width:.1},g={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-e.w/2-e.pl/3,y:n/2+e.pl/3},{x:e.w/2+e.pl/3,y:n/2+e.pl/3},{x:e.w/2+e.pl/3,y:-n/2-e.pl/3},{x:-e.w/2-e.pl/3,y:-n/2-e.pl/3},{x:-e.w/2-e.pl/3,y:n/2+e.pl/3}],stroke_width:.1,layer:"top"},h=xi(0,n/1.8,n/25);return{circuitJson:[...r,...o,...i,g,u,h],parameters:e}},Sfi=t=>(t.legsoutside=!0,t.pl||(t.pl=1.5),t.pw||(t.pw=.3),uT(t)),Qfi=Ci.extend({fn:Z(),num_pins:_t().int().positive().optional().default(14),grid:WB.optional(),p:ce.default(ce.parse("0.5mm")),w:ce.optional(),h:ce.optional(),pw:ce.default(ce.parse("0.28mm")),pl:ce.default(ce.parse("0.7mm")),pillpads:je().optional().default(!1)}),vfi=t=>{const e=Qfi.parse(t),n=e.num_pins/2;if(!Number.isInteger(n))throw new Error("LGA footprints require an even number of perimeter pads");const o=e.grid??{x:Math.ceil(n/2),y:Math.floor(n/2)};if(!Number.isInteger(o.x)||!Number.isInteger(o.y)||o.x<0||o.y<0||o.x+o.y<=0||2*(o.x+o.y)!==e.num_pins)throw new Error(`LGA grid ${o.x}x${o.y} requires ${2*(o.x+o.y)} pads, got ${e.num_pins}`);const i=e.w??(o.y-1)*e.p+2*e.pl,r=e.h??(o.x-1)*e.p+2*e.pl,s=(i-e.pl)/2,a=(r-e.pl)/2,A=[],c=(p,m,_,f,I)=>{A.push(e.pillpads?cT(p,m,_,f,I):Wo(p,m,_,f,I))};let l=1;for(let p=0;p<o.x;p+=1)c(l++,-s,((o.x-1)/2-p)*e.p,e.pl,e.pw);for(let p=0;p<o.y;p+=1)c(l++,(p-(o.y-1)/2)*e.p,-a,e.pw,e.pl);for(let p=0;p<o.x;p+=1)c(l++,s,(p-(o.x-1)/2)*e.p,e.pl,e.pw);for(let p=0;p<o.y;p+=1)c(l++,((o.y-1)/2-p)*e.p,a,e.pw,e.pl);const u=Math.max(e.pw,.15),g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_marker",stroke_width:.1,route:[{x:-i/2,y:r/2-u},{x:-i/2,y:r/2},{x:-i/2+u,y:r/2}]},h=.25,d={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",layer:"top",outline:[{x:-i/2-h,y:-r/2-h},{x:i/2+h,y:-r/2-h},{x:i/2+h,y:r/2+h},{x:-i/2-h,y:r/2+h},{x:-i/2-h,y:-r/2-h}]};return{circuitJson:[...A,g,xi(0,r/2+.5,.3),d],parameters:{...e,grid:o,w:i,h:r}}},osn=Ci.extend({fn:Z(),w:ce.default("10mm"),h:ce.optional(),left:ce.optional().default(20),right:ce.optional().default(20),top:ce.optional().default(0),bottom:ce.optional().default(0),p:ce.default(ce.parse("2.54mm")),id:ce.optional().default(ce.parse("1mm")),od:ce.optional().default(ce.parse("1.5mm"))}),wfi=t=>{const e=osn.parse(t);return e.left&&e.right?Math.max(e.left,e.right)*e.p:e.left?e.left*e.p:e.right?e.right*e.p:51},fpe=(t,e,n,o=1,i=.6)=>{const r=o/2,s=i/2;return{left:[{x:t+r,y:e},{x:t-r,y:e+s},{x:t-r,y:e-s},{x:t+r,y:e}],right:[{x:t-r,y:e},{x:t+r,y:e+s},{x:t+r,y:e-s},{x:t-r,y:e}],top:[{x:t,y:e-r},{x:t-s,y:e+r},{x:t+s,y:e+r},{x:t,y:e-r}],bottom:[{x:t,y:e+r},{x:t-s,y:e-r},{x:t+s,y:e-r},{x:t,y:e+r}]}[n]},Pfi=t=>{const e=osn.parse(t),n=e.h??wfi(e),o=[],i=e.id,r=e.od;let s=[];if(e.right){const l=-((e.right-1)/2)*e.p;for(let u=0;u<e.right;u++)u===0&&!e.left&&!e.bottom&&(s=fpe(e.w/2+r*1.4,l+u*e.p,"right")),o.push(Os(u+1+e.left+(e.bottom??0),e.w/2,l+u*e.p,i,r))}if(e.left){const l=-((e.left-1)/2)*e.p;for(let u=0;u<e.left;u++)u===e.left-1&&(s=fpe(-e.w/2-r*1.4,l+u*e.p,"left")),o.push(Os(u+1,-e.w/2,l+u*e.p,i,r))}if(e.top){const l=-((e.top-1)/2)*e.p;for(let u=0;u<e.top;u++)u===e.top-1&&!e.left&&!e.bottom&&!e.right&&(s=fpe(l+u*e.p,n/2+r*1.4,"top")),o.push(Os(u+1+e.right+(e.bottom??0)+e.left,l+u*e.p,n/2,i,r))}if(e.bottom){const l=-((e.bottom-1)/2)*e.p;for(let u=0;u<e.bottom;u++)u===0&&!e.left&&(s=fpe(l+u*e.p,-n/2-r*1.4,"bottom")),o.push(Os(u+1+e.left,l+u*e.p,-n/2,i,r))}const a={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"1",pcb_component_id:"1",layer:"top",route:s,stroke_width:.1},A={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-e.w/2-r,y:n/2+r},{x:e.w/2+r,y:n/2+r},{x:e.w/2+r,y:-n/2-r},{x:-e.w/2-r,y:-n/2-r},{x:-e.w/2-r,y:n/2+r}],stroke_width:.1,layer:"top"},c=xi(0,n/1.7,n/25);return{circuitJson:[...o,A,c,a],parameters:e}},Mfi=t=>{const{centerX:e,centerY:n,straightHalfLength:o,radius:i,arcSegmentCount:r=9,orientation:s="horizontal"}=t;if(o<0)throw new Error("Capsule straightHalfLength must be non-negative");if(i<=0)throw new Error("Capsule radius must be positive");if(r<2)throw new Error("Capsule arcSegmentCount must be at least 2");if(s==="horizontal"){const u=e-o,g=e+o,h=Array.from({length:r+1},(p,m)=>{const _=Math.PI/2-m*Math.PI/r;return{x:g+Math.cos(_)*i,y:n+Math.sin(_)*i}}),d=Array.from({length:r+1},(p,m)=>{const _=-Math.PI/2+m*Math.PI/r;return{x:u-Math.cos(_)*i,y:n+Math.sin(_)*i}});return[{x:u,y:n+i},{x:g,y:n+i},...h.slice(1,-1),{x:g,y:n-i},{x:u,y:n-i},...d.slice(1,-1)]}const a=n-o,A=n+o,c=Array.from({length:r+1},(u,g)=>{const h=Math.PI-g*Math.PI/r;return{x:e+Math.cos(h)*i,y:A+Math.sin(h)*i}}),l=Array.from({length:r+1},(u,g)=>{const h=g*Math.PI/r;return{x:e+Math.cos(h)*i,y:a-Math.sin(h)*i}});return[{x:e-i,y:a},{x:e-i,y:A},...c.slice(1,-1),{x:e+i,y:A},{x:e+i,y:a},...l.slice(1,-1)]},isn=(t,e,n,o)=>Array.from({length:25},(i,r)=>{const s=r/24*Math.PI-Math.PI/2;return{x:t+(o==="right"?1:-1)*Math.cos(s)*n,y:e+Math.sin(s)*n}}),Dfi=Ci.extend({fn:Z(),p:ce.optional().default("4.88mm"),id:ce.optional().default("0.8mm"),od:ce.optional().default("1.5mm"),w:ce.optional().default("5.6mm"),h:ce.optional().default("3.5mm")}),Nfi=t=>{const e=Dfi.parse(t),{p:n,id:o,od:i,w:r,h:s}=e,a=s/2,A=[Os(1,-n/2,0,o,i),Os(2,n/2,0,o,i)],c=isn(-r/2,0,a,"left"),l=isn(r/2,0,a,"right"),u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[...c,...c.slice(1).reverse(),{x:-r/2,y:-s/2},{x:r/2,y:-s/2},...l,{x:r/2,y:s/2},{x:-r/2,y:s/2}],stroke_width:.1,pcb_silkscreen_path_id:""},g=xi(0,n/4,.5),d=n/2+i/2,p=Math.max(s/2+.25,r/2+.03),m={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:Mfi({centerX:0,centerY:0,straightHalfLength:d,radius:p,arcSegmentCount:9}),layer:"top"};return{circuitJson:[...A,u,g,m],parameters:e}};Ci.extend({w:ce,h:ce});var Rfi=t=>{const{w:e,h:n}=t,o=Ua(e),i=Ua(n);return{circuitJson:[Wo(1,0,0,o,i),xi(0,i/2+.5,.2)],parameters:t}},Q6=(t,e,n,o,i,r)=>({pcb_plated_hole_id:"",type:"pcb_plated_hole",shape:"pill",x:e,y:n,outer_width:Ua(i),outer_height:Ua(r),hole_width:Ua(o),hole_height:Ua(o),pcb_port_id:"",layers:["top","bottom"],port_hints:[t.toString()],ccw_rotation:0}),Tfi=[{x:-2.5,y:4.75},{x:-2.5,y:-.25},{x:2.5,y:-.25},{x:2.5,y:4.75}],kfi=Ci.extend({fn:Z(),num_pins:xo([$e(3),$e(2)]).default(3),p:Z().default("1.27mm"),id:Z().default("0.72mm"),od:Z().default("0.95mm"),w:Z().default("4.5mm"),h:Z().default("4.5mm"),inline:je().default(!1),string:Z().optional()}),Ffi=(t,e,n)=>Array.from({length:25},(o,i)=>{const r=i/24*Math.PI;return{x:t+Math.cos(r)*n,y:e+Math.sin(r)*n}}),Lfi=t=>{const e=t.string?.match(/^to92_(\d+)/),n=e?Number.parseInt(e[1],10):3,o=kfi.parse({...t,num_pins:n}),{p:i,id:r,od:s,w:a,h:A,inline:c}=o,l=Number.parseFloat(A)/2,u=Number.parseFloat(i),g=Number.parseFloat(r),h=Number.parseFloat(s),d=h,p=h*(1.5/1.05);let m=[];if(o.num_pins===3)c?m=[r2({pn:1,x:-u,y:l-u,holeDiameter:g,rectPadWidth:h,rectPadHeight:p}),Q6(2,0,l-u,g,d,p),Q6(3,u,l-u,g,d,p)]:m=[r2({pn:1,x:-u,y:l-u,holeDiameter:g,rectPadWidth:h,rectPadHeight:h}),Os(2,0,l,g,h),Os(3,u,l-u,g,h)];else if(o.num_pins===2)m=[r2({pn:1,x:-u,y:l-u,holeDiameter:g,rectPadWidth:d,rectPadHeight:p}),Q6(2,u,l-u,g,d,p)];else throw new Error("Invalid number of pins for TO-92");const _=Number.parseFloat(a)/2,f=Ffi(0,l,_),I={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[...f,{x:-_,y:0},{x:_,y:0},f[0]],stroke_width:.1,pcb_silkscreen_path_id:""},C=xi(0,l+1,.5),y={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:Tfi,layer:"top"};return{circuitJson:[...m,I,C,y],parameters:o}},Hfi=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("2.15mm"),h:Z().default("0.7mm"),pl:Z().default("0.6mm"),pw:Z().default("0.7mm"),p:Z().default("1.4mm")}),Ofi=t=>{const e=Hfi.parse(t),n=xi(0,ce.parse(e.h),.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2,y:ce.parse(e.h)/2+.2},{x:-ce.parse(e.w)/2-.2,y:ce.parse(e.h)/2+.2},{x:-ce.parse(e.w)/2-.2,y:-ce.parse(e.h)/2-.2},{x:ce.parse(e.p)/2,y:-ce.parse(e.h)/2-.2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:2.5,height:1.4,layer:"top"};return{circuitJson:Yfi(e).concat(...uh(e),o,n,s),parameters:e}},Gfi=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},Yfi=t=>{const e=[],n=ce.parse(t.p),o=ce.parse(t.pl),i=ce.parse(t.pw),r=.075;for(let s=1;s<=t.num_pins;s++){const{x:a,y:A}=Gfi({pn:s,p:n});e.push(Wo(s,a,A,o,i,r))}return e},Ufi=lT({w:"7.05mm",p:"1.27mm",pw:"0.65mm",pl:"1.975mm"}),Kfi=t=>{const e=Ufi.parse(t),n=[],o=Math.min(e.pl,e.pw)/8;for(let h=0;h<e.num_pins;h++){const{x:d,y:p}=UVe({num_pins:e.num_pins,pn:h+1,w:e.w,p:e.p??1.27,pl:e.pl,widthincludeslegs:!0});n.push(Wo(h+1,d,p,e.pl,e.pw,o))}const i=(e.num_pins/2-1)*e.p+e.pw,r=xi(0,i/2+1,i/12),s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:-e.w/3,y:i/2+.4},{x:e.w/3,y:i/2+.4}],stroke_width:.1},a=(e.num_pins/2-1)*e.p+e.pw,A=e.w/2-1.395,c=e.w/2+.255,l=a/2+.25,u=a/2+.5,g={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",layer:"top",outline:s2([{minX:-c,maxX:c,minY:-l,maxY:l},{minX:-A,maxX:A,minY:-u,maxY:u}])};return{circuitJson:[...n,r,s,g],parameters:e}},Vfi=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("5.0mm"),h:Z().default("2.30mm"),pl:Z().default("1.25mm"),pw:Z().default("2mm"),p:Z().default("3.75mm")}),zfi=t=>{const e=Vfi.parse(t),n=xi(0,ce.parse(e.h)/2+1,.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2+.5,y:ce.parse(e.h)/2+.5},{x:-ce.parse(e.w)/2-.5,y:ce.parse(e.h)/2+.5},{x:-ce.parse(e.w)/2-.5,y:-ce.parse(e.h)/2-.5},{x:ce.parse(e.p)/2+.5,y:-ce.parse(e.h)/2-.5}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:5.1,height:2.8,layer:"top"};return{circuitJson:Wfi(e).concat(...uh(e),o,n,s),parameters:e}},Jfi=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},Wfi=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=Jfi({pn:n,p:Number.parseFloat(t.p)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return e},jfi=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("4.4mm"),h:Z().default("1.7mm"),pl:Z().default("1.2mm"),pw:Z().default("1.2mm"),p:Z().default("2.8mm")}),$fi=t=>{const e=jfi.parse(t),n=xi(0,ce.parse(e.h)-.5,.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.2,y:-ce.parse(e.h)/2},{x:ce.parse(e.p)/2,y:-ce.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:4.5,height:2.2,layer:"top"};return{circuitJson:Xfi(e).concat(...uh(e),o,n,s),parameters:e}},qfi=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},Xfi=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=qfi({pn:n,p:Number.parseFloat(t.p)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return e},Zfi=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("3.30mm"),h:Z().default("1.80mm"),pl:Z().default("0.60mm"),pw:Z().default("0.45mm"),p:Z().default("2.1mm")}),e1i=t=>{const e=Zfi.parse(t),n=xi(0,ce.parse(e.h)-.5,.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2,y:-ce.parse(e.h)/2},{x:ce.parse(e.p)/2,y:-ce.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:3.2,height:1.9,layer:"top"};return{circuitJson:n1i(e).concat(...uh(e),o,n,s),parameters:e}},t1i=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},n1i=t=>{const e=[],n=ce.parse(t.p),o=ce.parse(t.pl),i=ce.parse(t.pw),r=.05625;for(let s=1;s<=t.num_pins;s++){const{x:a,y:A}=t1i({pn:s,p:n});e.push(Wo(s,a,A,o,i,r))}return e},o1i=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("1.4mm"),h:Z().default("0.9mm"),pl:Z().default("0.36mm"),pw:Z().default("0.25mm"),p:Z().default("0.85mm")}),i1i=t=>{const e=o1i.parse(t),n=ce.parse(e.w),o=ce.parse(e.h),i=ce.parse(e.pl),r=ce.parse(e.pw),s=ce.parse(e.p),a=xi(0,o,.3),A={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:s/2+.15,y:o/2},{x:-n/2-.15,y:o/2},{x:-n/2-.15,y:-o/2},{x:s/2+.15,y:-o/2}],stroke_width:.1,pcb_silkscreen_path_id:""},c=s+i,l=r,u=n/2,g=o/2,h=c/2,d=l/2,p=Math.max(u,h),m=Math.max(g,d),_=Math.min(u,h),f=Math.min(g,d),I=p+.05,C=_-.055,y=m,x=f+.155,E={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:s2([{minX:-I,maxX:I,minY:-x,maxY:x},{minX:-C,maxX:C,minY:-y,maxY:y}]),layer:"top"};return{circuitJson:s1i(e).concat(...uh(e),A,a,E),parameters:e}},r1i=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},s1i=t=>{const e=[],n=ce.parse(t.p),o=ce.parse(t.pl),i=ce.parse(t.pw),r=.03125;for(let s=1;s<=t.num_pins;s++){const{x:a,y:A}=r1i({pn:s,p:n});e.push(Wo(s,a,A,o,i,r))}return e},a1i=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("1.3mm"),h:Z().default("0.9mm"),pl:Z().default("0.4mm"),pw:Z().default("0.7mm"),p:Z().default("0.7mm")}),A1i=t=>{const e=a1i.parse(t),n=xi(0,ce.parse(e.h)+.1,.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2+.2,y:ce.parse(e.h)/2+.2},{x:-ce.parse(e.w)/2-.2,y:ce.parse(e.h)/2+.2},{x:-ce.parse(e.w)/2-.2,y:-ce.parse(e.h)/2-.2},{x:ce.parse(e.p)/2+.2,y:-ce.parse(e.h)/2-.2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:1.6,height:1.2,layer:"top"};return{circuitJson:l1i(e).concat(...uh(e),o,n,s),parameters:e}},c1i=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},l1i=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=c1i({pn:n,p:Number.parseFloat(t.p)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw),.025))}return e},u1i=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("3.05mm"),h:Z().default("1.4mm"),pl:Z().default("0.5mm"),pw:Z().default("0.5mm"),pad_spacing:Z().default("2.2mm")}),g1i=t=>{const e=u1i.parse(t),n=xi(0,ce.parse(e.h),.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.pad_spacing)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.2,y:-ce.parse(e.h)/2},{x:ce.parse(e.pad_spacing)/2,y:-ce.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:3.2,height:1.9,layer:"top"};return{circuitJson:h1i(e).concat(...uh(e),o,n,s),parameters:e}},d1i=t=>{const{pn:e,pad_spacing:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},h1i=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=d1i({pn:n,pad_spacing:Number.parseFloat(t.pad_spacing)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw),.0625))}return e},p1i=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("4.4mm"),h:Z().default("2.1mm"),pl:Z().default("1.10mm"),pw:Z().default("1.10mm"),p:Z().default("2.8mm")}),m1i=t=>{const e=p1i.parse(t),n=xi(0,ce.parse(e.h),.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.2,y:-ce.parse(e.h)/2},{x:ce.parse(e.p)/2,y:-ce.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:4.4,height:2.3,layer:"top"};return{circuitJson:f1i(e).concat(...uh(e),o,n,s),parameters:e}},_1i=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},f1i=t=>{const e=[],n=ce.parse(t.p),o=ce.parse(t.pl),i=ce.parse(t.pw),r=.125;for(let s=1;s<=t.num_pins;s++){const{x:a,y:A}=_1i({pn:s,p:n});e.push(Wo(s,a,A,o,i,r))}return e},I1i=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("4.4mm"),h:Z().default("2.1mm"),pl:Z().default("0.91mm"),pw:Z().default("1.22mm"),p:Z().default("3.146mm")}),C1i=t=>{const e=I1i.parse(t),n=xi(0,ce.parse(e.h),.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.2,y:-ce.parse(e.h)/2},{x:ce.parse(e.p)/2,y:-ce.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:4.9,height:2.7,layer:"top"};return{circuitJson:x1i(e).concat(...uh(e),o,n,s),parameters:e}},y1i=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},x1i=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=y1i({pn:n,p:Number.parseFloat(t.p)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return e},E1i=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("1.80mm"),h:Z().default("1.00mm"),pl:Z().default("0.66mm"),pw:Z().default("0.5mm"),p:Z().default("0.8mm")}),B1i=t=>{const e=E1i.parse(t),n=xi(0,ce.parse(e.h),.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.1,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.1,y:-ce.parse(e.h)/2},{x:ce.parse(e.p)/2,y:-ce.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:2.3,height:1.5,layer:"top"};return{circuitJson:S1i(e).concat(...uh(e),o,n,s),parameters:e}},b1i=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},S1i=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=b1i({pn:n,p:Number.parseFloat(t.p)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return e},Q1i=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("6.2mm"),h:Z().default("3.4mm"),pl:Z().default("1.4mm"),pw:Z().default("2.1mm"),p:Z().default("4.4mm")}),v1i=t=>{const e=Q1i.parse(t),n=xi(0,ce.parse(e.h)/2+.4,.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.2,y:-ce.parse(e.h)/2},{x:ce.parse(e.p)/2,y:-ce.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:6.3,height:3,layer:"top"};return{circuitJson:P1i(e).concat(...uh(e),o,n,s),parameters:e}},w1i=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},P1i=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=w1i({pn:n,p:Number.parseFloat(t.p)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw),.125))}return e},M1i=[{x:-2.85,y:-2.5},{x:-2.85,y:2.5},{x:2.25,y:2.5},{x:2.25,y:-2.5}],D1i=[{x:-2.85,y:-2.5},{x:-2.85,y:2.5},{x:2.85,y:2.5},{x:2.85,y:-2.5}],N1i=[{x:.9,y:.5},{x:2.6,y:.5},{x:2.6,y:-.5},{x:.9,y:-.5},{x:.4,y:-1},{x:-.4,y:-1},{x:-.9,y:-.5},{x:-2.6,y:-.5},{x:-2.6,y:.5},{x:-.9,y:.5},{x:-.4,y:1},{x:.4,y:1}],R1i=[{x:2,y:-.8665},{x:-1.125,y:-.8665},{x:-1.125,y:-.45},{x:-2.6,y:-.45},{x:-2.6,y:.45},{x:-1.125,y:.45},{x:-1.125,y:.8665},{x:2,y:.8665}],T1i=Ci.extend({fn:Z(),num_pins:xo([$e(3),$e(5)]).default(3),w:Z().default("4.20mm"),h:Z().default("4.80mm"),pl:Z().default("1.3mm"),pw:Z().default("0.9mm"),p:Z().default("1.5mm"),string:Z().optional()}),k1i=t=>{const e=Number.parseFloat(t.p),n=Number.parseFloat(t.pw),o=Number.parseFloat(t.w),i=Number.parseFloat(t.pl),r=Math.min(i,n)/8,s=-o/2+.15,a=o/2-1,A=Number.parseFloat(t.h)/2,c=[Wo(1,s,e,i,n,r),zVe(2,R1i),Wo(3,s,-e,i,n,r)],l=xi(0,A+.5,.3),u={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-a,y:A},{x:a,y:A},{x:a,y:A/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},g={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-a,y:-A},{x:a,y:-A},{x:a,y:-A/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1},h={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:M1i,layer:"top"};return[...c,u,g,l,h]},F1i=t=>{const e=Math.min(1.5,.7)/8,n=[Wo(1,-1.85,-1.5,1.5,.7,e),Wo(2,-1.85,1.5,1.5,.7,e),zVe(3,N1i),Wo(4,1.85,-1.5,1.5,.7,e),Wo(5,1.85,1.5,1.5,.7,e)],o=Number.parseFloat(t.w)/2-1,i=Number.parseFloat(t.h)/2,r=xi(0,i+.5,.3),s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-o,y:i},{x:o,y:i}],type:"pcb_silkscreen_path",stroke_width:.1},a={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-o,y:-i},{x:o,y:-i}],type:"pcb_silkscreen_path",stroke_width:.1},A={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:D1i,layer:"top"};return[...n,s,a,r,A]},L1i=t=>{const e=t.string?.match(/^sot89_(\d+)/),n=e?Number.parseInt(e[1],10):3,o=T1i.parse({...t,num_pins:n});if(o.num_pins===3)return{circuitJson:k1i(o),parameters:o};if(o.num_pins===5)return{circuitJson:F1i(o),parameters:o};throw new Error("Invalid number of pins for SOT89")},H1i=Ci.extend({fn:Z(),p:ce.optional().default("5.0mm"),id:ce.optional().default("1.0mm"),od:ce.optional().default("1.9mm"),w:ce.optional().default("13mm"),h:ce.optional().default("7mm"),num_pins:_t().optional(),string:Z().optional()}),rsn=t=>{const e=H1i.parse(t),{id:n,od:o,w:i,h:r,string:s}=e,a=e.num_pins??Number.parseInt(s?.match(/^to220(?:_|-)(\d+)/i)?.[1]??"3"),A=-1,c=i/2,l=r/2,u=2.5,g=i*.4,h=Math.max(u,g/(a-1)),d=Array.from({length:a},(F,O)=>{const U=a%2===0?(O-a/2+.5)*h:(O-Math.floor(a/2))*h;return Os(O+1,U,A,n,o)}),p={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-c,y:-l},{x:c,y:-l},{x:c,y:l},{x:-c,y:l},{x:-c,y:-l}],stroke_width:.1,pcb_silkscreen_path_id:""},m=-l+2*r/3,_={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-c,y:m},{x:c,y:m}],stroke_width:.1,pcb_silkscreen_path_id:""},f=[{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-i/6,y:m},{x:-i/6,y:l}],stroke_width:.1,pcb_silkscreen_path_id:""},{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:i/6,y:m},{x:i/6,y:l}],stroke_width:.1,pcb_silkscreen_path_id:""}],I=xi(0,r/2+.6,.5),C=Math.max(...d.map(F=>Math.abs(F.x)))+o/2,y=A+o/2,x=A-o/2,E=Math.max(C+.25,c-o*.59),B=l-o*.63,S=x-(o/2+.01),Q=-E,w=E,M=Math.min(S,x-.25),k=Math.max(B,y+.25),R={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:(Q+w)/2,y:(M+k)/2},width:w-Q,height:k-M,layer:"top"};return{circuitJson:[...d,p,_,...f,I,R],parameters:{...e,p:h}}},JVe=2.54,O1i=Ci.extend({fn:Z(),id:ce.optional().default("1.2mm"),od:ce.optional().default("1.905mm"),ph:ce.optional().default("2mm"),w:ce.optional().default("13mm"),h:ce.optional().default("7mm"),num_pins:_t().optional(),string:Z().optional()}),G1i=t=>{const e=O1i.parse(t),n=e.num_pins??Number.parseInt(e.string?.match(/^to220f(?:_|-)(\d+)/i)?.[1]??"3"),o=rsn({...e,fn:"to220",string:e.string?.replace(/^to220f/i,"to220"),num_pins:n}),i=-1,r=Array.from({length:n},(a,A)=>{const c=n%2===0?(A-n/2+.5)*JVe:(A-Math.floor(n/2))*JVe;return A===0?r2({pn:1,x:c,y:i,holeDiameter:e.id,rectPadWidth:e.od,rectPadHeight:e.ph}):Q6(A+1,c,i,Ua(e.id),Ua(e.od),Ua(e.ph))}),s=o.circuitJson.filter(a=>a.type!=="pcb_plated_hole");return{circuitJson:[...r,...s],parameters:{...e,p:JVe,num_pins:n}}},Y1i=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("5.40mm"),h:Z().default("2.30mm"),pl:Z().default("1.30mm"),pw:Z().default("1.70mm"),p:Z().default("3.5mm")}),U1i=t=>{const e=Y1i.parse(t),n=xi(0,ce.parse(e.h)/2+.4,.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2,y:-ce.parse(e.h)/2},{x:ce.parse(e.p)/2,y:-ce.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:5.3,height:2.2,layer:"top"};return{circuitJson:V1i(e).concat(...uh(e),o,n,s),parameters:e}},K1i=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},V1i=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=K1i({pn:n,p:Number.parseFloat(t.p)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw),.125))}return e},z1i=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("1.90mm"),h:Z().default("1.33mm"),pl:Z().default("0.5mm"),pw:Z().default("0.7mm"),p:Z().default("0.8mm")}),J1i=t=>{const e=z1i.parse(t),n=xi(0,ce.parse(e.h)+.1,.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2+.1,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2,y:-ce.parse(e.h)/2},{x:ce.parse(e.p)/2+.1,y:-ce.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:1.8,height:1.2,layer:"top"};return{circuitJson:j1i(e).concat(...uh(e),o,n,s),parameters:e}},W1i=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},j1i=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=W1i({pn:n,p:Number.parseFloat(t.p)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw),.0625))}return e},$1i=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("7.0mm"),h:Z().default("3.35mm"),pl:Z().default("1.50mm"),pw:Z().default("2.70mm"),p:Z().default("4.8mm")}),q1i=t=>{const e=$1i.parse(t),n=xi(0,ce.parse(e.h),.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2,y:-ce.parse(e.h)/2},{x:ce.parse(e.p)/2,y:-ce.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:6.8,height:3.2,layer:"top"};return{circuitJson:Z1i(e).concat(...uh(e),o,n,s),parameters:e}},X1i=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},Z1i=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=X1i({pn:n,p:Number.parseFloat(t.p)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw),.125))}return e},eIi=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("3.0mm"),h:Z().default("1.80mm"),pl:Z().default("0.80mm"),pw:Z().default("1.20mm"),p:Z().default("1.6mm")}),tIi=t=>{const e=eIi.parse(t),n=xi(0,ce.parse(e.h),.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.1,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.1,y:-ce.parse(e.h)/2},{x:ce.parse(e.p)/2,y:-ce.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:2.9,height:1.7,layer:"top"};return{circuitJson:oIi(e).concat(...uh(e),o,n,s),parameters:e}},nIi=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},oIi=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=nIi({pn:n,p:Number.parseFloat(t.p)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw),.1))}return e},iIi=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("7.10mm"),h:Z().default("3.40mm"),pl:Z().default("2.50mm"),pw:Z().default("1.80mm"),p:Z().default("4.00mm")}),rIi=t=>{const e=iIi.parse(t),n=xi(0,ce.parse(e.h)/2+.5,.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.5,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.5,y:-ce.parse(e.h)/2},{x:ce.parse(e.p)/2,y:-ce.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:7,height:3.5,layer:"top"};return{circuitJson:aIi(e).concat(...uh(e),o,n,s),parameters:e}},sIi=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},aIi=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=sIi({pn:n,p:Number.parseFloat(t.p)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw),.125))}return e},AIi=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("4.80mm"),h:Z().default("2.10mm"),pl:Z().default("1.30mm"),pw:Z().default("1.40mm"),p:Z().default("2.9mm")}),cIi=t=>{const e=AIi.parse(t),n=xi(0,ce.parse(e.h)-.5,.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2,y:-ce.parse(e.h)/2},{x:ce.parse(e.p)/2,y:-ce.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:4.7,height:2.3,layer:"top"};return{circuitJson:uIi(e).concat(...uh(e),o,n,s),parameters:e}},lIi=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},uIi=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=lIi({pn:n,p:Number.parseFloat(t.p)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw),.125))}return e},gIi=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("7.30mm"),h:Z().default("4.40mm"),pl:Z().default("2.50mm"),pw:Z().default("2.30mm"),p:Z().default("4.30mm")}),dIi=t=>{const e=gIi.parse(t),n=xi(0,ce.parse(e.h)/2+.5,.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.1,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.1,y:-ce.parse(e.h)/2},{x:ce.parse(e.p)/2,y:-ce.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:7.3,height:4.5,layer:"top"};return{circuitJson:pIi(e).concat(...uh(e),o,n,s),parameters:e}},hIi=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},pIi=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=hIi({pn:n,p:Number.parseFloat(t.p)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw),.125))}return e},mIi=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("10.70mm"),h:Z().default("6.60mm"),pl:Z().default("2.50mm"),pw:Z().default("3.30mm"),p:Z().default("6.80mm")}),_Ii=t=>{const e=mIi.parse(t),n=xi(0,3,.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2,y:ce.parse(e.h)/2-.8},{x:-ce.parse(e.w)/2-.8,y:ce.parse(e.h)/2-.8},{x:-ce.parse(e.w)/2-.8,y:-ce.parse(e.h)/2+.8},{x:ce.parse(e.p)/2,y:-ce.parse(e.h)/2+.8}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:9.8,height:6.7,layer:"top"};return{circuitJson:IIi(e).concat(...uh(e),o,n,s),parameters:e}},fIi=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},IIi=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=fIi({pn:n,p:Number.parseFloat(t.p)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw),.125))}return e},CIi=Ci.extend({fn:Z(),num_pins:_t().default(4),w:Z().default("8.50mm"),h:Z().default("6.90mm"),pl:Z().default("2mm"),pw:Z().default("1.5mm"),p:Z().default("2.30mm"),tabpl:Z().optional(),tabpw:Z().default("3.8mm"),taboffset:Z().default("0mm"),string:Z().optional()}),yIi=t=>{const e=t.string?.match(/^sot223_(\d+)/),n=e?Number.parseInt(e[1],10):4;if(n===8){const i=BIi.parse({...t,num_pins:n});return{circuitJson:LX(i),parameters:i}}const o=CIi.parse({...t,num_pins:n});if(o.num_pins===4)return{circuitJson:EIi(o),parameters:o};if(o.num_pins===5)return{circuitJson:SIi(o),parameters:o};if(o.num_pins===6)return{circuitJson:vIi(o),parameters:o};throw new Error("Invalid number of pins")},xIi=t=>{const{pn:e,w:n,p:o,taboffset:i}=t;return e===1?{x:-n/2+1.1,y:o}:e===2?{x:-n/2+1.1,y:0}:e===3?{x:-n/2+1.1,y:-o}:{x:n/2-1.1+i,y:0}},EIi=t=>{const e=[];let n=0,o=0;const i=Number.parseFloat(t.w),r=Number.parseFloat(t.h),s=Number.parseFloat(t.pl),a=Number.parseFloat(t.p),A=Number.parseFloat(t.pw),c=Number.parseFloat(t.tabpl??t.pl),l=Number.parseFloat(t.tabpw),u=Number.parseFloat(t.taboffset);for(let x=0;x<t.num_pins;x++){const{x:E,y:B}=xIi({num_pins:t.num_pins,pn:x+1,w:i,p:a,taboffset:u}),S=x===3?l:A,Q=x===3?c:s,w=Math.min(Q,S)/8;n=Math.max(n,Math.abs(E)+Q/2),o=Math.max(o,Math.abs(B)+S/2),e.push(Wo(x+1,E,B,Q,S,w))}const g=xi(0,0,.3),h=i/2-2.4,d=r/2,p={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-h,y:d},{x:h,y:d},{x:h,y:d/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},m={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-h,y:-d},{x:h,y:-d},{x:h,y:-d/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1},_=i/2,f=r/2,I=Math.max(n+.25,_+.15),C=Math.max(o+.25,f+.15),y={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:2*I,height:2*C,layer:"top"};return[...e,p,m,g,y]},BIi=lT({p:"0.90mm",w:"2.8mm",legsoutside:!0}),bIi=t=>{const{p:e,pn:n,w:o}=t;if(n===1)return{x:-o/2+1.2,y:e/2+e};if(n===2)return{x:-o/2+1.2,y:e/2};if(n===3)return{x:-o/2+1.2,y:-e/2};if(n===4)return{x:-o/2+1.2,y:-e/2-e};if(n===5)return{x:o/2-1,y:0};throw new Error("Invalid pin number")},SIi=t=>{const e=[];let n=0,o=0;const i=Number.parseFloat(t.w),r=Number.parseFloat(t.h);for(let m=1;m<=t.num_pins;m++){const{x:_,y:f}=bIi({p:1.5,pn:m,w:i});let I=Number.parseFloat(t.pw),C=Number.parseFloat(t.pl);m===5?(I=3.4,C=1.8):(I=1,C=2.2);const y=Math.min(C,I)/8;n=Math.max(n,Math.abs(_)+C/2),o=Math.max(o,Math.abs(f)+I/2),e.push(Wo(m,_,f,C,I,y))}const s=i/2-2.4,a=r/2,A={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-s,y:a},{x:s,y:a},{x:s,y:a/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},c={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-s,y:-a},{x:s,y:-a},{x:s,y:-a/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1},l=xi(0,0,.3),u=i/2,g=r/2,h=Math.max(n+.25,u+.15),d=Math.max(o+.25,g+.15),p={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:2*h,height:2*d,layer:"top"};return[...e,A,c,l,p]},QIi=t=>{const{p:e,pn:n,w:o}=t;if(n===1)return{x:-o/2+1.2,y:2*e};if(n===2)return{x:-o/2+1.2,y:e};if(n===3)return{x:-o/2+1.2,y:0};if(n===4)return{x:-o/2+1.2,y:-e};if(n===5)return{x:-o/2+1.2,y:-2*e};if(n===6)return{x:o/2-1.175,y:0};throw new Error("Invalid pin number")},vIi=t=>{const e=[];let n=0,o=0;const i=Number.parseFloat(t.h),r=8.7;for(let m=1;m<=t.num_pins;m++){const{x:_,y:f}=QIi({p:1.3,pn:m,w:r});let I=Number.parseFloat(t.pw),C=Number.parseFloat(t.pl);m===6?(I=3.4,C=2.15):(I=.6,C=2.2);const y=Math.min(C,I)/8;n=Math.max(n,Math.abs(_)+C/2),o=Math.max(o,Math.abs(f)+I/2),e.push(Wo(m,_,f,C,I,y))}const s=Number.parseFloat(t.w)/2-2.4,a=i/2,A={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-s,y:a},{x:s,y:a},{x:s,y:a/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},c={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-s,y:-a},{x:s,y:-a},{x:s,y:-a/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1},l=xi(0,0,.3),u=Number.parseFloat(t.w)/2,g=i/2,h=Math.max(n+.25,u+.15),d=Math.max(o+.25,g+.15),p={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:2*h,height:2*d,layer:"top"};return[...e,A,c,l,p]},wIi=Ci.extend({fn:Z(),num_pins:_t().default(3),w:Z().default("3.40mm"),h:Z().default("3.30mm"),pl:Z().default("1mm"),pw:Z().default("0.7mm"),p:Z().default("1.2mm"),string:Z().optional()}),PIi=t=>{const e=t.string?.match(/^sot23w_(\d+)/),n=e?Number.parseInt(e[1],3):3,o=wIi.parse({...t,num_pins:n});if(o.num_pins===3)return{circuitJson:DIi(o),parameters:o};throw new Error("Invalid number of pins")},MIi=t=>{const{pn:e,p:n}=t;return e===1?{x:-n,y:.95}:e===2?{x:-n,y:-.95}:{x:n,y:0}},DIi=t=>{const e=[],n=Number.parseFloat(t.w),o=Number.parseFloat(t.h),i=Number.parseFloat(t.pl),r=Number.parseFloat(t.pw),s=Number.parseFloat(t.p),a=Math.min(i,r)/8;for(let I=0;I<t.num_pins;I++){const{x:C,y}=MIi({num_pins:t.num_pins,pn:I+1,p:s});e.push(Wo(I+1,C,y,i,r,a))}const A=xi(0,Number.parseInt(t.h)/2+1,.3),c=n/2-1,l=o/2,u={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-c,y:l},{x:c+.3,y:l},{x:c+.3,y:l/2}],type:"pcb_silkscreen_path",stroke_width:.1},g={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-c,y:-l},{x:c+.3,y:-l},{x:c+.3,y:-l/2}],type:"pcb_silkscreen_path",stroke_width:.1},h=s+i/2,d=.95+r/2,p=o/2,m=h+.25,_=Math.max(d+.25,p+.09),f={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:2*m,height:2*_,layer:"top"};return[...e,u,g,A,f]},NIi=Ci.extend({fn:Z(),num_pins:xo([$e(3),$e(2)]).default(3),p:Z().default("1.27mm"),id:Z().default("0.72mm"),od:Z().default("0.95mm"),w:Z().default("2.5mm"),h:Z().default("4.2mm"),string:Z().optional()}),RIi=t=>{const{p:e,id:n,od:o,w:i,h:r}=t,s=Number.parseFloat(r)/2,a=Number.parseFloat(e);return[Os(1,-a,s-a,n,o),Os(2,0,s-a,n,o),Os(3,a,s-a,n,o)]},TIi=t=>{const{p:e,id:n,od:o,h:i}=t,r=Number.parseFloat(i)/2,s=Number.parseFloat(e),a=Number.parseFloat(n),A=Number.parseFloat(o),c=A*(1.5/1.05);return[r2({pn:1,x:-s,y:r-s,holeDiameter:a,rectPadWidth:A,rectPadHeight:c}),Q6(2,s,r-s,a,A,c)]},kIi=t=>{const e=t.string?.match(/^to92s_(\d+)/),n=e?Number.parseInt(e[1],10):3,o=NIi.parse({...t,num_pins:n});let i=[];if(o.num_pins===3)i=RIi(o);else if(o.num_pins===2)i=TIi(o);else throw new Error("Invalid number of pins for TO-92");const r=Number.parseFloat(o.h)/2,s=Number.parseFloat(o.p),a={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-r,y:r-s},{x:-1.9,y:0},{x:1.9,y:0},{x:r,y:r-s},{x:1.5,y:Number.parseFloat(o.h)/2+.5},{x:-1.5,y:Number.parseFloat(o.h)/2+.5},{x:-r,y:r-s}],stroke_width:.1,pcb_silkscreen_path_id:""},A=xi(0,r+1,.5),c=Number.parseFloat(o.od),l=r-s,u=-s-c/2,g=s+c/2,h=l-c/2,d=l+c/2,p=-r,m=r,_=0,f=r+.5,I=Math.min(u,p)-.25,C=Math.max(g,m)+.25,y=Math.min(h,_)-.25,x=Math.max(d,f)+.25,E={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:(I+C)/2,y:(y+x)/2},width:C-I,height:x-y,layer:"top"};return{circuitJson:[...i,a,A,E],parameters:o}},FIi=Ci.extend({fn:Z(),p:ce.optional(),id:ce.optional(),pw:ce.optional(),pl:ce.optional(),w:ce.optional(),h:ce.optional(),mpx:ce.optional().describe("center-to-center distance between the SMD mounting pads"),mpy:ce.optional().describe("mounting-pad row distance from the signal-pad row"),mpw:ce.optional().describe("SMD mounting pad width"),mpl:ce.optional().describe("SMD mounting pad length"),mounttop:je().optional().describe("place SMD mounting pads above the signal-pad row"),smd:je().optional().describe("Generic surface-mount JST-style connector with one signal row and two mounting pads."),sh:je().optional().describe('JST SH (Surface-mount) connector family. SH stands for "Super High-density".'),ph:je().optional().describe('JST PH (Through-hole) connector family. PH stands for "Pin Header".'),zh:je().optional().describe("JST ZH (Through-hole) connector family. 1.5mm pitch wire-to-board."),xh:je().optional().describe("JST XH (Through-hole) connector family. 2.5mm pitch wire-to-board."),string:Z().optional()}),LIi=()=>({minX:Number.POSITIVE_INFINITY,maxX:Number.NEGATIVE_INFINITY,minY:Number.POSITIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY}),mP=({bounds:t,centerX:e,centerY:n,width:o,height:i})=>{const r=o/2,s=i/2;t.minX=Math.min(t.minX,e-r),t.maxX=Math.max(t.maxX,e+r),t.minY=Math.min(t.minY,n-s),t.maxY=Math.max(t.maxY,n+s)},HIi={ph:{p:ce.parse("2mm"),id:ce.parse("0.75mm"),pw:ce.parse("1.20mm"),pl:ce.parse("1.75mm"),h:ce.parse("5mm")},sh:{p:ce.parse("1mm"),pw:ce.parse("0.6mm"),pl:ce.parse("1.55mm"),w:ce.parse("5.8mm"),h:ce.parse("7.8mm")},smd:{p:ce.parse("2mm"),id:0,pw:ce.parse("1mm"),pl:ce.parse("3mm"),mpw:ce.parse("1.8mm"),mpl:ce.parse("3mm"),mpy:ce.parse("2.5mm"),w:ce.parse("8mm"),h:ce.parse("5mm")},zh:{p:ce.parse("1.5mm"),id:ce.parse("0.73mm"),pw:ce.parse("1.03mm"),pl:ce.parse("1.73mm"),w:ce.parse("3mm"),h:ce.parse("3.5mm")},xh:{p:ce.parse("2.5mm"),pw:ce.parse("1.7mm")}};function OIi(t){return t.smd?"smd":t.sh?"sh":t.ph?"ph":t.zh?"zh":t.xh?"xh":"ph"}function GIi({variant:t,numPins:e,p:n,id:o,pw:i,pl:r,mpx:s,mpy:a,mpw:A,mpl:c,mounttop:l}){const u=[],g=LIi();let h=0;if(t==="smd"){const d=-((e-1)/2)*n;for(let m=0;m<e;m++){const _=d+m*n;u.push(Wo(m+1,_,0,i,r)),mP({bounds:g,centerX:_,centerY:0,width:i,height:r})}const p=a===0?0:(l?1:-1)*a;for(const[m,_]of[-s/2,s/2].entries())u.push(Wo(e+m+1,_,p,A,c)),mP({bounds:g,centerX:_,centerY:p,width:A,height:c});h=Math.max(r/2,c/2)}else if(t==="ph"){const d=-((e-1)/2)*n;for(let p=0;p<e;p++){const m=d+p*n;p===0?u.push(r2({pn:p+1,x:m,y:0,holeDiameter:o,rectPadWidth:i,rectPadHeight:r,rectBorderRadius:.1249998})):u.push(Q6(p+1,m,0,o,i,r)),mP({bounds:g,centerX:m,centerY:0,width:i,height:r}),h=Math.max(h,r/2)}}else if(t==="zh"){const d=-((e-1)/2)*n;for(let p=0;p<e;p++){const m=d+p*n;p===0?u.push(r2({pn:p+1,x:m,y:0,holeDiameter:o,rectPadWidth:i,rectPadHeight:r,rectBorderRadius:.12499977})):u.push(Q6(p+1,m,0,o,i,r)),mP({bounds:g,centerX:m,centerY:0,width:i,height:r}),h=Math.max(h,r/2)}}else if(t==="xh"){const d=-((e-1)/2)*n;for(let p=0;p<e;p++){const m=d+p*n;p===0?u.push(r2({pn:p+1,x:m,y:0,holeDiameter:o,rectPadWidth:i,rectPadHeight:r,rectBorderRadius:.12500015})):u.push(Q6(p+1,m,0,o,i,r)),mP({bounds:g,centerX:m,centerY:0,width:i,height:r}),h=Math.max(h,r/2)}}else{const d=-((e-1)/2)*n;for(let m=0;m<e;m++){const _=d+m*n;u.push(Wo(m+1,_,-1.325,i,r)),mP({bounds:g,centerX:_,centerY:-1.325,width:i,height:r}),h=Math.max(h,r/2)}const p=(e-1)/2*n+1.3;u.push(Wo(e+1,-p,1.22,1.2,1.8)),u.push(Wo(e+2,p,1.22,1.2,1.8)),mP({bounds:g,centerX:-p,centerY:1.22,width:1.2,height:1.8}),mP({bounds:g,centerX:p,centerY:1.22,width:1.2,height:1.8}),h=Math.max(h,.9)}return{pads:u,padBounds:g,maxPadHalfY:h}}function YIi({variant:t,w:e,h:n,numPins:o,p:i}){const r=s=>({type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:s,stroke_width:.1,pcb_silkscreen_path_id:""});if(t==="smd")return[r([{x:-e/2,y:-n/2},{x:e/2,y:-n/2},{x:e/2,y:n/2},{x:-e/2,y:n/2},{x:-e/2,y:-n/2}])];if(t==="ph"){const s=n/2+.5,a=s-n;return[r([{x:-e/2,y:s},{x:e/2,y:s},{x:e/2,y:a},{x:-e/2,y:a},{x:-e/2,y:s}])]}else if(t==="zh"&&o&&i){const s=(o-1)*i,a=-s/2-1.5,A=s/2+1.5,c=-n/2,l=n/2;return[r([{x:a,y:c},{x:A,y:c},{x:A,y:l},{x:a,y:l},{x:a,y:c}])]}else if(t==="xh"&&o&&i){const s=-((o-1)/2)*i,a=Array.from({length:o},(I,C)=>s+C*i),A=a[0],c=a[o-1],l=(A+c)/2,u=-2.75,g=-3.51,h=2.46,d=2.75,p=1.5,m=.2,_=(I,C,y,x)=>r([{x:I,y:C},{x:y,y:C},{x:y,y:x},{x:I,y:x},{x:I,y:C}]),f=[];return f.push(_(A-2.56,h,c+2.56,g)),f.push(r([{x:A-1.6,y:d},{x:A-2.85,y:d},{x:A-2.85,y:p}])),f.push(r([{x:A-2.55,y:m},{x:A-1.8,y:m},{x:A-1.8,y:u},{x:l,y:u}])),f.push(r([{x:c+2.55,y:m},{x:c+1.8,y:m},{x:c+1.8,y:u},{x:l,y:u}])),f.push(_(A-2.55,2.45,A-.75,1.7)),c-.75>A+.75&&f.push(_(A+.75,2.45,c-.75,1.7)),f.push(_(c+.75,2.45,c+2.55,1.7)),f}else return[]}var UIi=t=>{const e=FIi.parse(t),n=OIi(e),o=HIi[n];let i;const r=t.num_pins;typeof r=="number"&&(i=r);const s=typeof t.string=="string"?t.string:"",a=s.match(/(?:^|_)jst(\d+)(?:_|$)/),A=s.match(/(?:^|_)zh(\d+)(?:_|$)/);if(a&&a[1]){const fe=Number.parseInt(a[1],10);Number.isNaN(fe)||(i=fe)}if(A&&A[1]){const fe=Number.parseInt(A[1],10);Number.isNaN(fe)||(i=fe)}if(typeof i!="number")throw new Error(`JST requires an explicit pin count (e.g. jst6_sh or .jst(6))${e.string?`, from string "${e.string}"`:""}`);const c=e.p??o.p,l=e.id??(n==="xh"?i===2?1:.95:o.id),u=e.pw??o.pw,g=e.pl??(n==="xh"?i===2?2:1.95:o.pl),h=(i-1)*c+4,d=n==="xh"?(i-1)*c+5.12:n==="ph"?h:o.w,p=e.w??d,m=e.h??(n==="xh"?5.97:o.h),_=e.mpx??(i-1)*c+3.4,f=e.mpy??o.mpy??0,I=e.mpw??o.mpw??0,C=e.mpl??o.mpl??0,y=e.mounttop??!1,x=GIi({variant:n,numPins:i,p:c,id:l,pw:u,pl:g,mpx:_,mpy:f,mpw:I,mpl:C,mounttop:y}),{pads:E,padBounds:B,maxPadHalfY:S}=x,Q=n==="smd"?Math.max(p,2*Math.max(Math.abs(B.minX),Math.abs(B.maxX))+.4):p,w=n==="smd"?Math.max(m,2*Math.max(Math.abs(B.minY),Math.abs(B.maxY))+.4):m,M=YIi({variant:n,w:Q,h:w,numPins:i,p:c}),k=xi(0,w/2+1,.5),R=M.flatMap(fe=>fe.route),F=R.map(fe=>fe.x),O=R.map(fe=>fe.y),U=F.length>0&&O.length>0,Y=U?Math.min(B.minX,Math.min(...F)):B.minX,W=U?Math.max(B.maxX,Math.max(...F)):B.maxX,te=U?Math.min(B.minY,Math.min(...O)):B.minY,j=U?Math.max(B.maxY,Math.max(...O)):B.maxY,J=.5,oe=.05,ie=S+.085,ne=Y-J,le=W+J,ge=te-ie,_e=j+oe,ue=n==="ph"?{type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:-.55},width:(i-1)*c+4.9,height:5.5,layer:"top"}:n==="xh"?{type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:-.525},width:(i-1)*c+5.9,height:6.75,layer:"top"}:{type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:(ne+le)/2,y:(ge+_e)/2},width:le-ne,height:_e-ge,layer:"top"};return{circuitJson:[...E,...M,k,ue],parameters:{...e,p:c,id:l,pw:u,pl:g,w:p,h:m,num_pins:i,sh:n==="sh",ph:n==="ph",smd:n==="smd",zh:n==="zh",xh:n==="xh",...n==="smd"?{mpx:_,mpy:f,mpw:I,mpl:C,mounttop:y}:{}}}},KIi=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("3.30mm"),h:Z().default("1.70mm"),pl:Z().default("0.80mm"),pw:Z().default("1mm"),p:Z().default("1.90mm")}),VIi=t=>{const e=KIi.parse(t),n=xi(0,ce.parse(e.h)/2+.5,.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2,y:-ce.parse(e.h)/2},{x:ce.parse(e.p)/2,y:-ce.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:3.2,height:2,layer:"top"};return{circuitJson:JIi(e).concat(...uh(e),o,n,s),parameters:e}},zIi=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},JIi=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=zIi({pn:n,p:Number.parseFloat(t.p)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw),.1))}return e},WIi=t=>{switch(t){case 8:return{w:"3.06mm",h:"3.14mm",p:"0.65mm",pl:"1.6mm",pw:"0.5mm"};case 10:return{w:"3.10mm",h:"3.33mm",p:"0.5mm",pl:"1.45mm",pw:"0.3mm"};default:return{w:"3.06mm",h:"3.14mm",p:"0.65mm",pl:"1.6mm",pw:"0.5mm"}}},jIi=Ci.extend({fn:Z(),num_pins:xo([$e(8),$e(10)]).default(8),w:Z().optional(),h:Z().optional(),p:Z().optional(),pl:Z().optional(),pw:Z().optional(),thermalpad:WB.optional(),...RY,string:Z().optional()}),$Ii=t=>{const e=jIi.parse(t),n=WIi(e.num_pins),o=ce.parse(e.w||n.w),i=ce.parse(e.h||n.h),r=ce.parse(e.p||n.p),s=ce.parse(e.pl||n.pl),a=ce.parse(e.pw||n.pw),A=Math.min(s,a)/8,c=[],l=e.num_pins/2;for(let S=0;S<e.num_pins;S++){const{x:Q,y:w}=ssn(e.num_pins,S+1,o,r),M=S<l?S+1:e.num_pins-(S-l);c.push(Wo(M,Q,w,s,a,A))}e.thermalpad&&c.push(hP(e.thermalpad,{x:e.thermalpadcenteroffsetx,y:e.thermalpadcenteroffsety}));const u=o,g=i,h={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-u/2,y:g/2},{x:u/2,y:g/2}],stroke_width:.05,pcb_silkscreen_path_id:""},d={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-u/2,y:-g/2},{x:u/2,y:-g/2}],stroke_width:.05,pcb_silkscreen_path_id:""},p=ssn(e.num_pins,1,u,r),m={x:p.x-.8,y:p.y},_={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:m.x-.4,y:m.y},{x:m.x-.7,y:m.y+.3},{x:m.x-.7,y:m.y-.3},{x:m.x-.4,y:m.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},f=xi(0,g/2+.5,.3),I=(e.num_pins/2-1)*r+a,C=o/2+.25,y=C+1.43,x=I/2+.255,E=i/2+.25,B={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",layer:"top",outline:s2([{minX:-y,maxX:y,minY:-x,maxY:x},{minX:-C,maxX:C,minY:-E,maxY:E}])};return{circuitJson:[...c,h,d,f,_,B],parameters:e}},ssn=(t,e,n,o)=>{const i=t/2,r=(e-1)%i,s=e<=i?-1:1,a=(i-1)/2-r;return{x:s*2.11,y:a*o}},qIi=t=>{switch(t){case 10:return{w:"3.10mm",h:"3.32mm",p:"0.5mm",pl:"1.63mm",pw:"0.33mm"};case 12:return{w:"3mm",h:"4mm",p:"0.65mm",pl:"0.88mm",pw:"0.4mm"};case 16:return{w:"3.10mm",h:"4mm",p:"0.5mm",pl:"0.88mm",pw:"0.3mm"};default:return{w:"3.10mm",h:"3.32mm",p:"0.65mm",pl:"1.63mm",pw:"0.4mm"}}},XIi=Ci.extend({fn:Z(),num_pins:xo([$e(8),$e(10),$e(12),$e(16)]).default(8),w:Z().optional(),h:Z().optional(),p:Z().optional(),pl:Z().optional(),pw:Z().optional(),thermalpad:WB.optional(),...RY,string:Z().optional()}),asn=(t,e,n,o,i)=>{const r=t/2,s=(e-1)%r,a=e<=r?-1:1,A=(r-1)/2-s,c=ce.parse("0.2mm");return{x:a*(n/2+i/2-c),y:A*o}},ZIi=t=>{const e=XIi.parse(t),n=qIi(e.num_pins),o=ce.parse(e.w||n.w),i=ce.parse(e.h||n.h),r=ce.parse(e.p||n.p),s=ce.parse(e.pl||n.pl),a=ce.parse(e.pw||n.pw),A=Math.min(s,a)/8,c=[];for(let B=0;B<e.num_pins;B++){const{x:S,y:Q}=asn(e.num_pins,B+1,o,r,s);c.push(Wo(B+1,S,Q,s,a,A))}e.thermalpad&&c.push(hP(e.thermalpad,{x:e.thermalpadcenteroffsetx,y:e.thermalpadcenteroffsety}));const l=o,u=i,g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-l/2,y:u/2},{x:l/2,y:u/2}],stroke_width:.05,pcb_silkscreen_path_id:""},h={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-l/2,y:-u/2},{x:l/2,y:-u/2}],stroke_width:.05,pcb_silkscreen_path_id:""},d=asn(e.num_pins,1,l,r,s),p={x:d.x-.8,y:d.y},m={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:p.x-.4,y:p.y},{x:p.x-.7,y:p.y+.3},{x:p.x-.7,y:p.y-.3},{x:p.x-.4,y:p.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},_=xi(0,u/2+.5,.3),f=(e.num_pins/2-1)*r+a,I=o/2+.25,C=I+1.43,y=f/2+.255,x=i/2+.25,E={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",layer:"top",outline:s2([{minX:-C,maxX:C,minY:-y,maxY:y},{minX:-I,maxX:I,minY:-x,maxY:x}])};return{circuitJson:[...c,g,h,_,m,E],parameters:e}},eCi=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("3.8mm"),h:Z().default("1.65mm"),pl:Z().default("1.2mm"),pw:Z().default("1.2mm"),pad_spacing:Z().default("2.6mm")}),tCi=t=>{const e=eCi.parse(t),n=xi(0,ce.parse(e.h),.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.pad_spacing)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.2,y:-ce.parse(e.h)/2},{x:ce.parse(e.pad_spacing)/2,y:-ce.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:4.3,height:2.15,layer:"top"};return{circuitJson:oCi(e).concat(...uh(e),o,n,s),parameters:e}},nCi=t=>{const{pn:e,pad_spacing:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},oCi=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=nCi({pn:n,pad_spacing:Number.parseFloat(t.pad_spacing)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return e},iCi=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("3.20mm"),h:Z().default("1.65mm"),pl:Z().default("0.8mm"),pw:Z().default("0.9mm"),pad_spacing:Z().default("2.1mm")}),rCi=t=>{const e=iCi.parse(t),n=xi(0,ce.parse(e.h),.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.pad_spacing)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.2,y:-ce.parse(e.h)/2},{x:ce.parse(e.pad_spacing)/2,y:-ce.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:3.7,height:2.15,layer:"top"};return{circuitJson:aCi(e).concat(...uh(e),o,n,s),parameters:e}},sCi=t=>{const{pn:e,pad_spacing:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},aCi=t=>{const e=[];for(let n=1;n<=t.num_pins;n++){const{x:o,y:i}=sCi({pn:n,pad_spacing:Number.parseFloat(t.pad_spacing)});e.push(Wo(n,o,i,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return e},ACi=Ci.extend({fn:Z(),num_pins:xo([$e(6),$e(8)]).default(8),w:Z().default("3mm"),h:Z().default("3mm"),p:Z().default("0.5mm"),pl:Z().default("0.52mm"),pw:Z().default("0.35mm"),epw:Z().default("1.40mm"),eph:Z().default("1.60mm"),string:Z().optional(),ep:je().default(!1)}),cCi=t=>{t.string&&t.string.includes("_ep")&&(t.ep=!0);const e=t.string?.match(/^son_(\d+)/),n=e?Number.parseInt(e[1],10):t.num_pins||8,o=ACi.parse({...t,num_pins:n}),i=ce.parse(o.w),r=ce.parse(o.h),s=ce.parse(o.p),a=ce.parse(o.pl),A=ce.parse(o.pw),c=ce.parse(o.epw),l=ce.parse(o.eph),u=Math.min(a,A)/8,g=[];for(let k=0;k<o.num_pins;k++){const{x:R,y:F}=WVe(o.num_pins,k+1,i,s);g.push(Wo(k+1,R,F,a,A,u))}o.ep&&g.push(Wo(o.num_pins+1,0,0,c,l));const h=i,d=r,p={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-h/2,y:d/2},{x:h/2,y:d/2}],stroke_width:.05,pcb_silkscreen_path_id:""},m={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-h/2,y:-d/2},{x:h/2,y:-d/2}],stroke_width:.05,pcb_silkscreen_path_id:""},_=WVe(o.num_pins,1,h,s),f={x:_.x-.4,y:_.y},I={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:f.x-.4,y:f.y},{x:f.x-.7,y:f.y+.3},{x:f.x-.7,y:f.y-.3},{x:f.x-.4,y:f.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},C=xi(0,d/2+.5,.3),y=Math.abs(WVe(o.num_pins,1,i,s).x),x=(o.num_pins/2-1)*s+A,E=y*2+a,B=i/2+.25,S=E/2+.25,Q=x/2+.25,w=r/2+.25,M={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",layer:"top",outline:s2([{minX:-S,maxX:S,minY:-Q,maxY:Q},{minX:-B,maxX:B,minY:-w,maxY:w}])};return{circuitJson:[...g,p,m,C,I,M],parameters:o}},WVe=(t,e,n,o)=>{const i=t/2,r=(e-1)%i,s=e<=i?-1:1,a=(i-1)/2-r;return{x:s*ce.parse("1.4mm"),y:a*o}},lCi=Ci.extend({fn:Z(),num_pins:_t().optional().default(8),p:lt.describe("pitch (distance between center of each pin)"),w:ce.describe("width between vertical rows of pins"),grid:WB.describe("width and height of the border of the footprint"),ep:WB.default("0x0mm").describe("width and height of the central exposed thermal pad"),epx:ce.default("0mm").describe("x offset of the center of the central exposed thermal pad"),pinw:ce.describe("width of the pin pads"),pinh:ce.describe("height of the pin pads")}),uCi=t=>{const e=lCi.parse(t),{num_pins:n,p:o,w:i,grid:r,ep:s,epx:a,pinw:A,pinh:c}=e;if(n%2!==0)throw new Error("invalid number of pins");const l=[],u=Math.min(A,c)/8;for(let B=0;B<n;B++){const{pinX:S,pinY:Q}=gCi({pinCount:n,pinIndex:B,width:i,pitch:o});l.push(Wo(B+1,S,Q,A,c,u))}s.x>0&&s.y>0&&l.push(Wo(e.num_pins+1,a,0,s.x,s.y));const g=dCi(r),h=xi(0,r.y/2+o,r.y/6),d=(n/2-1)*o+c,p=i+A,m=r.x/2+.25,_=p/2+.25,f=d/2+.25,I=d/2+.45+Math.max(0,.8-o),C=Math.min(r.y/2+.25,I),y=Math.max(0,.37-Math.max(0,_-m-.38)*1.4),x=Math.max(f,C-y),E={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",layer:"top",outline:s2([{minX:-_,maxX:_,minY:-x,maxY:x},{minX:-m,maxX:m,minY:-C,maxY:C}])};return{circuitJson:[...l,...g,h,E],parameters:e}},gCi=t=>{let e=0,n=0;const o=(t.pinCount/2-1)*t.pitch/2,i=t.pinCount/2;return t.pinIndex+1<=i?(e=t.pitch*t.pinIndex-o,n=0-t.width/2):(e=t.pitch*(t.pinCount-t.pinIndex-1)-o,n=t.width/2),{pinX:n,pinY:e}},dCi=t=>{const n=t.y/30;return[{layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:-t.x/2-.1,y:t.y/2+.1-n},{x:-t.x/2-.1,y:t.y/2+.1},{x:t.x/2+.1,y:t.y/2+.1},{x:t.x/2+.1,y:t.y/2+.1-n}],stroke_width:t.y/30},{layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:-t.x/2-.1,y:-t.y/2-.1+n},{x:-t.x/2-.1,y:-t.y/2-.1},{x:t.x/2+.1,y:-t.y/2-.1},{x:t.x/2+.1,y:-t.y/2-.1+n}],stroke_width:t.y/30}]},hCi=Ci.extend({fn:$e("wson"),num_pins:$e(8).default(8),p:ce.default("0.5mm").describe("pin pitch"),rowspan:ce.default("3.015mm").describe("distance between pad rows"),pl:ce.default("0.6mm").describe("pad length across the package edge"),pw:ce.default("0.28mm").describe("pad width along the pin row"),ep:je().default(!0).describe("include the exposed pad"),epw:ce.default("1.7mm").describe("exposed pad width"),eph:ce.default("0.3mm").describe("exposed pad height"),w:ce.default("2mm").describe("package body width"),h:ce.default("3mm").describe("package body height")}),pCi=t=>{const e=hCi.parse(t),{p:n,rowspan:o,pl:i,pw:r,ep:s,epw:a,eph:A,w:c,h:l}=e,u=[],g=-3*n/2;for(let f=0;f<4;f+=1){const I=g+f*n;u.push(Wo(f+1,I,-o/2,r,i)),u.push(Wo(8-f,I,o/2,r,i))}s&&u.push(Wo(9,0,0,a,A));const h=[sA([{x:-c/2,y:-l/2},{x:-c/2,y:l/2}]),sA([{x:c/2,y:-l/2},{x:c/2,y:l/2}])],d=xi(0,Math.max(l/2,(o+i)/2)+.6,.5),p=Math.max(3*n+r,s?a:0),m=Math.max(o+i,s?A:0),_={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:Math.max(c,p)+.5,height:Math.max(l,m)+.5,layer:"top"};return{circuitJson:[...u,...h,d,_],parameters:e}},mCi=t=>{const{num_pins:e,bridged:n,p:o=2.54,pw:i=1.5,ph:r=1.5}=t,s=ce.parse(o),a=ce.parse(i),A=ce.parse(r),c=Math.min(A/4,.5),l=[];for(let Q=0;Q<e;Q++)l.push(Wo(Q+1,Q*s,0,a,A));let u=[];if(n){const Q=n.split("").map(Number);if(Q.length>1)for(let w=0;w<Q.length-1;w++){const M=Q[w],k=Q[w+1];if(typeof M=="number"&&typeof k=="number"&&!isNaN(M)&&!isNaN(k)){const R=(M-1)*s,F=(k-1)*s,O=Math.sign(F-R),U=R+O*(a/2),Y=F-O*(a/2);u.push({type:"pcb_trace",pcb_trace_id:"",route:[{start_pcb_port_id:`{PIN${M}}`,x:U,y:0,width:c,layer:"top",route_type:"wire"},{end_pcb_port_id:`{PIN${k}}`,x:Y,y:0,width:c,layer:"top",route_type:"wire"}]})}}}const g=(e-1)*s+a+.7,h=A+1,d=(e-1)*s/2,p=0,m={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"outline",route:[{x:d-g/2,y:p-h/2},{x:d+g/2,y:p-h/2},{x:d+g/2,y:p+h/2},{x:d-g/2,y:p+h/2},{x:d-g/2,y:p-h/2}],stroke_width:.15},f=p+h/2+.6,I=xi(d,f,.4),C=(e-1)*s,y=C/2+a/2,x=A/2,E=y+.5,B=x+.5,S={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:C/2,y:0},width:2*E,height:2*B,layer:"top"};return{circuitJson:[...l,...u,m,I,S],parameters:t}},Asn={fn:$e("sot457"),num_pins:$e(6).default(6),pillh:Z().default("0.45mm"),pillw:Z().default("1.45mm"),pl:Z(),pw:Z(),p:Z(),wave:je().optional(),reflow:je().optional()},_Ci=Ci.extend({...Asn,h:Z().default("2.5mm"),w:Z().default("2.7mm"),pl:Z().default("0.8mm"),pw:Z().default("0.55mm"),p:Z().default("0.95mm")}),fCi=Ci.extend({...Asn,h:Z().default("3mm"),w:Z().default("4mm"),pillr:Z().default("0.225mm"),pl:Z().default("1.45mm"),pw:Z().default("1.5mm"),p:Z().default("1.475mm")}).transform(t=>({...t,wave:t.wave??(t.reflow===void 0?!0:!t.reflow),reflow:t.reflow??(t.wave===void 0?!1:!t.wave)})),lS=t=>Number.parseFloat(t.replace("mm","")),csn=({pitch:t,width:e,pinNumber:n})=>{const r={1:{x:-e/2-.1,y:t},2:{x:-e/2-.1,y:0},3:{x:-e/2-.1,y:-t},4:{x:e/2+.1,y:-t},5:{x:e/2+.1,y:0},6:{x:e/2+.1,y:t}}[n];if(!r)throw new Error(`Invalid pin number: ${n}`);return r},lsn=t=>{const e=[],n=lS(t.p),o=lS(t.pl),i=lS(t.pw),r=lS(t.w),s=lS(t.h),a=Math.min(o,i)/8;if(t.wave){const m={1:({padWidth:_,padHeight:f})=>Wo(1,-n,n,f,_,a),2:({padWidth:_,padHeight:f})=>Wo(2,-n,-n,f,_,a),3:({padWidth:_,padHeight:f})=>cT(3,-n,0,lS(t.pillw),lS(t.pillh)),4:({padWidth:_,padHeight:f})=>cT(4,n,0,lS(t.pillw),lS(t.pillh)),5:({padWidth:_,padHeight:f})=>Wo(5,n,n,f,_,a),6:({padWidth:_,padHeight:f})=>Wo(6,n,-n,f,_,a)};for(let _=1;_<=t.num_pins;_++){const f=m[_];f&&e.push(f({padWidth:o,padHeight:i}))}}else for(let m=1;m<=t.num_pins;m++){const{x:_,y:f}=csn({pitch:n,width:r,pinNumber:m});e.push(Wo(m,_,f,o,i,a))}const A={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-r/3,y:s/2+n/1.3},{x:r/3,y:s/2+n/1.3}],stroke_width:.05},c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-r/3,y:-s/2-n/1.3},{x:r/3,y:-s/2-n/1.3}],stroke_width:.05},l=xi(0,s+.5,.3),u=csn({pitch:n,width:r,pinNumber:1}),g=t.wave?1:.5,h=t.wave?.7:.3;u.x-=t.wave?i:i*1.7;const d={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:u.x+g/2,y:u.y},{x:u.x-g/2,y:u.y+h/2},{x:u.x-g/2,y:u.y-h/2},{x:u.x+g/2,y:u.y}],stroke_width:.05};let p;if(t.wave){const m=2*n,_=2*n,f=m/2+i/2,I=_/2+o/2,C=f+.25,y=I+.25;p={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:2*C,height:2*y,layer:"top"}}else{const _=r/2+.1+o/2,f=n+i/2,I=r/2,C=s/2,y=_+.25,x=I+.08,E=f+.25,B=Math.max(C+.45,E);p={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:s2([{minX:-y,maxX:y,minY:-E,maxY:E},{minX:-x,maxX:x,minY:-B,maxY:B}]),layer:"top"}}return[l,A,c,d,...e,p]},ICi=t=>{if(t.wave){const n=fCi.parse({...t,fn:"sot457"});return{circuitJson:lsn(n),parameters:n}}const e=_Ci.parse(t);return{circuitJson:lsn(e),parameters:e}},CCi=[{x:-.8,y:.75},{x:.8,y:.75},{x:.8,y:-.75},{x:-.8,y:-.75}],yCi=Ci.extend({fn:Z(),num_pins:$e(6).default(6),w:Z().default("1.1mm"),h:Z().default("1.45mm"),p:Z().default("0.35mm"),pl:Z().default("0.2mm"),pw:Z().default("0.2mm"),string:Z().optional()}),xCi=t=>{const e=yCi.parse({...t,fn:"sot963"}),n=ce.parse(e.w),o=ce.parse(e.h),i=ce.parse(e.p),r=ce.parse(e.pl),s=ce.parse(e.pw),a=Math.min(r,s)/8,A=[];for(let p=0;p<6;p++){const{x:m,y:_}=usn(p+1,n,i,r);A.push(Wo(p+1,m,_,r,s,a))}const c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-n/2,y:o/2},{x:n/2,y:o/2}],stroke_width:.05,pcb_silkscreen_path_id:""},l={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-n/2,y:-o/2},{x:n/2,y:-o/2}],stroke_width:.05,pcb_silkscreen_path_id:""},u=usn(1,n,i,r),g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:u.x-r/2-.3,y:u.y},{x:u.x-r/2-.45,y:u.y+.15},{x:u.x-r/2-.45,y:u.y-.15},{x:u.x-r/2-.3,y:u.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},h=xi(0,o/2+.4,.25),d={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:CCi,layer:"top"};return{circuitJson:[...A,c,l,h,g,d],parameters:e}},usn=(t,e,n,o)=>{const i=e/2-o/2;return t<=3?{x:-i,y:n-(t-1)*n}:{x:i,y:-n+(t-4)*n}},ECi=Ci.extend({fn:Z(),num_pins:xo([$e(3),$e(2)]).default(3),p:Z().default("5mm"),id:Z().default("1.25mm"),od:Z().default("2.35mm"),ca:Z().default("14mm").describe("Caliper axis (width or diameter of the potentiometer body or adjustment knob)"),w:Z().default("5.35mm"),h:Z().default("4mm"),string:Z().optional()}),BCi=t=>{const{p:e,id:n,od:o,h:i}=t,r=Number.parseFloat(i),s=Number.parseFloat(e);return[Os(1,0,s,n,o),Os(2,r,0,n,o),Os(3,0,-s,n,o)]},bCi=t=>{const e=t.string?.match(/^potentiometer_(\d+)/),n=e?Number.parseInt(e[1],10):3,o=ECi.parse({...t,num_pins:n});let i=[];o.num_pins===3&&(i=BCi(o));const r=Number.parseFloat(o.ca)/2+.15,s=Number.parseFloat(o.w),a=Number.parseFloat(o.od)/2+.35,A={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:0,y:r-1.75},{x:0,y:r},{x:s,y:r},{x:s,y:a}],stroke_width:.1,pcb_silkscreen_path_id:""},c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:s,y:-a},{x:s,y:-r},{x:0,y:-r},{x:0,y:-r+1.75}],stroke_width:.1,pcb_silkscreen_path_id:""},l=Number.parseFloat(o.w)/2,u=xi(l,r+1,.5),g=Number.parseFloat(o.od)/2,h=Number.parseFloat(o.h),d=Number.parseFloat(o.ca)/2,p=-(g+.25),m=h+g+.25,_=d+.25,f={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:(p+m)/2,y:0},width:m-p,height:2*_,layer:"top"};return{circuitJson:[...i,A,c,u,f],parameters:o}},SCi=Ci.extend({fn:Z(),p:ce.optional().default("7.5mm"),id:ce.optional().default("1mm"),od:ce.optional().default("2mm"),d:ce.optional().default("10.5mm")}),QCi=(t,e,n,o,i)=>{const r=[],s=[];for(let a=0;a<=50;a++){const A=a/50*Math.PI,c=t+Math.cos(A)*n,l=e+Math.sin(A)*n;c<t-o&&l>=e-i/2&&l<=e+i/2||r.push({x:c,y:l})}for(let a=0;a<=50;a++){const A=Math.PI+a/50*Math.PI,c=t+Math.cos(A)*n,l=e+Math.sin(A)*n;c<t-o&&l>=e-i/2&&l<=e+i/2||s.push({x:c,y:l})}return{topArc:r,bottomArc:s}},vCi=t=>{const e=SCi.parse(t),{p:n,id:o,od:i,d:r}=e,s=[r2({pn:1,x:-n/2,y:0,holeDiameter:o,rectPadWidth:i,rectPadHeight:i}),Os(2,n/2,0,o,i)],{topArc:a,bottomArc:A}=QCi(0,0,r/2+.1,i/2,i),c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:a,stroke_width:.1,pcb_silkscreen_path_id:""},l={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:A,stroke_width:.1,pcb_silkscreen_path_id:""},u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:0,y:r/2+.1},{x:0,y:-(r/2+.1)}],stroke_width:.1,pcb_silkscreen_path_id:""},g=-(r/2+.5),h=i/2+1.5,d=.5,p={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:g-d,y:h},{x:g+d,y:h}],stroke_width:.1,pcb_silkscreen_path_id:""},m={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:g,y:h-d},{x:g,y:h+d}],stroke_width:.1,pcb_silkscreen_path_id:""},_=xi(0,r/2+1,.5),f=r/2,I=n/2+i/2,y=Math.max(f,I)+.25,x={type:"pcb_courtyard_circle",pcb_courtyard_circle_id:"",pcb_component_id:"",center:{x:0,y:0},radius:y,layer:"top"};return{circuitJson:[...s,c,l,u,p,m,_,x],parameters:e}},wCi=Ci.extend({fn:$e("fpc"),num_pins:S5.number().int().min(2),p:ce.default("0.5mm").describe("contact pad pitch"),pw:ce.default("0.3mm").describe("contact pad width"),pl:ce.default("1.25mm").describe("contact pad length"),staggered:je().default(!1).describe("alternate contacts between two rows"),reverse:je().default(!1).describe("place pin 1 on the upper row when staggered"),py:ce.default("2.4mm").describe("staggered row center pitch"),toppl:ce.optional().describe("upper-row contact pad length"),bottompl:ce.optional().describe("lower-row contact pad length"),mpx:ce.optional().describe("mounting pad center pitch"),mpy:ce.optional().describe("mounting pad row distance from the contact-row center"),mounttop:je().default(!1).describe("place the mounting pads above the contact-row center"),mpw:ce.default("2mm").describe("mounting pad width"),mpl:ce.default("2.5mm").describe("mounting pad length")}),jVe=(...t)=>Wo(...t),PCi=t=>({maxX:Math.max(...t.map(e=>e.x+e.width/2)),maxY:Math.max(...t.map(e=>e.y+e.height/2)),minX:Math.min(...t.map(e=>e.x-e.width/2)),minY:Math.min(...t.map(e=>e.y-e.height/2))}),MCi=t=>{const e=wCi.parse(t),{num_pins:n,p:o,pw:i,pl:r,staggered:s,reverse:a,py:A,toppl:c,bottompl:l,mounttop:u,mpw:g,mpl:h}=e,d=(n-1)*o,p=e.mpx??d+(s?3.5:3.38),m=e.mpy??(s?0:2.575),_=m===0?0:(u?1:-1)*m,f=-d/2,I=Array.from({length:n},(O,U)=>{const Y=s&&U%2===1!==a,W=s?Y?A/2:-A/2:0,te=Y?c??r:l??r;return jVe(U+1,f+U*o,W,i,te)}),C=[jVe(n+1,p/2,_,g,h),jVe(n+2,-p/2,_,g,h)],y=[...I,...C],x=PCi(y),E=Math.min(d/2+i/2,p/2-g/2),B=x.maxY+.2,S=x.minY-.2,Q=I[0],w=Q.x-Q.width/2-.2,M=Q.y,k=[sA([{x:-E,y:B},{x:E,y:B}]),sA([{x:-E,y:S},{x:E,y:S}]),sA([{x:w-.25,y:M-.25},{x:w,y:M},{x:w-.25,y:M+.25}])],R=xi(0,B+.7,.5),F={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:(x.minX+x.maxX)/2,y:(x.minY+x.maxY)/2},width:x.maxX-x.minX+.5,height:x.maxY-x.minY+.5,layer:"top"};return{circuitJson:[...y,...k,R,F],parameters:{...e,mpx:p,mpy:m,toppl:c??r,bottompl:l??r}}},DCi=Ci.extend({fn:Z(),num_pins:$e(2).default(2),w:Z().default("6.5mm"),h:Z().default("3mm"),pl:Z().default("1.75mm"),pw:Z().default("2.40mm"),p:Z().default("4.75mm")}),NCi=t=>{const e=DCi.parse(t),n=xi(0,ce.parse(e.h)-.5,.3),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:ce.parse(e.p)/2,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.3,y:ce.parse(e.h)/2},{x:-ce.parse(e.w)/2-.3,y:-ce.parse(e.h)/2},{x:ce.parse(e.p)/2,y:-ce.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""},s={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:7,height:3.5,layer:"top"};return{circuitJson:TCi(e).concat(...uh(e),o,n,s),parameters:e}},RCi=t=>{const{pn:e,p:n}=t;return e===1?{x:-n/2,y:0}:{x:n/2,y:0}},TCi=t=>{const e=[],n=ce.parse(t.p),o=ce.parse(t.pl),i=ce.parse(t.pw),r=.125;for(let s=1;s<=t.num_pins;s++){const{x:a,y:A}=RCi({pn:s,p:n});e.push(Wo(s,a,A,o,i,r))}return e},kCi=[{x:-1.45,y:.98},{x:-.73,y:.98},{x:-.73,y:1.1},{x:.73,y:1.1},{x:.73,y:.33},{x:1.45,y:.33},{x:1.45,y:-.33},{x:.73,y:-.33},{x:.73,y:-1.1},{x:-.73,y:-1.1},{x:-.73,y:-.98},{x:-1.45,y:-.98},{x:-1.45,y:-.32},{x:-.73,y:-.32},{x:-.73,y:.32},{x:-1.45,y:.32}],FCi=Ci.extend({fn:Z(),num_pins:_t().default(3),w:Z().default("2.45mm"),h:Z().default("2.40mm"),pl:Z().default("0.92mm"),pw:Z().default("0.45mm"),p:Z().default("0.891mm"),string:Z().optional()}),LCi=t=>{const e=t.string?.match(/^sot323_(\d+)/),n=e?Number.parseInt(e[1],3):3,o=FCi.parse({...t,num_pins:n});if(o.num_pins===3)return{circuitJson:OCi(o),parameters:o};throw new Error("Invalid number of pins")},HCi=t=>{const{pn:e,p:n}=t;return e===1?{x:-n,y:.65}:e===2?{x:-n,y:-.65}:{x:n,y:0}},OCi=t=>{const e=[],n=Number.parseFloat(t.w),o=Number.parseFloat(t.h),i=Number.parseFloat(t.pl),r=Number.parseFloat(t.pw),s=Number.parseFloat(t.p),a=Math.min(i,r)/8;for(let d=0;d<t.num_pins;d++){const{x:p,y:m}=HCi({num_pins:t.num_pins,pn:d+1,p:s});e.push(Wo(d+1,p,m,i,r,a))}const A=xi(0,Number.parseInt(t.h)/2+1,.3),c=n/2-i,l=o/2,u={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-c,y:l+.3},{x:c,y:l+.3},{x:c,y:l/2}],type:"pcb_silkscreen_path",stroke_width:.1},g={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-c,y:-l-.3},{x:c,y:-l-.3},{x:c,y:-l/2}],type:"pcb_silkscreen_path",stroke_width:.1},h={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:kCi,layer:"top"};return[...e,u,g,A,h]},GCi=Ci.extend({fn:Z(),circle:je().optional(),rect:je().optional(),square:je().optional(),pill:je().optional(),d:ce.optional(),pd:ce.optional(),diameter:ce.optional(),r:ce.optional(),pr:ce.optional(),radius:ce.optional(),w:ce.optional(),pw:ce.optional(),width:ce.optional(),h:ce.optional(),ph:ce.optional(),height:ce.optional(),s:ce.optional(),size:ce.optional(),string:Z().optional()}).transform(t=>{let e="rect";t.circle&&(e="circle"),t.square&&(e="square"),t.rect&&(e="rect"),t.pill&&(e="pill");let n,o,i;return e==="circle"?t.r!==void 0?n=Ua(t.r):t.pr!==void 0?n=Ua(t.pr):t.radius!==void 0?n=Ua(t.radius):t.d!==void 0?n=Ua(t.d)/2:t.pd!==void 0?n=Ua(t.pd)/2:t.diameter!==void 0?n=Ua(t.diameter)/2:n=Ua("1mm")/2:(t.w!==void 0?o=Ua(t.w):t.pw!==void 0?o=Ua(t.pw):t.width!==void 0?o=Ua(t.width):t.s!==void 0?o=Ua(t.s):t.size!==void 0?o=Ua(t.size):o=Ua("1mm"),t.h!==void 0?i=Ua(t.h):t.ph!==void 0?i=Ua(t.ph):t.height!==void 0?i=Ua(t.height):e==="square"||e==="rect"?i=o:i=Ua("1mm")),{fn:t.fn,shape:e,radius:n,width:o,height:i}}),YCi=t=>{const e=GCi.parse(t),{shape:n,radius:o,width:i,height:r}=e;let s,a;return n==="circle"?(s=Orn(1,{x:0,y:0,radius:o}),a=o+.5):n==="pill"?(s=cT(1,0,0,i,r),a=Math.max(i,r)/2+.5):(s=Wo(1,0,0,i,r),a=r/2+.5),{circuitJson:[s,xi(0,a,.2)],parameters:e}},UCi=Ci.extend({fn:$e("smdpads"),num_pins:_t().int().positive().default(3),p:ce.default("1mm").describe("pad center pitch"),pw:ce.default("1mm").describe("outer pad width"),ph:ce.default("1mm").describe("pad height"),cyw:ce.optional().describe("courtyard width"),cyh:ce.optional().describe("courtyard height"),centerpadwidth:ce.optional().describe("center pad width")}).superRefine((t,e)=>{t.centerpadwidth!==void 0&&t.num_pins%2===0&&e.addIssue({code:lo.custom,message:"'centerpadwidth' requires an odd number of SMD pads",path:["centerpadwidth"]})}),KCi=t=>{const e=UCi.parse(t),{num_pins:n,p:o,pw:i,ph:r,cyw:s,cyh:a,centerpadwidth:A}=e,c=Math.ceil(n/2),l=-((n-1)*o)/2,u=Array.from({length:n},(_,f)=>{const I=f+1,C=A!==void 0&&I===c?A:i;return Wo(I,l+f*o,0,C,r)}),g=(n-1)*o/2+i/2,h=A?A/2:0,d=Math.max(g,h),p=s!==void 0&&a!==void 0?{width:s,height:a}:{width:d*2+.5,height:r+.5},m={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:p.width,height:p.height,layer:"top"};return{circuitJson:[...u,xi(0,r/2+.8,.4),m],parameters:e}},VCi=Ci.extend({fn:$e("smdpushbutton"),num_pins:$e(4).default(4),px:ce.default("4.2mm").describe("horizontal pad center pitch"),py:ce.default("2.15mm").describe("vertical pad center pitch"),pw:ce.default("1.05mm").describe("pad width"),ph:ce.default("0.7mm").describe("pad height")}),zCi=t=>{const e=VCi.parse(t),{px:n,py:o,pw:i,ph:r}=e,s=[Wo(1,-n/2,o/2,i,r),Wo(2,n/2,o/2,i,r),Wo(3,-n/2,-o/2,i,r),Wo(4,n/2,-o/2,i,r)],a=Math.max(n/2-i/2-.15,.2),A=o/2+r/2+.1,c=Math.max(o/2-r/2-.15,.2),l=[sA([{x:-a,y:A},{x:a,y:A}]),sA([{x:-a,y:-A},{x:a,y:-A}]),sA([{x:-n/2,y:-c},{x:-n/2,y:c}]),sA([{x:n/2,y:-c},{x:n/2,y:c}])],u=xi(0,A+.6,.5),g={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:n+i+.5,height:o+r+.5,layer:"top"};return{circuitJson:[...s,...l,u,g],parameters:e}},JCi=t=>({x:(t.minX+t.maxX)/2,y:(t.minY+t.maxY)/2}),WCi=t=>{if(t.length===0)return null;let e=t[0].x,n=t[0].y,o=t[0].x,i=t[0].y;for(let r=1;r<t.length;r++){const s=t[r];s.x<e&&(e=s.x),s.y<n&&(n=s.y),s.x>o&&(o=s.x),s.y>i&&(i=s.y)}return{minX:e,minY:n,maxX:o,maxY:i}},jCi=Ci.extend({fn:$e("smdslideswitch"),num_pins:$e(7).default(7),signalcols:S5.number().int().min(3).default(3),missing:FX.default([]),p:ce.default("1mm").describe("signal-pad column pitch"),pw:ce.default("0.7mm").describe("signal-pad width"),pl:ce.default("1.5mm").describe("signal-pad length"),mounty:ce.default("-1.8mm").describe("Y position of the mounting-pad row center"),mpx:ce.default("5.5mm").describe("horizontal center-to-center mounting-pad distance"),mpy:ce.default("2.2mm").describe("vertical center-to-center mounting-pad distance"),mpw:ce.default("1mm").describe("mounting-pad width"),mpl:ce.default("0.8mm").describe("mounting-pad length"),holex:ce.default("1.5mm").describe("alignment-hole X distance from the footprint center"),holey:ce.optional().describe("alignment-hole Y position; defaults to mounty"),holed:ce.default("0.9mm").describe("alignment-hole diameter"),noholes:je().optional().default(!1)}),$Ci=t=>{const e=jCi.parse(t),{num_pins:n,signalcols:o,missing:i,p:r,pw:s,pl:a,mounty:A,mpx:c,mpy:l,mpw:u,mpl:g,holex:h,holed:d,noholes:p}=e,m=e.holey??A,_=i.find(J=>typeof J!="number"||!Number.isInteger(J)||J<1||J>o);if(_!==void 0)throw new Error(`Invalid missing signal column "${_}" for signalcols${o}`);const f=new Set(i.filter(J=>typeof J=="number")),I=o-f.size;if(I+4!==n)throw new Error(`smdslideswitch${n} needs ${n-4} signal pads, but signalcols${o}_missing(${[...f].join(",")}) creates ${I}`);const C=J=>Number(J.toFixed(12)),y=[],x=-((o-1)*r)/2;let E=1;for(let J=1;J<=o;J++)f.has(J)||(y.push(Wo(E,C(x+(J-1)*r),0,s,a)),E++);const B=A+l/2,S=A-l/2,Q=[{x:C(-c/2),y:C(B)},{x:C(c/2),y:C(B)},{x:C(-c/2),y:C(S)},{x:C(c/2),y:C(S)}];for(const J of Q)y.push(Wo(E,J.x,J.y,u,g)),E++;const w=p?[]:[-h,h].map(J=>({type:"pcb_hole",pcb_hole_id:"",pcb_component_id:"",hole_shape:"circle",hole_diameter:d,x:J,y:m})),M=Math.max(c/2-u/2-.2,r),k=-a/2-.2,R=S+g/2+.2,F=[sA([{x:-M,y:k},{x:M,y:k}]),sA([{x:-M,y:R},{x:M,y:R}]),sA([{x:-M,y:R},{x:-M,y:k}]),sA([{x:M,y:R},{x:M,y:k}])],O=x+(o-1)*r,U=WCi([{x:x-s/2,y:-a/2},{x:O+s/2,y:a/2},{x:-c/2-u/2,y:S-g/2},{x:c/2+u/2,y:B+g/2},...p?[]:[{x:-h-d/2,y:m-d/2},{x:h+d/2,y:m+d/2}]]);if(!U)throw new Error("Could not determine SMD slide-switch bounds");const Y=.25,W=JCi(U),te={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:W,width:U.maxX-U.minX+Y*2,height:U.maxY-U.minY+Y*2,layer:"top"},j=xi(W.x,U.maxY+.6,.5);return{circuitJson:[...y,...w,...F,j,te],parameters:e}},qCi=Ci.extend({fn:$e("smdpinheader"),num_pins:_t().int().positive().default(6),p:ce.default("2.54mm").describe("contact pitch"),py:ce.default("3.31mm").describe("center-to-center distance between alternating pad rows"),pw:ce.default("1mm").describe("pad width"),ph:ce.default("2.51mm").describe("pad height"),bh:ce.default("2.5mm").describe("plastic body height"),male:$e(!0).default(!0),female:$e(!1).default(!1),smd:$e(!0).default(!0)}),XCi=t=>{const e=qCi.parse(t),{num_pins:n,p:o,py:i,pw:r,ph:s,bh:a}=e,A=-((n-1)*o)/2,c=Array.from({length:n},(y,x)=>Wo(x+1,A+x*o,x%2===0?i/2:-i/2,r,s)),l=n*o/2,u=a/2,g=Math.min(.5,a/4),h=(y,x,E=-l)=>{const B=r/2+.2,S=[];let Q=E;for(let w=x;w<n;w+=2){const M=A+w*o,k=M-B;k>Q&&S.push(sA([{x:Q,y},{x:k,y}])),Q=M+B}return Q<l&&S.push(sA([{x:Q,y},{x:l,y}])),S},d=[...h(u,0,-l+g),...h(-u,1),sA([{x:l,y:-u},{x:l,y:u}]),sA([{x:-l,y:-u},{x:-l,y:u-g},{x:-l+g,y:u}])],p=(n-1)*o/2+r/2,m=i/2+s/2,_=Math.max(l,p)+.25,f=Math.max(u,m)+.25,I={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:2*_,height:2*f,layer:"top"},C=xi(0,f+.6,.5);return{circuitJson:[...c,...d,C,I],parameters:e}},ZCi=Ci.extend({fn:Z(),d:ce.optional(),hd:ce.optional(),r:ce.optional(),hr:ce.optional(),pd:ce.optional(),pr:ce.optional(),squarepad:je().optional().default(!1)}).transform(t=>{let e;t.d!==void 0?e=Ua(t.d):t.hd!==void 0?e=Ua(t.hd):t.r!==void 0?e=Ua(t.r)*2:t.hr!==void 0?e=Ua(t.hr)*2:e=Ua("1mm");let n;return t.pd!==void 0?n=Ua(t.pd):t.pr!==void 0?n=Ua(t.pr)*2:n=e*(1.5/1),{fn:t.fn,d:e,pd:n,squarepad:t.squarepad??!1}}),eyi=t=>{const e=ZCi.parse(t),{d:n,pd:o,squarepad:i}=e;return{circuitJson:[i?r2({pn:1,x:0,y:0,holeDiameter:n,rectPadWidth:o,rectPadHeight:o}):Os(1,0,0,n,o),xi(0,o/2+.5,.2)],parameters:e}},tyi=Ci.extend({fn:Z(),num_pins:$e(6).default(6),h:Z().default("1.3mm"),pl:Z().default("1.325mm"),pw:Z().default("0.6mm"),p:Z().default("0.95mm")}),nyi=t=>{const e=tyi.parse(t);return{circuitJson:oyi(e),parameters:e}},gsn=t=>{const{p:e,h:n,pn:o}=t;if(o===1)return{x:-n/2-.4875,y:e};if(o===2)return{x:-n/2-.4875,y:0};if(o===3)return{x:-n/2-.4875,y:-e};if(o===4)return{x:n/2+.4875,y:-e};if(o===5)return{x:n/2+.4875,y:0};if(o===6)return{x:n/2+.4875,y:e};throw new Error("Invalid pin number")},oyi=t=>{const e=[],n=Number.parseFloat(t.h),o=Number.parseFloat(t.p),i=Number.parseFloat(t.pl),r=Number.parseFloat(t.pw),s=Math.min(i,r)/8;for(let B=1;B<=t.num_pins;B++){const{x:S,y:Q}=gsn({h:n,p:o,pn:B});e.push(Wo(B,S,Q,i,r,s))}const a=t.num_pins/2*o,A=n,c={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-a/3,y:A/2+Number.parseFloat(t.p)/1.3},{x:a/3,y:A/2+o/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},l={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-a/3,y:-A/2-o/1.3},{x:a/3,y:-A/2-o/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},u=xi(0,A+.3,.3),g=gsn({h:n,p:o,pn:1});g.x=g.x-r*1.5;const h=.7,d=.3,p={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:g.x+h/2-.2,y:g.y},{x:g.x-h/2,y:g.y+d/2},{x:g.x-h/2,y:g.y-d/2},{x:g.x+h/2-.2,y:g.y}],stroke_width:.05},m=n/2+.4875,_=o*2+r,f=m+i/2,I=n/2+.4,C=f+.25,y=_/2+.25,x=y+.2,E={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",layer:"top",outline:s2([{minX:-C,maxX:C,minY:-y,maxY:y},{minX:-I,maxX:I,minY:-x,maxY:x}])};return[...e,u,c,l,p,E]},iyi=Ci.extend({fn:$e("sot143"),num_pins:$e(4).default(4),p:ce.default("2.382774mm"),px:ce.default("1.89992mm"),pw:ce.default("0.8382mm"),ph:ce.default("0.8382mm"),pin1padwidth:ce.default("1.1938mm"),pin1centeroffsetx:ce.default("0.199898mm"),w:ce.default("3mm"),h:ce.default("2.9mm")}),ryi=t=>{const e=iyi.parse(t),{p:n,px:o,pw:i,ph:r,pin1padwidth:s,pin1centeroffsetx:a,w:A,h:c}=e,l=o/2,u=n/2,g=[Wo(1,-l+a,-u,s,r),Wo(2,l,-u,i,r),Wo(3,l,u,i,r),Wo(4,-l,u,i,r)],h=A/2,d=c/2,p=[sA([{x:-h,y:-d/2},{x:-h,y:d/2}]),sA([{x:h,y:d/2},{x:h,y:-d/2}])],m=o+Math.max(s,i),_=n+r,f={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:0},width:Math.max(A,m)+.5,height:Math.max(c,_)+.5,layer:"top"};return{circuitJson:[...g,...p,xi(0,Math.max(d,_/2)+.8,.4),f],parameters:e}},syi=[{x:-1.703,y:.98},{x:-.983,y:.98},{x:-.983,y:1.1},{x:.477,y:1.1},{x:.477,y:.98},{x:1.197,y:.98},{x:1.197,y:-.98},{x:.477,y:-.98},{x:.477,y:-1.1},{x:-.983,y:-1.1},{x:-.983,y:-.98},{x:-1.703,y:-.98}],ayi=Ci.extend({fn:Z(),num_pins:_t().default(4),w:Z().default("3.2mm"),h:Z().default("2.6mm"),pl:Z().default("1.05mm"),pw:Z().default("0.45mm"),p:Z().default("0.55mm"),string:Z().optional()}),Ayi=t=>{const e=t.string?.match(/^sot343_(\d+)/),n=e?Number.parseInt(e[1],4):4,o=ayi.parse({...t,num_pins:n});if(o.num_pins===4)return{circuitJson:lyi(o),parameters:o};throw new Error("Invalid number of pins")},cyi=t=>{const{pn:e,p:n}=t;return e===1?{x:-n*1.92,y:-.65}:e===2?{x:-n*1.92,y:.65}:e===3?{x:n,y:.65}:e===4?{x:n,y:-.65}:{x:0,y:0}},lyi=t=>{const e=[],n=Number.parseFloat(t.w),o=Number.parseFloat(t.h),i=Number.parseFloat(t.pl),r=Number.parseFloat(t.pw),s=Number.parseFloat(t.p),a=Math.min(i,r)/8;let A=1/0,c=-1/0,l=1/0,u=-1/0;for(let y=0;y<t.num_pins;y++){const{x,y:E}=cyi({num_pins:t.num_pins,pn:y+1,p:s});e.push(Wo(y+1,x,E,i,r,a)),x<A&&(A=x),x>c&&(c=x),E<l&&(l=E),E>u&&(u=E)}const g=(A+c)/2,h=u-l,d=o*.3,p=h/2+d;let m=n*.8;o<=2.6&&(m/=2);const _=xi(g,p+.5,.3),f={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_top",route:[{x:g-m/2,y:p},{x:g+m/2,y:p}],type:"pcb_silkscreen_path",stroke_width:.1},I={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_bottom",route:[{x:g-m/2,y:-p},{x:g+m/2,y:-p}],type:"pcb_silkscreen_path",stroke_width:.1},C={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:syi,layer:"top"};return[...e,f,I,_,C]},uyi=Ci.extend({fn:Z()}),gyi=t=>{const e=uyi.parse(t),n=[],o=.5-.15,i=1.5,s=.5/2,a=75,A=-37/2;for(let E=0;E<a;E++){const B=E+1;if(B>=24&&B<=31)continue;const S=A-E*s,Q=B%2===0,w=i+(Q?.25:0),k=.5-w/2,R=Wo(B,k,S,w,o);R.layer=Q?"bottom":"top",n.push(R)}const c=46*.0254,l=137*.0254,u=261*.0254,g={type:"pcb_cutout",pcb_cutout_id:"",shape:"rect",center:{x:-l/2+i/2,y:A-u},width:l,height:c},h={x:-.5,y:A},d={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:h.x-.4,y:h.y},{x:h.x-.7,y:h.y+.3},{x:h.x-.7,y:h.y-.3},{x:h.x-.4,y:h.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"};let p=1/0,m=-1/0,_=1/0,f=-1/0;const I=(E,B,S=0,Q=0)=>{p=Math.min(p,E-S/2),m=Math.max(m,E+S/2),_=Math.min(_,B-Q/2),f=Math.max(f,B+Q/2)};for(const E of n){const B=E;I(B.x,B.y,B.width,B.height)}I(g.center.x,g.center.y,g.width,g.height);for(const E of d.route)I(E.x,E.y);const C=(p+m)/2,y=(_+f)/2,x=E=>{typeof E.x=="number"&&(E.x-=C),typeof E.y=="number"&&(E.y-=y),E.center&&(E.center.x-=C,E.center.y-=y),Array.isArray(E.route)&&(E.route=E.route.map(B=>({x:B.x-C,y:B.y-y})))};for(const E of n)x(E);return x(g),x(d),{circuitJson:[...n,g,d],parameters:e}},dyi=Ci.extend({fn:Z(),numPins:_t().optional().default(0),rows:xo([Z(),_t()]).transform(t=>Number(t)).optional().default(1).describe("number of rows"),p:ce.default("2.54mm").describe("pitch"),id:ce.default("1.0mm").describe("inner diameter"),od:ce.default("1.5mm").describe("outer diameter"),male:je().optional().describe("the module uses male headers"),nopin:je().optional().default(!1).describe("omit pins rendering"),female:je().optional().describe("the module uses female headers"),smd:je().optional().describe("surface mount device"),pinlabeltextalignleft:je().optional().default(!1),pinlabeltextaligncenter:je().optional().default(!1),pinlabeltextalignright:je().optional().default(!1),pinlabelverticallyinverted:je().optional().default(!1),pinlabelorthogonal:je().optional().default(!1),nopinlabels:je().optional().default(!1).describe("omit silkscreen pin labels"),doublesidedpinlabel:je().optional().default(!1).describe("add silkscreen pins in top and bottom layers"),bottomsidepinlabel:je().optional().default(!1).describe("place the silkscreen reference text on the bottom layer instead of top"),pinRowSide:Kn(["left","right","top","bottom"]).optional().default("left"),pinrowleft:je().optional().default(!1),pinrowright:je().optional().default(!1),pinrowtop:je().optional().default(!1),pinrowbottom:je().optional().default(!1),pinrowleftpins:xo([Z(),_t()]).transform(t=>Number(t)).optional(),pinrowrightpins:xo([Z(),_t()]).transform(t=>Number(t)).optional(),pinrowtoppins:xo([Z(),_t()]).transform(t=>Number(t)).optional(),pinrowbottompins:xo([Z(),_t()]).transform(t=>Number(t)).optional(),width:ce.optional(),height:ce.optional(),pinRowHoleEdgeToEdgeDist:ce.default("2mm"),holes:xo([Z(),dn(Z())]).optional().transform(t=>!t||Array.isArray(t)?t:t.startsWith("(")&&t.endsWith(")")?t.slice(1,-1).split(",").map(e=>e.trim()):[t]),holeXDist:ce.optional(),holeYDist:ce.optional(),holeInset:ce.default("1mm"),pinrow:xo([Z(),_t()]).optional(),usbposition:Kn(["left","right","top","bottom"]).optional().default("left"),usbleft:je().optional().default(!1),usbtop:je().optional().default(!1),usbright:je().optional().default(!1),usbbottom:je().optional().default(!1),usbtype:Kn(["micro","c"]).optional(),usbmicro:je().optional().default(!1),usbc:je().optional().default(!1),screen:je().optional().default(!1).describe("add silkscreen outline for screen/display area"),screenwidth:ce.optional(),screenheight:ce.optional(),screencenteroffsetx:ce.optional(),screencenteroffsety:ce.optional()}).transform(t=>{const e=Xrn(t);let n=t.pinRowSide;t.pinrowleft&&(n="left"),t.pinrowright&&(n="right"),t.pinrowtop&&(n="top"),t.pinrowbottom&&(n="bottom");let o=t.usbposition;t.usbleft&&(o="left"),t.usbtop&&(o="top"),t.usbright&&(o="right"),t.usbbottom&&(o="bottom");let i=t.usbtype;t.usbmicro&&(i="micro"),t.usbc&&(i="c"),t.pinrow!==void 0&&(t.numPins=Number(t.pinrow));const r={left:t.pinrowleftpins,right:t.pinrowrightpins,top:t.pinrowtoppins,bottom:t.pinrowbottompins},s=Object.values(r).some(C=>C!==void 0&&C>0),a=(r.left??0)>0&&(r.right??0)>0,A=(r.top??0)>0&&(r.bottom??0)>0;s&&((r.left??0)>0?n="left":(r.right??0)>0?n="right":(r.top??0)>0?n="top":(r.bottom??0)>0&&(n="bottom"),t.numPins=(r.left??0)+(r.right??0)+(r.top??0)+(r.bottom??0));const c=Math.ceil(t.numPins/t.rows),l=Math.max(r.left??0,r.right??0),u=Math.max(r.top??0,r.bottom??0);let g,h;if(s){const C=a?t.p:0,y=A?t.p:0;g=(u>0?(u-1)*t.p:0)+2*t.pinRowHoleEdgeToEdgeDist+C,h=(l>0?(l-1)*t.p:0)+2*t.pinRowHoleEdgeToEdgeDist+y}else n==="left"||n==="right"?(g=(t.rows-1)*t.p+2*t.pinRowHoleEdgeToEdgeDist,h=(c-1)*t.p+2*t.pinRowHoleEdgeToEdgeDist):(h=(t.rows-1)*t.p+2*t.pinRowHoleEdgeToEdgeDist,g=(c-1)*t.p+2*t.pinRowHoleEdgeToEdgeDist);t.numPins===0&&(g=10,h=10);const d=t.width??g,p=t.height??h,m=t.screenwidth??d*.95,_=t.screenheight??p*.95,f=t.screencenteroffsetx??0,I=t.screencenteroffsety??0;return{...t,pinlabelAnchorSide:e,pinRowSide:n,usbposition:o,usbtype:i,male:t.male??!t.female,female:t.female??!1,width:d,height:p,screenwidth:m,screenheight:_,screencenteroffsetx:f,screencenteroffsety:I,pinrowleftpins:r.left,pinrowrightpins:r.right,pinrowtoppins:r.top,pinrowbottompins:r.bottom}}).superRefine((t,e)=>{t.male&&t.female&&e.addIssue({code:lo.custom,message:"'male' and 'female' cannot both be true; it should be male or female.",path:["male","female"]})}),hyi=t=>{const e=dyi.parse(t),{p:n,id:o,od:i,rows:r,numPins:s,pinlabelAnchorSide:a,pinlabelverticallyinverted:A,pinlabelorthogonal:c,pinlabeltextalignleft:l,pinlabeltextalignright:u,nopinlabels:g,doublesidedpinlabel:h,bottomsidepinlabel:d,pinRowSide:p,width:m,height:_,pinRowHoleEdgeToEdgeDist:f,holes:I,holeXDist:C,holeYDist:y,holeInset:x,pinrowleftpins:E,pinrowrightpins:B,pinrowtoppins:S,pinrowbottompins:Q,usbposition:w,usbtype:M,screen:k,screenwidth:R,screenheight:F,screencenteroffsetx:O,screencenteroffsety:U}=e;let Y="center";l?Y="left":u&&(Y="right");const W=[],te={left:E,right:B,top:S,bottom:Q},j=Object.values(te).some(ie=>ie!==void 0&&ie>0),J=(ie,ne,le,ge)=>{if(e.smd?W.push(Wo(ie,ne,le,e.od,e.od)):ie===1?W.push(r2({pn:ie,x:ne,y:le,holeDiameter:o,rectPadWidth:i,rectPadHeight:i})):W.push(Os(ie,ne,le,o,i)),!g){const _e=ne+(ge==="left"?-i:ge==="right"?i:0),ue=le+(ge==="top"?i:ge==="bottom"?-i:0);d||W.push(gT({fs:i/5,pn:ie,anchor_x:_e,anchor_y:ue,anchorplacement:ge,textalign:Y,orthogonal:c,verticallyinverted:A,layer:"top"})),(h||d)&&W.push(gT({fs:i/5,pn:ie,anchor_x:_e,anchor_y:ue,anchorplacement:ge,textalign:Y,orthogonal:c,verticallyinverted:A,layer:"bottom"}))}};if(j){const ie=n;let ne=1;const le=te.left??0,ge=te.right??0,_e=te.top??0,ue=te.bottom??0,fe=(pe,ye)=>{if(!(ye<=0))if(pe==="left"||pe==="right"){const Me=pe==="left"?-m/2+f:m/2-f,ve=(ye-1)/2*ie;for(let he=0;he<ye;he++)J(ne,Me,ve-he*ie,pe),ne++}else{const Me=pe==="top"?_/2-f:-_/2+f,ve=-((ye-1)/2)*ie;for(let he=0;he<ye;he++)J(ne,ve+he*ie,Me,pe),ne++}};fe("left",le),fe("right",ge),fe("top",_e),fe("bottom",ue)}else{const ie=n;let ne=0,le=0,ge=0,_e=0,ue=0,fe=0;const pe=Math.ceil(s/r);p==="left"||p==="right"?(ne=p==="left"?-m/2+f:m/2-f,le=(pe-1)/2*ie,ge=0,_e=-ie,ue=p==="left"?ie:-ie,fe=0):(ne=-(pe-1)/2*ie,le=p==="top"?_/2-f:-_/2+f,ge=ie,_e=0,ue=0,fe=p==="top"?-ie:ie);let ye=1;for(let Me=0;Me<r&&ye<=s;Me++)for(let ve=0;ve<pe&&ye<=s;ve++){const he=ne+ve*ge+Me*ue,Qe=le+ve*_e+Me*fe;if(e.smd?W.push(Wo(ye,he,Qe,e.od,e.od)):ye===1?W.push(r2({pn:ye,x:he,y:Qe,holeDiameter:o,rectPadWidth:i,rectPadHeight:i})):W.push(Os(ye,he,Qe,o,i)),!g){const Pe=he+(p==="left"?-i:p==="right"?i:0),we=Qe+(p==="top"?i:p==="bottom"?-i:0);d||W.push(gT({fs:i/5,pn:ye,anchor_x:Pe,anchor_y:we,anchorplacement:a,textalign:Y,orthogonal:c,verticallyinverted:A,layer:"top"})),(h||d)&&W.push(gT({fs:i/5,pn:ye,anchor_x:Pe,anchor_y:we,anchorplacement:a,textalign:Y,orthogonal:c,verticallyinverted:A,layer:"bottom"}))}ye++}}if(I)for(const ie of I){let ne=0,le=0;ie==="topleft"?(ne=-m/2+x,le=_/2-x):ie==="topright"?(ne=m/2-x,le=_/2-x):ie==="bottomleft"?(ne=-m/2+x,le=-_/2+x):ie==="bottomright"?(ne=m/2-x,le=-_/2+x):ie==="center"&&(ne=0,le=0),C!==void 0&&(ne+=C),y!==void 0&&(le+=y),W.push(Os(s+I.indexOf(ie)+1,ne,le,o,i))}if(!e.nosilkscreen){const ie=[{x:-m/2,y:-_/2},{x:m/2,y:-_/2},{x:m/2,y:_/2},{x:-m/2,y:_/2},{x:-m/2,y:-_/2}];W.push(sA(ie,{stroke_width:.1,layer:"top"}))}const oe=xi(0,_/2+1,.5);if(W.push(oe),w&&M){let ie,ne;if(M==="c")ie=8,ne=3;else if(M==="micro")ie=6,ne=2;else return{circuitJson:W,parameters:e};let le;if(w==="left")le=[{x:-m/2,y:-ie/2},{x:-m/2+ne,y:-ie/2},{x:-m/2+ne,y:ie/2},{x:-m/2,y:ie/2},{x:-m/2,y:-ie/2}];else if(w==="right")le=[{x:m/2-ne,y:-ie/2},{x:m/2,y:-ie/2},{x:m/2,y:ie/2},{x:m/2-ne,y:ie/2},{x:m/2-ne,y:-ie/2}];else if(w==="top")le=[{x:-ie/2,y:_/2-ne},{x:ie/2,y:_/2-ne},{x:ie/2,y:_/2},{x:-ie/2,y:_/2},{x:-ie/2,y:_/2-ne}];else if(w==="bottom")le=[{x:-ie/2,y:-_/2},{x:ie/2,y:-_/2},{x:ie/2,y:-_/2+ne},{x:-ie/2,y:-_/2+ne},{x:-ie/2,y:-_/2}];else return{circuitJson:W,parameters:e};W.push(sA(le,{stroke_width:.1,layer:"top"}))}if(k){const ie=R/2,ne=F/2,le=O,ge=U,_e=[{x:-ie+le,y:-ne+ge},{x:ie+le,y:-ne+ge},{x:ie+le,y:ne+ge},{x:-ie+le,y:ne+ge},{x:-ie+le,y:-ne+ge}];W.push(sA(_e,{stroke_width:.05,layer:"top"}))}return{circuitJson:W,parameters:e}},pyi=[{x:-1.45,y:2.75},{x:-1.45,y:-1.85},{x:4.05,y:-1.85},{x:4.05,y:2.75}],myi=[{x:-1.55,y:2.75},{x:-1.55,y:-1.85},{x:3.95,y:-1.85},{x:3.95,y:2.75}],_yi=Ci.extend({fn:Z(),num_pins:_t().default(3),inline:je().default(!1),p:Z().default("1.27mm"),id:Z().default("0.75mm"),od:Z().default("1.3mm"),w:Z().default("4.8mm"),h:Z().default("4.0mm")}),fyi=t=>{const e=_yi.parse(t),n=Number.parseFloat(e.p),o=Number.parseFloat(e.w),i=Number.parseFloat(e.h),r=e.inline?1.05:Number.parseFloat(e.od),s=e.inline?1.5:r,a=[r2({pn:1,x:0,y:0,holeDiameter:e.id,rectPadWidth:r,rectPadHeight:s}),e.inline?Q6(2,n,0,Number.parseFloat(e.id),r,s):Os(2,n,n,e.id,r),e.inline?Q6(3,n*2,0,Number.parseFloat(e.id),r,s):Os(3,n*2,0,e.id,r)],A=o/2,c=e.inline?n-.09:n,l=.2,u=l+A-i,g=Array.from({length:32},(m,_)=>{const f=Math.PI*_/31;return{x:c+A*Math.cos(f),y:l+A*Math.sin(f)}}),h={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",stroke_width:.12,route:[...g,{x:c-A,y:u},{x:c+A,y:u},g[0]]},d=xi(c,l+A+1,.5),p={type:"pcb_courtyard_outline",pcb_courtyard_outline_id:"",pcb_component_id:"",outline:e.inline?myi:pyi,layer:"top"};return{circuitJson:[...a,h,d,p],parameters:e}},Iyi=Ci.extend({fn:$e("usbcmidmount"),num_pins:$e(16).default(16),pinstart:S5.number().int().positive().default(1),split:je().default(!1).describe("emit all 16 contact lands"),reverse:je().default(!1).describe("number contact lands right-to-left"),noholes:je().default(!1).describe("omit the two locator holes"),rowy:ce.default("2.125mm").describe("contact pad row y position"),ph:ce.default("1.1mm").describe("contact pad height"),pw:ce.default("0.3mm").describe("signal contact pad width"),powerpw:ce.default("0.55mm").describe("merged power pad width"),powerx:ce.default("3.2mm").describe("outer merged power pad x"),shellx:ce.default("4.325mm").describe("shell tab x position"),topy:ce.default("1.575mm").describe("upper shell tab y position"),bottomy:ce.default("2.625mm").describe("lower shell tab negative y magnitude"),tophw:ce.default("0.6mm").describe("upper shell slot width"),tophh:ce.default("1.5mm").describe("upper shell slot height"),topring:ce.default("0.25mm").describe("upper shell annular ring"),bottomhw:ce.default("0.6mm").describe("lower shell slot width"),bottomhh:ce.default("1.2mm").describe("lower shell slot height"),bottomring:ce.default("0.3mm").describe("lower shell annular ring"),holex:ce.default("2.89mm").describe("locator hole x position"),holey:ce.default("1.055mm").describe("locator hole y position"),holed:ce.default("0.7mm").describe("locator hole diameter"),bodybottom:ce.default("5.225mm").describe("connector body negative y extent")}),Ipe=({pin:t,x:e,y:n,holeWidth:o,holeHeight:i,outerWidth:r,outerHeight:s})=>({type:"pcb_plated_hole",shape:"pill",pcb_plated_hole_id:"",pcb_component_id:"",pcb_port_id:"",x:e,y:n,hole_width:o,hole_height:i,outer_width:r,outer_height:s,ccw_rotation:0,layers:["top","bottom"],port_hints:[t.toString()]}),Cyi=t=>{const e=Iyi.parse(t),{pinstart:n,split:o,reverse:i,noholes:r,rowy:s,ph:a,pw:A,powerpw:c,powerx:l,shellx:u,topy:g,bottomy:h,tophw:d,tophh:p,topring:m,bottomhw:_,bottomhh:f,bottomring:I,holex:C,holey:y,holed:x,bodybottom:E}=e,B=r?[]:[-C,C].map(ge=>({type:"pcb_hole",pcb_hole_id:"",pcb_component_id:"",hole_shape:"circle",hole_diameter:x,x:ge,y})),S=[Ipe({pin:n,x:-u,y:g,holeWidth:d,holeHeight:p,outerWidth:d+2*m,outerHeight:p+2*m}),Ipe({pin:n+1,x:u,y:g,holeWidth:d,holeHeight:p,outerWidth:d+2*m,outerHeight:p+2*m}),Ipe({pin:n+2,x:-u,y:-h,holeWidth:_,holeHeight:f,outerWidth:_+2*I,outerHeight:f+2*I}),Ipe({pin:n+3,x:u,y:-h,holeWidth:_,holeHeight:f,outerWidth:_+2*I,outerHeight:f+2*I})],Q=Number((l-.8).toFixed(12)),w=[-l,-Q,-1.75,-1.25,-.75,-.25,.25,.75,1.25,1.75,Q,l],k=o?[-3.35,-3.05,-2.55,-2.25,-1.75,-1.25,-.75,-.25,.25,.75,1.25,1.75,2.25,2.55,3.05,3.35]:w,R=i?k.slice().reverse():k,F=o?R.map(()=>A):R.map((ge,_e)=>_e<2||_e>=R.length-2?c:A),O=R.map((ge,_e)=>Wo(n+4+_e,ge,s,F[_e],a)),U=Math.min(u-Math.max(d,_)/2-.2,4.5),Y=[sA([{x:-U,y:-h+f/2+I+.2},{x:-U,y:g-p/2-m-.2}]),sA([{x:U,y:-h+f/2+I+.2},{x:U,y:g-p/2-m-.2}]),sA([{x:-U,y:-E},{x:U,y:-E}])],W=Math.max(s+a/2,g+p/2+m),te=Math.min(-E,-h-f/2-I),j=-u-Math.max(d+2*m,_+2*I)/2-.25,J=-j,oe=W+.25,ie=te-.25,ne=xi(0,oe+.75,.5),le={type:"pcb_courtyard_rect",pcb_courtyard_rect_id:"",pcb_component_id:"",center:{x:0,y:(oe+ie)/2},width:J-j,height:oe-ie,layer:"top"};return{circuitJson:[...B,...S,...O,...Y,ne,le],parameters:e}};hpe.extend({}).transform(ppe);var yyi=t=>(t.legsoutside=!1,t.pl||(t.pl=1),t.pw||(t.pw=.6),uT(t)),xyi=(t,e)=>{const n=t.filter(o=>o.type==="pcb_silkscreen_text");if(n.length===0)return t;for(const o of n)e.norefdes&&(o.text="");return t},Eyi=(t,e)=>e.nosilkscreen?t.filter(n=>n.type!=="pcb_silkscreen_path"&&n.type!=="pcb_silkscreen_text"):t,Byi=(t,e)=>{if(!e)return t;const n=t.filter(l=>l.type==="pcb_smtpad"||l.type==="pcb_plated_hole");if(n.length===0)return t;let o=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;const a=(l,u,g=0,h=0)=>{const d=l-g/2,p=l+g/2,m=u-h/2,_=u+h/2;o=Math.min(o,d),i=Math.max(i,p),r=Math.min(r,m),s=Math.max(s,_)};for(const l of n)if(l.type==="pcb_smtpad"){const u=l.shape==="circle"?l.radius*2:l.width,g=l.shape==="circle"?l.radius*2:l.height;a(l.x,l.y,u,g)}else if(l.type==="pcb_plated_hole"){const u=l.outer_diameter??l.hole_diameter;a(l.x,l.y,u,u)}let A=0,c=0;switch(e){case"center":A=(o+i)/2,c=(r+s)/2;break;case"bottomleft":A=o,c=r;break;case"bottomcenter":case"centerbottom":A=(o+i)/2,c=r;break;case"topcenter":case"centertop":A=(o+i)/2,c=s;break;case"leftcenter":case"centerleft":A=o,c=(r+s)/2;break;case"rightcenter":case"centerright":A=i,c=(r+s)/2;break;case"pin1":{const l=n.find(u=>u.port_hints?.[0]==="1")||n[0];A=l.x,c=l.y;break}}if(A===0&&c===0)return t;for(const l of t){if(typeof l.x=="number"&&(l.x-=A),typeof l.y=="number"&&(l.y-=c),l.center&&typeof l.center.x=="number"&&(l.center.x-=A,l.center.y-=c),l.type==="pcb_silkscreen_path")for(const u of l.route)u.x-=A,u.y-=c;l.type==="pcb_silkscreen_text"&&l.anchor_position&&(l.anchor_position.x-=A,l.anchor_position.y-=c)}return t},byi=[0,90,180,270],Cpe=(t,e)=>{switch(e){case 90:return{x:-t.y,y:t.x};case 180:return{x:-t.x,y:-t.y};case 270:return{x:t.y,y:-t.x};default:return{...t}}},dsn=t=>{if(typeof t.x=="number"&&typeof t.y=="number")return{x:t.x,y:t.y};if(Array.isArray(t.points)&&t.points.length>0){const e=t.points.map(o=>o.x),n=t.points.map(o=>o.y);return{x:(Math.min(...e)+Math.max(...e))/2,y:(Math.min(...n)+Math.max(...n))/2}}return null},Syi=t=>t.port_hints?.some(e=>/^(?:pin)?1$/i.test(String(e))),Qyi=(t,e,[n,o])=>{const i=t.map(_=>_.x),r=t.map(_=>_.y),s=Math.min(...i),a=Math.max(...i),A=Math.min(...r),c=Math.max(...r),l=(s+a)/2,u=(A+c)/2,g=a-s,h=c-A,d=Math.max(g,h,1)*1e-6,p=n==="leftside"&&Math.abs(e.x-s)<=d||n==="rightside"&&Math.abs(e.x-a)<=d||n==="topside"&&Math.abs(e.y-c)<=d||n==="bottomside"&&Math.abs(e.y-A)<=d,m=o==="left"&&(g<=d||e.x<l-d)||o==="right"&&(g<=d||e.x>l+d)||o==="top"&&(h<=d||e.y>u+d)||o==="bottom"&&(h<=d||e.y<u-d);return p&&m},$Ve=(t,e)=>{if(!t||typeof t!="object"||typeof t.x!="number"||typeof t.y!="number")return;const n=Cpe(t,e);t.x=n.x,t.y=n.y},ype=t=>(t%360+360)%360,vyi=(t,e)=>{switch(t.shape){case"rect":return{...t,shape:"rotated_rect",ccw_rotation:ype(e)};case"pill":return{...t,shape:"rotated_pill",ccw_rotation:ype(e)};case"rotated_rect":case"rotated_pill":return{...t,ccw_rotation:ype(t.ccw_rotation+e)};default:return t}},wyi=(t,e)=>e===0?t:t.map(n=>{const o=structuredClone(n);if(typeof o.x=="number"&&typeof o.y=="number"){const i=Cpe(o,e);o.x=i.x,o.y=i.y}$Ve(o.center,e),$Ve(o.anchor_position,e);for(const i of["route","outline","points"])if(Array.isArray(o[i]))for(const r of o[i])$Ve(r,e);return o.type==="pcb_smtpad"?vyi(o,e):((o.type==="pcb_plated_hole"||o.type==="pcb_silkscreen_text"||o.type==="pcb_fabrication_note_text")&&(o.ccw_rotation=ype(Number(o.ccw_rotation??0)+e)),(e===90||e===270)&&(o.type==="pcb_courtyard_rect"||o.type==="pcb_silkscreen_rect"||o.type==="pcb_fabrication_note_rect"||o.type==="pcb_cutout"&&o.shape==="rect")&&([o.width,o.height]=[o.height,o.width]),o)}),Pyi=(t,e)=>{if(!e)return t;const n=t.filter(a=>a.type==="pcb_smtpad"||a.type==="pcb_plated_hole"),o=n.find(Syi),i=n.map(dsn).filter(a=>a!==null),r=o?dsn(o):null;if(!o||!r||i.length===0)throw new Error(`pin1location(${e.join(",")}) requires a footprint with a pad whose port_hints contain "1" or "pin1"`);const s=byi.find(a=>{const A=i.map(l=>Cpe(l,a)),c=Cpe(r,a);return Qyi(A,c,e)});if(s===void 0)throw new Error(`pin1location(${e.join(",")}) cannot be reached with a rotation; the requested location may be the mirrored orientation of this footprint`);return wyi(t,s)},hsn=(t,e,n)=>Math.min(t,e/2,n/2),Myi=(t,e)=>{if(e===void 0)return t;const n=Ua(e);if(!Number.isFinite(n)||n<0)throw new Error(`rounded radius must be a non-negative length, got "${e}"`);for(const o of t)o.type==="pcb_smtpad"&&(o.shape==="rect"||o.shape==="rotated_rect")&&(o.corner_radius=hsn(n,o.width,o.height)),o.type==="pcb_plated_hole"&&"rect_pad_width"in o&&"rect_pad_height"in o&&(o.rect_border_radius=hsn(n,o.rect_pad_width,o.rect_pad_height));return t};function Dyi(t){return t!=null}var Nyi=t=>t.trim().replace(/^pinheader(?=[\d_]|$)/i,"pinrow").replace(/^d2pak(\d+)(?=_|$)/i,"d2pak_$1").replace(/^to-252(?:-(\d+))?(?=_|$)/i,(e,n)=>n?`to252_${n}`:"to252").replace(/^to-263(?:-(\d+))?(?=_|$)/i,(e,n)=>n?`to263_${n}`:"to263").replace(/^sot-23(?:-(\d+))?(?=_|$)/i,(e,n)=>n?`sot23_${n}`:"sot23").replace(/^sot23-(\d+)(?=_|$)/i,"sot23_$1").replace(/^sot-223-(\d+)(?=_|$)/i,"sot223_$1").replace(/^to-220f-(\d+)(?=_|$)/i,"to220f_$1").replace(/^jst_(ph|sh|zh|xh)_(\d+)(?=_|$)/i,"jst$2_$1"),Ryi=t=>t.replace(/([+-]?(?:\d+(?:\.\d*)?|\.\d+))\s*(?:um|µm)(?=$|[x,() ])/gi,e=>`${Number(ce.parse(e).toPrecision(12))}mm`),Tyi=t=>{let e=xpe();const n=Nyi(t),i=n.replace(/^((?:\d{4}|\d{5}))(?=$|_|x)/,"res$1").replace(/^zh(\d+)(?:$|_)/,"jst$1_zh").split(/_(?!metric)/).map(r=>{const s=r.match(/^(pin1location)(\(.*\))$/i);if(s)return{fn:s[1].toLowerCase(),v:s[2]};const a=r.match(/((?:p\d+[a-zA-Z]+(?=[\(\d\.\+\-\?]))|[a-zA-Z]+)([\(\d\.\+\-\?].*)?/);if(!a)return null;const[,A,c]=a;if(!A)return null;const l=A.toLowerCase();return c?.includes("?")?null:{fn:l,v:c}}).filter(Dyi);for(const{fn:r,v:s}of i)e=e[r](s);return e.setString(n),e},kyi=()=>Object.keys(cS),xpe=()=>{const t=new Proxy({},{get:(e,n)=>{if(n==="soup"||n==="circuitJson"){if("fn"in e&&cS[e.fn])return()=>{const{circuitJson:o}=cS[e.fn](e),i=Eyi(o,e),r=xyi(i,e),s=Pyi(r,e.pin1location?Drn.parse(e.pin1location):void 0),a=Myi(s,e.rounded);return Byi(a,e.origin)};if(!cS[e.fn])throw new Error(`Invalid footprint function, got "${e.fn}"${e.string?`, from string "${e.string}"`:""}`);return()=>{throw new Error(`No function found for footprinter, make sure to specify .dip, .lr, .p, etc. Got "${n}"`)}}if(n==="json"){if(!cS[e.fn])throw new Error(`Invalid footprint function, got "${e.fn}"${e.string?`, from string "${e.string}"`:""}`);return()=>cS[e.fn](e).parameters}return n==="getFootprintNames"?()=>Object.keys(cS):n==="params"?()=>e:n==="setString"?o=>(e.string=o,t):(...o)=>{const i=o[0],r=typeof i=="string"?Ryi(i):i;return Object.keys(e).length===0?`${n}${i}`in cS?(e[`${n}${i}`]=!0,e.fn=`${n}${i}`):(e[n]=!0,e.fn=n,n==="res"||n==="cap"||n==="led"||n==="diode"?i&&(typeof i=="string"&&i.includes("_metric")?e.metric=i.split("_metric")[0]:e.imperial=i):e.num_pins=Number.isNaN(Number.parseFloat(i))?void 0:Number.parseFloat(i)):!i&&["w","h","p"].includes(n)||(e[n]=n==="pin1location"&&o.length>1?o:r??!0),t}}});return t};xpe.string=Tyi,xpe.getFootprintNames=kyi;var pI=xpe,psn={in:25.4,inch:25.4,mil:.0254,mm:1,m:1e3,cm:10,ft:304.8,feet:304.8},Fyi=t=>{let e=typeof t=="number"?"mm":t.replace(/^[^a-zA-Z]+/g,"").toLowerCase();e||(e="mm");const n=typeof t=="number"?t:Number.parseFloat(t.split(e)[0]);if(e in psn)return n*psn[e];throw new Error(`Unsupported unit: ${e}`)},v6=xo([_t(),Z()]).transform((t,e)=>{try{const n=Fyi(t);if(!Number.isFinite(n))throw new Error("Length is not finite");return n}catch{return e.addIssue({code:"custom",message:`Invalid model length: ${String(t)}`}),gBn}}),a1=v6.refine(t=>t>0,"Length must be greater than zero"),w6=v6.refine(t=>t>=0,"Length cannot be negative"),Lyi=Kn(["sitsFlat","sitsFlatBelowBoard","foldedToFaceAboveBoard","foldedToFaceBelowBoard","foldedToRightAngleAboveBoard","foldedToRightAngleBelowBoard"]),qVe=_t().finite().positive(),Hyi=Z().refine(t=>{const e=t.split(":");if(e.length!==2)return!1;const n=Number(e[0]),o=Number(e[1]);return Number.isFinite(n)&&Number.isFinite(o)&&n>0&&o>0},'Aspect ratio must look like "16:9"').transform(t=>t),msn=xo([qVe,Hyi,fQ([qVe,qVe])]),_sn=Pt({x:v6.optional(),y:v6.optional(),z:v6.optional()}).strict(),XVe=xo([_t().finite(),Z().min(1)]),fsn=fQ([XVe,XVe,XVe]),Oyi=["sitsFlat","sitsFlatBelowBoard","foldedToFaceAboveBoard","foldedToFaceBelowBoard","foldsAboveBoard","foldsBelowBoard","foldedToRightAngleAboveBoard","foldedToRightAngleBelowBoard"],Isn={width:a1.optional(),height:a1.optional(),diagonal:a1.optional(),aspectRatio:msn.optional(),ratio:msn.optional(),defaultDiagonal:a1.optional(),orientation:Lyi.optional(),sitsFlat:je().optional(),sitsFlatBelowBoard:je().optional(),foldedToFaceAboveBoard:je().optional(),foldedToFaceBelowBoard:je().optional(),foldsAboveBoard:je().optional(),foldsBelowBoard:je().optional(),foldedToRightAngleAboveBoard:je().optional(),foldedToRightAngleBelowBoard:je().optional(),screenThickness:a1.optional(),bezelInset:w6.optional(),bezelDepth:a1.optional(),activeAreaWidth:a1.optional(),activeAreaHeight:a1.optional(),screenColor:Z().min(1).optional(),bezelColor:Z().min(1).optional(),showScreen:je().optional(),flexCableLength:a1.optional(),flexCableWidth:a1.optional(),flexCableThickness:a1.optional(),flexCableColor:Z().min(1).optional(),conductorCount:_t().int().positive().optional(),conductorPitch:a1.optional(),conductorWidth:a1.optional(),conductorThickness:a1.optional(),conductorColor:Z().min(1).optional(),cableEdgeMargin:w6.optional(),exposedContactLength:w6.optional(),showConductors:je().optional(),showFlexCable:je().optional(),showStiffeners:je().optional(),stiffenerLength:w6.optional(),stiffenerThickness:a1.optional(),stiffenerColor:Z().min(1).optional(),bendRadius:a1.optional(),bendSegments:_t().int().min(2).optional(),rightAngleVerticalLead:w6.optional(),distanceAboveBoard:w6.optional(),distanceBelowBoard:w6.optional(),foldDistanceFromConnector:w6.optional(),foldOutset:a1.optional(),foldSegments:_t().int().min(4).optional(),screenGap:w6.optional(),boardTopZ:v6.optional(),boardThickness:a1.optional(),boardClearance:w6.optional(),cableStartX:v6.optional(),cableStartY:v6.optional(),cableStartZ:v6.optional(),cableLateralOffset:v6.optional(),screenOffset:_sn.optional(),screenRotation:fsn.optional(),rotation:fsn.optional(),offset:_sn.optional()},Csn=(t,e)=>{const n=Oyi.filter(o=>t[o]===!0);n.length>1&&e(n[1])};Pt(Isn).strict().superRefine((t,e)=>{Csn(t,n=>{e.addIssue({code:"custom",message:"Only one FlexScreen orientation shortcut can be true",path:[n]})})});var Gyi=Pt({fn:$e("flexscreen"),...Isn}).strict().superRefine((t,e)=>{Csn(t,n=>{e.addIssue({code:"custom",message:"Only one FlexScreen orientation shortcut can be true",path:[n]})})}),ysn=t=>{const e=t.match(/^([a-zA-Z]+)([\(\d\.\+\-].*)?$/);if(e?.[1])return{fn:e[1].toLowerCase(),value:e[2]}},Yyi=t=>{const e=t.trim();if(!e)throw new Error("Model string cannot be empty");const n=e.split("_"),o=n[0],i=ysn(o),r={},s=i?.fn??o.toLowerCase();if(r[s]=!0,r.fn=s,i?.value){const a=Number.parseFloat(i.value);Number.isFinite(a)&&(r.num_pins=a)}for(const a of n.slice(1)){if(!a)throw new Error("Model strings cannot contain empty tokens");const A=ysn(a);if(!A)throw new Error(`Invalid model string token "${a}"`);r[A.fn]=A.value??!0}return r.string=e,r},Uyi={sitsflat:"sitsFlat",sitsflatbelow:"sitsFlatBelowBoard",sitsflatbelowboard:"sitsFlatBelowBoard",foldsabove:"foldedToFaceAboveBoard",foldsaboveboard:"foldedToFaceAboveBoard",foldedtofaceaboveboard:"foldedToFaceAboveBoard",foldsbelow:"foldedToFaceBelowBoard",foldsbelowboard:"foldedToFaceBelowBoard",foldedtofacebelowboard:"foldedToFaceBelowBoard",rightangleabove:"foldedToRightAngleAboveBoard",rightangleaboveboard:"foldedToRightAngleAboveBoard",foldedtorightangleaboveboard:"foldedToRightAngleAboveBoard",rightanglebelow:"foldedToRightAngleBelowBoard",rightanglebelowboard:"foldedToRightAngleBelowBoard",foldedtorightanglebelowboard:"foldedToRightAngleBelowBoard"},Kyi={width:["width","w"],height:["height","h"],diagonal:["diagonal","diag","d"],defaultDiagonal:["defaultdiagonal","defaultdiag"],screenThickness:["screenthickness"],bezelInset:["bezelinset"],bezelDepth:["bezeldepth"],activeAreaWidth:["activeareawidth","activew"],activeAreaHeight:["activeareaheight","activeh"],flexCableLength:["flexcablelength","flexlength","flex"],flexCableWidth:["flexcablewidth","flexwidth"],flexCableThickness:["flexcablethickness","flexthickness"],conductorPitch:["conductorpitch"],conductorWidth:["conductorwidth"],conductorThickness:["conductorthickness"],cableEdgeMargin:["cableedgemargin","edgemargin"],exposedContactLength:["exposedcontactlength","contactlength"],stiffenerLength:["stiffenerlength"],stiffenerThickness:["stiffenerthickness"],bendRadius:["bendradius"],rightAngleVerticalLead:["rightangleverticallead","verticallead"],distanceAboveBoard:["distanceaboveboard","distanceabove"],distanceBelowBoard:["distancebelowboard","distancebelow"],foldDistanceFromConnector:["folddistancefromconnector","folddistance","foldstart"],foldOutset:["foldoutset","outset"],screenGap:["screengap"],boardTopZ:["boardtopz"],boardThickness:["boardthickness"],boardClearance:["boardclearance"],cableStartX:["cablestartx"],cableStartY:["cablestarty"],cableStartZ:["cablestartz"],cableLateralOffset:["cablelateraloffset","lateraloffset"]},Vyi=Object.fromEntries(Object.entries(Kyi).flatMap(([t,e])=>e.map(n=>[n,t]))),zyi={conductorcount:"conductorCount",conductors:"conductorCount",bendsegments:"bendSegments",foldsegments:"foldSegments"},xsn={showscreen:["showScreen",!0],hidescreen:["showScreen",!1],showflex:["showFlexCable",!0],hideflex:["showFlexCable",!1],showconductors:["showConductors",!0],hideconductors:["showConductors",!1],showstiffeners:["showStiffeners",!0],hidestiffeners:["showStiffeners",!1]},Jyi={screencolor:"screenColor",bezelcolor:"bezelColor",flexcolor:"flexCableColor",conductorcolor:"conductorColor",stiffenercolor:"stiffenerColor"},Wyi=t=>{const e=String(t).toLowerCase().replace("x",":");if(e.includes(":")){const[o,i,r]=e.split(":"),s=Number(o),a=Number(i);if(r!==void 0||!Number.isFinite(s)||!Number.isFinite(a)||s<=0||a<=0)throw new Error(`Invalid FlexScreen aspect ratio "${String(t)}"`);return`${s}:${a}`}const n=Number(e);if(!Number.isFinite(n)||n<=0)throw new Error(`Invalid FlexScreen aspect ratio "${String(t)}"`);return n},jyi=(t,e)=>{if(typeof t!="string"||!/^\(.+\)$/.test(t))throw new Error(`FlexScreen token "${e}" requires a value in (...)`);return t.slice(1,-1)},Esn=(t,e)=>{if(t!==!0)throw new Error(`FlexScreen token "${e}" does not accept a value`)},$yi=t=>{if(t.fn!=="flexscreen")throw new Error(`Expected FlexScreen params, got "${t.fn}"`);const e={};let n,o;for(const[i,r]of Object.entries(t)){if(i==="fn"||i==="string"||i==="flexscreen")continue;const s=Uyi[i];if(s){if(Esn(r,i),n&&n!==s)throw new Error("A FlexScreen model string can only set one orientation");n=s,e.orientation=s;continue}if(i in xsn){Esn(r,i);const[l,u]=xsn[i];e[l]=u;continue}const a=Jyi[i];if(a){e[a]=jyi(r,i);continue}if(i==="ratio"){e.aspectRatio=Wyi(r);continue}const A=Vyi[i];if(A){e[A]=r;continue}if(i==="distance"){o=r;continue}const c=zyi[i];if(c){const l=Number(r);if(!Number.isInteger(l)||l<1)throw new Error(`Invalid positive integer in FlexScreen token "${i}${String(r)}"`);e[c]=l;continue}throw new Error(`Unknown FlexScreen model token "${i}${String(r)}"`)}if(o!==void 0)if(n==="foldedToFaceAboveBoard")e.distanceAboveBoard=o;else if(n==="foldedToFaceBelowBoard")e.distanceBelowBoard=o;else throw new Error('The "distance" token requires foldsabove or foldsbelow; use distanceabove or distancebelow for an explicit side');return Gyi.parse({fn:"flexscreen",...e})},Bsn={flexscreen:$yi},qyi=t=>{const e=Bsn[t.fn];if(e)return e(t);throw new Error(`Unsupported modelprinter function "${t.fn}"`)},Xyi=t=>{const e=Yyi(t);return{params:()=>e,json:()=>qyi(e)}},Zyi={string:Xyi,getModelNames:()=>Object.keys(Bsn)},ZVe=Zyi,bsn=Symbol("Fragment");function eze(t,e,...n){const o=n.length?n:e?.children!==void 0?[e.children]:[],i=[],r=(Array.isArray(o)?o:[o]).flat(1/0);for(const s of r)s==null||s===!1||(Array.isArray(s)?i.push(...s):i.push(s));return{type:t,props:(e&&e.children!==void 0?{...e,children:void 0}:e)||{},children:i}}var $t=Symbol("Cuboid"),Ssn=Symbol("Cube"),Ns=Symbol("Cylinder"),TY=Symbol("Sphere"),A1=Symbol("RoundedCuboid"),Uo=Symbol("Translate"),Ac=Symbol("Rotate"),gh=Symbol("Union"),e0=Symbol("Subtract"),ZA=Symbol("Hull"),qo=Symbol("Colorize"),kY=Symbol("Polygon"),FY=Symbol("ExtrudeLinear"),a2=Symbol("RoundedCylinder"),Ei=bsn,De=(t,e,n)=>eze(t,e),Sn=(t,e,n)=>eze(t,e),tze=({hole:t,isPin1:e})=>{const n=e?"#00ff00":"#b87333";if(t.shape==="circle")return De(qo,{color:n,children:De(Uo,{offset:[t.x,t.y,-.005],children:Sn(e0,{children:[De(Ns,{radius:t.outer_diameter/2,height:.01}),De(Ns,{radius:t.hole_diameter/2,height:.01})]})})});if(t.shape==="circular_hole_with_rect_pad")return De(qo,{color:n,children:De(Uo,{offset:[t.x,t.y,0],children:Sn(e0,{children:[De($t,{size:[t.rect_pad_width,t.rect_pad_height,.01],center:[0,0,0]}),De(Ns,{radius:t.hole_diameter/2,height:.01})]})})});if(t.shape==="pill"){const o=t.outer_width,i=t.outer_height,r=Math.min(o,i)/2,s=o>i,a=t.hole_width??.8,A=t.hole_height??.8;return De(qo,{color:n,children:De(Uo,{offset:[t.x,t.y,0],children:Sn(e0,{children:[Sn(ZA,{children:[De(Ns,{radius:r,height:.01,center:[s?-(o/2-r):0,s?0:-(i/2-r),0]}),De(Ns,{radius:r,height:.01,center:[s?o/2-r:0,s?0:i/2-r,0]})]}),a===A?De(Ns,{radius:a/2,height:.01}):Sn(ZA,{children:[De(Ns,{radius:Math.min(a,A)/2,height:.01,center:[a>A?-(a/2-A/2):0,a>A?0:-(A/2-a/2),0]}),De(Ns,{radius:Math.min(a,A)/2,height:.01,center:[a>A?a/2-A/2:0,a>A?0:A/2-a/2,0]})]})]})})})}throw new Error("Shape not supported: "+t.shape)};function e2i(t){for(const o of["bodyWidth","bodyLength","bodyHeight","pitch","landWidth","landLength","landThickness"])if(!Number.isFinite(t[o])||t[o]<=0)throw new Error(`${o} must be finite and positive`);for(const o of["landsPerSideX","landsPerSideY"])if(!Number.isInteger(t[o])||t[o]<0)throw new Error(`${o} must be a nonnegative integer`);if(!Number.isFinite(t.edgeInset)||t.edgeInset<0||t.landThickness>=t.bodyHeight||t.landWidth>=t.pitch||t.landsPerSideX+t.landsPerSideY<1)throw new Error("Invalid land layout or thickness");const e=[{count:t.landsPerSideX,across:t.bodyWidth,along:t.bodyLength,horizontal:!0},{count:t.landsPerSideY,across:t.bodyLength,along:t.bodyWidth,horizontal:!1}];for(const o of e){if(o.count===0)continue;const i=(o.count-1)*t.pitch+t.landWidth;if(i>=o.along-2*t.edgeInset||2*(t.edgeInset+t.landLength)>=o.across)throw new Error("Lands must fit below the body without opposite-row overlap");const r=o.horizontal?t.landsPerSideY:t.landsPerSideX;if(r>0&&i>=o.along-2*(t.edgeInset+t.landLength)&&(r-1)*t.pitch+t.landWidth>=o.across-2*(t.edgeInset+t.landLength))throw new Error("Adjacent land rows overlap at corners")}const n=Math.min(t.bodyWidth,t.bodyLength)*.035;return Sn(Ei,{children:[De(qo,{color:"#353535",children:Sn(e0,{children:[De(Uo,{z:(t.bodyHeight+t.landThickness/2)/2,children:De($t,{size:[t.bodyWidth,t.bodyLength,t.bodyHeight-t.landThickness/2]})}),De(Uo,{offset:[-t.bodyWidth/2+2*n,t.bodyLength/2-2*n,t.bodyHeight],children:De(Ns,{radius:n,height:Math.min(.04,t.bodyHeight/10)})})]})}),De(qo,{color:"#c5b987",children:e.flatMap(o=>[-1,1].flatMap(i=>Array.from({length:o.count},(r,s)=>{const a=i*(o.across/2-t.edgeInset-t.landLength/2),A=((o.count-1)/2-s)*t.pitch;return De(Uo,{offset:[o.horizontal?a:A,o.horizontal?A:a,t.landThickness/2],children:De($t,{size:o.horizontal?[t.landLength,t.landWidth,t.landThickness]:[t.landWidth,t.landLength,t.landThickness]})},`${o.horizontal}-${i}-${s}`)})))})]})}function Epe(t){const{pinCount:e,pitch:n,bodyWidth:o,bodyLength:i,bodyHeight:r,standoff:s,leadSpan:a,leadWidth:A,leadThickness:c,contactLength:l,taperInset:u,exposedPadWidth:g=0,exposedPadLength:h=0}=t;for(const E of["pitch","bodyWidth","bodyLength","bodyHeight","leadSpan","leadWidth","leadThickness","contactLength"])if(!Number.isFinite(t[E])||t[E]<=0)throw new Error(`${E} must be finite and positive`);for(const[E,B]of Object.entries({standoff:s,taperInset:u,exposedPadWidth:g,exposedPadLength:h}))if(!Number.isFinite(B)||B<0)throw new Error(`${E} must be finite and nonnegative`);if(!Number.isInteger(e)||e<4||e%2)throw new Error("pinCount must be even and at least 4");const d=r-s,p=(a-o)/2,m=(e/2-1)*n+A;if(d<=c*2||A>=n||m>=i-2*u||u*2>=Math.min(o,i)||l>=p)throw new Error("Invalid mold, lead spacing, or terminal reach");if(g===0!=(h===0)||g>=o-2*u||h>=i-2*u)throw new Error("Exposed pad must fit inside the bottom mold face");const _=s+d/2,f=Math.min(.002,d/100),I=Sn(ZA,{children:[De(Uo,{z:s+f/2,children:De($t,{size:[o-2*u,i-2*u,f]})}),De(Uo,{z:_,children:De($t,{size:[o,i,f]})}),De(Uo,{z:r-f/2,children:De($t,{size:[o-2*u,i-2*u,f]})})]}),C=Math.min(o,i)*.045,y=Math.min(.04,d/10),x=(E,B)=>{const S=a/2,Q=o/2-Math.min(o/8,.15),w=S-l,M=o/2+Math.min(.08,(p-l)/4),k=[[S-f/2,c/2],[w,c/2]];for(let F=1;F<=12;F++){const O=F/12;k.push([w+(M-w)*O,c/2+(_-c/2)*O*O*(3-2*O)])}k.push([Q,_]);const R=([F,O])=>De(Uo,{offset:{x:E*F,y:B,z:O},children:De($t,{size:[f,A,c]})});return De(gh,{children:k.slice(1).map((F,O)=>Sn(ZA,{children:[R(k[O]),R(F)]}))})};return Sn(Ei,{children:[De(qo,{color:"#353535",children:Sn(e0,{children:[I,De(Uo,{offset:{x:-o/2+u+C*2,y:i/2-u-C*2,z:r},children:De(Ns,{radius:C,height:y*2})})]})}),De(qo,{color:"#bfc1c4",children:Array.from({length:e},(E,B)=>x(B<e/2?-1:1,((e/2-1)/2-B%(e/2))*n))}),g>0&&De(qo,{color:"#bfc1c4",children:De(Uo,{z:(s+c)/2,children:De($t,{size:[g,h,s+c]})})})]})}var t2i=t=>Epe(t);function n2i(t){if(t.bodywidth===void 0&&t.bodyheight===void 0&&t.bodythickness===void 0)return null;if(t.fn==="ssop"){const e=t.bodywidth??t.w*.55,n=t.bodyheight??(t.num_pins/2-1)*t.p+t.pw+.4,o=t.bodythickness??1,i=Math.min(t.pw,t.p*.5),r=(t.num_pins/2-1)*t.p+i;if(n<=r)throw new Error("SSOP bodyheight must contain the lead row");const s=Math.max(t.w+.2+t.pl/2,e+t.p),a=Math.min(.1,o/10);return De(t2i,{pinCount:t.num_pins,pitch:t.p,bodyWidth:e,bodyLength:n,bodyHeight:o+a,standoff:a,leadSpan:s,leadWidth:i,leadThickness:Math.min(.15,o/4),contactLength:Math.min(t.pl/2,(s-e)/4),taperInset:Math.min(.12,(n-r)/4,e/8)})}if(t.fn==="lga"){const e=t.bodywidth??t.w,n=t.bodyheight??t.h,o=t.bodythickness??1,i=t.grid,r=Math.min(t.pw,t.p/2),s=e-((i.y-1)*t.p+r),a=n-((i.x-1)*t.p+r),A=Math.min(t.pl/2,e/8,n/8,s/4,a/4);return De(e2i,{bodyWidth:e,bodyLength:n,bodyHeight:o,landsPerSideX:i.x,landsPerSideY:i.y,pitch:t.p,landWidth:r,landLength:A,edgeInset:0,landThickness:Math.min(.015,o/10)})}return null}var ng=({center:t,width:e,length:n,height:o,heightAboveSurface:i=.15,color:r="#555",taperRatio:s=.12,faceRatio:a=.75,straightHeightRatio:A=.5,includeNotch:c=!0,notchRadius:l,notchPosition:u,notchRotation:g=[0,0,0],notchLength:h=.5,notchWidth:d=.25,chamferSize:p=0})=>{const m=o*A,_=o-m,f=Math.min(e,n)*s,I=Math.max(e-f,e*a),C=Math.max(n-f,n*a),y=Math.min(e,n)*.12,x=l??y,E={x:0,y:n/2-x*.25,z:o},B=u??E,S=Sn(gh,{children:[Sn(ZA,{children:[De(Uo,{z:.005,children:De($t,{size:[I,C,.01]})}),De(Uo,{z:m,children:De($t,{size:[e,n,.01]})})]}),Sn(ZA,{children:[De(Uo,{z:m,children:De($t,{size:[e,n,.01]})}),De(Uo,{z:m+_,children:De($t,{size:[I,C,.01]})})]})]}),Q=(M,k)=>De(Uo,{offset:{x:M,y:k,z:0},children:De(Ac,{rotation:[0,0,Math.PI/4],children:De($t,{size:[p*Math.SQRT2,p*Math.SQRT2,o*3]})})});let w=S;if(p>0){const M=e/2,k=n/2;w=Sn(e0,{children:[S,Q(M,k),Q(-M,k),Q(M,-k),Q(-M,-k)]})}return De(qo,{color:r,children:De(Uo,{offset:t,children:De(Uo,{offset:{x:0,y:0,z:i},children:c?Sn(e0,{children:[w,De(Uo,{offset:B,children:De(Ac,{rotation:g,children:De(Ns,{radius:x,height:d})})})]}):w})})})},o2i=t=>Array.from({length:t},(e,n)=>n);function nze(t,e){if(t.length<2)throw new Error("Stroke must have at least two points");const n=Array.isArray(t[0])?t.map(([l,u])=>({x:l,y:u})):t,o=e/2,i=[],r=[];function s(l,u){const g=u.x-l.x,h=u.y-l.y,d=Math.sqrt(g*g+h*h);return{x:-h/d,y:g/d}}function a(l,u,g){const h={x:l.x+u.x*o*g,y:l.y+u.y*o*g};g>0?i.push(h):r.unshift(h)}const A=s(n[0],n[1]);a(n[0],A,1),a(n[0],A,-1);for(let l=1;l<n.length-1;l++){const u=n[l-1],g=n[l],h=n[l+1],d=s(u,g),p=s(g,h),m=d.x+p.x,_=d.y+p.y,f=Math.sqrt(m*m+_*_);if(f/2>2*o)a(g,d,1),a(g,p,1),a(g,d,-1),a(g,p,-1);else{const C=1/f;a(g,{x:m*C,y:_*C},1),a(g,{x:m*C,y:_*C},-1)}}const c=s(n[n.length-2],n[n.length-1]);return a(n[n.length-1],c,1),a(n[n.length-1],c,-1),[...i,...r]}var i2i=t=>{const e=Math.min(...t.map(a=>a.x)),n=Math.max(...t.map(a=>a.x)),o=Math.min(...t.map(a=>a.y)),s=5.47/(Math.max(...t.map(a=>a.y))-o);return t.map(a=>({x:(a.x-e-(n-e)/2)*s,y:(a.y-o)*s}))},r2i=i2i([{x:20,y:105},{x:20,y:109},{x:20,y:102},{x:26,y:102},{x:26,y:109},{x:24,y:111},{x:24,y:118},{x:22,y:118},{x:22,y:111},{x:20,y:109}]),Qsn=5.47,Bpe=.5,s2i=({x:t,y:e,z:n})=>{const o=t>0;return Sn(Ei,{children:[De(Uo,{offset:{x:t+.25/2,y:e,z:n},children:De(Ac,{rotation:["-90deg",0,"90deg"],children:De(FY,{height:.25,children:De(kY,{points:r2i.slice().reverse().map(i=>[i.x,i.y])})})})}),De(Uo,{offset:{x:t,y:e+(o?1:-1),z:n},children:De(Ac,{rotation:["-90deg","90deg",o?"180deg":"0deg"],children:De(FY,{height:2,children:De(kY,{points:nze([[0,0],[-1,0],[-1,-1]],.25).map(i=>[i.x,i.y])})})})})]})},a2i=({numPins:t=8,pitch:e=2.54,bodyWidth:n=6.4,rowSpacing:o})=>{const i=Math.floor(t/2),r=o??(n>=7?n:n+1.22),s=n>=7?r-1.22:n;return Sn(Ei,{children:[o2i(t).map(a=>{const A=a%i,c=(Math.floor(a/i)-.5)*2;return De(s2i,{x:c*r/2,y:A*e-(i-1)/2*e,z:Qsn/2+Bpe})}),De(ng,{width:s,length:i*e+.5,height:Qsn-Bpe,heightAboveSurface:Bpe,center:{x:0,y:0,z:Bpe}})]})};function A2i(t,{height:e,padContactLength:n,curveLength:o,bodyDistance:i,steepness:r=10}){o||(o=i*.3);let s=i-n-o;s<0&&(o+=s,s=0);const a=n*.75,A=n+o+(i-n-o)*.25;if(t<=a)return 0;if(t>=A)return e;const c=(t-a)/(A-a);return e/(1+Math.exp(-r*(c-.5)))}var ns=t=>{const{thickness:e,width:n,padContactLength:o,bodyDistance:i,height:r,rotation:s}=t,a=15,A=Array.from({length:a}).map((l,u)=>u/(a-1)*i).map(l=>[l,A2i(l,t)]),c=nze(A,e);return De(qo,{color:"#fff",children:De(Uo,{offset:{z:0,y:0,x:0,...t.position},children:De(Ac,{rotation:["90deg",0,s??0],children:De(Uo,{offset:{x:0,y:0,z:-n/2},children:De(FY,{height:n,children:De(kY,{points:c.map(l=>[l.x,l.y])})})})})})})},c2i=({pinCount:t,leadLength:e,leadWidth:n,pitch:o,bodyWidth:i})=>{const r=Math.ceil(t/2),s=r<=4,a=(r-1)*o/2,A=o*Math.max(r-1,0)+(s?1.5:1.15),c=i-(s?.66:.58),l=.15,u=.8,g=1.22,h=e*.5,d=h+Math.max(.22,Math.min(.4,e*.65)),p=i/2+e/2,m=d*.1,_=Math.min(Math.min(c,A)*.18,1),f=Math.min(Math.min(c,A)*.12,.45);return Sn(Ei,{children:[Array.from({length:r}).map((I,C)=>De(ns,{position:{x:-p,y:C*o-a,z:l/2},width:n,thickness:l,padContactLength:h,bodyDistance:d,curveLength:m,height:u})),Array.from({length:r}).map((I,C)=>De(ns,{rotation:Math.PI,position:{x:p,y:C*o-a,z:l/2},width:n,thickness:l,padContactLength:h,bodyDistance:d,curveLength:m,height:u})),De(ng,{center:{x:0,y:0,z:0},width:c,length:A,height:g,notchPosition:{x:-(c/2-_-.2),y:A/2-_-.2,z:g},notchRadius:f})]})},l2i=t=>"leadSpan"in t?Epe(t):c2i(t),u2i=({pinCount:t,padContactLength:e=.4,leadWidth:n=.2,pitch:o=.65,bodyWidth:i=3})=>{const r=Math.ceil(t/2),s=(r-1)*o/2,a=.2;return Sn(Ei,{children:[Array.from({length:r}).map((A,c)=>De(ns,{position:{x:-i/2-e-.3,y:c*o-s,z:a/2},width:n,thickness:a,padContactLength:e,bodyDistance:e+.4,height:.6})),Array.from({length:r}).map((A,c)=>De(ns,{rotation:Math.PI,position:{x:i/2+e+.3,y:c*o-s,z:a/2},width:n,thickness:a,padContactLength:e,bodyDistance:e+.4,height:.6})),De(ng,{center:{x:0,y:0,z:a/2},width:i,length:i,height:1.1,notchRadius:.35,heightAboveSurface:.1,taperRatio:.09})]})},g2i=t=>"leadSpan"in t?Epe(t):u2i(t),oze=1,ize=.5,LY=.5,HX=.2,d2i=oze-HX*2,vsn=({color:t="#333"})=>Sn(Ei,{children:[De($t,{size:[d2i,ize,LY],offset:[0,0,LY/2],color:t}),De($t,{size:[HX,LY,ize],offset:[oze/2-HX/2,0,LY/2],color:"#ccc"}),De($t,{size:[HX,LY,ize],offset:[-oze/2+HX/2,0,LY/2],color:"#ccc"})]}),rze=1.6,h2i=rze-.3*2,bpe=.3,sze=.85,HY=.6,wsn=({color:t="#333"})=>Sn(Ei,{children:[De($t,{size:[h2i,sze,HY],offset:[0,0,HY/2],color:t}),De($t,{size:[bpe,sze,HY],offset:[rze/2-bpe/2,0,HY/2],color:"#ccc"}),De($t,{size:[bpe,sze,HY],offset:[-rze/2+bpe/2,0,HY/2],color:"#ccc"})]}),aze=2,Aze=1.25,OY=.55,OX=.5,p2i=aze-OX*2,Psn=({color:t="#333"})=>Sn(Ei,{children:[De($t,{size:[p2i,Aze,OY],offset:[0,0,OY/2],color:t}),De($t,{size:[OX,Aze,OY],offset:[aze/2-OX/2,0,OY/2],color:"#ccc"}),De($t,{size:[OX,Aze,OY],offset:[-aze/2+OX/2,0,OY/2],color:"#ccc"})]}),Msn=({pinCount:t,pitch:e,leadWidth:n,padContactLength:o,bodyWidth:i})=>{const r=t/4;e||(e=m2i(t,i)),o||(o=_2i(t)),n||(n=f2i(t,i)),i||(i=e*(r+4));const s=o,a=i,A=(r-1)*e/2,c=s*.5,l=a+2*c,u=l,g=.8,h=.15,d=c,p=c*.5,m=c*.18;return Sn(Ei,{children:[Array.from({length:r}).map((_,f)=>De(ns,{position:{x:-u/2,y:f*e-A,z:h/2},width:n,thickness:h,padContactLength:p,bodyDistance:d,curveLength:m,height:g})),Array.from({length:r}).map((_,f)=>De(ns,{rotation:Math.PI,position:{x:u/2,y:f*e-A,z:h/2},width:n,thickness:h,padContactLength:p,bodyDistance:d,curveLength:m,height:g})),Array.from({length:r}).map((_,f)=>De(ns,{rotation:Math.PI/2,position:{x:f*e-A,y:-l/2,z:h/2},width:n,thickness:h,padContactLength:p,bodyDistance:d,curveLength:m,height:g})),Array.from({length:r}).map((_,f)=>De(ns,{rotation:-Math.PI/2,position:{x:f*e-A,y:l/2,z:h/2},width:n,thickness:h,padContactLength:p,bodyDistance:d,curveLength:m,height:g})),De(ng,{center:{x:0,y:0,z:0},width:i,length:a,height:1.5,taperRatio:.03,chamferSize:.7,notchPosition:{x:-(a/2-1.5),y:i/2-1.5,z:1.5},notchRadius:1.5/2})]})},m2i=(t,e)=>{switch(t){case 44:case 64:return .8;case 52:return e===14?1:.65;case 208:return .5;default:return .5}},_2i=t=>{switch(t){case 32:return .6;case 40:return .6;case 52:case 64:return .65;case 208:return 1.65;default:return .6}},f2i=(t,e)=>{switch(t){case 44:case 64:return .5;case 52:return e===14?.45:.55;case 208:return .3;default:return .25}},GY="#c0c0c0",Dsn=({x:t,y:e,pinThickness:n,shortSidePinLength:o,longSidePinLength:i,bodyHeight:r,bodyLength:s=2.54,bodyWidth:a=2.54,flipZ:A,smd:c,rightangle:l})=>Sn(Ei,{children:[De(Uo,{y:l?-3:0,children:De($t,{color:"#222",size:[s,a,r],center:[t,e,A(r/2)]})}),De(qo,{color:GY,children:c?De(ns,{rotation:-Math.PI/2,position:{x:t,y:e+1,z:n/2},thickness:n,width:n,height:n,padContactLength:2,bodyDistance:3}):Sn(ZA,{children:[De($t,{color:GY,size:[n,n,o*.9],center:[t,e,A(r*.9+r/2)]}),De($t,{color:GY,size:[n/1.8,n/1.8,o],center:[t,e,A(r+r/2)]})]})}),De(qo,{color:GY,children:De(Uo,{y:l?-3.9:0,z:l?1:0,children:De(Ac,{rotation:l?[-Math.PI/2,0,0]:[0,0,0],children:Sn(ZA,{children:[De($t,{color:GY,size:[n,n,i*.9],center:[t,e,A(-i/2*.9)]}),De($t,{color:GY,size:[n/1.8,n/1.8,i],center:[t,e,A(-i/2)]})]})})})})]}),Nsn=({numberOfPins:t,pitch:e=2.54,longSidePinLength:n=6,invert:o,rows:i=1,smd:r,rightangle:s})=>{const c=Math.ceil(t/i),l=2.54,u=3,g=-((c-1)/2)*e,d=!r&&!s?!o:!!o,p=m=>d?-m+2:m;return De(Ei,{children:Array.from({length:t},(m,_)=>{const f=Math.floor(_/c),I=_%c,C=g+I*e,y=((i-1)/2-f)*l;return De(Dsn,{x:C,y,pinThickness:.63,shortSidePinLength:u,longSidePinLength:n,bodyHeight:2,flipZ:p,smd:r,rightangle:s},_)})})};function I2i(t){const{num_pins:e,bodyWidth:n,bodyLength:o,bodyHeight:i,standoff:r,terminalSpanX:s,terminalSpanY:a,terminalThickness:A,padWidth:c,padLength:l,pitch:u,exposedPadWidth:g,exposedPadLength:h}=t;for(const _ of["bodyWidth","bodyLength","bodyHeight","terminalSpanX","terminalSpanY","terminalThickness","padWidth","padLength","pitch","exposedPadWidth","exposedPadLength"])if(!Number.isFinite(t[_])||t[_]<=0)throw new Error(`${_} must be finite and positive`);if(!Number.isInteger(e)||e<8||e%4)throw new Error("num_pins must be divisible by four and at least eight");if(!Number.isFinite(r)||r<0)throw new Error("standoff must be finite and nonnegative");const d=(e/4-1)*u+c;if(A<=r||A>=i||c>=u||d>=Math.min(n,o))throw new Error("Invalid mold, terminal thickness or spacing");if(s<n||a<o||s/2-l>=n/2||a/2-l>=o/2||g>=Math.min(n,s-2*l)||h>=Math.min(o,a-2*l)||d>=Math.min(s,a)-2*l)throw new Error("Terminals must enter the mold and clear the exposed pad and corners");const p=De(Uo,{z:(i+r)/2,children:De($t,{size:[n,o,i-r]})}),m=Math.min(n,o)*.035;return Sn(Ei,{children:[De(qo,{color:"#353535",children:Sn(e0,{children:[p,De(Uo,{offset:{x:-n/2+m*2,y:o/2-m*2,z:i},children:De(Ns,{radius:m,height:Math.min(.06,(i-r)/5)})})]})}),De(qo,{color:"#bfc1c4",children:Array.from({length:e},(_,f)=>{const I=Math.floor(f/(e/4)),C=((e/4-1)/2-f%(e/4))*u,y=I%2===0,x=I<2?-1:1,E=((y?s:a)-l)/2*x;return De(Uo,{offset:{x:y?E:C,y:y?C:E,z:A/2},children:De($t,{size:y?[l,c,A]:[c,l,A]})},f)})}),De(qo,{color:"#bfc1c4",children:De(Uo,{z:A/2,children:De($t,{size:[g,h,A]})})})]})}var C2i=t=>{const e=["left","bottom","right","top"],{pin_count:n,pn:o,w:i,h:r,p:s,pl:a}=t,A=n/4,c=e[Math.floor((o-1)/A)],l=(o-1)%A,u=s*(A-1),g=s*(A-1),h=-a/2;switch(c){case"left":return{x:-i/2-h,y:g/2-l*s,o:"vert"};case"bottom":return{x:-u/2+l*s,y:-r/2-h,o:"horz"};case"right":return{x:i/2+h,y:-g/2+l*s,o:"vert"};case"top":return{x:u/2-l*s,y:r/2+h,o:"horz"};default:throw new Error("Invalid pin number")}},y2i=({num_pins:t,cw:e,ccw:n,startingpin:o})=>{const i=[],r=t/4;let s=1;const a={};for(const A of o??[])a[A]=!0;!a.leftside&&!a.topside&&!a.rightside&&!a.bottomside&&(a.leftside=!0),!a.bottompin&&!a.leftpin&&!a.rightpin&&!a.toppin&&(a.leftside?a.toppin=!0:a.topside?a.rightpin=!0:a.rightside?a.bottompin=!0:a.bottomside&&(a.leftpin=!0)),a.leftside&&a.toppin?s=1:a.leftside&&a.bottompin?s=r:a.bottomside&&a.leftpin?s=r+1:a.bottomside&&a.rightpin?s=r*2:a.rightside&&a.bottompin?s=r*2+1:a.rightside&&a.toppin?s=r*3:a.topside&&a.rightpin?s=r*3+1:a.topside&&a.leftpin&&(s=r*4),i.push(-1);for(let A=0;A<t;A++)i[s]=A+1,s++,s>t&&(s=1);return i},x2i=({num_pins:t=16,bodyWidth:e=9,bodyLength:n=9,bodyThickness:o=.8,thermalPadSize:i,padWidth:r=.25,padLength:s=.25,pitch:a=.5,thermalPadThickness:A=.05})=>{const c=y2i({num_pins:t,cw:!0,ccw:!0}),l=[];for(let u=0;u<t;u++){const{x:g,y:h,o:d}=C2i({pin_count:t,pn:u+1,w:e,h:n,p:a,pl:s});let p=r,m=s;d==="vert"&&([p,m]=[m,p]);const _=c[u+1];l.push({pn:_,x:g,y:h,pw:p,pl:m})}return Sn(Ei,{children:[De(qo,{color:"grey",children:De($t,{center:[0,0,o/2],size:[e,n,o]})}),l.map((u,g)=>De($t,{center:[u.x,u.y,A/2],size:[u.pw,u.pl,A]})),i?.length!==void 0&&i?.width!==void 0&&De($t,{center:[0,0,A/2],size:[i.width,i.length,A]})]})},E2i=t=>"bodyHeight"in t?I2i(t):x2i(t),Rsn=E2i,B2i=()=>{const A=1.1999999999999997;return Sn(Ei,{children:[De(ns,{rotation:Math.PI,position:{x:2.8/2+A/4,y:-1,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:A,height:.95}),De(ns,{rotation:Math.PI,position:{x:2.8/2+A/4,y:1,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:A,height:.95}),De(ns,{position:{x:-2.8/2-A/4,y:0,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:A,height:.95}),De(ns,{position:{x:-2.8/2-A/4,y:-1,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:A,height:.95}),De(ns,{position:{x:-2.8/2-A/4,y:1,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:A,height:.95}),De(ng,{center:{x:0,y:0,z:0},width:1.6,length:2.9,height:1.2})]})},Tsn=B2i,b2i=({fullWidth:t=2.9,fullLength:e=2.8,color:n}={})=>{const u=(t-1.3)/2+.3;return Sn(Ei,{children:[De(ns,{position:{x:-t/2,y:.95,z:.075},width:.4,thickness:.15,padContactLength:.4,bodyDistance:u,height:.95}),De(ns,{position:{x:-t/2,y:-.95,z:.075},width:.4,thickness:.15,padContactLength:.4,bodyDistance:u,height:.95}),De(ns,{rotation:Math.PI,position:{x:t/2,y:0,z:.075},width:.4,thickness:.15,padContactLength:.4,bodyDistance:u,height:.95}),De(ng,{center:{x:0,y:0,z:0},width:1.3,length:2.9,height:1.1,color:n})]})},S2i=({fullWidth:t=2.9,fullLength:e=2.8})=>{const l=(t-1.92)/2+.3;return Sn(Ei,{children:[De(ns,{rotation:Math.PI,position:{x:t/2,y:0,z:.075},width:.4,thickness:.15,padContactLength:.25,bodyDistance:l,height:.45}),De(ns,{position:{x:-t/2,y:-.95,z:.075},width:.4,thickness:.15,padContactLength:.25,bodyDistance:l,height:.45}),De(ns,{position:{x:-t/2,y:.95,z:.075},width:.4,thickness:.15,padContactLength:.25,bodyDistance:l,height:.45}),De(ng,{center:{x:0,y:0,z:0},width:1.92,length:2.9,height:1.1,straightHeightRatio:.45,heightAboveSurface:.05})]})},cze=.6,lze=.3,YY=.33,GX=.1,Q2i=cze-GX*2,ksn=({color:t="#333"})=>Sn(Ei,{children:[De($t,{size:[Q2i,lze,YY],offset:[0,0,YY/2],color:t}),De($t,{size:[GX,lze,YY],offset:[cze/2-GX/2,0,YY/2],color:"#ccc"}),De($t,{size:[GX,lze,YY],offset:[-cze/2+GX/2,0,YY/2],color:"#ccc"})]}),uze=.4,gze=.2,UY=.13,YX=.07,v2i=uze-YX*2,Fsn=({color:t="#333"})=>Sn(Ei,{children:[De($t,{size:[v2i,gze,UY],offset:[0,0,UY/2],color:t}),De($t,{size:[YX,gze,UY],offset:[uze/2-YX/2,0,UY/2],color:"#ccc"}),De($t,{size:[YX,gze,UY],offset:[-uze/2+YX/2,0,UY/2],color:"#ccc"})]}),dze=3.2,hze=1.6,KY=.9,UX=.5,w2i=dze-UX*2,Lsn=({color:t="#333"})=>Sn(Ei,{children:[De($t,{size:[w2i,hze,KY],offset:[0,0,KY/2],color:t}),De($t,{size:[UX,hze,KY],offset:[dze/2-UX/2,0,KY/2],color:"#ccc"}),De($t,{size:[UX,hze,KY],offset:[-dze/2+UX/2,0,KY/2],color:"#ccc"})]}),pze=3.2,mze=2.5,VY=1,KX=.6,P2i=pze-KX*2,Hsn=({color:t="#333"})=>Sn(Ei,{children:[De($t,{size:[P2i,mze,VY],offset:[0,0,VY/2],color:t}),De($t,{size:[KX,mze,VY],offset:[pze/2-KX/2,0,VY/2],color:"#ccc"}),De($t,{size:[KX,mze,VY],offset:[-pze/2+KX/2,0,VY/2],color:"#ccc"})]}),_ze=5,fze=2.5,zY=1.4,VX=.6,M2i=_ze-VX*2,Osn=({color:t="#333"})=>Sn(Ei,{children:[De($t,{size:[M2i,fze,zY],offset:[0,0,zY/2],color:t}),De($t,{size:[VX,fze,zY],offset:[_ze/2-VX/2,0,zY/2],color:"#ccc"}),De($t,{size:[VX,fze,zY],offset:[-_ze/2+VX/2,0,zY/2],color:"#ccc"})]}),Ize=6.3,Cze=3.2,JY=1.8,zX=.8,D2i=Ize-zX*2,Gsn=({color:t="#333"})=>Sn(Ei,{children:[De($t,{size:[D2i,Cze,JY],offset:[0,0,JY/2],color:t}),De($t,{size:[zX,Cze,JY],offset:[Ize/2-zX/2,0,JY/2],color:"#ccc"}),De($t,{size:[zX,Cze,JY],offset:[-Ize/2+zX/2,0,JY/2],color:"#ccc"})]}),Ysn=({x:t,y:e,z:n=0,pitch:o=2.54,legsLength:i=3,innerDiameter:r=.945,bodyHeight:s=5,bodyLength:a=o,bodyWidth:A=o,flipZ:c})=>{const l=r||.945,u=l/1.5,g=l,h=g*1.8,d=Math.min(s*.18,o*.24),p=s+.1,m=c(n+p/2),_=n+s-d,f=u*1.6;return Sn(Ei,{children:[De(qo,{color:"#1a1a1a",children:Sn(e0,{children:[De($t,{color:"#000",size:[a,A,s],center:[t,e,c(n+s/2)]}),De($t,{size:[g,g,p],center:[t,e,m]}),Sn(ZA,{children:[De($t,{size:[g,g,.01],center:[t,e,c(_)]}),De($t,{size:[h,h,.01],center:[t,e,c(n+s)]})]})]})}),Sn(qo,{color:"silver",children:[Sn(ZA,{children:[De($t,{color:"silver",size:[u,u,i*.9],center:[t,e,c(n+-i/2*.9)]}),De($t,{color:"silver",size:[u/1.8,u/1.8,i],center:[t,e,c(n+-i/2)]})]}),De($t,{color:"silver",size:[f,f,f*.5],center:[t,e,c(n+f/2*.5)]})]})]})},N2i=({numberOfPins:t,pitch:e=2.54,legsLength:n=3,innerDiameter:o=.945,rows:i=1,invert:r})=>{const a=Math.ceil(t/i),A=2.54,c=-((a-1)/2)*e,l=u=>r?-u+5:u;return De(Ei,{children:Array.from({length:t},(u,g)=>{const h=Math.floor(g/a),d=g%a,p=c+d*e,m=((i-1)/2-h)*A;return De(Ysn,{x:p,y:m,pitch:e,legsLength:n,innerDiameter:o,flipZ:l},g)})})},R2i=({width:t,length:e,innerDiameter:n=1})=>{const o=t,i=e,r=t*.7,s=n/2.5;return Sn(Ei,{children:[De(A1,{color:"#1a1a1f",center:[0,0,r/2],size:[i,i,r],roundRadius:.3}),De(A1,{color:"#f2f2f2",center:[0,0,r+r*.1/2.5],size:[i,i,r*.1],roundRadius:.14}),De(Ns,{color:"#1a1a1f",height:r*.8,radius:o/3,center:[0,0,r+r*.8/2]}),De(Ns,{color:"#1a1a1f",height:r*.2,radius:n/2,center:[i/3,i/3,r+r*.1/2]}),De(Ns,{color:"#1a1a1f",height:r*.2,radius:n/2,center:[-i/3,-i/3,r+r*.1/2]}),De(Ns,{color:"#1a1a1f",height:r*.2,radius:n/2,center:[-i/3,i/3,r+r*.1/2]}),De(Ns,{color:"#1a1a1f",height:r*.2,radius:n/2,center:[i/3,-i/3,r+r*.1/2]}),De(Spe,{thickness:n/3,width:s,horizontalLength:i*.8,verticalLength:r/2,position:{x:-o/2,y:-i/2,z:-r*1.2}}),De(Spe,{thickness:n/3,width:s,horizontalLength:i*.8,verticalLength:r/2,position:{x:-o/2,y:i/2,z:-r*1.2},rotation:Math.PI}),De(Spe,{thickness:n/3,width:s,horizontalLength:i*.8,verticalLength:r/2,position:{x:o/2,y:i/2,z:-r*1.2},rotation:Math.PI}),De(Spe,{thickness:n/3,width:s,horizontalLength:i*.8,verticalLength:r/2,position:{x:o/2+n/3.6,y:-i/2,z:-r*1.2}})]})},Spe=t=>{const{thickness:e,width:n,horizontalLength:o,verticalLength:i,rotation:r=0,position:s}=t,a=[[0,o],[-i/3,o/3],[-i/5,o/4],[0,0]],A=nze(a,e);return De(qo,{color:"#f2f2f2",children:De(Uo,{offset:{x:s?.x||0,y:s?.y||0,z:s?.z||0},children:De(Ac,{rotation:[0,55,r],children:De(FY,{height:n,children:De(kY,{points:A.map(c=>[c.y,c.x])})})})})})},T2i=({pinCount:t,leadLength:e,leadWidth:n,pitch:o,bodyWidth:i})=>{const r=Math.ceil(t/2),s=(r-1)*o/2,a=.25,A=1,c=.8,l=e*0,u=o*(r-1)+n+.2,g=i*.55;return Sn(Ei,{children:[Array.from({length:r}).map((h,d)=>De(ns,{position:{x:-i/2-l,y:d*o-s,z:a/2},width:n,thickness:a,padContactLength:e/2,bodyDistance:e+.3,height:c})),Array.from({length:r}).map((h,d)=>De(ns,{rotation:Math.PI,position:{x:i/2+l,y:d*o-s,z:a/2},width:n,thickness:a,padContactLength:e/2,bodyDistance:e+.3,height:c})),De(ng,{center:{x:0,y:0,z:a/2},width:g,length:u,height:A})]})},k2i=t=>"leadSpan"in t?Epe(t):T2i(t),F2i=({pinCount:t,pitch:e,leadWidth:n,leadLength:o,bodyWidth:i,bodyLength:r})=>{const s=t===8?{pitch:.65,leadWidth:.3}:{pitch:.5,leadWidth:.225},a=isNaN(parseFloat(e))?s.pitch:parseFloat(e),A=isNaN(parseFloat(n))?s.leadWidth:parseFloat(n)*.8,c=isNaN(parseFloat(i))?2.6:parseFloat(i)*.8,l=isNaN(parseFloat(r))?2+Number(a)*1.4:parseFloat(r),u=t/2,g=(u-1)*a/2,h=.15,d=.8,p=4.5,m=(p-c)/2,_=m*.5;return Sn(Ei,{children:[Array.from({length:u}).map((f,I)=>De(ns,{position:{x:-p/2,y:g-I*a,z:h/2},width:A,thickness:h,padContactLength:_+.05,bodyDistance:m+.1,height:d})),Array.from({length:u}).map((f,I)=>De(ns,{rotation:Math.PI,position:{x:p/2,y:g-I*a,z:h/2},width:A,thickness:h,padContactLength:_+.05,bodyDistance:m+.1,height:d})),De(ng,{center:{x:0,y:0,z:h/2},width:c,length:l,height:1})]})},L2i=()=>Sn(Ei,{children:[De($t,{color:"#ccc",size:[.5,.6,.12],center:[-.725,0,.12/2]}),De($t,{color:"#ccc",size:[.5,.6,.12],center:[.725,0,.12/2]}),De(qo,{color:"#222",children:Sn(gh,{children:[De(Uo,{z:.3/2,children:De($t,{size:[1.65,.8,.3]})}),Sn(ZA,{children:[De(Uo,{z:.3,children:De($t,{size:[1.65,.8,.01]})}),De(Uo,{z:.6,children:De($t,{size:[1.65-.2,.8-.2,.01]})})]})]})})]}),Usn=()=>Sn(Ei,{children:[De($t,{color:"#ccc",size:[.26,.51,.12],center:[-.325,0,.12/2]}),De($t,{color:"#ccc",size:[.26,.51,.12],center:[.325,0,.12/2]}),De(qo,{color:"#222",children:De(Uo,{z:.47/2+.02,children:De($t,{size:[.98,.58,.47]})})}),De($t,{color:"#ccc",size:[.98+.001,.26/2,.26/4],center:[0,.26/2,.47/4]}),De($t,{color:"#ccc",size:[.98+.001,.26/2,.26/4],center:[0,-.26/2,.47/4]}),De($t,{color:"#ccc",size:[.26/1.5,.58+.001,.26/4],center:[.65/2,0,.47/4]}),De($t,{color:"#ccc",size:[.26/1.5,.58+.001,.26/4],center:[-.65/2,0,.47/4]})]}),H2i=()=>{const c=De(qo,{color:"#1a1a1a",children:Sn(gh,{children:[Sn(ZA,{children:[De(Uo,{z:.13,children:De($t,{size:[4,3,.03]})}),De(Uo,{z:1.15,children:De($t,{size:[4.4,3.4,.01]})})]}),Sn(ZA,{children:[De(Uo,{z:1.15,children:De($t,{size:[4.4,3.4,.01]})}),De(Uo,{z:2.3,children:De($t,{size:[4,3,.01]})})]})]})}),l=({xDir:u})=>{const d=u*1.78,p=u*(3.4/2-.2/2+1),m=u*(3.4/2-.2/2),_=Math.abs(m-p),f=(p+m)/2;return De(qo,{color:"#c0c0c0",children:Sn(gh,{children:[De($t,{size:[2.3*.8,1.45,.2],center:[d,0,.2/2]}),De($t,{size:[.2,1.45,1.14],center:[p,0,1.14/2+.2]}),De($t,{size:[_,1.45,.2],center:[f,0,.2/2+1.14]})]})})};return Sn(Ei,{children:[De(l,{xDir:1}),De(l,{xDir:-1}),c]})},Ksn=()=>{const c=De(qo,{color:"#1a1a1a",children:Sn(gh,{children:[Sn(ZA,{children:[De(Uo,{z:.13,children:De($t,{size:[4.199999999999999,3.6,.03]})}),De(Uo,{z:1.15,children:De($t,{size:[4.6,4,.01]})})]}),Sn(ZA,{children:[De(Uo,{z:1.15,children:De($t,{size:[4.6,4,.01]})}),De(Uo,{z:2.3,children:De($t,{size:[4.199999999999999,3.6,.01]})})]})]})}),l=({xDir:u})=>{const d=u*2.08,p=u*(4/2-.2/2+1),m=u*(4/2-.2/2),_=Math.abs(m-p),f=(p+m)/2;return De(qo,{color:"#c0c0c0",children:Sn(gh,{children:[De($t,{size:[2.3*.8,1.45,.2],center:[d,0,.2/2]}),De($t,{size:[.2,1.45,1.14],center:[p,0,1.14/2+.2]}),De($t,{size:[_,1.45,.2],center:[f,0,.2/2+1.14]})]})})};return Sn(Ei,{children:[De(l,{xDir:1}),De(l,{xDir:-1}),c]})},O2i=()=>{const c=De(qo,{color:"#1a1a1a",children:Sn(gh,{children:[Sn(ZA,{children:[De(Uo,{z:.21000000000000002,children:De($t,{size:[6.3999999999999995,5.6,.03]})}),De(Uo,{z:1.15,children:De($t,{size:[6.8,6,.01]})})]}),Sn(ZA,{children:[De(Uo,{z:1.15,children:De($t,{size:[6.8,6,.01]})}),De(Uo,{z:2.3,children:De($t,{size:[6.3999999999999995,5.6,.01]})})]})]})}),l=({xDir:u})=>{const d=u*3.08,p=u*(6/2-.2/2+1),m=u*(6/2-.2/2),_=Math.abs(m-p),f=(p+m)/2;return De(qo,{color:"#c0c0c0",children:Sn(gh,{children:[De($t,{size:[2.3*.8,2.95,.2],center:[d,0,.2/2]}),De($t,{size:[.2,2.95,1.14],center:[p,0,1.14/2+.2]}),De($t,{size:[_,2.95,.2],center:[f,0,.2/2+1.14]})]})})};return Sn(Ei,{children:[De(l,{xDir:1}),De(l,{xDir:-1}),c]})},G2i=()=>{const u=De(qo,{color:"#222",children:Sn(gh,{children:[De(Uo,{z:.27,children:De($t,{size:[2.9,1.9,.54]})}),Sn(ZA,{children:[De(Uo,{z:.54,children:De($t,{size:[2.9,1.9,.01]})}),De(Uo,{z:1.08,children:De($t,{size:[2.6999999999999997,1.7,.01]})})]})]})});return Sn(Ei,{children:[De($t,{color:"#ccc",size:[1,1.2,.25],center:[-1.3,0,.25/2]}),De($t,{color:"#ccc",size:[1,1.2,.25],center:[1.3,0,.25/2]}),u]})},Y2i=()=>Sn(Ei,{children:[De($t,{color:"#ccc",size:[1,.6,.12],center:[-1.3,0,.12/2]}),De($t,{color:"#ccc",size:[1,.6,.12],center:[1.3,0,.12/2]}),De(qo,{color:"#222",children:Sn(gh,{children:[De(Uo,{z:.55/2,children:De($t,{size:[2.7,1.6,.55]})}),Sn(ZA,{children:[De(Uo,{z:.55,children:De($t,{size:[2.7,1.6,.01]})}),De(Uo,{z:1.1,children:De($t,{size:[2.7-.2,1.6-.2,.01]})})]})]})})]}),U2i=()=>Sn(Ei,{children:[De($t,{color:"#ccc",size:[1,.9,.2],center:[-1.3,0,.2/2]}),De($t,{color:"#ccc",size:[1,.9,.2],center:[1.3,0,.2/2]}),De(qo,{color:"#222",children:Sn(gh,{children:[De(Uo,{z:.2/2,children:De($t,{size:[2.75,1.8,.2]})}),Sn(ZA,{children:[De(Uo,{z:.2,children:De($t,{size:[2.75,1.8,.01]})}),De(Uo,{z:1,children:De($t,{size:[2.75-.4,1.8-.4,.01]})})]})]})}),De($t,{color:"#777",size:[.2,1.8-.4,.01],center:[-1.3+.4,0,1]})]}),Vsn=({bodyWidth:t=2.6,bodyLength:e=1.7,bodyHeight:n=1}={})=>{const o=t,i=e*.53,r=t*.35,s=.2,a=-(o/2-.075),A=o/2-.075,c=.4,l=.1,u=n*.2;return Sn(Ei,{children:[De($t,{color:"#ccc",size:[r,i,s],center:[a,0,s/2]}),De($t,{color:"#ccc",size:[r,i,s],center:[A,0,s/2]}),De(qo,{color:"#222",children:Sn(gh,{children:[Sn(ZA,{children:[De(Uo,{z:u,children:De($t,{size:[o-l/2,e-l/2,.01]})}),De(Uo,{z:.01,children:De($t,{size:[o-l,e-l,.01]})})]}),Sn(ZA,{children:[De(Uo,{z:u,children:De($t,{size:[o,e,.01]})}),De(Uo,{z:n,children:De($t,{size:[o-c,e-c,.01]})})]})]})}),De($t,{color:"#777",size:[s*2.7,e-c,.02],center:[a+c,0,n]})]})},K2i=({fullWidth:t=3.7,fullLength:e=1.55}={})=>{const n=t-1,o=e,i=1.175,r=.1,s=i-r,a=.55,A=.12,c=.35,l=(t-n)/2,u=.25,g=.2;return Sn(Ei,{children:[De(ns,{position:{x:-t/2,y:0,z:A/2},width:a,thickness:A,padContactLength:u,bodyDistance:l,curveLength:g,height:c}),De(ns,{rotation:Math.PI,position:{x:t/2,y:0,z:A/2},width:a,thickness:A,padContactLength:u,bodyDistance:l,curveLength:g,height:c}),De(ng,{center:{x:0,y:0,z:0},width:n,length:o,height:s,heightAboveSurface:r,includeNotch:!1,color:"#222",taperRatio:.06,straightHeightRatio:.6}),De($t,{color:"#777",size:[.45,o-.15,.02],center:[-n/4,0,i]})]})},V2i=()=>Sn(Ei,{children:[De($t,{color:"#ccc",size:[.9,1.75,.2],center:[-1.825,0,.2/2]}),De($t,{color:"#ccc",size:[.9,1.75,.2],center:[1.825,0,.2/2]}),De(qo,{color:"#222",children:Sn(gh,{children:[Sn(ZA,{children:[De(Uo,{z:.2,children:De($t,{size:[3.8-.05/2,2.5-.05/2,.01]})}),De(Uo,{z:.01,children:De($t,{size:[3.8-.05,2.5-.05,.01]})})]}),Sn(ZA,{children:[De(Uo,{z:.2,children:De($t,{size:[3.8,2.5,.01]})}),De(Uo,{z:1,children:De($t,{size:[3.8-.4,2.5-.4,.01]})})]})]})}),De($t,{color:"#777",size:[.2*2.7,2.5-.4,.02],center:[-1.825+.4,0,1]})]}),z2i=()=>Sn(Ei,{children:[De($t,{color:"#ccc",size:[.4,.25,.14],center:[-.4,0,.14/2]}),De($t,{color:"#ccc",size:[.4,.25,.14],center:[.4,0,.14/2]}),De(qo,{color:"#222",children:Sn(gh,{children:[De(Uo,{z:.14/2,children:De($t,{size:[.8,.6,.14]})}),Sn(ZA,{children:[De(Uo,{z:.14,children:De($t,{size:[.8,.6,.01]})}),De(Uo,{z:.37,children:De($t,{size:[.8-.1,.6-.1,.01]})})]})]})})]}),zsn=({fullWidth:t=6.6,bodyWidth:e=3.5,bodyLength:n=6.5,bodyHeight:o=1.7,leadWidth:i=.7,tabLeadWidth:r=3,padPitch:s=2.3,leadHeight:a=.75}={})=>{const A=r,c=.25,l=.5,u=t-e;return Sn(Ei,{children:[De(ns,{rotation:Math.PI,position:{x:t/2+u/4,y:0,z:c/2},width:A,thickness:c,padContactLength:l,bodyDistance:u,height:a}),De(ns,{position:{x:-t/2-u/4,y:0,z:c/2},width:i,thickness:c,padContactLength:l,bodyDistance:u,height:a}),De(ns,{position:{x:-t/2-u/4,y:-s,z:c/2},width:i,thickness:c,padContactLength:l,bodyDistance:u,height:a}),De(ns,{position:{x:-t/2-u/4,y:s,z:c/2},width:i,thickness:c,padContactLength:l,bodyDistance:u,height:a}),De(ng,{center:{x:0,y:0,z:0},width:e,length:n,height:o,includeNotch:!1,taperRatio:.06,straightHeightRatio:.45})]})},J2i=()=>Sn(Ei,{children:[Array.from({length:16}).map((h,d)=>De(ns,{position:{x:-10.5/2,y:d*.5-3.75,z:.25/2},width:.2,thickness:.25,padContactLength:.45,bodyDistance:.95,height:.65})),Array.from({length:16}).map((h,d)=>De(ns,{rotation:Math.PI,position:{x:10.5/2,y:d*.5-3.75,z:.25/2},width:.2,thickness:.25,padContactLength:.45,bodyDistance:.95,height:.65})),Array.from({length:16}).map((h,d)=>De(ns,{rotation:Math.PI/2,position:{x:d*.5-3.75,y:-10.5/2,z:.25/2},width:.2,thickness:.25,padContactLength:.45,bodyDistance:.95,height:.65})),Array.from({length:16}).map((h,d)=>De(ns,{rotation:-Math.PI/2,position:{x:d*.5-3.75,y:10.5/2,z:.25/2},width:.2,thickness:.25,padContactLength:.45,bodyDistance:.95,height:.65})),De(ng,{center:{x:0,y:0,z:0},width:9,length:9,height:1.2,chamferSize:.7,taperRatio:.05,notchPosition:{x:-3.5,y:3.5,z:1.2},notchRadius:1.2/2})]}),W2i=J2i,j2i=()=>{const c=.7999999999999998;return Sn(Ei,{children:[De(ns,{rotation:Math.PI,position:{x:2.05/2+c/4,y:0,z:.18/2},width:.3,thickness:.18,padContactLength:.2,bodyDistance:c,height:.65}),De(ns,{position:{x:-2.05/2-c/4,y:-.65,z:.18/2},width:.3,thickness:.18,padContactLength:.2,bodyDistance:c,height:.65}),De(ns,{position:{x:-2.05/2-c/4,y:.65,z:.18/2},width:.3,thickness:.18,padContactLength:.2,bodyDistance:c,height:.65}),De(ng,{center:{x:0,y:0,z:0},width:1.25,length:2,height:.9,includeNotch:!1,taperRatio:.06,straightHeightRatio:.7,heightAboveSurface:.05})]})};function $2i(t){const{pinCount:e,pitch:n,bodyWidth:o,bodyLength:i,bodyHeight:r,standoff:s,leadSpanX:a,leadSpanY:A,leadWidth:c,leadThickness:l,contactLength:u,taperInset:g}=t;for(const x of["pitch","bodyWidth","bodyLength","bodyHeight","leadSpanX","leadSpanY","leadWidth","leadThickness","contactLength"])if(!Number.isFinite(t[x])||t[x]<=0)throw new Error(`${x} must be finite and positive`);for(const[x,E]of Object.entries({standoff:s,taperInset:g}))if(!Number.isFinite(E)||E<0)throw new Error(`${x} must be finite and nonnegative`);if(!Number.isInteger(e)||e<8||e%4)throw new Error("pinCount must be divisible by four and at least eight");const h=r-s,d=Math.min(a-o,A-i)/2,p=(e/4-1)*n+c;if(h<=l*2||c>=n||p>=Math.min(o,i)-2*g||g*2>=Math.min(o,i)||u>=d)throw new Error("Invalid mold, lead spacing, or terminal reach");const m=s+h/2,_=Math.min(.002,h/100),f=Sn(ZA,{children:[De(Uo,{z:s+_/2,children:De($t,{size:[o-2*g,i-2*g,_]})}),De(Uo,{z:m,children:De($t,{size:[o,i,_]})}),De(Uo,{z:r-_/2,children:De($t,{size:[o-2*g,i-2*g,_]})})]}),I=Math.min(o,i)*.045,C=Math.min(.04,h/10),y=(x,E)=>{const B=x%2===0,S=x<2?-1:1,Q=B?o:i,w=(B?a:A)/2,M=Q/2-Math.min(Q/8,.15),k=w-u,R=Q/2+Math.min(.08,(d-u)/4),F=[[w-_/2,l/2],[k,l/2]];for(let U=1;U<=12;U++){const Y=U/12;F.push([k+(R-k)*Y,l/2+(m-l/2)*Y*Y*(3-2*Y)])}F.push([M,m]);const O=([U,Y])=>De(Uo,{offset:{x:B?S*U:E,y:B?E:S*U,z:Y},children:De($t,{size:B?[_,c,l]:[c,_,l]})});return De(gh,{children:F.slice(1).map((U,Y)=>Sn(ZA,{children:[O(F[Y]),O(U)]}))})};return Sn(Ei,{children:[De(qo,{color:"#353535",children:Sn(e0,{children:[f,De(Uo,{offset:{x:-o/2+g+I*2,y:i/2-g-I*2,z:r},children:De(Ns,{radius:I,height:C*2})})]})}),De(qo,{color:"#bfc1c4",children:Array.from({length:e},(x,E)=>y(Math.floor(E/(e/4)),((e/4-1)/2-E%(e/4))*n))})]})}var q2i=({pinCount:t,pitch:e,leadWidth:n,padContactLength:o,bodyWidth:i})=>{const r=t/4;if(r!==Math.floor(r))throw new Error(`LQFP pinCount must be divisible by 4, got ${t}`);e||(e=.5),o||(o=.6),n||(n=.22),i||(i=e*(r+4));const s=i,a=(r-1)*e/2,A=s+3.3*o,c=A,l=.8,u=.2,g=(c-i)/2+.4;return Sn(Ei,{children:[Array.from({length:r}).map((h,d)=>De(ns,{position:{x:-c/2-.36,y:d*e-a,z:u/2},width:n,thickness:u,padContactLength:o,bodyDistance:g,height:l})),Array.from({length:r}).map((h,d)=>De(ns,{rotation:Math.PI,position:{x:c/2+.36,y:d*e-a,z:u/2},width:n,thickness:u,padContactLength:o,bodyDistance:g,height:l})),Array.from({length:r}).map((h,d)=>De(ns,{rotation:Math.PI/2,position:{x:d*e-a,y:-A/2-.36,z:u/2},width:n,thickness:u,padContactLength:o,bodyDistance:g,height:l})),Array.from({length:r}).map((h,d)=>De(ns,{rotation:-Math.PI/2,position:{x:d*e-a,y:A/2+.36,z:u/2},width:n,thickness:u,padContactLength:o,bodyDistance:g,height:l})),De(ng,{center:{x:0,y:0,z:0},width:i,length:s,height:1.5,heightAboveSurface:.1,taperRatio:.04,chamferSize:.7,notchPosition:{x:-(s/2-1.5),y:s/2-1.5,z:1.5},notchRadius:1.5/2})]})},X2i=t=>"leadSpanX"in t?$2i(t):q2i(t),Z2i=()=>{const o=.20900000000000002,i=.1,r=.3,s=.1,a=.2;return Sn(Ei,{children:[De(qo,{color:"#222",children:Sn(gh,{children:[De($t,{size:[.85,1.2,o],center:[0,0,o/2]}),Sn(ZA,{children:[De(Uo,{z:o,children:De($t,{size:[.85,1.2,.01]})}),De(Uo,{z:.38,children:De($t,{size:[.85-i,1.2-i,.01]})})]})]})}),De($t,{color:"#ccc",size:[r,.25,s],center:[.55,0,s/2]}),De($t,{color:"#ccc",size:[r,a,s],center:[-.55,.4,s/2]}),De($t,{color:"#ccc",size:[r,a,s],center:[-.55,-.4,s/2]})]})},Jsn=({num_pins:t,bodyWidth:e=5.3,bodyLength:n=5.3,bodyThickness:o=1,thermalPadSize:i,padWidth:r=n/5.3*.6,padLength:s=n/5.3*1,pitch:a=.5,thermalPadThickness:A=.2,bodyStyle:c="chamfered",standoff:l=0,terminalInset:u=0,terminalThickness:g=A,pin1TerminalChamfer:h=0,pin1MarkWidth:d=0})=>{if(c==="rectangular"){if(!Number.isInteger(t)||t<2||t%2!==0)throw new Error("DFN requires an even pin count of at least two");for(const f of[e,n,o,r,s,a,g])if(!Number.isFinite(f)||f<=0)throw new Error("DFN dimensions must be finite and positive");for(const f of[l,u,h,d])if(!Number.isFinite(f)||f<0)throw new Error("DFN offsets must be finite and nonnegative");if(g<=l||g>l+o||u+s>=e/2||(t/2-1)*a+r>n||t>2&&r>=a||h>=Math.min(s,r/2)||d>=e/4)throw new Error("DFN dimensions leave disconnected or overlapping terminals")}const p=[],m=Math.floor(t/2),_=a*(m-1);for(let f=0;f<t;f++){const I=f<m?"left":"right",C=f%m,y=_/2-C*a,x=s,E=r,B=I==="left"?-e/2+x/2+u:e/2-x/2-u,S=f+1;p.push({pinNumber:S,x:B,y,padSizeX:x,padSizeY:E})}if(c==="rectangular"){const f=l+o,I=Math.min(o,n)/100,C=De($t,{size:[d,n*.8,I],center:[-e/2+d*1.5,0,f-I/2]}),y=De($t,{size:[e,n,o],center:[0,0,l+o/2]});return Sn(Ei,{children:[De(qo,{color:"#25272a",children:d>0?Sn(e0,{children:[y,C]}):y}),De(qo,{color:"#c7c9cd",children:p.map(x=>x.pinNumber===1&&h>0?Sn(ZA,{children:[De($t,{size:[s-h,r,g],center:[x.x+h/2,x.y,g/2]}),De($t,{size:[s,r-2*h,g],center:[x.x,x.y,g/2]})]},x.pinNumber):De($t,{size:[x.padSizeX,x.padSizeY,g],center:[x.x,x.y,g/2]},x.pinNumber))}),i&&De($t,{color:"#c7c9cd",size:[i.width,i.length,A],center:[0,0,A/2]}),d>0&&De(qo,{color:"#969997",children:C})]})}return Sn(Ei,{children:[De(ng,{center:{x:0,y:0,z:0},width:e,length:n,height:o,heightAboveSurface:0,color:"grey",chamferSize:.2,taperRatio:0,notchPosition:{x:-(e/2-s),y:n/2-s,z:o}}),p.map((f,I)=>De($t,{center:[f.x,f.y,A/2],size:[f.padSizeX,f.padSizeY,A]})),i?.length!==void 0&&i?.width!==void 0&&De($t,{center:[0,0,A/2],size:[i.width,i.length,A]})]})},exi=({bodyLength:t=10.2,bodyWidth:e=4.65,bodyHeight:n=13.46,leadSpacing:o=5,leadDiameter:i=.8,leadLength:r=12.7,color:s="#ddd",leadColor:a="#b87333"})=>{const A=t/2,c=e/2,l=A-c,u=o/2,g=.85;return Sn(Ei,{children:[Sn(qo,{color:s,children:[Sn(ZA,{children:[De(a2,{height:n,roundRadius:.5,radius:c,center:[-l,0,n]}),De(a2,{height:n,roundRadius:.5,radius:c,center:[l,0,n]})]}),Sn(ZA,{children:[De(a2,{height:g,roundRadius:.1,radius:c+.85,center:[-l,0,n/2+g/2]}),De(a2,{height:g,roundRadius:.1,radius:c+.85,center:[l,0,n/2+g/2]})]})]}),Sn(qo,{color:a,children:[De(Ns,{height:r+n/2,radius:i/2,center:[-u+.06,0,-(r/2)+n/2]}),De(Ns,{height:r+n/2,radius:i/2,center:[u-.06,0,-(r/2)+n/2]})]})]})},txi=({bodyLength:t=1.4,bodyDiameter:e=1.1,color:n="#3a3a3aff",contactColor:o="#c6c6c6",cathodeIdentification:i="#111"})=>Sn(Ei,{children:[De(qo,{color:n,children:Sn(Ac,{rotation:[0,"90deg",0],children:[De(A1,{size:[e,e,t-.2],roundRadius:.2,center:[-e/2,0,.05]}),De(Ns,{height:.2/2,radius:e/2-.2,center:[-e/2,0,-t/2+.2/2]})]})}),De(qo,{color:i,children:De(Ac,{rotation:[0,"90deg",0],children:De(A1,{size:[e*1.01,e*1.01,t/3],roundRadius:.2,center:[-e/2,0,-t/4+.1]})})}),De(qo,{color:o,children:De(Ac,{rotation:[0,"90deg",0],children:De(a2,{height:.2,radius:e/2,roundRadius:.2/3,center:[-e/2,0,-t/2]})})}),De(qo,{color:o,children:De(Ac,{rotation:[0,"90deg",0],children:De(a2,{height:.2,radius:e/2,roundRadius:.2/3,center:[-e/2,0,t/2]})})})]}),Wsn=({bodyLength:t=3.5,bodyDiameter:e=1.5,color:n="#202020",contactColor:o="#c6c6c6",bandColor:i="#f2f2f2"})=>{const s=t-.8+.04,a=(t-.4)/2,A=e/2+.02,c=.14,l=-t/2+.4+.35;return Sn(Ei,{children:[De(qo,{color:n,children:De(Ac,{rotation:[0,"90deg",0],children:De(a2,{height:s,radius:e/2,roundRadius:.05,center:[-e/2,0,0]})})}),De(qo,{color:i,children:De(Ac,{rotation:[0,"90deg",0],children:De(Ns,{height:c,radius:e/2+.002,center:[-e/2,0,l]})})}),De(qo,{color:o,children:De(Ac,{rotation:[0,"90deg",0],children:De(a2,{height:.4,radius:A,roundRadius:.04,center:[-e/2,0,-a]})})}),De(qo,{color:o,children:De(Ac,{rotation:[0,"90deg",0],children:De(a2,{height:.4,radius:A,roundRadius:.04,center:[-e/2,0,a]})})})]})},nxi=({bodyLength:t=3.9,bodyDiameter:e=2.5,color:n="#3a3a3aff",contactColor:o="#c6c6c6"})=>Sn(Ei,{children:[De(qo,{color:n,children:De(Ac,{rotation:[0,"90deg",0],children:De(a2,{height:t,radius:e/2,roundRadius:.3,center:[-e/2,0,0]})})}),De(qo,{color:o,children:De(Ac,{rotation:[0,"90deg",0],children:De(a2,{height:.55,radius:e/2,roundRadius:.2,center:[-e/2,0,-t/2]})})}),De(qo,{color:o,children:De(Ac,{rotation:[0,"90deg",0],children:De(a2,{height:.55,radius:e/2,roundRadius:.2,center:[-e/2,0,t/2]})})})]}),oxi=({pinCount:t,padContactLength:e=.6,leadWidth:n=.41,pitch:o=1.27})=>{if(t%2!==0)throw new Error("MS012 pinCount must be even");const i=t/2,r=4.9,s=3.9,a=(i-1)*o/2,A=.2;return Sn(Ei,{children:[Array.from({length:i}).map((c,l)=>De(ns,{position:{x:-s/2-e-.3,y:l*o-a,z:A/2},width:n,thickness:A,padContactLength:e,bodyDistance:e+.4,height:.85})),Array.from({length:i}).map((c,l)=>De(ns,{rotation:Math.PI,position:{x:s/2+e+.3,y:l*o-a,z:A/2},width:n,thickness:A,padContactLength:e,bodyDistance:e+.4,height:.85})),De(ng,{center:{x:0,y:0,z:A/2},width:s,length:r,height:1.55,notchPosition:{x:-.95,y:r/2-1,z:1.55},heightAboveSurface:.17,taperRatio:.09})]})},ixi=({pinCount:t=16,padContactLength:e=.6,leadWidth:n=.41,pitch:o=1.27})=>{if(t!==16)throw new Error("MS013 only supports 16 pins");const i=t/2,r=7.5,s=10.3,a=(i-1)*o/2,A=.2;return Sn(Ei,{children:[Array.from({length:i}).map((c,l)=>De(ns,{position:{x:-r/2-e-.3,y:l*o-a,z:A/2},width:n,thickness:A,padContactLength:e,bodyDistance:e+.4,height:.85})),Array.from({length:i}).map((c,l)=>De(ns,{rotation:Math.PI,position:{x:r/2+e+.3,y:l*o-a,z:A/2},width:n,thickness:A,padContactLength:e,bodyDistance:e+.4,height:.85})),De(ng,{center:{x:0,y:0,z:A/2},width:r,length:s,height:1.1,notchPosition:{x:-2.25,y:s/2-1.5,z:1.1},heightAboveSurface:.17,taperRatio:.05})]})},rxi=[{x:-2.54,y:-1},{x:0,y:-1},{x:2.54,y:-1}],jsn=({mouldedTab:t=!1,leads:e=rxi,bodyWidth:n=10,bodyThickness:o=4.5,bodyHeight:i=9.2,tabHeight:r=6.4,tabThickness:s=1.4,mountingHoleDiameter:a=3.6,standoff:A=3,leadLength:c=3,bodyColor:l="#222",tabColor:u="#ccc",leadColor:g="#d4b106"}={})=>{const h=e.reduce((x,E)=>x+E.x,0)/e.length,d=e.reduce((x,E)=>x+E.y,0)/e.length,p=A,m=p+i,_=m+r,f=d+(o-s)/2,I=_-Math.max(a*.8,2.6),C=.8,y=.5;return Sn(Ei,{children:[De(qo,{color:l,children:De($t,{size:[n,o,i],center:[h,d,p+i/2]})}),De(qo,{color:t?l:u,children:Sn(e0,{children:[De($t,{size:[n,s,r],center:[h,f,m+r/2]}),De(Ac,{rotation:["90deg",0,0],children:De(Uo,{center:[h,I,-f],children:De(Ns,{radius:a/2,height:s*3})})})]})}),e.map(x=>De(qo,{color:g,children:De($t,{size:[C,y,A+c],center:[x.x,x.y,(A-c)/2]})},`lead-${x.x}-${x.y}`))]})},sxi=()=>{const c=1.1999999999999997;return Sn(Ei,{children:[De(ns,{rotation:Math.PI,position:{x:2.8/2+c/4,y:-.95,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:c,height:.95}),De(ns,{rotation:Math.PI,position:{x:2.8/2+c/4,y:0,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:c,height:.95}),De(ns,{rotation:Math.PI,position:{x:2.8/2+c/4,y:.95,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:c,height:.95}),De(ns,{position:{x:-2.8/2-c/4,y:0,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:c,height:.95}),De(ns,{position:{x:-2.8/2-c/4,y:-.95,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:c,height:.95}),De(ns,{position:{x:-2.8/2-c/4,y:.95,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:c,height:.95}),De(ng,{center:{x:0,y:0,z:0},width:1.6,length:2.9,height:1.2,straightHeightRatio:.6,notchPosition:{x:-.4,y:1.2/2+.4,z:1.2+.05},notchRadius:.1})]})},axi=()=>Sn(Ei,{children:[De(ng,{center:{x:0,y:0,z:0},width:.8,length:1,height:.37,heightAboveSurface:0,color:"#1a1a1a",taperRatio:.15,straightHeightRatio:0,notchPosition:{x:-.8/4,y:.7/2.2,z:.37+.1}}),[0,1,2].map(c=>{const l=-.35+c*.35;return De($t,{center:[-.8/2+.19/2-.1,l,.12/2],size:[.19,.15,.12]})}),[0,1,2].map(c=>{const l=-.35+c*.35;return De($t,{center:[.8/2-.19/2+.1,l,.12/2],size:[.19,.15,.12]})})]}),Axi=[{x:-1.27,y:.98},{x:0,y:2.25},{x:1.27,y:.98}],cxi=t=>{let e=[t[0],t[t.length-1]],n=-1;for(let o=0;o<t.length;o++)for(let i=o+1;i<t.length;i++){const r=Math.hypot(t[o].x-t[i].x,t[o].y-t[i].y);r>n&&(n=r,e=[t[o],t[i]])}return{outer:e,separation:n}},$sn=({bodyDiameter:t=4.8,bodyHeight:e=4.5,flatCut:n=1.1,leads:o=Axi,standoff:i=1.5,leadLength:r=3,bodyColor:s="#222"}={})=>{const a=t/2,A=.4,c=.25,{outer:l,separation:u}=cxi(o),[g,h]=l,d={x:(g.x+h.x)/2,y:(g.y+h.y)/2},p=Math.max(u,.001),m={x:(h.x-g.x)/p,y:(h.y-g.y)/p},_=u/2,f=C=>{const y=(C-(o.length-1)/2)*_;return{x:d.x+m.x*y,y:d.y+m.y*y}},I=[c,A,c];return Sn(Ei,{children:[De(qo,{color:s,children:Sn(e0,{children:[De(Uo,{center:[d.x,d.y,i+e/2],children:De(Ns,{radius:a,height:e})}),De(Uo,{center:[d.x,d.y-(a-n/2),i+e/2],children:De($t,{size:[a*2,n,e+.2]})})]})}),o.map((C,y)=>{const x=f(y);return Sn(Uo,{center:[0,0,0],children:[Sn(ZA,{children:[De(Uo,{center:[C.x,C.y,0],children:De($t,{size:I})}),De(Uo,{center:[x.x,x.y,i],children:De($t,{size:I})})]}),De(Uo,{center:[C.x,C.y,-r/2],children:De($t,{size:[c,A,r]})})]},`lead-${C.x}-${C.y}`)})]})},lxi=()=>Sn(Ei,{children:[De(ns,{rotation:Math.PI,position:{x:2/2+.75/4,y:-.65,z:.15/2},width:.25,thickness:.15,padContactLength:.3,bodyDistance:.75,height:.85}),De(ns,{rotation:Math.PI,position:{x:2/2+.75/4,y:0,z:.15/2},width:.25,thickness:.15,padContactLength:.3,bodyDistance:.75,height:.85}),De(ns,{rotation:Math.PI,position:{x:2/2+.75/4,y:.65,z:.15/2},width:.25,thickness:.15,padContactLength:.3,bodyDistance:.75,height:.85}),De(ns,{position:{x:-2/2-.75/4,y:0,z:.15/2},width:.25,thickness:.15,padContactLength:.3,bodyDistance:.75,height:.85}),De(ns,{position:{x:-2/2-.75/4,y:-.65,z:.15/2},width:.25,thickness:.15,padContactLength:.3,bodyDistance:.75,height:.85}),De(ns,{position:{x:-2/2-.75/4,y:.65,z:.15/2},width:.25,thickness:.15,padContactLength:.3,bodyDistance:.75,height:.85}),De(ng,{center:{x:0,y:0,z:0},width:1.25,length:2,height:1.1,straightHeightRatio:.6,notchPosition:{x:-.375,y:1.1/2+.2,z:1.1},heightAboveSurface:.1})]}),uxi=lxi,gxi=()=>Sn(Ei,{children:[De(ng,{center:{x:0,y:0,z:.05},width:1,length:1.45,height:.5,heightAboveSurface:0,color:"#1a1a1a",taperRatio:0,includeNotch:!1}),[0,1,2].map(a=>{const A=-.5+a*.5;return De($t,{center:[-1/2+.3/2,A,.05/2],size:[.3,.2,.05]})}),[0,1,2].map(a=>{const A=-.5+a*.5;return De($t,{center:[1/2-.3/2,A,.05/2],size:[.3,.2,.05]})})]}),qsn=()=>Sn(Ei,{children:[De(ns,{position:{x:-2.5/2,y:0,z:.175/2},width:.3,thickness:.175,padContactLength:.3,bodyDistance:.45,height:.7}),De(ns,{rotation:Math.PI,position:{x:2.5/2,y:0,z:.175/2},width:.3,thickness:.175,padContactLength:.3,bodyDistance:.45,height:.7}),De(qo,{color:"#222",children:De(ng,{center:{x:0,y:0,z:0},width:1.8,length:1.4,height:.95,includeNotch:!1,taperRatio:.06,straightHeightRatio:.7,heightAboveSurface:.05})}),De($t,{color:"#777",size:[1.8/3,1.4-.075,.02],center:[-.9*2/3+.035,0,.95+.05]})]}),dxi=()=>Sn(Ei,{children:[De($t,{color:"#ccc",size:[.4,.325,.175],center:[-1.05,0,.175/2]}),De($t,{color:"#ccc",size:[.4,.325,.175],center:[1.05,0,.175/2]}),De(qo,{color:"#222",children:Sn(gh,{children:[De(Uo,{z:.175/2,children:De($t,{size:[1.7,1.25,.175]})}),Sn(ZA,{children:[De(Uo,{z:.175,children:De($t,{size:[1.7,1.25,.01]})}),De(Uo,{z:.725,children:De($t,{size:[1.7-.2,1.25-.2,.01]})})]})]})}),De($t,{color:"#777",size:[1.7/3,1.25-.2,.02],center:[-1.05+1.7/4.4+.2,0,.725]})]}),hxi=()=>{const s=-1.0474999999999999,a=1.775/2+.4/2-.04;return Sn(Ei,{children:[De($t,{color:"#ccc",size:[.4,.325,.13],center:[s,0,.13/2]}),De($t,{color:"#ccc",size:[.4,.325,.13],center:[a,0,.13/2]}),De(qo,{color:"#222",children:De(ng,{width:1.775,length:1.25,height:.725,center:{x:0,y:0,z:0},heightAboveSurface:0,straightHeightRatio:.7,taperRatio:.06,includeNotch:!1})}),De($t,{color:"#777",size:[1.775/3,1.25-.05,.02],center:[s+1.775/4.4+.2,0,.725]})]})},pxi=({pitch:t=10})=>Sn(Ei,{children:[De(Ns,{height:4,radius:.5,center:[-t/2,0,.5]}),De(TY,{radius:.5,center:[-t/2,0,2.5]}),De(Uo,{x:-2.5,y:0,z:2.5,children:Sn(Ac,{rotation:[0,Math.PI/2,0],children:[De(Ns,{height:t,radius:.5,center:[0,0,2.5]}),De(qo,{color:"#d2b48c",children:De(Ns,{height:5,radius:1.3,center:[0,0,2.5]})})]})}),De(Ns,{height:4,radius:.5,center:[t/2,0,.5]}),De(TY,{radius:.5,center:[t/2,0,2.5]})]}),mxi=({bodyWidth:t=21,boardThickness:e=.5,leadWidth:n=1.6,leadLength:o=2.4,leadsPitch:i=2.54,leadsLeft:r,leadsRight:s,leadsTop:a,leadsBottom:A,innerHoles:c=!0,innerHoleEdgeDistance:l=1.61,innerHoleDiameter:u=1})=>{const g=t/2,h=e/2,d=e*1.05,p=u/2,m=Math.max(r||0,s||0,a||0,A||0)*i||51,_=[],f=[];if(s){const x=-((s-1)/2)*i;for(let E=0;E<s;E++){const B=x+E*i;_.push({x:g-o/2,y:-B,pl:o,pw:n}),c&&f.push({x:g,y:-B},{x:g-l,y:-B})}}if(r){const x=-((r-1)/2)*i;for(let E=0;E<r;E++){const B=x+E*i;_.push({x:-g+o/2,y:-B,pl:o,pw:n}),c&&f.push({x:-g,y:-B},{x:-g+l,y:-B})}}if(a){const x=-((a-1)/2)*i;for(let E=0;E<a;E++){const B=x+E*i;_.push({x:-B,y:m/2-o/2,pl:n,pw:o}),c&&f.push({x:-B,y:m/2},{x:-B,y:m/2-l})}}if(A){const x=-((A-1)/2)*i;for(let E=0;E<A;E++){const B=x+E*i;_.push({x:-B,y:-m/2+o/2,pl:n,pw:o}),c&&f.push({x:-B,y:-m/2},{x:-B,y:-m/2+l})}}const I=De(qo,{color:"#051a0a",children:Sn(e0,{children:[De($t,{center:[0,0,h],size:[t,m,e]}),_.map((x,E)=>De($t,{center:[x.x,x.y,h],size:[x.pl+.01,x.pw+.01,d]},E))]})}),C=c&&f.map((x,E)=>De(Ns,{color:"black",center:[x.x,x.y,h],radius:p,height:e*1.07})),y=_.map((x,E)=>De($t,{center:[x.x,x.y,h],size:[x.pl+.01,x.pw+.01,d]}));return Sn(Ei,{children:[I,De(qo,{color:"#FFD700",children:c?Sn(e0,{children:[De(gh,{children:_.map((x,E)=>De($t,{center:[x.x,x.y,h],size:[x.pl+.01,x.pw+.01,d]},E))}),C]}):y})]})},Xsn=({width:t=30,height:e=22,thickness:n=1,bezelInset:o=2,bezelDepth:i=1,screenColor:r="#001414",bezelColor:s="#0f1116",screenWidth:a,screenHeight:A,offset:c})=>{const l=t,u=e,g=Math.max(n,.4),h=Math.max(Math.min(i,g),.2),d=Math.max(g-h,0),p=Math.max(o,0),m=Math.max(a??l-p*2,2),_=Math.max(A??u-p*2,2),f=Math.min(Math.max(h*.6,.2),h),I=c?.x??0,C=c?.y??0,y=c?.z??0;return Sn(Uo,{offset:{x:I,y:C,z:y},children:[d>0&&De(qo,{color:s,children:De($t,{size:[l,u,d],offset:[0,0,d/2]})}),De(qo,{color:s,children:Sn(e0,{children:[De($t,{size:[l,u,h],offset:[0,0,d+h/2]}),De($t,{size:[m,_,h+.02],offset:[0,0,d+h/2]})]})}),De(qo,{color:r,children:De($t,{size:[m,_,f],offset:[0,0,d+f/2]})})]})},_xi=({numPins:t=5,rows:e=1,p:n=2.54,id:o=1,od:i=1.5,boardThickness:r=1.6,width:s,height:a,pinRowSide:A="left",holes:c=[],holeInset:l=1,pinRowHoleEdgeToEdgeDist:u=2,female:g,nopin:h,screen:d,screenWidth:p,screenHeight:m,screenCenterOffsetX:_,screenCenterOffsetY:f})=>{const I=d??!1,C=r/2,y=Math.ceil(t/e);let x,E;A==="left"||A==="right"?(x=(e-1)*n+2*u,E=(y-1)*n+2*u):(E=(e-1)*n+2*u,x=(y-1)*n+2*u),t===0&&(x=10,E=10);const B=Number(s??x),S=Number(a??E),Q=[];let w=0,M=0,k=0,R=0,F=0,O=0;A==="left"||A==="right"?(w=A==="left"?-B/2+u:B/2-u,M=-((y-1)/2)*n,k=0,R=n,F=A==="left"?n:-n,O=0):(w=-((y-1)/2)*n,M=A==="top"?S/2-u:-S/2+u,k=n,R=0,F=0,O=A==="top"?-n:n);let U=0;for(let ue=0;ue<e&&U<t;ue++)for(let fe=0;fe<y&&U<t;fe++){const pe=w+fe*k+ue*F,ye=M+fe*R+ue*O;Q.push({x:pe,y:ye}),U++}const Y=[];if(c)for(const ue of c){let fe=0,pe=0;ue==="topleft"?(fe=-B/2+l,pe=S/2-l):ue==="topright"?(fe=B/2-l,pe=S/2-l):ue==="bottomleft"?(fe=-B/2+l,pe=-S/2+l):ue==="bottomright"?(fe=B/2-l,pe=-S/2+l):ue==="center"&&(fe=0,pe=0),Y.push({x:fe,y:pe})}const W=.63,te=2,j=6,J=3,oe=h||g?0:te,ie=oe+r,ne=De(qo,{color:"#008080",children:Sn(e0,{children:[De($t,{center:[0,0,C+oe],size:[B,S,r]}),Y.map((ue,fe)=>De(Ns,{center:[ue.x,ue.y,C+oe],radius:i/2,height:r},`hole-${fe}`)),Q.map((ue,fe)=>De(Ns,{center:[ue.x,ue.y,C+oe],radius:i/2,height:r},`pin-hole-${fe}`))]})}),le=Q.map((ue,fe)=>De(qo,{color:"#FFD700",children:Sn(e0,{children:[De(Ns,{center:[ue.x,ue.y,r/2+oe],radius:i/2,height:r}),De(Ns,{center:[ue.x,ue.y,r/2+oe],radius:o/2,height:r})]})})),ge=Q.map((ue,fe)=>De(Dsn,{x:ue.x,y:ue.y,pinThickness:W,shortSidePinLength:J,longSidePinLength:j,bodyHeight:te,flipZ:pe=>pe})),_e=Q.map((ue,fe)=>De(Ysn,{x:ue.x,y:ue.y,flipZ:pe=>-pe}));return Sn(Ei,{children:[ne,le,!g&&!h&&ge,g&&_e,I&&De(Xsn,{width:p??B*.8,height:m??S*.6,offset:{x:_??0,y:f??0,z:ie}})]})},fxi=()=>{const s=.8999999999999999,a=-s/2+.5/2-.15,A=s/2-.5/2+.15,c=.2,l=.5*.24;return Sn(Ei,{children:[De($t,{color:"#ccc",size:[.5,.28,.12],center:[a,0,.12/2]}),De($t,{color:"#ccc",size:[.5,.28,.12],center:[A,0,.12/2]}),De(qo,{color:"#222",children:Sn(gh,{children:[De(Uo,{z:l/2,children:De($t,{size:[s,.6,l]})}),Sn(ZA,{children:[De(Uo,{z:l,children:De($t,{size:[s,.6,.01]})}),De(Uo,{z:.5,children:De($t,{size:[s-c,.6-c,.01]})})]})]})}),De($t,{color:"#777",size:[1.4/6,.6-c,.02],center:[-s/4,0,.5]})]})},Ixi=fxi,Cxi=({numPins:t=7,showPins:e=!0,showFootprint:n=!0,bodyColor:o="#f5f5f5",pinColor:i="#635959"})=>{const c=3.5999999999999996,l=6,u=(t-1)*1.5+4,g=-((t-1)*1.5)/2;return Sn(Ei,{children:[De(Uo,{offset:[0,0,6],children:De(Ac,{angles:[Math.PI,0,0],children:De(qo,{color:o,children:Sn(e0,{children:[De($t,{size:[u,3.5,6],center:[0,0,6/2]}),De($t,{size:[u-.5*2,3.5-.5*2,c],center:[0,0,c/2]}),De($t,{size:[u,3.5/3,c],center:[0,0,c/6]}),De($t,{size:[u-.5*2,.5/2,c],center:[0,3.5/2-.5/4,c/2]}),De($t,{size:[u-.5*2,.5/2,c],center:[0,-3.5/2+.5/4,c/2]}),De($t,{size:[1,.5+2,1],center:[-u/4,3.5/2,6/2]}),De($t,{size:[1,.5+3,1],center:[u/4,3.5/2,6/2]}),De($t,{size:[1,.5+2,1],center:[-u/4,-3.5/2,6/2]}),De($t,{size:[1,.5+3,1],center:[u/4,-3.5/2,6/2]})]})})})}),e&&Array.from({length:t}).map((h,d)=>De(qo,{color:i,children:De(Ns,{height:l,radius:.35,center:[g+d*1.5,0,2.5]})})),n&&Array.from({length:t}).map((h,d)=>{const p=d===0,m=p?{type:"pcb_plated_hole",pcb_plated_hole_id:`jstzh_${d}`,shape:"circular_hole_with_rect_pad",x:g+d*1.5,y:0,hole_diameter:.73,rect_pad_width:1.03,rect_pad_height:1.73,hole_shape:"circle",pad_shape:"rect",layers:["top","bottom"],port_hints:[`${d+1}`]}:{type:"pcb_plated_hole",pcb_plated_hole_id:`jstzh_${d}`,shape:"pill",x:g+d*1.5,y:0,hole_height:.73,hole_width:.73,outer_height:1.73,outer_width:1.03,layers:["top","bottom"],port_hints:[`${d+1}`]};return De(tze,{hole:m,isPin1:p})})]})},yxi=({numPins:t=2,showPins:e=!0,showFootprint:n=!0,bodyColor:o="#f5f5f5",pinColor:i="#635959"})=>{const c=3.5999999999999996,l=3.4,u=5.5,g=.5,h=l+u,d=(t-1)*2+3.9,p=-((t-1)*2)/2,m=1,_=1.8,f=.7,I=.8,C=.65;return Sn(Ei,{children:[De(Uo,{offset:[0,0,6],children:De(Ac,{angles:[Math.PI,0,0],children:De(qo,{color:o,children:Sn(e0,{children:[De($t,{size:[d,4.5,6],center:[0,0,6/2]}),De($t,{size:[d-.5*2,4.5-.5*2,c],center:[0,0,c/2]}),De($t,{size:[d,4.5/3,c],center:[0,0,c/6]}),De($t,{size:[d-.5*2,.5/2,c],center:[0,4.5/2-.5/4,c/2]}),De($t,{size:[d-.5*2,.5/2,c],center:[0,-4.5/2+.5/4,c/2]}),De($t,{size:[m,4.5+.5,_],center:[-d/2+f,0,6/2]}),De($t,{size:[m,4.5+.5,_],center:[d/2-f,0,6/2]}),De($t,{size:[.5*3,I,C],center:[-d/2,0,C/2]}),De(Uo,{offset:[-d/2,0,C],children:De(Ac,{angles:[0,Math.PI/2,0],children:De(Ns,{height:.5*3,radius:I/2})})}),De($t,{size:[.5*3,I,C],center:[d/2,0,C/2]}),De(Uo,{offset:[d/2,0,C],children:De(Ac,{angles:[0,Math.PI/2,0],children:De(Ns,{height:.5*3,radius:I/2})})})]})})})}),e&&Array.from({length:t}).map((y,x)=>De(qo,{color:i,children:De($t,{size:[g,g,h],center:[p+x*2,0,(u-l)/2]})})),n&&Array.from({length:t}).map((y,x)=>{const E=x===0,B=E?{type:"pcb_plated_hole",pcb_plated_hole_id:`jstph_${x}`,shape:"circular_hole_with_rect_pad",x:p+x*2,y:0,hole_diameter:.73,rect_pad_width:1.2,rect_pad_height:1.2,hole_shape:"circle",pad_shape:"rect",layers:["top","bottom"],port_hints:[`${x+1}`]}:{type:"pcb_plated_hole",pcb_plated_hole_id:`jstph_${x}`,shape:"pill",x:p+x*2,y:0,hole_height:.73,hole_width:.73,outer_height:1.2,outer_width:1.2,layers:["top","bottom"],port_hints:[`${x+1}`]};return De(tze,{hole:B,isPin1:E})})]})},xxi=({numPins:t=4,showPins:e=!0,showFootprint:n=!0,bodyColor:o="#f8fafc",pinColor:i="#635959"})=>{const g=(t-1)*2.5+4.9,h=-((t-1)*2.5)/2,d=.8,p=.85+.2,m=3.5,_=g/2-1.3,f=Math.min(g-3.4,Math.max(3,(t-1)*2.5*.4+2.2)),I=2.4;return Sn(Ei,{children:[De(Uo,{offset:[0,0,7/2],children:De(qo,{color:o,children:Sn(e0,{children:[De($t,{size:[g,5.75,7]}),De(Uo,{offset:[0,0,(7-5.35)/2+.1],children:De($t,{size:[g-.85*2,5.75-.85*2,5.35+.2]})}),De(Uo,{offset:[0,-5.75/2+.85/2,7/2-I/2+.1],children:De($t,{size:[f,.85+.2,I+.2]})}),De(Uo,{offset:[-_,-5.75/2+.85/2,7/2-m/2+.1],children:De($t,{size:[d,p,m+.2]})}),De(Uo,{offset:[_,-5.75/2+.85/2,7/2-m/2+.1],children:De($t,{size:[d,p,m+.2]})}),Array.from({length:t}).map((C,y)=>De(Uo,{offset:[h+y*2.5,-5.75/2+.3,-7/2+.25],children:De($t,{size:[1,.8,.5]})},`vent_${y}`))]})})}),e&&Array.from({length:t}).map((C,y)=>De(qo,{color:i,children:De(Uo,{offset:[h+y*2.5,0,8.75/2-3.4],children:De($t,{size:[.64,.64,8.75]})})})),n&&(()=>{try{return pI.string(`jst${t}_xh`).circuitJson().filter(x=>x.type==="pcb_plated_hole").map((x,E)=>De(tze,{hole:x,isPin1:E===0},`footprint_${E}`))}catch{return null}})()]})};function Zsn(t){const e=pI.string(t).json();return e.fn!=="jst"?!1:!!(e.sh||e.smd&&Math.abs(Ua(e.p)-1)<.01&&Math.abs(Ua(e.mpx??0)-(e.num_pins-1+2.6))<.15&&Math.abs(Ua(e.mpy??0)-2.525)<.15)}var Exi=({footprint:t="jst6_sh"})=>{if(!Zsn(t))throw new Error("JstSh requires a named SH or matching 1mm SH top-entry footprint");const e=t.replace(/_pin1location\([^)]*\)/g,""),n=pI.string(e).json(),o=pI.string(e).circuitJson().filter(_=>_.type==="pcb_smtpad"&&_.shape==="rect"),i=pI.string(t).circuitJson().filter(_=>_.type==="pcb_smtpad"&&(_.shape==="rect"||_.shape==="rotated_rect")),r=n.num_pins;if(!Number.isInteger(r)||r<2||r>20||o.length!==r+2)throw new Error("JstSh requires 2–20 contacts and two hold-down pads");const s=o.slice(0,r),a=o.slice(r),A=Math.atan2(i[1].y-i[0].y,i[1].x-i[0].x)-Math.atan2(o[1].y-o[0].y,o[1].x-o[0].x),c=s.reduce((_,f)=>_+f.x,0)/r,l=s[0].y,u=a[0].y>l?1:-1,g=l+u*1.8,h=r+2,d=2.9,p=4.2,m=g-u*.25;return Sn(Ac,{rotation:[0,0,A],children:[De(qo,{color:"#e4e1d6",children:Sn(e0,{children:[De($t,{size:[h,d,p],center:[c,g,p/2+.05]}),De($t,{size:[h-1.3,1.8,p],center:[c,g,p/2+.8]}),a.map((_,f)=>De($t,{size:[.7,_.height*.8,1.5],center:[_.x,_.y,.75]},`recess-${f}`)),[-1,1].map(_=>De($t,{size:[.55,.6,1],center:[c+_*(h/2-.9),g+u*d/2,4]},_))]})}),Sn(qo,{color:"#c6c7c9",children:[s.map((_,f)=>{const I=_.y-u*_.height*.4;return Sn(gh,{children:[De($t,{size:[.2,Math.abs(m-I)+.1,.2],center:[_.x,(m+I)/2,.1]}),De($t,{size:[.2,.2,3.45],center:[_.x,m,1.725]})]},f)}),a.map((_,f)=>Sn(gh,{children:[De($t,{size:[.7,_.height*.75,.2],center:[_.x,_.y,.1]}),De($t,{size:[.2,_.height*.6,1.35],center:[_.x,_.y,.675]})]},`mount-${f}`))]})]})},Bxi=([t,e],n,o,i,r)=>{const s=Math.sign(t),a=Math.sign(e),A=n/2,c=o/2,l=r?Math.min(.32,o*.36):0,u=Math.min(i,A,c),g=[[-A,-c],[A,-c],[A,c-u],[A-u,c],[-A,c]];l&&(g[0]=[-A+l,-c],g.push([-A,-c+l]));const h=g.map(([d,p])=>[t+d*s,e+p*a]);return s*a<0?h.reverse():h},yze=({width:t,length:e,radius:n,height:o,z:i})=>{const r=t/2-n,s=e/2-n;return[[-r,-s],[r,-s],[r,s],[-r,s]].map(([a,A],c)=>De(Ns,{center:[a,A,i+o/2],height:o,radius:n}))},bxi=({horizontalPadPitch:t=2.2,verticalPadPitch:e=1.7,padWidth:n=1.4,padHeight:o=1.2,bodyHeight:i=.7})=>{const r=t+n*.7142857142857143,s=e+o*(2/3),a=Math.min(.01,i*.02),A=n*(5/7),c=o*.75,l=i*(5/7),u=l-a,g=i*(2/35),h=r*.95,d=s*.94,p=r*.905,m=s*.9,_=r*.83,f=s*.82,I=l+g,C=Math.min(.01,i*.015),y=Math.min(.12,s*.05),x=(r-A)/2,E=(s-c)/2,B=[[-x,-E],[x,-E],[x,E],[-x,E]],S=yze({width:h,length:d,radius:Math.min(.13,d*.08),height:g,z:l}),Q=[...yze({width:p,length:m,radius:Math.min(.14,m*.08),height:C,z:I}),...yze({width:_,length:f,radius:Math.min(.15,f*.09),height:C,z:i-C})];return Sn(Ei,{children:[B.map((w,M)=>De(qo,{color:"#d6a258",children:De(FY,{height:a,children:De(kY,{points:Bxi(w,A,c,y,M===0)})})})),De(ng,{center:{x:0,y:0,z:a},width:r,length:s,height:u-.005,heightAboveSurface:0,color:"#34343d",taperRatio:0,straightHeightRatio:1,includeNotch:!1,chamferSize:y}),De(qo,{color:"#d2a057",children:De(ZA,{children:S})}),De(qo,{color:"#b9bec2",children:De(ZA,{children:Q})})]})},Sxi="#303339",Qpe="#1f2227",ean="#eee8d8",tan="#f8f3e7",xze="#b7bdc2",Qxi="#d2d6d9",vxi="#767d82",wxi="#9ba1a5",Pxi=({pinCount:t=12,pitch:e=.5,padWidth:n=.3,padLength:o=1.25,staggered:i=!1,reverse:r=!1,rowPitch:s=2.4,topPadLength:a=o,bottomPadLength:A=o,mountPadPitchX:c,mountPadOffsetY:l=2.575,mountTop:u=!1,mountPadWidth:g=2,mountPadLength:h=2.5})=>{const d=Math.max((t-1)*e,e),p=-d/2,m=c??d+(i?3.5:3.38),_=l===0?0:(u?1:-1)*l,f=Array.from({length:t},(Ce,Le)=>{const Ye=i&&Le%2===1!==r,tt=i?Ye?s/2:-s/2:0,At=Ye?a:A;return{index:Le,x:p+Le*e,y:tt,length:At}}),I=Math.max(...f.map(Ce=>Ce.y+Ce.length/2)),C=Math.min(...f.map(Ce=>Ce.y-Ce.length/2)),y=_-h/2,x=_+h/2,E=u?C:I,B=u?Math.max(x,I)+.67:Math.min(y,C)-.67,S=u?-1:1,Q=E-S*Math.max(o*.86,1.05),w=B+S*.22,M=Math.abs(Q-w),k=(Q+w)/2,R=w-S*.01,F=Math.max(d+4.9,m+g*.76),O=Math.min(F-2.3,d+1.1),U=.3,Y=1.42,W=2,te=Math.min(.92,M*.28),j=R+S*(te/2-.04),J=1.6,oe=1.1,ie=Math.max(M-.78,1.5),ne=R+S*(ie/2+.68),le=F-.72,ge=.34,_e=W-ge/2,ue=R+S*Math.min(.68,M*.22),fe=1.48,pe=Math.max(n*.82,.15),ye=E,Me=Math.abs(ye-Q),ve=(ye+Q)/2,he=Math.max(te*.8,.5),Qe=R+S*(he/2+.08),Pe=m/2,we=.75,Te=F/2-.04,Re=F/2-.23,Ee=F/2-.32,ke=.68;return Sn(Ei,{children:[[-1,1].map(Ce=>De($t,{color:xze,center:[Ce*Pe,_,.07],size:[g,h,.14]})),f.map(Ce=>De($t,{color:xze,center:[Ce.x,ve,.065],size:[pe,Me,.13]},`terminal:${Ce.index}`)),De(A1,{color:Qpe,center:[0,k,U/2],size:[F,M,U],roundRadius:.1}),De(qo,{color:Sxi,children:Sn(e0,{children:[De(A1,{center:[0,k,U+Y/2],size:[F-.2,M-.12,Y],roundRadius:.14}),De($t,{center:[0,j,oe],size:[O,te,J]}),De($t,{center:[0,ne,W-ge*.72],size:[le-.32,ie-.16,ge]})]})}),f.map(Ce=>De(A1,{color:Qxi,center:[Ce.x,Qe,U+.82],size:[pe*.82,he,.14],roundRadius:.035},`spring:${Ce.index}`)),f.map(Ce=>De($t,{color:xze,center:[Ce.x,Q-S*.03,U+.32],size:[pe,.13,.62]},`terminal-rise:${Ce.index}`)),De($t,{color:Qpe,center:[0,R+S*.1,U+.71],size:[O+.18,.16,.8]}),De(A1,{color:ean,center:[0,ne,_e],size:[le,ie,ge],roundRadius:.11}),De($t,{color:tan,center:[0,ne-S*(ie/2-.12),W-.035],size:[le-.36,.24,.07]}),[-1,1].map(Ce=>De(A1,{color:ean,center:[Ce*Ee,ue,fe],size:[ke,.92,.72],roundRadius:.1})),[-1,1].map(Ce=>De(Uo,{x:Ce*Ee,y:ue,z:fe,children:De(Ac,{rotation:[0,Math.PI/2,0],children:De(Ns,{color:tan,height:ke+.12,radius:.24})})})),[-1,1].map(Ce=>De(A1,{color:vxi,center:[Ce*Te,_,we/2],size:[.17,Math.min(h*.3,.7),we],roundRadius:.04})),[-1,1].map(Ce=>De(A1,{color:wxi,center:[Ce*Re,_,we-.05],size:[.42,Math.min(h*.3,.7),.1],roundRadius:.035})),De($t,{color:Qpe,center:[0,k,.025],size:[O+.7,M*.58,.05]}),De($t,{color:Qpe,center:[0,Q-S*.06,U+.82],size:[O+.4,.15,.92]})]})},Mxi=({numberOfPins:t,pitch:e=2.54,pinThickness:n=.64,bodyWidth:o=2.5,bodyHeight:i=2.54,standoffHeight:r=1.27,matingPinLength:s=5.8,tailSpan:a=5.08})=>{const A=-((t-1)*e)/2,c=r+i,l=a/2,u=n*.35;return De(Ei,{children:Array.from({length:t},(g,h)=>{const d=A+h*e,p=h%2===0?1:-1,m=s-u,_=r-n/2;return Sn(Uo,{x:d,children:[De($t,{color:"#222",size:[e,o,i],center:[0,0,r+i/2]}),Sn(qo,{color:"#d4af37",children:[De($t,{size:[n,l,n],center:[0,p*(l/2),n/2]}),De($t,{size:[n,n,_],center:[0,0,n/2+_/2]}),De($t,{size:[n,n,m],center:[0,0,c+m/2]}),Sn(ZA,{children:[De($t,{size:[n,n,.01],center:[0,0,c+m]}),De($t,{size:[n*.65,n*.65,.01],center:[0,0,c+s]})]})]})]})})})},JX=t=>pI.string(t).circuitJson().filter(n=>n.type==="pcb_plated_hole"&&Number.isFinite(n.x)&&Number.isFinite(n.y)).map(n=>({x:n.x,y:n.y,pin:n.port_hints?.[0]})),nan=t=>pI.string(t).circuitJson().filter(n=>n.type==="pcb_smtpad"&&n.shape==="rect"&&Number.isFinite(n.x)&&Number.isFinite(n.y)).map(n=>({x:n.x,y:n.y,width:n.width??.4,height:n.height??.4,pin:n.port_hints?.[0]})),Dxi=({bodyWidth:t,bodyLength:e,bodyHeight:n=1,pads:o,leadThickness:i=.15,leadHeightRatio:r=.75})=>{const s=o.reduce((c,l)=>c+l.x,0)/(o.length||1),a=o.reduce((c,l)=>c+l.y,0)/(o.length||1),A=n*r;return Sn(Ei,{children:[De(ng,{center:{x:s,y:a,z:0},width:t,length:e,height:n}),o.map(c=>{const l=c.width??.4,u=c.height??.4,g=c.x>=s?1:-1,h=c.x+g*l/2,d=Math.max(Math.abs(h-s)-t/2,.1),p=Math.min(.15,t*.15);return De(ns,{rotation:g>0?Math.PI:0,position:{x:h,y:c.y,z:i/2},width:u,thickness:i,padContactLength:l*.6,bodyDistance:d+p,height:A},`lead-${c.x}-${c.y}`)})]})},Nxi=({padPitch:t,padHeight:e,color:n="#333"})=>{const o=t,i=e*.85,r=i,s=o*.2,a=o-s*2;return Sn(Ei,{children:[De($t,{size:[a,i,r],offset:[0,0,r/2],color:n}),De($t,{size:[s,r,i],offset:[o/2-s/2,0,r/2],color:"#ccc"}),De($t,{size:[s,r,i],offset:[-o/2+s/2,0,r/2],color:"#ccc"})]})},Rxi=({color:t="#ffff00",bodyColor:e="#ffffff",leadColor:n="#dedede"})=>{const m=[-1.7,0,1.7],_=[-1,1];return Sn(Ei,{children:[m.flatMap(f=>_.map(I=>De($t,{color:n,size:[1.4,1,.2],center:[I*2,f,.2/2]}))),De(qo,{color:e,children:Sn(e0,{children:[De(ng,{width:5,length:5,height:1.3,heightAboveSurface:.2,center:{x:0,y:0,z:0},color:e,taperRatio:.036,straightHeightRatio:.01,includeNotch:!1}),De(Ns,{radius:2,height:.25,center:[0,0,1.5-.25/2]}),De(Uo,{offset:[-5/2,5/2,1.5-.3/2+.005],children:De(Ac,{rotation:[0,0,Math.PI/4],children:De($t,{size:[.9,.9,.3+.01]})})})]})}),De(Ns,{color:t,radius:2,height:.25,center:[0,0,1.55-.25/2]})]})},Txi=({bodyWidth:t=3.5,bodyLength:e=2.8,bodyHeight:n=.8,color:o="#ffe08a",bodyColor:i="#f2f2f2",padColor:r="#cccccc",pad1X:s=-.9,pad1Width:a=2.2,pad2X:A=1.375,pad2Width:c=1.25,padLength:l=2.2}={})=>{const h=(s+A)/2,d=t*.55,p=e*.55;return Sn(Ei,{children:[[{x:s,w:a,key:"pad-1"},{x:A,w:c,key:"pad-2"}].map(({x:m,w:_,key:f})=>De(qo,{color:r,children:De($t,{size:[_,l,.1],center:[m,0,.1/2]})})),De(qo,{color:i,children:De($t,{size:[t,e,n],center:[h,0,.1+n/2]})}),De(qo,{color:o,children:De($t,{size:[d,p,.15],center:[h,0,.1+n+.15/2-.05]})})]})},oan=t=>Array.from({length:t},(e,n)=>n),kxi=({bodyWidth:t=16.26,bodyDepth:e=15.88,bodyHeight:n=13.5,bodyCenterY:o=-.96,ledPins:i=!1,firstPinLeft:r=!1,firstPinTop:s=!1,signalPitch:a=1.02,signalRowPitch:A=1.78,signalHoleDiameter:c=.9144,shieldPinX:l=8.13,shieldPinY:u=.13,shieldHoleDiameter:g=1.8,locatorHoleX:h=6.35,locatorHoleY:d=-3.43,locatorHoleDiameter:p=3.25,ledPinX:m=4.57,ledPinPitch:_=2.29,ledPinY:f=5.7,openingDirection:I,shellColor:C="#b7bdc2",housingColor:y="#20242a",contactColor:x="#d6a928"})=>{const E=I??(o>0?1:-1),B=o+E*e/2,S=Math.min(.38,t*.024),Q=Math.max(t-2.5,t*.72),w=Math.min(n-2.4,9.6),M=1.3+w/2,k=Math.min(4.4,e*.34),R=B-E*k/2,F=B-E*(k+S*.7),O=Math.max(.22,Math.min(c*.36,.38)),U=oan(8).map(oe=>{const ie=(3.5-oe)*a,ne=oe%2===0?-A/2:A/2;return{x:r?-ie:ie,y:s?-ne:ne}}),Y=[-m-_,-m,m,m+_],W=Q/10,te=B-E*Math.max(k*.48,1.2),j=M+w*.18,J=B+E*S*.2;return Sn(Ei,{children:[Sn(qo,{color:C,children:[Sn(e0,{children:[De($t,{center:[0,o,n/2],size:[t,e,n]}),De($t,{center:[0,R,M],size:[Q,k+S*2,w]})]}),De($t,{center:[0,J,.72],size:[Q+.5,S*1.25,1.05]}),[-1,1].map(oe=>De($t,{center:[oe*l,u,.25],size:[Math.max(g*.46,.65),Math.max(g*.72,1.1),3.4]})),[-1,1].map(oe=>De($t,{center:[oe*t*.24,o-E*e*.08,n+.04],size:[t*.22,e*.42,.1]}))]}),Sn(qo,{color:y,children:[Sn(e0,{children:[De(A1,{center:[0,R,M],size:[Q-.2,k+S*.5,w-.2],roundRadius:.22}),De($t,{center:[0,R-E*S*.2,M-.05],size:[Q-1.25,k+S,w-1.35]})]}),De($t,{center:[0,F,M],size:[Q-1.15,S,w-1.25]}),De(A1,{center:[0,B-E*k*.28,1.55],size:[Q-2.6,k*.5,1.15],roundRadius:.16}),[-1,1].map(oe=>De(Ns,{center:[oe*h,d,-.25],radius:Math.max(p*.41,.65),height:2.7}))]}),Sn(qo,{color:x,children:[U.map(({x:oe,y:ie},ne)=>De(Ns,{center:[oe,ie,.15],radius:O,height:3.1})),oan(8).map(oe=>De(Uo,{offset:[(oe-3.5)*W,te,j+(oe%2===0?.03:-.03)],children:De(Ac,{rotation:[E*.2,0,0],children:De(A1,{size:[Math.max(W*.28,.28),3.25,.16],roundRadius:.05})})})),i&&Y.map((oe,ie)=>De(Ns,{center:[oe,f,.15],radius:O,height:3.1}))]}),i&&Sn(Ei,{children:[De(A1,{color:"#73b744",center:[-t/2+2.05,B+E*S*.35,n-2.05],size:[2.15,S*1.55,1.45],roundRadius:.18}),De(A1,{color:"#e0aa35",center:[t/2-2.05,B+E*S*.35,n-2.05],size:[2.15,S*1.55,1.45],roundRadius:.18})]})]})},Fxi=({bodyWidth:t=6.1,bodyLength:e=6.5,bodyHeight:n=2.3,tabWidth:o=6.2,tabLength:i=5.8,span:r=6.85,pitch:s=2.29,leadWidth:a=.9,leadContactLength:A=1.5,color:c="#222",tabColor:l="#cccccc",leadColor:u="#cccccc"})=>{const h=r/2,d=-r/2,p=h+(o-t)/2,m=p-t/2,_=.5/2,f=.4;return Sn(Ei,{children:[De(qo,{color:l,children:De($t,{size:[o,i,.5],center:[h,0,.5/2]})}),De(qo,{color:c,children:De($t,{size:[t,e,n],center:[p,0,.5+n/2]})}),[-1,1].map(I=>Sn(qo,{color:u,children:[De($t,{size:[A,a,f],center:[d+A/2,I*s,f/2]}),Sn(ZA,{children:[De($t,{size:[.1,a,f],center:[d+A,I*s,f/2]}),De($t,{size:[.1,a,f],center:[m,I*s,_+.5/2]})]})]},`lead-${I}`))]})},Lxi=({diameter:t=6.3,heightToDiameterRatio:e=1.4,height:n=t*e,leadPitch:o=2.5,leadDiameter:i=.6,leadLength:r=3,sleeveColor:s="#1b2a6b",baseColor:a="#1a1a1a"})=>{const A=t/2,c=Math.min(1,t*.12),l=Math.max(n-c,.1),u=c,g=u+l,h=Math.max(t*.06,.2),d=.3;return Sn(Ei,{children:[De(qo,{color:a,children:De(Ns,{radius:A-.05,height:c,center:[0,0,c/2]})}),De(qo,{color:s,children:Sn(e0,{children:[De(a2,{radius:A,height:l,roundRadius:Math.min(.3,A*.15),center:[0,0,u+l/2]}),De($t,{size:[t,h,d*2],center:[0,0,g]}),De($t,{size:[h,t,d*2],center:[0,0,g]})]})}),[-1,1].map(p=>De(qo,{color:"#c0c0c0",children:De(Ns,{radius:i/2,height:r+c,center:[p*o/2,0,(c-r)/2]})}))]})},Hxi=({bodyWidth:t=5.35,bodyLength:e=14,bodyHeight:n=4,bodyCenterX:o=t/2,adjusterDiameter:i=Math.min(t,e)*.55,shaftDiameter:r=0,shaftHeight:s=0,leads:a=[],leadDiameter:A=.6,leadLength:c=3,bodyColor:l="#1f4fa3",adjusterColor:u="#d8d8d8"})=>{const h=n+.4,d=Math.max(i*.16,.3);return Sn(Ei,{children:[De(qo,{color:l,children:De($t,{size:[t,e,n],center:[o,0,n/2]})}),De(qo,{color:u,children:Sn(e0,{children:[De(Ns,{radius:i/2,height:.8,center:[o,0,h]}),De($t,{size:[i,d,.8*.6],center:[o,0,h+.8/2]})]})}),s>0&&r>0?De(qo,{color:u,children:De(Ns,{radius:r/2,height:s,center:[o,0,n+s/2]})}):null,a.map(p=>De(qo,{color:"#c0c0c0",children:De(Ns,{radius:A/2,height:n/2+c,center:[p.x,p.y,(n/2-c)/2]})},`lead-${p.x}-${p.y}`))]})},Oxi=({bodyWidth:t=2.9,bodyLength:e=3,bodyHeight:n=1.4,actuatorDiameter:o=1.5,actuatorHeight:i=.5,padSpanX:r=4.2,padSpanY:s=2.15,padWidth:a=1.05,padLength:A=.7,bodyColor:c="#2b2b2b",actuatorColor:l="#d9d9d9",leadColor:u="#cccccc"})=>Sn(Ei,{children:[De(qo,{color:c,children:De($t,{size:[t,e,n],center:[0,0,n/2]})}),De(qo,{color:l,children:De(Ns,{radius:o/2,height:i,center:[0,0,n+i/2]})}),[-1,1].flatMap(h=>[-1,1].map(d=>De(qo,{color:u,children:De($t,{size:[a,A,.15],center:[h*r/2,d*s/2,.15/2]})})))]}),Gxi=({footprint:t="smdslideswitch7",position:e=0})=>{const n=t.replace(/_pin1location\([^)]*\)/g,""),o=pI.string(n).json(),i=pI.string(n).circuitJson(),r=i.filter(g=>g.type==="pcb_smtpad"&&g.shape==="rect"),s=pI.string(t).circuitJson().filter(g=>g.type==="pcb_smtpad"&&(g.shape==="rect"||g.shape==="rotated_rect"));if(r.length<7||!Number.isFinite(o.mpx)||o.mpx<3)throw new Error("SmdSlideSwitch needs signal pads and four mounting pads");const a=Math.atan2(s[1].y-s[0].y,s[1].x-s[0].x)-Math.atan2(r[1].y-r[0].y,r[1].x-r[0].x),A=o.mpx-.5,c=2.7,l=o.mpx>6?1.5:1.4,u=o.mounty;return Sn(Ac,{rotation:[0,0,a],children:[De(qo,{color:"#aeb4ba",children:Sn(e0,{children:[De($t,{size:[A,c,l],center:[0,u,l/2]}),De($t,{size:[A-.3,c-.3,l],center:[0,u,l/2-.15]}),De($t,{size:[2.7,.5,.9],center:[0,u-c/2,.65]})]})}),Sn(qo,{color:"#28292c",children:[De($t,{size:[A-.32,c-.32,.35],center:[0,u,.175]}),De($t,{size:[1,2.25,.65],center:[e===0?-.5:.5,u-1.5,.65]}),i.filter(g=>g.type==="pcb_hole").map((g,h)=>"hole_diameter"in g&&"x"in g?De(Ns,{radius:g.hole_diameter*.42,height:.6,center:[g.x,g.y,-.2]}):null)]}),De(qo,{color:"#c6c7c9",children:r.map((g,h)=>{const d=h<r.length-4,p=g.y+g.height*.4,m=Math.min(g.y-g.height*.4,u+c/2-.2);return De($t,{size:[g.width*.8,d?p-m:g.height*.8,.18],center:[g.x,d?(p+m)/2:g.y,.09]},h)})})]})},Yxi=({fullWidth:t=1.94,fullLength:e=1.6})=>Sn(Ei,{children:[De(Ac,{rotation:[45*Math.PI,0,0],children:De(Uo,{center:[0,0,-.4],children:De(qo,{color:"grey",children:De($t,{size:[1.2,1.6,.55]})})})}),[-1,0,1].flatMap((l,u)=>[De(Uo,{center:[-1.2/2-.03,l*.5,.13/2],children:De($t,{size:[.67,.3,.13]})}),De(Uo,{center:[1.2/2+.03,l*.5,.13/2],children:De($t,{size:[.67,.3,.13]})})])]}),Uxi=({packageWidth:t=10,packageLength:e=10,packageHeight:n=1.2,standoffHeight:o=.2,ballPitch:i=.8,ballDiameter:r=.5,ballRows:s=8,ballColumns:a=8,missingBalls:A=[],footprintString:c})=>{const l=n-o,u=o+l/2,g=Math.max(o/2,r/2),h=c?pI.string(c).circuitJson():null;return Sn(Ei,{children:[De(Uo,{z:u,children:De(qo,{color:"#555",children:De($t,{size:[t,e,l]})})}),!c&&Array.from({length:s*a}).map((d,p)=>{if(A.includes(p+1))return null;const m=Math.floor(p/a),f=(p%a-(a-1)/2)*i,I=(m-(s-1)/2)*i;return De(Uo,{x:f,y:I,z:g,children:De(TY,{radius:r/2})})}),h&&h.map((d,p)=>d.type==="pcb_smtpad"?De(Uo,{x:d.x,y:d.y,z:g,children:De(TY,{radius:r/2})}):null)]})},ian=({width:t,height:e,depth:n})=>De(ZA,{children:[-1,1].map(o=>De(Uo,{offset:[o*(t-e)/2,0,0],children:De(Ac,{rotation:[Math.PI/2,0,0],children:De(Ns,{radius:e/2,height:n})})},o))}),Kxi=({footprint:t="usbcmidmount16"})=>{const e=t.replace(/_pin1location\([^)]*\)/g,""),n=pI.string(e).json(),o=pI.string(e).circuitJson(),i=o.filter(C=>C.type==="pcb_smtpad"&&C.shape==="rect"),r=o.filter(C=>C.type==="pcb_plated_hole"),s=o.filter(C=>C.type==="pcb_hole"),a=pI.string(t).circuitJson().find(C=>C.type==="pcb_plated_hole"),A=r[0],c=A&&a&&"x"in a?Math.atan2(a.y,a.x)-Math.atan2(A.y,A.x):0,l=8.94,u=3.2,g=.22,h=n.rowy+.23,d=-n.bodybottom,p=h-d,m=(h+d)/2,_=1.65;if(!Number.isFinite(p)||p<3||r.length!==4)throw new Error("UsbCMidmount requires four mounting slots and a positive body depth");const f=-.9,I=_+.1;return Sn(Ac,{rotation:[0,0,c],children:[De(qo,{color:"#b8bdc4",children:De(Uo,{offset:[0,m,_],children:Sn(e0,{children:[De(ian,{width:l,height:u,depth:p}),De(ian,{width:l-g*2,height:u-g*2,depth:p+.2})]})})}),Sn(qo,{color:"#242529",children:[De($t,{size:[6.65,p-1.1,.7],center:[0,m+.3,_]}),De($t,{size:[7.6,1,2.45],center:[0,h-.65,_]}),s.map((C,y)=>"x"in C&&"hole_diameter"in C?De(Ns,{radius:C.hole_diameter*.42,height:.8,center:[C.x,C.y,-.3]}):null)]}),Sn(qo,{color:"#d3ad57",children:[[-1,1].flatMap(C=>[-2.75,-2.25,-1.25,-.25,.25,1.25,2.25,2.75].map(y=>De($t,{size:[.24,p-2,.04],center:[y,m+.1,_+C*.365]}))),i.map((C,y)=>De($t,{size:[Math.min(C.width*.7,.35),C.height*.8+.35,.15],center:[C.x,C.y-.175,.075]}))]}),De(qo,{color:"#b8bdc4",children:r.map((C,y)=>De($t,{size:[.4,"hole_height"in C?Math.max(.3,C.hole_height-.2):1,I-f],center:[C.x,C.y,(I+f)/2]},y))})]})},ran=t=>pI.string(t).circuitJson().filter(e=>e.type==="pcb_smtpad"&&(e.shape==="rect"||e.shape==="rotated_rect")).map(e=>({x:e.x,y:e.y,pin:e.port_hints?.[0]})),Vxi=({footprint:t="sot143"})=>{const e=ran(t);if(e.length!==4)throw new Error("SOT143 requires four signal pads");const n=ran("sot143"),o=pI.string(t).json(),i=n[1],r=e.find(A=>A.pin==="2"),s=o.pin1location?Math.round((Math.atan2(r.y,r.x)-Math.atan2(i.y,i.x))/(Math.PI/2))*(Math.PI/2):0,a=e.map(A=>({...A,x:A.x*Math.cos(s)+A.y*Math.sin(s),y:-A.x*Math.sin(s)+A.y*Math.cos(s)}));return Sn(Ac,{rotation:[0,0,s],children:[De(ng,{width:2.9,length:1.3,height:.95,heightAboveSurface:.05,center:{x:0,y:0,z:0},includeNotch:!1,taperRatio:.06}),a.map(A=>{const c=A.y<0?-1:1,l=A.pin==="1"?.83:.43;return De(ns,{width:l,thickness:.12,height:.45,padContactLength:.3,bodyDistance:.6,rotation:c<0?Math.PI/2:-Math.PI/2,position:{x:A.x,y:c*1.15,z:.06}},A.pin)})]})},zxi=16/9,Jxi=40,uS=1e-6,gf=(t,e)=>{if(!Number.isFinite(e)||e<=0)throw new Error(`${t} must be a finite number greater than zero`)},Wxi=t=>{if(t===void 0)return zxi;if(typeof t=="number")return gf("aspectRatio",t),t;if(typeof t!="string"){const[i,r]=t;return gf("aspectRatio width",i),gf("aspectRatio height",r),i/r}const e=t.split(":");if(e.length!==2)throw new Error('aspectRatio must look like "16:9"');const n=Number(e[0]),o=Number(e[1]);return gf("aspectRatio width",n),gf("aspectRatio height",o),n/o},jxi=({width:t,height:e,diagonal:n,aspectRatio:o,ratio:i,defaultDiagonal:r=Jxi})=>{const s=Wxi(o??i);t!==void 0&&gf("width",t),e!==void 0&&gf("height",e),n!==void 0&&gf("diagonal",n),gf("defaultDiagonal",r);let a,A;if(t!==void 0&&e!==void 0)a=t,A=e;else if(n!==void 0&&t!==void 0){if(t>=n)throw new Error("width must be smaller than diagonal");a=t,A=Math.sqrt(n**2-t**2)}else if(n!==void 0&&e!==void 0){if(e>=n)throw new Error("height must be smaller than diagonal");a=Math.sqrt(n**2-e**2),A=e}else t!==void 0?(a=t,A=t/s):e!==void 0?(a=e*s,A=e):(A=(n??r)/Math.sqrt(s**2+1),a=A*s);return{width:a,height:A,diagonal:Math.hypot(a,A),aspectRatio:a/A}},$xi=t=>{const e=[["sitsFlat",t.sitsFlat],["sitsFlatBelowBoard",t.sitsFlatBelowBoard],["foldedToFaceAboveBoard",t.foldedToFaceAboveBoard],["foldedToFaceBelowBoard",t.foldedToFaceBelowBoard],["foldedToFaceAboveBoard",t.foldsAboveBoard],["foldedToFaceBelowBoard",t.foldsBelowBoard],["foldedToRightAngleAboveBoard",t.foldedToRightAngleAboveBoard],["foldedToRightAngleBelowBoard",t.foldedToRightAngleBelowBoard]].filter(n=>n[1]);if(e.length>1)throw new Error("Only one FlexScreen boolean orientation shortcut can be true");return e[0]?.[0]??t.orientation??"sitsFlat"},qxi=(t,e)=>Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2]),Xxi=(t,e,n)=>[t[0]+(e[0]-t[0])*n,t[1]+(e[1]-t[1])*n,t[2]+(e[2]-t[2])*n],Eze=t=>{const e=[0];for(let n=1;n<t.length;n+=1)e.push(e[n-1]+qxi(t[n-1],t[n]));return e},san=(t,e,n)=>{if(n<=0)return t[0];const o=e.at(-1);if(n>=o)return t.at(-1);for(let i=1;i<t.length;i+=1)if(e[i]>=n){const r=e[i-1],s=e[i]-r;return Xxi(t[i-1],t[i],(n-r)/s)}return t.at(-1)},vpe=(t,e,n)=>{const o=Eze(t),i=o.at(-1),r=Math.max(0,Math.min(e,i)),s=Math.max(r,Math.min(n,i)),a=[san(t,o,r)];for(let A=1;A<t.length-1;A+=1)o[A]>r&&o[A]<s&&a.push(t[A]);return a.push(san(t,o,s)),a},Zxi=(t,e)=>[t,[t[0],t[1]+e,t[2]]],e3i=({start:t,endZ:e,flexCableLength:n,foldDistanceFromConnector:o,foldOutset:i,foldSegments:r})=>{const s=[t],a=[t[0],t[1]+o,t[2]];o>uS&&s.push(a);for(let l=1;l<=r;l+=1){const u=Math.PI*l/r;s.push([t[0],a[1]+i*Math.sin(u),t[2]+(e-t[2])*(1-Math.cos(u))/2])}const A=Eze(s).at(-1);if(A>n+uS)throw new Error(`flexCableLength must be at least ${A.toFixed(2)} for this 180-degree fold`);const c=Math.max(0,n-A);if(c>uS){const l=s.at(-1);s.push([l[0],l[1]-c,l[2]])}return s},t3i=({start:t,flexCableLength:e,bendRadius:n,bendSegments:o,verticalLead:i,direction:r})=>{const s=2*o*Math.sin(Math.PI/(4*o)),a=Math.min(n,e/s),A=a*s,c=Math.max(0,e-A),l=Math.min(i,c*.45),u=c-l,g=[t];u>uS&&g.push([t[0],t[1]+u,t[2]]);for(let h=1;h<=o;h+=1){const d=Math.PI/2*h/o;g.push([t[0],t[1]+u+a*Math.sin(d),t[2]+r*a*(1-Math.cos(d))])}if(l>uS){const h=g.at(-1);g.push([h[0],h[1],h[2]+r*l])}return g},WX=({points:t,width:e,thickness:n,color:o,acrossOffset:i=0,normalOffset:r=0,overlap:s=.03})=>De(qo,{color:o,children:t.slice(1).map((a,A)=>{const c=t[A],l=a[0]-c[0],u=a[1]-c[1],g=a[2]-c[2],h=Math.hypot(l,u,g);if(h<uS)return null;const d=Math.asin(g/h),p=Math.atan2(-l,u),m=[(c[0]+a[0])/2,(c[1]+a[1])/2,(c[2]+a[2])/2],_=Math.max(.001,Math.min(e,n,h)/2-.001);return De(Uo,{offset:m,children:De(Ac,{rotation:[d,0,p],children:De(A1,{size:[e,h+s,n],center:[i,0,r],roundRadius:_})})},`${A}:${m.join(":")}`)})}),n3i=t=>{const{width:e,height:n,diagonal:o,aspectRatio:i,ratio:r,defaultDiagonal:s,screenThickness:a=1.2,bezelInset:A=2,bezelDepth:c=.65,activeAreaWidth:l,activeAreaHeight:u,screenColor:g="#071b24",bezelColor:h="#15181d",showScreen:d=!0,flexCableLength:p=28,flexCableThickness:m=.18,flexCableColor:_="#d79528",conductorCount:f=8,conductorPitch:I,conductorWidth:C,conductorThickness:y=.035,conductorColor:x="#8c4a18",cableEdgeMargin:E=.6,exposedContactLength:B=2.4,showConductors:S=!0,showFlexCable:Q=!0,showStiffeners:w=!0,stiffenerLength:M=3,stiffenerThickness:k=.16,stiffenerColor:R="#416bb3",bendRadius:F=3,bendSegments:O=10,rightAngleVerticalLead:U=3,distanceAboveBoard:Y=7,distanceBelowBoard:W=7,foldDistanceFromConnector:te=7,foldOutset:j=4,foldSegments:J=18,screenGap:oe=.08,boardTopZ:ie=0,boardThickness:ne=1.6,boardClearance:le=.15,cableStartX:ge=0,cableStartY:_e=0,cableStartZ:ue,cableLateralOffset:fe=0,screenOffset:pe,screenRotation:ye,rotation:Me=[0,0,0],offset:ve}=t,he=jxi({width:e,height:n,diagonal:o,aspectRatio:i,ratio:r,defaultDiagonal:s}),Qe=$xi(t),Pe=Qe==="sitsFlatBelowBoard"||Qe==="foldedToFaceBelowBoard"||Qe==="foldedToRightAngleBelowBoard",we=Qe==="foldedToFaceAboveBoard"||Qe==="foldedToFaceBelowBoard",Te=Qe==="foldedToRightAngleAboveBoard"||Qe==="foldedToRightAngleBelowBoard";if(gf("screenThickness",a),gf("flexCableLength",p),gf("flexCableThickness",m),gf("conductorThickness",y),gf("bendRadius",F),gf("foldOutset",j),gf("boardThickness",ne),w&&gf("stiffenerThickness",k),!Number.isInteger(f)||f<1)throw new Error("conductorCount must be a positive integer");if(!Number.isInteger(O)||O<2)throw new Error("bendSegments must be an integer of at least 2");if(!Number.isInteger(J)||J<4)throw new Error("foldSegments must be an integer of at least 4");if(le<0||oe<0||E<0||B<0||M<0||U<0||Y<0||W<0||te<0)throw new Error("clearances, margins, contact lengths, and lead lengths cannot be negative");const Re=t.flexCableWidth??Math.min(12,Math.max(5,he.width*.3));gf("flexCableWidth",Re);const Ee=Re-E*2;if(Ee<=0)throw new Error("cableEdgeMargin leaves no usable flex cable width");const ke=I??(f===1?0:Ee/f);if(f>1&&(!Number.isFinite(ke)||ke<=0))throw new Error("conductorPitch must be greater than zero");const Ce=C??(f===1?Math.min(Ee,Re*.45):ke*.48);if(gf("conductorWidth",Ce),(f-1)*ke+Ce>Ee+uS)throw new Error("conductorPitch and conductorWidth do not fit inside the flex cable margins");const tt=Pe&&!we?ie-ne-le-m/2:ie+le+m/2,At=[ge+fe,_e,ue??tt],at=Pe?-1:1,nt=Qe==="foldedToFaceAboveBoard"?ie+Y:ie-ne-W,gt=Qe==="foldedToFaceAboveBoard"?nt-oe-m/2:nt+oe+m/2,bt=we?e3i({start:At,endZ:gt,flexCableLength:p,foldDistanceFromConnector:te,foldOutset:j,foldSegments:J}):Te?t3i({start:At,flexCableLength:p,bendRadius:F,bendSegments:O,verticalLead:U,direction:at}):Zxi(At,p),Ct=Eze(bt).at(-1),Dt=Math.min(Math.max(0,B),Ct/2),kt=Math.min(Math.max(0,M),Ct/2),it=vpe(bt,0,Dt),Yt=vpe(bt,Ct-Dt,Ct),pn=vpe(bt,0,kt),be=vpe(bt,Ct-kt,Ct),et=bt.at(-1);let It,Bt;Qe==="sitsFlat"?(It=[0,0,0],Bt=[et[0],et[1]+he.height/2,et[2]+m/2+oe]):Qe==="sitsFlatBelowBoard"?(It=[0,Math.PI,0],Bt=[et[0],et[1]+he.height/2,et[2]-m/2-oe]):Qe==="foldedToFaceAboveBoard"?(It=[0,0,0],Bt=[et[0],et[1]-he.height/2,nt]):Qe==="foldedToFaceBelowBoard"?(It=[0,Math.PI,0],Bt=[et[0],et[1]-he.height/2,nt]):Qe==="foldedToRightAngleAboveBoard"?(It=[Math.PI/2,0,0],Bt=[et[0],et[1]-m/2-oe,et[2]+he.height/2]):(It=[-Math.PI/2,0,0],Bt=[et[0],et[1]+m/2+oe,et[2]-he.height/2]),Bt=[Bt[0]+(pe?.x??0),Bt[1]+(pe?.y??0),Bt[2]+(pe?.z??0)];const mt=Array.from({length:f},(Ze,dt)=>f===1?0:(dt-(f-1)/2)*ke),st=(m+y)/2,xt=-(m+k)/2,Xe=Sn(Ei,{children:[Q&&De(WX,{points:bt,width:Re,thickness:m,color:_}),Q&&w&&kt>uS&&Sn(Ei,{children:[De(WX,{points:pn,width:Re,thickness:k,color:R,normalOffset:xt}),De(WX,{points:be,width:Re,thickness:k,color:R,normalOffset:xt})]}),Q&&S&&Dt>uS&&mt.map((Ze,dt)=>Sn(Ei,{children:[De(WX,{points:it,width:Ce,thickness:y,color:x,acrossOffset:Ze,normalOffset:st}),De(WX,{points:Yt,width:Ce,thickness:y,color:x,acrossOffset:Ze,normalOffset:st})]},`conductor:${dt}`)),d&&De(Uo,{offset:Bt,children:De(Ac,{rotation:ye??It,children:De(Xsn,{width:he.width,height:he.height,thickness:a,bezelInset:A,bezelDepth:c,screenWidth:l,screenHeight:u,screenColor:g,bezelColor:h})})})]});return De(Uo,{offset:{x:ve?.x??0,y:ve?.y??0,z:ve?.z??0},children:De(Uo,{offset:At,children:De(Ac,{rotation:Me,children:De(Uo,{offset:[-At[0],-At[1],-At[2]],children:Xe})})})})},o3i=({footprint:t})=>{const e=ZVe.string(t.split("_",1)[0]).params().fn;if(ZVe.getModelNames().includes(e)){const A=ZVe.string(t).json();if(A.fn==="flexscreen"){const{fn:c,...l}=A;return De(n3i,{...l})}}let n=t;if(t.startsWith("jstzh1_5mm")){const A=t.match(/jstzh1_5mm(\d+)?/);n=`zh${A&&A[1]?A[1]:"7"}`}else if(t.startsWith("jstph2_0mm")){const A=t.match(/jstph2_0mm(\d+)?/);n=`jst${A&&A[1]?A[1]:"2"}_ph`}else if(t.startsWith("jstxh2_5mm")){const A=t.match(/jstxh2_5mm(\d+)?/);n=`jst${A&&A[1]?A[1]:"2"}_xh`}const o=pI.string(n).json(),i=t.match(/_color\(([^)]+)\)/),r=i?i[1]:void 0,s=(A,c)=>{if(A==null)return c;const l=Ua(A);return Number.isFinite(l)?l:c},a=n2i(o);if(a)return a;switch(o.fn){case"crystal":return De(bxi,{horizontalPadPitch:o.px,verticalPadPitch:o.py,padWidth:o.pw,padHeight:o.ph});case"dip":return De(a2i,{numPins:o.num_pins,pitch:o.p,bodyWidth:o.w});case"axial":return De(pxi,{pitch:o.p});case"tssop":return De(l2i,{pinCount:o.num_pins,leadLength:o.pl,leadWidth:o.pw,pitch:o.p,bodyWidth:o.w});case"msop":return De(g2i,{pinCount:o.num_pins,padContactLength:o.pl,leadWidth:o.pw,pitch:o.p,bodyWidth:o.w});case"vssop":return De(F2i,{pinCount:o.num_pins,leadLength:o.pl,leadWidth:o.pw,pitch:o.p,bodyWidth:o.w,bodyLength:o.h});case"qfp":return De(Msn,{pinCount:o.num_pins,pitch:o.p,leadWidth:o.pw,padContactLength:o.pl,bodyWidth:o.w});case"tqfp":return De(W2i,{});case"lqfp":return De(X2i,{pinCount:o.num_pins});case"qfn":{const A=typeof o.thermalpad?.x=="number"&&typeof o.thermalpad?.y=="number";return De(Rsn,{num_pins:o.num_pins,bodyWidth:o.w,bodyLength:o.h,pitch:o.p,padLength:o.pl,padWidth:o.pw,thermalPadSize:A?{width:o.thermalpad.x,length:o.thermalpad.y}:void 0})}case"dfn":{const A=typeof o.thermalpad?.x=="number"&&typeof o.thermalpad?.y=="number";return De(Jsn,{num_pins:o.num_pins,bodyWidth:o.w,bodyLength:o.h,pitch:o.p,padLength:o.pl,padWidth:o.pw,thermalPadSize:A?{width:o.thermalpad.x,length:o.thermalpad.y}:void 0})}case"pinrow":{const A=t.match(/_rows(\d+)/),c=A&&A[1]?parseInt(A[1],10):1;if(o.male)return De(Nsn,{numberOfPins:o.num_pins,pitch:o.p,invert:o.invert,rows:c,smd:o.smd||o.surface_mount,rightangle:o.rightangle});if(o.female)return De(N2i,{numberOfPins:o.num_pins,pitch:o.p,rows:c})}case"smdpinheader":return De(Mxi,{numberOfPins:o.num_pins,pitch:o.p,bodyWidth:o.bh});case"led5050":return De(Rxi,{color:r});case"cap":{switch(o.imperial){case"0402":return De(vsn,{color:"#856c4d"});case"0603":return De(wsn,{color:"#856c4d"});case"0805":return De(Psn,{color:"#856c4d"});case"0201":return De(ksn,{color:"#856c4d"});case"01005":return De(Fsn,{color:"#856c4d"});case"1206":return De(Lsn,{color:"#856c4d"});case"1210":return De(Hsn,{color:"#856c4d"});case"2010":return De(Osn,{color:"#856c4d"});case"2512":return De(Gsn,{color:"#856c4d"})}break}case"sot23":switch(o.num_pins){case 3:return De(b2i,{color:r});case 5:return De(Tsn,{})}break;case"sot25":return De(Tsn,{});case"sot":case"sot343":{const A=o.fn==="sot343";return De(Dxi,{pads:nan(n),bodyWidth:A?1.25:1.6,bodyLength:A?2:2.9,bodyHeight:A?1.1:1.3})}case"sot563":return De(Yxi,{});case"sot89":{const A=s(o.w,4.2);return De(zsn,{fullWidth:A,bodyWidth:A*.6,bodyLength:s(o.h,4.8)*.94,bodyHeight:1.5,leadWidth:s(o.pw,.48),tabLeadWidth:s(o.pw,.48)*2,padPitch:s(o.p,1.5),leadHeight:.66})}case"sot457":return De(sxi,{});case"smdslideswitch":return De(Gxi,{footprint:n});case"usbcmidmount":return De(Kxi,{footprint:n});case"sot143":return De(Vxi,{footprint:n});case"sot223":return De(zsn,{});case"sot23w":return De(S2i,{});case"sot323":return De(j2i,{});case"sod323f":return De(dxi,{});case"sod323fl":return De(hxi,{});case"sot363":return De(uxi,{});case"sot886":return De(gxi,{});case"sot963":return De(axi,{});case"pushbutton":return De(R2i,{width:o.w,length:o.h,innerDiameter:o.id});case"jst":if(Zsn(n))return De(Exi,{footprint:n});if(o.zh)return De(Cxi,{numPins:o.num_pins});if(o.ph)return De(yxi,{numPins:o.num_pins});if(o.xh)return De(xxi,{numPins:o.num_pins});break;case"fpc":return De(Pxi,{pinCount:o.num_pins,pitch:o.p,padWidth:o.pw,padLength:o.pl,staggered:o.staggered,reverse:o.reverse,rowPitch:o.py,topPadLength:o.toppl,bottomPadLength:o.bottompl,mountPadPitchX:o.mpx,mountPadOffsetY:o.mpy,mountTop:o.mounttop,mountPadWidth:o.mpw,mountPadLength:o.mpl});case"rj45":return De(kxi,{bodyWidth:o.w,bodyDepth:o.h,bodyCenterY:o.bodyy,ledPins:o.ledpins||o.num_pins===14,firstPinLeft:o.firstpinleft,firstPinTop:o.firstpintop,signalPitch:o.p,signalRowPitch:o.py,signalHoleDiameter:o.id,shieldPinX:o.shieldx,shieldPinY:o.shieldy,shieldHoleDiameter:o.shieldid,locatorHoleX:o.holex,locatorHoleY:o.holey,locatorHoleDiameter:o.holed,ledPinX:o.ledx,ledPinPitch:o.ledp,ledPinY:o.ledy});case"soic":case"sop8":case"ssop":return De(k2i,{pinCount:o.num_pins,leadLength:o.pl,leadWidth:o.pw,pitch:o.p,bodyWidth:o.w});case"son":case"wson":case"vson":{const A=o.fn==="vson"?s(o.grid?.x,3):s(o.w,3),c=o.fn==="vson"?s(o.grid?.y,3):s(o.h,3),l=s(o.epw,0),u=s(o.eph,0),g=o.pl!==void 0?s(o.pl,0):void 0,h=o.pw!==void 0?s(o.pw,0):void 0,d=nan(n).filter(f=>Number(f.pin??0)<=o.num_pins),p=f=>new Set(f.map(I=>I.toFixed(3))).size,m=d.length>2&&p(d.map(f=>f.y))===2&&p(d.map(f=>f.x))>2,_=De(Jsn,{num_pins:o.num_pins,bodyWidth:m?c:A,bodyLength:m?A:c,pitch:s(o.p,.5),padLength:g,padWidth:h,thermalPadSize:o.ep&&l>0&&u>0?{width:m?u:l,length:m?l:u}:void 0});return m?De(Ac,{rotation:[0,0,"90deg"],children:_}):_}case"mlp":case"lga":case"quad":return o.legsoutside?De(Msn,{pinCount:o.num_pins,pitch:s(o.p,.5),leadWidth:s(o.pw,.25),padContactLength:s(o.pl,.25),bodyWidth:s(o.w,6)}):De(Rsn,{num_pins:o.num_pins,bodyWidth:s(o.w,6),bodyLength:s(o.h,6),pitch:s(o.p,.5),padLength:s(o.pl,.25),padWidth:s(o.pw,.25)});case"bga":{const A=s(o.p,.8),c=o.grid?.x??8,l=o.grid?.y??8;return De(Uxi,{ballPitch:A,ballColumns:c,ballRows:l,ballDiameter:A*.625,packageWidth:c*A,packageLength:l*A})}case"sod523":return De(L2i,{});case"sod723":return De(Ixi,{});case"sod882":return De(Usn,{});case"sma":return De(H2i,{});case"smb":return De(Ksn,{});case"smc":return De(O2i,{});case"smf":return De(G2i,{});case"sod123":return De(K2i,{});case"sod123f":return De(Y2i,{});case"sod123fl":return De(U2i,{});case"sod123w":return De(Vsn,{});case"sod110":return De(Vsn,{bodyWidth:2.1,bodyLength:1.4});case"sod128":return De(V2i,{});case"sod323":return De(qsn,{});case"sod323w":return De(qsn,{});case"sod80":return De(Wsn,{});case"sod882d":return De(Usn,{});case"smbf":return De(Ksn,{});case"led2835":return De(Txi,{color:r,bodyWidth:s(o.w,3.5),bodyLength:s(o.h,2.8),pad1X:s(o.p1x,-.9),pad1Width:s(o.p1w,2.2),pad2X:s(o.p2x,1.375),pad2Width:s(o.p2w,1.25),padLength:s(o.ph,2.2)});case"electrolytic":case"radial":{const A=s(o.p,2.5),c=t.match(/_d([\d.]+)/),l=o.d!==void 0?s(o.d,A*2):c?Number(c[1]):A*2;return De(Lxi,{diameter:l,leadPitch:A})}case"potentiometer":return De(Hxi,{bodyWidth:s(o.w,5.35),bodyLength:s(o.ca,14),bodyHeight:s(o.h,4),leads:JX(n)});case"smdpushbutton":return De(Oxi,{padSpanX:s(o.px,4.2),padSpanY:s(o.py,2.15),padWidth:s(o.pw,1.05),padLength:s(o.ph,.7)});case"breakoutheaders":{const A=s(o.p,2.54),c=s(o.w,10)/2,l=[{x:-c,pins:o.left??0,key:"left"},{x:c,pins:o.right??0,key:"right"}];return De(Ei,{children:l.filter(({pins:u})=>u>0).map(({x:u,pins:g,key:h})=>De(Uo,{center:[u,0,0],children:De(Ac,{rotation:[0,0,"90deg"],children:De(Nsn,{numberOfPins:g,pitch:A})})},h))})}case"sod923":return De(z2i,{});case"hc49":return De(exi,{});case"micromelf":return De(txi,{});case"minimelf":return De(Wsn,{});case"melf":return De(nxi,{});case"ms012":return De(oxi,{pinCount:o.num_pins,padContactLength:o.pl,leadWidth:o.pw,pitch:o.p});case"ms013":return De(ixi,{pinCount:o.num_pins,padContactLength:o.pl,leadWidth:o.pw,pitch:o.p});case"sot723":return De(Z2i,{});case"to220":return De(jsn,{leads:JX(n)});case"to220f":return De(jsn,{mouldedTab:!0,leads:JX(n)});case"to92":return De($sn,{leads:JX(n)});case"to92l":case"to92s":{const A=s(o.w,4.8),c=s(o.h,4),l=Math.max(A,c);return De($sn,{bodyDiameter:l,flatCut:Math.max(l-Math.min(A,c),.4),leads:JX(n)})}case"to252":case"dpak":case"to263":case"d2pak":{const A=o.fn==="to263"||o.fn==="d2pak",c=s(o.tabw,A?8.38:6.2),l=Math.min(s(o.tabh,A?10:5.8),A?10:6.5);return De(Fxi,{bodyWidth:c,bodyLength:s(o.w,A?10.1:6.6),bodyHeight:A?4.4:2.3,tabWidth:c,tabLength:l,span:s(o.span,A?10.21:6.85),pitch:s(o.p,A?2.54:2.29),leadWidth:s(o.pw,1.5),leadContactLength:s(o.pl,3)})}case"stampboard":case"stampreceiver":return De(mxi,{bodyWidth:o.w,leadsLeft:o.left,leadsRight:o.right,leadsTop:o.top,leadsBottom:o.bottom,leadsPitch:o.p,leadWidth:o.pw,leadLength:o.pl,innerHoles:o.innerhole,innerHoleEdgeDistance:o.innerholeedgedistance});case"mountedpcbmodule":{const A=o.rows??1,c=o.pinRowSide??"left",l=o.holeInset,u=o.width,g=o.height,h=o.pinrow,d=o.pinRowHoleEdgeToEdgeDist,p=Array.isArray(o.holes)?o.holes:[];return De(_xi,{numPins:h,rows:A,p:o.p,id:o.id,od:o.od,width:u,height:g,pinRowSide:c,holes:p,holeInset:l,pinRowHoleEdgeToEdgeDist:d,nopin:o.nopin,female:o.female,screen:o.screen,screenWidth:o.screenwidth,screenHeight:o.screenheight,screenCenterOffsetX:o.screencenteroffsetx,screenCenterOffsetY:o.screencenteroffsety})}}switch(o.imperial){case"0402":return De(vsn,{color:r});case"0603":return De(wsn,{color:r});case"0805":return De(Psn,{color:r});case"0201":return De(ksn,{color:r});case"01005":return De(Fsn,{color:r});case"1206":return De(Lsn,{color:r});case"1210":return De(Hsn,{color:r});case"2010":return De(Osn,{color:r});case"2512":return De(Gsn,{color:r})}if((o.fn==="res"||o.fn==="cap")&&o.p!==void 0&&o.ph!==void 0){const A=Ua(o.p),c=Ua(o.ph);if(Number.isFinite(A)&&Number.isFinite(c))return De(Nxi,{padPitch:A,padHeight:c,color:r??(o.fn==="cap"?"#856c4d":void 0)})}return null},i3i=t=>t&&typeof t=="object"&&"type"in t,WY=t=>{if(typeof t=="number")return t;if(typeof t=="string"){const e=/^(-?\d+(?:\.\d+)?)\s*deg$/i.exec(t);if(e)return parseFloat(e[1])*Math.PI/180;const n=Number(t);if(!Number.isNaN(n))return n}return 0},r3i=t=>Array.isArray(t)?[Number(t[0])||0,Number(t[1])||0,Number(t[2])||0]:typeof t=="object"&&t?[Number(t.x)||0,Number(t.y)||0,Number(t.z)||0]:[0,0,0];function P6(t,e,n){const{jscad:{primitives:o,booleans:i,hulls:r,geometries:s,extrusions:a,transforms:A}}=n;if(t==null||t===!1)return[];if(Array.isArray(t))return t.flatMap(g=>P6(g,e,n));if(!i3i(t))return[];const{type:c,props:l,children:u}=t;if(c===bsn)return(u??[]).flatMap(g=>P6(g,e,n));if(c===qo){const g=l?.color;return(u??[]).flatMap(h=>P6(h,g??e,n))}if(c===Uo){const g=r3i(l?.offset??l?.center??{x:l?.x,y:l?.y,z:l?.z});return(u??[]).flatMap(d=>P6(d,e,n)).map(({geom:d,color:p})=>({geom:A.translate(g,d),color:p??e}))}if(c===Ac){const g=l?.angles??l?.rotation,h=Array.isArray(g)?[WY(g[0]),WY(g[1]),WY(g[2])]:[WY(l?.x??0),WY(l?.y??0),WY(l?.z??0)];return(u??[]).flatMap(p=>P6(p,e,n)).map(({geom:p,color:m})=>({geom:A.rotateZ(h[2],A.rotateY(h[1],A.rotateX(h[0],p))),color:m}))}if(c===gh||c===e0||c===ZA){const g=(u??[]).flatMap(d=>P6(d,e,n)).map(d=>d.geom);if(g.length===0)return[];let h;return c===gh?h=i.union(g):c===e0?h=i.subtract(g[0],g.slice(1)):h=r.hull(g),[{geom:h,color:e}]}if(c===kY){const g=l?.points??[];return[{geom:s.geom2.fromPoints(g),color:e??l?.color}]}if(c===FY){const g=(u??[]).flatMap(m=>P6(m,e,n)).map(m=>m.geom);if(g.length===0)return[];const h=g.length>1?i.union(g):g[0],d=l?.height??l?.h??1;let p=a.extrudeLinear({height:d},h);if(p.polygons)for(const m of p.polygons)!m.plane||!m.vertices||m.vertices.length<3||m.vertices.reverse();return[{geom:p,color:e??l?.color}]}if(c===$t||c===Ssn||c===Ns||c===TY||c===A1||c===a2){let g;if(c===$t){const h=l?.size??[1,1,1],d=l?.offset,p=l?.center??(d?[d[0],d[1],d[2]]:[0,0,0]);g=o.cuboid({size:h,center:p})}else if(c===Ssn){const h=l?.size??1,d=l?.offset,p=l?.center??(d?[d[0],d[1],d[2]]:[0,0,0]);g=o.cube({size:h,center:p})}else if(c===Ns){const h=l?.height??1,d=l?.radius??1,p=l?.center??[0,0,0];g=o.cylinder({height:h,radius:d,center:p})}else if(c===TY){const h=l?.radius??1,d=l?.center??[0,0,0];g=o.sphere({radius:h,center:d})}else if(c===a2){const h=l?.height??1,d=l?.radius??1,p=l?.roundRadius??.1,m=l?.center??[0,0,0];g=o.roundedCylinder({height:h,radius:d,roundRadius:p,center:m})}else{const h=l?.size??[1,1,1],d=l?.roundRadius??.1,p=l?.center??[0,0,0];g=o.roundedCuboid({size:h,roundRadius:d,center:p})}return[{geom:g,color:e??l?.color}]}if(typeof c=="function"){const g=c(l??{});return P6(g,e,n)}return(u??[]).flatMap(g=>P6(g,e,n))}function s3i(t,e){return{geometries:P6(t,void 0,{jscad:e})}}function aan(t){if(t.polygons){const e=[],n=[],o=[];let i=0;for(const s of t.polygons){for(const A of s.vertices)A.index=i,e.push(A[0],A[1],A[2]),t.color&&t.color.length>=3?o.push(t.color[0],t.color[1],t.color[2]):o.push(1,1,1),i++;const a=s.vertices[0].index;for(let A=2;A<s.vertices.length;A++){const c=s.vertices[A-1].index,l=s.vertices[A].index;n.push(a,c,l)}}const r=new Zl;if(r.setAttribute("position",new tg(new Float32Array(e),3)),r.setIndex(n),o.length>0&&r.setAttribute("color",new tg(new Float32Array(o),3)),t.transforms){const s=new va;s.fromArray(t.transforms),r.applyMatrix4(s)}return r.computeVertexNormals(),r}if(t.sides){const e=[],n=[];for(const i of t.sides)e.push(i[0][0],i[0][1],0),t.color&&t.color.length>=3?n.push(t.color[0],t.color[1],t.color[2]):n.push(1,1,1);const o=new Zl;if(o.setAttribute("position",new tg(new Float32Array(e),3)),n.length>0&&o.setAttribute("color",new tg(new Float32Array(n),3)),t.transforms){const i=new va;i.fromArray(t.transforms),o.applyMatrix4(i)}return o}return console.error("Invalid CSG object: neither polygons nor sides found"),new Zl}function a3i(t,e){const n=eze(o3i,{footprint:t});return s3i(n,e)}var A3i=_0(Ape()),Aan=ee.createContext(null),c3i=()=>{const t=ee.useContext(Aan);if(!t)throw new Error("useHover must be used within a HoverProvider");return t},l3i=({children:t})=>{const{camera:e,renderer:n}=uf(),[o,i]=ee.useState([]),r=ee.useMemo(()=>new uJt,[]),s=ee.useMemo(()=>new ni,[]),a=ee.useRef(o);a.current=o;const A=ee.useRef(null),c=ee.useCallback(d=>{i(p=>[...p,d])},[]),l=ee.useCallback(d=>{if(A.current){let p=!1,m=A.current.object;for(;m;){if(m===d){p=!0;break}m=m.parent}p&&(A.current.onUnhover(),A.current=null)}i(p=>p.filter(m=>m.object!==d))},[]),u=ee.useCallback(d=>{let p=d;for(;p;){const m=a.current.find(_=>_.object===p);if(m)return m;p=p.parent}},[]),g=ee.useCallback(d=>{if(!n.domElement)return;const p=n.domElement.getBoundingClientRect();s.x=(d.clientX-p.left)/p.width*2-1,s.y=-((d.clientY-p.top)/p.height)*2+1,r.setFromCamera(s,e);const m=a.current.map(f=>f.object);if(m.length===0){A.current&&(A.current.onUnhover(),A.current=null);return}const _=r.intersectObjects(m,!0);if(_.length>0){const f=_[0],I=u(f.object);if(I){const C={mousePosition:[f.point.x,f.point.y,f.point.z]};A.current!==I?(A.current?.onUnhover(),I.onHover(C),A.current=I):I.onHover(C)}else A.current&&(A.current.onUnhover(),A.current=null)}else A.current&&(A.current.onUnhover(),A.current=null)},[e,n,r,s,u]);ee.useEffect(()=>{const d=n.domElement;return d.addEventListener("mousemove",g),()=>{d.removeEventListener("mousemove",g)}},[n,g]);const h=ee.useMemo(()=>({addHoverable:c,removeHoverable:l}),[c,l]);return K.jsx(Aan.Provider,{value:h,children:t})},u3i=({children:t,object:e,onHover:n,onUnhover:o,isHovered:i})=>{const{addHoverable:r,removeHoverable:s}=c3i();return ee.useEffect(()=>e?(r({object:e,onHover:n,onUnhover:o}),()=>{s(e)}):void 0,[e,n,o,r,s]),K.jsx(K.Fragment,{children:t})},jX=u3i,p4=(t,{castShadow:e=!0,receiveShadow:n=!0}={})=>{t.traverse(o=>{o instanceof Er&&(o.castShadow=e,o.receiveShadow=n)})},g3i=({positionOffset:t,footprint:e,rotationOffset:n,onHover:o,onUnhover:i,isHovered:r,scale:s,isTranslucent:a=!1})=>{const{rootObject:A}=uf(),c=ee.useMemo(()=>{if(!e)return null;const{geometries:l}=a3i(e,A3i),u=new lh;for(const g of l.flat(1/0)){const h=g.geom;if(!h||!h.polygons&&!h.sides)continue;const d=new Vi(g.color);d.convertLinearToSRGB();const p={...h,color:[d.r,d.g,d.b]},m=aan(p),_=new su({vertexColors:!0,side:r_,transparent:a,opacity:a?.5:1,depthWrite:!a}),f=new Er(m,_);f.renderOrder=a?2:1,p4(f,{castShadow:!a,receiveShadow:!0}),u.add(f)}return u},[e,a]);return ee.useEffect(()=>{if(!(!c||!A))return A.add(c),()=>{A.remove(c)}},[A,c]),ee.useEffect(()=>{c&&(t&&c.position.fromArray(t),n&&c.rotation.fromArray(n),s!==void 0&&c.scale.setScalar(s))},[c,t?.[0],t?.[1],t?.[2],n?.[0],n?.[1],n?.[2],s]),ee.useEffect(()=>{c&&c.traverse(l=>{l instanceof Er&&l.material instanceof su&&(r?(l.material.emissive.setHex(255),l.material.emissiveIntensity=.2):l.material.emissiveIntensity=0)})},[r,c]),c?K.jsx(jX,{isHovered:r,onHover:o,onUnhover:i,object:c}):null},can=new WeakMap,d3i=()=>{const t=new Hg;return t.name="fallback-environment-map",t.mapping=fde,t},h3i=t=>{if(!t)return null;const e=t,n=can.get(e);if(n)return n;let o;if(t instanceof $de){const i=new DTe(t);o=i.fromScene(Pni(),.04).texture,i.dispose()}else o=d3i();return can.set(e,o),o};function p3i(t){const e=new e2;let n=!1;t.updateWorldMatrix(!0,!1);const o=t.parent?t.parent.matrixWorld.clone().invert():new va;return t.traverse(i=>{if(i.updateWorldMatrix(!0,!1),i instanceof Er&&i.geometry&&(i.geometry.boundingBox||i.geometry.computeBoundingBox(),i.geometry.boundingBox)){const r=o.clone().multiply(i.matrixWorld),s=i.geometry.boundingBox.clone();s.applyMatrix4(r),n?e.union(s):(e.copy(s),n=!0)}}),n?e:null}function m3i(t){const e=p3i(t);return e?e.getSize(new jt):new jt}function _3i(t,e,n="contain_within_bounds"){if(!e)return[1,1,1];const o=m3i(t),i=[o.x>0?e[0]/o.x:1,o.y>0?e[1]/o.y:1,o.z>0?e[2]/o.z:1];if(n==="fill_bounds")return i;const r=Math.min(...i);return[r,r,r]}var Bze=({model:t,position:e,rotation:n,modelOffset:o=[0,0,0],modelRotation:i=[0,0,0],sourceCoordinateTransform:r,modelSize:s,modelFitMode:a="contain_within_bounds",scale:A})=>{const{rootObject:c}=uf(),l=ee.useMemo(()=>new lh,[]),u=ee.useMemo(()=>new lh,[]),g=ee.useMemo(()=>new lh,[]),h=ee.useMemo(()=>new lh,[]);return ee.useEffect(()=>(l.add(u),()=>{l.remove(u)}),[l,u]),ee.useEffect(()=>(u.add(g),()=>{u.remove(g)}),[u,g]),ee.useEffect(()=>(g.add(h),()=>{g.remove(h)}),[g,h]),ee.useEffect(()=>{for(;h.children.length>0;){const d=h.children[0];if(!d)break;h.remove(d)}t&&h.add(t)},[h,t]),ee.useEffect(()=>{if(!r){h.matrixAutoUpdate=!0,h.position.set(0,0,0),h.rotation.set(0,0,0),h.scale.set(1,1,1),h.updateMatrix();return}h.matrixAutoUpdate=!1,h.matrix.copy(r),h.matrixWorldNeedsUpdate=!0},[h,r]),ee.useEffect(()=>{if(c)return c.add(l),()=>{c.remove(l)}},[c,l]),ee.useEffect(()=>{if(e?l.position.fromArray(e):l.position.set(0,0,0),n?l.rotation.fromArray(n):l.rotation.set(0,0,0),g.position.fromArray(o),g.rotation.fromArray(i),g.scale.setScalar(A??1),!t){u.scale.set(1,1,1);return}u.scale.set(1,1,1),u.updateWorldMatrix(!0,!0);const d=_3i(g,s,a);u.scale.set(d[0],d[1],d[2])},[l,u,t,a,o,h,g,i,s,e,n,A]),{boardTransformGroup:l}},lan=1.25;function uan({gltfUrl:t,position:e,rotation:n,modelOffset:o=[0,0,0],modelRotation:i=[0,0,0],sourceCoordinateTransform:r,modelSize:s,modelFitMode:a="contain_within_bounds",onHover:A,onUnhover:c,isHovered:l,scale:u,isTranslucent:g=!1}){const{renderer:h}=uf(),[d,p]=ee.useState(null),[m,_]=ee.useState(null),{boardTransformGroup:f}=Bze({model:d,position:e,rotation:n,modelOffset:o,modelRotation:i,sourceCoordinateTransform:r,modelSize:s,modelFitMode:a,scale:u});if(ee.useEffect(()=>{if(!t)return;const I=new Dni;let C=!0;return I.load(t,y=>{if(!C)return;const x=y.scene;x.traverse(E=>{if(E instanceof Er&&E.material){const B=S=>{S.transparent=g,S.opacity=g?.5:1,S.depthWrite=!g,S.needsUpdate=!0};Array.isArray(E.material)?E.material.forEach(B):B(E.material),E.renderOrder=g?2:1}}),p4(x,{castShadow:!g,receiveShadow:!0}),p(x)},void 0,y=>{if(!C)return;console.error(`An error happened loading ${t}`,y);const x=y instanceof Error?y:new Error(`Failed to load glTF model from ${t}`);_(x)}),()=>{C=!1}},[t,g]),ee.useEffect(()=>{if(!d||!h)return;const I=h3i(h);if(!I)return;const C=[],y=x=>{x instanceof su&&(C.push({material:x,envMap:x.envMap??null,envMapIntensity:x.envMapIntensity??1}),x.envMap=I,(typeof x.envMapIntensity!="number"||x.envMapIntensity<lan)&&(x.envMapIntensity=lan),x.needsUpdate=!0)};return d.traverse(x=>{if(!(x instanceof Er))return;const E=x.material;Array.isArray(E)?E.forEach(y):E&&y(E)}),()=>{C.forEach(({material:x,envMap:E,envMapIntensity:B})=>{x.envMap=E,x.envMapIntensity=B,x.needsUpdate=!0})}},[d,h]),ee.useEffect(()=>{d&&d.traverse(I=>{if(!(I instanceof Er))return;const C=Array.isArray(I.material)?I.material:[I.material];for(const y of C)y instanceof su&&(l?(y.emissive.setHex(255),y.emissiveIntensity=.2):y.emissiveIntensity=0)})},[l,d]),m)throw m;return d?K.jsx(jX,{isHovered:l,onHover:A,onUnhover:c,object:f}):null}var f3i=_0(Brn()),I3i=_0(Ape()),C3i=({jscadPlan:t,positionOffset:e,rotationOffset:n,modelOffset:o=[0,0,0],modelRotation:i=[0,0,0],sourceCoordinateTransform:r,modelSize:s,modelFitMode:a="contain_within_bounds",onHover:A,onUnhover:c,isHovered:l,scale:u,isTranslucent:g=!1})=>{const{threeGeom:h,material:d}=ee.useMemo(()=>{const _=(0,f3i.executeJscadOperations)(I3i.default,t);if(!_||!_.polygons&&!_.sides)return{threeGeom:null,material:null};const f=aan(_),I=new su({vertexColors:!0,side:r_,transparent:g,opacity:g?.5:1,depthWrite:!g});return{threeGeom:f,material:I}},[t,g]),p=ee.useMemo(()=>{if(!h)return null;const _=new Er(h,d);return _.renderOrder=g?2:1,p4(_,{castShadow:!g,receiveShadow:!0}),_},[h,d,g]),{boardTransformGroup:m}=Bze({model:p,position:e,rotation:n,modelOffset:o,modelRotation:i,sourceCoordinateTransform:r,modelSize:s,modelFitMode:a,scale:u});return ee.useEffect(()=>{if(d)if(l){const _=new Vi(d.color.getHex());d.emissive.copy(_),d.emissive.setRGB(0,0,1),d.emissiveIntensity=.2}else d.emissiveIntensity=0},[l,d]),h?K.jsx(jX,{isHovered:l,onHover:A,onUnhover:c,object:m}):null};function y3i(t){return t.replace(/(DEF|USE)\s+([^\s]+)/g,(e,n,o)=>`${n} ${o.replace(/-/g,"_")}`)}async function x3i(t){const e=await fetch(t);if(!e.ok)throw new Error(`Failed to fetch "${t}": ${e.status} ${e.statusText}`);const n=await e.text();return new _oi().parse(y3i(n),t)}typeof window<"u"&&!window.TSCIRCUIT_OBJ_LOADER_CACHE&&(window.TSCIRCUIT_OBJ_LOADER_CACHE=new Map);function E3i(t){const[e,n]=ee.useState(null);return ee.useEffect(()=>{if(!t)return;const o=t.replace(/&cachebust_origin=$/,""),i=window.TSCIRCUIT_OBJ_LOADER_CACHE;let r=!1;async function s(){try{if(o.endsWith(".wrl"))return await x3i(o);const A=await fetch(o);if(!A.ok)throw new Error(`Failed to fetch "${o}": ${A.status} ${A.statusText}`);const c=await A.text(),l=c.match(/newmtl[\s\S]*?endmtl/g),u=new Soi;if(l?.length){const g=l.join(`
`).replace(/^d\s+0\./gm,"d 1."),h=c.replace(/newmtl[\s\S]*?endmtl/g,"").replace(/^mtllib.*/gm,""),d=new hoi;d.setMaterialOptions({invertTrProperty:!0});const p=d.parse(g,"embedded.mtl");return u.setMaterials(p),u.parse(h)}return u.parse(c.replace(/^mtllib.*/gm,""))}catch(A){return A}}function a(){if(i.has(o)){const c=i.get(o);return c.result?Promise.resolve(c.result.clone()):c.promise.then(l=>l instanceof Error?l:l.clone())}const A=s().then(c=>(c instanceof Error||i.set(o,{...i.get(o),result:c}),c));return i.set(o,{promise:A,result:null}),A}return a().then(A=>{r||n(A)}).catch(A=>{console.error(A)}),()=>{r=!0}},[t]),e}function B3i({url:t,position:e,rotation:n,modelOffset:o=[0,0,0],modelRotation:i=[0,0,0],sourceCoordinateTransform:r,modelSize:s,modelFitMode:a="contain_within_bounds",onHover:A,onUnhover:c,isHovered:l,scale:u,isTranslucent:g=!1}){const h=E3i(t),d=ee.useMemo(()=>{if(h&&!(h instanceof Error))return h.traverse(_=>{if(_ instanceof Er&&_.material){const f=I=>{I.transparent=g,I.opacity=g?.5:1,I.depthWrite=!g,I.needsUpdate=!0};Array.isArray(_.material)?_.material.forEach(f):f(_.material),_.renderOrder=g?2:1}}),p4(h,{castShadow:!g,receiveShadow:!0}),h;const m=new Er(new Yx(.5,.5,.5),new su({transparent:!0,color:"red",opacity:.25}));return p4(m,{castShadow:!1,receiveShadow:!0}),m},[h,g]),{boardTransformGroup:p}=Bze({model:d,position:Array.isArray(e)?e:e?[e.x,e.y,e.z]:void 0,rotation:Array.isArray(n)?n:n?[n.x,n.y,n.z]:void 0,modelOffset:o,modelRotation:i,sourceCoordinateTransform:r,modelSize:s,modelFitMode:a,scale:u});if(h instanceof Error)throw h;return K.jsx(jX,{isHovered:l,onHover:A,onUnhover:c,object:p})}var b3i=new Vi(.82,.82,.82),gan=t=>new su({color:t?new Vi(t[0],t[1],t[2]):b3i});function S3i(t,e){const n=gan(e.color),o=e.brep_faces??[];if(o.length===0)return[n];const i=o.length>1?[...o].sort((u,g)=>u.first-g.first):o,r=[n],s=new Map,a=e.index.array.length/3;let A=0,c=0;const l=u=>{if(!u)return 0;const g=u.join(","),h=s.get(g);if(h!==void 0)return h;const d=r.length;return r.push(gan(u)),s.set(g,d),d};for(;A<a;){const u=i[c];let g=a,h=0;u&&(A<u.first?g=u.first:(g=u.last+1,h=l(u.color),c+=1)),g>A&&t.addGroup(A*3,(g-A)*3,h),A=g}return r}function Q3i(t){const e=new lh;for(const n of t){const o=n.attributes.position?.array??[],i=n.index?.array??[];if(!o.length||!i.length)continue;const r=new Zl;r.setAttribute("position",new Bs(o,3));const s=n.attributes.normal?.array??[];s.length?r.setAttribute("normal",new Bs(s,3)):r.computeVertexNormals(),r.setIndex(i),r.clearGroups();const a=S3i(r,n),A=new Er(r,a.length>1?a:a[0]);A.name=n.name,e.add(A)}return e}var bze,v3i="https://cdn.jsdelivr.net/npm/occt-import-js@0.0.23/dist";function w3i(t){if(typeof t=="function")return t;if(t&&typeof t=="object"&&"default"in t&&typeof t.default=="function")return t.default;throw new Error("Unable to resolve occt-import-js factory export")}async function P3i(){if(!bze){const t=await import("https://cdn.jsdelivr.net/npm/occt-import-js@0.0.23/+esm");bze=w3i(t)({locateFile:n=>`${v3i}/${n}`})}return bze}async function M3i(t){const e=await fetch(t);if(!e.ok)throw new Error(`Failed to fetch STEP file: ${e.statusText}`);const n=await e.arrayBuffer(),i=(await P3i()).ReadStepFile(new Uint8Array(n),null);if(!i.success||!i.meshes.length)throw new Error("occt-import-js failed to convert STEP file");const r=Q3i(i.meshes),s=new pke;return await new Promise((A,c)=>{s.parse(r,l=>{l instanceof ArrayBuffer?A(l):c(new Error("GLTFExporter did not return binary output"))},l=>{c(l)},{binary:!0})})}var dan="step-glb-cache:v2:";function D3i(t){const e=new Uint8Array(t),n=32768;let o="";for(let i=0;i<e.length;i+=n){const r=e.subarray(i,i+n);o+=String.fromCharCode(...r)}return btoa(o)}function N3i(t){const e=atob(t),n=new Uint8Array(e.length);for(let o=0;o<e.length;o+=1)n[o]=e.charCodeAt(o);return n.buffer}function R3i(t){try{const e=localStorage.getItem(`${dan}${t}`);return e?N3i(e):null}catch(e){return console.warn("Failed to read STEP GLB cache",e),null}}function han(t,e){try{const n=D3i(e);localStorage.setItem(`${dan}${t}`,n)}catch(n){console.warn("Failed to write STEP GLB cache",n)}}function T3i(){const t=globalThis;return t.stepUrlToGltfModelConversions||(t.stepUrlToGltfModelConversions={inProgress:new Map,completed:new Map}),t.stepUrlToGltfModelConversions}var k3i=({stepUrl:t,position:e,rotation:n,modelOffset:o,modelRotation:i,sourceCoordinateTransform:r,modelSize:s,modelFitMode:a,scale:A,onHover:c,onUnhover:l,isHovered:u,isTranslucent:g})=>{const[h,d]=ee.useState(null);return ee.useEffect(()=>{let p=!0,m=null,_=!0;const f=T3i(),I=R3i(t);if(I){const x={arrayBuffer:I,blobUrl:URL.createObjectURL(new Blob([I],{type:"model/gltf-binary"}))};return f.completed.set(t,x),m=x.blobUrl,_=!1,d(x.blobUrl),()=>{p=!1,m&&_&&URL.revokeObjectURL(m)}}const C=f.completed.get(t);if(C)return m=C.blobUrl,_=!1,d(C.blobUrl),han(t,C.arrayBuffer),()=>{p=!1,m&&_&&URL.revokeObjectURL(m)};let y=f.inProgress.get(t);return y||(y=M3i(t).then(x=>{const E={arrayBuffer:x,blobUrl:URL.createObjectURL(new Blob([x],{type:"model/gltf-binary"}))};return f.completed.set(t,E),f.inProgress.delete(t),E}).catch(x=>{throw f.inProgress.delete(t),x}),f.inProgress.set(t,y)),y.then(x=>{p&&(m=x.blobUrl,_=!1,d(x.blobUrl),han(t,x.arrayBuffer))}).catch(x=>{console.error("Failed to convert STEP file to GLB",x),p&&d(null)}),()=>{p=!1,m&&_&&URL.revokeObjectURL(m)}},[t]),h?K.jsx(uan,{gltfUrl:h,position:e,rotation:n,modelOffset:o,modelRotation:i,sourceCoordinateTransform:r,modelSize:s,modelFitMode:a,scale:A,onHover:c,onUnhover:l,isHovered:u,isTranslucent:g}):null};function wpe(t,e){let{x:n,y:o,z:i}=t;if(e.axisMapping){const r={x:n,y:o,z:i};e.axisMapping.x&&(n=Sze(r,e.axisMapping.x)),e.axisMapping.y&&(o=Sze(r,e.axisMapping.y)),e.axisMapping.z&&(i=Sze(r,e.axisMapping.z))}if(n*=e.flipX??1,o*=e.flipY??1,i*=e.flipZ??1,e.rotation){if(e.rotation.x){const r=e.rotation.x*Math.PI/180,s=Math.cos(r),a=Math.sin(r),A=o*s-i*a,c=o*a+i*s;o=A,i=c}if(e.rotation.y){const r=e.rotation.y*Math.PI/180,s=Math.cos(r),a=Math.sin(r),A=n*s+i*a,c=-n*a+i*s;n=A,i=c}if(e.rotation.z){const r=e.rotation.z*Math.PI/180,s=Math.cos(r),a=Math.sin(r),A=n*s-o*a,c=n*a+o*s;n=A,o=c}}return{x:n,y:o,z:i}}function Sze(t,e){switch(e){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}}var Qze={STEP_INVERTED:{axisMapping:{x:"-x",y:"z",z:"-y"}},Z_UP_TO_Y_UP_USB_FIX:{axisMapping:{x:"x",y:"-z",z:"y"},flipZ:-1},FOOTPRINTER_MODEL_TRANSFORM:{axisMapping:{x:"x",y:"-z",z:"y"},flipX:-1,rotation:{x:180,y:180}}};function F3i(t,e){if(e.coordinateTransform)return e.coordinateTransform;if(!e.usingGlbCoordinates){if(e.hasFootprinterModel)return Qze.FOOTPRINTER_MODEL_TRANSFORM;if(!e.usingObjFormat)return e.usingStepFormat?Qze.STEP_INVERTED:Qze.Z_UP_TO_Y_UP_USB_FIX}}function $X(t,e){return F3i(t,{usingGlbCoordinates:e==="gltf"||e==="glb"||e==="jscad",usingObjFormat:e==="obj"||e==="wrl",usingStepFormat:e==="step",hasFootprinterModel:e==="footprinter"})}function Ppe(t){if(!t)return;const e=wpe({x:1,y:0,z:0},t),n=wpe({x:0,y:1,z:0},t),o=wpe({x:0,y:0,z:1},t);return new va().makeBasis(new jt(e.x,e.y,e.z),new jt(n.x,n.y,n.z),new jt(o.x,o.y,o.z))}function _P(t){return t*Math.PI/180}function L3i(t){if(t==="z+")return[0,0,0];switch(t){case"x+":return[0,_P(-90),0];case"x-":return[0,_P(90),0];case"y+":return[_P(90),0,0];case"y-":return[_P(-90),0,0];case"z-":return[_P(180),0,0];default:return[0,0,0]}}function H3i(t,e,n){if(!t.position)return;let o=t.position.z;return!t.is_on_folded_board&&t.pcb_component_id&&e==="bottom"&&t.position.z>=0&&(o=-(t.position.z+n)),[t.position.x,t.position.y,o]}function O3i(t,e){return t.rotation?[_P(t.rotation.x),_P(t.rotation.y),_P(t.rotation.z)]:e==="bottom"?[Math.PI,0,0]:[0,0,0]}function G3i(t,e){const n=new jt(t.x,t.y,t.z),o=new t2(e[0],e[1],e[2],"XYZ");return n.applyEuler(o),[n.x,n.y,n.z]}function Y3i(t,e,n){if(!t.model_origin_position)return[0,0,0];const o=e?wpe(t.model_origin_position,e):t.model_origin_position;return G3i(o,n)}function U3i(t,e){const n=H3i(t,e.layer,e.pcbThickness),o=O3i(t,e.layer),i=$X(t,e.modelType),r=L3i(t.model_board_normal_direction??"z+"),s=Y3i(t,i,r);return{position:n,rotation:o,modelPosition:[-s[0],-s[1],-s[2]],modelRotation:r,scale:t.model_unit_to_mm_scale_factor??void 0,fitMode:t.model_object_fit??"contain_within_bounds",size:t.size?[t.size.x,t.size.y,t.size.z]:void 0}}var K3i=t=>t.model_glb_url||t.model_gltf_url?t.model_glb_url?"glb":"gltf":t.model_obj_url||t.model_wrl_url||t.model_stl_url?t.model_wrl_url?"wrl":t.model_stl_url?"stl":"obj":t.model_jscad?"jscad":t.footprinter_string?"footprinter":t.model_step_url?"step":"unknown",V3i=t=>t==="step"?"glb":t,z3i=(t,e)=>{if(!t.pcb_component_id||!t.model_jscad||t.model_origin_alignment!=="bottom_center_of_component")return!1;const n=e.find(o=>o.type==="pcb_component"&&o.pcb_component_id===t.pcb_component_id);return!!(n&&n.do_not_place&&n.is_allowed_to_be_off_board&&n.obstructs_within_bounds===!1)},J3i=(t,e)=>{if(t)return e?e(t):t},W3i=(...t)=>t,vze=class extends Fs.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}render(){return this.state.hasError&&this.state.error?this.props.fallback({error:this.state.error}):this.props.children}},j3i=({error:t,onError:e})=>(ee.useEffect(()=>{e(t)},[t,e]),null),pan=({cad_component:t,circuitJson:e,resolveStaticAsset:n})=>{const o=wrn(e),[i,r]=ee.useState(!1),{visibility:s}=AT(),[a,A]=ee.useState(null),c=ee.useCallback(Y=>{Y?.mousePosition?(r(!0),A(Y.mousePosition)):(r(!1),A(null))},[]),l=ee.useCallback(()=>{r(!1),A(null)},[]),u=ee.useMemo(()=>Mr(e).source_component.getUsing({source_component_id:t.source_component_id})?.name,[e,t.source_component_id]),{pcbComponent:g,layer:h,isThroughHole:d}=ee.useMemo(()=>mmi(t,e),[t,e]),p=ee.useCallback(Y=>J3i(Y,n),[n]),m=p(t.model_wrl_url??t.model_stl_url??t.model_obj_url),_=p(t.model_glb_url??t.model_gltf_url),f=p(t.model_step_url),[I,C]=ee.useState(0),[y,x]=ee.useState(null);ee.useEffect(()=>{C(0),x(null)},[t.cad_component_id,m,_,f]);const E=ee.useMemo(()=>z3i(t,e),[t,e]),B=E?s.enclosure==="translucent":!!t.show_as_translucent_model,S=K3i(t),Q=V3i(S),w=t.model_glb_url?"glb":"gltf",M=t.model_wrl_url?"wrl":t.model_stl_url?"stl":"obj",k=ee.useMemo(()=>U3i(t,{layer:h,pcbThickness:o,modelType:Q}),[t,h,o,Q]),R=W3i(...k.rotation),F=k.position,O=ee.useMemo(()=>{const Y=[];return _&&Y.push(K.jsx(uan,{gltfUrl:_,position:F,rotation:R,modelOffset:k.modelPosition,modelRotation:k.modelRotation,sourceCoordinateTransform:Ppe($X(t,w)),scale:k.scale,modelSize:k.size,modelFitMode:k.fitMode,onHover:c,onUnhover:l,isHovered:i,isTranslucent:B},`${t.cad_component_id}-gltf-${_}`)),m&&Y.push(K.jsx(B3i,{url:m,position:F,rotation:R,modelOffset:k.modelPosition,modelRotation:k.modelRotation,sourceCoordinateTransform:Ppe($X(t,M)),scale:k.scale,modelSize:k.size,modelFitMode:k.fitMode,onHover:c,onUnhover:l,isHovered:i,isTranslucent:B},`${t.cad_component_id}-mixed-${m}`)),f&&!t.model_jscad&&!t.footprinter_string&&Y.push(K.jsx(k3i,{stepUrl:f,position:F,rotation:R,modelOffset:k.modelPosition,modelRotation:k.modelRotation,sourceCoordinateTransform:Ppe($X(t,Q)),scale:k.scale,modelSize:k.size,modelFitMode:k.fitMode,onHover:c,onUnhover:l,isHovered:i,isTranslucent:B},`${t.cad_component_id}-step-${f}`)),Y},[F,t.cad_component_id,t.footprinter_string,t.model_jscad,B,_,w,c,l,i,M,k.modelPosition,k.modelRotation,k.scale,k.fitMode,k.size,Q,R,f,m]);let U=null;if(O.length>0){if(I>=O.length){if(y)throw y;return null}U=K.jsx(vze,{fallback:({error:Y})=>K.jsx(j3i,{error:Y,onError:W=>{x(W),C(te=>Math.max(te,I+1))}}),children:O[I]},`${t.cad_component_id}-fallback-${I}`)}else t.model_jscad?U=K.jsx(C3i,{jscadPlan:t.model_jscad,positionOffset:F,rotationOffset:R,modelOffset:k.modelPosition,modelRotation:k.modelRotation,sourceCoordinateTransform:Ppe($X(t,"jscad")),scale:k.scale,modelSize:k.size,modelFitMode:k.fitMode,onHover:c,onUnhover:l,isHovered:i,isTranslucent:B},t.cad_component_id):t.footprinter_string&&(U=K.jsx(g3i,{positionOffset:F,rotationOffset:R,footprint:t.footprinter_string,scale:k.scale,onHover:c,onUnhover:l,isHovered:i,isTranslucent:B}));if(E){if(s.enclosure==="hidden")return null}else if(t.show_as_translucent_model){if(!s.translucentModels)return null}else if(g&&(d&&!s.throughHoleModels||!d&&!s.smtModels))return null;return K.jsxs(K.Fragment,{children:[K.jsx(gmi,{cadComponent:t,children:U}),i&&a?K.jsx(Prn,{position:a,style:{fontFamily:"sans-serif",transform:"translate3d(1rem, 1rem, 0)",backgroundColor:"white",padding:"5px",borderRadius:"3px",pointerEvents:"none",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},children:u??"<unknown>"}):null]})},man={version:"0.0.609"},_an="cadViewerLightingEnabled",$3i=()=>typeof window>"u"?!0:window.localStorage.getItem(_an)!=="false",fan=ee.createContext(void 0),q3i=({children:t})=>{const[e,n]=ee.useState(!1),[o,i]=ee.useState(!1),[r,s]=ee.useState($3i);ee.useEffect(()=>{window.localStorage.setItem(_an,r?"true":"false")},[r]);const a=ee.useMemo(()=>({darkBackgroundEnabled:e,setDarkBackgroundEnabled:n,gridEnabled:o,setGridEnabled:i,lightingEnabled:r,setLightingEnabled:s}),[e,o,r]);return K.jsx(fan.Provider,{value:a,children:t})},wze=()=>{const t=ee.useContext(fan);if(!t)throw new Error("useAppearance must be used within an AppearanceProvider");return t},Ian="cadViewerCameraStateSession",Can=(t,e)=>{try{const n={position:t.position.toArray(),quaternion:t.quaternion.toArray(),up:t.up.toArray(),fov:t.fov??50,target:e.target.toArray()};sessionStorage.setItem(Ian,JSON.stringify(n))}catch(n){console.warn("Failed to save camera:",n)}},Pze=(t,e)=>{try{const n=sessionStorage.getItem(Ian);if(!n)return!1;const o=JSON.parse(n);if(t.position.fromArray(o.position),t.quaternion.fromArray(o.quaternion),t.up.fromArray(o.up),"fov"in t){const i=t;i.fov=o.fov,i.updateProjectionMatrix?.()}return e.target.fromArray(o.target),e.update(),t.updateMatrixWorld(),!0}catch(n){return console.warn("Failed to restore camera:",n),!1}},yan=ee.createContext(void 0),X3i=({children:t,defaultTarget:e,initialCameraPosition:n,initialCameraType:o})=>{const i=ee.useRef(null),r=ee.useRef(null),[s,a]=ee.useState(null),[A,c]=ee.useState(o??"perspective"),[l,u]=ee.useState(n??null),[g,h]=ee.useState(new t2(0,0,0)),d=ee.useMemo(()=>{const[f,I,C]=n??[5,-5,5],y=Math.hypot(f-e.x,I-e.y,C-e.z);return y>0?y:5},[n,e]),p=ee.useCallback(f=>{const I=[e.x,e.y,e.z],C=r.current,y=i.current;let x=d;switch(C&&y&&(x=C.position.distanceTo(y.target)),f){case"Top Center Angled":{const E=x/Math.sqrt(2);return{position:[e.x,e.y-E,e.z+E],target:I,up:[0,0,1]}}case"Top Down":return{position:[e.x,e.y,e.z+x],target:I,up:[0,0,1]};case"Top Left Corner":return{position:[e.x-x*.6,e.y-x*.6,e.z+x*.6],target:I,up:[0,0,1]};case"Top Right Corner":return{position:[e.x+x*.6,e.y-x*.6,e.z+x*.6],target:I,up:[0,0,1]};case"Left Sideview":return{position:[e.x-x,e.y,e.z],target:I,up:[0,0,1]};case"Right Sideview":return{position:[e.x+x,e.y,e.z],target:I,up:[0,0,1]};case"Front":return{position:[e.x,e.y-x,e.z],target:I,up:[0,0,1]};default:return null}},[d,e,r,i]),m=ee.useCallback(f=>{i.current=f},[]),_=ee.useMemo(()=>({controlsRef:i,mainCameraRef:r,defaultTarget:e,baseDistance:d,controller:s,setController:a,getPresetConfig:p,handleControlsChange:m,cameraType:A,setCameraType:c,cameraPosition:l,setCameraPosition:u,cameraRotation:g,setCameraRotation:h,saveCameraToSession:Can,loadCameraFromSession:Pze}),[e,d,s,p,m,A,l,g]);return K.jsx(yan.Provider,{value:_,children:t})},gS=()=>{const t=ee.useContext(yan);if(!t)throw new Error("useCameraController must be used within a CameraControllerProvider");return t},Z3i=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,eEi=()=>{const{controlsRef:t,mainCameraRef:e,defaultTarget:n,setController:o,getPresetConfig:i}=gS(),r=ee.useRef(null),s=ee.useRef(new Zy),a=ee.useRef(new jt),A=ee.useRef(new jt),c=ee.useRef(new Zy),l=ee.useRef(new Zy),u=ee.useRef(new T0),g=ee.useRef(new T0),h=ee.useCallback(({position:p,target:m,up:_,durationMs:f=600})=>{if(!e.current)return;const I=t.current?.target??n,C=new jt(p[0],p[1],p[2]),y=m?new jt(m[0],m[1],m[2]):n.clone(),x=new jt(..._??[0,0,1]).normalize(),E=g.current;E.position.copy(C),E.up.copy(x),E.lookAt(y);const B=E.quaternion.clone(),S=e.current.quaternion.clone(),Q=e.current.position.clone(),w=I.clone(),M=u.current;M.up.set(0,0,1),M.position.copy(Q),M.lookAt(w);const k=M.quaternion.clone();M.up.set(0,0,1),M.position.copy(C),M.lookAt(y);const R=M.quaternion.clone(),F=k.clone().invert().multiply(S).normalize(),O=R.clone().invert().multiply(B).normalize();r.current={fromPosition:Q,toPosition:C,fromTarget:w,toTarget:y,toQuaternion:B,rollFrom:F,rollTo:O,startTime:performance.now(),duration:f}},[e,t,n]),d=ee.useCallback(p=>{if(p==="Custom")return;const m=i(p);m&&h(m)},[h,i]);return ee.useEffect(()=>e.current?(o({animateTo:h,animateToPreset:d}),()=>{o(null)}):void 0,[h,d,e,o]),TX(()=>{if(!e.current||!r.current)return;const{fromPosition:p,toPosition:m,fromTarget:_,toTarget:f,toQuaternion:I,rollFrom:C,rollTo:y,startTime:x,duration:E}=r.current,B=performance.now()-x,S=E<=0?1:Math.min(B/E,1),Q=Z3i(S);e.current.position.lerpVectors(p,m,Q);const w=a.current;w.copy(_).lerp(f,Q);const M=u.current;M.up.set(0,0,1),M.position.copy(e.current.position),M.lookAt(w);const k=s.current;k.copy(M.quaternion);const R=c.current;R.copy(C);const F=l.current;F.copy(y),C.dot(y)<0&&(F.x*=-1,F.y*=-1,F.z*=-1,F.w*=-1),F.normalize(),R.slerp(F,Q),e.current.quaternion.copy(k).multiply(R).normalize();const O=A.current;O.set(0,1,0).applyQuaternion(e.current.quaternion).normalize(),e.current.up.copy(O),t.current?.target.copy(w),e.current.updateMatrixWorld(),t.current?.update(),S>=1&&(e.current.position.copy(m),e.current.quaternion.copy(I),e.current.up.set(0,0,1),e.current.updateMatrixWorld(),t.current?.target.copy(f),t.current?.update(),r.current=null)}),null},tEi=()=>{const{controlsRef:t}=gS(),e=ee.useRef(null),n=ee.useRef(!1),o=ee.useRef(null),i=ee.useCallback(s=>{e.current=s,!n.current&&t.current&&Pze(s,t.current)&&(n.current=!0)},[t]),r=ee.useCallback(()=>{if(!(!e.current||!t.current)){if(!n.current&&Pze(e.current,t.current)){n.current=!0;return}clearTimeout(o.current),o.current=setTimeout(()=>{e.current&&t.current&&Can(e.current,t.current)},150)}},[t]);return{handleCameraCreated:i,handleControlsChange:r}};function nEi(t){t.querySelectorAll("canvas").forEach(e=>e.remove())}var oEi=t=>{t.outputColorSpace=Ox,t.toneMapping=PKt,t.toneMappingExposure=1,t.shadowMap.enabled=!0,t.shadowMap.type=SKt},iEi=ee.forwardRef(({children:t,scene:e,camera:n,style:o,onCreated:i},r)=>{const{cameraType:s}=gS(),a=ee.useRef(null),[A,c]=ee.useState(null),l=ee.useRef([]),u=ee.useRef(void 0);u.current=i;const g=ee.useRef(null),h=ee.useCallback(_=>{l.current.push(_)},[]),d=ee.useCallback(_=>{l.current=l.current.filter(f=>f!==_)},[]),p=ee.useMemo(()=>new KR,[]);e?.up&&p.up.set(e.up.x,e.up.y,e.up.z);const m=ee.useRef(new T0);return ee.useImperativeHandle(r,()=>m.current),ee.useEffect(()=>{if(!a.current)return;nEi(a.current);const _=new $de({antialias:!0,alpha:!0});oEi(_),_.setSize(a.current.clientWidth,a.current.clientHeight),_.setPixelRatio(window.devicePixelRatio),a.current.appendChild(_.domElement);const f=a.current.clientWidth/a.current.clientHeight,I=s==="perspective"?new sf(75,f,.1,1e3):new rY(-10*f,10*f,10,-10,-1e3,1e3);g.current?(I.position.copy(g.current.position),I.quaternion.copy(g.current.quaternion),I.up.copy(g.current.up)):(n?.up&&I.up.set(n.up[0],n.up[1],n.up[2]),n?.position&&I.position.set(n.position[0],n.position[1],n.position[2]),I.lookAt(0,0,0)),p.add(m.current),window.__TSCIRCUIT_THREE_OBJECT=m.current,c({scene:p,camera:I,renderer:_,rootObject:m.current,addFrameListener:h,removeFrameListener:d}),u.current?.({camera:I,renderer:_});let C;const y=new qti;let x=!0;const E=new IntersectionObserver(([Q])=>{x=Q?.isIntersecting??!1,x&&S()});E.observe(a.current);const B=()=>{if(C=requestAnimationFrame(B),!x)return;const Q=y.getElapsedTime(),w=y.getDelta();l.current.forEach(M=>M(Q,w)),_.render(p,I)};B();const S=()=>{if(a.current?.clientWidth&&a.current.clientHeight){const Q=a.current.clientWidth/a.current.clientHeight;I instanceof sf?I.aspect=Q:I instanceof rY&&(I.left=-10*Q,I.right=10*Q,I.top=10,I.bottom=-10),I.updateProjectionMatrix(),_.setSize(a.current.clientWidth,a.current.clientHeight)}};return window.addEventListener("resize",S),()=>{g.current={position:I.position.clone(),quaternion:I.quaternion.clone(),up:I.up.clone()},window.removeEventListener("resize",S),cancelAnimationFrame(C),E.disconnect(),a.current&&_.domElement&&a.current.removeChild(_.domElement),_.dispose(),p.remove(m.current),window.__TSCIRCUIT_THREE_OBJECT===m.current&&(window.__TSCIRCUIT_THREE_OBJECT=void 0)}},[p,h,d,s]),K.jsx("div",{ref:a,style:{width:"100%",height:"100%",...o},children:A&&K.jsx(LVe.Provider,{value:A,children:K.jsx(l3i,{children:t})})})}),rEi=`
varying vec3 worldPosition;
void main() {
worldPosition = (modelMatrix * vec4(position, 1.0)).xyz;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
`,sEi=`
varying vec3 worldPosition;
uniform float cellSize;
uniform float sectionSize;
uniform vec3 gridColor;
uniform vec3 sectionColor;
uniform float fadeDistance;
uniform float fadeStrength;
float getGrid(float size) {
vec2 r = worldPosition.xy / size;
vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);
float line = min(grid.x, grid.y);
return 1.0 - min(line * 1.5, 1.0);
}
void main() {
float g1 = getGrid(cellSize);
float g2 = getGrid(sectionSize);
float d = distance(worldPosition.xy, cameraPosition.xy);
float a = 1.0 - smoothstep(fadeDistance, fadeDistance * fadeStrength, d);
vec3 color = mix(gridColor, sectionColor, g2);
gl_FragColor = vec4(color, max(g1, g2) * a);
if (gl_FragColor.a <= 0.0) discard;
}
`,aEi=({rotation:t,infiniteGrid:e,cellSize:n=1,sectionSize:o=10})=>{const{scene:i,camera:r}=uf(),s=1e3,a=ee.useMemo(()=>{const A=new VB(s,s);A.rotateX(-Math.PI/2);const c=new f6({vertexShader:rEi,fragmentShader:sEi,uniforms:{cellSize:{value:n},sectionSize:{value:o},gridColor:{value:new Vi(15658734)},sectionColor:{value:new Vi(13421823)},fadeDistance:{value:100},fadeStrength:{value:1.5}},transparent:!0,side:r_}),l=new Er(A,c);return t&&l.rotation.fromArray(t),l},[s,n,o,t]);return TX(()=>{e&&a.position.set(r.position.x,r.position.y,0)}),ee.useEffect(()=>{if(!(!i||!a))return i.add(a),()=>{i.remove(a),a.geometry.dispose(),Array.isArray(a.material)?a.material.forEach(A=>A.dispose()):a.material.dispose()}},[i,a]),null},Mze=.75,AEi=({boardDimensions:t,boardCenter:e,darkBackgroundEnabled:n=!1,shadowsEnabled:o=!1})=>{const{scene:i}=uf(),r=ee.useMemo(()=>{const s=new lh;s.name="cad-viewer-light-rig";const a=e?.x??0,A=e?.y??0,c=Math.max(t?.width??0,t?.height??0,20),l=c*.8,u=c,g=c*1.7,h=new AJt(16186360,.22);h.name="cad-viewer-soft-ambient",s.add(h);const d=new Kti(15004141,1581597,.2);d.name="cad-viewer-hemisphere",s.add(d);const p=(m,_,f,I,C=!1)=>{const y=new aJt(_,f);if(y.name=m,y.position.set(a+I[0],A+I[1],I[2]),y.target.position.set(a,A,0),y.castShadow=C,C){y.shadow.mapSize.set(2048,2048),y.shadow.bias=-2e-4,y.shadow.normalBias=.03,y.shadow.radius=5;const x=y.shadow.camera;x.left=-l,x.right=l,x.top=l,x.bottom=-l,x.near=.5,x.far=Math.max(c*4,Math.hypot(...I)+c*2),x.updateProjectionMatrix()}s.add(y),s.add(y.target)};return p("cad-viewer-key-light",16775406,1.35,[g*.68,-g*.8,g*1.08],o),p("cad-viewer-fill-light",14477554,.25,[-u*.85,u*.55,u*.75]),p("cad-viewer-rim-light",12184275,.5,[-u*.35,u*.85,u*.95]),p("cad-viewer-underside-key-light",16775406,1.35*Mze,[g*.68,-g*.8,-g*1.08]),p("cad-viewer-underside-fill-light",14477554,.25*Mze,[-u*.85,u*.55,-u*.75]),p("cad-viewer-underside-rim-light",12184275,.5*Mze,[-u*.35,u*.85,-u*.95]),s},[e,t,o]);return ee.useEffect(()=>{const s=i.background,a=i.environment;return i.background=n?new Vi(1053456):null,i.environment=null,()=>{i.background=s,i.environment=a}},[n,i]),ee.useEffect(()=>{if(i)return i.add(r),()=>{i.remove(r)}},[i,r]),null},cEi=({autoRotate:t,autoRotateSpeed:e,onStart:n,panSpeed:o,rotateSpeed:i,zoomSpeed:r,enableDamping:s,dampingFactor:a,target:A,onControlsChange:c})=>{const{camera:l,renderer:u}=uf(),g=ee.useMemo(()=>!l||!u?null:new voi(l,u.domElement),[l,u]);return ee.useEffect(()=>(c?.(g??null),()=>c?.(null)),[g,c]),ee.useEffect(()=>{if(!g)return;const h=()=>{c?.(g)};return g.addEventListener("change",h),()=>{g.removeEventListener("change",h)}},[g,c]),ee.useEffect(()=>{g&&(g.autoRotate=t||!1,g.autoRotateSpeed=e||1,o!==void 0&&(g.panSpeed=o),i!==void 0&&(g.rotateSpeed=i),r!==void 0&&(g.zoomSpeed=r),s!==void 0&&(g.enableDamping=s),a!==void 0&&(g.dampingFactor=a),g.zoomToCursor=!0,g.mouseButtons={LEFT:Vw.ROTATE,MIDDLE:Vw.PAN,RIGHT:null},A&&(g.target.set(A[0],A[1],A[2]),g.update()))},[g,t,e,o,i,r,s,a,A]),ee.useEffect(()=>{if(!(!g||!n))return g.addEventListener("start",n),()=>{g.removeEventListener("start",n)}},[g,n]),ee.useEffect(()=>{if(g)return()=>{g.dispose()}},[g]),TX(()=>{g?.update()},[g]),null},lEi=10,jY={banana:{type:"banana",label:"Show Banana",width:190,height:60,depth:34,zCenter:17},"credit-card":{type:"credit-card",label:"Show Credit Card",width:85.6,height:53.98,depth:.76,zCenter:0},"14in-macbook":{type:"14in-macbook",label:"Show 14in Macbook",width:312.6,height:221.2,depth:15.5,zCenter:0}},uEi=Object.values(jY),gEi=[{type:null,label:"None"},...uEi],dEi=(t,e)=>t===e?null:e,Dze=t=>Number.isFinite(t)?Math.max(t??0,0):0,Mpe=t=>Number.isFinite(t)?t??0:0,xan=(t,e,n)=>{const o=jY[t],i=Dze(e?.width),r=Mpe(n?.x),s=Mpe(n?.y);return{x:r+i/2+lEi+o.width/2,y:s,z:0}},hEi=(t,e,n)=>{const o=jY[t],i=Dze(e?.width),r=Dze(e?.height),s=Mpe(n?.x),a=Mpe(n?.y),A=xan(t,e,n);return{minX:Math.min(s-i/2,A.x-o.width/2),maxX:Math.max(s+i/2,A.x+o.width/2),minY:Math.min(a-r/2,A.y-o.height/2),maxY:Math.max(a+r/2,A.y+o.height/2),minZ:Math.min(0,A.z+o.zCenter-o.depth/2),maxZ:Math.max(0,A.z+o.zCenter+o.depth/2)}};function pEi(t,e){const n=new Zy().setFromEuler(new t2(t.x,t.y,t.z)),o=new jt(0,0,1);return o.applyQuaternion(n),o.multiplyScalar(e)}var mEi=()=>{const{mainCameraRef:t}=gS(),e=ee.useRef(null);return ee.useEffect(()=>{if(!e.current)return;const n=e.current,o=document.createElement("canvas");n.appendChild(o);const i=new $de({canvas:o,antialias:!0,alpha:!0});i.setSize(120,120),i.setPixelRatio(window.devicePixelRatio);const r=new KR,s=new sf(75,1,.1,1e3);s.up.set(0,0,1);const a=new AJt(16777215,Math.PI/2);r.add(a);const A=new lh;A.rotation.fromArray([Math.PI/2,0,0]);const c=1,l=new Er(new Yx(c,c,c),new su({color:"white"}));A.add(l);const u=new Jq(new gti(new Yx(c,c,c)),new VR({color:0,linewidth:2}));A.add(u),r.add(A);const g=.51,h=(B,S,Q)=>{const w=new Rke;return w.text=B,w.position.fromArray(S),Q&&w.rotation.fromArray(Q),w.color="black",w.fontSize=.25,w.anchorX="center",w.anchorY="middle",w.depthOffset=0,w.font=null,w.sync(),w},d=h("Front",[0,0,g]),p=h("Back",[0,0,-g],[0,Math.PI,0]),m=h("Right",[g,0,0],[0,Math.PI/2,0]),_=h("Left",[-g,0,0],[0,-Math.PI/2,0]),f=h("Top",[0,g,0],[-Math.PI/2,0,0]),I=h("Bottom",[0,-g,0],[Math.PI/2,0,0]);A.add(d),A.add(p),A.add(m),A.add(_),A.add(f),A.add(I);let C=null,y=!0;const x=new IntersectionObserver(([B])=>{y=B?.isIntersecting??!1});x.observe(o);const E=()=>{if(C=requestAnimationFrame(E),!!y){if(t.current){const B=pEi(t.current.rotation??new t2(0,0,0),2);B.equals(s.position)||(s.position.copy(B),s.lookAt(0,0,0))}i.render(r,s)}};return E(),()=>{x.disconnect(),o.remove(),C!==null&&cancelAnimationFrame(C),d.dispose(),p.dispose(),m.dispose(),_.dispose(),f.dispose(),I.dispose(),l.geometry.dispose(),l.material.dispose(),u.geometry.dispose(),u.material.dispose(),r.clear(),i.dispose(),i.forceContextLoss()}},[t]),K.jsx("div",{ref:e,style:{position:"absolute",top:0,left:0,width:120,height:120,zIndex:kX.orientationCube}})},Ean=(t,e,n)=>{const o=t/2,i=e/2,r=Math.min(n,o,i),s=new zzt;return s.moveTo(-o+r,-i),s.lineTo(o-r,-i),s.quadraticCurveTo(o,-i,o,-i+r),s.lineTo(o,i-r),s.quadraticCurveTo(o,i,o-r,i),s.lineTo(-o+r,i),s.quadraticCurveTo(-o,i,-o,i-r),s.lineTo(-o,-i+r),s.quadraticCurveTo(-o,-i,-o+r,-i),s},Nze=(t,e,n,o)=>Ban(Ean(t,e,o),n),Ban=(t,e)=>{const n=new oke(t,{depth:e,bevelEnabled:!1,curveSegments:24});return n.translate(0,0,-e/2),n.computeVertexNormals(),n},_Ei=(t,e)=>{const n=jY[e];t.updateMatrixWorld(!0);const i=new e2().setFromObject(t).getSize(new jt);t.scale.set(n.width/i.x,n.height/i.y,n.depth/i.z),t.updateMatrixWorld(!0);const s=new e2().setFromObject(t).getCenter(new jt);t.position.set(-s.x,-s.y,n.zCenter-s.z),t.updateMatrixWorld(!0)},fEi=()=>{const t=new Ozt([new jt(-82,18,16),new jt(-67,7,15),new jt(-43,-9,14),new jt(-15,-18,14),new jt(16,-18,14),new jt(47,-8,14.5),new jt(72,8,16),new jt(84,19,17)]),e=84,n=30,o=t.computeFrenetFrames(e,!1),i=[],r=[],s=[],a=[],A=[],c=new Vi(16766023),l=new Vi(12038965);for(let g=0;g<=e;g++){const h=g/e,d=t.getPointAt(h),p=o.normals[g],m=o.binormals[g],f=3.4+12.4*Math.sin(Math.PI*h)**.48,I=Math.max(0,(h-.82)/.18)*.38,C=c.clone().lerp(l,I);for(let y=0;y<=n;y++){const x=y/n*Math.PI*2,E=Math.sin(x),B=Math.cos(x),S=1+Math.cos(x*5+.35)*.035,Q=new jt().addScaledVector(p,B).addScaledVector(m,E*.9).normalize(),w=d.clone().addScaledVector(p,B*f*S).addScaledVector(m,E*f*.9*S);i.push(w.x,w.y,w.z),r.push(Q.x,Q.y,Q.z),s.push(C.r,C.g,C.b),a.push(h,y/n)}}for(let g=1;g<=e;g++)for(let h=1;h<=n;h++){const d=n+1,p=d*(g-1)+(h-1),m=d*g+(h-1),_=d*g+h,f=d*(g-1)+h;A.push(p,f,m,m,f,_)}const u=new Zl;return u.setIndex(A),u.setAttribute("position",new Bs(i,3)),u.setAttribute("normal",new Bs(r,3)),u.setAttribute("color",new Bs(s,3)),u.setAttribute("uv",new Bs(a,2)),u.computeBoundingBox(),u.computeBoundingSphere(),{geometry:u,curve:t}},IEi=()=>{const t=new lh,e=new lh,{geometry:n,curve:o}=fEi(),i=new Er(n,new su({color:16777215,roughness:.72,metalness:0,vertexColors:!0}));i.name="banana-peel",e.add(i);const r=new Er(new WR(3.4,20,12),new su({color:6242844,roughness:.92}));r.position.copy(o.getPointAt(0)),r.scale.set(1.15,.78,.78),r.name="banana-blossom-tip",e.add(r);const s=11,a=o.getTangentAt(1).normalize(),A=new Er(new lY(2.5,4.1,s,18),new su({color:8483625,roughness:.82}));A.quaternion.setFromUnitVectors(new jt(0,1,0),a),A.position.copy(o.getPointAt(1)).addScaledVector(a,s/2),A.name="banana-stem",e.add(A);const c=new Er(new WR(2.55,18,10),new su({color:5981470,roughness:.9}));return c.position.copy(o.getPointAt(1)).addScaledVector(a,s),c.name="banana-stem-tip",e.add(c),_Ei(e,"banana"),t.add(e),t},CEi=(t,e,n,o,i)=>{const r=Ean(t,e,o),s=new XTe;return s.absarc(0,0,i,0,Math.PI*2,!0),r.holes.push(s),Ban(r,n)},yEi=(t,e)=>{const i=new Er(new lY(e-.15,e-.15,.25,48),new su({color:10199202,roughness:.48,metalness:.28}));return i.rotation.x=Math.PI/2,i.position.z=t-.35-.25/2,i.name="macbook-lid-indent",i},xEi=()=>{const t=jY["credit-card"],e=new lh,n=new Er(Nze(t.width,t.height,t.depth,3.18),new su({color:2383272,roughness:.38,metalness:.08}));n.name="credit-card-body",e.add(n);const o=t.depth/2+.08,i=new Er(Nze(12,9,.14,1.2),new su({color:14003525,roughness:.3,metalness:.62}));i.position.set(-21,3,o),i.name="credit-card-chip",e.add(i);const r=new su({color:15331061,roughness:.45,metalness:.05});for(let s=0;s<4;s++){const a=new Er(new Yx(s===3?8:12,.8,.1),r);a.position.set(-20+s*14,-14,o+.08),a.name="credit-card-detail",e.add(a)}return e},EEi=()=>{const t=jY["14in-macbook"],e=new lh,n=new su({color:12896201,roughness:.3,metalness:.38}),o=new Er(Nze(t.width,t.height,13.5,9),n);o.position.z=-1,o.name="macbook-body",e.add(o);const i=2,r=6.75,s=r+i/2,a=12,A=new Er(CEi(t.width-1.8,t.height-1.8,i,8.2,a),n.clone());A.position.z=r,A.name="macbook-lid",e.add(A);const c=new Er(new Yx(t.width-42,3.2,1.2),new su({color:3158838,roughness:.55,metalness:.45}));c.position.set(0,t.height/2-2.4,6.15),c.name="macbook-hinge",e.add(c),e.add(yEi(s,a));const l=new Er(new Yx(54,1.2,.8),new su({color:6712174,roughness:.45,metalness:.5}));return l.position.set(0,-221.2/2+.5,2.5),l.name="macbook-front-notch",e.add(l),e},BEi=t=>{const e=t==="banana"?IEi():t==="credit-card"?xEi():EEi();return e.name=`reference-object-${t}`,e.userData.isReferenceObject=!0,e.userData.referenceObjectType=t,p4(e),e},bEi=t=>{const e=new Set,n=new Set;t.traverse(o=>{if(!(o instanceof Er))return;e.add(o.geometry);const i=Array.isArray(o.material)?o.material:[o.material];for(const r of i)n.add(r)});for(const o of e)o.dispose();for(const o of n)o.dispose()},SEi=(t,e,n,o=1.18)=>{const i=Math.max(n.maxX-n.minX,0),r=Math.max(n.maxY-n.minY,0),s=Math.max(n.maxZ-n.minZ,0),a=new jt((n.minX+n.maxX)/2,(n.minY+n.maxY)/2,(n.minZ+n.maxZ)/2),A=Math.max(Math.hypot(i,r,s)/2,1),c=e?.target??new jt,l=new jt(0,-.75,.9).normalize();let u=Math.max(t.position.distanceTo(c),5);if(t instanceof sf){const g=OG.degToRad(t.fov),h=2*Math.atan(Math.tan(g/2)*t.aspect),d=Math.min(g,h);u=A*o/Math.sin(d/2),t.far=Math.max(t.far,u+A*o*3),t.updateProjectionMatrix()}else if(t instanceof rY){const g=Math.abs(t.right-t.left)/2,h=Math.abs(t.top-t.bottom)/2;t.zoom=Math.min(g/(A*o),h/(A*o)),u=Math.max(u,A*o*2),t.updateProjectionMatrix()}return t.position.copy(a).addScaledVector(l,u),t.lookAt(a),t.updateMatrixWorld(),e&&(e.target.copy(a),e.update()),{center:a,radius:A,distance:u}},QEi=({type:t,boardDimensions:e,boardCenter:n})=>{const{scene:o}=uf(),i=ee.useMemo(()=>{const r=BEi(t),s=xan(t,e,n);return r.position.set(s.x,s.y,s.z),r},[t,e,n]);return ee.useEffect(()=>(o.add(i),()=>{o.remove(i),bEi(i)}),[o,i]),null},ban=({bounds:t})=>{const{camera:e}=uf(),{controlsRef:n}=gS();return ee.useEffect(()=>{SEi(e,n.current,t)},[t,e,n]),null},vEi=()=>{const{camera:t}=uf(),{setCameraRotation:e}=gS();return TX(()=>{t&&e(t.rotation)}),null},San=ee.forwardRef(({children:t,initialCameraPosition:e=[5,-5,5],autoRotateDisabled:n,clickToInteractEnabled:o=!1,boardDimensions:i,boardCenter:r,referenceObject:s,onUserInteraction:a,onCameraControllerReady:A},c)=>{const[l,u]=ee.useState(!o),{mainCameraRef:g,handleControlsChange:h,controller:d}=gS(),{darkBackgroundEnabled:p,gridEnabled:m,lightingEnabled:_}=wze(),{handleCameraCreated:f,handleControlsChange:I}=tEi();ee.useEffect(()=>{A&&A(d)},[d,A]);const C=ee.useMemo(()=>{if(s)return hEi(s,i,r)},[s,i,r]),y=ee.useMemo(()=>{if(!i)return 10;const E=i.width??0,B=i.height??0;return Math.max(Math.max(E,B)*1.5,10)},[i]),x=ee.useMemo(()=>{if(C)return[(C.minX+C.maxX)/2,(C.minY+C.maxY)/2,(C.minZ+C.maxZ)/2];if(r)return[r.x,r.y,0]},[r,C]);return K.jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[K.jsx(mEi,{}),K.jsxs(iEi,{ref:c,scene:{up:new jt(0,0,1)},camera:{up:[0,0,1],position:e},onCreated:({camera:E})=>{g.current=E,f(E)},children:[K.jsx(umi,{}),K.jsx(eEi,{}),K.jsx(vEi,{}),l&&K.jsx(cEi,{autoRotate:!n,autoRotateSpeed:1,onStart:a,rotateSpeed:.5,panSpeed:.75,zoomSpeed:.5,enableDamping:!0,dampingFactor:.1,target:x,onControlsChange:E=>{h(E),I()}}),K.jsx(AEi,{boardDimensions:i,boardCenter:r,darkBackgroundEnabled:p,shadowsEnabled:_}),s&&K.jsx(QEi,{type:s,boardDimensions:i,boardCenter:r}),C&&K.jsx(ban,{bounds:C}),m&&K.jsx(aEi,{rotation:[Math.PI/2,0,0],infiniteGrid:!0,cellSize:3,sectionSize:y}),t]}),K.jsxs("div",{style:{position:"absolute",right:24,bottom:24,fontFamily:"sans-serif",color:"white",WebkitTextStroke:"0.5px rgba(0, 0, 0, 0.5)",fontSize:11},children:["@",man.version]}),o&&!l&&K.jsx("button",{type:"button",onClick:()=>u(!0),onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&u(!0)},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:kX.clickToInteractOverlay,display:"flex",alignItems:"center",justifyContent:"center"},children:K.jsx("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"16px",fontFamily:"sans-serif",pointerEvents:"none"},children:"Click to Interact"})})]})}),wEi=t=>{const[e,n]=ee.useState([]),[o,i]=ee.useState(!0);return ee.useEffect(()=>{if(!t)return;(async()=>{i(!0);const a=(Array.isArray(t)?t:[t]).map(async(A,c)=>{const l=Sci.serialize({binary:!0},[A]),g=await new Blob(l).arrayBuffer(),d=A.layerType||(c===0?"board":void 0);return{stlData:g,color:A.color,layerType:d}});try{const A=await Promise.all(a);n(A)}catch(A){console.error("Error generating STLs:",A),n([])}finally{i(!1)}})()},[t]),{stls:e,loading:o}},PEi=_0(epe()),MEi=_0(sT()),DEi=_0(RX()),NEi=_0(sT()),REi=_0(aT()),TEi=_0(yrn()),Qan=t=>{let e=0;for(let o=0;o<t.length;o++){const i=(o+1)%t.length;e+=t[o][0]*t[i][1],e-=t[i][0]*t[o][1]}return e/2<=0},Rze=(t,e=1.2,n={})=>{const{xyOutset:o=0}=n,{outline:i}=t;let r=i.map(A=>[A.x,A.y]);Qan(r)&&(r=r.reverse());let s=(0,NEi.polygon)({points:r});o!==0&&(s=(0,TEi.expand)({delta:o,corners:"edge"},s));let a=(0,DEi.extrudeLinear)({height:e},s);return a=(0,REi.translate)([0,0,-e/2],a),a},Cs=.01,Tc={copper:[.78,.63,.39],fr4Tan:[.6,.43,.28],fr4SolderMaskGreen:[.06,.31,.19],fr4TracesWithMaskGreen:[.09,.38,.23],fr4TracesWithoutMaskTan:[.6,.43,.28],flexAmber:[.8,.61,.2],fr1Tan:[.8,.4,.2],fr1TracesWithMaskCopper:[.9,.6,.2],fr1SolderMaskGreen:[.02,.1,.04]},jB=.001,df=32,m4=150,Dpe=.6,kEi={fr1:Tc.fr1Tan,fr4:Tc.fr4Tan,flex:Tc.flexAmber},FEi={fr1:Tc.fr1SolderMaskGreen,fr4:Tc.fr4SolderMaskGreen,flex:Tc.flexAmber},LEi={red:"#650202",blue:"#003f7d",purple:"#4c1d69",black:"#071014",white:"#dddddd",yellow:"#dcc84a"},HEi=.875,OEi=/^#(?:[\da-f]{3}|[\da-f]{6})$/i,GEi=/^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/i,YEi=/^rgb\(\s*\d+%\s*,\s*\d+%\s*,\s*\d+%\s*\)$/i,UEi=/^hsl\(\s*\d*\.?\d+\s*,\s*\d*\.?\d+%\s*,\s*\d*\.?\d+%\s*\)$/i,KEi={blue:.96,purple:.96,black:.99,yellow:.92},van=t=>{const e=t?.trim();if(!e)return null;const n=e.toLowerCase();if(n==="green"||n==="not_specified")return null;const i=LEi[n];return i?new Vi(i):Object.hasOwn(Vi.NAMES,n)||OEi.test(e)||GEi.test(e)||YEi.test(e)||UEi.test(e)?new Vi(n):null},VEi=t=>{const e=t?.trim().toLowerCase();return KEi[e]??HEi},zEi=({red:t,green:e,blue:n})=>Math.hypot(t-220,e-200,n-74)<4||Math.hypot(t-218,e-197,n-76)<4,JEi=({soldermaskColor:t,copperColor:e,soldermaskOpacity:n})=>t.clone().multiplyScalar(n).add(e.clone().multiplyScalar(1-n)),wan=t=>{const e=t.clone().convertLinearToSRGB();return`rgb(${[Math.round(e.r*255),Math.round(e.g*255),Math.round(e.b*255)].join(",")})`},WEi=new Vi(1063462),Tze=({material:t,solder_mask_color:e})=>{const n=van(e);if(n)return n;if(t==="fr4")return WEi.clone();const o=kEi[t]??Tc.fr4Tan;return new Vi(o[0],o[1],o[2])},jEi=t=>{const e=t.filter(A=>A.type==="pcb_panel"),n=Mr(t).pcb_board.list();let o,i,r=1.2;if(e.length>0)o=e[0],i=n.find(A=>A.pcb_panel_id===o.pcb_panel_id),r=i?.thickness??1.2;else{if(o=n.filter(c=>!c.pcb_panel_id)[0],!o)return console.warn("No pcb_board or pcb_panel found for simplified geometry"),[];i=o,r=o.thickness??1.2}let s;"outline"in o&&o.outline&&o.outline.length>0?s=Rze({outline:o.outline},r):s=(0,MEi.cuboid)({size:[o.width??10,o.height??10,r],center:[o.center.x,o.center.y,0]});const a=Tze({material:i?.material??"fr4",solder_mask_color:i?.solder_mask_color});return[(0,PEi.colorize)([a.r,a.g,a.b],s)]},qX=_0(epe()),c1=_0(NX()),kze=_0(RX()),Vx=_0(aT()),og=_0(sT()),fP=_0(sT()),$Ei=_0(RX()),Npe=_0(aT()),qEi=_0(NX()),XEi=64,ZEi=(t,e,n)=>{const o=(0,fP.ellipse)({center:[0,0],radius:[Math.max(t/2,Cs/2),Math.max(e/2,Cs/2)],segments:XEi}),i=(0,$Ei.extrudeLinear)({height:n},o);return(0,Npe.translate)([0,0,-n/2],i)},e5i=(t,e,n)=>{const o=Math.max(t,Cs),i=Math.max(e,Cs);if(Math.abs(o-i)<1e-6)return(0,fP.cylinder)({center:[0,0,0],radius:o/2,height:n});const r=o>=i,s=r?o:i,a=r?i:o,A=Math.max(s-a,0),c=(0,fP.cuboid)({center:[0,0,0],size:r?[A,a,n]:[a,A,n]});if(A<=1e-6)return(0,fP.cylinder)({center:[0,0,0],radius:a/2,height:n});const l=A/2,u=(0,fP.cylinder)({center:r?[-l,0,0]:[0,-l,0],radius:a/2,height:n}),g=(0,fP.cylinder)({center:r?[l,0,0]:[0,l,0],radius:a/2,height:n});return(0,qEi.union)(c,u,g)},Rpe=(t,e,n={})=>{const o=t.hole_shape||"circle",i=n.sizeDelta??0,r=t.hole_offset_x||0,s=t.hole_offset_y||0,a=[t.x+r,t.y+s,0];if(o==="circle"){const h=Math.max((t.hole_diameter??0)+i,Cs),d=Math.max(h/2,Cs/2);return(0,fP.cylinder)({center:a,radius:d,height:e})}const A=t.hole_width??t.hole_diameter,c=t.hole_height??t.hole_diameter;if(!A||!c)return null;const l=Math.max(A+i,Cs),u=Math.max(c+i,Cs);if(o==="oval"){const h=ZEi(l,u,e);return(0,Npe.translate)([a[0],a[1],0],h)}if(o==="pill"||o==="rotated_pill"){let h=e5i(l,u,e);if(!h)return null;const d=t.ccw_rotation||0;return d&&(h=(0,Npe.rotateZ)(d*Math.PI/180,h)),(0,Npe.translate)(a,h)}const g=Math.max((t.hole_diameter??A??c??Cs)+i,Cs);return(0,fP.cylinder)({center:a,radius:g/2,height:e})},tl=_0(sT()),M6=_0(epe()),Og=_0(NX()),Pan=_0(aT()),Tpe=_0(RX()),zx=_0(aT()),t5i=1e-5;function Man(t,e,n){if(typeof n!="number"||!Number.isFinite(n)||n<=0)return 0;const o=t/2,i=e/2,r=Math.min(o,i)-2*t5i;return Math.max(0,Math.min(n,r))}function IP(t){if(!(!t||typeof t!="object"))return t.corner_radius??t.cornerRadius??t.rect_pad_border_radius??t.rectPadBorderRadius??t.rect_border_radius??t.rectBorderRadius??void 0}var n5i=.05,Fze=64,dT=(t,e)=>e?(0,Og.intersect)(e,t):t,XX=(t,e,n={})=>{const{clipGeom:o}=n;t.shape||(t.shape="circle");const i=Math.max(e.pcbThickness*.002,Cs/5),r=Math.max(e.pcbThickness*3e-4,Cs/20),s=Math.max(e.pcbThickness*.0025,Cs/4),a=e.pcbThickness+2*n5i+4*Cs,A=Math.max(e.pcbThickness-2*(i+r+s),Cs),c=Math.max(A,Cs);if(t.shape==="circle"){const l=t.outer_diameter??Math.max(t.hole_diameter,0),u=A,g=(0,tl.cylinder)({center:[t.x,t.y,0],radius:l/2,height:u}),h=dT(g,o),d=(0,tl.cylinder)({center:[t.x,t.y,0],radius:Math.max(t.hole_diameter/2,.01),height:a});return(0,M6.colorize)(Tc.copper,(0,Og.subtract)(h,d))}if(t.shape==="oval"){const l=t.outer_width||t.hole_width||0,u=t.outer_height||t.hole_height||0,g=t.hole_width||0,h=t.hole_height||0,d=(()=>{const _=(0,tl.cylinder)({center:[0,0,0],radius:1,height:A,segments:64}),f=(0,Pan.scale)([l/2,u/2,1],_);return(0,zx.translate)([t.x,t.y,0],f)})(),p=dT(d,o),m=(()=>{const _=(0,tl.cylinder)({center:[0,0,0],radius:1,height:a,segments:64}),f=(0,Pan.scale)([Math.max(g/2,.01),Math.max(h/2,.01),1],_);return(0,zx.translate)([t.x,t.y,0],f)})();return(0,M6.colorize)(Tc.copper,(0,Og.subtract)(p,m))}if(t.shape==="circular_hole_with_rect_pad"){const l=t.hole_offset_x||0,u=t.hole_offset_y||0,g=t.rect_pad_width||t.hole_diameter,h=t.rect_pad_height||t.hole_diameter,d=IP(t),p=dT((0,Og.union)((()=>{const f=(0,tl.roundedRectangle)({size:[g,h],roundRadius:d||0,segments:Fze}),I=(0,Tpe.extrudeLinear)({height:A},f);return(0,zx.translate)([t.x,t.y,-A/2],I)})(),(0,tl.cylinder)({center:[t.x+(l||0),t.y+(u||0),0],radius:t.hole_diameter/2,height:c})),o),m=(0,tl.cylinder)({center:[t.x+(l||0),t.y+(u||0),0],radius:Math.max(t.hole_diameter/2-Cs,.01),height:a}),_=(0,Og.subtract)(p,m);return n.clipGeom?(0,M6.colorize)(Tc.copper,(0,Og.intersect)(_,n.clipGeom)):(0,M6.colorize)(Tc.copper,_)}if(t.shape==="pill"){const l=(t.ccw_rotation||0)*Math.PI/180,u=M=>{if(!l)return M;const k=(0,zx.translate)([-t.x,-t.y,0],M),R=(0,zx.rotate)([0,0,l],k);return(0,zx.translate)([t.x,t.y,0],R)},g=t.hole_height>t.hole_width,h=g?t.hole_height:t.hole_width,d=g?t.hole_width:t.hole_height,p=g?t.outer_height||d+.2:t.outer_width||h+.2,m=g?t.outer_width||h+.2:t.outer_height||d+.2,_=d/2,f=Math.abs(h-d),y=((M,k,R)=>{const F=k/2,O=Math.abs(M-k);if(O<=1e-6)return(0,tl.cylinder)({center:[t.x,t.y,0],radius:F,height:R});const U=(0,tl.cuboid)({center:[t.x,t.y,0],size:g?[k,O,R]:[O,k,R]}),Y=(0,tl.cylinder)({center:g?[t.x,t.y-O/2,0]:[t.x-O/2,t.y,0],radius:F,height:R}),W=(0,tl.cylinder)({center:g?[t.x,t.y+O/2,0]:[t.x+O/2,t.y,0],radius:F,height:R});return(0,Og.union)(U,Y,W)})(p,m,A),x=(0,tl.cuboid)({center:[t.x,t.y,0],size:g?[d-2*Cs,f,a]:[f,d-2*Cs,a]}),E=(0,tl.cylinder)({center:g?[t.x,t.y-f/2,0]:[t.x-f/2,t.y,0],radius:_-Cs,height:a}),B=(0,tl.cylinder)({center:g?[t.x,t.y+f/2,0]:[t.x+f/2,t.y,0],radius:_-Cs,height:a}),S=(0,Og.union)(x,E,B),Q=dT(u(y),o),w=u(S);return(0,M6.colorize)(Tc.copper,(0,Og.subtract)(Q,w))}if(t.shape==="pill_hole_with_rect_pad"){if(t.hole_shape&&t.hole_shape!=="pill"||t.pad_shape&&t.pad_shape!=="rect")throw new Error("Invalid hole_shape or pad_shape for pill_hole_with_rect_pad");const l=t.hole_offset_x||0,u=t.hole_offset_y||0,g=t.hole_height>t.hole_width,h=g?t.hole_height:t.hole_width,d=g?t.hole_width:t.hole_height,p=d/2,m=Math.abs(h-d),_=t.rect_pad_width||h+.2,f=t.rect_pad_height||d+.2,I=IP(t),C=.03,y=(0,Og.union)((0,tl.cuboid)({center:[t.x+l,t.y+u,0],size:g?[d+2*C,m+2*C,c]:[m+2*C,d+2*C,c]}),(0,tl.cylinder)({center:g?[t.x+l,t.y+u-m/2,0]:[t.x+l-m/2,t.y+u,0],radius:p+C,height:c}),(0,tl.cylinder)({center:g?[t.x+l,t.y+u+m/2,0]:[t.x+l+m/2,t.y+u,0],radius:p+C,height:c})),x=(0,Og.union)((0,tl.cuboid)({center:[t.x+l,t.y+u,0],size:g?[d,m,a]:[m,d,a]}),(0,tl.cylinder)({center:g?[t.x+l,t.y+u-m/2,0]:[t.x+l-m/2,t.y+u,0],radius:p,height:a}),(0,tl.cylinder)({center:g?[t.x+l,t.y+u+m/2,0]:[t.x+l+m/2,t.y+u,0],radius:p,height:a})),E=(()=>{const M=(0,tl.roundedRectangle)({size:[_,f],roundRadius:I||0,segments:Fze}),k=(0,Tpe.extrudeLinear)({height:A},M);return(0,zx.translate)([t.x,t.y,-A/2],k)})(),B=(0,Og.subtract)(E,x),S=(0,Og.union)((0,tl.cuboid)({center:[t.x+l,t.y+u,0],size:g?[d-2*Cs,m-2*Cs,a]:[m-2*Cs,d-2*Cs,a]}),(0,tl.cylinder)({center:g?[t.x+l,t.y+u-m/2,0]:[t.x+l-m/2,t.y+u,0],radius:p-Cs,height:a}),(0,tl.cylinder)({center:g?[t.x+l,t.y+u+m/2,0]:[t.x+l+m/2,t.y+u,0],radius:p-Cs,height:a})),Q=(0,Og.subtract)(y,S),w=dT((0,Og.union)(B,Q),o);return(0,M6.colorize)(Tc.copper,w)}else if(t.shape==="rotated_pill_hole_with_rect_pad"){if(t.hole_shape&&t.hole_shape!=="rotated_pill"||t.pad_shape&&t.pad_shape!=="rect")throw new Error("Invalid hole_shape or pad_shape for rotated_pill_hole_with_rect_pad");const l=t.hole_offset_x||0,u=t.hole_offset_y||0,g=t.hole_width,h=t.hole_height,d=g>=h,p=d?g:h,m=d?h:g,_=m/2,f=Math.abs(p-m),I=t.rect_pad_width||g+.2,C=t.rect_pad_height||h+.2,y=IP(t),x=.03,E=(t.hole_ccw_rotation||0)*Math.PI/180,B=(t.rect_ccw_rotation||0)*Math.PI/180,S=Y=>{const W=l*Math.cos(E)-u*Math.sin(E),te=l*Math.sin(E)+u*Math.cos(E),j=(0,zx.rotate)([0,0,E],Y);return(0,zx.translate)([t.x+W,t.y+te,0],j)},Q=Y=>{if(!B)return Y;const W=(0,zx.translate)([-t.x,-t.y,0],Y),te=(0,zx.rotate)([0,0,B],W);return(0,zx.translate)([t.x,t.y,0],te)},w=S((0,Og.union)((0,tl.cuboid)({center:[0,0,0],size:d?[f+2*x,m+2*x,c]:[m+2*x,f+2*x,c]}),(0,tl.cylinder)({center:d?[-f/2,0,0]:[0,-f/2,0],radius:_+x,height:c}),(0,tl.cylinder)({center:d?[f/2,0,0]:[0,f/2,0],radius:_+x,height:c}))),M=S((0,Og.union)((0,tl.cuboid)({center:[0,0,0],size:d?[f,m,a]:[m,f,a]}),(0,tl.cylinder)({center:d?[-f/2,0,0]:[0,-f/2,0],radius:_,height:a}),(0,tl.cylinder)({center:d?[f/2,0,0]:[0,f/2,0],radius:_,height:a}))),k=Q((()=>{const Y=(0,tl.roundedRectangle)({size:[I,C],roundRadius:y||0,segments:Fze}),W=(0,Tpe.extrudeLinear)({height:A},Y);return(0,zx.translate)([t.x,t.y,-A/2],W)})()),R=(0,Og.subtract)(k,M),F=S((0,Og.union)((0,tl.cuboid)({center:[0,0,0],size:d?[f-2*Cs,m-2*Cs,a]:[m-2*Cs,f-2*Cs,a]}),(0,tl.cylinder)({center:d?[-f/2,0,0]:[0,-f/2,0],radius:_-Cs,height:a}),(0,tl.cylinder)({center:d?[f/2,0,0]:[0,f/2,0],radius:_-Cs,height:a}))),O=(0,Og.subtract)(w,F),U=dT((0,Og.union)(R,O),o);return(0,M6.colorize)(Tc.copper,U)}else if(t.shape==="hole_with_polygon_pad"){const l=t.pad_outline;if(!Array.isArray(l)||l.length<3)throw new Error(`Invalid pad_outline for plated hole at (${t.x}, ${t.y})`);const u=l.map(C=>[C.x,C.y]),g=(0,tl.polygon)({points:u}),p=((C,y)=>{const x=Math.max(C,Cs),E=(0,Tpe.extrudeLinear)({height:x},g);return(0,zx.translate)([t.x,t.y,y-x/2],E)})(A,0),m=dT(p,o),_=Rpe(t,c);if(!_)return(0,M6.colorize)(Tc.copper,m);const f=Rpe(t,a,{sizeDelta:-2*Cs})||_;let I=(0,Og.union)((0,Og.subtract)(m,_),_);return n.clipGeom?(I=(0,Og.subtract)(I,f),I=(0,Og.intersect)(I,n.clipGeom),(0,M6.colorize)(Tc.copper,I)):(0,M6.colorize)(Tc.copper,(0,Og.subtract)(I,f))}else throw new Error(`Unsupported plated hole shape: ${t.shape}`)},o5i=_0(NX()),i5i=_0(aT()),Lze=_0(sT());function r5i({x:t,y:e,outerDiameter:n,holeDiameter:o,thickness:i}){if(n<=o)throw new Error(`Invalid via geometry: outerDiameter (${n}) must be > holeDiameter (${o})`);const r=Cs,s=Math.min(n/2,o/2+r),A=(0,Lze.cylinder)({center:[0,0,0],radius:s,height:i,segments:df}),c=i+2*Cs,l=(0,Lze.cylinder)({center:[0,0,0],radius:o/2,height:c,segments:df}),u=(0,o5i.subtract)(A,l);return(0,i5i.translate)([t,e,0],u)}function s5i({x:t,y:e,holeDiameter:n,thickness:o}){const i=o*1.5,r=n/2+Cs;return(0,Lze.cylinder)({center:[t,e,0],radius:r,height:i,segments:df})}function Dan(t){const e=omt(t),n=[...Mr(t).pcb_via.list()],o=new Map;for(const i of n){const s=`${e.get(i.pcb_via_id)?.pcb_board_id??""}:${i.x}:${i.y}`,a=o.get(s)??[];a.push(i),o.set(s,a)}for(const i of Mr(t).pcb_trace.list()){const r=e.get(i.pcb_trace_id);for(const[s,a]of i.route.entries()){if(a.route_type!=="via")continue;const A=`${r?.pcb_board_id??""}:${a.x}:${a.y}`,c=o.get(A)??[];if(c.some(g=>g.layers.includes(a.from_layer)&&g.layers.includes(a.to_layer)))continue;const u={type:"pcb_via",pcb_via_id:`${i.pcb_trace_id}_route_via_${s}`,pcb_trace_id:i.pcb_trace_id,subcircuit_id:i.subcircuit_id,pcb_group_id:i.pcb_group_id,x:a.x,y:a.y,layers:[a.from_layer,a.to_layer],hole_diameter:a.hole_diameter??r?.min_via_hole_diameter??.25,outer_diameter:a.outer_diameter??r?.min_via_pad_diameter??.6,tented_on_top:a.tented_on_top,tented_on_bottom:a.tented_on_bottom};n.push(u),c.push(u),o.set(A,c)}}return n}var a5i=64,A5i=1,Hze=.05,Nan=["initializing","processing_plated_holes","processing_holes","processing_cutouts","processing_vias","finalizing","done"],c5i=class{board;plated_holes;holes;pcb_vias;pcb_cutouts;boardGeom=null;platedHoleGeoms=[];viaGeoms=[];boardClipGeom=null;state="initializing";currentIndex=0;ctx;onCompleteCallback;finalGeoms=[];constructor(t,e){this.onCompleteCallback=e;const n=t.filter(i=>i.type==="pcb_panel"),o=Mr(t).pcb_board.list();if(n.length>0){const i=n[0],r=o.find(s=>s.pcb_panel_id===i.pcb_panel_id);this.board={type:"pcb_board",pcb_board_id:i.pcb_panel_id,center:i.center,width:i.width,height:i.height,thickness:r?.thickness??1.4,material:r?.material??"fr4",num_layers:r?.num_layers??2,solder_mask_color:r?.solder_mask_color}}else{const i=o.filter(r=>!r.pcb_panel_id);this.board=i[0]}this.plated_holes=Mr(t).pcb_plated_hole.list(),this.holes=Mr(t).pcb_hole.list(),this.pcb_vias=Dan(t),this.pcb_cutouts=Mr(t).pcb_cutout.list(),this.ctx={pcbThickness:this.board.thickness??1.2},this.initializeBoard()}initializeBoard(){const t=this.ctx.pcbThickness+2*A5i;this.board.outline&&this.board.outline.length>0?(this.boardGeom=Rze({outline:this.board.outline},this.ctx.pcbThickness),this.boardClipGeom=Rze({outline:this.board.outline},t,{xyOutset:Hze})):(this.boardGeom=(0,og.cuboid)({size:[this.board.width,this.board.height,this.ctx.pcbThickness],center:[this.board.center.x,this.board.center.y,0]}),this.boardClipGeom=(0,og.cuboid)({size:[this.board.width+2*Hze,this.board.height+2*Hze,t],center:[this.board.center.x,this.board.center.y,0]})),this.state="processing_plated_holes",this.currentIndex=0}goToNextState(){const t=Nan.indexOf(this.state);t!==-1&&(this.state=Nan[t+1],this.currentIndex=0)}step(t=1){if(this.state==="done"||!this.boardGeom)return!0;for(let e=0;e<t&&this.state!=="done";e++)switch(this.state){case"processing_plated_holes":this.currentIndex<this.plated_holes.length?(this.processPlatedHole(this.plated_holes[this.currentIndex]),this.currentIndex++):this.goToNextState();break;case"processing_holes":this.currentIndex<this.holes.length?(this.processHole(this.holes[this.currentIndex]),this.currentIndex++):this.goToNextState();break;case"processing_vias":this.currentIndex<this.pcb_vias.length?(this.processVia(this.pcb_vias[this.currentIndex]),this.currentIndex++):this.goToNextState();break;case"processing_cutouts":this.currentIndex<this.pcb_cutouts.length?(this.processCutout(this.pcb_cutouts[this.currentIndex]),this.currentIndex++):this.goToNextState();break;case"finalizing":this.finalize(),this.state="done";break}return this.state==="done"}processCutout(t){if(!this.boardGeom)return;let e=null;const n=this.ctx.pcbThickness*1.5;switch(t.shape){case"rect":{const o=Man(t.width,t.height,IP(t));if(o>0){const i=(0,og.roundedRectangle)({size:[t.width,t.height],roundRadius:o,segments:a5i});e=(0,kze.extrudeLinear)({height:n},i),e=(0,Vx.translate)([0,0,-n/2],e)}else e=(0,og.cuboid)({center:[0,0,0],size:[t.width,t.height,n]});if(t.rotation){const i=t.rotation*Math.PI/180;e=(0,Vx.rotateZ)(i,e)}e=(0,Vx.translate)([t.center.x,t.center.y,0],e);break}case"circle":e=(0,og.cylinder)({center:[t.center.x,t.center.y,0],radius:t.radius,height:n});break;case"polygon":{let o=t.points.map(r=>[r.x,r.y]);if(o.length<3){console.warn(`PCB Cutout [${t.pcb_cutout_id}] polygon has fewer than 3 points, skipping.`);break}Qan(o)&&(o=o.reverse());const i=(0,og.polygon)({points:o});e=(0,kze.extrudeLinear)({height:n},i),e=(0,Vx.translate)([0,0,-n/2],e);break}}e&&(this.boardGeom=(0,c1.subtract)(this.boardGeom,e))}processPlatedHole(t,e={}){if(this.boardGeom){if(t.shape==="circle"||t.shape==="circular_hole_with_rect_pad"){let n=null;if(t.shape==="circular_hole_with_rect_pad"){if(t.hole_shape&&t.hole_shape!=="circle"||t.pad_shape&&t.pad_shape!=="rect")return;n=(0,og.cylinder)({center:[t.x+(t.hole_offset_x||0),t.y+(t.hole_offset_y||0),0],radius:t.hole_diameter/2+Cs,height:this.ctx.pcbThickness*1.5})}else n=(0,og.cylinder)({center:[t.x,t.y,0],radius:t.hole_diameter/2+Cs,height:this.ctx.pcbThickness*1.5});e.dontCutBoard||(this.boardGeom=(0,c1.subtract)(this.boardGeom,n));const o=XX(t,this.ctx,{clipGeom:this.boardClipGeom});this.platedHoleGeoms.push(o)}else if(t.shape==="pill"||t.shape==="oval"){const n=t.hole_height>t.hole_width,o=n?t.hole_height:t.hole_width,i=n?t.hole_width:t.hole_height,r=i/2,s=Math.abs(o-i);let a;if(a=(0,c1.union)((0,og.cuboid)({center:[t.x,t.y,0],size:n?[i,s,this.ctx.pcbThickness*1.5]:[s,i,this.ctx.pcbThickness*1.5]}),(0,og.cylinder)({center:n?[t.x,t.y-s/2,0]:[t.x-s/2,t.y,0],radius:r,height:this.ctx.pcbThickness*1.5}),(0,og.cylinder)({center:n?[t.x,t.y+s/2,0]:[t.x+s/2,t.y,0],radius:r,height:this.ctx.pcbThickness*1.5})),t.ccw_rotation){const c=t.ccw_rotation*Math.PI/180;a=(0,Vx.translate)([t.x,t.y,0],(0,Vx.rotateZ)(c,(0,Vx.translate)([-t.x,-t.y,0],a)))}e.dontCutBoard||(this.boardGeom=(0,c1.subtract)(this.boardGeom,a));const A=XX(t,this.ctx,{clipGeom:this.boardClipGeom});this.platedHoleGeoms.push(A)}else if(t.shape==="pill_hole_with_rect_pad"){if(t.hole_shape&&t.hole_shape!=="pill"||t.pad_shape&&t.pad_shape!=="rect")return;const n=t.hole_height>t.hole_width,o=n?t.hole_height:t.hole_width,i=n?t.hole_width:t.hole_height,r=i/2,s=Math.abs(o-i);let a;a=(0,c1.union)((0,og.cuboid)({center:[t.x+(t.hole_offset_x||0),t.y+(t.hole_offset_y||0),0],size:n?[i,s,this.ctx.pcbThickness*1.5]:[s,i,this.ctx.pcbThickness*1.5]}),(0,og.cylinder)({center:n?[t.x+(t.hole_offset_x||0),t.y+(t.hole_offset_y||0)-s/2,0]:[t.x+(t.hole_offset_x||0)-s/2,t.y+(t.hole_offset_y||0),0],radius:r,height:this.ctx.pcbThickness*1.5}),(0,og.cylinder)({center:n?[t.x+(t.hole_offset_x||0),t.y+(t.hole_offset_y||0)+s/2,0]:[t.x+(t.hole_offset_x||0)+s/2,t.y+(t.hole_offset_y||0),0],radius:r,height:this.ctx.pcbThickness*1.5})),e.dontCutBoard||(this.boardGeom=(0,c1.subtract)(this.boardGeom,a));const A=XX(t,this.ctx,{clipGeom:this.boardClipGeom});this.platedHoleGeoms.push(A)}else if(t.shape==="rotated_pill_hole_with_rect_pad"){if(t.hole_shape&&t.hole_shape!=="rotated_pill"||t.pad_shape&&t.pad_shape!=="rect")return;const n=t.hole_width,o=t.hole_height,i=n>=o,r=i?n:o,s=i?o:n,a=s/2,A=Math.abs(r-s),c=t.hole_offset_x||0,l=t.hole_offset_y||0;let u=(0,c1.union)((0,og.cuboid)({center:[0,0,0],size:i?[A,s,this.ctx.pcbThickness*1.5]:[s,A,this.ctx.pcbThickness*1.5]}),(0,og.cylinder)({center:i?[-A/2,0,0]:[0,-A/2,0],radius:a,height:this.ctx.pcbThickness*1.5}),(0,og.cylinder)({center:i?[A/2,0,0]:[0,A/2,0],radius:a,height:this.ctx.pcbThickness*1.5}));const g=(t.hole_ccw_rotation||0)*Math.PI/180,h=c*Math.cos(g)-l*Math.sin(g),d=c*Math.sin(g)+l*Math.cos(g);u=(0,Vx.rotateZ)(g,u);const p=(0,Vx.translate)([t.x+h,t.y+d,0],u);e.dontCutBoard||(this.boardGeom=(0,c1.subtract)(this.boardGeom,p));const m=XX(t,this.ctx,{clipGeom:this.boardClipGeom});this.platedHoleGeoms.push(m)}else if(t.shape==="hole_with_polygon_pad"){const n=t.pad_outline;if(!Array.isArray(n)||n.length<3)return;const o=this.ctx.pcbThickness*1.5,i=Rpe(t,o,{sizeDelta:2*Cs}),r=Rpe(t,o,{sizeDelta:-2*Cs});if(!i||!r)return;e.dontCutBoard||(this.boardGeom=(0,c1.subtract)(this.boardGeom,i)),this.platedHoleGeoms=this.platedHoleGeoms.map(a=>(0,qX.colorize)(Tc.copper,(0,c1.subtract)(a,r)));const s=XX(t,this.ctx,{clipGeom:this.boardClipGeom});this.platedHoleGeoms.push(s)}}}processHole(t){if(!this.boardGeom)return;const e=this.ctx.pcbThickness*1.5;if(t.hole_shape==="circle"){const n=(0,og.cylinder)({center:[t.x,t.y,0],radius:t.hole_diameter/2+Cs,height:e});this.boardGeom=(0,c1.subtract)(this.boardGeom,n);const o=(0,og.cylinder)({center:[t.x,t.y,0],radius:t.hole_diameter/2+Cs/2,height:e});this.platedHoleGeoms=this.platedHoleGeoms.map(i=>(0,qX.colorize)(Tc.copper,(0,c1.subtract)(i,o)))}else if(t.hole_shape==="pill"||t.hole_shape==="rotated_pill"||t.hole_shape==="rect"||t.hole_shape==="oval"){const n=t.hole_width??t.hole_diameter,o=t.hole_height??t.hole_diameter,i=t.ccw_rotation??t.rotation??0,r=.02,s=(c,l,u,g)=>{if(c<=0||l<=0)return null;if(t.hole_shape==="rect")return(0,og.cuboid)({center:[0,0,0],size:[c,l,u]});if(g)return(0,Vx.translate)([0,0,-u/2],(0,kze.extrudeLinear)({height:u},(0,og.ellipse)({radius:[c/2,l/2]})));const h=Math.min(c,l)/2,d=Math.abs(c-l);return c>l?(0,c1.union)((0,og.cuboid)({center:[0,0,0],size:[d,l,u]}),(0,og.cylinder)({center:[-d/2,0,0],radius:h,height:u}),(0,og.cylinder)({center:[d/2,0,0],radius:h,height:u})):(0,c1.union)((0,og.cuboid)({center:[0,0,0],size:[c,d,u]}),(0,og.cylinder)({center:[0,-d/2,0],radius:h,height:u}),(0,og.cylinder)({center:[0,d/2,0],radius:h,height:u}))};let a=s(n,o,e,t.hole_shape==="oval"),A=s(n-2*r,o-2*r,e,t.hole_shape==="oval");if(a&&i!==0&&(a=(0,Vx.rotateZ)(i*Math.PI/180,a)),A&&i!==0&&(A=(0,Vx.rotateZ)(i*Math.PI/180,A)),a){const c=(0,Vx.translate)([t.x,t.y,0],a);this.boardGeom=(0,c1.subtract)(this.boardGeom,c)}if(A){const c=(0,Vx.translate)([t.x,t.y,0],A);this.platedHoleGeoms=this.platedHoleGeoms.map(l=>(0,qX.colorize)(Tc.copper,(0,c1.subtract)(l,c)))}}}processVia(t){if(this.boardGeom){if(typeof t.outer_diameter=="number"&&typeof t.hole_diameter=="number"){const e=r5i({x:t.x,y:t.y,outerDiameter:t.outer_diameter,holeDiameter:t.hole_diameter,thickness:this.ctx.pcbThickness});let n=e;this.boardClipGeom&&(n=(0,c1.intersect)(this.boardClipGeom,e),n=(0,qX.colorize)(Tc.copper,n)),this.viaGeoms.push(n)}if(typeof t.hole_diameter=="number"){const e=s5i({x:t.x,y:t.y,holeDiameter:t.hole_diameter,thickness:this.ctx.pcbThickness});this.boardGeom=(0,c1.subtract)(this.boardGeom,e)}}}finalize(){if(!this.boardGeom)return;const t=Tze(this.board);this.boardGeom=(0,qX.colorize)([t.r,t.g,t.b],this.boardGeom),this.finalGeoms=[this.boardGeom,...this.platedHoleGeoms,...this.viaGeoms],this.onCompleteCallback&&this.onCompleteCallback(this.finalGeoms)}getGeoms(){return this.finalGeoms}},l5i=t=>{const[e,n]=ee.useState(null),o=ee.useRef(!1);return ee.useEffect(()=>{let i=!1;if(!t){n(null);return}if(!t.some(c=>c.type==="pcb_board"||c.type==="pcb_panel")){n(null);return}const s=jEi(t);n(s);const a=new c5i(t,c=>{});return(async()=>{if(!o.current){o.current=!0;try{let c=!1;for(;!c&&!i;)c=a.step(1),c||await new Promise(l=>setTimeout(l,0));i||n(a.getGeoms())}catch(c){console.error("Error during board geometry building:",c)}finally{o.current=!1}}})(),()=>{i=!0}},[t]),e},u5i=({children:t,parent:e,position:n,rotation:o,scale:i,color:r,fontSize:s,anchorX:a,anchorY:A,depthOffset:c})=>{const{rootObject:l}=uf(),u=ee.useMemo(()=>{const g=new Rke;return g.text=t,n&&g.position.fromArray(n),o&&g.rotation.fromArray(o),i&&g.scale.fromArray(i),g.color=r||"white",g.fontSize=s||1,g.anchorX=a||"center",g.anchorY=A||"middle",g.depthOffset=c||0,g.font=null,g.sync(),g},[t,n,o,i,r,s,a,A,c]);return ee.useEffect(()=>{const g=e||l;if(!(!g||!u))return g.add(u),()=>{g.remove(u),u.dispose()}},[l,e,u]),null},Ran=({error:t,cad_component:e})=>{const{rootObject:n}=uf(),[o,i]=ee.useState(!1),[r,s]=ee.useState(null),a=ee.useCallback(u=>{u?.mousePosition?(i(!0),s(u.mousePosition)):(i(!1),s(null))},[]),A=ee.useCallback(()=>{i(!1),s(null)},[]),c=ee.useMemo(()=>e?.position?[e.position.x,e.position.y,e.position.z].map(g=>Number.isNaN(g)?0:g):[0,0,0],[e]),l=ee.useMemo(()=>{const u=new lh;return u.position.fromArray(c),u},[c]);return l.userData.cad_component_id=e?.cad_component_id,l.userData.pcb_component_id=e?.pcb_component_id,ee.useEffect(()=>{if(n)return n.add(l),()=>{n.remove(l)}},[n,l]),K.jsxs(K.Fragment,{children:[K.jsxs(jX,{isHovered:o,onHover:a,onUnhover:A,object:l,children:[K.jsx(g5i,{parent:l}),K.jsx(u5i,{parent:l,scale:[.1,.1,.1],color:"red",anchorX:"center",anchorY:"middle",depthOffset:-99999,children:`${t.toString().slice(0,50)}...`})]}),o&&r?K.jsx(Prn,{position:r,style:{fontFamily:"sans-serif",transform:"translate3d(-1rem, 0rem, 0)",backgroundColor:"white",padding:"6px",borderRadius:"4px",color:"red",pointerEvents:"none",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},children:t.toString()}):null]})},g5i=({parent:t})=>{const e=ee.useMemo(()=>{const n=new Er(new Yx(.5,.5,.5),new su({depthTest:!1,transparent:!0,color:"red",opacity:.5}));return n.renderOrder=999999,n.rotation.fromArray([Math.PI/4,Math.PI/4,0]),n},[]);return ee.useEffect(()=>(t.add(e),()=>{t.remove(e)}),[t,e]),null},d5i=t=>{if(t.length===0)return null;let e=t[0].x,n=t[0].y,o=t[0].x,i=t[0].y;for(let r=1;r<t.length;r++){const s=t[r];s.x<e&&(e=s.x),s.y<n&&(n=s.y),s.x>o&&(o=s.x),s.y>i&&(i=s.y)}return{minX:e,minY:n,maxX:o,maxY:i}};function DC(t){if(t.outline&&t.outline.length>=3){const s=d5i(t.outline);return{...s,width:s.maxX-s.minX,height:s.maxY-s.minY,centerX:(s.minX+s.maxX)/2,centerY:(s.minY+s.maxY)/2}}const e=t.width??0,n=t.height??0,o=t.center?.x??0,i=t.center?.y??0;return{...{minX:o-e/2,maxX:o+e/2,minY:i-n/2,maxY:i+n/2},width:e,height:n,centerX:o,centerY:i}}function h5i({layer:t,circuitJson:e,boardData:n,copperColor:o,traceTextureResolution:i}){const s=Mr(e).pcb_smtpad.list().filter(y=>y.layer===t);if(s.length===0)return null;const a=Mr(e).pcb_hole.list(),A=Mr(e).pcb_plated_hole.list().filter(y=>!Array.isArray(y.layers)||y.layers.includes(t)),c=Mr(e).pcb_via.list().filter(y=>!Array.isArray(y.layers)||y.layers.includes(t)),l=Mr(e).pcb_cutout.list(),u=[...a,...A,...c],g=t==="top"?"top_copper":"bottom_copper",h=DC(n),d=document.createElement("canvas"),p=Math.floor(h.width*i),m=Math.floor(h.height*i);d.width=p,d.height=m;const _=d.getContext("2d");if(!_)return null;t==="bottom"&&(_.translate(0,m),_.scale(1,-1));const f="rgba(0,0,0,0)",I=new xl(_);I.configure({colorOverrides:{copper:{top:o,bottom:o,inner1:o,inner2:o,inner3:o,inner4:o,inner5:o,inner6:o,inner7:o,inner8:o},copperPour:{top:f,bottom:f},drill:f,boardOutline:f,substrate:f,keepout:{top:f,bottom:f},fabricationNote:f,courtyard:{top:f,bottom:f},silkscreen:{top:f,bottom:f},soldermask:{top:f,bottom:f},soldermaskWithCopperUnderneath:{top:f,bottom:f},soldermaskOverCopper:{top:f,bottom:f}}}),I.setCameraBounds({minX:h.minX,maxX:h.maxX,minY:h.minY,maxY:h.maxY}),I.drawElements([...s,...u,...l],{layers:[g],drawSoldermask:!1,drawSoldermaskTop:!1,drawSoldermaskBottom:!1});const C=new Ux(d);return C.generateMipmaps=!0,C.minFilter=gm,C.magFilter=Fl,C.anisotropy=16,C.needsUpdate=!0,C}var p5i=t=>{const e=t.filter(n=>n.type==="pcb_panel");return e.length===0?null:e.length===1?e[0].pcb_panel_id:null};function m5i({layer:t,circuitJson:e,panelData:n,outlineColor:o="black",traceTextureResolution:i}){const r=p5i(e);if(!r)return null;const a=Mr(e).pcb_board.list().filter(p=>p.pcb_panel_id===r||p.position_mode==="relative_to_panel_anchor"&&!p.pcb_panel_id);if(a.length===0)return null;const A=document.createElement("canvas"),c=Math.floor(n.width*i),l=Math.floor(n.height*i);A.width=c,A.height=l;const u=A.getContext("2d");if(!u)return null;t==="bottom"&&(u.translate(0,l),u.scale(1,-1)),u.strokeStyle=o,u.lineWidth=.05*i;const g=p=>(p-n.center.x+n.width/2)*i,h=p=>(-(p-n.center.y)+n.height/2)*i;a.forEach(p=>{if(p.outline&&p.outline.length>=2)u.beginPath(),p.outline.forEach((m,_)=>{const f=g(m.x),I=h(m.y);_===0?u.moveTo(f,I):u.lineTo(f,I)}),u.closePath(),u.stroke();else{const m=p.width,_=p.height,{x:f,y:I}=p.center,C=g(f-m/2),y=h(I+_/2);u.strokeRect(C,y,m*i,_*i)}});const d=new Ux(A);return d.generateMipmaps=!0,d.minFilter=gm,d.magFilter=Fl,d.anisotropy=16,d.needsUpdate=!0,d}function _5i({layer:t,circuitJson:e,boardData:n,traceColor:o,traceTextureResolution:i}){const r=Mr(e).pcb_trace.list(),s=Mr(e).pcb_via.list(),a=Mr(e).pcb_plated_hole.list(),A=t==="top"?"top_copper":"bottom_copper",c=r.filter(C=>umt(C).includes(A));if(c.length===0)return null;const l=a.filter(C=>C.layers.includes(t)),u=[...c,...s,...l],g=DC(n),h=document.createElement("canvas"),d=Math.floor(g.width*i),p=Math.floor(g.height*i);h.width=d,h.height=p;const m=h.getContext("2d");if(!m)return null;t==="bottom"&&(m.translate(0,p),m.scale(1,-1));const _="rgba(0,0,0,0)",f=new xl(m);f.configure({colorOverrides:{copper:{top:o,bottom:o,inner1:o,inner2:o,inner3:o,inner4:o,inner5:o,inner6:o,inner7:o,inner8:o},copperPour:{top:_,bottom:_},drill:_,boardOutline:_,substrate:_,keepout:{top:_,bottom:_},fabricationNote:_,courtyard:{top:_,bottom:_},silkscreen:{top:_,bottom:_},soldermask:{top:_,bottom:_},soldermaskWithCopperUnderneath:{top:_,bottom:_},soldermaskOverCopper:{top:_,bottom:_}}}),f.setCameraBounds({minX:g.minX,maxX:g.maxX,minY:g.minY,maxY:g.maxY}),f.drawElements(u,{layers:[A],clipContextElements:e,drawSoldermask:!1,drawSoldermaskTop:!1,drawSoldermaskBottom:!1});const I=new Ux(h);return I.generateMipmaps=!0,I.minFilter=gm,I.magFilter=Fl,I.anisotropy=16,I.needsUpdate=!0,I}var f5i=t=>{const[e=0,n=0,o=0]=t;return`rgb(${Math.round(e*255)}, ${Math.round(n*255)}, ${Math.round(o*255)})`},I5i=8;function Tan({layer:t,circuitJson:e,boardData:n,traceTextureResolution:o=m4,copperColor:i=f5i(Tc.copper),onlyCoveredBySoldermask:r=!1}){const s=e.filter(S=>S.type==="pcb_copper_pour"),a=t==="top"?"top_copper":"bottom_copper",A=s.filter(S=>S.layer===t&&(!r||S.covered_with_solder_mask!==!1));if(A.length===0)return null;const c=e.filter(S=>S.type==="pcb_hole"),l=e.filter(S=>S.type!=="pcb_plated_hole"?!1:!Array.isArray(S.layers)||S.layers.includes(t)),u=e.filter(S=>S.type!=="pcb_via"?!1:!Array.isArray(S.layers)||S.layers.includes(t)),g=[...c,...l,...u],h=DC(n),d=document.createElement("canvas"),p=Math.floor(h.width*o),m=Math.floor(h.height*o);d.width=p,d.height=m;const _=d.getContext("2d");if(!_)return null;t==="bottom"&&(_.translate(0,m),_.scale(1,-1));const f="rgba(0,0,0,0)",I=i,C=i,y=(S,Q)=>{if(S.length===0)return;const w=[...S,...g],M=new xl(_);M.configure({colorOverrides:{copper:{top:Q,bottom:Q,inner1:Q,inner2:Q,inner3:Q,inner4:Q,inner5:Q,inner6:Q,inner7:Q,inner8:Q},copperPour:{top:f,bottom:f},drill:f,boardOutline:f,substrate:f,keepout:{top:f,bottom:f},fabricationNote:f,courtyard:{top:f,bottom:f},silkscreen:{top:f,bottom:f},soldermask:{top:f,bottom:f},soldermaskWithCopperUnderneath:{top:f,bottom:f},soldermaskOverCopper:{top:f,bottom:f}}}),M.setCameraBounds({minX:h.minX,maxX:h.maxX,minY:h.minY,maxY:h.maxY}),M.drawElements(w,{layers:[a],drawSoldermask:!1,drawSoldermaskTop:!1,drawSoldermaskBottom:!1});for(let k=1;k<I5i;k+=1)M.drawElements(w,{layers:[a],drawSoldermask:!1,drawSoldermaskTop:!1,drawSoldermaskBottom:!1})},x=A.filter(S=>S.covered_with_solder_mask!==!1),E=A.filter(S=>S.covered_with_solder_mask===!1);y(x,I),r||y(E,C);const B=new Ux(d);return B.generateMipmaps=!0,B.minFilter=gm,B.magFilter=Fl,B.anisotropy=16,B.needsUpdate=!0,B}var kan=(t,e)=>{t.setCameraBounds({minX:e.minX,maxX:e.maxX,minY:e.minY,maxY:e.maxY})},C5i=({ctx:t,layer:e,bounds:n,elements:o,copperColor:i})=>{const r=e==="top"?"top_copper":"bottom_copper",s=new xl(t);s.configure({colorOverrides:{copper:{top:i,bottom:i,inner1:i,inner2:i,inner3:i,inner4:i,inner5:i,inner6:i,inner7:i,inner8:i}}}),kan(s,n),s.drawElements(o,{layers:[r]});const a=o.filter(u=>u.type==="pcb_copper_text"&&u.is_knockout===!0);if(a.length===0)return;const A=document.createElement("canvas");A.width=t.canvas.width,A.height=t.canvas.height;const c=A.getContext("2d");if(!c)return;const l=new xl(c);l.configure({colorOverrides:{copper:{top:"rgb(255,255,255)",bottom:"rgb(255,255,255)",inner1:"rgb(255,255,255)",inner2:"rgb(255,255,255)",inner3:"rgb(255,255,255)",inner4:"rgb(255,255,255)",inner5:"rgb(255,255,255)",inner6:"rgb(255,255,255)",inner7:"rgb(255,255,255)",inner8:"rgb(255,255,255)"}}}),kan(l,n),l.drawElements(a.map(u=>({...u,is_knockout:!1})),{layers:[r]}),t.save(),t.globalCompositeOperation="destination-out",t.drawImage(A,0,0),t.restore()};function y5i({layer:t,circuitJson:e,boardData:n,copperColor:o="rgb(230, 153, 51)",traceTextureResolution:i=m4}){const r=e.filter(g=>g.type==="pcb_copper_text"&&"layer"in g&&g.layer===t);if(r.length===0)return null;const s=DC(n),a=Math.floor(s.width*i),A=Math.floor(s.height*i);if(a<=0||A<=0)return null;const c=document.createElement("canvas");c.width=a,c.height=A;const l=c.getContext("2d");if(!l)return null;t==="bottom"&&(l.translate(0,A),l.scale(1,-1)),C5i({ctx:l,layer:t,bounds:s,elements:r,copperColor:o});const u=new Ux(c);return u.generateMipmaps=!0,u.minFilter=gm,u.magFilter=Fl,u.anisotropy=16,u.needsUpdate=!0,u}var Fan=25.4,x5i=Fan/1e3,E5i=/^\s*(-?\d*(?:\.\d+)?)(?:\s*(mm|mil|inch|in|"))?\s*$/i;function B5i(t){if(!t)return;const e=t.trim().toLowerCase();return e==='"'||e==="inch"?"in":e}function kpe(t){if(t==null)return;if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(typeof t!="string")return;const e=t.trim();if(e.length===0)return;const n=e.match(E5i);if(!n){const a=Number.parseFloat(e);return Number.isFinite(a)?a:void 0}const[,o,i]=n,r=Number.parseFloat(o||"0");if(!Number.isFinite(r))return;switch(B5i(i)){case"mil":return r*x5i;case"in":return r*Fan;case"mm":case void 0:return r;default:return r}}function k0(t,e){const n=kpe(t);return n===void 0?e:n}var b5i="rgb(255,243,204)",ig="rgba(0,0,0,0)",S5i=(t,e)=>{t.setCameraBounds({minX:e.minX,maxX:e.maxX,minY:e.minY,maxY:e.maxY})},Q5i=t=>t.type==="pcb_fabrication_note_rect"?{...t,width:kpe(t.width)??0,height:kpe(t.height)??0,stroke_width:k0(t.stroke_width,.1),corner_radius:kpe(t.corner_radius)}:t.type==="pcb_fabrication_note_path"?{...t,stroke_width:k0(t.stroke_width,.1)}:t.type==="pcb_fabrication_note_text"?{...t,font_size:k0(t.font_size,1)}:t.type==="pcb_fabrication_note_dimension"?{...t,font_size:k0(t.font_size,1),arrow_size:k0(t.arrow_size,1),offset_distance:k0(t.offset_distance,0)}:t,v5i=({ctx:t,layer:e,bounds:n,elements:o})=>{const i=`${e}_fabrication_note`,r=o.map(Q5i),s=new xl(t);s.configure({colorOverrides:{copper:{top:ig,bottom:ig,inner1:ig,inner2:ig,inner3:ig,inner4:ig,inner5:ig,inner6:ig,inner7:ig,inner8:ig},copperPour:{top:ig,bottom:ig},drill:ig,boardOutline:ig,substrate:ig,keepout:{top:ig,bottom:ig},courtyard:{top:ig,bottom:ig},soldermask:{top:ig,bottom:ig},soldermaskWithCopperUnderneath:{top:ig,bottom:ig},soldermaskOverCopper:{top:ig,bottom:ig},silkscreen:{top:ig,bottom:ig},fabricationNote:b5i}}),S5i(s,n),s.drawElements(r,{layers:[i]})},w5i=t=>({minX:t.center.x-t.width/2,maxX:t.center.x+t.width/2,minY:t.center.y-t.height/2,maxY:t.center.y+t.height/2,width:t.width,height:t.height,centerX:t.center.x,centerY:t.center.y}),P5i=(t,e)=>{const n=Math.min(t.minX,e.minX),o=Math.max(t.maxX,e.maxX),i=Math.min(t.minY,e.minY),r=Math.max(t.maxY,e.maxY);return{minX:n,maxX:o,minY:i,maxY:r,width:o-n,height:r-i,centerX:(n+o)/2,centerY:(i+r)/2}},Fpe=(t,e)=>{const n=t.filter(s=>s.type==="pcb_panel"),o=t.filter(s=>s.type==="pcb_board"),i=n.find(s=>s.pcb_panel_id===e.pcb_board_id)??n[0];return i&&i.width>0&&i.height>0?w5i(i):(o.length>1?o:[e]).map(s=>DC(s)).reduce((s,a)=>P5i(s,a))},M5i=(t,e)=>{if(!("layer"in t)||t.layer!==e)return!1;const n=t.type;return n.startsWith("pcb_fabrication_note_")&&n!=="pcb_fabrication_note_text"};function D5i({layer:t,circuitJson:e,boardData:n,traceTextureResolution:o=m4}){const i=e.filter(u=>M5i(u,t));if(i.length===0)return null;const r=Fpe(e,n),s=Math.floor(r.width*o),a=Math.floor(r.height*o);if(s<=0||a<=0)return null;const A=document.createElement("canvas");A.width=s,A.height=a;const c=A.getContext("2d");if(!c)return null;t==="bottom"&&(c.translate(0,a),c.scale(1,-1)),v5i({ctx:c,layer:t,bounds:r,elements:i});const l=new Ux(A);return l.generateMipmaps=!0,l.minFilter=gm,l.magFilter=Fl,l.anisotropy=16,l.needsUpdate=!0,l}var N5i=(t,e)=>{t.setCameraBounds({minX:e.minX,maxX:e.maxX,minY:e.minY,maxY:e.maxY})},R5i=({ctx:t,layer:e,bounds:n,elements:o,keepoutColor:i})=>{const r=e==="top"?"top_copper":"bottom_copper",s=new xl(t);s.configure({colorOverrides:{keepout:{top:i,bottom:i}}}),N5i(s,n),s.drawElements(o,{layers:[r],drawSoldermask:!1,drawSoldermaskTop:!1,drawSoldermaskBottom:!1})},T5i=(t,e)=>t.type!=="pcb_keepout"?!1:!("layers"in t)||!Array.isArray(t.layers)?!0:t.layers.includes(e);function k5i({layer:t,circuitJson:e,boardData:n,traceTextureResolution:o=m4,keepoutColor:i=t==="bottom"?"#4b72d2":"#d24b4b"}){const r=e.filter(g=>T5i(g,t));if(r.length===0)return null;const s=DC(n),a=Math.floor(s.width*o),A=Math.floor(s.height*o);if(a<=0||A<=0)return null;const c=document.createElement("canvas");c.width=a,c.height=A;const l=c.getContext("2d");if(!l)return null;t==="bottom"&&(l.translate(0,A),l.scale(1,-1)),R5i({ctx:l,layer:t,bounds:s,elements:r,keepoutColor:i});const u=new Ux(c);return u.generateMipmaps=!0,u.minFilter=gm,u.magFilter=Fl,u.anisotropy=16,u.needsUpdate=!0,u}var Nu="rgba(0,0,0,0)",F5i=(t,e)=>{t.setCameraBounds({minX:e.minX,maxX:e.maxX,minY:e.minY,maxY:e.maxY})},L5i=t=>t.type==="pcb_note_line"?{...t,x1:k0(t.x1,0),y1:k0(t.y1,0),x2:k0(t.x2,0),y2:k0(t.y2,0),stroke_width:k0(t.stroke_width,.1)}:t.type==="pcb_note_rect"?{...t,center:{x:k0(t.center.x,0),y:k0(t.center.y,0)},width:k0(t.width,0),height:k0(t.height,0),stroke_width:k0(t.stroke_width,.1),corner_radius:k0(t.corner_radius,0)}:t.type==="pcb_note_text"?{...t,anchor_position:{x:k0(t.anchor_position.x,0),y:k0(t.anchor_position.y,0)},font_size:k0(t.font_size,1)}:t.type==="pcb_note_path"?{...t,route:t.route.map(e=>({...e,x:k0(e.x,0),y:k0(e.y,0)})),stroke_width:k0(t.stroke_width,.1)}:t.type==="pcb_note_dimension"?{...t,from:{x:k0(t.from.x,0),y:k0(t.from.y,0)},to:{x:k0(t.to.x,0),y:k0(t.to.y,0)},font_size:k0(t.font_size,1),arrow_size:k0(t.arrow_size,1),offset_distance:k0(t.offset_distance,0)}:t,H5i=({ctx:t,bounds:e,elements:n})=>{const o=n.map(L5i),i=new xl(t);i.configure({colorOverrides:{copper:{top:Nu,bottom:Nu,inner1:Nu,inner2:Nu,inner3:Nu,inner4:Nu,inner5:Nu,inner6:Nu,inner7:Nu,inner8:Nu},copperPour:{top:Nu,bottom:Nu},drill:Nu,boardOutline:Nu,substrate:Nu,keepout:{top:Nu,bottom:Nu},courtyard:{top:Nu,bottom:Nu},soldermask:{top:Nu,bottom:Nu},soldermaskWithCopperUnderneath:{top:Nu,bottom:Nu},soldermaskOverCopper:{top:Nu,bottom:Nu},silkscreen:{top:Nu,bottom:Nu},fabricationNote:Nu}}),F5i(i,e),i.drawElements(o)},O5i=(t,e)=>!("layer"in t)||t.layer!==e?!1:t.type.startsWith("pcb_note_");function G5i({layer:t,circuitJson:e,boardData:n,traceTextureResolution:o=m4}){const i=e.filter(u=>O5i(u,t));if(i.length===0)return null;const r=Fpe(e,n),s=Math.floor(r.width*o),a=Math.floor(r.height*o);if(s<=0||a<=0)return null;const A=document.createElement("canvas");A.width=s,A.height=a;const c=A.getContext("2d");if(!c)return null;t==="bottom"&&(c.translate(0,a),c.scale(1,-1)),H5i({ctx:c,bounds:r,elements:i});const l=new Ux(A);return l.generateMipmaps=!0,l.minFilter=gm,l.magFilter=Fl,l.anisotropy=16,l.needsUpdate=!0,l}var Y5i="rgb(255,243,204)",bd="rgba(0,0,0,0)",Lan=(t,e,n)=>{const o=e==="top"?t.tented_on_top:t.tented_on_bottom,i="is_tented"in t?t.is_tented:void 0,r=e==="top"?n?.default_via_tented_on_top:n?.default_via_tented_on_bottom;return o??i??r??!1},U5i=(t,e,n,o)=>t.type==="pcb_cutout"?!0:t.type==="pcb_via"?!o||!Lan(t,e,n):t.type==="pcb_hole"||t.type==="pcb_plated_hole"?!o||t.is_covered_with_solder_mask!==!0:!1,K5i=(t,e)=>{t.setCameraBounds({minX:e.minX,maxX:e.maxX,minY:e.minY,maxY:e.maxY})},V5i=({ctx:t,layer:e,bounds:n,elements:o,circuitJson:i,silkscreenColor:r,soldermaskVisible:s})=>{const a=e==="top"?"top_silkscreen":"bottom_silkscreen",A=new xl(t);A.configure({colorOverrides:{copper:{top:bd,bottom:bd,inner1:bd,inner2:bd,inner3:bd,inner4:bd,inner5:bd,inner6:bd,inner7:bd,inner8:bd},copperPour:{top:bd,bottom:bd},drill:bd,boardOutline:bd,substrate:bd,keepout:{top:bd,bottom:bd},courtyard:{top:bd,bottom:bd},soldermask:{top:bd,bottom:bd},soldermaskWithCopperUnderneath:{top:bd,bottom:bd},soldermaskOverCopper:{top:bd,bottom:bd},silkscreen:{top:r,bottom:r},fabricationNote:Y5i}}),K5i(A,n),A.drawElements(o,{layers:[a],clipContextElements:i});const c=i.flatMap(l=>{if(l.type==="pcb_trace"){const g=t.boardOwnerMap?.get(l.pcb_trace_id),h=l.route.filter(d=>d.route_type==="via"&&(!s||!Lan(d,e,g)));return h.length?[{...l,route:h}]:[]}const u=l.type==="pcb_via"?t.boardOwnerMap?.get(l.pcb_via_id):void 0;return U5i(l,e,u,s)?[l]:[]});A.drawElements(c,{layers:[a],clipContextElements:i,clearDrillHoles:!0})},z5i=(t,e)=>!("layer"in t)||t.layer!==e?!1:t.type.startsWith("pcb_silkscreen_");function J5i({layer:t,circuitJson:e,boardData:n,traceTextureResolution:o=m4,silkscreenColor:i="rgb(255,255,255)",soldermaskVisible:r=!0}){const s=e.filter(h=>z5i(h,t));if(s.length===0)return null;const a=Fpe(e,n),A=Math.floor(a.width*o),c=Math.floor(a.height*o);if(A<=0||c<=0)return null;const l=document.createElement("canvas");l.width=A,l.height=c;const u=l.getContext("2d");if(!u)return null;t==="bottom"&&(u.translate(0,c),u.scale(1,-1)),V5i({ctx:u,layer:t,bounds:a,elements:s,circuitJson:e,silkscreenColor:i,soldermaskVisible:r});const g=new Ux(l);return g.generateMipmaps=!0,g.minFilter=gm,g.magFilter=Fl,g.anisotropy=16,g.needsUpdate=!0,g}var ZX=t=>{const[e=0,n=0,o=0]=t;return`rgb(${Math.round(e*255)}, ${Math.round(n*255)}, ${Math.round(o*255)})`},W5i=t=>{const e=ZX(FEi[t.material]??Tc.fr4SolderMaskGreen),n=t.material==="fr1"?ZX(Tc.fr1TracesWithMaskCopper):ZX(Tc.fr4TracesWithMaskGreen),o=van(t.solder_mask_color);if(!o)return{soldermask:e,soldermaskOverCopper:n,copper:ZX(Tc.copper),transparent:"rgba(0,0,0,0)"};const i=new Vi().setRGB(Tc.copper[0],Tc.copper[1],Tc.copper[2],Ox);return{soldermask:wan(o),soldermaskOverCopper:wan(JEi({soldermaskColor:o,copperColor:i,soldermaskOpacity:VEi(t.solder_mask_color)})),copper:ZX(Tc.copper),transparent:"rgba(0,0,0,0)"}},Han=(t,e)=>{t.setCameraBounds({minX:e.minX,maxX:e.maxX,minY:e.minY,maxY:e.maxY})},j5i=({ctx:t,layer:e,bounds:n,elements:o,boardData:i})=>{const r=W5i(i),s=e==="top"?"top_copper":"bottom_copper",a=new xl(t);a.configure({colorOverrides:{copper:{top:r.transparent,bottom:r.transparent,inner1:r.transparent,inner2:r.transparent,inner3:r.transparent,inner4:r.transparent,inner5:r.transparent,inner6:r.transparent,inner7:r.transparent,inner8:r.transparent},drill:r.transparent,boardOutline:r.transparent,substrate:r.transparent,keepout:{top:r.transparent,bottom:r.transparent},fabricationNote:r.transparent,silkscreen:{top:r.transparent,bottom:r.transparent},courtyard:{top:r.transparent,bottom:r.transparent},soldermask:{top:r.soldermask,bottom:r.soldermask},soldermaskWithCopperUnderneath:{top:r.soldermaskOverCopper,bottom:r.soldermaskOverCopper},soldermaskOverCopper:{top:r.soldermaskOverCopper,bottom:r.soldermaskOverCopper}}}),Han(a,n);const A=o.filter(l=>l.type!=="pcb_keepout");a.drawElements(A,{layers:[s],drawSoldermask:!0,drawSoldermaskTop:e==="top",drawSoldermaskBottom:e==="bottom"});const c=A.filter(l=>l.type==="pcb_copper_pour"&&l.layer===e&&l.covered_with_solder_mask===!1);if(c.length>0){t.save(),t.globalCompositeOperation="destination-out";const l=new xl(t);l.configure({colorOverrides:{copper:{top:r.copper,bottom:r.copper,inner1:r.copper,inner2:r.copper,inner3:r.copper,inner4:r.copper,inner5:r.copper,inner6:r.copper,inner7:r.copper,inner8:r.copper}}}),Han(l,n),l.drawElements(c,{layers:[s]}),t.restore()}};function $5i({layer:t,circuitJson:e,boardData:n,traceTextureResolution:o=m4}){const i=Fpe(e,n),r=Math.floor(i.width*o),s=Math.floor(i.height*o);if(r<=0||s<=0)return null;const a=document.createElement("canvas");a.width=r,a.height=s;const A=a.getContext("2d");if(!A)return null;t==="bottom"&&(A.translate(0,s),A.scale(1,-1));const c=e.some(u=>u.type==="pcb_board")?e:[n,...e];j5i({ctx:A,layer:t,bounds:i,elements:c,boardData:n});const l=new Ux(a);return l.generateMipmaps=!0,l.minFilter=gm,l.magFilter=Fl,l.anisotropy=16,l.needsUpdate=!0,l}var q5i=(t,e)=>{t.setCameraBounds({minX:e.minX,maxX:e.maxX,minY:e.minY,maxY:e.maxY})},X5i=({ctx:t,layer:e,bounds:n,elements:o,copperColor:i})=>{const r=e==="top"?"top_copper":"bottom_copper",s="rgba(0,0,0,0)",a=new xl(t);a.configure({colorOverrides:{copper:{top:i,bottom:i,inner1:i,inner2:i,inner3:i,inner4:i,inner5:i,inner6:i,inner7:i,inner8:i},drill:s,boardOutline:s,substrate:s,keepout:{top:s,bottom:s},fabricationNote:s,silkscreen:{top:s,bottom:s},courtyard:{top:s,bottom:s},soldermask:{top:s,bottom:s},soldermaskWithCopperUnderneath:{top:s,bottom:s},soldermaskOverCopper:{top:s,bottom:s}}}),q5i(a,n),a.drawElements(o,{layers:[r]})};function Z5i({layer:t,circuitJson:e,boardData:n,copperColor:o="rgb(230, 153, 51)",traceTextureResolution:i=m4}){const r=e.filter(g=>{if(g.type==="pcb_via")return!0;if(g.type!=="pcb_plated_hole")return!1;const h=g;return!Array.isArray(h.layers)||h.layers.includes(t)});if(r.length===0)return null;const s=DC(n),a=Math.floor(s.width*i),A=Math.floor(s.height*i);if(a<=0||A<=0)return null;const c=document.createElement("canvas");c.width=a,c.height=A;const l=c.getContext("2d");if(!l)return null;t==="bottom"&&(l.translate(0,A),l.scale(1,-1)),X5i({ctx:l,layer:t,bounds:s,elements:r,copperColor:o});const u=new Ux(c);return u.generateMipmaps=!0,u.minFilter=gm,u.magFilter=Fl,u.anisotropy=16,u.needsUpdate=!0,u}var Oan=t=>{const[e=0,n=0,o=0]=t;return`rgb(${Math.round(e*255)}, ${Math.round(n*255)}, ${Math.round(o*255)})`},Oze=t=>Math.max(0,Math.min(255,t)),e4i=(t,e,n,o={})=>{const i=t.getImageData(0,0,e,n),r=i.data,s=Math.max(e-1,1),a=Math.max(n-1,1);for(let A=0;A<r.length;A+=4){if((r[A+3]??0)<16)continue;const l=r[A]??0,u=r[A+1]??0,g=r[A+2]??0,h=.2126*l+.7152*u+.0722*g;if(!(u>l*1.35&&u>g*1.15&&h<90&&l<80&&g<80))continue;const p=A/4,m=p%e,_=Math.floor(p/e),f=m/s,I=_/a,C=f*.62+(1-I)*.38,y=Math.sin((f*1.15+I*.35)*Math.PI)*.04,x=.74+C*.18+y,E=o.includeReflection?(()=>{const k=f-.36,R=I-.22,F=Math.max(0,1-Math.hypot(k,R)/.38);return F*F*.07})():0,B=(l*.9+3)*x,S=(u*1.08+15)*x,Q=(g*1.28+13)*x;r[A]=Oze(B*(1-E)+255*E),r[A+1]=Oze(S*(1-E)+255*E),r[A+2]=Oze(Q*(1-E)+255*E)}t.putImageData(i,0,0)},t4i=({textures:t,boardData:e,traceTextureResolution:n,layer:o})=>{if(!t.some(u=>u?.image))return null;const r=DC(e),s=Math.floor(r.width*n),a=Math.floor(r.height*n);if(s<=0||a<=0)return null;const A=document.createElement("canvas");A.width=s,A.height=a+1;const c=A.getContext("2d");if(!c)return null;for(const u of t){if(!u?.image)continue;const g=u.image;c.drawImage(g,0,0,s,a)}e4i(c,s,a,{includeReflection:o==="top"});const l=new Ux(A);return l.generateMipmaps=!1,l.minFilter=Fl,l.magFilter=Fl,l.premultiplyAlpha=!0,l.anisotropy=16,l.needsUpdate=!0,l},n4i=({textures:t,soldermaskTexture:e,boardData:n,traceTextureResolution:o})=>{if(!e?.image||!t.some(l=>l?.image))return null;const i=DC(n),r=Math.floor(i.width*o),s=Math.floor(i.height*o);if(r<=0||s<=0)return null;const a=document.createElement("canvas");a.width=r,a.height=s+1;const A=a.getContext("2d");if(!A)return null;for(const l of t)l?.image&&A.drawImage(l.image,0,0,r,s);A.globalCompositeOperation="destination-in",A.drawImage(e.image,0,0,r,s),A.globalCompositeOperation="source-over";const c=new Ux(a);return c.colorSpace=_6,c.generateMipmaps=!1,c.minFilter=Fl,c.magFilter=Fl,c.premultiplyAlpha=!1,c.needsUpdate=!0,c};function Gan({circuitJson:t,boardData:e,traceTextureResolution:n,visibility:o}){const i=Oan(Tc.copper),r="rgb(255,255,255)",s=Oan(Tc.copper),a=o?.boardBody??!0,A=g=>{const h=(g==="top"?o?.topMask:o?.bottomMask)??!0,d=(g==="top"?o?.topCopper:o?.bottomCopper)??!0,p=(g==="top"?o?.topSilkscreen:o?.bottomSilkscreen)??!0,m=o?.keepout??!0,_=h?$5i({layer:g,circuitJson:t,boardData:e,traceTextureResolution:n}):null,f=d?_5i({layer:g,circuitJson:t,boardData:e,traceColor:i,traceTextureResolution:n}):null,I=d?Tan({layer:g,circuitJson:t,boardData:e,traceTextureResolution:n,copperColor:s}):null,C=h&&d?Tan({layer:g,circuitJson:t,boardData:e,traceTextureResolution:n,copperColor:s,onlyCoveredBySoldermask:!0}):null,y=d?y5i({layer:g,circuitJson:t,boardData:e,copperColor:s,traceTextureResolution:n}):null,x=d?h5i({layer:g,circuitJson:t,boardData:e,copperColor:s,traceTextureResolution:n}):null,E=d?Z5i({layer:g,circuitJson:t,boardData:e,copperColor:s,traceTextureResolution:n}):null,B=p?J5i({layer:g,circuitJson:t,boardData:e,silkscreenColor:r,traceTextureResolution:n,soldermaskVisible:h}):null,S=p?D5i({layer:g,circuitJson:t,boardData:e,traceTextureResolution:n}):null,w=o?.pcbNotes??!1?G5i({layer:g,circuitJson:t,boardData:e,traceTextureResolution:n}):null,M=a?m5i({layer:g,circuitJson:t,panelData:e,traceTextureResolution:n}):null,k=m?k5i({layer:g,circuitJson:t,boardData:e,traceTextureResolution:n}):null,R=t4i({textures:[I,f,x,E,_,y,B,S,w,M,k],boardData:e,traceTextureResolution:n,layer:g}),F=h&&d?n4i({textures:[f,C],soldermaskTexture:_,boardData:e,traceTextureResolution:n}):null;return{boardTexture:R,maskedCopperTexture:F}},c=e.num_layers??2,l=A("top"),u=c<2?null:A("bottom");return{topBoard:l.boardTexture,bottomBoard:u?.boardTexture??null,topMaskedCopper:l.maskedCopperTexture,bottomMaskedCopper:u?.maskedCopperTexture??null}}var $B={bumpScale:.12,normalScale:.08,roughnessBias:.015,clearcoat:.08,clearcoatRoughness:.55},Lpe={roughness:.42,metalness:.5,roughnessVariance:.035,detailStrength:.028},Hpe=.22,o4i=.7,i4i=.86,Yan={height:Hpe,microSurfaceWeight:1,roughness:.7,metalness:.015,isExposedCopper:!1,isMaskedCopper:!1},r4i={height:o4i,microSurfaceWeight:.9,roughness:.54,metalness:.025,isExposedCopper:!1,isMaskedCopper:!0},Gze=t=>Math.max(0,Math.min(1,t)),Uan=t=>1-t,eZ=(t,e,n)=>{let o=Math.imul(t,374761393)^Math.imul(e,668265263)^n;return o=Math.imul(o^o>>>13,1274126177),((o^o>>>16)>>>0)/4294967295},Kan=t=>t*t*(3-2*t),Yze=(t,e,n)=>t+(e-t)*n,Uze=(t,e,n,o)=>{const i=t/n,r=e/n,s=Math.floor(i),a=Math.floor(r),A=Kan(i-s),c=Kan(r-a),l=Yze(eZ(s,a,o),eZ(s+1,a,o),A),u=Yze(eZ(s,a+1,o),eZ(s+1,a+1,o),A);return Yze(l,u,c)},s4i=(t,e,n)=>{const o=(Uze(t,e,7,n+31)-.5)*.55,i=Math.sin(t*.12+Uze(t,e,44,n+37)*2)*.22;return(o+i)*Lpe.detailStrength},a4i=(t,e,n)=>{const o=(eZ(t,e,n+53)-.5)*.42,i=Math.sin(t*.26+e*.06)*.2+Math.sin(e*.31-t*.04)*.12;return(o+i)*.045},A4i=(t,e,n,o)=>o?r4i:zEi({red:t,green:e,blue:n})?Yan:t>120&&e>70&&n<150&&t>e*1.05&&e>n*1.15?{height:i4i,microSurfaceWeight:.9,roughness:Lpe.roughness,metalness:Lpe.metalness,isExposedCopper:!0,isMaskedCopper:!1}:t>170&&e>170&&n>160?{height:Hpe,microSurfaceWeight:.4,roughness:.76,metalness:0,isExposedCopper:!1,isMaskedCopper:!1}:e>t*1.25&&e>n*1.05&&t<110&&e<180&&n<130?Yan:{height:Hpe,microSurfaceWeight:.7,roughness:.58,metalness:.015,isExposedCopper:!1,isMaskedCopper:!1},Ope=t=>{const e=new Ux(t);return e.colorSpace=_6,e.generateMipmaps=!1,e.minFilter=Fl,e.magFilter=Fl,e.wrapS=Xy,e.wrapT=Xy,e.needsUpdate=!0,e},Van=(t,e)=>{const n=t.image;if(!n?.width||!n.height)return null;const{width:o,height:i}=n,r=n.getContext("2d");if(!r)return null;const s=e?.image,a=s?.getContext("2d"),A=s?.width??0,c=s?.height??0,l=a&&A&&c?a.getImageData(0,0,A,c):null,u=r.getImageData(0,0,o,i),g=u.data,h=new Float32Array(o*i),d=document.createElement("canvas"),p=document.createElement("canvas");d.width=p.width=o,d.height=p.height=i;const m=d.getContext("2d"),_=p.getContext("2d");if(!m||!_)return null;const f=m.createImageData(o,i),I=_.createImageData(o,i),C=f.data,y=I.data;for(let k=0;k<g.length;k+=4){const R=k/4,F=R%o,O=Math.floor(R/o);if((g[k+3]??0)<16){h[R]=Uan(Hpe);continue}const Y=l?Math.min(A-1,Math.floor(F/o*A)):0,W=l?Math.min(c-1,Math.floor(O/i*c)):0,te=l?l.data[(W*A+Y)*4+3]??0:0,j=A4i(g[k]??0,g[k+1]??0,g[k+2]??0,te>=16),J=o+i,oe=j.isExposedCopper?s4i(F,O,J):j.isMaskedCopper?a4i(F,O,J):0,ie=Gze(Uan(j.height)+oe*j.microSurfaceWeight);h[R]=ie;const ne=ie*255;g[k]=g[k+1]=g[k+2]=ne,g[k+3]=255;const ge=(j.isExposedCopper?Gze(j.roughness+oe*.7+(Uze(F,O,36,J+17)-.5)*Lpe.roughnessVariance):j.isMaskedCopper?Gze(j.roughness+oe+$B.roughnessBias):j.roughness)*255;C[k]=C[k+1]=C[k+2]=ge,C[k+3]=255;const _e=j.metalness*255;y[k]=y[k+1]=y[k+2]=_e,y[k+3]=255}m.putImageData(f,0,0),_.putImageData(I,0,0);const x=document.createElement("canvas");x.width=o,x.height=i;const E=x.getContext("2d");if(!E)return null;E.putImageData(u,0,0);const B=document.createElement("canvas");B.width=o,B.height=i;const S=B.getContext("2d");if(!S)return null;const Q=S.createImageData(o,i),w=Q.data,M=(k,R)=>h[Math.max(0,Math.min(i-1,R))*o+Math.max(0,Math.min(o-1,k))]??0;for(let k=0;k<i;k++)for(let R=0;R<o;R++){const F=(M(R+1,k)-M(R-1,k))*4,O=(M(R,k+1)-M(R,k-1))*4,U=1/Math.sqrt(F*F+O*O+1),Y=(k*o+R)*4;w[Y]=(-F*U*.5+.5)*255,w[Y+1]=(-O*U*.5+.5)*255,w[Y+2]=(U*.5+.5)*255,w[Y+3]=255}return S.putImageData(Q,0,0),{bumpMap:Ope(x),normalMap:Ope(B),roughnessMap:Ope(d),metalnessMap:Ope(p)}};function zan(t,e){const{texture:n,maskedCopperMask:o,yOffset:i,isBottomLayer:r,usePolygonOffset:s=!1,renderOrder:a=0,isFaux:A=!1}=t;if(!n)return null;const c=DC(e),l=new VB(c.width,c.height);n.colorSpace=Ox;const u={map:n,transparent:!0,alphaTest:.08,side:mE,depthWrite:!0,polygonOffset:s,polygonOffsetFactor:s?-4:0,polygonOffsetUnits:s?-4:0,opacity:A?Dpe:1},g=Van(n,o),h=new CE({...u,bumpMap:g?.bumpMap??null,bumpScale:$B.bumpScale,normalMap:g?.normalMap??null,normalScale:new ni($B.normalScale,$B.normalScale),roughnessMap:g?.roughnessMap??null,roughness:1,metalnessMap:g?.metalnessMap??null,metalness:1,clearcoat:$B.clearcoat,clearcoatRoughness:$B.clearcoatRoughness,envMapIntensity:.18}),d=new Er(l,h);return d.position.set(c.centerX,c.centerY,i),r&&d.rotation.set(Math.PI,0,0),d.name=`${r?"bottom":"top"}-board-texture-plane`,d.renderOrder=a,p4(d,{castShadow:!1,receiveShadow:!0}),d}function c4i(t,e,n,o=!1){const i=[];if(!t||!e||n===null)return i;const r=.005,s=zan({texture:t.topBoard,maskedCopperMask:t.topMaskedCopper,yOffset:n/2+r,isBottomLayer:!1,usePolygonOffset:!0,renderOrder:1,isFaux:o},e);s&&i.push(s);const a=zan({texture:t.bottomBoard,maskedCopperMask:t.bottomMaskedCopper,yOffset:-n/2-r,isBottomLayer:!0,usePolygonOffset:!0,renderOrder:1,isFaux:o},e);return a&&i.push(a),i}var l4i=4e6,u4i=4096,g4i=1;function Jan(t,e,n={}){const{maxTexturePixels:o=l4i,maxTextureDimension:i=u4i,minTextureResolution:r=g4i}=n,s=DC(t);if(!Number.isFinite(s.width)||!Number.isFinite(s.height)||s.width<=0||s.height<=0)return e;const a=Math.max(s.width,s.height),A=i/a,c=Math.sqrt(o/(s.width*s.height)),l=Math.min(e,A,c);return Math.max(r,l)}function d4i({circuitJson:t,pcbThickness:e,isFaux:n=!1}){const{rootObject:o}=uf(),{visibility:i}=AT(),r=ee.useMemo(()=>{const A=t.filter(u=>u.type==="pcb_panel"),c=Mr(t).pcb_board.list();if(A.length>0){const u=A[0],g=c.find(h=>h.pcb_panel_id===u.pcb_panel_id);return{type:"pcb_board",pcb_board_id:u.pcb_panel_id,center:u.center,width:u.width,height:u.height,thickness:g?.thickness??1.4,material:g?.material??"fr4",num_layers:g?.num_layers??2,solder_mask_color:g?.solder_mask_color}}const l=c.filter(u=>!u.pcb_panel_id);return l.length>0?l[0]:null},[t]),s=ee.useMemo(()=>r?Jan(r,m4):m4,[r]),a=ee.useMemo(()=>!r?.width||!r.height?null:Gan({circuitJson:t,boardData:r,traceTextureResolution:s,visibility:i}),[t,r,s,i]);return ee.useEffect(()=>{if(!o||!r||!a)return;const A=[],c=d=>{const p=["map","alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","lightMap","metalnessMap","normalMap","roughnessMap","specularMap"],m=d;for(const _ of p){const f=m[_];f&&f instanceof Hg&&(f.dispose(),m[_]=null)}d.dispose()},l=({texture:d,maskedCopperMask:p,zOffset:m,isBottomLayer:_,name:f,usePolygonOffset:I=!1,depthWrite:C=!0,renderOrder:y=1})=>{if(!d)return null;const x=DC(r),E=new VB(x.width,x.height);d.colorSpace=Ox;const B={map:d,transparent:!0,alphaTest:.08,side:mE,depthWrite:C,polygonOffset:I,polygonOffsetFactor:I?-4:0,polygonOffsetUnits:I?-4:0,opacity:n?Dpe:1},S=Van(d,p),Q=new CE({...B,bumpMap:S?.bumpMap??null,bumpScale:$B.bumpScale,normalMap:S?.normalMap??null,normalScale:new ni($B.normalScale,$B.normalScale),roughnessMap:S?.roughnessMap??null,roughness:1,metalnessMap:S?.metalnessMap??null,metalness:1,clearcoat:$B.clearcoat,clearcoatRoughness:$B.clearcoatRoughness,envMapIntensity:.18}),w=new Er(E,Q);return w.position.set(x.centerX,x.centerY,m),_&&w.rotation.set(Math.PI,0,0),w.name=f,w.renderOrder=y,w.frustumCulled=!1,p4(w,{castShadow:!1,receiveShadow:!0}),w},u=.005,g=l({texture:a.topBoard,maskedCopperMask:a.topMaskedCopper,zOffset:e/2+u,isBottomLayer:!1,name:"jscad-top-board-texture",usePolygonOffset:!0});g&&(A.push(g),o.add(g));const h=l({texture:a.bottomBoard,maskedCopperMask:a.bottomMaskedCopper,zOffset:-e/2-u,isBottomLayer:!0,name:"jscad-bottom-board-texture",usePolygonOffset:!0});return h&&(A.push(h),o.add(h)),()=>{for(const d of A)if(d.parent===o&&o.remove(d),d.geometry.dispose(),Array.isArray(d.material))for(const p of d.material)c(p);else d.material instanceof Gx&&c(d.material);a.topBoard?.dispose(),a.bottomBoard?.dispose()}},[o,r,a,e]),null}function h4i({stlUrl:t,stlData:e,mtlUrl:n,color:o,opacity:i=1,layerType:r}){const{rootObject:s}=uf(),[a,A]=ee.useState(null);ee.useEffect(()=>{const l=new doi;if(e){try{const u=l.parse(e);A(u)}catch(u){console.error("Failed to parse STL data",u),A(null)}return}t&&l.load(t,u=>{A(u)})},[t,e]);const c=ee.useMemo(()=>{if(!a)return null;const l=r==="board",u=new su({color:Array.isArray(o)?new Vi(o[0],o[1],o[2]):o,transparent:i!==1,opacity:i,polygonOffset:l,polygonOffsetFactor:l?6:0,polygonOffsetUnits:l?6:0}),g=new Er(a,u);return g.renderOrder=l?-1:1,p4(g,{castShadow:!l&&i===1,receiveShadow:!0}),g},[a,o,i,r]);return ee.useEffect(()=>{if(!(!s||!c))return s.add(c),()=>{s.remove(c),c.geometry.dispose(),Array.isArray(c.material)?c.material.forEach(l=>l.dispose()):c.material.dispose()}},[s,c]),null}function p4i({stlData:t,color:e,opacity:n=1,layerType:o}){const{visibility:i}=AT();let r=!0;return o==="board"?r=i.boardBody:o==="top-copper"?r=i.topCopper:o==="bottom-copper"?r=i.bottomCopper:o==="top-silkscreen"?r=i.topSilkscreen:o==="bottom-silkscreen"&&(r=i.bottomSilkscreen),r?K.jsx(h4i,{stlData:t,color:e,opacity:n,layerType:o}):null}function m4i(t){const e=Mr(t).cad_component.list().filter(f=>f.pcb_component_id),n=Mr(t).pcb_smtpad.list(),o=Mr(t).pcb_hole.list(),i=Mr(t).pcb_plated_hole.list(),r=Mr(t).pcb_via.list();if(e.length===0&&n.length===0&&o.length===0&&i.length===0&&r.length===0)return null;const s=[...o,...i,...r,...n],a=H8(s);let A=a.minX,c=a.maxX,l=a.minY,u=a.maxY;for(const f of e)if(f.position){const I=f.position.x,C=f.position.y;A=Math.min(A,I),c=Math.max(c,I),l=Math.min(l,C),u=Math.max(u,C)}A===1/0&&(A=-10,c=10,l=-10,u=10);const g=2,h=Math.max(Math.abs(A),Math.abs(c))+g,d=Math.max(Math.abs(l),Math.abs(u))+g,p=Math.max(2*h,10),m=Math.max(2*d,10);return{type:"pcb_board",pcb_board_id:"faux-board",center:{x:0,y:0},width:p,height:m,thickness:1.4,material:"fr4",num_layers:2}}function Wan(t){if(Mr(t).pcb_board.list().length>0)return t;const n=m4i(t);if(!n)return t;const i=n.thickness/2;return[...t.map(s=>{if(s.type==="cad_component"&&s.pcb_component_id){const a=s;if(a.position){const A=a.position.z??0;return{...a,position:{...a.position,z:A+i}}}}return s}),n]}var _4i=ee.forwardRef(({circuitJson:t,children:e,autoRotateDisabled:n,clickToInteractEnabled:o,onUserInteraction:i,onCameraControllerReady:r,resolveStaticAsset:s,referenceObject:a,hiddenCadComponentIds:A},c)=>{const l=OVe(e),u=ee.useMemo(()=>Wan(t??l),[t,l]),g=l5i(u),h=ee.useMemo(()=>{if(!u)return[5,-5,5];try{const C=Mr(u).pcb_board.list()[0];if(!C)return[5,-5,5];const{width:y,height:x}=C;if(!y&&!x)return[5,-5,5];const E=5,B=Math.max(y,E),S=Math.max(x,E),Q=Math.max(B,S);return[Q*.4,-Q*.7,Q*.9]}catch(C){return console.error(C),[5,-5,5]}},[u]),d=ee.useMemo(()=>{if(!u)return!1;try{const C=Mr(u).pcb_board.list()[0];return!!C&&C.pcb_board_id==="faux-board"}catch{return!1}},[u]),p=ee.useMemo(()=>{if(u)try{const C=Mr(u).pcb_board.list()[0];if(!C)return;const y=DC(C);return{width:y.width,height:y.height}}catch(C){console.error(C);return}},[u]),m=ee.useMemo(()=>{if(u)try{const C=Mr(u).pcb_board.list()[0];if(!C)return;const y=DC(C);return{x:y.centerX,y:y.centerY}}catch(C){console.error(C);return}},[u]),_=wrn(u),{stls:f}=wEi(g),I=Mr(u).cad_component.list().filter(C=>!A?.has(C.cad_component_id));return K.jsxs(San,{ref:c,autoRotateDisabled:n,initialCameraPosition:h,clickToInteractEnabled:o,boardDimensions:p,boardCenter:m,referenceObject:a,onUserInteraction:i,onCameraControllerReady:r,children:[f.map(({stlData:C,color:y,layerType:x},E)=>K.jsx(p4i,{stlData:C,color:y,opacity:E===0?d?.8:.95:1,layerType:x},`board-${E}`)),K.jsx(d4i,{circuitJson:u,pcbThickness:_,isFaux:d}),I.map(C=>K.jsx(vze,{fallback:({error:y})=>K.jsx(Ran,{cad_component:C,error:y}),children:K.jsx(pan,{cad_component:C,circuitJson:u,resolveStaticAsset:s},C.cad_component_id)},C.cad_component_id))]})}),Gpe=new Set,Kze=!1;function f4i(t,e,n=2){const o=t.length;Gpe.size&&Gpe.clear();let i=I4i(t,0,o,n,!0);const r=[];if(!i||i.next===i.prev)return r;let s=0,a=0,A=0;if(t.length>80*n){s=t[0],a=t[1];let c=s,l=a;for(let u=n;u<o;u+=n){const g=t[u],h=t[u+1];g<s&&(s=g),h<a&&(a=h),g>c&&(c=g),h>l&&(l=h)}A=Math.max(c-s,l-a),A=A!==0?32767/A:0}return Vze(i,r,s,a,A),r}function I4i(t,e,n,o,i){let r=null;if(i===P4i(t,e,n,o)>0)for(let s=e;s<n;s+=o)r=$an(s/o|0,t[s],t[s+1],r);else for(let s=n-o;s>=e;s-=o)r=$an(s/o|0,t[s],t[s+1],r);return r&&Wze(r,r.next)&&(oZ(r),r=r.next),r}function Ype(t,e=t){const n=e===t;let o=t,i;do i=!1,o!==o.next&&(Gpe.size===0||!Gpe.has(o))&&(Wze(o,o.next)||l1(o.prev,o,o.next)===0)?((n||o===e)&&(e=o.prev),Kze=!0,oZ(o),o=o.prev,i=!0):(n||o!==e)&&(o=o.next,i=!n);while(i||o!==e);return e}function Vze(t,e,n,o,i){i&&B4i(t,n,o,i);let r=t,s=!1;for(;t.prev!==t.next;){const a=t.prev,A=t.next;if(l1(a,t,A)<0&&(i?y4i(t,n,o,i):C4i(t))){e.push(a.i,t.i,A.i),oZ(t),t=A,r=A;continue}if(t=A,t===r){if(Kze=!1,t=Ype(t),Kze){r=t;continue}if(!s){t=x4i(t,e),r=t,s=!0;continue}E4i(t,e,n,o,i);break}}}function C4i(t){const e=t.prev,n=t,o=t.next,i=e.x,r=n.x,s=o.x,a=e.y,A=n.y,c=o.y,l=Math.min(i,r,s),u=Math.min(a,A,c),g=Math.max(i,r,s),h=Math.max(a,A,c);let d=o.next;for(;d!==e;){if(d.x>=l&&d.x<=g&&d.y>=u&&d.y<=h&&!(i===d.x&&a===d.y)&&Jze(i,a,r,A,s,c,d.x,d.y)&&l1(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function y4i(t,e,n,o){const i=t.prev,r=t,s=t.next,a=i.x,A=r.x,c=s.x,l=i.y,u=r.y,g=s.y,h=Math.min(a,A,c),d=Math.min(l,u,g),p=Math.max(a,A,c),m=Math.max(l,u,g),_=zze(h,d,e,n,o),f=zze(p,m,e,n,o);let I=t.prevZ;for(;I&&I.z>=_;){if(I.x>=h&&I.x<=p&&I.y>=d&&I.y<=m&&I!==s&&!(a===I.x&&l===I.y)&&Jze(a,l,A,u,c,g,I.x,I.y)&&l1(I.prev,I,I.next)>=0)return!1;I=I.prevZ}let C=t.nextZ;for(;C&&C.z<=f;){if(C.x>=h&&C.x<=p&&C.y>=d&&C.y<=m&&C!==s&&!(a===C.x&&l===C.y)&&Jze(a,l,A,u,c,g,C.x,C.y)&&l1(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function x4i(t,e){let n=t,o=!1;do{const i=n.prev,r=n.next.next;jan(i,n,n.next,r,!1)&&Vpe(i,r)&&Vpe(r,i)&&(e.push(i.i,n.i,r.i),oZ(n),oZ(n.next),n=t=r,o=!0),n=n.next}while(n!==t);return o?Ype(n):n}function E4i(t,e,n,o,i){let r=t;do{let s=r.next.next;for(;s!==r.prev;){if(r.i!==s.i&&S4i(r,s)){let a=w4i(r,s);r=Ype(r,r.next),a=Ype(a,a.next),Vze(r,e,n,o,i),Vze(a,e,n,o,i);return}s=s.next}r=r.next}while(r!==t)}var BE=[],$Y=[],hT=new Uint32Array(0),tZ=new Uint32Array(0),nZ=new Uint32Array(256);function B4i(t,e,n,o){let i=t,r=0;do i.z=zze(i.x,i.y,e,n,o),BE[r++]=i,i=i.next;while(i!==t);b4i(r);let s=null;for(let a=0;a<r;a++){const A=BE[a];A.prevZ=s,s&&(s.nextZ=A),s=A}s.nextZ=null,BE.fill(null,0,r),$Y.fill(null,0,r)}function b4i(t){if(t<=32){for(let e=1;e<t;e++){const n=BE[e],o=n.z;let i=e-1;for(;i>=0&&BE[i].z>o;)BE[i+1]=BE[i],i--;BE[i+1]=n}return}hT.length<t&&(hT=new Uint32Array(t),tZ=new Uint32Array(t),$Y=new Array(t));for(let e=0;e<t;e++)hT[e]=BE[e].z;Upe(t,BE,hT,$Y,tZ,0),Upe(t,$Y,tZ,BE,hT,8),Upe(t,BE,hT,$Y,tZ,16),Upe(t,$Y,tZ,BE,hT,24)}function Upe(t,e,n,o,i,r){nZ.fill(0);for(let a=0;a<t;a++)nZ[n[a]>>>r&255]++;let s=0;for(let a=0;a<256;a++){const A=nZ[a];nZ[a]=s,s+=A}for(let a=0;a<t;a++){const A=n[a],c=nZ[A>>>r&255]++;o[c]=e[a],i[c]=A}}function zze(t,e,n,o,i){return t=(t-n)*i|0,e=(e-o)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Jze(t,e,n,o,i,r,s,a){return(i-s)*(e-a)>=(t-s)*(r-a)&&(t-s)*(o-a)>=(n-s)*(e-a)&&(n-s)*(r-a)>=(i-s)*(o-a)}function S4i(t,e){const n=Wze(t,e)&&l1(t.prev,t,t.next)>0&&l1(e.prev,e,e.next)>0;return t.next.i!==e.i&&(n||Vpe(t,e)&&Vpe(e,t)&&(l1(t.prev,t,e.prev)!==0||l1(t,e.prev,e)!==0))&&!Q4i(t,e)&&(n||v4i(t,e))}function l1(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Wze(t,e){return t.x===e.x&&t.y===e.y}function jan(t,e,n,o,i=!0){const r=l1(t,e,n),s=l1(t,e,o),a=l1(n,o,t),A=l1(n,o,e);return(r>0&&s<0||r<0&&s>0)&&(a>0&&A<0||a<0&&A>0)?!0:i?!!(r===0&&Kpe(t,n,e)||s===0&&Kpe(t,o,e)||a===0&&Kpe(n,t,o)||A===0&&Kpe(n,e,o)):!1}function Kpe(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Q4i(t,e){const n=Math.min(t.x,e.x),o=Math.max(t.x,e.x),i=Math.min(t.y,e.y),r=Math.max(t.y,e.y);let s=t;do{const a=s.next;if(s.x>o&&a.x>o||s.x<n&&a.x<n||s.y>r&&a.y>r||s.y<i&&a.y<i){s=a;continue}if(s.i!==t.i&&a.i!==t.i&&s.i!==e.i&&a.i!==e.i&&jan(s,a,t,e))return!0;s=a}while(s!==t);return!1}function Vpe(t,e){return l1(t.prev,t,t.next)<0?l1(t,e,t.next)>=0&&l1(t,t.prev,e)>=0:l1(t,e,t.prev)<0||l1(t,t.next,e)<0}function v4i(t,e){let n=t,o=!1;const i=(t.x+e.x)/2,r=(t.y+e.y)/2;do{const s=n.next;n.y>r!=s.y>r&&i<(s.x-n.x)*(r-n.y)/(s.y-n.y)+n.x&&(o=!o),n=s}while(n!==t);return o}function w4i(t,e){const n=jze(t.i,t.x,t.y),o=jze(e.i,e.x,e.y),i=t.next,r=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,o.next=n,n.prev=o,r.next=o,o.prev=r,o}function $an(t,e,n,o){const i=jze(t,e,n);return o?(i.next=o.next,i.prev=o,o.next.prev=i,o.next=i):(i.prev=i,i.next=i),i}function oZ(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function jze(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function P4i(t,e,n,o){let i=0;for(let r=e,s=n-o;r<n;r+=o)i+=(t[s]-t[r])*(t[r+1]+t[s+1]),s=r;return i}var pT=1e-7;function qan(t,e){if(!Number.isFinite(e)||e<0)throw new Error("Board thickness must be finite and nonnegative");const n=t.map(a=>{const{start:A,end:c,bend_angle:l,bend_radius:u}=a;if([A?.x,A?.y,c?.x,c?.y,l,u].some(C=>!Number.isFinite(C))||u<=e/2||!["left","right"].includes(a.bend_side))throw new Error(`Invalid PCB bend ${a.pcb_bend_id}: finite geometry and radius greater than half the board thickness are required`);const h=Math.hypot(c.x-A.x,c.y-A.y);if(h<pT||Math.abs(l)>180)throw new Error(`Unsupported PCB bend ${a.pcb_bend_id}: distinct endpoints and angles within ±180 degrees are required`);const d=a.bend_side==="right"?1:-1,p=d*(c.y-A.y)/h,m=-d*(c.x-A.x)/h,_=l*Math.PI/180,f=u*Math.abs(_),I=A.x*p+A.y*m;return{id:a.pcb_bend_id,nx:p,ny:m,start:I-f/2,end:I+f/2,angle:_,radius:u,axisMin:Math.min(-m*A.x+p*A.y,-m*c.x+p*c.y),axisMax:Math.max(-m*A.x+p*A.y,-m*c.x+p*c.y)}}).filter(a=>Math.abs(a.angle)>pT),o=n[0];if(o&&n.some(a=>Math.abs(a.nx-o.nx)>pT||Math.abs(a.ny-o.ny)>pT))throw new Error("Folded PCB rendering currently requires parallel bends with the same moving direction");n.sort((a,A)=>a.start-A.start);for(let a=1;a<n.length;a++)if(n[a].start<n[a-1].end-pT)throw new Error("Overlapping PCB bend zones are not supported");const i=[...n].reverse(),r=({p:a,anchor:A,direction:c})=>{let l={...a};for(const u of i){const g=u.end-u.start,h=A.x*u.nx+A.y*u.ny-u.start,d=Math.max(0,Math.min(g,h)),p=u.angle*d/g,m=Math.cos(p),_=Math.sin(p),f=l.x*u.nx+l.y*u.ny-(c?0:u.start),I=l.x-(f+(c?0:u.start))*u.nx,C=l.y-(f+(c?0:u.start))*u.ny,y=Math.sign(u.angle)*u.radius,x=c?0:y*_-d*m,E=c?0:y*(1-m)-d*_,B=f*m-l.z*_+x;l={x:I+(B+(c?0:u.start))*u.nx,y:C+(B+(c?0:u.start))*u.ny,z:f*_+l.z*m+E}}return l},s=({p:a,anchor:A,direction:c})=>{const l=c?{x:0,y:0,z:0}:r({p:{x:0,y:0,z:0},anchor:A,direction:!1}),u={x:a.x-l.x,y:a.y-l.y,z:a.z-l.z},g=[{x:1,y:0,z:0},{x:0,y:1,z:0},{x:0,y:0,z:1}].map(d=>r({p:d,anchor:A,direction:!0})),h=d=>d.x*u.x+d.y*u.y+d.z*u.z;return{x:h(g[0]),y:h(g[1]),z:h(g[2])}};return{bends:n,inversePoint:(a,A)=>s({p:a,anchor:A,direction:!1}),inverseDirection:(a,A)=>s({p:a,anchor:A,direction:!0}),point:(a,A=a)=>r({p:a,anchor:A,direction:!1}),direction:(a,A)=>r({p:a,anchor:A,direction:!0}),assertRigid(a,A){for(const c of n){const l=a.map(u=>u.x*c.nx+u.y*c.ny);if(Math.max(...l)>c.start+pT&&Math.min(...l)<c.end-pT)throw new Error(`${A} intersects PCB bend zone ${c.id}`)}}}}var qB=1e-7;function iZ(t){const e=t.flatMap(i=>i.vertices);if(!e.length)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}};const n={x:1/0,y:1/0,z:1/0},o={x:-1/0,y:-1/0,z:-1/0};for(const i of e)for(const r of["x","y","z"])n[r]=Math.min(n[r],i[r]),o[r]=Math.max(o[r],i[r]);return{min:n,max:o}}function Xan(t,e){const n=e.bends.flatMap(a=>{const A=Math.ceil(Math.abs(a.angle)/(Math.PI/36));return Array.from({length:A+1},(c,l)=>({b:a,d:a.start+(a.end-a.start)*l/A}))}),{min:o,max:i}=t.boundingBox,r=({polygon:a,nx:A,ny:c,d:l})=>{const u=a.map(({p:h})=>A*h.x+c*h.y-l);if(Math.min(...u)>=-qB||Math.max(...u)<=qB)return[a];const g=[[],[]];for(let h=0;h<2;h++){const d=h===0?1:-1;for(let p=0;p<a.length;p++){const m=a[p],_=(p+1)%a.length,f=a[_],I=u[p]*d,C=u[_]*d;if(I>=-qB&&g[h].push(m),I>qB&&C<-qB||I<-qB&&C>qB){const y=I/(I-C);g[h].push({p:{x:m.p.x+(f.p.x-m.p.x)*y,y:m.p.y+(f.p.y-m.p.y)*y,z:m.p.z+(f.p.z-m.p.z)*y},uv:{u:m.uv.u+(f.uv.u-m.uv.u)*y,v:m.uv.v+(f.uv.v-m.uv.v)*y}})}}}return g.filter(h=>h.length>=3)},s=[];for(const a of t.triangles){const A=a.pcbFace??(a.normal.z>.8?"top":a.normal.z<-.8?"bottom":"side");let c=[a.vertices.map((l,u)=>({p:l,uv:a.uvs?.[u]??{u:(l.x-o.x)/(i.x-o.x),v:1-(l.y-o.y)/(i.y-o.y)}}))];for(const{b:l,d:u}of n)c=c.flatMap(g=>r({polygon:g,nx:l.nx,ny:l.ny,d:u}));for(const l of c){for(const u of e.bends){const g=l.reduce((h,{p:d})=>h+d.x*u.nx+d.y*u.ny,0)/l.length;if(g>u.start+qB&&g<u.end-qB&&l.some(({p:h})=>{const d=-u.ny*h.x+u.nx*h.y;return d<u.axisMin-qB||d>u.axisMax+qB}))throw new Error(`PCB bend ${u.id} must span the full board cross-section through its bend zone`)}for(let u=1;u+1<l.length;u++){const g=[l[0],l[u],l[u+1]],h=g.map(({p:y})=>e.point(y)),[d,p,m]=h,_={x:p.x-d.x,y:p.y-d.y,z:p.z-d.z},f={x:m.x-d.x,y:m.y-d.y,z:m.z-d.z},I={x:_.y*f.z-_.z*f.y,y:_.z*f.x-_.x*f.z,z:_.x*f.y-_.y*f.x},C=Math.hypot(I.x,I.y,I.z);C<1e-12||s.push({...a,vertices:h,normal:{x:I.x/C,y:I.y/C,z:I.z/C},pcbFace:A,uvs:g.map(({uv:y})=>y)})}}}return{...t,triangles:s,boundingBox:iZ(s)}}var M4i=[{x:1,y:0,z:0},{x:0,y:1,z:0},{x:0,y:0,z:1}];function D4i(t,e){const[n,o,i]=[e.x,e.y,e.z].map(a=>a*Math.PI/180),r={x:Math.cos(i)*t.x-Math.sin(i)*t.y,y:Math.sin(i)*t.x+Math.cos(i)*t.y,z:t.z},s={x:Math.cos(o)*r.x+Math.sin(o)*r.z,y:r.y,z:-Math.sin(o)*r.x+Math.cos(o)*r.z};return{x:s.x,y:Math.cos(n)*s.y-Math.sin(n)*s.z,z:Math.sin(n)*s.y+Math.cos(n)*s.z}}function N4i([t,e,n]){const o=Math.asin(Math.max(-1,Math.min(1,n.x))),i=Math.abs(n.x)<1-1e-12;return{x:(i?Math.atan2(-n.y,n.z):Math.atan2(e.z,e.y))*180/Math.PI,y:o*180/Math.PI,z:(i?Math.atan2(-e.x,t.x):0)*180/Math.PI}}function R4i({cadComponent:t,foldPcbs:e},n){return T4i({cadComponentPlacement:t,foldPcbs:e},n)}function T4i({cadComponentPlacement:t,foldPcbs:e},n){if(t.is_on_folded_board===!0===e)return t;const{fold:o,boardCenter:i,flatMount:r}=n,s={x:r.x-i.x,y:r.y-i.y,z:0};o.assertRigid([s],"CAD mount");const a={x:t.position.x-i.x,y:t.position.y-i.y,z:t.position.z},A=e?o.direction:o.inverseDirection,c=e?o.point(a,s):o.inversePoint(a,s),l=t.rotation??n.defaultRotation??{x:0,y:0,z:0},u=M4i.map(g=>A(D4i(g,l),s));return{...t,position:{x:c.x+i.x,y:c.y+i.y,z:c.z},rotation:N4i(u),is_on_folded_board:e}}function k4i(t,e){const n=e.find(A=>A.type==="pcb_component"&&A.pcb_component_id===t.pcb_component_id);if(n?.type!=="pcb_component"){if(t.is_on_folded_board)throw new Error(`Folded CAD ${t.cad_component_id} requires its flat pcb_component reference`);return}const o=e.filter(A=>A.type==="pcb_board"),i=n.positioned_relative_to_pcb_board_id,r=i?o.filter(A=>A.pcb_board_id===i):o.filter(A=>A.subcircuit_id&&A.subcircuit_id===n.subcircuit_id),s=r.length===1?r[0]:!i&&!r.length&&o.length===1?o[0]:void 0;if(!s)throw new Error(`Cannot unambiguously resolve board for CAD ${t.cad_component_id}`);const a=e.filter(A=>A.type==="pcb_bend"&&A.pcb_board_id===s.pcb_board_id);return{fold:qan(a,s.thickness??1.6),boardCenter:s.center,flatMount:n.center,defaultRotation:{x:(t.layer??n.layer)==="bottom"?180:0,y:0,z:0}}}function F4i(t,e){const n=t.some(o=>o.type==="pcb_bend");return t.map(o=>{if(o.type!=="cad_component")return o;const i=o;if(!n&&!i.is_on_folded_board||i.is_on_folded_board===!0===e.foldPcbs)return o;const r=k4i(i,t);return!r||!r.fold.bends.length&&!i.is_on_folded_board?o:R4i({cadComponent:i,foldPcbs:e.foldPcbs},r)})}function L4i({outline:t,bottom:e,top:n}){if(t.length<3||!Number.isFinite(e)||!Number.isFinite(n)||n<=e||t.some(A=>!Number.isFinite(A.x)||!Number.isFinite(A.y)))throw new Error("A finite polygon and positive extrusion thickness are required");let o=0;for(const[A,c]of t.entries()){const l=t[(A+1)%t.length];o+=c.x*l.y-l.x*c.y}if(Math.abs(o)<1e-12)throw new Error("Degenerate polygon");const i=o>0?t:[...t].reverse(),r=[],s=({a:A,b:c,c:l,pcbFace:u})=>{const g={x:c.x-A.x,y:c.y-A.y,z:c.z-A.z},h={x:l.x-A.x,y:l.y-A.y,z:l.z-A.z},d={x:g.y*h.z-g.z*h.y,y:g.z*h.x-g.x*h.z,z:g.x*h.y-g.y*h.x},p=Math.hypot(d.x,d.y,d.z);p>1e-12&&r.push({vertices:[A,c,l],normal:{x:d.x/p,y:d.y/p,z:d.z/p},pcbFace:u})},a=f4i(i.flatMap(A=>[A.x,A.y]));for(let A=0;A<a.length;A+=3){const[c,l,u]=a.slice(A,A+3).map(g=>i[g]);s({a:{...c,z:n},b:{...l,z:n},c:{...u,z:n},pcbFace:"top"}),s({a:{...u,z:e},b:{...l,z:e},c:{...c,z:e},pcbFace:"bottom"})}for(let A=0;A<i.length;A++){const c=i[A],l=i[(A+1)%i.length];s({a:{...c,z:e},b:{...l,z:e},c:{...l,z:n},pcbFace:"side"}),s({a:{...c,z:e},b:{...l,z:n},c:{...c,z:n},pcbFace:"side"})}return{triangles:r,boundingBox:iZ(r)}}function H4i({stiffener:t,boardThickness:e,fold:n}){const o=t.adhesive_thickness??0;if(!Number.isFinite(o)||o<0||!Number.isFinite(t.thickness)||t.thickness<=0||!["top","bottom"].includes(t.layer))throw new Error(`Invalid PCB stiffener ${t.pcb_stiffener_id}`);const i=t.shape==="polygon"?t.outline:(()=>{if(!(t.width>0&&t.height>0))throw new Error("Invalid stiffener dimensions");const l=(t.rotation??0)*Math.PI/180;return[[-1,-1],[1,-1],[1,1],[-1,1]].map(([u,g])=>({x:t.center.x+u*t.width/2*Math.cos(l)-g*t.height/2*Math.sin(l),y:t.center.y+u*t.width/2*Math.sin(l)+g*t.height/2*Math.cos(l)}))})(),r=e/2+o,s=r+t.thickness,a=L4i({outline:i,bottom:t.layer==="top"?r:-s,top:t.layer==="top"?s:-r});if(!n)return a;n.assertRigid(a.triangles.flatMap(l=>l.vertices),t.pcb_stiffener_id);const A={x:i.reduce((l,u)=>l+u.x,0)/i.length,y:i.reduce((l,u)=>l+u.y,0)/i.length,z:0},c=a.triangles.map(l=>({...l,vertices:l.vertices.map(u=>n.point(u,A)),normal:n.direction(l.normal,A)}));return{...a,triangles:c,boundingBox:iZ(c)}}function Zan(t,e){t.updateMatrix();const n=t.geometry.index?t.geometry.toNonIndexed():t.geometry,o=n.getAttribute("position"),i=n.getAttribute("uv"),r=[];for(let s=0;s<o.count;s+=3){const a=[0,1,2].map(g=>{const h=new jt().fromBufferAttribute(o,s+g).applyMatrix4(t.matrix);return{x:h.x-e.x,y:h.y-e.y,z:h.z}}),[A,c,l]=a,u=new jt(c.x-A.x,c.y-A.y,c.z-A.z).cross(new jt(l.x-A.x,l.y-A.y,l.z-A.z)).normalize();r.push({vertices:a,normal:{x:u.x,y:u.y,z:u.z},...i?{uvs:[0,1,2].map(g=>({u:i.getX(s+g),v:i.getY(s+g)}))}:{}})}return n!==t.geometry&&n.dispose(),{triangles:r,boundingBox:iZ(r)}}function eAn(t,e){const n=[],o=[],i=[];for(const s of t.triangles)s.vertices.forEach((a,A)=>{n.push(a.x+e.x,a.y+e.y,a.z),o.push(s.normal.x,s.normal.y,s.normal.z),i.push(s.uvs?.[A]?.u??0,s.uvs?.[A]?.v??0)});const r=new Zl;return r.setAttribute("position",new Bs(n,3)),r.setAttribute("normal",new Bs(o,3)),r.setAttribute("uv",new Bs(i,2)),r.computeBoundingBox(),r.computeBoundingSphere(),r}function tAn(t,e,n){const o=t.clone();return o.geometry=eAn(e,n.center),o.position.set(0,0,0),o.rotation.set(0,0,0),o.scale.set(1,1,1),o.updateMatrix(),o}function O4i(t,e,n,o){const i=n.filter(d=>d.type==="pcb_board"),r=n.filter(d=>d.type==="pcb_bend"),s=n.filter(d=>d.type==="pcb_stiffener");if(!r.length&&!s.length)return{geometryMeshes:t,textureMeshes:e};const a=i[0];if(!a||i.length!==1||n.some(d=>d.type==="pcb_panel")||[...r,...s].some(d=>d.pcb_board_id!==a.pcb_board_id))throw new Error("Flex rendering requires one board, matching board references, and no panel");const A=o?qan(r,a.thickness??1.6):void 0,c=t.find(d=>d.name==="board-geom"),l=c?Zan(c,a.center):void 0,u=A?t.map(d=>tAn(d,Xan(Zan(d,a.center),A),a)):[...t],g=A&&l?e.map(d=>{d.updateMatrix();const p=d.matrix.clone().invert(),m=d.name.startsWith("bottom"),_=d.geometry.parameters,f=l.triangles.filter(C=>m?C.normal.z<-.9:C.normal.z>.9).map(C=>{const y=C.vertices.map(E=>({...E,z:d.position.z})),x=y.map(E=>{const B=new jt(E.x+a.center.x,E.y+a.center.y,E.z).applyMatrix4(p);return{u:B.x/_.width+.5,v:B.y/_.height+.5}});return{...C,vertices:y,uvs:x}}),I=tAn(d,Xan({triangles:f,boundingBox:iZ(f)},A),a);return d.geometry.dispose(),I}):e;for(const d of s){const p=new Er(eAn(H4i({stiffener:d,boardThickness:a.thickness??1.6,fold:A}),a.center),new su({color:d.material==="fr4"?"#879568":d.material==="polyimide"?"#bd7f27":"#b8bdc4",side:r_}));p.name="board-stiffener",p4(p),u.push(p)}const h=new e2;for(const d of[...u,...g])h.expandByObject(d);return{geometryMeshes:u,textureMeshes:g,bounds:{minX:h.min.x,maxX:h.max.x,minY:h.min.y,maxY:h.max.y,minZ:h.min.z,maxZ:h.max.z}}}var G4i=t=>{let e=0;for(let o=0;o<t.length;o++){const i=(o+1)%t.length;t[o]&&t[i]&&(e+=t[o][0]*t[i][1],e-=t[i][0]*t[o][1])}return e/2<=0};function Y4i(t,e,n,o,i){let r,s=null;if(n.outline&&n.outline.length>=3){let a=n.outline.map(c=>[c.x,c.y]);G4i(a)&&(a=a.reverse());const A=e.ofPolygons([a]);i.push(A),s=A,r=t.extrude(A,o,void 0,void 0,void 0,!0),i.push(r)}else n.outline&&n.outline.length>0&&console.warn("Board outline has fewer than 3 points, falling back to rectangular board."),r=t.cube([n.width,n.height,o],!0),i.push(r),r=r.translate([n.center.x,n.center.y,0]),i.push(r);return{boardOp:r,outlineCrossSection:s}}var U4i=64;function mT({Manifold:t,width:e,height:n,thickness:o,borderRadius:i}){const r=Man(e,n,i);if(r<=0)return t.cube([e,n,o],!0);const s=[],a=e-2*r,A=n-2*r;return a>0&&s.push(t.cube([a,n,o],!0)),A>0&&s.push(t.cube([e,A,o],!0)),[[e/2-r,n/2-r],[-e/2+r,n/2-r],[-e/2+r,-n/2+r],[e/2-r,-n/2+r]].forEach(([l,u])=>{s.push(t.cylinder(o,r,r,U4i,!0).translate([l,u,0]))}),t.union(s)}var K4i=t=>{let e=0;for(let o=0;o<t.length;o++){const i=(o+1)%t.length;t[o]&&t[i]&&(e+=t[o][0]*t[i][1],e-=t[i][0]*t[o][1])}return e/2<=0};function V4i(t,e,n,o,i){const r=[],s=Mr(n).pcb_cutout.list();for(const a of s){let A;const c=o*1.5;switch(a.shape){case"rect":{const g=IP(a);if(typeof g=="number"&&g>0?A=mT({Manifold:t,width:a.width,height:a.height,thickness:c,borderRadius:g}):A=t.cube([a.width,a.height,c],!0),i.push(A),a.rotation){const h=A.rotate([0,0,a.rotation]);i.push(h),A=h}A=A.translate([a.center.x,a.center.y,0]),i.push(A);break}case"circle":A=t.cylinder(c,a.radius,-1,df,!0),i.push(A),A=A.translate([a.center.x,a.center.y,0]),i.push(A);break;case"polygon":if(a.points.length<3){console.warn(`PCB Cutout [${a.pcb_cutout_id}] polygon has fewer than 3 points, skipping.`);continue}let l=a.points.map(g=>[g.x,g.y]);K4i(l)&&(l=l.reverse());const u=e.ofPolygons([l]);i.push(u),A=t.extrude(u,c,0,0,[1,1],!0),i.push(A);break;default:console.warn(`Unsupported cutout shape: ${a.shape} for cutout ${a.pcb_cutout_id}`);continue}A&&r.push(A)}return{cutoutOps:r}}function nAn({Manifold:t,x:e,y:n,diameter:o,thickness:i,segments:r=32}){return t.cylinder(i*1.2,o/2,o/2,r,!0).translate([e,n,0])}function oAn({Manifold:t,x:e,y:n,holeDiameter:o,thickness:i,zOffset:r=.001,segments:s=32}){const a=o/2+r;return t.cylinder(i*1.2,a,a,s,!0).translate([e,n,0])}function z4i(t,e,n,o,i){const r=[],s=Mr(n).pcb_hole.list(),a=(l,u,g)=>{const h=mT({Manifold:t,width:l,height:u,thickness:g,borderRadius:Math.min(l,u)/2});return i.push(h),h},A=(l,u,g)=>{const h=t.cube([l,u,g],!0);return i.push(h),h},c=(l,u,g)=>{const h=[];for(let d=0;d<g;d++){const p=2*Math.PI*d/g;h.push([l/2*Math.cos(p),u/2*Math.sin(p)])}return h};for(const l of s){const u=l.hole_shape,g=l.x,h=l.y,d=o*1.2,p=l.ccw_rotation??l.rotation??0,m=l.hole_width??l.hole_diameter,_=l.hole_height??l.hole_diameter;let f=null;if(u==="circle"){f=nAn({Manifold:t,x:g,y:h,diameter:l.hole_diameter,thickness:o,segments:df}),r.push(f),i.push(f);continue}if(u==="pill"||u==="rotated_pill")f=a(m,_,d);else if(u==="rect")f=A(m,_,d);else if(u==="oval"){let I=c(m,_,df),C=0;for(let x=0;x<I.length;x++){const E=(x+1)%I.length;C+=I[x][0]*I[E][1],C-=I[E][0]*I[x][1]}C<=0&&(I=I.reverse());const y=e.ofPolygons([I]);i.push(y),f=t.extrude(y,d,0,0,[1,1],!0),i.push(f)}if(f){if(p!==0){const C=f.rotate([0,0,p]);i.push(C),f=C}const I=f.translate([g,h,0]);i.push(I),r.push(I)}}return{nonPlatedHoleBoardDrills:r}}function D6(t){const e=new Zl;if(e.setAttribute("position",new Bs(t.vertProperties,3)),e.setIndex(new xTe(t.triVerts,1)),t.runIndex&&t.runIndex.length>1&&t.runOriginalID)for(let n=0;n<t.runIndex.length-1;n++){const o=t.runIndex[n],i=t.runIndex[n+1]-o;e.addGroup(o,i,0)}else e.addGroup(0,t.triVerts.length,0);return e}var rZ=t=>{let e=0;for(let o=0;o<t.length;o++){const i=(o+1)%t.length;t[o]&&t[i]&&(e+=t[o][0]*t[i][1],e-=t[i][0]*t[o][1])}return e/2<=0},zpe=(t,e,n)=>{const o=[];for(let i=0;i<n;i++){const r=2*Math.PI*i/n;o.push([t/2*Math.cos(r),e/2*Math.sin(r)])}return o},_T=new Vi(...Tc.copper),Jpe=.05,sZ=.003,aZ=5e-4,AZ=.004;function J4i(t,e,n,o,i,r){const s=[],a=Mr(n).pcb_plated_hole.list(),A=[],c=[],l=(d,p,m)=>{const _=mT({Manifold:t,width:d,height:p,thickness:m,borderRadius:Math.min(d,p)/2});return i.push(_),_},u=({padOutline:d,thickness:p})=>{if(!Array.isArray(d)||d.length<3)return null;let m=d.map(I=>[I.x,I.y]);rZ(m)&&(m=m.reverse());const _=e.ofPolygons([m]);i.push(_);const f=t.extrude(_,p,0,0,[1,1],!0);return i.push(f),f},g=({ph:d,depth:p,sizeDelta:m=0})=>{if(d.shape!=="hole_with_polygon_pad")return null;const f=d.pad_outline;if(!Array.isArray(f)||f.length<3)return null;const I=d.hole_shape||"circle",C=d.hole_offset_x||0,y=d.hole_offset_y||0;let x=null;if(I==="circle"){const E=Math.max((d.hole_diameter??0)+m,Cs),B=Math.max(E/2,Cs/2);x=t.cylinder(p,B,B,df,!0),i.push(x)}else{const E=d.hole_width??d.hole_diameter,B=d.hole_height??d.hole_diameter;if(!E||!B)return null;const S=Math.max(E+m,Cs),Q=Math.max(B+m,Cs);if(I==="oval"){let w=zpe(S,Q,df);rZ(w)&&(w=w.reverse());const M=e.ofPolygons([w]);i.push(M),x=t.extrude(M,p,0,0,[1,1],!0),i.push(x)}else(I==="pill"||I==="rotated_pill")&&(x=mT({Manifold:t,width:S,height:Q,thickness:p,borderRadius:Math.min(S,Q)/2}),i.push(x))}if(!x)return null;if(C||y){const E=x.translate([C,y,0]);i.push(E),x=E}return x};a.forEach((d,p)=>{const m=Math.max(o-2*(sZ+aZ+AZ),Cs);if(d.shape==="circle"){const _=oAn({Manifold:t,x:d.x,y:d.y,holeDiameter:d.hole_diameter*1.02,thickness:o,zOffset:jB,segments:df});i.push(_),s.push(_);const f=m,I=t.cylinder(f,d.outer_diameter/2,d.outer_diameter/2,df,!0);i.push(I);const C=t.cylinder(f*1.05,d.hole_diameter/2,d.hole_diameter/2,df,!0);i.push(C);const y=I.subtract(C);i.push(y);const x=y.translate([d.x,d.y,0]);i.push(x);let E=x;if(r){const S=t.intersection([x,r]);i.push(S),E=S}c.push(E);const B=D6(E.getMesh());A.push({key:`ph-${d.pcb_plated_hole_id||p}`,geometry:B,color:_T})}else if(d.shape==="pill"){const _=d.hole_width,f=d.hole_height,I=.4,C=d.outer_width??_+I,y=d.outer_height??f+I,x=_+2*jB,E=f+2*jB,B=o*1.2;let S=l(x,E,B);if(d.ccw_rotation){const Y=S.rotate([0,0,d.ccw_rotation]);i.push(Y),S=Y}const Q=S.translate([d.x,d.y,0]);i.push(Q),s.push(Q);const w=m,M=l(C,y,w),k=l(_,f,w*1.05);let R=M.subtract(k);if(i.push(R),d.ccw_rotation){const Y=R.rotate([0,0,d.ccw_rotation]);i.push(Y),R=Y}const F=R.translate([d.x,d.y,0]);i.push(F);let O=F;if(r){const Y=t.intersection([F,r]);i.push(Y),O=Y}c.push(O);const U=D6(O.getMesh());A.push({key:`ph-${d.pcb_plated_hole_id||p}`,geometry:U,color:_T})}else if(d.shape==="pill_hole_with_rect_pad"){if(d.hole_shape&&d.hole_shape!=="pill"||d.pad_shape&&d.pad_shape!=="rect")return;const _=d.hole_width,f=d.hole_height,I=d.hole_offset_x||0,C=d.hole_offset_y||0,y=d.rect_pad_width,x=d.rect_pad_height,E=IP(d),B=sZ,S=_+2*jB,Q=f+2*jB,w=o*1.2,k=l(S,Q,w).translate([I,C,0]).translate([d.x,d.y,0]);i.push(k),s.push(k);const R=mT({Manifold:t,width:y,height:x,thickness:Math.max(o-2*(B+aZ+AZ),Cs),borderRadius:E});i.push(R);const F=l(_,f,o*.8).translate([I,C,0]);i.push(F);const O=t.union([R,F]);i.push(O);const U=l(Math.max(_-2*Jpe,.01),Math.max(f-2*Jpe,.01),o*1.2).translate([I,C,0]);i.push(U);const Y=O.subtract(U);i.push(Y);const W=Y.translate([d.x,d.y,0]);i.push(W);let te=W;if(r){const J=t.intersection([W,r]);i.push(J),te=J}c.push(te);const j=D6(te.getMesh());A.push({key:`ph-${d.pcb_plated_hole_id||p}`,geometry:j,color:_T})}else if(d.shape==="rotated_pill_hole_with_rect_pad"){if(d.hole_shape&&d.hole_shape!=="rotated_pill"||d.pad_shape&&d.pad_shape!=="rect")return;const _=d.hole_width,f=d.hole_height,I=d.hole_offset_x||0,C=d.hole_offset_y||0,y=d.rect_pad_width,x=d.rect_pad_height,E=IP(d),B=sZ,S=_+2*jB,Q=f+2*jB,w=o*1.2;let M=l(S,Q,w).translate([I,C,0]);if(d.hole_ccw_rotation){const J=M.rotate([0,0,d.hole_ccw_rotation]);i.push(J),M=J}const k=M.translate([d.x,d.y,0]);i.push(k),s.push(k);let R=mT({Manifold:t,width:y,height:x,thickness:Math.max(o-2*(B+aZ+AZ),Cs),borderRadius:E});if(i.push(R),d.rect_ccw_rotation){const J=R.rotate([0,0,d.rect_ccw_rotation]);i.push(J),R=J}let F=l(_,f,o*.8).translate([I,C,0]);if(d.hole_ccw_rotation){const J=F.rotate([0,0,d.hole_ccw_rotation]);i.push(J),F=J}i.push(F);const O=t.union([R,F]);i.push(O);let U=l(Math.max(_-2*Jpe,.01),Math.max(f-2*Jpe,.01),o*1.2).translate([I,C,0]);if(d.hole_ccw_rotation){const J=U.rotate([0,0,d.hole_ccw_rotation]);i.push(J),U=J}i.push(U);const Y=O.subtract(U);i.push(Y);const W=Y.translate([d.x,d.y,0]);i.push(W);let te=W;if(r){const J=t.intersection([W,r]);i.push(J),te=J}c.push(te);const j=D6(te.getMesh());A.push({key:`ph-${d.pcb_plated_hole_id||p}`,geometry:j,color:_T})}else if(d.shape==="hole_with_polygon_pad"){const _=d.pad_outline;if(!Array.isArray(_)||_.length<3)return;const f=g({ph:d,depth:o*1.2,sizeDelta:2*Cs});if(!f)return;const I=f.translate([d.x,d.y,0]);i.push(I),s.push(I);const y=Math.max(o-2*(sZ+aZ+AZ),Cs),x=u({padOutline:_,thickness:y});if(!x)return;const E=g({ph:d,depth:o*1.02});if(!E)return;const B=g({ph:d,depth:o*.8,sizeDelta:-2*Cs})||E,S=t.union([x,E]);i.push(S);const Q=S.subtract(B);i.push(Q);const w=Q.translate([d.x,d.y,0]);i.push(w);let M=w;if(r){const R=t.intersection([w,r]);i.push(R),M=R}c.push(M);const k=D6(M.getMesh());A.push({key:`ph-${d.pcb_plated_hole_id||p}`,geometry:k,color:_T})}else if(d.shape==="oval"){const _=d.hole_width,f=d.hole_height,I=d.outer_width??_+.4,C=d.outer_height??f+.4,y=_+2*jB,x=f+2*jB,E=o*1.2;let B=zpe(y,x,df);rZ(B)&&(B=B.reverse());const S=e.ofPolygons([B]);i.push(S);let Q=t.extrude(S,E,0,0,[1,1],!0);if(i.push(Q),d.ccw_rotation){const oe=Q.rotate([0,0,d.ccw_rotation]);i.push(oe),Q=oe}const w=Q.translate([d.x,d.y,0]);i.push(w),s.push(w);const M=m;let k=zpe(I,C,df);rZ(k)&&(k=k.reverse());const R=e.ofPolygons([k]);i.push(R);const F=t.extrude(R,M,0,0,[1,1],!0);i.push(F);let O=zpe(_,f,df);rZ(O)&&(O=O.reverse());const U=e.ofPolygons([O]);i.push(U);const Y=t.extrude(U,M*1.05,0,0,[1,1],!0);i.push(Y);let W=F.subtract(Y);if(i.push(W),d.ccw_rotation){const oe=W.rotate([0,0,d.ccw_rotation]);i.push(oe),W=oe}const te=W.translate([d.x,d.y,0]);i.push(te);let j=te;if(r){const oe=t.intersection([te,r]);i.push(oe),j=oe}c.push(j);const J=D6(j.getMesh());A.push({key:`ph-${d.pcb_plated_hole_id||p}`,geometry:J,color:_T})}else if(d.shape==="circular_hole_with_rect_pad"){if(d.hole_shape&&d.hole_shape!=="circle"||d.pad_shape&&d.pad_shape!=="rect")return;const _=d.hole_offset_x||0,f=d.hole_offset_y||0,I=nAn({Manifold:t,x:d.x+_,y:d.y+f,diameter:d.hole_diameter,thickness:o,segments:df});i.push(I),s.push(I);const C=d.rect_pad_width??d.hole_diameter,y=d.rect_pad_height??d.hole_diameter,x=IP(d),E=sZ,B=d.hole_diameter/2,S=mT({Manifold:t,width:C,height:y,thickness:Math.max(o-2*(E+aZ+AZ),Cs),borderRadius:x});i.push(S);const Q=t.cylinder(o*.8,B,B,df,!0).translate([_,f,0]);i.push(Q);const w=t.union([S,Q]);i.push(w);const M=t.cylinder(o*1.2,Math.max(B-Cs,.01),Math.max(B-Cs,.01),df,!0).translate([_,f,0]);i.push(M);const k=w.subtract(M);i.push(k);const R=k.translate([d.x,d.y,0]);i.push(R);let F=R;if(r){const U=t.intersection([R,r]);i.push(U),F=U}c.push(F);const O=D6(F.getMesh());A.push({key:`ph-${d.pcb_plated_hole_id||p}`,geometry:O,color:_T})}});let h;return c.length>0&&(h=t.union(c),i.push(h)),{platedHoleBoardDrills:s,platedHoleCopperGeoms:A,platedHoleSubtractOp:h}}function W4i({Manifold:t,x:e,y:n,outerDiameter:o,holeDiameter:i,thickness:r,zOffset:s=.001,segments:a=32}){const A=s;if(o<i)throw new Error(`Invalid via geometry: outerDiameter (${o}) must be >= holeDiameter (${i})`);const c=Math.min(o/2,i/2+A),u=t.cylinder(r,c,-1,a,!0),g=r+2*s,h=t.cylinder(g,i/2,-1,a,!0);return u.subtract(h).translate([e,n,0])}var j4i=new Vi(...Tc.copper);function $4i(t,e,n,o,i){const r=[],s=Dan(e),a=[];return s.forEach((A,c)=>{if(typeof A.hole_diameter=="number"){const l=oAn({Manifold:t,x:A.x,y:A.y,holeDiameter:A.hole_diameter,thickness:n,zOffset:jB,segments:df});o.push(l),r.push(l)}if(typeof A.outer_diameter=="number"&&typeof A.hole_diameter=="number"){const l=W4i({Manifold:t,x:A.x,y:A.y,outerDiameter:A.outer_diameter,holeDiameter:A.hole_diameter,thickness:n,zOffset:jB,segments:df});o.push(l);let u=l;if(i){const h=t.intersection([l,i]);o.push(h),u=h}const g=D6(u.getMesh());a.push({key:`via-${A.pcb_via_id||c}`,geometry:g,color:j4i})}}),{viaBoardDrills:r,viaCopperGeoms:a}}var q4i=(t,e,n)=>{const[o,i]=ee.useState(null),[r,s]=ee.useState(null),[a,A]=ee.useState(null),[c,l]=ee.useState(!0),u=ee.useRef([]),g=ee.useMemo(()=>{const m=e.filter(I=>I.type==="pcb_panel"),_=Mr(e).pcb_board.list();if(m.length>0){const I=m[0],C=_.find(y=>y.pcb_panel_id===I.pcb_panel_id);return{type:"pcb_board",pcb_board_id:I.pcb_panel_id,center:I.center,width:I.width,height:I.height,thickness:C?.thickness??1.4,material:C?.material??"fr4",num_layers:C?.num_layers??2,solder_mask_color:C?.solder_mask_color}}const f=_.filter(I=>!I.pcb_panel_id);return f.length>0?f[0]:null},[e]),h=ee.useMemo(()=>{const m=Mr(e).pcb_board.list();return m.length>0&&m[0].pcb_board_id==="faux-board"},[e]),d=ee.useMemo(()=>g?Jan(g,m4):m4,[g]);ee.useEffect(()=>{if(!t||!g){i(null),s(null),l(!1);return}if((g.width===0||!g.width)&&(g.height===0||!g.height)&&(!g.outline||g.outline.length<3)){i({platedHoles:[],vias:[]}),s(g.thickness??0),l(!1);return}l(!0),A(null);const m=t.Manifold,_=t.CrossSection,f=y=>{if(!(!y||typeof y.delete!="function"))try{y.delete()}catch(x){(!(x instanceof Error)||!x.message?.includes("Manifold instance already deleted"))&&console.warn("Failed to delete Manifold instance",x)}};u.current.forEach(f),u.current=[];let I=null;const C={};try{const y=g.thickness||1.4;s(y);const{boardOp:x,outlineCrossSection:E}=Y4i(m,_,g,y,u.current);let B=x;const Q=y+2*1;let w=null;const M=.01;if(E){let J=E;if(M>0){const ie=E.offset(M);u.current.push(ie),J=ie}const oe=m.extrude(J,Q,void 0,void 0,void 0,!0);u.current.push(oe),w=oe}else{const J=(g.width||0)+2*M,oe=(g.height||0)+2*M,ie=m.cube([J,oe,Q],!0);u.current.push(ie);const ne=ie.translate([g.center.x,g.center.y,0]);u.current.push(ne),w=ne}const k=[];let R=null;const{nonPlatedHoleBoardDrills:F}=z4i(m,_,e,y,u.current);k.push(...F);const{platedHoleBoardDrills:O,platedHoleCopperGeoms:U,platedHoleSubtractOp:Y}=J4i(m,_,e,y,u.current,w);k.push(...O),C.platedHoles=U;const{viaBoardDrills:W,viaCopperGeoms:te}=$4i(m,e,y,u.current,w);if(k.push(...W),C.vias=te,k.length>0){R=m.union(k),u.current.push(R);const J=Y?m.union([R,Y]):R;u.current.push(J);const oe=B.subtract(J);if(u.current.push(oe),B=oe,Y){const ie=Y.subtract(R);u.current.push(ie);const ne=ie.getMesh(),le=D6(ne);C.platedHoles=[{key:"plated-holes-union",geometry:le,color:new Vi(Tc.copper[0],Tc.copper[1],Tc.copper[2])}]}}const{cutoutOps:j}=V4i(m,_,e,y,u.current);if(j.length>0){const J=m.union(j);u.current.push(J);const oe=B.subtract(J);u.current.push(oe),B=oe}if(I=B,I){const J=I.getMesh(),oe=D6(J);C.board={geometry:oe,color:Tze(g),material:g.material,isFaux:h}}i(C)}catch(y){console.error("Error processing geometry with Manifold in hook:",y),A(y.message||"An unknown error occurred while processing geometry in hook."),i(null)}finally{l(!1)}return()=>{u.current.forEach(f),u.current=[]}},[t,e,g]);const p=ee.useMemo(()=>!g||!d?null:Gan({circuitJson:e,boardData:g,traceTextureResolution:d,visibility:n}),[e,g,d,n]);return{geoms:o,textures:p,pcbThickness:r,error:a,isLoading:c,boardData:g,isFauxBoard:h}},X4i=r_,Z4i=({material:t,color:e,side:n=X4i,isFaux:o=!1})=>t==="fr4"?new CE({color:e,side:n,metalness:0,roughness:.48,specularIntensity:.3,ior:1.45,sheen:0,clearcoat:.16,clearcoatRoughness:.3,transparent:o,opacity:o?Dpe:1,flatShading:!0,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}):new su({color:e,side:n,flatShading:!0,metalness:.1,roughness:.8,transparent:!0,opacity:o?Dpe:.9,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1});function eBi(t){const e=[];if(!t)return e;if(t.board?.geometry){const o=new Er(t.board.geometry,Z4i({material:t.board.material,color:t.board.color,side:r_,isFaux:t.board.isFaux}));o.name="board-geom",p4(o,{castShadow:!1,receiveShadow:!0}),e.push(o)}const n=o=>{if(o)for(const i of o){const r=new Er(i.geometry,new su({color:i.color,side:r_,flatShading:!0}));r.name=i.key,p4(r),e.push(r)}};return n(t.platedHoles),n(t.vias),e}var tBi=({geometryMeshes:t,textureMeshes:e})=>{const{rootObject:n}=uf(),{visibility:o}=AT(),i=r=>{r.geometry.dispose();const s=Array.isArray(r.material)?r.material:[r.material];for(const a of s){if(!a)continue;const A=["map","alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","lightMap","metalnessMap","normalMap","roughnessMap","specularMap"],c=a;for(const l of A){const u=c[l];u&&u instanceof Hg&&u.dispose()}a.dispose()}};return ee.useEffect(()=>{if(n){for(const r of t){let s=!0;r.name==="board-geom"||r.name==="board-stiffener"?s=o.boardBody:(r.name.includes("plated_hole")||r.name.includes("via"))&&(s=o.topCopper||o.bottomCopper),s&&n.add(r)}return()=>{for(const r of t)r.parent===n&&n.remove(r),i(r)}}},[n,t,o]),ee.useEffect(()=>{if(n){for(const r of e)n.add(r);return()=>{for(const r of e)r.parent===n&&n.remove(r),i(r)}}},[n,e]),null},nBi="https://cdn.jsdelivr.net/npm/manifold-3d@3.2.1",oBi=({circuitJson:t,foldPcbs:e,autoRotateDisabled:n,clickToInteractEnabled:o,onUserInteraction:i,children:r,onCameraControllerReady:s,resolveStaticAsset:a,referenceObject:A,hiddenCadComponentIds:c})=>{const l=OVe(r),u=ee.useMemo(()=>Wan(t??l),[t,l]),[g,h]=ee.useState(null),[d,p]=ee.useState(null),{visibility:m}=AT();ee.useEffect(()=>{if(window.ManifoldModule&&typeof window.ManifoldModule=="object"&&window.ManifoldModule.setup){h(window.ManifoldModule);return}const k=async W=>{try{const te=await W();te.setup(),window.ManifoldModule=te,h(te)}catch(te){console.error("Failed to initialize Manifold:",te),p(`Failed to initialize Manifold: ${te instanceof Error?te.message:"Unknown error"}`)}},R=window.ManifoldModule??window.MANIFOLD??window.MANIFOLD_MODULE;if(R){window.ManifoldModule=R,k(window.ManifoldModule);return}const F="manifoldLoaded",O=()=>{const W=window.ManifoldModule??window.MANIFOLD??window.MANIFOLD_MODULE;if(W)window.ManifoldModule=W,k(window.ManifoldModule);else{const te="ManifoldModule not found on window after script load.";console.error(te),p(te)}};window.addEventListener(F,O,{once:!0});const U=document.createElement("script");U.type="module",U.innerHTML=`
try {
const { default: ManifoldModule } = await import('${nBi}/manifold.js');
window.ManifoldModule = ManifoldModule;
} catch (e) {
console.error('Error importing manifold in dynamic script:', e);
} finally {
window.dispatchEvent(new CustomEvent('${F}'));
}
`.trim();const Y=W=>{const te="Failed to load Manifold loader script.";console.error(te,W),p(te),window.removeEventListener(F,O)};return U.addEventListener("error",Y),document.body.appendChild(U),()=>{window.removeEventListener(F,O),U.removeEventListener("error",Y)}},[]);const{geoms:_,textures:f,pcbThickness:I,error:C,isLoading:y,boardData:x,isFauxBoard:E}=q4i(g,u,m),B=ee.useMemo(()=>{try{const k=Srn(u,e),R=F4i(u,{foldPcbs:k});return{...O4i(eBi(_),c4i(f,x,I,E),u,k),posedJson:R,error:void 0}}catch(k){return{error:k instanceof Error?k.message:String(k),geometryMeshes:[],textureMeshes:[],posedJson:u,bounds:void 0}}},[_,f,x,I,E,u,e]),S=ee.useMemo(()=>Mr(B.posedJson).cad_component.list().filter(k=>!c?.has(k.cad_component_id)),[B.posedJson,c]),Q=ee.useMemo(()=>{if(!x)return;const k=DC(x);return{width:k.width,height:k.height}},[x]),w=ee.useMemo(()=>{if(!x)return;const k=DC(x);return{x:k.centerX,y:k.centerY}},[x]),M=ee.useMemo(()=>{if(!x)return[5,-5,5];const{width:k=0,height:R=0}=x,F=Math.max(k,1),O=Math.max(R,1),U=Math.max(F,O,5);return[U*.4,-U*.7,U*.9]},[x]);return d?K.jsxs("div",{style:{color:"red",padding:"1em",border:"1px solid red",margin:"1em"},children:["Error: ",d]}):g?C||B.error?K.jsxs("div",{role:"alert",style:{color:"red",padding:"1em",border:"1px solid red",margin:"1em"},children:["Error: ",C??B.error]}):y?K.jsx("div",{style:{padding:"1em"},children:"Processing board geometry..."}):K.jsxs(San,{initialCameraPosition:M,autoRotateDisabled:n,clickToInteractEnabled:o,boardDimensions:Q,boardCenter:w,referenceObject:A,onUserInteraction:i,onCameraControllerReady:s,children:[K.jsx(tBi,{geometryMeshes:B.geometryMeshes,textureMeshes:B.textureMeshes}),B.bounds&&K.jsx(ban,{bounds:B.bounds}),S.map(k=>K.jsx(vze,{fallback:({error:R})=>K.jsx(Ran,{cad_component:k,error:R}),children:K.jsx(pan,{cad_component:k,circuitJson:B.posedJson,resolveStaticAsset:a})},k.cad_component_id))]}):K.jsx("div",{style:{padding:"1em"},children:"Loading Manifold module..."})},iAn=oBi,iBi=Object.defineProperty,qY=(t,e)=>iBi(t,"name",{value:e,configurable:!0}),rAn=!!(typeof window<"u"&&window.document&&window.document.createElement);function El(t,e,{checkForDefaultPrevented:n=!0}={}){return qY(function(i){if(t?.(i),n===!1||!i||!i.defaultPrevented)return e?.(i)},"handleEvent")}qY(El,"composeEventHandlers");function rBi(t){if(!rAn)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}qY(rBi,"getOwnerWindow");function $ze(t){if(!rAn)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}qY($ze,"getOwnerDocument");function sAn(t,e=!1){const{activeElement:n}=$ze(t);if(!n?.nodeName)return null;if(aAn(n)&&n.contentDocument)return sAn(n.contentDocument.body,e);if(e){const o=n.getAttribute("aria-activedescendant");if(o){const i=$ze(n).getElementById(o);if(i)return i}}return n}qY(sAn,"getActiveElement");function aAn(t){return t.tagName==="IFRAME"}qY(aAn,"isFrame");var sBi=Object.defineProperty,qze=(t,e)=>sBi(t,"name",{value:e,configurable:!0});function Xze(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}qze(Xze,"setRef");function AAn(...t){return e=>{let n=!1;const o=t.map(i=>{const r=Xze(i,e);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let i=0;i<o.length;i++){const r=o[i];typeof r=="function"?r():Xze(t[i],null)}}}}qze(AAn,"composeRefs");function hf(...t){return ee.useCallback(AAn(...t),t)}qze(hf,"useComposedRefs");var aBi=Object.defineProperty,_4=(t,e)=>aBi(t,"name",{value:e,configurable:!0});function ABi(t,e){const n=ee.createContext(e);n.displayName=t+"Context";const o=_4(r=>{const{children:s,...a}=r,A=ee.useMemo(()=>a,Object.values(a));return K.jsx(n.Provider,{value:A,children:s})},"Provider");o.displayName=t+"Provider";function i(r,s={}){const{optional:a=!1}=s,A=ee.useContext(n);if(A)return A;if(e!==void 0)return e;if(!a)throw new Error(`\`${r}\` must be used within \`${t}\``)}return _4(i,"useContext"),[o,i]}_4(ABi,"createContext");function fT(t,e=[]){let n=[];function o(r,s){const a=ee.createContext(s);a.displayName=r+"Context";const A=n.length;n=[...n,s];const c=_4(u=>{const{scope:g,children:h,...d}=u,p=g?.[t]?.[A]||a,m=ee.useMemo(()=>d,Object.values(d));return K.jsx(p.Provider,{value:m,children:h})},"Provider");c.displayName=r+"Provider";function l(u,g,h={}){const{optional:d=!1}=h,p=g?.[t]?.[A]||a,m=ee.useContext(p);if(m)return m;if(s!==void 0)return s;if(!d)throw new Error(`\`${u}\` must be used within \`${r}\``)}return _4(l,"useContext"),[c,l]}_4(o,"createContext");const i=_4(()=>{const r=n.map(s=>ee.createContext(s));return _4(function(a){const A=a?.[t]||r;return ee.useMemo(()=>({[`__scope${t}`]:{...a,[t]:A}}),[a,A])},"useScope")},"createScope");return i.scopeName=t,[o,cAn(i,...e)]}_4(fT,"createContextScope");function cAn(...t){const e=t[0];if(t.length===1)return e;const n=_4(()=>{const o=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return _4(function(r){const s=o.reduce((a,{useScope:A,scopeName:c})=>{const u=A(r)[`__scope${c}`];return{...a,...u}},{});return ee.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}_4(cAn,"composeContextScopes");var XB=globalThis?.document?ee.useLayoutEffect:()=>{},cBi=Object.defineProperty,lBi=(t,e)=>cBi(t,"name",{value:e,configurable:!0}),lAn=Q5[" useEffectEvent ".trim().toString()],uAn=Q5[" useInsertionEffect ".trim().toString()];function gAn(t){if(typeof lAn=="function")return lAn(t);const e=ee.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof uAn=="function"?uAn(()=>{e.current=t}):XB(()=>{e.current=t}),ee.useMemo(()=>((...n)=>e.current?.(...n)),[])}lBi(gAn,"useEffectEvent");var uBi=Object.defineProperty,cZ=(t,e)=>uBi(t,"name",{value:e,configurable:!0}),gBi=Q5[" useInsertionEffect ".trim().toString()]||XB;function Wpe({prop:t,defaultProp:e,onChange:n=cZ(()=>{},"onChange"),caller:o}){const[i,r,s]=dAn({defaultProp:e,onChange:n}),a=t!==void 0,A=a?t:i,c=ee.useCallback(l=>{if(a){const u=hAn(l)?l(t):l;u!==t&&s.current?.(u)}else r(l)},[a,t,r,s]);return[A,c]}cZ(Wpe,"useControllableState");function dAn({defaultProp:t,onChange:e}){const[n,o]=ee.useState(t),i=ee.useRef(n),r=ee.useRef(e);return gBi(()=>{r.current=e},[e]),ee.useEffect(()=>{i.current!==n&&(r.current?.(n),i.current=n)},[n,i]),[n,o,r]}cZ(dAn,"useUncontrolledState");function hAn(t){return typeof t=="function"}cZ(hAn,"isFunction");var pAn=Symbol("RADIX:SYNC_STATE");function dBi(t,e,n,o){const{prop:i,defaultProp:r,onChange:s,caller:a}=e,A=i!==void 0,c=gAn(s),l=[{...n,state:r}];o&&l.push(o);const[u,g]=ee.useReducer((m,_)=>{if(_.type===pAn)return{...m,state:_.state};const f=t(m,_);return A&&!Object.is(f.state,m.state)&&c(f.state),f},...l),h=u.state,d=ee.useRef(h);ee.useEffect(()=>{d.current!==h&&(d.current=h,A||c(h))},[h,d,A]);const p=ee.useMemo(()=>i!==void 0?{...u,state:i}:u,[u,i]);return ee.useEffect(()=>{A&&!Object.is(i,u.state)&&g({type:pAn,state:i})},[i,u.state,A]),[p,g]}cZ(dBi,"useControllableStateReducer");var hBi=Object.defineProperty,ZB=(t,e)=>hBi(t,"name",{value:e,configurable:!0});function IT(t){const e=ee.forwardRef((n,o)=>{let{children:i,...r}=n,s=null,a=!1;const A=[];Zze(i)&&typeof jpe=="function"&&(i=jpe(i._payload)),ee.Children.forEach(i,g=>{if(IAn(g)){a=!0;const h=g;let d="child"in h.props?h.props.child:h.props.children;Zze(d)&&typeof jpe=="function"&&(d=jpe(d._payload)),s=mBi(h,d),A.push(s?.props?.children)}else A.push(g)}),s?s=ee.cloneElement(s,void 0,A):!a&&ee.Children.count(i)===1&&ee.isValidElement(i)&&(s=i);const c=s?fAn(s):void 0,l=hf(o,c);if(!s){if(i||i===0)throw new Error(a?IBi(t):fBi(t));return i}const u=_An(r,s.props??{});return s.type!==ee.Fragment&&(u.ref=o?l:c),ee.cloneElement(s,u)});return e.displayName=`${t}.Slot`,e}ZB(IT,"createSlot");var mAn=Symbol.for("radix.slottable");function pBi(t){const e=ZB(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=mAn,e}ZB(pBi,"createSlottable");var mBi=ZB((t,e)=>{if("child"in t.props){const n=t.props.child;return ee.isValidElement(n)?ee.cloneElement(n,void 0,t.props.children(n.props.children)):null}return ee.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function _An(t,e){const n={...e};for(const o in e){const i=t[o],r=e[o];/^on[A-Z]/.test(o)?i&&r?n[o]=(...a)=>{const A=r(...a);return i(...a),A}:i&&(n[o]=i):o==="style"?n[o]={...i,...r}:o==="className"&&(n[o]=[i,r].filter(Boolean).join(" "))}return{...t,...n}}ZB(_An,"mergeProps");function fAn(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}ZB(fAn,"getElementRef");function IAn(t){return ee.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===mAn}ZB(IAn,"isSlottable");var _Bi=Symbol.for("react.lazy");function Zze(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===_Bi&&"_payload"in t&&CAn(t._payload)}ZB(Zze,"isLazyComponent");function CAn(t){return typeof t=="object"&&t!==null&&"then"in t}ZB(CAn,"isPromiseLike");var fBi=ZB(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),IBi=ZB(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),jpe=Q5[" use ".trim().toString()],CBi=Object.defineProperty,yBi=(t,e)=>CBi(t,"name",{value:e,configurable:!0}),xBi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],N6=xBi.reduce((t,e)=>{const n=IT(`Primitive.${e}`),o=ee.forwardRef((i,r)=>{const{asChild:s,...a}=i,A=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),K.jsx(A,{...a,ref:r})});return o.displayName=`Primitive.${e}`,{...t,[e]:o}},{});function eJe(t,e){t&&c6.flushSync(()=>t.dispatchEvent(e))}yBi(eJe,"dispatchDiscreteCustomEvent");var EBi=Object.defineProperty,u1=(t,e)=>EBi(t,"name",{value:e,configurable:!0});function tJe(t){const e=t+"CollectionProvider",[n,o]=fT(e),[i,r]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=u1(p=>{const{scope:m,children:_}=p,f=ee.useRef(null),I=ee.useRef(new Map).current;return K.jsx(i,{scope:m,itemMap:I,collectionRef:f,children:_})},"CollectionProvider");s.displayName=e;const a=t+"CollectionSlot",A=IT(a),c=ee.forwardRef((p,m)=>{const{scope:_,children:f}=p,I=r(a,_),C=hf(m,I.collectionRef);return K.jsx(A,{ref:C,children:f})});c.displayName=a;const l=t+"CollectionItemSlot",u="data-radix-collection-item",g=IT(l),h=ee.forwardRef((p,m)=>{const{scope:_,children:f,...I}=p,C=ee.useRef(null),y=hf(m,C),x=r(l,_);return ee.useEffect(()=>(x.itemMap.set(C,{ref:C,...I}),()=>{x.itemMap.delete(C)})),K.jsx(g,{[u]:"",ref:y,children:f})});h.displayName=l;function d(p){const m=r(t+"CollectionConsumer",p);return ee.useCallback(()=>{const f=m.collectionRef.current;if(!f)return[];const I=Array.from(f.querySelectorAll(`[${u}]`));return Array.from(m.itemMap.values()).sort((x,E)=>I.indexOf(x.ref.current)-I.indexOf(E.ref.current))},[m.collectionRef,m.itemMap])}return u1(d,"useCollection"),[{Provider:s,Slot:c,ItemSlot:h},d,o]}u1(tJe,"createCollection");var yAn=new WeakMap,nJe=(UE=class extends Map{constructor(n){super(n);uit(this,p_);Yte(this,p_,[...super.keys()]),yAn.set(this,!0)}set(n,o){return yAn.get(this)&&(this.has(n)?w0(this,p_)[w0(this,p_).indexOf(n)]=n:w0(this,p_).push(n)),super.set(n,o),this}insert(n,o,i){const r=this.has(o),s=w0(this,p_).length,a=oJe(n);let A=a>=0?a:s+a;const c=A<0||A>=s?-1:A;if(c===this.size||r&&c===this.size-1||c===-1)return this.set(o,i),this;const l=this.size+(r?0:1);a<0&&A++;const u=[...w0(this,p_)];let g,h=!1;for(let d=A;d<l;d++)if(A===d){let p=u[d];u[d]===o&&(p=u[d+1]),r&&this.delete(o),g=this.get(p),this.set(o,i)}else{!h&&u[d-1]===o&&(h=!0);const p=u[h?d:d-1],m=g;g=this.get(p),this.delete(p),this.set(p,m)}return this}with(n,o,i){const r=new UE(this);return r.insert(n,o,i),r}before(n){const o=w0(this,p_).indexOf(n)-1;if(!(o<0))return this.entryAt(o)}setBefore(n,o,i){const r=w0(this,p_).indexOf(n);return r===-1?this:this.insert(r,o,i)}after(n){let o=w0(this,p_).indexOf(n);if(o=o===-1||o===this.size-1?-1:o+1,o!==-1)return this.entryAt(o)}setAfter(n,o,i){const r=w0(this,p_).indexOf(n);return r===-1?this:this.insert(r+1,o,i)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return Yte(this,p_,[]),super.clear()}delete(n){const o=super.delete(n);return o&&w0(this,p_).splice(w0(this,p_).indexOf(n),1),o}deleteAt(n){const o=this.keyAt(n);return o!==void 0?this.delete(o):!1}at(n){const o=$pe(w0(this,p_),n);if(o!==void 0)return this.get(o)}entryAt(n){const o=$pe(w0(this,p_),n);if(o!==void 0)return[o,this.get(o)]}indexOf(n){return w0(this,p_).indexOf(n)}keyAt(n){return $pe(w0(this,p_),n)}from(n,o){const i=this.indexOf(n);if(i===-1)return;let r=i+o;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(n,o){const i=this.indexOf(n);if(i===-1)return;let r=i+o;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(n,o){let i=0;for(const r of this){if(Reflect.apply(n,o,[r,i,this]))return r;i++}}findIndex(n,o){let i=0;for(const r of this){if(Reflect.apply(n,o,[r,i,this]))return i;i++}return-1}filter(n,o){const i=[];let r=0;for(const s of this)Reflect.apply(n,o,[s,r,this])&&i.push(s),r++;return new UE(i)}map(n,o){const i=[];let r=0;for(const s of this)i.push([s[0],Reflect.apply(n,o,[s,r,this])]),r++;return new UE(i)}reduce(...n){const[o,i]=n;let r=0,s=i??this.at(0);for(const a of this)r===0&&n.length===1?s=a:s=Reflect.apply(o,this,[s,a,r,this]),r++;return s}reduceRight(...n){const[o,i]=n;let r=i??this.at(-1);for(let s=this.size-1;s>=0;s--){const a=this.at(s);s===this.size-1&&n.length===1?r=a:r=Reflect.apply(o,this,[r,a,s,this])}return r}toSorted(n){const o=[...this.entries()].sort(n);return new UE(o)}toReversed(){const n=new UE;for(let o=this.size-1;o>=0;o--){const i=this.keyAt(o),r=this.get(i);n.set(i,r)}return n}toSpliced(...n){const o=[...this.entries()];return o.splice(...n),new UE(o)}slice(n,o){const i=new UE;let r=this.size-1;if(n===void 0)return i;n<0&&(n=n+this.size),o!==void 0&&o>0&&(r=o-1);for(let s=n;s<=r;s++){const a=this.keyAt(s),A=this.get(a);i.set(a,A)}return i}every(n,o){let i=0;for(const r of this){if(!Reflect.apply(n,o,[r,i,this]))return!1;i++}return!0}some(n,o){let i=0;for(const r of this){if(Reflect.apply(n,o,[r,i,this]))return!0;i++}return!1}},p_=new WeakMap,u1(UE,"OrderedDict"),UE);function $pe(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);const n=xAn(t,e);return n===-1?void 0:t[n]}u1($pe,"at");function xAn(t,e){const n=t.length,o=oJe(e),i=o>=0?o:n+o;return i<0||i>=n?-1:i}u1(xAn,"toSafeIndex");function oJe(t){return t!==t||t===0?0:Math.trunc(t)}u1(oJe,"toSafeInteger");function BBi(t){const e=t+"CollectionProvider",[n,o]=fT(e),[i,r]=n(e,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new nJe,setItemMap:u1(()=>{},"setItemMap")}),s=u1(({state:I,...C})=>I?K.jsx(A,{...C,state:I}):K.jsx(a,{...C}),"CollectionProvider");s.displayName=e;const a=u1(I=>{const C=m();return K.jsx(A,{...I,state:C})},"CollectionInit");a.displayName=e+"Init";const A=u1(I=>{const{scope:C,children:y,state:x}=I,E=ee.useRef(null),[B,S]=ee.useState(null),Q=hf(E,S),[w,M]=x;return ee.useEffect(()=>{if(!B)return;const k=bAn(()=>{});return k.observe(B,{childList:!0,subtree:!0}),()=>{k.disconnect()}},[B]),K.jsx(i,{scope:C,itemMap:w,setItemMap:M,collectionRef:Q,collectionRefObject:E,collectionElement:B,children:y})},"CollectionProviderImpl");A.displayName=e+"Impl";const c=t+"CollectionSlot",l=IT(c),u=ee.forwardRef((I,C)=>{const{scope:y,children:x}=I,E=r(c,y),B=hf(C,E.collectionRef);return K.jsx(l,{ref:B,children:x})});u.displayName=c;const g=t+"CollectionItemSlot",h="data-radix-collection-item",d=IT(g),p=ee.forwardRef((I,C)=>{const{scope:y,children:x,...E}=I,B=ee.useRef(null),[S,Q]=ee.useState(null),w=hf(C,B,Q),M=r(g,y),{setItemMap:k}=M,R=ee.useRef(E);EAn(R.current,E)||(R.current=E);const F=R.current;return ee.useEffect(()=>{const O=F;return k(U=>S?U.has(S)?U.set(S,{...O,element:S}).toSorted(iJe):(U.set(S,{...O,element:S}),U.toSorted(iJe)):U),()=>{k(U=>!S||!U.has(S)?U:(U.delete(S),new nJe(U)))}},[S,F,k]),K.jsx(d,{[h]:"",ref:w,children:x})});p.displayName=g;function m(){return ee.useState(new nJe)}u1(m,"useInitCollection");function _(I){const{itemMap:C}=r(t+"CollectionConsumer",I);return C}return u1(_,"useCollection"),[{Provider:s,Slot:u,ItemSlot:p},{createCollectionScope:o,useCollection:_,useInitCollection:m}]}u1(BBi,"createCollection");function EAn(t,e){if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return!1;const n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(e,i)||t[i]!==e[i])return!1;return!0}u1(EAn,"shallowEqual");function BAn(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}u1(BAn,"isElementPreceding");function iJe(t,e){return!t[1].element||!e[1].element?0:BAn(t[1].element,e[1].element)?-1:1}u1(iJe,"sortByDocumentPosition");function bAn(t){return new MutationObserver(n=>{for(const o of n)if(o.type==="childList"){t();return}})}u1(bAn,"getChildListObserver");var bBi=Object.defineProperty,SBi=(t,e)=>bBi(t,"name",{value:e,configurable:!0}),QBi=ee.createContext(void 0);function rJe(t){const e=ee.useContext(QBi);return t||e||"ltr"}SBi(rJe,"useDirection");var vBi=Object.defineProperty,wBi=(t,e)=>vBi(t,"name",{value:e,configurable:!0});function R6(t){const e=ee.useRef(t);return ee.useEffect(()=>{e.current=t}),ee.useMemo(()=>((...n)=>e.current?.(...n)),[])}wBi(R6,"useCallbackRef");var PBi=Object.defineProperty,g1=(t,e)=>PBi(t,"name",{value:e,configurable:!0}),sJe="dismissableLayer.update",MBi="dismissableLayer.pointerDownOutside",DBi="dismissableLayer.focusOutside",SAn,QAn=ee.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),NBi=ee.forwardRef(g1(function(e,n){const{disableOutsidePointerEvents:o=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:A,onDismiss:c,...l}=e,u=ee.useContext(QAn),[g,h]=ee.useState(null),d=g?.ownerDocument??globalThis?.document,[,p]=ee.useState({}),m=hf(n,h),_=Array.from(u.layers),[f]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),I=f?_.indexOf(f):-1,C=g?_.indexOf(g):-1,y=u.layersWithOutsidePointerEventsDisabled.size>0,x=C>=I,E=ee.useRef(!1),B=vAn(M=>{s?.(M),A?.(M),M.defaultPrevented||c?.()},{ownerDocument:d,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:E,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:ee.useCallback(M=>{if(!(M instanceof Node))return!1;const k=[...u.branches].some(R=>R.contains(M));return x&&!k},[u.branches,x])}),S=wAn(M=>{if(i&&E.current)return;const k=M.target;[...u.branches].some(F=>F.contains(k))||(a?.(M),A?.(M),M.defaultPrevented||c?.())},d),Q=g?C===_.length-1:!1,w=R6(M=>{M.key==="Escape"&&(r?.(M),!M.defaultPrevented&&c&&(M.preventDefault(),c()))});return ee.useEffect(()=>{if(Q)return d.addEventListener("keydown",w,{capture:!0}),()=>d.removeEventListener("keydown",w,{capture:!0})},[d,Q,w]),ee.useEffect(()=>{if(g)return o&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(SAn=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(g)),u.layers.add(g),aJe(),()=>{o&&(u.layersWithOutsidePointerEventsDisabled.delete(g),u.layersWithOutsidePointerEventsDisabled.size===0&&(d.body.style.pointerEvents=SAn))}},[g,d,o,u]),ee.useEffect(()=>()=>{g&&(u.layers.delete(g),u.layersWithOutsidePointerEventsDisabled.delete(g),aJe())},[g,u]),ee.useEffect(()=>{const M=g1(()=>p({}),"handleUpdate");return document.addEventListener(sJe,M),()=>document.removeEventListener(sJe,M)},[]),K.jsx(N6.div,{...l,ref:m,style:{pointerEvents:y?x?"auto":"none":void 0,...e.style},onFocusCapture:El(e.onFocusCapture,S.onFocusCapture),onBlurCapture:El(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:El(e.onPointerDownCapture,B.onPointerDownCapture)})},"DismissableLayer"));function RBi(){const t=ee.useContext(QAn),[e,n]=ee.useState(null);return ee.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}g1(RBi,"useDismissableLayerSurface");var TBi=g1(()=>!0,"IS_TRUE");function vAn(t,e){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:o=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:r,shouldHandlePointerDownOutside:s=TBi}=e,a=R6(t),A=ee.useRef(!1),c=ee.useRef(!1),l=ee.useRef(new Map),u=ee.useRef(()=>{});return ee.useEffect(()=>{function g(){c.current=!1,i.current=!1,l.current.clear()}g1(g,"resetOutsideInteraction");function h(){return Array.from(l.current.values()).some(Boolean)}g1(h,"isOutsideInteractionIntercepted");function d(I){if(!c.current)return;const C=I.target;C instanceof Node&&[...r].some(x=>x.contains(C))||l.current.set(I.type,!0),I.type==="click"&&window.setTimeout(()=>{c.current&&u.current()},0)}g1(d,"handleInteractionCapture");function p(I){c.current&&l.current.set(I.type,!1)}g1(p,"handleInteractionBubble");const m=g1(I=>{if(I.target&&!A.current){let C=function(){n.removeEventListener("click",u.current);const x=h();g(),x||AJe(MBi,a,y,{discrete:!0})};if(g1(C,"handleAndDispatchPointerDownOutsideEvent"),!s(I.target)){n.removeEventListener("click",u.current),g(),A.current=!1;return}const y={originalEvent:I};c.current=!0,i.current=o&&I.button===0,l.current.clear(),!o||I.button!==0?C():(n.removeEventListener("click",u.current),u.current=C,n.addEventListener("click",u.current,{once:!0}))}else n.removeEventListener("click",u.current),g();A.current=!1},"handlePointerDown"),_=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const I of _)n.addEventListener(I,d,!0),n.addEventListener(I,p);const f=window.setTimeout(()=>{n.addEventListener("pointerdown",m)},0);return()=>{window.clearTimeout(f),n.removeEventListener("pointerdown",m),n.removeEventListener("click",u.current);for(const I of _)n.removeEventListener(I,d,!0),n.removeEventListener(I,p)}},[n,a,o,i,r,s]),{onPointerDownCapture:g1(()=>A.current=!0,"onPointerDownCapture")}}g1(vAn,"usePointerDownOutside");function wAn(t,e=globalThis?.document){const n=R6(t),o=ee.useRef(!1);return ee.useEffect(()=>{const i=g1(r=>{r.target&&!o.current&&AJe(DBi,n,{originalEvent:r},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:g1(()=>o.current=!0,"onFocusCapture"),onBlurCapture:g1(()=>o.current=!1,"onBlurCapture")}}g1(wAn,"useFocusOutside");function aJe(){const t=new CustomEvent(sJe);document.dispatchEvent(t)}g1(aJe,"dispatchUpdate");function AJe(t,e,n,{discrete:o}){const i=n.originalEvent.target,r=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),o?eJe(i,r):i.dispatchEvent(r)}g1(AJe,"handleAndDispatchCustomEvent");var kBi=Object.defineProperty,cJe=(t,e)=>kBi(t,"name",{value:e,configurable:!0}),qpe=0,XY=null;function FBi(t){return lJe(),t.children}cJe(FBi,"FocusGuards");function lJe(){ee.useEffect(()=>{XY||(XY={start:uJe(),end:uJe()});const{start:t,end:e}=XY;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),qpe++,()=>{qpe===1&&(XY?.start.remove(),XY?.end.remove(),XY=null),qpe=Math.max(0,qpe-1)}},[])}cJe(lJe,"useFocusGuards");function uJe(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}cJe(uJe,"createFocusGuard");var LBi=Object.defineProperty,A2=(t,e)=>LBi(t,"name",{value:e,configurable:!0}),gJe="focusScope.autoFocusOnMount",dJe="focusScope.autoFocusOnUnmount",PAn={bubbles:!1,cancelable:!0},HBi=ee.forwardRef(A2(function(e,n){const{loop:o=!1,trapped:i=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...a}=e,[A,c]=ee.useState(null),l=R6(r),u=R6(s),g=ee.useRef(null),h=hf(n,c),d=ee.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;ee.useEffect(()=>{if(i){let m=function(C){if(d.paused||!A)return;const y=C.target;A.contains(y)?g.current=y:dS(g.current,{select:!0})},_=function(C){if(d.paused||!A)return;const y=C.relatedTarget;y!==null&&(A.contains(y)||dS(g.current,{select:!0}))},f=function(C){if(document.activeElement===document.body)for(const x of C)x.removedNodes.length>0&&dS(A)};A2(m,"handleFocusIn"),A2(_,"handleFocusOut"),A2(f,"handleMutations"),document.addEventListener("focusin",m),document.addEventListener("focusout",_);const I=new MutationObserver(f);return A&&I.observe(A,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",_),I.disconnect()}}},[i,A,d.paused]),ee.useEffect(()=>{if(A){TAn.add(d);const m=document.activeElement;if(!A.contains(m)){const f=new CustomEvent(gJe,PAn);A.addEventListener(gJe,l),A.dispatchEvent(f),f.defaultPrevented||(MAn(FAn(hJe(A)),{select:!0}),document.activeElement===m&&dS(A))}return()=>{A.removeEventListener(gJe,l),setTimeout(()=>{const f=new CustomEvent(dJe,PAn);A.addEventListener(dJe,u),A.dispatchEvent(f),f.defaultPrevented||dS(m??document.body,{select:!0}),A.removeEventListener(dJe,u),TAn.remove(d)},0)}}},[A,l,u,d]);const p=ee.useCallback(m=>{if(!o&&!i||d.paused)return;const _=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,f=document.activeElement;if(_&&f){const I=m.currentTarget,[C,y]=DAn(I);C&&y?!m.shiftKey&&f===y?(m.preventDefault(),o&&dS(C,{select:!0})):m.shiftKey&&f===C&&(m.preventDefault(),o&&dS(y,{select:!0})):f===I&&m.preventDefault()}},[o,i,d.paused]);return K.jsx(N6.div,{tabIndex:-1,...a,ref:h,onKeyDown:p})},"FocusScope"));function MAn(t,{select:e=!1}={}){const n=document.activeElement;for(const o of t)if(dS(o,{select:e}),document.activeElement!==n)return}A2(MAn,"focusFirst");function DAn(t){const e=hJe(t),n=pJe(e,t),o=pJe(e.reverse(),t);return[n,o]}A2(DAn,"getTabbableEdges");function hJe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:A2(o=>{const i=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||i?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)e.push(n.currentNode);return e}A2(hJe,"getTabbableCandidates");function pJe(t,e){const n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const o of t)if(!(n?!o.checkVisibility({checkVisibilityCSS:!0}):NAn(o,{upTo:e})))return o}A2(pJe,"findVisible");function NAn(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}A2(NAn,"isHidden");function RAn(t){return t instanceof HTMLInputElement&&"select"in t}A2(RAn,"isSelectableInput");function dS(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&RAn(t)&&e&&t.select()}}A2(dS,"focus");var TAn=kAn();function kAn(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=mJe(t,e),t.unshift(e)},remove(e){t=mJe(t,e),t[0]?.resume()}}}A2(kAn,"createFocusScopesStack");function mJe(t,e){const n=[...t],o=n.indexOf(e);return o!==-1&&n.splice(o,1),n}A2(mJe,"arrayRemove");function FAn(t){return t.filter(e=>e.tagName!=="A")}A2(FAn,"removeLinks");var OBi=Object.defineProperty,GBi=(t,e)=>OBi(t,"name",{value:e,configurable:!0}),YBi=Q5[" useId ".trim().toString()]||(()=>{}),UBi=0;function ZY(t){const[e,n]=ee.useState(YBi());return XB(()=>{t||n(o=>o??String(UBi++))},[t]),t||(e?`radix-${e}`:"")}GBi(ZY,"useId");var KBi=["top","right","bottom","left"],CP=Math.min,hS=Math.max,Xpe=Math.round,Zpe=Math.floor,pS=t=>({x:t,y:t}),VBi={left:"right",right:"left",bottom:"top",top:"bottom"};function LAn(t,e,n){return hS(t,CP(e,n))}function mS(t,e){return typeof t=="function"?t(e):t}function yP(t){return t.split("-")[0]}function eU(t){return t.split("-")[1]}function _Je(t){return t==="x"?"y":"x"}function fJe(t){return t==="y"?"height":"width"}function T6(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function IJe(t){return _Je(T6(t))}function zBi(t,e,n){n===void 0&&(n=!1);const o=eU(t),i=IJe(t),r=fJe(i);let s=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=eme(s)),[s,eme(s)]}function JBi(t){const e=eme(t);return[CJe(t),e,CJe(e)]}function CJe(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}var HAn=["left","right"],OAn=["right","left"],WBi=["top","bottom"],jBi=["bottom","top"];function $Bi(t,e,n){switch(t){case"top":case"bottom":return n?e?OAn:HAn:e?HAn:OAn;case"left":case"right":return e?WBi:jBi;default:return[]}}function qBi(t,e,n,o){const i=eU(t);let r=$Bi(yP(t),n==="start",o);return i&&(r=r.map(s=>s+"-"+i),e&&(r=r.concat(r.map(CJe)))),r}function eme(t){const e=yP(t);return VBi[e]+t.slice(e.length)}function XBi(t){var e,n,o,i;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(o=t.bottom)!=null?o:0,left:(i=t.left)!=null?i:0}}function GAn(t){return typeof t!="number"?XBi(t):{top:t,right:t,bottom:t,left:t}}function tme(t){const{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function YAn(t,e,n){let{reference:o,floating:i}=t;const r=T6(e),s=IJe(e),a=fJe(s),A=yP(e),c=r==="y",l=o.x+o.width/2-i.width/2,u=o.y+o.height/2-i.height/2,g=o[a]/2-i[a]/2;let h;switch(A){case"top":h={x:l,y:o.y-i.height};break;case"bottom":h={x:l,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:u};break;case"left":h={x:o.x-i.width,y:u};break;default:h={x:o.x,y:o.y}}const d=eU(e);return d&&(h[s]+=g*(d==="end"?1:-1)*(n&&c?-1:1)),h}async function ZBi(t,e){var n;e===void 0&&(e={});const{x:o,y:i,platform:r,rects:s,elements:a,strategy:A}=t,{boundary:c="clippingAncestors",rootBoundary:l="viewport",elementContext:u="floating",altBoundary:g=!1,padding:h=0}=mS(e,t),d=GAn(h),m=a[g?u==="floating"?"reference":"floating":u],_=tme(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(m)))==null||n?m:m.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:c,rootBoundary:l,strategy:A})),f=u==="floating"?{x:o,y:i,width:s.floating.width,height:s.floating.height}:s.reference,I=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),C=await(r.isElement==null?void 0:r.isElement(I))&&await(r.getScale==null?void 0:r.getScale(I))||{x:1,y:1},y=tme(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:f,offsetParent:I,strategy:A}):f);return{top:(_.top-y.top+d.top)/C.y,bottom:(y.bottom-_.bottom+d.bottom)/C.y,left:(_.left-y.left+d.left)/C.x,right:(y.right-_.right+d.right)/C.x}}var e9i=50,t9i=async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:s}=n,a=s.detectOverflow?s:{...s,detectOverflow:ZBi},A=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:l,y:u}=YAn(c,o,A),g=o,h=0;const d={};for(let p=0;p<r.length;p++){const m=r[p];if(!m)continue;const{name:_,fn:f}=m,{x:I,y:C,data:y,reset:x}=await f({x:l,y:u,initialPlacement:o,placement:g,strategy:i,middlewareData:d,rects:c,platform:a,elements:{reference:t,floating:e}});l=I??l,u=C??u,d[_]={...d[_],...y},x&&h<e9i&&(h++,typeof x=="object"&&(x.placement&&(g=x.placement),x.rects&&(c=x.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):x.rects),{x:l,y:u}=YAn(c,g,A)),p=-1)}return{x:l,y:u,placement:g,strategy:i,middlewareData:d}},n9i=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:i,rects:r,platform:s,elements:a,middlewareData:A}=e,{element:c,padding:l=0}=mS(t,e)||{};if(c==null)return{};const u=GAn(l),g={x:n,y:o},h=IJe(i),d=fJe(h),p=await s.getDimensions(c),m=h==="y",_=m?"top":"left",f=m?"bottom":"right",I=m?"clientHeight":"clientWidth",C=r.reference[d]+r.reference[h]-g[h]-r.floating[d],y=g[h]-r.reference[h],x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let E=x?x[I]:0;(!E||!await(s.isElement==null?void 0:s.isElement(x)))&&(E=a.floating[I]||r.floating[d]);const B=C/2-y/2,S=E/2-p[d]/2-1,Q=CP(u[_],S),w=CP(u[f],S),M=E-p[d]-w,k=E/2-p[d]/2+B,R=LAn(Q,k,M),F=!A.arrow&&eU(i)!=null&&k!==R&&r.reference[d]/2-(k<Q?Q:w)-p[d]/2<0,O=F?k<Q?k-Q:k-M:0;return{[h]:g[h]+O,data:{[h]:R,centerOffset:k-R-O,...F&&{alignmentOffset:O}},reset:F}}}),o9i=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:r,rects:s,initialPlacement:a,platform:A,elements:c}=e,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:g,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:d="none",flipAlignment:p=!0,...m}=mS(t,e);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const _=yP(i),f=T6(a),I=yP(a)===a,C=await(A.isRTL==null?void 0:A.isRTL(c.floating)),y=g||(I||!p?[eme(a)]:JBi(a)),x=d!=="none";!g&&x&&y.push(...qBi(a,p,d,C));const E=[a,...y],B=await A.detectOverflow(e,m),S=[];let Q=((o=r.flip)==null?void 0:o.overflows)||[];if(l&&S.push(B[_]),u){const R=zBi(i,s,C);S.push(B[R[0]],B[R[1]])}if(Q=[...Q,{placement:i,overflows:S}],!S.every(R=>R<=0)){var w,M;const R=(((w=r.flip)==null?void 0:w.index)||0)+1,F=E[R];if(F&&(!(u==="alignment"?f!==T6(F):!1)||Q.every(Y=>T6(Y.placement)===f?Y.overflows[0]>0:!0)))return{data:{index:R,overflows:Q},reset:{placement:F}};let O=(M=Q.filter(U=>U.overflows[0]<=0).sort((U,Y)=>U.overflows[1]-Y.overflows[1])[0])==null?void 0:M.placement;if(!O)switch(h){case"bestFit":{var k;const U=(k=Q.filter(Y=>{if(x){const W=T6(Y.placement);return W===f||W==="y"}return!0}).map(Y=>[Y.placement,Y.overflows.filter(W=>W>0).reduce((W,te)=>W+te,0)]).sort((Y,W)=>Y[1]-W[1])[0])==null?void 0:k[0];U&&(O=U);break}case"initialPlacement":O=a;break}if(i!==O)return{reset:{placement:O}}}return{}}}};function UAn(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function KAn(t){return KBi.some(e=>t[e]>=0)}var i9i=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:o}=e,{strategy:i="referenceHidden",...r}=mS(t,e);switch(i){case"referenceHidden":{const s=await o.detectOverflow(e,{...r,elementContext:"reference"}),a=UAn(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:KAn(a)}}}case"escaped":{const s=await o.detectOverflow(e,{...r,altBoundary:!0}),a=UAn(s,n.floating);return{data:{escapedOffsets:a,escaped:KAn(a)}}}default:return{}}}}},VAn=new Set(["left","top"]);async function r9i(t,e){const{placement:n,platform:o,elements:i}=t,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),s=yP(n),a=eU(n),A=T6(n)==="y",c=VAn.has(s)?-1:1,l=r&&A?-1:1,u=mS(e,t);let{mainAxis:g,crossAxis:h,alignmentAxis:d}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof d=="number"&&(h=a==="end"?d*-1:d),A?{x:h*l,y:g*c}:{x:g*c,y:h*l}}var s9i=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:i,y:r,placement:s,middlewareData:a}=e,A=await r9i(e,t);return s===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:i+A.x,y:r+A.y,data:{...A,placement:s}}}}},a9i=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i,platform:r}=e,{mainAxis:s=!0,crossAxis:a=!1,limiter:A={fn:f=>{let{x:I,y:C}=f;return{x:I,y:C}}},...c}=mS(t,e),l={x:n,y:o},u=await r.detectOverflow(e,c),g=T6(i),h=_Je(g);let d=l[h],p=l[g];const m=(f,I)=>LAn(I+u[f==="y"?"top":"left"],I,I-u[f==="y"?"bottom":"right"]);s&&(d=m(h,d)),a&&(p=m(g,p));const _=A.fn({...e,[h]:d,[g]:p});return{..._,data:{x:_.x-n,y:_.y-o,enabled:{[h]:s,[g]:a}}}}}},A9i=function(t){return t===void 0&&(t={}),{options:t,fn(e){var n,o;const{x:i,y:r,placement:s,rects:a,middlewareData:A}=e,{offset:c=0,mainAxis:l=!0,crossAxis:u=!0}=mS(t,e),g={x:i,y:r},h=T6(s),d=_Je(h);let p=g[d],m=g[h];const _=mS(c,e),f=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:(n=_.mainAxis)!=null?n:0,crossAxis:(o=_.crossAxis)!=null?o:0};if(l){const y=d==="y"?"height":"width",x=a.reference[d]-a.floating[y]+f.mainAxis,E=a.reference[d]+a.reference[y]-f.mainAxis;p<x?p=x:p>E&&(p=E)}if(u){var I,C;const y=d==="y"?"width":"height",x=VAn.has(yP(s)),E=a.reference[h]-a.floating[y]+(x&&((I=A.offset)==null?void 0:I[h])||0)+(x?0:f.crossAxis),B=a.reference[h]+a.reference[y]+(x?0:((C=A.offset)==null?void 0:C[h])||0)-(x?f.crossAxis:0);m<E?m=E:m>B&&(m=B)}return{[d]:p,[h]:m}}}},c9i=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:o,platform:i,elements:r}=e,{apply:s=()=>{},...a}=mS(t,e),A=await i.detectOverflow(e,a),c=yP(n),l=eU(n),u=T6(n)==="y",{width:g,height:h}=o.floating;let d,p;c==="top"||c==="bottom"?(d=c,p=l===(await(i.isRTL==null?void 0:i.isRTL(r.floating))?"start":"end")?"left":"right"):(p=c,d=l==="end"?"top":"bottom");const m=h-A.top-A.bottom,_=g-A.left-A.right,f=CP(h-A[d],m),I=CP(g-A[p],_),C=e.middlewareData.shift,y=!C;let x=f,E=I;C!=null&&C.enabled.x&&(E=_),C!=null&&C.enabled.y&&(x=m),y&&!l&&(u?E=g-2*hS(A.left,A.right):x=h-2*hS(A.top,A.bottom)),await s({...e,availableWidth:E,availableHeight:x});const B=await i.getDimensions(r.floating);return g!==B.width||h!==B.height?{reset:{rects:!0}}:{}}}};function nme(){return typeof window<"u"}function tU(t){return zAn(t)?(t.nodeName||"").toLowerCase():"#document"}function Jx(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function _S(t){var e;return(e=(zAn(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function zAn(t){return nme()?t instanceof Node||t instanceof Jx(t).Node:!1}function k6(t){return nme()?t instanceof Element||t instanceof Jx(t).Element:!1}function xP(t){return nme()?t instanceof HTMLElement||t instanceof Jx(t).HTMLElement:!1}function JAn(t){return!nme()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Jx(t).ShadowRoot}function ome(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=F6(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&i!=="inline"&&i!=="contents"}function l9i(t){return/^(table|td|th)$/.test(tU(t))}function ime(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}var u9i=/transform|translate|scale|rotate|perspective|filter/,g9i=/paint|layout|strict|content/,CT=t=>!!t&&t!=="none",yJe;function xJe(t){const e=k6(t)?F6(t):t;return CT(e.transform)||CT(e.translate)||CT(e.scale)||CT(e.rotate)||CT(e.perspective)||!EJe()&&(CT(e.backdropFilter)||CT(e.filter))||u9i.test(e.willChange||"")||g9i.test(e.contain||"")}function d9i(t){let e=yT(t);for(;xP(e)&&!lZ(e);){if(xJe(e))return e;if(ime(e))return null;e=yT(e)}return null}function EJe(){return yJe==null&&(yJe=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),yJe}function lZ(t){return/^(html|body|#document)$/.test(tU(t))}function F6(t){return Jx(t).getComputedStyle(t)}function rme(t){return k6(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function yT(t){if(tU(t)==="html")return t;const e=t.assignedSlot||t.parentNode||JAn(t)&&t.host||_S(t);return JAn(e)?e.host:e}function WAn(t){const e=yT(t);return lZ(e)?(t.ownerDocument||t).body:xP(e)&&ome(e)?e:WAn(e)}function uZ(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=WAn(t),r=i===((o=t.ownerDocument)==null?void 0:o.body),s=Jx(i);if(r){const a=BJe(s);return e.concat(s,s.visualViewport||[],ome(i)?i:[],a&&n?uZ(a):[])}else return e.concat(i,uZ(i,[],n))}function BJe(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function jAn(t){const e=F6(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=xP(t),r=i?t.offsetWidth:n,s=i?t.offsetHeight:o,a=Xpe(n)!==r||Xpe(o)!==s;return a&&(n=r,o=s),{width:n,height:o,$:a}}function bJe(t){return k6(t)?t:t.contextElement}function nU(t){const e=bJe(t);if(!xP(e))return pS(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:r}=jAn(e);let s=(r?Xpe(n.width):n.width)/o,a=(r?Xpe(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}var h9i=pS(0);function $An(t){const e=Jx(t);return!EJe()||!e.visualViewport?h9i:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function p9i(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===Jx(t)}function xT(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),r=bJe(t);let s=pS(1);e&&(o?k6(o)&&(s=nU(o)):s=nU(t));const a=p9i(r,n,o)?$An(r):pS(0);let A=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,l=i.width/s.x,u=i.height/s.y;if(r&&o){const g=Jx(r),h=k6(o)?Jx(o):o;let d=g,p=BJe(d);for(;p&&h!==d;){const m=nU(p),_=p.getBoundingClientRect(),f=F6(p),I=_.left+(p.clientLeft+parseFloat(f.paddingLeft))*m.x,C=_.top+(p.clientTop+parseFloat(f.paddingTop))*m.y;A*=m.x,c*=m.y,l*=m.x,u*=m.y,A+=I,c+=C,d=Jx(p),p=BJe(d)}}return tme({width:l,height:u,x:A,y:c})}function sme(t,e){const n=rme(t).scrollLeft;return e?e.left+n:xT(_S(t)).left+n}function qAn(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-sme(t,n),i=n.top+e.scrollTop;return{x:o,y:i}}function m9i(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const r=i==="fixed",s=_S(o),a=e?ime(e.floating):!1;if(o===s||a&&r)return n;let A={scrollLeft:0,scrollTop:0},c=pS(1);const l=pS(0),u=xP(o);if((u||!r)&&((tU(o)!=="body"||ome(s))&&(A=rme(o)),u)){const h=xT(o);c=nU(o),l.x=h.x+o.clientLeft,l.y=h.y+o.clientTop}const g=s&&!u&&!r?qAn(s,A):pS(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-A.scrollLeft*c.x+l.x+g.x,y:n.y*c.y-A.scrollTop*c.y+l.y+g.y}}function _9i(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function f9i(t){const e=rme(t),n=t.ownerDocument.body,o=hS(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=hS(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let r=-e.scrollLeft+sme(t);const s=-e.scrollTop;return F6(n).direction==="rtl"&&(r+=hS(t.clientWidth,n.clientWidth)-o),{width:o,height:i,x:r,y:s}}var I9i=25;function C9i(t,e,n){n===void 0&&(n="viewport");const o=n==="layoutViewport",i=Jx(t),r=_S(t),s=i.visualViewport;let a=r.clientWidth,A=r.clientHeight,c=0,l=0;if(s){const g=!EJe()||e==="fixed";o?g||(c=-s.offsetLeft,l=-s.offsetTop):(a=s.width,A=s.height,g&&(c=s.offsetLeft,l=s.offsetTop))}if(sme(r)<=0){const g=r.ownerDocument,h=g.body,d=getComputedStyle(h),p=g.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,m=Math.abs(r.clientWidth-h.clientWidth-p),_=getComputedStyle(r).scrollbarGutter==="stable both-edges"?m/2:m;_<=I9i&&(a-=_)}return{width:a,height:A,x:c,y:l}}function y9i(t,e){const n=xT(t,!0,e==="fixed"),o=n.top+t.clientTop,i=n.left+t.clientLeft,r=nU(t),s=t.clientWidth*r.x,a=t.clientHeight*r.y,A=i*r.x,c=o*r.y;return{width:s,height:a,x:A,y:c}}function XAn(t,e,n){let o;if(e==="viewport"||e==="layoutViewport")o=C9i(t,n,e);else if(e==="document")o=f9i(_S(t));else if(k6(e))o=y9i(e,n);else{const i=$An(t);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return tme(o)}function x9i(t,e){const n=e.get(t);if(n)return n;let o=uZ(t,[],!1).filter(a=>k6(a)&&tU(a)!=="body"),i=null;const r=F6(t).position==="fixed";let s=r?yT(t):t;for(;k6(s)&&!lZ(s);){const a=F6(s),A=xJe(s),c=i?i.position:r?"fixed":"";!A&&(c==="fixed"||c==="absolute"&&a.position==="static")?o=o.filter(u=>u!==s):i=a,s=yT(s)}return e.set(t,o),o}function E9i(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const s=[...n==="clippingAncestors"?ime(e)?[]:x9i(e,this._c):[].concat(n),o],a=XAn(e,s[0],i);let A=a.top,c=a.right,l=a.bottom,u=a.left;for(let g=1;g<s.length;g++){const h=XAn(e,s[g],i);A=hS(h.top,A),c=CP(h.right,c),l=CP(h.bottom,l),u=hS(h.left,u)}return{width:c-u,height:l-A,x:u,y:A}}function B9i(t){const{width:e,height:n}=jAn(t);return{width:e,height:n}}function b9i(t,e,n){const o=xP(e),i=_S(e),r=n==="fixed",s=xT(t,!0,r,e);let a={scrollLeft:0,scrollTop:0};const A=pS(0);if((o||!r)&&((tU(e)!=="body"||ome(i))&&(a=rme(e)),o)){const g=xT(e,!0,r,e);A.x=g.x+e.clientLeft,A.y=g.y+e.clientTop}!o&&i&&(A.x=sme(i));const c=i&&!o&&!r?qAn(i,a):pS(0),l=s.left+a.scrollLeft-A.x-c.x,u=s.top+a.scrollTop-A.y-c.y;return{x:l,y:u,width:s.width,height:s.height}}function SJe(t){return F6(t).position==="static"}function ZAn(t,e){if(!xP(t)||F6(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return _S(t)===n&&(n=n.ownerDocument.body),n}function ecn(t,e){const n=Jx(t);if(ime(t))return n;if(!xP(t)){let i=yT(t);for(;i&&!lZ(i);){if(k6(i)&&!SJe(i))return i;i=yT(i)}return n}let o=ZAn(t,e);for(;o&&l9i(o)&&SJe(o);)o=ZAn(o,e);return o&&lZ(o)&&SJe(o)&&!xJe(o)?n:o||d9i(t)||n}var S9i=async function(t){const e=this.getOffsetParent||ecn,n=this.getDimensions,o=await n(t.floating);return{reference:b9i(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Q9i(t){return F6(t).direction==="rtl"}var v9i={convertOffsetParentRelativeRectToViewportRelativeRect:m9i,getDocumentElement:_S,getClippingRect:E9i,getOffsetParent:ecn,getElementRects:S9i,getClientRects:_9i,getDimensions:B9i,getScale:nU,isElement:k6,isRTL:Q9i};function tcn(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function w9i(t,e,n){let o=null,i;const r=_S(t);function s(){var l;clearTimeout(i),(l=o)==null||l.disconnect(),o=null}function a(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),s();const g=t.getBoundingClientRect(),{left:h,top:d,width:p,height:m}=g;if(l||e(),!p||!m)return;const _=Zpe(d),f=Zpe(r.clientWidth-(h+p)),I=Zpe(r.clientHeight-(d+m)),C=Zpe(h),x={rootMargin:-_+"px "+-f+"px "+-I+"px "+-C+"px",threshold:hS(0,CP(1,u))||1};let E=!0;function B(S){const Q=S[0].intersectionRatio;if(!tcn(g,t.getBoundingClientRect()))return a();if(Q!==u){if(!E)return a();Q?a(!1,Q):i=setTimeout(()=>{a(!1,1e-7)},1e3)}E=!1}try{o=new IntersectionObserver(B,{...x,root:r.ownerDocument})}catch{o=new IntersectionObserver(B,x)}o.observe(t)}const A=Jx(t),c=()=>a(n);return A.addEventListener("resize",c),a(!0),()=>{A.removeEventListener("resize",c),s()}}function P9i(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:A=!1}=o,c=bJe(t),l=i||r?[...c?uZ(c):[],...e?uZ(e):[]]:[];l.forEach(_=>{i&&_.addEventListener("scroll",n),r&&_.addEventListener("resize",n)});const u=c&&a?w9i(c,n,r):null;let g=-1,h=null;s&&(h=new ResizeObserver(_=>{let[f]=_;f&&f.target===c&&h&&e&&(h.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var I;(I=h)==null||I.observe(e)})),n()}),c&&!A&&h.observe(c),e&&h.observe(e));let d,p=A?xT(t):null;A&&m();function m(){const _=xT(t);p&&!tcn(p,_)&&n(),p=_,d=requestAnimationFrame(m)}return n(),()=>{var _;l.forEach(f=>{i&&f.removeEventListener("scroll",n),r&&f.removeEventListener("resize",n)}),u?.(),(_=h)==null||_.disconnect(),h=null,A&&cancelAnimationFrame(d)}}var M9i=s9i,D9i=a9i,N9i=o9i,R9i=c9i,T9i=i9i,ncn=n9i,k9i=A9i,F9i=(t,e,n)=>{const o=new Map,i=n??{},r={...v9i,...i.platform,_c:o};return t9i(t,e,{...i,platform:r})},L9i=typeof document<"u",H9i=function(){},ame=L9i?ee.useLayoutEffect:H9i;function Ame(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,o,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;o--!==0;)if(!Ame(t[o],e[o]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(e,i[o]))return!1;for(o=n;o--!==0;){const r=i[o];if(!(r==="_owner"&&t.$$typeof)&&!Ame(t[r],e[r]))return!1}return!0}return t!==t&&e!==e}function ocn(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function icn(t,e){const n=ocn(t);return Math.round(e*n)/n}function QJe(t){const e=ee.useRef(t);return ame(()=>{e.current=t}),e}function O9i(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:r,floating:s}={},transform:a=!0,whileElementsMounted:A,open:c}=t,[l,u]=ee.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,h]=ee.useState(o);Ame(g,o)||h(o);const[d,p]=ee.useState(null),[m,_]=ee.useState(null),f=ee.useCallback(Y=>{Y!==x.current&&(x.current=Y,p(Y))},[]),I=ee.useCallback(Y=>{Y!==E.current&&(E.current=Y,_(Y))},[]),C=r||d,y=s||m,x=ee.useRef(null),E=ee.useRef(null),B=ee.useRef(l),S=A!=null,Q=QJe(A),w=QJe(i),M=QJe(c),k=ee.useCallback(()=>{if(!x.current||!E.current)return;const Y={placement:e,strategy:n,middleware:g};w.current&&(Y.platform=w.current),F9i(x.current,E.current,Y).then(W=>{const te={...W,isPositioned:M.current!==!1};R.current&&!Ame(B.current,te)&&(B.current=te,c6.flushSync(()=>{u(te)}))})},[g,e,n,w,M]);ame(()=>{c===!1&&B.current.isPositioned&&(B.current.isPositioned=!1,u(Y=>({...Y,isPositioned:!1})))},[c]);const R=ee.useRef(!1);ame(()=>(R.current=!0,()=>{R.current=!1}),[]),ame(()=>{if(C&&(x.current=C),y&&(E.current=y),C&&y){if(Q.current)return Q.current(C,y,k);k()}},[C,y,k,Q,S]);const F=ee.useMemo(()=>({reference:x,floating:E,setReference:f,setFloating:I}),[f,I]),O=ee.useMemo(()=>({reference:C,floating:y}),[C,y]),U=ee.useMemo(()=>{const Y={position:n,left:0,top:0};if(!O.floating)return Y;const W=icn(O.floating,l.x),te=icn(O.floating,l.y);return a?{...Y,transform:"translate("+W+"px, "+te+"px)",...ocn(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:te}},[n,a,O.floating,l.x,l.y]);return ee.useMemo(()=>({...l,update:k,refs:F,elements:O,floatingStyles:U}),[l,k,F,O,U])}var G9i=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:o,padding:i}=typeof t=="function"?t(n):t;return o&&e(o)?o.current!=null?ncn({element:o.current,padding:i}).fn(n):{}:o?ncn({element:o,padding:i}).fn(n):{}}}},Y9i=(t,e)=>{const n=M9i(t);return{name:n.name,fn:n.fn,options:[t,e]}},U9i=(t,e)=>{const n=D9i(t);return{name:n.name,fn:n.fn,options:[t,e]}},K9i=(t,e)=>({fn:k9i(t).fn,options:[t,e]}),V9i=(t,e)=>{const n=N9i(t);return{name:n.name,fn:n.fn,options:[t,e]}},z9i=(t,e)=>{const n=R9i(t);return{name:n.name,fn:n.fn,options:[t,e]}},J9i=(t,e)=>{const n=T9i(t);return{name:n.name,fn:n.fn,options:[t,e]}},W9i=(t,e)=>{const n=G9i(t);return{name:n.name,fn:n.fn,options:[t,e]}},j9i=Object.defineProperty,$9i=(t,e)=>j9i(t,"name",{value:e,configurable:!0});function rcn(t){const[e,n]=ee.useState(void 0);return XB(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const o=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const r=i[0];let s,a;if("borderBoxSize"in r){const A=r.borderBoxSize,c=Array.isArray(A)?A[0]:A;s=c.inlineSize,a=c.blockSize}else s=t.offsetWidth,a=t.offsetHeight;n({width:s,height:a})});return o.observe(t,{box:"border-box"}),()=>o.unobserve(t)}else n(void 0)},[t]),e}$9i(rcn,"useSize");var q9i=Object.defineProperty,EP=(t,e)=>q9i(t,"name",{value:e,configurable:!0}),scn="Popper",[acn,Acn]=fT(scn),[X9i,ccn]=acn(scn),Z9i=EP(t=>{const{__scopePopper:e,children:n}=t,[o,i]=ee.useState(null),[r,s]=ee.useState(void 0);return K.jsx(X9i,{scope:e,anchor:o,onAnchorChange:i,placementState:r,setPlacementState:s,children:n})},"Popper"),e7i="PopperAnchor",t7i=ee.forwardRef(EP(function(e,n){const{__scopePopper:o,virtualRef:i,...r}=e,s=ccn(e7i,o),a=ee.useRef(null),A=s.onAnchorChange,c=ee.useCallback(p=>{a.current=p,p&&A(p)},[A]),l=hf(n,c),u=ee.useRef(null);ee.useEffect(()=>{if(!i)return;const p=u.current;u.current=i.current,p!==u.current&&A(u.current)});const g=s.placementState&&cme(s.placementState),h=g?.[0],d=g?.[1];return i?null:K.jsx(N6.div,{"data-radix-popper-side":h,"data-radix-popper-align":d,...r,ref:l})},"PopperAnchor")),lcn="PopperContent",[n7i,Npr]=acn(lcn),o7i=ee.forwardRef(EP(function(e,n){const{__scopePopper:o,side:i="bottom",sideOffset:r=0,align:s="center",alignOffset:a=0,arrowPadding:A=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:g="partial",hideWhenDetached:h=!1,updatePositionStrategy:d="optimized",onPlaced:p,...m}=e,_=ccn(lcn,o),[f,I]=ee.useState(null),C=hf(n,I),[y,x]=ee.useState(null),E=rcn(y),B=E?.width??0,S=E?.height??0,Q=i+(s!=="center"?"-"+s:""),w=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},M=Array.isArray(l)?l:[l],k=M.length>0,R={padding:w,boundary:M.filter(ucn),altBoundary:k},{refs:F,floatingStyles:O,placement:U,isPositioned:Y,middlewareData:W}=O9i({strategy:"fixed",placement:Q,whileElementsMounted:EP((...ue)=>P9i(...ue,{animationFrame:d==="always"}),"whileElementsMounted"),elements:{reference:_.anchor},middleware:[Y9i({mainAxis:r+S,alignmentAxis:a}),c&&U9i({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?K9i():void 0,...R}),c&&V9i({...R}),z9i({...R,apply:EP(({elements:ue,rects:fe,availableWidth:pe,availableHeight:ye})=>{const{width:Me,height:ve}=fe.reference,he=ue.floating.style;he.setProperty("--radix-popper-available-width",`${pe}px`),he.setProperty("--radix-popper-available-height",`${ye}px`),he.setProperty("--radix-popper-anchor-width",`${Me}px`),he.setProperty("--radix-popper-anchor-height",`${ve}px`)},"apply")}),y&&W9i({element:y,padding:A}),i7i({arrowWidth:B,arrowHeight:S}),h&&J9i({strategy:"referenceHidden",...R,boundary:k?R.boundary:void 0})]}),te=_.setPlacementState;XB(()=>(te(U),()=>{te(void 0)}),[U,te]);const[j,J]=cme(U),oe=R6(p);XB(()=>{Y&&oe?.()},[Y,oe]);const ie=W.arrow?.x,ne=W.arrow?.y,le=W.arrow?.centerOffset!==0,[ge,_e]=ee.useState();return XB(()=>{f&&_e(window.getComputedStyle(f).zIndex)},[f]),K.jsx("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...O,transform:Y?O.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ge,"--radix-popper-transform-origin":[W.transformOrigin?.x,W.transformOrigin?.y].join(" "),...W.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:K.jsx(n7i,{scope:o,placedSide:j,placedAlign:J,onArrowChange:x,arrowX:ie,arrowY:ne,shouldHideArrow:le,children:K.jsx(N6.div,{"data-side":j,"data-align":J,...m,ref:C,style:{...m.style,animation:Y?m.style?.animation:"none"}})})})},"PopperContent"));function ucn(t){return t!==null}EP(ucn,"isNotNull");var i7i=EP(t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:o,middlewareData:i}=e,s=i.arrow?.centerOffset!==0,a=s?0:t.arrowWidth,A=s?0:t.arrowHeight,[c,l]=cme(n),u={start:"0%",center:"50%",end:"100%"}[l],g=(i.arrow?.x??0)+a/2,h=(i.arrow?.y??0)+A/2;let d="",p="";return c==="bottom"?(d=s?u:`${g}px`,p=`${-A}px`):c==="top"?(d=s?u:`${g}px`,p=`${o.floating.height+A}px`):c==="right"?(d=`${-A}px`,p=s?u:`${h}px`):c==="left"&&(d=`${o.floating.width+A}px`,p=s?u:`${h}px`),{data:{x:d,y:p}}}}),"transformOrigin");function cme(t){const[e,n="center"]=t.split("-");return[e,n]}EP(cme,"getSideAndAlignFromPlacement");var gcn=Z9i,r7i=t7i,s7i=o7i,a7i=Object.defineProperty,A7i=(t,e)=>a7i(t,"name",{value:e,configurable:!0}),c7i=ee.forwardRef(A7i(function(e,n){const{container:o,...i}=e,[r,s]=ee.useState(!1);XB(()=>s(!0),[]);const a=o||r&&globalThis?.document?.body;return a?c6.createPortal(K.jsx(N6.div,{...i,ref:n}),a):null},"Portal")),l7i=Object.defineProperty,fS=(t,e)=>l7i(t,"name",{value:e,configurable:!0});function dcn(t,e){return ee.useReducer((n,o)=>e[n][o]??n,t)}fS(dcn,"useStateMachine");var vJe=fS(t=>{const{present:e,children:n}=t,o=hcn(e),i=typeof n=="function"?n({present:o.isPresent}):ee.Children.only(n),r=pcn(o.ref,mcn(i));return typeof n=="function"||o.isPresent?ee.cloneElement(i,{ref:r}):null},"Presence");function hcn(t){const[e,n]=ee.useState(),o=ee.useRef(null),i=ee.useRef(t),r=ee.useRef("none"),s=ee.useRef(void 0),a=t?"mounted":"unmounted",[A,c]=dcn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return ee.useEffect(()=>{A==="mounted"?(r.current=s.current??oU(o.current),s.current=void 0):r.current="none"},[A]),XB(()=>{const l=o.current,u=i.current;if(u!==t){const h=r.current,d=oU(l);t?(s.current=d,c("MOUNT")):d==="none"||l?.display==="none"?c("UNMOUNT"):c(u&&h!==d?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,c]),XB(()=>{if(e){let l;const u=e.ownerDocument.defaultView??window,g=fS(d=>{const m=oU(o.current).includes(CSS.escape(d.animationName));if(d.target===e&&m&&(c("ANIMATION_END"),!i.current)){const _=e.style.animationFillMode;e.style.animationFillMode="forwards",l=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=_)})}},"handleAnimationEnd"),h=fS(d=>{d.target===e&&(r.current=oU(o.current))},"handleAnimationStart");return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",g),e.addEventListener("animationend",g),()=>{u.clearTimeout(l),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",g),e.removeEventListener("animationend",g)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(A),ref:ee.useCallback(l=>{if(l){const u=getComputedStyle(l);o.current=u,s.current=oU(u)}else o.current=null;n(l)},[])}}fS(hcn,"usePresence");function wJe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}fS(wJe,"setRef");function pcn(...t){const e=ee.useRef(t);return e.current=t,ee.useCallback(n=>{const o=e.current;let i=!1;const r=o.map(s=>{const a=wJe(s,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let s=0;s<r.length;s++){const a=r[s];typeof a=="function"?a():wJe(o[s],null)}}},[])}fS(pcn,"useStableComposedRefs");function oU(t){return t?.animationName||"none"}fS(oU,"getAnimationName");function mcn(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}fS(mcn,"getElementRef");var u7i=Object.defineProperty,PJe=(t,e)=>u7i(t,"name",{value:e,configurable:!0}),MJe=!1;function _cn(){const[t,e]=ee.useState(MJe);return ee.useEffect(()=>{MJe||(MJe=!0,e(!0))},[]),t}PJe(_cn,"useIsHydrated");var fcn=Q5[" useSyncExternalStore ".trim().toString()];function Icn(){return()=>{}}PJe(Icn,"subscribe");function Ccn(){return fcn(Icn,()=>!0,()=>!1)}PJe(Ccn,"useIsHydratedModern");var g7i=typeof fcn=="function"?Ccn:_cn,d7i=Object.defineProperty,ET=(t,e)=>d7i(t,"name",{value:e,configurable:!0}),DJe="rovingFocusGroup.onEntryFocus",h7i={bubbles:!1,cancelable:!0},lme="RovingFocusGroup",[NJe,ycn,p7i]=tJe(lme),[m7i,xcn]=fT(lme,[p7i]),[_7i,f7i]=m7i(lme),I7i=ee.forwardRef(ET(function(e,n){return K.jsx(NJe.Provider,{scope:e.__scopeRovingFocusGroup,children:K.jsx(NJe.Slot,{scope:e.__scopeRovingFocusGroup,children:K.jsx(C7i,{...e,ref:n})})})},"RovingFocusGroup")),C7i=ee.forwardRef(ET(function(e,n){const{__scopeRovingFocusGroup:o,orientation:i,loop:r=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:A,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...g}=e,h=ee.useRef(null),d=hf(n,h),p=rJe(s),[m,_]=Wpe({prop:a,defaultProp:A??null,onChange:c,caller:lme}),[f,I]=ee.useState(!1),C=R6(l),y=ycn(o),x=ee.useRef(!1),[E,B]=ee.useState(0);return ee.useEffect(()=>{const S=h.current;if(S)return S.addEventListener(DJe,C),()=>S.removeEventListener(DJe,C)},[C]),K.jsx(_7i,{scope:o,orientation:i,dir:p,loop:r,currentTabStopId:m,onItemFocus:ee.useCallback(S=>_(S),[_]),onItemShiftTab:ee.useCallback(()=>I(!0),[]),onFocusableItemAdd:ee.useCallback(()=>B(S=>S+1),[]),onFocusableItemRemove:ee.useCallback(()=>B(S=>S-1),[]),children:K.jsx(N6.div,{tabIndex:f||E===0?-1:0,"data-orientation":i,...g,ref:d,style:{outline:"none",...e.style},onMouseDown:El(e.onMouseDown,()=>{x.current=!0}),onFocus:El(e.onFocus,S=>{const Q=!x.current;if(S.target===S.currentTarget&&Q&&!f){const w=new CustomEvent(DJe,h7i);if(S.currentTarget.dispatchEvent(w),!w.defaultPrevented){const M=y().filter(U=>U.focusable),k=M.find(U=>U.active),R=M.find(U=>U.id===m),O=[k,R,...M].filter(Boolean).map(U=>U.ref.current);RJe(O,u)}}x.current=!1}),onBlur:El(e.onBlur,()=>I(!1))})})},"RovingFocusGroupImpl")),y7i="RovingFocusGroupItem",x7i=ee.forwardRef(ET(function(e,n){const{__scopeRovingFocusGroup:o,focusable:i=!0,active:r=!1,tabStopId:s,children:a,...A}=e,c=ZY(),l=s||c,u=f7i(y7i,o),g=u.currentTabStopId===l,h=ycn(o),{onFocusableItemAdd:d,onFocusableItemRemove:p,currentTabStopId:m}=u,_=g7i();return XB(()=>{if(!(!_||!i))return d(),()=>p()},[_,i,d,p]),ee.useEffect(()=>{if(!(_||!i))return d(),()=>p()},[_,i,d,p]),K.jsx(NJe.ItemSlot,{scope:o,id:l,focusable:i,active:r,children:K.jsx(N6.span,{tabIndex:g?0:-1,"data-orientation":u.orientation,...A,ref:n,onMouseDown:El(e.onMouseDown,f=>{i?u.onItemFocus(l):f.preventDefault()}),onFocus:El(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:El(e.onKeyDown,f=>{if(f.key==="Tab"&&f.shiftKey){u.onItemShiftTab();return}if(f.target!==f.currentTarget)return;const I=Bcn(f,u.orientation,u.dir);if(I!==void 0){if(f.metaKey||f.ctrlKey||f.altKey||f.shiftKey)return;f.preventDefault();let y=h().filter(x=>x.focusable).map(x=>x.ref.current);if(I==="last")y.reverse();else if(I==="prev"||I==="next"){I==="prev"&&y.reverse();const x=y.indexOf(f.currentTarget);y=u.loop?bcn(y,x+1):y.slice(x+1)}setTimeout(()=>RJe(y))}}),children:typeof a=="function"?a({isCurrentTabStop:g,hasTabStop:m!=null}):a})})},"RovingFocusGroupItem")),E7i={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ecn(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}ET(Ecn,"getDirectionAwareKey");function Bcn(t,e,n){const o=Ecn(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return E7i[o]}ET(Bcn,"getFocusIntent");function RJe(t,e=!1){const n=document.activeElement;for(const o of t)if(o===n||(o.focus({preventScroll:e}),document.activeElement!==n))return}ET(RJe,"focusFirst");function bcn(t,e){return t.map((n,o)=>t[(e+o)%t.length])}ET(bcn,"wrapArray");var B7i=I7i,b7i=x7i,S7i=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},iU=new WeakMap,ume=new WeakMap,gme={},TJe=0,Scn=function(t){return t&&(t.host||Scn(t.parentNode))},Q7i=function(t,e){return e.map(function(n){if(t.contains(n))return n;var o=Scn(n);return o&&t.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},v7i=function(t,e,n,o){var i=Q7i(e,Array.isArray(t)?t:[t]);gme[n]||(gme[n]=new WeakMap);var r=gme[n],s=[],a=new Set,A=new Set(i),c=function(u){!u||a.has(u)||(a.add(u),c(u.parentNode))};i.forEach(c);var l=function(u){!u||A.has(u)||Array.prototype.forEach.call(u.children,function(g){if(a.has(g))l(g);else try{var h=g.getAttribute(o),d=h!==null&&h!=="false",p=(iU.get(g)||0)+1,m=(r.get(g)||0)+1;iU.set(g,p),r.set(g,m),s.push(g),p===1&&d&&ume.set(g,!0),m===1&&g.setAttribute(n,"true"),d||g.setAttribute(o,"true")}catch(_){console.error("aria-hidden: cannot operate on ",g,_)}})};return l(e),a.clear(),TJe++,function(){s.forEach(function(u){var g=iU.get(u)-1,h=r.get(u)-1;iU.set(u,g),r.set(u,h),g||(ume.has(u)||u.removeAttribute(o),ume.delete(u)),h||u.removeAttribute(n)}),TJe--,TJe||(iU=new WeakMap,iU=new WeakMap,ume=new WeakMap,gme={})}},w7i=function(t,e,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(t)?t:[t]),i=S7i(t);return i?(o.push.apply(o,Array.from(i.querySelectorAll("[aria-live], script"))),v7i(o,i,n,"aria-hidden")):function(){return null}},L6=function(){return L6=Object.assign||function(e){for(var n,o=1,i=arguments.length;o<i;o++){n=arguments[o];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},L6.apply(this,arguments)};function Qcn(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,o=Object.getOwnPropertySymbols(t);i<o.length;i++)e.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(t,o[i])&&(n[o[i]]=t[o[i]]);return n}function P7i(t,e,n){for(var o=0,i=e.length,r;o<i;o++)(r||!(o in e))&&(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}var dme="right-scroll-bar-position",hme="width-before-scroll-bar",M7i="with-scroll-bars-hidden",D7i="--removed-body-scroll-bar-size";function kJe(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function N7i(t,e){var n=ee.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(o){var i=n.value;i!==o&&(n.value=o,n.callback(o,i))}}}})[0];return n.callback=e,n.facade}var R7i=typeof window<"u"?ee.useLayoutEffect:ee.useEffect,vcn=new WeakMap;function T7i(t,e){var n=N7i(null,function(o){return t.forEach(function(i){return kJe(i,o)})});return R7i(function(){var o=vcn.get(n);if(o){var i=new Set(o),r=new Set(t),s=n.current;i.forEach(function(a){r.has(a)||kJe(a,null)}),r.forEach(function(a){i.has(a)||kJe(a,s)})}vcn.set(n,t)},[t]),n}function k7i(t){return t}function F7i(t,e){e===void 0&&(e=k7i);var n=[],o=!1,i={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(r){var s=e(r,o);return n.push(s),function(){n=n.filter(function(a){return a!==s})}},assignSyncMedium:function(r){for(o=!0;n.length;){var s=n;n=[],s.forEach(r)}n={push:function(a){return r(a)},filter:function(){return n}}},assignMedium:function(r){o=!0;var s=[];if(n.length){var a=n;n=[],a.forEach(r),s=n}var A=function(){var l=s;s=[],l.forEach(r)},c=function(){return Promise.resolve().then(A)};c(),n={push:function(l){s.push(l),c()},filter:function(l){return s=s.filter(l),n}}}};return i}function L7i(t){t===void 0&&(t={});var e=F7i(null);return e.options=L6({async:!0,ssr:!1},t),e}var wcn=function(t){var e=t.sideCar,n=Qcn(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=e.read();if(!o)throw new Error("Sidecar medium not found");return ee.createElement(o,L6({},n))};wcn.isSideCarExport=!0;function H7i(t,e){return t.useMedium(e),wcn}var Pcn=L7i(),FJe=function(){},pme=ee.forwardRef(function(t,e){var n=ee.useRef(null),o=ee.useState({onScrollCapture:FJe,onWheelCapture:FJe,onTouchMoveCapture:FJe}),i=o[0],r=o[1],s=t.forwardProps,a=t.children,A=t.className,c=t.removeScrollBar,l=t.enabled,u=t.shards,g=t.sideCar,h=t.noRelative,d=t.noIsolation,p=t.inert,m=t.allowPinchZoom,_=t.as,f=_===void 0?"div":_,I=t.gapMode,C=Qcn(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),y=g,x=T7i([n,e]),E=L6(L6({},C),i);return ee.createElement(ee.Fragment,null,l&&ee.createElement(y,{sideCar:Pcn,removeScrollBar:c,shards:u,noRelative:h,noIsolation:d,inert:p,setCallbacks:r,allowPinchZoom:!!m,lockRef:n,gapMode:I}),s?ee.cloneElement(ee.Children.only(a),L6(L6({},E),{ref:x})):ee.createElement(f,L6({},E,{className:A,ref:x}),a))});pme.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},pme.classNames={fullWidth:hme,zeroRight:dme};var O7i=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function G7i(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=O7i();return e&&t.setAttribute("nonce",e),t}function Y7i(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function U7i(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var K7i=function(){var t=0,e=null;return{add:function(n){t==0&&(e=G7i())&&(Y7i(e,n),U7i(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},V7i=function(){var t=K7i();return function(e,n){ee.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},Mcn=function(){var t=V7i(),e=function(n){var o=n.styles,i=n.dynamic;return t(o,i),null};return e},z7i={left:0,top:0,right:0,gap:0},LJe=function(t){return parseInt(t||"",10)||0},J7i=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],o=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[LJe(n),LJe(o),LJe(i)]},W7i=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return z7i;var e=J7i(t),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,o-n+e[2]-e[0])}},j7i=Mcn(),rU="data-scroll-locked",$7i=function(t,e,n,o){var i=t.left,r=t.top,s=t.right,a=t.gap;return n===void 0&&(n="margin"),`
.`.concat(M7i,` {
overflow: hidden `).concat(o,`;
padding-right: `).concat(a,"px ").concat(o,`;
}
body[`).concat(rU,`] {
overflow: hidden `).concat(o,`;
overscroll-behavior: contain;
`).concat([e&&"position: relative ".concat(o,";"),n==="margin"&&`
padding-left: `.concat(i,`px;
padding-top: `).concat(r,`px;
padding-right: `).concat(s,`px;
margin-left:0;
margin-top:0;
margin-right: `).concat(a,"px ").concat(o,`;
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(o,";")].filter(Boolean).join(""),`
}
.`).concat(dme,` {
right: `).concat(a,"px ").concat(o,`;
}
.`).concat(hme,` {
margin-right: `).concat(a,"px ").concat(o,`;
}
.`).concat(dme," .").concat(dme,` {
right: 0 `).concat(o,`;
}
.`).concat(hme," .").concat(hme,` {
margin-right: 0 `).concat(o,`;
}
body[`).concat(rU,`] {
`).concat(D7i,": ").concat(a,`px;
}
`)},Dcn=function(){var t=parseInt(document.body.getAttribute(rU)||"0",10);return isFinite(t)?t:0},q7i=function(){ee.useEffect(function(){return document.body.setAttribute(rU,(Dcn()+1).toString()),function(){var t=Dcn()-1;t<=0?document.body.removeAttribute(rU):document.body.setAttribute(rU,t.toString())}},[])},X7i=function(t){var e=t.noRelative,n=t.noImportant,o=t.gapMode,i=o===void 0?"margin":o;q7i();var r=ee.useMemo(function(){return W7i(i)},[i]);return ee.createElement(j7i,{styles:$7i(r,!e,i,n?"":"!important")})},HJe=!1;if(typeof window<"u")try{gZ=Object.defineProperty({},"passive",{get:function(){return HJe=!0,!0}}),window.addEventListener("test",gZ,gZ),window.removeEventListener("test",gZ,gZ)}catch{HJe=!1}var gZ,sU=HJe?{passive:!1}:!1,Z7i=function(t){return t.tagName==="TEXTAREA"},Ncn=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!Z7i(t)&&n[e]==="visible")},e6i=function(t){return Ncn(t,"overflowY")},t6i=function(t){return Ncn(t,"overflowX")},Rcn=function(t,e){var n=e.ownerDocument,o=e;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var i=Tcn(t,o);if(i){var r=kcn(t,o),s=r[1],a=r[2];if(s>a)return!0}o=o.parentNode}while(o&&o!==n.body);return!1},n6i=function(t){var e=t.scrollTop,n=t.scrollHeight,o=t.clientHeight;return[e,n,o]},o6i=function(t){var e=t.scrollLeft,n=t.scrollWidth,o=t.clientWidth;return[e,n,o]},Tcn=function(t,e){return t==="v"?e6i(e):t6i(e)},kcn=function(t,e){return t==="v"?n6i(e):o6i(e)},i6i=function(t,e){return t==="h"&&e==="rtl"?-1:1},r6i=function(t,e,n,o,i){var r=i6i(t,window.getComputedStyle(e).direction),s=r*o,a=n.target,A=e.contains(a),c=!1,l=s>0,u=0,g=0;do{if(!a)break;var h=kcn(t,a),d=h[0],p=h[1],m=h[2],_=p-m-r*d;(d||_)&&Tcn(t,a)&&(u+=_,g+=d);var f=a.parentNode;a=f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE?f.host:f}while(!A&&a!==document.body||A&&(e.contains(a)||e===a));return(l&&Math.abs(u)<1||!l&&Math.abs(g)<1)&&(c=!0),c},mme=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Fcn=function(t){return[t.deltaX,t.deltaY]},Lcn=function(t){return t&&"current"in t?t.current:t},s6i=function(t,e){return t[0]===e[0]&&t[1]===e[1]},a6i=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},A6i=0,aU=[];function c6i(t){var e=ee.useRef([]),n=ee.useRef([0,0]),o=ee.useRef(),i=ee.useState(A6i++)[0],r=ee.useState(Mcn)[0],s=ee.useRef(t);ee.useEffect(function(){s.current=t},[t]),ee.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var p=P7i([t.lockRef.current],(t.shards||[]).map(Lcn)).filter(Boolean);return p.forEach(function(m){return m.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),p.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=ee.useCallback(function(p,m){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!s.current.allowPinchZoom;var _=mme(p),f=n.current,I="deltaX"in p?p.deltaX:f[0]-_[0],C="deltaY"in p?p.deltaY:f[1]-_[1],y,x=p.target,E=Math.abs(I)>Math.abs(C)?"h":"v";if("touches"in p&&E==="h"&&x.type==="range")return!1;var B=window.getSelection(),S=B&&B.anchorNode,Q=S?S===x||S.contains(x):!1;if(Q)return!1;var w=Rcn(E,x);if(!w)return!0;if(w?y=E:(y=E==="v"?"h":"v",w=Rcn(E,x)),!w)return!1;if(!o.current&&"changedTouches"in p&&(I||C)&&(o.current=y),!y)return!0;var M=o.current||y;return r6i(M,m,p,M==="h"?I:C)},[]),A=ee.useCallback(function(p){var m=p;if(!(!aU.length||aU[aU.length-1]!==r)){var _="deltaY"in m?Fcn(m):mme(m),f=e.current.filter(function(y){return y.name===m.type&&(y.target===m.target||m.target===y.shadowParent)&&s6i(y.delta,_)})[0];if(f&&f.should){m.cancelable&&m.preventDefault();return}if(!f){var I=(s.current.shards||[]).map(Lcn).filter(Boolean).filter(function(y){return y.contains(m.target)}),C=I.length>0?a(m,I[0]):!s.current.noIsolation;C&&m.cancelable&&m.preventDefault()}}},[]),c=ee.useCallback(function(p,m,_,f){var I={name:p,delta:m,target:_,should:f,shadowParent:l6i(_)};e.current.push(I),setTimeout(function(){e.current=e.current.filter(function(C){return C!==I})},1)},[]),l=ee.useCallback(function(p){n.current=mme(p),o.current=void 0},[]),u=ee.useCallback(function(p){c(p.type,Fcn(p),p.target,a(p,t.lockRef.current))},[]),g=ee.useCallback(function(p){c(p.type,mme(p),p.target,a(p,t.lockRef.current))},[]);ee.useEffect(function(){return aU.push(r),t.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:g}),document.addEventListener("wheel",A,sU),document.addEventListener("touchmove",A,sU),document.addEventListener("touchstart",l,sU),function(){aU=aU.filter(function(p){return p!==r}),document.removeEventListener("wheel",A,sU),document.removeEventListener("touchmove",A,sU),document.removeEventListener("touchstart",l,sU)}},[]);var h=t.removeScrollBar,d=t.inert;return ee.createElement(ee.Fragment,null,d?ee.createElement(r,{styles:a6i(i)}):null,h?ee.createElement(X7i,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function l6i(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var u6i=H7i(Pcn,c6i),Hcn=ee.forwardRef(function(t,e){return ee.createElement(pme,L6({},t,{ref:e,sideCar:u6i}))});Hcn.classNames=pme.classNames;var g6i=Hcn,d6i=Object.defineProperty,F0=(t,e)=>d6i(t,"name",{value:e,configurable:!0}),OJe=["Enter"," "],h6i=["ArrowDown","PageUp","Home"],Ocn=["ArrowUp","PageDown","End"],p6i=[...h6i,...Ocn],m6i={ltr:[...OJe,"ArrowRight"],rtl:[...OJe,"ArrowLeft"]},_6i={ltr:["ArrowLeft"],rtl:["ArrowRight"]},_me="Menu",[dZ,f6i,I6i]=tJe(_me),[BT,Gcn]=fT(_me,[I6i,Acn,xcn]),fme=Acn(),Ycn=xcn(),[Ucn,BP]=BT(_me),[C6i,hZ]=BT(_me),y6i=F0(t=>{const{__scopeMenu:e,open:n=!1,children:o,dir:i,onOpenChange:r,modal:s=!0}=t,a=fme(e),[A,c]=ee.useState(null),l=ee.useRef(!1),u=R6(r),g=rJe(i);return ee.useEffect(()=>{const h=F0(()=>{l.current=!0,document.addEventListener("pointerdown",d,{capture:!0,once:!0}),document.addEventListener("pointermove",d,{capture:!0,once:!0})},"handleKeyDown"),d=F0(()=>l.current=!1,"handlePointer");return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",d,{capture:!0}),document.removeEventListener("pointermove",d,{capture:!0})}},[]),ee.useEffect(()=>{if(!n)return;const h=F0(()=>u(!1),"handleBlur");return window.addEventListener("blur",h),()=>window.removeEventListener("blur",h)},[n,u]),K.jsx(gcn,{...a,children:K.jsx(Ucn,{scope:e,open:n,onOpenChange:u,content:A,onContentChange:c,children:K.jsx(C6i,{scope:e,onClose:ee.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:l,dir:g,modal:s,children:o})})})},"Menu"),Kcn=ee.forwardRef(F0(function(e,n){const{__scopeMenu:o,...i}=e,r=fme(o);return K.jsx(r7i,{...r,...i,ref:n})},"MenuAnchor")),Vcn="MenuPortal",[x6i,zcn]=BT(Vcn,{forceMount:void 0}),E6i=F0(t=>{const{__scopeMenu:e,forceMount:n,children:o,container:i}=t,r=BP(Vcn,e);return K.jsx(x6i,{scope:e,forceMount:n,children:K.jsx(vJe,{present:n||r.open,children:K.jsx(c7i,{asChild:!0,container:i,children:o})})})},"MenuPortal"),e9="MenuContent",[B6i,GJe]=BT(e9),b6i=ee.forwardRef(F0(function(e,n){const o=zcn(e9,e.__scopeMenu),{forceMount:i=o.forceMount,...r}=e,s=BP(e9,e.__scopeMenu),a=hZ(e9,e.__scopeMenu);return K.jsx(dZ.Provider,{scope:e.__scopeMenu,children:K.jsx(vJe,{present:i||s.open,children:K.jsx(dZ.Slot,{scope:e.__scopeMenu,children:a.modal?K.jsx(S6i,{...r,ref:n}):K.jsx(Q6i,{...r,ref:n})})})})},"MenuContent")),S6i=ee.forwardRef(F0(function(e,n){const o=BP(e9,e.__scopeMenu),i=ee.useRef(null),r=hf(n,i);return ee.useEffect(()=>{const s=i.current;if(s)return w7i(s)},[]),K.jsx(YJe,{...e,ref:r,trapFocus:o.open,disableOutsidePointerEvents:o.open,disableOutsideScroll:!0,onFocusOutside:El(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>o.onOpenChange(!1)})},"MenuRootContentModal")),Q6i=ee.forwardRef(F0(function(e,n){const o=BP(e9,e.__scopeMenu);return K.jsx(YJe,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>o.onOpenChange(!1)})},"MenuRootContentNonModal")),v6i=IT("MenuContent.ScrollLock"),YJe=ee.forwardRef(F0(function(e,n){const{__scopeMenu:o,loop:i=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:A,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:g,onInteractOutside:h,onDismiss:d,disableOutsideScroll:p,...m}=e,_=BP(e9,o),f=hZ(e9,o),I=fme(o),C=Ycn(o),y=f6i(o),[x,E]=ee.useState(null),B=ee.useRef(null),S=hf(n,B,_.onContentChange),Q=ee.useRef(0),w=ee.useRef(""),M=ee.useRef(0),k=ee.useRef(null),R=ee.useRef("right"),F=ee.useRef(0),O=p?g6i:ee.Fragment,U=p?{as:v6i,allowPinchZoom:!0}:void 0,Y=F0(te=>{const j=w.current+te,J=y().filter(_e=>!_e.disabled),oe=document.activeElement,ie=J.find(_e=>_e.ref.current===oe)?.textValue,ne=J.map(_e=>_e.textValue),le=tln(ne,j,ie),ge=J.find(_e=>_e.textValue===le)?.ref.current;F0((function _e(ue){w.current=ue,window.clearTimeout(Q.current),ue!==""&&(Q.current=window.setTimeout(()=>_e(""),1e3))}),"updateSearch")(j),ge&&setTimeout(()=>ge.focus())},"handleTypeaheadSearch");ee.useEffect(()=>()=>window.clearTimeout(Q.current),[]),lJe();const W=ee.useCallback(te=>R.current===k.current?.side&&oln(te,k.current?.area),[]);return K.jsx(B6i,{scope:o,searchRef:w,onItemEnter:ee.useCallback(te=>{W(te)&&te.preventDefault()},[W]),onItemLeave:ee.useCallback(te=>{W(te)||(B.current?.focus(),E(null))},[W]),onTriggerLeave:ee.useCallback(te=>{W(te)&&te.preventDefault()},[W]),pointerGraceTimerRef:M,onPointerGraceIntentChange:ee.useCallback(te=>{k.current=te},[]),children:K.jsx(O,{...U,children:K.jsx(HBi,{asChild:!0,trapped:r,onMountAutoFocus:El(s,te=>{te.preventDefault(),B.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:K.jsx(NBi,{asChild:!0,disableOutsidePointerEvents:A,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:g,onInteractOutside:h,onDismiss:d,children:K.jsx(B7i,{asChild:!0,...C,dir:f.dir,orientation:"vertical",loop:i,currentTabStopId:x,onCurrentTabStopIdChange:E,onEntryFocus:El(c,te=>{f.isUsingKeyboardRef.current||te.preventDefault()}),preventScrollOnEntryFocus:!0,children:K.jsx(s7i,{role:"menu","aria-orientation":"vertical","data-state":KJe(_.open),"data-radix-menu-content":"",dir:f.dir,...I,...m,ref:S,style:{outline:"none",...m.style},onKeyDown:El(m.onKeyDown,te=>{const J=te.target.closest("[data-radix-menu-content]")===te.currentTarget,oe=te.ctrlKey||te.altKey||te.metaKey,ie=te.key.length===1;J&&(te.key==="Tab"&&te.preventDefault(),!oe&&ie&&Y(te.key));const ne=B.current;if(te.target!==ne||!p6i.includes(te.key))return;te.preventDefault();const ge=y().filter(_e=>!_e.disabled).map(_e=>_e.ref.current);Ocn.includes(te.key)&&ge.reverse(),Zcn(ge)}),onBlur:El(e.onBlur,te=>{te.currentTarget.contains(te.target)||(window.clearTimeout(Q.current),w.current="")}),onPointerMove:El(e.onPointerMove,AU(te=>{const j=te.target,J=F.current!==te.clientX;if(te.currentTarget.contains(j)&&J){const oe=te.clientX>F.current?"right":"left";R.current=oe,F.current=te.clientX}}))})})})})})})},"MenuContentImpl")),UJe="MenuItem",Jcn="menu.itemSelect",Wcn=ee.forwardRef(F0(function(e,n){const{disabled:o=!1,onSelect:i,...r}=e,s=ee.useRef(null),a=hZ(UJe,e.__scopeMenu),A=GJe(UJe,e.__scopeMenu),c=hf(n,s),l=ee.useRef(!1),u=F0(()=>{const g=s.current;if(!o&&g){const h=new CustomEvent(Jcn,{bubbles:!0,cancelable:!0});g.addEventListener(Jcn,d=>i?.(d),{once:!0}),eJe(g,h),h.defaultPrevented?l.current=!1:a.onClose()}},"handleSelect");return K.jsx(jcn,{...r,ref:c,disabled:o,onClick:El(e.onClick,u),onPointerDown:g=>{e.onPointerDown?.(g),l.current=!0},onPointerUp:El(e.onPointerUp,g=>{l.current||g.currentTarget?.click()}),onKeyDown:El(e.onKeyDown,g=>{o||g.target!==g.currentTarget||A.searchRef.current!==""&&g.key===" "||OJe.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})},"MenuItem")),jcn=ee.forwardRef(F0(function(e,n){const{__scopeMenu:o,disabled:i=!1,textValue:r,...s}=e,a=GJe(UJe,o),A=Ycn(o),c=ee.useRef(null),l=hf(n,c),[u,g]=ee.useState(!1),[h,d]=ee.useState("");return ee.useEffect(()=>{const p=c.current;p&&d((p.textContent??"").trim())},[s.children]),K.jsx(dZ.ItemSlot,{scope:o,disabled:i,textValue:r??h,children:K.jsx(b7i,{asChild:!0,...A,focusable:!i,children:K.jsx(N6.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...s,ref:l,onPointerMove:El(e.onPointerMove,AU(p=>{i?a.onItemLeave(p):(a.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:El(e.onPointerLeave,AU(p=>a.onItemLeave(p))),onFocus:El(e.onFocus,()=>g(!0)),onBlur:El(e.onBlur,()=>g(!1))})})})},"MenuItemImpl")),w6i=ee.forwardRef(F0(function(e,n){const{checked:o=!1,onCheckedChange:i,...r}=e;return K.jsx(D6i,{scope:e.__scopeMenu,checked:o,children:K.jsx(Wcn,{role:"menuitemcheckbox","aria-checked":Cme(o)?"mixed":o,...r,ref:n,"data-state":Xcn(o),onSelect:El(r.onSelect,()=>i?.(Cme(o)?!0:!o),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),P6i="MenuRadioGroup",[Rpr,Tpr]=BT(P6i,{value:void 0,onValueChange:F0(()=>{},"onValueChange")}),M6i="MenuItemIndicator",[D6i,kpr]=BT(M6i,{checked:!1}),N6i=ee.forwardRef(F0(function(e,n){const{__scopeMenu:o,...i}=e;return K.jsx(N6.div,{role:"separator","aria-orientation":"horizontal",...i,ref:n})},"MenuSeparator")),$cn="MenuSub",[R6i,qcn]=BT($cn),T6i=F0(t=>{const{__scopeMenu:e,children:n,open:o=!1,onOpenChange:i}=t,r=BP($cn,e),s=fme(e),[a,A]=ee.useState(null),[c,l]=ee.useState(null),u=R6(i);return ee.useEffect(()=>(r.open===!1&&u(!1),()=>u(!1)),[r.open,u]),K.jsx(gcn,{...s,children:K.jsx(Ucn,{scope:e,open:o,onOpenChange:u,content:c,onContentChange:l,children:K.jsx(R6i,{scope:e,contentId:ZY(),triggerId:ZY(),trigger:a,onTriggerChange:A,children:n})})})},"MenuSub"),Ime="MenuSubTrigger",k6i=ee.forwardRef(F0(function(e,n){const o=BP(Ime,e.__scopeMenu),i=hZ(Ime,e.__scopeMenu),r=qcn(Ime,e.__scopeMenu),s=GJe(Ime,e.__scopeMenu),a=ee.useRef(null),{pointerGraceTimerRef:A,onPointerGraceIntentChange:c}=s,l={__scopeMenu:e.__scopeMenu},u=ee.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);ee.useEffect(()=>u,[u]),ee.useEffect(()=>{const h=A.current;return()=>{window.clearTimeout(h),c(null)}},[A,c]);const g=hf(n,r.onTriggerChange);return K.jsx(Kcn,{asChild:!0,...l,children:K.jsx(jcn,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?r.contentId:void 0,"data-state":KJe(o.open),...e,ref:g,onClick:h=>{e.onClick?.(h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),o.open||o.onOpenChange(!0))},onPointerMove:El(e.onPointerMove,AU(h=>{s.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!o.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{o.onOpenChange(!0),u()},100))})),onPointerLeave:El(e.onPointerLeave,AU(h=>{u();const d=o.content?.getBoundingClientRect();if(d){const p=o.content?.dataset.side,m=p==="right",_=m?-5:5,f=d[m?"left":"right"],I=d[m?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+_,y:h.clientY},{x:f,y:d.top},{x:I,y:d.top},{x:I,y:d.bottom},{x:f,y:d.bottom}],side:p}),window.clearTimeout(A.current),A.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:El(e.onKeyDown,h=>{e.disabled||h.target!==h.currentTarget||s.searchRef.current!==""&&h.key===" "||m6i[i.dir].includes(h.key)&&(o.onOpenChange(!0),o.content?.focus(),h.preventDefault())})})})},"MenuSubTrigger")),F6i="MenuSubContent",L6i=ee.forwardRef(F0(function(e,n){const o=zcn(e9,e.__scopeMenu),{forceMount:i=o.forceMount,align:r="start",...s}=e,a=BP(e9,e.__scopeMenu),A=hZ(e9,e.__scopeMenu),c=qcn(F6i,e.__scopeMenu),l=ee.useRef(null),u=hf(n,l);return K.jsx(dZ.Provider,{scope:e.__scopeMenu,children:K.jsx(vJe,{present:i||a.open,children:K.jsx(dZ.Slot,{scope:e.__scopeMenu,children:K.jsx(YJe,{id:c.contentId,"aria-labelledby":c.triggerId,...s,ref:u,align:r,side:A.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:g=>{A.isUsingKeyboardRef.current&&l.current?.focus(),g.preventDefault()},onCloseAutoFocus:g=>g.preventDefault(),onFocusOutside:El(e.onFocusOutside,g=>{g.target!==c.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:El(e.onEscapeKeyDown,g=>{A.onClose(),g.preventDefault()}),onKeyDown:El(e.onKeyDown,g=>{const h=g.currentTarget.contains(g.target),d=_6i[A.dir].includes(g.key);h&&d&&(a.onOpenChange(!1),c.trigger?.focus(),g.preventDefault())})})})})})},"MenuSubContent"));function KJe(t){return t?"open":"closed"}F0(KJe,"getOpenState");function Cme(t){return t==="indeterminate"}F0(Cme,"isIndeterminate");function Xcn(t){return Cme(t)?"indeterminate":t?"checked":"unchecked"}F0(Xcn,"getCheckedState");function Zcn(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}F0(Zcn,"focusFirst");function eln(t,e){return t.map((n,o)=>t[(e+o)%t.length])}F0(eln,"wrapArray");function tln(t,e,n){const i=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,r=n?t.indexOf(n):-1;let s=eln(t,Math.max(r,0));i.length===1&&(s=s.filter(c=>c!==n));const A=s.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return A!==n?A:void 0}F0(tln,"getNextMatch");function nln(t,e){const{x:n,y:o}=t;let i=!1;for(let r=0,s=e.length-1;r<e.length;s=r++){const a=e[r],A=e[s],c=a.x,l=a.y,u=A.x,g=A.y;l>o!=g>o&&n<(u-c)*(o-l)/(g-l)+c&&(i=!i)}return i}F0(nln,"isPointInPolygon");function oln(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return nln(n,e)}F0(oln,"isPointerInGraceArea");function AU(t){return e=>e.pointerType==="mouse"?t(e):void 0}F0(AU,"whenMouse");var H6i=y6i,O6i=Kcn,G6i=E6i,Y6i=b6i,U6i=Wcn,K6i=w6i,V6i=N6i,z6i=T6i,J6i=k6i,W6i=L6i,j6i=Object.defineProperty,H6=(t,e)=>j6i(t,"name",{value:e,configurable:!0}),VJe="DropdownMenu",[$6i,Fpr]=fT(VJe,[Gcn]),O6=Gcn(),[q6i,iln]=$6i(VJe),X6i=H6(t=>{const{__scopeDropdownMenu:e,children:n,dir:o,open:i,defaultOpen:r,onOpenChange:s,modal:a=!0}=t,A=O6(e),c=ee.useRef(null),[l,u]=Wpe({prop:i,defaultProp:r??!1,onChange:s,caller:VJe});return K.jsx(q6i,{scope:e,triggerId:ZY(),triggerRef:c,contentId:ZY(),open:l,onOpenChange:u,onOpenToggle:ee.useCallback(()=>u(g=>!g),[u]),modal:a,children:K.jsx(H6i,{...A,open:l,onOpenChange:u,dir:o,modal:a,children:n})})},"DropdownMenu"),Z6i="DropdownMenuTrigger",e8i=ee.forwardRef(H6(function(e,n){const{__scopeDropdownMenu:o,disabled:i=!1,...r}=e,s=iln(Z6i,o),a=O6(o),A=hf(n,s.triggerRef);return K.jsx(O6i,{asChild:!0,...a,children:K.jsx(N6.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...r,ref:A,onPointerDown:El(e.onPointerDown,c=>{!i&&c.button===0&&c.ctrlKey===!1&&(s.onOpenToggle(),s.open||c.preventDefault())}),onKeyDown:El(e.onKeyDown,c=>{i||(["Enter"," "].includes(c.key)&&s.onOpenToggle(),c.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})},"DropdownMenuTrigger")),t8i=H6(t=>{const{__scopeDropdownMenu:e,...n}=t,o=O6(e);return K.jsx(G6i,{...o,...n})},"DropdownMenuPortal"),n8i="DropdownMenuContent",o8i=ee.forwardRef(H6(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=iln(n8i,o),s=O6(o),a=ee.useRef(!1);return K.jsx(Y6i,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...i,ref:n,onCloseAutoFocus:El(e.onCloseAutoFocus,A=>{a.current||r.triggerRef.current?.focus(),a.current=!1,A.preventDefault()}),onInteractOutside:El(e.onInteractOutside,A=>{const c=A.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,u=c.button===2||l;(!r.modal||u)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),i8i=ee.forwardRef(H6(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=O6(o);return K.jsx(U6i,{...r,...i,ref:n})},"DropdownMenuItem")),r8i=ee.forwardRef(H6(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=O6(o);return K.jsx(K6i,{...r,...i,ref:n})},"DropdownMenuCheckboxItem")),s8i=ee.forwardRef(H6(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=O6(o);return K.jsx(V6i,{...r,...i,ref:n})},"DropdownMenuSeparator")),a8i=H6(t=>{const{__scopeDropdownMenu:e,children:n,open:o,onOpenChange:i,defaultOpen:r}=t,s=O6(e),[a,A]=Wpe({prop:o,defaultProp:r??!1,onChange:i,caller:"DropdownMenuSub"});return K.jsx(z6i,{...s,open:a,onOpenChange:A,children:n})},"DropdownMenuSub"),A8i=ee.forwardRef(H6(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=O6(o);return K.jsx(J6i,{...r,...i,ref:n})},"DropdownMenuSubTrigger")),c8i=ee.forwardRef(H6(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=O6(o);return K.jsx(W6i,{...r,...i,ref:n,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuSubContent")),l8i=X6i,u8i=e8i,yme=t8i,g8i=o8i,Sd=i8i,d8i=r8i,IS=s8i,zJe=a8i,JJe=A8i,h8i=c8i,WJe=t=>{const[e,n]=ee.useState(null),[o,i]=ee.useState();return ee.useLayoutEffect(()=>{if(!e)return;const r=document.getElementById(e.getAttribute("aria-labelledby")??"");if(!r)return;let s=0;const a=()=>{if(s=Math.max(s,e.offsetWidth),!s)return;const c=r.getBoundingClientRect(),l=Math.max(c.left-10,document.documentElement.clientWidth-c.right-10);i(l<s?c.width:void 0)},A=new ResizeObserver(a);return A.observe(e),A.observe(r),a(),window.addEventListener("resize",a),()=>{A.disconnect(),window.removeEventListener("resize",a)}},[e]),K.jsx(h8i,{...t,ref:n,sideOffset:o===void 0?t.sideOffset:-o,style:{...t.style,...o===void 0?{}:{minWidth:Math.min(160,o),maxWidth:o}}})},rln={boxSizing:"border-box",minWidth:"min(160px, calc(100vw - 20px))",maxWidth:"calc(100vw - 20px)",maxHeight:"var(--radix-dropdown-menu-content-available-height, calc(100dvh - 20px))",overflowY:"auto",overflowX:"hidden",overscrollBehavior:"contain",overflowWrap:"anywhere"},d1=()=>K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:K.jsx("path",{d:"M20 6 9 17l-5-5"})}),jJe=({isOpen:t})=>K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transition:"transform 0.2s ease",transform:t?"rotate(90deg)":"rotate(0deg)",opacity:.6},children:K.jsx("path",{d:"m9 18 6-6-6-6"})}),p8i=()=>K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:K.jsx("path",{d:"M5 12h14"})}),sln=()=>K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-dot-icon lucide-dot",children:K.jsx("circle",{cx:"12.1",cy:"12.1",r:"4.5",fill:"white"})}),c2={padding:"6px 8px",borderRadius:6,cursor:"default",outline:"none",userSelect:"none",display:"flex",alignItems:"center",gap:8,color:"#fafafa",fontWeight:400,fontSize:14,transition:"background-color 0.15s ease, color 0.15s ease",fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},m8i={paddingLeft:32,paddingTop:6,paddingBottom:6,paddingRight:8},$Je={height:1,backgroundColor:"#ffffff1a",margin:"4px 0"},_8i={...rln,backgroundColor:"#262626",color:"#fafafa",borderRadius:8,boxShadow:"0px 12px 48px -12px rgba(0, 0, 0, 0.5), 0px 8px 24px -8px rgba(0, 0, 0, 0.3)",border:"1px solid #333333",padding:"4px",zIndex:kX.appearanceMenu,fontSize:14,fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},Wx={width:16,height:16,display:"flex",alignItems:"flex-end",justifyContent:"center",flexShrink:0},f8i=()=>{const{visibility:t,setLayerVisibility:e}=AT(),{darkBackgroundEnabled:n,setDarkBackgroundEnabled:o,lightingEnabled:i,setLightingEnabled:r}=wze(),[s,a]=ee.useState(!1),[A,c]=ee.useState(null);return K.jsxs(K.Fragment,{children:[K.jsx(IS,{style:$Je}),K.jsxs(zJe,{onOpenChange:a,children:[K.jsxs(JJe,{style:{...c2,...m8i,backgroundColor:s||A==="appearance"?"#404040":"transparent"},onMouseEnter:()=>c("appearance"),onMouseLeave:()=>c(null),onTouchStart:()=>c("appearance"),children:[K.jsx("span",{style:{flex:1,display:"flex",alignItems:"center"},children:"Appearance"}),K.jsx("div",{style:{marginLeft:"auto",display:"flex",alignItems:"flex-end",marginBottom:"-5px"},children:K.jsx(jJe,{isOpen:s})})]}),K.jsx(yme,{children:K.jsxs(WJe,{style:{..._8i,marginLeft:-2},collisionPadding:10,avoidCollisions:!0,children:[K.jsxs(Sd,{style:{...c2,backgroundColor:A==="darkBackground"?"#404040":"transparent"},onSelect:l=>l.preventDefault(),onPointerDown:l=>{l.preventDefault(),o(!n)},onMouseEnter:()=>c("darkBackground"),onMouseLeave:()=>c(null),onTouchStart:()=>c("darkBackground"),children:[K.jsx("span",{style:Wx,children:n&&K.jsx(d1,{})}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:"Dark Background"})]}),K.jsxs(Sd,{style:{...c2,backgroundColor:A==="lighting"?"#404040":"transparent"},onSelect:l=>l.preventDefault(),onPointerDown:l=>{l.preventDefault(),r(!i)},onMouseEnter:()=>c("lighting"),onMouseLeave:()=>c(null),onTouchStart:()=>c("lighting"),children:[K.jsx("span",{style:Wx,children:i&&K.jsx(d1,{})}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:"Lighting"})]}),K.jsx(IS,{style:$Je}),K.jsxs(Sd,{style:{...c2,backgroundColor:A==="boardBody"?"#404040":"transparent"},onSelect:l=>l.preventDefault(),onPointerDown:l=>{l.preventDefault(),e("boardBody",!t.boardBody)},onMouseEnter:()=>c("boardBody"),onMouseLeave:()=>c(null),onTouchStart:()=>c("boardBody"),children:[K.jsx("span",{style:Wx,children:t.boardBody&&K.jsx(d1,{})}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:"Board Body"})]}),K.jsxs(Sd,{style:{...c2,backgroundColor:A==="topCopper"?"#404040":"transparent"},onSelect:l=>l.preventDefault(),onPointerDown:l=>{l.preventDefault(),e("topCopper",!t.topCopper)},onMouseEnter:()=>c("topCopper"),onMouseLeave:()=>c(null),onTouchStart:()=>c("topCopper"),children:[K.jsx("span",{style:Wx,children:t.topCopper&&K.jsx(d1,{})}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:"Top Copper"})]}),K.jsxs(Sd,{style:{...c2,backgroundColor:A==="bottomCopper"?"#404040":"transparent"},onSelect:l=>l.preventDefault(),onPointerDown:l=>{l.preventDefault(),e("bottomCopper",!t.bottomCopper)},onMouseEnter:()=>c("bottomCopper"),onMouseLeave:()=>c(null),onTouchStart:()=>c("bottomCopper"),children:[K.jsx("span",{style:Wx,children:t.bottomCopper&&K.jsx(d1,{})}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:"Bottom Copper"})]}),K.jsxs(Sd,{style:{...c2,backgroundColor:A==="keepout"?"#404040":"transparent"},onSelect:l=>l.preventDefault(),onPointerDown:l=>{l.preventDefault(),e("keepout",!t.keepout)},onMouseEnter:()=>c("keepout"),onMouseLeave:()=>c(null),onTouchStart:()=>c("keepout"),children:[K.jsx("span",{style:Wx,children:t.keepout&&K.jsx(d1,{})}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:"Keepout"})]}),K.jsxs(Sd,{style:{...c2,backgroundColor:A==="topSilkscreen"?"#404040":"transparent"},onSelect:l=>l.preventDefault(),onPointerDown:l=>{l.preventDefault(),e("topSilkscreen",!t.topSilkscreen)},onMouseEnter:()=>c("topSilkscreen"),onMouseLeave:()=>c(null),onTouchStart:()=>c("topSilkscreen"),children:[K.jsx("span",{style:Wx,children:t.topSilkscreen&&K.jsx(d1,{})}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:"Top Silkscreen"})]}),K.jsxs(Sd,{style:{...c2,backgroundColor:A==="bottomSilkscreen"?"#404040":"transparent"},onSelect:l=>l.preventDefault(),onPointerDown:l=>{l.preventDefault(),e("bottomSilkscreen",!t.bottomSilkscreen)},onMouseEnter:()=>c("bottomSilkscreen"),onMouseLeave:()=>c(null),onTouchStart:()=>c("bottomSilkscreen"),children:[K.jsx("span",{style:Wx,children:t.bottomSilkscreen&&K.jsx(d1,{})}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:"Bottom Silkscreen"})]}),K.jsxs(Sd,{style:{...c2,backgroundColor:A==="topMask"?"#404040":"transparent"},onSelect:l=>l.preventDefault(),onPointerDown:l=>{l.preventDefault(),e("topMask",!t.topMask)},onMouseEnter:()=>c("topMask"),onMouseLeave:()=>c(null),onTouchStart:()=>c("topMask"),children:[K.jsx("span",{style:Wx,children:t.topMask&&K.jsx(d1,{})}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:"Top Soldermask"})]}),K.jsxs(Sd,{style:{...c2,backgroundColor:A==="bottomMask"?"#404040":"transparent"},onSelect:l=>l.preventDefault(),onPointerDown:l=>{l.preventDefault(),e("bottomMask",!t.bottomMask)},onMouseEnter:()=>c("bottomMask"),onMouseLeave:()=>c(null),onTouchStart:()=>c("bottomMask"),children:[K.jsx("span",{style:Wx,children:t.bottomMask&&K.jsx(d1,{})}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:"Bottom Soldermask"})]}),K.jsxs(Sd,{style:{...c2,backgroundColor:A==="pcbNotes"?"#404040":"transparent"},onSelect:l=>l.preventDefault(),onPointerDown:l=>{l.preventDefault(),e("pcbNotes",!t.pcbNotes)},onMouseEnter:()=>c("pcbNotes"),onMouseLeave:()=>c(null),onTouchStart:()=>c("pcbNotes"),children:[K.jsx("span",{style:Wx,children:t.pcbNotes&&K.jsx(d1,{})}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:"PCB Notes"})]}),K.jsxs(Sd,{style:{...c2,backgroundColor:A==="smtModels"?"#404040":"transparent"},onSelect:l=>l.preventDefault(),onPointerDown:l=>{l.preventDefault(),e("smtModels",!t.smtModels)},onMouseEnter:()=>c("smtModels"),onMouseLeave:()=>c(null),onTouchStart:()=>c("smtModels"),children:[K.jsx("span",{style:Wx,children:t.smtModels&&K.jsx(d1,{})}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:"Surface Mount Components"})]}),K.jsxs(Sd,{style:{...c2,backgroundColor:A==="throughHoleModels"?"#404040":"transparent"},onSelect:l=>l.preventDefault(),onPointerDown:l=>{l.preventDefault(),e("throughHoleModels",!t.throughHoleModels)},onMouseEnter:()=>c("throughHoleModels"),onMouseLeave:()=>c(null),onTouchStart:()=>c("throughHoleModels"),children:[K.jsx("span",{style:Wx,children:t.throughHoleModels&&K.jsx(d1,{})}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:"Through-Hole Components"})]}),K.jsx(IS,{style:$Je}),K.jsxs(Sd,{style:{...c2,backgroundColor:A==="enclosure"?"#404040":"transparent"},onSelect:l=>l.preventDefault(),onPointerDown:l=>{l.preventDefault(),e("enclosure",_mi(t.enclosure))},onMouseEnter:()=>c("enclosure"),onMouseLeave:()=>c(null),onTouchStart:()=>c("enclosure"),title:`Enclosure: ${t.enclosure}`,children:[K.jsxs("span",{style:Wx,children:[t.enclosure==="opaque"&&K.jsx(d1,{}),t.enclosure==="translucent"&&K.jsx(p8i,{})]}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:"Enclosure"})]})]})})]})]})},I8i=["Custom","Top Center Angled","Top Down","Top Left Corner","Top Right Corner","Left Sideview","Right Sideview","Front"],qJe={...rln,backgroundColor:"#262626",color:"#fafafa",borderRadius:6,boxShadow:"0px 12px 48px -12px rgba(0, 0, 0, 0.5), 0px 8px 24px -8px rgba(0, 0, 0, 0.3)",border:"1px solid #333333",padding:"4px",zIndex:kX.contextMenu,fontSize:14,fontWeight:400,fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},jx={padding:"6px 8px",borderRadius:6,cursor:"default",outline:"none",userSelect:"none",display:"flex",alignItems:"center",gap:8,color:"#fafafa",fontWeight:400,fontSize:14,transition:"background-color 0.15s ease, color 0.15s ease",fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},bP={paddingLeft:32,paddingTop:6,paddingBottom:6,paddingRight:8},cU={width:16,height:16,display:"flex",alignItems:"flex-end",justifyContent:"center",flexShrink:0},lU={height:1,backgroundColor:"#ffffff1a",margin:"4px 0"},aln={fontSize:11,opacity:.65,fontWeight:500,color:"#b5b5bcff",backgroundColor:"rgba(161, 161, 170, 0.1)",padding:"2px 6px",borderRadius:4,border:"1px solid rgba(161, 161, 170, 0.2)",letterSpacing:"0.3px"},C8i=({menuRef:t,menuPos:e,engine:n,cameraPreset:o,autoRotate:i,foldPcbs:r=!1,onFoldPcbsToggle:s,flexScene:a=!1,referenceObject:A=null,onEngineSwitch:c,onCameraPresetSelect:l,onAutoRotateToggle:u,onReferenceObjectSelect:g=()=>{},onViewSchematicComponent:h,componentName:d,onHideComponent:p,onUnhideAllComponents:m,onDownloadGltf:_,onOpenKeyboardShortcuts:f})=>{const{cameraType:I,setCameraType:C}=gS(),{gridEnabled:y,setGridEnabled:x}=wze(),[E,B]=ee.useState(!1),[S,Q]=ee.useState(!1),[w,M]=ee.useState(null);return K.jsx("div",{ref:t,style:{position:"fixed",left:e.x,top:e.y,width:0,height:0},children:K.jsxs(l8i,{open:!0,modal:!1,children:[K.jsx(u8i,{asChild:!0,children:K.jsx("div",{style:{position:"absolute",width:1,height:1}})}),K.jsx(yme,{children:K.jsxs(g8i,{style:qJe,collisionPadding:10,avoidCollisions:!0,sideOffset:0,align:"start",children:[h&&K.jsx(K.Fragment,{children:K.jsx(Sd,{style:{...jx,...bP,backgroundColor:w==="schematic"?"#404040":"transparent"},onSelect:h,onMouseEnter:()=>M("schematic"),onMouseLeave:()=>M(null),children:"Show on schematic"})}),p&&K.jsx(Sd,{style:{...jx,...bP,backgroundColor:w==="hide"?"#404040":"transparent"},onSelect:p,onMouseEnter:()=>M("hide"),onMouseLeave:()=>M(null),children:`Hide "${d}"`}),m&&K.jsx(Sd,{style:{...jx,...bP,backgroundColor:w==="unhide"?"#404040":"transparent"},onSelect:m,onMouseEnter:()=>M("unhide"),onMouseLeave:()=>M(null),children:"Unhide All Components"}),(h||p||m)&&K.jsx(IS,{style:lU}),K.jsxs(zJe,{onOpenChange:B,children:[K.jsxs(JJe,{style:{...jx,...bP,backgroundColor:E||w==="camera"?"#404040":"transparent"},onMouseEnter:()=>M("camera"),onMouseLeave:()=>M(null),onTouchStart:()=>M("camera"),children:[K.jsx("span",{style:{flex:1,display:"flex",alignItems:"center"},children:"Camera"}),K.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:6,marginLeft:"auto"},children:[K.jsx("span",{style:{opacity:.55,fontSize:13},children:o}),K.jsx(jJe,{isOpen:E})]})]}),K.jsx(yme,{children:K.jsxs(WJe,{style:{...qJe,marginLeft:-2},collisionPadding:10,avoidCollisions:!0,children:[I8i.map(k=>K.jsxs(Sd,{style:{...jx,backgroundColor:w===k?"#404040":"transparent"},onSelect:()=>l(k),onMouseEnter:()=>M(k),onMouseLeave:()=>M(null),onTouchStart:()=>M(k),children:[K.jsx("span",{style:cU,children:o===k&&K.jsx(sln,{})}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:k})]},k)),K.jsx(IS,{style:lU}),K.jsxs(Sd,{style:{...jx,backgroundColor:w==="autorotate"?"#404040":"transparent"},onSelect:u,onMouseEnter:()=>M("autorotate"),onMouseLeave:()=>M(null),onTouchStart:()=>M("autorotate"),children:[K.jsx("span",{style:cU,children:i&&K.jsx(d1,{})}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:"Auto rotate"})]}),K.jsxs(Sd,{style:{...jx,backgroundColor:w==="cameratype"?"#404040":"transparent"},onSelect:k=>{k.preventDefault(),C(I==="perspective"?"orthographic":"perspective")},onMouseEnter:()=>M("cameratype"),onMouseLeave:()=>M(null),onTouchStart:()=>M("cameratype"),children:[K.jsx("span",{style:cU,children:I==="orthographic"&&K.jsx(d1,{})}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:"Orthographic Camera"})]})]})})]}),K.jsxs(zJe,{onOpenChange:Q,children:[K.jsxs(JJe,{style:{...jx,...bP,backgroundColor:S||w==="reference-object"?"#404040":"transparent"},onMouseEnter:()=>M("reference-object"),onMouseLeave:()=>M(null),onTouchStart:()=>M("reference-object"),children:[K.jsx("span",{style:{flex:1,display:"flex",alignItems:"center"},children:"Show Reference Object"}),K.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:6,marginLeft:"auto"},children:K.jsx(jJe,{isOpen:S})})]}),K.jsx(yme,{children:K.jsx(WJe,{style:{...qJe,marginLeft:-2},collisionPadding:10,avoidCollisions:!0,children:gEi.map(k=>{const R=k.type??"none";return K.jsxs(Sd,{style:{...jx,backgroundColor:w===R?"#404040":"transparent"},onSelect:F=>F.preventDefault(),onPointerDown:F=>{F.preventDefault(),g(k.type)},onMouseEnter:()=>M(R),onMouseLeave:()=>M(null),onTouchStart:()=>M(R),children:[K.jsx("span",{style:cU,children:A===k.type&&K.jsx(sln,{})}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:k.label})]},R)})})})]}),s&&K.jsxs(d8i,{checked:r,onCheckedChange:s,style:{...jx,backgroundColor:w==="fold"?"#404040":"transparent"},onMouseEnter:()=>M("fold"),onMouseLeave:()=>M(null),children:[K.jsx("span",{style:cU,children:r&&K.jsx(d1,{})}),K.jsx("span",{children:"Fold PCBs"})]}),K.jsxs(Sd,{style:{...jx,backgroundColor:w==="grid"?"#404040":"transparent"},onSelect:k=>k.preventDefault(),onPointerDown:k=>{k.preventDefault(),x(!y)},onMouseEnter:()=>M("grid"),onMouseLeave:()=>M(null),onTouchStart:()=>M("grid"),children:[K.jsx("span",{style:cU,children:y&&K.jsx(d1,{})}),K.jsx("span",{style:{display:"flex",alignItems:"center"},children:"Show Grid"})]}),K.jsx(f8i,{}),K.jsx(IS,{style:lU}),K.jsx(Sd,{style:{...jx,...bP,backgroundColor:w==="download"?"#404040":"transparent"},onSelect:_,onMouseEnter:()=>M("download"),onMouseLeave:()=>M(null),onTouchStart:()=>M("download"),children:K.jsx("span",{style:{display:"flex",alignItems:"center"},children:"Download GLTF"})}),K.jsx(IS,{style:lU}),!a&&K.jsxs(Sd,{style:{...jx,...bP,backgroundColor:w==="engine"?"#404040":"transparent"},onSelect:k=>k.preventDefault(),onPointerDown:k=>{k.preventDefault(),c(n==="jscad"?"manifold":"jscad")},onMouseEnter:()=>M("engine"),onMouseLeave:()=>M(null),onTouchStart:()=>M("engine"),children:[K.jsxs("span",{style:{flex:1,display:"flex",alignItems:"center"},children:["Switch to ",n==="jscad"?"Manifold":"JSCAD"," Engine"]}),K.jsx("div",{style:{...aln,display:"flex",alignItems:"center"},children:n==="jscad"?"experimental":"default"})]}),K.jsx(IS,{style:lU}),K.jsxs(Sd,{style:{...jx,...bP,backgroundColor:w==="shortcuts"?"#404040":"transparent"},onSelect:f,onMouseEnter:()=>M("shortcuts"),onMouseLeave:()=>M(null),onTouchStart:()=>M("shortcuts"),children:[K.jsx("span",{style:{flex:1,display:"flex",alignItems:"center"},children:"Keyboard Shortcuts"}),K.jsx("div",{style:{...aln,display:"flex",alignItems:"center"},children:"Shift+?"})]}),K.jsx(IS,{style:lU}),K.jsx("div",{style:{display:"flex",alignItems:"center",marginTop:0,paddingLeft:32,paddingTop:4,paddingBottom:4},children:K.jsxs("span",{style:{fontSize:11,opacity:.35,fontWeight:400,color:"#a1a1aa",letterSpacing:"0.2px"},children:["@tscircuit/3d-viewer@",man.version]})})]})})]})})},uU=new Map,XJe=new Set,Aln=!1,ZJe=0,eWe=0,xme=null,cln=!1,y8i=20,x8i=t=>{const e=t.toLowerCase().split("+"),n=e[e.length-1],o=e.slice(0,-1);return{key:n,ctrl:o.includes("ctrl"),cmd:o.includes("cmd"),shift:o.includes("shift"),alt:o.includes("alt")}},E8i=(t,e)=>{const n=x8i(e),o=t.key.toLowerCase()===n.key,i=n.ctrl===t.ctrlKey,r=n.cmd===t.metaKey,s=n.shift===t.shiftKey,a=n.alt===t.altKey;return o&&i&&r&&s&&a},B8i=t=>{if(!t||typeof t!="object")return!1;const e=t,n=e.tagName,o=["INPUT","TEXTAREA","SELECT"];if(o.includes(n))return!0;const i=e.getAttribute?.("contenteditable");if(i==="true"||i==="")return!0;let r=e.parentElement;for(let s=0;s<y8i&&r;s++){const a=r.tagName;if(o.includes(a))return!0;const A=r.getAttribute?.("contenteditable");if(A==="true"||A==="")return!0;r=r.parentElement}return!1},b8i=()=>{if(typeof document>"u")return!1;const t=document.activeElement;if(!t)return!1;const e=t.tagName;if(e==="INPUT"||e==="TEXTAREA"||e==="SELECT")return!0;const n=t.getAttribute("contenteditable");return n==="true"||n===""},S8i=()=>{if(!xme)return!0;const t=xme.getBoundingClientRect();return ZJe>=t.left&&ZJe<=t.right&&eWe>=t.top&&eWe<=t.bottom},Q8i=()=>{cln||typeof window>"u"||(window.addEventListener("mousemove",t=>{ZJe=t.clientX,eWe=t.clientY}),cln=!0)},v8i=t=>{B8i(t.target)||b8i()||xme&&!S8i()||uU.forEach(e=>{E8i(t,e.shortcut)&&(t.preventDefault(),e.invoke())})},lln=()=>{const t=Array.from(uU.values());XJe.forEach(e=>e(t))},w8i=()=>{Aln||typeof window>"u"||(window.addEventListener("keydown",v8i),Aln=!0)},P8i=t=>{uU.set(t.id,t),lln(),w8i()},M8i=t=>{uU.delete(t)&&lln()},D8i=t=>(XJe.add(t),t(Array.from(uU.values())),()=>{XJe.delete(t)}),Eme=(t,e,n)=>{const o=ee.useRef(e);o.current=e;const i=ee.useMemo(()=>({shortcut:n.shortcut,description:n.description}),[n.shortcut,n.description]);ee.useEffect(()=>{const r={id:t,...i,invoke:()=>o.current()};return P8i(r),()=>{M8i(t)}},[t,i])},N8i=()=>{const[t,e]=ee.useState(()=>Array.from(uU.values()));return ee.useEffect(()=>D8i(e),[]),t},R8i=t=>{xme=t,Q8i()},T8i=({open:t,onClose:e})=>{const[n,o]=ee.useState(""),i=ee.useRef(null),r=N8i();ee.useEffect(()=>{if(!t)return;const a=A=>{A.key==="Escape"&&(A.preventDefault(),e())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[t,e]),ee.useEffect(()=>{t&&setTimeout(()=>{i.current?.focus()},0)},[t]);const s=ee.useMemo(()=>{const a=n.trim().toLowerCase();return a?r.filter(A=>`${A.shortcut} ${A.description}`.toLowerCase().includes(a)):r},[r,n]);return t?K.jsx("div",{role:"dialog","aria-modal":"true",style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999},onClick:e,children:K.jsxs("div",{style:{backgroundColor:"#1f1f23",color:"#f8f8ff",borderRadius:12,width:"min(640px, 90vw)",maxHeight:"80vh",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.45), 0 8px 20px rgba(0, 0, 0, 0.35)",display:"flex",flexDirection:"column",overflow:"hidden"},onClick:a=>a.stopPropagation(),children:[K.jsxs("header",{style:{padding:"20px 24px 12px",borderBottom:"1px solid rgba(255, 255, 255, 0.08)"},children:[K.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[K.jsx("h2",{style:{margin:0,fontSize:"1.1rem",fontWeight:600,letterSpacing:"0.02em"},children:"Keyboard Shortcuts"}),K.jsx("button",{type:"button",onClick:e,style:{background:"transparent",border:"none",color:"rgba(255, 255, 255, 0.8)",fontSize:"1rem",cursor:"pointer"},children:"✕"})]}),K.jsx("input",{ref:i,type:"text",placeholder:"Search shortcuts...",value:n,onChange:a=>o(a.target.value),style:{marginTop:12,width:"calc(100% - 24px)",padding:"10px 12px",borderRadius:8,border:"1px solid rgba(255, 255, 255, 0.1)",backgroundColor:"rgba(255, 255, 255, 0.05)",color:"white",fontSize:"0.95rem"}})]}),K.jsx("div",{style:{overflowY:"auto"},children:K.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"0.95rem"},children:[K.jsx("thead",{children:K.jsxs("tr",{style:{textAlign:"left",color:"#a1a1b5"},children:[K.jsx("th",{style:{padding:"12px 24px",width:"25%"},children:"Key"}),K.jsx("th",{style:{padding:"12px 24px"},children:"Description"})]})}),K.jsx("tbody",{children:s.length===0?K.jsx("tr",{children:K.jsx("td",{colSpan:2,style:{padding:"24px",textAlign:"center"},children:"No shortcuts found"})}):s.map(a=>K.jsxs("tr",{style:{borderTop:"1px solid rgba(255, 255, 255, 0.05)"},children:[K.jsx("td",{style:{padding:"12px 24px"},children:K.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",border:"1px solid rgba(255, 255, 255, 0.3)",borderRadius:6,minWidth:36,padding:"4px 8px",fontFamily:"monospace",fontSize:"0.95rem",textTransform:"capitalize"},children:a.shortcut})}),K.jsx("td",{style:{padding:"12px 24px"},children:a.description})]},a.id))})]})})]})}):null},k8i=()=>({showToast:(t,e=2e3)=>{ua(t,{duration:e})}}),F8i=({children:t})=>K.jsxs(K.Fragment,{children:[t,K.jsx(ein,{position:"bottom-right"})]});function L8i({setAutoRotate:t,setAutoRotateUserToggled:e,setCameraPreset:n,closeMenu:o,cameraControllerRef:i,isAnimatingRef:r,lastPresetSelectTime:s}){return{handleCameraPresetSelect:ee.useCallback(A=>{t(!1),e(!0),n(A),o(),s.current=Date.now(),A!=="Custom"&&(r.current=!0,i.current?.animateToPreset(A),setTimeout(()=>{r.current=!1},600))},[t,e,n,o,i,r,s])}}var H8i=({containerRef:t,onOpen:e})=>{const[n,o]=ee.useState(!1),[i,r]=ee.useState({x:0,y:0}),s=ee.useRef(null),a=ee.useRef(null),A=ee.useRef(null),c=ee.useRef(!1),l=()=>{A.current!==null&&(clearTimeout(A.current),A.current=null)},u=ee.useCallback(_=>{_.preventDefault();const f=typeof _.clientX=="number"?_.clientX:0,I=typeof _.clientY=="number"?_.clientY:0;if(c.current){c.current=!1;return}if(!a.current)return;const{x:C,y}=a.current,x=Math.abs(f-C),E=Math.abs(I-y),B=10;if(x>B||E>B){a.current=null;return}e?.({x:f,y:I}),r({x:f,y:I}),o(!0),a.current=null},[r,o,e]),g=ee.useCallback(_=>{if(_.touches.length===1){const f=_.touches[0];f?(a.current={x:f.clientX,y:f.clientY},l(),A.current=window.setTimeout(()=>{if(a.current){if(t.current){e?.(a.current);const I=t.current.getBoundingClientRect();r({x:I.left+I.width/2,y:I.top+I.height/2}),o(!0),c.current=!0}a.current=null}},600)):a.current=null}else a.current=null,l()},[t,e]),h=ee.useCallback(_=>{if(!a.current||_.touches.length!==1)return;const f=_.touches[0];if(f){const I=Math.abs(f.clientX-a.current.x),C=Math.abs(f.clientY-a.current.y),y=10;(I>y||C>y)&&(a.current=null,l())}else a.current=null,l()},[]),d=ee.useCallback(()=>{l(),setTimeout(()=>{a.current&&(a.current=null)},0)},[]),p=ee.useCallback(_=>{const f=_.target;s.current&&s.current.contains(f)||f.closest?.("[data-radix-popper-content-wrapper], [data-radix-dropdown-menu-content], [data-radix-dropdown-menu-sub-content]")||o(!1)},[]);return ee.useEffect(()=>{if(n)return document.addEventListener("mousedown",p),document.addEventListener("touchstart",p),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("touchstart",p)}},[n,p]),{menuVisible:n,menuPos:i,menuRef:s,contextMenuEventHandlers:{onMouseDown:_=>{_.button===2?a.current={x:_.clientX,y:_.clientY}:a.current=null},onContextMenu:u,onTouchStart:g,onTouchMove:h,onTouchEnd:d},setMenuVisible:o}},O8i=()=>ee.useCallback(()=>{const t=window.__TSCIRCUIT_THREE_OBJECT;if(!t)return;new pke().parse(t,n=>{const o=new Blob([n instanceof ArrayBuffer?n:JSON.stringify(n)],{type:"model/gltf+json"}),i=URL.createObjectURL(o),r=document.createElement("a");r.href=i,r.download="scene.gltf",r.click(),URL.revokeObjectURL(i)},n=>{console.error("Failed to export GLTF",n)})},[]),G8i=new jt(0,0,0),Y8i=[5,-5,5],U8i=()=>{if(typeof window>"u")return;const t=window.localStorage.getItem("cadViewerCameraType");return t==="orthographic"||t==="perspective"?t:void 0},K8i=t=>{const e=OVe(t.circuitJson?void 0:t.children),n=t.circuitJson??e,o=n.some(Te=>Te.type==="pcb_bend"),i=o||n.some(Te=>Te.type==="pcb_stiffener"),[r,s]=ee.useState(void 0),a=r??t.foldPcbs,A=Srn(n,a),c=JSON.stringify(n),{hiddenCadComponentIds:l,hideComponent:u,unhideAllComponents:g}=pmi(c),h={...t,circuitJson:n,children:void 0,hiddenCadComponentIds:l},[d,p]=ee.useState(()=>{const Te=window.localStorage.getItem("cadViewerEngine");return Te==="jscad"||Te==="manifold"?Te:"manifold"}),m=ee.useRef(null),[_,f]=ee.useState(!1),[I,C]=ee.useState(()=>window.localStorage.getItem("cadViewerAutoRotate")!=="false"),[y,x]=ee.useState(()=>window.localStorage.getItem("cadViewerAutoRotateUserToggled")==="true"),[E,B]=ee.useState("Custom"),[S,Q]=ee.useState(null),{cameraType:w}=gS(),{visibility:M,setLayerVisibility:k}=AT(),{showToast:R}=k8i(),F=ee.useRef(null),O=t.onCameraControllerReady,U=ee.useContext(HVe),[Y,W]=ee.useState(),[te,j]=ee.useState(),J=ee.useCallback(Te=>{j(hmi(U.current,Te,n)),W(t.onViewSchematicComponent?dmi(U.current,Te,n):void 0)},[U,n,t.onViewSchematicComponent]),{menuVisible:oe,menuPos:ie,menuRef:ne,contextMenuEventHandlers:le,setMenuVisible:ge}=H8i({containerRef:m,onOpen:J}),_e=ee.useRef(y);_e.current=y;const ue=ee.useRef(!1),fe=ee.useRef(0),pe=1e3,ye=ee.useCallback(()=>{ue.current||Date.now()-fe.current<pe||(_e.current||C(!1),oe||B("Custom"))},[oe]),Me=ee.useCallback(()=>{C(Te=>!Te),x(!0)},[]),ve=O8i(),he=ee.useCallback(()=>{ge(!1)},[ge]),Qe=ee.useCallback(Te=>{F.current=Te,O?.(Te),Te&&E!=="Custom"&&Te.animateToPreset(E)},[E,O]),{handleCameraPresetSelect:Pe}=L8i({setAutoRotate:C,setAutoRotateUserToggled:x,setCameraPreset:B,closeMenu:he,cameraControllerRef:F,isAnimatingRef:ue,lastPresetSelectTime:fe});Eme("open_keyboard_shortcuts_dialog",()=>{f(!0)},{shortcut:"shift+?",description:"Open keyboard shortcuts"}),Eme("toggle_smt_models",()=>{const Te=!M.smtModels;k("smtModels",Te),R(Te?"SMT components visible":"SMT components hidden",1500)},{shortcut:"shift+s",description:"Toggle surface mount components"}),Eme("toggle_through_hole_models",()=>{const Te=!M.throughHoleModels;k("throughHoleModels",Te),R(Te?"Through-hole components visible":"Through-hole components hidden",1500)},{shortcut:"shift+t",description:"Toggle through-hole components"}),Eme("toggle_translucent_models",()=>{const Te=!M.translucentModels;k("translucentModels",Te),R(Te?"Translucent components visible":"Translucent components hidden",1500)},{shortcut:"shift+v",description:"Toggle translucent components"}),ee.useEffect(()=>{m.current&&R8i(m.current)},[]),ee.useEffect(()=>{window.localStorage.setItem("cadViewerEngine",d)},[d]),ee.useEffect(()=>{window.localStorage.setItem("cadViewerAutoRotate",String(I))},[I]),ee.useEffect(()=>{window.localStorage.setItem("cadViewerAutoRotateUserToggled",String(y))},[y]),ee.useEffect(()=>{window.localStorage.setItem("cadViewerCameraType",w)},[w]);const we=t.circuitJson?c:void 0;return K.jsxs("div",{ref:m,style:{width:"100%",height:"100%",position:"relative",userSelect:"none",MozUserSelect:"none",msUserSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none"},...le,children:[i?K.jsx(iAn,{...h,foldPcbs:a,autoRotateDisabled:t.autoRotateDisabled||!I,onUserInteraction:ye,onCameraControllerReady:Qe,referenceObject:S}):d==="jscad"?K.jsx(_4i,{...h,autoRotateDisabled:t.autoRotateDisabled||!I,cameraType:w,onUserInteraction:ye,onCameraControllerReady:Qe,referenceObject:S}):K.jsx(iAn,{...h,autoRotateDisabled:t.autoRotateDisabled||!I,cameraType:w,onUserInteraction:ye,onCameraControllerReady:Qe,referenceObject:S}),oe&&K.jsx(C8i,{componentName:te?.componentName,onHideComponent:te?()=>{u(te.cad_component_id),he()}:void 0,onUnhideAllComponents:l.size>0?()=>{g(),he()}:void 0,onViewSchematicComponent:Y&&t.onViewSchematicComponent?()=>{t.onViewSchematicComponent?.(Y),he()}:void 0,menuRef:ne,menuPos:ie,engine:d,flexScene:i,foldPcbs:A,onFoldPcbsToggle:o?()=>{s(!A),B("Custom"),he()}:void 0,cameraPreset:E,autoRotate:I,referenceObject:S,onEngineSwitch:Te=>{p(Te),he()},onCameraPresetSelect:Pe,onAutoRotateToggle:()=>{Me(),he()},onReferenceObjectSelect:Te=>{Q(Re=>dEi(Re,Te)),C(!1),x(!0),B("Custom"),he()},onDownloadGltf:()=>{ve(),he()},onOpenKeyboardShortcuts:()=>{f(!0),he()}}),K.jsx(T8i,{open:_,onClose:()=>f(!1)})]},we)},V8i=t=>{const e=ee.useRef(null);return K.jsx(HVe.Provider,{value:e,children:K.jsx(X3i,{defaultTarget:G8i,initialCameraPosition:Y8i,initialCameraType:U8i(),children:K.jsx(fmi,{children:K.jsx(q3i,{children:K.jsx(F8i,{children:K.jsx(K8i,{...t})})})})})})},z8i=_0(lmi());_0(Ape()),_0(Brn()),_0(Ape()),(0,z8i.default)("tscircuit:3d-viewer:convert-circuit-json-to-3d-svg");const uln=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,gln=NB,gU=((t,e)=>n=>{var o;if(e?.variants==null)return gln(t,n?.class,n?.className);const{variants:i,defaultVariants:r}=e,s=Object.keys(i).map(c=>{const l=n?.[c],u=r?.[c];if(l===null)return null;const g=uln(l)||uln(u);return i[c][g]}),a=n&&Object.entries(n).reduce((c,l)=>{let[u,g]=l;return g===void 0||(c[u]=g),c},{}),A=e==null||(o=e.compoundVariants)===null||o===void 0?void 0:o.reduce((c,l)=>{let{class:u,className:g,...h}=l;return Object.entries(h).every(d=>{let[p,m]=d;return Array.isArray(m)?m.includes({...r,...a}[p]):{...r,...a}[p]===m})?[...c,u,g]:c},[]);return gln(t,s,A,n?.class,n?.className)})("rf-inline-flex rf-items-center rf-justify-center rf-gap-2 rf-whitespace-nowrap rf-rounded-md rf-text-sm rf-font-medium rf-transition-colors focus-visible:rf-outline-none focus-visible:rf-ring-1 focus-visible:rf-ring-zinc-950 disabled:rf-pointer-events-none disabled:rf-opacity-50 [&_svg]:rf-pointer-events-none [&_svg]:rf-size-4 [&_svg]:rf-shrink-0 dark:focus-visible:rf-ring-zinc-300",{variants:{variant:{default:"rf-bg-zinc-900 rf-text-zinc-50 rf-shadow hover:rf-bg-zinc-900/90 dark:rf-bg-zinc-50 dark:rf-text-zinc-900 dark:hover:rf-bg-zinc-50/90",destructive:"rf-bg-red-500 rf-text-zinc-50 rf-shadow-sm hover:rf-bg-red-500/90 dark:rf-bg-red-900 dark:rf-text-zinc-50 dark:hover:rf-bg-red-900/90",outline:"rf-border rf-border-zinc-200 rf-bg-white rf-shadow-sm hover:rf-bg-zinc-100 hover:rf-text-zinc-900 dark:rf-border-zinc-800 dark:rf-bg-zinc-950 dark:hover:rf-bg-zinc-800 dark:hover:rf-text-zinc-50",secondary:"rf-bg-zinc-100 rf-text-zinc-900 rf-shadow-sm hover:rf-bg-zinc-100/80 dark:rf-bg-zinc-800 dark:rf-text-zinc-50 dark:hover:rf-bg-zinc-800/80",ghost:"hover:rf-bg-zinc-100 hover:rf-text-zinc-900 dark:hover:rf-bg-zinc-800 dark:hover:rf-text-zinc-50",link:"rf-text-zinc-900 rf-underline-offset-4 hover:rf-underline dark:rf-text-zinc-50"},size:{default:"rf-h-9 rf-px-4 rf-py-2",sm:"rf-h-8 rf-rounded-md rf-px-3 rf-text-xs",lg:"rf-h-10 rf-rounded-md rf-px-8",icon:"rf-h-9 rf-w-9"}},defaultVariants:{variant:"default",size:"default"}}),fA=ee.forwardRef(({className:t,variant:e,size:n,asChild:o=!1,...i},r)=>{const s=o?ZFo:"button";return K.jsx(s,{className:Oi(gU({variant:e,size:n,className:t})),ref:r,...i})});fA.displayName="Button";const J8i=({error:t,resetErrorBoundary:e})=>{const n=t instanceof Error?t:new Error(String(t));return K.jsx("div",{"data-testid":"error-container",className:"rf-error-container rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:K.jsxs("div",{className:"rf-p-4",children:[K.jsx("h2",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error Loading 3D Viewer"}),K.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-700",children:n.message}),K.jsx("details",{style:{whiteSpace:"pre-wrap"},className:"rf-text-xs rf-font-mono rf-text-red-600 rf-mt-2",children:n.stack}),e&&K.jsx("div",{className:"rf-mt-4",children:K.jsx(fA,{variant:"outline",size:"sm",onClick:e,className:"rf-text-red-700 rf-border-red-300 hover:rf-bg-red-100",children:"Retry"})})]})})},W8i=ee.createContext(null);function j8i({children:t,didCatch:e,error:n,resetErrorBoundary:o}){const i=ee.useMemo(()=>({didCatch:e,error:n,resetErrorBoundary:o}),[e,n,o]);return ee.createElement(W8i.Provider,{value:i},t)}const tWe={didCatch:!1,error:null};let bE=class extends ee.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=tWe}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){const{didCatch:n}=this.state;n&&(this.props.onReset?.({args:e,reason:"imperative-api"}),this.setState(tWe))}componentDidCatch(e,n){this.props.onError?.(e,n)}componentDidUpdate(e,n){const{didCatch:o}=this.state,{resetKeys:i}=this.props;o&&n.didCatch&&$8i(e.resetKeys,i)&&(this.props.onReset?.({next:i,prev:e.resetKeys,reason:"keys"}),this.setState(tWe))}render(){const{children:e,fallbackRender:n,FallbackComponent:o,fallback:i}=this.props,{didCatch:r,error:s}=this.state;let a=e;if(r){const A={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")a=n(A);else if(o)a=ee.createElement(o,A);else if("fallback"in this.props)a=i;else throw s}return ee.createElement(j8i,{didCatch:r,error:s,resetErrorBoundary:this.resetErrorBoundary},a)}};function $8i(t=[],e=[]){return t.length!==e.length||t.some((n,o)=>!Object.is(n,e[o]))}function q8i(t,e){if(t==null)return{};var n={},o=Object.keys(t),i,r;for(r=0;r<o.length;r++)i=o[r],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var X8i=["color"],nWe=ee.forwardRef(function(t,e){var n=t.color,o=n===void 0?"currentColor":n,i=q8i(t,X8i);return ee.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:e}),ee.createElement("path",{d:"M7.49933 0.25C3.49635 0.25 0.25 3.49593 0.25 7.50024C0.25 10.703 2.32715 13.4206 5.2081 14.3797C5.57084 14.446 5.70302 14.2222 5.70302 14.0299C5.70302 13.8576 5.69679 13.4019 5.69323 12.797C3.67661 13.235 3.25112 11.825 3.25112 11.825C2.92132 10.9874 2.44599 10.7644 2.44599 10.7644C1.78773 10.3149 2.49584 10.3238 2.49584 10.3238C3.22353 10.375 3.60629 11.0711 3.60629 11.0711C4.25298 12.1788 5.30335 11.8588 5.71638 11.6732C5.78225 11.205 5.96962 10.8854 6.17658 10.7043C4.56675 10.5209 2.87415 9.89918 2.87415 7.12104C2.87415 6.32925 3.15677 5.68257 3.62053 5.17563C3.54576 4.99226 3.29697 4.25521 3.69174 3.25691C3.69174 3.25691 4.30015 3.06196 5.68522 3.99973C6.26337 3.83906 6.8838 3.75895 7.50022 3.75583C8.1162 3.75895 8.73619 3.83906 9.31523 3.99973C10.6994 3.06196 11.3069 3.25691 11.3069 3.25691C11.7026 4.25521 11.4538 4.99226 11.3795 5.17563C11.8441 5.68257 12.1245 6.32925 12.1245 7.12104C12.1245 9.9063 10.4292 10.5192 8.81452 10.6985C9.07444 10.9224 9.30633 11.3648 9.30633 12.0413C9.30633 13.0102 9.29742 13.7922 9.29742 14.0299C9.29742 14.2239 9.42828 14.4496 9.79591 14.3788C12.6746 13.4179 14.75 10.7025 14.75 7.50024C14.75 3.49593 11.5036 0.25 7.49933 0.25Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))});const Z8i=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ebi=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,o)=>o?o.toUpperCase():n.toLowerCase()),dln=t=>{const e=ebi(t);return e.charAt(0).toUpperCase()+e.slice(1)},hln=(...t)=>t.filter((e,n,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===n).join(" ").trim();var tbi={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const nbi=ee.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:i="",children:r,iconNode:s,...a},A)=>ee.createElement("svg",{ref:A,...tbi,width:e,height:e,stroke:t,strokeWidth:o?Number(n)*24/Number(e):n,className:hln("lucide",i),...a},[...s.map(([c,l])=>ee.createElement(c,l)),...Array.isArray(r)?r:[r]]));const ec=(t,e)=>{const n=ee.forwardRef(({className:o,...i},r)=>ee.createElement(nbi,{ref:r,iconNode:e,className:hln(`lucide-${Z8i(dln(t))}`,`lucide-${t}`,o),...i}));return n.displayName=dln(t),n};const obi=ec("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const ibi=ec("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);const rbi=ec("box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const Bme=ec("bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);const CS=ec("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const pZ=ec("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const bT=ec("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const sbi=ec("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const abi=ec("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);const oWe=ec("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const Abi=ec("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);const pln=ec("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const cbi=ec("circuit-board",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M11 9h4a2 2 0 0 0 2-2V3",key:"1ve2rv"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"M7 21v-4a2 2 0 0 1 2-2h4",key:"1fwkro"}],["circle",{cx:"15",cy:"15",r:"2",key:"3i40o0"}]]);const lbi=ec("clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);const ubi=ec("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const gbi=ec("code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const mZ=ec("download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);const dbi=ec("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);const hbi=ec("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const pbi=ec("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const mbi=ec("file",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);const _bi=ec("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);const fbi=ec("fullscreen",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["rect",{width:"10",height:"8",x:"7",y:"8",rx:"1",key:"vys8me"}]]);const Ibi=ec("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);const mln=ec("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);const Cbi=ec("lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);const SE=ec("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const ybi=ec("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);const xbi=ec("message-circle-question",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Ebi=ec("minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]);const Bbi=ec("package-open",[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]);const bbi=ec("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);const _ln=ec("play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);const fln=ec("route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);const Sbi=ec("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const iWe=ec("search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const Qbi=ec("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);const vbi=ec("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const wbi=ec("truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);const Pbi=ec("upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);function Mbi(t){const e=String.fromCodePoint(...t);return btoa(e)}function Dbi(t){const e=RQe(TQe(t.trim()),{mtime:1739063707691});return Mbi(e)}function Nbi(t){return`#data:application/gzip;base64,${Dbi(t.trim())}`}function Rbi(t,e){return`https://tscircuit.com/editor?${Nbi(t)}`}var Tbi=Object.defineProperty,h1=(t,e)=>Tbi(t,"name",{value:e,configurable:!0}),rWe="dismissableLayer.update",kbi="dismissableLayer.pointerDownOutside",Fbi="dismissableLayer.focusOutside",Iln,Cln=ee.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),_Z=ee.forwardRef(h1(function(e,n){const{disableOutsidePointerEvents:o=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:A,onDismiss:c,...l}=e,u=ee.useContext(Cln),[g,h]=ee.useState(null),d=g?.ownerDocument??globalThis?.document,[,p]=ee.useState({}),m=$A(n,h),_=Array.from(u.layers),[f]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),I=f?_.indexOf(f):-1,C=g?_.indexOf(g):-1,y=u.layersWithOutsidePointerEventsDisabled.size>0,x=C>=I,E=ee.useRef(!1),B=xln(M=>{s?.(M),A?.(M),M.defaultPrevented||c?.()},{ownerDocument:d,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:E,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:ee.useCallback(M=>{if(!(M instanceof Node))return!1;const k=[...u.branches].some(R=>R.contains(M));return x&&!k},[u.branches,x])}),S=Eln(M=>{if(i&&E.current)return;const k=M.target;[...u.branches].some(F=>F.contains(k))||(a?.(M),A?.(M),M.defaultPrevented||c?.())},d),Q=g?C===_.length-1:!1,w=lE(M=>{M.key==="Escape"&&(r?.(M),!M.defaultPrevented&&c&&(M.preventDefault(),c()))});return ee.useEffect(()=>{if(Q)return d.addEventListener("keydown",w,{capture:!0}),()=>d.removeEventListener("keydown",w,{capture:!0})},[d,Q,w]),ee.useEffect(()=>{if(g)return o&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Iln=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(g)),u.layers.add(g),sWe(),()=>{o&&(u.layersWithOutsidePointerEventsDisabled.delete(g),u.layersWithOutsidePointerEventsDisabled.size===0&&(d.body.style.pointerEvents=Iln))}},[g,d,o,u]),ee.useEffect(()=>()=>{g&&(u.layers.delete(g),u.layersWithOutsidePointerEventsDisabled.delete(g),sWe())},[g,u]),ee.useEffect(()=>{const M=h1(()=>p({}),"handleUpdate");return document.addEventListener(rWe,M),()=>document.removeEventListener(rWe,M)},[]),K.jsx(Na.div,{...l,ref:m,style:{pointerEvents:y?x?"auto":"none":void 0,...e.style},onFocusCapture:ar(e.onFocusCapture,S.onFocusCapture),onBlurCapture:ar(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ar(e.onPointerDownCapture,B.onPointerDownCapture)})},"DismissableLayer"));function yln(){const t=ee.useContext(Cln),[e,n]=ee.useState(null);return ee.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}h1(yln,"useDismissableLayerSurface");var Lbi=h1(()=>!0,"IS_TRUE");function xln(t,e){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:o=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:r,shouldHandlePointerDownOutside:s=Lbi}=e,a=lE(t),A=ee.useRef(!1),c=ee.useRef(!1),l=ee.useRef(new Map),u=ee.useRef(()=>{});return ee.useEffect(()=>{function g(){c.current=!1,i.current=!1,l.current.clear()}h1(g,"resetOutsideInteraction");function h(){return Array.from(l.current.values()).some(Boolean)}h1(h,"isOutsideInteractionIntercepted");function d(I){if(!c.current)return;const C=I.target;C instanceof Node&&[...r].some(x=>x.contains(C))||l.current.set(I.type,!0),I.type==="click"&&window.setTimeout(()=>{c.current&&u.current()},0)}h1(d,"handleInteractionCapture");function p(I){c.current&&l.current.set(I.type,!1)}h1(p,"handleInteractionBubble");const m=h1(I=>{if(I.target&&!A.current){let C=function(){n.removeEventListener("click",u.current);const x=h();g(),x||aWe(kbi,a,y,{discrete:!0})};if(h1(C,"handleAndDispatchPointerDownOutsideEvent"),!s(I.target)){n.removeEventListener("click",u.current),g(),A.current=!1;return}const y={originalEvent:I};c.current=!0,i.current=o&&I.button===0,l.current.clear(),!o||I.button!==0?C():(n.removeEventListener("click",u.current),u.current=C,n.addEventListener("click",u.current,{once:!0}))}else n.removeEventListener("click",u.current),g();A.current=!1},"handlePointerDown"),_=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const I of _)n.addEventListener(I,d,!0),n.addEventListener(I,p);const f=window.setTimeout(()=>{n.addEventListener("pointerdown",m)},0);return()=>{window.clearTimeout(f),n.removeEventListener("pointerdown",m),n.removeEventListener("click",u.current);for(const I of _)n.removeEventListener(I,d,!0),n.removeEventListener(I,p)}},[n,a,o,i,r,s]),{onPointerDownCapture:h1(()=>A.current=!0,"onPointerDownCapture")}}h1(xln,"usePointerDownOutside");function Eln(t,e=globalThis?.document){const n=lE(t),o=ee.useRef(!1);return ee.useEffect(()=>{const i=h1(r=>{r.target&&!o.current&&aWe(Fbi,n,{originalEvent:r},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:h1(()=>o.current=!0,"onFocusCapture"),onBlurCapture:h1(()=>o.current=!1,"onBlurCapture")}}h1(Eln,"useFocusOutside");function sWe(){const t=new CustomEvent(rWe);document.dispatchEvent(t)}h1(sWe,"dispatchUpdate");function aWe(t,e,n,{discrete:o}){const i=n.originalEvent.target,r=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),o?hDe(i,r):i.dispatchEvent(r)}h1(aWe,"handleAndDispatchCustomEvent");var Hbi=Object.defineProperty,AWe=(t,e)=>Hbi(t,"name",{value:e,configurable:!0}),bme=0,dU=null;function Obi(t){return hU(),t.children}AWe(Obi,"FocusGuards");function hU(){ee.useEffect(()=>{dU||(dU={start:cWe(),end:cWe()});const{start:t,end:e}=dU;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),bme++,()=>{bme===1&&(dU?.start.remove(),dU?.end.remove(),dU=null),bme=Math.max(0,bme-1)}},[])}AWe(hU,"useFocusGuards");function cWe(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}AWe(cWe,"createFocusGuard");var Gbi=Object.defineProperty,l2=(t,e)=>Gbi(t,"name",{value:e,configurable:!0}),lWe="focusScope.autoFocusOnMount",uWe="focusScope.autoFocusOnUnmount",Bln={bubbles:!1,cancelable:!0},Sme=ee.forwardRef(l2(function(e,n){const{loop:o=!1,trapped:i=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...a}=e,[A,c]=ee.useState(null),l=lE(r),u=lE(s),g=ee.useRef(null),h=$A(n,c),d=ee.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;ee.useEffect(()=>{if(i){let m=function(C){if(d.paused||!A)return;const y=C.target;A.contains(y)?g.current=y:yS(g.current,{select:!0})},_=function(C){if(d.paused||!A)return;const y=C.relatedTarget;y!==null&&(A.contains(y)||yS(g.current,{select:!0}))},f=function(C){if(document.activeElement===document.body)for(const x of C)x.removedNodes.length>0&&yS(A)};l2(m,"handleFocusIn"),l2(_,"handleFocusOut"),l2(f,"handleMutations"),document.addEventListener("focusin",m),document.addEventListener("focusout",_);const I=new MutationObserver(f);return A&&I.observe(A,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",_),I.disconnect()}}},[i,A,d.paused]),ee.useEffect(()=>{if(A){wln.add(d);const m=document.activeElement;if(!A.contains(m)){const f=new CustomEvent(lWe,Bln);A.addEventListener(lWe,l),A.dispatchEvent(f),f.defaultPrevented||(bln(Mln(gWe(A)),{select:!0}),document.activeElement===m&&yS(A))}return()=>{A.removeEventListener(lWe,l),setTimeout(()=>{const f=new CustomEvent(uWe,Bln);A.addEventListener(uWe,u),A.dispatchEvent(f),f.defaultPrevented||yS(m??document.body,{select:!0}),A.removeEventListener(uWe,u),wln.remove(d)},0)}}},[A,l,u,d]);const p=ee.useCallback(m=>{if(!o&&!i||d.paused)return;const _=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,f=document.activeElement;if(_&&f){const I=m.currentTarget,[C,y]=Sln(I);C&&y?!m.shiftKey&&f===y?(m.preventDefault(),o&&yS(C,{select:!0})):m.shiftKey&&f===C&&(m.preventDefault(),o&&yS(y,{select:!0})):f===I&&m.preventDefault()}},[o,i,d.paused]);return K.jsx(Na.div,{tabIndex:-1,...a,ref:h,onKeyDown:p})},"FocusScope"));function bln(t,{select:e=!1}={}){const n=document.activeElement;for(const o of t)if(yS(o,{select:e}),document.activeElement!==n)return}l2(bln,"focusFirst");function Sln(t){const e=gWe(t),n=dWe(e,t),o=dWe(e.reverse(),t);return[n,o]}l2(Sln,"getTabbableEdges");function gWe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:l2(o=>{const i=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||i?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)e.push(n.currentNode);return e}l2(gWe,"getTabbableCandidates");function dWe(t,e){const n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const o of t)if(!(n?!o.checkVisibility({checkVisibilityCSS:!0}):Qln(o,{upTo:e})))return o}l2(dWe,"findVisible");function Qln(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}l2(Qln,"isHidden");function vln(t){return t instanceof HTMLInputElement&&"select"in t}l2(vln,"isSelectableInput");function yS(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&vln(t)&&e&&t.select()}}l2(yS,"focus");var wln=Pln();function Pln(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=hWe(t,e),t.unshift(e)},remove(e){t=hWe(t,e),t[0]?.resume()}}}l2(Pln,"createFocusScopesStack");function hWe(t,e){const n=[...t],o=n.indexOf(e);return o!==-1&&n.splice(o,1),n}l2(hWe,"arrayRemove");function Mln(t){return t.filter(e=>e.tagName!=="A")}l2(Mln,"removeLinks");const Ybi=["top","right","bottom","left"],SP=Math.min,xS=Math.max,Qme=Math.round,vme=Math.floor,ES=t=>({x:t,y:t}),Ubi={left:"right",right:"left",bottom:"top",top:"bottom"};function Dln(t,e,n){return xS(t,SP(e,n))}function BS(t,e){return typeof t=="function"?t(e):t}function QP(t){return t.split("-")[0]}function pU(t){return t.split("-")[1]}function pWe(t){return t==="x"?"y":"x"}function mWe(t){return t==="y"?"height":"width"}function G6(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function _We(t){return pWe(G6(t))}function Kbi(t,e,n){n===void 0&&(n=!1);const o=pU(t),i=_We(t),r=mWe(i);let s=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=wme(s)),[s,wme(s)]}function Vbi(t){const e=wme(t);return[fWe(t),e,fWe(e)]}function fWe(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Nln=["left","right"],Rln=["right","left"],zbi=["top","bottom"],Jbi=["bottom","top"];function Wbi(t,e,n){switch(t){case"top":case"bottom":return n?e?Rln:Nln:e?Nln:Rln;case"left":case"right":return e?zbi:Jbi;default:return[]}}function jbi(t,e,n,o){const i=pU(t);let r=Wbi(QP(t),n==="start",o);return i&&(r=r.map(s=>s+"-"+i),e&&(r=r.concat(r.map(fWe)))),r}function wme(t){const e=QP(t);return Ubi[e]+t.slice(e.length)}function $bi(t){var e,n,o,i;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(o=t.bottom)!=null?o:0,left:(i=t.left)!=null?i:0}}function Tln(t){return typeof t!="number"?$bi(t):{top:t,right:t,bottom:t,left:t}}function Pme(t){const{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function kln(t,e,n){let{reference:o,floating:i}=t;const r=G6(e),s=_We(e),a=mWe(s),A=QP(e),c=r==="y",l=o.x+o.width/2-i.width/2,u=o.y+o.height/2-i.height/2,g=o[a]/2-i[a]/2;let h;switch(A){case"top":h={x:l,y:o.y-i.height};break;case"bottom":h={x:l,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:u};break;case"left":h={x:o.x-i.width,y:u};break;default:h={x:o.x,y:o.y}}const d=pU(e);return d&&(h[s]+=g*(d==="end"?1:-1)*(n&&c?-1:1)),h}async function qbi(t,e){var n;e===void 0&&(e={});const{x:o,y:i,platform:r,rects:s,elements:a,strategy:A}=t,{boundary:c="clippingAncestors",rootBoundary:l="viewport",elementContext:u="floating",altBoundary:g=!1,padding:h=0}=BS(e,t),d=Tln(h),m=a[g?u==="floating"?"reference":"floating":u],_=Pme(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(m)))==null||n?m:m.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:c,rootBoundary:l,strategy:A})),f=u==="floating"?{x:o,y:i,width:s.floating.width,height:s.floating.height}:s.reference,I=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),C=await(r.isElement==null?void 0:r.isElement(I))&&await(r.getScale==null?void 0:r.getScale(I))||{x:1,y:1},y=Pme(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:f,offsetParent:I,strategy:A}):f);return{top:(_.top-y.top+d.top)/C.y,bottom:(y.bottom-_.bottom+d.bottom)/C.y,left:(_.left-y.left+d.left)/C.x,right:(y.right-_.right+d.right)/C.x}}const Xbi=50,Zbi=async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:s}=n,a=s.detectOverflow?s:{...s,detectOverflow:qbi},A=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:l,y:u}=kln(c,o,A),g=o,h=0;const d={};for(let p=0;p<r.length;p++){const m=r[p];if(!m)continue;const{name:_,fn:f}=m,{x:I,y:C,data:y,reset:x}=await f({x:l,y:u,initialPlacement:o,placement:g,strategy:i,middlewareData:d,rects:c,platform:a,elements:{reference:t,floating:e}});l=I??l,u=C??u,d[_]={...d[_],...y},x&&h<Xbi&&(h++,typeof x=="object"&&(x.placement&&(g=x.placement),x.rects&&(c=x.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):x.rects),{x:l,y:u}=kln(c,g,A)),p=-1)}return{x:l,y:u,placement:g,strategy:i,middlewareData:d}},eSi=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:i,rects:r,platform:s,elements:a,middlewareData:A}=e,{element:c,padding:l=0}=BS(t,e)||{};if(c==null)return{};const u=Tln(l),g={x:n,y:o},h=_We(i),d=mWe(h),p=await s.getDimensions(c),m=h==="y",_=m?"top":"left",f=m?"bottom":"right",I=m?"clientHeight":"clientWidth",C=r.reference[d]+r.reference[h]-g[h]-r.floating[d],y=g[h]-r.reference[h],x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let E=x?x[I]:0;(!E||!await(s.isElement==null?void 0:s.isElement(x)))&&(E=a.floating[I]||r.floating[d]);const B=C/2-y/2,S=E/2-p[d]/2-1,Q=SP(u[_],S),w=SP(u[f],S),M=E-p[d]-w,k=E/2-p[d]/2+B,R=Dln(Q,k,M),F=!A.arrow&&pU(i)!=null&&k!==R&&r.reference[d]/2-(k<Q?Q:w)-p[d]/2<0,O=F?k<Q?k-Q:k-M:0;return{[h]:g[h]+O,data:{[h]:R,centerOffset:k-R-O,...F&&{alignmentOffset:O}},reset:F}}}),tSi=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:r,rects:s,initialPlacement:a,platform:A,elements:c}=e,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:g,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:d="none",flipAlignment:p=!0,...m}=BS(t,e);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const _=QP(i),f=G6(a),I=QP(a)===a,C=await(A.isRTL==null?void 0:A.isRTL(c.floating)),y=g||(I||!p?[wme(a)]:Vbi(a)),x=d!=="none";!g&&x&&y.push(...jbi(a,p,d,C));const E=[a,...y],B=await A.detectOverflow(e,m),S=[];let Q=((o=r.flip)==null?void 0:o.overflows)||[];if(l&&S.push(B[_]),u){const R=Kbi(i,s,C);S.push(B[R[0]],B[R[1]])}if(Q=[...Q,{placement:i,overflows:S}],!S.every(R=>R<=0)){var w,M;const R=(((w=r.flip)==null?void 0:w.index)||0)+1,F=E[R];if(F&&(!(u==="alignment"?f!==G6(F):!1)||Q.every(Y=>G6(Y.placement)===f?Y.overflows[0]>0:!0)))return{data:{index:R,overflows:Q},reset:{placement:F}};let O=(M=Q.filter(U=>U.overflows[0]<=0).sort((U,Y)=>U.overflows[1]-Y.overflows[1])[0])==null?void 0:M.placement;if(!O)switch(h){case"bestFit":{var k;const U=(k=Q.filter(Y=>{if(x){const W=G6(Y.placement);return W===f||W==="y"}return!0}).map(Y=>[Y.placement,Y.overflows.filter(W=>W>0).reduce((W,te)=>W+te,0)]).sort((Y,W)=>Y[1]-W[1])[0])==null?void 0:k[0];U&&(O=U);break}case"initialPlacement":O=a;break}if(i!==O)return{reset:{placement:O}}}return{}}}};function Fln(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Lln(t){return Ybi.some(e=>t[e]>=0)}const nSi=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:o}=e,{strategy:i="referenceHidden",...r}=BS(t,e);switch(i){case"referenceHidden":{const s=await o.detectOverflow(e,{...r,elementContext:"reference"}),a=Fln(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Lln(a)}}}case"escaped":{const s=await o.detectOverflow(e,{...r,altBoundary:!0}),a=Fln(s,n.floating);return{data:{escapedOffsets:a,escaped:Lln(a)}}}default:return{}}}}},Hln=new Set(["left","top"]);async function oSi(t,e){const{placement:n,platform:o,elements:i}=t,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),s=QP(n),a=pU(n),A=G6(n)==="y",c=Hln.has(s)?-1:1,l=r&&A?-1:1,u=BS(e,t);let{mainAxis:g,crossAxis:h,alignmentAxis:d}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof d=="number"&&(h=a==="end"?d*-1:d),A?{x:h*l,y:g*c}:{x:g*c,y:h*l}}const iSi=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:i,y:r,placement:s,middlewareData:a}=e,A=await oSi(e,t);return s===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:i+A.x,y:r+A.y,data:{...A,placement:s}}}}},rSi=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i,platform:r}=e,{mainAxis:s=!0,crossAxis:a=!1,limiter:A={fn:f=>{let{x:I,y:C}=f;return{x:I,y:C}}},...c}=BS(t,e),l={x:n,y:o},u=await r.detectOverflow(e,c),g=G6(i),h=pWe(g);let d=l[h],p=l[g];const m=(f,I)=>Dln(I+u[f==="y"?"top":"left"],I,I-u[f==="y"?"bottom":"right"]);s&&(d=m(h,d)),a&&(p=m(g,p));const _=A.fn({...e,[h]:d,[g]:p});return{..._,data:{x:_.x-n,y:_.y-o,enabled:{[h]:s,[g]:a}}}}}},sSi=function(t){return t===void 0&&(t={}),{options:t,fn(e){var n,o;const{x:i,y:r,placement:s,rects:a,middlewareData:A}=e,{offset:c=0,mainAxis:l=!0,crossAxis:u=!0}=BS(t,e),g={x:i,y:r},h=G6(s),d=pWe(h);let p=g[d],m=g[h];const _=BS(c,e),f=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:(n=_.mainAxis)!=null?n:0,crossAxis:(o=_.crossAxis)!=null?o:0};if(l){const y=d==="y"?"height":"width",x=a.reference[d]-a.floating[y]+f.mainAxis,E=a.reference[d]+a.reference[y]-f.mainAxis;p<x?p=x:p>E&&(p=E)}if(u){var I,C;const y=d==="y"?"width":"height",x=Hln.has(QP(s)),E=a.reference[h]-a.floating[y]+(x&&((I=A.offset)==null?void 0:I[h])||0)+(x?0:f.crossAxis),B=a.reference[h]+a.reference[y]+(x?0:((C=A.offset)==null?void 0:C[h])||0)-(x?f.crossAxis:0);m<E?m=E:m>B&&(m=B)}return{[d]:p,[h]:m}}}},aSi=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:o,platform:i,elements:r}=e,{apply:s=()=>{},...a}=BS(t,e),A=await i.detectOverflow(e,a),c=QP(n),l=pU(n),u=G6(n)==="y",{width:g,height:h}=o.floating;let d,p;c==="top"||c==="bottom"?(d=c,p=l===(await(i.isRTL==null?void 0:i.isRTL(r.floating))?"start":"end")?"left":"right"):(p=c,d=l==="end"?"top":"bottom");const m=h-A.top-A.bottom,_=g-A.left-A.right,f=SP(h-A[d],m),I=SP(g-A[p],_),C=e.middlewareData.shift,y=!C;let x=f,E=I;C!=null&&C.enabled.x&&(E=_),C!=null&&C.enabled.y&&(x=m),y&&!l&&(u?E=g-2*xS(A.left,A.right):x=h-2*xS(A.top,A.bottom)),await s({...e,availableWidth:E,availableHeight:x});const B=await i.getDimensions(r.floating);return g!==B.width||h!==B.height?{reset:{rects:!0}}:{}}}};function Mme(){return typeof window<"u"}function mU(t){return Oln(t)?(t.nodeName||"").toLowerCase():"#document"}function $x(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function bS(t){var e;return(e=(Oln(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Oln(t){return Mme()?t instanceof Node||t instanceof $x(t).Node:!1}function Y6(t){return Mme()?t instanceof Element||t instanceof $x(t).Element:!1}function vP(t){return Mme()?t instanceof HTMLElement||t instanceof $x(t).HTMLElement:!1}function Gln(t){return!Mme()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof $x(t).ShadowRoot}function Dme(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=U6(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&i!=="inline"&&i!=="contents"}function ASi(t){return/^(table|td|th)$/.test(mU(t))}function Nme(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const cSi=/transform|translate|scale|rotate|perspective|filter/,lSi=/paint|layout|strict|content/,ST=t=>!!t&&t!=="none";let IWe;function CWe(t){const e=Y6(t)?U6(t):t;return ST(e.transform)||ST(e.translate)||ST(e.scale)||ST(e.rotate)||ST(e.perspective)||!yWe()&&(ST(e.backdropFilter)||ST(e.filter))||cSi.test(e.willChange||"")||lSi.test(e.contain||"")}function uSi(t){let e=QT(t);for(;vP(e)&&!fZ(e);){if(CWe(e))return e;if(Nme(e))return null;e=QT(e)}return null}function yWe(){return IWe==null&&(IWe=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),IWe}function fZ(t){return/^(html|body|#document)$/.test(mU(t))}function U6(t){return $x(t).getComputedStyle(t)}function Rme(t){return Y6(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function QT(t){if(mU(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Gln(t)&&t.host||bS(t);return Gln(e)?e.host:e}function Yln(t){const e=QT(t);return fZ(e)?(t.ownerDocument||t).body:vP(e)&&Dme(e)?e:Yln(e)}function IZ(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=Yln(t),r=i===((o=t.ownerDocument)==null?void 0:o.body),s=$x(i);if(r){const a=xWe(s);return e.concat(s,s.visualViewport||[],Dme(i)?i:[],a&&n?IZ(a):[])}else return e.concat(i,IZ(i,[],n))}function xWe(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Uln(t){const e=U6(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=vP(t),r=i?t.offsetWidth:n,s=i?t.offsetHeight:o,a=Qme(n)!==r||Qme(o)!==s;return a&&(n=r,o=s),{width:n,height:o,$:a}}function EWe(t){return Y6(t)?t:t.contextElement}function _U(t){const e=EWe(t);if(!vP(e))return ES(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:r}=Uln(e);let s=(r?Qme(n.width):n.width)/o,a=(r?Qme(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const gSi=ES(0);function Kln(t){const e=$x(t);return!yWe()||!e.visualViewport?gSi:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function dSi(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===$x(t)}function vT(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),r=EWe(t);let s=ES(1);e&&(o?Y6(o)&&(s=_U(o)):s=_U(t));const a=dSi(r,n,o)?Kln(r):ES(0);let A=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,l=i.width/s.x,u=i.height/s.y;if(r&&o){const g=$x(r),h=Y6(o)?$x(o):o;let d=g,p=xWe(d);for(;p&&h!==d;){const m=_U(p),_=p.getBoundingClientRect(),f=U6(p),I=_.left+(p.clientLeft+parseFloat(f.paddingLeft))*m.x,C=_.top+(p.clientTop+parseFloat(f.paddingTop))*m.y;A*=m.x,c*=m.y,l*=m.x,u*=m.y,A+=I,c+=C,d=$x(p),p=xWe(d)}}return Pme({width:l,height:u,x:A,y:c})}function Tme(t,e){const n=Rme(t).scrollLeft;return e?e.left+n:vT(bS(t)).left+n}function Vln(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-Tme(t,n),i=n.top+e.scrollTop;return{x:o,y:i}}function hSi(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const r=i==="fixed",s=bS(o),a=e?Nme(e.floating):!1;if(o===s||a&&r)return n;let A={scrollLeft:0,scrollTop:0},c=ES(1);const l=ES(0),u=vP(o);if((u||!r)&&((mU(o)!=="body"||Dme(s))&&(A=Rme(o)),u)){const h=vT(o);c=_U(o),l.x=h.x+o.clientLeft,l.y=h.y+o.clientTop}const g=s&&!u&&!r?Vln(s,A):ES(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-A.scrollLeft*c.x+l.x+g.x,y:n.y*c.y-A.scrollTop*c.y+l.y+g.y}}function pSi(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function mSi(t){const e=Rme(t),n=t.ownerDocument.body,o=xS(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=xS(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let r=-e.scrollLeft+Tme(t);const s=-e.scrollTop;return U6(n).direction==="rtl"&&(r+=xS(t.clientWidth,n.clientWidth)-o),{width:o,height:i,x:r,y:s}}const _Si=25;function fSi(t,e,n){n===void 0&&(n="viewport");const o=n==="layoutViewport",i=$x(t),r=bS(t),s=i.visualViewport;let a=r.clientWidth,A=r.clientHeight,c=0,l=0;if(s){const g=!yWe()||e==="fixed";o?g||(c=-s.offsetLeft,l=-s.offsetTop):(a=s.width,A=s.height,g&&(c=s.offsetLeft,l=s.offsetTop))}if(Tme(r)<=0){const g=r.ownerDocument,h=g.body,d=getComputedStyle(h),p=g.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,m=Math.abs(r.clientWidth-h.clientWidth-p),_=getComputedStyle(r).scrollbarGutter==="stable both-edges"?m/2:m;_<=_Si&&(a-=_)}return{width:a,height:A,x:c,y:l}}function ISi(t,e){const n=vT(t,!0,e==="fixed"),o=n.top+t.clientTop,i=n.left+t.clientLeft,r=_U(t),s=t.clientWidth*r.x,a=t.clientHeight*r.y,A=i*r.x,c=o*r.y;return{width:s,height:a,x:A,y:c}}function zln(t,e,n){let o;if(e==="viewport"||e==="layoutViewport")o=fSi(t,n,e);else if(e==="document")o=mSi(bS(t));else if(Y6(e))o=ISi(e,n);else{const i=Kln(t);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Pme(o)}function CSi(t,e){const n=e.get(t);if(n)return n;let o=IZ(t,[],!1).filter(a=>Y6(a)&&mU(a)!=="body"),i=null;const r=U6(t).position==="fixed";let s=r?QT(t):t;for(;Y6(s)&&!fZ(s);){const a=U6(s),A=CWe(s),c=i?i.position:r?"fixed":"";!A&&(c==="fixed"||c==="absolute"&&a.position==="static")?o=o.filter(u=>u!==s):i=a,s=QT(s)}return e.set(t,o),o}function ySi(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const s=[...n==="clippingAncestors"?Nme(e)?[]:CSi(e,this._c):[].concat(n),o],a=zln(e,s[0],i);let A=a.top,c=a.right,l=a.bottom,u=a.left;for(let g=1;g<s.length;g++){const h=zln(e,s[g],i);A=xS(h.top,A),c=SP(h.right,c),l=SP(h.bottom,l),u=xS(h.left,u)}return{width:c-u,height:l-A,x:u,y:A}}function xSi(t){const{width:e,height:n}=Uln(t);return{width:e,height:n}}function ESi(t,e,n){const o=vP(e),i=bS(e),r=n==="fixed",s=vT(t,!0,r,e);let a={scrollLeft:0,scrollTop:0};const A=ES(0);if((o||!r)&&((mU(e)!=="body"||Dme(i))&&(a=Rme(e)),o)){const g=vT(e,!0,r,e);A.x=g.x+e.clientLeft,A.y=g.y+e.clientTop}!o&&i&&(A.x=Tme(i));const c=i&&!o&&!r?Vln(i,a):ES(0),l=s.left+a.scrollLeft-A.x-c.x,u=s.top+a.scrollTop-A.y-c.y;return{x:l,y:u,width:s.width,height:s.height}}function BWe(t){return U6(t).position==="static"}function Jln(t,e){if(!vP(t)||U6(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return bS(t)===n&&(n=n.ownerDocument.body),n}function Wln(t,e){const n=$x(t);if(Nme(t))return n;if(!vP(t)){let i=QT(t);for(;i&&!fZ(i);){if(Y6(i)&&!BWe(i))return i;i=QT(i)}return n}let o=Jln(t,e);for(;o&&ASi(o)&&BWe(o);)o=Jln(o,e);return o&&fZ(o)&&BWe(o)&&!CWe(o)?n:o||uSi(t)||n}const BSi=async function(t){const e=this.getOffsetParent||Wln,n=this.getDimensions,o=await n(t.floating);return{reference:ESi(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function bSi(t){return U6(t).direction==="rtl"}const SSi={convertOffsetParentRelativeRectToViewportRelativeRect:hSi,getDocumentElement:bS,getClippingRect:ySi,getOffsetParent:Wln,getElementRects:BSi,getClientRects:pSi,getDimensions:xSi,getScale:_U,isElement:Y6,isRTL:bSi};function jln(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function QSi(t,e,n){let o=null,i;const r=bS(t);function s(){var l;clearTimeout(i),(l=o)==null||l.disconnect(),o=null}function a(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),s();const g=t.getBoundingClientRect(),{left:h,top:d,width:p,height:m}=g;if(l||e(),!p||!m)return;const _=vme(d),f=vme(r.clientWidth-(h+p)),I=vme(r.clientHeight-(d+m)),C=vme(h),x={rootMargin:-_+"px "+-f+"px "+-I+"px "+-C+"px",threshold:xS(0,SP(1,u))||1};let E=!0;function B(S){const Q=S[0].intersectionRatio;if(!jln(g,t.getBoundingClientRect()))return a();if(Q!==u){if(!E)return a();Q?a(!1,Q):i=setTimeout(()=>{a(!1,1e-7)},1e3)}E=!1}try{o=new IntersectionObserver(B,{...x,root:r.ownerDocument})}catch{o=new IntersectionObserver(B,x)}o.observe(t)}const A=$x(t),c=()=>a(n);return A.addEventListener("resize",c),a(!0),()=>{A.removeEventListener("resize",c),s()}}function vSi(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:A=!1}=o,c=EWe(t),l=i||r?[...c?IZ(c):[],...e?IZ(e):[]]:[];l.forEach(_=>{i&&_.addEventListener("scroll",n),r&&_.addEventListener("resize",n)});const u=c&&a?QSi(c,n,r):null;let g=-1,h=null;s&&(h=new ResizeObserver(_=>{let[f]=_;f&&f.target===c&&h&&e&&(h.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var I;(I=h)==null||I.observe(e)})),n()}),c&&!A&&h.observe(c),e&&h.observe(e));let d,p=A?vT(t):null;A&&m();function m(){const _=vT(t);p&&!jln(p,_)&&n(),p=_,d=requestAnimationFrame(m)}return n(),()=>{var _;l.forEach(f=>{i&&f.removeEventListener("scroll",n),r&&f.removeEventListener("resize",n)}),u?.(),(_=h)==null||_.disconnect(),h=null,A&&cancelAnimationFrame(d)}}const wSi=iSi,PSi=rSi,MSi=tSi,DSi=aSi,NSi=nSi,$ln=eSi,RSi=sSi,TSi=(t,e,n)=>{const o=new Map,i=n??{},r={...SSi,...i.platform,_c:o};return Zbi(t,e,{...i,platform:r})};var kSi=typeof document<"u",FSi=function(){},kme=kSi?ee.useLayoutEffect:FSi;function Fme(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,o,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;o--!==0;)if(!Fme(t[o],e[o]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(e,i[o]))return!1;for(o=n;o--!==0;){const r=i[o];if(!(r==="_owner"&&t.$$typeof)&&!Fme(t[r],e[r]))return!1}return!0}return t!==t&&e!==e}function qln(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Xln(t,e){const n=qln(t);return Math.round(e*n)/n}function bWe(t){const e=ee.useRef(t);return kme(()=>{e.current=t}),e}function LSi(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:r,floating:s}={},transform:a=!0,whileElementsMounted:A,open:c}=t,[l,u]=ee.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,h]=ee.useState(o);Fme(g,o)||h(o);const[d,p]=ee.useState(null),[m,_]=ee.useState(null),f=ee.useCallback(Y=>{Y!==x.current&&(x.current=Y,p(Y))},[]),I=ee.useCallback(Y=>{Y!==E.current&&(E.current=Y,_(Y))},[]),C=r||d,y=s||m,x=ee.useRef(null),E=ee.useRef(null),B=ee.useRef(l),S=A!=null,Q=bWe(A),w=bWe(i),M=bWe(c),k=ee.useCallback(()=>{if(!x.current||!E.current)return;const Y={placement:e,strategy:n,middleware:g};w.current&&(Y.platform=w.current),TSi(x.current,E.current,Y).then(W=>{const te={...W,isPositioned:M.current!==!1};R.current&&!Fme(B.current,te)&&(B.current=te,c6.flushSync(()=>{u(te)}))})},[g,e,n,w,M]);kme(()=>{c===!1&&B.current.isPositioned&&(B.current.isPositioned=!1,u(Y=>({...Y,isPositioned:!1})))},[c]);const R=ee.useRef(!1);kme(()=>(R.current=!0,()=>{R.current=!1}),[]),kme(()=>{if(C&&(x.current=C),y&&(E.current=y),C&&y){if(Q.current)return Q.current(C,y,k);k()}},[C,y,k,Q,S]);const F=ee.useMemo(()=>({reference:x,floating:E,setReference:f,setFloating:I}),[f,I]),O=ee.useMemo(()=>({reference:C,floating:y}),[C,y]),U=ee.useMemo(()=>{const Y={position:n,left:0,top:0};if(!O.floating)return Y;const W=Xln(O.floating,l.x),te=Xln(O.floating,l.y);return a?{...Y,transform:"translate("+W+"px, "+te+"px)",...qln(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:te}},[n,a,O.floating,l.x,l.y]);return ee.useMemo(()=>({...l,update:k,refs:F,elements:O,floatingStyles:U}),[l,k,F,O,U])}const HSi=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:o,padding:i}=typeof t=="function"?t(n):t;return o&&e(o)?o.current!=null?$ln({element:o.current,padding:i}).fn(n):{}:o?$ln({element:o,padding:i}).fn(n):{}}}},OSi=(t,e)=>{const n=wSi(t);return{name:n.name,fn:n.fn,options:[t,e]}},GSi=(t,e)=>{const n=PSi(t);return{name:n.name,fn:n.fn,options:[t,e]}},YSi=(t,e)=>({fn:RSi(t).fn,options:[t,e]}),USi=(t,e)=>{const n=MSi(t);return{name:n.name,fn:n.fn,options:[t,e]}},KSi=(t,e)=>{const n=DSi(t);return{name:n.name,fn:n.fn,options:[t,e]}},VSi=(t,e)=>{const n=NSi(t);return{name:n.name,fn:n.fn,options:[t,e]}},zSi=(t,e)=>{const n=HSi(t);return{name:n.name,fn:n.fn,options:[t,e]}};var JSi=Object.defineProperty,WSi=(t,e)=>JSi(t,"name",{value:e,configurable:!0});function SWe(t){const[e,n]=ee.useState(void 0);return Ep(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const o=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const r=i[0];let s,a;if("borderBoxSize"in r){const A=r.borderBoxSize,c=Array.isArray(A)?A[0]:A;s=c.inlineSize,a=c.blockSize}else s=t.offsetWidth,a=t.offsetHeight;n({width:s,height:a})});return o.observe(t,{box:"border-box"}),()=>o.unobserve(t)}else n(void 0)},[t]),e}WSi(SWe,"useSize");var jSi=Object.defineProperty,wP=(t,e)=>jSi(t,"name",{value:e,configurable:!0}),Zln="Popper",[e0n,PP]=Nx(Zln),[$Si,t0n]=e0n(Zln),qSi=wP(t=>{const{__scopePopper:e,children:n}=t,[o,i]=ee.useState(null),[r,s]=ee.useState(void 0);return K.jsx($Si,{scope:e,anchor:o,onAnchorChange:i,placementState:r,setPlacementState:s,children:n})},"Popper"),XSi="PopperAnchor",ZSi=ee.forwardRef(wP(function(e,n){const{__scopePopper:o,virtualRef:i,...r}=e,s=t0n(XSi,o),a=ee.useRef(null),A=s.onAnchorChange,c=ee.useCallback(p=>{a.current=p,p&&A(p)},[A]),l=$A(n,c),u=ee.useRef(null);ee.useEffect(()=>{if(!i)return;const p=u.current;u.current=i.current,p!==u.current&&A(u.current)});const g=s.placementState&&Lme(s.placementState),h=g?.[0],d=g?.[1];return i?null:K.jsx(Na.div,{"data-radix-popper-side":h,"data-radix-popper-align":d,...r,ref:l})},"PopperAnchor")),n0n="PopperContent",[eQi,bmr]=e0n(n0n),tQi=ee.forwardRef(wP(function(e,n){const{__scopePopper:o,side:i="bottom",sideOffset:r=0,align:s="center",alignOffset:a=0,arrowPadding:A=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:g="partial",hideWhenDetached:h=!1,updatePositionStrategy:d="optimized",onPlaced:p,...m}=e,_=t0n(n0n,o),[f,I]=ee.useState(null),C=$A(n,I),[y,x]=ee.useState(null),E=SWe(y),B=E?.width??0,S=E?.height??0,Q=i+(s!=="center"?"-"+s:""),w=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},M=Array.isArray(l)?l:[l],k=M.length>0,R={padding:w,boundary:M.filter(o0n),altBoundary:k},{refs:F,floatingStyles:O,placement:U,isPositioned:Y,middlewareData:W}=LSi({strategy:"fixed",placement:Q,whileElementsMounted:wP((...ue)=>vSi(...ue,{animationFrame:d==="always"}),"whileElementsMounted"),elements:{reference:_.anchor},middleware:[OSi({mainAxis:r+S,alignmentAxis:a}),c&&GSi({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?YSi():void 0,...R}),c&&USi({...R}),KSi({...R,apply:wP(({elements:ue,rects:fe,availableWidth:pe,availableHeight:ye})=>{const{width:Me,height:ve}=fe.reference,he=ue.floating.style;he.setProperty("--radix-popper-available-width",`${pe}px`),he.setProperty("--radix-popper-available-height",`${ye}px`),he.setProperty("--radix-popper-anchor-width",`${Me}px`),he.setProperty("--radix-popper-anchor-height",`${ve}px`)},"apply")}),y&&zSi({element:y,padding:A}),nQi({arrowWidth:B,arrowHeight:S}),h&&VSi({strategy:"referenceHidden",...R,boundary:k?R.boundary:void 0})]}),te=_.setPlacementState;Ep(()=>(te(U),()=>{te(void 0)}),[U,te]);const[j,J]=Lme(U),oe=lE(p);Ep(()=>{Y&&oe?.()},[Y,oe]);const ie=W.arrow?.x,ne=W.arrow?.y,le=W.arrow?.centerOffset!==0,[ge,_e]=ee.useState();return Ep(()=>{f&&_e(window.getComputedStyle(f).zIndex)},[f]),K.jsx("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...O,transform:Y?O.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ge,"--radix-popper-transform-origin":[W.transformOrigin?.x,W.transformOrigin?.y].join(" "),...W.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:K.jsx(eQi,{scope:o,placedSide:j,placedAlign:J,onArrowChange:x,arrowX:ie,arrowY:ne,shouldHideArrow:le,children:K.jsx(Na.div,{"data-side":j,"data-align":J,...m,ref:C,style:{...m.style,animation:Y?m.style?.animation:"none"}})})})},"PopperContent"));function o0n(t){return t!==null}wP(o0n,"isNotNull");var nQi=wP(t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:o,middlewareData:i}=e,s=i.arrow?.centerOffset!==0,a=s?0:t.arrowWidth,A=s?0:t.arrowHeight,[c,l]=Lme(n),u={start:"0%",center:"50%",end:"100%"}[l],g=(i.arrow?.x??0)+a/2,h=(i.arrow?.y??0)+A/2;let d="",p="";return c==="bottom"?(d=s?u:`${g}px`,p=`${-A}px`):c==="top"?(d=s?u:`${g}px`,p=`${o.floating.height+A}px`):c==="right"?(d=`${-A}px`,p=s?u:`${h}px`):c==="left"&&(d=`${o.floating.width+A}px`,p=s?u:`${h}px`),{data:{x:d,y:p}}}}),"transformOrigin");function Lme(t){const[e,n="center"]=t.split("-");return[e,n]}wP(Lme,"getSideAndAlignFromPlacement");var CZ=qSi,Hme=ZSi,Ome=tQi,oQi=Object.defineProperty,iQi=(t,e)=>oQi(t,"name",{value:e,configurable:!0}),Gme=ee.forwardRef(iQi(function(e,n){const{container:o,...i}=e,[r,s]=ee.useState(!1);Ep(()=>s(!0),[]);const a=o||r&&globalThis?.document?.body;return a?c6.createPortal(K.jsx(Na.div,{...i,ref:n}),a):null},"Portal")),rQi=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},fU=new WeakMap,Yme=new WeakMap,Ume={},QWe=0,i0n=function(t){return t&&(t.host||i0n(t.parentNode))},sQi=function(t,e){return e.map(function(n){if(t.contains(n))return n;var o=i0n(n);return o&&t.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},aQi=function(t,e,n,o){var i=sQi(e,Array.isArray(t)?t:[t]);Ume[n]||(Ume[n]=new WeakMap);var r=Ume[n],s=[],a=new Set,A=new Set(i),c=function(u){!u||a.has(u)||(a.add(u),c(u.parentNode))};i.forEach(c);var l=function(u){!u||A.has(u)||Array.prototype.forEach.call(u.children,function(g){if(a.has(g))l(g);else try{var h=g.getAttribute(o),d=h!==null&&h!=="false",p=(fU.get(g)||0)+1,m=(r.get(g)||0)+1;fU.set(g,p),r.set(g,m),s.push(g),p===1&&d&&Yme.set(g,!0),m===1&&g.setAttribute(n,"true"),d||g.setAttribute(o,"true")}catch(_){console.error("aria-hidden: cannot operate on ",g,_)}})};return l(e),a.clear(),QWe++,function(){s.forEach(function(u){var g=fU.get(u)-1,h=r.get(u)-1;fU.set(u,g),r.set(u,h),g||(Yme.has(u)||u.removeAttribute(o),Yme.delete(u)),h||u.removeAttribute(n)}),QWe--,QWe||(fU=new WeakMap,fU=new WeakMap,Yme=new WeakMap,Ume={})}},Kme=function(t,e,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(t)?t:[t]),i=rQi(t);return i?(o.push.apply(o,Array.from(i.querySelectorAll("[aria-live], script"))),aQi(o,i,n,"aria-hidden")):function(){return null}},K6=function(){return K6=Object.assign||function(e){for(var n,o=1,i=arguments.length;o<i;o++){n=arguments[o];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},K6.apply(this,arguments)};function r0n(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,o=Object.getOwnPropertySymbols(t);i<o.length;i++)e.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(t,o[i])&&(n[o[i]]=t[o[i]]);return n}function AQi(t,e,n){if(n||arguments.length===2)for(var o=0,i=e.length,r;o<i;o++)(r||!(o in e))&&(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;var Vme="right-scroll-bar-position",zme="width-before-scroll-bar",cQi="with-scroll-bars-hidden",lQi="--removed-body-scroll-bar-size";function vWe(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function uQi(t,e){var n=ee.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(o){var i=n.value;i!==o&&(n.value=o,n.callback(o,i))}}}})[0];return n.callback=e,n.facade}var gQi=typeof window<"u"?ee.useLayoutEffect:ee.useEffect,s0n=new WeakMap;function dQi(t,e){var n=uQi(null,function(o){return t.forEach(function(i){return vWe(i,o)})});return gQi(function(){var o=s0n.get(n);if(o){var i=new Set(o),r=new Set(t),s=n.current;i.forEach(function(a){r.has(a)||vWe(a,null)}),r.forEach(function(a){i.has(a)||vWe(a,s)})}s0n.set(n,t)},[t]),n}function hQi(t){return t}function pQi(t,e){e===void 0&&(e=hQi);var n=[],o=!1,i={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(r){var s=e(r,o);return n.push(s),function(){n=n.filter(function(a){return a!==s})}},assignSyncMedium:function(r){for(o=!0;n.length;){var s=n;n=[],s.forEach(r)}n={push:function(a){return r(a)},filter:function(){return n}}},assignMedium:function(r){o=!0;var s=[];if(n.length){var a=n;n=[],a.forEach(r),s=n}var A=function(){var l=s;s=[],l.forEach(r)},c=function(){return Promise.resolve().then(A)};c(),n={push:function(l){s.push(l),c()},filter:function(l){return s=s.filter(l),n}}}};return i}function mQi(t){t===void 0&&(t={});var e=pQi(null);return e.options=K6({async:!0,ssr:!1},t),e}var a0n=function(t){var e=t.sideCar,n=r0n(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=e.read();if(!o)throw new Error("Sidecar medium not found");return ee.createElement(o,K6({},n))};a0n.isSideCarExport=!0;function _Qi(t,e){return t.useMedium(e),a0n}var A0n=mQi(),wWe=function(){},Jme=ee.forwardRef(function(t,e){var n=ee.useRef(null),o=ee.useState({onScrollCapture:wWe,onWheelCapture:wWe,onTouchMoveCapture:wWe}),i=o[0],r=o[1],s=t.forwardProps,a=t.children,A=t.className,c=t.removeScrollBar,l=t.enabled,u=t.shards,g=t.sideCar,h=t.noRelative,d=t.noIsolation,p=t.inert,m=t.allowPinchZoom,_=t.as,f=_===void 0?"div":_,I=t.gapMode,C=r0n(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),y=g,x=dQi([n,e]),E=K6(K6({},C),i);return ee.createElement(ee.Fragment,null,l&&ee.createElement(y,{sideCar:A0n,removeScrollBar:c,shards:u,noRelative:h,noIsolation:d,inert:p,setCallbacks:r,allowPinchZoom:!!m,lockRef:n,gapMode:I}),s?ee.cloneElement(ee.Children.only(a),K6(K6({},E),{ref:x})):ee.createElement(f,K6({},E,{className:A,ref:x}),a))});Jme.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Jme.classNames={fullWidth:zme,zeroRight:Vme};var fQi=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function IQi(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=fQi();return e&&t.setAttribute("nonce",e),t}function CQi(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function yQi(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var xQi=function(){var t=0,e=null;return{add:function(n){t==0&&(e=IQi())&&(CQi(e,n),yQi(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},EQi=function(){var t=xQi();return function(e,n){ee.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},c0n=function(){var t=EQi(),e=function(n){var o=n.styles,i=n.dynamic;return t(o,i),null};return e},BQi={left:0,top:0,right:0,gap:0},PWe=function(t){return parseInt(t||"",10)||0},bQi=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],o=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[PWe(n),PWe(o),PWe(i)]},SQi=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return BQi;var e=bQi(t),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,o-n+e[2]-e[0])}},QQi=c0n(),IU="data-scroll-locked",vQi=function(t,e,n,o){var i=t.left,r=t.top,s=t.right,a=t.gap;return n===void 0&&(n="margin"),`
.`.concat(cQi,` {
overflow: hidden `).concat(o,`;
padding-right: `).concat(a,"px ").concat(o,`;
}
body[`).concat(IU,`] {
overflow: hidden `).concat(o,`;
overscroll-behavior: contain;
`).concat([e&&"position: relative ".concat(o,";"),n==="margin"&&`
padding-left: `.concat(i,`px;
padding-top: `).concat(r,`px;
padding-right: `).concat(s,`px;
margin-left:0;
margin-top:0;
margin-right: `).concat(a,"px ").concat(o,`;
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(o,";")].filter(Boolean).join(""),`
}
.`).concat(Vme,` {
right: `).concat(a,"px ").concat(o,`;
}
.`).concat(zme,` {
margin-right: `).concat(a,"px ").concat(o,`;
}
.`).concat(Vme," .").concat(Vme,` {
right: 0 `).concat(o,`;
}
.`).concat(zme," .").concat(zme,` {
margin-right: 0 `).concat(o,`;
}
body[`).concat(IU,`] {
`).concat(lQi,": ").concat(a,`px;
}
`)},l0n=function(){var t=parseInt(document.body.getAttribute(IU)||"0",10);return isFinite(t)?t:0},wQi=function(){ee.useEffect(function(){return document.body.setAttribute(IU,(l0n()+1).toString()),function(){var t=l0n()-1;t<=0?document.body.removeAttribute(IU):document.body.setAttribute(IU,t.toString())}},[])},PQi=function(t){var e=t.noRelative,n=t.noImportant,o=t.gapMode,i=o===void 0?"margin":o;wQi();var r=ee.useMemo(function(){return SQi(i)},[i]);return ee.createElement(QQi,{styles:vQi(r,!e,i,n?"":"!important")})},MWe=!1;if(typeof window<"u")try{var Wme=Object.defineProperty({},"passive",{get:function(){return MWe=!0,!0}});window.addEventListener("test",Wme,Wme),window.removeEventListener("test",Wme,Wme)}catch{MWe=!1}var CU=MWe?{passive:!1}:!1,MQi=function(t){return t.tagName==="TEXTAREA"},u0n=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!MQi(t)&&n[e]==="visible")},DQi=function(t){return u0n(t,"overflowY")},NQi=function(t){return u0n(t,"overflowX")},g0n=function(t,e){var n=e.ownerDocument,o=e;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var i=d0n(t,o);if(i){var r=h0n(t,o),s=r[1],a=r[2];if(s>a)return!0}o=o.parentNode}while(o&&o!==n.body);return!1},RQi=function(t){var e=t.scrollTop,n=t.scrollHeight,o=t.clientHeight;return[e,n,o]},TQi=function(t){var e=t.scrollLeft,n=t.scrollWidth,o=t.clientWidth;return[e,n,o]},d0n=function(t,e){return t==="v"?DQi(e):NQi(e)},h0n=function(t,e){return t==="v"?RQi(e):TQi(e)},kQi=function(t,e){return t==="h"&&e==="rtl"?-1:1},FQi=function(t,e,n,o,i){var r=kQi(t,window.getComputedStyle(e).direction),s=r*o,a=n.target,A=e.contains(a),c=!1,l=s>0,u=0,g=0;do{if(!a)break;var h=h0n(t,a),d=h[0],p=h[1],m=h[2],_=p-m-r*d;(d||_)&&d0n(t,a)&&(u+=_,g+=d);var f=a.parentNode;a=f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE?f.host:f}while(!A&&a!==document.body||A&&(e.contains(a)||e===a));return(l&&Math.abs(u)<1||!l&&Math.abs(g)<1)&&(c=!0),c},jme=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},p0n=function(t){return[t.deltaX,t.deltaY]},m0n=function(t){return t&&"current"in t?t.current:t},LQi=function(t,e){return t[0]===e[0]&&t[1]===e[1]},HQi=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},OQi=0,yU=[];function GQi(t){var e=ee.useRef([]),n=ee.useRef([0,0]),o=ee.useRef(),i=ee.useState(OQi++)[0],r=ee.useState(c0n)[0],s=ee.useRef(t);ee.useEffect(function(){s.current=t},[t]),ee.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var p=AQi([t.lockRef.current],(t.shards||[]).map(m0n),!0).filter(Boolean);return p.forEach(function(m){return m.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),p.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=ee.useCallback(function(p,m){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!s.current.allowPinchZoom;var _=jme(p),f=n.current,I="deltaX"in p?p.deltaX:f[0]-_[0],C="deltaY"in p?p.deltaY:f[1]-_[1],y,x=p.target,E=Math.abs(I)>Math.abs(C)?"h":"v";if("touches"in p&&E==="h"&&x.type==="range")return!1;var B=window.getSelection(),S=B&&B.anchorNode,Q=S?S===x||S.contains(x):!1;if(Q)return!1;var w=g0n(E,x);if(!w)return!0;if(w?y=E:(y=E==="v"?"h":"v",w=g0n(E,x)),!w)return!1;if(!o.current&&"changedTouches"in p&&(I||C)&&(o.current=y),!y)return!0;var M=o.current||y;return FQi(M,m,p,M==="h"?I:C)},[]),A=ee.useCallback(function(p){var m=p;if(!(!yU.length||yU[yU.length-1]!==r)){var _="deltaY"in m?p0n(m):jme(m),f=e.current.filter(function(y){return y.name===m.type&&(y.target===m.target||m.target===y.shadowParent)&&LQi(y.delta,_)})[0];if(f&&f.should){m.cancelable&&m.preventDefault();return}if(!f){var I=(s.current.shards||[]).map(m0n).filter(Boolean).filter(function(y){return y.contains(m.target)}),C=I.length>0?a(m,I[0]):!s.current.noIsolation;C&&m.cancelable&&m.preventDefault()}}},[]),c=ee.useCallback(function(p,m,_,f){var I={name:p,delta:m,target:_,should:f,shadowParent:YQi(_)};e.current.push(I),setTimeout(function(){e.current=e.current.filter(function(C){return C!==I})},1)},[]),l=ee.useCallback(function(p){n.current=jme(p),o.current=void 0},[]),u=ee.useCallback(function(p){c(p.type,p0n(p),p.target,a(p,t.lockRef.current))},[]),g=ee.useCallback(function(p){c(p.type,jme(p),p.target,a(p,t.lockRef.current))},[]);ee.useEffect(function(){return yU.push(r),t.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:g}),document.addEventListener("wheel",A,CU),document.addEventListener("touchmove",A,CU),document.addEventListener("touchstart",l,CU),function(){yU=yU.filter(function(p){return p!==r}),document.removeEventListener("wheel",A,CU),document.removeEventListener("touchmove",A,CU),document.removeEventListener("touchstart",l,CU)}},[]);var h=t.removeScrollBar,d=t.inert;return ee.createElement(ee.Fragment,null,d?ee.createElement(r,{styles:HQi(i)}):null,h?ee.createElement(PQi,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function YQi(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const UQi=_Qi(A0n,GQi);var yZ=ee.forwardRef(function(t,e){return ee.createElement(Jme,K6({},t,{ref:e,sideCar:UQi}))});yZ.classNames=Jme.classNames;var KQi=Object.defineProperty,Hl=(t,e)=>KQi(t,"name",{value:e,configurable:!0}),DWe=["Enter"," "],VQi=["ArrowDown","PageUp","Home"],_0n=["ArrowUp","PageDown","End"],zQi=[...VQi,..._0n],JQi={ltr:[...DWe,"ArrowRight"],rtl:[...DWe,"ArrowLeft"]},WQi={ltr:["ArrowLeft"],rtl:["ArrowRight"]},$me="Menu",[xZ,jQi,$Qi]=tge($me),[wT,f0n]=Nx($me,[$Qi,PP,ige]),qme=PP(),I0n=ige(),[C0n,MP]=wT($me),[qQi,EZ]=wT($me),XQi=Hl(t=>{const{__scopeMenu:e,open:n=!1,children:o,dir:i,onOpenChange:r,modal:s=!0}=t,a=qme(e),[A,c]=ee.useState(null),l=ee.useRef(!1),u=lE(r),g=Q$(i);return ee.useEffect(()=>{const h=Hl(()=>{l.current=!0,document.addEventListener("pointerdown",d,{capture:!0,once:!0}),document.addEventListener("pointermove",d,{capture:!0,once:!0})},"handleKeyDown"),d=Hl(()=>l.current=!1,"handlePointer");return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",d,{capture:!0}),document.removeEventListener("pointermove",d,{capture:!0})}},[]),ee.useEffect(()=>{if(!n)return;const h=Hl(()=>u(!1),"handleBlur");return window.addEventListener("blur",h),()=>window.removeEventListener("blur",h)},[n,u]),K.jsx(CZ,{...a,children:K.jsx(C0n,{scope:e,open:n,onOpenChange:u,content:A,onContentChange:c,children:K.jsx(qQi,{scope:e,onClose:ee.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:l,dir:g,modal:s,children:o})})})},"Menu"),y0n=ee.forwardRef(Hl(function(e,n){const{__scopeMenu:o,...i}=e,r=qme(o);return K.jsx(Hme,{...r,...i,ref:n})},"MenuAnchor")),x0n="MenuPortal",[ZQi,E0n]=wT(x0n,{forceMount:void 0}),evi=Hl(t=>{const{__scopeMenu:e,forceMount:n,children:o,container:i}=t,r=MP(x0n,e);return K.jsx(ZQi,{scope:e,forceMount:n,children:K.jsx(uE,{present:n||r.open,children:K.jsx(Gme,{asChild:!0,container:i,children:o})})})},"MenuPortal"),t9="MenuContent",[tvi,NWe]=wT(t9),nvi=ee.forwardRef(Hl(function(e,n){const o=E0n(t9,e.__scopeMenu),{forceMount:i=o.forceMount,...r}=e,s=MP(t9,e.__scopeMenu),a=EZ(t9,e.__scopeMenu);return K.jsx(xZ.Provider,{scope:e.__scopeMenu,children:K.jsx(uE,{present:i||s.open,children:K.jsx(xZ.Slot,{scope:e.__scopeMenu,children:a.modal?K.jsx(ovi,{...r,ref:n}):K.jsx(ivi,{...r,ref:n})})})})},"MenuContent")),ovi=ee.forwardRef(Hl(function(e,n){const o=MP(t9,e.__scopeMenu),i=ee.useRef(null),r=$A(n,i);return ee.useEffect(()=>{const s=i.current;if(s)return Kme(s)},[]),K.jsx(RWe,{...e,ref:r,trapFocus:o.open,disableOutsidePointerEvents:o.open,disableOutsideScroll:!0,onFocusOutside:ar(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>o.onOpenChange(!1)})},"MenuRootContentModal")),ivi=ee.forwardRef(Hl(function(e,n){const o=MP(t9,e.__scopeMenu);return K.jsx(RWe,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>o.onOpenChange(!1)})},"MenuRootContentNonModal")),rvi=MB("MenuContent.ScrollLock"),RWe=ee.forwardRef(Hl(function(e,n){const{__scopeMenu:o,loop:i=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:A,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:g,onInteractOutside:h,onDismiss:d,disableOutsideScroll:p,...m}=e,_=MP(t9,o),f=EZ(t9,o),I=qme(o),C=I0n(o),y=jQi(o),[x,E]=ee.useState(null),B=ee.useRef(null),S=$A(n,B,_.onContentChange),Q=ee.useRef(0),w=ee.useRef(""),M=ee.useRef(0),k=ee.useRef(null),R=ee.useRef("right"),F=ee.useRef(0),O=p?yZ:ee.Fragment,U=p?{as:rvi,allowPinchZoom:!0}:void 0,Y=Hl(te=>{const j=w.current+te,J=y().filter(_e=>!_e.disabled),oe=document.activeElement,ie=J.find(_e=>_e.ref.current===oe)?.textValue,ne=J.map(_e=>_e.textValue),le=D0n(ne,j,ie),ge=J.find(_e=>_e.textValue===le)?.ref.current;Hl((function _e(ue){w.current=ue,window.clearTimeout(Q.current),ue!==""&&(Q.current=window.setTimeout(()=>_e(""),1e3))}),"updateSearch")(j),ge&&setTimeout(()=>ge.focus())},"handleTypeaheadSearch");ee.useEffect(()=>()=>window.clearTimeout(Q.current),[]),hU();const W=ee.useCallback(te=>R.current===k.current?.side&&R0n(te,k.current?.area),[]);return K.jsx(tvi,{scope:o,searchRef:w,onItemEnter:ee.useCallback(te=>{W(te)&&te.preventDefault()},[W]),onItemLeave:ee.useCallback(te=>{W(te)||(B.current?.focus(),E(null))},[W]),onTriggerLeave:ee.useCallback(te=>{W(te)&&te.preventDefault()},[W]),pointerGraceTimerRef:M,onPointerGraceIntentChange:ee.useCallback(te=>{k.current=te},[]),children:K.jsx(O,{...U,children:K.jsx(Sme,{asChild:!0,trapped:r,onMountAutoFocus:ar(s,te=>{te.preventDefault(),B.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:K.jsx(_Z,{asChild:!0,disableOutsidePointerEvents:A,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:g,onInteractOutside:h,onDismiss:d,children:K.jsx(WFt,{asChild:!0,...C,dir:f.dir,orientation:"vertical",loop:i,currentTabStopId:x,onCurrentTabStopIdChange:E,onEntryFocus:ar(c,te=>{f.isUsingKeyboardRef.current||te.preventDefault()}),preventScrollOnEntryFocus:!0,children:K.jsx(Ome,{role:"menu","aria-orientation":"vertical","data-state":FWe(_.open),"data-radix-menu-content":"",dir:f.dir,...I,...m,ref:S,style:{outline:"none",...m.style},onKeyDown:ar(m.onKeyDown,te=>{const J=te.target.closest("[data-radix-menu-content]")===te.currentTarget,oe=te.ctrlKey||te.altKey||te.metaKey,ie=te.key.length===1;J&&(te.key==="Tab"&&te.preventDefault(),!oe&&ie&&Y(te.key));const ne=B.current;if(te.target!==ne||!zQi.includes(te.key))return;te.preventDefault();const ge=y().filter(_e=>!_e.disabled).map(_e=>_e.ref.current);_0n.includes(te.key)&&ge.reverse(),P0n(ge)}),onBlur:ar(e.onBlur,te=>{te.currentTarget.contains(te.target)||(window.clearTimeout(Q.current),w.current="")}),onPointerMove:ar(e.onPointerMove,xU(te=>{const j=te.target,J=F.current!==te.clientX;if(te.currentTarget.contains(j)&&J){const oe=te.clientX>F.current?"right":"left";R.current=oe,F.current=te.clientX}}))})})})})})})},"MenuContentImpl")),svi=ee.forwardRef(Hl(function(e,n){const{__scopeMenu:o,...i}=e;return K.jsx(Na.div,{...i,ref:n})},"MenuLabel")),TWe="MenuItem",B0n="menu.itemSelect",kWe=ee.forwardRef(Hl(function(e,n){const{disabled:o=!1,onSelect:i,...r}=e,s=ee.useRef(null),a=EZ(TWe,e.__scopeMenu),A=NWe(TWe,e.__scopeMenu),c=$A(n,s),l=ee.useRef(!1),u=Hl(()=>{const g=s.current;if(!o&&g){const h=new CustomEvent(B0n,{bubbles:!0,cancelable:!0});g.addEventListener(B0n,d=>i?.(d),{once:!0}),hDe(g,h),h.defaultPrevented?l.current=!1:a.onClose()}},"handleSelect");return K.jsx(b0n,{...r,ref:c,disabled:o,onClick:ar(e.onClick,u),onPointerDown:g=>{e.onPointerDown?.(g),l.current=!0},onPointerUp:ar(e.onPointerUp,g=>{l.current||g.currentTarget?.click()}),onKeyDown:ar(e.onKeyDown,g=>{o||g.target!==g.currentTarget||A.searchRef.current!==""&&g.key===" "||DWe.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})},"MenuItem")),b0n=ee.forwardRef(Hl(function(e,n){const{__scopeMenu:o,disabled:i=!1,textValue:r,...s}=e,a=NWe(TWe,o),A=I0n(o),c=ee.useRef(null),l=$A(n,c),[u,g]=ee.useState(!1),[h,d]=ee.useState("");return ee.useEffect(()=>{const p=c.current;p&&d((p.textContent??"").trim())},[s.children]),K.jsx(xZ.ItemSlot,{scope:o,disabled:i,textValue:r??h,children:K.jsx(jFt,{asChild:!0,...A,focusable:!i,children:K.jsx(Na.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...s,ref:l,onPointerMove:ar(e.onPointerMove,xU(p=>{i?a.onItemLeave(p):(a.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ar(e.onPointerLeave,xU(p=>a.onItemLeave(p))),onFocus:ar(e.onFocus,()=>g(!0)),onBlur:ar(e.onBlur,()=>g(!1))})})})},"MenuItemImpl")),avi=ee.forwardRef(Hl(function(e,n){const{checked:o=!1,onCheckedChange:i,...r}=e;return K.jsx(Q0n,{scope:e.__scopeMenu,checked:o,children:K.jsx(kWe,{role:"menuitemcheckbox","aria-checked":BZ(o)?"mixed":o,...r,ref:n,"data-state":Zme(o),onSelect:ar(r.onSelect,()=>i?.(BZ(o)?!0:!o),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),Avi="MenuRadioGroup",[Smr,cvi]=wT(Avi,{value:void 0,onValueChange:Hl(()=>{},"onValueChange")}),lvi="MenuRadioItem",uvi=ee.forwardRef(Hl(function(e,n){const{value:o,...i}=e,r=cvi(lvi,e.__scopeMenu),s=o===r.value;return K.jsx(Q0n,{scope:e.__scopeMenu,checked:s,children:K.jsx(kWe,{role:"menuitemradio","aria-checked":s,...i,ref:n,"data-state":Zme(s),onSelect:ar(i.onSelect,()=>r.onValueChange?.(o),{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),S0n="MenuItemIndicator",[Q0n,gvi]=wT(S0n,{checked:!1}),dvi=ee.forwardRef(Hl(function(e,n){const{__scopeMenu:o,forceMount:i,...r}=e,s=gvi(S0n,o);return K.jsx(uE,{present:i||BZ(s.checked)||s.checked===!0,children:K.jsx(Na.span,{...r,ref:n,"data-state":Zme(s.checked)})})},"MenuItemIndicator")),hvi=ee.forwardRef(Hl(function(e,n){const{__scopeMenu:o,...i}=e;return K.jsx(Na.div,{role:"separator","aria-orientation":"horizontal",...i,ref:n})},"MenuSeparator")),v0n="MenuSub",[pvi,w0n]=wT(v0n),mvi=Hl(t=>{const{__scopeMenu:e,children:n,open:o=!1,onOpenChange:i}=t,r=MP(v0n,e),s=qme(e),[a,A]=ee.useState(null),[c,l]=ee.useState(null),u=lE(i);return ee.useEffect(()=>(r.open===!1&&u(!1),()=>u(!1)),[r.open,u]),K.jsx(CZ,{...s,children:K.jsx(C0n,{scope:e,open:o,onOpenChange:u,content:c,onContentChange:l,children:K.jsx(pvi,{scope:e,contentId:t_(),triggerId:t_(),trigger:a,onTriggerChange:A,children:n})})})},"MenuSub"),Xme="MenuSubTrigger",_vi=ee.forwardRef(Hl(function(e,n){const o=MP(Xme,e.__scopeMenu),i=EZ(Xme,e.__scopeMenu),r=w0n(Xme,e.__scopeMenu),s=NWe(Xme,e.__scopeMenu),a=ee.useRef(null),{pointerGraceTimerRef:A,onPointerGraceIntentChange:c}=s,l={__scopeMenu:e.__scopeMenu},u=ee.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);ee.useEffect(()=>u,[u]),ee.useEffect(()=>{const h=A.current;return()=>{window.clearTimeout(h),c(null)}},[A,c]);const g=$A(n,r.onTriggerChange);return K.jsx(y0n,{asChild:!0,...l,children:K.jsx(b0n,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?r.contentId:void 0,"data-state":FWe(o.open),...e,ref:g,onClick:h=>{e.onClick?.(h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),o.open||o.onOpenChange(!0))},onPointerMove:ar(e.onPointerMove,xU(h=>{s.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!o.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{o.onOpenChange(!0),u()},100))})),onPointerLeave:ar(e.onPointerLeave,xU(h=>{u();const d=o.content?.getBoundingClientRect();if(d){const p=o.content?.dataset.side,m=p==="right",_=m?-5:5,f=d[m?"left":"right"],I=d[m?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+_,y:h.clientY},{x:f,y:d.top},{x:I,y:d.top},{x:I,y:d.bottom},{x:f,y:d.bottom}],side:p}),window.clearTimeout(A.current),A.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:ar(e.onKeyDown,h=>{e.disabled||h.target!==h.currentTarget||s.searchRef.current!==""&&h.key===" "||JQi[i.dir].includes(h.key)&&(o.onOpenChange(!0),o.content?.focus(),h.preventDefault())})})})},"MenuSubTrigger")),fvi="MenuSubContent",Ivi=ee.forwardRef(Hl(function(e,n){const o=E0n(t9,e.__scopeMenu),{forceMount:i=o.forceMount,align:r="start",...s}=e,a=MP(t9,e.__scopeMenu),A=EZ(t9,e.__scopeMenu),c=w0n(fvi,e.__scopeMenu),l=ee.useRef(null),u=$A(n,l);return K.jsx(xZ.Provider,{scope:e.__scopeMenu,children:K.jsx(uE,{present:i||a.open,children:K.jsx(xZ.Slot,{scope:e.__scopeMenu,children:K.jsx(RWe,{id:c.contentId,"aria-labelledby":c.triggerId,...s,ref:u,align:r,side:A.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:g=>{A.isUsingKeyboardRef.current&&l.current?.focus(),g.preventDefault()},onCloseAutoFocus:g=>g.preventDefault(),onFocusOutside:ar(e.onFocusOutside,g=>{g.target!==c.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:ar(e.onEscapeKeyDown,g=>{A.onClose(),g.preventDefault()}),onKeyDown:ar(e.onKeyDown,g=>{const h=g.currentTarget.contains(g.target),d=WQi[A.dir].includes(g.key);h&&d&&(a.onOpenChange(!1),c.trigger?.focus(),g.preventDefault())})})})})})},"MenuSubContent"));function FWe(t){return t?"open":"closed"}Hl(FWe,"getOpenState");function BZ(t){return t==="indeterminate"}Hl(BZ,"isIndeterminate");function Zme(t){return BZ(t)?"indeterminate":t?"checked":"unchecked"}Hl(Zme,"getCheckedState");function P0n(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}Hl(P0n,"focusFirst");function M0n(t,e){return t.map((n,o)=>t[(e+o)%t.length])}Hl(M0n,"wrapArray");function D0n(t,e,n){const i=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,r=n?t.indexOf(n):-1;let s=M0n(t,Math.max(r,0));i.length===1&&(s=s.filter(c=>c!==n));const A=s.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return A!==n?A:void 0}Hl(D0n,"getNextMatch");function N0n(t,e){const{x:n,y:o}=t;let i=!1;for(let r=0,s=e.length-1;r<e.length;s=r++){const a=e[r],A=e[s],c=a.x,l=a.y,u=A.x,g=A.y;l>o!=g>o&&n<(u-c)*(o-l)/(g-l)+c&&(i=!i)}return i}Hl(N0n,"isPointInPolygon");function R0n(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return N0n(n,e)}Hl(R0n,"isPointerInGraceArea");function xU(t){return e=>e.pointerType==="mouse"?t(e):void 0}Hl(xU,"whenMouse");var Cvi=XQi,yvi=y0n,xvi=evi,Evi=nvi,Bvi=svi,bvi=kWe,Svi=avi,Qvi=uvi,vvi=dvi,wvi=hvi,Pvi=mvi,Mvi=_vi,Dvi=Ivi,Nvi=Object.defineProperty,QE=(t,e)=>Nvi(t,"name",{value:e,configurable:!0}),LWe="DropdownMenu",[Rvi,Qmr]=Nx(LWe,[f0n]),vE=f0n(),[Tvi,T0n]=Rvi(LWe),kvi=QE(t=>{const{__scopeDropdownMenu:e,children:n,dir:o,open:i,defaultOpen:r,onOpenChange:s,modal:a=!0}=t,A=vE(e),c=ee.useRef(null),[l,u]=DB({prop:i,defaultProp:r??!1,onChange:s,caller:LWe});return K.jsx(Tvi,{scope:e,triggerId:t_(),triggerRef:c,contentId:t_(),open:l,onOpenChange:u,onOpenToggle:ee.useCallback(()=>u(g=>!g),[u]),modal:a,children:K.jsx(Cvi,{...A,open:l,onOpenChange:u,dir:o,modal:a,children:n})})},"DropdownMenu"),Fvi="DropdownMenuTrigger",Lvi=ee.forwardRef(QE(function(e,n){const{__scopeDropdownMenu:o,disabled:i=!1,...r}=e,s=T0n(Fvi,o),a=vE(o),A=$A(n,s.triggerRef);return K.jsx(yvi,{asChild:!0,...a,children:K.jsx(Na.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...r,ref:A,onPointerDown:ar(e.onPointerDown,c=>{!i&&c.button===0&&c.ctrlKey===!1&&(s.onOpenToggle(),s.open||c.preventDefault())}),onKeyDown:ar(e.onKeyDown,c=>{i||(["Enter"," "].includes(c.key)&&s.onOpenToggle(),c.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})},"DropdownMenuTrigger")),Hvi=QE(t=>{const{__scopeDropdownMenu:e,...n}=t,o=vE(e);return K.jsx(xvi,{...o,...n})},"DropdownMenuPortal"),Ovi="DropdownMenuContent",Gvi=ee.forwardRef(QE(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=T0n(Ovi,o),s=vE(o),a=ee.useRef(!1);return K.jsx(Evi,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...i,ref:n,onCloseAutoFocus:ar(e.onCloseAutoFocus,A=>{a.current||r.triggerRef.current?.focus(),a.current=!1,A.preventDefault()}),onInteractOutside:ar(e.onInteractOutside,A=>{const c=A.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,u=c.button===2||l;(!r.modal||u)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),Yvi=ee.forwardRef(QE(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=vE(o);return K.jsx(Bvi,{...r,...i,ref:n})},"DropdownMenuLabel")),Uvi=ee.forwardRef(QE(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=vE(o);return K.jsx(bvi,{...r,...i,ref:n})},"DropdownMenuItem")),Kvi=ee.forwardRef(QE(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=vE(o);return K.jsx(Svi,{...r,...i,ref:n})},"DropdownMenuCheckboxItem")),Vvi=ee.forwardRef(QE(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=vE(o);return K.jsx(Qvi,{...r,...i,ref:n})},"DropdownMenuRadioItem")),zvi=ee.forwardRef(QE(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=vE(o);return K.jsx(vvi,{...r,...i,ref:n})},"DropdownMenuItemIndicator")),Jvi=ee.forwardRef(QE(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=vE(o);return K.jsx(wvi,{...r,...i,ref:n})},"DropdownMenuSeparator")),Wvi=QE(t=>{const{__scopeDropdownMenu:e,children:n,open:o,onOpenChange:i,defaultOpen:r}=t,s=vE(e),[a,A]=DB({prop:o,defaultProp:r??!1,onChange:i,caller:"DropdownMenuSub"});return K.jsx(Pvi,{...s,open:a,onOpenChange:A,children:n})},"DropdownMenuSub"),jvi=ee.forwardRef(QE(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=vE(o);return K.jsx(Mvi,{...r,...i,ref:n})},"DropdownMenuSubTrigger")),$vi=ee.forwardRef(QE(function(e,n){const{__scopeDropdownMenu:o,...i}=e,r=vE(o);return K.jsx(Dvi,{...r,...i,ref:n,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuSubContent")),e_e=kvi,t_e=Lvi,EU=Hvi,bZ=Gvi,k0n=Yvi,SS=Uvi,HWe=Kvi,F0n=Vvi,OWe=zvi,n_e=Jvi,L0n=Wvi,GWe=jvi,YWe=$vi;const o_e=e_e,i_e=t_e,SZ=EU,QZ=L0n,BU=ee.forwardRef(({className:t,inset:e,children:n,...o},i)=>K.jsxs(GWe,{ref:i,className:Oi("rf-flex rf-cursor-default rf-gap-2 rf-select-none rf-items-center rf-rounded-sm rf-px-2 rf-py-1.5 rf-text-sm rf-outline-none focus:rf-bg-zinc-100 data-[state=open]:rf-bg-zinc-100 [&_svg]:rf-pointer-events-none [&_svg]:rf-size-4 [&_svg]:rf-shrink-0 dark:focus:rf-bg-zinc-800 dark:data-[state=open]:rf-bg-zinc-800",e&&"rf-pl-8",t),...o,children:[n,K.jsx(bT,{className:"rf-ml-auto"})]}));BU.displayName=GWe.displayName;const bU=ee.forwardRef(({className:t,...e},n)=>K.jsx(YWe,{ref:n,className:Oi("rf-z-[102] rf-min-w-[8rem] rf-overflow-hidden rf-rounded-md rf-border rf-border-zinc-200 rf-bg-white rf-p-1 rf-text-zinc-950 rf-shadow-lg data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0 data-[state=closed]:rf-zoom-out-95 data-[state=open]:rf-zoom-in-95 data-[side=bottom]:rf-slide-in-from-top-2 data-[side=left]:rf-slide-in-from-right-2 data-[side=right]:rf-slide-in-from-left-2 data-[side=top]:rf-slide-in-from-bottom-2 dark:rf-border-zinc-800 dark:rf-bg-zinc-950 dark:rf-text-zinc-50",t),...e}));bU.displayName=YWe.displayName;const vZ=ee.forwardRef(({className:t,sideOffset:e=4,...n},o)=>K.jsx(EU,{children:K.jsx(bZ,{ref:o,sideOffset:e,className:Oi("rf-z-50 rf-min-w-[8rem] rf-overflow-hidden rf-rounded-md rf-border rf-border-zinc-200 rf-bg-white rf-p-1 rf-text-zinc-950 rf-shadow-md dark:rf-border-zinc-800 dark:rf-bg-zinc-950 dark:rf-text-zinc-50","data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0 data-[state=closed]:rf-zoom-out-95 data-[state=open]:rf-zoom-in-95 data-[side=bottom]:rf-slide-in-from-top-2 data-[side=left]:rf-slide-in-from-right-2 data-[side=right]:rf-slide-in-from-left-2 data-[side=top]:rf-slide-in-from-bottom-2",t),...n})}));vZ.displayName=bZ.displayName;const bp=ee.forwardRef(({className:t,inset:e,...n},o)=>K.jsx(SS,{ref:o,className:Oi("rf-relative rf-flex rf-cursor-default rf-select-none rf-items-center rf-gap-2 rf-rounded-sm rf-px-2 rf-py-1.5 rf-text-sm rf-outline-none rf-transition-colors focus:rf-bg-zinc-100 focus:rf-text-zinc-900 data-[disabled]:rf-pointer-events-none data-[disabled]:rf-opacity-50 [&>svg]:rf-size-4 [&>svg]:rf-shrink-0 dark:focus:rf-bg-zinc-800 dark:focus:rf-text-zinc-50",e&&"rf-pl-8",t),...n}));bp.displayName=SS.displayName;const qvi=ee.forwardRef(({className:t,children:e,checked:n,...o},i)=>K.jsxs(HWe,{ref:i,className:Oi("rf-relative rf-flex rf-cursor-default rf-select-none rf-items-center rf-rounded-sm rf-py-1.5 rf-pl-8 rf-pr-2 rf-text-sm rf-outline-none rf-transition-colors focus:rf-bg-zinc-100 focus:rf-text-zinc-900 data-[disabled]:rf-pointer-events-none data-[disabled]:rf-opacity-50 dark:focus:rf-bg-zinc-800 dark:focus:rf-text-zinc-50",t),checked:n,...o,children:[K.jsx("span",{className:"rf-absolute rf-left-2 rf-flex rf-h-3.5 rf-w-3.5 rf-items-center rf-justify-center",children:K.jsx(OWe,{children:K.jsx(CS,{className:"rf-h-4 rf-w-4"})})}),e]}));qvi.displayName=HWe.displayName;const Xvi=ee.forwardRef(({className:t,children:e,...n},o)=>K.jsxs(F0n,{ref:o,className:Oi("rf-relative rf-flex rf-cursor-default rf-select-none rf-items-center rf-rounded-sm rf-py-1.5 rf-pl-8 rf-pr-2 rf-text-sm rf-outline-none rf-transition-colors focus:rf-bg-zinc-100 focus:rf-text-zinc-900 data-[disabled]:rf-pointer-events-none data-[disabled]:rf-opacity-50 dark:focus:rf-bg-zinc-800 dark:focus:rf-text-zinc-50",t),...n,children:[K.jsx("span",{className:"rf-absolute rf-left-2 rf-flex rf-h-3.5 rf-w-3.5 rf-items-center rf-justify-center",children:K.jsx(OWe,{children:K.jsx(pln,{className:"rf-h-2 rf-w-2 rf-fill-current"})})}),e]}));Xvi.displayName=F0n.displayName;const Zvi=ee.forwardRef(({className:t,inset:e,...n},o)=>K.jsx(k0n,{ref:o,className:Oi("rf-px-2 rf-py-1.5 rf-text-sm rf-font-semibold",e&&"rf-pl-8",t),...n}));Zvi.displayName=k0n.displayName;const H0n=ee.forwardRef(({className:t,...e},n)=>K.jsx(n_e,{ref:n,className:Oi("rf--mx-1 rf-my-1 rf-h-px rf-bg-zinc-100 dark:rf-bg-zinc-800",t),...e}));H0n.displayName=n_e.displayName;const O0n=({autoroutingLog:t,onReportAutoroutingLog:e})=>K.jsx(K.Fragment,{children:Object.keys(t??{}).length>0&&K.jsxs(o_e,{children:[K.jsx(i_e,{asChild:!0,children:K.jsxs(fA,{variant:"outline",children:[K.jsx(cbi,{className:"rf-w-4 rf-h-4 rf-mr-2"}),"Open Autorouting Log"]})}),K.jsx(vZ,{className:"rf-w-96",children:Object.entries(t??{}).map(([n,{simpleRouteJson:o}])=>K.jsxs(bp,{className:"rf-flex rf-justify-between rf-items-center",children:[K.jsx("span",{className:"rf-truncate rf-text-xs rf-mr-2",children:n}),K.jsxs("div",{className:"rf-flex rf-gap-2",children:[K.jsxs(fA,{variant:"outline",size:"sm",onClick:i=>{i.stopPropagation();const r=new Blob([JSON.stringify(o,null,2)],{type:"application/json"}),s=URL.createObjectURL(r),a=document.createElement("a");a.href=s,a.download=`${n}-autorouting.json`,a.click(),URL.revokeObjectURL(s)},children:[K.jsx(mZ,{className:"rf-w-3 rf-h-3"}),"Download"]}),e&&K.jsxs(fA,{variant:"outline",size:"sm",onClick:i=>{i.stopPropagation(),e&&e(n,{simpleRouteJson:o})},children:[K.jsx(Pbi,{className:"rf-w-3 rf-h-3"}),"Report Bug"]})]})]},n))})]})}),ewi=({code:t,fsMap:e,autoroutingLog:n,circuitJsonErrors:o,circuitJsonWarnings:i,onReportAutoroutingLog:r,errorMessage:s,errorStack:a,circuitJson:A,evalVersion:c})=>{const l=ee.useMemo(()=>{const S=[];if(s&&S.push({type:"Execution Error",message:s,stack:a||void 0,source:"execution"}),o&&o.length>0)for(const Q of o)S.push({type:Q.type||"Circuit JSON Error",message:Q.message||"No error message available",stack:Q.stack||"",source:"circuitJson"});return S},[s,a,o]),u=ee.useMemo(()=>!A||!Array.isArray(A)?void 0:A.find(Q=>Q.type==="source_project_metadata")?.software_used_string,[A]),g=ee.useMemo(()=>{const S=[];if(i&&i.length>0)for(const Q of i)S.push({type:Q.type||"Circuit JSON Warning",message:Q.message||"No warning message available",stack:Q.stack||"",source:"circuitJson"});return S},[i]),h=()=>{if(e)try{return QUo(e instanceof Map?Object.fromEntries(e.entries()):e)}catch{}return Rbi(t??"")},d=(S,Q)=>{const w=`https://github.com/tscircuit/tscircuit.com/issues/new?title=${encodeURIComponent(S)}&body=${encodeURIComponent(Q)}`;window.open(w,"_blank")};ee.useEffect(()=>{if(s){let S=s;a&&(S+=`
${a}`),typeof window<"u"&&(window.__TSCIRCUIT_LAST_EXECUTION_ERROR=S)}},[s,a]);const[p,m]=ee.useState(()=>{const S=new Set;return l.forEach((Q,w)=>S.add(w)),S}),[_,f]=ee.useState(()=>{const S=new Set;return g.forEach((Q,w)=>S.add(w)),S}),[I,C]=ee.useState(!1),[y,x]=ee.useState(!1);if(l.length===0&&g.length===0)return K.jsxs("div",{className:"px-2",children:[K.jsx("div",{className:"rf-mt-4 rf-bg-green-50 rf-rounded-md rf-border rf-border-green-200",children:K.jsxs("div",{className:"rf-p-4",children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-green-800 rf-mb-3",children:"No errors or warnings!"}),K.jsx("p",{className:"rf-text-sm rf-text-green-700",children:"Your code is running without any errors or warnings."})]})}),K.jsxs("div",{className:"rf-flex rf-gap-2 rf-mt-4 rf-justify-end",children:[K.jsx(O0n,{autoroutingLog:n,onReportAutoroutingLog:r}),K.jsxs(fA,{variant:"outline",className:"rf-p-1",onClick:()=>{const S=h();d("Issue Report",`[Package code to reproduce](${S})`)},children:[K.jsx(nWe,{className:"rf-w-4 rf-h-4"}),"Report Issue"]})]})]});const E=S=>{m(Q=>{const w=new Set(Q);return w.has(S)?w.delete(S):w.add(S),w})},B=S=>{f(Q=>{const w=new Set(Q);return w.has(S)?w.delete(S):w.add(S),w})};return K.jsx(K.Fragment,{children:K.jsxs("div",{className:"rf-w-full rf-flex rf-flex-col rf-h-full",children:[K.jsxs("div",{className:"rf-overflow-y-auto rf-min-h-0",children:[l.length>0&&K.jsxs("div",{className:"rf-mt-2",children:[K.jsxs("div",{className:"rf-text-xs rf-text-red-700 rf-font-semibold rf-px-2 rf-py-1 rf-bg-red-50 rf-border-b rf-border-red-200 rf-flex rf-items-center rf-gap-2 rf-cursor-pointer hover:rf-bg-red-100",onClick:()=>C(!I),children:[I?K.jsx(bT,{className:"rf-h-3 rf-w-3 rf-text-red-700"}):K.jsx(pZ,{className:"rf-h-3 rf-w-3 rf-text-red-700"}),K.jsxs("span",{children:[l.length," ",l.length===1?"error":"errors"]})]}),!I&&l.map((S,Q)=>{const w=p.has(Q);S.message;const M=S.stack||c||u;return K.jsxs("div",{className:"rf-bg-white hover:rf-bg-red-100",children:[K.jsxs("div",{className:"rf-flex rf-items-start rf-gap-1 rf-px-2 rf-pt-1 rf-pb-1 rf-cursor-pointer rf-bg-red-50/50",onClick:()=>M&&E(Q),children:[K.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",style:{marginTop:"2px"},children:[K.jsx(Abi,{className:"rf-h-4 rf-w-4 rf-text-red-500 rf-flex-shrink-0"}),M&&K.jsx(bT,{className:`rf-h-3 rf-w-3 rf-text-red-500 rf-flex-shrink-0 rf-transition-transform ${w?"rf-rotate-90":""}`})]}),K.jsxs("div",{className:"rf-flex-1 rf-min-w-0 rf-leading-[1rem]",children:[K.jsxs("span",{className:"rf-text-xs rf-font-mono rf-text-red-700 rf-leading-[0.95rem]",children:[S.type,":"]}),K.jsx("span",{className:"rf-text-xs rf-font-mono rf-text-red-600 rf-ml-1 rf-leading-[0.95rem]",children:S.message})]})]}),w&&M&&K.jsxs("div",{className:"rf-bg-red-50/50 rf-pl-12",children:[S.stack?.split(`
`).filter(k=>k.trim()).slice(1).map((k,R)=>K.jsx("div",{className:"rf-px-2 rf-leading-tight",children:K.jsx("span",{className:"rf-text-xs rf-font-mono rf-text-red-500",children:k})},R)),(c||u)&&K.jsx("div",{className:"rf-px-2",children:K.jsxs("span",{className:"rf-text-xs rf-font-mono rf-text-red-400",children:[c&&`@tscircuit/eval@${c}`,c&&u&&" • ",u]})})]})]},Q)})]}),g.length>0&&K.jsxs("div",{className:"rf-mt-2",children:[K.jsxs("div",{className:"rf-text-xs rf-text-orange-700 rf-font-semibold rf-px-2 rf-py-1 rf-bg-orange-50 rf-border-b rf-border-orange-200 rf-flex rf-items-center rf-gap-2 rf-cursor-pointer hover:rf-bg-orange-100",onClick:()=>x(!y),children:[y?K.jsx(bT,{className:"rf-h-3 rf-w-3 rf-text-orange-700"}):K.jsx(pZ,{className:"rf-h-3 rf-w-3 rf-text-orange-700"}),K.jsxs("span",{children:[g.length," ",g.length===1?"warning":"warnings"]})]}),!y&&g.map((S,Q)=>{const w=_.has(Q);S.message;const M=!!S.stack;return K.jsxs("div",{className:"rf-bg-white hover:rf-bg-orange-100",children:[K.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2 rf-px-2 rf-py-1 rf-cursor-pointer rf-bg-orange-50/50",onClick:()=>M&&B(Q),children:[K.jsx(oWe,{className:"rf-h-4 rf-w-4 rf-text-orange-500 rf-flex-shrink-0"}),M&&K.jsx(bT,{className:`rf-h-3 rf-w-3 rf-text-orange-500 rf-flex-shrink-0 rf-transition-transform ${w?"rf-rotate-90":""}`}),K.jsxs("div",{className:"rf-flex-1 rf-min-w-0 rf-flex rf-items-center rf-flex-wrap",children:[K.jsxs("span",{className:"rf-text-xs rf-font-mono rf-text-orange-700 rf-break-words",children:[S.type,":"]}),K.jsx("span",{className:"rf-text-xs rf-font-mono rf-text-orange-600 rf-ml-1 rf-break-words",children:S.message})]})]}),w&&M&&K.jsx("div",{className:"rf-bg-orange-50/50 rf-pl-12",children:S.stack?.split(`
`).filter(k=>k.trim()).slice(1).map((k,R)=>K.jsx("div",{className:"rf-px-2 rf-leading-tight",children:K.jsx("span",{className:"rf-text-xs rf-font-mono rf-text-orange-500",children:k})},R))})]},Q)})]})]}),K.jsxs("div",{className:"rf-flex rf-gap-2 rf-mt-4 rf-justify-end rf-flex-shrink-0",children:[K.jsx(O0n,{autoroutingLog:n,onReportAutoroutingLog:r}),K.jsxs(fA,{variant:"outline",className:"rf-p-1",onClick:()=>{const S=l[0]??g[0]??{type:"General Issue",message:"No error or warning details provided."};let Q=`${S.type}: ${S.message}`;c&&(Q+=`
@tscircuit/eval@${c}`),u&&(Q+=`
${u}`),S.stack&&(Q+=`
${S.stack}`),navigator.clipboard.writeText(Q),ua.success("Error copied to clipboard!")},children:[K.jsx(lbi,{className:"rf-w-4 rf-h-4"}),"Copy Error"]}),K.jsxs(fA,{variant:"outline",className:"rf-p-1",onClick:()=>{const S=l[0]??g[0]??{type:"General Issue",message:"No error or warning details provided."},Q=`Error ${S.type}`.replace(/[^a-zA-Z0-9 ]/g," ").replace(/\s+/g," ").slice(0,100);let w=`${S.type}: ${S.message}`;c&&(w+=`
@tscircuit/eval@${c}`),u&&(w+=`
${u}`),S.stack&&(w+=`
${S.stack}`);let M=`[Package code to reproduce](${h()})
### Error
\`\`\`
${w}
\`\`\`
`;if(M.length>35e3){const k=S.message.length>500?`${S.message.slice(0,500)}...`:S.message;M=`[Package code to reproduce](${h()})
### Error
\`\`\`
${S.type}: ${k}
\`\`\``}d(Q,M)},children:[K.jsx(nWe,{className:"rf-w-4 rf-h-4"}),"Report Issue"]})]})]})})};var twi=Object.defineProperty,wE=(t,e)=>twi(t,"name",{value:e,configurable:!0}),UWe="Dialog",[G0n,Y0n]=Nx(UWe),[nwi,n9]=G0n(UWe),r_e=wE(t=>{const{__scopeDialog:e,children:n,open:o,defaultOpen:i,onOpenChange:r,modal:s=!0}=t,a=ee.useRef(null),A=ee.useRef(null),[c,l]=DB({prop:o,defaultProp:i??!1,onChange:r,caller:UWe}),[u,g]=ee.useState(0),[h,d]=ee.useState(0);return K.jsx(nwi,{scope:e,triggerRef:a,contentRef:A,contentId:t_(),titleId:t_(),descriptionId:t_(),titlePresent:u>0,descriptionPresent:h>0,setTitleCount:g,setDescriptionCount:d,open:c,onOpenChange:l,onOpenToggle:ee.useCallback(()=>l(p=>!p),[l]),modal:s,children:n})},"Dialog"),owi="DialogTrigger",iwi=ee.forwardRef(wE(function(e,n){const{__scopeDialog:o,...i}=e,r=n9(owi,o),s=$A(n,r.triggerRef);return K.jsx(Na.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":c_e(r.open),...i,ref:s,onClick:ar(e.onClick,r.onOpenToggle)})},"DialogTrigger")),U0n="DialogPortal",[rwi,K0n]=G0n(U0n,{forceMount:void 0}),s_e=wE(t=>{const{__scopeDialog:e,forceMount:n,children:o,container:i}=t,r=n9(U0n,e);return K.jsx(rwi,{scope:e,forceMount:n,children:ee.Children.map(o,s=>K.jsx(uE,{present:n||r.open,children:K.jsx(Gme,{asChild:!0,container:i,children:s})}))})},"DialogPortal"),KWe="DialogOverlay",wZ=ee.forwardRef(wE(function(e,n){const o=K0n(KWe,e.__scopeDialog),{forceMount:i=o.forceMount,...r}=e,s=n9(KWe,e.__scopeDialog);return s.modal?K.jsx(uE,{present:i||s.open,children:K.jsx(awi,{...r,ref:n})}):null},"DialogOverlay")),swi=MB("DialogOverlay.RemoveScroll"),awi=ee.forwardRef(wE(function(e,n){const{__scopeDialog:o,...i}=e,r=n9(KWe,o),s=yln(),a=$A(n,s);return K.jsx(yZ,{as:swi,allowPinchZoom:!0,shards:[r.contentRef],children:K.jsx(Na.div,{"data-state":c_e(r.open),...i,ref:a,style:{pointerEvents:"auto",...i.style}})})},"DialogOverlayImpl")),PZ="DialogContent",MZ=ee.forwardRef(wE(function(e,n){const o=K0n(PZ,e.__scopeDialog),{forceMount:i=o.forceMount,...r}=e,s=n9(PZ,e.__scopeDialog);return K.jsx(uE,{present:i||s.open,children:s.modal?K.jsx(Awi,{...r,ref:n}):K.jsx(cwi,{...r,ref:n})})},"DialogContent")),Awi=ee.forwardRef(wE(function(e,n){const o=n9(PZ,e.__scopeDialog),i=ee.useRef(null),r=$A(n,o.contentRef,i);return ee.useEffect(()=>{const s=i.current;if(s)return Kme(s)},[]),K.jsx(V0n,{...e,ref:r,trapFocus:o.open,disableOutsidePointerEvents:o.open,onCloseAutoFocus:ar(e.onCloseAutoFocus,s=>{s.preventDefault(),o.triggerRef.current?.focus()}),onPointerDownOutside:ar(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,A=a.button===0&&a.ctrlKey===!0;(a.button===2||A)&&s.preventDefault()}),onFocusOutside:ar(e.onFocusOutside,s=>s.preventDefault())})},"DialogContentModal")),cwi=ee.forwardRef(wE(function(e,n){const o=n9(PZ,e.__scopeDialog),i=ee.useRef(!1),r=ee.useRef(!1);return K.jsx(V0n,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(i.current||o.triggerRef.current?.focus(),s.preventDefault()),i.current=!1,r.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(i.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=s.target;o.triggerRef.current?.contains(a)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})},"DialogContentNonModal")),V0n=ee.forwardRef(wE(function(e,n){const{__scopeDialog:o,trapFocus:i,onOpenAutoFocus:r,onCloseAutoFocus:s,...a}=e,A=n9(PZ,o);return hU(),K.jsx(K.Fragment,{children:K.jsx(Sme,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:r,onUnmountAutoFocus:s,children:K.jsx(_Z,{role:"dialog",id:A.contentId,"aria-describedby":A.descriptionPresent?A.descriptionId:void 0,"aria-labelledby":A.titlePresent?A.titleId:void 0,"data-state":c_e(A.open),...a,ref:n,deferPointerDownOutside:!0,onDismiss:()=>A.onOpenChange(!1)})})})},"DialogContentImpl")),lwi="DialogTitle",a_e=ee.forwardRef(wE(function(e,n){const{__scopeDialog:o,...i}=e,r=n9(lwi,o),{setTitleCount:s}=r;return Ep(()=>(s(a=>a+1),()=>s(a=>a-1)),[s]),K.jsx(Na.h2,{id:r.titleId,...i,ref:n})},"DialogTitle")),uwi="DialogDescription",A_e=ee.forwardRef(wE(function(e,n){const{__scopeDialog:o,...i}=e,r=n9(uwi,o),{setDescriptionCount:s}=r;return Ep(()=>(s(a=>a+1),()=>s(a=>a-1)),[s]),K.jsx(Na.p,{id:r.descriptionId,...i,ref:n})},"DialogDescription")),gwi="DialogClose",VWe=ee.forwardRef(wE(function(e,n){const{__scopeDialog:o,...i}=e,r=n9(gwi,o);return K.jsx(Na.button,{type:"button",...i,ref:n,onClick:ar(e.onClick,()=>r.onOpenChange(!1))})},"DialogClose"));function c_e(t){return t?"open":"closed"}wE(c_e,"getState");function er(t,e){return Array.isArray(e)?[t.a*e[0]+t.c*e[1]+t.e,t.b*e[0]+t.d*e[1]+t.f]:{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function dwi(t){const{a:e,b:n,c:o,d:i,e:r,f:s}=t,a=e*i-n*o;return{a:i/a,b:n/-a,c:o/-a,d:e/a,e:(i*r-o*s)/-a,f:(n*r-e*s)/a}}function DZ(t){return typeof t>"u"}function PT(t,e=0){return{a:1,c:0,e:t,b:0,d:1,f:e}}function NZ(...t){t=Array.isArray(t[0])?t[0]:t;const e=(n,o)=>({a:n.a*o.a+n.c*o.b,c:n.a*o.c+n.c*o.d,e:n.a*o.e+n.c*o.f+n.e,b:n.b*o.a+n.d*o.b,d:n.b*o.c+n.d*o.d,f:n.b*o.e+n.d*o.f+n.f});switch(t.length){case 0:throw new Error("no matrices provided");case 1:return t[0];case 2:return e(t[0],t[1]);default:{const[n,o,...i]=t,r=e(n,o);return NZ(r,...i)}}}function pf(...t){return NZ(...t)}const{cos:hwi,sin:pwi}=Math;function z0n(t,e,n){const o=hwi(t),i=pwi(t),r={a:o,c:-i,e:0,b:i,d:o,f:0};return DZ(e)||DZ(n)?r:NZ([PT(e,n),r,PT(-e,-n)])}function zWe(t,e=void 0,n=void 0,o=void 0){DZ(e)&&(e=t);const i={a:t,c:0,e:0,b:0,d:e,f:0};return DZ(n)||DZ(o)?i:NZ([PT(n,o),i,PT(-n,-o)])}function mwi(t){return _wi(t)}function _wi(t){return`matrix(${t.a},${t.b},${t.c},${t.d},${t.e},${t.f})`}function fwi(t,e=1e10){return{a:Math.round(t.a*e)/e,b:Math.round(t.b*e)/e,c:Math.round(t.c*e)/e,d:Math.round(t.d*e)/e,e:Math.round(t.e*e)/e,f:Math.round(t.f*e)/e}}function Iwi(t,e){const n=t[0].x!=null?t[0].x:t[0][0],o=t[0].y!=null?t[0].y:t[0][1],i=e[0].x!=null?e[0].x:e[0][0],r=e[0].y!=null?e[0].y:e[0][1],s=t[1].x!=null?t[1].x:t[1][0],a=t[1].y!=null?t[1].y:t[1][1],A=e[1].x!=null?e[1].x:e[1][0],c=e[1].y!=null?e[1].y:e[1][1],l=t[2].x!=null?t[2].x:t[2][0],u=t[2].y!=null?t[2].y:t[2][1],g=e[2].x!=null?e[2].x:e[2][0],h=e[2].y!=null?e[2].y:e[2][1],d={a:n-l,b:o-u,c:s-l,d:a-u,e:l,f:u},p={a:i-g,b:r-h,c:A-g,d:c-h,e:g,f:h},m=dwi(d),_=NZ([p,m]);return fwi(_)}function Cwi(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n}function l_e(t,e,n,o){var i=Error.call(this,t);return Object.setPrototypeOf&&Object.setPrototypeOf(i,l_e.prototype),i.expected=e,i.found=n,i.location=o,i.name="SyntaxError",i}Cwi(l_e,Error);function JWe(t,e,n){return n=n||" ",t.length>e?t:(e-=t.length,n+=n.repeat(e),t+n.slice(0,e))}l_e.prototype.format=function(t){var e="Error: "+this.message;if(this.location){var n=null,o;for(o=0;o<t.length;o++)if(t[o].source===this.location.source){n=t[o].text.split(/\r\n|\n|\r/g);break}var i=this.location.start,r=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(i):i,s=this.location.source+":"+r.line+":"+r.column;if(n){var a=this.location.end,A=JWe("",r.line.toString().length," "),c=n[i.line-1],l=i.line===a.line?a.column:c.length+1,u=l-i.column||1;e+=`
--> `+s+`
`+A+` |
`+r.line+" | "+c+`
`+A+" | "+JWe("",i.column-1," ")+JWe("",u,"^")}else e+=`
at `+s}return e},l_e.buildMessage=function(t,e){var n={literal:function(c){return'"'+i(c.text)+'"'},class:function(c){var l=c.parts.map(function(u){return Array.isArray(u)?r(u[0])+"-"+r(u[1]):r(u)});return"["+(c.inverted?"^":"")+l.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(c){return c.description}};function o(c){return c.charCodeAt(0).toString(16).toUpperCase()}function i(c){return c.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(l){return"\\x0"+o(l)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(l){return"\\x"+o(l)})}function r(c){return c.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(l){return"\\x0"+o(l)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(l){return"\\x"+o(l)})}function s(c){return n[c.type](c)}function a(c){var l=c.map(s),u,g;if(l.sort(),l.length>0){for(u=1,g=1;u<l.length;u++)l[u-1]!==l[u]&&(l[g]=l[u],g++);l.length=g}switch(l.length){case 1:return l[0];case 2:return l[0]+" or "+l[1];default:return l.slice(0,-1).join(", ")+", or "+l[l.length-1]}}function A(c){return c?'"'+i(c)+'"':"end of input"}return"Expected "+a(t)+" but "+A(e)+" found."};function J0n(t,e,n){if(!e||!n)return;let o=t.get(e);o||(o=new Set,t.set(e,o)),o.add(n);let i=t.get(n);i||(i=new Set,t.set(n,i)),i.add(e)}function ywi(t,e){if(!e.subcircuit_id&&!e.source_group_id)return[...t];let n=e;if(e.subcircuit_id){const a=new Set([e.subcircuit_id]),A=new Map,c=new Map;for(const u of t)if(u.type==="source_group"){const g=u.source_group_id,h=u.subcircuit_id;h&&c.set(g,h);const d=u.parent_source_group_id;d&&(A.has(d)||A.set(d,[]),A.get(d).push(g))}let l;for(const[u,g]of c)if(g===e.subcircuit_id){l=u;break}if(l){const u=g=>{const h=A.get(g)||[];for(const d of h){const p=c.get(d);p&&a.add(p),u(d)}};u(l),n={...e,subcircuit_ids:Array.from(a)}}}const o=new Map;for(const a of t){const A=`${a.type}_id`,c=a[A];typeof c=="string"&&o.set(c,a)}const i=new Map;for(const a of t){const A=Object.entries(a);for(const[c,l]of A)if(c!=="parent_source_group_id"){if(c.endsWith("_id")&&typeof l=="string"){const u=o.get(l);J0n(i,a,u)}else if(c.endsWith("_ids")&&Array.isArray(l)){for(const u of l)if(typeof u=="string"){const g=o.get(u);J0n(i,a,g)}}}}const r=[],s=new Set;for(const a of t){let A=!1;(n.subcircuit_id&&"subcircuit_id"in a&&a.subcircuit_id===n.subcircuit_id||n.subcircuit_ids&&"subcircuit_id"in a&&a.subcircuit_id&&n.subcircuit_ids.includes(a.subcircuit_id)||n.source_group_id&&"source_group_id"in a&&a.source_group_id===n.source_group_id||n.source_group_id&&"member_source_group_ids"in a&&Array.isArray(a.member_source_group_ids)&&a.member_source_group_ids.includes(n.source_group_id))&&(A=!0),A&&(r.push(a),s.add(a))}for(;r.length>0;){const a=r.shift(),A=i.get(a);if(A)for(const c of A)s.has(c)||(s.add(c),r.push(c))}return t.filter(a=>s.has(a))}var u_e=((t,e={})=>{const n=t;let o=n._internal_store;if(!o){o={counts:{},editCount:0},n._internal_store=o;for(const r of n){const s=r.type,a=r[`${s}_id`];if(!a)continue;const A=Number.parseInt(a.split("_").pop());Number.isNaN(A)||(o.counts[s]=Math.max(o.counts[s]??0,A))}}const i=new Proxy({},{get:(r,s)=>{if(s==="toArray")return()=>(n.editCount=o.editCount,n);if(s==="editCount")return o.editCount;if(s==="subtree")return A=>u_e(ywi(n,A),e);if(s==="insert")return A=>{const c=A.type;if(!c)throw new Error("insert requires an element with a type");o.counts[c]??=-1,o.counts[c]++;const l=o.counts[c],u={...A,type:c,[`${c}_id`]:`${c}_${l}`};return e.validateInserts&&(R9[c]??U4).parse(u),n.push(u),o.editCount++,u};if(s==="insertAll")return A=>A.map(c=>i.insert(c));const a=s;return{get:A=>n.find(c=>c.type===a&&c[`${a}_id`]===A),getUsing:A=>{const c=Object.keys(A);if(c.length!==1)throw new Error("getUsing requires exactly one key, e.g. { pcb_component_id }");const l=c[0],u=l.replace("_id",""),g=n.find(h=>h.type===u&&h[l]===A[l]);return g?n.find(h=>h.type===a&&h[`${a}_id`]===g[`${a}_id`]):null},getWhere:A=>{const c=Object.keys(A);return n.find(l=>l.type===a&&c.every(u=>l[u]===A[u]))},list:A=>{const c=A?Object.keys(A):[];return n.filter(l=>l.type===a&&c.every(u=>l[u]===A[u]))},insert:A=>{o.counts[a]??=-1,o.counts[a]++;const c=o.counts[a],l={type:a,[`${a}_id`]:`${a}_${c}`,...A};return e.validateInserts&&(R9[a]??U4).parse(l),n.push(l),o.editCount++,l},delete:A=>{const c=n.find(l=>l[`${a}_id`]===A);c&&(n.splice(n.indexOf(c),1),o.editCount++)},update:(A,c)=>{const l=n.find(u=>u.type===a&&u[`${a}_id`]===A);return l?(Object.assign(l,c),o.editCount++,l):null},select:A=>{if(a==="source_component")return n.find(c=>c.type==="source_component"&&c.name===A.replace(/\./g,""));if(a==="pcb_port"||a==="source_port"||a==="schematic_port"){const[c,l]=A.replace(/\./g,"").split(/[\s\>]+/),u=n.find(h=>h.type==="source_component"&&h.name===c);if(!u)return null;const g=n.find(h=>h.type==="source_port"&&h.source_component_id===u.source_component_id&&(h.name===l||(h.port_hints??[]).includes(l)));if(!g)return null;if(a==="source_port")return g;if(a==="pcb_port")return n.find(h=>h.type==="pcb_port"&&h.source_port_id===g.source_port_id);if(a==="schematic_port")return n.find(h=>h.type==="schematic_port"&&h.source_port_id===g.source_port_id)}}}}});return i});u_e.unparsed=u_e;var MT=u_e;function WWe(t){const e=t.type;return`${e}:${t[`${e}_id`]}`}var W0n=((t,e={})=>{let n=t._internal_store_indexed;if(!n){n={counts:{},editCount:0,indexes:{}};for(const s of t){const a=s.type,A=s[`${a}_id`];if(!A)continue;const c=Number.parseInt(A.split("_").pop()||"");Number.isNaN(c)||(n.counts[a]=Math.max(n.counts[a]??0,c))}const i=e.indexConfig||{},r=n.indexes;if(i.byId&&(r.byId=new Map),i.byType&&(r.byType=new Map),i.byRelation&&(r.byRelation=new Map),i.bySubcircuit&&(r.bySubcircuit=new Map),i.byCustomField&&i.byCustomField.length>0){r.byCustomField=new Map;for(const s of i.byCustomField)r.byCustomField.set(s,new Map)}for(const s of t){if(i.byId){const a=WWe(s);r.byId.set(a,s)}if(i.byType){const a=r.byType.get(s.type)||[];a.push(s),r.byType.set(s.type,a)}if(i.byRelation){const a=Object.entries(s);for(const[A,c]of a)if(A.endsWith("_id")&&A!==`${s.type}_id`&&typeof c=="string"){const l=r.byRelation.get(A)||new Map,u=l.get(c)||[];u.push(s),l.set(c,u),r.byRelation.set(A,l)}}if(i.bySubcircuit&&"subcircuit_id"in s){const a=s.subcircuit_id;if(a&&typeof a=="string"){const A=r.bySubcircuit.get(a)||[];A.push(s),r.bySubcircuit.set(a,A)}}if(i.byCustomField&&r.byCustomField){for(const a of i.byCustomField)if(a in s){const A=s[a];if(A!==void 0&&(typeof A=="string"||typeof A=="number")){const c=String(A),l=r.byCustomField.get(a),u=l.get(c)||[];u.push(s),l.set(c,u)}}}}t._internal_store_indexed=n}return new Proxy({},{get:(i,r)=>{if(r==="toArray")return()=>(t.editCount=n.editCount,t);if(r==="editCount")return n.editCount;const s=r;return{get:a=>{const A=e.indexConfig||{};return A.byId&&n.indexes.byId?n.indexes.byId.get(`${s}:${a}`)||null:A.byType&&n.indexes.byType?(n.indexes.byType.get(s)||[]).find(l=>l[`${s}_id`]===a)||null:t.find(c=>c.type===s&&c[`${s}_id`]===a)||null},getUsing:a=>{const A=e.indexConfig||{},c=Object.keys(a);if(c.length!==1)throw new Error("getUsing requires exactly one key, e.g. { pcb_component_id }");const l=c[0],u=l.replace("_id","");if(A.byRelation&&n.indexes.byRelation){const h=n.indexes.byRelation.get(l);if(h){const p=(h.get(a[l])||[]).find(_=>_.type===u);if(!p)return null;const m=p[`${s}_id`];return A.byId&&n.indexes.byId?n.indexes.byId.get(`${s}:${m}`)||null:A.byType&&n.indexes.byType?(n.indexes.byType.get(s)||[]).find(f=>f[`${s}_id`]===m)||null:t.find(_=>_.type===s&&_[`${s}_id`]===m)||null}}const g=t.find(h=>h.type===u&&h[l]===a[l]);return g&&t.find(h=>h.type===s&&h[`${s}_id`]===g[`${s}_id`])||null},getWhere:a=>{const A=e.indexConfig||{},c=Object.keys(a);if(c.length===1&&A.byCustomField&&n.indexes.byCustomField){const l=c[0],u=n.indexes.byCustomField.get(l);if(u){const g=String(a[l]);return(u.get(g)||[]).find(d=>d.type===s)||null}}if("subcircuit_id"in a&&A.bySubcircuit&&n.indexes.bySubcircuit){const l=a.subcircuit_id;return(n.indexes.bySubcircuit.get(l)||[]).find(g=>g.type===s&&c.every(h=>g[h]===a[h]))||null}return A.byType&&n.indexes.byType?(n.indexes.byType.get(s)||[]).find(u=>c.every(g=>u[g]===a[g]))||null:t.find(l=>l.type===s&&c.every(u=>l[u]===a[u]))||null},list:a=>{const A=e.indexConfig||{},c=a?Object.keys(a):[];if(c.length===0&&A.byType&&n.indexes.byType)return n.indexes.byType.get(s)||[];if(c.length===1&&c[0]==="subcircuit_id"&&A.bySubcircuit&&n.indexes.bySubcircuit){const u=a.subcircuit_id;return(n.indexes.bySubcircuit.get(u)||[]).filter(h=>h.type===s)}let l;return A.byType&&n.indexes.byType?l=n.indexes.byType.get(s)||[]:l=t.filter(u=>u.type===s),c.length>0?l.filter(u=>c.every(g=>u[g]===a[g])):l},insert:a=>{n.counts[s]??=-1,n.counts[s]++;const A=n.counts[s],c={type:s,[`${s}_id`]:`${s}_${A}`,...a};e.validateInserts&&(R9[s]??U4).parse(c),t.push(c),n.editCount++;const l=e.indexConfig||{};if(l.byId&&n.indexes.byId){const u=WWe(c);n.indexes.byId.set(u,c)}if(l.byType&&n.indexes.byType){const u=n.indexes.byType.get(s)||[];u.push(c),n.indexes.byType.set(s,u)}if(l.byRelation&&n.indexes.byRelation){const u=Object.entries(c);for(const[g,h]of u)if(g.endsWith("_id")&&g!==`${c.type}_id`&&typeof h=="string"){const d=n.indexes.byRelation.get(g)||new Map,p=d.get(h)||[];p.push(c),d.set(h,p),n.indexes.byRelation.set(g,d)}}if(l.bySubcircuit&&n.indexes.bySubcircuit&&"subcircuit_id"in c){const u=c.subcircuit_id;if(u&&typeof u=="string"){const g=n.indexes.bySubcircuit.get(u)||[];g.push(c),n.indexes.bySubcircuit.set(u,g)}}if(l.byCustomField&&n.indexes.byCustomField){for(const u of l.byCustomField)if(u in c){const g=c[u];if(g!==void 0&&(typeof g=="string"||typeof g=="number")){const h=String(g),d=n.indexes.byCustomField.get(u),p=d.get(h)||[];p.push(c),d.set(h,p)}}}return c},delete:a=>{const A=e.indexConfig||{};let c;if(A.byId&&n.indexes.byId?c=n.indexes.byId.get(`${s}:${a}`):A.byType&&n.indexes.byType?c=(n.indexes.byType.get(s)||[]).find(g=>g[`${s}_id`]===a):c=t.find(u=>u[`${s}_id`]===a),!c)return;const l=t.indexOf(c);if(l>=0&&(t.splice(l,1),n.editCount++),A.byId&&n.indexes.byId){const u=WWe(c);n.indexes.byId.delete(u)}if(A.byType&&n.indexes.byType){const g=(n.indexes.byType.get(s)||[]).filter(h=>h[`${s}_id`]!==a);n.indexes.byType.set(s,g)}if(A.byRelation&&n.indexes.byRelation)for(const[u,g]of n.indexes.byRelation.entries())for(const[h,d]of g.entries()){const p=d.filter(m=>m!==c);p.length===0?g.delete(h):g.set(h,p)}if(A.bySubcircuit&&n.indexes.bySubcircuit&&"subcircuit_id"in c){const u=c.subcircuit_id;if(u){const h=(n.indexes.bySubcircuit.get(u)||[]).filter(d=>d!==c);h.length===0?n.indexes.bySubcircuit.delete(u):n.indexes.bySubcircuit.set(u,h)}}if(A.byCustomField&&n.indexes.byCustomField)for(const u of n.indexes.byCustomField.values())for(const[g,h]of u.entries()){const d=h.filter(p=>p!==c);d.length===0?u.delete(g):u.set(g,d)}},update:(a,A)=>{const c=e.indexConfig||{};let l;if(c.byId&&n.indexes.byId?l=n.indexes.byId.get(`${s}:${a}`):c.byType&&n.indexes.byType?l=(n.indexes.byType.get(s)||[]).find(g=>g[`${s}_id`]===a):l=t.find(u=>u.type===s&&u[`${s}_id`]===a),!l)return null;if(c.byRelation&&n.indexes.byRelation){const u=Object.entries(l);for(const[g,h]of u)if(g.endsWith("_id")&&g!==`${l.type}_id`&&typeof h=="string"&&g in A&&A[g]!==h){const d=n.indexes.byRelation.get(g);if(d){const m=(d.get(h)||[]).filter(_=>_!==l);m.length===0?d.delete(h):d.set(h,m)}}}if(c.bySubcircuit&&n.indexes.bySubcircuit&&"subcircuit_id"in l&&"subcircuit_id"in A){const u=l.subcircuit_id,g=A.subcircuit_id;if(u!==g){const d=(n.indexes.bySubcircuit.get(u)||[]).filter(p=>p!==l);d.length===0?n.indexes.bySubcircuit.delete(u):n.indexes.bySubcircuit.set(u,d)}}if(c.byCustomField&&n.indexes.byCustomField){for(const u of c.byCustomField)if(u in l&&u in A&&l[u]!==A[u]){const g=n.indexes.byCustomField.get(u);if(g){const h=String(l[u]),p=(g.get(h)||[]).filter(m=>m!==l);p.length===0?g.delete(h):g.set(h,p)}}}if(Object.assign(l,A),n.editCount++,c.byRelation&&n.indexes.byRelation){const u=Object.entries(l);for(const[g,h]of u)if(g.endsWith("_id")&&g!==`${l.type}_id`&&typeof h=="string"&&g in A){const d=n.indexes.byRelation.get(g)||new Map,p=d.get(h)||[];p.includes(l)||(p.push(l),d.set(h,p),n.indexes.byRelation.set(g,d))}}if(c.bySubcircuit&&n.indexes.bySubcircuit&&"subcircuit_id"in l&&"subcircuit_id"in A){const u=l.subcircuit_id;if(u&&typeof u=="string"){const g=n.indexes.bySubcircuit.get(u)||[];g.includes(l)||(g.push(l),n.indexes.bySubcircuit.set(u,g))}}if(c.byCustomField&&n.indexes.byCustomField){for(const u of c.byCustomField)if(u in l&&u in A){const g=l[u];if(g!==void 0&&(typeof g=="string"||typeof g=="number")){const h=String(g),d=n.indexes.byCustomField.get(u),p=d.get(h)||[];p.includes(l)||(p.push(l),d.set(h,p))}}}return l},select:a=>{if(s==="source_component")return t.find(A=>A.type==="source_component"&&A.name===a.replace(/\./g,""))||null;if(s==="pcb_port"||s==="source_port"||s==="schematic_port"){const[A,c]=a.replace(/\./g,"").split(/[\s\>]+/),l=t.find(g=>g.type==="source_component"&&g.name===A);if(!l)return null;const u=t.find(g=>g.type==="source_port"&&g.source_component_id===l.source_component_id&&(g.name===c||(g.port_hints??[]).includes(c)));if(!u)return null;if(s==="source_port")return u;if(s==="pcb_port")return t.find(g=>g.type==="pcb_port"&&g.source_port_id===u.source_port_id)||null;if(s==="schematic_port")return t.find(g=>g.type==="schematic_port"&&g.source_port_id===u.source_port_id)||null}return null}}}})});W0n.unparsed=W0n;var j0n=(t,e)=>({minX:Math.min(t.minX,e.minX),minY:Math.min(t.minY,e.minY),maxX:Math.max(t.maxX,e.maxX),maxY:Math.max(t.maxY,e.maxY)}),RZ=(t,e,n)=>{const o=n/2;return{minX:t-o,minY:e-o,maxX:t+o,maxY:e+o}},$0n=(t,e,n,o,i)=>{const r=n/2,s=o/2,a=i*Math.PI/180,A=Math.cos(a),c=Math.sin(a),l=[{x:-r,y:-s},{x:r,y:-s},{x:r,y:s},{x:-r,y:s}].map(u=>({x:t+u.x*A-u.y*c,y:e+u.x*c+u.y*A}));return{minX:Math.min(...l.map(u=>u.x)),minY:Math.min(...l.map(u=>u.y)),maxX:Math.max(...l.map(u=>u.x)),maxY:Math.max(...l.map(u=>u.y))}},xwi=(t,e,n,o,i)=>{const r=n/2,s=o/2,a=i*Math.PI/180,A=Math.cos(a),c=Math.sin(a),l=Math.hypot(r*A,s*c),u=Math.hypot(r*c,s*A);return{minX:t-l,minY:e-u,maxX:t+l,maxY:e+u}},Ewi=(t,e,n,o,i)=>{const r=Math.min(n,o)/2,s=Math.max(n,o)/2-r,a=i*Math.PI/180,A=n>=o?{x:s,y:0}:{x:0,y:s},c={x:A.x*Math.cos(a)-A.y*Math.sin(a),y:A.x*Math.sin(a)+A.y*Math.cos(a)},l=Math.abs(c.x)+r,u=Math.abs(c.y)+r;return{minX:t-l,minY:e-u,maxX:t+l,maxY:e+u}},g_e=t=>t.length===0?null:{minX:Math.min(...t.map(e=>e.x)),minY:Math.min(...t.map(e=>e.y)),maxX:Math.max(...t.map(e=>e.x)),maxY:Math.max(...t.map(e=>e.y))},jWe=t=>Array.isArray(t)?t.flatMap(e=>!e||typeof e!="object"?[]:"x"in e&&"y"in e&&typeof e.x=="number"&&typeof e.y=="number"?[{x:e.x,y:e.y}]:"start"in e&&"end"in e?[e.start,e.end].filter(o=>!!(o&&typeof o=="object"&&"x"in o&&"y"in o&&typeof o.x=="number"&&typeof o.y=="number")):[]):[],q0n=t=>{if(!t.type.startsWith("pcb_"))return null;if(t.type==="pcb_smtpad"&&t.shape==="polygon"&&Array.isArray(t.points))return g_e(t.points);if(t.type==="pcb_hole"&&t.hole_shape==="circle")return RZ(t.x,t.y,t.hole_diameter);if(t.type==="pcb_plated_hole"){let u;if("outer_diameter"in t&&typeof t.outer_diameter=="number"?u=RZ(t.x,t.y,t.outer_diameter):"hole_diameter"in t&&typeof t.hole_diameter=="number"&&(u=RZ(t.x,t.y,t.hole_diameter)),(t.shape==="oval"||t.shape==="pill")&&typeof t.outer_width=="number"&&typeof t.outer_height=="number"&&(u=(t.shape==="pill"?Ewi:xwi)(t.x,t.y,t.outer_width,t.outer_height,t.ccw_rotation??0)),"rect_pad_width"in t&&typeof t.rect_pad_width=="number"&&"rect_pad_height"in t&&typeof t.rect_pad_height=="number"){const g=$0n(t.x,t.y,t.rect_pad_width,t.rect_pad_height,"rect_ccw_rotation"in t?t.rect_ccw_rotation??0:0);u=u?j0n(u,g):g}if("hole_diameter"in t&&typeof t.hole_diameter=="number"){const g=RZ(t.x+("hole_offset_x"in t?t.hole_offset_x??0:0),t.y+("hole_offset_y"in t?t.hole_offset_y??0:0),t.hole_diameter);u=u?j0n(u,g):g}if(u)return u}const e=t,n=g_e(jWe(e.route));if(n)return n;const o=g_e(jWe(e.outline));if(o)return o;const i=g_e(jWe(e.points));if(i)return i;let r,s,a,A;"x"in t&&"y"in t&&(r=Number(t.x),s=Number(t.y)),"outer_diameter"in t&&(a=Number(t.outer_diameter),A=Number(t.outer_diameter)),"width"in t&&(a=Number(t.width)),"height"in t&&(A=Number(t.height)),"center"in t&&t.center&&typeof t.center=="object"&&"x"in t.center&&"y"in t.center&&(r=Number(t.center.x),s=Number(t.center.y));let c=0;if("rotation"in t&&typeof t.rotation=="number"&&(c=t.rotation),"ccw_rotation"in t&&typeof t.ccw_rotation=="number"&&(c=t.ccw_rotation),r!==void 0&&s!==void 0)return a!==void 0&&A!==void 0?c?$0n(r,s,a,A,c):{minX:r-a/2,minY:s-A/2,maxX:r+a/2,maxY:s+A/2}:"radius"in t&&typeof t.radius=="number"?RZ(r,s,t.radius*2):{minX:r,minY:s,maxX:r,maxY:s};const l=[e.anchor_position,e.position].filter(u=>!!(u&&typeof u=="object"&&"x"in u&&"y"in u&&typeof u.x=="number"&&typeof u.y=="number")).at(0);return l?{minX:l.x,minY:l.y,maxX:l.x,maxY:l.y}:null},Bwi=(t,e)=>t.filter(n=>{const o=q0n(n);return o?o.minX<=e.maxX&&o.maxX>=e.minX&&o.minY<=e.maxY&&o.maxY>=e.minY:!1}),bwi="TscircuitAlphabet",X0n="data-tscircuit-alphabet-font";function $We(t){const e=o=>({...o,children:(o.children??[]).filter(i=>!(X0n in(i.attributes??{}))).map(e)}),n=e(t);return n.children.push({name:"style",type:"element",value:"",attributes:{[X0n]:"",type:"text/css"},children:[{name:"",type:"text",value:`@font-face { font-family: '${bwi}'; src: url('data:font/ttf;base64,${EYt}') format('truetype'); font-weight: normal; font-style: normal; }`,attributes:{},children:[]}]}),Cbt(n)}var Z0n=vc("circuit-to-svg");Z0n.extend("pcb"),Z0n.extend("sch");var $h={"3d_viewer":{background_bottom:"rgb(102, 102, 128)",background_top:"rgb(204, 204, 230)",board:"rgb(51, 43, 23)",copper:"rgb(179, 156, 0)",silkscreen_bottom:"rgb(230, 230, 230)",silkscreen_top:"rgb(230, 230, 230)",soldermask:"rgb(20, 51, 36)",solderpaste:"rgb(128, 128, 128)"},board:{anchor:"rgb(255, 38, 226)",aux_items:"rgb(255, 255, 255)",b_adhes:"rgb(0, 0, 132)",b_crtyd:"rgb(255, 38, 226)",b_fab:"rgb(88, 93, 132)",b_mask:"rgba(2, 255, 238, 0.400)",b_paste:"rgb(0, 194, 194)",b_silks:"rgb(232, 178, 167)",background:"rgb(0, 16, 35)",cmts_user:"rgb(89, 148, 220)",copper:{b:"rgb(77, 127, 196)",f:"rgb(200, 52, 52)",in1:"rgb(127, 200, 127)",in10:"rgb(237, 124, 51)",in11:"rgb(91, 195, 235)",in12:"rgb(247, 111, 142)",in13:"rgb(167, 165, 198)",in14:"rgb(40, 204, 217)",in15:"rgb(232, 178, 167)",in16:"rgb(242, 237, 161)",in17:"rgb(237, 124, 51)",in18:"rgb(91, 195, 235)",in19:"rgb(247, 111, 142)",in2:"rgb(206, 125, 44)",in20:"rgb(167, 165, 198)",in21:"rgb(40, 204, 217)",in22:"rgb(232, 178, 167)",in23:"rgb(242, 237, 161)",in24:"rgb(237, 124, 51)",in25:"rgb(91, 195, 235)",in26:"rgb(247, 111, 142)",in27:"rgb(167, 165, 198)",in28:"rgb(40, 204, 217)",in29:"rgb(232, 178, 167)",in3:"rgb(79, 203, 203)",in30:"rgb(242, 237, 161)",in4:"rgb(219, 98, 139)",in5:"rgb(167, 165, 198)",in6:"rgb(40, 204, 217)",in7:"rgb(232, 178, 167)",in8:"rgb(242, 237, 161)",in9:"rgb(141, 203, 129)"},cursor:"rgb(255, 255, 255)",drc:"rgb(194, 194, 194)",drc_error:"rgba(215, 91, 107, 0.800)",drc_exclusion:"rgb(255, 255, 255)",drc_warning:"rgba(255, 208, 66, 0.902)",dwgs_user:"rgb(194, 194, 194)",eco1_user:"rgb(180, 219, 210)",eco2_user:"rgb(216, 200, 82)",edge_cuts:"rgb(208, 210, 205)",f_adhes:"rgb(132, 0, 132)",f_crtyd:"rgb(255, 0, 245)",f_fab:"rgb(175, 175, 175)",f_mask:"rgba(216, 100, 255, 0.400)",f_paste:"rgba(180, 160, 154, 0.902)",f_silks:"rgb(242, 237, 161)",footprint_text_back:"rgb(0, 0, 132)",footprint_text_front:"rgb(194, 194, 194)",footprint_text_invisible:"rgb(132, 132, 132)",grid:"rgb(132, 132, 132)",grid_axes:"rgb(194, 194, 194)",margin:"rgb(255, 38, 226)",microvia:"rgb(0, 132, 132)",no_connect:"rgb(0, 0, 132)",pad_back:"rgb(77, 127, 196)",pad_front:"rgb(200, 52, 52)",pad_plated_hole:"rgb(194, 194, 0)",pad_through_hole:"rgb(227, 183, 46)",plated_hole:"rgb(26, 196, 210)",ratsnest:"rgba(245, 255, 213, 0.702)",select_overlay:"rgb(4, 255, 67)",through_via:"rgb(236, 236, 236)",user_1:"rgb(194, 194, 194)",user_2:"rgb(89, 148, 220)",user_3:"rgb(180, 219, 210)",user_4:"rgb(216, 200, 82)",user_5:"rgb(194, 194, 194)",user_6:"rgb(89, 148, 220)",user_7:"rgb(180, 219, 210)",user_8:"rgb(216, 200, 82)",user_9:"rgb(232, 178, 167)",via_blind_buried:"rgb(187, 151, 38)",via_hole:"rgb(227, 183, 46)",via_micro:"rgb(0, 132, 132)",via_through:"rgb(236, 236, 236)",worksheet:"rgb(200, 114, 171)"},gerbview:{axes:"rgb(0, 0, 132)",background:"rgb(0, 0, 0)",dcodes:"rgb(255, 255, 255)",grid:"rgb(132, 132, 132)",layers:["rgb(132, 0, 0)","rgb(194, 194, 0)","rgb(194, 0, 194)","rgb(194, 0, 0)","rgb(0, 132, 132)","rgb(0, 132, 0)","rgb(0, 0, 132)","rgb(132, 132, 132)","rgb(132, 0, 132)","rgb(194, 194, 194)","rgb(132, 0, 132)","rgb(132, 0, 0)","rgb(132, 132, 0)","rgb(194, 194, 194)","rgb(0, 0, 132)","rgb(0, 132, 0)","rgb(132, 0, 0)","rgb(194, 194, 0)","rgb(194, 0, 194)","rgb(194, 0, 0)","rgb(0, 132, 132)","rgb(0, 132, 0)","rgb(0, 0, 132)","rgb(132, 132, 132)","rgb(132, 0, 132)","rgb(194, 194, 194)","rgb(132, 0, 132)","rgb(132, 0, 0)","rgb(132, 132, 0)","rgb(194, 194, 194)","rgb(0, 0, 132)","rgb(0, 132, 0)","rgb(132, 0, 0)","rgb(194, 194, 0)","rgb(194, 0, 194)","rgb(194, 0, 0)","rgb(0, 132, 132)","rgb(0, 132, 0)","rgb(0, 0, 132)","rgb(132, 132, 132)","rgb(132, 0, 132)","rgb(194, 194, 194)","rgb(132, 0, 132)","rgb(132, 0, 0)","rgb(132, 132, 0)","rgb(194, 194, 194)","rgb(0, 0, 132)","rgb(0, 132, 0)","rgb(132, 0, 0)","rgb(194, 194, 0)","rgb(194, 0, 194)","rgb(194, 0, 0)","rgb(0, 132, 132)","rgb(0, 132, 0)","rgb(0, 0, 132)","rgb(132, 132, 132)","rgb(132, 0, 132)","rgb(194, 194, 194)","rgb(132, 0, 132)","rgb(132, 0, 0)"],negative_objects:"rgb(132, 132, 132)",worksheet:"rgb(0, 0, 132)"},meta:{filename:"kicad_2020",name:"KiCad 2020",version:2},simulation_palette:["#1f77b4","#d62728","#2ca02c","#ff7f0e","#9467bd","#17becf","#8c564b","#e377c2","#7f7f7f","#bcbd22"],palette:["rgb(132, 0, 0)","rgb(194, 194, 0)","rgb(194, 0, 194)","rgb(194, 0, 0)","rgb(0, 132, 132)","rgb(0, 132, 0)","rgb(0, 0, 132)","rgb(132, 132, 132)","rgb(132, 0, 132)","rgb(194, 194, 194)","rgb(132, 0, 132)","rgb(132, 0, 0)","rgb(132, 132, 0)","rgb(194, 194, 194)","rgb(0, 0, 132)","rgb(0, 132, 0)"],schematic:{aux_items:"rgb(46, 46, 46)",background:"rgb(245, 241, 237)",brightened:"rgb(255, 0, 255)",bus:"rgb(0, 0, 132)",bus_junction:"rgb(0, 0, 132)",component_body:"rgb(255, 255, 194)",component_outline:"rgb(132, 0, 0)",cursor:"rgb(15, 15, 15)",erc_error:"rgba(230, 9, 13, 0.800)",erc_warning:"rgba(209, 146, 0, 0.800)",fields:"rgb(132, 0, 132)",grid:"rgb(181, 181, 181)",grid_axes:"rgb(0, 0, 132)",hidden:"rgb(194, 194, 194)",junction:"rgb(0, 150, 0)",label_global:"rgb(132, 0, 0)",label_background:"rgba(255, 255, 255, 0.6)",label_hier:"rgb(114, 86, 0)",label_local:"rgb(15, 15, 15)",net_name:"rgb(132, 132, 132)",no_connect:"rgb(132, 0, 0)",note:"rgb(0, 0, 194)",override_item_colors:!1,pin:"rgb(132, 0, 0)",pin_name:"rgb(0, 100, 100)",pin_number:"rgb(169, 0, 0)",reference:"rgb(0, 100, 100)",shadow:"rgba(102, 179, 255, 0.800)",sheet:"rgb(132, 0, 0)",sheet_background:"rgba(253, 255, 231, 0.000)",sheet_fields:"rgb(132, 0, 132)",sheet_filename:"rgb(114, 86, 0)",sheet_label:"rgb(0, 100, 100)",sheet_name:"rgb(0, 100, 100)",table:"rgb(102, 102, 102)",value:"rgb(0, 100, 100)",wire:"rgb(0, 150, 0)",wire_crossing:"rgb(30, 180, 30)",worksheet:"rgb(132, 0, 0)"}};$h.board.user_2,$h.board.user_2,$h.board.user_2,$h.board.user_2,$h.board.user_2;var eun=.94,d_e=.09/2,Swi=Object.fromEntries(Object.entries(Ov).map(([t,e])=>{const n=e.flatMap(i=>[i.x1,i.x2]),o=e.flatMap(i=>[i.y1,i.y2]);return[t,e.length?{minX:Math.min(...n)-d_e,maxX:Math.max(...n)+d_e,minY:-(Math.max(...o)+d_e)*eun,maxY:-(Math.min(...o)-d_e)*eun}:null]}));Math.round(Math.max(...Object.values(Swi).map(t=>t?t.maxX-t.minX:0))*1e3)/1e3;function qWe(t){return t.find(n=>n.type==="project_software_metadata"||n.type==="source_project_metadata")?.software_used_string}var Qwi={version:"0.0.431"},XWe=Qwi.version;function vwi(t,e="error_text_overlay"){const n=t.filter(r=>r.type.endsWith("_error"));if(n.length===0)return null;const o=n.map(r=>r.message).filter(r=>!!r);return o.length===0?null:{name:"text",type:"element",value:"",attributes:{x:"10",y:"20",fill:"red","font-family":"monospace","font-size":"12px","data-type":e,"data-layer":"global"},children:o.map((r,s)=>({name:"tspan",type:"element",value:"",attributes:{x:"10",dy:s===0?"0":"1.2em"},children:[{type:"text",value:r,name:"",attributes:{},children:[]}]}))}}var wwi={pin_number:.15,negated_pin_number:.15*.8,reference_designator:.18,manufacturer_number:.18,net_label:.18,error:.05},DP=(t,e)=>e??wwi[t],PE=(t,e,n)=>Math.abs(t.a)*DP(e,n);function Pwi(t){const{minX:e,minY:n,maxX:o,maxY:i}=t.bounds,r=t.cellSize??1,s=t.labelCells??!1,a=[],A=(c,l)=>{const[u,g]=er(t.transform,[c,l]);return{x:u,y:g}};for(let c=Math.floor(e);c<=Math.ceil(o);c+=r){const l=A(c,n),u=A(c,i);a.push({name:"line",type:"element",attributes:{x1:l.x.toString(),y1:l.y.toString(),x2:u.x.toString(),y2:u.y.toString(),stroke:$h.schematic.grid,"stroke-width":(.01*Math.abs(t.transform.a)).toString(),"stroke-opacity":"0.5"}})}for(let c=Math.floor(n);c<=Math.ceil(i);c+=r){const l=A(e,c),u=A(o,c);a.push({name:"line",type:"element",attributes:{x1:l.x.toString(),y1:l.y.toString(),x2:u.x.toString(),y2:u.y.toString(),stroke:$h.schematic.grid,"stroke-width":(.01*Math.abs(t.transform.a)).toString(),"stroke-opacity":"0.5"}})}if(s){const c=(l,u)=>r<=.1?`${l.toFixed(1)},${u.toFixed(1)}`:`${l},${u}`;for(let l=Math.floor(e);l<=Math.ceil(o);l+=r)for(let u=Math.floor(n);u<=Math.ceil(i);u+=r){const g=A(l,u);a.push({name:"text",type:"element",attributes:{x:(g.x-2.5).toString(),y:(g.y-5).toString(),fill:$h.schematic.grid,"font-size":(r/5*Math.abs(t.transform.a)).toString(),"fill-opacity":"0.5","text-anchor":"middle","dominant-baseline":"middle","font-family":"sans-serif"},children:[{type:"text",value:c(l,u),name:"",attributes:{},children:[]}]})}}return{name:"g",value:"",type:"element",attributes:{class:"grid sch-grid"},children:a}}function Mwi(t){const{points:e,transform:n}=t,o=[];for(const i of e){const[r,s]=er(n,[i.x-.1,i.y-.1]),[a,A]=er(n,[i.x+.1,i.y+.1]),[c,l]=er(n,[i.x-.1,i.y+.1]),[u,g]=er(n,[i.x+.1,i.y-.1]);o.push({name:"path",type:"element",attributes:{d:`M${r},${s} L${a},${A} M${c},${l} L${u},${g}`,stroke:$h.schematic.grid,"stroke-width":(.02*Math.abs(n.a)).toString(),"stroke-opacity":"0.7"}});const[h,d]=er(n,[i.x+.15,i.y-.15]);o.push({name:"text",type:"element",attributes:{x:h.toString(),y:d.toString(),fill:$h.schematic.grid,"font-size":(.1*Math.abs(n.a)).toString(),"fill-opacity":"0.7","text-anchor":"start","font-family":"sans-serif","dominant-baseline":"middle"},children:[{type:"text",value:i.label||`(${i.x},${i.y})`,name:"",attributes:{},children:[]}]})}return{name:"g",value:"",type:"element",attributes:{class:"labeled-points sch-labeled-points"},children:o}}function Dwi(t){return t.reduce((e,n)=>e?n.sheet_index===void 0?e:e.sheet_index===void 0||n.sheet_index<e.sheet_index?n:e:n,void 0)}var tun={0:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},1:{width:13,height:27,ascent:22,descent:5,left:-3,right:9},2:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},3:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},4:{width:13,height:27,ascent:22,descent:5,left:0,right:12},5:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},6:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},7:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},8:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},9:{width:13,height:27,ascent:22,descent:5,left:-1,right:12}," ":{width:7,height:27,ascent:22,descent:5,left:0,right:0},"!":{width:7,height:27,ascent:22,descent:5,left:-2,right:5},'"':{width:9,height:27,ascent:22,descent:5,left:-1,right:7},"#":{width:13,height:27,ascent:22,descent:5,left:0,right:13},$:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},"%":{width:21,height:27,ascent:22,descent:5,left:-1,right:20},"&":{width:16,height:27,ascent:22,descent:5,left:-1,right:15},"'":{width:5,height:27,ascent:22,descent:5,left:-1,right:3},"(":{width:8,height:27,ascent:22,descent:5,left:-1,right:7},")":{width:8,height:27,ascent:22,descent:5,left:-1,right:7},"*":{width:9,height:27,ascent:22,descent:5,left:-1,right:8},"+":{width:14,height:27,ascent:22,descent:5,left:-1,right:13},",":{width:7,height:27,ascent:22,descent:5,left:-2,right:5},"-":{width:8,height:27,ascent:22,descent:5,left:-1,right:7},".":{width:7,height:27,ascent:22,descent:5,left:-2,right:5},"/":{width:7,height:27,ascent:22,descent:5,left:0,right:7},":":{width:7,height:27,ascent:22,descent:5,left:-2,right:5},";":{width:7,height:27,ascent:22,descent:5,left:-2,right:5},"<":{width:14,height:27,ascent:22,descent:5,left:-1,right:13},"=":{width:14,height:27,ascent:22,descent:5,left:-1,right:13},">":{width:14,height:27,ascent:22,descent:5,left:-1,right:13},"?":{width:13,height:27,ascent:22,descent:5,left:-1,right:12},"@":{width:24,height:27,ascent:22,descent:5,left:-1,right:23},A:{width:16,height:27,ascent:22,descent:5,left:0,right:16},B:{width:16,height:27,ascent:22,descent:5,left:-2,right:15},C:{width:17,height:27,ascent:22,descent:5,left:-1,right:16},D:{width:17,height:27,ascent:22,descent:5,left:-2,right:16},E:{width:16,height:27,ascent:22,descent:5,left:-2,right:15},F:{width:15,height:27,ascent:22,descent:5,left:-2,right:14},G:{width:19,height:27,ascent:22,descent:5,left:-1,right:17},H:{width:17,height:27,ascent:22,descent:5,left:-2,right:15},I:{width:7,height:27,ascent:22,descent:5,left:-2,right:5},J:{width:12,height:27,ascent:22,descent:5,left:-1,right:10},K:{width:16,height:27,ascent:22,descent:5,left:-2,right:16},L:{width:13,height:27,ascent:22,descent:5,left:-2,right:12},M:{width:20,height:27,ascent:22,descent:5,left:-2,right:18},N:{width:17,height:27,ascent:22,descent:5,left:-2,right:15},O:{width:19,height:27,ascent:22,descent:5,left:-1,right:18},P:{width:16,height:27,ascent:22,descent:5,left:-2,right:15},Q:{width:19,height:27,ascent:22,descent:5,left:-1,right:18},R:{width:17,height:27,ascent:22,descent:5,left:-2,right:17},S:{width:16,height:27,ascent:22,descent:5,left:-1,right:15},T:{width:15,height:27,ascent:22,descent:5,left:-1,right:14},U:{width:17,height:27,ascent:22,descent:5,left:-2,right:15},V:{width:16,height:27,ascent:22,descent:5,left:0,right:16},W:{width:23,height:27,ascent:22,descent:5,left:0,right:22},X:{width:16,height:27,ascent:22,descent:5,left:0,right:16},Y:{width:16,height:27,ascent:22,descent:5,left:0,right:16},Z:{width:15,height:27,ascent:22,descent:5,left:0,right:14},"[":{width:7,height:27,ascent:22,descent:5,left:-2,right:6},"\\":{width:7,height:27,ascent:22,descent:5,left:0,right:7},"]":{width:7,height:27,ascent:22,descent:5,left:0,right:5},"^":{width:11,height:27,ascent:22,descent:5,left:-1,right:11},_:{width:13,height:27,ascent:22,descent:5,left:0,right:14},"`":{width:8,height:27,ascent:22,descent:5,left:-1,right:5},a:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},b:{width:13,height:27,ascent:22,descent:5,left:-2,right:12},c:{width:12,height:27,ascent:22,descent:5,left:-1,right:12},d:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},e:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},f:{width:7,height:27,ascent:22,descent:5,left:0,right:8},g:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},h:{width:13,height:27,ascent:22,descent:5,left:-2,right:12},i:{width:5,height:27,ascent:22,descent:5,left:-2,right:4},j:{width:5,height:27,ascent:22,descent:5,left:1,right:4},k:{width:12,height:27,ascent:22,descent:5,left:-2,right:12},l:{width:5,height:27,ascent:22,descent:5,left:-2,right:4},m:{width:20,height:27,ascent:22,descent:5,left:-2,right:18},n:{width:13,height:27,ascent:22,descent:5,left:-2,right:12},o:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},p:{width:13,height:27,ascent:22,descent:5,left:-2,right:12},q:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},r:{width:8,height:27,ascent:22,descent:5,left:-2,right:8},s:{width:12,height:27,ascent:22,descent:5,left:-1,right:11},t:{width:7,height:27,ascent:22,descent:5,left:0,right:6},u:{width:13,height:27,ascent:22,descent:5,left:-2,right:12},v:{width:12,height:27,ascent:22,descent:5,left:0,right:12},w:{width:17,height:27,ascent:22,descent:5,left:0,right:17},x:{width:12,height:27,ascent:22,descent:5,left:0,right:12},y:{width:12,height:27,ascent:22,descent:5,left:0,right:12},z:{width:12,height:27,ascent:22,descent:5,left:0,right:11},"{":{width:8,height:27,ascent:22,descent:5,left:-1,right:7},"|":{width:6,height:27,ascent:22,descent:5,left:-2,right:4},"}":{width:8,height:27,ascent:22,descent:5,left:-1,right:7},"~":{width:14,height:27,ascent:22,descent:5,left:-1,right:13}},TZ=t=>{if(!t)return 0;let e=0;for(const n of t){const o=tun[n];o?e+=o.width:e+=tun["?"].width}return e/27},nun=.65,oun=.08;function h_e(t){return TZ(t.text||"")+(t.display_superscript?oun+TZ(t.display_superscript)*nun:0)}function ZWe(t,e,n,o="central"){const i=[{type:"text",value:t,name:"",attributes:{},children:[]}];return e&&i.push({type:"element",name:"tspan",value:"",attributes:{class:"sch-net-label-superscript","font-size":`${n*nun}px`,dx:`${n*oun}`,dy:`${-n*(o==="ideographic"?.5:.25)}`},children:[{type:"text",value:e,name:"",attributes:{},children:[]}]}),i}var SU=t=>{switch(t){case"top":return{x:0,y:-1};case"bottom":return{x:0,y:1};case"left":return{x:1,y:0};case"right":return{x:-1,y:0}}throw new Error(`Invalid side: ${t}`)},NP=.3,QU=.3,vU=.06,iun=.2,run=t=>({"data-circuit-json-type":"schematic_net_label","data-schematic-net-label-id":t.schematic_net_label_id}),Nwi={top_left:"start",top_right:"end",middle_left:"start",middle_right:"end",bottom_left:"start",bottom_right:"end",center:"middle",middle_top:"middle",middle_bottom:"middle"},sun={top_left:"hanging",top_right:"hanging",bottom_left:"ideographic",bottom_right:"ideographic",center:"middle",middle_left:"middle",middle_right:"middle",middle_top:"hanging",middle_bottom:"ideographic"};function Rwi(t){return{left:180,top:90,bottom:-90,right:0}[t]??0}function Twi(t,e,n){const o=n+NP*2+vU*t.text.length+QU,i=SU(t.anchor_side);return t.anchor_position??{x:t.center.x-i.x*o*e/2,y:t.center.y-i.y*o*e/2}}var kwi=(t,e)=>{const n=t<0?t+2*Math.PI:t,o=e<0?e+2*Math.PI:e;let i=Math.abs(n-o);return i>Math.PI&&(i=2*Math.PI-i),i},aun=({schPorts:t,symbol:e,schComponent:n})=>{const o=t.map(a=>{const A=a.center.x-n.center.x,c=a.center.y-n.center.y;return{port:a,angle:Math.atan2(c,A)}}),i=e.ports.map(a=>{const A=a.x-e.center.x,c=a.y-e.center.y;return{port:a,angle:Math.atan2(c,A)}});o.sort((a,A)=>a.angle-A.angle),i.sort((a,A)=>a.angle-A.angle);const r=[],s=new Set;for(const a of o){let A=null;for(const c of i){if(s.has(c.port))continue;const l=kwi(a.angle,c.angle);(A===null||l<A.angleDiff)&&(A={symbolPort:c.port,angleDiff:l})}A&&A.angleDiff<Math.PI/4&&(r.push({schPort:a.port,symbolPort:A.symbolPort}),s.add(A.symbolPort))}return r};function Aun(t,e,n,o){const i=Math.sqrt((n.x-t.x)**2+(n.y-t.y)**2),s=Math.sqrt((o.x-e.x)**2+(o.y-e.y)**2)/i,a=e.x-s*t.x,A=e.y-s*t.y,c=PT(a,A),l=zWe(s,s);return pf(c,l)}function Fwi(t){const e=[],n=new Map,o=new Map;let i=null;for(const r of t)if(r.type==="schematic_component")e.push(r);else if(r.type==="schematic_port"&&r.schematic_component_id){const s=n.get(r.schematic_component_id)??[];s.push(r),n.set(r.schematic_component_id,s)}else r.type==="source_component"&&o.set(r.source_component_id,r);for(const r of e){const s=Lwi({component:r,schematicPorts:n.get(r.schematic_component_id)??[],sourceComponent:r.source_component_id?o.get(r.source_component_id):void 0});s&&(i=i?cun(i,s):s)}return i}function Lwi({component:t,schematicPorts:e,sourceComponent:n}){if(!t.symbol_name)return null;const o=Su[t.symbol_name];if(!o)return null;const i=aun({schPorts:e,symbol:o,schComponent:t});if(!i[0])return null;const r=Aun(i[1]?.symbolPort??o.center,i[1]?.schPort.center??t.center,i[0].symbolPort,i[0].schPort.center);let s=null;for(const a of o.primitives){if(a.type!=="text")continue;const A=Hwi({primitive:a,component:t,sourceComponent:n});if(!A)continue;const c=er(r,a),l=DP("reference_designator"),u=Owi({x:c.x,y:c.y,width:TZ(A)*l,height:l,anchor:a.anchor});s=s?cun(s,u):u}return s}function Hwi({primitive:t,component:e,sourceComponent:n}){return t.text==="{REF}"?n?.display_name??n?.name??"":t.text==="{VAL}"?e.symbol_display_value??"":""}function Owi({x:t,y:e,width:n,height:o,anchor:i}){let r=t,s=t,a=e-o/2,A=e+o/2;return i.includes("left")?s=t+n:i.includes("right")?r=t-n:(r=t-n/2,s=t+n/2),i.includes("top")?(a=e-o,A=e):i.includes("bottom")&&(a=e,A=e+o),{minX:r,minY:a,maxX:s,maxY:A}}function cun(t,e){return{minX:Math.min(t.minX,e.minX),minY:Math.min(t.minY,e.minY),maxX:Math.max(t.maxX,e.maxX),maxY:Math.max(t.maxY,e.maxY)}}var lun=(t,e)=>{if(t.column_widths&&t.column_widths.length>0&&t.row_heights&&t.row_heights.length>0){const l=u=>typeof u=="number"?u:u.endsWith("mm")?parseFloat(u):u.endsWith("in")?parseFloat(u)*25.4:parseFloat(u);return{column_widths:t.column_widths.map(l),row_heights:t.row_heights.map(l)}}const n=e.filter(l=>l.type==="schematic_table_cell"&&l.schematic_table_id===t.schematic_table_id);if(n.length===0)return{column_widths:[],row_heights:[]};const o=n.reduce((l,u)=>Math.max(l,u.end_column_index),-1)+1,i=n.reduce((l,u)=>Math.max(l,u.end_row_index),-1)+1,{cell_padding:r=.2}=t,s=new Array(o).fill(0),a=new Array(i).fill(0),A={},c={};for(const l of n){const u=DP("reference_designator",l.font_size),h=TZ(l.text??"")*u+2*r,d=u*1.2+2*r,p=`${l.start_row_index}-${l.start_column_index}`;A[p]=h,c[p]=d}for(let l=0;l<i;l++)for(let u=0;u<o;u++){const g=`${l}-${u}`;A[g]&&A[g]>s[u]&&(s[u]=A[g]),c[g]&&c[g]>a[l]&&(a[l]=c[g])}for(const l of n){if(l.start_column_index===l.end_column_index&&l.start_row_index===l.end_row_index)continue;const u=`${l.start_row_index}-${l.start_column_index}`,g=A[u],h=c[u];if(g===void 0||h===void 0)continue;let d=0;for(let m=l.start_column_index;m<=l.end_column_index;m++)d+=s[m];if(g>d){const _=(g-d)/(l.end_column_index-l.start_column_index+1);for(let f=l.start_column_index;f<=l.end_column_index;f++)s[f]+=_}let p=0;for(let m=l.start_row_index;m<=l.end_row_index;m++)p+=a[m];if(h>p){const _=(h-p)/(l.end_row_index-l.start_row_index+1);for(let f=l.start_row_index;f<=l.end_row_index;f++)a[f]+=_}}return{column_widths:s,row_heights:a}},Gwi=10.16,Ywi=1.1,DT=Gwi/Ywi,Uwi=297/DT,Kwi=210/DT,p_e=5/DT;function eje(t={}){const e=t.center??{x:0,y:0},n=t.sheet_width===void 0?Uwi:t.sheet_width/DT,o=t.sheet_height===void 0?Kwi:t.sheet_height/DT,i=e.x-n/2,r=e.x+n/2,s=e.y-o/2,a=e.y+o/2;return{center:e,width:n,height:o,minX:i,maxX:r,minY:s,maxY:a,innerMinX:i+p_e,innerMaxX:r-p_e,innerMinY:s+p_e,innerMaxY:a-p_e}}function Vwi(t,e=.5){let n=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;const s=.2;for(const c of t)if(c.type==="schematic_sheet"){const l=eje(c);A(l.center,{width:l.width,height:l.height},0)}else if(c.type==="schematic_component")A(c.center,c.size,0);else if(c.type==="schematic_port")A(c.center,{width:s,height:s},0);else if(c.type==="schematic_debug_object")c.shape==="rect"?A(c.center,c.size,0):c.shape==="line"&&(A(c.start,{width:.1,height:.1},0),A(c.end,{width:.1,height:.1},0));else if(c.type==="schematic_net_label"){const l=DP("net_label"),u=h_e(c),h=(u+NP*2+vU*(c.text?.length||0)+QU)*l,d=iun,p=Rwi(c.anchor_side)/180*Math.PI,m=Twi(c,l,u),_=SU(c.anchor_side),f={x:m.x+_.x*h/2,y:m.y+_.y*h/2};A(f,{width:h,height:d},p)}else if(c.type==="schematic_trace")for(const l of c.edges)A(l.from,{width:.1,height:.1},0),A(l.to,{width:.1,height:.1},0);else if(c.type==="schematic_text"){const u=DP("reference_designator",c.font_size)??.18,g=c.text??"",h=c.display_superscript;if(h){const d=g.split(`
`),p=Math.max(...d.map((x,E)=>h_e({text:x,display_superscript:E===d.length-1?h:void 0})))*u,m=c.anchor,_=m==="left"||m.endsWith("_left")?p/2:m==="right"||m.endsWith("_right")?-p/2:0,f=m==="top"||m.startsWith("top_")?0:m==="bottom"||m.startsWith("bottom_")?-u:-u/2,I=(d.length+.3)*u,C=-(f-.3*u+I/2),y=-(c.rotation??0)*Math.PI/180;A({x:c.position.x+_*Math.cos(y)-C*Math.sin(y),y:c.position.y+_*Math.sin(y)+C*Math.cos(y)},{width:p,height:I},y)}else{const d=g.length*u,p=u;A(c.position,{width:d,height:p},c.rotation??0)}}else if(c.type==="schematic_voltage_probe"){if(A(c.position,{width:.2,height:.4},0),c.name){const l=DP("net_label"),u=TZ(c.name)*l,g=l,h=.3,d=c.label_alignment??"top_right";let p=c.position.x,m=c.position.y;d.includes("top")?m+=h+g/2:d.includes("bottom")&&(m-=h+g/2),d.includes("right")?p+=h+u/2:d.includes("left")&&(p-=h+u/2),A({x:p,y:m},{width:u,height:g},0)}}else if(c.type==="schematic_box")A({x:c.x+c.width/2,y:c.y+c.height/2},{width:c.width,height:c.height},0);else if(c.type==="schematic_table"){const{column_widths:l,row_heights:u}=lun(c,t),g=l.reduce((I,C)=>I+C,0),h=u.reduce((I,C)=>I+C,0),d=c.anchor??"center";let p=c.anchor_position.x,m=c.anchor_position.y;d.includes("center")?p-=g/2:d.includes("right")&&(p-=g),d.includes("center")?m+=h/2:d.includes("bottom")&&(m+=h);const _=p+g/2,f=m-h/2;A({x:_,y:f},{width:g,height:h},0)}else if(c.type==="schematic_line")A({x:c.x1,y:c.y1},{width:.02,height:.02},0),A({x:c.x2,y:c.y2},{width:.02,height:.02},0);else if(c.type==="schematic_circle")A(c.center,{width:c.radius*2,height:c.radius*2},0);else if(c.type==="schematic_rect")A(c.center,{width:c.width,height:c.height},c.rotation);else if(c.type==="schematic_arc")A(c.center,{width:c.radius*2,height:c.radius*2},0);else if(c.type==="schematic_path"&&c.points&&c.points.length>0)for(const l of c.points)A(l,{width:.02,height:.02},0);Number.isFinite(n)||(n=-1,o=-1,i=1,r=1),n-=e,o-=e,i+=e,r+=e;const a=Fwi(t);return a&&(a.minX<n&&(n=a.minX-e),a.minY<o&&(o=a.minY-e),a.maxX>i&&(i=a.maxX+e),a.maxY>r&&(r=a.maxY+e)),{minX:n,minY:o,maxX:i,maxY:r};function A(c,l,u){const g=[{x:-l.width/2,y:-l.height/2},{x:l.width/2,y:-l.height/2},{x:l.width/2,y:l.height/2},{x:-l.width/2,y:l.height/2}];for(const h of g){const d=h.x*Math.cos(u)-h.y*Math.sin(u)+c.x,p=h.x*Math.sin(u)+h.y*Math.cos(u)+c.y;n=Math.min(n,d),o=Math.min(o,p),i=Math.max(i,d),r=Math.max(r,p)}}}function uun(t){if(t.type!=="element")throw new Error("Expected SVG root element to be of type 'element'");return t}function gun(t){return{...t,attributes:{...t.attributes??{}},children:t.children?.map(gun)??[]}}function m_e(t,e,n,o,i){const r=gun(t);return r.attributes={...r.attributes,x:f4(e),y:f4(n),width:f4(o),height:f4(i)},delete r.attributes.xmlns,r}function f4(t){return Number.isFinite(t)?Number.parseFloat(t.toFixed(6)).toString():"0"}var kZ="image/svg+xml";function zwi({schematicGraphic:t,viewport:e}){const n=Jwi(t);return{name:"g",type:"element",value:"",attributes:{class:"schematic-graphic","pointer-events":"none","data-circuit-json-type":"schematic_graphic","data-schematic-graphic-id":t.schematic_graphic_id,...t.schematic_sheet_id?{"data-schematic-sheet-id":t.schematic_sheet_id}:{}},children:[{name:"image",type:"element",value:"",attributes:{href:n,x:f4(e.x),y:f4(e.y),width:f4(e.width),height:f4(e.height),preserveAspectRatio:"xMidYMid meet",overflow:"hidden","pointer-events":"none"},children:[]}]}}function Jwi(t){const e=`Unable to render schematic graphic "${t.schematic_graphic_id}"`,{asset:n,svg_content:o}=t;if(!n){if(o!==void 0)return dun(o);throw new Error(`${e}: asset or svg_content is required`)}if(hun(n.mimetype)!==kZ)throw new Error(`${e}: asset.mimetype must be "${kZ}" (received ${JSON.stringify(n.mimetype)})`);const i=n.url.trim();if(i.toLowerCase().startsWith("data:"))return Wwi(i,e),i;if(o!==void 0)return dun(o);throw new Error(`${e}: asset.url must be an inline SVG data URL because circuit-to-svg cannot synchronously load ${JSON.stringify(n.url)}`)}function Wwi(t,e){const n=t.match(/^data:([^,]*),(.*)$/is);if(!n)throw new Error(`${e}: asset.url is not a valid SVG data URL`);const o=n[1].split(";").map(A=>A.trim());if(hun(o.shift()??"")!==kZ)throw new Error(`${e}: asset.url must use the "${kZ}" media type`);const r=n[2],s=o.findIndex(A=>A.toLowerCase()==="base64"),a=s!==-1;if(a&&s!==o.length-1)throw new Error(`${e}: asset.url must place "base64" as its final metadata token`);if(a){const A=r.replace(/\s+/g,"");if(!/^(?:[a-z\d+/]{4})*(?:[a-z\d+/]{2}==|[a-z\d+/]{3}=)?$/i.test(A))throw new Error(`${e}: asset.url is not a valid SVG data URL`);return}if(r.includes("#"))throw new Error(`${e}: asset.url must percent-encode "#" in a non-base64 SVG data URL`);try{decodeURIComponent(r)}catch(A){throw new Error(`${e}: asset.url is not a valid SVG data URL`,{cause:A})}}function dun(t){const e=new TextEncoder().encode(t);let n="";const o=32768;for(let i=0;i<e.length;i+=o)n+=String.fromCharCode(...e.subarray(i,i+o));return`data:${kZ};base64,${btoa(n)}`}function hun(t){return(t.split(";",1)[0]??"").trim().toLowerCase()}var c_=t=>Math.abs(t.a)*.02,tje=({text:t,realCenter:e,realToScreenTransform:n})=>{const o=er(n,e);return{type:"element",name:"text",value:"",attributes:{x:o.x.toString(),y:o.y.toString(),fill:"red","text-anchor":"middle","dominant-baseline":"middle","font-family":"sans-serif","font-size":`${PE(n,"error")}px`},children:[{type:"text",value:t,name:"",attributes:{},children:[]}]}},jwi=({schNetLabel:t,realToScreenTransform:e,colorMap:n})=>{if(!t.text)return[];const o=t.text.startsWith("N_"),i=o?t.text.slice(2):t.text,r=run(t),s=[],a=Su[t.symbol_name];if(!a){const O=tje({text:`Symbol not found: ${t.symbol_name}`,realCenter:t.center,realToScreenTransform:e});return O.attributes={...O.attributes,...r},s.push(O),s}const A=a.primitives.filter(O=>O.type==="path"),c=a.primitives.filter(O=>O.type==="text"),l=a.primitives.filter(O=>O.type==="circle"),u=a.primitives.filter(O=>O.type==="box"),g={minX:Math.min(...A.flatMap(O=>O.points.map(U=>U.x))),maxX:Math.max(...A.flatMap(O=>O.points.map(U=>U.x))),minY:Math.min(...A.flatMap(O=>O.points.map(U=>U.y))),maxY:Math.max(...A.flatMap(O=>O.points.map(U=>U.y)))},h=DP("net_label"),p=h_e({...t,text:i})+NP*2+vU*i.length+QU,m=SU(t.anchor_side),_=t.anchor_position??{x:t.center.x-m.x*p*h/2,y:t.center.y-m.y*p*h/2},I=z0n(0/180*Math.PI),C={minX:Math.min(...a.primitives.flatMap(O=>O.type==="path"?O.points.map(U=>U.x):[])),maxX:Math.max(...a.primitives.flatMap(O=>O.type==="path"?O.points.map(U=>U.x):[])),minY:Math.min(...a.primitives.flatMap(O=>O.type==="path"?O.points.map(U=>U.y):[])),maxY:Math.max(...a.primitives.flatMap(O=>O.type==="path"?O.points.map(U=>U.y):[]))},y=a.ports?.[0]?{x:a.ports[0].x,y:a.ports[0].y}:{x:C.minX,y:(C.minY+C.maxY)/2},x=er(I,y),E=pf(PT(_.x-x.x,_.y-x.y),I,zWe(1)),[B,S]=er(pf(e,E),[g.minX,g.minY]),[Q,w]=er(pf(e,E),[g.maxX,g.maxY]),M=Math.abs(w-S),k=Math.min(S,w),R=Math.abs(Q-B),F=Math.min(B,Q);s.push({name:"rect",type:"element",value:"",attributes:{class:"component-overlay sch-component-overlay sch-net-label-overlay",...r,x:F.toString(),y:k.toString(),width:R.toString(),height:M.toString(),fill:"transparent"},children:[]});for(const O of A){const U=O.points.map((Y,W)=>{const[te,j]=er(pf(e,E),[Y.x,Y.y]);return`${W===0?"M":"L"} ${te} ${j}`}).join(" ");s.push({name:"path",type:"element",attributes:{class:"sch-net-label-symbol-path",...r,d:U+(O.closed?" Z":""),stroke:n.schematic.component_outline,fill:"none","stroke-width":`${c_(e)}px`,"stroke-linecap":"round"},value:"",children:[]})}for(const O of c){const U=er(pf(e,E),O);let Y=O.text;Y==="{REF}"?Y=i||"":Y==="{VAL}"&&(Y=""),Math.abs(e.a);const W={x:U.x,y:U.y};s.push({name:"text",type:"element",attributes:{class:"sch-net-label-symbol-text",...r,x:W.x.toString(),y:W.y.toString(),fill:n.schematic.label_local,"font-family":"sans-serif","text-anchor":Nwi[O.anchor],"dominant-baseline":sun[O.anchor],"font-size":`${PE(e,"reference_designator")}px`,...o&&Y===i?{style:"text-decoration: overline;"}:{}},children:ZWe(Y,O.text==="{REF}"?t.display_superscript:void 0,PE(e,"reference_designator"),sun[O.anchor]),value:""})}for(const O of u){const U=er(pf(e,E),O),Y=pf(e,E).a;s.push({name:"rect",type:"element",attributes:{class:"sch-net-label-symbol-box",...r,x:U.x.toString(),y:U.y.toString(),width:(O.width*Y).toString(),height:(O.height*Y).toString(),fill:"red"},value:"",children:[]})}for(const O of l){const U=er(pf(e,E),O),Y=pf(e,E).a;s.push({name:"circle",type:"element",attributes:{class:"sch-net-label-symbol-circle",...r,cx:U.x.toString(),cy:U.y.toString(),r:(O.radius*Y).toString(),fill:"none",stroke:n.schematic.component_outline,"stroke-width":`${c_(e)}px`},value:"",children:[]})}return s},$wi=({schNetLabel:t,realToScreenTransform:e,colorMap:n})=>{if(!t.text)return[];const o=t.text;if(t.symbol_name)return jwi({schNetLabel:t,realToScreenTransform:e,colorMap:n});const i=run(t),r=[],s=PE(e,"net_label"),a=DP("net_label"),A=iun/a/2,c=h_e({...t,text:o}),l=er(e,t.center),u=SU(t.anchor_side),g={...u};g.y*=-1;const h=c+NP*2+vU*o.length+QU,d=t.anchor_position?er(e,t.anchor_position):{x:l.x-g.x*h*s/2,y:l.y-g.y*h*s/2},p=t.anchor_position??{x:t.center.x-u.x*h*a/2,y:t.center.y-u.y*h*a/2},m={left:0,top:-90,bottom:90,right:180}[t.anchor_side],_=[{x:0,y:0},{x:NP,y:A},{x:NP*2+QU+vU*o.length+c,y:A},{x:NP*2+QU+vU*o.length+c,y:-A},{x:NP,y:-A}].map(x=>er(pf(e,PT(p.x,p.y),zWe(a),z0n(m/180*Math.PI)),x)),f=`
M ${_[0].x},${_[0].y}
L ${_[1].x},${_[1].y}
L ${_[2].x},${_[2].y}
L ${_[3].x},${_[3].y}
L ${_[4].x},${_[4].y}
Z
`;r.push({name:"path",type:"element",attributes:{class:"net-label sch-net-label",...i,d:f,fill:n.schematic.label_background,stroke:n.schematic.label_global,"stroke-width":`${c_(e)}px`},value:"",children:[]});const I={x:d.x+g.x*s*.5,y:d.y+g.y*s*.5},C={left:"start",top:"start",bottom:"start",right:"end"}[t.anchor_side],y={left:"",right:"",top:`rotate(90 ${I.x} ${I.y})`,bottom:`rotate(-90 ${I.x} ${I.y})`}[t.anchor_side];return r.push({name:"text",type:"element",attributes:{class:"net-label-text sch-net-label-text",...i,x:I.x.toString(),y:I.y.toString(),fill:n.schematic.label_global,"text-anchor":C,"dominant-baseline":"central","font-family":"sans-serif","font-variant-numeric":"tabular-nums","font-size":`${s}px`,transform:y},children:ZWe(o,t.display_superscript,s),value:""}),r},qwi=.02,Xwi=({schPort:t,transform:e})=>{const n=er(e,t.center),o=Math.abs(e.a)*qwi*2;return[{name:"g",type:"element",value:"",attributes:{class:"schematic-port-hover sch-port-hover","data-schematic-port-id":t.source_port_id,...t.schematic_sheet_id?{"data-schematic-sheet-id":t.schematic_sheet_id}:{}},children:[{name:"circle",type:"element",value:"",attributes:{cx:n.x.toString(),cy:n.y.toString(),r:o.toString(),fill:"red",opacity:"0"},children:[]}]}]},Zwi=({component:t,transform:e,circuitJson:n})=>{const o=MT(n).schematic_port.list({schematic_component_id:t.schematic_component_id}),i=[];for(const r of o)i.push(...Xwi({schPort:r,transform:e}));return i},ePi=({schPort:t,transform:e,colorMap:n})=>{const{x:i,y:r}=t.center,s=[-1,1].map(a=>{const A=er(e,{x:i-.05,y:r-a*.05}),c=er(e,{x:i+.05,y:r+a*.05});return`M ${A.x} ${A.y} L ${c.x} ${c.y}`}).join(" ");return{name:"path",type:"element",value:"",attributes:{class:"sch-port-no-connect","data-schematic-port-id":t.schematic_port_id,"data-source-port-id":t.source_port_id,d:s,fill:"none",stroke:n.schematic.no_connect,"stroke-width":`${c_(e)}px`,"stroke-linecap":"round"},children:[]}},pun=.02,tPi=({schPort:t,transform:e,circuitJson:n,colorMap:o})=>{const i=[],r=Math.abs(e.a)*pun,s=Math.abs(e.a)*pun,a=er(e,t.center),A=n.find(l=>l.type==="source_port"&&l.source_port_id===t.source_port_id);A?.do_not_connect||i.push({name:"circle",type:"element",value:"",attributes:{class:"component-pin sch-component-pin sch-port-indicator",cx:a.x.toString(),cy:a.y.toString(),r:r.toString(),fill:"none",stroke:o.schematic.component_outline,"stroke-width":s.toString(),"data-schematic-port-id":t.schematic_port_id},children:[]});const c=t.display_pin_label??A?.name;if(c){const l={...t.center},u=t.distance_from_component_edge??0,g=.05;let h="middle",d="";switch(t.facing_direction){case"left":l.x+=u/2,l.y+=g,h="start";break;case"right":l.x-=u/2,l.y+=g,h="end";break;case"up":l.y-=u/2,l.x-=g,h="middle";break;case"down":l.y+=u/2,l.x-=g,h="middle";break}const p=er(e,l),m=PE(e,"pin_number");(t.facing_direction==="up"||t.facing_direction==="down")&&(d=`rotate(-90 ${p.x} ${p.y})`),i.push({name:"text",type:"element",value:"",attributes:{class:"port-indicator-label sch-port-label",x:p.x.toString(),y:p.y.toString(),fill:o.schematic.component_outline,"font-family":"sans-serif","font-size":`${m*.7}px`,"text-anchor":h,"dominant-baseline":"middle",...d&&{transform:d}},children:[{type:"text",value:c,name:"",attributes:{},children:[]}]})}return i},mun=t=>({type:"element",name:"tspan",value:"",attributes:t.is_overlined?{"text-decoration":"overline"}:{},children:[{type:"text",name:"",value:t.text,attributes:{},children:[]}]}),nPi=t=>t.filter(e=>e.text).map(mun),oPi=t=>{const e=[[]];for(const n of t)n.text.split(`
`).forEach((o,i)=>{i>0&&e.push([]),o&&e.at(-1).push(mun({...n,text:o}))});return e},nje=({elm:t,transform:e,colorMap:n})=>{const o=er(e,t.position),i={center:"middle",center_right:"end",bottom_left:"start",bottom_center:"middle",bottom_right:"end",left:"start",right:"end",top:"middle",bottom:"middle",top_left:"start",top_center:"middle",top_right:"end",center_left:"start"},r={center:"middle",center_right:"middle",bottom_left:"ideographic",bottom_center:"ideographic",bottom_right:"ideographic",left:"middle",right:"middle",top:"hanging",bottom:"ideographic",top_left:"hanging",top_center:"hanging",top_right:"hanging",center_left:"middle"},s=t.text.split(`
`),a=oPi(t.text_parts??[]),A=s.length===1?t.text_parts?.length?a[0]:[{type:"text",value:t.text,name:t.schematic_text_id,attributes:{},children:[]}]:s.map((c,l)=>({type:"element",name:"tspan",value:"",attributes:{x:o.x.toString(),...l>0?{dy:"1em"}:{}},children:t.text_parts?.length?a[l]??[]:[{type:"text",value:c,name:l===0?t.schematic_text_id:"",attributes:{},children:[]}]}));return t.display_superscript&&(s.length===1?A:A[A.length-1].children).push(...ZWe("",t.display_superscript,PE(e,"reference_designator",t.font_size),r[t.anchor]).slice(1)),{type:"element",name:"text",value:"",attributes:{class:"sch-text","data-schematic-text-id":t.schematic_text_id,x:o.x.toString(),y:o.y.toString(),fill:t.color??n.schematic.sheet_label,"text-anchor":i[t.anchor],"dominant-baseline":r[t.anchor],"font-family":"sans-serif","font-size":`${PE(e,"reference_designator",t.font_size)}px`,transform:`rotate(${t.rotation}, ${o.x}, ${o.y})`},children:A}};function _un({schArc:t,transform:e,colorMap:n}){const o=er(e,t.center),i=Math.abs(e.a)*t.radius,r=t.stroke_width??.02,s=Math.abs(e.a)*r,a=t.start_angle_degrees*Math.PI/180,A=t.end_angle_degrees*Math.PI/180,c=o.x+i*Math.cos(a),l=o.y+i*Math.sin(a),u=o.x+i*Math.cos(A),g=o.y+i*Math.sin(A);let h=t.end_angle_degrees-t.start_angle_degrees;t.direction==="clockwise"&&(h=-h),h<0&&(h+=360);const d=h>180?1:0,p=t.direction==="clockwise"?1:0;return[{name:"path",type:"element",attributes:{class:"sch-arc",d:`M ${c} ${l} A ${i} ${i} 0 ${d} ${p} ${u} ${g}`,fill:"none",stroke:t.color,"stroke-width":s.toString(),...t.is_dashed&&{"stroke-dasharray":(s*3).toString()},"data-schematic-arc-id":t.schematic_arc_id,...t.schematic_component_id&&{"data-schematic-component-id":t.schematic_component_id}},children:[],value:""}]}var iPi=({schematicBox:t,transform:e,colorMap:n})=>{const o=er(e,{x:t.x,y:t.y}),i=er(e,{x:t.x+t.width,y:t.y+t.height}),r=Math.min(o.y,i.y),s=Math.max(o.y,i.y),a=Math.min(o.x,i.x),A=Math.max(o.x,i.x),c=c_(e),l={class:"schematic-box sch-box",x:a.toString(),y:r.toString(),width:(A-a).toString(),height:(s-r).toString(),"stroke-width":`${c}px`,stroke:n.schematic.component_outline||"black",fill:"transparent"};if(t.is_dashed){const u=8*c,g=4*c;l["stroke-dasharray"]=`${u} ${g}`}return[{name:"rect",type:"element",value:"",attributes:l,children:[]}]};function fun({schCircle:t,transform:e,colorMap:n}){const o=er(e,t.center),i=Math.abs(e.a)*t.radius,r=t.stroke_width??.02,s=Math.abs(e.a)*r;return[{name:"circle",type:"element",attributes:{class:"sch-circle",cx:o.x.toString(),cy:o.y.toString(),r:i.toString(),fill:t.is_filled?t.fill_color??t.color:"none",stroke:t.color,"stroke-width":s.toString(),...t.is_dashed&&{"stroke-dasharray":(s*3).toString()},"data-schematic-circle-id":t.schematic_circle_id,...t.schematic_component_id&&{"data-schematic-component-id":t.schematic_component_id}},children:[],value:""}]}var Iun=(t,e)=>{for(const n of t){if(n.type!=="source_trace")continue;const o=n;if(Array.isArray(o.connected_source_port_ids)&&o.connected_source_port_ids.includes(e))return!0}return!1},rPi={top_left:"start",top_right:"end",middle_left:"start",middle_right:"end",bottom_left:"start",bottom_right:"end",center:"middle",middle_top:"middle",middle_bottom:"middle"},sPi={top_left:"hanging",top_right:"hanging",bottom_left:"ideographic",bottom_right:"ideographic",center:"middle",middle_left:"middle",middle_right:"middle",middle_top:"hanging",middle_bottom:"ideographic"},aPi=({component:t,transform:e,circuitJson:n,colorMap:o})=>{const i=[],r=Su[t.symbol_name];if(!r)return[tje({text:`Symbol not found: ${t.symbol_name}`,realCenter:t.center,realToScreenTransform:e})];const s=MT(n).schematic_port.list({schematic_component_id:t.schematic_component_id}),a=MT(n).source_component.get(t.source_component_id),A=aun({schPorts:s,symbol:r,schComponent:t});if(!A[0])return[tje({text:`Could not match ports for symbol ${t.symbol_name}`,realCenter:t.center,realToScreenTransform:e})];const c=Aun(A[1]?.symbolPort??r.center,A[1]?.schPort.center??t.center,A[0].symbolPort,A[0].schPort.center),l=r.primitives.filter(B=>B.type==="path"),u=r.primitives.filter(B=>B.type==="text"),g=r.primitives.filter(B=>B.type==="circle"),h=r.primitives.filter(B=>B.type==="box"),d=new Set;for(const B of A)(Iun(n,B.schPort.source_port_id)||MT(n).source_port.get(B.schPort.source_port_id)?.do_not_connect)&&d.add(B.symbolPort);const p={minX:Math.min(...l.flatMap(B=>B.points.map(S=>S.x))),maxX:Math.max(...l.flatMap(B=>B.points.map(S=>S.x))),minY:Math.min(...l.flatMap(B=>B.points.map(S=>S.y))),maxY:Math.max(...l.flatMap(B=>B.points.map(S=>S.y)))},[m,_]=er(pf(e,c),[p.minX,p.minY]),[f,I]=er(pf(e,c),[p.maxX,p.maxY]),C=Math.abs(I-_),y=Math.min(_,I),x=Math.abs(f-m),E=Math.min(m,f);i.push({name:"rect",type:"element",value:"",attributes:{class:"component-overlay sch-component-overlay",x:E.toString(),y:y.toString(),width:x.toString(),height:C.toString(),fill:"transparent"},children:[]});for(const B of l){const{points:S,color:Q,closed:w,fill:M}=B;i.push({type:"element",name:"path",attributes:{class:"sch-component-symbol-path",d:S.map((k,R)=>{const[F,O]=er(pf(e,c),[k.x,k.y]);return`${R===0?"M":"L"} ${F} ${O}`}).join(" ")+(w?" Z":""),stroke:o.schematic.component_outline,fill:"none","stroke-width":`${c_(e)}px`,"stroke-linecap":"round"},value:"",children:[]})}for(const B of u){const S=er(pf(e,c),B);let Q="";const w=B.text==="{REF}";w?Q=a?.display_name??a?.name??"":B.text==="{VAL}"&&(Q=t.symbol_display_value??"");const M=sPi[B.anchor];i.push({name:"text",type:"element",attributes:{class:w?"sch-component-name sch-component-text":"sch-component-text",x:S.x.toString(),y:S.y.toString(),...w?{stroke:o.schematic.background,"stroke-width":`${c_(e)}px`,"paint-order":"stroke"}:{},fill:o.schematic.label_local,"font-family":"sans-serif","text-anchor":rPi[B.anchor],"dominant-baseline":M,"font-size":`${PE(e,"reference_designator")}px`},value:"",children:[{type:"text",value:Q,name:"",attributes:{},children:[]}]})}for(const B of h){const S=er(pf(e,c),B),Q=pf(e,c).a;i.push({name:"rect",type:"element",attributes:{class:"sch-component-symbol-box",x:S.x.toString(),y:S.y.toString(),width:(B.width*Q).toString(),height:(B.height*Q).toString(),fill:"red"},value:"",children:[]})}for(const B of r.ports){if(d.has(B))continue;const S=er(pf(e,c),B);i.push({type:"element",name:"circle",attributes:{class:"component-pin sch-component-pin",cx:S.x.toString(),cy:S.y.toString(),r:`${Math.abs(e.a)*.02}px`,"stroke-width":`${c_(e)}px`,fill:"none",stroke:o.schematic.component_outline},value:"",children:[]})}for(const B of g){const S=er(pf(e,c),B),Q=Math.abs(B.radius*e.a);i.push({type:"element",name:"circle",attributes:{class:"sch-component-symbol-circle",cx:S.x.toString(),cy:S.y.toString(),r:`${Q}px`,"stroke-width":`${c_(e)}px`,fill:"none",stroke:o.schematic.component_outline},value:"",children:[]})}return i},FZ=.02,Cun=(t,e,n,o,i)=>{const r=Math.PI/6,s={x:t.x-n*Math.cos(e-r),y:t.y-n*Math.sin(e-r)},a={x:t.x-n*Math.cos(e+r),y:t.y-n*Math.sin(e+r)};return{name:"polygon",type:"element",attributes:{points:`${t.x},${t.y} ${s.x},${s.y} ${a.x},${a.y}`,fill:"white",stroke:o,"stroke-width":`${i}px`},value:"",children:[]}},APi=({schPort:t,schComponent:e,transform:n,circuitJson:o})=>{const i=[],r=MT(o).source_port.get(t.source_port_id),s={x:t.center.x,y:t.center.y},a=t.distance_from_component_edge??.4;switch(t.side_of_component){case"left":s.x+=a;break;case"right":s.x-=a;break;case"top":s.y-=a;break;case"bottom":s.y+=a;break}const A=er(n,t.center),c=er(n,s),l=r!=null&&r.source_component_id==null&&typeof t.is_connected=="boolean"?t.is_connected:Iun(o,t.source_port_id),u=t.is_drawn_with_inversion_circle??!1,g=.06,h={...t.center};if(!l&&!r?.do_not_connect)switch(t.side_of_component){case"left":h.x+=FZ;break;case"right":h.x-=FZ;break;case"top":h.y-=FZ;break;case"bottom":h.y+=FZ;break}const d=er(n,h);if(u){const I=Math.abs(n.a)*g,C={...c};switch(t.side_of_component){case"left":C.x-=I,c.x-=I*2;break;case"right":C.x+=I,c.x+=I*2;break;case"top":C.y-=I,c.y-=I*2;break;case"bottom":C.y+=I,c.y+=I*2;break}i.push({name:"circle",type:"element",attributes:{class:"component-pin sch-component-pin sch-inversion-bubble",cx:C.x.toString(),cy:C.y.toString(),r:I.toString(),fill:"white",stroke:$h.schematic.component_outline,"stroke-width":`${c_(n)}px`},value:"",children:[]})}i.push({name:"line",type:"element",attributes:{class:"component-pin sch-component-pin sch-port-line",x1:c.x.toString(),y1:c.y.toString(),x2:d.x.toString(),y2:d.y.toString(),"stroke-width":`${c_(n)}px`},value:"",children:[]});const p=Math.abs(n.a)*FZ,m=[];!l&&!r?.do_not_connect&&m.push({name:"circle",type:"element",attributes:{class:"component-pin sch-component-pin sch-port-terminal",cx:A.x.toString(),cy:A.y.toString(),r:p.toString(),"stroke-width":`${c_(n)}px`},value:"",children:[]}),m.push({name:"rect",type:"element",attributes:{x:(A.x-p).toString(),y:(A.y-p).toString(),width:(p*2).toString(),height:(p*2).toString(),opacity:"0"},value:"",children:[]}),i.push({name:"g",type:"element",value:"",attributes:{class:"sch-port","data-schematic-port-id":t.source_port_id},children:m});const{has_input_arrow:_,has_output_arrow:f}=t;if((_||f)&&t.side_of_component){const I=Math.abs(n.a)*.1,C=$h.schematic.component_outline,y=I*Math.cos(Math.PI/6),x=c_(n)/3;let E=0,B=0;t.side_of_component==="left"?(E=0,B=Math.PI):t.side_of_component==="right"?(E=Math.PI,B=0):t.side_of_component==="top"?(E=Math.PI/2,B=-Math.PI/2):t.side_of_component==="bottom"&&(E=-Math.PI/2,B=Math.PI/2);const S=_&&f;let Q={...c},w={...c};if(S){const M=y;t.side_of_component==="left"?w.x-=M:t.side_of_component==="right"?w.x+=M:t.side_of_component==="top"?w.y-=M:t.side_of_component==="bottom"&&(w.y+=M)}if(_&&i.push(Cun(Q,E,I,C,x)),f){const M={x:w.x+I*Math.cos(B),y:w.y+I*Math.sin(B)};i.push(Cun(M,B,I,C,x))}}return i},cPi=t=>{const e=[],{schPort:n,transform:o}=t,i={x:n.center.x,y:n.center.y};if(!n.side_of_component)return[];const r=SU(n.side_of_component),s=n.distance_from_component_edge??.4;i.x+=r.x*s/2,i.y+=r.y*s/2,n.side_of_component==="top"||n.side_of_component==="bottom"?i.x-=.02:i.y+=.02;const a=er(o,i);return e.push({name:"text",type:"element",attributes:{class:"pin-number sch-pin-number",x:a.x.toString(),y:a.y.toString(),style:"font-family: sans-serif;",fill:$h.schematic.pin_number,"text-anchor":"middle","dominant-baseline":"auto","font-size":`${PE(o,"pin_number")}px`,transform:n.side_of_component==="top"||n.side_of_component==="bottom"?`rotate(-90 ${a.x} ${a.y})`:""},children:[{type:"text",value:n.pin_number?.toString()||"",name:"",attributes:{},children:[]}],value:""}),e},yun=.1,xun=t=>{const e=[],{schPort:n,schComponent:o,transform:i,labelColor:r=$h.schematic.pin_number,labelClassName:s="pin-number sch-pin-label"}=t,a={x:n.center.x,y:n.center.y};if(!n.side_of_component)return[];const A=SU(n.side_of_component),c=n.distance_from_component_edge??.4;a.x+=A.x*(c+yun),a.y+=A.y*(c+yun);const l=er(i,a),u=n.display_pin_label??o.port_labels?.[`${n.pin_number}`];if(!u)return[];const g=u.startsWith("N_"),h=g?u.slice(2):u,d=n.display_pin_label_text_parts,p=n.is_drawn_with_inversion_circle??!1,m=PE(i,g||p?"negated_pin_number":"pin_number",n.display_pin_label_font_size);return e.push({name:"text",type:"element",attributes:{class:s,x:l.x.toString(),y:l.y.toString(),style:`font-family: sans-serif;${g&&!d?.length?" text-decoration: overline;":""}`,fill:r,"text-anchor":n.side_of_component==="left"||n.side_of_component==="bottom"?"start":"end","dominant-baseline":"middle","font-size":`${m}px`,transform:n.side_of_component==="top"||n.side_of_component==="bottom"?`rotate(-90 ${l.x} ${l.y})`:""},children:d?.length?nPi(d):[{type:"text",value:h||"",name:"",attributes:{},children:[]}],value:""}),e},lPi=t=>{const e=[];return e.push(...APi(t)),e.push(...cPi(t)),e.push(...xun(t)),e},uPi=({component:t,transform:e,circuitJson:n,colorMap:o})=>{const i=[],r=er(e,{x:t.center.x-t.size.width/2,y:t.center.y+t.size.height/2}),s=er(e,{x:t.center.x+t.size.width/2,y:t.center.y-t.size.height/2}),a=s.x-r.x,A=s.y-r.y;i.push({name:"rect",type:"element",value:"",attributes:{class:"component chip sch-component-body",x:r.x.toString(),y:r.y.toString(),width:a.toString(),height:A.toString(),"stroke-width":`${c_(e)}px`,fill:o.schematic.component_body,stroke:o.schematic.component_outline},children:[]}),i.push({name:"rect",type:"element",value:"",attributes:{class:"component-overlay sch-component-overlay",x:r.x.toString(),y:r.y.toString(),width:a.toString(),height:A.toString(),fill:"transparent"},children:[]});const c=MT(n).schematic_text.list();for(const u of c)u.schematic_component_id===t.schematic_component_id&&i.push(nje({elm:u,transform:e,colorMap:o}));const l=MT(n).schematic_port.list({schematic_component_id:t.schematic_component_id});for(const u of l)i.push(...lPi({schPort:u,schComponent:t,transform:e,circuitJson:n}));return i};function Eun({isDashed:t,dashLength:e,dashGap:n,strokeWidth:o,transform:i}){if(!t)return;const r=Math.abs(i.a),s=o*r*3,a=e!==void 0?e*r:s,A=n!==void 0?n*r:s;return`${a} ${A}`}function Bun({schLine:t,transform:e,colorMap:n}){const o=er(e,{x:t.x1,y:t.y1}),i=er(e,{x:t.x2,y:t.y2}),r=t.stroke_width??.02,s=Math.abs(e.a)*r,a=Eun({isDashed:t.is_dashed,dashLength:t.dash_length,dashGap:t.dash_gap,strokeWidth:r,transform:e});return[{name:"line",type:"element",attributes:{class:"sch-line",x1:o.x.toString(),y1:o.y.toString(),x2:i.x.toString(),y2:i.y.toString(),stroke:t.color,"stroke-width":s.toString(),...a&&{"stroke-dasharray":a},"data-schematic-line-id":t.schematic_line_id,...t.schematic_component_id&&{"data-schematic-component-id":t.schematic_component_id}},children:[],value:""}]}function bun({schRect:t,transform:e,colorMap:n}){const o=er(e,t.center),i=Math.abs(e.a)*t.width,r=Math.abs(e.d)*t.height,s=t.stroke_width??.02,a=Math.abs(e.a)*s,A=o.x-i/2,c=o.y-r/2;return[{name:"rect",type:"element",attributes:{class:"sch-rect",x:A.toString(),y:c.toString(),width:i.toString(),height:r.toString(),fill:t.is_filled?t.fill_color??t.color:"none",stroke:t.color,"stroke-width":a.toString(),...t.is_dashed&&{"stroke-dasharray":(a*3).toString()},...t.rotation!==0&&{transform:`rotate(${t.rotation} ${o.x} ${o.y})`},"data-schematic-rect-id":t.schematic_rect_id,...t.schematic_component_id&&{"data-schematic-component-id":t.schematic_component_id}},children:[],value:""}]}function Sun({schPath:t,transform:e,colorMap:n}){const o=t.stroke_color??n.schematic.component_outline,i=t.fill_color??"none",r=t.stroke_width??.02,s=Math.abs(e.a)*r,a=Eun({isDashed:t.is_dashed,dashLength:t.dash_length,dashGap:t.dash_gap,strokeWidth:r,transform:e});return!t.points||t.points.length<2?[]:[{name:"path",type:"element",attributes:{class:"sch-path",d:t.points.map(l=>er(e,{x:l.x,y:l.y})).map((l,u)=>`${u===0?"M":"L"} ${l.x} ${l.y}`).join(" "),stroke:o,"stroke-width":s.toString(),fill:t.is_filled?i:"none","stroke-linecap":"round","stroke-linejoin":"round",...a&&{"stroke-dasharray":a},...t.schematic_component_id&&{"data-schematic-component-id":t.schematic_component_id}},children:[],value:""}]}var gPi=({component:t,transform:e,circuitJson:n,colorMap:o})=>{const i=[],r=t.schematic_component_id;for(const s of n)!("schematic_component_id"in s)||s.schematic_component_id!==r||(s.type==="schematic_text"&&t.is_box_with_pins===!1?i.push(nje({elm:s,transform:e,colorMap:o})):s.type==="schematic_line"?i.push(...Bun({schLine:s,transform:e,colorMap:o})):s.type==="schematic_circle"?i.push(...fun({schCircle:s,transform:e,colorMap:o})):s.type==="schematic_rect"?i.push(...bun({schRect:s,transform:e,colorMap:o})):s.type==="schematic_arc"?i.push(..._un({schArc:s,transform:e,colorMap:o})):s.type==="schematic_path"&&i.push(...Sun({schPath:s,transform:e,colorMap:o})));if(t.is_box_with_pins===!1){const s=n.filter(A=>A.type==="schematic_line"&&A.schematic_component_id===r),a=n.filter(A=>A.type==="schematic_port"&&A.schematic_component_id===r);for(const A of a){const c=s.find(p=>p.x1===A.center.x&&p.y1===A.center.y||p.x2===A.center.x&&p.y2===A.center.y);if(!c)continue;const l=c.x1===A.center.x&&c.y1===A.center.y?{x:c.x2,y:c.y2}:{x:c.x1,y:c.y1},u=l.x-A.center.x,g=l.y-A.center.y,h=Math.abs(u)>Math.abs(g)?u>0?"left":"right":g>0?"bottom":"top",d=Math.max(Math.abs(u),Math.abs(g));i.push(...xun({schPort:{...A,side_of_component:h,distance_from_component_edge:d},schComponent:t,transform:e,labelClassName:"port-label sch-pin-label",labelColor:o.schematic.pin_name}))}}return i};function dPi(t){const{component:e}=t;let n=[];e.is_box_with_pins!==!1&&(e.symbol_name?n=aPi(t):n=uPi(t));const o=gPi(t),i=[...n,...o];return[{type:"element",name:"g",attributes:{class:"sch-component","data-circuit-json-type":"schematic_component","data-schematic-component-id":e.schematic_component_id,...e.schematic_sheet_id?{"data-schematic-sheet-id":e.schematic_sheet_id}:{}},children:i,value:""}]}function hPi({debugObject:t,transform:e}){if(t.shape==="rect"){let[n,o]=er(e,[t.center.x-t.size.width/2,t.center.y-t.size.height/2]),[i,r]=er(e,[t.center.x+t.size.width/2,t.center.y+t.size.height/2]);[o,r]=[Math.min(o,r),Math.max(o,r)];const s=Math.abs(i-n),a=Math.abs(r-o),[A,c]=er(e,[t.center.x,t.center.y]);return[{name:"rect",type:"element",value:"",attributes:{x:n.toString(),y:o.toString(),width:s.toString(),height:a.toString(),fill:"none",stroke:"red","stroke-width":(.02*Math.abs(e.a)).toString(),"stroke-dasharray":"5,5"},children:t.label?[{name:"text",type:"element",value:"",attributes:{x:A.toString(),y:(c-10).toString(),"text-anchor":"middle","font-size":(.2*Math.abs(e.a)).toString(),fill:"red"},children:[{type:"text",value:t.label,name:"",attributes:{},children:[]}]}]:[]}]}if(t.shape==="line"){const[n,o]=er(e,[t.start.x,t.start.y]),[i,r]=er(e,[t.end.x,t.end.y]),s=(n+i)/2,a=(o+r)/2;return[{name:"line",type:"element",value:"",attributes:{x1:n.toString(),y1:o.toString(),x2:i.toString(),y2:r.toString(),stroke:"red","stroke-width":(.02*Math.abs(e.a)).toString(),"stroke-dasharray":"5,5"},children:t.label?[{name:"text",type:"element",value:"",attributes:{x:s.toString(),y:(a-10).toString(),"text-anchor":"middle","font-size":(.2*Math.abs(e.a)).toString(),fill:"red"},children:[{type:"text",value:t.label,name:"",attributes:{},children:[]}]}]:[]}]}return[]}var Qun=.2/DT,pPi=3/DT,__e=["1","2","3","4","5","6"],LZ=["A","B","C","D"];function mPi({schematicSheet:t,transform:e,colorMap:n}){const o=eje(t),i=n.schematic.sheet,r=n.schematic.net_name,s=[vun({id:`${t.schematic_sheet_id}_outer`,center:o.center,width:o.width,height:o.height,transform:e,color:i}),vun({id:`${t.schematic_sheet_id}_inner`,center:o.center,width:o.innerMaxX-o.innerMinX,height:o.innerMaxY-o.innerMinY,transform:e,color:i})];for(let a=1;a<__e.length;a++){const A=o.innerMinX+(o.innerMaxX-o.innerMinX)*a/__e.length;s.push(f_e({id:`${t.schematic_sheet_id}_top_column_${a}`,x1:A,y1:o.maxY,x2:A,y2:o.innerMaxY,transform:e,color:i}),f_e({id:`${t.schematic_sheet_id}_bottom_column_${a}`,x1:A,y1:o.minY,x2:A,y2:o.innerMinY,transform:e,color:i}))}for(let a=1;a<LZ.length;a++){const A=o.innerMinY+(o.innerMaxY-o.innerMinY)*a/LZ.length;s.push(f_e({id:`${t.schematic_sheet_id}_left_row_${a}`,x1:o.minX,y1:A,x2:o.innerMinX,y2:A,transform:e,color:i}),f_e({id:`${t.schematic_sheet_id}_right_row_${a}`,x1:o.maxX,y1:A,x2:o.innerMaxX,y2:A,transform:e,color:i}))}return __e.forEach((a,A)=>{const c=o.innerMinX+(o.innerMaxX-o.innerMinX)*(A+.5)/__e.length;s.push(I_e({text:a,x:c,y:(o.maxY+o.innerMaxY)/2,transform:e,color:r}),I_e({text:a,x:c,y:(o.minY+o.innerMinY)/2,transform:e,color:r}))}),LZ.forEach((a,A)=>{const c=o.innerMinY+(o.innerMaxY-o.innerMinY)*(LZ.length-A-.5)/LZ.length;s.push(I_e({text:a,x:(o.minX+o.innerMinX)/2,y:c,transform:e,color:r}),I_e({text:a,x:(o.maxX+o.innerMaxX)/2,y:c,transform:e,color:r}))}),[{name:"g",type:"element",value:"",attributes:{class:"schematic-sheet","data-circuit-json-type":"schematic_sheet","data-schematic-sheet-id":t.schematic_sheet_id},children:s}]}function vun({id:t,center:e,width:n,height:o,transform:i,color:r}){const s=er(i,e),a=Math.abs(i.a)*n,A=Math.abs(i.d)*o;return{name:"rect",type:"element",value:"",attributes:{class:"sch-rect",x:(s.x-a/2).toString(),y:(s.y-A/2).toString(),width:a.toString(),height:A.toString(),fill:"none",stroke:r,"stroke-width":(Math.abs(i.a)*Qun).toString(),"data-schematic-rect-id":t},children:[]}}function f_e({id:t,x1:e,y1:n,x2:o,y2:i,transform:r,color:s}){const a=er(r,{x:e,y:n}),A=er(r,{x:o,y:i});return{name:"line",type:"element",value:"",attributes:{class:"sch-line",x1:a.x.toString(),y1:a.y.toString(),x2:A.x.toString(),y2:A.y.toString(),stroke:s,"stroke-width":(Math.abs(r.a)*Qun).toString(),"data-schematic-line-id":t},children:[]}}function I_e({text:t,x:e,y:n,transform:o,color:i}){const r=er(o,{x:e,y:n});return{type:"element",name:"text",value:"",attributes:{class:"sch-text",x:r.x.toString(),y:r.y.toString(),fill:i,"text-anchor":"middle","dominant-baseline":"middle","font-family":"sans-serif","font-size":`${PE(o,"reference_designator",pPi)}px`,transform:`rotate(0, ${r.x}, ${r.y})`},children:[{type:"text",value:t,name:"",attributes:{},children:[]}]}}var _Pi=({schematicTable:t,transform:e,colorMap:n,circuitJson:o})=>{const{anchor_position:i,border_width:r=.05,anchor:s="center"}=t,{column_widths:a,row_heights:A}=lun(t,o),c=a.reduce((E,B)=>E+B,0),l=A.reduce((E,B)=>E+B,0);let u=i.x,g=i.y;s.includes("center")?u-=c/2:s.includes("right")&&(u-=c),s.includes("center")?g+=l/2:s.includes("bottom")&&(g+=l);const h=[],d=r*Math.abs(e.a),p=c_(e),[m,_]=er(e,[u,g]),[f,I]=er(e,[u+c,g-l]);h.push({name:"rect",type:"element",attributes:{class:"sch-table-border",x:m.toString(),y:_.toString(),width:(f-m).toString(),height:(I-_).toString(),fill:"none",stroke:n.schematic.table,"stroke-width":d.toString()},children:[],value:""});const C=o.filter(E=>E.type==="schematic_table_cell"&&E.schematic_table_id===t.schematic_table_id);let y=u;for(let E=0;E<a.length-1;E++){y+=a[E];let B=g;for(let S=0;S<A.length;S++){const Q=B-A[S];if(!C.some(M=>M.start_column_index<=E&&M.end_column_index>E&&M.start_row_index<=S&&M.end_row_index>=S)){const M=er(e,{x:y,y:B}),k=er(e,{x:y,y:Q});h.push({name:"line",type:"element",attributes:{class:"sch-table-grid-line",x1:M.x.toString(),y1:M.y.toString(),x2:k.x.toString(),y2:k.y.toString(),stroke:n.schematic.table,"stroke-width":p.toString()},children:[],value:""})}B=Q}}let x=g;for(let E=0;E<A.length-1;E++){x-=A[E];let B=u;for(let S=0;S<a.length;S++){const Q=B+a[S];if(!C.some(M=>M.start_row_index<=E&&M.end_row_index>E&&M.start_column_index<=S&&M.end_column_index>=S)){const M=er(e,{x:B,y:x}),k=er(e,{x:Q,y:x});h.push({name:"line",type:"element",attributes:{class:"sch-table-grid-line",x1:M.x.toString(),y1:M.y.toString(),x2:k.x.toString(),y2:k.y.toString(),stroke:n.schematic.table,"stroke-width":p.toString()},children:[],value:""})}B=Q}}for(const E of C)if(E.text){const B=a.slice(E.start_column_index,E.end_column_index+1).reduce((te,j)=>te+j,0),S=A.slice(E.start_row_index,E.end_row_index+1).reduce((te,j)=>te+j,0),Q=u+a.slice(0,E.start_column_index).reduce((te,j)=>te+j,0),w=g-A.slice(0,E.start_row_index).reduce((te,j)=>te+j,0),{cell_padding:M=.2}=t,k=E.horizontal_align??"center",R=E.vertical_align??"middle";let F={x:Q+B/2,y:w-S/2};k==="left"?F.x=Q+M:k==="right"&&(F.x=Q+B-M),R==="top"?F.y=w-M:R==="bottom"&&(F.y=w-S+M);const O=er(e,F),U=PE(e,"reference_designator",E.font_size),Y={left:"start",center:"middle",right:"end"},W={top:"hanging",middle:"middle",bottom:"ideographic"};h.push({name:"text",type:"element",attributes:{class:"sch-table-text",x:O.x.toString(),y:O.y.toString(),"font-size":`${U}px`,"text-anchor":Y[k],"dominant-baseline":W[R],fill:n.schematic.table,"font-family":"sans-serif"},children:[{type:"text",value:E.text,name:"",attributes:{},children:[]}],value:""})}return[{name:"g",type:"element",attributes:{class:"sch-table","data-schematic-table-id":t.schematic_table_id},children:h,value:""}]};function fPi({trace:t,transform:e,colorMap:n}){const o=t.edges;if(o.length===0)return[];const i=[],r=[];let s="";for(let a=0;a<o.length;a++){const A=o[a];if(A.is_crossing)continue;const[c,l]=er(e,[A.from.x,A.from.y]),[u,g]=er(e,[A.to.x,A.to.y]);a===0||o[a-1]?.is_crossing?s+=`M ${c} ${l} L ${u} ${g}`:s+=` L ${u} ${g}`}s&&(i.push({name:"path",type:"element",attributes:{d:s,class:"trace-invisible-hover-outline sch-trace-hitbox",stroke:n.schematic.wire,fill:"none","stroke-width":`${c_(e)*8}px`,"stroke-linecap":"round",opacity:"0","stroke-linejoin":"round"},value:"",children:[]}),i.push({name:"path",type:"element",attributes:{class:"sch-trace-path",d:s,stroke:n.schematic.wire,fill:"none","stroke-width":`${c_(e)}px`,"stroke-linecap":"round","stroke-linejoin":"round"},value:"",children:[]}));for(const a of o){if(!a.is_crossing)continue;const[A,c]=er(e,[a.from.x,a.from.y]),[l,u]=er(e,[a.to.x,a.to.y]),g=(A+l)/2,h=(c+u)/2,d=l-A,p=u-c,m=Math.sqrt(d*d+p*p),_=m*.7,f=-p/m*_,I=d/m*_,C=g+f,y=h-Math.abs(I);r.push({name:"path",type:"element",attributes:{class:"trace-crossing-outline sch-trace-crossing-outline",d:`M ${A} ${c} Q ${C} ${y} ${l} ${u}`,stroke:n.schematic.background,fill:"none","stroke-width":`${c_(e)*1.5}px`,"stroke-linecap":"butt"},value:"",children:[]}),r.push({name:"path",type:"element",attributes:{class:"sch-trace-crossing-path",d:`M ${A} ${c} Q ${C} ${y} ${l} ${u}`,stroke:n.schematic.wire,fill:"none","stroke-width":`${c_(e)}px`,"stroke-linecap":"round"},value:"",children:[]})}if(t.junctions)for(const a of t.junctions){const[A,c]=er(e,[a.x,a.y]);r.push({name:"circle",type:"element",attributes:{cx:A.toString(),cy:c.toString(),r:(Math.abs(e.a)*.03).toString(),class:"trace-junction sch-trace-junction",fill:n.schematic.junction},value:"",children:[]})}return[{name:"g",type:"element",value:"",attributes:{class:"trace sch-trace","data-layer":"base","data-circuit-json-type":"schematic_trace","data-schematic-trace-id":t.schematic_trace_id,...t.subcircuit_connectivity_map_key&&{"data-subcircuit-connectivity-map-key":t.subcircuit_connectivity_map_key}},children:i},{name:"g",type:"element",value:"",attributes:{class:"trace-overlays sch-trace-overlays","data-layer":"overlay","data-circuit-json-type":"schematic_trace","data-schematic-trace-id":t.schematic_trace_id,...t.subcircuit_connectivity_map_key&&{"data-subcircuit-connectivity-map-key":t.subcircuit_connectivity_map_key}},children:r}]}function IPi({probe:t,transform:e,colorMap:n,fallbackColor:o}){const[i,r]=er(e,[t.position.x,t.position.y]),s=t.color??o??n.schematic.reference,a=Math.abs(e.a)*.6,A=Math.abs(e.a)*.28,c=t.label_alignment??"top_right";let l,u,g,h;switch(c){case"top_left":l=-135*Math.PI/180,u="end",g=-8,h=-8;break;case"top_center":l=-90*Math.PI/180,u="middle",g=0,h=-8;break;case"top_right":l=-45*Math.PI/180,u="start",g=8,h=-8;break;case"center_left":l=180*Math.PI/180,u="end",g=-8,h=0;break;case"center":l=-90*Math.PI/180,u="middle",g=0,h=-8;break;case"center_right":l=0*Math.PI/180,u="start",g=8,h=0;break;case"bottom_left":l=135*Math.PI/180,u="end",g=-8,h=8;break;case"bottom_center":l=90*Math.PI/180,u="middle",g=0,h=8;break;case"bottom_right":l=45*Math.PI/180,u="start",g=8,h=8;break;default:l=-50*Math.PI/180,u="start",g=8,h=0}const d=i+a*Math.cos(l),p=r+a*Math.sin(l),m=i,_=r,f=[`M ${d},${p}`,`L ${m},${_}`,`M ${m},${_}`,`L ${m-A*Math.cos((l*180/Math.PI+150)*Math.PI/180)},${_-A*Math.sin((l*180/Math.PI+150)*Math.PI/180)}`,`L ${m-A*Math.cos((l*180/Math.PI+210)*Math.PI/180)},${_-A*Math.sin((l*180/Math.PI+210)*Math.PI/180)}`,"Z"].join(" "),I=(d+g).toString(),C=(p+h).toString(),y=[];if(t.name&&t.voltage!==void 0)y.push({type:"element",name:"tspan",value:"",attributes:{x:I},children:[{type:"text",value:t.name,name:"",attributes:{},children:[]}]}),y.push({type:"element",name:"tspan",value:"",attributes:{x:I,dy:"1.2em"},children:[{type:"text",value:`${t.voltage}V`,name:"",attributes:{},children:[]}]});else{const x=[];t.name&&x.push(t.name),t.voltage!==void 0&&x.push(`${t.voltage}V`),y.push({type:"text",value:x.join(" "),name:"",attributes:{},children:[]})}return[{name:"path",type:"element",attributes:{class:"sch-voltage-probe",d:f,stroke:s,fill:s,"stroke-width":`${c_(e)}px`},value:"",children:[]},{type:"element",name:"text",value:"",attributes:{class:"sch-voltage-probe-label",x:I,y:C,fill:s,"text-anchor":u,"dominant-baseline":"middle","font-family":"sans-serif","font-size":`${PE(e,"reference_designator")}px`,"font-weight":"bold","data-schematic-voltage-probe-id":t.schematic_voltage_probe_id},children:y}]}var HZ=6,C_e=12,mI=12,wU=6,wun=14,y_e=11,Pun=280,CPi=140,Mun=t=>t.type==="schematic_component_overlap_warning"||t.type==="schematic_component_styling_warning"||t.type==="schematic_element_outside_sheet_warning"||t.type==="schematic_manual_edit_conflict_warning";function yPi({circuitJson:t,transform:e,svgWidth:n,svgHeight:o,colorMap:i}){const r=i.schematic.erc_warning,s=[];return t.filter(Mun).flatMap(a=>{const A=xPi(a,t,e);if(!A)return[];const c=Math.max(1,n-mI*2),l=wPi(a.message,Math.max(12,Math.floor((Math.min(Pun,c)-wU*2)/(y_e*.56)))),u=Math.max(...l.map(I=>I.length)),g=Math.min(Pun,c,Math.max(Math.min(CPi,c),u*y_e*.56+wU*2)),h=wU*2+l.length*wun,d=SPi({targetBounds:A,calloutWidth:g,calloutHeight:h,svgWidth:n,svgHeight:o,occupiedCalloutBounds:s});s.push(d);const p=vPi(a),m=x_e(A,HZ),_=QPi(d,m);return[{name:"g",type:"element",value:"",attributes:{class:"schematic-warning","data-type":a.type,"data-warning-id":p,role:"note","aria-label":a.message},children:[{name:"rect",type:"element",value:"",attributes:{x:m.minX.toString(),y:m.minY.toString(),width:(m.maxX-m.minX).toString(),height:(m.maxY-m.minY).toString(),rx:"6",fill:"none",stroke:r,"stroke-width":"1","stroke-dasharray":"4,3","data-warning-reference":"target"},children:[]},{name:"line",type:"element",value:"",attributes:{x1:_.from.x.toString(),y1:_.from.y.toString(),x2:_.to.x.toString(),y2:_.to.y.toString(),stroke:r,"stroke-width":"1","data-warning-reference":"leader"},children:[]},{name:"rect",type:"element",value:"",attributes:{x:d.minX.toString(),y:d.minY.toString(),width:g.toString(),height:h.toString(),fill:"rgba(255, 250, 235, 0.97)",stroke:r,"stroke-width":"1","data-warning-reference":"callout"},children:[]},{name:"text",type:"element",value:"",attributes:{x:(d.minX+wU).toString(),y:(d.minY+wU+y_e).toString(),fill:"#5c4300","font-family":"sans-serif","font-size":y_e.toString()},children:l.map((I,C)=>({name:"tspan",type:"element",value:"",attributes:{x:(d.minX+wU).toString(),dy:C===0?"0":wun.toString()},children:[DPi(I)]}))}]}]})}function xPi(t,e,n){const i=EPi(t).map(r=>BPi(e,r)).filter(r=>!!r).map(r=>bPi(r,n)).filter(r=>!!r);return i.length===0?null:i.reduce(PPi)}function EPi(t){switch(t.type){case"schematic_component_overlap_warning":return t.schematic_component_ids;case"schematic_component_styling_warning":return[t.schematic_component_id,...t.schematic_port_ids??[]];case"schematic_manual_edit_conflict_warning":return[t.schematic_component_id];case"schematic_element_outside_sheet_warning":return[t.schematic_element_id]}}function BPi(t,e){return t.find(n=>{if(!n.type.startsWith("schematic_"))return!1;const o=`${n.type}_id`;return n[o]===e})}function bPi(t,e){if(t.type==="schematic_component"){const n=er(e,{x:t.center.x-t.size.width/2,y:t.center.y+t.size.height/2}),o=er(e,{x:t.center.x+t.size.width/2,y:t.center.y-t.size.height/2});return oje([n,o])}if(t.type==="schematic_port"){const n=er(e,t.center);return x_e(oje([n]),4)}if(t.type==="schematic_net_label"){const n=er(e,t.anchor_position??t.center),o=Math.max(28,t.text.length*8);return{minX:n.x-o/2,minY:n.y-10,maxX:n.x+o/2,maxY:n.y+10}}if(t.type==="schematic_trace"){const n=t.edges.flatMap(o=>[er(e,o.from),er(e,o.to)]);return n.length===0?null:x_e(oje(n),4)}return null}function SPi({targetBounds:t,calloutWidth:e,calloutHeight:n,svgWidth:o,svgHeight:i,occupiedCalloutBounds:r}){const s=(t.minX+t.maxX)/2,a=(t.minY+t.maxY)/2,A=t.minY-HZ-C_e-n,c=t.maxY+HZ+C_e,l=t.minX-HZ-C_e-e,u=t.maxX+HZ+C_e,g=[];A>=mI&&g.push(OZ({x:PU(s-e/2,mI,o-mI-e),y:A,width:e,height:n,side:"top"})),c+n<=i-mI&&g.push(OZ({x:PU(s-e/2,mI,o-mI-e),y:c,width:e,height:n,side:"bottom"})),u+e<=o-mI&&g.push(OZ({x:u,y:PU(a-n/2,mI,i-mI-n),width:e,height:n,side:"right"})),l>=mI&&g.push(OZ({x:l,y:PU(a-n/2,mI,i-mI-n),width:e,height:n,side:"left"}));const h=g.find(d=>r.every(p=>!MPi(x_e(d,4),p)));return h||(g[0]?g[0]:OZ({x:PU(s-e/2,mI,o-mI-e),y:PU(A,mI,i-mI-n),width:e,height:n,side:"top"}))}function QPi(t,e){const n=(e.minX+e.maxX)/2,o=(e.minY+e.maxY)/2,i=(t.minX+t.maxX)/2,r=(t.minY+t.maxY)/2;switch(t.side){case"top":return{from:{x:i,y:t.maxY},to:{x:n,y:e.minY}};case"bottom":return{from:{x:i,y:t.minY},to:{x:n,y:e.maxY}};case"left":return{from:{x:t.maxX,y:r},to:{x:e.minX,y:o}};case"right":return{from:{x:t.minX,y:r},to:{x:e.maxX,y:o}}}}function vPi(t){switch(t.type){case"schematic_component_overlap_warning":return t.schematic_component_overlap_warning_id;case"schematic_component_styling_warning":return t.schematic_component_styling_warning_id;case"schematic_element_outside_sheet_warning":return t.schematic_element_outside_sheet_warning_id;case"schematic_manual_edit_conflict_warning":return t.schematic_manual_edit_conflict_warning_id}}function wPi(t,e){const n=t.trim().split(/\s+/),o=[];let i="";for(const r of n){const s=i?`${i} ${r}`:r;if(s.length<=e||i.length===0){i=s;continue}o.push(i),i=r}return i&&o.push(i),o.length>0?o:["Warning"]}function oje(t){return{minX:Math.min(...t.map(e=>e.x)),minY:Math.min(...t.map(e=>e.y)),maxX:Math.max(...t.map(e=>e.x)),maxY:Math.max(...t.map(e=>e.y))}}function PPi(t,e){return{minX:Math.min(t.minX,e.minX),minY:Math.min(t.minY,e.minY),maxX:Math.max(t.maxX,e.maxX),maxY:Math.max(t.maxY,e.maxY)}}function x_e(t,e){return{minX:t.minX-e,minY:t.minY-e,maxX:t.maxX+e,maxY:t.maxY+e}}function MPi(t,e){return!(t.maxX<=e.minX||t.minX>=e.maxX||t.maxY<=e.minY||t.minY>=e.maxY)}function OZ({x:t,y:e,width:n,height:o,side:i}){return{minX:t,minY:e,maxX:t+n,maxY:e+o,side:i}}function PU(t,e,n){return n<e?(e+n)/2:Math.min(Math.max(t,e),n)}function DPi(t){return{name:"",type:"text",value:t,attributes:{},children:[]}}function Dun(t,e){const n=t.filter(ge=>ge.type==="schematic_sheet"),o=Dwi(n);let i=o;e?.schematicSheetId!==void 0?i=n.find(ge=>ge.schematic_sheet_id===e.schematicSheetId)??o:e?.schematicSheetIndex!==void 0&&(i=n.find(ge=>ge.sheet_index===e.schematicSheetIndex)??o);const r=i?t.filter(ge=>!ge.type.startsWith("schematic_")||Mun(ge)||"schematic_sheet_id"in ge&&ge.schematic_sheet_id===i.schematic_sheet_id):t,s=Vwi(r),a=s.maxX-s.minX,A=s.maxY-s.minY,c=e?.width??1200,l=e?.height??600,u=e?.colorOverrides,g={...$h,schematic:{...$h.schematic,...u?.schematic??{}}},h=a/A,d=c/l;let p;if(h>d){const ge=c/h;p={x:0,y:(l-ge)/2}}else{const ge=l*h;p={x:(c-ge)/2,y:0}}const m=Iwi([{x:s.minX,y:s.maxY},{x:s.maxX,y:s.maxY},{x:s.maxX,y:s.minY}],[{x:p.x,y:p.y},{x:c-p.x,y:p.y},{x:c-p.x,y:l-p.y}]),_=[];if(_.push({name:"rect",type:"element",attributes:{class:"boundary",x:"0",y:"0",width:c.toString(),height:l.toString()},children:[],value:""}),e?.grid){const ge=typeof e.grid=="object"?e.grid:{};_.push(Pwi({bounds:s,transform:m,...ge}))}const f=[],I=[],C=[],y=[],x=[],E=[],B=[],S=[],Q=[],w=[],M=[],k=[],R=[],F=[],O=[],U=[],Y=[],W=NPi({transform:m,svgWidth:c,svgHeight:l,schematicSheet:i}),te=Array.isArray(g.simulation_palette)?g.simulation_palette:Array.isArray(g.palette)?g.palette:[];let j=0;for(const ge of r)if(ge.type==="schematic_sheet")U.push(...mPi({schematicSheet:ge,transform:m,colorMap:g}));else if(ge.type==="schematic_graphic")Y.push(zwi({schematicGraphic:ge,viewport:RPi({availableViewport:W,schematicGraphic:ge,transform:m})}));else if(ge.type==="schematic_debug_object")f.push(...hPi({debugObject:ge,transform:m}));else if(ge.type==="schematic_component")I.push(...dPi({component:ge,transform:m,circuitJson:r,colorMap:g})),Q.push(...Zwi({component:ge,transform:m,circuitJson:r}));else if(ge.type==="schematic_box")B.push(...iPi({schematicBox:ge,transform:m,colorMap:g}));else if(ge.type==="schematic_trace")C.push(...fPi({trace:ge,transform:m,colorMap:g}));else if(ge.type==="schematic_net_label")y.push(...$wi({schNetLabel:ge,realToScreenTransform:m,colorMap:g}));else if(ge.type==="schematic_text"&&!ge.schematic_component_id)x.push(nje({elm:ge,transform:m,colorMap:g}));else if(ge.type==="schematic_voltage_probe"){const _e=te.length>0?te[j%te.length]:void 0;j+=1,E.push(...IPi({probe:ge,transform:m,colorMap:g,fallbackColor:_e}))}else if(ge.type==="schematic_table")S.push(..._Pi({schematicTable:ge,transform:m,colorMap:g,circuitJson:r}));else if(ge.type==="schematic_line"){if(ge.schematic_component_id)continue;M.push(...Bun({schLine:ge,transform:m,colorMap:g}))}else if(ge.type==="schematic_circle"){if(ge.schematic_component_id)continue;k.push(...fun({schCircle:ge,transform:m,colorMap:g}))}else if(ge.type==="schematic_rect"){if(ge.schematic_component_id)continue;R.push(...bun({schRect:ge,transform:m,colorMap:g}))}else if(ge.type==="schematic_arc"){if(ge.schematic_component_id)continue;F.push(..._un({schArc:ge,transform:m,colorMap:g}))}else if(ge.type==="schematic_path"){if(ge.schematic_component_id)continue;O.push(...Sun({schPath:ge,transform:m,colorMap:g}))}else if(ge.type==="schematic_port"){const _e=r.find(ue=>ue.type==="source_port"&&ue.source_port_id===ge.source_port_id);_e?.type==="source_port"&&_e.do_not_connect===!0&&w.push(ePi({schPort:ge,transform:m,colorMap:g})),e?.drawPorts&&w.push(...tPi({schPort:ge,transform:m,circuitJson:r,colorMap:g}))}const J=C.filter(ge=>ge.attributes?.["data-layer"]!=="overlay"),oe=C.filter(ge=>ge.attributes?.["data-layer"]==="overlay");_.push(...Y,...f,...U,...J,...oe,...M,...k,...R,...F,...O,...I,...Q,...w,...y,...x,...B,...E,...S),e?.labeledPoints&&_.push(Mwi({points:e.labeledPoints,transform:m})),e?.shouldDrawWarnings&&_.push(...yPi({circuitJson:r,transform:m,svgWidth:c,svgHeight:l,colorMap:g}));const ie=qWe(t),ne=XWe;if(e?.showErrorsInTextOverlay){const ge=vwi(t);ge&&_.push(ge)}const le={name:"svg",type:"element",attributes:{xmlns:"http://www.w3.org/2000/svg",class:["tscircuit-schematic",e?.className].filter(Boolean).join(" "),width:c.toString(),height:l.toString(),style:`background-color: ${g.schematic.background}`,"data-real-to-screen-transform":mwi(m),...ie&&{"data-software-used-string":ie},...e?.includeVersion&&{"data-circuit-to-svg-version":ne}},children:[{name:"style",type:"element",children:[{type:"text",value:`
.boundary { fill: ${g.schematic.background}; }
.schematic-boundary { fill: none; stroke: #fff; }
.component { fill: none; stroke: ${g.schematic.component_outline}; }
.chip { fill: ${g.schematic.component_body}; stroke: ${g.schematic.component_outline}; }
.component-pin { fill: none; stroke: ${g.schematic.component_outline}; }
.text { font-family: sans-serif; fill: ${g.schematic.wire}; }
.pin-number { fill: ${g.schematic.pin_number}; }
.port-label { fill: ${g.schematic.reference}; }
.component-name { fill: ${g.schematic.reference}; }
${e?.css??""}
`,name:"",attributes:{},children:[]}],value:"",attributes:{}},..._],value:""};return $We(le)}function NPi({transform:t,svgWidth:e,svgHeight:n,schematicSheet:o}){if(!o)return{x:0,y:0,width:e,height:n};const i=eje(o),r=er(t,{x:i.innerMinX,y:i.innerMaxY}),s=er(t,{x:i.innerMaxX,y:i.innerMinY});return{x:Math.min(r.x,s.x),y:Math.min(r.y,s.y),width:Math.abs(s.x-r.x),height:Math.abs(s.y-r.y)}}function RPi({availableViewport:t,schematicGraphic:e,transform:n}){if(e.width===void 0&&e.height===void 0)return t;const o=e.width===void 0?t.width:Nun(e.width*Math.hypot(n.a,n.b),t.width),i=e.height===void 0?t.height:Nun(e.height*Math.hypot(n.c,n.d),t.height);return{x:t.x+(t.width-o)/2,y:t.y+(t.height-i)/2,width:o,height:i}}function Nun(t,e){return Number.isFinite(t)?Math.max(0,Math.min(t,e)):e}var Run=({simulationResult:t,fallbackName:e})=>{const n=t.name??e,o=t.simulation_parameter_sweep_coordinate;return o?`${n} (${o.parameter_value}${o.parameter_unit})`:n},TPi=t=>{const e=t[0]??0,n=t[1];return{timestamps_ms:t,start_time_ms:e,end_time_ms:t.at(-1)??0,time_per_step:n===void 0?1:Math.abs(n-e)}},kPi=t=>t.type==="simulation_transient_voltage_graph"?t.simulation_transient_voltage_graph_id:t.simulation_transient_current_graph_id,Tun=t=>{switch(t.type){case"simulation_transient_voltage_graph":return t.simulation_transient_voltage_graph_id;case"simulation_transient_current_graph":return t.simulation_transient_current_graph_id;case"simulation_dc_operating_point_voltage":return t.simulation_dc_operating_point_voltage_id;case"simulation_dc_operating_point_current":return t.simulation_dc_operating_point_current_id;case"simulation_dc_sweep_voltage_graph":return t.simulation_dc_sweep_voltage_graph_id;case"simulation_dc_sweep_current_graph":return t.simulation_dc_sweep_current_graph_id;case"simulation_ac_sweep_voltage_graph":return t.simulation_ac_sweep_voltage_graph_id;case"simulation_ac_sweep_current_graph":return t.simulation_ac_sweep_current_graph_id}},FPi=({simulationResult:t,acSweepView:e,usesLogarithmicXValues:n})=>{switch(t.type){case"simulation_dc_operating_point_voltage":return{horizontalCoordinates:[0],measuredLevels:[t.voltage],isCurrent:!1};case"simulation_dc_operating_point_current":return{horizontalCoordinates:[0],measuredLevels:[t.current],isCurrent:!0};case"simulation_dc_sweep_voltage_graph":return{horizontalCoordinates:t.sweep_values,measuredLevels:t.voltage_levels,isCurrent:!1};case"simulation_dc_sweep_current_graph":return{horizontalCoordinates:t.sweep_values,measuredLevels:t.current_levels,isCurrent:!0};case"simulation_ac_sweep_voltage_graph":return{horizontalCoordinates:n?t.frequencies_hz.map(Math.log10):t.frequencies_hz,measuredLevels:t.complex_voltages.map(o=>e==="phase"?Math.atan2(o.im,o.re)*180/Math.PI:Math.hypot(o.re,o.im)),isCurrent:!1};case"simulation_ac_sweep_current_graph":return{horizontalCoordinates:n?t.frequencies_hz.map(Math.log10):t.frequencies_hz,measuredLevels:t.complex_currents.map(o=>e==="phase"?Math.atan2(o.im,o.re)*180/Math.PI:Math.hypot(o.re,o.im)),isCurrent:!0}}},LPi=({simulationResult:t,acSweepView:e,usesLogarithmicXValues:n})=>{if(t.type==="simulation_transient_voltage_graph"||t.type==="simulation_transient_current_graph")return t.simulation_parameter_sweep_coordinate?{...t,name:Run({simulationResult:t,fallbackName:t.name??kPi(t)})}:t;const o=Tun(t),{horizontalCoordinates:i,measuredLevels:r,isCurrent:s}=FPi({simulationResult:t,acSweepView:e,usesLogarithmicXValues:n}),a={simulation_experiment_id:t.simulation_experiment_id,simulation_parameter_sweep_coordinate:t.simulation_parameter_sweep_coordinate,name:Run({simulationResult:t,fallbackName:o}),color:t.color,...TPi(i)};return s?{type:"simulation_transient_current_graph",simulation_transient_current_graph_id:o,current_levels:r,...a}:{type:"simulation_transient_voltage_graph",simulation_transient_voltage_graph_id:o,voltage_levels:r,...a}},HPi=({simulationResultType:t,experiment:e})=>t?.startsWith("simulation_ac_sweep_")?"Frequency (Hz)":t?.startsWith("simulation_dc_sweep_")?e?.dc_sweep_unit?`DC Sweep (${e.dc_sweep_unit})`:"DC Sweep":t?.startsWith("simulation_dc_operating_point_")?"Operating Point":"Time (ms)",OPi=({results:t,acSweepView:e,experiment:n})=>{const o=t[0]?.type,i=o?.startsWith("simulation_ac_sweep_")??!1,r=i&&n?.ac_sweep_type!=="linear";return{graphs:t.map(a=>LPi({simulationResult:a,acSweepView:e,usesLogarithmicXValues:r})),xAxisTitle:HPi({simulationResultType:o,experiment:n}),yAxisTitle:i&&e==="phase"?"Phase (deg)":void 0,usesLogarithmicXValues:r}};function GZ(t){return t?.valuePerDiv!==void 0&&Number.isFinite(t.valuePerDiv)&&Math.abs(t.valuePerDiv)>Number.EPSILON}var GPi=1200,YPi=600,hm={top:64,right:100,bottom:80,left:100},ije=24,rje=56,UPi=56,KPi=8,kun="#1f77b4";function qx(t){return t.type==="simulation_transient_current_graph"}function sje(t){return qx(t)?t.simulation_transient_current_graph_id:t.simulation_transient_voltage_graph_id}function Fun(t){return qx(t)?"data-simulation-transient-current-graph-id":"data-simulation-transient-voltage-graph-id"}function Lun(t){return qx(t)?t.current_levels:t.voltage_levels}function VPi(t){const e=t.some(o=>qx(o.graph)),n=t.some(o=>!qx(o.graph));return e&&!n?"Current (A)":n&&!e?"Voltage (V)":"Value"}function zPi(t){return`simulation-graph-${t.replace(/[^a-zA-Z0-9_-]+/g,"-")}`}function $i(t){if(!Number.isFinite(t))return"0";const e=Number.parseFloat(t.toFixed(6));return Number.isInteger(e),e.toString()}function cc(t,e,n=[]){return{name:t,type:"element",value:"",attributes:e,children:n}}function o9(t){return{name:"",type:"text",value:t,attributes:{},children:[]}}function aje(t,e){if(!Number.isFinite(t))return`0 ${e}`;if(t===0)return`0 ${e}`;const n=Math.abs(t),o=[{threshold:1e6,factor:1e6,prefix:"M"},{threshold:1e3,factor:1e3,prefix:"k"},{threshold:1,factor:1,prefix:""},{threshold:.001,factor:.001,prefix:"m"},{threshold:1e-6,factor:1e-6,prefix:"µ"},{threshold:1e-9,factor:1e-9,prefix:"n"}],i=o.find(s=>n>=s.threshold)??o[o.length-1],r=t/i.factor;return`${Hun(r)} ${i.prefix}${e}`}function JPi(t){return`${Hun(t)} div`}function Hun(t){if(!Number.isFinite(t))return"0";const e=Math.abs(t),n=e>=100?0:e>=10?1:e>=1?2:3;return Number.parseFloat(t.toFixed(n)).toString()}function Oun(t,e){const n=e.tickLabelOverrides?.get(t);if(n!==void 0)return n;const{ticks:o}=e;if(o.length<=1)return $i(t);const i=o[o.length-1]-o[0];if(!Number.isFinite(i)||i===0)return $i(t);const r=WPi(i),s=10**r;return(Math.round(t*s)/s).toFixed(r).replace(/\.0+$/,"").replace(/(\.\d*?)0+$/,"$1").replace(/\.$/,"")}function WPi(t){return t>=100?0:t>=10?1:t>=1?2:3}function jPi({graphs:t,valueAxis:e,scaleY:n,plotLeft:o,plotWidth:i,plotHeight:r}){const s=hm.top,a=hm.top+r,A=o,c=o+i,l=[],u=t.filter(g=>GZ(g.scopeTraceDisplay));for(const[g,h]of u.entries()){const d=g%2===0?"left":"right",p=Math.floor(g/2),m=d==="left"?A-10-p*rje:c+10+p*rje,_=d==="left"?m-6:m+6,f=d==="left"?"end":"start",I=d==="left"?m+6:m-6,C=h.scopeTraceDisplay;if(GZ(C)){l.push(cc("line",{class:"axis axis-y axis-y-scope",x1:$i(m),y1:$i(s),x2:$i(m),y2:$i(a),style:`stroke: ${h.color};`}),cc("text",{class:"axis-title axis-title-y axis-title-y-scope",x:$i(m),y:$i(s-12),"text-anchor":"middle",style:`fill: ${h.color}; font-size: 10px;`},[o9(h.label)]));for(const y of e.ticks){const x=n(y),E=(C.center??0)+(y-(C.offsetDivs??0))*C.valuePerDiv;l.push(cc("line",{class:"axis-tick axis-tick-y axis-tick-y-scope",x1:$i(m),y1:$i(x),x2:$i(I),y2:$i(x),style:`stroke: ${h.color};`}),cc("text",{class:"axis-label axis-label-y axis-label-y-scope",x:$i(_),y:$i(x),"text-anchor":f,"dominant-baseline":"middle",style:`fill: ${h.color}; font-size: 10px;`},[o9(aje(E,qx(h.graph)?"A":"V"))]))}}}return l}function $Pi({timeAxis:t,valueAxis:e,graphs:n,scaleX:o,scaleY:i,plotLeft:r,plotWidth:s,plotHeight:a,yAxisTitle:A,xAxisTitle:c,usesScopeTraceDisplay:l}){const u=hm.top+a,g=r,h=r+s,d=[cc("line",{class:"axis axis-x",x1:$i(g),y1:$i(u),x2:$i(h),y2:$i(u)}),...l?[]:[cc("line",{class:"axis axis-y",x1:$i(g),y1:$i(hm.top),x2:$i(g),y2:$i(u)})]];for(const p of t.ticks){const m=$i(o(p));d.push(cc("line",{class:"axis-tick axis-tick-x",x1:m,y1:$i(u),x2:m,y2:$i(u+6)}),cc("text",{class:"axis-label axis-label-x",x:m,y:$i(u+22),"text-anchor":"middle"},[o9(Oun(p,t))]))}if(l)d.push(...jPi({graphs:n,valueAxis:e,scaleY:i,plotLeft:r,plotWidth:s,plotHeight:a}));else{for(const p of e.ticks){const m=$i(i(p));d.push(cc("line",{class:"axis-tick axis-tick-y",x1:$i(g-6),y1:m,x2:$i(g),y2:m}),cc("text",{class:"axis-label axis-label-y",x:$i(g-10),y:m,"text-anchor":"end","dominant-baseline":"middle"},[o9(Oun(p,e))]))}d.push(cc("text",{class:"axis-title axis-title-y",x:$i(g-64),y:$i(hm.top+a/2),transform:`rotate(-90 ${$i(g-64)} ${$i(hm.top+a/2)})`,"text-anchor":"middle"},[o9(A)]))}return d.push(cc("text",{class:"axis-title axis-title-x",x:$i(g+s/2),y:$i(u+48),"text-anchor":"middle"},[o9(c)])),cc("g",{class:"axes"},d)}function E_e(t,e=!1){if(t.length===0)return{domainMin:0,domainMax:1,ticks:[0,1]};const n=Math.min(...t),o=Math.max(...t);if(n===o){const A=n===0?1:Math.abs(n)*.1||1;return{domainMin:n-A,domainMax:n+A,ticks:[n-A,n,n+A]}}const i=Gun(n,o),r=i.length>0?[...i]:[n,o];let s=r[0],a=r[r.length-1];if(e&&r.length>1){const A=Math.abs(r[1]-r[0]),c=.1;n<s+A*c&&(s-=A,r.unshift(s)),o>a-A*c&&(a+=A,r.push(a))}return{domainMin:s,domainMax:a,ticks:r}}function qPi({values:t,graphs:e,experiment:n}){const o=B_e(n?.start_time_ms),i=B_e(n?.end_time_ms),r=e.map(p=>B_e(p.start_time_ms)).filter(p=>p!==void 0),s=e.map(p=>B_e(p.end_time_ms)).filter(p=>p!==void 0),a=o??(r.length>0?Math.min(...r):void 0),A=i??(s.length>0?Math.max(...s):void 0);if(a===void 0||A===void 0||a===A)return E_e(t);const c=Math.min(a,A),l=Math.max(a,A),g=(l-c)*.12,h=Gun(c,l).filter(p=>p>c+g&&p<l-g),d=XPi([c,...h,l]);return{domainMin:c,domainMax:l,ticks:d,tickLabelOverrides:new Map([[c,$i(c)],[l,$i(l)]])}}function B_e(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}function XPi(t){const e=[...t].sort((o,i)=>o-i),n=[];for(const o of e){const i=n[n.length-1];(i===void 0||Math.abs(o-i)>1e-12)&&n.push(o)}return n}function Gun(t,e,n=6){const o=e-t;if(!Number.isFinite(o)||o<=Number.EPSILON)return[t,e];const i=ZPi(o/Math.max(1,n-1)),r=Math.floor(t/i)*i,s=Math.ceil(e/i)*i,a=[];for(let A=r;A<=s+i/2;A+=i)a.push(Number.parseFloat(A.toPrecision(12)));return a}function ZPi(t){if(!Number.isFinite(t)||t<=0)return 1;const e=Math.floor(Math.log10(t)),n=t/10**e;let o;return n<=1?o=1:n<=2?o=2:n<=5?o=5:o=10,o*10**e}function eMi(t,e){return cc("rect",{class:"background",x:"0",y:"0",width:$i(t),height:$i(e)})}function tMi(t,e,n,o){return cc("defs",{},[cc("clipPath",{id:t},[cc("rect",{x:$i(e),y:$i(hm.top),width:$i(n),height:$i(o)})])])}function nMi({timeAxis:t,valueAxis:e,scaleX:n,scaleY:o,plotLeft:i,plotWidth:r,plotHeight:s}){const a=hm.top,A=hm.top+s,c=i,l=i+r,u=[];for(const g of t.ticks){const h=$i(n(g));u.push(cc("line",{class:"grid-line grid-line-x",x1:h,y1:$i(a),x2:h,y2:$i(A)}))}for(const g of e.ticks){const h=$i(o(g));u.push(cc("line",{class:"grid-line grid-line-y",x1:$i(c),y1:h,x2:$i(l),y2:h}))}return cc("g",{class:"grid"},u)}function Yun(t,e,n,o){if(!Number.isFinite(t)||!Number.isFinite(e)){const r=(n+o)/2;return()=>r}const i=e-t;if(Math.abs(i)<Number.EPSILON){const r=(n+o)/2;return()=>r}return r=>n+(r-t)/i*(o-n)}function oMi(t,e,n){return cc("rect",{class:"plot-background",x:$i(t),y:$i(hm.top),width:$i(e),height:$i(n)})}function iMi(){const t=`
:root { color-scheme: light; }
svg { font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif; }
.background { fill: ${$h.schematic.background}; }
.plot-background { fill: #ffffff; }
.grid-line { stroke: rgba(0, 0, 0, 0.08); stroke-width: 1; }
.axis { stroke: rgba(0, 0, 0, 0.6); stroke-width: 1.5; }
.axis-tick { stroke: rgba(0, 0, 0, 0.6); stroke-width: 1; }
.axis-label { fill: rgba(0, 0, 0, 0.75); font-size: 12px; }
.axis-title { fill: rgba(0, 0, 0, 0.9); font-size: 14px; font-weight: 600; }
.legend-label { fill: rgba(0, 0, 0, 0.75); font-size: 11px; }
.legend-line { stroke-width: 3; }
.scope-channel-card { fill: #ffffff; stroke: rgba(0, 0, 0, 0.22); stroke-width: 1; }
.scope-channel-header-text { fill: #ffffff; font-size: 14px; font-weight: 700; }
.scope-channel-detail { fill: rgba(0, 0, 0, 0.42); font-size: 14px; }
.simulation-line { fill: none; stroke-width: 2.5; }
.simulation-point { stroke-width: 0; }
.chart-title { fill: rgba(0, 0, 0, 0.85); font-size: 18px; font-weight: 600; }
`;return cc("style",{},[o9(t)])}function Uun(t,e){const n=t[e];if(typeof n=="string")return n}function rMi(t,e,n,o){const r=[4,8],s=r.map(g=>$i(g)).join(" "),A=r.reduce((g,h)=>g+h,0)/3,c=[];t.forEach((g,h)=>{if(g.points.length===0)return;const d=[];g.points.forEach((I,C)=>{const y=$i(n(I.timeMs)),x=$i(o(I.displayValue));d.push(`${C===0?"M":"L"} ${y} ${x}`)});const p={class:"simulation-line",d:d.join(" "),stroke:g.color,"clip-path":`url(#${e})`,[Fun(g.graph)]:sje(g.graph)};g.graph.source_component_id&&(p["data-source-component-id"]=g.graph.source_component_id);const m=Uun(g.graph,"source_probe_id");m&&(p["data-source-probe-id"]=m);const _=Uun(g.graph,"source_probe_name");_&&(p["data-source-probe-name"]=_),g.graph.subcircuit_connectivity_map_key&&(p["data-subcircuit-connectivity-map-key"]=g.graph.subcircuit_connectivity_map_key);const f=g.points.map(I=>{const C=$i(n(I.timeMs)),y=$i(o(I.displayValue));return cc("circle",{class:"simulation-point",cx:C,cy:y,r:"2.5",fill:g.color,"clip-path":`url(#${e})`})});c.push({entry:g,graphIndex:h,pathAttributes:p,pointElements:f})});const l=[];for(let g=0;g<3;g++)for(const h of c){const d=(h.graphIndex+g)%3,p=$i(d*A);l.push(cc("path",{...h.pathAttributes,"stroke-dasharray":s,"stroke-dashoffset":p}))}const u=c.flatMap(g=>g.pointElements);return cc("g",{class:"data-series"},[...l,...u])}function sMi(t,e){return t?.name?cc("text",{class:"chart-title",x:$i(e/2),y:$i(hm.top-40),"text-anchor":"middle"},[o9(t.name)]):null}var Kun=16;function aMi(t,e,n,o){const i=o.map((r,s)=>cc("tspan",{x:"20",dy:s===0?"0":String(Kun)},[o9(r)]));return cc("g",{class:"legend-item",transform:`translate(${$i(e)} ${$i(n)})`},[cc("line",{class:"legend-line",x1:"0",y1:"0",x2:"16",y2:"0",stroke:t.color}),cc("text",{class:"legend-label",x:"20",y:"0","dominant-baseline":"middle"},i)])}var AMi=15;function cMi(t){const e=t.split("_");if(e.length<=1)return[t];const n=[];let o=e[0]??"";for(let i=1;i<e.length;i++){const r=e[i]??"",s=`${o}_${r}`;s.length>AMi?(n.push(o),o=r):o=s}return o&&n.push(o),n}var lMi=24;function uMi(t,e){let n=hm.top;const o=t.map(i=>{const r=e-hm.right+10,s=cMi(i.label),a=aMi(i,r,n,s),A=s.length*Kun;return n+=Math.max(A,lMi),a});return cc("g",{class:"legend"},o)}var NT=118,b_e=94,MU=18;function Vun(t,e){const n=Math.floor((e+MU)/(NT+MU)),o=Math.max(1,Math.min(n,t)),i=Math.max(1,Math.ceil(t/o)),r=o*NT+(o-1)*MU,s=i*b_e+(i-1)*MU;return{columns:o,rows:i,x:Math.max(0,(e-r)/2),height:s}}var S_e=20,Aje=8,gMi=14;function dMi(t,e,n){const o=Vun(t.length,e),i=[];for(const[r,s]of t.entries()){const a=r%o.columns,A=Math.floor(r/o.columns);i.push(hMi(s,r,o.x+a*(NT+MU),n+ije+A*(b_e+MU)))}return cc("g",{class:"scope-legend"},i)}function hMi(t,e,n,o){const i=t.scopeTraceDisplay,r=qx(t.graph)?"A":"V",s=i&&GZ(i)?aje(i.valuePerDiv,r):`1 ${r}`,a=aje(i?.center??0,r),A=JPi(i?.offsetDivs??0),c=`Ch${e+1}`,u=[t.label===c?void 0:t.label,`${s}/div`,A,a].filter(h=>!!h),g=u.length>1?(b_e-S_e-Aje*2-gMi)/(u.length-1):0;return cc("g",{class:"scope-channel",transform:`translate(${$i(n)} ${$i(o)})`,[Fun(t.graph)]:sje(t.graph)},[cc("rect",{class:"scope-channel-card",x:"0",y:"0",width:$i(NT),height:$i(b_e),rx:"6",ry:"6"}),cc("rect",{x:"0",y:"0",width:$i(NT),height:$i(S_e),rx:"6",ry:"6",fill:t.color}),cc("rect",{x:"0",y:$i(S_e-6),width:$i(NT),height:"6",fill:t.color}),cc("text",{class:"scope-channel-header-text",x:$i(NT/2),y:"14","text-anchor":"middle"},[o9(c)]),...u.map((h,d)=>cc("text",{class:"scope-channel-detail",x:$i(Aje),y:$i(S_e+Aje+d*g),"dominant-baseline":"hanging"},[o9(h)]))])}function pMi(t){const e=Math.ceil(t/2),n=Math.floor(t/2);return{left:zun(e),right:zun(n)}}function zun(t){if(t<=1)return 0;const e=10+(t-1)*rje+6+UPi+KPi;return Math.max(0,e-hm.left)}function Jun(t){return t.type==="simulation_transient_voltage_graph"||t.type==="simulation_transient_current_graph"||t.type==="simulation_dc_operating_point_voltage"||t.type==="simulation_dc_operating_point_current"||t.type==="simulation_dc_sweep_voltage_graph"||t.type==="simulation_dc_sweep_current_graph"||t.type==="simulation_ac_sweep_voltage_graph"||t.type==="simulation_ac_sweep_current_graph"}function Wun(t){return t?.type==="simulation_experiment"}function mMi(t){return t?.type==="simulation_voltage_probe"}function _Mi(t){return t?.type==="simulation_current_probe"}function fMi(t){return t?.type==="simulation_oscilloscope_trace"}function IMi(t,e){const n=yMi(t),o=Lun(t),i=Math.min(n.length,o.length),r=[],s=CMi(e);for(let a=0;a<i;a++){const A=Number(n[a]??Number.NaN),c=Number(o[a]??Number.NaN);!Number.isFinite(A)||!Number.isFinite(c)||r.push({timeMs:A,rawValue:c,displayValue:s(c)})}return r}function CMi(t){if(!GZ(t))return i=>i;const e=t.center??0,n=t.offsetDivs??0,o=t.valuePerDiv;return i=>n+(i-e)/o}function yMi(t){const e=Lun(t);if(Array.isArray(t.timestamps_ms)&&t.timestamps_ms.length===e.length)return t.timestamps_ms.map(r=>Number(r));const n=e.length;if(n===0)return[];const o=[];for(let r=0;r<n;r++)o.push(t.start_time_ms+t.time_per_step*r);const i=o.length>0?o[o.length-1]:void 0;return i!==void 0&&Number.isFinite(t.end_time_ms)&&Number.isFinite(i)&&Math.abs(i-t.end_time_ms)>t.time_per_step/2&&o.push(t.end_time_ms),o}function Q_e(t,e){const n=t[e];if(typeof n=="string")return n}function xMi(t,e,n,o){const i=qx(t)?"I":"V";if(n?.displayName)return n.displayName;if(t.simulation_parameter_sweep_coordinate&&t.name)return t.name;if(e?.name)return`${i}(${e.name})`;const r=Q_e(t,"source_probe_name");if(r)return`${i}(${r})`;if(t.source_component_id){const s=o.get(t.source_component_id);if(s)return`${i}(${s})`}return t.name?t.name:t.source_component_id?`Probe ${t.source_component_id}`:sje(t)}function EMi(t,e,n,o,i,r){if(qx(t)){const A=o.get(t.simulation_transient_current_graph_id);if(A)return A;const c=Q_e(t,"source_probe_id")??(e?.type==="simulation_current_probe"?e.simulation_current_probe_id:void 0);return c?r.get(c):void 0}const s=n.get(t.simulation_transient_voltage_graph_id);if(s)return s;const a=Q_e(t,"source_probe_id")??(e?.type==="simulation_voltage_probe"?e.simulation_voltage_probe_id:void 0);return a?i.get(a):void 0}function BMi(t,e,n,o,i){const r=Q_e(t,"source_probe_id");if(r){const s=qx(t)?n.get(r):e.get(r);if(s)return s}if(t.source_component_id)return qx(t)?i.get(t.source_component_id):o.get(t.source_component_id)}function bMi(t,e){if(e)return{displayName:e.display_name,color:e.color,center:e.display_center_value,offsetDivs:e.display_center_offset_divs,valuePerDiv:qx(t)?e.amps_per_div:e.volts_per_div}}function SMi(t,e){const n=Array.isArray($h.simulation_palette)?$h.simulation_palette:Array.isArray($h.palette)?$h.palette:[],o=e.filter(mMi),i=e.filter(_Mi),r=e.filter(fMi),s=new Map,a=new Map,A=new Map,c=new Map,l=new Map,u=new Map,g=new Map,h=new Map,d=new Map,p=new Map,m=new Map,_=new Map;for(const f of r)f.simulation_transient_voltage_graph_id&&d.set(f.simulation_transient_voltage_graph_id,f),f.simulation_transient_current_graph_id&&p.set(f.simulation_transient_current_graph_id,f),f.simulation_voltage_probe_id&&m.set(f.simulation_voltage_probe_id,f),f.simulation_current_probe_id&&_.set(f.simulation_current_probe_id,f);for(const f of o)l.set(f.simulation_voltage_probe_id,f),f.name&&f.source_component_id&&s.set(f.source_component_id,f.name),f.color&&f.source_component_id&&a.set(f.source_component_id,f.color),f.source_component_id&&g.set(f.source_component_id,f);for(const f of i)u.set(f.simulation_current_probe_id,f),f.name&&f.source_component_id&&A.set(f.source_component_id,f.name),f.color&&f.source_component_id&&c.set(f.source_component_id,f.color),f.source_component_id&&h.set(f.source_component_id,f);return t.map((f,I)=>{const C=BMi(f,l,u,g,h),y=EMi(f,C,d,p,m,_),x=bMi(f,y),E=IMi(f,x),B=QMi(n,I),S=vMi(f,C,qx(f)?c:a),Q=f.color??x?.color??S??B,w=xMi(f,C,x,qx(f)?A:s);return{graph:f,points:E,color:Q,label:w,scopeTraceDisplay:x,usesScopeTraceDisplay:GZ(x)}}).filter(f=>f.points.length>0)}function QMi(t,e){return t.length===0?kun:t[e%t.length]??kun}function vMi(t,e,n){if(e?.color)return e.color;if(t.source_component_id)return n.get(t.source_component_id)}function jun({circuitJson:t,simulation_experiment_id:e,simulation_transient_current_graph_ids:n,simulation_transient_voltage_graph_ids:o,simulation_result_ids:i,ac_sweep_view:r="magnitude",width:s=GPi,height:a=YPi,includeVersion:A}){const c=o?new Set(o):null,l=n?new Set(n):null,u=!!(c||l),g=i?new Set(i):null,h=t.find(J=>Wun(J)&&J.simulation_experiment_id===e),d=t.filter(J=>Jun(J)&&J.simulation_experiment_id===e&&(!g||g.has(Tun(J)))&&(!u||J.type==="simulation_transient_voltage_graph"&&(c?.has(J.simulation_transient_voltage_graph_id)??!1)||J.type==="simulation_transient_current_graph"&&(l?.has(J.simulation_transient_current_graph_id)??!1))),p=OPi({results:d,acSweepView:r,experiment:h}),m=p.graphs;if(m.length===0)throw new Error(`No simulation analysis results found for simulation_experiment_id "${e}"`);const _=SMi(m,t),f=_.flatMap(J=>J.points);if(f.length===0)throw new Error(`Simulation results for simulation_experiment_id "${e}" do not contain any datapoints`);const I=f.map(J=>J.timeMs);let C;p.usesLogarithmicXValues?C=wMi(I):p.xAxisTitle==="Time (ms)"?C=qPi({values:I,graphs:m,experiment:h}):C=E_e(I);const y=E_e(f.map(J=>J.displayValue),!0),x=_.some(J=>J.usesScopeTraceDisplay),E=x?pMi(_.length):{left:0,right:0},B=s+E.left+E.right,S=x?Vun(_.length,B):null,Q=S?a+ije+S.height+ije:a,w=Math.max(1,s-hm.left-hm.right),M=Math.max(1,a-hm.top-hm.bottom),k=hm.left+E.left,R=Yun(C.domainMin,C.domainMax,k,k+w),F=Yun(y.domainMin,y.domainMax,hm.top+M,hm.top),O=zPi(e),U=qWe(t),Y=XWe,W=sMi(h,B),te=[iMi(),eMi(B,Q),tMi(O,k,w,M),oMi(k,w,M),nMi({timeAxis:C,valueAxis:y,scaleX:R,scaleY:F,plotLeft:k,plotWidth:w,plotHeight:M}),rMi(_,O,R,F),$Pi({timeAxis:C,valueAxis:y,graphs:_,scaleX:R,scaleY:F,plotLeft:k,plotWidth:w,plotHeight:M,yAxisTitle:p.yAxisTitle??VPi(_),xAxisTitle:p.xAxisTitle,usesScopeTraceDisplay:x}),x?dMi(_,B,a):uMi(_,B),...W?[W]:[]],j=cc("svg",{xmlns:"http://www.w3.org/2000/svg",width:B.toString(),height:Q.toString(),style:`background-color: ${$h.schematic.background}`,viewBox:`0 0 ${$i(B)} ${$i(Q)}`,"data-simulation-experiment-id":e,...h?.name&&{"data-simulation-experiment-name":h.name},...U&&{"data-software-used-string":U},...A&&{"data-circuit-to-svg-version":Y}},te);return $We(j)}var wMi=t=>{const e=E_e(t);return{...e,tickLabelOverrides:new Map(e.ticks.map(n=>[n,$i(10**n)]))}},PMi=1200,MMi=1200,$un=.55;function DMi({circuitJson:t,simulation_experiment_id:e,simulation_transient_current_graph_ids:n,simulation_transient_voltage_graph_ids:o,simulation_result_ids:i,ac_sweep_view:r,width:s=PMi,height:a=MMi,schematicHeightRatio:A=$un,schematicOptions:c,includeVersion:l,graphAboveSchematic:u=!1,showErrorsInTextOverlay:g}){const h=t.filter(F=>!Wun(F)&&!Jun(F)),d=RMi(A),p=Math.max(1,a*d),m=Math.max(1,a-p),_=p+m,f=_===0?1:a/_,I=p*f,C=m*f,y=Dun(h,{...c,width:s,height:I,includeVersion:!1,showErrorsInTextOverlay:g}),x=jun({circuitJson:t,simulation_experiment_id:e,simulation_transient_current_graph_ids:n,simulation_transient_voltage_graph_ids:o,simulation_result_ids:i,ac_sweep_view:r,width:s,height:C,includeVersion:!1}),E=uun($W(y)),B=uun($W(x)),S=NMi(B)??{width:s,height:C},Q=S.width>0?s*(S.height/S.width):C,w=I+Q,M=[];u?(M.push(m_e(B,0,0,s,Q)),M.push(m_e(E,0,Q,s,I))):(M.push(m_e(E,0,0,s,I)),M.push(m_e(B,0,I,s,Q)));const k=qWe(h),R={name:"svg",type:"element",value:"",attributes:{xmlns:"http://www.w3.org/2000/svg",width:f4(s),height:f4(w),viewBox:`0 0 ${f4(s)} ${f4(w)}`,"data-simulation-experiment-id":e,...k&&{"data-software-used-string":k},...l&&{"data-circuit-to-svg-version":XWe}},children:M};return $We(R)}function NMi(t){const e=t.attributes?.viewBox;if(typeof e!="string")return null;const n=e.trim().split(/[\s,]+/).map(r=>Number.parseFloat(r));if(n.length!==4)return null;const o=n.at(2),i=n.at(3);return!Number.isFinite(o)||!Number.isFinite(i)||o===void 0||i===void 0||o<=0||i<=0?null:{width:o,height:i}}function RMi(t){return Number.isFinite(t)?t<=0?0:t>=1?1:t:$un}var qun=({initialTransform:t,initialTouch1:e,initialTouch2:n,finalTouch1:o,finalTouch2:i})=>{if(!o||!i)return t;const r={x:(e.x+n.x)/2,y:(e.y+n.y)/2},s={x:(o.x+i.x)/2,y:(o.y+i.y)/2},a=Math.hypot(n.x-e.x,n.y-e.y),A=Math.hypot(i.x-o.x,i.y-o.y),c=a===0?1:A/a,l=s.x-r.x,u=s.y-r.y;return Ad(pA(l,u),pA(r.x,r.y),dC(c,c),pA(-r.x,-r.y),t)},YZ=(t={})=>{const e=ee.useRef(null),[n,o]=ee.useState(0),i=t.canvasElm??e.current,[r,s]=ee.useState(t.initialTransform??QQ()),[a,A]=ee.useState(0),[c,l]=ee.useReducer(I=>I+1,0),u=ee.useCallback(I=>{t.onSetTransform&&t.onSetTransform(I),t.transform||s(I)},[t.onSetTransform,s]),g=ee.useCallback(I=>{u(I),l()},[u]),h=t.transform??r,d=ee.useCallback(()=>{o(Date.now())},[]),p=ee.useRef("none"),m=ee.useRef(null),_=ee.useRef(null);ee.useEffect(()=>{const I=t.canvasElm??e.current;if(I&&!i){A(a+1);return}if(!I){const U=setTimeout(()=>{A(a+1)},100);return()=>clearTimeout(U)}let C=t.transform??r,y={x:0,y:0},x={x:0,y:0},E=!1;const B=U=>({x:U.pageX-I.getBoundingClientRect().left-window.scrollX,y:U.pageY-I.getBoundingClientRect().top-window.scrollY});function S(U){t.enabled!==!1&&(t.shouldDrag&&!t.shouldDrag(U)||(y=B(U),!(Date.now()-n<100)&&(E=!0,U.preventDefault())))}function Q(U){if(!E||t.enabled===!1||t.shouldDrag&&!t.shouldDrag(U))return;x=B(U);const Y=Ad(pA(x.x-y.x,x.y-y.y),C);u(Y),C=Y,E=!1}function w(U){if(B(U),!E||t.enabled===!1||t.shouldDrag&&!t.shouldDrag(U))return;x=B(U);const Y=Ad(pA(x.x-y.x,x.y-y.y),C);u(Y)}function M(U){if(t.enabled===!1||t.shouldDrag&&!t.shouldDrag(U))return;const Y=B(U),W=Ad(pA(Y.x,Y.y),dC(1-U.deltaY/1e3,1-U.deltaY/1e3),pA(-Y.x,-Y.y),C);u(W),C=W,U.preventDefault()}function k(U){if(!E||t.shouldDrag&&!t.shouldDrag(U))return;if(I){const W=I.getBoundingClientRect();if(U.clientX>=W.left+10&&U.clientX<=W.right-10&&U.clientY>=W.top+10&&U.clientY<=W.bottom-10)return}E=!1,x=B(U);const Y=Ad(pA(x.x-y.x,x.y-y.y),C);u(Y),C=Y}function R(U){if(U.preventDefault(),t.enabled!==!1){if(U.touches.length===1){p.current="drag";const Y=U.touches[0];m.current={initialTransform:C,initialTouch:{x:Y.clientX,y:Y.clientY}}}else if(U.touches.length===2){p.current="pinch";const Y=U.touches[0],W=U.touches[1];_.current={initialTransform:C,initialTouch1:{x:Y.clientX,y:Y.clientY},initialTouch2:{x:W.clientX,y:W.clientY},finalTouch1:null,finalTouch2:null}}}}function F(U){if(U.preventDefault(),t.enabled!==!1){if(p.current==="drag"&&U.touches.length===1&&m.current){const Y=U.touches[0],W={x:Y.clientX,y:Y.clientY},te=W.x-m.current.initialTouch.x,j=W.y-m.current.initialTouch.y,J=Ad(pA(te,j),m.current.initialTransform);u(J)}else if(p.current==="pinch"&&U.touches.length===2&&_.current){const Y=U.touches[0],W=U.touches[1];_.current.finalTouch1={x:Y.clientX,y:Y.clientY},_.current.finalTouch2={x:W.clientX,y:W.clientY};const te=qun(_.current);u(te)}}}function O(U){U.preventDefault();const Y=U.changedTouches[0];if(p.current==="drag"&&m.current&&Y){const W={x:Y.clientX,y:Y.clientY},te=W.x-m.current.initialTouch.x,j=W.y-m.current.initialTouch.y,J=Ad(pA(te,j),m.current.initialTransform);u(J),C=J}else if(p.current==="pinch"&&_.current){const W=qun(_.current);u(W),C=W}p.current="none",m.current=null,_.current=null}return I.addEventListener("mousedown",S),I.addEventListener("mouseup",Q),window.addEventListener("mousemove",w),I.addEventListener("mouseout",k),I.addEventListener("wheel",M),I.addEventListener("touchstart",R,{passive:!1}),I.addEventListener("touchmove",F,{passive:!1}),I.addEventListener("touchend",O,{passive:!1}),I.addEventListener("touchcancel",O,{passive:!1}),()=>{I.removeEventListener("mousedown",S),I.removeEventListener("mouseup",Q),window.removeEventListener("mousemove",w),I.removeEventListener("mouseout",k),I.removeEventListener("wheel",M),I.removeEventListener("touchstart",R),I.removeEventListener("touchmove",F),I.removeEventListener("touchend",O),I.removeEventListener("touchcancel",O)}},[i,a,c,n,t.enabled,t.shouldDrag]);const f=ee.useCallback(I=>Bn(h,I),[h]);return{ref:e,transform:h,applyTransformToPoint:f,setTransform:g,cancelDrag:d}},Xun=YZ;function cje(t){const e=O3(t),n=new Map;for(const s of e.schematic_component.list())s.source_component_id&&n.set(s.source_component_id,s.schematic_component_id);const o=new Map;for(const s of e.source_trace.list()){const a=s.subcircuit_connectivity_map_key;if(a)for(const A of s.connected_source_port_ids??[]){const c=n.get(e.source_port.get(A)?.source_component_id??"");c&&(o.has(c)||o.set(c,new Set),o.get(c).add(a))}}const i=new Map;for(const s of e.schematic_net_label.list()){if(!s.source_net_id)continue;const a=e.source_net.get(s.source_net_id)?.subcircuit_connectivity_map_key??s.source_net_id;i.set(s.schematic_net_label_id,a)}const r=new Map;for(const s of e.schematic_text.list()){if(!s.source_trace_id)continue;const a=e.source_trace.get(s.source_trace_id)?.subcircuit_connectivity_map_key;a&&r.set(s.schematic_text_id,a)}return{componentIdToKeys:o,netLabelIdToKey:i,textIdToKey:r}}var v_e=(t,e)=>Math.hypot(t.x-e.x,t.y-e.y),Zun=(t,e,n)=>{const o=n.x-e.x,i=n.y-e.y,r=o*o+i*i,s=r?Math.max(0,Math.min(1,((t.x-e.x)*o+(t.y-e.y)*i)/r)):0;return v_e(t,{x:e.x+s*o,y:e.y+s*i})},RT=(t,e,n)=>Math.abs(v_e(e,t)+v_e(t,n)-v_e(e,n))<1e-5;function TMi(t,e){const n=cje(e),o=t?.closest("[data-subcircuit-connectivity-map-key], [data-schematic-net-label-id], [data-schematic-text-id], [data-schematic-trace-id]");if(!o)return;const i=e.find(r=>r.type==="schematic_trace"&&r.schematic_trace_id===o.getAttribute("data-schematic-trace-id"));return o.getAttribute("data-subcircuit-connectivity-map-key")||n.netLabelIdToKey.get(o.getAttribute("data-schematic-net-label-id"))||n.textIdToKey.get(o.getAttribute("data-schematic-text-id"))||(i?.type==="schematic_trace"?i.subcircuit_connectivity_map_key||e.filter(r=>r.type==="source_trace").find(r=>r.source_trace_id===i.source_trace_id)?.subcircuit_connectivity_map_key:void 0)}function kMi(t,e){const n=cje(t),o=t.filter(u=>u.type==="source_trace"),i=t.filter(u=>u.type==="schematic_trace"),r=t.filter(u=>u.type==="schematic_sheet"),s=r[0]?.schematic_sheet_id,a=[];for(const u of i)if((u.subcircuit_connectivity_map_key??o.find(h=>h.source_trace_id===u.source_trace_id)?.subcircuit_connectivity_map_key)===e)for(const h of u.edges)a.push({a:h.from,b:h.to,sheet:u.schematic_sheet_id??s,target:{type:"schematic_trace",id:u.schematic_trace_id},sourceTraceId:u.source_trace_id,portIds:[h.from_schematic_port_id,h.to_schematic_port_id].filter(d=>!!d),junctions:u.junctions});for(const u of t)if(u.type==="schematic_net_label"&&n.netLabelIdToKey.get(u.schematic_net_label_id)===e){const g=u.anchor_position??u.center;a.push({a:g,b:g,sheet:u.schematic_sheet_id??s,target:{type:"schematic_net_label",id:u.schematic_net_label_id},name:u.text})}for(const u of t){if(u.type!=="schematic_text"||n.textIdToKey.get(u.schematic_text_id)!==e)continue;const g=u.schematic_sheet_id??s,d=a.filter(p=>p.sheet===g&&p.sourceTraceId===u.source_trace_id).sort((p,m)=>Zun(u.position,p.a,p.b)-Zun(u.position,m.a,m.b))[0]?.a??u.position;a.push({a:d,b:d,sheet:g,target:{type:"schematic_text",id:u.schematic_text_id},name:u.text})}const A=a.map((u,g)=>g),c=u=>A[u]===u?u:A[u]=c(A[u]);for(let u=0;u<a.length;u++)for(let g=0;g<u;g++){const h=a[u],d=a[g];h.sheet===d.sheet&&(RT(h.a,d.a,d.b)||RT(h.b,d.a,d.b)||RT(d.a,h.a,h.b)||RT(d.b,h.a,h.b)||[...h.junctions??[],...d.junctions??[]].some(p=>RT(p,h.a,h.b)&&RT(p,d.a,d.b)))&&(A[c(u)]=c(g))}const l=new Map;return a.forEach((u,g)=>l.set(c(g),[...l.get(c(g))??[],u])),[...l.values()].map((u,g)=>{const h=u.find(f=>f.target.type!=="schematic_trace")??u[0],p=t.filter(f=>f.type==="schematic_port").filter(f=>(f.schematic_sheet_id??s)===h.sheet&&u.some(I=>I.portIds?.includes(f.schematic_port_id)||RT(f.center,I.a,I.b))).map(f=>{const I=t.find(y=>y.type==="source_port"&&y.source_port_id===f.source_port_id);if(I?.type!=="source_port")return;const C=t.find(y=>y.type==="source_component"&&y.source_component_id===I.source_component_id);return C?.type==="source_component"?`${C.name}.${I.name??`pin${I.pin_number}`}`:void 0}).filter(f=>!!f).sort(),m=r.findIndex(f=>f.schematic_sheet_id===h.sheet);return{kind:"net",label:`${r[m]?.name??`Sheet ${Math.max(0,m)+1}`}: ${p[0]??h.name??`Location ${g+1}`}`,schematicSheetId:h.sheet,target:h.target,focusPoint:{x:(h.a.x+h.b.x)/2,y:(h.a.y+h.b.y)/2}}})}var FMi="https://jscdn.tscircuit.com/@tscircuit/circuit-json-schematic-placement-analysis/latest/dist/browser.js",LMi={async load(){const t=await import(FMi);if(typeof t.createSchematicPlacementIssueArtifacts!="function")throw new Error("The style analyzer module does not export its analysis function.");return t}},ME={contextMenu:110,styleAnalysis:120,viewMenu:55,viewMenuIcon:48,clickToInteractOverlay:100,schematicComponentDetailsTooltip:105,schematicComponentHoverOutline:47,schematicPortHoverOutline:48,schematicSearch:101},HMi=({circuitJson:t,onClose:e})=>{const[n,o]=ee.useState({status:"loading"});return ee.useEffect(()=>{let i=!1;const r=window.setTimeout(async()=>{try{const{createSchematicPlacementIssueArtifacts:s}=await LMi.load();if(i)return;const a=s(t);i||o({status:"complete",artifacts:a})}catch(s){i||o({status:"error",message:s instanceof Error?s.message:String(s)})}},0);return()=>{i=!0,window.clearTimeout(r)}},[t]),K.jsx(r_e,{open:!0,onOpenChange:i=>!i&&e(),children:K.jsxs(s_e,{children:[K.jsx(wZ,{style:{position:"fixed",inset:0,background:"#0008",zIndex:ME.styleAnalysis}}),K.jsxs(MZ,{style:{position:"fixed",top:"5vh",left:"50%",transform:"translateX(-50%)",width:"min(1000px, 94vw)",maxHeight:"90vh",overflowY:"auto",boxSizing:"border-box",padding:24,borderRadius:12,background:"#fafafa",color:"#171717",fontFamily:"system-ui, sans-serif",boxShadow:"0 20px 60px #0005",zIndex:ME.styleAnalysis},children:[K.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16},children:[K.jsx(a_e,{style:{margin:0,fontSize:22},children:"Style Analysis"}),K.jsx(VWe,{style:{cursor:"pointer",padding:"6px 12px"},children:"Close"})]}),K.jsx(A_e,{style:{color:"#525252"},children:"Placement and style issues across all schematic sheets. Each image highlights one issue with its description below."}),n.status==="loading"&&K.jsx("p",{role:"status",children:"Running style analysis…"}),n.status==="error"&&K.jsxs("p",{role:"alert",children:["Style analysis failed: ",n.message]}),n.status==="complete"&&K.jsxs(K.Fragment,{children:[K.jsx("p",{role:"status",children:n.artifacts.length===0?"No style issues found.":`${n.artifacts.length} style ${n.artifacts.length===1?"issue":"issues"} found.`}),n.artifacts.map(i=>K.jsxs("section",{style:{marginTop:24,border:"1px solid #ddd",borderRadius:8,overflow:"hidden",background:"white"},children:[K.jsxs("h3",{style:{margin:16,fontSize:16},children:[i.issueIndex+1,"."," ",i.issue.lineItemType.replace(/([a-z])([A-Z])/g,"$1 $2"),i.schematicSheetId&&K.jsxs("small",{style:{display:"block",marginTop:4,color:"#525252"},children:["Sheet: ",i.schematicSheetId]})]}),K.jsx("img",{src:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(i.content)}`,alt:i.descriptionXml,loading:"lazy",style:{display:"block",width:"100%",height:"auto"}})]},i.issueIndex))]})]})]})})},DU={IS_SHOWING_SCHEMATIC_GROUPS:"schematic_viewer_show_groups",IS_SHOWING_SCHEMATIC_PORTS:"schematic_viewer_show_ports",SELECTED_SCHEMATIC_SHEET:"schematic_viewer_selected_sheet"},egn=(t,e)=>{if(typeof window>"u")return e;try{const n=localStorage.getItem(t);return n!==null?JSON.parse(n):e}catch{return e}},tgn=(t,e)=>{if(!(typeof window>"u"))try{localStorage.setItem(t,JSON.stringify(e))}catch{}},OMi=t=>{if(typeof window>"u")return null;try{return localStorage.getItem(t)}catch{return null}},GMi=(t,e)=>{if(!(typeof window>"u"))try{localStorage.setItem(t,e)}catch{}},ngn=["#8B0000","#2F4F4F","#191970","#006400","#FF4500","#800080","#2E8B57","#B8860B","#C71585","#008B8B"],YMi=t=>{const{svgDivRef:e,circuitJson:n,circuitJsonKey:o,showGroups:i}=t;ee.useEffect(()=>{if(e.current&&e.current.querySelectorAll(".schematic-group-overlay").forEach(a=>a.remove()),!e.current||!i||!n||n.length===0)return;const r=setTimeout(()=>{if(!e.current)return;const s=e.current.querySelector("svg");if(!s)return;s.querySelectorAll(".schematic-group-overlay").forEach(A=>A.remove());try{const A=O3(n).source_group?.list().filter(f=>!f.is_subcircuit)||[],c=O3(n).schematic_component?.list()||[],l=new Map;A.forEach(f=>{const I=f;if(I.parent_source_group_id){const C=l.get(I.parent_source_group_id)||[];C.push(f.source_group_id),l.set(I.parent_source_group_id,C)}});const u=f=>{const I=[],C=l.get(f)||[];for(const y of C)I.push(y),I.push(...u(y));return I},g=f=>{const I=A.find(C=>C.source_group_id===f);return I?.parent_source_group_id?1+g(I.parent_source_group_id):0},h=A.length>0&&A.some(f=>f.name&&f.name.trim()!=="");let d=[];if(h){const f=new Map;for(const I of c){const C=O3(n).source_component.get(I.source_component_id);C?.source_group_id&&(f.has(C.source_group_id)||f.set(C.source_group_id,[]),f.get(C.source_group_id).push(I))}A.forEach((I,C)=>{let y=f.get(I.source_group_id)||[];const x=u(I.source_group_id);for(const E of x){const B=f.get(E)||[];y=[...y,...B]}if(y.length>0){const E=g(I.source_group_id),B=u(I.source_group_id).length>0;if(I.name?.startsWith("unnamed_board"))return;d.push({id:I.source_group_id,name:I.name||`Group ${C+1}`,components:y,color:ngn[C%ngn.length],depthLevel:E,hasChildren:B,sourceGroupId:I.source_group_id})}})}const p=s.viewBox.baseVal,m=s.getBoundingClientRect(),_=Math.min(m.width/p.width,m.height/p.height)||1;d.sort((f,I)=>f.depthLevel-I.depthLevel),d.forEach(f=>{if(f.components.length===0)return;const I=UMi(f.components,s);if(!I)return;const C=Math.max(8,Math.min(25,15/Math.max(_,.3))),y=f.hasChildren?C*.6:0,x=C+y,E=Math.max(1,2/Math.max(_,.5)),B=f.depthLevel===0?E:E*.7,S=Math.max(4,8/Math.max(_,.5)),Q=f.hasChildren?1.3:1,w=S*Q,M=w*.5,k=document.createElementNS("http://www.w3.org/2000/svg","rect");k.setAttribute("class","schematic-group-overlay"),k.setAttribute("x",(I.minX-x).toString()),k.setAttribute("y",(I.minY-x).toString()),k.setAttribute("width",(I.maxX-I.minX+x*2).toString()),k.setAttribute("height",(I.maxY-I.minY+x*2).toString()),k.setAttribute("fill","none"),k.setAttribute("stroke",f.color),k.setAttribute("stroke-width",B.toString()),k.setAttribute("stroke-dasharray",`${w},${M}`),k.setAttribute("opacity","0.8"),k.setAttribute("rx","0"),k.setAttribute("ry","0");const R=Math.max(6,Math.min(20,14/Math.max(_,.2))),F=f.depthLevel===0||f.depthLevel===1?0:f.depthLevel*.2,O=R*(1-F),U=Math.max(1,O*.2),Y=f.name,W=document.createElementNS("http://www.w3.org/2000/svg","text");W.setAttribute("font-size",O.toString()),W.setAttribute("font-family","Arial, sans-serif"),W.textContent=Y,s.appendChild(W);const te=W.getBBox();s.removeChild(W);const j=te.width+U*2,J=O+U*2,oe=I.minX-x,ie=I.minY-x-J,ne=document.createElementNS("http://www.w3.org/2000/svg","rect");ne.setAttribute("class","schematic-group-overlay"),ne.setAttribute("x",oe.toString()),ne.setAttribute("y",(ie-J).toString()),ne.setAttribute("width",j.toString()),ne.setAttribute("height",J.toString()),ne.setAttribute("fill","transparent"),ne.setAttribute("rx","0"),ne.setAttribute("ry","0");const le=document.createElementNS("http://www.w3.org/2000/svg","text");le.setAttribute("class","schematic-group-overlay"),le.setAttribute("x",(oe+U).toString()),le.setAttribute("y",(ie+J-U).toString()),le.setAttribute("fill",f.color),le.setAttribute("font-size",O.toString()),le.setAttribute("font-family","Arial, sans-serif"),le.setAttribute("font-weight",f.depthLevel===0?"600":"500"),le.setAttribute("stroke",f.color),le.setAttribute("stroke-width",Math.max(.2,O*.02).toString()),le.textContent=Y,s.appendChild(k),s.appendChild(ne),s.appendChild(le)})}catch(A){console.error("Error creating group overlays:",A)}},10);return()=>clearTimeout(r)},[e,o,i])};function UMi(t,e){let n=1/0,o=1/0,i=-1/0,r=-1/0;for(const a of t){let A=e.querySelector(`g[data-schematic-component-id="${a.schematic_component_id}"]`);if(A||(A=e.querySelector(`[data-schematic-component-id="${a.schematic_component_id}"]`)),A){const c=A.getBBox();n=Math.min(n,c.x),o=Math.min(o,c.y),i=Math.max(i,c.x+c.width),r=Math.max(r,c.y+c.height)}}return n===1/0?null:{minX:n,minY:o,maxX:i,maxY:r}}var lje="sch-net-faded",ogn="g.trace[data-subcircuit-connectivity-map-key], g.trace-overlays[data-subcircuit-connectivity-map-key]",uje="[data-schematic-net-label-id], [data-schematic-text-id]",KMi=({svgDivRef:t,circuitJson:e,circuitJsonKey:n,enabled:o})=>{ee.useEffect(()=>{const i=t.current;if(!o||!i)return;const{componentIdToKeys:r,netLabelIdToKey:s,textIdToKey:a}=cje(e);let A=[];const c=new Map;let l=null;const u=()=>{for(const{el:_}of A)_.classList.remove(lje);A=[],c.clear(),l=null;const m=i.querySelector("svg");if(m){for(const _ of Array.from(m.querySelectorAll(ogn))){const f=_.getAttribute("data-subcircuit-connectivity-map-key"),I=new Set;f&&(I.add(f),c.set(_,f)),A.push({el:_,keys:I})}for(const _ of Array.from(m.querySelectorAll("g[data-schematic-component-id]"))){const f=_.getAttribute("data-schematic-component-id");A.push({el:_,keys:r.get(f)??new Set})}for(const _ of Array.from(m.querySelectorAll(uje))){const f=s.get(_.getAttribute("data-schematic-net-label-id"))??a.get(_.getAttribute("data-schematic-text-id")),I=new Set;f&&(I.add(f),c.set(_,f)),A.push({el:_,keys:I})}}},g=m=>{if(m!==l){l=m;for(const{el:_,keys:f}of A)_.classList.toggle(lje,m!==null&&!f.has(m))}},h=m=>{const _=m.target;if(!(_ instanceof Element)){g(null);return}const f=_.closest(`${ogn}, ${uje}`);if(f&&c.has(f)){g(c.get(f));return}for(const[I,C]of c){if(!I.matches(uje))continue;const y=I.getBoundingClientRect();if(m.clientX>=y.left-6&&m.clientX<=y.right+6&&m.clientY>=y.top-6&&m.clientY<=y.bottom+6){g(C);return}}g(null)},d=()=>g(null);u(),i.addEventListener("mousemove",h),i.addEventListener("mouseleave",d);const p=new MutationObserver(u);return p.observe(i,{childList:!0}),()=>{p.disconnect(),i.removeEventListener("mousemove",h),i.removeEventListener("mouseleave",d);for(const{el:m}of A)m.classList.remove(lje)}},[t,n,o])},gje="http://www.w3.org/2000/svg",VMi=({svgDivRef:t,svgContent:e,circuitJsonKey:n})=>{const o=ee.useRef(new Set);ee.useLayoutEffect(()=>{o.current.clear()},[n]),ee.useLayoutEffect(()=>{const i=[];for(const r of t.current?.querySelectorAll(".schematic-warning")??[]){const s=r.getAttribute("data-warning-id"),a=r.querySelector('[data-warning-reference="callout"]');if(!s||!a)continue;const A=Array.from(r.children),c=A.map(I=>I.style.display),l=r.getAttribute("role"),u=r.getAttribute("aria-label")??"Warning",g=document.createElementNS(gje,"g");g.setAttribute("data-warning-icon",""),g.setAttribute("aria-hidden","true"),g.setAttribute("transform",`translate(${a.getAttribute("x")} ${a.getAttribute("y")})`);const h=document.createElementNS(gje,"rect");h.setAttribute("width","24"),h.setAttribute("height","24"),h.setAttribute("fill",a.getAttribute("fill")??"#fffaeb"),h.setAttribute("stroke",a.getAttribute("stroke")??"#d99a00"),h.setAttribute("stroke-width","1");const d=document.createElementNS(gje,"text");d.setAttribute("x","12"),d.setAttribute("y","12"),d.setAttribute("dominant-baseline","central"),d.setAttribute("text-anchor","middle"),d.setAttribute("font-size","16"),d.setAttribute("font-family","sans-serif"),d.setAttribute("font-weight","bold"),d.setAttribute("fill","#5c4300"),d.textContent="!",g.append(h,d),r.append(g),r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.style.cursor="pointer",r.style.outline="none";const p=()=>{const I=o.current.has(s);A.forEach((C,y)=>{C.style.display=I?"none":c[y]}),g.style.display=I?"":"none",r.setAttribute("aria-expanded",String(!I)),r.setAttribute("aria-label",`${I?"Expand":"Minimize"} warning: ${u}`)},m=I=>{I.preventDefault(),I.stopPropagation(),o.current.has(s)?o.current.delete(s):o.current.add(s),p()},_=I=>{(I.key==="Enter"||I.key===" ")&&(I.repeat?I.preventDefault():m(I))},f=I=>I.stopPropagation();r.addEventListener("click",m),r.addEventListener("keydown",_),r.addEventListener("mousedown",f),r.addEventListener("touchstart",f),p(),i.push(()=>{r.removeEventListener("click",m),r.removeEventListener("keydown",_),r.removeEventListener("mousedown",f),r.removeEventListener("touchstart",f),g.remove(),A.forEach((I,C)=>{I.style.display=c[C]}),l?r.setAttribute("role",l):r.removeAttribute("role"),r.setAttribute("aria-label",u),r.removeAttribute("aria-expanded"),r.removeAttribute("tabindex"),r.style.removeProperty("cursor"),r.style.removeProperty("outline")})}return()=>i.forEach(r=>r())},[t,e,n])},dje=t=>String(t??"").toLocaleLowerCase(),UZ=(t,e)=>{const n=dje(t);return n===e?0:n.startsWith(e)?1:n.includes(e)?2:Number.POSITIVE_INFINITY},zMi=t=>{if(t)return String(t).replace(/^simple_/,"").replaceAll("_"," ").replace(/\b\w/g,e=>e.toLocaleUpperCase())},JMi=(t,e,n)=>{let i=zMi(t?.ftype);t?.ftype==="simple_chip"&&t.manufacturer_part_number&&(i=t.manufacturer_part_number);const r=[];t?.display_name===n&&t.name!==n&&r.push(t.name);let s=t?.display_value;if(!s&&t){for(const a of["display_resistance","display_capacitance","display_inductance","display_frequency","symbol_display_value"])if(a in t){const A=t[a];if(typeof A=="string"){s=A;break}}}if(s??(s=e.symbol_display_value),i&&r.push(i),s&&r.push(s),!i&&!s&&t?.manufacturer_part_number&&r.push(t.manufacturer_part_number),r.length!==0)return r.join(" · ")},WMi=t=>t.type==="source_component"&&"source_component_id"in t,jMi=t=>t.type==="source_port",$Mi=t=>t.type==="source_trace",qMi=t=>t.type==="schematic_component",XMi=t=>t.type==="schematic_port",ZMi=t=>t.type==="schematic_net_label",eDi=t=>t.type==="schematic_sheet",hje=({schematicSheets:t,schematicSheetId:e})=>{if(!(t.length<=1||!e))return t.find(n=>n.schematic_sheet_id===e)?.name},tDi=(t,e)=>{const n=dje(e).trim();if(!n)return[];const o=new Map(t.filter(WMi).map(l=>[l.source_component_id,l])),i=new Map(t.filter(jMi).map(l=>[l.source_port_id,l])),r=t.filter(XMi),s=t.filter($Mi),a=t.filter(eDi),A=[],c=new Map;for(const l of t.filter(qMi)){const u=l.source_component_id?o.get(l.source_component_id):void 0,g=u?.display_name??u?.name??"Component",h=Math.min(UZ(u?.name,n),UZ(u?.display_name,n),UZ(u?.manufacturer_part_number,n));if(Number.isFinite(h)){const d={label:g,detail:JMi(u,l,g),kind:"component",schematicSheetId:l.schematic_sheet_id,schematicSheetName:hje({schematicSheets:a,schematicSheetId:l.schematic_sheet_id}),target:{type:"schematic_component",id:l.schematic_component_id}};A.push(d),c.set(d,h)}}for(const l of t.filter(ZMi)){if(!dje(l.text).includes(n))continue;const u=new Set;for(const I of s.filter(C=>C.connected_source_net_ids.includes(l.source_net_id)))for(const C of I.connected_source_port_ids)u.add(C);const g=l.anchor_position??l.center,h=r.filter(I=>u.has(I.source_port_id)&&(!l.schematic_sheet_id||!I.schematic_sheet_id||I.schematic_sheet_id===l.schematic_sheet_id)).map(I=>({port:I,distance:Math.hypot(I.center.x-g.x,I.center.y-g.y)})).filter(({distance:I})=>I<=1).sort((I,C)=>I.distance-C.distance)[0]?.port,d=h?i.get(h.source_port_id):void 0,p=d?.source_component_id?o.get(d.source_component_id):void 0,m=d?.name??(d?.pin_number!==void 0?`pin${d.pin_number}`:h?.display_pin_label),_=p?.name&&m?`Connected to ${p.name}.${m}`:void 0,f={label:l.text,detail:_,kind:"net",schematicSheetId:l.schematic_sheet_id,schematicSheetName:hje({schematicSheets:a,schematicSheetId:l.schematic_sheet_id}),target:{type:"schematic_net_label",id:l.schematic_net_label_id}};A.push(f),c.set(f,UZ(l.text,n))}for(const l of t){if(l.type!=="schematic_text"||!l.source_trace_id)continue;const u=UZ(l.text,n);if(!Number.isFinite(u))continue;const g={label:l.text,kind:"net",schematicSheetId:l.schematic_sheet_id,schematicSheetName:hje({schematicSheets:a,schematicSheetId:l.schematic_sheet_id}),target:{type:"schematic_text",id:l.schematic_text_id}};A.push(g),c.set(g,u)}return A.sort((l,u)=>(c.get(l)??Number.POSITIVE_INFINITY)-(c.get(u)??Number.POSITIVE_INFINITY)||l.label.localeCompare(u.label))},nDi=({containerRect:t,targetRect:e,visibleProjection:n,minimumScale:o})=>{const i=n.a||1,r={x:e.left+e.width/2-t.left,y:e.top+e.height/2-t.top},s={x:(r.x-n.e)/i,y:(r.y-n.f)/i},a=Math.max(i,o);return{a,b:0,c:0,d:a,e:t.width/2-s.x*a,f:t.height/2-s.y*a}},oDi=1.8,ign=350,iDi=({controller:t,circuitJson:e,circuitJsonKey:n,svgDivRef:o,containerRef:i,activeSheetId:r,hasMultipleSheets:s,handleSelectSheet:a,svgString:A,svgToScreenProjection:c,setSvgToScreenProjection:l,setIsInteractionEnabled:u})=>{const[g,h]=ee.useState(""),[d,p]=ee.useState(null),m=ee.useRef(null),_=ee.useMemo(()=>tDi(e,g),[e,n,g]),f=ee.useCallback(E=>{const B=o.current,S=i.current;if(!B||!S)return!1;const Q=`data-${E.target.type.replaceAll("_","-")}-id`,w=Array.from(B.querySelectorAll(`[${Q}]`)).find(O=>O.getAttribute(Q)===E.target.id);if(!w)return!1;let M=w.getBoundingClientRect();if(E.focusPoint){const O=w.closest("svg"),U=O?.getAttribute("data-real-to-screen-transform"),Y=O?.getScreenCTM?.();if(U&&Y){const W=Bn(Y,Bn(BV(U),E.focusPoint));M={left:W.x-1,top:W.y-1,width:2,height:2}}}const k=S.getBoundingClientRect();if(!k.width||!k.height||!M.width&&!M.height)return!1;m.current&&clearTimeout(m.current);let R=c;const F=getComputedStyle(B).transform;if(F&&F!=="none")try{R=BV(F),B.style.transition="none",B.style.transform=F,B.offsetWidth}catch{}return B.style.transition=`transform ${ign}ms ease-in-out`,B.offsetWidth,l(nDi({containerRect:k,targetRect:M,visibleProjection:R,minimumScale:oDi})),m.current=setTimeout(()=>{B.style.transition=""},ign),B.querySelectorAll(".schematic-search-match").forEach(O=>O.classList.remove("schematic-search-match")),B.querySelectorAll(`[${Q}]`).forEach(O=>{O.getAttribute(Q)===E.target.id&&O.classList.add("schematic-search-match")}),!0},[i,l,o,c]),I=ee.useCallback(E=>{if(u(!0),E.schematicSheetId&&E.schematicSheetId!==r&&s){a(E.schematicSheetId),p(E);return}f(E)},[r,f,a,s,u]),C=ee.useCallback(()=>{h(""),p(null),m.current&&(clearTimeout(m.current),m.current=null),o.current&&(o.current.style.transition="",o.current.querySelectorAll(".schematic-search-match").forEach(E=>E.classList.remove("schematic-search-match")))},[o]),y=t?.focusRequest,x=t?.onFocusRequestHandled;return ee.useEffect(()=>{if(!y)return;const E=e.find(B=>B.type==="schematic_component"&&B.schematic_component_id===y.schematicComponentId);if(E?.type!=="schematic_component"){p(null),x?.(y);return}u(!0),E.schematic_sheet_id&&s&&a(E.schematic_sheet_id),p({kind:"component",label:E.schematic_component_id,schematicSheetId:E.schematic_sheet_id,target:{type:"schematic_component",id:E.schematic_component_id}})},[y,x,e,n,s,a,u]),ee.useEffect(()=>{if(!d||!A||s&&d.schematicSheetId&&d.schematicSheetId!==r)return;const E=requestAnimationFrame(()=>{f(d)&&(p(null),y?.schematicComponentId===d.target.id&&x?.(y))});return()=>cancelAnimationFrame(E)},[f,y,x,d,A,s,r]),ee.useEffect(()=>{g||o.current?.querySelectorAll(".schematic-search-match").forEach(E=>E.classList.remove("schematic-search-match"))},[g,o]),ee.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),{searchQuery:g,setSearchQuery:h,searchResults:_,handleSearchResultSelect:I,handleCancelSearch:C}};vc("schematic-viewer");var rDi=()=>{vc.enable("schematic-viewer*")},rgn=t=>{const[e,n]=ee.useState(0),[o,i]=ee.useState(0);return ee.useEffect(()=>{if(!t.current)return;const r=()=>{const a=t.current?.getBoundingClientRect();n(a?.width||0),i(a?.height||0)};r();const s=new ResizeObserver(r);return s.observe(t.current),window.addEventListener("resize",r),()=>{s.disconnect(),window.removeEventListener("resize",r)}},[]),{containerWidth:e,containerHeight:o}},sDi=600,w_e=10,aDi=({containerRef:t})=>{const[e,n]=ee.useState(null),[o,i]=ee.useState(!1),[r,s]=ee.useState({x:0,y:0}),a=ee.useRef(null),A=ee.useRef(null),c=ee.useRef(null),l=ee.useRef(0),u=ee.useCallback(()=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null)},[]),g=ee.useCallback(_=>{if(_.preventDefault(),Date.now()<l.current)return;const f=A.current;if(!f)return;const I=Math.abs(_.clientX-f.x)>w_e||Math.abs(_.clientY-f.y)>w_e;A.current=null,!I&&(n(_.target instanceof Element?_.target:null),s({x:_.clientX,y:_.clientY}),i(!0))},[]),h=ee.useCallback(_=>{if(u(),_.touches.length!==1){A.current=null;return}const f=_.touches[0];if(!f)return;const I=_.target instanceof Element?_.target:null;A.current={x:f.clientX,y:f.clientY},c.current=window.setTimeout(()=>{const C=t.current;if(!C||!A.current)return;n(I);const y=C.getBoundingClientRect();s({x:y.left+y.width/2,y:y.top+y.height/2}),i(!0),l.current=Date.now()+1e3,A.current=null},sDi)},[u,t]),d=ee.useCallback(_=>{const f=A.current;if(!f||_.touches.length!==1)return;const I=_.touches[0];(!I||Math.abs(I.clientX-f.x)>w_e||Math.abs(I.clientY-f.y)>w_e)&&(A.current=null,u())},[u]),p=ee.useCallback(()=>{u(),A.current=null},[u]),m=ee.useCallback(_=>{const f=_.target;a.current?.contains(f)||f.closest?.("[data-radix-popper-content-wrapper], [data-radix-dropdown-menu-content]")||i(!1)},[]);return ee.useEffect(()=>{if(o)return document.addEventListener("mousedown",m),document.addEventListener("touchstart",m),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("touchstart",m)}},[m,o]),ee.useEffect(()=>u,[u]),{menuVisible:o,menuTarget:e,menuPos:r,menuRef:a,setMenuVisible:i,contextMenuEventHandlers:{onMouseDown:_=>{A.current=_.button===2||_.button===0&&_.ctrlKey?{x:_.clientX,y:_.clientY}:null},onContextMenu:g,onTouchStart:h,onTouchMove:d,onTouchEnd:p,onTouchCancel:p}}},ADi=(t,e,n)=>t.filter(o=>{if(!o.type.endsWith("_warning"))return!1;const i=o;return[["source_component",e.source_component_id],["schematic_component",e.schematic_component_id],["pcb_component",n?.pcb_component_id]].some(([s,a])=>{if(!a)return!1;const A=i[`${s}_ids`];return i[`${s}_id`]===a||Array.isArray(A)&&A.includes(a)||i.schematic_element_type===s&&i.schematic_element_id===a})}),cDi=new Set(["type","source_component_id","source_group_id","subcircuit_id","display_name","ftype","are_pins_interchangeable","supplier_part_numbers"]),sgn=["name","resistance","capacitance","inductance","frequency","voltage","current","max_voltage_rating","max_current_rating","power_rating","manufacturer_part_number"],lDi={jlcpcb:t=>`https://jlcpcb.com/partdetail/${encodeURIComponent(t)}`,lcsc:t=>`https://www.lcsc.com/product-detail/${encodeURIComponent(t)}.html`},uDi=t=>{const e=t.trim(),n=/^c?(\d+)$/i.exec(e);return n?`C${n[1]}`:e},agn=t=>{const e=sgn.indexOf(t);return e===-1?sgn.length:e},gDi=(t,e,n)=>{if(e==="name")return String(n);const o=t[`display_${e}`];if(typeof o=="string"&&o.trim()){const i=e==="resistance"?o.replace(/Ω$/,""):o;return JSON.stringify(i)}return JSON.stringify(n)??String(n)},dDi=t=>Object.entries(t).filter(([e,n])=>cDi.has(e)||e.startsWith("display_")&&e.slice(8)in t?!1:n!=null&&n!=="").sort(([e],[n])=>agn(e)-agn(n)||e.localeCompare(n)).map(([e,n])=>({key:e,label:e,value:gDi(t,e,n)})),hDi=t=>{const e=t.supplier_part_numbers;return e?["jlcpcb","lcsc"].flatMap(n=>{const o=e[n];if(!Array.isArray(o))return[];const i=[...new Set(o.filter(r=>!!(typeof r=="string"&&r.trim())).map(uDi))];return i.length?[{key:`supplier_part_numbers.${n}`,label:n,links:i.map(r=>({partNumber:r,href:lDi[n](r)}))}]:[]}):[]},pDi=(t,e)=>{const n=t.find(A=>A.type==="schematic_component"&&A.schematic_component_id===e);if(!n)return null;const o=t.find(A=>A.type==="source_component"&&A.source_component_id===n.source_component_id);if(!o)return null;const i=t.find(A=>A.type==="pcb_component"&&A.source_component_id===o.source_component_id),r=t.find(A=>A.type==="cad_component"&&A.source_component_id===o.source_component_id&&(!i||A.pcb_component_id===i.pcb_component_id)),s=i?.footprinter_string??r?.footprinter_string,a=i?mDi(t,i.pcb_component_id):null;return{schematicComponent:n,sourceComponent:o,pcbComponent:i,footprinterString:s,footprintPreviewCircuitJson:a?.circuitJson,footprintPreviewViewBox:a?.viewBox,warnings:ADi(t,n,i)}},P_e=2,mDi=(t,e)=>{const n=t.find(r=>r.type==="pcb_component"&&r.pcb_component_id===e);if(!n)return null;const o=q0n(n);if(!o)return null;const i={minX:o.minX-P_e,minY:o.minY-P_e,maxX:o.maxX+P_e,maxY:o.maxY+P_e};return{circuitJson:Bwi(t,i),viewBox:i}},_Di=t=>{let e="";for(let o=0;o<t.length;o+=8192)e+=String.fromCharCode(...t.subarray(o,o+8192));return btoa(e)},fDi=(t,e)=>{const n=_Di(RQe(TQe(JSON.stringify(t)))),o=new URL("https://svg.tscircuit.com/");return o.searchParams.set("svg_type","pcb"),o.searchParams.set("circuit_json",n),o.searchParams.set("viewbox",[e.minX,e.minY,e.maxX,e.maxY].join(",")),o.searchParams.set("background_color","#f8fafc"),o.toString()},pje=ee.createContext(null),IDi=5,CDi=(t,e)=>!t&&!e?!0:!t||!e?!1:t.minX===e.minX&&t.maxX===e.maxX&&t.minY===e.minY&&t.maxY===e.maxY,yDi=({children:t})=>ee.useContext(pje)?K.jsx(K.Fragment,{children:t}):K.jsx(xDi,{children:t}),xDi=({children:t})=>{const e=ee.useRef({pointer:null,boundingBoxes:new Map,hoveringIds:new Set,subscribers:new Set,mouseDownPosition:null}),n=ee.useCallback(()=>{for(const l of e.current.subscribers)l()},[]),o=ee.useCallback(()=>{const l=e.current.pointer,u=new Set;if(l)for(const[h,d]of e.current.boundingBoxes){const p=d.bounds;p&&l.x>=p.minX&&l.x<=p.maxX&&l.y>=p.minY&&l.y<=p.maxY&&u.add(h)}const g=e.current.hoveringIds;u.size===g.size&&[...u].every(h=>g.has(h))||(e.current.hoveringIds=u,n())},[n]),i=ee.useCallback((l,u)=>{e.current.boundingBoxes.set(l,u),o()},[o]),r=ee.useCallback((l,u)=>{const g=e.current.boundingBoxes.get(l);g&&CDi(g.bounds,u.bounds)&&g.onClick===u.onClick||(e.current.boundingBoxes.set(l,u),o())},[o]),s=ee.useCallback(l=>{e.current.boundingBoxes.delete(l)&&o()},[o]),a=ee.useCallback(l=>(e.current.subscribers.add(l),()=>{e.current.subscribers.delete(l)}),[]),A=ee.useCallback(l=>e.current.hoveringIds.has(l),[]);ee.useEffect(()=>{const l=d=>{const{clientX:p,clientY:m}=d,_=e.current.pointer;_&&_.x===p&&_.y===m||(e.current.pointer={x:p,y:m},o())},u=()=>{e.current.pointer!==null&&(e.current.pointer=null,e.current.mouseDownPosition=null,o())},g=d=>{e.current.mouseDownPosition={x:d.clientX,y:d.clientY}},h=d=>{const{clientX:p,clientY:m}=d,_=e.current.mouseDownPosition;if(_&&Math.sqrt(Math.pow(p-_.x,2)+Math.pow(m-_.y,2))>IDi){e.current.mouseDownPosition=null;return}e.current.mouseDownPosition=null;for(const f of e.current.boundingBoxes.values()){const I=f.bounds;I&&p>=I.minX&&p<=I.maxX&&m>=I.minY&&m<=I.maxY&&f.onClick?.(d)}};return window.addEventListener("pointermove",l,{passive:!0}),window.addEventListener("pointerdown",l,{passive:!0}),window.addEventListener("pointerup",l,{passive:!0}),window.addEventListener("pointerleave",u),window.addEventListener("pointercancel",u),window.addEventListener("blur",u),window.addEventListener("mousedown",g,{passive:!0}),window.addEventListener("click",h,{passive:!0}),()=>{window.removeEventListener("pointermove",l),window.removeEventListener("pointerdown",l),window.removeEventListener("pointerup",l),window.removeEventListener("pointerleave",u),window.removeEventListener("pointercancel",u),window.removeEventListener("blur",u),window.removeEventListener("mousedown",g),window.removeEventListener("click",h)}},[o]);const c=ee.useMemo(()=>({registerBoundingBox:i,updateBoundingBox:r,unregisterBoundingBox:s,subscribe:a,isHovering:A}),[i,r,s,a,A]);return K.jsx(pje.Provider,{value:c,children:t})},mje={color:"#64748b",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace',fontSize:"12px",lineHeight:1.45},EDi=({sourceComponent:t,warnings:e=[],footprinterString:n,footprintPreviewCircuitJson:o,footprintPreviewViewBox:i,left:r,top:s,width:a,maxHeight:A})=>{const c=ee.useMemo(()=>dDi(t),[t]),l=ee.useMemo(()=>hDi(t),[t]),u=ee.useMemo(()=>o?.length&&i?fDi(o,i):void 0,[o,i]);return K.jsxs("dialog",{open:!0,"aria-label":`${t.name} component details`,"data-schematic-component-details-tooltip":!0,style:{position:"absolute",left:r,right:"auto",top:s,bottom:"auto",width:a,maxHeight:A,margin:0,padding:0,overflowY:"auto",boxSizing:"border-box",border:"1px solid #cbd5e1",borderRadius:"4px",backgroundColor:"rgba(255, 255, 255, 0.98)",boxShadow:"0 20px 25px -5px rgba(15, 23, 42, 0.18), 0 8px 10px -6px rgba(15, 23, 42, 0.12)",color:"#0f172a",fontFamily:'Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',pointerEvents:"auto",userSelect:"text",WebkitUserSelect:"text",zIndex:ME.schematicComponentDetailsTooltip},onMouseDown:g=>g.stopPropagation(),onClick:g=>g.stopPropagation(),children:[K.jsxs("dl",{style:{display:"grid",gridTemplateColumns:"minmax(110px, 0.8fr) minmax(0, 1.2fr)",gap:"6px 12px",margin:0,padding:"8px"},children:[c.map(g=>K.jsxs("div",{style:{display:"contents"},children:[K.jsx("dt",{style:mje,children:g.label}),K.jsx("dd",{style:{minWidth:0,margin:0,color:"#1e293b",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace',fontSize:"12px",lineHeight:1.45,overflowWrap:"anywhere"},children:g.value})]},g.key)),l.map(g=>K.jsxs("div",{style:{display:"contents"},children:[K.jsx("dt",{style:mje,children:g.label}),K.jsx("dd",{style:{minWidth:0,margin:0,fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace',fontSize:"12px",lineHeight:1.45,overflowWrap:"anywhere"},children:g.links.map((h,d)=>K.jsxs("span",{children:[d>0&&", ",K.jsx("a",{href:h.href,target:"_blank",rel:"noreferrer noopener",style:{color:"#2563eb",textDecoration:"underline"},children:h.partNumber})]},h.href))})]},g.key)),n&&K.jsxs("div",{style:{display:"contents"},children:[K.jsx("dt",{style:mje,children:"footprint"}),K.jsx("dd",{style:{minWidth:0,margin:0,color:"#1e293b",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace',fontSize:"12px",lineHeight:1.45,overflowWrap:"anywhere"},children:JSON.stringify(n)})]})]}),e.length>0&&K.jsxs("section",{"aria-label":"Component warnings",style:{margin:"0 8px 8px",padding:"8px",border:"1px solid #fcd34d",borderRadius:"4px",backgroundColor:"#fffbeb",color:"#92400e",fontSize:"12px",lineHeight:1.45,overflowWrap:"anywhere"},children:[K.jsxs("strong",{children:["Warnings (",e.length,")"]}),K.jsx("ul",{style:{margin:"4px 0 0",paddingLeft:"18px"},children:e.map((g,h)=>K.jsx("li",{children:g.message},`${g.type}-${h}`))})]}),u&&K.jsx("div",{style:{padding:"0 4px 4px"},children:K.jsx("div",{style:{height:"210px",overflow:"hidden",border:"1px solid #e2e8f0",borderRadius:"2px",background:"#f8fafc"},children:K.jsx("img",{src:u,alt:`${t.name}${n?` ${n}`:""} PCB footprint`,loading:"lazy",referrerPolicy:"no-referrer",style:{display:"block",width:"100%",height:"100%",objectFit:"contain"}})})})]})},Agn=t=>{const e=ee.useContext(pje);if(!e)throw new Error("useMouseEventsOverBoundingBox must be used within a MouseTracker");const n=ee.useId(),o=ee.useRef(t);o.current=t;const i=ee.useMemo(()=>s=>{o.current.onClick?.(s)},[]);return ee.useEffect(()=>(e.registerBoundingBox(n,{bounds:o.current.bounds,onClick:o.current.onClick?i:void 0}),()=>{e.unregisterBoundingBox(n)}),[e,i,n]),ee.useEffect(()=>{e.updateBoundingBox(n,{bounds:o.current.bounds,onClick:o.current.onClick?i:void 0})},[e,i,n,t.bounds?.minX,t.bounds?.maxX,t.bounds?.minY,t.bounds?.maxY,t.onClick]),{hovering:ee.useSyncExternalStore(e.subscribe,()=>e.isHovering(n),()=>!1)}},BDi=(t,e)=>!t&&!e?!0:!t||!e?!1:Math.abs(t.bounds.minX-e.bounds.minX)<.5&&Math.abs(t.bounds.maxX-e.bounds.maxX)<.5&&Math.abs(t.bounds.minY-e.bounds.minY)<.5&&Math.abs(t.bounds.maxY-e.bounds.maxY)<.5&&Math.abs(t.rect.left-e.rect.left)<.5&&Math.abs(t.rect.top-e.rect.top)<.5&&Math.abs(t.rect.width-e.rect.width)<.5&&Math.abs(t.rect.height-e.rect.height)<.5,bDi=({componentId:t,svgDivRef:e,containerRef:n,onComponentClick:o,onHoverChange:i,showOutline:r,circuitJsonKey:s})=>{const[a,A]=ee.useState(null),c=ee.useRef(null),l=ee.useCallback(()=>{c.current=null;const m=e.current,_=n.current;if(!m||!_){A(x=>x&&null);return}const f=m.querySelector(`[data-schematic-component-id="${t}"]`);if(!f){A(x=>x&&null);return}const I=f.getBoundingClientRect(),C=_.getBoundingClientRect(),y={bounds:{minX:I.left,maxX:I.right,minY:I.top,maxY:I.bottom},rect:{left:I.left-C.left,top:I.top-C.top,width:I.width,height:I.height}};A(x=>BDi(x,y)?x:y)},[t,n,e]),u=ee.useCallback(()=>{c.current===null&&(c.current=window.requestAnimationFrame(l))},[l]);ee.useEffect(()=>{u()},[u,s]),ee.useEffect(()=>{u();const m=e.current,_=n.current;if(!m||!_)return;const f=typeof ResizeObserver<"u"?new ResizeObserver(()=>{u()}):null;f?.observe(_),f?.observe(m);const I=typeof MutationObserver<"u"?new MutationObserver(()=>{u()}):null;return I?.observe(m,{attributes:!0,attributeFilter:["style","transform"],subtree:!0,childList:!0}),window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{f?.disconnect(),I?.disconnect(),window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u),c.current!==null&&(cancelAnimationFrame(c.current),c.current=null)}},[u,e,n]);const g=ee.useCallback(m=>{o&&o(t,m)},[t,o]),h=a?.bounds??null,{hovering:d}=Agn({bounds:h,onClick:o?g:void 0});if(ee.useEffect(()=>{i&&i(t,d)},[d,t,i]),!a||!d||!r)return null;const p=a.rect;return K.jsx("div",{style:{position:"absolute",left:p.left,top:p.top,width:p.width,height:p.height,border:"1.5px solid rgba(51, 153, 255, 0.9)",pointerEvents:"none",zIndex:ME.schematicComponentHoverOutline}})},SDi=(t,e)=>!t&&!e?!0:!t||!e?!1:Math.abs(t.bounds.minX-e.bounds.minX)<.5&&Math.abs(t.bounds.maxX-e.bounds.maxX)<.5&&Math.abs(t.bounds.minY-e.bounds.minY)<.5&&Math.abs(t.bounds.maxY-e.bounds.maxY)<.5&&Math.abs(t.rect.left-e.rect.left)<.5&&Math.abs(t.rect.top-e.rect.top)<.5&&Math.abs(t.rect.width-e.rect.width)<.5&&Math.abs(t.rect.height-e.rect.height)<.5,QDi=({portId:t,portLabel:e,svgDivRef:n,containerRef:o,onPortClick:i,onHoverChange:r,showOutline:s,circuitJsonKey:a})=>{const[A,c]=ee.useState(null),l=ee.useRef(null),u=ee.useCallback(()=>{l.current=null;const _=n.current,f=o.current;if(!_||!f){c(B=>B&&null);return}const I=_.querySelector(`[data-schematic-port-id="${t}"]`);if(!I){c(B=>B&&null);return}const C=I.getBoundingClientRect(),y=f.getBoundingClientRect(),x=4,E={bounds:{minX:C.left-x,maxX:C.right+x,minY:C.top-x,maxY:C.bottom+x},rect:{left:C.left-y.left-x,top:C.top-y.top-x,width:C.width+x*2,height:C.height+x*2}};c(B=>SDi(B,E)?B:E)},[t,o,n]),g=ee.useCallback(()=>{l.current===null&&(l.current=window.requestAnimationFrame(u))},[u]);ee.useEffect(()=>{g()},[g,a]),ee.useEffect(()=>{g();const _=n.current,f=o.current;if(!_||!f)return;const I=typeof ResizeObserver<"u"?new ResizeObserver(()=>{g()}):null;I?.observe(f),I?.observe(_);const C=typeof MutationObserver<"u"?new MutationObserver(()=>{g()}):null;return C?.observe(_,{attributes:!0,attributeFilter:["style","transform"],subtree:!0,childList:!0}),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),()=>{I?.disconnect(),C?.disconnect(),window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),l.current!==null&&(cancelAnimationFrame(l.current),l.current=null)}},[g,n,o]);const h=ee.useCallback(_=>{i&&i(t,_)},[t,i]),d=A?.bounds??null,{hovering:p}=Agn({bounds:d,onClick:i?h:void 0});if(ee.useEffect(()=>{r&&r(t,p)},[p,t,r]),!A||!s)return null;const m=A.rect;return K.jsxs(K.Fragment,{children:[K.jsx("div",{style:{position:"absolute",left:m.left,top:m.top,width:m.width,height:m.height,border:p?"1.5px solid rgba(255, 153, 51, 0.9)":"1.5px solid rgba(255, 153, 51, 0.3)",backgroundColor:p?"rgba(255, 153, 51, 0.15)":"rgba(255, 153, 51, 0.05)",borderRadius:"50%",pointerEvents:"none",zIndex:ME.schematicPortHoverOutline,transition:"border-color 0.15s, background-color 0.15s"}}),p&&e&&K.jsx("div",{style:{position:"absolute",left:m.left+m.width/2,top:m.top-24,transform:"translateX(-50%)",backgroundColor:"rgba(0, 0, 0, 0.85)",color:"white",padding:"4px 8px",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",whiteSpace:"nowrap",pointerEvents:"none",zIndex:ME.schematicPortHoverOutline+1},children:e})]})},KZ=({children:t,size:e,strokeWidth:n})=>K.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t}),cgn=t=>K.jsxs(KZ,{...t,children:[K.jsx("circle",{cx:"11",cy:"11",r:"8"}),K.jsx("path",{d:"m21 21-4.34-4.34"})]}),vDi=t=>K.jsxs(KZ,{...t,children:[K.jsx("path",{d:"M18 6 6 18"}),K.jsx("path",{d:"m6 6 12 12"})]}),wDi=t=>K.jsxs(KZ,{...t,children:[K.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),K.jsx("rect",{x:"8",y:"8",width:"8",height:"8",rx:"1"}),K.jsx("path",{d:"M7 2v2M12 2v2M17 2v2M7 20v2M12 20v2M17 20v2M2 7h2M2 12h2M2 17h2M20 7h2M20 12h2M20 17h2"})]}),PDi=t=>K.jsxs(KZ,{...t,children:[K.jsx("path",{d:"M15 6a9 9 0 0 0-9 9V3"}),K.jsx("circle",{cx:"18",cy:"6",r:"3"}),K.jsx("circle",{cx:"6",cy:"18",r:"3"})]}),MDi=t=>K.jsxs(KZ,{...t,children:[K.jsx("path",{d:"M20 4v7a4 4 0 0 1-4 4H4"}),K.jsx("path",{d:"m9 10-5 5 5 5"})]}),DDi=({text:t,query:e})=>{const n=e.trim().toLocaleLowerCase();if(!n)return t;const o=t.toLocaleLowerCase(),i=[];let r=0,s=o.indexOf(n);for(;s!==-1;)s>r&&i.push(t.slice(r,s)),i.push(K.jsx("strong",{style:{fontWeight:700},children:t.slice(s,s+n.length)},`${s}-${r}`)),r=s+n.length,s=o.indexOf(n,r);return r<t.length&&i.push(t.slice(r)),i.length>0?i:t},NDi=()=>typeof navigator>"u"?"Ctrl F":/mac/i.test(navigator.platform)?"⌘ F":"Ctrl F",RDi=({query:t,onQueryChange:e,onCancel:n,results:o,onSelect:i,viewerContainerRef:r})=>{const[s,a]=ee.useState(!1),[A,c]=ee.useState(null),[l,u]=ee.useState(null),g=ee.useRef(null),h=ee.useRef(null),d=NDi();ee.useEffect(()=>{c(S=>o.some(Q=>Q.target.id===S)?S:o.find(Q=>Q.kind==="component")?.target.id??o[0]?.target.id??null)},[o]),ee.useEffect(()=>{A&&h.current?.querySelector(`[data-search-result-id="${A}"]`)?.scrollIntoView({behavior:"smooth",block:"nearest"})},[A]),ee.useEffect(()=>{const S=w=>{if(w.key==="Escape"&&s){w.preventDefault(),w.stopPropagation(),w.stopImmediatePropagation(),n(),a(!1),g.current?.blur();return}w.code!=="KeyF"&&w.key.toLocaleLowerCase()!=="f"||!w.metaKey&&!w.ctrlKey||r.current?.matches(":hover")&&(w.preventDefault(),w.stopPropagation(),w.stopImmediatePropagation(),a(!0),requestAnimationFrame(()=>{g.current?.focus(),g.current?.select()}))},Q=[window];try{window.parent!==window&&window.parent.document&&Q.push(window.parent)}catch{}return Q.forEach(w=>w.addEventListener("keydown",S,{capture:!0})),()=>{Q.forEach(w=>w.removeEventListener("keydown",S,{capture:!0}))}},[s,n,r]);const p=()=>{n(),a(!1),g.current?.blur()},m=S=>{a(!0),S&&requestAnimationFrame(()=>g.current?.focus())},_=o.filter(S=>S.kind==="component"),f=o.filter(S=>S.kind==="net"),I=[..._,...f],C=I.find(S=>S.target.id===A)??I[0],y=o.length===1?"1 result":`${o.length} results`;let x="none";t&&(x="1px solid #e8e8e8");const E=S=>{if(!(S.key==="Enter"&&S.target instanceof Element&&S.target.closest('[aria-label="Clear search"]'))){if(S.key==="Escape"){S.preventDefault(),p();return}if(I.length>0&&(S.key==="ArrowDown"||S.key==="ArrowUp")){S.preventDefault();let Q=-1;S.key==="ArrowDown"&&(Q=1),c(w=>{const M=I.findIndex(F=>F.target.id===w);let k=M;M===-1&&(k=0,Q===1&&(k=-1));const R=(k+Q+I.length)%I.length;return I[R]?.target.id??null});return}S.key==="Enter"&&C&&(S.preventDefault(),i(C))}},B=(S,Q)=>Q.length===0?null:K.jsxs("section",{children:[K.jsx("div",{style:{padding:"6px 12px 3px",backgroundColor:"#f7f7f8",color:"#777777",fontSize:"11px",fontWeight:600,letterSpacing:"0.02em",textTransform:"lowercase"},children:S}),Q.map(w=>{const M=w.target.id===C?.target.id,k=w.target.id===l;let R="#ffffff";(k||M)&&(R="#f1f3f5");let F=K.jsx(PDi,{size:15,strokeWidth:1.8});w.kind==="component"&&(F=K.jsx(wDi,{size:15,strokeWidth:1.8}));const O=()=>{g.current?.blur(),c(w.target.id),i(w)};return K.jsxs("button",{type:"button","data-search-result-id":w.target.id,onPointerUp:U=>{U.button===0&&O()},onClick:U=>{U.detail===0&&O()},onMouseEnter:()=>u(w.target.id),onMouseLeave:()=>u(null),style:{width:"100%",display:"flex",alignItems:"center",gap:"9px",padding:"7px 12px",border:"none",background:R,color:"#222222",cursor:"pointer",textAlign:"left"},children:[K.jsx("span",{style:{width:"26px",height:"26px",flexShrink:0,display:"grid",placeItems:"center",border:"1px solid #e5e5e5",borderRadius:"6px",backgroundColor:"#f7f7f7",color:"#666666"},children:F}),K.jsxs("span",{style:{minWidth:0,flex:1},children:[K.jsx("span",{style:{display:"block",overflow:"hidden",fontSize:"13px",fontWeight:400,lineHeight:1.25,textOverflow:"ellipsis",whiteSpace:"nowrap"},children:K.jsx(DDi,{text:w.label,query:t})}),w.detail&&K.jsx("span",{style:{display:"block",overflow:"hidden",marginTop:"2px",color:"#777777",fontSize:"11px",lineHeight:1.2,textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w.detail}),w.schematicSheetName&&K.jsxs("span",{style:{display:"block",overflow:"hidden",marginTop:"2px",color:"#777777",fontSize:"11px",lineHeight:1.2,textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["Sheet: ",w.schematicSheetName]})]}),M&&K.jsx("span",{title:"Press Enter to open",style:{flexShrink:0,color:"#666666",fontSize:"17px",lineHeight:1},children:K.jsx(MDi,{size:14,strokeWidth:1.8})})]},w.target.id)})]});return K.jsx("div",{"data-schematic-search":!0,onPointerDown:S=>S.stopPropagation(),onMouseDown:S=>S.stopPropagation(),onTouchStart:S=>S.stopPropagation(),onTouchEnd:S=>S.stopPropagation(),style:{position:"relative",zIndex:ME.schematicSearch,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'},children:s?K.jsxs("div",{onKeyDown:E,style:{width:"min(280px, calc(100vw - 32px))",overflow:"hidden",border:"none",borderRadius:"4px",backgroundColor:"#ffffff",boxShadow:"0 2px 4px rgba(0,0,0,0.1)"},children:[K.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",height:"32px",boxSizing:"border-box",padding:"0 12px",borderBottom:x},children:[K.jsx(cgn,{size:15,strokeWidth:2}),K.jsx("input",{ref:g,value:t,"aria-label":"Search components and nets",placeholder:"Search...",onPointerUp:S=>S.currentTarget.focus(),onChange:S=>e(S.target.value),style:{minWidth:0,flex:1,border:"none",outline:"none",fontSize:"13px",color:"#222222",background:"transparent"}}),t&&o.length>0?K.jsx("span",{style:{flexShrink:0,color:"#888888",fontSize:"12px",whiteSpace:"nowrap"},children:y}):K.jsx("kbd",{style:{flexShrink:0,padding:"2px 5px",border:"1px solid #dddddd",borderRadius:"4px",backgroundColor:"#f7f7f7",color:"#777777",fontFamily:"inherit",fontSize:"10px",lineHeight:1.2},children:d}),s&&K.jsx("button",{type:"button","aria-label":"Clear search",onPointerUp:S=>{S.button===0&&p()},onClick:S=>{S.detail===0&&p()},style:{border:"none",background:"transparent",color:"#777777",cursor:"pointer",width:"20px",height:"20px",display:"grid",placeItems:"center",padding:0,lineHeight:1},children:K.jsx(vDi,{size:16,strokeWidth:2})})]}),t&&K.jsx("div",{ref:h,style:{maxHeight:"240px",overflowX:"hidden",overflowY:"auto",overscrollBehavior:"contain",scrollBehavior:"smooth",touchAction:"pan-y",WebkitOverflowScrolling:"touch"},onWheel:S=>S.stopPropagation(),onTouchMove:S=>S.stopPropagation(),children:o.length===0?K.jsx("div",{style:{padding:"12px",color:"#777777",fontSize:"13px"},children:"No matching components or nets"}):K.jsxs(K.Fragment,{children:[B("components",_),B("nets",f)]})})]}):K.jsx("button",{type:"button",title:"Search schematic","aria-label":"Search schematic",onPointerDown:S=>{S.stopPropagation(),S.pointerType!=="mouse"&&m(!1)},onPointerUp:S=>{S.pointerType==="mouse"&&S.button===0&&m(!0)},onClick:S=>{S.detail===0&&m(!0)},style:{width:"32px",height:"32px",display:"grid",placeItems:"center",padding:0,border:"none",borderRadius:"4px",backgroundColor:"#ffffff",color:"#000000",cursor:"pointer",boxShadow:"0 2px 4px rgba(0,0,0,0.1)"},children:K.jsx(cgn,{size:16,strokeWidth:2})})})},_je='system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',TDi={backgroundColor:"#ffffff",color:"#111111",borderRadius:8,boxShadow:"0 6px 24px rgba(0,0,0,0.12), 0 1px 3px rgba(0,0,0,0.08)",border:"1px solid #e5e7eb",padding:4,minWidth:200,maxWidth:320,maxHeight:320,overflowY:"auto",fontSize:13,fontFamily:_je,outline:"none",zIndex:ME.viewMenu},kDi={display:"flex",alignItems:"center",gap:8,padding:"7px 10px 7px 8px",borderRadius:6,cursor:"pointer",outline:"none",userSelect:"none",color:"#111111",fontSize:13,fontFamily:_je},FDi={width:16,height:16,flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#111111"},lgn={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},LDi=`
.sv-sheet-item[data-highlighted], .sv-sheet-item:hover { background-color: #f1f3f5; }
.sv-sheet-chevron { transition: transform 0.2s ease; }
[data-state="open"] > .sv-sheet-chevron { transform: rotate(180deg); }
`,HDi=()=>K.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:K.jsx("path",{d:"M20 6 9 17l-5-5"})}),ODi=({className:t})=>K.jsx("svg",{className:t,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{opacity:.6,flexShrink:0},"aria-hidden":"true",children:K.jsx("path",{d:"m6 9 6 6 6-6"})}),GDi=({sheets:t,selectedSheetId:e,onSelectSheet:n})=>{const[o,i]=ee.useState(!1);if(t.length<=1)return null;const s=t.find(a=>a.schematic_sheet_id===e)?.name??"Select sheet";return K.jsxs(K.Fragment,{children:[K.jsx("style",{children:LDi}),K.jsxs(e_e,{open:o,onOpenChange:i,modal:!1,children:[K.jsx(t_e,{asChild:!0,children:K.jsxs("button",{type:"button",title:s,onPointerDown:a=>a.stopPropagation(),style:{display:"flex",alignItems:"center",gap:"6px",maxWidth:"220px",height:"32px",boxSizing:"border-box",padding:"0 12px",backgroundColor:"#ffffff",color:"#000000",border:"none",outline:"none",borderRadius:"4px",cursor:"pointer",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",fontSize:"13px",fontFamily:_je},children:[K.jsx("span",{style:{color:"#888888",flexShrink:0},children:"Sheet:"}),K.jsx("span",{style:{...lgn,minWidth:0},children:s}),K.jsx(ODi,{className:"sv-sheet-chevron"})]})}),K.jsx(EU,{children:K.jsx(bZ,{style:TDi,side:"bottom",align:"start",sideOffset:8,collisionPadding:10,children:t.map(a=>{const A=a.schematic_sheet_id===e;return K.jsxs(SS,{className:"sv-sheet-item",style:kDi,title:a.name,onSelect:c=>c.preventDefault(),onPointerUp:()=>{n(a.schematic_sheet_id),i(!1)},children:[K.jsx("span",{style:FDi,children:A&&K.jsx(HDi,{})}),K.jsx("span",{style:{...lgn,minWidth:0},children:a.name})]},a.schematic_sheet_id)})})})]})]})},YDi=({count:t,showWarnings:e,onToggle:n})=>{const o=`${e?"Hide":"Show"} ${t} ${t===1?"warning":"warnings"}`;return K.jsxs("button",{type:"button","data-schematic-warnings":!0,title:o,"aria-label":o,"aria-pressed":e,onClick:n,onPointerDown:i=>i.stopPropagation(),onMouseDown:i=>i.stopPropagation(),onTouchStart:i=>i.stopPropagation(),onTouchEnd:i=>i.stopPropagation(),style:{height:"32px",display:"flex",alignItems:"center",gap:"4px",padding:"0 8px",border:"none",borderRadius:"4px",backgroundColor:e?"#fff3cd":"#ffffff",color:"#946200",cursor:"pointer",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',fontSize:"12px",fontWeight:600},children:[K.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[K.jsx("path",{d:"M10.3 3.9 1.8 18.1A2 2 0 0 0 3.5 21h17a2 2 0 0 0 1.7-2.9L13.7 3.9a2 2 0 0 0-3.4 0Z"}),K.jsx("path",{d:"M12 9v4m0 4h.01"})]}),K.jsx("span",{children:t})]})},UDi={version:"2.0.98"},fje='system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',ugn={backgroundColor:"#262626",color:"#fafafa",borderRadius:6,boxShadow:"0px 12px 48px -12px rgba(0, 0, 0, 0.5), 0px 8px 24px -8px rgba(0, 0, 0, 0.3)",border:"1px solid #333333",padding:4,minWidth:208,fontSize:14,fontWeight:400,fontFamily:fje,outline:"none",zIndex:ME.contextMenu},TT={display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:6,cursor:"default",outline:"none",userSelect:"none",color:"#fafafa",fontSize:14,fontWeight:400,fontFamily:fje},VZ={width:16,height:16,flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#fafafa"},ggn={height:1,backgroundColor:"#ffffff1a",margin:"4px 0"},KDi=`
.sv-vm-item[data-highlighted]:not([data-disabled]),
.sv-vm-item:hover:not([data-disabled]) { background-color: #404040; }
.sv-vm-item[data-disabled] { opacity: 0.45; cursor: not-allowed; }
`,M_e=()=>K.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:K.jsx("path",{d:"M20 6 9 17l-5-5"})}),VDi=({netLocations:t=[],onSelectNetLocation:e,circuitJson:n,circuitJsonKey:o,menuRef:i,menuPos:r,onOpenChange:s,onRunStyleAnalysis:a,showGroups:A,onToggleGroups:c,showGrid:l,onToggleGrid:u,showPorts:g,onTogglePorts:h,showWarnings:d,onToggleWarnings:p})=>{const m=ee.useMemo(()=>{if(!n||n.length===0)return!1;try{if((O3(n).source_group?.list()||[]).length>0)return!0;const I=O3(n).schematic_component?.list()||[];if(I.length>1){const C=new Set;for(const y of I){const x=O3(n).source_component.get(y.source_component_id);x?.ftype&&C.add(x.ftype)}return C.size>1}return!1}catch(f){return console.error("Error checking for groups:",f),!1}},[o]),_=ee.useMemo(()=>{if(!n||n.length===0)return!1;try{return(O3(n).schematic_port?.list()||[]).length>0}catch(f){return console.error("Error checking for schematic ports:",f),!1}},[o]);return K.jsx("div",{ref:i,style:{position:"fixed",left:r.x,top:r.y,width:0,height:0},children:K.jsxs(e_e,{open:!0,onOpenChange:s,modal:!1,children:[K.jsx(t_e,{asChild:!0,children:K.jsx("div",{style:{position:"absolute",width:1,height:1}})}),K.jsx(EU,{children:K.jsxs(bZ,{style:ugn,align:"start",sideOffset:0,collisionPadding:10,avoidCollisions:!0,children:[K.jsx("style",{children:KDi}),t.length>0&&K.jsxs(L0n,{children:[K.jsxs(GWe,{className:"sv-vm-item",style:TT,children:["Net Locations ",K.jsx("span",{style:{marginLeft:"auto"},children:"›"})]}),K.jsx(EU,{children:K.jsx(YWe,{style:{...ugn,maxHeight:"min(400px, var(--radix-dropdown-menu-content-available-height))",overflowY:"auto"},collisionPadding:10,children:t.map((f,I)=>K.jsx(SS,{className:"sv-vm-item",style:TT,onSelect:()=>e?.(f),children:f.label},I))})})]}),K.jsxs(SS,{className:"sv-vm-item",style:TT,disabled:!_,title:_?void 0:"No ports found in this schematic",onSelect:f=>f.preventDefault(),onPointerDown:f=>{f.preventDefault(),_&&h(!g)},children:[K.jsx("span",{style:VZ,children:g&&K.jsx(M_e,{})}),K.jsx("span",{children:"Show Schematic Ports"})]}),K.jsxs(SS,{className:"sv-vm-item",style:TT,disabled:!m,title:m?void 0:"No groups found in this schematic",onSelect:f=>f.preventDefault(),onPointerDown:f=>{f.preventDefault(),m&&c(!A)},children:[K.jsx("span",{style:VZ,children:A&&K.jsx(M_e,{})}),K.jsx("span",{children:"View Schematic Groups"})]}),K.jsxs(SS,{className:"sv-vm-item",style:TT,onSelect:f=>f.preventDefault(),onPointerDown:f=>{f.preventDefault(),u(!l)},children:[K.jsx("span",{style:VZ,children:l&&K.jsx(M_e,{})}),K.jsx("span",{children:"Show Grid"})]}),K.jsxs(HWe,{className:"sv-vm-item",style:TT,checked:d,onCheckedChange:p,onSelect:f=>f.preventDefault(),children:[K.jsx("span",{style:VZ,children:K.jsx(OWe,{children:K.jsx(M_e,{})})}),K.jsx("span",{children:"Show Warnings"})]}),K.jsx(n_e,{style:ggn}),K.jsxs(SS,{className:"sv-vm-item",style:TT,onSelect:a,children:[K.jsx("span",{style:VZ}),K.jsx("span",{children:"Run Style Analysis"})]}),K.jsx(n_e,{style:ggn}),K.jsxs("div",{style:{padding:"4px 8px 4px 32px",fontSize:11,opacity:.35,color:"#a1a1aa",letterSpacing:"0.2px",fontFamily:fje},children:["@tscircuit/schematic-viewer@",String(UDi?.version)]})]})})]})})},zDi=({circuitJson:t,containerStyle:e,debugGrid:n=!1,debug:o=!1,clickToInteractEnabled:i=!1,colorOverrides:r,disableGroups:s=!1,netHoverHighlightEnabled:a=!0,onSchematicComponentClicked:A,showSchematicPorts:c,onSchematicPortClicked:l,onSchematicSheetChange:u,searchEnabled:g=!0,controller:h,css:d,className:p})=>{o&&rDi();const m=st=>`${st?.length||0}_${st?.editCount||0}`,_=ee.useMemo(()=>m(t),[t]),f=ee.useMemo(()=>{try{return t.filter(st=>st?.type==="schematic_sheet").slice().sort((st,xt)=>(st.sheet_index??0)-(xt.sheet_index??0))}catch(st){return console.error("Failed to derive schematic sheets",st),[]}},[_]),I=f.length>1,C=f[0]?.schematic_sheet_id,[y,x]=ee.useState(()=>{const st=OMi(DU.SELECTED_SCHEMATIC_SHEET);return st&&f.some(xt=>xt.schematic_sheet_id===st)?st:C});ee.useEffect(()=>{y!==void 0&&f.some(xt=>xt.schematic_sheet_id===y)||x(C)},[_]);const E=I?y??C:void 0,B=ee.useCallback(st=>{x(st),GMi(DU.SELECTED_SCHEMATIC_SHEET,st),u?.(st)},[u]),[S,Q]=ee.useState(!1),[w,M]=ee.useState(null),[k,R]=ee.useState(!1),F=t.filter(st=>st.type.startsWith("schematic_")&&st.type.endsWith("_warning")).length,O=n||S,[U,Y]=ee.useState(!i),[W,te]=ee.useState(()=>s?!1:egn(DU.IS_SHOWING_SCHEMATIC_GROUPS,!1)),[j,J]=ee.useState(()=>c??egn(DU.IS_SHOWING_SCHEMATIC_PORTS,!1));ee.useEffect(()=>{c!==void 0&&J(c)},[c]);const[oe,ie]=ee.useState(!1),ne=ee.useRef(new Set),[le,ge]=ee.useState(null),_e=ee.useCallback((st,xt)=>{xt?ne.current.add(st):ne.current.delete(st),ie(ne.current.size>0)},[]),[ue,fe]=ee.useState(!1),pe=ee.useRef(new Set),ye=ee.useCallback((st,xt)=>{xt?pe.current.add(st):pe.current.delete(st),fe(pe.current.size>0)},[]),Me=ee.useRef(null),ve=ee.useRef(null),he=ee.useRef({x:1,y:1}),Qe=ee.useMemo(()=>{try{return(O3(t).schematic_component?.list()??[]).filter(xt=>!E||xt.schematic_sheet_id===E).map(xt=>xt.schematic_component_id)}catch(st){return console.error("Failed to derive schematic component ids",st),[]}},[_,t,E]),Pe=ee.useMemo(()=>{if(!j)return[];try{return(O3(t).schematic_port?.list()??[]).filter(xt=>!E||xt.schematic_sheet_id===E).map(xt=>{const Xe=O3(t).source_port.get(xt.source_port_id),dt=(Xe?.source_component_id?O3(t).source_component.get(Xe.source_component_id):null)?.name??"?",Ut=xt.display_pin_label??Xe?.pin_number??Xe?.name??"?";return{portId:xt.source_port_id,label:`${dt}.${Ut}`}})}catch(st){return console.error("Failed to derive schematic port info",st),[]}},[_,t,j,E]),we=st=>{const xt=st.touches[0];ve.current={x:xt.clientX,y:xt.clientY}},Te=st=>{const xt=st.changedTouches[0],Xe=ve.current;if(!Xe)return;const Ze=Math.abs(xt.clientX-Xe.x),dt=Math.abs(xt.clientY-Xe.y);Ze<10&&dt<10&&(st.preventDefault(),Y(!0)),ve.current=null},Re=ee.useCallback(st=>st.target instanceof Element&&st.target.closest("[data-schematic-search], [data-schematic-warnings], .schematic-warning")?!1:st.type!=="mousedown"||!("button"in st)?!0:st.button!==2&&!(st.button===0&&st.ctrlKey),[]),{ref:Ee,transform:ke,setTransform:Ce}=YZ({onSetTransform(st){const xt=st.a!==he.current.x||st.d!==he.current.y;he.current={x:st.a,y:st.d},xt&&ge(null),Me.current&&(Me.current.style.transform=iD(st))},enabled:U,shouldDrag:Re}),{menuVisible:Le,menuPos:Ye,menuRef:tt,setMenuVisible:At,contextMenuEventHandlers:at,menuTarget:nt}=aDi({containerRef:Ee}),{containerWidth:gt,containerHeight:bt}=rgn(Ee),Ct=ee.useMemo(()=>le?pDi(t,le.schematicComponentId):null,[_,t,le]),Dt=ee.useMemo(()=>{if(!le||!gt||!bt)return null;const st=12,xt=14,Xe=Math.min(420,gt-st*2),Ze=Math.min(520,bt-st*2),{anchorX:dt,anchorY:Ut}=le,Wt=dt+xt,Xt=dt-Xe-xt,Jt=Wt+Xe<=gt-st?Wt:Xt>=st?Xt:Math.max(st,Math.min(dt-Xe/2,gt-Xe-st)),yn=Math.max(st,Math.min(Ut-24,bt-Ze-st));return{left:Jt,top:yn,width:Xe,maxHeight:Ze}},[le,gt,bt]),kt=ee.useCallback((st,xt)=>{if(xt.target instanceof Element&&xt.target.closest("[data-schematic-component-details-tooltip]"))return;const Xe=Ee.current?.getBoundingClientRect();Xe&&(ge({schematicComponentId:st,anchorX:xt.clientX-Xe.left,anchorY:xt.clientY-Xe.top}),A?.({schematicComponentId:st,event:xt}))},[Ee,A]);ee.useEffect(()=>{ge(null)},[_,E]),ee.useEffect(()=>{if(!le)return;const st=Xe=>{Xe.key==="Escape"&&ge(null)},xt=Xe=>{Xe.target instanceof Element&&Xe.target.closest("[data-schematic-component-details-tooltip]")||ge(null)};return window.addEventListener("keydown",st),document.addEventListener("mousedown",xt),()=>{window.removeEventListener("keydown",st),document.removeEventListener("mousedown",xt)}},[le]);const it=ee.useMemo(()=>!gt||!bt?"":Dun(t,{width:gt,height:bt||720,drawPorts:j,shouldDrawWarnings:k,schematicSheetId:E,grid:O?{cellSize:1,labelCells:!0}:void 0,colorOverrides:r,css:d,className:p}),[_,gt,bt,O,k,j,E]),Yt=ee.useMemo(()=>it.match(/<svg[^>]*style="[^"]*background-color:\s*([^;\"]+)/i)?.[1]??"transparent",[it]),{searchQuery:pn,setSearchQuery:be,searchResults:et,handleSearchResultSelect:It,handleCancelSearch:Bt}=iDi({controller:h,circuitJson:t,circuitJsonKey:_,svgDivRef:Me,containerRef:Ee,activeSheetId:E,hasMultipleSheets:I,handleSelectSheet:B,svgString:it,svgToScreenProjection:ke,setSvgToScreenProjection:Ce,setIsInteractionEnabled:Y});YMi({svgDivRef:Me,circuitJson:t,circuitJsonKey:`${_}_${E??""}`,showGroups:W&&!s}),KMi({svgDivRef:Me,circuitJson:t,circuitJsonKey:`${_}_${E??""}`,enabled:a});const mt=ee.useMemo(()=>K.jsx("div",{ref:Me,style:{pointerEvents:i?U?"auto":"none":"auto",transformOrigin:"0 0"},className:"schematic-component-clickable",dangerouslySetInnerHTML:{__html:it}}),[it,U,i]);return VMi({svgDivRef:Me,svgContent:mt,circuitJsonKey:_}),K.jsxs(yDi,{children:[a&&K.jsx("style",{children:`.sch-net-faded { opacity: 0.35; }
svg :is(g.trace, g.trace-overlays, g[data-schematic-component-id], [data-schematic-net-label-id]) { transition: opacity 0.12s ease-in-out; }`}),g&&K.jsx("style",{children:`.schematic-search-match text,
text.schematic-search-match {
fill: #ff00d4 !important;
}
.schematic-search-match [stroke]:not(text):not([stroke="none"]),
[stroke]:not(text):not([stroke="none"]).schematic-search-match {
stroke: #ff00d4 !important;
}
.schematic-viewer-toolbar {
flex-direction: row;
}
@media (max-width: 640px) {
.schematic-viewer-toolbar {
flex-direction: column;
}
}`}),K.jsx("style",{children:".schematic-component-clickable [data-schematic-component-id]:hover { cursor: pointer !important; }"}),l&&K.jsx("style",{children:"[data-schematic-port-id]:hover { cursor: pointer !important; }"}),K.jsxs("div",{ref:Ee,style:{position:"relative",backgroundColor:Yt,overflow:"hidden",cursor:i&&!U||oe||ue&&l?"pointer":"grab",minHeight:"300px",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",...e},onMouseDownCapture:st=>{if(at.onMouseDown(st),i&&!U){st.preventDefault(),st.stopPropagation();return}},onContextMenu:at.onContextMenu,onTouchStart:st=>{we(st),at.onTouchStart(st)},onTouchMove:at.onTouchMove,onTouchEnd:st=>{Te(st),at.onTouchEnd()},onTouchCancel:at.onTouchCancel,children:[!U&&i&&K.jsx("div",{onClick:st=>{st.preventDefault(),st.stopPropagation(),Y(!0)},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:ME.clickToInteractOverlay,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"all",touchAction:"pan-x pan-y pinch-zoom"},children:K.jsx("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"16px",fontFamily:"sans-serif",pointerEvents:"none"},children:typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)?"Touch to Interact":"Click to Interact"})}),w&&K.jsx(HMi,{circuitJson:w,onClose:()=>M(null)}),Le&&K.jsx(VDi,{circuitJson:t,circuitJsonKey:_,netLocations:(()=>{const st=TMi(nt,t);return st?kMi(t,st):[]})(),onSelectNetLocation:st=>{At(!1),It(st)},menuRef:tt,menuPos:Ye,onOpenChange:At,onRunStyleAnalysis:()=>{At(!1),M(structuredClone(t))},showPorts:j,onTogglePorts:st=>{J(st),tgn(DU.IS_SHOWING_SCHEMATIC_PORTS,st)},showGroups:W,onToggleGroups:st=>{s||(te(st),tgn(DU.IS_SHOWING_SCHEMATIC_GROUPS,st))},showWarnings:k,onToggleWarnings:R,showGrid:O,onToggleGrid:Q}),K.jsxs("div",{className:"schematic-viewer-toolbar",style:{position:"absolute",top:"16px",left:"16px",display:"flex",alignItems:"flex-start",gap:"8px",zIndex:ME.schematicSearch},children:[K.jsx(GDi,{sheets:f,selectedSheetId:E,onSelectSheet:B}),g&&K.jsx(RDi,{query:pn,onQueryChange:be,onCancel:Bt,results:et,onSelect:It,viewerContainerRef:Ee}),F>0&&K.jsx(YDi,{count:F,showWarnings:k,onToggle:()=>R(st=>!st)})]}),Qe.map(st=>K.jsx(bDi,{componentId:st,svgDivRef:Me,containerRef:Ee,showOutline:!0,circuitJsonKey:_,onHoverChange:_e,onComponentClick:kt},st)),mt,Ct&&Dt&&K.jsx(EDi,{sourceComponent:Ct.sourceComponent,warnings:Ct.warnings,footprinterString:Ct.footprinterString,footprintPreviewCircuitJson:Ct.footprintPreviewCircuitJson,footprintPreviewViewBox:Ct.footprintPreviewViewBox,...Dt}),j&&Pe.map(({portId:st,label:xt})=>K.jsx(QDi,{portId:st,portLabel:xt,svgDivRef:Me,containerRef:Ee,showOutline:!0,circuitJsonKey:_,onHoverChange:ye,onPortClick:l?(Xe,Ze)=>{l?.({schematicPortId:Xe,event:Ze})}:void 0},st))]})]})},JDi=t=>{const e=t.match(/<svg\b[^>]*\bstyle=(?:"([^"]*)"|'([^']*)')/i);return(e?.[1]??e?.[2])?.match(/(?:^|;)\s*background-color\s*:\s*([^;]+)/i)?.[1]?.trim()},WDi=t=>t.match(/\.background\s*\{[^}]*\bfill\s*:\s*([^;}]+)/i)?.[1]?.trim(),jDi=(t,e)=>JDi(t)??WDi(t)??e?.schematic?.background??$h.schematic.background,Ije='system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',$Di={backgroundColor:"#ffffff",color:"#111111",borderRadius:8,boxShadow:"0 6px 24px rgba(0,0,0,0.12), 0 1px 3px rgba(0,0,0,0.08)",border:"1px solid #e5e7eb",padding:4,minWidth:220,maxWidth:360,maxHeight:320,overflowY:"auto",fontSize:13,fontFamily:Ije,outline:"none",zIndex:ME.viewMenu},qDi={display:"flex",alignItems:"center",gap:8,padding:"7px 10px 7px 8px",borderRadius:6,cursor:"pointer",outline:"none",userSelect:"none",color:"#111111",fontSize:13,fontFamily:Ije},XDi={width:16,height:16,flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#111111"},dgn={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},ZDi=`
.sv-simulation-item[data-highlighted], .sv-simulation-item:hover { background-color: #f1f3f5; }
.sv-simulation-chevron { transition: transform 0.2s ease; }
[data-state="open"] > .sv-simulation-chevron { transform: rotate(180deg); }
`,eNi=()=>K.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:K.jsx("path",{d:"M20 6 9 17l-5-5"})}),tNi=({className:t})=>K.jsx("svg",{className:t,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{opacity:.6,flexShrink:0},"aria-hidden":"true",children:K.jsx("path",{d:"m6 9 6 6 6-6"})}),nNi=t=>{const e=new Map;return t.map(n=>{const o=(e.get(n.name)??0)+1;return e.set(n.name,o),{simulation:n,label:o===1?n.name:`${n.name} (${o})`}})},oNi=({simulations:t,selectedSimulationExperimentId:e,onSelectSimulation:n})=>{const[o,i]=ee.useState(!1);if(t.length<=1)return null;const r=nNi(t),a=r.find(({simulation:A})=>A.simulation_experiment_id===e)?.label??"Select simulation";return K.jsxs(K.Fragment,{children:[K.jsx("style",{children:ZDi}),K.jsxs(e_e,{open:o,onOpenChange:i,modal:!1,children:[K.jsx(t_e,{asChild:!0,children:K.jsxs("button",{type:"button",title:a,onPointerDown:A=>A.stopPropagation(),style:{position:"absolute",top:"16px",left:"16px",display:"flex",alignItems:"center",gap:"6px",maxWidth:"280px",padding:"8px 12px",backgroundColor:"#ffffff",color:"#000000",border:"none",outline:"none",borderRadius:"4px",cursor:"pointer",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",fontSize:"13px",fontFamily:Ije,zIndex:ME.viewMenuIcon},children:[K.jsx("span",{style:{color:"#888888",flexShrink:0},children:"Simulation:"}),K.jsx("span",{style:{...dgn,minWidth:0},children:a}),K.jsx(tNi,{className:"sv-simulation-chevron"})]})}),K.jsx(EU,{children:K.jsx(bZ,{style:$Di,side:"bottom",align:"start",sideOffset:8,collisionPadding:10,children:r.map(({simulation:A,label:c})=>{const l=A.simulation_experiment_id===e;return K.jsxs(SS,{className:"sv-simulation-item",style:qDi,title:c,onSelect:u=>u.preventDefault(),onPointerUp:()=>{n(A.simulation_experiment_id),i(!1)},children:[K.jsx("span",{style:XDi,children:l&&K.jsx(eNi,{})}),K.jsx("span",{style:{...dgn,minWidth:0},children:c})]},A.simulation_experiment_id)})})})]})]})},iNi=1200,rNi=1,sNi=2,aNi=({circuitJson:t,containerStyle:e,colorOverrides:n,width:o,height:i,className:r,hideSchematic:s=!1,onSimulationChange:a,acSweepView:A="magnitude"})=>{const[c,l]=ee.useState(null),[u,g]=ee.useState(!0),[h,d]=ee.useState(null),[p,m]=ee.useState(null),_=ee.useRef(null),f=ee.useRef(null),{containerWidth:I}=rgn(_),[C,y]=ee.useState(!1),{ref:x}=YZ({onSetTransform(te){f.current&&(f.current.style.transform=iD(te))}}),B=o&&i?o/i:s?sNi:rNi,S=o||(i?i*B:I)||iNi,Q=i||S/B;ee.useEffect(()=>{g(!0),d(null),l(t),g(!1)},[t]);const w=ee.useMemo(()=>c?c.filter(te=>te.type==="simulation_experiment"):[],[c]),[M,k]=ee.useState(null),R=(M&&w.some(te=>te.simulation_experiment_id===M)?M:w[0]?.simulation_experiment_id)??null;ee.useEffect(()=>{R!==M&&k(R)},[R,M]);const F=te=>{k(te),a?.(te)},O=ee.useMemo(()=>{if(!c||!S||!Q||!R)return"";try{const te={circuitJson:c,simulation_experiment_id:R,ac_sweep_view:A,width:S,height:Q};return s?jun(te):DMi({...te,schematicOptions:{colorOverrides:n}})}catch(te){return console.error("Failed to generate simulation SVG:",te),""}},[c,S,Q,n,s,R,A]);ee.useEffect(()=>{if(!O){m(null);return}try{const te=new Blob([O],{type:"image/svg+xml"}),j=URL.createObjectURL(te);return m(j),()=>{URL.revokeObjectURL(j)}}catch(te){console.error("Failed to create SVG object URL:",te),m(null)}},[O]);const U=ee.useMemo(()=>jDi(O,n),[O,n]),Y=te=>{y(!0)},W=te=>{y(!0)};return ee.useEffect(()=>{const te=()=>{y(!1)},j=()=>{y(!1)};return window.addEventListener("mouseup",te),window.addEventListener("touchend",j),()=>{window.removeEventListener("mouseup",te),window.removeEventListener("touchend",j)}},[]),u?K.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#f5f5f5",minHeight:"300px",fontFamily:"sans-serif",fontSize:"16px",color:"#666",...e},className:r,children:"Loading circuit..."}):h?K.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#fef2f2",minHeight:"300px",fontFamily:"sans-serif",fontSize:"16px",color:"#dc2626",...e},className:r,children:K.jsxs("div",{style:{textAlign:"center",padding:"20px"},children:[K.jsx("div",{style:{fontWeight:"bold",marginBottom:"8px"},children:"Circuit Conversion Error"}),K.jsx("div",{style:{fontSize:"14px"},children:h})]})}):O?K.jsxs("div",{ref:te=>{_.current=te,x.current=te},style:{position:"relative",backgroundColor:U,overflow:"hidden",minHeight:"300px",cursor:C?"grabbing":"grab",...e},className:r,onMouseDown:Y,onTouchStart:W,children:[K.jsx(oNi,{simulations:w,selectedSimulationExperimentId:R,onSelectSimulation:F}),p?K.jsx("img",{ref:f,src:p,alt:"Circuit Simulation",style:{transformOrigin:"0 0",width:"100%",height:"100%",display:"block",objectFit:"contain"}}):K.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",minHeight:"300px",color:"#666",fontFamily:"sans-serif"},children:"Failed to render SVG"})]}):K.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:"#f8fafc",minHeight:"300px",fontFamily:"sans-serif",gap:"12px",...e},className:r,children:[K.jsx("div",{style:{fontSize:"16px",color:"#475569",fontWeight:500},children:"No Simulation Found"}),K.jsxs("div",{style:{fontSize:"14px",color:"#64748b"},children:["Use"," ",K.jsx("code",{style:{backgroundColor:"#e2e8f0",padding:"2px 6px",borderRadius:"4px",fontFamily:"monospace",fontSize:"13px"},children:"<analogsimulation />"})," ","to create simulations"]})]})},ANi=()=>{const[t,e]=ee.useState(null),n=ee.useCallback(r=>{e({schematicComponentId:r})},[]),o=ee.useCallback(r=>{e(s=>s===r?null:s)},[]);return{controller:ee.useMemo(()=>({focusRequest:t,onFocusRequestHandled:o}),[t,o]),focusSchematicComponent:n}},hgn=t=>{const[e,n]=ee.useState(0),[o,i]=ee.useState(0);return ee.useEffect(()=>{if(!t.current)return;const r=()=>{const a=t.current?.getBoundingClientRect();n(a?.width||0),i(a?.height||0)};r();const s=new ResizeObserver(r);return s.observe(t.current),window.addEventListener("resize",r),()=>{s.disconnect(),window.removeEventListener("resize",r)}},[]),{containerWidth:e,containerHeight:o}};vc("assembly-viewer");var pgn=()=>{vc.enable("assembly-viewer*")},cNi=({circuitJson:t,containerStyle:e,debugGrid:n=!1,debug:o=!1})=>{o&&pgn();const i=ee.useRef(null),{ref:r}=YZ({onSetTransform(l){i.current&&(i.current.style.transform=iD(l))}}),{containerWidth:s,containerHeight:a}=hgn(r),A=ee.useMemo(()=>!s||!a?"":_Ut(t,{width:s,height:a||720}),[t,s,a]);ee.useMemo(()=>{if(!A)return QQ();const l=A.match(/data-real-to-screen-transform="([^"]+)"/)?.[1];try{return BV(l)}catch(u){return console.error(u),QQ()}},[A]);const c=ee.useMemo(()=>K.jsx("div",{ref:i,style:{pointerEvents:"auto",transformOrigin:"0 0"},dangerouslySetInnerHTML:{__html:A}}),[A]);return K.jsx("div",{ref:r,style:{position:"relative",backgroundColor:"#FFFFFF",overflow:"hidden",minHeight:"300px",...e},children:c})},lNi=({circuitJson:t,containerStyle:e,debugGrid:n=!1,debug:o=!1})=>{o&&pgn();const i=ee.useRef(null),{ref:r}=YZ({onSetTransform(l){i.current&&(i.current.style.transform=iD(l))}}),{containerWidth:s,containerHeight:a}=hgn(r),A=ee.useMemo(()=>!s||!a?"":SUt(t,{width:s,height:a||720}),[t,s,a]);ee.useMemo(()=>{if(!A)return QQ();const l=A.match(/data-real-to-screen-transform="([^"]+)"/)?.[1];try{return BV(l)}catch(u){return console.error(u),QQ()}},[A]);const c=ee.useMemo(()=>K.jsx("div",{ref:i,style:{pointerEvents:"auto",transformOrigin:"0 0"},dangerouslySetInnerHTML:{__html:A}}),[A]);return K.jsx("div",{ref:r,style:{position:"relative",backgroundColor:"#FFFFFF",overflow:"hidden",minHeight:"300px",...e},children:c})};const mgn=["Initialize a tscircuit project using [tsci init](https://github.com/tscircuit/cli) before adding components.","Define reusable modules with cached routes using [<subcircuit />](https://docs.tscircuit.com/elements/subcircuit)","Run `tsci dev` on the command line to preview your boards before export",'Use units like mm or mils consistently across your designs (e.g. pcbX="10mm")',"Quickly set footprints with the [footprint prop](https://docs.tscircuit.com/footprints/footprinter-strings)","Check out the guide on [ordering prototypes](https://docs.tscircuit.com/building-electronics/ordering-prototypes)","Use [net labels](https://docs.tscircuit.com/elements/net) and [group elements](https://docs.tscircuit.com/elements/group) to organize complex schematics.","You can manually drag components on the PCB and Schematic using [manual edits](https://docs.tscircuit.com/guides/manual-edits)","Every tscircuit module can export to [Circuit JSON](https://github.com/tscircuit/circuit-json), Gerbers, Pick'n'Place CSV files, Bill of Materials CSV and more","You can import components from [JLCPCB](https://docs.tscircuit.com/guides/importing-modules-and-chips/importing-from-jlcpcb) or [KiCad](https://docs.tscircuit.com/guides/importing-modules-and-chips/importing-from-kicad)","Any module you push to the [registry](https://tscircuit.com/trending) will have [simple image urls](https://docs.tscircuit.com/web-apis/image-generation-api) you can use display images on a website","The default [Parts Engine](https://docs.tscircuit.com/guides/platform-configuration) will automatically find parts from common vendors for your BOM",'[Pin selectors](https://docs.tscircuit.com/guides/using-sel-references) are similar to CSS selectors, ".R1 > .pin1" means "connect to the first pin of the component R1"',"You can use the [sel](https://docs.tscircuit.com/guides/using-sel-references) object to select pins in a type-safe way","Publish modules via the [registry](https://tscircuit.com/trending) for working with a team or sharing your work","[Explore tutorials](https://docs.tscircuit.com/category/tutorials) for real-world circuit design examples.","Upload your Circuit JSON to [circuitjson.com](https://circuitjson.com) for a quick preview.","You can display Circuit JSON in 3D, PCB or Schematic mode with the [<CircuitJsonPreview />](https://docs.tscircuit.com/guides/running-tscircuit/displaying-circuit-json-on-a-webpage#react-display-all-available-previews-with-circuitjsonpreview-) React component","Use a [<group />](https://docs.tscircuit.com/elements/group) element to move multiple components at once in a schematic or PCB layout.","Check out the [GitHub Discussions page](https://github.com/tscircuit/tscircuit/discussions) to upvote features","You can customize the autorouter using the [autorouter prop](https://docs.tscircuit.com/elements/board#setting-the-autorouter)","Use the [<constraint />](https://docs.tscircuit.com/footprints/constraint) element to enforce geometric relationships in PCB designs.","When working on component placement and circuit design, autorouting can slow down your iteration cycle. Use [routingDisabled](https://docs.tscircuit.com/elements/board#disabling-routing-with-routingdisabled) on the <board /> element to disable autorouting temporarily.","Join the [Discord server](https://tscircuit.com/join) to discuss issues and get help directly from the community."],uNi=(()=>{let t=mgn[Math.floor(Math.random()*mgn.length)];return t=t.replace(/</g,"<"),t=t.replace(/>/g,">"),t=t.replace(new RegExp('(?<!href=")(?<!\\()(?<!\\]\\()(https?:\\/\\/[^\\s\\)\\]]+)',"g"),(e,n)=>`<a class="rf-text-blue-500 rf-underline" href="${e}" target="_blank">${e}</a>`),t=t.replace(/\[([^\]]+)\]\((https?:\/\/[^\)]+)\)/g,'<a class="rf-text-blue-500 rf-underline" href="$2" target="_blank">$1</a>'),t})(),QS=({onRunClicked:t})=>K.jsxs("div",{className:"rf-flex rf-flex-col rf-items-center rf-justify-center rf-h-full rf-bg-gray-50 rf-text-gray-500 rf-p-4",children:[K.jsx(Cbi,{className:"rf-size-14 rf-mb-4"}),K.jsxs("p",{className:"rf-text-md rf-break-words rf-max-w-xl rf-text-center",children:["Tip: ",K.jsx("span",{dangerouslySetInnerHTML:{__html:uNi}})]}),t&&K.jsxs(fA,{className:"rf-mt-4 rf-bg-blue-600 rf-hover:bg-blue-500",onClick:t,children:["Run Code",K.jsx(_ln,{className:"rf-w-3 rf-h-3 rf-ml-2"})]})]}),D_e=({text:t,onClick:e})=>K.jsx("span",{className:"rf-cursor-pointer rf-underline rf-text-blue-600 rf-mx-2",onClick:e,children:t}),N_e=t=>K.jsxs("div",{className:"rf-leading-5",children:[K.jsx("div",{className:"rf-py-2 rf-font-bold",children:t.column.name}),K.jsx("div",{children:t.field?.()??K.jsx("input",{type:"text",className:"rf-border rf-rounded rf-p-1 rf-w-full",onChange:e=>{t.onTextChange?.(e.target.value)}})})]}),gNi=({open:t,children:e,title:n,onClose:o})=>t?K.jsx("div",{className:"rf-fixed rf-inset-0 rf-bg-black rf-bg-opacity-50 rf-flex rf-justify-center rf-items-center rf-z-50",onClick:o,children:K.jsxs("div",{className:"rf-bg-white rf-p-5 rf-rounded-lg rf-relative rf-w-11/12 rf-max-w-2xl",onClick:i=>{i.preventDefault(),i.stopPropagation()},children:[K.jsx("h2",{className:"rf-mt-0 rf-text-md rf-pb-4",children:n}),K.jsx("button",{type:"button",className:"rf-absolute rf-top-2 rf-right-4 rf-text-2xl rf-font-bold",onClick:o,children:"×"}),e]})}):null,dNi=({elements:t})=>{const[e,n]=ee.useState({open:!1}),[o,i]=ee.useReducer((l,u)=>({...l,...u}),{}),r=[...new Set(t.map(l=>l.type))],s=t.map(l=>{const u=l[`${l.type}_id`],g=Object.fromEntries(Object.entries(l).filter(([d])=>!(d===`${l.type}_id`||!d.endsWith("_id")))),h=Object.fromEntries(Object.entries(l).filter(([d])=>!d.endsWith("_id")));return{primary_id:u,other_ids:g,...h,_og_elm:l}}),a=s.map(l=>{let u="";const g=h=>{const d=Object.keys(h.other_ids).find(_=>_.startsWith("source_"));if(!d)return`.${h.name}`;const p=d.slice(0,-3),m=s.find(_=>_.type===p&&_.primary_id===h.other_ids[d]);return m?"name"in m?`${g(m)} > .${h.name}`:`#${m.primary_id} > .${h.name}`:`??? > .${h.name}`};return"name"in l&&(u=g(l)),{...l,selector_path:u}}),A=[{key:"primary_id",name:"primary_id",renderCell:l=>K.jsxs("div",{className:"rf-flex rf-items-center",children:[K.jsx(D_e,{text:l.primary_id,onClick:()=>i({focused_id:l.primary_id,id_search:void 0,selector_search:void 0})}),K.jsx("span",{className:"rf-flex-grow"}),K.jsx(D_e,{text:"(JSON)",onClick:()=>n({open:!0,element:l._og_elm,title:l.primary_id})})]}),renderHeaderCell:l=>K.jsx(N_e,{column:l,onTextChange:u=>i({id_search:u}),field:o.focused_id?()=>K.jsxs("div",{children:["Focus:"," ",K.jsx("span",{className:"rf-underline",children:o.focused_id}),K.jsx(D_e,{text:"(unfocus)",onClick:()=>i({focused_id:void 0})})]}):void 0})},{key:"type",name:"type",renderHeaderCell:l=>K.jsx(N_e,{column:l,field:()=>K.jsxs("select",{onChange:u=>i({component_type_filter:u.target.value}),className:"rf-border rf-rounded rf-p-1 rf-w-full",children:[K.jsx("option",{value:"any",children:"any"},"any"),K.jsx("option",{value:"source",children:"source"},"source"),K.jsx("option",{value:"source/pcb",children:"source/pcb"},"source/pcb"),K.jsx("option",{value:"source/schematic",children:"source/schematic"},"source/schematic"),r.map(u=>K.jsx("option",{value:u,children:u},u))]})})},{key:"name",name:"name",renderHeaderCell:l=>K.jsx(N_e,{column:l,onTextChange:u=>i({name_search:u})})},{key:"selector_path",name:"selector_path",renderHeaderCell:l=>K.jsx(N_e,{column:l,onTextChange:u=>i({selector_search:u})})},{key:"other_ids",name:"other_ids",renderCell:l=>K.jsx("div",{className:"rf-space-x-2",children:Object.entries(l.other_ids).map(([u,g])=>K.jsx(D_e,{text:g,onClick:()=>i({focused_id:g})},g))})}],c=a.filter(l=>o.name_search?l.name?.toLowerCase()?.includes(o.name_search.toLowerCase()):!0).filter(l=>!o.component_type_filter||o.component_type_filter==="any"?!0:o.component_type_filter==="source"?l.type.startsWith("source_"):o.component_type_filter==="source/pcb"?l.type.startsWith("source_")||l.type.startsWith("pcb_"):o.component_type_filter==="source/schematic"?l.type.startsWith("source_")||l.type.startsWith("schematic_"):l.type?.includes(o.component_type_filter)).filter(l=>o.selector_search?o.selector_search.split(" ").filter(g=>g.length>0).every(g=>l.selector_path?.includes(g)):!0).filter(l=>o.id_search?l.primary_id?.includes(o.id_search):!0).filter(l=>!!(!o.focused_id||l.primary_id===o.focused_id||Object.values(l.other_ids).includes(o.focused_id)));return K.jsxs("div",{className:"rf-font-mono rf-text-xs rf-bg-white",children:[K.jsx("div",{className:"rf-overflow-x-auto",children:K.jsxs("table",{className:"rf-table-auto rf-w-full rf-text-left",children:[K.jsx("thead",{children:K.jsx("tr",{children:A.map(l=>K.jsx("th",{className:"rf-px-4 rf-py-2 rf-border-b",children:l.renderHeaderCell?l.renderHeaderCell(l):l.name},l.key))})}),K.jsx("tbody",{children:c.map((l,u)=>K.jsx("tr",{className:"rf-hover:bg-gray-100",children:A.map(g=>K.jsx("td",{className:"rf-px-4 rf-py-2 rf-border-b",children:g.renderCell?g.renderCell(l):l[g.key]},g.key))},u))})]})}),K.jsx(gNi,{open:e.open,onClose:()=>n({open:!1}),title:e.open?e.title:"",children:K.jsx("div",{className:"rf-bg-gray-800 rf-p-3 rf-text-white rf-rounded",children:K.jsx("pre",{className:"rf-whitespace-pre-wrap",children:e.open?JSON.stringify(e.element,null,2):""})})})]})};var hNi=()=>{if(globalThis.tscircuitDynamicModules)return globalThis.tscircuitDynamicModules;const t={};return globalThis.tscircuitDynamicModules=t,t};function pNi(t,e){return hNi()[t]=e,e}var mNi=["circuit-json-to-3d-png","circuit-json-to-bom-csv","circuit-json-to-bpc","circuit-json-to-connectivity-map","circuit-json-to-fdm-component-box","circuit-json-to-gerber","circuit-json-to-gltf","circuit-json-to-kicad","circuit-json-to-lbrn","circuit-json-to-pnp-csv","circuit-json-to-readable-netlist","circuit-json-to-simple-3d","circuit-json-to-spice","circuit-json-to-step","circuit-json-to-tscircuit","circuit-to-canvas","circuit-to-svg","kicad-to-circuit-json"],Cje=t=>{const e=t.indexOf("@");return e===-1?t:t.slice(0,e)},_Ni=new Set(mNi),fNi=t=>(CNi(t),[INi(t),`https://esm.run/${t}`]);function INi(t){const e=Cje(t),n=t.length===e.length?"latest":t.slice(e.length+1);return`https://jscdn.tscircuit.com/${e}/${n}/+esm`}function CNi(t){const e=Cje(t);if(!_Ni.has(e))throw new Error(`Unsupported module: ${t}`)}async function yNi(t){let e;for(const n of fNi(t))try{const o=await import(n);return pNi(Cje(t),o)}catch(o){e=o}throw e}var DE=yNi;const xNi=(t,e)=>K.jsx("a",{className:"rf-underline rf-text-blue-500",target:"_blank",rel:"noreferrer",href:`https://jlcpcb.com/partdetail/${e}`,children:e}),ENi=t=>t?.map(({manufacturer:e,mpn:n})=>`${e}: ${n}`).join(", "),BNi=t=>{const e=new Set;let n=!1,o=!1;for(const i of t){i.supplier_part_number_columns?.["JLCPCB Part #"]!==void 0&&(n=!0);for(const r of Object.keys(i.extra_columns??{}))e.add(r);(i.manufacturer_mpn_pairs?.length??0)>0&&(o=!0)}return{extraColumnNames:[...e],hasSupplierColumn:n,hasManufacturerColumn:o}},bNi=t=>{const e=[{key:"designator",label:"Designator",getCell:n=>n.designator},{key:"comment",label:"Comment",getCell:n=>n.comment},{key:"value",label:"Component Value",getCell:n=>n.value},{key:"footprint",label:"Footprint",getCell:n=>n.footprint}];t.hasSupplierColumn&&e.push({key:"supplier:JLCPCB Part #",label:"JLCPCB Part #",getCell:n=>{const o=n.supplier_part_number_columns?.["JLCPCB Part #"];return o?xNi("jlcpcb",o):""}}),t.hasManufacturerColumn&&e.push({key:"manufacturer_mpn_pairs",label:"Manufacturer / MPN",getCell:n=>ENi(n.manufacturer_mpn_pairs)});for(const n of t.extraColumnNames)e.push({key:`extra:${n}`,label:n,getCell:o=>o.extra_columns?.[n]||""});return e},SNi=({circuitJson:t})=>{const[e,n]=ee.useState(null),[o,i]=ee.useState(null);if(ee.useEffect(()=>{let a=!1;return(async()=>{try{i(null),n(null);const{convertCircuitJsonToBomRows:c}=await DE("circuit-json-to-bom-csv"),l=await c({circuitJson:t});a||n(l)}catch(c){a||i(c instanceof Error?c.message:"Unknown BOM error")}})(),()=>{a=!0}},[t]),o)throw new Error(o);const r=BNi(e??[]),s=bNi(r);return e?K.jsx("div",{className:"rf-overflow-x-auto",children:K.jsxs("table",{className:"rf-w-full rf-text-left rf-text-sm",children:[K.jsx("thead",{children:K.jsx("tr",{className:"rf-border-b",children:s.map(a=>K.jsx("th",{className:"rf-p-2",children:a.label},a.key))})}),K.jsx("tbody",{children:e.map((a,A)=>K.jsx("tr",{className:"rf-border-b",children:s.map(c=>K.jsx("td",{className:"rf-p-2",children:c.getCell(a)},c.key))},a.designator||`${A}`))})]})}):K.jsx("div",{className:"rf-p-4 rf-text-sm rf-text-muted-foreground",children:"Loading BOM..."})},yje=ee.forwardRef(({className:t,type:e,...n},o)=>K.jsx("input",{type:e,className:Oi("rf-flex rf-h-9 rf-w-full rf-rounded-md rf-border rf-border-zinc-200 rf-bg-white rf-px-3 rf-py-1 rf-text-sm rf-shadow-sm rf-transition-colors file:rf-border-0 file:rf-bg-transparent file:rf-text-sm file:rf-font-medium placeholder:rf-text-zinc-500 focus-visible:rf-outline-none focus-visible:rf-ring-1 focus-visible:rf-ring-zinc-950 disabled:rf-cursor-not-allowed disabled:rf-opacity-50 dark:rf-border-zinc-800 dark:rf-bg-zinc-950 dark:rf-placeholder-zinc-400 dark:focus-visible:rf-ring-zinc-300",t),ref:o,...n}));yje.displayName="Input";function _i(t,e){return Array.isArray(e)?[t.a*e[0]+t.c*e[1]+t.e,t.b*e[0]+t.d*e[1]+t.f]:{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function RP(){return{a:1,c:0,e:0,b:0,d:1,f:0}}function V6(t){const{a:e,b:n,c:o,d:i,e:r,f:s}=t,a=e*i-n*o;return{a:i/a,b:n/-a,c:o/-a,d:e/a,e:(i*r-o*s)/-a,f:(n*r-e*s)/a}}function zZ(t){return typeof t>"u"}function Qd(t,e=0){return{a:1,c:0,e:t,b:0,d:1,f:e}}function R_e(...t){t=Array.isArray(t[0])?t[0]:t;const e=(n,o)=>({a:n.a*o.a+n.c*o.b,c:n.a*o.c+n.c*o.d,e:n.a*o.e+n.c*o.f+n.e,b:n.b*o.a+n.d*o.b,d:n.b*o.c+n.d*o.d,f:n.b*o.e+n.d*o.f+n.f});switch(t.length){case 0:throw new Error("no matrices provided");case 1:return t[0];case 2:return e(t[0],t[1]);default:{const[n,o,...i]=t,r=e(n,o);return R_e(r,...i)}}}function NC(...t){return R_e(...t)}const{cos:QNi,sin:vNi}=Math;function wNi(t,e,n){const o=QNi(t),i=vNi(t),r={a:o,c:-i,e:0,b:i,d:o,f:0};return zZ(e)||zZ(n)?r:R_e([Qd(e,n),r,Qd(-e,-n)])}function vS(t,e=void 0,n=void 0,o=void 0){zZ(e)&&(e=t);const i={a:t,c:0,e:0,b:0,d:e,f:0};return zZ(n)||zZ(o)?i:R_e([Qd(n,o),i,Qd(-n,-o)])}function PNi(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n}function T_e(t,e,n,o){var i=Error.call(this,t);return Object.setPrototypeOf&&Object.setPrototypeOf(i,T_e.prototype),i.expected=e,i.found=n,i.location=o,i.name="SyntaxError",i}PNi(T_e,Error);function xje(t,e,n){return n=n||" ",t.length>e?t:(e-=t.length,n+=n.repeat(e),t+n.slice(0,e))}T_e.prototype.format=function(t){var e="Error: "+this.message;if(this.location){var n=null,o;for(o=0;o<t.length;o++)if(t[o].source===this.location.source){n=t[o].text.split(/\r\n|\n|\r/g);break}var i=this.location.start,r=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(i):i,s=this.location.source+":"+r.line+":"+r.column;if(n){var a=this.location.end,A=xje("",r.line.toString().length," "),c=n[i.line-1],l=i.line===a.line?a.column:c.length+1,u=l-i.column||1;e+=`
--> `+s+`
`+A+` |
`+r.line+" | "+c+`
`+A+" | "+xje("",i.column-1," ")+xje("",u,"^")}else e+=`
at `+s}return e},T_e.buildMessage=function(t,e){var n={literal:function(c){return'"'+i(c.text)+'"'},class:function(c){var l=c.parts.map(function(u){return Array.isArray(u)?r(u[0])+"-"+r(u[1]):r(u)});return"["+(c.inverted?"^":"")+l.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(c){return c.description}};function o(c){return c.charCodeAt(0).toString(16).toUpperCase()}function i(c){return c.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(l){return"\\x0"+o(l)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(l){return"\\x"+o(l)})}function r(c){return c.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(l){return"\\x0"+o(l)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(l){return"\\x"+o(l)})}function s(c){return n[c.type](c)}function a(c){var l=c.map(s),u,g;if(l.sort(),l.length>0){for(u=1,g=1;u<l.length;u++)l[u-1]!==l[u]&&(l[g]=l[u],g++);l.length=g}switch(l.length){case 1:return l[0];case 2:return l[0]+" or "+l[1];default:return l.slice(0,-1).join(", ")+", or "+l[l.length-1]}}function A(c){return c?'"'+i(c)+'"':"end of input"}return"Expected "+a(t)+" but "+A(e)+" found."};function MNi(t,e=!1,n=!1){e?n?t=NC(t,vS(-1,-1)):t=NC(t,vS(1,-1)):n&&(t=NC(t,vS(-1,1)));const o=t.a,i=t.b,r=t.c,s=t.d;let a,A,c;if(o!==0||r!==0){const l=Math.hypot(o,r);a=l,A=(o*s-i*r)/l;const u=Math.acos(o/l);c=r>0?-u:u}else if(i!==0||s!==0){const l=Math.hypot(i,s);a=(o*s-i*r)/l,A=l;const u=Math.acos(i/l);c=Math.PI/2+(s>0?-u:u)}else a=0,A=0,c=0;return n&&(a=-a),e&&(A=-A),{translate:{tx:t.e,ty:t.f},scale:{sx:a,sy:A},rotation:{angle:c}}}const JZ=t=>typeof t=="number"&&!isNaN(t),kT=t=>typeof t=="string",NE=t=>typeof t=="function",k_e=t=>kT(t)||NE(t)?t:null,Eje=t=>ee.isValidElement(t)||kT(t)||NE(t)||JZ(t);function DNi(t,e,n){n===void 0&&(n=300);const{scrollHeight:o,style:i}=t;requestAnimationFrame(()=>{i.minHeight="initial",i.height=o+"px",i.transition=`all ${n}ms`,requestAnimationFrame(()=>{i.height="0",i.padding="0",i.margin="0",setTimeout(e,n)})})}function F_e(t){let{enter:e,exit:n,appendPosition:o=!1,collapse:i=!0,collapseDuration:r=300}=t;return function(s){let{children:a,position:A,preventExitTransition:c,done:l,nodeRef:u,isIn:g,playToast:h}=s;const d=o?`${e}--${A}`:e,p=o?`${n}--${A}`:n,m=ee.useRef(0);return ee.useLayoutEffect(()=>{const _=u.current,f=d.split(" "),I=C=>{C.target===u.current&&(h(),_.removeEventListener("animationend",I),_.removeEventListener("animationcancel",I),m.current===0&&C.type!=="animationcancel"&&_.classList.remove(...f))};_.classList.add(...f),_.addEventListener("animationend",I),_.addEventListener("animationcancel",I)},[]),ee.useEffect(()=>{const _=u.current,f=()=>{_.removeEventListener("animationend",f),i?DNi(_,l,r):l()};g||(c?f():(m.current=1,_.className+=` ${p}`,_.addEventListener("animationend",f)))},[g]),Fs.createElement(Fs.Fragment,null,a)}}function _gn(t,e){return t!=null?{content:t.content,containerId:t.props.containerId,id:t.props.toastId,theme:t.props.theme,type:t.props.type,data:t.props.data||{},isLoading:t.props.isLoading,icon:t.props.icon,status:e}:{}}const u2=new Map;let WZ=[];const Bje=new Set,NNi=t=>Bje.forEach(e=>e(t)),fgn=()=>u2.size>0;function Ign(t,e){var n;if(e)return!((n=u2.get(e))==null||!n.isToastActive(t));let o=!1;return u2.forEach(i=>{i.isToastActive(t)&&(o=!0)}),o}function Cgn(t,e){Eje(t)&&(fgn()||WZ.push({content:t,options:e}),u2.forEach(n=>{n.buildToast(t,e)}))}function ygn(t,e){u2.forEach(n=>{e!=null&&e!=null&&e.containerId?e?.containerId===n.id&&n.toggle(t,e?.id):n.toggle(t,e?.id)})}function RNi(t){const{subscribe:e,getSnapshot:n,setProps:o}=ee.useRef((function(r){const s=r.containerId||1;return{subscribe(a){const A=(function(l,u,g){let h=1,d=0,p=[],m=[],_=[],f=u;const I=new Map,C=new Set,y=()=>{_=Array.from(I.values()),C.forEach(B=>B())},x=B=>{m=B==null?[]:m.filter(S=>S!==B),y()},E=B=>{const{toastId:S,onOpen:Q,updateId:w,children:M}=B.props,k=w==null;B.staleId&&I.delete(B.staleId),I.set(S,B),m=[...m,B.props.toastId].filter(R=>R!==B.staleId),y(),g(_gn(B,k?"added":"updated")),k&&NE(Q)&&Q(ee.isValidElement(M)&&M.props)};return{id:l,props:f,observe:B=>(C.add(B),()=>C.delete(B)),toggle:(B,S)=>{I.forEach(Q=>{S!=null&&S!==Q.props.toastId||NE(Q.toggle)&&Q.toggle(B)})},removeToast:x,toasts:I,clearQueue:()=>{d-=p.length,p=[]},buildToast:(B,S)=>{if((J=>{let{containerId:oe,toastId:ie,updateId:ne}=J;const le=oe?oe!==l:l!==1,ge=I.has(ie)&&ne==null;return le||ge})(S))return;const{toastId:Q,updateId:w,data:M,staleId:k,delay:R}=S,F=()=>{x(Q)},O=w==null;O&&d++;const U={...f,style:f.toastStyle,key:h++,...Object.fromEntries(Object.entries(S).filter(J=>{let[oe,ie]=J;return ie!=null})),toastId:Q,updateId:w,data:M,closeToast:F,isIn:!1,className:k_e(S.className||f.toastClassName),bodyClassName:k_e(S.bodyClassName||f.bodyClassName),progressClassName:k_e(S.progressClassName||f.progressClassName),autoClose:!S.isLoading&&(Y=S.autoClose,W=f.autoClose,Y===!1||JZ(Y)&&Y>0?Y:W),deleteToast(){const J=I.get(Q),{onClose:oe,children:ie}=J.props;NE(oe)&&oe(ee.isValidElement(ie)&&ie.props),g(_gn(J,"removed")),I.delete(Q),d--,d<0&&(d=0),p.length>0?E(p.shift()):y()}};var Y,W;U.closeButton=f.closeButton,S.closeButton===!1||Eje(S.closeButton)?U.closeButton=S.closeButton:S.closeButton===!0&&(U.closeButton=!Eje(f.closeButton)||f.closeButton);let te=B;ee.isValidElement(B)&&!kT(B.type)?te=ee.cloneElement(B,{closeToast:F,toastProps:U,data:M}):NE(B)&&(te=B({closeToast:F,toastProps:U,data:M}));const j={content:te,props:U,staleId:k};f.limit&&f.limit>0&&d>f.limit&&O?p.push(j):JZ(R)?setTimeout(()=>{E(j)},R):E(j)},setProps(B){f=B},setToggle:(B,S)=>{I.get(B).toggle=S},isToastActive:B=>m.some(S=>S===B),getSnapshot:()=>_}})(s,r,NNi);u2.set(s,A);const c=A.observe(a);return WZ.forEach(l=>Cgn(l.content,l.options)),WZ=[],()=>{c(),u2.delete(s)}},setProps(a){var A;(A=u2.get(s))==null||A.setProps(a)},getSnapshot(){var a;return(a=u2.get(s))==null?void 0:a.getSnapshot()}}})(t)).current;o(t);const i=ee.useSyncExternalStore(e,n,n);return{getToastToRender:function(r){if(!i)return[];const s=new Map;return t.newestOnTop&&i.reverse(),i.forEach(a=>{const{position:A}=a.props;s.has(A)||s.set(A,[]),s.get(A).push(a)}),Array.from(s,a=>r(a[0],a[1]))},isToastActive:Ign,count:i?.length}}function TNi(t){const[e,n]=ee.useState(!1),[o,i]=ee.useState(!1),r=ee.useRef(null),s=ee.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:a,pauseOnHover:A,closeToast:c,onClick:l,closeOnClick:u}=t;var g,h;function d(){n(!0)}function p(){n(!1)}function m(I){const C=r.current;s.canDrag&&C&&(s.didMove=!0,e&&p(),s.delta=t.draggableDirection==="x"?I.clientX-s.start:I.clientY-s.start,s.start!==I.clientX&&(s.canCloseOnClick=!1),C.style.transform=`translate3d(${t.draggableDirection==="x"?`${s.delta}px, var(--y)`:`0, calc(${s.delta}px + var(--y))`},0)`,C.style.opacity=""+(1-Math.abs(s.delta/s.removalDistance)))}function _(){document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",_);const I=r.current;if(s.canDrag&&s.didMove&&I){if(s.canDrag=!1,Math.abs(s.delta)>s.removalDistance)return i(!0),t.closeToast(),void t.collapseAll();I.style.transition="transform 0.2s, opacity 0.2s",I.style.removeProperty("transform"),I.style.removeProperty("opacity")}}(h=u2.get((g={id:t.toastId,containerId:t.containerId,fn:n}).containerId||1))==null||h.setToggle(g.id,g.fn),ee.useEffect(()=>{if(t.pauseOnFocusLoss)return document.hasFocus()||p(),window.addEventListener("focus",d),window.addEventListener("blur",p),()=>{window.removeEventListener("focus",d),window.removeEventListener("blur",p)}},[t.pauseOnFocusLoss]);const f={onPointerDown:function(I){if(t.draggable===!0||t.draggable===I.pointerType){s.didMove=!1,document.addEventListener("pointermove",m),document.addEventListener("pointerup",_);const C=r.current;s.canCloseOnClick=!0,s.canDrag=!0,C.style.transition="none",t.draggableDirection==="x"?(s.start=I.clientX,s.removalDistance=C.offsetWidth*(t.draggablePercent/100)):(s.start=I.clientY,s.removalDistance=C.offsetHeight*(t.draggablePercent===80?1.5*t.draggablePercent:t.draggablePercent)/100)}},onPointerUp:function(I){const{top:C,bottom:y,left:x,right:E}=r.current.getBoundingClientRect();I.nativeEvent.type!=="touchend"&&t.pauseOnHover&&I.clientX>=x&&I.clientX<=E&&I.clientY>=C&&I.clientY<=y?p():d()}};return a&&A&&(f.onMouseEnter=p,t.stacked||(f.onMouseLeave=d)),u&&(f.onClick=I=>{l&&l(I),s.canCloseOnClick&&c()}),{playToast:d,pauseToast:p,isRunning:e,preventExitTransition:o,toastRef:r,eventHandlers:f}}function kNi(t){let{delay:e,isRunning:n,closeToast:o,type:i="default",hide:r,className:s,style:a,controlledProgress:A,progress:c,rtl:l,isIn:u,theme:g}=t;const h=r||A&&c===0,d={...a,animationDuration:`${e}ms`,animationPlayState:n?"running":"paused"};A&&(d.transform=`scaleX(${c})`);const p=NB("Toastify__progress-bar",A?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${g}`,`Toastify__progress-bar--${i}`,{"Toastify__progress-bar--rtl":l}),m=NE(s)?s({rtl:l,type:i,defaultClassName:p}):NB(p,s),_={[A&&c>=1?"onTransitionEnd":"onAnimationEnd"]:A&&c<1?null:()=>{u&&o()}};return Fs.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":h},Fs.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${g} Toastify__progress-bar--${i}`}),Fs.createElement("div",{role:"progressbar","aria-hidden":h?"true":"false","aria-label":"notification timer",className:m,style:d,..._}))}let FNi=1;const xgn=()=>""+FNi++;function LNi(t){return t&&(kT(t.toastId)||JZ(t.toastId))?t.toastId:xgn()}function jZ(t,e){return Cgn(t,e),e.toastId}function L_e(t,e){return{...e,type:e&&e.type||t,toastId:LNi(e)}}function H_e(t){return(e,n)=>jZ(e,L_e(t,n))}function vd(t,e){return jZ(t,L_e("default",e))}vd.loading=(t,e)=>jZ(t,L_e("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...e})),vd.promise=function(t,e,n){let o,{pending:i,error:r,success:s}=e;i&&(o=kT(i)?vd.loading(i,n):vd.loading(i.render,{...n,...i}));const a={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},A=(l,u,g)=>{if(u==null)return void vd.dismiss(o);const h={type:l,...a,...n,data:g},d=kT(u)?{render:u}:u;return o?vd.update(o,{...h,...d}):vd(d.render,{...h,...d}),g},c=NE(t)?t():t;return c.then(l=>A("success",s,l)).catch(l=>A("error",r,l)),c},vd.success=H_e("success"),vd.info=H_e("info"),vd.error=H_e("error"),vd.warning=H_e("warning"),vd.warn=vd.warning,vd.dark=(t,e)=>jZ(t,L_e("default",{theme:"dark",...e})),vd.dismiss=function(t){(function(e){var n;if(fgn()){if(e==null||kT(n=e)||JZ(n))u2.forEach(o=>{o.removeToast(e)});else if(e&&("containerId"in e||"id"in e)){const o=u2.get(e.containerId);o?o.removeToast(e.id):u2.forEach(i=>{i.removeToast(e.id)})}}else WZ=WZ.filter(o=>e!=null&&o.options.toastId!==e)})(t)},vd.clearWaitingQueue=function(t){t===void 0&&(t={}),u2.forEach(e=>{!e.props.limit||t.containerId&&e.id!==t.containerId||e.clearQueue()})},vd.isActive=Ign,vd.update=function(t,e){e===void 0&&(e={});const n=((o,i)=>{var r;let{containerId:s}=i;return(r=u2.get(s||1))==null?void 0:r.toasts.get(o)})(t,e);if(n){const{props:o,content:i}=n,r={delay:100,...o,...e,toastId:e.toastId||t,updateId:xgn()};r.toastId!==t&&(r.staleId=t);const s=r.render||i;delete r.render,jZ(s,r)}},vd.done=t=>{vd.update(t,{progress:1})},vd.onChange=function(t){return Bje.add(t),()=>{Bje.delete(t)}},vd.play=t=>ygn(!0,t),vd.pause=t=>ygn(!1,t);const HNi=typeof window<"u"?ee.useLayoutEffect:ee.useEffect,O_e=t=>{let{theme:e,type:n,isLoading:o,...i}=t;return Fs.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:e==="colored"?"currentColor":`var(--toastify-icon-color-${n})`,...i})},bje={info:function(t){return Fs.createElement(O_e,{...t},Fs.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(t){return Fs.createElement(O_e,{...t},Fs.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(t){return Fs.createElement(O_e,{...t},Fs.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(t){return Fs.createElement(O_e,{...t},Fs.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return Fs.createElement("div",{className:"Toastify__spinner"})}},ONi=t=>{const{isRunning:e,preventExitTransition:n,toastRef:o,eventHandlers:i,playToast:r}=TNi(t),{closeButton:s,children:a,autoClose:A,onClick:c,type:l,hideProgressBar:u,closeToast:g,transition:h,position:d,className:p,style:m,bodyClassName:_,bodyStyle:f,progressClassName:I,progressStyle:C,updateId:y,role:x,progress:E,rtl:B,toastId:S,deleteToast:Q,isIn:w,isLoading:M,closeOnClick:k,theme:R}=t,F=NB("Toastify__toast",`Toastify__toast-theme--${R}`,`Toastify__toast--${l}`,{"Toastify__toast--rtl":B},{"Toastify__toast--close-on-click":k}),O=NE(p)?p({rtl:B,position:d,type:l,defaultClassName:F}):NB(F,p),U=(function(j){let{theme:J,type:oe,isLoading:ie,icon:ne}=j,le=null;const ge={theme:J,type:oe};return ne===!1||(NE(ne)?le=ne({...ge,isLoading:ie}):ee.isValidElement(ne)?le=ee.cloneElement(ne,ge):ie?le=bje.spinner():(_e=>_e in bje)(oe)&&(le=bje[oe](ge))),le})(t),Y=!!E||!A,W={closeToast:g,type:l,theme:R};let te=null;return s===!1||(te=NE(s)?s(W):ee.isValidElement(s)?ee.cloneElement(s,W):(function(j){let{closeToast:J,theme:oe,ariaLabel:ie="close"}=j;return Fs.createElement("button",{className:`Toastify__close-button Toastify__close-button--${oe}`,type:"button",onClick:ne=>{ne.stopPropagation(),J(ne)},"aria-label":ie},Fs.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},Fs.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))})(W)),Fs.createElement(h,{isIn:w,done:Q,position:d,preventExitTransition:n,nodeRef:o,playToast:r},Fs.createElement("div",{id:S,onClick:c,"data-in":w,className:O,...i,style:m,ref:o},Fs.createElement("div",{...w&&{role:x},className:NE(_)?_({type:l}):NB("Toastify__toast-body",_),style:f},U!=null&&Fs.createElement("div",{className:NB("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!M})},U),Fs.createElement("div",null,a)),te,Fs.createElement(kNi,{...y&&!Y?{key:`pb-${y}`}:{},rtl:B,theme:R,delay:A,isRunning:e,isIn:w,closeToast:g,hide:u,type:l,style:C,className:I,controlledProgress:Y,progress:E||0})))},G_e=function(t,e){return e===void 0&&(e=!1),{enter:`Toastify--animate Toastify__${t}-enter`,exit:`Toastify--animate Toastify__${t}-exit`,appendPosition:e}},GNi=F_e(G_e("bounce",!0));F_e(G_e("slide",!0)),F_e(G_e("zoom")),F_e(G_e("flip"));const YNi={position:"top-right",transition:GNi,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};function UNi(t){let e={...YNi,...t};const n=t.stacked,[o,i]=ee.useState(!0),r=ee.useRef(null),{getToastToRender:s,isToastActive:a,count:A}=RNi(e),{className:c,style:l,rtl:u,containerId:g}=e;function h(p){const m=NB("Toastify__toast-container",`Toastify__toast-container--${p}`,{"Toastify__toast-container--rtl":u});return NE(c)?c({position:p,rtl:u,defaultClassName:m}):NB(m,k_e(c))}function d(){n&&(i(!0),vd.play())}return HNi(()=>{if(n){var p;const m=r.current.querySelectorAll('[data-in="true"]'),_=12,f=(p=e.position)==null?void 0:p.includes("top");let I=0,C=0;Array.from(m).reverse().forEach((y,x)=>{const E=y;E.classList.add("Toastify__toast--stacked"),x>0&&(E.dataset.collapsed=`${o}`),E.dataset.pos||(E.dataset.pos=f?"top":"bot");const B=I*(o?.2:1)+(o?0:_*x);E.style.setProperty("--y",`${f?B:-1*B}px`),E.style.setProperty("--g",`${_}`),E.style.setProperty("--s",""+(1-(o?C:0))),I+=E.offsetHeight,C+=.025})}},[o,A,n]),Fs.createElement("div",{ref:r,className:"Toastify",id:g,onMouseEnter:()=>{n&&(i(!1),vd.pause())},onMouseLeave:d},s((p,m)=>{const _=m.length?{...l}:{...l,pointerEvents:"none"};return Fs.createElement("div",{className:h(p),style:_,key:`container-${p}`},m.map(f=>{let{content:I,props:C}=f;return Fs.createElement(ONi,{...C,stacked:n,collapseAll:d,isIn:a(C.toastId,C.containerId),style:C.style,key:`toast-${C.key}`},I)}))}))}function KNi(){var t=':root{--toastify-color-light:#fff;--toastify-color-dark:#121212;--toastify-color-info:#3498db;--toastify-color-success:#07bc0c;--toastify-color-warning:#f1c40f;--toastify-color-error:#e74c3c;--toastify-color-transparent:hsla(0,0%,100%,.7);--toastify-icon-color-info:var(--toastify-color-info);--toastify-icon-color-success:var(--toastify-color-success);--toastify-icon-color-warning:var(--toastify-color-warning);--toastify-icon-color-error:var(--toastify-color-error);--toastify-toast-width:320px;--toastify-toast-offset:16px;--toastify-toast-top:max(var(--toastify-toast-offset),env(safe-area-inset-top));--toastify-toast-right:max(var(--toastify-toast-offset),env(safe-area-inset-right));--toastify-toast-left:max(var(--toastify-toast-offset),env(safe-area-inset-left));--toastify-toast-bottom:max(var(--toastify-toast-offset),env(safe-area-inset-bottom));--toastify-toast-background:#fff;--toastify-toast-min-height:64px;--toastify-toast-max-height:800px;--toastify-toast-bd-radius:6px;--toastify-font-family:sans-serif;--toastify-z-index:9999;--toastify-text-color-light:#757575;--toastify-text-color-dark:#fff;--toastify-text-color-info:#fff;--toastify-text-color-success:#fff;--toastify-text-color-warning:#fff;--toastify-text-color-error:#fff;--toastify-spinner-color:#616161;--toastify-spinner-color-empty-area:#e0e0e0;--toastify-color-progress-light:linear-gradient(90deg,#4cd964,#5ac8fa,#007aff,#34aadc,#5856d6,#ff2d55);--toastify-color-progress-dark:#bb86fc;--toastify-color-progress-info:var(--toastify-color-info);--toastify-color-progress-success:var(--toastify-color-success);--toastify-color-progress-warning:var(--toastify-color-warning);--toastify-color-progress-error:var(--toastify-color-error);--toastify-color-progress-bgo:0.2}.Toastify__toast-container{z-index:var(--toastify-z-index);-webkit-transform:translateZ(var(--toastify-z-index));position:fixed;padding:4px;width:var(--toastify-toast-width);box-sizing:border-box;color:#fff}.Toastify__toast-container--top-left{top:var(--toastify-toast-top);left:var(--toastify-toast-left)}.Toastify__toast-container--top-center{top:var(--toastify-toast-top);left:50%;transform:translateX(-50%)}.Toastify__toast-container--top-right{top:var(--toastify-toast-top);right:var(--toastify-toast-right)}.Toastify__toast-container--bottom-left{bottom:var(--toastify-toast-bottom);left:var(--toastify-toast-left)}.Toastify__toast-container--bottom-center{bottom:var(--toastify-toast-bottom);left:50%;transform:translateX(-50%)}.Toastify__toast-container--bottom-right{bottom:var(--toastify-toast-bottom);right:var(--toastify-toast-right)}@media only screen and (max-width:480px){.Toastify__toast-container{width:100vw;padding:0;left:env(safe-area-inset-left);margin:0}.Toastify__toast-container--top-center,.Toastify__toast-container--top-left,.Toastify__toast-container--top-right{top:env(safe-area-inset-top);transform:translateX(0)}.Toastify__toast-container--bottom-center,.Toastify__toast-container--bottom-left,.Toastify__toast-container--bottom-right{bottom:env(safe-area-inset-bottom);transform:translateX(0)}.Toastify__toast-container--rtl{right:env(safe-area-inset-right);left:auto}}.Toastify__toast{--y:0;position:relative;-ms-touch-action:none;touch-action:none;min-height:var(--toastify-toast-min-height);box-sizing:border-box;margin-bottom:1rem;padding:8px;border-radius:var(--toastify-toast-bd-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;max-height:var(--toastify-toast-max-height);font-family:var(--toastify-font-family);cursor:default;direction:ltr;z-index:0;overflow:hidden}.Toastify__toast--stacked{position:absolute;width:100%;transform:translate3d(0,var(--y),0) scale(var(--s));transition:transform .3s}.Toastify__toast--stacked[data-collapsed] .Toastify__close-button,.Toastify__toast--stacked[data-collapsed] .Toastify__toast-body{transition:opacity .1s}.Toastify__toast--stacked[data-collapsed=false]{overflow:visible}.Toastify__toast--stacked[data-collapsed=true]:not(:last-child)>*{opacity:0}.Toastify__toast--stacked:after{content:"";position:absolute;left:0;right:0;height:calc(var(--g) * 1px);bottom:100%}.Toastify__toast--stacked[data-pos=top]{top:0}.Toastify__toast--stacked[data-pos=bot]{bottom:0}.Toastify__toast--stacked[data-pos=bot].Toastify__toast--stacked:before{transform-origin:top}.Toastify__toast--stacked[data-pos=top].Toastify__toast--stacked:before{transform-origin:bottom}.Toastify__toast--stacked:before{content:"";position:absolute;left:0;right:0;bottom:0;height:100%;transform:scaleY(3);z-index:-1}.Toastify__toast--rtl{direction:rtl}.Toastify__toast--close-on-click{cursor:pointer}.Toastify__toast-body{margin:auto 0;-ms-flex:1 1 auto;flex:1 1 auto;padding:6px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.Toastify__toast-body>div:last-child{word-break:break-word;-ms-flex:1;flex:1}.Toastify__toast-icon{-webkit-margin-end:10px;margin-inline-end:10px;width:20px;-ms-flex-negative:0;flex-shrink:0;display:-ms-flexbox;display:flex}.Toastify--animate{animation-fill-mode:both;animation-duration:.5s}.Toastify--animate-icon{animation-fill-mode:both;animation-duration:.3s}@media only screen and (max-width:480px){.Toastify__toast{margin-bottom:0;border-radius:0}}.Toastify__toast-theme--dark{background:var(--toastify-color-dark);color:var(--toastify-text-color-dark)}.Toastify__toast-theme--colored.Toastify__toast--default,.Toastify__toast-theme--light{background:var(--toastify-color-light);color:var(--toastify-text-color-light)}.Toastify__toast-theme--colored.Toastify__toast--info{color:var(--toastify-text-color-info);background:var(--toastify-color-info)}.Toastify__toast-theme--colored.Toastify__toast--success{color:var(--toastify-text-color-success);background:var(--toastify-color-success)}.Toastify__toast-theme--colored.Toastify__toast--warning{color:var(--toastify-text-color-warning);background:var(--toastify-color-warning)}.Toastify__toast-theme--colored.Toastify__toast--error{color:var(--toastify-text-color-error);background:var(--toastify-color-error)}.Toastify__progress-bar-theme--light{background:var(--toastify-color-progress-light)}.Toastify__progress-bar-theme--dark{background:var(--toastify-color-progress-dark)}.Toastify__progress-bar--info{background:var(--toastify-color-progress-info)}.Toastify__progress-bar--success{background:var(--toastify-color-progress-success)}.Toastify__progress-bar--warning{background:var(--toastify-color-progress-warning)}.Toastify__progress-bar--error{background:var(--toastify-color-progress-error)}.Toastify__progress-bar-theme--colored.Toastify__progress-bar--error,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--info,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--success,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--warning{background:var(--toastify-color-transparent)}.Toastify__close-button{color:#fff;background:transparent;outline:none;border:none;padding:0;cursor:pointer;opacity:.7;transition:.3s ease;-ms-flex-item-align:start;align-self:flex-start;z-index:1}.Toastify__close-button--light{color:#000;opacity:.3}.Toastify__close-button>svg{fill:currentColor;height:16px;width:14px}.Toastify__close-button:focus,.Toastify__close-button:hover{opacity:1}@keyframes Toastify__trackProgress{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.Toastify__progress-bar{position:absolute;bottom:0;left:0;width:100%;height:100%;z-index:var(--toastify-z-index);opacity:.7;transform-origin:left;border-bottom-left-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--animated{animation:Toastify__trackProgress linear 1 forwards}.Toastify__progress-bar--controlled{transition:transform .2s}.Toastify__progress-bar--rtl{right:0;left:auto;transform-origin:right;border-bottom-left-radius:0;border-bottom-right-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--wrp{position:absolute;bottom:0;left:0;width:100%;height:5px;border-bottom-left-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--wrp[data-hidden=true]{opacity:0}.Toastify__progress-bar--bg{opacity:var(--toastify-color-progress-bgo);width:100%;height:100%}.Toastify__spinner{width:20px;height:20px;box-sizing:border-box;border:2px solid;border-radius:100%;border-color:var(--toastify-spinner-color-empty-area);border-right-color:var(--toastify-spinner-color);animation:Toastify__spin .65s linear infinite}@keyframes Toastify__bounceInRight{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(3000px,0,0)}60%{opacity:1;transform:translate3d(-25px,0,0)}75%{transform:translate3d(10px,0,0)}90%{transform:translate3d(-5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutRight{20%{opacity:1;transform:translate3d(-20px,var(--y),0)}to{opacity:0;transform:translate3d(2000px,var(--y),0)}}@keyframes Toastify__bounceInLeft{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(-3000px,0,0)}60%{opacity:1;transform:translate3d(25px,0,0)}75%{transform:translate3d(-10px,0,0)}90%{transform:translate3d(5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutLeft{20%{opacity:1;transform:translate3d(20px,var(--y),0)}to{opacity:0;transform:translate3d(-2000px,var(--y),0)}}@keyframes Toastify__bounceInUp{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,3000px,0)}60%{opacity:1;transform:translate3d(0,-20px,0)}75%{transform:translate3d(0,10px,0)}90%{transform:translate3d(0,-5px,0)}to{transform:translateZ(0)}}@keyframes Toastify__bounceOutUp{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,-2000px,0)}}@keyframes Toastify__bounceInDown{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,-3000px,0)}60%{opacity:1;transform:translate3d(0,25px,0)}75%{transform:translate3d(0,-10px,0)}90%{transform:translate3d(0,5px,0)}to{transform:none}}@keyframes Toastify__bounceOutDown{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,2000px,0)}}.Toastify__bounce-enter--bottom-left,.Toastify__bounce-enter--top-left{animation-name:Toastify__bounceInLeft}.Toastify__bounce-enter--bottom-right,.Toastify__bounce-enter--top-right{animation-name:Toastify__bounceInRight}.Toastify__bounce-enter--top-center{animation-name:Toastify__bounceInDown}.Toastify__bounce-enter--bottom-center{animation-name:Toastify__bounceInUp}.Toastify__bounce-exit--bottom-left,.Toastify__bounce-exit--top-left{animation-name:Toastify__bounceOutLeft}.Toastify__bounce-exit--bottom-right,.Toastify__bounce-exit--top-right{animation-name:Toastify__bounceOutRight}.Toastify__bounce-exit--top-center{animation-name:Toastify__bounceOutUp}.Toastify__bounce-exit--bottom-center{animation-name:Toastify__bounceOutDown}@keyframes Toastify__zoomIn{0%{opacity:0;transform:scale3d(.3,.3,.3)}50%{opacity:1}}@keyframes Toastify__zoomOut{0%{opacity:1}50%{opacity:0;transform:translate3d(0,var(--y),0) scale3d(.3,.3,.3)}to{opacity:0}}.Toastify__zoom-enter{animation-name:Toastify__zoomIn}.Toastify__zoom-exit{animation-name:Toastify__zoomOut}@keyframes Toastify__flipIn{0%{transform:perspective(400px) rotateX(90deg);animation-timing-function:ease-in;opacity:0}40%{transform:perspective(400px) rotateX(-20deg);animation-timing-function:ease-in}60%{transform:perspective(400px) rotateX(10deg);opacity:1}80%{transform:perspective(400px) rotateX(-5deg)}to{transform:perspective(400px)}}@keyframes Toastify__flipOut{0%{transform:translate3d(0,var(--y),0) perspective(400px)}30%{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(-20deg);opacity:1}to{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(90deg);opacity:0}}.Toastify__flip-enter{animation-name:Toastify__flipIn}.Toastify__flip-exit{animation-name:Toastify__flipOut}@keyframes Toastify__slideInRight{0%{transform:translate3d(110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInLeft{0%{transform:translate3d(-110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInUp{0%{transform:translate3d(0,110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInDown{0%{transform:translate3d(0,-110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideOutRight{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(110%,var(--y),0)}}@keyframes Toastify__slideOutLeft{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(-110%,var(--y),0)}}@keyframes Toastify__slideOutDown{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,500px,0)}}@keyframes Toastify__slideOutUp{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,-500px,0)}}.Toastify__slide-enter--bottom-left,.Toastify__slide-enter--top-left{animation-name:Toastify__slideInLeft}.Toastify__slide-enter--bottom-right,.Toastify__slide-enter--top-right{animation-name:Toastify__slideInRight}.Toastify__slide-enter--top-center{animation-name:Toastify__slideInDown}.Toastify__slide-enter--bottom-center{animation-name:Toastify__slideInUp}.Toastify__slide-exit--bottom-left,.Toastify__slide-exit--top-left{animation-name:Toastify__slideOutLeft;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--bottom-right,.Toastify__slide-exit--top-right{animation-name:Toastify__slideOutRight;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-center{animation-name:Toastify__slideOutUp;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--bottom-center{animation-name:Toastify__slideOutDown;animation-timing-function:ease-in;animation-duration:.3s}@keyframes Toastify__spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}',e=document.createElement("style");e.innerText=t,document.head.appendChild(e)}const VNi=wit(WQn);var Sje,Egn;function zNi(){if(Egn)return Sje;Egn=1;var t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i=(m,_)=>{for(var f in _)t(m,f,{get:_[f],enumerable:!0})},r=(m,_,f,I)=>{if(_&&typeof _=="object"||typeof _=="function")for(let C of n(_))!o.call(m,C)&&C!==f&&t(m,C,{get:()=>_[C],enumerable:!(I=e(_,C))||I.enumerable});return m},s=m=>r(t({},"__esModule",{value:!0}),m),a={};i(a,{SuperGrid:()=>p,toMMSI:()=>d,toMeterSI:()=>h}),Sje=s(a);var A=L3(),c=VNi,l=kit(),u=(m,_,f)=>{const I=[];if(_<m)for(let C=m;C>=_;C-=Math.abs(f))I.push(C);else for(let C=m;C<=_;C+=Math.abs(f))I.push(C);return I};function g(m,_){return{x:Math.round(_.x/m)*m,y:Math.round(_.y/m)*m}}function h(m,_=1){return m<0?"-"+h(-m):m<1e-6?"0m":m>1e3?Math.floor(m/1e3)+"km":m>1&&_>1?Math.round(m)+"m":m>1&&_<=1?m.toFixed(Math.ceil(-Math.log10(_)))+"m":m<1&&_>=1/1e3?Math.round(m*1e3)+"mm":m<1&&_<1/1e3?(m*1e3).toFixed(Math.ceil(-Math.log10(_*1e3)))+"mm":""}function d(m,_=1){return h(m/1e3,_/1e3)}var p=m=>{var _;const f=(0,A.useRef)(null),[I,C]=(0,A.useState)({x:0,y:0}),{majorColor:y="rgba(0,0,0,0.2)",minorColor:x="rgba(0,0,0,0.1)",textColor:E=(_=m.majorColor)!=null?_:"rgba(0,0,0,0.5)",width:B,height:S,screenSpaceCellSize:Q=200,stringifyCoord:w=(F,O,U)=>`${h(F,U)}, ${h(O,U)}`}=m,M=Math.ceil(B/Q)+2,k=Math.ceil(S/Q)+2;(0,A.useEffect)(()=>{if(!f.current)return;const F=f.current.getContext("2d");if(!F)return;const O=Q/10**Math.floor(Math.log10(m.transform.a)),U=m.transform.d<0?-1:1,W=Q/10**Math.log10(m.transform.a)/O;function te(fe,pe,ye){const Me=fe;let ve,he,Qe;for(ve=pe.x;ve<=ye.x;ve+=Me)he=(0,c.applyToPoint)(m.transform,{x:ve,y:pe.y}),Qe=(0,c.applyToPoint)(m.transform,{x:ve,y:ye.y}),F.beginPath(),F.moveTo(he.x,he.y),F.lineTo(Qe.x,Qe.y),F.stroke();const Pe=u(pe.y,ye.y,Me*U);for(const we of Pe)he=(0,c.applyToPoint)(m.transform,{x:pe.x,y:we}),Qe=(0,c.applyToPoint)(m.transform,{x:ye.x,y:we}),F.beginPath(),F.moveTo(he.x,he.y),F.lineTo(Qe.x,Qe.y),F.stroke()}function j(fe,pe,ye){const Me=fe;let ve;for(ve=pe.x;ve<=ye.x;ve+=Me)for(const he of u(pe.y,ye.y,Me*U)){const Qe=(0,c.applyToPoint)(m.transform,{x:ve,y:he});F.fillStyle=E,F.font="12px sans-serif",F.fillText(w(ve,he,fe),Qe.x+2,Qe.y-2)}}F.clearRect(0,0,B,S);const J=(0,c.applyToPoint)((0,c.inverse)(m.transform),{x:0,y:0}),oe={x:Math.floor((J.x-O)/O)*O,y:Math.floor((J.y-O)/O+(U==-1?2:0))*O},ie={x:oe.x+O*M,y:oe.y+O*k*U},le=O*5,ge={x:Math.floor((J.x-le)/le)*le,y:Math.floor((J.y-le)/le+(U==-1?2:0))*le},_e={x:ge.x+le*M,y:ge.y+le*k*U};F.globalAlpha=1,F.strokeStyle=y,te(O,oe,ie),j(le,ge,_e),F.globalAlpha=1-W,te(le/10,ge,_e),F.globalAlpha=1-W,F.strokeStyle=x,te(O/10,oe,ie),F.globalAlpha=Math.max(((1-W)*10-5)/5,0),j(le/10,ge,_e),F.globalAlpha=1;const ue=(0,c.applyToPoint)(m.transform,I);F.font="12px sans-serif",F.fillStyle=E,F.fillText(w(I.x,I.y,O),ue.x+2,ue.y-2),F.strokeStyle=y,F.strokeRect(ue.x-5,ue.y-5,10,10)},[f,m.transform,I,B,S]);const R=F=>{if(!f.current)return;const O=Q/10/10**Math.floor(Math.log10(m.transform.a)),U=f.current.getBoundingClientRect(),Y=(0,c.applyToPoint)((0,c.inverse)(m.transform),{x:F.clientX-U.left,y:F.clientY-U.top}),W=g(O,Y);C(W)};return(0,l.jsx)("canvas",{onMouseUp:F=>{F.button===1&&R(F)},onDoubleClick:R,ref:f,width:m.width,height:m.height})};return Sje}var FT=zNi(),Qje={exports:{}},vje,Bgn;function JNi(){return Bgn||(Bgn=1,vje={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}),vje}var wje={exports:{}},Pje,bgn;function WNi(){return bgn||(bgn=1,Pje=function(e){return!e||typeof e=="string"?!1:e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&e.constructor.name!=="String")}),Pje}var Sgn;function jNi(){if(Sgn)return wje.exports;Sgn=1;var t=WNi(),e=Array.prototype.concat,n=Array.prototype.slice,o=wje.exports=function(r){for(var s=[],a=0,A=r.length;a<A;a++){var c=r[a];t(c)?s=e.call(s,n.call(c)):s.push(c)}return s};return o.wrap=function(i){return function(){return i(o(arguments))}},wje.exports}var Qgn;function $Ni(){if(Qgn)return Qje.exports;Qgn=1;var t=JNi(),e=jNi(),n=Object.hasOwnProperty,o=Object.create(null);for(var i in t)n.call(t,i)&&(o[t[i]]=i);var r=Qje.exports={to:{},get:{}};r.get=function(A){var c=A.substring(0,3).toLowerCase(),l,u;switch(c){case"hsl":l=r.get.hsl(A),u="hsl";break;case"hwb":l=r.get.hwb(A),u="hwb";break;default:l=r.get.rgb(A),u="rgb";break}return l?{model:u,value:l}:null},r.get.rgb=function(A){if(!A)return null;var c=/^#([a-f0-9]{3,4})$/i,l=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,u=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,g=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,h=/^(\w+)$/,d=[0,0,0,1],p,m,_;if(p=A.match(l)){for(_=p[2],p=p[1],m=0;m<3;m++){var f=m*2;d[m]=parseInt(p.slice(f,f+2),16)}_&&(d[3]=parseInt(_,16)/255)}else if(p=A.match(c)){for(p=p[1],_=p[3],m=0;m<3;m++)d[m]=parseInt(p[m]+p[m],16);_&&(d[3]=parseInt(_+_,16)/255)}else if(p=A.match(u)){for(m=0;m<3;m++)d[m]=parseInt(p[m+1],0);p[4]&&(p[5]?d[3]=parseFloat(p[4])*.01:d[3]=parseFloat(p[4]))}else if(p=A.match(g)){for(m=0;m<3;m++)d[m]=Math.round(parseFloat(p[m+1])*2.55);p[4]&&(p[5]?d[3]=parseFloat(p[4])*.01:d[3]=parseFloat(p[4]))}else return(p=A.match(h))?p[1]==="transparent"?[0,0,0,0]:n.call(t,p[1])?(d=t[p[1]],d[3]=1,d):null:null;for(m=0;m<3;m++)d[m]=s(d[m],0,255);return d[3]=s(d[3],0,1),d},r.get.hsl=function(A){if(!A)return null;var c=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,l=A.match(c);if(l){var u=parseFloat(l[4]),g=(parseFloat(l[1])%360+360)%360,h=s(parseFloat(l[2]),0,100),d=s(parseFloat(l[3]),0,100),p=s(isNaN(u)?1:u,0,1);return[g,h,d,p]}return null},r.get.hwb=function(A){if(!A)return null;var c=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,l=A.match(c);if(l){var u=parseFloat(l[4]),g=(parseFloat(l[1])%360+360)%360,h=s(parseFloat(l[2]),0,100),d=s(parseFloat(l[3]),0,100),p=s(isNaN(u)?1:u,0,1);return[g,h,d,p]}return null},r.to.hex=function(){var A=e(arguments);return"#"+a(A[0])+a(A[1])+a(A[2])+(A[3]<1?a(Math.round(A[3]*255)):"")},r.to.rgb=function(){var A=e(arguments);return A.length<4||A[3]===1?"rgb("+Math.round(A[0])+", "+Math.round(A[1])+", "+Math.round(A[2])+")":"rgba("+Math.round(A[0])+", "+Math.round(A[1])+", "+Math.round(A[2])+", "+A[3]+")"},r.to.rgb.percent=function(){var A=e(arguments),c=Math.round(A[0]/255*100),l=Math.round(A[1]/255*100),u=Math.round(A[2]/255*100);return A.length<4||A[3]===1?"rgb("+c+"%, "+l+"%, "+u+"%)":"rgba("+c+"%, "+l+"%, "+u+"%, "+A[3]+")"},r.to.hsl=function(){var A=e(arguments);return A.length<4||A[3]===1?"hsl("+A[0]+", "+A[1]+"%, "+A[2]+"%)":"hsla("+A[0]+", "+A[1]+"%, "+A[2]+"%, "+A[3]+")"},r.to.hwb=function(){var A=e(arguments),c="";return A.length>=4&&A[3]!==1&&(c=", "+A[3]),"hwb("+A[0]+", "+A[1]+"%, "+A[2]+"%"+c+")"},r.to.keyword=function(A){return o[A.slice(0,3)]};function s(A,c,l){return Math.min(Math.max(c,A),l)}function a(A){var c=Math.round(A).toString(16).toUpperCase();return c.length<2?"0"+c:c}return Qje.exports}var Mje,vgn;function qNi(){return vgn||(vgn=1,Mje={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}),Mje}var Dje,wgn;function Pgn(){if(wgn)return Dje;wgn=1;const t=qNi(),e={};for(const i of Object.keys(t))e[t[i]]=i;const n={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};Dje=n;for(const i of Object.keys(n)){if(!("channels"in n[i]))throw new Error("missing channels property: "+i);if(!("labels"in n[i]))throw new Error("missing channel labels property: "+i);if(n[i].labels.length!==n[i].channels)throw new Error("channel and label counts mismatch: "+i);const{channels:r,labels:s}=n[i];delete n[i].channels,delete n[i].labels,Object.defineProperty(n[i],"channels",{value:r}),Object.defineProperty(n[i],"labels",{value:s})}n.rgb.hsl=function(i){const r=i[0]/255,s=i[1]/255,a=i[2]/255,A=Math.min(r,s,a),c=Math.max(r,s,a),l=c-A;let u,g;c===A?u=0:r===c?u=(s-a)/l:s===c?u=2+(a-r)/l:a===c&&(u=4+(r-s)/l),u=Math.min(u*60,360),u<0&&(u+=360);const h=(A+c)/2;return c===A?g=0:h<=.5?g=l/(c+A):g=l/(2-c-A),[u,g*100,h*100]},n.rgb.hsv=function(i){let r,s,a,A,c;const l=i[0]/255,u=i[1]/255,g=i[2]/255,h=Math.max(l,u,g),d=h-Math.min(l,u,g),p=function(m){return(h-m)/6/d+1/2};return d===0?(A=0,c=0):(c=d/h,r=p(l),s=p(u),a=p(g),l===h?A=a-s:u===h?A=1/3+r-a:g===h&&(A=2/3+s-r),A<0?A+=1:A>1&&(A-=1)),[A*360,c*100,h*100]},n.rgb.hwb=function(i){const r=i[0],s=i[1];let a=i[2];const A=n.rgb.hsl(i)[0],c=1/255*Math.min(r,Math.min(s,a));return a=1-1/255*Math.max(r,Math.max(s,a)),[A,c*100,a*100]},n.rgb.cmyk=function(i){const r=i[0]/255,s=i[1]/255,a=i[2]/255,A=Math.min(1-r,1-s,1-a),c=(1-r-A)/(1-A)||0,l=(1-s-A)/(1-A)||0,u=(1-a-A)/(1-A)||0;return[c*100,l*100,u*100,A*100]};function o(i,r){return(i[0]-r[0])**2+(i[1]-r[1])**2+(i[2]-r[2])**2}return n.rgb.keyword=function(i){const r=e[i];if(r)return r;let s=1/0,a;for(const A of Object.keys(t)){const c=t[A],l=o(i,c);l<s&&(s=l,a=A)}return a},n.keyword.rgb=function(i){return t[i]},n.rgb.xyz=function(i){let r=i[0]/255,s=i[1]/255,a=i[2]/255;r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,s=s>.04045?((s+.055)/1.055)**2.4:s/12.92,a=a>.04045?((a+.055)/1.055)**2.4:a/12.92;const A=r*.4124+s*.3576+a*.1805,c=r*.2126+s*.7152+a*.0722,l=r*.0193+s*.1192+a*.9505;return[A*100,c*100,l*100]},n.rgb.lab=function(i){const r=n.rgb.xyz(i);let s=r[0],a=r[1],A=r[2];s/=95.047,a/=100,A/=108.883,s=s>.008856?s**(1/3):7.787*s+16/116,a=a>.008856?a**(1/3):7.787*a+16/116,A=A>.008856?A**(1/3):7.787*A+16/116;const c=116*a-16,l=500*(s-a),u=200*(a-A);return[c,l,u]},n.hsl.rgb=function(i){const r=i[0]/360,s=i[1]/100,a=i[2]/100;let A,c,l;if(s===0)return l=a*255,[l,l,l];a<.5?A=a*(1+s):A=a+s-a*s;const u=2*a-A,g=[0,0,0];for(let h=0;h<3;h++)c=r+1/3*-(h-1),c<0&&c++,c>1&&c--,6*c<1?l=u+(A-u)*6*c:2*c<1?l=A:3*c<2?l=u+(A-u)*(2/3-c)*6:l=u,g[h]=l*255;return g},n.hsl.hsv=function(i){const r=i[0];let s=i[1]/100,a=i[2]/100,A=s;const c=Math.max(a,.01);a*=2,s*=a<=1?a:2-a,A*=c<=1?c:2-c;const l=(a+s)/2,u=a===0?2*A/(c+A):2*s/(a+s);return[r,u*100,l*100]},n.hsv.rgb=function(i){const r=i[0]/60,s=i[1]/100;let a=i[2]/100;const A=Math.floor(r)%6,c=r-Math.floor(r),l=255*a*(1-s),u=255*a*(1-s*c),g=255*a*(1-s*(1-c));switch(a*=255,A){case 0:return[a,g,l];case 1:return[u,a,l];case 2:return[l,a,g];case 3:return[l,u,a];case 4:return[g,l,a];case 5:return[a,l,u]}},n.hsv.hsl=function(i){const r=i[0],s=i[1]/100,a=i[2]/100,A=Math.max(a,.01);let c,l;l=(2-s)*a;const u=(2-s)*A;return c=s*A,c/=u<=1?u:2-u,c=c||0,l/=2,[r,c*100,l*100]},n.hwb.rgb=function(i){const r=i[0]/360;let s=i[1]/100,a=i[2]/100;const A=s+a;let c;A>1&&(s/=A,a/=A);const l=Math.floor(6*r),u=1-a;c=6*r-l,(l&1)!==0&&(c=1-c);const g=s+c*(u-s);let h,d,p;switch(l){default:case 6:case 0:h=u,d=g,p=s;break;case 1:h=g,d=u,p=s;break;case 2:h=s,d=u,p=g;break;case 3:h=s,d=g,p=u;break;case 4:h=g,d=s,p=u;break;case 5:h=u,d=s,p=g;break}return[h*255,d*255,p*255]},n.cmyk.rgb=function(i){const r=i[0]/100,s=i[1]/100,a=i[2]/100,A=i[3]/100,c=1-Math.min(1,r*(1-A)+A),l=1-Math.min(1,s*(1-A)+A),u=1-Math.min(1,a*(1-A)+A);return[c*255,l*255,u*255]},n.xyz.rgb=function(i){const r=i[0]/100,s=i[1]/100,a=i[2]/100;let A,c,l;return A=r*3.2406+s*-1.5372+a*-.4986,c=r*-.9689+s*1.8758+a*.0415,l=r*.0557+s*-.204+a*1.057,A=A>.0031308?1.055*A**(1/2.4)-.055:A*12.92,c=c>.0031308?1.055*c**(1/2.4)-.055:c*12.92,l=l>.0031308?1.055*l**(1/2.4)-.055:l*12.92,A=Math.min(Math.max(0,A),1),c=Math.min(Math.max(0,c),1),l=Math.min(Math.max(0,l),1),[A*255,c*255,l*255]},n.xyz.lab=function(i){let r=i[0],s=i[1],a=i[2];r/=95.047,s/=100,a/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,s=s>.008856?s**(1/3):7.787*s+16/116,a=a>.008856?a**(1/3):7.787*a+16/116;const A=116*s-16,c=500*(r-s),l=200*(s-a);return[A,c,l]},n.lab.xyz=function(i){const r=i[0],s=i[1],a=i[2];let A,c,l;c=(r+16)/116,A=s/500+c,l=c-a/200;const u=c**3,g=A**3,h=l**3;return c=u>.008856?u:(c-16/116)/7.787,A=g>.008856?g:(A-16/116)/7.787,l=h>.008856?h:(l-16/116)/7.787,A*=95.047,c*=100,l*=108.883,[A,c,l]},n.lab.lch=function(i){const r=i[0],s=i[1],a=i[2];let A;A=Math.atan2(a,s)*360/2/Math.PI,A<0&&(A+=360);const l=Math.sqrt(s*s+a*a);return[r,l,A]},n.lch.lab=function(i){const r=i[0],s=i[1],A=i[2]/360*2*Math.PI,c=s*Math.cos(A),l=s*Math.sin(A);return[r,c,l]},n.rgb.ansi16=function(i,r=null){const[s,a,A]=i;let c=r===null?n.rgb.hsv(i)[2]:r;if(c=Math.round(c/50),c===0)return 30;let l=30+(Math.round(A/255)<<2|Math.round(a/255)<<1|Math.round(s/255));return c===2&&(l+=60),l},n.hsv.ansi16=function(i){return n.rgb.ansi16(n.hsv.rgb(i),i[2])},n.rgb.ansi256=function(i){const r=i[0],s=i[1],a=i[2];return r===s&&s===a?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(s/255*5)+Math.round(a/255*5)},n.ansi16.rgb=function(i){let r=i%10;if(r===0||r===7)return i>50&&(r+=3.5),r=r/10.5*255,[r,r,r];const s=(~~(i>50)+1)*.5,a=(r&1)*s*255,A=(r>>1&1)*s*255,c=(r>>2&1)*s*255;return[a,A,c]},n.ansi256.rgb=function(i){if(i>=232){const c=(i-232)*10+8;return[c,c,c]}i-=16;let r;const s=Math.floor(i/36)/5*255,a=Math.floor((r=i%36)/6)/5*255,A=r%6/5*255;return[s,a,A]},n.rgb.hex=function(i){const s=(((Math.round(i[0])&255)<<16)+((Math.round(i[1])&255)<<8)+(Math.round(i[2])&255)).toString(16).toUpperCase();return"000000".substring(s.length)+s},n.hex.rgb=function(i){const r=i.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!r)return[0,0,0];let s=r[0];r[0].length===3&&(s=s.split("").map(u=>u+u).join(""));const a=parseInt(s,16),A=a>>16&255,c=a>>8&255,l=a&255;return[A,c,l]},n.rgb.hcg=function(i){const r=i[0]/255,s=i[1]/255,a=i[2]/255,A=Math.max(Math.max(r,s),a),c=Math.min(Math.min(r,s),a),l=A-c;let u,g;return l<1?u=c/(1-l):u=0,l<=0?g=0:A===r?g=(s-a)/l%6:A===s?g=2+(a-r)/l:g=4+(r-s)/l,g/=6,g%=1,[g*360,l*100,u*100]},n.hsl.hcg=function(i){const r=i[1]/100,s=i[2]/100,a=s<.5?2*r*s:2*r*(1-s);let A=0;return a<1&&(A=(s-.5*a)/(1-a)),[i[0],a*100,A*100]},n.hsv.hcg=function(i){const r=i[1]/100,s=i[2]/100,a=r*s;let A=0;return a<1&&(A=(s-a)/(1-a)),[i[0],a*100,A*100]},n.hcg.rgb=function(i){const r=i[0]/360,s=i[1]/100,a=i[2]/100;if(s===0)return[a*255,a*255,a*255];const A=[0,0,0],c=r%1*6,l=c%1,u=1-l;let g=0;switch(Math.floor(c)){case 0:A[0]=1,A[1]=l,A[2]=0;break;case 1:A[0]=u,A[1]=1,A[2]=0;break;case 2:A[0]=0,A[1]=1,A[2]=l;break;case 3:A[0]=0,A[1]=u,A[2]=1;break;case 4:A[0]=l,A[1]=0,A[2]=1;break;default:A[0]=1,A[1]=0,A[2]=u}return g=(1-s)*a,[(s*A[0]+g)*255,(s*A[1]+g)*255,(s*A[2]+g)*255]},n.hcg.hsv=function(i){const r=i[1]/100,s=i[2]/100,a=r+s*(1-r);let A=0;return a>0&&(A=r/a),[i[0],A*100,a*100]},n.hcg.hsl=function(i){const r=i[1]/100,a=i[2]/100*(1-r)+.5*r;let A=0;return a>0&&a<.5?A=r/(2*a):a>=.5&&a<1&&(A=r/(2*(1-a))),[i[0],A*100,a*100]},n.hcg.hwb=function(i){const r=i[1]/100,s=i[2]/100,a=r+s*(1-r);return[i[0],(a-r)*100,(1-a)*100]},n.hwb.hcg=function(i){const r=i[1]/100,a=1-i[2]/100,A=a-r;let c=0;return A<1&&(c=(a-A)/(1-A)),[i[0],A*100,c*100]},n.apple.rgb=function(i){return[i[0]/65535*255,i[1]/65535*255,i[2]/65535*255]},n.rgb.apple=function(i){return[i[0]/255*65535,i[1]/255*65535,i[2]/255*65535]},n.gray.rgb=function(i){return[i[0]/100*255,i[0]/100*255,i[0]/100*255]},n.gray.hsl=function(i){return[0,0,i[0]]},n.gray.hsv=n.gray.hsl,n.gray.hwb=function(i){return[0,100,i[0]]},n.gray.cmyk=function(i){return[0,0,0,i[0]]},n.gray.lab=function(i){return[i[0],0,0]},n.gray.hex=function(i){const r=Math.round(i[0]/100*255)&255,a=((r<<16)+(r<<8)+r).toString(16).toUpperCase();return"000000".substring(a.length)+a},n.rgb.gray=function(i){return[(i[0]+i[1]+i[2])/3/255*100]},Dje}var Nje,Mgn;function XNi(){if(Mgn)return Nje;Mgn=1;const t=Pgn();function e(){const r={},s=Object.keys(t);for(let a=s.length,A=0;A<a;A++)r[s[A]]={distance:-1,parent:null};return r}function n(r){const s=e(),a=[r];for(s[r].distance=0;a.length;){const A=a.pop(),c=Object.keys(t[A]);for(let l=c.length,u=0;u<l;u++){const g=c[u],h=s[g];h.distance===-1&&(h.distance=s[A].distance+1,h.parent=A,a.unshift(g))}}return s}function o(r,s){return function(a){return s(r(a))}}function i(r,s){const a=[s[r].parent,r];let A=t[s[r].parent][r],c=s[r].parent;for(;s[c].parent;)a.unshift(s[c].parent),A=o(t[s[c].parent][c],A),c=s[c].parent;return A.conversion=a,A}return Nje=function(r){const s=n(r),a={},A=Object.keys(s);for(let c=A.length,l=0;l<c;l++){const u=A[l];s[u].parent!==null&&(a[u]=i(u,s))}return a},Nje}var Rje,Dgn;function ZNi(){if(Dgn)return Rje;Dgn=1;const t=Pgn(),e=XNi(),n={},o=Object.keys(t);function i(s){const a=function(...A){const c=A[0];return c==null?c:(c.length>1&&(A=c),s(A))};return"conversion"in s&&(a.conversion=s.conversion),a}function r(s){const a=function(...A){const c=A[0];if(c==null)return c;c.length>1&&(A=c);const l=s(A);if(typeof l=="object")for(let u=l.length,g=0;g<u;g++)l[g]=Math.round(l[g]);return l};return"conversion"in s&&(a.conversion=s.conversion),a}return o.forEach(s=>{n[s]={},Object.defineProperty(n[s],"channels",{value:t[s].channels}),Object.defineProperty(n[s],"labels",{value:t[s].labels});const a=e(s);Object.keys(a).forEach(c=>{const l=a[c];n[s][c]=r(l),n[s][c].raw=i(l)})}),Rje=n,Rje}var Tje,Ngn;function eRi(){if(Ngn)return Tje;Ngn=1;const t=$Ni(),e=ZNi(),n=["keyword","gray","hex"],o={};for(const g of Object.keys(e))o[[...e[g].labels].sort().join("")]=g;const i={};function r(g,h){if(!(this instanceof r))return new r(g,h);if(h&&h in n&&(h=null),h&&!(h in e))throw new Error("Unknown model: "+h);let d,p;if(g==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(g instanceof r)this.model=g.model,this.color=[...g.color],this.valpha=g.valpha;else if(typeof g=="string"){const m=t.get(g);if(m===null)throw new Error("Unable to parse color from string: "+g);this.model=m.model,p=e[this.model].channels,this.color=m.value.slice(0,p),this.valpha=typeof m.value[p]=="number"?m.value[p]:1}else if(g.length>0){this.model=h||"rgb",p=e[this.model].channels;const m=Array.prototype.slice.call(g,0,p);this.color=u(m,p),this.valpha=typeof g[p]=="number"?g[p]:1}else if(typeof g=="number")this.model="rgb",this.color=[g>>16&255,g>>8&255,g&255],this.valpha=1;else{this.valpha=1;const m=Object.keys(g);"alpha"in g&&(m.splice(m.indexOf("alpha"),1),this.valpha=typeof g.alpha=="number"?g.alpha:0);const _=m.sort().join("");if(!(_ in o))throw new Error("Unable to parse color from object: "+JSON.stringify(g));this.model=o[_];const{labels:f}=e[this.model],I=[];for(d=0;d<f.length;d++)I.push(g[f[d]]);this.color=u(I)}if(i[this.model])for(p=e[this.model].channels,d=0;d<p;d++){const m=i[this.model][d];m&&(this.color[d]=m(this.color[d]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}r.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(g){let h=this.model in t.to?this:this.rgb();h=h.round(typeof g=="number"?g:1);const d=h.valpha===1?h.color:[...h.color,this.valpha];return t.to[h.model](d)},percentString(g){const h=this.rgb().round(typeof g=="number"?g:1),d=h.valpha===1?h.color:[...h.color,this.valpha];return t.to.rgb.percent(d)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){const g={},{channels:h}=e[this.model],{labels:d}=e[this.model];for(let p=0;p<h;p++)g[d[p]]=this.color[p];return this.valpha!==1&&(g.alpha=this.valpha),g},unitArray(){const g=this.rgb().color;return g[0]/=255,g[1]/=255,g[2]/=255,this.valpha!==1&&g.push(this.valpha),g},unitObject(){const g=this.rgb().object();return g.r/=255,g.g/=255,g.b/=255,this.valpha!==1&&(g.alpha=this.valpha),g},round(g){return g=Math.max(g||0,0),new r([...this.color.map(a(g)),this.valpha],this.model)},alpha(g){return g!==void 0?new r([...this.color,Math.max(0,Math.min(1,g))],this.model):this.valpha},red:A("rgb",0,c(255)),green:A("rgb",1,c(255)),blue:A("rgb",2,c(255)),hue:A(["hsl","hsv","hsl","hwb","hcg"],0,g=>(g%360+360)%360),saturationl:A("hsl",1,c(100)),lightness:A("hsl",2,c(100)),saturationv:A("hsv",1,c(100)),value:A("hsv",2,c(100)),chroma:A("hcg",1,c(100)),gray:A("hcg",2,c(100)),white:A("hwb",1,c(100)),wblack:A("hwb",2,c(100)),cyan:A("cmyk",0,c(100)),magenta:A("cmyk",1,c(100)),yellow:A("cmyk",2,c(100)),black:A("cmyk",3,c(100)),x:A("xyz",0,c(95.047)),y:A("xyz",1,c(100)),z:A("xyz",2,c(108.833)),l:A("lab",0,c(100)),a:A("lab",1),b:A("lab",2),keyword(g){return g!==void 0?new r(g):e[this.model].keyword(this.color)},hex(g){return g!==void 0?new r(g):t.to.hex(this.rgb().round().color)},hexa(g){if(g!==void 0)return new r(g);const h=this.rgb().round().color;let d=Math.round(this.valpha*255).toString(16).toUpperCase();return d.length===1&&(d="0"+d),t.to.hex(h)+d},rgbNumber(){const g=this.rgb().color;return(g[0]&255)<<16|(g[1]&255)<<8|g[2]&255},luminosity(){const g=this.rgb().color,h=[];for(const[d,p]of g.entries()){const m=p/255;h[d]=m<=.04045?m/12.92:((m+.055)/1.055)**2.4}return .2126*h[0]+.7152*h[1]+.0722*h[2]},contrast(g){const h=this.luminosity(),d=g.luminosity();return h>d?(h+.05)/(d+.05):(d+.05)/(h+.05)},level(g){const h=this.contrast(g);return h>=7?"AAA":h>=4.5?"AA":""},isDark(){const g=this.rgb().color;return(g[0]*2126+g[1]*7152+g[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const g=this.rgb();for(let h=0;h<3;h++)g.color[h]=255-g.color[h];return g},lighten(g){const h=this.hsl();return h.color[2]+=h.color[2]*g,h},darken(g){const h=this.hsl();return h.color[2]-=h.color[2]*g,h},saturate(g){const h=this.hsl();return h.color[1]+=h.color[1]*g,h},desaturate(g){const h=this.hsl();return h.color[1]-=h.color[1]*g,h},whiten(g){const h=this.hwb();return h.color[1]+=h.color[1]*g,h},blacken(g){const h=this.hwb();return h.color[2]+=h.color[2]*g,h},grayscale(){const g=this.rgb().color,h=g[0]*.3+g[1]*.59+g[2]*.11;return r.rgb(h,h,h)},fade(g){return this.alpha(this.valpha-this.valpha*g)},opaquer(g){return this.alpha(this.valpha+this.valpha*g)},rotate(g){const h=this.hsl();let d=h.color[0];return d=(d+g)%360,d=d<0?360+d:d,h.color[0]=d,h},mix(g,h){if(!g||!g.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof g);const d=g.rgb(),p=this.rgb(),m=h===void 0?.5:h,_=2*m-1,f=d.alpha()-p.alpha(),I=((_*f===-1?_:(_+f)/(1+_*f))+1)/2,C=1-I;return r.rgb(I*d.red()+C*p.red(),I*d.green()+C*p.green(),I*d.blue()+C*p.blue(),d.alpha()*m+p.alpha()*(1-m))}};for(const g of Object.keys(e)){if(n.includes(g))continue;const{channels:h}=e[g];r.prototype[g]=function(...d){return this.model===g?new r(this):d.length>0?new r(d,g):new r([...l(e[this.model][g].raw(this.color)),this.valpha],g)},r[g]=function(...d){let p=d[0];return typeof p=="number"&&(p=u(d,h)),new r(p,g)}}function s(g,h){return Number(g.toFixed(h))}function a(g){return function(h){return s(h,g)}}function A(g,h,d){g=Array.isArray(g)?g:[g];for(const p of g)(i[p]||(i[p]=[]))[h]=d;return g=g[0],function(p){let m;return p!==void 0?(d&&(p=d(p)),m=this[g](),m.color[h]=p,m):(m=this[g]().color[h],d&&(m=d(m)),m)}}function c(g){return function(h){return Math.max(0,Math.min(g,h))}}function l(g){return Array.isArray(g)?g:[g]}function u(g,h){for(let d=0;d<h;d++)typeof g[d]!="number"&&(g[d]=0);return g}return Tje=r,Tje}var tRi=eRi();const Ka=_y(tRi);function nRi(t){if(t.sheet)return t.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===t)return document.styleSheets[e]}function oRi(t){var e=document.createElement("style");return e.setAttribute("data-emotion",t.key),t.nonce!==void 0&&e.setAttribute("nonce",t.nonce),e.appendChild(document.createTextNode("")),e.setAttribute("data-s",""),e}var iRi=(function(){function t(n){var o=this;this._insertTag=function(i){var r;o.tags.length===0?o.insertionPoint?r=o.insertionPoint.nextSibling:o.prepend?r=o.container.firstChild:r=o.before:r=o.tags[o.tags.length-1].nextSibling,o.container.insertBefore(i,r),o.tags.push(i)},this.isSpeedy=n.speedy===void 0?!0:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var e=t.prototype;return e.hydrate=function(o){o.forEach(this._insertTag)},e.insert=function(o){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(oRi(this));var i=this.tags[this.tags.length-1];if(this.isSpeedy){var r=nRi(i);try{r.insertRule(o,r.cssRules.length)}catch{}}else i.appendChild(document.createTextNode(o));this.ctr++},e.flush=function(){this.tags.forEach(function(o){var i;return(i=o.parentNode)==null?void 0:i.removeChild(o)}),this.tags=[],this.ctr=0},t})(),RC="-ms-",Y_e="-moz-",f0="-webkit-",Rgn="comm",kje="rule",Fje="decl",rRi="@import",Tgn="@keyframes",sRi="@layer",aRi=Math.abs,U_e=String.fromCharCode,ARi=Object.assign;function cRi(t,e){return _I(t,0)^45?(((e<<2^_I(t,0))<<2^_I(t,1))<<2^_I(t,2))<<2^_I(t,3):0}function kgn(t){return t.trim()}function lRi(t,e){return(t=e.exec(t))?t[0]:t}function I0(t,e,n){return t.replace(e,n)}function Lje(t,e){return t.indexOf(e)}function _I(t,e){return t.charCodeAt(e)|0}function $Z(t,e,n){return t.slice(e,n)}function z6(t){return t.length}function Hje(t){return t.length}function K_e(t,e){return e.push(t),t}function uRi(t,e){return t.map(e).join("")}var V_e=1,NU=1,Fgn=0,Xx=0,l_=0,RU="";function z_e(t,e,n,o,i,r,s){return{value:t,root:e,parent:n,type:o,props:i,children:r,line:V_e,column:NU,length:s,return:""}}function qZ(t,e){return ARi(z_e("",null,null,"",null,null,0),t,{length:-t.length},e)}function gRi(){return l_}function dRi(){return l_=Xx>0?_I(RU,--Xx):0,NU--,l_===10&&(NU=1,V_e--),l_}function RE(){return l_=Xx<Fgn?_I(RU,Xx++):0,NU++,l_===10&&(NU=1,V_e++),l_}function J6(){return _I(RU,Xx)}function J_e(){return Xx}function XZ(t,e){return $Z(RU,t,e)}function ZZ(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Lgn(t){return V_e=NU=1,Fgn=z6(RU=t),Xx=0,[]}function Hgn(t){return RU="",t}function W_e(t){return kgn(XZ(Xx-1,Oje(t===91?t+2:t===40?t+1:t)))}function hRi(t){for(;(l_=J6())&&l_<33;)RE();return ZZ(t)>2||ZZ(l_)>3?"":" "}function pRi(t,e){for(;--e&&RE()&&!(l_<48||l_>102||l_>57&&l_<65||l_>70&&l_<97););return XZ(t,J_e()+(e<6&&J6()==32&&RE()==32))}function Oje(t){for(;RE();)switch(l_){case t:return Xx;case 34:case 39:t!==34&&t!==39&&Oje(l_);break;case 40:t===41&&Oje(t);break;case 92:RE();break}return Xx}function mRi(t,e){for(;RE()&&t+l_!==57;)if(t+l_===84&&J6()===47)break;return"/*"+XZ(e,Xx-1)+"*"+U_e(t===47?t:RE())}function _Ri(t){for(;!ZZ(J6());)RE();return XZ(t,Xx)}function fRi(t){return Hgn(j_e("",null,null,null,[""],t=Lgn(t),0,[0],t))}function j_e(t,e,n,o,i,r,s,a,A){for(var c=0,l=0,u=s,g=0,h=0,d=0,p=1,m=1,_=1,f=0,I="",C=i,y=r,x=o,E=I;m;)switch(d=f,f=RE()){case 40:if(d!=108&&_I(E,u-1)==58){Lje(E+=I0(W_e(f),"&","&\f"),"&\f")!=-1&&(_=-1);break}case 34:case 39:case 91:E+=W_e(f);break;case 9:case 10:case 13:case 32:E+=hRi(d);break;case 92:E+=pRi(J_e()-1,7);continue;case 47:switch(J6()){case 42:case 47:K_e(IRi(mRi(RE(),J_e()),e,n),A);break;default:E+="/"}break;case 123*p:a[c++]=z6(E)*_;case 125*p:case 59:case 0:switch(f){case 0:case 125:m=0;case 59+l:_==-1&&(E=I0(E,/\f/g,"")),h>0&&z6(E)-u&&K_e(h>32?Ggn(E+";",o,n,u-1):Ggn(I0(E," ","")+";",o,n,u-2),A);break;case 59:E+=";";default:if(K_e(x=Ogn(E,e,n,c,l,i,a,I,C=[],y=[],u),r),f===123)if(l===0)j_e(E,e,x,x,C,r,u,a,y);else switch(g===99&&_I(E,3)===110?100:g){case 100:case 108:case 109:case 115:j_e(t,x,x,o&&K_e(Ogn(t,x,x,0,0,i,a,I,i,C=[],u),y),i,y,u,a,o?C:y);break;default:j_e(E,x,x,x,[""],y,0,a,y)}}c=l=h=0,p=_=1,I=E="",u=s;break;case 58:u=1+z6(E),h=d;default:if(p<1){if(f==123)--p;else if(f==125&&p++==0&&dRi()==125)continue}switch(E+=U_e(f),f*p){case 38:_=l>0?1:(E+="\f",-1);break;case 44:a[c++]=(z6(E)-1)*_,_=1;break;case 64:J6()===45&&(E+=W_e(RE())),g=J6(),l=u=z6(I=E+=_Ri(J_e())),f++;break;case 45:d===45&&z6(E)==2&&(p=0)}}return r}function Ogn(t,e,n,o,i,r,s,a,A,c,l){for(var u=i-1,g=i===0?r:[""],h=Hje(g),d=0,p=0,m=0;d<o;++d)for(var _=0,f=$Z(t,u+1,u=aRi(p=s[d])),I=t;_<h;++_)(I=kgn(p>0?g[_]+" "+f:I0(f,/&\f/g,g[_])))&&(A[m++]=I);return z_e(t,e,n,i===0?kje:a,A,c,l)}function IRi(t,e,n){return z_e(t,e,n,Rgn,U_e(gRi()),$Z(t,2,-2),0)}function Ggn(t,e,n,o){return z_e(t,e,n,Fje,$Z(t,0,o),$Z(t,o+1,-1),o)}function TU(t,e){for(var n="",o=Hje(t),i=0;i<o;i++)n+=e(t[i],i,t,e)||"";return n}function CRi(t,e,n,o){switch(t.type){case sRi:if(t.children.length)break;case rRi:case Fje:return t.return=t.return||t.value;case Rgn:return"";case Tgn:return t.return=t.value+"{"+TU(t.children,o)+"}";case kje:t.value=t.props.join(",")}return z6(n=TU(t.children,o))?t.return=t.value+"{"+n+"}":""}function yRi(t){var e=Hje(t);return function(n,o,i,r){for(var s="",a=0;a<e;a++)s+=t[a](n,o,i,r)||"";return s}}function xRi(t){return function(e){e.root||(e=e.return)&&t(e)}}function ERi(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var BRi=function(e,n,o){for(var i=0,r=0;i=r,r=J6(),i===38&&r===12&&(n[o]=1),!ZZ(r);)RE();return XZ(e,Xx)},bRi=function(e,n){var o=-1,i=44;do switch(ZZ(i)){case 0:i===38&&J6()===12&&(n[o]=1),e[o]+=BRi(Xx-1,n,o);break;case 2:e[o]+=W_e(i);break;case 4:if(i===44){e[++o]=J6()===58?"&\f":"",n[o]=e[o].length;break}default:e[o]+=U_e(i)}while(i=RE());return e},SRi=function(e,n){return Hgn(bRi(Lgn(e),n))},Ygn=new WeakMap,QRi=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var n=e.value,o=e.parent,i=e.column===o.column&&e.line===o.line;o.type!=="rule";)if(o=o.parent,!o)return;if(!(e.props.length===1&&n.charCodeAt(0)!==58&&!Ygn.get(o))&&!i){Ygn.set(e,!0);for(var r=[],s=SRi(n,r),a=o.props,A=0,c=0;A<s.length;A++)for(var l=0;l<a.length;l++,c++)e.props[c]=r[A]?s[A].replace(/&\f/g,a[l]):a[l]+" "+s[A]}}},vRi=function(e){if(e.type==="decl"){var n=e.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(e.return="",e.value="")}};function Ugn(t,e){switch(cRi(t,e)){case 5103:return f0+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return f0+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return f0+t+Y_e+t+RC+t+t;case 6828:case 4268:return f0+t+RC+t+t;case 6165:return f0+t+RC+"flex-"+t+t;case 5187:return f0+t+I0(t,/(\w+).+(:[^]+)/,f0+"box-$1$2"+RC+"flex-$1$2")+t;case 5443:return f0+t+RC+"flex-item-"+I0(t,/flex-|-self/,"")+t;case 4675:return f0+t+RC+"flex-line-pack"+I0(t,/align-content|flex-|-self/,"")+t;case 5548:return f0+t+RC+I0(t,"shrink","negative")+t;case 5292:return f0+t+RC+I0(t,"basis","preferred-size")+t;case 6060:return f0+"box-"+I0(t,"-grow","")+f0+t+RC+I0(t,"grow","positive")+t;case 4554:return f0+I0(t,/([^-])(transform)/g,"$1"+f0+"$2")+t;case 6187:return I0(I0(I0(t,/(zoom-|grab)/,f0+"$1"),/(image-set)/,f0+"$1"),t,"")+t;case 5495:case 3959:return I0(t,/(image-set\([^]*)/,f0+"$1$`$1");case 4968:return I0(I0(t,/(.+:)(flex-)?(.*)/,f0+"box-pack:$3"+RC+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+f0+t+t;case 4095:case 3583:case 4068:case 2532:return I0(t,/(.+)-inline(.+)/,f0+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(z6(t)-1-e>6)switch(_I(t,e+1)){case 109:if(_I(t,e+4)!==45)break;case 102:return I0(t,/(.+:)(.+)-([^]+)/,"$1"+f0+"$2-$3$1"+Y_e+(_I(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~Lje(t,"stretch")?Ugn(I0(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(_I(t,e+1)!==115)break;case 6444:switch(_I(t,z6(t)-3-(~Lje(t,"!important")&&10))){case 107:return I0(t,":",":"+f0)+t;case 101:return I0(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+f0+(_I(t,14)===45?"inline-":"")+"box$3$1"+f0+"$2$3$1"+RC+"$2box$3")+t}break;case 5936:switch(_I(t,e+11)){case 114:return f0+t+RC+I0(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return f0+t+RC+I0(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return f0+t+RC+I0(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return f0+t+RC+t+t}return t}var wRi=function(e,n,o,i){if(e.length>-1&&!e.return)switch(e.type){case Fje:e.return=Ugn(e.value,e.length);break;case Tgn:return TU([qZ(e,{value:I0(e.value,"@","@"+f0)})],i);case kje:if(e.length)return uRi(e.props,function(r){switch(lRi(r,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return TU([qZ(e,{props:[I0(r,/:(read-\w+)/,":"+Y_e+"$1")]})],i);case"::placeholder":return TU([qZ(e,{props:[I0(r,/:(plac\w+)/,":"+f0+"input-$1")]}),qZ(e,{props:[I0(r,/:(plac\w+)/,":"+Y_e+"$1")]}),qZ(e,{props:[I0(r,/:(plac\w+)/,RC+"input-$1")]})],i)}return""})}},PRi=[wRi],MRi=function(e){var n=e.key;if(n==="css"){var o=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(o,function(p){var m=p.getAttribute("data-emotion");m.indexOf(" ")!==-1&&(document.head.appendChild(p),p.setAttribute("data-s",""))})}var i=e.stylisPlugins||PRi,r={},s,a=[];s=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(p){for(var m=p.getAttribute("data-emotion").split(" "),_=1;_<m.length;_++)r[m[_]]=!0;a.push(p)});var A,c=[QRi,vRi];{var l,u=[CRi,xRi(function(p){l.insert(p)})],g=yRi(c.concat(i,u)),h=function(m){return TU(fRi(m),g)};A=function(m,_,f,I){l=f,h(m?m+"{"+_.styles+"}":_.styles),I&&(d.inserted[_.name]=!0)}}var d={key:n,sheet:new iRi({key:n,container:s,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:r,registered:{},insert:A};return d.sheet.hydrate(a),d};function DRi(t){for(var e=0,n,o=0,i=t.length;i>=4;++o,i-=4)n=t.charCodeAt(o)&255|(t.charCodeAt(++o)&255)<<8|(t.charCodeAt(++o)&255)<<16|(t.charCodeAt(++o)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,e=(n&65535)*1540483477+((n>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(i){case 3:e^=(t.charCodeAt(o+2)&255)<<16;case 2:e^=(t.charCodeAt(o+1)&255)<<8;case 1:e^=t.charCodeAt(o)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var NRi={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},RRi=/[A-Z]|^ms/g,TRi=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Kgn=function(e){return e.charCodeAt(1)===45},Vgn=function(e){return e!=null&&typeof e!="boolean"},Gje=ERi(function(t){return Kgn(t)?t:t.replace(RRi,"-$&").toLowerCase()}),zgn=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(TRi,function(o,i,r){return TP={name:i,styles:r,next:TP},i})}return NRi[e]!==1&&!Kgn(e)&&typeof n=="number"&&n!==0?n+"px":n};function $_e(t,e,n){if(n==null)return"";var o=n;if(o.__emotion_styles!==void 0)return o;switch(typeof n){case"boolean":return"";case"object":{var i=n;if(i.anim===1)return TP={name:i.name,styles:i.styles,next:TP},i.name;var r=n;if(r.styles!==void 0){var s=r.next;if(s!==void 0)for(;s!==void 0;)TP={name:s.name,styles:s.styles,next:TP},s=s.next;var a=r.styles+";";return a}return kRi(t,e,n)}}var A=n;if(e==null)return A;var c=e[A];return c!==void 0?c:A}function kRi(t,e,n){var o="";if(Array.isArray(n))for(var i=0;i<n.length;i++)o+=$_e(t,e,n[i])+";";else for(var r in n){var s=n[r];if(typeof s!="object"){var a=s;e!=null&&e[a]!==void 0?o+=r+"{"+e[a]+"}":Vgn(a)&&(o+=Gje(r)+":"+zgn(r,a)+";")}else if(Array.isArray(s)&&typeof s[0]=="string"&&(e==null||e[s[0]]===void 0))for(var A=0;A<s.length;A++)Vgn(s[A])&&(o+=Gje(r)+":"+zgn(r,s[A])+";");else{var c=$_e(t,e,s);switch(r){case"animation":case"animationName":{o+=Gje(r)+":"+c+";";break}default:o+=r+"{"+c+"}"}}}return o}var Jgn=/label:\s*([^\s;{]+)\s*(;|$)/g,TP;function Yje(t,e,n){if(t.length===1&&typeof t[0]=="object"&&t[0]!==null&&t[0].styles!==void 0)return t[0];var o=!0,i="";TP=void 0;var r=t[0];if(r==null||r.raw===void 0)o=!1,i+=$_e(n,e,r);else{var s=r;i+=s[0]}for(var a=1;a<t.length;a++)if(i+=$_e(n,e,t[a]),o){var A=r;i+=A[a]}Jgn.lastIndex=0;for(var c="",l;(l=Jgn.exec(i))!==null;)c+="-"+l[1];var u=DRi(i)+c;return{name:u,styles:i,next:TP}}function Wgn(t,e,n){var o="";return n.split(" ").forEach(function(i){t[i]!==void 0?e.push(t[i]+";"):i&&(o+=i+" ")}),o}var FRi=function(e,n,o){var i=e.key+"-"+n.name;e.registered[i]===void 0&&(e.registered[i]=n.styles)},LRi=function(e,n,o){FRi(e,n);var i=e.key+"-"+n.name;if(e.inserted[n.name]===void 0){var r=n;do e.insert(n===r?"."+i:"",r,e.sheet,!0),r=r.next;while(r!==void 0)}};function jgn(t,e){if(t.inserted[e.name]===void 0)return t.insert("",e,t.sheet,!0)}function $gn(t,e,n){var o=[],i=Wgn(t,o,n);return o.length<2?n:i+e(o)}var HRi=function(e){var n=MRi(e);n.sheet.speedy=function(a){this.isSpeedy=a},n.compat=!0;var o=function(){for(var A=arguments.length,c=new Array(A),l=0;l<A;l++)c[l]=arguments[l];var u=Yje(c,n.registered,void 0);return LRi(n,u),n.key+"-"+u.name},i=function(){for(var A=arguments.length,c=new Array(A),l=0;l<A;l++)c[l]=arguments[l];var u=Yje(c,n.registered),g="animation-"+u.name;return jgn(n,{name:u.name,styles:"@keyframes "+g+"{"+u.styles+"}"}),g},r=function(){for(var A=arguments.length,c=new Array(A),l=0;l<A;l++)c[l]=arguments[l];var u=Yje(c,n.registered);jgn(n,u)},s=function(){for(var A=arguments.length,c=new Array(A),l=0;l<A;l++)c[l]=arguments[l];return $gn(n.registered,o,ORi(c))};return{css:o,cx:s,injectGlobal:r,keyframes:i,hydrate:function(A){A.forEach(function(c){n.inserted[c]=!0})},flush:function(){n.registered={},n.inserted={},n.sheet.flush()},sheet:n.sheet,cache:n,getRegisteredStyles:Wgn.bind(null,n.registered),merge:$gn.bind(null,n.registered,o)}},ORi=function t(e){for(var n="",o=0;o<e.length;o++){var i=e[o];if(i!=null){var r=void 0;switch(typeof i){case"boolean":break;case"object":{if(Array.isArray(i))r=t(i);else{r="";for(var s in i)i[s]&&s&&(r&&(r+=" "),r+=s)}break}default:r=i}r&&(n&&(n+=" "),n+=r)}}return n},GRi=HRi({key:"css"}),kU=GRi.css,YRi=Object.create,Uje=Object.defineProperty,URi=Object.getOwnPropertyDescriptor,Kje=Object.getOwnPropertyNames,KRi=Object.getPrototypeOf,VRi=Object.prototype.hasOwnProperty,zRi=(t,e)=>function(){return t&&(e=(0,t[Kje(t)[0]])(t=0)),e},Vje=(t,e)=>function(){return e||(0,t[Kje(t)[0]])((e={exports:{}}).exports,e),e.exports},JRi=(t,e)=>{for(var n in e)Uje(t,n,{get:e[n],enumerable:!0})},WRi=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Kje(e))!VRi.call(t,i)&&i!==n&&Uje(t,i,{get:()=>e[i],enumerable:!(o=URi(e,i))||o.enumerable});return t},qgn=(t,e,n)=>(n=t!=null?YRi(KRi(t)):{},WRi(e||!t||!t.__esModule?Uje(n,"default",{value:t,enumerable:!0}):n,t)),jRi=Vje({"node_modules/toggle-selection/index.js"(t,e){e.exports=function(){var n=document.getSelection();if(!n.rangeCount)return function(){};for(var o=document.activeElement,i=[],r=0;r<n.rangeCount;r++)i.push(n.getRangeAt(r));switch(o.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":o.blur();break;default:o=null;break}return n.removeAllRanges(),function(){n.type==="Caret"&&n.removeAllRanges(),n.rangeCount||i.forEach(function(s){n.addRange(s)}),o&&o.focus()}}}}),$Ri=Vje({"node_modules/copy-to-clipboard/index.js"(t,e){var n=jRi(),o={"text/plain":"Text","text/html":"Url",default:"Text"},i="Copy to clipboard: #{key}, Enter";function r(a){var A=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return a.replace(/#{\s*key\s*}/g,A)}function s(a,A){var c,l,u,g,h,d,p=!1;A||(A={}),c=A.debug||!1;try{u=n(),g=document.createRange(),h=document.getSelection(),d=document.createElement("span"),d.textContent=a,d.ariaHidden="true",d.style.all="unset",d.style.position="fixed",d.style.top=0,d.style.clip="rect(0, 0, 0, 0)",d.style.whiteSpace="pre",d.style.webkitUserSelect="text",d.style.MozUserSelect="text",d.style.msUserSelect="text",d.style.userSelect="text",d.addEventListener("copy",function(_){if(_.stopPropagation(),A.format)if(_.preventDefault(),typeof _.clipboardData>"u"){c&&console.warn("unable to use e.clipboardData"),c&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=o[A.format]||o.default;window.clipboardData.setData(f,a)}else _.clipboardData.clearData(),_.clipboardData.setData(A.format,a);A.onCopy&&(_.preventDefault(),A.onCopy(_.clipboardData))}),document.body.appendChild(d),g.selectNodeContents(d),h.addRange(g);var m=document.execCommand("copy");if(!m)throw new Error("copy command was unsuccessful");p=!0}catch(_){c&&console.error("unable to copy using execCommand: ",_),c&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(A.format||"text",a),A.onCopy&&A.onCopy(window.clipboardData),p=!0}catch(f){c&&console.error("unable to copy using clipboardData: ",f),c&&console.error("falling back to prompt"),l=r("message"in A?A.message:i),window.prompt(l,a)}}finally{h&&(typeof h.removeRange=="function"?h.removeRange(g):h.removeAllRanges()),d&&document.body.removeChild(d),u()}return p}e.exports=s}}),Xgn={};JRi(Xgn,{default:()=>qRi});function qRi(){const t=URL.createObjectURL(new Blob(['"use strict";(()=>{var _0=Object.defineProperty;var M0=(y,x,e)=>x in y?_0(y,x,{enumerable:!0,configurable:!0,writable:!0,value:e}):y[x]=e;var M=(y,x,e)=>M0(y,typeof x!="symbol"?x+"":x,e);function V(y,x,e=2){let t=x&&x.length,r=t?x[0]*e:y.length,n=e0(y,0,r,e,!0),o=[];if(!n||n.next===n.prev)return o;let i,a,c;if(t&&(n=R0(y,x,n,e)),y.length>80*e){i=y[0],a=y[1];let d=i,f=a;for(let l=e;l<r;l+=e){let p=y[l],s=y[l+1];p<i&&(i=p),s<a&&(a=s),p>d&&(d=p),s>f&&(f=s)}c=Math.max(d-i,f-a),c=c!==0?32767/c:0}return N(n,o,e,i,a,c,0),o}function e0(y,x,e,t,r){let n;if(r===A0(y,x,e,t)>0)for(let o=x;o<e;o+=t)n=x0(o/t|0,y[o],y[o+1],n);else for(let o=e-t;o>=x;o-=t)n=x0(o/t|0,y[o],y[o+1],n);return n&&U(n,n.next)&&(A(n),n=n.next),n}function I(y,x){if(!y)return y;x||(x=y);let e=y,t;do if(t=!1,!e.steiner&&(U(e,e.next)||v(e.prev,e,e.next)===0)){if(A(e),e=x=e.prev,e===e.next)break;t=!0}else e=e.next;while(t||e!==x);return x}function N(y,x,e,t,r,n,o){if(!y)return;!o&&n&&E0(y,t,r,n);let i=y;for(;y.prev!==y.next;){let a=y.prev,c=y.next;if(n?b0(y,t,r,n):v0(y)){x.push(a.i,y.i,c.i),A(y),y=c.next,i=c.next;continue}if(y=c,y===i){o?o===1?(y=w0(I(y),x),N(y,x,e,t,r,n,2)):o===2&&P0(y,x,e,t,r,n):N(I(y),x,e,t,r,n,1);break}}}function v0(y){let x=y.prev,e=y,t=y.next;if(v(x,e,t)>=0)return!1;let r=x.x,n=e.x,o=t.x,i=x.y,a=e.y,c=t.y,d=Math.min(r,n,o),f=Math.min(i,a,c),l=Math.max(r,n,o),p=Math.max(i,a,c),s=t.next;for(;s!==x;){if(s.x>=d&&s.x<=l&&s.y>=f&&s.y<=p&&F(r,i,n,a,o,c,s.x,s.y)&&v(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function b0(y,x,e,t){let r=y.prev,n=y,o=y.next;if(v(r,n,o)>=0)return!1;let i=r.x,a=n.x,c=o.x,d=r.y,f=n.y,l=o.y,p=Math.min(i,a,c),s=Math.min(d,f,l),L=Math.max(i,a,c),m=Math.max(d,f,l),u=X(p,s,x,e,t),_=X(L,m,x,e,t),h=y.prevZ,g=y.nextZ;for(;h&&h.z>=u&&g&&g.z<=_;){if(h.x>=p&&h.x<=L&&h.y>=s&&h.y<=m&&h!==r&&h!==o&&F(i,d,a,f,c,l,h.x,h.y)&&v(h.prev,h,h.next)>=0||(h=h.prevZ,g.x>=p&&g.x<=L&&g.y>=s&&g.y<=m&&g!==r&&g!==o&&F(i,d,a,f,c,l,g.x,g.y)&&v(g.prev,g,g.next)>=0))return!1;g=g.nextZ}for(;h&&h.z>=u;){if(h.x>=p&&h.x<=L&&h.y>=s&&h.y<=m&&h!==r&&h!==o&&F(i,d,a,f,c,l,h.x,h.y)&&v(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;g&&g.z<=_;){if(g.x>=p&&g.x<=L&&g.y>=s&&g.y<=m&&g!==r&&g!==o&&F(i,d,a,f,c,l,g.x,g.y)&&v(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function w0(y,x){let e=y;do{let t=e.prev,r=e.next.next;!U(t,r)&&r0(t,e,e.next,r)&&B(t,r)&&B(r,t)&&(x.push(t.i,e.i,r.i),A(e),A(e.next),e=y=r),e=e.next}while(e!==y);return I(e)}function P0(y,x,e,t,r,n){let o=y;do{let i=o.next.next;for(;i!==o.prev;){if(o.i!==i.i&&F0(o,i)){let a=n0(o,i);o=I(o,o.next),a=I(a,a.next),N(o,x,e,t,r,n,0),N(a,x,e,t,r,n,0);return}i=i.next}o=o.next}while(o!==y)}function R0(y,x,e,t){let r=[];for(let n=0,o=x.length;n<o;n++){let i=x[n]*t,a=n<o-1?x[n+1]*t:y.length,c=e0(y,i,a,t,!1);c===c.next&&(c.steiner=!0),r.push(W0(c))}r.sort(I0);for(let n=0;n<r.length;n++)e=G0(r[n],e);return e}function I0(y,x){let e=y.x-x.x;if(e===0&&(e=y.y-x.y,e===0)){let t=(y.next.y-y.y)/(y.next.x-y.x),r=(x.next.y-x.y)/(x.next.x-x.x);e=t-r}return e}function G0(y,x){let e=T0(y,x);if(!e)return x;let t=n0(e,y);return I(t,t.next),I(e,e.next)}function T0(y,x){let e=x,t=y.x,r=y.y,n=-1/0,o;if(U(y,e))return e;do{if(U(y,e.next))return e.next;if(r<=e.y&&r>=e.next.y&&e.next.y!==e.y){let f=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(f<=t&&f>n&&(n=f,o=e.x<e.next.x?e:e.next,f===t))return o}e=e.next}while(e!==x);if(!o)return null;let i=o,a=o.x,c=o.y,d=1/0;e=o;do{if(t>=e.x&&e.x>=a&&t!==e.x&&t0(r<c?t:n,r,a,c,r<c?n:t,r,e.x,e.y)){let f=Math.abs(r-e.y)/(t-e.x);B(e,y)&&(f<d||f===d&&(e.x>o.x||e.x===o.x&&U0(o,e)))&&(o=e,d=f)}e=e.next}while(e!==i);return o}function U0(y,x){return v(y.prev,y,x.prev)<0&&v(x.next,y,y.next)<0}function E0(y,x,e,t){let r=y;do r.z===0&&(r.z=X(r.x,r.y,x,e,t)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==y);r.prevZ.nextZ=null,r.prevZ=null,k0(r)}function k0(y){let x,e=1;do{let t=y,r;y=null;let n=null;for(x=0;t;){x++;let o=t,i=0;for(let c=0;c<e&&(i++,o=o.nextZ,!!o);c++);let a=e;for(;i>0||a>0&&o;)i!==0&&(a===0||!o||t.z<=o.z)?(r=t,t=t.nextZ,i--):(r=o,o=o.nextZ,a--),n?n.nextZ=r:y=r,r.prevZ=n,n=r;t=o}n.nextZ=null,e*=2}while(x>1);return y}function X(y,x,e,t,r){return y=(y-e)*r|0,x=(x-t)*r|0,y=(y|y<<8)&16711935,y=(y|y<<4)&252645135,y=(y|y<<2)&858993459,y=(y|y<<1)&1431655765,x=(x|x<<8)&16711935,x=(x|x<<4)&252645135,x=(x|x<<2)&858993459,x=(x|x<<1)&1431655765,y|x<<1}function W0(y){let x=y,e=y;do(x.x<e.x||x.x===e.x&&x.y<e.y)&&(e=x),x=x.next;while(x!==y);return e}function t0(y,x,e,t,r,n,o,i){return(r-o)*(x-i)>=(y-o)*(n-i)&&(y-o)*(t-i)>=(e-o)*(x-i)&&(e-o)*(n-i)>=(r-o)*(t-i)}function F(y,x,e,t,r,n,o,i){return!(y===o&&x===i)&&t0(y,x,e,t,r,n,o,i)}function F0(y,x){return y.next.i!==x.i&&y.prev.i!==x.i&&!N0(y,x)&&(B(y,x)&&B(x,y)&&B0(y,x)&&(v(y.prev,y,x.prev)||v(y,x.prev,x))||U(y,x)&&v(y.prev,y,y.next)>0&&v(x.prev,x,x.next)>0)}function v(y,x,e){return(x.y-y.y)*(e.x-x.x)-(x.x-y.x)*(e.y-x.y)}function U(y,x){return y.x===x.x&&y.y===x.y}function r0(y,x,e,t){let r=S(v(y,x,e)),n=S(v(y,x,t)),o=S(v(e,t,y)),i=S(v(e,t,x));return!!(r!==n&&o!==i||r===0&&O(y,e,x)||n===0&&O(y,t,x)||o===0&&O(e,y,t)||i===0&&O(e,x,t))}function O(y,x,e){return x.x<=Math.max(y.x,e.x)&&x.x>=Math.min(y.x,e.x)&&x.y<=Math.max(y.y,e.y)&&x.y>=Math.min(y.y,e.y)}function S(y){return y>0?1:y<0?-1:0}function N0(y,x){let e=y;do{if(e.i!==y.i&&e.next.i!==y.i&&e.i!==x.i&&e.next.i!==x.i&&r0(e,e.next,y,x))return!0;e=e.next}while(e!==y);return!1}function B(y,x){return v(y.prev,y,y.next)<0?v(y,x,y.next)>=0&&v(y,y.prev,x)>=0:v(y,x,y.prev)<0||v(y,y.next,x)<0}function B0(y,x){let e=y,t=!1,r=(y.x+x.x)/2,n=(y.y+x.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&r<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(t=!t),e=e.next;while(e!==y);return t}function n0(y,x){let e=$(y.i,y.x,y.y),t=$(x.i,x.x,x.y),r=y.next,n=x.prev;return y.next=x,x.prev=y,e.next=r,r.prev=e,t.next=e,e.prev=t,n.next=t,t.prev=n,t}function x0(y,x,e,t){let r=$(y,x,e);return t?(r.next=t.next,r.prev=t,t.next.prev=r,t.next=r):(r.prev=r,r.next=r),r}function A(y){y.next.prev=y.prev,y.prev.next=y.next,y.prevZ&&(y.prevZ.nextZ=y.nextZ),y.nextZ&&(y.nextZ.prevZ=y.prevZ)}function $(y,x,e){return{i:y,x,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function A0(y,x,e,t){let r=0;for(let n=x,o=e-t;n<e;n+=t)r+=(y[o]-y[n])*(y[n+1]+y[o+1]),o=n;return r}var o0={0:"M0.301025 0.257813 L0.206593 0.283385 L0.122042 0.361307 L0.075923 0.474441 L0.064942 0.642221 L0.091296 0.78289 L0.159376 0.899463 L0.257104 0.961214 L0.344948 0.961214 L0.442678 0.899463 L0.510757 0.78289 L0.537111 0.642221 L0.526131 0.474441 L0.480012 0.361307 L0.39546 0.283385 L0.301025 0.257813",1:"M0.220426 0.40845 L0.381626 0.270996 L0.381626 0.948966",2:"M0.110409 0.39212 L0.125621 0.342293 L0.170571 0.295823 L0.244237 0.26431 L0.291518 0.257813 L0.373319 0.263799 L0.434683 0.290705 L0.468239 0.331966 L0.480292 0.379913 L0.479492 0.411806 L0.465088 0.465192 L0.402571 0.568988 L0.245134 0.766438 L0.07959 0.948045 L0.522462 0.948045",3:"M0.081606 0.345073 L0.119154 0.315633 L0.178996 0.284091 L0.255265 0.257813 L0.349133 0.263062 L0.43127 0.289348 L0.48994 0.336662 L0.525141 0.394491 L0.513407 0.457577 L0.466472 0.504892 L0.384334 0.541692 L0.290464 0.56272 L0.20833 0.573235 L0.290464 0.583749 L0.384334 0.610035 L0.466472 0.652092 L0.519274 0.709922 L0.531007 0.773007 L0.50754 0.841351 L0.454738 0.899179 L0.3726 0.946494 L0.310412 0.961214 L0.209503 0.959111 L0.127367 0.946494 L0.071046 0.929671",4:"M0.418494 0.270996 L0.048828 0.724199 L0.553224 0.724199 M0.414181 0.578167 L0.414181 0.94897",5:"M0.074951 0.270996 L0.074951 0.614701 L0.267655 0.5695 L0.405247 0.586502 L0.460002 0.617189 L0.498028 0.660731 L0.527101 0.779401 L0.513352 0.841049 L0.477274 0.889568 L0.406378 0.93463 L0.324445 0.958337 L0.247399 0.962139 L0.182516 0.949767 L0.130068 0.925508 L0.074951 0.875607 M0.074951 0.270996 L0.527101 0.270996",6:"M0.428549 0.257813 L0.341433 0.285053 L0.26073 0.312099 L0.192188 0.360182 L0.138902 0.410969 L0.098219 0.500422 L0.070249 0.584267 L0.067264 0.670716 L0.065164 0.756863 L0.087163 0.820973 L0.108168 0.861042 L0.157916 0.913131 L0.210981 0.948192 L0.29279 0.961214 L0.384548 0.956206 L0.456409 0.924151 L0.507262 0.881077 L0.5349 0.821975 L0.537111 0.771889 L0.521634 0.718798 L0.498418 0.67372 L0.463042 0.636657 L0.414398 0.613617 L0.34696 0.598591 L0.28284 0.595587 L0.215403 0.605604 L0.145756 0.641665 L0.109274 0.678729 L0.064942 0.724006",7:"M0.071534 0.270996 L0.530519 0.270996 L0.495935 0.291702 L0.477752 0.305407 L0.435186 0.346112 L0.412067 0.374136 L0.388565 0.40796 L0.365315 0.448098 L0.342943 0.495062 L0.322081 0.549366 L0.303364 0.611524 L0.287416 0.68205 L0.270077 0.80465 L0.26253 0.94897",8:"M0.286761 0.257813 L0.210684 0.27162 L0.1414 0.305622 L0.092494 0.382125 L0.111513 0.450128 L0.16857 0.502193 L0.228345 0.539382 L0.377781 0.594635 L0.470161 0.645637 L0.52586 0.706203 L0.538087 0.792269 L0.506841 0.87621 L0.438915 0.927212 L0.339743 0.961214 L0.263666 0.959089 L0.174004 0.929337 L0.102003 0.881523 L0.063965 0.811395 L0.066682 0.741266 L0.102003 0.671139 L0.180797 0.608448 L0.259591 0.580822 L0.358762 0.548945 L0.456576 0.49688 L0.486463 0.446941 L0.487822 0.362999 L0.453859 0.302434 L0.384574 0.265245 L0.286761 0.257813",9:"M0.511026 0.437812 L0.491026 0.347812 L0.451026 0.297812 L0.391026 0.267812 L0.311026 0.257813 L0.231026 0.267812 L0.161026 0.297812 L0.111026 0.347812 L0.091026 0.417812 L0.111026 0.487812 L0.161026 0.537812 L0.231026 0.567812 L0.311026 0.577812 L0.391026 0.557812 L0.451026 0.517812 L0.491026 0.477812 L0.511026 0.437812 M0.510026 0.438812 L0.434026 0.636812 L0.381026 0.777812 L0.337026 0.879812 L0.301026 0.957812","!":"M0.301026 0.270996 L0.301026 0.749566 M0.251466 0.94897 L0.350587 0.94897",\'"\':"M0.16504 0.270996 L0.16504 0.523022 M0.437013 0.270996 L0.437013 0.523022","#":"M0.20958 0.282227 L0.146515 0.949754 M0.461844 0.282227 L0.398779 0.949754 M0.032999 0.526969 L0.600587 0.452796 M0.001465 0.82366 L0.569055 0.749486",$:"M0.307121 0.240234 L0.307121 1.083502 M0.490031 0.415915 L0.404676 0.328075 L0.23396 0.310507 L0.136407 0.398347 L0.099828 0.521324 L0.124213 0.591596 L0.197379 0.644299 L0.429061 0.697003 L0.502224 0.749708 L0.526613 0.837547 L0.477836 0.960526 L0.355897 1.013228 L0.197379 0.99566 L0.112021 0.942957 L0.07544 0.837547","\'":"M0.301026 0.270996 L0.301026 0.523022","(":"M0.413087 0.241211 L0.372337 0.28347 L0.331589 0.334184 L0.290838 0.393349 L0.25009 0.460965 L0.219528 0.528584 L0.199153 0.5962 L0.188966 0.655364 L0.199153 0.714529 L0.219528 0.782146 L0.25009 0.849764 L0.290838 0.91738 L0.331589 0.976544 L0.372337 1.027258 L0.413087 1.069491",")":"M0.188966 0.241211 L0.229716 0.28347 L0.270466 0.334184 L0.311213 0.393349 L0.351964 0.460965 L0.382526 0.528584 L0.4029 0.5962 L0.413087 0.655364 L0.4029 0.714529 L0.382526 0.782146 L0.351964 0.849764 L0.311213 0.91738 L0.270466 0.976544 L0.229716 1.027258 L0.188966 1.069491","*":"M0.301026 0.458702 L0.301026 0.681942 M0.301026 0.458702 L0.520997 0.536834 M0.301026 0.458702 L0.439954 0.257813 M0.301026 0.458702 L0.162098 0.257813 M0.301026 0.458702 L0.081055 0.536834","+":"M0.042969 0.66845 L0.559083 0.66845 M0.301023 0.428223 L0.301023 0.908661",",":"M0.38672 0.852051 L0.215333 1.030661 L0.301025 1.119971","-":"M0.173829 0.686035 L0.428224 0.686035",".":"M0.362549 0.851074 L0.239503 0.851074","/":"M0.062501 1.035249 L0.539551 0.270996","<":"M0.559083 0.441895 L0.042969 0.66939 L0.042969 0.66939 L0.559083 0.896902","=":"M0.042969 0.545898 L0.559083 0.545898 M0.042969 0.80837 L0.559083 0.80837",">":"M0.042969 0.441895 L0.559083 0.66939 L0.559083 0.66939 L0.042969 0.896902",A:"M0.018067 0.94897 L0.290179 0.270996 L0.583986 0.94897 M0.155303 0.684521 L0.433548 0.684521",B:"M0.063965 0.94897 L0.063965 0.278953 L0.209356 0.270996 L0.342486 0.294394 L0.432179 0.37292 L0.418224 0.48773 L0.312686 0.549166 L0.084728 0.575531 L0.306377 0.589434 L0.468877 0.647456 L0.538087 0.736658 L0.5324 0.85202 L0.501247 0.902983 L0.42355 0.944398 L0.063965 0.94897",C:"M0.529054 0.419847 L0.498425 0.345196 L0.442238 0.292341 L0.33583 0.257813 L0.257199 0.268357 L0.187906 0.303748 L0.120243 0.385432 L0.072998 0.599844 L0.110073 0.815385 L0.165381 0.902183 L0.222883 0.942801 L0.334904 0.961214 L0.43253 0.937679 L0.504816 0.868999 L0.529054 0.772065",D:"M0.064454 0.94897 L0.071838 0.285078 L0.171217 0.270996 L0.247348 0.272633 L0.37101 0.306078 L0.462461 0.378304 L0.514748 0.475555 L0.535591 0.576392 L0.537599 0.652313 L0.528065 0.717381 L0.508562 0.772419 L0.445948 0.855695 L0.362356 0.90871 L0.225203 0.945862 L0.064454 0.94897",E:"M0.080078 0.270996 L0.080078 0.94897 M0.080078 0.270996 L0.521974 0.270996 M0.080078 0.609981 L0.389405 0.609981 M0.080078 0.94897 L0.521974 0.94897",F:"M0.086426 0.270996 L0.086426 0.94897 M0.091304 0.275607 L0.515626 0.275607 M0.091304 0.607677 L0.447344 0.607677",G:"M0.498034 0.284943 L0.374621 0.257813 L0.244219 0.268648 L0.160577 0.311997 L0.094556 0.398116 L0.056397 0.58404 L0.076752 0.785532 L0.120865 0.858197 L0.188947 0.916734 L0.271008 0.953591 L0.357069 0.961214 L0.43715 0.932047 L0.501262 0.858539 L0.545656 0.648611 L0.329595 0.648131",H:"M0.066895 0.270996 L0.066895 0.94897 M0.066895 0.595658 L0.530009 0.595658 M0.535157 0.270996 L0.535157 0.94897",I:"M0.301026 0.270996 L0.301026 0.94897",J:"M0.506839 0.270996 L0.507814 0.782193 L0.498468 0.846168 L0.480733 0.880789 L0.455864 0.90832 L0.426095 0.929408 L0.360746 0.954812 L0.302508 0.962139 L0.223573 0.953638 L0.16538 0.930312 L0.137072 0.907715 L0.116428 0.880312 L0.102822 0.848819 L0.095633 0.813947 L0.094239 0.776413",K:"M0.035401 0.270996 L0.035401 0.94897 M0.502258 0.316194 L0.035401 0.687823 M0.212484 0.582361 L0.566652 0.933903",L:"M0.07544 0.270996 L0.07544 0.94897 L0.526613 0.94897",M:"M0.042481 0.94897 L0.042481 0.270996 L0.301027 0.712492 L0.559571 0.270996 L0.559571 0.94897",N:"M0.067871 0.94897 L0.067871 0.270996 L0.534181 0.94897 L0.525031 0.270996",O:"M0.287293 0.961214 L0.19843 0.933567 L0.1172 0.849451 L0.057129 0.563945 L0.114348 0.350255 L0.18455 0.289392 L0.306101 0.257813 L0.42054 0.29572 L0.487543 0.365003 L0.544923 0.625294 L0.516366 0.789624 L0.465476 0.884596 L0.375084 0.949287 L0.287293 0.961214",P:"M0.070557 0.94897 L0.070557 0.28379 L0.20704 0.270996 L0.329134 0.278993 L0.408525 0.300514 L0.444022 0.317908 L0.500637 0.368929 L0.525796 0.423728 L0.531496 0.50384 L0.508934 0.554205 L0.473724 0.582043 L0.417577 0.604365 L0.336375 0.620372 L0.226014 0.629268 L0.082368 0.630258",Q:"M0.282435 1.050813 L0.195447 1.019646 L0.115933 0.924817 L0.057129 0.602943 L0.113139 0.362034 L0.18186 0.293418 L0.300844 0.257813 L0.412868 0.300553 L0.478457 0.37866 L0.534625 0.672103 L0.506671 0.857367 L0.456855 0.964437 L0.368371 1.037368 L0.282435 1.050813 M0.341225 0.815559 L0.544923 1.070653",R:"M0.034912 0.944112 L0.034912 0.288556 L0.227127 0.270996 L0.362038 0.276867 L0.443423 0.294907 L0.477644 0.309614 L0.505809 0.328757 L0.526616 0.352817 L0.544963 0.418061 L0.543241 0.475921 L0.524463 0.517817 L0.49076 0.546518 L0.444265 0.564799 L0.355195 0.578739 L0.047653 0.589627 M0.303054 0.617306 L0.56714 0.94897",S:"M0.483037 0.364333 L0.407613 0.267477 L0.22883 0.257813 L0.128623 0.327565 L0.087712 0.455539 L0.104656 0.518727 L0.168054 0.573307 L0.41928 0.617318 L0.503796 0.669342 L0.535157 0.759324 L0.493846 0.900055 L0.367668 0.961214 L0.205436 0.956661 L0.116711 0.907038 L0.066895 0.790334",T:"M0.022949 0.270996 L0.579103 0.270996 M0.309284 0.270996 L0.309284 0.94897",U:"M0.072022 0.270996 L0.07308 0.648875 L0.080372 0.75167 L0.099024 0.827813 L0.134786 0.885729 L0.181571 0.924023 L0.251464 0.95168 L0.339655 0.962139 L0.401553 0.951668 L0.45232 0.924086 L0.482701 0.891771 L0.495745 0.870529 L0.515699 0.81637 L0.525014 0.744626 L0.530031 0.272017",V:"M0.027832 0.270996 L0.320083 0.94897 L0.57422 0.270996",W:"M0 0.270996 L0.079799 0.940377 L0.285198 0.472884 L0.505255 0.94897 L0.602052 0.270996",X:"M0.009034 0.270996 L0.586805 0.94897 M0.593019 0.270996 L0.015246 0.94897",Y:"M0.018067 0.270996 L0.293132 0.574135 M0.583986 0.271959 L0.294954 0.57606 L0.305277 0.94897",Z:"M0.053711 0.270996 L0.548341 0.270996 L0.053711 0.94897 L0.548341 0.94897","[":"M0.404542 0.240234 L0.197511 0.240234 L0.197511 1.069424 L0.404542 1.069424","\\\\":"M0.062501 0.270996 L0.539551 1.035249","]":"M0.19751 0.240234 L0.404542 0.240234 L0.404542 1.069424 L0.19751 1.069424","^":"M0.035156 0.523931 L0.301024 0.270996 L0.566896 0.523931",_:"M0 1.160601 L0.602052 1.160601",a:"M0.527101 0.439941 L0.527101 0.973965 M0.527101 0.553824 L0.451366 0.477535 L0.376759 0.439941 L0.263722 0.439941 L0.187989 0.477535 L0.112255 0.553824 L0.074951 0.66881 L0.074951 0.745099 L0.112255 0.85898 L0.187989 0.93527 L0.263722 0.973965 L0.376759 0.973965 L0.451366 0.93527 L0.527101 0.85898",b:"M0.07666 0.240234 L0.07666 0.959985 M0.07666 0.582737 L0.151822 0.514237 L0.225865 0.480483 L0.338045 0.480483 L0.413211 0.514237 L0.488374 0.582737 L0.525392 0.685983 L0.525392 0.754485 L0.488374 0.856739 L0.413211 0.92524 L0.338045 0.959985 L0.225865 0.959985 L0.151822 0.92524 L0.07666 0.856739",c:"M0.512452 0.553823 L0.441624 0.477535 L0.371854 0.439941 L0.26614 0.439941 L0.195312 0.477535 L0.124486 0.553823 L0.0896 0.668808 L0.0896 0.745099 L0.124486 0.858979 L0.195312 0.93527 L0.26614 0.973965 L0.371854 0.973965 L0.441624 0.93527 L0.512452 0.858979",d:"M0.525392 0.240234 L0.525392 0.959985 M0.525392 0.582737 L0.450232 0.514237 L0.376189 0.480483 L0.264006 0.480483 L0.188844 0.514237 L0.11368 0.582737 L0.076661 0.685983 L0.076661 0.754485 L0.11368 0.856739 L0.188844 0.92524 L0.264006 0.959985 L0.376189 0.959985 L0.450232 0.92524 L0.525392 0.856739",e:"M0.059571 0.668808 L0.542482 0.668808 M0.542482 0.592521 L0.502641 0.516231 L0.461594 0.477535 L0.381914 0.439941 L0.261186 0.439941 L0.180299 0.477535 L0.099412 0.553823 L0.059571 0.668808 L0.059571 0.745099 L0.099412 0.858979 L0.180299 0.93527 L0.261186 0.973965 L0.381914 0.973965 L0.461594 0.93527 L0.542482 0.858979",f:"M0.512941 0.240234 L0.406984 0.240234 L0.301026 0.274346 L0.248047 0.374731 L0.248047 0.946817 M0.089112 0.476088 L0.459965 0.476088",g:"M0.525392 0.439941 L0.525392 0.989395 L0.488373 1.091918 L0.45023 1.126757 L0.376189 1.160601 L0.264004 1.160601 L0.188844 1.126757 L0.113681 1.058075 L0.076661 0.954555 M0.525392 0.542467 L0.45023 0.473786 L0.376189 0.439941 L0.264004 0.439941 L0.188844 0.473786 L0.113681 0.542467 L0.076661 0.645988 L0.076661 0.714669 L0.113681 0.817193 L0.188844 0.885875 L0.264004 0.920713 L0.376189 0.920713 L0.45023 0.885875 L0.525392 0.817193",h:"M0.092041 0.240234 L0.092041 0.946817 M0.092041 0.61058 L0.205937 0.509225 L0.282214 0.476086 L0.396109 0.476086 L0.47187 0.509225 L0.510011 0.61058 L0.510011 0.946817",i:"M0.261026 0.240234 L0.341026 0.240234 M0.300978 0.476089 L0.300978 0.946817",j:"M0.3853 0.240234 L0.447023 0.240234 M0.416159 0.465708 L0.416159 1.011689 L0.383887 1.108586 L0.252832 1.140264 L0.15503 1.108586",k:"M0.065186 0.240234 L0.065186 0.946817 M0.493824 0.476086 L0.065186 0.812323 M0.236758 0.677829 L0.536867 0.946817",l:"M0.301026 0.234863 L0.301026 0.946441",m:"M0.050538 0.439941 L0.050538 0.960796 M0.050538 0.588758 L0.114405 0.476607 L0.157178 0.439941 L0.236864 0.439941 L0.279637 0.476607 L0.32241 0.588758 L0.32241 0.960796 M0.32241 0.588758 L0.386281 0.476607 L0.428467 0.439941 L0.50874 0.439941 L0.551515 0.476607 L0.551515 0.960796",n:"M0.092041 0.439941 L0.092041 0.960796 M0.092041 0.588758 L0.205936 0.476607 L0.282216 0.439941 L0.396113 0.439941 L0.471871 0.476607 L0.510011 0.588758 L0.510011 0.960796",o:"M0.247175 0.439941 L0.175178 0.477535 L0.103186 0.553823 L0.066895 0.668808 L0.066895 0.745099 L0.103186 0.858979 L0.175178 0.93527 L0.247175 0.973965 L0.354874 0.973965 L0.426872 0.93527 L0.498866 0.858979 L0.535157 0.745099 L0.535157 0.668808 L0.498866 0.553823 L0.426872 0.477535 L0.354874 0.439941 L0.247175 0.439941",p:"M0.076904 0.439941 L0.076904 1.154244 M0.076904 0.541563 L0.151986 0.473487 L0.225944 0.439941 L0.338005 0.439941 L0.413087 0.473487 L0.488166 0.541563 L0.525148 0.644169 L0.525148 0.712246 L0.488166 0.813866 L0.413087 0.881942 L0.338005 0.916471 L0.225944 0.916471 L0.151986 0.881942 L0.076904 0.813866",q:"M0.525148 0.441895 L0.525148 1.156195 M0.525148 0.5435 L0.450067 0.47544 L0.376106 0.441895 L0.264042 0.441895 L0.188966 0.47544 L0.113885 0.5435 L0.076905 0.646108 L0.076905 0.714187 L0.113885 0.815809 L0.188966 0.883886 L0.264042 0.918418 L0.376106 0.918418 L0.450067 0.883886 L0.525148 0.815809",r:"M0.107422 0.439941 L0.107422 0.960796 M0.107422 0.663164 L0.155824 0.551014 L0.252626 0.476607 L0.349428 0.439941 L0.49463 0.439941",s:"M0.475556 0.477535 L0.400757 0.439941 L0.276092 0.439941 L0.176361 0.477535 L0.101563 0.553823 L0.101563 0.630112 L0.176361 0.668808 L0.301024 0.668808 L0.425688 0.745099 L0.50049 0.821387 L0.50049 0.897677 L0.425688 0.93527 L0.325956 0.973965 L0.201295 0.973965 L0.126496 0.93527 L0.101563 0.858979",t:"M0.246032 0.297852 L0.246032 0.826549 L0.301023 0.919323 L0.411011 0.950848 L0.520997 0.950848 M0.081055 0.515799 L0.466004 0.515799",u:"M0.092041 0.454102 L0.092041 0.826134 L0.13018 0.937211 L0.205936 0.974954 L0.319832 0.974954 L0.396113 0.937211 L0.510011 0.826134 M0.510011 0.454102 L0.510011 0.974954",v:"M0.048828 0.453125 L0.301026 0.961719 M0.553224 0.453125 L0.301026 0.961719",w:"M0 0.453125 L0.150512 0.961719 M0.301024 0.453125 L0.150512 0.961719 M0.301024 0.453125 L0.451539 0.961719 M0.602052 0.453125 L0.451539 0.961719",x:"M0.03711 0.453125 L0.564943 0.961719 M0.564943 0.453125 L0.03711 0.961719",y:"M0.084618 0.453125 L0.320232 0.921476 M0.55713 0.453125 L0.320232 0.921476 L0.242119 1.055289 L0.163369 1.122196 L0.084618 1.155166 L0.044922 1.155166",z:"M0.505373 0.452148 L0.09668 0.961651 M0.09668 0.452148 L0.505373 0.452148 M0.09668 0.961651 L0.505373 0.961651"},i0={};for(let y in o0){i0[y]=[];let x=o0[y].split("M").slice(1).map(e=>e.split("L").map(t=>t.trim().split(" ").map(parseFloat)));for(let e of x)for(let t=0;t<e.length-1;t++)i0[y].push({x1:e[t][0],y1:1-e[t][1],x2:e[t+1][0],y2:1-e[t+1][1]})}var C0=.09,O0=.692052,S0=.692052,Y0=1.152,Z0=0;var s0={0:.692052,1:.692052,2:.692052,3:.692052,4:.692052,5:.692052,6:.692052,7:.692052,8:.692052,9:.692052,"!":.692052,\'"\':.692052,"#":.692052,$:.692052,"\'":.692052,"(":.692052,")":.692052,"*":.692052,"+":.692052,",":.692052,"-":.692052,".":.692052,"/":.692052,"<":.692052,"=":.692052,">":.692052,A:.692052,B:.692052,C:.692052,D:.692052,E:.692052,F:.692052,G:.692052,H:.692052,I:.692052,J:.692052,K:.692052,L:.692052,M:.692052,N:.692052,O:.692052,P:.692052,Q:.692052,R:.692052,S:.692052,T:.692052,U:.692052,V:.692052,W:.692052,X:.692052,Y:.692052,Z:.692052,"[":.692052,"\\\\":.692052,"]":.692052,"^":.692052,_:.692052,a:.692052,b:.692052,c:.692052,d:.692052,e:.692052,f:.692052,g:.692052,h:.692052,i:.692052,j:.692052,k:.692052,l:.692052,m:.692052,n:.692052,o:.692052,p:.692052,q:.692052,r:.692052,s:.692052,t:.692052,u:.692052,v:.692052,w:.692052,x:.692052,y:.692052,z:.692052," ":.692052},a0={},R={glyphWidthRatio:O0,spaceWidthRatio:S0,lineHeightRatio:Y0,strokeWidthRatio:C0,letterSpacingRatio:Z0};var D0={0:[[{x:.019944796633211075,y:.35828068632415006},{x:.020222641007547733,y:.3550960892473839},{x:.020327535068617307,y:.3519011161217302},{x:.02060526835904108,y:.3507104904820116},{x:.02071153113201321,y:.34949252766745387},{x:.047065531132013214,y:.20882352766745393},{x:.047989939967683706,y:.20564918300405605},{x:.04875673163473768,y:.20243312543665407},{x:.04922094308839032,y:.20142201853303832},{x:.04953201774467938,y:.20035381349539033},{x:.05105794824635218,y:.1974208061920286},{x:.05243742793298141,y:.1944161379022362},{x:.1205174279329814,y:.07784313790223615},{x:.1216536619223176,y:.07627409360623287},{x:.12261018498510404,y:.07458945972562232},{x:.1242345189777056,y:.07271014544101197},{x:.12569143736362237,y:.07069826276137084},{x:.12711194429242206,y:.06938103546641537},{x:.12837874379901673,y:.06791537974577894},{x:.130338502698373,y:.06638906779986004},{x:.132159925645859,y:.06470007355882942},{x:.13381011622947792,y:.06368528357115737},{x:.13533850978527173,y:.062494930337889824},{x:.2330665097852717,y:.000743930337889824},{x:.2364974226485404,y:-.000978818921256936},{x:.23988324554357096,y:-.0027885789630079164},{x:.24043487144166406,y:-.0029559128497863825},{x:.24095002304009888,y:-.0032145836671228292},{x:.2446511035824589,y:-.0042348928870151745},{x:.24832493550927423,y:-.005349337618145378},{x:.24889860729226898,y:-.005405839357118937},{x:.2494543245702404,y:-.005559038796006631},{x:.2532833423420387,y:-.0058376980655201055},{x:.257104,y:-.006214000000000011},{x:.344948,y:-.006214000000000011},{x:.34876845169289644,y:-.005837718351308385},{x:.352597265623821,y:-.005559109487024962},{x:.35315318526669126,y:-.00540585978827806},{x:.3537270644907258,y:-.005349337618145378},{x:.3574006983675983,y:-.004234952964808514},{x:.36110158881940224,y:-.0032147329490055873},{x:.36161692908913895,y:-.0029559733581057666},{x:.36216875445642904,y:-.0027885789630079164},{x:.36555439482758706,y:-.000978916482299381},{x:.3689851386556908,y:.0007437082019616584},{x:.4667151386556908,y:.06249470820196166},{x:.46824382031514195,y:.0636852631221029},{x:.4698943035897058,y:.06470024765114774},{x:.4717154585013725,y:.06638901501054441},{x:.47367495473362387,y:.0679150932923645},{x:.4749419974608878,y:.0693810030307532},{x:.47636275350351887,y:.0706984782301942},{x:.4778194532662604,y:.07271008609647399},{x:.47944357522443626,y:.07458911996296573},{x:.4804002872780698,y:.07627405043044727},{x:.48153671723081914,y:.07784338646721853},{x:.5496157172308191,y:.19441638646721857},{x:.5509951179002539,y:.19742093333312605},{x:.5525209822553206,y:.20035381349539033},{x:.5528320971760705,y:.20142215679791795},{x:.5532963622471587,y:.2024333975455826},{x:.5540631001039363,y:.20564932060673602},{x:.5549874688679868,y:.20882352766745393},{x:.5813414688679868,y:.34949252766745387},{x:.5814477200321959,y:.3507103574246747},{x:.581725430046729,y:.351900851345405},{x:.5818303474337426,y:.35509595676374855},{x:.5821082033667889,y:.35828068632415006},{x:.5819748261451739,y:.3594958443979094},{x:.5820149461972951,y:.36071764184793353},{x:.5710349461972951,y:.5284976418479336},{x:.5705756858728281,y:.5312810757499365},{x:.5703149436633981,y:.5340900680661724},{x:.5698592272920282,y:.5356233082419208},{x:.5695988288779222,y:.5372015019922555},{x:.5686053720955593,y:.5398418557477263},{x:.5678016327590553,y:.5425460057826548},{x:.5216826327590552,y:.6556800057826547},{x:.5211943471023096,y:.656605995281004},{x:.5208498728309648,y:.6575945381025444},{x:.5191405880551111,y:.6605007631972294},{x:.5175679428069421,y:.6634831423933323},{x:.5169083878327574,y:.664296079457111},{x:.5163776774005638,y:.665198424109003},{x:.5141342596628157,y:.6677153419860701},{x:.5120099990343735,y:.6703336077343061},{x:.511204521070525,y:.6710022516480534},{x:.510507969381766,y:.6717837215313657},{x:.425955969381766,y:.7497057215313657},{x:.4243831978740034,y:.750892537075826},{x:.42294870744900304,y:.7522432326643229},{x:.4208707687817478,y:.7535430209032156},{x:.4189143183619635,y:.7550193610827685},{x:.4171402309909699,y:.7558765397994217},{x:.4154697962599445,y:.7569214269519826},{x:.41317820849544135,y:.7577908544006052},{x:.41097133104084405,y:.7588571425751742},{x:.40906410498936707,y:.7593517435666508},{x:.4072219198222394,y:.7600506678559823},{x:.3127869198222394,y:.7856226678559822},{x:.3097655669518694,y:.7861297177594856},{x:.3067801557646532,y:.7868174624905968},{x:.3054245519856559,y:.7868582361795984},{x:.30408703940192616,y:.7870827004032797},{x:.3010248204508113,y:.7869905707806608},{x:.2979626007613803,y:.7870826758597451},{x:.29662508997676323,y:.7868582009159747},{x:.29526948652460844,y:.786817416361878},{x:.2922840808497275,y:.7861296477028675},{x:.28926273204343433,y:.7856225735833884},{x:.19483073204343437,y:.7600505735833885},{x:.19298859701529922,y:.7593516514268194},{x:.1910814199885863,y:.7588570511522524},{x:.1888745059729717,y:.757790729268721},{x:.18658288068670334,y:.7569212665731724},{x:.18491249471518256,y:.7558763912940257},{x:.18313845528709377,y:.7550192228447639},{x:.18118197558509466,y:.7535428424712565},{x:.17910400699337814,y:.7522430123425641},{x:.17766956207459372,y:.7508923379118444},{x:.17609683558545802,y:.7497055417906873},{x:.09154583558545802,y:.6717835417906872},{x:.09084937681091164,y:.6710021668773223},{x:.09004400096562647,y:.6703336077343061},{x:.087919657143162,y:.6677152394449524},{x:.08567616637982708,y:.6651982097729843},{x:.0851455285488078,y:.6642959763928821},{x:.08448605719305789,y:.6634831423933323},{x:.08291335035419628,y:.6605006463960624},{x:.08120401576602496,y:.6575942974079984},{x:.08085959099279398,y:.6566058778839782},{x:.08037136724094471,y:.6556800057826547},{x:.03425236724094472,y:.5425460057826548},{x:.03344866581310472,y:.5398419832899659},{x:.03245524021837327,y:.537201759963462},{x:.0321948107181119,y:.5356234361255728},{x:.03173905633660196,y:.5340900680661724},{x:.03147832642517492,y:.5312812082371015},{x:.031019071243648687,y:.5284979083423142},{x:.020038071243648682,y:.36071790834231426},{x:.020078188427320915,y:.3594959771633442},{x:.019944796633211075,y:.35828068632415006}],[{x:.11021604810185967,y:.3604951889884744},{x:.12035004420691338,y:.5153337161267963},{x:.1599220965290545,y:.612407472440097},{x:.22898846858521874,y:.6760588762479813},{x:.301025186831377,y:.6955662779655215},{x:.373064807645506,y:.6760587099720985},{x:.44213195602343713,y:.6124073435241713},{x:.48170390405887986,y:.5153338430353971},{x:.49183697687726113,y:.3604953223188204},{x:.4679633532090146,y:.23306575687188358},{x:.4093572783633461,y:.13271343144136735},{x:.3319224534250481,y:.08378599999999999},{x:.27012977192577264,y:.08378599999999999},{x:.19269670382412518,y:.13271332265415062},{x:.13408961949133952,y:.23306590258843124},{x:.11021604810185967,y:.3604951889884744}]],1:[[{x:.17556757075794932,y:.5951166967821685},{x:.17573368487361973,y:.586296718297643},{x:.17761729959585784,y:.5776786204828649},{x:.18114602866723137,y:.5695935920037709},{x:.1861842650084615,y:.5623523359706766},{x:.19253839202243023,y:.5562331297919906},{x:.19996422417142623,y:.5514711311294693},{x:.20817639089041826,y:.548249340921154},{x:.21685930321783156,y:.5466915707579493},{x:.225679281702357,y:.5468576848736197},{x:.2342973795171352,y:.5487412995958578},{x:.24238240799622912,y:.5522700286672314},{x:.24962366402932343,y:.5573082650084615},{x:.33662600000000004,y:.6314944876419193},{x:.33662600000000004,y:.051034000000000024},{x:.33749066238185466,y:.042254935509274234},{x:.3400514210369921,y:.033813245543570986},{x:.3442098674463855,y:.026033339514117928},{x:.34980619484660536,y:.019214194846605387},{x:.35662533951411796,y:.013617867446385483},{x:.364405245543571,y:.00945942103699212},{x:.3728469355092743,y:.006898662381854659},{x:.381626,y:.0060340000000000255},{x:.3904050644907258,y:.006898662381854659},{x:.3988467544564291,y:.00945942103699212},{x:.40662666048588214,y:.01361786744638549},{x:.4134458051533947,y:.019214194846605387},{x:.41904213255361455,y:.026033339514117928},{x:.42320057896300795,y:.033813245543570986},{x:.4257613376181454,y:.042254935509274255},{x:.426626,y:.051034000000000024},{x:.426626,y:.729004},{x:.42636789988195944,y:.7316245344755278},{x:.4263183151263803,y:.7342572817023569},{x:.42593657376816557,y:.7360038620015019},{x:.4257613376181454,y:.7377830644907257},{x:.42499695590681574,y:.7403028932959718},{x:.4244347004041422,y:.7428753795171351},{x:.42371955318609683,y:.744513925721078},{x:.42320057896300795,y:.746224754456429},{x:.4219592904188853,y:.7485470419835442},{x:.42090597133276864,y:.7509604079962291},{x:.419884900961423,y:.7524279516932593},{x:.41904213255361455,y:.7540046604858821},{x:.41737163919932724,y:.7560401625275525},{x:.41586773499153856,y:.7582016640293234},{x:.4145799806286405,y:.7594418083381722},{x:.4134458051533947,y:.7608238051533946},{x:.41141030311172405,y:.7624942985076821},{x:.4095136079775698,y:.7643208702080094},{x:.40800865730110464,y:.7652859570783687},{x:.40662666048588214,y:.7664201325536145},{x:.40430437295876726,y:.767661421097737},{x:.4020877758285738,y:.7690828688705307},{x:.4004234632490515,y:.7697358105551997},{x:.3988467544564291,y:.7705785789630079},{x:.39632692565118355,y:.7713429606743374},{x:.3938756091095818,y:.772304659078846},{x:.39211589322607654,y:.7726203633950566},{x:.3904050644907258,y:.7731393376181454},{x:.3877845300151986,y:.7733974377361859},{x:.3851926967821685,y:.7738624292420507},{x:.38340520248922366,y:.7738287638499798},{x:.381626,y:.774004},{x:.37900546552447173,y:.7737458998819594},{x:.376372718297643,y:.7736963151263803},{x:.37462613799849803,y:.7733145737681656},{x:.3728469355092743,y:.7731393376181454},{x:.3703271067040287,y:.7723749559068158},{x:.36775462048286484,y:.7718127004041422},{x:.3661160742789217,y:.7710975531860966},{x:.364405245543571,y:.7705785789630079},{x:.3620829580164563,y:.7693372904188854},{x:.3596695920037709,y:.7682839713327686},{x:.35820204830674063,y:.7672629009614229},{x:.35662533951411796,y:.7664201325536145},{x:.3545898374724472,y:.7647496391993269},{x:.35242833597067663,y:.7632457349915385},{x:.1912283359706766,y:.6257917349915385},{x:.18510912979199054,y:.6194376079775697},{x:.18034713112946932,y:.6120117758285738},{x:.17712534092115398,y:.6037996091095817},{x:.17556757075794932,y:.5951166967821685}]],2:[[{x:.034589999999999996,y:.05195499999999997},{x:.034692251306008066,y:.05091682506774448},{x:.03463809526377374,y:.04987503351343359},{x:.03512383076438082,y:.04653492529109402},{x:.03545466238185463,y:.043175935509274184},{x:.03575748683953214,y:.042177657057450094},{x:.03590761484026801,y:.04114531791601493},{x:.0370356398580977,y:.03796415123181852},{x:.03801542103699209,y:.034734245543570935},{x:.03850718127225641,y:.0338142268532408},{x:.03885582398108696,y:.03283101233894428},{x:.040582789147307716,y:.02993103764454602},{x:.04217386744638545,y:.02695433951411788},{x:.04283566538917773,y:.026147936387598623},{x:.04336942466232366,y:.025251630882832152},{x:.04562896367409083,y:.022744292579413156},{x:.04777019484660536,y:.020135194846605337},{x:.04857659797312457,y:.019473396903813094},{x:.04927496174105457,y:.01869844492647086},{x:.0519802417813102,y:.01668009861889986},{x:.05458933951411791,y:.014538867446385433},{x:.055509358204447995,y:.01404710721112114},{x:.05634548873920743,y:.013423289731094336},{x:.05939254741314285,y:.011971499336069797},{x:.062369245543570956,y:.01038042103699207},{x:.0633675239953951,y:.010077596579314544},{x:.06430928926944049,y:.00962888655251979},{x:.06758102982102647,y:.008799443560749052},{x:.07081093550927423,y:.007819662381854608},{x:.0718491104415297,y:.007717411075846537},{x:.07286031894352762,y:.007461052176974015},{x:.07623101021818018,y:.0072858316174737835},{x:.07959,y:.006954999999999975},{x:.522462,y:.006954999999999975},{x:.5312410644907257,y:.007819662381854608},{x:.539682754456429,y:.01038042103699207},{x:.5474626604858821,y:.014538867446385433},{x:.5542818051533946,y:.020135194846605337},{x:.5598781325536145,y:.02695433951411788},{x:.5640365789630079,y:.034734245543570935},{x:.5665973376181453,y:.043175935509274205},{x:.567462,y:.05195499999999997},{x:.5665973376181453,y:.06073406449072574},{x:.5640365789630079,y:.06917575445642901},{x:.5598781325536145,y:.07695566048588207},{x:.5542818051533946,y:.08377480515339461},{x:.5474626604858821,y:.08937113255361451},{x:.539682754456429,y:.09352957896300787},{x:.5312410644907257,y:.09609033761814534},{x:.522462,y:.09695499999999997},{x:.1815000359059797,y:.09695499999999997},{x:.2783905550735291,y:.2032469617410546},{x:.2792807818102756,y:.20444017254595384},{x:.28031851181367967,y:.20550758629318672},{x:.43775551181367967,y:.4029575862931866},{x:.4393581707982963,y:.4054309283363016},{x:.4411189018513206,y:.4077943501865292},{x:.5036359018513206,y:.5115903501865292},{x:.5044316302389797,y:.5132634494776924},{x:.5054127007337849,y:.5148350555317778},{x:.5063216043693862,y:.5172373109446714},{x:.5074247535047713,y:.5195567934026113},{x:.5078787867151084,y:.5213529834674229},{x:.5085344010842773,y:.5230857889106145},{x:.5229384010842772,y:.5764717889106146},{x:.5230947969602031,y:.5774089507908463},{x:.5233933154704733,y:.5783109589719573},{x:.5238196553887738,y:.5817524776504878},{x:.5243904806061233,y:.5851730002877248},{x:.5243610401661515,y:.586122666187007},{x:.5244778496604383,y:.5870655806061408},{x:.5252778496604383,y:.6189585806061408},{x:.525154398698275,y:.6206444560860672},{x:.5252359209411441,y:.6223328785443973},{x:.5248330095087286,y:.6250334227224941},{x:.5246336028763079,y:.6277565667648055},{x:.5241836259995084,y:.6293859645321488},{x:.5239341869342451,y:.6310578486269935},{x:.5118811869342451,y:.6790048486269935},{x:.5115474759395316,y:.6799350391147754},{x:.5113589931552627,y:.6809051378786065},{x:.5100605296725933,y:.6840797730170447},{x:.5089023081582834,y:.6873082151493771},{x:.5083935381649621,y:.6881554285023456},{x:.5080194201443183,y:.6890701159233712},{x:.5061265656819337,y:.6919304336788418},{x:.5043607612540449,y:.6948708843926746},{x:.5036964840076373,y:.6956025626767983},{x:.5031511078963445,y:.6964266878303904},{x:.4695951078963445,y:.7376876878303904},{x:.46829294792790443,y:.7390014838193654},{x:.46714904955699066,y:.7404551608815331},{x:.46519525859727806,y:.7421268539092958},{x:.4633851429208498,y:.7439531446668906},{x:.4618516947085211,y:.7449876576267703},{x:.4604461776978856,y:.7461902391902692},{x:.4582037971525157,y:.7474486453977692},{x:.45607217068925404,y:.7488867084403534},{x:.4543663637878686,y:.7496021826182516},{x:.45275324136800726,y:.7505074541480116},{x:.3913892413680073,y:.7774134541480116},{x:.3883140702117422,y:.7784156528007931},{x:.3852957573995619,y:.7795779210778271},{x:.3841283231887951,y:.779779788263216},{x:.3830018757962646,y:.7801468976050565},{x:.3797902739335826,y:.7805299031606142},{x:.3766032098633093,y:.781080995160135},{x:.2948022098633093,y:.7870669951601349},{x:.29450281220893076,y:.7870594704966325},{x:.2942070489499988,y:.7871065838776864},{x:.29009611613079095,y:.7869487184427649},{x:.2859834519838158,y:.7868453561974301},{x:.28569127516043946,y:.7867795665334233},{x:.28539200354491423,y:.7867680740946454},{x:.2381110035449142,y:.7802710740946455},{x:.2365476307297285,y:.7798972084805876},{x:.2349498387179436,y:.7797212234138579},{x:.23226739693423346,y:.7788736316211718},{x:.2295313767481002,y:.7782193386355017},{x:.22807098126622102,y:.7775476578384392},{x:.22653822336325463,y:.7770633405173258},{x:.15287222336325462,y:.7455503405173259},{x:.15277120515837472,y:.7454948388638573},{x:.15266147866932564,y:.7454595513468599},{x:.14890641990559073,y:.7433714396994592},{x:.14514076206912752,y:.7413025033471496},{x:.1450525127361761,y:.7412283604682699},{x:.14495177886390068,y:.7411723444149347},{x:.14167624287507044,y:.7383917796239132},{x:.1383865705572421,y:.7356279539035645},{x:.138314481468594,y:.7355380190685297},{x:.13822661135931125,y:.7354634271443719},{x:.09327661135931127,y:.6889934271443718},{x:.09215967204365061,y:.6875853345117547},{x:.09088652507606766,y:.6863167230283468},{x:.0894249598835053,y:.6841377631074377},{x:.0877944205712414,y:.6820821900242812},{x:.08697364817646357,y:.6804832494460014},{x:.08597245819367963,y:.6789906353246448},{x:.0849640705590952,y:.6765684062835642},{x:.08376588401722862,y:.6742342280213215},{x:.08327282036617045,y:.6725058858871059},{x:.08258206253775009,y:.6708466294514168},{x:.06737006253775008,y:.6210196294514168},{x:.06563362911198059,y:.61237067498716},{x:.06561788807912042,y:.6035491464015462},{x:.0673234443582347,y:.5948940500909503},{x:.07068475437800403,y:.5867379965527546},{x:.07557264487941309,y:.5793944183504645},{x:.08179927697165325,y:.5731455250760676},{x:.08912536467535526,y:.5682314581936796},{x:.09726937054858317,y:.56484106253775},{x:.10591832501283995,y:.5631046291119806},{x:.11473985359845373,y:.5630888880791204},{x:.12339494990904962,y:.5647944443582347},{x:.13155100344724535,y:.568155754378004},{x:.13889458164953555,y:.5730436448794131},{x:.14514347492393234,y:.5792702769716532},{x:.15005754180632036,y:.5865963646753553},{x:.1534479374622499,y:.5947403705485832},{x:.16549687462406137,y:.6342067386764809},{x:.19660916323298405,y:.666371100226128},{x:.2563653288901179,y:.6919337213587163},{x:.29295461470925055,y:.696961546277117},{x:.3623268316838737,y:.6918850546595318},{x:.40664087103378327,y:.672454875030618},{x:.4270299373286165,y:.6473841495451277},{x:.4351521014718352,y:.6150740687208592},{x:.4346413299816387,y:.5947115247998124},{x:.4232850296720603,y:.5526213103922067},{x:.3655461500158852,y:.45675834907300783},{x:.21087613207581168,y:.2627785664153893},{x:.04633344492647088,y:.0822700382589454},{x:.04431509861889995,y:.07956475821868986},{x:.04217386744638545,y:.07695566048588207},{x:.04168210721112112,y:.0760356417955519},{x:.04105828973109435,y:.07519951126079251},{x:.03960649933606985,y:.07215245258685718},{x:.03801542103699209,y:.06917575445642901},{x:.037712596579314576,y:.0681774760046049},{x:.037263886552519804,y:.06723571073055948},{x:.036434443560749034,y:.06396397017897336},{x:.03545466238185463,y:.06073406449072574},{x:.03535241107584656,y:.059695889558470286},{x:.035096052176974035,y:.05868468105647236},{x:.03492083161747381,y:.05531398978181981},{x:.034589999999999996,y:.05195499999999997}]],3:[[{x:.02624429558875499,y:.07454886751538828},{x:.02628189246403191,y:.06572740500388341},{x:.028039748887915363,y:.057082779207475086},{x:.03145031142385274,y:.04894719824755728},{x:.036382514066253493,y:.04163330793793327},{x:.042646815033581253,y:.035422176981524986},{x:.05000248075272204,y:.030552495657744837},{x:.05816683711519421,y:.027211403088916904},{x:.11448783711519421,y:.010388403088916982},{x:.11753114712885143,y:.009796523380387901},{x:.12053464064709668,y:.009027703431080128},{x:.20267064064709667,y:-.0035892965689199724},{x:.20562630159751,y:-.003749783589053152},{x:.20856537842676282,y:-.004101230781641964},{x:.30947437842676284,y:-.00620423078164193},{x:.31075400531193675,y:-.006105070212514369},{x:.31203499449415534,y:-.0061847225744922005},{x:.3151428517207607,y:-.005764970678224511},{x:.3182695531731509,y:-.005522677007230838},{x:.31950524711917533,y:-.005175778959545043},{x:.3207771618583987,y:-.005003992231664048},{x:.3829651618583987,y:.009716007768336019},{x:.3849642059743718,y:.010402067561162992},{x:.38702295869345676,y:.010879972006216251},{x:.389126076828856,y:.011830396347599064},{x:.3913090018652735,y:.012579562954916447},{x:.3931357912831918,y:.013642434461507345},{x:.39506175111398195,y:.014512798837572657},{x:.47719975111398194,y:.06182779883757265},{x:.47924722409526294,y:.06329195880211928},{x:.48141099047099317,y:.06457804786673271},{x:.4828265323572166,y:.06585154318044145},{x:.484375351035892,y:.06695911252196202},{x:.4860978389589892,y:.06879458122658251},{x:.48796912564078,y:.07047808832945178},{x:.54077112564078,y:.12830608832945176},{x:.5409949120745448,y:.12860551518367325},{x:.5412686389329152,y:.1288600940829806},{x:.5436334835107667,y:.13213593090859313},{x:.5460522072884215,y:.13537218987116906},{x:.5462132784472015,y:.1357095218897727},{x:.546432079841298,y:.13601261058785885},{x:.5481124005325159,y:.13968686141763526},{x:.5498532864078638,y:.14333280617235186},{x:.5499454524173568,y:.14369507987504085},{x:.5501009199323095,y:.14403503084321223},{x:.5735679199323094,y:.2123790308432122},{x:.5742003382158373,y:.21504899342087444},{x:.5750294951185407,y:.21766455299430504},{x:.5752146521018063,y:.21933125436759},{x:.575601167738761,y:.22096305773765262},{x:.575700550423256,y:.22370509641963415},{x:.5760035049491392,y:.22643215923642232},{x:.5758599468852712,y:.22810295774565637},{x:.5759206866877095,y:.2297788119316045},{x:.5754832145523405,y:.2324875517091097},{x:.575248324328873,y:.23522131827456078},{x:.563515324328873,y:.2983063182745607},{x:.5624930457986839,y:.30183400865706583},{x:.561587550163308,y:.3053934651440046},{x:.5612670272694029,y:.3060647673464004},{x:.5610599744254687,y:.30677926765590185},{x:.5593691204378909,y:.31003973780923805},{x:.5577866081350055,y:.3133541469027738},{x:.5573412794357957,y:.31395001930700017},{x:.5569988129587381,y:.31461039668740554},{x:.5547043620842722,y:.317478348572073},{x:.5525056481741942,y:.32042033938948294},{x:.4997036481741942,y:.378250339389483},{x:.4970091109540712,y:.38067456957783247},{x:.49440132723244246,y:.38319188697894757},{x:.4937347452782226,y:.3836204617554604},{x:.49314561461057166,y:.3841504927896343},{x:.49002990831948917,y:.38600246394071897},{x:.48698112816844114,y:.387962658427834},{x:.4171684643874312,y:.4237087345514058},{x:.48487098803351525,y:.4540412587201935},{x:.4882241875669253,y:.4559584413246188},{x:.4916233115558361,y:.4577929691542233},{x:.4920492459188098,y:.45814540790983926},{x:.4925291804180174,y:.45841980913886743},{x:.49544392539098053,y:.4609543303938907},{x:.49841983754054403,y:.46341674447922576},{x:.545354837540544,y:.5107317444792258},{x:.5454749496657809,y:.5108793107625336},{x:.5456205162109946,y:.5110018387655073},{x:.548258239278959,y:.5142987798858712},{x:.5509236260451226,y:.5175733969812307},{x:.5510126414958236,y:.5177415605329735},{x:.5511315069931322,y:.5178901328189077},{x:.5530753456471339,y:.5216383183828395},{x:.5550506716503533,y:.525370005791429},{x:.5551051696126684,y:.5255523041806199},{x:.555192766127671,y:.525721211199887},{x:.5563680197383496,y:.5297766005381628},{x:.5575773743081012,y:.5338219516056334},{x:.5575952604559016,y:.5340113792074108},{x:.557648221703651,y:.5341941299579837},{x:.569382221703651,y:.5972801299579837},{x:.5696549699390315,y:.6004540423597167},{x:.5701008412017201,y:.6036082951002054},{x:.5700318821169291,y:.6048400880993865},{x:.5701375119403227,y:.6060692795769916},{x:.5697858198023349,y:.6092354166829699},{x:.5696077595908724,y:.6124160465097288},{x:.5692998146426919,y:.6136107177017713},{x:.5691636114574624,y:.614836897966064},{x:.5682009942777376,y:.6178735869028962},{x:.5674058453461934,y:.6209583639953996},{x:.5668707486862845,y:.622070002836373},{x:.5664979467044567,y:.623246050467446},{x:.5649613973213707,y:.6260365929822823},{x:.5635797167972587,y:.6289069710868302},{x:.5283787167972587,y:.6867359710868302},{x:.526364685994031,y:.6894131274243959},{x:.524479650893362,y:.6921826271628648},{x:.5237177195860089,y:.6929316152663909},{x:.5230754099184859,y:.6937854072711274},{x:.5205777908604191,y:.6960182048823972},{x:.5181886735848373,y:.6983667373551676},{x:.4595186735848373,y:.7456807373551677},{x:.45627545779875317,y:.7478078267647688},{x:.4530837115337172,y:.7500113951823929},{x:.4525909707504246,y:.7502243275150239},{x:.4521421155924859,y:.7505187128152536},{x:.44854624273044896,y:.7519722107862162},{x:.4449859301027389,y:.7535107594479447},{x:.362848930102739,y:.7797967594479446},{x:.36158078031831586,y:.7800691142952486},{x:.3603625229719573,y:.7805143446587972},{x:.35727696699365546,y:.7809934249999153},{x:.35422405316989464,y:.781649085623381},{x:.352927136733123,y:.7816688034988555},{x:.3516454277250751,y:.7818678086678129},{x:.2577774277250751,y:.7871168086678129},{x:.2534831925795917,y:.7869349938938289},{x:.24918809681378723,y:.7867747925856998},{x:.2490774333618657,y:.786748457272228},{x:.24896378128970398,y:.7867436453266514},{x:.24478752897123962,y:.7857275603552258},{x:.2406062159909945,y:.7847325056542677},{x:.16433721599099446,y:.7584545056542678},{x:.1612047546311144,y:.7570179671101032},{x:.15801334200327716,y:.7557176430739929},{x:.09817134200327716,y:.7241756430739928},{x:.09479788711775466,y:.721949723610623},{x:.09138819905405325,y:.7197797137879894},{x:.05384019905405325,y:.6903397137879895},{x:.04746503339724546,y:.6842424293748122},{x:.0424018859405069,y:.677018569451043},{x:.0388453306011542,y:.6689457429023652},{x:.036932043806339465,y:.6603341839257509},{x:.036735552094603836,y:.6515148299032538},{x:.03826340653223549,y:.6428266036640077},{x:.041456892530026886,y:.6346033888699733},{x:.046193286212010486,y:.6271611990540533},{x:.05229057062518783,y:.6207860333972455},{x:.05951443054895701,y:.615722885940507},{x:.06758725709763488,y:.6121663306011542},{x:.07619881607424907,y:.6102530438063395},{x:.08501817009674617,y:.6100565520946039},{x:.09370639633599236,y:.6115844065322356},{x:.1019296111300268,y:.6147778925300269},{x:.10937180094594674,y:.6195142862120105},{x:.14372643260130716,y:.6464504840370294},{x:.1969218011618275,y:.6744891243755197},{x:.2615721948597163,y:.6967640072977177},{x:.3408866683163358,y:.6923288252210377},{x:.40955721054777616,y:.6703524458415177},{x:.4555820596629536,y:.6332360369266462},{x:.477752059875079,y:.596814658492312},{x:.4716998550115053,y:.5642759337587675},{x:.44042564505409965,y:.532748518309004},{x:.3700728058889163,y:.5012285825754976},{x:.28267158635688694,y:.4816496665818946},{x:.2026156257994338,y:.47140070238604853},{x:.19958923290487823,y:.4707064281346213},{x:.19652752938874105,y:.4701896668089735},{x:.19529880233776667,y:.46972217540403877},{x:.1940174323454584,y:.4694282207777866},{x:.19118463692903986,y:.4681568668470777},{x:.18828257832087977,y:.4670527262205195},{x:.18716866396437967,y:.46635450477580015},{x:.18596926283986664,y:.4658162155208443},{x:.1834389276407875,y:.4640166393294268},{x:.18080803842542348,y:.46236755090702814},{x:.17985174386742717,y:.4614654316810775},{x:.17878040392329292,y:.4607034939516098},{x:.17664976830422657,y:.45844485220330683},{x:.1743911520787843,y:.45631418952832026},{x:.17362922718285934,y:.45524284045707714},{x:.17272711941234267,y:.45428653509274164},{x:.17107806250525512,y:.45165562612327925},{x:.16927851662463225,y:.44912526936741537},{x:.1687402417372368,y:.44792586179486843},{x:.1680420336360506,y:.4468119390745141},{x:.1669379277730794,y:.44390986724015796},{x:.1656666077762714,y:.4410770565945043},{x:.16537266849946,y:.43979568308103084},{x:.16490519181337332,y:.438566950430106},{x:.16438846716364272,y:.4355052407239498},{x:.16369422916516244,y:.43247883951296023},{x:.16365592142049992,y:.43116474252408066},{x:.16343714101639506,y:.42986841944927895},{x:.1635276550184117,y:.4267647316583033},{x:.16343717819520762,y:.42366104278329114},{x:.1636559741278381,y:.4223647223293339},{x:.1636942976139514,y:.42105062579943375},{x:.1643885718653787,y:.41802423290487795},{x:.16490533319102646,y:.414962529388741},{x:.1653728245959611,y:.41373380233776696},{x:.1656667792222133,y:.41245243234545836},{x:.1669381331529224,y:.40961963692903947},{x:.16804227377948042,y:.40671757832087974},{x:.16874049522419982,y:.4056036639643795},{x:.16927878447915568,y:.4044042628398666},{x:.17107836067057278,y:.40187392764078794},{x:.1727274490929718,y:.3992430384254234},{x:.17362956831892262,y:.3982867438674269},{x:.17439150604839013,y:.3972154039232929},{x:.1766501477966929,y:.39508476830422673},{x:.1787808104716797,y:.39282615207878424},{x:.17985215954292283,y:.39206422718285927},{x:.18080846490725827,y:.39116211941234263},{x:.18343937387672077,y:.38951306250525497},{x:.18596973063258454,y:.3877135166246322},{x:.18716913820513145,y:.3871752417372368},{x:.1882830609254858,y:.38647703363605057},{x:.19118513275984234,y:.3853729277730792},{x:.19401794340549564,y:.3841016077762714},{x:.19529931691896882,y:.38380766849946},{x:.19652804956989395,y:.38334019181337325},{x:.19958975927605035,y:.38282346716364263},{x:.20261616048703973,y:.3821292291651624},{x:.28149235433605535,y:.37203226198800626},{x:.3678476199052635,y:.34785057975990136},{x:.4387239808422848,y:.31155986033736477},{x:.4773813812672204,y:.26922136053481893},{x:.48460036747312013,y:.2304069273293995},{x:.4680118822440525,y:.1820955353962423},{x:.4262197745588727,y:.1363254129914362},{x:.35583608100487274,y:.09578139608686695},{x:.3056218275014876,y:.083895601213743},{x:.2134048551529998,y:.08581745449589688},{x:.13726972612583144,y:.09751265420048184},{x:.0839251628848058,y:.11344659691108305},{x:.0752658675153883,y:.11513070441124498},{x:.06644440500388343,y:.11509310753596806},{x:.05779977920747511,y:.11333525111208462},{x:.0496641982475573,y:.10992468857614723},{x:.04235030793793329,y:.10499248593374648},{x:.036139176981525016,y:.09872818496641873},{x:.03126949565774486,y:.09137251924727793},{x:.027928403088916927,y:.08320816288480577},{x:.02624429558875499,y:.07454886751538828}]],4:[[{x:.003828000000000005,y:.27580099999999996},{x:.0040512821902059844,y:.2735339778783202},{x:.004058111165048277,y:.2712559968420181},{x:.004482570943879651,y:.26915502967601196},{x:.004692662381854638,y:.26702193550927417},{x:.005353928343121064,y:.26484203377636983},{x:.005805038155045426,y:.26260915577382815},{x:.0066312204192078995,y:.26063136609773396},{x:.0072534210369921,y:.25858024554357095},{x:.008327258689269697,y:.2565712366005347},{x:.009205313441189196,y:.2544692698811785},{x:.010401468469599332,y:.25269066304309135},{x:.011411867446385462,y:.25080033951411784},{x:.01285700981091242,y:.2490394284479652},{x:.014128266351129452,y:.24714915041402313},{x:.01564842657685691,y:.24563807727727646},{x:.017008194846605366,y:.24398119484660533},{x:.018769105912757822,y:.24253605248207852},{x:.020384710565360974,y:.24093010545831445},{x:.022170457083446928,y:.23974463571613375},{x:.023827339514117918,y:.23838486744638543},{x:.025836348457154004,y:.2373110297941079},{x:.027734214441385185,y:.2360511294240198},{x:.029716922014597604,y:.23523682001377813},{x:.031607245543570965,y:.23422642103699207},{x:.03378714727647517,y:.23356515507572567},{x:.03589434066689576,y:.23269971862397582},{x:.03799781495511128,y:.23228786299963877},{x:.040048935509274235,y:.2316656623818546},{x:.04231595763095386,y:.23144238019164864},{x:.0445515001672978,y:.23100466589573537},{x:.046694905833262405,y:.23101109143797494},{x:.048828,y:.23080099999999998},{x:.36918100000000004,y:.23080099999999998},{x:.36918100000000004,y:.05103000000000002},{x:.37004566238185466,y:.04225093550927423},{x:.3726064210369921,y:.03380924554357098},{x:.3767648674463855,y:.026029339514117924},{x:.38236119484660536,y:.019210194846605383},{x:.38918033951411796,y:.013613867446385479},{x:.396960245543571,y:.009455421036992116},{x:.4054019355092743,y:.006894662381854655},{x:.414181,y:.0060300000000000215},{x:.4229600644907258,y:.006894662381854655},{x:.4314017544564291,y:.009455421036992116},{x:.43918166048588214,y:.013613867446385486},{x:.4460008051533947,y:.019210194846605383},{x:.45159713255361456,y:.026029339514117924},{x:.45575557896300795,y:.03380924554357098},{x:.4583163376181454,y:.04225093550927425},{x:.459181,y:.05103000000000002},{x:.459181,y:.23080099999999998},{x:.553224,y:.23080099999999998},{x:.5620030644907258,y:.2316656623818546},{x:.5704447544564291,y:.23422642103699207},{x:.5782246604858822,y:.23838486744638543},{x:.5850438051533947,y:.24398119484660533},{x:.5906401325536146,y:.25080033951411784},{x:.5947985789630079,y:.25858024554357095},{x:.5973593376181454,y:.26702193550927417},{x:.5982240000000001,y:.27580099999999996},{x:.5973593376181454,y:.28458006449072576},{x:.5947985789630079,y:.293021754456429},{x:.5906401325536146,y:.3008016604858821},{x:.5850438051533947,y:.3076208051533946},{x:.5782246604858822,y:.3132171325536145},{x:.5704447544564291,y:.3173755789630079},{x:.5620030644907258,y:.31993633761814533},{x:.553224,y:.32080099999999995},{x:.459181,y:.32080099999999995},{x:.459181,y:.421833},{x:.4583163376181454,y:.4306120644907258},{x:.45575557896300795,y:.439053754456429},{x:.45159713255361456,y:.4468336604858821},{x:.4460008051533947,y:.4536528051533947},{x:.43918166048588214,y:.45924913255361455},{x:.4314017544564291,y:.4634075789630079},{x:.4229600644907258,y:.4659683376181454},{x:.414181,y:.466833},{x:.4054019355092743,y:.4659683376181454},{x:.396960245543571,y:.4634075789630079},{x:.38918033951411796,y:.45924913255361455},{x:.38236119484660536,y:.4536528051533947},{x:.3767648674463855,y:.4468336604858821},{x:.3726064210369921,y:.439053754456429},{x:.37004566238185466,y:.4306120644907258},{x:.36918100000000004,y:.421833},{x:.36918100000000004,y:.32080099999999995},{x:.1436046917940101,y:.32080099999999995},{x:.4533648945416855,y:.700560710565361},{x:.45824387057598015,y:.7079102144413851},{x:.4615952813760241,y:.7160703406668958},{x:.46329033410426457,y:.7247275001672978},{x:.46326388883495173,y:.7335490031579818},{x:.46151696184495455,y:.7421958442261718},{x:.45811668655881077,y:.7503357301188214},{x:.4531937336488705,y:.7576558495859769},{x:.446937289434639,y:.7638748945416856},{x:.4395877855586148,y:.7687538705759801},{x:.43142765933310423,y:.7721052813760241},{x:.42277049983270215,y:.7738003341042645},{x:.41394899684201814,y:.7737738888349517},{x:.40530215577382817,y:.7720269618449546},{x:.39716226988117853,y:.7686266865588108},{x:.38984215041402315,y:.7637037336488706},{x:.38362310545831446,y:.757447289434639},{x:.013957105458314502,y:.304244289434639},{x:.012771635716133971,y:.30245854291655333},{x:.011411867446385462,y:.3008016604858821},{x:.010338029794107799,y:.29879265154284573},{x:.009078129424019837,y:.29689478555861476},{x:.008263820013778204,y:.2949120779854024},{x:.0072534210369921,y:.293021754456429},{x:.006592155075725704,y:.29084185272352475},{x:.005726718623975863,y:.2887346593331042},{x:.0053148629996388475,y:.28663118504488877},{x:.004692662381854638,y:.28458006449072576},{x:.00446938019164866,y:.282313042369046},{x:.00403166589573542,y:.2800774998327022},{x:.00403809143797499,y:.27793409416673776},{x:.003828000000000005,y:.27580099999999996}]],5:[[{x:.029951000000000005,y:.38529899999999995},{x:.030026331329377584,y:.3845341481773043},{x:.029977079633894697,y:.38376717530271315},{x:.030458063889865227,y:.38015069392879464},{x:.03081566238185464,y:.37651993550927415},{x:.03103876142924568,y:.3757844765131909},{x:.03114008507636279,y:.3750226322781917},{x:.0323173678705276,y:.3715694759531816},{x:.0333764210369921,y:.36807824554357094},{x:.033738714231120716,y:.3674004426508694},{x:.033986719409902104,y:.366673004302166},{x:.03581505842470893,y:.3635158758870829},{x:.03753486744638546,y:.3602983395141178},{x:.03802243206297786,y:.35970424030984804},{x:.03840758807348568,y:.3590391628952293},{x:.04081672126593952,y:.35629938906452685},{x:.04313119484660537,y:.3534791948466053},{x:.04372529405087513,y:.3529916302300129},{x:.04423279956362368,y:.3524144723015426},{x:.04713014529619686,y:.3501973410270508},{x:.04995033951411792,y:.3478828674463854},{x:.05062814240681941,y:.3475205742522568},{x:.05123849426956635,y:.347053515665452},{x:.054512709170605814,y:.34544423005866864},{x:.057730245543570965,y:.343724421036992},{x:.05846570453965444,y:.3435013219896009},{x:.05915544727260316,y:.34316231154402344},{x:.06268070509966306,y:.34222271554831923},{x:.06617193550927424,y:.3411636623818546},{x:.0669367873319697,y:.34108833105247705},{x:.06767941450870582,y:.34089039672943083},{x:.07132024158048059,y:.34065659849198926},{x:.074951,y:.34029899999999996},{x:.0757158518226955,y:.3403743313293775},{x:.07648282469728679,y:.34032507963389463},{x:.08009930607120508,y:.3408060638898651},{x:.08373006449072577,y:.3411636623818546},{x:.0844655234868091,y:.3413867614292456},{x:.08522736772180821,y:.34148808507636275},{x:.2701097088502776,y:.3848544225750548},{x:.39095673206080095,y:.3699215697302287},{x:.4312208460684155,y:.34735587040502247},{x:.4569274445394237,y:.3179203076157562},{x:.4808881134259603,y:.2201177906149206},{x:.47151862074291284,y:.1781066999956386},{x:.4461217481742335,y:.14395206669668215},{x:.3876788357927069,y:.10680533743499816},{x:.3169820044514503,y:.08634947983662909},{x:.2505487358362677,y:.08307118781270932},{x:.19638270317906092,y:.09339965838335124},{x:.15518503458472022,y:.11245499400015477},{x:.1051531598037562,y:.15775209985578706},{x:.09806479623887651,y:.16300326318775482},{x:.09008818244690309,y:.16677065575830224},{x:.0815298552225249,y:.16890949878372125},{x:.07271870628140957,y:.16933759772602197},{x:.06399334313601493,y:.16803850098293246},{x:.05568907659877849,y:.16506213211374782},{x:.04812503497563989,y:.16052287130494386},{x:.041591900144212934,y:.15459515980375618},{x:.03634073681224515,y:.1475067962388765},{x:.03257334424169774,y:.13953018244690307},{x:.03043450121627874,y:.13097185522252489},{x:.03000640227397801,y:.12216070628140954},{x:.031305499017067515,y:.1134353431360149},{x:.034281867886252176,y:.10513107659877846},{x:.03882112869505611,y:.09756703497563987},{x:.044748840196243804,y:.09103390014421289},{x:.09986584019624378,y:.041132900144212926},{x:.10178680031290575,y:.03970982481314967},{x:.10357183338498165,y:.03811957700249835},{x:.10532248536915285,y:.037090537646117014},{x:.10695420376112348,y:.035881736812245144},{x:.10911588139237749,y:.0348607662023731},{x:.11117685751196796,y:.03364931723433351},{x:.16362485751196798,y:.009390317234333478},{x:.1646572774363771,y:.009030847933342759},{x:.16562545909873666,y:.008523173483185618},{x:.16881529925253239,y:.0075831025339957205},{x:.1719558576504946,y:.006489618860012841},{x:.17303856889723523,y:.006338471796353147},{x:.17408718959239433,y:.0060294350406820685},{x:.23897018959239436,y:-.00634256495931787},{x:.2399001168767359,y:-.006426714843400178},{x:.24080591100583193,y:-.006653392925378379},{x:.24428588214420577,y:-.0068235863462415185},{x:.247755834543085,y:-.007137585190079683},{x:.24868431036339586,y:-.007038698344381461},{x:.24961692261229596,y:-.007084309202250054},{x:.32666292261229596,y:-.003282309202250082},{x:.32746661284147915,y:-.0031629125067284265},{x:.32827905619988357,y:-.00317336931171093},{x:.3318231917274382,y:-.002515696572186591},{x:.33538870069659477,y:-.001986002452099067},{x:.33615365510360457,y:-.0017121077449900682},{x:.3369525276121403,y:-.0015638637889859724},{x:.4188855276121403,y:.02214313621101406},{x:.4207304127428032,y:.02287964098341223},{x:.42264402370761556,y:.023412682727046455},{x:.4248170355152836,y:.024511079778651145},{x:.4270783417525648,y:.02541382586724525},{x:.42874409297954025,y:.02649609814118395},{x:.43051694316083267,y:.027392224616519634},{x:.5014129431608326,y:.07245422461651957},{x:.5044011686844615,y:.0747943741105689},{x:.5074525565132345,y:.07705154573740032},{x:.5078697672823866,y:.07751071502587484},{x:.5083582165656543,y:.07789323111579813},{x:.5108324836553944,y:.0807713891731658},{x:.5133848875831327,y:.08358048611421783},{x:.5494628875831328,y:.1320994861142178},{x:.5497798823390716,y:.1326268676033582},{x:.5501811109693575,y:.13309337858567127},{x:.5520495631508493,y:.13640291633591076},{x:.5540074974944301,y:.13966031511116345},{x:.5542155142604781,y:.14023940572188273},{x:.5545180216173755,y:.1407752286491667},{x:.5557049132287019,y:.14438569149730107},{x:.5569897394368822,y:.14796247431004633},{x:.5570807842453774,y:.1485710199149322},{x:.5572729451408087,y:.14915556341258465},{x:.5710219451408087,y:.2108035634125847},{x:.5712046210163666,y:.21230267395853206},{x:.5715791512667351,y:.2137656948046034},{x:.571736996194895,y:.21667155541097086},{x:.5720890113736304,y:.2195603313107129},{x:.5719757152243157,y:.2210662751632623},{x:.5720576277729665,y:.2225742517011615},{x:.5716455344736617,y:.2254550710286549},{x:.5714272135589309,y:.2283570146640783},{x:.5710222992922247,y:.22981191924551903},{x:.5708084462858501,y:.23130690078257787},{x:.5417354462858501,y:.3499769007825779},{x:.5411002871662289,y:.3517814599872898},{x:.540669734049328,y:.3536454570484658},{x:.5396393400617131,y:.355932176655931},{x:.5388066121493867,y:.3582980512419798},{x:.5378316053978042,y:.3599440229503987},{x:.537045677451414,y:.361688207084494},{x:.5355889653307644,y:.36372996812105773},{x:.5343106788169316,y:.36588792593376723},{x:.5330332933960605,y:.36731205637621067},{x:.5319221933904076,y:.36886939956510134},{x:.49389619339040763,y:.4124113995651013},{x:.49150876583293945,y:.41465677330496736},{x:.4892379705562563,y:.41702003426923534},{x:.48830169237996507,y:.41767302336482964},{x:.48747017448549057,y:.4184550652905171},{x:.4846905699931398,y:.420191530792605},{x:.4820023580684325,y:.4220663721783498},{x:.4272473580684325,y:.4527533721783498},{x:.42330567688981036,y:.45447898255061825},{x:.4193723578126433,y:.45622356923745777},{x:.4192660752068488,y:.4562474610875831},{x:.4191662841579818,y:.4562911481493166},{x:.41496369139475175,y:.45721461755172516},{x:.4107655979622113,y:.4581583300092093},{x:.27317359796221125,y:.47516033000920926},{x:.26964530070808584,y:.4752477446385603},{x:.2661231753027132,y:.4754739203661053},{x:.26524270860794985,y:.4753568201865933},{x:.26435476148695686,y:.47537881934450843},{x:.2608772057270339,y:.4747762176787918},{x:.2573786322781918,y:.4743109149236372},{x:.119951,y:.44207564006371447},{x:.119951,y:.684004},{x:.527101,y:.684004},{x:.5358800644907258,y:.6848686623818546},{x:.544321754456429,y:.6874294210369921},{x:.5521016604858822,y:.6915878674463855},{x:.5589208051533947,y:.6971841948466053},{x:.5645171325536146,y:.7040033395141179},{x:.5686755789630079,y:.711783245543571},{x:.5712363376181454,y:.7202249355092742},{x:.5721010000000001,y:.729004},{x:.5712363376181454,y:.7377830644907257},{x:.5686755789630079,y:.746224754456429},{x:.5645171325536146,y:.7540046604858821},{x:.5589208051533947,y:.7608238051533946},{x:.5521016604858822,y:.7664201325536145},{x:.544321754456429,y:.7705785789630079},{x:.5358800644907258,y:.7731393376181454},{x:.527101,y:.774004},{x:.074951,y:.774004},{x:.06617193550927424,y:.7731393376181454},{x:.05773024554357094,y:.7705785789630079},{x:.04995033951411792,y:.7664201325536145},{x:.04313119484660537,y:.7608238051533946},{x:.03753486744638546,y:.7540046604858821},{x:.0333764210369921,y:.746224754456429},{x:.03081566238185464,y:.7377830644907257},{x:.029951000000000005,y:.729004},{x:.029951000000000005,y:.38529899999999995}]],6:[[{x:.01994450211145162,y:.2755194646798348},{x:.020758274672659796,y:.26806396163938684},{x:.0201773643330274,y:.24423363638780976},{x:.020440223451033163,y:.2406784570189078},{x:.020568639264984916,y:.237115887070161},{x:.02076496657089406,y:.23628629421823594},{x:.02082782677693791,y:.23543610758842642},{x:.021779216218601925,y:.23200052126419074},{x:.022600187477202785,y:.22853145778054884},{x:.04459918747720279,y:.16442145778054884},{x:.04602253566469808,y:.16130748249724527},{x:.047307319174730654,y:.15813382633120915},{x:.06831231917473066,y:.11806482633120913},{x:.06934150993632018,y:.11649740482650416},{x:.07018719324152095,y:.11482382676006757},{x:.07175673818837072,y:.11281909673987861},{x:.07315419088510985,y:.11069082519836773},{x:.0744693948008918,y:.10935430641546007},{x:.07562532742241568,y:.1078778703106287},{x:.1253733274224157,y:.055788870310628645},{x:.12585541612958862,y:.055374327647901005},{x:.12626130847256478,y:.0548849335871293},{x:.1291958120945167,y:.0525019586891126},{x:.1320620582603259,y:.05003730581521479},{x:.13261575702973094,y:.04972477931463493},{x:.1331093263100589,y:.049323974491408525},{x:.1861743263100589,y:.014262974491408516},{x:.18683955107784095,y:.013911818906951787},{x:.187438960697758,y:.013457349607970202},{x:.1907349034619545,y:.011855559414887177},{x:.19397565070571454,y:.010144849670490022},{x:.19469660042216425,y:.009930220356283175},{x:.19537315511619574,y:.009601422573216056},{x:.19891826102894206,y:.008673416864759805},{x:.2024304811380398,y:.007627816351770726},{x:.20317945010986724,y:.007557961391993223},{x:.20390715026053782,y:.0073674706392518954},{x:.2857161502605378,y:-.005654529360748083},{x:.2860775594607644,y:-.005676122674759226},{x:.28642923596273784,y:-.0057621838110407525},{x:.2904772893795591,y:-.005938995755027237},{x:.2945219894833068,y:-.006180656673914681},{x:.2948806669536751,y:-.006131327641200151},{x:.2952423757850646,y:-.006147126454864343},{x:.38700037578506463,y:-.001139126454864331},{x:.39074801870473747,y:-.000562375362895672},{x:.3945101708776463,y:-8942684208443352e-20},{x:.395102371884912,y:.00010774663253235539},{x:.3957192721812796,y:.00020268575218489876},{x:.39928238663684656,y:.0014994835976446027},{x:.4028799824314506,y:.002697304024131271},{x:.47474098243145063,y:.03475230402413133},{x:.4764407459001163,y:.03572046389197228},{x:.4782361407270164,y:.03649705052245801},{x:.48026428101539703,y:.03789829234877595},{x:.4824063061811086,y:.03911835786940705},{x:.4838845305509628,y:.04039952221931584},{x:.48549392283388365,y:.041511451110380196},{x:.5363469228338836,y:.08458545111038014},{x:.5369424578291695,y:.08519979361043255},{x:.5376274627831791,y:.08571247952886965},{x:.5400078699953618,y:.08836201411598918},{x:.5424869876672573,y:.09091942444541115},{x:.5429512273484354,y:.09163814564059086},{x:.5435230500634102,y:.09227461827992436},{x:.5453408198626901,y:.09533763721244376},{x:.5472733759789791,y:.0983295594844189},{x:.5475884798754501,y:.09912503932225875},{x:.5480251455251356,y:.09986083939589693},{x:.5756631455251356,y:.15896283939589692},{x:.5756676990332947,y:.1589757429605767},{x:.575674675284325,y:.15898751446598428},{x:.5771354507402345,y:.1631350040011944},{x:.5785987361645655,y:.16728160865370237},{x:.5786006848177536,y:.16729515262537814},{x:.5786052305152959,y:.16730805894366996},{x:.5792288025114348,y:.17166083878445604},{x:.5798550088797246,y:.1760132404159827},{x:.5798542777922926,y:.17602690430741857},{x:.5798562182477396,y:.17604044945602063},{x:.5820672182477395,y:.2261264494560206},{x:.5819074721227447,y:.22907858468741052},{x:.5819395990078049,y:.232034864293962},{x:.5816696541741431,y:.23347350033714379},{x:.5815905637246603,y:.23493510513282764},{x:.580857954063737,y:.2377993509905685},{x:.5803127220992973,y:.2407050941577823},{x:.5648357220992973,y:.2937960941577823},{x:.5632290277642941,y:.2977974374258546},{x:.5616400226499054,y:.30180583827676916},{x:.5384240226499054,y:.3468838382767692},{x:.5373215489467563,y:.3485896803397862},{x:.5364060617863755,y:.35040275195151915},{x:.5349331318310961,y:.3522852445680167},{x:.5336357086983223,y:.35429272914301846},{x:.5322216254408594,y:.35575071197935654},{x:.5309700163849885,y:.3573503432435408},{x:.49559401638498846,y:.39441334324354077},{x:.4926979475395651,y:.39690515537305066},{x:.48986855873600776,y:.3994724304741097},{x:.48935820160472765,y:.3997787125549045},{x:.48890701524930746,y:.4001669186691625},{x:.48558046512393155,y:.4020458563236817},{x:.4823045917066957,y:.404011815580751},{x:.4336605917066957,y:.42705181558075106},{x:.43309173356321873,y:.4272557130907893},{x:.4325654489917744,y:.42755269513041455},{x:.42894434743018467,y:.4287422729922158},{x:.4253563740806812,y:.43002832091195864},{x:.42475866795602985,y:.4301173218701226},{x:.42418455747331046,y:.430305924456616},{x:.35674655747331047,y:.44533192445661596},{x:.3529000911149492,y:.4457998510145922},{x:.3490659246900917,y:.4463596961147396},{x:.28494592469009167,y:.4493636961147396},{x:.2805873413475358,y:.449139645094856},{x:.27622830276644406,y:.44892463285807194},{x:.20879130276644411,y:.4389076328580719},{x:.2058686377582091,y:.4381749274884603},{x:.2029059705898912,y:.4376259000221244},{x:.2015992206546876,y:.4371045944779896},{x:.20023455588710068,y:.4367624761715421},{x:.19751099279397463,y:.4354736658725529},{x:.19471236238975773,y:.4343572001231398},{x:.1250653623897577,y:.39829620012313977},{x:.12281565387932818,y:.3968352958512946},{x:.12046004217050754,y:.3955521266688945},{x:.11912493361112,y:.39443863469229795},{x:.1176668837895426,y:.39349181371392206},{x:.11574541108214431,y:.3916200839502759},{x:.11440461043594556,y:.3905018447245139},{x:.11499744675527566,y:.4076710597897629},{x:.14015918883207887,y:.48309781218266834},{x:.17625691985197756,y:.5624688107059582},{x:.22079283681825793,y:.6049160879451294},{x:.2812243215554422,y:.6473094683632384},{x:.35529887985725983,y:.6721340784004237},{x:.44197867319461825,y:.699237682451455},{x:.450099621980826,y:.7026829408131323},{x:.45739239245003865,y:.7076463180152294},{x:.4635767275229571,y:.7139370742553635},{x:.4684149666709443,y:.7213134592991232},{x:.47172117907685873,y:.729492002806001},{x:.4733683088520865,y:.7381584079356077},{x:.4732930577230865,y:.7469796295989887},{x:.471498317548545,y:.7556166731946181},{x:.4680530591868676,y:.7637376219808258},{x:.4630896819847706,y:.7710303924500386},{x:.4567989257446365,y:.7772147275229571},{x:.4494225407008768,y:.7820529666709441},{x:.4412439971939989,y:.7853591790768587},{x:.43257759206439217,y:.7870063088520864},{x:.4237563704010112,y:.7869310577230865},{x:.41511932680538177,y:.7851363175485448},{x:.32800332680538175,y:.7578963175485449},{x:.32758097645219697,y:.7577171382279785},{x:.32713377373466446,y:.7576146941984534},{x:.2464307737346645,y:.7305686941984535},{x:.24453959681011464,y:.7297206474805041},{x:.2425703892464572,y:.7290741531131611},{x:.24052462272791658,y:.727920241844807},{x:.2383814751569417,y:.7269592057619036},{x:.2366920823739949,y:.725758503708645},{x:.23488683737580707,y:.7247402582115807},{x:.16634483737580705,y:.6766572582115807},{x:.16379281785599412,y:.6744641039532857},{x:.16114120086592887,y:.6723924725748345},{x:.10785520086592887,y:.6216054725748346},{x:.10512406158167997,y:.61843588774195},{x:.10236095541706475,y:.6152941312068447},{x:.10224621895073822,y:.6150960484276141},{x:.1020967920615373,y:.6149226331776604},{x:.10003648617852028,y:.6112811321861437},{x:.09793939861820375,y:.6076606883504815},{x:.057256398618203745,y:.5182076883504814},{x:.05649445644348035,y:.515973451082899},{x:.055531562043165734,y:.5138181769891187},{x:.02756156204316574,y:.4299731769891187},{x:.02710606704062858,y:.4279720709807987},{x:.026442901166776424,y:.42602987841114226},{x:.0261294707087366,y:.42368163359604843},{x:.025603668479436986,y:.4213716499642221},{x:.02554732210120287,y:.4193201319800137},{x:.025275801747494525,y:.4172858808521062},{x:.022290801747494524,y:.3308368808521062},{x:.022305383523873214,y:.330608131273329},{x:.022277364333027405,y:.33038063638780973},{x:.021194122115214913,y:.2859434614650037},{x:.02071653916751727,y:.2843071590959475},{x:.01994450211145162,y:.2755194646798348}],[{x:.11034731747482908,y:.25010871966048204},{x:.11054573733688708,y:.2582483748303443},{x:.14138614929871246,y:.28974619429248377},{x:.17280436841728808,y:.32166563054627706},{x:.2294333737827033,y:.3509863272379111},{x:.2851142784460479,y:.35925709287120927},{x:.3409693478959939,y:.3566403020317264},{x:.39969116147327427,y:.34355637352239615},{x:.43624565447916347,y:.3262425111990739},{x:.46138408324665353,y:.29990528863548604},{x:.47964461062187336,y:.2644492215688011},{x:.49182659739178797,y:.22266115801633354},{x:.4903391577658353,y:.18896604218391924},{x:.47066764412974615,y:.14689983627465894},{x:.4322187986209955,y:.11433252320671945},{x:.3738017517723872,y:.08827446060346957},{x:.29512698962943984,y:.08398052210424463},{x:.22766698305582697,y:.09471851188045},{x:.18695506157646963,y:.1216176107024183},{x:.1450838647757246,y:.1654591474507099},{x:.12861258258928074,y:.1968796571354811},{x:.11034731747482908,y:.25010871966048204}]],7:[[{x:.026534000000000002,y:.729004},{x:.027398662381854635,y:.7202249355092742},{x:.029959421036992097,y:.711783245543571},{x:.03411786744638546,y:.7040033395141179},{x:.039714194846605363,y:.6971841948466053},{x:.046533339514117915,y:.6915878674463855},{x:.05431324554357096,y:.6874294210369921},{x:.06275493550927423,y:.6848686623818546},{x:.071534,y:.684004},{x:.4019606654607806,y:.684004},{x:.4004737160341744,y:.6825246433416329},{x:.3773547160341744,y:.6545006433416328},{x:.37631768094411194,y:.6529571778549935},{x:.37511206403824765,y:.6515414747212956},{x:.3516100640382476,y:.6177174747212957},{x:.35070717908442606,y:.6160998190359583},{x:.34962595461558005,y:.6145955036421288},{x:.32637595461558006,y:.5744575036421288},{x:.32562538351875275,y:.5728072168885044},{x:.3246890272988689,y:.5712547864166106},{x:.3023170272988689,y:.5242907864166106},{x:.3017220252289498,y:.5226423026482856},{x:.3009361907094137,y:.5210757809262708},{x:.2800741907094137,y:.4667717809262708},{x:.2796297795277362,y:.4651572895546526},{x:.27899211910181604,y:.46360891205912846},{x:.26027511910181605,y:.40145091205912853},{x:.2599700482242006,y:.399900691568321},{x:.2594722021762355,y:.3984012246220316},{x:.2435242021762355,y:.3278752246220315},{x:.24329560198997774,y:.32604433113097486},{x:.24285939794168837,y:.32425152465814894},{x:.22552039794168838,y:.201651524658149},{x:.22543629437721757,y:.19966542745190077},{x:.2251384028560513,y:.1976999971774209},{x:.21759140285605127,y:.0533799971774209},{x:.2179964236931644,y:.04456775725283754},{x:.22011284489303193,y:.03600385769296016},{x:.22385933357584556,y:.028017404355184638},{x:.22909191428257988,y:.020915312162427036},{x:.23560950187114016,y:.014970510534755857},{x:.24316162910560324,y:.010411454864839347},{x:.25145807197163045,y:.007413347105324521},{x:.2601800028225791,y:.006091402856051323},{x:.26899224274716244,y:.0064964236931644576},{x:.27755614230703984,y:.008612844893031955},{x:.2855425956448154,y:.0123593335758456},{x:.29264468783757297,y:.017591914282579925},{x:.29858948946524416,y:.02410950187114019},{x:.30314854513516065,y:.03166162910560326},{x:.30614665289467546,y:.03995807197163046},{x:.3074685971439487,y:.04868000282257914},{x:.3149118365119932,y:.19101580586964154},{x:.33171443080019297,y:.3098230069615897},{x:.3469078029209317,y:.3770118558572018},{x:.3646876244488305,y:.43605754408347375},{x:.3843219343355222,y:.48716585412502805},{x:.40516196826036527,y:.5309139031705462},{x:.42657620329737017,y:.5678827017045378},{x:.4479617026009278,y:.5986606409626235},{x:.4682073320853445,y:.6232016470905397},{x:.5069453480603512,y:.6602460238293135},{x:.5211069187127709,y:.670919967941474},{x:.553634852004927,y:.6903949675582732},{x:.5545334052571363,y:.6910607030437311},{x:.5555196604858821,y:.6915878674463855},{x:.5580709875097788,y:.6936816874233654},{x:.5607229359621996,y:.6956465083018619},{x:.5614743452153894,y:.6964747509099635},{x:.5623388051533946,y:.6971841948466053},{x:.5644326251303754,y:.699735521870503},{x:.5666502995990071,y:.7021799587443133},{x:.5672256886169725,y:.7031388795761127},{x:.5679351325536145,y:.7040033395141179},{x:.5694909811561905,y:.7069141275182039},{x:.5711891576548912,y:.709744242049125},{x:.5715664145603537,y:.7107969903148255},{x:.5720935789630078,y:.711783245543571},{x:.5730516658019124,y:.7149416345772374},{x:.5741650843601849,y:.7180486670509921},{x:.5743297113818354,y:.7191547862251302},{x:.5746543376181453,y:.7202249355092742},{x:.574977843953461,y:.7235095504532041},{x:.5754637165205229,y:.7267740993542682},{x:.5754093871342436,y:.7278910818973009},{x:.575519,y:.729004},{x:.5751954936646845,y:.7322886149439295},{x:.5750351484302645,y:.735585225488817},{x:.5747639504839017,y:.7366701463880269},{x:.5746543376181453,y:.7377830644907257},{x:.5736962507792408,y:.7409414535243923},{x:.5728958497207748,y:.7441434388186243},{x:.5724182051993175,y:.7451546051722857},{x:.5720935789630078,y:.746224754456429},{x:.570537730360432,y:.749135542460515},{x:.5691280324417267,y:.752119852004927},{x:.5684622969562688,y:.7530184052571364},{x:.5679351325536145,y:.7540046604858821},{x:.5658413125766343,y:.756555987509779},{x:.563876491698138,y:.7592079359621996},{x:.5630482490900365,y:.7599593452153895},{x:.5623388051533946,y:.7608238051533946},{x:.5597874781294971,y:.7629176251303754},{x:.5573430412556867,y:.7651352995990072},{x:.5563841204238874,y:.7657106886169726},{x:.5555196604858821,y:.7664201325536145},{x:.5526088724817957,y:.7679759811561907},{x:.5497787579508749,y:.7696741576548912},{x:.5487260096851745,y:.7700514145603538},{x:.547739754456429,y:.7705785789630079},{x:.5445813654227618,y:.7715366658019126},{x:.5414743329490078,y:.7726500843601849},{x:.5403682137748697,y:.7728147113818356},{x:.5392980644907257,y:.7731393376181454},{x:.5360134495467959,y:.773462843953461},{x:.5327489006457318,y:.7739487165205229},{x:.531631918102699,y:.7738943871342436},{x:.530519,y:.774004},{x:.071534,y:.774004},{x:.06275493550927423,y:.7731393376181454},{x:.054313245543570934,y:.7705785789630079},{x:.046533339514117915,y:.7664201325536145},{x:.039714194846605363,y:.7608238051533946},{x:.03411786744638546,y:.7540046604858821},{x:.029959421036992097,y:.746224754456429},{x:.027398662381854635,y:.7377830644907257},{x:.026534000000000002,y:.729004}]],8:[[{x:.018998734783549534,y:.19034712298183487},{x:.01918983868826437,y:.187136446932327},{x:.01920952916989005,y:.18392014879903562},{x:.019451409422642358,y:.18274188004279768},{x:.019522877627479743,y:.18154116541629586},{x:.0203366813486396,y:.1784294641291047},{x:.020983462121705806,y:.17527880768498513},{x:.021450563544301488,y:.17417036752890672},{x:.021754906310756543,y:.17300666705236456},{x:.02316013582774355,y:.17011352146289485},{x:.024409151469860245,y:.16714958466818597},{x:.06244715146986025,y:.097021584668186},{x:.06364531823888224,y:.0952519506947441},{x:.06465809579443724,y:.09337006609963419},{x:.0661122558858275,y:.09160840391706095},{x:.06739294989385258,y:.08971688123025286},{x:.06891333268610705,y:.08821500101819715},{x:.07027378747657535,y:.08656685940733966},{x:.07204368953204261,y:.0851227396301211},{x:.07366879313388441,y:.08351741302778071},{x:.0754529644913056,y:.08234100299139627},{x:.07710881500204132,y:.08098994152260804},{x:.14910981500204132,y:.03317594152260801},{x:.1504928100364302,y:.03244176283843531},{x:.15177178054792087,y:.031538475488709236},{x:.15438005907773164,y:.030378172358910993},{x:.15690151209615905,y:.029039630272177964},{x:.1584011644246711,y:.028589367572161194},{x:.15983178249634203,y:.027952951404511282},{x:.24949378249634205,y:-.0017990485954887184},{x:.251605077566582,y:-.002276091838878668},{x:.25365804064979064,y:-.002962007073194259},{x:.2558970148670134,y:-.0032458471890824472},{x:.2580984148155577,y:-.003743249464233246},{x:.2602622084630055,y:-.003799233220341744},{x:.26240953986016613,y:-.0040714555567724145},{x:.33848653986016614,y:-.006196455556772458},{x:.34211630259529946,y:-.0059410451417675775},{x:.3457527120689106,y:-.005810898556388326},{x:.34651004211407876,y:-.005631877045722989},{x:.3472863241290845,y:-.005577253499755554},{x:.35079651389094996,y:-.004618619143417753},{x:.3543376604369356,y:-.0037815449929937683},{x:.4535096604369356,y:.03022045500700621},{x:.45591274590665615,y:.03131812424947078},{x:.4583949217344816,y:.03222283453480715},{x:.45991547545056405,y:.03314647083206772},{x:.461533744189149,y:.033885655452327273},{x:.46367651039942226,y:.035431052006208004},{x:.4659344916938285,y:.03680262701864639},{x:.5338604916938285,y:.08780462701864639},{x:.5368034713408607,y:.09050382186837246},{x:.5397962541268131,y:.09314768896709699},{x:.5400513850489728,y:.09348269124727963},{x:.5403617177400871,y:.09376731720532937},{x:.5427215620660051,y:.09698879462990716},{x:.5451410464862535,y:.10016572352111452},{x:.5453259194365666,y:.1005440624001799},{x:.5455747614022292,y:.10088376225489704},{x:.547260782913003,y:.10450372268352329},{x:.5490139895381407,y:.10809162577156875},{x:.5802599895381407,y:.1920326257715688},{x:.5808621946470703,y:.19431314395649216},{x:.5816704362178704,y:.19652903198349428},{x:.5819856183913868,y:.19856748893015458},{x:.5825122482529622,y:.20056180773987195},{x:.5826579751325236,y:.20291599079595712},{x:.5830183882594349,y:.20524698126417715},{x:.5829298310737253,y:.20730775882392333},{x:.5830572695913885,y:.20936649774620245},{x:.5827409180393249,y:.21170387573884492},{x:.582639652248002,y:.21406038999182395},{x:.570412652248002,y:.30012638999182395},{x:.5703409363500996,y:.30042034316527866},{x:.5703238989157716,y:.30072243812390526},{x:.5692961437829783,y:.3047027979582916},{x:.5683217827960937,y:.30869656381164773},{x:.5681940974797931,y:.30897087767968473},{x:.5681184516122305,y:.3092638441298401},{x:.5663339148242972,y:.3129672173863048},{x:.5645991308441736,y:.31669415574996157},{x:.5644203829845738,y:.31693828858446854},{x:.5642890357120441,y:.31721086798977133},{x:.5618162960169492,y:.32049493611094637},{x:.5593877558190667,y:.3238118228336772},{x:.5591648145961691,y:.32401639274673566},{x:.5589828135206953,y:.3242581100335041},{x:.5032838135206953,y:.3848241100335041},{x:.5011622073766187,y:.38671918495638496},{x:.4991781602202921,y:.38875783119234486},{x:.4978799327840818,y:.3896509997457094},{x:.496704700181234,y:.39070074870143656},{x:.4942541493273608,y:.39214550546522026},{x:.4919105049301597,y:.39375791128677606},{x:.42072451102124153,y:.4330589294870645},{x:.4777200661568854,y:.4633968522602595},{x:.4805213378044988,y:.46526159042857346},{x:.48340658539474834,y:.46699355971902134},{x:.4841865730327025,y:.4677014480666941},{x:.48506339053858555,y:.46828512408085676},{x:.487447044167244,y:.4706605328159332},{x:.4899389620874836,y:.4729221066835925},{x:.4905658603159866,y:.4737685611946159},{x:.49131196047780046,y:.47451208064740324},{x:.493186393615322,y:.4773068743236967},{x:.4951892188573616,y:.48001114175313947},{x:.5250762188573616,y:.5299501417531395},{x:.5263287500632193,y:.5326029758232522},{x:.5277533683388757,y:.5351675080991},{x:.5282078804872482,y:.5365829335183069},{x:.5288425912810938,y:.5379272372855163},{x:.5295535131980511,y:.5407734546091212},{x:.5304504424054924,y:.5435666393545394},{x:.5306200854295579,y:.5450435386925929},{x:.5309803397786421,y:.5464858379730204},{x:.5311223320761199,y:.5494160600145488},{x:.5314571037289079,y:.5523305567062068},{x:.5328161037289079,y:.6362725567062067},{x:.5325682225912138,y:.6392892202473488},{x:.5325070847315841,y:.6423154334158161},{x:.5322077563487247,y:.6436760218476847},{x:.5320936668790056,y:.6450644677251389},{x:.5312620268462096,y:.647974807711247},{x:.530611678831884,y:.6509309456375182},{x:.530052664324664,y:.6522069946735811},{x:.5296698946987799,y:.6535465042014387},{x:.5282864552309536,y:.656238677898982},{x:.5270718895714029,y:.659011137860374},{x:.493108889571403,y:.7195761378603741},{x:.49086599866607616,y:.7227903647520136},{x:.4886941713149356,y:.7260530293196586},{x:.4883443495413535,y:.7264040725827037},{x:.48806074906628455,y:.7268104928286833},{x:.4852338901214668,y:.7295253929429124},{x:.4824672795427586,y:.7323016638284542},{x:.4820556943532359,y:.7325777150511769},{x:.48169825452511067,y:.7329209983380867},{x:.4783960621447291,y:.7350322395860499},{x:.4751409876314614,y:.737215426256307},{x:.4058559876314614,y:.774404426256307},{x:.40535390944732597,y:.7746134197603937},{x:.4048950878292554,y:.7749053846735706},{x:.40128606998249994,y:.7763066859700772},{x:.39771184087056327,y:.7777944834687843},{x:.3971786373679402,y:.7779015106266721},{x:.3966716723496766,y:.778098353858693},{x:.39285862044769176,y:.7787686450898307},{x:.3890628142527955,y:.7795305574683767},{x:.38851897614326597,y:.7795315052864096},{x:.3879833501061526,y:.7796256622622586},{x:.29017035010615255,y:.7870576622622585},{x:.28883979914978264,y:.7870279344512828},{x:.28751770557027906,y:.7871806372910648},{x:.2844390802539456,y:.7869296114679608},{x:.28135100845003463,y:.7868606162788429},{x:.2800518232654171,y:.7865718820648824},{x:.2787253424971381,y:.7864637231002555},{x:.20264834249713812,y:.7726567231002556},{x:.20090732012312768,y:.7721604024311715},{x:.19912055356042774,y:.7718689262507037},{x:.1966754417776232,y:.7709540028332816},{x:.19416478523538352,y:.7702382792713757},{x:.19255404347725652,y:.7694118386491953},{x:.19085847331495095,y:.7687773822377194},{x:.12157447331495094,y:.7347753822377193},{x:.11864840230662128,y:.7329636093328938},{x:.1156466869822177,y:.7312801255296781},{x:.11490452792065226,y:.7306454666247165},{x:.11407427694169714,y:.7301313894804525},{x:.11155788892673538,y:.7277835811487093},{x:.10894228211787771,y:.7255468394054793},{x:.1083381992447159,y:.7247795872431081},{x:.10762419278113186,y:.7241134140161837},{x:.10561419113974596,y:.7213197952150451},{x:.1034852091492498,y:.7186157522626143},{x:.05457920914924981,y:.6421127522626143},{x:.05400544809690788,y:.6409849569633866},{x:.05327967340990527,y:.639948436299892},{x:.05200937551205521,y:.6370614399018406},{x:.05057918033015655,y:.6342502218929852},{x:.050236465883645505,y:.633032161635733},{x:.04972685190376166,y:.6318739658087451},{x:.04904418748077848,y:.6287946194110116},{x:.04818991452487371,y:.6257584009293389},{x:.04809141700817653,y:.6244968850866522},{x:.047817547914863534,y:.6232615229122788},{x:.04774875137767971,y:.6201081640700103},{x:.04750322987838258,y:.6169636252890404},{x:.04765273449582791,y:.6157071332072875},{x:.04762513492475421,y:.6144420789610904},{x:.04817285008571219,y:.6113358894861711},{x:.048545515296550656,y:.608203873267779},{x:.04893727666953319,y:.607000691233013},{x:.04915700725673716,y:.6057545602402229},{x:.06817600725673716,y:.537751560240223},{x:.0695259178796919,y:.5342803033966695},{x:.07076883034011841,y:.5307693133112962},{x:.07112252784165454,y:.530174666206544},{x:.07137329591617819,y:.5295298232221028},{x:.07337447700044117,y:.5263886201035727},{x:.07527846743280868,y:.5231875729003385},{x:.0757413786311829,y:.522673354732434},{x:.07611313089295507,y:.5220898246495332},{x:.07868867817173447,y:.5193993899302627},{x:.08118057729149615,y:.5166313000580217},{x:.13823757729149616,y:.46456630005802163},{x:.1415344063491032,y:.46210392848613274},{x:.14479841194755694,y:.45959821041612353},{x:.17870395742216458,y:.4385038845164132},{x:.16590813892329467,y:.43401753680148847},{x:.1630836262780146,y:.43270367241359486},{x:.16018787852971583,y:.4315553012665589},{x:.15909238677042803,y:.43084708753997614},{x:.15790960896480868,y:.43029690071741367},{x:.15539569076452509,y:.4284572467838155},{x:.15277962009410193,y:.4267660089056696},{x:.07398562009410191,y:.3640750089056696},{x:.07334669706368892,y:.36345515994886657},{x:.07261876409580822,y:.3629427646304707},{x:.07018582297292754,y:.3603886489381779},{x:.067654053855944,y:.3579324619307791},{x:.06714833408498834,y:.3571998754981266},{x:.06653435151263618,y:.35655531303498644},{x:.06464644192410274,y:.3535756306924294},{x:.06264249835499126,y:.3506727149773525},{x:.06228941637067996,y:.3498555439546183},{x:.061812979199786275,y:.3491035845207174},{x:.026491979199786284,y:.27897658452071744},{x:.026206182636496978,y:.2782362375154344},{x:.02580526951533789,y:.27755135647970497},{x:.024619992088609113,y:.2741272608068926},{x:.023315086847465263,y:.27074694483548933},{x:.02317921632066564,y:.26996506724675395},{x:.022919620294515476,y:.2692151317381758},{x:.022425125568608657,y:.2656255929487299},{x:.02180476064715109,y:.2620556544171705},{x:.02182403758498896,y:.26126229336223583},{x:.021715734783549545,y:.26047612298183487},{x:.018998734783549534,y:.19034712298183487}],[{x:.10940940002433477,y:.19920410482166873},{x:.1112697837122767,y:.2472228194523932},{x:.137749803196691,y:.2997967648781603},{x:.20286290613296581,y:.3516028102138205},{x:.27392321813344717,y:.3765172983642545},{x:.30180455045059645,y:.38547932587505673},{x:.3589974388819276,y:.364332623176267},{x:.44199758150171664,y:.31850914110336725},{x:.48327372240847105,y:.27362627516037924},{x:.4919267227459848,y:.21271770175329152},{x:.46927072007314496,y:.15185335046477932},{x:.41758736799183827,y:.11304708595854013},{x:.33285528741119674,y:.08399594043457195},{x:.2715476841223936,y:.0857083982994813},{x:.19388634557978268,y:.1114782912788902},{x:.13622191473335832,y:.14977174687660325},{x:.10940940002433477,y:.19920410482166873}],[{x:.1412545940070051,y:.610603192179028},{x:.17253143522148345,y:.6595291354872365},{x:.22488466829434647,y:.6852221473073319},{x:.28911227954018853,y:.6968786351876549},{x:.37167628924266627,y:.6906052797020977},{x:.4210229734590171,y:.664118250196117},{x:.4426312796779887,y:.6255849325813003},{x:.4416638895166663,y:.5658316839266069},{x:.4243877259953326,y:.5369644730960824},{x:.3411654121752423,y:.49266641996418925},{x:.3038587353431559,y:.48067475972705925},{x:.2482367446999157,y:.5012406330709052},{x:.1958501022844071,y:.5338329684082593},{x:.1513751879049268,y:.5744167077770947},{x:.1412545940070051,y:.610603192179028}]],9:[[{x:.04617702144416433,y:.5785043710151274},{x:.046308257010348054,y:.5777836867379841},{x:.04632014162646953,y:.5770512474182771},{x:.047097404355444614,y:.5734500590446777},{x:.04775742235616295,y:.5698255492446179},{x:.06775742235616294,y:.499825549244618},{x:.06870401207934061,y:.497431122678351},{x:.06945142103699212,y:.4949672455435709},{x:.07032179921115676,y:.4933388825112154},{x:.07100061044171635,y:.4916218095236955},{x:.07239614115864691,y:.4894580616864063},{x:.07360986744638548,y:.48718733951411786},{x:.07478119941633177,y:.4857600673791044},{x:.07578195180149752,y:.48420841696912487},{x:.07757279404935197,y:.4823584994767568},{x:.07920619484660538,y:.4803681948466053},{x:.1292061948466054,y:.43036819484660543},{x:.1324047212320044,y:.4277432320802026},{x:.1355710052680468,y:.42507946670648067},{x:.13581237417673697,y:.4249466435819557},{x:.13602533951411794,y:.4247718674463855},{x:.13967451194327588,y:.422821344145996},{x:.14329963156393744,y:.42082647364918746},{x:.21329963156393744,y:.39082647364918743},{x:.21510775104315333,y:.39025382151681987},{x:.2168404136401385,y:.3894823898342746},{x:.21930272871556003,y:.3889252240779052},{x:.22170947225776405,y:.3881629808537447},{x:.22359456811709633,y:.38795407868297094},{x:.22544443694348562,y:.38753549554788497},{x:.30544443694348566,y:.37753549554788496},{x:.30933066171136914,y:.37743373006124875},{x:.3132134481214367,y:.3772411973248817},{x:.31373545479679327,y:.3773183852372503},{x:.314262956584918,y:.37730457196617717},{x:.3180943620951528,y:.37796292671622445},{x:.321940103126635,y:.37853158749346005},{x:.39912055139763536,y:.39782669956121014},{x:.3920145202755848,y:.3793136184800785},{x:.3919728818872528,y:.3791621799808353},{x:.39190347676812315,y:.3790212888743934},{x:.33928123709710245,y:.23902627390054626},{x:.29593066247424293,y:.13853176000209894},{x:.2601678276974797,y:.06104561798577861},{x:.25727396725620644,y:.05271224015242973},{x:.25606147289685455,y:.04397442167208486},{x:.2565769400976792,y:.035167952008718584},{x:.2588005597432301,y:.02663125885276897},{x:.2626468793775489,y:.018692402534786497},{x:.2679680870941297,y:.011656468850909336},{x:.274559691864592,y:.005793844786811796},{x:.2821683820142214,y:.0013298276974796769},{x:.29050175984757026,y:-.0015640327437935753},{x:.29923957832791515,y:-.002776527103145486},{x:.30804604799128144,y:-.002261059902320825},{x:.31658274114723106,y:-3744025676995222e-20},{x:.32452159746521353,y:.003808879377548882},{x:.3315575311490907,y:.009130087094129706},{x:.33742015521318824,y:.015721691864591977},{x:.34188417230252033,y:.023330382014221395},{x:.3778841723025203,y:.10133038201422136},{x:.3780704961344211,y:.10186693411204945},{x:.37834550457920557,y:.10236389998544072},{x:.42234550457920556,y:.2043638999854408},{x:.4226728981736059,y:.20538920106595157},{x:.42314852323187685,y:.20635471112560658},{x:.47609350933819694,y:.3472083534084579},{x:.5496013805841499,y:.5387157021808093},{x:.5512752235949963,y:.542063388202502},{x:.5520259437659378,y:.5440252139743784},{x:.5529745491659372,y:.5458993775022888},{x:.553598518494472,y:.5481347580495968},{x:.5544279630456541,y:.5503023109672317},{x:.5547815251174404,y:.5523728990468965},{x:.5553462721645,y:.554396114781092},{x:.555522150986547,y:.5567102734952235},{x:.5559127893965689,y:.5589979940959194},{x:.5558556061770612,y:.5610977729446709},{x:.5560147919588762,y:.5631922898391183},{x:.5557358213499382,y:.5654962948984841},{x:.5556726416037749,y:.5678162673625252},{x:.5552069106120301,y:.5698645436567753},{x:.5549544177082778,y:.5719498706018395},{x:.5349544177082779,y:.6619498706018395},{x:.5345092452033302,y:.663307558548854},{x:.5342480120020212,y:.6647122835522489},{x:.5331378863550271,y:.6674899313564284},{x:.5322058990004909,y:.6703323081518522},{x:.5315044085816177,y:.6715770596583215},{x:.5309741466497647,y:.6729038291953012},{x:.5293434595512297,y:.6754115305058349},{x:.5278748598680685,y:.6780174701150343},{x:.5269440094186665,y:.6791014500786302},{x:.5261650964249364,y:.6802992771399491},{x:.4861650964249363,y:.7302992771399491},{x:.4855393928217795,y:.7309407996522789},{x:.48502142797480674,y:.7316720783612058},{x:.48246447922773295,y:.7340934525762789},{x:.48000567043073006,y:.7366144244690945},{x:.4792668347133476,y:.7371215515888083},{x:.4786161570168623,y:.7377377290536072},{x:.47563595264764597,y:.7396137412876539},{x:.4727325719538572,y:.7416065836124539},{x:.4719089971645242,y:.7419598267287414},{x:.4711506117974981,y:.7424372235949962},{x:.4111506117974981,y:.7724372235949962},{x:.40814803697660645,y:.7735862009991664},{x:.4052110607504687,y:.7748937847545917},{x:.4040364518244048,y:.77515955677446},{x:.40291168903276836,y:.7755899630456542},{x:.39974265347336024,y:.7761310898824948},{x:.39660701348596056,y:.7768405731449995},{x:.3166070134859606,y:.7868395731449994},{x:.31542693671630134,y:.7868704603456931},{x:.31426350899694466,y:.7870703881908964},{x:.3110259999999998,y:.7869856499834279},{x:.3077884910030554,y:.7870703881908964},{x:.3066250632836987,y:.7868704603456931},{x:.30544498651403945,y:.7868395731449994},{x:.22544498651403946,y:.7768405731449995},{x:.22359484289355938,y:.7764219517671516},{x:.22170947225776405,y:.7762130191462554},{x:.21930299190993624,y:.775450859278766},{x:.2168409392495313,y:.7748937847545917},{x:.21510801459933976,y:.7741222619544408},{x:.21329963156393744,y:.7735495263508126},{x:.14329963156393744,y:.7435495263508126},{x:.1396745119432796,y:.741554655854006},{x:.13602533951411788,y:.7396041325536146},{x:.13581237417673678,y:.7394293564180442},{x:.1355710052680468,y:.7392965332935194},{x:.13240472123200803,y:.7366327679198006},{x:.12920619484660534,y:.7340078051533947},{x:.07920619484660535,y:.6840078051533947},{x:.07757279404935197,y:.6820175005232432},{x:.0757819518014975,y:.6801675830308751},{x:.07478119941633177,y:.6786159326208956},{x:.07360986744638545,y:.6771886604858821},{x:.07239614115864686,y:.6749179383135936},{x:.07100061044171635,y:.6727541904763045},{x:.07032179921115676,y:.6710371174887846},{x:.06945142103699209,y:.669408754456429},{x:.06870401207934061,y:.666944877321649},{x:.06775742235616294,y:.664550450755382},{x:.04775742235616295,y:.5945504507553819},{x:.0470974043554446,y:.590925940955322},{x:.04632014162646953,y:.5873247525817227},{x:.046308257010348054,y:.5865923132620157},{x:.04617702144416433,y:.5858716289848723},{x:.0462367922883029,y:.5821879999999999},{x:.04617702144416433,y:.5785043710151274}],[{x:.13782670643108905,y:.5821879999999999},{x:.15109114488080894,y:.6286135345740196},{x:.18671787059591238,y:.6642402602891231},{x:.24291204200407931,y:.688323476606909},{x:.311026,y:.696836869931924},{x:.377796042530131,y:.6884914492411893},{x:.4220611757635009,y:.6663588826245044},{x:.4493630453483168,y:.6322315456434845},{x:.46363172164975686,y:.5680225022870041},{x:.4540425513192988,y:.5488441616260881},{x:.42235697647551157,y:.5171585867823008},{x:.37255000597497323,y:.48395393978194207},{x:.30826669745594837,y:.4678831126521858},{x:.24291230161158606,y:.4760524121327311},{x:.1867178705959123,y:.500135739710877},{x:.15109114488080894,y:.5357624654259804},{x:.13782670643108905,y:.5821879999999999}]],"!":[[{x:.20646600000000004,y:.05103000000000002},{x:.20733066238185466,y:.04225093550927423},{x:.20989142103699213,y:.03380924554357098},{x:.2140498674463855,y:.026029339514117927},{x:.21964619484660539,y:.019210194846605383},{x:.22646533951411793,y:.013613867446385479},{x:.23424524554357098,y:.009455421036992116},{x:.24268693550927425,y:.006894662381854655},{x:.251466,y:.0060300000000000215},{x:.350587,y:.0060300000000000215},{x:.3593660644907258,y:.006894662381854655},{x:.36780775445642905,y:.009455421036992116},{x:.3755876604858821,y:.013613867446385479},{x:.38240680515339465,y:.019210194846605383},{x:.3880031325536145,y:.026029339514117927},{x:.3921615789630079,y:.03380924554357098},{x:.39472233761814535,y:.04225093550927425},{x:.39558699999999997,y:.05103000000000002},{x:.39472233761814535,y:.05980906449072579},{x:.3921615789630079,y:.06825075445642906},{x:.3880031325536145,y:.07603066048588211},{x:.38240680515339465,y:.08284980515339466},{x:.3755876604858821,y:.08844613255361455},{x:.36780775445642905,y:.09260457896300792},{x:.3593660644907258,y:.09516533761814538},{x:.350587,y:.09603000000000002},{x:.251466,y:.09603000000000002},{x:.24268693550927425,y:.09516533761814538},{x:.23424524554357098,y:.09260457896300792},{x:.22646533951411793,y:.08844613255361455},{x:.21964619484660539,y:.08284980515339466},{x:.2140498674463855,y:.07603066048588211},{x:.20989142103699213,y:.06825075445642906},{x:.20733066238185466,y:.05980906449072579},{x:.20646600000000004,y:.05103000000000002}],[{x:.25602600000000003,y:.25043400000000005},{x:.25689066238185465,y:.24165493550927428},{x:.2594514210369921,y:.233213245543571},{x:.2636098674463855,y:.22543333951411795},{x:.26920619484660535,y:.2186141948466054},{x:.27602533951411795,y:.2130178674463855},{x:.283805245543571,y:.20885942103699215},{x:.2922469355092743,y:.20629866238185468},{x:.301026,y:.20543400000000006},{x:.3098050644907258,y:.20629866238185468},{x:.3182467544564291,y:.20885942103699215},{x:.32602666048588214,y:.2130178674463855},{x:.3328458051533947,y:.2186141948466054},{x:.33844213255361455,y:.22543333951411795},{x:.34260057896300794,y:.233213245543571},{x:.3451613376181454,y:.24165493550927428},{x:.346026,y:.25043400000000005},{x:.346026,y:.729004},{x:.3451613376181454,y:.7377830644907257},{x:.34260057896300794,y:.746224754456429},{x:.33844213255361455,y:.7540046604858821},{x:.3328458051533947,y:.7608238051533946},{x:.32602666048588214,y:.7664201325536145},{x:.3182467544564291,y:.7705785789630079},{x:.3098050644907258,y:.7731393376181454},{x:.301026,y:.774004},{x:.2922469355092743,y:.7731393376181454},{x:.283805245543571,y:.7705785789630079},{x:.27602533951411795,y:.7664201325536145},{x:.26920619484660535,y:.7608238051533946},{x:.2636098674463855,y:.7540046604858821},{x:.2594514210369921,y:.746224754456429},{x:.25689066238185465,y:.7377830644907257},{x:.25602600000000003,y:.729004},{x:.25602600000000003,y:.25043400000000005}]],\'"\':[[{x:.12004,y:.476978},{x:.12090466238185463,y:.4681989355092742},{x:.1234654210369921,y:.459757245543571},{x:.12762386744638546,y:.4519773395141179},{x:.13322019484660536,y:.44515819484660535},{x:.1400393395141179,y:.4395618674463855},{x:.14781924554357095,y:.4354034210369921},{x:.15626093550927422,y:.43284266238185465},{x:.16504,y:.43197800000000003},{x:.17381906449072576,y:.43284266238185465},{x:.18226075445642903,y:.4354034210369921},{x:.19004066048588208,y:.4395618674463855},{x:.19685980515339463,y:.44515819484660535},{x:.20245613255361453,y:.4519773395141179},{x:.2066145789630079,y:.459757245543571},{x:.20917533761814536,y:.4681989355092742},{x:.21004,y:.476978},{x:.21004,y:.729004},{x:.20917533761814536,y:.7377830644907257},{x:.2066145789630079,y:.746224754456429},{x:.20245613255361453,y:.7540046604858821},{x:.19685980515339463,y:.7608238051533946},{x:.19004066048588208,y:.7664201325536145},{x:.18226075445642903,y:.7705785789630079},{x:.17381906449072576,y:.7731393376181454},{x:.16504,y:.774004},{x:.15626093550927422,y:.7731393376181454},{x:.14781924554357095,y:.7705785789630079},{x:.1400393395141179,y:.7664201325536145},{x:.13322019484660536,y:.7608238051533946},{x:.12762386744638546,y:.7540046604858821},{x:.1234654210369921,y:.746224754456429},{x:.12090466238185463,y:.7377830644907257},{x:.12004,y:.729004},{x:.12004,y:.476978}],[{x:.392013,y:.476978},{x:.3928776623818546,y:.4681989355092742},{x:.39543842103699206,y:.459757245543571},{x:.39959686744638545,y:.4519773395141179},{x:.4051931948466053,y:.44515819484660535},{x:.4120123395141179,y:.4395618674463855},{x:.419792245543571,y:.4354034210369921},{x:.42823393550927424,y:.43284266238185465},{x:.437013,y:.43197800000000003},{x:.4457920644907258,y:.43284266238185465},{x:.45423375445642905,y:.4354034210369921},{x:.4620136604858821,y:.4395618674463855},{x:.46883280515339465,y:.44515819484660535},{x:.4744291325536145,y:.4519773395141179},{x:.4785875789630079,y:.459757245543571},{x:.48114833761814535,y:.4681989355092742},{x:.48201299999999997,y:.476978},{x:.48201299999999997,y:.729004},{x:.48114833761814535,y:.7377830644907257},{x:.4785875789630079,y:.746224754456429},{x:.4744291325536145,y:.7540046604858821},{x:.46883280515339465,y:.7608238051533946},{x:.4620136604858821,y:.7664201325536145},{x:.45423375445642905,y:.7705785789630079},{x:.4457920644907258,y:.7731393376181454},{x:.437013,y:.774004},{x:.42823393550927424,y:.7731393376181454},{x:.419792245543571,y:.7705785789630079},{x:.4120123395141179,y:.7664201325536145},{x:.4051931948466053,y:.7608238051533946},{x:.39959686744638545,y:.7540046604858821},{x:.39543842103699206,y:.746224754456429},{x:.3928776623818546,y:.7377830644907257},{x:.392013,y:.729004},{x:.392013,y:.476978}]],"#":[[{x:-.04343582416242281,y:.17932596542766122},{x:-.043155600373289436,y:.1705088746946064},{x:-.04116063193533153,y:.16191587083690517},{x:-.037527584366828626,y:.15387717817379684},{x:-.03239607364840174,y:.1467017191561739},{x:-.025963300859175642,y:.14066524265003977},{x:-.01847647384989975,y:.13599972706223024},{x:-.010223307183879607,y:.1328844655403335},{x:-.0015209654276611437,y:.13143917583757725},{x:.007296125305393629,y:.13171939962671061},{x:.11028337660265361,y:.14517801654688708},{x:.10171449233133083,y:.05447855391336175},{x:.10174959121806887,y:.04565708110917159},{x:.10350499965956604,y:.03701195788446062},{x:.10691325829386003,y:.02887541147651351},{x:.11184338965300836,y:.02156012480075985},{x:.11810593155372849,y:.015347220221688843},{x:.1254602180228497,y:.01047545617803717},{x:.13362362795569505,y:.007132051829885598},{x:.14228244608663826,y:.005445492331330834},{x:.15110391889082841,y:.0054805912180688685},{x:.1597490421155394,y:.0072359996595660475},{x:.1678855885234865,y:.010644258293860037},{x:.17520087519924016,y:.015574389653008364},{x:.18141377977831116,y:.02183693155372849},{x:.18628554382196283,y:.029191218022849703},{x:.18962894817011441,y:.03735462795569504},{x:.19131550766866917,y:.04601344608663827},{x:.2018142041879224,y:.1571394809935999},{x:.36570083500909,y:.17855657247605955},{x:.35397849233133083,y:.05447855391336175},{x:.35401359121806886,y:.04565708110917159},{x:.35576899965956604,y:.03701195788446062},{x:.35917725829386,y:.02887541147651351},{x:.3641073896530084,y:.02156012480075985},{x:.3703699315537285,y:.015347220221688843},{x:.37772421802284967,y:.01047545617803717},{x:.38588762795569503,y:.007132051829885598},{x:.39454644608663825,y:.005445492331330834},{x:.4033679188908284,y:.0054805912180688685},{x:.4120130421155394,y:.0072359996595660475},{x:.4201495885234865,y:.010644258293860037},{x:.42746487519924015,y:.015574389653008364},{x:.4336777797783111,y:.02183693155372849},{x:.4385495438219628,y:.029191218022849703},{x:.44189294817011443,y:.03735462795569504},{x:.44357950766866916,y:.04601344608663827},{x:.45723166259435877,y:.19051803692277236},{x:.5748861253053936,y:.20589339962671058},{x:.5834791291630949,y:.20788836806466848},{x:.5915178218262032,y:.2115214156331714},{x:.5986932808438261,y:.21665292635159827},{x:.6047297573499603,y:.22308569914082438},{x:.6093952729377698,y:.23057252615010027},{x:.6125105344596665,y:.2388256928161204},{x:.6139558241624228,y:.24752803457233888},{x:.6136756003732894,y:.25634512530539366},{x:.6116806319353315,y:.2649381291630949},{x:.6080475843668286,y:.2729768218262032},{x:.6029160736484017,y:.2801522808438262},{x:.5964833008591757,y:.2861887573499603},{x:.5889964738498997,y:.29085427293776983},{x:.5807433071838796,y:.29396953445966656},{x:.5720409654276611,y:.2954148241624228},{x:.5632238746946063,y:.2951346003732895},{x:.4659139564059225,y:.28241791072205386},{x:.48521785958998953,y:.48674482074743597},{x:.6064180682130128,y:.5025833921657807},{x:.6150110746232834,y:.5045783496089273},{x:.6230497719348954,y:.5082113868918628},{x:.6302252375183169,y:.5133428884292346},{x:.6362617222552247,y:.5197756534947408},{x:.640927247422479,y:.5272624745344501},{x:.6440425195043586,y:.5355156372144642},{x:.645487820341822,y:.544217977121417},{x:.6452076078342193,y:.5530350682130128},{x:.6432126503910727,y:.5616280746232835},{x:.6395796131081373,y:.5696667719348955},{x:.6344481115707654,y:.576842237518317},{x:.6280153465052593,y:.5828787222552247},{x:.6205285254655499,y:.587544247422479},{x:.6122753627855358,y:.5906595195043587},{x:.603573022878583,y:.592104820341822},{x:.5947559317869872,y:.5918246078342193},{x:.493900150869001,y:.5786446677402959},{x:.5066445076686692,y:.7135404460866382},{x:.5066094087819312,y:.7223619188908285},{x:.5048540003404339,y:.7310070421155394},{x:.50144574170614,y:.7391435885234865},{x:.4965156103469916,y:.7464588751992401},{x:.4902530684462715,y:.7526717797783111},{x:.4828987819771503,y:.7575435438219629},{x:.47473537204430494,y:.7608869481701144},{x:.4660765539133617,y:.7625735076686692},{x:.45725508110917157,y:.7625384087819311},{x:.44860995788446056,y:.760783000340434},{x:.4404734114765135,y:.7573747417061399},{x:.43315812480075977,y:.7524446103469916},{x:.4269452202216888,y:.7461820684462716},{x:.42207345617803715,y:.7388277819771503},{x:.41873005182988554,y:.730664372044305},{x:.4170434923313308,y:.7220055539133617},{x:.40236933467780645,y:.5666833238969633},{x:.23848272425781383,y:.5452664483557571},{x:.25438050766866915,y:.7135404460866382},{x:.2543454087819311,y:.7223619188908285},{x:.25259000034043394,y:.7310070421155394},{x:.24918174170614,y:.7391435885234865},{x:.2442516103469916,y:.7464588751992401},{x:.23798906844627152,y:.7526717797783111},{x:.2306347819771503,y:.7575435438219629},{x:.22247137204430495,y:.7608869481701144},{x:.21381255391336174,y:.7625735076686692},{x:.20499108110917158,y:.7625384087819311},{x:.1963459578844606,y:.760783000340434},{x:.18820941147651346,y:.7573747417061399},{x:.1808941248007598,y:.7524446103469916},{x:.17468122022168883,y:.7461820684462716},{x:.16980945617803714,y:.7388277819771503},{x:.16646605182988555,y:.730664372044305},{x:.16477949233133082,y:.7220055539133617},{x:.14695190806661926,y:.5333051045124245},{x:.02716793178698713,y:.5176516078342193},{x:.01857492537671658,y:.5156566503910727},{x:.01053622806510461,y:.5120236131081373},{x:.0033607624816830023,y:.5068921115707654},{x:-.0026757222552247634,y:.5004593465052593},{x:-.0073412474224789775,y:.4929725254655499},{x:-.010456519504358698,y:.48471936278553585},{x:-.011901820341822023,y:.476017022878583},{x:-.011621607834219276,y:.4671999317869871},{x:-.00962665039107264,y:.45860692537671655},{x:-.005993613108137223,y:.45056822806510455},{x:-.0008621115707654614,y:.44339276248168297},{x:.005570653494740684,y:.4373562777447752},{x:.013057474534450029,y:.432690752577521},{x:.02131063721446411,y:.42957548049564126},{x:.03001297712141698,y:.42813017965817796},{x:.03883006821301287,y:.4284103921657807},{x:.13826961678760774,y:.4414052575195645},{x:.1189656704142173,y:.23707789034616855},{x:-.004366125305393629,y:.2209606003732895},{x:-.012959129163094893,y:.21896563193533158},{x:-.0209978218262032,y:.2153325843668287},{x:-.028173280843826164,y:.2102010736484018},{x:-.034209757349960276,y:.2037683008591757},{x:-.03887527293776982,y:.1962814738498998},{x:-.041990534459666565,y:.18802830718387967},{x:-.04343582416242281,y:.17932596542766122}],[{x:.2104964979994861,y:.24903935479288136},{x:.22980043297880234,y:.4533666013628972},{x:.39368704339879496,y:.4747834769041034},{x:.3743831288206537,y:.27045644627534104},{x:.2104964979994861,y:.24903935479288136}]],$:[[{x:.030517420733400163,y:.165091535964518},{x:.03086584266660257,y:.1562768767808978},{x:.032927224468652025,y:.14769956254897784},{x:.06950822446865203,y:.04228956254897785},{x:.0704003940010533,y:.04035550336969822},{x:.07109145007989037,y:.03834080913001754},{x:.07224350295250744,y:.03635998272422403},{x:.073203348392932,y:.034279214644477654},{x:.0744556913660193,y:.03255637151138059},{x:.07552651634405921,y:.03071520740954014},{x:.07704287290513265,y:.02899719639360223},{x:.07839021289928177,y:.02714366624511229},{x:.07995460247492134,y:.0256982470536212},{x:.08136404514878363,y:.02410136799351792},{x:.08318643266605391,y:.022712194567306505},{x:.08486948969354943,y:.02115713247420773},{x:.0866858072576693,y:.0200446838732511},{x:.08837970353582197,y:.01875345702162473},{x:.17373770353582196,y:-.03394954297837521},{x:.17475219432147746,y:-.03444582628601368},{x:.17568351020275566,y:-.03508468417701866},{x:.17870701554383397,y:-.03638050305696308},{x:.18166188368778688,y:-.037826008286632525},{x:.18275370138776084,y:-.03811483831561822},{x:.18379175728720304,y:-.038559730016208084},{x:.18700996854351615,y:-.03924079346911771},{x:.19019006380536974,y:-.04008205754340442},{x:.19131725047775072,y:-.0401523347177012},{x:.19242215448928965,y:-.04038616328932037},{x:.262121,y:-.048110644533924524},{x:.262121,y:-.08350199999999997},{x:.2629856623818546,y:-.09228106449072573},{x:.26554642103699205,y:-.100722754456429},{x:.26970486744638544,y:-.10850266048588206},{x:.2753011948466053,y:-.1153218051533946},{x:.2821203395141179,y:-.1209181325536145},{x:.28990024554357097,y:-.12507657896300786},{x:.29834193550927424,y:-.12763733761814533},{x:.307121,y:-.12850199999999995},{x:.3159000644907258,y:-.12763733761814533},{x:.32434175445642904,y:-.12507657896300786},{x:.3321216604858821,y:-.1209181325536145},{x:.33894080515339464,y:-.1153218051533946},{x:.3445371325536145,y:-.10850266048588206},{x:.3486955789630079,y:-.100722754456429},{x:.35125633761814534,y:-.09228106449072573},{x:.35212099999999996,y:-.08350199999999997},{x:.35212099999999996,y:-.05796857189257534},{x:.3537665284657676,y:-.05798865052825875},{x:.3565834008023822,y:-.05822276473922817},{x:.35816715833059226,y:-.05804234673933715},{x:.35976104048452195,y:-.05806179518994546},{x:.3625398346041163,y:-.05754422155704884},{x:.36534825494544937,y:-.05722429279787242},{x:.3668663832111493,y:-.05673836571308556},{x:.3684334335709129,y:-.056446489484502926},{x:.37105786033397337,y:-.05539674504422484},{x:.37374990266128777,y:-.05453506799769968},{x:.49568890266128773,y:-.0018330679976996528},{x:.4995437197067623,y:.0003036028478311586},{x:.5033988605511543,y:.0024396894158641644},{x:.5034014762743246,y:.0024419030290919073},{x:.503404473339876,y:.00244356426035406},{x:.5067683773534712,y:.005291217073469004},{x:.510132712931077,y:.008138360005776092},{x:.5101348465393426,y:.008141041387321917},{x:.510137461926978,y:.00814325539697476},{x:.5128811799638975,y:.011592456477016289},{x:.5156254207452635,y:.015041241667436683},{x:.5156269902452553,y:.015044287773311453},{x:.5156291234470946,y:.015046969478205698},{x:.5176472159618929,y:.018965167962033513},{x:.519665902312761,y:.02288306052976895},{x:.5684429023127611,y:.1458620605297689},{x:.5688122064775901,y:.14714915498994666},{x:.5693537919217377,y:.14837377040805427},{x:.5700262192706007,y:.15138021786244946},{x:.5708758841928585,y:.15434145989163614},{x:.5709869926090132,y:.15567587086110493},{x:.5712792610244494,y:.1569826137160382},{x:.5713522390683521,y:.16006247719363653},{x:.5716078682563359,y:.16313258119086366},{x:.5714565110896938,y:.16446302800441426},{x:.5714882307651191,y:.1658016809010868},{x:.5709589549987614,y:.16883660297565092},{x:.5706107247661352,y:.1718975865660398},{x:.570202718587728,y:.17317294089875004},{x:.5699726705538047,y:.1744920601570685},{x:.5455836705538047,y:.26233106015706853},{x:.5448796820390573,y:.26415145628779163},{x:.5443792359109676,y:.2660379863232085},{x:.5432925447356423,y:.2682555269445408},{x:.5424018225194911,y:.2705587850827968},{x:.5413562192793141,y:.27220686146627543},{x:.5404973453311464,y:.27395951015977},{x:.5389989139081434,y:.2759224384285429},{x:.5376759632977357,y:.2780076688235372},{x:.5363289272782685,y:.2794200908086057},{x:.5351446315541886,y:.28097150485378414},{x:.5332920437627642,y:.28260438653745124},{x:.5315877050081386,y:.28439145495451523},{x:.529991002048182,y:.2855139439563835},{x:.528526796368706,y:.2868045033815319},{x:.4553637963687061,y:.3395095033815319},{x:.4552094954443409,y:.33959910378534747},{x:.4550747122553104,y:.3397160246969866},{x:.45139660000367776,y:.341813199213456},{x:.44773515946955245,y:.3439393468807752},{x:.44756634322254935,y:.3439971230209339},{x:.4474113397164003,y:.34408550243429054},{x:.4433947629085852,y:.34542481622689836},{x:.43938888509457313,y:.34679579895012297},{x:.43921204103863115,y:.34681953052195974},{x:.439042773913178,y:.34687597206574233},{x:.35212099999999996,y:.3666493043587998},{x:.35212099999999996,y:.6320956693586206},{x:.3838005126074005,y:.6288356018928482},{x:.4577579663937751,y:.5527249728659002},{x:.46449612147708186,y:.5470313904751531},{x:.47221556762189953,y:.5427617575185425},{x:.48061965084199804,y:.5400801535961528},{x:.48938540693229315,y:.5390896312428609},{x:.49817597280212744,y:.5398282556772123},{x:.5066535319349293,y:.5422676419764202},{x:.5144922964874953,y:.5463140458930298},{x:.5213910271340998,y:.551811966393775},{x:.5270846095248467,y:.5585501214770818},{x:.5313542424814575,y:.5662695676218995},{x:.534035846403847,y:.5746736508419981},{x:.535026368757139,y:.5834394069322931},{x:.5342877443227877,y:.5922299728021274},{x:.5318483580235798,y:.6007075319349293},{x:.5278019541069703,y:.6085462964874953},{x:.5223040336062249,y:.6154450271340998},{x:.4369490336062249,y:.7032850271340998},{x:.435089451582588,y:.7048563301588934},{x:.43337550685970433,y:.706585327551969},{x:.43172842132509603,y:.7076963215886295},{x:.4302108785229181,y:.7089786095248467},{x:.4280804818333404,y:.7101569339468108},{x:.4260621594195314,y:.7115183351118896},{x:.4242299779872524,y:.7122866512623272},{x:.42249143237810044,y:.7132482424814575},{x:.4201720909726226,y:.7139883059538676},{x:.4179269538663623,y:.7149297930076584},{x:.4159800862413552,y:.7153259053130885},{x:.41408734915800194,y:.715929846403847},{x:.4116681940261354,y:.716203208702491},{x:.4092825215873294,y:.7166886008255086},{x:.35212099999999996,y:.7225709645831306},{x:.35212099999999996,y:.7597659999999999},{x:.35125633761814534,y:.7685450644907257},{x:.3486955789630079,y:.776986754456429},{x:.3445371325536145,y:.7847666604858821},{x:.33894080515339464,y:.7915858051533946},{x:.3321216604858821,y:.7971821325536145},{x:.32434175445642904,y:.8013405789630078},{x:.3159000644907258,y:.8039013376181453},{x:.307121,y:.804766},{x:.29834193550927424,y:.8039013376181453},{x:.28990024554357097,y:.8013405789630078},{x:.2821203395141179,y:.7971821325536145},{x:.2753011948466053,y:.7915858051533946},{x:.26970486744638544,y:.7847666604858821},{x:.26554642103699205,y:.776986754456429},{x:.2629856623818546,y:.7685450644907257},{x:.262121,y:.7597659999999999},{x:.262121,y:.7318326623736131},{x:.23856652158732947,y:.7342566008255086},{x:.23743405616423266,y:.7342615520061975},{x:.23631438427367413,y:.7344313675125375},{x:.2330314335362298,y:.7342808004350606},{x:.22974506326706257,y:.734295168567351},{x:.22863339192208898,y:.7340790915684273},{x:.22750210485113245,y:.7340272069677483},{x:.2243116092711877,y:.7332390610779145},{x:.22108558260167874,y:.7326120140964958},{x:.22003742624118275,y:.7321832126358507},{x:.21893799871753236,y:.7319116218242595},{x:.21596256725097532,y:.7305161851266182},{x:.21292085857685591,y:.729271820095334},{x:.21197649726195836,y:.7286467727726252},{x:.21095117966878213,y:.7281659128327016},{x:.2083051564782311,y:.7262168111769735},{x:.20556465695803808,y:.7244029483461277},{x:.204760381964467,y:.7236056753794367},{x:.20384857668186554,y:.7229340254890024},{x:.10629557668186554,y:.6350940254890024},{x:.10393291169686979,y:.6325042238563513},{x:.10146752815288923,y:.6300120075116347},{x:.10096488682836192,y:.6292508655939548},{x:.10035013880638408,y:.6285770182897039},{x:.09853811700104832,y:.6255760458964971},{x:.09660631239978806,y:.6226507443205297},{x:.09626182060918942,y:.6218061670735107},{x:.09579034588565258,y:.6210253361666956},{x:.09459860224176168,y:.6177285186990383},{x:.0932746147506803,y:.6144825495908574},{x:.056695614750680294,y:.49150554959085735},{x:.05654965816703397,y:.490750439567249},{x:.05628361804350595,y:.49002883224693095},{x:.05571374572525952,y:.48642582571377374},{x:.055021470477783566,y:.4828443224653027},{x:.055025633066628665,y:.4820752469521588},{x:.05490548343396577,y:.4813156032607913},{x:.055049472757300266,y:.47767065091379934},{x:.05506921600663437,y:.4740229090450286},{x:.05522333780201598,y:.4732694231830167},{x:.05525369594322076,y:.472500935801646},{x:.05610601347919053,y:.46895411111540136},{x:.056837016503334954,y:.46538031130067065},{x:.05713517469108906,y:.46467137112890816},{x:.05731487395982006,y:.46392357259662753},{x:.08169987395982006,y:.39365157259662753},{x:.08192222202041206,y:.3931695328553223},{x:.08205835369770847,y:.3926564352635495},{x:.08376780756696771,y:.3891683934837906},{x:.08539480756850773,y:.3856411369034641},{x:.08570692456181836,y:.38521173737536313},{x:.08594054088151196,y:.3847350567827023},{x:.08829763126802886,y:.38164753465350854},{x:.09058150254284453,y:.37850546527353984},{x:.0909713939878581,y:.378145207541698},{x:.09129351720579659,y:.37772326251599964},{x:.09420766244788897,y:.3751549117812935},{x:.09706063710369874,y:.372518777565862},{x:.09751331969083687,y:.37224150613287915},{x:.09791157079240381,y:.3718905117848512},{x:.17107757079240382,y:.3191875117848513},{x:.17123114354048857,y:.3190983419119289},{x:.17136528774468962,y:.3189819753030134},{x:.17504412834709762,y:.3168843854977816},{x:.17870637355344754,y:.314757953928811},{x:.1788743916234626,y:.3147004579868701},{x:.17902866028359976,y:.31461249756570947},{x:.183046032465951,y:.31327291855818423},{x:.1870527548771027,y:.3119018143721617},{x:.18722876142884332,y:.31187820189800686},{x:.18739722608682208,y:.3118220279342577},{x:.262121,y:.2948235482063542},{x:.262121,y:.04244038202745839},{x:.212402420161311,y:.04795051974434915},{x:.14928483997433578,y:.08692151049617265},{x:.11795277553134796,y:.17720643745102208},{x:.114257651607068,y:.18521678535552225},{x:.10907078710071823,y:.1923523337548876},{x:.10259151030645056,y:.1983388675257922},{x:.09506881619784838,y:.20294632753270694},{x:.08679179769072982,y:.20599765167145945},{x:.07807853596451803,y:.20737557926659977},{x:.06926387678089782,y:.20702715733339738},{x:.0606865625489779,y:.20496577553134793},{x:.052676214644477706,y:.20127065160706795},{x:.04554066624511235,y:.1960837871007182},{x:.039554132474207776,y:.18960451030645054},{x:.034946672467293015,y:.18208181619784836},{x:.03189534832854049,y:.1738047976907298},{x:.030517420733400163,y:.165091535964518}],[{x:.14709211773983194,y:.4797371545422716},{x:.17592903295677773,y:.5766856037244347},{x:.24922570721126042,y:.6426843927572041},{x:.262121,y:.6413573671491031},{x:.262121,y:.3871228845247169},{x:.21626819752335621,y:.3975536737173561},{x:.16206100150816494,y:.4366002507010456},{x:.14709211773983194,y:.4797371545422716}],[{x:.35212099999999996,y:.034163101195078524},{x:.35212099999999996,y:.2743499680404371},{x:.4101709471377665,y:.26114452085874473},{x:.4630938273127818,y:.2230200535785049},{x:.47920731446793274,y:.1649859973145621},{x:.44287681685863156,y:.07338773859643172},{x:.35212099999999996,y:.034163101195078524}]],"\'":[[{x:.25602600000000003,y:.476978},{x:.25689066238185465,y:.4681989355092742},{x:.2594514210369921,y:.459757245543571},{x:.2636098674463855,y:.4519773395141179},{x:.26920619484660535,y:.44515819484660535},{x:.27602533951411795,y:.4395618674463855},{x:.283805245543571,y:.4354034210369921},{x:.2922469355092743,y:.43284266238185465},{x:.301026,y:.43197800000000003},{x:.3098050644907258,y:.43284266238185465},{x:.3182467544564291,y:.4354034210369921},{x:.32602666048588214,y:.4395618674463855},{x:.3328458051533947,y:.44515819484660535},{x:.33844213255361455,y:.4519773395141179},{x:.34260057896300794,y:.459757245543571},{x:.3451613376181454,y:.4681989355092742},{x:.346026,y:.476978},{x:.346026,y:.729004},{x:.3451613376181454,y:.7377830644907257},{x:.34260057896300794,y:.746224754456429},{x:.33844213255361455,y:.7540046604858821},{x:.3328458051533947,y:.7608238051533946},{x:.32602666048588214,y:.7664201325536145},{x:.3182467544564291,y:.7705785789630079},{x:.3098050644907258,y:.7731393376181454},{x:.301026,y:.774004},{x:.2922469355092743,y:.7731393376181454},{x:.283805245543571,y:.7705785789630079},{x:.27602533951411795,y:.7664201325536145},{x:.26920619484660535,y:.7608238051533946},{x:.2636098674463855,y:.7540046604858821},{x:.2594514210369921,y:.746224754456429},{x:.25689066238185465,y:.7377830644907257},{x:.25602600000000003,y:.729004},{x:.25602600000000003,y:.476978}]],"(":[[{x:.14398102142772873,y:.343473372436119},{x:.14438344127795402,y:.34024506484177663},{x:.14461855620935057,y:.33700027938992067},{x:.15480555620935058,y:.27783527938992064},{x:.15553530200183258,y:.27518493680242373},{x:.1560666158259812,y:.2724877993619115},{x:.1764416158259812,y:.20487079936191147},{x:.17757136816824137,y:.2021290142392397},{x:.17852197521392682,y:.19932008699588913},{x:.2090839752139268,y:.13170208699588917},{x:.21040800505224358,y:.12940389577393302},{x:.21154775445201235,y:.12700896170152925},{x:.25229575445201236,y:.05939296170152925},{x:.2531150427152032,y:.05829379345186112},{x:.2537782786760274,y:.05709399256856861},{x:.29452927867602746,y:-.0020700074314313824},{x:.29560111146026063,y:-.0033391000809501682},{x:.29650963843516415,y:-.004729783512322571},{x:.3372576384351641,y:-.05544378351232261},{x:.3386866074193021,y:-.05690267270426387},{x:.3399537097957662,y:-.05850416001284604},{x:.38070370979576623,y:-.10073716001284601},{x:.38742176905533504,y:-.10645444032360908},{x:.3951261287468799,y:-.11075123635207199},{x:.40352071464810957,y:-.11346242463653189},{x:.41228292753057777,y:-.11448381573166892},{x:.42107604046711683,y:-.11377615815049966},{x:.4295621390588101,y:-.11136664677700951},{x:.4374151072958377,y:-.10734787778201216},{x:.444333160012846,y:-.10187429020423372},{x:.4500504403236091,y:-.09515623094466494},{x:.45434723635207197,y:-.08745187125312004},{x:.4570584246365319,y:-.07905728535189037},{x:.45807981573166895,y:-.07029507246942218},{x:.4573721581504997,y:-.06150195953288313},{x:.45496264677700954,y:-.053015860941189874},{x:.45094387778201217,y:-.04516289270416226},{x:.44547029020423373,y:-.03824483998715393},{x:.4061377413616867,y:.0025191240684850026},{x:.3677075745656829,y:.050348403515145926},{x:.3286739379437331,y:.10701906379590062},{x:.2900025757951927,y:.1711891536907596},{x:.2617573982317254,y:.23368121626802973},{x:.24303344075060918,y:.2958190240226623},{x:.23462816944303005,y:.34463593546989096},{x:.24303340667749923,y:.39345182392970596},{x:.26175739639474455,y:.45558881969516635},{x:.2900026404789191,y:.5180819536434618},{x:.328674029726828,y:.5822520885061939},{x:.36770768599197223,y:.6389237351633864},{x:.4061420841180472,y:.6867582808236831},{x:.4454798975405431,y:.7275528000242046},{x:.45095135740921277,y:.7344725356602282},{x:.45496771125722263,y:.7423267393839987},{x:.45737461285859093,y:.7508135785511003},{x:.458079566334583,y:.759606908691815},{x:.4570554807184589,y:.768368807060192},{x:.4543417110461325,y:.7767625588156633},{x:.4500425459642118,y:.7844655967855365},{x:.4443231999757953,y:.791181897540543},{x:.4374034643397718,y:.7966533574092127},{x:.4295492606160011,y:.8006697112572226},{x:.42106242144889966,y:.8030766128585909},{x:.41226909130818484,y:.803781566334583},{x:.403507192939808,y:.8027574807184589},{x:.39511344118433667,y:.8000437110461325},{x:.3874104032144634,y:.7957445459642117},{x:.38069410245945684,y:.7900251999757952},{x:.33994410245945683,y:.7477661999757953},{x:.338681775527778,y:.7461697396410558},{x:.3372576384351641,y:.7447157835123226},{x:.29650963843516415,y:.6940017835123226},{x:.2956010143988682,y:.6926109515089496},{x:.29452907712829884,y:.6913417148135671},{x:.2537780771282988,y:.6321767148135672},{x:.25311493656839296,y:.6309770641401381},{x:.25229575445201236,y:.6298780382984708},{x:.21154775445201235,y:.5622620382984707},{x:.21040795156345282,y:.5598669918310725},{x:.2090838723444427,y:.5575686854051248},{x:.17852187234444272,y:.48994968540512485},{x:.17757135012625538,y:.48714095747585867},{x:.17644166886939822,y:.4843993766680373},{x:.1560666688693982,y:.4167833766680374},{x:.15553533856931018,y:.4140862136984408},{x:.15480557779123924,y:.4114358459543075},{x:.14461857779123924,y:.3522718459543075},{x:.14438345368873493,y:.3490270611669966},{x:.14398102471397584,y:.3457987547100726},{x:.14406527252602844,y:.3446360634540339},{x:.14398102142772873,y:.343473372436119}]],")":[[{x:.14397318426833106,y:-.07029507246942218},{x:.14499457536346808,y:-.07905728535189037},{x:.14770576364792798,y:-.08745187125312004},{x:.1520025596763909,y:-.09515623094466495},{x:.15771983998715397,y:-.10187429020423372},{x:.16463789270416226,y:-.10734787778201214},{x:.1724908609411899,y:-.11136664677700951},{x:.18097695953288315,y:-.11377615815049966},{x:.1897700724694222,y:-.11448381573166892},{x:.19853228535189038,y:-.11346242463653189},{x:.20692687125312006,y:-.11075123635207199},{x:.21463123094466496,y:-.10645444032360907},{x:.22134929020423375,y:-.10073716001284601},{x:.2620992902042337,y:-.05850416001284604},{x:.2633660586938147,y:-.05690309470300352},{x:.26479468609075496,y:-.05544462417080616},{x:.30554468609075497,y:-.004730624170806122},{x:.3064541047100432,y:-.003338648753719708},{x:.307526891803669,y:-.002068307996824087},{x:.348273891803669,y:.05709569200317591},{x:.3489362195699084,y:.058293979727073175},{x:.3497544895549002,y:.059391707275619196},{x:.39050548955490016,y:.12700770727561922},{x:.39164563057902163,y:.12940326331913213},{x:.3929700247860732,y:.13170208699588917},{x:.42353202478607316,y:.19932008699588913},{x:.4244827292530259,y:.20212930210713742},{x:.4256125601984483,y:.2048713835354543},{x:.4459865601984483,y:.27248838353545435},{x:.4465177787005257,y:.27518522990297933},{x:.4472474437906494,y:.27783527938992064},{x:.4574344437906494,y:.33700027938992067},{x:.45766955872204595,y:.3402450648417768},{x:.4580719785722712,y:.34347337243611903},{x:.45798772747397154,y:.3446360634540339},{x:.4580719752860241,y:.3457987547100726},{x:.45766954631126505,y:.34902706116699656},{x:.45743442220876074,y:.3522718459543075},{x:.44724742220876074,y:.4114358459543075},{x:.4465177421348676,y:.414085920594514},{x:.44598650715958776,y:.4167827924880124},{x:.42561250715958776,y:.4843987924880123},{x:.42448274729464536,y:.48714066960378194},{x:.42353212765555726,y:.48994968540512485},{x:.3929701276555573,y:.5575686854051248},{x:.39164568407140216,y:.5598676242877579},{x:.39050548955490016,y:.5622632927243807},{x:.3497544895549002,y:.6298792927243808},{x:.3489363257182038,y:.6309768778726063},{x:.34827409333092635,y:.6321750153799588},{x:.3075270933309263,y:.6913400153799587},{x:.3064542017711834,y:.692610500189881},{x:.30554468609075497,y:.6940026241708062},{x:.26479468609075496,y:.7447166241708062},{x:.26337089070969094,y:.7461701617493295},{x:.2621088975405431,y:.7477661999757953},{x:.2213588975405431,y:.7900251999757952},{x:.21464259678553657,y:.7957445459642117},{x:.20693955881566328,y:.8000437110461325},{x:.19854580706019195,y:.8027574807184589},{x:.1897839086918151,y:.803781566334583},{x:.1809905785511003,y:.8030766128585909},{x:.17250373938399882,y:.8006697112572226},{x:.16464953566022822,y:.7966533574092127},{x:.15772980002420467,y:.791181897540543},{x:.15201045403578817,y:.7844655967855365},{x:.14771128895386743,y:.7767625588156633},{x:.14499751928154103,y:.7683688070601918},{x:.14397343366541698,y:.759606908691815},{x:.14467838714140904,y:.7508135785511002},{x:.14708528874277732,y:.7423267393839987},{x:.1511016425907872,y:.7344725356602282},{x:.15657310245945688,y:.7275528000242046},{x:.19591129092993145,y:.6867578918874246},{x:.23434697314436972,y:.6389240958672278},{x:.27337685298529213,y:.5822523693404118},{x:.3120516621801016,y:.518081284004684},{x:.34029647741491703,y:.4555890988936643},{x:.35901954136421654,y:.39345212569273014},{x:.36742483055696995,y:.344635935469891},{x:.359019507292604,y:.29581872226323463},{x:.3402964755778617,y:.23368093707349602},{x:.3120517268674457,y:.17118982332763816},{x:.27337694476991303,y:.10701878295300266},{x:.23434708457036935,y:.05034804280413771},{x:.1959156338111051,y:.0025195128948044543},{x:.15658270979576625,y:-.03824483998715393},{x:.1511091222179878,y:-.045162892704162266},{x:.14709035322299047,y:-.053015860941189874},{x:.1446808418495003,y:-.06150195953288312},{x:.14397318426833106,y:-.07029507246942218}]],"*":[[{x:.03611444520266741,y:.4654782574484574},{x:.03652686631141767,y:.45666636076295464},{x:.038650478626155074,y:.4481042415682919},{x:.04240367291655979,y:.4401209373034283},{x:.04764221603086716,y:.4330232418741738},{x:.05416479369500318,y:.42708391573544136},{x:.06172074690723879,y:.42253120385992987},{x:.07001970462305517,y:.4195400644118251},{x:.0787427425515426,y:.41822544520266736},{x:.08755463923704532,y:.41863786631141764},{x:.09611675843170807,y:.42076147862615504},{x:.25602600000000003,y:.47756000598755177},{x:.25602600000000003,y:.31805799999999995},{x:.25689066238185465,y:.30927893550927416},{x:.2594514210369921,y:.30083724554357094},{x:.2636098674463855,y:.29305733951411783},{x:.26920619484660535,y:.2862381948466053},{x:.27602533951411795,y:.2806418674463854},{x:.283805245543571,y:.276483421036992},{x:.2922469355092743,y:.2739226623818546},{x:.301026,y:.27305799999999997},{x:.3098050644907258,y:.2739226623818546},{x:.3182467544564291,y:.276483421036992},{x:.32602666048588214,y:.2806418674463854},{x:.3328458051533947,y:.2862381948466053},{x:.33844213255361455,y:.29305733951411783},{x:.34260057896300794,y:.30083724554357094},{x:.3451613376181454,y:.30927893550927416},{x:.346026,y:.31805799999999995},{x:.346026,y:.47756000598755177},{x:.505935241568292,y:.42076147862615504},{x:.5144973607629547,y:.41863786631141764},{x:.5233092574484575,y:.41822544520266736},{x:.5320322953769449,y:.4195400644118251},{x:.5403312530927612,y:.42253120385992987},{x:.5478872063049969,y:.42708391573544136},{x:.5544097839691329,y:.4330232418741738},{x:.5596483270834403,y:.4401209373034283},{x:.5634015213738449,y:.4481042415682919},{x:.5655251336885824,y:.45666636076295464},{x:.5659375547973327,y:.4654782574484574},{x:.5646229355881749,y:.4742012953769448},{x:.5616317961400701,y:.4825002530927612},{x:.5570790842645587,y:.4900562063049968},{x:.5511397581258262,y:.4965787839691328},{x:.5440420626965717,y:.5018173270834402},{x:.5360587584317081,y:.5055705213738448},{x:.37146215609131306,y:.5640339630732496},{x:.47696549129035026,y:.7165911114148321},{x:.48124783600971727,y:.7243035129909579},{x:.48394328176908086,y:.732703166943666},{x:.4849482440995321,y:.7414672792821342},{x:.48422410286230105,y:.7502590500841659},{x:.48179868639903156,y:.758740616528321},{x:.47776520210421775,y:.7665860367726678},{x:.4722786545173053,y:.7734938157169785},{x:.4655498885851679,y:.7791984912903502},{x:.45783748700904214,y:.7834808360097172},{x:.449437833056334,y:.7861762817690807},{x:.4406737207178658,y:.7871812440995319},{x:.431881949915834,y:.786457102862301},{x:.4234003834716789,y:.7840316863990314},{x:.4155549632273321,y:.7799982021042177},{x:.40864718428302144,y:.7745116545173052},{x:.40294250870964976,y:.7677828885851677},{x:.301026,y:.6204122684209616},{x:.19910949129035027,y:.7677828885851677},{x:.19340481571697854,y:.7745116545173052},{x:.18649703677266788,y:.7799982021042177},{x:.17865161652832107,y:.7840316863990314},{x:.17017005008416597,y:.786457102862301},{x:.1613782792821342,y:.7871812440995319},{x:.15261416694366597,y:.7861762817690807},{x:.14421451299095783,y:.7834808360097172},{x:.13650211141483212,y:.7791984912903502},{x:.12977334548269473,y:.7734938157169785},{x:.12428679789578226,y:.7665860367726678},{x:.12025331360096844,y:.758740616528321},{x:.11782789713769894,y:.7502590500841659},{x:.11710375590046794,y:.7414672792821342},{x:.11810871823091917,y:.732703166943666},{x:.12080416399028275,y:.7243035129909579},{x:.1250865087096497,y:.7165911114148321},{x:.23058984390868703,y:.5640339630732496},{x:.06599324156829194,y:.5055705213738448},{x:.058009937303428294,y:.5018173270834402},{x:.05091224187417384,y:.4965787839691328},{x:.04497291573544139,y:.4900562063049968},{x:.04042020385992993,y:.4825002530927612},{x:.03742906441182516,y:.4742012953769448},{x:.03611444520266741,y:.4654782574484574}]],"+":[[{x:-.002030999999999998,y:.33155},{x:-.0011663376181453647,y:.3227709355092742},{x:.0013944210369920967,y:.314329245543571},{x:.005552867446385459,y:.3065493395141179},{x:.011149194846605363,y:.29973019484660535},{x:.017968339514117915,y:.2941338674463855},{x:.025748245543570962,y:.2899754210369921},{x:.03418993550927423,y:.28741466238185465},{x:.042969,y:.28655},{x:.256023,y:.28655},{x:.256023,y:.09133899999999995},{x:.2568876623818546,y:.08255993550927418},{x:.25944842103699206,y:.07411824554357091},{x:.26360686744638545,y:.06633833951411786},{x:.2692031948466054,y:.05951919484660531},{x:.2760223395141179,y:.053922867446385414},{x:.2838022455435709,y:.049764421036992045},{x:.2922439355092742,y:.04720366238185458},{x:.301023,y:.04633899999999995},{x:.3098020644907258,y:.04720366238185458},{x:.31824375445642905,y:.049764421036992045},{x:.3260236604858821,y:.053922867446385414},{x:.3328428051533946,y:.05951919484660531},{x:.3384391325536145,y:.06633833951411786},{x:.3425975789630079,y:.07411824554357091},{x:.34515833761814535,y:.08255993550927418},{x:.34602299999999997,y:.09133899999999995},{x:.34602299999999997,y:.28655},{x:.559083,y:.28655},{x:.5678620644907257,y:.28741466238185465},{x:.576303754456429,y:.2899754210369921},{x:.5840836604858821,y:.2941338674463855},{x:.5909028051533947,y:.29973019484660535},{x:.5964991325536145,y:.3065493395141179},{x:.6006575789630079,y:.314329245543571},{x:.6032183376181454,y:.3227709355092742},{x:.604083,y:.33155},{x:.6032183376181454,y:.3403290644907258},{x:.6006575789630079,y:.348770754456429},{x:.5964991325536145,y:.35655066048588213},{x:.5909028051533947,y:.3633698051533947},{x:.5840836604858821,y:.36896613255361455},{x:.576303754456429,y:.37312457896300794},{x:.5678620644907257,y:.3756853376181454},{x:.559083,y:.37655},{x:.34602299999999997,y:.37655},{x:.34602299999999997,y:.571777},{x:.34515833761814535,y:.5805560644907257},{x:.3425975789630079,y:.588997754456429},{x:.3384391325536145,y:.5967776604858821},{x:.3328428051533946,y:.6035968051533946},{x:.3260236604858821,y:.6091931325536145},{x:.31824375445642905,y:.6133515789630078},{x:.3098020644907258,y:.6159123376181453},{x:.301023,y:.616777},{x:.2922439355092742,y:.6159123376181453},{x:.2838022455435709,y:.6133515789630078},{x:.2760223395141179,y:.6091931325536145},{x:.2692031948466054,y:.6035968051533946},{x:.26360686744638545,y:.5967776604858821},{x:.25944842103699206,y:.588997754456429},{x:.2568876623818546,y:.5805560644907257},{x:.256023,y:.571777},{x:.256023,y:.37655},{x:.042969,y:.37655},{x:.03418993550927421,y:.3756853376181454},{x:.025748245543570934,y:.37312457896300794},{x:.017968339514117904,y:.36896613255361455},{x:.011149194846605356,y:.3633698051533947},{x:.005552867446385459,y:.35655066048588213},{x:.0013944210369920967,y:.348770754456429},{x:-.0011663376181453647,y:.3403290644907258},{x:-.002030999999999998,y:.33155}]],",":[[{x:.1703425796668749,y:-.03158948169003215},{x:.1707557440557006,y:-.035050650253961146},{x:.17102563140319493,y:-.03852592771911176},{x:.17127771326913271,y:-.039423300660751795},{x:.17138819577001116,y:-.0403488367651378},{x:.1724686618106471,y:-.0436628955719719},{x:.1734113563482083,y:-.04701874414557815},{x:.1738336633079298,y:-.04784969558537063},{x:.17412258605517572,y:-.048735893706360625},{x:.1758288320436127,y:-.05177548533469908},{x:.17740810654883146,y:-.054882941638058576},{x:.177984409582707,y:-.05561553857817519},{x:.17844066943717352,y:-.05642834261896521},{x:.18070712529694977,y:-.05907665726715373},{x:.18286228913625774,y:-.06181630349720979},{x:.26855428913625773,y:-.1511263034972098},{x:.27525630293239317,y:-.15686238451505874},{x:.2829485933055849,y:-.16118075031492074},{x:.2913355498506774,y:-.16391544852087458},{x:.3000948665311021,y:-.16496138621450188},{x:.3088899277191117,y:-.1642783685968051},{x:.3173827441455781,y:-.16189264365179173},{x:.3252469416380585,y:-.15789589345116858},{x:.33218030349720973,y:-.1524417108637423},{x:.3379163845150587,y:-.14573969706760687},{x:.3422347503149207,y:-.13804740669441512},{x:.3449694485208745,y:-.12966045014932262},{x:.3460153862145018,y:-.12090113346889794},{x:.34533236859680505,y:-.11210607228088836},{x:.34294664365179167,y:-.10361325585442197},{x:.33894989345116855,y:-.09574905836194152},{x:.33349571086374225,y:-.08881569650279031},{x:.277697993368333,y:-.03066214483501502},{x:.41918956700521515,y:.11679250439324337},{x:.42464400414059766,y:.12372566600271688},{x:.42864104306488354,y:.1315897167531037},{x:.43102707981377775,y:.14008244558427704},{x:.4317104203331251,y:.14887748169003212},{x:.4306648042299889,y:.15763683676513773},{x:.4279304139448243,y:.1660238937063606},{x:.4236123305628265,y:.17371634261896518},{x:.41787649560675666,y:.1804185670052151},{x:.41094333399728317,y:.18587300414059763},{x:.4030792832468963,y:.18987004306488353},{x:.39458655441572293,y:.19225607981377774},{x:.3857915183099679,y:.19293942033312508},{x:.37703216323486227,y:.19189380422998883},{x:.36864510629363945,y:.18915941394482427},{x:.3609526573810348,y:.18484133056282648},{x:.35425043299478487,y:.17910549560675662},{x:.18286343299478489,y:.000495495606756581},{x:.18070816857348473,y:-.0022440714967103576},{x:.1784416154849413,y:-.004892302932393237},{x:.17798532578947307,y:-.005705090221499034},{x:.17740899585940237,y:-.006437666002716908},{x:.1758296072680145,y:-.009545064322455634},{x:.1741232496850793,y:-.012584593305585},{x:.17383429440212667,y:-.013470780818460306},{x:.1734119569351165,y:-.014301716753103766},{x:.1724691391914766,y:-.01765753071433596},{x:.17138855147912546,y:-.02097154985067746},{x:.17127803499816427,y:-.02189708189818214},{x:.17102592018622226,y:-.022794445584277102},{x:.17075590524748027,y:-.02626971313843455},{x:.17034261378549817,y:-.029730866531102167},{x:.17041478319291342,y:-.03066017543569507},{x:.1703425796668749,y:-.03158948169003215}]],"-":[[{x:.12882900000000003,y:.31396500000000005},{x:.12969366238185465,y:.30518593550927425},{x:.13225442103699211,y:.29674424554357104},{x:.13641286744638548,y:.28896433951411793},{x:.14200919484660537,y:.2821451948466054},{x:.14882833951411792,y:.2765488674463855},{x:.15660824554357097,y:.2723904210369921},{x:.16504993550927424,y:.2698296623818547},{x:.173829,y:.26896500000000007},{x:.428224,y:.26896500000000007},{x:.4370030644907258,y:.2698296623818547},{x:.44544475445642906,y:.2723904210369921},{x:.4532246604858821,y:.2765488674463855},{x:.4600438051533946,y:.2821451948466054},{x:.4656401325536145,y:.28896433951411793},{x:.4697985789630079,y:.29674424554357104},{x:.47235933761814536,y:.30518593550927425},{x:.473224,y:.31396500000000005},{x:.47235933761814536,y:.32274406449072585},{x:.4697985789630079,y:.33118575445642906},{x:.4656401325536145,y:.33896566048588217},{x:.4600438051533946,y:.3457848051533947},{x:.4532246604858821,y:.3513811325536146},{x:.44544475445642906,y:.355539578963008},{x:.4370030644907258,y:.3581003376181454},{x:.428224,y:.35896500000000003},{x:.173829,y:.35896500000000003},{x:.16504993550927424,y:.3581003376181454},{x:.15660824554357097,y:.355539578963008},{x:.14882833951411792,y:.3513811325536146},{x:.14200919484660537,y:.3457848051533947},{x:.13641286744638548,y:.33896566048588217},{x:.13225442103699211,y:.33118575445642906},{x:.12969366238185465,y:.32274406449072585},{x:.12882900000000003,y:.31396500000000005}]],".":[[{x:.19450299999999998,y:.148926},{x:.19536766238185463,y:.14014693550927423},{x:.1979284210369921,y:.13170524554357096},{x:.20208686744638546,y:.12392533951411791},{x:.20768319484660536,y:.11710619484660537},{x:.2145023395141179,y:.11150986744638547},{x:.22228224554357093,y:.1073514210369921},{x:.2307239355092742,y:.10479066238185464},{x:.239503,y:.103926},{x:.362549,y:.103926},{x:.3713280644907258,y:.10479066238185464},{x:.3797697544564291,y:.1073514210369921},{x:.38754966048588213,y:.11150986744638547},{x:.3943688051533947,y:.11710619484660537},{x:.39996513255361454,y:.12392533951411791},{x:.40412357896300793,y:.13170524554357096},{x:.4066843376181454,y:.14014693550927423},{x:.407549,y:.148926},{x:.4066843376181454,y:.1577050644907258},{x:.40412357896300793,y:.16614675445642904},{x:.39996513255361454,y:.1739266604858821},{x:.3943688051533947,y:.18074580515339464},{x:.38754966048588213,y:.18634213255361454},{x:.3797697544564291,y:.1905005789630079},{x:.3713280644907258,y:.19306133761814537},{x:.362549,y:.193926},{x:.239503,y:.193926},{x:.2307239355092742,y:.19306133761814537},{x:.22228224554357093,y:.1905005789630079},{x:.2145023395141179,y:.18634213255361454},{x:.20768319484660536,y:.18074580515339464},{x:.20208686744638546,y:.1739266604858821},{x:.1979284210369921,y:.16614675445642904},{x:.19536766238185463,y:.1577050644907258},{x:.19450299999999998,y:.148926}]],"/":[[{x:.017522651058219416,y:-.036644753012328966},{x:.01865919532569161,y:-.04539277458837648},{x:.02148055556003016,y:-.053750976595687026},{x:.02587830846966649,y:-.06139815801845333},{x:.031683450876571484,y:-.06804044196318723},{x:.038672894413609195,y:-.07342256918292836},{x:.04657803868537635,y:-.0773377075469538},{x:.0550950934307649,y:-.07963540048356893},{x:.0638967530123289,y:-.08022734894178067},{x:.07264477458837641,y:-.07909080467430848},{x:.08100297659568695,y:-.07626944443996993},{x:.08865015801845323,y:-.0718716915303336},{x:.09529244196318715,y:-.0660665491234286},{x:.10067456918292828,y:-.059077105586390885},{x:.5777245691829282,y:.7051758944136092},{x:.5816397075469537,y:.7130810386853763},{x:.5839374004835688,y:.7215980934307649},{x:.5845293489417805,y:.7303997530123288},{x:.5833928046743084,y:.7391477745883763},{x:.5805714444399699,y:.747505976595687},{x:.5761736915303335,y:.7551531580184532},{x:.5703685491234285,y:.7617954419631872},{x:.5633791055863908,y:.7671775691829282},{x:.5554739613146237,y:.7710927075469537},{x:.5469569065692351,y:.7733904004835688},{x:.5381552469876711,y:.7739823489417805},{x:.5294072254116237,y:.7728458046743084},{x:.521049023404313,y:.7700244444399699},{x:.5134018419815468,y:.7656266915303335},{x:.5067595580368128,y:.7598215491234285},{x:.5013774308170718,y:.7528321055863908},{x:.024327430817071727,y:-.011420894413609283},{x:.020412292453046287,y:-.019326038685376436},{x:.018114599516431164,y:-.027843093430764996},{x:.017522651058219416,y:-.036644753012328966}]],"<":[[{x:-.002019645490236678,y:.32959917016575135},{x:-.0016099914284145765,y:.3262199732716625},{x:-.0013526191024594778,y:.3228257800560043},{x:-.001080072865731869,y:.3218487260950263},{x:-.0009579981642362373,y:.3208417436418168},{x:.00010303311987996846,y:.3176073966113462},{x:.0010176343561875828,y:.3143286327165328},{x:.0014755574652736251,y:.31342352370653337},{x:.001791739066671412,y:.3124597057316259},{x:.003463372735866293,y:.309494502707312},{x:.00500005526992945,y:.3064571691910689},{x:.005625757523098081,y:.30565878796371126},{x:.0061238953427729045,y:.3047751734513664},{x:.008341891452602095,y:.3021930655225286},{x:.010441601436418424,y:.2995138854085287},{x:.011211037446978121,y:.298852913306643},{x:.011871988327878901,y:.29808345906703315},{x:.014551110531708777,y:.29598367519331337},{x:.017133157288130564,y:.2937656078708368},{x:.01801675806170013,y:.2932674456816211},{x:.018815122032139454,y:.29264172140965955},{x:.021852413166145952,y:.29110495510775264},{x:.024817570086352318,y:.28943323966009543},{x:.5409315700863523,y:.06192123966009548},{x:.5493135321567164,y:.059171271257023414},{x:.5580709293975171,y:.05810938240515066},{x:.5668672199439956,y:.058776380897540545},{x:.5753643672834672,y:.061146634356187606},{x:.583235830808931,y:.06512905526992949},{x:.5901791145914712,y:.07057060143641844},{x:.5959273921291632,y:.07726215728813057},{x:.6002597603399046,y:.08494657008635234},{x:.6030097287429766,y:.09332853215671641},{x:.6040716175948494,y:.10208592939751719},{x:.6034046191024595,y:.11088221994399564},{x:.6010343656438124,y:.11937936728346718},{x:.5970519447300705,y:.12725083080893104},{x:.5916103985635816,y:.13419411459147126},{x:.5849188427118694,y:.1399423921291632},{x:.5772344299136477,y:.14427476033990455},{x:.15453394878652635,y:.33060846154195217},{x:.577233294268374,y:.5169277390666714},{x:.5849178265486336,y:.521259895342773},{x:.5916095409329668,y:.527007988327879},{x:.5970512785903404,y:.5339511220321395},{x:.6010339165943431,y:.5418224757210541},{x:.6034044043999703,y:.5503195576866639},{x:.6040716454902366,y:.5591158298342486},{x:.6030099981642363,y:.5678732563581832},{x:.6002602609333286,y:.5762552942683741},{x:.5959281046572271,y:.5839398265486336},{x:.5901800116721211,y:.5906315409329669},{x:.5832368779678606,y:.5960732785903404},{x:.5753655242789459,y:.6000559165943432},{x:.5668684423133362,y:.6024264043999704},{x:.5580721701657515,y:.6030936454902367},{x:.5493147436418169,y:.6020319981642364},{x:.540932705731626,y:.5992822609333287},{x:.024818705731625975,y:.37178726093332853},{x:.02185350270731245,y:.3701156272641339},{x:.018816169191068974,y:.3685789447300705},{x:.01801778796371134,y:.36795324247690187},{x:.01713417345136639,y:.367455104657227},{x:.01455206552252819,y:.3652371085473975},{x:.011872885408528756,y:.3631373985635815},{x:.011211913306643135,y:.3623679625530219},{x:.010442459067033207,y:.36170701167212105},{x:.008342675193313383,y:.3590278894682912},{x:.006124607870836803,y:.3564458427118694},{x:.005626445681621026,y:.3555622419382997},{x:.005000721409659611,y:.3547638779678605},{x:.0034639551077528313,y:.3517265868338544},{x:.0017922396600954515,y:.3487614299136476},{x:.0014760314771086122,y:.3477976206592673},{x:.0010180834056568513,y:.3468925242789459},{x:.00010339174271701993,y:.34361378560971106},{x:-.0009577287429766018,y:.3403794678432836},{x:-.0010798312165939596,y:.33937248875722786},{x:-.0013524043999703778,y:.33839544231333624},{x:-.001609870336301571,y:.33500125619719334},{x:-.0020196175948493655,y:.3316220706024828},{x:-.001942922029511974,y:.3306106193263084},{x:-.002019645490236678,y:.32959917016575135}]],"=":[[{x:-.002030999999999998,y:.19162999999999997},{x:-.0011663376181453647,y:.1828509355092742},{x:.0013944210369920967,y:.17440924554357093},{x:.005552867446385459,y:.16662933951411787},{x:.011149194846605363,y:.15981019484660533},{x:.017968339514117915,y:.15421386744638543},{x:.025748245543570962,y:.15005542103699207},{x:.03418993550927423,y:.1474946623818546},{x:.042969,y:.14662999999999998},{x:.559083,y:.14662999999999998},{x:.5678620644907257,y:.1474946623818546},{x:.576303754456429,y:.15005542103699207},{x:.5840836604858821,y:.15421386744638543},{x:.5909028051533947,y:.15981019484660533},{x:.5964991325536145,y:.16662933951411787},{x:.6006575789630079,y:.17440924554357093},{x:.6032183376181454,y:.1828509355092742},{x:.604083,y:.19162999999999997},{x:.6032183376181454,y:.20040906449072574},{x:.6006575789630079,y:.208850754456429},{x:.5964991325536145,y:.21663066048588206},{x:.5909028051533947,y:.2234498051533946},{x:.5840836604858821,y:.2290461325536145},{x:.576303754456429,y:.23320457896300786},{x:.5678620644907257,y:.23576533761814533},{x:.559083,y:.23662999999999995},{x:.042969,y:.23662999999999995},{x:.03418993550927421,y:.23576533761814533},{x:.025748245543570934,y:.23320457896300786},{x:.017968339514117904,y:.2290461325536145},{x:.011149194846605356,y:.2234498051533946},{x:.005552867446385459,y:.21663066048588206},{x:.0013944210369920967,y:.208850754456429},{x:-.0011663376181453647,y:.20040906449072574},{x:-.002030999999999998,y:.19162999999999997}],[{x:-.002030999999999998,y:.454102},{x:-.0011663376181453647,y:.4453229355092742},{x:.0013944210369920967,y:.436881245543571},{x:.005552867446385459,y:.4291013395141179},{x:.011149194846605363,y:.42228219484660534},{x:.017968339514117915,y:.41668586744638547},{x:.025748245543570962,y:.4125274210369921},{x:.03418993550927423,y:.40996666238185464},{x:.042969,y:.409102},{x:.559083,y:.409102},{x:.5678620644907257,y:.40996666238185464},{x:.576303754456429,y:.4125274210369921},{x:.5840836604858821,y:.41668586744638547},{x:.5909028051533947,y:.42228219484660534},{x:.5964991325536145,y:.4291013395141179},{x:.6006575789630079,y:.436881245543571},{x:.6032183376181454,y:.4453229355092742},{x:.604083,y:.454102},{x:.6032183376181454,y:.4628810644907258},{x:.6006575789630079,y:.471322754456429},{x:.5964991325536145,y:.4791026604858821},{x:.5909028051533947,y:.48592180515339467},{x:.5840836604858821,y:.49151813255361454},{x:.576303754456429,y:.49567657896300793},{x:.5678620644907257,y:.49823733761814537},{x:.559083,y:.499102},{x:.042969,y:.499102},{x:.03418993550927421,y:.49823733761814537},{x:.025748245543570934,y:.49567657896300793},{x:.017968339514117904,y:.49151813255361454},{x:.011149194846605356,y:.48592180515339467},{x:.005552867446385459,y:.4791026604858821},{x:.0013944210369920967,y:.471322754456429},{x:-.0011663376181453647,y:.4628810644907258},{x:-.002030999999999998,y:.454102}]],">":[[{x:-.002019645490236678,y:.5591158298342487},{x:-.0013524043999703708,y:.5503195576866637},{x:.0010180834056568513,y:.5418224757210541},{x:.005000721409659611,y:.5339511220321396},{x:.01044245906703322,y:.527007988327879},{x:.01713417345136643,y:.521259895342773},{x:.024818705731625975,y:.5169277390666714},{x:.44751805121347366,y:.33060846154195217},{x:.024817570086352318,y:.14427476033990455},{x:.017133157288130554,y:.1399423921291632},{x:.01044160143641841,y:.13419411459147126},{x:.00500005526992945,y:.12725083080893107},{x:.0010176343561875828,y:.11937936728346718},{x:-.0013526191024594778,y:.11088221994399562},{x:-.0020196175948493655,y:.10208592939751718},{x:-.0009577287429766018,y:.0933285321567164},{x:.0017922396600954585,y:.08494657008635234},{x:.00612460787083681,y:.07726215728813059},{x:.011872885408528759,y:.07057060143641844},{x:.018816169191068984,y:.06512905526992947},{x:.02668763271653284,y:.061146634356187606},{x:.03518478005600438,y:.058776380897540545},{x:.04398107060248284,y:.05810938240515066},{x:.052738467843283614,y:.05917127125702342},{x:.06112042991364768,y:.06192123966009548},{x:.5772344299136477,y:.28943323966009543},{x:.5801995868338548,y:.29110495510775297},{x:.5832368779678606,y:.2926417214096596},{x:.5840352419382998,y:.29326744568162105},{x:.5849188427118694,y:.2937656078708368},{x:.5875008894682915,y:.29598367519331353},{x:.5901800116721211,y:.29808345906703315},{x:.5908409625530218,y:.2988529133066429},{x:.5916103985635817,y:.29951388540852875},{x:.5937101085473976,y:.3021930655225282},{x:.5959281046572271,y:.3047751734513664},{x:.5964262424769022,y:.30565878796371176},{x:.5970519447300705,y:.30645716919106897},{x:.5985886272641329,y:.3094945027073105},{x:.6002602609333286,y:.31245970573162596},{x:.6005764425347265,y:.31342352370653376},{x:.6010343656438124,y:.31432863271653283},{x:.6019489668801197,y:.31760739661134507},{x:.6030099981642363,y:.32084174364181683},{x:.6031320728657319,y:.3218487260950267},{x:.6034046191024595,y:.3228257800560044},{x:.6036619914284146,y:.3262199732716634},{x:.6040716454902366,y:.32959917016575135},{x:.603994922029512,y:.330610619326308},{x:.6040716175948494,y:.33162207060248283},{x:.6036618703363014,y:.3350012561971954},{x:.6034044043999703,y:.33839544231333624},{x:.6031318312165941,y:.33937248875722736},{x:.6030097287429766,y:.3403794678432836},{x:.6019486082572825,y:.3436137856097129},{x:.6010339165943431,y:.3468925242789459},{x:.6005759685228916,y:.3477976206592668},{x:.6002597603399046,y:.34876142991364767},{x:.5985880448922466,y:.3517265868338553},{x:.5970512785903404,y:.3547638779678605},{x:.596425554318379,y:.35556224193829966},{x:.5959273921291631,y:.35644584271186947},{x:.5937093248066866,y:.3590278894682911},{x:.5916095409329668,y:.36170701167212105},{x:.5908400866933569,y:.3623679625530219},{x:.5901791145914712,y:.36313739856358157},{x:.5874999344774714,y:.3652371085473978},{x:.5849178265486336,y:.367455104657227},{x:.5840342120362888,y:.36795324247690175},{x:.583235830808931,y:.3685789447300705},{x:.5801984972926872,y:.37011562726413405},{x:.577233294268374,y:.37178726093332853},{x:.06111929426837402,y:.5992822609333287},{x:.05273725635818315,y:.6020319981642364},{x:.04397982983424857,y:.6030936454902367},{x:.035183557686663716,y:.6024264043999704},{x:.02668647572105406,y:.6000559165943432},{x:.018815122032139416,y:.5960732785903404},{x:.011871988327878898,y:.5906315409329669},{x:.006123895342772898,y:.5839398265486336},{x:.001791739066671405,y:.5762552942683741},{x:-.0009579981642362442,y:.5678732563581832},{x:-.002019645490236678,y:.5591158298342487}]],A:[[{x:-.026930267425517032,y:.05053409251215203},{x:-.025968910797820398,y:.041765089843587025},{x:-.02331527881378681,y:.03335213247651147},{x:-.019071349062388714,y:.025618525644501258},{x:-.013400213383949137,y:.018861467521053887},{x:-.006519810342180955,y:.013340628060451547},{x:.0013054500325951415,y:.009268170027042777},{x:.009774847372633092,y:.006800595699190677},{x:.018562907487847988,y:.006032732574482988},{x:.02733191015641301,y:.006994089202179622},{x:.035744867523488544,y:.00964772118621321},{x:.043478474355498745,y:.013891650937611293},{x:.05023553247894613,y:.019562786616050876},{x:.055756371939548466,y:.02644318965781906},{x:.05982882997295724,y:.03426845003259516},{x:.15465984441872488,y:.2705423452957767},{x:.155303,y:.27047899999999997},{x:.433548,y:.27047899999999997},{x:.439584057854266,y:.2710734998088117},{x:.5426964027293978,y:.03313672871631684},{x:.5469805748198717,y:.025425342079263714},{x:.5526868446471364,y:.018697928086846893},{x:.559595923461843,y:.013213017486017727},{x:.5674422992397985,y:.009181392315192764},{x:.5759244401601543,y:.006757985668725375},{x:.5847163823041805,y:.006035927704977205},{x:.5934802562658602,y:.007042966706560308},{x:.6018792712836831,y:.009740402729397836},{x:.6095906579207363,y:.01402457481987169},{x:.6163180719131531,y:.019730844647136342},{x:.6218029825139822,y:.026639923461843008},{x:.6258346076848073,y:.03448629923979854},{x:.6282580143312746,y:.042968440160154345},{x:.6289800722950228,y:.05176038230418057},{x:.6279730332934397,y:.060524256265860256},{x:.6252755972706022,y:.0689232712836832},{x:.3314685972706022,y:.7468972712836831},{x:.3293831787279993,y:.7506509647260751},{x:.32731734906238874,y:.7544154743554987},{x:.32724162770964893,y:.7545056950115825},{x:.32718442518012836,y:.7546086579207363},{x:.324406768107635,y:.7578833802211685},{x:.32164621338394916,y:.7611725324789461},{x:.3215543458189217,y:.761246247067332},{x:.32147815535286367,y:.7613360719131531},{x:.3181150035540548,y:.764005977330098},{x:.314765810342181,y:.7666933719395485},{x:.31466132698386995,y:.7667477476499444},{x:.314569076538157,y:.7668209825139822},{x:.31074967405057474,y:.7687834680795742},{x:.3069405499674049,y:.7707658299729572},{x:.30682746605267575,y:.7707987771773066},{x:.30672270076020147,y:.7708526076848072},{x:.3025938250794972,y:.7720322561793334},{x:.29847115262736695,y:.7732334043008093},{x:.2983538139076442,y:.7732436568565263},{x:.29824055983984565,y:.7732760143312747},{x:.29396088134293,y:.7736274925246428},{x:.289683092512152,y:.774001267425517},{x:.28956600824863027,y:.7739884313326351},{x:.2894486176958195,y:.7739980722950228},{x:.2851826020272766,y:.773507873077374},{x:.280914089843587,y:.7730399107978204},{x:.2808017595188513,y:.7730044793401902},{x:.28068474373413976,y:.7729910332934397},{x:.2765963314836881,y:.7716779947458032},{x:.2725011324765115,y:.7703862788137869},{x:.27239787288194656,y:.7703296136024552},{x:.27228572871631684,y:.7702935972706022},{x:.26853203527393116,y:.7682081787280027},{x:.2647675256445013,y:.7661423490623888},{x:.26467730498841713,y:.7660666277096486},{x:.2645743420792637,y:.7660094251801283},{x:.2612996197788366,y:.7632317681076393},{x:.2580104675210539,y:.7604712133839491},{x:.2579367529326681,y:.7603793458189217},{x:.2578469280868469,y:.7603031553528636},{x:.25517702266989234,y:.7569400035540427},{x:.25248962806045155,y:.7535908103421809},{x:.2524352523500559,y:.7534863269838704},{x:.2523620174860177,y:.753394076538157},{x:.2503995319204231,y:.7495746740505695},{x:.24841717002704278,y:.7457655499674049},{x:-.023694829972957243,y:.06779154996740488},{x:-.026162404300809343,y:.05932215262736691},{x:-.026930267425517032,y:.05053409251215203}],[{x:.19075686729109992,y:.36047899999999994},{x:.2917712201653896,y:.6121588409316518},{x:.4008392655839541,y:.36047899999999994},{x:.19075686729109992,y:.36047899999999994}]],B:[[{x:.018964999999999996,y:.05103000000000002},{x:.018993157630992935,y:.05074411077481729},{x:.01896863696544404,y:.050457886669927884},{x:.019425235762019696,y:.046357147889743},{x:.01982966238185463,y:.04225093550927423},{x:.019913053192865363,y:.04197603284668677},{x:.019944843237820968,y:.04169052471317667},{x:.02119268306568244,y:.037757658485048945},{x:.02239042103699209,y:.03380924554357098},{x:.0225258403659196,y:.03355589379873479},{x:.022612719447780122,y:.03328207355405998},{x:.02460384652213923,y:.029668217721559587},{x:.026548867446385453,y:.026029339514117924},{x:.02673111120436309,y:.02580727485250577},{x:.026869740608734982,y:.025555665255108946},{x:.029527637032761178,y:.022399698271204867},{x:.03214519484660536,y:.019210194846605383},{x:.03236725950821749,y:.019027951088627763},{x:.03255231178483501,y:.01880822135423258},{x:.03577483608951879,y:.016231425260229353},{x:.03896433951411791,y:.013613867446385479},{x:.03921769125895406,y:.013478448117457993},{x:.03944205495260531,y:.013299042336531411},{x:.04310536733612953,y:.011400441961238211},{x:.046744245543570956,y:.009455421036992116},{x:.04701914820615845,y:.009372030225981372},{x:.047274201145921,y:.009239842862072495},{x:.051237522567796415,y:.008092400353164256},{x:.055185935509274225,y:.006894662381854655},{x:.05547182473445692,y:.006866504750861718},{x:.05574776537889109,y:.006786615690234012},{x:.05985878761953148,y:.006434426619834929},{x:.063965,y:.0060300000000000215},{x:.06425088922518268,y:.006058157630992957},{x:.06453711333007213,y:.00603363696544406},{x:.4241221133300721,y:.01060563696544408},{x:.4260098351414485,y:.010815826288282449},{x:.4279092214657345,y:.010813640036582327},{x:.43038314701987823,y:.011302774871886453},{x:.43288947528682337,y:.011581843237821021},{x:.43469991915024053,y:.012156270087817089},{x:.43656323581544765,y:.012524677733968342},{x:.4388942001112364,y:.013487052913568918},{x:.44129792644594007,y:.014249719447780182},{x:.4429615180190356,y:.01516630892323094},{x:.4447171588106798,y:.015891152767997317},{x:.5224141588106799,y:.0573061527679973},{x:.525028554951968,y:.05904868699814221},{x:.5277374225537912,y:.06064039332865708},{x:.5286915199232336,y:.06149010807639827},{x:.529754639763497,y:.06219869339105244},{x:.5319788494519322,y:.06441778869965879},{x:.5343251404217865,y:.06650738469209135},{x:.5350951339540482,y:.06752690757225652},{x:.5359995881074716,y:.06842928201075814},{x:.5377481362120787,y:.07103965980959966},{x:.5396416839038074,y:.07354684346181917},{x:.5707946839038074,y:.12450984346181915},{x:.5718407730360667,y:.12667263757185424},{x:.573076251912317,y:.12873311634664666},{x:.5737567016649755,y:.13063382885667474},{x:.5746357412153917,y:.13245124718509382},{x:.57523978983892,y:.1347765656784282},{x:.576049549867314,y:.13703848290314058},{x:.576346114353134,y:.13903542291661675},{x:.5768537026781452,y:.1409894121704204},{x:.5769924975430949,y:.14338789436140983},{x:.5773454200998597,y:.14576432582559334},{x:.5830324200998597,y:.2611263258255933},{x:.5829003037879823,y:.26382496142481277},{x:.5829742287592172,y:.2665258175697889},{x:.5826851199428378,y:.2682203519457296},{x:.5826010630436497,y:.26993731586400416},{x:.5819450076216034,y:.2725583233230625},{x:.5814906012502021,y:.27522170532098544},{x:.5808764603215925,y:.2768272773619606},{x:.5804590555084463,y:.278494851612457},{x:.5793042728181804,y:.28093750708458076},{x:.5783389976861617,y:.283461062658912},{x:.5774234257367941,y:.284915971131802},{x:.5766887136425759,y:.2864700717712602},{x:.575079581335268,y:.2886405053765124},{x:.5736405324246225,y:.2909272557017569},{x:.5044305324246225,y:.38012925570175693},{x:.5017223718437749,y:.38298983800955333},{x:.499075053174031,y:.3859068173944946},{x:.49869279401231464,y:.38618992769627897},{x:.4983657648506557,y:.38653536283797296},{x:.49515156889241035,y:.38881264393905274},{x:.49198604326106643,y:.39115710813128307},{x:.4915558970220145,y:.39136020348505085},{x:.4911677605809681,y:.39163520096290155},{x:.48757104899345777,y:.3932416662216644},{x:.4840089657752798,y:.3949235187770668},{x:.3737297002329455,y:.43429966367120415},{x:.4408630401939032,y:.4733794631163462},{x:.44336631106573315,y:.475186847643908},{x:.4459719275146733,y:.476843279595192},{x:.4469351296354233,y:.4777635673817196},{x:.4480152047486495,y:.4785433915190981},{x:.45011777274311354,y:.48080441158023823},{x:.45235016915983667,y:.4829373462081214},{x:.4531153243813002,y:.4840278623347861},{x:.4540225100120052,y:.48500341457167107},{x:.4556435746202097,y:.4876311804334344},{x:.4574169612623637,y:.4901586502563309},{x:.45795466509848404,y:.4913774867999537},{x:.45865409861163536,y:.4925112772109775},{x:.4597313632297904,y:.4954048053049642},{x:.460977589843244,y:.49822968107500176},{x:.46126717863714684,y:.4995299988307428},{x:.46173198119508085,y:.5007784564862466},{x:.46222404714804793,y:.5038265501505143},{x:.4628952219429378,y:.5068402734760588},{x:.4768502219429378,y:.6216502734760588},{x:.47694604753136066,y:.6258560133977795},{x:.4770801736029929,y:.6300607061367898},{x:.47704647561686464,y:.6302637547476413},{x:.47705116403527437,y:.6304695272224051},{x:.47632464920624185,y:.6346131496757303},{x:.47563590322258376,y:.6387632171212809},{x:.475563239914934,y:.6389557900590453},{x:.4755276940283349,y:.6391585233384632},{x:.47400675833929046,y:.6430807912362932},{x:.4725216084222428,y:.647016748623825},{x:.4724127722032346,y:.6471914454185},{x:.4723383580201142,y:.6473833485763381},{x:.4700814501766401,y:.6509335313629835},{x:.46785696980463054,y:.6545041220574128},{x:.46771614318912413,y:.6546542292091504},{x:.46760572040480797,y:.6548279275146733},{x:.4646995721096373,y:.6578695936566139},{x:.4618212468158623,y:.6609376018599591},{x:.3721282468158623,y:.739463601859959},{x:.3693406873548985,y:.7414576112446344},{x:.36664335021940475,y:.7435720694617842},{x:.36575927454484214,y:.7440194833243711},{x:.36495338890552403,y:.7445959530105889},{x:.3618303796850022,y:.746007822191186},{x:.35877236079175173,y:.7475554273162446},{x:.35781798626885214,y:.7478217696388809},{x:.3569151218394033,y:.7482299421328396},{x:.35357667835226414,y:.7490054137685334},{x:.3502754956523681,y:.7499266922044516},{x:.21714549565236804,y:.7733246922044517},{x:.2164184100494338,y:.7733799121498203},{x:.21571010443589486,y:.773553134187072},{x:.21202614434596675,y:.7737134914026773},{x:.20834928456346336,y:.7739927377465721},{x:.20762539682958886,y:.7739050492917646},{x:.20689690716677497,y:.7739367593459113},{x:.061505907166774995,y:.7659797593459113},{x:.05835682356136361,y:.7654946428322841},{x:.055185935509274225,y:.7651823376181454},{x:.05400593378019863,y:.7648243880069794},{x:.05278721145616079,y:.7646366437616691},{x:.0497932781460736,y:.7635464928911877},{x:.046744245543570956,y:.7626215789630079},{x:.045656749721751114,y:.7620403003359452},{x:.0444980718907103,y:.7616184026130197},{x:.04177434405403643,y:.7599651112722733},{x:.03896433951411791,y:.7584631325536145},{x:.03801114145411163,y:.7576808631223083},{x:.03695703545532078,y:.7570410252146568},{x:.03460818442533898,y:.7548881284626934},{x:.03214519484660536,y:.7528668051533947},{x:.03136292541529926,y:.7519136070933885},{x:.03045389995114224,y:.7510804176129765},{x:.02857019075568381,y:.7485106500646154},{x:.026548867446385453,y:.7460476604858821},{x:.025967588819322866,y:.7449601646640625},{x:.025238577228599887,y:.7439656426153641},{x:.023892399755650346,y:.7410777589963466},{x:.02239042103699209,y:.738267754456429},{x:.022032471425826126,y:.7370877527273536},{x:.021511489215134356,y:.7359701170349662},{x:.02075457631003429,y:.7328750970932278},{x:.01982966238185463,y:.7298260644907257},{x:.019708797589401895,y:.7285989036590902},{x:.01941586581292807,y:.7274011044358949},{x:.019277305214138767,y:.7242178880520896},{x:.018964999999999996,y:.721047},{x:.018964999999999996,y:.05103000000000002}],[{x:.10896499999999999,y:.09660579683225357},{x:.10896499999999999,y:.37786028838708235},{x:.29722384626437015,y:.36605169579422814},{x:.44137514989764515,y:.3145812530901673},{x:.49232133133007555,y:.24891875813083103},{x:.48801965008125897,y:.1616582425292873},{x:.46925190911582665,y:.130956211173677},{x:.41203782454012283,y:.1004592638951106},{x:.10896499999999999,y:.09660579683225357}],[{x:.10896499999999999,y:.47257215902605326},{x:.10896499999999999,y:.6784424315209651},{x:.20665565807681563,y:.6837888736412973},{x:.32230778354311135,y:.6634626629325134},{x:.3846372425734713,y:.608893375476212},{x:.3762519660226853,y:.5399063743443061},{x:.2981741908903496,y:.4944555775409729},{x:.10896499999999999,y:.47257215902605326}]],C:[[{x:.028007484408327545,y:.4010798543150725},{x:.028340096336253087,y:.39680461654123217},{x:.028649292669517497,y:.39252762152779447},{x:.06572429266951751,y:.1769866215277945},{x:.0657499934516808,y:.17689321918606288},{x:.06575739253020782,y:.1767966283931179},{x:.06691993730130205,y:.17264138379230456},{x:.0680646634579554,y:.1684811950870131},{x:.0681080922997215,y:.16839460141895576},{x:.06813419313592875,y:.16830131007962543},{x:.07008504794245551,y:.16445270857242494},{x:.07201939106115751,y:.16059578172109576},{x:.07207887901649253,y:.16051932447281397},{x:.0721226785698821,y:.1604329177209502},{x:.1274306785698821,y:.07363491772095027},{x:.13009575906138268,y:.07023973030268985},{x:.13274648275581225,y:.06683332229320074},{x:.13281865262016482,y:.06677089175108791},{x:.13287757357360944,y:.06669582922279092},{x:.1361538134974972,y:.06388581079003605},{x:.13941816151489866,y:.0610619864944041},{x:.19692016151489866,y:.020443986494404057},{x:.19808425112310213,y:.019782383965415776},{x:.19914710087537263,y:.01896802966513257},{x:.20191114759162085,y:.01760739299916557},{x:.20458957759683996,y:.01608512525217841},{x:.2058603718000633,y:.015663337846789194},{x:.20706167183504787,y:.015071982836463577},{x:.21003805521400143,y:.014276729186446702},{x:.2129619996426652,y:.013306247159584957},{x:.21429066253234816,y:.013140483931242813},{x:.21558424756339917,y:.01279485365228588},{x:.32760524756339915,y:-.005618146347714133},{x:.32775803960473765,y:-.005628051859015257},{x:.32790622767465843,y:-.005666572281957827},{x:.3321581535063009,y:-.005913311337168391},{x:.3364083102547015,y:-.006188849089881349},{x:.3365600989091985,y:-.006168756021014132},{x:.33671295454862427,y:-.006177626226551311},{x:.34093131721939995,y:-.005590114680318674},{x:.3451535631465426,y:-.005031193603710363},{x:.34529851526132993,y:-.004981874120043047},{x:.3454501643137599,y:-.004960753231150514},{x:.44307616431375996,y:.01857424676884946},{x:.4458503498549469,y:.019539172468847843},{x:.4486819664572553,y:.020319643122350156},{x:.45000735163266253,y:.02098507354168687},{x:.45140809089867484,y:.021472282957461515},{x:.45394072357704407,y:.022959884631265325},{x:.4565656691892177,y:.024277779754777677},{x:.4577357684253341,y:.0251889939358613},{x:.459014543037309,y:.025940112433793877},{x:.4612082951993476,y:.027893222383335445},{x:.4635256946335971,y:.029697896006345384},{x:.5358116946335971,y:.09837789600634546},{x:.5383578959705028,y:.10132350300922108},{x:.5409714489909738,y:.10420951799057969},{x:.5412394420583803,y:.10465705806338507},{x:.5415805729157932,y:.10505169984914184},{x:.5435031902892489,y:.10843744707814906},{x:.545503491029224,y:.11177788699125937},{x:.5456790239480676,y:.11226911056087577},{x:.5459366092786453,y:.11272272074420048},{x:.5471617575812067,y:.11641849583208026},{x:.548471935605029,y:.12008498944441898},{x:.572709935605029,y:.21701898944441894},{x:.5740007070580636,y:.2257455880614603},{x:.5735642017652605,y:.23455632455146336},{x:.571417194380227,y:.24311260725223527},{x:.5676421931927146,y:.25108562301800397},{x:.5623842693813143,y:.2581689733242098},{x:.5558454820094204,y:.2640904489909738},{x:.5482771130087407,y:.26862249102922403},{x:.539970010555581,y:.27159093560502906},{x:.5312434119385397,y:.2728817070580635},{x:.5224326754485367,y:.2724452017652604},{x:.5138763927477648,y:.270298194380227},{x:.5059033769819961,y:.26652319319271456},{x:.49882002667579023,y:.2612652693813142},{x:.49289855100902624,y:.25472648200942033},{x:.488366508970776,y:.24715811300874066},{x:.48539806439497096,y:.23885101055558106},{x:.46433420621000654,y:.15461122058523102},{x:.4102697826671089,y:.10324381045150927},{x:.3332137540403124,y:.08466767669890593},{x:.24039332695070226,y:.09992465997883551},{x:.1985742470214596,y:.12946463056361485},{x:.15288732813236672,y:.2011637190451272},{x:.11884238546013813,y:.39908903228895243},{x:.16184523767713488,y:.5942488915238071},{x:.2166399992296726,y:.6603981208316636},{x:.2708106585112101,y:.6880654725502051},{x:.33167151101531583,y:.6962265900331734},{x:.41875307675349,y:.6679697644015699},{x:.4604926982936834,y:.628705384802963},{x:.487421989657252,y:.5630715564186946},{x:.49155436139101494,y:.5552777692634718},{x:.49712782320648147,y:.5484399232752638},{x:.5039281900917167,y:.5428207930406891},{x:.5116941277610109,y:.5386363185834178},{x:.5201271955849208,y:.5360473069101626},{x:.5289033154962927,y:.5351532522875923},{x:.5376852261286371,y:.5359885127334604},{x:.5461354435813054,y:.5385209896572519},{x:.5539292307365281,y:.5426533613910148},{x:.5607670767247361,y:.5482268232064814},{x:.5663862069593109,y:.5550271900917166},{x:.5705706814165822,y:.5627931277610108},{x:.5731596930898373,y:.5712261955849207},{x:.5740537477124077,y:.5800023154962926},{x:.5732184872665396,y:.588784226128637},{x:.570686010342748,y:.5972344435813053},{x:.540057010342748,y:.6718854435813053},{x:.5396985836895672,y:.6725614478775368},{x:.539454213118803,y:.6732865233897278},{x:.5376352487491008,y:.6764529645154376},{x:.5359246386089851,y:.679679230736528},{x:.5354412171276051,y:.6802723202285732},{x:.5350600868536766,y:.680935789284769},{x:.5326583313554347,y:.6836865257875079},{x:.5303511767935185,y:.686517076724736},{x:.5297613381003629,y:.6870044593160238},{x:.5292580947459566,y:.687580825172473},{x:.47307109474595666,y:.7404358251724731},{x:.4722065860115991,y:.7411021817697292},{x:.4714497622811152,y:.7418887085063782},{x:.4687194058651613,y:.7437900730587934},{x:.46608420409854834,y:.7458212660502541},{x:.46510630693397415,y:.746306161504971},{x:.46421058160492856,y:.7469299263656303},{x:.4611617503991064,y:.748262090618912},{x:.45818091720073817,y:.7497401524453693},{x:.45712721164557074,y:.7500249524971546},{x:.4561270069400303,y:.7504619845480405},{x:.3497190069400303,y:.7849899845480404},{x:.34852117258500637,y:.7852523061157466},{x:.34737251112679673,y:.7856814874310271},{x:.34422084285321763,y:.7861940634064482},{x:.3411016855274714,y:.7868771480384597},{x:.33987569082458696,y:.7869007432807547},{x:.3386653714532072,y:.7870975852636362},{x:.3354742629896646,y:.786985452257037},{x:.33228177619648713,y:.7870468942022847},{x:.3310747354346284,y:.7868308563672394},{x:.32984927004476555,y:.7867877944907101},{x:.25121827004476555,y:.7762437944907102},{x:.24809780050166644,y:.7755083028870222},{x:.24494229970605153,y:.7749416523797719},{x:.24381291428322105,y:.7744983594176508},{x:.24263200473447152,y:.7742200201979198},{x:.2397149814324578,y:.772889887451158},{x:.2367306607297473,y:.771718517308175},{x:.16743766072974728,y:.7363275173081749},{x:.16716950847174827,y:.7361554960544541},{x:.16687461978467572,y:.7360349240533984},{x:.16345937419922074,y:.733775423054901},{x:.16001260855282193,y:.7315643025810339},{x:.15978316844705134,y:.7313432727571054},{x:.15951746839392553,y:.7311674875843215},{x:.15660865257214304,y:.7282851209029094},{x:.15365948376641753,y:.7254440558690711},{x:.15347757306746915,y:.725182511527114},{x:.15325127235232486,y:.7249582685082102},{x:.08558827235232488,y:.6432742685082102},{x:.0845522070982367,y:.6417389136031936},{x:.0833480194008015,y:.6403315480201149},{x:.08209078724421986,y:.6380913122274521},{x:.0806538380596292,y:.6359618836319892},{x:.07993721339171088,y:.6342539038369039},{x:.07903072722802115,y:.632638655023214},{x:.07823470075697891,y:.6301961909068614},{x:.07724079305844417,y:.627827343805619},{x:.07687114846079628,y:.6260123758261444},{x:.07629719958575912,y:.6242513168879111},{x:.02905219958575911,y:.40983931688791114},{x:.028544362954760993,y:.4055813372409792},{x:.028013217832748447,y:.4013262022752188},{x:.028022142274708197,y:.401202753871557},{x:.028007484408327545,y:.4010798543150725}]],D:[[{x:.019456783112310236,y:.0515304721392918},{x:.019516560837245702,y:.0508455251733057},{x:.019462408649259272,y:.05016011050819538},{x:.01989956114396584,y:.04645701928180655},{x:.020223754746627687,y:.042742334175020345},{x:.02041601038349858,y:.04208221032853139},{x:.020496616482350807,y:.04139940114622653},{x:.021647806474261868,y:.03785274800035644},{x:.022690469901424933,y:.03427268656062632},{x:.023007815173924504,y:.033662754022853354},{x:.023220081912440925,y:.03300879029730612},{x:.025041069815762075,y:.029754871123364675},{x:.026762134096652887,y:.026447013104097812},{x:.027192373603928278,y:.025910711240413317},{x:.027528143690388265,y:.025310724430849408},{x:.029948949961216734,y:.02247458551787214},{x:.03228227556070457,y:.019566050047680916},{x:.03280887543977226,y:.01912398863794477},{x:.03325524541805519,y:.01860103590097925},{x:.03618283982900684,y:.01629166847686688},{x:.03903875835284746,y:.013894228942745224},{x:.03964148166567549,y:.013563396159022682},{x:.0401812977878431,y:.013137574275061882},{x:.04350317452751879,y:.011443726034814963},{x:.04677193462845869,y:.0096495146935595},{x:.04742761905614622,y:.009442624254195854},{x:.048040136491355995,y:.009130297319436702},{x:.05162863769958001,y:.008117061901006828},{x:.05518462276008175,y:.0069950292882567724},{x:.05586807071778482,y:.006920031876811272},{x:.05652975076450537,y:.006733202440201605},{x:.060246972352300414,y:.0064395179124900545},{x:.06395352786070822,y:.006032783112310258},{x:.06463847482669428,y:.006092560837245719},{x:.06532388949180462,y:.006038408649259287},{x:.22607288949180462,y:.009146408649259287},{x:.22716730592225892,y:.009275605270020776},{x:.2282688262216939,y:.009242558031150067},{x:.23153975417198444,y:.00979177582685766},{x:.23483359885377353,y:.010180616482350843},{x:.23588178136904675,y:.010520840680108605},{x:.23696858346127098,y:.010703324384590318},{x:.374121583461271,y:.04785532438459028},{x:.3763172878682137,y:.048688585594252994},{x:.37858028056243914,y:.049316523610364836},{x:.3804311803743379,y:.05024979166335608},{x:.3823691959266467,y:.050985260963484026},{x:.38436014929137596,y:.0522308719724549},{x:.38645715458576285,y:.05328823230909956},{x:.47004915458576285,y:.1063032323090996},{x:.47296331256678825,y:.10858070495130694},{x:.47594842000778254,y:.11076435600861785},{x:.476434095048061,y:.11129319075325024},{x:.4769998347544389,y:.11173532762855881},{x:.47941368513584726,y:.11453756329148114},{x:.48191542538645477,y:.11726162167794474},{x:.5445294253864548,y:.20053762167794476},{x:.5457907389554543,y:.20261097926106453},{x:.5472304508598836,y:.2045646816997861},{x:.5480776582474705,y:.2063702359380903},{x:.54911422277829,y:.20807414921008693},{x:.5499468085621922,y:.21035373787896267},{x:.5509777083681839,y:.21255077433219424},{x:.570480708368184,y:.26758877433219413},{x:.5715324066676154,y:.27184261440989077},{x:.5725895850614416,y:.2760950958693092},{x:.5821235850614417,y:.3411630958693092},{x:.5823063349967632,y:.3450227385412275},{x:.5825832689280143,y:.34887676846995497},{x:.5805752689280143,y:.424797768469955},{x:.5800798101377765,y:.42875301375722},{x:.5796594372976747,y:.43271694253692033},{x:.5588164372976746,y:.5335539425369203},{x:.5581925601051908,y:.535556542700639},{x:.5577783377379867,y:.5376127649642906},{x:.5568838034059929,y:.5397575559956548},{x:.5561926080991778,y:.5419762423834013},{x:.555190030621201,y:.5438186507441294},{x:.5543826183570809,y:.5457545524985521},{x:.5020956183570809,y:.6430055524985521},{x:.5018901867095668,y:.6433113858234256},{x:.5017428412228655,y:.6436490624319612},{x:.4994325691935421,y:.6469701275279692},{x:.4971767628200625,y:.6503284258808291},{x:.4969156133622187,y:.650588304977856},{x:.4967052216394318,y:.6508907475465959},{x:.49379143318032753,y:.6536972875938759},{x:.49092379998669317,y:.6565509711937552},{x:.49061696854573045,y:.6567549090549786},{x:.49035161582277553,y:.657010494885618},{x:.39890061582277553,y:.7292364948856179},{x:.3986791836579038,y:.7293785203585265},{x:.39848760231040037,y:.7295587979940886},{x:.39496847203231433,y:.7317585520660096},{x:.39147518928128755,y:.7339991259907827},{x:.39123030407812903,y:.7340952232117042},{x:.391007233490524,y:.7342346611962726},{x:.3871265715837099,y:.7357055993513507},{x:.38326329699273004,y:.7372216156196327},{x:.3830043695523095,y:.737268091626259},{x:.38275838220218455,y:.7373613314362847},{x:.25909638220218456,y:.7708063314362847},{x:.2580664240588666,y:.7709788511982676},{x:.2570738325025125,y:.7713034106651087},{x:.2537238261308602,y:.7717062438265866},{x:.2503960471743838,y:.7722636525302581},{x:.2493522224520667,y:.7722319225075465},{x:.24831538485324267,y:.7723566006488801},{x:.17218438485324267,y:.7739936006488801},{x:.16854768223369815,y:.7737142062783378},{x:.16490357022768087,y:.7735589167265521},{x:.06552457022768086,y:.7594769167265522},{x:.06454980411013514,y:.759239472501363},{x:.06355033417502035,y:.7591522452533723},{x:.06027159361314519,y:.7581973390517399},{x:.056953647958865025,y:.7573891174476861},{x:.056043934769293216,y:.7569660682109414},{x:.05508068656062633,y:.7566855300985751},{x:.05205123903764884,y:.7551093215998242},{x:.04895472299174925,y:.7536693306611393},{x:.04814502249785432,y:.7530769339577588},{x:.0472550131040978,y:.7526138659033472},{x:.04459127858939255,y:.7504769279161366},{x:.04183518952697092,y:.7484605056870383},{x:.041156618064647085,y:.7477215269901124},{x:.040374050047680896,y:.7470937244392954},{x:.03817839436480973,y:.744478178292066},{x:.035868647242901154,y:.7419628147479951},{x:.03534728193289863,y:.7411056525944231},{x:.03470222894274521,y:.7403372416471526},{x:.03305902990826266,y:.7373436013115269},{x:.03128438701344127,y:.73442596046285},{x:.030940263632238257,y:.7334835551134912},{x:.030457514693559486,y:.7326040653715413},{x:.029429919524844063,y:.7293473747667649},{x:.028258579388326675,y:.7261395799150647},{x:.028104922404476318,y:.7251481474789881},{x:.02780302928825676,y:.7241913772399183},{x:.02743052789135989,y:.7207967891595589},{x:.026907504457698045,y:.7174221140620348},{x:.02695021882291786,y:.7164197547317572},{x:.026840783112310238,y:.7154224721392919},{x:.019456783112310236,y:.0515304721392918}],[{x:.1099671672449683,y:.09691838411671685},{x:.1164055200593884,y:.675787686211921},{x:.17390769441284104,y:.6839357418297609},{x:.2408956143230629,y:.6824953400894312},{x:.35035782392371695,y:.652890743688808},{x:.42724604872976657,y:.5921661050862587},{x:.4720072878873445,y:.5089126143655517},{x:.4907125333997566,y:.41841792349882906},{x:.4925121994894803,y:.35037387509349616},{x:.4841787199640398,y:.2934992321564965},{x:.4684498534661817,y:.24911194023683725},{x:.41491413338319044,y:.1779099626338861},{x:.34401115658372555,y:.1329424859013802},{x:.21878934362335548,y:.0990224054430332},{x:.1099671672449683,y:.09691838411671685}]],E:[[{x:.035078,y:.05103000000000002},{x:.03594266238185463,y:.04225093550927423},{x:.03850342103699209,y:.03380924554357098},{x:.042661867446385456,y:.026029339514117924},{x:.04825819484660536,y:.019210194846605383},{x:.05507733951411791,y:.013613867446385479},{x:.06285724554357096,y:.009455421036992116},{x:.07129893550927423,y:.006894662381854655},{x:.080078,y:.0060300000000000215},{x:.521974,y:.0060300000000000215},{x:.5307530644907258,y:.006894662381854655},{x:.5391947544564291,y:.009455421036992116},{x:.5469746604858822,y:.013613867446385479},{x:.5537938051533947,y:.019210194846605383},{x:.5593901325536146,y:.026029339514117924},{x:.5635485789630079,y:.03380924554357098},{x:.5661093376181454,y:.04225093550927425},{x:.5669740000000001,y:.05103000000000002},{x:.5661093376181454,y:.05980906449072579},{x:.5635485789630079,y:.06825075445642906},{x:.5593901325536146,y:.07603066048588211},{x:.5537938051533947,y:.08284980515339466},{x:.5469746604858822,y:.08844613255361455},{x:.5391947544564291,y:.09260457896300792},{x:.5307530644907258,y:.09516533761814538},{x:.521974,y:.09603000000000002},{x:.125078,y:.09603000000000002},{x:.125078,y:.345019},{x:.389405,y:.345019},{x:.3981840644907258,y:.34588366238185464},{x:.40662575445642907,y:.3484444210369921},{x:.4144056604858821,y:.35260286744638547},{x:.42122480515339467,y:.35819919484660534},{x:.42682113255361454,y:.3650183395141179},{x:.4309795789630079,y:.372798245543571},{x:.43354033761814537,y:.3812399355092742},{x:.434405,y:.390019},{x:.43354033761814537,y:.3987980644907258},{x:.4309795789630079,y:.407239754456429},{x:.42682113255361454,y:.4150196604858821},{x:.42122480515339467,y:.42183880515339467},{x:.4144056604858821,y:.42743513255361454},{x:.40662575445642907,y:.43159357896300793},{x:.3981840644907258,y:.43415433761814537},{x:.389405,y:.435019},{x:.125078,y:.435019},{x:.125078,y:.684004},{x:.521974,y:.684004},{x:.5307530644907258,y:.6848686623818546},{x:.5391947544564291,y:.6874294210369921},{x:.5469746604858822,y:.6915878674463855},{x:.5537938051533947,y:.6971841948466053},{x:.5593901325536146,y:.7040033395141179},{x:.5635485789630079,y:.711783245543571},{x:.5661093376181454,y:.7202249355092742},{x:.5669740000000001,y:.729004},{x:.5661093376181454,y:.7377830644907257},{x:.5635485789630079,y:.746224754456429},{x:.5593901325536146,y:.7540046604858821},{x:.5537938051533947,y:.7608238051533946},{x:.5469746604858822,y:.7664201325536145},{x:.5391947544564291,y:.7705785789630079},{x:.5307530644907258,y:.7731393376181454},{x:.521974,y:.774004},{x:.080078,y:.774004},{x:.07129893550927423,y:.7731393376181454},{x:.06285724554357093,y:.7705785789630079},{x:.05507733951411791,y:.7664201325536145},{x:.04825819484660536,y:.7608238051533946},{x:.042661867446385456,y:.7540046604858821},{x:.03850342103699209,y:.746224754456429},{x:.03594266238185463,y:.7377830644907257},{x:.035078,y:.729004},{x:.035078,y:.05103000000000002}]],F:[[{x:.041426000000000004,y:.05103000000000002},{x:.04229066238185464,y:.04225093550927423},{x:.0448514210369921,y:.03380924554357098},{x:.04900986744638546,y:.026029339514117924},{x:.054606194846605366,y:.019210194846605383},{x:.06142533951411792,y:.013613867446385479},{x:.06920524554357096,y:.009455421036992116},{x:.07764693550927423,y:.006894662381854655},{x:.086426,y:.0060300000000000215},{x:.09520506449072577,y:.006894662381854655},{x:.10364675445642904,y:.009455421036992116},{x:.11142666048588211,y:.013613867446385486},{x:.11824580515339464,y:.019210194846605383},{x:.12384213255361454,y:.026029339514117924},{x:.1280005789630079,y:.03380924554357098},{x:.13056133761814537,y:.04225093550927425},{x:.131426,y:.05103000000000002},{x:.131426,y:.347323},{x:.447344,y:.347323},{x:.4561230644907258,y:.3481876623818546},{x:.4645647544564291,y:.35074842103699205},{x:.47234466048588214,y:.35490686744638544},{x:.47916380515339463,y:.3605031948466053},{x:.48476013255361455,y:.36732233951411786},{x:.48891857896300794,y:.37510224554357097},{x:.4914793376181454,y:.3835439355092742},{x:.492344,y:.392323},{x:.4914793376181454,y:.4011020644907258},{x:.48891857896300794,y:.409543754456429},{x:.48476013255361455,y:.4173236604858821},{x:.47916380515339463,y:.42414280515339464},{x:.47234466048588214,y:.4297391325536145},{x:.4645647544564291,y:.4338975789630079},{x:.4561230644907258,y:.43645833761814534},{x:.447344,y:.43732299999999996},{x:.131426,y:.43732299999999996},{x:.131426,y:.679393},{x:.515626,y:.679393},{x:.5244050644907258,y:.6802576623818547},{x:.532846754456429,y:.6828184210369922},{x:.5406266604858821,y:.6869768674463855},{x:.5474458051533947,y:.6925731948466054},{x:.5530421325536146,y:.6993923395141179},{x:.5572005789630079,y:.707172245543571},{x:.5597613376181454,y:.7156139355092743},{x:.5606260000000001,y:.7243930000000001},{x:.5597613376181454,y:.7331720644907258},{x:.5572005789630079,y:.7416137544564291},{x:.5530421325536146,y:.7493936604858822},{x:.5474458051533947,y:.7562128051533947},{x:.5406266604858821,y:.7618091325536146},{x:.532846754456429,y:.7659675789630079},{x:.5244050644907258,y:.7685283376181454},{x:.515626,y:.7693930000000001},{x:.10586481668800227,y:.7693930000000001},{x:.10364675445642904,y:.7705785789630079},{x:.09520506449072577,y:.7731393376181454},{x:.086426,y:.774004},{x:.0776469355092742,y:.7731393376181454},{x:.06920524554357094,y:.7705785789630079},{x:.06142533951411792,y:.7664201325536145},{x:.054606194846605366,y:.7608238051533946},{x:.04900986744638546,y:.7540046604858821},{x:.0448514210369921,y:.746224754456429},{x:.04229066238185464,y:.7377830644907257},{x:.041426000000000004,y:.729004},{x:.041426000000000004,y:.05103000000000002}]],G:[[{x:.011397831509003739,y:.41623356008285023},{x:.011618856500496228,y:.4138403978921803},{x:.011624876992355357,y:.4114370583257866},{x:.031979876992355355,y:.20994505832578658},{x:.0322125865037964,y:.20879027461506633},{x:.03227702681480045,y:.2076140405475535},{x:.033082276634523504,y:.2044745765152392},{x:.033722542929381774,y:.20129735748690203},{x:.034176068118796386,y:.2002101619949014},{x:.03446874211029117,y:.19906910061620064},{x:.03587099832954512,y:.19614705695158466},{x:.03711880677043453,y:.1931557970536144},{x:.03777571891913337,y:.19217797009338475},{x:.03828537929375919,y:.19111593175236494},{x:.08239837929375919,y:.11845093175236496},{x:.08400149586436068,y:.11631468084865614},{x:.08543403702225794,y:.1140604899753128},{x:.08664282877724949,y:.11279494315419919},{x:.08769326713863865,y:.11139516977529508},{x:.08968234215056696,y:.10961271886167734},{x:.09152712825517066,y:.10768131654967852},{x:.15960912825517065,y:.049144316549678456},{x:.16129904644183068,y:.0479582081853546},{x:.16285577619764602,y:.04660201166682107},{x:.1649006360722032,y:.045430348778213794},{x:.16682965744636918,y:.04407642028337947},{x:.16871850259167306,y:.043242789341903884},{x:.17050990103726027,y:.04221635466854622},{x:.25257090103726026,y:.005359354668546305},{x:.2555014876285109,y:.004375276469579791},{x:.2583690572759664,y:.003220377345201267},{x:.25967433471463813,y:.0029740526131209386},{x:.2609335532503684,y:.0025512125194529015},{x:.2639998135747395,y:.0021577721889240492},{x:.26703759331756605,y:.0015844992133087973},{x:.35309859331756605,y:-.006038500786691249},{x:.3541123404679588,y:-.006028536718703998},{x:.3551159915981175,y:-.006171599559831674},{x:.3585153812714738,y:-.005985259459774228},{x:.361919709861342,y:-.005951798491220829},{x:.36291203425126567,y:-.00574425362199294},{x:.3639243106821295,y:-.005688764928569123},{x:.3672220288859873,y:-.004842817275250554},{x:.37055441634545594,y:-.004145847688979236},{x:.3714871835051078,y:-.003748697851442632},{x:.37246918402112983,y:-.003496790022837183},{x:.4525501840211298,y:.02567020997716287},{x:.4548144879103283,y:.026756908839544704},{x:.45716266717941917,y:.02764799841997529},{x:.45878159595452606,y:.02866082810547922},{x:.4605032369247208,y:.02948708879101062},{x:.4625120284186098,y:.03099465081435172},{x:.46464124512829075,y:.032326725408117304},{x:.4660314733714444,y:.03363593119127184},{x:.46755883802994086,y:.034782191000688294},{x:.46923492039795345,y:.03665268142188218},{x:.47106334994415,y:.038374550149380404},{x:.53517534994415,y:.11188255014938031},{x:.5366918789074028,y:.11401106513419482},{x:.5383741006891446,y:.11601120663268963},{x:.5392453250303639,y:.11759493887966013},{x:.5402941837404813,y:.11906705813061697},{x:.5413663203511413,y:.12145053442062861},{x:.5426260104640281,y:.12374042895017842},{x:.5431715236397763,y:.1254636976633839},{x:.5439130326051668,y:.12711215273922669},{x:.5444995752545472,y:.12965899467727895},{x:.5452883245139833,y:.13215064287530112},{x:.5896823245139834,y:.3420786428753011},{x:.5897067631627176,y:.34229945557802055},{x:.5897717252277992,y:.3425119065778641},{x:.5901917436343531,y:.346681442891342},{x:.5906527316031134,y:.3508466486034176},{x:.590633622248786,y:.3510679861958218},{x:.5906558889520306,y:.35128902847947113},{x:.590254400640623,y:.3554603898480228},{x:.5898939395311937,y:.3596354965915505},{x:.5898320165355749,y:.3598488531940917},{x:.589810732180064,y:.3600699922305474},{x:.5886031661213459,y:.3640828755761044},{x:.5874351082520124,y:.3681074363403587},{x:.5873327512810971,y:.3683046127784522},{x:.5872687338126765,y:.3685173503185603},{x:.5853014960930706,y:.3722175427846122},{x:.5833707292727002,y:.37593689595641405},{x:.5832318718474782,y:.3761103148501221},{x:.583127581421558,y:.3763064755095204},{x:.5804762718833937,y:.37955178077467916},{x:.577856994398102,y:.38282299369748307},{x:.5776869727315521,y:.38296599065597503},{x:.5775464171707139,y:.38313803609053093},{x:.5743129241526703,y:.3858037388934479},{x:.5711057933673104,y:.38850110068914456},{x:.5709111412967293,y:.38860818041949885},{x:.5707397220723512,y:.3887494990196469},{x:.5670483068977423,y:.3907331578965531},{x:.5633765710498215,y:.39275301046402805},{x:.5631647689451196,y:.3928200579522583},{x:.5629690736018615,y:.39292521892344706},{x:.5589615952856832,y:.39415060297614785},{x:.5549663571246989,y:.39541532451398326},{x:.5547455444219794,y:.39543976316271745},{x:.5545330934221359,y:.39550472522779906},{x:.5503635571086607,y:.3959247436343527},{x:.5461983513965825,y:.39638573160311336},{x:.5459770138041778,y:.396366622248786},{x:.5457559715205288,y:.3963888889520305},{x:.32969497152052885,y:.39686888895203054},{x:.32091400776945256,y:.3960237321800639},{x:.31246664968143967,y:.39348173381267654},{x:.3046775244904796,y:.389340581421558},{x:.29784596390946905,y:.3837594171707138},{x:.2922345009803531,y:.3769527220723512},{x:.2880587810765529,y:.3691820736018615},{x:.2854792747722009,y:.3607460934221358},{x:.2845951110479695,y:.3519689715205288},{x:.2854402678199361,y:.3431880077694525},{x:.2879822661873235,y:.33474064968143963},{x:.29212341857844204,y:.32695152449047954},{x:.29770458282928614,y:.320119963909469},{x:.3045112779276488,y:.31450850098035305},{x:.31228192639813845,y:.3103327810765529},{x:.3207179065778642,y:.3077532747722009},{x:.3294950284794712,y:.30686911104796943},{x:.49017057214072013,y:.30651215509128404},{x:.45965681956734333,y:.16222033524572274},{x:.4108567628008364,y:.10626833604444391},{x:.35107150330533127,y:.0844934248457151},{x:.2825297162303303,y:.09056463065174497},{x:.21333680545064249,y:.12164203785622632},{x:.15562253329738823,y:.17126485077351794},{x:.1205010051965362,y:.2291186770707186},{x:.10185989085514695,y:.41364510354456796},{x:.13655871914038514,y:.5827099362211221},{x:.190187982415082,y:.6526649281775241},{x:.2569251189377254,y:.6872526727450867},{x:.3715857772516941,y:.6967797369989467},{x:.4883723057362636,y:.6711064406866752},{x:.49713228125159653,y:.6700660353148682},{x:.5059269093127409,y:.6707546074846872},{x:.5144182172953911,y:.6731456957538017},{x:.5222798889957544,y:.6771474119409674},{x:.529209804779262,y:.6826059723372997},{x:.5349416518686954,y:.6893116075279637},{x:.5392551585948644,y:.6970066237131456},{x:.5419845593133248,y:.7053953057362636},{x:.5430249646851317,y:.7141552812515966},{x:.5423363925153128,y:.722949909312741},{x:.5399453042461984,y:.7314412172953911},{x:.5359435880590326,y:.7393028889957545},{x:.5304850276627003,y:.7462328047792621},{x:.5237793924720363,y:.7519646518686954},{x:.5160843762868544,y:.7562781585948645},{x:.5076956942637364,y:.7590075593133249},{x:.38428269426373635,y:.7861375593133247},{x:.3819812519937546,y:.7864108971664274},{x:.3797153389243004,y:.7868977113667894},{x:.37761181025895013,y:.7869298473215656},{x:.37552271874840343,y:.7871779646851318},{x:.3732121724765259,y:.7869970613144796},{x:.370894825552222,y:.7870324638061055},{x:.24049282555222196,y:.7761974638061055},{x:.24043595887820252,y:.7761870527203061},{x:.24037815170992255,y:.776187787986971},{x:.2360978388350013,y:.7753928346522221},{x:.2318155069745089,y:.7746088302209789},{x:.231761764079766,y:.7745875250435272},{x:.2317049242166051,y:.7745769685631748},{x:.227661944055434,y:.7729622424167508},{x:.22361484767780643,y:.7713578609091699},{x:.22356629387164592,y:.7713264803860874},{x:.22351260563766895,y:.7713050378383375},{x:.13987060563766895,y:.7279560378383374},{x:.13900257424615298,y:.727391873258006},{x:.13805978359276902,y:.7269641982011581},{x:.13531067905832161,y:.7249923788161832},{x:.13247402218179744,y:.7231487342752945},{x:.13173273281971745,y:.7224260654354895},{x:.1308914928889356,y:.7218226787027751},{x:.128579894506033,y:.7193524235854973},{x:.12615742040314795,y:.7169907998540069},{x:.12557136040496888,y:.7161373985129647},{x:.12486399957555622,y:.7153814879181388},{x:.05884299957555622,y:.6292624879181389},{x:.05814177883495547,y:.6281337214080167},{x:.057292540659828396,y:.62711165542026},{x:.05581896837632758,y:.6243946553718145},{x:.05418793684040681,y:.6217691571968414},{x:.05372040128165289,y:.6205252782386133},{x:.05308687616260495,y:.6193571728131668},{x:.052171678571706244,y:.6164048994674943},{x:.051084196133809955,y:.613511651036194},{x:.05086831288622884,y:.6122004612006492},{x:.05047484683830003,y:.6109312059739318},{x:.012315846838300032,y:.4250072059739319},{x:.012065742114142504,y:.42261690788694145},{x:.011602778634016861,y:.4202585732767163},{x:.011607833784388823,y:.41824059149262255},{x:.011397831509003739,y:.41623356008285023}]],H:[[{x:.021894999999999998,y:.05103000000000002},{x:.02275966238185463,y:.04225093550927423},{x:.025320421036992093,y:.03380924554357098},{x:.029478867446385455,y:.026029339514117924},{x:.03507519484660536,y:.019210194846605383},{x:.04189433951411791,y:.013613867446385479},{x:.04967424554357096,y:.009455421036992116},{x:.05811593550927423,y:.006894662381854655},{x:.066895,y:.0060300000000000215},{x:.07567406449072576,y:.006894662381854655},{x:.08411575445642903,y:.009455421036992116},{x:.0918956604858821,y:.013613867446385486},{x:.09871480515339463,y:.019210194846605383},{x:.10431113255361453,y:.026029339514117924},{x:.1084695789630079,y:.03380924554357098},{x:.11103033761814536,y:.04225093550927425},{x:.111895,y:.05103000000000002},{x:.111895,y:.359342},{x:.490157,y:.359342},{x:.490157,y:.05103000000000002},{x:.49102166238185463,y:.04225093550927423},{x:.49358242103699207,y:.03380924554357098},{x:.49774086744638546,y:.026029339514117924},{x:.5033371948466053,y:.019210194846605383},{x:.5101563395141179,y:.013613867446385479},{x:.517936245543571,y:.009455421036992116},{x:.5263779355092743,y:.006894662381854655},{x:.535157,y:.0060300000000000215},{x:.5439360644907257,y:.006894662381854655},{x:.552377754456429,y:.009455421036992116},{x:.5601576604858821,y:.013613867446385486},{x:.5669768051533947,y:.019210194846605383},{x:.5725731325536145,y:.026029339514117924},{x:.5767315789630079,y:.03380924554357098},{x:.5792923376181454,y:.04225093550927425},{x:.580157,y:.05103000000000002},{x:.580157,y:.729004},{x:.5792923376181454,y:.7377830644907257},{x:.5767315789630079,y:.746224754456429},{x:.5725731325536145,y:.7540046604858821},{x:.5669768051533947,y:.7608238051533946},{x:.5601576604858821,y:.7664201325536145},{x:.552377754456429,y:.7705785789630079},{x:.5439360644907257,y:.7731393376181454},{x:.535157,y:.774004},{x:.5263779355092743,y:.7731393376181454},{x:.517936245543571,y:.7705785789630079},{x:.5101563395141179,y:.7664201325536145},{x:.5033371948466053,y:.7608238051533946},{x:.49774086744638546,y:.7540046604858821},{x:.49358242103699207,y:.746224754456429},{x:.49102166238185463,y:.7377830644907257},{x:.490157,y:.729004},{x:.490157,y:.44934199999999996},{x:.111895,y:.44934199999999996},{x:.111895,y:.729004},{x:.11103033761814536,y:.7377830644907257},{x:.10846957896300788,y:.746224754456429},{x:.10431113255361453,y:.7540046604858821},{x:.09871480515339463,y:.7608238051533946},{x:.09189566048588207,y:.7664201325536145},{x:.08411575445642903,y:.7705785789630079},{x:.07567406449072576,y:.7731393376181454},{x:.066895,y:.774004},{x:.05811593550927421,y:.7731393376181454},{x:.04967424554357093,y:.7705785789630079},{x:.04189433951411791,y:.7664201325536145},{x:.03507519484660536,y:.7608238051533946},{x:.029478867446385455,y:.7540046604858821},{x:.025320421036992093,y:.746224754456429},{x:.02275966238185463,y:.7377830644907257},{x:.021894999999999998,y:.729004},{x:.021894999999999998,y:.05103000000000002}]],I:[[{x:.25602600000000003,y:.05103000000000002},{x:.25689066238185465,y:.04225093550927423},{x:.2594514210369921,y:.03380924554357098},{x:.2636098674463855,y:.026029339514117924},{x:.26920619484660535,y:.019210194846605383},{x:.27602533951411795,y:.013613867446385479},{x:.283805245543571,y:.009455421036992116},{x:.2922469355092743,y:.006894662381854655},{x:.301026,y:.0060300000000000215},{x:.3098050644907258,y:.006894662381854655},{x:.3182467544564291,y:.009455421036992116},{x:.32602666048588214,y:.013613867446385486},{x:.3328458051533947,y:.019210194846605383},{x:.33844213255361455,y:.026029339514117924},{x:.34260057896300794,y:.03380924554357098},{x:.3451613376181454,y:.04225093550927425},{x:.346026,y:.05103000000000002},{x:.346026,y:.729004},{x:.3451613376181454,y:.7377830644907257},{x:.34260057896300794,y:.746224754456429},{x:.33844213255361455,y:.7540046604858821},{x:.3328458051533947,y:.7608238051533946},{x:.32602666048588214,y:.7664201325536145},{x:.3182467544564291,y:.7705785789630079},{x:.3098050644907258,y:.7731393376181454},{x:.301026,y:.774004},{x:.2922469355092743,y:.7731393376181454},{x:.283805245543571,y:.7705785789630079},{x:.27602533951411795,y:.7664201325536145},{x:.26920619484660535,y:.7608238051533946},{x:.2636098674463855,y:.7540046604858821},{x:.2594514210369921,y:.746224754456429},{x:.25689066238185465,y:.7377830644907257},{x:.25602600000000003,y:.729004},{x:.25602600000000003,y:.05103000000000002}]],J:[[{x:.0492700034030052,y:.22191686675397743},{x:.05066400340300519,y:.18438286675397747},{x:.05116783173382979,y:.18068175768771486},{x:.05155979864248331,y:.17696713613904605},{x:.05874879864248331,y:.14209513613904604},{x:.05880353678004782,y:.1419191061579158},{x:.05882437610196882,y:.14173594355086241},{x:.060112741823836933,y:.13770889095133898},{x:.06136821695472819,y:.13367146342030908},{x:.0614562450600313,y:.133509494686791},{x:.06151241721221637,y:.13333391704789688},{x:.07511841721221638,y:.10184091704789687},{x:.07557207470549994,y:.10102219111224012},{x:.07589401217340325,y:.10014328637013822},{x:.07770640675364808,y:.09717031380613761},{x:.07939396242231754,y:.09412474393402119},{x:.07999862852050488,y:.09341025377409445},{x:.08048584585939292,y:.09261104382444658},{x:.10112984585939291,y:.06520804382444652},{x:.10197173470408774,y:.06429305686105671},{x:.10267645797068833,y:.06326868237508665},{x:.10495244591663212,y:.06105354143298789},{x:.10710291637241387,y:.058716353519649434},{x:.10810713366035453,y:.05798319214000915},{x:.10899816141532707,y:.05711598541156246},{x:.1373061614153271,y:.03451898541156248},{x:.13912164740426522,y:.03334117545586675},{x:.1408101373903697,y:.03198757757075004},{x:.14281300361792376,y:.03094638082514127},{x:.14470672673278473,y:.029717813955661344},{x:.1467171079910441,y:.028916819034200267},{x:.14863722796281134,y:.027918638208003034},{x:.20683022796281134,y:.004592638208003076},{x:.20850921914024034,y:.004104279923540699},{x:.2101185278310492,y:.0034204446176558795},{x:.21273469892125257,y:.0028752394826936905},{x:.21530073387518742,y:.0021288719943945503},{x:.21704273768291169,y:.0019774523068977427},{x:.21875453360851305,y:.0016207172553791283},{x:.2976895336085131,y:-.0068802827446208525},{x:.29850402526559744,y:-.006887701289741747},{x:.2993068957135494,y:-.007024999279811796},{x:.30290822222422875,y:-.006927815554356645},{x:.3065107103471747,y:-.0069606277022222565},{x:.30731099906181086,y:-.006809004262418785},{x:.30812522808832776,y:-.0067870318558802545},{x:.3663632280883278,y:.0005399681441197179},{x:.367446910459264,y:.0007860908462292888},{x:.3685549625674647,y:.000870733572342984},{x:.37174033606180384,y:.0017612008405818037},{x:.37496569353784953,y:.0024937343933679954},{x:.37598053709868623,y:.002946543859479297},{x:.3770507853196353,y:.0032457304419443098},{x:.4423997853196353,y:.028649730441944292},{x:.44339023767510893,y:.0291515261148112},{x:.4444435524779453,y:.029502699422305954},{x:.4473177196266577,y:.03114131738307233},{x:.45026902431580135,y:.03263654520916596},{x:.4511425499275847,y:.03332192668785485},{x:.4521071150681948,y:.03387184382278591},{x:.4818761150681948,y:.0549598438227859},{x:.482276572000261,y:.05530719927286456},{x:.48273081061614365,y:.05558049186877649},{x:.48560514894853896,y:.05819439949693127},{x:.48854004666413575,y:.060740123232255375},{x:.48886504324193186,y:.061158929616590856},{x:.48925723704963914,y:.06151558852974905},{x:.5141262370496392,y:.08904658852974903},{x:.5149956342421861,y:.09022293690705172},{x:.5160117353213701,y:.09127516577002369},{x:.5176116053111659,y:.0937625081737249},{x:.5193693801104602,y:.0961408866071265},{x:.519992577896003,y:.09746424275846524},{x:.5207838752101566,y:.09869448482562238},{x:.5385188752101566,y:.1333154848256224},{x:.5396070973995049,y:.13607819549886616},{x:.5408707323766272,y:.1387652058155645},{x:.5412201620380835,y:.14017334347255597},{x:.5417518824254063,y:.14152324205357814},{x:.5422802166156467,y:.1444451696332536},{x:.5429953614930656,y:.1473270727547606},{x:.5523413614930656,y:.2113020727547606},{x:.5524962602601196,y:.21460328519222147},{x:.5528139181508881,y:.2178928278123641},{x:.5518389181508881,y:.7290898278123641},{x:.5509575131661891,y:.7378672271777721},{x:.5483806584624608,y:.7463040176932935},{x:.5442073811208505,y:.7540759782308231},{x:.5385980578491955,y:.7608844367054697},{x:.5317682517950807,y:.7664677478762799},{x:.5239804285749665,y:.7706113482261165},{x:.5155338698677402,y:.7731560015172932},{x:.5067531721876358,y:.7740039181508881},{x:.4979757728222279,y:.7731225131661891},{x:.4895389823067066,y:.7705456584624607},{x:.48176702176917696,y:.7663723811208505},{x:.4749585632945304,y:.7607630578491954},{x:.46937525212372017,y:.7539332517950806},{x:.4652316517738835,y:.7461454285749665},{x:.46268699848270683,y:.7376988698677401},{x:.461839081849112,y:.7289181721876359},{x:.462807763438783,y:.22103394388498027},{x:.45501827222953295,y:.16771351802238937},{x:.44337725180090903,y:.14498874958374325},{x:.42579959063650114,y:.12552955984883984},{x:.4046143325842134,y:.11052217895574154},{x:.34961801160788414,y:.08914271579513207},{x:.3021031758959219,y:.08316481131246532},{x:.2345584384824393,y:.09043912324952764},{x:.18827433696976265,y:.10899157718530504},{x:.16959144206995366,y:.1239052897771866},{x:.155605251275173,y:.14247066404328695},{x:.14596289111822178,y:.16478926233983734},{x:.14046290234137151,y:.19146830095804884},{x:.13920799659699482,y:.22525713324602253},{x:.1380181031040591,y:.23399805813086086},{x:.13514580323043823,y:.24233889189031887},{x:.13070147784947123,y:.24995910096061402},{x:.12485591989314217,y:.25656584498063745},{x:.11783377087548613,y:.26190523048280423},{x:.10990488804518514,y:.26577206787662816},{x:.10137397392283892,y:.2680177567696118},{x:.09256886675397746,y:.2685559965969948},{x:.08382794186913914,y:.26736610310405906},{x:.07548710810968112,y:.26449380323043825},{x:.06786689903938595,y:.2600494778494712},{x:.06126015501936256,y:.2542039198931421},{x:.055920769517195726,y:.24718177087548612},{x:.052053932123371845,y:.23925288804518513},{x:.04980824323038816,y:.2307219739228389},{x:.0492700034030052,y:.22191686675397743}]],K:[[{x:-.009598999999999996,y:.05103000000000002},{x:-.008734337618145363,y:.04225093550927423},{x:-.006173578963007902,y:.03380924554357098},{x:-.002015132553614539,y:.026029339514117924},{x:.003581194846605365,y:.019210194846605383},{x:.010400339514117916,y:.013613867446385479},{x:.018180245543570964,y:.009455421036992116},{x:.026621935509274233,y:.006894662381854655},{x:.035401,y:.0060300000000000215},{x:.04418006449072578,y:.006894662381854655},{x:.05262175445642904,y:.009455421036992116},{x:.06040166048588211,y:.013613867446385486},{x:.06722080515339464,y:.019210194846605383},{x:.07281713255361454,y:.026029339514117924},{x:.07697557896300791,y:.03380924554357098},{x:.07953633761814537,y:.04225093550927425},{x:.080401,y:.05103000000000002},{x:.080401,y:.29048154892126793},{x:.18934433769134518,y:.3772029724897202},{x:.5349508182082354,y:.03415901207017739},{x:.5417907398770268,y:.02858809778868676},{x:.5495860658299886,y:.024458629583942203},{x:.5580372260624178,y:.02192930060321959},{x:.5668194472260474,y:.021097311540784057},{x:.5755952334866855,y:.021994635269720175},{x:.5840273362998535,y:.024586788142349852},{x:.5917917146832189,y:.028774155177474024},{x:.5985899879298227,y:.03439581820823536},{x:.6041609022113132,y:.04123573987702663},{x:.6082903704160578,y:.04903106582998847},{x:.6108196993967804,y:.05748222606241771},{x:.6116516884592159,y:.06626444722604735},{x:.6107543647302798,y:.07504023348668547},{x:.6081622118576502,y:.08347233629985339},{x:.603974844822526,y:.0912367146832188},{x:.5983531817917647,y:.09803498792982254},{x:.26024203797571366,y:.43363918627462555},{x:.5302838206406747,y:.648598708462355},{x:.5366139141989896,y:.654742773070568},{x:.5416237292416561,y:.6620037211908337},{x:.545120741386121,y:.6701025186588768},{x:.5469705624168195,y:.6787279332298585},{x:.5471021047489336,y:.6875484950590041},{x:.5455103132844098,y:.6962252349018474},{x:.542256359676543,y:.7044247105121999},{x:.537465291537645,y:.7118318206406747},{x:.531321226929432,y:.7181619141989897},{x:.5240602788091663,y:.7231717292416562},{x:.5159614813411232,y:.726668741386121},{x:.5073360667701415,y:.7285185624168196},{x:.498515504940996,y:.7286501047489337},{x:.48983876509815266,y:.7270583132844098},{x:.48163928948780005,y:.723804359676543},{x:.47423217935932527,y:.719013291537645},{x:.080401,y:.4055145384845117},{x:.080401,y:.729004},{x:.07953633761814537,y:.7377830644907257},{x:.07697557896300788,y:.746224754456429},{x:.07281713255361454,y:.7540046604858821},{x:.06722080515339464,y:.7608238051533946},{x:.06040166048588208,y:.7664201325536145},{x:.052621754456429054,y:.7705785789630079},{x:.04418006449072578,y:.7731393376181454},{x:.035401,y:.774004},{x:.026621935509274212,y:.7731393376181454},{x:.018180245543570936,y:.7705785789630079},{x:.010400339514117906,y:.7664201325536145},{x:.003581194846605358,y:.7608238051533946},{x:-.002015132553614539,y:.7540046604858821},{x:-.006173578963007902,y:.746224754456429},{x:-.008734337618145363,y:.7377830644907257},{x:-.009598999999999996,y:.729004},{x:-.009598999999999996,y:.05103000000000002}]],L:[[{x:.030439999999999995,y:.05103000000000002},{x:.03130466238185463,y:.04225093550927423},{x:.03386542103699209,y:.03380924554357098},{x:.03802386744638545,y:.026029339514117924},{x:.043620194846605356,y:.019210194846605383},{x:.05043933951411791,y:.013613867446385479},{x:.058219245543570955,y:.009455421036992116},{x:.06666093550927422,y:.006894662381854655},{x:.07544,y:.0060300000000000215},{x:.526613,y:.0060300000000000215},{x:.5353920644907257,y:.006894662381854655},{x:.543833754456429,y:.009455421036992116},{x:.5516136604858821,y:.013613867446385479},{x:.5584328051533947,y:.019210194846605383},{x:.5640291325536145,y:.026029339514117924},{x:.5681875789630079,y:.03380924554357098},{x:.5707483376181454,y:.04225093550927425},{x:.571613,y:.05103000000000002},{x:.5707483376181454,y:.05980906449072579},{x:.5681875789630079,y:.06825075445642906},{x:.5640291325536145,y:.07603066048588211},{x:.5584328051533947,y:.08284980515339466},{x:.5516136604858821,y:.08844613255361455},{x:.543833754456429,y:.09260457896300792},{x:.5353920644907257,y:.09516533761814538},{x:.526613,y:.09603000000000002},{x:.12043999999999999,y:.09603000000000002},{x:.12043999999999999,y:.729004},{x:.11957533761814536,y:.7377830644907257},{x:.11701457896300788,y:.746224754456429},{x:.11285613255361453,y:.7540046604858821},{x:.10725980515339463,y:.7608238051533946},{x:.10044066048588207,y:.7664201325536145},{x:.09266075445642903,y:.7705785789630079},{x:.08421906449072576,y:.7731393376181454},{x:.07544,y:.774004},{x:.06666093550927422,y:.7731393376181454},{x:.05821924554357093,y:.7705785789630079},{x:.05043933951411791,y:.7664201325536145},{x:.043620194846605356,y:.7608238051533946},{x:.03802386744638545,y:.7540046604858821},{x:.03386542103699209,y:.746224754456429},{x:.03130466238185463,y:.7377830644907257},{x:.030439999999999995,y:.729004},{x:.030439999999999995,y:.05103000000000002}]],M:[[{x:-.0025190000000000004,y:.05103000000000002},{x:-.001654337618145367,y:.04225093550927423},{x:.0009064210369920944,y:.03380924554357098},{x:.005064867446385457,y:.026029339514117924},{x:.010661194846605361,y:.019210194846605383},{x:.017480339514117912,y:.013613867446385479},{x:.02526024554357096,y:.009455421036992116},{x:.03370193550927423,y:.006894662381854655},{x:.042481,y:.0060300000000000215},{x:.051260064490725774,y:.006894662381854655},{x:.05970175445642904,y:.009455421036992116},{x:.06748166048588208,y:.013613867446385486},{x:.07430080515339463,y:.019210194846605383},{x:.07989713255361454,y:.026029339514117924},{x:.0840555789630079,y:.03380924554357098},{x:.08661633761814536,y:.04225093550927425},{x:.087481,y:.05103000000000002},{x:.087481,y:.5631122522964573},{x:.26219554141599577,y:.26476777519375044},{x:.26376288989624813,y:.2626088267569117},{x:.2651577075441738,y:.2603345964826191},{x:.26634817172230724,y:.2590477232579252},{x:.26737807478439135,y:.2576290804774607},{x:.2693364970488442,y:.25581739014918375},{x:.271148193983327,y:.2538589739959976},{x:.27256684023788735,y:.25282907571933333},{x:.27385371747828813,y:.25163861588213104},{x:.27612795245761435,y:.25024380590572387},{x:.27828690618147356,y:.24867646470811877},{x:.2798792167324836,y:.24794311979268302},{x:.28137361418054185,y:.2470265916026687},{x:.2838762642998919,y:.24610226374330602},{x:.28629950743227456,y:.24498622954453103},{x:.28800429067823724,y:.24457762002415934},{x:.28964877947809164,y:.24397024514568044},{x:.29228366929688115,y:.24355192080462856},{x:.2948780779631802,y:.2429300821730634},{x:.29662982004000654,y:.24286191068247276},{x:.29836120340931876,y:.24258703019148947},{x:.3010270755894747,y:.24269078533857608},{x:.3036929481196057,y:.24258703918410057},{x:.30542433056167173,y:.24286192551544342},{x:.30717607240852984,y:.24293010291506947},{x:.3097704789772072,y:.24355195029817853},{x:.3124053673848756,y:.24397028352732772},{x:.31404985413590314,y:.24457766395304856},{x:.3157546360035206,y:.24498627922405064},{x:.3181778753712451,y:.24610232159698525},{x:.32068052237260675,y:.24702665789836697},{x:.32217491672899246,y:.24794319112932822},{x:.32376722480624953,y:.2486765414159958},{x:.3259261732430879,y:.2502438898962479},{x:.3282004035173809,y:.2516387075441738},{x:.329487276742075,y:.2528291717223074},{x:.3309059195225393,y:.2538590747843914},{x:.3327176098508159,y:.2558174970488439},{x:.33467602600400237,y:.257629193983327},{x:.3357059242806667,y:.2590478402378874},{x:.33689638411786893,y:.2603347174782881},{x:.3382911940942761,y:.2626089524576143},{x:.3398585352918812,y:.26476790618147356},{x:.514571,y:.5631111449291359},{x:.514571,y:.05103000000000002},{x:.5154356623818547,y:.04225093550927423},{x:.5179964210369922,y:.03380924554357098},{x:.5221548674463855,y:.026029339514117924},{x:.5277511948466054,y:.019210194846605383},{x:.5345703395141179,y:.013613867446385479},{x:.542350245543571,y:.009455421036992116},{x:.5507919355092743,y:.006894662381854655},{x:.559571,y:.0060300000000000215},{x:.5683500644907258,y:.006894662381854655},{x:.576791754456429,y:.009455421036992116},{x:.5845716604858822,y:.013613867446385486},{x:.5913908051533947,y:.019210194846605383},{x:.5969871325536146,y:.026029339514117924},{x:.6011455789630079,y:.03380924554357098},{x:.6037063376181454,y:.04225093550927425},{x:.6045710000000001,y:.05103000000000002},{x:.6045710000000001,y:.729004},{x:.6044399806971988,y:.7303342613054065},{x:.6044919608158994,y:.7316699481196056},{x:.6040085293496043,y:.7347148603514975},{x:.6037063376181454,y:.7377830644907257},{x:.6033183147080721,y:.7390622046001841},{x:.6031087164726723,y:.7403823673848756},{x:.6020405410986152,y:.7432744596816038},{x:.6011455789630079,y:.746224754456429},{x:.6005154639484909,y:.7474036167328832},{x:.600052342101633,y:.7486575223726067},{x:.5984404722003996,y:.7512856532491108},{x:.5969871325536146,y:.7540046604858821},{x:.596139140401289,y:.7550379419131618},{x:.5954402924558263,y:.7561774035173808},{x:.5933466712837743,y:.758440575377949},{x:.5913908051533947,y:.7608238051533946},{x:.5903575237261146,y:.7616717973057207},{x:.589449806016673,y:.7626530260040023},{x:.5869548902613284,y:.7644642664232344},{x:.5845716604858822,y:.7664201325536145},{x:.5833927982094276,y:.7670502475681318},{x:.5823110938185264,y:.7678355352918812},{x:.579510761693201,y:.7691252393162225},{x:.576791754456429,y:.7705785789630079},{x:.5755126143469705,y:.7709666018730812},{x:.5742984925677255,y:.7715257704554689},{x:.5713003592655512,y:.772244375482538},{x:.5683500644907258,y:.7731393376181454},{x:.5670198031853202,y:.7732703569209465},{x:.5657199220368199,y:.7735819178269366},{x:.5626392041392276,y:.7737018082685412},{x:.559571,y:.774004},{x:.5582407386945936,y:.7738729806971988},{x:.5569050518803944,y:.7739249608158993},{x:.5538601396485026,y:.7734415293496042},{x:.5507919355092743,y:.7731393376181454},{x:.5495127953998159,y:.772751314708072},{x:.5481926326151244,y:.7725417164726722},{x:.5453005403183963,y:.7714735410986151},{x:.542350245543571,y:.7705785789630079},{x:.5411713832671168,y:.7699484639484908},{x:.5399174776273933,y:.769485342101633},{x:.5372893467508892,y:.7678734722003996},{x:.5345703395141179,y:.7664201325536145},{x:.5335370580868383,y:.765572140401289},{x:.5323975964826192,y:.7648732924558262},{x:.5301344246220511,y:.7627796712837742},{x:.5277511948466054,y:.7608238051533946},{x:.5269032026942794,y:.7597905237261146},{x:.5259219739959977,y:.7588828060166729},{x:.5241107335767656,y:.7563878902613284},{x:.5221548674463855,y:.7540046604858821},{x:.5215247524318682,y:.7528257982094275},{x:.5207394647081188,y:.7517440938185264},{x:.30102684980758887,y:.3765575080608823},{x:.08131245858400418,y:.7517442248062496},{x:.0805272117946797,y:.752825865136849},{x:.07989713255361454,y:.7540046604858821},{x:.07794121846393844,y:.7563879486998997},{x:.0761299252156086,y:.7588829195225393},{x:.07514874916275306,y:.7597905823884902},{x:.07430080515339463,y:.7608238051533946},{x:.0719175169393771,y:.7627797192430708},{x:.06965428252171184,y:.764873384117869},{x:.06851488325078628,y:.7655721885442563},{x:.06748166048588208,y:.7664201325536145},{x:.06476258657702469,y:.7678735078373721},{x:.06213438581945812,y:.7694854083973313},{x:.06088054980546198,y:.7699484997219428},{x:.05970175445642904,y:.7705785789630079},{x:.056751387338174995,y:.7714735630437544},{x:.05385922052190834,y:.7725417548543195},{x:.05253913197970031,y:.7727513367372549},{x:.051260064490725774,y:.7731393376181454},{x:.04819178511684276,y:.773441536759571},{x:.0451467965906812,y:.7739249698085104},{x:.04381118578262464,y:.7738729881355436},{x:.042481,y:.774004},{x:.039412720626117295,y:.7737018008585744},{x:.03633192759147018,y:.7735818970849305},{x:.035032121291898165,y:.7732703494826018},{x:.03370193550927423,y:.7731393376181454},{x:.030751568391020223,y:.7722443535373988},{x:.02775336399647938,y:.7715257207759494},{x:.026539313032545114,y:.7709665798438982},{x:.02526024554357096,y:.7705785789630079},{x:.02254117163471342,y:.7691252036792503},{x:.01974077519375046,y:.7678354585840041},{x:.01865913486315115,y:.7670502117946798},{x:.017480339514117912,y:.7664201325536145},{x:.015097051300099952,y:.7644642184639381},{x:.012602080477460715,y:.7626529252156086},{x:.011694417611510011,y:.7616717491627533},{x:.010661194846605361,y:.7608238051533946},{x:.008705280756928618,y:.7584405169393763},{x:.006611615882131057,y:.7561772825217118},{x:.005912811455744052,y:.7550378832507868},{x:.005064867446385457,y:.7540046604858821},{x:.0036114921626275165,y:.7512855865770239},{x:.0019995916026687363,y:.7486573858194581},{x:.0015365002780573323,y:.7474035498054622},{x:.0009064210369920944,y:.746224754456429},{x:11436956245516774e-21,y:.7432743873381747},{x:-.0010567548543195318,y:.7403822205219084},{x:-.0012663367372549837,y:.7390621319797002},{x:-.001654337618145367,y:.7377830644907257},{x:-.0019565367595708303,y:.7347147851168438},{x:-.0024399698085105087,y:.7316697965906812},{x:-.0023879881355436095,y:.730334185782624},{x:-.0025190000000000004,y:.729004},{x:-.0025190000000000004,y:.05103000000000002}]],N:[[{x:.022871000000000002,y:.05103000000000002},{x:.023735662381854636,y:.04225093550927423},{x:.026296421036992097,y:.03380924554357098},{x:.03045486744638546,y:.026029339514117924},{x:.036051194846605364,y:.019210194846605383},{x:.042870339514117915,y:.013613867446385479},{x:.05065024554357096,y:.009455421036992116},{x:.05909193550927423,y:.006894662381854655},{x:.067871,y:.0060300000000000215},{x:.07665006449072577,y:.006894662381854655},{x:.08509175445642904,y:.009455421036992116},{x:.0928716604858821,y:.013613867446385486},{x:.09969080515339464,y:.019210194846605383},{x:.10528713255361455,y:.026029339514117924},{x:.10944557896300791,y:.03380924554357098},{x:.11200633761814537,y:.04225093550927425},{x:.112871,y:.05103000000000002},{x:.112871,y:.5841703094604355},{x:.49710429367778214,y:.025528669675955993},{x:.4971050718109503,y:.02552774709009411},{x:.49710565506134197,y:.025526690456344234},{x:.49994880496714983,y:.022156103119426583},{x:.5027917749380927,y:.01878536401177818},{x:.5027927181072235,y:.018784610959395015},{x:.5027934962896407,y:.018783688415073364},{x:.5062395848358414,y:.016032536999645196},{x:.5096855265142521,y:.01328120162562755},{x:.5096865984738844,y:.013280647046104224},{x:.5096875416832135,y:.013279894044071351},{x:.5136041376200112,y:.011253903755746949},{x:.5175206253992491,y:.009227704391234041},{x:.5175217849545753,y:.009227369596750634},{x:.5175228569438108,y:.00922681507445236},{x:.5217594476858983,y:.008003843583871996},{x:.5259959731369073,y:.006780645934087934},{x:.5259971757268666,y:.006780543790608634},{x:.5259983353000632,y:.006780209058025982},{x:.5303921110410749,y:.006407254473822295},{x:.5347858668666982,y:.00603406533837119},{x:.5347870662764328,y:.00603419977121261},{x:.5347882688718429,y:.006034097691931008},{x:.5391703792739257,y:.006525492449663053},{x:.5435525159020149,y:.007016653277689966},{x:.5435536660388816,y:.007017019120673398},{x:.543554865441438,y:.007017153617542397},{x:.547756908459233,y:.008354013692199154},{x:.5519590228368241,y:.009690649448577907},{x:.5519600795017079,y:.0096912326425627},{x:.551961229619043,y:.009691598546943021},{x:.555821723096155,y:.01182254915564361},{x:.559682330324044,y:.013953293677782128},{x:.5596832529099061,y:.01395407181095043},{x:.5596843095436558,y:.013954655061341997},{x:.5630548968806759,y:.016797804967236304},{x:.5664256359882218,y:.01964077493809272},{x:.5664263890406048,y:.019641718107223288},{x:.5664273115849267,y:.019642496289640633},{x:.5691784630004857,y:.02308858483600535},{x:.5719297983743725,y:.026534526514252196},{x:.5719303529538958,y:.0265355984738845},{x:.5719311059559287,y:.0265365416832135},{x:.5739570962443242,y:.03045313762014873},{x:.575983295608766,y:.03436962539924916},{x:.5759836304032494,y:.03437078495457533},{x:.5759841849255477,y:.0343718569438108},{x:.5772071564160691,y:.03860844768569421},{x:.5784303540659121,y:.04284497313690728},{x:.5784304562093915,y:.04284617572686688},{x:.578430790941974,y:.042847335300063204},{x:.5788037455260991,y:.0