ShiboSoftwareDev/nema8-20mm-usbc-pd-controller

A 20×20 mm four-layer USB‑C PD stepper motor controller PCB using a CH32X035 MCU, TMC2209 driver, protected power inputs, USB data/boot interface, 3.3 V regulation, ESD/TVS protection, current-sense circuitry, and NEMA‑8 motor outputs.

Version
1.0.13
License
unset
Stars
0

dist/index.cjs

'use strict';

var jsxRuntime = require('react/jsx-runtime');
var react = require('react');
var capacityAutorouter = require('@tscircuit/capacity-autorouter');

const pinLabels$b = {
    pin1: ["cathode", "neg"],
    pin2: ["anode", "pos"],
};
const BAT54KFILM = (props) => {
    const { name = "D1", ...restProps } = props;
    return (jsxRuntime.jsx("diode", { name: name, pinLabels: pinLabels$b, supplierPartNumbers: {
            "jlcpcb": [
                "C283259"
            ]
        }, manufacturerPartNumber: "BAT54KFILM", footprint: jsxRuntime.jsxs("footprint", { children: [jsxRuntime.jsx("smtpad", { portHints: ["pin1"], points: [{ x: "-1.016mm", y: "0.2463038mm" }, { x: "-0.4064mm", y: "0.2463038mm" }, { x: "-0.4064mm", y: "-0.2362962mm" }, { x: "-1.016mm", y: "-0.2362962mm" }], shape: "polygon" }), jsxRuntime.jsx("smtpad", { portHints: ["pin2"], points: [{ x: "0.4064mm", y: "0.2362962mm" }, { x: "1.016mm", y: "0.2362962mm" }, { x: "1.016mm", y: "-0.2463038mm" }, { x: "0.4064mm", y: "-0.2463038mm" }], shape: "polygon" }), jsxRuntime.jsx("silkscreenpath", { route: [{ "x": 0.6602730000000037, "y": -0.3261614000000037 }, { "x": 0.6602730000000037, "y": -0.43185080000000653 }, { "x": -0.6605270000000019, "y": -0.43185080000000653 }, { "x": -0.6603999999999814, "y": -0.43180000000000973 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ "x": -0.6603999999999814, "y": 0.4317999999999955 }, { "x": -0.6603999999999814, "y": 0.4317999999999955 }, { "x": 0.6604000000000099, "y": 0.4317999999999955 }, { "x": 0.6604000000000099, "y": 0.3301999999999907 }] }), jsxRuntime.jsx("silkscreentext", { text: "{NAME}", pcbX: "-0.000127mm", pcbY: "1.4866386mm", anchorAlignment: "center", fontSize: "1mm" }), jsxRuntime.jsx("fabricationnotepath", { route: [{ "x": -0.8889999999999816, "y": 0.10563859999999181 }, { "x": -0.4825999999999908, "y": 0.10563859999999181 }, { "x": -0.4825999999999908, "y": 0.004038599999987014 }, { "x": -0.8889999999999816, "y": 0.004038599999987014 }, { "x": -0.8889999999999816, "y": 0.10563859999999181 }], strokeWidth: "0.254mm" }), jsxRuntime.jsx("fabricationnotepath", { route: [{ "x": 0.5588000000000051, "y": 0.08023859999998706 }, { "x": 0.9906000000000148, "y": 0.08023859999998706 }, { "x": 0.9906000000000148, "y": 0.004038599999987014 }, { "x": 0.5588000000000051, "y": 0.004038599999987014 }, { "x": 0.5588000000000051, "y": 0.08023859999998706 }], strokeWidth: "0.254mm" }), jsxRuntime.jsx("fabricationnotepath", { route: [{ "x": 0.7239000000000146, "y": -0.1864614000000131 }, { "x": 0.7239000000000146, "y": 0.24533859999999663 }, { "x": 0.8001000000000147, "y": 0.24533859999999663 }, { "x": 0.8001000000000147, "y": -0.1864614000000131 }, { "x": 0.7239000000000146, "y": -0.1864614000000131 }], strokeWidth: "0.254mm" }), jsxRuntime.jsx("courtyardoutline", { outline: [{ "x": -1.2661269999999973, "y": 0.736638599999992 }, { "x": 1.2658730000000133, "y": 0.736638599999992 }, { "x": 1.2658730000000133, "y": -0.728561400000018 }, { "x": -1.2661269999999973, "y": -0.728561400000018 }, { "x": -1.2661269999999973, "y": 0.736638599999992 }] })] }), cadModel: {
            objUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C283259.obj?uuid=84cf6c2b182949329e473e9158b1fb00",
            stepUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C283259.step?uuid=84cf6c2b182949329e473e9158b1fb00",
            pcbRotationOffset: 0,
            modelOriginPosition: { x: 0, y: -0.0040386000000012245, z: 0 },
        }, ...restProps }));
};

const pinLabels$a = {
    pin1: ["cathode", "neg"],
    pin2: ["anode", "pos"],
};
const BAT54WS = (props) => {
    const { name = "D1", ...restProps } = props;
    return (jsxRuntime.jsx("diode", { name: name, pinLabels: pinLabels$a, supplierPartNumbers: { jlcpcb: ["C7502694"] }, manufacturerPartNumber: "BAT54WS", footprint: jsxRuntime.jsxs("footprint", { children: [jsxRuntime.jsx("smtpad", { portHints: ["pin1", "cathode", "neg"], pcbX: "-1.139952mm", pcbY: "0mm", width: "0.8299958mm", height: "0.6299962mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin2", "anode", "pos"], pcbX: "1.139952mm", pcbY: "0mm", width: "0.8299958mm", height: "0.6299962mm", shape: "rect" }), jsxRuntime.jsx("silkscreenpath", { route: [{ x: 0.8889238, y: -0.4950968 }, { x: 0.8889238, y: -0.635 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ x: 0.8889238, y: 0.635 }, { x: 0.8889238, y: 0.495173 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ x: -0.8890762, y: 0.635 }, { x: -1.020064, y: 0.635 }, { x: -1.020064, y: 0.4950968 }, { x: -0.8890762, y: 0.4950968 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ x: -0.8890762, y: -0.635 }, { x: 0.8889238, y: -0.635 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ x: 0.1904238, y: 0.381 }, { x: 0.1904238, y: -0.381 }, { x: -0.1905762, y: 0 }, { x: 0.1904238, y: 0.381 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ x: -0.8890762, y: 0.635 }, { x: 0.8889238, y: 0.635 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ x: 0.5079238, y: 0 }, { x: -0.5080762, y: 0 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ x: -0.2540762, y: 0.381 }, { x: -0.2540762, y: -0.381 }] }), jsxRuntime.jsx("silkscreentext", { text: "{NAME}", pcbX: "0.004064mm", pcbY: "1.6604mm", anchorAlignment: "center", fontSize: "1mm" }), jsxRuntime.jsx("courtyardoutline", { outline: [{ x: -1.795336, y: 0.9104 }, { x: 1.803464, y: 0.9104 }, { x: 1.803464, y: -0.9104 }, { x: -1.795336, y: -0.9104 }, { x: -1.795336, y: 0.9104 }] })] }), cadModel: {
            objUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C7502694.obj?uuid=ca55f7f4aa2143938eb241550bbe4129",
            stepUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C7502694.step?uuid=ca55f7f4aa2143938eb241550bbe4129",
            pcbRotationOffset: 0,
            modelOriginPosition: { x: 0, y: 0, z: -0.55 },
        }, ...restProps }));
};

const pinLabels$9 = {
    pin1: ["pin1"],
    pin2: ["pin2"],
    pin3: ["pin3"],
    pin4: ["pin4"],
    pin5: ["pin5"]
};
const BM04B_SRSS_TB_LF__SN_ = (props) => {
    return (jsxRuntime.jsx("chip", { pinLabels: pinLabels$9, supplierPartNumbers: {
            "jlcpcb": [
                "C160390"
            ]
        }, manufacturerPartNumber: "BM04B-SRSS-TB(LF)(SN)", footprint: jsxRuntime.jsxs("footprint", { insertionDirection: "from_bottom", children: [jsxRuntime.jsx("smtpad", { portHints: ["pin1"], pcbX: "-1.499997mm", pcbY: "-1.3250037mm", width: "0.5999988mm", height: "1.5500096mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin2"], pcbX: "-0.499999mm", pcbY: "-1.3250037mm", width: "0.5999988mm", height: "1.5500096mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin3"], pcbX: "0.499999mm", pcbY: "-1.3250037mm", width: "0.5999988mm", height: "1.5500096mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin4"], pcbX: "1.499997mm", pcbY: "-1.3250037mm", width: "0.5999988mm", height: "1.5500096mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin5"], pcbX: "-2.799969mm", pcbY: "1.2000103mm", width: "1.1999976mm", height: "1.7999964mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin5"], pcbX: "2.799969mm", pcbY: "1.2000103mm", width: "1.1999976mm", height: "1.7999964mm", shape: "rect" }), jsxRuntime.jsx("silkscreenpath", { route: [{ "x": -1.8987769999999955, "y": 1.900796299999996 }, { "x": 1.9010629999999935, "y": 1.900796299999996 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ "x": -3.001137, "y": 0.0008763000000158172 }, { "x": -3.001137, "y": -0.999883699999998 }, { "x": -2.0994369999999947, "y": -0.999883699999998 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ "x": -2.500756999999993, "y": -0.999883699999998 }, { "x": -2.500756999999993, "y": 0.0008763000000158172 }, { "x": -2.500756999999993, "y": -0.999883699999998 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ "x": -2.500756999999993, "y": -0.40044369999999674 }, { "x": -3.001137, "y": -0.40044369999999674 }, { "x": -2.500756999999993, "y": -0.40044369999999674 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ "x": 3.0008830000000017, "y": 0.0008763000000158172 }, { "x": 3.0008830000000017, "y": -0.999883699999998 }, { "x": 2.0991830000000107, "y": -0.999883699999998 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ "x": 2.500502999999995, "y": -0.999883699999998 }, { "x": 2.500502999999995, "y": 0.0008763000000158172 }, { "x": 2.500502999999995, "y": -0.999883699999998 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ "x": 2.500502999999995, "y": -0.40044369999999674 }, { "x": 3.0008830000000017, "y": -0.40044369999999674 }, { "x": 2.500502999999995, "y": -0.40044369999999674 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ "x": -1.8987769999999955, "y": 0.9990962999999908 }, { "x": -1.8987769999999955, "y": 1.4994762999999978 }, { "x": 1.9010629999999935, "y": 1.4994762999999978 }, { "x": 1.9010629999999935, "y": 0.9990962999999908 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ "x": -1.8987769999999955, "y": 0.39965630000001795 }, { "x": -1.8987769999999955, "y": -0.25058369999999286 }, { "x": 1.9010629999999935, "y": -0.25058369999999286 }, { "x": 1.9010629999999935, "y": 0.39965630000001795 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ "x": -1.4999969999999934, "y": 0.9990962999999908 }, { "x": -1.4999969999999934, "y": 0.8009763000000021 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ "x": -0.4992369999999937, "y": 0.9990962999999908 }, { "x": -0.4992369999999937, "y": 0.8009763000000021 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ "x": 0.4989830000000097, "y": 0.9990962999999908 }, { "x": 0.4989830000000097, "y": 0.8009763000000021 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ "x": 1.4997429999999952, "y": 0.9990962999999908 }, { "x": 1.4997429999999952, "y": 0.8009763000000021 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ "x": -2.249982800000012, "y": -1.6499967000000026 }, { "x": -2.342729725363057, "y": -1.4554478696548045 }, { "x": -2.5523478589418005, "y": -1.4053332248097234 }, { "x": -2.7230600507568, "y": -1.536895328466926 }, { "x": -2.7280019964004794, "y": -1.7523641585241592 }, { "x": -2.5635011023114913, "y": -1.8916146357114911 }, { "x": -2.351805763763423, "y": -1.8511631438971818 }, { "x": -2.2502368000000246, "y": -1.661071100000001 }] }), jsxRuntime.jsx("silkscreentext", { text: "{NAME}", pcbX: "-0.001397mm", pcbY: "3.1039963mm", anchorAlignment: "center", fontSize: "1mm" }), jsxRuntime.jsx("courtyardoutline", { outline: [{ "x": -3.6549969999999945, "y": 2.3539963000000057 }, { "x": 3.652203, "y": 2.3539963000000057 }, { "x": 3.652203, "y": -2.337003699999997 }, { "x": -3.6549969999999945, "y": -2.337003699999997 }, { "x": -3.6549969999999945, "y": 2.3539963000000057 }] })] }), cadModel: {
            objUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C160390.obj?uuid=9af647057cdd4d60966c8713812af180",
            stepUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C160390.step?uuid=9af647057cdd4d60966c8713812af180",
            pcbRotationOffset: 0,
            modelOriginPosition: { x: 1.5, y: -0.4325029999999981, z: -0.01 },
        }, ...props }));
};

