@tscircuit/cli 0.1.704 → 0.1.705

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.
Files changed (2) hide show
  1. package/dist/main.js +628 -601
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -60652,8 +60652,8 @@ var require_utils6 = __commonJS((exports2) => {
60652
60652
  var result = transform[inputType][outputType](input);
60653
60653
  return result;
60654
60654
  };
60655
- exports2.resolve = function(path24) {
60656
- var parts = path24.split("/");
60655
+ exports2.resolve = function(path25) {
60656
+ var parts = path25.split("/");
60657
60657
  var result = [];
60658
60658
  for (var index = 0;index < parts.length; index++) {
60659
60659
  var part = parts[index];
@@ -66103,18 +66103,18 @@ var require_object = __commonJS((exports2, module2) => {
66103
66103
  var object = new ZipObject(name, zipObjectContent, o);
66104
66104
  this.files[name] = object;
66105
66105
  };
66106
- var parentFolder = function(path24) {
66107
- if (path24.slice(-1) === "/") {
66108
- path24 = path24.substring(0, path24.length - 1);
66106
+ var parentFolder = function(path25) {
66107
+ if (path25.slice(-1) === "/") {
66108
+ path25 = path25.substring(0, path25.length - 1);
66109
66109
  }
66110
- var lastSlash = path24.lastIndexOf("/");
66111
- return lastSlash > 0 ? path24.substring(0, lastSlash) : "";
66110
+ var lastSlash = path25.lastIndexOf("/");
66111
+ return lastSlash > 0 ? path25.substring(0, lastSlash) : "";
66112
66112
  };
66113
- var forceTrailingSlash = function(path24) {
66114
- if (path24.slice(-1) !== "/") {
66115
- path24 += "/";
66113
+ var forceTrailingSlash = function(path25) {
66114
+ if (path25.slice(-1) !== "/") {
66115
+ path25 += "/";
66116
66116
  }
66117
- return path24;
66117
+ return path25;
66118
66118
  };
66119
66119
  var folderAdd = function(name, createFolders) {
66120
66120
  createFolders = typeof createFolders !== "undefined" ? createFolders : defaults.createFolders;
@@ -67193,7 +67193,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
67193
67193
  });
67194
67194
  };
67195
67195
  traverse(program3, []);
67196
- return allCommandPaths.filter((path27) => path27 !== "");
67196
+ return allCommandPaths.filter((path28) => path28 !== "");
67197
67197
  };
67198
67198
  var normalizeCommandName = (s) => s.replace(/_/g, "-").toLowerCase();
67199
67199
  var getCommandFromPath = (program3, commandPathAndPositionalArgs) => {
@@ -67201,7 +67201,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
67201
67201
  return commandPath.reduce((curr, nextCommandName) => !curr ? null : curr.commands.find((c) => normalizeCommandName(c.name()) === normalizeCommandName(nextCommandName)), program3);
67202
67202
  };
67203
67203
  var getCommandPathOnly = (program3, commandPathAndPositionalArgs) => {
67204
- const allLeafCommandPaths = getAllLeafCommandPaths(program3).map((path27) => normalizeCommandName(path27));
67204
+ const allLeafCommandPaths = getAllLeafCommandPaths(program3).map((path28) => normalizeCommandName(path28));
67205
67205
  const commandPath = [];
67206
67206
  for (const elm of commandPathAndPositionalArgs) {
67207
67207
  if (elm.startsWith("-"))
@@ -67488,7 +67488,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
67488
67488
  "node_modules/fs.realpath/old.js"(exports3) {
67489
67489
  var pathModule = __require("path");
67490
67490
  var isWindows2 = process.platform === "win32";
67491
- var fs25 = __require("fs");
67491
+ var fs26 = __require("fs");
67492
67492
  var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
67493
67493
  function rethrow() {
67494
67494
  var callback;
@@ -67553,7 +67553,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
67553
67553
  base = m2[0];
67554
67554
  previous = "";
67555
67555
  if (isWindows2 && !knownHard[base]) {
67556
- fs25.lstatSync(base);
67556
+ fs26.lstatSync(base);
67557
67557
  knownHard[base] = true;
67558
67558
  }
67559
67559
  }
@@ -67571,7 +67571,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
67571
67571
  if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
67572
67572
  resolvedLink = cache[base];
67573
67573
  } else {
67574
- var stat4 = fs25.lstatSync(base);
67574
+ var stat4 = fs26.lstatSync(base);
67575
67575
  if (!stat4.isSymbolicLink()) {
67576
67576
  knownHard[base] = true;
67577
67577
  if (cache)
@@ -67586,8 +67586,8 @@ var require_dist8 = __commonJS((exports2, module2) => {
67586
67586
  }
67587
67587
  }
67588
67588
  if (linkTarget === null) {
67589
- fs25.statSync(base);
67590
- linkTarget = fs25.readlinkSync(base);
67589
+ fs26.statSync(base);
67590
+ linkTarget = fs26.readlinkSync(base);
67591
67591
  }
67592
67592
  resolvedLink = pathModule.resolve(previous, linkTarget);
67593
67593
  if (cache)
@@ -67624,7 +67624,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
67624
67624
  base = m2[0];
67625
67625
  previous = "";
67626
67626
  if (isWindows2 && !knownHard[base]) {
67627
- fs25.lstat(base, function(err) {
67627
+ fs26.lstat(base, function(err) {
67628
67628
  if (err)
67629
67629
  return cb(err);
67630
67630
  knownHard[base] = true;
@@ -67652,7 +67652,7 @@ var require_dist8 = __commonJS((exports2, module2) => {
67652
67652
  if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
67653
67653
  return gotResolvedLink(cache[base]);
67654
67654
  }
67655
- return fs25.lstat(base, gotStat);
67655
+ return fs26.lstat(base, gotStat);
67656
67656
  }
67657
67657
  function gotStat(err, stat4) {
67658
67658
  if (err)
@@ -67669,10 +67669,10 @@ var require_dist8 = __commonJS((exports2, module2) => {
67669
67669
  return gotTarget(null, seenLinks[id], base);
67670
67670
  }
67671
67671
  }
67672
- fs25.stat(base, function(err2) {
67672
+ fs26.stat(base, function(err2) {
67673
67673
  if (err2)
67674
67674
  return cb(err2);
67675
- fs25.readlink(base, function(err3, target) {
67675
+ fs26.readlink(base, function(err3, target) {
67676
67676
  if (!isWindows2)
67677
67677
  seenLinks[id] = target;
67678
67678
  gotTarget(err3, target);
@@ -67702,9 +67702,9 @@ var require_dist8 = __commonJS((exports2, module2) => {
67702
67702
  realpath2.realpathSync = realpathSync;
67703
67703
  realpath2.monkeypatch = monkeypatch;
67704
67704
  realpath2.unmonkeypatch = unmonkeypatch;
67705
- var fs25 = __require("fs");
67706
- var origRealpath = fs25.realpath;
67707
- var origRealpathSync = fs25.realpathSync;
67705
+ var fs26 = __require("fs");
67706
+ var origRealpath = fs26.realpath;
67707
+ var origRealpathSync = fs26.realpathSync;
67708
67708
  var version2 = process.version;
67709
67709
  var ok = /^v[0-5]\./.test(version2);
67710
67710
  var old = require_old();
@@ -67742,12 +67742,12 @@ var require_dist8 = __commonJS((exports2, module2) => {
67742
67742
  }
67743
67743
  }
67744
67744
  function monkeypatch() {
67745
- fs25.realpath = realpath2;
67746
- fs25.realpathSync = realpathSync;
67745
+ fs26.realpath = realpath2;
67746
+ fs26.realpathSync = realpathSync;
67747
67747
  }
67748
67748
  function unmonkeypatch() {
67749
- fs25.realpath = origRealpath;
67750
- fs25.realpathSync = origRealpathSync;
67749
+ fs26.realpath = origRealpath;
67750
+ fs26.realpathSync = origRealpathSync;
67751
67751
  }
67752
67752
  }
67753
67753
  });
@@ -67973,8 +67973,8 @@ var require_dist8 = __commonJS((exports2, module2) => {
67973
67973
  return new Minimatch(pattern, options).match(p);
67974
67974
  };
67975
67975
  module22.exports = minimatch;
67976
- var path27 = require_path2();
67977
- minimatch.sep = path27.sep;
67976
+ var path28 = require_path2();
67977
+ minimatch.sep = path28.sep;
67978
67978
  var GLOBSTAR = Symbol("globstar **");
67979
67979
  minimatch.GLOBSTAR = GLOBSTAR;
67980
67980
  var expand = require_brace_expansion();
@@ -68465,8 +68465,8 @@ globstar while`, file, fr, pattern, pr, swallowee);
68465
68465
  if (f === "/" && partial)
68466
68466
  return true;
68467
68467
  const options = this.options;
68468
- if (path27.sep !== "/") {
68469
- f = f.split(path27.sep).join("/");
68468
+ if (path28.sep !== "/") {
68469
+ f = f.split(path28.sep).join("/");
68470
68470
  }
68471
68471
  f = f.split(slashSplit);
68472
68472
  this.debug(this.pattern, "split", f);
@@ -68556,8 +68556,8 @@ globstar while`, file, fr, pattern, pr, swallowee);
68556
68556
  function ownProp(obj, field) {
68557
68557
  return Object.prototype.hasOwnProperty.call(obj, field);
68558
68558
  }
68559
- var fs25 = __require("fs");
68560
- var path27 = __require("path");
68559
+ var fs26 = __require("fs");
68560
+ var path28 = __require("path");
68561
68561
  var minimatch = require_minimatch();
68562
68562
  var isAbsolute3 = __require("path").isAbsolute;
68563
68563
  var Minimatch = minimatch.Minimatch;
@@ -68611,7 +68611,7 @@ globstar while`, file, fr, pattern, pr, swallowee);
68611
68611
  self2.stat = !!options.stat;
68612
68612
  self2.noprocess = !!options.noprocess;
68613
68613
  self2.absolute = !!options.absolute;
68614
- self2.fs = options.fs || fs25;
68614
+ self2.fs = options.fs || fs26;
68615
68615
  self2.maxLength = options.maxLength || Infinity;
68616
68616
  self2.cache = options.cache || /* @__PURE__ */ Object.create(null);
68617
68617
  self2.statCache = options.statCache || /* @__PURE__ */ Object.create(null);
@@ -68620,13 +68620,13 @@ globstar while`, file, fr, pattern, pr, swallowee);
68620
68620
  self2.changedCwd = false;
68621
68621
  var cwd = process.cwd();
68622
68622
  if (!ownProp(options, "cwd"))
68623
- self2.cwd = path27.resolve(cwd);
68623
+ self2.cwd = path28.resolve(cwd);
68624
68624
  else {
68625
- self2.cwd = path27.resolve(options.cwd);
68625
+ self2.cwd = path28.resolve(options.cwd);
68626
68626
  self2.changedCwd = self2.cwd !== cwd;
68627
68627
  }
68628
- self2.root = options.root || path27.resolve(self2.cwd, "/");
68629
- self2.root = path27.resolve(self2.root);
68628
+ self2.root = options.root || path28.resolve(self2.cwd, "/");
68629
+ self2.root = path28.resolve(self2.root);
68630
68630
  self2.cwdAbs = isAbsolute3(self2.cwd) ? self2.cwd : makeAbs(self2, self2.cwd);
68631
68631
  self2.nomount = !!options.nomount;
68632
68632
  if (process.platform === "win32") {
@@ -68709,13 +68709,13 @@ globstar while`, file, fr, pattern, pr, swallowee);
68709
68709
  function makeAbs(self2, f) {
68710
68710
  var abs = f;
68711
68711
  if (f.charAt(0) === "/") {
68712
- abs = path27.join(self2.root, f);
68712
+ abs = path28.join(self2.root, f);
68713
68713
  } else if (isAbsolute3(f) || f === "") {
68714
68714
  abs = f;
68715
68715
  } else if (self2.changedCwd) {
68716
- abs = path27.resolve(self2.cwd, f);
68716
+ abs = path28.resolve(self2.cwd, f);
68717
68717
  } else {
68718
- abs = path27.resolve(f);
68718
+ abs = path28.resolve(f);
68719
68719
  }
68720
68720
  if (process.platform === "win32")
68721
68721
  abs = abs.replace(/\\/g, "/");
@@ -68746,7 +68746,7 @@ globstar while`, file, fr, pattern, pr, swallowee);
68746
68746
  var Minimatch = minimatch.Minimatch;
68747
68747
  var Glob = require_glob().Glob;
68748
68748
  var util = __require("util");
68749
- var path27 = __require("path");
68749
+ var path28 = __require("path");
68750
68750
  var assert2 = __require("assert");
68751
68751
  var isAbsolute3 = __require("path").isAbsolute;
68752
68752
  var common = require_common4();
@@ -68876,7 +68876,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
68876
68876
  e = prefix + e;
68877
68877
  }
68878
68878
  if (e.charAt(0) === "/" && !this.nomount) {
68879
- e = path27.join(this.root, e);
68879
+ e = path28.join(this.root, e);
68880
68880
  }
68881
68881
  this._emitMatch(index, e);
68882
68882
  }
@@ -69025,9 +69025,9 @@ See: https://github.com/isaacs/node-glob/issues/167`);
69025
69025
  if (prefix && isAbsolute3(prefix) && !this.nomount) {
69026
69026
  var trail = /[\/\\]$/.test(prefix);
69027
69027
  if (prefix.charAt(0) === "/") {
69028
- prefix = path27.join(this.root, prefix);
69028
+ prefix = path28.join(this.root, prefix);
69029
69029
  } else {
69030
- prefix = path27.resolve(this.root, prefix);
69030
+ prefix = path28.resolve(this.root, prefix);
69031
69031
  if (trail)
69032
69032
  prefix += "/";
69033
69033
  }
@@ -69214,7 +69214,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
69214
69214
  var Minimatch = minimatch.Minimatch;
69215
69215
  var inherits = require_inherits2();
69216
69216
  var EE = __require("events").EventEmitter;
69217
- var path27 = __require("path");
69217
+ var path28 = __require("path");
69218
69218
  var assert2 = __require("assert");
69219
69219
  var isAbsolute3 = __require("path").isAbsolute;
69220
69220
  var globSync = require_sync7();
@@ -69497,7 +69497,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
69497
69497
  e = prefix + e;
69498
69498
  }
69499
69499
  if (e.charAt(0) === "/" && !this.nomount) {
69500
- e = path27.join(this.root, e);
69500
+ e = path28.join(this.root, e);
69501
69501
  }
69502
69502
  this._emitMatch(index, e);
69503
69503
  }
@@ -69684,9 +69684,9 @@ See: https://github.com/isaacs/node-glob/issues/167`);
69684
69684
  if (prefix && isAbsolute3(prefix) && !this.nomount) {
69685
69685
  var trail = /[\/\\]$/.test(prefix);
69686
69686
  if (prefix.charAt(0) === "/") {
69687
- prefix = path27.join(this.root, prefix);
69687
+ prefix = path28.join(this.root, prefix);
69688
69688
  } else {
69689
- prefix = path27.resolve(this.root, prefix);
69689
+ prefix = path28.resolve(this.root, prefix);
69690
69690
  if (trail)
69691
69691
  prefix += "/";
69692
69692
  }
@@ -69870,7 +69870,7 @@ export default {
69870
69870
  }
69871
69871
  case "export-pathlist": {
69872
69872
  return `export default [
69873
- ` + Object.keys(vfs).map((path27) => ` "${path27}"`).join(`,
69873
+ ` + Object.keys(vfs).map((path28) => ` "${path28}"`).join(`,
69874
69874
  `) + `
69875
69875
  ]`;
69876
69876
  }
@@ -73251,7 +73251,8 @@ var projectConfigSchema = z.object({
73251
73251
  var CONFIG_FILENAME = "tscircuit.config.json";
73252
73252
  var DEFAULT_BOARD_FILE_PATTERNS = [
73253
73253
  "**/*.board.tsx",
73254
- "**/*.circuit.tsx"
73254
+ "**/*.circuit.tsx",
73255
+ "**/*.circuit.json"
73255
73256
  ];
73256
73257
  var loadProjectConfig = (projectDir = process.cwd()) => {
73257
73258
  const configPath = path9.join(projectDir, CONFIG_FILENAME);
@@ -74453,9 +74454,9 @@ export default () => (
74453
74454
  };
74454
74455
 
74455
74456
  // cli/dev/register.ts
74456
- import * as fs20 from "node:fs";
74457
+ import * as fs21 from "node:fs";
74457
74458
  import * as net from "node:net";
74458
- import * as path22 from "node:path";
74459
+ import * as path23 from "node:path";
74459
74460
 
74460
74461
  // lib/server/createHttpServer.ts
74461
74462
  import * as http from "node:http";
@@ -79633,11 +79634,9 @@ class DevServer {
79633
79634
  }
79634
79635
  }
79635
79636
 
79636
- // lib/getVersion.ts
79637
- var import_semver4 = __toESM2(require_semver2(), 1);
79638
- var getVersion = () => {
79639
- return import_semver4.default.inc(package_default.version, "patch") ?? package_default.version;
79640
- };
79637
+ // cli/dev/resolve-dev-target.ts
79638
+ import * as fs20 from "node:fs";
79639
+ import * as path22 from "node:path";
79641
79640
 
79642
79641
  // lib/shared/find-board-files.ts
79643
79642
  import fs19 from "node:fs";
@@ -79709,25 +79708,83 @@ var findBoardFiles = ({
79709
79708
  return Array.from(boardFileSet).sort((a, b) => a.localeCompare(b));
79710
79709
  };
79711
79710
 
79712
- // cli/dev/register.ts
79713
- var findSelectableTsxFiles = (projectDir) => {
79711
+ // cli/dev/resolve-dev-target.ts
79712
+ var findSelectableFiles = (projectDir) => {
79714
79713
  const boardFiles = findBoardFiles({ projectDir }).filter((file) => fs20.existsSync(file)).sort();
79715
79714
  if (boardFiles.length > 0) {
79716
79715
  return boardFiles;
79717
79716
  }
79718
- const files = globbySync(["**/*.tsx", "**/*.ts"], {
79717
+ const files = globbySync(["**/*.tsx", "**/*.ts", "**/*.circuit.json"], {
79719
79718
  cwd: projectDir,
79720
79719
  ignore: DEFAULT_IGNORED_PATTERNS
79721
79720
  });
79722
79721
  return files.map((file) => path22.resolve(projectDir, file)).filter((file) => fs20.existsSync(file)).sort();
79723
79722
  };
79723
+ var isValidDevFile = (filePath) => {
79724
+ return filePath.endsWith(".tsx") || filePath.endsWith(".ts") || filePath.endsWith(".circuit.json");
79725
+ };
79726
+ var resolveDevTarget = async (file) => {
79727
+ let projectDir = process.cwd();
79728
+ if (file) {
79729
+ const resolvedPath = path22.resolve(file);
79730
+ if (fs20.existsSync(resolvedPath) && fs20.statSync(resolvedPath).isDirectory()) {
79731
+ projectDir = resolvedPath;
79732
+ const availableFiles2 = findSelectableFiles(projectDir);
79733
+ if (availableFiles2.length === 0) {
79734
+ console.log(`No .tsx, .ts, or .circuit.json files found in ${projectDir}. Run 'tsci init' to bootstrap a basic project.`);
79735
+ return null;
79736
+ }
79737
+ console.log("Selected file:", path22.relative(projectDir, availableFiles2[0]));
79738
+ return { absolutePath: availableFiles2[0], projectDir };
79739
+ }
79740
+ if (!fs20.existsSync(resolvedPath)) {
79741
+ console.error(`Error: File not found: ${file}`);
79742
+ return null;
79743
+ }
79744
+ if (!isValidDevFile(resolvedPath)) {
79745
+ console.error("Error: Only .tsx, .ts, and .circuit.json files are supported");
79746
+ return null;
79747
+ }
79748
+ return { absolutePath: resolvedPath, projectDir };
79749
+ }
79750
+ const entrypointPath = await getEntrypoint({ onError: () => {} });
79751
+ if (entrypointPath && fs20.existsSync(entrypointPath)) {
79752
+ console.log("Found entrypoint at:", entrypointPath);
79753
+ return { absolutePath: entrypointPath, projectDir };
79754
+ }
79755
+ const availableFiles = findSelectableFiles(projectDir);
79756
+ if (availableFiles.length === 0) {
79757
+ console.log("No .tsx, .ts, or .circuit.json files found in the project. Run 'tsci init' to bootstrap a basic project.");
79758
+ return null;
79759
+ }
79760
+ console.log("Selected file:", path22.relative(projectDir, availableFiles[0]));
79761
+ return { absolutePath: availableFiles[0], projectDir };
79762
+ };
79763
+
79764
+ // lib/getVersion.ts
79765
+ var import_semver4 = __toESM2(require_semver2(), 1);
79766
+ var getVersion = () => {
79767
+ return import_semver4.default.inc(package_default.version, "patch") ?? package_default.version;
79768
+ };
79769
+
79770
+ // cli/dev/register.ts
79771
+ var isPortAvailable = (port) => {
79772
+ return new Promise((resolve8) => {
79773
+ const server = net.createServer();
79774
+ server.once("error", () => resolve8(false));
79775
+ server.once("listening", () => {
79776
+ server.close(() => resolve8(true));
79777
+ });
79778
+ server.listen(port);
79779
+ });
79780
+ };
79724
79781
  var warnIfTsconfigMissingTscircuitType = (projectDir) => {
79725
- const tsconfigPath = path22.join(projectDir, "tsconfig.json");
79726
- if (!fs20.existsSync(tsconfigPath)) {
79782
+ const tsconfigPath = path23.join(projectDir, "tsconfig.json");
79783
+ if (!fs21.existsSync(tsconfigPath)) {
79727
79784
  return;
79728
79785
  }
79729
79786
  try {
79730
- const tsconfig = JSON.parse(fs20.readFileSync(tsconfigPath, "utf-8"));
79787
+ const tsconfig = JSON.parse(fs21.readFileSync(tsconfigPath, "utf-8"));
79731
79788
  const types = tsconfig?.compilerOptions?.types;
79732
79789
  if (!Array.isArray(types) || !types.includes("tscircuit")) {
79733
79790
  console.warn(kleur_default.yellow('Warning: "tscircuit" is missing from tsconfig.json compilerOptions.types. Add it (e.g. "types": ["tscircuit"]) to ensure CLI-provided types work correctly.'));
@@ -79735,52 +79792,22 @@ var warnIfTsconfigMissingTscircuitType = (projectDir) => {
79735
79792
  } catch {}
79736
79793
  };
79737
79794
  var registerDev = (program3) => {
79738
- program3.command("dev").description("Start development server for a package").argument("[file]", "Path to the package file").option("-p, --port <number>", "Port to run server on", "3020").action(async (file, options) => {
79795
+ program3.command("dev").description("Start development server for a package").argument("[file]", "Path to the package file or directory").option("-p, --port <number>", "Port to run server on", "3020").action(async (file, options) => {
79739
79796
  let port = parseInt(options.port);
79740
79797
  const startTime = Date.now();
79741
- const isPortAvailable = (port2) => {
79742
- return new Promise((resolve8) => {
79743
- const server2 = net.createServer();
79744
- server2.once("error", () => resolve8(false));
79745
- server2.once("listening", () => {
79746
- server2.close(() => resolve8(true));
79747
- });
79748
- server2.listen(port2);
79749
- });
79750
- };
79751
79798
  while (!await isPortAvailable(port)) {
79752
79799
  console.log(kleur_default.gray(`Port ${port} is in use, trying port ${port + 1}...`));
79753
79800
  port += 1;
79754
79801
  }
79755
- let absolutePath;
79756
- if (file) {
79757
- absolutePath = path22.resolve(file);
79758
- if (!absolutePath.endsWith(".tsx") && !absolutePath.endsWith(".ts")) {
79759
- console.error("Error: Only .tsx files are supported");
79760
- return;
79761
- }
79762
- } else {
79763
- const entrypointPath = await getEntrypoint({
79764
- onError: () => {}
79765
- });
79766
- if (entrypointPath && fs20.existsSync(entrypointPath)) {
79767
- absolutePath = entrypointPath;
79768
- console.log("Found entrypoint at:", entrypointPath);
79769
- } else {
79770
- const availableFiles = findSelectableTsxFiles(process.cwd());
79771
- if (availableFiles.length === 0) {
79772
- console.log("No .tsx or .ts files found in the project. Run 'tsci init' to bootstrap a basic project.");
79773
- return;
79774
- }
79775
- absolutePath = availableFiles[0];
79776
- console.log("Selected file:", path22.relative(process.cwd(), absolutePath));
79777
- }
79778
- }
79779
- warnIfTsconfigMissingTscircuitType(process.cwd());
79802
+ const target = await resolveDevTarget(file);
79803
+ if (!target)
79804
+ return;
79805
+ const { absolutePath, projectDir } = target;
79806
+ warnIfTsconfigMissingTscircuitType(projectDir);
79780
79807
  const server = new DevServer({
79781
79808
  port,
79782
79809
  componentFilePath: absolutePath,
79783
- projectDir: process.cwd()
79810
+ projectDir
79784
79811
  });
79785
79812
  await server.start();
79786
79813
  const timeToStart = Date.now() - startTime;
@@ -79788,7 +79815,7 @@ var registerDev = (program3) => {
79788
79815
 
79789
79816
  ${kleur_default.green(`@tscircuit/cli@${getVersion()}`)} ${kleur_default.gray("ready in")} ${kleur_default.white(`${Math.round(timeToStart)}ms`)}`);
79790
79817
  console.log(`
79791
- ${kleur_default.bold("➜ Local:")} ${kleur_default.underline(kleur_default.cyan(`http://localhost:${port}`))}${server.componentFilePath ? kleur_default.underline(kleur_default.cyan(`/#file=${encodeURIComponent(path22.relative(process.cwd(), server.componentFilePath).replaceAll("\\", "/"))}`)) : ""}
79818
+ ${kleur_default.bold("➜ Local:")} ${kleur_default.underline(kleur_default.cyan(`http://localhost:${port}`))}${server.componentFilePath ? kleur_default.underline(kleur_default.cyan(`/#file=${encodeURIComponent(path23.relative(process.cwd(), server.componentFilePath).replaceAll("\\", "/"))}`)) : ""}
79792
79819
 
79793
79820
  `);
79794
79821
  console.log(kleur_default.gray(`Watching ${kleur_default.underline(server.projectDir.split("/").slice(-2).join("/"))} for changes...`));
@@ -79843,21 +79870,21 @@ var delay2 = createDelay();
79843
79870
  var delay_default = delay2;
79844
79871
 
79845
79872
  // cli/auth/setup-npmrc/setup-npmrc.ts
79846
- import * as fs21 from "node:fs";
79847
- import * as path23 from "node:path";
79873
+ import * as fs22 from "node:fs";
79874
+ import * as path24 from "node:path";
79848
79875
  import * as os3 from "node:os";
79849
79876
  var REGISTRY_URL = "npm.tscircuit.com";
79850
79877
  function findGlobalNpmrc() {
79851
79878
  const possiblePaths = [
79852
- path23.join(os3.homedir(), ".npmrc"),
79853
- process.env.USERPROFILE ? path23.join(process.env.USERPROFILE, ".npmrc") : null
79879
+ path24.join(os3.homedir(), ".npmrc"),
79880
+ process.env.USERPROFILE ? path24.join(process.env.USERPROFILE, ".npmrc") : null
79854
79881
  ].filter(Boolean);
79855
79882
  for (const npmrcPath of possiblePaths) {
79856
- if (fs21.existsSync(npmrcPath)) {
79883
+ if (fs22.existsSync(npmrcPath)) {
79857
79884
  return npmrcPath;
79858
79885
  }
79859
79886
  }
79860
- return path23.join(os3.homedir(), ".npmrc");
79887
+ return path24.join(os3.homedir(), ".npmrc");
79861
79888
  }
79862
79889
  function printManualInstructions(sessionToken) {
79863
79890
  console.log(kleur_default.yellow(`
@@ -79865,7 +79892,7 @@ Manual setup instructions:`));
79865
79892
  console.log(kleur_default.gray("─".repeat(50)));
79866
79893
  console.log(`
79867
79894
  1. Open or create your global .npmrc file:`);
79868
- console.log(kleur_default.cyan(` ${path23.join(os3.homedir(), ".npmrc")}`));
79895
+ console.log(kleur_default.cyan(` ${path24.join(os3.homedir(), ".npmrc")}`));
79869
79896
  console.log(`
79870
79897
  2. Add the following line:`);
79871
79898
  console.log(kleur_default.cyan(` //${REGISTRY_URL}/:_authToken=${sessionToken}`));
@@ -79880,12 +79907,12 @@ function setupNpmrc(sessionToken) {
79880
79907
  }
79881
79908
  try {
79882
79909
  let existingContent = "";
79883
- if (fs21.existsSync(npmrcPath)) {
79884
- existingContent = fs21.readFileSync(npmrcPath, "utf-8");
79910
+ if (fs22.existsSync(npmrcPath)) {
79911
+ existingContent = fs22.readFileSync(npmrcPath, "utf-8");
79885
79912
  const authLineRegex = new RegExp(`^//${REGISTRY_URL.replace(/\./g, "\\.")}/:_authToken=.+$`, "m");
79886
79913
  if (authLineRegex.test(existingContent)) {
79887
79914
  const updatedContent = existingContent.replace(authLineRegex, authLine);
79888
- fs21.writeFileSync(npmrcPath, updatedContent, "utf-8");
79915
+ fs22.writeFileSync(npmrcPath, updatedContent, "utf-8");
79889
79916
  console.log(kleur_default.green(`Updated authentication token in ${npmrcPath}`));
79890
79917
  return true;
79891
79918
  }
@@ -79896,7 +79923,7 @@ function setupNpmrc(sessionToken) {
79896
79923
  ${authLine}
79897
79924
  ` : `${authLine}
79898
79925
  `;
79899
- fs21.writeFileSync(npmrcPath, newContent, "utf-8");
79926
+ fs22.writeFileSync(npmrcPath, newContent, "utf-8");
79900
79927
  console.log(kleur_default.green(`Added authentication token to ${npmrcPath}`));
79901
79928
  return true;
79902
79929
  } catch (error) {
@@ -79990,26 +80017,26 @@ var registerConfigPrint = (program3) => {
79990
80017
  };
79991
80018
 
79992
80019
  // cli/clone/register.ts
79993
- import * as fs24 from "node:fs";
79994
- import * as path26 from "node:path";
80020
+ import * as fs25 from "node:fs";
80021
+ import * as path27 from "node:path";
79995
80022
 
79996
80023
  // cli/clone/clone-bug-report.ts
79997
80024
  var import_jszip = __toESM2(require_lib4(), 1);
79998
80025
  var import_prompts7 = __toESM2(require_prompts3(), 1);
79999
- import * as fs23 from "node:fs";
80000
- import * as path25 from "node:path";
80026
+ import * as fs24 from "node:fs";
80027
+ import * as path26 from "node:path";
80001
80028
 
80002
80029
  // cli/clone/handle-existing-directory.ts
80003
80030
  var import_prompts6 = __toESM2(require_prompts3(), 1);
80004
- import * as fs22 from "node:fs";
80005
- import * as path24 from "node:path";
80031
+ import * as fs23 from "node:fs";
80032
+ import * as path25 from "node:path";
80006
80033
  var handleExistingDirectory = async (dirPath) => {
80007
- if (!fs22.existsSync(dirPath))
80034
+ if (!fs23.existsSync(dirPath))
80008
80035
  return;
80009
80036
  const response = await import_prompts6.default({
80010
80037
  type: "select",
80011
80038
  name: "action",
80012
- message: `Directory "${path24.basename(dirPath)}" already exists. What would you like to do?`,
80039
+ message: `Directory "${path25.basename(dirPath)}" already exists. What would you like to do?`,
80013
80040
  choices: [
80014
80041
  { title: "Merge files into existing directory", value: "merge" },
80015
80042
  {
@@ -80024,7 +80051,7 @@ var handleExistingDirectory = async (dirPath) => {
80024
80051
  process.exit(0);
80025
80052
  }
80026
80053
  if (response.action === "delete") {
80027
- fs22.rmSync(dirPath, { recursive: true, force: true });
80054
+ fs23.rmSync(dirPath, { recursive: true, force: true });
80028
80055
  console.log(`Deleted existing directory: ${dirPath}`);
80029
80056
  } else if (response.action === "merge") {
80030
80057
  console.log(`Merging files into existing directory: ${dirPath}`);
@@ -80050,12 +80077,12 @@ var getCommonDirectoryPrefix = (paths) => {
80050
80077
  return commonSegments.join("/");
80051
80078
  };
80052
80079
  var sanitizeRelativePath = (relativePath) => {
80053
- const normalizedPath = path25.normalize(relativePath);
80080
+ const normalizedPath = path26.normalize(relativePath);
80054
80081
  if (!normalizedPath)
80055
80082
  return null;
80056
- if (path25.isAbsolute(normalizedPath))
80083
+ if (path26.isAbsolute(normalizedPath))
80057
80084
  return null;
80058
- const segments = normalizedPath.split(path25.sep);
80085
+ const segments = normalizedPath.split(path26.sep);
80059
80086
  if (segments.some((segment) => segment === ".." || segment === "")) {
80060
80087
  return null;
80061
80088
  }
@@ -80070,7 +80097,7 @@ var cloneBugReport = async ({
80070
80097
  console.error("Bug report ID must not be empty.");
80071
80098
  process.exit(1);
80072
80099
  }
80073
- let dirPath = path25.resolve(`bug-report-${trimmedBugReportId}`);
80100
+ let dirPath = path26.resolve(`bug-report-${trimmedBugReportId}`);
80074
80101
  await handleExistingDirectory(dirPath);
80075
80102
  const ky2 = getRegistryApiKy();
80076
80103
  let zipBuffer;
@@ -80088,7 +80115,7 @@ var cloneBugReport = async ({
80088
80115
  }
80089
80116
  process.exit(1);
80090
80117
  }
80091
- fs23.mkdirSync(dirPath, { recursive: true });
80118
+ fs24.mkdirSync(dirPath, { recursive: true });
80092
80119
  const zip = await import_jszip.default.loadAsync(zipBuffer);
80093
80120
  const fileEntries = Object.entries(zip.files).filter(([, entry]) => !entry.dir);
80094
80121
  const commonPrefix = getCommonDirectoryPrefix(fileEntries.map(([fileName]) => fileName));
@@ -80100,29 +80127,29 @@ var cloneBugReport = async ({
80100
80127
  console.warn(`Skipping potentially unsafe path: ${fileName}`);
80101
80128
  continue;
80102
80129
  }
80103
- const fullPath = path25.join(dirPath, sanitizedRelativePath);
80104
- fs23.mkdirSync(path25.dirname(fullPath), { recursive: true });
80130
+ const fullPath = path26.join(dirPath, sanitizedRelativePath);
80131
+ fs24.mkdirSync(path26.dirname(fullPath), { recursive: true });
80105
80132
  const fileContent = await entry.async("nodebuffer");
80106
- fs23.writeFileSync(fullPath, fileContent);
80133
+ fs24.writeFileSync(fullPath, fileContent);
80107
80134
  }
80108
- const packageJsonPath = path25.join(dirPath, "package.json");
80109
- if (fs23.existsSync(packageJsonPath)) {
80135
+ const packageJsonPath = path26.join(dirPath, "package.json");
80136
+ if (fs24.existsSync(packageJsonPath)) {
80110
80137
  try {
80111
- const packageJson = JSON.parse(fs23.readFileSync(packageJsonPath, "utf-8"));
80138
+ const packageJson = JSON.parse(fs24.readFileSync(packageJsonPath, "utf-8"));
80112
80139
  const packageName = packageJson?.name;
80113
80140
  if (typeof packageName === "string" && packageName.trim()) {
80114
80141
  const sanitizedName = packageName.replace(/[^a-zA-Z0-9]/g, "_");
80115
- const suggestedDirPath = path25.resolve(`${sanitizedName}_${trimmedBugReportId.slice(7)}`);
80142
+ const suggestedDirPath = path26.resolve(`${sanitizedName}_${trimmedBugReportId.slice(7)}`);
80116
80143
  if (suggestedDirPath !== dirPath) {
80117
80144
  const response = await import_prompts7.default({
80118
80145
  type: "confirm",
80119
80146
  name: "rename",
80120
80147
  initial: true,
80121
- message: `Rename the directory to "${path25.basename(suggestedDirPath)}"?`
80148
+ message: `Rename the directory to "${path26.basename(suggestedDirPath)}"?`
80122
80149
  });
80123
80150
  if (response.rename) {
80124
80151
  await handleExistingDirectory(suggestedDirPath);
80125
- fs23.renameSync(dirPath, suggestedDirPath);
80152
+ fs24.renameSync(dirPath, suggestedDirPath);
80126
80153
  dirPath = suggestedDirPath;
80127
80154
  }
80128
80155
  }
@@ -80131,9 +80158,9 @@ var cloneBugReport = async ({
80131
80158
  console.warn("Unable to read package name for renaming:", error);
80132
80159
  }
80133
80160
  }
80134
- fs23.writeFileSync(path25.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
80161
+ fs24.writeFileSync(path26.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
80135
80162
  generateTsConfig(dirPath);
80136
- const relativeDirPath = path25.relative(originalCwd, dirPath);
80163
+ const relativeDirPath = path26.relative(originalCwd, dirPath);
80137
80164
  console.log(kleur_default.green(`
80138
80165
  Successfully cloned bug report to:`));
80139
80166
  console.log(` ${dirPath}/
@@ -80172,7 +80199,7 @@ var registerClone = (program3) => {
80172
80199
  const [, author, packageName] = match;
80173
80200
  console.log(`Cloning ${author}/${packageName}...`);
80174
80201
  const userSettingToIncludeAuthor = options.includeAuthor || cliConfig.get("alwaysCloneWithAuthorName");
80175
- const dirPath = userSettingToIncludeAuthor ? path26.resolve(`${author}.${packageName}`) : path26.resolve(packageName);
80202
+ const dirPath = userSettingToIncludeAuthor ? path27.resolve(`${author}.${packageName}`) : path27.resolve(packageName);
80176
80203
  await handleExistingDirectory(dirPath);
80177
80204
  const ky2 = getRegistryApiKy();
80178
80205
  let packageFileList = {
@@ -80193,13 +80220,13 @@ var registerClone = (program3) => {
80193
80220
  console.error("Failed to fetch package files:", error instanceof Error ? error.message : error);
80194
80221
  process.exit(1);
80195
80222
  }
80196
- fs24.mkdirSync(dirPath, { recursive: true });
80223
+ fs25.mkdirSync(dirPath, { recursive: true });
80197
80224
  for (const fileInfo of packageFileList.package_files) {
80198
80225
  const filePath = fileInfo.file_path.replace(/^\/|dist\//g, "");
80199
80226
  if (!filePath)
80200
80227
  continue;
80201
- const fullPath = path26.join(dirPath, filePath);
80202
- fs24.mkdirSync(path26.dirname(fullPath), { recursive: true });
80228
+ const fullPath = path27.join(dirPath, filePath);
80229
+ fs25.mkdirSync(path27.dirname(fullPath), { recursive: true });
80203
80230
  try {
80204
80231
  const fileContent = await ky2.get("package_files/get", {
80205
80232
  searchParams: {
@@ -80208,15 +80235,15 @@ var registerClone = (program3) => {
80208
80235
  file_path: fileInfo.file_path
80209
80236
  }
80210
80237
  }).json();
80211
- fs24.writeFileSync(fullPath, fileContent.package_file.content_text);
80238
+ fs25.writeFileSync(fullPath, fileContent.package_file.content_text);
80212
80239
  } catch (error) {
80213
80240
  console.warn(`Skipping ${filePath} due to error:`, error instanceof Error ? error.message : error);
80214
80241
  }
80215
80242
  }
80216
- fs24.writeFileSync(path26.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
80243
+ fs25.writeFileSync(path27.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
80217
80244
  generateTsConfig(dirPath);
80218
80245
  await setupTsciProject(dirPath);
80219
- const relativeDirPath = path26.relative(originalCwd, dirPath);
80246
+ const relativeDirPath = path27.relative(originalCwd, dirPath);
80220
80247
  console.log(kleur_default.green(`
80221
80248
  Successfully cloned to:`));
80222
80249
  console.log(` ${dirPath}/
@@ -80232,8 +80259,8 @@ Successfully cloned to:`));
80232
80259
  var import_perfect_cli = __toESM2(require_dist7(), 1);
80233
80260
 
80234
80261
  // lib/shared/export-snippet.ts
80235
- import fs28 from "node:fs";
80236
- import path30 from "node:path";
80262
+ import fs29 from "node:fs";
80263
+ import path31 from "node:path";
80237
80264
  import { promisify as promisify3 } from "node:util";
80238
80265
 
80239
80266
  // node_modules/circuit-json-to-readable-netlist/dist/index.js
@@ -81412,9 +81439,9 @@ var stringifyDsnJson = (dsnJson) => {
81412
81439
  const stringifyCoordinates = (coordinates) => {
81413
81440
  return coordinates.join(" ");
81414
81441
  };
81415
- const stringifyPath = (path27, level) => {
81442
+ const stringifyPath = (path28, level) => {
81416
81443
  const padding = indent.repeat(level);
81417
- return `${padding}(path ${path27.layer} ${path27.width} ${stringifyCoordinates(path27.coordinates)})`;
81444
+ return `${padding}(path ${path28.layer} ${path28.width} ${stringifyCoordinates(path28.coordinates)})`;
81418
81445
  };
81419
81446
  result += `(pcb ${dsnJson.filename ? dsnJson.filename : "./converted_dsn.dsn"}
81420
81447
  `;
@@ -82326,10 +82353,10 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
82326
82353
  }
82327
82354
  const instances = new SymbolInstances;
82328
82355
  const project = new SymbolInstancesProject("");
82329
- const path27 = new SymbolInstancePath(`/${kicadSch?.uuid?.value || ""}`);
82330
- path27.reference = reference;
82331
- path27.unit = 1;
82332
- project.paths.push(path27);
82356
+ const path28 = new SymbolInstancePath(`/${kicadSch?.uuid?.value || ""}`);
82357
+ path28.reference = reference;
82358
+ path28.unit = 1;
82359
+ project.paths.push(path28);
82333
82360
  instances.projects.push(project);
82334
82361
  symbol._sxInstances = instances;
82335
82362
  symbols3.push(symbol);
@@ -82551,10 +82578,10 @@ var AddSchematicNetLabelsStage = class extends ConverterStage {
82551
82578
  const { kicadSch } = this.ctx;
82552
82579
  const instances = new SymbolInstances2;
82553
82580
  const project = new SymbolInstancesProject2("");
82554
- const path27 = new SymbolInstancePath2(`/${kicadSch?.uuid?.value || ""}`);
82555
- path27.reference = labelText;
82556
- path27.unit = 1;
82557
- project.paths.push(path27);
82581
+ const path28 = new SymbolInstancePath2(`/${kicadSch?.uuid?.value || ""}`);
82582
+ path28.reference = labelText;
82583
+ path28.unit = 1;
82584
+ project.paths.push(path28);
82558
82585
  instances.projects.push(project);
82559
82586
  symbol._sxInstances = instances;
82560
82587
  return symbol;
@@ -82688,11 +82715,11 @@ var AddSheetInstancesStage = class extends ConverterStage {
82688
82715
  throw new Error("KicadSch instance not initialized in context");
82689
82716
  }
82690
82717
  const sheetInstances = new SheetInstances;
82691
- const path27 = new SheetInstancesRootPath;
82692
- path27.value = "/";
82718
+ const path28 = new SheetInstancesRootPath;
82719
+ path28.value = "/";
82693
82720
  const page = new SheetInstancesRootPage("1");
82694
- path27.pages = [page];
82695
- sheetInstances.paths = [path27];
82721
+ path28.pages = [page];
82722
+ sheetInstances.paths = [path28];
82696
82723
  kicadSch.sheetInstances = sheetInstances;
82697
82724
  kicadSch.embeddedFonts = new EmbeddedFonts3(false);
82698
82725
  this.finished = true;
@@ -83631,12 +83658,12 @@ var AddGraphicsStage = class extends ConverterStage {
83631
83658
  throw new Error("PCB transformation matrix not initialized in context");
83632
83659
  }
83633
83660
  const pcbSilkscreenPaths = this.ctx.db.pcb_silkscreen_path?.list() || [];
83634
- for (const path27 of pcbSilkscreenPaths) {
83635
- if (!path27.route || path27.route.length < 2)
83661
+ for (const path28 of pcbSilkscreenPaths) {
83662
+ if (!path28.route || path28.route.length < 2)
83636
83663
  continue;
83637
- for (let i = 0;i < path27.route.length - 1; i++) {
83638
- const startPoint = path27.route[i];
83639
- const endPoint = path27.route[i + 1];
83664
+ for (let i = 0;i < path28.route.length - 1; i++) {
83665
+ const startPoint = path28.route[i];
83666
+ const endPoint = path28.route[i + 1];
83640
83667
  if (!startPoint || !endPoint)
83641
83668
  continue;
83642
83669
  const transformedStart = applyToPoint13(c2kMatPcb, {
@@ -83651,12 +83678,12 @@ var AddGraphicsStage = class extends ConverterStage {
83651
83678
  top: "F.SilkS",
83652
83679
  bottom: "B.SilkS"
83653
83680
  };
83654
- const kicadLayer = layerMap[path27.layer] || path27.layer || "F.SilkS";
83681
+ const kicadLayer = layerMap[path28.layer] || path28.layer || "F.SilkS";
83655
83682
  const grLine = new GrLine({
83656
83683
  start: { x: transformedStart.x, y: transformedStart.y },
83657
83684
  end: { x: transformedEnd.x, y: transformedEnd.y },
83658
83685
  layer: kicadLayer,
83659
- width: path27.stroke_width || 0.15
83686
+ width: path28.stroke_width || 0.15
83660
83687
  });
83661
83688
  const graphicLines = kicadPcb.graphicLines;
83662
83689
  graphicLines.push(grLine);
@@ -84081,8 +84108,8 @@ var import_jszip2 = __toESM2(require_lib4(), 1);
84081
84108
 
84082
84109
  // lib/shared/generate-circuit-json.tsx
84083
84110
  var import_make_vfs2 = __toESM2(require_dist8(), 1);
84084
- import path28 from "node:path";
84085
- import fs26 from "node:fs";
84111
+ import path29 from "node:path";
84112
+ import fs27 from "node:fs";
84086
84113
  import { pathToFileURL } from "node:url";
84087
84114
  import Debug11 from "debug";
84088
84115
 
@@ -84102,12 +84129,12 @@ var abbreviateStringifyObject = (obj) => {
84102
84129
 
84103
84130
  // lib/shared/importFromUserLand.ts
84104
84131
  import { createRequire as createRequire2 } from "node:module";
84105
- import fs25 from "node:fs";
84106
- import path27 from "node:path";
84132
+ import fs26 from "node:fs";
84133
+ import path28 from "node:path";
84107
84134
  async function importFromUserLand(moduleName) {
84108
- const userModulePath = path27.join(process.cwd(), "node_modules", moduleName);
84109
- if (fs25.existsSync(userModulePath)) {
84110
- const userRequire = createRequire2(path27.join(process.cwd(), "noop.js"));
84135
+ const userModulePath = path28.join(process.cwd(), "node_modules", moduleName);
84136
+ if (fs26.existsSync(userModulePath)) {
84137
+ const userRequire = createRequire2(path28.join(process.cwd(), "noop.js"));
84111
84138
  try {
84112
84139
  const resolvedUserPath = userRequire.resolve(moduleName);
84113
84140
  return await import(resolvedUserPath);
@@ -84157,12 +84184,12 @@ async function generateCircuitJson({
84157
84184
  const runner = new userLandTscircuit.RootCircuit({
84158
84185
  platform: platformConfig
84159
84186
  });
84160
- const absoluteFilePath = path28.isAbsolute(filePath) ? filePath : path28.resolve(process.cwd(), filePath);
84161
- const projectDir = path28.dirname(absoluteFilePath);
84187
+ const absoluteFilePath = path29.isAbsolute(filePath) ? filePath : path29.resolve(process.cwd(), filePath);
84188
+ const projectDir = path29.dirname(absoluteFilePath);
84162
84189
  const resolvedOutputDir = outputDir ?? projectDir;
84163
- const relativeComponentPath = path28.relative(projectDir, absoluteFilePath);
84164
- const baseFileName = outputFileName || path28.basename(absoluteFilePath).replace(/\.[^.]+$/, "");
84165
- const outputPath = path28.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
84190
+ const relativeComponentPath = path29.relative(projectDir, absoluteFilePath);
84191
+ const baseFileName = outputFileName || path29.basename(absoluteFilePath).replace(/\.[^.]+$/, "");
84192
+ const outputPath = path29.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
84166
84193
  debug11(`Project directory: ${projectDir}`);
84167
84194
  debug11(`Relative component path: ${relativeComponentPath}`);
84168
84195
  debug11(`Output path: ${outputPath}`);
@@ -84182,7 +84209,7 @@ async function generateCircuitJson({
84182
84209
  return false;
84183
84210
  if (normalizedFilePath.match(/^\.[^/]/))
84184
84211
  return false;
84185
- if (!ALLOWED_FILE_EXTENSIONS.includes(path28.extname(normalizedFilePath)))
84212
+ if (!ALLOWED_FILE_EXTENSIONS.includes(path29.extname(normalizedFilePath)))
84186
84213
  return false;
84187
84214
  return true;
84188
84215
  },
@@ -84200,7 +84227,7 @@ async function generateCircuitJson({
84200
84227
  const circuitJson = await runner.getCircuitJson();
84201
84228
  if (saveToFile) {
84202
84229
  debug11(`Saving circuit JSON to ${outputPath}`);
84203
- fs26.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
84230
+ fs27.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
84204
84231
  }
84205
84232
  return {
84206
84233
  circuitJson,
@@ -84209,8 +84236,8 @@ async function generateCircuitJson({
84209
84236
  }
84210
84237
 
84211
84238
  // cli/build/generate-kicad-footprint-library.ts
84212
- import fs27 from "node:fs";
84213
- import path29 from "node:path";
84239
+ import fs28 from "node:fs";
84240
+ import path30 from "node:path";
84214
84241
  import {
84215
84242
  At as At3,
84216
84243
  KicadPcb as KicadPcb3,
@@ -84271,7 +84298,7 @@ var sanitizeFootprint = (footprint, outputLibraryName) => {
84271
84298
  const modelFiles = [];
84272
84299
  for (const model of models) {
84273
84300
  if (model.path) {
84274
- const modelFilename = path29.basename(model.path);
84301
+ const modelFilename = path30.basename(model.path);
84275
84302
  const newPath = `\${KIPRJMOD}/${targetLibraryName}.3dshapes/${modelFilename}`;
84276
84303
  const newModel = new FootprintModel3(newPath);
84277
84304
  if (model.offset)
@@ -84296,8 +84323,8 @@ var generateKicadFootprintLibrary = async ({
84296
84323
  projects,
84297
84324
  distDir
84298
84325
  }) => {
84299
- const libraryRoot = path29.join(distDir, "kicad-footprints");
84300
- fs27.mkdirSync(libraryRoot, { recursive: true });
84326
+ const libraryRoot = path30.join(distDir, "kicad-footprints");
84327
+ fs28.mkdirSync(libraryRoot, { recursive: true });
84301
84328
  const uniqueFootprints = new Map;
84302
84329
  for (const project of projects) {
84303
84330
  try {
@@ -84320,10 +84347,10 @@ var generateKicadFootprintLibrary = async ({
84320
84347
  const libraryNames = new Set;
84321
84348
  for (const entry of uniqueFootprints.values()) {
84322
84349
  libraryNames.add(entry.libraryName);
84323
- const libraryDir = path29.join(libraryRoot, `${entry.libraryName}.pretty`);
84324
- fs27.mkdirSync(libraryDir, { recursive: true });
84325
- const footprintPath = path29.join(libraryDir, `${entry.footprintName}.kicad_mod`);
84326
- fs27.writeFileSync(footprintPath, `${entry.content}
84350
+ const libraryDir = path30.join(libraryRoot, `${entry.libraryName}.pretty`);
84351
+ fs28.mkdirSync(libraryDir, { recursive: true });
84352
+ const footprintPath = path30.join(libraryDir, `${entry.footprintName}.kicad_mod`);
84353
+ fs28.writeFileSync(footprintPath, `${entry.content}
84327
84354
  `);
84328
84355
  }
84329
84356
  if (libraryNames.size > 0) {
@@ -84333,7 +84360,7 @@ ${libTableEntries.join(`
84333
84360
  `)}
84334
84361
  )
84335
84362
  `;
84336
- fs27.writeFileSync(path29.join(libraryRoot, "fp-lib-table"), libTableContent);
84363
+ fs28.writeFileSync(path30.join(libraryRoot, "fp-lib-table"), libTableContent);
84337
84364
  }
84338
84365
  };
84339
84366
  var extractFootprintsFromPcb = (pcbContent, outputLibraryName) => {
@@ -84363,7 +84390,7 @@ var extractFootprintsFromPcb = (pcbContent, outputLibraryName) => {
84363
84390
  };
84364
84391
 
84365
84392
  // lib/shared/export-snippet.ts
84366
- var writeFileAsync = promisify3(fs28.writeFile);
84393
+ var writeFileAsync = promisify3(fs29.writeFile);
84367
84394
  var ALLOWED_EXPORT_FORMATS = [
84368
84395
  "json",
84369
84396
  "circuit-json",
@@ -84410,10 +84437,10 @@ var exportSnippet = async ({
84410
84437
  onError(`Invalid format: ${format}`);
84411
84438
  return onExit(1);
84412
84439
  }
84413
- const projectDir = path30.dirname(filePath);
84414
- const outputBaseName = path30.basename(filePath).replace(/\.[^.]+$/, "");
84440
+ const projectDir = path31.dirname(filePath);
84441
+ const outputBaseName = path31.basename(filePath).replace(/\.[^.]+$/, "");
84415
84442
  const outputFileName = `${outputBaseName}${OUTPUT_EXTENSIONS[format]}`;
84416
- const outputDestination = path30.join(projectDir, outputPath ?? outputFileName);
84443
+ const outputDestination = path31.join(projectDir, outputPath ?? outputFileName);
84417
84444
  const circuitData = await generateCircuitJson({
84418
84445
  filePath,
84419
84446
  saveToFile: format === "circuit-json",
@@ -84508,26 +84535,26 @@ ${libTableEntries.join(`
84508
84535
  libConverter.runUntilFinished();
84509
84536
  const libOutput = libConverter.getOutput();
84510
84537
  const libDir = outputDestination;
84511
- fs28.mkdirSync(libDir, { recursive: true });
84512
- fs28.writeFileSync(path30.join(libDir, `${libraryName}.kicad_sym`), libOutput.kicadSymString);
84513
- const fpDir = path30.join(libDir, `${fpLibName}.pretty`);
84514
- fs28.mkdirSync(fpDir, { recursive: true });
84538
+ fs29.mkdirSync(libDir, { recursive: true });
84539
+ fs29.writeFileSync(path31.join(libDir, `${libraryName}.kicad_sym`), libOutput.kicadSymString);
84540
+ const fpDir = path31.join(libDir, `${fpLibName}.pretty`);
84541
+ fs29.mkdirSync(fpDir, { recursive: true });
84515
84542
  for (const fp of libOutput.footprints) {
84516
- fs28.writeFileSync(path30.join(fpDir, `${fp.footprintName}.kicad_mod`), `${fp.kicadModString}
84543
+ fs29.writeFileSync(path31.join(fpDir, `${fp.footprintName}.kicad_mod`), `${fp.kicadModString}
84517
84544
  `);
84518
84545
  }
84519
84546
  if (libOutput.model3dSourcePaths.length > 0) {
84520
- const shapesDir = path30.join(libDir, `${fpLibName}.3dshapes`);
84521
- fs28.mkdirSync(shapesDir, { recursive: true });
84547
+ const shapesDir = path31.join(libDir, `${fpLibName}.3dshapes`);
84548
+ fs29.mkdirSync(shapesDir, { recursive: true });
84522
84549
  for (const modelPath of libOutput.model3dSourcePaths) {
84523
- if (fs28.existsSync(modelPath)) {
84524
- const filename = path30.basename(modelPath);
84525
- fs28.copyFileSync(modelPath, path30.join(shapesDir, filename));
84550
+ if (fs29.existsSync(modelPath)) {
84551
+ const filename = path31.basename(modelPath);
84552
+ fs29.copyFileSync(modelPath, path31.join(shapesDir, filename));
84526
84553
  }
84527
84554
  }
84528
84555
  }
84529
- fs28.writeFileSync(path30.join(libDir, "fp-lib-table"), libOutput.fpLibTableString);
84530
- fs28.writeFileSync(path30.join(libDir, "sym-lib-table"), libOutput.symLibTableString);
84556
+ fs29.writeFileSync(path31.join(libDir, "fp-lib-table"), libOutput.fpLibTableString);
84557
+ fs29.writeFileSync(path31.join(libDir, "sym-lib-table"), libOutput.symLibTableString);
84531
84558
  outputContent = "";
84532
84559
  if (writeFile) {
84533
84560
  onSuccess({ outputDestination: libDir, outputContent: "" });
@@ -84662,20 +84689,20 @@ var getSpiceWithPaddedSim = (circuitJson, options) => {
84662
84689
  };
84663
84690
 
84664
84691
  // lib/eecircuit-engine/run-simulation.ts
84665
- import { promises as fs29, existsSync as existsSync11 } from "node:fs";
84666
- import path31 from "node:path";
84692
+ import { promises as fs30, existsSync as existsSync12 } from "node:fs";
84693
+ import path32 from "node:path";
84667
84694
  import os4 from "node:os";
84668
84695
  var sim = null;
84669
84696
  var fetchSimulation = async () => {
84670
- const tempFilePath = path31.join(os4.tmpdir(), "eecircuit-engine-1.5.2.mjs");
84671
- if (!existsSync11(tempFilePath)) {
84697
+ const tempFilePath = path32.join(os4.tmpdir(), "eecircuit-engine-1.5.2.mjs");
84698
+ if (!existsSync12(tempFilePath)) {
84672
84699
  const url = "https://cdn.jsdelivr.net/npm/eecircuit-engine@1.5.2/+esm";
84673
84700
  const response = await fetch(url);
84674
84701
  if (!response.ok) {
84675
84702
  throw new Error(`Failed to fetch eecircuit-engine from ${url}: ${response.statusText}`);
84676
84703
  }
84677
84704
  const scriptContent = await response.text();
84678
- await fs29.writeFile(tempFilePath, scriptContent);
84705
+ await fs30.writeFile(tempFilePath, scriptContent);
84679
84706
  }
84680
84707
  const module2 = await import(tempFilePath);
84681
84708
  return module2.Simulation;
@@ -84764,8 +84791,8 @@ var resultToCsv = (result) => {
84764
84791
  };
84765
84792
 
84766
84793
  // cli/export/register.ts
84767
- import path32 from "node:path";
84768
- import { promises as fs30 } from "node:fs";
84794
+ import path33 from "node:path";
84795
+ import { promises as fs31 } from "node:fs";
84769
84796
  var registerExport = (program3) => {
84770
84797
  program3.command("export").description("Export tscircuit code to various formats").argument("<file>", "Path to the package file").option("-f, --format <format>", `Output format (${ALLOWED_EXPORT_FORMATS.join(", ")})`).option("-o, --output <path>", "Output file path").option("--disable-parts-engine", "Disable the parts engine").action(async (file, options) => {
84771
84798
  const formatOption = options.format ?? "json";
@@ -84777,12 +84804,12 @@ var registerExport = (program3) => {
84777
84804
  });
84778
84805
  if (circuitJson) {
84779
84806
  const spiceString = getSpiceWithPaddedSim(circuitJson);
84780
- const outputSpicePath = options.output ?? path32.join(path32.dirname(file), `${path32.basename(file, path32.extname(file))}.spice.cir`);
84781
- await fs30.writeFile(outputSpicePath, spiceString);
84807
+ const outputSpicePath = options.output ?? path33.join(path33.dirname(file), `${path33.basename(file, path33.extname(file))}.spice.cir`);
84808
+ await fs31.writeFile(outputSpicePath, spiceString);
84782
84809
  const { result } = await runSimulation(spiceString);
84783
84810
  const csvContent = resultToCsv(result);
84784
84811
  const outputCsvPath = outputSpicePath.replace(/\.spice\.cir$/, ".csv");
84785
- await fs30.writeFile(outputCsvPath, csvContent);
84812
+ await fs31.writeFile(outputCsvPath, csvContent);
84786
84813
  console.log(`Exported to ${outputSpicePath} and ${outputCsvPath} (simulation results)!`);
84787
84814
  }
84788
84815
  process.exit(0);
@@ -85007,14 +85034,14 @@ class KeyStore {
85007
85034
  }
85008
85035
  }
85009
85036
  function createKey(key) {
85010
- let path33 = null;
85037
+ let path34 = null;
85011
85038
  let id = null;
85012
85039
  let src = null;
85013
85040
  let weight = 1;
85014
85041
  let getFn = null;
85015
85042
  if (isString2(key) || isArray(key)) {
85016
85043
  src = key;
85017
- path33 = createKeyPath(key);
85044
+ path34 = createKeyPath(key);
85018
85045
  id = createKeyId(key);
85019
85046
  } else {
85020
85047
  if (!hasOwn.call(key, "name")) {
@@ -85028,11 +85055,11 @@ function createKey(key) {
85028
85055
  throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
85029
85056
  }
85030
85057
  }
85031
- path33 = createKeyPath(name);
85058
+ path34 = createKeyPath(name);
85032
85059
  id = createKeyId(name);
85033
85060
  getFn = key.getFn;
85034
85061
  }
85035
- return { path: path33, id, weight, src, getFn };
85062
+ return { path: path34, id, weight, src, getFn };
85036
85063
  }
85037
85064
  function createKeyPath(key) {
85038
85065
  return isArray(key) ? key : key.split(".");
@@ -85040,34 +85067,34 @@ function createKeyPath(key) {
85040
85067
  function createKeyId(key) {
85041
85068
  return isArray(key) ? key.join(".") : key;
85042
85069
  }
85043
- function get(obj, path33) {
85070
+ function get(obj, path34) {
85044
85071
  let list = [];
85045
85072
  let arr = false;
85046
- const deepGet = (obj2, path34, index) => {
85073
+ const deepGet = (obj2, path35, index) => {
85047
85074
  if (!isDefined(obj2)) {
85048
85075
  return;
85049
85076
  }
85050
- if (!path34[index]) {
85077
+ if (!path35[index]) {
85051
85078
  list.push(obj2);
85052
85079
  } else {
85053
- let key = path34[index];
85080
+ let key = path35[index];
85054
85081
  const value = obj2[key];
85055
85082
  if (!isDefined(value)) {
85056
85083
  return;
85057
85084
  }
85058
- if (index === path34.length - 1 && (isString2(value) || isNumber(value) || isBoolean(value))) {
85085
+ if (index === path35.length - 1 && (isString2(value) || isNumber(value) || isBoolean(value))) {
85059
85086
  list.push(toString(value));
85060
85087
  } else if (isArray(value)) {
85061
85088
  arr = true;
85062
85089
  for (let i = 0, len = value.length;i < len; i += 1) {
85063
- deepGet(value[i], path34, index + 1);
85090
+ deepGet(value[i], path35, index + 1);
85064
85091
  }
85065
- } else if (path34.length) {
85066
- deepGet(value, path34, index + 1);
85092
+ } else if (path35.length) {
85093
+ deepGet(value, path35, index + 1);
85067
85094
  }
85068
85095
  }
85069
85096
  };
85070
- deepGet(obj, isString2(path33) ? path33.split(".") : path33, 0);
85097
+ deepGet(obj, isString2(path34) ? path34.split(".") : path34, 0);
85071
85098
  return arr ? list : list[0];
85072
85099
  }
85073
85100
  var MatchOptions = {
@@ -86259,8 +86286,8 @@ var registerSearch = (program3) => {
86259
86286
  }
86260
86287
  if (kicadResults.length) {
86261
86288
  console.log(kleur_default.bold().underline(`Found ${kicadResults.length} footprint(s) from KiCad:`));
86262
- kicadResults.forEach((path33, idx) => {
86263
- console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path33.replace(".kicad_mod", "").replace(".pretty", "")}`);
86289
+ kicadResults.forEach((path34, idx) => {
86290
+ console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path34.replace(".kicad_mod", "").replace(".pretty", "")}`);
86264
86291
  });
86265
86292
  }
86266
86293
  if (!onlyKicad && results.packages.length) {
@@ -91439,7 +91466,7 @@ var { paths: Ad, bounds: ss, refblocks: Pd } = xs;
91439
91466
  var U = e({ primitives: [...Object.values(Ad)], ports: [{ ...Pd.left1, labels: ["1"] }], center: { x: ss.centerX, y: ss.centerY } }).rotateRightFacingSymbol("right").labelPort("left1", ["1"]).build();
91440
91467
  var ms = r(U, "down");
91441
91468
  var ns = r(U, "left");
91442
- var fs31 = r(U, "up");
91469
+ var fs32 = r(U, "up");
91443
91470
  var g = { paths: { path11: { type: "path", points: [{ x: -0.39, y: 0 }, { x: 0.06, y: -0.01 }], color: "primary", fill: false }, "path40-0": { type: "path", points: [{ x: 0.07, y: 0.27 }, { x: 0.07, y: -0.28 }], color: "primary", fill: false }, "path40-0-5": { type: "path", points: [{ x: 0.28, y: 0.24 }, { x: 0.08, y: 0.11 }], color: "primary", fill: false }, "path40-0-5-0": { type: "path", points: [{ x: 0.29, y: -0.24 }, { x: 0.09, y: -0.11 }], color: "primary", fill: false }, "path12-1-5": { type: "path", points: [{ x: 0.29, y: 0.25 }, { x: 0.29, y: 0.54 }], color: "primary", fill: false }, "path12-1-5-3": { type: "path", points: [{ x: 0.29, y: -0.54 }, { x: 0.29, y: -0.25 }], color: "primary", fill: false }, path15: { type: "path", points: [{ x: 0.19, y: -0.1 }, { x: 0.12, y: -0.2 }, { x: 0.22, y: -0.2 }, { x: 0.19, y: -0.1 }], color: "primary", fill: true } }, texts: { top1: { type: "text", text: "{REF}", x: -0.08, y: 0.36 }, bottom1: { type: "text", text: "{VAL}", x: -0.07, y: -0.41 } }, refblocks: { top1: { x: 0.29, y: 0.55 }, bottom1: { x: 0.29, y: -0.55 }, left1: { x: -0.4, y: 0 } }, bounds: { minX: -0.43, maxX: 0.43, minY: -0.58, maxY: 0.58, width: 0.85, height: 1.16, centerX: 0, centerY: 0 }, circles: { "path1-0": { type: "circle", x: 0.14, y: 0, radius: 0.29, color: "primary", fill: false } } };
91444
91471
  var { paths: Fd, texts: XA, bounds: e0, refblocks: Mo, circles: Rd } = g;
91445
91472
  var hs = e({ primitives: [...Object.values(Fd), ...Object.values(Rd), { type: "text", text: "{REF}", x: -0.1, y: 0.3094553499999995 }, { type: "text", text: "{VAL}", x: -0.1, y: -0.3094553499999995 }], ports: [{ ...Mo.top1, labels: ["1", "collector"] }, { ...Mo.bottom1, labels: ["2", "emitter"] }, { ...Mo.left1, labels: ["3", "base"] }], size: { width: e0.width, height: e0.height }, center: { x: e0.centerX, y: e0.centerY } }).rotateRightFacingSymbol("right").changeTextAnchor("{REF}", "middle_right").changeTextAnchor("{VAL}", "middle_right").build();
@@ -92008,7 +92035,7 @@ var mb = Cl.primitives.find((t3) => t3.type === "text" && t3.text === "{VAL}");
92008
92035
  sb.anchor = "middle_left";
92009
92036
  mb.anchor = "middle_right";
92010
92037
  var B1 = Cl;
92011
- var q1 = { ac_voltmeter_down: Ul, ac_voltmeter_horz: Wl, ac_voltmeter_left: Zl, ac_voltmeter_right: Kl, ac_voltmeter_up: ep, ac_voltmeter_vert: op, avalanche_diode_down: lp, avalanche_diode_horz: pp, avalanche_diode_left: yp, avalanche_diode_right: xp, avalanche_diode_up: mp, avalanche_diode_vert: fp, backward_diode_down: cp, backward_diode_left: Dt, backward_diode_right: _p, backward_diode_up: gp, battery_horz: Wt, battery_vert: Ap, boxresistor_down: Fp, boxresistor_left: Ep, boxresistor_right: Lp, boxresistor_small_down: jp, boxresistor_small_left: zp, boxresistor_small_right: Jp, boxresistor_small_up: Mp, boxresistor_up: Ip, bridged_ground_down: Dp, bridged_ground_left: Wp, bridged_ground_right: te, bridged_ground_up: Qp, capacitor_down: ta, capacitor_left: ea, capacitor_polarized_down: oa, capacitor_polarized_left: ia, capacitor_polarized_right: pa, capacitor_polarized_up: ya, capacitor_right: xa, capacitor_up: ma, constant_current_diode_down: fa, constant_current_diode_horz: ha, constant_current_diode_left: da, constant_current_diode_right: ba, constant_current_diode_up: ga, constant_current_diode_vert: va, crystal_4pin_down: wa, crystal_4pin_left: Aa, crystal_4pin_right: Pa, crystal_4pin_up: Sa, crystal_down: Ra, crystal_left: Ta, crystal_right: Ea, crystal_up: Xa, darlington_pair_transistor_down: La, darlington_pair_transistor_horz: Va, darlington_pair_transistor_left: ja, darlington_pair_transistor_right: ka, darlington_pair_transistor_up: za, darlington_pair_transistor_vert: Oa, dc_ammeter_horz: wt, dc_ammeter_vert: Ca, dc_voltmeter_down: Ia, dc_voltmeter_horz: qa, dc_voltmeter_left: Ua, dc_voltmeter_right: Wa, dc_voltmeter_up: Za, dc_voltmeter_vert: Ka, diac_down: ty, diac_horz: ey, diac_left: ry, diac_right: oy, diac_up: iy, diac_vert: ly, diode_down: ay, diode_left: yy, diode_right: $2, diode_up: xy, dpdt_normally_closed_switch_down: my, dpdt_normally_closed_switch_left: ny, dpdt_normally_closed_switch_right: M, dpdt_normally_closed_switch_up: fy, dpdt_switch_down: cy, dpdt_switch_left: dy, dpdt_switch_right: C, dpdt_switch_up: by, dpst_normally_closed_switch_down: gy, dpst_normally_closed_switch_left: uy, dpst_normally_closed_switch_right: N, dpst_normally_closed_switch_up: vy, dpst_switch_down: Ay, dpst_switch_left: Py, dpst_switch_right: I, dpst_switch_up: Sy, ferrite_bead_down: Ry, ferrite_bead_left: Ty, ferrite_bead_right: Fe, ferrite_bead_up: Se, filled_diode_down: Yy, filled_diode_horz: Ly, filled_diode_left: jy, filled_diode_right: zy, filled_diode_up: Jy, filled_diode_vert: My, frequency_meter_horz: At5, frequency_meter_vert: By, fuse_horz: ke, fuse_vert: Uy, ground_down: Gy, ground_horz: Wy, ground_left: Hy, ground_right: Zy, ground_up: Qy, ground_vert: Ky2, ground2_down: ex, ground2_left: ox, ground2_right: lx, ground2_up: ax, gunn_diode_horz: yx, gunn_diode_vert: xx, icled_down: mx, icled_left: nx, icled_right: q, icled_up: fx, igbt_transistor_horz: ze, igbt_transistor_vert: dx, illuminated_push_button_normally_open_horz: Oe, illuminated_push_button_normally_open_vert: ux, inductor_down: Px, inductor_left: Sx, inductor_right: _t, inductor_up: $e, laser_diode_down: Fx, laser_diode_left: Rx, laser_diode_right: D, laser_diode_up: Tx, led_down: Lx, led_left: Vx, led_right: gt, led_up: Ce, light_dependent_resistor_horz: Ie, light_dependent_resistor_vert: $x, mosfet_depletion_normally_on_horz: qe, mosfet_depletion_normally_on_vert: Ix, mushroom_head_normally_open_momentary_horz: Ue, mushroom_head_normally_open_momentary_vert: Ux, n_channel_d_mosfet_transistor_horz: He, n_channel_d_mosfet_transistor_vert: Qx, n_channel_e_mosfet_transistor_horz: Qe, n_channel_e_mosfet_transistor_vert: os5, njfet_transistor_horz: t0, njfet_transistor_vert: ys, not_connected_down: ms, not_connected_left: ns, not_connected_right: U, not_connected_up: fs31, npn_bipolar_transistor_down: hs, npn_bipolar_transistor_horz: cs, npn_bipolar_transistor_left: ds, npn_bipolar_transistor_right: bs, npn_bipolar_transistor_up: _s, npn_bipolar_transistor_vert: gs, opamp_no_power_down: vs, opamp_no_power_left: ws, opamp_no_power_right: G, opamp_no_power_up: As, opamp_with_power_down: Ss, opamp_with_power_left: Fs, opamp_with_power_right: W, opamp_with_power_up: Rs, p_channel_d_mosfet_transistor_horz: a0, p_channel_d_mosfet_transistor_vert: Ls, p_channel_e_mosfet_transistor_horz: x0, p_channel_e_mosfet_transistor_vert: Os, photodiode_horz: s0, photodiode_vert: Cs, pjfet_transistor_horz: n0, pjfet_transistor_vert: Ds, pnp_bipolar_transistor_down: Us, pnp_bipolar_transistor_horz: Gs, pnp_bipolar_transistor_left: Ws, pnp_bipolar_transistor_right: Hs, pnp_bipolar_transistor_up: Zs, pnp_bipolar_transistor_vert: Qs, potentiometer_horz: g0, potentiometer_vert: rm, potentiometer2_down: pm, potentiometer2_left: am, potentiometer2_right: H, potentiometer2_up: ym, potentiometer3_down: xm, potentiometer3_left: sm, potentiometer3_right: mm, potentiometer3_up: nm, power_factor_meter_horz: S0, power_factor_meter_vert: dm, push_button_normally_closed_momentary_horz: R0, push_button_normally_closed_momentary_vert: um, push_button_normally_open_momentary_horz: E0, push_button_normally_open_momentary_vert: Pm, rectifier_diode_horz: L0, rectifier_diode_vert: Rm, resistor_down: Em, resistor_left: Xm, resistor_right: Vm, resistor_up: km, resonator_down: Om, resonator_horz: M0, resonator_left: Jm, resonator_right: K, resonator_up: $m, resonator_vert: Mm, schottky_diode_down: Nm, schottky_diode_left: Im, schottky_diode_right: tt, schottky_diode_up: Bm, silicon_controlled_rectifier_horz: C0, silicon_controlled_rectifier_vert: Um, solderjumper2_bridged12_down: Gm, solderjumper2_bridged12_left: Wm, solderjumper2_bridged12_right: Hm, solderjumper2_bridged12_up: Zm, solderjumper2_down: Qm, solderjumper2_left: Km, solderjumper2_right: tn, solderjumper2_up: en, solderjumper3_bridged12_down: rn, solderjumper3_bridged12_left: on2, solderjumper3_bridged12_right: ln, solderjumper3_bridged12_up: pn, solderjumper3_bridged123_down: an, solderjumper3_bridged123_left: yn, solderjumper3_bridged123_right: xn, solderjumper3_bridged123_up: sn, solderjumper3_bridged23_down: mn, solderjumper3_bridged23_left: nn, solderjumper3_bridged23_right: fn, solderjumper3_bridged23_up: hn, solderjumper3_down: cn, solderjumper3_left: dn, solderjumper3_right: bn, solderjumper3_up: _n, spdt_normally_closed_switch_down: un, spdt_normally_closed_switch_left: vn, spdt_normally_closed_switch_right: at, spdt_normally_closed_switch_up: wn, spdt_switch_down: Pn, spdt_switch_left: Sn, spdt_switch_right: yt, spdt_switch_up: Fn, spst_normally_closed_switch_down: Rn, spst_normally_closed_switch_left: Tn, spst_normally_closed_switch_right: xt, spst_normally_closed_switch_up: En, spst_switch_down: Yn, spst_switch_left: Xn, spst_switch_right: st, spst_switch_up: Ln, square_wave_down: Vn, square_wave_left: jn, square_wave_right: kn, square_wave_up: zn, step_recovery_diode_horz: N0, step_recovery_diode_vert: On, tachometer_horz: Tt, tachometer_vert: Cn, testpoint_down: Bn, testpoint_left: qn, testpoint_right: nt, testpoint_up: Gn, tilted_ground_down: Hn, tilted_ground_left: Zn, tilted_ground_right: ut, tilted_ground_up: B0, triac_horz: q0, triac_vert: t1, tunnel_diode_horz: U0, tunnel_diode_vert: i1, unijunction_transistor_horz: W0, unijunction_transistor_vert: s1, usbc: n1, var_meter_horz: Z0, var_meter_vert: c1, varactor_diode_horz: K0, varactor_diode_vert: g1, varistor_horz: er, varistor_vert: A1, varmeter_horz: Et, varmeter_vert: R1, vcc_down: T1, vcc_left: E1, vcc_right: Y1, vcc_up: X1, volt_meter_horz: or, volt_meter_vert: L1, watt_hour_meter_horz: Yt, watt_hour_meter_vert: z1, wattmeter_horz: Xt, wattmeter_vert: M1, zener_diode_horz: ar, zener_diode_vert: B1 };
92038
+ var q1 = { ac_voltmeter_down: Ul, ac_voltmeter_horz: Wl, ac_voltmeter_left: Zl, ac_voltmeter_right: Kl, ac_voltmeter_up: ep, ac_voltmeter_vert: op, avalanche_diode_down: lp, avalanche_diode_horz: pp, avalanche_diode_left: yp, avalanche_diode_right: xp, avalanche_diode_up: mp, avalanche_diode_vert: fp, backward_diode_down: cp, backward_diode_left: Dt, backward_diode_right: _p, backward_diode_up: gp, battery_horz: Wt, battery_vert: Ap, boxresistor_down: Fp, boxresistor_left: Ep, boxresistor_right: Lp, boxresistor_small_down: jp, boxresistor_small_left: zp, boxresistor_small_right: Jp, boxresistor_small_up: Mp, boxresistor_up: Ip, bridged_ground_down: Dp, bridged_ground_left: Wp, bridged_ground_right: te, bridged_ground_up: Qp, capacitor_down: ta, capacitor_left: ea, capacitor_polarized_down: oa, capacitor_polarized_left: ia, capacitor_polarized_right: pa, capacitor_polarized_up: ya, capacitor_right: xa, capacitor_up: ma, constant_current_diode_down: fa, constant_current_diode_horz: ha, constant_current_diode_left: da, constant_current_diode_right: ba, constant_current_diode_up: ga, constant_current_diode_vert: va, crystal_4pin_down: wa, crystal_4pin_left: Aa, crystal_4pin_right: Pa, crystal_4pin_up: Sa, crystal_down: Ra, crystal_left: Ta, crystal_right: Ea, crystal_up: Xa, darlington_pair_transistor_down: La, darlington_pair_transistor_horz: Va, darlington_pair_transistor_left: ja, darlington_pair_transistor_right: ka, darlington_pair_transistor_up: za, darlington_pair_transistor_vert: Oa, dc_ammeter_horz: wt, dc_ammeter_vert: Ca, dc_voltmeter_down: Ia, dc_voltmeter_horz: qa, dc_voltmeter_left: Ua, dc_voltmeter_right: Wa, dc_voltmeter_up: Za, dc_voltmeter_vert: Ka, diac_down: ty, diac_horz: ey, diac_left: ry, diac_right: oy, diac_up: iy, diac_vert: ly, diode_down: ay, diode_left: yy, diode_right: $2, diode_up: xy, dpdt_normally_closed_switch_down: my, dpdt_normally_closed_switch_left: ny, dpdt_normally_closed_switch_right: M, dpdt_normally_closed_switch_up: fy, dpdt_switch_down: cy, dpdt_switch_left: dy, dpdt_switch_right: C, dpdt_switch_up: by, dpst_normally_closed_switch_down: gy, dpst_normally_closed_switch_left: uy, dpst_normally_closed_switch_right: N, dpst_normally_closed_switch_up: vy, dpst_switch_down: Ay, dpst_switch_left: Py, dpst_switch_right: I, dpst_switch_up: Sy, ferrite_bead_down: Ry, ferrite_bead_left: Ty, ferrite_bead_right: Fe, ferrite_bead_up: Se, filled_diode_down: Yy, filled_diode_horz: Ly, filled_diode_left: jy, filled_diode_right: zy, filled_diode_up: Jy, filled_diode_vert: My, frequency_meter_horz: At5, frequency_meter_vert: By, fuse_horz: ke, fuse_vert: Uy, ground_down: Gy, ground_horz: Wy, ground_left: Hy, ground_right: Zy, ground_up: Qy, ground_vert: Ky2, ground2_down: ex, ground2_left: ox, ground2_right: lx, ground2_up: ax, gunn_diode_horz: yx, gunn_diode_vert: xx, icled_down: mx, icled_left: nx, icled_right: q, icled_up: fx, igbt_transistor_horz: ze, igbt_transistor_vert: dx, illuminated_push_button_normally_open_horz: Oe, illuminated_push_button_normally_open_vert: ux, inductor_down: Px, inductor_left: Sx, inductor_right: _t, inductor_up: $e, laser_diode_down: Fx, laser_diode_left: Rx, laser_diode_right: D, laser_diode_up: Tx, led_down: Lx, led_left: Vx, led_right: gt, led_up: Ce, light_dependent_resistor_horz: Ie, light_dependent_resistor_vert: $x, mosfet_depletion_normally_on_horz: qe, mosfet_depletion_normally_on_vert: Ix, mushroom_head_normally_open_momentary_horz: Ue, mushroom_head_normally_open_momentary_vert: Ux, n_channel_d_mosfet_transistor_horz: He, n_channel_d_mosfet_transistor_vert: Qx, n_channel_e_mosfet_transistor_horz: Qe, n_channel_e_mosfet_transistor_vert: os5, njfet_transistor_horz: t0, njfet_transistor_vert: ys, not_connected_down: ms, not_connected_left: ns, not_connected_right: U, not_connected_up: fs32, npn_bipolar_transistor_down: hs, npn_bipolar_transistor_horz: cs, npn_bipolar_transistor_left: ds, npn_bipolar_transistor_right: bs, npn_bipolar_transistor_up: _s, npn_bipolar_transistor_vert: gs, opamp_no_power_down: vs, opamp_no_power_left: ws, opamp_no_power_right: G, opamp_no_power_up: As, opamp_with_power_down: Ss, opamp_with_power_left: Fs, opamp_with_power_right: W, opamp_with_power_up: Rs, p_channel_d_mosfet_transistor_horz: a0, p_channel_d_mosfet_transistor_vert: Ls, p_channel_e_mosfet_transistor_horz: x0, p_channel_e_mosfet_transistor_vert: Os, photodiode_horz: s0, photodiode_vert: Cs, pjfet_transistor_horz: n0, pjfet_transistor_vert: Ds, pnp_bipolar_transistor_down: Us, pnp_bipolar_transistor_horz: Gs, pnp_bipolar_transistor_left: Ws, pnp_bipolar_transistor_right: Hs, pnp_bipolar_transistor_up: Zs, pnp_bipolar_transistor_vert: Qs, potentiometer_horz: g0, potentiometer_vert: rm, potentiometer2_down: pm, potentiometer2_left: am, potentiometer2_right: H, potentiometer2_up: ym, potentiometer3_down: xm, potentiometer3_left: sm, potentiometer3_right: mm, potentiometer3_up: nm, power_factor_meter_horz: S0, power_factor_meter_vert: dm, push_button_normally_closed_momentary_horz: R0, push_button_normally_closed_momentary_vert: um, push_button_normally_open_momentary_horz: E0, push_button_normally_open_momentary_vert: Pm, rectifier_diode_horz: L0, rectifier_diode_vert: Rm, resistor_down: Em, resistor_left: Xm, resistor_right: Vm, resistor_up: km, resonator_down: Om, resonator_horz: M0, resonator_left: Jm, resonator_right: K, resonator_up: $m, resonator_vert: Mm, schottky_diode_down: Nm, schottky_diode_left: Im, schottky_diode_right: tt, schottky_diode_up: Bm, silicon_controlled_rectifier_horz: C0, silicon_controlled_rectifier_vert: Um, solderjumper2_bridged12_down: Gm, solderjumper2_bridged12_left: Wm, solderjumper2_bridged12_right: Hm, solderjumper2_bridged12_up: Zm, solderjumper2_down: Qm, solderjumper2_left: Km, solderjumper2_right: tn, solderjumper2_up: en, solderjumper3_bridged12_down: rn, solderjumper3_bridged12_left: on2, solderjumper3_bridged12_right: ln, solderjumper3_bridged12_up: pn, solderjumper3_bridged123_down: an, solderjumper3_bridged123_left: yn, solderjumper3_bridged123_right: xn, solderjumper3_bridged123_up: sn, solderjumper3_bridged23_down: mn, solderjumper3_bridged23_left: nn, solderjumper3_bridged23_right: fn, solderjumper3_bridged23_up: hn, solderjumper3_down: cn, solderjumper3_left: dn, solderjumper3_right: bn, solderjumper3_up: _n, spdt_normally_closed_switch_down: un, spdt_normally_closed_switch_left: vn, spdt_normally_closed_switch_right: at, spdt_normally_closed_switch_up: wn, spdt_switch_down: Pn, spdt_switch_left: Sn, spdt_switch_right: yt, spdt_switch_up: Fn, spst_normally_closed_switch_down: Rn, spst_normally_closed_switch_left: Tn, spst_normally_closed_switch_right: xt, spst_normally_closed_switch_up: En, spst_switch_down: Yn, spst_switch_left: Xn, spst_switch_right: st, spst_switch_up: Ln, square_wave_down: Vn, square_wave_left: jn, square_wave_right: kn, square_wave_up: zn, step_recovery_diode_horz: N0, step_recovery_diode_vert: On, tachometer_horz: Tt, tachometer_vert: Cn, testpoint_down: Bn, testpoint_left: qn, testpoint_right: nt, testpoint_up: Gn, tilted_ground_down: Hn, tilted_ground_left: Zn, tilted_ground_right: ut, tilted_ground_up: B0, triac_horz: q0, triac_vert: t1, tunnel_diode_horz: U0, tunnel_diode_vert: i1, unijunction_transistor_horz: W0, unijunction_transistor_vert: s1, usbc: n1, var_meter_horz: Z0, var_meter_vert: c1, varactor_diode_horz: K0, varactor_diode_vert: g1, varistor_horz: er, varistor_vert: A1, varmeter_horz: Et, varmeter_vert: R1, vcc_down: T1, vcc_left: E1, vcc_right: Y1, vcc_up: X1, volt_meter_horz: or, volt_meter_vert: L1, watt_hour_meter_horz: Yt, watt_hour_meter_vert: z1, wattmeter_horz: Xt, wattmeter_vert: M1, zener_diode_horz: ar, zener_diode_vert: B1 };
92012
92039
  var Y$ = Object.fromEntries(Object.keys(q1).map((t3) => [t3, t3]));
92013
92040
  function doesLineIntersectLine([a12, a22], [b12, b22], {
92014
92041
  lineThickness = 0
@@ -94038,11 +94065,11 @@ var require_react_reconciler_development = __commonJS2({
94038
94065
  fiber = fiber.next, id2--;
94039
94066
  return fiber;
94040
94067
  }
94041
- function copyWithSetImpl(obj, path33, index, value) {
94042
- if (index >= path33.length)
94068
+ function copyWithSetImpl(obj, path34, index, value) {
94069
+ if (index >= path34.length)
94043
94070
  return value;
94044
- var key = path33[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
94045
- updated[key] = copyWithSetImpl(obj[key], path33, index + 1, value);
94071
+ var key = path34[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
94072
+ updated[key] = copyWithSetImpl(obj[key], path34, index + 1, value);
94046
94073
  return updated;
94047
94074
  }
94048
94075
  function copyWithRename(obj, oldPath, newPath) {
@@ -94062,11 +94089,11 @@ var require_react_reconciler_development = __commonJS2({
94062
94089
  index + 1 === oldPath.length ? (updated[newPath[index]] = updated[oldKey], isArrayImpl(updated) ? updated.splice(oldKey, 1) : delete updated[oldKey]) : updated[oldKey] = copyWithRenameImpl(obj[oldKey], oldPath, newPath, index + 1);
94063
94090
  return updated;
94064
94091
  }
94065
- function copyWithDeleteImpl(obj, path33, index) {
94066
- var key = path33[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
94067
- if (index + 1 === path33.length)
94092
+ function copyWithDeleteImpl(obj, path34, index) {
94093
+ var key = path34[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
94094
+ if (index + 1 === path34.length)
94068
94095
  return isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], updated;
94069
- updated[key] = copyWithDeleteImpl(obj[key], path33, index + 1);
94096
+ updated[key] = copyWithDeleteImpl(obj[key], path34, index + 1);
94070
94097
  return updated;
94071
94098
  }
94072
94099
  function shouldSuspendImpl() {
@@ -103097,29 +103124,29 @@ Check the top-level render call using <` + componentName2 + ">.");
103097
103124
  var didWarnAboutNestedUpdates = false;
103098
103125
  var didWarnAboutFindNodeInStrictMode = {};
103099
103126
  var overrideHookState = null, overrideHookStateDeletePath = null, overrideHookStateRenamePath = null, overrideProps = null, overridePropsDeletePath = null, overridePropsRenamePath = null, scheduleUpdate = null, setErrorHandler = null, setSuspenseHandler = null;
103100
- overrideHookState = function(fiber, id2, path33, value) {
103127
+ overrideHookState = function(fiber, id2, path34, value) {
103101
103128
  id2 = findHook(fiber, id2);
103102
- id2 !== null && (path33 = copyWithSetImpl(id2.memoizedState, path33, 0, value), id2.memoizedState = path33, id2.baseState = path33, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path33 = enqueueConcurrentRenderForLane(fiber, 2), path33 !== null && scheduleUpdateOnFiber(path33, fiber, 2));
103129
+ id2 !== null && (path34 = copyWithSetImpl(id2.memoizedState, path34, 0, value), id2.memoizedState = path34, id2.baseState = path34, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path34 = enqueueConcurrentRenderForLane(fiber, 2), path34 !== null && scheduleUpdateOnFiber(path34, fiber, 2));
103103
103130
  };
103104
- overrideHookStateDeletePath = function(fiber, id2, path33) {
103131
+ overrideHookStateDeletePath = function(fiber, id2, path34) {
103105
103132
  id2 = findHook(fiber, id2);
103106
- id2 !== null && (path33 = copyWithDeleteImpl(id2.memoizedState, path33, 0), id2.memoizedState = path33, id2.baseState = path33, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path33 = enqueueConcurrentRenderForLane(fiber, 2), path33 !== null && scheduleUpdateOnFiber(path33, fiber, 2));
103133
+ id2 !== null && (path34 = copyWithDeleteImpl(id2.memoizedState, path34, 0), id2.memoizedState = path34, id2.baseState = path34, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path34 = enqueueConcurrentRenderForLane(fiber, 2), path34 !== null && scheduleUpdateOnFiber(path34, fiber, 2));
103107
103134
  };
103108
103135
  overrideHookStateRenamePath = function(fiber, id2, oldPath, newPath) {
103109
103136
  id2 = findHook(fiber, id2);
103110
103137
  id2 !== null && (oldPath = copyWithRename(id2.memoizedState, oldPath, newPath), id2.memoizedState = oldPath, id2.baseState = oldPath, fiber.memoizedProps = assign2({}, fiber.memoizedProps), oldPath = enqueueConcurrentRenderForLane(fiber, 2), oldPath !== null && scheduleUpdateOnFiber(oldPath, fiber, 2));
103111
103138
  };
103112
- overrideProps = function(fiber, path33, value) {
103113
- fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path33, 0, value);
103139
+ overrideProps = function(fiber, path34, value) {
103140
+ fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path34, 0, value);
103114
103141
  fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
103115
- path33 = enqueueConcurrentRenderForLane(fiber, 2);
103116
- path33 !== null && scheduleUpdateOnFiber(path33, fiber, 2);
103142
+ path34 = enqueueConcurrentRenderForLane(fiber, 2);
103143
+ path34 !== null && scheduleUpdateOnFiber(path34, fiber, 2);
103117
103144
  };
103118
- overridePropsDeletePath = function(fiber, path33) {
103119
- fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path33, 0);
103145
+ overridePropsDeletePath = function(fiber, path34) {
103146
+ fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path34, 0);
103120
103147
  fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
103121
- path33 = enqueueConcurrentRenderForLane(fiber, 2);
103122
- path33 !== null && scheduleUpdateOnFiber(path33, fiber, 2);
103148
+ path34 = enqueueConcurrentRenderForLane(fiber, 2);
103149
+ path34 !== null && scheduleUpdateOnFiber(path34, fiber, 2);
103123
103150
  };
103124
103151
  overridePropsRenamePath = function(fiber, oldPath, newPath) {
103125
103152
  fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath);
@@ -118456,10 +118483,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
118456
118483
  var setErrorHandler = null;
118457
118484
  var setSuspenseHandler = null;
118458
118485
  {
118459
- var copyWithDeleteImpl = function(obj, path33, index2) {
118460
- var key = path33[index2];
118486
+ var copyWithDeleteImpl = function(obj, path34, index2) {
118487
+ var key = path34[index2];
118461
118488
  var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
118462
- if (index2 + 1 === path33.length) {
118489
+ if (index2 + 1 === path34.length) {
118463
118490
  if (isArray2(updated)) {
118464
118491
  updated.splice(key, 1);
118465
118492
  } else {
@@ -118467,11 +118494,11 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
118467
118494
  }
118468
118495
  return updated;
118469
118496
  }
118470
- updated[key] = copyWithDeleteImpl(obj[key], path33, index2 + 1);
118497
+ updated[key] = copyWithDeleteImpl(obj[key], path34, index2 + 1);
118471
118498
  return updated;
118472
118499
  };
118473
- var copyWithDelete = function(obj, path33) {
118474
- return copyWithDeleteImpl(obj, path33, 0);
118500
+ var copyWithDelete = function(obj, path34) {
118501
+ return copyWithDeleteImpl(obj, path34, 0);
118475
118502
  };
118476
118503
  var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
118477
118504
  var oldKey = oldPath[index2];
@@ -118503,17 +118530,17 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
118503
118530
  }
118504
118531
  return copyWithRenameImpl(obj, oldPath, newPath, 0);
118505
118532
  };
118506
- var copyWithSetImpl = function(obj, path33, index2, value) {
118507
- if (index2 >= path33.length) {
118533
+ var copyWithSetImpl = function(obj, path34, index2, value) {
118534
+ if (index2 >= path34.length) {
118508
118535
  return value;
118509
118536
  }
118510
- var key = path33[index2];
118537
+ var key = path34[index2];
118511
118538
  var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
118512
- updated[key] = copyWithSetImpl(obj[key], path33, index2 + 1, value);
118539
+ updated[key] = copyWithSetImpl(obj[key], path34, index2 + 1, value);
118513
118540
  return updated;
118514
118541
  };
118515
- var copyWithSet = function(obj, path33, value) {
118516
- return copyWithSetImpl(obj, path33, 0, value);
118542
+ var copyWithSet = function(obj, path34, value) {
118543
+ return copyWithSetImpl(obj, path34, 0, value);
118517
118544
  };
118518
118545
  var findHook = function(fiber, id2) {
118519
118546
  var currentHook2 = fiber.memoizedState;
@@ -118523,10 +118550,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
118523
118550
  }
118524
118551
  return currentHook2;
118525
118552
  };
118526
- overrideHookState = function(fiber, id2, path33, value) {
118553
+ overrideHookState = function(fiber, id2, path34, value) {
118527
118554
  var hook = findHook(fiber, id2);
118528
118555
  if (hook !== null) {
118529
- var newState = copyWithSet(hook.memoizedState, path33, value);
118556
+ var newState = copyWithSet(hook.memoizedState, path34, value);
118530
118557
  hook.memoizedState = newState;
118531
118558
  hook.baseState = newState;
118532
118559
  fiber.memoizedProps = assign2({}, fiber.memoizedProps);
@@ -118536,10 +118563,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
118536
118563
  }
118537
118564
  }
118538
118565
  };
118539
- overrideHookStateDeletePath = function(fiber, id2, path33) {
118566
+ overrideHookStateDeletePath = function(fiber, id2, path34) {
118540
118567
  var hook = findHook(fiber, id2);
118541
118568
  if (hook !== null) {
118542
- var newState = copyWithDelete(hook.memoizedState, path33);
118569
+ var newState = copyWithDelete(hook.memoizedState, path34);
118543
118570
  hook.memoizedState = newState;
118544
118571
  hook.baseState = newState;
118545
118572
  fiber.memoizedProps = assign2({}, fiber.memoizedProps);
@@ -118562,8 +118589,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
118562
118589
  }
118563
118590
  }
118564
118591
  };
118565
- overrideProps = function(fiber, path33, value) {
118566
- fiber.pendingProps = copyWithSet(fiber.memoizedProps, path33, value);
118592
+ overrideProps = function(fiber, path34, value) {
118593
+ fiber.pendingProps = copyWithSet(fiber.memoizedProps, path34, value);
118567
118594
  if (fiber.alternate) {
118568
118595
  fiber.alternate.pendingProps = fiber.pendingProps;
118569
118596
  }
@@ -118572,8 +118599,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
118572
118599
  scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
118573
118600
  }
118574
118601
  };
118575
- overridePropsDeletePath = function(fiber, path33) {
118576
- fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path33);
118602
+ overridePropsDeletePath = function(fiber, path34) {
118603
+ fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path34);
118577
118604
  if (fiber.alternate) {
118578
118605
  fiber.alternate.pendingProps = fiber.pendingProps;
118579
118606
  }
@@ -124624,7 +124651,7 @@ var parsePin = (pinString) => {
124624
124651
  const colorMatch = pinString.match(/#[0-9A-F]{6}/);
124625
124652
  const labelColor = colorMatch ? colorMatch[0] : "";
124626
124653
  const pathMatch = pinString.match(/\^\^([^~]+)/);
124627
- const path33 = pathMatch ? pathMatch[1] : "";
124654
+ const path34 = pathMatch ? pathMatch[1] : "";
124628
124655
  const arrowMatch = pinString.match(/\^\^0~(.+)$/);
124629
124656
  const arrow = arrowMatch ? arrowMatch[1] : "";
124630
124657
  const r3 = Number.parseFloat(rotation2);
@@ -124638,7 +124665,7 @@ var parsePin = (pinString) => {
124638
124665
  rotation: Number.isNaN(r3) ? 0 : r3,
124639
124666
  label,
124640
124667
  labelColor,
124641
- path: path33,
124668
+ path: path34,
124642
124669
  arrow
124643
124670
  };
124644
124671
  };
@@ -125078,15 +125105,15 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
125078
125105
  }
125079
125106
  }
125080
125107
  const numPoints = Math.max(2, Math.ceil(Math.abs(endAngle - startAngle) * radius));
125081
- const path33 = [];
125108
+ const path34 = [];
125082
125109
  for (let i = 0;i <= numPoints; i++) {
125083
125110
  const t3 = i / numPoints;
125084
125111
  const angle2 = startAngle + t3 * (endAngle - startAngle);
125085
125112
  const x = centerX + radius * Math.cos(angle2);
125086
125113
  const y = centerY + radius * Math.sin(angle2);
125087
- path33.push({ x, y });
125114
+ path34.push({ x, y });
125088
125115
  }
125089
- return path33;
125116
+ return path34;
125090
125117
  }
125091
125118
  var __defProp4 = Object.defineProperty;
125092
125119
  var __export22 = (target, all) => {
@@ -126504,7 +126531,7 @@ var platedHoleWithRectPad = (pn2, x, y, holeDiameter, rectPadWidth, rectPadHeigh
126504
126531
  };
126505
126532
  };
126506
126533
  var silkscreenPin = ({
126507
- fs: fs32,
126534
+ fs: fs33,
126508
126535
  pn: pn2,
126509
126536
  anchor_x,
126510
126537
  anchor_y,
@@ -126547,7 +126574,7 @@ var silkscreenPin = ({
126547
126574
  type: "pcb_silkscreen_text",
126548
126575
  pcb_silkscreen_text_id: "silkscreen_text_1",
126549
126576
  font: "tscircuit2024",
126550
- font_size: fs32,
126577
+ font_size: fs33,
126551
126578
  pcb_component_id: "pcb_component_1",
126552
126579
  text: `{PIN${pn2}}`,
126553
126580
  layer,
@@ -132468,10 +132495,10 @@ function compareDocumentPosition(nodeA, nodeB) {
132468
132495
  function uniqueSort(nodes) {
132469
132496
  nodes = nodes.filter((node, i, arr) => !arr.includes(node, i + 1));
132470
132497
  nodes.sort((a, b3) => {
132471
- const relative9 = compareDocumentPosition(a, b3);
132472
- if (relative9 & DocumentPosition.PRECEDING) {
132498
+ const relative10 = compareDocumentPosition(a, b3);
132499
+ if (relative10 & DocumentPosition.PRECEDING) {
132473
132500
  return -1;
132474
- } else if (relative9 & DocumentPosition.FOLLOWING) {
132501
+ } else if (relative10 & DocumentPosition.FOLLOWING) {
132475
132502
  return 1;
132476
132503
  }
132477
132504
  return 0;
@@ -134163,17 +134190,17 @@ var ObstacleList = class {
134163
134190
  return obstacles;
134164
134191
  }
134165
134192
  };
134166
- function removePathLoops(path33) {
134167
- if (path33.length < 4)
134168
- return path33;
134169
- const result = [{ ...path33[0] }];
134170
- let currentLayer = path33[0].layer;
134171
- for (let i = 1;i < path33.length; i++) {
134172
- const currentSegment = { start: path33[i - 1], end: path33[i] };
134173
- const isVia = path33[i].route_type === "via" || path33[i - 1].route_type === "via";
134174
- if (path33[i].layer !== currentLayer || isVia) {
134175
- result.push({ ...path33[i] });
134176
- currentLayer = path33[i].layer;
134193
+ function removePathLoops(path34) {
134194
+ if (path34.length < 4)
134195
+ return path34;
134196
+ const result = [{ ...path34[0] }];
134197
+ let currentLayer = path34[0].layer;
134198
+ for (let i = 1;i < path34.length; i++) {
134199
+ const currentSegment = { start: path34[i - 1], end: path34[i] };
134200
+ const isVia = path34[i].route_type === "via" || path34[i - 1].route_type === "via";
134201
+ if (path34[i].layer !== currentLayer || isVia) {
134202
+ result.push({ ...path34[i] });
134203
+ currentLayer = path34[i].layer;
134177
134204
  continue;
134178
134205
  }
134179
134206
  let intersectionFound = false;
@@ -134202,8 +134229,8 @@ function removePathLoops(path33) {
134202
134229
  result.push(intersectionPoint);
134203
134230
  }
134204
134231
  const lastPoint = result[result.length - 1];
134205
- if (lastPoint.x !== path33[i].x || lastPoint.y !== path33[i].y) {
134206
- result.push(path33[i]);
134232
+ if (lastPoint.x !== path34[i].x || lastPoint.y !== path34[i].y) {
134233
+ result.push(path34[i]);
134207
134234
  }
134208
134235
  }
134209
134236
  return result;
@@ -134692,10 +134719,10 @@ var GeneralizedAstarAutorouter = class {
134692
134719
  });
134693
134720
  }
134694
134721
  if (current2.parent) {
134695
- const path33 = [];
134722
+ const path34 = [];
134696
134723
  let p = current2;
134697
134724
  while (p) {
134698
- path33.unshift(p);
134725
+ path34.unshift(p);
134699
134726
  p = p.parent;
134700
134727
  }
134701
134728
  debugSolution.push({
@@ -134703,7 +134730,7 @@ var GeneralizedAstarAutorouter = class {
134703
134730
  pcb_component_id: "",
134704
134731
  pcb_fabrication_note_path_id: `note_path_${current2.x}_${current2.y}`,
134705
134732
  layer: "top",
134706
- route: path33,
134733
+ route: path34,
134707
134734
  stroke_width: 0.01
134708
134735
  });
134709
134736
  }
@@ -139625,13 +139652,13 @@ var RBush = class {
139625
139652
  return this;
139626
139653
  let node = this.data;
139627
139654
  const bbox = this.toBBox(item);
139628
- const path33 = [];
139655
+ const path34 = [];
139629
139656
  const indexes = [];
139630
139657
  let i, parent, goingUp;
139631
- while (node || path33.length) {
139658
+ while (node || path34.length) {
139632
139659
  if (!node) {
139633
- node = path33.pop();
139634
- parent = path33[path33.length - 1];
139660
+ node = path34.pop();
139661
+ parent = path34[path34.length - 1];
139635
139662
  i = indexes.pop();
139636
139663
  goingUp = true;
139637
139664
  }
@@ -139639,13 +139666,13 @@ var RBush = class {
139639
139666
  const index = findItem(item, node.children, equalsFn);
139640
139667
  if (index !== -1) {
139641
139668
  node.children.splice(index, 1);
139642
- path33.push(node);
139643
- this._condense(path33);
139669
+ path34.push(node);
139670
+ this._condense(path34);
139644
139671
  return this;
139645
139672
  }
139646
139673
  }
139647
139674
  if (!goingUp && !node.leaf && contains(node, bbox)) {
139648
- path33.push(node);
139675
+ path34.push(node);
139649
139676
  indexes.push(i);
139650
139677
  i = 0;
139651
139678
  parent = node;
@@ -139716,10 +139743,10 @@ var RBush = class {
139716
139743
  calcBBox(node, this.toBBox);
139717
139744
  return node;
139718
139745
  }
139719
- _chooseSubtree(bbox, node, level, path33) {
139746
+ _chooseSubtree(bbox, node, level, path34) {
139720
139747
  while (true) {
139721
- path33.push(node);
139722
- if (node.leaf || path33.length - 1 === level)
139748
+ path34.push(node);
139749
+ if (node.leaf || path34.length - 1 === level)
139723
139750
  break;
139724
139751
  let minArea = Infinity;
139725
139752
  let minEnlargement = Infinity;
@@ -139828,21 +139855,21 @@ var RBush = class {
139828
139855
  }
139829
139856
  return margin;
139830
139857
  }
139831
- _adjustParentBBoxes(bbox, path33, level) {
139858
+ _adjustParentBBoxes(bbox, path34, level) {
139832
139859
  for (let i = level;i >= 0; i--) {
139833
- extend(path33[i], bbox);
139860
+ extend(path34[i], bbox);
139834
139861
  }
139835
139862
  }
139836
- _condense(path33) {
139837
- for (let i = path33.length - 1, siblings;i >= 0; i--) {
139838
- if (path33[i].children.length === 0) {
139863
+ _condense(path34) {
139864
+ for (let i = path34.length - 1, siblings;i >= 0; i--) {
139865
+ if (path34[i].children.length === 0) {
139839
139866
  if (i > 0) {
139840
- siblings = path33[i - 1].children;
139841
- siblings.splice(siblings.indexOf(path33[i]), 1);
139867
+ siblings = path34[i - 1].children;
139868
+ siblings.splice(siblings.indexOf(path34[i]), 1);
139842
139869
  } else
139843
139870
  this.clear();
139844
139871
  } else
139845
- calcBBox(path33[i], this.toBBox);
139872
+ calcBBox(path34[i], this.toBBox);
139846
139873
  }
139847
139874
  }
139848
139875
  };
@@ -140987,7 +141014,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
140987
141014
  this.capacityPaths = capacityPaths;
140988
141015
  this.colorMap = colorMap ?? {};
140989
141016
  this.unprocessedNodeIds = [
140990
- ...new Set(capacityPaths.flatMap((path33) => path33.nodeIds))
141017
+ ...new Set(capacityPaths.flatMap((path34) => path34.nodeIds))
140991
141018
  ];
140992
141019
  this.nodePortSegments = /* @__PURE__ */ new Map;
140993
141020
  }
@@ -140998,17 +141025,17 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
140998
141025
  return;
140999
141026
  }
141000
141027
  const pathsGoingThroughNode = [];
141001
- for (const path33 of this.capacityPaths) {
141002
- const indexOfNodeInPath = path33.nodeIds.indexOf(nodeId);
141028
+ for (const path34 of this.capacityPaths) {
141029
+ const indexOfNodeInPath = path34.nodeIds.indexOf(nodeId);
141003
141030
  if (indexOfNodeInPath !== -1) {
141004
- pathsGoingThroughNode.push({ path: path33, indexOfNodeInPath });
141031
+ pathsGoingThroughNode.push({ path: path34, indexOfNodeInPath });
141005
141032
  }
141006
141033
  }
141007
141034
  const node = this.nodeMap.get(nodeId);
141008
141035
  const nodePortSegments = [];
141009
- for (const { path: path33, indexOfNodeInPath } of pathsGoingThroughNode) {
141010
- const entryNodeId = path33.nodeIds[indexOfNodeInPath - 1];
141011
- const exitNodeId = path33.nodeIds[indexOfNodeInPath + 1];
141036
+ for (const { path: path34, indexOfNodeInPath } of pathsGoingThroughNode) {
141037
+ const entryNodeId = path34.nodeIds[indexOfNodeInPath - 1];
141038
+ const exitNodeId = path34.nodeIds[indexOfNodeInPath + 1];
141012
141039
  for (const adjNodeId of [entryNodeId, exitNodeId]) {
141013
141040
  const adjNode = this.nodeMap.get(adjNodeId);
141014
141041
  if (!adjNode)
@@ -141021,7 +141048,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
141021
141048
  capacityMeshNodeId: nodeId,
141022
141049
  start: segment2.start,
141023
141050
  end: segment2.end,
141024
- connectionNames: [path33.connectionName],
141051
+ connectionNames: [path34.connectionName],
141025
141052
  availableZ: mutuallyAvailableZ
141026
141053
  };
141027
141054
  nodePortSegments.push(portSegment);
@@ -141827,37 +141854,37 @@ var SingleHighDensityRouteSolver = class extends BaseSolver {
141827
141854
  return neighbors;
141828
141855
  }
141829
141856
  getNodePath(node) {
141830
- const path33 = [];
141857
+ const path34 = [];
141831
141858
  while (node) {
141832
- path33.push(node);
141859
+ path34.push(node);
141833
141860
  node = node.parent;
141834
141861
  }
141835
- return path33;
141862
+ return path34;
141836
141863
  }
141837
141864
  getViasInNodePath(node) {
141838
- const path33 = this.getNodePath(node);
141865
+ const path34 = this.getNodePath(node);
141839
141866
  const vias = [];
141840
- for (let i = 0;i < path33.length - 1; i++) {
141841
- if (path33[i].z !== path33[i + 1].z) {
141842
- vias.push({ x: path33[i].x, y: path33[i].y });
141867
+ for (let i = 0;i < path34.length - 1; i++) {
141868
+ if (path34[i].z !== path34[i + 1].z) {
141869
+ vias.push({ x: path34[i].x, y: path34[i].y });
141843
141870
  }
141844
141871
  }
141845
141872
  return vias;
141846
141873
  }
141847
141874
  setSolvedPath(node) {
141848
- const path33 = this.getNodePath(node);
141849
- path33.reverse();
141875
+ const path34 = this.getNodePath(node);
141876
+ path34.reverse();
141850
141877
  const vias = [];
141851
- for (let i = 0;i < path33.length - 1; i++) {
141852
- if (path33[i].z !== path33[i + 1].z) {
141853
- vias.push({ x: path33[i].x, y: path33[i].y });
141878
+ for (let i = 0;i < path34.length - 1; i++) {
141879
+ if (path34[i].z !== path34[i + 1].z) {
141880
+ vias.push({ x: path34[i].x, y: path34[i].y });
141854
141881
  }
141855
141882
  }
141856
141883
  this.solvedPath = {
141857
141884
  connectionName: this.connectionName,
141858
141885
  traceThickness: this.traceThickness,
141859
141886
  viaDiameter: this.viaDiameter,
141860
- route: path33.map((node2) => ({ x: node2.x, y: node2.y, z: node2.z })).concat([this.B]),
141887
+ route: path34.map((node2) => ({ x: node2.x, y: node2.y, z: node2.z })).concat([this.B]),
141861
141888
  vias
141862
141889
  };
141863
141890
  }
@@ -142665,12 +142692,12 @@ function computeDumbbellPaths({
142665
142692
  specialType: circleCenter === A3 ? "A" : "B"
142666
142693
  };
142667
142694
  };
142668
- const subdivideOptimalPath = (path33, numSubdivisions) => {
142669
- if (path33.length < 2)
142670
- return path33;
142671
- const result = [path33[0]];
142672
- for (let i = 0;i < path33.length - 1; i++) {
142673
- const segment2 = { start: path33[i], end: path33[i + 1] };
142695
+ const subdivideOptimalPath = (path34, numSubdivisions) => {
142696
+ if (path34.length < 2)
142697
+ return path34;
142698
+ const result = [path34[0]];
142699
+ for (let i = 0;i < path34.length - 1; i++) {
142700
+ const segment2 = { start: path34[i], end: path34[i + 1] };
142674
142701
  const segmentMidpoint = {
142675
142702
  x: (segment2.start.x + segment2.end.x) / 2,
142676
142703
  y: (segment2.start.y + segment2.end.y) / 2
@@ -142732,7 +142759,7 @@ function computeDumbbellPaths({
142732
142759
  }
142733
142760
  subdivisionPoints.forEach((p) => result.push(p));
142734
142761
  }
142735
- result.push(path33[i + 1]);
142762
+ result.push(path34[i + 1]);
142736
142763
  }
142737
142764
  if (result.length > 1) {
142738
142765
  const filteredResult = [result[0]];
@@ -142967,13 +142994,13 @@ function computeDumbbellPaths({
142967
142994
  ].map((l, index) => ({ ...l, index }));
142968
142995
  };
142969
142996
  const subdivideJLinePath = (jLine, oppositePoint, r3, m2, numSubdivisions) => {
142970
- const path33 = jLine.points;
142971
- if (path33.length < 2)
142972
- return path33;
142997
+ const path34 = jLine.points;
142998
+ if (path34.length < 2)
142999
+ return path34;
142973
143000
  const minDistThreshold = r3 + m2;
142974
- const result = [path33[0]];
142975
- for (let i = 0;i < path33.length - 1; i++) {
142976
- const segment2 = { start: path33[i], end: path33[i + 1] };
143001
+ const result = [path34[0]];
143002
+ for (let i = 0;i < path34.length - 1; i++) {
143003
+ const segment2 = { start: path34[i], end: path34[i + 1] };
142977
143004
  const distToOpposite = pointToSegmentDistance22(oppositePoint, segment2.start, segment2.end);
142978
143005
  if (distToOpposite < minDistThreshold) {
142979
143006
  const closestPt = closestPointOnSegment(segment2, oppositePoint);
@@ -143042,26 +143069,26 @@ function computeDumbbellPaths({
143042
143069
  return { index: 0, path: [] };
143043
143070
  }
143044
143071
  const optimalPath2 = validPaths.sort((a, b3) => a.length - b3.length)[0];
143045
- const path33 = [...optimalPath2.path];
143046
- const firstPoint = path33[0];
143047
- const dist3 = distance3(firstPoint, path33[2]);
143048
- const dist4 = distance3(firstPoint, path33[3]);
143072
+ const path34 = [...optimalPath2.path];
143073
+ const firstPoint = path34[0];
143074
+ const dist3 = distance3(firstPoint, path34[2]);
143075
+ const dist4 = distance3(firstPoint, path34[3]);
143049
143076
  const closerIdx = dist3 < dist4 ? 2 : 3;
143050
- if (dist3 < distance3(firstPoint, path33[1]) || dist4 < distance3(firstPoint, path33[1])) {
143051
- path33.splice(1, closerIdx - 1);
143077
+ if (dist3 < distance3(firstPoint, path34[1]) || dist4 < distance3(firstPoint, path34[1])) {
143078
+ path34.splice(1, closerIdx - 1);
143052
143079
  }
143053
- const lastPoint = path33[path33.length - 1];
143054
- const distM3 = distance3(lastPoint, path33[path33.length - 3]);
143055
- const distM4 = distance3(lastPoint, path33[path33.length - 4]);
143056
- const closerLastIdx = distM3 < distM4 ? path33.length - 3 : path33.length - 4;
143057
- if (distM3 < distance3(lastPoint, path33[path33.length - 2]) || distM4 < distance3(lastPoint, path33[path33.length - 2])) {
143058
- path33.splice(closerLastIdx + 1, path33.length - closerLastIdx - 2);
143080
+ const lastPoint = path34[path34.length - 1];
143081
+ const distM3 = distance3(lastPoint, path34[path34.length - 3]);
143082
+ const distM4 = distance3(lastPoint, path34[path34.length - 4]);
143083
+ const closerLastIdx = distM3 < distM4 ? path34.length - 3 : path34.length - 4;
143084
+ if (distM3 < distance3(lastPoint, path34[path34.length - 2]) || distM4 < distance3(lastPoint, path34[path34.length - 2])) {
143085
+ path34.splice(closerLastIdx + 1, path34.length - closerLastIdx - 2);
143059
143086
  }
143060
143087
  return {
143061
143088
  index: optimalPath2.index,
143062
- path: path33,
143063
- startsAt: path33[0] === C2 ? "C" : "D",
143064
- goesTo: path33[path33.length - 1] === C2 ? "C" : "D"
143089
+ path: path34,
143090
+ startsAt: path34[0] === C2 ? "C" : "D",
143091
+ goesTo: path34[path34.length - 1] === C2 ? "C" : "D"
143065
143092
  };
143066
143093
  };
143067
143094
  const optimalPath = findOptimalPath();
@@ -144481,9 +144508,9 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
144481
144508
  let closestIntersection = null;
144482
144509
  let intersectedSegmentZ = null;
144483
144510
  const checkIntersectionsWithPathMap = (pathMap) => {
144484
- for (const path33 of pathMap.values()) {
144485
- for (let i = 0;i < path33.length - 1; i++) {
144486
- const segment2 = [path33[i], path33[i + 1]];
144511
+ for (const path34 of pathMap.values()) {
144512
+ for (let i = 0;i < path34.length - 1; i++) {
144513
+ const segment2 = [path34[i], path34[i + 1]];
144487
144514
  if (segment2[0].x === segment2[1].x && segment2[0].y === segment2[1].y) {
144488
144515
  continue;
144489
144516
  }
@@ -144613,11 +144640,11 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
144613
144640
  });
144614
144641
  }
144615
144642
  const drawPath = (pathMap, labelPrefix) => {
144616
- for (const [connectionName, path33] of pathMap.entries()) {
144643
+ for (const [connectionName, path34] of pathMap.entries()) {
144617
144644
  const color = colorMap[connectionName] ?? "black";
144618
- for (let i = 0;i < path33.length - 1; i++) {
144619
- const p12 = path33[i];
144620
- const p2 = path33[i + 1];
144645
+ for (let i = 0;i < path34.length - 1; i++) {
144646
+ const p12 = path34[i];
144647
+ const p2 = path34[i + 1];
144621
144648
  if (p12.x === p2.x && p12.y === p2.y && p12.z !== p2.z) {
144622
144649
  graphics.circles.push({
144623
144650
  center: { x: p12.x, y: p12.y },
@@ -145215,10 +145242,10 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
145215
145242
  const allSegments = [];
145216
145243
  const viaPoints = /* @__PURE__ */ new Map;
145217
145244
  for (const polyLine of polyLines) {
145218
- const path33 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
145219
- for (let i = 0;i < path33.length - 1; i++) {
145220
- const p12 = path33[i];
145221
- const p2 = path33[i + 1];
145245
+ const path34 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
145246
+ for (let i = 0;i < path34.length - 1; i++) {
145247
+ const p12 = path34[i];
145248
+ const p2 = path34[i + 1];
145222
145249
  const layer = p12.z2;
145223
145250
  allSegments.push({
145224
145251
  start: { x: p12.x, y: p12.y },
@@ -145236,7 +145263,7 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
145236
145263
  }
145237
145264
  }
145238
145265
  }
145239
- const lastPoint = path33[path33.length - 1];
145266
+ const lastPoint = path34[path34.length - 1];
145240
145267
  if (lastPoint.z1 !== lastPoint.z2) {
145241
145268
  const key = pointKey2(lastPoint);
145242
145269
  if (!viaPoints.has(key)) {
@@ -145535,14 +145562,14 @@ var MultiHeadPolyLineIntraNodeSolver = class extends BaseSolver {
145535
145562
  const polyLineVias = [];
145536
145563
  for (let i = 0;i < polyLines.length; i++) {
145537
145564
  const polyLine = polyLines[i];
145538
- const path33 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
145565
+ const path34 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
145539
145566
  const segmentsByLayer = new Map(this.availableZ.map((z852) => [z852, []]));
145540
- for (let i22 = 0;i22 < path33.length - 1; i22++) {
145541
- const segment2 = [path33[i22], path33[i22 + 1]];
145567
+ for (let i22 = 0;i22 < path34.length - 1; i22++) {
145568
+ const segment2 = [path34[i22], path34[i22 + 1]];
145542
145569
  segmentsByLayer.get(segment2[0].z2).push(segment2);
145543
145570
  }
145544
145571
  polyLineSegmentsByLayer.push(segmentsByLayer);
145545
- polyLineVias.push(path33.filter((p) => p.z1 !== p.z2));
145572
+ polyLineVias.push(path34.filter((p) => p.z1 !== p.z2));
145546
145573
  }
145547
145574
  for (let i = 0;i < polyLines.length; i++) {
145548
145575
  const path1SegmentsByLayer = polyLineSegmentsByLayer[i];
@@ -146971,7 +146998,7 @@ var HighDensitySolver = class extends BaseSolver {
146971
146998
  if (this.failedSolvers.length > 0) {
146972
146999
  this.solved = false;
146973
147000
  this.failed = true;
146974
- this.error = `Failed to solve ${this.failedSolvers.length} nodes, ${this.failedSolvers.slice(0, 5).map((fs32) => fs32.nodeWithPortPoints.capacityMeshNodeId)}. err0: ${this.failedSolvers[0].error}.`;
147001
+ this.error = `Failed to solve ${this.failedSolvers.length} nodes, ${this.failedSolvers.slice(0, 5).map((fs33) => fs33.nodeWithPortPoints.capacityMeshNodeId)}. err0: ${this.failedSolvers[0].error}.`;
146975
147002
  return;
146976
147003
  }
146977
147004
  this.solved = true;
@@ -149752,13 +149779,13 @@ var CapacityPathingSolver = class extends BaseSolver {
149752
149779
  return this.getDistanceBetweenNodes(node, endGoal);
149753
149780
  }
149754
149781
  getBacktrackedPath(candidate) {
149755
- const path33 = [];
149782
+ const path34 = [];
149756
149783
  let currentCandidate = candidate;
149757
149784
  while (currentCandidate) {
149758
- path33.push(currentCandidate.node);
149785
+ path34.push(currentCandidate.node);
149759
149786
  currentCandidate = currentCandidate.prevCandidate;
149760
149787
  }
149761
- return path33;
149788
+ return path34;
149762
149789
  }
149763
149790
  getNeighboringNodes(node) {
149764
149791
  return this.nodeEdgeMap.get(node.capacityMeshNodeId).flatMap((edge) => edge.nodeIds.filter((n3) => n3 !== node.capacityMeshNodeId)).map((n3) => this.nodeMap.get(n3));
@@ -149766,12 +149793,12 @@ var CapacityPathingSolver = class extends BaseSolver {
149766
149793
  getCapacityPaths() {
149767
149794
  const capacityPaths = [];
149768
149795
  for (const connection of this.connectionsWithNodes) {
149769
- const path33 = connection.path;
149770
- if (path33) {
149796
+ const path34 = connection.path;
149797
+ if (path34) {
149771
149798
  capacityPaths.push({
149772
149799
  capacityPathId: connection.connection.name,
149773
149800
  connectionName: connection.connection.name,
149774
- nodeIds: path33.map((node) => node.capacityMeshNodeId)
149801
+ nodeIds: path34.map((node) => node.capacityMeshNodeId)
149775
149802
  });
149776
149803
  }
149777
149804
  }
@@ -150456,10 +150483,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
150456
150483
  return this.getDistanceBetweenNodes(node, endGoal) + this.getNodeCapacityPenalty(node);
150457
150484
  }
150458
150485
  getBacktrackedPath(candidate) {
150459
- const path33 = [];
150486
+ const path34 = [];
150460
150487
  let currentCandidate = candidate;
150461
150488
  while (currentCandidate) {
150462
- path33.push(currentCandidate.node);
150489
+ path34.push(currentCandidate.node);
150463
150490
  if (this.nodeMap.has(currentCandidate.node.capacityMeshNodeId)) {
150464
150491
  currentCandidate = currentCandidate.prevCandidate;
150465
150492
  } else {
@@ -150467,7 +150494,7 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
150467
150494
  break;
150468
150495
  }
150469
150496
  }
150470
- return path33.reverse();
150497
+ return path34.reverse();
150471
150498
  }
150472
150499
  getNeighboringNodes(node) {
150473
150500
  if (!this.nodeMap.has(node.capacityMeshNodeId))
@@ -150482,8 +150509,8 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
150482
150509
  doesNodeHaveCapacityForTrace(node, prevNode) {
150483
150510
  return true;
150484
150511
  }
150485
- reduceCapacityAlongPath(path33) {
150486
- for (const pathNode of path33) {
150512
+ reduceCapacityAlongPath(path34) {
150513
+ for (const pathNode of path34) {
150487
150514
  if (this.usedNodeCapacityMap.has(pathNode.capacityMeshNodeId)) {
150488
150515
  const nodeId = pathNode.capacityMeshNodeId;
150489
150516
  const nodeInSection = this.nodeMap.get(nodeId);
@@ -150612,9 +150639,9 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
150612
150639
  this.queuedNodes = null;
150613
150640
  }
150614
150641
  _handleGoalReached(currentCandidate, currentTerminal, endNode) {
150615
- const path33 = this.getBacktrackedPath(currentCandidate);
150616
- currentTerminal.path = path33;
150617
- this.reduceCapacityAlongPath(path33);
150642
+ const path34 = this.getBacktrackedPath(currentCandidate);
150643
+ currentTerminal.path = path34;
150644
+ this.reduceCapacityAlongPath(path34);
150618
150645
  this.currentConnectionIndex++;
150619
150646
  this.candidates = null;
150620
150647
  this.visitedNodes = null;
@@ -150663,10 +150690,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
150663
150690
  const connectionColor = this.colorMap[connectionName] ?? "purple";
150664
150691
  topCandidates.forEach((candidate, index) => {
150665
150692
  const opacity = 0.8 * (1 - index / 5);
150666
- const path33 = this.getBacktrackedPath(candidate);
150667
- if (path33.length > 0) {
150693
+ const path34 = this.getBacktrackedPath(candidate);
150694
+ if (path34.length > 0) {
150668
150695
  baseGraphics.lines.push({
150669
- points: path33.map(({ center: { x, y } }) => ({ x, y })),
150696
+ points: path34.map(({ center: { x, y } }) => ({ x, y })),
150670
150697
  strokeColor: safeTransparentize(connectionColor, 1 - opacity),
150671
150698
  strokeWidth: 0.05
150672
150699
  });
@@ -151355,12 +151382,12 @@ var CapacityPathingMultiSectionSolver = class extends BaseSolver {
151355
151382
  getCapacityPaths() {
151356
151383
  const capacityPaths = [];
151357
151384
  for (const connection of this.connectionsWithNodes) {
151358
- const path33 = connection.path;
151359
- if (path33) {
151385
+ const path34 = connection.path;
151386
+ if (path34) {
151360
151387
  capacityPaths.push({
151361
151388
  capacityPathId: connection.connection.name,
151362
151389
  connectionName: connection.connection.name,
151363
- nodeIds: path33.map((node) => node.capacityMeshNodeId)
151390
+ nodeIds: path34.map((node) => node.capacityMeshNodeId)
151364
151391
  });
151365
151392
  }
151366
151393
  }
@@ -152381,22 +152408,22 @@ var SingleSimplifiedPathSolver5 = class extends SingleSimplifiedPathSolver {
152381
152408
  return null;
152382
152409
  }
152383
152410
  const possiblePaths = calculate45DegreePaths({ x: start.x, y: start.y }, { x: end.x, y: end.y });
152384
- for (const path33 of possiblePaths) {
152385
- const fullPath = path33.map((p) => ({ x: p.x, y: p.y, z: start.z }));
152411
+ for (const path34 of possiblePaths) {
152412
+ const fullPath = path34.map((p) => ({ x: p.x, y: p.y, z: start.z }));
152386
152413
  if (this.isValidPath(fullPath)) {
152387
152414
  return fullPath;
152388
152415
  }
152389
152416
  }
152390
152417
  return null;
152391
152418
  }
152392
- addPathToResult(path33) {
152393
- if (path33.length === 0)
152419
+ addPathToResult(path34) {
152420
+ if (path34.length === 0)
152394
152421
  return;
152395
- for (let i = 0;i < path33.length; i++) {
152396
- if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1], path33[i])) {
152422
+ for (let i = 0;i < path34.length; i++) {
152423
+ if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1], path34[i])) {
152397
152424
  continue;
152398
152425
  }
152399
- this.newRoute.push(path33[i]);
152426
+ this.newRoute.push(path34[i]);
152400
152427
  }
152401
152428
  this.currentStepSize = this.maxStepSize;
152402
152429
  }
@@ -179803,7 +179830,7 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
179803
179830
  for (let i = 0;i < portsWithPosition.length - 1; i++) {
179804
179831
  const start = portsWithPosition[i];
179805
179832
  const end = portsWithPosition[i + 1];
179806
- const path33 = calculateElbow({
179833
+ const path34 = calculateElbow({
179807
179834
  x: start.position.x,
179808
179835
  y: start.position.y,
179809
179836
  facingDirection: convertFacingDirectionToElbowDirection(start.facingDirection)
@@ -179812,8 +179839,8 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
179812
179839
  y: end.position.y,
179813
179840
  facingDirection: convertFacingDirectionToElbowDirection(end.facingDirection)
179814
179841
  });
179815
- for (let j4 = 0;j4 < path33.length - 1; j4++) {
179816
- elbowEdges.push({ from: path33[j4], to: path33[j4 + 1] });
179842
+ for (let j4 = 0;j4 < path34.length - 1; j4++) {
179843
+ elbowEdges.push({ from: path34[j4], to: path34[j4 + 1] });
179817
179844
  }
179818
179845
  }
179819
179846
  const doesSegmentIntersectRect = (edge, rect) => {
@@ -186001,8 +186028,8 @@ react/cjs/react-jsx-runtime.development.js:
186001
186028
  */
186002
186029
 
186003
186030
  // lib/import/import-component-from-jlcpcb.ts
186004
- import fs32 from "node:fs/promises";
186005
- import path33 from "node:path";
186031
+ import fs33 from "node:fs/promises";
186032
+ import path34 from "node:path";
186006
186033
  var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cwd()) => {
186007
186034
  const component = await fetchEasyEDAComponent(jlcpcbPartNumber);
186008
186035
  const tsx = await convertRawEasyToTsx(component);
@@ -186010,10 +186037,10 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cw
186010
186037
  if (!fileName) {
186011
186038
  throw new Error("Could not determine file name of converted component");
186012
186039
  }
186013
- const importsDir = path33.join(projectDir, "imports");
186014
- await fs32.mkdir(importsDir, { recursive: true });
186015
- const filePath = path33.join(importsDir, `${fileName}.tsx`);
186016
- await fs32.writeFile(filePath, tsx);
186040
+ const importsDir = path34.join(projectDir, "imports");
186041
+ await fs33.mkdir(importsDir, { recursive: true });
186042
+ const filePath = path34.join(importsDir, `${fileName}.tsx`);
186043
+ await fs33.writeFile(filePath, tsx);
186017
186044
  return { filePath };
186018
186045
  };
186019
186046
 
@@ -187378,12 +187405,12 @@ var registerRemove = (program3) => {
187378
187405
  };
187379
187406
 
187380
187407
  // cli/build/register.ts
187381
- import path42 from "node:path";
187382
- import fs41 from "node:fs";
187408
+ import path43 from "node:path";
187409
+ import fs42 from "node:fs";
187383
187410
 
187384
187411
  // cli/build/build-file.ts
187385
- import path34 from "node:path";
187386
- import fs33 from "node:fs";
187412
+ import path35 from "node:path";
187413
+ import fs34 from "node:fs";
187387
187414
 
187388
187415
  // lib/shared/circuit-json-diagnostics.ts
187389
187416
  function analyzeCircuitJson(circuitJson) {
@@ -187445,9 +187472,9 @@ var buildFile = async (input, output, projectDir, options) => {
187445
187472
  filePath: input,
187446
187473
  platformConfig: completePlatformConfig
187447
187474
  });
187448
- fs33.mkdirSync(path34.dirname(output), { recursive: true });
187449
- fs33.writeFileSync(output, JSON.stringify(result.circuitJson, null, 2));
187450
- console.log(`Circuit JSON written to ${path34.relative(projectDir, output)}`);
187475
+ fs34.mkdirSync(path35.dirname(output), { recursive: true });
187476
+ fs34.writeFileSync(output, JSON.stringify(result.circuitJson, null, 2));
187477
+ console.log(`Circuit JSON written to ${path35.relative(projectDir, output)}`);
187451
187478
  const { errors, warnings } = analyzeCircuitJson(result.circuitJson);
187452
187479
  if (!options?.ignoreWarnings) {
187453
187480
  for (const warn of warnings) {
@@ -187486,7 +187513,7 @@ var logTsxExtensionHint = (error, entryFilePath) => {
187486
187513
  const isAggregateError = error instanceof AggregateError || String(error).includes("AggregateError");
187487
187514
  if (!isTsEntry || !isAggregateError)
187488
187515
  return;
187489
- const entryFileName = path34.basename(entryFilePath);
187516
+ const entryFileName = path35.basename(entryFilePath);
187490
187517
  console.error([
187491
187518
  "",
187492
187519
  `It looks like "${entryFileName}" is a ".ts" file. tscircuit component files must use the ".tsx" extension.`,
@@ -187501,7 +187528,7 @@ var logTypeReexportHint = (error, entryFilePath) => {
187501
187528
  if (!match)
187502
187529
  return;
187503
187530
  const [, exportName, fromSpecifier] = match;
187504
- const entryFileName = path34.basename(entryFilePath);
187531
+ const entryFileName = path35.basename(entryFilePath);
187505
187532
  console.error([
187506
187533
  "",
187507
187534
  `It looks like "${entryFileName}" re-exports the type-only symbol "${exportName}" from "${fromSpecifier}" without the "type" modifier.`,
@@ -187514,20 +187541,20 @@ var logTypeReexportHint = (error, entryFilePath) => {
187514
187541
  };
187515
187542
 
187516
187543
  // cli/build/get-build-entrypoints.ts
187517
- import fs34 from "node:fs";
187518
- import path35 from "node:path";
187544
+ import fs35 from "node:fs";
187545
+ import path36 from "node:path";
187519
187546
  var isSubPath2 = (maybeChild, maybeParent) => {
187520
- const relative9 = path35.relative(maybeParent, maybeChild);
187521
- return relative9 === "" || !relative9.startsWith("..") && !path35.isAbsolute(relative9);
187547
+ const relative10 = path36.relative(maybeParent, maybeChild);
187548
+ return relative10 === "" || !relative10.startsWith("..") && !path36.isAbsolute(relative10);
187522
187549
  };
187523
187550
  var findProjectRoot = (startDir) => {
187524
187551
  let currentDir = startDir;
187525
- while (currentDir !== path35.dirname(currentDir)) {
187526
- const packageJsonPath = path35.join(currentDir, "package.json");
187527
- if (fs34.existsSync(packageJsonPath)) {
187552
+ while (currentDir !== path36.dirname(currentDir)) {
187553
+ const packageJsonPath = path36.join(currentDir, "package.json");
187554
+ if (fs35.existsSync(packageJsonPath)) {
187528
187555
  return currentDir;
187529
187556
  }
187530
- currentDir = path35.dirname(currentDir);
187557
+ currentDir = path36.dirname(currentDir);
187531
187558
  }
187532
187559
  return startDir;
187533
187560
  };
@@ -187536,11 +187563,11 @@ async function getBuildEntrypoints({
187536
187563
  rootDir = process.cwd(),
187537
187564
  includeBoardFiles = true
187538
187565
  }) {
187539
- const resolvedRoot = path35.resolve(rootDir);
187566
+ const resolvedRoot = path36.resolve(rootDir);
187540
187567
  const includeBoardFilePatterns = includeBoardFiles ? getBoardFilePatterns(resolvedRoot) : [];
187541
187568
  const buildFromProjectDir = async () => {
187542
187569
  const projectConfig = loadProjectConfig(resolvedRoot);
187543
- const resolvedPreviewComponentPath = projectConfig?.previewComponentPath ? path35.resolve(resolvedRoot, projectConfig.previewComponentPath) : undefined;
187570
+ const resolvedPreviewComponentPath = projectConfig?.previewComponentPath ? path36.resolve(resolvedRoot, projectConfig.previewComponentPath) : undefined;
187544
187571
  if (includeBoardFiles) {
187545
187572
  const files = findBoardFiles({ projectDir: resolvedRoot });
187546
187573
  if (files.length > 0) {
@@ -187575,10 +187602,10 @@ async function getBuildEntrypoints({
187575
187602
  };
187576
187603
  };
187577
187604
  if (fileOrDir) {
187578
- const resolved = path35.resolve(resolvedRoot, fileOrDir);
187579
- if (fs34.existsSync(resolved) && fs34.statSync(resolved).isDirectory()) {
187605
+ const resolved = path36.resolve(resolvedRoot, fileOrDir);
187606
+ if (fs35.existsSync(resolved) && fs35.statSync(resolved).isDirectory()) {
187580
187607
  const projectConfig2 = loadProjectConfig(resolvedRoot);
187581
- const resolvedPreviewComponentPath2 = projectConfig2?.previewComponentPath ? path35.resolve(resolvedRoot, projectConfig2.previewComponentPath) : undefined;
187608
+ const resolvedPreviewComponentPath2 = projectConfig2?.previewComponentPath ? path36.resolve(resolvedRoot, projectConfig2.previewComponentPath) : undefined;
187582
187609
  if (includeBoardFiles) {
187583
187610
  const circuitFiles = findBoardFiles({
187584
187611
  projectDir: resolvedRoot,
@@ -187610,10 +187637,10 @@ async function getBuildEntrypoints({
187610
187637
  circuitFiles: mainEntrypoint ? [mainEntrypoint] : []
187611
187638
  };
187612
187639
  }
187613
- const fileDir = path35.dirname(resolved);
187640
+ const fileDir = path36.dirname(resolved);
187614
187641
  const projectDir = findProjectRoot(fileDir);
187615
187642
  const projectConfig = loadProjectConfig(projectDir);
187616
- const resolvedPreviewComponentPath = projectConfig?.previewComponentPath ? path35.resolve(projectDir, projectConfig.previewComponentPath) : undefined;
187643
+ const resolvedPreviewComponentPath = projectConfig?.previewComponentPath ? path36.resolve(projectDir, projectConfig.previewComponentPath) : undefined;
187617
187644
  return {
187618
187645
  projectDir,
187619
187646
  previewComponentPath: resolvedPreviewComponentPath,
@@ -187653,8 +187680,8 @@ ${scriptBlock} <script src="https://cdn.tailwindcss.com"></script>
187653
187680
  };
187654
187681
 
187655
187682
  // cli/build/build-preview-images.ts
187656
- import fs35 from "node:fs";
187657
- import path36 from "node:path";
187683
+ import fs36 from "node:fs";
187684
+ import path37 from "node:path";
187658
187685
  import {
187659
187686
  convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg2,
187660
187687
  convertCircuitJsonToSchematicSvg as convertCircuitJsonToSchematicSvg2
@@ -187730,21 +187757,21 @@ var generatePreviewAssets = async ({
187730
187757
  outputDir,
187731
187758
  distDir
187732
187759
  }) => {
187733
- const prefixRelative = path36.relative(distDir, outputDir) || ".";
187760
+ const prefixRelative = path37.relative(distDir, outputDir) || ".";
187734
187761
  const prefix = prefixRelative === "." ? "" : `[${prefixRelative}] `;
187735
187762
  let circuitJson;
187736
187763
  try {
187737
- const circuitJsonRaw = fs35.readFileSync(build.outputPath, "utf-8");
187764
+ const circuitJsonRaw = fs36.readFileSync(build.outputPath, "utf-8");
187738
187765
  circuitJson = JSON.parse(circuitJsonRaw);
187739
187766
  } catch (error) {
187740
187767
  console.error(`${prefix}Failed to read circuit JSON:`, error);
187741
187768
  return;
187742
187769
  }
187743
- fs35.mkdirSync(outputDir, { recursive: true });
187770
+ fs36.mkdirSync(outputDir, { recursive: true });
187744
187771
  try {
187745
187772
  console.log(`${prefix}Generating PCB SVG...`);
187746
187773
  const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson);
187747
- fs35.writeFileSync(path36.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
187774
+ fs36.writeFileSync(path37.join(outputDir, "pcb.svg"), pcbSvg, "utf-8");
187748
187775
  console.log(`${prefix}Written pcb.svg`);
187749
187776
  } catch (error) {
187750
187777
  console.error(`${prefix}Failed to generate PCB SVG:`, error);
@@ -187752,7 +187779,7 @@ var generatePreviewAssets = async ({
187752
187779
  try {
187753
187780
  console.log(`${prefix}Generating schematic SVG...`);
187754
187781
  const schematicSvg = convertCircuitJsonToSchematicSvg2(circuitJson);
187755
- fs35.writeFileSync(path36.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
187782
+ fs36.writeFileSync(path37.join(outputDir, "schematic.svg"), schematicSvg, "utf-8");
187756
187783
  console.log(`${prefix}Written schematic.svg`);
187757
187784
  } catch (error) {
187758
187785
  console.error(`${prefix}Failed to generate schematic SVG:`, error);
@@ -187769,7 +187796,7 @@ var generatePreviewAssets = async ({
187769
187796
  camPos: [10, 10, 10],
187770
187797
  lookAt: [0, 0, 0]
187771
187798
  });
187772
- fs35.writeFileSync(path36.join(outputDir, "3d.png"), Buffer.from(normalizeToUint8Array(pngBuffer)));
187799
+ fs36.writeFileSync(path37.join(outputDir, "3d.png"), Buffer.from(normalizeToUint8Array(pngBuffer)));
187773
187800
  console.log(`${prefix}Written 3d.png`);
187774
187801
  } catch (error) {
187775
187802
  console.error(`${prefix}Failed to generate 3D PNG:`, error);
@@ -187784,14 +187811,14 @@ var buildPreviewImages = async ({
187784
187811
  }) => {
187785
187812
  const successfulBuilds = builtFiles.filter((file) => file.ok);
187786
187813
  const previewEntrypoint = previewComponentPath || mainEntrypoint;
187787
- const resolvedPreviewEntrypoint = previewEntrypoint ? path36.resolve(previewEntrypoint) : undefined;
187814
+ const resolvedPreviewEntrypoint = previewEntrypoint ? path37.resolve(previewEntrypoint) : undefined;
187788
187815
  if (allImages) {
187789
187816
  if (successfulBuilds.length === 0) {
187790
187817
  console.warn("No successful build output available for preview image generation.");
187791
187818
  return;
187792
187819
  }
187793
187820
  for (const build of successfulBuilds) {
187794
- const outputDir = path36.dirname(build.outputPath);
187821
+ const outputDir = path37.dirname(build.outputPath);
187795
187822
  await generatePreviewAssets({
187796
187823
  build,
187797
187824
  outputDir,
@@ -187802,7 +187829,7 @@ var buildPreviewImages = async ({
187802
187829
  }
187803
187830
  const previewBuild = (() => {
187804
187831
  if (resolvedPreviewEntrypoint) {
187805
- const match = successfulBuilds.find((built) => path36.resolve(built.sourcePath) === resolvedPreviewEntrypoint);
187832
+ const match = successfulBuilds.find((built) => path37.resolve(built.sourcePath) === resolvedPreviewEntrypoint);
187806
187833
  if (match)
187807
187834
  return match;
187808
187835
  }
@@ -187820,8 +187847,8 @@ var buildPreviewImages = async ({
187820
187847
  };
187821
187848
 
187822
187849
  // cli/build/build-preview-gltf.ts
187823
- import fs36 from "node:fs";
187824
- import path37 from "node:path";
187850
+ import fs37 from "node:fs";
187851
+ import path38 from "node:path";
187825
187852
  import { convertCircuitJsonToGltf as convertCircuitJsonToGltf3 } from "circuit-json-to-gltf";
187826
187853
  var buildPreviewGltf = async ({
187827
187854
  builtFiles,
@@ -187831,10 +187858,10 @@ var buildPreviewGltf = async ({
187831
187858
  }) => {
187832
187859
  const successfulBuilds = builtFiles.filter((file) => file.ok);
187833
187860
  const previewEntrypoint = previewComponentPath || mainEntrypoint;
187834
- const resolvedPreviewEntrypoint = previewEntrypoint ? path37.resolve(previewEntrypoint) : undefined;
187861
+ const resolvedPreviewEntrypoint = previewEntrypoint ? path38.resolve(previewEntrypoint) : undefined;
187835
187862
  const previewBuild = (() => {
187836
187863
  if (resolvedPreviewEntrypoint) {
187837
- const match = successfulBuilds.find((built) => path37.resolve(built.sourcePath) === resolvedPreviewEntrypoint);
187864
+ const match = successfulBuilds.find((built) => path38.resolve(built.sourcePath) === resolvedPreviewEntrypoint);
187838
187865
  if (match)
187839
187866
  return match;
187840
187867
  }
@@ -187846,16 +187873,16 @@ var buildPreviewGltf = async ({
187846
187873
  }
187847
187874
  let circuitJson;
187848
187875
  try {
187849
- const circuitJsonRaw = fs36.readFileSync(previewBuild.outputPath, "utf-8");
187876
+ const circuitJsonRaw = fs37.readFileSync(previewBuild.outputPath, "utf-8");
187850
187877
  circuitJson = JSON.parse(circuitJsonRaw);
187851
187878
  } catch (error) {
187852
187879
  console.error("Failed to read circuit JSON:", error);
187853
187880
  return;
187854
187881
  }
187855
187882
  const sourcePath = previewBuild.sourcePath;
187856
- const sourceBasename = path37.basename(sourcePath);
187883
+ const sourceBasename = path38.basename(sourcePath);
187857
187884
  const gltfFilename = sourceBasename.replace(/(\.(board|circuit))?\.tsx?$/, ".gltf");
187858
- const outputPath = path37.join(distDir, gltfFilename);
187885
+ const outputPath = path38.join(distDir, gltfFilename);
187859
187886
  try {
187860
187887
  console.log("Converting circuit to GLTF...");
187861
187888
  const circuitJsonWithFileUrls = convertModelUrlsToFileUrls(circuitJson);
@@ -187863,7 +187890,7 @@ var buildPreviewGltf = async ({
187863
187890
  format: "gltf"
187864
187891
  });
187865
187892
  const gltfContent = JSON.stringify(gltfData, null, 2);
187866
- fs36.writeFileSync(outputPath, gltfContent, "utf-8");
187893
+ fs37.writeFileSync(outputPath, gltfContent, "utf-8");
187867
187894
  console.log(`Written ${gltfFilename}`);
187868
187895
  } catch (error) {
187869
187896
  console.error("Failed to generate GLTF:", error);
@@ -187871,8 +187898,8 @@ var buildPreviewGltf = async ({
187871
187898
  };
187872
187899
 
187873
187900
  // cli/build/generate-kicad-project.ts
187874
- import fs37 from "node:fs";
187875
- import path38 from "node:path";
187901
+ import fs38 from "node:fs";
187902
+ import path39 from "node:path";
187876
187903
  var createKicadProContent = ({
187877
187904
  projectName,
187878
187905
  schematicFileName,
@@ -187912,10 +187939,10 @@ var generateKicadProject = async ({
187912
187939
  boardFileName
187913
187940
  });
187914
187941
  if (writeFiles) {
187915
- fs37.mkdirSync(outputDir, { recursive: true });
187916
- fs37.writeFileSync(path38.join(outputDir, schematicFileName), schContent);
187917
- fs37.writeFileSync(path38.join(outputDir, boardFileName), pcbContent);
187918
- fs37.writeFileSync(path38.join(outputDir, projectFileName), proContent);
187942
+ fs38.mkdirSync(outputDir, { recursive: true });
187943
+ fs38.writeFileSync(path39.join(outputDir, schematicFileName), schContent);
187944
+ fs38.writeFileSync(path39.join(outputDir, boardFileName), pcbContent);
187945
+ fs38.writeFileSync(path39.join(outputDir, projectFileName), proContent);
187919
187946
  }
187920
187947
  return {
187921
187948
  pcbContent,
@@ -187927,8 +187954,8 @@ var generateKicadProject = async ({
187927
187954
  };
187928
187955
 
187929
187956
  // cli/build/transpile/index.ts
187930
- import path40 from "node:path";
187931
- import fs39 from "node:fs";
187957
+ import path41 from "node:path";
187958
+ import fs40 from "node:fs";
187932
187959
  import { rollup } from "rollup";
187933
187960
  import typescript from "@rollup/plugin-typescript";
187934
187961
  import resolve11 from "@rollup/plugin-node-resolve";
@@ -187937,11 +187964,11 @@ import json from "@rollup/plugin-json";
187937
187964
  import dts from "rollup-plugin-dts";
187938
187965
 
187939
187966
  // cli/build/transpile/static-asset-plugin.ts
187940
- import fs38 from "node:fs";
187941
- import path39 from "node:path";
187967
+ import fs39 from "node:fs";
187968
+ import path40 from "node:path";
187942
187969
  import { createHash } from "node:crypto";
187943
187970
  function normalizePathSeparators(filePath) {
187944
- return filePath.split(path39.sep).join("/");
187971
+ return filePath.split(path40.sep).join("/");
187945
187972
  }
187946
187973
  var STATIC_ASSET_EXTENSIONS = new Set([
187947
187974
  ".glb",
@@ -187972,24 +187999,24 @@ var createStaticAssetPlugin = ({
187972
187999
  return {
187973
188000
  name: "tsci-static-assets",
187974
188001
  resolveId(source, importer) {
187975
- const ext = path39.extname(source).toLowerCase();
188002
+ const ext = path40.extname(source).toLowerCase();
187976
188003
  if (!STATIC_ASSET_EXTENSIONS.has(ext))
187977
188004
  return null;
187978
- if (path39.isAbsolute(source)) {
187979
- return fs38.existsSync(source) ? { id: normalizePathSeparators(source), external: true } : null;
188005
+ if (path40.isAbsolute(source)) {
188006
+ return fs39.existsSync(source) ? { id: normalizePathSeparators(source), external: true } : null;
187980
188007
  }
187981
188008
  if (importer) {
187982
- const importerNative = importer.split("/").join(path39.sep);
187983
- const resolvedFromImporter = path39.resolve(path39.dirname(importerNative), source);
187984
- if (fs38.existsSync(resolvedFromImporter)) {
188009
+ const importerNative = importer.split("/").join(path40.sep);
188010
+ const resolvedFromImporter = path40.resolve(path40.dirname(importerNative), source);
188011
+ if (fs39.existsSync(resolvedFromImporter)) {
187985
188012
  return {
187986
188013
  id: normalizePathSeparators(resolvedFromImporter),
187987
188014
  external: true
187988
188015
  };
187989
188016
  }
187990
188017
  }
187991
- const resolvedFromProject = path39.resolve(resolvedBaseUrl, source);
187992
- if (fs38.existsSync(resolvedFromProject)) {
188018
+ const resolvedFromProject = path40.resolve(resolvedBaseUrl, source);
188019
+ if (fs39.existsSync(resolvedFromProject)) {
187993
188020
  return {
187994
188021
  id: normalizePathSeparators(resolvedFromProject),
187995
188022
  external: true
@@ -188002,8 +188029,8 @@ var createStaticAssetPlugin = ({
188002
188029
  const wildcard = isWildcard ? source.slice(patternPrefix.length) : "";
188003
188030
  for (const target of targets) {
188004
188031
  const targetPath = isWildcard ? target.replace("*", wildcard) : target;
188005
- const resolvedTarget = path39.resolve(resolvedBaseUrl, targetPath);
188006
- if (fs38.existsSync(resolvedTarget)) {
188032
+ const resolvedTarget = path40.resolve(resolvedBaseUrl, targetPath);
188033
+ if (fs39.existsSync(resolvedTarget)) {
188007
188034
  return {
188008
188035
  id: normalizePathSeparators(resolvedTarget),
188009
188036
  external: true
@@ -188029,18 +188056,18 @@ var createStaticAssetPlugin = ({
188029
188056
  if (chunk.type !== "chunk")
188030
188057
  continue;
188031
188058
  for (const importedId of chunk.imports) {
188032
- const ext = path39.extname(importedId).toLowerCase();
188059
+ const ext = path40.extname(importedId).toLowerCase();
188033
188060
  if (!STATIC_ASSET_EXTENSIONS.has(ext))
188034
188061
  continue;
188035
188062
  if (!copiedAssets.has(importedId)) {
188036
- const assetDir = path39.join(outputDir, "assets");
188037
- fs38.mkdirSync(assetDir, { recursive: true });
188038
- const nativePath = importedId.split("/").join(path39.sep);
188039
- const fileBuffer = fs38.readFileSync(nativePath);
188063
+ const assetDir = path40.join(outputDir, "assets");
188064
+ fs39.mkdirSync(assetDir, { recursive: true });
188065
+ const nativePath = importedId.split("/").join(path40.sep);
188066
+ const fileBuffer = fs39.readFileSync(nativePath);
188040
188067
  const hash = createHash("sha1").update(fileBuffer).digest("hex").slice(0, 8);
188041
- const fileName = `${path39.basename(importedId, ext)}-${hash}${ext}`;
188042
- const outputFilePath = path39.join(assetDir, fileName);
188043
- fs38.writeFileSync(outputFilePath, fileBuffer);
188068
+ const fileName = `${path40.basename(importedId, ext)}-${hash}${ext}`;
188069
+ const outputFilePath = path40.join(assetDir, fileName);
188070
+ fs39.writeFileSync(outputFilePath, fileBuffer);
188044
188071
  copiedAssets.set(importedId, `./assets/${fileName}`);
188045
188072
  assetIdToOutputPath.set(importedId, `./assets/${fileName}`);
188046
188073
  }
@@ -188062,17 +188089,17 @@ function escapeRegExp(string) {
188062
188089
 
188063
188090
  // cli/build/transpile/index.ts
188064
188091
  var createExternalFunction = (projectDir, tsconfigPath) => (id2) => {
188065
- if (id2.startsWith(".") || id2.startsWith("/") || path40.isAbsolute(id2)) {
188092
+ if (id2.startsWith(".") || id2.startsWith("/") || path41.isAbsolute(id2)) {
188066
188093
  return false;
188067
188094
  }
188068
188095
  let baseUrl = projectDir;
188069
188096
  let pathMappings = {};
188070
- if (tsconfigPath && fs39.existsSync(tsconfigPath)) {
188097
+ if (tsconfigPath && fs40.existsSync(tsconfigPath)) {
188071
188098
  try {
188072
- const tsconfigContent = fs39.readFileSync(tsconfigPath, "utf-8");
188099
+ const tsconfigContent = fs40.readFileSync(tsconfigPath, "utf-8");
188073
188100
  const tsconfig = JSON.parse(tsconfigContent);
188074
188101
  if (tsconfig.compilerOptions?.baseUrl) {
188075
- baseUrl = path40.resolve(path40.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
188102
+ baseUrl = path41.resolve(path41.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
188076
188103
  }
188077
188104
  if (tsconfig.compilerOptions?.paths) {
188078
188105
  pathMappings = tsconfig.compilerOptions.paths;
@@ -188086,17 +188113,17 @@ var createExternalFunction = (projectDir, tsconfigPath) => (id2) => {
188086
188113
  }
188087
188114
  }
188088
188115
  const potentialPaths = [
188089
- path40.join(baseUrl, id2),
188090
- path40.join(baseUrl, `${id2}.ts`),
188091
- path40.join(baseUrl, `${id2}.tsx`),
188092
- path40.join(baseUrl, `${id2}.js`),
188093
- path40.join(baseUrl, `${id2}.jsx`),
188094
- path40.join(baseUrl, id2, "index.ts"),
188095
- path40.join(baseUrl, id2, "index.tsx"),
188096
- path40.join(baseUrl, id2, "index.js"),
188097
- path40.join(baseUrl, id2, "index.jsx")
188116
+ path41.join(baseUrl, id2),
188117
+ path41.join(baseUrl, `${id2}.ts`),
188118
+ path41.join(baseUrl, `${id2}.tsx`),
188119
+ path41.join(baseUrl, `${id2}.js`),
188120
+ path41.join(baseUrl, `${id2}.jsx`),
188121
+ path41.join(baseUrl, id2, "index.ts"),
188122
+ path41.join(baseUrl, id2, "index.tsx"),
188123
+ path41.join(baseUrl, id2, "index.js"),
188124
+ path41.join(baseUrl, id2, "index.jsx")
188098
188125
  ];
188099
- if (potentialPaths.some((p) => fs39.existsSync(p))) {
188126
+ if (potentialPaths.some((p) => fs40.existsSync(p))) {
188100
188127
  return false;
188101
188128
  }
188102
188129
  return true;
@@ -188107,17 +188134,17 @@ var transpileFile = async ({
188107
188134
  projectDir
188108
188135
  }) => {
188109
188136
  try {
188110
- fs39.mkdirSync(outputDir, { recursive: true });
188111
- const tsconfigPath = path40.join(projectDir, "tsconfig.json");
188112
- const hasTsConfig = fs39.existsSync(tsconfigPath);
188137
+ fs40.mkdirSync(outputDir, { recursive: true });
188138
+ const tsconfigPath = path41.join(projectDir, "tsconfig.json");
188139
+ const hasTsConfig = fs40.existsSync(tsconfigPath);
188113
188140
  let tsconfigBaseUrl = projectDir;
188114
188141
  let tsconfigPathMappings;
188115
188142
  if (hasTsConfig) {
188116
188143
  try {
188117
- const tsconfigContent = fs39.readFileSync(tsconfigPath, "utf-8");
188144
+ const tsconfigContent = fs40.readFileSync(tsconfigPath, "utf-8");
188118
188145
  const tsconfig = JSON.parse(tsconfigContent);
188119
188146
  if (tsconfig.compilerOptions?.baseUrl) {
188120
- tsconfigBaseUrl = path40.resolve(path40.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
188147
+ tsconfigBaseUrl = path41.resolve(path41.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
188121
188148
  }
188122
188149
  if (tsconfig.compilerOptions?.paths) {
188123
188150
  tsconfigPathMappings = tsconfig.compilerOptions.paths;
@@ -188172,27 +188199,27 @@ var transpileFile = async ({
188172
188199
  external: createExternalFunction(projectDir, hasTsConfig ? tsconfigPath : undefined),
188173
188200
  plugins: getPlugins()
188174
188201
  });
188175
- const esmOutputPath = path40.join(outputDir, "index.js");
188202
+ const esmOutputPath = path41.join(outputDir, "index.js");
188176
188203
  await esmBundle.write({
188177
188204
  file: esmOutputPath,
188178
188205
  format: "es",
188179
188206
  sourcemap: false
188180
188207
  });
188181
- console.log(`ESM bundle written to ${path40.relative(projectDir, esmOutputPath)}`);
188208
+ console.log(`ESM bundle written to ${path41.relative(projectDir, esmOutputPath)}`);
188182
188209
  console.log("Building CommonJS bundle...");
188183
188210
  const cjsBundle = await rollup({
188184
188211
  input,
188185
188212
  external: createExternalFunction(projectDir, hasTsConfig ? tsconfigPath : undefined),
188186
188213
  plugins: getPlugins()
188187
188214
  });
188188
- const cjsOutputPath = path40.join(outputDir, "index.cjs");
188215
+ const cjsOutputPath = path41.join(outputDir, "index.cjs");
188189
188216
  console.log("Writing CJS bundle to:", cjsOutputPath);
188190
188217
  await cjsBundle.write({
188191
188218
  file: cjsOutputPath,
188192
188219
  format: "cjs",
188193
188220
  sourcemap: false
188194
188221
  });
188195
- console.log(`CommonJS bundle written to ${path40.relative(projectDir, cjsOutputPath)}`);
188222
+ console.log(`CommonJS bundle written to ${path41.relative(projectDir, cjsOutputPath)}`);
188196
188223
  console.log("Generating type declarations...");
188197
188224
  const dtsBundle = await rollup({
188198
188225
  input,
@@ -188217,9 +188244,9 @@ var transpileFile = async ({
188217
188244
  dtsContent = dtsContent.replace(/import \* as [\w_]+ from ['"]react\/jsx-runtime['"];?\s*\n?/g, "");
188218
188245
  dtsContent = dtsContent.replace(/[\w_]+\.JSX\.Element/g, "any");
188219
188246
  dtsContent = dtsContent.replace(/export\s*{\s*};\s*$/gm, "").trim();
188220
- const dtsOutputPath = path40.join(outputDir, "index.d.ts");
188221
- fs39.writeFileSync(dtsOutputPath, dtsContent);
188222
- console.log(`Type declarations written to ${path40.relative(projectDir, dtsOutputPath)}`);
188247
+ const dtsOutputPath = path41.join(outputDir, "index.d.ts");
188248
+ fs40.writeFileSync(dtsOutputPath, dtsContent);
188249
+ console.log(`Type declarations written to ${path41.relative(projectDir, dtsOutputPath)}`);
188223
188250
  console.log(kleur_default.green("Transpilation complete!"));
188224
188251
  return true;
188225
188252
  } catch (err) {
@@ -188232,17 +188259,17 @@ var transpileFile = async ({
188232
188259
  };
188233
188260
 
188234
188261
  // cli/utils/validate-main-in-dist.ts
188235
- import fs40 from "node:fs";
188236
- import path41 from "node:path";
188262
+ import fs41 from "node:fs";
188263
+ import path42 from "node:path";
188237
188264
  var validateMainInDist = (projectDir, distDir) => {
188238
- const packageJsonPath = path41.join(projectDir, "package.json");
188239
- if (!fs40.existsSync(packageJsonPath))
188265
+ const packageJsonPath = path42.join(projectDir, "package.json");
188266
+ if (!fs41.existsSync(packageJsonPath))
188240
188267
  return;
188241
- const packageJson = JSON.parse(fs40.readFileSync(packageJsonPath, "utf-8"));
188268
+ const packageJson = JSON.parse(fs41.readFileSync(packageJsonPath, "utf-8"));
188242
188269
  if (typeof packageJson.main !== "string")
188243
188270
  return;
188244
- const resolvedMainPath = path41.resolve(projectDir, packageJson.main);
188245
- const isMainInDist = resolvedMainPath === distDir || resolvedMainPath.startsWith(`${distDir}${path41.sep}`);
188271
+ const resolvedMainPath = path42.resolve(projectDir, packageJson.main);
188272
+ const isMainInDist = resolvedMainPath === distDir || resolvedMainPath.startsWith(`${distDir}${path42.sep}`);
188246
188273
  if (!isMainInDist) {
188247
188274
  console.warn('When using transpilation, your package\'s "main" field should point inside the `dist/*` directory, usually to "dist/index.js"');
188248
188275
  }
@@ -188272,8 +188299,8 @@ var registerBuild = (program3) => {
188272
188299
  }
188273
188300
  return config;
188274
188301
  })();
188275
- const distDir = path42.join(projectDir, "dist");
188276
- fs41.mkdirSync(distDir, { recursive: true });
188302
+ const distDir = path43.join(projectDir, "dist");
188303
+ fs42.mkdirSync(distDir, { recursive: true });
188277
188304
  console.log(`Building ${circuitFiles.length} file(s)...`);
188278
188305
  let hasErrors = false;
188279
188306
  const staticFileReferences = [];
@@ -188281,10 +188308,10 @@ var registerBuild = (program3) => {
188281
188308
  const kicadProjects = [];
188282
188309
  const shouldGenerateKicad = options?.kicad || options?.kicadFootprintLibrary;
188283
188310
  for (const filePath of circuitFiles) {
188284
- const relative9 = path42.relative(projectDir, filePath);
188285
- console.log(`Building ${relative9}...`);
188286
- const outputDirName = relative9.replace(/(\.board|\.circuit)?\.tsx$/, "");
188287
- const outputPath = path42.join(distDir, outputDirName, "circuit.json");
188311
+ const relative10 = path43.relative(projectDir, filePath);
188312
+ console.log(`Building ${relative10}...`);
188313
+ const outputDirName = relative10.replace(/(\.board|\.circuit)?\.tsx$/, "");
188314
+ const outputPath = path43.join(distDir, outputDirName, "circuit.json");
188288
188315
  const buildOutcome = await buildFile(filePath, outputPath, projectDir, {
188289
188316
  ignoreErrors: options?.ignoreErrors,
188290
188317
  ignoreWarnings: options?.ignoreWarnings,
@@ -188298,17 +188325,17 @@ var registerBuild = (program3) => {
188298
188325
  if (!buildOutcome.ok) {
188299
188326
  hasErrors = true;
188300
188327
  } else if (options?.site) {
188301
- const normalizedSourcePath = relative9.split(path42.sep).join("/");
188302
- const relativeOutputPath = path42.join(outputDirName, "circuit.json");
188303
- const normalizedOutputPath = relativeOutputPath.split(path42.sep).join("/");
188328
+ const normalizedSourcePath = relative10.split(path43.sep).join("/");
188329
+ const relativeOutputPath = path43.join(outputDirName, "circuit.json");
188330
+ const normalizedOutputPath = relativeOutputPath.split(path43.sep).join("/");
188304
188331
  staticFileReferences.push({
188305
188332
  filePath: normalizedSourcePath,
188306
188333
  fileStaticAssetUrl: `./${normalizedOutputPath}`
188307
188334
  });
188308
188335
  }
188309
188336
  if (buildOutcome.ok && shouldGenerateKicad && buildOutcome.circuitJson) {
188310
- const projectOutputDir = path42.join(distDir, outputDirName, "kicad");
188311
- const projectName = path42.basename(outputDirName);
188337
+ const projectOutputDir = path43.join(distDir, outputDirName, "kicad");
188338
+ const projectName = path43.basename(outputDirName);
188312
188339
  const project = await generateKicadProject({
188313
188340
  circuitJson: buildOutcome.circuitJson,
188314
188341
  outputDir: projectOutputDir,
@@ -188371,8 +188398,8 @@ var registerBuild = (program3) => {
188371
188398
  files: staticFileReferences,
188372
188399
  standaloneScriptSrc: "./standalone.min.js"
188373
188400
  });
188374
- fs41.writeFileSync(path42.join(distDir, "index.html"), indexHtml);
188375
- fs41.writeFileSync(path42.join(distDir, "standalone.min.js"), standalone_min_default);
188401
+ fs42.writeFileSync(path43.join(distDir, "index.html"), indexHtml);
188402
+ fs42.writeFileSync(path43.join(distDir, "standalone.min.js"), standalone_min_default);
188376
188403
  }
188377
188404
  if (options?.kicadFootprintLibrary) {
188378
188405
  if (kicadProjects.length === 0) {
@@ -188401,7 +188428,7 @@ var registerBuild = (program3) => {
188401
188428
  if (enabledOpts.length > 0) {
188402
188429
  console.log(` Options ${kleur_default.cyan(enabledOpts.join(", "))}`);
188403
188430
  }
188404
- console.log(` Output ${kleur_default.dim(path42.relative(process.cwd(), distDir) || "dist")}`);
188431
+ console.log(` Output ${kleur_default.dim(path43.relative(process.cwd(), distDir) || "dist")}`);
188405
188432
  console.log(hasErrors ? kleur_default.yellow(`
188406
188433
  ⚠ Build completed with errors`) : kleur_default.green(`
188407
188434
  ✓ Done`));
@@ -188415,8 +188442,8 @@ var registerBuild = (program3) => {
188415
188442
  };
188416
188443
 
188417
188444
  // lib/shared/snapshot-project.ts
188418
- import fs43 from "node:fs";
188419
- import path43 from "node:path";
188445
+ import fs44 from "node:fs";
188446
+ import path44 from "node:path";
188420
188447
  import looksSame2 from "looks-same";
188421
188448
  import {
188422
188449
  convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg3,
@@ -188427,7 +188454,7 @@ import { renderGLTFToPNGBufferFromGLBBuffer as renderGLTFToPNGBufferFromGLBBuffe
188427
188454
 
188428
188455
  // lib/shared/compare-images.ts
188429
188456
  import looksSame from "looks-same";
188430
- import fs42 from "node:fs/promises";
188457
+ import fs43 from "node:fs/promises";
188431
188458
  var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
188432
188459
  const { equal: equal2 } = await looksSame(buffer1, buffer2, {
188433
188460
  strict: false,
@@ -188443,7 +188470,7 @@ var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
188443
188470
  tolerance: 2
188444
188471
  });
188445
188472
  } else {
188446
- await fs42.writeFile(diffPath, buffer2);
188473
+ await fs43.writeFile(diffPath, buffer2);
188447
188474
  }
188448
188475
  }
188449
188476
  return { equal: equal2 };
@@ -188468,7 +188495,7 @@ var snapshotProject = async ({
188468
188495
  ...DEFAULT_IGNORED_PATTERNS,
188469
188496
  ...ignored.map(normalizeIgnorePattern)
188470
188497
  ];
188471
- const resolvedPaths = filePaths.map((f) => path43.resolve(projectDir, f));
188498
+ const resolvedPaths = filePaths.map((f) => path44.resolve(projectDir, f));
188472
188499
  const boardFiles = findBoardFiles({
188473
188500
  projectDir,
188474
188501
  ignore,
@@ -188482,7 +188509,7 @@ var snapshotProject = async ({
188482
188509
  const mismatches = [];
188483
188510
  let didUpdate = false;
188484
188511
  for (const file of boardFiles) {
188485
- const relativeFilePath = path43.relative(projectDir, file);
188512
+ const relativeFilePath = path44.relative(projectDir, file);
188486
188513
  let circuitJson;
188487
188514
  let pcbSvg;
188488
188515
  let schSvg;
@@ -188537,17 +188564,17 @@ var snapshotProject = async ({
188537
188564
  } catch (error) {
188538
188565
  const errorMessage = error instanceof Error ? error.message : String(error);
188539
188566
  if (errorMessage.includes("No pcb_board found in circuit JSON")) {
188540
- const fileDir = path43.dirname(file);
188541
- const relativeDir = path43.relative(projectDir, fileDir);
188542
- const snapDir2 = snapshotsDirName ? path43.join(projectDir, snapshotsDirName, relativeDir) : path43.join(fileDir, "__snapshots__");
188543
- const base2 = path43.basename(file).replace(/\.tsx$/, "");
188544
- const snap3dPath = path43.join(snapDir2, `${base2}-3d.snap.png`);
188545
- const existing3dSnapshot = fs43.existsSync(snap3dPath);
188567
+ const fileDir = path44.dirname(file);
188568
+ const relativeDir = path44.relative(projectDir, fileDir);
188569
+ const snapDir2 = snapshotsDirName ? path44.join(projectDir, snapshotsDirName, relativeDir) : path44.join(fileDir, "__snapshots__");
188570
+ const base2 = path44.basename(file).replace(/\.tsx$/, "");
188571
+ const snap3dPath = path44.join(snapDir2, `${base2}-3d.snap.png`);
188572
+ const existing3dSnapshot = fs44.existsSync(snap3dPath);
188546
188573
  if (existing3dSnapshot) {
188547
188574
  onError(kleur_default.red(`
188548
188575
  ❌ Failed to generate 3D snapshot for ${relativeFilePath}:
188549
188576
  `) + kleur_default.red(` No pcb_board found in circuit JSON
188550
- `) + kleur_default.red(` Existing snapshot: ${path43.relative(projectDir, snap3dPath)}
188577
+ `) + kleur_default.red(` Existing snapshot: ${path44.relative(projectDir, snap3dPath)}
188551
188578
  `));
188552
188579
  return onExit2(1);
188553
188580
  } else {
@@ -188563,9 +188590,9 @@ var snapshotProject = async ({
188563
188590
  }
188564
188591
  }
188565
188592
  }
188566
- const snapDir = snapshotsDirName ? path43.join(projectDir, snapshotsDirName, path43.relative(projectDir, path43.dirname(file))) : path43.join(path43.dirname(file), "__snapshots__");
188567
- fs43.mkdirSync(snapDir, { recursive: true });
188568
- const base = path43.basename(file).replace(/\.tsx$/, "");
188593
+ const snapDir = snapshotsDirName ? path44.join(projectDir, snapshotsDirName, path44.relative(projectDir, path44.dirname(file))) : path44.join(path44.dirname(file), "__snapshots__");
188594
+ fs44.mkdirSync(snapDir, { recursive: true });
188595
+ const base = path44.basename(file).replace(/\.tsx$/, "");
188569
188596
  const snapshots = [];
188570
188597
  if (pcbOnly || !schematicOnly) {
188571
188598
  snapshots.push({ type: "pcb", content: pcbSvg, isBinary: false });
@@ -188583,31 +188610,31 @@ var snapshotProject = async ({
188583
188610
  for (const snapshot of snapshots) {
188584
188611
  const { type } = snapshot;
188585
188612
  const is3d = type === "3d";
188586
- const snapPath = path43.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
188587
- const existing = fs43.existsSync(snapPath);
188613
+ const snapPath = path44.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
188614
+ const existing = fs44.existsSync(snapPath);
188588
188615
  const newContentBuffer = snapshot.isBinary ? snapshot.content : Buffer.from(snapshot.content, "utf8");
188589
188616
  const newContentForFile = snapshot.content;
188590
188617
  if (!existing) {
188591
- fs43.writeFileSync(snapPath, newContentForFile);
188592
- console.log("✅", kleur_default.gray(path43.relative(projectDir, snapPath)));
188618
+ fs44.writeFileSync(snapPath, newContentForFile);
188619
+ console.log("✅", kleur_default.gray(path44.relative(projectDir, snapPath)));
188593
188620
  didUpdate = true;
188594
188621
  continue;
188595
188622
  }
188596
- const oldContentBuffer = fs43.readFileSync(snapPath);
188623
+ const oldContentBuffer = fs44.readFileSync(snapPath);
188597
188624
  const diffPath = snapPath.replace(is3d ? ".snap.png" : ".snap.svg", is3d ? ".diff.png" : ".diff.svg");
188598
188625
  const { equal: equal2 } = await compareAndCreateDiff(oldContentBuffer, newContentBuffer, diffPath);
188599
188626
  if (update) {
188600
188627
  if (!forceUpdate && equal2) {
188601
- console.log("✅", kleur_default.gray(path43.relative(projectDir, snapPath)));
188628
+ console.log("✅", kleur_default.gray(path44.relative(projectDir, snapPath)));
188602
188629
  } else {
188603
- fs43.writeFileSync(snapPath, newContentForFile);
188604
- console.log("✅", kleur_default.gray(path43.relative(projectDir, snapPath)));
188630
+ fs44.writeFileSync(snapPath, newContentForFile);
188631
+ console.log("✅", kleur_default.gray(path44.relative(projectDir, snapPath)));
188605
188632
  didUpdate = true;
188606
188633
  }
188607
188634
  } else if (!equal2) {
188608
188635
  mismatches.push(`${snapPath} (diff: ${diffPath})`);
188609
188636
  } else {
188610
- console.log("✅", kleur_default.gray(path43.relative(projectDir, snapPath)));
188637
+ console.log("✅", kleur_default.gray(path44.relative(projectDir, snapPath)));
188611
188638
  }
188612
188639
  }
188613
188640
  }
@@ -188646,22 +188673,22 @@ var registerSnapshot = (program3) => {
188646
188673
  };
188647
188674
 
188648
188675
  // lib/shared/setup-github-actions.ts
188649
- import fs44 from "node:fs";
188650
- import path44 from "node:path";
188676
+ import fs45 from "node:fs";
188677
+ import path45 from "node:path";
188651
188678
  var setupGithubActions = (projectDir = process.cwd()) => {
188652
188679
  const findGitRoot = (startDir) => {
188653
- let dir = path44.resolve(startDir);
188654
- while (dir !== path44.parse(dir).root) {
188655
- if (fs44.existsSync(path44.join(dir, ".git"))) {
188680
+ let dir = path45.resolve(startDir);
188681
+ while (dir !== path45.parse(dir).root) {
188682
+ if (fs45.existsSync(path45.join(dir, ".git"))) {
188656
188683
  return dir;
188657
188684
  }
188658
- dir = path44.dirname(dir);
188685
+ dir = path45.dirname(dir);
188659
188686
  }
188660
188687
  return null;
188661
188688
  };
188662
188689
  const gitRoot = findGitRoot(projectDir) ?? projectDir;
188663
- const workflowsDir = path44.join(gitRoot, ".github", "workflows");
188664
- fs44.mkdirSync(workflowsDir, { recursive: true });
188690
+ const workflowsDir = path45.join(gitRoot, ".github", "workflows");
188691
+ fs45.mkdirSync(workflowsDir, { recursive: true });
188665
188692
  const buildWorkflow = `name: tscircuit Build
188666
188693
 
188667
188694
  on:
@@ -188700,8 +188727,8 @@ jobs:
188700
188727
  - run: bun install
188701
188728
  - run: bunx tsci snapshot
188702
188729
  `;
188703
- writeFileIfNotExists(path44.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
188704
- writeFileIfNotExists(path44.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
188730
+ writeFileIfNotExists(path45.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
188731
+ writeFileIfNotExists(path45.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
188705
188732
  };
188706
188733
 
188707
188734
  // cli/setup/register.ts
@@ -188739,8 +188766,8 @@ function registerAuthSetupNpmrc(program3) {
188739
188766
  }
188740
188767
 
188741
188768
  // cli/convert/register.ts
188742
- import fs45 from "node:fs/promises";
188743
- import path45 from "node:path";
188769
+ import fs46 from "node:fs/promises";
188770
+ import path46 from "node:path";
188744
188771
  import { parseKicadModToCircuitJson } from "kicad-component-converter";
188745
188772
 
188746
188773
  // node_modules/@tscircuit/mm/dist/index.js
@@ -188860,15 +188887,15 @@ var convertCircuitJsonToTscircuit = (circuitJson, opts) => {
188860
188887
  var registerConvert = (program3) => {
188861
188888
  program3.command("convert").description("Convert a .kicad_mod footprint to a tscircuit component").argument("<file>", "Path to the .kicad_mod file").option("-o, --output <path>", "Output TSX file path").option("-n, --name <component>", "Component name for export").action(async (file, options) => {
188862
188889
  try {
188863
- const inputPath = path45.resolve(file);
188864
- const modContent = await fs45.readFile(inputPath, "utf-8");
188890
+ const inputPath = path46.resolve(file);
188891
+ const modContent = await fs46.readFile(inputPath, "utf-8");
188865
188892
  const circuitJson = await parseKicadModToCircuitJson(modContent);
188866
- const componentName = options.name ?? path45.basename(inputPath, ".kicad_mod");
188893
+ const componentName = options.name ?? path46.basename(inputPath, ".kicad_mod");
188867
188894
  const tsx = convertCircuitJsonToTscircuit(circuitJson, {
188868
188895
  componentName
188869
188896
  });
188870
- const outputPath = options.output ? path45.resolve(options.output) : path45.join(path45.dirname(inputPath), `${componentName}.tsx`);
188871
- await fs45.writeFile(outputPath, tsx);
188897
+ const outputPath = options.output ? path46.resolve(options.output) : path46.join(path46.dirname(inputPath), `${componentName}.tsx`);
188898
+ await fs46.writeFile(outputPath, tsx);
188872
188899
  console.log(kleur_default.green(`Converted ${outputPath}`));
188873
188900
  } catch (error) {
188874
188901
  console.error(kleur_default.red("Failed to convert footprint:"), error instanceof Error ? error.message : error);
@@ -188964,12 +188991,12 @@ var registerSimulate = (program3) => {
188964
188991
  };
188965
188992
 
188966
188993
  // lib/shared/install-project-dependencies.ts
188967
- import fs47 from "node:fs";
188968
- import path47 from "node:path";
188994
+ import fs48 from "node:fs";
188995
+ import path48 from "node:path";
188969
188996
 
188970
188997
  // lib/shared/collect-tsci-dependencies.ts
188971
- import fs46 from "node:fs";
188972
- import path46 from "node:path";
188998
+ import fs47 from "node:fs";
188999
+ import path47 from "node:path";
188973
189000
  var DEFAULT_PATTERNS = ["**/*.{ts,tsx,js,jsx}"];
188974
189001
  var DEFAULT_IGNORES = [
188975
189002
  "**/node_modules/**",
@@ -188984,7 +189011,7 @@ function collectTsciDependencies({
188984
189011
  patterns = DEFAULT_PATTERNS,
188985
189012
  ignore = DEFAULT_IGNORES
188986
189013
  } = {}) {
188987
- const searchRoot = path46.resolve(cwd);
189014
+ const searchRoot = path47.resolve(cwd);
188988
189015
  const files = globbySync(patterns, {
188989
189016
  cwd: searchRoot,
188990
189017
  absolute: true,
@@ -188994,7 +189021,7 @@ function collectTsciDependencies({
188994
189021
  const dependencies2 = new Set;
188995
189022
  for (const filePath of files) {
188996
189023
  try {
188997
- const fileContents = fs46.readFileSync(filePath, "utf-8");
189024
+ const fileContents = fs47.readFileSync(filePath, "utf-8");
188998
189025
  let match;
188999
189026
  while (true) {
189000
189027
  match = IMPORT_PATTERN.exec(fileContents);
@@ -189011,26 +189038,26 @@ function collectTsciDependencies({
189011
189038
  async function installProjectDependencies({
189012
189039
  cwd = process.cwd()
189013
189040
  } = {}) {
189014
- const projectRoot = path47.resolve(cwd);
189015
- const packageJsonPath = path47.join(projectRoot, "package.json");
189016
- const npmrcPath = path47.join(projectRoot, ".npmrc");
189041
+ const projectRoot = path48.resolve(cwd);
189042
+ const packageJsonPath = path48.join(projectRoot, "package.json");
189043
+ const npmrcPath = path48.join(projectRoot, ".npmrc");
189017
189044
  const packageManager = getPackageManager();
189018
- if (!fs47.existsSync(projectRoot)) {
189045
+ if (!fs48.existsSync(projectRoot)) {
189019
189046
  throw new Error(`Directory not found: ${projectRoot}`);
189020
189047
  }
189021
189048
  let packageJsonCreated = false;
189022
- if (!fs47.existsSync(packageJsonPath)) {
189049
+ if (!fs48.existsSync(packageJsonPath)) {
189023
189050
  console.log("No package.json found. Generating a new one.");
189024
189051
  generatePackageJson(projectRoot);
189025
189052
  packageJsonCreated = true;
189026
189053
  } else {
189027
189054
  console.log("Found existing package.json.");
189028
189055
  }
189029
- if (!fs47.existsSync(npmrcPath)) {
189056
+ if (!fs48.existsSync(npmrcPath)) {
189030
189057
  console.log("Creating .npmrc with tscircuit registry configuration.");
189031
- fs47.writeFileSync(npmrcPath, "@tsci:registry=https://npm.tscircuit.com");
189058
+ fs48.writeFileSync(npmrcPath, "@tsci:registry=https://npm.tscircuit.com");
189032
189059
  }
189033
- const packageJson = JSON.parse(fs47.readFileSync(packageJsonPath, "utf-8"));
189060
+ const packageJson = JSON.parse(fs48.readFileSync(packageJsonPath, "utf-8"));
189034
189061
  if (packageJsonCreated) {
189035
189062
  const tsciDependencies = collectTsciDependencies({ cwd: projectRoot });
189036
189063
  if (tsciDependencies.length > 0) {
@@ -189045,7 +189072,7 @@ async function installProjectDependencies({
189045
189072
  console.log("No @tsci dependencies detected in circuit files.");
189046
189073
  }
189047
189074
  }
189048
- fs47.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
189075
+ fs48.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
189049
189076
  `);
189050
189077
  console.log(`Installing dependencies using ${kleur_default.bold(packageManager.name)}...`);
189051
189078
  try {
@@ -189080,7 +189107,7 @@ var registerInstall = (program3) => {
189080
189107
  };
189081
189108
 
189082
189109
  // cli/transpile/register.ts
189083
- import path48 from "node:path";
189110
+ import path49 from "node:path";
189084
189111
  var registerTranspile = (program3) => {
189085
189112
  program3.command("transpile").description("Transpile TypeScript/TSX to JavaScript (ESM, CommonJS, and type declarations)").argument("[file]", "Path to the entry file").action(async (file) => {
189086
189113
  try {
@@ -189088,7 +189115,7 @@ var registerTranspile = (program3) => {
189088
189115
  fileOrDir: file,
189089
189116
  includeBoardFiles: false
189090
189117
  });
189091
- const distDir = path48.join(projectDir, "dist");
189118
+ const distDir = path49.join(projectDir, "dist");
189092
189119
  validateMainInDist(projectDir, distDir);
189093
189120
  console.log("Transpiling entry file...");
189094
189121
  const entryFile = mainEntrypoint || circuitFiles[0];