@tscircuit/3d-viewer 0.0.367 → 0.0.369

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +515 -411
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -14228,15 +14228,15 @@ var require_browser = __commonJS({
14228
14228
  });
14229
14229
 
14230
14230
  // src/CadViewer.tsx
14231
- import { useState as useState15, useCallback as useCallback8, useRef as useRef9, useEffect as useEffect22 } from "react";
14231
+ import { useState as useState16, useCallback as useCallback8, useRef as useRef9, useEffect as useEffect23 } from "react";
14232
14232
 
14233
14233
  // src/CadViewerJscad.tsx
14234
14234
  import { su as su4 } from "@tscircuit/circuit-json-util";
14235
- import { forwardRef as forwardRef3, useMemo as useMemo16 } from "react";
14235
+ import { forwardRef as forwardRef3, useMemo as useMemo17 } from "react";
14236
14236
 
14237
14237
  // src/AnyCadComponent.tsx
14238
14238
  import { su } from "@tscircuit/circuit-json-util";
14239
- import { useMemo as useMemo5, useState as useState4, useCallback as useCallback2 } from "react";
14239
+ import { useMemo as useMemo6, useState as useState5, useCallback as useCallback2 } from "react";
14240
14240
 
14241
14241
  // src/ContainerWithTooltip.tsx
14242
14242
  import { useEffect as useEffect2 } from "react";
@@ -14567,6 +14567,85 @@ function MixedStlModel({
14567
14567
  );
14568
14568
  }
14569
14569
 
14570
+ // src/three-components/GltfModel.tsx
14571
+ import { useState as useState3, useEffect as useEffect5 } from "react";
14572
+ import * as THREE3 from "three";
14573
+ import { GLTFLoader } from "three-stdlib";
14574
+ import { jsx as jsx4 } from "react/jsx-runtime";
14575
+ function GltfModel({
14576
+ gltfUrl,
14577
+ position,
14578
+ rotation: rotation2,
14579
+ onHover,
14580
+ onUnhover,
14581
+ isHovered
14582
+ }) {
14583
+ const { rootObject } = useThree();
14584
+ const [model, setModel] = useState3(null);
14585
+ useEffect5(() => {
14586
+ if (!gltfUrl) return;
14587
+ const loader = new GLTFLoader();
14588
+ let isMounted = true;
14589
+ loader.load(
14590
+ gltfUrl,
14591
+ (gltf) => {
14592
+ if (isMounted) setModel(gltf.scene);
14593
+ },
14594
+ void 0,
14595
+ (error) => {
14596
+ if (isMounted)
14597
+ console.error(`An error happened loading ${gltfUrl}`, error);
14598
+ }
14599
+ );
14600
+ return () => {
14601
+ isMounted = false;
14602
+ };
14603
+ }, [gltfUrl]);
14604
+ useEffect5(() => {
14605
+ if (!model) return;
14606
+ if (position) model.position.fromArray(position);
14607
+ if (rotation2) model.rotation.fromArray(rotation2);
14608
+ }, [
14609
+ model,
14610
+ position?.[0],
14611
+ position?.[1],
14612
+ position?.[2],
14613
+ rotation2?.[0],
14614
+ rotation2?.[1],
14615
+ rotation2?.[2]
14616
+ ]);
14617
+ useEffect5(() => {
14618
+ if (!rootObject || !model) return;
14619
+ rootObject.add(model);
14620
+ return () => {
14621
+ rootObject.remove(model);
14622
+ };
14623
+ }, [rootObject, model]);
14624
+ useEffect5(() => {
14625
+ if (!model) return;
14626
+ model.traverse((child) => {
14627
+ if (child instanceof THREE3.Mesh && child.material instanceof THREE3.MeshStandardMaterial) {
14628
+ if (isHovered) {
14629
+ child.material.emissive.setHex(255);
14630
+ child.material.emissiveIntensity = 0.2;
14631
+ } else {
14632
+ child.material.emissiveIntensity = 0;
14633
+ }
14634
+ }
14635
+ });
14636
+ }, [isHovered, model]);
14637
+ if (!model) return null;
14638
+ return /* @__PURE__ */ jsx4(
14639
+ ContainerWithTooltip_default,
14640
+ {
14641
+ isHovered,
14642
+ onHover,
14643
+ onUnhover,
14644
+ object: model
14645
+ }
14646
+ );
14647
+ }
14648
+
14570
14649
  // src/three-components/JscadModel.tsx
14571
14650
  var import_jscad_planner = __toESM(require_dist(), 1);
14572
14651
  var import_modeling2 = __toESM(require_src(), 1);
@@ -16471,6 +16550,7 @@ var cad_component = z98.object({
16471
16550
  model_obj_url: z98.string().optional(),
16472
16551
  model_stl_url: z98.string().optional(),
16473
16552
  model_3mf_url: z98.string().optional(),
16553
+ model_gltf_url: z98.string().optional(),
16474
16554
  model_jscad: z98.any().optional()
16475
16555
  }).describe("Defines a component on the PCB");
16476
16556
  expectTypesMatch(true);
@@ -23669,7 +23749,7 @@ var Colorize = Symbol("Colorize");
23669
23749
  var Polygon = Symbol("Polygon");
23670
23750
  var ExtrudeLinear = Symbol("ExtrudeLinear");
23671
23751
  var Fragment22 = Fragment2;
23672
- var jsx4 = (type, props, _key) => h(type, props);
23752
+ var jsx5 = (type, props, _key) => h(type, props);
23673
23753
  var jsxs = (type, props, _key) => h(type, props);
23674
23754
  var ChipBody = ({
23675
23755
  center,
@@ -23678,7 +23758,7 @@ var ChipBody = ({
23678
23758
  height: height10,
23679
23759
  heightAboveSurface: heightAboveSurface2 = 0.15
23680
23760
  }) => {
23681
- return /* @__PURE__ */ jsx4(Colorize, { color: "#555", children: /* @__PURE__ */ jsx4(Translate, { offset: center, children: /* @__PURE__ */ jsx4(Translate, { offset: { x: 0, y: 0, z: height10 / 2 + heightAboveSurface2 }, children: /* @__PURE__ */ jsx4(RoundedCuboid, { roundRadius: 0.2, size: [width10, length2, height10] }) }) }) });
23761
+ return /* @__PURE__ */ jsx5(Colorize, { color: "#555", children: /* @__PURE__ */ jsx5(Translate, { offset: center, children: /* @__PURE__ */ jsx5(Translate, { offset: { x: 0, y: 0, z: height10 / 2 + heightAboveSurface2 }, children: /* @__PURE__ */ jsx5(RoundedCuboid, { roundRadius: 0.2, size: [width10, length2, height10] }) }) }) });
23682
23762
  };
23683
23763
  var range = (end) => Array.from({ length: end }, (_, i) => i);
23684
23764
  function getExpandedStroke(strokeInput, width10) {
@@ -23767,8 +23847,8 @@ var heightAboveSurface = 0.5;
23767
23847
  var DipPinLeg = ({ x, y, z: z102 }) => {
23768
23848
  const isRotated = x > 0;
23769
23849
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
23770
- /* @__PURE__ */ jsx4(Translate, { offset: { x: x + 0.25 / 2, y, z: z102 }, children: /* @__PURE__ */ jsx4(Rotate, { rotation: ["-90deg", 0, "90deg"], children: /* @__PURE__ */ jsx4(ExtrudeLinear, { height: 0.25, children: /* @__PURE__ */ jsx4(Polygon, { points: svgPathPoints.map((p) => [p.x, p.y]) }) }) }) }),
23771
- /* @__PURE__ */ jsx4(
23850
+ /* @__PURE__ */ jsx5(Translate, { offset: { x: x + 0.25 / 2, y, z: z102 }, children: /* @__PURE__ */ jsx5(Rotate, { rotation: ["-90deg", 0, "90deg"], children: /* @__PURE__ */ jsx5(ExtrudeLinear, { height: 0.25, children: /* @__PURE__ */ jsx5(Polygon, { points: svgPathPoints.map((p) => [p.x, p.y]) }) }) }) }),
23851
+ /* @__PURE__ */ jsx5(
23772
23852
  Translate,
23773
23853
  {
23774
23854
  offset: {
@@ -23776,7 +23856,7 @@ var DipPinLeg = ({ x, y, z: z102 }) => {
23776
23856
  y: y + (isRotated ? 1 : -1),
23777
23857
  z: z102
23778
23858
  },
23779
- children: /* @__PURE__ */ jsx4(Rotate, { rotation: ["-90deg", "90deg", isRotated ? "180deg" : "0deg"], children: /* @__PURE__ */ jsx4(ExtrudeLinear, { height: 2, children: /* @__PURE__ */ jsx4(
23859
+ children: /* @__PURE__ */ jsx5(Rotate, { rotation: ["-90deg", "90deg", isRotated ? "180deg" : "0deg"], children: /* @__PURE__ */ jsx5(ExtrudeLinear, { height: 2, children: /* @__PURE__ */ jsx5(
23780
23860
  Polygon,
23781
23861
  {
23782
23862
  points: getExpandedStroke(
@@ -23804,7 +23884,7 @@ var Dip = ({
23804
23884
  range(numPins).map((i) => {
23805
23885
  const yRow = i % numPinsOnEachSide;
23806
23886
  const xRow = (Math.floor(i / numPinsOnEachSide) - 0.5) * 2;
23807
- return /* @__PURE__ */ jsx4(
23887
+ return /* @__PURE__ */ jsx5(
23808
23888
  DipPinLeg,
23809
23889
  {
23810
23890
  x: xRow * crossBodyPinWidth / 2,
@@ -23814,7 +23894,7 @@ var Dip = ({
23814
23894
  i
23815
23895
  );
23816
23896
  }),
23817
- /* @__PURE__ */ jsx4(
23897
+ /* @__PURE__ */ jsx5(
23818
23898
  ChipBody,
23819
23899
  {
23820
23900
  width: bodyWidth,
@@ -23851,7 +23931,7 @@ var SmdChipLead = (props) => {
23851
23931
  const N = 15;
23852
23932
  const points = Array.from({ length: N }).map((_, i) => i / (N - 1) * bodyDistance).map((x) => [x, calculateSCurve(x, props)]);
23853
23933
  const polygon2 = getExpandedStroke(points, thickness);
23854
- return /* @__PURE__ */ jsx4(Colorize, { color: "#fff", children: /* @__PURE__ */ jsx4(Translate, { offset: { z: 0, y: 0, x: 0, ...props.position }, children: /* @__PURE__ */ jsx4(Rotate, { rotation: ["90deg", 0, rotation2 ?? 0], children: /* @__PURE__ */ jsx4(Translate, { offset: { x: 0, y: 0, z: -width10 / 2 }, children: /* @__PURE__ */ jsx4(ExtrudeLinear, { height: width10, children: /* @__PURE__ */ jsx4(Polygon, { points: polygon2.map((p) => [p.x, p.y]) }) }) }) }) }) });
23934
+ return /* @__PURE__ */ jsx5(Colorize, { color: "#fff", children: /* @__PURE__ */ jsx5(Translate, { offset: { z: 0, y: 0, x: 0, ...props.position }, children: /* @__PURE__ */ jsx5(Rotate, { rotation: ["90deg", 0, rotation2 ?? 0], children: /* @__PURE__ */ jsx5(Translate, { offset: { x: 0, y: 0, z: -width10 / 2 }, children: /* @__PURE__ */ jsx5(ExtrudeLinear, { height: width10, children: /* @__PURE__ */ jsx5(Polygon, { points: polygon2.map((p) => [p.x, p.y]) }) }) }) }) }) });
23855
23935
  };
23856
23936
  var Tssop = ({
23857
23937
  pinCount,
@@ -23865,7 +23945,7 @@ var Tssop = ({
23865
23945
  const pinOffsetToCenter = (sidePinCount - 1) * pitch / 2;
23866
23946
  const leadThickness = 0.25;
23867
23947
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
23868
- Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx4(
23948
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
23869
23949
  SmdChipLead,
23870
23950
  {
23871
23951
  position: {
@@ -23881,7 +23961,7 @@ var Tssop = ({
23881
23961
  },
23882
23962
  i
23883
23963
  )),
23884
- Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx4(
23964
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
23885
23965
  SmdChipLead,
23886
23966
  {
23887
23967
  rotation: Math.PI,
@@ -23898,7 +23978,7 @@ var Tssop = ({
23898
23978
  },
23899
23979
  i
23900
23980
  )),
23901
- /* @__PURE__ */ jsx4(
23981
+ /* @__PURE__ */ jsx5(
23902
23982
  ChipBody,
23903
23983
  {
23904
23984
  center: { x: 0, y: 0, z: leadThickness / 2 },
@@ -23916,7 +23996,7 @@ var terminatorWidth = 0.2;
23916
23996
  var bodyLength = fullLength - terminatorWidth * 2;
23917
23997
  var A0402 = ({ color = "#333" }) => {
23918
23998
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
23919
- /* @__PURE__ */ jsx4(
23999
+ /* @__PURE__ */ jsx5(
23920
24000
  Cuboid,
23921
24001
  {
23922
24002
  size: [bodyLength, width, height],
@@ -23924,7 +24004,7 @@ var A0402 = ({ color = "#333" }) => {
23924
24004
  color
23925
24005
  }
23926
24006
  ),
23927
- /* @__PURE__ */ jsx4(
24007
+ /* @__PURE__ */ jsx5(
23928
24008
  Cuboid,
23929
24009
  {
23930
24010
  size: [terminatorWidth, height, width],
@@ -23932,7 +24012,7 @@ var A0402 = ({ color = "#333" }) => {
23932
24012
  color: "#ccc"
23933
24013
  }
23934
24014
  ),
23935
- /* @__PURE__ */ jsx4(
24015
+ /* @__PURE__ */ jsx5(
23936
24016
  Cuboid,
23937
24017
  {
23938
24018
  size: [terminatorWidth, height, width],
@@ -23949,7 +24029,7 @@ var width2 = 0.85;
23949
24029
  var height2 = 0.6;
23950
24030
  var A0603 = ({ color = "#333" }) => {
23951
24031
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
23952
- /* @__PURE__ */ jsx4(
24032
+ /* @__PURE__ */ jsx5(
23953
24033
  Cuboid,
23954
24034
  {
23955
24035
  size: [bodyLength2, width2, height2],
@@ -23957,7 +24037,7 @@ var A0603 = ({ color = "#333" }) => {
23957
24037
  color
23958
24038
  }
23959
24039
  ),
23960
- /* @__PURE__ */ jsx4(
24040
+ /* @__PURE__ */ jsx5(
23961
24041
  Cuboid,
23962
24042
  {
23963
24043
  size: [terminatorLength, width2, height2],
@@ -23965,7 +24045,7 @@ var A0603 = ({ color = "#333" }) => {
23965
24045
  color: "#ccc"
23966
24046
  }
23967
24047
  ),
23968
- /* @__PURE__ */ jsx4(
24048
+ /* @__PURE__ */ jsx5(
23969
24049
  Cuboid,
23970
24050
  {
23971
24051
  size: [terminatorLength, width2, height2],
@@ -23982,7 +24062,7 @@ var terminatorWidth2 = 0.5;
23982
24062
  var bodyLength3 = fullLength3 - terminatorWidth2 * 2;
23983
24063
  var A0805 = ({ color = "#333" }) => {
23984
24064
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
23985
- /* @__PURE__ */ jsx4(
24065
+ /* @__PURE__ */ jsx5(
23986
24066
  Cuboid,
23987
24067
  {
23988
24068
  size: [bodyLength3, width3, height3],
@@ -23990,7 +24070,7 @@ var A0805 = ({ color = "#333" }) => {
23990
24070
  color
23991
24071
  }
23992
24072
  ),
23993
- /* @__PURE__ */ jsx4(
24073
+ /* @__PURE__ */ jsx5(
23994
24074
  Cuboid,
23995
24075
  {
23996
24076
  size: [terminatorWidth2, width3, height3],
@@ -23998,7 +24078,7 @@ var A0805 = ({ color = "#333" }) => {
23998
24078
  color: "#ccc"
23999
24079
  }
24000
24080
  ),
24001
- /* @__PURE__ */ jsx4(
24081
+ /* @__PURE__ */ jsx5(
24002
24082
  Cuboid,
24003
24083
  {
24004
24084
  size: [terminatorWidth2, width3, height3],
@@ -24028,7 +24108,7 @@ var QFP = ({
24028
24108
  const leadThickness = 0.15;
24029
24109
  const bodyDistance = (fullWidth - bodyWidth) / 2;
24030
24110
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
24031
- Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx4(
24111
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
24032
24112
  SmdChipLead,
24033
24113
  {
24034
24114
  position: {
@@ -24044,7 +24124,7 @@ var QFP = ({
24044
24124
  },
24045
24125
  `left-${i}`
24046
24126
  )),
24047
- Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx4(
24127
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
24048
24128
  SmdChipLead,
24049
24129
  {
24050
24130
  rotation: Math.PI,
@@ -24061,7 +24141,7 @@ var QFP = ({
24061
24141
  },
24062
24142
  `right-${i}`
24063
24143
  )),
24064
- Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx4(
24144
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
24065
24145
  SmdChipLead,
24066
24146
  {
24067
24147
  rotation: Math.PI / 2,
@@ -24078,7 +24158,7 @@ var QFP = ({
24078
24158
  },
24079
24159
  `bottom-${i}`
24080
24160
  )),
24081
- Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx4(
24161
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
24082
24162
  SmdChipLead,
24083
24163
  {
24084
24164
  rotation: -Math.PI / 2,
@@ -24095,7 +24175,7 @@ var QFP = ({
24095
24175
  },
24096
24176
  `top-${i}`
24097
24177
  )),
24098
- /* @__PURE__ */ jsx4(
24178
+ /* @__PURE__ */ jsx5(
24099
24179
  ChipBody,
24100
24180
  {
24101
24181
  center: { x: 0, y: 0, z: leadThickness / 2 },
@@ -24155,7 +24235,7 @@ var PinRow = ({
24155
24235
  const shortSidePinLength = 3;
24156
24236
  const xoff = -((numberOfPins - 1) / 2) * pitch;
24157
24237
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
24158
- /* @__PURE__ */ jsx4(
24238
+ /* @__PURE__ */ jsx5(
24159
24239
  Cuboid,
24160
24240
  {
24161
24241
  color: "#222",
@@ -24164,8 +24244,8 @@ var PinRow = ({
24164
24244
  }
24165
24245
  ),
24166
24246
  Array.from({ length: numberOfPins }, (_, i) => /* @__PURE__ */ jsxs(Fragment22, { children: [
24167
- /* @__PURE__ */ jsx4(Colorize, { color: "gold", children: /* @__PURE__ */ jsxs(Hull, { children: [
24168
- /* @__PURE__ */ jsx4(
24247
+ /* @__PURE__ */ jsx5(Colorize, { color: "gold", children: /* @__PURE__ */ jsxs(Hull, { children: [
24248
+ /* @__PURE__ */ jsx5(
24169
24249
  Cuboid,
24170
24250
  {
24171
24251
  color: "gold",
@@ -24177,7 +24257,7 @@ var PinRow = ({
24177
24257
  ]
24178
24258
  }
24179
24259
  ),
24180
- /* @__PURE__ */ jsx4(
24260
+ /* @__PURE__ */ jsx5(
24181
24261
  Cuboid,
24182
24262
  {
24183
24263
  color: "gold",
@@ -24190,8 +24270,8 @@ var PinRow = ({
24190
24270
  }
24191
24271
  )
24192
24272
  ] }) }),
24193
- /* @__PURE__ */ jsx4(Colorize, { color: "gold", children: /* @__PURE__ */ jsxs(Hull, { children: [
24194
- /* @__PURE__ */ jsx4(
24273
+ /* @__PURE__ */ jsx5(Colorize, { color: "gold", children: /* @__PURE__ */ jsxs(Hull, { children: [
24274
+ /* @__PURE__ */ jsx5(
24195
24275
  Cuboid,
24196
24276
  {
24197
24277
  color: "gold",
@@ -24199,7 +24279,7 @@ var PinRow = ({
24199
24279
  center: [xoff + i * pitch, 0, -longSidePinLength / 2 * 0.9]
24200
24280
  }
24201
24281
  ),
24202
- /* @__PURE__ */ jsx4(
24282
+ /* @__PURE__ */ jsx5(
24203
24283
  Cuboid,
24204
24284
  {
24205
24285
  color: "gold",
@@ -24340,14 +24420,14 @@ var QFN = ({
24340
24420
  pinPositions.push({ pn, x, y, pw, pl });
24341
24421
  }
24342
24422
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
24343
- /* @__PURE__ */ jsx4(Colorize, { color: "grey", children: /* @__PURE__ */ jsx4(
24423
+ /* @__PURE__ */ jsx5(Colorize, { color: "grey", children: /* @__PURE__ */ jsx5(
24344
24424
  Cuboid,
24345
24425
  {
24346
24426
  center: { x: 0, y: 0, z: bodyThickness / 2 },
24347
24427
  size: [bodyWidth, bodyLength10, bodyThickness]
24348
24428
  }
24349
24429
  ) }),
24350
- pinPositions.map((p, i) => /* @__PURE__ */ jsx4(
24430
+ pinPositions.map((p, i) => /* @__PURE__ */ jsx5(
24351
24431
  Cuboid,
24352
24432
  {
24353
24433
  center: { x: p.x, y: p.y, z: thermalPadThickness / 2 },
@@ -24355,7 +24435,7 @@ var QFN = ({
24355
24435
  },
24356
24436
  i
24357
24437
  )),
24358
- thermalPadSize?.length !== void 0 && thermalPadSize?.width !== void 0 && /* @__PURE__ */ jsx4(
24438
+ thermalPadSize?.length !== void 0 && thermalPadSize?.width !== void 0 && /* @__PURE__ */ jsx5(
24359
24439
  Cuboid,
24360
24440
  {
24361
24441
  center: { x: 0, y: 0, z: thermalPadThickness / 2 },
@@ -24381,7 +24461,7 @@ var SOT235 = () => {
24381
24461
  const padPitch = 0.95;
24382
24462
  const extendedBodyDistance = fullWidth - bodyWidth;
24383
24463
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
24384
- /* @__PURE__ */ jsx4(
24464
+ /* @__PURE__ */ jsx5(
24385
24465
  SmdChipLead,
24386
24466
  {
24387
24467
  rotation: Math.PI,
@@ -24398,7 +24478,7 @@ var SOT235 = () => {
24398
24478
  },
24399
24479
  1
24400
24480
  ),
24401
- /* @__PURE__ */ jsx4(
24481
+ /* @__PURE__ */ jsx5(
24402
24482
  SmdChipLead,
24403
24483
  {
24404
24484
  rotation: Math.PI,
@@ -24415,7 +24495,7 @@ var SOT235 = () => {
24415
24495
  },
24416
24496
  2
24417
24497
  ),
24418
- /* @__PURE__ */ jsx4(
24498
+ /* @__PURE__ */ jsx5(
24419
24499
  SmdChipLead,
24420
24500
  {
24421
24501
  position: {
@@ -24431,7 +24511,7 @@ var SOT235 = () => {
24431
24511
  },
24432
24512
  3
24433
24513
  ),
24434
- /* @__PURE__ */ jsx4(
24514
+ /* @__PURE__ */ jsx5(
24435
24515
  SmdChipLead,
24436
24516
  {
24437
24517
  position: {
@@ -24447,7 +24527,7 @@ var SOT235 = () => {
24447
24527
  },
24448
24528
  1
24449
24529
  ),
24450
- /* @__PURE__ */ jsx4(
24530
+ /* @__PURE__ */ jsx5(
24451
24531
  SmdChipLead,
24452
24532
  {
24453
24533
  position: {
@@ -24463,7 +24543,7 @@ var SOT235 = () => {
24463
24543
  },
24464
24544
  2
24465
24545
  ),
24466
- /* @__PURE__ */ jsx4(
24546
+ /* @__PURE__ */ jsx5(
24467
24547
  ChipBody,
24468
24548
  {
24469
24549
  center: { x: 0, y: 0, z: 0 },
@@ -24482,7 +24562,7 @@ var terminatorWidth3 = 0.1;
24482
24562
  var bodyLength4 = fullLength4 - terminatorWidth3 * 2;
24483
24563
  var A0201 = ({ color = "#333" }) => {
24484
24564
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
24485
- /* @__PURE__ */ jsx4(
24565
+ /* @__PURE__ */ jsx5(
24486
24566
  Cuboid,
24487
24567
  {
24488
24568
  size: [bodyLength4, width4, height4],
@@ -24490,7 +24570,7 @@ var A0201 = ({ color = "#333" }) => {
24490
24570
  color
24491
24571
  }
24492
24572
  ),
24493
- /* @__PURE__ */ jsx4(
24573
+ /* @__PURE__ */ jsx5(
24494
24574
  Cuboid,
24495
24575
  {
24496
24576
  size: [terminatorWidth3, width4, height4],
@@ -24498,7 +24578,7 @@ var A0201 = ({ color = "#333" }) => {
24498
24578
  color: "#ccc"
24499
24579
  }
24500
24580
  ),
24501
- /* @__PURE__ */ jsx4(
24581
+ /* @__PURE__ */ jsx5(
24502
24582
  Cuboid,
24503
24583
  {
24504
24584
  size: [terminatorWidth3, width4, height4],
@@ -24515,7 +24595,7 @@ var terminatorWidth4 = 0.07;
24515
24595
  var bodyLength5 = fullLength5 - terminatorWidth4 * 2;
24516
24596
  var A01005 = ({ color = "#333" }) => {
24517
24597
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
24518
- /* @__PURE__ */ jsx4(
24598
+ /* @__PURE__ */ jsx5(
24519
24599
  Cuboid,
24520
24600
  {
24521
24601
  size: [bodyLength5, width5, height5],
@@ -24523,7 +24603,7 @@ var A01005 = ({ color = "#333" }) => {
24523
24603
  color
24524
24604
  }
24525
24605
  ),
24526
- /* @__PURE__ */ jsx4(
24606
+ /* @__PURE__ */ jsx5(
24527
24607
  Cuboid,
24528
24608
  {
24529
24609
  size: [terminatorWidth4, width5, height5],
@@ -24531,7 +24611,7 @@ var A01005 = ({ color = "#333" }) => {
24531
24611
  color: "#ccc"
24532
24612
  }
24533
24613
  ),
24534
- /* @__PURE__ */ jsx4(
24614
+ /* @__PURE__ */ jsx5(
24535
24615
  Cuboid,
24536
24616
  {
24537
24617
  size: [terminatorWidth4, width5, height5],
@@ -24548,7 +24628,7 @@ var terminatorWidth5 = 0.5;
24548
24628
  var bodyLength6 = fullLength6 - terminatorWidth5 * 2;
24549
24629
  var A1206 = ({ color = "#333" }) => {
24550
24630
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
24551
- /* @__PURE__ */ jsx4(
24631
+ /* @__PURE__ */ jsx5(
24552
24632
  Cuboid,
24553
24633
  {
24554
24634
  size: [bodyLength6, width6, height6],
@@ -24556,7 +24636,7 @@ var A1206 = ({ color = "#333" }) => {
24556
24636
  color
24557
24637
  }
24558
24638
  ),
24559
- /* @__PURE__ */ jsx4(
24639
+ /* @__PURE__ */ jsx5(
24560
24640
  Cuboid,
24561
24641
  {
24562
24642
  size: [terminatorWidth5, width6, height6],
@@ -24564,7 +24644,7 @@ var A1206 = ({ color = "#333" }) => {
24564
24644
  color: "#ccc"
24565
24645
  }
24566
24646
  ),
24567
- /* @__PURE__ */ jsx4(
24647
+ /* @__PURE__ */ jsx5(
24568
24648
  Cuboid,
24569
24649
  {
24570
24650
  size: [terminatorWidth5, width6, height6],
@@ -24581,7 +24661,7 @@ var terminatorWidth6 = 0.6;
24581
24661
  var bodyLength7 = fullLength7 - terminatorWidth6 * 2;
24582
24662
  var A1210 = ({ color = "#333" }) => {
24583
24663
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
24584
- /* @__PURE__ */ jsx4(
24664
+ /* @__PURE__ */ jsx5(
24585
24665
  Cuboid,
24586
24666
  {
24587
24667
  size: [bodyLength7, width7, height7],
@@ -24589,7 +24669,7 @@ var A1210 = ({ color = "#333" }) => {
24589
24669
  color
24590
24670
  }
24591
24671
  ),
24592
- /* @__PURE__ */ jsx4(
24672
+ /* @__PURE__ */ jsx5(
24593
24673
  Cuboid,
24594
24674
  {
24595
24675
  size: [terminatorWidth6, width7, height7],
@@ -24597,7 +24677,7 @@ var A1210 = ({ color = "#333" }) => {
24597
24677
  color: "#ccc"
24598
24678
  }
24599
24679
  ),
24600
- /* @__PURE__ */ jsx4(
24680
+ /* @__PURE__ */ jsx5(
24601
24681
  Cuboid,
24602
24682
  {
24603
24683
  size: [terminatorWidth6, width7, height7],
@@ -24614,7 +24694,7 @@ var terminatorWidth7 = 0.6;
24614
24694
  var bodyLength8 = fullLength8 - terminatorWidth7 * 2;
24615
24695
  var A2010 = ({ color = "#333" }) => {
24616
24696
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
24617
- /* @__PURE__ */ jsx4(
24697
+ /* @__PURE__ */ jsx5(
24618
24698
  Cuboid,
24619
24699
  {
24620
24700
  size: [bodyLength8, width8, height8],
@@ -24622,7 +24702,7 @@ var A2010 = ({ color = "#333" }) => {
24622
24702
  color
24623
24703
  }
24624
24704
  ),
24625
- /* @__PURE__ */ jsx4(
24705
+ /* @__PURE__ */ jsx5(
24626
24706
  Cuboid,
24627
24707
  {
24628
24708
  size: [terminatorWidth7, width8, height8],
@@ -24630,7 +24710,7 @@ var A2010 = ({ color = "#333" }) => {
24630
24710
  color: "#ccc"
24631
24711
  }
24632
24712
  ),
24633
- /* @__PURE__ */ jsx4(
24713
+ /* @__PURE__ */ jsx5(
24634
24714
  Cuboid,
24635
24715
  {
24636
24716
  size: [terminatorWidth7, width8, height8],
@@ -24647,7 +24727,7 @@ var terminatorWidth8 = 0.8;
24647
24727
  var bodyLength9 = fullLength9 - terminatorWidth8 * 2;
24648
24728
  var A2512 = ({ color = "#333" }) => {
24649
24729
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
24650
- /* @__PURE__ */ jsx4(
24730
+ /* @__PURE__ */ jsx5(
24651
24731
  Cuboid,
24652
24732
  {
24653
24733
  size: [bodyLength9, width9, height9],
@@ -24655,7 +24735,7 @@ var A2512 = ({ color = "#333" }) => {
24655
24735
  color
24656
24736
  }
24657
24737
  ),
24658
- /* @__PURE__ */ jsx4(
24738
+ /* @__PURE__ */ jsx5(
24659
24739
  Cuboid,
24660
24740
  {
24661
24741
  size: [terminatorWidth8, width9, height9],
@@ -24663,7 +24743,7 @@ var A2512 = ({ color = "#333" }) => {
24663
24743
  color: "#ccc"
24664
24744
  }
24665
24745
  ),
24666
- /* @__PURE__ */ jsx4(
24746
+ /* @__PURE__ */ jsx5(
24667
24747
  Cuboid,
24668
24748
  {
24669
24749
  size: [terminatorWidth8, width9, height9],
@@ -24686,8 +24766,8 @@ var FemaleHeader = ({
24686
24766
  const bodyWidth = (numberOfPins - 1) * pitch + outerDiameter + pitch / 2;
24687
24767
  const gapWidth = pinThickness * 1.6;
24688
24768
  const xoff = -((numberOfPins - 1) / 2) * pitch;
24689
- const Body = /* @__PURE__ */ jsx4(Colorize, { color: "#1a1a1a", children: /* @__PURE__ */ jsxs(Subtract, { children: [
24690
- /* @__PURE__ */ jsx4(
24769
+ const Body = /* @__PURE__ */ jsx5(Colorize, { color: "#1a1a1a", children: /* @__PURE__ */ jsxs(Subtract, { children: [
24770
+ /* @__PURE__ */ jsx5(
24691
24771
  Cuboid,
24692
24772
  {
24693
24773
  color: "#000",
@@ -24697,7 +24777,7 @@ var FemaleHeader = ({
24697
24777
  ),
24698
24778
  Array.from(
24699
24779
  { length: numberOfPins },
24700
- (_, i) => innerDiameter ? /* @__PURE__ */ jsx4(
24780
+ (_, i) => innerDiameter ? /* @__PURE__ */ jsx5(
24701
24781
  Cylinder,
24702
24782
  {
24703
24783
  height: bodyHeight + 0.1,
@@ -24706,7 +24786,7 @@ var FemaleHeader = ({
24706
24786
  color: "#222"
24707
24787
  },
24708
24788
  i
24709
- ) : /* @__PURE__ */ jsx4(
24789
+ ) : /* @__PURE__ */ jsx5(
24710
24790
  Cuboid,
24711
24791
  {
24712
24792
  size: [gapWidth, gapWidth, bodyHeight],
@@ -24720,7 +24800,7 @@ var FemaleHeader = ({
24720
24800
  Body,
24721
24801
  Array.from({ length: numberOfPins }, (_, i) => /* @__PURE__ */ jsxs(Colorize, { color: "silver", children: [
24722
24802
  /* @__PURE__ */ jsxs(Hull, { children: [
24723
- /* @__PURE__ */ jsx4(
24803
+ /* @__PURE__ */ jsx5(
24724
24804
  Cuboid,
24725
24805
  {
24726
24806
  color: "silver",
@@ -24728,7 +24808,7 @@ var FemaleHeader = ({
24728
24808
  center: [xoff + i * pitch, 0, -legsLength / 2 * 0.9]
24729
24809
  }
24730
24810
  ),
24731
- /* @__PURE__ */ jsx4(
24811
+ /* @__PURE__ */ jsx5(
24732
24812
  Cuboid,
24733
24813
  {
24734
24814
  color: "silver",
@@ -24737,7 +24817,7 @@ var FemaleHeader = ({
24737
24817
  }
24738
24818
  )
24739
24819
  ] }),
24740
- /* @__PURE__ */ jsx4(
24820
+ /* @__PURE__ */ jsx5(
24741
24821
  Cuboid,
24742
24822
  {
24743
24823
  color: "silver",
@@ -24758,7 +24838,7 @@ var PushButton = ({
24758
24838
  const bodyHeight = width10 * 0.7;
24759
24839
  const legWidth = innerDiameter / 2.5;
24760
24840
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
24761
- /* @__PURE__ */ jsx4(
24841
+ /* @__PURE__ */ jsx5(
24762
24842
  RoundedCuboid,
24763
24843
  {
24764
24844
  color: "#1a1a1f",
@@ -24767,7 +24847,7 @@ var PushButton = ({
24767
24847
  roundRadius: 0.3
24768
24848
  }
24769
24849
  ),
24770
- /* @__PURE__ */ jsx4(
24850
+ /* @__PURE__ */ jsx5(
24771
24851
  RoundedCuboid,
24772
24852
  {
24773
24853
  color: "#f2f2f2",
@@ -24776,7 +24856,7 @@ var PushButton = ({
24776
24856
  roundRadius: 0.14
24777
24857
  }
24778
24858
  ),
24779
- /* @__PURE__ */ jsx4(
24859
+ /* @__PURE__ */ jsx5(
24780
24860
  Cylinder,
24781
24861
  {
24782
24862
  color: "#1a1a1f",
@@ -24785,7 +24865,7 @@ var PushButton = ({
24785
24865
  center: [0, 0, bodyHeight + bodyHeight * 0.8 / 2]
24786
24866
  }
24787
24867
  ),
24788
- /* @__PURE__ */ jsx4(
24868
+ /* @__PURE__ */ jsx5(
24789
24869
  Cylinder,
24790
24870
  {
24791
24871
  color: "#1a1a1f",
@@ -24798,7 +24878,7 @@ var PushButton = ({
24798
24878
  ]
24799
24879
  }
24800
24880
  ),
24801
- /* @__PURE__ */ jsx4(
24881
+ /* @__PURE__ */ jsx5(
24802
24882
  Cylinder,
24803
24883
  {
24804
24884
  color: "#1a1a1f",
@@ -24811,7 +24891,7 @@ var PushButton = ({
24811
24891
  ]
24812
24892
  }
24813
24893
  ),
24814
- /* @__PURE__ */ jsx4(
24894
+ /* @__PURE__ */ jsx5(
24815
24895
  Cylinder,
24816
24896
  {
24817
24897
  color: "#1a1a1f",
@@ -24824,7 +24904,7 @@ var PushButton = ({
24824
24904
  ]
24825
24905
  }
24826
24906
  ),
24827
- /* @__PURE__ */ jsx4(
24907
+ /* @__PURE__ */ jsx5(
24828
24908
  Cylinder,
24829
24909
  {
24830
24910
  color: "#1a1a1f",
@@ -24837,7 +24917,7 @@ var PushButton = ({
24837
24917
  ]
24838
24918
  }
24839
24919
  ),
24840
- /* @__PURE__ */ jsx4(
24920
+ /* @__PURE__ */ jsx5(
24841
24921
  PushButtonLeg,
24842
24922
  {
24843
24923
  thickness: innerDiameter / 3,
@@ -24851,7 +24931,7 @@ var PushButton = ({
24851
24931
  }
24852
24932
  }
24853
24933
  ),
24854
- /* @__PURE__ */ jsx4(
24934
+ /* @__PURE__ */ jsx5(
24855
24935
  PushButtonLeg,
24856
24936
  {
24857
24937
  thickness: innerDiameter / 3,
@@ -24866,7 +24946,7 @@ var PushButton = ({
24866
24946
  rotation: Math.PI
24867
24947
  }
24868
24948
  ),
24869
- /* @__PURE__ */ jsx4(
24949
+ /* @__PURE__ */ jsx5(
24870
24950
  PushButtonLeg,
24871
24951
  {
24872
24952
  thickness: innerDiameter / 3,
@@ -24877,7 +24957,7 @@ var PushButton = ({
24877
24957
  rotation: Math.PI
24878
24958
  }
24879
24959
  ),
24880
- /* @__PURE__ */ jsx4(
24960
+ /* @__PURE__ */ jsx5(
24881
24961
  PushButtonLeg,
24882
24962
  {
24883
24963
  thickness: innerDiameter / 3,
@@ -24909,7 +24989,7 @@ var PushButtonLeg = (props) => {
24909
24989
  [0, 0]
24910
24990
  ];
24911
24991
  const polygon2 = getExpandedStroke(points, thickness);
24912
- return /* @__PURE__ */ jsx4(Colorize, { color: "#f2f2f2", children: /* @__PURE__ */ jsx4(
24992
+ return /* @__PURE__ */ jsx5(Colorize, { color: "#f2f2f2", children: /* @__PURE__ */ jsx5(
24913
24993
  Translate,
24914
24994
  {
24915
24995
  offset: {
@@ -24917,7 +24997,7 @@ var PushButtonLeg = (props) => {
24917
24997
  y: position?.y || 0,
24918
24998
  z: position?.z || 0
24919
24999
  },
24920
- children: /* @__PURE__ */ jsx4(Rotate, { rotation: [0, 55, rotation2], children: /* @__PURE__ */ jsx4(ExtrudeLinear, { height: width10, children: /* @__PURE__ */ jsx4(Polygon, { points: polygon2.map((p) => [p.y, p.x]) }) }) })
25000
+ children: /* @__PURE__ */ jsx5(Rotate, { rotation: [0, 55, rotation2], children: /* @__PURE__ */ jsx5(ExtrudeLinear, { height: width10, children: /* @__PURE__ */ jsx5(Polygon, { points: polygon2.map((p) => [p.y, p.x]) }) }) })
24921
25001
  }
24922
25002
  ) });
24923
25003
  };
@@ -24937,7 +25017,7 @@ var SOIC = ({
24937
25017
  const fullLength10 = pitch * (sidePinCount - 1) + leadWidth + 0.2;
24938
25018
  const bodyWidthAdjusted = bodyWidth * 0.55;
24939
25019
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
24940
- Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx4(
25020
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
24941
25021
  SmdChipLead,
24942
25022
  {
24943
25023
  position: {
@@ -24953,7 +25033,7 @@ var SOIC = ({
24953
25033
  },
24954
25034
  i
24955
25035
  )),
24956
- Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx4(
25036
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
24957
25037
  SmdChipLead,
24958
25038
  {
24959
25039
  rotation: Math.PI,
@@ -24970,7 +25050,7 @@ var SOIC = ({
24970
25050
  },
24971
25051
  i
24972
25052
  )),
24973
- /* @__PURE__ */ jsx4(
25053
+ /* @__PURE__ */ jsx5(
24974
25054
  ChipBody,
24975
25055
  {
24976
25056
  center: { x: 0, y: 0, z: leadThickness / 2 },
@@ -25011,7 +25091,7 @@ var VSSOP = ({
25011
25091
  const leadBodyDistance = (componentFullWidth - _bodyWidth) / 2;
25012
25092
  const padContactLength = leadBodyDistance * 0.5;
25013
25093
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
25014
- Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx4(
25094
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
25015
25095
  SmdChipLead,
25016
25096
  {
25017
25097
  position: {
@@ -25027,7 +25107,7 @@ var VSSOP = ({
25027
25107
  },
25028
25108
  `left-${i}`
25029
25109
  )),
25030
- Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx4(
25110
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
25031
25111
  SmdChipLead,
25032
25112
  {
25033
25113
  rotation: Math.PI,
@@ -25044,7 +25124,7 @@ var VSSOP = ({
25044
25124
  },
25045
25125
  `right-${i}`
25046
25126
  )),
25047
- /* @__PURE__ */ jsx4(
25127
+ /* @__PURE__ */ jsx5(
25048
25128
  ChipBody,
25049
25129
  {
25050
25130
  center: { x: 0, y: 0, z: leadThickness / 2 },
@@ -25059,9 +25139,9 @@ var Footprinter3d = ({ footprint }) => {
25059
25139
  const fpJson = fp.string(footprint).json();
25060
25140
  switch (fpJson.fn) {
25061
25141
  case "dip":
25062
- return /* @__PURE__ */ jsx4(Dip, { numPins: fpJson.num_pins, pitch: fpJson.p, bodyWidth: fpJson.w });
25142
+ return /* @__PURE__ */ jsx5(Dip, { numPins: fpJson.num_pins, pitch: fpJson.p, bodyWidth: fpJson.w });
25063
25143
  case "tssop":
25064
- return /* @__PURE__ */ jsx4(
25144
+ return /* @__PURE__ */ jsx5(
25065
25145
  Tssop,
25066
25146
  {
25067
25147
  pinCount: fpJson.num_pins,
@@ -25072,7 +25152,7 @@ var Footprinter3d = ({ footprint }) => {
25072
25152
  }
25073
25153
  );
25074
25154
  case "vssop":
25075
- return /* @__PURE__ */ jsx4(
25155
+ return /* @__PURE__ */ jsx5(
25076
25156
  VSSOP,
25077
25157
  {
25078
25158
  pinCount: fpJson.num_pins,
@@ -25084,7 +25164,7 @@ var Footprinter3d = ({ footprint }) => {
25084
25164
  }
25085
25165
  );
25086
25166
  case "qfp":
25087
- return /* @__PURE__ */ jsx4(
25167
+ return /* @__PURE__ */ jsx5(
25088
25168
  QFP,
25089
25169
  {
25090
25170
  pinCount: fpJson.num_pins,
@@ -25095,7 +25175,7 @@ var Footprinter3d = ({ footprint }) => {
25095
25175
  }
25096
25176
  );
25097
25177
  case "qfn":
25098
- return /* @__PURE__ */ jsx4(
25178
+ return /* @__PURE__ */ jsx5(
25099
25179
  qfn_default,
25100
25180
  {
25101
25181
  num_pins: fpJson.num_pins,
@@ -25112,35 +25192,35 @@ var Footprinter3d = ({ footprint }) => {
25112
25192
  );
25113
25193
  case "pinrow":
25114
25194
  if (fpJson.male)
25115
- return /* @__PURE__ */ jsx4(PinRow, { numberOfPins: fpJson.num_pins, pitch: fpJson.p });
25195
+ return /* @__PURE__ */ jsx5(PinRow, { numberOfPins: fpJson.num_pins, pitch: fpJson.p });
25116
25196
  if (fpJson.female)
25117
- return /* @__PURE__ */ jsx4(FemaleHeader, { numberOfPins: fpJson.num_pins, pitch: fpJson.p });
25197
+ return /* @__PURE__ */ jsx5(FemaleHeader, { numberOfPins: fpJson.num_pins, pitch: fpJson.p });
25118
25198
  case "cap": {
25119
25199
  switch (fpJson.imperial) {
25120
25200
  case "0402":
25121
- return /* @__PURE__ */ jsx4(A0402, { color: "#856c4d" });
25201
+ return /* @__PURE__ */ jsx5(A0402, { color: "#856c4d" });
25122
25202
  case "0603":
25123
- return /* @__PURE__ */ jsx4(A0603, { color: "#856c4d" });
25203
+ return /* @__PURE__ */ jsx5(A0603, { color: "#856c4d" });
25124
25204
  case "0805":
25125
- return /* @__PURE__ */ jsx4(A0805, { color: "#856c4d" });
25205
+ return /* @__PURE__ */ jsx5(A0805, { color: "#856c4d" });
25126
25206
  case "0201":
25127
- return /* @__PURE__ */ jsx4(A0201, { color: "#856c4d" });
25207
+ return /* @__PURE__ */ jsx5(A0201, { color: "#856c4d" });
25128
25208
  case "01005":
25129
- return /* @__PURE__ */ jsx4(A01005, { color: "#856c4d" });
25209
+ return /* @__PURE__ */ jsx5(A01005, { color: "#856c4d" });
25130
25210
  case "1206":
25131
- return /* @__PURE__ */ jsx4(A1206, { color: "#856c4d" });
25211
+ return /* @__PURE__ */ jsx5(A1206, { color: "#856c4d" });
25132
25212
  case "1210":
25133
- return /* @__PURE__ */ jsx4(A1210, { color: "#856c4d" });
25213
+ return /* @__PURE__ */ jsx5(A1210, { color: "#856c4d" });
25134
25214
  case "2010":
25135
- return /* @__PURE__ */ jsx4(A2010, { color: "#856c4d" });
25215
+ return /* @__PURE__ */ jsx5(A2010, { color: "#856c4d" });
25136
25216
  case "2512":
25137
- return /* @__PURE__ */ jsx4(A2512, { color: "#856c4d" });
25217
+ return /* @__PURE__ */ jsx5(A2512, { color: "#856c4d" });
25138
25218
  }
25139
25219
  }
25140
25220
  case "sot235":
25141
- return /* @__PURE__ */ jsx4(SOT_235_default, {});
25221
+ return /* @__PURE__ */ jsx5(SOT_235_default, {});
25142
25222
  case "pushbutton":
25143
- return /* @__PURE__ */ jsx4(
25223
+ return /* @__PURE__ */ jsx5(
25144
25224
  PushButton,
25145
25225
  {
25146
25226
  width: fpJson.w,
@@ -25149,7 +25229,7 @@ var Footprinter3d = ({ footprint }) => {
25149
25229
  }
25150
25230
  );
25151
25231
  case "soic":
25152
- return /* @__PURE__ */ jsx4(
25232
+ return /* @__PURE__ */ jsx5(
25153
25233
  SOIC,
25154
25234
  {
25155
25235
  pinCount: fpJson.num_pins,
@@ -25162,23 +25242,23 @@ var Footprinter3d = ({ footprint }) => {
25162
25242
  }
25163
25243
  switch (fpJson.imperial) {
25164
25244
  case "0402":
25165
- return /* @__PURE__ */ jsx4(A0402, {});
25245
+ return /* @__PURE__ */ jsx5(A0402, {});
25166
25246
  case "0603":
25167
- return /* @__PURE__ */ jsx4(A0603, {});
25247
+ return /* @__PURE__ */ jsx5(A0603, {});
25168
25248
  case "0805":
25169
- return /* @__PURE__ */ jsx4(A0805, {});
25249
+ return /* @__PURE__ */ jsx5(A0805, {});
25170
25250
  case "0201":
25171
- return /* @__PURE__ */ jsx4(A0201, {});
25251
+ return /* @__PURE__ */ jsx5(A0201, {});
25172
25252
  case "01005":
25173
- return /* @__PURE__ */ jsx4(A01005, {});
25253
+ return /* @__PURE__ */ jsx5(A01005, {});
25174
25254
  case "1206":
25175
- return /* @__PURE__ */ jsx4(A1206, {});
25255
+ return /* @__PURE__ */ jsx5(A1206, {});
25176
25256
  case "1210":
25177
- return /* @__PURE__ */ jsx4(A1210, {});
25257
+ return /* @__PURE__ */ jsx5(A1210, {});
25178
25258
  case "2010":
25179
- return /* @__PURE__ */ jsx4(A2010, {});
25259
+ return /* @__PURE__ */ jsx5(A2010, {});
25180
25260
  case "2512":
25181
- return /* @__PURE__ */ jsx4(A2512, {});
25261
+ return /* @__PURE__ */ jsx5(A2512, {});
25182
25262
  }
25183
25263
  return null;
25184
25264
  };
@@ -25385,9 +25465,9 @@ function getJscadModelForFootprint(footprint) {
25385
25465
  }
25386
25466
 
25387
25467
  // src/three-components/JscadModel.tsx
25388
- import * as THREE3 from "three";
25389
- import { useMemo as useMemo3, useEffect as useEffect5 } from "react";
25390
- import { jsx as jsx5 } from "react/jsx-runtime";
25468
+ import * as THREE4 from "three";
25469
+ import { useMemo as useMemo4, useEffect as useEffect6 } from "react";
25470
+ import { jsx as jsx6 } from "react/jsx-runtime";
25391
25471
  var JscadModel = ({
25392
25472
  jscadPlan,
25393
25473
  positionOffset,
@@ -25397,31 +25477,31 @@ var JscadModel = ({
25397
25477
  isHovered
25398
25478
  }) => {
25399
25479
  const { rootObject } = useThree();
25400
- const { threeGeom, material } = useMemo3(() => {
25480
+ const { threeGeom, material } = useMemo4(() => {
25401
25481
  const jscadObject = (0, import_jscad_planner.executeJscadOperations)(import_modeling2.default, jscadPlan);
25402
25482
  if (!jscadObject || !jscadObject.polygons && !jscadObject.sides) {
25403
25483
  return { threeGeom: null, material: null };
25404
25484
  }
25405
25485
  const threeGeom2 = convertCSGToThreeGeom(jscadObject);
25406
- const material2 = new THREE3.MeshStandardMaterial({
25486
+ const material2 = new THREE4.MeshStandardMaterial({
25407
25487
  vertexColors: true,
25408
- side: THREE3.DoubleSide
25488
+ side: THREE4.DoubleSide
25409
25489
  // Ensure both sides are visible
25410
25490
  });
25411
25491
  return { threeGeom: threeGeom2, material: material2 };
25412
25492
  }, [jscadPlan]);
25413
- const mesh = useMemo3(() => {
25493
+ const mesh = useMemo4(() => {
25414
25494
  if (!threeGeom) return null;
25415
- return new THREE3.Mesh(threeGeom, material);
25495
+ return new THREE4.Mesh(threeGeom, material);
25416
25496
  }, [threeGeom, material]);
25417
- useEffect5(() => {
25497
+ useEffect6(() => {
25418
25498
  if (!mesh || !rootObject) return;
25419
25499
  rootObject.add(mesh);
25420
25500
  return () => {
25421
25501
  rootObject.remove(mesh);
25422
25502
  };
25423
25503
  }, [rootObject, mesh]);
25424
- useEffect5(() => {
25504
+ useEffect6(() => {
25425
25505
  if (!mesh) return;
25426
25506
  if (positionOffset) mesh.position.fromArray(positionOffset);
25427
25507
  if (rotationOffset) mesh.rotation.fromArray(rotationOffset);
@@ -25434,10 +25514,10 @@ var JscadModel = ({
25434
25514
  rotationOffset?.[1],
25435
25515
  rotationOffset?.[2]
25436
25516
  ]);
25437
- useMemo3(() => {
25517
+ useMemo4(() => {
25438
25518
  if (!material) return;
25439
25519
  if (isHovered) {
25440
- const color = new THREE3.Color(material.color.getHex());
25520
+ const color = new THREE4.Color(material.color.getHex());
25441
25521
  material.emissive.copy(color);
25442
25522
  material.emissive.setRGB(0, 0, 1);
25443
25523
  material.emissiveIntensity = 0.2;
@@ -25446,7 +25526,7 @@ var JscadModel = ({
25446
25526
  }
25447
25527
  }, [isHovered, material]);
25448
25528
  if (!threeGeom) return null;
25449
- return /* @__PURE__ */ jsx5(
25529
+ return /* @__PURE__ */ jsx6(
25450
25530
  ContainerWithTooltip_default,
25451
25531
  {
25452
25532
  isHovered,
@@ -25458,9 +25538,9 @@ var JscadModel = ({
25458
25538
  };
25459
25539
 
25460
25540
  // src/three-components/FootprinterModel.tsx
25461
- import { useMemo as useMemo4, useEffect as useEffect6 } from "react";
25462
- import * as THREE4 from "three";
25463
- import { jsx as jsx6 } from "react/jsx-runtime";
25541
+ import { useMemo as useMemo5, useEffect as useEffect7 } from "react";
25542
+ import * as THREE5 from "three";
25543
+ import { jsx as jsx7 } from "react/jsx-runtime";
25464
25544
  var FootprinterModel = ({
25465
25545
  positionOffset,
25466
25546
  footprint,
@@ -25470,36 +25550,36 @@ var FootprinterModel = ({
25470
25550
  isHovered
25471
25551
  }) => {
25472
25552
  const { rootObject } = useThree();
25473
- const group = useMemo4(() => {
25553
+ const group = useMemo5(() => {
25474
25554
  if (!footprint) return null;
25475
25555
  const { geometries: geometries2 } = getJscadModelForFootprint(footprint);
25476
- const group2 = new THREE4.Group();
25556
+ const group2 = new THREE5.Group();
25477
25557
  for (const geomInfo of geometries2.flat(Infinity)) {
25478
25558
  const geom = geomInfo.geom;
25479
25559
  if (!geom || !geom.polygons && !geom.sides) {
25480
25560
  continue;
25481
25561
  }
25482
- const color = new THREE4.Color(geomInfo.color);
25562
+ const color = new THREE5.Color(geomInfo.color);
25483
25563
  color.convertLinearToSRGB();
25484
25564
  const geomWithColor = { ...geom, color: [color.r, color.g, color.b] };
25485
25565
  const threeGeom = convertCSGToThreeGeom(geomWithColor);
25486
- const material = new THREE4.MeshStandardMaterial({
25566
+ const material = new THREE5.MeshStandardMaterial({
25487
25567
  vertexColors: true,
25488
- side: THREE4.DoubleSide
25568
+ side: THREE5.DoubleSide
25489
25569
  });
25490
- const mesh = new THREE4.Mesh(threeGeom, material);
25570
+ const mesh = new THREE5.Mesh(threeGeom, material);
25491
25571
  group2.add(mesh);
25492
25572
  }
25493
25573
  return group2;
25494
25574
  }, [footprint]);
25495
- useEffect6(() => {
25575
+ useEffect7(() => {
25496
25576
  if (!group || !rootObject) return;
25497
25577
  rootObject.add(group);
25498
25578
  return () => {
25499
25579
  rootObject.remove(group);
25500
25580
  };
25501
25581
  }, [rootObject, group]);
25502
- useEffect6(() => {
25582
+ useEffect7(() => {
25503
25583
  if (!group) return;
25504
25584
  if (positionOffset) group.position.fromArray(positionOffset);
25505
25585
  if (rotationOffset) group.rotation.fromArray(rotationOffset);
@@ -25512,10 +25592,10 @@ var FootprinterModel = ({
25512
25592
  rotationOffset?.[1],
25513
25593
  rotationOffset?.[2]
25514
25594
  ]);
25515
- useEffect6(() => {
25595
+ useEffect7(() => {
25516
25596
  if (!group) return;
25517
25597
  group.traverse((child) => {
25518
- if (child instanceof THREE4.Mesh && child.material instanceof THREE4.MeshStandardMaterial) {
25598
+ if (child instanceof THREE5.Mesh && child.material instanceof THREE5.MeshStandardMaterial) {
25519
25599
  if (isHovered) {
25520
25600
  child.material.emissive.setHex(255);
25521
25601
  child.material.emissiveIntensity = 0.2;
@@ -25526,7 +25606,7 @@ var FootprinterModel = ({
25526
25606
  });
25527
25607
  }, [isHovered, group]);
25528
25608
  if (!group) return null;
25529
- return /* @__PURE__ */ jsx6(
25609
+ return /* @__PURE__ */ jsx7(
25530
25610
  ContainerWithTooltip_default,
25531
25611
  {
25532
25612
  isHovered,
@@ -25541,14 +25621,14 @@ var FootprinterModel = ({
25541
25621
  var tuple = (...args) => args;
25542
25622
 
25543
25623
  // src/react-three/Html.tsx
25544
- import { useRef as useRef2, useEffect as useEffect7, useState as useState3 } from "react";
25624
+ import { useRef as useRef2, useEffect as useEffect8, useState as useState4 } from "react";
25545
25625
  import ReactDOM from "react-dom";
25546
- import * as THREE5 from "three";
25626
+ import * as THREE6 from "three";
25547
25627
  var Html = ({ children, position, style }) => {
25548
25628
  const { camera, renderer } = useThree();
25549
25629
  const el = useRef2(document.createElement("div"));
25550
- const [portal, setPortal] = useState3(null);
25551
- useEffect7(() => {
25630
+ const [portal, setPortal] = useState4(null);
25631
+ useEffect8(() => {
25552
25632
  const rendererNode = renderer?.domElement.parentNode;
25553
25633
  if (!rendererNode) return;
25554
25634
  rendererNode.appendChild(el.current);
@@ -25561,7 +25641,7 @@ var Html = ({ children, position, style }) => {
25561
25641
  }, [renderer, children]);
25562
25642
  useFrame(() => {
25563
25643
  if (!camera || !el.current || !renderer) return;
25564
- const vector = new THREE5.Vector3(...position);
25644
+ const vector = new THREE6.Vector3(...position);
25565
25645
  vector.project(camera);
25566
25646
  const rect = renderer.domElement.getBoundingClientRect();
25567
25647
  const x = Math.round((vector.x + 1) / 2 * rect.width);
@@ -25578,13 +25658,13 @@ var Html = ({ children, position, style }) => {
25578
25658
  };
25579
25659
 
25580
25660
  // src/AnyCadComponent.tsx
25581
- import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
25661
+ import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
25582
25662
  var AnyCadComponent = ({
25583
25663
  cad_component: cad_component2,
25584
25664
  circuitJson
25585
25665
  }) => {
25586
- const [isHovered, setIsHovered] = useState4(false);
25587
- const [hoverPosition, setHoverPosition] = useState4(null);
25666
+ const [isHovered, setIsHovered] = useState5(false);
25667
+ const [hoverPosition, setHoverPosition] = useState5(null);
25588
25668
  const handleHover = useCallback2((e) => {
25589
25669
  if (e?.mousePosition) {
25590
25670
  setIsHovered(true);
@@ -25598,12 +25678,13 @@ var AnyCadComponent = ({
25598
25678
  setIsHovered(false);
25599
25679
  setHoverPosition(null);
25600
25680
  }, []);
25601
- const componentName = useMemo5(() => {
25681
+ const componentName = useMemo6(() => {
25602
25682
  return su(circuitJson).source_component.getUsing({
25603
25683
  source_component_id: cad_component2.source_component_id
25604
25684
  })?.name;
25605
25685
  }, [circuitJson, cad_component2.source_component_id]);
25606
25686
  const url = cad_component2.model_obj_url ?? cad_component2.model_stl_url;
25687
+ const gltfUrl = cad_component2.model_gltf_url;
25607
25688
  const rotationOffset = cad_component2.rotation ? tuple(
25608
25689
  cad_component2.rotation.x * Math.PI / 180,
25609
25690
  cad_component2.rotation.y * Math.PI / 180,
@@ -25611,7 +25692,7 @@ var AnyCadComponent = ({
25611
25692
  ) : void 0;
25612
25693
  let modelComponent = null;
25613
25694
  if (url) {
25614
- modelComponent = /* @__PURE__ */ jsx7(
25695
+ modelComponent = /* @__PURE__ */ jsx8(
25615
25696
  MixedStlModel,
25616
25697
  {
25617
25698
  url,
@@ -25627,8 +25708,25 @@ var AnyCadComponent = ({
25627
25708
  },
25628
25709
  cad_component2.cad_component_id
25629
25710
  );
25711
+ } else if (gltfUrl) {
25712
+ modelComponent = /* @__PURE__ */ jsx8(
25713
+ GltfModel,
25714
+ {
25715
+ gltfUrl,
25716
+ position: cad_component2.position ? [
25717
+ cad_component2.position.x,
25718
+ cad_component2.position.y,
25719
+ cad_component2.position.z
25720
+ ] : void 0,
25721
+ rotation: rotationOffset,
25722
+ onHover: handleHover,
25723
+ onUnhover: handleUnhover,
25724
+ isHovered
25725
+ },
25726
+ cad_component2.cad_component_id
25727
+ );
25630
25728
  } else if (cad_component2.model_jscad) {
25631
- modelComponent = /* @__PURE__ */ jsx7(
25729
+ modelComponent = /* @__PURE__ */ jsx8(
25632
25730
  JscadModel,
25633
25731
  {
25634
25732
  jscadPlan: cad_component2.model_jscad,
@@ -25640,7 +25738,7 @@ var AnyCadComponent = ({
25640
25738
  cad_component2.cad_component_id
25641
25739
  );
25642
25740
  } else if (cad_component2.footprinter_string) {
25643
- modelComponent = /* @__PURE__ */ jsx7(
25741
+ modelComponent = /* @__PURE__ */ jsx8(
25644
25742
  FootprinterModel,
25645
25743
  {
25646
25744
  positionOffset: cad_component2.position ? [
@@ -25658,7 +25756,7 @@ var AnyCadComponent = ({
25658
25756
  }
25659
25757
  return /* @__PURE__ */ jsxs2(Fragment3, { children: [
25660
25758
  modelComponent,
25661
- isHovered && hoverPosition ? /* @__PURE__ */ jsx7(
25759
+ isHovered && hoverPosition ? /* @__PURE__ */ jsx8(
25662
25760
  Html,
25663
25761
  {
25664
25762
  position: hoverPosition,
@@ -25683,15 +25781,15 @@ var AnyCadComponent = ({
25683
25781
  // src/CadViewerContainer.tsx
25684
25782
  import {
25685
25783
  forwardRef as forwardRef2,
25686
- useMemo as useMemo12,
25687
- useState as useState6
25784
+ useMemo as useMemo13,
25785
+ useState as useState7
25688
25786
  } from "react";
25689
- import * as THREE10 from "three";
25787
+ import * as THREE11 from "three";
25690
25788
 
25691
25789
  // package.json
25692
25790
  var package_default = {
25693
25791
  name: "@tscircuit/3d-viewer",
25694
- version: "0.0.366",
25792
+ version: "0.0.368",
25695
25793
  main: "./dist/index.js",
25696
25794
  module: "./dist/index.js",
25697
25795
  type: "module",
@@ -25738,8 +25836,8 @@ var package_default = {
25738
25836
  "@storybook/blocks": "9.0.0-alpha.17",
25739
25837
  "@storybook/react-vite": "^9.1.2",
25740
25838
  "@tscircuit/circuit-json-util": "^0.0.67",
25741
- "@tscircuit/core": "^0.0.688",
25742
- "@tscircuit/props": "^0.0.296",
25839
+ "@tscircuit/core": "^0.0.691",
25840
+ "@tscircuit/props": "^0.0.298",
25743
25841
  "@types/jsdom": "^21.1.7",
25744
25842
  "@types/react": "19",
25745
25843
  "@types/react-dom": "19",
@@ -25747,7 +25845,7 @@ var package_default = {
25747
25845
  "@vitejs/plugin-react": "^4.3.4",
25748
25846
  "bun-match-svg": "^0.0.9",
25749
25847
  "bun-types": "1.2.1",
25750
- "circuit-json": "^0.0.241",
25848
+ "circuit-json": "^0.0.242",
25751
25849
  "circuit-to-svg": "^0.0.179",
25752
25850
  debug: "^4.4.0",
25753
25851
  "jscad-electronics": "^0.0.38",
@@ -25766,11 +25864,11 @@ var package_default = {
25766
25864
  };
25767
25865
 
25768
25866
  // src/three-components/cube-with-labeled-sides.tsx
25769
- import { useEffect as useEffect9, useMemo as useMemo7 } from "react";
25770
- import * as THREE6 from "three";
25867
+ import { useEffect as useEffect10, useMemo as useMemo8 } from "react";
25868
+ import * as THREE7 from "three";
25771
25869
 
25772
25870
  // src/react-three/Text.tsx
25773
- import { useEffect as useEffect8, useMemo as useMemo6 } from "react";
25871
+ import { useEffect as useEffect9, useMemo as useMemo7 } from "react";
25774
25872
  import { Text as TroikaText } from "troika-three-text";
25775
25873
  var Text = ({
25776
25874
  children,
@@ -25785,7 +25883,7 @@ var Text = ({
25785
25883
  depthOffset
25786
25884
  }) => {
25787
25885
  const { rootObject } = useThree();
25788
- const mesh = useMemo6(() => {
25886
+ const mesh = useMemo7(() => {
25789
25887
  const textMesh = new TroikaText();
25790
25888
  textMesh.text = children;
25791
25889
  if (position) textMesh.position.fromArray(position);
@@ -25810,7 +25908,7 @@ var Text = ({
25810
25908
  anchorY,
25811
25909
  depthOffset
25812
25910
  ]);
25813
- useEffect8(() => {
25911
+ useEffect9(() => {
25814
25912
  const parentObject = parent || rootObject;
25815
25913
  if (!parentObject || !mesh) return;
25816
25914
  parentObject.add(mesh);
@@ -25823,24 +25921,24 @@ var Text = ({
25823
25921
  };
25824
25922
 
25825
25923
  // src/three-components/cube-with-labeled-sides.tsx
25826
- import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
25924
+ import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
25827
25925
  if (typeof window !== "undefined") {
25828
- window.TSCI_MAIN_CAMERA_ROTATION = new THREE6.Euler(0, 0, 0);
25926
+ window.TSCI_MAIN_CAMERA_ROTATION = new THREE7.Euler(0, 0, 0);
25829
25927
  }
25830
25928
  function computePointInFront(rotationVector, distance2) {
25831
- const quaternion = new THREE6.Quaternion().setFromEuler(
25832
- new THREE6.Euler(rotationVector.x, rotationVector.y, rotationVector.z)
25929
+ const quaternion = new THREE7.Quaternion().setFromEuler(
25930
+ new THREE7.Euler(rotationVector.x, rotationVector.y, rotationVector.z)
25833
25931
  );
25834
- const forwardVector = new THREE6.Vector3(0, 0, 1);
25932
+ const forwardVector = new THREE7.Vector3(0, 0, 1);
25835
25933
  forwardVector.applyQuaternion(quaternion);
25836
25934
  const result = forwardVector.multiplyScalar(distance2);
25837
25935
  return result;
25838
25936
  }
25839
25937
  var CubeWithLabeledSides = ({}) => {
25840
25938
  const { camera, scene } = useThree();
25841
- useEffect9(() => {
25939
+ useEffect10(() => {
25842
25940
  if (!scene) return;
25843
- const ambientLight = new THREE6.AmbientLight(16777215, Math.PI / 2);
25941
+ const ambientLight = new THREE7.AmbientLight(16777215, Math.PI / 2);
25844
25942
  scene.add(ambientLight);
25845
25943
  return () => {
25846
25944
  scene.remove(ambientLight);
@@ -25853,22 +25951,22 @@ var CubeWithLabeledSides = ({}) => {
25853
25951
  camera.position.copy(cameraPosition);
25854
25952
  camera.lookAt(0, 0, 0);
25855
25953
  });
25856
- const group = useMemo7(() => {
25857
- const g = new THREE6.Group();
25954
+ const group = useMemo8(() => {
25955
+ const g = new THREE7.Group();
25858
25956
  g.rotation.fromArray([Math.PI / 2, 0, 0]);
25859
- const box = new THREE6.Mesh(
25860
- new THREE6.BoxGeometry(1, 1, 1),
25861
- new THREE6.MeshStandardMaterial({ color: "white" })
25957
+ const box = new THREE7.Mesh(
25958
+ new THREE7.BoxGeometry(1, 1, 1),
25959
+ new THREE7.MeshStandardMaterial({ color: "white" })
25862
25960
  );
25863
25961
  g.add(box);
25864
- const edges = new THREE6.LineSegments(
25865
- new THREE6.EdgesGeometry(new THREE6.BoxGeometry(1, 1, 1)),
25866
- new THREE6.LineBasicMaterial({ color: 0, linewidth: 2 })
25962
+ const edges = new THREE7.LineSegments(
25963
+ new THREE7.EdgesGeometry(new THREE7.BoxGeometry(1, 1, 1)),
25964
+ new THREE7.LineBasicMaterial({ color: 0, linewidth: 2 })
25867
25965
  );
25868
25966
  g.add(edges);
25869
25967
  return g;
25870
25968
  }, []);
25871
- useEffect9(() => {
25969
+ useEffect10(() => {
25872
25970
  if (!scene) return;
25873
25971
  scene.add(group);
25874
25972
  return () => {
@@ -25876,7 +25974,7 @@ var CubeWithLabeledSides = ({}) => {
25876
25974
  };
25877
25975
  }, [scene, group]);
25878
25976
  return /* @__PURE__ */ jsxs3(Fragment4, { children: [
25879
- /* @__PURE__ */ jsx8(
25977
+ /* @__PURE__ */ jsx9(
25880
25978
  Text,
25881
25979
  {
25882
25980
  parent: group,
@@ -25886,7 +25984,7 @@ var CubeWithLabeledSides = ({}) => {
25886
25984
  children: "Front"
25887
25985
  }
25888
25986
  ),
25889
- /* @__PURE__ */ jsx8(
25987
+ /* @__PURE__ */ jsx9(
25890
25988
  Text,
25891
25989
  {
25892
25990
  parent: group,
@@ -25897,7 +25995,7 @@ var CubeWithLabeledSides = ({}) => {
25897
25995
  children: "Back"
25898
25996
  }
25899
25997
  ),
25900
- /* @__PURE__ */ jsx8(
25998
+ /* @__PURE__ */ jsx9(
25901
25999
  Text,
25902
26000
  {
25903
26001
  parent: group,
@@ -25908,7 +26006,7 @@ var CubeWithLabeledSides = ({}) => {
25908
26006
  children: "Right"
25909
26007
  }
25910
26008
  ),
25911
- /* @__PURE__ */ jsx8(
26009
+ /* @__PURE__ */ jsx9(
25912
26010
  Text,
25913
26011
  {
25914
26012
  parent: group,
@@ -25919,7 +26017,7 @@ var CubeWithLabeledSides = ({}) => {
25919
26017
  children: "Left"
25920
26018
  }
25921
26019
  ),
25922
- /* @__PURE__ */ jsx8(
26020
+ /* @__PURE__ */ jsx9(
25923
26021
  Text,
25924
26022
  {
25925
26023
  parent: group,
@@ -25930,7 +26028,7 @@ var CubeWithLabeledSides = ({}) => {
25930
26028
  children: "Top"
25931
26029
  }
25932
26030
  ),
25933
- /* @__PURE__ */ jsx8(
26031
+ /* @__PURE__ */ jsx9(
25934
26032
  Text,
25935
26033
  {
25936
26034
  parent: group,
@@ -25947,14 +26045,14 @@ var CubeWithLabeledSides = ({}) => {
25947
26045
  // src/react-three/Canvas.tsx
25948
26046
  import {
25949
26047
  useRef as useRef4,
25950
- useEffect as useEffect10,
25951
- useState as useState5,
26048
+ useEffect as useEffect11,
26049
+ useState as useState6,
25952
26050
  useCallback as useCallback3,
25953
26051
  forwardRef,
25954
26052
  useImperativeHandle,
25955
- useMemo as useMemo8
26053
+ useMemo as useMemo9
25956
26054
  } from "react";
25957
- import * as THREE7 from "three";
26055
+ import * as THREE8 from "three";
25958
26056
 
25959
26057
  // src/react-three/remove-existing-canvases.ts
25960
26058
  function removeExistingCanvases(container) {
@@ -25962,11 +26060,11 @@ function removeExistingCanvases(container) {
25962
26060
  }
25963
26061
 
25964
26062
  // src/react-three/Canvas.tsx
25965
- import { jsx as jsx9 } from "react/jsx-runtime";
26063
+ import { jsx as jsx10 } from "react/jsx-runtime";
25966
26064
  var Canvas = forwardRef(
25967
26065
  ({ children, scene: sceneProps, camera: cameraProps, style }, ref) => {
25968
26066
  const mountRef = useRef4(null);
25969
- const [contextState, setContextState] = useState5(
26067
+ const [contextState, setContextState] = useState6(
25970
26068
  null
25971
26069
  );
25972
26070
  const frameListeners = useRef4(
@@ -25986,23 +26084,23 @@ var Canvas = forwardRef(
25986
26084
  },
25987
26085
  []
25988
26086
  );
25989
- const scene = useMemo8(() => new THREE7.Scene(), []);
26087
+ const scene = useMemo9(() => new THREE8.Scene(), []);
25990
26088
  if (sceneProps?.up) {
25991
26089
  scene.up.set(sceneProps.up.x, sceneProps.up.y, sceneProps.up.z);
25992
26090
  }
25993
- const rootObject = useRef4(new THREE7.Object3D());
26091
+ const rootObject = useRef4(new THREE8.Object3D());
25994
26092
  useImperativeHandle(ref, () => rootObject.current);
25995
- useEffect10(() => {
26093
+ useEffect11(() => {
25996
26094
  if (!mountRef.current) return;
25997
26095
  removeExistingCanvases(mountRef.current);
25998
- const renderer = new THREE7.WebGLRenderer({ antialias: true, alpha: true });
26096
+ const renderer = new THREE8.WebGLRenderer({ antialias: true, alpha: true });
25999
26097
  renderer.setSize(
26000
26098
  mountRef.current.clientWidth,
26001
26099
  mountRef.current.clientHeight
26002
26100
  );
26003
26101
  renderer.setPixelRatio(window.devicePixelRatio);
26004
26102
  mountRef.current.appendChild(renderer.domElement);
26005
- const camera = new THREE7.PerspectiveCamera(
26103
+ const camera = new THREE8.PerspectiveCamera(
26006
26104
  75,
26007
26105
  mountRef.current.clientWidth / mountRef.current.clientHeight,
26008
26106
  0.1,
@@ -26030,7 +26128,7 @@ var Canvas = forwardRef(
26030
26128
  removeFrameListener
26031
26129
  });
26032
26130
  let animationFrameId;
26033
- const clock = new THREE7.Clock();
26131
+ const clock = new THREE8.Clock();
26034
26132
  const animate = () => {
26035
26133
  const time2 = clock.getElapsedTime();
26036
26134
  const delta = clock.getDelta();
@@ -26063,12 +26161,12 @@ var Canvas = forwardRef(
26063
26161
  }
26064
26162
  };
26065
26163
  }, [scene, addFrameListener, removeFrameListener]);
26066
- return /* @__PURE__ */ jsx9("div", { ref: mountRef, style: { width: "100%", height: "100%", ...style }, children: contextState && /* @__PURE__ */ jsx9(ThreeContext.Provider, { value: contextState, children: /* @__PURE__ */ jsx9(HoverProvider, { children }) }) });
26164
+ return /* @__PURE__ */ jsx10("div", { ref: mountRef, style: { width: "100%", height: "100%", ...style }, children: contextState && /* @__PURE__ */ jsx10(ThreeContext.Provider, { value: contextState, children: /* @__PURE__ */ jsx10(HoverProvider, { children }) }) });
26067
26165
  }
26068
26166
  );
26069
26167
 
26070
26168
  // src/react-three/OrbitControls.tsx
26071
- import { useEffect as useEffect11, useMemo as useMemo9 } from "react";
26169
+ import { useEffect as useEffect12, useMemo as useMemo10 } from "react";
26072
26170
  import { OrbitControls as ThreeOrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
26073
26171
  var OrbitControls = ({
26074
26172
  autoRotate,
@@ -26081,11 +26179,11 @@ var OrbitControls = ({
26081
26179
  dampingFactor
26082
26180
  }) => {
26083
26181
  const { camera, renderer } = useThree();
26084
- const controls = useMemo9(() => {
26182
+ const controls = useMemo10(() => {
26085
26183
  if (!camera || !renderer) return null;
26086
26184
  return new ThreeOrbitControls(camera, renderer.domElement);
26087
26185
  }, [camera, renderer]);
26088
- useEffect11(() => {
26186
+ useEffect12(() => {
26089
26187
  if (!controls) return;
26090
26188
  controls.autoRotate = autoRotate || false;
26091
26189
  controls.autoRotateSpeed = autoRotateSpeed || 1;
@@ -26104,14 +26202,14 @@ var OrbitControls = ({
26104
26202
  enableDamping,
26105
26203
  dampingFactor
26106
26204
  ]);
26107
- useEffect11(() => {
26205
+ useEffect12(() => {
26108
26206
  if (!controls || !onStart) return;
26109
26207
  controls.addEventListener("start", onStart);
26110
26208
  return () => {
26111
26209
  controls.removeEventListener("start", onStart);
26112
26210
  };
26113
26211
  }, [controls, onStart]);
26114
- useEffect11(() => {
26212
+ useEffect12(() => {
26115
26213
  if (!controls) return;
26116
26214
  return () => {
26117
26215
  controls.dispose();
@@ -26124,8 +26222,8 @@ var OrbitControls = ({
26124
26222
  };
26125
26223
 
26126
26224
  // src/react-three/Grid.tsx
26127
- import { useEffect as useEffect12, useMemo as useMemo10 } from "react";
26128
- import * as THREE8 from "three";
26225
+ import { useEffect as useEffect13, useMemo as useMemo11 } from "react";
26226
+ import * as THREE9 from "three";
26129
26227
  var vertexShader = `
26130
26228
  varying vec3 worldPosition;
26131
26229
  void main() {
@@ -26170,25 +26268,25 @@ var Grid = ({
26170
26268
  }) => {
26171
26269
  const { scene, camera } = useThree();
26172
26270
  const size2 = 1e3;
26173
- const gridMesh = useMemo10(() => {
26174
- const geometry = new THREE8.PlaneGeometry(size2, size2);
26271
+ const gridMesh = useMemo11(() => {
26272
+ const geometry = new THREE9.PlaneGeometry(size2, size2);
26175
26273
  geometry.rotateX(-Math.PI / 2);
26176
- const material = new THREE8.ShaderMaterial({
26274
+ const material = new THREE9.ShaderMaterial({
26177
26275
  vertexShader,
26178
26276
  fragmentShader,
26179
26277
  uniforms: {
26180
26278
  cellSize: { value: cellSize },
26181
26279
  sectionSize: { value: sectionSize },
26182
- gridColor: { value: new THREE8.Color(15658734) },
26183
- sectionColor: { value: new THREE8.Color(13421823) },
26280
+ gridColor: { value: new THREE9.Color(15658734) },
26281
+ sectionColor: { value: new THREE9.Color(13421823) },
26184
26282
  fadeDistance: { value: 100 },
26185
26283
  // Fade out based on sectionSize
26186
26284
  fadeStrength: { value: 1.5 }
26187
26285
  },
26188
26286
  transparent: true,
26189
- side: THREE8.DoubleSide
26287
+ side: THREE9.DoubleSide
26190
26288
  });
26191
- const mesh = new THREE8.Mesh(geometry, material);
26289
+ const mesh = new THREE9.Mesh(geometry, material);
26192
26290
  if (rotation2) {
26193
26291
  mesh.rotation.fromArray(rotation2);
26194
26292
  }
@@ -26199,7 +26297,7 @@ var Grid = ({
26199
26297
  gridMesh.position.set(camera.position.x, camera.position.y, 0);
26200
26298
  }
26201
26299
  });
26202
- useEffect12(() => {
26300
+ useEffect13(() => {
26203
26301
  if (!scene || !gridMesh) return;
26204
26302
  scene.add(gridMesh);
26205
26303
  return () => {
@@ -26216,21 +26314,21 @@ var Grid = ({
26216
26314
  };
26217
26315
 
26218
26316
  // src/react-three/Lights.tsx
26219
- import { useEffect as useEffect13, useMemo as useMemo11 } from "react";
26220
- import * as THREE9 from "three";
26317
+ import { useEffect as useEffect14, useMemo as useMemo12 } from "react";
26318
+ import * as THREE10 from "three";
26221
26319
  var Lights = () => {
26222
26320
  const { scene } = useThree();
26223
- const ambientLight = useMemo11(
26224
- () => new THREE9.AmbientLight(16777215, Math.PI / 2),
26321
+ const ambientLight = useMemo12(
26322
+ () => new THREE10.AmbientLight(16777215, Math.PI / 2),
26225
26323
  []
26226
26324
  );
26227
- const pointLight = useMemo11(() => {
26228
- const light = new THREE9.PointLight(16777215, Math.PI / 4);
26325
+ const pointLight = useMemo12(() => {
26326
+ const light = new THREE10.PointLight(16777215, Math.PI / 4);
26229
26327
  light.position.set(-10, -10, 10);
26230
26328
  light.decay = 0;
26231
26329
  return light;
26232
26330
  }, []);
26233
- useEffect13(() => {
26331
+ useEffect14(() => {
26234
26332
  if (!scene) return;
26235
26333
  scene.add(ambientLight);
26236
26334
  scene.add(pointLight);
@@ -26243,7 +26341,7 @@ var Lights = () => {
26243
26341
  };
26244
26342
 
26245
26343
  // src/CadViewerContainer.tsx
26246
- import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
26344
+ import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
26247
26345
  var RotationTracker = () => {
26248
26346
  const { camera } = useThree();
26249
26347
  useFrame(() => {
@@ -26262,10 +26360,10 @@ var CadViewerContainer = forwardRef2(
26262
26360
  boardDimensions,
26263
26361
  onUserInteraction
26264
26362
  }, ref) => {
26265
- const [isInteractionEnabled, setIsInteractionEnabled] = useState6(
26363
+ const [isInteractionEnabled, setIsInteractionEnabled] = useState7(
26266
26364
  !clickToInteractEnabled
26267
26365
  );
26268
- const gridSectionSize = useMemo12(() => {
26366
+ const gridSectionSize = useMemo13(() => {
26269
26367
  if (!boardDimensions) return 10;
26270
26368
  const width10 = boardDimensions.width ?? 0;
26271
26369
  const height10 = boardDimensions.height ?? 0;
@@ -26274,7 +26372,7 @@ var CadViewerContainer = forwardRef2(
26274
26372
  return desired > 10 ? desired : 10;
26275
26373
  }, [boardDimensions]);
26276
26374
  return /* @__PURE__ */ jsxs4("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
26277
- /* @__PURE__ */ jsx10(
26375
+ /* @__PURE__ */ jsx11(
26278
26376
  "div",
26279
26377
  {
26280
26378
  style: {
@@ -26284,7 +26382,7 @@ var CadViewerContainer = forwardRef2(
26284
26382
  width: 120,
26285
26383
  height: 120
26286
26384
  },
26287
- children: /* @__PURE__ */ jsx10(
26385
+ children: /* @__PURE__ */ jsx11(
26288
26386
  Canvas,
26289
26387
  {
26290
26388
  camera: {
@@ -26292,7 +26390,7 @@ var CadViewerContainer = forwardRef2(
26292
26390
  position: [1, 1, 1]
26293
26391
  },
26294
26392
  style: { zIndex: 10 },
26295
- children: /* @__PURE__ */ jsx10(CubeWithLabeledSides, {})
26393
+ children: /* @__PURE__ */ jsx11(CubeWithLabeledSides, {})
26296
26394
  }
26297
26395
  )
26298
26396
  }
@@ -26301,11 +26399,11 @@ var CadViewerContainer = forwardRef2(
26301
26399
  Canvas,
26302
26400
  {
26303
26401
  ref,
26304
- scene: { up: new THREE10.Vector3(0, 0, 1) },
26402
+ scene: { up: new THREE11.Vector3(0, 0, 1) },
26305
26403
  camera: { up: [0, 0, 1], position: initialCameraPosition },
26306
26404
  children: [
26307
- /* @__PURE__ */ jsx10(RotationTracker, {}),
26308
- isInteractionEnabled && /* @__PURE__ */ jsx10(
26405
+ /* @__PURE__ */ jsx11(RotationTracker, {}),
26406
+ isInteractionEnabled && /* @__PURE__ */ jsx11(
26309
26407
  OrbitControls,
26310
26408
  {
26311
26409
  autoRotate: !autoRotateDisabled,
@@ -26318,8 +26416,8 @@ var CadViewerContainer = forwardRef2(
26318
26416
  dampingFactor: 0.1
26319
26417
  }
26320
26418
  ),
26321
- /* @__PURE__ */ jsx10(Lights, {}),
26322
- /* @__PURE__ */ jsx10(
26419
+ /* @__PURE__ */ jsx11(Lights, {}),
26420
+ /* @__PURE__ */ jsx11(
26323
26421
  Grid,
26324
26422
  {
26325
26423
  rotation: [Math.PI / 2, 0, 0],
@@ -26351,7 +26449,7 @@ var CadViewerContainer = forwardRef2(
26351
26449
  ]
26352
26450
  }
26353
26451
  ),
26354
- clickToInteractEnabled && !isInteractionEnabled && /* @__PURE__ */ jsx10(
26452
+ clickToInteractEnabled && !isInteractionEnabled && /* @__PURE__ */ jsx11(
26355
26453
  "button",
26356
26454
  {
26357
26455
  type: "button",
@@ -26370,7 +26468,7 @@ var CadViewerContainer = forwardRef2(
26370
26468
  alignItems: "center",
26371
26469
  justifyContent: "center"
26372
26470
  },
26373
- children: /* @__PURE__ */ jsx10(
26471
+ children: /* @__PURE__ */ jsx11(
26374
26472
  "div",
26375
26473
  {
26376
26474
  style: {
@@ -26393,9 +26491,9 @@ var CadViewerContainer = forwardRef2(
26393
26491
 
26394
26492
  // src/hooks/use-convert-children-to-soup.ts
26395
26493
  import { Circuit } from "@tscircuit/core";
26396
- import { useMemo as useMemo13 } from "react";
26494
+ import { useMemo as useMemo14 } from "react";
26397
26495
  var useConvertChildrenToSoup = (children) => {
26398
- return useMemo13(() => {
26496
+ return useMemo14(() => {
26399
26497
  if (!children) return [];
26400
26498
  const circuit = new Circuit();
26401
26499
  circuit.add(children);
@@ -26405,12 +26503,12 @@ var useConvertChildrenToSoup = (children) => {
26405
26503
  };
26406
26504
 
26407
26505
  // src/hooks/use-stls-from-geom.ts
26408
- import { useState as useState7, useEffect as useEffect15 } from "react";
26506
+ import { useState as useState8, useEffect as useEffect16 } from "react";
26409
26507
  import stlSerializer from "@jscad/stl-serializer";
26410
26508
  var useStlsFromGeom = (geom) => {
26411
- const [stls, setStls] = useState7([]);
26412
- const [loading, setLoading] = useState7(true);
26413
- useEffect15(() => {
26509
+ const [stls, setStls] = useState8([]);
26510
+ const [loading, setLoading] = useState8(true);
26511
+ useEffect16(() => {
26414
26512
  if (!geom) return;
26415
26513
  const generateStls = async () => {
26416
26514
  setLoading(true);
@@ -26437,7 +26535,7 @@ var useStlsFromGeom = (geom) => {
26437
26535
  };
26438
26536
 
26439
26537
  // src/hooks/useBoardGeomBuilder.ts
26440
- import { useState as useState8, useEffect as useEffect16, useRef as useRef6 } from "react";
26538
+ import { useState as useState9, useEffect as useEffect17, useRef as useRef6 } from "react";
26441
26539
 
26442
26540
  // src/soup-to-3d/index.ts
26443
26541
  var import_primitives2 = __toESM(require_primitives(), 1);
@@ -27610,9 +27708,9 @@ var BoardGeomBuilder = class {
27610
27708
 
27611
27709
  // src/hooks/useBoardGeomBuilder.ts
27612
27710
  var useBoardGeomBuilder = (circuitJson) => {
27613
- const [boardGeom, setBoardGeom] = useState8(null);
27711
+ const [boardGeom, setBoardGeom] = useState9(null);
27614
27712
  const isProcessingRef = useRef6(false);
27615
- useEffect16(() => {
27713
+ useEffect17(() => {
27616
27714
  let isCancelled = false;
27617
27715
  if (!circuitJson) {
27618
27716
  setBoardGeom(null);
@@ -27655,16 +27753,16 @@ var useBoardGeomBuilder = (circuitJson) => {
27655
27753
  };
27656
27754
 
27657
27755
  // src/three-components/Error3d.tsx
27658
- import { useState as useState9, useCallback as useCallback4, useEffect as useEffect17, useMemo as useMemo14 } from "react";
27659
- import * as THREE11 from "three";
27660
- import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
27756
+ import { useState as useState10, useCallback as useCallback4, useEffect as useEffect18, useMemo as useMemo15 } from "react";
27757
+ import * as THREE12 from "three";
27758
+ import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
27661
27759
  var Error3d = ({
27662
27760
  error,
27663
27761
  cad_component: cad_component2
27664
27762
  }) => {
27665
27763
  const { rootObject } = useThree();
27666
- const [isHovered, setIsHovered] = useState9(false);
27667
- const [hoverPosition, setHoverPosition] = useState9(null);
27764
+ const [isHovered, setIsHovered] = useState10(false);
27765
+ const [hoverPosition, setHoverPosition] = useState10(null);
27668
27766
  const handleHover = useCallback4((e) => {
27669
27767
  if (e?.mousePosition) {
27670
27768
  setIsHovered(true);
@@ -27678,7 +27776,7 @@ var Error3d = ({
27678
27776
  setIsHovered(false);
27679
27777
  setHoverPosition(null);
27680
27778
  }, []);
27681
- const position = useMemo14(() => {
27779
+ const position = useMemo15(() => {
27682
27780
  if (cad_component2?.position) {
27683
27781
  const p = [
27684
27782
  cad_component2.position.x,
@@ -27689,12 +27787,12 @@ var Error3d = ({
27689
27787
  }
27690
27788
  return [0, 0, 0];
27691
27789
  }, [cad_component2]);
27692
- const group = useMemo14(() => {
27693
- const g = new THREE11.Group();
27790
+ const group = useMemo15(() => {
27791
+ const g = new THREE12.Group();
27694
27792
  g.position.fromArray(position);
27695
27793
  return g;
27696
27794
  }, [position]);
27697
- useEffect17(() => {
27795
+ useEffect18(() => {
27698
27796
  if (!rootObject) return;
27699
27797
  rootObject.add(group);
27700
27798
  return () => {
@@ -27710,8 +27808,8 @@ var Error3d = ({
27710
27808
  onUnhover: handleUnhover,
27711
27809
  object: group,
27712
27810
  children: [
27713
- /* @__PURE__ */ jsx11(ErrorBox, { parent: group }),
27714
- /* @__PURE__ */ jsx11(
27811
+ /* @__PURE__ */ jsx12(ErrorBox, { parent: group }),
27812
+ /* @__PURE__ */ jsx12(
27715
27813
  Text,
27716
27814
  {
27717
27815
  parent: group,
@@ -27726,7 +27824,7 @@ var Error3d = ({
27726
27824
  ]
27727
27825
  }
27728
27826
  ),
27729
- isHovered && hoverPosition ? /* @__PURE__ */ jsx11(
27827
+ isHovered && hoverPosition ? /* @__PURE__ */ jsx12(
27730
27828
  Html,
27731
27829
  {
27732
27830
  position: hoverPosition,
@@ -27749,10 +27847,10 @@ var Error3d = ({
27749
27847
  ] });
27750
27848
  };
27751
27849
  var ErrorBox = ({ parent }) => {
27752
- const mesh = useMemo14(() => {
27753
- const m = new THREE11.Mesh(
27754
- new THREE11.BoxGeometry(0.5, 0.5, 0.5),
27755
- new THREE11.MeshStandardMaterial({
27850
+ const mesh = useMemo15(() => {
27851
+ const m = new THREE12.Mesh(
27852
+ new THREE12.BoxGeometry(0.5, 0.5, 0.5),
27853
+ new THREE12.MeshStandardMaterial({
27756
27854
  depthTest: false,
27757
27855
  transparent: true,
27758
27856
  color: "red",
@@ -27763,7 +27861,7 @@ var ErrorBox = ({ parent }) => {
27763
27861
  m.rotation.fromArray([Math.PI / 4, Math.PI / 4, 0]);
27764
27862
  return m;
27765
27863
  }, []);
27766
- useEffect17(() => {
27864
+ useEffect18(() => {
27767
27865
  parent.add(mesh);
27768
27866
  return () => {
27769
27867
  parent.remove(mesh);
@@ -27773,8 +27871,8 @@ var ErrorBox = ({ parent }) => {
27773
27871
  };
27774
27872
 
27775
27873
  // src/three-components/STLModel.tsx
27776
- import { useState as useState10, useEffect as useEffect18, useMemo as useMemo15 } from "react";
27777
- import * as THREE12 from "three";
27874
+ import { useState as useState11, useEffect as useEffect19, useMemo as useMemo16 } from "react";
27875
+ import * as THREE13 from "three";
27778
27876
  import { STLLoader } from "three-stdlib";
27779
27877
  function STLModel({
27780
27878
  stlUrl,
@@ -27784,8 +27882,8 @@ function STLModel({
27784
27882
  opacity = 1
27785
27883
  }) {
27786
27884
  const { rootObject } = useThree();
27787
- const [geom, setGeom] = useState10(null);
27788
- useEffect18(() => {
27885
+ const [geom, setGeom] = useState11(null);
27886
+ useEffect19(() => {
27789
27887
  const loader = new STLLoader();
27790
27888
  if (stlData) {
27791
27889
  try {
@@ -27803,16 +27901,16 @@ function STLModel({
27803
27901
  });
27804
27902
  }
27805
27903
  }, [stlUrl, stlData]);
27806
- const mesh = useMemo15(() => {
27904
+ const mesh = useMemo16(() => {
27807
27905
  if (!geom) return null;
27808
- const material = new THREE12.MeshStandardMaterial({
27809
- color: Array.isArray(color) ? new THREE12.Color(color[0], color[1], color[2]) : color,
27906
+ const material = new THREE13.MeshStandardMaterial({
27907
+ color: Array.isArray(color) ? new THREE13.Color(color[0], color[1], color[2]) : color,
27810
27908
  transparent: opacity !== 1,
27811
27909
  opacity
27812
27910
  });
27813
- return new THREE12.Mesh(geom, material);
27911
+ return new THREE13.Mesh(geom, material);
27814
27912
  }, [geom, color, opacity]);
27815
- useEffect18(() => {
27913
+ useEffect19(() => {
27816
27914
  if (!rootObject || !mesh) return;
27817
27915
  rootObject.add(mesh);
27818
27916
  return () => {
@@ -27847,7 +27945,7 @@ var ThreeErrorBoundary = class extends React10.Component {
27847
27945
  };
27848
27946
 
27849
27947
  // src/CadViewerJscad.tsx
27850
- import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
27948
+ import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
27851
27949
  var CadViewerJscad = forwardRef3(
27852
27950
  ({
27853
27951
  soup,
@@ -27858,12 +27956,12 @@ var CadViewerJscad = forwardRef3(
27858
27956
  onUserInteraction
27859
27957
  }, ref) => {
27860
27958
  const childrenSoup = useConvertChildrenToSoup(children);
27861
- const internalCircuitJson = useMemo16(() => {
27959
+ const internalCircuitJson = useMemo17(() => {
27862
27960
  const cj = soup ?? circuitJson;
27863
27961
  return cj ?? childrenSoup;
27864
27962
  }, [soup, circuitJson, childrenSoup]);
27865
27963
  const boardGeom = useBoardGeomBuilder(internalCircuitJson);
27866
- const initialCameraPosition = useMemo16(() => {
27964
+ const initialCameraPosition = useMemo17(() => {
27867
27965
  if (!internalCircuitJson) return [5, 5, 5];
27868
27966
  try {
27869
27967
  const board = su4(internalCircuitJson).pcb_board.list()[0];
@@ -27882,7 +27980,7 @@ var CadViewerJscad = forwardRef3(
27882
27980
  return [5, 5, 5];
27883
27981
  }
27884
27982
  }, [internalCircuitJson]);
27885
- const boardDimensions = useMemo16(() => {
27983
+ const boardDimensions = useMemo17(() => {
27886
27984
  if (!internalCircuitJson) return void 0;
27887
27985
  try {
27888
27986
  const board = su4(internalCircuitJson).pcb_board.list()[0];
@@ -27905,7 +28003,7 @@ var CadViewerJscad = forwardRef3(
27905
28003
  boardDimensions,
27906
28004
  onUserInteraction,
27907
28005
  children: [
27908
- boardStls.map(({ stlData, color }, index) => /* @__PURE__ */ jsx12(
28006
+ boardStls.map(({ stlData, color }, index) => /* @__PURE__ */ jsx13(
27909
28007
  STLModel,
27910
28008
  {
27911
28009
  stlData,
@@ -27914,11 +28012,11 @@ var CadViewerJscad = forwardRef3(
27914
28012
  },
27915
28013
  `board-${index - boardStls.length}`
27916
28014
  )),
27917
- cad_components.map((cad_component2) => /* @__PURE__ */ jsx12(
28015
+ cad_components.map((cad_component2) => /* @__PURE__ */ jsx13(
27918
28016
  ThreeErrorBoundary,
27919
28017
  {
27920
- fallback: ({ error }) => /* @__PURE__ */ jsx12(Error3d, { cad_component: cad_component2, error }),
27921
- children: /* @__PURE__ */ jsx12(
28018
+ fallback: ({ error }) => /* @__PURE__ */ jsx13(Error3d, { cad_component: cad_component2, error }),
28019
+ children: /* @__PURE__ */ jsx13(
27922
28020
  AnyCadComponent,
27923
28021
  {
27924
28022
  cad_component: cad_component2,
@@ -27937,22 +28035,22 @@ var CadViewerJscad = forwardRef3(
27937
28035
 
27938
28036
  // src/CadViewerManifold.tsx
27939
28037
  import { su as su13 } from "@tscircuit/circuit-json-util";
27940
- import { useEffect as useEffect20, useMemo as useMemo18, useState as useState13 } from "react";
28038
+ import { useEffect as useEffect21, useMemo as useMemo19, useState as useState14 } from "react";
27941
28039
 
27942
28040
  // src/hooks/useManifoldBoardBuilder.ts
27943
- import { useState as useState12, useEffect as useEffect19, useMemo as useMemo17, useRef as useRef7 } from "react";
28041
+ import { useState as useState13, useEffect as useEffect20, useMemo as useMemo18, useRef as useRef7 } from "react";
27944
28042
  import { su as su12 } from "@tscircuit/circuit-json-util";
27945
- import * as THREE20 from "three";
28043
+ import * as THREE21 from "three";
27946
28044
 
27947
28045
  // src/utils/manifold-mesh-to-three-geometry.ts
27948
- import * as THREE13 from "three";
28046
+ import * as THREE14 from "three";
27949
28047
  function manifoldMeshToThreeGeometry(manifoldMesh) {
27950
- const geometry = new THREE13.BufferGeometry();
28048
+ const geometry = new THREE14.BufferGeometry();
27951
28049
  geometry.setAttribute(
27952
28050
  "position",
27953
- new THREE13.Float32BufferAttribute(manifoldMesh.vertProperties, 3)
28051
+ new THREE14.Float32BufferAttribute(manifoldMesh.vertProperties, 3)
27954
28052
  );
27955
- geometry.setIndex(new THREE13.Uint32BufferAttribute(manifoldMesh.triVerts, 1));
28053
+ geometry.setIndex(new THREE14.Uint32BufferAttribute(manifoldMesh.triVerts, 1));
27956
28054
  if (manifoldMesh.runIndex && manifoldMesh.runIndex.length > 1 && manifoldMesh.runOriginalID) {
27957
28055
  for (let i = 0; i < manifoldMesh.runIndex.length - 1; i++) {
27958
28056
  const start = manifoldMesh.runIndex[i];
@@ -27966,7 +28064,7 @@ function manifoldMeshToThreeGeometry(manifoldMesh) {
27966
28064
  }
27967
28065
 
27968
28066
  // src/utils/trace-texture.ts
27969
- import * as THREE14 from "three";
28067
+ import * as THREE15 from "three";
27970
28068
  import { su as su5 } from "@tscircuit/circuit-json-util";
27971
28069
  function isWireRoutePoint(point2) {
27972
28070
  return point2 && point2.route_type === "wire" && typeof point2.layer === "string" && typeof point2.width === "number";
@@ -28049,10 +28147,10 @@ function createTraceTextureForLayer({
28049
28147
  }
28050
28148
  });
28051
28149
  ctx.globalCompositeOperation = "source-over";
28052
- const texture = new THREE14.CanvasTexture(canvas);
28150
+ const texture = new THREE15.CanvasTexture(canvas);
28053
28151
  texture.generateMipmaps = true;
28054
- texture.minFilter = THREE14.LinearMipmapLinearFilter;
28055
- texture.magFilter = THREE14.LinearFilter;
28152
+ texture.minFilter = THREE15.LinearMipmapLinearFilter;
28153
+ texture.magFilter = THREE15.LinearFilter;
28056
28154
  texture.anisotropy = 16;
28057
28155
  texture.needsUpdate = true;
28058
28156
  return texture;
@@ -28060,7 +28158,7 @@ function createTraceTextureForLayer({
28060
28158
 
28061
28159
  // src/utils/silkscreen-texture.ts
28062
28160
  var import_text2 = __toESM(require_text(), 1);
28063
- import * as THREE15 from "three";
28161
+ import * as THREE16 from "three";
28064
28162
  import { su as su6 } from "@tscircuit/circuit-json-util";
28065
28163
  function createSilkscreenTextureForLayer({
28066
28164
  layer,
@@ -28189,10 +28287,10 @@ function createSilkscreenTextureForLayer({
28189
28287
  ctx.stroke();
28190
28288
  });
28191
28289
  });
28192
- const texture = new THREE15.CanvasTexture(canvas);
28290
+ const texture = new THREE16.CanvasTexture(canvas);
28193
28291
  texture.generateMipmaps = true;
28194
- texture.minFilter = THREE15.LinearMipmapLinearFilter;
28195
- texture.magFilter = THREE15.LinearFilter;
28292
+ texture.minFilter = THREE16.LinearMipmapLinearFilter;
28293
+ texture.magFilter = THREE16.LinearFilter;
28196
28294
  texture.anisotropy = 16;
28197
28295
  texture.needsUpdate = true;
28198
28296
  return texture;
@@ -28265,8 +28363,8 @@ function processNonPlatedHolesForManifold(Manifold, circuitJson, pcbThickness, m
28265
28363
 
28266
28364
  // src/utils/manifold/process-plated-holes.ts
28267
28365
  import { su as su8 } from "@tscircuit/circuit-json-util";
28268
- import * as THREE16 from "three";
28269
- var COPPER_COLOR = new THREE16.Color(...colors.copper);
28366
+ import * as THREE17 from "three";
28367
+ var COPPER_COLOR = new THREE17.Color(...colors.copper);
28270
28368
  function processPlatedHolesForManifold(Manifold, circuitJson, pcbThickness, manifoldInstancesForCleanup) {
28271
28369
  const platedHoleBoardDrills = [];
28272
28370
  const pcbPlatedHoles = su8(circuitJson).pcb_plated_hole.list();
@@ -28481,7 +28579,7 @@ function processPlatedHolesForManifold(Manifold, circuitJson, pcbThickness, mani
28481
28579
 
28482
28580
  // src/utils/manifold/process-vias.ts
28483
28581
  import { su as su9 } from "@tscircuit/circuit-json-util";
28484
- import * as THREE17 from "three";
28582
+ import * as THREE18 from "three";
28485
28583
 
28486
28584
  // src/utils/via-geoms.ts
28487
28585
  function createViaCopper({
@@ -28514,7 +28612,7 @@ function createViaCopper({
28514
28612
  }
28515
28613
 
28516
28614
  // src/utils/manifold/process-vias.ts
28517
- var COPPER_COLOR2 = new THREE17.Color(...colors.copper);
28615
+ var COPPER_COLOR2 = new THREE18.Color(...colors.copper);
28518
28616
  function processViasForManifold(Manifold, circuitJson, pcbThickness, manifoldInstancesForCleanup) {
28519
28617
  const viaBoardDrills = [];
28520
28618
  const pcbVias = su9(circuitJson).pcb_via.list();
@@ -28560,7 +28658,7 @@ function processViasForManifold(Manifold, circuitJson, pcbThickness, manifoldIns
28560
28658
 
28561
28659
  // src/utils/manifold/process-smt-pads.ts
28562
28660
  import { su as su10 } from "@tscircuit/circuit-json-util";
28563
- import * as THREE18 from "three";
28661
+ import * as THREE19 from "three";
28564
28662
 
28565
28663
  // src/utils/pad-geoms.ts
28566
28664
  function createPadManifoldOp({
@@ -28577,7 +28675,7 @@ function createPadManifoldOp({
28577
28675
  }
28578
28676
 
28579
28677
  // src/utils/manifold/process-smt-pads.ts
28580
- var COPPER_COLOR3 = new THREE18.Color(...colors.copper);
28678
+ var COPPER_COLOR3 = new THREE19.Color(...colors.copper);
28581
28679
  function processSmtPadsForManifold(Manifold, circuitJson, pcbThickness, manifoldInstancesForCleanup, holeUnion) {
28582
28680
  const smtPadGeoms = [];
28583
28681
  const smtPads = su10(circuitJson).pcb_smtpad.list();
@@ -28666,8 +28764,8 @@ function createManifoldBoard(Manifold, CrossSection, boardData, pcbThickness, ma
28666
28764
  }
28667
28765
 
28668
28766
  // src/utils/manifold/process-copper-pours.ts
28669
- import * as THREE19 from "three";
28670
- var COPPER_COLOR4 = new THREE19.Color(...colors.copper);
28767
+ import * as THREE20 from "three";
28768
+ var COPPER_COLOR4 = new THREE20.Color(...colors.copper);
28671
28769
  var arePointsClockwise3 = (points) => {
28672
28770
  let area = 0;
28673
28771
  for (let i = 0; i < points.length; i++) {
@@ -28843,20 +28941,20 @@ function processCutoutsForManifold(Manifold, CrossSection, circuitJson, pcbThick
28843
28941
 
28844
28942
  // src/hooks/useManifoldBoardBuilder.ts
28845
28943
  var useManifoldBoardBuilder = (manifoldJSModule, circuitJson) => {
28846
- const [geoms, setGeoms] = useState12(null);
28847
- const [textures, setTextures] = useState12(null);
28848
- const [pcbThickness, setPcbThickness] = useState12(null);
28849
- const [error, setError] = useState12(null);
28850
- const [isLoading, setIsLoading] = useState12(true);
28944
+ const [geoms, setGeoms] = useState13(null);
28945
+ const [textures, setTextures] = useState13(null);
28946
+ const [pcbThickness, setPcbThickness] = useState13(null);
28947
+ const [error, setError] = useState13(null);
28948
+ const [isLoading, setIsLoading] = useState13(true);
28851
28949
  const manifoldInstancesForCleanup = useRef7([]);
28852
- const boardData = useMemo17(() => {
28950
+ const boardData = useMemo18(() => {
28853
28951
  const boards = su12(circuitJson).pcb_board.list();
28854
28952
  if (boards.length === 0) {
28855
28953
  return null;
28856
28954
  }
28857
28955
  return boards[0];
28858
28956
  }, [circuitJson]);
28859
- useEffect19(() => {
28957
+ useEffect20(() => {
28860
28958
  if (!manifoldJSModule || !boardData) {
28861
28959
  setGeoms(null);
28862
28960
  setTextures(null);
@@ -28943,7 +29041,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson) => {
28943
29041
  const matColorArray = boardMaterialColors[boardData.material] ?? colors.fr4Green;
28944
29042
  currentGeoms.board = {
28945
29043
  geometry: finalBoardGeom,
28946
- color: new THREE20.Color(
29044
+ color: new THREE21.Color(
28947
29045
  matColorArray[0],
28948
29046
  matColorArray[1],
28949
29047
  matColorArray[2]
@@ -29026,16 +29124,16 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson) => {
29026
29124
  };
29027
29125
 
29028
29126
  // src/utils/manifold/create-three-geometry-meshes.ts
29029
- import * as THREE21 from "three";
29127
+ import * as THREE22 from "three";
29030
29128
  function createGeometryMeshes(geoms) {
29031
29129
  const meshes = [];
29032
29130
  if (!geoms) return meshes;
29033
29131
  if (geoms.board && geoms.board.geometry) {
29034
- const mesh = new THREE21.Mesh(
29132
+ const mesh = new THREE22.Mesh(
29035
29133
  geoms.board.geometry,
29036
- new THREE21.MeshStandardMaterial({
29134
+ new THREE22.MeshStandardMaterial({
29037
29135
  color: geoms.board.color,
29038
- side: THREE21.DoubleSide,
29136
+ side: THREE22.DoubleSide,
29039
29137
  flatShading: true
29040
29138
  })
29041
29139
  );
@@ -29045,11 +29143,11 @@ function createGeometryMeshes(geoms) {
29045
29143
  const createMeshesFromArray = (geomArray) => {
29046
29144
  if (geomArray) {
29047
29145
  geomArray.forEach((comp) => {
29048
- const mesh = new THREE21.Mesh(
29146
+ const mesh = new THREE22.Mesh(
29049
29147
  comp.geometry,
29050
- new THREE21.MeshStandardMaterial({
29148
+ new THREE22.MeshStandardMaterial({
29051
29149
  color: comp.color,
29052
- side: THREE21.DoubleSide,
29150
+ side: THREE22.DoubleSide,
29053
29151
  flatShading: true
29054
29152
  // Consistent with board
29055
29153
  })
@@ -29067,21 +29165,21 @@ function createGeometryMeshes(geoms) {
29067
29165
  }
29068
29166
 
29069
29167
  // src/utils/manifold/create-three-texture-meshes.ts
29070
- import * as THREE22 from "three";
29168
+ import * as THREE23 from "three";
29071
29169
  function createTextureMeshes(textures, boardData, pcbThickness) {
29072
29170
  const meshes = [];
29073
29171
  if (!textures || !boardData || pcbThickness === null) return meshes;
29074
29172
  const createTexturePlane = (texture, yOffset, isBottomLayer, keySuffix) => {
29075
29173
  if (!texture) return null;
29076
- const planeGeom = new THREE22.PlaneGeometry(boardData.width, boardData.height);
29077
- const material = new THREE22.MeshBasicMaterial({
29174
+ const planeGeom = new THREE23.PlaneGeometry(boardData.width, boardData.height);
29175
+ const material = new THREE23.MeshBasicMaterial({
29078
29176
  map: texture,
29079
29177
  transparent: true,
29080
- side: THREE22.DoubleSide,
29178
+ side: THREE23.DoubleSide,
29081
29179
  depthWrite: false
29082
29180
  // Important for layers to avoid z-fighting issues with board itself
29083
29181
  });
29084
- const mesh = new THREE22.Mesh(planeGeom, material);
29182
+ const mesh = new THREE23.Mesh(planeGeom, material);
29085
29183
  mesh.position.set(boardData.center.x, boardData.center.y, yOffset);
29086
29184
  if (isBottomLayer) {
29087
29185
  mesh.rotation.set(Math.PI, 0, 0);
@@ -29123,13 +29221,13 @@ function createTextureMeshes(textures, boardData, pcbThickness) {
29123
29221
  }
29124
29222
 
29125
29223
  // src/CadViewerManifold.tsx
29126
- import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
29224
+ import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
29127
29225
  var BoardMeshes = ({
29128
29226
  geometryMeshes,
29129
29227
  textureMeshes
29130
29228
  }) => {
29131
29229
  const { rootObject } = useThree();
29132
- useEffect20(() => {
29230
+ useEffect21(() => {
29133
29231
  if (!rootObject) return;
29134
29232
  geometryMeshes.forEach((mesh) => rootObject.add(mesh));
29135
29233
  textureMeshes.forEach((mesh) => rootObject.add(mesh));
@@ -29149,12 +29247,12 @@ var CadViewerManifold = ({
29149
29247
  children
29150
29248
  }) => {
29151
29249
  const childrenCircuitJson = useConvertChildrenToSoup(children);
29152
- const circuitJson = useMemo18(() => {
29250
+ const circuitJson = useMemo19(() => {
29153
29251
  return circuitJsonProp ?? childrenCircuitJson;
29154
29252
  }, [circuitJsonProp, childrenCircuitJson]);
29155
- const [manifoldJSModule, setManifoldJSModule] = useState13(null);
29156
- const [manifoldLoadingError, setManifoldLoadingError] = useState13(null);
29157
- useEffect20(() => {
29253
+ const [manifoldJSModule, setManifoldJSModule] = useState14(null);
29254
+ const [manifoldLoadingError, setManifoldLoadingError] = useState14(null);
29255
+ useEffect21(() => {
29158
29256
  const initManifold = async (ManifoldModule) => {
29159
29257
  try {
29160
29258
  const loadedModule = await ManifoldModule();
@@ -29219,21 +29317,21 @@ try {
29219
29317
  isLoading: builderIsLoading,
29220
29318
  boardData
29221
29319
  } = useManifoldBoardBuilder(manifoldJSModule, circuitJson);
29222
- const geometryMeshes = useMemo18(() => createGeometryMeshes(geoms), [geoms]);
29223
- const textureMeshes = useMemo18(
29320
+ const geometryMeshes = useMemo19(() => createGeometryMeshes(geoms), [geoms]);
29321
+ const textureMeshes = useMemo19(
29224
29322
  () => createTextureMeshes(textures, boardData, pcbThickness),
29225
29323
  [textures, boardData, pcbThickness]
29226
29324
  );
29227
- const cadComponents = useMemo18(
29325
+ const cadComponents = useMemo19(
29228
29326
  () => su13(circuitJson).cad_component.list(),
29229
29327
  [circuitJson]
29230
29328
  );
29231
- const boardDimensions = useMemo18(() => {
29329
+ const boardDimensions = useMemo19(() => {
29232
29330
  if (!boardData) return void 0;
29233
29331
  const { width: width10 = 0, height: height10 = 0 } = boardData;
29234
29332
  return { width: width10, height: height10 };
29235
29333
  }, [boardData]);
29236
- const initialCameraPosition = useMemo18(() => {
29334
+ const initialCameraPosition = useMemo19(() => {
29237
29335
  if (!boardData) return [5, 5, 5];
29238
29336
  const { width: width10 = 0, height: height10 = 0 } = boardData;
29239
29337
  const safeWidth = Math.max(width10, 1);
@@ -29259,7 +29357,7 @@ try {
29259
29357
  );
29260
29358
  }
29261
29359
  if (!manifoldJSModule) {
29262
- return /* @__PURE__ */ jsx13("div", { style: { padding: "1em" }, children: "Loading Manifold module..." });
29360
+ return /* @__PURE__ */ jsx14("div", { style: { padding: "1em" }, children: "Loading Manifold module..." });
29263
29361
  }
29264
29362
  if (builderError) {
29265
29363
  return /* @__PURE__ */ jsxs7(
@@ -29279,7 +29377,7 @@ try {
29279
29377
  );
29280
29378
  }
29281
29379
  if (builderIsLoading) {
29282
- return /* @__PURE__ */ jsx13("div", { style: { padding: "1em" }, children: "Processing board geometry..." });
29380
+ return /* @__PURE__ */ jsx14("div", { style: { padding: "1em" }, children: "Processing board geometry..." });
29283
29381
  }
29284
29382
  return /* @__PURE__ */ jsxs7(
29285
29383
  CadViewerContainer,
@@ -29290,18 +29388,18 @@ try {
29290
29388
  boardDimensions,
29291
29389
  onUserInteraction,
29292
29390
  children: [
29293
- /* @__PURE__ */ jsx13(
29391
+ /* @__PURE__ */ jsx14(
29294
29392
  BoardMeshes,
29295
29393
  {
29296
29394
  geometryMeshes,
29297
29395
  textureMeshes
29298
29396
  }
29299
29397
  ),
29300
- cadComponents.map((cad_component2) => /* @__PURE__ */ jsx13(
29398
+ cadComponents.map((cad_component2) => /* @__PURE__ */ jsx14(
29301
29399
  ThreeErrorBoundary,
29302
29400
  {
29303
- fallback: ({ error }) => /* @__PURE__ */ jsx13(Error3d, { cad_component: cad_component2, error }),
29304
- children: /* @__PURE__ */ jsx13(
29401
+ fallback: ({ error }) => /* @__PURE__ */ jsx14(Error3d, { cad_component: cad_component2, error }),
29402
+ children: /* @__PURE__ */ jsx14(
29305
29403
  AnyCadComponent,
29306
29404
  {
29307
29405
  cad_component: cad_component2,
@@ -29318,10 +29416,10 @@ try {
29318
29416
  var CadViewerManifold_default = CadViewerManifold;
29319
29417
 
29320
29418
  // src/hooks/useContextMenu.ts
29321
- import { useState as useState14, useCallback as useCallback6, useRef as useRef8, useEffect as useEffect21 } from "react";
29419
+ import { useState as useState15, useCallback as useCallback6, useRef as useRef8, useEffect as useEffect22 } from "react";
29322
29420
  var useContextMenu = ({ containerRef }) => {
29323
- const [menuVisible, setMenuVisible] = useState14(false);
29324
- const [menuPos, setMenuPos] = useState14({
29421
+ const [menuVisible, setMenuVisible] = useState15(false);
29422
+ const [menuPos, setMenuPos] = useState15({
29325
29423
  x: 0,
29326
29424
  y: 0
29327
29425
  });
@@ -29426,7 +29524,7 @@ var useContextMenu = ({ containerRef }) => {
29426
29524
  setMenuVisible(false);
29427
29525
  }
29428
29526
  }, []);
29429
- useEffect21(() => {
29527
+ useEffect22(() => {
29430
29528
  if (menuVisible) {
29431
29529
  document.addEventListener("mousedown", handleClickAway);
29432
29530
  document.addEventListener("touchstart", handleClickAway);
@@ -29489,12 +29587,12 @@ var useGlobalDownloadGltf = () => {
29489
29587
  };
29490
29588
 
29491
29589
  // src/CadViewer.tsx
29492
- import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
29590
+ import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
29493
29591
  var CadViewer = (props) => {
29494
- const [engine, setEngine] = useState15("manifold");
29592
+ const [engine, setEngine] = useState16("manifold");
29495
29593
  const containerRef = useRef9(null);
29496
- const [autoRotate, setAutoRotate] = useState15(true);
29497
- const [autoRotateUserToggled, setAutoRotateUserToggled] = useState15(false);
29594
+ const [autoRotate, setAutoRotate] = useState16(true);
29595
+ const [autoRotateUserToggled, setAutoRotateUserToggled] = useState16(false);
29498
29596
  const {
29499
29597
  menuVisible,
29500
29598
  menuPos,
@@ -29518,13 +29616,13 @@ var CadViewer = (props) => {
29518
29616
  setEngine(newEngine);
29519
29617
  setMenuVisible(false);
29520
29618
  };
29521
- useEffect22(() => {
29619
+ useEffect23(() => {
29522
29620
  const stored = window.localStorage.getItem("cadViewerEngine");
29523
29621
  if (stored === "jscad" || stored === "manifold") {
29524
29622
  setEngine(stored);
29525
29623
  }
29526
29624
  }, []);
29527
- useEffect22(() => {
29625
+ useEffect23(() => {
29528
29626
  window.localStorage.setItem("cadViewerEngine", engine);
29529
29627
  }, [engine]);
29530
29628
  const viewerKey = props.circuitJson ? JSON.stringify(props.circuitJson) : void 0;
@@ -29544,14 +29642,14 @@ var CadViewer = (props) => {
29544
29642
  },
29545
29643
  ...contextMenuEventHandlers,
29546
29644
  children: [
29547
- engine === "jscad" ? /* @__PURE__ */ jsx14(
29645
+ engine === "jscad" ? /* @__PURE__ */ jsx15(
29548
29646
  CadViewerJscad,
29549
29647
  {
29550
29648
  ...props,
29551
29649
  autoRotateDisabled: props.autoRotateDisabled || !autoRotate,
29552
29650
  onUserInteraction: handleUserInteraction
29553
29651
  }
29554
- ) : /* @__PURE__ */ jsx14(
29652
+ ) : /* @__PURE__ */ jsx15(
29555
29653
  CadViewerManifold_default,
29556
29654
  {
29557
29655
  ...props,
@@ -29576,7 +29674,7 @@ var CadViewer = (props) => {
29576
29674
  },
29577
29675
  children: [
29578
29676
  "Engine: ",
29579
- /* @__PURE__ */ jsx14("b", { children: engine === "jscad" ? "JSCAD" : "Manifold" })
29677
+ /* @__PURE__ */ jsx15("b", { children: engine === "jscad" ? "JSCAD" : "Manifold" })
29580
29678
  ]
29581
29679
  }
29582
29680
  ),
@@ -29622,7 +29720,7 @@ var CadViewer = (props) => {
29622
29720
  "Switch to ",
29623
29721
  engine === "jscad" ? "Manifold" : "JSCAD",
29624
29722
  " Engine",
29625
- /* @__PURE__ */ jsx14(
29723
+ /* @__PURE__ */ jsx15(
29626
29724
  "span",
29627
29725
  {
29628
29726
  style: {
@@ -29658,12 +29756,12 @@ var CadViewer = (props) => {
29658
29756
  onMouseOver: (e) => e.currentTarget.style.background = "#2d313a",
29659
29757
  onMouseOut: (e) => e.currentTarget.style.background = "transparent",
29660
29758
  children: [
29661
- /* @__PURE__ */ jsx14("span", { style: { marginRight: 8 }, children: autoRotate ? "\u2714" : "" }),
29759
+ /* @__PURE__ */ jsx15("span", { style: { marginRight: 8 }, children: autoRotate ? "\u2714" : "" }),
29662
29760
  "Auto rotate"
29663
29761
  ]
29664
29762
  }
29665
29763
  ),
29666
- /* @__PURE__ */ jsx14(
29764
+ /* @__PURE__ */ jsx15(
29667
29765
  "div",
29668
29766
  {
29669
29767
  style: {
@@ -29686,7 +29784,7 @@ var CadViewer = (props) => {
29686
29784
  children: "Download GLTF"
29687
29785
  }
29688
29786
  ),
29689
- /* @__PURE__ */ jsx14(
29787
+ /* @__PURE__ */ jsx15(
29690
29788
  "div",
29691
29789
  {
29692
29790
  style: {
@@ -29725,11 +29823,11 @@ var CadViewer = (props) => {
29725
29823
  // src/convert-circuit-json-to-3d-svg.ts
29726
29824
  var import_debug = __toESM(require_browser(), 1);
29727
29825
  import { su as su14 } from "@tscircuit/circuit-json-util";
29728
- import * as THREE26 from "three";
29826
+ import * as THREE27 from "three";
29729
29827
  import { SVGRenderer } from "three/examples/jsm/renderers/SVGRenderer.js";
29730
29828
 
29731
29829
  // src/utils/create-geometry-from-polygons.ts
29732
- import * as THREE23 from "three";
29830
+ import * as THREE24 from "three";
29733
29831
  import { BufferGeometry as BufferGeometry3, Float32BufferAttribute as Float32BufferAttribute2 } from "three";
29734
29832
  function createGeometryFromPolygons(polygons) {
29735
29833
  const geometry = new BufferGeometry3();
@@ -29743,12 +29841,12 @@ function createGeometryFromPolygons(polygons) {
29743
29841
  ...polygon2.vertices[i + 1]
29744
29842
  // Third vertex
29745
29843
  );
29746
- const v1 = new THREE23.Vector3(...polygon2.vertices[0]);
29747
- const v2 = new THREE23.Vector3(...polygon2.vertices[i]);
29748
- const v3 = new THREE23.Vector3(...polygon2.vertices[i + 1]);
29749
- const normal = new THREE23.Vector3().crossVectors(
29750
- new THREE23.Vector3().subVectors(v2, v1),
29751
- new THREE23.Vector3().subVectors(v3, v1)
29844
+ const v1 = new THREE24.Vector3(...polygon2.vertices[0]);
29845
+ const v2 = new THREE24.Vector3(...polygon2.vertices[i]);
29846
+ const v3 = new THREE24.Vector3(...polygon2.vertices[i + 1]);
29847
+ const normal = new THREE24.Vector3().crossVectors(
29848
+ new THREE24.Vector3().subVectors(v2, v1),
29849
+ new THREE24.Vector3().subVectors(v3, v1)
29752
29850
  ).normalize();
29753
29851
  normals.push(
29754
29852
  normal.x,
@@ -29771,34 +29869,40 @@ function createGeometryFromPolygons(polygons) {
29771
29869
  // src/utils/render-component.tsx
29772
29870
  var import_modeling3 = __toESM(require_src(), 1);
29773
29871
  var import_jscad_planner2 = __toESM(require_dist(), 1);
29774
- import * as THREE25 from "three";
29872
+ import * as THREE26 from "three";
29775
29873
 
29776
29874
  // src/utils/load-model.ts
29777
- import * as THREE24 from "three";
29875
+ import * as THREE25 from "three";
29876
+ import { GLTFLoader as GLTFLoader2 } from "three/examples/jsm/loaders/GLTFLoader.js";
29778
29877
  import { OBJLoader as OBJLoader2 } from "three/examples/jsm/loaders/OBJLoader.js";
29779
29878
  import { STLLoader as STLLoader2 } from "three/examples/jsm/loaders/STLLoader.js";
29780
29879
  async function load3DModel(url) {
29781
29880
  if (url.endsWith(".stl")) {
29782
29881
  const loader = new STLLoader2();
29783
29882
  const geometry = await loader.loadAsync(url);
29784
- const material = new THREE24.MeshStandardMaterial({
29883
+ const material = new THREE25.MeshStandardMaterial({
29785
29884
  color: 8947848,
29786
29885
  metalness: 0.5,
29787
29886
  roughness: 0.5
29788
29887
  });
29789
- return new THREE24.Mesh(geometry, material);
29888
+ return new THREE25.Mesh(geometry, material);
29790
29889
  }
29791
29890
  if (url.endsWith(".obj")) {
29792
29891
  const loader = new OBJLoader2();
29793
29892
  return await loader.loadAsync(url);
29794
29893
  }
29894
+ if (url.endsWith(".gltf") || url.endsWith(".glb")) {
29895
+ const loader = new GLTFLoader2();
29896
+ const gltf = await loader.loadAsync(url);
29897
+ return gltf.scene;
29898
+ }
29795
29899
  console.error("Unsupported file format or failed to load 3D model.");
29796
29900
  return null;
29797
29901
  }
29798
29902
 
29799
29903
  // src/utils/render-component.tsx
29800
29904
  async function renderComponent(component, scene) {
29801
- const url = component.model_obj_url ?? component.model_stl_url;
29905
+ const url = component.model_obj_url ?? component.model_stl_url ?? component.model_gltf_url;
29802
29906
  if (url) {
29803
29907
  const model = await load3DModel(url);
29804
29908
  if (model) {
@@ -29811,9 +29915,9 @@ async function renderComponent(component, scene) {
29811
29915
  }
29812
29916
  if (component.rotation) {
29813
29917
  model.rotation.set(
29814
- THREE25.MathUtils.degToRad(component.rotation.x ?? 0),
29815
- THREE25.MathUtils.degToRad(component.rotation.y ?? 0),
29816
- THREE25.MathUtils.degToRad(component.rotation.z ?? 0)
29918
+ THREE26.MathUtils.degToRad(component.rotation.x ?? 0),
29919
+ THREE26.MathUtils.degToRad(component.rotation.y ?? 0),
29920
+ THREE26.MathUtils.degToRad(component.rotation.z ?? 0)
29817
29921
  );
29818
29922
  }
29819
29923
  scene.add(model);
@@ -29827,13 +29931,13 @@ async function renderComponent(component, scene) {
29827
29931
  );
29828
29932
  if (jscadObject && (jscadObject.polygons || jscadObject.sides)) {
29829
29933
  const threeGeom = convertCSGToThreeGeom(jscadObject);
29830
- const material2 = new THREE25.MeshStandardMaterial({
29934
+ const material2 = new THREE26.MeshStandardMaterial({
29831
29935
  color: 8947848,
29832
29936
  metalness: 0.5,
29833
29937
  roughness: 0.5,
29834
- side: THREE25.DoubleSide
29938
+ side: THREE26.DoubleSide
29835
29939
  });
29836
- const mesh2 = new THREE25.Mesh(threeGeom, material2);
29940
+ const mesh2 = new THREE26.Mesh(threeGeom, material2);
29837
29941
  if (component.position) {
29838
29942
  mesh2.position.set(
29839
29943
  component.position.x ?? 0,
@@ -29843,9 +29947,9 @@ async function renderComponent(component, scene) {
29843
29947
  }
29844
29948
  if (component.rotation) {
29845
29949
  mesh2.rotation.set(
29846
- THREE25.MathUtils.degToRad(component.rotation.x ?? 0),
29847
- THREE25.MathUtils.degToRad(component.rotation.y ?? 0),
29848
- THREE25.MathUtils.degToRad(component.rotation.z ?? 0)
29950
+ THREE26.MathUtils.degToRad(component.rotation.x ?? 0),
29951
+ THREE26.MathUtils.degToRad(component.rotation.y ?? 0),
29952
+ THREE26.MathUtils.degToRad(component.rotation.z ?? 0)
29849
29953
  );
29850
29954
  }
29851
29955
  scene.add(mesh2);
@@ -29861,17 +29965,17 @@ async function renderComponent(component, scene) {
29861
29965
  if (!geom || !geom.polygons && !geom.sides) {
29862
29966
  continue;
29863
29967
  }
29864
- const color = new THREE25.Color(geomInfo.color);
29968
+ const color = new THREE26.Color(geomInfo.color);
29865
29969
  color.convertLinearToSRGB();
29866
29970
  const geomWithColor = { ...geom, color: [color.r, color.g, color.b] };
29867
29971
  const threeGeom = convertCSGToThreeGeom(geomWithColor);
29868
- const material2 = new THREE25.MeshStandardMaterial({
29972
+ const material2 = new THREE26.MeshStandardMaterial({
29869
29973
  vertexColors: true,
29870
29974
  metalness: 0.2,
29871
29975
  roughness: 0.8,
29872
- side: THREE25.DoubleSide
29976
+ side: THREE26.DoubleSide
29873
29977
  });
29874
- const mesh2 = new THREE25.Mesh(threeGeom, material2);
29978
+ const mesh2 = new THREE26.Mesh(threeGeom, material2);
29875
29979
  if (component.position) {
29876
29980
  mesh2.position.set(
29877
29981
  component.position.x ?? 0,
@@ -29881,22 +29985,22 @@ async function renderComponent(component, scene) {
29881
29985
  }
29882
29986
  if (component.rotation) {
29883
29987
  mesh2.rotation.set(
29884
- THREE25.MathUtils.degToRad(component.rotation.x ?? 0),
29885
- THREE25.MathUtils.degToRad(component.rotation.y ?? 0),
29886
- THREE25.MathUtils.degToRad(component.rotation.z ?? 0)
29988
+ THREE26.MathUtils.degToRad(component.rotation.x ?? 0),
29989
+ THREE26.MathUtils.degToRad(component.rotation.y ?? 0),
29990
+ THREE26.MathUtils.degToRad(component.rotation.z ?? 0)
29887
29991
  );
29888
29992
  }
29889
29993
  scene.add(mesh2);
29890
29994
  }
29891
29995
  return;
29892
29996
  }
29893
- const geometry = new THREE25.BoxGeometry(0.5, 0.5, 0.5);
29894
- const material = new THREE25.MeshStandardMaterial({
29997
+ const geometry = new THREE26.BoxGeometry(0.5, 0.5, 0.5);
29998
+ const material = new THREE26.MeshStandardMaterial({
29895
29999
  color: 16711680,
29896
30000
  transparent: true,
29897
30001
  opacity: 0.25
29898
30002
  });
29899
- const mesh = new THREE25.Mesh(geometry, material);
30003
+ const mesh = new THREE26.Mesh(geometry, material);
29900
30004
  if (component.position) {
29901
30005
  mesh.position.set(
29902
30006
  component.position.x ?? 0,
@@ -29917,11 +30021,11 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
29917
30021
  padding = 20,
29918
30022
  zoom = 1.5
29919
30023
  } = options;
29920
- const scene = new THREE26.Scene();
30024
+ const scene = new THREE27.Scene();
29921
30025
  const renderer = new SVGRenderer();
29922
30026
  renderer.setSize(width10, height10);
29923
- renderer.setClearColor(new THREE26.Color(backgroundColor), 1);
29924
- const camera = new THREE26.OrthographicCamera();
30027
+ renderer.setClearColor(new THREE27.Color(backgroundColor), 1);
30028
+ const camera = new THREE27.OrthographicCamera();
29925
30029
  const aspect = width10 / height10;
29926
30030
  const frustumSize = 100;
29927
30031
  const halfFrustumSize = frustumSize / 2 / zoom;
@@ -29935,11 +30039,11 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
29935
30039
  camera.position.set(position.x, position.y, position.z);
29936
30040
  camera.up.set(0, 1, 0);
29937
30041
  const lookAt = options.camera?.lookAt ?? { x: 0, y: 0, z: 0 };
29938
- camera.lookAt(new THREE26.Vector3(lookAt.x, lookAt.y, lookAt.z));
30042
+ camera.lookAt(new THREE27.Vector3(lookAt.x, lookAt.y, lookAt.z));
29939
30043
  camera.updateProjectionMatrix();
29940
- const ambientLight = new THREE26.AmbientLight(16777215, Math.PI / 2);
30044
+ const ambientLight = new THREE27.AmbientLight(16777215, Math.PI / 2);
29941
30045
  scene.add(ambientLight);
29942
- const pointLight = new THREE26.PointLight(16777215, Math.PI / 4);
30046
+ const pointLight = new THREE27.PointLight(16777215, Math.PI / 4);
29943
30047
  pointLight.position.set(-10, -10, 10);
29944
30048
  scene.add(pointLight);
29945
30049
  const components = su14(circuitJson).cad_component.list();
@@ -29952,8 +30056,8 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
29952
30056
  const g = geom;
29953
30057
  if (!g.polygons || g.polygons.length === 0) continue;
29954
30058
  const geometry = createGeometryFromPolygons(g.polygons);
29955
- const material = new THREE26.MeshStandardMaterial({
29956
- color: new THREE26.Color(
30059
+ const material = new THREE27.MeshStandardMaterial({
30060
+ color: new THREE27.Color(
29957
30061
  g.color?.[0] ?? 0,
29958
30062
  g.color?.[1] ?? 0,
29959
30063
  g.color?.[2] ?? 0
@@ -29962,18 +30066,18 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
29962
30066
  roughness: 0.8,
29963
30067
  opacity: 0.9,
29964
30068
  transparent: true,
29965
- side: THREE26.DoubleSide
30069
+ side: THREE27.DoubleSide
29966
30070
  });
29967
- const mesh = new THREE26.Mesh(geometry, material);
30071
+ const mesh = new THREE27.Mesh(geometry, material);
29968
30072
  scene.add(mesh);
29969
30073
  }
29970
30074
  }
29971
- const gridHelper = new THREE26.GridHelper(100, 100);
30075
+ const gridHelper = new THREE27.GridHelper(100, 100);
29972
30076
  gridHelper.rotation.x = Math.PI / 2;
29973
30077
  scene.add(gridHelper);
29974
- const box = new THREE26.Box3().setFromObject(scene);
29975
- const center = box.getCenter(new THREE26.Vector3());
29976
- const size2 = box.getSize(new THREE26.Vector3());
30078
+ const box = new THREE27.Box3().setFromObject(scene);
30079
+ const center = box.getCenter(new THREE27.Vector3());
30080
+ const size2 = box.getSize(new THREE27.Vector3());
29977
30081
  scene.position.sub(center);
29978
30082
  const maxDim = Math.max(size2.x, size2.y, size2.z);
29979
30083
  if (maxDim > 0) {
@@ -29991,10 +30095,10 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
29991
30095
 
29992
30096
  // src/hooks/exporter/gltf.ts
29993
30097
  import { GLTFExporter as GLTFExporter2 } from "three-stdlib";
29994
- import { useEffect as useEffect23, useState as useState16, useMemo as useMemo19, useCallback as useCallback9 } from "react";
30098
+ import { useEffect as useEffect24, useState as useState17, useMemo as useMemo20, useCallback as useCallback9 } from "react";
29995
30099
  function useSaveGltfAs(options = {}) {
29996
30100
  const parse = useParser(options);
29997
- const link = useMemo19(() => document.createElement("a"), []);
30101
+ const link = useMemo20(() => document.createElement("a"), []);
29998
30102
  const saveAs = async (filename) => {
29999
30103
  const name = filename ?? options.filename ?? "";
30000
30104
  if (options.binary == null) options.binary = name.endsWith(".glb");
@@ -30004,7 +30108,7 @@ function useSaveGltfAs(options = {}) {
30004
30108
  link.dispatchEvent(new MouseEvent("click"));
30005
30109
  URL.revokeObjectURL(url);
30006
30110
  };
30007
- useEffect23(
30111
+ useEffect24(
30008
30112
  () => () => {
30009
30113
  link.remove();
30010
30114
  instance = null;
@@ -30019,17 +30123,17 @@ function useSaveGltfAs(options = {}) {
30019
30123
  }
30020
30124
  function useExportGltfUrl(options = {}) {
30021
30125
  const parse = useParser(options);
30022
- const [url, setUrl] = useState16();
30023
- const [error, setError] = useState16();
30126
+ const [url, setUrl] = useState17();
30127
+ const [error, setError] = useState17();
30024
30128
  const ref = useCallback9(
30025
30129
  (instance) => parse(instance).then(setUrl).catch(setError),
30026
30130
  []
30027
30131
  );
30028
- useEffect23(() => () => URL.revokeObjectURL(url), [url]);
30132
+ useEffect24(() => () => URL.revokeObjectURL(url), [url]);
30029
30133
  return [ref, url, error];
30030
30134
  }
30031
30135
  function useParser(options = {}) {
30032
- const exporter = useMemo19(() => new GLTFExporter2(), []);
30136
+ const exporter = useMemo20(() => new GLTFExporter2(), []);
30033
30137
  return (instance) => {
30034
30138
  const { promise, resolve, reject } = Promise.withResolvers();
30035
30139
  exporter.parse(