brepjs 19.0.3 → 19.0.5

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 (88) hide show
  1. package/dist/2d.cjs +6 -6
  2. package/dist/2d.js +6 -6
  3. package/dist/{adjacencyFns-Cuqqg_9C.js → adjacencyFns-BFgzaWom.js} +40 -6
  4. package/dist/{adjacencyFns-D1sYXJUk.cjs → adjacencyFns-CZ8tOKo6.cjs} +40 -6
  5. package/dist/{blueprint-BeuiC2jB.js → blueprint-CuE8oS8o.js} +5 -5
  6. package/dist/{blueprint-DbMLINgb.cjs → blueprint-Pd5C9eyi.cjs} +5 -5
  7. package/dist/{blueprintFns-JT9_SPeA.js → blueprintFns-DeK5m2Dd.js} +2 -2
  8. package/dist/{blueprintFns-CtpFK_Qe.cjs → blueprintFns-Jt8aabnr.cjs} +2 -2
  9. package/dist/{blueprintSketcher-Dedw15H1.cjs → blueprintSketcher-BbbIIw68.cjs} +3 -3
  10. package/dist/{blueprintSketcher-Dr5-ITBw.js → blueprintSketcher-s1mCyP4C.js} +3 -3
  11. package/dist/{boolean2D-Dktt8ed6.cjs → boolean2D-B5-s6yey.cjs} +4 -4
  12. package/dist/{boolean2D-D1EzLW3j.js → boolean2D-XkF5a9UO.js} +4 -4
  13. package/dist/brepjs.cjs +30 -28
  14. package/dist/brepjs.js +30 -29
  15. package/dist/{cameraFns-D59FeXIj.js → cameraFns-C42m8_GN.js} +3 -3
  16. package/dist/{cameraFns-CKl-ZLoM.cjs → cameraFns-C_aXHOXb.cjs} +3 -3
  17. package/dist/core/cleanupError.d.ts +9 -0
  18. package/dist/core/shapeTypes.d.ts +2 -0
  19. package/dist/core.cjs +3 -2
  20. package/dist/core.d.ts +1 -0
  21. package/dist/core.js +3 -3
  22. package/dist/{cornerFinder-Cq-kBDcR.js → cornerFinder-B5uO-_nX.js} +1 -1
  23. package/dist/{cornerFinder-CLEHlBMf.cjs → cornerFinder-BSHr_G27.cjs} +1 -1
  24. package/dist/{curveFns-DXMlN84x.cjs → curveFns-BRhVbssu.cjs} +1 -1
  25. package/dist/{curveFns-CIyfCLCt.js → curveFns-xQNPUc23.js} +1 -1
  26. package/dist/{drawFns-BaGbMy6K.cjs → drawFns-ByfPdMin.cjs} +12 -12
  27. package/dist/{drawFns-Dr9iCrbh.js → drawFns-S-UBDz0z.js} +12 -12
  28. package/dist/{faceFns-qnvwgyaw.cjs → faceFns-BbkcUym2.cjs} +2 -2
  29. package/dist/{faceFns-2wV1msnQ.js → faceFns-WhbyFezr.js} +2 -2
  30. package/dist/{healingFns-BSHqLCOx.cjs → healingFns-CxWU6nqI.cjs} +4 -4
  31. package/dist/{healingFns-J_O-YEpl.js → healingFns-sTD9eRIy.js} +4 -4
  32. package/dist/{helpers-YWE4RECX.cjs → helpers-HXscoErf.cjs} +6 -6
  33. package/dist/{helpers-DHU9mCM7.js → helpers-m7uW_dyL.js} +6 -6
  34. package/dist/{importFns-DF9TqvQt.cjs → importFns-BUiDmbn7.cjs} +2 -2
  35. package/dist/{importFns-BHmZYBBq.js → importFns-C9yuTs04.js} +2 -2
  36. package/dist/index.d.ts +1 -0
  37. package/dist/io.cjs +2 -2
  38. package/dist/io.js +2 -2
  39. package/dist/kernel/manifold/kernel2dNative.d.ts +1 -1
  40. package/dist/{loftFns-B9-6-lOQ.cjs → loftFns-BUtmwfSU.cjs} +1 -1
  41. package/dist/{loftFns-qB9Ek9-L.js → loftFns-oiR_wtVd.js} +1 -1
  42. package/dist/{measureFns-CCd5bBnv.js → measureFns-B2-vw7XG.js} +3 -3
  43. package/dist/{measureFns-DU8x4zPn.cjs → measureFns-BX7yvMB_.cjs} +3 -3
  44. package/dist/measurement.cjs +1 -1
  45. package/dist/measurement.js +1 -1
  46. package/dist/{meshFns-DvDybgNn.js → meshFns-13CekW14.js} +3 -3
  47. package/dist/{meshFns-DkMiqcvB.cjs → meshFns-DFhnm9DB.cjs} +3 -3
  48. package/dist/operations.cjs +2 -2
  49. package/dist/operations.js +2 -2
  50. package/dist/{originTrackingFns-Bm7CD2oW.cjs → originTrackingFns-B1dazHMg.cjs} +2 -2
  51. package/dist/{originTrackingFns-j2je8lQv.js → originTrackingFns-DYB8oZOX.js} +2 -2
  52. package/dist/{primitiveFns-C-rBAvgV.cjs → primitiveFns-BdM2vG17.cjs} +38 -10
  53. package/dist/{primitiveFns-itCYAzxU.js → primitiveFns-DjKUrsMr.js} +38 -10
  54. package/dist/projection.cjs +1 -1
  55. package/dist/projection.js +1 -1
  56. package/dist/query.cjs +2 -2
  57. package/dist/query.js +2 -2
  58. package/dist/{refResolveFns-DTZoqjRs.js → refResolveFns-BhN6_Z7B.js} +6 -6
  59. package/dist/{refResolveFns-CxIokx3w.cjs → refResolveFns-IdHk_1vT.cjs} +6 -6
  60. package/dist/{shapeFns-B_GAp2z3.js → shapeFns-B2Xg4Xom.js} +2 -2
  61. package/dist/{shapeFns-FzE1ivNh.cjs → shapeFns-D6EjojPG.cjs} +2 -2
  62. package/dist/shapeRef.cjs +1 -1
  63. package/dist/shapeRef.js +1 -1
  64. package/dist/{shapeTypes-CIMiWenj.js → shapeTypes-2oI77VpW.js} +75 -11
  65. package/dist/{shapeTypes-DZZldFUS.cjs → shapeTypes-GoRBg9oo.cjs} +80 -10
  66. package/dist/sketching.cjs +3 -3
  67. package/dist/sketching.js +3 -3
  68. package/dist/{solidBuilders-x5Bz2ELQ.cjs → solidBuilders-BDwUKmVl.cjs} +51 -26
  69. package/dist/{solidBuilders-DKwoY2nP.js → solidBuilders-Buze6qct.js} +50 -25
  70. package/dist/{surfaceBuilders-CHfC8AUd.js → surfaceBuilders-DcD6eAJW.js} +3 -3
  71. package/dist/{surfaceBuilders-B9llhfrz.cjs → surfaceBuilders-rWRvkB_K.cjs} +3 -3
  72. package/dist/text.cjs +2 -2
  73. package/dist/text.js +2 -2
  74. package/dist/{textBlueprints-D6csroh5.cjs → textBlueprints-DoePacWO.cjs} +7 -7
  75. package/dist/{textBlueprints-B3cJhqsf.js → textBlueprints-lFyk_adY.js} +7 -7
  76. package/dist/{textMetrics-B_Js6IoN.js → textMetrics-CmAlcFpe.js} +1 -1
  77. package/dist/{textMetrics-sApnOuwi.cjs → textMetrics-DemtrM-e.cjs} +1 -1
  78. package/dist/{threadFns-iR-yK8rr.js → threadFns-C1EWB5h6.js} +7 -7
  79. package/dist/{threadFns-52YHK9wK.cjs → threadFns-DzoOHczW.cjs} +7 -7
  80. package/dist/topology/api.d.ts +2 -1
  81. package/dist/topology/transformFns.d.ts +2 -1
  82. package/dist/topology.cjs +9 -9
  83. package/dist/topology.js +9 -9
  84. package/dist/{topologyQueryFns-Dp_LqPFF.js → topologyQueryFns-C2tBjzT8.js} +1 -1
  85. package/dist/{topologyQueryFns-DYslfber.cjs → topologyQueryFns-CZAfuhOE.cjs} +1 -1
  86. package/dist/{validityTypes-BqJb23o4.js → validityTypes-BAwJuMQB.js} +1 -1
  87. package/dist/{validityTypes-BYnGyL8L.cjs → validityTypes-rPudJ_eg.cjs} +1 -1
  88. package/package.json +7 -7
@@ -1,9 +1,9 @@
1
- import { K as getKernel, g as disposeTransientSubShape, o as castShapeWithKnownType } from "./shapeTypes-CIMiWenj.js";
2
- import { C as vertexPosition, c as getFaces } from "./topologyQueryFns-Dp_LqPFF.js";
3
- import { i as faceGeomType, l as normalAt, r as faceCenter } from "./faceFns-2wV1msnQ.js";
4
- import { n as getHashCode } from "./shapeFns-B_GAp2z3.js";
5
- import { n as measureArea, s as measureLength } from "./measureFns-CCd5bBnv.js";
6
- import { a as facesOfVertex, c as verticesOfFace, i as facesOfEdge, o as sharedEdges, s as verticesOfEdge, t as adjacentFaceHashes } from "./adjacencyFns-Cuqqg_9C.js";
1
+ import { g as disposeTransientSubShape, o as castShapeWithKnownType, q as getKernel } from "./shapeTypes-2oI77VpW.js";
2
+ import { C as vertexPosition, c as getFaces } from "./topologyQueryFns-C2tBjzT8.js";
3
+ import { i as faceGeomType, l as normalAt, r as faceCenter } from "./faceFns-WhbyFezr.js";
4
+ import { n as getHashCode } from "./shapeFns-B2Xg4Xom.js";
5
+ import { n as measureArea, s as measureLength } from "./measureFns-B2-vw7XG.js";
6
+ import { a as facesOfVertex, c as verticesOfFace, i as facesOfEdge, o as sharedEdges, s as verticesOfEdge, t as adjacentFaceHashes } from "./adjacencyFns-BFgzaWom.js";
7
7
  //#region src/topology/shapeRef/scoring.ts
8
8
  /**
9
9
  * Default face scorer combining surface type, normal alignment, centroid proximity,
@@ -1,9 +1,9 @@
1
- const require_shapeTypes = require("./shapeTypes-DZZldFUS.cjs");
2
- const require_topologyQueryFns = require("./topologyQueryFns-DYslfber.cjs");
3
- const require_faceFns = require("./faceFns-qnvwgyaw.cjs");
4
- const require_shapeFns = require("./shapeFns-FzE1ivNh.cjs");
5
- const require_measureFns = require("./measureFns-DU8x4zPn.cjs");
6
- const require_adjacencyFns = require("./adjacencyFns-D1sYXJUk.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-GoRBg9oo.cjs");
2
+ const require_topologyQueryFns = require("./topologyQueryFns-CZAfuhOE.cjs");
3
+ const require_faceFns = require("./faceFns-BbkcUym2.cjs");
4
+ const require_shapeFns = require("./shapeFns-D6EjojPG.cjs");
5
+ const require_measureFns = require("./measureFns-BX7yvMB_.cjs");
6
+ const require_adjacencyFns = require("./adjacencyFns-CZ8tOKo6.cjs");
7
7
  //#region src/topology/shapeRef/scoring.ts
8
8
  /**
9
9
  * Default face scorer combining surface type, normal alignment, centroid proximity,
@@ -1,6 +1,6 @@
1
- import { K as getKernel } from "./shapeTypes-CIMiWenj.js";
1
+ import { q as getKernel } from "./shapeTypes-2oI77VpW.js";
2
2
  import { t as BrepErrorCode } from "./errors-CTn8i3lY.js";
3
- import { T as kernelCallRaw, w as kernelCall } from "./topologyQueryFns-Dp_LqPFF.js";
3
+ import { T as kernelCallRaw, w as kernelCall } from "./topologyQueryFns-C2tBjzT8.js";
4
4
  import { n as HASH_CODE_MAX } from "./constants-ITRzCnCp.js";
5
5
  //#region src/topology/shapeFns.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
- const require_shapeTypes = require("./shapeTypes-DZZldFUS.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-GoRBg9oo.cjs");
2
2
  const require_errors = require("./errors-DWezb9DI.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-DYslfber.cjs");
3
+ const require_topologyQueryFns = require("./topologyQueryFns-CZAfuhOE.cjs");
4
4
  const require_constants = require("./constants-BOVyEYGH.cjs");
5
5
  //#region src/topology/shapeFns.ts
6
6
  /**
package/dist/shapeRef.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_refResolveFns = require("./refResolveFns-CxIokx3w.cjs");
2
+ const require_refResolveFns = require("./refResolveFns-IdHk_1vT.cjs");
3
3
  exports.assignRoles = require_refResolveFns.assignRoles;
4
4
  exports.captureHint = require_refResolveFns.captureHint;
5
5
  exports.createDerivedFaceRef = require_refResolveFns.createDerivedFaceRef;
package/dist/shapeRef.js CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-DTZoqjRs.js";
1
+ import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-BhN6_Z7B.js";
2
2
  export { assignRoles, captureHint, createDerivedFaceRef, createEdgeRef, createRef, createVertexRef, defaultScorer, isDerivedFaceRef, isEdgeRef, isFaceRef, isLineageRef, isVertexRef, resolveDerivedFaceRef, resolveEdgeRef, resolveLineageRef, resolveRef, resolveRefIn, resolveRefParams, resolveVertexRef, updateRoles };
@@ -7124,9 +7124,23 @@ function makeWireFromMixed(bk, items) {
7124
7124
  function makeCompound(bk, shapes) {
7125
7125
  const handles = shapes.filter(isBrepkitHandle);
7126
7126
  if (handles.length === 0) throw new Error("brepkit: makeCompound requires at least one shape");
7127
- if (handles.every((h) => h.type === "solid")) return compoundHandle(bk.makeCompound(handles.map((h) => h.id)));
7127
+ const flat = [];
7128
+ const collect = (h) => {
7129
+ if (h.type !== "compound") {
7130
+ flat.push(h);
7131
+ return;
7132
+ }
7133
+ const synthetic = syntheticCompounds.get(h.id);
7134
+ if (synthetic) {
7135
+ synthetic.forEach(collect);
7136
+ return;
7137
+ }
7138
+ for (const id of toArray(bk.getCompoundSolids(h.id))) flat.push(solidHandle(id));
7139
+ };
7140
+ handles.forEach(collect);
7141
+ if (flat.every((h) => h.type === "solid")) return compoundHandle(bk.makeCompound(flat.map((h) => h.id)));
7128
7142
  const id = nextSyntheticId();
7129
- syntheticCompounds.set(id, handles);
7143
+ syntheticCompounds.set(id, flat);
7130
7144
  return compoundHandle(id);
7131
7145
  }
7132
7146
  function makeBoxFromCorners(bk, p1, p2) {
@@ -8919,6 +8933,19 @@ function transformCurve2dGeneral(curve, gtrsf) {
8919
8933
  const tx = Number(gtrsf.tx) || 0, ty = Number(gtrsf.ty) || 0;
8920
8934
  const m0 = wasmIndex(m, 0), m1 = wasmIndex(m, 1), m3 = wasmIndex(m, 3), m4 = wasmIndex(m, 4);
8921
8935
  if (Math.abs(m0 - 1) < 1e-12 && Math.abs(m4 - 1) < 1e-12 && Math.abs(m1) < 1e-12 && Math.abs(m3) < 1e-12) return translateCurve2d$2(c, tx, ty);
8936
+ const colLen0 = Math.hypot(m0, m3);
8937
+ const colLen1 = Math.hypot(m1, m4);
8938
+ const colDot = m0 * m1 + m3 * m4;
8939
+ const scaleRef = Math.max(colLen0, colLen1);
8940
+ if (colLen0 > 0 && colLen1 > 0 && Math.abs(colLen0 - colLen1) <= 1e-12 * scaleRef && Math.abs(colDot) <= 1e-12 * colLen0 * colLen1) {
8941
+ const det = m0 * m4 - m1 * m3;
8942
+ const angle = Math.atan2(m3, m0);
8943
+ let out = Math.abs(colLen0 - 1) < 1e-15 ? c : scaleCurve2d$2(c, colLen0, 0, 0);
8944
+ if (det > 0) {
8945
+ if (Math.abs(angle) > 1e-15) out = rotateCurve2d$2(out, angle, 0, 0);
8946
+ } else out = mirrorAcrossAxis(out, 0, 0, Math.cos(angle / 2), Math.sin(angle / 2));
8947
+ return tx !== 0 || ty !== 0 ? translateCurve2d$2(out, tx, ty) : out;
8948
+ }
8922
8949
  const bounds = curveBounds(c);
8923
8950
  const N = 20;
8924
8951
  const pts = [];
@@ -15365,7 +15392,7 @@ function circleThrough3(p1, pm, p2) {
15365
15392
  else a1 = a0 - norm(a0 - a1);
15366
15393
  return conic(center, [r, 0], [0, r], a0, a1);
15367
15394
  }
15368
- function makeNativeKernel2DOps(module, occt) {
15395
+ function makeNativeKernel2DOps(_module, occt) {
15369
15396
  const PLACEHOLDER = {
15370
15397
  delete: () => {},
15371
15398
  isEmpty: () => false
@@ -15451,7 +15478,6 @@ function makeNativeKernel2DOps(module, occt) {
15451
15478
  const r = Math.hypot(sx - cx, sy - cy);
15452
15479
  const a0 = Math.atan2(sy - cy, sx - cx);
15453
15480
  let a1 = Math.atan2(ey - cy, ex - cx);
15454
- nx * tx + ny * ty;
15455
15481
  const norm = (x) => (x % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI);
15456
15482
  const tangCCW = [-(sy - cy), sx - cx];
15457
15483
  if (tangCCW[0] * tx + tangCCW[1] * ty >= 0) a1 = a0 + norm(a1 - a0);
@@ -16656,6 +16682,17 @@ function getShapeKind(shape) {
16656
16682
  return getOrQueryType(getKernel(), shape.wrapped);
16657
16683
  }
16658
16684
  //#endregion
16685
+ //#region src/core/cleanupError.ts
16686
+ /** An observable failed release. Its native outcome is uncertain; never retry it blindly. */
16687
+ var GeometryCleanupError = class extends Error {
16688
+ resourceKind;
16689
+ constructor(options) {
16690
+ super(options.message, { cause: options.cause });
16691
+ this.name = "GeometryCleanupError";
16692
+ this.resourceKind = options.resourceKind;
16693
+ }
16694
+ };
16695
+ //#endregion
16659
16696
  //#region src/core/shapeTypes.ts
