brepjs 20.1.4 → 20.2.0

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 (99) hide show
  1. package/dist/2d.cjs +7 -7
  2. package/dist/2d.js +7 -7
  3. package/dist/{adjacencyFns-C_ZNyZRx.cjs → adjacencyFns-DZsPfYIq.cjs} +2 -2
  4. package/dist/{adjacencyFns-A1SikG3N.js → adjacencyFns-k4GWh4n7.js} +2 -2
  5. package/dist/{blueprint-BsaJ4TJW.cjs → blueprint-CJuRunkd.cjs} +7 -7
  6. package/dist/{blueprint-CAg8eRRu.js → blueprint-Dsp4t2ul.js} +7 -7
  7. package/dist/{blueprintFns-CCVf2Yat.cjs → blueprintFns-BRceCeZp.cjs} +3 -3
  8. package/dist/{blueprintFns-BRXgJCA2.js → blueprintFns-DNyUtopT.js} +3 -3
  9. package/dist/{blueprintSketcher-DobJgYX3.cjs → blueprintSketcher-DRXOTYuD.cjs} +4 -4
  10. package/dist/{blueprintSketcher-CNbOLihr.js → blueprintSketcher-kV7aFwRS.js} +4 -4
  11. package/dist/{boolean2D-CB3xwM21.cjs → boolean2D-DmPqFj_V.cjs} +5 -5
  12. package/dist/{boolean2D-C-TdmZUJ.js → boolean2D-TdJfMS8F.js} +5 -5
  13. package/dist/brepjs.cjs +300 -79
  14. package/dist/brepjs.js +300 -79
  15. package/dist/{cameraFns-BSHErz3i.cjs → cameraFns-B8Ai6b3Q.cjs} +4 -4
  16. package/dist/{cameraFns-CdtviYur.js → cameraFns-u08iOn7p.js} +4 -4
  17. package/dist/core/errors.d.ts +1 -0
  18. package/dist/core.cjs +4 -4
  19. package/dist/core.js +4 -4
  20. package/dist/{cornerFinder-BdK6e9T-.cjs → cornerFinder-BVUuCBX-.cjs} +1 -1
  21. package/dist/{cornerFinder-DCXsZzIe.js → cornerFinder-DfoRecV-.js} +1 -1
  22. package/dist/csg/builders.d.ts +13 -1
  23. package/dist/csg/evaluate.d.ts +10 -1
  24. package/dist/csg/evaluators/context.d.ts +2 -1
  25. package/dist/csg/evaluators/extension.d.ts +5 -0
  26. package/dist/csg/hash.d.ts +1 -0
  27. package/dist/csg/index.d.ts +2 -2
  28. package/dist/csg/jsonData.d.ts +8 -0
  29. package/dist/csg/serialize.d.ts +1 -1
  30. package/dist/csg/types.d.ts +50 -1
  31. package/dist/{curveFns-D_xfC1HQ.js → curveFns-D5V4jm7S.js} +2 -2
  32. package/dist/{curveFns-BXGE1xHa.cjs → curveFns-DciWOppG.cjs} +2 -2
  33. package/dist/{drawFns-CIfCWrWw.js → drawFns-BzuxoLHh.js} +14 -14
  34. package/dist/{drawFns-B9JThnjT.cjs → drawFns-DeUXFpjR.cjs} +14 -14
  35. package/dist/{errors-CTn8i3lY.js → errors-CDSezF9z.js} +1 -0
  36. package/dist/{errors-DWezb9DI.cjs → errors-gG-7hA7k.cjs} +1 -0
  37. package/dist/{faceFns-CGXvMjno.cjs → faceFns-DaXVpMr5.cjs} +3 -3
  38. package/dist/{faceFns-CwweiLRC.js → faceFns-DhdweJGk.js} +3 -3
  39. package/dist/{healingFns-D8_IZ8LC.cjs → healingFns-C_f03IV6.cjs} +5 -5
  40. package/dist/{healingFns-DVH0JBpC.js → healingFns-HekFOO_s.js} +5 -5
  41. package/dist/{helpers-jV94RJf1.js → helpers-BWNXoJz0.js} +7 -7
  42. package/dist/{helpers-BjKe6-M-.cjs → helpers-Dh4qTGcQ.cjs} +7 -7
  43. package/dist/{importFns-C0WKTbbQ.cjs → importFns-CKfKRdiq.cjs} +3 -3
  44. package/dist/{importFns-8OY0H66Q.js → importFns-DGnmgb9G.js} +3 -3
  45. package/dist/io.cjs +2 -2
  46. package/dist/io.js +2 -2
  47. package/dist/{loftFns-B3aEz87L.cjs → loftFns-CI8uJc1D.cjs} +2 -2
  48. package/dist/{loftFns-CS0JYNr4.js → loftFns-DE1GYW9g.js} +2 -2
  49. package/dist/{measureFns-CyU-fOaZ.cjs → measureFns-B8Yj_BMz.cjs} +4 -4
  50. package/dist/{measureFns-LkW9r9Dm.js → measureFns-BoA-Fmwy.js} +4 -4
  51. package/dist/measurement.cjs +1 -1
  52. package/dist/measurement.js +1 -1
  53. package/dist/{meshFns-vO9xsIlB.cjs → meshFns-BT7W4b1c.cjs} +4 -4
  54. package/dist/{meshFns-BI_fEj-T.js → meshFns-o9MnZeir.js} +4 -4
  55. package/dist/operations.cjs +2 -2
  56. package/dist/operations.js +2 -2
  57. package/dist/{originTrackingFns-CuCeiMNZ.cjs → originTrackingFns-B3-1bBED.cjs} +2 -2
  58. package/dist/{originTrackingFns-BTBemULp.js → originTrackingFns-BFmhk_Up.js} +2 -2
  59. package/dist/{planeOps-CkpMeheg.js → planeOps-BO6nvRja.js} +1 -1
  60. package/dist/{planeOps-CpupTCRM.cjs → planeOps-DqGSxcMr.cjs} +1 -1
  61. package/dist/{primitiveFns-CfxGT0nf.js → primitiveFns-DfhjU_X9.js} +5 -5
  62. package/dist/{primitiveFns-DSUL72Md.cjs → primitiveFns-Ke-n8Bib.cjs} +5 -5
  63. package/dist/projection.cjs +1 -1
  64. package/dist/projection.js +1 -1
  65. package/dist/query.cjs +2 -2
  66. package/dist/query.js +2 -2
  67. package/dist/{refResolveFns-BleIGUVN.cjs → refResolveFns-BPqbBoxy.cjs} +6 -6
  68. package/dist/{refResolveFns-BuS72b11.js → refResolveFns-C-6Xa_8k.js} +6 -6
  69. package/dist/result.cjs +1 -1
  70. package/dist/result.js +1 -1
  71. package/dist/{shapeFns-DTZ96dTc.js → shapeFns-CUTM2ZDR.js} +3 -3
  72. package/dist/{shapeFns-BsuUPJR3.cjs → shapeFns-CmJNoPsh.cjs} +3 -3
  73. package/dist/shapeRef.cjs +1 -1
  74. package/dist/shapeRef.js +1 -1
  75. package/dist/{shapeTypes-CACpB7r3.cjs → shapeTypes-BWsKDxzf.cjs} +7 -5
  76. package/dist/{shapeTypes-CEFHrXNb.js → shapeTypes-DVpJHhgk.js} +7 -5
  77. package/dist/sketching.cjs +3 -3
  78. package/dist/sketching.js +3 -3
  79. package/dist/{solidBuilders-BdKU5bQ9.cjs → solidBuilders-B8t5h68e.cjs} +7 -7
  80. package/dist/{solidBuilders-De11-Gp-.js → solidBuilders-p_ppeTkc.js} +7 -7
  81. package/dist/{surfaceBuilders-BaVNAtRf.cjs → surfaceBuilders-Bn-c9xVR.cjs} +4 -4
  82. package/dist/{surfaceBuilders-QGhgel6X.js → surfaceBuilders-Dccm2kQX.js} +4 -4
  83. package/dist/text.cjs +2 -2
  84. package/dist/text.js +2 -2
  85. package/dist/{textBlueprints-BHOADZSh.cjs → textBlueprints-DQi920gG.cjs} +9 -9
  86. package/dist/{textBlueprints-B_yfJn3S.js → textBlueprints-bFsyNLkO.js} +9 -9
  87. package/dist/{textMetrics-C4I5t9jZ.js → textMetrics-CvTwh4tR.js} +2 -2
  88. package/dist/{textMetrics-DHWYuTUK.cjs → textMetrics-DhysRMr7.cjs} +2 -2
  89. package/dist/{threadFns-P682L-Kg.cjs → threadFns-DAKMitvE.cjs} +8 -8
  90. package/dist/{threadFns-BVwQUwRJ.js → threadFns-DlGXBSK7.js} +8 -8
  91. package/dist/topology.cjs +9 -9
  92. package/dist/topology.js +9 -9
  93. package/dist/{topologyQueryFns-Cp390rTF.cjs → topologyQueryFns-CI4j3NTE.cjs} +2 -2
  94. package/dist/{topologyQueryFns-CFfTw0pA.js → topologyQueryFns-fNWsM4Lr.js} +2 -2
  95. package/dist/{validityTypes-Biiyb5lR.js → validityTypes-2DNKAPEw.js} +2 -2
  96. package/dist/{validityTypes-DtfxKjGs.cjs → validityTypes-D9oxhu4U.cjs} +2 -2
  97. package/dist/vectors.cjs +1 -1
  98. package/dist/vectors.js +1 -1
  99. package/package.json +1 -1
