@tscircuit/runframe 0.0.869 → 0.0.871

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4365,7 +4365,7 @@ if (edgeAlpha == 0.0) {
4365
4365
  `;function o2t(n){const e=PK(n,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new as},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new Np(0,0,0,0)},uTroikaClipRect:{value:new Np(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new as},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new Ho},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new ja},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:t2t,vertexTransform:n2t,fragmentDefs:i2t,fragmentColorTransform:r2t,customRewriter({vertexShader:t,fragmentShader:i}){let r=/\buniform\s+vec3\s+diffuse\b/;return r.test(i)&&(i=i.replace(r,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),r.test(t)||(t=t.replace(pTe,`uniform vec3 diffuse;
4366
4366
  $&
4367
4367
  vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;
4368
- `))),{vertexShader:t,fragmentShader:i}}});return e.transparent=!0,e.forceSinglePass=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const NK=new JO({color:16777215,side:N1,transparent:!0}),ATe=8421504,RTe=new Ud,ID=new Jt,kK=new Jt,KA=[],s2t=new Jt,OK="+x+y";function PTe(n){return Array.isArray(n)?n[0]:n}let ITe=()=>{const n=new kp(new $5(1,1),NK);return ITe=()=>n,n},NTe=()=>{const n=new kp(new $5(1,1,32,1),NK);return NTe=()=>n,n};const a2t={type:"syncstart"},c2t={type:"synccomplete"},kTe=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],l2t=kTe.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let OTe=class extends kp{constructor(){const e=new e2t;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=ATe,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=OK,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(a2t),Y9t({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);const i=this._queuedSyncs;i&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{i.forEach(r=>r&&r())})),this.dispatchEvent(c2t),e&&e()})))}onBeforeRender(e,t,i,r,o,s){this.sync(),o.isTroikaTextMaterial&&this._prepareForRender(o)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(e){return o2t(e)}get material(){let e=this._derivedMaterial;const t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=NK.clone());if((!e||!e.isDerivedFrom(t))&&(e=this._derivedMaterial=this.createDerivedMaterial(t),t.addEventListener("dispose",function i(){t.removeEventListener("dispose",i),e.dispose()})),this.hasOutline()){let i=e._outlineMtl;return i||(i=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),i.isTextOutlineMaterial=!0,i.depthWrite=!1,i.map=null,e.addEventListener("dispose",function r(){e.removeEventListener("dispose",r),i.dispose()})),[i,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return PTe(this.material).getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return PTe(this.material).getDistanceMaterial()}set customDistanceMaterial(e){}_prepareForRender(e){const t=e.isTextOutlineMaterial,i=e.uniforms,r=this.textRenderInfo;if(r){const{sdfTexture:a,blockBounds:c}=r;i.uTroikaSDFTexture.value=a,i.uTroikaSDFTextureSize.value.set(a.image.width,a.image.height),i.uTroikaSDFGlyphSize.value=r.sdfGlyphSize,i.uTroikaSDFExponent.value=r.sdfExponent,i.uTroikaTotalBounds.value.fromArray(c),i.uTroikaUseGlyphColors.value=!t&&!!r.glyphColors;let l=0,u=0,d=0,h,f,m,y=0,g=0;if(t){let{outlineWidth:x,outlineOffsetX:w,outlineOffsetY:T,outlineBlur:N,outlineOpacity:R}=this;l=this._parsePercent(x)||0,u=Math.max(0,this._parsePercent(N)||0),h=R,y=this._parsePercent(w)||0,g=this._parsePercent(T)||0}else d=Math.max(0,this._parsePercent(this.strokeWidth)||0),d&&(m=this.strokeColor,i.uTroikaStrokeColor.value.set(m??ATe),f=this.strokeOpacity,f==null&&(f=1)),h=this.fillOpacity;i.uTroikaEdgeOffset.value=l,i.uTroikaPositionOffset.value.set(y,g),i.uTroikaBlurRadius.value=u,i.uTroikaStrokeWidth.value=d,i.uTroikaStrokeOpacity.value=f,i.uTroikaFillOpacity.value=h??1,i.uTroikaCurveRadius.value=this.curveRadius||0;let b=this.clipRect;if(b&&Array.isArray(b)&&b.length===4)i.uTroikaClipRect.value.fromArray(b);else{const x=(this.fontSize||.1)*100;i.uTroikaClipRect.value.set(c[0]-x,c[1]-x,c[2]+x,c[3]+x)}this.geometry.applyClipRect(i.uTroikaClipRect.value)}i.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const o=t?this.outlineColor||0:this.color;if(o==null)delete e.color;else{const a=e.hasOwnProperty("color")?e.color:e.color=new Ho;(o!==a._input||typeof o=="object")&&a.set(a._input=o)}let s=this.orientation||OK;if(s!==e._orientation){let a=i.uTroikaOrient.value;s=s.replace(/[^-+xyz]/g,"");let c=s!==OK&&s.match(/^([-+])([xyz])([-+])([xyz])$/);if(c){let[,l,u,d,h]=c;ID.set(0,0,0)[u]=l==="-"?1:-1,kK.set(0,0,0)[h]=d==="-"?-1:1,RTe.lookAt(s2t,ID.cross(kK),kK),a.setFromMatrix4(RTe)}else a.identity();e._orientation=s}}_parsePercent(e){if(typeof e=="string"){let t=e.match(/^(-?[\d.]+)%$/),i=t?parseFloat(t[1]):NaN;e=(isNaN(i)?0:i/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new as){t.copy(e);const i=this.curveRadius;return i&&(t.x=Math.atan2(e.x,Math.abs(i)-Math.abs(e.z))*Math.abs(i)),t}worldPositionToTextCoords(e,t=new as){return ID.copy(e),this.localPositionToTextCoords(this.worldToLocal(ID),t)}raycast(e,t){const{textRenderInfo:i,curveRadius:r}=this;if(i){const o=i.blockBounds,s=r?NTe():ITe(),a=s.geometry,{position:c,uv:l}=a.attributes;for(let u=0;u<l.count;u++){let d=o[0]+l.getX(u)*(o[2]-o[0]);const h=o[1]+l.getY(u)*(o[3]-o[1]);let f=0;r&&(f=r-Math.cos(d/r)*r,d=Math.sin(d/r)*r),c.setXYZ(u,d,h,f)}a.boundingSphere=this.geometry.boundingSphere,a.boundingBox=this.geometry.boundingBox,s.matrixWorld=this.matrixWorld,s.material.side=this.material.side,KA.length=0,s.raycast(e,KA);for(let u=0;u<KA.length;u++)KA[u].object=this,t.push(KA[u])}}copy(e){const t=this.geometry;return super.copy(e),this.geometry=t,l2t.forEach(i=>{this[i]=e[i]}),this}clone(){return new this.constructor().copy(this)}};kTe.forEach(n=>{const e="_private_"+n;Object.defineProperty(OTe.prototype,n,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})}),new zE,new Ho;const DTe={type:"change"},DK={type:"start"},LTe={type:"end"},ND=new BA,zTe=new qS,u2t=Math.cos(70*HO.DEG2RAD);let d2t=class extends DE{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new Jt,this.cursor=new Jt,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:u6.ROTATE,MIDDLE:u6.DOLLY,RIGHT:u6.PAN},this.touches={ONE:d6.ROTATE,TWO:d6.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(de){de.addEventListener("keydown",Ut),this._domElementKeyEvents=de},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",Ut),this._domElementKeyEvents=null},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(DTe),i.update(),o=r.NONE},this.update=(function(){const de=new Jt,He=new FS().setFromUnitVectors(e.up,new Jt(0,1,0)),ot=He.clone().invert(),pt=new Jt,At=new FS,zt=new Jt,rn=2*Math.PI;return function(Nn=null){const qn=i.object.position;de.copy(qn).sub(i.target),de.applyQuaternion(He),a.setFromVector3(de),i.autoRotate&&o===r.NONE&&P(C(Nn)),i.enableDamping?(a.theta+=c.theta*i.dampingFactor,a.phi+=c.phi*i.dampingFactor):(a.theta+=c.theta,a.phi+=c.phi);let Oi=i.minAzimuthAngle,br=i.maxAzimuthAngle;isFinite(Oi)&&isFinite(br)&&(Oi<-Math.PI?Oi+=rn:Oi>Math.PI&&(Oi-=rn),br<-Math.PI?br+=rn:br>Math.PI&&(br-=rn),Oi<=br?a.theta=Math.max(Oi,Math.min(br,a.theta)):a.theta=a.theta>(Oi+br)/2?Math.max(Oi,a.theta):Math.min(br,a.theta)),a.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,a.phi)),a.makeSafe(),i.enableDamping===!0?i.target.addScaledVector(u,i.dampingFactor):i.target.add(u),i.target.sub(i.cursor),i.target.clampLength(i.minTargetRadius,i.maxTargetRadius),i.target.add(i.cursor);let wr=!1;if(i.zoomToCursor&&R||i.object.isOrthographicCamera)a.radius=me(a.radius);else{const ki=a.radius;a.radius=me(a.radius*l),wr=ki!=a.radius}if(de.setFromSpherical(a),de.applyQuaternion(ot),qn.copy(i.target).add(de),i.object.lookAt(i.target),i.enableDamping===!0?(c.theta*=1-i.dampingFactor,c.phi*=1-i.dampingFactor,u.multiplyScalar(1-i.dampingFactor)):(c.set(0,0,0),u.set(0,0,0)),i.zoomToCursor&&R){let ki=null;if(i.object.isPerspectiveCamera){const oi=de.length();ki=me(oi*l);const xt=oi-ki;i.object.position.addScaledVector(T,xt),i.object.updateMatrixWorld(),wr=!!xt}else if(i.object.isOrthographicCamera){const oi=new Jt(N.x,N.y,0);oi.unproject(i.object);const xt=i.object.zoom;i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/l)),i.object.updateProjectionMatrix(),wr=xt!==i.object.zoom;const ln=new Jt(N.x,N.y,0);ln.unproject(i.object),i.object.position.sub(ln).add(oi),i.object.updateMatrixWorld(),ki=de.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;ki!==null&&(this.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(ki).add(i.object.position):(ND.origin.copy(i.object.position),ND.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(ND.direction))<u2t?e.lookAt(i.target):(zTe.setFromNormalAndCoplanarPoint(i.object.up,i.target),ND.intersectPlane(zTe,i.target))))}else if(i.object.isOrthographicCamera){const ki=i.object.zoom;i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/l)),ki!==i.object.zoom&&(i.object.updateProjectionMatrix(),wr=!0)}return l=1,R=!1,wr||pt.distanceToSquared(i.object.position)>s||8*(1-At.dot(i.object.quaternion))>s||zt.distanceToSquared(i.target)>s?(i.dispatchEvent(DTe),pt.copy(i.object.position),At.copy(i.object.quaternion),zt.copy(i.target),!0):!1}})(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",an),i.domElement.removeEventListener("pointerdown",Xe),i.domElement.removeEventListener("pointercancel",Me),i.domElement.removeEventListener("wheel",_t),i.domElement.removeEventListener("pointermove",Be),i.domElement.removeEventListener("pointerup",Me),i.domElement.getRootNode().removeEventListener("keydown",Ft,{capture:!0}),i._domElementKeyEvents!==null&&(i._domElementKeyEvents.removeEventListener("keydown",Ut),i._domElementKeyEvents=null)};const i=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let o=r.NONE;const s=1e-6,a=new ZEe,c=new ZEe;let l=1;const u=new Jt,d=new as,h=new as,f=new as,m=new as,y=new as,g=new as,b=new as,x=new as,w=new as,T=new Jt,N=new as;let R=!1;const k=[],M={};let I=!1;function C(de){return de!==null?2*Math.PI/60*i.autoRotateSpeed*de:2*Math.PI/60/60*i.autoRotateSpeed}function $(de){const He=Math.abs(de*.01);return Math.pow(.95,i.zoomSpeed*He)}function P(de){c.theta-=de}function H(de){c.phi-=de}const G=(function(){const de=new Jt;return function(ot,pt){de.setFromMatrixColumn(pt,0),de.multiplyScalar(-ot),u.add(de)}})(),X=(function(){const de=new Jt;return function(ot,pt){i.screenSpacePanning===!0?de.setFromMatrixColumn(pt,1):(de.setFromMatrixColumn(pt,0),de.crossVectors(i.object.up,de)),de.multiplyScalar(ot),u.add(de)}})(),W=(function(){const de=new Jt;return function(ot,pt){const At=i.domElement;if(i.object.isPerspectiveCamera){const zt=i.object.position;de.copy(zt).sub(i.target);let rn=de.length();rn*=Math.tan(i.object.fov/2*Math.PI/180),G(2*ot*rn/At.clientHeight,i.object.matrix),X(2*pt*rn/At.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(G(ot*(i.object.right-i.object.left)/i.object.zoom/At.clientWidth,i.object.matrix),X(pt*(i.object.top-i.object.bottom)/i.object.zoom/At.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}})();function K(de){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?l/=de:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function ie(de){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?l*=de:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function ce(de,He){if(!i.zoomToCursor)return;R=!0;const ot=i.domElement.getBoundingClientRect(),pt=de-ot.left,At=He-ot.top,zt=ot.width,rn=ot.height;N.x=pt/zt*2-1,N.y=-(At/rn)*2+1,T.set(N.x,N.y,1).unproject(i.object).sub(i.object.position).normalize()}function me(de){return Math.max(i.minDistance,Math.min(i.maxDistance,de))}function ne(de){d.set(de.clientX,de.clientY)}function ae(de){ce(de.clientX,de.clientX),b.set(de.clientX,de.clientY)}function pe(de){m.set(de.clientX,de.clientY)}function be(de){h.set(de.clientX,de.clientY),f.subVectors(h,d).multiplyScalar(i.rotateSpeed);const He=i.domElement;P(2*Math.PI*f.x/He.clientHeight),H(2*Math.PI*f.y/He.clientHeight),d.copy(h),i.update()}function Te(de){x.set(de.clientX,de.clientY),w.subVectors(x,b),w.y>0?K($(w.y)):w.y<0&&ie($(w.y)),b.copy(x),i.update()}function De(de){y.set(de.clientX,de.clientY),g.subVectors(y,m).multiplyScalar(i.panSpeed),W(g.x,g.y),m.copy(y),i.update()}function Ue(de){ce(de.clientX,de.clientY),de.deltaY<0?ie($(de.deltaY)):de.deltaY>0&&K($(de.deltaY)),i.update()}function Ce(de){let He=!1;switch(de.code){case i.keys.UP:de.ctrlKey||de.metaKey||de.shiftKey?H(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):W(0,i.keyPanSpeed),He=!0;break;case i.keys.BOTTOM:de.ctrlKey||de.metaKey||de.shiftKey?H(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):W(0,-i.keyPanSpeed),He=!0;break;case i.keys.LEFT:de.ctrlKey||de.metaKey||de.shiftKey?P(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):W(i.keyPanSpeed,0),He=!0;break;case i.keys.RIGHT:de.ctrlKey||de.metaKey||de.shiftKey?P(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):W(-i.keyPanSpeed,0),He=!0;break}He&&(de.preventDefault(),i.update())}function oe(de){if(k.length===1)d.set(de.pageX,de.pageY);else{const He=Un(de),ot=.5*(de.pageX+He.x),pt=.5*(de.pageY+He.y);d.set(ot,pt)}}function ge(de){if(k.length===1)m.set(de.pageX,de.pageY);else{const He=Un(de),ot=.5*(de.pageX+He.x),pt=.5*(de.pageY+He.y);m.set(ot,pt)}}function ye(de){const He=Un(de),ot=de.pageX-He.x,pt=de.pageY-He.y,At=Math.sqrt(ot*ot+pt*pt);b.set(0,At)}function $e(de){i.enableZoom&&ye(de),i.enablePan&&ge(de)}function Ve(de){i.enableZoom&&ye(de),i.enableRotate&&oe(de)}function Ze(de){if(k.length==1)h.set(de.pageX,de.pageY);else{const ot=Un(de),pt=.5*(de.pageX+ot.x),At=.5*(de.pageY+ot.y);h.set(pt,At)}f.subVectors(h,d).multiplyScalar(i.rotateSpeed);const He=i.domElement;P(2*Math.PI*f.x/He.clientHeight),H(2*Math.PI*f.y/He.clientHeight),d.copy(h)}function ve(de){if(k.length===1)y.set(de.pageX,de.pageY);else{const He=Un(de),ot=.5*(de.pageX+He.x),pt=.5*(de.pageY+He.y);y.set(ot,pt)}g.subVectors(y,m).multiplyScalar(i.panSpeed),W(g.x,g.y),m.copy(y)}function nt(de){const He=Un(de),ot=de.pageX-He.x,pt=de.pageY-He.y,At=Math.sqrt(ot*ot+pt*pt);x.set(0,At),w.set(0,Math.pow(x.y/b.y,i.zoomSpeed)),K(w.y),b.copy(x);const zt=(de.pageX+He.x)*.5,rn=(de.pageY+He.y)*.5;ce(zt,rn)}function je(de){i.enableZoom&&nt(de),i.enablePan&&ve(de)}function Le(de){i.enableZoom&&nt(de),i.enableRotate&&Ze(de)}function Xe(de){i.enabled!==!1&&(k.length===0&&(i.domElement.setPointerCapture(de.pointerId),i.domElement.addEventListener("pointermove",Be),i.domElement.addEventListener("pointerup",Me)),!tn(de)&&(Cn(de),de.pointerType==="touch"?Kt(de):at(de)))}function Be(de){i.enabled!==!1&&(de.pointerType==="touch"?Tt(de):We(de))}function Me(de){switch(An(de),k.length){case 0:i.domElement.releasePointerCapture(de.pointerId),i.domElement.removeEventListener("pointermove",Be),i.domElement.removeEventListener("pointerup",Me),i.dispatchEvent(LTe),o=r.NONE;break;case 1:const He=k[0],ot=M[He];Kt({pointerId:He,pageX:ot.x,pageY:ot.y});break}}function at(de){let He;switch(de.button){case 0:He=i.mouseButtons.LEFT;break;case 1:He=i.mouseButtons.MIDDLE;break;case 2:He=i.mouseButtons.RIGHT;break;default:He=-1}switch(He){case u6.DOLLY:if(i.enableZoom===!1)return;ae(de),o=r.DOLLY;break;case u6.ROTATE:if(de.ctrlKey||de.metaKey||de.shiftKey){if(i.enablePan===!1)return;pe(de),o=r.PAN}else{if(i.enableRotate===!1)return;ne(de),o=r.ROTATE}break;case u6.PAN:if(de.ctrlKey||de.metaKey||de.shiftKey){if(i.enableRotate===!1)return;ne(de),o=r.ROTATE}else{if(i.enablePan===!1)return;pe(de),o=r.PAN}break;default:o=r.NONE}o!==r.NONE&&i.dispatchEvent(DK)}function We(de){switch(o){case r.ROTATE:if(i.enableRotate===!1)return;be(de);break;case r.DOLLY:if(i.enableZoom===!1)return;Te(de);break;case r.PAN:if(i.enablePan===!1)return;De(de);break}}function _t(de){i.enabled===!1||i.enableZoom===!1||o!==r.NONE||(de.preventDefault(),i.dispatchEvent(DK),Ue(Et(de)),i.dispatchEvent(LTe))}function Et(de){const He=de.deltaMode,ot={clientX:de.clientX,clientY:de.clientY,deltaY:de.deltaY};switch(He){case 1:ot.deltaY*=16;break;case 2:ot.deltaY*=100;break}return de.ctrlKey&&!I&&(ot.deltaY*=10),ot}function Ft(de){de.key==="Control"&&(I=!0,i.domElement.getRootNode().addEventListener("keyup",Dt,{passive:!0,capture:!0}))}function Dt(de){de.key==="Control"&&(I=!1,i.domElement.getRootNode().removeEventListener("keyup",Dt,{passive:!0,capture:!0}))}function Ut(de){i.enabled===!1||i.enablePan===!1||Ce(de)}function Kt(de){switch(cn(de),k.length){case 1:switch(i.touches.ONE){case d6.ROTATE:if(i.enableRotate===!1)return;oe(de),o=r.TOUCH_ROTATE;break;case d6.PAN:if(i.enablePan===!1)return;ge(de),o=r.TOUCH_PAN;break;default:o=r.NONE}break;case 2:switch(i.touches.TWO){case d6.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;$e(de),o=r.TOUCH_DOLLY_PAN;break;case d6.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Ve(de),o=r.TOUCH_DOLLY_ROTATE;break;default:o=r.NONE}break;default:o=r.NONE}o!==r.NONE&&i.dispatchEvent(DK)}function Tt(de){switch(cn(de),o){case r.TOUCH_ROTATE:if(i.enableRotate===!1)return;Ze(de),i.update();break;case r.TOUCH_PAN:if(i.enablePan===!1)return;ve(de),i.update();break;case r.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;je(de),i.update();break;case r.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Le(de),i.update();break;default:o=r.NONE}}function an(de){i.enabled!==!1&&de.preventDefault()}function Cn(de){k.push(de.pointerId)}function An(de){delete M[de.pointerId];for(let He=0;He<k.length;He++)if(k[He]==de.pointerId){k.splice(He,1);return}}function tn(de){for(let He=0;He<k.length;He++)if(k[He]==de.pointerId)return!0;return!1}function cn(de){let He=M[de.pointerId];He===void 0&&(He=new as,M[de.pointerId]=He),He.set(de.pageX,de.pageY)}function Un(de){const He=de.pointerId===k[0]?k[1]:k[0];return M[He]}i.domElement.addEventListener("contextmenu",an),i.domElement.addEventListener("pointerdown",Xe),i.domElement.addEventListener("pointercancel",Me),i.domElement.addEventListener("wheel",_t,{passive:!1}),i.domElement.getRootNode().addEventListener("keydown",Ft,{passive:!0,capture:!0}),this.update()}};var FTe={in:25.4,inch:25.4,mil:.0254,mm:1,m:1e3,cm:10,ft:304.8,feet:304.8},Yu=n=>{let e=typeof n=="number"?"mm":n.replace(/^[^a-zA-Z]+/g,"").toLowerCase();e||(e="mm");const t=typeof n=="number"?n:Number.parseFloat(n.split(e)[0]);if(e in FTe)return t*FTe[e];throw new Error(`Unsupported unit: ${e}`)},QA=Yu,h2t=Object.defineProperty,p2t=(n,e)=>{for(var t in e)h2t(n,t,{get:e[t],enumerable:!0})},dw={};p2t(dw,{axial:()=>p5t,bga:()=>T2t,breakoutheaders:()=>S5t,cap:()=>x2t,dfn:()=>X2t,diode:()=>v2t,dip:()=>_2t,electrolytic:()=>oSt,hc49:()=>T5t,jst:()=>Rwt,led:()=>b2t,lqfp:()=>b5t,m2host:()=>wSt,melf:()=>F3t,micromelf:()=>j3t,minimelf:()=>P3t,mlp:()=>k2t,ms012:()=>t5t,ms013:()=>i5t,msop:()=>Bwt,pad:()=>M5t,pinrow:()=>K2t,platedhole:()=>ySt,potentiometer:()=>nSt,pushbutton:()=>m5t,qfn:()=>I2t,qfp:()=>N2t,quad:()=>JA,res:()=>w2t,sma:()=>G3t,smb:()=>ewt,smbf:()=>aSt,smc:()=>rwt,smf:()=>Z3t,smtpad:()=>mSt,sod110:()=>Iwt,sod123:()=>l5t,sod123f:()=>c3t,sod123fl:()=>h3t,sod123w:()=>j5t,sod128:()=>x3t,sod323:()=>G5t,sod323f:()=>r3t,sod323fl:()=>qwt,sod323w:()=>$wt,sod523:()=>N5t,sod723:()=>_3t,sod80:()=>F5t,sod882:()=>e3t,sod882d:()=>O3t,sod923:()=>Z5t,soic:()=>C2t,solderjumper:()=>Zwt,son:()=>Wwt,sop8:()=>L5t,sot:()=>vSt,sot223:()=>cwt,sot23:()=>$2t,sot23w:()=>ywt,sot25:()=>q2t,sot323:()=>dSt,sot363:()=>B2t,sot457:()=>Jwt,sot563:()=>J2t,sot723:()=>o5t,sot89:()=>M3t,ssop:()=>D2t,stampboard:()=>y5t,stampreceiver:()=>x5t,to220:()=>A3t,to92:()=>P5t,to92s:()=>Swt,tssop:()=>z2t,vssop:()=>Lwt});var Zr=(n,e,t)=>({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:"silkscreen_text_1",font:"tscircuit2024",font_size:t,pcb_component_id:"pcb_component_1",text:"{REF}",layer:"top",anchor_position:{x:n,y:e},anchor_alignment:"center"}),Ps=(n,e,t,i,r)=>({pcb_plated_hole_id:"",type:"pcb_plated_hole",shape:"circle",x:e,y:t,hole_diameter:Yu(i),outer_diameter:Yu(r),pcb_port_id:"",layers:["top","bottom"],port_hints:[n.toString()]}),BTe=Array.from({length:9},(n,e)=>Math.cos(e/8*Math.PI-Math.PI)).map(n=>({x:n,y:-Math.sqrt(1-n**2)}));function YS(n){return typeof n=="string"?n.trim().toLowerCase().endsWith("mil")?parseFloat(n)*.0254:parseFloat(n):Number(n)}var kD=Gn([U(),Fe()]).transform(n=>YS(n)),f2t=n=>Re({fn:U(),num_pins:Fe().optional().default(6),wide:vt().optional(),narrow:vt().optional(),w:kD.optional(),p:kD.default(n.p??"2.54mm"),id:kD.optional(),od:kD.optional()}).transform(e=>(!e.id&&!e.od?Math.abs(e.p-1.27)<.01?(e.id=YS("0.55mm"),e.od=YS("0.95mm")):(e.id=YS("1.0mm"),e.od=YS("1.5mm")):e.id?e.od||(e.od=e.id*(1.5/1)):e.id=e.od*(1/1.5),e.w||(e.wide?e.w=YS("600mil"):e.narrow?e.w=YS("300mil"):e.w=YS(n.w??"300mil")),e)),m2t=f2t({}),UTe=(n,e,t,i)=>{const r=n/2,o=e<=r,s=r-1,a=i,c=a*s;return o?{x:-t/2,y:c/2-(e-1)*a}:{x:t/2,y:-c/2+(e-r-1)*a}},_2t=n=>{const e=m2t.parse(n),t=[];for(let l=0;l<e.num_pins;l++){const{x:u,y:d}=UTe(e.num_pins,l+1,e.w,e.p??2.54);t.push(Ps(l+1,u,d,e.id??"0.8mm",e.od??"1mm"))}(e.num_pins/2-1)*e.p+e.od;const r=e.w-e.od-1,o=(e.num_pins/2-1)*e.p+e.od+.4,s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-r/2,y:-o/2},{x:-r/2,y:o/2},...BTe.map(({x:l,y:u})=>({x:l*r/6,y:u*r/6+o/2})),{x:r/2,y:o/2},{x:r/2,y:-o/2},{x:-r/2,y:-o/2}],type:"pcb_silkscreen_path",stroke_width:.1},a=[];for(let l=0;l<e.num_pins;l++){const u=l<e.num_pins/2,d=.6,{y:h}=UTe(e.num_pins,l+1,e.w,e.p??2.54),f=u?-e.w/2-e.od/2-d:e.w/2+e.od/2+d,m=h;a.push({type:"pcb_fabrication_note_text",pcb_fabrication_note_text_id:`pin_${l+1}`,layer:"top",pcb_component_id:`pin_${l+1}`,text:`{pin${l+1}}`,anchor_position:{x:f,y:m},font_size:.3,font:"tscircuit2024",anchor_alignment:"top_left"})}const c=Zr(0,o/2+.5,.4);return{circuitJson:[...t,s,c,...a],parameters:e}},or=(n,e,t,i,r)=>({type:"pcb_smtpad",x:e,y:t,width:i,height:r,layer:"top",shape:"rect",pcb_smtpad_id:"",port_hints:Array.isArray(n)?n.map(o=>o.toString()):[n.toString()]}),$Te=[{imperial:"01005",metric:"0402",p_mm_min:.5,pw_mm_min:.4,ph_mm_min:.3,w_mm_min:.58,h_mm_min:.21},{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},{imperial:"0201",metric:"0603",p_mm_min:.66,pw_mm_min:.46,ph_mm_min:.4,w_mm_min:.9,h_mm_min:.3},{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},{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},{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},{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},{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},{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},{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}],y2t=Object.fromEntries($Te.map(n=>[n.metric,n])),g2t=Object.fromEntries($Te.map(n=>[n.imperial,n]));Re({tht:vt(),p:et.optional(),pw:et.optional(),ph:et.optional(),metric:Ot.optional(),imperial:Ot.optional(),w:et.optional(),h:et.optional(),textbottom:vt().optional()});var OD=n=>{let{tht:e,p:t,pw:i,ph:r,metric:o,imperial:s,w:a,h:c,textbottom:l}=n;if(typeof a=="string"&&(a=QA(a)),typeof c=="string"&&(c=QA(c)),typeof t=="string"&&(t=QA(t)),typeof i=="string"&&(i=QA(i)),typeof r=="string"&&(r=QA(r)),c!==void 0&&a!==void 0&&c>a)throw new Error("height cannot be greater than width (rotated footprint not yet implemented)");let u;if(o&&(u=y2t[o]),s&&(u=g2t[s]),u&&(a=u.w_mm_min,c=u.h_mm_min,t=u.p_mm_min,i=u.pw_mm_min,r=u.ph_mm_min),t===void 0||i===void 0||r===void 0)throw new Error("Could not determine required pad dimensions (p, pw, ph)");const d={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:t/2,y:r/2+.4},{x:-t/2-i/2-.2,y:r/2+.4},{x:-t/2-i/2-.2,y:-r/2-.4},{x:t/2,y:-r/2-.4}],stroke_width:.1,pcb_silkscreen_path_id:""},h=l?-r/2-.9:r/2+.9,f=Zr(0,h,.2);return e?[Ps(1,-t/2,0,i,i*1/.8),Ps(2,t/2,0,i,i*1/.8),d,f]:[or(["1","left"],-t/2,0,i,r),or(["2","right"],t/2,0,i,r),d,f]},v2t=n=>({circuitJson:OD(n),parameters:n}),x2t=n=>({circuitJson:OD(n),parameters:n}),b2t=n=>({circuitJson:OD(n),parameters:n}),w2t=n=>({circuitJson:OD(n),parameters:n}),jTe=(n,{x:e,y:t,radius:i})=>({type:"pcb_smtpad",x:e,y:t,radius:i,layer:"top",shape:"circle",pcb_smtpad_id:"",port_hints:Array.isArray(n)?n.map(r=>r.toString()):[n.toString()]}),HTe="ABCDEFGHIJKLMNOPQRSTUVWXYZ",VTe=U().transform(n=>{const[e,t]=n.split(/[x ]/);return{x:parseFloat(e),y:parseFloat(t)}}).pipe(Re({x:Fe(),y:Fe()})),S2t=U().or(mt(Gu())).transform(n=>Array.isArray(n)?n:(n.startsWith("(")&&n.endsWith(")")&&(n=n.slice(1,-1)),n.split(",").map(e=>{const t=Number(e);return isNaN(t)?e:t}))).pipe(mt(U().or(Fe()))),E2t=Re({fn:U(),num_pins:Fe().optional().default(64),grid:VTe.optional(),p:Ot.default("0.8mm"),w:et.optional(),h:et.optional(),ball:et.optional().describe("ball diameter"),pad:et.optional().describe("pad width/height"),circularpads:vt().optional().describe("use circular pads"),tlorigin:vt().optional(),blorigin:vt().optional(),trorigin:vt().optional(),brorigin:vt().optional(),missing:S2t.default([])}).transform(n=>{let e="tl";if(n.blorigin&&(e="bl"),n.trorigin&&(e="tr"),n.brorigin&&(e="br"),!n.grid){const i=Math.ceil(Math.sqrt(n.num_pins));n.grid={x:i,y:i}}return n.missing&&(n.missing=n.missing.map(i=>{if(typeof i=="number")return i;if(i==="center")return"center";if(i==="topleft")return"topleft";const r=i.match(/([A-Z]+)(\d+)/);if(!r)return i;const o=HTe.indexOf(r[1]),s=Number.parseInt(r[2])-1;return o*n.grid.x+s+1})),{...n,origin:e}}),T2t=n=>{const e=E2t.parse(n);let{num_pins:t,grid:i,p:r,w:o,h:s,ball:a,pad:c,missing:l}=e;a??=.75/1.27*r,c??=a*.8;const u=[],d=(l??[]).filter(N=>typeof N=="number"),h=i.x*i.y-t;if(l.length===0&&h>0&&(Math.sqrt(h)%1===0?l.push("center"):h===1&&l.push("topleft")),l?.includes("center")){const N=Math.floor(Math.sqrt(h)),R=Math.floor((i.x-N)/2),k=Math.floor((i.y-N)/2);for(let M=k;M<k+N;M++)for(let I=R;I<R+N;I++)d.push(M*i.x+I+1)}l?.includes("topleft")&&d.push(1);const f=new Set(d);let m=0;for(let N=0;N<i.y;N++)for(let R=0;R<i.x;R++){const k=(R-(i.x-1)/2)*r,M=(N-(i.y-1)/2)*r;let I=R,C=N;switch(e.origin){case"bl":I=R,C=i.y-1-N;break;case"br":I=i.x-1-R,C=i.y-1-N;break;case"tr":I=i.x-1-R,C=N;break}let $=C*i.x+I+1;if(f.has($)){m++;continue}$-=m;const P=[$,`${HTe[C]}${I+1}`];u.push(e.circularpads?jTe(P,{x:k,y:M,radius:c/2}):or(P,k,M,c,c))}const y=Zr(0,i.y*r/2,.2),g=r/6;let b;const x=i.x*r/2,w=i.y*r/2;switch(e.origin){case"bl":b=[{x:-x,y:-w},{x:-x,y:-w-g},{x:-x-g,y:-w},{x:-x,y:-w}];break;case"br":b=[{x,y:-w},{x,y:-w-g},{x:x+g,y:-w},{x,y:-w}];break;case"tr":b=[{x,y:w},{x,y:w+g},{x:x+g,y:w},{x,y:w}];break;case"tl":default:b=[{x:-x,y:w},{x:-x,y:w+g},{x:-x-g,y:w},{x:-x,y:w}];break}const T={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_marker",route:b,stroke_width:.05};return{circuitJson:[...u,y,T],parameters:e}},$2=n=>Re({fn:U(),num_pins:Fe().optional().default(8),w:et.default(et.parse(n.w??"5.3mm")),p:et.default(et.parse(n.p??"1.27mm")),pw:et.default(et.parse(n.pw??"0.6mm")),pl:et.default(et.parse(n.pl??"1.0mm")),legsoutside:vt().optional().default(n.legsoutside??!1)}).transform(e=>(!e.pw&&!e.pl?(e.pw=et.parse("0.6mm"),e.pl=et.parse("1.0mm")):e.pw?e.pl||(e.pl=e.pw*(1/.6)):e.pw=e.pl*(.6/1),e)),M2t=$2({}),LK=n=>{n.widthincludeslegs!==void 0&&(n.legsoutside=!n.widthincludeslegs);const{num_pins:e,pn:t,w:i,p:r,pl:o,legsoutside:s}=n,a=e/2,c=t<=a,l=a-1,u=r,d=u*l,h=s?o/2:-o/2;return c?{x:-i/2-h,y:d/2-(t-1)*u}:{x:i/2+h,y:-d/2+(t-a-1)*u}},C2t=n=>{const e=M2t.parse(n);return{circuitJson:hw(e),parameters:e}},hw=n=>{const e=[];for(let a=0;a<n.num_pins;a++){const{x:c,y:l}=LK({num_pins:n.num_pins,pn:a+1,w:n.w,p:n.p,pl:n.pl,legsoutside:n.legsoutside});e.push(or(a+1,c,l,n.pl,n.pw))}const t=Math.min(1,n.p/2),i=n.w-(n.legsoutside?0:n.pl*2)-.2,r=(n.num_pins/2-1)*n.p+n.pw+t,o=Zr(0,r/2+.4,r/12),s={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",stroke_width:.1,route:[{x:-i/2,y:-r/2},{x:-i/2,y:r/2},...BTe.map(({x:a,y:c})=>({x:a*i/6,y:c*i/6+r/2})),{x:i/2,y:r/2},{x:i/2,y:-r/2},{x:-i/2,y:-r/2}]};return[...e,s,o]},qTe=Gt(["leftside","topside","rightside","bottomside","toppin","bottompin","leftpin","rightpin"]),A2t=({num_pins:n,cw:e,ccw:t,startingpin:i})=>{const r=[],o=n/4;let s=1;const a={};for(const c of i??[])a[c]=!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=o:a.bottomside&&a.leftpin?s=o+1:a.bottomside&&a.rightpin?s=o*2:a.rightside&&a.bottompin?s=o*2+1:a.rightside&&a.toppin?s=o*3:a.topside&&a.rightpin?s=o*3+1:a.topside&&a.leftpin&&(s=o*4),r.push(-1);for(let c=0;c<n;c++)r[s]=c+1,t||!e?(s++,s>n&&(s=1)):(s--,s<1&&(s=n));return r},zK=Re({fn:U(),cc:vt().default(!0).optional(),ccw:vt().default(!0).optional(),startingpin:U().or(mt(qTe)).transform(n=>typeof n=="string"?n.slice(1,-1).split(","):n).pipe(mt(qTe)).optional(),num_pins:Fe().optional().default(64),w:et.optional(),h:et.optional(),p:et.default(et.parse("0.5mm")),pw:et.optional(),pl:et.optional(),thermalpad:Gn([we(!0),VTe]).optional(),legsoutside:vt().default(!1)}),FK=n=>{n.w&&!n.h?n.h=n.w:!n.w&&n.h&&(n.w=n.h);const e=n.num_pins/4;if(!n.p&&!n.pw&&!n.pl&&n.w){const t=e+4;n.p=n.w/t}return!n.p&&n.w&&n.h&&n.pw&&n.pl&&(n.p=(n.w-n.pl*2)/(e-1)),!n.w&&!n.h&&n.p&&(n.w=n.p*(e+4),n.h=n.w),n.p&&!n.pw&&!n.pl?(n.pw=n.p/2,n.pl=n.p/2):n.pw?n.pl||(n.pl=n.pw*(1/.6)):n.pw=n.pl*(.6/1),n},GTe=zK.transform(FK),R2t=["left","bottom","right","top"],P2t=n=>{const{pin_count:e,pn:t,w:i,h:r,p:o,pl:s,legsoutside:a}=n,c=e/4,l=R2t[Math.floor((t-1)/c)],u=(t-1)%c,d=o*(c-1),h=o*(c-1),f=a?s/2:-s/2;switch(l){case"left":return{x:-i/2-f,y:h/2-u*o,o:"vert"};case"bottom":return{x:-d/2+u*o,y:-r/2-f,o:"horz"};case"right":return{x:i/2+f,y:-h/2+u*o,o:"vert"};case"top":return{x:d/2-u*o,y:r/2+f,o:"horz"};default:throw new Error("Invalid pin number")}},JA=n=>{const e=GTe.parse(n),t=[],i=A2t(e),r=e.num_pins/4;for(let a=0;a<e.num_pins;a++){const{x:c,y:l,o:u}=P2t({pin_count:e.num_pins,pn:a+1,w:e.w,h:e.h,p:e.p??.5,pl:e.pl,legsoutside:e.legsoutside});let d=e.pw,h=e.pl;u==="vert"&&([d,h]=[h,d]);const f=i[a+1];t.push(or(f,c,l,d,h))}if(e.thermalpad)if(typeof e.thermalpad=="boolean"){const a=e.p*(r-1)+e.pw,c=e.p*(r-1)+e.pw;t.push(or(["thermalpad"],0,0,a,c))}else t.push(or(["thermalpad"],0,0,e.thermalpad.x,e.thermalpad.y));const o=[];for(const[a,c,l]of[["top-left",-1,1],["bottom-left",-1,-1],["bottom-right",1,-1],["top-right",1,1]]){const u=e.w/2*c,d=e.h/2*l;let h="none",f=u,m=d;const y=e.pw*2;i[1]===1&&a==="top-left"?h="in1":i[r*4]===1&&a==="top-left"||i[r*3+1]===1&&a==="top-right"?h="in2":i[r*3]===1&&a==="top-right"||i[r]===1&&a==="bottom-left"?h="in1":i[r+1]===1&&a==="bottom-left"?h="in2":i[r*2]===1&&a==="bottom-right"?h="in1":i[r*2+1]===1&&a==="bottom-right"&&(h="in2");const g=h==="in1"?1:-1;if(e.legsoutside){const b=h==="in1"?e.pl/2:e.pw/2,x=h==="in1"?e.pw/2:e.pl/2;f+=b*c*g,m-=x*l*g}(h==="none"||e.legsoutside)&&o.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${a}`,route:[{x:u-y*c,y:d},{x:u,y:d},{x:u,y:d-y*l}],type:"pcb_silkscreen_path",stroke_width:.1}),(h==="in1"||h==="in2")&&!e.legsoutside&&o.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${a}_1`,route:[{x:u-y*c,y:d},{x:u-y*c/2,y:d}],type:"pcb_silkscreen_path",stroke_width:0},{layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${a}_2`,route:[{x:u,y:d-y*l/2},{x:u,y:d-y*l}],type:"pcb_silkscreen_path",stroke_width:.1}),(h==="in1"||h==="in2")&&o.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${a}_3`,route:[{x:f-.2*-c,y:m+.2*g},{x:f,y:m},{x:f+.2*g*-c,y:m+.2},{x:f-.2*-c,y:m+.2*g}],type:"pcb_silkscreen_path",stroke_width:.1})}const s=Zr(0,e.h/2+(e.legsoutside?e.pl*1.2:.5),.3);return{circuitJson:[...t,...o,s],parameters:e}};zK.extend({}).transform(FK);var I2t=n=>(n.legsoutside=!1,JA(n)),N2t=n=>{n.legsoutside=!0;const e=GTe.parse(n);if(!n.p)switch(n.num_pins){case 44:case 64:n.p=.8;break;case 52:n.w===14?n.p=1:n.p=.65;break;case 208:n.p=.5;break}if(!n.pl)switch(n.num_pins){case 44:case 52:case 64:n.pl=2.25;break;case 208:n.pl=1.65;break;default:n.pl=e.pl*4;break}if(!n.pw)switch(n.num_pins){case 44:case 64:n.pw=.5;break;case 52:n.w===14?n.pw=.45:n.pw=.55;break;case 208:n.pw=.3;break;default:n.pw=e.pw;break}return JA(n)};zK.extend({}).transform(FK);var k2t=n=>(n.legsoutside=!1,n.thermalpad===void 0&&(n.thermalpad=!0),JA(n)),O2t=$2({w:"3.9mm",p:"1.27mm"}),D2t=n=>{const e=O2t.parse(n);return{circuitJson:hw(e),parameters:e}},L2t=$2({w:"7.1mm",p:"0.65mm",pl:"1.35mm",pw:"0.40mm",legsoutside:!0}),z2t=n=>{const e=L2t.parse(n);return{circuitJson:hw(e),parameters:e}},F2t=$2({}),B2t=n=>{const e=F2t.parse({fn:"sot363",num_pins:6,w:1.94,p:.65,pw:.3,pl:.7,legoutside:!0});return{circuitJson:hw(e),parameters:e}},YTe=Re({fn:U(),num_pins:Fe().default(3),w:U().default("1.92mm"),h:U().default("2.74mm"),pl:U().default("0.8mm"),pw:U().default("0.764mm"),p:U().default("0.95mm"),string:U().optional()}),U2t=$2({p:"0.95mm",w:"1.6mm",legsoutside:!0}),$2t=n=>{const e=n.string?.match(/^sot23_(\d+)/),t=e?Number.parseInt(e[1],10):3;if(t===6||t===8){const r=U2t.parse({...n,num_pins:t});return{circuitJson:hw(r),parameters:r}}const i=YTe.parse({...n,num_pins:t});if(i.num_pins===3)return{circuitJson:H2t(i),parameters:i};if(i.num_pins===5)return{circuitJson:WTe(i),parameters:i};throw new Error("Invalid number of pins")},j2t=n=>{const{pn:e}=n;return e===1?{x:-1.7,y:0}:e===2?{x:1.7,y:-.95}:{x:1.7,y:.95}},H2t=n=>{const e=[];for(let i=0;i<n.num_pins;i++){const{x:r,y:o}=j2t({num_pins:n.num_pins,pn:i+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl)});e.push(or(i+1,r,o,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=Zr(0,Number.parseInt(n.h),.3);return[...e,t]},XTe=n=>{const{p:e,h:t,pn:i}=n;if(i===1)return{x:-t/2-.5,y:e};if(i===2)return{x:-t/2-.5,y:0};if(i===3)return{x:-t/2-.5,y:-e};if(i===4)return{x:t/2+.5,y:-e};if(i===5)return{x:t/2+.5,y:e};throw new Error("Invalid pin number")},WTe=n=>{const e=[];for(let d=1;d<=n.num_pins;d++){const{x:h,y:f}=XTe({h:Number.parseFloat(n.h),p:Number.parseFloat(n.p),pn:d});e.push(or(d,h,f,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=(n.num_pins+1)/2*Number.parseFloat(n.p),i=Number.parseFloat(n.h),r={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-t/3,y:i/2+Number.parseFloat(n.p)/1.3},{x:t/3,y:i/2+Number.parseFloat(n.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-t/3,y:-i/2-Number.parseFloat(n.p)/1.3},{x:t/3,y:-i/2-Number.parseFloat(n.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},s=Zr(0,i+.3,.3),a=XTe({h:Number.parseFloat(n.h),p:Number.parseFloat(n.p),pn:1});a.x=a.x-Number.parseFloat(n.pw)*1.5;const c=.7,l=.3,u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:a.x+c/2,y:a.y},{x:a.x-c/2,y:a.y+l/2},{x:a.x-c/2,y:a.y-l/2},{x:a.x+c/2,y:a.y}],stroke_width:.05};return[...e,s,r,o,u]},V2t=YTe.extend({}),q2t=n=>{const e=V2t.parse({...n,num_pins:5});return{circuitJson:WTe(e),parameters:e}},G2t=[{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}],Y2t=$2({}),X2t=n=>{const e=Y2t.parse(n),t=[];for(let d=0;d<e.num_pins;d++){const{x:h,y:f}=LK({num_pins:e.num_pins,pn:d+1,w:e.w,p:e.p??1.27,pl:e.pl,widthincludeslegs:!0});t.push(or(d+1,h,f,e.pl??"1mm",e.pw??"0.6mm"))}const i=Math.min(1,e.p/2),r=e.w+i,o=(e.num_pins/2-1)*e.p+e.pw+i,s=[];for(const d of G2t){const{dx:h,dy:f}=d;s.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",route:[{x:h*r/2-h*e.p,y:f*o/2},{x:h*r/2,y:f*o/2},{x:h*r/2,y:f*o/2-f*e.p}],type:"pcb_silkscreen_path",stroke_width:.1})}const a=e.p/4,c=-r/2-a/2,l=o/2-e.p/2;s.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:c,y:l},{x:c-a,y:l+a},{x:c-a,y:l-a},{x:c,y:l}],stroke_width:.1});const u=Zr(0,o/2+.4,o/12);return{circuitJson:[...t,u,...s],parameters:e}},DD=(n,e,t,i,r,o)=>({pcb_plated_hole_id:"",type:"pcb_plated_hole",shape:"circular_hole_with_rect_pad",x:e,y:t,hole_diameter:Yu(i),hole_shape:"circle",pad_shape:"rect",rect_pad_width:Yu(r),rect_pad_height:Yu(o),pcb_port_id:"",layers:["top","bottom"],port_hints:[n.toString()]}),BK=({fs:n,pn:e,anchor_x:t,anchor_y:i,textalign:r="center",orthogonal:o=!1,verticallyinverted:s=!1,layer:a="top"})=>{let c=0;o&&s?c=270:s?c=180:o?c=90:c=0;let l="center";return r==="left"&&(s?l="center_right":l="center_left"),r==="right"&&(s?l="center_left":l="center_right"),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:n,pcb_component_id:"pcb_component_1",text:`{PIN${e}}`,layer:a,anchor_position:{x:t,y:i},anchor_alignment:l,ccw_rotation:c}};function W2t({pinlabeltextalignleft:n,pinlabeltextalignright:e,pinlabelorthogonal:t}){let i="top";return t?i="left":i="top",n&&(t?i="bottom":i="right"),e&&(t?i="top":i="left"),i}var Z2t=Re({fn:U(),num_pins:Fe().optional().default(6),rows:Gn([U(),Fe()]).transform(n=>Number(n)).optional().default(1).describe("number of rows"),p:et.default("0.1in").describe("pitch"),id:et.default("1.0mm").describe("inner diameter"),od:et.default("1.5mm").describe("outer diameter"),male:vt().optional().describe("for male pin headers"),female:vt().optional().describe("for female pin headers"),pinlabeltextalignleft:vt().optional().default(!1),pinlabeltextaligncenter:vt().optional().default(!1),pinlabeltextalignright:vt().optional().default(!1),pinlabelverticallyinverted:vt().optional().default(!1),pinlabelorthogonal:vt().optional().default(!1),nosquareplating:vt().optional().default(!1).describe("do not use rectangular pad for pin 1"),nopinlabels:vt().optional().default(!1).describe("omit silkscreen pin labels"),doublesidedpinlabel:vt().optional().default(!1).describe("add silkscreen pins in top and bottom layers"),bottomsidepinlabel:vt().optional().default(!1).describe("place the silkscreen reference text on the bottom layer instead of top")}).transform(n=>{const e=W2t(n);return{...n,pinlabelAnchorSide:e,male:n.male??!n.female,female:n.female??!1}}).superRefine((n,e)=>{n.male&&n.female&&e.addIssue({code:_i.custom,message:"'male' and 'female' cannot both be true; it should be male or female.",path:["male","female"]})}),K2t=n=>{const e=Z2t.parse(n),{p:t,id:i,od:r,rows:o,num_pins:s,pinlabelAnchorSide:a,pinlabelverticallyinverted:c,pinlabelorthogonal:l,pinlabeltextalignleft:u,pinlabeltextalignright:d,nopinlabels:h,doublesidedpinlabel:f,bottomsidepinlabel:m}=e;let y="center";u?y="left":d&&(y="right");const g=[],b=Math.ceil(s/o),x=-t,w=({xoff:M,yoff:I,od:C,anchorSide:$})=>{let P=0,H=0;const G=C*.75;switch($){case"right":P=G;break;case"top":H=G;break;case"bottom":H=-G;break;case"left":P=-G;break}return{anchor_x:M+P,anchor_y:I+H}},T=(M,I,C)=>{M===1&&!e.nosquareplating?g.push(DD(M,I,C,i,r,r)):g.push(Ps(M,I,C,i,r));const{anchor_x:$,anchor_y:P}=w({xoff:I,yoff:C,od:r,anchorSide:a});h||(m?g.push(BK({fs:r/5,pn:M,anchor_x:$,anchor_y:P,textalign:y,orthogonal:l,verticallyinverted:c,layer:"bottom"})):g.push(BK({fs:r/5,pn:M,anchor_x:$,anchor_y:P,textalign:y,orthogonal:l,verticallyinverted:c,layer:"top"})),f&&g.push(BK({fs:r/5,pn:M,anchor_x:$,anchor_y:P,textalign:y,orthogonal:l,verticallyinverted:c,layer:"bottom"})))},N=new Set,R=o>2&&b>2;if(o===1){const M=-((s-1)/2)*t;for(let I=0;I<s;I++){const C=I+1,$=M+I*t,P=`${$},0`;if(N.has(P))throw new Error(`Overlap at ${P}`);N.add(P),T(C,$,0)}}else if(R){const M=-((b-1)/2)*t;let I=1;for(let C=0;C<o&&I<=s;C++)for(let $=0;$<b&&I<=s;$++){const P=M+$*t,H=C*x,G=`${P},${H}`;if(N.has(G))throw new Error(`Overlap at ${G}`);N.add(G),T(I++,P,H)}}else{const M=-((b-1)/2)*t;let I=1,C=0,$=o-1,P=0,H=b-1;for(;I<=s&&C<=$&&P<=H;){for(let G=C;G<=$&&I<=s;G++){const X=M+P*t,W=G*x,K=`${X},${W}`;if(N.has(K))throw new Error(`Overlap at ${K}`);N.add(K),T(I++,X,W)}P++;for(let G=P;G<=H&&I<=s;G++){const X=M+G*t,W=$*x,K=`${X},${W}`;if(N.has(K))throw new Error(`Overlap at ${K}`);N.add(K),T(I++,X,W)}if($--,P<=H){for(let G=$;G>=C&&I<=s;G--){const X=M+H*t,W=G*x,K=`${X},${W}`;if(N.has(K))throw new Error(`Overlap at ${K}`);N.add(K),T(I++,X,W)}H--}if(C<=$){for(let G=H;G>=P&&I<=s;G--){const X=M+G*t,W=C*x,K=`${X},${W}`;if(N.has(K))throw new Error(`Overlap at ${K}`);N.add(K),T(I++,X,W)}C++}}if(I-1<s)throw new Error(`Missing pins: assigned ${I-1}, expected ${s}`)}const k=Zr(0,t,.5);return{circuitJson:[...g,k],parameters:e}},Q2t=$2({}),J2t=n=>{const e=Q2t.parse({fn:"sot563",num_pins:6,w:1.94,p:.5,pw:.3,pl:.67,legoutside:!0});return{circuitJson:hw(e),parameters:e}},e5t=$2({p:"1.27mm",w:"3.9mm",legsoutside:!0}),t5t=n=>{const e=e5t.parse({...n,num_pins:8});return{circuitJson:hw(e),parameters:e}},n5t=$2({p:"1.27mm",w:"7.5mm",legsoutside:!0}),i5t=n=>{const e=n5t.parse({...n,num_pins:16});return{circuitJson:hw(e),parameters:e}},r5t=Re({fn:U(),num_pins:we(3).default(3),w:U().default("1.2mm"),h:U().default("1.2mm"),pl:U().default("0.3mm"),pw:U().default("0.32mm")}),o5t=n=>{const e=r5t.parse(n),t=a5t(e),i=Zr(.4,et.parse(e.h),.2);return{circuitJson:[...t,i],parameters:e}},s5t=n=>{const{pn:e}=n;return e===1?{x:0,y:0}:e===2?{x:1,y:-.4}:{x:1,y:.4}},a5t=n=>{const e=[];for(let t=0;t<3;t++){const{x:i,y:r}=s5t({num_pins:n.num_pins,pn:t+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl)});e.push(or(t+1,i,r,Number.parseFloat(n.pl),t!==0?Number.parseFloat(n.pw):.42))}return e},c5t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("2.36mm"),h:U().default("1.22mm"),pl:U().default("0.9mm"),pw:U().default("0.9mm"),p:U().default("4.19mm")}),l5t=n=>{const e=c5t.parse(n),t=Zr(0,et.parse(e.h)/4+.4,.3);return{circuitJson:d5t(e).concat(t),parameters:e}},u5t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},d5t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=u5t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},h5t=Re({fn:U(),p:et.optional().default("2.54mm"),id:et.optional().default("0.7mm"),od:et.optional().default("1mm")}),p5t=n=>{const e=h5t.parse(n),{p:t,id:i,od:r}=e,o=[Ps(1,-t/2,0,i,r),Ps(2,t/2,0,i,r)],s={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-t/2+r+i/2,y:0},{x:t/2-r-i/2,y:0}],stroke_width:.1,pcb_silkscreen_path_id:""},a=Zr(0,t/4,.5);return{circuitJson:[...o,s,a],parameters:e}},LD=(n,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:n,stroke_width:e.stroke_width||.1}),f5t=Re({fn:we("pushbutton"),w:et.default(4.5),h:et.default(6.5),id:et.default(1),od:et.default(1.2)}),m5t=n=>{const e=f5t.parse(n),t=e.w,i=e.h,r=e.id,o=[Ps(1,-t/2,i/2,r,r*1.5),Ps(2,-t/2,-i/2,r,r*1.5),Ps(3,t/2,-i/2,r,r*1.5),Ps(4,t/2,i/2,r,r*1.5)],s=[LD([{x:-t/2,y:-i/2},{x:-t/2,y:i/2}]),LD([{x:t/2,y:-i/2},{x:t/2,y:i/2}]),LD([{x:-t/2,y:0},{x:-t/5,y:0},{x:t/5*1/Math.sqrt(2),y:i/8}]),LD([{x:t/2,y:0},{x:t/5,y:0}])],a=Zr(0,i/2+.4,.5);return{circuitJson:[...o,...s,a],parameters:e}},ZTe=Re({fn:U(),w:et.default("22.58mm"),h:et.optional(),left:et.optional().default(20),right:et.optional().default(20),top:et.optional().default(2),bottom:et.optional().default(2),p:et.default(et.parse("2.54mm")),pw:et.default(et.parse("1.6mm")),pl:et.default(et.parse("2.4mm")),innerhole:vt().default(!1),innerholeedgedistance:et.default(et.parse("1.61mm")),silkscreenlabels:vt().default(!1),silkscreenlabelmargin:et.default(et.parse("0.1mm"))}),_5t=n=>{const e=ZTe.parse(n);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},zD=(n,e,t)=>{let i=[];return t==="right"&&(i=[{x:n+1/2,y:e},{x:n-1/2,y:e+.6/2},{x:n-1/2,y:e-.6/2},{x:n+1/2,y:e}]),t==="left"&&(i=[{x:n-1/2,y:e},{x:n+1/2,y:e+.6/2},{x:n+1/2,y:e-.6/2},{x:n-1/2,y:e}]),t==="top"&&(i=[{x:n,y:e+1/2},{x:n-.6/2,y:e-1/2},{x:n+.6/2,y:e-1/2},{x:n,y:e+1/2}]),t==="bottom"&&(i=[{x:n,y:e-1/2},{x:n-.6/2,y:e+1/2},{x:n+.6/2,y:e+1/2},{x:n,y:e-1/2}]),i},y5t=n=>{const e=ZTe.parse(n),t=e.h??_5t(e),i=[],r=[],o=[];let s=[];const a=1,c=1.2,l=e.left+e.right+(e.bottom??0)+(e.top??0),d=`pin${l}`.length*.7/2;if(e.right){const y=-((e.right-1)/2)*e.p;for(let g=0;g<e.right;g++){if(g===0&&!e.left&&!e.bottom&&!e.silkscreenlabels&&(s=zD(e.w/2-e.pl*1.4,y+g*e.p,"right")),i.push(or(g+1+e.left+(e.bottom??0),e.w/2-e.pl/2,y+g*e.p,e.pl,e.pw)),e.silkscreenlabels){const b=g+1+e.left+(e.bottom??0),x=`pin${b}`;o.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${b}`,pcb_component_id:"1",layer:"top",anchor_position:{x:e.w/2-e.pl-(d+e.silkscreenlabelmargin),y:y+g*e.p},text:x,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"})}e.innerhole&&(r.push(Ps(g+1+e.left+(e.bottom??0)+l,e.w/2,y+g*e.p,a,c)),r.push(Ps(g+1+e.left+(e.bottom??0)+l*2,e.w/2-e.innerholeedgedistance,y+g*e.p,a,c)))}}if(e.left){const y=(e.left-1)/2*e.p;for(let g=0;g<e.left;g++){if(g===0&&!e.silkscreenlabels&&(s=zD(-e.w/2+e.pl*1.4,y-g*e.p,"left")),i.push(or(g+1,-e.w/2+e.pl/2,y-g*e.p,e.pl,e.pw)),e.silkscreenlabels){const b=g+1,x=`pin${b}`;o.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${b}`,pcb_component_id:"1",layer:"top",anchor_position:{x:-e.w/2+e.pl+(d+e.silkscreenlabelmargin),y:y-g*e.p},text:x,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"})}e.innerhole&&(r.push(Ps(g+1+l,-e.w/2,y-g*e.p,a,c)),r.push(Ps(g+1+l*2,-e.w/2+e.innerholeedgedistance,y-g*e.p,a,c)))}}if(e.top){const y=(e.top-1)/2*e.p;for(let g=0;g<e.top;g++){if(g===0&&!e.left&&!e.bottom&&!e.right&&!e.silkscreenlabels&&(s=zD(y-g*e.p,t/2-e.pl*1.4,"top")),i.push(or(g+1+e.left+e.right+(e.bottom??0),y-g*e.p,t/2-e.pl/2,e.pw,e.pl)),e.silkscreenlabels){const b=g+1+e.left+e.right+(e.bottom??0),x=`pin${b}`;o.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${b}`,pcb_component_id:"1",layer:"top",anchor_position:{x:y-g*e.p,y:t/2-e.pl-(d+e.silkscreenlabelmargin)},text:x,font_size:.7,font:"tscircuit2024",anchor_alignment:"center",ccw_rotation:270})}e.innerhole&&(r.push(Ps(g+1+e.left+e.right+(e.bottom??0)+l,y-g*e.p,t/2,a,c)),r.push(Ps(g+1+e.left+e.right+(e.bottom??0)+l*2,y-g*e.p,t/2-e.innerholeedgedistance,a,c)))}}if(e.bottom){const y=-((e.bottom-1)/2)*e.p;for(let g=0;g<e.bottom;g++){if(g===0&&!e.left&&!e.silkscreenlabels&&(s=zD(y+g*e.p,-t/2+e.pl*1.4,"bottom")),i.push(or(g+1+e.left,y+g*e.p,-t/2+e.pl/2,e.pw,e.pl)),e.silkscreenlabels){const b=g+1+e.left,x=`pin${b}`;o.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${b}`,pcb_component_id:"1",layer:"top",anchor_position:{x:y+g*e.p,y:-t/2+e.pl+(d+e.silkscreenlabelmargin)},text:x,font_size:.7,font:"tscircuit2024",anchor_alignment:"center",ccw_rotation:90})}e.innerhole&&(r.push(Ps(g+1+e.left+l,y+g*e.p,-t/2,a,c)),r.push(Ps(g+1+e.left+l*2,y+g*e.p,-t/2+e.innerholeedgedistance,a,c)))}}const h={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_triangle_1",pcb_component_id:"2",route:s,stroke_width:.1,layer:"top"},f={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-e.w/2,y:t/2},{x:e.w/2,y:t/2},{x:e.w/2,y:-t/2},{x:-e.w/2,y:-t/2},{x:-e.w/2,y:t/2}],stroke_width:.1,layer:"top"},m=Zr(0,t/1.8,t/25);return{circuitJson:[...i,...r,...o,f,...e.silkscreenlabels?[]:[h],m],parameters:e}},KTe=Re({fn:U(),w:et.default("22.58mm"),h:et.optional(),left:et.optional().default(20),right:et.optional().default(20),top:et.optional().default(2),bottom:et.optional().default(2),p:et.default(et.parse("2.54mm")),pw:et.default(et.parse("1.6mm")),pl:et.default(et.parse("3.2mm")),innerhole:vt().default(!1),innerholeedgedistance:et.default(et.parse("1.61mm"))}),g5t=n=>{const e=KTe.parse(n);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},v5t=(n,e,t,i=1,r=.6)=>{const o=i/2,s=r/2;return{left:[{x:n+o,y:e},{x:n-o,y:e+s},{x:n-o,y:e-s},{x:n+o,y:e}],right:[{x:n-o,y:e},{x:n+o,y:e+s},{x:n+o,y:e-s},{x:n-o,y:e}],top:[{x:n,y:e-o},{x:n-s,y:e+o},{x:n+s,y:e+o},{x:n,y:e-o}],bottom:[{x:n,y:e+o},{x:n-s,y:e-o},{x:n+s,y:e-o},{x:n,y:e+o}]}[t]},x5t=n=>{const e=KTe.parse(n),t=e.h??g5t(e),i=[],r=[],o=[],s=1,a=1.2,c=e.left+e.right+(e.bottom??0)+(e.top??0);let l=[],u=1;if(e.left){const m=(e.left-1)/2*e.p;for(let y=0;y<e.left;y++)y===0&&(l=v5t(-e.w/2-e.pl/2,m-y*e.p,"left")),i.push(or(u,-e.w/2+e.pl/2,m-y*e.p,e.pl,e.pw)),r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${u}`,pcb_component_id:"1",layer:"top",anchor_position:{x:-e.w/2+e.pl/2-4.5,y:m-y*e.p},text:`pin${u}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),u++,e.innerhole&&o.push(Ps(u+c,-e.w/2+e.innerholeedgedistance,m-y*e.p,s,a))}if(e.bottom){const m=(e.bottom-1)/2*e.p;for(let y=e.bottom-1;y>=0;y--)i.push(or(u,m-y*e.p,-t/2+e.pl/2,e.pw,e.pl)),r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${u}`,pcb_component_id:"1",layer:"top",anchor_position:{x:m-y*e.p,y:-t/2+e.pl/2-3.2},text:`pin${u}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),u++,e.innerhole&&o.push(Ps(u+c,m-y*e.p,-t/2+e.innerholeedgedistance,s,a))}if(e.right){const m=-((e.right-1)/2)*e.p;for(let y=0;y<e.right;y++)i.push(or(u,e.w/2-e.pl/2,m+y*e.p,e.pl,e.pw)),r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${u}`,pcb_component_id:"1",layer:"top",anchor_position:{x:e.w/2-e.pl/2+3.7,y:m+y*e.p},text:`pin${u}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),u++,e.innerhole&&o.push(Ps(u+c,e.w/2-e.innerholeedgedistance,m+y*e.p,s,a))}if(e.top){const m=-((e.top-1)/2)*e.p;for(let y=e.top-1;y>=0;y--)i.push(or(u,m+y*e.p,t/2-e.pl/2,e.pw,e.pl)),r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${u}`,pcb_component_id:"1",layer:"top",anchor_position:{x:m+y*e.p,y:t/2-e.pl/2+3.2},text:`pin${u}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),u++,e.innerhole&&o.push(Ps(u+c,m+y*e.p,t/2-e.innerholeedgedistance,s,a))}const d={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"1",pcb_component_id:"1",layer:"top",route:l,stroke_width:.1},h={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:t/2+e.pl/3},{x:e.w/2+e.pl/3,y:t/2+e.pl/3},{x:e.w/2+e.pl/3,y:-t/2-e.pl/3},{x:-e.w/2-e.pl/3,y:-t/2-e.pl/3},{x:-e.w/2-e.pl/3,y:t/2+e.pl/3}],stroke_width:.1,layer:"top"},f=Zr(0,t/1.8,t/25);return{circuitJson:[...o,...i,...r,h,d,f],parameters:e}},b5t=n=>(n.legsoutside=!0,JA(n)),QTe=Re({fn:U(),w:et.default("10mm"),h:et.optional(),left:et.optional().default(20),right:et.optional().default(20),top:et.optional().default(0),bottom:et.optional().default(0),p:et.default(et.parse("2.54mm")),id:et.optional().default(et.parse("1mm")),od:et.optional().default(et.parse("1.5mm"))}),w5t=n=>{const e=QTe.parse(n);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},FD=(n,e,t,i=1,r=.6)=>{const o=i/2,s=r/2;return{left:[{x:n+o,y:e},{x:n-o,y:e+s},{x:n-o,y:e-s},{x:n+o,y:e}],right:[{x:n-o,y:e},{x:n+o,y:e+s},{x:n+o,y:e-s},{x:n-o,y:e}],top:[{x:n,y:e-o},{x:n-s,y:e+o},{x:n+s,y:e+o},{x:n,y:e-o}],bottom:[{x:n,y:e+o},{x:n-s,y:e-o},{x:n+s,y:e-o},{x:n,y:e+o}]}[t]},S5t=n=>{const e=QTe.parse(n),t=e.h??w5t(e),i=[],r=e.id,o=e.od;let s=[];if(e.right){const u=-((e.right-1)/2)*e.p;for(let d=0;d<e.right;d++)d===0&&!e.left&&!e.bottom&&(s=FD(e.w/2+o*1.4,u+d*e.p,"right")),i.push(Ps(d+1+e.left+(e.bottom??0),e.w/2,u+d*e.p,r,o))}if(e.left){const u=-((e.left-1)/2)*e.p;for(let d=0;d<e.left;d++)d===e.left-1&&(s=FD(-e.w/2-o*1.4,u+d*e.p,"left")),i.push(Ps(d+1,-e.w/2,u+d*e.p,r,o))}if(e.top){const u=-((e.top-1)/2)*e.p;for(let d=0;d<e.top;d++)d===e.top-1&&!e.left&&!e.bottom&&!e.right&&(s=FD(u+d*e.p,t/2+o*1.4,"top")),i.push(Ps(d+1+e.right+(e.bottom??0)+e.left,u+d*e.p,t/2,r,o))}if(e.bottom){const u=-((e.bottom-1)/2)*e.p;for(let d=0;d<e.bottom;d++)d===0&&!e.left&&(s=FD(u+d*e.p,-t/2-o*1.4,"bottom")),i.push(Ps(d+1+e.left,u+d*e.p,-t/2,r,o))}const a={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"1",pcb_component_id:"1",layer:"top",route:s,stroke_width:.1},c={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-e.w/2-o,y:t/2+o},{x:e.w/2+o,y:t/2+o},{x:e.w/2+o,y:-t/2-o},{x:-e.w/2-o,y:-t/2-o},{x:-e.w/2-o,y:t/2+o}],stroke_width:.1,layer:"top"},l=Zr(0,t/1.7,t/25);return{circuitJson:[...i,c,l,a],parameters:e}},JTe=(n,e,t,i)=>Array.from({length:25},(r,o)=>{const s=o/24*Math.PI-Math.PI/2;return{x:n+(i==="right"?1:-1)*Math.cos(s)*t,y:e+Math.sin(s)*t}}),E5t=Re({fn:U(),p:et.optional().default("4.88mm"),id:et.optional().default("0.6mm"),od:et.optional().default("1.2mm"),w:et.optional().default("5.6mm"),h:et.optional().default("3.5mm")}),T5t=n=>{const e=E5t.parse(n),{p:t,id:i,od:r,w:o,h:s}=e,a=s/2,c=[Ps(1,-t/2,0,i,r),Ps(2,t/2,0,i,r)],l=JTe(-o/2,0,a,"left"),u=JTe(o/2,0,a,"right"),d={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[...l,...l.slice(1).reverse(),{x:-o/2,y:-s/2},{x:o/2,y:-s/2},...u,{x:o/2,y:s/2},{x:-o/2,y:s/2}],stroke_width:.1,pcb_silkscreen_path_id:""},h=Zr(0,t/4,.5);return{circuitJson:[...c,d,h],parameters:e}};Re({w:et,h:et});var M5t=n=>{const{w:e,h:t}=n,i=Yu(e),r=Yu(t);return{circuitJson:[or(1,0,0,i,r),Zr(0,r/2+.5,.2)],parameters:n}},C5t=Re({fn:U(),num_pins:Gn([we(3),we(2)]).default(3),p:U().default("1.27mm"),id:U().default("0.72mm"),od:U().default("0.95mm"),w:U().default("4.5mm"),h:U().default("4.5mm"),inline:vt().default(!1),string:U().optional()}),A5t=(n,e,t)=>Array.from({length:25},(i,r)=>{const o=r/24*Math.PI;return{x:n+Math.cos(o)*t,y:e+Math.sin(o)*t}}),R5t=n=>{const{p:e,id:t,od:i,h:r}=n,o=Number.parseFloat(r)/2,s=Number.parseFloat(e);return[Ps(1,-s,o-s,t,i),Ps(2,s,o-s,t,i)]},P5t=n=>{const e=n.string?.match(/^to92_(\d+)/),t=e?Number.parseInt(e[1],10):3,i=C5t.parse({...n,num_pins:t}),{p:r,id:o,od:s,w:a,h:c,inline:l}=i,u=Number.parseFloat(c)/2,d=Number.parseFloat(r);let h=[];if(i.num_pins===3)h=l?[Ps(1,-d,u-d,o,s),Ps(2,0,u-d,o,s),Ps(3,d,u-d,o,s)]:[Ps(1,0,u,o,s),Ps(2,-d,u-d,o,s),Ps(3,d,u-d,o,s)];else if(i.num_pins===2)h=R5t(i);else throw new Error("Invalid number of pins for TO-92");const f=Number.parseFloat(a)/2,m=A5t(0,u,f),y={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[...m,{x:-f,y:0},{x:f,y:0},m[0]],stroke_width:.1,pcb_silkscreen_path_id:""},g=Zr(0,u+1,.5);return{circuitJson:[...h,y,g],parameters:i}},I5t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("2.15mm"),h:U().default("1.20mm"),pl:U().default("0.5mm"),pw:U().default("0.6mm"),p:U().default("1.4mm")}),N5t=n=>{const e=I5t.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:O5t(e).concat(i,t),parameters:e}},k5t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},O5t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=k5t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},D5t=$2({}),L5t=n=>{const e=D5t.parse(n),t=[];for(let s=0;s<e.num_pins;s++){const{x:a,y:c}=LK({num_pins:e.num_pins,pn:s+1,w:e.w,p:e.p??1.27,pl:e.pl,widthincludeslegs:!0});t.push(or(s+1,a,c,e.pl??"1.5mm",e.pw??"0.6mm"))}const i=(e.num_pins/2-1)*e.p+e.pw,r=Zr(0,i/2-.5,i/12),o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:-e.w/3,y:i/2+.2},{x:e.w/3,y:i/2+.2}],stroke_width:.1};return{circuitJson:[...t,r,o],parameters:e}},z5t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("5.0mm"),h:U().default("2.30mm"),pl:U().default("1.25mm"),pw:U().default("2mm"),p:U().default("3.75mm")}),F5t=n=>{const e=z5t.parse(n),t=Zr(0,et.parse(e.h)/2+1,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2+.5,y:et.parse(e.h)/2+.5},{x:-et.parse(e.w)/2-.5,y:et.parse(e.h)/2+.5},{x:-et.parse(e.w)/2-.5,y:-et.parse(e.h)/2-.5},{x:et.parse(e.p)/2+.5,y:-et.parse(e.h)/2-.5}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:U5t(e).concat(i,t),parameters:e}},B5t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},U5t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=B5t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},$5t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("4.4mm"),h:U().default("2.1mm"),pl:U().default("1.2mm"),pw:U().default("1.2mm"),p:U().default("2.9mm")}),j5t=n=>{const e=$5t.parse(n),t=Zr(0,et.parse(e.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:V5t(e).concat(i,t),parameters:e}},H5t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},V5t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=H5t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},q5t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.30mm"),h:U().default("1.80mm"),pl:U().default("0.60mm"),pw:U().default("0.45mm"),p:U().default("2.1mm")}),G5t=n=>{const e=q5t.parse(n),t=Zr(0,et.parse(e.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:X5t(e).concat(i,t),parameters:e}},Y5t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},X5t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Y5t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},W5t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("1.4mm"),h:U().default("0.9mm"),pl:U().default("0.35mm"),pw:U().default("0.25mm"),p:U().default("1.2mm")}),Z5t=n=>{const e=W5t.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2+.15,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.4,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.4,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2+.15,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Q5t(e).concat(i,t),parameters:e}},K5t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Q5t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=K5t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},J5t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("1.3mm"),h:U().default("0.9mm"),pl:U().default("0.4mm"),pw:U().default("0.7mm"),p:U().default("0.7mm")}),e3t=n=>{const e=J5t.parse(n),t=Zr(0,et.parse(e.h)+.1,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2+.2,y:et.parse(e.h)/2+.2},{x:-et.parse(e.w)/2-.2,y:et.parse(e.h)/2+.2},{x:-et.parse(e.w)/2-.2,y:-et.parse(e.h)/2-.2},{x:et.parse(e.p)/2+.2,y:-et.parse(e.h)/2-.2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:n3t(e).concat(i,t),parameters:e}},t3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},n3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=t3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},i3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3,05mm"),h:U().default("1.65mm"),pl:U().default("0.6mm"),pw:U().default("0.6mm"),pad_spacing:U().default("2.2mm")}),r3t=n=>{const e=i3t.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.pad_spacing)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:-et.parse(e.h)/2},{x:et.parse(e.pad_spacing)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:s3t(e).concat(i,t),parameters:e}},o3t=n=>{const{pn:e,pad_spacing:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},s3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=o3t({pn:t,pad_spacing:Number.parseFloat(n.pad_spacing)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},a3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("4.4mm"),h:U().default("2.1mm"),pl:U().default("1.2mm"),pw:U().default("1.2mm"),p:U().default("2.9mm")}),c3t=n=>{const e=a3t.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:u3t(e).concat(i,t),parameters:e}},l3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},u3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=l3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},d3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("4.4mm"),h:U().default("2.1mm"),pl:U().default("0.91mm"),pw:U().default("1.22mm"),p:U().default("3.146mm")}),h3t=n=>{const e=d3t.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:f3t(e).concat(i,t),parameters:e}},p3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},f3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=p3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},m3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("1.80mm"),h:U().default("1.00mm"),pl:U().default("0.66mm"),pw:U().default("0.5mm"),p:U().default("0.8mm")}),_3t=n=>{const e=m3t.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.1,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.1,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:g3t(e).concat(i,t),parameters:e}},y3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},g3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=y3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},v3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("6.2mm"),h:U().default("3.4mm"),pl:U().default("1.4mm"),pw:U().default("2.1mm"),p:U().default("4.4mm")}),x3t=n=>{const e=v3t.parse(n),t=Zr(0,et.parse(e.h)/2+.4,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:w3t(e).concat(i,t),parameters:e}},b3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},w3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=b3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},S3t=Re({fn:U(),num_pins:Gn([we(3),we(5)]).default(3),w:U().default("4.80mm"),h:U().default("4.80mm"),pl:U().default("1.3mm"),pw:U().default("0.9mm"),p:U().default("1.5mm"),string:U().optional()}),E3t=n=>{const e=[],t=Number.parseFloat(n.p),i=Number.parseFloat(n.pw),r=Number.parseFloat(n.w),o=Number.parseFloat(n.pl);e.push(or(1,-r/2,t,o,i),or(2,-r/2+(1.5-1.3)/2,0,1.5,i),or(3,-r/2,-t,o,i));const s=Zr(0,0,.3),a=Number.parseFloat(n.w)/2-1,c=Number.parseFloat(n.h)/2,l={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-a,y:c},{x:a,y:c},{x:a,y:c/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},u={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-a,y:-c},{x:a,y:-c},{x:a,y:-c/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,l,u,s]},T3t=n=>{const e=[];Number.parseFloat(n.p),Number.parseFloat(n.pw),Number.parseFloat(n.w),e.push(or(1,-1.85,-1.5,1.5,.7),or(2,-1.85,1.5,1.5,.7),or(3,0,0,.8,2),or(4,1.85,-1.5,1.5,.7),or(5,1.85,1.5,1.5,.7));const t=Zr(0,Number.parseFloat(n.h)/2+.5,.3),i=Number.parseFloat(n.w)/2-1,r=Number.parseFloat(n.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:r},{x:i,y:r}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-r},{x:i,y:-r}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,o,s,t]},M3t=n=>{const e=n.string?.match(/^sot89_(\d+)/),t=e?Number.parseInt(e[1],10):3,i=S3t.parse({...n,num_pins:t});if(i.num_pins===3)return{circuitJson:E3t(i),parameters:i};if(i.num_pins===5)return{circuitJson:T3t(i),parameters:i};throw new Error("Invalid number of pins for SOT89")},C3t=Re({fn:U(),p:et.optional().default("5.0mm"),id:et.optional().default("1.0mm"),od:et.optional().default("1.9mm"),w:et.optional().default("13mm"),h:et.optional().default("7mm"),num_pins:Fe().optional(),string:U().optional()}),A3t=n=>{const e=C3t.parse(n),{fn:t,id:i,od:r,w:o,h:s,string:a}=e,c=Number.parseInt(a?.split("_")[1]??"3"),l=-1,u=o/2,d=s/2,h=2.5,f=o*.4,m=Math.max(h,f/(c-1)),y=Array.from({length:c},(N,R)=>{const k=c%2===0?(R-c/2+.5)*m:(R-Math.floor(c/2))*m;return Ps(R+1,k,l,i,r)}),g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-u,y:-d},{x:u,y:-d},{x:u,y:d},{x:-u,y:d},{x:-u,y:-d}],stroke_width:.1,pcb_silkscreen_path_id:""},b=-d+2*s/3,x={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-u,y:b},{x:u,y:b}],stroke_width:.1,pcb_silkscreen_path_id:""},w=[{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-o/6,y:b},{x:-o/6,y:d}],stroke_width:.1,pcb_silkscreen_path_id:""},{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:o/6,y:b},{x:o/6,y:d}],stroke_width:.1,pcb_silkscreen_path_id:""}],T=Zr(0,s/2+.6,.5);return{circuitJson:[...y,g,x,...w,T],parameters:{...e,p:m}}},R3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("5.40mm"),h:U().default("2.30mm"),pl:U().default("1.30mm"),pw:U().default("1.70mm"),p:U().default("3.5mm")}),P3t=n=>{const e=R3t.parse(n),t=Zr(0,et.parse(e.h)/2+.4,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:N3t(e).concat(i,t),parameters:e}},I3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},N3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=I3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},k3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("1.90mm"),h:U().default("1.33mm"),pl:U().default("0.5mm"),pw:U().default("0.7mm"),p:U().default("0.8mm")}),O3t=n=>{const e=k3t.parse(n),t=Zr(0,et.parse(e.h)+.1,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2+.1,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2+.1,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:L3t(e).concat(i,t),parameters:e}},D3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},L3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=D3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},z3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("7.0mm"),h:U().default("3.35mm"),pl:U().default("1.50mm"),pw:U().default("2.70mm"),p:U().default("4.8mm")}),F3t=n=>{const e=z3t.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:U3t(e).concat(i,t),parameters:e}},B3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},U3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=B3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},$3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.0mm"),h:U().default("1.80mm"),pl:U().default("0.80mm"),pw:U().default("1.20mm"),p:U().default("1.6mm")}),j3t=n=>{const e=$3t.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.1,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.1,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:V3t(e).concat(i,t),parameters:e}},H3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},V3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=H3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},q3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("7.10mm"),h:U().default("3.40mm"),pl:U().default("2.45mm"),pw:U().default("1.80mm"),p:U().default("4.05mm")}),G3t=n=>{const e=q3t.parse(n),t=Zr(0,et.parse(e.h)/2+.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.5,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.5,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:X3t(e).concat(i,t),parameters:e}},Y3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},X3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Y3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},W3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("4.80mm"),h:U().default("2.10mm"),pl:U().default("1.30mm"),pw:U().default("1.40mm"),p:U().default("2.9mm")}),Z3t=n=>{const e=W3t.parse(n),t=Zr(0,et.parse(e.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Q3t(e).concat(i,t),parameters:e}},K3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Q3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=K3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},J3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("7.30mm"),h:U().default("4.40mm"),pl:U().default("2.50mm"),pw:U().default("2.30mm"),p:U().default("4.30mm")}),ewt=n=>{const e=J3t.parse(n),t=Zr(0,et.parse(e.h)/2+.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.1,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.1,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:nwt(e).concat(i,t),parameters:e}},twt=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},nwt=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=twt({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},iwt=Re({fn:U(),num_pins:we(2).default(2),w:U().default("10.70mm"),h:U().default("6.60mm"),pl:U().default("3.30mm"),pw:U().default("2.50mm"),p:U().default("6.80mm")}),rwt=n=>{const e=iwt.parse(n),t=Zr(0,3,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2-.8},{x:-et.parse(e.w)/2-.8,y:et.parse(e.h)/2-.8},{x:-et.parse(e.w)/2-.8,y:-et.parse(e.h)/2+.8},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2+.8}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:swt(e).concat(i,t),parameters:e}},owt=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},swt=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=owt({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},awt=Re({fn:U(),num_pins:Fe().default(4),w:U().default("8.50mm"),h:U().default("6.90mm"),pl:U().default("2mm"),pw:U().default("1.5mm"),p:U().default("2.30mm"),string:U().optional()}),cwt=n=>{const e=n.string?.match(/^sot223_(\d+)/),t=e?Number.parseInt(e[1],10):4;if(t===8){const r=dwt.parse({...n,num_pins:t});return{circuitJson:hw(r),parameters:r}}const i=awt.parse({...n,num_pins:t});if(i.num_pins===4)return{circuitJson:uwt(i),parameters:i};if(i.num_pins===5)return{circuitJson:pwt(i),parameters:i};if(i.num_pins===6)return{circuitJson:mwt(i),parameters:i};throw new Error("Invalid number of pins")},lwt=n=>{const{pn:e,w:t,p:i}=n;return e===1?{x:-t/2+1.1,y:i}:e===2?{x:-t/2+1.1,y:0}:e===3?{x:-t/2+1.1,y:-i}:{x:t/2-1.1,y:0}},uwt=n=>{const e=[];for(let a=0;a<n.num_pins;a++){const{x:c,y:l}=lwt({num_pins:n.num_pins,pn:a+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl),p:Number.parseFloat(n.p)}),u=a===3?3.8:Number.parseFloat(n.pw);e.push(or(a+1,c,l,Number.parseFloat(n.pl),u))}const t=Zr(0,0,.3),i=Number.parseFloat(n.w)/2-2.4,r=Number.parseFloat(n.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:r},{x:i,y:r},{x:i,y:r/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-r},{x:i,y:-r},{x:i,y:-r/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,o,s,t]},dwt=$2({p:"0.90mm",w:"2.8mm",legsoutside:!0}),hwt=n=>{const{p:e,pn:t,w:i}=n;if(t===1)return{x:-i/2+1.2,y:e/2+e};if(t===2)return{x:-i/2+1.2,y:e/2};if(t===3)return{x:-i/2+1.2,y:-e/2};if(t===4)return{x:-i/2+1.2,y:-e/2-e};if(t===5)return{x:i/2-1,y:0};throw new Error("Invalid pin number")},pwt=n=>{const e=[];for(let a=1;a<=n.num_pins;a++){const{x:c,y:l}=hwt({h:Number.parseFloat(n.h),p:1.5,pn:a,w:Number.parseFloat(n.w)});let u=Number.parseFloat(n.pw),d=Number.parseFloat(n.pl);a===5?(u=3.4,d=1.8):(u=1,d=2.2),e.push(or(a,c,l,d,u))}const t=Number.parseFloat(n.w)/2-2.4,i=Number.parseFloat(n.h)/2,r={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-t,y:i},{x:t,y:i},{x:t,y:i/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-t,y:-i},{x:t,y:-i},{x:t,y:-i/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1},s=Zr(0,0,.3);return[...e,r,o,s]},fwt=n=>{const{p:e,pn:t,w:i}=n;if(t===1)return{x:-i/2+1.2,y:2*e};if(t===2)return{x:-i/2+1.2,y:e};if(t===3)return{x:-i/2+1.2,y:0};if(t===4)return{x:-i/2+1.2,y:-e};if(t===5)return{x:-i/2+1.2,y:-2*e};if(t===6)return{x:i/2-1.175,y:0};throw new Error("Invalid pin number")},mwt=n=>{const e=[];for(let a=1;a<=n.num_pins;a++){const{x:c,y:l}=fwt({h:Number.parseFloat(n.h),p:1.3,pn:a,w:8.7});let u=Number.parseFloat(n.pw),d=Number.parseFloat(n.pl);a===6?(u=3.4,d=2.15):(u=.6,d=2.2),e.push(or(a,c,l,d,u))}const t=Number.parseFloat(n.w)/2-2.4,i=Number.parseFloat(n.h)/2,r={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-t,y:i},{x:t,y:i},{x:t,y:i/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-t,y:-i},{x:t,y:-i},{x:t,y:-i/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1},s=Zr(0,0,.3);return[...e,r,o,s]},_wt=Re({fn:U(),num_pins:Fe().default(3),w:U().default("3.40mm"),h:U().default("3.30mm"),pl:U().default("1mm"),pw:U().default("0.7mm"),p:U().default("1.2mm"),string:U().optional()}),ywt=n=>{const e=n.string?.match(/^sot23w_(\d+)/),t=e?Number.parseInt(e[1],3):3,i=_wt.parse({...n,num_pins:t});if(i.num_pins===3)return{circuitJson:vwt(i),parameters:i};throw new Error("Invalid number of pins")},gwt=n=>{const{pn:e,p:t}=n;return e===1?{x:-t,y:.95}:e===2?{x:-t,y:-.95}:{x:t,y:0}},vwt=n=>{const e=[];for(let a=0;a<n.num_pins;a++){const{x:c,y:l}=gwt({num_pins:n.num_pins,pn:a+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl),p:Number.parseFloat(n.p)});e.push(or(a+1,c,l,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=Zr(0,Number.parseInt(n.h)/2+1,.3),i=Number.parseFloat(n.w)/2-1,r=Number.parseFloat(n.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:r},{x:i+.3,y:r},{x:i+.3,y:r/2}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-r},{x:i+.3,y:-r},{x:i+.3,y:-r/2}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,o,s,t]},xwt=Re({fn:U(),num_pins:Gn([we(3),we(2)]).default(3),p:U().default("1.27mm"),id:U().default("0.72mm"),od:U().default("0.95mm"),w:U().default("2.5mm"),h:U().default("4.2mm"),string:U().optional()}),bwt=n=>{const{p:e,id:t,od:i,w:r,h:o}=n,s=Number.parseFloat(o)/2,a=Number.parseFloat(e);return[Ps(1,-a,s-a,t,i),Ps(2,0,s-a,t,i),Ps(3,a,s-a,t,i)]},wwt=n=>{const{p:e,id:t,od:i,h:r}=n,o=Number.parseFloat(r)/2,s=Number.parseFloat(e);return[Ps(1,-s,o-s,t,i),Ps(2,s,o-s,t,i)]},Swt=n=>{const e=n.string?.match(/^to92s_(\d+)/),t=e?Number.parseInt(e[1],10):3,i=xwt.parse({...n,num_pins:t});let r=[];if(i.num_pins===3)r=bwt(i);else if(i.num_pins===2)r=wwt(i);else throw new Error("Invalid number of pins for TO-92");const o=Number.parseFloat(i.h)/2,s=Number.parseFloat(i.p),a={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-o,y:o-s},{x:-1.9,y:0},{x:1.9,y:0},{x:o,y:o-s},{x:1.5,y:Number.parseFloat(i.h)/2+.5},{x:-1.5,y:Number.parseFloat(i.h)/2+.5},{x:-o,y:o-s}],stroke_width:.1,pcb_silkscreen_path_id:""},c=Zr(0,o+1,.5);return{circuitJson:[...r,a,c],parameters:i}},Ewt=Re({fn:U(),p:et.optional(),id:et.optional(),pw:et.optional(),pl:et.optional(),w:et.optional(),h:et.optional(),sh:Gn([vt(),U(),Fe()]).optional().transform(n=>{if(typeof n=="string"){const e=Number(n);return Number.isNaN(e)?!0:e}return n}).describe('JST SH (Surface-mount) connector family. SH stands for "Super High-density".'),ph:vt().optional().describe('JST PH (Through-hole) connector family. PH stands for "Pin Header".'),string:U().optional()}),Twt={ph:{p:et.parse("2.2mm"),id:et.parse("0.70mm"),pw:et.parse("1.20mm"),pl:et.parse("1.20mm"),w:et.parse("6mm"),h:et.parse("5mm")},sh:{p:et.parse("1mm"),pw:et.parse("0.6mm"),pl:et.parse("1.55mm"),w:et.parse("5.8mm"),h:et.parse("7.8mm")}};function Mwt(n){return n.sh?"sh":(n.ph,"ph")}function Cwt(n,e,t,i,r,o){const s=[];if(n==="ph"){const a=t/2;s.push(DD(1,-a,2,i,r,o)),s.push(DD(2,a,2,i,r,o))}else{const a=-((e-1)/2)*t;for(let l=0;l<e;l++){const u=a+l*t;console.log("x si",u),s.push(or(l+1,u,-1.325,r,o))}const c=(e-1)/2*t+1.3;console.log("offset",c),s.push(or(e+1,-c,1.22,1.2,1.8)),s.push(or(e+2,c,1.22,1.2,1.8))}return s}function Awt(n,e,t){return n==="ph"?{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-3,y:3},{x:3,y:3},{x:3,y:-2},{x:-3,y:-2},{x:-3,y:3}],stroke_width:.1,pcb_silkscreen_path_id:""}:{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[],stroke_width:.1,pcb_silkscreen_path_id:""}}var Rwt=n=>{const e=Ewt.parse(n),t=Mwt(e),i=Twt[t],r=e.p??i.p,o=e.id??i.id,s=e.pw??i.pw,a=e.pl??i.pl,c=e.w??i.w,l=e.h??i.h;let u=t==="sh"?4:2;if(t==="sh"){const y=(typeof n.string=="string"?n.string:"").match(/sh(\d+)/);if(y&&y[1]){const g=parseInt(y[1],10);Number.isNaN(g)||(u=g)}else typeof e.sh=="number"&&(u=e.sh)}const d=Cwt(t,u,r,o,s,a),h=Awt(t),f=Zr(0,l/2+1,.5);return{circuitJson:[...d,h,f],parameters:{...e,p:r,id:o,pw:s,pl:a,w:c,h:l,num_pins:u,sh:t==="sh",ph:t==="ph"}}},Pwt=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.30mm"),h:U().default("1.70mm"),pl:U().default("0.80mm"),pw:U().default("1mm"),p:U().default("1.90mm")}),Iwt=n=>{const e=Pwt.parse(n),t=Zr(0,et.parse(e.h)/2+.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:kwt(e).concat(i,t),parameters:e}},Nwt=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},kwt=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Nwt({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Owt=n=>{switch(n){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"}}},Dwt=Re({fn:U(),num_pins:Gn([we(8),we(10)]).default(8),w:U().optional(),h:U().optional(),p:U().optional(),pl:U().optional(),pw:U().optional(),string:U().optional()}),Lwt=n=>{const e=Dwt.parse(n),t=Owt(e.num_pins),i=et.parse(e.w||t.w),r=et.parse(e.h||t.h),o=et.parse(e.p||t.p),s=et.parse(e.pl||t.pl),a=et.parse(e.pw||t.pw),c=[],l=e.num_pins/2;for(let x=0;x<e.num_pins;x++){const{x:w,y:T}=e8e(e.num_pins,x+1,i,o),N=x<l?x+1:e.num_pins-(x-l);c.push(or(N,w,T,s,a))}const u=i,d=r,h={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-u/2,y:d/2},{x:u/2,y:d/2}],stroke_width:.05,pcb_silkscreen_path_id:""},f={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-u/2,y:-d/2},{x:u/2,y:-d/2}],stroke_width:.05,pcb_silkscreen_path_id:""},m=e8e(e.num_pins,1,u,o),y={x:m.x-.8,y:m.y},g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:y.x-.4,y:y.y},{x:y.x-.7,y:y.y+.3},{x:y.x-.7,y:y.y-.3},{x:y.x-.4,y:y.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},b=Zr(0,d/2+.5,.3);return{circuitJson:[...c,h,f,b,g],parameters:e}},e8e=(n,e,t,i)=>{const r=n/2,o=(e-1)%r,s=e<=r?-1:1,a=(r-1)/2-o;return{x:s*et.parse(n===8?"1.8mm":"2.2mm"),y:a*i}},zwt=n=>{switch(n){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"}}},Fwt=Re({fn:U(),num_pins:Gn([we(8),we(10),we(12),we(16)]).default(8),w:U().optional(),h:U().optional(),p:U().optional(),pl:U().optional(),pw:U().optional(),string:U().optional()}),t8e=(n,e,t,i)=>{const r=n/2,o=(e-1)%r,s=e<=r?-1:1,a=(r-1)/2-o;return{x:s*et.parse("2mm"),y:a*i}},Bwt=n=>{const e=Fwt.parse(n),t=zwt(e.num_pins),i=et.parse(e.w||t.w),r=et.parse(e.h||t.h),o=et.parse(e.p||t.p),s=et.parse(e.pl||t.pl),a=et.parse(e.pw||t.pw),c=[];for(let b=0;b<e.num_pins;b++){const{x,y:w}=t8e(e.num_pins,b+1,i,o);c.push(or(b+1,x,w,s,a))}const l=i,u=r,d={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:""},f=t8e(e.num_pins,1,l,o),m={x:f.x-.8,y:f.y},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"},g=Zr(0,u/2+.5,.3);return{circuitJson:[...c,d,h,g,y],parameters:e}},Uwt=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.8mm"),h:U().default("1.65mm"),pl:U().default("1.2mm"),pw:U().default("1.2mm"),pad_spacing:U().default("2.6mm")}),$wt=n=>{const e=Uwt.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.pad_spacing)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:-et.parse(e.h)/2},{x:et.parse(e.pad_spacing)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Hwt(e).concat(i,t),parameters:e}},jwt=n=>{const{pn:e,pad_spacing:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Hwt=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=jwt({pn:t,pad_spacing:Number.parseFloat(n.pad_spacing)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Vwt=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.20mm"),h:U().default("1.65mm"),pl:U().default("0.8mm"),pw:U().default("0.9mm"),pad_spacing:U().default("2.1mm")}),qwt=n=>{const e=Vwt.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.pad_spacing)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:-et.parse(e.h)/2},{x:et.parse(e.pad_spacing)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Ywt(e).concat(i,t),parameters:e}},Gwt=n=>{const{pn:e,pad_spacing:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Ywt=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Gwt({pn:t,pad_spacing:Number.parseFloat(n.pad_spacing)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Xwt=Re({fn:U(),num_pins:Gn([we(6),we(8)]).default(8),w:U().default("3mm"),h:U().default("3mm"),p:U().default("0.5mm"),pl:U().default("0.52mm"),pw:U().default("0.35mm"),epw:U().default("1.40mm"),eph:U().default("1.60mm"),string:U().optional(),ep:vt().default(!1)}),Wwt=n=>{n.string&&n.string.includes("_ep")&&(n.ep=!0);const e=n.string?.match(/^son_(\d+)/),t=e?Number.parseInt(e[1],10):n.num_pins||8,i=Xwt.parse({...n,num_pins:t}),r=et.parse(i.w),o=et.parse(i.h),s=et.parse(i.p),a=et.parse(i.pl),c=et.parse(i.pw),l=et.parse(i.epw),u=et.parse(i.eph),d=[];for(let T=0;T<i.num_pins;T++){const{x:N,y:R}=n8e(i.num_pins,T+1,r,s);d.push(or(T+1,N,R,a,c))}i.ep&&d.push(or(i.num_pins+1,0,0,l,u));const h=r,f=o,m={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-h/2,y:f/2},{x:h/2,y:f/2}],stroke_width:.05,pcb_silkscreen_path_id:""},y={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-h/2,y:-f/2},{x:h/2,y:-f/2}],stroke_width:.05,pcb_silkscreen_path_id:""},g=n8e(i.num_pins,1,h,s),b={x:g.x-.4,y:g.y},x={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:b.x-.4,y:b.y},{x:b.x-.7,y:b.y+.3},{x:b.x-.7,y:b.y-.3},{x:b.x-.4,y:b.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},w=Zr(0,f/2+.5,.3);return{circuitJson:[...d,m,y,w,x],parameters:i}},n8e=(n,e,t,i)=>{const r=n/2,o=(e-1)%r,s=e<=r?-1:1,a=(r-1)/2-o;return{x:s*et.parse("1.4mm"),y:a*i}},Zwt=n=>{const{num_pins:e,bridged:t,p:i=2.54,pw:r=1.5,ph:o=1.5}=n,s=et.parse(i),a=et.parse(r),c=et.parse(o),l=Math.min(c/4,.5),u=[];for(let T=0;T<e;T++)u.push(or(T+1,T*s,0,a,c));let d=[];if(t){const T=t.split("").map(Number);if(T.length>1)for(let N=0;N<T.length-1;N++){const R=T[N],k=T[N+1];if(typeof R=="number"&&typeof k=="number"&&!isNaN(R)&&!isNaN(k)){const M=(R-1)*s,I=(k-1)*s,C=Math.sign(I-M),$=M+C*(a/2),P=I-C*(a/2);d.push({type:"pcb_trace",pcb_trace_id:"",route:[{start_pcb_port_id:`{PIN${R}}`,x:$,y:0,width:l,layer:"top",route_type:"wire"},{end_pcb_port_id:`{PIN${k}}`,x:P,y:0,width:l,layer:"top",route_type:"wire"}]})}}}const h=(e-1)*s+a+.7,f=c+1,m=(e-1)*s/2,y=0,g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"outline",route:[{x:m-h/2,y:y-f/2},{x:m+h/2,y:y-f/2},{x:m+h/2,y:y+f/2},{x:m-h/2,y:y+f/2},{x:m-h/2,y:y-f/2}],stroke_width:.15},x=y+f/2+.6,w=Zr(m,x,.4);return{circuitJson:[...u,...d,g,w],parameters:n}},i8e=(n,e,t,i,r)=>({type:"pcb_smtpad",x:e,y:t,width:i,height:r,radius:r/2,layer:"top",shape:"pill",pcb_smtpad_id:"",port_hints:Array.isArray(n)?n.map(o=>o.toString()):[n.toString()]}),r8e={fn:we("sot457"),num_pins:we(6).default(6),pillh:U().default("0.45mm"),pillw:U().default("1.45mm"),pl:U(),pw:U(),p:U(),wave:vt().optional(),reflow:vt().optional()},Kwt=Re({...r8e,h:U().default("2.5mm"),w:U().default("2.7mm"),pl:U().default("0.8mm"),pw:U().default("0.55mm"),p:U().default("0.95mm")}),Qwt=Re({...r8e,h:U().default("3mm"),w:U().default("4mm"),pillr:U().default("0.225mm"),pl:U().default("1.45mm"),pw:U().default("1.5mm"),p:U().default("1.475mm")}).transform(n=>({...n,wave:n.wave??(n.reflow===void 0?!0:!n.reflow),reflow:n.reflow??(n.wave===void 0?!1:!n.wave)})),pw=n=>Number.parseFloat(n.replace("mm","")),o8e=({pitch:n,width:e,pinNumber:t})=>{const o={1:{x:-e/2-.1,y:n},2:{x:-e/2-.1,y:0},3:{x:-e/2-.1,y:-n},4:{x:e/2+.1,y:-n},5:{x:e/2+.1,y:0},6:{x:e/2+.1,y:n}}[t];if(!o)throw new Error(`Invalid pin number: ${t}`);return o},s8e=n=>{const e=[],t=pw(n.p),i=pw(n.pl),r=pw(n.pw),o=pw(n.w),s=pw(n.h);if(n.wave){const m={1:({padWidth:y,padHeight:g})=>or(1,-t,t,g,y),2:({padWidth:y,padHeight:g})=>or(2,-t,-t,g,y),3:({padWidth:y,padHeight:g})=>i8e(3,-t,0,pw(n.pillw),pw(n.pillh)),4:({padWidth:y,padHeight:g})=>i8e(4,t,0,pw(n.pillw),pw(n.pillh)),5:({padWidth:y,padHeight:g})=>or(5,t,t,g,y),6:({padWidth:y,padHeight:g})=>or(6,t,-t,g,y)};for(let y=1;y<=n.num_pins;y++){const g=m[y];g&&e.push(g({padWidth:i,padHeight:r}))}}else for(let m=1;m<=n.num_pins;m++){const{x:y,y:g}=o8e({pitch:t,width:o,pinNumber:m});e.push(or(m,y,g,i,r))}const a={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-o/3,y:s/2+t/1.3},{x:o/3,y:s/2+t/1.3}],stroke_width:.05},c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-o/3,y:-s/2-t/1.3},{x:o/3,y:-s/2-t/1.3}],stroke_width:.05},l=Zr(0,s+.5,.3),u=o8e({pitch:t,width:o,pinNumber:1}),d=n.wave?1:.5,h=n.wave?.7:.3;u.x-=n.wave?r:r*1.7;const f={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:u.x+d/2,y:u.y},{x:u.x-d/2,y:u.y+h/2},{x:u.x-d/2,y:u.y-h/2},{x:u.x+d/2,y:u.y}],stroke_width:.05};return[l,a,c,f,...e]},Jwt=n=>{if(n.wave){const t=Qwt.parse({...n,fn:"sot457"});return{circuitJson:s8e(t),parameters:t}}const e=Kwt.parse(n);return{circuitJson:s8e(e),parameters:e}},eSt=Re({fn:U(),num_pins:Gn([we(3),we(2)]).default(3),p:U().default("3.8mm"),id:U().default("1.25mm"),od:U().default("2.35mm"),ca:U().default("14mm").describe("Caliper axis (width or diameter of the potentiometer body or adjustment knob)"),w:U().default("5.35mm"),h:U().default("4mm"),string:U().optional()}),tSt=n=>{const{p:e,id:t,od:i,h:r,ca:o}=n,s=Number.parseFloat(r),a=Number.parseFloat(o);return[Ps(1,0,a/4+.3,t,i),Ps(2,s,0,t,i),Ps(3,0,-a/4-.3,t,i)]},nSt=n=>{const e=n.string?.match(/^potentiometer_(\d+)/),t=e?Number.parseInt(e[1],10):3,i=eSt.parse({...n,num_pins:t});let r=[];i.num_pins===3&&(r=tSt(i));const o=Number.parseFloat(i.ca)/2+.15,s=Number.parseFloat(i.w),a=Number.parseFloat(i.od)/2+.35,c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:0,y:o-1.75},{x:0,y:o},{x:s,y:o},{x:s,y:a}],stroke_width:.1,pcb_silkscreen_path_id:""},l={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:s,y:-a},{x:s,y:-o},{x:0,y:-o},{x:0,y:-o+1.75}],stroke_width:.1,pcb_silkscreen_path_id:""},u=Number.parseFloat(i.w)/2,d=Zr(u,o+1,.5);return{circuitJson:[...r,c,l,d],parameters:i}},iSt=Re({fn:U(),p:et.optional().default("7.5mm"),id:et.optional().default("1mm"),od:et.optional().default("2mm"),d:et.optional().default("10.5mm")}),rSt=(n,e,t,i,r)=>{const o=[],s=[];for(let a=0;a<=50;a++){const c=a/50*Math.PI,l=n+Math.cos(c)*t,u=e+Math.sin(c)*t;l<n-i&&u>=e-r/2&&u<=e+r/2||o.push({x:l,y:u})}for(let a=0;a<=50;a++){const c=Math.PI+a/50*Math.PI,l=n+Math.cos(c)*t,u=e+Math.sin(c)*t;l<n-i&&u>=e-r/2&&u<=e+r/2||s.push({x:l,y:u})}return{topArc:o,bottomArc:s}},oSt=n=>{const e=iSt.parse(n),{p:t,id:i,od:r,d:o}=e,s=[Ps(1,-t/2,0,i,r),Ps(2,t/2,0,i,r)],{topArc:a,bottomArc:c}=rSt(0,0,o/2+.1,r/2,r),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:c,stroke_width:.1,pcb_silkscreen_path_id:""},d={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:0,y:o/2+.1},{x:0,y:-(o/2+.1)}],stroke_width:.1,pcb_silkscreen_path_id:""},h=-(o/2+.5),f=r/2+1.5,m=.5,y={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:h-m,y:f},{x:h+m,y:f}],stroke_width:.1,pcb_silkscreen_path_id:""},g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:h,y:f-m},{x:h,y:f+m}],stroke_width:.1,pcb_silkscreen_path_id:""},b=Zr(0,o/2+1,.5);return{circuitJson:[...s,l,u,d,y,g,b],parameters:e}},sSt=Re({fn:U(),num_pins:we(2).default(2),w:U().default("6.5mm"),h:U().default("3mm"),pl:U().default("1.75mm"),pw:U().default("2.40mm"),p:U().default("4.75mm")}),aSt=n=>{const e=sSt.parse(n),t=Zr(0,et.parse(e.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.3,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.3,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:lSt(e).concat(i,t),parameters:e}},cSt=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},lSt=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=cSt({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},uSt=Re({fn:U(),num_pins:Fe().default(3),w:U().default("2.45mm"),h:U().default("2.40mm"),pl:U().default("0.45mm"),pw:U().default("0.70mm"),p:U().default("1mm"),string:U().optional()}),dSt=n=>{const e=n.string?.match(/^sot323_(\d+)/),t=e?Number.parseInt(e[1],3):3,i=uSt.parse({...n,num_pins:t});if(i.num_pins===3)return{circuitJson:pSt(i),parameters:i};throw new Error("Invalid number of pins")},hSt=n=>{const{pn:e,p:t}=n;return e===1?{x:-t,y:.65}:e===2?{x:-t,y:-.65}:{x:t,y:0}},pSt=n=>{const e=[];for(let a=0;a<n.num_pins;a++){const{x:c,y:l}=hSt({num_pins:n.num_pins,pn:a+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl),p:Number.parseFloat(n.p)});e.push(or(a+1,c,l,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=Zr(0,Number.parseInt(n.h)/2+1,.3),i=Number.parseFloat(n.w)/2-Number.parseFloat(n.pl),r=Number.parseFloat(n.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:r+.3},{x:i,y:r+.3},{x:i,y:r/2}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-r-.3},{x:i,y:-r-.3},{x:i,y:-r/2}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,o,s,t]},fSt=Re({fn:U(),circle:vt().optional(),rect:vt().optional(),square:vt().optional(),d:et.optional(),pd:et.optional(),diameter:et.optional(),r:et.optional(),pr:et.optional(),radius:et.optional(),w:et.optional(),pw:et.optional(),width:et.optional(),h:et.optional(),ph:et.optional(),height:et.optional(),s:et.optional(),size:et.optional(),string:U().optional()}).transform(n=>{let e="rect";n.circle&&(e="circle"),n.square&&(e="square"),n.rect&&(e="rect");let t,i,r;return e==="circle"?n.r!==void 0?t=Yu(n.r):n.pr!==void 0?t=Yu(n.pr):n.radius!==void 0?t=Yu(n.radius):n.d!==void 0?t=Yu(n.d)/2:n.pd!==void 0?t=Yu(n.pd)/2:n.diameter!==void 0?t=Yu(n.diameter)/2:t=Yu("1mm")/2:(n.w!==void 0?i=Yu(n.w):n.pw!==void 0?i=Yu(n.pw):n.width!==void 0?i=Yu(n.width):n.s!==void 0?i=Yu(n.s):n.size!==void 0?i=Yu(n.size):i=Yu("1mm"),n.h!==void 0?r=Yu(n.h):n.ph!==void 0?r=Yu(n.ph):n.height!==void 0?r=Yu(n.height):r=i),{fn:n.fn,shape:e,radius:t,width:i,height:r}}),mSt=n=>{const e=fSt.parse(n),{shape:t,radius:i,width:r,height:o}=e;return{circuitJson:[t==="circle"?jTe(1,{x:0,y:0,radius:i}):or(1,0,0,r,o),Zr(0,t==="circle"?i+.5:o/2+.5,.2)],parameters:e}},_St=Re({fn:U(),d:et.optional(),hd:et.optional(),r:et.optional(),hr:et.optional(),pd:et.optional(),pr:et.optional(),squarepad:vt().optional().default(!1)}).transform(n=>{let e;n.d!==void 0?e=Yu(n.d):n.hd!==void 0?e=Yu(n.hd):n.r!==void 0?e=Yu(n.r)*2:n.hr!==void 0?e=Yu(n.hr)*2:e=Yu("1mm");let t;return n.pd!==void 0?t=Yu(n.pd):n.pr!==void 0?t=Yu(n.pr)*2:t=e*(1.5/1),{fn:n.fn,d:e,pd:t,squarepad:n.squarepad??!1}}),ySt=n=>{const e=_St.parse(n),{d:t,pd:i,squarepad:r}=e;return{circuitJson:[r?DD(1,0,0,t,i,i):Ps(1,0,0,t,i),Zr(0,i/2+.5,.2)],parameters:e}},gSt=Re({fn:U(),num_pins:we(6).default(6),h:U().default("1.6mm"),pl:U().default("1mm"),pw:U().default("0.7mm"),p:U().default("0.95mm")}),vSt=n=>{const e=gSt.parse(n);return{circuitJson:xSt(e),parameters:e}},a8e=n=>{const{p:e,h:t,pn:i}=n;if(i===1)return{x:-t/2-.5,y:e};if(i===2)return{x:-t/2-.5,y:0};if(i===3)return{x:-t/2-.5,y:-e};if(i===4)return{x:t/2+.5,y:-e};if(i===5)return{x:t/2+.5,y:0};if(i===6)return{x:t/2+.5,y:e};throw new Error("Invalid pin number")},xSt=n=>{const e=[];for(let d=1;d<=n.num_pins;d++){const{x:h,y:f}=a8e({h:Number.parseFloat(n.h),p:Number.parseFloat(n.p),pn:d});e.push(or(d,h,f,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=n.num_pins/2*Number.parseFloat(n.p),i=Number.parseFloat(n.h),r={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-t/3,y:i/2+Number.parseFloat(n.p)/1.3},{x:t/3,y:i/2+Number.parseFloat(n.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-t/3,y:-i/2-Number.parseFloat(n.p)/1.3},{x:t/3,y:-i/2-Number.parseFloat(n.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},s=Zr(0,i+.3,.3),a=a8e({h:Number.parseFloat(n.h),p:Number.parseFloat(n.p),pn:1});a.x=a.x-Number.parseFloat(n.pw)*1.5;const c=.7,l=.3,u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:a.x+c/2,y:a.y},{x:a.x-c/2,y:a.y+l/2},{x:a.x-c/2,y:a.y-l/2},{x:a.x+c/2,y:a.y}],stroke_width:.05};return[...e,s,r,o,u]},bSt=Re({fn:U()}),wSt=n=>{const e=bSt.parse(n),t=[],i=.5-.15,r=1.5,s=.5/2,a=75,c=-37/2;for(let k=0;k<a;k++){const M=k+1;if(M>=24&&M<=31)continue;const I=c-k*s,C=M%2===0,$=r+(C?.25:0),H=.5-$/2,G=or(M,H,I,$,i);G.layer=C?"bottom":"top",t.push(G)}const l=46*.0254,u=137*.0254,d=261*.0254,h={type:"pcb_cutout",pcb_cutout_id:"",shape:"rect",center:{x:-u/2+r/2,y:c-d},width:u,height:l},f={x:-.5,y:c},m={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"};let y=1/0,g=-1/0,b=1/0,x=-1/0;const w=(k,M,I=0,C=0)=>{y=Math.min(y,k-I/2),g=Math.max(g,k+I/2),b=Math.min(b,M-C/2),x=Math.max(x,M+C/2)};for(const k of t)w(k.x,k.y,k.width,k.height);w(h.center.x,h.center.y,h.width,h.height);for(const k of m.route)w(k.x,k.y);const T=(y+g)/2,N=(b+x)/2,R=k=>{typeof k.x=="number"&&(k.x-=T),typeof k.y=="number"&&(k.y-=N),k.center&&(k.center.x-=T,k.center.y-=N),Array.isArray(k.route)&&(k.route=k.route.map(M=>({x:M.x-T,y:M.y-N})))};for(const k of t)R(k);return R(h),R(m),{circuitJson:[...t,h,m],parameters:e}};function SSt(n){return n!=null}var ESt=(n,e)=>{if(!e)return n;const t=n.filter(u=>u.type==="pcb_smtpad"||u.type==="pcb_plated_hole"||u.type==="pcb_thtpad");if(t.length===0)return n;let i=1/0,r=-1/0,o=1/0,s=-1/0;const a=(u,d,h=0,f=0)=>{const m=u-h/2,y=u+h/2,g=d-f/2,b=d+f/2;i=Math.min(i,m),r=Math.max(r,y),o=Math.min(o,g),s=Math.max(s,b)};for(const u of t)if(u.type==="pcb_smtpad"){const d=u.shape==="circle"?u.radius*2:u.width,h=u.shape==="circle"?u.radius*2:u.height;a(u.x,u.y,d,h)}else if(u.type==="pcb_plated_hole"){const d=u.outer_diameter??u.hole_diameter;a(u.x,u.y,d,d)}else if(u.type==="pcb_thtpad"){const d=u.diameter;a(u.x,u.y,d,d)}let c=0,l=0;switch(e){case"center":c=(i+r)/2,l=(o+s)/2;break;case"bottomleft":c=i,l=o;break;case"bottomcenter":case"centerbottom":c=(i+r)/2,l=o;break;case"topcenter":case"centertop":c=(i+r)/2,l=s;break;case"leftcenter":case"centerleft":c=i,l=(o+s)/2;break;case"rightcenter":case"centerright":c=r,l=(o+s)/2;break;case"pin1":const u=t.find(d=>d.port_hints?.[0]==="1")||t[0];c=u.x,l=u.y;break}if(c===0&&l===0)return n;for(const u of n){if(typeof u.x=="number"&&(u.x-=c),typeof u.y=="number"&&(u.y-=l),u.center&&typeof u.center.x=="number"&&(u.center.x-=c,u.center.y-=l),u.type==="pcb_silkscreen_path")for(const d of u.route)d.x-=c,d.y-=l;u.type==="pcb_silkscreen_text"&&u.anchor_position&&(u.anchor_position.x-=c,u.anchor_position.y-=l)}return n},TSt=n=>{let e=BD();const i=n.replace(/^((?:\d{4}|\d{5}))(?=$|_)/,"res$1").split(/_(?!metric)/).map(r=>{const o=r.match(/([a-z]+)([\(\d\.\+\?].*)?/);if(!o)return null;const[,s,a]=o;return!s||a?.includes("?")?null:{fn:s,v:a}}).filter(SSt);for(const{fn:r,v:o}of i)e=e[r](o);return e.setString(n),e},MSt=()=>Object.keys(dw),BD=()=>{const n=new Proxy({},{get:(e,t)=>{if(t==="soup"||t==="circuitJson"){if("fn"in e&&dw[e.fn])return()=>{const{circuitJson:i}=dw[e.fn](e);return ESt(i,e.origin)};if(!dw[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 "${t}"`)}}if(t==="json"){if(!dw[e.fn])throw new Error(`Invalid footprint function, got "${e.fn}"${e.string?`, from string "${e.string}"`:""}`);return()=>dw[e.fn](e).parameters}return t==="getFootprintNames"?()=>Object.keys(dw):t==="params"?()=>e:t==="setString"?i=>(e.string=i,n):i=>(Object.keys(e).length===0?`${t}${i}`in dw?(e[`${t}${i}`]=!0,e.fn=`${t}${i}`):(e[t]=!0,e.fn=t,t==="res"||t==="cap"?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(t)||(e[t]=i??!0),n)}});return n};BD.string=TSt,BD.getFootprintNames=MSt;var c8e=BD,UD={exports:{}},UK,l8e;function CSt(){if(l8e)return UK;l8e=1;var n=1e3,e=n*60,t=e*60,i=t*24,r=i*7,o=i*365.25;UK=function(u,d){d=d||{};var h=typeof u;if(h==="string"&&u.length>0)return s(u);if(h==="number"&&isFinite(u))return d.long?c(u):a(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function s(u){if(u=String(u),!(u.length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(d){var h=parseFloat(d[1]),f=(d[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return h*o;case"weeks":case"week":case"w":return h*r;case"days":case"day":case"d":return h*i;case"hours":case"hour":case"hrs":case"hr":case"h":return h*t;case"minutes":case"minute":case"mins":case"min":case"m":return h*e;case"seconds":case"second":case"secs":case"sec":case"s":return h*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}}}function a(u){var d=Math.abs(u);return d>=i?Math.round(u/i)+"d":d>=t?Math.round(u/t)+"h":d>=e?Math.round(u/e)+"m":d>=n?Math.round(u/n)+"s":u+"ms"}function c(u){var d=Math.abs(u);return d>=i?l(u,d,i,"day"):d>=t?l(u,d,t,"hour"):d>=e?l(u,d,e,"minute"):d>=n?l(u,d,n,"second"):u+" ms"}function l(u,d,h,f){var m=d>=h*1.5;return Math.round(u/h)+" "+f+(m?"s":"")}return UK}var $K,u8e;function ASt(){if(u8e)return $K;u8e=1;function n(e){i.debug=i,i.default=i,i.coerce=l,i.disable=a,i.enable=o,i.enabled=c,i.humanize=CSt(),i.destroy=u,Object.keys(e).forEach(d=>{i[d]=e[d]}),i.names=[],i.skips=[],i.formatters={};function t(d){let h=0;for(let f=0;f<d.length;f++)h=(h<<5)-h+d.charCodeAt(f),h|=0;return i.colors[Math.abs(h)%i.colors.length]}i.selectColor=t;function i(d){let h,f=null,m,y;function g(...b){if(!g.enabled)return;const x=g,w=Number(new Date),T=w-(h||w);x.diff=T,x.prev=h,x.curr=w,h=w,b[0]=i.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let N=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(k,M)=>{if(k==="%%")return"%";N++;const I=i.formatters[M];if(typeof I=="function"){const C=b[N];k=I.call(x,C),b.splice(N,1),N--}return k}),i.formatArgs.call(x,b),(x.log||i.log).apply(x,b)}return g.namespace=d,g.useColors=i.useColors(),g.color=i.selectColor(d),g.extend=r,g.destroy=i.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(m!==i.namespaces&&(m=i.namespaces,y=i.enabled(d)),y),set:b=>{f=b}}),typeof i.init=="function"&&i.init(g),g}function r(d,h){const f=i(this.namespace+(typeof h>"u"?":":h)+d);return f.log=this.log,f}function o(d){i.save(d),i.namespaces=d,i.names=[],i.skips=[];const h=(typeof d=="string"?d:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const f of h)f[0]==="-"?i.skips.push(f.slice(1)):i.names.push(f)}function s(d,h){let f=0,m=0,y=-1,g=0;for(;f<d.length;)if(m<h.length&&(h[m]===d[f]||h[m]==="*"))h[m]==="*"?(y=m,g=f,m++):(f++,m++);else if(y!==-1)m=y+1,g++,f=g;else return!1;for(;m<h.length&&h[m]==="*";)m++;return m===h.length}function a(){const d=[...i.names,...i.skips.map(h=>"-"+h)].join(",");return i.enable(""),d}function c(d){for(const h of i.skips)if(s(d,h))return!1;for(const h of i.names)if(s(d,h))return!0;return!1}function l(d){return d instanceof Error?d.stack||d.message:d}function u(){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 i.enable(i.load()),i}return $K=n,$K}var d8e;function RSt(){return d8e||(d8e=1,(function(n,e){var t={env:{},version:""};e.formatArgs=r,e.save=o,e.load=s,e.useColors=i,e.storage=a(),e.destroy=(()=>{let l=!1;return()=>{l||(l=!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`."))}})(),e.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 i(){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 l;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&&(l=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(l[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+n.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;l.splice(1,0,u,"color: inherit");let d=0,h=0;l[0].replace(/%[a-zA-Z%]/g,f=>{f!=="%%"&&(d++,f==="%c"&&(h=d))}),l.splice(h,0,u)}e.log=console.debug||console.log||(()=>{});function o(l){try{l?e.storage.setItem("debug",l):e.storage.removeItem("debug")}catch{}}function s(){let l;try{l=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch{}return!l&&typeof t<"u"&&"env"in t&&(l=t.env.DEBUG),l}function a(){try{return localStorage}catch{}}n.exports=ASt()(e);const{formatters:c}=n.exports;c.j=function(l){try{return JSON.stringify(l)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(UD,UD.exports)),UD.exports}var PSt=RSt();const dm=j9(PSt);var $D={exports:{}},jK={exports:{}},h8e;function ISt(){return h8e||(h8e=1,(function(n){var e={env:{},version:""};/**
4368
+ `))),{vertexShader:t,fragmentShader:i}}});return e.transparent=!0,e.forceSinglePass=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const NK=new JO({color:16777215,side:N1,transparent:!0}),ATe=8421504,RTe=new Ud,ID=new Jt,kK=new Jt,KA=[],s2t=new Jt,OK="+x+y";function PTe(n){return Array.isArray(n)?n[0]:n}let ITe=()=>{const n=new kp(new $5(1,1),NK);return ITe=()=>n,n},NTe=()=>{const n=new kp(new $5(1,1,32,1),NK);return NTe=()=>n,n};const a2t={type:"syncstart"},c2t={type:"synccomplete"},kTe=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],l2t=kTe.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let OTe=class extends kp{constructor(){const e=new e2t;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=ATe,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=OK,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(a2t),Y9t({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);const i=this._queuedSyncs;i&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{i.forEach(r=>r&&r())})),this.dispatchEvent(c2t),e&&e()})))}onBeforeRender(e,t,i,r,o,s){this.sync(),o.isTroikaTextMaterial&&this._prepareForRender(o)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(e){return o2t(e)}get material(){let e=this._derivedMaterial;const t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=NK.clone());if((!e||!e.isDerivedFrom(t))&&(e=this._derivedMaterial=this.createDerivedMaterial(t),t.addEventListener("dispose",function i(){t.removeEventListener("dispose",i),e.dispose()})),this.hasOutline()){let i=e._outlineMtl;return i||(i=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),i.isTextOutlineMaterial=!0,i.depthWrite=!1,i.map=null,e.addEventListener("dispose",function r(){e.removeEventListener("dispose",r),i.dispose()})),[i,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return PTe(this.material).getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return PTe(this.material).getDistanceMaterial()}set customDistanceMaterial(e){}_prepareForRender(e){const t=e.isTextOutlineMaterial,i=e.uniforms,r=this.textRenderInfo;if(r){const{sdfTexture:a,blockBounds:c}=r;i.uTroikaSDFTexture.value=a,i.uTroikaSDFTextureSize.value.set(a.image.width,a.image.height),i.uTroikaSDFGlyphSize.value=r.sdfGlyphSize,i.uTroikaSDFExponent.value=r.sdfExponent,i.uTroikaTotalBounds.value.fromArray(c),i.uTroikaUseGlyphColors.value=!t&&!!r.glyphColors;let l=0,u=0,d=0,h,f,m,y=0,g=0;if(t){let{outlineWidth:x,outlineOffsetX:w,outlineOffsetY:T,outlineBlur:N,outlineOpacity:R}=this;l=this._parsePercent(x)||0,u=Math.max(0,this._parsePercent(N)||0),h=R,y=this._parsePercent(w)||0,g=this._parsePercent(T)||0}else d=Math.max(0,this._parsePercent(this.strokeWidth)||0),d&&(m=this.strokeColor,i.uTroikaStrokeColor.value.set(m??ATe),f=this.strokeOpacity,f==null&&(f=1)),h=this.fillOpacity;i.uTroikaEdgeOffset.value=l,i.uTroikaPositionOffset.value.set(y,g),i.uTroikaBlurRadius.value=u,i.uTroikaStrokeWidth.value=d,i.uTroikaStrokeOpacity.value=f,i.uTroikaFillOpacity.value=h??1,i.uTroikaCurveRadius.value=this.curveRadius||0;let b=this.clipRect;if(b&&Array.isArray(b)&&b.length===4)i.uTroikaClipRect.value.fromArray(b);else{const x=(this.fontSize||.1)*100;i.uTroikaClipRect.value.set(c[0]-x,c[1]-x,c[2]+x,c[3]+x)}this.geometry.applyClipRect(i.uTroikaClipRect.value)}i.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const o=t?this.outlineColor||0:this.color;if(o==null)delete e.color;else{const a=e.hasOwnProperty("color")?e.color:e.color=new Ho;(o!==a._input||typeof o=="object")&&a.set(a._input=o)}let s=this.orientation||OK;if(s!==e._orientation){let a=i.uTroikaOrient.value;s=s.replace(/[^-+xyz]/g,"");let c=s!==OK&&s.match(/^([-+])([xyz])([-+])([xyz])$/);if(c){let[,l,u,d,h]=c;ID.set(0,0,0)[u]=l==="-"?1:-1,kK.set(0,0,0)[h]=d==="-"?-1:1,RTe.lookAt(s2t,ID.cross(kK),kK),a.setFromMatrix4(RTe)}else a.identity();e._orientation=s}}_parsePercent(e){if(typeof e=="string"){let t=e.match(/^(-?[\d.]+)%$/),i=t?parseFloat(t[1]):NaN;e=(isNaN(i)?0:i/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new as){t.copy(e);const i=this.curveRadius;return i&&(t.x=Math.atan2(e.x,Math.abs(i)-Math.abs(e.z))*Math.abs(i)),t}worldPositionToTextCoords(e,t=new as){return ID.copy(e),this.localPositionToTextCoords(this.worldToLocal(ID),t)}raycast(e,t){const{textRenderInfo:i,curveRadius:r}=this;if(i){const o=i.blockBounds,s=r?NTe():ITe(),a=s.geometry,{position:c,uv:l}=a.attributes;for(let u=0;u<l.count;u++){let d=o[0]+l.getX(u)*(o[2]-o[0]);const h=o[1]+l.getY(u)*(o[3]-o[1]);let f=0;r&&(f=r-Math.cos(d/r)*r,d=Math.sin(d/r)*r),c.setXYZ(u,d,h,f)}a.boundingSphere=this.geometry.boundingSphere,a.boundingBox=this.geometry.boundingBox,s.matrixWorld=this.matrixWorld,s.material.side=this.material.side,KA.length=0,s.raycast(e,KA);for(let u=0;u<KA.length;u++)KA[u].object=this,t.push(KA[u])}}copy(e){const t=this.geometry;return super.copy(e),this.geometry=t,l2t.forEach(i=>{this[i]=e[i]}),this}clone(){return new this.constructor().copy(this)}};kTe.forEach(n=>{const e="_private_"+n;Object.defineProperty(OTe.prototype,n,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})}),new zE,new Ho;const DTe={type:"change"},DK={type:"start"},LTe={type:"end"},ND=new BA,zTe=new qS,u2t=Math.cos(70*HO.DEG2RAD);let d2t=class extends DE{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new Jt,this.cursor=new Jt,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:u6.ROTATE,MIDDLE:u6.DOLLY,RIGHT:u6.PAN},this.touches={ONE:d6.ROTATE,TWO:d6.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(de){de.addEventListener("keydown",Ut),this._domElementKeyEvents=de},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",Ut),this._domElementKeyEvents=null},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(DTe),i.update(),o=r.NONE},this.update=(function(){const de=new Jt,He=new FS().setFromUnitVectors(e.up,new Jt(0,1,0)),ot=He.clone().invert(),pt=new Jt,At=new FS,zt=new Jt,rn=2*Math.PI;return function(Nn=null){const qn=i.object.position;de.copy(qn).sub(i.target),de.applyQuaternion(He),a.setFromVector3(de),i.autoRotate&&o===r.NONE&&P(C(Nn)),i.enableDamping?(a.theta+=c.theta*i.dampingFactor,a.phi+=c.phi*i.dampingFactor):(a.theta+=c.theta,a.phi+=c.phi);let Oi=i.minAzimuthAngle,br=i.maxAzimuthAngle;isFinite(Oi)&&isFinite(br)&&(Oi<-Math.PI?Oi+=rn:Oi>Math.PI&&(Oi-=rn),br<-Math.PI?br+=rn:br>Math.PI&&(br-=rn),Oi<=br?a.theta=Math.max(Oi,Math.min(br,a.theta)):a.theta=a.theta>(Oi+br)/2?Math.max(Oi,a.theta):Math.min(br,a.theta)),a.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,a.phi)),a.makeSafe(),i.enableDamping===!0?i.target.addScaledVector(u,i.dampingFactor):i.target.add(u),i.target.sub(i.cursor),i.target.clampLength(i.minTargetRadius,i.maxTargetRadius),i.target.add(i.cursor);let wr=!1;if(i.zoomToCursor&&R||i.object.isOrthographicCamera)a.radius=me(a.radius);else{const ki=a.radius;a.radius=me(a.radius*l),wr=ki!=a.radius}if(de.setFromSpherical(a),de.applyQuaternion(ot),qn.copy(i.target).add(de),i.object.lookAt(i.target),i.enableDamping===!0?(c.theta*=1-i.dampingFactor,c.phi*=1-i.dampingFactor,u.multiplyScalar(1-i.dampingFactor)):(c.set(0,0,0),u.set(0,0,0)),i.zoomToCursor&&R){let ki=null;if(i.object.isPerspectiveCamera){const oi=de.length();ki=me(oi*l);const xt=oi-ki;i.object.position.addScaledVector(T,xt),i.object.updateMatrixWorld(),wr=!!xt}else if(i.object.isOrthographicCamera){const oi=new Jt(N.x,N.y,0);oi.unproject(i.object);const xt=i.object.zoom;i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/l)),i.object.updateProjectionMatrix(),wr=xt!==i.object.zoom;const ln=new Jt(N.x,N.y,0);ln.unproject(i.object),i.object.position.sub(ln).add(oi),i.object.updateMatrixWorld(),ki=de.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;ki!==null&&(this.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(ki).add(i.object.position):(ND.origin.copy(i.object.position),ND.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(ND.direction))<u2t?e.lookAt(i.target):(zTe.setFromNormalAndCoplanarPoint(i.object.up,i.target),ND.intersectPlane(zTe,i.target))))}else if(i.object.isOrthographicCamera){const ki=i.object.zoom;i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/l)),ki!==i.object.zoom&&(i.object.updateProjectionMatrix(),wr=!0)}return l=1,R=!1,wr||pt.distanceToSquared(i.object.position)>s||8*(1-At.dot(i.object.quaternion))>s||zt.distanceToSquared(i.target)>s?(i.dispatchEvent(DTe),pt.copy(i.object.position),At.copy(i.object.quaternion),zt.copy(i.target),!0):!1}})(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",an),i.domElement.removeEventListener("pointerdown",Xe),i.domElement.removeEventListener("pointercancel",Me),i.domElement.removeEventListener("wheel",_t),i.domElement.removeEventListener("pointermove",Be),i.domElement.removeEventListener("pointerup",Me),i.domElement.getRootNode().removeEventListener("keydown",Ft,{capture:!0}),i._domElementKeyEvents!==null&&(i._domElementKeyEvents.removeEventListener("keydown",Ut),i._domElementKeyEvents=null)};const i=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let o=r.NONE;const s=1e-6,a=new ZEe,c=new ZEe;let l=1;const u=new Jt,d=new as,h=new as,f=new as,m=new as,y=new as,g=new as,b=new as,x=new as,w=new as,T=new Jt,N=new as;let R=!1;const k=[],M={};let I=!1;function C(de){return de!==null?2*Math.PI/60*i.autoRotateSpeed*de:2*Math.PI/60/60*i.autoRotateSpeed}function $(de){const He=Math.abs(de*.01);return Math.pow(.95,i.zoomSpeed*He)}function P(de){c.theta-=de}function H(de){c.phi-=de}const G=(function(){const de=new Jt;return function(ot,pt){de.setFromMatrixColumn(pt,0),de.multiplyScalar(-ot),u.add(de)}})(),X=(function(){const de=new Jt;return function(ot,pt){i.screenSpacePanning===!0?de.setFromMatrixColumn(pt,1):(de.setFromMatrixColumn(pt,0),de.crossVectors(i.object.up,de)),de.multiplyScalar(ot),u.add(de)}})(),W=(function(){const de=new Jt;return function(ot,pt){const At=i.domElement;if(i.object.isPerspectiveCamera){const zt=i.object.position;de.copy(zt).sub(i.target);let rn=de.length();rn*=Math.tan(i.object.fov/2*Math.PI/180),G(2*ot*rn/At.clientHeight,i.object.matrix),X(2*pt*rn/At.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(G(ot*(i.object.right-i.object.left)/i.object.zoom/At.clientWidth,i.object.matrix),X(pt*(i.object.top-i.object.bottom)/i.object.zoom/At.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}})();function K(de){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?l/=de:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function ie(de){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?l*=de:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function ce(de,He){if(!i.zoomToCursor)return;R=!0;const ot=i.domElement.getBoundingClientRect(),pt=de-ot.left,At=He-ot.top,zt=ot.width,rn=ot.height;N.x=pt/zt*2-1,N.y=-(At/rn)*2+1,T.set(N.x,N.y,1).unproject(i.object).sub(i.object.position).normalize()}function me(de){return Math.max(i.minDistance,Math.min(i.maxDistance,de))}function ne(de){d.set(de.clientX,de.clientY)}function ae(de){ce(de.clientX,de.clientX),b.set(de.clientX,de.clientY)}function pe(de){m.set(de.clientX,de.clientY)}function be(de){h.set(de.clientX,de.clientY),f.subVectors(h,d).multiplyScalar(i.rotateSpeed);const He=i.domElement;P(2*Math.PI*f.x/He.clientHeight),H(2*Math.PI*f.y/He.clientHeight),d.copy(h),i.update()}function Te(de){x.set(de.clientX,de.clientY),w.subVectors(x,b),w.y>0?K($(w.y)):w.y<0&&ie($(w.y)),b.copy(x),i.update()}function De(de){y.set(de.clientX,de.clientY),g.subVectors(y,m).multiplyScalar(i.panSpeed),W(g.x,g.y),m.copy(y),i.update()}function Ue(de){ce(de.clientX,de.clientY),de.deltaY<0?ie($(de.deltaY)):de.deltaY>0&&K($(de.deltaY)),i.update()}function Ce(de){let He=!1;switch(de.code){case i.keys.UP:de.ctrlKey||de.metaKey||de.shiftKey?H(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):W(0,i.keyPanSpeed),He=!0;break;case i.keys.BOTTOM:de.ctrlKey||de.metaKey||de.shiftKey?H(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):W(0,-i.keyPanSpeed),He=!0;break;case i.keys.LEFT:de.ctrlKey||de.metaKey||de.shiftKey?P(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):W(i.keyPanSpeed,0),He=!0;break;case i.keys.RIGHT:de.ctrlKey||de.metaKey||de.shiftKey?P(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):W(-i.keyPanSpeed,0),He=!0;break}He&&(de.preventDefault(),i.update())}function oe(de){if(k.length===1)d.set(de.pageX,de.pageY);else{const He=Un(de),ot=.5*(de.pageX+He.x),pt=.5*(de.pageY+He.y);d.set(ot,pt)}}function ge(de){if(k.length===1)m.set(de.pageX,de.pageY);else{const He=Un(de),ot=.5*(de.pageX+He.x),pt=.5*(de.pageY+He.y);m.set(ot,pt)}}function ye(de){const He=Un(de),ot=de.pageX-He.x,pt=de.pageY-He.y,At=Math.sqrt(ot*ot+pt*pt);b.set(0,At)}function $e(de){i.enableZoom&&ye(de),i.enablePan&&ge(de)}function Ve(de){i.enableZoom&&ye(de),i.enableRotate&&oe(de)}function Ze(de){if(k.length==1)h.set(de.pageX,de.pageY);else{const ot=Un(de),pt=.5*(de.pageX+ot.x),At=.5*(de.pageY+ot.y);h.set(pt,At)}f.subVectors(h,d).multiplyScalar(i.rotateSpeed);const He=i.domElement;P(2*Math.PI*f.x/He.clientHeight),H(2*Math.PI*f.y/He.clientHeight),d.copy(h)}function ve(de){if(k.length===1)y.set(de.pageX,de.pageY);else{const He=Un(de),ot=.5*(de.pageX+He.x),pt=.5*(de.pageY+He.y);y.set(ot,pt)}g.subVectors(y,m).multiplyScalar(i.panSpeed),W(g.x,g.y),m.copy(y)}function nt(de){const He=Un(de),ot=de.pageX-He.x,pt=de.pageY-He.y,At=Math.sqrt(ot*ot+pt*pt);x.set(0,At),w.set(0,Math.pow(x.y/b.y,i.zoomSpeed)),K(w.y),b.copy(x);const zt=(de.pageX+He.x)*.5,rn=(de.pageY+He.y)*.5;ce(zt,rn)}function je(de){i.enableZoom&&nt(de),i.enablePan&&ve(de)}function Le(de){i.enableZoom&&nt(de),i.enableRotate&&Ze(de)}function Xe(de){i.enabled!==!1&&(k.length===0&&(i.domElement.setPointerCapture(de.pointerId),i.domElement.addEventListener("pointermove",Be),i.domElement.addEventListener("pointerup",Me)),!tn(de)&&(Cn(de),de.pointerType==="touch"?Kt(de):at(de)))}function Be(de){i.enabled!==!1&&(de.pointerType==="touch"?Tt(de):We(de))}function Me(de){switch(An(de),k.length){case 0:i.domElement.releasePointerCapture(de.pointerId),i.domElement.removeEventListener("pointermove",Be),i.domElement.removeEventListener("pointerup",Me),i.dispatchEvent(LTe),o=r.NONE;break;case 1:const He=k[0],ot=M[He];Kt({pointerId:He,pageX:ot.x,pageY:ot.y});break}}function at(de){let He;switch(de.button){case 0:He=i.mouseButtons.LEFT;break;case 1:He=i.mouseButtons.MIDDLE;break;case 2:He=i.mouseButtons.RIGHT;break;default:He=-1}switch(He){case u6.DOLLY:if(i.enableZoom===!1)return;ae(de),o=r.DOLLY;break;case u6.ROTATE:if(de.ctrlKey||de.metaKey||de.shiftKey){if(i.enablePan===!1)return;pe(de),o=r.PAN}else{if(i.enableRotate===!1)return;ne(de),o=r.ROTATE}break;case u6.PAN:if(de.ctrlKey||de.metaKey||de.shiftKey){if(i.enableRotate===!1)return;ne(de),o=r.ROTATE}else{if(i.enablePan===!1)return;pe(de),o=r.PAN}break;default:o=r.NONE}o!==r.NONE&&i.dispatchEvent(DK)}function We(de){switch(o){case r.ROTATE:if(i.enableRotate===!1)return;be(de);break;case r.DOLLY:if(i.enableZoom===!1)return;Te(de);break;case r.PAN:if(i.enablePan===!1)return;De(de);break}}function _t(de){i.enabled===!1||i.enableZoom===!1||o!==r.NONE||(de.preventDefault(),i.dispatchEvent(DK),Ue(Et(de)),i.dispatchEvent(LTe))}function Et(de){const He=de.deltaMode,ot={clientX:de.clientX,clientY:de.clientY,deltaY:de.deltaY};switch(He){case 1:ot.deltaY*=16;break;case 2:ot.deltaY*=100;break}return de.ctrlKey&&!I&&(ot.deltaY*=10),ot}function Ft(de){de.key==="Control"&&(I=!0,i.domElement.getRootNode().addEventListener("keyup",Dt,{passive:!0,capture:!0}))}function Dt(de){de.key==="Control"&&(I=!1,i.domElement.getRootNode().removeEventListener("keyup",Dt,{passive:!0,capture:!0}))}function Ut(de){i.enabled===!1||i.enablePan===!1||Ce(de)}function Kt(de){switch(cn(de),k.length){case 1:switch(i.touches.ONE){case d6.ROTATE:if(i.enableRotate===!1)return;oe(de),o=r.TOUCH_ROTATE;break;case d6.PAN:if(i.enablePan===!1)return;ge(de),o=r.TOUCH_PAN;break;default:o=r.NONE}break;case 2:switch(i.touches.TWO){case d6.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;$e(de),o=r.TOUCH_DOLLY_PAN;break;case d6.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Ve(de),o=r.TOUCH_DOLLY_ROTATE;break;default:o=r.NONE}break;default:o=r.NONE}o!==r.NONE&&i.dispatchEvent(DK)}function Tt(de){switch(cn(de),o){case r.TOUCH_ROTATE:if(i.enableRotate===!1)return;Ze(de),i.update();break;case r.TOUCH_PAN:if(i.enablePan===!1)return;ve(de),i.update();break;case r.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;je(de),i.update();break;case r.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Le(de),i.update();break;default:o=r.NONE}}function an(de){i.enabled!==!1&&de.preventDefault()}function Cn(de){k.push(de.pointerId)}function An(de){delete M[de.pointerId];for(let He=0;He<k.length;He++)if(k[He]==de.pointerId){k.splice(He,1);return}}function tn(de){for(let He=0;He<k.length;He++)if(k[He]==de.pointerId)return!0;return!1}function cn(de){let He=M[de.pointerId];He===void 0&&(He=new as,M[de.pointerId]=He),He.set(de.pageX,de.pageY)}function Un(de){const He=de.pointerId===k[0]?k[1]:k[0];return M[He]}i.domElement.addEventListener("contextmenu",an),i.domElement.addEventListener("pointerdown",Xe),i.domElement.addEventListener("pointercancel",Me),i.domElement.addEventListener("wheel",_t,{passive:!1}),i.domElement.getRootNode().addEventListener("keydown",Ft,{passive:!0,capture:!0}),this.update()}};var FTe={in:25.4,inch:25.4,mil:.0254,mm:1,m:1e3,cm:10,ft:304.8,feet:304.8},Yu=n=>{let e=typeof n=="number"?"mm":n.replace(/^[^a-zA-Z]+/g,"").toLowerCase();e||(e="mm");const t=typeof n=="number"?n:Number.parseFloat(n.split(e)[0]);if(e in FTe)return t*FTe[e];throw new Error(`Unsupported unit: ${e}`)},QA=Yu,h2t=Object.defineProperty,p2t=(n,e)=>{for(var t in e)h2t(n,t,{get:e[t],enumerable:!0})},dw={};p2t(dw,{axial:()=>p5t,bga:()=>T2t,breakoutheaders:()=>S5t,cap:()=>x2t,dfn:()=>X2t,diode:()=>v2t,dip:()=>_2t,electrolytic:()=>oSt,hc49:()=>T5t,jst:()=>Rwt,led:()=>b2t,lqfp:()=>b5t,m2host:()=>wSt,melf:()=>F3t,micromelf:()=>j3t,minimelf:()=>P3t,mlp:()=>k2t,ms012:()=>t5t,ms013:()=>i5t,msop:()=>Bwt,pad:()=>M5t,pinrow:()=>K2t,platedhole:()=>ySt,potentiometer:()=>nSt,pushbutton:()=>m5t,qfn:()=>I2t,qfp:()=>N2t,quad:()=>JA,res:()=>w2t,sma:()=>G3t,smb:()=>ewt,smbf:()=>aSt,smc:()=>rwt,smf:()=>Z3t,smtpad:()=>mSt,sod110:()=>Iwt,sod123:()=>l5t,sod123f:()=>c3t,sod123fl:()=>h3t,sod123w:()=>j5t,sod128:()=>x3t,sod323:()=>G5t,sod323f:()=>r3t,sod323fl:()=>qwt,sod323w:()=>$wt,sod523:()=>N5t,sod723:()=>_3t,sod80:()=>F5t,sod882:()=>e3t,sod882d:()=>O3t,sod923:()=>Z5t,soic:()=>C2t,solderjumper:()=>Zwt,son:()=>Wwt,sop8:()=>L5t,sot:()=>vSt,sot223:()=>cwt,sot23:()=>$2t,sot23w:()=>ywt,sot25:()=>q2t,sot323:()=>dSt,sot363:()=>B2t,sot457:()=>Jwt,sot563:()=>J2t,sot723:()=>o5t,sot89:()=>M3t,ssop:()=>D2t,stampboard:()=>y5t,stampreceiver:()=>x5t,to220:()=>A3t,to92:()=>P5t,to92s:()=>Swt,tssop:()=>z2t,vssop:()=>Lwt});var Zr=(n,e,t)=>({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:"silkscreen_text_1",font:"tscircuit2024",font_size:t,pcb_component_id:"pcb_component_1",text:"{REF}",layer:"top",anchor_position:{x:n,y:e},anchor_alignment:"center"}),Ps=(n,e,t,i,r)=>({pcb_plated_hole_id:"",type:"pcb_plated_hole",shape:"circle",x:e,y:t,hole_diameter:Yu(i),outer_diameter:Yu(r),pcb_port_id:"",layers:["top","bottom"],port_hints:[n.toString()]}),BTe=Array.from({length:9},(n,e)=>Math.cos(e/8*Math.PI-Math.PI)).map(n=>({x:n,y:-Math.sqrt(1-n**2)}));function YS(n){return typeof n=="string"?n.trim().toLowerCase().endsWith("mil")?parseFloat(n)*.0254:parseFloat(n):Number(n)}var kD=Gn([U(),Fe()]).transform(n=>YS(n)),f2t=n=>Re({fn:U(),num_pins:Fe().optional().default(6),wide:vt().optional(),narrow:vt().optional(),w:kD.optional(),p:kD.default(n.p??"2.54mm"),id:kD.optional(),od:kD.optional()}).transform(e=>(!e.id&&!e.od?Math.abs(e.p-1.27)<.01?(e.id=YS("0.55mm"),e.od=YS("0.95mm")):(e.id=YS("1.0mm"),e.od=YS("1.5mm")):e.id?e.od||(e.od=e.id*(1.5/1)):e.id=e.od*(1/1.5),e.w||(e.wide?e.w=YS("600mil"):e.narrow?e.w=YS("300mil"):e.w=YS(n.w??"300mil")),e)),m2t=f2t({}),UTe=(n,e,t,i)=>{const r=n/2,o=e<=r,s=r-1,a=i,c=a*s;return o?{x:-t/2,y:c/2-(e-1)*a}:{x:t/2,y:-c/2+(e-r-1)*a}},_2t=n=>{const e=m2t.parse(n),t=[];for(let l=0;l<e.num_pins;l++){const{x:u,y:d}=UTe(e.num_pins,l+1,e.w,e.p??2.54);t.push(Ps(l+1,u,d,e.id??"0.8mm",e.od??"1mm"))}(e.num_pins/2-1)*e.p+e.od;const r=e.w-e.od-1,o=(e.num_pins/2-1)*e.p+e.od+.4,s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-r/2,y:-o/2},{x:-r/2,y:o/2},...BTe.map(({x:l,y:u})=>({x:l*r/6,y:u*r/6+o/2})),{x:r/2,y:o/2},{x:r/2,y:-o/2},{x:-r/2,y:-o/2}],type:"pcb_silkscreen_path",stroke_width:.1},a=[];for(let l=0;l<e.num_pins;l++){const u=l<e.num_pins/2,d=.6,{y:h}=UTe(e.num_pins,l+1,e.w,e.p??2.54),f=u?-e.w/2-e.od/2-d:e.w/2+e.od/2+d,m=h;a.push({type:"pcb_fabrication_note_text",pcb_fabrication_note_text_id:`pin_${l+1}`,layer:"top",pcb_component_id:`pin_${l+1}`,text:`{pin${l+1}}`,anchor_position:{x:f,y:m},font_size:.3,font:"tscircuit2024",anchor_alignment:"top_left"})}const c=Zr(0,o/2+.5,.4);return{circuitJson:[...t,s,c,...a],parameters:e}},or=(n,e,t,i,r)=>({type:"pcb_smtpad",x:e,y:t,width:i,height:r,layer:"top",shape:"rect",pcb_smtpad_id:"",port_hints:Array.isArray(n)?n.map(o=>o.toString()):[n.toString()]}),$Te=[{imperial:"01005",metric:"0402",p_mm_min:.5,pw_mm_min:.4,ph_mm_min:.3,w_mm_min:.58,h_mm_min:.21},{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},{imperial:"0201",metric:"0603",p_mm_min:.66,pw_mm_min:.46,ph_mm_min:.4,w_mm_min:.9,h_mm_min:.3},{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},{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},{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},{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},{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},{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},{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}],y2t=Object.fromEntries($Te.map(n=>[n.metric,n])),g2t=Object.fromEntries($Te.map(n=>[n.imperial,n]));Re({tht:vt(),p:et.optional(),pw:et.optional(),ph:et.optional(),metric:Ot.optional(),imperial:Ot.optional(),w:et.optional(),h:et.optional(),textbottom:vt().optional()});var OD=n=>{let{tht:e,p:t,pw:i,ph:r,metric:o,imperial:s,w:a,h:c,textbottom:l}=n;if(typeof a=="string"&&(a=QA(a)),typeof c=="string"&&(c=QA(c)),typeof t=="string"&&(t=QA(t)),typeof i=="string"&&(i=QA(i)),typeof r=="string"&&(r=QA(r)),c!==void 0&&a!==void 0&&c>a)throw new Error("height cannot be greater than width (rotated footprint not yet implemented)");let u;if(o&&(u=y2t[o]),s&&(u=g2t[s]),u&&(a=u.w_mm_min,c=u.h_mm_min,t=u.p_mm_min,i=u.pw_mm_min,r=u.ph_mm_min),t===void 0||i===void 0||r===void 0)throw new Error("Could not determine required pad dimensions (p, pw, ph)");const d={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:t/2,y:r/2+.4},{x:-t/2-i/2-.2,y:r/2+.4},{x:-t/2-i/2-.2,y:-r/2-.4},{x:t/2,y:-r/2-.4}],stroke_width:.1,pcb_silkscreen_path_id:""},h=l?-r/2-.9:r/2+.9,f=Zr(0,h,.2);return e?[Ps(1,-t/2,0,i,i*1/.8),Ps(2,t/2,0,i,i*1/.8),d,f]:[or(["1","left"],-t/2,0,i,r),or(["2","right"],t/2,0,i,r),d,f]},v2t=n=>({circuitJson:OD(n),parameters:n}),x2t=n=>({circuitJson:OD(n),parameters:n}),b2t=n=>({circuitJson:OD(n),parameters:n}),w2t=n=>({circuitJson:OD(n),parameters:n}),jTe=(n,{x:e,y:t,radius:i})=>({type:"pcb_smtpad",x:e,y:t,radius:i,layer:"top",shape:"circle",pcb_smtpad_id:"",port_hints:Array.isArray(n)?n.map(r=>r.toString()):[n.toString()]}),HTe="ABCDEFGHIJKLMNOPQRSTUVWXYZ",VTe=U().transform(n=>{const[e,t]=n.split(/[x ]/);return{x:parseFloat(e),y:parseFloat(t)}}).pipe(Re({x:Fe(),y:Fe()})),S2t=U().or(mt(Gu())).transform(n=>Array.isArray(n)?n:(n.startsWith("(")&&n.endsWith(")")&&(n=n.slice(1,-1)),n.split(",").map(e=>{const t=Number(e);return isNaN(t)?e:t}))).pipe(mt(U().or(Fe()))),E2t=Re({fn:U(),num_pins:Fe().optional().default(64),grid:VTe.optional(),p:Ot.default("0.8mm"),w:et.optional(),h:et.optional(),ball:et.optional().describe("ball diameter"),pad:et.optional().describe("pad width/height"),circularpads:vt().optional().describe("use circular pads"),tlorigin:vt().optional(),blorigin:vt().optional(),trorigin:vt().optional(),brorigin:vt().optional(),missing:S2t.default([])}).transform(n=>{let e="tl";if(n.blorigin&&(e="bl"),n.trorigin&&(e="tr"),n.brorigin&&(e="br"),!n.grid){const i=Math.ceil(Math.sqrt(n.num_pins));n.grid={x:i,y:i}}return n.missing&&(n.missing=n.missing.map(i=>{if(typeof i=="number")return i;if(i==="center")return"center";if(i==="topleft")return"topleft";const r=i.match(/([A-Z]+)(\d+)/);if(!r)return i;const o=HTe.indexOf(r[1]),s=Number.parseInt(r[2])-1;return o*n.grid.x+s+1})),{...n,origin:e}}),T2t=n=>{const e=E2t.parse(n);let{num_pins:t,grid:i,p:r,w:o,h:s,ball:a,pad:c,missing:l}=e;a??=.75/1.27*r,c??=a*.8;const u=[],d=(l??[]).filter(N=>typeof N=="number"),h=i.x*i.y-t;if(l.length===0&&h>0&&(Math.sqrt(h)%1===0?l.push("center"):h===1&&l.push("topleft")),l?.includes("center")){const N=Math.floor(Math.sqrt(h)),R=Math.floor((i.x-N)/2),k=Math.floor((i.y-N)/2);for(let M=k;M<k+N;M++)for(let I=R;I<R+N;I++)d.push(M*i.x+I+1)}l?.includes("topleft")&&d.push(1);const f=new Set(d);let m=0;for(let N=0;N<i.y;N++)for(let R=0;R<i.x;R++){const k=(R-(i.x-1)/2)*r,M=(N-(i.y-1)/2)*r;let I=R,C=N;switch(e.origin){case"bl":I=R,C=i.y-1-N;break;case"br":I=i.x-1-R,C=i.y-1-N;break;case"tr":I=i.x-1-R,C=N;break}let $=C*i.x+I+1;if(f.has($)){m++;continue}$-=m;const P=[$,`${HTe[C]}${I+1}`];u.push(e.circularpads?jTe(P,{x:k,y:M,radius:c/2}):or(P,k,M,c,c))}const y=Zr(0,i.y*r/2,.2),g=r/6;let b;const x=i.x*r/2,w=i.y*r/2;switch(e.origin){case"bl":b=[{x:-x,y:-w},{x:-x,y:-w-g},{x:-x-g,y:-w},{x:-x,y:-w}];break;case"br":b=[{x,y:-w},{x,y:-w-g},{x:x+g,y:-w},{x,y:-w}];break;case"tr":b=[{x,y:w},{x,y:w+g},{x:x+g,y:w},{x,y:w}];break;case"tl":default:b=[{x:-x,y:w},{x:-x,y:w+g},{x:-x-g,y:w},{x:-x,y:w}];break}const T={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_marker",route:b,stroke_width:.05};return{circuitJson:[...u,y,T],parameters:e}},$2=n=>Re({fn:U(),num_pins:Fe().optional().default(8),w:et.default(et.parse(n.w??"5.3mm")),p:et.default(et.parse(n.p??"1.27mm")),pw:et.default(et.parse(n.pw??"0.6mm")),pl:et.default(et.parse(n.pl??"1.0mm")),legsoutside:vt().optional().default(n.legsoutside??!1)}).transform(e=>(!e.pw&&!e.pl?(e.pw=et.parse("0.6mm"),e.pl=et.parse("1.0mm")):e.pw?e.pl||(e.pl=e.pw*(1/.6)):e.pw=e.pl*(.6/1),e)),M2t=$2({}),LK=n=>{n.widthincludeslegs!==void 0&&(n.legsoutside=!n.widthincludeslegs);const{num_pins:e,pn:t,w:i,p:r,pl:o,legsoutside:s}=n,a=e/2,c=t<=a,l=a-1,u=r,d=u*l,h=s?o/2:-o/2;return c?{x:-i/2-h,y:d/2-(t-1)*u}:{x:i/2+h,y:-d/2+(t-a-1)*u}},C2t=n=>{const e=M2t.parse(n);return{circuitJson:hw(e),parameters:e}},hw=n=>{const e=[];for(let a=0;a<n.num_pins;a++){const{x:c,y:l}=LK({num_pins:n.num_pins,pn:a+1,w:n.w,p:n.p,pl:n.pl,legsoutside:n.legsoutside});e.push(or(a+1,c,l,n.pl,n.pw))}const t=Math.min(1,n.p/2),i=n.w-(n.legsoutside?0:n.pl*2)-.2,r=(n.num_pins/2-1)*n.p+n.pw+t,o=Zr(0,r/2+.4,r/12),s={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",stroke_width:.1,route:[{x:-i/2,y:-r/2},{x:-i/2,y:r/2},...BTe.map(({x:a,y:c})=>({x:a*i/6,y:c*i/6+r/2})),{x:i/2,y:r/2},{x:i/2,y:-r/2},{x:-i/2,y:-r/2}]};return[...e,s,o]},qTe=Gt(["leftside","topside","rightside","bottomside","toppin","bottompin","leftpin","rightpin"]),A2t=({num_pins:n,cw:e,ccw:t,startingpin:i})=>{const r=[],o=n/4;let s=1;const a={};for(const c of i??[])a[c]=!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=o:a.bottomside&&a.leftpin?s=o+1:a.bottomside&&a.rightpin?s=o*2:a.rightside&&a.bottompin?s=o*2+1:a.rightside&&a.toppin?s=o*3:a.topside&&a.rightpin?s=o*3+1:a.topside&&a.leftpin&&(s=o*4),r.push(-1);for(let c=0;c<n;c++)r[s]=c+1,t||!e?(s++,s>n&&(s=1)):(s--,s<1&&(s=n));return r},zK=Re({fn:U(),cc:vt().default(!0).optional(),ccw:vt().default(!0).optional(),startingpin:U().or(mt(qTe)).transform(n=>typeof n=="string"?n.slice(1,-1).split(","):n).pipe(mt(qTe)).optional(),num_pins:Fe().optional().default(64),w:et.optional(),h:et.optional(),p:et.default(et.parse("0.5mm")),pw:et.optional(),pl:et.optional(),thermalpad:Gn([we(!0),VTe]).optional(),legsoutside:vt().default(!1)}),FK=n=>{n.w&&!n.h?n.h=n.w:!n.w&&n.h&&(n.w=n.h);const e=n.num_pins/4;if(!n.p&&!n.pw&&!n.pl&&n.w){const t=e+4;n.p=n.w/t}return!n.p&&n.w&&n.h&&n.pw&&n.pl&&(n.p=(n.w-n.pl*2)/(e-1)),!n.w&&!n.h&&n.p&&(n.w=n.p*(e+4),n.h=n.w),n.p&&!n.pw&&!n.pl?(n.pw=n.p/2,n.pl=n.p/2):n.pw?n.pl||(n.pl=n.pw*(1/.6)):n.pw=n.pl*(.6/1),n},GTe=zK.transform(FK),R2t=["left","bottom","right","top"],P2t=n=>{const{pin_count:e,pn:t,w:i,h:r,p:o,pl:s,legsoutside:a}=n,c=e/4,l=R2t[Math.floor((t-1)/c)],u=(t-1)%c,d=o*(c-1),h=o*(c-1),f=a?s/2:-s/2;switch(l){case"left":return{x:-i/2-f,y:h/2-u*o,o:"vert"};case"bottom":return{x:-d/2+u*o,y:-r/2-f,o:"horz"};case"right":return{x:i/2+f,y:-h/2+u*o,o:"vert"};case"top":return{x:d/2-u*o,y:r/2+f,o:"horz"};default:throw new Error("Invalid pin number")}},JA=n=>{const e=GTe.parse(n),t=[],i=A2t(e),r=e.num_pins/4;for(let a=0;a<e.num_pins;a++){const{x:c,y:l,o:u}=P2t({pin_count:e.num_pins,pn:a+1,w:e.w,h:e.h,p:e.p??.5,pl:e.pl,legsoutside:e.legsoutside});let d=e.pw,h=e.pl;u==="vert"&&([d,h]=[h,d]);const f=i[a+1];t.push(or(f,c,l,d,h))}if(e.thermalpad)if(typeof e.thermalpad=="boolean"){const a=e.p*(r-1)+e.pw,c=e.p*(r-1)+e.pw;t.push(or(["thermalpad"],0,0,a,c))}else t.push(or(["thermalpad"],0,0,e.thermalpad.x,e.thermalpad.y));const o=[];for(const[a,c,l]of[["top-left",-1,1],["bottom-left",-1,-1],["bottom-right",1,-1],["top-right",1,1]]){const u=e.w/2*c,d=e.h/2*l;let h="none",f=u,m=d;const y=e.pw*2;i[1]===1&&a==="top-left"?h="in1":i[r*4]===1&&a==="top-left"||i[r*3+1]===1&&a==="top-right"?h="in2":i[r*3]===1&&a==="top-right"||i[r]===1&&a==="bottom-left"?h="in1":i[r+1]===1&&a==="bottom-left"?h="in2":i[r*2]===1&&a==="bottom-right"?h="in1":i[r*2+1]===1&&a==="bottom-right"&&(h="in2");const g=h==="in1"?1:-1;if(e.legsoutside){const b=h==="in1"?e.pl/2:e.pw/2,x=h==="in1"?e.pw/2:e.pl/2;f+=b*c*g,m-=x*l*g}(h==="none"||e.legsoutside)&&o.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${a}`,route:[{x:u-y*c,y:d},{x:u,y:d},{x:u,y:d-y*l}],type:"pcb_silkscreen_path",stroke_width:.1}),(h==="in1"||h==="in2")&&!e.legsoutside&&o.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${a}_1`,route:[{x:u-y*c,y:d},{x:u-y*c/2,y:d}],type:"pcb_silkscreen_path",stroke_width:0},{layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${a}_2`,route:[{x:u,y:d-y*l/2},{x:u,y:d-y*l}],type:"pcb_silkscreen_path",stroke_width:.1}),(h==="in1"||h==="in2")&&o.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${a}_3`,route:[{x:f-.2*-c,y:m+.2*g},{x:f,y:m},{x:f+.2*g*-c,y:m+.2},{x:f-.2*-c,y:m+.2*g}],type:"pcb_silkscreen_path",stroke_width:.1})}const s=Zr(0,e.h/2+(e.legsoutside?e.pl*1.2:.5),.3);return{circuitJson:[...t,...o,s],parameters:e}};zK.extend({}).transform(FK);var I2t=n=>(n.legsoutside=!1,JA(n)),N2t=n=>{n.legsoutside=!0;const e=GTe.parse(n);if(!n.p)switch(n.num_pins){case 44:case 64:n.p=.8;break;case 52:n.w===14?n.p=1:n.p=.65;break;case 208:n.p=.5;break}if(!n.pl)switch(n.num_pins){case 44:case 52:case 64:n.pl=2.25;break;case 208:n.pl=1.65;break;default:n.pl=e.pl*4;break}if(!n.pw)switch(n.num_pins){case 44:case 64:n.pw=.5;break;case 52:n.w===14?n.pw=.45:n.pw=.55;break;case 208:n.pw=.3;break;default:n.pw=e.pw;break}return JA(n)};zK.extend({}).transform(FK);var k2t=n=>(n.legsoutside=!1,n.thermalpad===void 0&&(n.thermalpad=!0),JA(n)),O2t=$2({w:"3.9mm",p:"1.27mm"}),D2t=n=>{const e=O2t.parse(n);return{circuitJson:hw(e),parameters:e}},L2t=$2({w:"7.1mm",p:"0.65mm",pl:"1.35mm",pw:"0.40mm",legsoutside:!0}),z2t=n=>{const e=L2t.parse(n);return{circuitJson:hw(e),parameters:e}},F2t=$2({}),B2t=n=>{const e=F2t.parse({fn:"sot363",num_pins:6,w:1.94,p:.65,pw:.3,pl:.7,legoutside:!0});return{circuitJson:hw(e),parameters:e}},YTe=Re({fn:U(),num_pins:Fe().default(3),w:U().default("1.92mm"),h:U().default("2.74mm"),pl:U().default("0.8mm"),pw:U().default("0.764mm"),p:U().default("0.95mm"),string:U().optional()}),U2t=$2({p:"0.95mm",w:"1.6mm",legsoutside:!0}),$2t=n=>{const e=n.string?.match(/^sot23_(\d+)/),t=e?Number.parseInt(e[1],10):3;if(t===6||t===8){const r=U2t.parse({...n,num_pins:t});return{circuitJson:hw(r),parameters:r}}const i=YTe.parse({...n,num_pins:t});if(i.num_pins===3)return{circuitJson:H2t(i),parameters:i};if(i.num_pins===5)return{circuitJson:WTe(i),parameters:i};throw new Error("Invalid number of pins")},j2t=n=>{const{pn:e}=n;return e===1?{x:-1.7,y:0}:e===2?{x:1.7,y:-.95}:{x:1.7,y:.95}},H2t=n=>{const e=[];for(let i=0;i<n.num_pins;i++){const{x:r,y:o}=j2t({num_pins:n.num_pins,pn:i+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl)});e.push(or(i+1,r,o,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=Zr(0,Number.parseInt(n.h),.3);return[...e,t]},XTe=n=>{const{p:e,h:t,pn:i}=n;if(i===1)return{x:-t/2-.5,y:e};if(i===2)return{x:-t/2-.5,y:0};if(i===3)return{x:-t/2-.5,y:-e};if(i===4)return{x:t/2+.5,y:-e};if(i===5)return{x:t/2+.5,y:e};throw new Error("Invalid pin number")},WTe=n=>{const e=[];for(let d=1;d<=n.num_pins;d++){const{x:h,y:f}=XTe({h:Number.parseFloat(n.h),p:Number.parseFloat(n.p),pn:d});e.push(or(d,h,f,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=(n.num_pins+1)/2*Number.parseFloat(n.p),i=Number.parseFloat(n.h),r={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-t/3,y:i/2+Number.parseFloat(n.p)/1.3},{x:t/3,y:i/2+Number.parseFloat(n.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-t/3,y:-i/2-Number.parseFloat(n.p)/1.3},{x:t/3,y:-i/2-Number.parseFloat(n.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},s=Zr(0,i+.3,.3),a=XTe({h:Number.parseFloat(n.h),p:Number.parseFloat(n.p),pn:1});a.x=a.x-Number.parseFloat(n.pw)*1.5;const c=.7,l=.3,u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:a.x+c/2,y:a.y},{x:a.x-c/2,y:a.y+l/2},{x:a.x-c/2,y:a.y-l/2},{x:a.x+c/2,y:a.y}],stroke_width:.05};return[...e,s,r,o,u]},V2t=YTe.extend({}),q2t=n=>{const e=V2t.parse({...n,num_pins:5});return{circuitJson:WTe(e),parameters:e}},G2t=[{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}],Y2t=$2({}),X2t=n=>{const e=Y2t.parse(n),t=[];for(let d=0;d<e.num_pins;d++){const{x:h,y:f}=LK({num_pins:e.num_pins,pn:d+1,w:e.w,p:e.p??1.27,pl:e.pl,widthincludeslegs:!0});t.push(or(d+1,h,f,e.pl??"1mm",e.pw??"0.6mm"))}const i=Math.min(1,e.p/2),r=e.w+i,o=(e.num_pins/2-1)*e.p+e.pw+i,s=[];for(const d of G2t){const{dx:h,dy:f}=d;s.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",route:[{x:h*r/2-h*e.p,y:f*o/2},{x:h*r/2,y:f*o/2},{x:h*r/2,y:f*o/2-f*e.p}],type:"pcb_silkscreen_path",stroke_width:.1})}const a=e.p/4,c=-r/2-a/2,l=o/2-e.p/2;s.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:c,y:l},{x:c-a,y:l+a},{x:c-a,y:l-a},{x:c,y:l}],stroke_width:.1});const u=Zr(0,o/2+.4,o/12);return{circuitJson:[...t,u,...s],parameters:e}},DD=(n,e,t,i,r,o)=>({pcb_plated_hole_id:"",type:"pcb_plated_hole",shape:"circular_hole_with_rect_pad",x:e,y:t,hole_diameter:Yu(i),hole_shape:"circle",pad_shape:"rect",rect_pad_width:Yu(r),rect_pad_height:Yu(o),pcb_port_id:"",layers:["top","bottom"],port_hints:[n.toString()]}),BK=({fs:n,pn:e,anchor_x:t,anchor_y:i,textalign:r="center",orthogonal:o=!1,verticallyinverted:s=!1,layer:a="top"})=>{let c=0;o&&s?c=270:s?c=180:o?c=90:c=0;let l="center";return r==="left"&&(s?l="center_right":l="center_left"),r==="right"&&(s?l="center_left":l="center_right"),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:n,pcb_component_id:"pcb_component_1",text:`{PIN${e}}`,layer:a,anchor_position:{x:t,y:i},anchor_alignment:l,ccw_rotation:c}};function W2t({pinlabeltextalignleft:n,pinlabeltextalignright:e,pinlabelorthogonal:t}){let i="top";return t?i="left":i="top",n&&(t?i="bottom":i="right"),e&&(t?i="top":i="left"),i}var Z2t=Re({fn:U(),num_pins:Fe().optional().default(6),rows:Gn([U(),Fe()]).transform(n=>Number(n)).optional().default(1).describe("number of rows"),p:et.default("0.1in").describe("pitch"),id:et.default("1.0mm").describe("inner diameter"),od:et.default("1.5mm").describe("outer diameter"),male:vt().optional().describe("for male pin headers"),female:vt().optional().describe("for female pin headers"),pinlabeltextalignleft:vt().optional().default(!1),pinlabeltextaligncenter:vt().optional().default(!1),pinlabeltextalignright:vt().optional().default(!1),pinlabelverticallyinverted:vt().optional().default(!1),pinlabelorthogonal:vt().optional().default(!1),nosquareplating:vt().optional().default(!1).describe("do not use rectangular pad for pin 1"),nopinlabels:vt().optional().default(!1).describe("omit silkscreen pin labels"),doublesidedpinlabel:vt().optional().default(!1).describe("add silkscreen pins in top and bottom layers"),bottomsidepinlabel:vt().optional().default(!1).describe("place the silkscreen reference text on the bottom layer instead of top")}).transform(n=>{const e=W2t(n);return{...n,pinlabelAnchorSide:e,male:n.male??!n.female,female:n.female??!1}}).superRefine((n,e)=>{n.male&&n.female&&e.addIssue({code:_i.custom,message:"'male' and 'female' cannot both be true; it should be male or female.",path:["male","female"]})}),K2t=n=>{const e=Z2t.parse(n),{p:t,id:i,od:r,rows:o,num_pins:s,pinlabelAnchorSide:a,pinlabelverticallyinverted:c,pinlabelorthogonal:l,pinlabeltextalignleft:u,pinlabeltextalignright:d,nopinlabels:h,doublesidedpinlabel:f,bottomsidepinlabel:m}=e;let y="center";u?y="left":d&&(y="right");const g=[],b=Math.ceil(s/o),x=-t,w=({xoff:M,yoff:I,od:C,anchorSide:$})=>{let P=0,H=0;const G=C*.75;switch($){case"right":P=G;break;case"top":H=G;break;case"bottom":H=-G;break;case"left":P=-G;break}return{anchor_x:M+P,anchor_y:I+H}},T=(M,I,C)=>{M===1&&!e.nosquareplating?g.push(DD(M,I,C,i,r,r)):g.push(Ps(M,I,C,i,r));const{anchor_x:$,anchor_y:P}=w({xoff:I,yoff:C,od:r,anchorSide:a});h||(m?g.push(BK({fs:r/5,pn:M,anchor_x:$,anchor_y:P,textalign:y,orthogonal:l,verticallyinverted:c,layer:"bottom"})):g.push(BK({fs:r/5,pn:M,anchor_x:$,anchor_y:P,textalign:y,orthogonal:l,verticallyinverted:c,layer:"top"})),f&&g.push(BK({fs:r/5,pn:M,anchor_x:$,anchor_y:P,textalign:y,orthogonal:l,verticallyinverted:c,layer:"bottom"})))},N=new Set,R=o>2&&b>2;if(o===1){const M=-((s-1)/2)*t;for(let I=0;I<s;I++){const C=I+1,$=M+I*t,P=`${$},0`;if(N.has(P))throw new Error(`Overlap at ${P}`);N.add(P),T(C,$,0)}}else if(R){const M=-((b-1)/2)*t;let I=1;for(let C=0;C<o&&I<=s;C++)for(let $=0;$<b&&I<=s;$++){const P=M+$*t,H=C*x,G=`${P},${H}`;if(N.has(G))throw new Error(`Overlap at ${G}`);N.add(G),T(I++,P,H)}}else{const M=-((b-1)/2)*t;let I=1,C=0,$=o-1,P=0,H=b-1;for(;I<=s&&C<=$&&P<=H;){for(let G=C;G<=$&&I<=s;G++){const X=M+P*t,W=G*x,K=`${X},${W}`;if(N.has(K))throw new Error(`Overlap at ${K}`);N.add(K),T(I++,X,W)}P++;for(let G=P;G<=H&&I<=s;G++){const X=M+G*t,W=$*x,K=`${X},${W}`;if(N.has(K))throw new Error(`Overlap at ${K}`);N.add(K),T(I++,X,W)}if($--,P<=H){for(let G=$;G>=C&&I<=s;G--){const X=M+H*t,W=G*x,K=`${X},${W}`;if(N.has(K))throw new Error(`Overlap at ${K}`);N.add(K),T(I++,X,W)}H--}if(C<=$){for(let G=H;G>=P&&I<=s;G--){const X=M+G*t,W=C*x,K=`${X},${W}`;if(N.has(K))throw new Error(`Overlap at ${K}`);N.add(K),T(I++,X,W)}C++}}if(I-1<s)throw new Error(`Missing pins: assigned ${I-1}, expected ${s}`)}const k=Zr(0,t,.5);return{circuitJson:[...g,k],parameters:e}},Q2t=$2({}),J2t=n=>{const e=Q2t.parse({fn:"sot563",num_pins:6,w:1.94,p:.5,pw:.3,pl:.67,legoutside:!0});return{circuitJson:hw(e),parameters:e}},e5t=$2({p:"1.27mm",w:"3.9mm",legsoutside:!0}),t5t=n=>{const e=e5t.parse({...n,num_pins:8});return{circuitJson:hw(e),parameters:e}},n5t=$2({p:"1.27mm",w:"7.5mm",legsoutside:!0}),i5t=n=>{const e=n5t.parse({...n,num_pins:16});return{circuitJson:hw(e),parameters:e}},r5t=Re({fn:U(),num_pins:we(3).default(3),w:U().default("1.2mm"),h:U().default("1.2mm"),pl:U().default("0.3mm"),pw:U().default("0.32mm")}),o5t=n=>{const e=r5t.parse(n),t=a5t(e),i=Zr(.4,et.parse(e.h),.2);return{circuitJson:[...t,i],parameters:e}},s5t=n=>{const{pn:e}=n;return e===1?{x:0,y:0}:e===2?{x:1,y:-.4}:{x:1,y:.4}},a5t=n=>{const e=[];for(let t=0;t<3;t++){const{x:i,y:r}=s5t({num_pins:n.num_pins,pn:t+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl)});e.push(or(t+1,i,r,Number.parseFloat(n.pl),t!==0?Number.parseFloat(n.pw):.42))}return e},c5t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("2.36mm"),h:U().default("1.22mm"),pl:U().default("0.9mm"),pw:U().default("0.9mm"),p:U().default("4.19mm")}),l5t=n=>{const e=c5t.parse(n),t=Zr(0,et.parse(e.h)/4+.4,.3);return{circuitJson:d5t(e).concat(t),parameters:e}},u5t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},d5t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=u5t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},h5t=Re({fn:U(),p:et.optional().default("2.54mm"),id:et.optional().default("0.7mm"),od:et.optional().default("1mm")}),p5t=n=>{const e=h5t.parse(n),{p:t,id:i,od:r}=e,o=[Ps(1,-t/2,0,i,r),Ps(2,t/2,0,i,r)],s={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-t/2+r+i/2,y:0},{x:t/2-r-i/2,y:0}],stroke_width:.1,pcb_silkscreen_path_id:""},a=Zr(0,t/4,.5);return{circuitJson:[...o,s,a],parameters:e}},LD=(n,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:n,stroke_width:e.stroke_width||.1}),f5t=Re({fn:we("pushbutton"),w:et.default(4.5),h:et.default(6.5),id:et.default(1),od:et.default(1.2)}),m5t=n=>{const e=f5t.parse(n),t=e.w,i=e.h,r=e.id,o=[Ps(1,-t/2,i/2,r,r*1.5),Ps(2,-t/2,-i/2,r,r*1.5),Ps(3,t/2,-i/2,r,r*1.5),Ps(4,t/2,i/2,r,r*1.5)],s=[LD([{x:-t/2,y:-i/2},{x:-t/2,y:i/2}]),LD([{x:t/2,y:-i/2},{x:t/2,y:i/2}]),LD([{x:-t/2,y:0},{x:-t/5,y:0},{x:t/5*1/Math.sqrt(2),y:i/8}]),LD([{x:t/2,y:0},{x:t/5,y:0}])],a=Zr(0,i/2+.4,.5);return{circuitJson:[...o,...s,a],parameters:e}},ZTe=Re({fn:U(),w:et.default("22.58mm"),h:et.optional(),left:et.optional().default(20),right:et.optional().default(20),top:et.optional().default(2),bottom:et.optional().default(2),p:et.default(et.parse("2.54mm")),pw:et.default(et.parse("1.6mm")),pl:et.default(et.parse("2.4mm")),innerhole:vt().default(!1),innerholeedgedistance:et.default(et.parse("1.61mm")),silkscreenlabels:vt().default(!1),silkscreenlabelmargin:et.default(et.parse("0.1mm"))}),_5t=n=>{const e=ZTe.parse(n);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},zD=(n,e,t)=>{let i=[];return t==="right"&&(i=[{x:n+1/2,y:e},{x:n-1/2,y:e+.6/2},{x:n-1/2,y:e-.6/2},{x:n+1/2,y:e}]),t==="left"&&(i=[{x:n-1/2,y:e},{x:n+1/2,y:e+.6/2},{x:n+1/2,y:e-.6/2},{x:n-1/2,y:e}]),t==="top"&&(i=[{x:n,y:e+1/2},{x:n-.6/2,y:e-1/2},{x:n+.6/2,y:e-1/2},{x:n,y:e+1/2}]),t==="bottom"&&(i=[{x:n,y:e-1/2},{x:n-.6/2,y:e+1/2},{x:n+.6/2,y:e+1/2},{x:n,y:e-1/2}]),i},y5t=n=>{const e=ZTe.parse(n),t=e.h??_5t(e),i=[],r=[],o=[];let s=[];const a=1,c=a,l=e.left+e.right+(e.bottom??0)+(e.top??0),d=`pin${l}`.length*.7/2;if(e.right){const y=-((e.right-1)/2)*e.p;for(let g=0;g<e.right;g++){if(g===0&&!e.left&&!e.bottom&&!e.silkscreenlabels&&(s=zD(e.w/2-e.pl*1.4,y+g*e.p,"right")),i.push(or(g+1+e.left+(e.bottom??0),e.w/2-e.pl/2,y+g*e.p,e.pl,e.pw)),e.silkscreenlabels){const b=g+1+e.left+(e.bottom??0),x=`pin${b}`;o.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${b}`,pcb_component_id:"1",layer:"top",anchor_position:{x:e.w/2-e.pl-(d+e.silkscreenlabelmargin),y:y+g*e.p},text:x,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"})}e.innerhole&&(r.push(Ps(g+1+e.left+(e.bottom??0)+l,e.w/2,y+g*e.p,a,c)),r.push(Ps(g+1+e.left+(e.bottom??0)+l*2,e.w/2-e.innerholeedgedistance,y+g*e.p,a,c)))}}if(e.left){const y=(e.left-1)/2*e.p;for(let g=0;g<e.left;g++){if(g===0&&!e.silkscreenlabels&&(s=zD(-e.w/2+e.pl*1.4,y-g*e.p,"left")),i.push(or(g+1,-e.w/2+e.pl/2,y-g*e.p,e.pl,e.pw)),e.silkscreenlabels){const b=g+1,x=`pin${b}`;o.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${b}`,pcb_component_id:"1",layer:"top",anchor_position:{x:-e.w/2+e.pl+(d+e.silkscreenlabelmargin),y:y-g*e.p},text:x,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"})}e.innerhole&&(r.push(Ps(g+1+l,-e.w/2,y-g*e.p,a,c)),r.push(Ps(g+1+l*2,-e.w/2+e.innerholeedgedistance,y-g*e.p,a,c)))}}if(e.top){const y=(e.top-1)/2*e.p;for(let g=0;g<e.top;g++){if(g===0&&!e.left&&!e.bottom&&!e.right&&!e.silkscreenlabels&&(s=zD(y-g*e.p,t/2-e.pl*1.4,"top")),i.push(or(g+1+e.left+e.right+(e.bottom??0),y-g*e.p,t/2-e.pl/2,e.pw,e.pl)),e.silkscreenlabels){const b=g+1+e.left+e.right+(e.bottom??0),x=`pin${b}`;o.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${b}`,pcb_component_id:"1",layer:"top",anchor_position:{x:y-g*e.p,y:t/2-e.pl-(d+e.silkscreenlabelmargin)},text:x,font_size:.7,font:"tscircuit2024",anchor_alignment:"center",ccw_rotation:270})}e.innerhole&&(r.push(Ps(g+1+e.left+e.right+(e.bottom??0)+l,y-g*e.p,t/2,a,c)),r.push(Ps(g+1+e.left+e.right+(e.bottom??0)+l*2,y-g*e.p,t/2-e.innerholeedgedistance,a,c)))}}if(e.bottom){const y=-((e.bottom-1)/2)*e.p;for(let g=0;g<e.bottom;g++){if(g===0&&!e.left&&!e.silkscreenlabels&&(s=zD(y+g*e.p,-t/2+e.pl*1.4,"bottom")),i.push(or(g+1+e.left,y+g*e.p,-t/2+e.pl/2,e.pw,e.pl)),e.silkscreenlabels){const b=g+1+e.left,x=`pin${b}`;o.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${b}`,pcb_component_id:"1",layer:"top",anchor_position:{x:y+g*e.p,y:-t/2+e.pl+(d+e.silkscreenlabelmargin)},text:x,font_size:.7,font:"tscircuit2024",anchor_alignment:"center",ccw_rotation:90})}e.innerhole&&(r.push(Ps(g+1+e.left+l,y+g*e.p,-t/2,a,c)),r.push(Ps(g+1+e.left+l*2,y+g*e.p,-t/2+e.innerholeedgedistance,a,c)))}}const h={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_triangle_1",pcb_component_id:"2",route:s,stroke_width:.1,layer:"top"},f={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-e.w/2,y:t/2},{x:e.w/2,y:t/2},{x:e.w/2,y:-t/2},{x:-e.w/2,y:-t/2},{x:-e.w/2,y:t/2}],stroke_width:.1,layer:"top"},m=Zr(0,t/1.8,t/25);return{circuitJson:[...i,...r,...o,f,...e.silkscreenlabels?[]:[h],m],parameters:e}},KTe=Re({fn:U(),w:et.default("22.58mm"),h:et.optional(),left:et.optional().default(20),right:et.optional().default(20),top:et.optional().default(2),bottom:et.optional().default(2),p:et.default(et.parse("2.54mm")),pw:et.default(et.parse("1.6mm")),pl:et.default(et.parse("3.2mm")),innerhole:vt().default(!1),innerholeedgedistance:et.default(et.parse("1.61mm"))}),g5t=n=>{const e=KTe.parse(n);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},v5t=(n,e,t,i=1,r=.6)=>{const o=i/2,s=r/2;return{left:[{x:n+o,y:e},{x:n-o,y:e+s},{x:n-o,y:e-s},{x:n+o,y:e}],right:[{x:n-o,y:e},{x:n+o,y:e+s},{x:n+o,y:e-s},{x:n-o,y:e}],top:[{x:n,y:e-o},{x:n-s,y:e+o},{x:n+s,y:e+o},{x:n,y:e-o}],bottom:[{x:n,y:e+o},{x:n-s,y:e-o},{x:n+s,y:e-o},{x:n,y:e+o}]}[t]},x5t=n=>{const e=KTe.parse(n),t=e.h??g5t(e),i=[],r=[],o=[],s=1,a=1.2,c=e.left+e.right+(e.bottom??0)+(e.top??0);let l=[],u=1;if(e.left){const m=(e.left-1)/2*e.p;for(let y=0;y<e.left;y++)y===0&&(l=v5t(-e.w/2-e.pl/2,m-y*e.p,"left")),i.push(or(u,-e.w/2+e.pl/2,m-y*e.p,e.pl,e.pw)),r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${u}`,pcb_component_id:"1",layer:"top",anchor_position:{x:-e.w/2+e.pl/2-4.5,y:m-y*e.p},text:`pin${u}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),u++,e.innerhole&&o.push(Ps(u+c,-e.w/2+e.innerholeedgedistance,m-y*e.p,s,a))}if(e.bottom){const m=(e.bottom-1)/2*e.p;for(let y=e.bottom-1;y>=0;y--)i.push(or(u,m-y*e.p,-t/2+e.pl/2,e.pw,e.pl)),r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${u}`,pcb_component_id:"1",layer:"top",anchor_position:{x:m-y*e.p,y:-t/2+e.pl/2-3.2},text:`pin${u}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),u++,e.innerhole&&o.push(Ps(u+c,m-y*e.p,-t/2+e.innerholeedgedistance,s,a))}if(e.right){const m=-((e.right-1)/2)*e.p;for(let y=0;y<e.right;y++)i.push(or(u,e.w/2-e.pl/2,m+y*e.p,e.pl,e.pw)),r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${u}`,pcb_component_id:"1",layer:"top",anchor_position:{x:e.w/2-e.pl/2+3.7,y:m+y*e.p},text:`pin${u}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),u++,e.innerhole&&o.push(Ps(u+c,e.w/2-e.innerholeedgedistance,m+y*e.p,s,a))}if(e.top){const m=-((e.top-1)/2)*e.p;for(let y=e.top-1;y>=0;y--)i.push(or(u,m+y*e.p,t/2-e.pl/2,e.pw,e.pl)),r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${u}`,pcb_component_id:"1",layer:"top",anchor_position:{x:m+y*e.p,y:t/2-e.pl/2+3.2},text:`pin${u}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),u++,e.innerhole&&o.push(Ps(u+c,m+y*e.p,t/2-e.innerholeedgedistance,s,a))}const d={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"1",pcb_component_id:"1",layer:"top",route:l,stroke_width:.1},h={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:t/2+e.pl/3},{x:e.w/2+e.pl/3,y:t/2+e.pl/3},{x:e.w/2+e.pl/3,y:-t/2-e.pl/3},{x:-e.w/2-e.pl/3,y:-t/2-e.pl/3},{x:-e.w/2-e.pl/3,y:t/2+e.pl/3}],stroke_width:.1,layer:"top"},f=Zr(0,t/1.8,t/25);return{circuitJson:[...o,...i,...r,h,d,f],parameters:e}},b5t=n=>(n.legsoutside=!0,JA(n)),QTe=Re({fn:U(),w:et.default("10mm"),h:et.optional(),left:et.optional().default(20),right:et.optional().default(20),top:et.optional().default(0),bottom:et.optional().default(0),p:et.default(et.parse("2.54mm")),id:et.optional().default(et.parse("1mm")),od:et.optional().default(et.parse("1.5mm"))}),w5t=n=>{const e=QTe.parse(n);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},FD=(n,e,t,i=1,r=.6)=>{const o=i/2,s=r/2;return{left:[{x:n+o,y:e},{x:n-o,y:e+s},{x:n-o,y:e-s},{x:n+o,y:e}],right:[{x:n-o,y:e},{x:n+o,y:e+s},{x:n+o,y:e-s},{x:n-o,y:e}],top:[{x:n,y:e-o},{x:n-s,y:e+o},{x:n+s,y:e+o},{x:n,y:e-o}],bottom:[{x:n,y:e+o},{x:n-s,y:e-o},{x:n+s,y:e-o},{x:n,y:e+o}]}[t]},S5t=n=>{const e=QTe.parse(n),t=e.h??w5t(e),i=[],r=e.id,o=e.od;let s=[];if(e.right){const u=-((e.right-1)/2)*e.p;for(let d=0;d<e.right;d++)d===0&&!e.left&&!e.bottom&&(s=FD(e.w/2+o*1.4,u+d*e.p,"right")),i.push(Ps(d+1+e.left+(e.bottom??0),e.w/2,u+d*e.p,r,o))}if(e.left){const u=-((e.left-1)/2)*e.p;for(let d=0;d<e.left;d++)d===e.left-1&&(s=FD(-e.w/2-o*1.4,u+d*e.p,"left")),i.push(Ps(d+1,-e.w/2,u+d*e.p,r,o))}if(e.top){const u=-((e.top-1)/2)*e.p;for(let d=0;d<e.top;d++)d===e.top-1&&!e.left&&!e.bottom&&!e.right&&(s=FD(u+d*e.p,t/2+o*1.4,"top")),i.push(Ps(d+1+e.right+(e.bottom??0)+e.left,u+d*e.p,t/2,r,o))}if(e.bottom){const u=-((e.bottom-1)/2)*e.p;for(let d=0;d<e.bottom;d++)d===0&&!e.left&&(s=FD(u+d*e.p,-t/2-o*1.4,"bottom")),i.push(Ps(d+1+e.left,u+d*e.p,-t/2,r,o))}const a={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"1",pcb_component_id:"1",layer:"top",route:s,stroke_width:.1},c={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-e.w/2-o,y:t/2+o},{x:e.w/2+o,y:t/2+o},{x:e.w/2+o,y:-t/2-o},{x:-e.w/2-o,y:-t/2-o},{x:-e.w/2-o,y:t/2+o}],stroke_width:.1,layer:"top"},l=Zr(0,t/1.7,t/25);return{circuitJson:[...i,c,l,a],parameters:e}},JTe=(n,e,t,i)=>Array.from({length:25},(r,o)=>{const s=o/24*Math.PI-Math.PI/2;return{x:n+(i==="right"?1:-1)*Math.cos(s)*t,y:e+Math.sin(s)*t}}),E5t=Re({fn:U(),p:et.optional().default("4.88mm"),id:et.optional().default("0.6mm"),od:et.optional().default("1.2mm"),w:et.optional().default("5.6mm"),h:et.optional().default("3.5mm")}),T5t=n=>{const e=E5t.parse(n),{p:t,id:i,od:r,w:o,h:s}=e,a=s/2,c=[Ps(1,-t/2,0,i,r),Ps(2,t/2,0,i,r)],l=JTe(-o/2,0,a,"left"),u=JTe(o/2,0,a,"right"),d={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[...l,...l.slice(1).reverse(),{x:-o/2,y:-s/2},{x:o/2,y:-s/2},...u,{x:o/2,y:s/2},{x:-o/2,y:s/2}],stroke_width:.1,pcb_silkscreen_path_id:""},h=Zr(0,t/4,.5);return{circuitJson:[...c,d,h],parameters:e}};Re({w:et,h:et});var M5t=n=>{const{w:e,h:t}=n,i=Yu(e),r=Yu(t);return{circuitJson:[or(1,0,0,i,r),Zr(0,r/2+.5,.2)],parameters:n}},C5t=Re({fn:U(),num_pins:Gn([we(3),we(2)]).default(3),p:U().default("1.27mm"),id:U().default("0.72mm"),od:U().default("0.95mm"),w:U().default("4.5mm"),h:U().default("4.5mm"),inline:vt().default(!1),string:U().optional()}),A5t=(n,e,t)=>Array.from({length:25},(i,r)=>{const o=r/24*Math.PI;return{x:n+Math.cos(o)*t,y:e+Math.sin(o)*t}}),R5t=n=>{const{p:e,id:t,od:i,h:r}=n,o=Number.parseFloat(r)/2,s=Number.parseFloat(e);return[Ps(1,-s,o-s,t,i),Ps(2,s,o-s,t,i)]},P5t=n=>{const e=n.string?.match(/^to92_(\d+)/),t=e?Number.parseInt(e[1],10):3,i=C5t.parse({...n,num_pins:t}),{p:r,id:o,od:s,w:a,h:c,inline:l}=i,u=Number.parseFloat(c)/2,d=Number.parseFloat(r);let h=[];if(i.num_pins===3)h=l?[Ps(1,-d,u-d,o,s),Ps(2,0,u-d,o,s),Ps(3,d,u-d,o,s)]:[Ps(1,0,u,o,s),Ps(2,-d,u-d,o,s),Ps(3,d,u-d,o,s)];else if(i.num_pins===2)h=R5t(i);else throw new Error("Invalid number of pins for TO-92");const f=Number.parseFloat(a)/2,m=A5t(0,u,f),y={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[...m,{x:-f,y:0},{x:f,y:0},m[0]],stroke_width:.1,pcb_silkscreen_path_id:""},g=Zr(0,u+1,.5);return{circuitJson:[...h,y,g],parameters:i}},I5t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("2.15mm"),h:U().default("1.20mm"),pl:U().default("0.5mm"),pw:U().default("0.6mm"),p:U().default("1.4mm")}),N5t=n=>{const e=I5t.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:O5t(e).concat(i,t),parameters:e}},k5t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},O5t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=k5t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},D5t=$2({}),L5t=n=>{const e=D5t.parse(n),t=[];for(let s=0;s<e.num_pins;s++){const{x:a,y:c}=LK({num_pins:e.num_pins,pn:s+1,w:e.w,p:e.p??1.27,pl:e.pl,widthincludeslegs:!0});t.push(or(s+1,a,c,e.pl??"1.5mm",e.pw??"0.6mm"))}const i=(e.num_pins/2-1)*e.p+e.pw,r=Zr(0,i/2-.5,i/12),o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:-e.w/3,y:i/2+.2},{x:e.w/3,y:i/2+.2}],stroke_width:.1};return{circuitJson:[...t,r,o],parameters:e}},z5t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("5.0mm"),h:U().default("2.30mm"),pl:U().default("1.25mm"),pw:U().default("2mm"),p:U().default("3.75mm")}),F5t=n=>{const e=z5t.parse(n),t=Zr(0,et.parse(e.h)/2+1,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2+.5,y:et.parse(e.h)/2+.5},{x:-et.parse(e.w)/2-.5,y:et.parse(e.h)/2+.5},{x:-et.parse(e.w)/2-.5,y:-et.parse(e.h)/2-.5},{x:et.parse(e.p)/2+.5,y:-et.parse(e.h)/2-.5}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:U5t(e).concat(i,t),parameters:e}},B5t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},U5t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=B5t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},$5t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("4.4mm"),h:U().default("2.1mm"),pl:U().default("1.2mm"),pw:U().default("1.2mm"),p:U().default("2.9mm")}),j5t=n=>{const e=$5t.parse(n),t=Zr(0,et.parse(e.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:V5t(e).concat(i,t),parameters:e}},H5t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},V5t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=H5t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},q5t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.30mm"),h:U().default("1.80mm"),pl:U().default("0.60mm"),pw:U().default("0.45mm"),p:U().default("2.1mm")}),G5t=n=>{const e=q5t.parse(n),t=Zr(0,et.parse(e.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:X5t(e).concat(i,t),parameters:e}},Y5t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},X5t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Y5t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},W5t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("1.4mm"),h:U().default("0.9mm"),pl:U().default("0.35mm"),pw:U().default("0.25mm"),p:U().default("1.2mm")}),Z5t=n=>{const e=W5t.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2+.15,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.4,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.4,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2+.15,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Q5t(e).concat(i,t),parameters:e}},K5t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Q5t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=K5t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},J5t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("1.3mm"),h:U().default("0.9mm"),pl:U().default("0.4mm"),pw:U().default("0.7mm"),p:U().default("0.7mm")}),e3t=n=>{const e=J5t.parse(n),t=Zr(0,et.parse(e.h)+.1,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2+.2,y:et.parse(e.h)/2+.2},{x:-et.parse(e.w)/2-.2,y:et.parse(e.h)/2+.2},{x:-et.parse(e.w)/2-.2,y:-et.parse(e.h)/2-.2},{x:et.parse(e.p)/2+.2,y:-et.parse(e.h)/2-.2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:n3t(e).concat(i,t),parameters:e}},t3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},n3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=t3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},i3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3,05mm"),h:U().default("1.65mm"),pl:U().default("0.6mm"),pw:U().default("0.6mm"),pad_spacing:U().default("2.2mm")}),r3t=n=>{const e=i3t.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.pad_spacing)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:-et.parse(e.h)/2},{x:et.parse(e.pad_spacing)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:s3t(e).concat(i,t),parameters:e}},o3t=n=>{const{pn:e,pad_spacing:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},s3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=o3t({pn:t,pad_spacing:Number.parseFloat(n.pad_spacing)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},a3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("4.4mm"),h:U().default("2.1mm"),pl:U().default("1.2mm"),pw:U().default("1.2mm"),p:U().default("2.9mm")}),c3t=n=>{const e=a3t.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:u3t(e).concat(i,t),parameters:e}},l3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},u3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=l3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},d3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("4.4mm"),h:U().default("2.1mm"),pl:U().default("0.91mm"),pw:U().default("1.22mm"),p:U().default("3.146mm")}),h3t=n=>{const e=d3t.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:f3t(e).concat(i,t),parameters:e}},p3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},f3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=p3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},m3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("1.80mm"),h:U().default("1.00mm"),pl:U().default("0.66mm"),pw:U().default("0.5mm"),p:U().default("0.8mm")}),_3t=n=>{const e=m3t.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.1,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.1,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:g3t(e).concat(i,t),parameters:e}},y3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},g3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=y3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},v3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("6.2mm"),h:U().default("3.4mm"),pl:U().default("1.4mm"),pw:U().default("2.1mm"),p:U().default("4.4mm")}),x3t=n=>{const e=v3t.parse(n),t=Zr(0,et.parse(e.h)/2+.4,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:w3t(e).concat(i,t),parameters:e}},b3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},w3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=b3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},S3t=Re({fn:U(),num_pins:Gn([we(3),we(5)]).default(3),w:U().default("4.80mm"),h:U().default("4.80mm"),pl:U().default("1.3mm"),pw:U().default("0.9mm"),p:U().default("1.5mm"),string:U().optional()}),E3t=n=>{const e=[],t=Number.parseFloat(n.p),i=Number.parseFloat(n.pw),r=Number.parseFloat(n.w),o=Number.parseFloat(n.pl);e.push(or(1,-r/2,t,o,i),or(2,-r/2+(1.5-1.3)/2,0,1.5,i),or(3,-r/2,-t,o,i));const s=Zr(0,0,.3),a=Number.parseFloat(n.w)/2-1,c=Number.parseFloat(n.h)/2,l={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-a,y:c},{x:a,y:c},{x:a,y:c/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},u={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-a,y:-c},{x:a,y:-c},{x:a,y:-c/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,l,u,s]},T3t=n=>{const e=[];Number.parseFloat(n.p),Number.parseFloat(n.pw),Number.parseFloat(n.w),e.push(or(1,-1.85,-1.5,1.5,.7),or(2,-1.85,1.5,1.5,.7),or(3,0,0,.8,2),or(4,1.85,-1.5,1.5,.7),or(5,1.85,1.5,1.5,.7));const t=Zr(0,Number.parseFloat(n.h)/2+.5,.3),i=Number.parseFloat(n.w)/2-1,r=Number.parseFloat(n.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:r},{x:i,y:r}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-r},{x:i,y:-r}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,o,s,t]},M3t=n=>{const e=n.string?.match(/^sot89_(\d+)/),t=e?Number.parseInt(e[1],10):3,i=S3t.parse({...n,num_pins:t});if(i.num_pins===3)return{circuitJson:E3t(i),parameters:i};if(i.num_pins===5)return{circuitJson:T3t(i),parameters:i};throw new Error("Invalid number of pins for SOT89")},C3t=Re({fn:U(),p:et.optional().default("5.0mm"),id:et.optional().default("1.0mm"),od:et.optional().default("1.9mm"),w:et.optional().default("13mm"),h:et.optional().default("7mm"),num_pins:Fe().optional(),string:U().optional()}),A3t=n=>{const e=C3t.parse(n),{fn:t,id:i,od:r,w:o,h:s,string:a}=e,c=Number.parseInt(a?.split("_")[1]??"3"),l=-1,u=o/2,d=s/2,h=2.5,f=o*.4,m=Math.max(h,f/(c-1)),y=Array.from({length:c},(N,R)=>{const k=c%2===0?(R-c/2+.5)*m:(R-Math.floor(c/2))*m;return Ps(R+1,k,l,i,r)}),g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-u,y:-d},{x:u,y:-d},{x:u,y:d},{x:-u,y:d},{x:-u,y:-d}],stroke_width:.1,pcb_silkscreen_path_id:""},b=-d+2*s/3,x={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-u,y:b},{x:u,y:b}],stroke_width:.1,pcb_silkscreen_path_id:""},w=[{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-o/6,y:b},{x:-o/6,y:d}],stroke_width:.1,pcb_silkscreen_path_id:""},{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:o/6,y:b},{x:o/6,y:d}],stroke_width:.1,pcb_silkscreen_path_id:""}],T=Zr(0,s/2+.6,.5);return{circuitJson:[...y,g,x,...w,T],parameters:{...e,p:m}}},R3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("5.40mm"),h:U().default("2.30mm"),pl:U().default("1.30mm"),pw:U().default("1.70mm"),p:U().default("3.5mm")}),P3t=n=>{const e=R3t.parse(n),t=Zr(0,et.parse(e.h)/2+.4,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:N3t(e).concat(i,t),parameters:e}},I3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},N3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=I3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},k3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("1.90mm"),h:U().default("1.33mm"),pl:U().default("0.5mm"),pw:U().default("0.7mm"),p:U().default("0.8mm")}),O3t=n=>{const e=k3t.parse(n),t=Zr(0,et.parse(e.h)+.1,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2+.1,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2+.1,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:L3t(e).concat(i,t),parameters:e}},D3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},L3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=D3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},z3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("7.0mm"),h:U().default("3.35mm"),pl:U().default("1.50mm"),pw:U().default("2.70mm"),p:U().default("4.8mm")}),F3t=n=>{const e=z3t.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:U3t(e).concat(i,t),parameters:e}},B3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},U3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=B3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},$3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.0mm"),h:U().default("1.80mm"),pl:U().default("0.80mm"),pw:U().default("1.20mm"),p:U().default("1.6mm")}),j3t=n=>{const e=$3t.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.1,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.1,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:V3t(e).concat(i,t),parameters:e}},H3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},V3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=H3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},q3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("7.10mm"),h:U().default("3.40mm"),pl:U().default("2.45mm"),pw:U().default("1.80mm"),p:U().default("4.05mm")}),G3t=n=>{const e=q3t.parse(n),t=Zr(0,et.parse(e.h)/2+.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.5,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.5,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:X3t(e).concat(i,t),parameters:e}},Y3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},X3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Y3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},W3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("4.80mm"),h:U().default("2.10mm"),pl:U().default("1.30mm"),pw:U().default("1.40mm"),p:U().default("2.9mm")}),Z3t=n=>{const e=W3t.parse(n),t=Zr(0,et.parse(e.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Q3t(e).concat(i,t),parameters:e}},K3t=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Q3t=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=K3t({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},J3t=Re({fn:U(),num_pins:we(2).default(2),w:U().default("7.30mm"),h:U().default("4.40mm"),pl:U().default("2.50mm"),pw:U().default("2.30mm"),p:U().default("4.30mm")}),ewt=n=>{const e=J3t.parse(n),t=Zr(0,et.parse(e.h)/2+.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.1,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.1,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:nwt(e).concat(i,t),parameters:e}},twt=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},nwt=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=twt({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},iwt=Re({fn:U(),num_pins:we(2).default(2),w:U().default("10.70mm"),h:U().default("6.60mm"),pl:U().default("3.30mm"),pw:U().default("2.50mm"),p:U().default("6.80mm")}),rwt=n=>{const e=iwt.parse(n),t=Zr(0,3,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2-.8},{x:-et.parse(e.w)/2-.8,y:et.parse(e.h)/2-.8},{x:-et.parse(e.w)/2-.8,y:-et.parse(e.h)/2+.8},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2+.8}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:swt(e).concat(i,t),parameters:e}},owt=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},swt=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=owt({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},awt=Re({fn:U(),num_pins:Fe().default(4),w:U().default("8.50mm"),h:U().default("6.90mm"),pl:U().default("2mm"),pw:U().default("1.5mm"),p:U().default("2.30mm"),string:U().optional()}),cwt=n=>{const e=n.string?.match(/^sot223_(\d+)/),t=e?Number.parseInt(e[1],10):4;if(t===8){const r=dwt.parse({...n,num_pins:t});return{circuitJson:hw(r),parameters:r}}const i=awt.parse({...n,num_pins:t});if(i.num_pins===4)return{circuitJson:uwt(i),parameters:i};if(i.num_pins===5)return{circuitJson:pwt(i),parameters:i};if(i.num_pins===6)return{circuitJson:mwt(i),parameters:i};throw new Error("Invalid number of pins")},lwt=n=>{const{pn:e,w:t,p:i}=n;return e===1?{x:-t/2+1.1,y:i}:e===2?{x:-t/2+1.1,y:0}:e===3?{x:-t/2+1.1,y:-i}:{x:t/2-1.1,y:0}},uwt=n=>{const e=[];for(let a=0;a<n.num_pins;a++){const{x:c,y:l}=lwt({num_pins:n.num_pins,pn:a+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl),p:Number.parseFloat(n.p)}),u=a===3?3.8:Number.parseFloat(n.pw);e.push(or(a+1,c,l,Number.parseFloat(n.pl),u))}const t=Zr(0,0,.3),i=Number.parseFloat(n.w)/2-2.4,r=Number.parseFloat(n.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:r},{x:i,y:r},{x:i,y:r/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-r},{x:i,y:-r},{x:i,y:-r/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,o,s,t]},dwt=$2({p:"0.90mm",w:"2.8mm",legsoutside:!0}),hwt=n=>{const{p:e,pn:t,w:i}=n;if(t===1)return{x:-i/2+1.2,y:e/2+e};if(t===2)return{x:-i/2+1.2,y:e/2};if(t===3)return{x:-i/2+1.2,y:-e/2};if(t===4)return{x:-i/2+1.2,y:-e/2-e};if(t===5)return{x:i/2-1,y:0};throw new Error("Invalid pin number")},pwt=n=>{const e=[];for(let a=1;a<=n.num_pins;a++){const{x:c,y:l}=hwt({h:Number.parseFloat(n.h),p:1.5,pn:a,w:Number.parseFloat(n.w)});let u=Number.parseFloat(n.pw),d=Number.parseFloat(n.pl);a===5?(u=3.4,d=1.8):(u=1,d=2.2),e.push(or(a,c,l,d,u))}const t=Number.parseFloat(n.w)/2-2.4,i=Number.parseFloat(n.h)/2,r={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-t,y:i},{x:t,y:i},{x:t,y:i/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-t,y:-i},{x:t,y:-i},{x:t,y:-i/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1},s=Zr(0,0,.3);return[...e,r,o,s]},fwt=n=>{const{p:e,pn:t,w:i}=n;if(t===1)return{x:-i/2+1.2,y:2*e};if(t===2)return{x:-i/2+1.2,y:e};if(t===3)return{x:-i/2+1.2,y:0};if(t===4)return{x:-i/2+1.2,y:-e};if(t===5)return{x:-i/2+1.2,y:-2*e};if(t===6)return{x:i/2-1.175,y:0};throw new Error("Invalid pin number")},mwt=n=>{const e=[];for(let a=1;a<=n.num_pins;a++){const{x:c,y:l}=fwt({h:Number.parseFloat(n.h),p:1.3,pn:a,w:8.7});let u=Number.parseFloat(n.pw),d=Number.parseFloat(n.pl);a===6?(u=3.4,d=2.15):(u=.6,d=2.2),e.push(or(a,c,l,d,u))}const t=Number.parseFloat(n.w)/2-2.4,i=Number.parseFloat(n.h)/2,r={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-t,y:i},{x:t,y:i},{x:t,y:i/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-t,y:-i},{x:t,y:-i},{x:t,y:-i/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1},s=Zr(0,0,.3);return[...e,r,o,s]},_wt=Re({fn:U(),num_pins:Fe().default(3),w:U().default("3.40mm"),h:U().default("3.30mm"),pl:U().default("1mm"),pw:U().default("0.7mm"),p:U().default("1.2mm"),string:U().optional()}),ywt=n=>{const e=n.string?.match(/^sot23w_(\d+)/),t=e?Number.parseInt(e[1],3):3,i=_wt.parse({...n,num_pins:t});if(i.num_pins===3)return{circuitJson:vwt(i),parameters:i};throw new Error("Invalid number of pins")},gwt=n=>{const{pn:e,p:t}=n;return e===1?{x:-t,y:.95}:e===2?{x:-t,y:-.95}:{x:t,y:0}},vwt=n=>{const e=[];for(let a=0;a<n.num_pins;a++){const{x:c,y:l}=gwt({num_pins:n.num_pins,pn:a+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl),p:Number.parseFloat(n.p)});e.push(or(a+1,c,l,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=Zr(0,Number.parseInt(n.h)/2+1,.3),i=Number.parseFloat(n.w)/2-1,r=Number.parseFloat(n.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:r},{x:i+.3,y:r},{x:i+.3,y:r/2}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-r},{x:i+.3,y:-r},{x:i+.3,y:-r/2}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,o,s,t]},xwt=Re({fn:U(),num_pins:Gn([we(3),we(2)]).default(3),p:U().default("1.27mm"),id:U().default("0.72mm"),od:U().default("0.95mm"),w:U().default("2.5mm"),h:U().default("4.2mm"),string:U().optional()}),bwt=n=>{const{p:e,id:t,od:i,w:r,h:o}=n,s=Number.parseFloat(o)/2,a=Number.parseFloat(e);return[Ps(1,-a,s-a,t,i),Ps(2,0,s-a,t,i),Ps(3,a,s-a,t,i)]},wwt=n=>{const{p:e,id:t,od:i,h:r}=n,o=Number.parseFloat(r)/2,s=Number.parseFloat(e);return[Ps(1,-s,o-s,t,i),Ps(2,s,o-s,t,i)]},Swt=n=>{const e=n.string?.match(/^to92s_(\d+)/),t=e?Number.parseInt(e[1],10):3,i=xwt.parse({...n,num_pins:t});let r=[];if(i.num_pins===3)r=bwt(i);else if(i.num_pins===2)r=wwt(i);else throw new Error("Invalid number of pins for TO-92");const o=Number.parseFloat(i.h)/2,s=Number.parseFloat(i.p),a={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-o,y:o-s},{x:-1.9,y:0},{x:1.9,y:0},{x:o,y:o-s},{x:1.5,y:Number.parseFloat(i.h)/2+.5},{x:-1.5,y:Number.parseFloat(i.h)/2+.5},{x:-o,y:o-s}],stroke_width:.1,pcb_silkscreen_path_id:""},c=Zr(0,o+1,.5);return{circuitJson:[...r,a,c],parameters:i}},Ewt=Re({fn:U(),p:et.optional(),id:et.optional(),pw:et.optional(),pl:et.optional(),w:et.optional(),h:et.optional(),sh:Gn([vt(),U(),Fe()]).optional().transform(n=>{if(typeof n=="string"){const e=Number(n);return Number.isNaN(e)?!0:e}return n}).describe('JST SH (Surface-mount) connector family. SH stands for "Super High-density".'),ph:vt().optional().describe('JST PH (Through-hole) connector family. PH stands for "Pin Header".'),string:U().optional()}),Twt={ph:{p:et.parse("2.2mm"),id:et.parse("0.70mm"),pw:et.parse("1.20mm"),pl:et.parse("1.20mm"),w:et.parse("6mm"),h:et.parse("5mm")},sh:{p:et.parse("1mm"),pw:et.parse("0.6mm"),pl:et.parse("1.55mm"),w:et.parse("5.8mm"),h:et.parse("7.8mm")}};function Mwt(n){return n.sh?"sh":(n.ph,"ph")}function Cwt(n,e,t,i,r,o){const s=[];if(n==="ph"){const a=t/2;s.push(DD(1,-a,2,i,r,o)),s.push(DD(2,a,2,i,r,o))}else{const a=-((e-1)/2)*t;for(let l=0;l<e;l++){const u=a+l*t;console.log("x si",u),s.push(or(l+1,u,-1.325,r,o))}const c=(e-1)/2*t+1.3;console.log("offset",c),s.push(or(e+1,-c,1.22,1.2,1.8)),s.push(or(e+2,c,1.22,1.2,1.8))}return s}function Awt(n,e,t){return n==="ph"?{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-3,y:3},{x:3,y:3},{x:3,y:-2},{x:-3,y:-2},{x:-3,y:3}],stroke_width:.1,pcb_silkscreen_path_id:""}:{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[],stroke_width:.1,pcb_silkscreen_path_id:""}}var Rwt=n=>{const e=Ewt.parse(n),t=Mwt(e),i=Twt[t],r=e.p??i.p,o=e.id??i.id,s=e.pw??i.pw,a=e.pl??i.pl,c=e.w??i.w,l=e.h??i.h;let u=t==="sh"?4:2;if(t==="sh"){const y=(typeof n.string=="string"?n.string:"").match(/sh(\d+)/);if(y&&y[1]){const g=parseInt(y[1],10);Number.isNaN(g)||(u=g)}else typeof e.sh=="number"&&(u=e.sh)}const d=Cwt(t,u,r,o,s,a),h=Awt(t),f=Zr(0,l/2+1,.5);return{circuitJson:[...d,h,f],parameters:{...e,p:r,id:o,pw:s,pl:a,w:c,h:l,num_pins:u,sh:t==="sh",ph:t==="ph"}}},Pwt=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.30mm"),h:U().default("1.70mm"),pl:U().default("0.80mm"),pw:U().default("1mm"),p:U().default("1.90mm")}),Iwt=n=>{const e=Pwt.parse(n),t=Zr(0,et.parse(e.h)/2+.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:kwt(e).concat(i,t),parameters:e}},Nwt=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},kwt=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Nwt({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Owt=n=>{switch(n){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"}}},Dwt=Re({fn:U(),num_pins:Gn([we(8),we(10)]).default(8),w:U().optional(),h:U().optional(),p:U().optional(),pl:U().optional(),pw:U().optional(),string:U().optional()}),Lwt=n=>{const e=Dwt.parse(n),t=Owt(e.num_pins),i=et.parse(e.w||t.w),r=et.parse(e.h||t.h),o=et.parse(e.p||t.p),s=et.parse(e.pl||t.pl),a=et.parse(e.pw||t.pw),c=[],l=e.num_pins/2;for(let x=0;x<e.num_pins;x++){const{x:w,y:T}=e8e(e.num_pins,x+1,i,o),N=x<l?x+1:e.num_pins-(x-l);c.push(or(N,w,T,s,a))}const u=i,d=r,h={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-u/2,y:d/2},{x:u/2,y:d/2}],stroke_width:.05,pcb_silkscreen_path_id:""},f={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-u/2,y:-d/2},{x:u/2,y:-d/2}],stroke_width:.05,pcb_silkscreen_path_id:""},m=e8e(e.num_pins,1,u,o),y={x:m.x-.8,y:m.y},g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:y.x-.4,y:y.y},{x:y.x-.7,y:y.y+.3},{x:y.x-.7,y:y.y-.3},{x:y.x-.4,y:y.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},b=Zr(0,d/2+.5,.3);return{circuitJson:[...c,h,f,b,g],parameters:e}},e8e=(n,e,t,i)=>{const r=n/2,o=(e-1)%r,s=e<=r?-1:1,a=(r-1)/2-o;return{x:s*et.parse(n===8?"1.8mm":"2.2mm"),y:a*i}},zwt=n=>{switch(n){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"}}},Fwt=Re({fn:U(),num_pins:Gn([we(8),we(10),we(12),we(16)]).default(8),w:U().optional(),h:U().optional(),p:U().optional(),pl:U().optional(),pw:U().optional(),string:U().optional()}),t8e=(n,e,t,i)=>{const r=n/2,o=(e-1)%r,s=e<=r?-1:1,a=(r-1)/2-o;return{x:s*et.parse("2mm"),y:a*i}},Bwt=n=>{const e=Fwt.parse(n),t=zwt(e.num_pins),i=et.parse(e.w||t.w),r=et.parse(e.h||t.h),o=et.parse(e.p||t.p),s=et.parse(e.pl||t.pl),a=et.parse(e.pw||t.pw),c=[];for(let b=0;b<e.num_pins;b++){const{x,y:w}=t8e(e.num_pins,b+1,i,o);c.push(or(b+1,x,w,s,a))}const l=i,u=r,d={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:""},f=t8e(e.num_pins,1,l,o),m={x:f.x-.8,y:f.y},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"},g=Zr(0,u/2+.5,.3);return{circuitJson:[...c,d,h,g,y],parameters:e}},Uwt=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.8mm"),h:U().default("1.65mm"),pl:U().default("1.2mm"),pw:U().default("1.2mm"),pad_spacing:U().default("2.6mm")}),$wt=n=>{const e=Uwt.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.pad_spacing)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:-et.parse(e.h)/2},{x:et.parse(e.pad_spacing)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Hwt(e).concat(i,t),parameters:e}},jwt=n=>{const{pn:e,pad_spacing:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Hwt=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=jwt({pn:t,pad_spacing:Number.parseFloat(n.pad_spacing)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Vwt=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.20mm"),h:U().default("1.65mm"),pl:U().default("0.8mm"),pw:U().default("0.9mm"),pad_spacing:U().default("2.1mm")}),qwt=n=>{const e=Vwt.parse(n),t=Zr(0,et.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.pad_spacing)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.2,y:-et.parse(e.h)/2},{x:et.parse(e.pad_spacing)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Ywt(e).concat(i,t),parameters:e}},Gwt=n=>{const{pn:e,pad_spacing:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Ywt=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Gwt({pn:t,pad_spacing:Number.parseFloat(n.pad_spacing)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Xwt=Re({fn:U(),num_pins:Gn([we(6),we(8)]).default(8),w:U().default("3mm"),h:U().default("3mm"),p:U().default("0.5mm"),pl:U().default("0.52mm"),pw:U().default("0.35mm"),epw:U().default("1.40mm"),eph:U().default("1.60mm"),string:U().optional(),ep:vt().default(!1)}),Wwt=n=>{n.string&&n.string.includes("_ep")&&(n.ep=!0);const e=n.string?.match(/^son_(\d+)/),t=e?Number.parseInt(e[1],10):n.num_pins||8,i=Xwt.parse({...n,num_pins:t}),r=et.parse(i.w),o=et.parse(i.h),s=et.parse(i.p),a=et.parse(i.pl),c=et.parse(i.pw),l=et.parse(i.epw),u=et.parse(i.eph),d=[];for(let T=0;T<i.num_pins;T++){const{x:N,y:R}=n8e(i.num_pins,T+1,r,s);d.push(or(T+1,N,R,a,c))}i.ep&&d.push(or(i.num_pins+1,0,0,l,u));const h=r,f=o,m={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-h/2,y:f/2},{x:h/2,y:f/2}],stroke_width:.05,pcb_silkscreen_path_id:""},y={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-h/2,y:-f/2},{x:h/2,y:-f/2}],stroke_width:.05,pcb_silkscreen_path_id:""},g=n8e(i.num_pins,1,h,s),b={x:g.x-.4,y:g.y},x={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:b.x-.4,y:b.y},{x:b.x-.7,y:b.y+.3},{x:b.x-.7,y:b.y-.3},{x:b.x-.4,y:b.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},w=Zr(0,f/2+.5,.3);return{circuitJson:[...d,m,y,w,x],parameters:i}},n8e=(n,e,t,i)=>{const r=n/2,o=(e-1)%r,s=e<=r?-1:1,a=(r-1)/2-o;return{x:s*et.parse("1.4mm"),y:a*i}},Zwt=n=>{const{num_pins:e,bridged:t,p:i=2.54,pw:r=1.5,ph:o=1.5}=n,s=et.parse(i),a=et.parse(r),c=et.parse(o),l=Math.min(c/4,.5),u=[];for(let T=0;T<e;T++)u.push(or(T+1,T*s,0,a,c));let d=[];if(t){const T=t.split("").map(Number);if(T.length>1)for(let N=0;N<T.length-1;N++){const R=T[N],k=T[N+1];if(typeof R=="number"&&typeof k=="number"&&!isNaN(R)&&!isNaN(k)){const M=(R-1)*s,I=(k-1)*s,C=Math.sign(I-M),$=M+C*(a/2),P=I-C*(a/2);d.push({type:"pcb_trace",pcb_trace_id:"",route:[{start_pcb_port_id:`{PIN${R}}`,x:$,y:0,width:l,layer:"top",route_type:"wire"},{end_pcb_port_id:`{PIN${k}}`,x:P,y:0,width:l,layer:"top",route_type:"wire"}]})}}}const h=(e-1)*s+a+.7,f=c+1,m=(e-1)*s/2,y=0,g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"outline",route:[{x:m-h/2,y:y-f/2},{x:m+h/2,y:y-f/2},{x:m+h/2,y:y+f/2},{x:m-h/2,y:y+f/2},{x:m-h/2,y:y-f/2}],stroke_width:.15},x=y+f/2+.6,w=Zr(m,x,.4);return{circuitJson:[...u,...d,g,w],parameters:n}},i8e=(n,e,t,i,r)=>({type:"pcb_smtpad",x:e,y:t,width:i,height:r,radius:r/2,layer:"top",shape:"pill",pcb_smtpad_id:"",port_hints:Array.isArray(n)?n.map(o=>o.toString()):[n.toString()]}),r8e={fn:we("sot457"),num_pins:we(6).default(6),pillh:U().default("0.45mm"),pillw:U().default("1.45mm"),pl:U(),pw:U(),p:U(),wave:vt().optional(),reflow:vt().optional()},Kwt=Re({...r8e,h:U().default("2.5mm"),w:U().default("2.7mm"),pl:U().default("0.8mm"),pw:U().default("0.55mm"),p:U().default("0.95mm")}),Qwt=Re({...r8e,h:U().default("3mm"),w:U().default("4mm"),pillr:U().default("0.225mm"),pl:U().default("1.45mm"),pw:U().default("1.5mm"),p:U().default("1.475mm")}).transform(n=>({...n,wave:n.wave??(n.reflow===void 0?!0:!n.reflow),reflow:n.reflow??(n.wave===void 0?!1:!n.wave)})),pw=n=>Number.parseFloat(n.replace("mm","")),o8e=({pitch:n,width:e,pinNumber:t})=>{const o={1:{x:-e/2-.1,y:n},2:{x:-e/2-.1,y:0},3:{x:-e/2-.1,y:-n},4:{x:e/2+.1,y:-n},5:{x:e/2+.1,y:0},6:{x:e/2+.1,y:n}}[t];if(!o)throw new Error(`Invalid pin number: ${t}`);return o},s8e=n=>{const e=[],t=pw(n.p),i=pw(n.pl),r=pw(n.pw),o=pw(n.w),s=pw(n.h);if(n.wave){const m={1:({padWidth:y,padHeight:g})=>or(1,-t,t,g,y),2:({padWidth:y,padHeight:g})=>or(2,-t,-t,g,y),3:({padWidth:y,padHeight:g})=>i8e(3,-t,0,pw(n.pillw),pw(n.pillh)),4:({padWidth:y,padHeight:g})=>i8e(4,t,0,pw(n.pillw),pw(n.pillh)),5:({padWidth:y,padHeight:g})=>or(5,t,t,g,y),6:({padWidth:y,padHeight:g})=>or(6,t,-t,g,y)};for(let y=1;y<=n.num_pins;y++){const g=m[y];g&&e.push(g({padWidth:i,padHeight:r}))}}else for(let m=1;m<=n.num_pins;m++){const{x:y,y:g}=o8e({pitch:t,width:o,pinNumber:m});e.push(or(m,y,g,i,r))}const a={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-o/3,y:s/2+t/1.3},{x:o/3,y:s/2+t/1.3}],stroke_width:.05},c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-o/3,y:-s/2-t/1.3},{x:o/3,y:-s/2-t/1.3}],stroke_width:.05},l=Zr(0,s+.5,.3),u=o8e({pitch:t,width:o,pinNumber:1}),d=n.wave?1:.5,h=n.wave?.7:.3;u.x-=n.wave?r:r*1.7;const f={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:u.x+d/2,y:u.y},{x:u.x-d/2,y:u.y+h/2},{x:u.x-d/2,y:u.y-h/2},{x:u.x+d/2,y:u.y}],stroke_width:.05};return[l,a,c,f,...e]},Jwt=n=>{if(n.wave){const t=Qwt.parse({...n,fn:"sot457"});return{circuitJson:s8e(t),parameters:t}}const e=Kwt.parse(n);return{circuitJson:s8e(e),parameters:e}},eSt=Re({fn:U(),num_pins:Gn([we(3),we(2)]).default(3),p:U().default("3.8mm"),id:U().default("1.25mm"),od:U().default("2.35mm"),ca:U().default("14mm").describe("Caliper axis (width or diameter of the potentiometer body or adjustment knob)"),w:U().default("5.35mm"),h:U().default("4mm"),string:U().optional()}),tSt=n=>{const{p:e,id:t,od:i,h:r,ca:o}=n,s=Number.parseFloat(r),a=Number.parseFloat(o);return[Ps(1,0,a/4+.3,t,i),Ps(2,s,0,t,i),Ps(3,0,-a/4-.3,t,i)]},nSt=n=>{const e=n.string?.match(/^potentiometer_(\d+)/),t=e?Number.parseInt(e[1],10):3,i=eSt.parse({...n,num_pins:t});let r=[];i.num_pins===3&&(r=tSt(i));const o=Number.parseFloat(i.ca)/2+.15,s=Number.parseFloat(i.w),a=Number.parseFloat(i.od)/2+.35,c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:0,y:o-1.75},{x:0,y:o},{x:s,y:o},{x:s,y:a}],stroke_width:.1,pcb_silkscreen_path_id:""},l={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:s,y:-a},{x:s,y:-o},{x:0,y:-o},{x:0,y:-o+1.75}],stroke_width:.1,pcb_silkscreen_path_id:""},u=Number.parseFloat(i.w)/2,d=Zr(u,o+1,.5);return{circuitJson:[...r,c,l,d],parameters:i}},iSt=Re({fn:U(),p:et.optional().default("7.5mm"),id:et.optional().default("1mm"),od:et.optional().default("2mm"),d:et.optional().default("10.5mm")}),rSt=(n,e,t,i,r)=>{const o=[],s=[];for(let a=0;a<=50;a++){const c=a/50*Math.PI,l=n+Math.cos(c)*t,u=e+Math.sin(c)*t;l<n-i&&u>=e-r/2&&u<=e+r/2||o.push({x:l,y:u})}for(let a=0;a<=50;a++){const c=Math.PI+a/50*Math.PI,l=n+Math.cos(c)*t,u=e+Math.sin(c)*t;l<n-i&&u>=e-r/2&&u<=e+r/2||s.push({x:l,y:u})}return{topArc:o,bottomArc:s}},oSt=n=>{const e=iSt.parse(n),{p:t,id:i,od:r,d:o}=e,s=[Ps(1,-t/2,0,i,r),Ps(2,t/2,0,i,r)],{topArc:a,bottomArc:c}=rSt(0,0,o/2+.1,r/2,r),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:c,stroke_width:.1,pcb_silkscreen_path_id:""},d={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:0,y:o/2+.1},{x:0,y:-(o/2+.1)}],stroke_width:.1,pcb_silkscreen_path_id:""},h=-(o/2+.5),f=r/2+1.5,m=.5,y={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:h-m,y:f},{x:h+m,y:f}],stroke_width:.1,pcb_silkscreen_path_id:""},g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:h,y:f-m},{x:h,y:f+m}],stroke_width:.1,pcb_silkscreen_path_id:""},b=Zr(0,o/2+1,.5);return{circuitJson:[...s,l,u,d,y,g,b],parameters:e}},sSt=Re({fn:U(),num_pins:we(2).default(2),w:U().default("6.5mm"),h:U().default("3mm"),pl:U().default("1.75mm"),pw:U().default("2.40mm"),p:U().default("4.75mm")}),aSt=n=>{const e=sSt.parse(n),t=Zr(0,et.parse(e.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:et.parse(e.p)/2,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.3,y:et.parse(e.h)/2},{x:-et.parse(e.w)/2-.3,y:-et.parse(e.h)/2},{x:et.parse(e.p)/2,y:-et.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:lSt(e).concat(i,t),parameters:e}},cSt=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},lSt=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=cSt({pn:t,p:Number.parseFloat(n.p)});e.push(or(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},uSt=Re({fn:U(),num_pins:Fe().default(3),w:U().default("2.45mm"),h:U().default("2.40mm"),pl:U().default("0.45mm"),pw:U().default("0.70mm"),p:U().default("1mm"),string:U().optional()}),dSt=n=>{const e=n.string?.match(/^sot323_(\d+)/),t=e?Number.parseInt(e[1],3):3,i=uSt.parse({...n,num_pins:t});if(i.num_pins===3)return{circuitJson:pSt(i),parameters:i};throw new Error("Invalid number of pins")},hSt=n=>{const{pn:e,p:t}=n;return e===1?{x:-t,y:.65}:e===2?{x:-t,y:-.65}:{x:t,y:0}},pSt=n=>{const e=[];for(let a=0;a<n.num_pins;a++){const{x:c,y:l}=hSt({num_pins:n.num_pins,pn:a+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl),p:Number.parseFloat(n.p)});e.push(or(a+1,c,l,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=Zr(0,Number.parseInt(n.h)/2+1,.3),i=Number.parseFloat(n.w)/2-Number.parseFloat(n.pl),r=Number.parseFloat(n.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:r+.3},{x:i,y:r+.3},{x:i,y:r/2}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-r-.3},{x:i,y:-r-.3},{x:i,y:-r/2}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,o,s,t]},fSt=Re({fn:U(),circle:vt().optional(),rect:vt().optional(),square:vt().optional(),d:et.optional(),pd:et.optional(),diameter:et.optional(),r:et.optional(),pr:et.optional(),radius:et.optional(),w:et.optional(),pw:et.optional(),width:et.optional(),h:et.optional(),ph:et.optional(),height:et.optional(),s:et.optional(),size:et.optional(),string:U().optional()}).transform(n=>{let e="rect";n.circle&&(e="circle"),n.square&&(e="square"),n.rect&&(e="rect");let t,i,r;return e==="circle"?n.r!==void 0?t=Yu(n.r):n.pr!==void 0?t=Yu(n.pr):n.radius!==void 0?t=Yu(n.radius):n.d!==void 0?t=Yu(n.d)/2:n.pd!==void 0?t=Yu(n.pd)/2:n.diameter!==void 0?t=Yu(n.diameter)/2:t=Yu("1mm")/2:(n.w!==void 0?i=Yu(n.w):n.pw!==void 0?i=Yu(n.pw):n.width!==void 0?i=Yu(n.width):n.s!==void 0?i=Yu(n.s):n.size!==void 0?i=Yu(n.size):i=Yu("1mm"),n.h!==void 0?r=Yu(n.h):n.ph!==void 0?r=Yu(n.ph):n.height!==void 0?r=Yu(n.height):r=i),{fn:n.fn,shape:e,radius:t,width:i,height:r}}),mSt=n=>{const e=fSt.parse(n),{shape:t,radius:i,width:r,height:o}=e;return{circuitJson:[t==="circle"?jTe(1,{x:0,y:0,radius:i}):or(1,0,0,r,o),Zr(0,t==="circle"?i+.5:o/2+.5,.2)],parameters:e}},_St=Re({fn:U(),d:et.optional(),hd:et.optional(),r:et.optional(),hr:et.optional(),pd:et.optional(),pr:et.optional(),squarepad:vt().optional().default(!1)}).transform(n=>{let e;n.d!==void 0?e=Yu(n.d):n.hd!==void 0?e=Yu(n.hd):n.r!==void 0?e=Yu(n.r)*2:n.hr!==void 0?e=Yu(n.hr)*2:e=Yu("1mm");let t;return n.pd!==void 0?t=Yu(n.pd):n.pr!==void 0?t=Yu(n.pr)*2:t=e*(1.5/1),{fn:n.fn,d:e,pd:t,squarepad:n.squarepad??!1}}),ySt=n=>{const e=_St.parse(n),{d:t,pd:i,squarepad:r}=e;return{circuitJson:[r?DD(1,0,0,t,i,i):Ps(1,0,0,t,i),Zr(0,i/2+.5,.2)],parameters:e}},gSt=Re({fn:U(),num_pins:we(6).default(6),h:U().default("1.6mm"),pl:U().default("1mm"),pw:U().default("0.7mm"),p:U().default("0.95mm")}),vSt=n=>{const e=gSt.parse(n);return{circuitJson:xSt(e),parameters:e}},a8e=n=>{const{p:e,h:t,pn:i}=n;if(i===1)return{x:-t/2-.5,y:e};if(i===2)return{x:-t/2-.5,y:0};if(i===3)return{x:-t/2-.5,y:-e};if(i===4)return{x:t/2+.5,y:-e};if(i===5)return{x:t/2+.5,y:0};if(i===6)return{x:t/2+.5,y:e};throw new Error("Invalid pin number")},xSt=n=>{const e=[];for(let d=1;d<=n.num_pins;d++){const{x:h,y:f}=a8e({h:Number.parseFloat(n.h),p:Number.parseFloat(n.p),pn:d});e.push(or(d,h,f,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=n.num_pins/2*Number.parseFloat(n.p),i=Number.parseFloat(n.h),r={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-t/3,y:i/2+Number.parseFloat(n.p)/1.3},{x:t/3,y:i/2+Number.parseFloat(n.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-t/3,y:-i/2-Number.parseFloat(n.p)/1.3},{x:t/3,y:-i/2-Number.parseFloat(n.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},s=Zr(0,i+.3,.3),a=a8e({h:Number.parseFloat(n.h),p:Number.parseFloat(n.p),pn:1});a.x=a.x-Number.parseFloat(n.pw)*1.5;const c=.7,l=.3,u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:a.x+c/2,y:a.y},{x:a.x-c/2,y:a.y+l/2},{x:a.x-c/2,y:a.y-l/2},{x:a.x+c/2,y:a.y}],stroke_width:.05};return[...e,s,r,o,u]},bSt=Re({fn:U()}),wSt=n=>{const e=bSt.parse(n),t=[],i=.5-.15,r=1.5,s=.5/2,a=75,c=-37/2;for(let k=0;k<a;k++){const M=k+1;if(M>=24&&M<=31)continue;const I=c-k*s,C=M%2===0,$=r+(C?.25:0),H=.5-$/2,G=or(M,H,I,$,i);G.layer=C?"bottom":"top",t.push(G)}const l=46*.0254,u=137*.0254,d=261*.0254,h={type:"pcb_cutout",pcb_cutout_id:"",shape:"rect",center:{x:-u/2+r/2,y:c-d},width:u,height:l},f={x:-.5,y:c},m={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"};let y=1/0,g=-1/0,b=1/0,x=-1/0;const w=(k,M,I=0,C=0)=>{y=Math.min(y,k-I/2),g=Math.max(g,k+I/2),b=Math.min(b,M-C/2),x=Math.max(x,M+C/2)};for(const k of t)w(k.x,k.y,k.width,k.height);w(h.center.x,h.center.y,h.width,h.height);for(const k of m.route)w(k.x,k.y);const T=(y+g)/2,N=(b+x)/2,R=k=>{typeof k.x=="number"&&(k.x-=T),typeof k.y=="number"&&(k.y-=N),k.center&&(k.center.x-=T,k.center.y-=N),Array.isArray(k.route)&&(k.route=k.route.map(M=>({x:M.x-T,y:M.y-N})))};for(const k of t)R(k);return R(h),R(m),{circuitJson:[...t,h,m],parameters:e}};function SSt(n){return n!=null}var ESt=(n,e)=>{if(!e)return n;const t=n.filter(u=>u.type==="pcb_smtpad"||u.type==="pcb_plated_hole"||u.type==="pcb_thtpad");if(t.length===0)return n;let i=1/0,r=-1/0,o=1/0,s=-1/0;const a=(u,d,h=0,f=0)=>{const m=u-h/2,y=u+h/2,g=d-f/2,b=d+f/2;i=Math.min(i,m),r=Math.max(r,y),o=Math.min(o,g),s=Math.max(s,b)};for(const u of t)if(u.type==="pcb_smtpad"){const d=u.shape==="circle"?u.radius*2:u.width,h=u.shape==="circle"?u.radius*2:u.height;a(u.x,u.y,d,h)}else if(u.type==="pcb_plated_hole"){const d=u.outer_diameter??u.hole_diameter;a(u.x,u.y,d,d)}else if(u.type==="pcb_thtpad"){const d=u.diameter;a(u.x,u.y,d,d)}let c=0,l=0;switch(e){case"center":c=(i+r)/2,l=(o+s)/2;break;case"bottomleft":c=i,l=o;break;case"bottomcenter":case"centerbottom":c=(i+r)/2,l=o;break;case"topcenter":case"centertop":c=(i+r)/2,l=s;break;case"leftcenter":case"centerleft":c=i,l=(o+s)/2;break;case"rightcenter":case"centerright":c=r,l=(o+s)/2;break;case"pin1":const u=t.find(d=>d.port_hints?.[0]==="1")||t[0];c=u.x,l=u.y;break}if(c===0&&l===0)return n;for(const u of n){if(typeof u.x=="number"&&(u.x-=c),typeof u.y=="number"&&(u.y-=l),u.center&&typeof u.center.x=="number"&&(u.center.x-=c,u.center.y-=l),u.type==="pcb_silkscreen_path")for(const d of u.route)d.x-=c,d.y-=l;u.type==="pcb_silkscreen_text"&&u.anchor_position&&(u.anchor_position.x-=c,u.anchor_position.y-=l)}return n},TSt=n=>{let e=BD();const i=n.replace(/^((?:\d{4}|\d{5}))(?=$|_)/,"res$1").split(/_(?!metric)/).map(r=>{const o=r.match(/([a-z]+)([\(\d\.\+\?].*)?/);if(!o)return null;const[,s,a]=o;return!s||a?.includes("?")?null:{fn:s,v:a}}).filter(SSt);for(const{fn:r,v:o}of i)e=e[r](o);return e.setString(n),e},MSt=()=>Object.keys(dw),BD=()=>{const n=new Proxy({},{get:(e,t)=>{if(t==="soup"||t==="circuitJson"){if("fn"in e&&dw[e.fn])return()=>{const{circuitJson:i}=dw[e.fn](e);return ESt(i,e.origin)};if(!dw[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 "${t}"`)}}if(t==="json"){if(!dw[e.fn])throw new Error(`Invalid footprint function, got "${e.fn}"${e.string?`, from string "${e.string}"`:""}`);return()=>dw[e.fn](e).parameters}return t==="getFootprintNames"?()=>Object.keys(dw):t==="params"?()=>e:t==="setString"?i=>(e.string=i,n):i=>(Object.keys(e).length===0?`${t}${i}`in dw?(e[`${t}${i}`]=!0,e.fn=`${t}${i}`):(e[t]=!0,e.fn=t,t==="res"||t==="cap"?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(t)||(e[t]=i??!0),n)}});return n};BD.string=TSt,BD.getFootprintNames=MSt;var c8e=BD,UD={exports:{}},UK,l8e;function CSt(){if(l8e)return UK;l8e=1;var n=1e3,e=n*60,t=e*60,i=t*24,r=i*7,o=i*365.25;UK=function(u,d){d=d||{};var h=typeof u;if(h==="string"&&u.length>0)return s(u);if(h==="number"&&isFinite(u))return d.long?c(u):a(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function s(u){if(u=String(u),!(u.length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(d){var h=parseFloat(d[1]),f=(d[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return h*o;case"weeks":case"week":case"w":return h*r;case"days":case"day":case"d":return h*i;case"hours":case"hour":case"hrs":case"hr":case"h":return h*t;case"minutes":case"minute":case"mins":case"min":case"m":return h*e;case"seconds":case"second":case"secs":case"sec":case"s":return h*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}}}function a(u){var d=Math.abs(u);return d>=i?Math.round(u/i)+"d":d>=t?Math.round(u/t)+"h":d>=e?Math.round(u/e)+"m":d>=n?Math.round(u/n)+"s":u+"ms"}function c(u){var d=Math.abs(u);return d>=i?l(u,d,i,"day"):d>=t?l(u,d,t,"hour"):d>=e?l(u,d,e,"minute"):d>=n?l(u,d,n,"second"):u+" ms"}function l(u,d,h,f){var m=d>=h*1.5;return Math.round(u/h)+" "+f+(m?"s":"")}return UK}var $K,u8e;function ASt(){if(u8e)return $K;u8e=1;function n(e){i.debug=i,i.default=i,i.coerce=l,i.disable=a,i.enable=o,i.enabled=c,i.humanize=CSt(),i.destroy=u,Object.keys(e).forEach(d=>{i[d]=e[d]}),i.names=[],i.skips=[],i.formatters={};function t(d){let h=0;for(let f=0;f<d.length;f++)h=(h<<5)-h+d.charCodeAt(f),h|=0;return i.colors[Math.abs(h)%i.colors.length]}i.selectColor=t;function i(d){let h,f=null,m,y;function g(...b){if(!g.enabled)return;const x=g,w=Number(new Date),T=w-(h||w);x.diff=T,x.prev=h,x.curr=w,h=w,b[0]=i.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let N=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(k,M)=>{if(k==="%%")return"%";N++;const I=i.formatters[M];if(typeof I=="function"){const C=b[N];k=I.call(x,C),b.splice(N,1),N--}return k}),i.formatArgs.call(x,b),(x.log||i.log).apply(x,b)}return g.namespace=d,g.useColors=i.useColors(),g.color=i.selectColor(d),g.extend=r,g.destroy=i.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(m!==i.namespaces&&(m=i.namespaces,y=i.enabled(d)),y),set:b=>{f=b}}),typeof i.init=="function"&&i.init(g),g}function r(d,h){const f=i(this.namespace+(typeof h>"u"?":":h)+d);return f.log=this.log,f}function o(d){i.save(d),i.namespaces=d,i.names=[],i.skips=[];const h=(typeof d=="string"?d:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const f of h)f[0]==="-"?i.skips.push(f.slice(1)):i.names.push(f)}function s(d,h){let f=0,m=0,y=-1,g=0;for(;f<d.length;)if(m<h.length&&(h[m]===d[f]||h[m]==="*"))h[m]==="*"?(y=m,g=f,m++):(f++,m++);else if(y!==-1)m=y+1,g++,f=g;else return!1;for(;m<h.length&&h[m]==="*";)m++;return m===h.length}function a(){const d=[...i.names,...i.skips.map(h=>"-"+h)].join(",");return i.enable(""),d}function c(d){for(const h of i.skips)if(s(d,h))return!1;for(const h of i.names)if(s(d,h))return!0;return!1}function l(d){return d instanceof Error?d.stack||d.message:d}function u(){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 i.enable(i.load()),i}return $K=n,$K}var d8e;function RSt(){return d8e||(d8e=1,(function(n,e){var t={env:{},version:""};e.formatArgs=r,e.save=o,e.load=s,e.useColors=i,e.storage=a(),e.destroy=(()=>{let l=!1;return()=>{l||(l=!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`."))}})(),e.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 i(){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 l;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&&(l=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(l[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+n.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;l.splice(1,0,u,"color: inherit");let d=0,h=0;l[0].replace(/%[a-zA-Z%]/g,f=>{f!=="%%"&&(d++,f==="%c"&&(h=d))}),l.splice(h,0,u)}e.log=console.debug||console.log||(()=>{});function o(l){try{l?e.storage.setItem("debug",l):e.storage.removeItem("debug")}catch{}}function s(){let l;try{l=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch{}return!l&&typeof t<"u"&&"env"in t&&(l=t.env.DEBUG),l}function a(){try{return localStorage}catch{}}n.exports=ASt()(e);const{formatters:c}=n.exports;c.j=function(l){try{return JSON.stringify(l)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(UD,UD.exports)),UD.exports}var PSt=RSt();const dm=j9(PSt);var $D={exports:{}},jK={exports:{}},h8e;function ISt(){return h8e||(h8e=1,(function(n){var e={env:{},version:""};/**
4369
4369
  * @license React
4370
4370
  * react-reconciler.production.js
4371
4371
  *
@@ -5068,7 +5068,7 @@ ${c.join(`
5068
5068
  ${y}polygon: ${m.polygon.vertices}
5069
5069
  `:c+=`
5070
5070
  `,m.children.length>0&&u.push(m.children)}return c}};e.exports=s}}),eJt=it({"node_modules/@jscad/modeling/src/operations/booleans/trees/Tree.js"(n,e){var t=ZQt(),i=JQt(),r=class{constructor(o){this.polygonTree=new i,this.rootnode=new t(null),o&&this.addPolygons(o)}invert(){this.polygonTree.invert(),this.rootnode.invert()}clipTo(o,s=!1){this.rootnode.clipTo(o,s)}allPolygons(){const o=[];return this.polygonTree.getPolygons(o),o}addPolygons(o){const s=new Array(o.length);for(let a=0;a<o.length;a++)s[a]=this.polygonTree.addChild(o[a]);this.rootnode.addPolygonTreeNodes(s)}clear(){this.polygonTree.clear()}toString(){return"Tree: "+this.polygonTree.toString("")}};e.exports=r}}),qhe=it({"node_modules/@jscad/modeling/src/operations/booleans/trees/index.js"(n,e){e.exports={Tree:eJt()}}}),tJt=it({"node_modules/@jscad/modeling/src/operations/booleans/intersectGeom3Sub.js"(n,e){var t=Qs(),i=Vhe(),{Tree:r}=qhe(),o=(s,a)=>{if(!i(s,a))return t.create();const c=new r(t.toPolygons(s)),l=new r(t.toPolygons(a));c.invert(),l.clipTo(c),l.invert(),c.clipTo(l),l.clipTo(c),c.addPolygons(l.allPolygons()),c.invert();const u=c.allPolygons();return t.create(u)};e.exports=o}}),eHe=it({"node_modules/@jscad/modeling/src/operations/booleans/intersectGeom3.js"(n,e){var t=ks(),i=lP(),r=tJt(),o=(...s)=>{s=t(s);let a=s.shift();return s.forEach(c=>{a=r(a,c)}),a=i(a),a};e.exports=o}}),nJt=it({"node_modules/@jscad/modeling/src/operations/booleans/intersectGeom2.js"(n,e){var t=ks(),i=Qs(),r=d4(),o=jhe(),s=Hhe(),a=eHe(),c=(...l)=>{l=t(l);const u=l.map(f=>s({z0:-1,z1:1},f)),d=a(u),h=r(d);return o(h,i.toPolygons(d))};e.exports=c}}),iJt=it({"node_modules/@jscad/modeling/src/operations/booleans/intersect.js"(n,e){var t=ks(),i=cP(),r=Ks(),o=Qs(),s=nJt(),a=eHe(),c=(...l)=>{if(l=t(l),l.length===0)throw new Error("wrong number of arguments");if(!i(l))throw new Error("only intersect of the types are supported");const u=l[0];return r.isA(u)?s(l):o.isA(u)?a(l):u};e.exports=c}}),rJt=it({"node_modules/@jscad/modeling/src/operations/booleans/scissionGeom3.js"(n,e){var t=oo(),i=d4(),r=Qs(),o=l=>l.sort((u,d)=>u-d).filter((u,d,h)=>!d||u!==h[d-1]),s=(l,u,d)=>{const h=`${u}`,f=l.get(h);f===void 0?l.set(h,[d]):f.push(d)},a=(l,u)=>{const d=`${u}`;return l.get(d)},c=l=>{const u=i(l),d=r.toPolygons(l),h=d.length,f=new Map,m=t.create();d.forEach((w,T)=>{w.vertices.forEach(N=>{s(f,t.snap(m,N,u),T)})});const y=d.map(w=>{let T=[];return w.vertices.forEach(N=>{T=T.concat(a(f,t.snap(m,N,u)))}),{e:1,d:o(T)}});f.clear();let g=0;const b=y.length;for(let w=0;w<b;w++){const T=y[w];if(T.e>0){const N=new Array(h);N[w]=!0;do g=0,N.forEach((R,k)=>{const M=y[k];if(M.e>0){M.e=-1;for(let I=0;I<M.d.length;I++)N[M.d[I]]=!0;g++}});while(g>0);T.indexes=N}}const x=[];for(let w=0;w<b;w++)if(y[w].indexes){const T=[];y[w].indexes.forEach((N,R)=>T.push(d[R])),x.push(r.create(T))}return x};e.exports=c}}),oJt=it({"node_modules/@jscad/modeling/src/operations/booleans/scission.js"(n,e){var t=ks(),i=Qs(),r=rJt(),o=(...s)=>{if(s=t(s),s.length===0)throw new Error("wrong number of arguments");const a=s.map(c=>i.isA(c)?r(c):c);return a.length===1?a[0]:a};e.exports=o}}),sJt=it({"node_modules/@jscad/modeling/src/operations/booleans/subtractGeom3Sub.js"(n,e){var t=Qs(),i=Vhe(),{Tree:r}=qhe(),o=(s,a)=>{if(!i(s,a))return t.clone(s);const c=new r(t.toPolygons(s)),l=new r(t.toPolygons(a));c.invert(),c.clipTo(l),l.clipTo(c,!0),c.addPolygons(l.allPolygons()),c.invert();const u=c.allPolygons();return t.create(u)};e.exports=o}}),tHe=it({"node_modules/@jscad/modeling/src/operations/booleans/subtractGeom3.js"(n,e){var t=ks(),i=lP(),r=sJt(),o=(...s)=>{s=t(s);let a=s.shift();return s.forEach(c=>{a=r(a,c)}),a=i(a),a};e.exports=o}}),aJt=it({"node_modules/@jscad/modeling/src/operations/booleans/subtractGeom2.js"(n,e){var t=ks(),i=Qs(),r=d4(),o=jhe(),s=Hhe(),a=tHe(),c=(...l)=>{l=t(l);const u=l.map(f=>s({z0:-1,z1:1},f)),d=a(u),h=r(d);return o(h,i.toPolygons(d))};e.exports=c}}),cJt=it({"node_modules/@jscad/modeling/src/operations/booleans/subtract.js"(n,e){var t=ks(),i=cP(),r=Ks(),o=Qs(),s=aJt(),a=tHe(),c=(...l)=>{if(l=t(l),l.length===0)throw new Error("wrong number of arguments");if(!i(l))throw new Error("only subtract of the types are supported");const u=l[0];return r.isA(u)?s(l):o.isA(u)?a(l):u};e.exports=c}}),nHe=it({"node_modules/@jscad/modeling/src/operations/booleans/unionGeom3Sub.js"(n,e){var t=Qs(),i=Vhe(),{Tree:r}=qhe(),o=(a,c)=>{if(!i(a,c))return s(a,c);const l=new r(t.toPolygons(a)),u=new r(t.toPolygons(c));l.clipTo(u,!1),u.clipTo(l),u.invert(),u.clipTo(l),u.invert();const d=l.allPolygons().concat(u.allPolygons());return t.create(d)},s=(a,c)=>{let l=t.toPolygons(a);return l=l.concat(t.toPolygons(c)),t.create(l)};e.exports=o}}),iHe=it({"node_modules/@jscad/modeling/src/operations/booleans/unionGeom3.js"(n,e){var t=ks(),i=lP(),r=nHe(),o=(...s)=>{s=t(s);let a;for(a=1;a<s.length;a+=2)s.push(r(s[a-1],s[a]));let c=s[a-1];return c=i(c),c};e.exports=o}}),rHe=it({"node_modules/@jscad/modeling/src/operations/booleans/unionGeom2.js"(n,e){var t=ks(),i=Qs(),r=d4(),o=jhe(),s=Hhe(),a=iHe(),c=(...l)=>{l=t(l);const u=l.map(f=>s({z0:-1,z1:1},f)),d=a(u),h=r(d);return o(h,i.toPolygons(d))};e.exports=c}}),Ghe=it({"node_modules/@jscad/modeling/src/operations/booleans/union.js"(n,e){var t=ks(),i=cP(),r=Ks(),o=Qs(),s=rHe(),a=iHe(),c=(...l)=>{if(l=t(l),l.length===0)throw new Error("wrong number of arguments");if(!i(l))throw new Error("only unions of the same type are supported");const u=l[0];return r.isA(u)?s(l):o.isA(u)?a(l):u};e.exports=c}}),Yhe=it({"node_modules/@jscad/modeling/src/operations/booleans/index.js"(n,e){e.exports={intersect:iJt(),scission:oJt(),subtract:cJt(),union:Ghe()}}}),yU=it({"node_modules/@jscad/modeling/src/operations/expansions/offsetFromPoints.js"(n,e){var{EPS:t,TAU:i}=$c(),r=kje(),o=Lhe(),s=xa(),a=fU(),c=(l,u)=>{const d={delta:1,corners:"edge",closed:!1,segments:16};let{delta:h,corners:f,closed:m,segments:y}=Object.assign({},d,l);if(Math.abs(h)<t)return u;let g=l.closed?a(u):1;g===0&&(g=1);const b=g>0&&h>=0||g<0&&h<0;h=Math.abs(h);let x=null,w=[];const T=[],N=s.create(),R=u.length;for(let k=0;k<R;k++){const M=(k+1)%R,I=u[k],C=u[M];b?s.subtract(N,I,C):s.subtract(N,C,I),s.normal(N,N),s.normalize(N,N),s.scale(N,N,h);const $=s.add(s.create(),I,N),P=s.add(s.create(),C,N),H=[$,P];if(x!=null&&(m||!m&&M!==0)){const G=r(x[0],x[1],H[0],H[1]);G?(w.pop(),H[0]=G):T.push({c:I,s0:x,s1:H})}x=[$,P],!(M===0&&!m)&&(w.push(H[0]),w.push(H[1]))}if(m&&x!=null){const k=w[0],M=w[1],I=r(x[0],x[1],k,M);if(I)w[0]=I,w.pop();else{const C=u[0],$=[k,M];T.push({c:C,s0:x,s1:$})}}if(f==="edge"){const k=new Map;w.forEach((C,$)=>k.set(C,$));const M=o.create(),I=o.create();T.forEach(C=>{o.fromPoints(M,C.s0[0],C.s0[1]),o.fromPoints(I,C.s1[0],C.s1[1]);const $=o.intersectPointOfLines(M,I);if(Number.isFinite($[0])&&Number.isFinite($[1])){const P=C.s0[1],H=k.get(P);w[H]=$,w[(H+1)%w.length]=void 0}else{const P=C.s1[0],H=k.get(P);w[H]=void 0}}),w=w.filter(C=>C!==void 0)}if(f==="round"){let k=Math.floor(y/4);const M=s.create();T.forEach(I=>{let C=s.angle(s.subtract(M,I.s1[0],I.c));if(C-=s.angle(s.subtract(M,I.s0[1],I.c)),b&&C<0&&(C=C+Math.PI,C<0&&(C=C+Math.PI)),!b&&C>0&&(C=C-Math.PI,C>0&&(C=C-Math.PI)),C!==0){k=Math.floor(y*(Math.abs(C)/i));const $=C/k,P=s.angle(s.subtract(M,I.s0[1],I.c)),H=[];for(let G=1;G<k;G++){const X=P+$*G,W=s.fromAngleRadians(s.create(),X);s.scale(W,W,h),s.add(W,W,I.c),H.push(W)}if(H.length>0){const G=I.s0[1];let X=w.findIndex(W=>s.equals(G,W));X=(X+1)%w.length,w.splice(X,0,...H)}}else{const $=I.s1[0],P=w.findIndex(H=>s.equals($,H));w.splice(P,1)}})}return w};e.exports=c}}),lJt=it({"node_modules/@jscad/modeling/src/operations/expansions/expandGeom2.js"(n,e){var t=Ks(),i=yU(),r=(o,s)=>{const a={delta:1,corners:"edge",segments:16},{delta:c,corners:l,segments:u}=Object.assign({},a,o);if(!(l==="edge"||l==="chamfer"||l==="round"))throw new Error('corners must be "edge", "chamfer", or "round"');const f=t.toOutlines(s).map(m=>(o={delta:c,corners:l,closed:!0,segments:u},i(o,m))).reduce((m,y)=>m.concat(t.toSides(t.fromPoints(y))),[]);return t.create(f)};e.exports=r}}),uJt=it({"node_modules/@jscad/modeling/src/operations/expansions/extrudePolygon.js"(n,e){var t=gh(),i=oo(),r=Qs(),o=xc(),s=(a,c)=>{i.dot(o.plane(c),a)>0&&(c=o.invert(c));const u=[c],d=o.transform(t.fromTranslation(t.create(),a),c),h=c.vertices.length;for(let f=0;f<h;f++){const m=f<h-1?f+1:0,y=o.create([c.vertices[f],d.vertices[f],d.vertices[m],c.vertices[m]]);u.push(y)}return u.push(o.invert(d)),r.create(u)};e.exports=s}}),dJt=it({"node_modules/@jscad/modeling/src/operations/expansions/expandShell.js"(n,e){var{EPS:t,TAU:i}=$c(),r=gh(),o=oo(),s=Qje(),a=Qs(),c=xc(),l=qje(),u=lP(),d=nHe(),h=uJt(),f=(b,x,w)=>{const T=x.toString();if(b.has(T))b.get(T)[1].push(w);else{const N=[x,[w]];b.set(T,N)}},m=(b,x,w)=>{const T=x[0].toString(),N=x[1].toString(),R=T<N?`${T},${N}`:`${N},${T}`;if(b.has(R))b.get(R)[1].push(w);else{const k=[x,[w]];b.set(R,k)}},y=(b,x)=>{b.findIndex(T=>T===x)<0&&b.push(x)},g=(b,x)=>{const w={delta:1,segments:12},{delta:T,segments:N}=Object.assign({},w,b);let R=a.create();const k=new Map,M=new Map,I=o.create(),C=o.create();return a.toPolygons(x).forEach((P,H)=>{const G=o.scale(o.create(),c.plane(P),2*T),X=c.transform(r.fromTranslation(r.create(),o.scale(o.create(),G,-.5)),P),W=h(G,X);R=d(R,W);const K=P.vertices;for(let ie=0;ie<K.length;ie++){f(k,K[ie],c.plane(P));const ce=(ie+1)%K.length,me=[K[ie],K[ce]];m(M,me,c.plane(P))}}),M.forEach(P=>{const H=P[0],G=P[1],X=H[0],W=H[1],K=o.subtract(o.create(),W,X);o.normalize(K,K);const ie=G[0],ce=o.cross(o.create(),ie,K);let me=[];for(let Ce=0;Ce<N;Ce++)y(me,Ce*i/N);for(let Ce=0,oe=G.length;Ce<oe;Ce++){const ge=G[Ce],ye=o.dot(ce,ge),$e=o.dot(ie,ge);let Ve=Math.atan2(ye,$e);Ve<0&&(Ve+=i),y(me,Ve),Ve=Math.atan2(-ye,-$e),Ve<0&&(Ve+=i),y(me,Ve)}me=me.sort(s);const ne=me.length;let ae,pe;const be=[],Te=[],De=[];for(let Ce=-1;Ce<ne;Ce++){const oe=me[Ce<0?Ce+ne:Ce],ge=Math.sin(oe),ye=Math.cos(oe);o.scale(I,ie,ye*T),o.scale(C,ce,ge*T),o.add(I,I,C);const $e=o.add(o.create(),X,I),Ve=o.add(o.create(),W,I);let Ze=!1;if(Ce>=0&&o.distance($e,ae)<t&&(Ze=!0),!Ze){if(Ce>=0){be.push($e),Te.push(Ve);const ve=[pe,Ve,$e,ae],nt=c.create(ve);De.push(nt)}ae=$e,pe=Ve}}Te.reverse(),De.push(c.create(be)),De.push(c.create(Te));const Ue=a.create(De);R=d(R,Ue)}),k.forEach(P=>{const H=P[0],G=P[1],X=G[0];let W=null,K=0;for(let ne=1;ne<G.length;ne++){const ae=G[ne],pe=o.cross(I,X,ae),be=o.length(pe);be>.05&&be>K&&(K=be,W=ae)}W||(W=o.orthogonal(I,X));const ie=o.cross(I,X,W);o.normalize(ie,ie);const ce=o.cross(C,ie,X),me=l({center:[H[0],H[1],H[2]],radius:T,segments:N,axes:[X,ie,ce]});R=d(R,me)}),u(R)};e.exports=g}}),hJt=it({"node_modules/@jscad/modeling/src/operations/expansions/expandGeom3.js"(n,e){var t=Qs(),i=Ghe(),r=dJt(),o=(s,a)=>{const c={delta:1,corners:"round",segments:12},{delta:l,corners:u,segments:d}=Object.assign({},c,s);if(u!=="round")throw new Error('corners must be "round" for 3D geometries');if(t.toPolygons(a).length===0)throw new Error("the given geometry cannot be empty");s={delta:l,corners:u,segments:d};const f=r(s,a);return i(a,f)};e.exports=o}}),pJt=it({"node_modules/@jscad/modeling/src/operations/expansions/expandPath2.js"(n,e){var t=fU(),i=xa(),r=Ks(),o=Hd(),s=yU(),a=u=>{let{external:d,internal:h}=u;t(d)<0?d=d.reverse():h=h.reverse();const f=o.fromPoints({closed:!0},d),m=o.fromPoints({closed:!0},h),y=r.toSides(r.fromPoints(o.toPoints(f))),g=r.toSides(r.fromPoints(o.toPoints(m)));return y.push(...g),r.create(y)},c=(u,d,h,f)=>{const{points:m,external:y,internal:g}=u,b=Math.floor(d/2),x=[],w=[];if(h==="round"&&b>0){const N=Math.PI/b,R=m[m.length-1],k=i.angle(i.subtract(i.create(),y[y.length-1],R)),M=m[0],I=i.angle(i.subtract(i.create(),g[0],M));for(let C=1;C<b;C++){let $=k+N*C,P=i.fromAngleRadians(i.create(),$);i.scale(P,P,f),i.add(P,P,R),x.push(P),$=I+N*C,P=i.fromAngleRadians(i.create(),$),i.scale(P,P,f),i.add(P,P,M),w.push(P)}}const T=[];return T.push(...y,...x,...g.reverse(),...w),r.fromPoints(T)},l=(u,d)=>{u=Object.assign({},{delta:1,corners:"edge",segments:16},u);const{delta:f,corners:m,segments:y}=u;if(f<=0)throw new Error("the given delta must be positive for paths");if(!(m==="edge"||m==="chamfer"||m==="round"))throw new Error('corners must be "edge", "chamfer", or "round"');const g=d.isClosed,b=o.toPoints(d);if(b.length===0)throw new Error("the given geometry cannot be empty");const x={points:b,external:s({delta:f,corners:m,segments:y,closed:g},b),internal:s({delta:-f,corners:m,segments:y,closed:g},b)};return d.isClosed?a(x):c(x,y,m,f)};e.exports=l}}),Xhe=it({"node_modules/@jscad/modeling/src/operations/expansions/expand.js"(n,e){var t=ks(),i=Ks(),r=Qs(),o=Hd(),s=lJt(),a=hJt(),c=pJt(),l=(u,...d)=>{if(d=t(d),d.length===0)throw new Error("wrong number of arguments");const h=d.map(f=>o.isA(f)?c(u,f):i.isA(f)?s(u,f):r.isA(f)?a(u,f):f);return h.length===1?h[0]:h};e.exports=l}}),fJt=it({"node_modules/@jscad/modeling/src/operations/expansions/offsetGeom2.js"(n,e){var t=Ks(),i=Ihe(),r=yU(),o=(s,a)=>{const c={delta:1,corners:"edge",segments:0},{delta:l,corners:u,segments:d}=Object.assign({},c,s);if(!(u==="edge"||u==="chamfer"||u==="round"))throw new Error('corners must be "edge", "chamfer", or "round"');const h=t.toOutlines(a),m=h.map(y=>(s={delta:h.reduce((x,w)=>x+i.arePointsInside(y,i.create(w)),0)%2===0?l:-l,corners:u,closed:!0,segments:d},r(s,y))).reduce((y,g)=>y.concat(t.toSides(t.fromPoints(g))),[]);return t.create(m)};e.exports=o}}),mJt=it({"node_modules/@jscad/modeling/src/operations/expansions/offsetPath2.js"(n,e){var t=Hd(),i=yU(),r=(o,s)=>{const a={delta:1,corners:"edge",closed:s.isClosed,segments:16},{delta:c,corners:l,closed:u,segments:d}=Object.assign({},a,o);if(!(l==="edge"||l==="chamfer"||l==="round"))throw new Error('corners must be "edge", "chamfer", or "round"');o={delta:c,corners:l,closed:u,segments:d};const h=i(o,t.toPoints(s));return t.fromPoints({closed:u},h)};e.exports=r}}),_Jt=it({"node_modules/@jscad/modeling/src/operations/expansions/offset.js"(n,e){var t=ks(),i=Ks(),r=Hd(),o=fJt(),s=mJt(),a=(c,...l)=>{if(l=t(l),l.length===0)throw new Error("wrong number of arguments");const u=l.map(d=>r.isA(d)?s(c,d):i.isA(d)?o(c,d):d);return u.length===1?u[0]:u};e.exports=a}}),Whe=it({"node_modules/@jscad/modeling/src/operations/expansions/index.js"(n,e){e.exports={expand:Xhe(),offset:_Jt()}}}),gU=it({"node_modules/@jscad/modeling/src/operations/extrusions/extrudeLinearGeom2.js"(n,e){var t=gh(),i=oo(),r=Ks(),o=DM(),s=_U(),a=(c,l)=>{const u={offset:[0,0,1],twistAngle:0,twistSteps:12,repair:!0};let{offset:d,twistAngle:h,twistSteps:f,repair:m}=Object.assign({},u,c);if(f<1)throw new Error("twistSteps must be 1 or more");h===0&&(f=1);const y=i.clone(d),g=r.toSides(l);if(g.length===0)throw new Error("the given geometry cannot be empty");const b=o.fromSides(g);y[2]<0&&o.reverse(b,b);const x=t.create(),w=(T,N,R)=>{const k=N/f*h,M=i.scale(i.create(),y,N/f);return t.multiply(x,t.fromZRotation(x,k),t.fromTranslation(t.create(),M)),o.transform(x,R)};return c={numberOfSlices:f+1,capStart:!0,capEnd:!0,repair:m,callback:w},s(c,b)};e.exports=a}}),yJt=it({"node_modules/@jscad/modeling/src/operations/extrusions/extrudeLinearPath2.js"(n,e){var t=Ks(),i=Hd(),r=gU(),o=(s,a)=>{if(!a.isClosed)throw new Error("extruded path must be closed");const c=i.toPoints(a),l=t.fromPoints(c);return r(s,l)};e.exports=o}}),gJt=it({"node_modules/@jscad/modeling/src/operations/extrusions/extrudeLinear.js"(n,e){var t=ks(),i=Ks(),r=Hd(),o=gU(),s=yJt(),a=(c,...l)=>{const u={height:1,twistAngle:0,twistSteps:1,repair:!0},{height:d,twistAngle:h,twistSteps:f,repair:m}=Object.assign({},u,c);if(l=t(l),l.length===0)throw new Error("wrong number of arguments");c={offset:[0,0,d],twistAngle:h,twistSteps:f,repair:m};const y=l.map(g=>r.isA(g)?s(c,g):i.isA(g)?o(c,g):g);return y.length===1?y[0]:y};e.exports=a}}),vJt=it({"node_modules/@jscad/modeling/src/operations/extrusions/extrudeRectangularPath2.js"(n,e){var t=Hd(),i=Xhe(),r=gU(),o=(s,a)=>{const c={size:1,height:1},{size:l,height:u}=Object.assign({},c,s);if(s.delta=l,s.offset=[0,0,u],t.toPoints(a).length===0)throw new Error("the given geometry cannot be empty");const h=i(s,a);return r(s,h)};e.exports=o}}),xJt=it({"node_modules/@jscad/modeling/src/operations/extrusions/extrudeRectangularGeom2.js"(n,e){var{area:t}=rP(),i=Ks(),r=Hd(),o=Xhe(),s=gU(),a=(c,l)=>{const u={size:1,height:1},{size:d,height:h}=Object.assign({},u,c);c.delta=d,c.offset=[0,0,h];const f=i.toOutlines(l);if(f.length===0)throw new Error("the given geometry cannot be empty");const y=f.map(b=>(t(b)<0&&b.reverse(),o(c,r.fromPoints({closed:!0},b)))).reduce((b,x)=>b.concat(i.toSides(x)),[]),g=i.create(y);return s(c,g)};e.exports=a}}),bJt=it({"node_modules/@jscad/modeling/src/operations/extrusions/extrudeRectangular.js"(n,e){var t=ks(),i=Ks(),r=Hd(),o=vJt(),s=xJt(),a=(c,...l)=>{const u={size:1,height:1},{size:d,height:h}=Object.assign({},u,c);if(l=t(l),l.length===0)throw new Error("wrong number of arguments");if(d<=0)throw new Error("size must be positive");if(h<=0)throw new Error("height must be positive");const f=l.map(m=>r.isA(m)?o(c,m):i.isA(m)?s(c,m):m);return f.length===1?f[0]:f};e.exports=a}}),wJt=it({"node_modules/@jscad/modeling/src/operations/extrusions/extrudeHelical.js"(n,e){var{TAU:t}=$c(),i=DM(),r=gh(),o=_U(),s=Ks(),a=(c,l)=>{const u={angle:t,startAngle:0,pitch:10,endOffset:0,segmentsPerRotation:32},{angle:d,endOffset:h,segmentsPerRotation:f,startAngle:m}=Object.assign({},u,c);let y;if(!c.pitch&&c.height?y=c.height/(d/t):y=c.pitch?c.pitch:u.pitch,f<3)throw new Error("The number of segments per rotation needs to be at least 3.");const b=s.toSides(l);if(b.length===0)throw new Error("the given geometry cannot be empty");const x=b.filter(I=>I[0][0]>=0);let w=i.fromSides(b);x.length===0&&(w=i.reverse(w));const T=Math.round(f/t*Math.abs(d)),N=T>=2?T:2,R=r.create();let k;const M=(I,C,$)=>{const P=m+d/N*C,H=h/N*C,G=(P-m)/t*y;return r.multiply(R,r.fromTranslation(r.create(),[H,0,G*Math.sign(d)]),r.fromXRotation(r.create(),-t/4*Math.sign(d))),k=r.create(),r.multiply(k,r.fromZRotation(r.create(),P),R),i.transform(k,$)};return o({numberOfSlices:N+1,callback:M},w)};e.exports=a}}),SJt=it({"node_modules/@jscad/modeling/src/operations/extrusions/project.js"(n,e){var t=ks(),i=Dhe(),r=t3(),o=gh(),s=Ks(),a=Qs(),c=xc(),l=d4(),u=rHe(),d=(f,m)=>{const y=r.fromNormalAndPoint(r.create(),f.axis,f.origin);if(Number.isNaN(y[0])||Number.isNaN(y[1])||Number.isNaN(y[2])||Number.isNaN(y[3]))throw new Error("project: invalid axis or origin");const g=l(m),b=g*g*Math.sqrt(3)/4;if(g===0)return s.create();const x=a.toPolygons(m);let w=[];for(let N=0;N<x.length;N++){const R=x[N].vertices.map(I=>r.projectionOfPoint(y,I)),k=c.create(R),M=c.plane(k);i(y,M)&&(c.measureArea(k)<b||w.push(k))}if(!i(y,[0,0,1])){const N=o.fromVectorRotation(o.create(),y,[0,0,1]);w=w.map(R=>c.transform(N,R))}w=w.sort((N,R)=>c.measureArea(R)-c.measureArea(N));const T=w.map(N=>s.fromPoints(N.vertices));return u(T)},h=(f,...m)=>{const y={axis:[0,0,1],origin:[0,0,0]},{axis:g,origin:b}=Object.assign({},y,f);if(m=t(m),m.length===0)throw new Error("wrong number of arguments");f={axis:g,origin:b};const x=m.map(w=>a.isA(w)?d(f,w):w);return x.length===1?x[0]:x};e.exports=h}}),vU=it({"node_modules/@jscad/modeling/src/operations/extrusions/index.js"(n,e){e.exports={extrudeFromSlices:_U(),extrudeLinear:gJt(),extrudeRectangular:bJt(),extrudeRotate:Wje(),extrudeHelical:wJt(),project:SJt(),slice:DM()}}}),Zhe=it({"node_modules/@jscad/modeling/src/operations/hulls/hullPoints2.js"(n,e){var t=xa(),i=s=>{let a=t.fromValues(1/0,1/0);s.forEach(u=>{(u[1]<a[1]||u[1]===a[1]&&u[0]<a[0])&&(a=u)});const c=[];s.forEach(u=>{const d=o(u[1]-a[1],u[0]-a[0]),h=t.squaredDistance(u,a);c.push({point:u,angle:d,distSq:h})}),c.sort((u,d)=>u.angle!==d.angle?u.angle-d.angle:u.distSq-d.distSq);const l=[];return c.forEach(u=>{let d=l.length;for(;d>1&&r(l[d-2],l[d-1],u.point)<=Number.EPSILON;)l.pop(),d=l.length;l.push(u.point)}),l},r=(s,a,c)=>(a[0]-s[0])*(c[1]-s[1])-(a[1]-s[1])*(c[0]-s[0]),o=(s,a)=>s===0&&a===0?-1/0:-a/s;e.exports=i}}),Khe=it({"node_modules/@jscad/modeling/src/operations/hulls/toUniquePoints.js"(n,e){var t=Ks(),i=Qs(),r=Hd(),o=s=>{const a=new Set,c=[],l=u=>{const d=u.toString();a.has(d)||(c.push(u),a.add(d))};return s.forEach(u=>{t.isA(u)?t.toPoints(u).forEach(l):i.isA(u)?i.toPoints(u).forEach(d=>d.forEach(l)):r.isA(u)&&r.toPoints(u).forEach(l)}),c};e.exports=o}}),EJt=it({"node_modules/@jscad/modeling/src/operations/hulls/hullPath2.js"(n,e){var t=ks(),i=Hd(),r=Zhe(),o=Khe(),s=(...a)=>{a=t(a);const c=o(a),l=r(c);return i.fromPoints({closed:!0},l)};e.exports=s}}),TJt=it({"node_modules/@jscad/modeling/src/operations/hulls/hullGeom2.js"(n,e){var t=ks(),i=Ks(),r=Zhe(),o=Khe(),s=(...a)=>{a=t(a);const c=o(a),l=r(c);return l.length<3?i.create():i.fromPoints(l)};e.exports=s}}),oHe=it({"node_modules/@jscad/modeling/src/operations/hulls/hullPoints3.js"(n,e){var t=xc(),i=rje(),r=o=>i(o,{skipTriangulation:!0}).map(c=>{const l=c.map(u=>o[u]);return t.create(l)});e.exports=r}}),MJt=it({"node_modules/@jscad/modeling/src/operations/hulls/hullGeom3.js"(n,e){var t=ks(),i=Qs(),r=Khe(),o=oHe(),s=(...a)=>{a=t(a);const c=r(a);return c.length===0?i.create():i.create(o(c))};e.exports=s}}),sHe=it({"node_modules/@jscad/modeling/src/operations/hulls/hull.js"(n,e){var t=ks(),i=cP(),r=Ks(),o=Qs(),s=Hd(),a=EJt(),c=TJt(),l=MJt(),u=(...d)=>{if(d=t(d),d.length===0)throw new Error("wrong number of arguments");if(!i(d))throw new Error("only hulls of the same type are supported");const h=d[0];return s.isA(h)?a(d):r.isA(h)?c(d):o.isA(h)?l(d):h};e.exports=u}}),CJt=it({"node_modules/@jscad/modeling/src/operations/hulls/hullChain.js"(n,e){var t=ks(),i=Ghe(),r=sHe(),o=(...s)=>{if(s=t(s),s.length<2)throw new Error("wrong number of arguments");const a=[];for(let c=1;c<s.length;c++)a.push(r(s[c-1],s[c]));return i(a)};e.exports=o}}),AJt=it({"node_modules/@jscad/modeling/src/operations/hulls/index.js"(n,e){e.exports={hull:sHe(),hullChain:CJt(),hullPoints2:Zhe(),hullPoints3:oHe()}}}),aHe=it({"node_modules/@jscad/modeling/src/operations/modifiers/snapPolygons.js"(n,e){var t=oo(),i=xc(),r=(s,a)=>{const c=Math.abs(i.measureArea(a));return Number.isFinite(c)&&c>s},o=(s,a)=>{let c=a.map(u=>{const d=u.vertices.map(m=>t.snap(t.create(),m,s)),h=[];for(let m=0;m<d.length;m++){const y=(m+1)%d.length;t.equals(d[m],d[y])||h.push(d[m])}const f=i.create(h);return u.color&&(f.color=u.color),f});const l=s*s*Math.sqrt(3)/4;return c=c.filter(u=>r(l,u)),c};e.exports=o}}),RJt=it({"node_modules/@jscad/modeling/src/operations/modifiers/mergePolygons.js"(n,e){var t=Dhe(),i=oo(),r=xc(),o=b=>{const x=r.toPoints(b),w=[];for(let T=0;T<x.length;T++){const N=(T+1)%x.length,R={v1:x[T],v2:x[N]};w.push(R)}for(let T=0;T<w.length;T++){const N=(T+1)%x.length;w[T].next=w[N],w[N].prev=w[T]}return w},s=(b,x)=>{const w=`${x.v1}:${x.v2}`;b.set(w,x)},a=(b,x)=>{const w=`${x.v1}:${x.v2}`;b.delete(w)},c=(b,x)=>{const w=`${x.v2}:${x.v1}`;return b.get(w)},l=(b,x,w)=>{let T=b.prev.v1,N=b.prev.v2,R=x.next.v2;const k=h(T,N,R,w);T=x.prev.v1,N=x.prev.v2,R=b.next.v2;const M=h(T,N,R,w);return[k,M]},u=i.create(),d=i.create(),h=(b,x,w,T)=>{const N=i.subtract(u,x,b),R=i.subtract(d,w,x);return i.cross(N,N,R),i.dot(N,T)},f=b=>{let x;const w=[];for(;b.next;){const T=b.next;w.push(b.v1),b.v1=null,b.v2=null,b.next=null,b.prev=null,b=T}return w.length>0&&(x=r.create(w)),x},m=b=>{if(b.length<2)return b;const x=b[0].plane,w=b.slice(),T=new Map;for(;w.length>0;){const R=w.shift(),k=o(R);for(let M=0;M<k.length;M++){const I=k[M],C=c(T,I);if(C){const $=l(I,C,x);if($[0]>=0&&$[1]>=0){const P=C.next,H=I.next;I.prev.next=C.next,I.next.prev=C.prev,C.prev.next=I.next,C.next.prev=I.prev,I.v1=null,I.v2=null,I.next=null,I.prev=null,a(T,C),C.v1=null,C.v2=null,C.next=null,C.prev=null;const G=(X,W,K)=>{const ie={v1:K.v1,v2:W.v2,next:W.next,prev:K.prev};K.prev.next=ie,W.next.prev=ie,a(X,W),W.v1=null,W.v2=null,W.next=null,W.prev=null,a(X,K),K.v1=null,K.v2=null,K.next=null,K.prev=null};$[0]===0&&G(T,P,P.prev),$[1]===0&&G(T,H,H.prev)}}else I.next&&s(T,I)}}const N=[];return T.forEach(R=>{const k=f(R);k&&N.push(k)}),T.clear(),N},y=(b,x)=>Math.abs(b[3]-x[3])<15e-8?t(b,x):!1,g=(b,x)=>{const w=[];x.forEach(N=>{const R=w.find(k=>y(k[0],r.plane(N)));R?R[1].push(N):w.push([r.plane(N),[N]])});let T=[];return w.forEach(N=>{const R=N[1],k=m(R);T=T.concat(k)}),T};e.exports=g}}),PJt=it({"node_modules/@jscad/modeling/src/operations/modifiers/insertTjunctions.js"(n,e){var t=$c(),i=oo(),r=xc(),o=l=>`${l}`,s=(l,u,d,h,f,m)=>{const y=o(h),g=o(f),b=`${y}/${g}`,x=`${g}/${y}`;if(l.has(x))return a(l,u,d,f,h,null),null;const w={vertex0:h,vertex1:f,polygonindex:m};return l.has(b)?l.get(b).push(w):l.set(b,[w]),u.has(y)?u.get(y).push(b):u.set(y,[b]),d.has(g)?d.get(g).push(b):d.set(g,[b]),b},a=(l,u,d,h,f,m)=>{const y=o(h),g=o(f),b=`${y}/${g}`;let x=-1;const w=l.get(b);for(let T=0;T<w.length;T++){const N=w[T];let R=o(N.vertex0);if(R===y&&(R=o(N.vertex1),R===g&&!(m!==null&&N.polygonindex!==m))){x=T;break}}w.splice(x,1),w.length===0&&l.delete(b),x=u.get(y).indexOf(b),u.get(y).splice(x,1),u.get(y).length===0&&u.delete(y),x=d.get(g).indexOf(b),d.get(g).splice(x,1),d.get(g).length===0&&d.delete(g)},c=l=>{const u=new Map;for(let d=0;d<l.length;d++){const h=l[d],f=h.vertices.length;if(f>=3){let m=h.vertices[0],y=o(m);for(let g=0;g<f;g++){let b=g+1;b===f&&(b=0);const x=h.vertices[b],w=o(x),T=`${y}/${w}`,N=`${w}/${y}`;if(u.has(N)){const R=u.get(N);R.splice(-1,1),R.length===0&&u.delete(N)}else{const R={vertex0:m,vertex1:x,polygonindex:d};u.has(T)?u.get(T).push(R):u.set(T,[R])}m=x,y=w}}else console.warn("warning: invalid polygon found during insertTjunctions")}if(u.size>0){const d=new Map,h=new Map,f=new Map;for(const[y,g]of u)f.set(y,!0),g.forEach(b=>{const x=o(b.vertex0),w=o(b.vertex1);d.has(x)?d.get(x).push(y):d.set(x,[y]),h.has(w)?h.get(w).push(y):h.set(w,[y])});const m=l.slice(0);for(;u.size!==0;){for(const g of u.keys())f.set(g,!0);let y=!1;for(;;){const g=Array.from(f.keys());if(g.length===0)break;const b=g[0];let x=!0;if(u.has(b)){const T=u.get(b)[0];for(let N=0;N<2;N++){const R=N===0?T.vertex0:T.vertex1,k=N===0?T.vertex1:T.vertex0,M=o(R),I=o(k);let C=[];N===0?h.has(M)&&(C=h.get(M)):d.has(M)&&(C=d.get(M));for(let $=0;$<C.length;$++){const P=C[$],H=u.get(P)[0],G=N===0?H.vertex0:H.vertex1;if(N===0?H.vertex1:H.vertex0,o(G)===I){a(u,d,h,R,k,null),a(u,d,h,k,R,null),x=!1,N=2,y=!0;break}else{const W=R,K=k,ie=G,ce=i.subtract(i.create(),ie,W),me=i.dot(i.subtract(i.create(),K,W),ce)/i.dot(ce,ce);if(me>0&&me<1){const ne=i.scale(i.create(),ce,me);if(i.add(ne,ne,W),i.squaredDistance(ne,K)<t.EPS*t.EPS){const pe=H.polygonindex,be=m[pe],Te=o(H.vertex1);let De=-1;for(let ye=0;ye<be.vertices.length;ye++)if(o(be.vertices[ye])===Te){De=ye;break}const Ue=be.vertices.slice(0);Ue.splice(De,0,k);const Ce=r.create(Ue);m[pe]=Ce,a(u,d,h,H.vertex0,H.vertex1,pe);const oe=s(u,d,h,H.vertex0,k,pe),ge=s(u,d,h,k,H.vertex1,pe);oe!==null&&f.set(oe,!0),ge!==null&&f.set(ge,!0),x=!1,N=2,y=!0;break}}}}}}x&&f.delete(b)}if(!y)break}l=m}return u.clear(),l};e.exports=c}}),IJt=it({"node_modules/@jscad/modeling/src/operations/modifiers/triangulatePolygons.js"(n,e){var t=oo(),i=xc(),r=(s,a,c)=>{const l=a.vertices.length;if(l>3){if(l>4){const h=[0,0,0];a.vertices.forEach(f=>t.add(h,h,f)),t.snap(h,t.divide(h,h,[l,l,l]),s);for(let f=0;f<l;f++){const m=i.create([h,a.vertices[f],a.vertices[(f+1)%l]]);a.color&&(m.color=a.color),c.push(m)}return}const u=i.create([a.vertices[0],a.vertices[1],a.vertices[2]]),d=i.create([a.vertices[0],a.vertices[2],a.vertices[3]]);a.color&&(u.color=a.color,d.color=a.color),c.push(u,d);return}c.push(a)},o=(s,a)=>{const c=[];return a.forEach(l=>{r(s,l,c)}),c};e.exports=o}}),NJt=it({"node_modules/@jscad/modeling/src/operations/modifiers/generalize.js"(n,e){var t=ks(),i=d4(),r=Ks(),o=Qs(),s=Hd(),a=aHe(),c=RJt(),l=PJt(),u=IJt(),d=(y,g)=>g,h=(y,g)=>g,f=(y,g)=>{const b={snap:!1,simplify:!1,triangulate:!1},{snap:x,simplify:w,triangulate:T}=Object.assign({},b,y),N=i(g);let R=o.toPolygons(g);x&&(R=a(N,R)),w&&(R=c(N,R)),T&&(R=l(R),R=u(N,R));const k=Object.assign({},g);return k.polygons=R,k},m=(y,...g)=>{if(g=t(g),g.length===0)throw new Error("wrong number of arguments");const b=g.map(x=>{if(s.isA(x))return d(y,x);if(r.isA(x))return h(y,x);if(o.isA(x))return f(y,x);throw new Error("invalid geometry")});return b.length===1?b[0]:b};e.exports=m}}),kJt=it({"node_modules/@jscad/modeling/src/operations/modifiers/snap.js"(n,e){var t=ks(),i=xa(),r=Ks(),o=Qs(),s=Hd(),a=d4(),c=aHe(),l=f=>{const m=a(f),g=s.toPoints(f).map(b=>i.snap(i.create(),b,m));return s.create(g)},u=f=>{const m=a(f);let g=r.toSides(f).map(b=>[i.snap(i.create(),b[0],m),i.snap(i.create(),b[1],m)]);return g=g.filter(b=>!i.equals(b[0],b[1])),r.create(g)},d=f=>{const m=a(f),y=o.toPolygons(f),g=c(m,y);return o.create(g)},h=(...f)=>{if(f=t(f),f.length===0)throw new Error("wrong number of arguments");const m=f.map(y=>s.isA(y)?l(y):r.isA(y)?u(y):o.isA(y)?d(y):y);return m.length===1?m[0]:m};e.exports=h}}),OJt=it({"node_modules/@jscad/modeling/src/operations/modifiers/index.js"(n,e){e.exports={generalize:NJt(),snap:kJt(),retessellate:lP()}}}),DJt=it({"node_modules/@jscad/modeling/src/utils/padArrayToLength.js"(n,e){var t=(i,r,o)=>{for(i=i.slice();i.length<o;)i.push(r);return i};e.exports=t}}),LJt=it({"node_modules/@jscad/modeling/src/operations/transforms/align.js"(n,e){var t=ks(),i=DJt(),r=zhe(),{translate:o}=xT(),s=u=>{if(!Array.isArray(u.modes)||u.modes.length>3)throw new Error("align(): modes must be an array of length <= 3");if(u.modes=i(u.modes,"none",3),u.modes.filter(d=>["center","max","min","none"].includes(d)).length!==3)throw new Error('align(): all modes must be one of "center", "max" or "min"');if(!Array.isArray(u.relativeTo)||u.relativeTo.length>3)throw new Error("align(): relativeTo must be an array of length <= 3");if(u.relativeTo=i(u.relativeTo,0,3),u.relativeTo.filter(d=>Number.isFinite(d)||d==null).length!==3)throw new Error("align(): all relativeTo values must be a number, or null.");if(typeof u.grouped!="boolean")throw new Error("align(): grouped must be a boolean value.");return u},a=(u,d,h)=>{for(let f=0;f<3;f++)u[f]==null&&(d[f]==="center"?u[f]=(h[0][f]+h[1][f])/2:d[f]==="max"?u[f]=h[1][f]:d[f]==="min"&&(u[f]=h[0][f]));return u},c=(u,d,h)=>{const f=r(u),m=[0,0,0];for(let y=0;y<3;y++)d[y]==="center"?m[y]=h[y]-(f[0][y]+f[1][y])/2:d[y]==="max"?m[y]=h[y]-f[1][y]:d[y]==="min"&&(m[y]=h[y]-f[0][y]);return o(m,u)},l=(u,...d)=>{u=Object.assign({},{modes:["center","center","min"],relativeTo:[0,0,0],grouped:!1},u),u=s(u);let{modes:f,relativeTo:m,grouped:y}=u;if(d=t(d),d.length===0)throw new Error("align(): No geometries were provided to act upon");if(m.filter(g=>g==null).length){const g=r(d);m=a(m,f,g)}return y?d=c(d,f,m):d=d.map(g=>c(g,f,m)),d.length===1?d[0]:d};e.exports=l}}),xU=it({"node_modules/@jscad/modeling/src/operations/transforms/center.js"(n,e){var t=ks(),i=Ks(),r=Qs(),o=Hd(),s=gT(),{translate:a}=xT(),c=(f,m)=>{const y={axes:[!0,!0,!0],relativeTo:[0,0,0]},{axes:g,relativeTo:b}=Object.assign({},y,f),x=s(m),w=[0,0,0];return g[0]&&(w[0]=b[0]-(x[0][0]+(x[1][0]-x[0][0])/2)),g[1]&&(w[1]=b[1]-(x[0][1]+(x[1][1]-x[0][1])/2)),g[2]&&(w[2]=b[2]-(x[0][2]+(x[1][2]-x[0][2])/2)),a(w,m)},l=(f,...m)=>{const y={axes:[!0,!0,!0],relativeTo:[0,0,0]},{axes:g,relativeTo:b}=Object.assign({},y,f);if(m=t(m),m.length===0)throw new Error("wrong number of arguments");if(b.length!==3)throw new Error("relativeTo must be an array of length 3");f={axes:g,relativeTo:b};const x=m.map(w=>o.isA(w)||i.isA(w)||r.isA(w)?c(f,w):w);return x.length===1?x[0]:x},u=(...f)=>l({axes:[!0,!1,!1]},f),d=(...f)=>l({axes:[!1,!0,!1]},f),h=(...f)=>l({axes:[!1,!1,!0]},f);e.exports={center:l,centerX:u,centerY:d,centerZ:h}}}),bU=it({"node_modules/@jscad/modeling/src/operations/transforms/scale.js"(n,e){var t=ks(),i=gh(),r=Ks(),o=Qs(),s=Hd(),a=(d,...h)=>{if(!Array.isArray(d))throw new Error("factors must be an array");if(h=t(h),h.length===0)throw new Error("wrong number of arguments");for(d=d.slice();d.length<3;)d.push(1);if(d[0]<=0||d[1]<=0||d[2]<=0)throw new Error("factors must be positive");const f=i.fromScaling(i.create(),d),m=h.map(y=>s.isA(y)?s.transform(f,y):r.isA(y)?r.transform(f,y):o.isA(y)?o.transform(f,y):y);return m.length===1?m[0]:m},c=(d,...h)=>a([d,1,1],h),l=(d,...h)=>a([1,d,1],h),u=(d,...h)=>a([1,1,d],h);e.exports={scale:a,scaleX:c,scaleY:l,scaleZ:u}}}),zJt=it({"node_modules/@jscad/modeling/src/operations/transforms/transform.js"(n,e){var t=ks(),i=Ks(),r=Qs(),o=Hd(),s=(a,...c)=>{if(c=t(c),c.length===0)throw new Error("wrong number of arguments");const l=c.map(u=>o.isA(u)?o.transform(a,u):i.isA(u)?i.transform(a,u):r.isA(u)?r.transform(a,u):u);return l.length===1?l[0]:l};e.exports=s}}),wU=it({"node_modules/@jscad/modeling/src/operations/transforms/index.js"(n,e){e.exports={align:LJt(),center:xU().center,centerX:xU().centerX,centerY:xU().centerY,centerZ:xU().centerZ,mirror:sP().mirror,mirrorX:sP().mirrorX,mirrorY:sP().mirrorY,mirrorZ:sP().mirrorZ,rotate:aP().rotate,rotateX:aP().rotateX,rotateY:aP().rotateY,rotateZ:aP().rotateZ,scale:bU().scale,scaleX:bU().scaleX,scaleY:bU().scaleY,scaleZ:bU().scaleZ,transform:zJt(),translate:xT().translate,translateX:xT().translateX,translateY:xT().translateY,translateZ:xT().translateZ}}}),Qhe=it({"node_modules/@jscad/modeling/src/index.js"(n,e){e.exports={colors:iP(),curves:kKt(),geometries:Nhe(),maths:rQt(),measurements:hQt(),primitives:LM(),text:$he(),utils:Jje(),booleans:Yhe(),expansions:Whe(),extrusions:vU(),hulls:AJt(),modifiers:OJt(),transforms:wU()}}}),FJt=it({"node_modules/ms/index.js"(n,e){var t=1e3,i=t*60,r=i*60,o=r*24,s=o*7,a=o*365.25;e.exports=function(h,f){f=f||{};var m=typeof h;if(m==="string"&&h.length>0)return c(h);if(m==="number"&&isFinite(h))return f.long?u(h):l(h);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(h))};function c(h){if(h=String(h),!(h.length>100)){var f=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(h);if(f){var m=parseFloat(f[1]),y=(f[2]||"ms").toLowerCase();switch(y){case"years":case"year":case"yrs":case"yr":case"y":return m*a;case"weeks":case"week":case"w":return m*s;case"days":case"day":case"d":return m*o;case"hours":case"hour":case"hrs":case"hr":case"h":return m*r;case"minutes":case"minute":case"mins":case"min":case"m":return m*i;case"seconds":case"second":case"secs":case"sec":case"s":return m*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return m;default:return}}}}function l(h){var f=Math.abs(h);return f>=o?Math.round(h/o)+"d":f>=r?Math.round(h/r)+"h":f>=i?Math.round(h/i)+"m":f>=t?Math.round(h/t)+"s":h+"ms"}function u(h){var f=Math.abs(h);return f>=o?d(h,f,o,"day"):f>=r?d(h,f,r,"hour"):f>=i?d(h,f,i,"minute"):f>=t?d(h,f,t,"second"):h+" ms"}function d(h,f,m,y){var g=f>=m*1.5;return Math.round(h/m)+" "+y+(g?"s":"")}}}),BJt=it({"node_modules/debug/src/common.js"(n,e){function t(i){o.debug=o,o.default=o,o.coerce=d,o.disable=l,o.enable=a,o.enabled=u,o.humanize=FJt(),o.destroy=h,Object.keys(i).forEach(f=>{o[f]=i[f]}),o.names=[],o.skips=[],o.formatters={};function r(f){let m=0;for(let y=0;y<f.length;y++)m=(m<<5)-m+f.charCodeAt(y),m|=0;return o.colors[Math.abs(m)%o.colors.length]}o.selectColor=r;function o(f){let m,y=null,g,b;function x(...w){if(!x.enabled)return;const T=x,N=Number(new Date),R=N-(m||N);T.diff=R,T.prev=m,T.curr=N,m=N,w[0]=o.coerce(w[0]),typeof w[0]!="string"&&w.unshift("%O");let k=0;w[0]=w[0].replace(/%([a-zA-Z%])/g,(I,C)=>{if(I==="%%")return"%";k++;const $=o.formatters[C];if(typeof $=="function"){const P=w[k];I=$.call(T,P),w.splice(k,1),k--}return I}),o.formatArgs.call(T,w),(T.log||o.log).apply(T,w)}return x.namespace=f,x.useColors=o.useColors(),x.color=o.selectColor(f),x.extend=s,x.destroy=o.destroy,Object.defineProperty(x,"enabled",{enumerable:!0,configurable:!1,get:()=>y!==null?y:(g!==o.namespaces&&(g=o.namespaces,b=o.enabled(f)),b),set:w=>{y=w}}),typeof o.init=="function"&&o.init(x),x}function s(f,m){const y=o(this.namespace+(typeof m>"u"?":":m)+f);return y.log=this.log,y}function a(f){o.save(f),o.namespaces=f,o.names=[],o.skips=[];const m=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const y of m)y[0]==="-"?o.skips.push(y.slice(1)):o.names.push(y)}function c(f,m){let y=0,g=0,b=-1,x=0;for(;y<f.length;)if(g<m.length&&(m[g]===f[y]||m[g]==="*"))m[g]==="*"?(b=g,x=y,g++):(y++,g++);else if(b!==-1)g=b+1,x++,y=x;else return!1;for(;g<m.length&&m[g]==="*";)g++;return g===m.length}function l(){const f=[...o.names,...o.skips.map(m=>"-"+m)].join(",");return o.enable(""),f}function u(f){for(const m of o.skips)if(c(f,m))return!1;for(const m of o.names)if(c(f,m))return!0;return!1}function d(f){return f instanceof Error?f.stack||f.message:f}function h(){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 o.enable(o.load()),o}e.exports=t}}),UJt=it({"node_modules/debug/src/browser.js"(n,e){n.formatArgs=i,n.save=r,n.load=o,n.useColors=t,n.storage=s(),n.destroy=(()=>{let c=!1;return()=>{c||(c=!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`."))}})(),n.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 t(){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 c;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&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function i(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const l="color: "+this.color;c.splice(1,0,l,"color: inherit");let u=0,d=0;c[0].replace(/%[a-zA-Z%]/g,h=>{h!=="%%"&&(u++,h==="%c"&&(d=u))}),c.splice(d,0,l)}n.log=console.debug||console.log||(()=>{});function r(c){try{c?n.storage.setItem("debug",c):n.storage.removeItem("debug")}catch{}}function o(){let c;try{c=n.storage.getItem("debug")||n.storage.getItem("DEBUG")}catch{}return!c&&typeof She<"u"&&"env"in She&&(c=She.env.DEBUG),c}function s(){try{return localStorage}catch{}}e.exports=BJt()(n);var{formatters:a}=e.exports;a.j=function(c){try{return JSON.stringify(c)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}}}),cHe=Ee.createContext(null),Ex=()=>{const n=Ee.useContext(cHe);if(!n)throw new Error("useThree must be used within a ThreeProvider");return n},uP=(n,e=[])=>{const{addFrameListener:t,removeFrameListener:i}=Ex();yo.useEffect(()=>(t(n),()=>i(n)),[t,i,...e])},lHe=Ee.createContext(null),$Jt=()=>{const n=Ee.useContext(lHe);if(!n)throw new Error("useHover must be used within a HoverProvider");return n},jJt=({children:n})=>{const{camera:e,renderer:t}=Ex(),[i,r]=Ee.useState([]),o=Ee.useMemo(()=>new Dbt,[]),s=Ee.useMemo(()=>new as,[]),a=Ee.useRef(i);a.current=i;const c=Ee.useRef(null),l=Ee.useCallback(m=>{r(y=>[...y,m])},[]),u=Ee.useCallback(m=>{if(c.current){let y=!1,g=c.current.object;for(;g;){if(g===m){y=!0;break}g=g.parent}y&&(c.current.onUnhover(),c.current=null)}r(y=>y.filter(g=>g.object!==m))},[]),d=Ee.useCallback(m=>{let y=m;for(;y;){const g=a.current.find(b=>b.object===y);if(g)return g;y=y.parent}},[]),h=Ee.useCallback(m=>{if(!t.domElement)return;const y=t.domElement.getBoundingClientRect();s.x=(m.clientX-y.left)/y.width*2-1,s.y=-((m.clientY-y.top)/y.height)*2+1,o.setFromCamera(s,e);const g=a.current.map(x=>x.object);if(g.length===0){c.current&&(c.current.onUnhover(),c.current=null);return}const b=o.intersectObjects(g,!0);if(b.length>0){const x=b[0],w=d(x.object);if(w){const T={mousePosition:[x.point.x,x.point.y,x.point.z]};c.current!==w?(c.current?.onUnhover(),w.onHover(T),c.current=w):w.onHover(T)}else c.current&&(c.current.onUnhover(),c.current=null)}else c.current&&(c.current.onUnhover(),c.current=null)},[e,t,o,s,d]);Ee.useEffect(()=>{const m=t.domElement;return m.addEventListener("mousemove",h),()=>{m.removeEventListener("mousemove",h)}},[t,h]);const f=Ee.useMemo(()=>({addHoverable:l,removeHoverable:u}),[l,u]);return _e.jsx(lHe.Provider,{value:f,children:n})},HJt=({children:n,object:e,onHover:t,onUnhover:i,isHovered:r})=>{const{addHoverable:o,removeHoverable:s}=$Jt();return Ee.useEffect(()=>e?(o({object:e,onHover:t,onUnhover:i}),()=>{s(e)}):void 0,[e,t,i,o,s]),_e.jsx(_e.Fragment,{children:n})},SU=HJt;typeof window<"u"&&!window.TSCIRCUIT_OBJ_LOADER_CACHE&&(window.TSCIRCUIT_OBJ_LOADER_CACHE=new Map);function VJt(n){const[e,t]=Ee.useState(null);return Ee.useEffect(()=>{if(!n)return;const i=n.replace(/&cachebust_origin=$/,""),r=window.TSCIRCUIT_OBJ_LOADER_CACHE;let o=!1;async function s(){try{const c=await fetch(i);if(!c.ok)throw new Error(`Failed to fetch "${i}": ${c.status} ${c.statusText}`);const l=await c.text(),u=l.match(/newmtl[\s\S]*?endmtl/g)?.join(`
5071
- `).replace(/d 0\./g,"d 1."),d=l.replace(/newmtl[\s\S]*?endmtl/g,""),h=new c9t;h.setMaterialOptions({invertTrProperty:!0});const f=h.parse(u.replace(/Kd\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/g,"Kd $2 $2 $2"),"test.mtl"),m=new m9t;return m.setMaterials(f),m.parse(d)}catch(c){return c}}function a(){if(r.has(i)){const l=r.get(i);return l.result?Promise.resolve(l.result.clone()):l.promise.then(u=>u instanceof Error?u:u.clone())}const c=s().then(l=>(l instanceof Error||r.set(i,{...r.get(i),result:l}),l));return r.set(i,{promise:c,result:null}),c}return a().then(c=>{o||t(c)}).catch(c=>{console.error(c)}),()=>{o=!0}},[n]),e}function qJt({url:n,position:e,rotation:t,onHover:i,onUnhover:r,isHovered:o}){const s=VJt(n),{rootObject:a}=Ex(),c=Ee.useMemo(()=>s&&!(s instanceof Error)?s:new kp(new cw(.5,.5,.5),new lw({transparent:!0,color:"red",opacity:.25})),[s]);if(Ee.useEffect(()=>{if(!(!a||!c))return a.add(c),()=>{a.remove(c)}},[a,c]),Ee.useEffect(()=>{c&&(e&&(Array.isArray(e)?c.position.fromArray(e):c.position.copy(e)),t&&(Array.isArray(t)?c.rotation.fromArray(t):c.rotation.copy(t)))},[c,Array.isArray(e)?e[0]:e?.x,Array.isArray(e)?e[1]:e?.y,Array.isArray(e)?e[2]:e?.z,Array.isArray(t)?t[0]:t?.x,Array.isArray(t)?t[1]:t?.y,Array.isArray(t)?t[2]:t?.z]),s instanceof Error)throw s;return _e.jsx(SU,{isHovered:o,onHover:i,onUnhover:r,object:c})}var GJt=ep(B$e()),YJt=ep(Qhe()),uHe={in:25.4,inch:25.4,mil:.0254,mm:1,m:1e3,cm:10,ft:304.8,feet:304.8},Xu=n=>{let e=typeof n=="number"?"mm":n.replace(/^[^a-zA-Z]+/g,"").toLowerCase();e||(e="mm");const t=typeof n=="number"?n:Number.parseFloat(n.split(e)[0]);if(e in uHe)return t*uHe[e];throw new Error(`Unsupported unit: ${e}`)},dP=Xu,dHe={Hz:{baseUnit:"Hz",variants:{MHz:1e6,kHz:1e3,Hz:1}},g:{baseUnit:"g",variants:{kg:1e3,g:1}},Ω:{baseUnit:"Ω",variants:{mΩ:.001,Ω:1,kΩ:1e3,KΩ:1e3,kohm:1e3,MΩ:1e6,GΩ:1e9,TΩ:1e12}},V:{baseUnit:"V",variants:{mV:.001,V:1,kV:1e3,KV:1e3,MV:1e6,GV:1e9,TV:1e12}},A:{baseUnit:"A",variants:{µA:1e-6,mA:.001,ma:.001,A:1,kA:1e3,MA:1e6}},F:{baseUnit:"F",variants:{pF:1e-12,nF:1e-9,µF:1e-6,uF:1e-6,mF:.001,F:1}},ml:{baseUnit:"ml",variants:{ml:1,mL:1,l:1e3,L:1e3}},deg:{baseUnit:"deg",variants:{rad:180/Math.PI}},ms:{baseUnit:"ms",variants:{s:1e3}},mm:{baseUnit:"mm",variants:{nm:1e-6,µm:.001,um:.001,mm:1,cm:10,dm:100,m:1e3,km:1e6,in:25.4,ft:304.8,IN:25.4,FT:304.8,yd:914.4,mi:1609344,mil:.0254}}},Jhe=new Set;for(const[n,e]of Object.entries(dHe)){Jhe.add(n);for(const t of Object.keys(e.variants))Jhe.add(t)}function XJt(n){for(const[e,t]of Object.entries(dHe))if(n in t.variants)return{baseUnit:t.baseUnit,conversionFactor:t.variants[n]};return{baseUnit:n,conversionFactor:1}}var hHe={tera:1e12,T:1e12,giga:1e9,G:1e9,mega:1e6,M:1e6,kilo:1e3,k:1e3,deci:.1,d:.1,centi:.01,c:.01,milli:.001,m:.001,micro:1e-6,u:1e-6,µ:1e-6,nano:1e-9,n:1e-9,pico:1e-12,p:1e-12},V2=n=>{if(typeof n>"u")return{parsedUnit:null,unitOfValue:null,value:null};if(typeof n=="string"&&n.match(/^-?[\d\.]+$/))return{value:Number.parseFloat(n),parsedUnit:null,unitOfValue:null};if(typeof n=="number")return{value:n,parsedUnit:null,unitOfValue:null};if(typeof n=="object"&&"x"in n&&"y"in n){const{parsedUnit:a,unitOfValue:c}=V2(n.x);return{parsedUnit:a,unitOfValue:c,value:{x:V2(n.x).value,y:V2(n.y).value}}}const t=n.toString().split("").reverse().join("").match(/[^\d\s]+/)?.[0];if(!t)throw new Error(`Could not determine unit: "${n}"`);const i=t.split("").reverse().join(""),r=n.slice(0,-i.length);if(i in hHe&&!Jhe.has(i)){const a=hHe[i];return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(r)*a}}const{baseUnit:o,conversionFactor:s}=XJt(i);return{parsedUnit:i,unitOfValue:o,value:s*Number.parseFloat(r)}},epe=U().or(Fe()).transform(n=>V2(n).value),pHe=U().or(Fe()).transform(n=>V2(n).value).transform(n=>Number.parseFloat(n.toPrecision(12))),WJt=U().or(Fe()).transform(n=>V2(n).value),zM=U().or(Fe()).transform(n=>V2(n).value),st=U().or(Fe()).transform(n=>V2(n).value),fHe=U().or(Fe()).transform(n=>V2(n).value),vi=st;U().or(Fe()).transform(n=>V2(n).value),U().or(Fe()).transform(n=>V2(n).value);var bT=U().or(Fe()).transform(n=>typeof n=="number"?n:n.endsWith("deg")?Number.parseFloat(n.split("deg")[0]):n.endsWith("rad")?Number.parseFloat(n.split("rad")[0])*180/Math.PI:Number.parseFloat(n)),ZJt=Fe().or(U().endsWith("mAh")).transform(n=>{if(typeof n=="string"){const e=n.replace("mAh",""),t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error("Invalid capacity");return t}return n}).describe("Battery capacity in mAh"),Fl=Re({x:vi,y:vi}),tpe=Re({x:vi,y:vi,z:vi}),mHe=Re({width:Fe(),height:Fe()}),KJt=n=>{const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";return Array.from({length:n},()=>e[Math.floor(Math.random()*e.length)]).join("")},go=n=>U().optional().default(()=>`${n}_${KJt(10)}`),npe=Gt(["top_left","top_center","top_right","center_left","center","center_right","bottom_left","bottom_center","bottom_right"]),QJt=Gt(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),zg=Re({type:we("source_component"),ftype:U().optional(),source_component_id:U(),name:U(),manufacturer_part_number:U().optional(),supplier_part_numbers:ms(QJt,mt(U())).optional(),display_value:U().optional(),are_pins_interchangeable:vt().optional(),internally_connected_source_port_ids:mt(mt(U())).optional(),source_group_id:U().optional(),subcircuit_id:U().optional()}),_He=zg.extend({ftype:we("simple_capacitor"),capacitance:pHe,max_voltage_rating:zM.optional(),display_capacitance:U().optional(),max_decoupling_trace_length:vi.optional()}),yHe=zg.extend({ftype:we("simple_resistor"),resistance:epe,display_resistance:U().optional()}),ipe=zg.extend({ftype:we("simple_diode")}),gHe=ipe.extend({ftype:we("simple_led"),color:U().optional(),wavelength:U().optional()}),JJt=zg.extend({ftype:we("simple_ground")}),vHe=zg.extend({ftype:we("simple_chip")}),xHe=zg.extend({ftype:we("simple_power_source"),voltage:zM}),een=zg.extend({ftype:we("simple_fuse"),current_rating_amps:Fe().describe("Nominal current in amps the fuse is rated for"),voltage_rating_volts:Fe().describe("Voltage rating in volts, e.g. ±5V would be 5")}),bHe=zg.extend({ftype:we("simple_battery"),capacity:ZJt}),wHe=zg.extend({ftype:we("simple_inductor"),inductance:WJt,max_current_rating:Fe().optional()}),SHe=zg.extend({ftype:we("simple_push_button")}),EHe=zg.extend({ftype:we("simple_potentiometer"),max_resistance:epe}),ten=zg.extend({ftype:we("simple_crystal"),frequency:Fe().describe("Frequency in Hz"),load_capacitance:Fe().optional().describe("Load capacitance in pF")}),THe=zg.extend({ftype:we("simple_pin_header"),pin_count:Fe(),gender:Gt(["male","female"]).optional().default("male")}),MHe=zg.extend({ftype:we("simple_resonator"),load_capacitance:pHe,equivalent_series_resistance:epe.optional(),frequency:fHe}),CHe=zg.extend({ftype:we("simple_transistor"),transistor_type:Gt(["npn","pnp"])}),AHe=zg.extend({ftype:we("simple_test_point"),footprint_variant:Gt(["pad","through_hole"]).optional(),pad_shape:Gt(["rect","circle"]).optional(),pad_diameter:Gn([Fe(),U()]).optional(),hole_diameter:Gn([Fe(),U()]).optional(),width:Gn([Fe(),U()]).optional(),height:Gn([Fe(),U()]).optional()}),RHe=zg.extend({ftype:we("simple_mosfet"),channel_type:Gt(["n","p"]),mosfet_mode:Gt(["enhancement","depletion"])}),PHe=zg.extend({ftype:we("simple_switch")}),IHe=Re({type:we("source_project_metadata"),name:U().optional(),software_used_string:U().optional(),project_url:U().optional(),created_at:U().datetime().optional()}),nen=Re({type:we("source_missing_property_error"),source_missing_property_error_id:go("source_missing_property_error"),source_component_id:U(),property_name:U(),subcircuit_id:U().optional(),error_type:we("source_missing_property_error").default("source_missing_property_error"),message:U()}).describe("The source code is missing a property"),ien=Re({type:we("source_failed_to_create_component_error"),source_failed_to_create_component_error_id:go("source_failed_to_create_component_error"),error_type:we("source_failed_to_create_component_error").default("source_failed_to_create_component_error"),component_name:U().optional(),subcircuit_id:U().optional(),parent_source_component_id:U().optional(),message:U(),pcb_center:Re({x:Fe().optional(),y:Fe().optional()}).optional(),schematic_center:Re({x:Fe().optional(),y:Fe().optional()}).optional()}).describe("Error emitted when a component fails to be constructed"),NHe=Re({type:we("source_trace_not_connected_error"),source_trace_not_connected_error_id:go("source_trace_not_connected_error"),error_type:we("source_trace_not_connected_error").default("source_trace_not_connected_error"),message:U(),subcircuit_id:U().optional(),source_group_id:U().optional(),source_trace_id:U().optional(),connected_source_port_ids:mt(U()).optional(),selectors_not_found:mt(U()).optional()}).describe("Occurs when a source trace selector does not match any ports"),ren=Gn([yHe,_He,ipe,gHe,JJt,vHe,xHe,bHe,wHe,SHe,EHe,ten,THe,MHe,PHe,CHe,AHe,RHe,een,IHe,nen,ien,NHe]),oen=Re({type:we("source_port"),pin_number:Fe().optional(),port_hints:mt(U()).optional(),name:U(),source_port_id:U(),source_component_id:U(),subcircuit_id:U().optional(),subcircuit_connectivity_map_key:U().optional()}),sen=Re({type:we("source_trace"),source_trace_id:U(),connected_source_port_ids:mt(U()),connected_source_net_ids:mt(U()),subcircuit_id:U().optional(),subcircuit_connectivity_map_key:U().optional(),max_length:Fe().optional(),min_trace_thickness:Fe().optional(),display_name:U().optional()}),aen=Re({type:we("source_group"),source_group_id:U(),subcircuit_id:U().optional(),parent_subcircuit_id:U().optional(),parent_source_group_id:U().optional(),is_subcircuit:vt().optional(),name:U().optional()}),cen=Re({type:we("source_net"),source_net_id:U(),name:U(),member_source_group_ids:mt(U()),is_power:vt().optional(),is_ground:vt().optional(),is_digital_signal:vt().optional(),is_analog_signal:vt().optional(),trace_width:Fe().optional(),subcircuit_id:U().optional(),subcircuit_connectivity_map_key:U().optional()}),len=Re({type:we("source_pcb_ground_plane"),source_pcb_ground_plane_id:U(),source_group_id:U(),source_net_id:U(),subcircuit_id:U().optional()}).describe("Defines a ground plane in the source domain"),uen=Re({type:we("schematic_box"),schematic_component_id:U().optional(),width:vi,height:vi,is_dashed:vt().default(!1),x:vi,y:vi,subcircuit_id:U().optional()}).describe("Draws a box on the schematic"),den=Re({type:we("schematic_path"),schematic_component_id:U(),fill_color:Gt(["red","blue"]).optional(),is_filled:vt().optional(),points:mt(Fl),subcircuit_id:U().optional()}),hen=ms(Re({left_margin:st.optional(),right_margin:st.optional(),top_margin:st.optional(),bottom_margin:st.optional()})),pen=Re({left_size:Fe(),right_size:Fe(),top_size:Fe().optional(),bottom_size:Fe().optional()}),fen=Re({left_side:Re({pins:mt(Fe()),direction:Gt(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:Re({pins:mt(Fe()),direction:Gt(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:Re({pins:mt(Fe()),direction:Gt(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:Re({pins:mt(Fe()),direction:Gt(["left-to-right","right-to-left"]).optional()}).optional()}),men=Gn([pen,fen]),_en=Re({type:we("schematic_component"),size:mHe,center:Fl,source_component_id:U(),schematic_component_id:U(),pin_spacing:st.optional(),pin_styles:hen.optional(),box_width:st.optional(),symbol_name:U().optional(),port_arrangement:men.optional(),port_labels:ms(U()).optional(),symbol_display_value:U().optional(),subcircuit_id:U().optional(),schematic_group_id:U().optional()}),yen=Re({type:we("schematic_line"),schematic_component_id:U(),x1:vi,x2:vi,y1:vi,y2:vi,subcircuit_id:U().optional()}),gen=Re({type:we("schematic_trace"),schematic_trace_id:U(),source_trace_id:U(),junctions:mt(Re({x:Fe(),y:Fe()})),edges:mt(Re({from:Re({x:Fe(),y:Fe()}),to:Re({x:Fe(),y:Fe()}),is_crossing:vt().optional(),from_schematic_port_id:U().optional(),to_schematic_port_id:U().optional()})),subcircuit_id:U().optional()}),ven=Gt(["center","left","right","top","bottom"]),xen=Re({type:we("schematic_text"),schematic_component_id:U().optional(),schematic_text_id:U(),text:U(),font_size:Fe().default(.18),position:Re({x:vi,y:vi}),rotation:Fe().default(0),anchor:Gn([ven.describe("legacy"),npe]).default("center"),color:U().default("#000000"),subcircuit_id:U().optional()}),ben=Re({type:we("schematic_port"),schematic_port_id:U(),source_port_id:U(),schematic_component_id:U().optional(),center:Fl,facing_direction:Gt(["up","down","left","right"]).optional(),distance_from_component_edge:Fe().optional(),side_of_component:Gt(["top","bottom","left","right"]).optional(),true_ccw_index:Fe().optional(),pin_number:Fe().optional(),display_pin_label:U().optional(),subcircuit_id:U().optional(),is_connected:vt().optional()}).describe("Defines a port on a schematic component"),wen=Re({type:we("schematic_net_label"),schematic_net_label_id:go("schematic_net_label"),schematic_trace_id:U().optional(),source_trace_id:U().optional(),source_net_id:U(),center:Fl,anchor_position:Fl.optional(),anchor_side:Gt(["top","bottom","left","right"]),text:U(),symbol_name:U().optional(),is_movable:vt().optional(),subcircuit_id:U().optional()}),Sen=Re({type:we("schematic_error"),schematic_error_id:U(),error_type:we("schematic_port_not_found").default("schematic_port_not_found"),message:U(),subcircuit_id:U().optional()}).describe("Defines a schematic error on the schematic"),Een=Re({type:we("schematic_layout_error"),schematic_layout_error_id:go("schematic_layout_error"),error_type:we("schematic_layout_error").default("schematic_layout_error"),message:U(),source_group_id:U(),schematic_group_id:U(),subcircuit_id:U().optional()}).describe("Error emitted when schematic layout fails for a group"),rpe=Re({type:we("schematic_debug_object"),label:U().optional(),subcircuit_id:U().optional()}),Ten=rpe.extend({shape:we("rect"),center:Fl,size:mHe}),Men=rpe.extend({shape:we("line"),start:Fl,end:Fl}),Cen=rpe.extend({shape:we("point"),center:Fl}),Aen=z_("shape",[Ten,Men,Cen]),Ren=Re({type:we("schematic_voltage_probe"),schematic_voltage_probe_id:U(),position:Fl,schematic_trace_id:U(),voltage:zM.optional(),subcircuit_id:U().optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),Pen=Re({type:we("schematic_manual_edit_conflict_warning"),schematic_manual_edit_conflict_warning_id:go("schematic_manual_edit_conflict_warning"),warning_type:we("schematic_manual_edit_conflict_warning").default("schematic_manual_edit_conflict_warning"),message:U(),schematic_component_id:U(),schematic_group_id:U().optional(),subcircuit_id:U().optional(),source_component_id:U()}).describe("Warning emitted when a component has both manual placement and explicit schX/schY coordinates"),Ien=Re({type:we("schematic_group"),schematic_group_id:go("schematic_group"),source_group_id:U(),is_subcircuit:vt().optional(),subcircuit_id:U().optional(),width:st,height:st,center:Fl,schematic_component_ids:mt(U()),name:U().optional(),description:U().optional()}).describe("Defines a group of components on the schematic"),Nen=Re({type:we("schematic_table"),schematic_table_id:go("schematic_table"),anchor_position:Fl,column_widths:mt(vi),row_heights:mt(vi),cell_padding:vi.optional(),border_width:vi.optional(),subcircuit_id:U().optional(),schematic_component_id:U().optional(),anchor:npe.optional()}).describe("Defines a table on the schematic"),ken=Re({type:we("schematic_table_cell"),schematic_table_cell_id:go("schematic_table_cell"),schematic_table_id:U(),start_row_index:Fe(),end_row_index:Fe(),start_column_index:Fe(),end_column_index:Fe(),text:U().optional(),center:Fl,width:vi,height:vi,horizontal_align:Gt(["left","center","right"]).optional(),vertical_align:Gt(["top","middle","bottom"]).optional(),font_size:vi.optional(),subcircuit_id:U().optional()}).describe("Defines a cell within a schematic_table"),Oen=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6"],kHe=Gt(Oen),fd=kHe.or(Re({name:kHe})).transform(n=>typeof n=="string"?n:n.name),hP=Gt(["top","bottom"]),Den=Re({x:vi,y:vi,via:vt().optional(),via_to_layer:fd.optional()});mt(Den);var Len=Re({x:vi,y:vi,via:vt().optional(),to_layer:fd.optional(),trace_width:vi.optional()}),zen=Re({type:we("pcb_component"),pcb_component_id:go("pcb_component"),source_component_id:U(),center:Fl,layer:fd,rotation:bT,width:st,height:st,subcircuit_id:U().optional(),pcb_group_id:U().optional()}).describe("Defines a component on the PCB"),OHe=Re({type:we("pcb_hole"),pcb_hole_id:go("pcb_hole"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),hole_shape:Gt(["circle","square"]),hole_diameter:Fe(),x:vi,y:vi});OHe.describe("Defines a circular or square hole on the PCB");var DHe=Re({type:we("pcb_hole"),pcb_hole_id:go("pcb_hole"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),hole_shape:we("oval"),hole_width:Fe(),hole_height:Fe(),x:vi,y:vi});DHe.describe("Defines an oval hole on the PCB");var Fen=OHe.or(DHe),Ben=Re({type:we("pcb_plated_hole"),shape:we("circle"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),outer_diameter:Fe(),hole_diameter:Fe(),x:vi,y:vi,layers:mt(fd),port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional(),pcb_plated_hole_id:go("pcb_plated_hole")}),Uen=Re({type:we("pcb_plated_hole"),shape:Gt(["oval","pill"]),pcb_group_id:U().optional(),subcircuit_id:U().optional(),outer_width:Fe(),outer_height:Fe(),hole_width:Fe(),hole_height:Fe(),x:vi,y:vi,layers:mt(fd),port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional(),pcb_plated_hole_id:go("pcb_plated_hole")}),$en=Re({type:we("pcb_plated_hole"),shape:we("circular_hole_with_rect_pad"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),hole_shape:we("circle"),pad_shape:we("rect"),hole_diameter:Fe(),rect_pad_width:Fe(),rect_pad_height:Fe(),x:vi,y:vi,layers:mt(fd),port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional(),pcb_plated_hole_id:go("pcb_plated_hole")}),jen=Re({type:we("pcb_plated_hole"),shape:we("pill_hole_with_rect_pad"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),hole_shape:we("pill"),pad_shape:we("rect"),hole_width:Fe(),hole_height:Fe(),rect_pad_width:Fe(),rect_pad_height:Fe(),x:vi,y:vi,layers:mt(fd),port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional(),pcb_plated_hole_id:go("pcb_plated_hole")}),Hen=Re({type:we("pcb_plated_hole"),shape:we("rotated_pill_hole_with_rect_pad"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),hole_shape:we("rotated_pill"),pad_shape:we("rect"),hole_width:Fe(),hole_height:Fe(),hole_ccw_rotation:bT,rect_pad_width:Fe(),rect_pad_height:Fe(),rect_ccw_rotation:bT,x:vi,y:vi,layers:mt(fd),port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional(),pcb_plated_hole_id:go("pcb_plated_hole")}),Ven=Gn([Ben,Uen,$en,jen,Hen]),qen=Re({type:we("pcb_port"),pcb_port_id:go("pcb_port"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),source_port_id:U(),pcb_component_id:U(),x:vi,y:vi,layers:mt(fd)}).describe("Defines a port on the PCB"),Gen=Re({type:we("pcb_smtpad"),shape:we("circle"),pcb_smtpad_id:go("pcb_smtpad"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,radius:Fe(),layer:fd,port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional()}),Yen=Re({type:we("pcb_smtpad"),shape:we("rect"),pcb_smtpad_id:go("pcb_smtpad"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,width:Fe(),height:Fe(),layer:fd,port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional()}),Xen=Re({type:we("pcb_smtpad"),shape:we("rotated_rect"),pcb_smtpad_id:go("pcb_smtpad"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,width:Fe(),height:Fe(),ccw_rotation:bT,layer:fd,port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional()}),Wen=Re({type:we("pcb_smtpad"),shape:we("pill"),pcb_smtpad_id:go("pcb_smtpad"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,width:Fe(),height:Fe(),radius:Fe(),layer:fd,port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional()}),Zen=Re({type:we("pcb_smtpad"),shape:we("rotated_pill"),pcb_smtpad_id:go("pcb_smtpad"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,width:Fe(),height:Fe(),radius:Fe(),ccw_rotation:bT,layer:fd,port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional()}),Ken=Re({type:we("pcb_smtpad"),shape:we("polygon"),pcb_smtpad_id:go("pcb_smtpad"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),points:mt(Fl),layer:fd,port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional()}),Qen=z_("shape",[Gen,Yen,Xen,Zen,Wen,Ken]).describe("Defines an SMT pad on the PCB"),Jen=Re({type:we("pcb_solder_paste"),shape:we("circle"),pcb_solder_paste_id:go("pcb_solder_paste"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,radius:Fe(),layer:fd,pcb_component_id:U().optional(),pcb_smtpad_id:U().optional()}),etn=Re({type:we("pcb_solder_paste"),shape:we("rect"),pcb_solder_paste_id:go("pcb_solder_paste"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,width:Fe(),height:Fe(),layer:fd,pcb_component_id:U().optional(),pcb_smtpad_id:U().optional()}),ttn=Re({type:we("pcb_solder_paste"),shape:we("pill"),pcb_solder_paste_id:go("pcb_solder_paste"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,width:Fe(),height:Fe(),radius:Fe(),layer:fd,pcb_component_id:U().optional(),pcb_smtpad_id:U().optional()}),ntn=Re({type:we("pcb_solder_paste"),shape:we("rotated_rect"),pcb_solder_paste_id:go("pcb_solder_paste"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,width:Fe(),height:Fe(),ccw_rotation:vi,layer:fd,pcb_component_id:U().optional(),pcb_smtpad_id:U().optional()}),itn=Re({type:we("pcb_solder_paste"),shape:we("oval"),pcb_solder_paste_id:go("pcb_solder_paste"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,width:Fe(),height:Fe(),layer:fd,pcb_component_id:U().optional(),pcb_smtpad_id:U().optional()}),rtn=Gn([Jen,etn,ttn,ntn,itn]).describe("Defines solderpaste on the PCB"),otn=Re({type:we("pcb_text"),pcb_text_id:go("pcb_text"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),text:U(),center:Fl,layer:fd,width:st,height:st,lines:Fe(),align:Gt(["bottom-left"])}).describe("Defines text on the PCB"),stn=Re({route_type:we("wire"),x:vi,y:vi,width:vi,start_pcb_port_id:U().optional(),end_pcb_port_id:U().optional(),layer:fd}),atn=Re({route_type:we("via"),x:vi,y:vi,hole_diameter:vi.optional(),outer_diameter:vi.optional(),from_layer:U(),to_layer:U()}),ctn=Gn([stn,atn]),ltn=Re({type:we("pcb_trace"),source_trace_id:U().optional(),pcb_component_id:U().optional(),pcb_trace_id:go("pcb_trace"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),route_thickness_mode:Gt(["constant","interpolated"]).default("constant").optional(),route_order_index:Fe().optional(),should_round_corners:vt().optional(),trace_length:Fe().optional(),route:mt(ctn)}).describe("Defines a trace on the PCB"),utn=Re({type:we("pcb_trace_error"),pcb_trace_error_id:go("pcb_trace_error"),error_type:we("pcb_trace_error").default("pcb_trace_error"),message:U(),center:Fl.optional(),pcb_trace_id:U(),source_trace_id:U(),pcb_component_ids:mt(U()),pcb_port_ids:mt(U()),subcircuit_id:U().optional()}).describe("Defines a trace error on the PCB"),dtn=Re({type:we("pcb_trace_missing_error"),pcb_trace_missing_error_id:go("pcb_trace_missing_error"),error_type:we("pcb_trace_missing_error").default("pcb_trace_missing_error"),message:U(),center:Fl.optional(),source_trace_id:U(),pcb_component_ids:mt(U()),pcb_port_ids:mt(U()),subcircuit_id:U().optional()}).describe("Defines an error when a source trace has no corresponding PCB trace"),htn=Re({type:we("pcb_port_not_matched_error"),pcb_error_id:go("pcb_error"),error_type:we("pcb_port_not_matched_error").default("pcb_port_not_matched_error"),message:U(),pcb_component_ids:mt(U()),subcircuit_id:U().optional()}).describe("Defines a trace error on the PCB where a port is not matched"),ptn=Re({type:we("pcb_port_not_connected_error"),pcb_port_not_connected_error_id:go("pcb_port_not_connected_error"),error_type:we("pcb_port_not_connected_error").default("pcb_port_not_connected_error"),message:U(),pcb_port_ids:mt(U()),pcb_component_ids:mt(U()),subcircuit_id:U().optional()}).describe("Defines an error when a pcb port is not connected to any trace"),ftn=Re({type:we("pcb_via"),pcb_via_id:go("pcb_via"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,outer_diameter:vi.default("0.6mm"),hole_diameter:vi.default("0.25mm"),from_layer:fd.optional(),to_layer:fd.optional(),layers:mt(fd),pcb_trace_id:U().optional()}).describe("Defines a via on the PCB"),mtn=Re({type:we("pcb_board"),pcb_board_id:go("pcb_board"),is_subcircuit:vt().optional(),subcircuit_id:U().optional(),width:st,height:st,center:Fl,thickness:st.optional().default(1.4),num_layers:Fe().optional().default(4),outline:mt(Fl).optional(),material:Gt(["fr4","fr1"]).default("fr4")}).describe("Defines the board outline of the PCB"),_tn=Re({type:we("pcb_placement_error"),pcb_placement_error_id:go("pcb_placement_error"),error_type:we("pcb_placement_error").default("pcb_placement_error"),message:U(),subcircuit_id:U().optional()}).describe("Defines a placement error on the PCB"),ytn=Re({type:we("pcb_trace_hint"),pcb_trace_hint_id:go("pcb_trace_hint"),pcb_port_id:U(),pcb_component_id:U(),route:mt(Len),subcircuit_id:U().optional()}).describe("A hint that can be used during generation of a PCB trace"),gtn=Re({type:we("pcb_silkscreen_line"),pcb_silkscreen_line_id:go("pcb_silkscreen_line"),pcb_component_id:U(),pcb_group_id:U().optional(),subcircuit_id:U().optional(),stroke_width:vi.default("0.1mm"),x1:vi,y1:vi,x2:vi,y2:vi,layer:hP}).describe("Defines a silkscreen line on the PCB"),vtn=Re({type:we("pcb_silkscreen_path"),pcb_silkscreen_path_id:go("pcb_silkscreen_path"),pcb_component_id:U(),pcb_group_id:U().optional(),subcircuit_id:U().optional(),layer:hP,route:mt(Fl),stroke_width:st}).describe("Defines a silkscreen path on the PCB"),xtn=Re({type:we("pcb_silkscreen_text"),pcb_silkscreen_text_id:go("pcb_silkscreen_text"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),font:we("tscircuit2024").default("tscircuit2024"),font_size:vi.default("0.2mm"),pcb_component_id:U(),text:U(),ccw_rotation:Fe().optional(),layer:fd,is_mirrored:vt().default(!1).optional(),anchor_position:Fl.default({x:0,y:0}),anchor_alignment:npe.default("center")}).describe("Defines silkscreen text on the PCB"),btn=Re({type:we("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:go("pcb_silkscreen_rect"),pcb_component_id:U(),pcb_group_id:U().optional(),subcircuit_id:U().optional(),center:Fl,width:st,height:st,layer:fd,stroke_width:st.default("1mm"),is_filled:vt().default(!0).optional(),has_stroke:vt().optional(),is_stroke_dashed:vt().optional()}).describe("Defines a silkscreen rect on the PCB"),wtn=Re({type:we("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:go("pcb_silkscreen_circle"),pcb_component_id:U(),pcb_group_id:U().optional(),subcircuit_id:U().optional(),center:Fl,radius:st,layer:hP,stroke_width:st.default("1mm")}).describe("Defines a silkscreen circle on the PCB"),Stn=Re({type:we("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:go("pcb_silkscreen_oval"),pcb_component_id:U(),pcb_group_id:U().optional(),subcircuit_id:U().optional(),center:Fl,radius_x:vi,radius_y:vi,layer:hP}).describe("Defines a silkscreen oval on the PCB"),Etn=Re({type:we("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:go("pcb_fabrication_note_text"),subcircuit_id:U().optional(),pcb_group_id:U().optional(),font:we("tscircuit2024").default("tscircuit2024"),font_size:vi.default("1mm"),pcb_component_id:U(),text:U(),layer:hP,anchor_position:Fl.default({x:0,y:0}),anchor_alignment:Gt(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:U().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"),Ttn=Re({type:we("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:go("pcb_fabrication_note_path"),pcb_component_id:U(),subcircuit_id:U().optional(),layer:fd,route:mt(Fl),stroke_width:st,color:U().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),Mtn=Re({type:we("pcb_footprint_overlap_error"),pcb_error_id:go("pcb_error"),error_type:we("pcb_footprint_overlap_error").default("pcb_footprint_overlap_error"),message:U(),pcb_smtpad_ids:mt(U()).optional(),pcb_plated_hole_ids:mt(U()).optional(),pcb_hole_ids:mt(U()).optional(),pcb_keepout_ids:mt(U()).optional()}).describe("Error emitted when a pcb footprint overlaps with another element"),Ctn=Re({type:we("pcb_keepout"),shape:we("rect"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),center:Fl,width:vi,height:vi,pcb_keepout_id:U(),layers:mt(U()),description:U().optional()}).or(Re({type:we("pcb_keepout"),shape:we("circle"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),center:Fl,radius:vi,pcb_keepout_id:U(),layers:mt(U()),description:U().optional()})),ope=Re({type:we("pcb_cutout"),pcb_cutout_id:go("pcb_cutout"),pcb_group_id:U().optional(),subcircuit_id:U().optional()}),Atn=ope.extend({shape:we("rect"),center:Fl,width:st,height:st,rotation:bT.optional()}),Rtn=ope.extend({shape:we("circle"),center:Fl,radius:st}),Ptn=ope.extend({shape:we("polygon"),points:mt(Fl)}),Itn=z_("shape",[Atn,Rtn,Ptn]).describe("Defines a cutout on the PCB, removing board material."),Ntn=Re({type:we("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:go("pcb_missing_footprint_error"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),error_type:we("pcb_missing_footprint_error").default("pcb_missing_footprint_error"),source_component_id:U(),message:U()}).describe("Defines a missing footprint error on the PCB"),ktn=Re({type:we("pcb_group"),pcb_group_id:go("pcb_group"),source_group_id:U(),is_subcircuit:vt().optional(),subcircuit_id:U().optional(),width:st,height:st,center:Fl,pcb_component_ids:mt(U()),name:U().optional(),description:U().optional(),layout_mode:U().optional(),autorouter_configuration:Re({trace_clearance:st}).optional(),autorouter_used_string:U().optional()}).describe("Defines a group of components on the PCB"),Otn=Re({type:we("pcb_autorouting_error"),pcb_error_id:go("pcb_autorouting_error"),error_type:we("pcb_autorouting_error").default("pcb_autorouting_error"),message:U(),subcircuit_id:U().optional()}).describe("The autorouting has failed to route a portion of the board"),Dtn=Re({type:we("pcb_manual_edit_conflict_warning"),pcb_manual_edit_conflict_warning_id:go("pcb_manual_edit_conflict_warning"),warning_type:we("pcb_manual_edit_conflict_warning").default("pcb_manual_edit_conflict_warning"),message:U(),pcb_component_id:U(),pcb_group_id:U().optional(),subcircuit_id:U().optional(),source_component_id:U()}).describe("Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"),Ltn=Re({type:we("pcb_breakout_point"),pcb_breakout_point_id:go("pcb_breakout_point"),pcb_group_id:U(),subcircuit_id:U().optional(),source_trace_id:U().optional(),source_port_id:U().optional(),source_net_id:U().optional(),x:vi,y:vi}).describe("Defines a routing target within a pcb_group for a source_trace or source_net"),ztn=Re({type:we("pcb_ground_plane"),pcb_ground_plane_id:go("pcb_ground_plane"),source_pcb_ground_plane_id:U(),source_net_id:U(),pcb_group_id:U().optional(),subcircuit_id:U().optional()}).describe("Defines a ground plane on the PCB"),Ftn=Re({type:we("pcb_ground_plane_region"),pcb_ground_plane_region_id:go("pcb_ground_plane_region"),pcb_ground_plane_id:U(),pcb_group_id:U().optional(),subcircuit_id:U().optional(),layer:fd,points:mt(Fl)}).describe("Defines a polygon region of a ground plane"),Btn=Re({type:we("pcb_thermal_spoke"),pcb_thermal_spoke_id:go("pcb_thermal_spoke"),pcb_ground_plane_id:U(),shape:U(),spoke_count:Fe(),spoke_thickness:vi,spoke_inner_diameter:vi,spoke_outer_diameter:vi,pcb_plated_hole_id:U().optional(),subcircuit_id:U().optional()}).describe("Pattern for connecting a ground plane to a plated hole"),Utn=Re({type:we("cad_component"),cad_component_id:U(),pcb_component_id:U(),source_component_id:U(),position:tpe,rotation:tpe.optional(),size:tpe.optional(),layer:fd.optional(),subcircuit_id:U().optional(),footprinter_string:U().optional(),model_obj_url:U().optional(),model_stl_url:U().optional(),model_3mf_url:U().optional(),model_jscad:Gu().optional()}).describe("Defines a component on the PCB"),$tn=Gt(["sinewave","square","triangle","sawtooth"]),jtn=Re({type:we("simulation_voltage_source"),simulation_voltage_source_id:go("simulation_voltage_source"),is_dc_source:we(!0).optional().default(!0),positive_source_port_id:U().optional(),negative_source_port_id:U().optional(),positive_source_net_id:U().optional(),negative_source_net_id:U().optional(),voltage:zM}).describe("Defines a DC voltage source for simulation"),Htn=Re({type:we("simulation_voltage_source"),simulation_voltage_source_id:go("simulation_voltage_source"),is_dc_source:we(!1),terminal1_source_port_id:U().optional(),terminal2_source_port_id:U().optional(),terminal1_source_net_id:U().optional(),terminal2_source_net_id:U().optional(),voltage:zM.optional(),frequency:fHe.optional(),peak_to_peak_voltage:zM.optional(),wave_shape:$tn.optional(),phase:bT.optional()}).describe("Defines an AC voltage source for simulation"),Vtn=Gn([jtn,Htn]).describe("Defines a voltage source for simulation");Gn([sen,oen,ren,cen,aen,vHe,_He,ipe,gHe,yHe,xHe,bHe,wHe,THe,MHe,PHe,CHe,AHe,RHe,EHe,SHe,len,IHe,NHe,zen,Fen,Ntn,Dtn,Ven,Ctn,qen,otn,ltn,ftn,Qen,rtn,mtn,ktn,ytn,gtn,vtn,xtn,btn,wtn,Stn,utn,dtn,_tn,htn,ptn,Ttn,Etn,Otn,Mtn,Ltn,Itn,ztn,Ftn,Btn,uen,xen,yen,_en,ben,gen,den,Sen,Een,wen,Aen,Ren,Pen,Ien,Nen,ken,Utn,Vtn]);var qtn=Object.defineProperty,Gtn=(n,e)=>{for(var t in e)qtn(n,t,{get:e[t],enumerable:!0})},bw={};Gtn(bw,{axial:()=>Gnn,bga:()=>rnn,breakoutheaders:()=>nin,cap:()=>Jtn,dfn:()=>Cnn,diode:()=>Qtn,dip:()=>Wtn,electrolytic:()=>Fon,hc49:()=>rin,jst:()=>con,led:()=>enn,lqfp:()=>ein,m2host:()=>tsn,melf:()=>yrn,micromelf:()=>brn,minimelf:()=>lrn,mlp:()=>hnn,ms012:()=>Onn,ms013:()=>Lnn,msop:()=>gon,pad:()=>oin,pinrow:()=>Pnn,platedhole:()=>Zon,potentiometer:()=>Don,pushbutton:()=>Xnn,qfn:()=>unn,qfp:()=>dnn,quad:()=>pP,res:()=>tnn,sma:()=>Trn,smb:()=>krn,smbf:()=>Uon,smc:()=>zrn,smf:()=>Rrn,smtpad:()=>Xon,sod110:()=>uon,sod123:()=>jnn,sod123f:()=>$in,sod123fl:()=>qin,sod123w:()=>bin,sod128:()=>Jin,sod323:()=>Tin,sod323f:()=>zin,sod323fl:()=>Eon,sod323w:()=>xon,sod523:()=>din,sod723:()=>Win,sod80:()=>yin,sod882:()=>kin,sod882d:()=>prn,sod923:()=>Rin,soic:()=>snn,solderjumper:()=>Ron,son:()=>Aon,sop8:()=>min,sot:()=>Qon,sot223:()=>$rn,sot23:()=>xnn,sot23w:()=>Zrn,sot25:()=>Enn,sot323:()=>Von,sot363:()=>gnn,sot457:()=>Non,sot563:()=>Nnn,sot723:()=>Fnn,sot89:()=>orn,ssop:()=>fnn,stampboard:()=>Znn,stampreceiver:()=>Jnn,to220:()=>arn,to92:()=>lin,to92s:()=>non,tssop:()=>_nn,vssop:()=>mon});var Kr=(n,e,t)=>({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:"silkscreen_text_1",font:"tscircuit2024",font_size:t,pcb_component_id:"pcb_component_1",text:"{REF}",layer:"top",anchor_position:{x:n,y:e},anchor_alignment:"center"}),Os=(n,e,t,i,r)=>({pcb_plated_hole_id:"",type:"pcb_plated_hole",shape:"circle",x:e,y:t,hole_diameter:Xu(i),outer_diameter:Xu(r),pcb_port_id:"",layers:["top","bottom"],port_hints:[n.toString()]}),LHe=Array.from({length:9},(n,e)=>Math.cos(e/8*Math.PI-Math.PI)).map(n=>({x:n,y:-Math.sqrt(1-n**2)}));function h4(n){return typeof n=="string"?n.trim().toLowerCase().endsWith("mil")?parseFloat(n)*.0254:parseFloat(n):Number(n)}var EU=Gn([U(),Fe()]).transform(n=>h4(n)),Ytn=n=>Re({fn:U(),num_pins:Fe().optional().default(6),wide:vt().optional(),narrow:vt().optional(),w:EU.optional(),p:EU.default(n.p??"2.54mm"),id:EU.optional(),od:EU.optional()}).transform(e=>(!e.id&&!e.od?Math.abs(e.p-1.27)<.01?(e.id=h4("0.55mm"),e.od=h4("0.95mm")):(e.id=h4("1.0mm"),e.od=h4("1.5mm")):e.id?e.od||(e.od=e.id*(1.5/1)):e.id=e.od*(1/1.5),e.w||(e.wide?e.w=h4("600mil"):e.narrow?e.w=h4("300mil"):e.w=h4(n.w??"300mil")),e)),Xtn=Ytn({}),zHe=(n,e,t,i)=>{const r=n/2,o=e<=r,s=r-1,a=i,c=a*s;return o?{x:-t/2,y:c/2-(e-1)*a}:{x:t/2,y:-c/2+(e-r-1)*a}},Wtn=n=>{const e=Xtn.parse(n),t=[];for(let l=0;l<e.num_pins;l++){const{x:u,y:d}=zHe(e.num_pins,l+1,e.w,e.p??2.54);t.push(Os(l+1,u,d,e.id??"0.8mm",e.od??"1mm"))}(e.num_pins/2-1)*e.p+e.od;const r=e.w-e.od-1,o=(e.num_pins/2-1)*e.p+e.od+.4,s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-r/2,y:-o/2},{x:-r/2,y:o/2},...LHe.map(({x:l,y:u})=>({x:l*r/6,y:u*r/6+o/2})),{x:r/2,y:o/2},{x:r/2,y:-o/2},{x:-r/2,y:-o/2}],type:"pcb_silkscreen_path",stroke_width:.1},a=[];for(let l=0;l<e.num_pins;l++){const u=l<e.num_pins/2,d=.6,{y:h}=zHe(e.num_pins,l+1,e.w,e.p??2.54),f=u?-e.w/2-e.od/2-d:e.w/2+e.od/2+d,m=h;a.push({type:"pcb_fabrication_note_text",pcb_fabrication_note_text_id:`pin_${l+1}`,layer:"top",pcb_component_id:`pin_${l+1}`,text:`{pin${l+1}}`,anchor_position:{x:f,y:m},font_size:.3,font:"tscircuit2024",anchor_alignment:"top_left"})}const c=Kr(0,o/2+.5,.4);return{circuitJson:[...t,s,c,...a],parameters:e}},sr=(n,e,t,i,r)=>({type:"pcb_smtpad",x:e,y:t,width:i,height:r,layer:"top",shape:"rect",pcb_smtpad_id:"",port_hints:Array.isArray(n)?n.map(o=>o.toString()):[n.toString()]}),FHe=[{imperial:"01005",metric:"0402",p_mm_min:.5,pw_mm_min:.4,ph_mm_min:.3,w_mm_min:.58,h_mm_min:.21},{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},{imperial:"0201",metric:"0603",p_mm_min:.66,pw_mm_min:.46,ph_mm_min:.4,w_mm_min:.9,h_mm_min:.3},{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},{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},{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},{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},{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},{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},{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}],Ztn=Object.fromEntries(FHe.map(n=>[n.metric,n])),Ktn=Object.fromEntries(FHe.map(n=>[n.imperial,n]));Re({tht:vt(),p:st.optional(),pw:st.optional(),ph:st.optional(),metric:vi.optional(),imperial:vi.optional(),w:st.optional(),h:st.optional(),textbottom:vt().optional()});var TU=n=>{let{tht:e,p:t,pw:i,ph:r,metric:o,imperial:s,w:a,h:c,textbottom:l}=n;if(typeof a=="string"&&(a=dP(a)),typeof c=="string"&&(c=dP(c)),typeof t=="string"&&(t=dP(t)),typeof i=="string"&&(i=dP(i)),typeof r=="string"&&(r=dP(r)),c!==void 0&&a!==void 0&&c>a)throw new Error("height cannot be greater than width (rotated footprint not yet implemented)");let u;if(o&&(u=Ztn[o]),s&&(u=Ktn[s]),u&&(a=u.w_mm_min,c=u.h_mm_min,t=u.p_mm_min,i=u.pw_mm_min,r=u.ph_mm_min),t===void 0||i===void 0||r===void 0)throw new Error("Could not determine required pad dimensions (p, pw, ph)");const d={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:t/2,y:r/2+.4},{x:-t/2-i/2-.2,y:r/2+.4},{x:-t/2-i/2-.2,y:-r/2-.4},{x:t/2,y:-r/2-.4}],stroke_width:.1,pcb_silkscreen_path_id:""},h=l?-r/2-.9:r/2+.9,f=Kr(0,h,.2);return e?[Os(1,-t/2,0,i,i*1/.8),Os(2,t/2,0,i,i*1/.8),d,f]:[sr(["1","left"],-t/2,0,i,r),sr(["2","right"],t/2,0,i,r),d,f]},Qtn=n=>({circuitJson:TU(n),parameters:n}),Jtn=n=>({circuitJson:TU(n),parameters:n}),enn=n=>({circuitJson:TU(n),parameters:n}),tnn=n=>({circuitJson:TU(n),parameters:n}),BHe=(n,{x:e,y:t,radius:i})=>({type:"pcb_smtpad",x:e,y:t,radius:i,layer:"top",shape:"circle",pcb_smtpad_id:"",port_hints:Array.isArray(n)?n.map(r=>r.toString()):[n.toString()]}),UHe="ABCDEFGHIJKLMNOPQRSTUVWXYZ",$He=U().transform(n=>{const[e,t]=n.split(/[x ]/);return{x:parseFloat(e),y:parseFloat(t)}}).pipe(Re({x:Fe(),y:Fe()})),nnn=U().or(mt(Gu())).transform(n=>Array.isArray(n)?n:(n.startsWith("(")&&n.endsWith(")")&&(n=n.slice(1,-1)),n.split(",").map(e=>{const t=Number(e);return isNaN(t)?e:t}))).pipe(mt(U().or(Fe()))),inn=Re({fn:U(),num_pins:Fe().optional().default(64),grid:$He.optional(),p:vi.default("0.8mm"),w:st.optional(),h:st.optional(),ball:st.optional().describe("ball diameter"),pad:st.optional().describe("pad width/height"),circularpads:vt().optional().describe("use circular pads"),tlorigin:vt().optional(),blorigin:vt().optional(),trorigin:vt().optional(),brorigin:vt().optional(),missing:nnn.default([])}).transform(n=>{let e="tl";if(n.blorigin&&(e="bl"),n.trorigin&&(e="tr"),n.brorigin&&(e="br"),!n.grid){const i=Math.ceil(Math.sqrt(n.num_pins));n.grid={x:i,y:i}}return n.missing&&(n.missing=n.missing.map(i=>{if(typeof i=="number")return i;if(i==="center")return"center";if(i==="topleft")return"topleft";const r=i.match(/([A-Z]+)(\d+)/);if(!r)return i;const o=UHe.indexOf(r[1]),s=Number.parseInt(r[2])-1;return o*n.grid.x+s+1})),{...n,origin:e}}),rnn=n=>{const e=inn.parse(n);let{num_pins:t,grid:i,p:r,w:o,h:s,ball:a,pad:c,missing:l}=e;a??=.75/1.27*r,c??=a*.8;const u=[],d=(l??[]).filter(N=>typeof N=="number"),h=i.x*i.y-t;if(l.length===0&&h>0&&(Math.sqrt(h)%1===0?l.push("center"):h===1&&l.push("topleft")),l?.includes("center")){const N=Math.floor(Math.sqrt(h)),R=Math.floor((i.x-N)/2),k=Math.floor((i.y-N)/2);for(let M=k;M<k+N;M++)for(let I=R;I<R+N;I++)d.push(M*i.x+I+1)}l?.includes("topleft")&&d.push(1);const f=new Set(d);let m=0;for(let N=0;N<i.y;N++)for(let R=0;R<i.x;R++){const k=(R-(i.x-1)/2)*r,M=(N-(i.y-1)/2)*r;let I=R,C=N;switch(e.origin){case"bl":I=R,C=i.y-1-N;break;case"br":I=i.x-1-R,C=i.y-1-N;break;case"tr":I=i.x-1-R,C=N;break}let $=C*i.x+I+1;if(f.has($)){m++;continue}$-=m;const P=[$,`${UHe[C]}${I+1}`];u.push(e.circularpads?BHe(P,{x:k,y:M,radius:c/2}):sr(P,k,M,c,c))}const y=Kr(0,i.y*r/2,.2),g=r/6;let b;const x=i.x*r/2,w=i.y*r/2;switch(e.origin){case"bl":b=[{x:-x,y:-w},{x:-x,y:-w-g},{x:-x-g,y:-w},{x:-x,y:-w}];break;case"br":b=[{x,y:-w},{x,y:-w-g},{x:x+g,y:-w},{x,y:-w}];break;case"tr":b=[{x,y:w},{x,y:w+g},{x:x+g,y:w},{x,y:w}];break;case"tl":default:b=[{x:-x,y:w},{x:-x,y:w+g},{x:-x-g,y:w},{x:-x,y:w}];break}const T={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_marker",route:b,stroke_width:.05};return{circuitJson:[...u,y,T],parameters:e}},q2=n=>Re({fn:U(),num_pins:Fe().optional().default(8),w:st.default(st.parse(n.w??"5.3mm")),p:st.default(st.parse(n.p??"1.27mm")),pw:st.default(st.parse(n.pw??"0.6mm")),pl:st.default(st.parse(n.pl??"1.0mm")),legsoutside:vt().optional().default(n.legsoutside??!1)}).transform(e=>(!e.pw&&!e.pl?(e.pw=st.parse("0.6mm"),e.pl=st.parse("1.0mm")):e.pw?e.pl||(e.pl=e.pw*(1/.6)):e.pw=e.pl*(.6/1),e)),onn=q2({}),spe=n=>{n.widthincludeslegs!==void 0&&(n.legsoutside=!n.widthincludeslegs);const{num_pins:e,pn:t,w:i,p:r,pl:o,legsoutside:s}=n,a=e/2,c=t<=a,l=a-1,u=r,d=u*l,h=s?o/2:-o/2;return c?{x:-i/2-h,y:d/2-(t-1)*u}:{x:i/2+h,y:-d/2+(t-a-1)*u}},snn=n=>{const e=onn.parse(n);return{circuitJson:ww(e),parameters:e}},ww=n=>{const e=[];for(let a=0;a<n.num_pins;a++){const{x:c,y:l}=spe({num_pins:n.num_pins,pn:a+1,w:n.w,p:n.p,pl:n.pl,legsoutside:n.legsoutside});e.push(sr(a+1,c,l,n.pl,n.pw))}const t=Math.min(1,n.p/2),i=n.w-(n.legsoutside?0:n.pl*2)-.2,r=(n.num_pins/2-1)*n.p+n.pw+t,o=Kr(0,r/2+.4,r/12),s={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",stroke_width:.1,route:[{x:-i/2,y:-r/2},{x:-i/2,y:r/2},...LHe.map(({x:a,y:c})=>({x:a*i/6,y:c*i/6+r/2})),{x:i/2,y:r/2},{x:i/2,y:-r/2},{x:-i/2,y:-r/2}]};return[...e,s,o]},jHe=Gt(["leftside","topside","rightside","bottomside","toppin","bottompin","leftpin","rightpin"]),ann=({num_pins:n,cw:e,ccw:t,startingpin:i})=>{const r=[],o=n/4;let s=1;const a={};for(const c of i??[])a[c]=!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=o:a.bottomside&&a.leftpin?s=o+1:a.bottomside&&a.rightpin?s=o*2:a.rightside&&a.bottompin?s=o*2+1:a.rightside&&a.toppin?s=o*3:a.topside&&a.rightpin?s=o*3+1:a.topside&&a.leftpin&&(s=o*4),r.push(-1);for(let c=0;c<n;c++)r[s]=c+1,t||!e?(s++,s>n&&(s=1)):(s--,s<1&&(s=n));return r},ape=Re({fn:U(),cc:vt().default(!0).optional(),ccw:vt().default(!0).optional(),startingpin:U().or(mt(jHe)).transform(n=>typeof n=="string"?n.slice(1,-1).split(","):n).pipe(mt(jHe)).optional(),num_pins:Fe().optional().default(64),w:st.optional(),h:st.optional(),p:st.default(st.parse("0.5mm")),pw:st.optional(),pl:st.optional(),thermalpad:Gn([we(!0),$He]).optional(),legsoutside:vt().default(!1)}),cpe=n=>{n.w&&!n.h?n.h=n.w:!n.w&&n.h&&(n.w=n.h);const e=n.num_pins/4;if(!n.p&&!n.pw&&!n.pl&&n.w){const t=e+4;n.p=n.w/t}return!n.p&&n.w&&n.h&&n.pw&&n.pl&&(n.p=(n.w-n.pl*2)/(e-1)),!n.w&&!n.h&&n.p&&(n.w=n.p*(e+4),n.h=n.w),n.p&&!n.pw&&!n.pl?(n.pw=n.p/2,n.pl=n.p/2):n.pw?n.pl||(n.pl=n.pw*(1/.6)):n.pw=n.pl*(.6/1),n},HHe=ape.transform(cpe),cnn=["left","bottom","right","top"],lnn=n=>{const{pin_count:e,pn:t,w:i,h:r,p:o,pl:s,legsoutside:a}=n,c=e/4,l=cnn[Math.floor((t-1)/c)],u=(t-1)%c,d=o*(c-1),h=o*(c-1),f=a?s/2:-s/2;switch(l){case"left":return{x:-i/2-f,y:h/2-u*o,o:"vert"};case"bottom":return{x:-d/2+u*o,y:-r/2-f,o:"horz"};case"right":return{x:i/2+f,y:-h/2+u*o,o:"vert"};case"top":return{x:d/2-u*o,y:r/2+f,o:"horz"};default:throw new Error("Invalid pin number")}},pP=n=>{const e=HHe.parse(n),t=[],i=ann(e),r=e.num_pins/4;for(let a=0;a<e.num_pins;a++){const{x:c,y:l,o:u}=lnn({pin_count:e.num_pins,pn:a+1,w:e.w,h:e.h,p:e.p??.5,pl:e.pl,legsoutside:e.legsoutside});let d=e.pw,h=e.pl;u==="vert"&&([d,h]=[h,d]);const f=i[a+1];t.push(sr(f,c,l,d,h))}if(e.thermalpad)if(typeof e.thermalpad=="boolean"){const a=e.p*(r-1)+e.pw,c=e.p*(r-1)+e.pw;t.push(sr(["thermalpad"],0,0,a,c))}else t.push(sr(["thermalpad"],0,0,e.thermalpad.x,e.thermalpad.y));const o=[];for(const[a,c,l]of[["top-left",-1,1],["bottom-left",-1,-1],["bottom-right",1,-1],["top-right",1,1]]){const u=e.w/2*c,d=e.h/2*l;let h="none",f=u,m=d;const y=e.pw*2;i[1]===1&&a==="top-left"?h="in1":i[r*4]===1&&a==="top-left"||i[r*3+1]===1&&a==="top-right"?h="in2":i[r*3]===1&&a==="top-right"||i[r]===1&&a==="bottom-left"?h="in1":i[r+1]===1&&a==="bottom-left"?h="in2":i[r*2]===1&&a==="bottom-right"?h="in1":i[r*2+1]===1&&a==="bottom-right"&&(h="in2");const g=h==="in1"?1:-1;if(e.legsoutside){const b=h==="in1"?e.pl/2:e.pw/2,x=h==="in1"?e.pw/2:e.pl/2;f+=b*c*g,m-=x*l*g}(h==="none"||e.legsoutside)&&o.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${a}`,route:[{x:u-y*c,y:d},{x:u,y:d},{x:u,y:d-y*l}],type:"pcb_silkscreen_path",stroke_width:.1}),(h==="in1"||h==="in2")&&!e.legsoutside&&o.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${a}_1`,route:[{x:u-y*c,y:d},{x:u-y*c/2,y:d}],type:"pcb_silkscreen_path",stroke_width:0},{layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${a}_2`,route:[{x:u,y:d-y*l/2},{x:u,y:d-y*l}],type:"pcb_silkscreen_path",stroke_width:.1}),(h==="in1"||h==="in2")&&o.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${a}_3`,route:[{x:f-.2*-c,y:m+.2*g},{x:f,y:m},{x:f+.2*g*-c,y:m+.2},{x:f-.2*-c,y:m+.2*g}],type:"pcb_silkscreen_path",stroke_width:.1})}const s=Kr(0,e.h/2+(e.legsoutside?e.pl*1.2:.5),.3);return{circuitJson:[...t,...o,s],parameters:e}};ape.extend({}).transform(cpe);var unn=n=>(n.legsoutside=!1,pP(n)),dnn=n=>{n.legsoutside=!0;const e=HHe.parse(n);if(!n.p)switch(n.num_pins){case 44:case 64:n.p=.8;break;case 52:n.w===14?n.p=1:n.p=.65;break;case 208:n.p=.5;break}if(!n.pl)switch(n.num_pins){case 44:case 52:case 64:n.pl=2.25;break;case 208:n.pl=1.65;break;default:n.pl=e.pl*4;break}if(!n.pw)switch(n.num_pins){case 44:case 64:n.pw=.5;break;case 52:n.w===14?n.pw=.45:n.pw=.55;break;case 208:n.pw=.3;break;default:n.pw=e.pw;break}return pP(n)};ape.extend({}).transform(cpe);var hnn=n=>(n.legsoutside=!1,n.thermalpad===void 0&&(n.thermalpad=!0),pP(n)),pnn=q2({w:"3.9mm",p:"1.27mm"}),fnn=n=>{const e=pnn.parse(n);return{circuitJson:ww(e),parameters:e}},mnn=q2({w:"7.1mm",p:"0.65mm",pl:"1.35mm",pw:"0.40mm",legsoutside:!0}),_nn=n=>{const e=mnn.parse(n);return{circuitJson:ww(e),parameters:e}},ynn=q2({}),gnn=n=>{const e=ynn.parse({fn:"sot363",num_pins:6,w:1.94,p:.65,pw:.3,pl:.7,legoutside:!0});return{circuitJson:ww(e),parameters:e}},VHe=Re({fn:U(),num_pins:Fe().default(3),w:U().default("1.92mm"),h:U().default("2.74mm"),pl:U().default("0.8mm"),pw:U().default("0.764mm"),p:U().default("0.95mm"),string:U().optional()}),vnn=q2({p:"0.95mm",w:"1.6mm",legsoutside:!0}),xnn=n=>{const e=n.string?.match(/^sot23_(\d+)/),t=e?Number.parseInt(e[1],10):3;if(t===6||t===8){const r=vnn.parse({...n,num_pins:t});return{circuitJson:ww(r),parameters:r}}const i=VHe.parse({...n,num_pins:t});if(i.num_pins===3)return{circuitJson:wnn(i),parameters:i};if(i.num_pins===5)return{circuitJson:GHe(i),parameters:i};throw new Error("Invalid number of pins")},bnn=n=>{const{pn:e}=n;return e===1?{x:-1.7,y:0}:e===2?{x:1.7,y:-.95}:{x:1.7,y:.95}},wnn=n=>{const e=[];for(let i=0;i<n.num_pins;i++){const{x:r,y:o}=bnn({num_pins:n.num_pins,pn:i+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl)});e.push(sr(i+1,r,o,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=Kr(0,Number.parseInt(n.h),.3);return[...e,t]},qHe=n=>{const{p:e,h:t,pn:i}=n;if(i===1)return{x:-t/2-.5,y:e};if(i===2)return{x:-t/2-.5,y:0};if(i===3)return{x:-t/2-.5,y:-e};if(i===4)return{x:t/2+.5,y:-e};if(i===5)return{x:t/2+.5,y:e};throw new Error("Invalid pin number")},GHe=n=>{const e=[];for(let d=1;d<=n.num_pins;d++){const{x:h,y:f}=qHe({h:Number.parseFloat(n.h),p:Number.parseFloat(n.p),pn:d});e.push(sr(d,h,f,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=(n.num_pins+1)/2*Number.parseFloat(n.p),i=Number.parseFloat(n.h),r={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-t/3,y:i/2+Number.parseFloat(n.p)/1.3},{x:t/3,y:i/2+Number.parseFloat(n.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-t/3,y:-i/2-Number.parseFloat(n.p)/1.3},{x:t/3,y:-i/2-Number.parseFloat(n.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},s=Kr(0,i+.3,.3),a=qHe({h:Number.parseFloat(n.h),p:Number.parseFloat(n.p),pn:1});a.x=a.x-Number.parseFloat(n.pw)*1.5;const c=.7,l=.3,u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:a.x+c/2,y:a.y},{x:a.x-c/2,y:a.y+l/2},{x:a.x-c/2,y:a.y-l/2},{x:a.x+c/2,y:a.y}],stroke_width:.05};return[...e,s,r,o,u]},Snn=VHe.extend({}),Enn=n=>{const e=Snn.parse({...n,num_pins:5});return{circuitJson:GHe(e),parameters:e}},Tnn=[{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}],Mnn=q2({}),Cnn=n=>{const e=Mnn.parse(n),t=[];for(let d=0;d<e.num_pins;d++){const{x:h,y:f}=spe({num_pins:e.num_pins,pn:d+1,w:e.w,p:e.p??1.27,pl:e.pl,widthincludeslegs:!0});t.push(sr(d+1,h,f,e.pl??"1mm",e.pw??"0.6mm"))}const i=Math.min(1,e.p/2),r=e.w+i,o=(e.num_pins/2-1)*e.p+e.pw+i,s=[];for(const d of Tnn){const{dx:h,dy:f}=d;s.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",route:[{x:h*r/2-h*e.p,y:f*o/2},{x:h*r/2,y:f*o/2},{x:h*r/2,y:f*o/2-f*e.p}],type:"pcb_silkscreen_path",stroke_width:.1})}const a=e.p/4,c=-r/2-a/2,l=o/2-e.p/2;s.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:c,y:l},{x:c-a,y:l+a},{x:c-a,y:l-a},{x:c,y:l}],stroke_width:.1});const u=Kr(0,o/2+.4,o/12);return{circuitJson:[...t,u,...s],parameters:e}},MU=(n,e,t,i,r,o)=>({pcb_plated_hole_id:"",type:"pcb_plated_hole",shape:"circular_hole_with_rect_pad",x:e,y:t,hole_diameter:Xu(i),hole_shape:"circle",pad_shape:"rect",rect_pad_width:Xu(r),rect_pad_height:Xu(o),pcb_port_id:"",layers:["top","bottom"],port_hints:[n.toString()]}),lpe=({fs:n,pn:e,anchor_x:t,anchor_y:i,textalign:r="center",orthogonal:o=!1,verticallyinverted:s=!1,layer:a="top"})=>{let c=0;o&&s?c=270:s?c=180:o?c=90:c=0;let l="center";return r==="left"&&(s?l="center_right":l="center_left"),r==="right"&&(s?l="center_left":l="center_right"),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:n,pcb_component_id:"pcb_component_1",text:`{PIN${e}}`,layer:a,anchor_position:{x:t,y:i},anchor_alignment:l,ccw_rotation:c}};function Ann({pinlabeltextalignleft:n,pinlabeltextalignright:e,pinlabelorthogonal:t}){let i="top";return t?i="left":i="top",n&&(t?i="bottom":i="right"),e&&(t?i="top":i="left"),i}var Rnn=Re({fn:U(),num_pins:Fe().optional().default(6),rows:Gn([U(),Fe()]).transform(n=>Number(n)).optional().default(1).describe("number of rows"),p:st.default("0.1in").describe("pitch"),id:st.default("1.0mm").describe("inner diameter"),od:st.default("1.5mm").describe("outer diameter"),male:vt().optional().describe("for male pin headers"),female:vt().optional().describe("for female pin headers"),pinlabeltextalignleft:vt().optional().default(!1),pinlabeltextaligncenter:vt().optional().default(!1),pinlabeltextalignright:vt().optional().default(!1),pinlabelverticallyinverted:vt().optional().default(!1),pinlabelorthogonal:vt().optional().default(!1),nosquareplating:vt().optional().default(!1).describe("do not use rectangular pad for pin 1"),nopinlabels:vt().optional().default(!1).describe("omit silkscreen pin labels"),doublesidedpinlabel:vt().optional().default(!1).describe("add silkscreen pins in top and bottom layers"),bottomsidepinlabel:vt().optional().default(!1).describe("place the silkscreen reference text on the bottom layer instead of top")}).transform(n=>{const e=Ann(n);return{...n,pinlabelAnchorSide:e,male:n.male??!n.female,female:n.female??!1}}).superRefine((n,e)=>{n.male&&n.female&&e.addIssue({code:_i.custom,message:"'male' and 'female' cannot both be true; it should be male or female.",path:["male","female"]})}),Pnn=n=>{const e=Rnn.parse(n),{p:t,id:i,od:r,rows:o,num_pins:s,pinlabelAnchorSide:a,pinlabelverticallyinverted:c,pinlabelorthogonal:l,pinlabeltextalignleft:u,pinlabeltextalignright:d,nopinlabels:h,doublesidedpinlabel:f,bottomsidepinlabel:m}=e;let y="center";u?y="left":d&&(y="right");const g=[],b=Math.ceil(s/o),x=-t,w=({xoff:M,yoff:I,od:C,anchorSide:$})=>{let P=0,H=0;const G=C*.75;switch($){case"right":P=G;break;case"top":H=G;break;case"bottom":H=-G;break;case"left":P=-G;break}return{anchor_x:M+P,anchor_y:I+H}},T=(M,I,C)=>{M===1&&!e.nosquareplating?g.push(MU(M,I,C,i,r,r)):g.push(Os(M,I,C,i,r));const{anchor_x:$,anchor_y:P}=w({xoff:I,yoff:C,od:r,anchorSide:a});h||(m?g.push(lpe({fs:r/5,pn:M,anchor_x:$,anchor_y:P,textalign:y,orthogonal:l,verticallyinverted:c,layer:"bottom"})):g.push(lpe({fs:r/5,pn:M,anchor_x:$,anchor_y:P,textalign:y,orthogonal:l,verticallyinverted:c,layer:"top"})),f&&g.push(lpe({fs:r/5,pn:M,anchor_x:$,anchor_y:P,textalign:y,orthogonal:l,verticallyinverted:c,layer:"bottom"})))},N=new Set,R=o>2&&b>2;if(o===1){const M=-((s-1)/2)*t;for(let I=0;I<s;I++){const C=I+1,$=M+I*t,P=`${$},0`;if(N.has(P))throw new Error(`Overlap at ${P}`);N.add(P),T(C,$,0)}}else if(R){const M=-((b-1)/2)*t;let I=1;for(let C=0;C<o&&I<=s;C++)for(let $=0;$<b&&I<=s;$++){const P=M+$*t,H=C*x,G=`${P},${H}`;if(N.has(G))throw new Error(`Overlap at ${G}`);N.add(G),T(I++,P,H)}}else{const M=-((b-1)/2)*t;let I=1,C=0,$=o-1,P=0,H=b-1;for(;I<=s&&C<=$&&P<=H;){for(let G=C;G<=$&&I<=s;G++){const X=M+P*t,W=G*x,K=`${X},${W}`;if(N.has(K))throw new Error(`Overlap at ${K}`);N.add(K),T(I++,X,W)}P++;for(let G=P;G<=H&&I<=s;G++){const X=M+G*t,W=$*x,K=`${X},${W}`;if(N.has(K))throw new Error(`Overlap at ${K}`);N.add(K),T(I++,X,W)}if($--,P<=H){for(let G=$;G>=C&&I<=s;G--){const X=M+H*t,W=G*x,K=`${X},${W}`;if(N.has(K))throw new Error(`Overlap at ${K}`);N.add(K),T(I++,X,W)}H--}if(C<=$){for(let G=H;G>=P&&I<=s;G--){const X=M+G*t,W=C*x,K=`${X},${W}`;if(N.has(K))throw new Error(`Overlap at ${K}`);N.add(K),T(I++,X,W)}C++}}if(I-1<s)throw new Error(`Missing pins: assigned ${I-1}, expected ${s}`)}const k=Kr(0,t,.5);return{circuitJson:[...g,k],parameters:e}},Inn=q2({}),Nnn=n=>{const e=Inn.parse({fn:"sot563",num_pins:6,w:1.94,p:.5,pw:.3,pl:.67,legoutside:!0});return{circuitJson:ww(e),parameters:e}},knn=q2({p:"1.27mm",w:"3.9mm",legsoutside:!0}),Onn=n=>{const e=knn.parse({...n,num_pins:8});return{circuitJson:ww(e),parameters:e}},Dnn=q2({p:"1.27mm",w:"7.5mm",legsoutside:!0}),Lnn=n=>{const e=Dnn.parse({...n,num_pins:16});return{circuitJson:ww(e),parameters:e}},znn=Re({fn:U(),num_pins:we(3).default(3),w:U().default("1.2mm"),h:U().default("1.2mm"),pl:U().default("0.3mm"),pw:U().default("0.32mm")}),Fnn=n=>{const e=znn.parse(n),t=Unn(e),i=Kr(.4,st.parse(e.h),.2);return{circuitJson:[...t,i],parameters:e}},Bnn=n=>{const{pn:e}=n;return e===1?{x:0,y:0}:e===2?{x:1,y:-.4}:{x:1,y:.4}},Unn=n=>{const e=[];for(let t=0;t<3;t++){const{x:i,y:r}=Bnn({num_pins:n.num_pins,pn:t+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl)});e.push(sr(t+1,i,r,Number.parseFloat(n.pl),t!==0?Number.parseFloat(n.pw):.42))}return e},$nn=Re({fn:U(),num_pins:we(2).default(2),w:U().default("2.36mm"),h:U().default("1.22mm"),pl:U().default("0.9mm"),pw:U().default("0.9mm"),p:U().default("4.19mm")}),jnn=n=>{const e=$nn.parse(n),t=Kr(0,st.parse(e.h)/4+.4,.3);return{circuitJson:Vnn(e).concat(t),parameters:e}},Hnn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Vnn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Hnn({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},qnn=Re({fn:U(),p:st.optional().default("2.54mm"),id:st.optional().default("0.7mm"),od:st.optional().default("1mm")}),Gnn=n=>{const e=qnn.parse(n),{p:t,id:i,od:r}=e,o=[Os(1,-t/2,0,i,r),Os(2,t/2,0,i,r)],s={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-t/2+r+i/2,y:0},{x:t/2-r-i/2,y:0}],stroke_width:.1,pcb_silkscreen_path_id:""},a=Kr(0,t/4,.5);return{circuitJson:[...o,s,a],parameters:e}},CU=(n,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:n,stroke_width:e.stroke_width||.1}),Ynn=Re({fn:we("pushbutton"),w:st.default(4.5),h:st.default(6.5),id:st.default(1),od:st.default(1.2)}),Xnn=n=>{const e=Ynn.parse(n),t=e.w,i=e.h,r=e.id,o=[Os(1,-t/2,i/2,r,r*1.5),Os(2,-t/2,-i/2,r,r*1.5),Os(3,t/2,-i/2,r,r*1.5),Os(4,t/2,i/2,r,r*1.5)],s=[CU([{x:-t/2,y:-i/2},{x:-t/2,y:i/2}]),CU([{x:t/2,y:-i/2},{x:t/2,y:i/2}]),CU([{x:-t/2,y:0},{x:-t/5,y:0},{x:t/5*1/Math.sqrt(2),y:i/8}]),CU([{x:t/2,y:0},{x:t/5,y:0}])],a=Kr(0,i/2+.4,.5);return{circuitJson:[...o,...s,a],parameters:e}},YHe=Re({fn:U(),w:st.default("22.58mm"),h:st.optional(),left:st.optional().default(20),right:st.optional().default(20),top:st.optional().default(2),bottom:st.optional().default(2),p:st.default(st.parse("2.54mm")),pw:st.default(st.parse("1.6mm")),pl:st.default(st.parse("2.4mm")),innerhole:vt().default(!1),innerholeedgedistance:st.default(st.parse("1.61mm"))}),Wnn=n=>{const e=YHe.parse(n);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},AU=(n,e,t)=>{let i=[];return t==="right"&&(i=[{x:n+1/2,y:e},{x:n-1/2,y:e+.6/2},{x:n-1/2,y:e-.6/2},{x:n+1/2,y:e}]),t==="left"&&(i=[{x:n-1/2,y:e},{x:n+1/2,y:e+.6/2},{x:n+1/2,y:e-.6/2},{x:n-1/2,y:e}]),t==="top"&&(i=[{x:n,y:e+1/2},{x:n-.6/2,y:e-1/2},{x:n+.6/2,y:e-1/2},{x:n,y:e+1/2}]),t==="bottom"&&(i=[{x:n,y:e-1/2},{x:n-.6/2,y:e+1/2},{x:n+.6/2,y:e+1/2},{x:n,y:e-1/2}]),i},Znn=n=>{const e=YHe.parse(n),t=e.h??Wnn(e),i=[],r=[];let o=[];const s=1,a=1.2,c=e.left+e.right+(e.bottom??0)+(e.top??0);if(e.right){const h=-((e.right-1)/2)*e.p;for(let f=0;f<e.right;f++)f===0&&!e.left&&!e.bottom&&(o=AU(e.w/2-e.pl*1.4,h+f*e.p,"right")),i.push(sr(f+1+e.left+(e.bottom??0),e.w/2-e.pl/2,h+f*e.p,e.pl,e.pw)),e.innerhole&&(r.push(Os(f+1+e.left+(e.bottom??0)+c,e.w/2,h+f*e.p,s,a)),r.push(Os(f+1+e.left+(e.bottom??0)+c*2,e.w/2-e.innerholeedgedistance,h+f*e.p,s,a)))}if(e.left){const h=-((e.left-1)/2)*e.p;for(let f=0;f<e.left;f++)f===e.left-1&&(o=AU(-e.w/2+e.pl*1.4,h+f*e.p,"left")),i.push(sr(f+1,-e.w/2+e.pl/2,h+f*e.p,e.pl,e.pw)),e.innerhole&&(r.push(Os(f+1+c,-e.w/2,h+f*e.p,s,a)),r.push(Os(f+1+c*2,-e.w/2+e.innerholeedgedistance,h+f*e.p,s,a)))}if(e.top){const h=-((e.top-1)/2)*e.p;for(let f=0;f<e.top;f++)f===e.top-1&&!e.left&&!e.bottom&&!e.right&&(o=AU(h+f*e.p,t/2-e.pl*1.4,"top")),i.push(sr(f+1+e.left+e.right+(e.bottom??0),h+f*e.p,t/2-e.pl/2,e.pw,e.pl)),e.innerhole&&(r.push(Os(f+1+e.left+e.right+(e.bottom??0)+c,h+f*e.p,t/2,s,a)),r.push(Os(f+1+e.left+e.right+(e.bottom??0)+c*2,h+f*e.p,t/2-e.innerholeedgedistance,s,a)))}if(e.bottom){const h=-((e.bottom-1)/2)*e.p;for(let f=0;f<e.bottom;f++)f===0&&!e.left&&(o=AU(h+f*e.p,-t/2+e.pl*1.4,"bottom")),i.push(sr(f+1+e.left,h+f*e.p,-t/2+e.pl/2,e.pw,e.pl)),e.innerhole&&(r.push(Os(f+1+e.left+c,h+f*e.p,-t/2,s,a)),r.push(Os(f+1+e.left+c*2,h+f*e.p,-t/2+e.innerholeedgedistance,s,a)))}const l={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_triangle_1",pcb_component_id:"2",route:o,stroke_width:.1,layer:"top"},u={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-e.w/2,y:t/2},{x:e.w/2,y:t/2},{x:e.w/2,y:-t/2},{x:-e.w/2,y:-t/2},{x:-e.w/2,y:t/2}],stroke_width:.1,layer:"top"},d=Kr(0,t/1.8,t/25);return{circuitJson:[...i,...r,u,l,d],parameters:e}},XHe=Re({fn:U(),w:st.default("22.58mm"),h:st.optional(),left:st.optional().default(20),right:st.optional().default(20),top:st.optional().default(2),bottom:st.optional().default(2),p:st.default(st.parse("2.54mm")),pw:st.default(st.parse("1.6mm")),pl:st.default(st.parse("3.2mm")),innerhole:vt().default(!1),innerholeedgedistance:st.default(st.parse("1.61mm"))}),Knn=n=>{const e=XHe.parse(n);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},Qnn=(n,e,t,i=1,r=.6)=>{const o=i/2,s=r/2;return{left:[{x:n+o,y:e},{x:n-o,y:e+s},{x:n-o,y:e-s},{x:n+o,y:e}],right:[{x:n-o,y:e},{x:n+o,y:e+s},{x:n+o,y:e-s},{x:n-o,y:e}],top:[{x:n,y:e-o},{x:n-s,y:e+o},{x:n+s,y:e+o},{x:n,y:e-o}],bottom:[{x:n,y:e+o},{x:n-s,y:e-o},{x:n+s,y:e-o},{x:n,y:e+o}]}[t]},Jnn=n=>{const e=XHe.parse(n),t=e.h??Knn(e),i=[],r=[],o=[],s=1,a=1.2,c=e.left+e.right+(e.bottom??0)+(e.top??0);let l=[],u=1;if(e.left){const m=(e.left-1)/2*e.p;for(let y=0;y<e.left;y++)y===0&&(l=Qnn(-e.w/2-e.pl/2,m-y*e.p,"left")),i.push(sr(u,-e.w/2+e.pl/2,m-y*e.p,e.pl,e.pw)),r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${u}`,pcb_component_id:"1",layer:"top",anchor_position:{x:-e.w/2+e.pl/2-4.5,y:m-y*e.p},text:`pin${u}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),u++,e.innerhole&&o.push(Os(u+c,-e.w/2+e.innerholeedgedistance,m-y*e.p,s,a))}if(e.bottom){const m=(e.bottom-1)/2*e.p;for(let y=e.bottom-1;y>=0;y--)i.push(sr(u,m-y*e.p,-t/2+e.pl/2,e.pw,e.pl)),r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${u}`,pcb_component_id:"1",layer:"top",anchor_position:{x:m-y*e.p,y:-t/2+e.pl/2-3.2},text:`pin${u}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),u++,e.innerhole&&o.push(Os(u+c,m-y*e.p,-t/2+e.innerholeedgedistance,s,a))}if(e.right){const m=-((e.right-1)/2)*e.p;for(let y=0;y<e.right;y++)i.push(sr(u,e.w/2-e.pl/2,m+y*e.p,e.pl,e.pw)),r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${u}`,pcb_component_id:"1",layer:"top",anchor_position:{x:e.w/2-e.pl/2+3.7,y:m+y*e.p},text:`pin${u}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),u++,e.innerhole&&o.push(Os(u+c,e.w/2-e.innerholeedgedistance,m+y*e.p,s,a))}if(e.top){const m=-((e.top-1)/2)*e.p;for(let y=e.top-1;y>=0;y--)i.push(sr(u,m+y*e.p,t/2-e.pl/2,e.pw,e.pl)),r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${u}`,pcb_component_id:"1",layer:"top",anchor_position:{x:m+y*e.p,y:t/2-e.pl/2+3.2},text:`pin${u}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),u++,e.innerhole&&o.push(Os(u+c,m+y*e.p,t/2-e.innerholeedgedistance,s,a))}const d={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"1",pcb_component_id:"1",layer:"top",route:l,stroke_width:.1},h={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:t/2+e.pl/3},{x:e.w/2+e.pl/3,y:t/2+e.pl/3},{x:e.w/2+e.pl/3,y:-t/2-e.pl/3},{x:-e.w/2-e.pl/3,y:-t/2-e.pl/3},{x:-e.w/2-e.pl/3,y:t/2+e.pl/3}],stroke_width:.1,layer:"top"},f=Kr(0,t/1.8,t/25);return{circuitJson:[...o,...i,...r,h,d,f],parameters:e}},ein=n=>(n.legsoutside=!0,pP(n)),WHe=Re({fn:U(),w:st.default("10mm"),h:st.optional(),left:st.optional().default(20),right:st.optional().default(20),top:st.optional().default(0),bottom:st.optional().default(0),p:st.default(st.parse("2.54mm")),id:st.optional().default(st.parse("1mm")),od:st.optional().default(st.parse("1.5mm"))}),tin=n=>{const e=WHe.parse(n);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},RU=(n,e,t,i=1,r=.6)=>{const o=i/2,s=r/2;return{left:[{x:n+o,y:e},{x:n-o,y:e+s},{x:n-o,y:e-s},{x:n+o,y:e}],right:[{x:n-o,y:e},{x:n+o,y:e+s},{x:n+o,y:e-s},{x:n-o,y:e}],top:[{x:n,y:e-o},{x:n-s,y:e+o},{x:n+s,y:e+o},{x:n,y:e-o}],bottom:[{x:n,y:e+o},{x:n-s,y:e-o},{x:n+s,y:e-o},{x:n,y:e+o}]}[t]},nin=n=>{const e=WHe.parse(n),t=e.h??tin(e),i=[],r=e.id,o=e.od;let s=[];if(e.right){const u=-((e.right-1)/2)*e.p;for(let d=0;d<e.right;d++)d===0&&!e.left&&!e.bottom&&(s=RU(e.w/2+o*1.4,u+d*e.p,"right")),i.push(Os(d+1+e.left+(e.bottom??0),e.w/2,u+d*e.p,r,o))}if(e.left){const u=-((e.left-1)/2)*e.p;for(let d=0;d<e.left;d++)d===e.left-1&&(s=RU(-e.w/2-o*1.4,u+d*e.p,"left")),i.push(Os(d+1,-e.w/2,u+d*e.p,r,o))}if(e.top){const u=-((e.top-1)/2)*e.p;for(let d=0;d<e.top;d++)d===e.top-1&&!e.left&&!e.bottom&&!e.right&&(s=RU(u+d*e.p,t/2+o*1.4,"top")),i.push(Os(d+1+e.right+(e.bottom??0)+e.left,u+d*e.p,t/2,r,o))}if(e.bottom){const u=-((e.bottom-1)/2)*e.p;for(let d=0;d<e.bottom;d++)d===0&&!e.left&&(s=RU(u+d*e.p,-t/2-o*1.4,"bottom")),i.push(Os(d+1+e.left,u+d*e.p,-t/2,r,o))}const a={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"1",pcb_component_id:"1",layer:"top",route:s,stroke_width:.1},c={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-e.w/2-o,y:t/2+o},{x:e.w/2+o,y:t/2+o},{x:e.w/2+o,y:-t/2-o},{x:-e.w/2-o,y:-t/2-o},{x:-e.w/2-o,y:t/2+o}],stroke_width:.1,layer:"top"},l=Kr(0,t/1.7,t/25);return{circuitJson:[...i,c,l,a],parameters:e}},ZHe=(n,e,t,i)=>Array.from({length:25},(r,o)=>{const s=o/24*Math.PI-Math.PI/2;return{x:n+(i==="right"?1:-1)*Math.cos(s)*t,y:e+Math.sin(s)*t}}),iin=Re({fn:U(),p:st.optional().default("4.88mm"),id:st.optional().default("0.6mm"),od:st.optional().default("1.2mm"),w:st.optional().default("5.6mm"),h:st.optional().default("3.5mm")}),rin=n=>{const e=iin.parse(n),{p:t,id:i,od:r,w:o,h:s}=e,a=s/2,c=[Os(1,-t/2,0,i,r),Os(2,t/2,0,i,r)],l=ZHe(-o/2,0,a,"left"),u=ZHe(o/2,0,a,"right"),d={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[...l,...l.slice(1).reverse(),{x:-o/2,y:-s/2},{x:o/2,y:-s/2},...u,{x:o/2,y:s/2},{x:-o/2,y:s/2}],stroke_width:.1,pcb_silkscreen_path_id:""},h=Kr(0,t/4,.5);return{circuitJson:[...c,d,h],parameters:e}};Re({w:st,h:st});var oin=n=>{const{w:e,h:t}=n,i=Xu(e),r=Xu(t);return{circuitJson:[sr(1,0,0,i,r),Kr(0,r/2+.5,.2)],parameters:n}},sin=Re({fn:U(),num_pins:Gn([we(3),we(2)]).default(3),p:U().default("1.27mm"),id:U().default("0.72mm"),od:U().default("0.95mm"),w:U().default("4.5mm"),h:U().default("4.5mm"),inline:vt().default(!1),string:U().optional()}),ain=(n,e,t)=>Array.from({length:25},(i,r)=>{const o=r/24*Math.PI;return{x:n+Math.cos(o)*t,y:e+Math.sin(o)*t}}),cin=n=>{const{p:e,id:t,od:i,h:r}=n,o=Number.parseFloat(r)/2,s=Number.parseFloat(e);return[Os(1,-s,o-s,t,i),Os(2,s,o-s,t,i)]},lin=n=>{const e=n.string?.match(/^to92_(\d+)/),t=e?Number.parseInt(e[1],10):3,i=sin.parse({...n,num_pins:t}),{p:r,id:o,od:s,w:a,h:c,inline:l}=i,u=Number.parseFloat(c)/2,d=Number.parseFloat(r);let h=[];if(i.num_pins===3)h=l?[Os(1,-d,u-d,o,s),Os(2,0,u-d,o,s),Os(3,d,u-d,o,s)]:[Os(1,0,u,o,s),Os(2,-d,u-d,o,s),Os(3,d,u-d,o,s)];else if(i.num_pins===2)h=cin(i);else throw new Error("Invalid number of pins for TO-92");const f=Number.parseFloat(a)/2,m=ain(0,u,f),y={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[...m,{x:-f,y:0},{x:f,y:0},m[0]],stroke_width:.1,pcb_silkscreen_path_id:""},g=Kr(0,u+1,.5);return{circuitJson:[...h,y,g],parameters:i}},uin=Re({fn:U(),num_pins:we(2).default(2),w:U().default("2.15mm"),h:U().default("1.20mm"),pl:U().default("0.5mm"),pw:U().default("0.6mm"),p:U().default("1.4mm")}),din=n=>{const e=uin.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:pin(e).concat(i,t),parameters:e}},hin=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},pin=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=hin({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},fin=q2({}),min=n=>{const e=fin.parse(n),t=[];for(let s=0;s<e.num_pins;s++){const{x:a,y:c}=spe({num_pins:e.num_pins,pn:s+1,w:e.w,p:e.p??1.27,pl:e.pl,widthincludeslegs:!0});t.push(sr(s+1,a,c,e.pl??"1.5mm",e.pw??"0.6mm"))}const i=(e.num_pins/2-1)*e.p+e.pw,r=Kr(0,i/2-.5,i/12),o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:-e.w/3,y:i/2+.2},{x:e.w/3,y:i/2+.2}],stroke_width:.1};return{circuitJson:[...t,r,o],parameters:e}},_in=Re({fn:U(),num_pins:we(2).default(2),w:U().default("5.0mm"),h:U().default("2.30mm"),pl:U().default("1.25mm"),pw:U().default("2mm"),p:U().default("3.75mm")}),yin=n=>{const e=_in.parse(n),t=Kr(0,st.parse(e.h)/2+1,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2+.5,y:st.parse(e.h)/2+.5},{x:-st.parse(e.w)/2-.5,y:st.parse(e.h)/2+.5},{x:-st.parse(e.w)/2-.5,y:-st.parse(e.h)/2-.5},{x:st.parse(e.p)/2+.5,y:-st.parse(e.h)/2-.5}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:vin(e).concat(i,t),parameters:e}},gin=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},vin=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=gin({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},xin=Re({fn:U(),num_pins:we(2).default(2),w:U().default("4.4mm"),h:U().default("2.1mm"),pl:U().default("1.2mm"),pw:U().default("1.2mm"),p:U().default("2.9mm")}),bin=n=>{const e=xin.parse(n),t=Kr(0,st.parse(e.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Sin(e).concat(i,t),parameters:e}},win=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Sin=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=win({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Ein=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.30mm"),h:U().default("1.80mm"),pl:U().default("0.60mm"),pw:U().default("0.45mm"),p:U().default("2.1mm")}),Tin=n=>{const e=Ein.parse(n),t=Kr(0,st.parse(e.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Cin(e).concat(i,t),parameters:e}},Min=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Cin=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Min({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Ain=Re({fn:U(),num_pins:we(2).default(2),w:U().default("1.4mm"),h:U().default("0.9mm"),pl:U().default("0.35mm"),pw:U().default("0.25mm"),p:U().default("1.2mm")}),Rin=n=>{const e=Ain.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2+.15,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.4,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.4,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2+.15,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Iin(e).concat(i,t),parameters:e}},Pin=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Iin=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Pin({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Nin=Re({fn:U(),num_pins:we(2).default(2),w:U().default("1.3mm"),h:U().default("0.9mm"),pl:U().default("0.4mm"),pw:U().default("0.7mm"),p:U().default("0.7mm")}),kin=n=>{const e=Nin.parse(n),t=Kr(0,st.parse(e.h)+.1,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2+.2,y:st.parse(e.h)/2+.2},{x:-st.parse(e.w)/2-.2,y:st.parse(e.h)/2+.2},{x:-st.parse(e.w)/2-.2,y:-st.parse(e.h)/2-.2},{x:st.parse(e.p)/2+.2,y:-st.parse(e.h)/2-.2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Din(e).concat(i,t),parameters:e}},Oin=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Din=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Oin({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Lin=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3,05mm"),h:U().default("1.65mm"),pl:U().default("0.6mm"),pw:U().default("0.6mm"),pad_spacing:U().default("2.2mm")}),zin=n=>{const e=Lin.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.pad_spacing)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:-st.parse(e.h)/2},{x:st.parse(e.pad_spacing)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Bin(e).concat(i,t),parameters:e}},Fin=n=>{const{pn:e,pad_spacing:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Bin=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Fin({pn:t,pad_spacing:Number.parseFloat(n.pad_spacing)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Uin=Re({fn:U(),num_pins:we(2).default(2),w:U().default("4.4mm"),h:U().default("2.1mm"),pl:U().default("1.2mm"),pw:U().default("1.2mm"),p:U().default("2.9mm")}),$in=n=>{const e=Uin.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Hin(e).concat(i,t),parameters:e}},jin=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Hin=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=jin({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Vin=Re({fn:U(),num_pins:we(2).default(2),w:U().default("4.4mm"),h:U().default("2.1mm"),pl:U().default("0.91mm"),pw:U().default("1.22mm"),p:U().default("3.146mm")}),qin=n=>{const e=Vin.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Yin(e).concat(i,t),parameters:e}},Gin=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Yin=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Gin({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Xin=Re({fn:U(),num_pins:we(2).default(2),w:U().default("1.80mm"),h:U().default("1.00mm"),pl:U().default("0.66mm"),pw:U().default("0.5mm"),p:U().default("0.8mm")}),Win=n=>{const e=Xin.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.1,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.1,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Kin(e).concat(i,t),parameters:e}},Zin=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Kin=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Zin({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Qin=Re({fn:U(),num_pins:we(2).default(2),w:U().default("6.2mm"),h:U().default("3.4mm"),pl:U().default("1.4mm"),pw:U().default("2.1mm"),p:U().default("4.4mm")}),Jin=n=>{const e=Qin.parse(n),t=Kr(0,st.parse(e.h)/2+.4,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:trn(e).concat(i,t),parameters:e}},ern=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},trn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=ern({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},nrn=Re({fn:U(),num_pins:Gn([we(3),we(5)]).default(3),w:U().default("4.80mm"),h:U().default("4.80mm"),pl:U().default("1.3mm"),pw:U().default("0.9mm"),p:U().default("1.5mm"),string:U().optional()}),irn=n=>{const e=[],t=Number.parseFloat(n.p),i=Number.parseFloat(n.pw),r=Number.parseFloat(n.w),o=Number.parseFloat(n.pl);e.push(sr(1,-r/2,t,o,i),sr(2,-r/2+(1.5-1.3)/2,0,1.5,i),sr(3,-r/2,-t,o,i));const s=Kr(0,0,.3),a=Number.parseFloat(n.w)/2-1,c=Number.parseFloat(n.h)/2,l={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-a,y:c},{x:a,y:c},{x:a,y:c/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},u={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-a,y:-c},{x:a,y:-c},{x:a,y:-c/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,l,u,s]},rrn=n=>{const e=[];Number.parseFloat(n.p),Number.parseFloat(n.pw),Number.parseFloat(n.w),e.push(sr(1,-1.85,-1.5,1.5,.7),sr(2,-1.85,1.5,1.5,.7),sr(3,0,0,.8,2),sr(4,1.85,-1.5,1.5,.7),sr(5,1.85,1.5,1.5,.7));const t=Kr(0,Number.parseFloat(n.h)/2+.5,.3),i=Number.parseFloat(n.w)/2-1,r=Number.parseFloat(n.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:r},{x:i,y:r}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-r},{x:i,y:-r}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,o,s,t]},orn=n=>{const e=n.string?.match(/^sot89_(\d+)/),t=e?Number.parseInt(e[1],10):3,i=nrn.parse({...n,num_pins:t});if(i.num_pins===3)return{circuitJson:irn(i),parameters:i};if(i.num_pins===5)return{circuitJson:rrn(i),parameters:i};throw new Error("Invalid number of pins for SOT89")},srn=Re({fn:U(),p:st.optional().default("5.0mm"),id:st.optional().default("1.0mm"),od:st.optional().default("1.9mm"),w:st.optional().default("13mm"),h:st.optional().default("7mm"),num_pins:Fe().optional(),string:U().optional()}),arn=n=>{const e=srn.parse(n),{fn:t,id:i,od:r,w:o,h:s,string:a}=e,c=Number.parseInt(a?.split("_")[1]??"3"),l=-1,u=o/2,d=s/2,h=2.5,f=o*.4,m=Math.max(h,f/(c-1)),y=Array.from({length:c},(N,R)=>{const k=c%2===0?(R-c/2+.5)*m:(R-Math.floor(c/2))*m;return Os(R+1,k,l,i,r)}),g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-u,y:-d},{x:u,y:-d},{x:u,y:d},{x:-u,y:d},{x:-u,y:-d}],stroke_width:.1,pcb_silkscreen_path_id:""},b=-d+2*s/3,x={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-u,y:b},{x:u,y:b}],stroke_width:.1,pcb_silkscreen_path_id:""},w=[{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-o/6,y:b},{x:-o/6,y:d}],stroke_width:.1,pcb_silkscreen_path_id:""},{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:o/6,y:b},{x:o/6,y:d}],stroke_width:.1,pcb_silkscreen_path_id:""}],T=Kr(0,s/2+.6,.5);return{circuitJson:[...y,g,x,...w,T],parameters:{...e,p:m}}},crn=Re({fn:U(),num_pins:we(2).default(2),w:U().default("5.40mm"),h:U().default("2.30mm"),pl:U().default("1.30mm"),pw:U().default("1.70mm"),p:U().default("3.5mm")}),lrn=n=>{const e=crn.parse(n),t=Kr(0,st.parse(e.h)/2+.4,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:drn(e).concat(i,t),parameters:e}},urn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},drn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=urn({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},hrn=Re({fn:U(),num_pins:we(2).default(2),w:U().default("1.90mm"),h:U().default("1.33mm"),pl:U().default("0.5mm"),pw:U().default("0.7mm"),p:U().default("0.8mm")}),prn=n=>{const e=hrn.parse(n),t=Kr(0,st.parse(e.h)+.1,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2+.1,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2+.1,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:mrn(e).concat(i,t),parameters:e}},frn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},mrn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=frn({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},_rn=Re({fn:U(),num_pins:we(2).default(2),w:U().default("7.0mm"),h:U().default("3.35mm"),pl:U().default("1.50mm"),pw:U().default("2.70mm"),p:U().default("4.8mm")}),yrn=n=>{const e=_rn.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:vrn(e).concat(i,t),parameters:e}},grn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},vrn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=grn({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},xrn=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.0mm"),h:U().default("1.80mm"),pl:U().default("0.80mm"),pw:U().default("1.20mm"),p:U().default("1.6mm")}),brn=n=>{const e=xrn.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.1,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.1,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Srn(e).concat(i,t),parameters:e}},wrn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Srn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=wrn({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Ern=Re({fn:U(),num_pins:we(2).default(2),w:U().default("7.10mm"),h:U().default("3.40mm"),pl:U().default("2.45mm"),pw:U().default("1.80mm"),p:U().default("4.05mm")}),Trn=n=>{const e=Ern.parse(n),t=Kr(0,st.parse(e.h)/2+.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.5,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.5,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Crn(e).concat(i,t),parameters:e}},Mrn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Crn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Mrn({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Arn=Re({fn:U(),num_pins:we(2).default(2),w:U().default("4.80mm"),h:U().default("2.10mm"),pl:U().default("1.30mm"),pw:U().default("1.40mm"),p:U().default("2.9mm")}),Rrn=n=>{const e=Arn.parse(n),t=Kr(0,st.parse(e.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Irn(e).concat(i,t),parameters:e}},Prn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Irn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Prn({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Nrn=Re({fn:U(),num_pins:we(2).default(2),w:U().default("7.30mm"),h:U().default("4.40mm"),pl:U().default("2.50mm"),pw:U().default("2.30mm"),p:U().default("4.30mm")}),krn=n=>{const e=Nrn.parse(n),t=Kr(0,st.parse(e.h)/2+.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.1,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.1,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Drn(e).concat(i,t),parameters:e}},Orn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Drn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Orn({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Lrn=Re({fn:U(),num_pins:we(2).default(2),w:U().default("10.70mm"),h:U().default("6.60mm"),pl:U().default("3.30mm"),pw:U().default("2.50mm"),p:U().default("6.80mm")}),zrn=n=>{const e=Lrn.parse(n),t=Kr(0,3,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2-.8},{x:-st.parse(e.w)/2-.8,y:st.parse(e.h)/2-.8},{x:-st.parse(e.w)/2-.8,y:-st.parse(e.h)/2+.8},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2+.8}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Brn(e).concat(i,t),parameters:e}},Frn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Brn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Frn({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Urn=Re({fn:U(),num_pins:Fe().default(4),w:U().default("8.50mm"),h:U().default("6.90mm"),pl:U().default("2mm"),pw:U().default("1.5mm"),p:U().default("2.30mm"),string:U().optional()}),$rn=n=>{const e=n.string?.match(/^sot223_(\d+)/),t=e?Number.parseInt(e[1],10):4;if(t===8){const r=Vrn.parse({...n,num_pins:t});return{circuitJson:ww(r),parameters:r}}const i=Urn.parse({...n,num_pins:t});if(i.num_pins===4)return{circuitJson:Hrn(i),parameters:i};if(i.num_pins===5)return{circuitJson:Grn(i),parameters:i};if(i.num_pins===6)return{circuitJson:Xrn(i),parameters:i};throw new Error("Invalid number of pins")},jrn=n=>{const{pn:e,w:t,p:i}=n;return e===1?{x:-t/2+1.1,y:i}:e===2?{x:-t/2+1.1,y:0}:e===3?{x:-t/2+1.1,y:-i}:{x:t/2-1.1,y:0}},Hrn=n=>{const e=[];for(let a=0;a<n.num_pins;a++){const{x:c,y:l}=jrn({num_pins:n.num_pins,pn:a+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl),p:Number.parseFloat(n.p)}),u=a===3?3.8:Number.parseFloat(n.pw);e.push(sr(a+1,c,l,Number.parseFloat(n.pl),u))}const t=Kr(0,0,.3),i=Number.parseFloat(n.w)/2-2.4,r=Number.parseFloat(n.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:r},{x:i,y:r},{x:i,y:r/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-r},{x:i,y:-r},{x:i,y:-r/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,o,s,t]},Vrn=q2({p:"0.90mm",w:"2.8mm",legsoutside:!0}),qrn=n=>{const{p:e,pn:t,w:i}=n;if(t===1)return{x:-i/2+1.2,y:e/2+e};if(t===2)return{x:-i/2+1.2,y:e/2};if(t===3)return{x:-i/2+1.2,y:-e/2};if(t===4)return{x:-i/2+1.2,y:-e/2-e};if(t===5)return{x:i/2-1,y:0};throw new Error("Invalid pin number")},Grn=n=>{const e=[];for(let a=1;a<=n.num_pins;a++){const{x:c,y:l}=qrn({h:Number.parseFloat(n.h),p:1.5,pn:a,w:Number.parseFloat(n.w)});let u=Number.parseFloat(n.pw),d=Number.parseFloat(n.pl);a===5?(u=3.4,d=1.8):(u=1,d=2.2),e.push(sr(a,c,l,d,u))}const t=Number.parseFloat(n.w)/2-2.4,i=Number.parseFloat(n.h)/2,r={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-t,y:i},{x:t,y:i},{x:t,y:i/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-t,y:-i},{x:t,y:-i},{x:t,y:-i/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1},s=Kr(0,0,.3);return[...e,r,o,s]},Yrn=n=>{const{p:e,pn:t,w:i}=n;if(t===1)return{x:-i/2+1.2,y:2*e};if(t===2)return{x:-i/2+1.2,y:e};if(t===3)return{x:-i/2+1.2,y:0};if(t===4)return{x:-i/2+1.2,y:-e};if(t===5)return{x:-i/2+1.2,y:-2*e};if(t===6)return{x:i/2-1.175,y:0};throw new Error("Invalid pin number")},Xrn=n=>{const e=[];for(let a=1;a<=n.num_pins;a++){const{x:c,y:l}=Yrn({h:Number.parseFloat(n.h),p:1.3,pn:a,w:8.7});let u=Number.parseFloat(n.pw),d=Number.parseFloat(n.pl);a===6?(u=3.4,d=2.15):(u=.6,d=2.2),e.push(sr(a,c,l,d,u))}const t=Number.parseFloat(n.w)/2-2.4,i=Number.parseFloat(n.h)/2,r={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-t,y:i},{x:t,y:i},{x:t,y:i/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-t,y:-i},{x:t,y:-i},{x:t,y:-i/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1},s=Kr(0,0,.3);return[...e,r,o,s]},Wrn=Re({fn:U(),num_pins:Fe().default(3),w:U().default("3.40mm"),h:U().default("3.30mm"),pl:U().default("1mm"),pw:U().default("0.7mm"),p:U().default("1.2mm"),string:U().optional()}),Zrn=n=>{const e=n.string?.match(/^sot23w_(\d+)/),t=e?Number.parseInt(e[1],3):3,i=Wrn.parse({...n,num_pins:t});if(i.num_pins===3)return{circuitJson:Qrn(i),parameters:i};throw new Error("Invalid number of pins")},Krn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t,y:.95}:e===2?{x:-t,y:-.95}:{x:t,y:0}},Qrn=n=>{const e=[];for(let a=0;a<n.num_pins;a++){const{x:c,y:l}=Krn({num_pins:n.num_pins,pn:a+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl),p:Number.parseFloat(n.p)});e.push(sr(a+1,c,l,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=Kr(0,Number.parseInt(n.h)/2+1,.3),i=Number.parseFloat(n.w)/2-1,r=Number.parseFloat(n.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:r},{x:i+.3,y:r},{x:i+.3,y:r/2}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-r},{x:i+.3,y:-r},{x:i+.3,y:-r/2}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,o,s,t]},Jrn=Re({fn:U(),num_pins:Gn([we(3),we(2)]).default(3),p:U().default("1.27mm"),id:U().default("0.72mm"),od:U().default("0.95mm"),w:U().default("2.5mm"),h:U().default("4.2mm"),string:U().optional()}),eon=n=>{const{p:e,id:t,od:i,w:r,h:o}=n,s=Number.parseFloat(o)/2,a=Number.parseFloat(e);return[Os(1,-a,s-a,t,i),Os(2,0,s-a,t,i),Os(3,a,s-a,t,i)]},ton=n=>{const{p:e,id:t,od:i,h:r}=n,o=Number.parseFloat(r)/2,s=Number.parseFloat(e);return[Os(1,-s,o-s,t,i),Os(2,s,o-s,t,i)]},non=n=>{const e=n.string?.match(/^to92s_(\d+)/),t=e?Number.parseInt(e[1],10):3,i=Jrn.parse({...n,num_pins:t});let r=[];if(i.num_pins===3)r=eon(i);else if(i.num_pins===2)r=ton(i);else throw new Error("Invalid number of pins for TO-92");const o=Number.parseFloat(i.h)/2,s=Number.parseFloat(i.p),a={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-o,y:o-s},{x:-1.9,y:0},{x:1.9,y:0},{x:o,y:o-s},{x:1.5,y:Number.parseFloat(i.h)/2+.5},{x:-1.5,y:Number.parseFloat(i.h)/2+.5},{x:-o,y:o-s}],stroke_width:.1,pcb_silkscreen_path_id:""},c=Kr(0,o+1,.5);return{circuitJson:[...r,a,c],parameters:i}},ion=Re({fn:U(),p:st.optional(),id:st.optional(),pw:st.optional(),pl:st.optional(),w:st.optional(),h:st.optional(),sh:Gn([vt(),U(),Fe()]).optional().transform(n=>{if(typeof n=="string"){const e=Number(n);return Number.isNaN(e)?!0:e}return n}).describe('JST SH (Surface-mount) connector family. SH stands for "Super High-density".'),ph:vt().optional().describe('JST PH (Through-hole) connector family. PH stands for "Pin Header".'),string:U().optional()}),ron={ph:{p:st.parse("2.2mm"),id:st.parse("0.70mm"),pw:st.parse("1.20mm"),pl:st.parse("1.20mm"),w:st.parse("6mm"),h:st.parse("5mm")},sh:{p:st.parse("1mm"),pw:st.parse("0.6mm"),pl:st.parse("1.55mm"),w:st.parse("5.8mm"),h:st.parse("7.8mm")}};function oon(n){return n.sh?"sh":(n.ph,"ph")}function son(n,e,t,i,r,o){const s=[];if(n==="ph"){const a=t/2;s.push(MU(1,-a,2,i,r,o)),s.push(MU(2,a,2,i,r,o))}else{const a=-((e-1)/2)*t;for(let l=0;l<e;l++){const u=a+l*t;console.log("x si",u),s.push(sr(l+1,u,-1.325,r,o))}const c=(e-1)/2*t+1.3;console.log("offset",c),s.push(sr(e+1,-c,1.22,1.2,1.8)),s.push(sr(e+2,c,1.22,1.2,1.8))}return s}function aon(n,e,t){return n==="ph"?{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-3,y:3},{x:3,y:3},{x:3,y:-2},{x:-3,y:-2},{x:-3,y:3}],stroke_width:.1,pcb_silkscreen_path_id:""}:{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[],stroke_width:.1,pcb_silkscreen_path_id:""}}var con=n=>{const e=ion.parse(n),t=oon(e),i=ron[t],r=e.p??i.p,o=e.id??i.id,s=e.pw??i.pw,a=e.pl??i.pl,c=e.w??i.w,l=e.h??i.h;let u=t==="sh"?4:2;if(t==="sh"){const y=(typeof n.string=="string"?n.string:"").match(/sh(\d+)/);if(y&&y[1]){const g=parseInt(y[1],10);Number.isNaN(g)||(u=g)}else typeof e.sh=="number"&&(u=e.sh)}const d=son(t,u,r,o,s,a),h=aon(t),f=Kr(0,l/2+1,.5);return{circuitJson:[...d,h,f],parameters:{...e,p:r,id:o,pw:s,pl:a,w:c,h:l,num_pins:u,sh:t==="sh",ph:t==="ph"}}},lon=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.30mm"),h:U().default("1.70mm"),pl:U().default("0.80mm"),pw:U().default("1mm"),p:U().default("1.90mm")}),uon=n=>{const e=lon.parse(n),t=Kr(0,st.parse(e.h)/2+.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:hon(e).concat(i,t),parameters:e}},don=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},hon=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=don({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},pon=n=>{switch(n){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"}}},fon=Re({fn:U(),num_pins:Gn([we(8),we(10)]).default(8),w:U().optional(),h:U().optional(),p:U().optional(),pl:U().optional(),pw:U().optional(),string:U().optional()}),mon=n=>{const e=fon.parse(n),t=pon(e.num_pins),i=st.parse(e.w||t.w),r=st.parse(e.h||t.h),o=st.parse(e.p||t.p),s=st.parse(e.pl||t.pl),a=st.parse(e.pw||t.pw),c=[],l=e.num_pins/2;for(let x=0;x<e.num_pins;x++){const{x:w,y:T}=KHe(e.num_pins,x+1,i,o),N=x<l?x+1:e.num_pins-(x-l);c.push(sr(N,w,T,s,a))}const u=i,d=r,h={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-u/2,y:d/2},{x:u/2,y:d/2}],stroke_width:.05,pcb_silkscreen_path_id:""},f={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-u/2,y:-d/2},{x:u/2,y:-d/2}],stroke_width:.05,pcb_silkscreen_path_id:""},m=KHe(e.num_pins,1,u,o),y={x:m.x-.8,y:m.y},g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:y.x-.4,y:y.y},{x:y.x-.7,y:y.y+.3},{x:y.x-.7,y:y.y-.3},{x:y.x-.4,y:y.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},b=Kr(0,d/2+.5,.3);return{circuitJson:[...c,h,f,b,g],parameters:e}},KHe=(n,e,t,i)=>{const r=n/2,o=(e-1)%r,s=e<=r?-1:1,a=(r-1)/2-o;return{x:s*st.parse(n===8?"1.8mm":"2.2mm"),y:a*i}},_on=n=>{switch(n){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"}}},yon=Re({fn:U(),num_pins:Gn([we(8),we(10),we(12),we(16)]).default(8),w:U().optional(),h:U().optional(),p:U().optional(),pl:U().optional(),pw:U().optional(),string:U().optional()}),QHe=(n,e,t,i)=>{const r=n/2,o=(e-1)%r,s=e<=r?-1:1,a=(r-1)/2-o;return{x:s*st.parse("2mm"),y:a*i}},gon=n=>{const e=yon.parse(n),t=_on(e.num_pins),i=st.parse(e.w||t.w),r=st.parse(e.h||t.h),o=st.parse(e.p||t.p),s=st.parse(e.pl||t.pl),a=st.parse(e.pw||t.pw),c=[];for(let b=0;b<e.num_pins;b++){const{x,y:w}=QHe(e.num_pins,b+1,i,o);c.push(sr(b+1,x,w,s,a))}const l=i,u=r,d={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:""},f=QHe(e.num_pins,1,l,o),m={x:f.x-.8,y:f.y},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"},g=Kr(0,u/2+.5,.3);return{circuitJson:[...c,d,h,g,y],parameters:e}},von=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.8mm"),h:U().default("1.65mm"),pl:U().default("1.2mm"),pw:U().default("1.2mm"),pad_spacing:U().default("2.6mm")}),xon=n=>{const e=von.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.pad_spacing)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:-st.parse(e.h)/2},{x:st.parse(e.pad_spacing)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:won(e).concat(i,t),parameters:e}},bon=n=>{const{pn:e,pad_spacing:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},won=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=bon({pn:t,pad_spacing:Number.parseFloat(n.pad_spacing)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Son=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.20mm"),h:U().default("1.65mm"),pl:U().default("0.8mm"),pw:U().default("0.9mm"),pad_spacing:U().default("2.1mm")}),Eon=n=>{const e=Son.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.pad_spacing)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:-st.parse(e.h)/2},{x:st.parse(e.pad_spacing)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Mon(e).concat(i,t),parameters:e}},Ton=n=>{const{pn:e,pad_spacing:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Mon=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Ton({pn:t,pad_spacing:Number.parseFloat(n.pad_spacing)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Con=Re({fn:U(),num_pins:Gn([we(6),we(8)]).default(8),w:U().default("3mm"),h:U().default("3mm"),p:U().default("0.5mm"),pl:U().default("0.52mm"),pw:U().default("0.35mm"),epw:U().default("1.40mm"),eph:U().default("1.60mm"),string:U().optional(),ep:vt().default(!1)}),Aon=n=>{n.string&&n.string.includes("_ep")&&(n.ep=!0);const e=n.string?.match(/^son_(\d+)/),t=e?Number.parseInt(e[1],10):n.num_pins||8,i=Con.parse({...n,num_pins:t}),r=st.parse(i.w),o=st.parse(i.h),s=st.parse(i.p),a=st.parse(i.pl),c=st.parse(i.pw),l=st.parse(i.epw),u=st.parse(i.eph),d=[];for(let T=0;T<i.num_pins;T++){const{x:N,y:R}=JHe(i.num_pins,T+1,r,s);d.push(sr(T+1,N,R,a,c))}i.ep&&d.push(sr(i.num_pins+1,0,0,l,u));const h=r,f=o,m={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-h/2,y:f/2},{x:h/2,y:f/2}],stroke_width:.05,pcb_silkscreen_path_id:""},y={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-h/2,y:-f/2},{x:h/2,y:-f/2}],stroke_width:.05,pcb_silkscreen_path_id:""},g=JHe(i.num_pins,1,h,s),b={x:g.x-.4,y:g.y},x={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:b.x-.4,y:b.y},{x:b.x-.7,y:b.y+.3},{x:b.x-.7,y:b.y-.3},{x:b.x-.4,y:b.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},w=Kr(0,f/2+.5,.3);return{circuitJson:[...d,m,y,w,x],parameters:i}},JHe=(n,e,t,i)=>{const r=n/2,o=(e-1)%r,s=e<=r?-1:1,a=(r-1)/2-o;return{x:s*st.parse("1.4mm"),y:a*i}},Ron=n=>{const{num_pins:e,bridged:t,p:i=2.54,pw:r=1.5,ph:o=1.5}=n,s=st.parse(i),a=st.parse(r),c=st.parse(o),l=Math.min(c/4,.5),u=[];for(let T=0;T<e;T++)u.push(sr(T+1,T*s,0,a,c));let d=[];if(t){const T=t.split("").map(Number);if(T.length>1)for(let N=0;N<T.length-1;N++){const R=T[N],k=T[N+1];if(typeof R=="number"&&typeof k=="number"&&!isNaN(R)&&!isNaN(k)){const M=(R-1)*s,I=(k-1)*s,C=Math.sign(I-M),$=M+C*(a/2),P=I-C*(a/2);d.push({type:"pcb_trace",pcb_trace_id:"",route:[{start_pcb_port_id:`{PIN${R}}`,x:$,y:0,width:l,layer:"top",route_type:"wire"},{end_pcb_port_id:`{PIN${k}}`,x:P,y:0,width:l,layer:"top",route_type:"wire"}]})}}}const h=(e-1)*s+a+.7,f=c+1,m=(e-1)*s/2,y=0,g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"outline",route:[{x:m-h/2,y:y-f/2},{x:m+h/2,y:y-f/2},{x:m+h/2,y:y+f/2},{x:m-h/2,y:y+f/2},{x:m-h/2,y:y-f/2}],stroke_width:.15},x=y+f/2+.6,w=Kr(m,x,.4);return{circuitJson:[...u,...d,g,w],parameters:n}},eVe=(n,e,t,i,r)=>({type:"pcb_smtpad",x:e,y:t,width:i,height:r,radius:r/2,layer:"top",shape:"pill",pcb_smtpad_id:"",port_hints:Array.isArray(n)?n.map(o=>o.toString()):[n.toString()]}),tVe={fn:we("sot457"),num_pins:we(6).default(6),pillh:U().default("0.45mm"),pillw:U().default("1.45mm"),pl:U(),pw:U(),p:U(),wave:vt().optional(),reflow:vt().optional()},Pon=Re({...tVe,h:U().default("2.5mm"),w:U().default("2.7mm"),pl:U().default("0.8mm"),pw:U().default("0.55mm"),p:U().default("0.95mm")}),Ion=Re({...tVe,h:U().default("3mm"),w:U().default("4mm"),pillr:U().default("0.225mm"),pl:U().default("1.45mm"),pw:U().default("1.5mm"),p:U().default("1.475mm")}).transform(n=>({...n,wave:n.wave??(n.reflow===void 0?!0:!n.reflow),reflow:n.reflow??(n.wave===void 0?!1:!n.wave)})),Sw=n=>Number.parseFloat(n.replace("mm","")),nVe=({pitch:n,width:e,pinNumber:t})=>{const o={1:{x:-e/2-.1,y:n},2:{x:-e/2-.1,y:0},3:{x:-e/2-.1,y:-n},4:{x:e/2+.1,y:-n},5:{x:e/2+.1,y:0},6:{x:e/2+.1,y:n}}[t];if(!o)throw new Error(`Invalid pin number: ${t}`);return o},iVe=n=>{const e=[],t=Sw(n.p),i=Sw(n.pl),r=Sw(n.pw),o=Sw(n.w),s=Sw(n.h);if(n.wave){const m={1:({padWidth:y,padHeight:g})=>sr(1,-t,t,g,y),2:({padWidth:y,padHeight:g})=>sr(2,-t,-t,g,y),3:({padWidth:y,padHeight:g})=>eVe(3,-t,0,Sw(n.pillw),Sw(n.pillh)),4:({padWidth:y,padHeight:g})=>eVe(4,t,0,Sw(n.pillw),Sw(n.pillh)),5:({padWidth:y,padHeight:g})=>sr(5,t,t,g,y),6:({padWidth:y,padHeight:g})=>sr(6,t,-t,g,y)};for(let y=1;y<=n.num_pins;y++){const g=m[y];g&&e.push(g({padWidth:i,padHeight:r}))}}else for(let m=1;m<=n.num_pins;m++){const{x:y,y:g}=nVe({pitch:t,width:o,pinNumber:m});e.push(sr(m,y,g,i,r))}const a={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-o/3,y:s/2+t/1.3},{x:o/3,y:s/2+t/1.3}],stroke_width:.05},c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-o/3,y:-s/2-t/1.3},{x:o/3,y:-s/2-t/1.3}],stroke_width:.05},l=Kr(0,s+.5,.3),u=nVe({pitch:t,width:o,pinNumber:1}),d=n.wave?1:.5,h=n.wave?.7:.3;u.x-=n.wave?r:r*1.7;const f={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:u.x+d/2,y:u.y},{x:u.x-d/2,y:u.y+h/2},{x:u.x-d/2,y:u.y-h/2},{x:u.x+d/2,y:u.y}],stroke_width:.05};return[l,a,c,f,...e]},Non=n=>{if(n.wave){const t=Ion.parse({...n,fn:"sot457"});return{circuitJson:iVe(t),parameters:t}}const e=Pon.parse(n);return{circuitJson:iVe(e),parameters:e}},kon=Re({fn:U(),num_pins:Gn([we(3),we(2)]).default(3),p:U().default("3.8mm"),id:U().default("1.25mm"),od:U().default("2.35mm"),ca:U().default("14mm").describe("Caliper axis (width or diameter of the potentiometer body or adjustment knob)"),w:U().default("5.35mm"),h:U().default("4mm"),string:U().optional()}),Oon=n=>{const{p:e,id:t,od:i,h:r,ca:o}=n,s=Number.parseFloat(r),a=Number.parseFloat(o);return[Os(1,0,a/4+.3,t,i),Os(2,s,0,t,i),Os(3,0,-a/4-.3,t,i)]},Don=n=>{const e=n.string?.match(/^potentiometer_(\d+)/),t=e?Number.parseInt(e[1],10):3,i=kon.parse({...n,num_pins:t});let r=[];i.num_pins===3&&(r=Oon(i));const o=Number.parseFloat(i.ca)/2+.15,s=Number.parseFloat(i.w),a=Number.parseFloat(i.od)/2+.35,c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:0,y:o-1.75},{x:0,y:o},{x:s,y:o},{x:s,y:a}],stroke_width:.1,pcb_silkscreen_path_id:""},l={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:s,y:-a},{x:s,y:-o},{x:0,y:-o},{x:0,y:-o+1.75}],stroke_width:.1,pcb_silkscreen_path_id:""},u=Number.parseFloat(i.w)/2,d=Kr(u,o+1,.5);return{circuitJson:[...r,c,l,d],parameters:i}},Lon=Re({fn:U(),p:st.optional().default("7.5mm"),id:st.optional().default("1mm"),od:st.optional().default("2mm"),d:st.optional().default("10.5mm")}),zon=(n,e,t,i,r)=>{const o=[],s=[];for(let a=0;a<=50;a++){const c=a/50*Math.PI,l=n+Math.cos(c)*t,u=e+Math.sin(c)*t;l<n-i&&u>=e-r/2&&u<=e+r/2||o.push({x:l,y:u})}for(let a=0;a<=50;a++){const c=Math.PI+a/50*Math.PI,l=n+Math.cos(c)*t,u=e+Math.sin(c)*t;l<n-i&&u>=e-r/2&&u<=e+r/2||s.push({x:l,y:u})}return{topArc:o,bottomArc:s}},Fon=n=>{const e=Lon.parse(n),{p:t,id:i,od:r,d:o}=e,s=[Os(1,-t/2,0,i,r),Os(2,t/2,0,i,r)],{topArc:a,bottomArc:c}=zon(0,0,o/2+.1,r/2,r),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:c,stroke_width:.1,pcb_silkscreen_path_id:""},d={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:0,y:o/2+.1},{x:0,y:-(o/2+.1)}],stroke_width:.1,pcb_silkscreen_path_id:""},h=-(o/2+.5),f=r/2+1.5,m=.5,y={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:h-m,y:f},{x:h+m,y:f}],stroke_width:.1,pcb_silkscreen_path_id:""},g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:h,y:f-m},{x:h,y:f+m}],stroke_width:.1,pcb_silkscreen_path_id:""},b=Kr(0,o/2+1,.5);return{circuitJson:[...s,l,u,d,y,g,b],parameters:e}},Bon=Re({fn:U(),num_pins:we(2).default(2),w:U().default("6.5mm"),h:U().default("3mm"),pl:U().default("1.75mm"),pw:U().default("2.40mm"),p:U().default("4.75mm")}),Uon=n=>{const e=Bon.parse(n),t=Kr(0,st.parse(e.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.3,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.3,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:jon(e).concat(i,t),parameters:e}},$on=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},jon=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=$on({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Hon=Re({fn:U(),num_pins:Fe().default(3),w:U().default("2.45mm"),h:U().default("2.40mm"),pl:U().default("0.45mm"),pw:U().default("0.70mm"),p:U().default("1mm"),string:U().optional()}),Von=n=>{const e=n.string?.match(/^sot323_(\d+)/),t=e?Number.parseInt(e[1],3):3,i=Hon.parse({...n,num_pins:t});if(i.num_pins===3)return{circuitJson:Gon(i),parameters:i};throw new Error("Invalid number of pins")},qon=n=>{const{pn:e,p:t}=n;return e===1?{x:-t,y:.65}:e===2?{x:-t,y:-.65}:{x:t,y:0}},Gon=n=>{const e=[];for(let a=0;a<n.num_pins;a++){const{x:c,y:l}=qon({num_pins:n.num_pins,pn:a+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl),p:Number.parseFloat(n.p)});e.push(sr(a+1,c,l,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=Kr(0,Number.parseInt(n.h)/2+1,.3),i=Number.parseFloat(n.w)/2-Number.parseFloat(n.pl),r=Number.parseFloat(n.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:r+.3},{x:i,y:r+.3},{x:i,y:r/2}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-r-.3},{x:i,y:-r-.3},{x:i,y:-r/2}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,o,s,t]},Yon=Re({fn:U(),circle:vt().optional(),rect:vt().optional(),square:vt().optional(),d:st.optional(),pd:st.optional(),diameter:st.optional(),r:st.optional(),pr:st.optional(),radius:st.optional(),w:st.optional(),pw:st.optional(),width:st.optional(),h:st.optional(),ph:st.optional(),height:st.optional(),s:st.optional(),size:st.optional(),string:U().optional()}).transform(n=>{let e="rect";n.circle&&(e="circle"),n.square&&(e="square"),n.rect&&(e="rect");let t,i,r;return e==="circle"?n.r!==void 0?t=Xu(n.r):n.pr!==void 0?t=Xu(n.pr):n.radius!==void 0?t=Xu(n.radius):n.d!==void 0?t=Xu(n.d)/2:n.pd!==void 0?t=Xu(n.pd)/2:n.diameter!==void 0?t=Xu(n.diameter)/2:t=Xu("1mm")/2:(n.w!==void 0?i=Xu(n.w):n.pw!==void 0?i=Xu(n.pw):n.width!==void 0?i=Xu(n.width):n.s!==void 0?i=Xu(n.s):n.size!==void 0?i=Xu(n.size):i=Xu("1mm"),n.h!==void 0?r=Xu(n.h):n.ph!==void 0?r=Xu(n.ph):n.height!==void 0?r=Xu(n.height):r=i),{fn:n.fn,shape:e,radius:t,width:i,height:r}}),Xon=n=>{const e=Yon.parse(n),{shape:t,radius:i,width:r,height:o}=e;return{circuitJson:[t==="circle"?BHe(1,{x:0,y:0,radius:i}):sr(1,0,0,r,o),Kr(0,t==="circle"?i+.5:o/2+.5,.2)],parameters:e}},Won=Re({fn:U(),d:st.optional(),hd:st.optional(),r:st.optional(),hr:st.optional(),pd:st.optional(),pr:st.optional(),squarepad:vt().optional().default(!1)}).transform(n=>{let e;n.d!==void 0?e=Xu(n.d):n.hd!==void 0?e=Xu(n.hd):n.r!==void 0?e=Xu(n.r)*2:n.hr!==void 0?e=Xu(n.hr)*2:e=Xu("1mm");let t;return n.pd!==void 0?t=Xu(n.pd):n.pr!==void 0?t=Xu(n.pr)*2:t=e*(1.5/1),{fn:n.fn,d:e,pd:t,squarepad:n.squarepad??!1}}),Zon=n=>{const e=Won.parse(n),{d:t,pd:i,squarepad:r}=e;return{circuitJson:[r?MU(1,0,0,t,i,i):Os(1,0,0,t,i),Kr(0,i/2+.5,.2)],parameters:e}},Kon=Re({fn:U(),num_pins:we(6).default(6),h:U().default("1.6mm"),pl:U().default("1mm"),pw:U().default("0.7mm"),p:U().default("0.95mm")}),Qon=n=>{const e=Kon.parse(n);return{circuitJson:Jon(e),parameters:e}},rVe=n=>{const{p:e,h:t,pn:i}=n;if(i===1)return{x:-t/2-.5,y:e};if(i===2)return{x:-t/2-.5,y:0};if(i===3)return{x:-t/2-.5,y:-e};if(i===4)return{x:t/2+.5,y:-e};if(i===5)return{x:t/2+.5,y:0};if(i===6)return{x:t/2+.5,y:e};throw new Error("Invalid pin number")},Jon=n=>{const e=[];for(let d=1;d<=n.num_pins;d++){const{x:h,y:f}=rVe({h:Number.parseFloat(n.h),p:Number.parseFloat(n.p),pn:d});e.push(sr(d,h,f,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=n.num_pins/2*Number.parseFloat(n.p),i=Number.parseFloat(n.h),r={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-t/3,y:i/2+Number.parseFloat(n.p)/1.3},{x:t/3,y:i/2+Number.parseFloat(n.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-t/3,y:-i/2-Number.parseFloat(n.p)/1.3},{x:t/3,y:-i/2-Number.parseFloat(n.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},s=Kr(0,i+.3,.3),a=rVe({h:Number.parseFloat(n.h),p:Number.parseFloat(n.p),pn:1});a.x=a.x-Number.parseFloat(n.pw)*1.5;const c=.7,l=.3,u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:a.x+c/2,y:a.y},{x:a.x-c/2,y:a.y+l/2},{x:a.x-c/2,y:a.y-l/2},{x:a.x+c/2,y:a.y}],stroke_width:.05};return[...e,s,r,o,u]},esn=Re({fn:U()}),tsn=n=>{const e=esn.parse(n),t=[],i=.5-.15,r=1.5,s=.5/2,a=75,c=-37/2;for(let k=0;k<a;k++){const M=k+1;if(M>=24&&M<=31)continue;const I=c-k*s,C=k%2===0?0:-.5/2,$=r+(k%2===0?0:.25),P=sr(M,C,I,$,i);P.layer=M%2===0?"bottom":"top",t.push(P)}const l=46*.0254,u=137*.0254,d=261*.0254,h={type:"pcb_cutout",pcb_cutout_id:"",shape:"rect",center:{x:-u/2+r/2,y:c-d},width:u,height:l},f={x:-.5,y:c},m={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"};let y=1/0,g=-1/0,b=1/0,x=-1/0;const w=(k,M,I=0,C=0)=>{y=Math.min(y,k-I/2),g=Math.max(g,k+I/2),b=Math.min(b,M-C/2),x=Math.max(x,M+C/2)};for(const k of t)w(k.x,k.y,k.width,k.height);w(h.center.x,h.center.y,h.width,h.height);for(const k of m.route)w(k.x,k.y);const T=(y+g)/2,N=(b+x)/2,R=k=>{typeof k.x=="number"&&(k.x-=T),typeof k.y=="number"&&(k.y-=N),k.center&&(k.center.x-=T,k.center.y-=N),Array.isArray(k.route)&&(k.route=k.route.map(M=>({x:M.x-T,y:M.y-N})))};for(const k of t)R(k);return R(h),R(m),{circuitJson:[...t,h,m],parameters:e}};function nsn(n){return n!==null}var isn=(n,e)=>{if(!e)return n;const t=n.filter(u=>u.type==="pcb_smtpad"||u.type==="pcb_plated_hole"||u.type==="pcb_thtpad");if(t.length===0)return n;let i=1/0,r=-1/0,o=1/0,s=-1/0;const a=(u,d,h=0,f=0)=>{const m=u-h/2,y=u+h/2,g=d-f/2,b=d+f/2;i=Math.min(i,m),r=Math.max(r,y),o=Math.min(o,g),s=Math.max(s,b)};for(const u of t)if(u.type==="pcb_smtpad"){const d=u.shape==="circle"?u.radius*2:u.width,h=u.shape==="circle"?u.radius*2:u.height;a(u.x,u.y,d,h)}else if(u.type==="pcb_plated_hole"){const d=u.outer_diameter??u.hole_diameter;a(u.x,u.y,d,d)}else if(u.type==="pcb_thtpad"){const d=u.diameter;a(u.x,u.y,d,d)}let c=0,l=0;switch(e){case"center":c=(i+r)/2,l=(o+s)/2;break;case"bottomleft":c=i,l=o;break;case"bottomcenter":case"centerbottom":c=(i+r)/2,l=o;break;case"topcenter":case"centertop":c=(i+r)/2,l=s;break;case"leftcenter":case"centerleft":c=i,l=(o+s)/2;break;case"rightcenter":case"centerright":c=r,l=(o+s)/2;break;case"pin1":const u=t.find(d=>d.port_hints?.[0]==="1")||t[0];c=u.x,l=u.y;break}if(c===0&&l===0)return n;for(const u of t)u.x-=c,u.y-=l,u.center&&(u.center.x-=c,u.center.y-=l);return n},rsn=n=>{let e=PU();const i=n.replace(/^((?:\d{4}|\d{5}))(?=$|_)/,"res$1").split(/_(?!metric)/).map(r=>{const o=r.match(/([a-z]+)([\(\d\.\+\?].*)?/),[s,a,c]=o??[];return c?.includes("?")?null:{fn:a,v:c}}).filter(nsn);for(const{fn:r,v:o}of i)e=e[r](o);return e.setString(n),e},osn=()=>Object.keys(bw),PU=()=>{const n=new Proxy({},{get:(e,t)=>{if(t==="soup"||t==="circuitJson"){if("fn"in e&&bw[e.fn])return()=>{const{circuitJson:i}=bw[e.fn](e);return isn(i,e.origin)};if(!bw[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 "${t}"`)}}if(t==="json"){if(!bw[e.fn])throw new Error(`Invalid footprint function, got "${e.fn}"${e.string?`, from string "${e.string}"`:""}`);return()=>bw[e.fn](e).parameters}return t==="getFootprintNames"?()=>Object.keys(bw):t==="params"?()=>e:t==="setString"?i=>(e.string=i,n):i=>(Object.keys(e).length===0?`${t}${i}`in bw?(e[`${t}${i}`]=!0,e.fn=`${t}${i}`):(e[t]=!0,e.fn=t,t==="res"||t==="cap"?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(t)||(e[t]=i??!0),n)}});return n};PU.string=rsn,PU.getFootprintNames=osn;var ssn=PU,Tx=ep(Qhe()),oVe=Symbol("Fragment");function upe(n,e,...t){const i=t.length?t:e?.children!==void 0?[e.children]:[],r=[],o=(Array.isArray(i)?i:[i]).flat(1/0);for(const s of o)s==null||s===!1||(Array.isArray(s)?r.push(...s):r.push(s));return{type:n,props:(e&&e.children!==void 0?{...e,children:void 0}:e)||{},children:r}}var Ra=Symbol("Cuboid"),sVe=Symbol("Cube"),p4=Symbol("Cylinder"),aVe=Symbol("Sphere"),IU=Symbol("RoundedCuboid"),f4=Symbol("Translate"),fP=Symbol("Rotate"),cVe=Symbol("Union"),dpe=Symbol("Subtract"),NU=Symbol("Hull"),Ew=Symbol("Colorize"),mP=Symbol("Polygon"),_P=Symbol("ExtrudeLinear"),Km=oVe,Yn=(n,e,t)=>upe(n,e),Dp=(n,e,t)=>upe(n,e),FM=({center:n,width:e,length:t,height:i,heightAboveSurface:r=.15})=>Yn(Ew,{color:"#555",children:Yn(f4,{offset:n,children:Yn(f4,{offset:{x:0,y:0,z:i/2+r},children:Yn(IU,{roundRadius:.2,size:[e,t,i]})})})}),asn=n=>Array.from({length:n},(e,t)=>t);function hpe(n,e){if(n.length<2)throw new Error("Stroke must have at least two points");const t=Array.isArray(n[0])?n.map(([u,d])=>({x:u,y:d})):n,i=e/2,r=[],o=[];function s(u,d){const h=d.x-u.x,f=d.y-u.y,m=Math.sqrt(h*h+f*f);return{x:-f/m,y:h/m}}function a(u,d,h){const f={x:u.x+d.x*i*h,y:u.y+d.y*i*h};h>0?r.push(f):o.unshift(f)}const c=s(t[0],t[1]);a(t[0],c,1),a(t[0],c,-1);for(let u=1;u<t.length-1;u++){const d=t[u-1],h=t[u],f=t[u+1],m=s(d,h),y=s(h,f),g=m.x+y.x,b=m.y+y.y,x=Math.sqrt(g*g+b*b);if(x/2>2*i)a(h,m,1),a(h,y,1),a(h,m,-1),a(h,y,-1);else{const T=1/x;a(h,{x:g*T,y:b*T},1),a(h,{x:g*T,y:b*T},-1)}}const l=s(t[t.length-2],t[t.length-1]);return a(t[t.length-1],l,1),a(t[t.length-1],l,-1),[...r,...o]}var csn=n=>{const e=Math.min(...n.map(a=>a.x)),t=Math.max(...n.map(a=>a.x)),i=Math.min(...n.map(a=>a.y)),s=5.47/(Math.max(...n.map(a=>a.y))-i);return n.map(a=>({x:(a.x-e-(t-e)/2)*s,y:(a.y-i)*s}))},lsn=csn([{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}]),lVe=5.47,kU=.5,usn=({x:n,y:e,z:t})=>{const i=n>0;return Dp(Km,{children:[Yn(f4,{offset:{x:n+.25/2,y:e,z:t},children:Yn(fP,{rotation:["-90deg",0,"90deg"],children:Yn(_P,{height:.25,children:Yn(mP,{points:lsn.map(r=>[r.x,r.y])})})})}),Yn(f4,{offset:{x:n,y:e+(i?1:-1),z:t},children:Yn(fP,{rotation:["-90deg","90deg",i?"180deg":"0deg"],children:Yn(_P,{height:2,children:Yn(mP,{points:hpe([[0,0],[-1,0],[-1,-1]],.25).map(r=>[r.x,r.y])})})})})]})},dsn=({numPins:n=8,pitch:e=2.54,bodyWidth:t=6.4})=>{const i=Math.floor(n/2),r=t+1;return Dp(Km,{children:[asn(n).map(o=>{const s=o%i,a=(Math.floor(o/i)-.5)*2;return Yn(usn,{x:a*r/2,y:s*e-(i-1)/2*e,z:lVe/2+kU})}),Yn(FM,{width:t,length:i*e+.5,height:lVe-kU,heightAboveSurface:kU,center:{x:0,y:0,z:kU}})]})};function hsn(n,{height:e,padContactLength:t,curveLength:i,bodyDistance:r,steepness:o=10}){i||(i=r*.3);let s=r-t-i;s<0&&(i+=s,s=0);const a=t*.75,c=t+i+(r-t-i)*.25;if(n<=a)return 0;if(n>=c)return e;const l=(n-a)/(c-a);return e/(1+Math.exp(-o*(l-.5)))}var Mx=n=>{const{thickness:e,width:t,padContactLength:i,bodyDistance:r,height:o,rotation:s}=n,a=15,c=Array.from({length:a}).map((u,d)=>d/(a-1)*r).map(u=>[u,hsn(u,n)]),l=hpe(c,e);return Yn(Ew,{color:"#fff",children:Yn(f4,{offset:{z:0,y:0,x:0,...n.position},children:Yn(fP,{rotation:["90deg",0,s??0],children:Yn(f4,{offset:{x:0,y:0,z:-t/2},children:Yn(_P,{height:t,children:Yn(mP,{points:l.map(u=>[u.x,u.y])})})})})})})},psn=({pinCount:n,leadLength:e,leadWidth:t,pitch:i,bodyWidth:r})=>{const o=Math.ceil(n/2),s=i*n/2+t/2,a=(o-1)*i/2,c=.25;return Dp(Km,{children:[Array.from({length:o}).map((l,u)=>Yn(Mx,{position:{x:-r/2-e,y:u*i-a,z:c/2},width:t,thickness:c,padContactLength:e,bodyDistance:e+1,height:.8})),Array.from({length:o}).map((l,u)=>Yn(Mx,{rotation:Math.PI,position:{x:r/2+e,y:u*i-a,z:c/2},width:t,thickness:c,padContactLength:e,bodyDistance:e+1,height:.8})),Yn(FM,{center:{x:0,y:0,z:c/2},width:r-t-1,length:s,height:1.5})]})},ppe=1,fpe=.5,BM=.5,yP=.2,fsn=ppe-yP*2,uVe=({color:n="#333"})=>Dp(Km,{children:[Yn(Ra,{size:[fsn,fpe,BM],offset:[0,0,BM/2],color:n}),Yn(Ra,{size:[yP,BM,fpe],offset:[ppe/2-yP/2,0,BM/2],color:"#ccc"}),Yn(Ra,{size:[yP,BM,fpe],offset:[-ppe/2+yP/2,0,BM/2],color:"#ccc"})]}),mpe=1.6,msn=mpe-.3*2,OU=.3,_pe=.85,UM=.6,dVe=({color:n="#333"})=>Dp(Km,{children:[Yn(Ra,{size:[msn,_pe,UM],offset:[0,0,UM/2],color:n}),Yn(Ra,{size:[OU,_pe,UM],offset:[mpe/2-OU/2,0,UM/2],color:"#ccc"}),Yn(Ra,{size:[OU,_pe,UM],offset:[-mpe/2+OU/2,0,UM/2],color:"#ccc"})]}),ype=2,gpe=1.25,$M=.55,gP=.5,_sn=ype-gP*2,hVe=({color:n="#333"})=>Dp(Km,{children:[Yn(Ra,{size:[_sn,gpe,$M],offset:[0,0,$M/2],color:n}),Yn(Ra,{size:[gP,gpe,$M],offset:[ype/2-gP/2,0,$M/2],color:"#ccc"}),Yn(Ra,{size:[gP,gpe,$M],offset:[-ype/2+gP/2,0,$M/2],color:"#ccc"})]}),ysn=({pinCount:n,pitch:e,leadWidth:t,padContactLength:i,bodyWidth:r})=>{const o=n/4;e||(e=gsn(n,r)),i||(i=vsn(n)),t||(t=xsn(n,r)),r||(r=e*(o+4));const s=r,a=(o-1)*e/2,c=s+2*i,l=c,u=.8,d=.15,h=(l-r)/2;return Dp(Km,{children:[Array.from({length:o}).map((f,m)=>Yn(Mx,{position:{x:-l/2,y:m*e-a,z:d/2},width:t,thickness:d,padContactLength:i,bodyDistance:h,height:u})),Array.from({length:o}).map((f,m)=>Yn(Mx,{rotation:Math.PI,position:{x:l/2,y:m*e-a,z:d/2},width:t,thickness:d,padContactLength:i,bodyDistance:h,height:u})),Array.from({length:o}).map((f,m)=>Yn(Mx,{rotation:Math.PI/2,position:{x:m*e-a,y:-c/2,z:d/2},width:t,thickness:d,padContactLength:i,bodyDistance:h,height:u})),Array.from({length:o}).map((f,m)=>Yn(Mx,{rotation:-Math.PI/2,position:{x:m*e-a,y:c/2,z:d/2},width:t,thickness:d,padContactLength:i,bodyDistance:h,height:u})),Yn(FM,{center:{x:0,y:0,z:d/2},width:r,length:s,height:1.5})]})},gsn=(n,e)=>{switch(n){case 44:case 64:return .8;case 52:return e===14?1:.65;case 208:return .5;default:return .5}},vsn=n=>{switch(n){case 44:case 52:case 64:return 2.25;case 208:return 1.65;default:return 1}},xsn=(n,e)=>{switch(n){case 44:case 64:return .5;case 52:return e===14?.45:.55;case 208:return .3;default:return .25}},bsn=({numberOfPins:n,pitch:e=2.54,longSidePinLength:t=6})=>{const o=n*e,s=3,a=-((n-1)/2)*e;return Dp(Km,{children:[Yn(Ra,{color:"#222",size:[o,.63*3,2],center:[0,0,2/2]}),Array.from({length:n},(c,l)=>Dp(Km,{children:[Yn(Ew,{color:"gold",children:Dp(NU,{children:[Yn(Ra,{color:"gold",size:[.63,.63,s*.9],center:[a+l*e,0,2*.9+2/2]}),Yn(Ra,{color:"gold",size:[.63/1.8,.63/1.8,s],center:[a+l*e,0,2+2/2]})]})}),Yn(Ew,{color:"gold",children:Dp(NU,{children:[Yn(Ra,{color:"gold",size:[.63,.63,t*.9],center:[a+l*e,0,-t/2*.9]}),Yn(Ra,{color:"gold",size:[.63/1.8,.63/1.8,t],center:[a+l*e,0,-t/2]})]})})]}))]})},wsn=n=>{const e=["left","bottom","right","top"],{pin_count:t,pn:i,w:r,h:o,p:s,pl:a}=n,c=t/4,l=e[Math.floor((i-1)/c)],u=(i-1)%c,d=s*(c-1),h=s*(c-1),f=-a/2;switch(l){case"left":return{x:-r/2-f,y:h/2-u*s,o:"vert"};case"bottom":return{x:-d/2+u*s,y:-o/2-f,o:"horz"};case"right":return{x:r/2+f,y:-h/2+u*s,o:"vert"};case"top":return{x:d/2-u*s,y:o/2+f,o:"horz"};default:throw new Error("Invalid pin number")}},Ssn=({num_pins:n,cw:e,ccw:t,startingpin:i})=>{const r=[],o=n/4;let s=1;const a={};for(const c of i??[])a[c]=!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=o:a.bottomside&&a.leftpin?s=o+1:a.bottomside&&a.rightpin?s=o*2:a.rightside&&a.bottompin?s=o*2+1:a.rightside&&a.toppin?s=o*3:a.topside&&a.rightpin?s=o*3+1:a.topside&&a.leftpin&&(s=o*4),r.push(-1);for(let c=0;c<n;c++)r[s]=c+1,s++,s>n&&(s=1);return r},Esn=({num_pins:n=16,bodyWidth:e=9,bodyLength:t=9,bodyThickness:i=.8,thermalPadSize:r,padWidth:o=.25,padLength:s=.25,pitch:a=.5,thermalPadThickness:c=.05})=>{const l=Ssn({num_pins:n,cw:!0,ccw:!0}),u=[];for(let d=0;d<n;d++){const{x:h,y:f,o:m}=wsn({pin_count:n,pn:d+1,w:e,h:t,p:a,pl:s});let y=o,g=s;m==="vert"&&([y,g]=[g,y]);const b=l[d+1];u.push({pn:b,x:h,y:f,pw:y,pl:g})}return Dp(Km,{children:[Yn(Ew,{color:"grey",children:Yn(Ra,{center:{x:0,y:0,z:i/2},size:[e,t,i]})}),u.map((d,h)=>Yn(Ra,{center:{x:d.x,y:d.y,z:c/2},size:[d.pw,d.pl,c]})),r?.length!==void 0&&r?.width!==void 0&&Yn(Ra,{center:{x:0,y:0,z:c/2},size:[r.width,r.length,c]})]})},Tsn=Esn,Msn=()=>{const c=1.1999999999999997;return Dp(Km,{children:[Yn(Mx,{rotation:Math.PI,position:{x:2.8/2+c/4,y:-1,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:c,height:.95}),Yn(Mx,{rotation:Math.PI,position:{x:2.8/2+c/4,y:1,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:c,height:.95}),Yn(Mx,{position:{x:-2.8/2-c/4,y:0,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:c,height:.95}),Yn(Mx,{position:{x:-2.8/2-c/4,y:-1,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:c,height:.95}),Yn(Mx,{position:{x:-2.8/2-c/4,y:1,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:c,height:.95}),Yn(FM,{center:{x:0,y:0,z:0},width:1.6,length:2.9,height:1.2})]})},Csn=Msn,vpe=.6,xpe=.3,jM=.33,vP=.1,Asn=vpe-vP*2,pVe=({color:n="#333"})=>Dp(Km,{children:[Yn(Ra,{size:[Asn,xpe,jM],offset:[0,0,jM/2],color:n}),Yn(Ra,{size:[vP,xpe,jM],offset:[vpe/2-vP/2,0,jM/2],color:"#ccc"}),Yn(Ra,{size:[vP,xpe,jM],offset:[-vpe/2+vP/2,0,jM/2],color:"#ccc"})]}),bpe=.4,wpe=.2,HM=.13,xP=.07,Rsn=bpe-xP*2,fVe=({color:n="#333"})=>Dp(Km,{children:[Yn(Ra,{size:[Rsn,wpe,HM],offset:[0,0,HM/2],color:n}),Yn(Ra,{size:[xP,wpe,HM],offset:[bpe/2-xP/2,0,HM/2],color:"#ccc"}),Yn(Ra,{size:[xP,wpe,HM],offset:[-bpe/2+xP/2,0,HM/2],color:"#ccc"})]}),Spe=3.2,Epe=1.6,VM=.9,bP=.5,Psn=Spe-bP*2,mVe=({color:n="#333"})=>Dp(Km,{children:[Yn(Ra,{size:[Psn,Epe,VM],offset:[0,0,VM/2],color:n}),Yn(Ra,{size:[bP,Epe,VM],offset:[Spe/2-bP/2,0,VM/2],color:"#ccc"}),Yn(Ra,{size:[bP,Epe,VM],offset:[-Spe/2+bP/2,0,VM/2],color:"#ccc"})]}),Tpe=3.2,Mpe=2.5,qM=1,wP=.6,Isn=Tpe-wP*2,_Ve=({color:n="#333"})=>Dp(Km,{children:[Yn(Ra,{size:[Isn,Mpe,qM],offset:[0,0,qM/2],color:n}),Yn(Ra,{size:[wP,Mpe,qM],offset:[Tpe/2-wP/2,0,qM/2],color:"#ccc"}),Yn(Ra,{size:[wP,Mpe,qM],offset:[-Tpe/2+wP/2,0,qM/2],color:"#ccc"})]}),Cpe=5,Ape=2.5,GM=1.4,SP=.6,Nsn=Cpe-SP*2,yVe=({color:n="#333"})=>Dp(Km,{children:[Yn(Ra,{size:[Nsn,Ape,GM],offset:[0,0,GM/2],color:n}),Yn(Ra,{size:[SP,Ape,GM],offset:[Cpe/2-SP/2,0,GM/2],color:"#ccc"}),Yn(Ra,{size:[SP,Ape,GM],offset:[-Cpe/2+SP/2,0,GM/2],color:"#ccc"})]}),Rpe=6.3,Ppe=3.2,YM=1.8,EP=.8,ksn=Rpe-EP*2,gVe=({color:n="#333"})=>Dp(Km,{children:[Yn(Ra,{size:[ksn,Ppe,YM],offset:[0,0,YM/2],color:n}),Yn(Ra,{size:[EP,Ppe,YM],offset:[Rpe/2-EP/2,0,YM/2],color:"#ccc"}),Yn(Ra,{size:[EP,Ppe,YM],offset:[-Rpe/2+EP/2,0,YM/2],color:"#ccc"})]}),Osn=({numberOfPins:n,pitch:e=2.54,legsLength:t=3,outerDiameter:i=.945,innerDiameter:r=.945})=>{const o=r/1.5,s=o*2+i,a=5,c=(n-1)*e+i+e/2,l=o*1.6,u=-((n-1)/2)*e,d=Yn(Ew,{color:"#1a1a1a",children:Dp(dpe,{children:[Yn(Ra,{color:"#000",size:[c,s,a],center:[0,0,a/2]}),Array.from({length:n},(h,f)=>r?Yn(p4,{height:a+.1,radius:r/2,center:[u+f*e,0,a/2],color:"#222"},f):Yn(Ra,{size:[l,l,a],center:[u+f*e,0,a/2]},f))]})});return Dp(Km,{children:[d,Array.from({length:n},(h,f)=>Dp(Ew,{color:"silver",children:[Dp(NU,{children:[Yn(Ra,{color:"silver",size:[o,o,t*.9],center:[u+f*e,0,-t/2*.9]}),Yn(Ra,{color:"silver",size:[o/1.8,o/1.8,t],center:[u+f*e,0,-t/2]})]}),Yn(Ra,{color:"silver",size:[l,l,l*.5],center:[u+f*e,0,l/2*.5]})]},f))]})},Dsn=({width:n,length:e,innerDiameter:t=1})=>{const i=n,r=e,o=n*.7,s=t/2.5;return Dp(Km,{children:[Yn(IU,{color:"#1a1a1f",center:[0,0,o/2],size:[r,r,o],roundRadius:.3}),Yn(IU,{color:"#f2f2f2",center:[0,0,o+o*.1/2.5],size:[r,r,o*.1],roundRadius:.14}),Yn(p4,{color:"#1a1a1f",height:o*.8,radius:i/3,center:[0,0,o+o*.8/2]}),Yn(p4,{color:"#1a1a1f",height:o*.2,radius:t/2,center:[r/3,r/3,o+o*.1/2]}),Yn(p4,{color:"#1a1a1f",height:o*.2,radius:t/2,center:[-r/3,-r/3,o+o*.1/2]}),Yn(p4,{color:"#1a1a1f",height:o*.2,radius:t/2,center:[-r/3,r/3,o+o*.1/2]}),Yn(p4,{color:"#1a1a1f",height:o*.2,radius:t/2,center:[r/3,-r/3,o+o*.1/2]}),Yn(DU,{thickness:t/3,width:s,horizontalLength:r*.8,verticalLength:o/2,position:{x:-i/2,y:-r/2,z:-o*1.2}}),Yn(DU,{thickness:t/3,width:s,horizontalLength:r*.8,verticalLength:o/2,position:{x:-i/2,y:r/2,z:-o*1.2},rotation:Math.PI}),Yn(DU,{thickness:t/3,width:s,horizontalLength:r*.8,verticalLength:o/2,position:{x:i/2,y:r/2,z:-o*1.2},rotation:Math.PI}),Yn(DU,{thickness:t/3,width:s,horizontalLength:r*.8,verticalLength:o/2,position:{x:i/2+t/3.6,y:-r/2,z:-o*1.2}})]})},DU=n=>{const{thickness:e,width:t,horizontalLength:i,verticalLength:r,rotation:o=0,position:s}=n,a=[[0,i],[-r/3,i/3],[-r/5,i/4],[0,0]],c=hpe(a,e);return Yn(Ew,{color:"#f2f2f2",children:Yn(f4,{offset:{x:s?.x||0,y:s?.y||0,z:s?.z||0},children:Yn(fP,{rotation:[0,55,o],children:Yn(_P,{height:t,children:Yn(mP,{points:c.map(l=>[l.y,l.x])})})})})})},Lsn=({pinCount:n,leadLength:e,leadWidth:t,pitch:i,bodyWidth:r})=>{const o=Math.ceil(n/2),s=(o-1)*i/2,a=.25,c=1,l=.8,u=e*0,d=i*(o-1)+t+.2,h=r*.55;return Dp(Km,{children:[Array.from({length:o}).map((f,m)=>Yn(Mx,{position:{x:-r/2-u,y:m*i-s,z:a/2},width:t,thickness:a,padContactLength:e/2,bodyDistance:e+.2,height:l})),Array.from({length:o}).map((f,m)=>Yn(Mx,{rotation:Math.PI,position:{x:r/2+u,y:m*i-s,z:a/2},width:t,thickness:a,padContactLength:e/2,bodyDistance:e+.2,height:l})),Yn(FM,{center:{x:0,y:0,z:a/2},width:h,length:d,height:c})]})},zsn=({pinCount:n,pitch:e,leadWidth:t,leadLength:i,bodyWidth:r,bodyLength:o})=>{const s=n===8?{pitch:.65,leadWidth:.3}:{pitch:.5,leadWidth:.225},a=isNaN(parseFloat(e))?s.pitch:parseFloat(e),c=isNaN(parseFloat(t))?s.leadWidth:parseFloat(t)*.8,l=isNaN(parseFloat(r))?2.6:parseFloat(r)*.8,u=isNaN(parseFloat(o))?2+Number(a)*1.4:parseFloat(o),d=n/2,h=(d-1)*a/2,f=.15,m=.8,y=4.5,g=(y-l)/2,b=g*.5;return Dp(Km,{children:[Array.from({length:d}).map((x,w)=>Yn(Mx,{position:{x:-y/2,y:h-w*a,z:f/2},width:c,thickness:f,padContactLength:b+.05,bodyDistance:g+.05,height:m})),Array.from({length:d}).map((x,w)=>Yn(Mx,{rotation:Math.PI,position:{x:y/2,y:h-w*a,z:f/2},width:c,thickness:f,padContactLength:b+.05,bodyDistance:g+.05,height:m})),Yn(FM,{center:{x:0,y:0,z:f/2},width:l,length:u,height:1})]})},Fsn=({footprint:n})=>{const e=ssn.string(n).json();switch(e.fn){case"dip":return Yn(dsn,{numPins:e.num_pins,pitch:e.p,bodyWidth:e.w});case"tssop":return Yn(psn,{pinCount:e.num_pins,leadLength:e.pl,leadWidth:e.pw,pitch:e.p,bodyWidth:e.w});case"vssop":return Yn(zsn,{pinCount:e.num_pins,leadLength:e.pl,leadWidth:e.pw,pitch:e.p,bodyWidth:e.w,bodyLength:e.h});case"qfp":return Yn(ysn,{pinCount:e.num_pins,pitch:e.p,leadWidth:e.pw,padContactLength:e.pl,bodyWidth:e.w});case"qfn":return Yn(Tsn,{num_pins:e.num_pins,bodyWidth:e.w,bodyLength:e.h,pitch:e.p,padLength:e.pl,padWidth:e.pw,thermalPadSize:{width:e.thermalpad.x,length:e.thermalpad.y}});case"pinrow":if(e.male)return Yn(bsn,{numberOfPins:e.num_pins,pitch:e.p});if(e.female)return Yn(Osn,{numberOfPins:e.num_pins,pitch:e.p});case"cap":switch(e.imperial){case"0402":return Yn(uVe,{color:"#856c4d"});case"0603":return Yn(dVe,{color:"#856c4d"});case"0805":return Yn(hVe,{color:"#856c4d"});case"0201":return Yn(pVe,{color:"#856c4d"});case"01005":return Yn(fVe,{color:"#856c4d"});case"1206":return Yn(mVe,{color:"#856c4d"});case"1210":return Yn(_Ve,{color:"#856c4d"});case"2010":return Yn(yVe,{color:"#856c4d"});case"2512":return Yn(gVe,{color:"#856c4d"})}case"sot235":return Yn(Csn,{});case"pushbutton":return Yn(Dsn,{width:e.w,length:e.h,innerDiameter:e.id});case"soic":return Yn(Lsn,{pinCount:e.num_pins,leadLength:e.pl,leadWidth:e.pw,pitch:e.p,bodyWidth:e.w})}switch(e.imperial){case"0402":return Yn(uVe,{});case"0603":return Yn(dVe,{});case"0805":return Yn(hVe,{});case"0201":return Yn(pVe,{});case"01005":return Yn(fVe,{});case"1206":return Yn(mVe,{});case"1210":return Yn(_Ve,{});case"2010":return Yn(yVe,{});case"2512":return Yn(gVe,{})}return null},Bsn=n=>n&&typeof n=="object"&&"type"in n,XM=n=>{if(typeof n=="number")return n;if(typeof n=="string"){const e=/^(-?\d+(?:\.\d+)?)\s*deg$/i.exec(n);if(e)return parseFloat(e[1])*Math.PI/180;const t=Number(n);if(!Number.isNaN(t))return t}return 0},Usn=n=>Array.isArray(n)?[Number(n[0])||0,Number(n[1])||0,Number(n[2])||0]:typeof n=="object"&&n?[Number(n.x)||0,Number(n.y)||0,Number(n.z)||0]:[0,0,0];function n3(n,e){if(n==null||n===!1)return[];if(Array.isArray(n))return n.flatMap(o=>n3(o,e));if(!Bsn(n))return[];const{type:t,props:i,children:r}=n;if(t===oVe)return(r??[]).flatMap(o=>n3(o,e));if(t===Ew){const o=i?.color;return(r??[]).flatMap(s=>n3(s,o??e))}if(t===f4){const o=Usn(i?.offset??{x:i?.x,y:i?.y,z:i?.z});return(r??[]).flatMap(a=>n3(a,e)).map(({geom:a,color:c})=>({geom:Tx.transforms.translate(o,a),color:c??e}))}if(t===fP){const o=Array.isArray(i?.rotation)?[XM(i.rotation[0]),XM(i.rotation[1]),XM(i.rotation[2])]:[XM(i?.x??0),XM(i?.y??0),XM(i?.z??0)];return(r??[]).flatMap(a=>n3(a,e)).map(({geom:a,color:c})=>({geom:Tx.transforms.rotateZ(o[2],Tx.transforms.rotateY(o[1],Tx.transforms.rotateX(o[0],a))),color:c}))}if(t===cVe||t===dpe||t===NU){const o=(r??[]).flatMap(a=>n3(a,e)).map(a=>a.geom);if(o.length===0)return[];let s;return t===cVe?s=Tx.booleans.union(o):t===dpe?s=Tx.booleans.subtract(o[0],o.slice(1)):s=Tx.hulls.hull(o),[{geom:s}]}if(t===mP){const o=i?.points??[];return[{geom:Tx.geometries.geom2.fromPoints(o),color:e??i?.color}]}if(t===_P){const o=(r??[]).flatMap(l=>n3(l,e)).map(l=>l.geom);if(o.length===0)return[];const s=o.length>1?Tx.booleans.union(o):o[0],a=i?.height??i?.h??1;return[{geom:Tx.extrusions.extrudeLinear({height:a},s),color:e??i?.color}]}if(t===Ra||t===sVe||t===p4||t===aVe||t===IU){let o;if(t===Ra){const s=i?.size??[1,1,1],a=i?.offset,c=i?.center??(a?[a[0],a[1],a[2]]:[0,0,0]);o=Tx.primitives.cuboid({size:s,center:c})}else if(t===sVe){const s=i?.size??1,a=i?.offset,c=i?.center??(a?[a[0],a[1],a[2]]:[0,0,0]);o=Tx.primitives.cube({size:s,center:c})}else if(t===p4){const s=i?.height??1,a=i?.radius??1,c=i?.center??[0,0,0];o=Tx.primitives.cylinder({height:s,radius:a,center:c})}else if(t===aVe){const s=i?.radius??1,a=i?.center??[0,0,0];o=Tx.primitives.sphere({radius:s,center:a})}else{const s=i?.size??[1,1,1],a=i?.roundRadius??.1,c=i?.center??[0,0,0];o=Tx.primitives.roundedCuboid({size:s,roundRadius:a,center:c})}return[{geom:o,color:e??i?.color}]}if(typeof t=="function"){const o=t(i??{});return n3(o,e)}return(r??[]).flatMap(o=>n3(o,e))}function $sn(n){return{geometries:n3(n)}}function vVe(n){if(n.polygons){const e=[],t=[],i=[];let r=0;for(const s of n.polygons){for(const c of s.vertices)c.index=r,e.push(c[0],c[1],c[2]),n.color&&n.color.length>=3?i.push(n.color[0],n.color[1],n.color[2]):i.push(1,1,1),r++;const a=s.vertices[0].index;for(let c=2;c<s.vertices.length;c++){const l=s.vertices[c-1].index,u=s.vertices[c].index;t.push(a,l,u)}}const o=new Ly;if(o.setAttribute("position",new um(new Float32Array(e),3)),o.setIndex(t),i.length>0&&o.setAttribute("color",new um(new Float32Array(i),3)),n.transforms){const s=new Ud;s.fromArray(n.transforms),o.applyMatrix4(s)}return o.computeVertexNormals(),o}if(n.sides){const e=[],t=[];for(const r of n.sides)e.push(r[0][0],r[0][1],0),n.color&&n.color.length>=3?t.push(n.color[0],n.color[1],n.color[2]):t.push(1,1,1);const i=new Ly;if(i.setAttribute("position",new um(new Float32Array(e),3)),t.length>0&&i.setAttribute("color",new um(new Float32Array(t),3)),n.transforms){const r=new Ud;r.fromArray(n.transforms),i.applyMatrix4(r)}return i}return console.error("Invalid CSG object: neither polygons nor sides found"),new Ly}function jsn(n){const e=upe(Fsn,{footprint:n});return $sn(e)}var Hsn=({jscadPlan:n,positionOffset:e,rotationOffset:t,onHover:i,onUnhover:r,isHovered:o})=>{const{rootObject:s}=Ex(),{threeGeom:a,material:c}=Ee.useMemo(()=>{const u=(0,GJt.executeJscadOperations)(YJt.default,n);if(!u||!u.polygons&&!u.sides)return{threeGeom:null,material:null};const d=vVe(u),h=new lw({vertexColors:!0,side:N1});return{threeGeom:d,material:h}},[n]),l=Ee.useMemo(()=>a?new kp(a,c):null,[a,c]);return Ee.useEffect(()=>{if(!(!l||!s))return s.add(l),()=>{s.remove(l)}},[s,l]),Ee.useEffect(()=>{l&&(e&&l.position.fromArray(e),t&&l.rotation.fromArray(t))},[l,e?.[0],e?.[1],e?.[2],t?.[0],t?.[1],t?.[2]]),Ee.useMemo(()=>{if(c)if(o){const u=new Ho(c.color.getHex());c.emissive.copy(u),c.emissive.setRGB(0,0,1),c.emissiveIntensity=.2}else c.emissiveIntensity=0},[o,c]),a?_e.jsx(SU,{isHovered:o,onHover:i,onUnhover:r,object:l}):null},Vsn=({positionOffset:n,footprint:e,rotationOffset:t,onHover:i,onUnhover:r,isHovered:o})=>{const{rootObject:s}=Ex(),a=Ee.useMemo(()=>{if(!e)return null;const{geometries:c}=jsn(e),l=new GS;for(const u of c.flat(1/0)){const d=u.geom;if(!d||!d.polygons&&!d.sides)continue;const h=new Ho(u.color);h.convertLinearToSRGB();const f={...d,color:[h.r,h.g,h.b]},m=vVe(f),y=new lw({vertexColors:!0,side:N1}),g=new kp(m,y);l.add(g)}return l},[e]);return Ee.useEffect(()=>{if(!(!a||!s))return s.add(a),()=>{s.remove(a)}},[s,a]),Ee.useEffect(()=>{a&&(n&&a.position.fromArray(n),t&&a.rotation.fromArray(t))},[a,n?.[0],n?.[1],n?.[2],t?.[0],t?.[1],t?.[2]]),Ee.useEffect(()=>{a&&a.traverse(c=>{c instanceof kp&&c.material instanceof lw&&(o?(c.material.emissive.setHex(255),c.material.emissiveIntensity=.2):c.material.emissiveIntensity=0)})},[o,a]),a?_e.jsx(SU,{isHovered:o,onHover:i,onUnhover:r,object:a}):null},qsn=(...n)=>n,xVe=({children:n,position:e,style:t})=>{const{camera:i,renderer:r}=Ex(),o=Ee.useRef(document.createElement("div")),[s,a]=Ee.useState(null);return Ee.useEffect(()=>{const c=r?.domElement.parentNode;if(c)return c.appendChild(o.current),a(sX.createPortal(n,o.current)),()=>{c.contains(o.current)&&c.removeChild(o.current)}},[r,n]),uP(()=>{if(!i||!o.current||!r)return;const c=new Jt(...e);c.project(i);const l=r.domElement.getBoundingClientRect(),u=Math.round((c.x+1)/2*l.width),d=Math.round((-c.y+1)/2*l.height);o.current.style.position="absolute",o.current.style.left=`${l.left+u}px`,o.current.style.top=`${l.top+d}px`,o.current.style.pointerEvents="none",t&&Object.assign(o.current.style,t)},[i,r,e,t]),s},bVe=({cad_component:n,circuitJson:e})=>{const[t,i]=Ee.useState(!1),[r,o]=Ee.useState(null),s=Ee.useCallback(h=>{h?.mousePosition?(i(!0),o(h.mousePosition)):(i(!1),o(null))},[]),a=Ee.useCallback(()=>{i(!1),o(null)},[]),c=Ee.useMemo(()=>Xs(e).source_component.getUsing({source_component_id:n.source_component_id})?.name,[e,n.source_component_id]),l=n.model_obj_url??n.model_stl_url,u=n.rotation?qsn(n.rotation.x*Math.PI/180,n.rotation.y*Math.PI/180,n.rotation.z*Math.PI/180):void 0;let d=null;return l?d=_e.jsx(qJt,{url:l,position:n.position?[n.position.x,n.position.y,n.position.z]:void 0,rotation:u,onHover:s,onUnhover:a,isHovered:t},n.cad_component_id):n.model_jscad?d=_e.jsx(Hsn,{jscadPlan:n.model_jscad,rotationOffset:u,onHover:s,onUnhover:a,isHovered:t},n.cad_component_id):n.footprinter_string&&(d=_e.jsx(Vsn,{positionOffset:n.position?[n.position.x,n.position.y,n.position.z]:void 0,rotationOffset:u,footprint:n.footprinter_string,onHover:s,onUnhover:a,isHovered:t})),_e.jsxs(_e.Fragment,{children:[d,t&&r?_e.jsx(xVe,{position:r,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:c??"<unknown>"}):null]})},wVe={version:"0.0.357"},wT=({children:n,parent:e,position:t,rotation:i,scale:r,color:o,fontSize:s,anchorX:a,anchorY:c,depthOffset:l})=>{const{rootObject:u}=Ex(),d=Ee.useMemo(()=>{const h=new OTe;return h.text=n,t&&h.position.fromArray(t),i&&h.rotation.fromArray(i),r&&h.scale.fromArray(r),h.color=o||"white",h.fontSize=s||1,h.anchorX=a||"center",h.anchorY=c||"middle",h.depthOffset=l||0,h.font=null,h.sync(),h},[n,t,i,r,o,s,a,c,l]);return Ee.useEffect(()=>{const h=e||u;if(!(!h||!d))return h.add(d),()=>{h.remove(d),d.dispose()}},[u,e,d]),null};typeof window<"u"&&(window.TSCI_MAIN_CAMERA_ROTATION=new r9(0,0,0));function Gsn(n,e){const t=new FS().setFromEuler(new r9(n.x,n.y,n.z)),i=new Jt(0,0,1);return i.applyQuaternion(t),i.multiplyScalar(e)}var Ysn=({})=>{const{camera:n,scene:e}=Ex();Ee.useEffect(()=>{if(!e)return;const i=new GEe(16777215,Math.PI/2);return e.add(i),()=>{e.remove(i)}},[e]),uP(()=>{if(!n)return;const i=window.TSCI_MAIN_CAMERA_ROTATION,r=Gsn(i,2);n.position.copy(r),n.lookAt(0,0,0)});const t=Ee.useMemo(()=>{const i=new GS;i.rotation.fromArray([Math.PI/2,0,0]);const r=new kp(new cw(1,1,1),new lw({color:"white"}));i.add(r);const o=new uK(new mbt(new cw(1,1,1)),new HA({color:0,linewidth:2}));return i.add(o),i},[]);return Ee.useEffect(()=>{if(e)return e.add(t),()=>{e.remove(t)}},[e,t]),_e.jsxs(_e.Fragment,{children:[_e.jsx(wT,{parent:t,position:[0,0,.51],fontSize:.25,color:"black",children:"Front"}),_e.jsx(wT,{parent:t,position:[0,0,-.51],fontSize:.25,color:"black",rotation:[0,Math.PI,0],children:"Back"}),_e.jsx(wT,{parent:t,position:[.51,0,0],fontSize:.25,color:"black",rotation:[0,Math.PI/2,0],children:"Right"}),_e.jsx(wT,{parent:t,position:[-.51,0,0],fontSize:.25,color:"black",rotation:[0,-Math.PI/2,0],children:"Left"}),_e.jsx(wT,{parent:t,position:[0,.51,0],fontSize:.25,color:"black",rotation:[-Math.PI/2,0,0],children:"Top"}),_e.jsx(wT,{parent:t,position:[0,-.51,0],fontSize:.25,color:"black",rotation:[Math.PI/2,0,0],children:"Bottom"})]})};function Xsn(n){n.querySelectorAll("canvas").forEach(e=>e.remove())}var SVe=Ee.forwardRef(({children:n,scene:e,camera:t,style:i},r)=>{const o=Ee.useRef(null),[s,a]=Ee.useState(null),c=Ee.useRef([]),l=Ee.useCallback(f=>{c.current.push(f)},[]),u=Ee.useCallback(f=>{c.current=c.current.filter(m=>m!==f)},[]),d=Ee.useMemo(()=>new fD,[]);e?.up&&d.up.set(e.up.x,e.up.y,e.up.z);const h=Ee.useRef(new k1);return Ee.useImperativeHandle(r,()=>h.current),Ee.useEffect(()=>{if(!o.current)return;Xsn(o.current);const f=new NEe({antialias:!0,alpha:!0});f.setSize(o.current.clientWidth,o.current.clientHeight),f.setPixelRatio(window.devicePixelRatio),o.current.appendChild(f.domElement);const m=new ub(75,o.current.clientWidth/o.current.clientHeight,.1,1e3);t?.up&&m.up.set(t.up[0],t.up[1],t.up[2]),t?.position&&m.position.set(t.position[0],t.position[1],t.position[2]),m.lookAt(0,0,0),d.add(h.current),window.__TSCIRCUIT_THREE_OBJECT=h.current,a({scene:d,camera:m,renderer:f,rootObject:h.current,addFrameListener:l,removeFrameListener:u});let y;const g=new Tbt,b=()=>{const w=g.getElapsedTime(),T=g.getDelta();c.current.forEach(N=>N(w,T)),f.render(d,m),y=requestAnimationFrame(b)};b();const x=()=>{o.current&&(m.aspect=o.current.clientWidth/o.current.clientHeight,m.updateProjectionMatrix(),f.setSize(o.current.clientWidth,o.current.clientHeight))};return window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x),cancelAnimationFrame(y),o.current&&f.domElement&&o.current.removeChild(f.domElement),f.dispose(),d.remove(h.current),window.__TSCIRCUIT_THREE_OBJECT===h.current&&(window.__TSCIRCUIT_THREE_OBJECT=void 0)}},[d,l,u]),_e.jsx("div",{ref:o,style:{width:"100%",height:"100%",...i},children:s&&_e.jsx(cHe.Provider,{value:s,children:_e.jsx(jJt,{children:n})})})}),Wsn=({autoRotate:n,autoRotateSpeed:e,onStart:t,panSpeed:i,rotateSpeed:r,zoomSpeed:o,enableDamping:s,dampingFactor:a})=>{const{camera:c,renderer:l}=Ex(),u=Ee.useMemo(()=>!c||!l?null:new d2t(c,l.domElement),[c,l]);return Ee.useEffect(()=>{u&&(u.autoRotate=n||!1,u.autoRotateSpeed=e||1,i!==void 0&&(u.panSpeed=i),r!==void 0&&(u.rotateSpeed=r),o!==void 0&&(u.zoomSpeed=o),s!==void 0&&(u.enableDamping=s),a!==void 0&&(u.dampingFactor=a))},[u,n,e,i,r,o,s,a]),Ee.useEffect(()=>{if(!(!u||!t))return u.addEventListener("start",t),()=>{u.removeEventListener("start",t)}},[u,t]),Ee.useEffect(()=>{if(u)return()=>{u.dispose()}},[u]),uP(()=>{u?.update()},[u]),null},Zsn=`
5071
+ `).replace(/d 0\./g,"d 1."),d=l.replace(/newmtl[\s\S]*?endmtl/g,""),h=new c9t;h.setMaterialOptions({invertTrProperty:!0});const f=h.parse(u.replace(/Kd\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/g,"Kd $2 $2 $2"),"test.mtl"),m=new m9t;return m.setMaterials(f),m.parse(d)}catch(c){return c}}function a(){if(r.has(i)){const l=r.get(i);return l.result?Promise.resolve(l.result.clone()):l.promise.then(u=>u instanceof Error?u:u.clone())}const c=s().then(l=>(l instanceof Error||r.set(i,{...r.get(i),result:l}),l));return r.set(i,{promise:c,result:null}),c}return a().then(c=>{o||t(c)}).catch(c=>{console.error(c)}),()=>{o=!0}},[n]),e}function qJt({url:n,position:e,rotation:t,onHover:i,onUnhover:r,isHovered:o}){const s=VJt(n),{rootObject:a}=Ex(),c=Ee.useMemo(()=>s&&!(s instanceof Error)?s:new kp(new cw(.5,.5,.5),new lw({transparent:!0,color:"red",opacity:.25})),[s]);if(Ee.useEffect(()=>{if(!(!a||!c))return a.add(c),()=>{a.remove(c)}},[a,c]),Ee.useEffect(()=>{c&&(e&&(Array.isArray(e)?c.position.fromArray(e):c.position.copy(e)),t&&(Array.isArray(t)?c.rotation.fromArray(t):c.rotation.copy(t)))},[c,Array.isArray(e)?e[0]:e?.x,Array.isArray(e)?e[1]:e?.y,Array.isArray(e)?e[2]:e?.z,Array.isArray(t)?t[0]:t?.x,Array.isArray(t)?t[1]:t?.y,Array.isArray(t)?t[2]:t?.z]),s instanceof Error)throw s;return _e.jsx(SU,{isHovered:o,onHover:i,onUnhover:r,object:c})}var GJt=ep(B$e()),YJt=ep(Qhe()),uHe={in:25.4,inch:25.4,mil:.0254,mm:1,m:1e3,cm:10,ft:304.8,feet:304.8},Xu=n=>{let e=typeof n=="number"?"mm":n.replace(/^[^a-zA-Z]+/g,"").toLowerCase();e||(e="mm");const t=typeof n=="number"?n:Number.parseFloat(n.split(e)[0]);if(e in uHe)return t*uHe[e];throw new Error(`Unsupported unit: ${e}`)},dP=Xu,dHe={Hz:{baseUnit:"Hz",variants:{MHz:1e6,kHz:1e3,Hz:1}},g:{baseUnit:"g",variants:{kg:1e3,g:1}},Ω:{baseUnit:"Ω",variants:{mΩ:.001,Ω:1,kΩ:1e3,KΩ:1e3,kohm:1e3,MΩ:1e6,GΩ:1e9,TΩ:1e12}},V:{baseUnit:"V",variants:{mV:.001,V:1,kV:1e3,KV:1e3,MV:1e6,GV:1e9,TV:1e12}},A:{baseUnit:"A",variants:{µA:1e-6,mA:.001,ma:.001,A:1,kA:1e3,MA:1e6}},F:{baseUnit:"F",variants:{pF:1e-12,nF:1e-9,µF:1e-6,uF:1e-6,mF:.001,F:1}},ml:{baseUnit:"ml",variants:{ml:1,mL:1,l:1e3,L:1e3}},deg:{baseUnit:"deg",variants:{rad:180/Math.PI}},ms:{baseUnit:"ms",variants:{s:1e3}},mm:{baseUnit:"mm",variants:{nm:1e-6,µm:.001,um:.001,mm:1,cm:10,dm:100,m:1e3,km:1e6,in:25.4,ft:304.8,IN:25.4,FT:304.8,yd:914.4,mi:1609344,mil:.0254}}},Jhe=new Set;for(const[n,e]of Object.entries(dHe)){Jhe.add(n);for(const t of Object.keys(e.variants))Jhe.add(t)}function XJt(n){for(const[e,t]of Object.entries(dHe))if(n in t.variants)return{baseUnit:t.baseUnit,conversionFactor:t.variants[n]};return{baseUnit:n,conversionFactor:1}}var hHe={tera:1e12,T:1e12,giga:1e9,G:1e9,mega:1e6,M:1e6,kilo:1e3,k:1e3,deci:.1,d:.1,centi:.01,c:.01,milli:.001,m:.001,micro:1e-6,u:1e-6,µ:1e-6,nano:1e-9,n:1e-9,pico:1e-12,p:1e-12},V2=n=>{if(typeof n>"u")return{parsedUnit:null,unitOfValue:null,value:null};if(typeof n=="string"&&n.match(/^-?[\d\.]+$/))return{value:Number.parseFloat(n),parsedUnit:null,unitOfValue:null};if(typeof n=="number")return{value:n,parsedUnit:null,unitOfValue:null};if(typeof n=="object"&&"x"in n&&"y"in n){const{parsedUnit:a,unitOfValue:c}=V2(n.x);return{parsedUnit:a,unitOfValue:c,value:{x:V2(n.x).value,y:V2(n.y).value}}}const t=n.toString().split("").reverse().join("").match(/[^\d\s]+/)?.[0];if(!t)throw new Error(`Could not determine unit: "${n}"`);const i=t.split("").reverse().join(""),r=n.slice(0,-i.length);if(i in hHe&&!Jhe.has(i)){const a=hHe[i];return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(r)*a}}const{baseUnit:o,conversionFactor:s}=XJt(i);return{parsedUnit:i,unitOfValue:o,value:s*Number.parseFloat(r)}},epe=U().or(Fe()).transform(n=>V2(n).value),pHe=U().or(Fe()).transform(n=>V2(n).value).transform(n=>Number.parseFloat(n.toPrecision(12))),WJt=U().or(Fe()).transform(n=>V2(n).value),zM=U().or(Fe()).transform(n=>V2(n).value),st=U().or(Fe()).transform(n=>V2(n).value),fHe=U().or(Fe()).transform(n=>V2(n).value),vi=st;U().or(Fe()).transform(n=>V2(n).value),U().or(Fe()).transform(n=>V2(n).value);var bT=U().or(Fe()).transform(n=>typeof n=="number"?n:n.endsWith("deg")?Number.parseFloat(n.split("deg")[0]):n.endsWith("rad")?Number.parseFloat(n.split("rad")[0])*180/Math.PI:Number.parseFloat(n)),ZJt=Fe().or(U().endsWith("mAh")).transform(n=>{if(typeof n=="string"){const e=n.replace("mAh",""),t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error("Invalid capacity");return t}return n}).describe("Battery capacity in mAh"),Fl=Re({x:vi,y:vi}),tpe=Re({x:vi,y:vi,z:vi}),mHe=Re({width:Fe(),height:Fe()}),KJt=n=>{const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";return Array.from({length:n},()=>e[Math.floor(Math.random()*e.length)]).join("")},go=n=>U().optional().default(()=>`${n}_${KJt(10)}`),npe=Gt(["top_left","top_center","top_right","center_left","center","center_right","bottom_left","bottom_center","bottom_right"]),QJt=Gt(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),zg=Re({type:we("source_component"),ftype:U().optional(),source_component_id:U(),name:U(),manufacturer_part_number:U().optional(),supplier_part_numbers:ms(QJt,mt(U())).optional(),display_value:U().optional(),are_pins_interchangeable:vt().optional(),internally_connected_source_port_ids:mt(mt(U())).optional(),source_group_id:U().optional(),subcircuit_id:U().optional()}),_He=zg.extend({ftype:we("simple_capacitor"),capacitance:pHe,max_voltage_rating:zM.optional(),display_capacitance:U().optional(),max_decoupling_trace_length:vi.optional()}),yHe=zg.extend({ftype:we("simple_resistor"),resistance:epe,display_resistance:U().optional()}),ipe=zg.extend({ftype:we("simple_diode")}),gHe=ipe.extend({ftype:we("simple_led"),color:U().optional(),wavelength:U().optional()}),JJt=zg.extend({ftype:we("simple_ground")}),vHe=zg.extend({ftype:we("simple_chip")}),xHe=zg.extend({ftype:we("simple_power_source"),voltage:zM}),een=zg.extend({ftype:we("simple_fuse"),current_rating_amps:Fe().describe("Nominal current in amps the fuse is rated for"),voltage_rating_volts:Fe().describe("Voltage rating in volts, e.g. ±5V would be 5")}),bHe=zg.extend({ftype:we("simple_battery"),capacity:ZJt}),wHe=zg.extend({ftype:we("simple_inductor"),inductance:WJt,max_current_rating:Fe().optional()}),SHe=zg.extend({ftype:we("simple_push_button")}),EHe=zg.extend({ftype:we("simple_potentiometer"),max_resistance:epe}),ten=zg.extend({ftype:we("simple_crystal"),frequency:Fe().describe("Frequency in Hz"),load_capacitance:Fe().optional().describe("Load capacitance in pF")}),THe=zg.extend({ftype:we("simple_pin_header"),pin_count:Fe(),gender:Gt(["male","female"]).optional().default("male")}),MHe=zg.extend({ftype:we("simple_resonator"),load_capacitance:pHe,equivalent_series_resistance:epe.optional(),frequency:fHe}),CHe=zg.extend({ftype:we("simple_transistor"),transistor_type:Gt(["npn","pnp"])}),AHe=zg.extend({ftype:we("simple_test_point"),footprint_variant:Gt(["pad","through_hole"]).optional(),pad_shape:Gt(["rect","circle"]).optional(),pad_diameter:Gn([Fe(),U()]).optional(),hole_diameter:Gn([Fe(),U()]).optional(),width:Gn([Fe(),U()]).optional(),height:Gn([Fe(),U()]).optional()}),RHe=zg.extend({ftype:we("simple_mosfet"),channel_type:Gt(["n","p"]),mosfet_mode:Gt(["enhancement","depletion"])}),PHe=zg.extend({ftype:we("simple_switch")}),IHe=Re({type:we("source_project_metadata"),name:U().optional(),software_used_string:U().optional(),project_url:U().optional(),created_at:U().datetime().optional()}),nen=Re({type:we("source_missing_property_error"),source_missing_property_error_id:go("source_missing_property_error"),source_component_id:U(),property_name:U(),subcircuit_id:U().optional(),error_type:we("source_missing_property_error").default("source_missing_property_error"),message:U()}).describe("The source code is missing a property"),ien=Re({type:we("source_failed_to_create_component_error"),source_failed_to_create_component_error_id:go("source_failed_to_create_component_error"),error_type:we("source_failed_to_create_component_error").default("source_failed_to_create_component_error"),component_name:U().optional(),subcircuit_id:U().optional(),parent_source_component_id:U().optional(),message:U(),pcb_center:Re({x:Fe().optional(),y:Fe().optional()}).optional(),schematic_center:Re({x:Fe().optional(),y:Fe().optional()}).optional()}).describe("Error emitted when a component fails to be constructed"),NHe=Re({type:we("source_trace_not_connected_error"),source_trace_not_connected_error_id:go("source_trace_not_connected_error"),error_type:we("source_trace_not_connected_error").default("source_trace_not_connected_error"),message:U(),subcircuit_id:U().optional(),source_group_id:U().optional(),source_trace_id:U().optional(),connected_source_port_ids:mt(U()).optional(),selectors_not_found:mt(U()).optional()}).describe("Occurs when a source trace selector does not match any ports"),ren=Gn([yHe,_He,ipe,gHe,JJt,vHe,xHe,bHe,wHe,SHe,EHe,ten,THe,MHe,PHe,CHe,AHe,RHe,een,IHe,nen,ien,NHe]),oen=Re({type:we("source_port"),pin_number:Fe().optional(),port_hints:mt(U()).optional(),name:U(),source_port_id:U(),source_component_id:U(),subcircuit_id:U().optional(),subcircuit_connectivity_map_key:U().optional()}),sen=Re({type:we("source_trace"),source_trace_id:U(),connected_source_port_ids:mt(U()),connected_source_net_ids:mt(U()),subcircuit_id:U().optional(),subcircuit_connectivity_map_key:U().optional(),max_length:Fe().optional(),min_trace_thickness:Fe().optional(),display_name:U().optional()}),aen=Re({type:we("source_group"),source_group_id:U(),subcircuit_id:U().optional(),parent_subcircuit_id:U().optional(),parent_source_group_id:U().optional(),is_subcircuit:vt().optional(),name:U().optional()}),cen=Re({type:we("source_net"),source_net_id:U(),name:U(),member_source_group_ids:mt(U()),is_power:vt().optional(),is_ground:vt().optional(),is_digital_signal:vt().optional(),is_analog_signal:vt().optional(),trace_width:Fe().optional(),subcircuit_id:U().optional(),subcircuit_connectivity_map_key:U().optional()}),len=Re({type:we("source_pcb_ground_plane"),source_pcb_ground_plane_id:U(),source_group_id:U(),source_net_id:U(),subcircuit_id:U().optional()}).describe("Defines a ground plane in the source domain"),uen=Re({type:we("schematic_box"),schematic_component_id:U().optional(),width:vi,height:vi,is_dashed:vt().default(!1),x:vi,y:vi,subcircuit_id:U().optional()}).describe("Draws a box on the schematic"),den=Re({type:we("schematic_path"),schematic_component_id:U(),fill_color:Gt(["red","blue"]).optional(),is_filled:vt().optional(),points:mt(Fl),subcircuit_id:U().optional()}),hen=ms(Re({left_margin:st.optional(),right_margin:st.optional(),top_margin:st.optional(),bottom_margin:st.optional()})),pen=Re({left_size:Fe(),right_size:Fe(),top_size:Fe().optional(),bottom_size:Fe().optional()}),fen=Re({left_side:Re({pins:mt(Fe()),direction:Gt(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:Re({pins:mt(Fe()),direction:Gt(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:Re({pins:mt(Fe()),direction:Gt(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:Re({pins:mt(Fe()),direction:Gt(["left-to-right","right-to-left"]).optional()}).optional()}),men=Gn([pen,fen]),_en=Re({type:we("schematic_component"),size:mHe,center:Fl,source_component_id:U(),schematic_component_id:U(),pin_spacing:st.optional(),pin_styles:hen.optional(),box_width:st.optional(),symbol_name:U().optional(),port_arrangement:men.optional(),port_labels:ms(U()).optional(),symbol_display_value:U().optional(),subcircuit_id:U().optional(),schematic_group_id:U().optional()}),yen=Re({type:we("schematic_line"),schematic_component_id:U(),x1:vi,x2:vi,y1:vi,y2:vi,subcircuit_id:U().optional()}),gen=Re({type:we("schematic_trace"),schematic_trace_id:U(),source_trace_id:U(),junctions:mt(Re({x:Fe(),y:Fe()})),edges:mt(Re({from:Re({x:Fe(),y:Fe()}),to:Re({x:Fe(),y:Fe()}),is_crossing:vt().optional(),from_schematic_port_id:U().optional(),to_schematic_port_id:U().optional()})),subcircuit_id:U().optional()}),ven=Gt(["center","left","right","top","bottom"]),xen=Re({type:we("schematic_text"),schematic_component_id:U().optional(),schematic_text_id:U(),text:U(),font_size:Fe().default(.18),position:Re({x:vi,y:vi}),rotation:Fe().default(0),anchor:Gn([ven.describe("legacy"),npe]).default("center"),color:U().default("#000000"),subcircuit_id:U().optional()}),ben=Re({type:we("schematic_port"),schematic_port_id:U(),source_port_id:U(),schematic_component_id:U().optional(),center:Fl,facing_direction:Gt(["up","down","left","right"]).optional(),distance_from_component_edge:Fe().optional(),side_of_component:Gt(["top","bottom","left","right"]).optional(),true_ccw_index:Fe().optional(),pin_number:Fe().optional(),display_pin_label:U().optional(),subcircuit_id:U().optional(),is_connected:vt().optional()}).describe("Defines a port on a schematic component"),wen=Re({type:we("schematic_net_label"),schematic_net_label_id:go("schematic_net_label"),schematic_trace_id:U().optional(),source_trace_id:U().optional(),source_net_id:U(),center:Fl,anchor_position:Fl.optional(),anchor_side:Gt(["top","bottom","left","right"]),text:U(),symbol_name:U().optional(),is_movable:vt().optional(),subcircuit_id:U().optional()}),Sen=Re({type:we("schematic_error"),schematic_error_id:U(),error_type:we("schematic_port_not_found").default("schematic_port_not_found"),message:U(),subcircuit_id:U().optional()}).describe("Defines a schematic error on the schematic"),Een=Re({type:we("schematic_layout_error"),schematic_layout_error_id:go("schematic_layout_error"),error_type:we("schematic_layout_error").default("schematic_layout_error"),message:U(),source_group_id:U(),schematic_group_id:U(),subcircuit_id:U().optional()}).describe("Error emitted when schematic layout fails for a group"),rpe=Re({type:we("schematic_debug_object"),label:U().optional(),subcircuit_id:U().optional()}),Ten=rpe.extend({shape:we("rect"),center:Fl,size:mHe}),Men=rpe.extend({shape:we("line"),start:Fl,end:Fl}),Cen=rpe.extend({shape:we("point"),center:Fl}),Aen=z_("shape",[Ten,Men,Cen]),Ren=Re({type:we("schematic_voltage_probe"),schematic_voltage_probe_id:U(),position:Fl,schematic_trace_id:U(),voltage:zM.optional(),subcircuit_id:U().optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),Pen=Re({type:we("schematic_manual_edit_conflict_warning"),schematic_manual_edit_conflict_warning_id:go("schematic_manual_edit_conflict_warning"),warning_type:we("schematic_manual_edit_conflict_warning").default("schematic_manual_edit_conflict_warning"),message:U(),schematic_component_id:U(),schematic_group_id:U().optional(),subcircuit_id:U().optional(),source_component_id:U()}).describe("Warning emitted when a component has both manual placement and explicit schX/schY coordinates"),Ien=Re({type:we("schematic_group"),schematic_group_id:go("schematic_group"),source_group_id:U(),is_subcircuit:vt().optional(),subcircuit_id:U().optional(),width:st,height:st,center:Fl,schematic_component_ids:mt(U()),name:U().optional(),description:U().optional()}).describe("Defines a group of components on the schematic"),Nen=Re({type:we("schematic_table"),schematic_table_id:go("schematic_table"),anchor_position:Fl,column_widths:mt(vi),row_heights:mt(vi),cell_padding:vi.optional(),border_width:vi.optional(),subcircuit_id:U().optional(),schematic_component_id:U().optional(),anchor:npe.optional()}).describe("Defines a table on the schematic"),ken=Re({type:we("schematic_table_cell"),schematic_table_cell_id:go("schematic_table_cell"),schematic_table_id:U(),start_row_index:Fe(),end_row_index:Fe(),start_column_index:Fe(),end_column_index:Fe(),text:U().optional(),center:Fl,width:vi,height:vi,horizontal_align:Gt(["left","center","right"]).optional(),vertical_align:Gt(["top","middle","bottom"]).optional(),font_size:vi.optional(),subcircuit_id:U().optional()}).describe("Defines a cell within a schematic_table"),Oen=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6"],kHe=Gt(Oen),fd=kHe.or(Re({name:kHe})).transform(n=>typeof n=="string"?n:n.name),hP=Gt(["top","bottom"]),Den=Re({x:vi,y:vi,via:vt().optional(),via_to_layer:fd.optional()});mt(Den);var Len=Re({x:vi,y:vi,via:vt().optional(),to_layer:fd.optional(),trace_width:vi.optional()}),zen=Re({type:we("pcb_component"),pcb_component_id:go("pcb_component"),source_component_id:U(),center:Fl,layer:fd,rotation:bT,width:st,height:st,subcircuit_id:U().optional(),pcb_group_id:U().optional()}).describe("Defines a component on the PCB"),OHe=Re({type:we("pcb_hole"),pcb_hole_id:go("pcb_hole"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),hole_shape:Gt(["circle","square"]),hole_diameter:Fe(),x:vi,y:vi});OHe.describe("Defines a circular or square hole on the PCB");var DHe=Re({type:we("pcb_hole"),pcb_hole_id:go("pcb_hole"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),hole_shape:we("oval"),hole_width:Fe(),hole_height:Fe(),x:vi,y:vi});DHe.describe("Defines an oval hole on the PCB");var Fen=OHe.or(DHe),Ben=Re({type:we("pcb_plated_hole"),shape:we("circle"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),outer_diameter:Fe(),hole_diameter:Fe(),x:vi,y:vi,layers:mt(fd),port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional(),pcb_plated_hole_id:go("pcb_plated_hole")}),Uen=Re({type:we("pcb_plated_hole"),shape:Gt(["oval","pill"]),pcb_group_id:U().optional(),subcircuit_id:U().optional(),outer_width:Fe(),outer_height:Fe(),hole_width:Fe(),hole_height:Fe(),x:vi,y:vi,layers:mt(fd),port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional(),pcb_plated_hole_id:go("pcb_plated_hole")}),$en=Re({type:we("pcb_plated_hole"),shape:we("circular_hole_with_rect_pad"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),hole_shape:we("circle"),pad_shape:we("rect"),hole_diameter:Fe(),rect_pad_width:Fe(),rect_pad_height:Fe(),x:vi,y:vi,layers:mt(fd),port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional(),pcb_plated_hole_id:go("pcb_plated_hole")}),jen=Re({type:we("pcb_plated_hole"),shape:we("pill_hole_with_rect_pad"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),hole_shape:we("pill"),pad_shape:we("rect"),hole_width:Fe(),hole_height:Fe(),rect_pad_width:Fe(),rect_pad_height:Fe(),x:vi,y:vi,layers:mt(fd),port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional(),pcb_plated_hole_id:go("pcb_plated_hole")}),Hen=Re({type:we("pcb_plated_hole"),shape:we("rotated_pill_hole_with_rect_pad"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),hole_shape:we("rotated_pill"),pad_shape:we("rect"),hole_width:Fe(),hole_height:Fe(),hole_ccw_rotation:bT,rect_pad_width:Fe(),rect_pad_height:Fe(),rect_ccw_rotation:bT,x:vi,y:vi,layers:mt(fd),port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional(),pcb_plated_hole_id:go("pcb_plated_hole")}),Ven=Gn([Ben,Uen,$en,jen,Hen]),qen=Re({type:we("pcb_port"),pcb_port_id:go("pcb_port"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),source_port_id:U(),pcb_component_id:U(),x:vi,y:vi,layers:mt(fd)}).describe("Defines a port on the PCB"),Gen=Re({type:we("pcb_smtpad"),shape:we("circle"),pcb_smtpad_id:go("pcb_smtpad"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,radius:Fe(),layer:fd,port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional()}),Yen=Re({type:we("pcb_smtpad"),shape:we("rect"),pcb_smtpad_id:go("pcb_smtpad"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,width:Fe(),height:Fe(),layer:fd,port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional()}),Xen=Re({type:we("pcb_smtpad"),shape:we("rotated_rect"),pcb_smtpad_id:go("pcb_smtpad"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,width:Fe(),height:Fe(),ccw_rotation:bT,layer:fd,port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional()}),Wen=Re({type:we("pcb_smtpad"),shape:we("pill"),pcb_smtpad_id:go("pcb_smtpad"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,width:Fe(),height:Fe(),radius:Fe(),layer:fd,port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional()}),Zen=Re({type:we("pcb_smtpad"),shape:we("rotated_pill"),pcb_smtpad_id:go("pcb_smtpad"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,width:Fe(),height:Fe(),radius:Fe(),ccw_rotation:bT,layer:fd,port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional()}),Ken=Re({type:we("pcb_smtpad"),shape:we("polygon"),pcb_smtpad_id:go("pcb_smtpad"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),points:mt(Fl),layer:fd,port_hints:mt(U()).optional(),pcb_component_id:U().optional(),pcb_port_id:U().optional()}),Qen=z_("shape",[Gen,Yen,Xen,Zen,Wen,Ken]).describe("Defines an SMT pad on the PCB"),Jen=Re({type:we("pcb_solder_paste"),shape:we("circle"),pcb_solder_paste_id:go("pcb_solder_paste"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,radius:Fe(),layer:fd,pcb_component_id:U().optional(),pcb_smtpad_id:U().optional()}),etn=Re({type:we("pcb_solder_paste"),shape:we("rect"),pcb_solder_paste_id:go("pcb_solder_paste"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,width:Fe(),height:Fe(),layer:fd,pcb_component_id:U().optional(),pcb_smtpad_id:U().optional()}),ttn=Re({type:we("pcb_solder_paste"),shape:we("pill"),pcb_solder_paste_id:go("pcb_solder_paste"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,width:Fe(),height:Fe(),radius:Fe(),layer:fd,pcb_component_id:U().optional(),pcb_smtpad_id:U().optional()}),ntn=Re({type:we("pcb_solder_paste"),shape:we("rotated_rect"),pcb_solder_paste_id:go("pcb_solder_paste"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,width:Fe(),height:Fe(),ccw_rotation:vi,layer:fd,pcb_component_id:U().optional(),pcb_smtpad_id:U().optional()}),itn=Re({type:we("pcb_solder_paste"),shape:we("oval"),pcb_solder_paste_id:go("pcb_solder_paste"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,width:Fe(),height:Fe(),layer:fd,pcb_component_id:U().optional(),pcb_smtpad_id:U().optional()}),rtn=Gn([Jen,etn,ttn,ntn,itn]).describe("Defines solderpaste on the PCB"),otn=Re({type:we("pcb_text"),pcb_text_id:go("pcb_text"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),text:U(),center:Fl,layer:fd,width:st,height:st,lines:Fe(),align:Gt(["bottom-left"])}).describe("Defines text on the PCB"),stn=Re({route_type:we("wire"),x:vi,y:vi,width:vi,start_pcb_port_id:U().optional(),end_pcb_port_id:U().optional(),layer:fd}),atn=Re({route_type:we("via"),x:vi,y:vi,hole_diameter:vi.optional(),outer_diameter:vi.optional(),from_layer:U(),to_layer:U()}),ctn=Gn([stn,atn]),ltn=Re({type:we("pcb_trace"),source_trace_id:U().optional(),pcb_component_id:U().optional(),pcb_trace_id:go("pcb_trace"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),route_thickness_mode:Gt(["constant","interpolated"]).default("constant").optional(),route_order_index:Fe().optional(),should_round_corners:vt().optional(),trace_length:Fe().optional(),route:mt(ctn)}).describe("Defines a trace on the PCB"),utn=Re({type:we("pcb_trace_error"),pcb_trace_error_id:go("pcb_trace_error"),error_type:we("pcb_trace_error").default("pcb_trace_error"),message:U(),center:Fl.optional(),pcb_trace_id:U(),source_trace_id:U(),pcb_component_ids:mt(U()),pcb_port_ids:mt(U()),subcircuit_id:U().optional()}).describe("Defines a trace error on the PCB"),dtn=Re({type:we("pcb_trace_missing_error"),pcb_trace_missing_error_id:go("pcb_trace_missing_error"),error_type:we("pcb_trace_missing_error").default("pcb_trace_missing_error"),message:U(),center:Fl.optional(),source_trace_id:U(),pcb_component_ids:mt(U()),pcb_port_ids:mt(U()),subcircuit_id:U().optional()}).describe("Defines an error when a source trace has no corresponding PCB trace"),htn=Re({type:we("pcb_port_not_matched_error"),pcb_error_id:go("pcb_error"),error_type:we("pcb_port_not_matched_error").default("pcb_port_not_matched_error"),message:U(),pcb_component_ids:mt(U()),subcircuit_id:U().optional()}).describe("Defines a trace error on the PCB where a port is not matched"),ptn=Re({type:we("pcb_port_not_connected_error"),pcb_port_not_connected_error_id:go("pcb_port_not_connected_error"),error_type:we("pcb_port_not_connected_error").default("pcb_port_not_connected_error"),message:U(),pcb_port_ids:mt(U()),pcb_component_ids:mt(U()),subcircuit_id:U().optional()}).describe("Defines an error when a pcb port is not connected to any trace"),ftn=Re({type:we("pcb_via"),pcb_via_id:go("pcb_via"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),x:vi,y:vi,outer_diameter:vi.default("0.6mm"),hole_diameter:vi.default("0.25mm"),from_layer:fd.optional(),to_layer:fd.optional(),layers:mt(fd),pcb_trace_id:U().optional()}).describe("Defines a via on the PCB"),mtn=Re({type:we("pcb_board"),pcb_board_id:go("pcb_board"),is_subcircuit:vt().optional(),subcircuit_id:U().optional(),width:st,height:st,center:Fl,thickness:st.optional().default(1.4),num_layers:Fe().optional().default(4),outline:mt(Fl).optional(),material:Gt(["fr4","fr1"]).default("fr4")}).describe("Defines the board outline of the PCB"),_tn=Re({type:we("pcb_placement_error"),pcb_placement_error_id:go("pcb_placement_error"),error_type:we("pcb_placement_error").default("pcb_placement_error"),message:U(),subcircuit_id:U().optional()}).describe("Defines a placement error on the PCB"),ytn=Re({type:we("pcb_trace_hint"),pcb_trace_hint_id:go("pcb_trace_hint"),pcb_port_id:U(),pcb_component_id:U(),route:mt(Len),subcircuit_id:U().optional()}).describe("A hint that can be used during generation of a PCB trace"),gtn=Re({type:we("pcb_silkscreen_line"),pcb_silkscreen_line_id:go("pcb_silkscreen_line"),pcb_component_id:U(),pcb_group_id:U().optional(),subcircuit_id:U().optional(),stroke_width:vi.default("0.1mm"),x1:vi,y1:vi,x2:vi,y2:vi,layer:hP}).describe("Defines a silkscreen line on the PCB"),vtn=Re({type:we("pcb_silkscreen_path"),pcb_silkscreen_path_id:go("pcb_silkscreen_path"),pcb_component_id:U(),pcb_group_id:U().optional(),subcircuit_id:U().optional(),layer:hP,route:mt(Fl),stroke_width:st}).describe("Defines a silkscreen path on the PCB"),xtn=Re({type:we("pcb_silkscreen_text"),pcb_silkscreen_text_id:go("pcb_silkscreen_text"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),font:we("tscircuit2024").default("tscircuit2024"),font_size:vi.default("0.2mm"),pcb_component_id:U(),text:U(),ccw_rotation:Fe().optional(),layer:fd,is_mirrored:vt().default(!1).optional(),anchor_position:Fl.default({x:0,y:0}),anchor_alignment:npe.default("center")}).describe("Defines silkscreen text on the PCB"),btn=Re({type:we("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:go("pcb_silkscreen_rect"),pcb_component_id:U(),pcb_group_id:U().optional(),subcircuit_id:U().optional(),center:Fl,width:st,height:st,layer:fd,stroke_width:st.default("1mm"),is_filled:vt().default(!0).optional(),has_stroke:vt().optional(),is_stroke_dashed:vt().optional()}).describe("Defines a silkscreen rect on the PCB"),wtn=Re({type:we("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:go("pcb_silkscreen_circle"),pcb_component_id:U(),pcb_group_id:U().optional(),subcircuit_id:U().optional(),center:Fl,radius:st,layer:hP,stroke_width:st.default("1mm")}).describe("Defines a silkscreen circle on the PCB"),Stn=Re({type:we("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:go("pcb_silkscreen_oval"),pcb_component_id:U(),pcb_group_id:U().optional(),subcircuit_id:U().optional(),center:Fl,radius_x:vi,radius_y:vi,layer:hP}).describe("Defines a silkscreen oval on the PCB"),Etn=Re({type:we("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:go("pcb_fabrication_note_text"),subcircuit_id:U().optional(),pcb_group_id:U().optional(),font:we("tscircuit2024").default("tscircuit2024"),font_size:vi.default("1mm"),pcb_component_id:U(),text:U(),layer:hP,anchor_position:Fl.default({x:0,y:0}),anchor_alignment:Gt(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:U().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"),Ttn=Re({type:we("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:go("pcb_fabrication_note_path"),pcb_component_id:U(),subcircuit_id:U().optional(),layer:fd,route:mt(Fl),stroke_width:st,color:U().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),Mtn=Re({type:we("pcb_footprint_overlap_error"),pcb_error_id:go("pcb_error"),error_type:we("pcb_footprint_overlap_error").default("pcb_footprint_overlap_error"),message:U(),pcb_smtpad_ids:mt(U()).optional(),pcb_plated_hole_ids:mt(U()).optional(),pcb_hole_ids:mt(U()).optional(),pcb_keepout_ids:mt(U()).optional()}).describe("Error emitted when a pcb footprint overlaps with another element"),Ctn=Re({type:we("pcb_keepout"),shape:we("rect"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),center:Fl,width:vi,height:vi,pcb_keepout_id:U(),layers:mt(U()),description:U().optional()}).or(Re({type:we("pcb_keepout"),shape:we("circle"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),center:Fl,radius:vi,pcb_keepout_id:U(),layers:mt(U()),description:U().optional()})),ope=Re({type:we("pcb_cutout"),pcb_cutout_id:go("pcb_cutout"),pcb_group_id:U().optional(),subcircuit_id:U().optional()}),Atn=ope.extend({shape:we("rect"),center:Fl,width:st,height:st,rotation:bT.optional()}),Rtn=ope.extend({shape:we("circle"),center:Fl,radius:st}),Ptn=ope.extend({shape:we("polygon"),points:mt(Fl)}),Itn=z_("shape",[Atn,Rtn,Ptn]).describe("Defines a cutout on the PCB, removing board material."),Ntn=Re({type:we("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:go("pcb_missing_footprint_error"),pcb_group_id:U().optional(),subcircuit_id:U().optional(),error_type:we("pcb_missing_footprint_error").default("pcb_missing_footprint_error"),source_component_id:U(),message:U()}).describe("Defines a missing footprint error on the PCB"),ktn=Re({type:we("pcb_group"),pcb_group_id:go("pcb_group"),source_group_id:U(),is_subcircuit:vt().optional(),subcircuit_id:U().optional(),width:st,height:st,center:Fl,pcb_component_ids:mt(U()),name:U().optional(),description:U().optional(),layout_mode:U().optional(),autorouter_configuration:Re({trace_clearance:st}).optional(),autorouter_used_string:U().optional()}).describe("Defines a group of components on the PCB"),Otn=Re({type:we("pcb_autorouting_error"),pcb_error_id:go("pcb_autorouting_error"),error_type:we("pcb_autorouting_error").default("pcb_autorouting_error"),message:U(),subcircuit_id:U().optional()}).describe("The autorouting has failed to route a portion of the board"),Dtn=Re({type:we("pcb_manual_edit_conflict_warning"),pcb_manual_edit_conflict_warning_id:go("pcb_manual_edit_conflict_warning"),warning_type:we("pcb_manual_edit_conflict_warning").default("pcb_manual_edit_conflict_warning"),message:U(),pcb_component_id:U(),pcb_group_id:U().optional(),subcircuit_id:U().optional(),source_component_id:U()}).describe("Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"),Ltn=Re({type:we("pcb_breakout_point"),pcb_breakout_point_id:go("pcb_breakout_point"),pcb_group_id:U(),subcircuit_id:U().optional(),source_trace_id:U().optional(),source_port_id:U().optional(),source_net_id:U().optional(),x:vi,y:vi}).describe("Defines a routing target within a pcb_group for a source_trace or source_net"),ztn=Re({type:we("pcb_ground_plane"),pcb_ground_plane_id:go("pcb_ground_plane"),source_pcb_ground_plane_id:U(),source_net_id:U(),pcb_group_id:U().optional(),subcircuit_id:U().optional()}).describe("Defines a ground plane on the PCB"),Ftn=Re({type:we("pcb_ground_plane_region"),pcb_ground_plane_region_id:go("pcb_ground_plane_region"),pcb_ground_plane_id:U(),pcb_group_id:U().optional(),subcircuit_id:U().optional(),layer:fd,points:mt(Fl)}).describe("Defines a polygon region of a ground plane"),Btn=Re({type:we("pcb_thermal_spoke"),pcb_thermal_spoke_id:go("pcb_thermal_spoke"),pcb_ground_plane_id:U(),shape:U(),spoke_count:Fe(),spoke_thickness:vi,spoke_inner_diameter:vi,spoke_outer_diameter:vi,pcb_plated_hole_id:U().optional(),subcircuit_id:U().optional()}).describe("Pattern for connecting a ground plane to a plated hole"),Utn=Re({type:we("cad_component"),cad_component_id:U(),pcb_component_id:U(),source_component_id:U(),position:tpe,rotation:tpe.optional(),size:tpe.optional(),layer:fd.optional(),subcircuit_id:U().optional(),footprinter_string:U().optional(),model_obj_url:U().optional(),model_stl_url:U().optional(),model_3mf_url:U().optional(),model_jscad:Gu().optional()}).describe("Defines a component on the PCB"),$tn=Gt(["sinewave","square","triangle","sawtooth"]),jtn=Re({type:we("simulation_voltage_source"),simulation_voltage_source_id:go("simulation_voltage_source"),is_dc_source:we(!0).optional().default(!0),positive_source_port_id:U().optional(),negative_source_port_id:U().optional(),positive_source_net_id:U().optional(),negative_source_net_id:U().optional(),voltage:zM}).describe("Defines a DC voltage source for simulation"),Htn=Re({type:we("simulation_voltage_source"),simulation_voltage_source_id:go("simulation_voltage_source"),is_dc_source:we(!1),terminal1_source_port_id:U().optional(),terminal2_source_port_id:U().optional(),terminal1_source_net_id:U().optional(),terminal2_source_net_id:U().optional(),voltage:zM.optional(),frequency:fHe.optional(),peak_to_peak_voltage:zM.optional(),wave_shape:$tn.optional(),phase:bT.optional()}).describe("Defines an AC voltage source for simulation"),Vtn=Gn([jtn,Htn]).describe("Defines a voltage source for simulation");Gn([sen,oen,ren,cen,aen,vHe,_He,ipe,gHe,yHe,xHe,bHe,wHe,THe,MHe,PHe,CHe,AHe,RHe,EHe,SHe,len,IHe,NHe,zen,Fen,Ntn,Dtn,Ven,Ctn,qen,otn,ltn,ftn,Qen,rtn,mtn,ktn,ytn,gtn,vtn,xtn,btn,wtn,Stn,utn,dtn,_tn,htn,ptn,Ttn,Etn,Otn,Mtn,Ltn,Itn,ztn,Ftn,Btn,uen,xen,yen,_en,ben,gen,den,Sen,Een,wen,Aen,Ren,Pen,Ien,Nen,ken,Utn,Vtn]);var qtn=Object.defineProperty,Gtn=(n,e)=>{for(var t in e)qtn(n,t,{get:e[t],enumerable:!0})},bw={};Gtn(bw,{axial:()=>Gnn,bga:()=>rnn,breakoutheaders:()=>nin,cap:()=>Jtn,dfn:()=>Cnn,diode:()=>Qtn,dip:()=>Wtn,electrolytic:()=>Fon,hc49:()=>rin,jst:()=>con,led:()=>enn,lqfp:()=>ein,m2host:()=>tsn,melf:()=>yrn,micromelf:()=>brn,minimelf:()=>lrn,mlp:()=>hnn,ms012:()=>Onn,ms013:()=>Lnn,msop:()=>gon,pad:()=>oin,pinrow:()=>Pnn,platedhole:()=>Zon,potentiometer:()=>Don,pushbutton:()=>Xnn,qfn:()=>unn,qfp:()=>dnn,quad:()=>pP,res:()=>tnn,sma:()=>Trn,smb:()=>krn,smbf:()=>Uon,smc:()=>zrn,smf:()=>Rrn,smtpad:()=>Xon,sod110:()=>uon,sod123:()=>jnn,sod123f:()=>$in,sod123fl:()=>qin,sod123w:()=>bin,sod128:()=>Jin,sod323:()=>Tin,sod323f:()=>zin,sod323fl:()=>Eon,sod323w:()=>xon,sod523:()=>din,sod723:()=>Win,sod80:()=>yin,sod882:()=>kin,sod882d:()=>prn,sod923:()=>Rin,soic:()=>snn,solderjumper:()=>Ron,son:()=>Aon,sop8:()=>min,sot:()=>Qon,sot223:()=>$rn,sot23:()=>xnn,sot23w:()=>Zrn,sot25:()=>Enn,sot323:()=>Von,sot363:()=>gnn,sot457:()=>Non,sot563:()=>Nnn,sot723:()=>Fnn,sot89:()=>orn,ssop:()=>fnn,stampboard:()=>Znn,stampreceiver:()=>Jnn,to220:()=>arn,to92:()=>lin,to92s:()=>non,tssop:()=>_nn,vssop:()=>mon});var Kr=(n,e,t)=>({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:"silkscreen_text_1",font:"tscircuit2024",font_size:t,pcb_component_id:"pcb_component_1",text:"{REF}",layer:"top",anchor_position:{x:n,y:e},anchor_alignment:"center"}),Os=(n,e,t,i,r)=>({pcb_plated_hole_id:"",type:"pcb_plated_hole",shape:"circle",x:e,y:t,hole_diameter:Xu(i),outer_diameter:Xu(r),pcb_port_id:"",layers:["top","bottom"],port_hints:[n.toString()]}),LHe=Array.from({length:9},(n,e)=>Math.cos(e/8*Math.PI-Math.PI)).map(n=>({x:n,y:-Math.sqrt(1-n**2)}));function h4(n){return typeof n=="string"?n.trim().toLowerCase().endsWith("mil")?parseFloat(n)*.0254:parseFloat(n):Number(n)}var EU=Gn([U(),Fe()]).transform(n=>h4(n)),Ytn=n=>Re({fn:U(),num_pins:Fe().optional().default(6),wide:vt().optional(),narrow:vt().optional(),w:EU.optional(),p:EU.default(n.p??"2.54mm"),id:EU.optional(),od:EU.optional()}).transform(e=>(!e.id&&!e.od?Math.abs(e.p-1.27)<.01?(e.id=h4("0.55mm"),e.od=h4("0.95mm")):(e.id=h4("1.0mm"),e.od=h4("1.5mm")):e.id?e.od||(e.od=e.id*(1.5/1)):e.id=e.od*(1/1.5),e.w||(e.wide?e.w=h4("600mil"):e.narrow?e.w=h4("300mil"):e.w=h4(n.w??"300mil")),e)),Xtn=Ytn({}),zHe=(n,e,t,i)=>{const r=n/2,o=e<=r,s=r-1,a=i,c=a*s;return o?{x:-t/2,y:c/2-(e-1)*a}:{x:t/2,y:-c/2+(e-r-1)*a}},Wtn=n=>{const e=Xtn.parse(n),t=[];for(let l=0;l<e.num_pins;l++){const{x:u,y:d}=zHe(e.num_pins,l+1,e.w,e.p??2.54);t.push(Os(l+1,u,d,e.id??"0.8mm",e.od??"1mm"))}(e.num_pins/2-1)*e.p+e.od;const r=e.w-e.od-1,o=(e.num_pins/2-1)*e.p+e.od+.4,s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-r/2,y:-o/2},{x:-r/2,y:o/2},...LHe.map(({x:l,y:u})=>({x:l*r/6,y:u*r/6+o/2})),{x:r/2,y:o/2},{x:r/2,y:-o/2},{x:-r/2,y:-o/2}],type:"pcb_silkscreen_path",stroke_width:.1},a=[];for(let l=0;l<e.num_pins;l++){const u=l<e.num_pins/2,d=.6,{y:h}=zHe(e.num_pins,l+1,e.w,e.p??2.54),f=u?-e.w/2-e.od/2-d:e.w/2+e.od/2+d,m=h;a.push({type:"pcb_fabrication_note_text",pcb_fabrication_note_text_id:`pin_${l+1}`,layer:"top",pcb_component_id:`pin_${l+1}`,text:`{pin${l+1}}`,anchor_position:{x:f,y:m},font_size:.3,font:"tscircuit2024",anchor_alignment:"top_left"})}const c=Kr(0,o/2+.5,.4);return{circuitJson:[...t,s,c,...a],parameters:e}},sr=(n,e,t,i,r)=>({type:"pcb_smtpad",x:e,y:t,width:i,height:r,layer:"top",shape:"rect",pcb_smtpad_id:"",port_hints:Array.isArray(n)?n.map(o=>o.toString()):[n.toString()]}),FHe=[{imperial:"01005",metric:"0402",p_mm_min:.5,pw_mm_min:.4,ph_mm_min:.3,w_mm_min:.58,h_mm_min:.21},{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},{imperial:"0201",metric:"0603",p_mm_min:.66,pw_mm_min:.46,ph_mm_min:.4,w_mm_min:.9,h_mm_min:.3},{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},{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},{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},{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},{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},{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},{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}],Ztn=Object.fromEntries(FHe.map(n=>[n.metric,n])),Ktn=Object.fromEntries(FHe.map(n=>[n.imperial,n]));Re({tht:vt(),p:st.optional(),pw:st.optional(),ph:st.optional(),metric:vi.optional(),imperial:vi.optional(),w:st.optional(),h:st.optional(),textbottom:vt().optional()});var TU=n=>{let{tht:e,p:t,pw:i,ph:r,metric:o,imperial:s,w:a,h:c,textbottom:l}=n;if(typeof a=="string"&&(a=dP(a)),typeof c=="string"&&(c=dP(c)),typeof t=="string"&&(t=dP(t)),typeof i=="string"&&(i=dP(i)),typeof r=="string"&&(r=dP(r)),c!==void 0&&a!==void 0&&c>a)throw new Error("height cannot be greater than width (rotated footprint not yet implemented)");let u;if(o&&(u=Ztn[o]),s&&(u=Ktn[s]),u&&(a=u.w_mm_min,c=u.h_mm_min,t=u.p_mm_min,i=u.pw_mm_min,r=u.ph_mm_min),t===void 0||i===void 0||r===void 0)throw new Error("Could not determine required pad dimensions (p, pw, ph)");const d={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:t/2,y:r/2+.4},{x:-t/2-i/2-.2,y:r/2+.4},{x:-t/2-i/2-.2,y:-r/2-.4},{x:t/2,y:-r/2-.4}],stroke_width:.1,pcb_silkscreen_path_id:""},h=l?-r/2-.9:r/2+.9,f=Kr(0,h,.2);return e?[Os(1,-t/2,0,i,i*1/.8),Os(2,t/2,0,i,i*1/.8),d,f]:[sr(["1","left"],-t/2,0,i,r),sr(["2","right"],t/2,0,i,r),d,f]},Qtn=n=>({circuitJson:TU(n),parameters:n}),Jtn=n=>({circuitJson:TU(n),parameters:n}),enn=n=>({circuitJson:TU(n),parameters:n}),tnn=n=>({circuitJson:TU(n),parameters:n}),BHe=(n,{x:e,y:t,radius:i})=>({type:"pcb_smtpad",x:e,y:t,radius:i,layer:"top",shape:"circle",pcb_smtpad_id:"",port_hints:Array.isArray(n)?n.map(r=>r.toString()):[n.toString()]}),UHe="ABCDEFGHIJKLMNOPQRSTUVWXYZ",$He=U().transform(n=>{const[e,t]=n.split(/[x ]/);return{x:parseFloat(e),y:parseFloat(t)}}).pipe(Re({x:Fe(),y:Fe()})),nnn=U().or(mt(Gu())).transform(n=>Array.isArray(n)?n:(n.startsWith("(")&&n.endsWith(")")&&(n=n.slice(1,-1)),n.split(",").map(e=>{const t=Number(e);return isNaN(t)?e:t}))).pipe(mt(U().or(Fe()))),inn=Re({fn:U(),num_pins:Fe().optional().default(64),grid:$He.optional(),p:vi.default("0.8mm"),w:st.optional(),h:st.optional(),ball:st.optional().describe("ball diameter"),pad:st.optional().describe("pad width/height"),circularpads:vt().optional().describe("use circular pads"),tlorigin:vt().optional(),blorigin:vt().optional(),trorigin:vt().optional(),brorigin:vt().optional(),missing:nnn.default([])}).transform(n=>{let e="tl";if(n.blorigin&&(e="bl"),n.trorigin&&(e="tr"),n.brorigin&&(e="br"),!n.grid){const i=Math.ceil(Math.sqrt(n.num_pins));n.grid={x:i,y:i}}return n.missing&&(n.missing=n.missing.map(i=>{if(typeof i=="number")return i;if(i==="center")return"center";if(i==="topleft")return"topleft";const r=i.match(/([A-Z]+)(\d+)/);if(!r)return i;const o=UHe.indexOf(r[1]),s=Number.parseInt(r[2])-1;return o*n.grid.x+s+1})),{...n,origin:e}}),rnn=n=>{const e=inn.parse(n);let{num_pins:t,grid:i,p:r,w:o,h:s,ball:a,pad:c,missing:l}=e;a??=.75/1.27*r,c??=a*.8;const u=[],d=(l??[]).filter(N=>typeof N=="number"),h=i.x*i.y-t;if(l.length===0&&h>0&&(Math.sqrt(h)%1===0?l.push("center"):h===1&&l.push("topleft")),l?.includes("center")){const N=Math.floor(Math.sqrt(h)),R=Math.floor((i.x-N)/2),k=Math.floor((i.y-N)/2);for(let M=k;M<k+N;M++)for(let I=R;I<R+N;I++)d.push(M*i.x+I+1)}l?.includes("topleft")&&d.push(1);const f=new Set(d);let m=0;for(let N=0;N<i.y;N++)for(let R=0;R<i.x;R++){const k=(R-(i.x-1)/2)*r,M=(N-(i.y-1)/2)*r;let I=R,C=N;switch(e.origin){case"bl":I=R,C=i.y-1-N;break;case"br":I=i.x-1-R,C=i.y-1-N;break;case"tr":I=i.x-1-R,C=N;break}let $=C*i.x+I+1;if(f.has($)){m++;continue}$-=m;const P=[$,`${UHe[C]}${I+1}`];u.push(e.circularpads?BHe(P,{x:k,y:M,radius:c/2}):sr(P,k,M,c,c))}const y=Kr(0,i.y*r/2,.2),g=r/6;let b;const x=i.x*r/2,w=i.y*r/2;switch(e.origin){case"bl":b=[{x:-x,y:-w},{x:-x,y:-w-g},{x:-x-g,y:-w},{x:-x,y:-w}];break;case"br":b=[{x,y:-w},{x,y:-w-g},{x:x+g,y:-w},{x,y:-w}];break;case"tr":b=[{x,y:w},{x,y:w+g},{x:x+g,y:w},{x,y:w}];break;case"tl":default:b=[{x:-x,y:w},{x:-x,y:w+g},{x:-x-g,y:w},{x:-x,y:w}];break}const T={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_marker",route:b,stroke_width:.05};return{circuitJson:[...u,y,T],parameters:e}},q2=n=>Re({fn:U(),num_pins:Fe().optional().default(8),w:st.default(st.parse(n.w??"5.3mm")),p:st.default(st.parse(n.p??"1.27mm")),pw:st.default(st.parse(n.pw??"0.6mm")),pl:st.default(st.parse(n.pl??"1.0mm")),legsoutside:vt().optional().default(n.legsoutside??!1)}).transform(e=>(!e.pw&&!e.pl?(e.pw=st.parse("0.6mm"),e.pl=st.parse("1.0mm")):e.pw?e.pl||(e.pl=e.pw*(1/.6)):e.pw=e.pl*(.6/1),e)),onn=q2({}),spe=n=>{n.widthincludeslegs!==void 0&&(n.legsoutside=!n.widthincludeslegs);const{num_pins:e,pn:t,w:i,p:r,pl:o,legsoutside:s}=n,a=e/2,c=t<=a,l=a-1,u=r,d=u*l,h=s?o/2:-o/2;return c?{x:-i/2-h,y:d/2-(t-1)*u}:{x:i/2+h,y:-d/2+(t-a-1)*u}},snn=n=>{const e=onn.parse(n);return{circuitJson:ww(e),parameters:e}},ww=n=>{const e=[];for(let a=0;a<n.num_pins;a++){const{x:c,y:l}=spe({num_pins:n.num_pins,pn:a+1,w:n.w,p:n.p,pl:n.pl,legsoutside:n.legsoutside});e.push(sr(a+1,c,l,n.pl,n.pw))}const t=Math.min(1,n.p/2),i=n.w-(n.legsoutside?0:n.pl*2)-.2,r=(n.num_pins/2-1)*n.p+n.pw+t,o=Kr(0,r/2+.4,r/12),s={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",stroke_width:.1,route:[{x:-i/2,y:-r/2},{x:-i/2,y:r/2},...LHe.map(({x:a,y:c})=>({x:a*i/6,y:c*i/6+r/2})),{x:i/2,y:r/2},{x:i/2,y:-r/2},{x:-i/2,y:-r/2}]};return[...e,s,o]},jHe=Gt(["leftside","topside","rightside","bottomside","toppin","bottompin","leftpin","rightpin"]),ann=({num_pins:n,cw:e,ccw:t,startingpin:i})=>{const r=[],o=n/4;let s=1;const a={};for(const c of i??[])a[c]=!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=o:a.bottomside&&a.leftpin?s=o+1:a.bottomside&&a.rightpin?s=o*2:a.rightside&&a.bottompin?s=o*2+1:a.rightside&&a.toppin?s=o*3:a.topside&&a.rightpin?s=o*3+1:a.topside&&a.leftpin&&(s=o*4),r.push(-1);for(let c=0;c<n;c++)r[s]=c+1,t||!e?(s++,s>n&&(s=1)):(s--,s<1&&(s=n));return r},ape=Re({fn:U(),cc:vt().default(!0).optional(),ccw:vt().default(!0).optional(),startingpin:U().or(mt(jHe)).transform(n=>typeof n=="string"?n.slice(1,-1).split(","):n).pipe(mt(jHe)).optional(),num_pins:Fe().optional().default(64),w:st.optional(),h:st.optional(),p:st.default(st.parse("0.5mm")),pw:st.optional(),pl:st.optional(),thermalpad:Gn([we(!0),$He]).optional(),legsoutside:vt().default(!1)}),cpe=n=>{n.w&&!n.h?n.h=n.w:!n.w&&n.h&&(n.w=n.h);const e=n.num_pins/4;if(!n.p&&!n.pw&&!n.pl&&n.w){const t=e+4;n.p=n.w/t}return!n.p&&n.w&&n.h&&n.pw&&n.pl&&(n.p=(n.w-n.pl*2)/(e-1)),!n.w&&!n.h&&n.p&&(n.w=n.p*(e+4),n.h=n.w),n.p&&!n.pw&&!n.pl?(n.pw=n.p/2,n.pl=n.p/2):n.pw?n.pl||(n.pl=n.pw*(1/.6)):n.pw=n.pl*(.6/1),n},HHe=ape.transform(cpe),cnn=["left","bottom","right","top"],lnn=n=>{const{pin_count:e,pn:t,w:i,h:r,p:o,pl:s,legsoutside:a}=n,c=e/4,l=cnn[Math.floor((t-1)/c)],u=(t-1)%c,d=o*(c-1),h=o*(c-1),f=a?s/2:-s/2;switch(l){case"left":return{x:-i/2-f,y:h/2-u*o,o:"vert"};case"bottom":return{x:-d/2+u*o,y:-r/2-f,o:"horz"};case"right":return{x:i/2+f,y:-h/2+u*o,o:"vert"};case"top":return{x:d/2-u*o,y:r/2+f,o:"horz"};default:throw new Error("Invalid pin number")}},pP=n=>{const e=HHe.parse(n),t=[],i=ann(e),r=e.num_pins/4;for(let a=0;a<e.num_pins;a++){const{x:c,y:l,o:u}=lnn({pin_count:e.num_pins,pn:a+1,w:e.w,h:e.h,p:e.p??.5,pl:e.pl,legsoutside:e.legsoutside});let d=e.pw,h=e.pl;u==="vert"&&([d,h]=[h,d]);const f=i[a+1];t.push(sr(f,c,l,d,h))}if(e.thermalpad)if(typeof e.thermalpad=="boolean"){const a=e.p*(r-1)+e.pw,c=e.p*(r-1)+e.pw;t.push(sr(["thermalpad"],0,0,a,c))}else t.push(sr(["thermalpad"],0,0,e.thermalpad.x,e.thermalpad.y));const o=[];for(const[a,c,l]of[["top-left",-1,1],["bottom-left",-1,-1],["bottom-right",1,-1],["top-right",1,1]]){const u=e.w/2*c,d=e.h/2*l;let h="none",f=u,m=d;const y=e.pw*2;i[1]===1&&a==="top-left"?h="in1":i[r*4]===1&&a==="top-left"||i[r*3+1]===1&&a==="top-right"?h="in2":i[r*3]===1&&a==="top-right"||i[r]===1&&a==="bottom-left"?h="in1":i[r+1]===1&&a==="bottom-left"?h="in2":i[r*2]===1&&a==="bottom-right"?h="in1":i[r*2+1]===1&&a==="bottom-right"&&(h="in2");const g=h==="in1"?1:-1;if(e.legsoutside){const b=h==="in1"?e.pl/2:e.pw/2,x=h==="in1"?e.pw/2:e.pl/2;f+=b*c*g,m-=x*l*g}(h==="none"||e.legsoutside)&&o.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${a}`,route:[{x:u-y*c,y:d},{x:u,y:d},{x:u,y:d-y*l}],type:"pcb_silkscreen_path",stroke_width:.1}),(h==="in1"||h==="in2")&&!e.legsoutside&&o.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${a}_1`,route:[{x:u-y*c,y:d},{x:u-y*c/2,y:d}],type:"pcb_silkscreen_path",stroke_width:0},{layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${a}_2`,route:[{x:u,y:d-y*l/2},{x:u,y:d-y*l}],type:"pcb_silkscreen_path",stroke_width:.1}),(h==="in1"||h==="in2")&&o.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${a}_3`,route:[{x:f-.2*-c,y:m+.2*g},{x:f,y:m},{x:f+.2*g*-c,y:m+.2},{x:f-.2*-c,y:m+.2*g}],type:"pcb_silkscreen_path",stroke_width:.1})}const s=Kr(0,e.h/2+(e.legsoutside?e.pl*1.2:.5),.3);return{circuitJson:[...t,...o,s],parameters:e}};ape.extend({}).transform(cpe);var unn=n=>(n.legsoutside=!1,pP(n)),dnn=n=>{n.legsoutside=!0;const e=HHe.parse(n);if(!n.p)switch(n.num_pins){case 44:case 64:n.p=.8;break;case 52:n.w===14?n.p=1:n.p=.65;break;case 208:n.p=.5;break}if(!n.pl)switch(n.num_pins){case 44:case 52:case 64:n.pl=2.25;break;case 208:n.pl=1.65;break;default:n.pl=e.pl*4;break}if(!n.pw)switch(n.num_pins){case 44:case 64:n.pw=.5;break;case 52:n.w===14?n.pw=.45:n.pw=.55;break;case 208:n.pw=.3;break;default:n.pw=e.pw;break}return pP(n)};ape.extend({}).transform(cpe);var hnn=n=>(n.legsoutside=!1,n.thermalpad===void 0&&(n.thermalpad=!0),pP(n)),pnn=q2({w:"3.9mm",p:"1.27mm"}),fnn=n=>{const e=pnn.parse(n);return{circuitJson:ww(e),parameters:e}},mnn=q2({w:"7.1mm",p:"0.65mm",pl:"1.35mm",pw:"0.40mm",legsoutside:!0}),_nn=n=>{const e=mnn.parse(n);return{circuitJson:ww(e),parameters:e}},ynn=q2({}),gnn=n=>{const e=ynn.parse({fn:"sot363",num_pins:6,w:1.94,p:.65,pw:.3,pl:.7,legoutside:!0});return{circuitJson:ww(e),parameters:e}},VHe=Re({fn:U(),num_pins:Fe().default(3),w:U().default("1.92mm"),h:U().default("2.74mm"),pl:U().default("0.8mm"),pw:U().default("0.764mm"),p:U().default("0.95mm"),string:U().optional()}),vnn=q2({p:"0.95mm",w:"1.6mm",legsoutside:!0}),xnn=n=>{const e=n.string?.match(/^sot23_(\d+)/),t=e?Number.parseInt(e[1],10):3;if(t===6||t===8){const r=vnn.parse({...n,num_pins:t});return{circuitJson:ww(r),parameters:r}}const i=VHe.parse({...n,num_pins:t});if(i.num_pins===3)return{circuitJson:wnn(i),parameters:i};if(i.num_pins===5)return{circuitJson:GHe(i),parameters:i};throw new Error("Invalid number of pins")},bnn=n=>{const{pn:e}=n;return e===1?{x:-1.7,y:0}:e===2?{x:1.7,y:-.95}:{x:1.7,y:.95}},wnn=n=>{const e=[];for(let i=0;i<n.num_pins;i++){const{x:r,y:o}=bnn({num_pins:n.num_pins,pn:i+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl)});e.push(sr(i+1,r,o,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=Kr(0,Number.parseInt(n.h),.3);return[...e,t]},qHe=n=>{const{p:e,h:t,pn:i}=n;if(i===1)return{x:-t/2-.5,y:e};if(i===2)return{x:-t/2-.5,y:0};if(i===3)return{x:-t/2-.5,y:-e};if(i===4)return{x:t/2+.5,y:-e};if(i===5)return{x:t/2+.5,y:e};throw new Error("Invalid pin number")},GHe=n=>{const e=[];for(let d=1;d<=n.num_pins;d++){const{x:h,y:f}=qHe({h:Number.parseFloat(n.h),p:Number.parseFloat(n.p),pn:d});e.push(sr(d,h,f,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=(n.num_pins+1)/2*Number.parseFloat(n.p),i=Number.parseFloat(n.h),r={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-t/3,y:i/2+Number.parseFloat(n.p)/1.3},{x:t/3,y:i/2+Number.parseFloat(n.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-t/3,y:-i/2-Number.parseFloat(n.p)/1.3},{x:t/3,y:-i/2-Number.parseFloat(n.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},s=Kr(0,i+.3,.3),a=qHe({h:Number.parseFloat(n.h),p:Number.parseFloat(n.p),pn:1});a.x=a.x-Number.parseFloat(n.pw)*1.5;const c=.7,l=.3,u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:a.x+c/2,y:a.y},{x:a.x-c/2,y:a.y+l/2},{x:a.x-c/2,y:a.y-l/2},{x:a.x+c/2,y:a.y}],stroke_width:.05};return[...e,s,r,o,u]},Snn=VHe.extend({}),Enn=n=>{const e=Snn.parse({...n,num_pins:5});return{circuitJson:GHe(e),parameters:e}},Tnn=[{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}],Mnn=q2({}),Cnn=n=>{const e=Mnn.parse(n),t=[];for(let d=0;d<e.num_pins;d++){const{x:h,y:f}=spe({num_pins:e.num_pins,pn:d+1,w:e.w,p:e.p??1.27,pl:e.pl,widthincludeslegs:!0});t.push(sr(d+1,h,f,e.pl??"1mm",e.pw??"0.6mm"))}const i=Math.min(1,e.p/2),r=e.w+i,o=(e.num_pins/2-1)*e.p+e.pw+i,s=[];for(const d of Tnn){const{dx:h,dy:f}=d;s.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",route:[{x:h*r/2-h*e.p,y:f*o/2},{x:h*r/2,y:f*o/2},{x:h*r/2,y:f*o/2-f*e.p}],type:"pcb_silkscreen_path",stroke_width:.1})}const a=e.p/4,c=-r/2-a/2,l=o/2-e.p/2;s.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:c,y:l},{x:c-a,y:l+a},{x:c-a,y:l-a},{x:c,y:l}],stroke_width:.1});const u=Kr(0,o/2+.4,o/12);return{circuitJson:[...t,u,...s],parameters:e}},MU=(n,e,t,i,r,o)=>({pcb_plated_hole_id:"",type:"pcb_plated_hole",shape:"circular_hole_with_rect_pad",x:e,y:t,hole_diameter:Xu(i),hole_shape:"circle",pad_shape:"rect",rect_pad_width:Xu(r),rect_pad_height:Xu(o),pcb_port_id:"",layers:["top","bottom"],port_hints:[n.toString()]}),lpe=({fs:n,pn:e,anchor_x:t,anchor_y:i,textalign:r="center",orthogonal:o=!1,verticallyinverted:s=!1,layer:a="top"})=>{let c=0;o&&s?c=270:s?c=180:o?c=90:c=0;let l="center";return r==="left"&&(s?l="center_right":l="center_left"),r==="right"&&(s?l="center_left":l="center_right"),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:n,pcb_component_id:"pcb_component_1",text:`{PIN${e}}`,layer:a,anchor_position:{x:t,y:i},anchor_alignment:l,ccw_rotation:c}};function Ann({pinlabeltextalignleft:n,pinlabeltextalignright:e,pinlabelorthogonal:t}){let i="top";return t?i="left":i="top",n&&(t?i="bottom":i="right"),e&&(t?i="top":i="left"),i}var Rnn=Re({fn:U(),num_pins:Fe().optional().default(6),rows:Gn([U(),Fe()]).transform(n=>Number(n)).optional().default(1).describe("number of rows"),p:st.default("0.1in").describe("pitch"),id:st.default("1.0mm").describe("inner diameter"),od:st.default("1.5mm").describe("outer diameter"),male:vt().optional().describe("for male pin headers"),female:vt().optional().describe("for female pin headers"),pinlabeltextalignleft:vt().optional().default(!1),pinlabeltextaligncenter:vt().optional().default(!1),pinlabeltextalignright:vt().optional().default(!1),pinlabelverticallyinverted:vt().optional().default(!1),pinlabelorthogonal:vt().optional().default(!1),nosquareplating:vt().optional().default(!1).describe("do not use rectangular pad for pin 1"),nopinlabels:vt().optional().default(!1).describe("omit silkscreen pin labels"),doublesidedpinlabel:vt().optional().default(!1).describe("add silkscreen pins in top and bottom layers"),bottomsidepinlabel:vt().optional().default(!1).describe("place the silkscreen reference text on the bottom layer instead of top")}).transform(n=>{const e=Ann(n);return{...n,pinlabelAnchorSide:e,male:n.male??!n.female,female:n.female??!1}}).superRefine((n,e)=>{n.male&&n.female&&e.addIssue({code:_i.custom,message:"'male' and 'female' cannot both be true; it should be male or female.",path:["male","female"]})}),Pnn=n=>{const e=Rnn.parse(n),{p:t,id:i,od:r,rows:o,num_pins:s,pinlabelAnchorSide:a,pinlabelverticallyinverted:c,pinlabelorthogonal:l,pinlabeltextalignleft:u,pinlabeltextalignright:d,nopinlabels:h,doublesidedpinlabel:f,bottomsidepinlabel:m}=e;let y="center";u?y="left":d&&(y="right");const g=[],b=Math.ceil(s/o),x=-t,w=({xoff:M,yoff:I,od:C,anchorSide:$})=>{let P=0,H=0;const G=C*.75;switch($){case"right":P=G;break;case"top":H=G;break;case"bottom":H=-G;break;case"left":P=-G;break}return{anchor_x:M+P,anchor_y:I+H}},T=(M,I,C)=>{M===1&&!e.nosquareplating?g.push(MU(M,I,C,i,r,r)):g.push(Os(M,I,C,i,r));const{anchor_x:$,anchor_y:P}=w({xoff:I,yoff:C,od:r,anchorSide:a});h||(m?g.push(lpe({fs:r/5,pn:M,anchor_x:$,anchor_y:P,textalign:y,orthogonal:l,verticallyinverted:c,layer:"bottom"})):g.push(lpe({fs:r/5,pn:M,anchor_x:$,anchor_y:P,textalign:y,orthogonal:l,verticallyinverted:c,layer:"top"})),f&&g.push(lpe({fs:r/5,pn:M,anchor_x:$,anchor_y:P,textalign:y,orthogonal:l,verticallyinverted:c,layer:"bottom"})))},N=new Set,R=o>2&&b>2;if(o===1){const M=-((s-1)/2)*t;for(let I=0;I<s;I++){const C=I+1,$=M+I*t,P=`${$},0`;if(N.has(P))throw new Error(`Overlap at ${P}`);N.add(P),T(C,$,0)}}else if(R){const M=-((b-1)/2)*t;let I=1;for(let C=0;C<o&&I<=s;C++)for(let $=0;$<b&&I<=s;$++){const P=M+$*t,H=C*x,G=`${P},${H}`;if(N.has(G))throw new Error(`Overlap at ${G}`);N.add(G),T(I++,P,H)}}else{const M=-((b-1)/2)*t;let I=1,C=0,$=o-1,P=0,H=b-1;for(;I<=s&&C<=$&&P<=H;){for(let G=C;G<=$&&I<=s;G++){const X=M+P*t,W=G*x,K=`${X},${W}`;if(N.has(K))throw new Error(`Overlap at ${K}`);N.add(K),T(I++,X,W)}P++;for(let G=P;G<=H&&I<=s;G++){const X=M+G*t,W=$*x,K=`${X},${W}`;if(N.has(K))throw new Error(`Overlap at ${K}`);N.add(K),T(I++,X,W)}if($--,P<=H){for(let G=$;G>=C&&I<=s;G--){const X=M+H*t,W=G*x,K=`${X},${W}`;if(N.has(K))throw new Error(`Overlap at ${K}`);N.add(K),T(I++,X,W)}H--}if(C<=$){for(let G=H;G>=P&&I<=s;G--){const X=M+G*t,W=C*x,K=`${X},${W}`;if(N.has(K))throw new Error(`Overlap at ${K}`);N.add(K),T(I++,X,W)}C++}}if(I-1<s)throw new Error(`Missing pins: assigned ${I-1}, expected ${s}`)}const k=Kr(0,t,.5);return{circuitJson:[...g,k],parameters:e}},Inn=q2({}),Nnn=n=>{const e=Inn.parse({fn:"sot563",num_pins:6,w:1.94,p:.5,pw:.3,pl:.67,legoutside:!0});return{circuitJson:ww(e),parameters:e}},knn=q2({p:"1.27mm",w:"3.9mm",legsoutside:!0}),Onn=n=>{const e=knn.parse({...n,num_pins:8});return{circuitJson:ww(e),parameters:e}},Dnn=q2({p:"1.27mm",w:"7.5mm",legsoutside:!0}),Lnn=n=>{const e=Dnn.parse({...n,num_pins:16});return{circuitJson:ww(e),parameters:e}},znn=Re({fn:U(),num_pins:we(3).default(3),w:U().default("1.2mm"),h:U().default("1.2mm"),pl:U().default("0.3mm"),pw:U().default("0.32mm")}),Fnn=n=>{const e=znn.parse(n),t=Unn(e),i=Kr(.4,st.parse(e.h),.2);return{circuitJson:[...t,i],parameters:e}},Bnn=n=>{const{pn:e}=n;return e===1?{x:0,y:0}:e===2?{x:1,y:-.4}:{x:1,y:.4}},Unn=n=>{const e=[];for(let t=0;t<3;t++){const{x:i,y:r}=Bnn({num_pins:n.num_pins,pn:t+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl)});e.push(sr(t+1,i,r,Number.parseFloat(n.pl),t!==0?Number.parseFloat(n.pw):.42))}return e},$nn=Re({fn:U(),num_pins:we(2).default(2),w:U().default("2.36mm"),h:U().default("1.22mm"),pl:U().default("0.9mm"),pw:U().default("0.9mm"),p:U().default("4.19mm")}),jnn=n=>{const e=$nn.parse(n),t=Kr(0,st.parse(e.h)/4+.4,.3);return{circuitJson:Vnn(e).concat(t),parameters:e}},Hnn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Vnn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Hnn({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},qnn=Re({fn:U(),p:st.optional().default("2.54mm"),id:st.optional().default("0.7mm"),od:st.optional().default("1mm")}),Gnn=n=>{const e=qnn.parse(n),{p:t,id:i,od:r}=e,o=[Os(1,-t/2,0,i,r),Os(2,t/2,0,i,r)],s={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-t/2+r+i/2,y:0},{x:t/2-r-i/2,y:0}],stroke_width:.1,pcb_silkscreen_path_id:""},a=Kr(0,t/4,.5);return{circuitJson:[...o,s,a],parameters:e}},CU=(n,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:n,stroke_width:e.stroke_width||.1}),Ynn=Re({fn:we("pushbutton"),w:st.default(4.5),h:st.default(6.5),id:st.default(1),od:st.default(1.2)}),Xnn=n=>{const e=Ynn.parse(n),t=e.w,i=e.h,r=e.id,o=[Os(1,-t/2,i/2,r,r*1.5),Os(2,-t/2,-i/2,r,r*1.5),Os(3,t/2,-i/2,r,r*1.5),Os(4,t/2,i/2,r,r*1.5)],s=[CU([{x:-t/2,y:-i/2},{x:-t/2,y:i/2}]),CU([{x:t/2,y:-i/2},{x:t/2,y:i/2}]),CU([{x:-t/2,y:0},{x:-t/5,y:0},{x:t/5*1/Math.sqrt(2),y:i/8}]),CU([{x:t/2,y:0},{x:t/5,y:0}])],a=Kr(0,i/2+.4,.5);return{circuitJson:[...o,...s,a],parameters:e}},YHe=Re({fn:U(),w:st.default("22.58mm"),h:st.optional(),left:st.optional().default(20),right:st.optional().default(20),top:st.optional().default(2),bottom:st.optional().default(2),p:st.default(st.parse("2.54mm")),pw:st.default(st.parse("1.6mm")),pl:st.default(st.parse("2.4mm")),innerhole:vt().default(!1),innerholeedgedistance:st.default(st.parse("1.61mm"))}),Wnn=n=>{const e=YHe.parse(n);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},AU=(n,e,t)=>{let i=[];return t==="right"&&(i=[{x:n+1/2,y:e},{x:n-1/2,y:e+.6/2},{x:n-1/2,y:e-.6/2},{x:n+1/2,y:e}]),t==="left"&&(i=[{x:n-1/2,y:e},{x:n+1/2,y:e+.6/2},{x:n+1/2,y:e-.6/2},{x:n-1/2,y:e}]),t==="top"&&(i=[{x:n,y:e+1/2},{x:n-.6/2,y:e-1/2},{x:n+.6/2,y:e-1/2},{x:n,y:e+1/2}]),t==="bottom"&&(i=[{x:n,y:e-1/2},{x:n-.6/2,y:e+1/2},{x:n+.6/2,y:e+1/2},{x:n,y:e-1/2}]),i},Znn=n=>{const e=YHe.parse(n),t=e.h??Wnn(e),i=[],r=[];let o=[];const s=1,a=1.2,c=e.left+e.right+(e.bottom??0)+(e.top??0);if(e.right){const h=-((e.right-1)/2)*e.p;for(let f=0;f<e.right;f++)f===0&&!e.left&&!e.bottom&&(o=AU(e.w/2-e.pl*1.4,h+f*e.p,"right")),i.push(sr(f+1+e.left+(e.bottom??0),e.w/2-e.pl/2,h+f*e.p,e.pl,e.pw)),e.innerhole&&(r.push(Os(f+1+e.left+(e.bottom??0)+c,e.w/2,h+f*e.p,s,a)),r.push(Os(f+1+e.left+(e.bottom??0)+c*2,e.w/2-e.innerholeedgedistance,h+f*e.p,s,a)))}if(e.left){const h=-((e.left-1)/2)*e.p;for(let f=0;f<e.left;f++)f===e.left-1&&(o=AU(-e.w/2+e.pl*1.4,h+f*e.p,"left")),i.push(sr(f+1,-e.w/2+e.pl/2,h+f*e.p,e.pl,e.pw)),e.innerhole&&(r.push(Os(f+1+c,-e.w/2,h+f*e.p,s,a)),r.push(Os(f+1+c*2,-e.w/2+e.innerholeedgedistance,h+f*e.p,s,a)))}if(e.top){const h=-((e.top-1)/2)*e.p;for(let f=0;f<e.top;f++)f===e.top-1&&!e.left&&!e.bottom&&!e.right&&(o=AU(h+f*e.p,t/2-e.pl*1.4,"top")),i.push(sr(f+1+e.left+e.right+(e.bottom??0),h+f*e.p,t/2-e.pl/2,e.pw,e.pl)),e.innerhole&&(r.push(Os(f+1+e.left+e.right+(e.bottom??0)+c,h+f*e.p,t/2,s,a)),r.push(Os(f+1+e.left+e.right+(e.bottom??0)+c*2,h+f*e.p,t/2-e.innerholeedgedistance,s,a)))}if(e.bottom){const h=-((e.bottom-1)/2)*e.p;for(let f=0;f<e.bottom;f++)f===0&&!e.left&&(o=AU(h+f*e.p,-t/2+e.pl*1.4,"bottom")),i.push(sr(f+1+e.left,h+f*e.p,-t/2+e.pl/2,e.pw,e.pl)),e.innerhole&&(r.push(Os(f+1+e.left+c,h+f*e.p,-t/2,s,a)),r.push(Os(f+1+e.left+c*2,h+f*e.p,-t/2+e.innerholeedgedistance,s,a)))}const l={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_triangle_1",pcb_component_id:"2",route:o,stroke_width:.1,layer:"top"},u={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-e.w/2,y:t/2},{x:e.w/2,y:t/2},{x:e.w/2,y:-t/2},{x:-e.w/2,y:-t/2},{x:-e.w/2,y:t/2}],stroke_width:.1,layer:"top"},d=Kr(0,t/1.8,t/25);return{circuitJson:[...i,...r,u,l,d],parameters:e}},XHe=Re({fn:U(),w:st.default("22.58mm"),h:st.optional(),left:st.optional().default(20),right:st.optional().default(20),top:st.optional().default(2),bottom:st.optional().default(2),p:st.default(st.parse("2.54mm")),pw:st.default(st.parse("1.6mm")),pl:st.default(st.parse("3.2mm")),innerhole:vt().default(!1),innerholeedgedistance:st.default(st.parse("1.61mm"))}),Knn=n=>{const e=XHe.parse(n);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},Qnn=(n,e,t,i=1,r=.6)=>{const o=i/2,s=r/2;return{left:[{x:n+o,y:e},{x:n-o,y:e+s},{x:n-o,y:e-s},{x:n+o,y:e}],right:[{x:n-o,y:e},{x:n+o,y:e+s},{x:n+o,y:e-s},{x:n-o,y:e}],top:[{x:n,y:e-o},{x:n-s,y:e+o},{x:n+s,y:e+o},{x:n,y:e-o}],bottom:[{x:n,y:e+o},{x:n-s,y:e-o},{x:n+s,y:e-o},{x:n,y:e+o}]}[t]},Jnn=n=>{const e=XHe.parse(n),t=e.h??Knn(e),i=[],r=[],o=[],s=1,a=1.2,c=e.left+e.right+(e.bottom??0)+(e.top??0);let l=[],u=1;if(e.left){const m=(e.left-1)/2*e.p;for(let y=0;y<e.left;y++)y===0&&(l=Qnn(-e.w/2-e.pl/2,m-y*e.p,"left")),i.push(sr(u,-e.w/2+e.pl/2,m-y*e.p,e.pl,e.pw)),r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${u}`,pcb_component_id:"1",layer:"top",anchor_position:{x:-e.w/2+e.pl/2-4.5,y:m-y*e.p},text:`pin${u}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),u++,e.innerhole&&o.push(Os(u+c,-e.w/2+e.innerholeedgedistance,m-y*e.p,s,a))}if(e.bottom){const m=(e.bottom-1)/2*e.p;for(let y=e.bottom-1;y>=0;y--)i.push(sr(u,m-y*e.p,-t/2+e.pl/2,e.pw,e.pl)),r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${u}`,pcb_component_id:"1",layer:"top",anchor_position:{x:m-y*e.p,y:-t/2+e.pl/2-3.2},text:`pin${u}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),u++,e.innerhole&&o.push(Os(u+c,m-y*e.p,-t/2+e.innerholeedgedistance,s,a))}if(e.right){const m=-((e.right-1)/2)*e.p;for(let y=0;y<e.right;y++)i.push(sr(u,e.w/2-e.pl/2,m+y*e.p,e.pl,e.pw)),r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${u}`,pcb_component_id:"1",layer:"top",anchor_position:{x:e.w/2-e.pl/2+3.7,y:m+y*e.p},text:`pin${u}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),u++,e.innerhole&&o.push(Os(u+c,e.w/2-e.innerholeedgedistance,m+y*e.p,s,a))}if(e.top){const m=-((e.top-1)/2)*e.p;for(let y=e.top-1;y>=0;y--)i.push(sr(u,m+y*e.p,t/2-e.pl/2,e.pw,e.pl)),r.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${u}`,pcb_component_id:"1",layer:"top",anchor_position:{x:m+y*e.p,y:t/2-e.pl/2+3.2},text:`pin${u}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),u++,e.innerhole&&o.push(Os(u+c,m+y*e.p,t/2-e.innerholeedgedistance,s,a))}const d={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"1",pcb_component_id:"1",layer:"top",route:l,stroke_width:.1},h={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:t/2+e.pl/3},{x:e.w/2+e.pl/3,y:t/2+e.pl/3},{x:e.w/2+e.pl/3,y:-t/2-e.pl/3},{x:-e.w/2-e.pl/3,y:-t/2-e.pl/3},{x:-e.w/2-e.pl/3,y:t/2+e.pl/3}],stroke_width:.1,layer:"top"},f=Kr(0,t/1.8,t/25);return{circuitJson:[...o,...i,...r,h,d,f],parameters:e}},ein=n=>(n.legsoutside=!0,pP(n)),WHe=Re({fn:U(),w:st.default("10mm"),h:st.optional(),left:st.optional().default(20),right:st.optional().default(20),top:st.optional().default(0),bottom:st.optional().default(0),p:st.default(st.parse("2.54mm")),id:st.optional().default(st.parse("1mm")),od:st.optional().default(st.parse("1.5mm"))}),tin=n=>{const e=WHe.parse(n);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},RU=(n,e,t,i=1,r=.6)=>{const o=i/2,s=r/2;return{left:[{x:n+o,y:e},{x:n-o,y:e+s},{x:n-o,y:e-s},{x:n+o,y:e}],right:[{x:n-o,y:e},{x:n+o,y:e+s},{x:n+o,y:e-s},{x:n-o,y:e}],top:[{x:n,y:e-o},{x:n-s,y:e+o},{x:n+s,y:e+o},{x:n,y:e-o}],bottom:[{x:n,y:e+o},{x:n-s,y:e-o},{x:n+s,y:e-o},{x:n,y:e+o}]}[t]},nin=n=>{const e=WHe.parse(n),t=e.h??tin(e),i=[],r=e.id,o=e.od;let s=[];if(e.right){const u=-((e.right-1)/2)*e.p;for(let d=0;d<e.right;d++)d===0&&!e.left&&!e.bottom&&(s=RU(e.w/2+o*1.4,u+d*e.p,"right")),i.push(Os(d+1+e.left+(e.bottom??0),e.w/2,u+d*e.p,r,o))}if(e.left){const u=-((e.left-1)/2)*e.p;for(let d=0;d<e.left;d++)d===e.left-1&&(s=RU(-e.w/2-o*1.4,u+d*e.p,"left")),i.push(Os(d+1,-e.w/2,u+d*e.p,r,o))}if(e.top){const u=-((e.top-1)/2)*e.p;for(let d=0;d<e.top;d++)d===e.top-1&&!e.left&&!e.bottom&&!e.right&&(s=RU(u+d*e.p,t/2+o*1.4,"top")),i.push(Os(d+1+e.right+(e.bottom??0)+e.left,u+d*e.p,t/2,r,o))}if(e.bottom){const u=-((e.bottom-1)/2)*e.p;for(let d=0;d<e.bottom;d++)d===0&&!e.left&&(s=RU(u+d*e.p,-t/2-o*1.4,"bottom")),i.push(Os(d+1+e.left,u+d*e.p,-t/2,r,o))}const a={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"1",pcb_component_id:"1",layer:"top",route:s,stroke_width:.1},c={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-e.w/2-o,y:t/2+o},{x:e.w/2+o,y:t/2+o},{x:e.w/2+o,y:-t/2-o},{x:-e.w/2-o,y:-t/2-o},{x:-e.w/2-o,y:t/2+o}],stroke_width:.1,layer:"top"},l=Kr(0,t/1.7,t/25);return{circuitJson:[...i,c,l,a],parameters:e}},ZHe=(n,e,t,i)=>Array.from({length:25},(r,o)=>{const s=o/24*Math.PI-Math.PI/2;return{x:n+(i==="right"?1:-1)*Math.cos(s)*t,y:e+Math.sin(s)*t}}),iin=Re({fn:U(),p:st.optional().default("4.88mm"),id:st.optional().default("0.6mm"),od:st.optional().default("1.2mm"),w:st.optional().default("5.6mm"),h:st.optional().default("3.5mm")}),rin=n=>{const e=iin.parse(n),{p:t,id:i,od:r,w:o,h:s}=e,a=s/2,c=[Os(1,-t/2,0,i,r),Os(2,t/2,0,i,r)],l=ZHe(-o/2,0,a,"left"),u=ZHe(o/2,0,a,"right"),d={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[...l,...l.slice(1).reverse(),{x:-o/2,y:-s/2},{x:o/2,y:-s/2},...u,{x:o/2,y:s/2},{x:-o/2,y:s/2}],stroke_width:.1,pcb_silkscreen_path_id:""},h=Kr(0,t/4,.5);return{circuitJson:[...c,d,h],parameters:e}};Re({w:st,h:st});var oin=n=>{const{w:e,h:t}=n,i=Xu(e),r=Xu(t);return{circuitJson:[sr(1,0,0,i,r),Kr(0,r/2+.5,.2)],parameters:n}},sin=Re({fn:U(),num_pins:Gn([we(3),we(2)]).default(3),p:U().default("1.27mm"),id:U().default("0.72mm"),od:U().default("0.95mm"),w:U().default("4.5mm"),h:U().default("4.5mm"),inline:vt().default(!1),string:U().optional()}),ain=(n,e,t)=>Array.from({length:25},(i,r)=>{const o=r/24*Math.PI;return{x:n+Math.cos(o)*t,y:e+Math.sin(o)*t}}),cin=n=>{const{p:e,id:t,od:i,h:r}=n,o=Number.parseFloat(r)/2,s=Number.parseFloat(e);return[Os(1,-s,o-s,t,i),Os(2,s,o-s,t,i)]},lin=n=>{const e=n.string?.match(/^to92_(\d+)/),t=e?Number.parseInt(e[1],10):3,i=sin.parse({...n,num_pins:t}),{p:r,id:o,od:s,w:a,h:c,inline:l}=i,u=Number.parseFloat(c)/2,d=Number.parseFloat(r);let h=[];if(i.num_pins===3)h=l?[Os(1,-d,u-d,o,s),Os(2,0,u-d,o,s),Os(3,d,u-d,o,s)]:[Os(1,0,u,o,s),Os(2,-d,u-d,o,s),Os(3,d,u-d,o,s)];else if(i.num_pins===2)h=cin(i);else throw new Error("Invalid number of pins for TO-92");const f=Number.parseFloat(a)/2,m=ain(0,u,f),y={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[...m,{x:-f,y:0},{x:f,y:0},m[0]],stroke_width:.1,pcb_silkscreen_path_id:""},g=Kr(0,u+1,.5);return{circuitJson:[...h,y,g],parameters:i}},uin=Re({fn:U(),num_pins:we(2).default(2),w:U().default("2.15mm"),h:U().default("1.20mm"),pl:U().default("0.5mm"),pw:U().default("0.6mm"),p:U().default("1.4mm")}),din=n=>{const e=uin.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:pin(e).concat(i,t),parameters:e}},hin=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},pin=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=hin({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},fin=q2({}),min=n=>{const e=fin.parse(n),t=[];for(let s=0;s<e.num_pins;s++){const{x:a,y:c}=spe({num_pins:e.num_pins,pn:s+1,w:e.w,p:e.p??1.27,pl:e.pl,widthincludeslegs:!0});t.push(sr(s+1,a,c,e.pl??"1.5mm",e.pw??"0.6mm"))}const i=(e.num_pins/2-1)*e.p+e.pw,r=Kr(0,i/2-.5,i/12),o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:-e.w/3,y:i/2+.2},{x:e.w/3,y:i/2+.2}],stroke_width:.1};return{circuitJson:[...t,r,o],parameters:e}},_in=Re({fn:U(),num_pins:we(2).default(2),w:U().default("5.0mm"),h:U().default("2.30mm"),pl:U().default("1.25mm"),pw:U().default("2mm"),p:U().default("3.75mm")}),yin=n=>{const e=_in.parse(n),t=Kr(0,st.parse(e.h)/2+1,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2+.5,y:st.parse(e.h)/2+.5},{x:-st.parse(e.w)/2-.5,y:st.parse(e.h)/2+.5},{x:-st.parse(e.w)/2-.5,y:-st.parse(e.h)/2-.5},{x:st.parse(e.p)/2+.5,y:-st.parse(e.h)/2-.5}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:vin(e).concat(i,t),parameters:e}},gin=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},vin=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=gin({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},xin=Re({fn:U(),num_pins:we(2).default(2),w:U().default("4.4mm"),h:U().default("2.1mm"),pl:U().default("1.2mm"),pw:U().default("1.2mm"),p:U().default("2.9mm")}),bin=n=>{const e=xin.parse(n),t=Kr(0,st.parse(e.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Sin(e).concat(i,t),parameters:e}},win=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Sin=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=win({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Ein=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.30mm"),h:U().default("1.80mm"),pl:U().default("0.60mm"),pw:U().default("0.45mm"),p:U().default("2.1mm")}),Tin=n=>{const e=Ein.parse(n),t=Kr(0,st.parse(e.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Cin(e).concat(i,t),parameters:e}},Min=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Cin=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Min({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Ain=Re({fn:U(),num_pins:we(2).default(2),w:U().default("1.4mm"),h:U().default("0.9mm"),pl:U().default("0.35mm"),pw:U().default("0.25mm"),p:U().default("1.2mm")}),Rin=n=>{const e=Ain.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2+.15,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.4,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.4,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2+.15,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Iin(e).concat(i,t),parameters:e}},Pin=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Iin=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Pin({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Nin=Re({fn:U(),num_pins:we(2).default(2),w:U().default("1.3mm"),h:U().default("0.9mm"),pl:U().default("0.4mm"),pw:U().default("0.7mm"),p:U().default("0.7mm")}),kin=n=>{const e=Nin.parse(n),t=Kr(0,st.parse(e.h)+.1,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2+.2,y:st.parse(e.h)/2+.2},{x:-st.parse(e.w)/2-.2,y:st.parse(e.h)/2+.2},{x:-st.parse(e.w)/2-.2,y:-st.parse(e.h)/2-.2},{x:st.parse(e.p)/2+.2,y:-st.parse(e.h)/2-.2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Din(e).concat(i,t),parameters:e}},Oin=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Din=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Oin({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Lin=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3,05mm"),h:U().default("1.65mm"),pl:U().default("0.6mm"),pw:U().default("0.6mm"),pad_spacing:U().default("2.2mm")}),zin=n=>{const e=Lin.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.pad_spacing)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:-st.parse(e.h)/2},{x:st.parse(e.pad_spacing)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Bin(e).concat(i,t),parameters:e}},Fin=n=>{const{pn:e,pad_spacing:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Bin=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Fin({pn:t,pad_spacing:Number.parseFloat(n.pad_spacing)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Uin=Re({fn:U(),num_pins:we(2).default(2),w:U().default("4.4mm"),h:U().default("2.1mm"),pl:U().default("1.2mm"),pw:U().default("1.2mm"),p:U().default("2.9mm")}),$in=n=>{const e=Uin.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Hin(e).concat(i,t),parameters:e}},jin=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Hin=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=jin({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Vin=Re({fn:U(),num_pins:we(2).default(2),w:U().default("4.4mm"),h:U().default("2.1mm"),pl:U().default("0.91mm"),pw:U().default("1.22mm"),p:U().default("3.146mm")}),qin=n=>{const e=Vin.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Yin(e).concat(i,t),parameters:e}},Gin=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Yin=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Gin({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Xin=Re({fn:U(),num_pins:we(2).default(2),w:U().default("1.80mm"),h:U().default("1.00mm"),pl:U().default("0.66mm"),pw:U().default("0.5mm"),p:U().default("0.8mm")}),Win=n=>{const e=Xin.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.1,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.1,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Kin(e).concat(i,t),parameters:e}},Zin=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Kin=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Zin({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Qin=Re({fn:U(),num_pins:we(2).default(2),w:U().default("6.2mm"),h:U().default("3.4mm"),pl:U().default("1.4mm"),pw:U().default("2.1mm"),p:U().default("4.4mm")}),Jin=n=>{const e=Qin.parse(n),t=Kr(0,st.parse(e.h)/2+.4,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:trn(e).concat(i,t),parameters:e}},ern=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},trn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=ern({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},nrn=Re({fn:U(),num_pins:Gn([we(3),we(5)]).default(3),w:U().default("4.80mm"),h:U().default("4.80mm"),pl:U().default("1.3mm"),pw:U().default("0.9mm"),p:U().default("1.5mm"),string:U().optional()}),irn=n=>{const e=[],t=Number.parseFloat(n.p),i=Number.parseFloat(n.pw),r=Number.parseFloat(n.w),o=Number.parseFloat(n.pl);e.push(sr(1,-r/2,t,o,i),sr(2,-r/2+(1.5-1.3)/2,0,1.5,i),sr(3,-r/2,-t,o,i));const s=Kr(0,0,.3),a=Number.parseFloat(n.w)/2-1,c=Number.parseFloat(n.h)/2,l={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-a,y:c},{x:a,y:c},{x:a,y:c/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},u={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-a,y:-c},{x:a,y:-c},{x:a,y:-c/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,l,u,s]},rrn=n=>{const e=[];Number.parseFloat(n.p),Number.parseFloat(n.pw),Number.parseFloat(n.w),e.push(sr(1,-1.85,-1.5,1.5,.7),sr(2,-1.85,1.5,1.5,.7),sr(3,0,0,.8,2),sr(4,1.85,-1.5,1.5,.7),sr(5,1.85,1.5,1.5,.7));const t=Kr(0,Number.parseFloat(n.h)/2+.5,.3),i=Number.parseFloat(n.w)/2-1,r=Number.parseFloat(n.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:r},{x:i,y:r}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-r},{x:i,y:-r}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,o,s,t]},orn=n=>{const e=n.string?.match(/^sot89_(\d+)/),t=e?Number.parseInt(e[1],10):3,i=nrn.parse({...n,num_pins:t});if(i.num_pins===3)return{circuitJson:irn(i),parameters:i};if(i.num_pins===5)return{circuitJson:rrn(i),parameters:i};throw new Error("Invalid number of pins for SOT89")},srn=Re({fn:U(),p:st.optional().default("5.0mm"),id:st.optional().default("1.0mm"),od:st.optional().default("1.9mm"),w:st.optional().default("13mm"),h:st.optional().default("7mm"),num_pins:Fe().optional(),string:U().optional()}),arn=n=>{const e=srn.parse(n),{fn:t,id:i,od:r,w:o,h:s,string:a}=e,c=Number.parseInt(a?.split("_")[1]??"3"),l=-1,u=o/2,d=s/2,h=2.5,f=o*.4,m=Math.max(h,f/(c-1)),y=Array.from({length:c},(N,R)=>{const k=c%2===0?(R-c/2+.5)*m:(R-Math.floor(c/2))*m;return Os(R+1,k,l,i,r)}),g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-u,y:-d},{x:u,y:-d},{x:u,y:d},{x:-u,y:d},{x:-u,y:-d}],stroke_width:.1,pcb_silkscreen_path_id:""},b=-d+2*s/3,x={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-u,y:b},{x:u,y:b}],stroke_width:.1,pcb_silkscreen_path_id:""},w=[{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-o/6,y:b},{x:-o/6,y:d}],stroke_width:.1,pcb_silkscreen_path_id:""},{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:o/6,y:b},{x:o/6,y:d}],stroke_width:.1,pcb_silkscreen_path_id:""}],T=Kr(0,s/2+.6,.5);return{circuitJson:[...y,g,x,...w,T],parameters:{...e,p:m}}},crn=Re({fn:U(),num_pins:we(2).default(2),w:U().default("5.40mm"),h:U().default("2.30mm"),pl:U().default("1.30mm"),pw:U().default("1.70mm"),p:U().default("3.5mm")}),lrn=n=>{const e=crn.parse(n),t=Kr(0,st.parse(e.h)/2+.4,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:drn(e).concat(i,t),parameters:e}},urn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},drn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=urn({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},hrn=Re({fn:U(),num_pins:we(2).default(2),w:U().default("1.90mm"),h:U().default("1.33mm"),pl:U().default("0.5mm"),pw:U().default("0.7mm"),p:U().default("0.8mm")}),prn=n=>{const e=hrn.parse(n),t=Kr(0,st.parse(e.h)+.1,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2+.1,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2+.1,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:mrn(e).concat(i,t),parameters:e}},frn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},mrn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=frn({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},_rn=Re({fn:U(),num_pins:we(2).default(2),w:U().default("7.0mm"),h:U().default("3.35mm"),pl:U().default("1.50mm"),pw:U().default("2.70mm"),p:U().default("4.8mm")}),yrn=n=>{const e=_rn.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:vrn(e).concat(i,t),parameters:e}},grn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},vrn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=grn({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},xrn=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.0mm"),h:U().default("1.80mm"),pl:U().default("0.80mm"),pw:U().default("1.20mm"),p:U().default("1.6mm")}),brn=n=>{const e=xrn.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.1,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.1,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Srn(e).concat(i,t),parameters:e}},wrn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Srn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=wrn({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Ern=Re({fn:U(),num_pins:we(2).default(2),w:U().default("7.10mm"),h:U().default("3.40mm"),pl:U().default("2.45mm"),pw:U().default("1.80mm"),p:U().default("4.05mm")}),Trn=n=>{const e=Ern.parse(n),t=Kr(0,st.parse(e.h)/2+.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.5,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.5,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Crn(e).concat(i,t),parameters:e}},Mrn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Crn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Mrn({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Arn=Re({fn:U(),num_pins:we(2).default(2),w:U().default("4.80mm"),h:U().default("2.10mm"),pl:U().default("1.30mm"),pw:U().default("1.40mm"),p:U().default("2.9mm")}),Rrn=n=>{const e=Arn.parse(n),t=Kr(0,st.parse(e.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Irn(e).concat(i,t),parameters:e}},Prn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Irn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Prn({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Nrn=Re({fn:U(),num_pins:we(2).default(2),w:U().default("7.30mm"),h:U().default("4.40mm"),pl:U().default("2.50mm"),pw:U().default("2.30mm"),p:U().default("4.30mm")}),krn=n=>{const e=Nrn.parse(n),t=Kr(0,st.parse(e.h)/2+.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.1,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.1,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Drn(e).concat(i,t),parameters:e}},Orn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Drn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Orn({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Lrn=Re({fn:U(),num_pins:we(2).default(2),w:U().default("10.70mm"),h:U().default("6.60mm"),pl:U().default("3.30mm"),pw:U().default("2.50mm"),p:U().default("6.80mm")}),zrn=n=>{const e=Lrn.parse(n),t=Kr(0,3,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2-.8},{x:-st.parse(e.w)/2-.8,y:st.parse(e.h)/2-.8},{x:-st.parse(e.w)/2-.8,y:-st.parse(e.h)/2+.8},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2+.8}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Brn(e).concat(i,t),parameters:e}},Frn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Brn=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Frn({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Urn=Re({fn:U(),num_pins:Fe().default(4),w:U().default("8.50mm"),h:U().default("6.90mm"),pl:U().default("2mm"),pw:U().default("1.5mm"),p:U().default("2.30mm"),string:U().optional()}),$rn=n=>{const e=n.string?.match(/^sot223_(\d+)/),t=e?Number.parseInt(e[1],10):4;if(t===8){const r=Vrn.parse({...n,num_pins:t});return{circuitJson:ww(r),parameters:r}}const i=Urn.parse({...n,num_pins:t});if(i.num_pins===4)return{circuitJson:Hrn(i),parameters:i};if(i.num_pins===5)return{circuitJson:Grn(i),parameters:i};if(i.num_pins===6)return{circuitJson:Xrn(i),parameters:i};throw new Error("Invalid number of pins")},jrn=n=>{const{pn:e,w:t,p:i}=n;return e===1?{x:-t/2+1.1,y:i}:e===2?{x:-t/2+1.1,y:0}:e===3?{x:-t/2+1.1,y:-i}:{x:t/2-1.1,y:0}},Hrn=n=>{const e=[];for(let a=0;a<n.num_pins;a++){const{x:c,y:l}=jrn({num_pins:n.num_pins,pn:a+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl),p:Number.parseFloat(n.p)}),u=a===3?3.8:Number.parseFloat(n.pw);e.push(sr(a+1,c,l,Number.parseFloat(n.pl),u))}const t=Kr(0,0,.3),i=Number.parseFloat(n.w)/2-2.4,r=Number.parseFloat(n.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:r},{x:i,y:r},{x:i,y:r/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-r},{x:i,y:-r},{x:i,y:-r/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,o,s,t]},Vrn=q2({p:"0.90mm",w:"2.8mm",legsoutside:!0}),qrn=n=>{const{p:e,pn:t,w:i}=n;if(t===1)return{x:-i/2+1.2,y:e/2+e};if(t===2)return{x:-i/2+1.2,y:e/2};if(t===3)return{x:-i/2+1.2,y:-e/2};if(t===4)return{x:-i/2+1.2,y:-e/2-e};if(t===5)return{x:i/2-1,y:0};throw new Error("Invalid pin number")},Grn=n=>{const e=[];for(let a=1;a<=n.num_pins;a++){const{x:c,y:l}=qrn({h:Number.parseFloat(n.h),p:1.5,pn:a,w:Number.parseFloat(n.w)});let u=Number.parseFloat(n.pw),d=Number.parseFloat(n.pl);a===5?(u=3.4,d=1.8):(u=1,d=2.2),e.push(sr(a,c,l,d,u))}const t=Number.parseFloat(n.w)/2-2.4,i=Number.parseFloat(n.h)/2,r={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-t,y:i},{x:t,y:i},{x:t,y:i/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-t,y:-i},{x:t,y:-i},{x:t,y:-i/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1},s=Kr(0,0,.3);return[...e,r,o,s]},Yrn=n=>{const{p:e,pn:t,w:i}=n;if(t===1)return{x:-i/2+1.2,y:2*e};if(t===2)return{x:-i/2+1.2,y:e};if(t===3)return{x:-i/2+1.2,y:0};if(t===4)return{x:-i/2+1.2,y:-e};if(t===5)return{x:-i/2+1.2,y:-2*e};if(t===6)return{x:i/2-1.175,y:0};throw new Error("Invalid pin number")},Xrn=n=>{const e=[];for(let a=1;a<=n.num_pins;a++){const{x:c,y:l}=Yrn({h:Number.parseFloat(n.h),p:1.3,pn:a,w:8.7});let u=Number.parseFloat(n.pw),d=Number.parseFloat(n.pl);a===6?(u=3.4,d=2.15):(u=.6,d=2.2),e.push(sr(a,c,l,d,u))}const t=Number.parseFloat(n.w)/2-2.4,i=Number.parseFloat(n.h)/2,r={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-t,y:i},{x:t,y:i},{x:t,y:i/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-t,y:-i},{x:t,y:-i},{x:t,y:-i/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1},s=Kr(0,0,.3);return[...e,r,o,s]},Wrn=Re({fn:U(),num_pins:Fe().default(3),w:U().default("3.40mm"),h:U().default("3.30mm"),pl:U().default("1mm"),pw:U().default("0.7mm"),p:U().default("1.2mm"),string:U().optional()}),Zrn=n=>{const e=n.string?.match(/^sot23w_(\d+)/),t=e?Number.parseInt(e[1],3):3,i=Wrn.parse({...n,num_pins:t});if(i.num_pins===3)return{circuitJson:Qrn(i),parameters:i};throw new Error("Invalid number of pins")},Krn=n=>{const{pn:e,p:t}=n;return e===1?{x:-t,y:.95}:e===2?{x:-t,y:-.95}:{x:t,y:0}},Qrn=n=>{const e=[];for(let a=0;a<n.num_pins;a++){const{x:c,y:l}=Krn({num_pins:n.num_pins,pn:a+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl),p:Number.parseFloat(n.p)});e.push(sr(a+1,c,l,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=Kr(0,Number.parseInt(n.h)/2+1,.3),i=Number.parseFloat(n.w)/2-1,r=Number.parseFloat(n.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:r},{x:i+.3,y:r},{x:i+.3,y:r/2}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-r},{x:i+.3,y:-r},{x:i+.3,y:-r/2}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,o,s,t]},Jrn=Re({fn:U(),num_pins:Gn([we(3),we(2)]).default(3),p:U().default("1.27mm"),id:U().default("0.72mm"),od:U().default("0.95mm"),w:U().default("2.5mm"),h:U().default("4.2mm"),string:U().optional()}),eon=n=>{const{p:e,id:t,od:i,w:r,h:o}=n,s=Number.parseFloat(o)/2,a=Number.parseFloat(e);return[Os(1,-a,s-a,t,i),Os(2,0,s-a,t,i),Os(3,a,s-a,t,i)]},ton=n=>{const{p:e,id:t,od:i,h:r}=n,o=Number.parseFloat(r)/2,s=Number.parseFloat(e);return[Os(1,-s,o-s,t,i),Os(2,s,o-s,t,i)]},non=n=>{const e=n.string?.match(/^to92s_(\d+)/),t=e?Number.parseInt(e[1],10):3,i=Jrn.parse({...n,num_pins:t});let r=[];if(i.num_pins===3)r=eon(i);else if(i.num_pins===2)r=ton(i);else throw new Error("Invalid number of pins for TO-92");const o=Number.parseFloat(i.h)/2,s=Number.parseFloat(i.p),a={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-o,y:o-s},{x:-1.9,y:0},{x:1.9,y:0},{x:o,y:o-s},{x:1.5,y:Number.parseFloat(i.h)/2+.5},{x:-1.5,y:Number.parseFloat(i.h)/2+.5},{x:-o,y:o-s}],stroke_width:.1,pcb_silkscreen_path_id:""},c=Kr(0,o+1,.5);return{circuitJson:[...r,a,c],parameters:i}},ion=Re({fn:U(),p:st.optional(),id:st.optional(),pw:st.optional(),pl:st.optional(),w:st.optional(),h:st.optional(),sh:Gn([vt(),U(),Fe()]).optional().transform(n=>{if(typeof n=="string"){const e=Number(n);return Number.isNaN(e)?!0:e}return n}).describe('JST SH (Surface-mount) connector family. SH stands for "Super High-density".'),ph:vt().optional().describe('JST PH (Through-hole) connector family. PH stands for "Pin Header".'),string:U().optional()}),ron={ph:{p:st.parse("2.2mm"),id:st.parse("0.70mm"),pw:st.parse("1.20mm"),pl:st.parse("1.20mm"),w:st.parse("6mm"),h:st.parse("5mm")},sh:{p:st.parse("1mm"),pw:st.parse("0.6mm"),pl:st.parse("1.55mm"),w:st.parse("5.8mm"),h:st.parse("7.8mm")}};function oon(n){return n.sh?"sh":(n.ph,"ph")}function son(n,e,t,i,r,o){const s=[];if(n==="ph"){const a=t/2;s.push(MU(1,-a,2,i,r,o)),s.push(MU(2,a,2,i,r,o))}else{const a=-((e-1)/2)*t;for(let l=0;l<e;l++){const u=a+l*t;console.log("x si",u),s.push(sr(l+1,u,-1.325,r,o))}const c=(e-1)/2*t+1.3;console.log("offset",c),s.push(sr(e+1,-c,1.22,1.2,1.8)),s.push(sr(e+2,c,1.22,1.2,1.8))}return s}function aon(n,e,t){return n==="ph"?{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-3,y:3},{x:3,y:3},{x:3,y:-2},{x:-3,y:-2},{x:-3,y:3}],stroke_width:.1,pcb_silkscreen_path_id:""}:{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[],stroke_width:.1,pcb_silkscreen_path_id:""}}var con=n=>{const e=ion.parse(n),t=oon(e),i=ron[t],r=e.p??i.p,o=e.id??i.id,s=e.pw??i.pw,a=e.pl??i.pl,c=e.w??i.w,l=e.h??i.h;let u=t==="sh"?4:2;if(t==="sh"){const y=(typeof n.string=="string"?n.string:"").match(/sh(\d+)/);if(y&&y[1]){const g=parseInt(y[1],10);Number.isNaN(g)||(u=g)}else typeof e.sh=="number"&&(u=e.sh)}const d=son(t,u,r,o,s,a),h=aon(t),f=Kr(0,l/2+1,.5);return{circuitJson:[...d,h,f],parameters:{...e,p:r,id:o,pw:s,pl:a,w:c,h:l,num_pins:u,sh:t==="sh",ph:t==="ph"}}},lon=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.30mm"),h:U().default("1.70mm"),pl:U().default("0.80mm"),pw:U().default("1mm"),p:U().default("1.90mm")}),uon=n=>{const e=lon.parse(n),t=Kr(0,st.parse(e.h)/2+.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:hon(e).concat(i,t),parameters:e}},don=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},hon=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=don({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},pon=n=>{switch(n){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"}}},fon=Re({fn:U(),num_pins:Gn([we(8),we(10)]).default(8),w:U().optional(),h:U().optional(),p:U().optional(),pl:U().optional(),pw:U().optional(),string:U().optional()}),mon=n=>{const e=fon.parse(n),t=pon(e.num_pins),i=st.parse(e.w||t.w),r=st.parse(e.h||t.h),o=st.parse(e.p||t.p),s=st.parse(e.pl||t.pl),a=st.parse(e.pw||t.pw),c=[],l=e.num_pins/2;for(let x=0;x<e.num_pins;x++){const{x:w,y:T}=KHe(e.num_pins,x+1,i,o),N=x<l?x+1:e.num_pins-(x-l);c.push(sr(N,w,T,s,a))}const u=i,d=r,h={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-u/2,y:d/2},{x:u/2,y:d/2}],stroke_width:.05,pcb_silkscreen_path_id:""},f={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-u/2,y:-d/2},{x:u/2,y:-d/2}],stroke_width:.05,pcb_silkscreen_path_id:""},m=KHe(e.num_pins,1,u,o),y={x:m.x-.8,y:m.y},g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:y.x-.4,y:y.y},{x:y.x-.7,y:y.y+.3},{x:y.x-.7,y:y.y-.3},{x:y.x-.4,y:y.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},b=Kr(0,d/2+.5,.3);return{circuitJson:[...c,h,f,b,g],parameters:e}},KHe=(n,e,t,i)=>{const r=n/2,o=(e-1)%r,s=e<=r?-1:1,a=(r-1)/2-o;return{x:s*st.parse(n===8?"1.8mm":"2.2mm"),y:a*i}},_on=n=>{switch(n){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"}}},yon=Re({fn:U(),num_pins:Gn([we(8),we(10),we(12),we(16)]).default(8),w:U().optional(),h:U().optional(),p:U().optional(),pl:U().optional(),pw:U().optional(),string:U().optional()}),QHe=(n,e,t,i)=>{const r=n/2,o=(e-1)%r,s=e<=r?-1:1,a=(r-1)/2-o;return{x:s*st.parse("2mm"),y:a*i}},gon=n=>{const e=yon.parse(n),t=_on(e.num_pins),i=st.parse(e.w||t.w),r=st.parse(e.h||t.h),o=st.parse(e.p||t.p),s=st.parse(e.pl||t.pl),a=st.parse(e.pw||t.pw),c=[];for(let b=0;b<e.num_pins;b++){const{x,y:w}=QHe(e.num_pins,b+1,i,o);c.push(sr(b+1,x,w,s,a))}const l=i,u=r,d={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:""},f=QHe(e.num_pins,1,l,o),m={x:f.x-.8,y:f.y},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"},g=Kr(0,u/2+.5,.3);return{circuitJson:[...c,d,h,g,y],parameters:e}},von=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.8mm"),h:U().default("1.65mm"),pl:U().default("1.2mm"),pw:U().default("1.2mm"),pad_spacing:U().default("2.6mm")}),xon=n=>{const e=von.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.pad_spacing)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:-st.parse(e.h)/2},{x:st.parse(e.pad_spacing)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:won(e).concat(i,t),parameters:e}},bon=n=>{const{pn:e,pad_spacing:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},won=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=bon({pn:t,pad_spacing:Number.parseFloat(n.pad_spacing)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Son=Re({fn:U(),num_pins:we(2).default(2),w:U().default("3.20mm"),h:U().default("1.65mm"),pl:U().default("0.8mm"),pw:U().default("0.9mm"),pad_spacing:U().default("2.1mm")}),Eon=n=>{const e=Son.parse(n),t=Kr(0,st.parse(e.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.pad_spacing)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.2,y:-st.parse(e.h)/2},{x:st.parse(e.pad_spacing)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Mon(e).concat(i,t),parameters:e}},Ton=n=>{const{pn:e,pad_spacing:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Mon=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=Ton({pn:t,pad_spacing:Number.parseFloat(n.pad_spacing)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Con=Re({fn:U(),num_pins:Gn([we(6),we(8)]).default(8),w:U().default("3mm"),h:U().default("3mm"),p:U().default("0.5mm"),pl:U().default("0.52mm"),pw:U().default("0.35mm"),epw:U().default("1.40mm"),eph:U().default("1.60mm"),string:U().optional(),ep:vt().default(!1)}),Aon=n=>{n.string&&n.string.includes("_ep")&&(n.ep=!0);const e=n.string?.match(/^son_(\d+)/),t=e?Number.parseInt(e[1],10):n.num_pins||8,i=Con.parse({...n,num_pins:t}),r=st.parse(i.w),o=st.parse(i.h),s=st.parse(i.p),a=st.parse(i.pl),c=st.parse(i.pw),l=st.parse(i.epw),u=st.parse(i.eph),d=[];for(let T=0;T<i.num_pins;T++){const{x:N,y:R}=JHe(i.num_pins,T+1,r,s);d.push(sr(T+1,N,R,a,c))}i.ep&&d.push(sr(i.num_pins+1,0,0,l,u));const h=r,f=o,m={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-h/2,y:f/2},{x:h/2,y:f/2}],stroke_width:.05,pcb_silkscreen_path_id:""},y={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-h/2,y:-f/2},{x:h/2,y:-f/2}],stroke_width:.05,pcb_silkscreen_path_id:""},g=JHe(i.num_pins,1,h,s),b={x:g.x-.4,y:g.y},x={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:b.x-.4,y:b.y},{x:b.x-.7,y:b.y+.3},{x:b.x-.7,y:b.y-.3},{x:b.x-.4,y:b.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},w=Kr(0,f/2+.5,.3);return{circuitJson:[...d,m,y,w,x],parameters:i}},JHe=(n,e,t,i)=>{const r=n/2,o=(e-1)%r,s=e<=r?-1:1,a=(r-1)/2-o;return{x:s*st.parse("1.4mm"),y:a*i}},Ron=n=>{const{num_pins:e,bridged:t,p:i=2.54,pw:r=1.5,ph:o=1.5}=n,s=st.parse(i),a=st.parse(r),c=st.parse(o),l=Math.min(c/4,.5),u=[];for(let T=0;T<e;T++)u.push(sr(T+1,T*s,0,a,c));let d=[];if(t){const T=t.split("").map(Number);if(T.length>1)for(let N=0;N<T.length-1;N++){const R=T[N],k=T[N+1];if(typeof R=="number"&&typeof k=="number"&&!isNaN(R)&&!isNaN(k)){const M=(R-1)*s,I=(k-1)*s,C=Math.sign(I-M),$=M+C*(a/2),P=I-C*(a/2);d.push({type:"pcb_trace",pcb_trace_id:"",route:[{start_pcb_port_id:`{PIN${R}}`,x:$,y:0,width:l,layer:"top",route_type:"wire"},{end_pcb_port_id:`{PIN${k}}`,x:P,y:0,width:l,layer:"top",route_type:"wire"}]})}}}const h=(e-1)*s+a+.7,f=c+1,m=(e-1)*s/2,y=0,g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"outline",route:[{x:m-h/2,y:y-f/2},{x:m+h/2,y:y-f/2},{x:m+h/2,y:y+f/2},{x:m-h/2,y:y+f/2},{x:m-h/2,y:y-f/2}],stroke_width:.15},x=y+f/2+.6,w=Kr(m,x,.4);return{circuitJson:[...u,...d,g,w],parameters:n}},eVe=(n,e,t,i,r)=>({type:"pcb_smtpad",x:e,y:t,width:i,height:r,radius:r/2,layer:"top",shape:"pill",pcb_smtpad_id:"",port_hints:Array.isArray(n)?n.map(o=>o.toString()):[n.toString()]}),tVe={fn:we("sot457"),num_pins:we(6).default(6),pillh:U().default("0.45mm"),pillw:U().default("1.45mm"),pl:U(),pw:U(),p:U(),wave:vt().optional(),reflow:vt().optional()},Pon=Re({...tVe,h:U().default("2.5mm"),w:U().default("2.7mm"),pl:U().default("0.8mm"),pw:U().default("0.55mm"),p:U().default("0.95mm")}),Ion=Re({...tVe,h:U().default("3mm"),w:U().default("4mm"),pillr:U().default("0.225mm"),pl:U().default("1.45mm"),pw:U().default("1.5mm"),p:U().default("1.475mm")}).transform(n=>({...n,wave:n.wave??(n.reflow===void 0?!0:!n.reflow),reflow:n.reflow??(n.wave===void 0?!1:!n.wave)})),Sw=n=>Number.parseFloat(n.replace("mm","")),nVe=({pitch:n,width:e,pinNumber:t})=>{const o={1:{x:-e/2-.1,y:n},2:{x:-e/2-.1,y:0},3:{x:-e/2-.1,y:-n},4:{x:e/2+.1,y:-n},5:{x:e/2+.1,y:0},6:{x:e/2+.1,y:n}}[t];if(!o)throw new Error(`Invalid pin number: ${t}`);return o},iVe=n=>{const e=[],t=Sw(n.p),i=Sw(n.pl),r=Sw(n.pw),o=Sw(n.w),s=Sw(n.h);if(n.wave){const m={1:({padWidth:y,padHeight:g})=>sr(1,-t,t,g,y),2:({padWidth:y,padHeight:g})=>sr(2,-t,-t,g,y),3:({padWidth:y,padHeight:g})=>eVe(3,-t,0,Sw(n.pillw),Sw(n.pillh)),4:({padWidth:y,padHeight:g})=>eVe(4,t,0,Sw(n.pillw),Sw(n.pillh)),5:({padWidth:y,padHeight:g})=>sr(5,t,t,g,y),6:({padWidth:y,padHeight:g})=>sr(6,t,-t,g,y)};for(let y=1;y<=n.num_pins;y++){const g=m[y];g&&e.push(g({padWidth:i,padHeight:r}))}}else for(let m=1;m<=n.num_pins;m++){const{x:y,y:g}=nVe({pitch:t,width:o,pinNumber:m});e.push(sr(m,y,g,i,r))}const a={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-o/3,y:s/2+t/1.3},{x:o/3,y:s/2+t/1.3}],stroke_width:.05},c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-o/3,y:-s/2-t/1.3},{x:o/3,y:-s/2-t/1.3}],stroke_width:.05},l=Kr(0,s+.5,.3),u=nVe({pitch:t,width:o,pinNumber:1}),d=n.wave?1:.5,h=n.wave?.7:.3;u.x-=n.wave?r:r*1.7;const f={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:u.x+d/2,y:u.y},{x:u.x-d/2,y:u.y+h/2},{x:u.x-d/2,y:u.y-h/2},{x:u.x+d/2,y:u.y}],stroke_width:.05};return[l,a,c,f,...e]},Non=n=>{if(n.wave){const t=Ion.parse({...n,fn:"sot457"});return{circuitJson:iVe(t),parameters:t}}const e=Pon.parse(n);return{circuitJson:iVe(e),parameters:e}},kon=Re({fn:U(),num_pins:Gn([we(3),we(2)]).default(3),p:U().default("3.8mm"),id:U().default("1.25mm"),od:U().default("2.35mm"),ca:U().default("14mm").describe("Caliper axis (width or diameter of the potentiometer body or adjustment knob)"),w:U().default("5.35mm"),h:U().default("4mm"),string:U().optional()}),Oon=n=>{const{p:e,id:t,od:i,h:r,ca:o}=n,s=Number.parseFloat(r),a=Number.parseFloat(o);return[Os(1,0,a/4+.3,t,i),Os(2,s,0,t,i),Os(3,0,-a/4-.3,t,i)]},Don=n=>{const e=n.string?.match(/^potentiometer_(\d+)/),t=e?Number.parseInt(e[1],10):3,i=kon.parse({...n,num_pins:t});let r=[];i.num_pins===3&&(r=Oon(i));const o=Number.parseFloat(i.ca)/2+.15,s=Number.parseFloat(i.w),a=Number.parseFloat(i.od)/2+.35,c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:0,y:o-1.75},{x:0,y:o},{x:s,y:o},{x:s,y:a}],stroke_width:.1,pcb_silkscreen_path_id:""},l={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:s,y:-a},{x:s,y:-o},{x:0,y:-o},{x:0,y:-o+1.75}],stroke_width:.1,pcb_silkscreen_path_id:""},u=Number.parseFloat(i.w)/2,d=Kr(u,o+1,.5);return{circuitJson:[...r,c,l,d],parameters:i}},Lon=Re({fn:U(),p:st.optional().default("7.5mm"),id:st.optional().default("1mm"),od:st.optional().default("2mm"),d:st.optional().default("10.5mm")}),zon=(n,e,t,i,r)=>{const o=[],s=[];for(let a=0;a<=50;a++){const c=a/50*Math.PI,l=n+Math.cos(c)*t,u=e+Math.sin(c)*t;l<n-i&&u>=e-r/2&&u<=e+r/2||o.push({x:l,y:u})}for(let a=0;a<=50;a++){const c=Math.PI+a/50*Math.PI,l=n+Math.cos(c)*t,u=e+Math.sin(c)*t;l<n-i&&u>=e-r/2&&u<=e+r/2||s.push({x:l,y:u})}return{topArc:o,bottomArc:s}},Fon=n=>{const e=Lon.parse(n),{p:t,id:i,od:r,d:o}=e,s=[Os(1,-t/2,0,i,r),Os(2,t/2,0,i,r)],{topArc:a,bottomArc:c}=zon(0,0,o/2+.1,r/2,r),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:c,stroke_width:.1,pcb_silkscreen_path_id:""},d={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:0,y:o/2+.1},{x:0,y:-(o/2+.1)}],stroke_width:.1,pcb_silkscreen_path_id:""},h=-(o/2+.5),f=r/2+1.5,m=.5,y={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:h-m,y:f},{x:h+m,y:f}],stroke_width:.1,pcb_silkscreen_path_id:""},g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:h,y:f-m},{x:h,y:f+m}],stroke_width:.1,pcb_silkscreen_path_id:""},b=Kr(0,o/2+1,.5);return{circuitJson:[...s,l,u,d,y,g,b],parameters:e}},Bon=Re({fn:U(),num_pins:we(2).default(2),w:U().default("6.5mm"),h:U().default("3mm"),pl:U().default("1.75mm"),pw:U().default("2.40mm"),p:U().default("4.75mm")}),Uon=n=>{const e=Bon.parse(n),t=Kr(0,st.parse(e.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:st.parse(e.p)/2,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.3,y:st.parse(e.h)/2},{x:-st.parse(e.w)/2-.3,y:-st.parse(e.h)/2},{x:st.parse(e.p)/2,y:-st.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:jon(e).concat(i,t),parameters:e}},$on=n=>{const{pn:e,p:t}=n;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},jon=n=>{const e=[];for(let t=1;t<=n.num_pins;t++){const{x:i,y:r}=$on({pn:t,p:Number.parseFloat(n.p)});e.push(sr(t,i,r,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}return e},Hon=Re({fn:U(),num_pins:Fe().default(3),w:U().default("2.45mm"),h:U().default("2.40mm"),pl:U().default("0.45mm"),pw:U().default("0.70mm"),p:U().default("1mm"),string:U().optional()}),Von=n=>{const e=n.string?.match(/^sot323_(\d+)/),t=e?Number.parseInt(e[1],3):3,i=Hon.parse({...n,num_pins:t});if(i.num_pins===3)return{circuitJson:Gon(i),parameters:i};throw new Error("Invalid number of pins")},qon=n=>{const{pn:e,p:t}=n;return e===1?{x:-t,y:.65}:e===2?{x:-t,y:-.65}:{x:t,y:0}},Gon=n=>{const e=[];for(let a=0;a<n.num_pins;a++){const{x:c,y:l}=qon({num_pins:n.num_pins,pn:a+1,w:Number.parseFloat(n.w),h:Number.parseFloat(n.h),pl:Number.parseFloat(n.pl),p:Number.parseFloat(n.p)});e.push(sr(a+1,c,l,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=Kr(0,Number.parseInt(n.h)/2+1,.3),i=Number.parseFloat(n.w)/2-Number.parseFloat(n.pl),r=Number.parseFloat(n.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:r+.3},{x:i,y:r+.3},{x:i,y:r/2}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-r-.3},{x:i,y:-r-.3},{x:i,y:-r/2}],type:"pcb_silkscreen_path",stroke_width:.1};return[...e,o,s,t]},Yon=Re({fn:U(),circle:vt().optional(),rect:vt().optional(),square:vt().optional(),d:st.optional(),pd:st.optional(),diameter:st.optional(),r:st.optional(),pr:st.optional(),radius:st.optional(),w:st.optional(),pw:st.optional(),width:st.optional(),h:st.optional(),ph:st.optional(),height:st.optional(),s:st.optional(),size:st.optional(),string:U().optional()}).transform(n=>{let e="rect";n.circle&&(e="circle"),n.square&&(e="square"),n.rect&&(e="rect");let t,i,r;return e==="circle"?n.r!==void 0?t=Xu(n.r):n.pr!==void 0?t=Xu(n.pr):n.radius!==void 0?t=Xu(n.radius):n.d!==void 0?t=Xu(n.d)/2:n.pd!==void 0?t=Xu(n.pd)/2:n.diameter!==void 0?t=Xu(n.diameter)/2:t=Xu("1mm")/2:(n.w!==void 0?i=Xu(n.w):n.pw!==void 0?i=Xu(n.pw):n.width!==void 0?i=Xu(n.width):n.s!==void 0?i=Xu(n.s):n.size!==void 0?i=Xu(n.size):i=Xu("1mm"),n.h!==void 0?r=Xu(n.h):n.ph!==void 0?r=Xu(n.ph):n.height!==void 0?r=Xu(n.height):r=i),{fn:n.fn,shape:e,radius:t,width:i,height:r}}),Xon=n=>{const e=Yon.parse(n),{shape:t,radius:i,width:r,height:o}=e;return{circuitJson:[t==="circle"?BHe(1,{x:0,y:0,radius:i}):sr(1,0,0,r,o),Kr(0,t==="circle"?i+.5:o/2+.5,.2)],parameters:e}},Won=Re({fn:U(),d:st.optional(),hd:st.optional(),r:st.optional(),hr:st.optional(),pd:st.optional(),pr:st.optional(),squarepad:vt().optional().default(!1)}).transform(n=>{let e;n.d!==void 0?e=Xu(n.d):n.hd!==void 0?e=Xu(n.hd):n.r!==void 0?e=Xu(n.r)*2:n.hr!==void 0?e=Xu(n.hr)*2:e=Xu("1mm");let t;return n.pd!==void 0?t=Xu(n.pd):n.pr!==void 0?t=Xu(n.pr)*2:t=e*(1.5/1),{fn:n.fn,d:e,pd:t,squarepad:n.squarepad??!1}}),Zon=n=>{const e=Won.parse(n),{d:t,pd:i,squarepad:r}=e;return{circuitJson:[r?MU(1,0,0,t,i,i):Os(1,0,0,t,i),Kr(0,i/2+.5,.2)],parameters:e}},Kon=Re({fn:U(),num_pins:we(6).default(6),h:U().default("1.6mm"),pl:U().default("1mm"),pw:U().default("0.7mm"),p:U().default("0.95mm")}),Qon=n=>{const e=Kon.parse(n);return{circuitJson:Jon(e),parameters:e}},rVe=n=>{const{p:e,h:t,pn:i}=n;if(i===1)return{x:-t/2-.5,y:e};if(i===2)return{x:-t/2-.5,y:0};if(i===3)return{x:-t/2-.5,y:-e};if(i===4)return{x:t/2+.5,y:-e};if(i===5)return{x:t/2+.5,y:0};if(i===6)return{x:t/2+.5,y:e};throw new Error("Invalid pin number")},Jon=n=>{const e=[];for(let d=1;d<=n.num_pins;d++){const{x:h,y:f}=rVe({h:Number.parseFloat(n.h),p:Number.parseFloat(n.p),pn:d});e.push(sr(d,h,f,Number.parseFloat(n.pl),Number.parseFloat(n.pw)))}const t=n.num_pins/2*Number.parseFloat(n.p),i=Number.parseFloat(n.h),r={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-t/3,y:i/2+Number.parseFloat(n.p)/1.3},{x:t/3,y:i/2+Number.parseFloat(n.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-t/3,y:-i/2-Number.parseFloat(n.p)/1.3},{x:t/3,y:-i/2-Number.parseFloat(n.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},s=Kr(0,i+.3,.3),a=rVe({h:Number.parseFloat(n.h),p:Number.parseFloat(n.p),pn:1});a.x=a.x-Number.parseFloat(n.pw)*1.5;const c=.7,l=.3,u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:a.x+c/2,y:a.y},{x:a.x-c/2,y:a.y+l/2},{x:a.x-c/2,y:a.y-l/2},{x:a.x+c/2,y:a.y}],stroke_width:.05};return[...e,s,r,o,u]},esn=Re({fn:U()}),tsn=n=>{const e=esn.parse(n),t=[],i=.5-.15,r=1.5,s=.5/2,a=75,c=-37/2;for(let k=0;k<a;k++){const M=k+1;if(M>=24&&M<=31)continue;const I=c-k*s,C=k%2===0?0:-.5/2,$=r+(k%2===0?0:.25),P=sr(M,C,I,$,i);P.layer=M%2===0?"bottom":"top",t.push(P)}const l=46*.0254,u=137*.0254,d=261*.0254,h={type:"pcb_cutout",pcb_cutout_id:"",shape:"rect",center:{x:-u/2+r/2,y:c-d},width:u,height:l},f={x:-.5,y:c},m={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"};let y=1/0,g=-1/0,b=1/0,x=-1/0;const w=(k,M,I=0,C=0)=>{y=Math.min(y,k-I/2),g=Math.max(g,k+I/2),b=Math.min(b,M-C/2),x=Math.max(x,M+C/2)};for(const k of t)w(k.x,k.y,k.width,k.height);w(h.center.x,h.center.y,h.width,h.height);for(const k of m.route)w(k.x,k.y);const T=(y+g)/2,N=(b+x)/2,R=k=>{typeof k.x=="number"&&(k.x-=T),typeof k.y=="number"&&(k.y-=N),k.center&&(k.center.x-=T,k.center.y-=N),Array.isArray(k.route)&&(k.route=k.route.map(M=>({x:M.x-T,y:M.y-N})))};for(const k of t)R(k);return R(h),R(m),{circuitJson:[...t,h,m],parameters:e}};function nsn(n){return n!==null}var isn=(n,e)=>{if(!e)return n;const t=n.filter(u=>u.type==="pcb_smtpad"||u.type==="pcb_plated_hole"||u.type==="pcb_thtpad");if(t.length===0)return n;let i=1/0,r=-1/0,o=1/0,s=-1/0;const a=(u,d,h=0,f=0)=>{const m=u-h/2,y=u+h/2,g=d-f/2,b=d+f/2;i=Math.min(i,m),r=Math.max(r,y),o=Math.min(o,g),s=Math.max(s,b)};for(const u of t)if(u.type==="pcb_smtpad"){const d=u.shape==="circle"?u.radius*2:u.width,h=u.shape==="circle"?u.radius*2:u.height;a(u.x,u.y,d,h)}else if(u.type==="pcb_plated_hole"){const d=u.outer_diameter??u.hole_diameter;a(u.x,u.y,d,d)}else if(u.type==="pcb_thtpad"){const d=u.diameter;a(u.x,u.y,d,d)}let c=0,l=0;switch(e){case"center":c=(i+r)/2,l=(o+s)/2;break;case"bottomleft":c=i,l=o;break;case"bottomcenter":case"centerbottom":c=(i+r)/2,l=o;break;case"topcenter":case"centertop":c=(i+r)/2,l=s;break;case"leftcenter":case"centerleft":c=i,l=(o+s)/2;break;case"rightcenter":case"centerright":c=r,l=(o+s)/2;break;case"pin1":const u=t.find(d=>d.port_hints?.[0]==="1")||t[0];c=u.x,l=u.y;break}if(c===0&&l===0)return n;for(const u of t)u.x-=c,u.y-=l,u.center&&(u.center.x-=c,u.center.y-=l);return n},rsn=n=>{let e=PU();const i=n.replace(/^((?:\d{4}|\d{5}))(?=$|_)/,"res$1").split(/_(?!metric)/).map(r=>{const o=r.match(/([a-z]+)([\(\d\.\+\?].*)?/),[s,a,c]=o??[];return c?.includes("?")?null:{fn:a,v:c}}).filter(nsn);for(const{fn:r,v:o}of i)e=e[r](o);return e.setString(n),e},osn=()=>Object.keys(bw),PU=()=>{const n=new Proxy({},{get:(e,t)=>{if(t==="soup"||t==="circuitJson"){if("fn"in e&&bw[e.fn])return()=>{const{circuitJson:i}=bw[e.fn](e);return isn(i,e.origin)};if(!bw[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 "${t}"`)}}if(t==="json"){if(!bw[e.fn])throw new Error(`Invalid footprint function, got "${e.fn}"${e.string?`, from string "${e.string}"`:""}`);return()=>bw[e.fn](e).parameters}return t==="getFootprintNames"?()=>Object.keys(bw):t==="params"?()=>e:t==="setString"?i=>(e.string=i,n):i=>(Object.keys(e).length===0?`${t}${i}`in bw?(e[`${t}${i}`]=!0,e.fn=`${t}${i}`):(e[t]=!0,e.fn=t,t==="res"||t==="cap"?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(t)||(e[t]=i??!0),n)}});return n};PU.string=rsn,PU.getFootprintNames=osn;var ssn=PU,Tx=ep(Qhe()),oVe=Symbol("Fragment");function upe(n,e,...t){const i=t.length?t:e?.children!==void 0?[e.children]:[],r=[],o=(Array.isArray(i)?i:[i]).flat(1/0);for(const s of o)s==null||s===!1||(Array.isArray(s)?r.push(...s):r.push(s));return{type:n,props:(e&&e.children!==void 0?{...e,children:void 0}:e)||{},children:r}}var Ra=Symbol("Cuboid"),sVe=Symbol("Cube"),p4=Symbol("Cylinder"),aVe=Symbol("Sphere"),IU=Symbol("RoundedCuboid"),f4=Symbol("Translate"),fP=Symbol("Rotate"),cVe=Symbol("Union"),dpe=Symbol("Subtract"),NU=Symbol("Hull"),Ew=Symbol("Colorize"),mP=Symbol("Polygon"),_P=Symbol("ExtrudeLinear"),Km=oVe,Yn=(n,e,t)=>upe(n,e),Dp=(n,e,t)=>upe(n,e),FM=({center:n,width:e,length:t,height:i,heightAboveSurface:r=.15})=>Yn(Ew,{color:"#555",children:Yn(f4,{offset:n,children:Yn(f4,{offset:{x:0,y:0,z:i/2+r},children:Yn(IU,{roundRadius:.2,size:[e,t,i]})})})}),asn=n=>Array.from({length:n},(e,t)=>t);function hpe(n,e){if(n.length<2)throw new Error("Stroke must have at least two points");const t=Array.isArray(n[0])?n.map(([u,d])=>({x:u,y:d})):n,i=e/2,r=[],o=[];function s(u,d){const h=d.x-u.x,f=d.y-u.y,m=Math.sqrt(h*h+f*f);return{x:-f/m,y:h/m}}function a(u,d,h){const f={x:u.x+d.x*i*h,y:u.y+d.y*i*h};h>0?r.push(f):o.unshift(f)}const c=s(t[0],t[1]);a(t[0],c,1),a(t[0],c,-1);for(let u=1;u<t.length-1;u++){const d=t[u-1],h=t[u],f=t[u+1],m=s(d,h),y=s(h,f),g=m.x+y.x,b=m.y+y.y,x=Math.sqrt(g*g+b*b);if(x/2>2*i)a(h,m,1),a(h,y,1),a(h,m,-1),a(h,y,-1);else{const T=1/x;a(h,{x:g*T,y:b*T},1),a(h,{x:g*T,y:b*T},-1)}}const l=s(t[t.length-2],t[t.length-1]);return a(t[t.length-1],l,1),a(t[t.length-1],l,-1),[...r,...o]}var csn=n=>{const e=Math.min(...n.map(a=>a.x)),t=Math.max(...n.map(a=>a.x)),i=Math.min(...n.map(a=>a.y)),s=5.47/(Math.max(...n.map(a=>a.y))-i);return n.map(a=>({x:(a.x-e-(t-e)/2)*s,y:(a.y-i)*s}))},lsn=csn([{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}]),lVe=5.47,kU=.5,usn=({x:n,y:e,z:t})=>{const i=n>0;return Dp(Km,{children:[Yn(f4,{offset:{x:n+.25/2,y:e,z:t},children:Yn(fP,{rotation:["-90deg",0,"90deg"],children:Yn(_P,{height:.25,children:Yn(mP,{points:lsn.map(r=>[r.x,r.y])})})})}),Yn(f4,{offset:{x:n,y:e+(i?1:-1),z:t},children:Yn(fP,{rotation:["-90deg","90deg",i?"180deg":"0deg"],children:Yn(_P,{height:2,children:Yn(mP,{points:hpe([[0,0],[-1,0],[-1,-1]],.25).map(r=>[r.x,r.y])})})})})]})},dsn=({numPins:n=8,pitch:e=2.54,bodyWidth:t=6.4})=>{const i=Math.floor(n/2),r=t+1;return Dp(Km,{children:[asn(n).map(o=>{const s=o%i,a=(Math.floor(o/i)-.5)*2;return Yn(usn,{x:a*r/2,y:s*e-(i-1)/2*e,z:lVe/2+kU})}),Yn(FM,{width:t,length:i*e+.5,height:lVe-kU,heightAboveSurface:kU,center:{x:0,y:0,z:kU}})]})};function hsn(n,{height:e,padContactLength:t,curveLength:i,bodyDistance:r,steepness:o=10}){i||(i=r*.3);let s=r-t-i;s<0&&(i+=s,s=0);const a=t*.75,c=t+i+(r-t-i)*.25;if(n<=a)return 0;if(n>=c)return e;const l=(n-a)/(c-a);return e/(1+Math.exp(-o*(l-.5)))}var Mx=n=>{const{thickness:e,width:t,padContactLength:i,bodyDistance:r,height:o,rotation:s}=n,a=15,c=Array.from({length:a}).map((u,d)=>d/(a-1)*r).map(u=>[u,hsn(u,n)]),l=hpe(c,e);return Yn(Ew,{color:"#fff",children:Yn(f4,{offset:{z:0,y:0,x:0,...n.position},children:Yn(fP,{rotation:["90deg",0,s??0],children:Yn(f4,{offset:{x:0,y:0,z:-t/2},children:Yn(_P,{height:t,children:Yn(mP,{points:l.map(u=>[u.x,u.y])})})})})})})},psn=({pinCount:n,leadLength:e,leadWidth:t,pitch:i,bodyWidth:r})=>{const o=Math.ceil(n/2),s=i*n/2+t/2,a=(o-1)*i/2,c=.25;return Dp(Km,{children:[Array.from({length:o}).map((l,u)=>Yn(Mx,{position:{x:-r/2-e,y:u*i-a,z:c/2},width:t,thickness:c,padContactLength:e,bodyDistance:e+1,height:.8})),Array.from({length:o}).map((l,u)=>Yn(Mx,{rotation:Math.PI,position:{x:r/2+e,y:u*i-a,z:c/2},width:t,thickness:c,padContactLength:e,bodyDistance:e+1,height:.8})),Yn(FM,{center:{x:0,y:0,z:c/2},width:r-t-1,length:s,height:1.5})]})},ppe=1,fpe=.5,BM=.5,yP=.2,fsn=ppe-yP*2,uVe=({color:n="#333"})=>Dp(Km,{children:[Yn(Ra,{size:[fsn,fpe,BM],offset:[0,0,BM/2],color:n}),Yn(Ra,{size:[yP,BM,fpe],offset:[ppe/2-yP/2,0,BM/2],color:"#ccc"}),Yn(Ra,{size:[yP,BM,fpe],offset:[-ppe/2+yP/2,0,BM/2],color:"#ccc"})]}),mpe=1.6,msn=mpe-.3*2,OU=.3,_pe=.85,UM=.6,dVe=({color:n="#333"})=>Dp(Km,{children:[Yn(Ra,{size:[msn,_pe,UM],offset:[0,0,UM/2],color:n}),Yn(Ra,{size:[OU,_pe,UM],offset:[mpe/2-OU/2,0,UM/2],color:"#ccc"}),Yn(Ra,{size:[OU,_pe,UM],offset:[-mpe/2+OU/2,0,UM/2],color:"#ccc"})]}),ype=2,gpe=1.25,$M=.55,gP=.5,_sn=ype-gP*2,hVe=({color:n="#333"})=>Dp(Km,{children:[Yn(Ra,{size:[_sn,gpe,$M],offset:[0,0,$M/2],color:n}),Yn(Ra,{size:[gP,gpe,$M],offset:[ype/2-gP/2,0,$M/2],color:"#ccc"}),Yn(Ra,{size:[gP,gpe,$M],offset:[-ype/2+gP/2,0,$M/2],color:"#ccc"})]}),ysn=({pinCount:n,pitch:e,leadWidth:t,padContactLength:i,bodyWidth:r})=>{const o=n/4;e||(e=gsn(n,r)),i||(i=vsn(n)),t||(t=xsn(n,r)),r||(r=e*(o+4));const s=r,a=(o-1)*e/2,c=s+2*i,l=c,u=.8,d=.15,h=(l-r)/2;return Dp(Km,{children:[Array.from({length:o}).map((f,m)=>Yn(Mx,{position:{x:-l/2,y:m*e-a,z:d/2},width:t,thickness:d,padContactLength:i,bodyDistance:h,height:u})),Array.from({length:o}).map((f,m)=>Yn(Mx,{rotation:Math.PI,position:{x:l/2,y:m*e-a,z:d/2},width:t,thickness:d,padContactLength:i,bodyDistance:h,height:u})),Array.from({length:o}).map((f,m)=>Yn(Mx,{rotation:Math.PI/2,position:{x:m*e-a,y:-c/2,z:d/2},width:t,thickness:d,padContactLength:i,bodyDistance:h,height:u})),Array.from({length:o}).map((f,m)=>Yn(Mx,{rotation:-Math.PI/2,position:{x:m*e-a,y:c/2,z:d/2},width:t,thickness:d,padContactLength:i,bodyDistance:h,height:u})),Yn(FM,{center:{x:0,y:0,z:d/2},width:r,length:s,height:1.5})]})},gsn=(n,e)=>{switch(n){case 44:case 64:return .8;case 52:return e===14?1:.65;case 208:return .5;default:return .5}},vsn=n=>{switch(n){case 44:case 52:case 64:return 2.25;case 208:return 1.65;default:return 1}},xsn=(n,e)=>{switch(n){case 44:case 64:return .5;case 52:return e===14?.45:.55;case 208:return .3;default:return .25}},bsn=({numberOfPins:n,pitch:e=2.54,longSidePinLength:t=6})=>{const o=n*e,s=3,a=-((n-1)/2)*e;return Dp(Km,{children:[Yn(Ra,{color:"#222",size:[o,.63*3,2],center:[0,0,2/2]}),Array.from({length:n},(c,l)=>Dp(Km,{children:[Yn(Ew,{color:"gold",children:Dp(NU,{children:[Yn(Ra,{color:"gold",size:[.63,.63,s*.9],center:[a+l*e,0,2*.9+2/2]}),Yn(Ra,{color:"gold",size:[.63/1.8,.63/1.8,s],center:[a+l*e,0,2+2/2]})]})}),Yn(Ew,{color:"gold",children:Dp(NU,{children:[Yn(Ra,{color:"gold",size:[.63,.63,t*.9],center:[a+l*e,0,-t/2*.9]}),Yn(Ra,{color:"gold",size:[.63/1.8,.63/1.8,t],center:[a+l*e,0,-t/2]})]})})]}))]})},wsn=n=>{const e=["left","bottom","right","top"],{pin_count:t,pn:i,w:r,h:o,p:s,pl:a}=n,c=t/4,l=e[Math.floor((i-1)/c)],u=(i-1)%c,d=s*(c-1),h=s*(c-1),f=-a/2;switch(l){case"left":return{x:-r/2-f,y:h/2-u*s,o:"vert"};case"bottom":return{x:-d/2+u*s,y:-o/2-f,o:"horz"};case"right":return{x:r/2+f,y:-h/2+u*s,o:"vert"};case"top":return{x:d/2-u*s,y:o/2+f,o:"horz"};default:throw new Error("Invalid pin number")}},Ssn=({num_pins:n,cw:e,ccw:t,startingpin:i})=>{const r=[],o=n/4;let s=1;const a={};for(const c of i??[])a[c]=!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=o:a.bottomside&&a.leftpin?s=o+1:a.bottomside&&a.rightpin?s=o*2:a.rightside&&a.bottompin?s=o*2+1:a.rightside&&a.toppin?s=o*3:a.topside&&a.rightpin?s=o*3+1:a.topside&&a.leftpin&&(s=o*4),r.push(-1);for(let c=0;c<n;c++)r[s]=c+1,s++,s>n&&(s=1);return r},Esn=({num_pins:n=16,bodyWidth:e=9,bodyLength:t=9,bodyThickness:i=.8,thermalPadSize:r,padWidth:o=.25,padLength:s=.25,pitch:a=.5,thermalPadThickness:c=.05})=>{const l=Ssn({num_pins:n,cw:!0,ccw:!0}),u=[];for(let d=0;d<n;d++){const{x:h,y:f,o:m}=wsn({pin_count:n,pn:d+1,w:e,h:t,p:a,pl:s});let y=o,g=s;m==="vert"&&([y,g]=[g,y]);const b=l[d+1];u.push({pn:b,x:h,y:f,pw:y,pl:g})}return Dp(Km,{children:[Yn(Ew,{color:"grey",children:Yn(Ra,{center:{x:0,y:0,z:i/2},size:[e,t,i]})}),u.map((d,h)=>Yn(Ra,{center:{x:d.x,y:d.y,z:c/2},size:[d.pw,d.pl,c]})),r?.length!==void 0&&r?.width!==void 0&&Yn(Ra,{center:{x:0,y:0,z:c/2},size:[r.width,r.length,c]})]})},Tsn=Esn,Msn=()=>{const c=1.1999999999999997;return Dp(Km,{children:[Yn(Mx,{rotation:Math.PI,position:{x:2.8/2+c/4,y:-1,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:c,height:.95}),Yn(Mx,{rotation:Math.PI,position:{x:2.8/2+c/4,y:1,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:c,height:.95}),Yn(Mx,{position:{x:-2.8/2-c/4,y:0,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:c,height:.95}),Yn(Mx,{position:{x:-2.8/2-c/4,y:-1,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:c,height:.95}),Yn(Mx,{position:{x:-2.8/2-c/4,y:1,z:.15/2},width:.4,thickness:.15,padContactLength:.5,bodyDistance:c,height:.95}),Yn(FM,{center:{x:0,y:0,z:0},width:1.6,length:2.9,height:1.2})]})},Csn=Msn,vpe=.6,xpe=.3,jM=.33,vP=.1,Asn=vpe-vP*2,pVe=({color:n="#333"})=>Dp(Km,{children:[Yn(Ra,{size:[Asn,xpe,jM],offset:[0,0,jM/2],color:n}),Yn(Ra,{size:[vP,xpe,jM],offset:[vpe/2-vP/2,0,jM/2],color:"#ccc"}),Yn(Ra,{size:[vP,xpe,jM],offset:[-vpe/2+vP/2,0,jM/2],color:"#ccc"})]}),bpe=.4,wpe=.2,HM=.13,xP=.07,Rsn=bpe-xP*2,fVe=({color:n="#333"})=>Dp(Km,{children:[Yn(Ra,{size:[Rsn,wpe,HM],offset:[0,0,HM/2],color:n}),Yn(Ra,{size:[xP,wpe,HM],offset:[bpe/2-xP/2,0,HM/2],color:"#ccc"}),Yn(Ra,{size:[xP,wpe,HM],offset:[-bpe/2+xP/2,0,HM/2],color:"#ccc"})]}),Spe=3.2,Epe=1.6,VM=.9,bP=.5,Psn=Spe-bP*2,mVe=({color:n="#333"})=>Dp(Km,{children:[Yn(Ra,{size:[Psn,Epe,VM],offset:[0,0,VM/2],color:n}),Yn(Ra,{size:[bP,Epe,VM],offset:[Spe/2-bP/2,0,VM/2],color:"#ccc"}),Yn(Ra,{size:[bP,Epe,VM],offset:[-Spe/2+bP/2,0,VM/2],color:"#ccc"})]}),Tpe=3.2,Mpe=2.5,qM=1,wP=.6,Isn=Tpe-wP*2,_Ve=({color:n="#333"})=>Dp(Km,{children:[Yn(Ra,{size:[Isn,Mpe,qM],offset:[0,0,qM/2],color:n}),Yn(Ra,{size:[wP,Mpe,qM],offset:[Tpe/2-wP/2,0,qM/2],color:"#ccc"}),Yn(Ra,{size:[wP,Mpe,qM],offset:[-Tpe/2+wP/2,0,qM/2],color:"#ccc"})]}),Cpe=5,Ape=2.5,GM=1.4,SP=.6,Nsn=Cpe-SP*2,yVe=({color:n="#333"})=>Dp(Km,{children:[Yn(Ra,{size:[Nsn,Ape,GM],offset:[0,0,GM/2],color:n}),Yn(Ra,{size:[SP,Ape,GM],offset:[Cpe/2-SP/2,0,GM/2],color:"#ccc"}),Yn(Ra,{size:[SP,Ape,GM],offset:[-Cpe/2+SP/2,0,GM/2],color:"#ccc"})]}),Rpe=6.3,Ppe=3.2,YM=1.8,EP=.8,ksn=Rpe-EP*2,gVe=({color:n="#333"})=>Dp(Km,{children:[Yn(Ra,{size:[ksn,Ppe,YM],offset:[0,0,YM/2],color:n}),Yn(Ra,{size:[EP,Ppe,YM],offset:[Rpe/2-EP/2,0,YM/2],color:"#ccc"}),Yn(Ra,{size:[EP,Ppe,YM],offset:[-Rpe/2+EP/2,0,YM/2],color:"#ccc"})]}),Osn=({numberOfPins:n,pitch:e=2.54,legsLength:t=3,outerDiameter:i=.945,innerDiameter:r=.945})=>{const o=r/1.5,s=o*2+i,a=5,c=(n-1)*e+i+e/2,l=o*1.6,u=-((n-1)/2)*e,d=Yn(Ew,{color:"#1a1a1a",children:Dp(dpe,{children:[Yn(Ra,{color:"#000",size:[c,s,a],center:[0,0,a/2]}),Array.from({length:n},(h,f)=>r?Yn(p4,{height:a+.1,radius:r/2,center:[u+f*e,0,a/2],color:"#222"},f):Yn(Ra,{size:[l,l,a],center:[u+f*e,0,a/2]},f))]})});return Dp(Km,{children:[d,Array.from({length:n},(h,f)=>Dp(Ew,{color:"silver",children:[Dp(NU,{children:[Yn(Ra,{color:"silver",size:[o,o,t*.9],center:[u+f*e,0,-t/2*.9]}),Yn(Ra,{color:"silver",size:[o/1.8,o/1.8,t],center:[u+f*e,0,-t/2]})]}),Yn(Ra,{color:"silver",size:[l,l,l*.5],center:[u+f*e,0,l/2*.5]})]},f))]})},Dsn=({width:n,length:e,innerDiameter:t=1})=>{const i=n,r=e,o=n*.7,s=t/2.5;return Dp(Km,{children:[Yn(IU,{color:"#1a1a1f",center:[0,0,o/2],size:[r,r,o],roundRadius:.3}),Yn(IU,{color:"#f2f2f2",center:[0,0,o+o*.1/2.5],size:[r,r,o*.1],roundRadius:.14}),Yn(p4,{color:"#1a1a1f",height:o*.8,radius:i/3,center:[0,0,o+o*.8/2]}),Yn(p4,{color:"#1a1a1f",height:o*.2,radius:t/2,center:[r/3,r/3,o+o*.1/2]}),Yn(p4,{color:"#1a1a1f",height:o*.2,radius:t/2,center:[-r/3,-r/3,o+o*.1/2]}),Yn(p4,{color:"#1a1a1f",height:o*.2,radius:t/2,center:[-r/3,r/3,o+o*.1/2]}),Yn(p4,{color:"#1a1a1f",height:o*.2,radius:t/2,center:[r/3,-r/3,o+o*.1/2]}),Yn(DU,{thickness:t/3,width:s,horizontalLength:r*.8,verticalLength:o/2,position:{x:-i/2,y:-r/2,z:-o*1.2}}),Yn(DU,{thickness:t/3,width:s,horizontalLength:r*.8,verticalLength:o/2,position:{x:-i/2,y:r/2,z:-o*1.2},rotation:Math.PI}),Yn(DU,{thickness:t/3,width:s,horizontalLength:r*.8,verticalLength:o/2,position:{x:i/2,y:r/2,z:-o*1.2},rotation:Math.PI}),Yn(DU,{thickness:t/3,width:s,horizontalLength:r*.8,verticalLength:o/2,position:{x:i/2+t/3.6,y:-r/2,z:-o*1.2}})]})},DU=n=>{const{thickness:e,width:t,horizontalLength:i,verticalLength:r,rotation:o=0,position:s}=n,a=[[0,i],[-r/3,i/3],[-r/5,i/4],[0,0]],c=hpe(a,e);return Yn(Ew,{color:"#f2f2f2",children:Yn(f4,{offset:{x:s?.x||0,y:s?.y||0,z:s?.z||0},children:Yn(fP,{rotation:[0,55,o],children:Yn(_P,{height:t,children:Yn(mP,{points:c.map(l=>[l.y,l.x])})})})})})},Lsn=({pinCount:n,leadLength:e,leadWidth:t,pitch:i,bodyWidth:r})=>{const o=Math.ceil(n/2),s=(o-1)*i/2,a=.25,c=1,l=.8,u=e*0,d=i*(o-1)+t+.2,h=r*.55;return Dp(Km,{children:[Array.from({length:o}).map((f,m)=>Yn(Mx,{position:{x:-r/2-u,y:m*i-s,z:a/2},width:t,thickness:a,padContactLength:e/2,bodyDistance:e+.2,height:l})),Array.from({length:o}).map((f,m)=>Yn(Mx,{rotation:Math.PI,position:{x:r/2+u,y:m*i-s,z:a/2},width:t,thickness:a,padContactLength:e/2,bodyDistance:e+.2,height:l})),Yn(FM,{center:{x:0,y:0,z:a/2},width:h,length:d,height:c})]})},zsn=({pinCount:n,pitch:e,leadWidth:t,leadLength:i,bodyWidth:r,bodyLength:o})=>{const s=n===8?{pitch:.65,leadWidth:.3}:{pitch:.5,leadWidth:.225},a=isNaN(parseFloat(e))?s.pitch:parseFloat(e),c=isNaN(parseFloat(t))?s.leadWidth:parseFloat(t)*.8,l=isNaN(parseFloat(r))?2.6:parseFloat(r)*.8,u=isNaN(parseFloat(o))?2+Number(a)*1.4:parseFloat(o),d=n/2,h=(d-1)*a/2,f=.15,m=.8,y=4.5,g=(y-l)/2,b=g*.5;return Dp(Km,{children:[Array.from({length:d}).map((x,w)=>Yn(Mx,{position:{x:-y/2,y:h-w*a,z:f/2},width:c,thickness:f,padContactLength:b+.05,bodyDistance:g+.05,height:m})),Array.from({length:d}).map((x,w)=>Yn(Mx,{rotation:Math.PI,position:{x:y/2,y:h-w*a,z:f/2},width:c,thickness:f,padContactLength:b+.05,bodyDistance:g+.05,height:m})),Yn(FM,{center:{x:0,y:0,z:f/2},width:l,length:u,height:1})]})},Fsn=({footprint:n})=>{const e=ssn.string(n).json();switch(e.fn){case"dip":return Yn(dsn,{numPins:e.num_pins,pitch:e.p,bodyWidth:e.w});case"tssop":return Yn(psn,{pinCount:e.num_pins,leadLength:e.pl,leadWidth:e.pw,pitch:e.p,bodyWidth:e.w});case"vssop":return Yn(zsn,{pinCount:e.num_pins,leadLength:e.pl,leadWidth:e.pw,pitch:e.p,bodyWidth:e.w,bodyLength:e.h});case"qfp":return Yn(ysn,{pinCount:e.num_pins,pitch:e.p,leadWidth:e.pw,padContactLength:e.pl,bodyWidth:e.w});case"qfn":return Yn(Tsn,{num_pins:e.num_pins,bodyWidth:e.w,bodyLength:e.h,pitch:e.p,padLength:e.pl,padWidth:e.pw,thermalPadSize:{width:e.thermalpad.x,length:e.thermalpad.y}});case"pinrow":if(e.male)return Yn(bsn,{numberOfPins:e.num_pins,pitch:e.p});if(e.female)return Yn(Osn,{numberOfPins:e.num_pins,pitch:e.p});case"cap":switch(e.imperial){case"0402":return Yn(uVe,{color:"#856c4d"});case"0603":return Yn(dVe,{color:"#856c4d"});case"0805":return Yn(hVe,{color:"#856c4d"});case"0201":return Yn(pVe,{color:"#856c4d"});case"01005":return Yn(fVe,{color:"#856c4d"});case"1206":return Yn(mVe,{color:"#856c4d"});case"1210":return Yn(_Ve,{color:"#856c4d"});case"2010":return Yn(yVe,{color:"#856c4d"});case"2512":return Yn(gVe,{color:"#856c4d"})}case"sot235":return Yn(Csn,{});case"pushbutton":return Yn(Dsn,{width:e.w,length:e.h,innerDiameter:e.id});case"soic":return Yn(Lsn,{pinCount:e.num_pins,leadLength:e.pl,leadWidth:e.pw,pitch:e.p,bodyWidth:e.w})}switch(e.imperial){case"0402":return Yn(uVe,{});case"0603":return Yn(dVe,{});case"0805":return Yn(hVe,{});case"0201":return Yn(pVe,{});case"01005":return Yn(fVe,{});case"1206":return Yn(mVe,{});case"1210":return Yn(_Ve,{});case"2010":return Yn(yVe,{});case"2512":return Yn(gVe,{})}return null},Bsn=n=>n&&typeof n=="object"&&"type"in n,XM=n=>{if(typeof n=="number")return n;if(typeof n=="string"){const e=/^(-?\d+(?:\.\d+)?)\s*deg$/i.exec(n);if(e)return parseFloat(e[1])*Math.PI/180;const t=Number(n);if(!Number.isNaN(t))return t}return 0},Usn=n=>Array.isArray(n)?[Number(n[0])||0,Number(n[1])||0,Number(n[2])||0]:typeof n=="object"&&n?[Number(n.x)||0,Number(n.y)||0,Number(n.z)||0]:[0,0,0];function n3(n,e){if(n==null||n===!1)return[];if(Array.isArray(n))return n.flatMap(o=>n3(o,e));if(!Bsn(n))return[];const{type:t,props:i,children:r}=n;if(t===oVe)return(r??[]).flatMap(o=>n3(o,e));if(t===Ew){const o=i?.color;return(r??[]).flatMap(s=>n3(s,o??e))}if(t===f4){const o=Usn(i?.offset??{x:i?.x,y:i?.y,z:i?.z});return(r??[]).flatMap(a=>n3(a,e)).map(({geom:a,color:c})=>({geom:Tx.transforms.translate(o,a),color:c??e}))}if(t===fP){const o=Array.isArray(i?.rotation)?[XM(i.rotation[0]),XM(i.rotation[1]),XM(i.rotation[2])]:[XM(i?.x??0),XM(i?.y??0),XM(i?.z??0)];return(r??[]).flatMap(a=>n3(a,e)).map(({geom:a,color:c})=>({geom:Tx.transforms.rotateZ(o[2],Tx.transforms.rotateY(o[1],Tx.transforms.rotateX(o[0],a))),color:c}))}if(t===cVe||t===dpe||t===NU){const o=(r??[]).flatMap(a=>n3(a,e)).map(a=>a.geom);if(o.length===0)return[];let s;return t===cVe?s=Tx.booleans.union(o):t===dpe?s=Tx.booleans.subtract(o[0],o.slice(1)):s=Tx.hulls.hull(o),[{geom:s}]}if(t===mP){const o=i?.points??[];return[{geom:Tx.geometries.geom2.fromPoints(o),color:e??i?.color}]}if(t===_P){const o=(r??[]).flatMap(l=>n3(l,e)).map(l=>l.geom);if(o.length===0)return[];const s=o.length>1?Tx.booleans.union(o):o[0],a=i?.height??i?.h??1;return[{geom:Tx.extrusions.extrudeLinear({height:a},s),color:e??i?.color}]}if(t===Ra||t===sVe||t===p4||t===aVe||t===IU){let o;if(t===Ra){const s=i?.size??[1,1,1],a=i?.offset,c=i?.center??(a?[a[0],a[1],a[2]]:[0,0,0]);o=Tx.primitives.cuboid({size:s,center:c})}else if(t===sVe){const s=i?.size??1,a=i?.offset,c=i?.center??(a?[a[0],a[1],a[2]]:[0,0,0]);o=Tx.primitives.cube({size:s,center:c})}else if(t===p4){const s=i?.height??1,a=i?.radius??1,c=i?.center??[0,0,0];o=Tx.primitives.cylinder({height:s,radius:a,center:c})}else if(t===aVe){const s=i?.radius??1,a=i?.center??[0,0,0];o=Tx.primitives.sphere({radius:s,center:a})}else{const s=i?.size??[1,1,1],a=i?.roundRadius??.1,c=i?.center??[0,0,0];o=Tx.primitives.roundedCuboid({size:s,roundRadius:a,center:c})}return[{geom:o,color:e??i?.color}]}if(typeof t=="function"){const o=t(i??{});return n3(o,e)}return(r??[]).flatMap(o=>n3(o,e))}function $sn(n){return{geometries:n3(n)}}function vVe(n){if(n.polygons){const e=[],t=[],i=[];let r=0;for(const s of n.polygons){for(const c of s.vertices)c.index=r,e.push(c[0],c[1],c[2]),n.color&&n.color.length>=3?i.push(n.color[0],n.color[1],n.color[2]):i.push(1,1,1),r++;const a=s.vertices[0].index;for(let c=2;c<s.vertices.length;c++){const l=s.vertices[c-1].index,u=s.vertices[c].index;t.push(a,l,u)}}const o=new Ly;if(o.setAttribute("position",new um(new Float32Array(e),3)),o.setIndex(t),i.length>0&&o.setAttribute("color",new um(new Float32Array(i),3)),n.transforms){const s=new Ud;s.fromArray(n.transforms),o.applyMatrix4(s)}return o.computeVertexNormals(),o}if(n.sides){const e=[],t=[];for(const r of n.sides)e.push(r[0][0],r[0][1],0),n.color&&n.color.length>=3?t.push(n.color[0],n.color[1],n.color[2]):t.push(1,1,1);const i=new Ly;if(i.setAttribute("position",new um(new Float32Array(e),3)),t.length>0&&i.setAttribute("color",new um(new Float32Array(t),3)),n.transforms){const r=new Ud;r.fromArray(n.transforms),i.applyMatrix4(r)}return i}return console.error("Invalid CSG object: neither polygons nor sides found"),new Ly}function jsn(n){const e=upe(Fsn,{footprint:n});return $sn(e)}var Hsn=({jscadPlan:n,positionOffset:e,rotationOffset:t,onHover:i,onUnhover:r,isHovered:o})=>{const{rootObject:s}=Ex(),{threeGeom:a,material:c}=Ee.useMemo(()=>{const u=(0,GJt.executeJscadOperations)(YJt.default,n);if(!u||!u.polygons&&!u.sides)return{threeGeom:null,material:null};const d=vVe(u),h=new lw({vertexColors:!0,side:N1});return{threeGeom:d,material:h}},[n]),l=Ee.useMemo(()=>a?new kp(a,c):null,[a,c]);return Ee.useEffect(()=>{if(!(!l||!s))return s.add(l),()=>{s.remove(l)}},[s,l]),Ee.useEffect(()=>{l&&(e&&l.position.fromArray(e),t&&l.rotation.fromArray(t))},[l,e?.[0],e?.[1],e?.[2],t?.[0],t?.[1],t?.[2]]),Ee.useMemo(()=>{if(c)if(o){const u=new Ho(c.color.getHex());c.emissive.copy(u),c.emissive.setRGB(0,0,1),c.emissiveIntensity=.2}else c.emissiveIntensity=0},[o,c]),a?_e.jsx(SU,{isHovered:o,onHover:i,onUnhover:r,object:l}):null},Vsn=({positionOffset:n,footprint:e,rotationOffset:t,onHover:i,onUnhover:r,isHovered:o})=>{const{rootObject:s}=Ex(),a=Ee.useMemo(()=>{if(!e)return null;const{geometries:c}=jsn(e),l=new GS;for(const u of c.flat(1/0)){const d=u.geom;if(!d||!d.polygons&&!d.sides)continue;const h=new Ho(u.color);h.convertLinearToSRGB();const f={...d,color:[h.r,h.g,h.b]},m=vVe(f),y=new lw({vertexColors:!0,side:N1}),g=new kp(m,y);l.add(g)}return l},[e]);return Ee.useEffect(()=>{if(!(!a||!s))return s.add(a),()=>{s.remove(a)}},[s,a]),Ee.useEffect(()=>{a&&(n&&a.position.fromArray(n),t&&a.rotation.fromArray(t))},[a,n?.[0],n?.[1],n?.[2],t?.[0],t?.[1],t?.[2]]),Ee.useEffect(()=>{a&&a.traverse(c=>{c instanceof kp&&c.material instanceof lw&&(o?(c.material.emissive.setHex(255),c.material.emissiveIntensity=.2):c.material.emissiveIntensity=0)})},[o,a]),a?_e.jsx(SU,{isHovered:o,onHover:i,onUnhover:r,object:a}):null},qsn=(...n)=>n,xVe=({children:n,position:e,style:t})=>{const{camera:i,renderer:r}=Ex(),o=Ee.useRef(document.createElement("div")),[s,a]=Ee.useState(null);return Ee.useEffect(()=>{const c=r?.domElement.parentNode;if(c)return c.appendChild(o.current),a(sX.createPortal(n,o.current)),()=>{c.contains(o.current)&&c.removeChild(o.current)}},[r,n]),uP(()=>{if(!i||!o.current||!r)return;const c=new Jt(...e);c.project(i);const l=r.domElement.getBoundingClientRect(),u=Math.round((c.x+1)/2*l.width),d=Math.round((-c.y+1)/2*l.height);o.current.style.position="absolute",o.current.style.left=`${l.left+u}px`,o.current.style.top=`${l.top+d}px`,o.current.style.pointerEvents="none",t&&Object.assign(o.current.style,t)},[i,r,e,t]),s},bVe=({cad_component:n,circuitJson:e})=>{const[t,i]=Ee.useState(!1),[r,o]=Ee.useState(null),s=Ee.useCallback(h=>{h?.mousePosition?(i(!0),o(h.mousePosition)):(i(!1),o(null))},[]),a=Ee.useCallback(()=>{i(!1),o(null)},[]),c=Ee.useMemo(()=>Xs(e).source_component.getUsing({source_component_id:n.source_component_id})?.name,[e,n.source_component_id]),l=n.model_obj_url??n.model_stl_url,u=n.rotation?qsn(n.rotation.x*Math.PI/180,n.rotation.y*Math.PI/180,n.rotation.z*Math.PI/180):void 0;let d=null;return l?d=_e.jsx(qJt,{url:l,position:n.position?[n.position.x,n.position.y,n.position.z]:void 0,rotation:u,onHover:s,onUnhover:a,isHovered:t},n.cad_component_id):n.model_jscad?d=_e.jsx(Hsn,{jscadPlan:n.model_jscad,rotationOffset:u,onHover:s,onUnhover:a,isHovered:t},n.cad_component_id):n.footprinter_string&&(d=_e.jsx(Vsn,{positionOffset:n.position?[n.position.x,n.position.y,n.position.z]:void 0,rotationOffset:u,footprint:n.footprinter_string,onHover:s,onUnhover:a,isHovered:t})),_e.jsxs(_e.Fragment,{children:[d,t&&r?_e.jsx(xVe,{position:r,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:c??"<unknown>"}):null]})},wVe={version:"0.0.358"},wT=({children:n,parent:e,position:t,rotation:i,scale:r,color:o,fontSize:s,anchorX:a,anchorY:c,depthOffset:l})=>{const{rootObject:u}=Ex(),d=Ee.useMemo(()=>{const h=new OTe;return h.text=n,t&&h.position.fromArray(t),i&&h.rotation.fromArray(i),r&&h.scale.fromArray(r),h.color=o||"white",h.fontSize=s||1,h.anchorX=a||"center",h.anchorY=c||"middle",h.depthOffset=l||0,h.font=null,h.sync(),h},[n,t,i,r,o,s,a,c,l]);return Ee.useEffect(()=>{const h=e||u;if(!(!h||!d))return h.add(d),()=>{h.remove(d),d.dispose()}},[u,e,d]),null};typeof window<"u"&&(window.TSCI_MAIN_CAMERA_ROTATION=new r9(0,0,0));function Gsn(n,e){const t=new FS().setFromEuler(new r9(n.x,n.y,n.z)),i=new Jt(0,0,1);return i.applyQuaternion(t),i.multiplyScalar(e)}var Ysn=({})=>{const{camera:n,scene:e}=Ex();Ee.useEffect(()=>{if(!e)return;const i=new GEe(16777215,Math.PI/2);return e.add(i),()=>{e.remove(i)}},[e]),uP(()=>{if(!n)return;const i=window.TSCI_MAIN_CAMERA_ROTATION,r=Gsn(i,2);n.position.copy(r),n.lookAt(0,0,0)});const t=Ee.useMemo(()=>{const i=new GS;i.rotation.fromArray([Math.PI/2,0,0]);const r=new kp(new cw(1,1,1),new lw({color:"white"}));i.add(r);const o=new uK(new mbt(new cw(1,1,1)),new HA({color:0,linewidth:2}));return i.add(o),i},[]);return Ee.useEffect(()=>{if(e)return e.add(t),()=>{e.remove(t)}},[e,t]),_e.jsxs(_e.Fragment,{children:[_e.jsx(wT,{parent:t,position:[0,0,.51],fontSize:.25,color:"black",children:"Front"}),_e.jsx(wT,{parent:t,position:[0,0,-.51],fontSize:.25,color:"black",rotation:[0,Math.PI,0],children:"Back"}),_e.jsx(wT,{parent:t,position:[.51,0,0],fontSize:.25,color:"black",rotation:[0,Math.PI/2,0],children:"Right"}),_e.jsx(wT,{parent:t,position:[-.51,0,0],fontSize:.25,color:"black",rotation:[0,-Math.PI/2,0],children:"Left"}),_e.jsx(wT,{parent:t,position:[0,.51,0],fontSize:.25,color:"black",rotation:[-Math.PI/2,0,0],children:"Top"}),_e.jsx(wT,{parent:t,position:[0,-.51,0],fontSize:.25,color:"black",rotation:[Math.PI/2,0,0],children:"Bottom"})]})};function Xsn(n){n.querySelectorAll("canvas").forEach(e=>e.remove())}var SVe=Ee.forwardRef(({children:n,scene:e,camera:t,style:i},r)=>{const o=Ee.useRef(null),[s,a]=Ee.useState(null),c=Ee.useRef([]),l=Ee.useCallback(f=>{c.current.push(f)},[]),u=Ee.useCallback(f=>{c.current=c.current.filter(m=>m!==f)},[]),d=Ee.useMemo(()=>new fD,[]);e?.up&&d.up.set(e.up.x,e.up.y,e.up.z);const h=Ee.useRef(new k1);return Ee.useImperativeHandle(r,()=>h.current),Ee.useEffect(()=>{if(!o.current)return;Xsn(o.current);const f=new NEe({antialias:!0,alpha:!0});f.setSize(o.current.clientWidth,o.current.clientHeight),f.setPixelRatio(window.devicePixelRatio),o.current.appendChild(f.domElement);const m=new ub(75,o.current.clientWidth/o.current.clientHeight,.1,1e3);t?.up&&m.up.set(t.up[0],t.up[1],t.up[2]),t?.position&&m.position.set(t.position[0],t.position[1],t.position[2]),m.lookAt(0,0,0),d.add(h.current),window.__TSCIRCUIT_THREE_OBJECT=h.current,a({scene:d,camera:m,renderer:f,rootObject:h.current,addFrameListener:l,removeFrameListener:u});let y;const g=new Tbt,b=()=>{const w=g.getElapsedTime(),T=g.getDelta();c.current.forEach(N=>N(w,T)),f.render(d,m),y=requestAnimationFrame(b)};b();const x=()=>{o.current&&(m.aspect=o.current.clientWidth/o.current.clientHeight,m.updateProjectionMatrix(),f.setSize(o.current.clientWidth,o.current.clientHeight))};return window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x),cancelAnimationFrame(y),o.current&&f.domElement&&o.current.removeChild(f.domElement),f.dispose(),d.remove(h.current),window.__TSCIRCUIT_THREE_OBJECT===h.current&&(window.__TSCIRCUIT_THREE_OBJECT=void 0)}},[d,l,u]),_e.jsx("div",{ref:o,style:{width:"100%",height:"100%",...i},children:s&&_e.jsx(cHe.Provider,{value:s,children:_e.jsx(jJt,{children:n})})})}),Wsn=({autoRotate:n,autoRotateSpeed:e,onStart:t,panSpeed:i,rotateSpeed:r,zoomSpeed:o,enableDamping:s,dampingFactor:a})=>{const{camera:c,renderer:l}=Ex(),u=Ee.useMemo(()=>!c||!l?null:new d2t(c,l.domElement),[c,l]);return Ee.useEffect(()=>{u&&(u.autoRotate=n||!1,u.autoRotateSpeed=e||1,i!==void 0&&(u.panSpeed=i),r!==void 0&&(u.rotateSpeed=r),o!==void 0&&(u.zoomSpeed=o),s!==void 0&&(u.enableDamping=s),a!==void 0&&(u.dampingFactor=a))},[u,n,e,i,r,o,s,a]),Ee.useEffect(()=>{if(!(!u||!t))return u.addEventListener("start",t),()=>{u.removeEventListener("start",t)}},[u,t]),Ee.useEffect(()=>{if(u)return()=>{u.dispose()}},[u]),uP(()=>{u?.update()},[u]),null},Zsn=`
5072
5072
  varying vec3 worldPosition;
5073
5073
  void main() {
5074
5074
  worldPosition = (modelMatrix * vec4(position, 1.0)).xyz;
@@ -5598,7 +5598,7 @@ $1`).replace(/>(\s*)(?=<!--\s*\/)/g,"> ")}}}),TZe={};Vgn(TZe,{all_layers:()=>dme
5598
5598
  * Copyright (c) 2013-2015, 2017, Jon Schlinkert.
5599
5599
  * Released under the MIT License.
5600
5600
  *)
5601
- */const dbn=({containerClassName:n,...e})=>{const t=Ee.useRef(null),[i,r]=Ee.useState(620);return Ee.useLayoutEffect(()=>{const o=()=>{if(t.current){const a=t.current.clientHeight,c=window.innerHeight;r(Math.min(Math.max(a,620),c))}};o();const s=new ResizeObserver(o);return t.current&&s.observe(t.current),window.addEventListener("resize",o),()=>{s.disconnect(),window.removeEventListener("resize",o)}},[]),_e.jsx("div",{ref:t,className:n||"rf-w-full rf-h-full",children:_e.jsx(ubn,{...e,height:i})})},hbn='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--radius:0.5rem}.rf-pointer-events-none{pointer-events:none}.rf-invisible{visibility:hidden}.rf-fixed{position:fixed}.rf-absolute{position:absolute}.rf-relative{position:relative}.rf-inset-0{inset:0}.-rf-left-2{left:-.5rem}.-rf-right-10{right:-2.5rem}.-rf-right-2{right:-.5rem}.-rf-right-4{right:-1rem}.-rf-right-6{right:-1.5rem}.-rf-right-7{right:-1.75rem}.-rf-right-8{right:-2rem}.-rf-right-9{right:-2.25rem}.rf-bottom-full{bottom:100%}.rf-left-0{left:0}.rf-left-1{left:.25rem}.rf-left-1\\/2{left:50%}.rf-left-2{left:.5rem}.rf-left-\\[50\\%\\]{left:50%}.rf-right-0{right:0}.rf-right-1{right:.25rem}.rf-right-4{right:1rem}.rf-right-\\[4px\\]{right:4px}.rf-top-0{top:0}.rf-top-1{top:.25rem}.rf-top-2{top:.5rem}.rf-top-2\\.5{top:.625rem}.rf-top-\\[50\\%\\]{top:50%}.rf-top-\\[6px\\]{top:6px}.\\!rf-z-\\[101\\]{z-index:101!important}.rf-z-10{z-index:10}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.rf-order-1{order:1}.rf-order-2{order:2}.rf-order-3{order:3}.rf-m-1{margin:.25rem}.rf-m-6{margin:1.5rem}.-rf-mx-1,.rf--mx-1{margin-left:-.25rem;margin-right:-.25rem}.rf-mx-1{margin-left:.25rem;margin-right:.25rem}.rf-mx-2{margin-left:.5rem;margin-right:.5rem}.rf-mx-4{margin-left:1rem;margin-right:1rem}.rf-mx-auto{margin-left:auto;margin-right:auto}.rf-my-1{margin-bottom:.25rem;margin-top:.25rem}.rf-my-12{margin-bottom:3rem;margin-top:3rem}.rf-my-4{margin-bottom:1rem;margin-top:1rem}.rf-my-auto{margin-bottom:auto;margin-top:auto}.rf-mb-1{margin-bottom:.25rem}.rf-mb-12{margin-bottom:3rem}.rf-mb-2{margin-bottom:.5rem}.rf-mb-3{margin-bottom:.75rem}.rf-mb-4{margin-bottom:1rem}.rf-mb-6{margin-bottom:1.5rem}.rf-mb-8{margin-bottom:2rem}.rf-ml-1{margin-left:.25rem}.rf-ml-2{margin-left:.5rem}.rf-ml-auto{margin-left:auto}.rf-mr-1{margin-right:.25rem}.rf-mr-2{margin-right:.5rem}.rf-mt-0{margin-top:0}.rf-mt-0\\.5{margin-top:.125rem}.rf-mt-1{margin-top:.25rem}.rf-mt-2{margin-top:.5rem}.rf-mt-3{margin-top:.75rem}.rf-mt-4{margin-top:1rem}.rf-mt-5{margin-top:1.25rem}.rf-mt-auto{margin-top:auto}.rf-block{display:block}.rf-inline-block{display:inline-block}.rf-inline{display:inline}.rf-flex{display:flex}.rf-inline-flex{display:inline-flex}.rf-grid{display:grid}.rf-hidden{display:none}.rf-aspect-square{aspect-ratio:1/1}.rf-aspect-video{aspect-ratio:16/9}.rf-size-14{height:3.5rem;width:3.5rem}.rf-size-4{height:1rem;width:1rem}.\\!rf-h-2{height:.5rem!important}.\\!rf-h-2\\.5{height:.625rem!important}.\\!rf-h-3{height:.75rem!important}.\\!rf-h-full{height:100%!important}.rf-h-1{height:.25rem}.rf-h-10{height:2.5rem}.rf-h-12{height:3rem}.rf-h-2{height:.5rem}.rf-h-2\\.5{height:.625rem}.rf-h-24{height:6rem}.rf-h-3{height:.75rem}.rf-h-3\\.5{height:.875rem}.rf-h-4{height:1rem}.rf-h-5{height:1.25rem}.rf-h-6{height:1.5rem}.rf-h-60{height:15rem}.rf-h-64{height:16rem}.rf-h-7{height:1.75rem}.rf-h-8{height:2rem}.rf-h-9{height:2.25rem}.rf-h-\\[400px\\]{height:400px}.rf-h-\\[calc\\(100vh-52px\\)\\]{height:calc(100vh - 52px)}.rf-h-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.rf-h-auto{height:auto}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.rf-h-screen{height:100vh}.\\!rf-max-h-\\[40vh\\]{max-height:40vh!important}.rf-max-h-32{max-height:8rem}.rf-max-h-96{max-height:24rem}.rf-max-h-\\[200px\\]{max-height:200px}.rf-max-h-\\[300px\\]{max-height:300px}.rf-max-h-\\[500px\\]{max-height:500px}.rf-max-h-\\[90vh\\]{max-height:90vh}.rf-max-h-full{max-height:100%}.rf-min-h-0{min-height:0}.rf-min-h-\\[200px\\]{min-height:200px}.rf-min-h-\\[300px\\]{min-height:300px}.rf-min-h-\\[620px\\]{min-height:620px}.rf-min-h-\\[calc\\(100vh-240px\\)\\]{min-height:calc(100vh - 240px)}.\\!rf-w-2{width:.5rem!important}.\\!rf-w-2\\.5{width:.625rem!important}.rf-w-1{width:.25rem}.rf-w-1\\/2{width:50%}.rf-w-11{width:2.75rem}.rf-w-11\\/12{width:91.666667%}.rf-w-12{width:3rem}.rf-w-16{width:4rem}.rf-w-2{width:.5rem}.rf-w-2\\.5{width:.625rem}.rf-w-20{width:5rem}.rf-w-24{width:6rem}.rf-w-28{width:7rem}.rf-w-3{width:.75rem}.rf-w-3\\.5{width:.875rem}.rf-w-32{width:8rem}.rf-w-4{width:1rem}.rf-w-40{width:10rem}.rf-w-48{width:12rem}.rf-w-5{width:1.25rem}.rf-w-6{width:1.5rem}.rf-w-64{width:16rem}.rf-w-72{width:18rem}.rf-w-8{width:2rem}.rf-w-9{width:2.25rem}.rf-w-96{width:24rem}.rf-w-\\[95\\%\\]{width:95%}.rf-w-fit{width:-moz-fit-content;width:fit-content}.rf-w-full{width:100%}.rf-w-screen{width:100vw}.rf-min-w-0{min-width:0}.rf-min-w-10{min-width:2.5rem}.rf-min-w-16{min-width:4rem}.rf-min-w-\\[148px\\]{min-width:148px}.rf-min-w-\\[8rem\\]{min-width:8rem}.rf-min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.\\!rf-max-w-\\[660px\\]{max-width:660px!important}.rf-max-w-2xl{max-width:42rem}.rf-max-w-3xl{max-width:48rem}.rf-max-w-4xl{max-width:56rem}.rf-max-w-5xl{max-width:64rem}.rf-max-w-full{max-width:100%}.rf-max-w-lg{max-width:32rem}.rf-max-w-md{max-width:28rem}.rf-max-w-none{max-width:none}.rf-max-w-xl{max-width:36rem}.rf-max-w-xs{max-width:20rem}.rf-flex-1{flex:1 1 0%}.rf-flex-shrink-0,.rf-shrink-0{flex-shrink:0}.rf-flex-grow{flex-grow:1}.rf-table-auto{table-layout:auto}.rf-origin-\\[--radix-popover-content-transform-origin\\]{transform-origin:var(--radix-popover-content-transform-origin)}.-rf-translate-x-1{--tw-translate-x:-0.25rem}.-rf-translate-x-1,.-rf-translate-x-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rf-translate-x-1\\/2{--tw-translate-x:-50%}.-rf-translate-y-1{--tw-translate-y:-0.25rem}.-rf-translate-y-1,.rf--translate-x-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-x-1{--tw-translate-x:-0.25rem}.rf--translate-x-1\\/2{--tw-translate-x:-50%}.rf--translate-x-1\\/2,.rf--translate-y-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-y-1{--tw-translate-y:-0.25rem}.rf-translate-x-\\[-50\\%\\]{--tw-translate-x:-50%}.rf-translate-x-\\[-50\\%\\],.rf-translate-y-\\[-50\\%\\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf-translate-y-\\[-50\\%\\]{--tw-translate-y:-50%}.rf-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes rf-pulse{50%{opacity:.5}}.rf-animate-pulse{animation:rf-pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes rf-spin{to{transform:rotate(1turn)}}.rf-animate-spin{animation:rf-spin 1s linear infinite}.rf-cursor-default{cursor:default}.rf-cursor-not-allowed{cursor:not-allowed}.rf-cursor-pointer{cursor:pointer}.rf-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.rf-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.rf-flex-row{flex-direction:row}.rf-flex-col{flex-direction:column}.rf-flex-col-reverse{flex-direction:column-reverse}.rf-flex-wrap{flex-wrap:wrap}.rf-place-items-center{place-items:center}.rf-items-start{align-items:flex-start}.rf-items-end{align-items:flex-end}.rf-items-center{align-items:center}.rf-items-stretch{align-items:stretch}.rf-justify-end{justify-content:flex-end}.rf-justify-center{justify-content:center}.rf-justify-between{justify-content:space-between}.rf-gap-0{gap:0}.rf-gap-1{gap:.25rem}.rf-gap-2{gap:.5rem}.rf-gap-3{gap:.75rem}.rf-gap-4{gap:1rem}.rf-gap-5{gap:1.25rem}.rf-gap-6{gap:1.5rem}.rf-gap-8{gap:2rem}.rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.rf-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.rf-divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.rf-overflow-auto{overflow:auto}.rf-overflow-hidden{overflow:hidden}.rf-overflow-visible{overflow:visible}.rf-overflow-x-auto{overflow-x:auto}.\\!rf-overflow-y-auto{overflow-y:auto!important}.rf-overflow-y-auto{overflow-y:auto}.rf-overflow-x-hidden{overflow-x:hidden}.rf-overflow-x-clip{overflow-x:clip}.rf-truncate{overflow:hidden;text-overflow:ellipsis}.rf-truncate,.rf-whitespace-nowrap{white-space:nowrap}.rf-whitespace-pre-wrap{white-space:pre-wrap}.rf-break-words{overflow-wrap:break-word}.rf-rounded{border-radius:.25rem}.rf-rounded-2xl{border-radius:1rem}.rf-rounded-full{border-radius:9999px}.rf-rounded-lg{border-radius:var(--radius)}.rf-rounded-md{border-radius:calc(var(--radius) - 2px)}.rf-rounded-sm{border-radius:calc(var(--radius) - 4px)}.rf-rounded-xl{border-radius:.75rem}.rf-border{border-width:1px}.rf-border-2{border-width:2px}.rf-border-b{border-bottom-width:1px}.rf-border-t{border-top-width:1px}.rf-border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}.rf-border-blue-400{--tw-border-opacity:1;border-color:rgb(96 165 250/var(--tw-border-opacity,1))}.rf-border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.rf-border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.rf-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.rf-border-green-200{--tw-border-opacity:1;border-color:rgb(187 247 208/var(--tw-border-opacity,1))}.rf-border-input{border-color:hsl(var(--input))}.rf-border-neutral-200{--tw-border-opacity:1;border-color:rgb(229 229 229/var(--tw-border-opacity,1))}.rf-border-orange-200{--tw-border-opacity:1;border-color:rgb(254 215 170/var(--tw-border-opacity,1))}.rf-border-primary{border-color:hsl(var(--primary))}.rf-border-red-200{--tw-border-opacity:1;border-color:rgb(254 202 202/var(--tw-border-opacity,1))}.rf-border-red-400{--tw-border-opacity:1;border-color:rgb(248 113 113/var(--tw-border-opacity,1))}.rf-border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.rf-border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity,1))}.rf-border-zinc-900{--tw-border-opacity:1;border-color:rgb(24 24 27/var(--tw-border-opacity,1))}.rf-bg-background{background-color:hsl(var(--background))}.rf-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.rf-bg-black\\/80{background-color:rgba(0,0,0,.8)}.rf-bg-blue-100{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity,1))}.rf-bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.rf-bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.rf-bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.rf-bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.rf-bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.rf-bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity,1))}.rf-bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}.rf-bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.rf-bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.rf-bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.rf-bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.rf-bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.rf-bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity,1))}.rf-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.rf-bg-muted{background-color:hsl(var(--muted))}.rf-bg-neutral-100{--tw-bg-opacity:1;background-color:rgb(245 245 245/var(--tw-bg-opacity,1))}.rf-bg-neutral-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38/var(--tw-bg-opacity,1))}.rf-bg-neutral-900{--tw-bg-opacity:1;background-color:rgb(23 23 23/var(--tw-bg-opacity,1))}.rf-bg-orange-400{--tw-bg-opacity:1;background-color:rgb(251 146 60/var(--tw-bg-opacity,1))}.rf-bg-orange-50{--tw-bg-opacity:1;background-color:rgb(255 247 237/var(--tw-bg-opacity,1))}.rf-bg-popover{background-color:hsl(var(--popover))}.rf-bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.rf-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.rf-bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.rf-bg-red-900{--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.rf-bg-transparent{background-color:transparent}.rf-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.rf-bg-yellow-100{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity,1))}.rf-bg-zinc-100{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.rf-bg-zinc-200{--tw-bg-opacity:1;background-color:rgb(228 228 231/var(--tw-bg-opacity,1))}.rf-bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-zinc-800{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.rf-bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.rf-bg-opacity-50{--tw-bg-opacity:0.5}.rf-fill-current{fill:currentColor}.rf-object-contain{-o-object-fit:contain;object-fit:contain}.rf-object-cover{-o-object-fit:cover;object-fit:cover}.\\!rf-p-0{padding:0!important}.rf-p-0{padding:0}.rf-p-1{padding:.25rem}.rf-p-2{padding:.5rem}.rf-p-3{padding:.75rem}.rf-p-4{padding:1rem}.rf-p-5{padding:1.25rem}.rf-p-6{padding:1.5rem}.rf-p-8{padding:2rem}.rf-px-1{padding-left:.25rem;padding-right:.25rem}.rf-px-2{padding-left:.5rem;padding-right:.5rem}.rf-px-3{padding-left:.75rem;padding-right:.75rem}.rf-px-4{padding-left:1rem;padding-right:1rem}.rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.rf-px-8{padding-left:2rem;padding-right:2rem}.rf-py-0{padding-bottom:0;padding-top:0}.rf-py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.rf-py-1{padding-bottom:.25rem;padding-top:.25rem}.rf-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.rf-py-10{padding-bottom:2.5rem;padding-top:2.5rem}.rf-py-12{padding-bottom:3rem;padding-top:3rem}.rf-py-2{padding-bottom:.5rem;padding-top:.5rem}.rf-py-3{padding-bottom:.75rem;padding-top:.75rem}.rf-py-4{padding-bottom:1rem;padding-top:1rem}.rf-py-6{padding-bottom:1.5rem;padding-top:1.5rem}.rf-py-8{padding-bottom:2rem;padding-top:2rem}.rf-pb-0{padding-bottom:0}.rf-pb-2{padding-bottom:.5rem}.rf-pb-3{padding-bottom:.75rem}.rf-pb-4{padding-bottom:1rem}.rf-pl-2{padding-left:.5rem}.rf-pl-4{padding-left:1rem}.rf-pl-8{padding-left:2rem}.rf-pr-2{padding-right:.5rem}.rf-pt-0{padding-top:0}.rf-pt-2{padding-top:.5rem}.rf-pt-4{padding-top:1rem}.rf-text-left{text-align:left}.rf-text-center{text-align:center}.rf-text-right{text-align:right}.rf-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.rf-text-2xl{font-size:1.5rem;line-height:2rem}.rf-text-3xl{font-size:1.875rem;line-height:2.25rem}.rf-text-\\[8px\\]{font-size:8px}.rf-text-base{font-size:1rem;line-height:1.5rem}.rf-text-lg{font-size:1.125rem;line-height:1.75rem}.rf-text-sm{font-size:.875rem;line-height:1.25rem}.rf-text-xl{font-size:1.25rem;line-height:1.75rem}.rf-text-xs{font-size:.75rem;line-height:1rem}.\\!rf-font-normal{font-weight:400!important}.rf-font-bold{font-weight:700}.rf-font-medium{font-weight:500}.rf-font-semibold{font-weight:600}.rf-uppercase{text-transform:uppercase}.rf-capitalize{text-transform:capitalize}.rf-tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.rf-leading-5{line-height:1.25rem}.rf-leading-none{line-height:1}.rf-leading-relaxed{line-height:1.625}.rf-leading-tight{line-height:1.25}.rf-tracking-wide{letter-spacing:.025em}.rf-tracking-widest{letter-spacing:.1em}.rf-text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.rf-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.rf-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.rf-text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.rf-text-blue-800{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.rf-text-blue-900{--tw-text-opacity:1;color:rgb(30 58 138/var(--tw-text-opacity,1))}.rf-text-current{color:currentColor}.rf-text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.rf-text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.rf-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.rf-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.rf-text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.rf-text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}.rf-text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.rf-text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.rf-text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity,1))}.rf-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.rf-text-green-800{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity,1))}.rf-text-green-900{--tw-text-opacity:1;color:rgb(20 83 45/var(--tw-text-opacity,1))}.rf-text-muted-foreground{color:hsl(var(--muted-foreground))}.rf-text-neutral-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-neutral-500{--tw-text-opacity:1;color:rgb(115 115 115/var(--tw-text-opacity,1))}.rf-text-neutral-900{--tw-text-opacity:1;color:rgb(23 23 23/var(--tw-text-opacity,1))}.rf-text-neutral-950{--tw-text-opacity:1;color:rgb(10 10 10/var(--tw-text-opacity,1))}.rf-text-orange-500{--tw-text-opacity:1;color:rgb(249 115 22/var(--tw-text-opacity,1))}.rf-text-orange-600{--tw-text-opacity:1;color:rgb(234 88 12/var(--tw-text-opacity,1))}.rf-text-orange-800{--tw-text-opacity:1;color:rgb(154 52 18/var(--tw-text-opacity,1))}.rf-text-popover-foreground{color:hsl(var(--popover-foreground))}.rf-text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.rf-text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.rf-text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.rf-text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.rf-text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.rf-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.rf-text-red-800{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity,1))}.rf-text-red-900{--tw-text-opacity:1;color:rgb(127 29 29/var(--tw-text-opacity,1))}.rf-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.rf-text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}.rf-text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity,1))}.rf-text-yellow-900{--tw-text-opacity:1;color:rgb(113 63 18/var(--tw-text-opacity,1))}.rf-text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.rf-text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.rf-text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.rf-text-zinc-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.rf-text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.rf-text-zinc-950{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.rf-underline{text-decoration-line:underline}.rf-line-through{text-decoration-line:line-through}.rf-underline-offset-4{text-underline-offset:4px}.rf-opacity-0{opacity:0}.rf-opacity-100{opacity:1}.rf-opacity-25{opacity:.25}.rf-opacity-30{opacity:.3}.rf-opacity-50{opacity:.5}.rf-opacity-60{opacity:.6}.rf-opacity-75{opacity:.75}.rf-shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.rf-shadow,.rf-shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.rf-shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.rf-shadow-md,.rf-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.rf-outline-none{outline:2px solid transparent;outline-offset:2px}.rf-ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.rf-ring-blue-500{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.rf-ring-primary{--tw-ring-color:hsl(var(--primary))}.rf-ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.rf-ring-offset-white{--tw-ring-offset-color:#fff}.rf-transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-duration-200{transition-duration:.2s}.rf-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.rf-slide-in-from-left-1{--tw-enter-translate-x:-0.25rem}.rf-slide-out-to-left-1{--tw-exit-translate-x:-0.25rem}.rf-duration-200{animation-duration:.2s}.rf-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.file\\:rf-border-0::file-selector-button{border-width:0}.file\\:rf-bg-transparent::file-selector-button{background-color:transparent}.file\\:rf-text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\\:rf-font-medium::file-selector-button{font-weight:500}.placeholder\\:rf-text-zinc-500::-moz-placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.placeholder\\:rf-text-zinc-500::placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.hover\\:rf-border-blue-300:hover{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.hover\\:\\!rf-bg-transparent:hover{background-color:transparent!important}.hover\\:rf-bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-500\\/90:hover{background-color:rgba(239,68,68,.9)}.hover\\:rf-bg-zinc-100:hover{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100\\/80:hover{background-color:hsla(240,5%,96%,.8)}.hover\\:rf-bg-zinc-900\\/90:hover{background-color:rgba(24,24,27,.9)}.hover\\:rf-text-red-400:hover{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.hover\\:rf-text-zinc-900:hover{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.hover\\:rf-underline:hover{text-decoration-line:underline}.focus\\:rf-bg-gray-100:focus{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.focus\\:rf-bg-zinc-100:focus{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.focus\\:rf-text-gray-900:focus{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.focus\\:rf-text-zinc-900:focus{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.focus\\:rf-outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:rf-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:rf-ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\\:rf-ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:rf-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:rf-ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-zinc-950:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(9 9 11/var(--tw-ring-opacity,1))}.focus-visible\\:rf-ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.disabled\\:rf-pointer-events-none:disabled{pointer-events:none}.disabled\\:rf-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:rf-opacity-50:disabled{opacity:.5}.rf-group\\/bar:hover .group-hover\\/bar\\:rf-opacity-100{opacity:1}.data-\\[disabled\\=true\\]\\:rf-pointer-events-none[data-disabled=true],.data-\\[disabled\\]\\:rf-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom]{--tw-translate-y:0.25rem}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom],.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{--tw-translate-x:-0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right]{--tw-translate-x:0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right],.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{--tw-translate-y:-0.25rem}.data-\\[selected\\=true\\]\\:rf-bg-zinc-100[data-selected=true]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[state\\=active\\]\\:rf-bg-white[data-state=active]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.data-\\[state\\=checked\\]\\:rf-bg-zinc-900[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.data-\\[state\\=open\\]\\:rf-bg-zinc-100[data-state=open]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[selected\\=true\\]\\:rf-text-zinc-900[data-selected=true]{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.data-\\[state\\=active\\]\\:rf-text-zinc-950[data-state=active]{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.data-\\[state\\=checked\\]\\:rf-text-zinc-50[data-state=checked]{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.data-\\[disabled\\=true\\]\\:rf-opacity-50[data-disabled=true],.data-\\[disabled\\]\\:rf-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=active\\]\\:rf-shadow[data-state=active]{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.data-\\[state\\=open\\]\\:rf-animate-in[data-state=open]{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-animate-out[data-state=closed]{animation-duration:.15s;animation-name:exit;--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:rf-fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:rf-zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:rf-zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:rf-slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:rf-slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:rf-slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:rf-slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.data-\\[state\\=closed\\]\\:rf-slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:rf-slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:rf-slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:rf-slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y:-48%}.dark\\:rf-border-zinc-50:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(250 250 250/var(--tw-border-opacity,1))}.dark\\:rf-border-zinc-800:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.dark\\:rf-bg-gray-700:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.dark\\:rf-bg-gray-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.dark\\:rf-bg-red-900:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-50:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-950:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:rf-text-gray-500:is(.rf-dark *){--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-400:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-50:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-900:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-ring-offset-zinc-950:is(.rf-dark *){--tw-ring-offset-color:#09090b}.dark\\:placeholder\\:rf-text-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:placeholder\\:rf-text-zinc-400:is(.rf-dark *)::placeholder{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:hover\\:rf-bg-red-900\\/90:hover:is(.rf-dark *){background-color:rgba(127,29,29,.9)}.dark\\:hover\\:rf-bg-zinc-50\\/90:hover:is(.rf-dark *){background-color:hsla(0,0%,98%,.9)}.dark\\:hover\\:rf-bg-zinc-800:hover:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:hover\\:rf-bg-zinc-800\\/80:hover:is(.rf-dark *){background-color:rgba(39,39,42,.8)}.dark\\:hover\\:rf-text-zinc-50:hover:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus\\:rf-bg-zinc-800:focus:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:focus\\:rf-text-zinc-50:focus:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus-visible\\:rf-ring-zinc-300:focus-visible:is(.rf-dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(212 212 216/var(--tw-ring-opacity,1))}.dark\\:data-\\[selected\\=true\\]\\:rf-bg-zinc-800[data-selected=true]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-bg-zinc-950[data-state=active]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-bg-zinc-50[data-state=checked]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=open\\]\\:rf-bg-zinc-800[data-state=open]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[selected\\=true\\]\\:rf-text-zinc-50[data-selected=true]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-text-zinc-50[data-state=active]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-text-zinc-900[data-state=checked]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}@media (min-width:640px){.sm\\:rf-order-1{order:1}.sm\\:rf-order-2{order:2}.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-inline{display:inline}.sm\\:rf-hidden{display:none}.sm\\:rf-w-auto{width:auto}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-items-center{align-items:center}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-gap-3{gap:.75rem}.sm\\:rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.sm\\:rf-rounded-lg{border-radius:var(--radius)}.sm\\:rf-px-4{padding-left:1rem;padding-right:1rem}.sm\\:rf-text-left{text-align:left}.sm\\:rf-text-sm{font-size:.875rem;line-height:1.25rem}.sm\\:rf-text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width:768px){.md\\:rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\\[\\&\\>span\\]\\:rf-line-clamp-1>span{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\\[\\&\\>svg\\]\\:rf-size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:rf-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:rf-text-red-300>svg{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.\\[\\&\\>svg\\]\\:hover\\:rf-text-red-400:hover>svg{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-py-1\\.5 [cmdk-group-heading]{padding-bottom:.375rem;padding-top:.375rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-font-medium [cmdk-group-heading]{font-weight:500}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-zinc-500 [cmdk-group-heading]{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.dark\\:\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-zinc-400 [cmdk-group-heading]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.\\[\\&_\\[cmdk-group\\]\\:not\\(\\[hidden\\]\\)_\\~\\[cmdk-group\\]\\]\\:rf-pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\\[\\&_\\[cmdk-group\\]\\]\\:rf-px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-input-wrapper\\]_svg\\]\\:rf-h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\\[\\&_\\[cmdk-input-wrapper\\]_svg\\]\\:rf-w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\\[\\&_\\[cmdk-input\\]\\]\\:rf-h-12 [cmdk-input]{height:3rem}.\\[\\&_\\[cmdk-item\\]\\]\\:rf-px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-item\\]\\]\\:rf-py-3 [cmdk-item]{padding-bottom:.75rem;padding-top:.75rem}.\\[\\&_\\[cmdk-item\\]_svg\\]\\:rf-h-5 [cmdk-item] svg{height:1.25rem}.\\[\\&_\\[cmdk-item\\]_svg\\]\\:rf-w-5 [cmdk-item] svg{width:1.25rem}.\\[\\&_svg\\]\\:rf-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:rf-size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:rf-shrink-0 svg{flex-shrink:0}',pbn=()=>{Ee.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const e=document.createElement("style");e.setAttribute("data-styles","tscircuit-runframe"),e.textContent=hbn,document.head.appendChild(e)},[])},fbn=n=>{Ee.useEffect(()=>(n?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[n])},CQe=n=>`hsl(${e2.indexOf(n)*137.5%360}, 70%, 50%)`,mbn=({phaseTimings:n})=>{if(!n)return null;const e=Object.values(n).reduce((t,i)=>t+i,0);return _e.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[_e.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:e2.map(t=>{const i=n[t]||0,r=i/e*100;return _e.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${r}%`,backgroundColor:CQe(t)},children:_e.jsxs("div",{className:"rf-opacity-0 group-hover/bar:rf-opacity-100 rf-transition-opacity rf-absolute rf-bottom-full rf-left-1/2 rf-transform -rf-translate-x-1/2 rf-mb-2 rf-px-2 rf-py-1 rf-text-xs rf-whitespace-nowrap rf-rounded rf-bg-gray-900 rf-text-white rf-pointer-events-none",children:[t,": ",i.toFixed(1),"ms"]})},t)})}),_e.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",e.toFixed(2),"ms"]})]})},_bn=({renderLog:n})=>{const[e,t]=Ee.useState("chronological");if(!n)return _e.jsx("div",{className:"rf-p-4 rf-bg-gray-100 rf-rounded-md",children:"No render log, make sure this tab is open when you render (TODO add a rerender button here)"});const i=Object.entries(n?.phaseTimings??{});e==="chronological"?i.sort((o,s)=>e2.indexOf(o[0])-e2.indexOf(s[0])):i.sort((o,s)=>s[1]-o[1]);const r=i.reduce((o,[s,a])=>o+a,0);return _e.jsxs("div",{className:"rf-bg-white",children:[_e.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center",children:[_e.jsx("div",{children:"Render Logs"}),_e.jsxs("div",{className:"rf-mb-4 rf-pr-2 rf-flex rf-text-xs rf-items-center",children:[_e.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),_e.jsxs("select",{value:e,onChange:o=>t(o.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[_e.jsx("option",{value:"chronological",children:"Phase Order"}),_e.jsx("option",{value:"longest",children:"Duration"})]})]})]}),_e.jsx(mbn,{phaseTimings:n.phaseTimings}),_e.jsxs("table",{className:"rf-w-full rf-text-xs",children:[_e.jsx("thead",{children:_e.jsxs("tr",{children:[_e.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),_e.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),_e.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),_e.jsx("tbody",{children:i.map(([o,s])=>_e.jsxs("tr",{children:[_e.jsx("td",{className:"rf-p-2",children:e2.indexOf(o)}),_e.jsx("td",{className:"rf-p-2",children:o}),_e.jsx("td",{className:"rf-p-2",children:_e.jsx("div",{className:"rf-w-8",children:_e.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:CQe(o),width:`${s/r*100}%`}})})}),_e.jsx("td",{className:"rf-p-2",children:_e.jsxs("div",{className:"rf-flex w-full",children:[_e.jsxs("span",{className:"rf-flex-grow",children:[s,"ms"]}),_e.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(s/r*100).toFixed(1),"%"]})]})})]},o))})]})]})},AQe=({errorMessage:n,errorStack:e,circuitJsonErrors:t})=>{Ee.useEffect(()=>{if(n){const i=new Error(n);e&&(i.stack=e);try{cO.captureException(i)}catch{}}},[n,e]),Ee.useEffect(()=>{if(t&&t.length>0)for(const i of t){const r=new Error(i.message||"Circuit JSON Error");i.stack&&(r.stack=i.stack);try{cO.captureException(r,{error_type:i.type})}catch{}}},[t])},ybn="0.0.868";function gbn(n,e){const[t,i]=Ee.useState(()=>{try{const r=window.localStorage.getItem(n);return r?JSON.parse(r):e}catch(r){return console.error("Error reading from localStorage:",r),e}});return Ee.useEffect(()=>{try{window.localStorage.setItem(n,JSON.stringify(t))}catch(r){console.error("Error writing to localStorage:",r)}},[n,t]),[t,i]}const _me={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},yme=new Map,Mj=n=>{const e=yme.get(n);return e?Object.fromEntries(Object.entries(e.stores).map(([t,i])=>[t,i.getState()])):{}},vbn=(n,e,t)=>{if(n===void 0)return{type:"untracked",connection:e.connect(t)};const i=yme.get(t.name);if(i)return{type:"tracked",store:n,...i};const r={connection:e.connect(t),stores:{}};return yme.set(t.name,r),{type:"tracked",store:n,...r}},RQe=(n,e={})=>(t,i,r)=>{const{enabled:o,anonymousActionType:s,store:a,...c}=e;let l;try{l=(o??(_me?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!l)return(_me?"production":void 0)!=="production"&&o&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),n(t,i,r);const{connection:u,...d}=vbn(a,l,c);let h=!0;r.setState=(y,g,b)=>{const x=t(y,g);if(!h)return x;const w=b===void 0?{type:s||"anonymous"}:typeof b=="string"?{type:b}:b;return a===void 0?(u?.send(w,i()),x):(u?.send({...w,type:`${a}/${w.type}`},{...Mj(c.name),[a]:r.getState()}),x)};const f=(...y)=>{const g=h;h=!1,t(...y),h=g},m=n(r.setState,i,r);if(d.type==="untracked"?u?.init(m):(d.stores[d.store]=r,u?.init(Object.fromEntries(Object.entries(d.stores).map(([y,g])=>[y,y===d.store?m:g.getState()])))),r.dispatchFromDevtools&&typeof r.dispatch=="function"){let y=!1;const g=r.dispatch;r.dispatch=(...b)=>{(_me?"production":void 0)!=="production"&&b[0].type==="__setState"&&!y&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),y=!0),g(...b)}}return u.subscribe(y=>{var g;switch(y.type){case"ACTION":if(typeof y.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return gme(y.payload,b=>{if(b.type==="__setState"){if(a===void 0){f(b.state);return}Object.keys(b.state).length!==1&&console.error(`
5601
+ */const dbn=({containerClassName:n,...e})=>{const t=Ee.useRef(null),[i,r]=Ee.useState(620);return Ee.useLayoutEffect(()=>{const o=()=>{if(t.current){const a=t.current.clientHeight,c=window.innerHeight;r(Math.min(Math.max(a,620),c))}};o();const s=new ResizeObserver(o);return t.current&&s.observe(t.current),window.addEventListener("resize",o),()=>{s.disconnect(),window.removeEventListener("resize",o)}},[]),_e.jsx("div",{ref:t,className:n||"rf-w-full rf-h-full",children:_e.jsx(ubn,{...e,height:i})})},hbn='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--radius:0.5rem}.rf-pointer-events-none{pointer-events:none}.rf-invisible{visibility:hidden}.rf-fixed{position:fixed}.rf-absolute{position:absolute}.rf-relative{position:relative}.rf-inset-0{inset:0}.-rf-left-2{left:-.5rem}.-rf-right-10{right:-2.5rem}.-rf-right-2{right:-.5rem}.-rf-right-4{right:-1rem}.-rf-right-6{right:-1.5rem}.-rf-right-7{right:-1.75rem}.-rf-right-8{right:-2rem}.-rf-right-9{right:-2.25rem}.rf-bottom-full{bottom:100%}.rf-left-0{left:0}.rf-left-1{left:.25rem}.rf-left-1\\/2{left:50%}.rf-left-2{left:.5rem}.rf-left-\\[50\\%\\]{left:50%}.rf-right-0{right:0}.rf-right-1{right:.25rem}.rf-right-4{right:1rem}.rf-right-\\[4px\\]{right:4px}.rf-top-0{top:0}.rf-top-1{top:.25rem}.rf-top-2{top:.5rem}.rf-top-2\\.5{top:.625rem}.rf-top-\\[50\\%\\]{top:50%}.rf-top-\\[6px\\]{top:6px}.\\!rf-z-\\[101\\]{z-index:101!important}.rf-z-10{z-index:10}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.rf-order-1{order:1}.rf-order-2{order:2}.rf-order-3{order:3}.rf-m-1{margin:.25rem}.rf-m-6{margin:1.5rem}.-rf-mx-1,.rf--mx-1{margin-left:-.25rem;margin-right:-.25rem}.rf-mx-1{margin-left:.25rem;margin-right:.25rem}.rf-mx-2{margin-left:.5rem;margin-right:.5rem}.rf-mx-4{margin-left:1rem;margin-right:1rem}.rf-mx-auto{margin-left:auto;margin-right:auto}.rf-my-1{margin-bottom:.25rem;margin-top:.25rem}.rf-my-12{margin-bottom:3rem;margin-top:3rem}.rf-my-4{margin-bottom:1rem;margin-top:1rem}.rf-my-auto{margin-bottom:auto;margin-top:auto}.rf-mb-1{margin-bottom:.25rem}.rf-mb-12{margin-bottom:3rem}.rf-mb-2{margin-bottom:.5rem}.rf-mb-3{margin-bottom:.75rem}.rf-mb-4{margin-bottom:1rem}.rf-mb-6{margin-bottom:1.5rem}.rf-mb-8{margin-bottom:2rem}.rf-ml-1{margin-left:.25rem}.rf-ml-2{margin-left:.5rem}.rf-ml-auto{margin-left:auto}.rf-mr-1{margin-right:.25rem}.rf-mr-2{margin-right:.5rem}.rf-mt-0{margin-top:0}.rf-mt-0\\.5{margin-top:.125rem}.rf-mt-1{margin-top:.25rem}.rf-mt-2{margin-top:.5rem}.rf-mt-3{margin-top:.75rem}.rf-mt-4{margin-top:1rem}.rf-mt-5{margin-top:1.25rem}.rf-mt-auto{margin-top:auto}.rf-block{display:block}.rf-inline-block{display:inline-block}.rf-inline{display:inline}.rf-flex{display:flex}.rf-inline-flex{display:inline-flex}.rf-grid{display:grid}.rf-hidden{display:none}.rf-aspect-square{aspect-ratio:1/1}.rf-aspect-video{aspect-ratio:16/9}.rf-size-14{height:3.5rem;width:3.5rem}.rf-size-4{height:1rem;width:1rem}.\\!rf-h-2{height:.5rem!important}.\\!rf-h-2\\.5{height:.625rem!important}.\\!rf-h-3{height:.75rem!important}.\\!rf-h-full{height:100%!important}.rf-h-1{height:.25rem}.rf-h-10{height:2.5rem}.rf-h-12{height:3rem}.rf-h-2{height:.5rem}.rf-h-2\\.5{height:.625rem}.rf-h-24{height:6rem}.rf-h-3{height:.75rem}.rf-h-3\\.5{height:.875rem}.rf-h-4{height:1rem}.rf-h-5{height:1.25rem}.rf-h-6{height:1.5rem}.rf-h-60{height:15rem}.rf-h-64{height:16rem}.rf-h-7{height:1.75rem}.rf-h-8{height:2rem}.rf-h-9{height:2.25rem}.rf-h-\\[400px\\]{height:400px}.rf-h-\\[calc\\(100vh-52px\\)\\]{height:calc(100vh - 52px)}.rf-h-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.rf-h-auto{height:auto}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.rf-h-screen{height:100vh}.\\!rf-max-h-\\[40vh\\]{max-height:40vh!important}.rf-max-h-32{max-height:8rem}.rf-max-h-96{max-height:24rem}.rf-max-h-\\[200px\\]{max-height:200px}.rf-max-h-\\[300px\\]{max-height:300px}.rf-max-h-\\[500px\\]{max-height:500px}.rf-max-h-\\[90vh\\]{max-height:90vh}.rf-max-h-full{max-height:100%}.rf-min-h-0{min-height:0}.rf-min-h-\\[200px\\]{min-height:200px}.rf-min-h-\\[300px\\]{min-height:300px}.rf-min-h-\\[620px\\]{min-height:620px}.rf-min-h-\\[calc\\(100vh-240px\\)\\]{min-height:calc(100vh - 240px)}.\\!rf-w-2{width:.5rem!important}.\\!rf-w-2\\.5{width:.625rem!important}.rf-w-1{width:.25rem}.rf-w-1\\/2{width:50%}.rf-w-11{width:2.75rem}.rf-w-11\\/12{width:91.666667%}.rf-w-12{width:3rem}.rf-w-16{width:4rem}.rf-w-2{width:.5rem}.rf-w-2\\.5{width:.625rem}.rf-w-20{width:5rem}.rf-w-24{width:6rem}.rf-w-28{width:7rem}.rf-w-3{width:.75rem}.rf-w-3\\.5{width:.875rem}.rf-w-32{width:8rem}.rf-w-4{width:1rem}.rf-w-40{width:10rem}.rf-w-48{width:12rem}.rf-w-5{width:1.25rem}.rf-w-6{width:1.5rem}.rf-w-64{width:16rem}.rf-w-72{width:18rem}.rf-w-8{width:2rem}.rf-w-9{width:2.25rem}.rf-w-96{width:24rem}.rf-w-\\[95\\%\\]{width:95%}.rf-w-fit{width:-moz-fit-content;width:fit-content}.rf-w-full{width:100%}.rf-w-screen{width:100vw}.rf-min-w-0{min-width:0}.rf-min-w-10{min-width:2.5rem}.rf-min-w-16{min-width:4rem}.rf-min-w-\\[148px\\]{min-width:148px}.rf-min-w-\\[8rem\\]{min-width:8rem}.rf-min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.\\!rf-max-w-\\[660px\\]{max-width:660px!important}.rf-max-w-2xl{max-width:42rem}.rf-max-w-3xl{max-width:48rem}.rf-max-w-4xl{max-width:56rem}.rf-max-w-5xl{max-width:64rem}.rf-max-w-full{max-width:100%}.rf-max-w-lg{max-width:32rem}.rf-max-w-md{max-width:28rem}.rf-max-w-none{max-width:none}.rf-max-w-xl{max-width:36rem}.rf-max-w-xs{max-width:20rem}.rf-flex-1{flex:1 1 0%}.rf-flex-shrink-0,.rf-shrink-0{flex-shrink:0}.rf-flex-grow{flex-grow:1}.rf-table-auto{table-layout:auto}.rf-origin-\\[--radix-popover-content-transform-origin\\]{transform-origin:var(--radix-popover-content-transform-origin)}.-rf-translate-x-1{--tw-translate-x:-0.25rem}.-rf-translate-x-1,.-rf-translate-x-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rf-translate-x-1\\/2{--tw-translate-x:-50%}.-rf-translate-y-1{--tw-translate-y:-0.25rem}.-rf-translate-y-1,.rf--translate-x-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-x-1{--tw-translate-x:-0.25rem}.rf--translate-x-1\\/2{--tw-translate-x:-50%}.rf--translate-x-1\\/2,.rf--translate-y-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-y-1{--tw-translate-y:-0.25rem}.rf-translate-x-\\[-50\\%\\]{--tw-translate-x:-50%}.rf-translate-x-\\[-50\\%\\],.rf-translate-y-\\[-50\\%\\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf-translate-y-\\[-50\\%\\]{--tw-translate-y:-50%}.rf-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes rf-pulse{50%{opacity:.5}}.rf-animate-pulse{animation:rf-pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes rf-spin{to{transform:rotate(1turn)}}.rf-animate-spin{animation:rf-spin 1s linear infinite}.rf-cursor-default{cursor:default}.rf-cursor-not-allowed{cursor:not-allowed}.rf-cursor-pointer{cursor:pointer}.rf-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.rf-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.rf-flex-row{flex-direction:row}.rf-flex-col{flex-direction:column}.rf-flex-col-reverse{flex-direction:column-reverse}.rf-flex-wrap{flex-wrap:wrap}.rf-place-items-center{place-items:center}.rf-items-start{align-items:flex-start}.rf-items-end{align-items:flex-end}.rf-items-center{align-items:center}.rf-items-stretch{align-items:stretch}.rf-justify-end{justify-content:flex-end}.rf-justify-center{justify-content:center}.rf-justify-between{justify-content:space-between}.rf-gap-0{gap:0}.rf-gap-1{gap:.25rem}.rf-gap-2{gap:.5rem}.rf-gap-3{gap:.75rem}.rf-gap-4{gap:1rem}.rf-gap-5{gap:1.25rem}.rf-gap-6{gap:1.5rem}.rf-gap-8{gap:2rem}.rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.rf-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.rf-divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.rf-overflow-auto{overflow:auto}.rf-overflow-hidden{overflow:hidden}.rf-overflow-visible{overflow:visible}.rf-overflow-x-auto{overflow-x:auto}.\\!rf-overflow-y-auto{overflow-y:auto!important}.rf-overflow-y-auto{overflow-y:auto}.rf-overflow-x-hidden{overflow-x:hidden}.rf-overflow-x-clip{overflow-x:clip}.rf-truncate{overflow:hidden;text-overflow:ellipsis}.rf-truncate,.rf-whitespace-nowrap{white-space:nowrap}.rf-whitespace-pre-wrap{white-space:pre-wrap}.rf-break-words{overflow-wrap:break-word}.rf-rounded{border-radius:.25rem}.rf-rounded-2xl{border-radius:1rem}.rf-rounded-full{border-radius:9999px}.rf-rounded-lg{border-radius:var(--radius)}.rf-rounded-md{border-radius:calc(var(--radius) - 2px)}.rf-rounded-sm{border-radius:calc(var(--radius) - 4px)}.rf-rounded-xl{border-radius:.75rem}.rf-border{border-width:1px}.rf-border-2{border-width:2px}.rf-border-b{border-bottom-width:1px}.rf-border-t{border-top-width:1px}.rf-border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}.rf-border-blue-400{--tw-border-opacity:1;border-color:rgb(96 165 250/var(--tw-border-opacity,1))}.rf-border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.rf-border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.rf-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.rf-border-green-200{--tw-border-opacity:1;border-color:rgb(187 247 208/var(--tw-border-opacity,1))}.rf-border-input{border-color:hsl(var(--input))}.rf-border-neutral-200{--tw-border-opacity:1;border-color:rgb(229 229 229/var(--tw-border-opacity,1))}.rf-border-orange-200{--tw-border-opacity:1;border-color:rgb(254 215 170/var(--tw-border-opacity,1))}.rf-border-primary{border-color:hsl(var(--primary))}.rf-border-red-200{--tw-border-opacity:1;border-color:rgb(254 202 202/var(--tw-border-opacity,1))}.rf-border-red-400{--tw-border-opacity:1;border-color:rgb(248 113 113/var(--tw-border-opacity,1))}.rf-border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.rf-border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity,1))}.rf-border-zinc-900{--tw-border-opacity:1;border-color:rgb(24 24 27/var(--tw-border-opacity,1))}.rf-bg-background{background-color:hsl(var(--background))}.rf-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.rf-bg-black\\/80{background-color:rgba(0,0,0,.8)}.rf-bg-blue-100{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity,1))}.rf-bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.rf-bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.rf-bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.rf-bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.rf-bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.rf-bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity,1))}.rf-bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}.rf-bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.rf-bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.rf-bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.rf-bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.rf-bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.rf-bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity,1))}.rf-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.rf-bg-muted{background-color:hsl(var(--muted))}.rf-bg-neutral-100{--tw-bg-opacity:1;background-color:rgb(245 245 245/var(--tw-bg-opacity,1))}.rf-bg-neutral-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38/var(--tw-bg-opacity,1))}.rf-bg-neutral-900{--tw-bg-opacity:1;background-color:rgb(23 23 23/var(--tw-bg-opacity,1))}.rf-bg-orange-400{--tw-bg-opacity:1;background-color:rgb(251 146 60/var(--tw-bg-opacity,1))}.rf-bg-orange-50{--tw-bg-opacity:1;background-color:rgb(255 247 237/var(--tw-bg-opacity,1))}.rf-bg-popover{background-color:hsl(var(--popover))}.rf-bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.rf-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.rf-bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.rf-bg-red-900{--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.rf-bg-transparent{background-color:transparent}.rf-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.rf-bg-yellow-100{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity,1))}.rf-bg-zinc-100{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.rf-bg-zinc-200{--tw-bg-opacity:1;background-color:rgb(228 228 231/var(--tw-bg-opacity,1))}.rf-bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-zinc-800{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.rf-bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.rf-bg-opacity-50{--tw-bg-opacity:0.5}.rf-fill-current{fill:currentColor}.rf-object-contain{-o-object-fit:contain;object-fit:contain}.rf-object-cover{-o-object-fit:cover;object-fit:cover}.\\!rf-p-0{padding:0!important}.rf-p-0{padding:0}.rf-p-1{padding:.25rem}.rf-p-2{padding:.5rem}.rf-p-3{padding:.75rem}.rf-p-4{padding:1rem}.rf-p-5{padding:1.25rem}.rf-p-6{padding:1.5rem}.rf-p-8{padding:2rem}.rf-px-1{padding-left:.25rem;padding-right:.25rem}.rf-px-2{padding-left:.5rem;padding-right:.5rem}.rf-px-3{padding-left:.75rem;padding-right:.75rem}.rf-px-4{padding-left:1rem;padding-right:1rem}.rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.rf-px-8{padding-left:2rem;padding-right:2rem}.rf-py-0{padding-bottom:0;padding-top:0}.rf-py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.rf-py-1{padding-bottom:.25rem;padding-top:.25rem}.rf-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.rf-py-10{padding-bottom:2.5rem;padding-top:2.5rem}.rf-py-12{padding-bottom:3rem;padding-top:3rem}.rf-py-2{padding-bottom:.5rem;padding-top:.5rem}.rf-py-3{padding-bottom:.75rem;padding-top:.75rem}.rf-py-4{padding-bottom:1rem;padding-top:1rem}.rf-py-6{padding-bottom:1.5rem;padding-top:1.5rem}.rf-py-8{padding-bottom:2rem;padding-top:2rem}.rf-pb-0{padding-bottom:0}.rf-pb-2{padding-bottom:.5rem}.rf-pb-3{padding-bottom:.75rem}.rf-pb-4{padding-bottom:1rem}.rf-pl-2{padding-left:.5rem}.rf-pl-4{padding-left:1rem}.rf-pl-8{padding-left:2rem}.rf-pr-2{padding-right:.5rem}.rf-pt-0{padding-top:0}.rf-pt-2{padding-top:.5rem}.rf-pt-4{padding-top:1rem}.rf-text-left{text-align:left}.rf-text-center{text-align:center}.rf-text-right{text-align:right}.rf-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.rf-text-2xl{font-size:1.5rem;line-height:2rem}.rf-text-3xl{font-size:1.875rem;line-height:2.25rem}.rf-text-\\[8px\\]{font-size:8px}.rf-text-base{font-size:1rem;line-height:1.5rem}.rf-text-lg{font-size:1.125rem;line-height:1.75rem}.rf-text-sm{font-size:.875rem;line-height:1.25rem}.rf-text-xl{font-size:1.25rem;line-height:1.75rem}.rf-text-xs{font-size:.75rem;line-height:1rem}.\\!rf-font-normal{font-weight:400!important}.rf-font-bold{font-weight:700}.rf-font-medium{font-weight:500}.rf-font-semibold{font-weight:600}.rf-uppercase{text-transform:uppercase}.rf-capitalize{text-transform:capitalize}.rf-tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.rf-leading-5{line-height:1.25rem}.rf-leading-none{line-height:1}.rf-leading-relaxed{line-height:1.625}.rf-leading-tight{line-height:1.25}.rf-tracking-wide{letter-spacing:.025em}.rf-tracking-widest{letter-spacing:.1em}.rf-text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.rf-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.rf-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.rf-text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.rf-text-blue-800{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.rf-text-blue-900{--tw-text-opacity:1;color:rgb(30 58 138/var(--tw-text-opacity,1))}.rf-text-current{color:currentColor}.rf-text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.rf-text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.rf-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.rf-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.rf-text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.rf-text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}.rf-text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.rf-text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.rf-text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity,1))}.rf-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.rf-text-green-800{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity,1))}.rf-text-green-900{--tw-text-opacity:1;color:rgb(20 83 45/var(--tw-text-opacity,1))}.rf-text-muted-foreground{color:hsl(var(--muted-foreground))}.rf-text-neutral-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-neutral-500{--tw-text-opacity:1;color:rgb(115 115 115/var(--tw-text-opacity,1))}.rf-text-neutral-900{--tw-text-opacity:1;color:rgb(23 23 23/var(--tw-text-opacity,1))}.rf-text-neutral-950{--tw-text-opacity:1;color:rgb(10 10 10/var(--tw-text-opacity,1))}.rf-text-orange-500{--tw-text-opacity:1;color:rgb(249 115 22/var(--tw-text-opacity,1))}.rf-text-orange-600{--tw-text-opacity:1;color:rgb(234 88 12/var(--tw-text-opacity,1))}.rf-text-orange-800{--tw-text-opacity:1;color:rgb(154 52 18/var(--tw-text-opacity,1))}.rf-text-popover-foreground{color:hsl(var(--popover-foreground))}.rf-text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.rf-text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.rf-text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.rf-text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.rf-text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.rf-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.rf-text-red-800{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity,1))}.rf-text-red-900{--tw-text-opacity:1;color:rgb(127 29 29/var(--tw-text-opacity,1))}.rf-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.rf-text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}.rf-text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity,1))}.rf-text-yellow-900{--tw-text-opacity:1;color:rgb(113 63 18/var(--tw-text-opacity,1))}.rf-text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.rf-text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.rf-text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.rf-text-zinc-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.rf-text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.rf-text-zinc-950{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.rf-underline{text-decoration-line:underline}.rf-line-through{text-decoration-line:line-through}.rf-underline-offset-4{text-underline-offset:4px}.rf-opacity-0{opacity:0}.rf-opacity-100{opacity:1}.rf-opacity-25{opacity:.25}.rf-opacity-30{opacity:.3}.rf-opacity-50{opacity:.5}.rf-opacity-60{opacity:.6}.rf-opacity-75{opacity:.75}.rf-shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.rf-shadow,.rf-shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.rf-shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.rf-shadow-md,.rf-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.rf-outline-none{outline:2px solid transparent;outline-offset:2px}.rf-ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.rf-ring-blue-500{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.rf-ring-primary{--tw-ring-color:hsl(var(--primary))}.rf-ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.rf-ring-offset-white{--tw-ring-offset-color:#fff}.rf-transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-duration-200{transition-duration:.2s}.rf-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.rf-slide-in-from-left-1{--tw-enter-translate-x:-0.25rem}.rf-slide-out-to-left-1{--tw-exit-translate-x:-0.25rem}.rf-duration-200{animation-duration:.2s}.rf-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.file\\:rf-border-0::file-selector-button{border-width:0}.file\\:rf-bg-transparent::file-selector-button{background-color:transparent}.file\\:rf-text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\\:rf-font-medium::file-selector-button{font-weight:500}.placeholder\\:rf-text-zinc-500::-moz-placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.placeholder\\:rf-text-zinc-500::placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.hover\\:rf-border-blue-300:hover{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.hover\\:\\!rf-bg-transparent:hover{background-color:transparent!important}.hover\\:rf-bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-500\\/90:hover{background-color:rgba(239,68,68,.9)}.hover\\:rf-bg-zinc-100:hover{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100\\/80:hover{background-color:hsla(240,5%,96%,.8)}.hover\\:rf-bg-zinc-900\\/90:hover{background-color:rgba(24,24,27,.9)}.hover\\:rf-text-red-400:hover{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.hover\\:rf-text-zinc-900:hover{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.hover\\:rf-underline:hover{text-decoration-line:underline}.focus\\:rf-bg-gray-100:focus{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.focus\\:rf-bg-zinc-100:focus{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.focus\\:rf-text-gray-900:focus{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.focus\\:rf-text-zinc-900:focus{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.focus\\:rf-outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:rf-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:rf-ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\\:rf-ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:rf-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:rf-ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-zinc-950:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(9 9 11/var(--tw-ring-opacity,1))}.focus-visible\\:rf-ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.disabled\\:rf-pointer-events-none:disabled{pointer-events:none}.disabled\\:rf-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:rf-opacity-50:disabled{opacity:.5}.rf-group\\/bar:hover .group-hover\\/bar\\:rf-opacity-100{opacity:1}.data-\\[disabled\\=true\\]\\:rf-pointer-events-none[data-disabled=true],.data-\\[disabled\\]\\:rf-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom]{--tw-translate-y:0.25rem}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom],.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{--tw-translate-x:-0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right]{--tw-translate-x:0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right],.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{--tw-translate-y:-0.25rem}.data-\\[selected\\=true\\]\\:rf-bg-zinc-100[data-selected=true]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[state\\=active\\]\\:rf-bg-white[data-state=active]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.data-\\[state\\=checked\\]\\:rf-bg-zinc-900[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.data-\\[state\\=open\\]\\:rf-bg-zinc-100[data-state=open]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[selected\\=true\\]\\:rf-text-zinc-900[data-selected=true]{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.data-\\[state\\=active\\]\\:rf-text-zinc-950[data-state=active]{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.data-\\[state\\=checked\\]\\:rf-text-zinc-50[data-state=checked]{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.data-\\[disabled\\=true\\]\\:rf-opacity-50[data-disabled=true],.data-\\[disabled\\]\\:rf-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=active\\]\\:rf-shadow[data-state=active]{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.data-\\[state\\=open\\]\\:rf-animate-in[data-state=open]{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-animate-out[data-state=closed]{animation-duration:.15s;animation-name:exit;--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:rf-fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:rf-zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:rf-zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:rf-slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:rf-slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:rf-slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:rf-slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.data-\\[state\\=closed\\]\\:rf-slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:rf-slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:rf-slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:rf-slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y:-48%}.dark\\:rf-border-zinc-50:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(250 250 250/var(--tw-border-opacity,1))}.dark\\:rf-border-zinc-800:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.dark\\:rf-bg-gray-700:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.dark\\:rf-bg-gray-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.dark\\:rf-bg-red-900:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-50:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-950:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:rf-text-gray-500:is(.rf-dark *){--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-400:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-50:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-900:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-ring-offset-zinc-950:is(.rf-dark *){--tw-ring-offset-color:#09090b}.dark\\:placeholder\\:rf-text-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:placeholder\\:rf-text-zinc-400:is(.rf-dark *)::placeholder{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:hover\\:rf-bg-red-900\\/90:hover:is(.rf-dark *){background-color:rgba(127,29,29,.9)}.dark\\:hover\\:rf-bg-zinc-50\\/90:hover:is(.rf-dark *){background-color:hsla(0,0%,98%,.9)}.dark\\:hover\\:rf-bg-zinc-800:hover:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:hover\\:rf-bg-zinc-800\\/80:hover:is(.rf-dark *){background-color:rgba(39,39,42,.8)}.dark\\:hover\\:rf-text-zinc-50:hover:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus\\:rf-bg-zinc-800:focus:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:focus\\:rf-text-zinc-50:focus:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus-visible\\:rf-ring-zinc-300:focus-visible:is(.rf-dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(212 212 216/var(--tw-ring-opacity,1))}.dark\\:data-\\[selected\\=true\\]\\:rf-bg-zinc-800[data-selected=true]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-bg-zinc-950[data-state=active]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-bg-zinc-50[data-state=checked]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=open\\]\\:rf-bg-zinc-800[data-state=open]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[selected\\=true\\]\\:rf-text-zinc-50[data-selected=true]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-text-zinc-50[data-state=active]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-text-zinc-900[data-state=checked]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}@media (min-width:640px){.sm\\:rf-order-1{order:1}.sm\\:rf-order-2{order:2}.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-inline{display:inline}.sm\\:rf-hidden{display:none}.sm\\:rf-w-auto{width:auto}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-items-center{align-items:center}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-gap-3{gap:.75rem}.sm\\:rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.sm\\:rf-rounded-lg{border-radius:var(--radius)}.sm\\:rf-px-4{padding-left:1rem;padding-right:1rem}.sm\\:rf-text-left{text-align:left}.sm\\:rf-text-sm{font-size:.875rem;line-height:1.25rem}.sm\\:rf-text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width:768px){.md\\:rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\\[\\&\\>span\\]\\:rf-line-clamp-1>span{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\\[\\&\\>svg\\]\\:rf-size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:rf-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:rf-text-red-300>svg{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.\\[\\&\\>svg\\]\\:hover\\:rf-text-red-400:hover>svg{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-py-1\\.5 [cmdk-group-heading]{padding-bottom:.375rem;padding-top:.375rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-font-medium [cmdk-group-heading]{font-weight:500}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-zinc-500 [cmdk-group-heading]{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.dark\\:\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-zinc-400 [cmdk-group-heading]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.\\[\\&_\\[cmdk-group\\]\\:not\\(\\[hidden\\]\\)_\\~\\[cmdk-group\\]\\]\\:rf-pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\\[\\&_\\[cmdk-group\\]\\]\\:rf-px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-input-wrapper\\]_svg\\]\\:rf-h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\\[\\&_\\[cmdk-input-wrapper\\]_svg\\]\\:rf-w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\\[\\&_\\[cmdk-input\\]\\]\\:rf-h-12 [cmdk-input]{height:3rem}.\\[\\&_\\[cmdk-item\\]\\]\\:rf-px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-item\\]\\]\\:rf-py-3 [cmdk-item]{padding-bottom:.75rem;padding-top:.75rem}.\\[\\&_\\[cmdk-item\\]_svg\\]\\:rf-h-5 [cmdk-item] svg{height:1.25rem}.\\[\\&_\\[cmdk-item\\]_svg\\]\\:rf-w-5 [cmdk-item] svg{width:1.25rem}.\\[\\&_svg\\]\\:rf-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:rf-size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:rf-shrink-0 svg{flex-shrink:0}',pbn=()=>{Ee.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const e=document.createElement("style");e.setAttribute("data-styles","tscircuit-runframe"),e.textContent=hbn,document.head.appendChild(e)},[])},fbn=n=>{Ee.useEffect(()=>(n?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[n])},CQe=n=>`hsl(${e2.indexOf(n)*137.5%360}, 70%, 50%)`,mbn=({phaseTimings:n})=>{if(!n)return null;const e=Object.values(n).reduce((t,i)=>t+i,0);return _e.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[_e.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:e2.map(t=>{const i=n[t]||0,r=i/e*100;return _e.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${r}%`,backgroundColor:CQe(t)},children:_e.jsxs("div",{className:"rf-opacity-0 group-hover/bar:rf-opacity-100 rf-transition-opacity rf-absolute rf-bottom-full rf-left-1/2 rf-transform -rf-translate-x-1/2 rf-mb-2 rf-px-2 rf-py-1 rf-text-xs rf-whitespace-nowrap rf-rounded rf-bg-gray-900 rf-text-white rf-pointer-events-none",children:[t,": ",i.toFixed(1),"ms"]})},t)})}),_e.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",e.toFixed(2),"ms"]})]})},_bn=({renderLog:n})=>{const[e,t]=Ee.useState("chronological");if(!n)return _e.jsx("div",{className:"rf-p-4 rf-bg-gray-100 rf-rounded-md",children:"No render log, make sure this tab is open when you render (TODO add a rerender button here)"});const i=Object.entries(n?.phaseTimings??{});e==="chronological"?i.sort((o,s)=>e2.indexOf(o[0])-e2.indexOf(s[0])):i.sort((o,s)=>s[1]-o[1]);const r=i.reduce((o,[s,a])=>o+a,0);return _e.jsxs("div",{className:"rf-bg-white",children:[_e.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center",children:[_e.jsx("div",{children:"Render Logs"}),_e.jsxs("div",{className:"rf-mb-4 rf-pr-2 rf-flex rf-text-xs rf-items-center",children:[_e.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),_e.jsxs("select",{value:e,onChange:o=>t(o.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[_e.jsx("option",{value:"chronological",children:"Phase Order"}),_e.jsx("option",{value:"longest",children:"Duration"})]})]})]}),_e.jsx(mbn,{phaseTimings:n.phaseTimings}),_e.jsxs("table",{className:"rf-w-full rf-text-xs",children:[_e.jsx("thead",{children:_e.jsxs("tr",{children:[_e.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),_e.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),_e.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),_e.jsx("tbody",{children:i.map(([o,s])=>_e.jsxs("tr",{children:[_e.jsx("td",{className:"rf-p-2",children:e2.indexOf(o)}),_e.jsx("td",{className:"rf-p-2",children:o}),_e.jsx("td",{className:"rf-p-2",children:_e.jsx("div",{className:"rf-w-8",children:_e.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:CQe(o),width:`${s/r*100}%`}})})}),_e.jsx("td",{className:"rf-p-2",children:_e.jsxs("div",{className:"rf-flex w-full",children:[_e.jsxs("span",{className:"rf-flex-grow",children:[s,"ms"]}),_e.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(s/r*100).toFixed(1),"%"]})]})})]},o))})]})]})},AQe=({errorMessage:n,errorStack:e,circuitJsonErrors:t})=>{Ee.useEffect(()=>{if(n){const i=new Error(n);e&&(i.stack=e);try{cO.captureException(i)}catch{}}},[n,e]),Ee.useEffect(()=>{if(t&&t.length>0)for(const i of t){const r=new Error(i.message||"Circuit JSON Error");i.stack&&(r.stack=i.stack);try{cO.captureException(r,{error_type:i.type})}catch{}}},[t])},ybn="0.0.870";function gbn(n,e){const[t,i]=Ee.useState(()=>{try{const r=window.localStorage.getItem(n);return r?JSON.parse(r):e}catch(r){return console.error("Error reading from localStorage:",r),e}});return Ee.useEffect(()=>{try{window.localStorage.setItem(n,JSON.stringify(t))}catch(r){console.error("Error writing to localStorage:",r)}},[n,t]),[t,i]}const _me={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},yme=new Map,Mj=n=>{const e=yme.get(n);return e?Object.fromEntries(Object.entries(e.stores).map(([t,i])=>[t,i.getState()])):{}},vbn=(n,e,t)=>{if(n===void 0)return{type:"untracked",connection:e.connect(t)};const i=yme.get(t.name);if(i)return{type:"tracked",store:n,...i};const r={connection:e.connect(t),stores:{}};return yme.set(t.name,r),{type:"tracked",store:n,...r}},RQe=(n,e={})=>(t,i,r)=>{const{enabled:o,anonymousActionType:s,store:a,...c}=e;let l;try{l=(o??(_me?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!l)return(_me?"production":void 0)!=="production"&&o&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),n(t,i,r);const{connection:u,...d}=vbn(a,l,c);let h=!0;r.setState=(y,g,b)=>{const x=t(y,g);if(!h)return x;const w=b===void 0?{type:s||"anonymous"}:typeof b=="string"?{type:b}:b;return a===void 0?(u?.send(w,i()),x):(u?.send({...w,type:`${a}/${w.type}`},{...Mj(c.name),[a]:r.getState()}),x)};const f=(...y)=>{const g=h;h=!1,t(...y),h=g},m=n(r.setState,i,r);if(d.type==="untracked"?u?.init(m):(d.stores[d.store]=r,u?.init(Object.fromEntries(Object.entries(d.stores).map(([y,g])=>[y,y===d.store?m:g.getState()])))),r.dispatchFromDevtools&&typeof r.dispatch=="function"){let y=!1;const g=r.dispatch;r.dispatch=(...b)=>{(_me?"production":void 0)!=="production"&&b[0].type==="__setState"&&!y&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),y=!0),g(...b)}}return u.subscribe(y=>{var g;switch(y.type){case"ACTION":if(typeof y.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return gme(y.payload,b=>{if(b.type==="__setState"){if(a===void 0){f(b.state);return}Object.keys(b.state).length!==1&&console.error(`
5602
5602
  [zustand devtools middleware] Unsupported __setState action format.
5603
5603
  When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
5604
5604
  and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }