brepjs 18.118.19 → 18.118.21

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 (96) hide show
  1. package/dist/2d.cjs +7 -7
  2. package/dist/2d.js +7 -7
  3. package/dist/{adjacencyFns-CA3Etyxq.js → adjacencyFns-Dgsl8VJ2.js} +27 -2
  4. package/dist/{adjacencyFns-Ds3HCvKX.cjs → adjacencyFns-h7eAxaRD.cjs} +27 -2
  5. package/dist/{blueprint-0DxFJgG3.js → blueprint-CwQmYoR4.js} +8 -8
  6. package/dist/{blueprint-BbWSvB5F.cjs → blueprint-DG-2uqNB.cjs} +19 -19
  7. package/dist/{blueprintFns-BaUv-Wlq.cjs → blueprintFns-FAuYTbQQ.cjs} +3 -3
  8. package/dist/{blueprintFns-cG_DFd8M.js → blueprintFns-aCrK18ZR.js} +3 -3
  9. package/dist/{blueprintSketcher-Cgz3qJx2.js → blueprintSketcher-VvIRL3M8.js} +5 -5
  10. package/dist/{blueprintSketcher-DKbyT3MJ.cjs → blueprintSketcher-k5dNnvzs.cjs} +21 -21
  11. package/dist/{boolean2D-B1WZsDzl.cjs → boolean2D-BmkwzUgt.cjs} +17 -17
  12. package/dist/{boolean2D-BgAUsrkF.js → boolean2D-qYYFeLWX.js} +6 -6
  13. package/dist/brepjs.cjs +35 -35
  14. package/dist/brepjs.js +29 -29
  15. package/dist/bug-BdOHwn_e.js +47 -0
  16. package/dist/{vec3-CFwOI0ZI.cjs → bug-O02CsAmt.cjs} +34 -0
  17. package/dist/{cameraFns-DIPrieGu.cjs → cameraFns-BZMHFbh9.cjs} +4 -4
  18. package/dist/{cameraFns-DdyBVRGK.js → cameraFns-CYU4C4N6.js} +4 -4
  19. package/dist/core.cjs +6 -5
  20. package/dist/core.js +4 -3
  21. package/dist/{cornerFinder-DxAdJ27L.cjs → cornerFinder-BEiSjmuO.cjs} +1 -1
  22. package/dist/{cornerFinder-Bz4GBpuu.js → cornerFinder-DhOm0L8g.js} +1 -1
  23. package/dist/{curveFns-Lkb1QlRl.js → curveFns-SNQ04JW6.js} +2 -2
  24. package/dist/{curveFns-_f5x9L6D.cjs → curveFns-YN8_CsqU.cjs} +2 -2
  25. package/dist/{drawFns-DrrUmioW.js → drawFns-8zxP0gC5.js} +15 -15
  26. package/dist/{drawFns-BL6RRjT0.cjs → drawFns-Dqsv_t37.cjs} +34 -34
  27. package/dist/{errors-DNWJsfVU.js → errors-B3CDG537.js} +2 -24
  28. package/dist/{errors-CXJtc4I7.cjs → errors-CJU8CHng.cjs} +3 -37
  29. package/dist/{faceFns-BapYNAxj.cjs → faceFns-C0SwZInk.cjs} +3 -3
  30. package/dist/{faceFns-CgTNP9kU.js → faceFns-CCu9ULQm.js} +3 -3
  31. package/dist/{healingFns-8zD9gHRr.cjs → healingFns-Bbl5KTIh.cjs} +6 -6
  32. package/dist/{healingFns-Bp8ixSdr.js → healingFns-D6Bizorp.js} +6 -6
  33. package/dist/{helpers-DGAx5Y2e.js → helpers-By-BruMN.js} +8 -7
  34. package/dist/{helpers-DARRNSnZ.cjs → helpers-Cv-lOGsc.cjs} +9 -8
  35. package/dist/{importFns-B8VrggoW.cjs → importFns-6eFs1L_G.cjs} +10 -10
  36. package/dist/{importFns-D8kNKBaP.js → importFns-Bcza0b4Y.js} +4 -4
  37. package/dist/io.cjs +2 -2
  38. package/dist/io.js +2 -2
  39. package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
  40. package/dist/kernel/occtWasm/occtWasmAdapter.d.ts +5 -2
  41. package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
  42. package/dist/kernel/occtWasm/occtWasmTypes.d.ts +4 -0
  43. package/dist/kernel/unsupported.d.ts +14 -0
  44. package/dist/{loftFns-DTJrpzK7.cjs → loftFns-Bbe5jRA-.cjs} +2 -2
  45. package/dist/{loftFns-CSdcxPhe.js → loftFns-DEReccFa.js} +2 -2
  46. package/dist/{measureFns-Pv782Tb2.js → measureFns-DHj5Z-5c.js} +4 -4
  47. package/dist/{measureFns-DBBUqf_V.cjs → measureFns-DMzw5wf0.cjs} +4 -4
  48. package/dist/measurement.cjs +1 -1
  49. package/dist/measurement.js +1 -1
  50. package/dist/{meshFns-CP_Gg9j9.cjs → meshFns-B9pPcwuD.cjs} +4 -4
  51. package/dist/{meshFns-CYFz0R29.js → meshFns-C2nLgSf2.js} +4 -4
  52. package/dist/{occtWasmAdapter-BgmRCYeD.js → occtWasmAdapter-5_6aHhcD.js} +43 -9
  53. package/dist/{occtWasmAdapter-CWX5KCl8.cjs → occtWasmAdapter-CIxwUim8.cjs} +56 -10
  54. package/dist/operations.cjs +2 -2
  55. package/dist/operations.js +2 -2
  56. package/dist/{planeOps-DSjjtrjg.js → planeOps-Cp6GQ23-.js} +1 -1
  57. package/dist/{planeOps-BA4HfgQu.cjs → planeOps-Cr25KWWA.cjs} +1 -1
  58. package/dist/{primitiveFns-cAodLWtw.js → primitiveFns-D2zyQa3w.js} +5 -5
  59. package/dist/{primitiveFns-BhfCCIWH.cjs → primitiveFns-DZXN7qDb.cjs} +5 -5
  60. package/dist/projection.cjs +1 -1
  61. package/dist/projection.js +1 -1
  62. package/dist/query.cjs +2 -2
  63. package/dist/query.js +2 -2
  64. package/dist/{refResolveFns-BF9Ag5ch.cjs → refResolveFns-CHm7tsm2.cjs} +6 -6
  65. package/dist/{refResolveFns-B7ixHjFn.js → refResolveFns-C_mHlM8R.js} +6 -6
  66. package/dist/result.cjs +4 -3
  67. package/dist/result.js +2 -1
  68. package/dist/{shapeFns-ey7LN7Bu.js → shapeFns-BakfS4c9.js} +3 -3
  69. package/dist/{shapeFns-DGEpliyN.cjs → shapeFns-DzXcfZHY.cjs} +3 -3
  70. package/dist/shapeRef.cjs +1 -1
  71. package/dist/shapeRef.js +1 -1
  72. package/dist/{shapeTypes-B1YVA0wM.js → shapeTypes-B5bBKbg9.js} +9 -9
  73. package/dist/{shapeTypes-DXLJEolb.cjs → shapeTypes-BfOb9vzc.cjs} +183 -183
  74. package/dist/sketching.cjs +3 -3
  75. package/dist/sketching.js +3 -3
  76. package/dist/{solidBuilders-CbdRC65U.cjs → solidBuilders-BgrXN-GP.cjs} +7 -7
  77. package/dist/{solidBuilders-Dzd09AEk.js → solidBuilders-DaTgm_Wj.js} +7 -7
  78. package/dist/{surfaceBuilders-DISUSNgU.js → surfaceBuilders-BdUP_OXk.js} +3 -3
  79. package/dist/{surfaceBuilders-M_S5pGJi.cjs → surfaceBuilders-CUNhA_3a.cjs} +3 -3
  80. package/dist/text.cjs +2 -2
  81. package/dist/text.js +2 -2
  82. package/dist/{textBlueprints-BNR8zfrZ.cjs → textBlueprints--5GSuYEm.cjs} +19 -18
  83. package/dist/{textBlueprints-BlN1vCZ2.js → textBlueprints-C_JaAGiG.js} +10 -9
  84. package/dist/{textMetrics-BcgFzxJW.js → textMetrics-829YpBdN.js} +2 -2
  85. package/dist/{textMetrics-kUZVQtvY.cjs → textMetrics-CyJlakdR.cjs} +2 -2
  86. package/dist/{threadFns-VuImNUwV.cjs → threadFns-BBELmTZv.cjs} +8 -8
  87. package/dist/{threadFns-CU9bwc38.js → threadFns-H0mRmS6I.js} +8 -8
  88. package/dist/topology/adjacencyFns.d.ts +4 -0
  89. package/dist/topology.cjs +9 -9
  90. package/dist/topology.js +9 -9
  91. package/dist/{topologyQueryFns-DQmiyVS8.js → topologyQueryFns-MAUFbsSp.js} +2 -2
  92. package/dist/{topologyQueryFns-WesEKd3r.cjs → topologyQueryFns-tns6VXoD.cjs} +2 -2
  93. package/dist/vectors.cjs +1 -1
  94. package/dist/vectors.js +1 -1
  95. package/package.json +1 -1
  96. package/dist/vec3-Dpha8d5k.js +0 -25
@@ -1,6 +1,6 @@
1
- const require_occtWasmAdapter = require("./occtWasmAdapter-CWX5KCl8.cjs");
2
- const require_vec3 = require("./vec3-CFwOI0ZI.cjs");
3
- const require_errors = require("./errors-CXJtc4I7.cjs");
1
+ const require_occtWasmAdapter = require("./occtWasmAdapter-CIxwUim8.cjs");
2
+ const require_bug = require("./bug-O02CsAmt.cjs");
3
+ const require_errors = require("./errors-CJU8CHng.cjs");
4
4
  //#region src/kernel/quality.ts
5
5
  /**
6
6
  * Extract-time deflection per level. `'standard'` matches brepjs's historical
@@ -711,7 +711,7 @@ function fuseAllNative(oc, shapes, options = {}) {
711
711
  function fuseAllPairwiseRange(oc, shapes, start, end, options) {
712
712
  options.signal?.throwIfAborted();
713
713
  const count = end - start;
714
- if (count === 1) return require_vec3.wasmIndex(shapes, start);
714
+ if (count === 1) return require_bug.wasmIndex(shapes, start);
715
715
  if (count === 2) return fuse$1(oc, shapes[start], shapes[start + 1], {
716
716
  ...options,
717
717
  simplify: false
@@ -741,7 +741,7 @@ function fuseAllPairwise(oc, shapes, options = {}) {
741
741
  */