const pinLabels$8 = {
    pin1: ["pin1"],
    pin2: ["pin2"]
};
const BSMD1206_110_16V = (props) => {
    return (jsxRuntime.jsx("chip", { pinLabels: pinLabels$8, symbol: jsxRuntime.jsxs("symbol", { children: [jsxRuntime.jsx("schematictext", { text: "{REF}", schX: 0, schY: 0.24, anchor: "bottom_center", fontSize: 0.16 }), jsxRuntime.jsx("schematicrect", { schX: 0, schY: 0, width: 0.52, height: 0.12, strokeWidth: 0.02, color: "#880000" }), jsxRuntime.jsx("port", { name: "pin1", pinNumber: 1, aliases: ["1"], direction: "left", schX: -0.4, schY: 0, schStemLength: 0.2 }), jsxRuntime.jsx("port", { name: "pin2", pinNumber: 2, aliases: ["2"], direction: "right", schX: 0.4, schY: 0, schStemLength: 0.2 }), jsxRuntime.jsx("schematicpath", { points: [{ "x": -0.2, "y": 0 }, { "x": 0.2, "y": 0 }], strokeColor: "#8D2323" })] }), supplierPartNumbers: {
            "jlcpcb": [
                "C2803346"
            ]
        }, manufacturerPartNumber: "BSMD1206-110-16V", footprint: "smdpads2_p2.89mm_pw1.1901mm_ph1.728mm", cadModel: {
            objUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C2803346.obj?uuid=7dbd95a5ee9a45949b72cb8147e267ff",
            stepUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C2803346.step?uuid=7dbd95a5ee9a45949b72cb8147e267ff",
            pcbRotationOffset: 0,
            modelOriginPosition: { x: 0, y: -12699999999199463e-21, z: 0 },
        }, ...props }));
};

const pinLabels$7 = {
    pin1: ["VDD"],
    pin2: ["PA0", "STEP_OUT"],
    pin3: ["PA1", "DIR_OUT"],
    pin4: ["PA2", "ENABLE_OUT"],
    pin5: ["PA3", "UART1"],
    pin6: ["PA4", "STDBY_OUT"],
    pin7: ["PA5", "DIAG_IN"],
    pin8: ["PA6"],
    pin9: ["PA7", "VBUS_ADC"],
    pin10: ["PB0"],
    pin11: ["PB1"],
    pin12: ["PB3"],
    pin13: ["PB11"],
    pin14: ["PC18", "DIO"],
    pin15: ["PB12"],
    pin16: ["PC19", "DCK"],
    pin17: ["PC16", "USB_DM"],
    pin18: ["PC17", "USB_DP"],
    pin19: ["PC14", "CC1"],
    pin20: ["PC15", "CC2"],
    pin21: ["GND"]
};
const pinAttributes$2 = {
    pin1: { requiresPower: true },
    pin21: { requiresGround: true }
};
const footprinterPinLabels$2 = {
    ...pinLabels$7,
    "pin21": [...pinLabels$7["pin21"], "thermalpad"],
};
const CH32X035F8U6 = (props) => {
    return (jsxRuntime.jsx("chip", { pinLabels: footprinterPinLabels$2, pinAttributes: pinAttributes$2, supplierPartNumbers: {
            "jlcpcb": [
                "C42442062"
            ]
        }, manufacturerPartNumber: "CH32X035F8U6", footprint: "qfn20_thermalpad1.7mmx1.7mm_p0.4mm_h4mm_pw0.2mm_pl0.8mm", cadModel: {
            objUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C42442062.obj?uuid=71760926877f42c6b0f5954e672bfe89",
            stepUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C42442062.step?uuid=71760926877f42c6b0f5954e672bfe89",
            pcbRotationOffset: 270,
            modelOriginPosition: { x: 0, y: 0, z: 0 },
        }, ...props }));
};

const pinLabels$6 = {
    pin1: ["GND"],
    pin2: ["VOUT"],
    pin3: ["VIN"],
};
const pinAttributes$1 = {
    pin1: { requiresGround: true },
    pin3: { requiresPower: true },
};
const HT7533_1 = (props) => {
    return (jsxRuntime.jsx("chip", { pinLabels: pinLabels$6, pinAttributes: pinAttributes$1, supplierPartNumbers: { jlcpcb: ["C49374775"] }, manufacturerPartNumber: "HT7533-1", footprint: jsxRuntime.jsxs("footprint", { children: [jsxRuntime.jsx("smtpad", { portHints: ["pin1"], pcbX: "0.999998mm", pcbY: "-0.94996mm", width: "0.999998mm", height: "0.6500114mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin2"], pcbX: "0.999998mm", pcbY: "0.94996mm", width: "0.999998mm", height: "0.6500114mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin3"], pcbX: "-0.999998mm", pcbY: "0mm", width: "0.999998mm", height: "0.6500114mm", shape: "rect" }), jsxRuntime.jsx("silkscreenpath", { route: [{ x: 0.7262114, y: 1.5262098 }, { x: -0.7262114, y: 1.5262098 }, { x: -0.7262114, y: 0.4945888 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ x: 0.7262114, y: -1.5262098 }, { x: -0.7262114, y: -1.5262098 }, { x: -0.7262114, y: -0.4945888 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ x: 0.7262114, y: 0.4553966 }, { x: 0.7262114, y: -0.4553966 }] }), jsxRuntime.jsx("courtyardoutline", { outline: [
                        { x: -1.7486, y: 1.774 },
                        { x: 1.7994, y: 1.774 },
                        { x: 1.7994, y: -1.774 },
                        { x: -1.7486, y: -1.774 },
                        { x: -1.7486, y: 1.774 },
                    ] })] }), cadModel: {
            objUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C49374775.obj?uuid=d777607a152f4f3aac9bb0d0c14ed6fd",
            stepUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C49374775.step?uuid=d777607a152f4f3aac9bb0d0c14ed6fd",
            pcbRotationOffset: 180,
            modelOriginPosition: { x: 0.0000127, y: -127e-7, z: 0.050795 },
        }, ...props }));
};

const pinLabels$5 = {
    pin1: ["cathode", "neg"],
    pin2: ["anode", "pos"]
};
const PMEG6020ELRX = (props) => {
    const { name = "D1", ...restProps } = props;
    return (jsxRuntime.jsx("diode", { name: name, pinLabels: pinLabels$5, supplierPartNumbers: {
            "jlcpcb": [
                "C478000"
            ]
        }, manufacturerPartNumber: "PMEG6020ELRX", footprint: "smdpads2_p3.3848mm_pw0.95mm_ph1.15mm", cadModel: {
            objUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C478000.obj?uuid=ffe28a36cfa04cde86eca0e275be7a76",
            stepUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C478000.step?uuid=ffe28a36cfa04cde86eca0e275be7a76",
            pcbRotationOffset: 0,
            modelOriginPosition: { x: 0, y: 0, z: -0.55 },
        }, ...restProps }));
};

const PT1206FR_7W0R33L = (props) => {
    const { name = "R1", ...restProps } = props;
    return (jsxRuntime.jsx("resistor", { name: name, resistance: "330mohm", supplierPartNumbers: {
            "jlcpcb": [
                "C858786"
            ]
        }, manufacturerPartNumber: "PT1206FR-7W0R33L", footprint: "smdpads2_p2.9576mm_pw1.2075mm_ph1.701mm", cadModel: {
            objUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C858786.obj?uuid=da5f078ee43c429f91838a456f48f0a8",
            stepUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C858786.step?uuid=da5f078ee43c429f91838a456f48f0a8",
            pcbRotationOffset: 0,
            modelOriginPosition: { x: 0, y: 0, z: 0 },
        }, ...restProps }));
};

const pinLabels$4 = {
    pin1: ["OB2"],
    pin2: ["ENN"],
    pin3: ["GND2"],
    pin4: ["CPO"],
    pin5: ["CPI"],
    pin6: ["VCP"],
    pin7: ["SPREAD"],
    pin8: ["5VOUT"],
    pin9: ["MS1_AD0"],
    pin10: ["MS2_AD1"],
    pin11: ["DIAG"],
    pin12: ["INDEX"],
    pin13: ["CLK"],
    pin14: ["PDN_UART"],
    pin15: ["VCC_IO"],
    pin16: ["STEP"],
    pin17: ["VREF"],
    pin18: ["GND1"],
    pin19: ["DIR"],
    pin20: ["STDBY"],
    pin21: ["OA2"],
    pin22: ["VS2"],
    pin23: ["BRA"],
    pin24: ["OA1"],
    pin25: ["UNUSED"],
    pin26: ["OB1"],
    pin27: ["BRB"],
    pin28: ["VS1"],
    pin29: ["EP"]
};
const pinAttributes = {
    pin3: { requiresGround: true },
    pin18: { requiresGround: true },
    pin29: { requiresGround: true }
};
const footprinterPinLabels$1 = {
    ...pinLabels$4,
    "pin29": [...pinLabels$4["pin29"], "thermalpad"],
};
const TMC2209_LA_T = (props) => {
    const bottomPins = [-1.5, -1, -0.5, 0, 0.5, 1, 1.5];
    const sidePins = [-1.5, -1, -0.5, 0, 0.5, 1, 1.5];
    return (jsxRuntime.jsx("chip", { pinLabels: footprinterPinLabels$1, pinAttributes: pinAttributes, supplierPartNumbers: {
            "jlcpcb": [
                "C2150710"
            ]
        }, manufacturerPartNumber: "TMC2209-LA-T", footprint: jsxRuntime.jsxs("footprint", { children: [bottomPins.map((x, index) => (jsxRuntime.jsx(react.Fragment, { children: jsxRuntime.jsx("smtpad", { portHints: [`pin${index + 1}`], pcbX: `${x}mm`, pcbY: "-2.5mm", width: "0.9mm", height: "0.28mm", shape: "rotated_pill", radius: "0.14mm", ccwRotation: 90 }) }, `bottom-${index}`))), sidePins.map((y, index) => (jsxRuntime.jsx(react.Fragment, { children: jsxRuntime.jsx("smtpad", { portHints: [`pin${index + 8}`], pcbX: "2.5mm", pcbY: `${y}mm`, width: "0.28mm", height: "0.9mm", shape: "rotated_pill", radius: "0.14mm", ccwRotation: 90 }) }, `right-${index}`))), bottomPins.map((x, index) => (jsxRuntime.jsx(react.Fragment, { children: jsxRuntime.jsx("smtpad", { portHints: [`pin${index + 15}`], pcbX: `${1.5 - index * 0.5}mm`, pcbY: "2.5mm", width: "0.9mm", height: "0.28mm", shape: "rotated_pill", radius: "0.14mm", ccwRotation: 90 }) }, `top-${index}`))), sidePins.map((y, index) => (jsxRuntime.jsx(react.Fragment, { children: jsxRuntime.jsx("smtpad", { portHints: [`pin${index + 22}`], pcbX: "-2.5mm", pcbY: `${1.5 - index * 0.5}mm`, width: "0.28mm", height: "0.9mm", shape: "rotated_pill", radius: "0.14mm", ccwRotation: 90 }) }, `left-${index}`))), jsxRuntime.jsx("smtpad", { portHints: ["pin29", "thermalpad"], pcbX: "0mm", pcbY: "0mm", width: "3.5mm", height: "3.5mm", shape: "rect" }), jsxRuntime.jsx("silkscreenpath", { route: [{ x: -2.8, y: -2.8 }, { x: 2.8, y: -2.8 }, { x: 2.8, y: 2.8 }, { x: -2.8, y: 2.8 }, { x: -2.8, y: -2.8 }] }), jsxRuntime.jsx("courtyardoutline", { outline: [{ x: -2.95, y: -2.95 }, { x: 2.95, y: -2.95 }, { x: 2.95, y: 2.95 }, { x: -2.95, y: 2.95 }, { x: -2.95, y: -2.95 }] })] }), cadModel: {
            objUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C2150710.obj?uuid=ae12e1b5ea7a411e8a6f7d8e9f5ed919",
            stepUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C2150710.step?uuid=ae12e1b5ea7a411e8a6f7d8e9f5ed919",
            pcbRotationOffset: 90,
            modelOriginPosition: { x: -6349999998889189e-20, y: -6349999999599731e-20, z: -0.02 },
        }, ...props }));
};

const pinLabels$3 = {
    pin101: ["1"],
    pin102: ["2"],
};
const TL3780AF100QG = (props) => {
    return (jsxRuntime.jsx("chip", { pinLabels: pinLabels$3, symbol: jsxRuntime.jsxs("symbol", { children: [jsxRuntime.jsx("schematictext", { text: "{REF}", schX: 0, schY: 0.32, anchor: "bottom_center", fontSize: 0.16 }), jsxRuntime.jsx("schematicpath", { points: [{ x: -0.2, y: 0 }, { x: 0.14, y: 0.1 }], strokeColor: "#880000" }), jsxRuntime.jsx("schematiccircle", { center: { x: 0.18, y: 0 }, radius: 0.02, strokeWidth: 0.02, color: "#880000" }), jsxRuntime.jsx("port", { name: "pin102", pinNumber: 102, aliases: ["2"], direction: "right", schX: 0.6, schY: 0, schStemLength: 0.4 }), jsxRuntime.jsx("port", { name: "pin101", pinNumber: 101, aliases: ["1"], direction: "left", schX: -0.6, schY: 0, schStemLength: 0.4 })] }), supplierPartNumbers: { jlcpcb: ["C2886892"] }, manufacturerPartNumber: "TL3780AF100QG", footprint: jsxRuntime.jsxs("footprint", { children: [jsxRuntime.jsx("smtpad", { portHints: ["pin102"], pcbX: "1.650492mm", pcbY: "0mm", width: "0.7999984mm", height: "1.524mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin101"], pcbX: "-1.650492mm", pcbY: "0mm", width: "0.7999984mm", height: "1.524mm", shape: "rect" }), jsxRuntime.jsx("silkscreenpath", { route: [{ x: 1.499489, y: 1.0000234 }, { x: -1.5005304, y: 1.0000234 }] }), jsxRuntime.jsx("silkscreenpath", { route: [{ x: -1.500505, y: -0.9999726 }, { x: 1.499489, y: -0.9999726 }] }), jsxRuntime.jsx("silkscreencircle", { pcbX: "-0.000508mm", pcbY: "0mm", radius: "0.635mm" }), jsxRuntime.jsx("silkscreentext", { text: "{NAME}", pcbX: "-0.017018mm", pcbY: "1.991616mm", anchorAlignment: "center", fontSize: "1mm" }), jsxRuntime.jsx("courtyardoutline", { outline: [{ x: -2.311718, y: 1.241616 }, { x: 2.277682, y: 1.241616 }, { x: 2.277682, y: -1.290384 }, { x: -2.311718, y: -1.290384 }, { x: -2.311718, y: 1.241616 }] })] }), cadModel: {
            objUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C2886892.obj?uuid=965cd0ca6c094e7c81ef6da0eb45e1aa",
            stepUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C2886892.step?uuid=965cd0ca6c094e7c81ef6da0eb45e1aa",
            pcbRotationOffset: 0,
            modelOriginPosition: { x: 0.0000127, y: 0.0005, z: -0.285 },
        }, ...props }));
};