16660
16697
  function brandHandle(handle, dim) {
16661
16698
  if (dim === "2D") handle["__is2D"] = true;
@@ -16782,11 +16819,39 @@ function disposeDowncastSource(source, cast) {
16782
16819
  * Cast a freshly-produced kernel result to its branded type and release the
16783
16820
  * orphaned pre-downcast handle. The result-owning counterpart to {@link castShape};
16784
16821
  * see {@link disposeDowncastSource} for the arena semantics.
16822
+ * Consumes the raw result on success or failure; callers must not retry its release.
16785
16823
  */
16786
16824
  function castResultShape(ocShape, dim) {
16787
- const cast = castShape(ocShape, dim);
16788
- disposeDowncastSource(ocShape, cast);
16789
- return cast;
16825
+ return castOwnedResult(ocShape, () => castShape(ocShape, dim));
16826
+ }
16827
+ /** The raw result remains owned here until its public handle can be returned. */
16828
+ function castOwnedResult(source, castResult) {
16829
+ let cast;
16830
+ try {
16831
+ cast = castResult();
16832
+ try {
16833
+ disposeDowncastSource(source, cast);
16834
+ } catch (cause) {
16835
+ throw new GeometryCleanupError({
16836
+ message: "Pre-downcast result cleanup failed",
16837
+ resourceKind: "SHAPE",
16838
+ cause
16839
+ });
16840
+ }
16841
+ return cast;
16842
+ } catch (cause) {
16843
+ try {
16844
+ if (cast === void 0) getKernel().dispose(source);
16845
+ else cast[Symbol.dispose]();
16846
+ } catch (cleanupCause) {
16847
+ throw new AggregateError([cause, new GeometryCleanupError({
16848
+ message: "Unreturned result cleanup failed",
16849
+ resourceKind: "SHAPE",
16850
+ cause: cleanupCause
16851
+ })], "Result casting and cleanup failed", { cause: cleanupCause });
16852
+ }
16853
+ throw cause;
16854
+ }
16790
16855
  }
16791
16856
  /**
16792
16857
  * Fully release a transiently-branded sub-shape and the raw handle it was cast
@@ -16843,11 +16908,10 @@ function castShapeWithKnownType(ocShape, knownType, dim) {
16843
16908
  * `iterShapes` — where only the branded downcast result is retained. Identity
16844
16909
  * downcast kernels (manifold/brepkit) skip the release via the guard in
16845
16910
  * {@link disposeDowncastSource}.
16911
+ * Consumes the raw result even when casting throws.
16846
16912
  */
16847
16913
  function castResultShapeWithKnownType(ocShape, knownType, dim) {
16848
- const cast = castShapeWithKnownType(ocShape, knownType, dim);
16849
- disposeDowncastSource(ocShape, cast);
16850
- return cast;
16914
+ return castOwnedResult(ocShape, () => castShapeWithKnownType(ocShape, knownType, dim));
16851
16915
  }
16852
16916
  /**
16853
16917
  * Brand a slot owned by someone else (e.g. the topology cache) as a **borrowed**
@@ -16861,4 +16925,4 @@ function borrowShapeWithKnownType(ocShape, knownType, dim) {
16861
16925
  return brandHandle(createBorrowedHandle(ocShape), dim);
16862
16926
  }
16863
16927
  //#endregion
16864
- export { prewarm as $, is2D as A, withArenaCheckpoint as B, isSolid as C, getOrQueryType as D, getShapeKind as E, getDisposalStats as F, getActiveKernelId as G, withScopeResult as H, isLive as I, getKernelCapabilities as J, getKernel as K, registerForCleanup as L, DisposalScope as M, createHandle as N, as2D as O, createKernelHandle as P, initFromOC as Q, resetDisposalStats as R, isShell as S, isWire as T, withScopeResultAsync as U, withScope as V, _usingCtx as W, init as X, getKernelTier as Y, initFromManifold as Z, isCompound as _, castShape3D as a, BrepkitAdapter as at, isShape1D as b, createEdge as c, currentQuality as ct, createSolid as d, registerKernel as et, createVertex as f, disposeTransientSubShape as g, disposeResultShape as h, castShape as i, withTier as it, is3D as j, as3D as k, createFace as l, qualityDeflection as lt, disposeDowncastSource as m, castResultShape as n, withKernel as nt, castShapeWithKnownType as o, getPerformanceStats as ot, createWire as p, getKernel2D as q, castResultShapeWithKnownType as r, withQuality as rt, createCompound as s, resetPerformanceStats as st, borrowShapeWithKnownType as t, registerKernelTier as tt, createShell as u, isEdge as v, isVertex as w, isShape3D as x, isFace as y, unregisterFromCleanup as z };
16928
+ export { initFromOC as $, as3D as A, unregisterFromCleanup as B, isSolid as C, getShapeKind as D, GeometryCleanupError as E, createKernelHandle as F, _usingCtx as G, withScope as H, getDisposalStats as I, getKernel2D as J, getActiveKernelId as K, isLive as L, is3D as M, DisposalScope as N, getOrQueryType as O, createHandle as P, initFromManifold as Q, registerForCleanup as R, isShell as S, isWire as T, withScopeResult as U, withArenaCheckpoint as V, withScopeResultAsync as W, getKernelTier as X, getKernelCapabilities as Y, init as Z, isCompound as _, castShape3D as a, withTier as at, isShape1D as b, createEdge as c, resetPerformanceStats as ct, createSolid as d, prewarm as et, createVertex as f, disposeTransientSubShape as g, disposeResultShape as h, castShape as i, withQuality as it, is2D as j, as2D as k, createFace as l, currentQuality as lt, disposeDowncastSource as m, castResultShape as n, registerKernelTier as nt, castShapeWithKnownType as o, BrepkitAdapter as ot, createWire as p, getKernel as q, castResultShapeWithKnownType as r, withKernel as rt, createCompound as s, getPerformanceStats as st, borrowShapeWithKnownType as t, registerKernel as tt, createShell as u, qualityDeflection as ut, isEdge as v, isVertex as w, isShape3D as x, isFace as y, resetDisposalStats as z };
@@ -7124,9 +7124,23 @@ function makeWireFromMixed(bk, items) {
7124
7124
  function makeCompound(bk, shapes) {
7125
7125
  const handles = shapes.filter(isBrepkitHandle);
7126
7126
  if (handles.length === 0) throw new Error("brepkit: makeCompound requires at least one shape");
7127
- if (handles.every((h) => h.type === "solid")) return compoundHandle(bk.makeCompound(handles.map((h) => h.id)));
7127
+ const flat = [];
7128
+ const collect = (h) => {
7129
+ if (h.type !== "compound") {
7130
+ flat.push(h);
7131
+ return;
7132
+ }
7133
+ const synthetic = syntheticCompounds.get(h.id);
7134
+ if (synthetic) {
7135
+ synthetic.forEach(collect);
7136
+ return;
7137
+ }
7138
+ for (const id of toArray(bk.getCompoundSolids(h.id))) flat.push(solidHandle(id));
7139
+ };
7140
+ handles.forEach(collect);
7141
+ if (flat.every((h) => h.type === "solid")) return compoundHandle(bk.makeCompound(flat.map((h) => h.id)));
7128
7142
  const id = nextSyntheticId();
7129
- syntheticCompounds.set(id, handles);
7143
+ syntheticCompounds.set(id, flat);
7130
7144
  return compoundHandle(id);
7131
7145
  }
7132
7146
  function makeBoxFromCorners(bk, p1, p2) {
@@ -8919,6 +8933,19 @@ function transformCurve2dGeneral(curve, gtrsf) {
8919
8933
  const tx = Number(gtrsf.tx) || 0, ty = Number(gtrsf.ty) || 0;
8920
8934
  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);
8921
8935
  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);
8936
+ const colLen0 = Math.hypot(m0, m3);
8937
+ const colLen1 = Math.hypot(m1, m4);
8938
+ const colDot = m0 * m1 + m3 * m4;
8939
+ const scaleRef = Math.max(colLen0, colLen1);
8940
+ if (colLen0 > 0 && colLen1 > 0 && Math.abs(colLen0 - colLen1) <= 1e-12 * scaleRef && Math.abs(colDot) <= 1e-12 * colLen0 * colLen1) {
8941
+ const det = m0 * m4 - m1 * m3;
8942
+ const angle = Math.atan2(m3, m0);
8943
+ let out = Math.abs(colLen0 - 1) < 1e-15 ? c : require_occtWasmAdapter.scaleCurve2d(c, colLen0, 0, 0);
8944
+ if (det > 0) {
8945
+ if (Math.abs(angle) > 1e-15) out = require_occtWasmAdapter.rotateCurve2d(out, angle, 0, 0);
8946
+ } else out = require_occtWasmAdapter.mirrorAcrossAxis(out, 0, 0, Math.cos(angle / 2), Math.sin(angle / 2));
8947
+ return tx !== 0 || ty !== 0 ? require_occtWasmAdapter.translateCurve2d(out, tx, ty) : out;
8948
+ }
8922
8949
  const bounds = require_occtWasmAdapter.curveBounds(c);
8923
8950
  const N = 20;
8924
8951
  const pts = [];
@@ -15365,7 +15392,7 @@ function circleThrough3(p1, pm, p2) {
15365
15392
  else a1 = a0 - norm(a0 - a1);
15366
15393
  return conic(center, [r, 0], [0, r], a0, a1);
15367
15394
  }
15368
- function makeNativeKernel2DOps(module, occt) {
15395
+ function makeNativeKernel2DOps(_module, occt) {
15369
15396
  const PLACEHOLDER = {
15370
15397
  delete: () => {},
15371
15398
  isEmpty: () => false
@@ -15451,7 +15478,6 @@ function makeNativeKernel2DOps(module, occt) {
15451
15478
  const r = Math.hypot(sx - cx, sy - cy);
15452
15479
  const a0 = Math.atan2(sy - cy, sx - cx);
15453
15480
  let a1 = Math.atan2(ey - cy, ex - cx);
15454
- nx * tx + ny * ty;
15455
15481
  const norm = (x) => (x % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI);
15456
15482
  const tangCCW = [-(sy - cy), sx - cx];
15457
15483
  if (tangCCW[0] * tx + tangCCW[1] * ty >= 0) a1 = a0 + norm(a1 - a0);
@@ -16656,6 +16682,17 @@ function getShapeKind(shape) {
16656
16682
  return getOrQueryType(getKernel(), shape.wrapped);
16657
16683
  }
16658
16684
  //#endregion
16685
+ //#region src/core/cleanupError.ts
16686
+ /** An observable failed release. Its native outcome is uncertain; never retry it blindly. */
16687
+ var GeometryCleanupError = class extends Error {
16688
+ resourceKind;
16689
+ constructor(options) {
16690
+ super(options.message, { cause: options.cause });
16691
+ this.name = "GeometryCleanupError";
16692
+ this.resourceKind = options.resourceKind;
16693
+ }
16694
+ };
16695
+ //#endregion
16659
16696
  //#region src/core/shapeTypes.ts
16660
16697
  function brandHandle(handle, dim) {
16661
16698
  if (dim === "2D") handle["__is2D"] = true;
@@ -16782,11 +16819,39 @@ function disposeDowncastSource(source, cast) {
16782
16819
  * Cast a freshly-produced kernel result to its branded type and release the
16783
16820
  * orphaned pre-downcast handle. The result-owning counterpart to {@link castShape};
16784
16821
  * see {@link disposeDowncastSource} for the arena semantics.
16822
+ * Consumes the raw result on success or failure; callers must not retry its release.
16785
16823
  */
16786
16824
  function castResultShape(ocShape, dim) {
16787
- const cast = castShape(ocShape, dim);
16788
- disposeDowncastSource(ocShape, cast);
16789
- return cast;
16825
+ return castOwnedResult(ocShape, () => castShape(ocShape, dim));
16826
+ }
16827
+ /** The raw result remains owned here until its public handle can be returned. */
16828
+ function castOwnedResult(source, castResult) {
16829
+ let cast;
16830
+ try {
16831
+ cast = castResult();
16832
+ try {
16833
+ disposeDowncastSource(source, cast);
16834
+ } catch (cause) {
16835
+ throw new GeometryCleanupError({
16836
+ message: "Pre-downcast result cleanup failed",
16837
+ resourceKind: "SHAPE",
16838
+ cause
16839
+ });
16840
+ }
16841
+ return cast;
16842
+ } catch (cause) {
16843
+ try {
16844
+ if (cast === void 0) getKernel().dispose(source);
16845
+ else cast[Symbol.dispose]();
16846
+ } catch (cleanupCause) {
16847
+ throw new AggregateError([cause, new GeometryCleanupError({
16848
+ message: "Unreturned result cleanup failed",
16849
+ resourceKind: "SHAPE",
16850
+ cause: cleanupCause
16851
+ })], "Result casting and cleanup failed", { cause: cleanupCause });
16852
+ }
16853
+ throw cause;
16854
+ }
16790
16855
  }
16791
16856
  /**
16792
16857
  * Fully release a transiently-branded sub-shape and the raw handle it was cast
@@ -16843,11 +16908,10 @@ function castShapeWithKnownType(ocShape, knownType, dim) {
16843
16908
  * `iterShapes` — where only the branded downcast result is retained. Identity
16844
16909
  * downcast kernels (manifold/brepkit) skip the release via the guard in
16845
16910
  * {@link disposeDowncastSource}.
16911
+ * Consumes the raw result even when casting throws.
16846
16912
  */
16847
16913
  function castResultShapeWithKnownType(ocShape, knownType, dim) {
16848
- const cast = castShapeWithKnownType(ocShape, knownType, dim);
16849
- disposeDowncastSource(ocShape, cast);
16850
- return cast;
16914
+ return castOwnedResult(ocShape, () => castShapeWithKnownType(ocShape, knownType, dim));
16851
16915
  }
16852
16916
  /**
16853
16917
  * Brand a slot owned by someone else (e.g. the topology cache) as a **borrowed**
@@ -16873,6 +16937,12 @@ Object.defineProperty(exports, "DisposalScope", {
16873
16937
  return DisposalScope;
16874
16938
  }
16875
16939
  });
16940
+ Object.defineProperty(exports, "GeometryCleanupError", {
16941
+ enumerable: true,
16942
+ get: function() {
16943
+ return GeometryCleanupError;
16944
+ }
16945
+ });
16876
16946
  Object.defineProperty(exports, "_usingCtx", {
16877
16947
  enumerable: true,
16878
16948
  get: function() {
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_blueprintSketcher = require("./blueprintSketcher-Dedw15H1.cjs");
3
- const require_drawFns = require("./drawFns-BaGbMy6K.cjs");
4
- const require_textBlueprints = require("./textBlueprints-D6csroh5.cjs");
2
+ const require_blueprintSketcher = require("./blueprintSketcher-BbbIIw68.cjs");
3
+ const require_drawFns = require("./drawFns-ByfPdMin.cjs");
4
+ const require_textBlueprints = require("./textBlueprints-DoePacWO.cjs");
5
5
  //#region src/sketching.ts
6
6
  /**
7
7
  * brepjs/sketching — Sketcher, Drawing, and sketch-to-shape operations.
package/dist/sketching.js CHANGED
@@ -1,6 +1,6 @@
1
- import { n as BaseSketcher2d, t as BlueprintSketcher } from "./blueprintSketcher-Dr5-ITBw.js";
2
- import { A as sketchEllipse, C as DrawingPen, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, T as Drawing, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-Dr9iCrbh.js";
3
- import { a as Sketch, c as compoundSketchLoft, d as sketchFace, f as sketchLoft, h as sketchWires, i as Sketches, l as compoundSketchRevolve, m as sketchSweep, o as compoundSketchExtrude, p as sketchRevolve, s as compoundSketchFace, u as sketchExtrude, v as CompoundSketch } from "./textBlueprints-B3cJhqsf.js";
1
+ import { n as BaseSketcher2d, t as BlueprintSketcher } from "./blueprintSketcher-s1mCyP4C.js";
2
+ import { A as sketchEllipse, C as DrawingPen, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, T as Drawing, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-S-UBDz0z.js";
3
+ import { a as Sketch, c as compoundSketchLoft, d as sketchFace, f as sketchLoft, h as sketchWires, i as Sketches, l as compoundSketchRevolve, m as sketchSweep, o as compoundSketchExtrude, p as sketchRevolve, s as compoundSketchFace, u as sketchExtrude, v as CompoundSketch } from "./textBlueprints-lFyk_adY.js";
4
4
  //#region src/sketching.ts
5
5
  /**
6
6
  * brepjs/sketching — Sketcher, Drawing, and sketch-to-shape operations.
@@ -1,13 +1,13 @@
1
- const require_shapeTypes = require("./shapeTypes-DZZldFUS.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-GoRBg9oo.cjs");
2
2
  const require_errors = require("./errors-DWezb9DI.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-DYslfber.cjs");
3
+ const require_topologyQueryFns = require("./topologyQueryFns-CZAfuhOE.cjs");
4
4
  const require_constants = require("./constants-BOVyEYGH.cjs");
5
5
  const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
6
6
  const require_planeOps = require("./planeOps-CpupTCRM.cjs");
7
- const require_faceFns = require("./faceFns-qnvwgyaw.cjs");
8
- const require_originTrackingFns = require("./originTrackingFns-Bm7CD2oW.cjs");
7
+ const require_faceFns = require("./faceFns-BbkcUym2.cjs");
8
+ const require_originTrackingFns = require("./originTrackingFns-B1dazHMg.cjs");
9
9
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
10
- const require_surfaceBuilders = require("./surfaceBuilders-B9llhfrz.cjs");
10
+ const require_surfaceBuilders = require("./surfaceBuilders-rWRvkB_K.cjs");
11
11
  //#region src/topology/metadata/faceTagFns.ts
12
12
  var shapeTagStore = /* @__PURE__ */ new WeakMap();
13
13
  var tagMetadataStore = /* @__PURE__ */ new WeakMap();
@@ -292,24 +292,51 @@ function propagateMetadataByHash(inputs, result) {
292
292
  * relocation; the length guard is purely defensive.
293
293
  */
294
294
  function propagateMetadataThroughRelocation(source, moved) {
295
- const kernel = require_shapeTypes.getKernel();
296
- const srcFaces = [...kernel.iterShapes(source.wrapped, "face")];
297
- const movedFaces = [...kernel.iterShapes(moved.wrapped, "face")];
298
- if (srcFaces.length !== movedFaces.length) return;
299
- const modified = /* @__PURE__ */ new Map();
300
- for (let i = 0; i < srcFaces.length; i++) {
301
- const sf = srcFaces[i];
302
- const mf = movedFaces[i];
303
- if (sf === void 0 || mf === void 0) continue;
304
- modified.set(kernel.hashCode(sf, require_constants.HASH_CODE_MAX), [kernel.hashCode(mf, require_constants.HASH_CODE_MAX)]);
305
- }
306
- for (const f of srcFaces) kernel.dispose(f);
307
- for (const f of movedFaces) kernel.dispose(f);
308
- propagateAllMetadata({
309
- modified,
310
- generated: /* @__PURE__ */ new Map(),
311
- deleted: /* @__PURE__ */ new Set()
312
- }, [source], moved);
295
+ try {
296
+ var _usingCtx$2 = require_shapeTypes._usingCtx();
297
+ const kernel = require_shapeTypes.getKernel();
298
+ const faces = [];
299
+ _usingCtx$2.u({ [Symbol.dispose]() {
300
+ const failures = [];
301
+ for (const face of faces) try {
302
+ kernel.dispose(face);
303
+ } catch (cause) {
304
+ failures.push(new require_shapeTypes.GeometryCleanupError({
305
+ message: "Relocation face cleanup failed",
306
+ resourceKind: "SHAPE",
307
+ cause
308
+ }));
309
+ }
310
+ if (failures.length > 0) throw new AggregateError(failures, "Relocation face cleanup failed");
311
+ } });
312
+ const collect = (shape) => {
313
+ const collected = [];
314
+ for (const face of kernel.iterShapes(shape, "face")) {
315
+ faces.push(face);
316
+ collected.push(face);
317
+ }
318
+ return collected;
319
+ };
320
+ const srcFaces = collect(source.wrapped);
321
+ const movedFaces = collect(moved.wrapped);
322
+ if (srcFaces.length !== movedFaces.length) return;
323
+ const modified = /* @__PURE__ */ new Map();
324
+ for (let i = 0; i < srcFaces.length; i++) {
325
+ const sf = srcFaces[i];
326
+ const mf = movedFaces[i];
327
+ if (sf === void 0 || mf === void 0) continue;
328
+ modified.set(kernel.hashCode(sf, require_constants.HASH_CODE_MAX), [kernel.hashCode(mf, require_constants.HASH_CODE_MAX)]);
329
+ }
330
+ propagateAllMetadata({
331
+ modified,
332
+ generated: /* @__PURE__ */ new Map(),
333
+ deleted: /* @__PURE__ */ new Set()
334
+ }, [source], moved);
335
+ } catch (_) {
336
+ _usingCtx$2.e = _;
337
+ } finally {
338
+ _usingCtx$2.d();
339
+ }
313
340
  }
314
341
  //#endregion
315
342
  //#region src/topology/booleanFns.ts
@@ -322,14 +349,12 @@ function validateShape3D(shape, label) {
322
349
  return require_errors.ok(void 0);
323
350
  }
324
351
  function castToShape3D(shape, errorCode, errorMsg, suggestion, diagnostics) {
325
- const wrapped = require_shapeTypes.castShape(shape);
352
+ const wrapped = require_shapeTypes.castResultShape(shape);
326
353
  if (!require_shapeTypes.isShape3D(wrapped)) {
327
354
  const typeName = require_shapeTypes.getShapeKind(wrapped).toUpperCase();
328
- require_shapeTypes.disposeDowncastSource(shape, wrapped);
329
355
  require_shapeTypes.disposeResultShape(wrapped);
330
356
  return require_errors.err(require_errors.typeCastError(errorCode, `${errorMsg}. Got ${typeName} instead.`, void 0, diagnostics ? { diagnostics } : void 0, suggestion));
331
357
  }
332
- require_shapeTypes.disposeDowncastSource(shape, wrapped);
333
358
  return require_errors.ok(wrapped);
334
359
  }
335
360
  function fuse(a, b, { optimisation = "none", simplify = false, signal, fuzzyValue, unsafe: _unsafe, trackEvolution = true } = {}) {
@@ -1,13 +1,13 @@
1
- import { C as isSolid, E as getShapeKind, K as getKernel, S as isShell, W as _usingCtx, d as createSolid, f as createVertex, h as disposeResultShape, i as castShape, m as disposeDowncastSource, n as castResultShape, s as createCompound, x as isShape3D } from "./shapeTypes-CIMiWenj.js";
1
+ import { C as isSolid, D as getShapeKind, E as GeometryCleanupError, G as _usingCtx, S as isShell, d as createSolid, f as createVertex, h as disposeResultShape, n as castResultShape, q as getKernel, s as createCompound, x as isShape3D } from "./shapeTypes-2oI77VpW.js";
2
2
  import { E as ok, P as unwrap, b as isErr, d as validationError, g as err, i as kernelError, l as typeCastError, m as andThen, t as BrepErrorCode } from "./errors-CTn8i3lY.js";
3
- import { S as subShapeHashes, c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-Dp_LqPFF.js";
3
+ import { S as subShapeHashes, c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-C2tBjzT8.js";
4
4
  import { n as HASH_CODE_MAX } from "./constants-ITRzCnCp.js";
5
5
  import { a as vecDot, g as vecSub, h as vecScale, t as vecAdd } from "./vecOps-SKPRvPH-.js";
6
6
  import { o as resolvePlane } from "./planeOps-CkpMeheg.js";
7
- import { _ as cast, y as downcast } from "./faceFns-2wV1msnQ.js";
8
- import { n as propagateOriginsByHash, r as propagateOriginsFromEvolution, t as getFaceOrigins } from "./originTrackingFns-j2je8lQv.js";
7
+ import { _ as cast, y as downcast } from "./faceFns-WhbyFezr.js";
8
+ import { n as propagateOriginsByHash, r as propagateOriginsFromEvolution, t as getFaceOrigins } from "./originTrackingFns-DYB8oZOX.js";
9
9
  import { n as getAtOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
10
- import { r as makeFace } from "./surfaceBuilders-CHfC8AUd.js";
10
+ import { r as makeFace } from "./surfaceBuilders-DcD6eAJW.js";
11
11
  //#region src/topology/metadata/faceTagFns.ts
12
12
  var shapeTagStore = /* @__PURE__ */ new WeakMap();
13
13
  var tagMetadataStore = /* @__PURE__ */ new WeakMap();
@@ -292,24 +292,51 @@ function propagateMetadataByHash(inputs, result) {
292
292
  * relocation; the length guard is purely defensive.
293
293
  */
294
294
  function propagateMetadataThroughRelocation(source, moved) {
295
- const kernel = getKernel();
296
- const srcFaces = [...kernel.iterShapes(source.wrapped, "face")];
297
- const movedFaces = [...kernel.iterShapes(moved.wrapped, "face")];
298
- if (srcFaces.length !== movedFaces.length) return;
299
- const modified = /* @__PURE__ */ new Map();
300
- for (let i = 0; i < srcFaces.length; i++) {
301
- const sf = srcFaces[i];
302
- const mf = movedFaces[i];
303
- if (sf === void 0 || mf === void 0) continue;
304
- modified.set(kernel.hashCode(sf, HASH_CODE_MAX), [kernel.hashCode(mf, HASH_CODE_MAX)]);
295
+ try {
296
+ var _usingCtx$2 = _usingCtx();
297
+ const kernel = getKernel();
298
+ const faces = [];
299
+ _usingCtx$2.u({ [Symbol.dispose]() {
300
+ const failures = [];
301
+ for (const face of faces) try {
302
+ kernel.dispose(face);
303
+ } catch (cause) {
304
+ failures.push(new GeometryCleanupError({
305
+ message: "Relocation face cleanup failed",
306
+ resourceKind: "SHAPE",
307
+ cause
308
+ }));
309
+ }
310
+ if (failures.length > 0) throw new AggregateError(failures, "Relocation face cleanup failed");
311
+ } });
312
+ const collect = (shape) => {
313
+ const collected = [];
314
+ for (const face of kernel.iterShapes(shape, "face")) {
315
+ faces.push(face);
316
+ collected.push(face);
317
+ }
318
+ return collected;
319
+ };
320
+ const srcFaces = collect(source.wrapped);
321
+ const movedFaces = collect(moved.wrapped);
322
+ if (srcFaces.length !== movedFaces.length) return;
323
+ const modified = /* @__PURE__ */ new Map();
324
+ for (let i = 0; i < srcFaces.length; i++) {
325
+ const sf = srcFaces[i];
326
+ const mf = movedFaces[i];
327
+ if (sf === void 0 || mf === void 0) continue;
328
+ modified.set(kernel.hashCode(sf, HASH_CODE_MAX), [kernel.hashCode(mf, HASH_CODE_MAX)]);
329
+ }
330
+ propagateAllMetadata({
331
+ modified,
332
+ generated: /* @__PURE__ */ new Map(),
333
+ deleted: /* @__PURE__ */ new Set()
334
+ }, [source], moved);
335
+ } catch (_) {
336
+ _usingCtx$2.e = _;
337
+ } finally {
338
+ _usingCtx$2.d();
305
339
  }
306
- for (const f of srcFaces) kernel.dispose(f);
307
- for (const f of movedFaces) kernel.dispose(f);
308
- propagateAllMetadata({
309
- modified,
310
- generated: /* @__PURE__ */ new Map(),
311
- deleted: /* @__PURE__ */ new Set()
312
- }, [source], moved);
313
340
  }
314
341
  //#endregion
315
342
  //#region src/topology/booleanFns.ts
@@ -322,14 +349,12 @@ function validateShape3D(shape, label) {
322
349
  return ok(void 0);
323
350
  }
324
351
  function castToShape3D(shape, errorCode, errorMsg, suggestion, diagnostics) {
325
- const wrapped = castShape(shape);
352
+ const wrapped = castResultShape(shape);
326
353
  if (!isShape3D(wrapped)) {
327
354
  const typeName = getShapeKind(wrapped).toUpperCase();
328
- disposeDowncastSource(shape, wrapped);
329
355
  disposeResultShape(wrapped);
330
356
  return err(typeCastError(errorCode, `${errorMsg}. Got ${typeName} instead.`, void 0, diagnostics ? { diagnostics } : void 0, suggestion));
331
357
  }
332
- disposeDowncastSource(shape, wrapped);
333
358
  return ok(wrapped);
334
359
  }
335
360
  function fuse(a, b, { optimisation = "none", simplify = false, signal, fuzzyValue, unsafe: _unsafe, trackEvolution = true } = {}) {
@@ -1,7 +1,7 @@
1
- import { K as getKernel, M as DisposalScope, W as _usingCtx, c as createEdge, l as createFace, p as createWire, y as isFace } from "./shapeTypes-CIMiWenj.js";
1
+ import { G as _usingCtx, N as DisposalScope, c as createEdge, l as createFace, p as createWire, q as getKernel, y as isFace } from "./shapeTypes-2oI77VpW.js";
2
2
  import { E as ok, d as validationError, g as err, i as kernelError, m as andThen } from "./errors-CTn8i3lY.js";
3
- import { a as isPlanarFace } from "./validityTypes-BqJb23o4.js";
4
- import { _ as cast, u as outerWire } from "./faceFns-2wV1msnQ.js";
3
+ import { a as isPlanarFace } from "./validityTypes-BAwJuMQB.js";
4
+ import { _ as cast, u as outerWire } from "./faceFns-WhbyFezr.js";
5
5
  //#region src/utils/range.ts
6
6
  /** Generate an array of integers `[0, 1, …, len - 1]`. */
7
7
  function range(len) {
@@ -1,7 +1,7 @@
1
- const require_shapeTypes = require("./shapeTypes-DZZldFUS.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-GoRBg9oo.cjs");
2
2
  const require_errors = require("./errors-DWezb9DI.cjs");
3
- const require_validityTypes = require("./validityTypes-BYnGyL8L.cjs");
4
- const require_faceFns = require("./faceFns-qnvwgyaw.cjs");
3
+ const require_validityTypes = require("./validityTypes-rPudJ_eg.cjs");
4
+ const require_faceFns = require("./faceFns-BbkcUym2.cjs");
5
5
  //#region src/utils/range.ts
6
6
  /** Generate an array of integers `[0, 1, …, len - 1]`. */
7
7
  function range(len) {
package/dist/text.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_textBlueprints = require("./textBlueprints-D6csroh5.cjs");
3
- const require_textMetrics = require("./textMetrics-sApnOuwi.cjs");
2
+ const require_textBlueprints = require("./textBlueprints-DoePacWO.cjs");
3
+ const require_textMetrics = require("./textMetrics-DemtrM-e.cjs");
4
4
  exports.fontMetrics = require_textMetrics.fontMetrics;
5
5
  exports.getFont = require_textBlueprints.getFont;
6
6
  exports.loadFont = require_textBlueprints.loadFont;