@tscircuit/cli 0.1.1533 → 0.1.1535

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/cli/main.js CHANGED
@@ -34840,16 +34840,16 @@ function segmentsDistance(a12, a2, b12, b22) {
34840
34840
  function pointToSegmentDistance(p, v3, w3) {
34841
34841
  const l22 = (w3.x - v3.x) ** 2 + (w3.y - v3.y) ** 2;
34842
34842
  if (l22 === 0)
34843
- return distance2(p, v3);
34843
+ return distance22(p, v3);
34844
34844
  let t = ((p.x - v3.x) * (w3.x - v3.x) + (p.y - v3.y) * (w3.y - v3.y)) / l22;
34845
34845
  t = Math.max(0, Math.min(1, t));
34846
34846
  const projection = {
34847
34847
  x: v3.x + t * (w3.x - v3.x),
34848
34848
  y: v3.y + t * (w3.y - v3.y)
34849
34849
  };
34850
- return distance2(p, projection);
34850
+ return distance22(p, projection);
34851
34851
  }
34852
- function distance2(p12, p22) {
34852
+ function distance22(p12, p22) {
34853
34853
  const dx2 = p12.x - p22.x;
34854
34854
  const dy2 = p12.y - p22.y;
34855
34855
  return Math.sqrt(dx2 * dx2 + dy2 * dy2);
@@ -35787,7 +35787,7 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
35787
35787
  }
35788
35788
  }, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, instanceOfType = (cls, params2 = {
35789
35789
  message: `Input not instance of ${cls.name}`
35790
- }) => custom((data) => data instanceof cls, params2), stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType, ostring = () => stringType().optional(), onumber = () => numberType().optional(), oboolean = () => booleanType().optional(), coerce, NEVER, unitMappings, unitMappingAndVariantSuffixes, si_prefix_multiplier, resistance, capacitance, inductance, voltage, length, frequency, distance, current, duration_ms, time, ms, timestamp, rotation, battery_capacity, expectTypesMatch = (shouldBe) => {}, expectStringUnionsMatch = (shouldBe) => {}, point, position, point3, position3, size, randomId = (length4) => {
35790
+ }) => custom((data) => data instanceof cls, params2), stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType, ostring = () => stringType().optional(), onumber = () => numberType().optional(), oboolean = () => booleanType().optional(), coerce, NEVER, unitMappings, unitMappingAndVariantSuffixes, si_prefix_multiplier, resistance, capacitance, inductance, voltage, length, frequency, distance2, current, duration_ms, time, ms, timestamp, rotation, battery_capacity, expectTypesMatch = (shouldBe) => {}, expectStringUnionsMatch = (shouldBe) => {}, point, position, point3, position3, size, randomId = (length4) => {
35791
35791
  const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
35792
35792
  return Array.from({ length: length4 }, () => chars[Math.floor(Math.random() * chars.length)]).join("");
35793
35793
  }, getZodPrefixedIdWithDefault = (prefix) => {
@@ -39272,7 +39272,7 @@ var init_chunk_SK323GHE = __esm(() => {
39272
39272
  capacitance: () => capacitance,
39273
39273
  circuit_json_footprint_load_error: () => circuit_json_footprint_load_error,
39274
39274
  current: () => current,
39275
- distance: () => distance,
39275
+ distance: () => distance2,
39276
39276
  duration_ms: () => duration_ms,
39277
39277
  experiment_type: () => experiment_type,
39278
39278
  external_footprint_load_error: () => external_footprint_load_error,
@@ -42749,7 +42749,7 @@ var init_chunk_SK323GHE = __esm(() => {
42749
42749
  voltage = external_exports.string().or(external_exports.number()).transform((v3) => parseAndConvertSiUnit(v3).value);
42750
42750
  length = external_exports.string().or(external_exports.number()).transform((v3) => parseAndConvertSiUnit(v3).value);
42751
42751
  frequency = external_exports.string().or(external_exports.number()).transform((v3) => parseAndConvertSiUnit(v3).value);
42752
- distance = length;
42752
+ distance2 = length;
42753
42753
  current = external_exports.string().or(external_exports.number()).transform((v3) => parseAndConvertSiUnit(v3).value);
42754
42754
  duration_ms = external_exports.string().or(external_exports.number()).transform((v3) => parseAndConvertSiUnit(v3).value);
42755
42755
  time = duration_ms;
@@ -42788,16 +42788,16 @@ var init_chunk_SK323GHE = __esm(() => {
42788
42788
  expectStringUnionsMatch('T1 has extra: "d", T2 has extra: "c"');
42789
42789
  expectStringUnionsMatch(true);
42790
42790
  point = external_exports.object({
42791
- x: distance,
42792
- y: distance
42791
+ x: distance2,
42792
+ y: distance2
42793
42793
  });
42794
42794
  position = point;
42795
42795
  expectTypesMatch(true);
42796
42796
  expectTypesMatch(true);
42797
42797
  point3 = external_exports.object({
42798
- x: distance,
42799
- y: distance,
42800
- z: distance
42798
+ x: distance2,
42799
+ y: distance2,
42800
+ z: distance2
42801
42801
  });
42802
42802
  position3 = point3;
42803
42803
  expectTypesMatch(true);
@@ -42853,7 +42853,7 @@ var init_chunk_SK323GHE = __esm(() => {
42853
42853
  expectTypesMatch(true);
42854
42854
  kicadFont = external_exports.object({
42855
42855
  size: point.optional(),
42856
- thickness: distance.optional()
42856
+ thickness: distance2.optional()
42857
42857
  });
42858
42858
  expectTypesMatch(true);
42859
42859
  kicadEffects = external_exports.object({
@@ -42889,7 +42889,7 @@ var init_chunk_SK323GHE = __esm(() => {
42889
42889
  shape: external_exports.string().optional(),
42890
42890
  at: kicadAt.optional(),
42891
42891
  size: point.optional(),
42892
- drill: distance.optional(),
42892
+ drill: distance2.optional(),
42893
42893
  layers: external_exports.array(external_exports.string()).optional(),
42894
42894
  removeUnusedLayers: external_exports.boolean().optional(),
42895
42895
  uuid: external_exports.string().optional()
@@ -42920,7 +42920,7 @@ var init_chunk_SK323GHE = __esm(() => {
42920
42920
  });
42921
42921
  expectTypesMatch(true);
42922
42922
  kicadSymbolPinNames = external_exports.object({
42923
- offset: distance.optional(),
42923
+ offset: distance2.optional(),
42924
42924
  hide: external_exports.boolean().optional()
42925
42925
  });
42926
42926
  expectTypesMatch(true);
@@ -42994,7 +42994,7 @@ var init_chunk_SK323GHE = __esm(() => {
42994
42994
  capacitance,
42995
42995
  max_voltage_rating: voltage.optional(),
42996
42996
  display_capacitance: external_exports.string().optional(),
42997
- max_decoupling_trace_length: distance.optional()
42997
+ max_decoupling_trace_length: distance2.optional()
42998
42998
  });
42999
42999
  expectTypesMatch(true);
43000
43000
  source_simple_resistor = source_component_base.extend({
@@ -43468,11 +43468,11 @@ var init_chunk_SK323GHE = __esm(() => {
43468
43468
  type: external_exports.literal("schematic_box"),
43469
43469
  schematic_component_id: external_exports.string().optional(),
43470
43470
  schematic_symbol_id: external_exports.string().optional(),
43471
- width: distance,
43472
- height: distance,
43471
+ width: distance2,
43472
+ height: distance2,
43473
43473
  is_dashed: external_exports.boolean().default(false),
43474
- x: distance,
43475
- y: distance,
43474
+ x: distance2,
43475
+ y: distance2,
43476
43476
  subcircuit_id: external_exports.string().optional()
43477
43477
  }).describe("Draws a box on the schematic");
43478
43478
  expectTypesMatch(true);
@@ -43483,7 +43483,7 @@ var init_chunk_SK323GHE = __esm(() => {
43483
43483
  schematic_symbol_id: external_exports.string().optional(),
43484
43484
  fill_color: external_exports.string().optional(),
43485
43485
  is_filled: external_exports.boolean().optional(),
43486
- stroke_width: distance.nullable().optional(),
43486
+ stroke_width: distance2.nullable().optional(),
43487
43487
  stroke_color: external_exports.string().optional(),
43488
43488
  points: external_exports.array(point),
43489
43489
  subcircuit_id: external_exports.string().optional()
@@ -43561,11 +43561,11 @@ var init_chunk_SK323GHE = __esm(() => {
43561
43561
  schematic_line_id: getZodPrefixedIdWithDefault("schematic_line"),
43562
43562
  schematic_component_id: external_exports.string().optional(),
43563
43563
  schematic_symbol_id: external_exports.string().optional(),
43564
- x1: distance,
43565
- y1: distance,
43566
- x2: distance,
43567
- y2: distance,
43568
- stroke_width: distance.nullable().optional(),
43564
+ x1: distance2,
43565
+ y1: distance2,
43566
+ x2: distance2,
43567
+ y2: distance2,
43568
+ stroke_width: distance2.nullable().optional(),
43569
43569
  color: external_exports.string().default("#000000"),
43570
43570
  is_dashed: external_exports.boolean().default(false),
43571
43571
  subcircuit_id: external_exports.string().optional()
@@ -43577,10 +43577,10 @@ var init_chunk_SK323GHE = __esm(() => {
43577
43577
  schematic_component_id: external_exports.string().optional(),
43578
43578
  schematic_symbol_id: external_exports.string().optional(),
43579
43579
  center: point,
43580
- width: distance,
43581
- height: distance,
43580
+ width: distance2,
43581
+ height: distance2,
43582
43582
  rotation: rotation.default(0),
43583
- stroke_width: distance.nullable().optional(),
43583
+ stroke_width: distance2.nullable().optional(),
43584
43584
  color: external_exports.string().default("#000000"),
43585
43585
  is_filled: external_exports.boolean().default(false),
43586
43586
  fill_color: external_exports.string().optional(),
@@ -43594,8 +43594,8 @@ var init_chunk_SK323GHE = __esm(() => {
43594
43594
  schematic_component_id: external_exports.string().optional(),
43595
43595
  schematic_symbol_id: external_exports.string().optional(),
43596
43596
  center: point,
43597
- radius: distance,
43598
- stroke_width: distance.nullable().optional(),
43597
+ radius: distance2,
43598
+ stroke_width: distance2.nullable().optional(),
43599
43599
  color: external_exports.string().default("#000000"),
43600
43600
  is_filled: external_exports.boolean().default(false),
43601
43601
  fill_color: external_exports.string().optional(),
@@ -43609,11 +43609,11 @@ var init_chunk_SK323GHE = __esm(() => {
43609
43609
  schematic_component_id: external_exports.string().optional(),
43610
43610
  schematic_symbol_id: external_exports.string().optional(),
43611
43611
  center: point,
43612
- radius: distance,
43612
+ radius: distance2,
43613
43613
  start_angle_degrees: rotation,
43614
43614
  end_angle_degrees: rotation,
43615
43615
  direction: external_exports.enum(["clockwise", "counterclockwise"]).default("counterclockwise"),
43616
- stroke_width: distance.nullable().optional(),
43616
+ stroke_width: distance2.nullable().optional(),
43617
43617
  color: external_exports.string().default("#000000"),
43618
43618
  is_dashed: external_exports.boolean().default(false),
43619
43619
  subcircuit_id: external_exports.string().optional()
@@ -43660,8 +43660,8 @@ var init_chunk_SK323GHE = __esm(() => {
43660
43660
  text: external_exports.string(),
43661
43661
  font_size: external_exports.number().default(0.18),
43662
43662
  position: external_exports.object({
43663
- x: distance,
43664
- y: distance
43663
+ x: distance2,
43664
+ y: distance2
43665
43665
  }),
43666
43666
  rotation: external_exports.number().default(0),
43667
43667
  anchor: external_exports.union([fivePointAnchor.describe("legacy"), ninePointAnchor]).default("center"),
@@ -43787,10 +43787,10 @@ var init_chunk_SK323GHE = __esm(() => {
43787
43787
  type: external_exports.literal("schematic_table"),
43788
43788
  schematic_table_id: getZodPrefixedIdWithDefault("schematic_table"),
43789
43789
  anchor_position: point,
43790
- column_widths: external_exports.array(distance),
43791
- row_heights: external_exports.array(distance),
43792
- cell_padding: distance.optional(),
43793
- border_width: distance.optional(),
43790
+ column_widths: external_exports.array(distance2),
43791
+ row_heights: external_exports.array(distance2),
43792
+ cell_padding: distance2.optional(),
43793
+ border_width: distance2.optional(),
43794
43794
  subcircuit_id: external_exports.string().optional(),
43795
43795
  schematic_component_id: external_exports.string().optional(),
43796
43796
  anchor: ninePointAnchor.optional()
@@ -43806,11 +43806,11 @@ var init_chunk_SK323GHE = __esm(() => {
43806
43806
  end_column_index: external_exports.number(),
43807
43807
  text: external_exports.string().optional(),
43808
43808
  center: point,
43809
- width: distance,
43810
- height: distance,
43809
+ width: distance2,
43810
+ height: distance2,
43811
43811
  horizontal_align: external_exports.enum(["left", "center", "right"]).optional(),
43812
43812
  vertical_align: external_exports.enum(["top", "middle", "bottom"]).optional(),
43813
- font_size: distance.optional(),
43813
+ font_size: distance2.optional(),
43814
43814
  subcircuit_id: external_exports.string().optional()
43815
43815
  }).describe("Defines a cell within a schematic_table");
43816
43816
  expectTypesMatch(true);
@@ -43822,8 +43822,8 @@ var init_chunk_SK323GHE = __esm(() => {
43822
43822
  }).describe("Defines a schematic sheet or page that components can be placed on");
43823
43823
  expectTypesMatch(true);
43824
43824
  point_with_bulge = external_exports.object({
43825
- x: distance,
43826
- y: distance,
43825
+ x: distance2,
43826
+ y: distance2,
43827
43827
  bulge: external_exports.number().optional()
43828
43828
  });
43829
43829
  expectTypesMatch(true);
@@ -43837,8 +43837,8 @@ var init_chunk_SK323GHE = __esm(() => {
43837
43837
  });
43838
43838
  expectTypesMatch(true);
43839
43839
  pcb_route_hint = external_exports.object({
43840
- x: distance,
43841
- y: distance,
43840
+ x: distance2,
43841
+ y: distance2,
43842
43842
  via: external_exports.boolean().optional(),
43843
43843
  via_to_layer: layer_ref.optional()
43844
43844
  });
@@ -43846,11 +43846,11 @@ var init_chunk_SK323GHE = __esm(() => {
43846
43846
  expectTypesMatch(true);
43847
43847
  expectTypesMatch(true);
43848
43848
  route_hint_point = external_exports.object({
43849
- x: distance,
43850
- y: distance,
43849
+ x: distance2,
43850
+ y: distance2,
43851
43851
  via: external_exports.boolean().optional(),
43852
43852
  to_layer: layer_ref.optional(),
43853
- trace_width: distance.optional()
43853
+ trace_width: distance2.optional()
43854
43854
  });
43855
43855
  expectTypesMatch(true);
43856
43856
  pcb_component = external_exports.object({
@@ -43893,8 +43893,8 @@ var init_chunk_SK323GHE = __esm(() => {
43893
43893
  pcb_component_id: external_exports.string().optional(),
43894
43894
  hole_shape: external_exports.literal("circle"),
43895
43895
  hole_diameter: external_exports.number(),
43896
- x: distance,
43897
- y: distance,
43896
+ x: distance2,
43897
+ y: distance2,
43898
43898
  is_covered_with_solder_mask: external_exports.boolean().optional(),
43899
43899
  soldermask_margin: external_exports.number().optional()
43900
43900
  });
@@ -43909,8 +43909,8 @@ var init_chunk_SK323GHE = __esm(() => {
43909
43909
  hole_shape: external_exports.literal("rect"),
43910
43910
  hole_width: external_exports.number(),
43911
43911
  hole_height: external_exports.number(),
43912
- x: distance,
43913
- y: distance,
43912
+ x: distance2,
43913
+ y: distance2,
43914
43914
  is_covered_with_solder_mask: external_exports.boolean().optional(),
43915
43915
  soldermask_margin: external_exports.number().optional()
43916
43916
  });
@@ -43924,8 +43924,8 @@ var init_chunk_SK323GHE = __esm(() => {
43924
43924
  pcb_component_id: external_exports.string().optional(),
43925
43925
  hole_shape: external_exports.enum(["circle", "square"]),
43926
43926
  hole_diameter: external_exports.number(),
43927
- x: distance,
43928
- y: distance,
43927
+ x: distance2,
43928
+ y: distance2,
43929
43929
  is_covered_with_solder_mask: external_exports.boolean().optional(),
43930
43930
  soldermask_margin: external_exports.number().optional()
43931
43931
  });
@@ -43940,8 +43940,8 @@ var init_chunk_SK323GHE = __esm(() => {
43940
43940
  hole_shape: external_exports.literal("oval"),
43941
43941
  hole_width: external_exports.number(),
43942
43942
  hole_height: external_exports.number(),
43943
- x: distance,
43944
- y: distance,
43943
+ x: distance2,
43944
+ y: distance2,
43945
43945
  is_covered_with_solder_mask: external_exports.boolean().optional(),
43946
43946
  soldermask_margin: external_exports.number().optional()
43947
43947
  });
@@ -43956,8 +43956,8 @@ var init_chunk_SK323GHE = __esm(() => {
43956
43956
  hole_shape: external_exports.literal("pill"),
43957
43957
  hole_width: external_exports.number(),
43958
43958
  hole_height: external_exports.number(),
43959
- x: distance,
43960
- y: distance,
43959
+ x: distance2,
43960
+ y: distance2,
43961
43961
  is_covered_with_solder_mask: external_exports.boolean().optional(),
43962
43962
  soldermask_margin: external_exports.number().optional()
43963
43963
  });
@@ -43972,8 +43972,8 @@ var init_chunk_SK323GHE = __esm(() => {
43972
43972
  hole_shape: external_exports.literal("rotated_pill"),
43973
43973
  hole_width: external_exports.number(),
43974
43974
  hole_height: external_exports.number(),
43975
- x: distance,
43976
- y: distance,
43975
+ x: distance2,
43976
+ y: distance2,
43977
43977
  ccw_rotation: rotation,
43978
43978
  is_covered_with_solder_mask: external_exports.boolean().optional(),
43979
43979
  soldermask_margin: external_exports.number().optional()
@@ -43989,8 +43989,8 @@ var init_chunk_SK323GHE = __esm(() => {
43989
43989
  outer_diameter: external_exports.number(),
43990
43990
  hole_diameter: external_exports.number(),
43991
43991
  is_covered_with_solder_mask: external_exports.boolean().optional(),
43992
- x: distance,
43993
- y: distance,
43992
+ x: distance2,
43993
+ y: distance2,
43994
43994
  layers: external_exports.array(layer_ref),
43995
43995
  port_hints: external_exports.array(external_exports.string()).optional(),
43996
43996
  pcb_component_id: external_exports.string().optional(),
@@ -44008,8 +44008,8 @@ var init_chunk_SK323GHE = __esm(() => {
44008
44008
  hole_width: external_exports.number(),
44009
44009
  hole_height: external_exports.number(),
44010
44010
  is_covered_with_solder_mask: external_exports.boolean().optional(),
44011
- x: distance,
44012
- y: distance,
44011
+ x: distance2,
44012
+ y: distance2,
44013
44013
  ccw_rotation: rotation,
44014
44014
  layers: external_exports.array(layer_ref),
44015
44015
  port_hints: external_exports.array(external_exports.string()).optional(),
@@ -44029,11 +44029,11 @@ var init_chunk_SK323GHE = __esm(() => {
44029
44029
  rect_pad_width: external_exports.number(),
44030
44030
  rect_pad_height: external_exports.number(),
44031
44031
  rect_border_radius: external_exports.number().optional(),
44032
- hole_offset_x: distance.default(0),
44033
- hole_offset_y: distance.default(0),
44032
+ hole_offset_x: distance2.default(0),
44033
+ hole_offset_y: distance2.default(0),
44034
44034
  is_covered_with_solder_mask: external_exports.boolean().optional(),
44035
- x: distance,
44036
- y: distance,
44035
+ x: distance2,
44036
+ y: distance2,
44037
44037
  layers: external_exports.array(layer_ref),
44038
44038
  port_hints: external_exports.array(external_exports.string()).optional(),
44039
44039
  pcb_component_id: external_exports.string().optional(),
@@ -44054,11 +44054,11 @@ var init_chunk_SK323GHE = __esm(() => {
44054
44054
  rect_pad_width: external_exports.number(),
44055
44055
  rect_pad_height: external_exports.number(),
44056
44056
  rect_border_radius: external_exports.number().optional(),
44057
- hole_offset_x: distance.default(0),
44058
- hole_offset_y: distance.default(0),
44057
+ hole_offset_x: distance2.default(0),
44058
+ hole_offset_y: distance2.default(0),
44059
44059
  is_covered_with_solder_mask: external_exports.boolean().optional(),
44060
- x: distance,
44061
- y: distance,
44060
+ x: distance2,
44061
+ y: distance2,
44062
44062
  layers: external_exports.array(layer_ref),
44063
44063
  port_hints: external_exports.array(external_exports.string()).optional(),
44064
44064
  pcb_component_id: external_exports.string().optional(),
@@ -44080,11 +44080,11 @@ var init_chunk_SK323GHE = __esm(() => {
44080
44080
  rect_pad_height: external_exports.number(),
44081
44081
  rect_border_radius: external_exports.number().optional(),
44082
44082
  rect_ccw_rotation: rotation,
44083
- hole_offset_x: distance.default(0),
44084
- hole_offset_y: distance.default(0),
44083
+ hole_offset_x: distance2.default(0),
44084
+ hole_offset_y: distance2.default(0),
44085
44085
  is_covered_with_solder_mask: external_exports.boolean().optional(),
44086
- x: distance,
44087
- y: distance,
44086
+ x: distance2,
44087
+ y: distance2,
44088
44088
  layers: external_exports.array(layer_ref),
44089
44089
  port_hints: external_exports.array(external_exports.string()).optional(),
44090
44090
  pcb_component_id: external_exports.string().optional(),
@@ -44102,14 +44102,14 @@ var init_chunk_SK323GHE = __esm(() => {
44102
44102
  hole_width: external_exports.number().optional(),
44103
44103
  hole_height: external_exports.number().optional(),
44104
44104
  pad_outline: external_exports.array(external_exports.object({
44105
- x: distance,
44106
- y: distance
44105
+ x: distance2,
44106
+ y: distance2
44107
44107
  })).min(3),
44108
- hole_offset_x: distance.default(0),
44109
- hole_offset_y: distance.default(0),
44108
+ hole_offset_x: distance2.default(0),
44109
+ hole_offset_y: distance2.default(0),
44110
44110
  is_covered_with_solder_mask: external_exports.boolean().optional(),
44111
- x: distance,
44112
- y: distance,
44111
+ x: distance2,
44112
+ y: distance2,
44113
44113
  layers: external_exports.array(layer_ref),
44114
44114
  port_hints: external_exports.array(external_exports.string()).optional(),
44115
44115
  pcb_component_id: external_exports.string().optional(),
@@ -44139,8 +44139,8 @@ var init_chunk_SK323GHE = __esm(() => {
44139
44139
  subcircuit_id: external_exports.string().optional(),
44140
44140
  source_port_id: external_exports.string(),
44141
44141
  pcb_component_id: external_exports.string().optional(),
44142
- x: distance,
44143
- y: distance,
44142
+ x: distance2,
44143
+ y: distance2,
44144
44144
  layers: external_exports.array(layer_ref),
44145
44145
  is_board_pinout: external_exports.boolean().optional()
44146
44146
  }).describe("Defines a port on the PCB");
@@ -44151,8 +44151,8 @@ var init_chunk_SK323GHE = __esm(() => {
44151
44151
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
44152
44152
  pcb_group_id: external_exports.string().optional(),
44153
44153
  subcircuit_id: external_exports.string().optional(),
44154
- x: distance,
44155
- y: distance,
44154
+ x: distance2,
44155
+ y: distance2,
44156
44156
  radius: external_exports.number(),
44157
44157
  layer: layer_ref,
44158
44158
  port_hints: external_exports.array(external_exports.string()).optional(),
@@ -44167,8 +44167,8 @@ var init_chunk_SK323GHE = __esm(() => {
44167
44167
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
44168
44168
  pcb_group_id: external_exports.string().optional(),
44169
44169
  subcircuit_id: external_exports.string().optional(),
44170
- x: distance,
44171
- y: distance,
44170
+ x: distance2,
44171
+ y: distance2,
44172
44172
  width: external_exports.number(),
44173
44173
  height: external_exports.number(),
44174
44174
  rect_border_radius: external_exports.number().optional(),
@@ -44190,8 +44190,8 @@ var init_chunk_SK323GHE = __esm(() => {
44190
44190
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
44191
44191
  pcb_group_id: external_exports.string().optional(),
44192
44192
  subcircuit_id: external_exports.string().optional(),
44193
- x: distance,
44194
- y: distance,
44193
+ x: distance2,
44194
+ y: distance2,
44195
44195
  width: external_exports.number(),
44196
44196
  height: external_exports.number(),
44197
44197
  rect_border_radius: external_exports.number().optional(),
@@ -44214,8 +44214,8 @@ var init_chunk_SK323GHE = __esm(() => {
44214
44214
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
44215
44215
  pcb_group_id: external_exports.string().optional(),
44216
44216
  subcircuit_id: external_exports.string().optional(),
44217
- x: distance,
44218
- y: distance,
44217
+ x: distance2,
44218
+ y: distance2,
44219
44219
  width: external_exports.number(),
44220
44220
  height: external_exports.number(),
44221
44221
  radius: external_exports.number(),
@@ -44232,8 +44232,8 @@ var init_chunk_SK323GHE = __esm(() => {
44232
44232
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
44233
44233
  pcb_group_id: external_exports.string().optional(),
44234
44234
  subcircuit_id: external_exports.string().optional(),
44235
- x: distance,
44236
- y: distance,
44235
+ x: distance2,
44236
+ y: distance2,
44237
44237
  width: external_exports.number(),
44238
44238
  height: external_exports.number(),
44239
44239
  radius: external_exports.number(),
@@ -44279,8 +44279,8 @@ var init_chunk_SK323GHE = __esm(() => {
44279
44279
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
44280
44280
  pcb_group_id: external_exports.string().optional(),
44281
44281
  subcircuit_id: external_exports.string().optional(),
44282
- x: distance,
44283
- y: distance,
44282
+ x: distance2,
44283
+ y: distance2,
44284
44284
  radius: external_exports.number(),
44285
44285
  layer: layer_ref,
44286
44286
  pcb_component_id: external_exports.string().optional(),
@@ -44292,8 +44292,8 @@ var init_chunk_SK323GHE = __esm(() => {
44292
44292
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
44293
44293
  pcb_group_id: external_exports.string().optional(),
44294
44294
  subcircuit_id: external_exports.string().optional(),
44295
- x: distance,
44296
- y: distance,
44295
+ x: distance2,
44296
+ y: distance2,
44297
44297
  width: external_exports.number(),
44298
44298
  height: external_exports.number(),
44299
44299
  layer: layer_ref,
@@ -44306,8 +44306,8 @@ var init_chunk_SK323GHE = __esm(() => {
44306
44306
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
44307
44307
  pcb_group_id: external_exports.string().optional(),
44308
44308
  subcircuit_id: external_exports.string().optional(),
44309
- x: distance,
44310
- y: distance,
44309
+ x: distance2,
44310
+ y: distance2,
44311
44311
  width: external_exports.number(),
44312
44312
  height: external_exports.number(),
44313
44313
  radius: external_exports.number(),
@@ -44321,11 +44321,11 @@ var init_chunk_SK323GHE = __esm(() => {
44321
44321
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
44322
44322
  pcb_group_id: external_exports.string().optional(),
44323
44323
  subcircuit_id: external_exports.string().optional(),
44324
- x: distance,
44325
- y: distance,
44324
+ x: distance2,
44325
+ y: distance2,
44326
44326
  width: external_exports.number(),
44327
44327
  height: external_exports.number(),
44328
- ccw_rotation: distance,
44328
+ ccw_rotation: distance2,
44329
44329
  layer: layer_ref,
44330
44330
  pcb_component_id: external_exports.string().optional(),
44331
44331
  pcb_smtpad_id: external_exports.string().optional()
@@ -44336,8 +44336,8 @@ var init_chunk_SK323GHE = __esm(() => {
44336
44336
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
44337
44337
  pcb_group_id: external_exports.string().optional(),
44338
44338
  subcircuit_id: external_exports.string().optional(),
44339
- x: distance,
44340
- y: distance,
44339
+ x: distance2,
44340
+ y: distance2,
44341
44341
  width: external_exports.number(),
44342
44342
  height: external_exports.number(),
44343
44343
  layer: layer_ref,
@@ -44372,9 +44372,9 @@ var init_chunk_SK323GHE = __esm(() => {
44372
44372
  expectTypesMatch(true);
44373
44373
  pcb_trace_route_point_wire = external_exports.object({
44374
44374
  route_type: external_exports.literal("wire"),
44375
- x: distance,
44376
- y: distance,
44377
- width: distance,
44375
+ x: distance2,
44376
+ y: distance2,
44377
+ width: distance2,
44378
44378
  copper_pour_id: external_exports.string().optional(),
44379
44379
  is_inside_copper_pour: external_exports.boolean().optional(),
44380
44380
  start_pcb_port_id: external_exports.string().optional(),
@@ -44383,12 +44383,12 @@ var init_chunk_SK323GHE = __esm(() => {
44383
44383
  });
44384
44384
  pcb_trace_route_point_via = external_exports.object({
44385
44385
  route_type: external_exports.literal("via"),
44386
- x: distance,
44387
- y: distance,
44386
+ x: distance2,
44387
+ y: distance2,
44388
44388
  copper_pour_id: external_exports.string().optional(),
44389
44389
  is_inside_copper_pour: external_exports.boolean().optional(),
44390
- hole_diameter: distance.optional(),
44391
- outer_diameter: distance.optional(),
44390
+ hole_diameter: distance2.optional(),
44391
+ outer_diameter: distance2.optional(),
44392
44392
  from_layer: external_exports.string(),
44393
44393
  to_layer: external_exports.string()
44394
44394
  });
@@ -44465,10 +44465,10 @@ var init_chunk_SK323GHE = __esm(() => {
44465
44465
  pcb_group_id: external_exports.string().optional(),
44466
44466
  subcircuit_id: external_exports.string().optional(),
44467
44467
  subcircuit_connectivity_map_key: external_exports.string().optional(),
44468
- x: distance,
44469
- y: distance,
44470
- outer_diameter: distance.default("0.6mm"),
44471
- hole_diameter: distance.default("0.25mm"),
44468
+ x: distance2,
44469
+ y: distance2,
44470
+ outer_diameter: distance2.default("0.6mm"),
44471
+ hole_diameter: distance2.default("0.25mm"),
44472
44472
  from_layer: layer_ref.optional(),
44473
44473
  to_layer: layer_ref.optional(),
44474
44474
  layers: external_exports.array(layer_ref),
@@ -44541,11 +44541,11 @@ var init_chunk_SK323GHE = __esm(() => {
44541
44541
  pcb_component_id: external_exports.string(),
44542
44542
  pcb_group_id: external_exports.string().optional(),
44543
44543
  subcircuit_id: external_exports.string().optional(),
44544
- stroke_width: distance.default("0.1mm"),
44545
- x1: distance,
44546
- y1: distance,
44547
- x2: distance,
44548
- y2: distance,
44544
+ stroke_width: distance2.default("0.1mm"),
44545
+ x1: distance2,
44546
+ y1: distance2,
44547
+ x2: distance2,
44548
+ y2: distance2,
44549
44549
  layer: visible_layer
44550
44550
  }).describe("Defines a silkscreen line on the PCB");
44551
44551
  expectTypesMatch(true);
@@ -44566,7 +44566,7 @@ var init_chunk_SK323GHE = __esm(() => {
44566
44566
  pcb_group_id: external_exports.string().optional(),
44567
44567
  subcircuit_id: external_exports.string().optional(),
44568
44568
  font: external_exports.literal("tscircuit2024").default("tscircuit2024"),
44569
- font_size: distance.default("0.2mm"),
44569
+ font_size: distance2.default("0.2mm"),
44570
44570
  pcb_component_id: external_exports.string(),
44571
44571
  text: external_exports.string(),
44572
44572
  is_knockout: external_exports.boolean().default(false).optional(),
@@ -44594,7 +44594,7 @@ var init_chunk_SK323GHE = __esm(() => {
44594
44594
  pcb_group_id: external_exports.string().optional(),
44595
44595
  subcircuit_id: external_exports.string().optional(),
44596
44596
  font: external_exports.literal("tscircuit2024").default("tscircuit2024"),
44597
- font_size: distance.default("0.2mm"),
44597
+ font_size: distance2.default("0.2mm"),
44598
44598
  pcb_component_id: external_exports.string(),
44599
44599
  text: external_exports.string(),
44600
44600
  is_knockout: external_exports.boolean().default(false).optional(),
@@ -44653,8 +44653,8 @@ var init_chunk_SK323GHE = __esm(() => {
44653
44653
  pcb_group_id: external_exports.string().optional(),
44654
44654
  subcircuit_id: external_exports.string().optional(),
44655
44655
  center: point,
44656
- radius_x: distance,
44657
- radius_y: distance,
44656
+ radius_x: distance2,
44657
+ radius_y: distance2,
44658
44658
  layer: visible_layer,
44659
44659
  ccw_rotation: rotation.optional()
44660
44660
  }).describe("Defines a silkscreen oval on the PCB");
@@ -44678,7 +44678,7 @@ var init_chunk_SK323GHE = __esm(() => {
44678
44678
  subcircuit_id: external_exports.string().optional(),
44679
44679
  pcb_group_id: external_exports.string().optional(),
44680
44680
  font: external_exports.literal("tscircuit2024").default("tscircuit2024"),
44681
- font_size: distance.default("1mm"),
44681
+ font_size: distance2.default("1mm"),
44682
44682
  pcb_component_id: external_exports.string(),
44683
44683
  text: external_exports.string(),
44684
44684
  layer: visible_layer,
@@ -44747,7 +44747,7 @@ var init_chunk_SK323GHE = __esm(() => {
44747
44747
  subcircuit_id: external_exports.string().optional(),
44748
44748
  name: external_exports.string().optional(),
44749
44749
  font: external_exports.literal("tscircuit2024").default("tscircuit2024"),
44750
- font_size: distance.default("1mm"),
44750
+ font_size: distance2.default("1mm"),
44751
44751
  text: external_exports.string().optional(),
44752
44752
  anchor_position: point.default({ x: 0, y: 0 }),
44753
44753
  anchor_alignment: external_exports.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
@@ -44794,11 +44794,11 @@ var init_chunk_SK323GHE = __esm(() => {
44794
44794
  subcircuit_id: external_exports.string().optional(),
44795
44795
  name: external_exports.string().optional(),
44796
44796
  text: external_exports.string().optional(),
44797
- x1: distance,
44798
- y1: distance,
44799
- x2: distance,
44800
- y2: distance,
44801
- stroke_width: distance.default("0.1mm"),
44797
+ x1: distance2,
44798
+ y1: distance2,
44799
+ x2: distance2,
44800
+ y2: distance2,
44801
+ stroke_width: distance2.default("0.1mm"),
44802
44802
  color: external_exports.string().optional(),
44803
44803
  is_dashed: external_exports.boolean().optional()
44804
44804
  }).describe("Defines a straight documentation note line on the PCB");
@@ -44848,8 +44848,8 @@ var init_chunk_SK323GHE = __esm(() => {
44848
44848
  pcb_group_id: external_exports.string().optional(),
44849
44849
  subcircuit_id: external_exports.string().optional(),
44850
44850
  center: point,
44851
- width: distance,
44852
- height: distance,
44851
+ width: distance2,
44852
+ height: distance2,
44853
44853
  pcb_keepout_id: external_exports.string(),
44854
44854
  layers: external_exports.array(external_exports.string()),
44855
44855
  description: external_exports.string().optional()
@@ -44859,7 +44859,7 @@ var init_chunk_SK323GHE = __esm(() => {
44859
44859
  pcb_group_id: external_exports.string().optional(),
44860
44860
  subcircuit_id: external_exports.string().optional(),
44861
44861
  center: point,
44862
- radius: distance,
44862
+ radius: distance2,
44863
44863
  pcb_keepout_id: external_exports.string(),
44864
44864
  layers: external_exports.array(external_exports.string()),
44865
44865
  description: external_exports.string().optional()
@@ -45008,8 +45008,8 @@ var init_chunk_SK323GHE = __esm(() => {
45008
45008
  source_trace_id: external_exports.string().optional(),
45009
45009
  source_port_id: external_exports.string().optional(),
45010
45010
  source_net_id: external_exports.string().optional(),
45011
- x: distance,
45012
- y: distance
45011
+ x: distance2,
45012
+ y: distance2
45013
45013
  }).describe("Defines a routing target within a pcb_group for a source_trace or source_net");
45014
45014
  expectTypesMatch(true);
45015
45015
  pcb_ground_plane = external_exports.object({
@@ -45037,9 +45037,9 @@ var init_chunk_SK323GHE = __esm(() => {
45037
45037
  pcb_ground_plane_id: external_exports.string(),
45038
45038
  shape: external_exports.string(),
45039
45039
  spoke_count: external_exports.number(),
45040
- spoke_thickness: distance,
45041
- spoke_inner_diameter: distance,
45042
- spoke_outer_diameter: distance,
45040
+ spoke_thickness: distance2,
45041
+ spoke_inner_diameter: distance2,
45042
+ spoke_outer_diameter: distance2,
45043
45043
  pcb_plated_hole_id: external_exports.string().optional(),
45044
45044
  subcircuit_id: external_exports.string().optional()
45045
45045
  }).describe("Pattern for connecting a ground plane to a plated hole");
@@ -45121,8 +45121,8 @@ var init_chunk_SK323GHE = __esm(() => {
45121
45121
  pcb_error_id: getZodPrefixedIdWithDefault("pcb_error"),
45122
45122
  error_type: external_exports.literal("pcb_via_clearance_error").default("pcb_via_clearance_error"),
45123
45123
  pcb_via_ids: external_exports.array(external_exports.string()).min(2),
45124
- minimum_clearance: distance.optional(),
45125
- actual_clearance: distance.optional(),
45124
+ minimum_clearance: distance2.optional(),
45125
+ actual_clearance: distance2.optional(),
45126
45126
  pcb_center: external_exports.object({
45127
45127
  x: external_exports.number().optional(),
45128
45128
  y: external_exports.number().optional()
@@ -49871,7 +49871,7 @@ function createSvgObjectsFromPcbCopperText(pcbCopperText, ctx) {
49871
49871
  anchor_position.x,
49872
49872
  anchor_position.y
49873
49873
  ]);
49874
- const fontSizeNum = distance.parse(font_size) ?? 0.2;
49874
+ const fontSizeNum = distance2.parse(font_size) ?? 0.2;
49875
49875
  const scaleFactor = Math.abs(transform2.a);
49876
49876
  const copperColor = layerNameToColor(layerName, colorMap2);
49877
49877
  const isBottom = layerName === "bottom";
@@ -52939,8 +52939,8 @@ function getPcbBoundsFromCircuitJson(circuitJson) {
52939
52939
  for (const circuitJsonElm of circuitJson) {
52940
52940
  if (circuitJsonElm.type === "pcb_panel") {
52941
52941
  const panel = circuitJsonElm;
52942
- const width = distance.parse(panel.width);
52943
- const height = distance.parse(panel.height);
52942
+ const width = distance2.parse(panel.width);
52943
+ const height = distance2.parse(panel.height);
52944
52944
  if (width === undefined || height === undefined) {
52945
52945
  continue;
52946
52946
  }
@@ -52971,7 +52971,7 @@ function getPcbBoundsFromCircuitJson(circuitJson) {
52971
52971
  height: pad.height
52972
52972
  });
52973
52973
  } else if (pad.shape === "circle") {
52974
- const radius = distance.parse(pad.radius);
52974
+ const radius = distance2.parse(pad.radius);
52975
52975
  if (radius !== undefined) {
52976
52976
  updateBounds({
52977
52977
  center: { x: pad.x, y: pad.y },
@@ -53101,7 +53101,7 @@ function getPcbBoundsFromCircuitJson(circuitJson) {
53101
53101
  height: cutout.height
53102
53102
  });
53103
53103
  } else if (cutout.shape === "circle") {
53104
- const radius = distance.parse(cutout.radius);
53104
+ const radius = distance2.parse(cutout.radius);
53105
53105
  if (radius !== undefined) {
53106
53106
  updateBounds({
53107
53107
  center: cutout.center,
@@ -53126,7 +53126,7 @@ function getPcbBoundsFromCircuitJson(circuitJson) {
53126
53126
  height: keepout.height
53127
53127
  });
53128
53128
  } else if (keepout.shape === "circle") {
53129
- const radius = typeof keepout.radius === "number" ? keepout.radius : distance.parse(keepout.radius) ?? 0;
53129
+ const radius = typeof keepout.radius === "number" ? keepout.radius : distance2.parse(keepout.radius) ?? 0;
53130
53130
  if (radius > 0) {
53131
53131
  updateBounds({
53132
53132
  center: keepout.center,
@@ -53174,12 +53174,12 @@ function getPcbBoundsFromCircuitJson(circuitJson) {
53174
53174
  }) {
53175
53175
  if (!center)
53176
53176
  return;
53177
- const centerX = distance.parse(center.x);
53178
- const centerY = distance.parse(center.y);
53177
+ const centerX = distance2.parse(center.x);
53178
+ const centerY = distance2.parse(center.y);
53179
53179
  if (centerX === undefined || centerY === undefined)
53180
53180
  return;
53181
- const numericWidth = distance.parse(width) ?? 0;
53182
- const numericHeight = distance.parse(height) ?? 0;
53181
+ const numericWidth = distance2.parse(width) ?? 0;
53182
+ const numericHeight = distance2.parse(height) ?? 0;
53183
53183
  const halfWidth = numericWidth / 2;
53184
53184
  const halfHeight = numericHeight / 2;
53185
53185
  minX = Math.min(minX, centerX - halfWidth);
@@ -53195,12 +53195,12 @@ function getPcbBoundsFromCircuitJson(circuitJson) {
53195
53195
  }) {
53196
53196
  if (!center)
53197
53197
  return;
53198
- const centerX = distance.parse(center.x);
53199
- const centerY = distance.parse(center.y);
53198
+ const centerX = distance2.parse(center.x);
53199
+ const centerY = distance2.parse(center.y);
53200
53200
  if (centerX === undefined || centerY === undefined)
53201
53201
  return;
53202
- const numericWidth = distance.parse(width) ?? 0;
53203
- const numericHeight = distance.parse(height) ?? 0;
53202
+ const numericWidth = distance2.parse(width) ?? 0;
53203
+ const numericHeight = distance2.parse(height) ?? 0;
53204
53204
  const halfWidth = numericWidth / 2;
53205
53205
  const halfHeight = numericHeight / 2;
53206
53206
  boardMinX = Math.min(boardMinX, centerX - halfWidth);
@@ -53213,8 +53213,8 @@ function getPcbBoundsFromCircuitJson(circuitJson) {
53213
53213
  function updateBoundsToIncludeOutline(outline) {
53214
53214
  let updated = false;
53215
53215
  for (const point2 of outline) {
53216
- const x3 = distance.parse(point2.x);
53217
- const y = distance.parse(point2.y);
53216
+ const x3 = distance2.parse(point2.x);
53217
+ const y = distance2.parse(point2.y);
53218
53218
  if (x3 === undefined || y === undefined)
53219
53219
  continue;
53220
53220
  minX = Math.min(minX, x3);
@@ -53230,8 +53230,8 @@ function getPcbBoundsFromCircuitJson(circuitJson) {
53230
53230
  function updateBoardBoundsToIncludeOutline(outline) {
53231
53231
  let updated = false;
53232
53232
  for (const point2 of outline) {
53233
- const x3 = distance.parse(point2.x);
53234
- const y = distance.parse(point2.y);
53233
+ const x3 = distance2.parse(point2.x);
53234
+ const y = distance2.parse(point2.y);
53235
53235
  if (x3 === undefined || y === undefined)
53236
53236
  continue;
53237
53237
  boardMinX = Math.min(boardMinX, x3);
@@ -53248,8 +53248,8 @@ function getPcbBoundsFromCircuitJson(circuitJson) {
53248
53248
  function updateTraceBounds(route) {
53249
53249
  let updated = false;
53250
53250
  for (const point2 of route) {
53251
- const x3 = distance.parse(point2?.x);
53252
- const y = distance.parse(point2?.y);
53251
+ const x3 = distance2.parse(point2?.x);
53252
+ const y = distance2.parse(point2?.y);
53253
53253
  if (x3 === undefined || y === undefined)
53254
53254
  continue;
53255
53255
  minX = Math.min(minX, x3);
@@ -53274,7 +53274,7 @@ function getPcbBoundsFromCircuitJson(circuitJson) {
53274
53274
  height: item.height
53275
53275
  });
53276
53276
  } else if (item.type === "pcb_silkscreen_circle") {
53277
- const radius = distance.parse(item.radius);
53277
+ const radius = distance2.parse(item.radius);
53278
53278
  if (radius !== undefined) {
53279
53279
  updateBounds({
53280
53280
  center: item.center,
@@ -53286,8 +53286,8 @@ function getPcbBoundsFromCircuitJson(circuitJson) {
53286
53286
  updateBounds({ center: { x: item.x1, y: item.y1 }, width: 0, height: 0 });
53287
53287
  updateBounds({ center: { x: item.x2, y: item.y2 }, width: 0, height: 0 });
53288
53288
  } else if (item.type === "pcb_silkscreen_oval") {
53289
- const radiusX = distance.parse(item.radius_x);
53290
- const radiusY = distance.parse(item.radius_y);
53289
+ const radiusX = distance2.parse(item.radius_x);
53290
+ const radiusY = distance2.parse(item.radius_y);
53291
53291
  if (radiusX !== undefined && radiusY !== undefined) {
53292
53292
  updateBounds({
53293
53293
  center: item.center,
@@ -53304,7 +53304,7 @@ function getPcbBoundsFromCircuitJson(circuitJson) {
53304
53304
  height: cutout.height
53305
53305
  });
53306
53306
  } else if (cutout.shape === "circle") {
53307
- const radius = distance.parse(cutout.radius);
53307
+ const radius = distance2.parse(cutout.radius);
53308
53308
  if (radius !== undefined) {
53309
53309
  updateBounds({
53310
53310
  center: cutout.center,
@@ -53326,12 +53326,12 @@ function getPcbBoundsFromCircuitJson(circuitJson) {
53326
53326
  function rectBounds(center, width, height) {
53327
53327
  if (!center || width === undefined || height === undefined)
53328
53328
  return;
53329
- const cx2 = distance.parse(center.x);
53330
- const cy2 = distance.parse(center.y);
53329
+ const cx2 = distance2.parse(center.x);
53330
+ const cy2 = distance2.parse(center.y);
53331
53331
  if (cx2 === undefined || cy2 === undefined)
53332
53332
  return;
53333
- const numericWidth = distance.parse(width);
53334
- const numericHeight = distance.parse(height);
53333
+ const numericWidth = distance2.parse(width);
53334
+ const numericHeight = distance2.parse(height);
53335
53335
  if (numericWidth === undefined || numericHeight === undefined)
53336
53336
  return;
53337
53337
  const halfW = numericWidth / 2;
@@ -53351,8 +53351,8 @@ function getOutlineBounds(outline) {
53351
53351
  let maxX = Number.NEGATIVE_INFINITY;
53352
53352
  let maxY = Number.NEGATIVE_INFINITY;
53353
53353
  for (const pt2 of outline) {
53354
- const x3 = distance.parse(pt2.x);
53355
- const y = distance.parse(pt2.y);
53354
+ const x3 = distance2.parse(pt2.x);
53355
+ const y = distance2.parse(pt2.y);
53356
53356
  if (x3 === undefined || y === undefined)
53357
53357
  continue;
53358
53358
  minX = Math.min(minX, x3);
@@ -57640,8 +57640,8 @@ function convertCircuitJsonToSolderPasteMask(circuitJson, options) {
57640
57640
  }
57641
57641
  } else if (item.type === "pcb_panel") {
57642
57642
  const panel = item;
57643
- const width = distance.parse(panel.width);
57644
- const height = distance.parse(panel.height);
57643
+ const width = distance2.parse(panel.width);
57644
+ const height = distance2.parse(panel.height);
57645
57645
  if (width !== undefined && height !== undefined) {
57646
57646
  const center = panel.center ?? { x: width / 2, y: height / 2 };
57647
57647
  updateBounds(center, width, height);
@@ -100768,7 +100768,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
100768
100768
  // lib/getVersion.ts
100769
100769
  import { createRequire as createRequire2 } from "node:module";
100770
100770
  // package.json
100771
- var version = "0.1.1532";
100771
+ var version = "0.1.1534";
100772
100772
  var package_default = {
100773
100773
  name: "@tscircuit/cli",
100774
100774
  version,
@@ -100806,6 +100806,7 @@ var package_default = {
100806
100806
  "bun-match-svg": "^0.0.12",
100807
100807
  chokidar: "4.0.1",
100808
100808
  "circuit-json": "^0.0.437",
100809
+ "circuit-json-to-3d-png": "^0.0.6",
100809
100810
  "circuit-json-to-bom-csv": "^0.0.7",
100810
100811
  "circuit-json-to-gerber": "^0.0.51",
100811
100812
  "circuit-json-to-kicad": "0.0.153",
@@ -102001,11 +102002,18 @@ function normalizeTscircuitPackageName(packageSpec) {
102001
102002
  return null;
102002
102003
  }
102003
102004
  async function addPackage(packageSpec, projectDir = process.cwd()) {
102004
- const normalizedName = normalizeTscircuitPackageName(packageSpec);
102005
- const displayName = normalizedName || packageSpec;
102006
- let installTarget = normalizedName || packageSpec;
102007
- console.log(kleur_default.cyan(`Adding ${kleur_default.bold(displayName)}...`));
102008
- if (normalizedName?.startsWith("@tsci/")) {
102005
+ return addPackages([packageSpec], projectDir);
102006
+ }
102007
+ async function addPackages(packageSpecs, projectDir = process.cwd()) {
102008
+ const normalized = packageSpecs.map((spec) => ({
102009
+ original: spec,
102010
+ normalized: normalizeTscircuitPackageName(spec)
102011
+ }));
102012
+ const displayNames = normalized.map((p) => p.normalized || p.original).join(" ");
102013
+ console.log(kleur_default.cyan(`Adding ${kleur_default.bold(displayNames)}...`));
102014
+ const hasTsciPackage = normalized.some((p) => p.normalized?.startsWith("@tsci/"));
102015
+ let useTarball = false;
102016
+ if (hasTsciPackage) {
102009
102017
  const npmrcPath = path8.join(projectDir, ".npmrc");
102010
102018
  const npmrcContent = fs10.existsSync(npmrcPath) ? fs10.readFileSync(npmrcPath, "utf-8") : "";
102011
102019
  let hasTsciRegistry = /@tsci[/:]/.test(npmrcContent);
@@ -102026,30 +102034,34 @@ async function addPackage(packageSpec, projectDir = process.cwd()) {
102026
102034
  hasTsciRegistry = true;
102027
102035
  } else {
102028
102036
  console.log("Continuing without updating .npmrc; will fetch package directly from registry tarball.");
102037
+ useTarball = true;
102029
102038
  }
102030
102039
  }
102031
- if (!hasTsciRegistry) {
102032
- installTarget = await resolveTarballUrlFromRegistry(normalizedName);
102033
- }
102034
102040
  }
102041
+ const installTargets = await Promise.all(normalized.map(async ({ original, normalized: norm }) => {
102042
+ if (norm?.startsWith("@tsci/") && useTarball) {
102043
+ return resolveTarballUrlFromRegistry(norm);
102044
+ }
102045
+ return norm || original;
102046
+ }));
102035
102047
  const packageManager = getPackageManager();
102036
102048
  try {
102037
- packageManager.install({ name: installTarget, cwd: projectDir });
102038
- console.log(kleur_default.green(`✓ Added ${kleur_default.bold(displayName)} successfully`));
102039
- await detectAndSetupKicadLibrary(packageSpec, projectDir);
102049
+ packageManager.install({ name: installTargets.join(" "), cwd: projectDir });
102050
+ console.log(kleur_default.green(`✓ Added ${kleur_default.bold(displayNames)} successfully`));
102051
+ await Promise.all(packageSpecs.map((spec) => detectAndSetupKicadLibrary(spec, projectDir)));
102040
102052
  } catch (error) {
102041
102053
  const errorMessage = error instanceof Error ? error.message : String(error);
102042
- console.error(kleur_default.red(`✗ Failed to add ${displayName}:`), errorMessage);
102054
+ console.error(kleur_default.red(`✗ Failed to add ${displayNames}:`), errorMessage);
102043
102055
  handleRegistryAuthError({ error, projectDir });
102044
- throw new Error(`Failed to add ${displayName}: ${errorMessage}`);
102056
+ throw new Error(`Failed to add ${displayNames}: ${errorMessage}`);
102045
102057
  }
102046
102058
  }
102047
102059
 
102048
102060
  // cli/add/register.ts
102049
102061
  var registerAdd = (program2) => {
102050
- program2.command("add").description("Add a tscircuit component package to your project").argument("<packageSpec>", "Package to add (e.g. package-name, author/component, https://github.com/user/repo, package@version)").action(async (packageSpec) => {
102062
+ program2.command("add").description("Add tscircuit component packages to your project").argument("<packageSpecs...>", "Packages to add (e.g. package-name, author/component, https://github.com/user/repo, package@version)").action(async (packageSpecs) => {
102051
102063
  try {
102052
- await addPackage(packageSpec);
102064
+ await addPackages(packageSpecs);
102053
102065
  } catch (error) {
102054
102066
  process.exit(1);
102055
102067
  }
@@ -112126,6 +112138,190 @@ import path33 from "node:path";
112126
112138
  import fs29 from "node:fs";
112127
112139
  import path32 from "node:path";
112128
112140
 
112141
+ // node_modules/circuit-json-to-3d-png/dist/index.js
112142
+ function normalizeDir(dir) {
112143
+ const len = Math.sqrt(dir[0] ** 2 + dir[1] ** 2 + dir[2] ** 2);
112144
+ if (len === 0)
112145
+ return [0, 1, 0];
112146
+ return [dir[0] / len, dir[1] / len, dir[2] / len];
112147
+ }
112148
+ function distance(a, b) {
112149
+ return Math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2 + (a[2] - b[2]) ** 2);
112150
+ }
112151
+ function repositionCamera(cam, dir, distOverride) {
112152
+ const dist = distOverride ?? distance(cam.camPos, cam.lookAt);
112153
+ const [nx, ny, nz] = normalizeDir(dir);
112154
+ return {
112155
+ camPos: [
112156
+ cam.lookAt[0] + nx * dist,
112157
+ cam.lookAt[1] + ny * dist,
112158
+ cam.lookAt[2] + nz * dist
112159
+ ],
112160
+ lookAt: cam.lookAt,
112161
+ fov: cam.fov
112162
+ };
112163
+ }
112164
+ var CAMERA_PRESETS = {
112165
+ "top-down": (cam) => repositionCamera(cam, [0.00000001, 1, -0.001]),
112166
+ "top-down-ortho": (cam) => {
112167
+ const desiredFov = 3;
112168
+ const dir = [0.00000001, 1, -0.001];
112169
+ const origDist = distance(cam.camPos, cam.lookAt);
112170
+ const origFovRad = Math.max(cam.fov * Math.PI / 180, 0.01);
112171
+ const desiredFovRad = Math.max(desiredFov * Math.PI / 180, 0.01);
112172
+ const tanOrig = Math.tan(origFovRad / 2);
112173
+ const tanDesired = Math.max(Math.tan(desiredFovRad / 2), 0.0001);
112174
+ const distScale = Number.isFinite(tanOrig / tanDesired) && tanOrig > 0 ? tanOrig / tanDesired : 1;
112175
+ const newDist = origDist * distScale;
112176
+ const repositioned = repositionCamera(cam, dir, newDist);
112177
+ return { ...repositioned, fov: desiredFov };
112178
+ },
112179
+ "top-left-corner": (cam) => repositionCamera(cam, [0.7, 1.2, -0.8]),
112180
+ "top-left": (cam) => repositionCamera(cam, [1, 1.2, 0]),
112181
+ "top-right-corner": (cam) => repositionCamera(cam, [-0.7, 1.2, -0.8]),
112182
+ "top-right": (cam) => repositionCamera(cam, [-1, 1.2, 0]),
112183
+ "left-sideview": (cam) => repositionCamera(cam, [1, 0.05, 0]),
112184
+ "right-sideview": (cam) => repositionCamera(cam, [-1, 0.05, 0]),
112185
+ front: (cam) => repositionCamera(cam, [0, 0.05, -1]),
112186
+ "top-center-angled": (cam) => repositionCamera(cam, [0, 1, -1])
112187
+ };
112188
+ var CAMERA_PRESET_NAMES = Object.keys(CAMERA_PRESETS);
112189
+ function applyCameraPreset(preset, cam) {
112190
+ if (!(preset in CAMERA_PRESETS)) {
112191
+ throw new Error(`Unknown camera preset "${preset}". Valid presets: ${CAMERA_PRESET_NAMES.join(", ")}`);
112192
+ }
112193
+ return CAMERA_PRESETS[preset](cam);
112194
+ }
112195
+ var viewToArrayBuffer2 = (view) => {
112196
+ const copy = new Uint8Array(view.byteLength);
112197
+ copy.set(new Uint8Array(view.buffer, view.byteOffset, view.byteLength));
112198
+ return copy.buffer;
112199
+ };
112200
+ var normalizeToArrayBuffer = async (value) => {
112201
+ if (value instanceof ArrayBuffer) {
112202
+ return value;
112203
+ }
112204
+ if (ArrayBuffer.isView(value)) {
112205
+ return viewToArrayBuffer2(value);
112206
+ }
112207
+ if ("arrayBuffer" in value && typeof value.arrayBuffer === "function") {
112208
+ const result = value.arrayBuffer();
112209
+ return result instanceof Promise ? await result : result;
112210
+ }
112211
+ throw new Error("Expected ArrayBuffer, ArrayBufferView, or Buffer-compatible object");
112212
+ };
112213
+ var normalizeToUint8Array2 = (value) => {
112214
+ if (value instanceof Uint8Array) {
112215
+ return value;
112216
+ }
112217
+ if (value instanceof ArrayBuffer) {
112218
+ return new Uint8Array(value);
112219
+ }
112220
+ if (ArrayBuffer.isView(value)) {
112221
+ return new Uint8Array(viewToArrayBuffer2(value));
112222
+ }
112223
+ throw new Error("Expected Uint8Array, ArrayBuffer, or ArrayBufferView");
112224
+ };
112225
+ var circuitJsonToGltfModulePromise = null;
112226
+ var poppyGlModulePromise = null;
112227
+ var loadCircuitJsonToGltf = async () => {
112228
+ circuitJsonToGltfModulePromise ??= import("circuit-json-to-gltf");
112229
+ return circuitJsonToGltfModulePromise;
112230
+ };
112231
+ var loadPoppyGl = async () => {
112232
+ poppyGlModulePromise ??= import("poppygl");
112233
+ return poppyGlModulePromise;
112234
+ };
112235
+ var modelUrlKeys = [
112236
+ "model_glb_url",
112237
+ "glb_model_url",
112238
+ "model_stl_url",
112239
+ "stl_model_url",
112240
+ "model_obj_url",
112241
+ "obj_model_url",
112242
+ "model_gltf_url",
112243
+ "gltf_model_url",
112244
+ "model_step_url",
112245
+ "step_model_url"
112246
+ ];
112247
+ var hasUriScheme = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) && !/^[a-zA-Z]:[\\/]/.test(value);
112248
+ var isWindowsAbsolutePath = (value) => /^[a-zA-Z]:[\\/]/.test(value);
112249
+ var getDefaultBaseDir = () => {
112250
+ if (typeof process !== "undefined" && process && typeof process.cwd === "function") {
112251
+ return process.cwd();
112252
+ }
112253
+ return;
112254
+ };
112255
+ var toFileUrl = (value) => {
112256
+ const normalizedPath = value.replace(/\\/g, "/");
112257
+ const pathname = isWindowsAbsolutePath(value) ? `/${normalizedPath}` : normalizedPath;
112258
+ return new URL(`file://${encodeURI(pathname)}`).href;
112259
+ };
112260
+ var toDirectoryUrl = (value) => {
112261
+ if (hasUriScheme(value)) {
112262
+ return value.endsWith("/") ? value : `${value}/`;
112263
+ }
112264
+ const directoryPath = value.endsWith("/") || value.endsWith("\\") ? value : `${value}/`;
112265
+ return toFileUrl(directoryPath);
112266
+ };
112267
+ var normalizeModelUrls = (circuitJson, options = {}) => {
112268
+ const baseDir = options.modelPathBaseDir ?? getDefaultBaseDir();
112269
+ const hasModelPathBaseDir = options.modelPathBaseDir != null;
112270
+ const preserveRelativeModelUrls = Boolean(options.projectBaseUrl);
112271
+ return circuitJson.map((element) => {
112272
+ if (!element || typeof element !== "object")
112273
+ return element;
112274
+ const updated = { ...element };
112275
+ for (const key of modelUrlKeys) {
112276
+ const value = updated[key];
112277
+ if (!value)
112278
+ continue;
112279
+ if (hasUriScheme(value))
112280
+ continue;
112281
+ if (value.startsWith("/") && preserveRelativeModelUrls) {
112282
+ updated[key] = value;
112283
+ } else if (value.startsWith("/") || isWindowsAbsolutePath(value)) {
112284
+ updated[key] = toFileUrl(value);
112285
+ } else if (preserveRelativeModelUrls && !hasModelPathBaseDir) {
112286
+ updated[key] = value;
112287
+ } else if (!baseDir) {
112288
+ updated[key] = value;
112289
+ } else {
112290
+ updated[key] = new URL(value, toDirectoryUrl(baseDir)).href;
112291
+ }
112292
+ }
112293
+ return updated;
112294
+ });
112295
+ };
112296
+ var getRenderCamera = (circuitJson, defaultCamera, options = {}) => {
112297
+ if (options.camera) {
112298
+ return options.camera;
112299
+ }
112300
+ if (!options.cameraPreset) {
112301
+ return defaultCamera;
112302
+ }
112303
+ return applyCameraPreset(options.cameraPreset, defaultCamera);
112304
+ };
112305
+ var getConversionOptions = (format, options = {}) => ({
112306
+ format,
112307
+ ...options.projectBaseUrl ? { projectBaseUrl: options.projectBaseUrl } : {},
112308
+ ...options.authHeaders ? { authHeaders: options.authHeaders } : {},
112309
+ ...options.boardTextureResolution ? { boardTextureResolution: options.boardTextureResolution } : {}
112310
+ });
112311
+ var convertCircuitJsonTo3dGlb = async (circuitJson, options = {}) => {
112312
+ const normalizedCircuitJson = normalizeModelUrls(circuitJson, options);
112313
+ const { convertCircuitJsonToGltf: convertCircuitJsonToGltf2 } = await loadCircuitJsonToGltf();
112314
+ const glbBuffer = await convertCircuitJsonToGltf2(normalizedCircuitJson, getConversionOptions("glb", options));
112315
+ return normalizeToUint8Array2(await normalizeToArrayBuffer(glbBuffer));
112316
+ };
112317
+ var renderCircuitJsonTo3dPng = async (circuitJson, options = {}) => {
112318
+ const [{ getBestCameraPosition }, { renderGLTFToPNGFromGLB }] = await Promise.all([loadCircuitJsonToGltf(), loadPoppyGl()]);
112319
+ const glbBuffer = await convertCircuitJsonTo3dGlb(circuitJson, options);
112320
+ const glbArrayBuffer = await normalizeToArrayBuffer(glbBuffer);
112321
+ const defaultCamera = getBestCameraPosition(circuitJson);
112322
+ return renderGLTFToPNGFromGLB(glbArrayBuffer, getRenderCamera(circuitJson, defaultCamera, options));
112323
+ };
112324
+
112129
112325
  // node_modules/circuit-json-to-step/node_modules/stepts/dist/index.js
112130
112326
  var Entity = class {
112131
112327
  static parse(_a, _ctx) {
@@ -114412,23 +114608,19 @@ async function circuitJsonToStep(circuitJson, options = {}) {
114412
114608
  }
114413
114609
 
114414
114610
  // cli/build/worker-output-generators.ts
114415
- import {
114416
- convertCircuitJsonToGltf as convertCircuitJsonToGltf2,
114417
- getBestCameraPosition
114418
- } from "circuit-json-to-gltf";
114611
+ import { convertCircuitJsonToGltf as convertCircuitJsonToGltf2 } from "circuit-json-to-gltf";
114419
114612
  import {
114420
114613
  convertCircuitJsonToPcbSvg,
114421
114614
  convertCircuitJsonToSchematicSvg
114422
114615
  } from "circuit-to-svg";
114423
- import { renderGLTFToPNGFromGLB } from "poppygl";
114424
114616
 
114425
114617
  // cli/build/worker-binary-utils.ts
114426
- var viewToArrayBuffer2 = (view) => {
114618
+ var viewToArrayBuffer3 = (view) => {
114427
114619
  const copy = new Uint8Array(view.byteLength);
114428
114620
  copy.set(new Uint8Array(view.buffer, view.byteOffset, view.byteLength));
114429
114621
  return copy.buffer;
114430
114622
  };
114431
- var normalizeToUint8Array2 = (value) => {
114623
+ var normalizeToUint8Array3 = (value) => {
114432
114624
  if (value instanceof Uint8Array) {
114433
114625
  return value;
114434
114626
  }
@@ -114436,26 +114628,10 @@ var normalizeToUint8Array2 = (value) => {
114436
114628
  return new Uint8Array(value);
114437
114629
  }
114438
114630
  if (ArrayBuffer.isView(value)) {
114439
- return new Uint8Array(viewToArrayBuffer2(value));
114631
+ return new Uint8Array(viewToArrayBuffer3(value));
114440
114632
  }
114441
114633
  throw new Error("Expected Uint8Array, ArrayBuffer, or ArrayBufferView for binary data");
114442
114634
  };
114443
- var normalizeToArrayBuffer = async (value) => {
114444
- if (value instanceof ArrayBuffer) {
114445
- return value;
114446
- }
114447
- if (ArrayBuffer.isView(value)) {
114448
- return viewToArrayBuffer2(value);
114449
- }
114450
- if (value && typeof value === "object") {
114451
- const maybeArrayBufferLike = value;
114452
- if (typeof maybeArrayBufferLike.arrayBuffer === "function") {
114453
- const result = maybeArrayBufferLike.arrayBuffer();
114454
- return result instanceof Promise ? await result : result;
114455
- }
114456
- }
114457
- throw new Error("Expected ArrayBuffer, ArrayBufferView, or Buffer-compatible object");
114458
- };
114459
114635
 
114460
114636
  // cli/build/svg-to-png.ts
114461
114637
  import { Resvg } from "@resvg/resvg-js";
@@ -114545,7 +114721,7 @@ var writeSimulationSvgAssetsFromCircuitJson = (circuitJson, outputDir, imageForm
114545
114721
  var writeGlbFromCircuitJson = async (circuitJson, glbOutputPath) => {
114546
114722
  const circuitJsonWithFileUrls = convertModelUrlsToFileUrls(circuitJson);
114547
114723
  const glbBuffer = await convertCircuitJsonToGltf2(circuitJsonWithFileUrls, getCircuitJsonToGltfOptions({ format: "glb" }));
114548
- const glbData = normalizeToUint8Array2(glbBuffer);
114724
+ const glbData = normalizeToUint8Array3(glbBuffer);
114549
114725
  fs29.mkdirSync(path32.dirname(glbOutputPath), { recursive: true });
114550
114726
  fs29.writeFileSync(glbOutputPath, Buffer.from(glbData));
114551
114727
  };
@@ -114575,11 +114751,8 @@ var writeImageAssetsFromCircuitJson = async (circuitJson, options) => {
114575
114751
  }
114576
114752
  writeSimulationSvgAssetsFromCircuitJson(circuitJson, outputDir, imageFormats);
114577
114753
  if (imageFormats.threeDPngs) {
114578
- const circuitJsonWithFileUrls = convertModelUrlsToFileUrls(circuitJson);
114579
- const glbBuffer = await convertCircuitJsonToGltf2(circuitJsonWithFileUrls, getCircuitJsonToGltfOptions({ format: "glb" }));
114580
- const glbArrayBuffer = await normalizeToArrayBuffer(glbBuffer);
114581
- const pngBuffer = await renderGLTFToPNGFromGLB(glbArrayBuffer, getBestCameraPosition(circuitJson));
114582
- fs29.writeFileSync(path32.join(outputDir, "3d.png"), Buffer.from(normalizeToUint8Array2(pngBuffer)));
114754
+ const pngBuffer = await renderCircuitJsonTo3dPng(circuitJson);
114755
+ fs29.writeFileSync(path32.join(outputDir, "3d.png"), Buffer.from(pngBuffer));
114583
114756
  }
114584
114757
  };
114585
114758
 
@@ -114667,48 +114840,10 @@ var buildPreviewGltf = async ({
114667
114840
  // cli/build/build-preview-images.ts
114668
114841
  import fs32 from "node:fs";
114669
114842
  import path35 from "node:path";
114670
- import {
114671
- convertCircuitJsonToGltf as convertCircuitJsonToGltf4,
114672
- getBestCameraPosition as getBestCameraPosition2
114673
- } from "circuit-json-to-gltf";
114674
114843
  import {
114675
114844
  convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg2,
114676
114845
  convertCircuitJsonToSchematicSvg as convertCircuitJsonToSchematicSvg2
114677
114846
  } from "circuit-to-svg";
114678
- import { renderGLTFToPNGFromGLB as renderGLTFToPNGFromGLB2 } from "poppygl";
114679
- var viewToArrayBuffer3 = (view) => {
114680
- const copy = new Uint8Array(view.byteLength);
114681
- copy.set(new Uint8Array(view.buffer, view.byteOffset, view.byteLength));
114682
- return copy.buffer;
114683
- };
114684
- var normalizeToArrayBuffer2 = async (value) => {
114685
- if (value instanceof ArrayBuffer) {
114686
- return value;
114687
- }
114688
- if (ArrayBuffer.isView(value)) {
114689
- return viewToArrayBuffer3(value);
114690
- }
114691
- if (value && typeof value === "object") {
114692
- const maybeArrayBufferLike = value;
114693
- if (typeof maybeArrayBufferLike.arrayBuffer === "function") {
114694
- const result = maybeArrayBufferLike.arrayBuffer();
114695
- return result instanceof Promise ? await result : result;
114696
- }
114697
- }
114698
- throw new Error("Expected ArrayBuffer, ArrayBufferView, or Buffer-compatible object");
114699
- };
114700
- var normalizeToUint8Array3 = (value) => {
114701
- if (value instanceof Uint8Array) {
114702
- return value;
114703
- }
114704
- if (value instanceof ArrayBuffer) {
114705
- return new Uint8Array(value);
114706
- }
114707
- if (ArrayBuffer.isView(value)) {
114708
- return new Uint8Array(viewToArrayBuffer3(value));
114709
- }
114710
- throw new Error("Expected Uint8Array, ArrayBuffer, or ArrayBufferView for PNG");
114711
- };
114712
114847
  var generatePreviewAssets = async ({
114713
114848
  build,
114714
114849
  outputDir,
@@ -114774,13 +114909,9 @@ var generatePreviewAssets = async ({
114774
114909
  }
114775
114910
  if (imageFormats.threeDPngs) {
114776
114911
  try {
114777
- console.log(`${prefix}Converting circuit to GLB...`);
114778
- const circuitJsonWithFileUrls = convertModelUrlsToFileUrls(circuitJson);
114779
- const glbBuffer = await convertCircuitJsonToGltf4(circuitJsonWithFileUrls, getCircuitJsonToGltfOptions({ format: "glb" }));
114780
- console.log(`${prefix}Rendering GLB to PNG buffer...`);
114781
- const glbArrayBuffer = await normalizeToArrayBuffer2(glbBuffer);
114782
- const pngBuffer = await renderGLTFToPNGFromGLB2(glbArrayBuffer, getBestCameraPosition2(circuitJson));
114783
- fs32.writeFileSync(path35.join(outputDir, "3d.png"), Buffer.from(normalizeToUint8Array3(pngBuffer)));
114912
+ console.log(`${prefix}Generating 3D PNG...`);
114913
+ const pngBuffer = await renderCircuitJsonTo3dPng(circuitJson);
114914
+ fs32.writeFileSync(path35.join(outputDir, "3d.png"), Buffer.from(pngBuffer));
114784
114915
  console.log(`${prefix}Written 3d.png`);
114785
114916
  } catch (error) {
114786
114917
  console.error(`${prefix}Failed to generate 3D PNG:`, error);
@@ -117414,8 +117545,8 @@ var isOffBoardEdgeOffset = (boardEdge, offset) => {
117414
117545
  }
117415
117546
  return offset > 0;
117416
117547
  };
117417
- var getComponentToComponentCalcString = (componentName, otherComponentName, direction, distance) => {
117418
- const d = fmtMm(distance);
117548
+ var getComponentToComponentCalcString = (componentName, otherComponentName, direction, distance2) => {
117549
+ const d = fmtMm(distance2);
117419
117550
  switch (direction) {
117420
117551
  case "right":
117421
117552
  return `${componentName}.pcbLeftEdgeX=calc(${otherComponentName}.maxX+${d})`;
@@ -117427,8 +117558,8 @@ var getComponentToComponentCalcString = (componentName, otherComponentName, dire
117427
117558
  return `${componentName}.pcbBottomEdgeY=calc(${otherComponentName}.maxY+${d})`;
117428
117559
  }
117429
117560
  };
117430
- var getComponentToBoardCalcString = (componentName, direction, distance) => {
117431
- const d = fmtMm(distance);
117561
+ var getComponentToBoardCalcString = (componentName, direction, distance2) => {
117562
+ const d = fmtMm(distance2);
117432
117563
  switch (direction) {
117433
117564
  case "right":
117434
117565
  return `${componentName}.centerX=calc(board.centerX+${d})`;
@@ -118084,9 +118215,9 @@ var getSeparationSuggestion = (a, b, overlapX, overlapY, preferredMover) => {
118084
118215
  }
118085
118216
  const { mover, anchor } = chooseMover(a, b, preferredMover);
118086
118217
  const axis = overlapX <= overlapY ? "x" : "y";
118087
- const distance = axis === "x" ? overlapX : overlapY;
118218
+ const distance2 = axis === "x" ? overlapX : overlapY;
118088
118219
  const direction = getMoveDirectionBetweenComponents(mover, anchor, axis);
118089
- return `move ${mover.name} ${fmtMm2(distance)} ${direction}`;
118220
+ return `move ${mover.name} ${fmtMm2(distance2)} ${direction}`;
118090
118221
  };
118091
118222
  var getCountainmentBonus = (a, b) => {
118092
118223
  if (!a.bounds || !b.bounds || a.centerX === null || a.centerY === null)
@@ -168891,8 +169022,8 @@ var passive_def = base_def.extend({
168891
169022
  p: length.optional(),
168892
169023
  pw: length.optional(),
168893
169024
  ph: length.optional(),
168894
- metric: distance.optional(),
168895
- imperial: distance.optional(),
169025
+ metric: distance2.optional(),
169026
+ imperial: distance2.optional(),
168896
169027
  w: length.optional(),
168897
169028
  h: length.optional(),
168898
169029
  textbottom: external_exports.boolean().optional()
@@ -169308,7 +169439,7 @@ var bga_def = base_def.extend({
169308
169439
  fn: external_exports.string(),
169309
169440
  num_pins: external_exports.number().optional().default(64),
169310
169441
  grid: dim2d.optional(),
169311
- p: distance.default("0.8mm"),
169442
+ p: distance2.default("0.8mm"),
169312
169443
  w: length.optional(),
169313
169444
  h: length.optional(),
169314
169445
  ball: length.optional().describe("ball diameter"),
@@ -174690,7 +174821,7 @@ var getSonPadCoord = (num_pins, pn22, w22, p3) => {
174690
174821
  var vson_def = base_def.extend({
174691
174822
  fn: external_exports.string(),
174692
174823
  num_pins: external_exports.number().optional().default(8),
174693
- p: distance.describe("pitch (distance between center of each pin)"),
174824
+ p: distance2.describe("pitch (distance between center of each pin)"),
174694
174825
  w: length.describe("width between vertical rows of pins"),
174695
174826
  grid: dim2d.describe("width and height of the border of the footprint"),
174696
174827
  ep: dim2d.default("0x0mm").describe("width and height of the central exposed thermal pad"),
@@ -176725,16 +176856,16 @@ function segmentsDistance2(a12, a2, b12, b22) {
176725
176856
  function pointToSegmentDistance2(p3, v3, w22) {
176726
176857
  const l22 = (w22.x - v3.x) ** 2 + (w22.y - v3.y) ** 2;
176727
176858
  if (l22 === 0)
176728
- return distance22(p3, v3);
176859
+ return distance23(p3, v3);
176729
176860
  let t17 = ((p3.x - v3.x) * (w22.x - v3.x) + (p3.y - v3.y) * (w22.y - v3.y)) / l22;
176730
176861
  t17 = Math.max(0, Math.min(1, t17));
176731
176862
  const projection = {
176732
176863
  x: v3.x + t17 * (w22.x - v3.x),
176733
176864
  y: v3.y + t17 * (w22.y - v3.y)
176734
176865
  };
176735
- return distance22(p3, projection);
176866
+ return distance23(p3, projection);
176736
176867
  }
176737
- function distance22(p12, p22) {
176868
+ function distance23(p12, p22) {
176738
176869
  const dx2 = p12.x - p22.x;
176739
176870
  const dy2 = p12.y - p22.y;
176740
176871
  return Math.sqrt(dx2 * dx2 + dy2 * dy2);
@@ -176942,12 +177073,12 @@ function segmentToBoundsMinDistance(a2, b22, bounds) {
176942
177073
  if (a2.x < bounds.minX || a2.x > bounds.maxX || a2.y < bounds.minY || a2.y > bounds.maxY) {
176943
177074
  const closestX = clamp(a2.x, bounds.minX, bounds.maxX);
176944
177075
  const closestY = clamp(a2.y, bounds.minY, bounds.maxY);
176945
- distances.push(distance22(a2, { x: closestX, y: closestY }));
177076
+ distances.push(distance23(a2, { x: closestX, y: closestY }));
176946
177077
  }
176947
177078
  if (b22.x < bounds.minX || b22.x > bounds.maxX || b22.y < bounds.minY || b22.y > bounds.maxY) {
176948
177079
  const closestX = clamp(b22.x, bounds.minX, bounds.maxX);
176949
177080
  const closestY = clamp(b22.y, bounds.minY, bounds.maxY);
176950
- distances.push(distance22(b22, { x: closestX, y: closestY }));
177081
+ distances.push(distance23(b22, { x: closestX, y: closestY }));
176951
177082
  }
176952
177083
  return Math.min(...distances);
176953
177084
  }
@@ -176965,7 +177096,7 @@ function segmentToBoxMinDistance(a2, b22, box2) {
176965
177096
  function segmentToCircleMinDistance(a2, b22, circle2) {
176966
177097
  const circleCenter = { x: circle2.x, y: circle2.y };
176967
177098
  if (a2.x === b22.x && a2.y === b22.y) {
176968
- return Math.max(0, distance22(a2, circleCenter) - circle2.radius);
177099
+ return Math.max(0, distance23(a2, circleCenter) - circle2.radius);
176969
177100
  }
176970
177101
  const ab = { x: b22.x - a2.x, y: b22.y - a2.y };
176971
177102
  const ac22 = { x: circleCenter.x - a2.x, y: circleCenter.y - a2.y };
@@ -176975,7 +177106,7 @@ function segmentToCircleMinDistance(a2, b22, circle2) {
176975
177106
  x: a2.x + t17 * ab.x,
176976
177107
  y: a2.y + t17 * ab.y
176977
177108
  };
176978
- const distToCenter = distance22(closestPoint, circleCenter);
177109
+ const distToCenter = distance23(closestPoint, circleCenter);
176979
177110
  return Math.max(0, distToCenter - circle2.radius);
176980
177111
  }
176981
177112
  var getUnitVectorFromPointAToB = (a2, b22) => {
@@ -178857,12 +178988,12 @@ expectTypesMatch2(true);
178857
178988
  var portHints = external_exports.array(external_exports.string().or(external_exports.number()));
178858
178989
  expectTypesMatch2(true);
178859
178990
  var calcString = external_exports.string().regex(/^calc\(.*\)$/);
178860
- var distance3 = distance;
178861
- var pcbCoordinate = calcString.or(distance);
178991
+ var distance3 = distance2;
178992
+ var pcbCoordinate = calcString.or(distance2);
178862
178993
  var point32 = external_exports.object({
178863
- x: distance,
178864
- y: distance,
178865
- z: distance
178994
+ x: distance2,
178995
+ y: distance2,
178996
+ z: distance2
178866
178997
  });
178867
178998
  var url = external_exports.preprocess((value) => {
178868
178999
  if (value && typeof value === "object" && "default" in value) {
@@ -178935,8 +179066,8 @@ var cadModelProp = external_exports.union([
178935
179066
  expectTypesMatch2(true);
178936
179067
  var footprintProp = external_exports.custom((v3) => true);
178937
179068
  var point2 = external_exports.object({
178938
- x: distance,
178939
- y: distance
179069
+ x: distance2,
179070
+ y: distance2
178940
179071
  });
178941
179072
  var kicadAt2 = point2.extend({
178942
179073
  rotation: rotation.optional()
@@ -178944,7 +179075,7 @@ var kicadAt2 = point2.extend({
178944
179075
  expectTypesMatch2(true);
178945
179076
  var kicadFont2 = external_exports.object({
178946
179077
  size: point2.optional(),
178947
- thickness: distance.optional()
179078
+ thickness: distance2.optional()
178948
179079
  });
178949
179080
  expectTypesMatch2(true);
178950
179081
  var kicadEffects2 = external_exports.object({
@@ -178980,7 +179111,7 @@ var kicadFootprintPad2 = external_exports.object({
178980
179111
  shape: external_exports.string().optional(),
178981
179112
  at: kicadAt2.optional(),
178982
179113
  size: point2.optional(),
178983
- drill: distance.optional(),
179114
+ drill: distance2.optional(),
178984
179115
  layers: external_exports.array(external_exports.string()).optional(),
178985
179116
  removeUnusedLayers: external_exports.boolean().optional(),
178986
179117
  uuid: external_exports.string().optional()
@@ -179011,7 +179142,7 @@ var kicadSymbolPinNumbers2 = external_exports.object({
179011
179142
  });
179012
179143
  expectTypesMatch2(true);
179013
179144
  var kicadSymbolPinNames2 = external_exports.object({
179014
- offset: distance.optional(),
179145
+ offset: distance2.optional(),
179015
179146
  hide: external_exports.boolean().optional()
179016
179147
  });
179017
179148
  expectTypesMatch2(true);
@@ -179051,9 +179182,9 @@ var kicadSymbolMetadata2 = external_exports.object({
179051
179182
  });
179052
179183
  expectTypesMatch2(true);
179053
179184
  var pcbStyle = external_exports.object({
179054
- silkscreenFontSize: distance.optional(),
179055
- viaPadDiameter: distance.optional(),
179056
- viaHoleDiameter: distance.optional(),
179185
+ silkscreenFontSize: distance2.optional(),
179186
+ viaPadDiameter: distance2.optional(),
179187
+ viaHoleDiameter: distance2.optional(),
179057
179188
  silkscreenTextPosition: external_exports.union([
179058
179189
  external_exports.enum(["centered", "outside", "none"]),
179059
179190
  external_exports.object({
@@ -179112,7 +179243,7 @@ var pinAttributeMap = external_exports.object({
179112
179243
  });
179113
179244
  expectTypesMatch2(true);
179114
179245
  var schStyle = external_exports.object({
179115
- defaultPassiveSize: external_exports.union([external_exports.enum(["xs", "sm", "md"]), distance]).optional(),
179246
+ defaultPassiveSize: external_exports.union([external_exports.enum(["xs", "sm", "md"]), distance2]).optional(),
179116
179247
  defaultCapacitorOrientation: external_exports.enum(["vertical", "none"]).optional()
179117
179248
  });
179118
179249
  expectTypesMatch2(true);
@@ -179124,8 +179255,8 @@ var pcbLayoutProps = external_exports.object({
179124
179255
  pcbRightEdgeX: pcbCoordinate.optional(),
179125
179256
  pcbTopEdgeY: pcbCoordinate.optional(),
179126
179257
  pcbBottomEdgeY: pcbCoordinate.optional(),
179127
- pcbOffsetX: distance.optional(),
179128
- pcbOffsetY: distance.optional(),
179258
+ pcbOffsetX: distance2.optional(),
179259
+ pcbOffsetY: distance2.optional(),
179129
179260
  pcbRotation: rotation.optional(),
179130
179261
  pcbPositionAnchor: external_exports.string().optional(),
179131
179262
  pcbPositionMode: external_exports.enum([
@@ -179136,12 +179267,12 @@ var pcbLayoutProps = external_exports.object({
179136
179267
  ]).optional(),
179137
179268
  shouldBeOnEdgeOfBoard: external_exports.boolean().optional(),
179138
179269
  layer: layer_ref.optional(),
179139
- pcbMarginTop: distance.optional(),
179140
- pcbMarginRight: distance.optional(),
179141
- pcbMarginBottom: distance.optional(),
179142
- pcbMarginLeft: distance.optional(),
179143
- pcbMarginX: distance.optional(),
179144
- pcbMarginY: distance.optional(),
179270
+ pcbMarginTop: distance2.optional(),
179271
+ pcbMarginRight: distance2.optional(),
179272
+ pcbMarginBottom: distance2.optional(),
179273
+ pcbMarginLeft: distance2.optional(),
179274
+ pcbMarginX: distance2.optional(),
179275
+ pcbMarginY: distance2.optional(),
179145
179276
  pcbStyle: pcbStyle.optional(),
179146
179277
  pcbSx: pcbSx.optional(),
179147
179278
  pcbRelative: external_exports.boolean().optional(),
@@ -179155,8 +179286,8 @@ var commonLayoutProps = external_exports.object({
179155
179286
  pcbRightEdgeX: pcbCoordinate.optional(),
179156
179287
  pcbTopEdgeY: pcbCoordinate.optional(),
179157
179288
  pcbBottomEdgeY: pcbCoordinate.optional(),
179158
- pcbOffsetX: distance.optional(),
179159
- pcbOffsetY: distance.optional(),
179289
+ pcbOffsetX: distance2.optional(),
179290
+ pcbOffsetY: distance2.optional(),
179160
179291
  pcbRotation: rotation.optional(),
179161
179292
  pcbPositionAnchor: external_exports.string().optional(),
179162
179293
  pcbPositionMode: external_exports.enum([
@@ -179166,22 +179297,22 @@ var commonLayoutProps = external_exports.object({
179166
179297
  "relative_to_component_anchor"
179167
179298
  ]).optional(),
179168
179299
  shouldBeOnEdgeOfBoard: external_exports.boolean().optional(),
179169
- pcbMarginTop: distance.optional(),
179170
- pcbMarginRight: distance.optional(),
179171
- pcbMarginBottom: distance.optional(),
179172
- pcbMarginLeft: distance.optional(),
179173
- pcbMarginX: distance.optional(),
179174
- pcbMarginY: distance.optional(),
179300
+ pcbMarginTop: distance2.optional(),
179301
+ pcbMarginRight: distance2.optional(),
179302
+ pcbMarginBottom: distance2.optional(),
179303
+ pcbMarginLeft: distance2.optional(),
179304
+ pcbMarginX: distance2.optional(),
179305
+ pcbMarginY: distance2.optional(),
179175
179306
  pcbStyle: pcbStyle.optional(),
179176
179307
  pcbSx: pcbSx.optional(),
179177
- schMarginTop: distance.optional(),
179178
- schMarginRight: distance.optional(),
179179
- schMarginBottom: distance.optional(),
179180
- schMarginLeft: distance.optional(),
179181
- schMarginX: distance.optional(),
179182
- schMarginY: distance.optional(),
179183
- schX: distance.optional(),
179184
- schY: distance.optional(),
179308
+ schMarginTop: distance2.optional(),
179309
+ schMarginRight: distance2.optional(),
179310
+ schMarginBottom: distance2.optional(),
179311
+ schMarginLeft: distance2.optional(),
179312
+ schMarginX: distance2.optional(),
179313
+ schMarginY: distance2.optional(),
179314
+ schX: distance2.optional(),
179315
+ schY: distance2.optional(),
179185
179316
  schRotation: rotation.optional(),
179186
179317
  layer: layer_ref.optional(),
179187
179318
  footprint: footprintProp.optional(),
@@ -179226,7 +179357,7 @@ var lrPolarPins = [
179226
179357
  "cathode",
179227
179358
  "neg"
179228
179359
  ];
179229
- var distanceOrMultiplier = distance.or(external_exports.enum(["2x", "3x", "4x"]));
179360
+ var distanceOrMultiplier = distance2.or(external_exports.enum(["2x", "3x", "4x"]));
179230
179361
  var kicadFootprintKeys = [
179231
179362
  "Audio_Module/Reverb_BTDR-1H",
179232
179363
  "Audio_Module/Reverb_BTDR-1V",
@@ -194702,18 +194833,18 @@ var schematicPortArrangement = external_exports.object({
194702
194833
  var schematicPinArrangement = schematicPortArrangement;
194703
194834
  expectTypesMatch2(true);
194704
194835
  var schematicPinStyle = external_exports.record(external_exports.object({
194705
- marginLeft: distance.optional(),
194706
- marginRight: distance.optional(),
194707
- marginTop: distance.optional(),
194708
- marginBottom: distance.optional(),
194709
- leftMargin: distance.optional(),
194710
- rightMargin: distance.optional(),
194711
- topMargin: distance.optional(),
194712
- bottomMargin: distance.optional()
194836
+ marginLeft: distance2.optional(),
194837
+ marginRight: distance2.optional(),
194838
+ marginTop: distance2.optional(),
194839
+ marginBottom: distance2.optional(),
194840
+ leftMargin: distance2.optional(),
194841
+ rightMargin: distance2.optional(),
194842
+ topMargin: distance2.optional(),
194843
+ bottomMargin: distance2.optional()
194713
194844
  }));
194714
194845
  expectTypesMatch2(true);
194715
194846
  var schematicPinLabel = external_exports.string().regex(/^[A-Za-z0-9_]+$/);
194716
- var schematicSymbolSize = distance.or(external_exports.enum(["xs", "sm", "default", "md"])).describe("distance between pin1 and pin2 of the schematic symbol");
194847
+ var schematicSymbolSize = distance2.or(external_exports.enum(["xs", "sm", "default", "md"])).describe("distance between pin1 and pin2 of the schematic symbol");
194717
194848
  var kicadPinElectricalType = external_exports.enum([
194718
194849
  "input",
194719
194850
  "output",
@@ -195030,7 +195161,7 @@ var subcircuitGroupProps = baseGroupProps.extend({
195030
195161
  manualEdits: manual_edits_file.optional(),
195031
195162
  schAutoLayoutEnabled: external_exports.boolean().optional(),
195032
195163
  schTraceAutoLabelEnabled: external_exports.boolean().optional(),
195033
- schMaxTraceDistance: distance.optional(),
195164
+ schMaxTraceDistance: distance2.optional(),
195034
195165
  routingDisabled: external_exports.boolean().optional(),
195035
195166
  bomDisabled: external_exports.boolean().optional(),
195036
195167
  defaultTraceWidth: length.optional(),
@@ -195045,11 +195176,11 @@ var subcircuitGroupProps = baseGroupProps.extend({
195045
195176
  square: external_exports.boolean().optional(),
195046
195177
  emptyArea: external_exports.string().optional(),
195047
195178
  filledArea: external_exports.string().optional(),
195048
- width: distance.optional(),
195049
- height: distance.optional(),
195179
+ width: distance2.optional(),
195180
+ height: distance2.optional(),
195050
195181
  outline: external_exports.array(point2).optional(),
195051
- outlineOffsetX: distance.optional(),
195052
- outlineOffsetY: distance.optional(),
195182
+ outlineOffsetX: distance2.optional(),
195183
+ outlineOffsetY: distance2.optional(),
195053
195184
  circuitJson: external_exports.array(external_exports.any()).optional()
195054
195185
  });
195055
195186
  var subcircuitGroupPropsWithBool = subcircuitGroupProps.extend({
@@ -195121,11 +195252,11 @@ expectTypesMatch2(true);
195121
195252
  var subpanelProps = panelProps;
195122
195253
  expectTypesMatch2(true);
195123
195254
  var breakoutProps = subcircuitGroupProps.extend({
195124
- padding: distance.optional(),
195125
- paddingLeft: distance.optional(),
195126
- paddingRight: distance.optional(),
195127
- paddingTop: distance.optional(),
195128
- paddingBottom: distance.optional()
195255
+ padding: distance2.optional(),
195256
+ paddingLeft: distance2.optional(),
195257
+ paddingRight: distance2.optional(),
195258
+ paddingTop: distance2.optional(),
195259
+ paddingBottom: distance2.optional()
195129
195260
  });
195130
195261
  expectTypesMatch2(true);
195131
195262
  var connectionTarget2 = external_exports.string().or(external_exports.array(external_exports.string()).readonly()).or(external_exports.array(external_exports.string()));
@@ -195147,9 +195278,9 @@ var chipProps = commonComponentProps.extend({
195147
195278
  schPortArrangement: schematicPortArrangement.optional(),
195148
195279
  pinCompatibleVariants: external_exports.array(pinCompatibleVariant).optional(),
195149
195280
  schPinStyle: schematicPinStyle.optional(),
195150
- schPinSpacing: distance.optional(),
195151
- schWidth: distance.optional(),
195152
- schHeight: distance.optional(),
195281
+ schPinSpacing: distance2.optional(),
195282
+ schWidth: distance2.optional(),
195283
+ schHeight: distance2.optional(),
195153
195284
  noSchematicRepresentation: external_exports.boolean().optional(),
195154
195285
  connections: connectionsProp.optional()
195155
195286
  });
@@ -195160,9 +195291,9 @@ var jumperProps = commonComponentProps.extend({
195160
195291
  manufacturerPartNumber: external_exports.string().optional(),
195161
195292
  pinLabels: external_exports.record(external_exports.number().or(schematicPinLabel), schematicPinLabel.or(external_exports.array(schematicPinLabel))).optional(),
195162
195293
  schPinStyle: schematicPinStyle.optional(),
195163
- schPinSpacing: distance.optional(),
195164
- schWidth: distance.optional(),
195165
- schHeight: distance.optional(),
195294
+ schPinSpacing: distance2.optional(),
195295
+ schWidth: distance2.optional(),
195296
+ schHeight: distance2.optional(),
195166
195297
  schDirection: external_exports.enum(["left", "right"]).optional(),
195167
195298
  schPinArrangement: schematicPinArrangement.optional(),
195168
195299
  schPortArrangement: schematicPortArrangement.optional(),
@@ -195181,9 +195312,9 @@ var connectorProps = commonComponentProps.extend({
195181
195312
  manufacturerPartNumber: external_exports.string().optional(),
195182
195313
  pinLabels: external_exports.record(external_exports.number().or(schematicPinLabel), schematicPinLabel.or(external_exports.array(schematicPinLabel))).optional(),
195183
195314
  schPinStyle: schematicPinStyle.optional(),
195184
- schPinSpacing: distance.optional(),
195185
- schWidth: distance.optional(),
195186
- schHeight: distance.optional(),
195315
+ schPinSpacing: distance2.optional(),
195316
+ schWidth: distance2.optional(),
195317
+ schHeight: distance2.optional(),
195187
195318
  schDirection: external_exports.enum(["left", "right"]).optional(),
195188
195319
  schPortArrangement: schematicPortArrangement.optional(),
195189
195320
  internallyConnectedPins: external_exports.array(external_exports.array(external_exports.union([external_exports.string(), external_exports.number()]))).optional(),
@@ -195243,32 +195374,32 @@ var inferPlatedHoleShapeAndDefaults = (rawProps) => {
195243
195374
  var distanceHiddenUndefined = external_exports.custom().transform((a2) => {
195244
195375
  if (a2 === undefined)
195245
195376
  return;
195246
- return distance.parse(a2);
195377
+ return distance2.parse(a2);
195247
195378
  });
195248
195379
  var platedHolePropsByShape = external_exports.discriminatedUnion("shape", [
195249
195380
  pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
195250
195381
  name: external_exports.string().optional(),
195251
195382
  connectsTo: external_exports.string().or(external_exports.array(external_exports.string())).optional(),
195252
195383
  shape: external_exports.literal("circle"),
195253
- holeDiameter: distance,
195254
- outerDiameter: distance,
195255
- padDiameter: distance.optional().describe("Diameter of the copper pad"),
195384
+ holeDiameter: distance2,
195385
+ outerDiameter: distance2,
195386
+ padDiameter: distance2.optional().describe("Diameter of the copper pad"),
195256
195387
  portHints: portHints.optional(),
195257
- solderMaskMargin: distance.optional(),
195388
+ solderMaskMargin: distance2.optional(),
195258
195389
  coveredWithSolderMask: external_exports.boolean().optional()
195259
195390
  }),
195260
195391
  pcbLayoutProps.omit({ layer: true }).extend({
195261
195392
  name: external_exports.string().optional(),
195262
195393
  connectsTo: external_exports.string().or(external_exports.array(external_exports.string())).optional(),
195263
195394
  shape: external_exports.literal("oval"),
195264
- outerWidth: distance,
195265
- outerHeight: distance,
195395
+ outerWidth: distance2,
195396
+ outerHeight: distance2,
195266
195397
  holeWidth: distanceHiddenUndefined,
195267
195398
  holeHeight: distanceHiddenUndefined,
195268
- innerWidth: distance.optional().describe("DEPRECATED use holeWidth"),
195269
- innerHeight: distance.optional().describe("DEPRECATED use holeHeight"),
195399
+ innerWidth: distance2.optional().describe("DEPRECATED use holeWidth"),
195400
+ innerHeight: distance2.optional().describe("DEPRECATED use holeHeight"),
195270
195401
  portHints: portHints.optional(),
195271
- solderMaskMargin: distance.optional(),
195402
+ solderMaskMargin: distance2.optional(),
195272
195403
  coveredWithSolderMask: external_exports.boolean().optional()
195273
195404
  }),
195274
195405
  pcbLayoutProps.omit({ layer: true }).extend({
@@ -195276,32 +195407,32 @@ var platedHolePropsByShape = external_exports.discriminatedUnion("shape", [
195276
195407
  connectsTo: external_exports.string().or(external_exports.array(external_exports.string())).optional(),
195277
195408
  shape: external_exports.literal("pill"),
195278
195409
  rectPad: external_exports.boolean().optional(),
195279
- outerWidth: distance,
195280
- outerHeight: distance,
195410
+ outerWidth: distance2,
195411
+ outerHeight: distance2,
195281
195412
  holeWidth: distanceHiddenUndefined,
195282
195413
  holeHeight: distanceHiddenUndefined,
195283
- innerWidth: distance.optional().describe("DEPRECATED use holeWidth"),
195284
- innerHeight: distance.optional().describe("DEPRECATED use holeHeight"),
195414
+ innerWidth: distance2.optional().describe("DEPRECATED use holeWidth"),
195415
+ innerHeight: distance2.optional().describe("DEPRECATED use holeHeight"),
195285
195416
  portHints: portHints.optional(),
195286
- holeOffsetX: distance.optional(),
195287
- holeOffsetY: distance.optional(),
195288
- solderMaskMargin: distance.optional(),
195417
+ holeOffsetX: distance2.optional(),
195418
+ holeOffsetY: distance2.optional(),
195419
+ solderMaskMargin: distance2.optional(),
195289
195420
  coveredWithSolderMask: external_exports.boolean().optional()
195290
195421
  }),
195291
195422
  pcbLayoutProps.omit({ layer: true }).extend({
195292
195423
  name: external_exports.string().optional(),
195293
195424
  connectsTo: external_exports.string().or(external_exports.array(external_exports.string())).optional(),
195294
195425
  shape: external_exports.literal("circular_hole_with_rect_pad"),
195295
- holeDiameter: distance,
195296
- rectPadWidth: distance,
195297
- rectPadHeight: distance,
195298
- rectBorderRadius: distance.optional(),
195426
+ holeDiameter: distance2,
195427
+ rectPadWidth: distance2,
195428
+ rectPadHeight: distance2,
195429
+ rectBorderRadius: distance2.optional(),
195299
195430
  holeShape: external_exports.literal("circle").optional(),
195300
195431
  padShape: external_exports.literal("rect").optional(),
195301
195432
  portHints: portHints.optional(),
195302
- holeOffsetX: distance.optional(),
195303
- holeOffsetY: distance.optional(),
195304
- solderMaskMargin: distance.optional(),
195433
+ holeOffsetX: distance2.optional(),
195434
+ holeOffsetY: distance2.optional(),
195435
+ solderMaskMargin: distance2.optional(),
195305
195436
  coveredWithSolderMask: external_exports.boolean().optional()
195306
195437
  }),
195307
195438
  pcbLayoutProps.omit({ layer: true }).extend({
@@ -195310,14 +195441,14 @@ var platedHolePropsByShape = external_exports.discriminatedUnion("shape", [
195310
195441
  shape: external_exports.literal("pill_hole_with_rect_pad"),
195311
195442
  holeShape: external_exports.literal("pill").optional(),
195312
195443
  padShape: external_exports.literal("rect").optional(),
195313
- holeWidth: distance,
195314
- holeHeight: distance,
195315
- rectPadWidth: distance,
195316
- rectPadHeight: distance,
195444
+ holeWidth: distance2,
195445
+ holeHeight: distance2,
195446
+ rectPadWidth: distance2,
195447
+ rectPadHeight: distance2,
195317
195448
  portHints: portHints.optional(),
195318
- holeOffsetX: distance.optional(),
195319
- holeOffsetY: distance.optional(),
195320
- solderMaskMargin: distance.optional(),
195449
+ holeOffsetX: distance2.optional(),
195450
+ holeOffsetY: distance2.optional(),
195451
+ solderMaskMargin: distance2.optional(),
195321
195452
  coveredWithSolderMask: external_exports.boolean().optional()
195322
195453
  }),
195323
195454
  pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
@@ -195325,14 +195456,14 @@ var platedHolePropsByShape = external_exports.discriminatedUnion("shape", [
195325
195456
  connectsTo: external_exports.string().or(external_exports.array(external_exports.string())).optional(),
195326
195457
  shape: external_exports.literal("hole_with_polygon_pad"),
195327
195458
  holeShape: external_exports.enum(["circle", "oval", "pill", "rotated_pill"]),
195328
- holeDiameter: distance.optional(),
195329
- holeWidth: distance.optional(),
195330
- holeHeight: distance.optional(),
195459
+ holeDiameter: distance2.optional(),
195460
+ holeWidth: distance2.optional(),
195461
+ holeHeight: distance2.optional(),
195331
195462
  padOutline: external_exports.array(point2),
195332
- holeOffsetX: distance,
195333
- holeOffsetY: distance,
195463
+ holeOffsetX: distance2,
195464
+ holeOffsetY: distance2,
195334
195465
  portHints: portHints.optional(),
195335
- solderMaskMargin: distance.optional(),
195466
+ solderMaskMargin: distance2.optional(),
195336
195467
  coveredWithSolderMask: external_exports.boolean().optional()
195337
195468
  })
195338
195469
  ]).transform((a2) => {
@@ -195401,7 +195532,7 @@ var stampboardProps = boardProps.extend({
195401
195532
  rightPins: external_exports.array(external_exports.string()).optional(),
195402
195533
  topPins: external_exports.array(external_exports.string()).optional(),
195403
195534
  bottomPins: external_exports.array(external_exports.string()).optional(),
195404
- pinPitch: distance.optional(),
195535
+ pinPitch: distance2.optional(),
195405
195536
  innerHoles: external_exports.boolean().optional()
195406
195537
  });
195407
195538
  expectTypesMatch2(true);
@@ -195665,8 +195796,8 @@ var pcbPathPoint = point2.extend({
195665
195796
  var pcbPath = external_exports.array(external_exports.union([pcbPathPoint, external_exports.string()]));
195666
195797
  var baseTraceProps = external_exports.object({
195667
195798
  key: external_exports.string().optional(),
195668
- thickness: distance.optional(),
195669
- width: distance.optional().describe("Alias for trace thickness"),
195799
+ thickness: distance2.optional(),
195800
+ width: distance2.optional().describe("Alias for trace thickness"),
195670
195801
  schematicRouteHints: external_exports.array(point2).optional(),
195671
195802
  pcbRouteHints: external_exports.array(route_hint_point).optional(),
195672
195803
  pcbPathRelativeTo: external_exports.string().optional(),
@@ -195676,7 +195807,7 @@ var baseTraceProps = external_exports.object({
195676
195807
  schDisplayLabel: external_exports.string().optional(),
195677
195808
  schStroke: external_exports.string().optional(),
195678
195809
  highlightColor: external_exports.string().optional(),
195679
- maxLength: distance.optional(),
195810
+ maxLength: distance2.optional(),
195680
195811
  connectsTo: external_exports.string().or(external_exports.array(external_exports.string())).optional()
195681
195812
  });
195682
195813
  var traceProps = external_exports.union([
@@ -195738,7 +195869,7 @@ var pcbOrientation = external_exports.enum(["vertical", "horizontal"]).describe(
195738
195869
  expectTypesMatch2(true);
195739
195870
  var pinHeaderProps = commonComponentProps.extend({
195740
195871
  pinCount: external_exports.number(),
195741
- pitch: distance.optional(),
195872
+ pitch: distance2.optional(),
195742
195873
  schFacingDirection: external_exports.enum(["up", "down", "left", "right"]).optional(),
195743
195874
  gender: external_exports.enum(["male", "female", "unpopulated"]).optional().default("male"),
195744
195875
  showSilkscreenPinLabels: external_exports.boolean().optional(),
@@ -195746,16 +195877,16 @@ var pinHeaderProps = commonComponentProps.extend({
195746
195877
  doubleRow: external_exports.boolean().optional(),
195747
195878
  rightAngle: external_exports.boolean().optional(),
195748
195879
  pcbOrientation: pcbOrientation.optional(),
195749
- holeDiameter: distance.optional(),
195750
- platedDiameter: distance.optional(),
195880
+ holeDiameter: distance2.optional(),
195881
+ platedDiameter: distance2.optional(),
195751
195882
  pinLabels: external_exports.record(external_exports.string(), schematicPinLabel).or(external_exports.array(schematicPinLabel)).optional(),
195752
195883
  connections: external_exports.custom().pipe(external_exports.record(external_exports.string(), connectionTarget)).optional(),
195753
195884
  facingDirection: external_exports.enum(["left", "right"]).optional(),
195754
195885
  schPinArrangement: schematicPinArrangement.optional(),
195755
195886
  schPinStyle: schematicPinStyle.optional(),
195756
- schPinSpacing: distance.optional(),
195757
- schWidth: distance.optional(),
195758
- schHeight: distance.optional()
195887
+ schPinSpacing: distance2.optional(),
195888
+ schWidth: distance2.optional(),
195889
+ schHeight: distance2.optional()
195759
195890
  });
195760
195891
  expectTypesMatch2(true);
195761
195892
  var netAliasProps = external_exports.object({
@@ -195980,14 +196111,14 @@ var fabricationNoteTextProps = pcbLayoutProps.extend({
195980
196111
  });
195981
196112
  expectTypesMatch2(true);
195982
196113
  var fabricationNoteRectProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
195983
- width: distance,
195984
- height: distance,
195985
- strokeWidth: distance.optional(),
196114
+ width: distance2,
196115
+ height: distance2,
196116
+ strokeWidth: distance2.optional(),
195986
196117
  isFilled: external_exports.boolean().optional(),
195987
196118
  hasStroke: external_exports.boolean().optional(),
195988
196119
  isStrokeDashed: external_exports.boolean().optional(),
195989
196120
  color: external_exports.string().optional(),
195990
- cornerRadius: distance.optional()
196121
+ cornerRadius: distance2.optional()
195991
196122
  });
195992
196123
  var fabricationNotePathProps = pcbLayoutProps.omit({
195993
196124
  pcbLeftEdgeX: true,
@@ -196019,11 +196150,11 @@ var fabricationNoteDimensionProps = pcbLayoutProps.omit({
196019
196150
  from: dimensionTarget,
196020
196151
  to: dimensionTarget,
196021
196152
  text: external_exports.string().optional(),
196022
- offset: distance.optional(),
196153
+ offset: distance2.optional(),
196023
196154
  font: external_exports.enum(["tscircuit2024"]).optional(),
196024
196155
  fontSize: length.optional(),
196025
196156
  color: external_exports.string().optional(),
196026
- arrowSize: distance.optional(),
196157
+ arrowSize: distance2.optional(),
196027
196158
  units: external_exports.enum(["in", "mm"]).optional(),
196028
196159
  outerEdgeToEdge: external_exports.literal(true).optional(),
196029
196160
  centerToCenter: external_exports.literal(true).optional(),
@@ -196032,15 +196163,15 @@ var fabricationNoteDimensionProps = pcbLayoutProps.omit({
196032
196163
  expectTypesMatch2(true);
196033
196164
  var pcbTraceProps = external_exports.object({
196034
196165
  layer: external_exports.string().optional(),
196035
- thickness: distance.optional(),
196166
+ thickness: distance2.optional(),
196036
196167
  route: external_exports.array(route_hint_point)
196037
196168
  });
196038
196169
  var viaProps = commonLayoutProps.extend({
196039
196170
  name: external_exports.string().optional(),
196040
196171
  fromLayer: layer_ref,
196041
196172
  toLayer: layer_ref,
196042
- holeDiameter: distance.optional(),
196043
- outerDiameter: distance.optional(),
196173
+ holeDiameter: distance2.optional(),
196174
+ outerDiameter: distance2.optional(),
196044
196175
  connectsTo: external_exports.string().or(external_exports.array(external_exports.string())).optional(),
196045
196176
  netIsAssignable: external_exports.boolean().optional()
196046
196177
  });
@@ -196052,10 +196183,10 @@ var testpointProps = commonComponentProps.extend({
196052
196183
  connections: testpointConnectionsProp.optional(),
196053
196184
  footprintVariant: external_exports.enum(["pad", "through_hole"]).optional(),
196054
196185
  padShape: external_exports.enum(["rect", "circle"]).optional().default("circle"),
196055
- padDiameter: distance.optional(),
196056
- holeDiameter: distance.optional(),
196057
- width: distance.optional(),
196058
- height: distance.optional()
196186
+ padDiameter: distance2.optional(),
196187
+ holeDiameter: distance2.optional(),
196188
+ width: distance2.optional(),
196189
+ height: distance2.optional()
196059
196190
  }).refine((props) => props.footprintVariant !== "through_hole" || props.holeDiameter !== undefined, { message: "holeDiameter is required for through_hole testpoints" });
196060
196191
  expectTypesMatch2(true);
196061
196192
  var breakoutPointProps = pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
@@ -196065,18 +196196,18 @@ expectTypesMatch2(true);
196065
196196
  var pcbKeepoutProps = external_exports.union([
196066
196197
  pcbLayoutProps.omit({ pcbRotation: true }).extend({
196067
196198
  shape: external_exports.literal("circle"),
196068
- radius: distance
196199
+ radius: distance2
196069
196200
  }),
196070
196201
  pcbLayoutProps.extend({
196071
196202
  shape: external_exports.literal("rect"),
196072
- width: distance,
196073
- height: distance
196203
+ width: distance2,
196204
+ height: distance2
196074
196205
  })
196075
196206
  ]);
196076
196207
  var courtyardRectProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
196077
- width: distance,
196078
- height: distance,
196079
- strokeWidth: distance.optional(),
196208
+ width: distance2,
196209
+ height: distance2,
196210
+ strokeWidth: distance2.optional(),
196080
196211
  isFilled: external_exports.boolean().optional(),
196081
196212
  hasStroke: external_exports.boolean().optional(),
196082
196213
  isStrokeDashed: external_exports.boolean().optional(),
@@ -196100,12 +196231,12 @@ var courtyardOutlineProps = pcbLayoutProps.omit({
196100
196231
  color: external_exports.string().optional()
196101
196232
  });
196102
196233
  var courtyardCircleProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
196103
- radius: distance
196234
+ radius: distance2
196104
196235
  });
196105
196236
  var courtyardPillProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
196106
- width: distance,
196107
- height: distance,
196108
- radius: distance
196237
+ width: distance2,
196238
+ height: distance2,
196239
+ radius: distance2
196109
196240
  });
196110
196241
  var copperPourProps = external_exports.object({
196111
196242
  name: external_exports.string().optional(),
@@ -196195,11 +196326,11 @@ var voltageProbeProps = commonComponentProps.omit({ name: true }).extend({
196195
196326
  expectTypesMatch2(true);
196196
196327
  var schematicArcProps = external_exports.object({
196197
196328
  center: point,
196198
- radius: distance,
196329
+ radius: distance2,
196199
196330
  startAngleDegrees: rotation,
196200
196331
  endAngleDegrees: rotation,
196201
196332
  direction: external_exports.enum(["clockwise", "counterclockwise"]).default("counterclockwise"),
196202
- strokeWidth: distance.optional(),
196333
+ strokeWidth: distance2.optional(),
196203
196334
  color: external_exports.string().optional(),
196204
196335
  isDashed: external_exports.boolean().optional().default(false)
196205
196336
  });
@@ -196209,20 +196340,20 @@ var toolingrailProps = external_exports.object({
196209
196340
  });
196210
196341
  expectTypesMatch2(true);
196211
196342
  var schematicBoxProps = external_exports.object({
196212
- schX: distance.optional(),
196213
- schY: distance.optional(),
196214
- width: distance.optional(),
196215
- height: distance.optional(),
196343
+ schX: distance2.optional(),
196344
+ schY: distance2.optional(),
196345
+ width: distance2.optional(),
196346
+ height: distance2.optional(),
196216
196347
  overlay: external_exports.array(external_exports.string()).optional(),
196217
- padding: distance.optional(),
196218
- paddingLeft: distance.optional(),
196219
- paddingRight: distance.optional(),
196220
- paddingTop: distance.optional(),
196221
- paddingBottom: distance.optional(),
196348
+ padding: distance2.optional(),
196349
+ paddingLeft: distance2.optional(),
196350
+ paddingRight: distance2.optional(),
196351
+ paddingTop: distance2.optional(),
196352
+ paddingBottom: distance2.optional(),
196222
196353
  title: external_exports.string().optional(),
196223
196354
  titleAlignment: ninePointAnchor2.default("top_left"),
196224
196355
  titleColor: external_exports.string().optional(),
196225
- titleFontSize: distance.optional(),
196356
+ titleFontSize: distance2.optional(),
196226
196357
  titleInside: external_exports.boolean().default(false),
196227
196358
  strokeStyle: external_exports.enum(["solid", "dashed"]).default("solid")
196228
196359
  }).refine((elm) => elm.width !== undefined && elm.height !== undefined || Array.isArray(elm.overlay) && elm.overlay.length > 0, {
@@ -196233,8 +196364,8 @@ var schematicBoxProps = external_exports.object({
196233
196364
  expectTypesMatch2(true);
196234
196365
  var schematicCircleProps = external_exports.object({
196235
196366
  center: point,
196236
- radius: distance,
196237
- strokeWidth: distance.optional(),
196367
+ radius: distance2,
196368
+ strokeWidth: distance2.optional(),
196238
196369
  color: external_exports.string().optional(),
196239
196370
  isFilled: external_exports.boolean().optional().default(false),
196240
196371
  fillColor: external_exports.string().optional(),
@@ -196242,25 +196373,25 @@ var schematicCircleProps = external_exports.object({
196242
196373
  });
196243
196374
  expectTypesMatch2(true);
196244
196375
  var schematicRectProps = external_exports.object({
196245
- schX: distance.optional(),
196246
- schY: distance.optional(),
196247
- width: distance,
196248
- height: distance,
196376
+ schX: distance2.optional(),
196377
+ schY: distance2.optional(),
196378
+ width: distance2,
196379
+ height: distance2,
196249
196380
  rotation: rotation.default(0),
196250
- strokeWidth: distance.optional(),
196381
+ strokeWidth: distance2.optional(),
196251
196382
  color: external_exports.string().optional(),
196252
196383
  isFilled: external_exports.boolean().optional().default(false),
196253
196384
  fillColor: external_exports.string().optional(),
196254
196385
  isDashed: external_exports.boolean().optional().default(false),
196255
- cornerRadius: distance.optional()
196386
+ cornerRadius: distance2.optional()
196256
196387
  });
196257
196388
  expectTypesMatch2(true);
196258
196389
  var schematicLineProps = external_exports.object({
196259
- x1: distance,
196260
- y1: distance,
196261
- x2: distance,
196262
- y2: distance,
196263
- strokeWidth: distance.optional(),
196390
+ x1: distance2,
196391
+ y1: distance2,
196392
+ x2: distance2,
196393
+ y2: distance2,
196394
+ strokeWidth: distance2.optional(),
196264
196395
  color: external_exports.string().optional(),
196265
196396
  isDashed: external_exports.boolean().optional().default(false)
196266
196397
  });
@@ -196273,8 +196404,8 @@ var fivePointAnchor2 = external_exports.enum([
196273
196404
  "bottom"
196274
196405
  ]);
196275
196406
  var schematicTextProps = external_exports.object({
196276
- schX: distance.optional(),
196277
- schY: distance.optional(),
196407
+ schX: distance2.optional(),
196408
+ schY: distance2.optional(),
196278
196409
  text: external_exports.string(),
196279
196410
  fontSize: external_exports.number().default(1),
196280
196411
  anchor: external_exports.union([fivePointAnchor2.describe("legacy"), ninePointAnchor2]).default("center"),
@@ -196285,35 +196416,35 @@ expectTypesMatch2(true);
196285
196416
  var schematicPathProps = external_exports.object({
196286
196417
  points: external_exports.array(point).optional(),
196287
196418
  svgPath: external_exports.string().optional(),
196288
- strokeWidth: distance.optional(),
196419
+ strokeWidth: distance2.optional(),
196289
196420
  strokeColor: external_exports.string().optional(),
196290
196421
  isFilled: external_exports.boolean().optional().default(false),
196291
196422
  fillColor: external_exports.string().optional()
196292
196423
  });
196293
196424
  expectTypesMatch2(true);
196294
196425
  var schematicTableProps = external_exports.object({
196295
- schX: distance.optional(),
196296
- schY: distance.optional(),
196426
+ schX: distance2.optional(),
196427
+ schY: distance2.optional(),
196297
196428
  children: external_exports.any().optional(),
196298
- cellPadding: distance.optional(),
196299
- borderWidth: distance.optional(),
196429
+ cellPadding: distance2.optional(),
196430
+ borderWidth: distance2.optional(),
196300
196431
  anchor: ninePointAnchor2.optional(),
196301
- fontSize: distance.optional()
196432
+ fontSize: distance2.optional()
196302
196433
  });
196303
196434
  expectTypesMatch2(true);
196304
196435
  var schematicRowProps = external_exports.object({
196305
196436
  children: external_exports.any().optional(),
196306
- height: distance.optional()
196437
+ height: distance2.optional()
196307
196438
  });
196308
196439
  expectTypesMatch2(true);
196309
196440
  var schematicCellProps = external_exports.object({
196310
196441
  children: external_exports.string().optional(),
196311
196442
  horizontalAlign: external_exports.enum(["left", "center", "right"]).optional(),
196312
196443
  verticalAlign: external_exports.enum(["top", "middle", "bottom"]).optional(),
196313
- fontSize: distance.optional(),
196444
+ fontSize: distance2.optional(),
196314
196445
  rowSpan: external_exports.number().optional(),
196315
196446
  colSpan: external_exports.number().optional(),
196316
- width: distance.optional(),
196447
+ width: distance2.optional(),
196317
196448
  text: external_exports.string().optional()
196318
196449
  });
196319
196450
  expectTypesMatch2(true);
@@ -196360,29 +196491,29 @@ var silkscreenLineProps = pcbLayoutProps.omit({
196360
196491
  pcbOffsetY: true,
196361
196492
  pcbRotation: true
196362
196493
  }).extend({
196363
- strokeWidth: distance,
196364
- x1: distance,
196365
- y1: distance,
196366
- x2: distance,
196367
- y2: distance
196494
+ strokeWidth: distance2,
196495
+ x1: distance2,
196496
+ y1: distance2,
196497
+ x2: distance2,
196498
+ y2: distance2
196368
196499
  });
196369
196500
  var silkscreenRectProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
196370
196501
  filled: external_exports.boolean().default(true).optional(),
196371
196502
  stroke: external_exports.enum(["dashed", "solid", "none"]).optional(),
196372
- strokeWidth: distance.optional(),
196373
- width: distance,
196374
- height: distance,
196375
- cornerRadius: distance.optional()
196503
+ strokeWidth: distance2.optional(),
196504
+ width: distance2,
196505
+ height: distance2,
196506
+ cornerRadius: distance2.optional()
196376
196507
  });
196377
196508
  var silkscreenCircleProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
196378
196509
  isFilled: external_exports.boolean().optional(),
196379
196510
  isOutline: external_exports.boolean().optional(),
196380
- strokeWidth: distance.optional(),
196381
- radius: distance
196511
+ strokeWidth: distance2.optional(),
196512
+ radius: distance2
196382
196513
  });
196383
196514
  var routeHintPointProps = external_exports.object({
196384
- x: distance,
196385
- y: distance,
196515
+ x: distance2,
196516
+ y: distance2,
196386
196517
  via: external_exports.boolean().optional(),
196387
196518
  toLayer: layer_ref.optional()
196388
196519
  });
@@ -196416,14 +196547,14 @@ var pcbNoteTextProps = pcbLayoutProps.extend({
196416
196547
  });
196417
196548
  expectTypesMatch2(true);
196418
196549
  var pcbNoteRectProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
196419
- width: distance,
196420
- height: distance,
196421
- strokeWidth: distance.optional(),
196550
+ width: distance2,
196551
+ height: distance2,
196552
+ strokeWidth: distance2.optional(),
196422
196553
  isFilled: external_exports.boolean().optional(),
196423
196554
  hasStroke: external_exports.boolean().optional(),
196424
196555
  isStrokeDashed: external_exports.boolean().optional(),
196425
196556
  color: external_exports.string().optional(),
196426
- cornerRadius: distance.optional()
196557
+ cornerRadius: distance2.optional()
196427
196558
  });
196428
196559
  expectTypesMatch2(true);
196429
196560
  var pcbNotePathProps = pcbLayoutProps.omit({
@@ -196453,11 +196584,11 @@ var pcbNoteLineProps = pcbLayoutProps.omit({
196453
196584
  pcbOffsetY: true,
196454
196585
  pcbRotation: true
196455
196586
  }).extend({
196456
- x1: distance,
196457
- y1: distance,
196458
- x2: distance,
196459
- y2: distance,
196460
- strokeWidth: distance.optional(),
196587
+ x1: distance2,
196588
+ y1: distance2,
196589
+ x2: distance2,
196590
+ y2: distance2,
196591
+ strokeWidth: distance2.optional(),
196461
196592
  color: external_exports.string().optional(),
196462
196593
  isDashed: external_exports.boolean().optional()
196463
196594
  });
@@ -196477,11 +196608,11 @@ var pcbNoteDimensionProps = pcbLayoutProps.omit({
196477
196608
  from: dimensionTarget2,
196478
196609
  to: dimensionTarget2,
196479
196610
  text: external_exports.string().optional(),
196480
- offset: distance.optional(),
196611
+ offset: distance2.optional(),
196481
196612
  font: external_exports.enum(["tscircuit2024"]).optional(),
196482
196613
  fontSize: length.optional(),
196483
196614
  color: external_exports.string().optional(),
196484
- arrowSize: distance.optional(),
196615
+ arrowSize: distance2.optional(),
196485
196616
  units: external_exports.enum(["in", "mm"]).optional(),
196486
196617
  outerEdgeToEdge: external_exports.literal(true).optional(),
196487
196618
  centerToCenter: external_exports.literal(true).optional(),
@@ -209315,9 +209446,9 @@ var SingleComponentPackSolver = class extends BaseSolver2 {
209315
209446
  width: p3.size.x,
209316
209447
  height: p3.size.y
209317
209448
  };
209318
- const { distance: distance23 } = computeDistanceBetweenBoxes(padBox, obsBox);
209319
- minObstacleGapDistance = Math.min(minObstacleGapDistance, distance23);
209320
- return distance23 + 0.000001 < this.minGap;
209449
+ const { distance: distance232 } = computeDistanceBetweenBoxes(padBox, obsBox);
209450
+ minObstacleGapDistance = Math.min(minObstacleGapDistance, distance232);
209451
+ return distance232 + 0.000001 < this.minGap;
209321
209452
  });
209322
209453
  });
209323
209454
  let outsideBounds = false;
@@ -225067,7 +225198,7 @@ var getStubEdges = ({
225067
225198
  });
225068
225199
  }
225069
225200
  }
225070
- edges = edges.filter((e22) => distance22(e22.from, e22.to) > 0.01);
225201
+ edges = edges.filter((e22) => distance23(e22.from, e22.to) > 0.01);
225071
225202
  return edges;
225072
225203
  };
225073
225204
  function tryNow(fn22) {
@@ -225601,7 +225732,7 @@ var createSchematicTraceCrossingSegments = ({
225601
225732
  otherEdgesIntersections.push({
225602
225733
  otherEdge,
225603
225734
  crossingPoint: crossingPoint2,
225604
- distanceFromEdgeFrom: distance22(edge.from, crossingPoint2)
225735
+ distanceFromEdgeFrom: distance23(edge.from, crossingPoint2)
225605
225736
  });
225606
225737
  }
225607
225738
  }
@@ -225627,7 +225758,7 @@ var createSchematicTraceCrossingSegments = ({
225627
225758
  x: crossingPoint.x + crossingUnitVec.x * crossingSegmentLength / 2,
225628
225759
  y: crossingPoint.y + crossingUnitVec.y * crossingSegmentLength / 2
225629
225760
  };
225630
- const overshot = distance22(afterCrossing, edge.to) < crossingSegmentLength;
225761
+ const overshot = distance23(afterCrossing, edge.to) < crossingSegmentLength;
225631
225762
  const newEdges = [
225632
225763
  { from: edge.from, to: beforeCrossing },
225633
225764
  { from: beforeCrossing, to: afterCrossing, is_crossing: true },
@@ -229885,8 +230016,8 @@ var SmtPad = class extends PrimitiveComponent2 {
229885
230016
  } else if (props.shape === "polygon") {
229886
230017
  const transformedPoints = props.points.map((point6) => {
229887
230018
  const transformed = applyToPoint24(globalTransform, {
229888
- x: distance.parse(point6.x),
229889
- y: distance.parse(point6.y)
230019
+ x: distance2.parse(point6.x),
230020
+ y: distance2.parse(point6.y)
229890
230021
  });
229891
230022
  return {
229892
230023
  x: transformed.x,
@@ -231550,7 +231681,7 @@ var CadModel = class extends PrimitiveComponent2 {
231550
231681
  z: props.pcbZ ?? 0,
231551
231682
  ...typeof props.positionOffset === "object" ? props.positionOffset : {}
231552
231683
  });
231553
- const zOffsetFromSurface = props.zOffsetFromSurface !== undefined ? distance.parse(props.zOffsetFromSurface) : 0;
231684
+ const zOffsetFromSurface = props.zOffsetFromSurface !== undefined ? distance2.parse(props.zOffsetFromSurface) : 0;
231554
231685
  const layer = parent.props.layer === "bottom" ? "bottom" : "top";
231555
231686
  const ext = props.modelUrl ? getFileExtension(props.modelUrl) : undefined;
231556
231687
  const modelUrlWithoutExtFragment = props.modelUrl?.replace(/#ext=\w+$/, "");
@@ -233196,7 +233327,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
233196
233327
  z: 0,
233197
233328
  ...typeof cadModel?.positionOffset === "object" ? cadModel.positionOffset : {}
233198
233329
  });
233199
- const zOffsetFromSurface = cadModel && typeof cadModel === "object" && "zOffsetFromSurface" in cadModel ? cadModel.zOffsetFromSurface !== undefined ? distance.parse(cadModel.zOffsetFromSurface) : 0 : 0;
233330
+ const zOffsetFromSurface = cadModel && typeof cadModel === "object" && "zOffsetFromSurface" in cadModel ? cadModel.zOffsetFromSurface !== undefined ? distance2.parse(cadModel.zOffsetFromSurface) : 0 : 0;
233200
233331
  const computedLayer = this.props.layer === "bottom" ? "bottom" : "top";
233201
233332
  const globalTransform = this._computePcbGlobalTransformBeforeLayout();
233202
233333
  const decomposedTransform = decomposeTSR(globalTransform);
@@ -238310,8 +238441,8 @@ var Group6 = class extends NormalComponent3 {
238310
238441
  const groupProps2 = props;
238311
238442
  const hasOutline = groupProps2.outline && groupProps2.outline.length > 0;
238312
238443
  const numericOutline = hasOutline ? groupProps2.outline.map((point6) => ({
238313
- x: distance.parse(point6.x),
238314
- y: distance.parse(point6.y)
238444
+ x: distance2.parse(point6.x),
238445
+ y: distance2.parse(point6.y)
238315
238446
  })) : undefined;
238316
238447
  const ctx = this.props;
238317
238448
  const anchorPosition = this._getGlobalPcbPositionBeforeLayout();
@@ -238351,8 +238482,8 @@ var Group6 = class extends NormalComponent3 {
238351
238482
  const hasExplicitPositioning = this._parsedProps.pcbX !== undefined || this._parsedProps.pcbY !== undefined;
238352
238483
  if (hasOutline) {
238353
238484
  const numericOutline = props.outline.map((point6) => ({
238354
- x: distance.parse(point6.x),
238355
- y: distance.parse(point6.y)
238485
+ x: distance2.parse(point6.x),
238486
+ y: distance2.parse(point6.y)
238356
238487
  }));
238357
238488
  const outlineBounds = getBoundsFromPoints2(numericOutline);
238358
238489
  if (!outlineBounds)
@@ -240908,8 +241039,8 @@ function generatePanelTabsAndMouseBites(boards, options) {
240908
241039
  }
240909
241040
  var getBoardDimensionsFromProps = (board) => {
240910
241041
  const props = board._parsedProps;
240911
- let width = props.width != null ? distance.parse(props.width) : undefined;
240912
- let height = props.height != null ? distance.parse(props.height) : undefined;
241042
+ let width = props.width != null ? distance2.parse(props.width) : undefined;
241043
+ let height = props.height != null ? distance2.parse(props.height) : undefined;
240913
241044
  if ((width === undefined || height === undefined) && props.outline?.length) {
240914
241045
  const outlineBounds = getBoundsFromPoints2(props.outline);
240915
241046
  if (outlineBounds) {
@@ -240949,8 +241080,8 @@ function packIntoGrid({
240949
241080
  }
240950
241081
  let cols;
240951
241082
  let rows;
240952
- const minCellWidth = cellWidth ? distance.parse(cellWidth) : 0;
240953
- const minCellHeight = cellHeight ? distance.parse(cellHeight) : 0;
241083
+ const minCellWidth = cellWidth ? distance2.parse(cellWidth) : 0;
241084
+ const minCellHeight = cellHeight ? distance2.parse(cellHeight) : 0;
240954
241085
  if (col !== undefined) {
240955
241086
  cols = col;
240956
241087
  rows = row ?? Math.ceil(itemsWithDims.length / cols);
@@ -241036,8 +241167,8 @@ function getItemDimensions(item, db) {
241036
241167
  const props = subpanel._parsedProps;
241037
241168
  if (props.width !== undefined && props.height !== undefined) {
241038
241169
  return {
241039
- width: distance.parse(props.width),
241040
- height: distance.parse(props.height)
241170
+ width: distance2.parse(props.width),
241171
+ height: distance2.parse(props.height)
241041
241172
  };
241042
241173
  }
241043
241174
  const directBoards = subpanel._getDirectBoardChildren();
@@ -241067,7 +241198,7 @@ function getItemDimensions(item, db) {
241067
241198
  return getBoardDimensionsFromProps(directBoards[0]);
241068
241199
  }
241069
241200
  if (subpanel._cachedGridWidth > 0 && subpanel._cachedGridHeight > 0) {
241070
- const edgePadding = distance.parse(props.edgePadding ?? 5);
241201
+ const edgePadding = distance2.parse(props.edgePadding ?? 5);
241071
241202
  return {
241072
241203
  width: subpanel._cachedGridWidth + edgePadding * 2,
241073
241204
  height: subpanel._cachedGridHeight + edgePadding * 2
@@ -241193,13 +241324,13 @@ var Subpanel = class _Subpanel extends Group6 {
241193
241324
  edgePaddingTop: edgePaddingTopProp,
241194
241325
  edgePaddingBottom: edgePaddingBottomProp
241195
241326
  } = this._parsedProps;
241196
- const edgePadding = distance.parse(edgePaddingProp ?? 5);
241197
- const edgePaddingLeft = distance.parse(edgePaddingLeftProp ?? edgePadding);
241198
- const edgePaddingRight = distance.parse(edgePaddingRightProp ?? edgePadding);
241199
- const edgePaddingTop = distance.parse(edgePaddingTopProp ?? edgePadding);
241200
- const edgePaddingBottom = distance.parse(edgePaddingBottomProp ?? edgePadding);
241201
- const panelWidth = distance.parse(this._parsedProps.width);
241202
- const panelHeight = distance.parse(this._parsedProps.height);
241327
+ const edgePadding = distance2.parse(edgePaddingProp ?? 5);
241328
+ const edgePaddingLeft = distance2.parse(edgePaddingLeftProp ?? edgePadding);
241329
+ const edgePaddingRight = distance2.parse(edgePaddingRightProp ?? edgePadding);
241330
+ const edgePaddingTop = distance2.parse(edgePaddingTopProp ?? edgePadding);
241331
+ const edgePaddingBottom = distance2.parse(edgePaddingBottomProp ?? edgePadding);
241332
+ const panelWidth = distance2.parse(this._parsedProps.width);
241333
+ const panelHeight = distance2.parse(this._parsedProps.height);
241203
241334
  availablePanelWidth = panelWidth - edgePaddingLeft - edgePaddingRight;
241204
241335
  availablePanelHeight = panelHeight - edgePaddingTop - edgePaddingBottom;
241205
241336
  }
@@ -241277,8 +241408,8 @@ var Subpanel = class _Subpanel extends Group6 {
241277
241408
  return;
241278
241409
  if (hasExplicitWidth && hasExplicitHeight) {
241279
241410
  db.pcb_group.update(this.pcb_group_id, {
241280
- width: distance.parse(this._parsedProps.width),
241281
- height: distance.parse(this._parsedProps.height)
241411
+ width: distance2.parse(this._parsedProps.width),
241412
+ height: distance2.parse(this._parsedProps.height)
241282
241413
  });
241283
241414
  } else if (gridWidth > 0 || gridHeight > 0) {
241284
241415
  const {
@@ -241288,14 +241419,14 @@ var Subpanel = class _Subpanel extends Group6 {
241288
241419
  edgePaddingTop: edgePaddingTopProp,
241289
241420
  edgePaddingBottom: edgePaddingBottomProp
241290
241421
  } = this._parsedProps;
241291
- const edgePadding = distance.parse(edgePaddingProp ?? 5);
241292
- const edgePaddingLeft = distance.parse(edgePaddingLeftProp ?? edgePadding);
241293
- const edgePaddingRight = distance.parse(edgePaddingRightProp ?? edgePadding);
241294
- const edgePaddingTop = distance.parse(edgePaddingTopProp ?? edgePadding);
241295
- const edgePaddingBottom = distance.parse(edgePaddingBottomProp ?? edgePadding);
241422
+ const edgePadding = distance2.parse(edgePaddingProp ?? 5);
241423
+ const edgePaddingLeft = distance2.parse(edgePaddingLeftProp ?? edgePadding);
241424
+ const edgePaddingRight = distance2.parse(edgePaddingRightProp ?? edgePadding);
241425
+ const edgePaddingTop = distance2.parse(edgePaddingTopProp ?? edgePadding);
241426
+ const edgePaddingBottom = distance2.parse(edgePaddingBottomProp ?? edgePadding);
241296
241427
  db.pcb_group.update(this.pcb_group_id, {
241297
- width: hasExplicitWidth ? distance.parse(this._parsedProps.width) : gridWidth + edgePaddingLeft + edgePaddingRight,
241298
- height: hasExplicitHeight ? distance.parse(this._parsedProps.height) : gridHeight + edgePaddingTop + edgePaddingBottom
241428
+ width: hasExplicitWidth ? distance2.parse(this._parsedProps.width) : gridWidth + edgePaddingLeft + edgePaddingRight,
241429
+ height: hasExplicitHeight ? distance2.parse(this._parsedProps.height) : gridHeight + edgePaddingTop + edgePaddingBottom
241299
241430
  });
241300
241431
  }
241301
241432
  }
@@ -241353,8 +241484,8 @@ var Panel = class extends Subpanel {
241353
241484
  const { db } = this.root;
241354
241485
  const props = this._parsedProps;
241355
241486
  const inserted = db.pcb_panel.insert({
241356
- width: props.width !== undefined ? distance.parse(props.width) : 0,
241357
- height: props.height !== undefined ? distance.parse(props.height) : 0,
241487
+ width: props.width !== undefined ? distance2.parse(props.width) : 0,
241488
+ height: props.height !== undefined ? distance2.parse(props.height) : 0,
241358
241489
  center: this._getGlobalPcbPositionBeforeLayout(),
241359
241490
  covered_with_solder_mask: !(props.noSolderMask ?? false)
241360
241491
  });
@@ -241370,8 +241501,8 @@ var Panel = class extends Subpanel {
241370
241501
  return;
241371
241502
  if (hasExplicitWidth && hasExplicitHeight) {
241372
241503
  db.pcb_panel.update(this.pcb_panel_id, {
241373
- width: distance.parse(this._parsedProps.width),
241374
- height: distance.parse(this._parsedProps.height)
241504
+ width: distance2.parse(this._parsedProps.width),
241505
+ height: distance2.parse(this._parsedProps.height)
241375
241506
  });
241376
241507
  } else if (gridWidth > 0 || gridHeight > 0) {
241377
241508
  const {
@@ -241381,14 +241512,14 @@ var Panel = class extends Subpanel {
241381
241512
  edgePaddingTop: edgePaddingTopProp,
241382
241513
  edgePaddingBottom: edgePaddingBottomProp
241383
241514
  } = this._parsedProps;
241384
- const edgePadding = distance.parse(edgePaddingProp ?? 5);
241385
- const edgePaddingLeft = distance.parse(edgePaddingLeftProp ?? edgePadding);
241386
- const edgePaddingRight = distance.parse(edgePaddingRightProp ?? edgePadding);
241387
- const edgePaddingTop = distance.parse(edgePaddingTopProp ?? edgePadding);
241388
- const edgePaddingBottom = distance.parse(edgePaddingBottomProp ?? edgePadding);
241515
+ const edgePadding = distance2.parse(edgePaddingProp ?? 5);
241516
+ const edgePaddingLeft = distance2.parse(edgePaddingLeftProp ?? edgePadding);
241517
+ const edgePaddingRight = distance2.parse(edgePaddingRightProp ?? edgePadding);
241518
+ const edgePaddingTop = distance2.parse(edgePaddingTopProp ?? edgePadding);
241519
+ const edgePaddingBottom = distance2.parse(edgePaddingBottomProp ?? edgePadding);
241389
241520
  db.pcb_panel.update(this.pcb_panel_id, {
241390
- width: hasExplicitWidth ? distance.parse(this._parsedProps.width) : gridWidth + edgePaddingLeft + edgePaddingRight,
241391
- height: hasExplicitHeight ? distance.parse(this._parsedProps.height) : gridHeight + edgePaddingTop + edgePaddingBottom
241521
+ width: hasExplicitWidth ? distance2.parse(this._parsedProps.width) : gridWidth + edgePaddingLeft + edgePaddingRight,
241522
+ height: hasExplicitHeight ? distance2.parse(this._parsedProps.height) : gridHeight + edgePaddingTop + edgePaddingBottom
241392
241523
  });
241393
241524
  }
241394
241525
  }
@@ -241401,8 +241532,8 @@ var Panel = class extends Subpanel {
241401
241532
  const props = this._parsedProps;
241402
241533
  const currentPanel = db.pcb_panel.get(this.pcb_panel_id);
241403
241534
  db.pcb_panel.update(this.pcb_panel_id, {
241404
- width: props.width !== undefined ? distance.parse(props.width) : currentPanel?.width,
241405
- height: props.height !== undefined ? distance.parse(props.height) : currentPanel?.height,
241535
+ width: props.width !== undefined ? distance2.parse(props.width) : currentPanel?.width,
241536
+ height: props.height !== undefined ? distance2.parse(props.height) : currentPanel?.height,
241406
241537
  center: this._getGlobalPcbPositionBeforeLayout(),
241407
241538
  covered_with_solder_mask: !(props.noSolderMask ?? false)
241408
241539
  });
@@ -242675,15 +242806,15 @@ var Fiducial = class extends PrimitiveComponent2 {
242675
242806
  shape: "circle",
242676
242807
  x: position2.x,
242677
242808
  y: position2.y,
242678
- radius: distance.parse(props.padDiameter) / 2,
242679
- soldermask_margin: props.soldermaskPullback ? distance.parse(props.soldermaskPullback) : distance.parse(props.padDiameter) / 2,
242809
+ radius: distance2.parse(props.padDiameter) / 2,
242810
+ soldermask_margin: props.soldermaskPullback ? distance2.parse(props.soldermaskPullback) : distance2.parse(props.padDiameter) / 2,
242680
242811
  is_covered_with_solder_mask: true
242681
242812
  });
242682
242813
  this.pcb_smtpad_id = pcb_smtpad2.pcb_smtpad_id;
242683
242814
  }
242684
242815
  getPcbSize() {
242685
242816
  const { _parsedProps: props } = this;
242686
- const d22 = distance.parse(props.padDiameter);
242817
+ const d22 = distance2.parse(props.padDiameter);
242687
242818
  return { width: d22, height: d22 };
242688
242819
  }
242689
242820
  _setPositionFromLayout(newCenter) {
@@ -253151,7 +253282,7 @@ var registerDoctor = (program2) => {
253151
253282
  import fs55 from "node:fs";
253152
253283
  import path59 from "node:path";
253153
253284
  import { promisify as promisify3 } from "node:util";
253154
- import { convertCircuitJsonToGltf as convertCircuitJsonToGltf5 } from "circuit-json-to-gltf";
253285
+ import { convertCircuitJsonToGltf as convertCircuitJsonToGltf4 } from "circuit-json-to-gltf";
253155
253286
  import {
253156
253287
  convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg4,
253157
253288
  convertCircuitJsonToSchematicSvg as convertCircuitJsonToSchematicSvg4,
@@ -256808,10 +256939,10 @@ var exportSnippet = async ({
256808
256939
  outputContent = convertCircuitJsonToReadableNetlist(circuitJson);
256809
256940
  break;
256810
256941
  case "gltf":
256811
- outputContent = JSON.stringify(await convertCircuitJsonToGltf5(circuitJson, getCircuitJsonToGltfOptions({ format: "gltf" })), null, 2);
256942
+ outputContent = JSON.stringify(await convertCircuitJsonToGltf4(circuitJson, getCircuitJsonToGltfOptions({ format: "gltf" })), null, 2);
256812
256943
  break;
256813
256944
  case "glb":
256814
- outputContent = Buffer.from(await convertCircuitJsonToGltf5(circuitJson, getCircuitJsonToGltfOptions({ format: "glb" })));
256945
+ outputContent = Buffer.from(await convertCircuitJsonToGltf4(circuitJson, getCircuitJsonToGltfOptions({ format: "glb" })));
256815
256946
  break;
256816
256947
  case "srj":
256817
256948
  {
@@ -278208,61 +278339,6 @@ var registerSimulate = (program3) => {
278208
278339
  });
278209
278340
  };
278210
278341
 
278211
- // lib/shared/camera-presets.ts
278212
- function normalizeDir(dir) {
278213
- const len = Math.sqrt(dir[0] ** 2 + dir[1] ** 2 + dir[2] ** 2);
278214
- if (len === 0)
278215
- return [0, 1, 0];
278216
- return [dir[0] / len, dir[1] / len, dir[2] / len];
278217
- }
278218
- function distance9(a2, b) {
278219
- return Math.sqrt((a2[0] - b[0]) ** 2 + (a2[1] - b[1]) ** 2 + (a2[2] - b[2]) ** 2);
278220
- }
278221
- function repositionCamera(cam, dir, distOverride) {
278222
- const dist = distOverride ?? distance9(cam.camPos, cam.lookAt);
278223
- const [nx2, ny2, nz] = normalizeDir(dir);
278224
- return {
278225
- camPos: [
278226
- cam.lookAt[0] + nx2 * dist,
278227
- cam.lookAt[1] + ny2 * dist,
278228
- cam.lookAt[2] + nz * dist
278229
- ],
278230
- lookAt: cam.lookAt,
278231
- fov: cam.fov
278232
- };
278233
- }
278234
- var CAMERA_PRESETS = {
278235
- "top-down": (cam) => repositionCamera(cam, [0.00000001, 1, -0.001]),
278236
- "top-down-ortho": (cam) => {
278237
- const desiredFov = 3;
278238
- const dir = [0.00000001, 1, -0.001];
278239
- const origDist = distance9(cam.camPos, cam.lookAt);
278240
- const origFovRad = Math.max(cam.fov * Math.PI / 180, 0.01);
278241
- const desiredFovRad = Math.max(desiredFov * Math.PI / 180, 0.01);
278242
- const tanOrig = Math.tan(origFovRad / 2);
278243
- const tanDesired = Math.max(Math.tan(desiredFovRad / 2), 0.0001);
278244
- const distScale = Number.isFinite(tanOrig / tanDesired) && tanOrig > 0 ? tanOrig / tanDesired : 1;
278245
- const newDist = origDist * distScale;
278246
- const repositioned = repositionCamera(cam, dir, newDist);
278247
- return { ...repositioned, fov: desiredFov };
278248
- },
278249
- "top-left-corner": (cam) => repositionCamera(cam, [0.7, 1.2, -0.8]),
278250
- "top-left": (cam) => repositionCamera(cam, [1, 1.2, 0]),
278251
- "top-right-corner": (cam) => repositionCamera(cam, [-0.7, 1.2, -0.8]),
278252
- "top-right": (cam) => repositionCamera(cam, [-1, 1.2, 0]),
278253
- "left-sideview": (cam) => repositionCamera(cam, [1, 0.05, 0]),
278254
- "right-sideview": (cam) => repositionCamera(cam, [-1, 0.05, 0]),
278255
- front: (cam) => repositionCamera(cam, [0, 0.05, -1]),
278256
- "top-center-angled": (cam) => repositionCamera(cam, [0, 1, -1])
278257
- };
278258
- var CAMERA_PRESET_NAMES = Object.keys(CAMERA_PRESETS);
278259
- function applyCameraPreset(preset, cam) {
278260
- if (!(preset in CAMERA_PRESETS)) {
278261
- throw new Error(`Unknown camera preset "${preset}". Valid presets: ${CAMERA_PRESET_NAMES.join(", ")}`);
278262
- }
278263
- return CAMERA_PRESETS[preset](cam);
278264
- }
278265
-
278266
278342
  // lib/shared/snapshot-project.ts
278267
278343
  import fs66 from "node:fs";
278268
278344
  import path70 from "node:path";
@@ -278351,15 +278427,10 @@ var snapshotFilesWithWorkerPool = async (options) => {
278351
278427
  // lib/shared/process-snapshot-file.ts
278352
278428
  import fs65 from "node:fs";
278353
278429
  import path69 from "node:path";
278354
- import {
278355
- convertCircuitJsonToGltf as convertCircuitJsonToGltf6,
278356
- getBestCameraPosition as getBestCameraPosition3
278357
- } from "circuit-json-to-gltf";
278358
278430
  import {
278359
278431
  convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg5,
278360
278432
  convertCircuitJsonToSchematicSvg as convertCircuitJsonToSchematicSvg5
278361
278433
  } from "circuit-to-svg";
278362
- import { renderGLTFToPNGFromGLB as renderGLTFToPNGFromGLB3 } from "poppygl";
278363
278434
 
278364
278435
  // lib/shared/compare-images.ts
278365
278436
  import looksSame from "@tscircuit/image-utils/looks-same";
@@ -278495,15 +278566,7 @@ var processSnapshotFile = async ({
278495
278566
  let png3d = null;
278496
278567
  if (threeD && !simulationOnly) {
278497
278568
  try {
278498
- const glbBuffer = await convertCircuitJsonToGltf6(circuitJson, getCircuitJsonToGltfOptions({ format: "glb" }));
278499
- if (!(glbBuffer instanceof ArrayBuffer)) {
278500
- throw new Error("Expected ArrayBuffer from convertCircuitJsonToGltf with glb format");
278501
- }
278502
- let cameraOptions = getBestCameraPosition3(circuitJson);
278503
- if (cameraPreset) {
278504
- cameraOptions = applyCameraPreset(cameraPreset, cameraOptions);
278505
- }
278506
- png3d = await renderGLTFToPNGFromGLB3(glbBuffer, cameraOptions);
278569
+ png3d = await renderCircuitJsonTo3dPng(circuitJson, { cameraPreset });
278507
278570
  } catch (error) {
278508
278571
  const errorMessage = error instanceof Error ? error.message : String(error);
278509
278572
  if (errorMessage.includes("No pcb_board found in circuit JSON")) {