const pinLabels$2 = {
    pin1: ["EH2"],
    pin2: ["EH1"],
    pin3: ["EH4"],
    pin4: ["EH3"],
    pin5: ["B8", "SBU2"],
    pin6: ["A5", "CC1"],
    pin7: ["B7", "DN2"],
    pin8: ["A6", "DP1"],
    pin9: ["A7", "DN1"],
    pin10: ["B6", "DP2"],
    pin11: ["A8", "SBU1"],
    pin12: ["B5", "CC2"],
    pin13: ["A1B12", "GND1"],
    pin14: ["B1A12", "GND2"],
    pin15: ["B4A9", "VBUS1"],
    pin16: ["A4B9", "VBUS2"]
};
const footprinterPinLabels = {
    ...pinLabels$2,
    "pin4": [...pinLabels$2["pin4"], "pin1"],
    "pin1": [...pinLabels$2["pin1"], "pin2"],
    "pin2": [...pinLabels$2["pin2"], "pin4"],
};
const TYPE_C_31_M_12 = (props) => {
    return (jsxRuntime.jsx("chip", { pinLabels: footprinterPinLabels, supplierPartNumbers: {
            "jlcpcb": [
                "C165948"
            ]
        }, manufacturerPartNumber: "TYPE-C-31-M-12", footprint: "usbcmidmount16_tophw0.8mm_bottomhw0.8mm_tophh1.6mm_bottomhh1.4mm_topring0.2mm_bottomring0.2mm_rowy2.174mm_ph1.3mm_pw0.3mm_powerpw0.6mm_powerx3.2mm_shellx4.3251mm_topy1.4057mm_bottomy2.7741mm_holex2.8999mm_holey0.9056mm_holed0.6mm", cadModel: {
            objUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C165948.obj?uuid=617b05f9bba7410b96c001093d8189e4",
            stepUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C165948.step?uuid=617b05f9bba7410b96c001093d8189e4",
            pcbRotationOffset: 180,
            modelOriginPosition: { x: 0, y: -2.7500289000000517, z: 0.000010999999999872223 },
        }, ...props }));
};

const pinLabels$1 = {
    pin7: ["EP1"],
    pin8: ["EP2"],
    pin9: ["B12", "GND1"],
    pin10: ["B9", "VBUS1"],
    pin11: ["A5", "CC1"],
    pin12: ["B5", "CC2"],
    pin13: ["A9", "VBUS2"],
    pin14: ["A12", "GND2"],
};
/**
 * Compact power-only edge-entry USB-C receptacle, JLCPCB C30167333.
 *
 * EasyEDA does not publish a 3D mesh for the exact "108" library record.
 * The CAD asset below is from SHOU HAN C5187462, the matching TYPE-C 6P
 * LTH5.5 housing family.  It is used only for 3D visualization and mechanical
 * envelope checking; the footprint and assembly BOM remain the exact
 * C30167333 part.
 */
const TYPE_C_6P_LTH5_5_108 = (props) => (jsxRuntime.jsx("chip", { pinLabels: pinLabels$1, supplierPartNumbers: { jlcpcb: ["C30167333"] }, manufacturerPartNumber: "TYPE-C 6P LTH5.5 108", footprint: jsxRuntime.jsxs("footprint", { children: [jsxRuntime.jsx("platedhole", { portHints: ["pin7"], pcbX: "4.300093mm", pcbY: "-0.73755245mm", holeWidth: "0.5500116mm", holeHeight: "1.3999972mm", outerWidth: "0.9500108mm", outerHeight: "1.7999964mm", shape: "pill" }), jsxRuntime.jsx("platedhole", { portHints: ["pin8"], pcbX: "-4.300093mm", pcbY: "-0.73755245mm", holeWidth: "0.5500116mm", holeHeight: "1.3999972mm", outerWidth: "0.9500108mm", outerHeight: "1.7999964mm", shape: "pill" }), jsxRuntime.jsx("smtpad", { portHints: ["pin9"], pcbX: "-2.749931mm", pcbY: "0.06254755mm", width: "0.8999982mm", height: "1.4500098mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin10"], pcbX: "-1.650111mm", pcbY: "0.06254755mm", width: "0.7999984mm", height: "1.4500098mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin11"], pcbX: "-0.550037mm", pcbY: "0.06254755mm", width: "0.7999984mm", height: "1.4500098mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin12"], pcbX: "0.550037mm", pcbY: "0.06254755mm", width: "0.7999984mm", height: "1.4500098mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin13"], pcbX: "1.650111mm", pcbY: "0.06254755mm", width: "0.7999984mm", height: "1.4500098mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin14"], pcbX: "2.749931mm", pcbY: "0.06254755mm", width: "0.8999982mm", height: "1.4500098mm", shape: "rect" }), jsxRuntime.jsx("silkscreenpath", { route: [
                    { x: -4.4, y: -2.69 }, { x: 4.45, y: -2.69 },
                    { x: 4.45, y: 0.41 }, { x: 3.43, y: 0.41 },
                ] }), jsxRuntime.jsx("silkscreenpath", { route: [
                    { x: -3.43, y: 0.41 }, { x: -4.4, y: 0.41 }, { x: -4.4, y: -2.69 },
                ] }), jsxRuntime.jsx("courtyardoutline", { outline: [
                    { x: -5.03, y: 1.05 }, { x: 5.03, y: 1.05 },
                    { x: 5.03, y: -3.01 }, { x: -5.03, y: -3.01 }, { x: -5.03, y: 1.05 },
                ] })] }), cadModel: {
        objUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C5187462.obj?uuid=647e2155cced47aabcd711df0900bb6d",
        stepUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C5187462.step?uuid=647e2155cced47aabcd711df0900bb6d",
        pcbRotationOffset: 0,
        modelOriginPosition: {
            x: 0,
            y: 1.06695589999994,
            z: -6.000000001282757e-7,
        },
    }, ...props }));

const pinLabels = {
    pin401: ["DM_IN"],
    pin402: ["GND"],
    pin403: ["DP_IN"],
    pin404: ["DP_OUT"],
    pin405: ["VBUS"],
    pin406: ["DM_OUT"]
};
const USBLC6_2SC6 = (props) => {
    return (jsxRuntime.jsx("chip", { pinLabels: pinLabels, symbol: jsxRuntime.jsxs("symbol", { children: [jsxRuntime.jsx("schematictext", { text: "{REF}", schX: 0, schY: 1.18, anchor: "bottom_center", fontSize: 0.16 }), jsxRuntime.jsx("schematicpath", { points: [{ "x": -0.9, "y": 1 }, { "x": 0.9, "y": 1 }, { "x": 0.9, "y": -1 }, { "x": -0.9, "y": -1 }, { "x": -0.9, "y": 1 }], strokeWidth: 0.02, strokeColor: "#880000", isFilled: true, fillColor: "#FFFFFF" }), jsxRuntime.jsx("port", { name: "pin401", pinNumber: 401, aliases: ["DM_IN"], direction: "left", schX: -1.3, schY: 0.6, schStemLength: 0.4 }), jsxRuntime.jsx("port", { name: "pin402", pinNumber: 402, aliases: ["GND"], direction: "left", schX: -1.3, schY: 0, schStemLength: 0.4 }), jsxRuntime.jsx("port", { name: "pin403", pinNumber: 403, aliases: ["DP_IN"], direction: "left", schX: -1.3, schY: -0.6, schStemLength: 0.4 }), jsxRuntime.jsx("port", { name: "pin404", pinNumber: 404, aliases: ["DP_OUT"], direction: "right", schX: 1.3, schY: -0.6, schStemLength: 0.4 }), jsxRuntime.jsx("port", { name: "pin405", pinNumber: 405, aliases: ["VBUS"], direction: "right", schX: 1.3, schY: 0, schStemLength: 0.4 }), jsxRuntime.jsx("port", { name: "pin406", pinNumber: 406, aliases: ["DM_OUT"], direction: "right", schX: 1.3, schY: 0.6, schStemLength: 0.4 }), jsxRuntime.jsx("schematicpath", { points: [{ "x": -0.9, "y": 0.6 }, { "x": 0.9, "y": 0.6 }], strokeColor: "#880000" }), jsxRuntime.jsx("schematicpath", { points: [{ "x": -0.9, "y": -0.6 }, { "x": 0.9, "y": -0.6 }], strokeColor: "#880000" }), jsxRuntime.jsx("schematicpath", { points: [{ "x": -0.9, "y": 0 }, { "x": 0.9, "y": 0 }], strokeColor: "#880000" }), jsxRuntime.jsx("schematicpath", { svgPath: "M -0.14 -0.12 L 0.06 0 L -0.14 0.14 Z", strokeColor: "#880000", isFilled: true, fillColor: "#880000" }), jsxRuntime.jsx("schematicpath", { points: [{ "x": 0.1, "y": 0.16 }, { "x": 0.06, "y": 0.16 }, { "x": 0.06, "y": -0.14 }, { "x": 0, "y": -0.14 }], strokeColor: "#880000" }), jsxRuntime.jsx("schematicpath", { points: [{ "x": -0.68, "y": 0 }, { "x": -0.68, "y": 0.4 }, { "x": 0.66, "y": 0.4 }, { "x": 0.66, "y": -0.4 }, { "x": -0.68, "y": -0.4 }, { "x": -0.68, "y": 0 }], strokeColor: "#880000" }), jsxRuntime.jsx("schematicpath", { points: [{ "x": 0, "y": 0.6 }, { "x": 0, "y": 0.4 }], strokeColor: "#880000" }), jsxRuntime.jsx("schematicpath", { points: [{ "x": 0, "y": -0.6 }, { "x": 0, "y": -0.4 }], strokeColor: "#880000" }), jsxRuntime.jsx("schematicpath", { svgPath: "M -0.46 0.28 L -0.26 0.4 L -0.46 0.54 Z", strokeColor: "#880000", isFilled: true, fillColor: "#880000" }), jsxRuntime.jsx("schematicpath", { points: [{ "x": -0.26, "y": 0.56 }, { "x": -0.26, "y": 0.56 }, { "x": -0.26, "y": 0.26 }, { "x": -0.26, "y": 0.26 }], strokeColor: "#880000" }), jsxRuntime.jsx("schematicpath", { svgPath: "M 0.22 0.28 L 0.42 0.4 L 0.22 0.54 Z", strokeColor: "#880000", isFilled: true, fillColor: "#880000" }), jsxRuntime.jsx("schematicpath", { points: [{ "x": 0.42, "y": 0.56 }, { "x": 0.42, "y": 0.56 }, { "x": 0.42, "y": 0.26 }, { "x": 0.42, "y": 0.26 }], strokeColor: "#880000" }), jsxRuntime.jsx("schematicpath", { svgPath: "M -0.48 -0.52 L -0.28 -0.4 L -0.48 -0.26 Z", strokeColor: "#880000", isFilled: true, fillColor: "#880000" }), jsxRuntime.jsx("schematicpath", { points: [{ "x": -0.28, "y": -0.24 }, { "x": -0.28, "y": -0.24 }, { "x": -0.28, "y": -0.54 }, { "x": -0.28, "y": -0.54 }], strokeColor: "#880000" }), jsxRuntime.jsx("schematicpath", { svgPath: "M 0.22 -0.52 L 0.42 -0.4 L 0.22 -0.26 Z", strokeColor: "#880000", isFilled: true, fillColor: "#880000" }), jsxRuntime.jsx("schematicpath", { points: [{ "x": 0.42, "y": -0.24 }, { "x": 0.42, "y": -0.24 }, { "x": 0.42, "y": -0.54 }, { "x": 0.42, "y": -0.54 }], strokeColor: "#880000" }), jsxRuntime.jsx("schematiccircle", { center: { x: 0, y: 0.6 }, radius: 0.02, strokeWidth: 0.02, color: "#880000" }), jsxRuntime.jsx("schematiccircle", { center: { x: 0, y: 0.4 }, radius: 0.02, strokeWidth: 0.02, color: "#880000" }), jsxRuntime.jsx("schematiccircle", { center: { x: -0.68, y: 0 }, radius: 0.02, strokeWidth: 0.02, color: "#880000" }), jsxRuntime.jsx("schematiccircle", { center: { x: 0.66, y: 0 }, radius: 0.02, strokeWidth: 0.02, color: "#880000" }), jsxRuntime.jsx("schematiccircle", { center: { x: 0, y: -0.4 }, radius: 0.02, strokeWidth: 0.02, color: "#880000" }), jsxRuntime.jsx("schematiccircle", { center: { x: 0, y: -0.6 }, radius: 0.02, strokeWidth: 0.02, color: "#880000" })] }), supplierPartNumbers: {
            "jlcpcb": [
                "C7519"
            ]
        }, manufacturerPartNumber: "USBLC6-2SC6", footprint: jsxRuntime.jsxs("footprint", { children: [jsxRuntime.jsx("smtpad", { portHints: ["pin401"], pcbX: "1.1491mm", pcbY: "-0.95mm", width: "1.072mm", height: "0.532mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin402"], pcbX: "1.1491mm", pcbY: "0mm", width: "1.072mm", height: "0.532mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin403"], pcbX: "1.1491mm", pcbY: "0.95mm", width: "1.072mm", height: "0.532mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin404"], pcbX: "-1.1491mm", pcbY: "0.95mm", width: "1.072mm", height: "0.532mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin405"], pcbX: "-1.1491mm", pcbY: "0mm", width: "1.072mm", height: "0.532mm", shape: "rect" }), jsxRuntime.jsx("smtpad", { portHints: ["pin406"], pcbX: "-1.1491mm", pcbY: "-0.95mm", width: "1.072mm", height: "0.532mm", shape: "rect" }), jsxRuntime.jsx("courtyardoutline", { outline: [
                        { x: -1.6851, y: -1.216 }, { x: 1.6851, y: -1.216 },
                        { x: 1.6851, y: 1.216 }, { x: -1.6851, y: 1.216 },
                        { x: -1.6851, y: -1.216 },
                    ] })] }), cadModel: {
            objUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C7519.obj?uuid=229b69761e2c45dba6a83d8866dec72d",
            stepUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C7519.step?uuid=229b69761e2c45dba6a83d8866dec72d",
            pcbRotationOffset: 90,
            modelOriginPosition: { x: -12700000070253736e-21, y: 0.000012700000070253736, z: -0.048939 },
        }, ...props }));
};

