@tscircuit/cli 0.1.1253 → 0.1.1254

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
@@ -34389,7 +34389,7 @@ function parseAndConvertSiUnit(v3) {
34389
34389
  value: conversionFactor * Number.parseFloat(numberPart)
34390
34390
  };
34391
34391
  }
34392
- function applyToPoint20(matrix, point2) {
34392
+ function applyToPoint21(matrix, point2) {
34393
34393
  return Array.isArray(point2) ? [
34394
34394
  matrix.a * point2[0] + matrix.c * point2[1] + matrix.e,
34395
34395
  matrix.b * point2[0] + matrix.d * point2[1] + matrix.f
@@ -34398,7 +34398,7 @@ function applyToPoint20(matrix, point2) {
34398
34398
  y: matrix.b * point2.x + matrix.d * point2.y + matrix.f
34399
34399
  };
34400
34400
  }
34401
- function translate5(tx2, ty2 = 0) {
34401
+ function translate6(tx2, ty2 = 0) {
34402
34402
  return {
34403
34403
  a: 1,
34404
34404
  c: 0,
@@ -34434,13 +34434,13 @@ function transform(...matrices) {
34434
34434
  }
34435
34435
  }
34436
34436
  }
34437
- function compose5(...matrices) {
34437
+ function compose6(...matrices) {
34438
34438
  return transform(...matrices);
34439
34439
  }
34440
34440
  function isUndefined2(val) {
34441
34441
  return typeof val === "undefined";
34442
34442
  }
34443
- function rotate6(angle, cx2, cy2) {
34443
+ function rotate7(angle, cx2, cy2) {
34444
34444
  const cosAngle = cos(angle);
34445
34445
  const sinAngle = sin(angle);
34446
34446
  const rotationMatrix = {
@@ -34455,15 +34455,15 @@ function rotate6(angle, cx2, cy2) {
34455
34455
  return rotationMatrix;
34456
34456
  }
34457
34457
  return transform([
34458
- translate5(cx2, cy2),
34458
+ translate6(cx2, cy2),
34459
34459
  rotationMatrix,
34460
- translate5(-cx2, -cy2)
34460
+ translate6(-cx2, -cy2)
34461
34461
  ]);
34462
34462
  }
34463
34463
  function rotateDEG(angle, cx2 = undefined, cy2 = undefined) {
34464
- return rotate6(angle * PI / 180, cx2, cy2);
34464
+ return rotate7(angle * PI / 180, cx2, cy2);
34465
34465
  }
34466
- function scale4(sx2, sy2 = undefined, cx2 = undefined, cy2 = undefined) {
34466
+ function scale5(sx2, sy2 = undefined, cx2 = undefined, cy2 = undefined) {
34467
34467
  if (isUndefined2(sy2))
34468
34468
  sy2 = sx2;
34469
34469
  const scaleMatrix = {
@@ -34478,9 +34478,9 @@ function scale4(sx2, sy2 = undefined, cx2 = undefined, cy2 = undefined) {
34478
34478
  return scaleMatrix;
34479
34479
  }
34480
34480
  return transform([
34481
- translate5(cx2, cy2),
34481
+ translate6(cx2, cy2),
34482
34482
  scaleMatrix,
34483
- translate5(-cx2, -cy2)
34483
+ translate6(-cx2, -cy2)
34484
34484
  ]);
34485
34485
  }
34486
34486
  function toSVG(matrix) {
@@ -34584,12 +34584,12 @@ function peg$padEnd(str, targetLength, padString) {
34584
34584
  function decomposeTSR(matrix, flipX = false, flipY2 = false) {
34585
34585
  if (flipX) {
34586
34586
  if (flipY2) {
34587
- matrix = compose5(matrix, scale4(-1, -1));
34587
+ matrix = compose6(matrix, scale5(-1, -1));
34588
34588
  } else {
34589
- matrix = compose5(matrix, scale4(1, -1));
34589
+ matrix = compose6(matrix, scale5(1, -1));
34590
34590
  }
34591
34591
  } else if (flipY2) {
34592
- matrix = compose5(matrix, scale4(-1, 1));
34592
+ matrix = compose6(matrix, scale5(-1, 1));
34593
34593
  }
34594
34594
  const a = matrix.a;
34595
34595
  const b = matrix.b;
@@ -37005,25 +37005,25 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
37005
37005
  throw new Error(`Invalid sideOrDir: ${sideOrDir}`);
37006
37006
  }, transformSchematicElement = (elm, matrix) => {
37007
37007
  if (elm.type === "schematic_component") {
37008
- elm.center = applyToPoint20(matrix, elm.center);
37008
+ elm.center = applyToPoint21(matrix, elm.center);
37009
37009
  } else if (elm.type === "schematic_port") {
37010
- elm.center = applyToPoint20(matrix, elm.center);
37010
+ elm.center = applyToPoint21(matrix, elm.center);
37011
37011
  if (elm.facing_direction) {
37012
37012
  elm.facing_direction = rotateDirection(elm.facing_direction, -(Math.atan2(matrix.b, matrix.a) / Math.PI) * 2);
37013
37013
  }
37014
37014
  } else if (elm.type === "schematic_text") {
37015
- elm.position = applyToPoint20(matrix, elm.position);
37015
+ elm.position = applyToPoint21(matrix, elm.position);
37016
37016
  } else if (elm.type === "schematic_trace") {
37017
37017
  const anyElm = elm;
37018
37018
  anyElm.route = (anyElm.route ?? []).map((rp2) => {
37019
- const tp2 = applyToPoint20(matrix, rp2);
37019
+ const tp2 = applyToPoint21(matrix, rp2);
37020
37020
  rp2.x = tp2.x;
37021
37021
  rp2.y = tp2.y;
37022
37022
  return rp2;
37023
37023
  });
37024
37024
  if (Array.isArray(anyElm.junctions)) {
37025
37025
  anyElm.junctions = anyElm.junctions.map((j2) => {
37026
- const tp2 = applyToPoint20(matrix, j2);
37026
+ const tp2 = applyToPoint21(matrix, j2);
37027
37027
  j2.x = tp2.x;
37028
37028
  j2.y = tp2.y;
37029
37029
  return j2;
@@ -37031,18 +37031,18 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
37031
37031
  }
37032
37032
  if (Array.isArray(anyElm.edges)) {
37033
37033
  anyElm.edges = anyElm.edges.map((e2) => {
37034
- e2.from = applyToPoint20(matrix, e2.from);
37035
- e2.to = applyToPoint20(matrix, e2.to);
37034
+ e2.from = applyToPoint21(matrix, e2.from);
37035
+ e2.to = applyToPoint21(matrix, e2.to);
37036
37036
  return e2;
37037
37037
  });
37038
37038
  }
37039
37039
  } else if (elm.type === "schematic_box") {
37040
- const { x: x3, y } = applyToPoint20(matrix, { x: elm.x, y: elm.y });
37040
+ const { x: x3, y } = applyToPoint21(matrix, { x: elm.x, y: elm.y });
37041
37041
  elm.x = x3;
37042
37042
  elm.y = y;
37043
37043
  } else if (elm.type === "schematic_line") {
37044
- const { x: x12, y: y12 } = applyToPoint20(matrix, { x: elm.x1, y: elm.y1 });
37045
- const { x: x22, y: y22 } = applyToPoint20(matrix, { x: elm.x2, y: elm.y2 });
37044
+ const { x: x12, y: y12 } = applyToPoint21(matrix, { x: elm.x1, y: elm.y1 });
37045
+ const { x: x22, y: y22 } = applyToPoint21(matrix, { x: elm.x2, y: elm.y2 });
37046
37046
  elm.x1 = x12;
37047
37047
  elm.y1 = y12;
37048
37048
  elm.x2 = x22;
@@ -37055,7 +37055,7 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
37055
37055
  const tsr = decomposeTSR(matrix);
37056
37056
  const flipPadWidthHeight = Math.round(tsr.rotation.angle / (Math.PI / 2)) % 2 === 1;
37057
37057
  if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
37058
- const { x: x3, y } = applyToPoint20(matrix, {
37058
+ const { x: x3, y } = applyToPoint21(matrix, {
37059
37059
  x: Number(elm.x),
37060
37060
  y: Number(elm.y)
37061
37061
  });
@@ -37063,7 +37063,7 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
37063
37063
  elm.y = y;
37064
37064
  if (elm.type === "pcb_smtpad" && elm.shape === "polygon" && Array.isArray(elm.points)) {
37065
37065
  elm.points = elm.points.map((point2) => {
37066
- const tp2 = applyToPoint20(matrix, { x: point2.x, y: point2.y });
37066
+ const tp2 = applyToPoint21(matrix, { x: point2.x, y: point2.y });
37067
37067
  return {
37068
37068
  x: tp2.x,
37069
37069
  y: tp2.y
@@ -37071,13 +37071,13 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
37071
37071
  });
37072
37072
  }
37073
37073
  } else if (elm.type === "pcb_keepout" || elm.type === "pcb_board") {
37074
- elm.center = applyToPoint20(matrix, elm.center);
37074
+ elm.center = applyToPoint21(matrix, elm.center);
37075
37075
  } else if (elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text" || elm.type === "pcb_note_text") {
37076
- elm.anchor_position = applyToPoint20(matrix, elm.anchor_position);
37076
+ elm.anchor_position = applyToPoint21(matrix, elm.anchor_position);
37077
37077
  } else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_note_rect" || elm.type === "pcb_courtyard_rect" || elm.type === "pcb_courtyard_circle") {
37078
- elm.center = applyToPoint20(matrix, elm.center);
37078
+ elm.center = applyToPoint21(matrix, elm.center);
37079
37079
  } else if (elm.type === "pcb_component") {
37080
- elm.center = applyToPoint20(matrix, elm.center);
37080
+ elm.center = applyToPoint21(matrix, elm.center);
37081
37081
  elm.rotation = elm.rotation + tsr.rotation.angle / Math.PI * 180;
37082
37082
  elm.rotation = elm.rotation % 360;
37083
37083
  if (flipPadWidthHeight) {
@@ -37085,21 +37085,21 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
37085
37085
  }
37086
37086
  } else if (elm.type === "pcb_courtyard_outline") {
37087
37087
  elm.outline = elm.outline.map((p) => {
37088
- const tp2 = applyToPoint20(matrix, p);
37088
+ const tp2 = applyToPoint21(matrix, p);
37089
37089
  p.x = tp2.x;
37090
37090
  p.y = tp2.y;
37091
37091
  return p;
37092
37092
  });
37093
37093
  } else if (elm.type === "pcb_courtyard_polygon") {
37094
37094
  elm.points = elm.points.map((p) => {
37095
- const tp2 = applyToPoint20(matrix, p);
37095
+ const tp2 = applyToPoint21(matrix, p);
37096
37096
  p.x = tp2.x;
37097
37097
  p.y = tp2.y;
37098
37098
  return p;
37099
37099
  });
37100
37100
  } else if (elm.type === "pcb_silkscreen_path" || elm.type === "pcb_trace" || elm.type === "pcb_fabrication_note_path" || elm.type === "pcb_note_path") {
37101
37101
  elm.route = elm.route.map((rp2) => {
37102
- const tp2 = applyToPoint20(matrix, rp2);
37102
+ const tp2 = applyToPoint21(matrix, rp2);
37103
37103
  rp2.x = tp2.x;
37104
37104
  rp2.y = tp2.y;
37105
37105
  return rp2;
@@ -37107,14 +37107,14 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
37107
37107
  } else if (elm.type === "pcb_silkscreen_line" || elm.type === "pcb_note_line") {
37108
37108
  const p12 = { x: elm.x1, y: elm.y1 };
37109
37109
  const p22 = { x: elm.x2, y: elm.y2 };
37110
- const p1t = applyToPoint20(matrix, p12);
37111
- const p2t = applyToPoint20(matrix, p22);
37110
+ const p1t = applyToPoint21(matrix, p12);
37111
+ const p2t = applyToPoint21(matrix, p22);
37112
37112
  elm.x1 = p1t.x;
37113
37113
  elm.y1 = p1t.y;
37114
37114
  elm.x2 = p2t.x;
37115
37115
  elm.y2 = p2t.y;
37116
37116
  } else if (elm.type === "cad_component") {
37117
- const newPos = applyToPoint20(matrix, {
37117
+ const newPos = applyToPoint21(matrix, {
37118
37118
  x: elm.position.x,
37119
37119
  y: elm.position.y
37120
37120
  });
@@ -37477,7 +37477,7 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
37477
37477
  return true;
37478
37478
  return false;
37479
37479
  });
37480
- const matrix = translate5(dx2, dy2);
37480
+ const matrix = translate6(dx2, dy2);
37481
37481
  transformPCBElements(elementsToMove, matrix);
37482
37482
  }, findAllDescendantGroupIds = (circuitJson, parentGroupId) => {
37483
37483
  const childGroupIds = [];
@@ -37521,7 +37521,7 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
37521
37521
  const { center: currentCenter } = findBoundsAndCenter(pcbElements);
37522
37522
  const dx2 = newCenter.x - currentCenter.x;
37523
37523
  const dy2 = newCenter.y - currentCenter.y;
37524
- const matrix = translate5(dx2, dy2);
37524
+ const matrix = translate6(dx2, dy2);
37525
37525
  transformPCBElements(pcbElements, matrix);
37526
37526
  }, repositionSchematicComponentTo = (circuitJson, schematic_component_id, newCenter) => {
37527
37527
  const schematicComponent = circuitJson.find((e2) => e2.type === "schematic_component" && e2.schematic_component_id === schematic_component_id);
@@ -37551,7 +37551,7 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
37551
37551
  return true;
37552
37552
  return false;
37553
37553
  });
37554
- const matrix = translate5(dx2, dy2);
37554
+ const matrix = translate6(dx2, dy2);
37555
37555
  transformSchematicElements(elementsToMove, matrix);
37556
37556
  }, findAllDescendantGroupIds2 = (circuitJson, parentGroupId) => {
37557
37557
  const childGroupIds = [];
@@ -37595,7 +37595,7 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
37595
37595
  const { center: currentCenter } = findBoundsAndCenter(schematicElements);
37596
37596
  const dx2 = newCenter.x - currentCenter.x;
37597
37597
  const dy2 = newCenter.y - currentCenter.y;
37598
- const matrix = translate5(dx2, dy2);
37598
+ const matrix = translate6(dx2, dy2);
37599
37599
  transformSchematicElements(schematicElements, matrix);
37600
37600
  }, getCircuitJsonTree = (circuitJson, opts) => {
37601
37601
  const groupChildMap = /* @__PURE__ */ new Map;
@@ -46896,7 +46896,7 @@ function createSvgObjectsFromPcbTraceError(pcbTraceError, circuitJson, ctx) {
46896
46896
  return createSvgObjectsForViaTraceError(pcbTraceError, via, ctx);
46897
46897
  }
46898
46898
  if (pcbTraceError.center) {
46899
- const screenCenter = applyToPoint20(transform2, {
46899
+ const screenCenter = applyToPoint21(transform2, {
46900
46900
  x: pcbTraceError.center.x,
46901
46901
  y: pcbTraceError.center.y
46902
46902
  });
@@ -46941,11 +46941,11 @@ function createSvgObjectsFromPcbTraceError(pcbTraceError, circuitJson, ctx) {
46941
46941
  } else
46942
46942
  return [];
46943
46943
  }
46944
- const screenPort1 = applyToPoint20(transform2, {
46944
+ const screenPort1 = applyToPoint21(transform2, {
46945
46945
  x: port1.x,
46946
46946
  y: port1.y
46947
46947
  });
46948
- const screenPort2 = applyToPoint20(transform2, {
46948
+ const screenPort2 = applyToPoint21(transform2, {
46949
46949
  x: port2.x,
46950
46950
  y: port2.y
46951
46951
  });
@@ -47029,11 +47029,11 @@ function createSvgObjectsFromPcbTraceError(pcbTraceError, circuitJson, ctx) {
47029
47029
  function createSvgObjectsForViaTraceError(pcbTraceError, via, ctx) {
47030
47030
  const { transform: transform2 } = ctx;
47031
47031
  if (pcbTraceError.center && via) {
47032
- const screenCenter = applyToPoint20(transform2, {
47032
+ const screenCenter = applyToPoint21(transform2, {
47033
47033
  x: pcbTraceError.center.x,
47034
47034
  y: pcbTraceError.center.y
47035
47035
  });
47036
- const screenVia = applyToPoint20(transform2, {
47036
+ const screenVia = applyToPoint21(transform2, {
47037
47037
  x: via.x,
47038
47038
  y: via.y
47039
47039
  });
@@ -47207,7 +47207,7 @@ function createSvgObjectsFromPcbFootprintOverlapError(error, circuitJson, ctx) {
47207
47207
  if (filteredReferencedElements.length > 0) {
47208
47208
  const centerX = filteredReferencedElements.reduce((sum, el2) => sum + el2.x, 0) / filteredReferencedElements.length;
47209
47209
  const centerY = filteredReferencedElements.reduce((sum, el2) => sum + el2.y, 0) / filteredReferencedElements.length;
47210
- const screenCenter = applyToPoint20(transform2, { x: centerX, y: centerY });
47210
+ const screenCenter = applyToPoint21(transform2, { x: centerX, y: centerY });
47211
47211
  svgObjects.push({
47212
47212
  name: "rect",
47213
47213
  type: "element",
@@ -47245,7 +47245,7 @@ function createSvgObjectsFromPcbFootprintOverlapError(error, circuitJson, ctx) {
47245
47245
  value: ""
47246
47246
  });
47247
47247
  for (const element of filteredReferencedElements) {
47248
- const screenPos = applyToPoint20(transform2, { x: element.x, y: element.y });
47248
+ const screenPos = applyToPoint21(transform2, { x: element.x, y: element.y });
47249
47249
  svgObjects.push({
47250
47250
  name: "rect",
47251
47251
  type: "element",
@@ -47297,7 +47297,7 @@ function createSvgObjectsFromPcbCourtyardOverlapError(error, circuitJson, ctx) {
47297
47297
  return [];
47298
47298
  const midX = componentCenters.reduce((s, c) => s + c.x, 0) / componentCenters.length;
47299
47299
  const midY = componentCenters.reduce((s, c) => s + c.y, 0) / componentCenters.length;
47300
- const screenMid = applyToPoint20(transform2, { x: midX, y: midY });
47300
+ const screenMid = applyToPoint21(transform2, { x: midX, y: midY });
47301
47301
  svgObjects.push({
47302
47302
  name: "rect",
47303
47303
  type: "element",
@@ -47339,7 +47339,7 @@ function createSvgObjectsFromPcbCourtyardOverlapError(error, circuitJson, ctx) {
47339
47339
  value: ""
47340
47340
  });
47341
47341
  for (const center of componentCenters) {
47342
- const screenPos = applyToPoint20(transform2, center);
47342
+ const screenPos = applyToPoint21(transform2, center);
47343
47343
  svgObjects.push({
47344
47344
  name: "rect",
47345
47345
  type: "element",
@@ -47358,7 +47358,7 @@ function createSvgObjectsFromPcbCourtyardOverlapError(error, circuitJson, ctx) {
47358
47358
  });
47359
47359
  }
47360
47360
  if (componentCenters.length === 2) {
47361
- const mapped = componentCenters.map((c) => applyToPoint20(transform2, c));
47361
+ const mapped = componentCenters.map((c) => applyToPoint21(transform2, c));
47362
47362
  const s12 = mapped[0];
47363
47363
  const s2 = mapped[1];
47364
47364
  svgObjects.push({
@@ -47413,8 +47413,8 @@ function createSvgObjectsFromPcbComponentOutsideBoardError(error, circuitJson, c
47413
47413
  const bounds = getComponentBounds(error, circuitJson);
47414
47414
  if (!bounds)
47415
47415
  return [];
47416
- const topLeft = applyToPoint20(transform2, { x: bounds.min_x, y: bounds.min_y });
47417
- const bottomRight = applyToPoint20(transform2, {
47416
+ const topLeft = applyToPoint21(transform2, { x: bounds.min_x, y: bounds.min_y });
47417
+ const bottomRight = applyToPoint21(transform2, {
47418
47418
  x: bounds.max_x,
47419
47419
  y: bounds.max_y
47420
47420
  });
@@ -47488,7 +47488,7 @@ function createSvgObjectsFromPcbFabricationNotePath(fabNotePath, ctx) {
47488
47488
  const lastPoint = fabNotePath.route[fabNotePath.route.length - 1];
47489
47489
  const isClosed = firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y;
47490
47490
  const path42 = fabNotePath.route.slice(0, isClosed ? -1 : undefined).map((point2, index) => {
47491
- const [x3, y] = applyToPoint20(transform2, [point2.x, point2.y]);
47491
+ const [x3, y] = applyToPoint21(transform2, [point2.x, point2.y]);
47492
47492
  return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
47493
47493
  }).join(" ") + (isClosed ? " Z" : "");
47494
47494
  return [
@@ -47527,7 +47527,7 @@ function createSvgObjectsFromPcbFabricationNoteText(pcbFabNoteText, ctx) {
47527
47527
  debugPcb(`[pcb_fabrication_note_text] Invalid anchor_position for "${pcbFabNoteText.pcb_fabrication_note_text_id}": expected {x: number, y: number}, got ${JSON.stringify(anchor_position)}`);
47528
47528
  return [];
47529
47529
  }
47530
- const [transformedX, transformedY] = applyToPoint20(transform2, [
47530
+ const [transformedX, transformedY] = applyToPoint21(transform2, [
47531
47531
  anchor_position.x,
47532
47532
  anchor_position.y
47533
47533
  ]);
@@ -47552,7 +47552,7 @@ function createSvgObjectsFromPcbFabricationNoteText(pcbFabNoteText, ctx) {
47552
47552
  dominantBaseline = "text-after-edge";
47553
47553
  break;
47554
47554
  }
47555
- const textTransform = compose5(translate5(transformedX, transformedY), rotate6(Math.PI / 180));
47555
+ const textTransform = compose6(translate6(transformedX, transformedY), rotate7(Math.PI / 180));
47556
47556
  const svgObject = {
47557
47557
  name: "text",
47558
47558
  type: "element",
@@ -47606,11 +47606,11 @@ function createSvgObjectsFromPcbFabricationNoteRect(fabricationNoteRect, ctx) {
47606
47606
  }
47607
47607
  const halfWidth = width / 2;
47608
47608
  const halfHeight = height / 2;
47609
- const [topLeftX, topLeftY] = applyToPoint20(transform2, [
47609
+ const [topLeftX, topLeftY] = applyToPoint21(transform2, [
47610
47610
  center.x - halfWidth,
47611
47611
  center.y + halfHeight
47612
47612
  ]);
47613
- const [bottomRightX, bottomRightY] = applyToPoint20(transform2, [
47613
+ const [bottomRightX, bottomRightY] = applyToPoint21(transform2, [
47614
47614
  center.x + halfWidth,
47615
47615
  center.y - halfHeight
47616
47616
  ]);
@@ -47757,11 +47757,11 @@ function createSvgObjectsFromPcbFabricationNoteDimension(dimension, ctx) {
47757
47757
  y: toBase.y - perpendicular.y * arrowHalfWidth
47758
47758
  })
47759
47759
  ];
47760
- const [lineStartX, lineStartY] = applyToPoint20(transform2, [
47760
+ const [lineStartX, lineStartY] = applyToPoint21(transform2, [
47761
47761
  fromBase.x,
47762
47762
  fromBase.y
47763
47763
  ]);
47764
- const [lineEndX, lineEndY] = applyToPoint20(transform2, [toBase.x, toBase.y]);
47764
+ const [lineEndX, lineEndY] = applyToPoint21(transform2, [toBase.x, toBase.y]);
47765
47765
  const strokeWidth = arrowSize / 5 * Math.abs(transform2.a);
47766
47766
  const lineColor = color || "rgba(255,255,255,0.5)";
47767
47767
  const extensionDirection = hasOffsetDirection && (Math.abs(normalizedOffsetDirection.x) > Number.EPSILON || Math.abs(normalizedOffsetDirection.y) > Number.EPSILON) ? normalizedOffsetDirection : perpendicular;
@@ -47771,8 +47771,8 @@ function createSvgObjectsFromPcbFabricationNoteDimension(dimension, ctx) {
47771
47771
  x: anchor.x + extensionDirection.x * extensionLength,
47772
47772
  y: anchor.y + extensionDirection.y * extensionLength
47773
47773
  };
47774
- const [startX, startY] = applyToPoint20(transform2, [anchor.x, anchor.y]);
47775
- const [endX, endY] = applyToPoint20(transform2, [endPoint.x, endPoint.y]);
47774
+ const [startX, startY] = applyToPoint21(transform2, [anchor.x, anchor.y]);
47775
+ const [endX, endY] = applyToPoint21(transform2, [endPoint.x, endPoint.y]);
47776
47776
  return {
47777
47777
  name: "path",
47778
47778
  type: "element",
@@ -47793,11 +47793,11 @@ function createSvgObjectsFromPcbFabricationNoteDimension(dimension, ctx) {
47793
47793
  x: (from.x + to2.x) / 2 + offsetVector.x,
47794
47794
  y: (from.y + to2.y) / 2 + offsetVector.y
47795
47795
  };
47796
- const [screenFromX, screenFromY] = applyToPoint20(transform2, [
47796
+ const [screenFromX, screenFromY] = applyToPoint21(transform2, [
47797
47797
  fromOffset.x,
47798
47798
  fromOffset.y
47799
47799
  ]);
47800
- const [screenToX, screenToY] = applyToPoint20(transform2, [
47800
+ const [screenToX, screenToY] = applyToPoint21(transform2, [
47801
47801
  toOffset.x,
47802
47802
  toOffset.y
47803
47803
  ]);
@@ -47827,7 +47827,7 @@ function createSvgObjectsFromPcbFabricationNoteDimension(dimension, ctx) {
47827
47827
  x: midPoint.x + perpendicular.x * textOffset,
47828
47828
  y: midPoint.y + perpendicular.y * textOffset
47829
47829
  };
47830
- const [textX, textY] = applyToPoint20(transform2, [textPoint.x, textPoint.y]);
47830
+ const [textX, textY] = applyToPoint21(transform2, [textPoint.x, textPoint.y]);
47831
47831
  const transformedFontSize = font_size * Math.abs(transform2.a);
47832
47832
  const children = [
47833
47833
  ...extensionSegments,
@@ -47914,7 +47914,7 @@ function createSvgObjectsFromPcbFabricationNoteDimension(dimension, ctx) {
47914
47914
  }
47915
47915
  ];
47916
47916
  function toScreen(point2) {
47917
- const [x3, y] = applyToPoint20(transform2, [point2.x, point2.y]);
47917
+ const [x3, y] = applyToPoint21(transform2, [point2.x, point2.y]);
47918
47918
  return { x: x3, y };
47919
47919
  }
47920
47920
  }
@@ -47995,11 +47995,11 @@ function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
47995
47995
  y: toBase.y - perpendicular.y * arrowHalfWidth
47996
47996
  })
47997
47997
  ];
47998
- const [lineStartX, lineStartY] = applyToPoint20(transform2, [
47998
+ const [lineStartX, lineStartY] = applyToPoint21(transform2, [
47999
47999
  fromBase.x,
48000
48000
  fromBase.y
48001
48001
  ]);
48002
- const [lineEndX, lineEndY] = applyToPoint20(transform2, [toBase.x, toBase.y]);
48002
+ const [lineEndX, lineEndY] = applyToPoint21(transform2, [toBase.x, toBase.y]);
48003
48003
  const strokeWidth = arrow_size / 5 * Math.abs(transform2.a);
48004
48004
  const lineColor = color || colorMap.board.user_2;
48005
48005
  const extensionDirection = hasOffsetDirection && (Math.abs(normalizedOffsetDirection.x) > Number.EPSILON || Math.abs(normalizedOffsetDirection.y) > Number.EPSILON) ? normalizedOffsetDirection : perpendicular;
@@ -48009,8 +48009,8 @@ function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
48009
48009
  x: anchor.x + extensionDirection.x * extensionLength,
48010
48010
  y: anchor.y + extensionDirection.y * extensionLength
48011
48011
  };
48012
- const [startX, startY] = applyToPoint20(transform2, [anchor.x, anchor.y]);
48013
- const [endX, endY] = applyToPoint20(transform2, [endPoint.x, endPoint.y]);
48012
+ const [startX, startY] = applyToPoint21(transform2, [anchor.x, anchor.y]);
48013
+ const [endX, endY] = applyToPoint21(transform2, [endPoint.x, endPoint.y]);
48014
48014
  return {
48015
48015
  name: "path",
48016
48016
  type: "element",
@@ -48031,11 +48031,11 @@ function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
48031
48031
  x: (from.x + to2.x) / 2 + offsetVector.x,
48032
48032
  y: (from.y + to2.y) / 2 + offsetVector.y
48033
48033
  };
48034
- const [screenFromX, screenFromY] = applyToPoint20(transform2, [
48034
+ const [screenFromX, screenFromY] = applyToPoint21(transform2, [
48035
48035
  fromOffset.x,
48036
48036
  fromOffset.y
48037
48037
  ]);
48038
- const [screenToX, screenToY] = applyToPoint20(transform2, [
48038
+ const [screenToX, screenToY] = applyToPoint21(transform2, [
48039
48039
  toOffset.x,
48040
48040
  toOffset.y
48041
48041
  ]);
@@ -48065,7 +48065,7 @@ function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
48065
48065
  x: midPoint.x + perpendicular.x * textOffset,
48066
48066
  y: midPoint.y + perpendicular.y * textOffset
48067
48067
  };
48068
- const [textX, textY] = applyToPoint20(transform2, [textPoint.x, textPoint.y]);
48068
+ const [textX, textY] = applyToPoint21(transform2, [textPoint.x, textPoint.y]);
48069
48069
  const transformedFontSize = font_size * Math.abs(transform2.a);
48070
48070
  const children = [
48071
48071
  ...extensionSegments,
@@ -48148,7 +48148,7 @@ function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
48148
48148
  }
48149
48149
  ];
48150
48150
  function toScreen(point2) {
48151
- const [x3, y] = applyToPoint20(transform2, [point2.x, point2.y]);
48151
+ const [x3, y] = applyToPoint21(transform2, [point2.x, point2.y]);
48152
48152
  return { x: x3, y };
48153
48153
  }
48154
48154
  }
@@ -48169,7 +48169,7 @@ function createSvgObjectsFromPcbNoteText(note, ctx) {
48169
48169
  debugPcb(`[pcb_note_text] Invalid text for "${note.pcb_note_text_id}": expected non-empty string, got ${JSON.stringify(text)}`);
48170
48170
  return [];
48171
48171
  }
48172
- const [x3, y] = applyToPoint20(transform2, [anchor_position.x, anchor_position.y]);
48172
+ const [x3, y] = applyToPoint21(transform2, [anchor_position.x, anchor_position.y]);
48173
48173
  const transformedFontSize = font_size * Math.abs(transform2.a);
48174
48174
  let textAnchor = "middle";
48175
48175
  let dominantBaseline = "central";
@@ -48264,11 +48264,11 @@ function createSvgObjectsFromPcbNoteRect(noteRect, ctx) {
48264
48264
  }
48265
48265
  const halfWidth = width / 2;
48266
48266
  const halfHeight = height / 2;
48267
- const [topLeftX, topLeftY] = applyToPoint20(transform2, [
48267
+ const [topLeftX, topLeftY] = applyToPoint21(transform2, [
48268
48268
  center.x - halfWidth,
48269
48269
  center.y + halfHeight
48270
48270
  ]);
48271
- const [bottomRightX, bottomRightY] = applyToPoint20(transform2, [
48271
+ const [bottomRightX, bottomRightY] = applyToPoint21(transform2, [
48272
48272
  center.x + halfWidth,
48273
48273
  center.y - halfHeight
48274
48274
  ]);
@@ -48337,7 +48337,7 @@ function createSvgObjectsFromPcbNotePath(notePath, ctx) {
48337
48337
  }
48338
48338
  }
48339
48339
  const pathD = notePath.route.map((point2, index) => {
48340
- const [x3, y] = applyToPoint20(transform2, [point2.x, point2.y]);
48340
+ const [x3, y] = applyToPoint21(transform2, [point2.x, point2.y]);
48341
48341
  return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
48342
48342
  }).join(" ");
48343
48343
  const strokeWidth = notePath.stroke_width * Math.abs(transform2.a);
@@ -48366,8 +48366,8 @@ function createSvgObjectsFromPcbNoteLine(noteLine, ctx) {
48366
48366
  debugPcb(`[pcb_note_line] Invalid coordinates for "${noteLine.pcb_note_line_id}": expected x1, y1, x2, y2 as numbers, got x1=${JSON.stringify(x12)}, y1=${JSON.stringify(y12)}, x2=${JSON.stringify(x22)}, y2=${JSON.stringify(y22)}`);
48367
48367
  return [];
48368
48368
  }
48369
- const [startX, startY] = applyToPoint20(transform2, [x12, y12]);
48370
- const [endX, endY] = applyToPoint20(transform2, [x22, y22]);
48369
+ const [startX, startY] = applyToPoint21(transform2, [x12, y12]);
48370
+ const [endX, endY] = applyToPoint21(transform2, [x22, y22]);
48371
48371
  const baseStrokeWidth = typeof stroke_width === "number" ? stroke_width : 0;
48372
48372
  const transformedStrokeWidth = baseStrokeWidth * Math.abs(transform2.a);
48373
48373
  const attributes = {
@@ -48399,7 +48399,7 @@ function createSvgObjectsFromPcbNoteLine(noteLine, ctx) {
48399
48399
  }
48400
48400
  function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
48401
48401
  const { transform: transform2, colorMap: colorMap2, showSolderMask } = ctx;
48402
- const [x3, y] = applyToPoint20(transform2, [hole.x, hole.y]);
48402
+ const [x3, y] = applyToPoint21(transform2, [hole.x, hole.y]);
48403
48403
  const layer = Array.isArray(hole.layers) && hole.layers[0] || hole.layer || "top";
48404
48404
  const maskLayer = layer;
48405
48405
  const isCoveredWithSolderMask = Boolean(hole.is_covered_with_solder_mask);
@@ -48697,7 +48697,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
48697
48697
  const xStr = rotation2 ? (-scaledRectPadWidth / 2).toString() : (x3 - scaledRectPadWidth / 2).toString();
48698
48698
  const yStr = rotation2 ? (-scaledRectPadHeight / 2).toString() : (y - scaledRectPadHeight / 2).toString();
48699
48699
  const holeRadius = scaledHoleDiameter / 2;
48700
- const [holeCx, holeCy] = applyToPoint20(transform2, [
48700
+ const [holeCx, holeCy] = applyToPoint21(transform2, [
48701
48701
  h.x + (h.hole_offset_x ?? 0),
48702
48702
  h.y + (h.hole_offset_y ?? 0)
48703
48703
  ]);
@@ -48860,7 +48860,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
48860
48860
  const pillHoleWithOffsets = pillHole;
48861
48861
  const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
48862
48862
  const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
48863
- const [holeCenterX, holeCenterY] = applyToPoint20(transform2, [
48863
+ const [holeCenterX, holeCenterY] = applyToPoint21(transform2, [
48864
48864
  pillHole.x + holeOffsetX,
48865
48865
  pillHole.y + holeOffsetY
48866
48866
  ]);
@@ -48999,7 +48999,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
48999
48999
  const rotatedHoleWithOffsets = rotatedHole;
49000
49000
  const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
49001
49001
  const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
49002
- const [holeCenterX, holeCenterY] = applyToPoint20(transform2, [
49002
+ const [holeCenterX, holeCenterY] = applyToPoint21(transform2, [
49003
49003
  rotatedHole.x + holeOffsetX,
49004
49004
  rotatedHole.y + holeOffsetY
49005
49005
  ]);
@@ -49138,9 +49138,9 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
49138
49138
  const padOutline = polygonHole.pad_outline || [];
49139
49139
  const holeX = polygonHole.x ?? 0;
49140
49140
  const holeY = polygonHole.y ?? 0;
49141
- const padPoints = padOutline.map((point2) => applyToPoint20(transform2, [holeX + point2.x, holeY + point2.y]));
49141
+ const padPoints = padOutline.map((point2) => applyToPoint21(transform2, [holeX + point2.x, holeY + point2.y]));
49142
49142
  const padPointsString = padPoints.map((p) => p.join(",")).join(" ");
49143
- const [holeCenterX, holeCenterY] = applyToPoint20(transform2, [
49143
+ const [holeCenterX, holeCenterY] = applyToPoint21(transform2, [
49144
49144
  holeX + polygonHole.hole_offset_x,
49145
49145
  holeY + polygonHole.hole_offset_y
49146
49146
  ]);
@@ -49251,7 +49251,7 @@ function createSvgObjectsFromPcbSilkscreenPath(silkscreenPath, ctx) {
49251
49251
  if (!silkscreenPath.route || !Array.isArray(silkscreenPath.route))
49252
49252
  return [];
49253
49253
  let path42 = silkscreenPath.route.map((point2, index) => {
49254
- const [x3, y] = applyToPoint20(transform2, [point2.x, point2.y]);
49254
+ const [x3, y] = applyToPoint21(transform2, [point2.x, point2.y]);
49255
49255
  return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
49256
49256
  }).join(" ");
49257
49257
  const firstPoint = silkscreenPath.route[0];
@@ -49361,7 +49361,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
49361
49361
  debugPcb(`[pcb_silkscreen_text] Invalid anchor_position for "${pcbSilkscreenText.pcb_silkscreen_text_id}": expected {x: number, y: number}, got ${JSON.stringify(anchor_position)}`);
49362
49362
  return [];
49363
49363
  }
49364
- const [transformedX, transformedY] = applyToPoint20(transform2, [
49364
+ const [transformedX, transformedY] = applyToPoint21(transform2, [
49365
49365
  anchor_position.x,
49366
49366
  anchor_position.y
49367
49367
  ]);
@@ -49381,7 +49381,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
49381
49381
  const rectW = width + padLeft + padRight;
49382
49382
  const rectH = height + padTop + padBottom;
49383
49383
  const strokeWidth = scaledFontSize * 0.15;
49384
- const knockoutTransform = toString(compose5(translate5(transformedX, transformedY), rotate6(-ccw_rotation * Math.PI / 180), ...applyMirror ? [scale4(-1, 1)] : [], scale4(scaleFactor, scaleFactor)));
49384
+ const knockoutTransform = toString(compose6(translate6(transformedX, transformedY), rotate7(-ccw_rotation * Math.PI / 180), ...applyMirror ? [scale5(-1, 1)] : [], scale5(scaleFactor, scaleFactor)));
49385
49385
  const maskId = `silkscreen-knockout-mask-${pcbSilkscreenText.pcb_silkscreen_text_id}-${silkscreenMaskIdCounter++}`;
49386
49386
  return [
49387
49387
  {
@@ -49494,7 +49494,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
49494
49494
  dominantBaseline = "central";
49495
49495
  break;
49496
49496
  }
49497
- const textTransform = compose5(translate5(transformedX, transformedY), rotate6(-ccw_rotation * Math.PI / 180), ...layer === "bottom" ? [scale4(-1, 1)] : []);
49497
+ const textTransform = compose6(translate6(transformedX, transformedY), rotate7(-ccw_rotation * Math.PI / 180), ...layer === "bottom" ? [scale5(-1, 1)] : []);
49498
49498
  const lines = text.split(`
49499
49499
  `);
49500
49500
  const children = lines.length === 1 ? [
@@ -49569,7 +49569,7 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
49569
49569
  debugPcb(`[pcb_silkscreen_rect] Invalid data for "${pcb_silkscreen_rect_id}": expected center {x: number, y: number}, width: number, height: number, got center=${JSON.stringify(center)}, width=${JSON.stringify(width)}, height=${JSON.stringify(height)}`);
49570
49570
  return [];
49571
49571
  }
49572
- const [transformedX, transformedY] = applyToPoint20(transform2, [
49572
+ const [transformedX, transformedY] = applyToPoint21(transform2, [
49573
49573
  center.x,
49574
49574
  center.y
49575
49575
  ]);
@@ -49719,7 +49719,7 @@ function createSvgObjectsFromPcbCopperText(pcbCopperText, ctx) {
49719
49719
  return [];
49720
49720
  if (!anchor_position)
49721
49721
  return [];
49722
- const [ax2, ay2] = applyToPoint20(transform2, [
49722
+ const [ax2, ay2] = applyToPoint21(transform2, [
49723
49723
  anchor_position.x,
49724
49724
  anchor_position.y
49725
49725
  ]);
@@ -49736,7 +49736,7 @@ function createSvgObjectsFromPcbCopperText(pcbCopperText, ctx) {
49736
49736
  const rectW = width2 + padX * 2;
49737
49737
  const rectH = height2 + padY * 2;
49738
49738
  const strokeWidth2 = scaledFontSize2 * 0.15;
49739
- const knockoutTransform = toString(compose5(translate5(ax2, ay2), rotate6(-ccw_rotation * Math.PI / 180), ...applyMirror ? [scale4(-1, 1)] : [], scale4(scaleFactor, scaleFactor)));
49739
+ const knockoutTransform = toString(compose6(translate6(ax2, ay2), rotate7(-ccw_rotation * Math.PI / 180), ...applyMirror ? [scale5(-1, 1)] : [], scale5(scaleFactor, scaleFactor)));
49740
49740
  const maskId = `knockout-mask-${pcbCopperText.pcb_copper_text_id}-${maskIdCounter++}`;
49741
49741
  return [
49742
49742
  {
@@ -49838,7 +49838,7 @@ function createSvgObjectsFromPcbCopperText(pcbCopperText, ctx) {
49838
49838
  offsetY = -height / 2;
49839
49839
  break;
49840
49840
  }
49841
- const textTransform = toString(compose5(translate5(ax2, ay2), rotate6(-ccw_rotation * Math.PI / 180), ...applyMirror ? [scale4(-1, 1)] : [], translate5(offsetX, offsetY), scale4(scaleFactor, scaleFactor)));
49841
+ const textTransform = toString(compose6(translate6(ax2, ay2), rotate7(-ccw_rotation * Math.PI / 180), ...applyMirror ? [scale5(-1, 1)] : [], translate6(offsetX, offsetY), scale5(scaleFactor, scaleFactor)));
49842
49842
  const strokeWidth = scaledFontSize * 0.15;
49843
49843
  return [
49844
49844
  {
@@ -49876,7 +49876,7 @@ function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, ctx) {
49876
49876
  console.error("Invalid PCB Silkscreen Circle data:", { center, radius });
49877
49877
  return [];
49878
49878
  }
49879
- const [transformedX, transformedY] = applyToPoint20(transform2, [
49879
+ const [transformedX, transformedY] = applyToPoint21(transform2, [
49880
49880
  center.x,
49881
49881
  center.y
49882
49882
  ]);
@@ -49919,8 +49919,8 @@ function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine, ctx) {
49919
49919
  debugPcb(`[pcb_silkscreen_line] Invalid coordinates for "${pcb_silkscreen_line_id}": expected x1, y1, x2, y2 as numbers, got x1=${JSON.stringify(x12)}, y1=${JSON.stringify(y12)}, x2=${JSON.stringify(x22)}, y2=${JSON.stringify(y22)}`);
49920
49920
  return [];
49921
49921
  }
49922
- const [transformedX1, transformedY1] = applyToPoint20(transform2, [x12, y12]);
49923
- const [transformedX2, transformedY2] = applyToPoint20(transform2, [x22, y22]);
49922
+ const [transformedX1, transformedY1] = applyToPoint21(transform2, [x12, y12]);
49923
+ const [transformedX2, transformedY2] = applyToPoint21(transform2, [x22, y22]);
49924
49924
  const transformedStrokeWidth = stroke_width * Math.abs(transform2.a);
49925
49925
  const color = layer === "bottom" ? colorMap2.silkscreen.bottom : colorMap2.silkscreen.top;
49926
49926
  return [
@@ -49955,7 +49955,7 @@ function createSvgObjectsFromPcbSilkscreenPill(pcbSilkscreenPill, ctx) {
49955
49955
  } = pcbSilkscreenPill;
49956
49956
  if (layerFilter && layer !== layerFilter)
49957
49957
  return [];
49958
- const [transformedX, transformedY] = applyToPoint20(transform2, [
49958
+ const [transformedX, transformedY] = applyToPoint21(transform2, [
49959
49959
  center.x,
49960
49960
  center.y
49961
49961
  ]);
@@ -50005,7 +50005,7 @@ function createSvgObjectsFromPcbSilkscreenOval(pcbSilkscreenOval, ctx) {
50005
50005
  debugPcb(`[pcb_silkscreen_oval] Invalid data for "${pcb_silkscreen_oval_id}": expected center {x: number, y: number}, radius_x: number, radius_y: number, got center=${JSON.stringify(center)}, radius_x=${JSON.stringify(radius_x)}, radius_y=${JSON.stringify(radius_y)}`);
50006
50006
  return [];
50007
50007
  }
50008
- const [transformedX, transformedY] = applyToPoint20(transform2, [
50008
+ const [transformedX, transformedY] = applyToPoint21(transform2, [
50009
50009
  center.x,
50010
50010
  center.y
50011
50011
  ]);
@@ -50052,7 +50052,7 @@ function createSvgObjectsFromPcbCourtyardRect(pcbCourtyardRect, ctx) {
50052
50052
  debugPcb(`[pcb_courtyard_rect] Invalid data for "${pcb_courtyard_rect_id}": expected center {x: number, y: number}, width: number, height: number, got center=${JSON.stringify(center)}, width=${JSON.stringify(width)}, height=${JSON.stringify(height)}`);
50053
50053
  return [];
50054
50054
  }
50055
- const [transformedX, transformedY] = applyToPoint20(transform2, [
50055
+ const [transformedX, transformedY] = applyToPoint21(transform2, [
50056
50056
  center.x,
50057
50057
  center.y
50058
50058
  ]);
@@ -50102,7 +50102,7 @@ function createSvgObjectsFromPcbCourtyardPolygon(pcbCourtyardPolygon, ctx) {
50102
50102
  debugPcb(`[pcb_courtyard_polygon] Invalid data for "${pcb_courtyard_polygon_id}": expected non-empty array of points, got ${JSON.stringify(points)}`);
50103
50103
  return [];
50104
50104
  }
50105
- const transformedPoints = points.map((p) => applyToPoint20(transform2, [p.x, p.y]));
50105
+ const transformedPoints = points.map((p) => applyToPoint21(transform2, [p.x, p.y]));
50106
50106
  const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
50107
50107
  const transformedStrokeWidth = 0.05 * Math.abs(transform2.a);
50108
50108
  const strokeColor = color ?? (layer === "bottom" ? colorMap2.courtyard.bottom : colorMap2.courtyard.top);
@@ -50134,7 +50134,7 @@ function createSvgObjectsFromPcbCourtyardOutline(pcbCourtyardOutline, ctx) {
50134
50134
  debugPcb(`[pcb_courtyard_outline] Invalid data for "${pcb_courtyard_outline_id}": expected non-empty array of points, got ${JSON.stringify(outline)}`);
50135
50135
  return [];
50136
50136
  }
50137
- const transformedPoints = outline.map((p) => applyToPoint20(transform2, [p.x, p.y]));
50137
+ const transformedPoints = outline.map((p) => applyToPoint21(transform2, [p.x, p.y]));
50138
50138
  const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
50139
50139
  const transformedStrokeWidth = 0.05 * Math.abs(transform2.a);
50140
50140
  const strokeColor = layer === "bottom" ? colorMap2.courtyard.bottom : colorMap2.courtyard.top;
@@ -50171,7 +50171,7 @@ function createSvgObjectsFromPcbCourtyardCircle(pcbCourtyardCircle, ctx) {
50171
50171
  console.error(`[pcb_courtyard_circle] Invalid data for "${pcb_courtyard_circle_id}": expected center {x: number, y: number}, radius: number, got center=${JSON.stringify(center)}, radius=${JSON.stringify(radius)}`);
50172
50172
  return [];
50173
50173
  }
50174
- const [transformedX, transformedY] = applyToPoint20(transform2, [
50174
+ const [transformedX, transformedY] = applyToPoint21(transform2, [
50175
50175
  center.x,
50176
50176
  center.y
50177
50177
  ]);
@@ -50216,8 +50216,8 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
50216
50216
  if (start.is_inside_copper_pour === true && end.is_inside_copper_pour === true) {
50217
50217
  continue;
50218
50218
  }
50219
- const startPoint = applyToPoint20(transform2, [start.x, start.y]);
50220
- const endPoint = applyToPoint20(transform2, [end.x, end.y]);
50219
+ const startPoint = applyToPoint21(transform2, [start.x, start.y]);
50220
+ const endPoint = applyToPoint21(transform2, [end.x, end.y]);
50221
50221
  const layer = "layer" in start ? start.layer : ("layer" in end) ? end.layer : null;
50222
50222
  if (!layer)
50223
50223
  continue;
@@ -50283,7 +50283,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
50283
50283
  if (pad.shape === "rect" || pad.shape === "rotated_rect") {
50284
50284
  const width = pad.width * Math.abs(transform2.a);
50285
50285
  const height = pad.height * Math.abs(transform2.d);
50286
- const [x3, y] = applyToPoint20(transform2, [pad.x, pad.y]);
50286
+ const [x3, y] = applyToPoint21(transform2, [pad.x, pad.y]);
50287
50287
  const cornerRadiusValue = pad.corner_radius ?? pad.rect_border_radius ?? 0;
50288
50288
  const scaledBorderRadius = cornerRadiusValue * Math.abs(transform2.a);
50289
50289
  const m = {
@@ -50533,7 +50533,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
50533
50533
  const width = pad.width * Math.abs(transform2.a);
50534
50534
  const height = pad.height * Math.abs(transform2.d);
50535
50535
  const radius = pad.radius * Math.abs(transform2.a);
50536
- const [x3, y] = applyToPoint20(transform2, [pad.x, pad.y]);
50536
+ const [x3, y] = applyToPoint21(transform2, [pad.x, pad.y]);
50537
50537
  const rotationTransformAttributes = isRotated ? {
50538
50538
  transform: `translate(${x3} ${y}) rotate(${-(pad.ccw_rotation ?? 0)})`
50539
50539
  } : undefined;
@@ -50651,7 +50651,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
50651
50651
  }
50652
50652
  if (pad.shape === "circle") {
50653
50653
  const radius = pad.radius * Math.abs(transform2.a);
50654
- const [x3, y] = applyToPoint20(transform2, [pad.x, pad.y]);
50654
+ const [x3, y] = applyToPoint21(transform2, [pad.x, pad.y]);
50655
50655
  const padElement = {
50656
50656
  name: "circle",
50657
50657
  type: "element",
@@ -50740,7 +50740,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
50740
50740
  return [substrateElement, padElement];
50741
50741
  }
50742
50742
  if (pad.shape === "polygon") {
50743
- const points = (pad.points ?? []).map((point2) => applyToPoint20(transform2, [point2.x, point2.y]));
50743
+ const points = (pad.points ?? []).map((point2) => applyToPoint21(transform2, [point2.x, point2.y]));
50744
50744
  const padElement = {
50745
50745
  name: "polygon",
50746
50746
  type: "element",
@@ -50848,11 +50848,11 @@ function createAnchorOffsetIndicators(params2) {
50848
50848
  displayYOffset
50849
50849
  } = params2;
50850
50850
  const objects = [];
50851
- const [screenGroupAnchorX, screenGroupAnchorY] = applyToPoint20(transform2, [
50851
+ const [screenGroupAnchorX, screenGroupAnchorY] = applyToPoint21(transform2, [
50852
50852
  groupAnchorPosition.x,
50853
50853
  groupAnchorPosition.y
50854
50854
  ]);
50855
- const [screenComponentX, screenComponentY] = applyToPoint20(transform2, [
50855
+ const [screenComponentX, screenComponentY] = applyToPoint21(transform2, [
50856
50856
  componentPosition.x,
50857
50857
  componentPosition.y
50858
50858
  ]);
@@ -51188,25 +51188,25 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
51188
51188
  let path42;
51189
51189
  if (outline && Array.isArray(outline) && outline.length >= 3) {
51190
51190
  path42 = outline.map((point2, index) => {
51191
- const [x3, y] = applyToPoint20(transform2, [point2.x, point2.y]);
51191
+ const [x3, y] = applyToPoint21(transform2, [point2.x, point2.y]);
51192
51192
  return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
51193
51193
  }).join(" ");
51194
51194
  } else {
51195
51195
  const halfWidth = width / 2;
51196
51196
  const halfHeight = height / 2;
51197
- const topLeft = applyToPoint20(transform2, [
51197
+ const topLeft = applyToPoint21(transform2, [
51198
51198
  center.x - halfWidth,
51199
51199
  center.y - halfHeight
51200
51200
  ]);
51201
- const topRight = applyToPoint20(transform2, [
51201
+ const topRight = applyToPoint21(transform2, [
51202
51202
  center.x + halfWidth,
51203
51203
  center.y - halfHeight
51204
51204
  ]);
51205
- const bottomRight = applyToPoint20(transform2, [
51205
+ const bottomRight = applyToPoint21(transform2, [
51206
51206
  center.x + halfWidth,
51207
51207
  center.y + halfHeight
51208
51208
  ]);
51209
- const bottomLeft = applyToPoint20(transform2, [
51209
+ const bottomLeft = applyToPoint21(transform2, [
51210
51210
  center.x - halfWidth,
51211
51211
  center.y + halfHeight
51212
51212
  ]);
@@ -51274,19 +51274,19 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
51274
51274
  const center = pcbPanel.center ?? { x: width / 2, y: height / 2 };
51275
51275
  const halfWidth = width / 2;
51276
51276
  const halfHeight = height / 2;
51277
- const topLeft = applyToPoint20(transform2, [
51277
+ const topLeft = applyToPoint21(transform2, [
51278
51278
  center.x - halfWidth,
51279
51279
  center.y - halfHeight
51280
51280
  ]);
51281
- const topRight = applyToPoint20(transform2, [
51281
+ const topRight = applyToPoint21(transform2, [
51282
51282
  center.x + halfWidth,
51283
51283
  center.y - halfHeight
51284
51284
  ]);
51285
- const bottomRight = applyToPoint20(transform2, [
51285
+ const bottomRight = applyToPoint21(transform2, [
51286
51286
  center.x + halfWidth,
51287
51287
  center.y + halfHeight
51288
51288
  ]);
51289
- const bottomLeft = applyToPoint20(transform2, [
51289
+ const bottomLeft = applyToPoint21(transform2, [
51290
51290
  center.x - halfWidth,
51291
51291
  center.y + halfHeight
51292
51292
  ]);
@@ -51313,7 +51313,7 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
51313
51313
  }
51314
51314
  function createSvgObjectsFromPcbVia(hole, ctx) {
51315
51315
  const { transform: transform2, colorMap: colorMap2 } = ctx;
51316
- const [x3, y] = applyToPoint20(transform2, [hole.x, hole.y]);
51316
+ const [x3, y] = applyToPoint21(transform2, [hole.x, hole.y]);
51317
51317
  const scaledOuterWidth = hole.outer_diameter * Math.abs(transform2.a);
51318
51318
  const scaledOuterHeight = hole.outer_diameter * Math.abs(transform2.a);
51319
51319
  const scaledHoleWidth = hole.hole_diameter * Math.abs(transform2.a);
@@ -51360,7 +51360,7 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
51360
51360
  function createSvgObjectsFromPcbHole(hole, ctx) {
51361
51361
  const { transform: transform2, colorMap: colorMap2, showSolderMask } = ctx;
51362
51362
  const layer = ctx.layer ?? "top";
51363
- const [x3, y] = applyToPoint20(transform2, [hole.x, hole.y]);
51363
+ const [x3, y] = applyToPoint21(transform2, [hole.x, hole.y]);
51364
51364
  const isCoveredWithSolderMask = Boolean(hole.is_covered_with_solder_mask);
51365
51365
  const soldermaskMargin = (hole.soldermask_margin ?? 0) * Math.abs(transform2.a);
51366
51366
  const shouldShowSolderMask = showSolderMask && isCoveredWithSolderMask && soldermaskMargin !== 0;
@@ -51858,11 +51858,11 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
51858
51858
  });
51859
51859
  const svgObjects = [];
51860
51860
  for (const line of ratsNestLines) {
51861
- const transformedStart = applyToPoint20(transform2, [
51861
+ const transformedStart = applyToPoint21(transform2, [
51862
51862
  line.startPoint.x,
51863
51863
  line.startPoint.y
51864
51864
  ]);
51865
- const transformedEnd = applyToPoint20(transform2, [
51865
+ const transformedEnd = applyToPoint21(transform2, [
51866
51866
  line.endPoint.x,
51867
51867
  line.endPoint.y
51868
51868
  ]);
@@ -51891,7 +51891,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
51891
51891
  const { transform: transform2, colorMap: colorMap2 } = ctx;
51892
51892
  if (cutout.shape === "rect") {
51893
51893
  const rectCutout = cutout;
51894
- const [cx2, cy2] = applyToPoint20(transform2, [
51894
+ const [cx2, cy2] = applyToPoint21(transform2, [
51895
51895
  rectCutout.center.x,
51896
51896
  rectCutout.center.y
51897
51897
  ]);
@@ -51909,7 +51909,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
51909
51909
  width: scaledWidth.toString(),
51910
51910
  height: scaledHeight.toString(),
51911
51911
  fill: colorMap2.drill,
51912
- transform: toString(compose5(translate5(cx2, cy2), rotate6(svgRotation * Math.PI / 180))),
51912
+ transform: toString(compose6(translate6(cx2, cy2), rotate7(svgRotation * Math.PI / 180))),
51913
51913
  "data-type": "pcb_cutout",
51914
51914
  "data-pcb-layer": "drill"
51915
51915
  };
@@ -51931,7 +51931,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
51931
51931
  }
51932
51932
  if (cutout.shape === "circle") {
51933
51933
  const circleCutout = cutout;
51934
- const [cx2, cy2] = applyToPoint20(transform2, [
51934
+ const [cx2, cy2] = applyToPoint21(transform2, [
51935
51935
  circleCutout.center.x,
51936
51936
  circleCutout.center.y
51937
51937
  ]);
@@ -51958,7 +51958,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
51958
51958
  const polygonCutout = cutout;
51959
51959
  if (!polygonCutout.points || polygonCutout.points.length === 0)
51960
51960
  return [];
51961
- const transformedPoints = polygonCutout.points.map((p) => applyToPoint20(transform2, [p.x, p.y]));
51961
+ const transformedPoints = polygonCutout.points.map((p) => applyToPoint21(transform2, [p.x, p.y]));
51962
51962
  const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
51963
51963
  return [
51964
51964
  {
@@ -51986,7 +51986,7 @@ function createSvgObjectsFromPcbCutoutPath(cutoutPath, ctx) {
51986
51986
  const lastPoint = cutoutPath.route[cutoutPath.route.length - 1];
51987
51987
  const isClosed = firstPoint && lastPoint && firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y;
51988
51988
  const path42 = cutoutPath.route.slice(0, isClosed ? -1 : undefined).map((point2, index) => {
51989
- const [x3, y] = applyToPoint20(transform2, [point2.x, point2.y]);
51989
+ const [x3, y] = applyToPoint21(transform2, [point2.x, point2.y]);
51990
51990
  return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
51991
51991
  }).join(" ") + (isClosed ? " Z" : "");
51992
51992
  return [
@@ -52088,13 +52088,13 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
52088
52088
  }
52089
52089
  if (keepout.shape === "rect") {
52090
52090
  const rectKeepout = keepout;
52091
- const [cx2, cy2] = applyToPoint20(transform2, [
52091
+ const [cx2, cy2] = applyToPoint21(transform2, [
52092
52092
  rectKeepout.center.x,
52093
52093
  rectKeepout.center.y
52094
52094
  ]);
52095
52095
  const scaledWidth = rectKeepout.width * Math.abs(transform2.a);
52096
52096
  const scaledHeight = rectKeepout.height * Math.abs(transform2.d);
52097
- const baseTransform = toString(compose5(translate5(cx2, cy2)));
52097
+ const baseTransform = toString(compose6(translate6(cx2, cy2)));
52098
52098
  const backgroundAttributes = {
52099
52099
  ...createKeepoutBaseAttributes(rectKeepout.pcb_keepout_id, layer, "pcb-keepout-rect", rectKeepout.description),
52100
52100
  x: (-scaledWidth / 2).toString(),
@@ -52127,7 +52127,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
52127
52127
  });
52128
52128
  } else if (keepout.shape === "circle") {
52129
52129
  const circleKeepout = keepout;
52130
- const [cx2, cy2] = applyToPoint20(transform2, [
52130
+ const [cx2, cy2] = applyToPoint21(transform2, [
52131
52131
  circleKeepout.center.x,
52132
52132
  circleKeepout.center.y
52133
52133
  ]);
@@ -52166,7 +52166,7 @@ function ringToPathD(vertices, transform2) {
52166
52166
  if (vertices.length === 0)
52167
52167
  return "";
52168
52168
  const transformedVertices = vertices.map((v3) => {
52169
- const [x3, y] = applyToPoint20(transform2, [v3.x, v3.y]);
52169
+ const [x3, y] = applyToPoint21(transform2, [v3.x, v3.y]);
52170
52170
  return { ...v3, x: x3, y };
52171
52171
  });
52172
52172
  let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
@@ -52251,7 +52251,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
52251
52251
  const maskOverlayColor = layer === "bottom" ? colorMap2.soldermaskOverCopper.bottom : colorMap2.soldermaskOverCopper.top;
52252
52252
  const maskOverlayOpacity = "0.9";
52253
52253
  if (pour.shape === "rect") {
52254
- const [cx2, cy2] = applyToPoint20(transform2, [pour.center.x, pour.center.y]);
52254
+ const [cx2, cy2] = applyToPoint21(transform2, [pour.center.x, pour.center.y]);
52255
52255
  const scaledWidth = pour.width * Math.abs(transform2.a);
52256
52256
  const scaledHeight = pour.height * Math.abs(transform2.d);
52257
52257
  const svgRotation = -(pour.rotation ?? 0);
@@ -52260,7 +52260,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
52260
52260
  y: (-scaledHeight / 2).toString(),
52261
52261
  width: scaledWidth.toString(),
52262
52262
  height: scaledHeight.toString(),
52263
- transform: toString(compose5(translate5(cx2, cy2), rotate6(svgRotation * Math.PI / 180)))
52263
+ transform: toString(compose6(translate6(cx2, cy2), rotate7(svgRotation * Math.PI / 180)))
52264
52264
  };
52265
52265
  const copperRect = {
52266
52266
  name: "rect",
@@ -52301,7 +52301,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
52301
52301
  if (pour.shape === "polygon") {
52302
52302
  if (!pour.points || pour.points.length === 0)
52303
52303
  return [];
52304
- const transformedPoints = pour.points.map((p) => applyToPoint20(transform2, [p.x, p.y]));
52304
+ const transformedPoints = pour.points.map((p) => applyToPoint21(transform2, [p.x, p.y]));
52305
52305
  const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
52306
52306
  const copperPolygon = {
52307
52307
  name: "polygon",
@@ -52510,7 +52510,7 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
52510
52510
  function createSvgObjectsFromPcbComponent(component, ctx) {
52511
52511
  const { transform: transform2, circuitJson } = ctx;
52512
52512
  const { center, width, height, rotation: rotation2 = 0 } = component;
52513
- const [x3, y] = applyToPoint20(transform2, [center.x, center.y]);
52513
+ const [x3, y] = applyToPoint21(transform2, [center.x, center.y]);
52514
52514
  const scaledWidth = width * Math.abs(transform2.a);
52515
52515
  const scaledHeight = height * Math.abs(transform2.d);
52516
52516
  const transformStr = `translate(${x3}, ${y}) rotate(${-rotation2}) scale(1, -1)`;
@@ -52613,7 +52613,7 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
52613
52613
  }
52614
52614
  if (outline && outline.length >= 3 && outline.every((point2) => point2 && typeof point2.x === "number" && typeof point2.y === "number")) {
52615
52615
  const path42 = outline.map((point2, index) => {
52616
- const [x3, y] = applyToPoint20(transform2, [point2.x, point2.y]);
52616
+ const [x3, y] = applyToPoint21(transform2, [point2.x, point2.y]);
52617
52617
  return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
52618
52618
  }).join(" ");
52619
52619
  svgObjects.push({
@@ -52634,11 +52634,11 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
52634
52634
  }
52635
52635
  const halfWidth = width / 2;
52636
52636
  const halfHeight = height / 2;
52637
- const [topLeftX, topLeftY] = applyToPoint20(transform2, [
52637
+ const [topLeftX, topLeftY] = applyToPoint21(transform2, [
52638
52638
  center.x - halfWidth,
52639
52639
  center.y + halfHeight
52640
52640
  ]);
52641
- const [bottomRightX, bottomRightY] = applyToPoint20(transform2, [
52641
+ const [bottomRightX, bottomRightY] = applyToPoint21(transform2, [
52642
52642
  center.x + halfWidth,
52643
52643
  center.y - halfHeight
52644
52644
  ]);
@@ -53322,7 +53322,7 @@ function convertCircuitJsonToPcbSvg2(circuitJson, options) {
53322
53322
  const scaleFactor = Math.min(scaleX, scaleY);
53323
53323
  const offsetX = (svgWidth - circuitWidth * scaleFactor) / 2;
53324
53324
  const offsetY = (svgHeight - circuitHeight * scaleFactor) / 2;
53325
- const transform2 = compose5(translate5(offsetX - boundsMinX * scaleFactor + padding * scaleFactor, svgHeight - offsetY + boundsMinY * scaleFactor - padding * scaleFactor), scale4(scaleFactor, -scaleFactor));
53325
+ const transform2 = compose6(translate6(offsetX - boundsMinX * scaleFactor + padding * scaleFactor, svgHeight - offsetY + boundsMinY * scaleFactor - padding * scaleFactor), scale5(scaleFactor, -scaleFactor));
53326
53326
  const ctx = {
53327
53327
  transform: transform2,
53328
53328
  layer,
@@ -53540,8 +53540,8 @@ function createSvgObjects({
53540
53540
  }
53541
53541
  }
53542
53542
  function createSvgObjectFromPcbBoundary(transform2, minX, minY, maxX, maxY) {
53543
- const [x12, y12] = applyToPoint20(transform2, [minX, minY]);
53544
- const [x22, y22] = applyToPoint20(transform2, [maxX, maxY]);
53543
+ const [x12, y12] = applyToPoint21(transform2, [minX, minY]);
53544
+ const [x22, y22] = applyToPoint21(transform2, [maxX, maxY]);
53545
53545
  const width = Math.abs(x22 - x12);
53546
53546
  const height = Math.abs(y22 - y12);
53547
53547
  const x3 = Math.min(x12, x22);
@@ -53570,25 +53570,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform2, style = {}) {
53570
53570
  let path42;
53571
53571
  if (outline && Array.isArray(outline) && outline.length >= 3) {
53572
53572
  path42 = outline.map((point2, index) => {
53573
- const [x3, y] = applyToPoint20(transform2, [point2.x, point2.y]);
53573
+ const [x3, y] = applyToPoint21(transform2, [point2.x, point2.y]);
53574
53574
  return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
53575
53575
  }).join(" ");
53576
53576
  } else {
53577
53577
  const halfWidth = width / 2;
53578
53578
  const halfHeight = height / 2;
53579
- const topLeft = applyToPoint20(transform2, [
53579
+ const topLeft = applyToPoint21(transform2, [
53580
53580
  center.x - halfWidth,
53581
53581
  center.y - halfHeight
53582
53582
  ]);
53583
- const topRight = applyToPoint20(transform2, [
53583
+ const topRight = applyToPoint21(transform2, [
53584
53584
  center.x + halfWidth,
53585
53585
  center.y - halfHeight
53586
53586
  ]);
53587
- const bottomRight = applyToPoint20(transform2, [
53587
+ const bottomRight = applyToPoint21(transform2, [
53588
53588
  center.x + halfWidth,
53589
53589
  center.y + halfHeight
53590
53590
  ]);
53591
- const bottomLeft = applyToPoint20(transform2, [
53591
+ const bottomLeft = applyToPoint21(transform2, [
53592
53592
  center.x - halfWidth,
53593
53593
  center.y + halfHeight
53594
53594
  ]);
@@ -53618,8 +53618,8 @@ function createSvgObjectsFromAssemblyComponent(params2, ctx) {
53618
53618
  const { center, width, height, rotation: rotation2 = 0, layer = "top" } = elm;
53619
53619
  if (!center || typeof width !== "number" || typeof height !== "number")
53620
53620
  return null;
53621
- const [x3, y] = applyToPoint20(transform2, [center.x, center.y]);
53622
- const [pinX, pinY] = applyToPoint20(transform2, [portPosition.x, portPosition.y]);
53621
+ const [x3, y] = applyToPoint21(transform2, [center.x, center.y]);
53622
+ const [pinX, pinY] = applyToPoint21(transform2, [portPosition.x, portPosition.y]);
53623
53623
  const scaledWidth = width * Math.abs(transform2.a);
53624
53624
  const scaledHeight = height * Math.abs(transform2.d);
53625
53625
  const isTopLayer = layer === "top";
@@ -53757,7 +53757,7 @@ function getRectPathData(w3, h, rotation2) {
53757
53757
  }
53758
53758
  function createSvgObjectsFromAssemblyHole(hole, ctx) {
53759
53759
  const { transform: transform2 } = ctx;
53760
- const [x3, y] = applyToPoint20(transform2, [hole.x, hole.y]);
53760
+ const [x3, y] = applyToPoint21(transform2, [hole.x, hole.y]);
53761
53761
  if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
53762
53762
  const scaledDiameter = hole.hole_diameter * Math.abs(transform2.a);
53763
53763
  const radius = scaledDiameter / 2;
@@ -53821,7 +53821,7 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
53821
53821
  }
53822
53822
  function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
53823
53823
  const { transform: transform2 } = ctx;
53824
- const [x3, y] = applyToPoint20(transform2, [hole.x, hole.y]);
53824
+ const [x3, y] = applyToPoint21(transform2, [hole.x, hole.y]);
53825
53825
  if (hole.shape === "pill") {
53826
53826
  const scaledOuterWidth = hole.outer_width * Math.abs(transform2.a);
53827
53827
  const scaledOuterHeight = hole.outer_height * Math.abs(transform2.a);
@@ -53915,7 +53915,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
53915
53915
  const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform2.a);
53916
53916
  const rectCcwRotation = circularHole.rect_ccw_rotation ?? 0;
53917
53917
  const holeRadius = scaledHoleDiameter / 2;
53918
- const [holeCx, holeCy] = applyToPoint20(transform2, [
53918
+ const [holeCx, holeCy] = applyToPoint21(transform2, [
53919
53919
  circularHole.x + circularHole.hole_offset_x,
53920
53920
  circularHole.y + circularHole.hole_offset_y
53921
53921
  ]);
@@ -53977,7 +53977,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
53977
53977
  const pillHoleWithOffsets = pillHole;
53978
53978
  const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
53979
53979
  const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
53980
- const [holeCenterX, holeCenterY] = applyToPoint20(transform2, [
53980
+ const [holeCenterX, holeCenterY] = applyToPoint21(transform2, [
53981
53981
  pillHole.x + holeOffsetX,
53982
53982
  pillHole.y + holeOffsetY
53983
53983
  ]);
@@ -54037,7 +54037,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
54037
54037
  const rotatedHoleWithOffsets = rotatedHole;
54038
54038
  const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
54039
54039
  const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
54040
- const [holeCenterX, holeCenterY] = applyToPoint20(transform2, [
54040
+ const [holeCenterX, holeCenterY] = applyToPoint21(transform2, [
54041
54041
  rotatedHole.x + holeOffsetX,
54042
54042
  rotatedHole.y + holeOffsetY
54043
54043
  ]);
@@ -54096,7 +54096,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
54096
54096
  if (pad.shape === "rect" || pad.shape === "rotated_rect") {
54097
54097
  const width = pad.width * Math.abs(transform2.a);
54098
54098
  const height = pad.height * Math.abs(transform2.d);
54099
- const [x3, y] = applyToPoint20(transform2, [pad.x, pad.y]);
54099
+ const [x3, y] = applyToPoint21(transform2, [pad.x, pad.y]);
54100
54100
  const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform2.a);
54101
54101
  if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
54102
54102
  return [
@@ -54148,7 +54148,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
54148
54148
  const width = pad.width * Math.abs(transform2.a);
54149
54149
  const height = pad.height * Math.abs(transform2.d);
54150
54150
  const radius = pad.radius * Math.abs(transform2.a);
54151
- const [x3, y] = applyToPoint20(transform2, [pad.x, pad.y]);
54151
+ const [x3, y] = applyToPoint21(transform2, [pad.x, pad.y]);
54152
54152
  return [
54153
54153
  {
54154
54154
  name: "rect",
@@ -54171,7 +54171,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
54171
54171
  }
54172
54172
  if (pad.shape === "circle") {
54173
54173
  const radius = pad.radius * Math.abs(transform2.a);
54174
- const [x3, y] = applyToPoint20(transform2, [pad.x, pad.y]);
54174
+ const [x3, y] = applyToPoint21(transform2, [pad.x, pad.y]);
54175
54175
  return [
54176
54176
  {
54177
54177
  name: "circle",
@@ -54190,7 +54190,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
54190
54190
  ];
54191
54191
  }
54192
54192
  if (pad.shape === "polygon") {
54193
- const points = (pad.points ?? []).map((point2) => applyToPoint20(transform2, [point2.x, point2.y]));
54193
+ const points = (pad.points ?? []).map((point2) => applyToPoint21(transform2, [point2.x, point2.y]));
54194
54194
  return [
54195
54195
  {
54196
54196
  name: "polygon",
@@ -54234,7 +54234,7 @@ function convertCircuitJsonToAssemblySvg(soup, options) {
54234
54234
  const scaleFactor = Math.min(scaleX, scaleY);
54235
54235
  const offsetX = (svgWidth - circuitWidth * scaleFactor) / 2;
54236
54236
  const offsetY = (svgHeight - circuitHeight * scaleFactor) / 2;
54237
- const transform2 = compose5(translate5(offsetX - minX * scaleFactor + padding * scaleFactor, svgHeight - offsetY + minY * scaleFactor - padding * scaleFactor), scale4(scaleFactor, -scaleFactor));
54237
+ const transform2 = compose6(translate6(offsetX - minX * scaleFactor + padding * scaleFactor, svgHeight - offsetY + minY * scaleFactor - padding * scaleFactor), scale5(scaleFactor, -scaleFactor));
54238
54238
  const ctx = { transform: transform2 };
54239
54239
  const svgObjects = soup.sort((a, b) => (OBJECT_ORDER.indexOf(b.type) ?? 9999) - (OBJECT_ORDER.indexOf(a.type) ?? 9999)).flatMap((item) => createSvgObjects2(item, ctx, soup));
54240
54240
  const softwareUsedString = getSoftwareUsedString(soup);
@@ -54350,8 +54350,8 @@ function createSvgObjects2(elm, ctx, soup) {
54350
54350
  }
54351
54351
  }
54352
54352
  function createSvgObjectFromAssemblyBoundary(transform2, minX, minY, maxX, maxY) {
54353
- const [x12, y12] = applyToPoint20(transform2, [minX, minY]);
54354
- const [x22, y22] = applyToPoint20(transform2, [maxX, maxY]);
54353
+ const [x12, y12] = applyToPoint21(transform2, [minX, minY]);
54354
+ const [x22, y22] = applyToPoint21(transform2, [maxX, maxY]);
54355
54355
  const width = Math.abs(x22 - x12);
54356
54356
  const height = Math.abs(y22 - y12);
54357
54357
  const x3 = Math.min(x12, x22);
@@ -54378,25 +54378,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
54378
54378
  let path42;
54379
54379
  if (outline && Array.isArray(outline) && outline.length >= 3) {
54380
54380
  path42 = outline.map((point2, index) => {
54381
- const [x3, y] = applyToPoint20(transform2, [point2.x, point2.y]);
54381
+ const [x3, y] = applyToPoint21(transform2, [point2.x, point2.y]);
54382
54382
  return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
54383
54383
  }).join(" ");
54384
54384
  } else {
54385
54385
  const halfWidth = width / 2;
54386
54386
  const halfHeight = height / 2;
54387
- const topLeft = applyToPoint20(transform2, [
54387
+ const topLeft = applyToPoint21(transform2, [
54388
54388
  center.x - halfWidth,
54389
54389
  center.y - halfHeight
54390
54390
  ]);
54391
- const topRight = applyToPoint20(transform2, [
54391
+ const topRight = applyToPoint21(transform2, [
54392
54392
  center.x + halfWidth,
54393
54393
  center.y - halfHeight
54394
54394
  ]);
54395
- const bottomRight = applyToPoint20(transform2, [
54395
+ const bottomRight = applyToPoint21(transform2, [
54396
54396
  center.x + halfWidth,
54397
54397
  center.y + halfHeight
54398
54398
  ]);
54399
- const bottomLeft = applyToPoint20(transform2, [
54399
+ const bottomLeft = applyToPoint21(transform2, [
54400
54400
  center.x - halfWidth,
54401
54401
  center.y + halfHeight
54402
54402
  ]);
@@ -54414,10 +54414,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
54414
54414
  const halfWidth = width2 / 2;
54415
54415
  const halfHeight = height2 / 2;
54416
54416
  const [tl2, tr2, br2, bl2] = [
54417
- applyToPoint20(transform2, [x3 - halfWidth, y - halfHeight]),
54418
- applyToPoint20(transform2, [x3 + halfWidth, y - halfHeight]),
54419
- applyToPoint20(transform2, [x3 + halfWidth, y + halfHeight]),
54420
- applyToPoint20(transform2, [x3 - halfWidth, y + halfHeight])
54417
+ applyToPoint21(transform2, [x3 - halfWidth, y - halfHeight]),
54418
+ applyToPoint21(transform2, [x3 + halfWidth, y - halfHeight]),
54419
+ applyToPoint21(transform2, [x3 + halfWidth, y + halfHeight]),
54420
+ applyToPoint21(transform2, [x3 - halfWidth, y + halfHeight])
54421
54421
  ];
54422
54422
  path42 += ` M ${tl2[0]} ${tl2[1]} L ${tr2[0]} ${tr2[1]} L ${br2[0]} ${br2[1]} L ${bl2[0]} ${bl2[1]} Z`;
54423
54423
  } else if (cutout.shape === "circle") {}
@@ -54470,7 +54470,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
54470
54470
  if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
54471
54471
  return [];
54472
54472
  }
54473
- const [x3, y] = applyToPoint20(transform2, [center.x, center.y]);
54473
+ const [x3, y] = applyToPoint21(transform2, [center.x, center.y]);
54474
54474
  const scaledWidth = width * Math.abs(transform2.a);
54475
54475
  const scaledHeight = height * Math.abs(transform2.d);
54476
54476
  const transformStr = `translate(${x3}, ${y})`;
@@ -54531,7 +54531,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
54531
54531
  }
54532
54532
  function createSvgObjectsFromPinoutHole(hole, ctx) {
54533
54533
  const { transform: transform2 } = ctx;
54534
- const [x3, y] = applyToPoint20(transform2, [hole.x, hole.y]);
54534
+ const [x3, y] = applyToPoint21(transform2, [hole.x, hole.y]);
54535
54535
  if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
54536
54536
  const scaledDiameter = hole.hole_diameter * Math.abs(transform2.a);
54537
54537
  const radius = scaledDiameter / 2;
@@ -54595,7 +54595,7 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
54595
54595
  }
54596
54596
  function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
54597
54597
  const { transform: transform2 } = ctx;
54598
- const [x3, y] = applyToPoint20(transform2, [hole.x, hole.y]);
54598
+ const [x3, y] = applyToPoint21(transform2, [hole.x, hole.y]);
54599
54599
  if (hole.shape === "pill") {
54600
54600
  const scaledOuterWidth = hole.outer_width * Math.abs(transform2.a);
54601
54601
  const scaledOuterHeight = hole.outer_height * Math.abs(transform2.a);
@@ -54827,7 +54827,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
54827
54827
  if (pad.shape === "rect" || pad.shape === "rotated_rect") {
54828
54828
  const width = pad.width * Math.abs(transform2.a);
54829
54829
  const height = pad.height * Math.abs(transform2.d);
54830
- const [x3, y] = applyToPoint20(transform2, [pad.x, pad.y]);
54830
+ const [x3, y] = applyToPoint21(transform2, [pad.x, pad.y]);
54831
54831
  if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
54832
54832
  return [
54833
54833
  {
@@ -54870,7 +54870,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
54870
54870
  const width = pad.width * Math.abs(transform2.a);
54871
54871
  const height = pad.height * Math.abs(transform2.d);
54872
54872
  const radius = pad.radius * Math.abs(transform2.a);
54873
- const [x3, y] = applyToPoint20(transform2, [pad.x, pad.y]);
54873
+ const [x3, y] = applyToPoint21(transform2, [pad.x, pad.y]);
54874
54874
  return [
54875
54875
  {
54876
54876
  name: "rect",
@@ -54893,7 +54893,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
54893
54893
  }
54894
54894
  if (pad.shape === "circle") {
54895
54895
  const radius = pad.radius * Math.abs(transform2.a);
54896
- const [x3, y] = applyToPoint20(transform2, [pad.x, pad.y]);
54896
+ const [x3, y] = applyToPoint21(transform2, [pad.x, pad.y]);
54897
54897
  return [
54898
54898
  {
54899
54899
  name: "circle",
@@ -54912,7 +54912,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
54912
54912
  ];
54913
54913
  }
54914
54914
  if (pad.shape === "polygon") {
54915
- const points = (pad.points ?? []).map((point2) => applyToPoint20(transform2, [point2.x, point2.y]));
54915
+ const points = (pad.points ?? []).map((point2) => applyToPoint21(transform2, [point2.x, point2.y]));
54916
54916
  return [
54917
54917
  {
54918
54918
  name: "polygon",
@@ -54997,7 +54997,7 @@ function createSvgObjectsFromPinoutPort(pcb_port2, ctx) {
54997
54997
  if (!label_info)
54998
54998
  return [];
54999
54999
  const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
55000
- const [port_x, port_y] = applyToPoint20(ctx.transform, [pcb_port2.x, pcb_port2.y]);
55000
+ const [port_x, port_y] = applyToPoint21(ctx.transform, [pcb_port2.x, pcb_port2.y]);
55001
55001
  const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
55002
55002
  const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
55003
55003
  const elbow_path = calculateElbow({
@@ -55147,7 +55147,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
55147
55147
  const other_pins = pinout_labels.filter((l) => Math.abs(l.pcb_port.x - primary_x) >= 0.2);
55148
55148
  const mapToEdgePort = (pinout_label) => ({
55149
55149
  pcb_port: pinout_label.pcb_port,
55150
- y: applyToPoint20(transform2, [
55150
+ y: applyToPoint21(transform2, [
55151
55151
  pinout_label.pcb_port.x,
55152
55152
  pinout_label.pcb_port.y
55153
55153
  ])[1],
@@ -55162,7 +55162,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
55162
55162
  } else {
55163
55163
  edge_ports = pinout_labels.map((pinout_label) => ({
55164
55164
  pcb_port: pinout_label.pcb_port,
55165
- y: applyToPoint20(transform2, [
55165
+ y: applyToPoint21(transform2, [
55166
55166
  pinout_label.pcb_port.x,
55167
55167
  pinout_label.pcb_port.y
55168
55168
  ])[1],
@@ -55171,7 +55171,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
55171
55171
  }
55172
55172
  if (edge_ports.length === 0)
55173
55173
  return;
55174
- const board_edge_x = applyToPoint20(transform2, [
55174
+ const board_edge_x = applyToPoint21(transform2, [
55175
55175
  edge === "left" ? board_bounds.minX : board_bounds.maxX,
55176
55176
  0
55177
55177
  ])[0];
@@ -55427,7 +55427,7 @@ function convertCircuitJsonToPinoutSvg(soup, options) {
55427
55427
  const pxPerMm = Math.min(pxPerMmX, pxPerMmY);
55428
55428
  const offsetX = (svgWidth - circuitWidth * pxPerMm) / 2;
55429
55429
  const offsetY = (svgHeight - circuitHeight * pxPerMm) / 2;
55430
- const transform2 = compose5(translate5(offsetX - expandedMinX * pxPerMm + paddingMm * pxPerMm, svgHeight - offsetY + minY * pxPerMm - paddingMm * pxPerMm), scale4(pxPerMm, -pxPerMm));
55430
+ const transform2 = compose6(translate6(offsetX - expandedMinX * pxPerMm + paddingMm * pxPerMm, svgHeight - offsetY + minY * pxPerMm - paddingMm * pxPerMm), scale5(pxPerMm, -pxPerMm));
55431
55431
  const label_positions = calculateLabelPositions({
55432
55432
  left_labels,
55433
55433
  right_labels,
@@ -55518,7 +55518,7 @@ function drawSchematicGrid(params2) {
55518
55518
  const labelCells = params2.labelCells ?? false;
55519
55519
  const gridLines = [];
55520
55520
  const transformPoint = (x3, y) => {
55521
- const [transformedX, transformedY] = applyToPoint20(params2.transform, [x3, y]);
55521
+ const [transformedX, transformedY] = applyToPoint21(params2.transform, [x3, y]);
55522
55522
  return { x: transformedX, y: transformedY };
55523
55523
  };
55524
55524
  for (let x3 = Math.floor(minX);x3 <= Math.ceil(maxX); x3 += cellSize) {
@@ -55602,10 +55602,10 @@ function drawSchematicLabeledPoints(params2) {
55602
55602
  const { points, transform: transform2 } = params2;
55603
55603
  const labeledPointsGroup = [];
55604
55604
  for (const point2 of points) {
55605
- const [x12, y12] = applyToPoint20(transform2, [point2.x - 0.1, point2.y - 0.1]);
55606
- const [x22, y22] = applyToPoint20(transform2, [point2.x + 0.1, point2.y + 0.1]);
55607
- const [x3, y32] = applyToPoint20(transform2, [point2.x - 0.1, point2.y + 0.1]);
55608
- const [x4, y4] = applyToPoint20(transform2, [point2.x + 0.1, point2.y - 0.1]);
55605
+ const [x12, y12] = applyToPoint21(transform2, [point2.x - 0.1, point2.y - 0.1]);
55606
+ const [x22, y22] = applyToPoint21(transform2, [point2.x + 0.1, point2.y + 0.1]);
55607
+ const [x3, y32] = applyToPoint21(transform2, [point2.x - 0.1, point2.y + 0.1]);
55608
+ const [x4, y4] = applyToPoint21(transform2, [point2.x + 0.1, point2.y - 0.1]);
55609
55609
  labeledPointsGroup.push({
55610
55610
  name: "path",
55611
55611
  type: "element",
@@ -55616,7 +55616,7 @@ function drawSchematicLabeledPoints(params2) {
55616
55616
  "stroke-opacity": "0.7"
55617
55617
  }
55618
55618
  });
55619
- const [labelX, labelY] = applyToPoint20(transform2, [
55619
+ const [labelX, labelY] = applyToPoint21(transform2, [
55620
55620
  point2.x + 0.15,
55621
55621
  point2.y - 0.15
55622
55622
  ]);
@@ -55805,9 +55805,9 @@ function pointPairsToMatrix(a12, a2, b12, b22) {
55805
55805
  const originalDistance = Math.sqrt((b12.x - a12.x) ** 2 + (b12.y - a12.y) ** 2);
55806
55806
  const transformedDistance = Math.sqrt((b22.x - a2.x) ** 2 + (b22.y - a2.y) ** 2);
55807
55807
  const a = transformedDistance / originalDistance;
55808
- const translateMatrix = translate5(tx2, ty2);
55809
- const scaleMatrix = scale4(a, a);
55810
- return compose5(translateMatrix, scaleMatrix);
55808
+ const translateMatrix = translate6(tx2, ty2);
55809
+ const scaleMatrix = scale5(a, a);
55810
+ return compose6(translateMatrix, scaleMatrix);
55811
55811
  }
55812
55812
  function createSvgObjectsFromSchematicComponent(params2) {
55813
55813
  const { component } = params2;
@@ -55833,7 +55833,7 @@ function createSvgObjectsFromSchVoltageProbe({
55833
55833
  transform: transform2,
55834
55834
  colorMap: colorMap2
55835
55835
  }) {
55836
- const [screenX, screenY] = applyToPoint20(transform2, [
55836
+ const [screenX, screenY] = applyToPoint21(transform2, [
55837
55837
  probe.position.x,
55838
55838
  probe.position.y
55839
55839
  ]);
@@ -56010,11 +56010,11 @@ function createSvgObjectsFromSchDebugObject({
56010
56010
  transform: transform2
56011
56011
  }) {
56012
56012
  if (debugObject.shape === "rect") {
56013
- let [screenLeft, screenTop] = applyToPoint20(transform2, [
56013
+ let [screenLeft, screenTop] = applyToPoint21(transform2, [
56014
56014
  debugObject.center.x - debugObject.size.width / 2,
56015
56015
  debugObject.center.y - debugObject.size.height / 2
56016
56016
  ]);
56017
- let [screenRight, screenBottom] = applyToPoint20(transform2, [
56017
+ let [screenRight, screenBottom] = applyToPoint21(transform2, [
56018
56018
  debugObject.center.x + debugObject.size.width / 2,
56019
56019
  debugObject.center.y + debugObject.size.height / 2
56020
56020
  ]);
@@ -56024,7 +56024,7 @@ function createSvgObjectsFromSchDebugObject({
56024
56024
  ];
56025
56025
  const width = Math.abs(screenRight - screenLeft);
56026
56026
  const height = Math.abs(screenBottom - screenTop);
56027
- const [screenCenterX, screenCenterY] = applyToPoint20(transform2, [
56027
+ const [screenCenterX, screenCenterY] = applyToPoint21(transform2, [
56028
56028
  debugObject.center.x,
56029
56029
  debugObject.center.y
56030
56030
  ]);
@@ -56070,11 +56070,11 @@ function createSvgObjectsFromSchDebugObject({
56070
56070
  ];
56071
56071
  }
56072
56072
  if (debugObject.shape === "line") {
56073
- const [screenStartX, screenStartY] = applyToPoint20(transform2, [
56073
+ const [screenStartX, screenStartY] = applyToPoint21(transform2, [
56074
56074
  debugObject.start.x,
56075
56075
  debugObject.start.y
56076
56076
  ]);
56077
- const [screenEndX, screenEndY] = applyToPoint20(transform2, [
56077
+ const [screenEndX, screenEndY] = applyToPoint21(transform2, [
56078
56078
  debugObject.end.x,
56079
56079
  debugObject.end.y
56080
56080
  ]);
@@ -56137,11 +56137,11 @@ function createSchematicTrace({
56137
56137
  const edge = edges[edgeIndex];
56138
56138
  if (edge.is_crossing)
56139
56139
  continue;
56140
- const [screenFromX, screenFromY] = applyToPoint20(transform2, [
56140
+ const [screenFromX, screenFromY] = applyToPoint21(transform2, [
56141
56141
  edge.from.x,
56142
56142
  edge.from.y
56143
56143
  ]);
56144
- const [screenToX, screenToY] = applyToPoint20(transform2, [
56144
+ const [screenToX, screenToY] = applyToPoint21(transform2, [
56145
56145
  edge.to.x,
56146
56146
  edge.to.y
56147
56147
  ]);
@@ -56186,11 +56186,11 @@ function createSchematicTrace({
56186
56186
  for (const edge of edges) {
56187
56187
  if (!edge.is_crossing)
56188
56188
  continue;
56189
- const [screenFromX, screenFromY] = applyToPoint20(transform2, [
56189
+ const [screenFromX, screenFromY] = applyToPoint21(transform2, [
56190
56190
  edge.from.x,
56191
56191
  edge.from.y
56192
56192
  ]);
56193
- const [screenToX, screenToY] = applyToPoint20(transform2, [
56193
+ const [screenToX, screenToY] = applyToPoint21(transform2, [
56194
56194
  edge.to.x,
56195
56195
  edge.to.y
56196
56196
  ]);
@@ -56234,7 +56234,7 @@ function createSchematicTrace({
56234
56234
  }
56235
56235
  if (trace.junctions) {
56236
56236
  for (const junction of trace.junctions) {
56237
- const [screenX, screenY] = applyToPoint20(transform2, [
56237
+ const [screenX, screenY] = applyToPoint21(transform2, [
56238
56238
  junction.x,
56239
56239
  junction.y
56240
56240
  ]);
@@ -56291,8 +56291,8 @@ function createSvgObjectsFromSchematicLine({
56291
56291
  transform: transform2,
56292
56292
  colorMap: colorMap2
56293
56293
  }) {
56294
- const p12 = applyToPoint20(transform2, { x: schLine.x1, y: schLine.y1 });
56295
- const p22 = applyToPoint20(transform2, { x: schLine.x2, y: schLine.y2 });
56294
+ const p12 = applyToPoint21(transform2, { x: schLine.x1, y: schLine.y1 });
56295
+ const p22 = applyToPoint21(transform2, { x: schLine.x2, y: schLine.y2 });
56296
56296
  const strokeWidth = schLine.stroke_width ?? 0.02;
56297
56297
  const transformedStrokeWidth = Math.abs(transform2.a) * strokeWidth;
56298
56298
  return [
@@ -56324,7 +56324,7 @@ function createSvgObjectsFromSchematicCircle({
56324
56324
  transform: transform2,
56325
56325
  colorMap: colorMap2
56326
56326
  }) {
56327
- const center = applyToPoint20(transform2, schCircle.center);
56327
+ const center = applyToPoint21(transform2, schCircle.center);
56328
56328
  const transformedRadius = Math.abs(transform2.a) * schCircle.radius;
56329
56329
  const strokeWidth = schCircle.stroke_width ?? 0.02;
56330
56330
  const transformedStrokeWidth = Math.abs(transform2.a) * strokeWidth;
@@ -56357,7 +56357,7 @@ function createSvgObjectsFromSchematicRect({
56357
56357
  transform: transform2,
56358
56358
  colorMap: colorMap2
56359
56359
  }) {
56360
- const center = applyToPoint20(transform2, schRect.center);
56360
+ const center = applyToPoint21(transform2, schRect.center);
56361
56361
  const transformedWidth = Math.abs(transform2.a) * schRect.width;
56362
56362
  const transformedHeight = Math.abs(transform2.d) * schRect.height;
56363
56363
  const strokeWidth = schRect.stroke_width ?? 0.02;
@@ -56396,7 +56396,7 @@ function createSvgObjectsFromSchematicArc({
56396
56396
  transform: transform2,
56397
56397
  colorMap: colorMap2
56398
56398
  }) {
56399
- const center = applyToPoint20(transform2, schArc.center);
56399
+ const center = applyToPoint21(transform2, schArc.center);
56400
56400
  const transformedRadius = Math.abs(transform2.a) * schArc.radius;
56401
56401
  const strokeWidth = schArc.stroke_width ?? 0.02;
56402
56402
  const transformedStrokeWidth = Math.abs(transform2.a) * strokeWidth;
@@ -56449,7 +56449,7 @@ function createSvgObjectsFromSchematicPath({
56449
56449
  if (!schPath.points || schPath.points.length < 2) {
56450
56450
  return [];
56451
56451
  }
56452
- const transformedPoints = schPath.points.map((p) => applyToPoint20(transform2, { x: p.x, y: p.y }));
56452
+ const transformedPoints = schPath.points.map((p) => applyToPoint21(transform2, { x: p.x, y: p.y }));
56453
56453
  const pathD = transformedPoints.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");
56454
56454
  return [
56455
56455
  {
@@ -57396,7 +57396,7 @@ function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
57396
57396
  const { transform: transform2, layer: layerFilter } = ctx;
57397
57397
  if (layerFilter && solderPaste.layer !== layerFilter)
57398
57398
  return [];
57399
- const [x3, y] = applyToPoint20(transform2, [solderPaste.x, solderPaste.y]);
57399
+ const [x3, y] = applyToPoint21(transform2, [solderPaste.x, solderPaste.y]);
57400
57400
  if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
57401
57401
  const width = solderPaste.width * Math.abs(transform2.a);
57402
57402
  const height = solderPaste.height * Math.abs(transform2.d);
@@ -57512,7 +57512,7 @@ function convertCircuitJsonToSolderPasteMask(circuitJson, options) {
57512
57512
  const scaleFactor = Math.min(scaleX, scaleY);
57513
57513
  const offsetX = (svgWidth - circuitWidth * scaleFactor) / 2;
57514
57514
  const offsetY = (svgHeight - circuitHeight * scaleFactor) / 2;
57515
- const transform2 = compose5(translate5(offsetX - minX * scaleFactor + padding * scaleFactor, svgHeight - offsetY + minY * scaleFactor - padding * scaleFactor), scale4(scaleFactor, -scaleFactor));
57515
+ const transform2 = compose6(translate6(offsetX - minX * scaleFactor + padding * scaleFactor, svgHeight - offsetY + minY * scaleFactor - padding * scaleFactor), scale5(scaleFactor, -scaleFactor));
57516
57516
  const ctx = {
57517
57517
  transform: transform2,
57518
57518
  layer: options.layer,
@@ -57605,8 +57605,8 @@ function createSvgObjects4({ elm, ctx }) {
57605
57605
  }
57606
57606
  }
57607
57607
  function createSvgObjectFromPcbBoundary2(transform2, minX, minY, maxX, maxY) {
57608
- const [x12, y12] = applyToPoint20(transform2, [minX, minY]);
57609
- const [x22, y22] = applyToPoint20(transform2, [maxX, maxY]);
57608
+ const [x12, y12] = applyToPoint21(transform2, [minX, minY]);
57609
+ const [x22, y22] = applyToPoint21(transform2, [maxX, maxY]);
57610
57610
  const width = Math.abs(x22 - x12);
57611
57611
  const height = Math.abs(y22 - y12);
57612
57612
  const x3 = Math.min(x12, x22);
@@ -57923,7 +57923,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
57923
57923
  realCenter,
57924
57924
  realToScreenTransform
57925
57925
  }) => {
57926
- const screenCenter = applyToPoint20(realToScreenTransform, realCenter);
57926
+ const screenCenter = applyToPoint21(realToScreenTransform, realCenter);
57927
57927
  return {
57928
57928
  type: "element",
57929
57929
  name: "text",
@@ -58009,8 +58009,8 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58009
58009
  minY: Math.min(...paths.flatMap((p) => p.points.map((pt2) => pt2.y))),
58010
58010
  maxY: Math.max(...paths.flatMap((p) => p.points.map((pt2) => pt2.y)))
58011
58011
  };
58012
- const [screenMinX, screenMinY] = applyToPoint20(compose5(realToScreenTransform, transformFromSymbolToReal), [bounds.minX, bounds.minY]);
58013
- const [screenMaxX, screenMaxY] = applyToPoint20(compose5(realToScreenTransform, transformFromSymbolToReal), [bounds.maxX, bounds.maxY]);
58012
+ const [screenMinX, screenMinY] = applyToPoint21(compose6(realToScreenTransform, transformFromSymbolToReal), [bounds.minX, bounds.minY]);
58013
+ const [screenMaxX, screenMaxY] = applyToPoint21(compose6(realToScreenTransform, transformFromSymbolToReal), [bounds.maxX, bounds.maxY]);
58014
58014
  const rectHeight = Math.abs(screenMaxY - screenMinY);
58015
58015
  const rectY = Math.min(screenMinY, screenMaxY);
58016
58016
  const rectWidth = Math.abs(screenMaxX - screenMinX);
@@ -58036,7 +58036,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58036
58036
  name: "path",
58037
58037
  attributes: {
58038
58038
  d: points.map((p, i) => {
58039
- const [x3, y] = applyToPoint20(compose5(realToScreenTransform, transformFromSymbolToReal), [p.x, p.y]);
58039
+ const [x3, y] = applyToPoint21(compose6(realToScreenTransform, transformFromSymbolToReal), [p.x, p.y]);
58040
58040
  return `${i === 0 ? "M" : "L"} ${x3} ${y}`;
58041
58041
  }).join(" ") + (closed ? " Z" : ""),
58042
58042
  stroke: colorMap2.schematic.component_outline,
@@ -58049,7 +58049,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58049
58049
  });
58050
58050
  }
58051
58051
  for (const text of texts) {
58052
- const screenTextPos = applyToPoint20(compose5(realToScreenTransform, transformFromSymbolToReal), text);
58052
+ const screenTextPos = applyToPoint21(compose6(realToScreenTransform, transformFromSymbolToReal), text);
58053
58053
  let textValue = "";
58054
58054
  const isReferenceText = text.text === "{REF}";
58055
58055
  if (isReferenceText) {
@@ -58088,8 +58088,8 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58088
58088
  });
58089
58089
  }
58090
58090
  for (const box of boxes) {
58091
- const screenBoxPos = applyToPoint20(compose5(realToScreenTransform, transformFromSymbolToReal), box);
58092
- const symbolToScreenScale = compose5(realToScreenTransform, transformFromSymbolToReal).a;
58091
+ const screenBoxPos = applyToPoint21(compose6(realToScreenTransform, transformFromSymbolToReal), box);
58092
+ const symbolToScreenScale = compose6(realToScreenTransform, transformFromSymbolToReal).a;
58093
58093
  svgObjects.push({
58094
58094
  name: "rect",
58095
58095
  type: "element",
@@ -58107,7 +58107,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58107
58107
  for (const port of symbol.ports) {
58108
58108
  if (connectedSymbolPorts.has(port))
58109
58109
  continue;
58110
- const screenPortPos = applyToPoint20(compose5(realToScreenTransform, transformFromSymbolToReal), port);
58110
+ const screenPortPos = applyToPoint21(compose6(realToScreenTransform, transformFromSymbolToReal), port);
58111
58111
  svgObjects.push({
58112
58112
  type: "element",
58113
58113
  name: "circle",
@@ -58124,7 +58124,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58124
58124
  });
58125
58125
  }
58126
58126
  for (const circle of circles) {
58127
- const screenCirclePos = applyToPoint20(compose5(realToScreenTransform, transformFromSymbolToReal), circle);
58127
+ const screenCirclePos = applyToPoint21(compose6(realToScreenTransform, transformFromSymbolToReal), circle);
58128
58128
  const screenRadius = Math.abs(circle.radius * realToScreenTransform.a);
58129
58129
  svgObjects.push({
58130
58130
  type: "element",
@@ -58191,8 +58191,8 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58191
58191
  realEdgePos.y += realPinLineLength;
58192
58192
  break;
58193
58193
  }
58194
- const screenSchPortPos = applyToPoint20(transform2, schPort.center);
58195
- const screenRealEdgePos = applyToPoint20(transform2, realEdgePos);
58194
+ const screenSchPortPos = applyToPoint21(transform2, schPort.center);
58195
+ const screenRealEdgePos = applyToPoint21(transform2, realEdgePos);
58196
58196
  const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
58197
58197
  const is_drawn_with_inversion_circle = schPort.is_drawn_with_inversion_circle ?? false;
58198
58198
  const BUBBLE_RADIUS_MM = 0.06;
@@ -58213,7 +58213,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58213
58213
  break;
58214
58214
  }
58215
58215
  }
58216
- const screenLineEnd = applyToPoint20(transform2, realLineEnd);
58216
+ const screenLineEnd = applyToPoint21(transform2, realLineEnd);
58217
58217
  if (is_drawn_with_inversion_circle) {
58218
58218
  const bubbleRadiusPx = Math.abs(transform2.a) * BUBBLE_RADIUS_MM;
58219
58219
  const bubbleCenter = { ...screenRealEdgePos };
@@ -58370,7 +58370,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58370
58370
  } else {
58371
58371
  realPinNumberPos.y += 0.02;
58372
58372
  }
58373
- const screenPinNumberTextPos = applyToPoint20(transform2, realPinNumberPos);
58373
+ const screenPinNumberTextPos = applyToPoint21(transform2, realPinNumberPos);
58374
58374
  svgObjects.push({
58375
58375
  name: "text",
58376
58376
  type: "element",
@@ -58410,7 +58410,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58410
58410
  const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
58411
58411
  realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
58412
58412
  realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
58413
- const screenPinNumberTextPos = applyToPoint20(transform2, realPinNumberPos);
58413
+ const screenPinNumberTextPos = applyToPoint21(transform2, realPinNumberPos);
58414
58414
  const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
58415
58415
  if (!label)
58416
58416
  return [];
@@ -58456,7 +58456,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58456
58456
  transform: transform2,
58457
58457
  colorMap: colorMap2
58458
58458
  }) => {
58459
- const center = applyToPoint20(transform2, elm.position);
58459
+ const center = applyToPoint21(transform2, elm.position);
58460
58460
  const textAnchorMap = {
58461
58461
  center: "middle",
58462
58462
  center_right: "end",
@@ -58538,11 +58538,11 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58538
58538
  colorMap: colorMap2
58539
58539
  }) => {
58540
58540
  const svgObjects = [];
58541
- const componentScreenTopLeft = applyToPoint20(transform2, {
58541
+ const componentScreenTopLeft = applyToPoint21(transform2, {
58542
58542
  x: schComponent.center.x - schComponent.size.width / 2,
58543
58543
  y: schComponent.center.y + schComponent.size.height / 2
58544
58544
  });
58545
- const componentScreenBottomRight = applyToPoint20(transform2, {
58545
+ const componentScreenBottomRight = applyToPoint21(transform2, {
58546
58546
  x: schComponent.center.x + schComponent.size.width / 2,
58547
58547
  y: schComponent.center.y - schComponent.size.height / 2
58548
58548
  });
@@ -58638,7 +58638,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58638
58638
  y: schNetLabel.center.y - realTextGrowthVec.y * fullWidthFsr * fontSizeMm / 2
58639
58639
  };
58640
58640
  const pathRotation = 0;
58641
- const rotationMatrix = rotate6(pathRotation / 180 * Math.PI);
58641
+ const rotationMatrix = rotate7(pathRotation / 180 * Math.PI);
58642
58642
  const symbolBounds = {
58643
58643
  minX: Math.min(...symbol.primitives.flatMap((p) => p.type === "path" ? p.points.map((pt2) => pt2.x) : [])),
58644
58644
  maxX: Math.max(...symbol.primitives.flatMap((p) => p.type === "path" ? p.points.map((pt2) => pt2.x) : [])),
@@ -58649,10 +58649,10 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58649
58649
  x: symbolBounds.minX,
58650
58650
  y: (symbolBounds.minY + symbolBounds.maxY) / 2
58651
58651
  };
58652
- const rotatedSymbolEnd = applyToPoint20(rotationMatrix, symbolEndPoint);
58653
- const symbolToRealTransform = compose5(translate5(realAnchorPosition.x - rotatedSymbolEnd.x, realAnchorPosition.y - rotatedSymbolEnd.y), rotationMatrix, scale4(1));
58654
- const [screenMinX, screenMinY] = applyToPoint20(compose5(realToScreenTransform, symbolToRealTransform), [bounds.minX, bounds.minY]);
58655
- const [screenMaxX, screenMaxY] = applyToPoint20(compose5(realToScreenTransform, symbolToRealTransform), [bounds.maxX, bounds.maxY]);
58652
+ const rotatedSymbolEnd = applyToPoint21(rotationMatrix, symbolEndPoint);
58653
+ const symbolToRealTransform = compose6(translate6(realAnchorPosition.x - rotatedSymbolEnd.x, realAnchorPosition.y - rotatedSymbolEnd.y), rotationMatrix, scale5(1));
58654
+ const [screenMinX, screenMinY] = applyToPoint21(compose6(realToScreenTransform, symbolToRealTransform), [bounds.minX, bounds.minY]);
58655
+ const [screenMaxX, screenMaxY] = applyToPoint21(compose6(realToScreenTransform, symbolToRealTransform), [bounds.maxX, bounds.maxY]);
58656
58656
  const rectHeight = Math.abs(screenMaxY - screenMinY);
58657
58657
  const rectY = Math.min(screenMinY, screenMaxY);
58658
58658
  const rectWidth = Math.abs(screenMaxX - screenMinX);
@@ -58673,7 +58673,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58673
58673
  });
58674
58674
  for (const path42 of symbolPaths) {
58675
58675
  const symbolPath = path42.points.map((p, i) => {
58676
- const [x3, y] = applyToPoint20(compose5(realToScreenTransform, symbolToRealTransform), [p.x, p.y]);
58676
+ const [x3, y] = applyToPoint21(compose6(realToScreenTransform, symbolToRealTransform), [p.x, p.y]);
58677
58677
  return `${i === 0 ? "M" : "L"} ${x3} ${y}`;
58678
58678
  }).join(" ");
58679
58679
  svgObjects.push({
@@ -58691,7 +58691,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58691
58691
  });
58692
58692
  }
58693
58693
  for (const text of symbolTexts) {
58694
- const screenTextPos = applyToPoint20(compose5(realToScreenTransform, symbolToRealTransform), text);
58694
+ const screenTextPos = applyToPoint21(compose6(realToScreenTransform, symbolToRealTransform), text);
58695
58695
  let textValue = text.text;
58696
58696
  if (textValue === "{REF}") {
58697
58697
  textValue = labelText || "";
@@ -58730,8 +58730,8 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58730
58730
  });
58731
58731
  }
58732
58732
  for (const box of symbolBoxes) {
58733
- const screenBoxPos = applyToPoint20(compose5(realToScreenTransform, symbolToRealTransform), box);
58734
- const symbolToScreenScale = compose5(realToScreenTransform, symbolToRealTransform).a;
58733
+ const screenBoxPos = applyToPoint21(compose6(realToScreenTransform, symbolToRealTransform), box);
58734
+ const symbolToScreenScale = compose6(realToScreenTransform, symbolToRealTransform).a;
58735
58735
  svgObjects.push({
58736
58736
  name: "rect",
58737
58737
  type: "element",
@@ -58747,8 +58747,8 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58747
58747
  });
58748
58748
  }
58749
58749
  for (const circle of symbolCircles) {
58750
- const screenCirclePos = applyToPoint20(compose5(realToScreenTransform, symbolToRealTransform), circle);
58751
- const symbolToScreenScale = compose5(realToScreenTransform, symbolToRealTransform).a;
58750
+ const screenCirclePos = applyToPoint21(compose6(realToScreenTransform, symbolToRealTransform), circle);
58751
+ const symbolToScreenScale = compose6(realToScreenTransform, symbolToRealTransform).a;
58752
58752
  svgObjects.push({
58753
58753
  name: "circle",
58754
58754
  type: "element",
@@ -58784,12 +58784,12 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58784
58784
  const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
58785
58785
  const fontSizeMm = getSchMmFontSize("net_label");
58786
58786
  const textWidthFSR = estimateTextWidth(labelText || "");
58787
- const screenCenter = applyToPoint20(realToScreenTransform, schNetLabel.center);
58787
+ const screenCenter = applyToPoint21(realToScreenTransform, schNetLabel.center);
58788
58788
  const realTextGrowthVec = getUnitVectorFromOutsideToEdge(schNetLabel.anchor_side);
58789
58789
  const screenTextGrowthVec = { ...realTextGrowthVec };
58790
58790
  screenTextGrowthVec.y *= -1;
58791
58791
  const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
58792
- const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint20(realToScreenTransform, schNetLabel.anchor_position) : {
58792
+ const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint21(realToScreenTransform, schNetLabel.anchor_position) : {
58793
58793
  x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
58794
58794
  y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
58795
58795
  };
@@ -58824,7 +58824,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58824
58824
  x: ARROW_POINT_WIDTH_FSR,
58825
58825
  y: -0.6
58826
58826
  }
58827
- ].map((fontRelativePoint) => applyToPoint20(compose5(realToScreenTransform, translate5(realAnchorPosition.x, realAnchorPosition.y), scale4(fontSizeMm), rotate6(pathRotation / 180 * Math.PI)), fontRelativePoint));
58827
+ ].map((fontRelativePoint) => applyToPoint21(compose6(realToScreenTransform, translate6(realAnchorPosition.x, realAnchorPosition.y), scale5(fontSizeMm), rotate7(pathRotation / 180 * Math.PI)), fontRelativePoint));
58828
58828
  const pathD = `
58829
58829
  M ${screenOutlinePoints[0].x},${screenOutlinePoints[0].y}
58830
58830
  L ${screenOutlinePoints[1].x},${screenOutlinePoints[1].y}
@@ -58894,11 +58894,11 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58894
58894
  transform: transform2,
58895
58895
  colorMap: colorMap2
58896
58896
  }) => {
58897
- const topLeft = applyToPoint20(transform2, {
58897
+ const topLeft = applyToPoint21(transform2, {
58898
58898
  x: schematicBox.x,
58899
58899
  y: schematicBox.y
58900
58900
  });
58901
- const bottomRight = applyToPoint20(transform2, {
58901
+ const bottomRight = applyToPoint21(transform2, {
58902
58902
  x: schematicBox.x + schematicBox.width,
58903
58903
  y: schematicBox.y + schematicBox.height
58904
58904
  });
@@ -58960,11 +58960,11 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58960
58960
  const svgObjects = [];
58961
58961
  const borderStrokeWidth = border_width * Math.abs(transform2.a);
58962
58962
  const gridStrokeWidth = getSchStrokeSize(transform2);
58963
- const [screenTopLeftX, screenTopLeftY] = applyToPoint20(transform2, [
58963
+ const [screenTopLeftX, screenTopLeftY] = applyToPoint21(transform2, [
58964
58964
  topLeftX,
58965
58965
  topLeftY
58966
58966
  ]);
58967
- const [screenBottomRightX, screenBottomRightY] = applyToPoint20(transform2, [
58967
+ const [screenBottomRightX, screenBottomRightY] = applyToPoint21(transform2, [
58968
58968
  topLeftX + totalWidth,
58969
58969
  topLeftY - totalHeight
58970
58970
  ]);
@@ -58992,8 +58992,8 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
58992
58992
  const segmentEndY = segmentStartY - row_heights[j2];
58993
58993
  const isMerged = cells.some((cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j2 && cell.end_row_index >= j2);
58994
58994
  if (!isMerged) {
58995
- const start = applyToPoint20(transform2, { x: currentX, y: segmentStartY });
58996
- const end = applyToPoint20(transform2, { x: currentX, y: segmentEndY });
58995
+ const start = applyToPoint21(transform2, { x: currentX, y: segmentStartY });
58996
+ const end = applyToPoint21(transform2, { x: currentX, y: segmentEndY });
58997
58997
  svgObjects.push({
58998
58998
  name: "line",
58999
58999
  type: "element",
@@ -59020,11 +59020,11 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
59020
59020
  const segmentEndX = segmentStartX + column_widths[j2];
59021
59021
  const isMerged = cells.some((cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j2 && cell.end_column_index >= j2);
59022
59022
  if (!isMerged) {
59023
- const start = applyToPoint20(transform2, {
59023
+ const start = applyToPoint21(transform2, {
59024
59024
  x: segmentStartX,
59025
59025
  y: currentY
59026
59026
  });
59027
- const end = applyToPoint20(transform2, { x: segmentEndX, y: currentY });
59027
+ const end = applyToPoint21(transform2, { x: segmentEndX, y: currentY });
59028
59028
  svgObjects.push({
59029
59029
  name: "line",
59030
59030
  type: "element",
@@ -59066,7 +59066,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
59066
59066
  } else if (vertical_align === "bottom") {
59067
59067
  realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
59068
59068
  }
59069
- const screenTextAnchorPos = applyToPoint20(transform2, realTextAnchorPos);
59069
+ const screenTextAnchorPos = applyToPoint21(transform2, realTextAnchorPos);
59070
59070
  const fontSize = getSchScreenFontSize(transform2, "reference_designator", cell.font_size);
59071
59071
  const textAnchorMap = {
59072
59072
  left: "start",
@@ -59118,7 +59118,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
59118
59118
  schPort,
59119
59119
  transform: transform2
59120
59120
  }) => {
59121
- const screenSchPortPos = applyToPoint20(transform2, schPort.center);
59121
+ const screenSchPortPos = applyToPoint21(transform2, schPort.center);
59122
59122
  const pinRadiusPx = Math.abs(transform2.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
59123
59123
  return [
59124
59124
  {
@@ -59168,7 +59168,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
59168
59168
  const svgObjects = [];
59169
59169
  const radiusPx = Math.abs(transform2.a) * PIN_CIRCLE_RADIUS_MM3;
59170
59170
  const strokeWidth = Math.abs(transform2.a) * PIN_CIRCLE_RADIUS_MM3;
59171
- const screenPos = applyToPoint20(transform2, schPort.center);
59171
+ const screenPos = applyToPoint21(transform2, schPort.center);
59172
59172
  svgObjects.push({
59173
59173
  name: "circle",
59174
59174
  type: "element",
@@ -59215,7 +59215,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
59215
59215
  textAnchor = "middle";
59216
59216
  break;
59217
59217
  }
59218
- const screenLabelPos = applyToPoint20(transform2, labelPos);
59218
+ const screenLabelPos = applyToPoint21(transform2, labelPos);
59219
59219
  const fontSizePx = getSchScreenFontSize(transform2, "pin_number");
59220
59220
  if (schPort.facing_direction === "up" || schPort.facing_direction === "down") {
59221
59221
  rotation2 = `rotate(-90 ${screenLabelPos.x} ${screenLabelPos.y})`;
@@ -99964,7 +99964,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
99964
99964
  // lib/getVersion.ts
99965
99965
  import { createRequire as createRequire2 } from "node:module";
99966
99966
  // package.json
99967
- var version = "0.1.1252";
99967
+ var version = "0.1.1253";
99968
99968
  var package_default = {
99969
99969
  name: "@tscircuit/cli",
99970
99970
  version,
@@ -99998,7 +99998,7 @@ var package_default = {
99998
99998
  "circuit-json": "^0.0.403",
99999
99999
  "circuit-json-to-bom-csv": "^0.0.7",
100000
100000
  "circuit-json-to-gerber": "^0.0.48",
100001
- "circuit-json-to-kicad": "^0.0.105",
100001
+ "circuit-json-to-kicad": "^0.0.109",
100002
100002
  "circuit-json-to-pnp-csv": "^0.0.7",
100003
100003
  "circuit-json-to-readable-netlist": "^0.0.15",
100004
100004
  "circuit-json-to-spice": "^0.0.10",
@@ -103939,7 +103939,7 @@ import {
103939
103939
  } from "kicadts";
103940
103940
  import { KicadPcb as KicadPcb2 } from "kicadts";
103941
103941
  import { cju as cju2 } from "@tscircuit/circuit-json-util";
103942
- import { compose as compose4, translate as translate4, scale as scale3 } from "transformation-matrix";
103942
+ import { compose as compose5, translate as translate5, scale as scale4 } from "transformation-matrix";
103943
103943
  import {
103944
103944
  Paper as Paper2,
103945
103945
  PcbLayers,
@@ -103960,7 +103960,7 @@ import {
103960
103960
  TextEffects as TextEffects6,
103961
103961
  TextEffectsFont as TextEffectsFont6
103962
103962
  } from "kicadts";
103963
- import { applyToPoint as applyToPoint13 } from "transformation-matrix";
103963
+ import { applyToPoint as applyToPoint14 } from "transformation-matrix";
103964
103964
  import {
103965
103965
  Property as Property2,
103966
103966
  TextEffects as TextEffects7,
@@ -103974,12 +103974,19 @@ import { FpCircle as FpCircle2, Stroke as Stroke5 } from "kicadts";
103974
103974
  import { FpRect, Stroke as Stroke6 } from "kicadts";
103975
103975
  import { FpRect as FpRect2, Stroke as Stroke7 } from "kicadts";
103976
103976
  import { FpRect as FpRect3, Stroke as Stroke8 } from "kicadts";
103977
- import { FpPoly, Pts as Pts3, Xy as Xy3, Stroke as Stroke9 } from "kicadts";
103977
+ import { FpPoly, Pts as Pts3, Stroke as Stroke9, Xy as Xy3 } from "kicadts";
103978
+ import {
103979
+ applyToPoint as applyToPoint8,
103980
+ compose as compose3,
103981
+ rotate,
103982
+ scale as scale2,
103983
+ translate as translate3
103984
+ } from "transformation-matrix";
103978
103985
  import"kicadts";
103979
103986
  import { FpText, TextEffects as TextEffects8, TextEffectsFont as TextEffectsFont8 } from "kicadts";
103980
- import { applyToPoint as applyToPoint8, rotate, identity } from "transformation-matrix";
103987
+ import { applyToPoint as applyToPoint9, rotate as rotate2, identity } from "transformation-matrix";
103981
103988
  import { FpText as FpText3, TextEffects as TextEffects9, TextEffectsFont as TextEffectsFont9 } from "kicadts";
103982
- import { applyToPoint as applyToPoint9, rotate as rotate2, identity as identity2 } from "transformation-matrix";
103989
+ import { applyToPoint as applyToPoint10, rotate as rotate3, identity as identity2 } from "transformation-matrix";
103983
103990
  import { FootprintModel as FootprintModel3 } from "kicadts";
103984
103991
  import {
103985
103992
  FootprintPad,
@@ -103991,22 +103998,22 @@ import {
103991
103998
  PadNet
103992
103999
  } from "kicadts";
103993
104000
  import {
103994
- applyToPoint as applyToPoint10,
103995
- compose as compose3,
103996
- translate as translate3,
103997
- scale as scale2,
103998
- rotate as rotate3
104001
+ applyToPoint as applyToPoint11,
104002
+ compose as compose4,
104003
+ translate as translate4,
104004
+ scale as scale3,
104005
+ rotate as rotate4
103999
104006
  } from "transformation-matrix";
104000
104007
  import { FootprintPad as FootprintPad2, PadDrill, PadNet as PadNet2 } from "kicadts";
104001
- import { applyToPoint as applyToPoint11, rotate as rotate4, identity as identity3 } from "transformation-matrix";
104008
+ import { applyToPoint as applyToPoint12, rotate as rotate5, identity as identity3 } from "transformation-matrix";
104002
104009
  import { FootprintPad as FootprintPad3, PadDrill as PadDrill2 } from "kicadts";
104003
- import { applyToPoint as applyToPoint12, rotate as rotate5, identity as identity4 } from "transformation-matrix";
104010
+ import { applyToPoint as applyToPoint13, rotate as rotate6, identity as identity4 } from "transformation-matrix";
104004
104011
  import { Segment, SegmentNet } from "kicadts";
104005
- import { applyToPoint as applyToPoint14 } from "transformation-matrix";
104006
- import { Via, ViaNet } from "kicadts";
104007
104012
  import { applyToPoint as applyToPoint15 } from "transformation-matrix";
104008
- import { Footprint as Footprint4 } from "kicadts";
104013
+ import { Via, ViaNet } from "kicadts";
104009
104014
  import { applyToPoint as applyToPoint16 } from "transformation-matrix";
104015
+ import { Footprint as Footprint4 } from "kicadts";
104016
+ import { applyToPoint as applyToPoint17 } from "transformation-matrix";
104010
104017
  import { GrLine } from "kicadts";
104011
104018
  import {
104012
104019
  At as At2,
@@ -104015,8 +104022,8 @@ import {
104015
104022
  TextEffectsFont as TextEffectsFont10,
104016
104023
  TextEffectsJustify as TextEffectsJustify3
104017
104024
  } from "kicadts";
104018
- import { applyToPoint as applyToPoint17 } from "transformation-matrix";
104019
- import { applyToPoint as applyToPoint19 } from "transformation-matrix";
104025
+ import { applyToPoint as applyToPoint18 } from "transformation-matrix";
104026
+ import { applyToPoint as applyToPoint20 } from "transformation-matrix";
104020
104027
  import {
104021
104028
  GrText as GrText2,
104022
104029
  TextEffects as TextEffects11,
@@ -104024,7 +104031,7 @@ import {
104024
104031
  TextEffectsJustify as TextEffectsJustify4,
104025
104032
  At as At3
104026
104033
  } from "kicadts";
104027
- import { applyToPoint as applyToPoint18 } from "transformation-matrix";
104034
+ import { applyToPoint as applyToPoint19 } from "transformation-matrix";
104028
104035
  import { cju as cju3 } from "@tscircuit/circuit-json-util";
104029
104036
  import { cju as cju4 } from "@tscircuit/circuit-json-util";
104030
104037
  import { parseKicadSexpr as parseKicadSexpr2, KicadSch as KicadSch2 } from "kicadts";
@@ -104308,7 +104315,7 @@ function createPolylineFromPoints({
104308
104315
  function createCircleFromPrimitive({
104309
104316
  primitive,
104310
104317
  transform,
104311
- scale: scale4
104318
+ scale: scale5
104312
104319
  }) {
104313
104320
  const circle = new SymbolCircle;
104314
104321
  const scaledPos = applyToPoint2(transform, {
@@ -104317,7 +104324,7 @@ function createCircleFromPrimitive({
104317
104324
  });
104318
104325
  const c = circle;
104319
104326
  c._sxCenter = new SymbolCircleCenter(scaledPos.x, scaledPos.y);
104320
- c._sxRadius = new SymbolCircleRadius(primitive.radius * scale4);
104327
+ c._sxRadius = new SymbolCircleRadius(primitive.radius * scale5);
104321
104328
  const stroke = new Stroke2;
104322
104329
  stroke.width = 0.254;
104323
104330
  stroke.type = "default";
@@ -104330,13 +104337,13 @@ function createCircleFromPrimitive({
104330
104337
  function createTextFromPrimitive({
104331
104338
  schText,
104332
104339
  transform,
104333
- scale: scale4
104340
+ scale: scale5
104334
104341
  }) {
104335
104342
  const symbolText = new SymbolText;
104336
104343
  const scaledPos = applyToPoint3(transform, { x: schText.x, y: schText.y });
104337
104344
  symbolText.value = schText.text;
104338
104345
  symbolText.at = [scaledPos.x, scaledPos.y, 0];
104339
- const scaledFontSize = schText.fontSize * scale4;
104346
+ const scaledFontSize = schText.fontSize * scale5;
104340
104347
  const font = new TextEffectsFont;
104341
104348
  font.size = { height: scaledFontSize, width: scaledFontSize };
104342
104349
  symbolText.effects = new TextEffects({ font });
@@ -106218,8 +106225,9 @@ function convertCourtyardRects(courtyardRects, componentCenter) {
106218
106225
  }
106219
106226
  return fpRects;
106220
106227
  }
106221
- function convertCourtyardOutlines(courtyardOutlines, componentCenter) {
106228
+ function convertCourtyardOutlines(courtyardOutlines, componentCenter, componentRotation = 0) {
106222
106229
  const fpPolys = [];
106230
+ const cj2kicadMatrix = compose3(componentRotation !== 0 ? rotate(componentRotation * Math.PI / 180) : { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }, scale2(1, -1), translate3(-componentCenter.x, -componentCenter.y));
106223
106231
  for (const outline of courtyardOutlines) {
106224
106232
  if (!outline.outline || outline.outline.length < 2)
106225
106233
  continue;
@@ -106229,9 +106237,8 @@ function convertCourtyardOutlines(courtyardOutlines, componentCenter) {
106229
106237
  };
106230
106238
  const kicadLayer = layerMap[outline.layer] || "F.CrtYd";
106231
106239
  const xyPoints = outline.outline.map((point) => {
106232
- const relX = point.x - componentCenter.x;
106233
- const relY = -(point.y - componentCenter.y);
106234
- return new Xy3(relX, relY);
106240
+ const transformedPoint = applyToPoint8(cj2kicadMatrix, point);
106241
+ return new Xy3(transformedPoint.x, transformedPoint.y);
106235
106242
  });
106236
106243
  const fpPoly = new FpPoly;
106237
106244
  fpPoly.points = new Pts3(xyPoints);
@@ -106256,8 +106263,8 @@ function createFpTextFromCircuitJson({
106256
106263
  }
106257
106264
  const relativeX = textElement.anchor_position.x - componentCenter.x;
106258
106265
  const relativeY = -(textElement.anchor_position.y - componentCenter.y);
106259
- const rotationMatrix = componentRotation !== 0 ? rotate(componentRotation * Math.PI / 180) : identity();
106260
- const rotatedPos = applyToPoint8(rotationMatrix, {
106266
+ const rotationMatrix = componentRotation !== 0 ? rotate2(componentRotation * Math.PI / 180) : identity();
106267
+ const rotatedPos = applyToPoint9(rotationMatrix, {
106261
106268
  x: relativeX,
106262
106269
  y: relativeY
106263
106270
  });
@@ -106311,8 +106318,8 @@ function convertNoteTexts(noteTexts, componentCenter, componentRotation) {
106311
106318
  for (const textElement of noteTexts) {
106312
106319
  const relX = textElement.anchor_position.x - componentCenter.x;
106313
106320
  const relY = -(textElement.anchor_position.y - componentCenter.y);
106314
- const rotationMatrix = componentRotation !== 0 ? rotate2(componentRotation * Math.PI / 180) : identity2();
106315
- const rotatedPos = applyToPoint9(rotationMatrix, { x: relX, y: relY });
106321
+ const rotationMatrix = componentRotation !== 0 ? rotate3(componentRotation * Math.PI / 180) : identity2();
106322
+ const rotatedPos = applyToPoint10(rotationMatrix, { x: relX, y: relY });
106316
106323
  const fontSize = textElement.font_size || 1;
106317
106324
  const font = new TextEffectsFont9;
106318
106325
  font.size = { width: fontSize, height: fontSize };
@@ -106350,8 +106357,8 @@ function create3DModelsFromCadComponent(cadComponent, componentCenter, options)
106350
106357
  };
106351
106358
  }
106352
106359
  if (cadComponent.model_unit_to_mm_scale_factor) {
106353
- const scale4 = cadComponent.model_unit_to_mm_scale_factor;
106354
- model.scale = { x: scale4, y: scale4, z: scale4 };
106360
+ const scale5 = cadComponent.model_unit_to_mm_scale_factor;
106361
+ model.scale = { x: scale5, y: scale5, z: scale5 };
106355
106362
  }
106356
106363
  models.push(model);
106357
106364
  return models;
@@ -106376,8 +106383,8 @@ function createSmdPadFromCircuitJson({
106376
106383
  } else {
106377
106384
  throw new Error("Pad must have either x/y coordinates or points array");
106378
106385
  }
106379
- const cj2kicadMatrix = compose3(componentRotation !== 0 ? rotate3(componentRotation * Math.PI / 180) : { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }, scale2(1, -1), translate3(-componentCenter.x, -componentCenter.y));
106380
- const rotatedPos = applyToPoint10(cj2kicadMatrix, {
106386
+ const cj2kicadMatrix = compose4(componentRotation !== 0 ? rotate4(componentRotation * Math.PI / 180) : { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }, scale3(1, -1), translate4(-componentCenter.x, -componentCenter.y));
106387
+ const rotatedPos = applyToPoint11(cj2kicadMatrix, {
106381
106388
  x: padX,
106382
106389
  y: padY
106383
106390
  });
@@ -106398,9 +106405,9 @@ function createSmdPadFromCircuitJson({
106398
106405
  ];
106399
106406
  } else if (pcbPad.shape === "polygon" && "points" in pcbPad) {
106400
106407
  const points = pcbPad.points;
106401
- const pointTransformMatrix = compose3(scale2(1, -1), translate3(-padX, -padY));
106408
+ const pointTransformMatrix = compose4(scale3(1, -1), translate4(-padX, -padY));
106402
106409
  const relativePoints = points.map((p) => {
106403
- const transformed = applyToPoint10(pointTransformMatrix, { x: p.x, y: p.y });
106410
+ const transformed = applyToPoint11(pointTransformMatrix, { x: p.x, y: p.y });
106404
106411
  return new Xy4(transformed.x, transformed.y);
106405
106412
  });
106406
106413
  const grPoly = new PadPrimitiveGrPoly;
@@ -106476,8 +106483,8 @@ function createThruHolePadFromCircuitJson({
106476
106483
  }
106477
106484
  const relativeX = platedHole.x - componentCenter.x;
106478
106485
  const relativeY = -(platedHole.y - componentCenter.y);
106479
- const rotationMatrix = componentRotation !== 0 ? rotate4(componentRotation * Math.PI / 180) : identity3();
106480
- const rotatedPos = applyToPoint11(rotationMatrix, {
106486
+ const rotationMatrix = componentRotation !== 0 ? rotate5(componentRotation * Math.PI / 180) : identity3();
106487
+ const rotatedPos = applyToPoint12(rotationMatrix, {
106481
106488
  x: relativeX,
106482
106489
  y: relativeY
106483
106490
  });
@@ -106493,7 +106500,7 @@ function createThruHolePadFromCircuitJson({
106493
106500
  y: platedHole.hole_offset_y ?? 0
106494
106501
  };
106495
106502
  if (rawOffset.x !== 0 || rawOffset.y !== 0) {
106496
- const rotatedOffset = applyToPoint11(rotationMatrix, {
106503
+ const rotatedOffset = applyToPoint12(rotationMatrix, {
106497
106504
  x: -rawOffset.x,
106498
106505
  y: rawOffset.y
106499
106506
  });
@@ -106606,8 +106613,8 @@ function createNpthPadFromCircuitJson({
106606
106613
  }
106607
106614
  const relativeX = pcbHole.x - componentCenter.x;
106608
106615
  const relativeY = -(pcbHole.y - componentCenter.y);
106609
- const rotationMatrix = componentRotation !== 0 ? rotate5(componentRotation * Math.PI / 180) : identity4();
106610
- const rotatedPos = applyToPoint12(rotationMatrix, {
106616
+ const rotationMatrix = componentRotation !== 0 ? rotate6(componentRotation * Math.PI / 180) : identity4();
106617
+ const rotatedPos = applyToPoint13(rotationMatrix, {
106611
106618
  x: relativeX,
106612
106619
  y: relativeY
106613
106620
  });
@@ -106721,7 +106728,7 @@ var AddFootprintsStage = class extends ConverterStage {
106721
106728
  const sourceComponent = component.source_component_id ? this.ctx.db.source_component.get(component.source_component_id) : null;
106722
106729
  const cadComponent = this.getCadComponentForPcbComponent(component.pcb_component_id);
106723
106730
  const footprintName = sourceComponent ? getKicadCompatibleComponentName(sourceComponent, cadComponent) : "Unknown";
106724
- const transformedPos = applyToPoint13(c2kMatPcb, {
106731
+ const transformedPos = applyToPoint14(c2kMatPcb, {
106725
106732
  x: component.center.x,
106726
106733
  y: component.center.y
106727
106734
  });
@@ -106765,7 +106772,7 @@ var AddFootprintsStage = class extends ConverterStage {
106765
106772
  fpRects.push(...convertCourtyardRects(pcbCourtyardRects, component.center));
106766
106773
  footprint.fpRects = fpRects;
106767
106774
  const pcbCourtyardOutlines = this.ctx.db.pcb_courtyard_outline?.list().filter((outline) => outline.pcb_component_id === component.pcb_component_id) || [];
106768
- const fpPolys = convertCourtyardOutlines(pcbCourtyardOutlines, component.center);
106775
+ const fpPolys = convertCourtyardOutlines(pcbCourtyardOutlines, component.center, component.rotation || 0);
106769
106776
  if (fpPolys.length > 0) {
106770
106777
  footprint.fpPolys = fpPolys;
106771
106778
  }
@@ -106878,11 +106885,11 @@ var AddTracesStage = class extends ConverterStage {
106878
106885
  for (let i = 0;i < trace.route.length - 1; i++) {
106879
106886
  const startPoint = trace.route[i];
106880
106887
  const endPoint = trace.route[i + 1];
106881
- const transformedStart = applyToPoint14(c2kMatPcb, {
106888
+ const transformedStart = applyToPoint15(c2kMatPcb, {
106882
106889
  x: startPoint.x,
106883
106890
  y: startPoint.y
106884
106891
  });
106885
- const transformedEnd = applyToPoint14(c2kMatPcb, {
106892
+ const transformedEnd = applyToPoint15(c2kMatPcb, {
106886
106893
  x: endPoint.x,
106887
106894
  y: endPoint.y
106888
106895
  });
@@ -107005,7 +107012,7 @@ var AddViasStage = class extends ConverterStage {
107005
107012
  this.finished = true;
107006
107013
  return;
107007
107014
  }
107008
- const transformedPos = applyToPoint15(c2kMatPcb, {
107015
+ const transformedPos = applyToPoint16(c2kMatPcb, {
107009
107016
  x: via.x,
107010
107017
  y: via.y
107011
107018
  });
@@ -107099,7 +107106,7 @@ var AddStandalonePcbElements = class extends ConverterStage {
107099
107106
  if (elm.type === "pcb_hole") {
107100
107107
  const hole = elm;
107101
107108
  const footprintSeed = `standalone_hole:${hole.pcb_hole_id}:${hole.x},${hole.y}`;
107102
- const kicadPos = applyToPoint16(c2kMatPcb, { x: hole.x, y: hole.y });
107109
+ const kicadPos = applyToPoint17(c2kMatPcb, { x: hole.x, y: hole.y });
107103
107110
  const libraryLink = this.getHoleLibraryLink(hole);
107104
107111
  const footprint = new Footprint4({
107105
107112
  libraryLink,
@@ -107118,7 +107125,7 @@ var AddStandalonePcbElements = class extends ConverterStage {
107118
107125
  } else if (elm.type === "pcb_plated_hole") {
107119
107126
  const hole = elm;
107120
107127
  const footprintSeed = `standalone_plated_hole:${hole.pcb_plated_hole_id}:${hole.x},${hole.y}`;
107121
- const kicadPos = applyToPoint16(c2kMatPcb, { x: hole.x, y: hole.y });
107128
+ const kicadPos = applyToPoint17(c2kMatPcb, { x: hole.x, y: hole.y });
107122
107129
  const libraryLink = this.getPlatedHoleLibraryLink(hole);
107123
107130
  const footprint = new Footprint4({
107124
107131
  libraryLink,
@@ -107184,7 +107191,7 @@ function createFabricationNoteTextFromCircuitJson({
107184
107191
  if (!textElement.text || !textElement.anchor_position) {
107185
107192
  return null;
107186
107193
  }
107187
- const transformedPos = applyToPoint17(c2kMatPcb, {
107194
+ const transformedPos = applyToPoint18(c2kMatPcb, {
107188
107195
  x: textElement.anchor_position.x,
107189
107196
  y: textElement.anchor_position.y
107190
107197
  });
@@ -107240,7 +107247,7 @@ function createGrTextFromCircuitJson({
107240
107247
  if (!textElement.text || !textElement.anchor_position) {
107241
107248
  return null;
107242
107249
  }
107243
- const transformedPos = applyToPoint18(c2kMatPcb, {
107250
+ const transformedPos = applyToPoint19(c2kMatPcb, {
107244
107251
  x: textElement.anchor_position.x,
107245
107252
  y: textElement.anchor_position.y
107246
107253
  });
@@ -107308,11 +107315,11 @@ var AddGraphicsStage = class extends ConverterStage {
107308
107315
  const endPoint = path16.route[i + 1];
107309
107316
  if (!startPoint || !endPoint)
107310
107317
  continue;
107311
- const transformedStart = applyToPoint19(c2kMatPcb, {
107318
+ const transformedStart = applyToPoint20(c2kMatPcb, {
107312
107319
  x: startPoint.x,
107313
107320
  y: startPoint.y
107314
107321
  });
107315
- const transformedEnd = applyToPoint19(c2kMatPcb, {
107322
+ const transformedEnd = applyToPoint20(c2kMatPcb, {
107316
107323
  x: endPoint.x,
107317
107324
  y: endPoint.y
107318
107325
  });
@@ -107376,7 +107383,7 @@ var AddGraphicsStage = class extends ConverterStage {
107376
107383
  { x: board.center.x - halfWidth, y: board.center.y + halfHeight }
107377
107384
  ];
107378
107385
  }
107379
- const transformedCorners = corners.map((corner) => applyToPoint19(c2kMatPcb, corner));
107386
+ const transformedCorners = corners.map((corner) => applyToPoint20(c2kMatPcb, corner));
107380
107387
  for (let i = 0;i < transformedCorners.length; i++) {
107381
107388
  const start = transformedCorners[i];
107382
107389
  const end = transformedCorners[(i + 1) % transformedCorners.length];
@@ -107418,7 +107425,7 @@ var CircuitJsonToKicadPcbConverter = class {
107418
107425
  generator: "circuit-json-to-kicad",
107419
107426
  generatorVersion: "0.0.1"
107420
107427
  }),
107421
- c2kMatPcb: compose4(translate4(KICAD_PCB_CENTER_X, KICAD_PCB_CENTER_Y), scale3(CIRCUIT_JSON_TO_MM_SCALE, -CIRCUIT_JSON_TO_MM_SCALE)),
107428
+ c2kMatPcb: compose5(translate5(KICAD_PCB_CENTER_X, KICAD_PCB_CENTER_Y), scale4(CIRCUIT_JSON_TO_MM_SCALE, -CIRCUIT_JSON_TO_MM_SCALE)),
107422
107429
  projectName: options?.projectName,
107423
107430
  pcbModel3dSourcePaths: []
107424
107431
  };
@@ -201207,7 +201214,7 @@ function rectanglePolygon({
201207
201214
  if (rotationDeg) {
201208
201215
  const matrix2 = rotateDEG(rotationDeg, cx2, cy2);
201209
201216
  const rotatedCorners = corners.map((pt3) => {
201210
- const p3 = applyToPoint20(matrix2, { x: pt3.x, y: pt3.y });
201217
+ const p3 = applyToPoint21(matrix2, { x: pt3.x, y: pt3.y });
201211
201218
  return new Point$3(p3.x, p3.y);
201212
201219
  });
201213
201220
  poly = new Polygon$1(rotatedCorners);
@@ -201272,7 +201279,7 @@ function computeOverlapDistance(compPoly, boardPoly, componentCenter, componentW
201272
201279
  }
201273
201280
  const matrix2 = rotateDEG(rotationDeg, componentCenter.x, componentCenter.y);
201274
201281
  const rotatePoint3 = (pt3) => {
201275
- const p3 = applyToPoint20(matrix2, pt3);
201282
+ const p3 = applyToPoint21(matrix2, pt3);
201276
201283
  return new Point$3(p3.x, p3.y);
201277
201284
  };
201278
201285
  const rotatedPoints = corners.concat(midpoints).map(rotatePoint3);
@@ -219408,25 +219415,25 @@ var PrimitiveComponent2 = class extends Renderable {
219408
219415
  computePcbPropsTransform() {
219409
219416
  const rotation4 = this._getPcbRotationBeforeLayout() ?? 0;
219410
219417
  const { pcbX, pcbY } = this.getResolvedPcbPositionProp();
219411
- const matrix2 = compose5(translate5(pcbX, pcbY), rotate6(rotation4 * Math.PI / 180));
219418
+ const matrix2 = compose6(translate6(pcbX, pcbY), rotate7(rotation4 * Math.PI / 180));
219412
219419
  return matrix2;
219413
219420
  }
219414
219421
  _computePcbGlobalTransformBeforeLayout() {
219415
219422
  const manualPlacement = this.getSubcircuit()._getPcbManualPlacementForComponent(this);
219416
219423
  if (manualPlacement && this.props.pcbX === undefined && this.props.pcbY === undefined) {
219417
219424
  const rotation4 = this._getPcbRotationBeforeLayout() ?? 0;
219418
- return compose5(this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity5(), compose5(translate5(manualPlacement.x, manualPlacement.y), rotate6(rotation4 * Math.PI / 180)));
219425
+ return compose6(this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity5(), compose6(translate6(manualPlacement.x, manualPlacement.y), rotate7(rotation4 * Math.PI / 180)));
219419
219426
  }
219420
219427
  if (this.isPcbPrimitive) {
219421
219428
  const primitiveContainer = this.getPrimitiveContainer();
219422
219429
  if (primitiveContainer) {
219423
219430
  const isFlipped = primitiveContainer._parsedProps.layer === "bottom";
219424
219431
  if (isFlipped) {
219425
- return compose5(this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity5(), flipY(), this.computePcbPropsTransform());
219432
+ return compose6(this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity5(), flipY(), this.computePcbPropsTransform());
219426
219433
  }
219427
219434
  }
219428
219435
  }
219429
- return compose5(this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity5(), this.computePcbPropsTransform());
219436
+ return compose6(this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity5(), this.computePcbPropsTransform());
219430
219437
  }
219431
219438
  getPrimitiveContainer() {
219432
219439
  if (this.isPrimitiveContainer)
@@ -219487,13 +219494,13 @@ var PrimitiveComponent2 = class extends Renderable {
219487
219494
  }
219488
219495
  computeSchematicPropsTransform() {
219489
219496
  const { _parsedProps: props } = this;
219490
- return compose5(translate5(props.schX ?? 0, props.schY ?? 0));
219497
+ return compose6(translate6(props.schX ?? 0, props.schY ?? 0));
219491
219498
  }
219492
219499
  computeSchematicGlobalTransform() {
219493
219500
  const manualPlacementTransform = this._getSchematicGlobalManualPlacementTransform(this);
219494
219501
  if (manualPlacementTransform)
219495
219502
  return manualPlacementTransform;
219496
- return compose5(this.parent?.computeSchematicGlobalTransform?.() ?? identity5(), this.computeSchematicPropsTransform());
219503
+ return compose6(this.parent?.computeSchematicGlobalTransform?.() ?? identity5(), this.computeSchematicPropsTransform());
219497
219504
  }
219498
219505
  _getSchematicSymbolName() {
219499
219506
  const { _parsedProps: props } = this;
@@ -219579,7 +219586,7 @@ var PrimitiveComponent2 = class extends Renderable {
219579
219586
  return null;
219580
219587
  for (const position2 of placementConfigPositions) {
219581
219588
  if (isMatchingSelector(component, position2.selector) || component.props.name === position2.selector) {
219582
- const center2 = applyToPoint20(this._computePcbGlobalTransformBeforeLayout(), position2.center);
219589
+ const center2 = applyToPoint21(this._computePcbGlobalTransformBeforeLayout(), position2.center);
219583
219590
  return center2;
219584
219591
  }
219585
219592
  }
@@ -219596,7 +219603,7 @@ var PrimitiveComponent2 = class extends Renderable {
219596
219603
  return null;
219597
219604
  for (const position2 of placementConfigPositions) {
219598
219605
  if (isMatchingSelector(component, position2.selector) || component.props.name === position2.selector) {
219599
- const center2 = applyToPoint20(this.computeSchematicGlobalTransform(), position2.center);
219606
+ const center2 = applyToPoint21(this.computeSchematicGlobalTransform(), position2.center);
219600
219607
  return center2;
219601
219608
  }
219602
219609
  }
@@ -219609,20 +219616,20 @@ var PrimitiveComponent2 = class extends Renderable {
219609
219616
  for (const position2 of manualEdits.schematic_placements ?? []) {
219610
219617
  if (isMatchingSelector(component, position2.selector) || component.props.name === position2.selector) {
219611
219618
  if (position2.relative_to === "group_center") {
219612
- return compose5(this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity5(), translate5(position2.center.x, position2.center.y));
219619
+ return compose6(this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity5(), translate6(position2.center.x, position2.center.y));
219613
219620
  }
219614
219621
  }
219615
219622
  }
219616
219623
  return null;
219617
219624
  }
219618
219625
  _getGlobalPcbPositionBeforeLayout() {
219619
- return applyToPoint20(this._computePcbGlobalTransformBeforeLayout(), {
219626
+ return applyToPoint21(this._computePcbGlobalTransformBeforeLayout(), {
219620
219627
  x: 0,
219621
219628
  y: 0
219622
219629
  });
219623
219630
  }
219624
219631
  _getGlobalSchematicPositionBeforeLayout() {
219625
- return applyToPoint20(this.computeSchematicGlobalTransform(), { x: 0, y: 0 });
219632
+ return applyToPoint21(this.computeSchematicGlobalTransform(), { x: 0, y: 0 });
219626
219633
  }
219627
219634
  _getBoard() {
219628
219635
  let current2 = this;
@@ -222099,7 +222106,7 @@ function Trace_doInitialPcbManualTraceRender(trace) {
222099
222106
  viaToLayer = pt3.toLayer;
222100
222107
  }
222101
222108
  }
222102
- const finalCoordinates = isGlobalPosition ? coordinates : applyToPoint20(transform2, coordinates);
222109
+ const finalCoordinates = isGlobalPosition ? coordinates : applyToPoint21(transform2, coordinates);
222103
222110
  if (isViaPoint) {
222104
222111
  route.push({
222105
222112
  route_type: "via",
@@ -222934,7 +222941,7 @@ var CourtyardOutline = class extends PrimitiveComponent2 {
222934
222941
  pcb_component_id,
222935
222942
  layer,
222936
222943
  outline: props.outline.map((p3) => {
222937
- const transformedPosition = applyToPoint20(transform2, {
222944
+ const transformedPosition = applyToPoint21(transform2, {
222938
222945
  x: p3.x,
222939
222946
  y: p3.y
222940
222947
  });
@@ -223111,7 +223118,7 @@ var Cutout = class extends PrimitiveComponent2 {
223111
223118
  inserted_pcb_cutout = db.pcb_cutout.insert(circleData);
223112
223119
  } else if (props.shape === "polygon") {
223113
223120
  const transform2 = this._computePcbGlobalTransformBeforeLayout();
223114
- const transformedPoints = props.points.map((p3) => applyToPoint20(transform2, p3));
223121
+ const transformedPoints = props.points.map((p3) => applyToPoint21(transform2, p3));
223115
223122
  const polygonData = {
223116
223123
  shape: "polygon",
223117
223124
  points: transformedPoints,
@@ -223272,7 +223279,7 @@ var FabricationNotePath = class extends PrimitiveComponent2 {
223272
223279
  layer,
223273
223280
  color: props.color,
223274
223281
  route: props.route.map((p3) => {
223275
- const transformedPosition = applyToPoint20(transform2, {
223282
+ const transformedPosition = applyToPoint21(transform2, {
223276
223283
  x: p3.x,
223277
223284
  y: p3.y
223278
223285
  });
@@ -223765,8 +223772,8 @@ var PcbNoteLine = class extends PrimitiveComponent2 {
223765
223772
  const subcircuit = this.getSubcircuit();
223766
223773
  const group = this.getGroup();
223767
223774
  const transform2 = this._computePcbGlobalTransformBeforeLayout();
223768
- const start = applyToPoint20(transform2, { x: props.x1, y: props.y1 });
223769
- const end = applyToPoint20(transform2, { x: props.x2, y: props.y2 });
223775
+ const start = applyToPoint21(transform2, { x: props.x1, y: props.y1 });
223776
+ const end = applyToPoint21(transform2, { x: props.x2, y: props.y2 });
223770
223777
  const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? undefined;
223771
223778
  const pcb_note_line2 = db.pcb_note_line.insert({
223772
223779
  pcb_component_id,
@@ -223831,7 +223838,7 @@ var PcbNotePath = class extends PrimitiveComponent2 {
223831
223838
  const { x: x3, y: y32, ...rest } = point6;
223832
223839
  const numericX = typeof x3 === "string" ? parseFloat(x3) : x3;
223833
223840
  const numericY = typeof y32 === "string" ? parseFloat(y32) : y32;
223834
- const transformed = applyToPoint20(transform2, { x: numericX, y: numericY });
223841
+ const transformed = applyToPoint21(transform2, { x: numericX, y: numericY });
223835
223842
  return { ...rest, x: transformed.x, y: transformed.y };
223836
223843
  });
223837
223844
  const pcb_note_path2 = db.pcb_note_path.insert({
@@ -223892,7 +223899,7 @@ var PcbNoteRect = class extends PrimitiveComponent2 {
223892
223899
  const { db } = this.root;
223893
223900
  const { _parsedProps: props } = this;
223894
223901
  const transform2 = this._computePcbGlobalTransformBeforeLayout();
223895
- const center2 = applyToPoint20(transform2, { x: 0, y: 0 });
223902
+ const center2 = applyToPoint21(transform2, { x: 0, y: 0 });
223896
223903
  const subcircuit = this.getSubcircuit();
223897
223904
  const group = this.getGroup();
223898
223905
  const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? undefined;
@@ -223953,7 +223960,7 @@ var PcbNoteText = class extends PrimitiveComponent2 {
223953
223960
  const { db } = this.root;
223954
223961
  const { _parsedProps: props } = this;
223955
223962
  const transform2 = this._computePcbGlobalTransformBeforeLayout();
223956
- const anchorPosition = applyToPoint20(transform2, { x: 0, y: 0 });
223963
+ const anchorPosition = applyToPoint21(transform2, { x: 0, y: 0 });
223957
223964
  const subcircuit = this.getSubcircuit();
223958
223965
  const group = this.getGroup();
223959
223966
  const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? undefined;
@@ -224022,7 +224029,7 @@ var PcbTrace = class extends PrimitiveComponent2 {
224022
224029
  const parentTransform = this._computePcbGlobalTransformBeforeLayout();
224023
224030
  const transformedRoute = props.route.map((point6) => {
224024
224031
  const { x: x3, y: y32, ...restOfPoint } = point6;
224025
- const transformedPoint = applyToPoint20(parentTransform, { x: x3, y: y32 });
224032
+ const transformedPoint = applyToPoint21(parentTransform, { x: x3, y: y32 });
224026
224033
  if (point6.route_type === "wire" && point6.layer) {
224027
224034
  return {
224028
224035
  ...transformedPoint,
@@ -224449,8 +224456,8 @@ var SilkscreenLine = class extends PrimitiveComponent2 {
224449
224456
  }
224450
224457
  const subcircuit = this.getSubcircuit();
224451
224458
  const transform2 = this._computePcbGlobalTransformBeforeLayout();
224452
- const p12 = applyToPoint20(transform2, { x: props.x1, y: props.y1 });
224453
- const p222 = applyToPoint20(transform2, { x: props.x2, y: props.y2 });
224459
+ const p12 = applyToPoint21(transform2, { x: props.x1, y: props.y1 });
224460
+ const p222 = applyToPoint21(transform2, { x: props.x2, y: props.y2 });
224454
224461
  const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
224455
224462
  const pcb_silkscreen_line2 = db.pcb_silkscreen_line.insert({
224456
224463
  pcb_component_id,
@@ -224517,7 +224524,7 @@ var SilkscreenPath = class extends PrimitiveComponent2 {
224517
224524
  pcb_component_id,
224518
224525
  layer,
224519
224526
  route: props.route.map((p3) => {
224520
- const transformedPosition = applyToPoint20(transform2, {
224527
+ const transformedPosition = applyToPoint21(transform2, {
224521
224528
  x: p3.x,
224522
224529
  y: p3.y
224523
224530
  });
@@ -224727,7 +224734,7 @@ var SilkscreenText = class extends PrimitiveComponent2 {
224727
224734
  });
224728
224735
  const fontSize = props.fontSize ?? resolvedPcbSxFontSize ?? this.getInheritedProperty("pcbStyle")?.silkscreenFontSize ?? this._footprinterFontSize ?? 1;
224729
224736
  const hasResolvedPcbSxPosition = resolvedPcbSxPcbX !== undefined || resolvedPcbSxPcbY !== undefined;
224730
- const position2 = hasResolvedPcbSxPosition && this._footprinterFontSize !== undefined ? applyToPoint20(compose5(this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity5(), isFlipped ? flipY() : identity5()), {
224737
+ const position2 = hasResolvedPcbSxPosition && this._footprinterFontSize !== undefined ? applyToPoint21(compose6(this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity5(), isFlipped ? flipY() : identity5()), {
224731
224738
  x: this.resolvePcbCoordinate({
224732
224739
  rawValue: resolvedPcbSxPcbX ?? props.pcbX ?? 0,
224733
224740
  axis: "pcbX"
@@ -225013,7 +225020,7 @@ var SmtPad = class extends PrimitiveComponent2 {
225013
225020
  });
225014
225021
  } else if (props.shape === "polygon") {
225015
225022
  const transformedPoints = props.points.map((point6) => {
225016
- const transformed = applyToPoint20(globalTransform, {
225023
+ const transformed = applyToPoint21(globalTransform, {
225017
225024
  x: distance.parse(point6.x),
225018
225025
  y: distance.parse(point6.y)
225019
225026
  });
@@ -225859,8 +225866,8 @@ var Port = class extends PrimitiveComponent2 {
225859
225866
  throw new Error(`Couldn't find schematicSymbolPortDef for port ${this.getString()}, searched internally connected ports and none had a schematicSymbolPortDef. Why are we trying to get the schematic position of this port?`);
225860
225867
  }
225861
225868
  }
225862
- const transform2 = compose5(parentNormalComponent.computeSchematicGlobalTransform(), translate5(-symbol.center.x, -symbol.center.y));
225863
- return applyToPoint20(transform2, schematicSymbolPortDef);
225869
+ const transform2 = compose6(parentNormalComponent.computeSchematicGlobalTransform(), translate6(-symbol.center.x, -symbol.center.y));
225870
+ return applyToPoint21(transform2, schematicSymbolPortDef);
225864
225871
  }
225865
225872
  const parentBoxDim = parentNormalComponent?._getSchematicBoxDimensions();
225866
225873
  if (parentBoxDim && this.props.pinNumber !== undefined) {
@@ -225868,7 +225875,7 @@ var Port = class extends PrimitiveComponent2 {
225868
225875
  if (!localPortPosition) {
225869
225876
  throw new Error(`Couldn't find position for schematic_port for port ${this.getString()} inside of the schematic box`);
225870
225877
  }
225871
- return applyToPoint20(parentNormalComponent.computeSchematicGlobalTransform(), localPortPosition);
225878
+ return applyToPoint21(parentNormalComponent.computeSchematicGlobalTransform(), localPortPosition);
225872
225879
  }
225873
225880
  throw new Error(`Couldn't find position for schematic_port for port ${this.getString()}`);
225874
225881
  }
@@ -226230,15 +226237,15 @@ var Port = class extends PrimitiveComponent2 {
226230
226237
  const { db } = this.root;
226231
226238
  const schPort = db.schematic_port.get(this.schematic_port_id);
226232
226239
  if (schPort) {
226233
- const newCenter = applyToPoint20(transform2, schPort.center);
226240
+ const newCenter = applyToPoint21(transform2, schPort.center);
226234
226241
  db.schematic_port.update(this.schematic_port_id, {
226235
226242
  center: newCenter
226236
226243
  });
226237
226244
  if (this.schematic_stem_line_id) {
226238
226245
  const line2 = db.schematic_line.get(this.schematic_stem_line_id);
226239
226246
  if (line2) {
226240
- const p12 = applyToPoint20(transform2, { x: line2.x1, y: line2.y1 });
226241
- const p222 = applyToPoint20(transform2, { x: line2.x2, y: line2.y2 });
226247
+ const p12 = applyToPoint21(transform2, { x: line2.x1, y: line2.y1 });
226248
+ const p222 = applyToPoint21(transform2, { x: line2.x2, y: line2.y2 });
226242
226249
  db.schematic_line.update(this.schematic_stem_line_id, {
226243
226250
  x1: p12.x,
226244
226251
  y1: p12.y,
@@ -228775,7 +228782,7 @@ var extractPcbPrimitivesFromCircuitJson = ({
228775
228782
  }) => {
228776
228783
  const componentCenter = pcbComponent.center || { x: 0, y: 0 };
228777
228784
  const componentRotation = pcbComponent.rotation || 0;
228778
- const absoluteToComponentRelativeTransform = inverse(compose5(translate5(componentCenter.x, componentCenter.y), rotate6(componentRotation * Math.PI / 180)));
228785
+ const absoluteToComponentRelativeTransform = inverse(compose6(translate6(componentCenter.x, componentCenter.y), rotate7(componentRotation * Math.PI / 180)));
228779
228786
  const relativeElements = db.toArray().filter((elm) => ("pcb_component_id" in elm) && elm.pcb_component_id === pcbComponent.pcb_component_id);
228780
228787
  const clonedRelativeElements = structuredClone(relativeElements);
228781
228788
  transformPCBElements(clonedRelativeElements, absoluteToComponentRelativeTransform);
@@ -229801,7 +229808,7 @@ var TraceHint = class extends PrimitiveComponent2 {
229801
229808
  return [];
229802
229809
  const globalTransform = this._computePcbGlobalTransformBeforeLayout();
229803
229810
  return offsets.map((offset) => ({
229804
- ...applyToPoint20(globalTransform, offset),
229811
+ ...applyToPoint21(globalTransform, offset),
229805
229812
  via: offset.via,
229806
229813
  to_layer: offset.to_layer,
229807
229814
  trace_width: offset.trace_width
@@ -230803,7 +230810,7 @@ var applyPackOutput = (group, packOutput, clusterMap) => {
230803
230810
  if (!member)
230804
230811
  continue;
230805
230812
  const originalCenter2 = member.center;
230806
- const transformMatrix2 = compose5(group._computePcbGlobalTransformBeforeLayout(), translate5(center2.x + rotatedRel.x, center2.y + rotatedRel.y), rotate6(angleRad), translate5(-originalCenter2.x, -originalCenter2.y));
230813
+ const transformMatrix2 = compose6(group._computePcbGlobalTransformBeforeLayout(), translate6(center2.x + rotatedRel.x, center2.y + rotatedRel.y), rotate7(angleRad), translate6(-originalCenter2.x, -originalCenter2.y));
230807
230814
  const related = db.toArray().filter((elm) => ("pcb_component_id" in elm) && elm.pcb_component_id === memberId);
230808
230815
  transformPCBElements(related, transformMatrix2);
230809
230816
  updateCadRotation({
@@ -230828,7 +230835,7 @@ var applyPackOutput = (group, packOutput, clusterMap) => {
230828
230835
  }
230829
230836
  const originalCenter2 = pcbComponent.center;
230830
230837
  const rotationDegrees2 = ccwRotationDegrees ?? ccwRotationOffset ?? 0;
230831
- const transformMatrix2 = compose5(group._computePcbGlobalTransformBeforeLayout(), translate5(center2.x, center2.y), rotate6(rotationDegrees2 * Math.PI / 180), translate5(-originalCenter2.x, -originalCenter2.y));
230838
+ const transformMatrix2 = compose6(group._computePcbGlobalTransformBeforeLayout(), translate6(center2.x, center2.y), rotate7(rotationDegrees2 * Math.PI / 180), translate6(-originalCenter2.x, -originalCenter2.y));
230832
230839
  const related = db.toArray().filter((elm) => ("pcb_component_id" in elm) && elm.pcb_component_id === componentId);
230833
230840
  transformPCBElements(related, transformMatrix2);
230834
230841
  updateCadRotation({
@@ -230844,7 +230851,7 @@ var applyPackOutput = (group, packOutput, clusterMap) => {
230844
230851
  continue;
230845
230852
  const originalCenter = pcbGroup.center;
230846
230853
  const rotationDegrees = ccwRotationDegrees ?? ccwRotationOffset ?? 0;
230847
- const transformMatrix = compose5(group._computePcbGlobalTransformBeforeLayout(), translate5(center2.x, center2.y), rotate6(rotationDegrees * Math.PI / 180), translate5(-originalCenter.x, -originalCenter.y));
230854
+ const transformMatrix = compose6(group._computePcbGlobalTransformBeforeLayout(), translate6(center2.x, center2.y), rotate7(rotationDegrees * Math.PI / 180), translate6(-originalCenter.x, -originalCenter.y));
230848
230855
  const relatedElements = db.toArray().filter((elm) => {
230849
230856
  if ("source_group_id" in elm && elm.source_group_id) {
230850
230857
  if (elm.source_group_id === componentId) {
@@ -235402,7 +235409,7 @@ var Board = class extends Group6 {
235402
235409
  _computePcbGlobalTransformBeforeLayout() {
235403
235410
  if (this._panelPositionOffset) {
235404
235411
  const parentTransform = this.parent?._computePcbGlobalTransformBeforeLayout?.() ?? { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 };
235405
- return compose5(parentTransform, translate5(this._panelPositionOffset.x, this._panelPositionOffset.y));
235412
+ return compose6(parentTransform, translate6(this._panelPositionOffset.x, this._panelPositionOffset.y));
235406
235413
  }
235407
235414
  return super._computePcbGlobalTransformBeforeLayout();
235408
235415
  }
@@ -236246,7 +236253,7 @@ var Subpanel = class _Subpanel extends Group6 {
236246
236253
  _computePcbGlobalTransformBeforeLayout() {
236247
236254
  if (this._panelPositionOffset) {
236248
236255
  const parentTransform = this.parent?._computePcbGlobalTransformBeforeLayout?.() ?? identity5();
236249
- return compose5(parentTransform, translate5(this._panelPositionOffset.x, this._panelPositionOffset.y));
236256
+ return compose6(parentTransform, translate6(this._panelPositionOffset.x, this._panelPositionOffset.y));
236250
236257
  }
236251
236258
  return super._computePcbGlobalTransformBeforeLayout();
236252
236259
  }
@@ -237245,13 +237252,13 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
237245
237252
  const target = this.getSubcircuit().selectOne(input);
237246
237253
  if (!target) {
237247
237254
  this.renderError(`FabricationNoteDimension could not find selector "${input}"`);
237248
- return applyToPoint20(transform2, { x: 0, y: 0 });
237255
+ return applyToPoint21(transform2, { x: 0, y: 0 });
237249
237256
  }
237250
237257
  return target._getGlobalPcbPositionBeforeLayout();
237251
237258
  }
237252
237259
  const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
237253
237260
  const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
237254
- return applyToPoint20(transform2, { x: numericX, y: numericY });
237261
+ return applyToPoint21(transform2, { x: numericX, y: numericY });
237255
237262
  }
237256
237263
  doInitialPcbPrimitiveRender() {
237257
237264
  if (this.root?.pcbDisabled)
@@ -237351,7 +237358,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
237351
237358
  const target = this.getSubcircuit().selectOne(`.${input}`);
237352
237359
  if (!target) {
237353
237360
  this.renderError(`PcbNoteDimension could not find selector "${input}"`);
237354
- return applyToPoint20(transform2, { x: 0, y: 0 });
237361
+ return applyToPoint21(transform2, { x: 0, y: 0 });
237355
237362
  }
237356
237363
  const targetPcbComponentId = target.pcb_component_id;
237357
237364
  const root = this.root;
@@ -237368,7 +237375,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
237368
237375
  }
237369
237376
  const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
237370
237377
  const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
237371
- return applyToPoint20(transform2, { x: numericX, y: numericY });
237378
+ return applyToPoint21(transform2, { x: numericX, y: numericY });
237372
237379
  }
237373
237380
  doInitialPcbPrimitiveRender() {
237374
237381
  if (this.root?.pcbDisabled)
@@ -237647,8 +237654,8 @@ var NetLabel = class extends PrimitiveComponent2 {
237647
237654
  const connectedPorts = this._getConnectedPorts();
237648
237655
  if (connectedPorts.length > 0) {
237649
237656
  const portPos = connectedPorts[0]._getGlobalSchematicPositionBeforeLayout();
237650
- const parentCenter = applyToPoint20(this.parent?.computeSchematicGlobalTransform?.() ?? identity5(), { x: 0, y: 0 });
237651
- return translate5(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
237657
+ const parentCenter = applyToPoint21(this.parent?.computeSchematicGlobalTransform?.() ?? identity5(), { x: 0, y: 0 });
237658
+ return translate6(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
237652
237659
  }
237653
237660
  }
237654
237661
  return super.computeSchematicPropsTransform();
@@ -238920,7 +238927,7 @@ var SchematicText = class extends PrimitiveComponent2 {
238920
238927
  const text = db.schematic_text.get(this.schematic_text_id);
238921
238928
  if (!text)
238922
238929
  return;
238923
- const newPosition = applyToPoint20(transform2, text.position);
238930
+ const newPosition = applyToPoint21(transform2, text.position);
238924
238931
  db.schematic_text.update(this.schematic_text_id, {
238925
238932
  position: { x: newPosition.x, y: newPosition.y }
238926
238933
  });
@@ -238970,8 +238977,8 @@ var SchematicLine = class extends PrimitiveComponent2 {
238970
238977
  const line2 = db.schematic_line.get(this.schematic_line_id);
238971
238978
  if (!line2)
238972
238979
  return;
238973
- const p12 = applyToPoint20(transform2, { x: line2.x1, y: line2.y1 });
238974
- const p222 = applyToPoint20(transform2, { x: line2.x2, y: line2.y2 });
238980
+ const p12 = applyToPoint21(transform2, { x: line2.x1, y: line2.y1 });
238981
+ const p222 = applyToPoint21(transform2, { x: line2.x2, y: line2.y2 });
238975
238982
  db.schematic_line.update(this.schematic_line_id, {
238976
238983
  x1: p12.x,
238977
238984
  y1: p12.y,
@@ -239028,11 +239035,11 @@ var SchematicRect = class extends PrimitiveComponent2 {
239028
239035
  const rect = db.schematic_rect.get(this.schematic_rect_id);
239029
239036
  if (!rect)
239030
239037
  return;
239031
- const topLeft = applyToPoint20(transform2, {
239038
+ const topLeft = applyToPoint21(transform2, {
239032
239039
  x: rect.center.x - rect.width / 2,
239033
239040
  y: rect.center.y + rect.height / 2
239034
239041
  });
239035
- const bottomRight = applyToPoint20(transform2, {
239042
+ const bottomRight = applyToPoint21(transform2, {
239036
239043
  x: rect.center.x + rect.width / 2,
239037
239044
  y: rect.center.y - rect.height / 2
239038
239045
  });
@@ -239097,8 +239104,8 @@ var SchematicArc = class extends PrimitiveComponent2 {
239097
239104
  const arc2 = db.schematic_arc.get(this.schematic_arc_id);
239098
239105
  if (!arc2)
239099
239106
  return;
239100
- const newCenter = applyToPoint20(transform2, arc2.center);
239101
- const edgePoint = applyToPoint20(transform2, {
239107
+ const newCenter = applyToPoint21(transform2, arc2.center);
239108
+ const edgePoint = applyToPoint21(transform2, {
239102
239109
  x: arc2.center.x + arc2.radius,
239103
239110
  y: arc2.center.y
239104
239111
  });
@@ -239156,8 +239163,8 @@ var SchematicCircle = class extends PrimitiveComponent2 {
239156
239163
  const circle2 = db.schematic_circle.get(this.schematic_circle_id);
239157
239164
  if (!circle2)
239158
239165
  return;
239159
- const newCenter = applyToPoint20(transform2, circle2.center);
239160
- const edgePoint = applyToPoint20(transform2, {
239166
+ const newCenter = applyToPoint21(transform2, circle2.center);
239167
+ const edgePoint = applyToPoint21(transform2, {
239161
239168
  x: circle2.center.x + circle2.radius,
239162
239169
  y: circle2.center.y
239163
239170
  });
@@ -239362,7 +239369,7 @@ var SchematicPath = class extends PrimitiveComponent2 {
239362
239369
  if (!path42)
239363
239370
  continue;
239364
239371
  const newPoints = path42.points.map((point6) => {
239365
- const transformed = applyToPoint20(transform2, point6);
239372
+ const transformed = applyToPoint21(transform2, point6);
239366
239373
  return { x: transformed.x, y: transformed.y };
239367
239374
  });
239368
239375
  db.schematic_path.update(pathId, {
@@ -239818,7 +239825,7 @@ var SymbolComponent = class extends PrimitiveComponent2 {
239818
239825
  const scaleX = targetWidth !== undefined && currentWidth > 0 ? targetWidth / currentWidth : 1;
239819
239826
  const scaleY = targetHeight !== undefined && currentHeight > 0 ? targetHeight / currentHeight : 1;
239820
239827
  const globalPos = this._getGlobalSchematicPositionBeforeLayout();
239821
- this.userCoordinateToResizedSymbolTransformMat = compose5(translate5(globalPos.x, globalPos.y), scale4(scaleX, scaleY), translate5(-currentCenterX, -currentCenterY));
239828
+ this.userCoordinateToResizedSymbolTransformMat = compose6(translate6(globalPos.x, globalPos.y), scale5(scaleX, scaleY), translate6(-currentCenterX, -currentCenterY));
239822
239829
  }
239823
239830
  };
239824
239831
  var AnalogSimulation = class extends PrimitiveComponent2 {
@@ -246422,11 +246429,11 @@ import {
246422
246429
 
246423
246430
  // node_modules/dsn-converter/dist/index.js
246424
246431
  import { su as su7 } from "@tscircuit/soup-util";
246425
- import { applyToPoint as applyToPoint22, scale as scale6 } from "transformation-matrix";
246432
+ import { applyToPoint as applyToPoint23, scale as scale7 } from "transformation-matrix";
246426
246433
  import { su as su23 } from "@tscircuit/soup-util";
246427
246434
  import Debug4 from "debug";
246428
246435
  import { su as su33 } from "@tscircuit/soup-util";
246429
- import { applyToPoint as applyToPoint23, scale as scale22 } from "transformation-matrix";
246436
+ import { applyToPoint as applyToPoint22, scale as scale22 } from "transformation-matrix";
246430
246437
  import { su as su42 } from "@tscircuit/soup-util";
246431
246438
  import Debug22 from "debug";
246432
246439
  import { scale as scale32, applyToPoint as applyToPoint92 } from "transformation-matrix";
@@ -246650,7 +246657,7 @@ function createPinForImage(pad2, pcbComponent, sourcePort) {
246650
246657
  y: (pad2.y - pcbComponent.center.y) * 1000
246651
246658
  };
246652
246659
  }
246653
- var transformMmToUm = scale6(1000);
246660
+ var transformMmToUm = scale7(1000);
246654
246661
  function processComponentsAndPads(componentGroups, circuitElements, pcb) {
246655
246662
  const processedPadstacks = /* @__PURE__ */ new Set;
246656
246663
  const componentsByFootprint = /* @__PURE__ */ new Map;
@@ -246662,7 +246669,7 @@ function processComponentsAndPads(componentGroups, circuitElements, pcb) {
246662
246669
  const sourceComponent = su7(circuitElements).source_component.list().find((e4) => e4.source_component_id === pcbComponent?.source_component_id);
246663
246670
  const footprintName = getFootprintName(sourceComponent, pcbComponent);
246664
246671
  const componentName = sourceComponent?.name || "Unknown";
246665
- const circuitSpaceCoordinates = applyToPoint22(transformMmToUm, pcbComponent.center);
246672
+ const circuitSpaceCoordinates = applyToPoint23(transformMmToUm, pcbComponent.center);
246666
246673
  if (!componentsByFootprint.has(footprintName)) {
246667
246674
  componentsByFootprint.set(footprintName, []);
246668
246675
  }
@@ -247174,7 +247181,7 @@ function processPlatedHoles(componentGroups, circuitElements, pcb) {
247174
247181
  componentsByFootprint.set(key, []);
247175
247182
  componentsByFootprint.get(key).push({
247176
247183
  componentName: sourceComponent?.name || "Unknown",
247177
- coordinates: applyToPoint23(transformMmToUm2, pcbComponent.center),
247184
+ coordinates: applyToPoint22(transformMmToUm2, pcbComponent.center),
247178
247185
  rotation: pcbComponent.rotation || 0,
247179
247186
  value: getComponentValue(sourceComponent),
247180
247187
  sourceComponent
@@ -249805,10 +249812,10 @@ import { z as z50 } from "zod";
249805
249812
  import { lineAlphabet as lineAlphabet2 } from "@tscircuit/alphabet";
249806
249813
  import {
249807
249814
  applyToPoint as applyToPoint24,
249808
- compose as compose7,
249815
+ compose as compose8,
249809
249816
  identity as identity7,
249810
- rotate as rotate8,
249811
- translate as translate7
249817
+ rotate as rotate9,
249818
+ translate as translate8
249812
249819
  } from "transformation-matrix";
249813
249820
  var defineExcellonDrillCommand = ({
249814
249821
  command_code,
@@ -251189,14 +251196,14 @@ var convertSoupToGerberCommands = (soup, opts = {}) => {
251189
251196
  const transforms = [];
251190
251197
  const shouldMirror = element.is_mirrored !== undefined ? element.is_mirrored : element.layer === "bottom";
251191
251198
  if (shouldMirror) {
251192
- transforms.push(translate7(cx2, cy2), { a: -1, b: 0, c: 0, d: 1, e: 0, f: 0 }, translate7(-cx2, -cy2));
251199
+ transforms.push(translate8(cx2, cy2), { a: -1, b: 0, c: 0, d: 1, e: 0, f: 0 }, translate8(-cx2, -cy2));
251193
251200
  rotation4 = -rotation4;
251194
251201
  }
251195
251202
  if (rotation4) {
251196
251203
  const rad = rotation4 * Math.PI / 180;
251197
- transforms.push(translate7(cx2, cy2), rotate8(rad), translate7(-cx2, -cy2));
251204
+ transforms.push(translate8(cx2, cy2), rotate9(rad), translate8(-cx2, -cy2));
251198
251205
  }
251199
- const transformMatrix = transforms.length > 0 ? compose7(...transforms) : undefined;
251206
+ const transformMatrix = transforms.length > 0 ? compose8(...transforms) : undefined;
251200
251207
  const applyTransform2 = (point5) => transformMatrix ? applyToPoint24(transformMatrix, point5) : point5;
251201
251208
  if (layerType === "copper" && element.is_knockout) {
251202
251209
  const padding = element.knockout_padding ?? {
@@ -251375,9 +251382,9 @@ var convertSoupToGerberCommands = (soup, opts = {}) => {
251375
251382
  let transformMatrix = identity7();
251376
251383
  if (rotation4) {
251377
251384
  const angle_rad = rotation4 * Math.PI / 180;
251378
- transformMatrix = rotate8(angle_rad);
251385
+ transformMatrix = rotate9(angle_rad);
251379
251386
  }
251380
- transformMatrix = compose7(translate7(center2.x, center2.y), transformMatrix);
251387
+ transformMatrix = compose8(translate8(center2.x, center2.y), transformMatrix);
251381
251388
  const transformedPoints = points.map((p3) => applyToPoint24(transformMatrix, p3));
251382
251389
  const rect_builder = gerberBuilder().add("select_aperture", { aperture_number: 10 }).add("start_region_statement", {});
251383
251390
  rect_builder.add("move_operation", {
@@ -251736,9 +251743,9 @@ var convertSoupToGerberCommands = (soup, opts = {}) => {
251736
251743
  let transformMatrix2 = identity7();
251737
251744
  if (rotation4) {
251738
251745
  const angle_rad = rotation4 * Math.PI / 180;
251739
- transformMatrix2 = rotate8(angle_rad);
251746
+ transformMatrix2 = rotate9(angle_rad);
251740
251747
  }
251741
- return compose7(translate7(center2.x, center2.y), transformMatrix2);
251748
+ return compose8(translate8(center2.x, center2.y), transformMatrix2);
251742
251749
  };
251743
251750
  const transformMatrix = makeTransformMatrix();
251744
251751
  if (r4 > 0) {
@@ -259643,7 +259650,7 @@ var any_circuit_element2 = external_exports2.union([
259643
259650
  var any_soup_element2 = any_circuit_element2;
259644
259651
  expectTypesMatch3(true);
259645
259652
  expectStringUnionsMatch2(true);
259646
- function applyToPoint26(matrix2, point22) {
259653
+ function applyToPoint25(matrix2, point22) {
259647
259654
  return Array.isArray(point22) ? [
259648
259655
  matrix2.a * point22[0] + matrix2.c * point22[1] + matrix2.e,
259649
259656
  matrix2.b * point22[0] + matrix2.d * point22[1] + matrix2.f
@@ -259655,7 +259662,7 @@ function applyToPoint26(matrix2, point22) {
259655
259662
  function isUndefined3(val) {
259656
259663
  return typeof val === "undefined";
259657
259664
  }
259658
- function translate8(tx2, ty2 = 0) {
259665
+ function translate9(tx2, ty2 = 0) {
259659
259666
  return {
259660
259667
  a: 1,
259661
259668
  c: 0,
@@ -259691,10 +259698,10 @@ function transform2(...matrices) {
259691
259698
  }
259692
259699
  }
259693
259700
  }
259694
- function compose8(...matrices) {
259701
+ function compose9(...matrices) {
259695
259702
  return transform2(...matrices);
259696
259703
  }
259697
- function scale7(sx2, sy2 = undefined, cx2 = undefined, cy2 = undefined) {
259704
+ function scale8(sx2, sy2 = undefined, cx2 = undefined, cy2 = undefined) {
259698
259705
  if (isUndefined3(sy2))
259699
259706
  sy2 = sx2;
259700
259707
  const scaleMatrix = {
@@ -259709,9 +259716,9 @@ function scale7(sx2, sy2 = undefined, cx2 = undefined, cy2 = undefined) {
259709
259716
  return scaleMatrix;
259710
259717
  }
259711
259718
  return transform2([
259712
- translate8(cx2, cy2),
259719
+ translate9(cx2, cy2),
259713
259720
  scaleMatrix,
259714
- translate8(-cx2, -cy2)
259721
+ translate9(-cx2, -cy2)
259715
259722
  ]);
259716
259723
  }
259717
259724
  function peg$subclass2(child, parent) {
@@ -259845,12 +259852,12 @@ peg$SyntaxError2.buildMessage = function(expected, found) {
259845
259852
  function decomposeTSR2(matrix2, flipX = false, flipY2 = false) {
259846
259853
  if (flipX) {
259847
259854
  if (flipY2) {
259848
- matrix2 = compose8(matrix2, scale7(-1, -1));
259855
+ matrix2 = compose9(matrix2, scale8(-1, -1));
259849
259856
  } else {
259850
- matrix2 = compose8(matrix2, scale7(1, -1));
259857
+ matrix2 = compose9(matrix2, scale8(1, -1));
259851
259858
  }
259852
259859
  } else if (flipY2) {
259853
- matrix2 = compose8(matrix2, scale7(-1, 1));
259860
+ matrix2 = compose9(matrix2, scale8(-1, 1));
259854
259861
  }
259855
259862
  const a2 = matrix2.a;
259856
259863
  const b = matrix2.b;
@@ -260607,7 +260614,7 @@ var transformPCBElement2 = (elm, matrix2) => {
260607
260614
  const tsr = decomposeTSR2(matrix2);
260608
260615
  const flipPadWidthHeight = Math.round(tsr.rotation.angle / (Math.PI / 2)) % 2 === 1;
260609
260616
  if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
260610
- const { x: x3, y: y4 } = applyToPoint26(matrix2, {
260617
+ const { x: x3, y: y4 } = applyToPoint25(matrix2, {
260611
260618
  x: Number(elm.x),
260612
260619
  y: Number(elm.y)
260613
260620
  });
@@ -260615,7 +260622,7 @@ var transformPCBElement2 = (elm, matrix2) => {
260615
260622
  elm.y = y4;
260616
260623
  if (elm.type === "pcb_smtpad" && elm.shape === "polygon" && Array.isArray(elm.points)) {
260617
260624
  elm.points = elm.points.map((point22) => {
260618
- const tp3 = applyToPoint26(matrix2, { x: point22.x, y: point22.y });
260625
+ const tp3 = applyToPoint25(matrix2, { x: point22.x, y: point22.y });
260619
260626
  return {
260620
260627
  x: tp3.x,
260621
260628
  y: tp3.y
@@ -260623,13 +260630,13 @@ var transformPCBElement2 = (elm, matrix2) => {
260623
260630
  });
260624
260631
  }
260625
260632
  } else if (elm.type === "pcb_keepout" || elm.type === "pcb_board") {
260626
- elm.center = applyToPoint26(matrix2, elm.center);
260633
+ elm.center = applyToPoint25(matrix2, elm.center);
260627
260634
  } else if (elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text" || elm.type === "pcb_note_text") {
260628
- elm.anchor_position = applyToPoint26(matrix2, elm.anchor_position);
260635
+ elm.anchor_position = applyToPoint25(matrix2, elm.anchor_position);
260629
260636
  } else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_note_rect" || elm.type === "pcb_courtyard_rect" || elm.type === "pcb_courtyard_circle") {
260630
- elm.center = applyToPoint26(matrix2, elm.center);
260637
+ elm.center = applyToPoint25(matrix2, elm.center);
260631
260638
  } else if (elm.type === "pcb_component") {
260632
- elm.center = applyToPoint26(matrix2, elm.center);
260639
+ elm.center = applyToPoint25(matrix2, elm.center);
260633
260640
  elm.rotation = elm.rotation + tsr.rotation.angle / Math.PI * 180;
260634
260641
  elm.rotation = elm.rotation % 360;
260635
260642
  if (flipPadWidthHeight) {
@@ -260637,21 +260644,21 @@ var transformPCBElement2 = (elm, matrix2) => {
260637
260644
  }
260638
260645
  } else if (elm.type === "pcb_courtyard_outline") {
260639
260646
  elm.outline = elm.outline.map((p3) => {
260640
- const tp3 = applyToPoint26(matrix2, p3);
260647
+ const tp3 = applyToPoint25(matrix2, p3);
260641
260648
  p3.x = tp3.x;
260642
260649
  p3.y = tp3.y;
260643
260650
  return p3;
260644
260651
  });
260645
260652
  } else if (elm.type === "pcb_courtyard_polygon") {
260646
260653
  elm.points = elm.points.map((p3) => {
260647
- const tp3 = applyToPoint26(matrix2, p3);
260654
+ const tp3 = applyToPoint25(matrix2, p3);
260648
260655
  p3.x = tp3.x;
260649
260656
  p3.y = tp3.y;
260650
260657
  return p3;
260651
260658
  });
260652
260659
  } else if (elm.type === "pcb_silkscreen_path" || elm.type === "pcb_trace" || elm.type === "pcb_fabrication_note_path" || elm.type === "pcb_note_path") {
260653
260660
  elm.route = elm.route.map((rp3) => {
260654
- const tp3 = applyToPoint26(matrix2, rp3);
260661
+ const tp3 = applyToPoint25(matrix2, rp3);
260655
260662
  rp3.x = tp3.x;
260656
260663
  rp3.y = tp3.y;
260657
260664
  return rp3;
@@ -260659,14 +260666,14 @@ var transformPCBElement2 = (elm, matrix2) => {
260659
260666
  } else if (elm.type === "pcb_silkscreen_line" || elm.type === "pcb_note_line") {
260660
260667
  const p12 = { x: elm.x1, y: elm.y1 };
260661
260668
  const p23 = { x: elm.x2, y: elm.y2 };
260662
- const p1t = applyToPoint26(matrix2, p12);
260663
- const p2t = applyToPoint26(matrix2, p23);
260669
+ const p1t = applyToPoint25(matrix2, p12);
260670
+ const p2t = applyToPoint25(matrix2, p23);
260664
260671
  elm.x1 = p1t.x;
260665
260672
  elm.y1 = p1t.y;
260666
260673
  elm.x2 = p2t.x;
260667
260674
  elm.y2 = p2t.y;
260668
260675
  } else if (elm.type === "cad_component") {
260669
- const newPos = applyToPoint26(matrix2, {
260676
+ const newPos = applyToPoint25(matrix2, {
260670
260677
  x: elm.position.x,
260671
260678
  y: elm.position.y
260672
260679
  });
@@ -261455,21 +261462,21 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
261455
261462
  const elementsForBounds = circuitElements.filter((e4) => e4.type !== "pcb_component" && e4.type !== "cad_component");
261456
261463
  const bounds = findBoundsAndCenter2(elementsForBounds);
261457
261464
  if (Number.isFinite(bounds.center.x) && Number.isFinite(bounds.center.y)) {
261458
- const matrix2 = compose8(translate8(-bounds.center.x, bounds.center.y), scale7(1, -1));
261465
+ const matrix2 = compose9(translate9(-bounds.center.x, bounds.center.y), scale8(1, -1));
261459
261466
  const elementsForTransform = circuitElements.filter((e4) => !(e4.type === "pcb_smtpad" && e4.shape === "polygon") && e4.type !== "cad_component");
261460
261467
  transformPCBElements2(elementsForTransform, matrix2);
261461
261468
  for (const e4 of circuitElements) {
261462
261469
  if (e4.type === "pcb_cutout") {
261463
261470
  if (e4.shape === "polygon") {
261464
- e4.points = e4.points.map((p3) => applyToPoint26(matrix2, p3));
261471
+ e4.points = e4.points.map((p3) => applyToPoint25(matrix2, p3));
261465
261472
  } else if (e4.shape === "circle" || e4.shape === "rect") {
261466
- e4.center = applyToPoint26(matrix2, e4.center);
261473
+ e4.center = applyToPoint25(matrix2, e4.center);
261467
261474
  } else if ("route" in e4) {
261468
261475
  const cutoutPath = e4;
261469
- cutoutPath.route = cutoutPath.route.map((p3) => applyToPoint26(matrix2, p3));
261476
+ cutoutPath.route = cutoutPath.route.map((p3) => applyToPoint25(matrix2, p3));
261470
261477
  }
261471
261478
  } else if (e4.type === "pcb_smtpad" && e4.shape === "polygon") {
261472
- e4.points = e4.points.map((p3) => applyToPoint26(matrix2, p3));
261479
+ e4.points = e4.points.map((p3) => applyToPoint25(matrix2, p3));
261473
261480
  }
261474
261481
  }
261475
261482
  const cad = circuitElements.find((e4) => e4.type === "cad_component");
@@ -266202,7 +266209,7 @@ var any_circuit_element3 = z160.union([
266202
266209
  var any_soup_element3 = any_circuit_element3;
266203
266210
  expectTypesMatch4(true);
266204
266211
  expectStringUnionsMatch3(true);
266205
- function applyToPoint27(matrix2, point22) {
266212
+ function applyToPoint26(matrix2, point22) {
266206
266213
  return Array.isArray(point22) ? [
266207
266214
  matrix2.a * point22[0] + matrix2.c * point22[1] + matrix2.e,
266208
266215
  matrix2.b * point22[0] + matrix2.d * point22[1] + matrix2.f
@@ -266214,7 +266221,7 @@ function applyToPoint27(matrix2, point22) {
266214
266221
  function isUndefined4(val) {
266215
266222
  return typeof val === "undefined";
266216
266223
  }
266217
- function translate9(tx2, ty2 = 0) {
266224
+ function translate10(tx2, ty2 = 0) {
266218
266225
  return {
266219
266226
  a: 1,
266220
266227
  c: 0,
@@ -266250,10 +266257,10 @@ function transform3(...matrices) {
266250
266257
  }
266251
266258
  }
266252
266259
  }
266253
- function compose9(...matrices) {
266260
+ function compose10(...matrices) {
266254
266261
  return transform3(...matrices);
266255
266262
  }
266256
- function scale8(sx2, sy2 = undefined, cx2 = undefined, cy2 = undefined) {
266263
+ function scale9(sx2, sy2 = undefined, cx2 = undefined, cy2 = undefined) {
266257
266264
  if (isUndefined4(sy2))
266258
266265
  sy2 = sx2;
266259
266266
  const scaleMatrix = {
@@ -266268,9 +266275,9 @@ function scale8(sx2, sy2 = undefined, cx2 = undefined, cy2 = undefined) {
266268
266275
  return scaleMatrix;
266269
266276
  }
266270
266277
  return transform3([
266271
- translate9(cx2, cy2),
266278
+ translate10(cx2, cy2),
266272
266279
  scaleMatrix,
266273
- translate9(-cx2, -cy2)
266280
+ translate10(-cx2, -cy2)
266274
266281
  ]);
266275
266282
  }
266276
266283
  function peg$subclass3(child, parent) {
@@ -266404,12 +266411,12 @@ peg$SyntaxError3.buildMessage = function(expected, found) {
266404
266411
  function decomposeTSR3(matrix2, flipX = false, flipY2 = false) {
266405
266412
  if (flipX) {
266406
266413
  if (flipY2) {
266407
- matrix2 = compose9(matrix2, scale8(-1, -1));
266414
+ matrix2 = compose10(matrix2, scale9(-1, -1));
266408
266415
  } else {
266409
- matrix2 = compose9(matrix2, scale8(1, -1));
266416
+ matrix2 = compose10(matrix2, scale9(1, -1));
266410
266417
  }
266411
266418
  } else if (flipY2) {
266412
- matrix2 = compose9(matrix2, scale8(-1, 1));
266419
+ matrix2 = compose10(matrix2, scale9(-1, 1));
266413
266420
  }
266414
266421
  const a2 = matrix2.a;
266415
266422
  const b = matrix2.b;
@@ -267165,7 +267172,7 @@ var transformPCBElement3 = (elm, matrix2) => {
267165
267172
  const tsr = decomposeTSR3(matrix2);
267166
267173
  const flipPadWidthHeight = Math.round(tsr.rotation.angle / (Math.PI / 2)) % 2 === 1;
267167
267174
  if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
267168
- const { x: x3, y: y4 } = applyToPoint27(matrix2, {
267175
+ const { x: x3, y: y4 } = applyToPoint26(matrix2, {
267169
267176
  x: Number(elm.x),
267170
267177
  y: Number(elm.y)
267171
267178
  });
@@ -267173,7 +267180,7 @@ var transformPCBElement3 = (elm, matrix2) => {
267173
267180
  elm.y = y4;
267174
267181
  if (elm.type === "pcb_smtpad" && elm.shape === "polygon" && Array.isArray(elm.points)) {
267175
267182
  elm.points = elm.points.map((point22) => {
267176
- const tp3 = applyToPoint27(matrix2, { x: point22.x, y: point22.y });
267183
+ const tp3 = applyToPoint26(matrix2, { x: point22.x, y: point22.y });
267177
267184
  return {
267178
267185
  x: tp3.x,
267179
267186
  y: tp3.y
@@ -267181,13 +267188,13 @@ var transformPCBElement3 = (elm, matrix2) => {
267181
267188
  });
267182
267189
  }
267183
267190
  } else if (elm.type === "pcb_keepout" || elm.type === "pcb_board") {
267184
- elm.center = applyToPoint27(matrix2, elm.center);
267191
+ elm.center = applyToPoint26(matrix2, elm.center);
267185
267192
  } else if (elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text" || elm.type === "pcb_note_text") {
267186
- elm.anchor_position = applyToPoint27(matrix2, elm.anchor_position);
267193
+ elm.anchor_position = applyToPoint26(matrix2, elm.anchor_position);
267187
267194
  } else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_note_rect" || elm.type === "pcb_courtyard_rect" || elm.type === "pcb_courtyard_circle") {
267188
- elm.center = applyToPoint27(matrix2, elm.center);
267195
+ elm.center = applyToPoint26(matrix2, elm.center);
267189
267196
  } else if (elm.type === "pcb_component") {
267190
- elm.center = applyToPoint27(matrix2, elm.center);
267197
+ elm.center = applyToPoint26(matrix2, elm.center);
267191
267198
  elm.rotation = elm.rotation + tsr.rotation.angle / Math.PI * 180;
267192
267199
  elm.rotation = elm.rotation % 360;
267193
267200
  if (flipPadWidthHeight) {
@@ -267195,21 +267202,21 @@ var transformPCBElement3 = (elm, matrix2) => {
267195
267202
  }
267196
267203
  } else if (elm.type === "pcb_courtyard_outline") {
267197
267204
  elm.outline = elm.outline.map((p3) => {
267198
- const tp3 = applyToPoint27(matrix2, p3);
267205
+ const tp3 = applyToPoint26(matrix2, p3);
267199
267206
  p3.x = tp3.x;
267200
267207
  p3.y = tp3.y;
267201
267208
  return p3;
267202
267209
  });
267203
267210
  } else if (elm.type === "pcb_courtyard_polygon") {
267204
267211
  elm.points = elm.points.map((p3) => {
267205
- const tp3 = applyToPoint27(matrix2, p3);
267212
+ const tp3 = applyToPoint26(matrix2, p3);
267206
267213
  p3.x = tp3.x;
267207
267214
  p3.y = tp3.y;
267208
267215
  return p3;
267209
267216
  });
267210
267217
  } else if (elm.type === "pcb_silkscreen_path" || elm.type === "pcb_trace" || elm.type === "pcb_fabrication_note_path" || elm.type === "pcb_note_path") {
267211
267218
  elm.route = elm.route.map((rp3) => {
267212
- const tp3 = applyToPoint27(matrix2, rp3);
267219
+ const tp3 = applyToPoint26(matrix2, rp3);
267213
267220
  rp3.x = tp3.x;
267214
267221
  rp3.y = tp3.y;
267215
267222
  return rp3;
@@ -267217,14 +267224,14 @@ var transformPCBElement3 = (elm, matrix2) => {
267217
267224
  } else if (elm.type === "pcb_silkscreen_line" || elm.type === "pcb_note_line") {
267218
267225
  const p12 = { x: elm.x1, y: elm.y1 };
267219
267226
  const p23 = { x: elm.x2, y: elm.y2 };
267220
- const p1t = applyToPoint27(matrix2, p12);
267221
- const p2t = applyToPoint27(matrix2, p23);
267227
+ const p1t = applyToPoint26(matrix2, p12);
267228
+ const p2t = applyToPoint26(matrix2, p23);
267222
267229
  elm.x1 = p1t.x;
267223
267230
  elm.y1 = p1t.y;
267224
267231
  elm.x2 = p2t.x;
267225
267232
  elm.y2 = p2t.y;
267226
267233
  } else if (elm.type === "cad_component") {
267227
- const newPos = applyToPoint27(matrix2, {
267234
+ const newPos = applyToPoint26(matrix2, {
267228
267235
  x: elm.position.x,
267229
267236
  y: elm.position.y
267230
267237
  });
@@ -268010,21 +268017,21 @@ var convertEasyEdaJsonToCircuitJson2 = (easyEdaJson, {
268010
268017
  const elementsForBounds = circuitElements.filter((e4) => e4.type !== "pcb_component" && e4.type !== "cad_component");
268011
268018
  const bounds = findBoundsAndCenter3(elementsForBounds);
268012
268019
  if (Number.isFinite(bounds.center.x) && Number.isFinite(bounds.center.y)) {
268013
- const matrix2 = compose9(translate9(-bounds.center.x, bounds.center.y), scale8(1, -1));
268020
+ const matrix2 = compose10(translate10(-bounds.center.x, bounds.center.y), scale9(1, -1));
268014
268021
  const elementsForTransform = circuitElements.filter((e4) => !(e4.type === "pcb_smtpad" && e4.shape === "polygon") && e4.type !== "cad_component");
268015
268022
  transformPCBElements3(elementsForTransform, matrix2);
268016
268023
  for (const e4 of circuitElements) {
268017
268024
  if (e4.type === "pcb_cutout") {
268018
268025
  if (e4.shape === "polygon") {
268019
- e4.points = e4.points.map((p3) => applyToPoint27(matrix2, p3));
268026
+ e4.points = e4.points.map((p3) => applyToPoint26(matrix2, p3));
268020
268027
  } else if (e4.shape === "circle" || e4.shape === "rect") {
268021
- e4.center = applyToPoint27(matrix2, e4.center);
268028
+ e4.center = applyToPoint26(matrix2, e4.center);
268022
268029
  } else if ("route" in e4) {
268023
268030
  const cutoutPath = e4;
268024
- cutoutPath.route = cutoutPath.route.map((p3) => applyToPoint27(matrix2, p3));
268031
+ cutoutPath.route = cutoutPath.route.map((p3) => applyToPoint26(matrix2, p3));
268025
268032
  }
268026
268033
  } else if (e4.type === "pcb_smtpad" && e4.shape === "polygon") {
268027
- e4.points = e4.points.map((p3) => applyToPoint27(matrix2, p3));
268034
+ e4.points = e4.points.map((p3) => applyToPoint26(matrix2, p3));
268028
268035
  }
268029
268036
  }
268030
268037
  const cad = circuitElements.find((e4) => e4.type === "cad_component");