package/dist/brepjs.js CHANGED
@@ -1,39 +1,39 @@
1
- import { $ as initFromOC, A as as3D, C as isSolid, D as getShapeKind, E as GeometryCleanupError, F as createKernelHandle, G as _usingCtx, H as withScope, I as getDisposalStats, J as getKernel2D, K as getActiveKernelId, L as isLive, M as is3D, N as DisposalScope, P as createHandle, Q as initFromManifold, S as isShell, T as isWire, U as withScopeResult, V as withArenaCheckpoint, W as withScopeResultAsync, X as getKernelTier, Y as getKernelCapabilities, Z as init, _ as isCompound, a as castShape3D, at as withTier, b as isShape1D, c as createEdge, ct as resetPerformanceStats, d as createSolid, et as prewarm, f as createVertex, h as disposeResultShape, i as castShape, it as withQuality, j as is2D, k as as2D, l as createFace, lt as currentQuality, n as castResultShape, nt as registerKernelTier, ot as BrepkitAdapter, p as createWire, q as getKernel, rt as withKernel, s as createCompound, st as getPerformanceStats, tt as registerKernel, u as createShell, ut as qualityDeflection, v as isEdge, w as isVertex, x as isShape3D, y as isFace, z as resetDisposalStats } from "./shapeTypes-CEFHrXNb.js";
1
+ import { $ as initFromOC, A as as3D, C as isSolid, D as getShapeKind, E as GeometryCleanupError, F as createKernelHandle, G as _usingCtx, H as withScope, I as getDisposalStats, J as getKernel2D, K as getActiveKernelId, L as isLive, M as is3D, N as DisposalScope, P as createHandle, Q as initFromManifold, S as isShell, T as isWire, U as withScopeResult, V as withArenaCheckpoint, W as withScopeResultAsync, X as getKernelTier, Y as getKernelCapabilities, Z as init, _ as isCompound, a as castShape3D, at as withTier, b as isShape1D, c as createEdge, ct as resetPerformanceStats, d as createSolid, et as prewarm, f as createVertex, h as disposeResultShape, i as castShape, it as withQuality, j as is2D, k as as2D, l as createFace, lt as currentQuality, n as castResultShape, nt as registerKernelTier, ot as BrepkitAdapter, p as createWire, q as getKernel, rt as withKernel, s as createCompound, st as getPerformanceStats, tt as registerKernel, u as createShell, ut as qualityDeflection, v as isEdge, w as isVertex, x as isShape3D, y as isFace, z as resetDisposalStats } from "./shapeTypes-DVpJHhgk.js";
2
2
  import { A as EXACT_BREP_CAPABILITIES, k as DEFAULT_CAPABILITIES, t as OcctWasmAdapter } from "./occtWasmAdapter-D4I0n537.js";
3
3
  import { i as wasmIndex, n as bug, t as BrepBugError } from "./bug-BdOHwn_e.js";
4
- import { A as tap, C as mapBoth, D as or, E as ok, F as unwrapErr, I as unwrapOr, L as unwrapOrElse, M as tryCatch, N as tryCatchAsync, O as orElse, P as unwrap, R as zip, S as map, T as match, _ as flatMap, a as moduleInitError, b as isErr, c as sketcherStateError, d as validationError, f as OK, g as err, h as collect, i as kernelError, j as tapErr, k as pipeline, l as typeCastError, m as andThen, n as computationError, o as queryError, p as all, r as ioError, t as BrepErrorCode, u as unsupportedError, v as flatten, w as mapErr, x as isOk, y as fromNullable } from "./errors-CTn8i3lY.js";
5
- import { C as vertexPosition, E as kernelCallScoped, T as kernelCallRaw, _ as iterFaces, a as getCachedSurfaceType, b as iterVertices, c as getFaces, d as getSolids, f as getVertices, g as iterEdges, h as iterCompSolids, m as invalidateShapeCache, n as getBounds, o as getCompSolids, p as getWires, s as getEdges, t as describe$1, u as getShells, v as iterShells, w as kernelCall, x as iterWires, y as iterSolids } from "./topologyQueryFns-CFfTw0pA.js";
6
- import { a as isPlanarFace, c as manifoldShell, d as planarWire, f as validSolid, i as isOrientedFace, l as orientedFace, n as isClosedWire, o as isPlanarWire, r as isManifoldShell, s as isValidSolid, t as closedWire, u as planarFace } from "./validityTypes-Biiyb5lR.js";
4
+ import { A as tap, C as mapBoth, D as or, E as ok, F as unwrapErr, I as unwrapOr, L as unwrapOrElse, M as tryCatch, N as tryCatchAsync, O as orElse, P as unwrap, R as zip, S as map, T as match, _ as flatMap, a as moduleInitError, b as isErr, c as sketcherStateError, d as validationError, f as OK, g as err, h as collect, i as kernelError, j as tapErr, k as pipeline, l as typeCastError, m as andThen, n as computationError, o as queryError, p as all, r as ioError, t as BrepErrorCode, u as unsupportedError, v as flatten, w as mapErr, x as isOk, y as fromNullable } from "./errors-CDSezF9z.js";
5
+ import { C as vertexPosition, E as kernelCallScoped, T as kernelCallRaw, _ as iterFaces, a as getCachedSurfaceType, b as iterVertices, c as getFaces, d as getSolids, f as getVertices, g as iterEdges, h as iterCompSolids, m as invalidateShapeCache, n as getBounds, o as getCompSolids, p as getWires, s as getEdges, t as describe$1, u as getShells, v as iterShells, w as kernelCall, x as iterWires, y as iterSolids } from "./topologyQueryFns-fNWsM4Lr.js";
6
+ import { a as isPlanarFace, c as manifoldShell, d as planarWire, f as validSolid, i as isOrientedFace, l as orientedFace, n as isClosedWire, o as isPlanarWire, r as isManifoldShell, s as isValidSolid, t as closedWire, u as planarFace } from "./validityTypes-2DNKAPEw.js";
7
7
  import { n as HASH_CODE_MAX, r as RAD2DEG, t as DEG2RAD } from "./constants-ITRzCnCp.js";
8
8
  import { n as toVec2, r as toVec3, t as resolveDirection } from "./types-D24Y27N0.js";
9
9
  import { a as vecDot, c as vecLength, d as vecNormalize, f as vecProjectToPlane, g as vecSub, h as vecScale, i as vecDistance, l as vecLengthSq, m as vecRotate, n as vecAngle, o as vecEquals, p as vecRepr, r as vecCross, s as vecIsZero, t as vecAdd, u as vecNegate } from "./vecOps-SKPRvPH-.js";
