easyeda 0.0.356 → 0.0.357

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.
package/dist/index.js CHANGED
@@ -4,6 +4,121 @@ var __export = (target, all) => {
4
4
  __defProp(target, name, { get: all[name], enumerable: true });
5
5
  };
6
6
 
7
+ // node_modules/@tscircuit/math-utils/dist/chunk-EFLPMB4J.js
8
+ function orientation(p, q, r) {
9
+ const val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
10
+ if (val === 0) return 0;
11
+ return val > 0 ? 1 : 2;
12
+ }
13
+ function distance(p1, p2) {
14
+ const dx = p1.x - p2.x;
15
+ const dy = p1.y - p2.y;
16
+ return Math.sqrt(dx * dx + dy * dy);
17
+ }
18
+
19
+ // node_modules/@tscircuit/math-utils/dist/chunk-GIGMPRPV.js
20
+ var getUnitVectorFromDirection = (direction) => {
21
+ switch (direction) {
22
+ case "up":
23
+ return { x: 0, y: 1 };
24
+ case "down":
25
+ return { x: 0, y: -1 };
26
+ case "left":
27
+ return { x: -1, y: 0 };
28
+ case "right":
29
+ return { x: 1, y: 0 };
30
+ }
31
+ };
32
+
33
+ // node_modules/@tscircuit/math-utils/dist/chunk-3WCUPG5S.js
34
+ var getBoundsCenter = (bounds) => ({
35
+ x: (bounds.minX + bounds.maxX) / 2,
36
+ y: (bounds.minY + bounds.maxY) / 2
37
+ });
38
+
39
+ // node_modules/@tscircuit/math-utils/dist/chunk-5N7UJNVK.js
40
+ var getBoundsFromPoints = (points) => {
41
+ if (points.length === 0) {
42
+ return null;
43
+ }
44
+ let minX = points[0].x;
45
+ let minY = points[0].y;
46
+ let maxX = points[0].x;
47
+ let maxY = points[0].y;
48
+ for (let i = 1; i < points.length; i++) {
49
+ const point2 = points[i];
50
+ if (point2.x < minX) minX = point2.x;
51
+ if (point2.y < minY) minY = point2.y;
52
+ if (point2.x > maxX) maxX = point2.x;
53
+ if (point2.y > maxY) maxY = point2.y;
54
+ }
55
+ return { minX, minY, maxX, maxY };
56
+ };
57
+
58
+ // lib/utils/get-board-outline-polygons.ts
59
+ var same = (a, b) => distance(a, b) < 1e-4;
60
+ var getBoardOutlinePolygons = (tracks) => {
61
+ const remainingEdges = tracks.flatMap(
62
+ (track) => track.points.slice(1).map((point2, i) => [track.points[i], point2])
63
+ ).filter(([a, b]) => !same(a, b));
64
+ const polygons = [];
65
+ while (remainingEdges.length) {
66
+ const edges = [remainingEdges.shift()];
67
+ while (true) {
68
+ const index = remainingEdges.findIndex(
69
+ (edge) => edge.some((p) => edges.flat().some((q) => same(p, q)))
70
+ );
71
+ if (index === -1) break;
72
+ edges.push(remainingEdges.splice(index, 1)[0]);
73
+ }
74
+ const endpoints = edges.flat();
75
+ if (endpoints.some((p) => endpoints.filter((q) => same(p, q)).length > 2))
76
+ continue;
77
+ const route = edges.shift();
78
+ let changed = true;
79
+ while (changed) {
80
+ changed = false;
81
+ for (let i = 0; i < edges.length; i++) {
82
+ const [a, b] = edges[i];
83
+ if (same(route.at(-1), a)) route.push(b);
84
+ else if (same(route.at(-1), b)) route.push(a);
85
+ else if (same(route[0], b)) route.unshift(a);
86
+ else if (same(route[0], a)) route.unshift(b);
87
+ else continue;
88
+ edges.splice(i, 1);
89
+ changed = true;
90
+ break;
91
+ }
92
+ }
93
+ if (same(route[0], route.at(-1))) route.pop();
94
+ else {
95
+ const first = route[0];
96
+ const last = route.at(-1);
97
+ if (Math.abs(first.x - last.x) > 1e-4 && Math.abs(first.y - last.y) > 1e-4)
98
+ continue;
99
+ }
100
+ if (route.some((p, i) => route.slice(i + 1).some((q) => same(p, q))))
101
+ continue;
102
+ while (route.length > 2) {
103
+ const index = route.findIndex(
104
+ (p, i) => orientation(
105
+ route[(i + route.length - 1) % route.length],
106
+ p,
107
+ route[(i + 1) % route.length]
108
+ ) === 0
109
+ );
110
+ if (index === -1) break;
111
+ route.splice(index, 1);
112
+ }
113
+ const area = route.reduce((sum, p, i) => {
114
+ const q = route[(i + 1) % route.length];
115
+ return sum + p.x * q.y - q.x * p.y;
116
+ }, 0);
117
+ if (route.length >= 3 && Math.abs(area) > 1e-8) polygons.push(route);
118
+ }
119
+ return polygons;
120
+ };
121
+
7
122
  // node_modules/circuit-json/dist/index.mjs
8
123
  var dist_exports = {};