const resistorParts = {
    "27": "C25100",
    "1k": "C11702",
    "4.7k": "C25900",
    "5.1k": "C25905",
    "10k": "C25744",
    "12k": "C25752",
    "47k": "C25792",
    "100k": "C25741",
    "270k": "C25770",
};
const capacitorParts = {
    "22nF_50V": { part: "C1532", footprint: "0402", voltage: "50V" },
    "100nF": { part: "C1525", footprint: "0402", voltage: "16V" },
    "100nF_50V": { part: "C14663", footprint: "0603", voltage: "50V" },
    "2.2uF_10V": { part: "C107370", footprint: "0402", voltage: "10V" },
    "2.2uF": { part: "C23630", footprint: "0603", voltage: "16V" },
    "10uF_25V": { part: "C96446", footprint: "0603", voltage: "25V" },
};
const R = ({ name, resistance, connections: _connections, ...props }) => (jsxRuntime.jsx("resistor", { name: name, resistance: resistance, footprint: "0402", supplierPartNumbers: { jlcpcb: [resistorParts[resistance]] }, ...props }));
const C = ({ name, value, connections: _connections, ...props }) => {
    const item = capacitorParts[value];
    return (jsxRuntime.jsx("capacitor", { name: name, capacitance: value.replace(/_\d+V$/, ""), footprint: item.footprint, maxVoltageRating: item.voltage, maxDecouplingTraceLength: "50mm", supplierPartNumbers: { jlcpcb: [item.part] }, ...props }));
};
const nets = [
    "GND",
    "PD_VBUS_RAW",
    "PD_VBUS_FUSED",
    "VM",
    "USB_5V",
    "LOGIC_IN",
    "VIO",
    "PD_CC1",
    "PD_CC2",
    "DATA_CC1",
    "DATA_CC2",
    "USB_DM_CONN",
    "USB_DP_CONN",
    "USB_DM",
    "USB_DP",
    "BOOT_BIAS",
    "VBUS_ADC",
    "DIAG",
    "STEP",
    "DIR",
    "ENN",
    "STDBY",
    "UART_MCU",
    "UART_DRV",
    "V5_DRV",
    "VREF",
    "CP_HI",
    "CP_LO",
    "VCP",
    "SENSE_A",
    "SENSE_B",
    "MOTOR_A_NEG",
    "MOTOR_A_POS",
    "MOTOR_B_POS",
    "MOTOR_B_NEG",
];
const sheets = {
    power: "power",
    control: "control",
    driver: "driver",
};
const sections = {
    pdInput: "pd_input",
    logicPower: "logic_power",
    usbData: "usb_data",
    controller: "controller",
    driverCore: "driver_core",
};
const driverX = 0;
const driverY = -0.5;
const mcuX = 5.6;
const mcuY = 0;
const thermalViaOffsets = [
    [-0.7, -0.7], [-0.7, 0.7], [0.7, -0.7], [0.7, 0.7],
];
const traceWidthForNet = (name) => {
    if (name.startsWith("MOTOR_"))
        return "0.3mm";
    if (name.startsWith("SENSE_"))
        return "0.3mm";
    if (name === "PD_VBUS_RAW" || name === "PD_VBUS_FUSED")
        return "0.5mm";
    if (name === "VM")
        return "0.4mm";
    if (["USB_5V", "LOGIC_IN", "VIO", "V5_DRV", "VCP"].includes(name))
        return "0.25mm";
    return "0.15mm";
};
// Ground is carried by a dedicated inner-1 plane. Every outer-layer ground
// land gets a full-stack 0.30/0.45 mm through-via fanout into that plane.
const usbGroundVias = [
    { from: ".J_USB_PD > .GND1", x: -4, y: 0.06254755 },
    { from: ".J_USB_PD > .GND2", x: 2.749931, y: 0.06254755 },
    { from: ".J_USB_DATA > .GND1", x: 1.25, y: 2.174 },
    { from: ".J_USB_DATA > .GND2", x: 1.75, y: 2.174 },
];
const connectorShellGrounds = [
    { from: ".J_USB_PD > .EP1", x: 4.9, y: 0.7 },
    { from: ".J_USB_PD > .EP2", x: -4.9, y: 0.7 },
    { from: ".J_USB_DATA > .EH1", x: 5.2, y: 0.75 },
    { from: ".J_USB_DATA > .EH2", x: -5.2, y: 0.75 },
    { from: ".J_USB_DATA > .EH3", x: 5.2, y: -2.05 },
    { from: ".J_USB_DATA > .EH4", x: -5.2, y: -2.05 },
];
const driverEpGroundPaths = [
    { from: ".U_DRV > .GND2", path: [
            { x: -0.5, y: -1.3 },
            { x: 0, y: 0 },
        ] },
    { from: ".U_DRV > .GND1", path: [
            { x: 0, y: 1.3 },
            { x: 0, y: 0 },
        ] },
    { from: ".U_DRV > .SPREAD", path: [
            { x: 1.6, y: -2.5 }, { x: 1.6, y: -1.4 }, { x: 0, y: 0 },
        ] },
    { from: ".U_DRV > .MS1_AD0", path: [
            { x: 1.4, y: -1 }, { x: 0, y: 0 },
        ] },
    { from: ".U_DRV > .MS2_AD1", path: [
            { x: 1.4, y: -0.5 }, { x: 0, y: 0 },
        ] },
    { from: ".U_DRV > .CLK", path: [
            { x: 1.4, y: 1.0 }, { x: 0, y: 0 },
        ] },
    { from: ".U_DRV > .UNUSED", path: [
            { x: -1.4, y: 0 }, { x: 0, y: 0 },
        ] },
];
const groundFanouts = [
    // Coordinates are local to each source component (the pcbPath convention).
    { from: ".C_VM_HF1 > .pin2", x: 1.4, y: 0, fromLayer: "top" },
    { from: ".D_VM_TVS > .anode", x: 2.5, y: 0, fromLayer: "bottom" },
    { from: ".C_VM_BULK1 > .pin2", x: -0.83, y: -0.8, fromLayer: "bottom" },
    { from: ".C_VM_BULK2 > .pin2", x: -0.83, y: -0.8, fromLayer: "bottom" },
    { from: ".R_PD_CC1 > .pin2", x: -1.1, y: 0, fromLayer: "bottom" },
    { from: ".R_PD_CC2 > .pin2", x: -1.1, y: 0, fromLayer: "bottom" },
    { from: ".R_DATA_CC1 > .pin2", x: -0.51, y: 0.65, fromLayer: "bottom" },
    { from: ".R_DATA_CC2 > .pin2", x: -0.51, y: 0.65, fromLayer: "bottom" },
    { from: ".C_LDO_IN > .pin2", x: -1.4, y: 0, fromLayer: "bottom" },
    { from: ".U_3V3 > .GND", x: -1.9, y: -0.95, fromLayer: "bottom" },
    { from: ".C_LDO_OUT > .pin2", x: -1, y: 0, fromLayer: "bottom" },
    { from: ".C_MCU_HF > .pin2", x: -0.6, y: 0.7, fromLayer: "bottom" },
    { from: ".C_MCU_BULK > .pin2", x: -0.2, y: 1.0, fromLayer: "bottom" },
    { from: ".R_STDBY_PD > .pin2", x: 1.1, y: 0, fromLayer: "top" },
    { from: ".C_VIO > .pin2", x: 3.3, y: 0, fromLayer: "top" },
    { from: ".R_VREF_BOTTOM > .pin2", x: -0.7, y: 0.8, fromLayer: "bottom" },
    { from: ".R_VBUS_BOTTOM > .pin2", x: 0.8, y: 0, fromLayer: "top" },
    { from: ".R_SENSE_A > .pin2", x: -2.2, y: 0, fromLayer: "bottom" },
    { from: ".R_SENSE_B > .pin2", x: -2, y: 1.0, fromLayer: "bottom" },
];
// Explicitly enumerate the signal/power routes so the default autorouter does
// not waste channels trying to duplicate the copper-pour ground network.
const routedConnections = [
    [".J_USB_PD > .VBUS1", ".J_USB_PD > .VBUS2"],
    [".J_USB_PD > .VBUS2", ".F1 > .pin1"],
    [".F1 > .pin2", ".D_BLOCK > .anode"],
    [".D_BLOCK > .cathode", ".D_VM_TVS > .cathode"],
    [".D_VM_TVS > .cathode", ".C_VM_BULK1 > .pin1"],
    [".C_VM_BULK1 > .pin1", ".C_VM_BULK2 > .pin1"],
    [".C_VM_BULK2 > .pin1", ".D_LOGIC_PD > .anode"],
    [".D_LOGIC_PD > .anode", ".R_VBUS_TOP > .pin1"],
    [".D_LOGIC_PD > .anode", ".C_VM_HF1 > .pin1"],
    [".C_VM_HF1 > .pin1", ".U_DRV > .VS1"],
    [".U_DRV > .VS1", ".U_DRV > .VS2"],
    [".C_VM_HF1 > .pin1", ".C_VCP > .pin2"],
    [".J_USB_DATA > .VBUS1", ".J_USB_DATA > .VBUS2"],
    [".J_USB_DATA > .VBUS2", ".D_LOGIC_USB > .anode"],
    [".D_LOGIC_PD > .cathode", ".D_LOGIC_USB > .cathode"],
    [".D_LOGIC_USB > .cathode", ".U_3V3 > .VIN"],
    [".U_3V3 > .VIN", ".C_LDO_IN > .pin1"],
    [".U_3V3 > .VOUT", ".C_LDO_OUT > .pin1"],
    [".C_LDO_OUT > .pin1", ".U_MCU > .VDD"],
    [".U_MCU > .VDD", ".C_MCU_HF > .pin1"],
    [".C_MCU_HF > .pin1", ".C_MCU_BULK > .pin1"],
    [".C_MCU_HF > .pin1", ".R_BOOT > .pin1"],
    [".C_MCU_BULK > .pin1", ".R_EN_PU > .pin1"],
    [".R_EN_PU > .pin1", ".U_DRV > .VCC_IO"],
    [".U_DRV > .VCC_IO", ".C_VIO > .pin1"],
    [".U_DRV > .VCC_IO", ".U_USB_ESD > .VBUS"],
    [".J_USB_PD > .CC1", ".U_MCU > .CC1"],
    [".J_USB_PD > .CC2", ".U_MCU > .CC2"],
    [".J_USB_DATA > .CC1", ".R_DATA_CC1 > .pin1"],
    [".J_USB_DATA > .CC2", ".R_DATA_CC2 > .pin1"],
    [".J_USB_DATA > .DN1", ".U_USB_ESD > .DM_IN"],
    [".J_USB_DATA > .DN2", ".U_USB_ESD > .DM_IN"],
    [".J_USB_DATA > .DP1", ".U_USB_ESD > .DP_IN"],
    [".J_USB_DATA > .DP2", ".U_USB_ESD > .DP_IN"],
    [".U_USB_ESD > .DM_OUT", ".U_MCU > .USB_DM"],
    [".U_USB_ESD > .DP_OUT", ".U_MCU > .USB_DP"],
    [".U_MCU > .USB_DP", ".SW_BOOT > .pin102"],
    [".R_BOOT > .pin2", ".SW_BOOT > .pin101"],
    [".R_VBUS_TOP > .pin2", ".R_VBUS_BOTTOM > .pin1"],
    [".R_VBUS_BOTTOM > .pin1", ".U_MCU > .VBUS_ADC"],
    [".U_DRV > .DIAG", ".U_MCU > .DIAG_IN"],
    [".U_DRV > .STEP", ".U_MCU > .STEP_OUT"],
    [".U_DRV > .DIR", ".U_MCU > .DIR_OUT"],
    [".U_DRV > .ENN", ".U_MCU > .ENABLE_OUT"],
    [".U_DRV > .ENN", ".R_EN_PU > .pin2"],
    [".U_DRV > .STDBY", ".U_MCU > .STDBY_OUT"],
    [".U_DRV > .STDBY", ".R_STDBY_PD > .pin1"],
    [".U_MCU > .UART1", ".U_DRV > .PDN_UART"],
    [".U_MCU > .UART1", ".U_DRV > .PDN_UART"], // reserved duplicate; not rendered
    [".U_DRV > .5VOUT", ".C_5V > .pin1"],
    [".C_5V > .pin1", ".R_VREF_TOP > .pin1"],
    [".R_VREF_TOP > .pin2", ".R_VREF_BOTTOM > .pin1"],
    [".R_VREF_BOTTOM > .pin1", ".C_VREF > .pin1"],
    [".C_VREF > .pin1", ".U_DRV > .VREF"],
    [".U_DRV > .CPO", ".C_CP > .pin1"],
    [".U_DRV > .CPI", ".C_CP > .pin2"],
    [".U_DRV > .VCP", ".C_VCP > .pin1"],
    [".U_DRV > .BRA", ".R_SENSE_A > .pin1"],
    [".U_DRV > .BRB", ".R_SENSE_B > .pin1"],
    [".U_DRV > .OA2", ".J_MOTOR > .pin1"],
    [".U_DRV > .OA1", ".J_MOTOR > .pin2"],
    [".U_DRV > .OB1", ".J_MOTOR > .pin3"],
    [".U_DRV > .OB2", ".J_MOTOR > .pin4"],
    [".C_VM_HF1 > .pin2", ".U_DRV > .GND1"],
    [".D_VM_TVS > .anode", ".C_VM_BULK1 > .pin2"],
    [".D_VM_TVS > .anode", ".C_VM_BULK2 > .pin2"],
    [".U_DRV > .SPREAD", ".U_DRV > .EP"],
    [".U_DRV > .MS1_AD0", ".U_DRV > .EP"],
    [".U_DRV > .MS2_AD1", ".U_DRV > .EP"],
    [".U_DRV > .CLK", ".U_DRV > .EP"],
    [".U_DRV > .UNUSED", ".U_DRV > .EP"],
    [".R_DATA_CC1 > .pin2", ".R_DATA_CC2 > .pin2"],
    [".R_DATA_CC2 > .pin2", ".U_MCU > .GND"],
    [".U_USB_ESD > .GND", ".J_USB_DATA > .GND1"],
    [".C_LDO_IN > .pin2", ".U_3V3 > .GND"],
    [".C_LDO_OUT > .pin2", ".C_LDO_IN > .pin2"],
    [".U_3V3 > .GND", ".J_USB_DATA > .EH3"],
    [".C_MCU_HF > .pin2", ".U_MCU > .GND"],
    [".C_MCU_BULK > .pin2", ".U_MCU > .GND"],
    [".R_STDBY_PD > .pin2", ".U_DRV > .EP"],
    [".C_5V > .pin2", ".U_DRV > .EP"],
    [".C_VIO > .pin2", ".U_DRV > .EP"],
    [".R_VREF_BOTTOM > .pin2", ".U_DRV > .EP"],
    [".C_VREF > .pin2", ".U_DRV > .EP"],
    [".R_VBUS_BOTTOM > .pin2", ".U_MCU > .GND"],
    [".C_VM_BULK1 > .pin2", ".J_USB_PD > .GND1"],
    [".C_VM_BULK2 > .pin2", ".J_USB_PD > .GND2"],
    [".R_SENSE_A > .pin2", ".U_DRV > .EP"],
    [".R_SENSE_B > .pin2", ".U_DRV > .EP"],
];
const traceWidthForRouteIndex = (index) => {
    if (index <= 2)
        return "0.5mm";
    if (index <= 11)
        return "0.4mm";
    if (index >= 57 && index <= 62)
        return "0.3mm";
    if (index === 63)
        return "0.3mm";
    if (index === 64 || index === 65)
        return "0.5mm";
    if (index >= 71 && index <= 73)
        return "0.2mm";
    if (index >= 74 && index <= 76)
        return "0.25mm";
    if (index >= 77 && index <= 83)
        return "0.2mm";
    if (index === 84)
        return "0.2mm";
    if (index === 85 || index === 86)
        return "0.5mm";
    if (index === 87 || index === 88)
        return "0.3mm";
    if ((index >= 12 && index <= 25) || index === 49 || index === 50 || index === 56)
        return "0.25mm";
    if (index === 54 || index === 55)
        return "0.2mm";
    return "0.15mm";
};
const routeNames = (start, end) => Array.from({ length: end - start + 1 }, (_, offset) => `ROUTE_${start + offset}`);
// Keep signal and power nets under the default autorouter. This avoids the
// partial-layer via definitions that hand routing can accidentally introduce;
// every layer transition is generated as a normal plated through-via.
const manualRouteIndexes = new Set([51]);
const manualPcbPathForRouteIndex = (index) => {
    if (index === 14)
        return [
            { x: 0.8, y: 1.6 },
            { x: 4.6, y: 1.6 },
            { x: 4.6, y: 0.6 },
            { x: 4.34, y: 0.6 },
        ];
    if (index === 15)
        return [
            { x: 1.14, y: 0 },
            { x: 0.2, y: 0.5 },
            { x: 0.2, y: 10.5 },
            { x: 1.1, y: 10.5 },
            { x: 1.1, y: 12.6 },
            { x: 0.63, y: 12.6 },
        ];
    if (index === 16)
        return [
            { x: 1.23, y: 0 },
            { x: 1.6, y: -1 },
            { x: 1.6, y: -2.975 },
        ];
    if (index === 24)
        return [
            { x: 1.8, y: 2.5 },
            { x: 3.2, y: 2.3 },
        ];
    if (index === 26)
        return [
            { x: -0.55, y: 1.2 },
            { x: -0.55, y: 1.2, via: true, fromLayer: "top", toLayer: "inner2" },
            { x: -0.55, y: 1.2 },
            { x: 5.4, y: 1.2 },
            { x: 4.7, y: 4.2 },
            { x: 4.7, y: 4.2, via: true, fromLayer: "inner2", toLayer: "bottom" },
            { x: 4.7, y: 4.2 },
            { x: 4.9, y: 4.6 },
        ];
    if (index === 27)
        return [
            { x: 0.55, y: 1.2 },
            { x: 0.55, y: 1.2, via: true, fromLayer: "top", toLayer: "inner1" },
            { x: 0.55, y: 1.2 },
            { x: 0.55, y: 4.7 },
            { x: 4.0, y: 4.7 },
            { x: 4.0, y: 4.7, via: true, fromLayer: "inner1", toLayer: "bottom" },
            { x: 4.0, y: 4.7 },
            { x: 4.5, y: 5.0 },
        ];
    if (index === 28)
        return [
            { x: -2.4, y: 3.25 },
            { x: -3, y: 3.45 },
            { x: -3, y: 3.45, via: true, fromLayer: "top", toLayer: "bottom" },
            { x: -3, y: 3.45 },
            { x: -3.5, y: 4.05 },
            { x: -8.71, y: 4.05 },
        ];
    if (index === 29)
        return [
            { x: 0.75, y: 1.55 },
            { x: 0.75, y: -1.45 },
            { x: 0, y: -1.45 },
            { x: 0, y: -1.45, via: true, fromLayer: "top", toLayer: "bottom" },
            { x: 0, y: -1.45 },
            { x: -1.31, y: -2.55 },
        ];
    if (index === 34)
        return [
            { x: 1.0, y: -2.4 },
            { x: 1.0, y: -2.4, via: true, fromLayer: "bottom", toLayer: "inner2" },
            { x: 1.0, y: -2.4 },
            { x: 1.0, y: -5.6 },
            { x: -1.2, y: -7.8 },
            { x: -7.3, y: -7.8 },
            { x: -7.3, y: -7.8, via: true, fromLayer: "inner2", toLayer: "bottom" },
            { x: -7.3, y: -7.8 },
            { x: -7.3, y: -5 },
            { x: -7, y: -4.5 },
        ];
    if (index === 36)
        return [
            { x: 0, y: 2.3 },
            { x: 0, y: 2.3, via: true, fromLayer: "bottom", toLayer: "inner1" },
            { x: 0, y: 2.3 },
            { x: -2.7, y: 2.3 },
            { x: -2.7, y: -5.5 },
            { x: -3.2, y: -5.5 },
            { x: -3.2, y: -5.5, via: true, fromLayer: "inner1", toLayer: "top" },
            { x: -3.2, y: -5.5 },
        ];
    if (index === 39)
        return [
            { x: 0.8, y: 1.0 },
            { x: 0.8, y: 1.0, via: true, fromLayer: "top", toLayer: "inner2" },
            { x: 0.8, y: 1.0 },
            { x: -2.6, y: 6.7 },
            { x: -2.6, y: 6.7, via: true, fromLayer: "inner2", toLayer: "bottom" },
            { x: -2.6, y: 6.7 },
        ];
    if (index === 41)
        return [
            { x: 1.0, y: 3.3 },
            { x: 1.0, y: 3.3, via: true, fromLayer: "top", toLayer: "inner2" },
            { x: 1.0, y: 3.3 },
            { x: 1.5, y: 2.3 },
            { x: 1.5, y: -0.5 },
            { x: 3.2, y: -0.7 },
            { x: 3.2, y: -0.7, via: true, fromLayer: "inner2", toLayer: "bottom" },
            { x: 3.2, y: -0.7 },
            { x: 3.2, y: 0.1 },
        ];
    if (index === 42)
        return [
            { x: -0.5, y: 2.5 },
            { x: -0.5, y: 3.3 },
            { x: 3.2, y: 3.3 },
            { x: 3.2, y: 3.3, via: true, fromLayer: "top", toLayer: "bottom" },
            { x: 3.2, y: 0.5 },
            { x: 3.8, y: 0.5 },
        ];
    if (index === 43)
        return [
            { x: -1, y: -3.2 },
            { x: -1, y: -3.2, via: true, fromLayer: "top", toLayer: "inner2" },
            { x: -1, y: -3.2 },
            { x: 3.5, y: -3.2 },
            { x: 3.5, y: 0.7 },
            { x: 3.7, y: 0.7 },
            { x: 3.7, y: 0.7, via: true, fromLayer: "inner2", toLayer: "bottom" },
            { x: 3.7, y: 0.7 },
        ];
    if (index === 44)
        return [
            { x: -0.8, y: -3.2 },
            { x: -3.6, y: -3.2 },
        ];
    if (index === 45)
        return [
            { x: -1, y: 3.3 },
            { x: -2.2, y: 3.3 },
            { x: -2.2, y: 3.3, via: true, fromLayer: "top", toLayer: "inner2" },
            { x: -2.2, y: 3.3 },
            { x: -2.2, y: 3.7 },
            { x: 3.1, y: 3.7 },
            { x: 3.1, y: 3.2 },
            { x: 3.1, y: 3.2, via: true, fromLayer: "inner2", toLayer: "bottom" },
            { x: 3.1, y: 3.2 },
            { x: 3.1, y: 2.5 },
            { x: 4.5, y: 2.5 },
            { x: 4.5, y: 2.0 },
        ];
    if (index === 46)
        return [
            { x: -1, y: 3.0 },
            { x: -4.7, y: 2.7 },
        ];
    if (index === 47)
        return [
            { x: 2.1, y: -0.8 },
            { x: 2.1, y: -1.2 },
            { x: 2.1, y: -1.2, via: true, fromLayer: "bottom", toLayer: "top" },
            { x: 2.1, y: -1.2 },
        ];
    if (index === 49)
        return [
            { x: 3.0, y: -1.5 },
            { x: 3.5, y: -2.5 },
        ];
    if (index === 50)
        return [
            { x: 0, y: -0.9 },
            { x: 0, y: -0.9, via: true, fromLayer: "top", toLayer: "inner1" },
            { x: 0, y: -0.9 },
            { x: 0, y: -0.6 },
            { x: -4.1, y: -0.6 },
            { x: -4.1, y: 0.6 },
            { x: -4.1, y: 0.6, via: true, fromLayer: "inner1", toLayer: "bottom" },
            { x: -4.1, y: 0.6 },
            { x: -4.1, y: 1.61 },
        ];
    if (index === 51)
        return [
            { x: -0.51, y: 0 },
            { x: -0.51, y: -0.8 },
            { x: 2.81, y: -0.8 },
            { x: 2.81, y: 0 },
        ];
    if (index === 52)
        return [
            { x: 0.51, y: -0.7 },
            { x: 2.81, y: -0.7 },
        ];
    if (index === 53)
        return [
            { x: 0.2, y: 0 },
            { x: 0.2, y: 1.3 },
            { x: 0.2, y: 1.3, via: true, fromLayer: "bottom", toLayer: "top" },
            { x: 0.2, y: 1.3 },
        ];
    if (index === 54)
        return [{ x: 0, y: -3.2 }];
    if (index === 55)
        return [{ x: 0.5, y: -3.2 }];
    if (index === 56)
        return [
            { x: 1.0, y: -3.1 },
            { x: 1.5, y: -3.3 },
            { x: 2.19, y: -3.3 },
        ];
    if (index === 59)
        return [
            { x: -2, y: 2.0 },
            { x: -8.3, y: 2.0 },
        ];
    if (index === 60)
        return [
            { x: -3, y: 0.5 },
            { x: -3.5, y: 1.0 },
            { x: -8.3, y: 1.0 },
        ];
    if (index === 61)
        return [
            { x: -3, y: -0.5 },
            { x: -3.5, y: 0 },
            { x: -8.3, y: 0 },
        ];
    if (index === 62)
        return [
            { x: -2.5, y: -1.5 },
            { x: -6.8, y: -1.5 },
            { x: -8.3, y: -1 },
        ];
    if (index === 57)
        return [
            { x: -2.2, y: 1.0 },
            { x: -2.2, y: 1.0, via: true, fromLayer: "top", toLayer: "bottom" },
            { x: -2.2, y: 1.0 },
        ];
    if (index === 58)
        return [
            { x: -2.2, y: -1 },
            { x: -2.2, y: -1, via: true, fromLayer: "top", toLayer: "bottom" },
            { x: -2.2, y: -1 },
        ];
    return undefined;
};
const routePhaseForIndex = (index) => {
    return index === 40 ? null : 1;
};
const replaceAutoroutedRoute = (trace, route) => {
    const original = trace.route ?? [];
    const firstPort = original.find((point) => point.start_pcb_port_id)?.start_pcb_port_id;
    const lastPort = [...original].reverse().find((point) => point.end_pcb_port_id)?.end_pcb_port_id;
    return {
        ...trace,
        route: route.map((point, index) => ({
            ...point,
            ...(index === 0 && firstPort ? { start_pcb_port_id: firstPort } : {}),
            ...(index === route.length - 1 && lastPort ? { end_pcb_port_id: lastPort } : {}),
        })),
    };
};
const postprocessDenseUsbRoutes = (traces) => {
    return traces.map((trace) => {
        const traceIdentity = `${trace.connection_name ?? ""} ${trace.pcb_trace_id ?? ""}`;
        const route = trace.route ?? [];
        const touches = (x, y) => route.some((point) => Math.abs((point.x ?? Infinity) - x) < 0.01 && Math.abs((point.y ?? Infinity) - y) < 0.01);
        if (traceIdentity.includes("ROUTE_28") || touches(-0.69, 8.6)) {
            return replaceAutoroutedRoute(trace, [
                { route_type: "wire", x: 2.4, y: 3.876, width: 0.15, layer: "top" },
                { route_type: "wire", x: 2.4, y: 3.0, width: 0.15, layer: "top" },
                { route_type: "via", x: 2.4, y: 3.0, from_layer: "top", to_layer: "inner2", via_diameter: 0.45, via_hole_diameter: 0.3 },
                { route_type: "wire", x: 2.4, y: 3.0, width: 0.15, layer: "inner2" },
                { route_type: "wire", x: 1.9, y: 4.2, width: 0.15, layer: "inner2" },
                { route_type: "wire", x: 1.9, y: 8.0, width: 0.15, layer: "inner2" },
                { route_type: "wire", x: -0.69, y: 8.0, width: 0.15, layer: "inner2" },
                { route_type: "via", x: -0.69, y: 8.0, from_layer: "inner2", to_layer: "bottom", via_diameter: 0.45, via_hole_diameter: 0.3 },
                { route_type: "wire", x: -0.69, y: 8.0, width: 0.15, layer: "bottom" },
                { route_type: "wire", x: -0.69, y: 8.6, width: 0.15, layer: "bottom" },
            ]);
        }
        if (traceIdentity.includes("ROUTE_29") || touches(1.31, 8.6)) {
            return replaceAutoroutedRoute(trace, [
                { route_type: "wire", x: -0.75, y: 3.876, width: 0.15, layer: "top" },
                { route_type: "wire", x: -0.75, y: 3.1, width: 0.15, layer: "top" },
                { route_type: "via", x: -0.75, y: 3.1, from_layer: "top", to_layer: "inner2", via_diameter: 0.45, via_hole_diameter: 0.3 },
                { route_type: "wire", x: -0.75, y: 3.1, width: 0.15, layer: "inner2" },
                { route_type: "wire", x: -0.75, y: 7.4, width: 0.15, layer: "inner2" },
                { route_type: "wire", x: 1.31, y: 7.4, width: 0.15, layer: "inner2" },
                { route_type: "via", x: 1.31, y: 7.4, from_layer: "inner2", to_layer: "bottom", via_diameter: 0.45, via_hole_diameter: 0.3 },
                { route_type: "wire", x: 1.31, y: 7.4, width: 0.15, layer: "bottom" },
                { route_type: "wire", x: 1.31, y: 8.6, width: 0.15, layer: "bottom" },
            ]);
        }
        if (traceIdentity.includes("ROUTE_34") || traceIdentity.includes("source_trace_34") || touches(2.15, 6.1491)) {
            return replaceAutoroutedRoute(trace, [
                { route_type: "wire", x: 2.15, y: 6.1491, width: 0.15, layer: "bottom" },
                { route_type: "wire", x: 3.6, y: 6.0, width: 0.15, layer: "bottom" },
                { route_type: "via", x: 3.6, y: 6.0, from_layer: "bottom", to_layer: "inner2", via_diameter: 0.45, via_hole_diameter: 0.3 },
                { route_type: "wire", x: 3.6, y: 6.0, width: 0.15, layer: "inner2" },
                { route_type: "wire", x: 6.8, y: 6.0, width: 0.15, layer: "inner2" },
                { route_type: "wire", x: 9.0, y: 3.8, width: 0.15, layer: "inner2" },
                { route_type: "wire", x: 9.0, y: -2.3, width: 0.15, layer: "inner2" },
                { route_type: "via", x: 9.0, y: -2.3, from_layer: "inner2", to_layer: "bottom", via_diameter: 0.45, via_hole_diameter: 0.3 },
                { route_type: "wire", x: 9.0, y: -2.3, width: 0.15, layer: "bottom" },
                { route_type: "wire", x: 6.2, y: -2.3, width: 0.15, layer: "bottom" },
                { route_type: "wire", x: 5.7, y: -2, width: 0.15, layer: "bottom" },
                { route_type: "wire", x: 5.7, y: -1.5, width: 0.15, layer: "bottom" },
            ]);
        }
        if (traceIdentity.includes("ROUTE_36") || traceIdentity.includes("source_trace_36") || (touches(5.3, -1.5) && touches(7.6, 6.150492))) {
            return replaceAutoroutedRoute(trace, [
                { route_type: "wire", x: 5.3, y: -1.5, width: 0.15, layer: "bottom" },
                { route_type: "wire", x: 5.3, y: -1.9, width: 0.15, layer: "bottom" },
                { route_type: "via", x: 5.3, y: -1.9, from_layer: "bottom", to_layer: "inner1", via_diameter: 0.45, via_hole_diameter: 0.3 },
                { route_type: "wire", x: 5.3, y: -1.9, width: 0.15, layer: "inner1" },
                { route_type: "wire", x: 8.0, y: -1.9, width: 0.15, layer: "inner1" },
                { route_type: "wire", x: 8.0, y: 5.5, width: 0.15, layer: "inner1" },
                { route_type: "wire", x: 8.5, y: 5.5, width: 0.15, layer: "inner1" },
                { route_type: "via", x: 8.5, y: 5.5, from_layer: "inner1", to_layer: "top", via_diameter: 0.45, via_hole_diameter: 0.3 },
                { route_type: "wire", x: 8.5, y: 5.5, width: 0.15, layer: "top" },
                { route_type: "wire", x: 7.6, y: 6.150492, width: 0.15, layer: "top" },
            ]);
        }
        if (traceIdentity.includes("ROUTE_43") || (touches(-1, -3) && touches(4.1, 0.4))) {
            return replaceAutoroutedRoute(trace, [
                { route_type: "wire", x: -1, y: -3, width: 0.15, layer: "top" },
                { route_type: "wire", x: -1, y: -3.2, width: 0.15, layer: "top" },
                { route_type: "via", x: -1, y: -3.2, from_layer: "top", to_layer: "inner2", via_diameter: 0.45, via_hole_diameter: 0.3 },
                { route_type: "wire", x: -1, y: -3.2, width: 0.15, layer: "inner2" },
                { route_type: "wire", x: 3.5, y: -3.2, width: 0.15, layer: "inner2" },
                { route_type: "wire", x: 3.5, y: 0.7, width: 0.15, layer: "inner2" },
                { route_type: "wire", x: 3.7, y: 0.7, width: 0.15, layer: "inner2" },
                { route_type: "via", x: 3.7, y: 0.7, from_layer: "inner2", to_layer: "bottom", via_diameter: 0.45, via_hole_diameter: 0.3 },
                { route_type: "wire", x: 3.7, y: 0.7, width: 0.15, layer: "bottom" },
                { route_type: "wire", x: 4.1, y: 0.4, width: 0.15, layer: "bottom" },
            ]);
        }
        return trace;
    });
};
// Keep inner1 dedicated to the ground plane and let low-current signals use
// inner2. Power, sense, and motor buses remain restricted to the outer layers.
// With allowBlindAndBuriedVias=false, core expands every routed transition to
// a plated hole spanning top, inner1, inner2, and bottom.
const outerLayerDefaultAutorouter = async (simpleRouteJson) => {
    const guardedInput = {
        ...simpleRouteJson,
        layerCount: 4,
        allowBlindAndBuriedVias: false,
    };
    const solver = new capacityAutorouter.AutoroutingPipelineSolver9_PreloadedTraceGraph(guardedInput, {
        effort: 4,
        cacheProvider: null,
    });
    const listeners = {
        complete: [], error: [], progress: [],
    };
    return {
        on(eventName, callback) {
            listeners[eventName]?.push(callback);
        },
        start() {
            setTimeout(() => {
                const originalRandom = Math.random;
                const configuredSeed = globalThis.process?.env?.TSCI_ROUTER_SEED;
                let randomState = Number(configuredSeed ?? "2209") >>> 0;
                Math.random = () => {
                    randomState = (1664525 * randomState + 1013904223) >>> 0;
                    return randomState / 4294967296;
                };
                try {
                    solver.solve();
                    if (solver.failed) {
                        const error = new Error(solver.error ?? "Outer-layer default autorouting failed");
                        listeners.error.forEach((callback) => callback({ type: "error", error }));
                        return;
                    }
                    const traces = postprocessDenseUsbRoutes(solver.getOutputSimplifiedPcbTraces());
                    listeners.complete.forEach((callback) => callback({ type: "complete", traces }));
                }
                catch (cause) {
                    const error = cause instanceof Error ? cause : new Error(String(cause));
                    listeners.error.forEach((callback) => callback({ type: "error", error }));
                }
                finally {
                    Math.random = originalRandom;
                }
            }, 0);
        },
        stop() {
            // The synchronous local solver has already completed when core calls stop.
        },
        getOutputSimpleRouteJson() {
            const output = solver.getOutputSimpleRouteJson();
            return {
                ...output,
                traces: (output.traces ?? []).map((trace) => {
                    const pcbTraceId = String(trace.pcb_trace_id ?? "");
                    const isBootSupplyTree = pcbTraceId.startsWith("source_trace_14__source_trace_15__source_trace_16");
                    const isSenseNeck = pcbTraceId === "source_trace_55_0";
                    return {
                        ...trace,
                        route: (trace.route ?? []).map((point) => {
                            if (isBootSupplyTree &&
                                Math.abs((point.x ?? Infinity) - 8.03) < 0.01 &&
                                Math.abs((point.y ?? Infinity) - 5.434) < 0.01) {
                                return { ...point, y: 5.3 };
                            }
                            if (point.route_type !== "wire")
                                return point;
                            if (isSenseNeck)
                                return { ...point, width: Math.max(point.width ?? 0.15, 0.28) };
                            return point;
                        }),
                    };
                }),
            };
        },
    };
};
function Nema8FourLayerController() {
    return (jsxRuntime.jsxs("board", { width: "20mm", height: "20mm", layers: 4, thickness: "1.6mm", fabricatorPreset: "jlcpcb_standard_20260912", autorouterEffortLevel: "2x", minTraceWidth: "0.15mm", minTraceToPadEdgeClearance: "0.1mm", minTraceToHoleEdgeClearance: "0.2mm", minViaEdgeToPadEdgeClearance: "0.1mm", minViaHoleEdgeToViaHoleEdgeClearance: "0.2mm", minPlatedHoleDrillEdgeToDrillEdgeClearance: "0.3mm", minPadEdgeToPadEdgeClearance: "0.1mm", minBoardEdgeClearance: "0.2mm", minViaHoleDiameter: "0.3mm", minViaPadDiameter: "0.45mm", allowBlindAndBuriedVias: false, isViaInPadAllowed: true, routeRemaining: false, autorouterVersion: "latest", autorouter: {
            algorithmFn: outerLayerDefaultAutorouter,
            serverCacheEnabled: false,
            allowViaInPad: false,
            traceClearance: "0.1mm",
        }, pcbStyle: { viaHoleDiameter: "0.3mm", viaPadDiameter: "0.45mm" }, children: [jsxRuntime.jsxs("schematicsheet", { name: sheets.power, displayName: "1. USB-C PD and power", sheetSize: "A4", sheetIndex: 1, children: [jsxRuntime.jsx("schematicsection", { name: sections.pdInput, displayName: "USB-C PD input and motor supply" }), jsxRuntime.jsx("schematicsection", { name: sections.logicPower, displayName: "3.3 V logic power" }), jsxRuntime.jsx("schematictext", { schX: -13, schY: 8.5, anchor: "top_left", fontSize: 0.22, text: "PWR / PD \u2014 CH32X035 negotiates the motor voltage on the dedicated USB-C input." }), jsxRuntime.jsx("schematictext", { schX: -13, schY: 8, anchor: "top_left", fontSize: 0.19, text: "F1 protects the input; D_BLOCK limits reverse current; D_VM_TVS clamps VM transients." }), jsxRuntime.jsx("schematictext", { schX: 1, schY: 8.5, anchor: "top_left", fontSize: 0.22, text: "LOGIC POWER \u2014 diode-ORed VM or DATA USB 5 V is regulated to 3.3 V." })] }), jsxRuntime.jsxs("schematicsheet", { name: sheets.control, displayName: "2. USB programming and controller", sheetSize: "A4", sheetIndex: 2, children: [jsxRuntime.jsx("schematicsection", { name: sections.usbData, displayName: "USB-C data/programming" }), jsxRuntime.jsx("schematicsection", { name: sections.controller, displayName: "CH32X035 controller" }), jsxRuntime.jsx("schematictext", { schX: -13, schY: 8.5, anchor: "top_left", fontSize: 0.22, text: "DATA / PROG \u2014 USB 2.0 programming/data and optional 5 V logic power." }), jsxRuntime.jsx("schematictext", { schX: -13, schY: 8, anchor: "top_left", fontSize: 0.19, text: "Hold BOOT while connecting DATA / PROG to enter the ROM USB bootloader." }), jsxRuntime.jsx("schematictext", { schX: 1, schY: 8.5, anchor: "top_left", fontSize: 0.22, text: "U_MCU negotiates PD and controls STEP, DIR, ENN, UART, and STDBY." })] }), jsxRuntime.jsxs("schematicsheet", { name: sheets.driver, displayName: "3. TMC2209 motor stage", sheetSize: "A4", sheetIndex: 3, children: [jsxRuntime.jsx("schematicsection", { name: sections.driverCore, displayName: "TMC2209 driver and current regulation" }), jsxRuntime.jsx("schematictext", { schX: -13, schY: 8.5, anchor: "top_left", fontSize: 0.22, text: "U_DRV \u2014 top-side TMC2209 with a plated-through thermal-via field." }), jsxRuntime.jsx("schematictext", { schX: -13, schY: 8, anchor: "top_left", fontSize: 0.19, text: "UART changes run/hold current; the VREF network provides a hardware current ceiling." }), jsxRuntime.jsx("schematictext", { schX: 1, schY: 8.5, anchor: "top_left", fontSize: 0.22, text: "MOTOR \u2014 8HS15-0604S; edge-facing JST order A-, A+, B+, B-." })] }), nets.map((name) => (jsxRuntime.jsx(react.Fragment, { children: jsxRuntime.jsx("net", { name: name, nominalTraceWidth: traceWidthForNet(name), isGroundNet: name === "GND", routingPhaseIndex: name === "GND" ? null : undefined }) }, name))), jsxRuntime.jsx("copperpour", { name: "GND_PLANE", layer: "inner1", connectsTo: "net.GND", padMargin: "0.3mm", traceMargin: "0.3mm", boardEdgeMargin: "0.25mm", useThermalReliefs: true }), routedConnections.map(([from, to], index) => index === 40 || index === 48 || index >= 63 ? null : (jsxRuntime.jsx(react.Fragment, { children: jsxRuntime.jsx("trace", { name: `ROUTE_${index}`, from: from, to: to, thickness: traceWidthForRouteIndex(index), pcbPath: manualRouteIndexes.has(index) ? manualPcbPathForRouteIndex(index) : undefined, routingPhaseIndex: routePhaseForIndex(index) }) }, `route-${index}`))), jsxRuntime.jsx("bus", { name: "PD_INPUT_BUS", connections: routeNames(0, 2), routingPhaseIndex: 1, pcbTraceWidth: "0.5mm", pcbAllowedLayers: ["top", "bottom"] }), jsxRuntime.jsx("bus", { name: "VM_POWER_BUS", connections: routeNames(3, 11), routingPhaseIndex: 1, pcbTraceWidth: "0.4mm", pcbAllowedLayers: ["top", "bottom"] }), jsxRuntime.jsx("bus", { name: "LOGIC_POWER_POLICY", connections: routeNames(12, 25), routingPhaseIndex: 1, pcbAllowedLayers: ["top", "inner2", "bottom"] }), jsxRuntime.jsx("bus", { name: "PD_CC_SIGNAL_POLICY", connections: routeNames(26, 27), routingPhaseIndex: 1, pcbAllowedLayers: ["top", "inner2", "bottom"] }), jsxRuntime.jsx("bus", { name: "PD_RD_SIGNAL_POLICY", connections: ["PD_CC1_RD", "PD_CC2_RD"], routingPhaseIndex: 1, pcbAllowedLayers: ["top", "inner2", "bottom"] }), jsxRuntime.jsx("bus", { name: "USB_SIGNAL_POLICY", connections: routeNames(28, 39), routingPhaseIndex: 1, pcbAllowedLayers: ["top", "inner2", "bottom"] }), jsxRuntime.jsx("bus", { name: "STEP_SIGNAL_POLICY", connections: ["ROUTE_41"], routingPhaseIndex: 1, pcbAllowedLayers: ["top", "inner2", "bottom"] }), routeNames(42, 47).map((routeName, offset) => (jsxRuntime.jsx(react.Fragment, { children: jsxRuntime.jsx("bus", { name: `CONTROL_SIGNAL_POLICY_${offset + 1}`, connections: [routeName], routingPhaseIndex: 1, pcbAllowedLayers: ["top", "inner2", "bottom"] }) }, `control-signal-policy-${routeName}`))), routeNames(49, 56).map((routeName, offset) => (jsxRuntime.jsx(react.Fragment, { children: jsxRuntime.jsx("bus", { name: `DRIVER_LOCAL_POLICY_${offset + 1}`, connections: [routeName], routingPhaseIndex: 1, pcbAllowedLayers: ["top", "inner2", "bottom"] }) }, `driver-local-policy-${routeName}`))), jsxRuntime.jsx("bus", { name: "SENSE_BUS", connections: routeNames(57, 58), routingPhaseIndex: 1, pcbTraceWidth: "0.3mm", pcbAllowedLayers: ["top", "bottom"] }), jsxRuntime.jsx("bus", { name: "MOTOR_BUS", connections: routeNames(59, 62), routingPhaseIndex: 1, pcbTraceWidth: "0.3mm", pcbAllowedLayers: ["top", "bottom"], preferredLayer: "top" }), jsxRuntime.jsx("autoroutingphase", { name: "GLOBAL_DEFAULT_ROUTING", phaseIndex: 1, connections: [
                    ...routeNames(0, 39),
                    ...routeNames(41, 47),
                    ...routeNames(49, 62),
                    "PD_CC1_RD",
                    "PD_CC2_RD",
                ].filter((routeName) => !manualRouteIndexes.has(Number(routeName.slice(6)))) }), jsxRuntime.jsx(TYPE_C_6P_LTH5_5_108, { name: "J_USB_PD", layer: "top", pcbX: 0, pcbY: -6.9, pcbRotation: 0, schSectionName: sections.pdInput, schSheetName: sheets.power, schX: -11, schY: 3, connections: { EP1: "net.GND", EP2: "net.GND", GND1: "net.GND", GND2: "net.GND" } }), jsxRuntime.jsx(TYPE_C_31_M_12, { name: "J_USB_DATA", layer: "top", pcbX: 0, pcbY: 6.05, pcbRotation: 180, schSectionName: sections.usbData, schSheetName: sheets.control, schX: -11, schY: 3, noConnect: ["SBU1", "SBU2"], connections: { EH1: "net.GND", EH2: "net.GND", EH3: "net.GND", EH4: "net.GND", GND1: "net.GND", GND2: "net.GND" } }), jsxRuntime.jsx(BM04B_SRSS_TB_LF__SN_, { name: "J_MOTOR", layer: "top", pcbX: -7.6, pcbY: 0, pcbRotation: 270, schSectionName: sections.driverCore, schSheetName: sheets.driver, schX: 10, schY: 0, noConnect: ["pin5"], pcbPinLabels: { pin1: "A-", pin2: "A+", pin3: "B+", pin4: "B-" } }), jsxRuntime.jsx(TMC2209_LA_T, { name: "U_DRV", layer: "top", pcbX: driverX, pcbY: driverY, pcbRotation: 0, schSectionName: sections.driverCore, schSheetName: sheets.driver, schX: 0, schY: 1, schWidth: 3.5, schHeight: 5, noConnect: ["INDEX", "DIAG"] }), thermalViaOffsets.map(([x, y]) => (jsxRuntime.jsx(react.Fragment, { children: jsxRuntime.jsx("via", { name: `U_DRV_THERMAL_${x}_${y}`, pcbX: driverX + x, pcbY: driverY + y, fromLayer: "top", toLayer: "bottom", holeDiameter: "0.3mm", outerDiameter: "0.45mm", connectsTo: "net.GND", tented: "bottom_tented" }) }, `thermal-${x}-${y}`))), jsxRuntime.jsx(CH32X035F8U6, { name: "U_MCU", layer: "bottom", pcbX: mcuX, pcbY: mcuY, pcbRotation: 180, schSectionName: sections.controller, schSheetName: sheets.control, schX: 4.5, schY: 2, schWidth: 4, schHeight: 5, noConnect: ["PA5", "PA6", "PB0", "PB1", "PB3", "PB11", "PB12", "DIO", "DCK"] }), jsxRuntime.jsx(R, { name: "R_PD_CC1", resistance: "5.1k", layer: "bottom", pcbX: -3.5, pcbY: -9.2, pcbRotation: 0, schSectionName: sections.pdInput, schSheetName: sheets.power, schX: -9, schY: -1, connections: { pin1: "net.PD_CC1", pin2: "net.GND" } }), jsxRuntime.jsx(R, { name: "R_PD_CC2", resistance: "5.1k", layer: "bottom", pcbX: 3.5, pcbY: -9.2, pcbRotation: 180, schSectionName: sections.pdInput, schSheetName: sheets.power, schX: -6, schY: -1, connections: { pin1: "net.PD_CC2", pin2: "net.GND" } }), jsxRuntime.jsx("trace", { name: "PD_CC1_RD", from: ".J_USB_PD > .CC1", to: ".R_PD_CC1 > .pin1", thickness: "0.15mm", routingPhaseIndex: 1 }), jsxRuntime.jsx("trace", { name: "PD_CC2_RD", from: ".J_USB_PD > .CC2", to: ".R_PD_CC2 > .pin1", thickness: "0.15mm", routingPhaseIndex: 1 }), jsxRuntime.jsx(R, { name: "R_DATA_CC1", resistance: "5.1k", layer: "bottom", pcbX: -1.2, pcbY: 8.6, pcbRotation: 0, schSectionName: sections.usbData, schSheetName: sheets.control, schX: -10, schY: -2, connections: { pin1: "net.DATA_CC1", pin2: "net.GND" } }), jsxRuntime.jsx(R, { name: "R_DATA_CC2", resistance: "5.1k", layer: "bottom", pcbX: 0.8, pcbY: 8.6, pcbRotation: 0, schSectionName: sections.usbData, schSheetName: sheets.control, schX: -7, schY: -2, connections: { pin1: "net.DATA_CC2", pin2: "net.GND" } }), jsxRuntime.jsx(USBLC6_2SC6, { name: "U_USB_ESD", layer: "bottom", pcbX: 1.2, pcbY: 5.0, pcbRotation: 90, schSectionName: sections.usbData, schSheetName: sheets.control, schX: -5, schY: 3 }), jsxRuntime.jsx(BAT54KFILM, { name: "D_LOGIC_PD", layer: "bottom", pcbX: 4.8, pcbY: -5.6, pcbRotation: 0, schSectionName: sections.logicPower, schSheetName: sheets.power, schX: -4, schY: -3 }), jsxRuntime.jsx(BAT54WS, { name: "D_LOGIC_USB", layer: "bottom", pcbX: -7.5, pcbY: 4.5, pcbRotation: 90, schSectionName: sections.logicPower, schSheetName: sheets.power, schX: 0, schY: -3 }), jsxRuntime.jsx(HT7533_1, { name: "U_3V3", layer: "bottom", pcbX: 7.4, pcbY: 7.6, pcbRotation: 0, schSectionName: sections.logicPower, schSheetName: sheets.power, schX: 5, schY: -3, schWidth: 3, schHeight: 3, schPinArrangement: {
                    leftSide: { pins: [3], direction: "top-to-bottom" },
                    rightSide: { pins: [2], direction: "top-to-bottom" },
                    bottomSide: { pins: [1], direction: "left-to-right" },
                } }), jsxRuntime.jsx(C, { name: "C_LDO_IN", value: "2.2uF", layer: "bottom", pcbX: 9.0, pcbY: 3.8, pcbRotation: 90, schSectionName: sections.logicPower, schSheetName: sheets.power, schX: 3, schY: -5.5, connections: { pin1: "net.LOGIC_IN", pin2: "net.GND" } }), jsxRuntime.jsx(C, { name: "C_LDO_OUT", value: "2.2uF_10V", layer: "bottom", pcbX: 3.4, pcbY: 7.1, pcbRotation: 0, schSectionName: sections.logicPower, schSheetName: sheets.power, schX: 8, schY: -5.5, connections: { pin1: "net.VIO", pin2: "net.GND" } }), jsxRuntime.jsx(C, { name: "C_MCU_HF", value: "100nF", layer: "bottom", pcbX: 4.0, pcbY: -3.6, pcbRotation: 180, schSectionName: sections.controller, schSheetName: sheets.control, schX: 10, schY: 4.5, connections: { pin1: "net.VIO", pin2: "net.GND" } }), jsxRuntime.jsx(C, { name: "C_MCU_BULK", value: "2.2uF_10V", layer: "bottom", pcbX: 6.6, pcbY: -3.2, pcbRotation: 180, schSectionName: sections.controller, schSheetName: sheets.control, schX: 10, schY: 2.5, connections: { pin1: "net.VIO", pin2: "net.GND" } }), jsxRuntime.jsx(R, { name: "R_VBUS_TOP", resistance: "270k", layer: "top", pcbX: 8.4, pcbY: -2, pcbRotation: 0, schSectionName: sections.controller, schSheetName: sheets.control, schX: 9, schY: -1, connections: { pin1: "net.VM", pin2: "net.VBUS_ADC" } }), jsxRuntime.jsx(R, { name: "R_VBUS_BOTTOM", resistance: "47k", layer: "top", pcbX: 8.4, pcbY: -4.2, pcbRotation: 0, schSectionName: sections.controller, schSheetName: sheets.control, schX: 12, schY: -1, connections: { pin1: "net.VBUS_ADC", pin2: "net.GND" } }), jsxRuntime.jsx(R, { name: "R_BOOT", resistance: "4.7k", layer: "bottom", pcbX: 6.5, pcbY: 5.2, pcbRotation: 0, schSectionName: sections.controller, schSheetName: sheets.control, schX: 7, schY: -4, connections: { pin1: "net.VIO", pin2: "net.BOOT_BIAS" } }), jsxRuntime.jsx(TL3780AF100QG, { name: "SW_BOOT", layer: "top", pcbX: 7.6, pcbY: 4.5, pcbRotation: 90, schSectionName: sections.controller, schSheetName: sheets.control, schX: 11, schY: -4 }), jsxRuntime.jsx(R, { name: "R_EN_PU", resistance: "100k", layer: "top", pcbX: -4.2, pcbY: -3, pcbRotation: 0, schSectionName: sections.controller, schSheetName: sheets.control, schX: -1, schY: -4, connections: { pin1: "net.VIO", pin2: "net.ENN" } }), jsxRuntime.jsx(R, { name: "R_STDBY_PD", resistance: "100k", layer: "top", pcbX: -4.2, pcbY: 2.2, pcbRotation: 0, schSectionName: sections.controller, schSheetName: sheets.control, schX: 1.5, schY: -4, connections: { pin1: "net.STDBY", pin2: "net.GND" } }), jsxRuntime.jsx(BSMD1206_110_16V, { name: "F1", layer: "top", pcbX: -7.5, pcbY: -8, pcbRotation: 180, schSectionName: sections.pdInput, schSheetName: sheets.power, schX: -6, schY: 4 }), jsxRuntime.jsx(PMEG6020ELRX, { name: "D_BLOCK", layer: "bottom", pcbX: 0, pcbY: -8.6, pcbRotation: 0, schSectionName: sections.pdInput, schSheetName: sheets.power, schX: -2, schY: 4 }), jsxRuntime.jsx("diode", { name: "D_VM_TVS", layer: "bottom", pcbX: -0.7, pcbY: -5.5, pcbRotation: 0, manufacturerPartNumber: "SMAJ16A", supplierPartNumbers: { jlcpcb: ["C20419815"] }, footprint: "smdpads2_p3.6mm_pw2mm_ph2.1mm", schSectionName: sections.pdInput, schSheetName: sheets.power, schX: 1, schY: 1, schRotation: 90 }), [{ x: -8.2, y: -6.8 }, { x: -8.2, y: -3.2 }].map(({ x, y }, index) => (jsxRuntime.jsx(C, { name: `C_VM_BULK${index + 1}`, value: "10uF_25V", layer: "bottom", pcbX: x, pcbY: y, pcbRotation: 90, schSectionName: sections.pdInput, schSheetName: sheets.power, schX: 4 + index * 3, schY: 1, connections: { pin1: "net.VM", pin2: "net.GND" } }, `bulk-${index}`))), jsxRuntime.jsx(C, { name: "C_VM_HF1", value: "100nF_50V", layer: "top", pcbX: -3.8, pcbY: -4.5, pcbRotation: 180, schSectionName: sections.driverCore, schSheetName: sheets.driver, schX: -10, schY: 4, connections: { pin1: "net.VM", pin2: "net.GND" } }), jsxRuntime.jsx(C, { name: "C_CP", value: "22nF_50V", layer: "top", pcbX: 0.25, pcbY: -4.3, pcbRotation: 0, schSectionName: sections.driverCore, schSheetName: sheets.driver, schX: -6, schY: 4, connections: { pin1: "net.CP_HI", pin2: "net.CP_LO" } }), jsxRuntime.jsx("capacitor", { name: "C_VCP", capacitance: "100nF", footprint: "0402", maxVoltageRating: "50V", supplierPartNumbers: { jlcpcb: ["C525226"] }, layer: "top", pcbX: 2.7, pcbY: -4.3, pcbRotation: 0, schSectionName: sections.driverCore, schSheetName: sheets.driver, schX: -6, schY: 2 }), jsxRuntime.jsx(C, { name: "C_5V", value: "2.2uF_10V", layer: "top", pcbX: 5.2, pcbY: -3.4, pcbRotation: 0, schSectionName: sections.driverCore, schSheetName: sheets.driver, schX: -6, schY: 0, connections: { pin1: "net.V5_DRV", pin2: "net.GND" } }), jsxRuntime.jsx(C, { name: "C_VIO", value: "100nF", layer: "top", pcbX: 5.4, pcbY: 1.8, pcbRotation: 0, schSectionName: sections.driverCore, schSheetName: sheets.driver, schX: -6, schY: -2, connections: { pin1: "net.VIO", pin2: "net.GND" } }), jsxRuntime.jsx(PT1206FR_7W0R33L, { name: "R_SENSE_A", layer: "bottom", pcbX: -4.5, pcbY: 0.5, pcbRotation: 0, schSectionName: sections.driverCore, schSheetName: sheets.driver, schX: 4, schY: -3 }), jsxRuntime.jsx(PT1206FR_7W0R33L, { name: "R_SENSE_B", layer: "bottom", pcbX: -4.8, pcbY: -1.8, pcbRotation: 0, schSectionName: sections.driverCore, schSheetName: sheets.driver, schX: 7, schY: -3 }), jsxRuntime.jsx(R, { name: "R_VREF_TOP", resistance: "12k", layer: "bottom", pcbX: 1.8, pcbY: -2.3, pcbRotation: 90, schSectionName: sections.driverCore, schSheetName: sheets.driver, schX: 4, schY: 4, connections: { pin1: "net.V5_DRV", pin2: "net.VREF" } }), jsxRuntime.jsx(R, { name: "R_VREF_BOTTOM", resistance: "10k", layer: "bottom", pcbX: 1.8, pcbY: 0, pcbRotation: 90, schSectionName: sections.driverCore, schSheetName: sheets.driver, schX: 7, schY: 4, connections: { pin1: "net.VREF", pin2: "net.GND" } }), jsxRuntime.jsx(C, { name: "C_VREF", value: "100nF", layer: "bottom", pcbX: 0.2, pcbY: -2.7, pcbRotation: 0, schSectionName: sections.driverCore, schSheetName: sheets.driver, schX: 10, schY: 4, connections: { pin1: "net.VREF", pin2: "net.GND" } }), connectorShellGrounds.map(({ from, x, y }, index) => (jsxRuntime.jsx(react.Fragment, { children: jsxRuntime.jsx("trace", { name: `CONNECTOR_SHELL_GND_${index + 1}`, from: from, to: "net.GND", thickness: "0.2mm", pcbPath: [{ x, y }, { x, y, via: true, fromLayer: "top", toLayer: "bottom" }], routingPhaseIndex: null }) }, `connector-shell-ground-${index}`))), groundFanouts.map(({ from, x, y, fromLayer }, index) => (jsxRuntime.jsx(react.Fragment, { children: jsxRuntime.jsx("trace", { name: `GROUND_FANOUT_${index + 1}`, from: from, to: "net.GND", thickness: from.includes("R_DATA_CC") ? "0.15mm" : "0.2mm", pcbPath: [
                        { x, y },
                        {
                            x, y, via: true,
                            fromLayer,
                            toLayer: fromLayer === "top" ? "bottom" : "top",
                        },
                    ], routingPhaseIndex: null }) }, `ground-fanout-${index}`))), jsxRuntime.jsx("trace", { name: "USB_ESD_GND_FANOUT", from: ".U_USB_ESD > .GND", to: "net.GND", thickness: "0.2mm", pcbPathRelativeTo: ".U_USB_ESD > .GND", pcbPath: [{ x: 0, y: 0, via: true, fromLayer: "bottom", toLayer: "top" }], routingPhaseIndex: null }), jsxRuntime.jsx("trace", { name: "C_VREF_GND_FANOUT", from: ".C_VREF > .pin2", to: "net.GND", thickness: "0.2mm", pcbPath: [
                    { x: -0.51, y: -1.2 },
                    { x: 0.9, y: -2.8 },
                    { x: 0.9, y: -2.8, via: true, fromLayer: "bottom", toLayer: "top" },
                ], routingPhaseIndex: null }), jsxRuntime.jsx("trace", { name: "C_5V_GND_FANOUT", from: ".C_5V > .pin2", to: "net.GND", thickness: "0.2mm", pcbPath: [
                    { x: 1.1, y: -0.9 },
                    { x: 1.1, y: -0.9, via: true, fromLayer: "top", toLayer: "bottom" },
                ], routingPhaseIndex: null }), usbGroundVias.map(({ from, x, y }, index) => (jsxRuntime.jsx(react.Fragment, { children: jsxRuntime.jsx("trace", { name: `USB_GND_VIA_${index + 1}`, from: from, to: "net.GND", thickness: "0.15mm", pcbPath: [
                        { x, y },
                        { x, y, via: true, fromLayer: "top", toLayer: "bottom" },
                    ], routingPhaseIndex: null }) }, `usb-ground-via-${index}`))), driverEpGroundPaths.map(({ from, path }, index) => (jsxRuntime.jsx(react.Fragment, { children: jsxRuntime.jsx("trace", { name: `U_DRV_GND_VIA_${index + 1}`, from: from, to: "net.GND", thickness: "0.15mm", pcbPath: [...path], routingPhaseIndex: null }) }, `driver-ground-via-${index}`))), jsxRuntime.jsx("trace", { name: "U_DRV_EP_GND", from: ".U_DRV > .EP", to: "net.GND", thickness: "0.15mm", pcbPathRelativeTo: ".U_DRV > .EP", pcbPath: [{ x: 0, y: 0, via: true, fromLayer: "top", toLayer: "bottom" }], routingPhaseIndex: null }), jsxRuntime.jsx("trace", { name: "U_MCU_EP_GND", from: ".U_MCU > .GND", to: "net.GND", thickness: "0.15mm", pcbPathRelativeTo: ".U_MCU > .GND", pcbPath: [{ x: 0, y: 0, via: true, fromLayer: "bottom", toLayer: "top" }], routingPhaseIndex: null }), jsxRuntime.jsx("hole", { name: "MOTOR_M2_UPPER_LEFT", pcbX: -7.7, pcbY: 7.7, diameter: "2.2mm" }), jsxRuntime.jsx("hole", { name: "MOTOR_M2_LOWER_RIGHT", pcbX: 7.7, pcbY: -7.7, diameter: "2.2mm" }), jsxRuntime.jsx("silkscreentext", { text: "PWR", layer: "top", pcbX: -5.7, pcbY: -7, pcbRotation: 90, fontSize: "0.7mm" }), jsxRuntime.jsx("silkscreentext", { text: "PD IN", layer: "top", pcbX: -6.5, pcbY: -7, pcbRotation: 90, fontSize: "0.5mm" }), jsxRuntime.jsx("silkscreentext", { text: "DATA", layer: "top", pcbX: 5.7, pcbY: 6.2, pcbRotation: 270, fontSize: "0.7mm" }), jsxRuntime.jsx("silkscreentext", { text: "PROG", layer: "top", pcbX: 6.5, pcbY: 6.2, pcbRotation: 270, fontSize: "0.5mm" }), jsxRuntime.jsx("silkscreentext", { text: "MOTOR", layer: "top", pcbX: -8.8, pcbY: 4.0, pcbRotation: 270, fontSize: "0.5mm" }), jsxRuntime.jsx("silkscreentext", { text: "A- A+ B+ B-", layer: "top", pcbX: -5.8, pcbY: 0, pcbRotation: 270, fontSize: "0.4mm" }), jsxRuntime.jsx("silkscreentext", { text: "BOOT", layer: "top", pcbX: 7.6, pcbY: 6.4, fontSize: "0.45mm" }), jsxRuntime.jsx("silkscreentext", { text: "NEMA8 20x20 4L", layer: "bottom", pcbX: 0, pcbY: -8.8, pcbRotation: 180, fontSize: "0.5mm" }), jsxRuntime.jsx("silkscreentext", { text: "0.60A MAX", layer: "bottom", pcbX: 0, pcbY: 8.8, fontSize: "0.5mm" })] }));
}

module.exports = Nema8FourLayerController;