10
- import { i as pivotPlane, n as createPlane, o as resolvePlane, r as makePlane, s as translatePlane, t as createNamedPlane } from "./planeOps-CkpMeheg.js";
11
- import { C as shapeType, S as iterTopo, _ as cast, a as faceOrientation, b as fromBREP, c as innerWires, d as pointOnSurface, f as projectPointOnFace, g as asTopo, h as uvCoordinates, i as faceGeomType, l as normalAt, m as uvBounds, n as faceAxis, o as flipFaceOrientation, p as removeHolesFromFace, r as faceCenter, s as getSurfaceType, t as classifyPointOnFace, u as outerWire, x as isCompSolid, y as downcast } from "./faceFns-CwweiLRC.js";
12
- import { i as setShapeOrigin, t as getFaceOrigins } from "./originTrackingFns-BTBemULp.js";
13
- import { A as parseColor, D as colorShape, E as colorFaces, F as tagFaces, M as getFaceTags, N as getTagMetadata, O as getFaceColor, P as setTagMetadata, S as hasAnyMetadata, T as propagateMetadataThroughRelocation, _ as section$1, b as split$1, d as booleanPipeline, f as cut$2, g as intersect$2, h as fuseAll$2, j as findFacesByTag, k as getShapeColor, m as fuse$2, p as cutAll$2, r as makeCylinder, t as makeCompound, v as sectionToFace$1, y as slice$1 } from "./solidBuilders-De11-Gp-.js";
14
- import { A as locate$1, C as threePointArc, D as wireLoop, E as wire, F as transformCopy$1, I as translate$2, M as resize, N as rotate$2, O as applyMatrix$1, P as scale$3, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere$1, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, j as mirror$2, k as composeTransforms, l as ellipse, m as helix, n as bezier, o as compound, p as filledFace, r as box, s as cone, t as addHoles, u as ellipseArc, v as sewShells, w as torus$1, x as subFace, y as solid } from "./primitiveFns-CfxGT0nf.js";
15
- import { a as isSameShape, i as isEqualShape, n as getHashCode, o as simplify$1, r as isEmpty$2, s as toBREP$1, t as clone$1 } from "./shapeFns-DTZ96dTc.js";
16
- import { a as curveIsPeriodic, c as curvePointAt, d as flipOrientation, f as getCurveType, h as offsetWire2D, i as curveIsClosed, l as curveStartPoint, m as interpolateCurve, n as curveAxis, o as curveLength, p as getOrientation, r as curveEndPoint, s as curvePeriod, t as approximateCurve, u as curveTangentAt } from "./curveFns-D_xfC1HQ.js";
17
- import { a as meshEdges$1, c as meshMultiLOD, d as clearMeshCache, f as createMeshCache, i as mesh$1, l as scaleDefaultTolerance, n as exportSTEP, o as meshLODs, r as exportSTL, s as meshLODsProgressive, t as exportIGES, u as buildMeshCacheKey } from "./meshFns-BI_fEj-T.js";
10
+ import { i as pivotPlane, n as createPlane, o as resolvePlane, r as makePlane, s as translatePlane, t as createNamedPlane } from "./planeOps-BO6nvRja.js";
11
+ import { C as shapeType, S as iterTopo, _ as cast, a as faceOrientation, b as fromBREP, c as innerWires, d as pointOnSurface, f as projectPointOnFace, g as asTopo, h as uvCoordinates, i as faceGeomType, l as normalAt, m as uvBounds, n as faceAxis, o as flipFaceOrientation, p as removeHolesFromFace, r as faceCenter, s as getSurfaceType, t as classifyPointOnFace, u as outerWire, x as isCompSolid, y as downcast } from "./faceFns-DhdweJGk.js";
12
+ import { i as setShapeOrigin, t as getFaceOrigins } from "./originTrackingFns-BFmhk_Up.js";
13
+ import { A as parseColor, D as colorShape, E as colorFaces, F as tagFaces, M as getFaceTags, N as getTagMetadata, O as getFaceColor, P as setTagMetadata, S as hasAnyMetadata, T as propagateMetadataThroughRelocation, _ as section$1, b as split$1, d as booleanPipeline, f as cut$2, g as intersect$2, h as fuseAll$2, j as findFacesByTag, k as getShapeColor, m as fuse$2, p as cutAll$2, r as makeCylinder, t as makeCompound, v as sectionToFace$1, y as slice$1 } from "./solidBuilders-p_ppeTkc.js";
14
+ import { A as locate$1, C as threePointArc, D as wireLoop, E as wire, F as transformCopy$1, I as translate$2, M as resize, N as rotate$2, O as applyMatrix$1, P as scale$3, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere$1, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, j as mirror$2, k as composeTransforms, l as ellipse, m as helix, n as bezier, o as compound, p as filledFace, r as box, s as cone, t as addHoles, u as ellipseArc, v as sewShells, w as torus$1, x as subFace, y as solid } from "./primitiveFns-DfhjU_X9.js";
15
+ import { a as isSameShape, i as isEqualShape, n as getHashCode, o as simplify$1, r as isEmpty$2, s as toBREP$1, t as clone$1 } from "./shapeFns-CUTM2ZDR.js";
16
+ import { a as curveIsPeriodic, c as curvePointAt, d as flipOrientation, f as getCurveType, h as offsetWire2D, i as curveIsClosed, l as curveStartPoint, m as interpolateCurve, n as curveAxis, o as curveLength, p as getOrientation, r as curveEndPoint, s as curvePeriod, t as approximateCurve, u as curveTangentAt } from "./curveFns-D5V4jm7S.js";
17
+ import { a as meshEdges$1, c as meshMultiLOD, d as clearMeshCache, f as createMeshCache, i as mesh$1, l as scaleDefaultTolerance, n as exportSTEP, o as meshLODs, r as exportSTL, s as meshLODsProgressive, t as exportIGES, u as buildMeshCacheKey } from "./meshFns-o9MnZeir.js";
18
18
  import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