9
124
  __export(dist_exports, {
@@ -22,7 +137,7 @@ __export(dist_exports, {
22
137
  capacitance: () => capacitance,
23
138
  circuit_json_footprint_load_error: () => circuit_json_footprint_load_error,
24
139
  current: () => current,
25
- distance: () => distance,
140
+ distance: () => distance2,
26
141
  duration_ms: () => duration_ms,
27
142
  experiment_type: () => experiment_type,
28
143
  external_footprint_load_error: () => external_footprint_load_error,
@@ -769,7 +884,7 @@ var inductance = z.string().or(z.number()).transform((v) => parseAndConvertSiUni
769
884
  var voltage = z.string().or(z.number()).transform((v) => parseAndConvertSiUnit(v, "V").value);
770
885
  var length = z.string().or(z.number()).transform((v) => parseAndConvertSiUnit(v).value);
771
886
  var frequency = z.string().or(z.number()).transform((v) => parseAndConvertSiUnit(v, "Hz").value);
772
- var distance = length;
887
+ var distance2 = length;
773
888
  var current = z.string().or(z.number()).transform((v) => parseAndConvertSiUnit(v, "A").value);
774
889
  var duration_ms = z.string().or(z.number()).transform((v) => parseAndConvertSiUnit(v).value);
775
890
  var time = duration_ms;
@@ -815,16 +930,16 @@ expectStringUnionsMatch(
815
930
  );
816
931
  expectStringUnionsMatch(true);
817
932
  var point = z2.object({
818
- x: distance,
819
- y: distance
933
+ x: distance2,
934
+ y: distance2
820
935
  });
821
936
  var position = point;
822
937
  expectTypesMatch(true);
823
938
  expectTypesMatch(true);
824
939
  var point3 = z3.object({
825
- x: distance,
826
- y: distance,
827
- z: distance
940
+ x: distance2,
941
+ y: distance2,
942
+ z: distance2
828
943
  });
829
944
  var position3 = point3;
830
945
  expectTypesMatch(true);
@@ -892,7 +1007,7 @@ var kicadAt = point.extend({
892
1007
  expectTypesMatch(true);
893
1008
  var kicadFont = z9.object({
894
1009
  size: point.optional(),
895
- thickness: distance.optional()
1010
+ thickness: distance2.optional()
896
1011
  });
897
1012
  expectTypesMatch(true);
898
1013
  var kicadEffects = z9.object({
@@ -932,7 +1047,7 @@ var kicadFootprintPad = z9.object({
932
1047
  shape: z9.string().optional(),
933
1048
  at: kicadAt.optional(),
934
1049
  size: point.optional(),
935
- drill: distance.optional(),
1050
+ drill: distance2.optional(),
936
1051
  layers: z9.array(z9.string()).optional(),
937
1052
  removeUnusedLayers: z9.boolean().optional(),
938
1053
  uuid: z9.string().optional()
@@ -963,7 +1078,7 @@ var kicadSymbolPinNumbers = z10.object({
963
1078
  });
964
1079
  expectTypesMatch(true);
965
1080
  var kicadSymbolPinNames = z10.object({
966
- offset: distance.optional(),
1081
+ offset: distance2.optional(),
967
1082
  hide: z10.boolean().optional()
968
1083
  });
969
1084
  expectTypesMatch(true);
@@ -1037,7 +1152,7 @@ var source_simple_capacitor = source_component_base.extend({
1037
1152
  capacitance,
1038
1153
  max_voltage_rating: voltage.optional(),
1039
1154
  display_capacitance: z14.string().optional(),
1040
- max_decoupling_trace_length: distance.optional()
1155
+ max_decoupling_trace_length: distance2.optional()
1041
1156
  });
1042
1157
  expectTypesMatch(true);
1043
1158
  var source_simple_resistor = source_component_base.extend({
@@ -1667,11 +1782,11 @@ var schematic_box = z72.object({
1667
1782
  schematic_sheet_id: z72.string().optional(),
1668
1783
  schematic_component_id: z72.string().optional(),
1669
1784
  schematic_symbol_id: z72.string().optional(),
1670
- width: distance,
1671
- height: distance,
1785
+ width: distance2,
1786
+ height: distance2,
1672
1787
  is_dashed: z72.boolean().default(false),
1673
- x: distance,
1674
- y: distance,
1788
+ x: distance2,
1789
+ y: distance2,
1675
1790
  subcircuit_id: z72.string().optional()
1676
1791
  }).describe("Draws a box on the schematic");
1677
1792
  expectTypesMatch(true);
@@ -1684,10 +1799,10 @@ var schematic_path = z73.object({
1684
1799
  fill_color: z73.string().optional(),
1685
1800
  is_filled: z73.boolean().optional(),
1686
1801
  is_dashed: z73.boolean().default(false),
1687
- stroke_width: distance.nullable().optional(),
1802
+ stroke_width: distance2.nullable().optional(),
1688
1803
  stroke_color: z73.string().optional(),
1689
- dash_length: distance.optional(),
1690
- dash_gap: distance.optional(),
1804
+ dash_length: distance2.optional(),
1805
+ dash_gap: distance2.optional(),
1691
1806
  points: z73.array(point),
1692
1807
  subcircuit_id: z73.string().optional()
1693
1808
  });
@@ -1774,15 +1889,15 @@ var schematic_line = z76.object({
1774
1889
  schematic_sheet_id: z76.string().optional(),
1775
1890
  schematic_component_id: z76.string().optional(),
1776
1891
  schematic_symbol_id: z76.string().optional(),
1777
- x1: distance,
1778
- y1: distance,
1779
- x2: distance,
1780
- y2: distance,
1781
- stroke_width: distance.nullable().optional(),
1892
+ x1: distance2,
1893
+ y1: distance2,
1894
+ x2: distance2,
1895
+ y2: distance2,
1896
+ stroke_width: distance2.nullable().optional(),
1782
1897
  color: z76.string().default("#000000"),
1783
1898
  is_dashed: z76.boolean().default(false),
1784
- dash_length: distance.optional(),
1785
- dash_gap: distance.optional(),
1899
+ dash_length: distance2.optional(),
1900
+ dash_gap: distance2.optional(),
1786
1901
  subcircuit_id: z76.string().optional()
1787
1902
  }).describe("Draws a styled line on the schematic");
1788
1903
  expectTypesMatch(true);
@@ -1793,10 +1908,10 @@ var schematic_rect = z77.object({
1793
1908
  schematic_component_id: z77.string().optional(),
1794
1909
  schematic_symbol_id: z77.string().optional(),
1795
1910
  center: point,
1796
- width: distance,
1797
- height: distance,
1911
+ width: distance2,
1912
+ height: distance2,
1798
1913
  rotation: rotation.default(0),
1799
- stroke_width: distance.nullable().optional(),
1914
+ stroke_width: distance2.nullable().optional(),
1800
1915
  color: z77.string().default("#000000"),
1801
1916
  is_filled: z77.boolean().default(false),
1802
1917
  fill_color: z77.string().optional(),
@@ -1811,8 +1926,8 @@ var schematic_circle = z78.object({
1811
1926
  schematic_component_id: z78.string().optional(),
1812
1927
  schematic_symbol_id: z78.string().optional(),
1813
1928
  center: point,
1814
- radius: distance,
1815
- stroke_width: distance.nullable().optional(),
1929
+ radius: distance2,
1930
+ stroke_width: distance2.nullable().optional(),
1816
1931
  color: z78.string().default("#000000"),
1817
1932
  is_filled: z78.boolean().default(false),
1818
1933
  fill_color: z78.string().optional(),
@@ -1827,11 +1942,11 @@ var schematic_arc = z79.object({
1827
1942
  schematic_component_id: z79.string().optional(),
1828
1943
  schematic_symbol_id: z79.string().optional(),
1829
1944
  center: point,
1830
- radius: distance,
1945
+ radius: distance2,
1831
1946
  start_angle_degrees: rotation,
1832
1947
  end_angle_degrees: rotation,
1833
1948
  direction: z79.enum(["clockwise", "counterclockwise"]).default("counterclockwise"),
1834
- stroke_width: distance.nullable().optional(),
1949
+ stroke_width: distance2.nullable().optional(),
1835
1950
  color: z79.string().default("#000000"),
1836
1951
  is_dashed: z79.boolean().default(false),
1837
1952
  subcircuit_id: z79.string().optional()
@@ -1886,8 +2001,8 @@ var schematic_text = z82.object({
1886
2001
  text: z82.string(),
1887
2002
  font_size: z82.number().default(0.18),
1888
2003
  position: z82.object({
1889
- x: distance,
1890
- y: distance
2004
+ x: distance2,
2005
+ y: distance2
1891
2006
  }),
1892
2007
  rotation: z82.number().default(0),
1893
2008
  anchor: z82.union([fivePointAnchor.describe("legacy"), ninePointAnchor]).default("center"),
@@ -2076,10 +2191,10 @@ var schematic_table = z94.object({
2076
2191
  schematic_table_id: getZodPrefixedIdWithDefault("schematic_table"),
2077
2192
  schematic_sheet_id: z94.string().optional(),
2078
2193
  anchor_position: point,
2079
- column_widths: z94.array(distance),
2080
- row_heights: z94.array(distance),
2081
- cell_padding: distance.optional(),
2082
- border_width: distance.optional(),
2194
+ column_widths: z94.array(distance2),
2195
+ row_heights: z94.array(distance2),
2196
+ cell_padding: distance2.optional(),
2197
+ border_width: distance2.optional(),
2083
2198
  subcircuit_id: z94.string().optional(),
2084
2199
  schematic_component_id: z94.string().optional(),
2085
2200
  anchor: ninePointAnchor.optional()
@@ -2098,11 +2213,11 @@ var schematic_table_cell = z95.object({
2098
2213
  end_column_index: z95.number(),
2099
2214
  text: z95.string().optional(),
2100
2215
  center: point,
2101
- width: distance,
2102
- height: distance,
2216
+ width: distance2,
2217
+ height: distance2,
2103
2218
  horizontal_align: z95.enum(["left", "center", "right"]).optional(),
2104
2219
  vertical_align: z95.enum(["top", "middle", "bottom"]).optional(),
2105
- font_size: distance.optional(),
2220
+ font_size: distance2.optional(),
2106
2221
  subcircuit_id: z95.string().optional()
2107
2222
  }).describe("Defines a cell within a schematic_table");
2108
2223
  expectTypesMatch(true);
@@ -2118,8 +2233,8 @@ var schematic_sheet = z96.object({
2118
2233
  );
2119
2234
  expectTypesMatch(true);
2120
2235
  var point_with_bulge = z97.object({
2121
- x: distance,
2122
- y: distance,
2236
+ x: distance2,
2237
+ y: distance2,
2123
2238
  bulge: z97.number().optional()
2124
2239
  });
2125
2240
  expectTypesMatch(true);
@@ -2217,8 +2332,8 @@ var getRotationBetweenPcbPin1Locations = (from, to) => {
2217
2332
  return null;
2218
2333
  };
2219
2334
  var pcb_route_hint = z100.object({
2220
- x: distance,
2221
- y: distance,
2335
+ x: distance2,
2336
+ y: distance2,
2222
2337
  via: z100.boolean().optional(),
2223
2338
  via_to_layer: layer_ref.optional()
2224
2339
  });
@@ -2226,11 +2341,11 @@ var pcb_route_hints = z100.array(pcb_route_hint);
2226
2341
  expectTypesMatch(true);
2227
2342
  expectTypesMatch(true);
2228
2343
  var route_hint_point = z101.object({
2229
- x: distance,
2230
- y: distance,
2344
+ x: distance2,
2345
+ y: distance2,
2231
2346
  via: z101.boolean().optional(),
2232
2347
  to_layer: layer_ref.optional(),
2233
- trace_width: distance.optional()
2348
+ trace_width: distance2.optional()
2234
2349
  });
2235
2350
  expectTypesMatch(true);
2236
2351
  var manufacturing_drc_properties = z102.object({
@@ -2325,8 +2440,8 @@ var pcb_hole_circle = z105.object({
2325
2440
  pcb_component_id: z105.string().optional(),
2326
2441
  hole_shape: z105.literal("circle"),
2327
2442
  hole_diameter: z105.number(),
2328
- x: distance,
2329
- y: distance,
2443
+ x: distance2,
2444
+ y: distance2,
2330
2445
  is_covered_with_solder_mask: z105.boolean().optional(),
2331
2446
  soldermask_margin: z105.number().optional()
2332
2447
  });
@@ -2343,8 +2458,8 @@ var pcb_hole_rect = z105.object({
2343
2458
  hole_shape: z105.literal("rect"),
2344
2459
  hole_width: z105.number(),
2345
2460
  hole_height: z105.number(),
2346
- x: distance,
2347
- y: distance,
2461
+ x: distance2,
2462
+ y: distance2,
2348
2463
  is_covered_with_solder_mask: z105.boolean().optional(),
2349
2464
  soldermask_margin: z105.number().optional()
2350
2465
  });
@@ -2360,8 +2475,8 @@ var pcb_hole_circle_or_square = z105.object({
2360
2475
  pcb_component_id: z105.string().optional(),
2361
2476
  hole_shape: z105.enum(["circle", "square"]),
2362
2477
  hole_diameter: z105.number(),
2363
- x: distance,
2364
- y: distance,
2478
+ x: distance2,
2479
+ y: distance2,
2365
2480
  is_covered_with_solder_mask: z105.boolean().optional(),
2366
2481
  soldermask_margin: z105.number().optional()
2367
2482
  });
@@ -2378,8 +2493,8 @@ var pcb_hole_oval = z105.object({
2378
2493
  hole_shape: z105.literal("oval"),
2379
2494
  hole_width: z105.number(),
2380
2495
  hole_height: z105.number(),
2381
- x: distance,
2382
- y: distance,
2496
+ x: distance2,
2497
+ y: distance2,
2383
2498
  is_covered_with_solder_mask: z105.boolean().optional(),
2384
2499
  soldermask_margin: z105.number().optional()
2385
2500
  });
@@ -2396,8 +2511,8 @@ var pcb_hole_pill = z105.object({
2396
2511
  hole_shape: z105.literal("pill"),
2397
2512
  hole_width: z105.number(),
2398
2513
  hole_height: z105.number(),
2399
- x: distance,
2400
- y: distance,
2514
+ x: distance2,
2515
+ y: distance2,
2401
2516
  is_covered_with_solder_mask: z105.boolean().optional(),
2402
2517
  soldermask_margin: z105.number().optional()
2403
2518
  });
@@ -2414,8 +2529,8 @@ var pcb_hole_rotated_pill = z105.object({
2414
2529
  hole_shape: z105.literal("rotated_pill"),
2415
2530
  hole_width: z105.number(),
2416
2531
  hole_height: z105.number(),
2417
- x: distance,
2418
- y: distance,
2532
+ x: distance2,
2533
+ y: distance2,
2419
2534
  ccw_rotation: rotation,
2420
2535
  is_covered_with_solder_mask: z105.boolean().optional(),
2421
2536
  soldermask_margin: z105.number().optional()
@@ -2433,8 +2548,8 @@ var pcb_plated_hole_circle = z106.object({
2433
2548
  outer_diameter: z106.number(),
2434
2549
  hole_diameter: z106.number(),
2435
2550
  is_covered_with_solder_mask: z106.boolean().optional(),
2436
- x: distance,
2437
- y: distance,
2551
+ x: distance2,
2552
+ y: distance2,
2438
2553
  layers: z106.array(layer_ref),
2439
2554
  port_hints: z106.array(z106.string()).optional(),
2440
2555
  pcb_component_id: z106.string().optional(),
@@ -2452,8 +2567,8 @@ var pcb_plated_hole_oval = z106.object({
2452
2567
  hole_width: z106.number(),
2453
2568
  hole_height: z106.number(),
2454
2569
  is_covered_with_solder_mask: z106.boolean().optional(),
2455
- x: distance,
2456
- y: distance,
2570
+ x: distance2,
2571
+ y: distance2,
2457
2572
  ccw_rotation: rotation,
2458
2573
  layers: z106.array(layer_ref),
2459
2574
  port_hints: z106.array(z106.string()).optional(),
@@ -2473,11 +2588,11 @@ var pcb_circular_hole_with_rect_pad = z106.object({
2473
2588
  rect_pad_width: z106.number(),
2474
2589
  rect_pad_height: z106.number(),
2475
2590
  rect_border_radius: z106.number().optional(),
2476
- hole_offset_x: distance.default(0),
2477
- hole_offset_y: distance.default(0),
2591
+ hole_offset_x: distance2.default(0),
2592
+ hole_offset_y: distance2.default(0),
2478
2593
  is_covered_with_solder_mask: z106.boolean().optional(),
2479
- x: distance,
2480
- y: distance,
2594
+ x: distance2,
2595
+ y: distance2,
2481
2596
  layers: z106.array(layer_ref),
2482
2597
  port_hints: z106.array(z106.string()).optional(),
2483
2598
  pcb_component_id: z106.string().optional(),
@@ -2498,11 +2613,11 @@ var pcb_pill_hole_with_rect_pad = z106.object({
2498
2613
  rect_pad_width: z106.number(),
2499
2614
  rect_pad_height: z106.number(),
2500
2615
  rect_border_radius: z106.number().optional(),
2501
- hole_offset_x: distance.default(0),
2502
- hole_offset_y: distance.default(0),
2616
+ hole_offset_x: distance2.default(0),
2617
+ hole_offset_y: distance2.default(0),
2503
2618
  is_covered_with_solder_mask: z106.boolean().optional(),
2504
- x: distance,
2505
- y: distance,
2619
+ x: distance2,
2620
+ y: distance2,
2506
2621
  layers: z106.array(layer_ref),
2507
2622
  port_hints: z106.array(z106.string()).optional(),
2508
2623
  pcb_component_id: z106.string().optional(),
@@ -2524,11 +2639,11 @@ var pcb_rotated_pill_hole_with_rect_pad = z106.object({
2524
2639
  rect_pad_height: z106.number(),
2525
2640
  rect_border_radius: z106.number().optional(),
2526
2641
  rect_ccw_rotation: rotation,
2527
- hole_offset_x: distance.default(0),
2528
- hole_offset_y: distance.default(0),
2642
+ hole_offset_x: distance2.default(0),
2643
+ hole_offset_y: distance2.default(0),
2529
2644
  is_covered_with_solder_mask: z106.boolean().optional(),
2530
- x: distance,
2531
- y: distance,
2645
+ x: distance2,
2646
+ y: distance2,
2532
2647
  layers: z106.array(layer_ref),
2533
2648
  port_hints: z106.array(z106.string()).optional(),
2534
2649
  pcb_component_id: z106.string().optional(),
@@ -2547,15 +2662,15 @@ var pcb_hole_with_polygon_pad = z106.object({
2547
2662
  hole_height: z106.number().optional(),
2548
2663
  pad_outline: z106.array(
2549
2664
  z106.object({
2550
- x: distance,
2551
- y: distance
2665
+ x: distance2,
2666
+ y: distance2
2552
2667
  })
2553
2668
  ).min(3),
2554
- hole_offset_x: distance.default(0),
2555
- hole_offset_y: distance.default(0),
2669
+ hole_offset_x: distance2.default(0),
2670
+ hole_offset_y: distance2.default(0),
2556
2671
  is_covered_with_solder_mask: z106.boolean().optional(),
2557
- x: distance,
2558
- y: distance,
2672
+ x: distance2,
2673
+ y: distance2,
2559
2674
  layers: z106.array(layer_ref),
2560
2675
  port_hints: z106.array(z106.string()).optional(),
2561
2676
  pcb_component_id: z106.string().optional(),
@@ -2587,8 +2702,8 @@ var pcb_port = z107.object({
2587
2702
  subcircuit_id: z107.string().optional(),
2588
2703
  source_port_id: z107.string(),
2589
2704
  pcb_component_id: z107.string().optional(),
2590
- x: distance,
2591
- y: distance,
2705
+ x: distance2,
2706
+ y: distance2,
2592
2707
  layers: z107.array(layer_ref),
2593
2708
  is_board_pinout: z107.boolean().optional()
2594
2709
  }).describe("Defines a port on the PCB");
@@ -2599,8 +2714,8 @@ var pcb_smtpad_circle = z108.object({
2599
2714
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
2600
2715
  pcb_group_id: z108.string().optional(),
2601
2716
  subcircuit_id: z108.string().optional(),
2602
- x: distance,
2603
- y: distance,
2717
+ x: distance2,
2718
+ y: distance2,
2604
2719
  radius: z108.number(),
2605
2720
  layer: layer_ref,
2606
2721
  port_hints: z108.array(z108.string()).optional(),
@@ -2616,8 +2731,8 @@ var pcb_smtpad_rect = z108.object({
2616
2731
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
2617
2732
  pcb_group_id: z108.string().optional(),
2618
2733
  subcircuit_id: z108.string().optional(),
2619
- x: distance,
2620
- y: distance,
2734
+ x: distance2,
2735
+ y: distance2,
2621
2736
  width: z108.number(),
2622
2737
  height: z108.number(),
2623
2738
  rect_border_radius: z108.number().optional(),
@@ -2640,8 +2755,8 @@ var pcb_smtpad_rotated_rect = z108.object({
2640
2755
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
2641
2756
  pcb_group_id: z108.string().optional(),
2642
2757
  subcircuit_id: z108.string().optional(),
2643
- x: distance,
2644
- y: distance,
2758
+ x: distance2,
2759
+ y: distance2,
2645
2760
  width: z108.number(),
2646
2761
  height: z108.number(),
2647
2762
  rect_border_radius: z108.number().optional(),
@@ -2665,8 +2780,8 @@ var pcb_smtpad_pill = z108.object({
2665
2780
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
2666
2781
  pcb_group_id: z108.string().optional(),
2667
2782
  subcircuit_id: z108.string().optional(),
2668
- x: distance,
2669
- y: distance,
2783
+ x: distance2,
2784
+ y: distance2,
2670
2785
  width: z108.number(),
2671
2786
  height: z108.number(),
2672
2787
  radius: z108.number(),
@@ -2684,8 +2799,8 @@ var pcb_smtpad_rotated_pill = z108.object({
2684
2799
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
2685
2800
  pcb_group_id: z108.string().optional(),
2686
2801
  subcircuit_id: z108.string().optional(),
2687
- x: distance,
2688
- y: distance,
2802
+ x: distance2,
2803
+ y: distance2,
2689
2804
  width: z108.number(),
2690
2805
  height: z108.number(),
2691
2806
  radius: z108.number(),
@@ -2733,8 +2848,8 @@ var pcb_solder_paste_circle = z109.object({
2733
2848
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
2734
2849
  pcb_group_id: z109.string().optional(),
2735
2850
  subcircuit_id: z109.string().optional(),
2736
- x: distance,
2737
- y: distance,
2851
+ x: distance2,
2852
+ y: distance2,
2738
2853
  radius: z109.number(),
2739
2854
  layer: layer_ref,
2740
2855
  pcb_component_id: z109.string().optional(),
@@ -2746,8 +2861,8 @@ var pcb_solder_paste_rect = z109.object({
2746
2861
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
2747
2862
  pcb_group_id: z109.string().optional(),
2748
2863
  subcircuit_id: z109.string().optional(),
2749
- x: distance,
2750
- y: distance,
2864
+ x: distance2,
2865
+ y: distance2,
2751
2866
  width: z109.number(),
2752
2867
  height: z109.number(),
2753
2868
  layer: layer_ref,
@@ -2760,8 +2875,8 @@ var pcb_solder_paste_pill = z109.object({
2760
2875
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
2761
2876
  pcb_group_id: z109.string().optional(),
2762
2877
  subcircuit_id: z109.string().optional(),
2763
- x: distance,
2764
- y: distance,
2878
+ x: distance2,
2879
+ y: distance2,
2765
2880
  width: z109.number(),
2766
2881
  height: z109.number(),
2767
2882
  radius: z109.number(),
@@ -2775,11 +2890,11 @@ var pcb_solder_paste_rotated_rect = z109.object({
2775
2890
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
2776
2891
  pcb_group_id: z109.string().optional(),
2777
2892
  subcircuit_id: z109.string().optional(),
2778
- x: distance,
2779
- y: distance,
2893
+ x: distance2,
2894
+ y: distance2,
2780
2895
  width: z109.number(),
2781
2896
  height: z109.number(),
2782
- ccw_rotation: distance,
2897
+ ccw_rotation: distance2,
2783
2898
  layer: layer_ref,
2784
2899
  pcb_component_id: z109.string().optional(),
2785
2900
  pcb_smtpad_id: z109.string().optional()
@@ -2790,8 +2905,8 @@ var pcb_solder_paste_rotated_pill = z109.object({
2790
2905
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
2791
2906
  pcb_group_id: z109.string().optional(),
2792
2907
  subcircuit_id: z109.string().optional(),
2793
- x: distance,
2794
- y: distance,
2908
+ x: distance2,
2909
+ y: distance2,
2795
2910
  width: z109.number(),
2796
2911
  height: z109.number(),
2797
2912
  radius: z109.number(),
@@ -2806,8 +2921,8 @@ var pcb_solder_paste_oval = z109.object({
2806
2921
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
2807
2922
  pcb_group_id: z109.string().optional(),
2808
2923
  subcircuit_id: z109.string().optional(),
2809
- x: distance,
2810
- y: distance,
2924
+ x: distance2,
2925
+ y: distance2,
2811
2926
  width: z109.number(),
2812
2927
  height: z109.number(),
2813
2928
  layer: layer_ref,
@@ -2849,9 +2964,9 @@ var pcb_text = z110.object({
2849
2964
  expectTypesMatch(true);
2850
2965
  var pcb_trace_route_point_wire = z111.object({
2851
2966
  route_type: z111.literal("wire"),
2852
- x: distance,
2853
- y: distance,
2854
- width: distance,
2967
+ x: distance2,
2968
+ y: distance2,
2969
+ width: distance2,
2855
2970
  copper_pour_id: z111.string().optional(),
2856
2971
  is_inside_copper_pour: z111.boolean().optional(),
2857
2972
  start_pcb_port_id: z111.string().optional(),
@@ -2860,12 +2975,12 @@ var pcb_trace_route_point_wire = z111.object({
2860
2975
  });
2861
2976
  var pcb_trace_route_point_via = z111.object({
2862
2977
  route_type: z111.literal("via"),
2863
- x: distance,
2864
- y: distance,
2978
+ x: distance2,
2979
+ y: distance2,
2865
2980
  copper_pour_id: z111.string().optional(),
2866
2981
  is_inside_copper_pour: z111.boolean().optional(),
2867
- hole_diameter: distance.optional(),
2868
- outer_diameter: distance.optional(),
2982
+ hole_diameter: distance2.optional(),
2983
+ outer_diameter: distance2.optional(),
2869
2984
  from_layer: layer_ref,
2870
2985
  to_layer: layer_ref
2871
2986
  });
@@ -2873,7 +2988,7 @@ var pcb_trace_route_point_through_pad = z111.object({
2873
2988
  route_type: z111.literal("through_pad"),
2874
2989
  start: point,
2875
2990
  end: point,
2876
- width: distance,
2991
+ width: distance2,
2877
2992
  start_layer: layer_ref,
2878
2993
  end_layer: layer_ref,
2879
2994
  pcb_smtpad_id: z111.string().optional(),
@@ -2923,8 +3038,8 @@ var pcb_trace_too_long_warning = z113.object({
2923
3038
  pcb_trace_id: z113.string(),
2924
3039
  source_net_id: z113.string().optional(),
2925
3040
  source_trace_id: z113.string().optional(),
2926
- actual_trace_length: distance,
2927
- maximum_trace_length: distance,
3041
+ actual_trace_length: distance2,
3042
+ maximum_trace_length: distance2,
2928
3043
  subcircuit_id: z113.string().optional()
2929
3044
  }).describe(
2930
3045
  "Warning emitted when a PCB trace is longer than its maximum allowed length"
@@ -3008,10 +3123,10 @@ var pcb_via = z120.object({
3008
3123
  pcb_group_id: z120.string().optional(),
3009
3124
  subcircuit_id: z120.string().optional(),
3010
3125
  subcircuit_connectivity_map_key: z120.string().optional(),
3011
- x: distance,
3012
- y: distance,
3013
- outer_diameter: distance.default("0.6mm"),
3014
- hole_diameter: distance.default("0.25mm"),
3126
+ x: distance2,
3127
+ y: distance2,
3128
+ outer_diameter: distance2.default("0.6mm"),
3129
+ hole_diameter: distance2.default("0.25mm"),
3015
3130
  /** @deprecated */
3016
3131
  from_layer: layer_ref.optional(),
3017
3132
  /** @deprecated */
@@ -3109,11 +3224,11 @@ var pcb_silkscreen_line = z127.object({
3109
3224
  pcb_component_id: z127.string(),
3110
3225
  pcb_group_id: z127.string().optional(),
3111
3226
  subcircuit_id: z127.string().optional(),
3112
- stroke_width: distance.default("0.1mm"),
3113
- x1: distance,
3114
- y1: distance,
3115
- x2: distance,
3116
- y2: distance,
3227
+ stroke_width: distance2.default("0.1mm"),
3228
+ x1: distance2,
3229
+ y1: distance2,
3230
+ x2: distance2,
3231
+ y2: distance2,
3117
3232
  layer: visible_layer
3118
3233
  }).describe("Defines a silkscreen line on the PCB");
3119
3234
  expectTypesMatch(true);
@@ -3134,7 +3249,7 @@ var pcb_silkscreen_text = z129.object({
3134
3249
  pcb_group_id: z129.string().optional(),
3135
3250
  subcircuit_id: z129.string().optional(),
3136
3251
  font: z129.literal("tscircuit2024").default("tscircuit2024"),
3137
- font_size: distance.default("0.2mm"),
3252
+ font_size: distance2.default("0.2mm"),
3138
3253
  pcb_component_id: z129.string(),
3139
3254
  text: z129.string(),
3140
3255
  is_knockout: z129.boolean().default(false).optional(),
@@ -3162,7 +3277,7 @@ var pcb_copper_text = z130.object({
3162
3277
  pcb_group_id: z130.string().optional(),
3163
3278
  subcircuit_id: z130.string().optional(),
3164
3279
  font: z130.literal("tscircuit2024").default("tscircuit2024"),
3165
- font_size: distance.default("0.2mm"),
3280
+ font_size: distance2.default("0.2mm"),
3166
3281
  pcb_component_id: z130.string(),
3167
3282
  text: z130.string(),
3168
3283
  is_knockout: z130.boolean().default(false).optional(),
@@ -3224,8 +3339,8 @@ var pcb_silkscreen_oval = z133.object({
3224
3339
  pcb_group_id: z133.string().optional(),
3225
3340
  subcircuit_id: z133.string().optional(),
3226
3341
  center: point,
3227
- radius_x: distance,
3228
- radius_y: distance,
3342
+ radius_x: distance2,
3343
+ radius_y: distance2,
3229
3344
  layer: visible_layer,
3230
3345
  ccw_rotation: rotation.optional()
3231
3346
  }).describe("Defines a silkscreen oval on the PCB");
@@ -3271,7 +3386,7 @@ var pcb_fabrication_note_text = z136.object({
3271
3386
  subcircuit_id: z136.string().optional(),
3272
3387
  pcb_group_id: z136.string().optional(),
3273
3388
  font: z136.literal("tscircuit2024").default("tscircuit2024"),
3274
- font_size: distance.default("1mm"),
3389
+ font_size: distance2.default("1mm"),
3275
3390
  pcb_component_id: z136.string(),
3276
3391
  text: z136.string(),
3277
3392
  ccw_rotation: z136.number().optional(),
@@ -3351,7 +3466,7 @@ var pcb_note_text = z140.object({
3351
3466
  subcircuit_id: z140.string().optional(),
3352
3467
  name: z140.string().optional(),
3353
3468
  font: z140.literal("tscircuit2024").default("tscircuit2024"),
3354
- font_size: distance.default("1mm"),
3469
+ font_size: distance2.default("1mm"),
3355
3470
  text: z140.string().optional(),
3356
3471
  anchor_position: point.default({ x: 0, y: 0 }),
3357
3472
  anchor_alignment: z140.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
@@ -3402,12 +3517,12 @@ var pcb_note_line = z143.object({
3402
3517
  subcircuit_id: z143.string().optional(),
3403
3518
  name: z143.string().optional(),
3404
3519
  text: z143.string().optional(),
3405
- x1: distance,
3406
- y1: distance,
3407
- x2: distance,
3408
- y2: distance,
3520
+ x1: distance2,
3521
+ y1: distance2,
3522
+ x2: distance2,
3523
+ y2: distance2,
3409
3524
  layer: visible_layer.default("top"),
3410
- stroke_width: distance.default("0.1mm"),
3525
+ stroke_width: distance2.default("0.1mm"),
3411
3526
  color: z143.string().optional(),
3412
3527
  is_dashed: z143.boolean().optional()
3413
3528
  }).describe("Defines a straight documentation note line on the PCB");
@@ -3464,8 +3579,8 @@ var pcb_keepout = z147.object({
3464
3579
  pcb_group_id: z147.string().optional(),
3465
3580
  subcircuit_id: z147.string().optional(),
3466
3581
  center: point,
3467
- width: distance,
3468
- height: distance,
3582
+ width: distance2,
3583
+ height: distance2,
3469
3584
  pcb_keepout_id: z147.string(),
3470
3585
  layers: z147.array(z147.string()),
3471
3586
  // Specify layers where the keepout applies
@@ -3479,7 +3594,7 @@ var pcb_keepout = z147.object({
3479
3594
  pcb_group_id: z147.string().optional(),
3480
3595
  subcircuit_id: z147.string().optional(),
3481
3596
  center: point,
3482
- radius: distance,
3597
+ radius: distance2,
3483
3598
  pcb_keepout_id: z147.string(),
3484
3599
  layers: z147.array(z147.string()),
3485
3600
  // Specify layers where the keepout applies
@@ -3684,8 +3799,8 @@ var pcb_breakout_point = z158.object({
3684
3799
  source_port_id: z158.string().optional(),
3685
3800
  source_net_id: z158.string().optional(),
3686
3801
  layer: layer_ref.optional(),
3687
- x: distance,
3688
- y: distance
3802
+ x: distance2,
3803
+ y: distance2
3689
3804
  }).describe(
3690
3805
  "Defines a routing target within a pcb_group for a source_trace or source_net"
3691
3806
  );
@@ -3717,9 +3832,9 @@ var pcb_thermal_spoke = z161.object({
3717
3832
  pcb_ground_plane_id: z161.string(),
3718
3833
  shape: z161.string(),
3719
3834
  spoke_count: z161.number(),
3720
- spoke_thickness: distance,
3721
- spoke_inner_diameter: distance,
3722
- spoke_outer_diameter: distance,
3835
+ spoke_thickness: distance2,
3836
+ spoke_inner_diameter: distance2,
3837
+ spoke_outer_diameter: distance2,
3723
3838
  pcb_plated_hole_id: z161.string().optional(),
3724
3839
  subcircuit_id: z161.string().optional()
3725
3840
  }).describe("Pattern for connecting a ground plane to a plated hole");
@@ -3813,8 +3928,8 @@ var pcb_via_clearance_error = base_circuit_json_error.extend({
3813
3928
  pcb_error_id: getZodPrefixedIdWithDefault("pcb_error"),
3814
3929
  error_type: z166.literal("pcb_via_clearance_error").default("pcb_via_clearance_error"),
3815
3930
  pcb_via_ids: z166.array(z166.string()).min(2),
3816
- minimum_clearance: distance.optional(),
3817
- actual_clearance: distance.optional(),
3931
+ minimum_clearance: distance2.optional(),
3932
+ actual_clearance: distance2.optional(),
3818
3933
  pcb_center: z166.object({
3819
3934
  x: z166.number().optional(),
3820
3935
  y: z166.number().optional()
@@ -3830,8 +3945,8 @@ var pcb_via_trace_clearance_error = base_circuit_json_error.extend({
3830
3945
  error_type: z167.literal("pcb_via_trace_clearance_error").default("pcb_via_trace_clearance_error"),
3831
3946
  pcb_via_id: z167.string(),
3832
3947
  pcb_trace_id: z167.string(),
3833
- minimum_clearance: distance.optional(),
3834
- actual_clearance: distance.optional(),
3948
+ minimum_clearance: distance2.optional(),
3949
+ actual_clearance: distance2.optional(),
3835
3950
  center: z167.object({
3836
3951
  x: z167.number().optional(),
3837
3952
  y: z167.number().optional()
@@ -3850,8 +3965,8 @@ var pcb_pad_pad_clearance_error = base_circuit_json_error.extend({
3850
3965
  ),
3851
3966
  error_type: z168.literal("pcb_pad_pad_clearance_error").default("pcb_pad_pad_clearance_error"),
3852
3967
  pcb_pad_ids: z168.array(z168.string()).min(2),
3853
- minimum_clearance: distance.optional(),
3854
- actual_clearance: distance.optional(),
3968
+ minimum_clearance: distance2.optional(),
3969
+ actual_clearance: distance2.optional(),
3855
3970
  center: z168.object({
3856
3971
  x: z168.number().optional(),
3857
3972
  y: z168.number().optional()
@@ -3867,8 +3982,8 @@ var pcb_pad_trace_clearance_error = base_circuit_json_error.extend({
3867
3982
  error_type: z169.literal("pcb_pad_trace_clearance_error").default("pcb_pad_trace_clearance_error"),
3868
3983
  pcb_pad_id: z169.string(),
3869
3984
  pcb_trace_id: z169.string(),
3870
- minimum_clearance: distance.optional(),
3871
- actual_clearance: distance.optional(),
3985
+ minimum_clearance: distance2.optional(),
3986
+ actual_clearance: distance2.optional(),
3872
3987
  center: z169.object({
3873
3988
  x: z169.number().optional(),
3874
3989
  y: z169.number().optional()
@@ -6553,52 +6668,6 @@ var isLedCategoryComponent = (betterEasy) => {
6553
6668
  ].some(categoryValueContainsLed);
6554
6669
  };
6555
6670
 
6556
- // node_modules/@tscircuit/math-utils/dist/chunk-EFLPMB4J.js
6557
- function distance2(p1, p2) {
6558
- const dx = p1.x - p2.x;
6559
- const dy = p1.y - p2.y;
6560
- return Math.sqrt(dx * dx + dy * dy);
6561
- }
6562
-
6563
- // node_modules/@tscircuit/math-utils/dist/chunk-GIGMPRPV.js
6564
- var getUnitVectorFromDirection = (direction) => {
6565
- switch (direction) {
6566
- case "up":
6567
- return { x: 0, y: 1 };
6568
- case "down":
6569
- return { x: 0, y: -1 };
6570
- case "left":
6571
- return { x: -1, y: 0 };
6572
- case "right":
6573
- return { x: 1, y: 0 };
6574
- }
6575
- };
6576
-
6577
- // node_modules/@tscircuit/math-utils/dist/chunk-3WCUPG5S.js
6578
- var getBoundsCenter = (bounds) => ({
6579
- x: (bounds.minX + bounds.maxX) / 2,
6580
- y: (bounds.minY + bounds.maxY) / 2
6581
- });
6582
-
6583
- // node_modules/@tscircuit/math-utils/dist/chunk-5N7UJNVK.js
6584
- var getBoundsFromPoints = (points) => {
6585
- if (points.length === 0) {
6586
- return null;
6587
- }
6588
- let minX = points[0].x;
6589
- let minY = points[0].y;
6590
- let maxX = points[0].x;
6591
- let maxY = points[0].y;
6592
- for (let i = 1; i < points.length; i++) {
6593
- const point2 = points[i];
6594
- if (point2.x < minX) minX = point2.x;
6595
- if (point2.y < minY) minY = point2.y;
6596
- if (point2.x > maxX) maxX = point2.x;
6597
- if (point2.y > maxY) maxY = point2.y;
6598
- }
6599
- return { minX, minY, maxX, maxY };
6600
- };
6601
-
6602
6671
  // lib/websafe/get-easyeda-cad-placement-helpers.ts
6603
6672
  var getCadSvgNode = (easyEdaJson) => {
6604
6673
  const svgNode = easyEdaJson.packageDetail.dataStr.shape.find(
@@ -7191,6 +7260,19 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
7191
7260
  ).forEach((sr, index) => {
7192
7261
  circuitElements.push(handleCutout(sr, index));
7193
7262
  });
7263
+ const boardOutlineTracks = easyEdaJson.packageDetail.dataStr.shape.filter(
7264
+ (shape) => shape.type === "TRACK" && shape.layer === 10
7265
+ );
7266
+ getBoardOutlinePolygons(boardOutlineTracks).forEach((points, index) => {
7267
+ circuitElements.push(
7268
+ pcb_cutout.parse({
7269
+ type: "pcb_cutout",
7270
+ pcb_cutout_id: `pcb_cutout_outline_${index + 1}`,
7271
+ shape: "polygon",
7272
+ points: points.map((p) => ({ x: milx10(p.x), y: milx10(p.y) }))
7273
+ })
7274
+ );
7275
+ });
7194
7276
  let hasFoundDesignator = false;
7195
7277
  const silkscreenTracks = easyEdaJson.packageDetail.dataStr.shape.filter(
7196
7278
  (shape) => shape.type === "TRACK" && isSilkscreenLayer(shape.layer)
@@ -8763,7 +8845,7 @@ var alignPortToDrawing = ({
8763
8845
  const alignmentTolerance = Math.max(0.02, stemLength * 0.25);
8764
8846
  const nearestEndpoint = drawingEndpoints.map((endpoint) => ({
8765
8847
  endpoint,
8766
- distance: distance2(endpoint, expectedBodyConnection)
8848
+ distance: distance(endpoint, expectedBodyConnection)
8767
8849
  })).filter((candidate) => candidate.distance <= alignmentTolerance).sort((a, b) => a.distance - b.distance)[0]?.endpoint;
8768
8850
  if (!nearestEndpoint) return position2;
8769
8851
  return {
@@ -8987,6 +9069,13 @@ var generateFootprintTsx = (circuitJson, options = {}) => {
8987
9069
  const pcbNoteDimensions = su(circuitJson).pcb_note_dimension.list();
8988
9070
  const courtyardOutlines = su(circuitJson).pcb_courtyard_outline.list();
8989
9071
  const elementStrings = [];
9072
+ for (const cutout of su(circuitJson).pcb_cutout.list()) {
9073
+ if (cutout.shape === "polygon") {
9074
+ elementStrings.push(
9075
+ `<cutout shape="polygon" points={${JSON.stringify(cutout.points)}} />`
9076
+ );
9077
+ }
9078
+ }
8990
9079
  for (const hole of holes) {
8991
9080
  if (hole.hole_shape === "circle") {
8992
9081
  elementStrings.push(