742
742
  function fuseAll$1(oc, shapes, options = {}) {
743
743
  if (shapes.length === 0) throw new Error("fuseAll requires at least one shape");
744
- if (shapes.length === 1) return require_vec3.wasmIndex(shapes, 0);
744
+ if (shapes.length === 1) return require_bug.wasmIndex(shapes, 0);
745
745
  const { strategy = "native" } = options;
746
746
  if (strategy === "pairwise") return fuseAllPairwise(oc, shapes, options);
747
747
  return fuseAllNative(oc, shapes, options);
@@ -1337,7 +1337,7 @@ function makeEllipseArc$1(oc, center, normal, majorRadius, minorRadius, startAng
1337
1337
  function makeBezierEdge$1(oc, points) {
1338
1338
  const arr = new oc.TColgp_Array1OfPnt_2(1, points.length);
1339
1339
  for (let i = 0; i < points.length; i++) {
1340
- const p = require_vec3.wasmIndex(points, i);
1340
+ const p = require_bug.wasmIndex(points, i);
1341
1341
  const pnt = new oc.gp_Pnt_3(p[0], p[1], p[2]);
1342
1342
  arr.SetValue_1(i + 1, pnt);
1343
1343
  pnt.delete();
@@ -3957,7 +3957,7 @@ function makeFaceOnSurface$1(oc, surfaceOrFace, wire) {
3957
3957
  function bsplineSurface$1(oc, points, rows, cols) {
3958
3958
  const arr = new oc.TColgp_Array2OfPnt_2(1, rows, 1, cols);
3959
3959
  for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) {
3960
- const pt = require_vec3.wasmIndex(points, r * cols + c);
3960
+ const pt = require_bug.wasmIndex(points, r * cols + c);
3961
3961
  const pnt = new oc.gp_Pnt_3(pt[0], pt[1], pt[2]);
3962
3962
  arr.SetValue_1(r + 1, c + 1, pnt);
3963
3963
  pnt.delete();
@@ -3979,10 +3979,10 @@ function triangulatedSurface$1(oc, points, rows, cols) {
3979
3979
  const i10 = (r + 1) * cols + c;
3980
3980
  const i01 = r * cols + (c + 1);
3981
3981
  const i11 = (r + 1) * cols + (c + 1);
3982
- const p00 = require_vec3.wasmIndex(points, i00);
3983
- const p10 = require_vec3.wasmIndex(points, i10);
3984
- const p01 = require_vec3.wasmIndex(points, i01);
3985
- const p11 = require_vec3.wasmIndex(points, i11);
3982
+ const p00 = require_bug.wasmIndex(points, i00);
3983
+ const p10 = require_bug.wasmIndex(points, i10);
3984
+ const p01 = require_bug.wasmIndex(points, i01);
3985
+ const p11 = require_bug.wasmIndex(points, i11);
3986
3986
  const face1 = makeTriFace(oc, p00, p10, p01);
3987
3987
  sewing.Add(face1);
3988
3988
  const face2 = makeTriFace(oc, p10, p11, p01);
@@ -4626,7 +4626,7 @@ function createAffinityGTrsf2d$1(ox, oy, dx, dy, ratio) {
4626
4626
  0,
4627
4627
  1
4628
4628
  ];
4629
- return _gtrsf$1(m, ox - require_vec3.wasmIndex(m, 0) * ox - require_vec3.wasmIndex(m, 1) * oy, oy - require_vec3.wasmIndex(m, 3) * ox - require_vec3.wasmIndex(m, 4) * oy);
4629
+ return _gtrsf$1(m, ox - require_bug.wasmIndex(m, 0) * ox - require_bug.wasmIndex(m, 1) * oy, oy - require_bug.wasmIndex(m, 3) * ox - require_bug.wasmIndex(m, 4) * oy);
4630
4630
  }
4631
4631
  function createTranslationGTrsf2d$1(dx, dy) {
4632
4632
  return _gtrsf$1([
@@ -4657,7 +4657,7 @@ function createMirrorGTrsf2d$1(cx, cy, mode, ox, oy, dx, dy) {
4657
4657
  1
4658
4658
  ];
4659
4659
  const apx = ox ?? cx, apy = oy ?? cy;
4660
- return _gtrsf$1(m, apx - require_vec3.wasmIndex(m, 0) * apx - require_vec3.wasmIndex(m, 1) * apy, apy - require_vec3.wasmIndex(m, 3) * apx - require_vec3.wasmIndex(m, 4) * apy);
4660
+ return _gtrsf$1(m, apx - require_bug.wasmIndex(m, 0) * apx - require_bug.wasmIndex(m, 1) * apy, apy - require_bug.wasmIndex(m, 3) * apx - require_bug.wasmIndex(m, 4) * apy);
4661
4661
  }
4662
4662
  return _gtrsf$1([
4663
4663
  -1,
@@ -4704,8 +4704,8 @@ function setGTrsf2dTranslationPart$1(gtrsf, dx, dy) {
4704
4704
  }
4705
4705
  function multiplyGTrsf2d$1(base, other) {
4706
4706
  const a = base.m, b = other.m;
4707
- const ai = (i) => require_vec3.wasmIndex(a, i);
4708
- const bi = (i) => require_vec3.wasmIndex(b, i);
4707
+ const ai = (i) => require_bug.wasmIndex(a, i);
4708
+ const bi = (i) => require_bug.wasmIndex(b, i);
4709
4709
  base.m = [
4710
4710
  ai(0) * bi(0) + ai(1) * bi(3) + ai(2) * bi(6),
4711
4711
  ai(0) * bi(1) + ai(1) * bi(4) + ai(2) * bi(7),
@@ -4736,7 +4736,7 @@ function transformCurve2dGeneral$1(curve, gtrsf) {
4736
4736
  1
4737
4737
  ];
4738
4738
  const tx = Number(gtrsf.tx) || 0, ty = Number(gtrsf.ty) || 0;
4739
- const m0 = require_vec3.wasmIndex(m, 0), m1 = require_vec3.wasmIndex(m, 1), m3 = require_vec3.wasmIndex(m, 3), m4 = require_vec3.wasmIndex(m, 4);
4739
+ const m0 = require_bug.wasmIndex(m, 0), m1 = require_bug.wasmIndex(m, 1), m3 = require_bug.wasmIndex(m, 3), m4 = require_bug.wasmIndex(m, 4);
4740
4740
  if (Math.abs(m0 - 1) < 1e-12 && Math.abs(m4 - 1) < 1e-12 && Math.abs(m1) < 1e-12 && Math.abs(m3) < 1e-12) return require_occtWasmAdapter.translateCurve2d(c, tx, ty);
4741
4741
  const bounds = require_occtWasmAdapter.curveBounds(c);
4742
4742
  const N = 20;
@@ -4878,8 +4878,8 @@ function approximateCurve2dAsBSpline$1(curve, tol, cont, maxSeg) {
4878
4878
  for (let i = 0; i < curN; i++) {
4879
4879
  const tMid = bounds.first + (bounds.last - bounds.first) * (i + .5) / curN;
4880
4880
  const [ex, ey] = require_occtWasmAdapter.evaluateCurve2d(c, tMid);
4881
- const p0 = require_vec3.wasmIndex(poles, i);
4882
- const p1 = require_vec3.wasmIndex(poles, i + 1);
4881
+ const p0 = require_bug.wasmIndex(poles, i);
4882
+ const p1 = require_bug.wasmIndex(poles, i + 1);
4883
4883
  const mx = (p0[0] + p1[0]) / 2;
4884
4884
  const my = (p0[1] + p1[1]) / 2;
4885
4885
  const err = Math.sqrt((ex - mx) ** 2 + (ey - my) ** 2);
@@ -4905,8 +4905,8 @@ function decomposeBSpline2dToBeziers$1(curve) {
4905
4905
  ];
4906
4906
  const result = [];
4907
4907
  for (let i = 0; i < breakpoints.length - 1; i++) {
4908
- const t0 = require_vec3.wasmIndex(breakpoints, i);
4909
- const t1 = require_vec3.wasmIndex(breakpoints, i + 1);
4908
+ const t0 = require_bug.wasmIndex(breakpoints, i);
4909
+ const t1 = require_bug.wasmIndex(breakpoints, i + 1);
4910
4910
  const span = t1 - t0;
4911
4911
  if (span < 1e-15) continue;
4912
4912
  const p0 = require_occtWasmAdapter.evaluateCurve2d(c, t0);
@@ -5053,7 +5053,7 @@ function interpolatePoints3d(oc, points) {
5053
5053
  const pnts = new oc.TColgp_Array1OfPnt_2(1, points.length);
5054
5054
  const reusePnt = new oc.gp_Pnt_1();
5055
5055
  for (let i = 0; i < points.length; i++) {
5056
- const p = require_vec3.wasmIndex(points, i);
5056
+ const p = require_bug.wasmIndex(points, i);
5057
5057
  reusePnt.SetCoord_2(p[0], p[1], p[2]);
5058
5058
  pnts.SetValue_1(i + 1, reusePnt);
5059
5059
  }
@@ -5119,7 +5119,7 @@ function liftCurve2dToPlane$1(oc, curve, planeOrigin, planeZ, planeX) {
5119
5119
  }
5120
5120
  if (c.__bk2d === "bezier" || c.__bk2d === "bspline") {
5121
5121
  const pts3d = c.poles.map(([u, v]) => lift(u, v));
5122
- if (pts3d.length === 2) return makeLineEdge3d(oc, require_vec3.wasmIndex(pts3d, 0), require_vec3.wasmIndex(pts3d, 1));
5122
+ if (pts3d.length === 2) return makeLineEdge3d(oc, require_bug.wasmIndex(pts3d, 0), require_bug.wasmIndex(pts3d, 1));
5123
5123
  return interpolatePoints3d(oc, pts3d);
5124
5124
  }
5125
5125
  const bounds = require_occtWasmAdapter.curveBounds(c);
@@ -5281,7 +5281,7 @@ function makeKernel2dOps$1(oc) {
5281
5281
  */
5282
5282
  function makeBrepkitOnlyStubs() {
5283
5283
  const u = (name) => () => {
5284
- throw new Error(`${name} is only available with the brepkit kernel`);
5284
+ throw new require_occtWasmAdapter.UnsupportedKernelOperationError(`${name} is only available with the brepkit kernel`);
5285
5285
  };
5286
5286
  return {
5287
5287
  export3MF: u("export3MF"),
@@ -5298,7 +5298,7 @@ function makeBrepkitOnlyStubs() {
5298
5298
  detectSmallFeatures: u("detectSmallFeatures"),
5299
5299
  recognizeFeatures: u("recognizeFeatures"),
5300
5300
  meshBoolean: (() => {
5301
- throw new Error("meshBoolean is only available with the brepkit kernel");
5301
+ throw new require_occtWasmAdapter.UnsupportedKernelOperationError("meshBoolean is only available with the brepkit kernel");
5302
5302
  }),
5303
5303
  edgeToFaceMap: u("edgeToFaceMap"),
5304
5304
  sharedEdges: u("sharedEdges"),
@@ -5565,7 +5565,7 @@ function scaleMatrix$1(centerInput, factor) {
5565
5565
  }
5566
5566
  /** Build a row-major 4x4 matrix from a 3x3 linear part + translation. */
5567
5567
  function affineMatrix$1(linear, translation) {
5568
- const li = (i) => require_vec3.wasmIndex(linear, i);
5568
+ const li = (i) => require_bug.wasmIndex(linear, i);
5569
5569
  return [
5570
5570
  li(0),
5571
5571
  li(1),
@@ -5729,13 +5729,13 @@ function uniqueWireVertices(bk, h) {
5729
5729
  for (const eid of edgeIds) {
5730
5730
  const verts = bk.getEdgeVertices(eid);
5731
5731
  const coords = [[
5732
- require_vec3.wasmIndex(verts, 0),
5733
- require_vec3.wasmIndex(verts, 1),
5734
- require_vec3.wasmIndex(verts, 2)
5732
+ require_bug.wasmIndex(verts, 0),
5733
+ require_bug.wasmIndex(verts, 1),
5734
+ require_bug.wasmIndex(verts, 2)
5735
5735
  ], [
5736
- require_vec3.wasmIndex(verts, 3),
5737
- require_vec3.wasmIndex(verts, 4),
5738
- require_vec3.wasmIndex(verts, 5)
5736
+ require_bug.wasmIndex(verts, 3),
5737
+ require_bug.wasmIndex(verts, 4),
5738
+ require_bug.wasmIndex(verts, 5)
5739
5739
  ]];
5740
5740
  for (const [x, y, z] of coords) {
5741
5741
  const key = `${x},${y},${z}`;
@@ -5756,8 +5756,8 @@ function iterEdge(bk, shape, h, type) {
5756
5756
  if (type === "edge") return [shape];
5757
5757
  if (type === "vertex") {
5758
5758
  const verts = bk.getEdgeVertices(h);
5759
- const v1 = bk.makeVertex(require_vec3.wasmIndex(verts, 0), require_vec3.wasmIndex(verts, 1), require_vec3.wasmIndex(verts, 2));
5760
- const v2 = bk.makeVertex(require_vec3.wasmIndex(verts, 3), require_vec3.wasmIndex(verts, 4), require_vec3.wasmIndex(verts, 5));
5759
+ const v1 = bk.makeVertex(require_bug.wasmIndex(verts, 0), require_bug.wasmIndex(verts, 1), require_bug.wasmIndex(verts, 2));
5760
+ const v2 = bk.makeVertex(require_bug.wasmIndex(verts, 3), require_bug.wasmIndex(verts, 4), require_bug.wasmIndex(verts, 5));
5761
5761
  return [vertexHandle(v1), vertexHandle(v2)];
5762
5762
  }
5763
5763
  return [];
@@ -5856,7 +5856,7 @@ function makeTopologyOps$1(bk) {
5856
5856
  //#endregion
5857
5857
  //#region src/kernel/brepkit/geometryOps.ts
5858
5858
  function vertexPosition(bk, vertex) {
5859
- return require_vec3.vec3At(bk.getVertexPosition(unwrap$1(vertex, "vertex")));
5859
+ return require_bug.vec3At(bk.getVertexPosition(unwrap$1(vertex, "vertex")));
5860
5860
  }
5861
5861
  function surfaceType(bk, face) {
5862
5862
  return bk.getSurfaceType(unwrap$1(face, "face"));
@@ -5864,32 +5864,32 @@ function surfaceType(bk, face) {
5864
5864
  function uvBounds(bk, face) {
5865
5865
  const domain = bk.getSurfaceDomain(unwrap$1(face, "face"));
5866
5866
  return {
5867
- uMin: require_vec3.wasmIndex(domain, 0),
5868
- uMax: require_vec3.wasmIndex(domain, 1),
5869
- vMin: require_vec3.wasmIndex(domain, 2),
5870
- vMax: require_vec3.wasmIndex(domain, 3)
5867
+ uMin: require_bug.wasmIndex(domain, 0),
5868
+ uMax: require_bug.wasmIndex(domain, 1),
5869
+ vMin: require_bug.wasmIndex(domain, 2),
5870
+ vMax: require_bug.wasmIndex(domain, 3)
5871
5871
  };
5872
5872
  }
5873
5873
  function outerWire(bk, face) {
5874
5874
  return wireHandle(bk.getFaceOuterWire(unwrap$1(face, "face")));
5875
5875
  }
5876
5876
  function surfaceNormal(bk, face, u, v) {
5877
- return require_vec3.vec3At(bk.evaluateSurfaceNormal(unwrap$1(face, "face"), u, v));
5877
+ return require_bug.vec3At(bk.evaluateSurfaceNormal(unwrap$1(face, "face"), u, v));
5878
5878
  }
5879
5879
  function pointOnSurface(bk, face, u, v) {
5880
- return require_vec3.vec3At(bk.evaluateSurface(unwrap$1(face, "face"), u, v));
5880
+ return require_bug.vec3At(bk.evaluateSurface(unwrap$1(face, "face"), u, v));
5881
5881
  }
5882
5882
  function uvFromPoint(bk, face, point) {
5883
5883
  try {
5884
5884
  const result = bk.projectPointOnSurface(unwrap$1(face, "face"), point[0], point[1], point[2]);
5885
- return [require_vec3.wasmIndex(result, 0), require_vec3.wasmIndex(result, 1)];
5885
+ return [require_bug.wasmIndex(result, 0), require_bug.wasmIndex(result, 1)];
5886
5886
  } catch (e) {
5887
5887
  console.warn("brepkit: uvFromPoint failed:", e);
5888
5888
  return null;
5889
5889
  }
5890
5890
  }
5891
5891
  function projectPointOnFace(bk, face, point) {
5892
- return require_vec3.vec3At(bk.projectPointOnSurface(unwrap$1(face, "face"), point[0], point[1], point[2]), 2);
5892
+ return require_bug.vec3At(bk.projectPointOnSurface(unwrap$1(face, "face"), point[0], point[1], point[2]), 2);
5893
5893
  }
5894
5894
  function curveTangent(bk, shape, param) {
5895
5895
  const h = shape;
@@ -5897,14 +5897,14 @@ function curveTangent(bk, shape, param) {
5897
5897
  let evalParam = param;
5898
5898
  if (h.type === "wire") {
5899
5899
  const edgeIds = toArray(bk.getWireEdges(h.id));
5900
- edgeId = require_vec3.wasmIndex(edgeIds, edgeIds.length - 1);
5900
+ edgeId = require_bug.wasmIndex(edgeIds, edgeIds.length - 1);
5901
5901
  let cumulative = 0;
5902
5902
  for (const eid of edgeIds) {
5903
5903
  const p = bk.getEdgeCurveParameters(eid);
5904
- const span = require_vec3.wasmIndex(p, 1) - require_vec3.wasmIndex(p, 0);
5904
+ const span = require_bug.wasmIndex(p, 1) - require_bug.wasmIndex(p, 0);
5905
5905
  if (param <= cumulative + span || eid === edgeId) {
5906
5906
  edgeId = eid;
5907
- evalParam = Math.min(require_vec3.wasmIndex(p, 0) + (param - cumulative), require_vec3.wasmIndex(p, 1));
5907
+ evalParam = Math.min(require_bug.wasmIndex(p, 0) + (param - cumulative), require_bug.wasmIndex(p, 1));
5908
5908
  break;
5909
5909
  }
5910
5910
  cumulative += span;
@@ -5912,8 +5912,8 @@ function curveTangent(bk, shape, param) {
5912
5912
  } else edgeId = unwrap$1(shape, "edge");
5913
5913
  const result = bk.evaluateEdgeCurveD1(edgeId, evalParam);
5914
5914
  return {
5915
- point: require_vec3.vec3At(result, 0),
5916
- tangent: require_vec3.vec3At(result, 3)
5915
+ point: require_bug.vec3At(result, 0),
5916
+ tangent: require_bug.vec3At(result, 3)
5917
5917
  };
5918
5918
  }
5919
5919
  function curveParameters(bk, shape) {
@@ -5924,12 +5924,12 @@ function curveParameters(bk, shape) {
5924
5924
  let total = 0;
5925
5925
  for (const eid of edgeIds) {
5926
5926
  const p = bk.getEdgeCurveParameters(eid);
5927
- total += require_vec3.wasmIndex(p, 1) - require_vec3.wasmIndex(p, 0);
5927
+ total += require_bug.wasmIndex(p, 1) - require_bug.wasmIndex(p, 0);
5928
5928
  }
5929
5929
  return [0, total];
5930
5930
  }
5931
5931
  const params = bk.getEdgeCurveParameters(unwrap$1(shape, "edge"));
5932
- return [require_vec3.wasmIndex(params, 0), require_vec3.wasmIndex(params, 1)];
5932
+ return [require_bug.wasmIndex(params, 0), require_bug.wasmIndex(params, 1)];
5933
5933
  }
5934
5934
  function curvePointAtParam(bk, shape, param) {
5935
5935
  const h = shape;
@@ -5938,28 +5938,28 @@ function curvePointAtParam(bk, shape, param) {
5938
5938
  let cumulative = 0;
5939
5939
  for (const eid of edgeIds) {
5940
5940
  const p = bk.getEdgeCurveParameters(eid);
5941
- const span = require_vec3.wasmIndex(p, 1) - require_vec3.wasmIndex(p, 0);
5941
+ const span = require_bug.wasmIndex(p, 1) - require_bug.wasmIndex(p, 0);
5942
5942
  if (param <= cumulative + span || eid === edgeIds[edgeIds.length - 1]) {
5943
- const localParam = require_vec3.wasmIndex(p, 0) + (param - cumulative);
5944
- return require_vec3.vec3At(bk.evaluateEdgeCurve(eid, Math.min(localParam, require_vec3.wasmIndex(p, 1))));
5943
+ const localParam = require_bug.wasmIndex(p, 0) + (param - cumulative);
5944
+ return require_bug.vec3At(bk.evaluateEdgeCurve(eid, Math.min(localParam, require_bug.wasmIndex(p, 1))));
5945
5945
  }
5946
5946
  cumulative += span;
5947
5947
  }
5948
- return require_vec3.vec3At(bk.evaluateEdgeCurve(require_vec3.wasmIndex(edgeIds, 0), param));
5948
+ return require_bug.vec3At(bk.evaluateEdgeCurve(require_bug.wasmIndex(edgeIds, 0), param));
5949
5949
  }
5950
- return require_vec3.vec3At(bk.evaluateEdgeCurve(unwrap$1(shape, "edge"), param));
5950
+ return require_bug.vec3At(bk.evaluateEdgeCurve(unwrap$1(shape, "edge"), param));
5951
5951
  }
5952
5952
  function curveIsClosed(bk, shape) {
5953
5953
  const h = shape;
5954
5954
  if (h.type === "wire") {
5955
5955
  const edgeIds = toArray(bk.getWireEdges(h.id));
5956
5956
  if (edgeIds.length === 0) return false;
5957
- if (edgeIds.length === 1) return edgeIsClosed(bk.getEdgeVertices(require_vec3.wasmIndex(edgeIds, 0)));
5957
+ if (edgeIds.length === 1) return edgeIsClosed(bk.getEdgeVertices(require_bug.wasmIndex(edgeIds, 0)));
5958
5958
  const endpoints = [];
5959
5959
  for (const eid of edgeIds) {
5960
5960
  const verts = bk.getEdgeVertices(eid);
5961
- endpoints.push(require_vec3.vec3At(verts, 0));
5962
- endpoints.push(require_vec3.vec3At(verts, 3));
5961
+ endpoints.push(require_bug.vec3At(verts, 0));
5962
+ endpoints.push(require_bug.vec3At(verts, 3));
5963
5963
  }
5964
5964
  const unmatched = [];
5965
5965
  for (const pt of endpoints) {
@@ -5972,7 +5972,7 @@ function curveIsClosed(bk, shape) {
5972
5972
  return edgeIsClosed(bk.getEdgeVertices(unwrap$1(shape, "edge")));
5973
5973
  }
5974
5974
  function edgeIsClosed(verts) {
5975
- return dist3(require_vec3.wasmIndex(verts, 0), require_vec3.wasmIndex(verts, 1), require_vec3.wasmIndex(verts, 2), require_vec3.wasmIndex(verts, 3), require_vec3.wasmIndex(verts, 4), require_vec3.wasmIndex(verts, 5)) < 1e-7;
5975
+ return dist3(require_bug.wasmIndex(verts, 0), require_bug.wasmIndex(verts, 1), require_bug.wasmIndex(verts, 2), require_bug.wasmIndex(verts, 3), require_bug.wasmIndex(verts, 4), require_bug.wasmIndex(verts, 5)) < 1e-7;
5976
5976
  }
5977
5977
  function curveIsPeriodic(bk, shape) {
5978
5978
  const h = shape;
@@ -6016,7 +6016,7 @@ function curveKnotRemove(bk, edge, knot, tolerance) {
6016
6016
  function curveSplit(bk, edge, param) {
6017
6017
  const edgeId = unwrap$1(edge, "edge");
6018
6018
  const result = bk.curveSplit(edgeId, param);
6019
- return [edgeHandle(require_vec3.wasmIndex(result, 0)), edgeHandle(require_vec3.wasmIndex(result, 1))];
6019
+ return [edgeHandle(require_bug.wasmIndex(result, 0)), edgeHandle(require_bug.wasmIndex(result, 1))];
6020
6020
  }
6021
6021
  function approximateSurfaceLspia(bk, coords, rows, cols, degreeU, degreeV, numCpsU, numCpsV, tolerance, maxIterations) {
6022
6022
  return faceHandle(bk.approximateSurfaceLspia(coords, rows, cols, degreeU, degreeV, numCpsU, numCpsV, tolerance, maxIterations));
@@ -6031,7 +6031,7 @@ function createCurveAdaptor(_bk, shape) {
6031
6031
  function getBezierPenultimatePole(bk, edge) {
6032
6032
  const nurbsData = extractNurbsFromEdge(bk, edge);
6033
6033
  if (!nurbsData || nurbsData.controlPoints.length < 6) return null;
6034
- return require_vec3.vec3At(nurbsData.controlPoints, nurbsData.controlPoints.length - 6);
6034
+ return require_bug.vec3At(nurbsData.controlPoints, nurbsData.controlPoints.length - 6);
6035
6035
  }
6036
6036
  function getSurfaceCylinderData(bk, surface) {
6037
6037
  if (isBrepkitHandle(surface) && surface.type === "face") {
@@ -6072,7 +6072,7 @@ function classifyPointOnFace(bk, face, u, v, tolerance) {
6072
6072
  if (tolerance !== void 0) warnOnce("classify-tolerance", "classifyPointOnFace() tolerance parameter is not supported; brepkit uses domain-based classification.");
6073
6073
  const faceId = unwrap$1(face, "face");
6074
6074
  const domain = bk.getSurfaceDomain(faceId);
6075
- if (u < require_vec3.wasmIndex(domain, 0) || u > require_vec3.wasmIndex(domain, 1) || v < require_vec3.wasmIndex(domain, 2) || v > require_vec3.wasmIndex(domain, 3)) return "out";
6075
+ if (u < require_bug.wasmIndex(domain, 0) || u > require_bug.wasmIndex(domain, 1) || v < require_bug.wasmIndex(domain, 2) || v > require_bug.wasmIndex(domain, 3)) return "out";
6076
6076
  return "in";
6077
6077
  }
6078
6078
  function classifyPointRobust(bk, shape, point, tolerance) {
@@ -6103,8 +6103,8 @@ function projectEdges(bk, shape, cameraOrigin, cameraDirection, cameraXAxis) {
6103
6103
  let deflection = .1;
6104
6104
  try {
6105
6105
  const bb = bk.boundingBox(solidId);
6106
- const [minX, minY, minZ] = require_vec3.vec3At(bb, 0);
6107
- const [maxX, maxY, maxZ] = require_vec3.vec3At(bb, 3);
6106
+ const [minX, minY, minZ] = require_bug.vec3At(bb, 0);
6107
+ const [maxX, maxY, maxZ] = require_bug.vec3At(bb, 3);
6108
6108
  const diag = dist3(minX, minY, minZ, maxX, maxY, maxZ);
6109
6109
  if (diag > 0) deflection = Math.max(diag * .001, 1e-6);
6110
6110
  } catch {}
@@ -6411,10 +6411,10 @@ function extractPlaneFromFace(bk, faceShape) {
6411
6411
  }
6412
6412
  faceId = bestId;
6413
6413
  } else faceId = unwrap$1(faceShape, "face");
6414
- const normal = require_vec3.vec3At(bk.getFaceNormal(faceId));
6414
+ const normal = require_bug.vec3At(bk.getFaceNormal(faceId));
6415
6415
  const positions = bk.tessellateFace(faceId, 1).positions;
6416
6416
  if (positions.length >= 3) return {
6417
- point: require_vec3.vec3At(positions),
6417
+ point: require_bug.vec3At(positions),
6418
6418
  normal
6419
6419
  };
6420
6420
  return {
@@ -6454,12 +6454,12 @@ function extractNurbsFromEdge(bk, shape) {
6454
6454
  1
6455
6455
  ],
6456
6456
  controlPoints: [
6457
- require_vec3.wasmIndex(verts, 0),
6458
- require_vec3.wasmIndex(verts, 1),
6459
- require_vec3.wasmIndex(verts, 2),
6460
- require_vec3.wasmIndex(verts, 3),
6461
- require_vec3.wasmIndex(verts, 4),
6462
- require_vec3.wasmIndex(verts, 5)
6457
+ require_bug.wasmIndex(verts, 0),
6458
+ require_bug.wasmIndex(verts, 1),
6459
+ require_bug.wasmIndex(verts, 2),
6460
+ require_bug.wasmIndex(verts, 3),
6461
+ require_bug.wasmIndex(verts, 4),
6462
+ require_bug.wasmIndex(verts, 5)
6463
6463
  ],
6464
6464
  weights: [1, 1]
6465
6465
  };
@@ -6623,8 +6623,8 @@ function section(bk, shape, plane, _approximation) {
6623
6623
  if (faceIds.length === 0) return compoundHandle(bk.makeCompound([]));
6624
6624
  const allWireHandles = [];
6625
6625
  for (let i = 0; i < faceIds.length; i++) {
6626
- const wireIds = toArray(bk.getFaceWires(require_vec3.wasmIndex(faceIds, i)));
6627
- for (let j = 0; j < wireIds.length; j++) allWireHandles.push(wireHandle(require_vec3.wasmIndex(wireIds, j)));
6626
+ const wireIds = toArray(bk.getFaceWires(require_bug.wasmIndex(faceIds, i)));
6627
+ for (let j = 0; j < wireIds.length; j++) allWireHandles.push(wireHandle(require_bug.wasmIndex(wireIds, j)));
6628
6628
  }
6629
6629
  const [firstWire] = allWireHandles;
6630
6630
  if (allWireHandles.length === 1 && firstWire !== void 0) return firstWire;
@@ -6634,7 +6634,7 @@ function section(bk, shape, plane, _approximation) {
6634
6634
  }
6635
6635
  function fuseAll(bk, shapes, options) {
6636
6636
  if (shapes.length === 0) throw new Error("brepkit: fuseAll requires at least one shape");
6637
- if (shapes.length === 1) return require_vec3.wasmIndex(shapes, 0);
6637
+ if (shapes.length === 1) return require_bug.wasmIndex(shapes, 0);
6638
6638
  if (bk.compoundFuse) {
6639
6639
  const solidIds = [];
6640
6640
  for (const shape of shapes) {
@@ -6652,7 +6652,7 @@ function fuseAll(bk, shapes, options) {
6652
6652
  else next.push(current[i]);
6653
6653
  current = next;
6654
6654
  }
6655
- return require_vec3.wasmIndex(current, 0);
6655
+ return require_bug.wasmIndex(current, 0);
6656
6656
  }
6657
6657
  function cutAll(bk, shape, tools, options) {
6658
6658
  if (tools.length === 0) return shape;
@@ -6731,11 +6731,11 @@ function hull(bk, shapes, _tolerance) {
6731
6731
  const vertIds = toArray(bk.getSolidVertices(h.id));
6732
6732
  for (const vid of vertIds) {
6733
6733
  const pos = bk.getVertexPosition(vid);
6734
- coords.push(require_vec3.wasmIndex(pos, 0), require_vec3.wasmIndex(pos, 1), require_vec3.wasmIndex(pos, 2));
6734
+ coords.push(require_bug.wasmIndex(pos, 0), require_bug.wasmIndex(pos, 1), require_bug.wasmIndex(pos, 2));
6735
6735
  }
6736
6736
  } else if (h.type === "vertex") {
6737
6737
  const pos = bk.getVertexPosition(h.id);
6738
- coords.push(require_vec3.wasmIndex(pos, 0), require_vec3.wasmIndex(pos, 1), require_vec3.wasmIndex(pos, 2));
6738
+ coords.push(require_bug.wasmIndex(pos, 0), require_bug.wasmIndex(pos, 1), require_bug.wasmIndex(pos, 2));
6739
6739
  }
6740
6740
  }
6741
6741
  if (coords.length < 12) throw new Error("brepkit: hull requires enough points");
@@ -6750,14 +6750,14 @@ function hullFromPoints(bk, points, _tolerance) {
6750
6750
  function buildSolidFromFaces(bk, points, faces, _tolerance) {
6751
6751
  const positions = new Float64Array(points.length * 3);
6752
6752
  for (let i = 0; i < points.length; i++) {
6753
- const p = require_vec3.wasmIndex(points, i);
6753
+ const p = require_bug.wasmIndex(points, i);
6754
6754
  positions[i * 3] = p.x;
6755
6755
  positions[i * 3 + 1] = p.y;
6756
6756
  positions[i * 3 + 2] = p.z;
6757
6757
  }
6758
6758
  const indices = new Uint32Array(faces.length * 3);
6759
6759
  for (let i = 0; i < faces.length; i++) {
6760
- const f = require_vec3.wasmIndex(faces, i);
6760
+ const f = require_bug.wasmIndex(faces, i);
6761
6761
  indices[i * 3] = f[0];
6762
6762
  indices[i * 3 + 1] = f[1];
6763
6763
  indices[i * 3 + 2] = f[2];
@@ -7001,8 +7001,8 @@ function makeBezierEdge(bk, points) {
7001
7001
  y,
7002
7002
  z
7003
7003
  ]);
7004
- const startPt = require_vec3.wasmIndex(points, 0);
7005
- const endPt = require_vec3.wasmIndex(points, n - 1);
7004
+ const startPt = require_bug.wasmIndex(points, 0);
7005
+ const endPt = require_bug.wasmIndex(points, n - 1);
7006
7006
  return edgeHandle(bk.makeNurbsEdge(startPt[0], startPt[1], startPt[2], endPt[0], endPt[1], endPt[2], degree, knots, flatCp, weights));
7007
7007
  }
7008
7008
  function makeTangentArc(bk, startPoint, startTangent, endPoint) {
@@ -7096,9 +7096,9 @@ function triangulatedSurface(bk, points, rows, cols) {
7096
7096
  const i10 = (r + 1) * cols + c;
7097
7097
  const i01 = r * cols + (c + 1);
7098
7098
  const i11 = (r + 1) * cols + (c + 1);
7099
- const f1 = buildTriFace(bk, require_vec3.wasmIndex(points, i00), require_vec3.wasmIndex(points, i10), require_vec3.wasmIndex(points, i01));
7099
+ const f1 = buildTriFace(bk, require_bug.wasmIndex(points, i00), require_bug.wasmIndex(points, i10), require_bug.wasmIndex(points, i01));
7100
7100
  if (f1) faces.push(f1);
7101
- const f2 = buildTriFace(bk, require_vec3.wasmIndex(points, i10), require_vec3.wasmIndex(points, i11), require_vec3.wasmIndex(points, i01));
7101
+ const f2 = buildTriFace(bk, require_bug.wasmIndex(points, i10), require_bug.wasmIndex(points, i11), require_bug.wasmIndex(points, i01));
7102
7102
  if (f2) faces.push(f2);
7103
7103
  }
7104
7104
  if (faces.length === 0) throw new Error("brepkit: no valid faces in surface grid");
@@ -7129,7 +7129,7 @@ function sewAndSolidify(bk, faces, tolerance) {
7129
7129
  function interpolatePoints(bk, points, options) {
7130
7130
  if (options?.tolerance !== void 0) warnOnce("interpolate-tolerance", "interpolatePoints() tolerance parameter is not supported; brepkit uses chord-length parameterisation.");
7131
7131
  if (points.length < 2) throw new Error("brepkit: need at least 2 points");
7132
- if (points.length === 2) return makeLineEdge(bk, require_vec3.wasmIndex(points, 0), require_vec3.wasmIndex(points, 1));
7132
+ if (points.length === 2) return makeLineEdge(bk, require_bug.wasmIndex(points, 0), require_bug.wasmIndex(points, 1));
7133
7133
  const degree = Math.min(3, points.length - 1);
7134
7134
  const coords = points.flatMap(([x, y, z]) => [
7135
7135
  x,
@@ -7281,14 +7281,14 @@ function makeCircleNurbs(bk, center, normal, radius, startAngle, endAngle) {
7281
7281
  const knots = Array(3).fill(0);
7282
7282
  for (let i = 1; i < nSegments; i++) knots.push(i, i);
7283
7283
  knots.push(...Array(3).fill(nSegments));
7284
- const kMax = require_vec3.wasmIndex(knots, knots.length - 1);
7285
- for (let i = 0; i < knots.length; i++) knots[i] = require_vec3.wasmIndex(knots, i) / kMax;
7286
- const sx = require_vec3.wasmIndex(controlPoints, 0);
7287
- const sy = require_vec3.wasmIndex(controlPoints, 1);
7288
- const sz = require_vec3.wasmIndex(controlPoints, 2);
7289
- const ex = require_vec3.wasmIndex(controlPoints, controlPoints.length - 3);
7290
- const ey = require_vec3.wasmIndex(controlPoints, controlPoints.length - 2);
7291
- const ez = require_vec3.wasmIndex(controlPoints, controlPoints.length - 1);
7284
+ const kMax = require_bug.wasmIndex(knots, knots.length - 1);
7285
+ for (let i = 0; i < knots.length; i++) knots[i] = require_bug.wasmIndex(knots, i) / kMax;
7286
+ const sx = require_bug.wasmIndex(controlPoints, 0);
7287
+ const sy = require_bug.wasmIndex(controlPoints, 1);
7288
+ const sz = require_bug.wasmIndex(controlPoints, 2);
7289
+ const ex = require_bug.wasmIndex(controlPoints, controlPoints.length - 3);
7290
+ const ey = require_bug.wasmIndex(controlPoints, controlPoints.length - 2);
7291
+ const ez = require_bug.wasmIndex(controlPoints, controlPoints.length - 1);
7292
7292
  return edgeHandle(bk.makeNurbsEdge(sx, sy, sz, ex, ey, ez, degree, knots, controlPoints, weights));
7293
7293
  }
7294
7294
  function makeEllipseNurbs(bk, center, normal, majorRadius, minorRadius, startAngle, endAngle, xDir) {
@@ -7362,14 +7362,14 @@ function makeEllipseNurbs(bk, center, normal, majorRadius, minorRadius, startAng
7362
7362
  const knots = Array(3).fill(0);
7363
7363
  for (let i = 1; i < nSegments; i++) knots.push(i, i);
7364
7364
  knots.push(...Array(3).fill(nSegments));
7365
- const kMax = require_vec3.wasmIndex(knots, knots.length - 1);
7366
- for (let i = 0; i < knots.length; i++) knots[i] = require_vec3.wasmIndex(knots, i) / kMax;
7367
- const sx = require_vec3.wasmIndex(controlPoints, 0);
7368
- const sy = require_vec3.wasmIndex(controlPoints, 1);
7369
- const sz = require_vec3.wasmIndex(controlPoints, 2);
7370
- const ex = require_vec3.wasmIndex(controlPoints, controlPoints.length - 3);
7371
- const ey = require_vec3.wasmIndex(controlPoints, controlPoints.length - 2);
7372
- const ez = require_vec3.wasmIndex(controlPoints, controlPoints.length - 1);
7365
+ const kMax = require_bug.wasmIndex(knots, knots.length - 1);
7366
+ for (let i = 0; i < knots.length; i++) knots[i] = require_bug.wasmIndex(knots, i) / kMax;
7367
+ const sx = require_bug.wasmIndex(controlPoints, 0);
7368
+ const sy = require_bug.wasmIndex(controlPoints, 1);
7369
+ const sz = require_bug.wasmIndex(controlPoints, 2);
7370
+ const ex = require_bug.wasmIndex(controlPoints, controlPoints.length - 3);
7371
+ const ey = require_bug.wasmIndex(controlPoints, controlPoints.length - 2);
7372
+ const ez = require_bug.wasmIndex(controlPoints, controlPoints.length - 1);
7373
7373
  return edgeHandle(bk.makeNurbsEdge(sx, sy, sz, ex, ey, ez, degree, knots, controlPoints, weights));
7374
7374
  }
7375
7375
  /** Co-located factory: returns the construction slice of {@link KernelAdapter} bound to `bk`. */
@@ -7486,9 +7486,9 @@ function faceCentroid(bk, faceId) {
7486
7486
  let x = 0, y = 0, z = 0;
7487
7487
  for (const vid of verts) {
7488
7488
  const pos = bk.getVertexPosition(vid);
7489
- x += require_vec3.wasmIndex(pos, 0);
7490
- y += require_vec3.wasmIndex(pos, 1);
7491
- z += require_vec3.wasmIndex(pos, 2);
7489
+ x += require_bug.wasmIndex(pos, 0);
7490
+ y += require_bug.wasmIndex(pos, 1);
7491
+ z += require_bug.wasmIndex(pos, 2);
7492
7492
  }
7493
7493
  const n = verts.length;
7494
7494
  return {
@@ -7591,12 +7591,12 @@ function offsetWire2D(bk, wire, offsetVal, joinType) {
7591
7591
  const coords2d = [];
7592
7592
  for (const edge of edges) {
7593
7593
  const verts = bk.getEdgeVertices(unwrap$1(edge, "edge"));
7594
- coords2d.push(require_vec3.wasmIndex(verts, 0), require_vec3.wasmIndex(verts, 1));
7594
+ coords2d.push(require_bug.wasmIndex(verts, 0), require_bug.wasmIndex(verts, 1));
7595
7595
  }
7596
7596
  if (coords2d.length < 6) return wire;
7597
7597
  const result = bk.offsetPolygon2d(coords2d, offsetVal, 1e-10);
7598
7598
  const coords3d = [];
7599
- for (let i = 0; i < result.length; i += 2) coords3d.push(require_vec3.wasmIndex(result, i), require_vec3.wasmIndex(result, i + 1), 0);
7599
+ for (let i = 0; i < result.length; i += 2) coords3d.push(require_bug.wasmIndex(result, i), require_bug.wasmIndex(result, i + 1), 0);
7600
7600
  return wireHandle(bk.makePolygonWire(coords3d));
7601
7601
  }
7602
7602
  function simplify$1(bk, shape) {
@@ -7690,9 +7690,9 @@ function faceCentroidById(bk, faceId) {
7690
7690
  let cz = 0;
7691
7691
  const nVerts = pos.length / 3;
7692
7692
  for (let i = 0; i < pos.length; i += 3) {
7693
- cx += require_vec3.wasmIndex(pos, i);
7694
- cy += require_vec3.wasmIndex(pos, i + 1);
7695
- cz += require_vec3.wasmIndex(pos, i + 2);
7693
+ cx += require_bug.wasmIndex(pos, i);
7694
+ cy += require_bug.wasmIndex(pos, i + 1);
7695
+ cz += require_bug.wasmIndex(pos, i + 2);
7696
7696
  }
7697
7697
  return [
7698
7698
  cx / nVerts,
@@ -7741,7 +7741,7 @@ function collectOutputMatches(out, inputSigs) {
7741
7741
  let bestScore = -Infinity;
7742
7742
  const matches = [];
7743
7743
  for (let i = 0; i < inputSigs.length; i++) {
7744
- const inp = require_vec3.wasmIndex(inputSigs, i);
7744
+ const inp = require_bug.wasmIndex(inputSigs, i);
7745
7745
  const dot = (out.normal[0] ?? 0) * (inp.normal[0] ?? 0) + (out.normal[1] ?? 0) * (inp.normal[1] ?? 0) + (out.normal[2] ?? 0) * (inp.normal[2] ?? 0);
7746
7746
  if (dot < NORMAL_THRESHOLD) continue;
7747
7747
  const distSq = centroidDistSq(out.centroid, inp.centroid);
@@ -7782,7 +7782,7 @@ function matchFacesGeometrically(bk, originalShape, inputFaceHashes, outputFaceI
7782
7782
  const hashCount = Math.min(inputFaceIds.length, inputFaceHashes.length);
7783
7783
  const inputSigs = [];
7784
7784
  for (let i = 0; i < hashCount; i++) {
7785
- const fid = require_vec3.wasmIndex(inputFaceIds, i);
7785
+ const fid = require_bug.wasmIndex(inputFaceIds, i);
7786
7786
  inputSigs.push(snapshotFaceSignature(bk, fid, inputFaceHashes[i] ?? fid % hashUpperBound));
7787
7787
  }
7788
7788
  const outputSigs = outputFaceIds.map((fid) => snapshotFaceSignature(bk, fid, fid % hashUpperBound));
@@ -7791,7 +7791,7 @@ function matchFacesGeometrically(bk, originalShape, inputFaceHashes, outputFaceI
7791
7791
  const { matches, bestScore } = collectOutputMatches(out, inputSigs);
7792
7792
  if (matches.length > 0) {
7793
7793
  for (const m of matches) if (m.score >= bestScore - SCORE_TIE_TOL) {
7794
- const inp = require_vec3.wasmIndex(inputSigs, m.idx);
7794
+ const inp = require_bug.wasmIndex(inputSigs, m.idx);
7795
7795
  const existing = modified.get(inp.hash) ?? [];
7796
7796
  existing.push(out.hash);
7797
7797
  modified.set(inp.hash, existing);
@@ -7806,7 +7806,7 @@ function matchFacesGeometrically(bk, originalShape, inputFaceHashes, outputFaceI
7806
7806
  }
7807
7807
  }
7808
7808
  }
7809
- for (let i = 0; i < inputSigs.length; i++) if (!matchedInputIndices.has(i)) deleted.add(require_vec3.wasmIndex(inputSigs, i).hash);
7809
+ for (let i = 0; i < inputSigs.length; i++) if (!matchedInputIndices.has(i)) deleted.add(require_bug.wasmIndex(inputSigs, i).hash);
7810
7810
  }
7811
7811
  /**
7812
7812
  * Apply geometric matching to the unmatched input/output residuals from a
@@ -7832,7 +7832,7 @@ function reconcileUnmatchedResiduals(bk, originalShape, unmatchedInputHashes, un
7832
7832
  */
7833
7833
  function fallbackHashOnlyEvolution(inputFaceHashes, outputHashes, inputSet, outputSet, generated, deleted) {
7834
7834
  const newFaces = outputHashes.filter((fh) => !inputSet.has(fh));
7835
- if (newFaces.length > 0 && inputFaceHashes.length > 0) generated.set(require_vec3.wasmIndex(inputFaceHashes, 0), newFaces);
7835
+ if (newFaces.length > 0 && inputFaceHashes.length > 0) generated.set(require_bug.wasmIndex(inputFaceHashes, 0), newFaces);
7836
7836
  for (const hash of inputFaceHashes) if (!outputSet.has(hash)) deleted.add(hash);
7837
7837
  }
7838
7838
  /**
@@ -7850,8 +7850,8 @@ function buildBooleanEvolution(bk, outputFaces, outputHashes, inputFaceHashes, h
7850
7850
  else fallbackHashOnlyEvolution(inputFaceHashes, outputHashes, inputSet, outputSet, generated, deleted);
7851
7851
  } else if (originalShape) matchFacesGeometrically(bk, originalShape, inputFaceHashes, outputFaces, hashUpperBound, modified, generated, deleted);
7852
7852
  else {
7853
- for (let i = 0; i < inputFaceHashes.length && i < outputHashes.length; i++) modified.set(require_vec3.wasmIndex(inputFaceHashes, i), [require_vec3.wasmIndex(outputHashes, i)]);
7854
- if (outputHashes.length > inputFaceHashes.length && inputFaceHashes.length > 0) generated.set(require_vec3.wasmIndex(inputFaceHashes, 0), outputHashes.slice(inputFaceHashes.length));
7853
+ for (let i = 0; i < inputFaceHashes.length && i < outputHashes.length; i++) modified.set(require_bug.wasmIndex(inputFaceHashes, i), [require_bug.wasmIndex(outputHashes, i)]);
7854
+ if (outputHashes.length > inputFaceHashes.length && inputFaceHashes.length > 0) generated.set(require_bug.wasmIndex(inputFaceHashes, 0), outputHashes.slice(inputFaceHashes.length));
7855
7855
  }
7856
7856
  }
7857
7857
  /**
@@ -7869,7 +7869,7 @@ function buildEvolution(bk, resultShape, inputFaceHashes, hashUpperBound, isTran
7869
7869
  if (h.type === "solid") {
7870
7870
  const outputFaces = toArray(bk.getSolidFaces(h.id));
7871
7871
  const outputHashes = outputFaces.map((fid) => fid % hashUpperBound);
7872
- if (isTransform) for (let i = 0; i < inputFaceHashes.length && i < outputHashes.length; i++) modified.set(require_vec3.wasmIndex(inputFaceHashes, i), [require_vec3.wasmIndex(outputHashes, i)]);
7872
+ if (isTransform) for (let i = 0; i < inputFaceHashes.length && i < outputHashes.length; i++) modified.set(require_bug.wasmIndex(inputFaceHashes, i), [require_bug.wasmIndex(outputHashes, i)]);
7873
7873
  else buildBooleanEvolution(bk, outputFaces, outputHashes, inputFaceHashes, hashUpperBound, modified, generated, deleted, originalShape);
7874
7874
  }
7875
7875
  return {
@@ -8112,8 +8112,8 @@ function meshEdges$1(bk, shape, tolerance, angularTolerance) {
8112
8112
  const edgeCount = edgeLines.edgeCount;
8113
8113
  const edgeGroups = [];
8114
8114
  for (let i = 0; i < edgeCount; i++) {
8115
- const startIdx = require_vec3.wasmIndex(offsets, i);
8116
- const pointCount = ((i + 1 < edgeCount ? require_vec3.wasmIndex(offsets, i + 1) : positions.length) - startIdx) / 3;
8115
+ const startIdx = require_bug.wasmIndex(offsets, i);
8116
+ const pointCount = ((i + 1 < edgeCount ? require_bug.wasmIndex(offsets, i + 1) : positions.length) - startIdx) / 3;
8117
8117
  edgeGroups.push({
8118
8118
  start: startIdx / 3,
8119
8119
  count: pointCount,
@@ -8167,8 +8167,8 @@ function meshSolidGroupedBinary(bk, solidId, deflection, includeUVs, angularTole
8167
8167
  if (groupCount !== faceIds.length) throw new Error(`faceOffsets/faceIds length mismatch: ${groupCount} groups vs ${faceIds.length} faces`);
8168
8168
  const faceGroups = [];
8169
8169
  for (let i = 0; i < faceOffsets.length - 1; i++) {
8170
- const start = require_vec3.wasmIndex(faceOffsets, i);
8171
- const count = require_vec3.wasmIndex(faceOffsets, i + 1) - start;
8170
+ const start = require_bug.wasmIndex(faceOffsets, i);
8171
+ const count = require_bug.wasmIndex(faceOffsets, i + 1) - start;
8172
8172
  if (count === 0) continue;
8173
8173
  faceGroups.push({
8174
8174
  start,
@@ -8204,8 +8204,8 @@ function meshSolidGroupedJson(bk, solidId, deflection, includeUVs, angularTolera
8204
8204
  if (groupCount !== faceIds.length) throw new Error(`faceOffsets/faceIds length mismatch: ${groupCount} groups vs ${faceIds.length} faces`);
8205
8205
  const faceGroups = [];
8206
8206
  for (let i = 0; i < data.faceOffsets.length - 1; i++) {
8207
- const start = require_vec3.wasmIndex(data.faceOffsets, i);
8208
- const count = require_vec3.wasmIndex(data.faceOffsets, i + 1) - start;
8207
+ const start = require_bug.wasmIndex(data.faceOffsets, i);
8208
+ const count = require_bug.wasmIndex(data.faceOffsets, i + 1) - start;
8209
8209
  if (count === 0) continue;
8210
8210
  faceGroups.push({
8211
8211
  start,
@@ -8316,7 +8316,7 @@ function exportSTEP(bk, shapes) {
8316
8316
  return parts.join("\n");
8317
8317
  }
8318
8318
  function exportSTL$1(bk, shape, binary, tolerance = require_occtWasmAdapter.DEFAULT_STL_TOLERANCE, angularTolerance = require_occtWasmAdapter.DEFAULT_STL_ANGULAR_TOLERANCE) {
8319
- const { vertices, triangles } = mesh$1(bk, solidHandle(require_vec3.wasmIndex(unwrapSolidsForExport(bk, shape, "exportSTL"), 0)), {
8319
+ const { vertices, triangles } = mesh$1(bk, solidHandle(require_bug.wasmIndex(unwrapSolidsForExport(bk, shape, "exportSTL"), 0)), {
8320
8320
  tolerance,
8321
8321
  angularTolerance,
8322
8322
  skipNormals: true
@@ -8646,7 +8646,7 @@ function createAffinityGTrsf2d(ox, oy, dx, dy, ratio) {
8646
8646
  0,
8647
8647
  1
8648
8648
  ];
8649
- return _gtrsf(m, ox - require_vec3.wasmIndex(m, 0) * ox - require_vec3.wasmIndex(m, 1) * oy, oy - require_vec3.wasmIndex(m, 3) * ox - require_vec3.wasmIndex(m, 4) * oy);
8649
+ return _gtrsf(m, ox - require_bug.wasmIndex(m, 0) * ox - require_bug.wasmIndex(m, 1) * oy, oy - require_bug.wasmIndex(m, 3) * ox - require_bug.wasmIndex(m, 4) * oy);
8650
8650
  }
8651
8651
  function createTranslationGTrsf2d(dx, dy) {
8652
8652
  return _gtrsf([
@@ -8677,7 +8677,7 @@ function createMirrorGTrsf2d(cx, cy, mode, ox, oy, dx, dy) {
8677
8677
  1
8678
8678
  ];
8679
8679
  const px = ox ?? cx, py = oy ?? cy;
8680
- return _gtrsf(m, px - require_vec3.wasmIndex(m, 0) * px - require_vec3.wasmIndex(m, 1) * py, py - require_vec3.wasmIndex(m, 3) * px - require_vec3.wasmIndex(m, 4) * py);
8680
+ return _gtrsf(m, px - require_bug.wasmIndex(m, 0) * px - require_bug.wasmIndex(m, 1) * py, py - require_bug.wasmIndex(m, 3) * px - require_bug.wasmIndex(m, 4) * py);
8681
8681
  }
8682
8682
  return _gtrsf([
8683
8683
  -1,
@@ -8724,8 +8724,8 @@ function setGTrsf2dTranslationPart(gtrsf, dx, dy) {
8724
8724
  }
8725
8725
  function multiplyGTrsf2d(base, other) {
8726
8726
  const a = base.m, b = other.m;
8727
- const ai = (i) => require_vec3.wasmIndex(a, i);
8728
- const bi = (i) => require_vec3.wasmIndex(b, i);
8727
+ const ai = (i) => require_bug.wasmIndex(a, i);
8728
+ const bi = (i) => require_bug.wasmIndex(b, i);
8729
8729
  base.m = [
8730
8730
  ai(0) * bi(0) + ai(1) * bi(3) + ai(2) * bi(6),
8731
8731
  ai(0) * bi(1) + ai(1) * bi(4) + ai(2) * bi(7),
@@ -8756,7 +8756,7 @@ function transformCurve2dGeneral(curve, gtrsf) {
8756
8756
  1
8757
8757
  ];
8758
8758
  const tx = Number(gtrsf.tx) || 0, ty = Number(gtrsf.ty) || 0;
8759
- const m0 = require_vec3.wasmIndex(m, 0), m1 = require_vec3.wasmIndex(m, 1), m3 = require_vec3.wasmIndex(m, 3), m4 = require_vec3.wasmIndex(m, 4);
8759
+ const m0 = require_bug.wasmIndex(m, 0), m1 = require_bug.wasmIndex(m, 1), m3 = require_bug.wasmIndex(m, 3), m4 = require_bug.wasmIndex(m, 4);
8760
8760
  if (Math.abs(m0 - 1) < 1e-12 && Math.abs(m4 - 1) < 1e-12 && Math.abs(m1) < 1e-12 && Math.abs(m3) < 1e-12) return require_occtWasmAdapter.translateCurve2d(c, tx, ty);
8761
8761
  const bounds = require_occtWasmAdapter.curveBounds(c);
8762
8762
  const N = 20;
@@ -8898,8 +8898,8 @@ function approximateCurve2dAsBSpline(curve, tol, cont, maxSeg) {
8898
8898
  for (let i = 0; i < N; i++) {
8899
8899
  const tMid = bounds.first + (bounds.last - bounds.first) * (i + .5) / N;
8900
8900
  const [ex, ey] = require_occtWasmAdapter.evaluateCurve2d(c, tMid);
8901
- const p0 = require_vec3.wasmIndex(poles, i);
8902
- const p1 = require_vec3.wasmIndex(poles, i + 1);
8901
+ const p0 = require_bug.wasmIndex(poles, i);
8902
+ const p1 = require_bug.wasmIndex(poles, i + 1);
8903
8903
  const mx = (p0[0] + p1[0]) / 2;
8904
8904
  const my = (p0[1] + p1[1]) / 2;
8905
8905
  const err = Math.sqrt((ex - mx) ** 2 + (ey - my) ** 2);
@@ -8925,8 +8925,8 @@ function decomposeBSpline2dToBeziers(curve) {
8925
8925
  ];
8926
8926
  const result = [];
8927
8927
  for (let i = 0; i < breakpoints.length - 1; i++) {
8928
- const t0 = require_vec3.wasmIndex(breakpoints, i);
8929
- const t1 = require_vec3.wasmIndex(breakpoints, i + 1);
8928
+ const t0 = require_bug.wasmIndex(breakpoints, i);
8929
+ const t1 = require_bug.wasmIndex(breakpoints, i + 1);
8930
8930
  const span = t1 - t0;
8931
8931
  if (span < 1e-15) continue;
8932
8932
  const p0 = require_occtWasmAdapter.evaluateCurve2d(c, t0);
@@ -9077,7 +9077,7 @@ function liftCurve2dToPlane(bk, curve, origin, planeZ, planeX) {
9077
9077
  const [eu, ev] = require_occtWasmAdapter.evaluateCurve2d(c, bounds.first + (seg + 1) * segmentSpan);
9078
9078
  edgeIds.push(bk.makeCircleArc3d(...lift(su, sv), ...lift(eu, ev), ...center3d, ...axis));
9079
9079
  }
9080
- if (edgeIds.length === 1) return edgeHandle(require_vec3.wasmIndex(edgeIds, 0));
9080
+ if (edgeIds.length === 1) return edgeHandle(require_bug.wasmIndex(edgeIds, 0));
9081
9081
  return wireHandle(bk.makeWire(edgeIds, false));
9082
9082
  }
9083
9083
  if (basis.__bk2d === "ellipse") {
@@ -9109,13 +9109,13 @@ function liftCurve2dToPlane(bk, curve, origin, planeZ, planeX) {
9109
9109
  const [eu, ev] = require_occtWasmAdapter.evaluateCurve2d(c, bounds.first + (seg + 1) * segmentSpan);
9110
9110
  edgeIds.push(bk.makeEllipseArc3d(...lift(su, sv), ...lift(eu, ev), ...center3d, ...axis, ...refDir, ell.majorRadius, ell.minorRadius));
9111
9111
  }
9112
- if (edgeIds.length === 1) return edgeHandle(require_vec3.wasmIndex(edgeIds, 0));
9112
+ if (edgeIds.length === 1) return edgeHandle(require_bug.wasmIndex(edgeIds, 0));
9113
9113
  return wireHandle(bk.makeWire(edgeIds, false));
9114
9114
  }
9115
9115
  }
9116
9116
  if (c.__bk2d === "bezier" || c.__bk2d === "bspline") {
9117
9117
  const points3d = c.poles.map(([u, v]) => lift(u, v));
9118
- if (points3d.length === 2) return makeLineEdge(bk, require_vec3.wasmIndex(points3d, 0), require_vec3.wasmIndex(points3d, 1));
9118
+ if (points3d.length === 2) return makeLineEdge(bk, require_bug.wasmIndex(points3d, 0), require_bug.wasmIndex(points3d, 1));
9119
9119
  const degree = Math.min(3, points3d.length - 1);
9120
9120
  const coords = points3d.flatMap(([px, py, pz]) => [
9121
9121
  px,
@@ -9144,7 +9144,7 @@ function buildEdgeOnSurface(bk, curve, surface) {
9144
9144
  for (let i = 0; i <= N; i++) {
9145
9145
  const t = bounds.first + (bounds.last - bounds.first) * i / N;
9146
9146
  const [u, v] = require_occtWasmAdapter.evaluateCurve2d(c, t);
9147
- points.push(require_vec3.vec3At(bk.evaluateSurface(fid, u, v)));
9147
+ points.push(require_bug.vec3At(bk.evaluateSurface(fid, u, v)));
9148
9148
  }
9149
9149
  return interpolatePoints(bk, points);
9150
9150
  }
@@ -9162,8 +9162,8 @@ function refineUVSamples(uvSamples, evaluateUV, maxSamples, threshold) {
9162
9162
  while (uvSamples.length < maxSamples) {
9163
9163
  const insertions = [];
9164
9164
  for (let i = 0; i < uvSamples.length - 1; i++) {
9165
- const a = require_vec3.wasmIndex(uvSamples, i);
9166
- const b = require_vec3.wasmIndex(uvSamples, i + 1);
9165
+ const a = require_bug.wasmIndex(uvSamples, i);
9166
+ const b = require_bug.wasmIndex(uvSamples, i + 1);
9167
9167
  const tMid = (a.t + b.t) / 2;
9168
9168
  const uvMid = evaluateUV(tMid);
9169
9169
  const interpU = (a.uv[0] + b.uv[0]) / 2;
@@ -9177,7 +9177,7 @@ function refineUVSamples(uvSamples, evaluateUV, maxSamples, threshold) {
9177
9177
  if (insertions.length === 0) break;
9178
9178
  let budget = maxSamples - uvSamples.length;
9179
9179
  for (let j = insertions.length - 1; j >= 0 && budget > 0; j--) {
9180
- const ins = require_vec3.wasmIndex(insertions, j);
9180
+ const ins = require_bug.wasmIndex(insertions, j);
9181
9181
  uvSamples.splice(ins.index, 0, {
9182
9182
  t: ins.t,
9183
9183
  uv: ins.uv
@@ -9201,8 +9201,8 @@ function extractCurve2dFromEdge(bk, edge, face) {
9201
9201
  for (let i = 0; i <= BASE_N; i++) tValues.push(tMin + (tMax - tMin) * i / BASE_N);
9202
9202
  const evaluateUV = (t) => {
9203
9203
  const pt = bk.evaluateEdgeCurve(eid, t);
9204
- const uv = bk.projectPointOnSurface(fid, require_vec3.wasmIndex(pt, 0), require_vec3.wasmIndex(pt, 1), require_vec3.wasmIndex(pt, 2));
9205
- return [require_vec3.wasmIndex(uv, 0), require_vec3.wasmIndex(uv, 1)];
9204
+ const uv = bk.projectPointOnSurface(fid, require_bug.wasmIndex(pt, 0), require_bug.wasmIndex(pt, 1), require_bug.wasmIndex(pt, 2));
9205
+ return [require_bug.wasmIndex(uv, 0), require_bug.wasmIndex(uv, 1)];
9206
9206
  };
9207
9207
  const uvSamples = tValues.map((t) => ({
9208
9208
  t,
@@ -9213,9 +9213,9 @@ function extractCurve2dFromEdge(bk, edge, face) {
9213
9213
  if (uvPoints.length >= 2) return makeBSpline2d(uvPoints);
9214
9214
  const verts = bk.getEdgeVertices(eid);
9215
9215
  if (verts.length >= 6) {
9216
- const uv1 = bk.projectPointOnSurface(fid, require_vec3.wasmIndex(verts, 0), require_vec3.wasmIndex(verts, 1), require_vec3.wasmIndex(verts, 2));
9217
- const uv2 = bk.projectPointOnSurface(fid, require_vec3.wasmIndex(verts, 3), require_vec3.wasmIndex(verts, 4), require_vec3.wasmIndex(verts, 5));
9218
- return require_occtWasmAdapter.makeLine2d(require_vec3.wasmIndex(uv1, 0), require_vec3.wasmIndex(uv1, 1), require_vec3.wasmIndex(uv2, 0), require_vec3.wasmIndex(uv2, 1));
9216
+ const uv1 = bk.projectPointOnSurface(fid, require_bug.wasmIndex(verts, 0), require_bug.wasmIndex(verts, 1), require_bug.wasmIndex(verts, 2));
9217
+ const uv2 = bk.projectPointOnSurface(fid, require_bug.wasmIndex(verts, 3), require_bug.wasmIndex(verts, 4), require_bug.wasmIndex(verts, 5));
9218
+ return require_occtWasmAdapter.makeLine2d(require_bug.wasmIndex(uv1, 0), require_bug.wasmIndex(uv1, 1), require_bug.wasmIndex(uv2, 0), require_bug.wasmIndex(uv2, 1));
9219
9219
  }
9220
9220
  throw new Error(`brepkit: extractCurve2dFromEdge: degenerate edge (${verts.length} coords)`);
9221
9221
  }
@@ -9231,14 +9231,14 @@ function fillSurface(bk, wires, _options) {
9231
9231
  for (const edge of wireEdges) {
9232
9232
  const edgeId = unwrap$1(edge, "edge");
9233
9233
  const params = bk.getEdgeCurveParameters(edgeId);
9234
- const tMin = require_vec3.wasmIndex(params, 0);
9235
- const tMax = require_vec3.wasmIndex(params, 1);
9234
+ const tMin = require_bug.wasmIndex(params, 0);
9235
+ const tMax = require_bug.wasmIndex(params, 1);
9236
9236
  const N = 10;
9237
9237
  const pts = [];
9238
9238
  for (let i = 0; i <= N; i++) {
9239
9239
  const t = tMin + (tMax - tMin) * i / N;
9240
9240
  const p = bk.evaluateEdgeCurve(edgeId, t);
9241
- pts.push(require_vec3.wasmIndex(p, 0), require_vec3.wasmIndex(p, 1), require_vec3.wasmIndex(p, 2));
9241
+ pts.push(require_bug.wasmIndex(p, 0), require_bug.wasmIndex(p, 1), require_bug.wasmIndex(p, 2));
9242
9242
  }
9243
9243
  allCoords.push(...pts);
9244
9244
  curveLengths.push(11);
@@ -9367,14 +9367,14 @@ function length(bk, shape) {
9367
9367
  function edgeMidpoint(bk, edgeId) {
9368
9368
  const v = bk.getEdgeVertices(edgeId);
9369
9369
  return [
9370
- (require_vec3.wasmIndex(v, 0) + require_vec3.wasmIndex(v, 3)) / 2,
9371
- (require_vec3.wasmIndex(v, 1) + require_vec3.wasmIndex(v, 4)) / 2,
9372
- (require_vec3.wasmIndex(v, 2) + require_vec3.wasmIndex(v, 5)) / 2
9370
+ (require_bug.wasmIndex(v, 0) + require_bug.wasmIndex(v, 3)) / 2,
9371
+ (require_bug.wasmIndex(v, 1) + require_bug.wasmIndex(v, 4)) / 2,
9372
+ (require_bug.wasmIndex(v, 2) + require_bug.wasmIndex(v, 5)) / 2
9373
9373
  ];
9374
9374
  }
9375
9375
  function centerOfMass$1(bk, shape) {
9376
9376
  const h = shape;
9377
- if (h.type === "solid") return require_vec3.vec3At(bk.centerOfMass(unwrap$1(shape), DEFAULT_DEFLECTION));
9377
+ if (h.type === "solid") return require_bug.vec3At(bk.centerOfMass(unwrap$1(shape), DEFAULT_DEFLECTION));
9378
9378
  if (h.type === "face") {
9379
9379
  const domain = uvBounds(bk, shape);
9380
9380
  return pointOnSurface(bk, shape, (domain.uMin + domain.uMax) / 2, (domain.vMin + domain.vMax) / 2);
@@ -9412,8 +9412,8 @@ function boundingBox$1(bk, shape) {
9412
9412
  if (h.type === "solid") {
9413
9413
  const bb = bk.boundingBox(unwrap$1(shape));
9414
9414
  return {
9415
- min: require_vec3.vec3At(bb, 0),
9416
- max: require_vec3.vec3At(bb, 3)
9415
+ min: require_bug.vec3At(bb, 0),
9416
+ max: require_bug.vec3At(bb, 3)
9417
9417
  };
9418
9418
  }
9419
9419
  if (h.type === "vertex") {
@@ -9467,28 +9467,28 @@ function distance$1(bk, shape1, shape2) {
9467
9467
  if (h1.type === "solid" && h2.type === "solid") {
9468
9468
  const buf = bk.solidToSolidDistance(h1.id, h2.id);
9469
9469
  return {
9470
- value: require_vec3.wasmIndex(buf, 0),
9471
- point1: require_vec3.vec3At(buf, 1),
9472
- point2: require_vec3.vec3At(buf, 4)
9470
+ value: require_bug.wasmIndex(buf, 0),
9471
+ point1: require_bug.vec3At(buf, 1),
9472
+ point2: require_bug.vec3At(buf, 4)
9473
9473
  };
9474
9474
  }
9475
9475
  if (h1.type === "vertex" && (h2.type === "solid" || h2.type === "face" || h2.type === "edge")) {
9476
- const point1 = require_vec3.vec3At(bk.getVertexPosition(h1.id));
9476
+ const point1 = require_bug.vec3At(bk.getVertexPosition(h1.id));
9477
9477
  const result = h2.type === "solid" ? bk.pointToSolidDistance(point1[0], point1[1], point1[2], h2.id) : h2.type === "face" ? bk.pointToFaceDistance(point1[0], point1[1], point1[2], h2.id) : bk.pointToEdgeDistance(point1[0], point1[1], point1[2], h2.id);
9478
9478
  return {
9479
- value: require_vec3.wasmIndex(result, 0),
9479
+ value: require_bug.wasmIndex(result, 0),
9480
9480
  point1,
9481
- point2: require_vec3.vec3At(result, 1)
9481
+ point2: require_bug.vec3At(result, 1)
9482
9482
  };
9483
9483
  }
9484
9484
  const getPos = (s) => {
9485
- if (s.type === "vertex") return require_vec3.vec3At(bk.getVertexPosition(s.id));
9485
+ if (s.type === "vertex") return require_bug.vec3At(bk.getVertexPosition(s.id));
9486
9486
  if (s.type === "solid") {
9487
9487
  const bb = bk.boundingBox(s.id);
9488
9488
  return [
9489
- (require_vec3.wasmIndex(bb, 0) + require_vec3.wasmIndex(bb, 3)) / 2,
9490
- (require_vec3.wasmIndex(bb, 1) + require_vec3.wasmIndex(bb, 4)) / 2,
9491
- (require_vec3.wasmIndex(bb, 2) + require_vec3.wasmIndex(bb, 5)) / 2
9489
+ (require_bug.wasmIndex(bb, 0) + require_bug.wasmIndex(bb, 3)) / 2,
9490
+ (require_bug.wasmIndex(bb, 1) + require_bug.wasmIndex(bb, 4)) / 2,
9491
+ (require_bug.wasmIndex(bb, 2) + require_bug.wasmIndex(bb, 5)) / 2
9492
9492
  ];
9493
9493
  }
9494
9494
  return [
@@ -9512,15 +9512,15 @@ function surfaceCurvature$1(bk, face, u, v) {
9512
9512
  const fid = unwrap$1(face, "face");
9513
9513
  const data = bk.measureCurvatureAtSurface(fid, u, v);
9514
9514
  if (data.length < 8) throw new Error(`brepkit: measureCurvatureAtSurface returned ${data.length} values, expected 8`);
9515
- const k1 = require_vec3.wasmIndex(data, 0);
9516
- const k2 = require_vec3.wasmIndex(data, 1);
9515
+ const k1 = require_bug.wasmIndex(data, 0);
9516
+ const k2 = require_bug.wasmIndex(data, 1);
9517
9517
  return {
9518
9518
  gaussian: k1 * k2,
9519
9519
  mean: (k1 + k2) / 2,
9520
9520
  max: Math.max(k1, k2),
9521
9521
  min: Math.min(k1, k2),
9522
- maxDirection: require_vec3.vec3At(data, 2),
9523
- minDirection: require_vec3.vec3At(data, 5)
9522
+ maxDirection: require_bug.vec3At(data, 2),
9523
+ minDirection: require_bug.vec3At(data, 5)
9524
9524
  };
9525
9525
  }
9526
9526
  function surfaceCenterOfMass(bk, face) {
@@ -9529,18 +9529,18 @@ function surfaceCenterOfMass(bk, face) {
9529
9529
  const idx = mesh.indices;
9530
9530
  let cx = 0, cy = 0, cz = 0, totalArea = 0;
9531
9531
  for (let t = 0; t < idx.length; t += 3) {
9532
- const i0 = require_vec3.wasmIndex(idx, t) * 3;
9533
- const i1 = require_vec3.wasmIndex(idx, t + 1) * 3;
9534
- const i2 = require_vec3.wasmIndex(idx, t + 2) * 3;
9535
- const p0x = require_vec3.wasmIndex(pos, i0);
9536
- const p0y = require_vec3.wasmIndex(pos, i0 + 1);
9537
- const p0z = require_vec3.wasmIndex(pos, i0 + 2);
9538
- const p1x = require_vec3.wasmIndex(pos, i1);
9539
- const p1y = require_vec3.wasmIndex(pos, i1 + 1);
9540
- const p1z = require_vec3.wasmIndex(pos, i1 + 2);
9541
- const p2x = require_vec3.wasmIndex(pos, i2);
9542
- const p2y = require_vec3.wasmIndex(pos, i2 + 1);
9543
- const p2z = require_vec3.wasmIndex(pos, i2 + 2);
9532
+ const i0 = require_bug.wasmIndex(idx, t) * 3;
9533
+ const i1 = require_bug.wasmIndex(idx, t + 1) * 3;
9534
+ const i2 = require_bug.wasmIndex(idx, t + 2) * 3;
9535
+ const p0x = require_bug.wasmIndex(pos, i0);
9536
+ const p0y = require_bug.wasmIndex(pos, i0 + 1);
9537
+ const p0z = require_bug.wasmIndex(pos, i0 + 2);
9538
+ const p1x = require_bug.wasmIndex(pos, i1);
9539
+ const p1y = require_bug.wasmIndex(pos, i1 + 1);
9540
+ const p1z = require_bug.wasmIndex(pos, i1 + 2);
9541
+ const p2x = require_bug.wasmIndex(pos, i2);
9542
+ const p2y = require_bug.wasmIndex(pos, i2 + 1);
9543
+ const p2z = require_bug.wasmIndex(pos, i2 + 2);
9544
9544
  const tcx = (p0x + p1x + p2x) / 3;
9545
9545
  const tcy = (p0y + p1y + p2y) / 3;
9546
9546
  const tcz = (p0z + p1z + p2z) / 3;
@@ -10031,7 +10031,7 @@ function resolveOcct() {
10031
10031
  }
10032
10032
  function occtOrThrow(method) {
10033
10033
  const occt = resolveOcct();
10034
- if (!occt) throw new Error(`manifold: ${method} requires a registered occt kernel; none is available`);
10034
+ if (!occt) throw new require_occtWasmAdapter.UnsupportedKernelOperationError(`manifold: ${method} requires a registered occt kernel; none is available`);
10035
10035
  return occt;
10036
10036
  }
10037
10037
  var brepCache = /* @__PURE__ */ new WeakMap();
@@ -13189,7 +13189,7 @@ function measureBulk(shape, _includeLinear = false) {
13189
13189
  }
13190
13190
  function surfaceCurvature(face, u, v) {
13191
13191
  const occt = resolveOcct();
13192
- if (!occt) throw new Error("manifold: surfaceCurvature requires a registered occt kernel; none is available");
13192
+ if (!occt) throw new require_occtWasmAdapter.UnsupportedKernelOperationError("manifold: surfaceCurvature requires a registered occt kernel; none is available");
13193
13193
  const ms = asManifoldShape(face);
13194
13194
  if (!ms) return occt.surfaceCurvature(face, u, v);
13195
13195
  if (!ms.node.replayable) throw new Error("manifold: surfaceCurvature unsupported; shape originates from a non-replayable op (raw mesh import or mesh boolean)");
@@ -14358,13 +14358,13 @@ function viaOcct(shape, query) {
14358
14358
  const witness = shape;
14359
14359
  if (witness && witness.__manifoldSub && witness.occt) {
14360
14360
  const occt = resolveOcct();
14361
- if (!occt) throw new Error("manifold: sub-shape geometry query requires a registered occt kernel");
14361
+ if (!occt) throw new require_occtWasmAdapter.UnsupportedKernelOperationError("manifold: sub-shape geometry query requires a registered occt kernel");
14362
14362
  return query(witness.occt, occt);
14363
14363
  }
14364
14364
  const ms = asManifoldShape(shape);
14365
14365
  if (!ms) throw new Error("manifold: exact geometry query requires a manifold shape handle");
14366
14366
  const occt = resolveOcct();
14367
- if (!occt) throw new Error("manifold: exact geometry query unsupported on manifold kernel; no B-rep kernel registered");
14367
+ if (!occt) throw new require_occtWasmAdapter.UnsupportedKernelOperationError("manifold: exact geometry query unsupported on manifold kernel; no B-rep kernel registered");
14368
14368
  if (!ms.node.replayable) throw new Error("manifold: exact geometry query unsupported; shape originates from a non-replayable op (raw mesh import or mesh boolean)");
14369
14369
  let occtShape = brepCache.get(ms.node);
14370
14370
  if (occtShape === void 0) {