19
- import { _ as makeThreePointArc, d as makeCircle, h as makeLine, l as makeBSplineInterpolation, n as fill, p as makeEllipseArc, r as makeFace, s as assembleWire, u as makeBezierCurve } from "./surfaceBuilders-QGhgel6X.js";
20
- import { A as toBufferGeometryData, C as chamfer$2, D as shell$2, E as offset$1, M as toLODGeometryData, N as toLODGeometryLevels, O as thicken$1, P as toLineGeometryData, S as chamferDistAngle, T as fillet$2, _ as checkBoolean, a as healFace, b as getNurbsCurveData, c as isValid$1, d as chamferWithEvolution, f as cutWithEvolution, g as shellWithEvolution, h as intersectWithEvolution, i as heal$1, j as toGroupedBufferGeometryData, k as variableFillet, l as solidFromShell, m as fuseWithEvolution, n as fixSelfIntersection, o as healSolid, p as filletWithEvolution, r as fixShape, s as healWire, t as autoHeal, u as positionOnCurve, v as cutAllBisect, w as draft$1, x as getNurbsSurfaceData, y as fuseAllBisect } from "./healingFns-DVH0JBpC.js";
21
- import { A as setJointValue, B as walkAssembly, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as countNodes, G as quatFromAxisAngle, H as circularPattern, I as createAssemblyNode, J as quatRotate, K as quatFromTo, L as findNode, M as sphericalJoint, N as addChild, O as prismaticJoint, P as collectShapes, R as removeChild, S as addJoint, T as jointTransform, U as gridPattern, V as exportAssemblySTEP, W as linearPattern, Y as createAssembly, _ as exportURDF, a as deserializeHistory, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, p as serializeHistory, q as quatMultiply, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as updateNode } from "./threadFns-BVwQUwRJ.js";
22
- import { n as BaseSketcher2d, r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-CNbOLihr.js";
23
- import { a as createTypedFinder, i as wireFinder, n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-jV94RJf1.js";
24
- import { _ as approximateAsSvgCompatibleCurve, o as ellipseArcFlags } from "./blueprint-CAg8eRRu.js";
25
- import { A as sketchEllipse, 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, _ 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-CIfCWrWw.js";
26
- import { a as measureDistance, c as measureLinearProps, d as measureVolumeProps, i as measureCurvatureAtMid, l as measureSurfaceProps, n as measureArea, o as measureDistanceProps, r as measureCurvatureAt, s as measureLength, t as createDistanceQuery, u as measureVolume } from "./measureFns-LkW9r9Dm.js";
27
- import { t as cornerFinder } from "./cornerFinder-DCXsZzIe.js";
28
- import { a as fuseBlueprints, c as roundedRectangleBlueprint, i as cutBlueprints, n as fuse2D, o as intersectBlueprints, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-C-TdmZUJ.js";
29
- import { S as reverseCurve, _ as curve2dIsOnCurve, a as isInside2D, b as curve2dSplitAt, c as scale2D, d as stretch2D, f as toSVGPathD, g as curve2dFirstPoint, h as curve2dDistanceFrom, i as getOrientation2D, l as sketchOnFace2D, m as curve2dBoundingBox, n as createCompoundBlueprint, o as mirror2D, p as translate2D, r as getBounds2D, s as rotate2D, t as createBlueprint, u as sketchOnPlane2D, v as curve2dLastPoint, x as curve2dTangentAt, y as curve2dParameter } from "./blueprintFns-BRXgJCA2.js";
30
- import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-8OY0H66Q.js";
31
- import { a as multiSectionSweep, c as twistExtrude, i as guidedSweep, n as loftAll, o as supportExtrude, r as complexExtrude, s as sweep$1, t as loft$2 } from "./loftFns-CS0JYNr4.js";
32
- import { a as Sketch, b as extrudeAll, c as compoundSketchLoft, d as sketchFace, f as sketchLoft, h as sketchWires, i as Sketches, l as compoundSketchRevolve, m as sketchSweep, n as getFont, o as compoundSketchExtrude, p as sketchRevolve, r as loadFont, s as compoundSketchFace, t as textBlueprints, u as sketchExtrude, v as CompoundSketch, x as revolve$2, y as extrude$2 } from "./textBlueprints-B_yfJn3S.js";
33
- 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-BuS72b11.js";
34
- import { a as facesOfVertex, c as verticesOfFace, i as facesOfEdge, l as wiresOfFace, n as adjacentFaces, o as sharedEdges, r as edgesOfFace, s as verticesOfEdge } from "./adjacencyFns-A1SikG3N.js";
35
- import { a as makeProjectedEdges, i as projectEdges, n as cameraLookAt, r as createCamera, s as isProjectionPlane, t as cameraFromPlane } from "./cameraFns-CdtviYur.js";
36
- import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-C4I5t9jZ.js";
19
+ import { _ as makeThreePointArc, d as makeCircle, h as makeLine, l as makeBSplineInterpolation, n as fill, p as makeEllipseArc, r as makeFace, s as assembleWire, u as makeBezierCurve } from "./surfaceBuilders-Dccm2kQX.js";
20
+ import { A as toBufferGeometryData, C as chamfer$2, D as shell$2, E as offset$1, M as toLODGeometryData, N as toLODGeometryLevels, O as thicken$1, P as toLineGeometryData, S as chamferDistAngle, T as fillet$2, _ as checkBoolean, a as healFace, b as getNurbsCurveData, c as isValid$1, d as chamferWithEvolution, f as cutWithEvolution, g as shellWithEvolution, h as intersectWithEvolution, i as heal$1, j as toGroupedBufferGeometryData, k as variableFillet, l as solidFromShell, m as fuseWithEvolution, n as fixSelfIntersection, o as healSolid, p as filletWithEvolution, r as fixShape, s as healWire, t as autoHeal, u as positionOnCurve, v as cutAllBisect, w as draft$1, x as getNurbsSurfaceData, y as fuseAllBisect } from "./healingFns-HekFOO_s.js";
21
+ import { A as setJointValue, B as walkAssembly, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as countNodes, G as quatFromAxisAngle, H as circularPattern, I as createAssemblyNode, J as quatRotate, K as quatFromTo, L as findNode, M as sphericalJoint, N as addChild, O as prismaticJoint, P as collectShapes, R as removeChild, S as addJoint, T as jointTransform, U as gridPattern, V as exportAssemblySTEP, W as linearPattern, Y as createAssembly, _ as exportURDF, a as deserializeHistory, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, p as serializeHistory, q as quatMultiply, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as updateNode } from "./threadFns-DlGXBSK7.js";
22
+ import { n as BaseSketcher2d, r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-kV7aFwRS.js";
23
+ import { a as createTypedFinder, i as wireFinder, n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-BWNXoJz0.js";
24
+ import { _ as approximateAsSvgCompatibleCurve, o as ellipseArcFlags } from "./blueprint-Dsp4t2ul.js";
25
+ import { A as sketchEllipse, 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, _ 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-BzuxoLHh.js";
26
+ import { a as measureDistance, c as measureLinearProps, d as measureVolumeProps, i as measureCurvatureAtMid, l as measureSurfaceProps, n as measureArea, o as measureDistanceProps, r as measureCurvatureAt, s as measureLength, t as createDistanceQuery, u as measureVolume } from "./measureFns-BoA-Fmwy.js";
27
+ import { t as cornerFinder } from "./cornerFinder-DfoRecV-.js";
28
+ import { a as fuseBlueprints, c as roundedRectangleBlueprint, i as cutBlueprints, n as fuse2D, o as intersectBlueprints, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-TdJfMS8F.js";
29
+ import { S as reverseCurve, _ as curve2dIsOnCurve, a as isInside2D, b as curve2dSplitAt, c as scale2D, d as stretch2D, f as toSVGPathD, g as curve2dFirstPoint, h as curve2dDistanceFrom, i as getOrientation2D, l as sketchOnFace2D, m as curve2dBoundingBox, n as createCompoundBlueprint, o as mirror2D, p as translate2D, r as getBounds2D, s as rotate2D, t as createBlueprint, u as sketchOnPlane2D, v as curve2dLastPoint, x as curve2dTangentAt, y as curve2dParameter } from "./blueprintFns-DNyUtopT.js";
30
+ import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-DGnmgb9G.js";
31
+ import { a as multiSectionSweep, c as twistExtrude, i as guidedSweep, n as loftAll, o as supportExtrude, r as complexExtrude, s as sweep$1, t as loft$2 } from "./loftFns-DE1GYW9g.js";
32
+ import { a as Sketch, b as extrudeAll, c as compoundSketchLoft, d as sketchFace, f as sketchLoft, h as sketchWires, i as Sketches, l as compoundSketchRevolve, m as sketchSweep, n as getFont, o as compoundSketchExtrude, p as sketchRevolve, r as loadFont, s as compoundSketchFace, t as textBlueprints, u as sketchExtrude, v as CompoundSketch, x as revolve$2, y as extrude$2 } from "./textBlueprints-bFsyNLkO.js";
33
+ 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-C-6Xa_8k.js";
34
+ import { a as facesOfVertex, c as verticesOfFace, i as facesOfEdge, l as wiresOfFace, n as adjacentFaces, o as sharedEdges, r as edgesOfFace, s as verticesOfEdge } from "./adjacencyFns-k4GWh4n7.js";
35
+ import { a as makeProjectedEdges, i as projectEdges, n as cameraLookAt, r as createCamera, s as isProjectionPlane, t as cameraFromPlane } from "./cameraFns-u08iOn7p.js";
36
+ import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-CvTwh4tR.js";
37
37
  import { _ as isSuccessResponse, a as createWorkerClient, c as enqueueTask, d as rejectAll, f as isBatchRequest, g as isOperationRequest, h as isInitRequest, i as registerHandler, l as isEmpty$1, m as isErrorResponse, n as createOperationRegistry, o as createTaskQueue, p as isDisposeRequest, r as createWorkerHandler, s as dequeueTask, t as createWorkerPool, u as pendingCount } from "./workerPool-XcYX2UZ0.js";
38
38
  //#region \0rolldown/runtime.js
39
39
  var __defProp = Object.defineProperty;
@@ -1184,6 +1184,14 @@ function fnvMixInt32(h, n) {
1184
1184
  }
1185
1185
  return r;
1186
1186
  }
1187
+ function fnvMixText(h, s) {
1188
+ let r = fnvMixInt32(h, s.length);
1189
+ for (let i = 0; i < s.length; i++) {
1190
+ const c = s.charCodeAt(i);
1191
+ r = fnvMixByte(fnvMixByte(r, c), c >>> 8);
1192
+ }
1193
+ return r;
1194
+ }
1187
1195
  function fnvMixBool(h, b) {
1188
1196
  return fnvMixByte(h, b ? 1 : 0);
1189
1197
  }
@@ -1532,6 +1540,130 @@ function foldSegment(s, foldExpr) {
1532
1540
  }
1533
1541
  }
1534
1542
  //#endregion
1543
+ //#region src/csg/jsonData.ts
1544
+ /** Validate `value` as JSON-safe and return its canonical frozen copy, or a
1545
+ * message naming the first offending path (rooted at `path`). */
1546
+ function canonicalJson(value, path) {
1547
+ return copyJson(value, path, /* @__PURE__ */ new Set());
1548
+ }
1549
+ function copyJson(v, path, ancestors) {
1550
+ if (v === null || typeof v === "boolean" || typeof v === "string") return ok(v);
1551
+ if (typeof v === "number") {
1552
+ if (!Number.isFinite(v)) return err(`${path}: ${String(v)} is not JSON-safe`);
1553
+ return ok(v === 0 ? 0 : v);
1554
+ }
1555
+ if (typeof v !== "object") return err(`${path}: ${typeof v} is not JSON-safe`);
1556
+ if (ancestors.has(v)) return err(`${path}: circular reference is not JSON-safe`);
1557
+ ancestors.add(v);
1558
+ const out = Array.isArray(v) ? copyArray(v, path, ancestors) : copyObject(v, path, ancestors);
1559
+ ancestors.delete(v);
1560
+ return out;
1561
+ }
1562
+ function copyArray(v, path, ancestors) {
1563
+ const out = [];
1564
+ for (let i = 0; i < v.length; i++) {
1565
+ const r = copyJson(v[i], `${path}[${i}]`, ancestors);
1566
+ if (!r.ok) return r;
1567
+ out.push(r.value);
1568
+ }
1569
+ return ok(Object.freeze(out));
1570
+ }
1571
+ function copyObject(v, path, ancestors) {
1572
+ const proto = Object.getPrototypeOf(v);
1573
+ if (proto !== Object.prototype && proto !== null) {
1574
+ const ctor = v.constructor;
1575
+ const what = typeof ctor === "function" && ctor.name ? `${ctor.name} instance` : "object";
1576
+ return err(`${path}: ${what} is not JSON-safe (use a plain object)`);
1577
+ }
1578
+ const record = v;
1579
+ const entries = [];
1580
+ for (const key of Object.keys(record).sort()) {
1581
+ const r = copyJson(record[key], `${path}.${key}`, ancestors);
1582
+ if (!r.ok) return r;
1583
+ entries.push([key, r.value]);
1584
+ }
1585
+ return ok(Object.freeze(Object.fromEntries(entries)));
1586
+ }
1587
+ var TAG_NULL = 0;
1588
+ var TAG_FALSE = 1;
1589
+ var TAG_TRUE = 2;
1590
+ var TAG_NUMBER = 3;
1591
+ var TAG_STRING = 4;
1592
+ var TAG_ARRAY = 5;
1593
+ var TAG_OBJECT = 6;
1594
+ /** Type-tagged, length-prefixed Merkle mix of a JSON value; object keys are
1595
+ * hashed in sorted order, so key order never changes the result. */
1596
+ function hashJson(h, v) {
1597
+ if (v === null) return fnvMixByte(h, TAG_NULL);
1598
+ if (typeof v === "boolean") return fnvMixByte(h, v ? TAG_TRUE : TAG_FALSE);
1599
+ if (typeof v === "number") return fnvMixNumber(fnvMixByte(h, TAG_NUMBER), v);
1600
+ if (typeof v === "string") return fnvMixText(fnvMixByte(h, TAG_STRING), v);
1601
+ if (isJsonArray(v)) {
1602
+ let r = fnvMixInt32(fnvMixByte(h, TAG_ARRAY), v.length);
1603
+ for (const item of v) r = hashJson(r, item);
1604
+ return r;
1605
+ }
1606
+ const keys = Object.keys(v).sort();
1607
+ let r = fnvMixInt32(fnvMixByte(h, TAG_OBJECT), keys.length);
1608
+ for (const key of keys) {
1609
+ r = fnvMixText(r, key);
1610
+ r = hashJson(r, v[key] ?? null);
1611
+ }
1612
+ return r;
1613
+ }
1614
+ function isJsonArray(v) {
1615
+ return Array.isArray(v);
1616
+ }
1617
+ //#endregion
1618
+ //#region src/csg/types.ts
1619
+ var OUTPUT_KINDS = {
1620
+ Solid: true,
1621
+ Face: true,
1622
+ Wire: true,
1623
+ Edge: true,
1624
+ Vertex: true,
1625
+ Compound: true
1626
+ };
1627
+ function isOutputKind(v) {
1628
+ return typeof v === "string" && Object.hasOwn(OUTPUT_KINDS, v);
1629
+ }
1630
+ function outputKindOf(node) {
1631
+ switch (node.kind) {
1632
+ case "Box":
1633
+ case "Sphere":
1634
+ case "Cylinder":
1635
+ case "Cone":
1636
+ case "Torus": return "Solid";
1637
+ case "Polygon": return "Face";
1638
+ case "Circle":
1639
+ case "Line": return "Edge";
1640
+ case "Vertex": return "Vertex";
1641
+ case "Empty": return node.output;
1642
+ case "Fuse":
1643
+ case "Cut":
1644
+ case "Intersect": return outputKindOf(node.a);
1645
+ case "FuseAll": return node.shapes[0] ? outputKindOf(node.shapes[0]) : "Solid";
1646
+ case "CutAll": return outputKindOf(node.base);
1647
+ case "Translate":
1648
+ case "Rotate":
1649
+ case "Scale":
1650
+ case "Mirror":
1651
+ case "Color": return outputKindOf(node.target);
1652
+ case "Extrude":
1653
+ case "Revolve":
1654
+ case "Loft":
1655
+ case "Sweep":
1656
+ case "Fillet":
1657
+ case "Chamfer":
1658
+ case "Shell": return "Solid";
1659
+ case "Profile": return "Face";
1660
+ case "Path": return "Wire";
1661
+ case "Compound": return "Compound";
1662
+ case "Instance": return node.fuse ? "Solid" : "Compound";
1663
+ case "Extension": return node.output;
1664
+ }
1665
+ }
1666
+ //#endregion
1535
1667
  //#region src/csg/builders.ts
1536
1668
  var EMPTY_DEPS = /* @__PURE__ */ new Set();
1537
1669
  function startHash(tag) {
@@ -2035,42 +2167,47 @@ function instance$1(source, placements, fuse = false) {
2035
2167
  freeParams: depsOf(source)
2036
2168
  };
2037
2169
  }
2038
- //#endregion
2039
- //#region src/csg/types.ts
2040
- function outputKindOf(node) {
2041
- switch (node.kind) {
2042
- case "Box":
2043
- case "Sphere":
2044
- case "Cylinder":
2045
- case "Cone":
2046
- case "Torus": return "Solid";
2047
- case "Polygon": return "Face";
2048
- case "Circle":
2049
- case "Line": return "Edge";
2050
- case "Vertex": return "Vertex";
2051
- case "Empty": return node.output;
2052
- case "Fuse":
2053
- case "Cut":
2054
- case "Intersect": return outputKindOf(node.a);
2055
- case "FuseAll": return node.shapes[0] ? outputKindOf(node.shapes[0]) : "Solid";
2056
- case "CutAll": return outputKindOf(node.base);
2057
- case "Translate":
2058
- case "Rotate":
2059
- case "Scale":
2060
- case "Mirror":
2061
- case "Color": return outputKindOf(node.target);
2062
- case "Extrude":
2063
- case "Revolve":
2064
- case "Loft":
2065
- case "Sweep":
2066
- case "Fillet":
2067
- case "Chamfer":
2068
- case "Shell": return "Solid";
2069
- case "Profile": return "Face";
2070
- case "Path": return "Wire";
2071
- case "Compound": return "Compound";
2072
- case "Instance": return node.fuse ? "Solid" : "Compound";
2073
- }
2170
+ function isExpr(v) {
2171
+ return typeof v === "object" && v !== null && typeof v.structuralHash === "bigint";
2172
+ }
2173
+ function extensionParams(name, input) {
2174
+ const entries = [];
2175
+ for (const key of Object.keys(input).sort()) {
2176
+ const v = input[key];
2177
+ if (typeof v !== "number" && !isExpr(v)) throw new TypeError(`csg.extension(${name}): params.${key} must be a number or an Expr`);
2178
+ entries.push([key, asScalarExpr(v)]);
2179
+ }
2180
+ return entries;
2181
+ }
2182
+ /** A caller-defined operation, materialized at evaluation by the
2183
+ * `ExtensionEvaluator` registered under `name` in
2184
+ * `EvaluatorOptions.extensions`. Unlike the other builders this one validates
2185
+ * eagerly and throws a TypeError: a node whose data cannot be hashed
2186
+ * canonically has no content address. */
2187
+ function extension(name, output, options) {
2188
+ if (typeof name !== "string" || name.length === 0) throw new TypeError("csg.extension: name must be a non-empty string");
2189
+ if (!isOutputKind(output)) throw new TypeError(`csg.extension(${name}): unknown output kind ${String(output)}`);
2190
+ const data = canonicalJson(options?.data ?? null, "data");
2191
+ if (!data.ok) throw new TypeError(`csg.extension(${name}): ${data.error}`);
2192
+ const children = [...options?.children ?? []];
2193
+ const params = extensionParams(name, options?.params ?? {});
2194
+ let h = fnvMixText(startHash("Extension"), name);
2195
+ h = fnvMixText(h, output);
2196
+ h = fnvMixInt32(h, children.length);
2197
+ for (const c of children) h = mix(h, c);
2198
+ h = fnvMixInt32(h, params.length);
2199
+ for (const [key, e] of params) h = mix(fnvMixText(h, key), e);
2200
+ h = hashJson(h, data.value);
2201
+ return {
2202
+ kind: "Extension",
2203
+ name,
2204
+ output,
2205
+ children,
2206
+ params: Object.fromEntries(params),
2207
+ data: data.value,
2208
+ structuralHash: h,
2209
+ freeParams: depsOf(...children, ...params.map(([, e]) => e))
2210
+ };
2074
2211
  }
2075
2212
  //#endregion
2076
2213
  //#region src/csg/profiles.ts
@@ -3125,6 +3262,29 @@ function evalShell(node, ctx) {
3125
3262
  return shell$2(solid.value, faces, thickness.value);
3126
3263
  }
3127
3264
  //#endregion
3265
+ //#region src/csg/evaluators/extension.ts
3266
+ function evalExtension(node, ctx) {
3267
+ const evaluator = ctx.extensions.get(node.name);
3268
+ if (evaluator === void 0) return err(validationError(BrepErrorCode.CSG_EXTENSION_UNKNOWN, `Extension: no evaluator registered for '${node.name}'`, void 0, { name: node.name }, `Register one with new csg.Evaluator({ extensions: { '${node.name}': fn } })`));
3269
+ const params = [];
3270
+ for (const [key, expr] of Object.entries(node.params)) {
3271
+ const v = evalScalar(expr, ctx.env, `Extension(${node.name}).params.${key}`);
3272
+ if (!v.ok) return v;
3273
+ params.push([key, v.value]);
3274
+ }
3275
+ const children = [];
3276
+ for (const child of node.children) {
3277
+ const r = ctx.evalNode(child);
3278
+ if (!r.ok) return r;
3279
+ children.push(r.value);
3280
+ }
3281
+ return evaluator({
3282
+ params: Object.fromEntries(params),
3283
+ data: node.data,
3284
+ children
3285
+ });
3286
+ }
3287
+ //#endregion
3128
3288
  //#region src/csg/evaluate.ts
3129
3289
  function dispatch(node, ctx) {
3130
3290
  switch (node.kind) {
@@ -3149,6 +3309,7 @@ function dispatch(node, ctx) {
3149
3309
  case "Mirror": return evalMirror(node, ctx);
3150
3310
  case "Compound": return evalCompound(node, ctx);
3151
3311
  case "Instance": return evalInstance(node, ctx);
3312
+ case "Extension": return evalExtension(node, ctx);
3152
3313
  case "Extrude":
3153
3314
  case "Revolve":
3154
3315
  case "Loft":
@@ -3376,6 +3537,7 @@ var Evaluator = class {
3376
3537
  maxMeshCacheEntries;
3377
3538
  meshCache = /* @__PURE__ */ new Map();
3378
3539
  onStep;
3540
+ extensions;
3379
3541
  hits = 0;
3380
3542
  misses = 0;
3381
3543
  evictions = 0;
@@ -3389,6 +3551,9 @@ var Evaluator = class {
3389
3551
  const meshMax = options.maxMeshCacheEntries;
3390
3552
  if (meshMax !== void 0 && (!Number.isInteger(meshMax) || meshMax < 1)) throw new RangeError(`Evaluator: maxMeshCacheEntries must be a positive integer, got ${String(meshMax)}`);
3391
3553
  this.maxMeshCacheEntries = meshMax;
3554
+ const extensions = new Map(Object.entries(options.extensions ?? {}));
3555
+ for (const [name, fn] of extensions) if (typeof fn !== "function") throw new TypeError(`Evaluator: extensions['${name}'] must be a function`);
3556
+ this.extensions = extensions;
3392
3557
  }
3393
3558
  /**
3394
3559
  * Materialize a CSG IR tree against the given parameter environment.
@@ -3517,7 +3682,8 @@ var Evaluator = class {
3517
3682
  const result = dispatch(node, {
3518
3683
  env,
3519
3684
  tolerance: this.defaultTolerance,
3520
- evalNode: (child) => this.evaluateInner(child, env)
3685
+ evalNode: (child) => this.evaluateInner(child, env),
3686
+ extensions: this.extensions
3521
3687
  });
3522
3688
  if (!result.ok) return result;
3523
3689
  const shape = result.value;
@@ -3645,6 +3811,11 @@ function rebuildChildren(n, pred, repl, memo) {
3645
3811
  });
3646
3812
  case "Compound": return compound$1(n.children.map((c) => walk(c, pred, repl, memo)));
3647
3813
  case "Instance": return instance$1(walk(n.source, pred, repl, memo), n.placements, n.fuse);
3814
+ case "Extension": return extension(n.name, n.output, {
3815
+ children: n.children.map((c) => walk(c, pred, repl, memo)),
3816
+ params: n.params,
3817
+ data: n.data
3818
+ });
3648
3819
  case "Extrude":
3649
3820
  case "Revolve":
3650
3821
  case "Loft":
@@ -3709,7 +3880,8 @@ function childrenOf(n) {
3709
3880
  case "Fillet":
3710
3881
  case "Chamfer":
3711
3882
  case "Shell": return [n.target];
3712
- case "Compound": return n.children;
3883
+ case "Compound":
3884
+ case "Extension": return n.children;
3713
3885
  case "Instance": return [n.source];
3714
3886
  case "Extrude":
3715
3887
  case "Revolve": return [n.profile];
@@ -3733,11 +3905,11 @@ function toJSON(node) {
3733
3905
  };
3734
3906
  const root = emitNode(node, ctx);
3735
3907
  return ctx.defs.length > 0 ? {
3736
- csgVersion: 8,
3908
+ csgVersion: 9,
3737
3909
  defs: ctx.defs,
3738
3910
  root
3739
3911
  } : {
3740
- csgVersion: 8,
3912
+ csgVersion: 9,
3741
3913
  root
3742
3914
  };
3743
3915
  }
@@ -4010,7 +4182,18 @@ function featureToJson(n, ctx) {
4010
4182
  default: return;
4011
4183
  }
4012
4184
  }
4185
+ function extensionToJson(n, ctx) {
4186
+ return {
4187
+ kind: "Extension",
4188
+ name: n.name,
4189
+ output: n.output,
4190
+ children: n.children.map((c) => emitNode(c, ctx)),
4191
+ params: Object.fromEntries(Object.entries(n.params).map(([k, e]) => [k, exprToJson(e)])),
4192
+ data: n.data
4193
+ };
4194
+ }
4013
4195
  function nodeToJson(n, ctx) {
4196
+ if (n.kind === "Extension") return extensionToJson(n, ctx);
4014
4197
  if (n.kind === "Color") return {
4015
4198
  kind: "Color",
4016
4199
  target: emitNode(n.target, ctx),
@@ -4077,7 +4260,7 @@ function readVec2(v, where) {
4077
4260
  function fromJSON(envelope) {
4078
4261
  if (!isObj(envelope)) return bad("input is not an object");
4079
4262
  const v = envelope["csgVersion"];
4080
- if (typeof v !== "number" || !Number.isInteger(v) || v < MIN_CSG_VERSION || v > 8) return bad(`unsupported csgVersion ${String(v)} (expected ${MIN_CSG_VERSION}..8)`);
4263
+ if (typeof v !== "number" || !Number.isInteger(v) || v < MIN_CSG_VERSION || v > 9) return bad(`unsupported csgVersion ${String(v)} (expected ${MIN_CSG_VERSION}..9)`);
4081
4264
  const rawDefs = envelope["defs"];
4082
4265
  const defs = [];
4083
4266
  if (rawDefs !== void 0) {
@@ -4169,15 +4352,15 @@ function readOptTolerance(j) {
4169
4352
  if (t === void 0 || t === null) return ok(void 0);
4170
4353
  return isNumber$1(t) ? ok(t) : bad("tolerance: not a finite number");
4171
4354
  }
4355
+ function readRef(ref, defs) {
4356
+ if (!isNumber$1(ref) || !Number.isInteger(ref) || ref < 0) return bad("$ref: expected a non-negative integer def index");
4357
+ const node = defs[ref];
4358
+ if (node === void 0) return bad(`$ref: ${ref} is out of range (forward refs are rejected)`);
4359
+ return ok(node);
4360
+ }
4172
4361
  function readNode(j, defs) {
4173
4362
  if (!isObj(j)) return bad("node: not an object");
4174
- const ref = j["$ref"];
4175
- if (ref !== void 0) {
4176
- if (!isNumber$1(ref) || !Number.isInteger(ref) || ref < 0) return bad("$ref: expected a non-negative integer def index");
4177
- const node = defs[ref];
4178
- if (node === void 0) return bad(`$ref: ${ref} is out of range (forward refs are rejected)`);
4179
- return ok(node);
4180
- }
4363
+ if (j["$ref"] !== void 0) return readRef(j["$ref"], defs);
4181
4364
  const kind = j["kind"];
4182
4365
  switch (kind) {
4183
4366
  case "Box":
@@ -4211,6 +4394,7 @@ function readNode(j, defs) {
4211
4394
  case "Fillet": return readFillet(j, defs);
4212
4395
  case "Chamfer": return readChamfer(j, defs);
4213
4396
  case "Shell": return readShell(j, defs);
4397
+ case "Extension": return readExtension(j, defs);
4214
4398
  default: return bad(`unknown node kind: ${String(kind)}`);
4215
4399
  }
4216
4400
  }
@@ -4622,6 +4806,34 @@ function readCompound(j, defs) {
4622
4806
  function isMatrix4x4(v) {
4623
4807
  return Array.isArray(v) && v.length === 4 && v.every((row) => Array.isArray(row) && row.length === 4 && row.every(isNumber$1));
4624
4808
  }
4809
+ function readExtensionParams(j) {
4810
+ if (j === void 0) return ok({});
4811
+ if (!isObj(j)) return bad("Extension.params: not an object");
4812
+ const entries = [];
4813
+ for (const [key, raw] of Object.entries(j)) {
4814
+ const e = readExpr(raw);
4815
+ if (!e.ok) return e;
4816
+ entries.push([key, e.value]);
4817
+ }
4818
+ return ok(Object.fromEntries(entries));
4819
+ }
4820
+ function readExtension(j, defs) {
4821
+ const name = j["name"];
4822
+ if (!isString(name) || name.length === 0) return bad("Extension.name: expected a non-empty string");
4823
+ const output = j["output"];
4824
+ if (!isOutputKind(output)) return bad(`Extension.output: ${String(output)}`);
4825
+ const children = j["children"] === void 0 ? ok([]) : readNodeArray(j["children"], "Extension.children", defs);
4826
+ if (!children.ok) return children;
4827
+ const params = readExtensionParams(j["params"]);
4828
+ if (!params.ok) return params;
4829
+ const data = canonicalJson(j["data"] ?? null, "Extension.data");
4830
+ if (!data.ok) return bad(data.error);
4831
+ return ok(extension(name, output, {
4832
+ children: children.value,
4833
+ params: params.value,
4834
+ data: data.value
4835
+ }));
4836
+ }
4625
4837
  function readInstance(j, defs) {
4626
4838
  const source = readNode(j["source"], defs);
4627
4839
  if (!source.ok) return source;
@@ -4728,6 +4940,7 @@ function rewriteNode(n) {
4728
4940
  case "Mirror": return optimizeTransform(n);
4729
4941
  case "Compound": return compound$1(n.children.map(optimizeNode).filter((c) => c.kind !== "Empty"));
4730
4942
  case "Instance": return instance$1(optimizeNode(n.source), n.placements, n.fuse);
4943
+ case "Extension": return optimizeExtension(n);
4731
4944
  case "Extrude":
4732
4945
  case "Revolve":
4733
4946
  case "Loft":
@@ -4757,6 +4970,13 @@ function optimizeFeature(n) {
4757
4970
  case "Shell": return shell$1(optimizeNode(n.target), n.refs, foldExpr(n.thickness));
4758
4971
  }
4759
4972
  }
4973
+ function optimizeExtension(n) {
4974
+ return extension(n.name, n.output, {
4975
+ children: n.children.map(optimizeNode),
4976
+ params: Object.fromEntries(Object.entries(n.params).map(([k, e]) => [k, foldExpr(e)])),
4977
+ data: n.data
4978
+ });
4979
+ }
4760
4980
  function optimizeTransform(n) {
4761
4981
  switch (n.kind) {
4762
4982
  case "Rotate": return rotate$1(optimizeNode(n.target), foldExpr(n.angle), {
@@ -8779,7 +8999,7 @@ var patterns_exports = /* @__PURE__ */ __exportAll({
8779
8999
  //#endregion
8780
9000
  //#region src/ns/csg.ts
8781
9001
  var csg_exports = /* @__PURE__ */ __exportAll({
8782
- CSG_VERSION: () => 8,
9002
+ CSG_VERSION: () => 9,
8783
9003
  Evaluator: () => Evaluator,
8784
9004
  add: () => add$1,
8785
9005
  arbitraryClosedProfile: () => arbitraryClosedProfile,
@@ -8811,6 +9031,7 @@ var csg_exports = /* @__PURE__ */ __exportAll({
8811
9031
  emptyFace: () => emptyFace,
8812
9032
  emptySolid: () => emptySolid,
8813
9033
  emptyWire: () => emptyWire,
9034
+ extension: () => extension,
8814
9035
  extrude: () => extrude$1,
8815
9036
  fillet: () => fillet$1,
8816
9037
  foldExpr: () => foldExpr,
@@ -1,8 +1,8 @@
1
- const require_shapeTypes = require("./shapeTypes-CACpB7r3.cjs");
2
- const require_errors = require("./errors-DWezb9DI.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-Cp390rTF.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-BWsKDxzf.cjs");
2
+ const require_errors = require("./errors-gG-7hA7k.cjs");
3
+ const require_topologyQueryFns = require("./topologyQueryFns-CI4j3NTE.cjs");
4
4
  const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
5
- const require_shapeFns = require("./shapeFns-BsuUPJR3.cjs");
5
+ const require_shapeFns = require("./shapeFns-CmJNoPsh.cjs");
6
6
  //#region src/projection/projectionPlanes.ts
7
7
  /** Lookup table mapping each {@link ProjectionPlane} to its camera configuration. */
8
8
  var PROJECTION_PLANES = {
@@ -1,8 +1,8 @@
1
- import { G as _usingCtx, n as castResultShape, q as getKernel } from "./shapeTypes-CEFHrXNb.js";
2
- import { E as ok, P as unwrap, d as validationError, g as err } from "./errors-CTn8i3lY.js";
3
- import { s as getEdges } from "./topologyQueryFns-CFfTw0pA.js";
1
+ import { G as _usingCtx, n as castResultShape, q as getKernel } from "./shapeTypes-DVpJHhgk.js";
2
+ import { E as ok, P as unwrap, d as validationError, g as err } from "./errors-CDSezF9z.js";
3
+ import { s as getEdges } from "./topologyQueryFns-fNWsM4Lr.js";
4
4
  import { c as vecLength, d as vecNormalize, g as vecSub, r as vecCross } from "./vecOps-SKPRvPH-.js";
5
- import { t as clone } from "./shapeFns-DTZ96dTc.js";
5
+ import { t as clone } from "./shapeFns-CUTM2ZDR.js";
6
6
  //#region src/projection/projectionPlanes.ts
7
7
  /** Lookup table mapping each {@link ProjectionPlane} to its camera configuration. */
8
8
  var PROJECTION_PLANES = {
@@ -47,6 +47,7 @@ export declare const BrepErrorCode: {
47
47
  readonly DRAFT_INVALID_ANGLE: "DRAFT_INVALID_ANGLE";
48
48
  readonly DRAFT_NOT_3D: "DRAFT_NOT_3D";
49
49
  readonly DRAFT_FAILED: "DRAFT_FAILED";
50
+ readonly CSG_EXTENSION_UNKNOWN: "CSG_EXTENSION_UNKNOWN";
50
51
  readonly FUSE_NOT_3D: "FUSE_NOT_3D";
51
52
  readonly CUT_NOT_3D: "CUT_NOT_3D";
52
53
  readonly INTERSECT_NOT_3D: "INTERSECT_NOT_3D";
package/dist/core.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_shapeTypes = require("./shapeTypes-CACpB7r3.cjs");
2
+ const require_shapeTypes = require("./shapeTypes-BWsKDxzf.cjs");
3
3
  const require_bug = require("./bug-O02CsAmt.cjs");
4
- const require_errors = require("./errors-DWezb9DI.cjs");
5
- const require_validityTypes = require("./validityTypes-DtfxKjGs.cjs");
4
+ const require_errors = require("./errors-gG-7hA7k.cjs");
5
+ const require_validityTypes = require("./validityTypes-D9oxhu4U.cjs");
6
6
  const require_constants = require("./constants-BOVyEYGH.cjs");
7
7
  const require_types = require("./types-KjA8tY4Y.cjs");
8
8
  const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
9
- const require_planeOps = require("./planeOps-CpupTCRM.cjs");
9
+ const require_planeOps = require("./planeOps-DqGSxcMr.cjs");
10
10
  exports.BrepBugError = require_bug.BrepBugError;
11
11
  exports.DEG2RAD = require_constants.DEG2RAD;
12
12
  exports.DisposalScope = require_shapeTypes.DisposalScope;
package/dist/core.js CHANGED
@@ -1,9 +1,9 @@
1
- import { C as isSolid, D as getShapeKind, E as GeometryCleanupError, F as createKernelHandle, H as withScope, L as isLive, M as is3D, N as DisposalScope, P as createHandle, S as isShell, T as isWire, U as withScopeResult, W as withScopeResultAsync, _ as isCompound, b as isShape1D, i as castShape, j as is2D, v as isEdge, w as isVertex, x as isShape3D, y as isFace } from "./shapeTypes-CEFHrXNb.js";
1
+ import { C as isSolid, D as getShapeKind, E as GeometryCleanupError, F as createKernelHandle, H as withScope, L as isLive, M as is3D, N as DisposalScope, P as createHandle, S as isShell, T as isWire, U as withScopeResult, W as withScopeResultAsync, _ as isCompound, b as isShape1D, i as castShape, j as is2D, v as isEdge, w as isVertex, x as isShape3D, y as isFace } from "./shapeTypes-DVpJHhgk.js";
2
2
  import { n as bug, t as BrepBugError } from "./bug-BdOHwn_e.js";
3
- import { E as ok, F as unwrapErr, I as unwrapOr, L as unwrapOrElse, M as tryCatch, N as tryCatchAsync, P as unwrap, S as map, T as match, _ as flatMap, a as moduleInitError, b as isErr, c as sketcherStateError, d as validationError, f as OK, g as err, h as collect, i as kernelError, l as typeCastError, m as andThen, n as computationError, o as queryError, r as ioError, u as unsupportedError, w as mapErr, x as isOk } from "./errors-CTn8i3lY.js";
4
- import { c as manifoldShell, f as validSolid, i as isOrientedFace, l as orientedFace, n as isClosedWire, r as isManifoldShell, s as isValidSolid, t as closedWire } from "./validityTypes-Biiyb5lR.js";
3
+ import { E as ok, F as unwrapErr, I as unwrapOr, L as unwrapOrElse, M as tryCatch, N as tryCatchAsync, P as unwrap, S as map, T as match, _ as flatMap, a as moduleInitError, b as isErr, c as sketcherStateError, d as validationError, f as OK, g as err, h as collect, i as kernelError, l as typeCastError, m as andThen, n as computationError, o as queryError, r as ioError, u as unsupportedError, w as mapErr, x as isOk } from "./errors-CDSezF9z.js";
4
+ import { c as manifoldShell, f as validSolid, i as isOrientedFace, l as orientedFace, n as isClosedWire, r as isManifoldShell, s as isValidSolid, t as closedWire } from "./validityTypes-2DNKAPEw.js";
5
5
  import { n as HASH_CODE_MAX, r as RAD2DEG, t as DEG2RAD } from "./constants-ITRzCnCp.js";
6
6
  import { n as toVec2, r as toVec3, t as resolveDirection } from "./types-D24Y27N0.js";
7
7
  import { a as vecDot, c as vecLength, d as vecNormalize, f as vecProjectToPlane, g as vecSub, h as vecScale, i as vecDistance, l as vecLengthSq, m as vecRotate, n as vecAngle, o as vecEquals, p as vecRepr, r as vecCross, s as vecIsZero, t as vecAdd, u as vecNegate } from "./vecOps-SKPRvPH-.js";
8
- import { i as pivotPlane, n as createPlane, o as resolvePlane, s as translatePlane, t as createNamedPlane } from "./planeOps-CkpMeheg.js";
8
+ import { i as pivotPlane, n as createPlane, o as resolvePlane, s as translatePlane, t as createNamedPlane } from "./planeOps-BO6nvRja.js";
9
9
  export { BrepBugError, DEG2RAD, DisposalScope, GeometryCleanupError, HASH_CODE_MAX, OK, RAD2DEG, andThen, bug, castShape, closedWire, collect, computationError, createHandle, createKernelHandle, createNamedPlane, createPlane, err, flatMap, getShapeKind, ioError, is2D, is3D, isClosedWire, isCompound, isEdge, isErr, isFace, isLive, isManifoldShell, isOk, isOrientedFace, isShape1D, isShape3D, isShell, isSolid, isValidSolid, isVertex, isWire, kernelError, manifoldShell, map, mapErr, match, moduleInitError, ok, orientedFace, pivotPlane, queryError, resolveDirection, resolvePlane, sketcherStateError, toVec2, toVec3, translatePlane, tryCatch, tryCatchAsync, typeCastError, unsupportedError, unwrap, unwrapErr, unwrapOr, unwrapOrElse, validSolid, validationError, vecAdd, vecAngle, vecCross, vecDistance, vecDot, vecEquals, vecIsZero, vecLength, vecLengthSq, vecNegate, vecNormalize, vecProjectToPlane, vecRepr, vecRotate, vecScale, vecSub, withScope, withScopeResult, withScopeResultAsync };
@@ -1,6 +1,6 @@
1
1
  const require_constants = require("./constants-BOVyEYGH.cjs");
2
2
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
3
- const require_helpers = require("./helpers-BjKe6-M-.cjs");
3
+ const require_helpers = require("./helpers-Dh4qTGcQ.cjs");
4
4
  //#region src/query/cornerFinder.ts
5
5
  var PI_2 = 2 * Math.PI;
6
6
  function positiveHalfAngle(angle) {