brep-io-kernel 1.0.266 → 1.0.267

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 (32) hide show
  1. package/README.md +3 -5
  2. package/dist/about.html +2 -2
  3. package/dist/apiExamples/BREP_Booleans.html +2 -2
  4. package/dist/apiExamples/BREP_Export.html +2 -2
  5. package/dist/apiExamples/BREP_Primitives.html +2 -2
  6. package/dist/apiExamples/BREP_Transforms.html +2 -2
  7. package/dist/apiExamples/Embeded_2D_Sketcher.html +2 -2
  8. package/dist/apiExamples/Embeded_CAD.html +2 -2
  9. package/dist/apiExamples/Embeded_CAD_Integration_Test.html +2 -2
  10. package/dist/assets/{apiExample_BREP_Booleans-BYmpqcsp.js → apiExample_BREP_Booleans-CTe2EMfJ.js} +1 -1
  11. package/dist/assets/{apiExample_BREP_Export-uBjod_wt.js → apiExample_BREP_Export-drwwX-N0.js} +1 -1
  12. package/dist/assets/{apiExample_BREP_Primitives-6305hZzi.js → apiExample_BREP_Primitives-DmkRC9x9.js} +1 -1
  13. package/dist/assets/{apiExample_BREP_Transforms-BzoYBAov.js → apiExample_BREP_Transforms-BuSQlmou.js} +1 -1
  14. package/dist/assets/{apiExample_Embeded_2D_Sketcher-D1NLjBBJ.js → apiExample_Embeded_2D_Sketcher-uhVSKDmJ.js} +1 -1
  15. package/dist/assets/{apiExample_Embeded_CAD-CyBvK6VA.js → apiExample_Embeded_CAD-DHa-5wYS.js} +1 -1
  16. package/dist/assets/{apiExample_Embeded_CAD_Integration_Test-GmK-MuGv.js → apiExample_Embeded_CAD_Integration_Test-ChPFgcn1.js} +1 -1
  17. package/dist/assets/{brep-kernel-PNIMTlaV.js → brep-kernel-DJpirUxq.js} +6 -2
  18. package/dist/assets/{browserTests-B-7L1X5b.js → browserTests-Co7TxSP6.js} +3 -3
  19. package/dist/assets/{index.es-BCqdB02m.js → index.es-f-EIT528.js} +1 -1
  20. package/dist/assets/{javascript-hVMGvX5S.js → javascript-kCxntZPl.js} +1 -1
  21. package/dist/assets/{main-cad-3Myw0wlX.js → main-cad-BckkeW6Q.js} +10 -6
  22. package/dist/assets/{test-D2BDjo1w.js → test-CZQN4gj3.js} +3 -3
  23. package/dist/cad.html +1 -1
  24. package/dist/help/index.html +2 -2
  25. package/dist/help/search-index.json +1 -1
  26. package/dist/test.html +1 -1
  27. package/dist/viewer.html +1 -1
  28. package/dist-kernel/brep-kernel.js +6 -2
  29. package/dist-kernel/help/index.html +2 -2
  30. package/dist-kernel/help/search-index.json +1 -1
  31. package/package.json +2 -4
  32. package/src/UI/toolbarButtons/scriptRunnerButton.js +6 -2
package/README.md CHANGED
@@ -126,7 +126,6 @@ Prerequisites:
126
126
  - Node.js 18+
127
127
  - `pnpm`
128
128
  - `git submodule update --init --recursive`
129
- - Emscripten SDK (`emcmake`/`emcc` on `PATH`, or run `pnpm install:emscripten`)
130
129
 
131
130
  Install and run locally:
132
131
 
@@ -146,8 +145,7 @@ Then open the Vite URL shown in your terminal.
146
145
  |---|---|
147
146
  | `pnpm dev` | Prepares fonts, builds the kernel bundle, then runs the Vite dev server. |
148
147
  | `pnpm build` | Production build of the app into `dist/` (includes kernel build step). |
149
- | `pnpm build:manifoldPlus` | Builds the local manifold wasm/js bundle from the `vendor/manifold3d` submodule plus local custom bindings. |
150
- | `pnpm install:emscripten` | Installs/activates EMSDK if `emcmake`/`emcc` are missing. Uses `$EMSDK` or `$HOME/emsdk`; override the version with `$EMSDK_VERSION`. |
148
+ | `pnpm build:manifoldPlus` | Builds the local manifold wasm/js bundle from the `vendor/manifold3d` submodule plus local custom bindings, using project-local EMSDK from `vendor/emsdk`. |
151
149
  | `pnpm build:kernel` | Builds the ESM kernel bundle into `dist-kernel/` and syncs assets. |
152
150
  | `pnpm use:manifold:npm` | Switches runtime/builds to the published `manifold-3d` npm package. |
153
151
  | `pnpm use:manifold:local` | Switches runtime/builds to the locally compiled manifold bundle. |
@@ -166,8 +164,8 @@ Build outputs:
166
164
 
167
165
  The kernel build compiles a custom wasm bundle from the `vendor/manifold3d` git submodule. CI environments must:
168
166
 
169
- - fetch submodules
170
- - install Emscripten/EMSDK before running `pnpm build` (`pnpm install:emscripten` can bootstrap it)
167
+ - fetch submodules, including `vendor/emsdk`
168
+ - allow `pnpm build` to download the pinned project-local Emscripten SDK payload through `vendor/emsdk`
171
169
 
172
170
  This repo includes GitHub Actions workflows for:
173
171
 
package/dist/about.html CHANGED
@@ -158,7 +158,7 @@ a{color:var(--accent);text-decoration:none} a:hover{text-decoration:underline}
158
158
  <main>
159
159
  <section class="card readme">
160
160
  <div class="header"><h1>Project Overview</h1></div>
161
- <div class="content prose"><h1><a href="https://BREP.io">BREP.io</a></h1><h1><a href="https://github.com/mmiscool/BREP">Source <a href="https://github.com/mmiscool/BREP" target="_blank" rel="noopener noreferrer">https://github.com/mmiscool/BREP</a></a></h1><ul><li><a href="https://www.npmjs.com/package/brep-io-kernel">NPM package: <code>brep-io-kernel</code> <a href="https://www.npmjs.com/package/brep-io-kernel" target="_blank" rel="noopener noreferrer">https://www.npmjs.com/package/brep-io-kernel</a></a></li><li><a href="https://BREP.io/apiExamples/index.html">Live API examples <a href="https://BREP.io/apiExamples/index.html" target="_blank" rel="noopener noreferrer">https://BREP.io/apiExamples/index.html</a></a></li><li><a href="https://discord.gg/R5KNAKrQ">Developer Discord <a href="https://discord.gg/R5KNAKrQ" target="_blank" rel="noopener noreferrer">https://discord.gg/R5KNAKrQ</a></a></li></ul><p>BREP.io is a browser-based CAD application and JavaScript kernel for feature-based solid modeling. At its core is a BREP-style modeler with explicit geometry/topology objects such as <code>Solid</code>, <code>Face</code>, <code>Edge</code>, and <code>Vertex</code>, paired with an editable feature-history pipeline. It also includes sketch workflows powered by a standalone 2D constraint solver, plus robust manifold booleans (<a href="https://github.com/elalish/manifold">manifold-3d</a>), mesh repair/import tooling, assembly constraints, PMI annotations, and embeddable CAD/sketcher APIs.</p><p>This project is in active development and APIs may continue to evolve.</p><h2>Workbenches</h2><ul><li><a href="docs__workbenches__modeling.html">Modeling Workbench</a></li><li><a href="docs__workbenches__import.html">Import Workbench</a></li><li><a href="docs__workbenches__surfacing.html">Surfacing Workbench</a></li><li><a href="docs__workbenches__sheet-metal.html">Sheet Metal Workbench</a></li><li><a href="docs__workbenches__assemblies.html">Assemblies Workbench</a></li><li><a href="docs__workbenches__wire-harness.html">Wire Harness Workbench</a></li><li><a href="docs__workbenches__pmi.html">PMI Workbench</a></li><li><a href="docs__workbenches__all.html">All Workbench</a></li></ul><h2>Screenshots</h2><p><img src="docs__HOME.png" alt="Home" width="280" loading="lazy" /> <a href="docs__modes__modeling.html"><img src="docs__MODELING.png" alt="Modeling Mode" width="280" loading="lazy" /></a> <a href="docs__modes__sketch.html"><img src="docs__SKETCH.png" alt="Sketch Mode" width="280" loading="lazy" /></a> <a href="docs__modes__pmi.html"><img src="docs__PMI.png" alt="PMI Mode" width="280" loading="lazy" /></a> <a href="docs__modes__sheets.html"><img src="docs__SHEETS.png" alt="2D Sheets Mode" width="280" loading="lazy" /></a> <a href="docs__features__image-to-face.html"><img src="docs__features__image-to-face-2D_dialog.png" alt="Image to Face 2D" width="280" loading="lazy" /></a> <a href="docs__features__image-to-face.html"><img src="docs__features__image-to-face-3D_dialog.png" alt="Image to Face 3D" width="280" loading="lazy" /></a></p><h2>Documentation Index</h2><p>General:</p><ul><li><a href="docs__developer-index.html">Developer Docs Index</a></li><li><a href="docs__highlights.html">Highlights</a></li><li><a href="docs__whats-new.html">What&#39;s New</a></li></ul><p>Mode guides:</p><ul><li><a href="docs__modes__modeling.html">Modeling Mode</a></li><li><a href="docs__modes__sketch.html">Sketch Mode</a></li><li><a href="docs__modes__pmi.html">PMI Mode</a></li><li><a href="docs__modes__sheets.html">2D Sheets Mode</a></li></ul><h2>Modeling Feature Docs</h2><p>Feature index:</p><ul><li><a href="docs__features__index.html">All Feature Docs</a></li></ul><p>Primitives and setup:</p><ul><li><a href="docs__features__primitive-cube.html">Primitive Cube</a></li><li><a href="docs__features__primitive-cylinder.html">Primitive Cylinder</a></li><li><a href="docs__features__primitive-cone.html">Primitive Cone</a></li><li><a href="docs__features__primitive-sphere.html">Primitive Sphere</a></li><li><a href="docs__features__primitive-torus.html">Primitive Torus</a></li><li><a href="docs__features__primitive-pyramid.html">Primitive Pyramid</a></li><li><a href="docs__features__plane.html">Plane</a></li><li><a href="docs__features__datum.html">Datum</a></li><li><a href="docs__features__datium.html">Datium</a></li><li><a href="docs__features__sketch.html">Sketch</a></li><li><a href="docs__features__spline.html">Spline</a></li><li><a href="docs__features__helix.html">Helix</a></li></ul><p>Solid operations:</p><ul><li><a href="docs__features__extrude.html">Extrude</a></li><li><a href="docs__features__sweep.html">Sweep</a></li><li><a href="docs__features__tube.html">Tube</a></li><li><a href="docs__features__loft.html">Loft</a></li><li><a href="docs__features__revolve.html">Revolve</a></li><li><a href="docs__features__mirror.html">Mirror</a></li><li><a href="docs__features__boolean.html">Boolean</a></li><li><a href="docs__features__fillet.html">Fillet</a></li><li><a href="docs__features__chamfer.html">Chamfer</a></li><li><a href="docs__features__hole.html">Hole</a></li><li><a href="docs__features__push-face.html">Push Face</a></li><li><a href="docs__features__thicken.html">Thicken</a></li><li><a href="docs__features__offset-shell.html">Offset Shell</a></li><li><a href="docs__features__remesh.html">Remesh</a></li><li><a href="docs__features__transform.html">Transform</a></li></ul><p>Pattern, import, and generation:</p><ul><li><a href="docs__features__pattern.html">Pattern (Legacy Combined)</a></li><li><a href="docs__features__pattern-linear.html">Pattern Linear</a></li><li><a href="docs__features__pattern-radial.html">Pattern Radial</a></li><li><a href="docs__features__import-3d-model.html">Import 3D Model</a></li><li><a href="docs__features__image-heightmap-solid.html">Image Heightmap Solid</a></li><li><a href="docs__features__image-to-face.html">Image to Face</a></li><li><a href="docs__features__text-to-face.html">Text to Face</a></li></ul><p>Assembly and sheet metal:</p><ul><li><a href="docs__features__assembly-component.html">Assembly Component</a></li><li><a href="docs__features__sheet-metal-tab.html">Sheet Metal Tab</a></li><li><a href="docs__features__sheet-metal-contour-flange.html">Sheet Metal Contour Flange</a></li><li><a href="docs__features__sheet-metal-flange.html">Sheet Metal Flange</a></li></ul><p>Additional implemented features in the codebase include collapse edge, edge smooth, offset face, overlap cleanup, sheet metal hem, and sheet metal cutout.</p><h2>Assembly Constraints</h2><ul><li><a href="docs__assembly-constraints__solver.html">Assembly Constraint Solver</a></li><li><a href="docs__assembly-constraints__coincident-constraint.html">Coincident</a></li><li><a href="docs__assembly-constraints__distance-constraint.html">Distance</a></li><li><a href="docs__assembly-constraints__angle-constraint.html">Angle</a></li><li><a href="docs__assembly-constraints__parallel-constraint.html">Parallel</a></li><li><a href="docs__assembly-constraints__touch-align-constraint.html">Touch Align</a></li><li><a href="docs__assembly-constraints__fixed-constraint.html">Fixed</a></li></ul><h2>PMI Annotation Docs</h2><ul><li><a href="docs__pmi-annotations__index.html">PMI Annotations Index</a></li><li><a href="docs__pmi-annotations__linear-dimension.html">Linear Dimension</a></li><li><a href="docs__pmi-annotations__radial-dimension.html">Radial Dimension</a></li><li><a href="docs__pmi-annotations__angle-dimension.html">Angle Dimension</a></li><li><a href="docs__pmi-annotations__leader.html">Leader</a></li><li><a href="docs__pmi-annotations__note.html">Note</a></li><li><a href="docs__pmi-annotations__hole-callout.html">Hole Callout</a></li><li><a href="docs__pmi-annotations__explode-body.html">Explode Body</a></li></ul><h2>Quick Start</h2><p>Prerequisites:</p><ul><li>Node.js 18+</li><li><code>pnpm</code></li><li><code>git submodule update --init --recursive</code></li><li>Emscripten SDK (<code>emcmake</code>/<code>emcc</code> on <code>PATH</code>, or run <code>pnpm install:emscripten</code>)</li></ul><p>Install and run locally:</p><div class="doc-codeblock" data-code-language="bash">
161
+ <div class="content prose"><h1><a href="https://BREP.io">BREP.io</a></h1><h1><a href="https://github.com/mmiscool/BREP">Source <a href="https://github.com/mmiscool/BREP" target="_blank" rel="noopener noreferrer">https://github.com/mmiscool/BREP</a></a></h1><ul><li><a href="https://www.npmjs.com/package/brep-io-kernel">NPM package: <code>brep-io-kernel</code> <a href="https://www.npmjs.com/package/brep-io-kernel" target="_blank" rel="noopener noreferrer">https://www.npmjs.com/package/brep-io-kernel</a></a></li><li><a href="https://BREP.io/apiExamples/index.html">Live API examples <a href="https://BREP.io/apiExamples/index.html" target="_blank" rel="noopener noreferrer">https://BREP.io/apiExamples/index.html</a></a></li><li><a href="https://discord.gg/R5KNAKrQ">Developer Discord <a href="https://discord.gg/R5KNAKrQ" target="_blank" rel="noopener noreferrer">https://discord.gg/R5KNAKrQ</a></a></li></ul><p>BREP.io is a browser-based CAD application and JavaScript kernel for feature-based solid modeling. At its core is a BREP-style modeler with explicit geometry/topology objects such as <code>Solid</code>, <code>Face</code>, <code>Edge</code>, and <code>Vertex</code>, paired with an editable feature-history pipeline. It also includes sketch workflows powered by a standalone 2D constraint solver, plus robust manifold booleans (<a href="https://github.com/elalish/manifold">manifold-3d</a>), mesh repair/import tooling, assembly constraints, PMI annotations, and embeddable CAD/sketcher APIs.</p><p>This project is in active development and APIs may continue to evolve.</p><h2>Workbenches</h2><ul><li><a href="docs__workbenches__modeling.html">Modeling Workbench</a></li><li><a href="docs__workbenches__import.html">Import Workbench</a></li><li><a href="docs__workbenches__surfacing.html">Surfacing Workbench</a></li><li><a href="docs__workbenches__sheet-metal.html">Sheet Metal Workbench</a></li><li><a href="docs__workbenches__assemblies.html">Assemblies Workbench</a></li><li><a href="docs__workbenches__wire-harness.html">Wire Harness Workbench</a></li><li><a href="docs__workbenches__pmi.html">PMI Workbench</a></li><li><a href="docs__workbenches__all.html">All Workbench</a></li></ul><h2>Screenshots</h2><p><img src="docs__HOME.png" alt="Home" width="280" loading="lazy" /> <a href="docs__modes__modeling.html"><img src="docs__MODELING.png" alt="Modeling Mode" width="280" loading="lazy" /></a> <a href="docs__modes__sketch.html"><img src="docs__SKETCH.png" alt="Sketch Mode" width="280" loading="lazy" /></a> <a href="docs__modes__pmi.html"><img src="docs__PMI.png" alt="PMI Mode" width="280" loading="lazy" /></a> <a href="docs__modes__sheets.html"><img src="docs__SHEETS.png" alt="2D Sheets Mode" width="280" loading="lazy" /></a> <a href="docs__features__image-to-face.html"><img src="docs__features__image-to-face-2D_dialog.png" alt="Image to Face 2D" width="280" loading="lazy" /></a> <a href="docs__features__image-to-face.html"><img src="docs__features__image-to-face-3D_dialog.png" alt="Image to Face 3D" width="280" loading="lazy" /></a></p><h2>Documentation Index</h2><p>General:</p><ul><li><a href="docs__developer-index.html">Developer Docs Index</a></li><li><a href="docs__highlights.html">Highlights</a></li><li><a href="docs__whats-new.html">What&#39;s New</a></li></ul><p>Mode guides:</p><ul><li><a href="docs__modes__modeling.html">Modeling Mode</a></li><li><a href="docs__modes__sketch.html">Sketch Mode</a></li><li><a href="docs__modes__pmi.html">PMI Mode</a></li><li><a href="docs__modes__sheets.html">2D Sheets Mode</a></li></ul><h2>Modeling Feature Docs</h2><p>Feature index:</p><ul><li><a href="docs__features__index.html">All Feature Docs</a></li></ul><p>Primitives and setup:</p><ul><li><a href="docs__features__primitive-cube.html">Primitive Cube</a></li><li><a href="docs__features__primitive-cylinder.html">Primitive Cylinder</a></li><li><a href="docs__features__primitive-cone.html">Primitive Cone</a></li><li><a href="docs__features__primitive-sphere.html">Primitive Sphere</a></li><li><a href="docs__features__primitive-torus.html">Primitive Torus</a></li><li><a href="docs__features__primitive-pyramid.html">Primitive Pyramid</a></li><li><a href="docs__features__plane.html">Plane</a></li><li><a href="docs__features__datum.html">Datum</a></li><li><a href="docs__features__datium.html">Datium</a></li><li><a href="docs__features__sketch.html">Sketch</a></li><li><a href="docs__features__spline.html">Spline</a></li><li><a href="docs__features__helix.html">Helix</a></li></ul><p>Solid operations:</p><ul><li><a href="docs__features__extrude.html">Extrude</a></li><li><a href="docs__features__sweep.html">Sweep</a></li><li><a href="docs__features__tube.html">Tube</a></li><li><a href="docs__features__loft.html">Loft</a></li><li><a href="docs__features__revolve.html">Revolve</a></li><li><a href="docs__features__mirror.html">Mirror</a></li><li><a href="docs__features__boolean.html">Boolean</a></li><li><a href="docs__features__fillet.html">Fillet</a></li><li><a href="docs__features__chamfer.html">Chamfer</a></li><li><a href="docs__features__hole.html">Hole</a></li><li><a href="docs__features__push-face.html">Push Face</a></li><li><a href="docs__features__thicken.html">Thicken</a></li><li><a href="docs__features__offset-shell.html">Offset Shell</a></li><li><a href="docs__features__remesh.html">Remesh</a></li><li><a href="docs__features__transform.html">Transform</a></li></ul><p>Pattern, import, and generation:</p><ul><li><a href="docs__features__pattern.html">Pattern (Legacy Combined)</a></li><li><a href="docs__features__pattern-linear.html">Pattern Linear</a></li><li><a href="docs__features__pattern-radial.html">Pattern Radial</a></li><li><a href="docs__features__import-3d-model.html">Import 3D Model</a></li><li><a href="docs__features__image-heightmap-solid.html">Image Heightmap Solid</a></li><li><a href="docs__features__image-to-face.html">Image to Face</a></li><li><a href="docs__features__text-to-face.html">Text to Face</a></li></ul><p>Assembly and sheet metal:</p><ul><li><a href="docs__features__assembly-component.html">Assembly Component</a></li><li><a href="docs__features__sheet-metal-tab.html">Sheet Metal Tab</a></li><li><a href="docs__features__sheet-metal-contour-flange.html">Sheet Metal Contour Flange</a></li><li><a href="docs__features__sheet-metal-flange.html">Sheet Metal Flange</a></li></ul><p>Additional implemented features in the codebase include collapse edge, edge smooth, offset face, overlap cleanup, sheet metal hem, and sheet metal cutout.</p><h2>Assembly Constraints</h2><ul><li><a href="docs__assembly-constraints__solver.html">Assembly Constraint Solver</a></li><li><a href="docs__assembly-constraints__coincident-constraint.html">Coincident</a></li><li><a href="docs__assembly-constraints__distance-constraint.html">Distance</a></li><li><a href="docs__assembly-constraints__angle-constraint.html">Angle</a></li><li><a href="docs__assembly-constraints__parallel-constraint.html">Parallel</a></li><li><a href="docs__assembly-constraints__touch-align-constraint.html">Touch Align</a></li><li><a href="docs__assembly-constraints__fixed-constraint.html">Fixed</a></li></ul><h2>PMI Annotation Docs</h2><ul><li><a href="docs__pmi-annotations__index.html">PMI Annotations Index</a></li><li><a href="docs__pmi-annotations__linear-dimension.html">Linear Dimension</a></li><li><a href="docs__pmi-annotations__radial-dimension.html">Radial Dimension</a></li><li><a href="docs__pmi-annotations__angle-dimension.html">Angle Dimension</a></li><li><a href="docs__pmi-annotations__leader.html">Leader</a></li><li><a href="docs__pmi-annotations__note.html">Note</a></li><li><a href="docs__pmi-annotations__hole-callout.html">Hole Callout</a></li><li><a href="docs__pmi-annotations__explode-body.html">Explode Body</a></li></ul><h2>Quick Start</h2><p>Prerequisites:</p><ul><li>Node.js 18+</li><li><code>pnpm</code></li><li><code>git submodule update --init --recursive</code></li></ul><p>Install and run locally:</p><div class="doc-codeblock" data-code-language="bash">
162
162
  <div class="doc-codeblock-header">
163
163
  <span class="doc-codeblock-lang">bash</span>
164
164
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -173,7 +173,7 @@ a{color:var(--accent);text-decoration:none} a:hover{text-decoration:underline}
173
173
  <div class="doc-codeblock-body"><pre><code class="language-bash">git submodule update --init --recursive
174
174
  pnpm install
175
175
  pnpm dev</code></pre></div>
176
- </div><p>Then open the Vite URL shown in your terminal.</p><ul><li>Main app shell: <code>/index.html</code></li><li>Direct CAD workspace: <code>/cad.html</code></li></ul><h2>Build, Test, and Utility Commands</h2><table><thead><tr><th>Command</th><th>Purpose</th></tr></thead><tbody><tr><td><code>pnpm dev</code></td><td>Prepares fonts, builds the kernel bundle, then runs the Vite dev server.</td></tr><tr><td><code>pnpm build</code></td><td>Production build of the app into <code>dist/</code> (includes kernel build step).</td></tr><tr><td><code>pnpm build:manifoldPlus</code></td><td>Builds the local manifold wasm/js bundle from the <code>vendor/manifold3d</code> submodule plus local custom bindings.</td></tr><tr><td><code>pnpm install:emscripten</code></td><td>Installs/activates EMSDK if <code>emcmake</code>/<code>emcc</code> are missing. Uses <code>$EMSDK</code> or <code>$HOME/emsdk</code>; override the version with <code>$EMSDK_VERSION</code>.</td></tr><tr><td><code>pnpm build:kernel</code></td><td>Builds the ESM kernel bundle into <code>dist-kernel/</code> and syncs assets.</td></tr><tr><td><code>pnpm use:manifold:npm</code></td><td>Switches runtime/builds to the published <code>manifold-3d</code> npm package.</td></tr><tr><td><code>pnpm use:manifold:local</code></td><td>Switches runtime/builds to the locally compiled manifold bundle.</td></tr><tr><td><code>pnpm which:manifold</code></td><td>Prints the currently selected manifold source.</td></tr><tr><td><code>pnpm test</code></td><td>Runs the Node test suite (<code>src/tests/tests.js</code>), writing artifacts to <code>tests/results/</code>.</td></tr><tr><td><code>pnpm test -- test_primitiveCube</code></td><td>Runs one registered test by exact test function name.</td></tr><tr><td><code>pnpm liveTesting</code></td><td>Watches <code>src/</code> and <code>tests/</code> and reruns tests on change.</td></tr><tr><td><code>pnpm capture</code></td><td>Captures docs/dialog screenshots.</td></tr><tr><td><code>pnpm generateLicenses</code></td><td>Regenerates dependency and bundled-font license summaries.</td></tr></tbody></table><p>Build outputs:</p><ul><li><code>dist/</code>: static web app (ready for CDN/web hosting)</li><li><code>dist-kernel/</code>: published kernel bundle artifacts</li></ul><h2>CI and Pages Deployments</h2><p>The kernel build compiles a custom wasm bundle from the <code>vendor/manifold3d</code> git submodule. CI environments must:</p><ul><li>fetch submodules</li><li>install Emscripten/EMSDK before running <code>pnpm build</code> (<code>pnpm install:emscripten</code> can bootstrap it)</li></ul><p>This repo includes GitHub Actions workflows for:</p><ul><li>npm publishing with submodules + EMSDK</li><li>Cloudflare Pages deployment via Wrangler Direct Upload</li></ul><p>For Cloudflare Pages, use the GitHub Actions deploy workflow instead of relying on Cloudflare&#39;s Git build container to compile the wasm bundle. Configure these repository settings before enabling the workflow:</p><ul><li>secret <code>CLOUDFLARE_ACCOUNT_ID</code></li><li>secret <code>CLOUDFLARE_API_TOKEN</code></li><li>variable <code>CLOUDFLARE_PAGES_PROJECT_NAME</code></li></ul><h2>Use as an NPM Package</h2><p>Package name: <code>brep-io-kernel</code> (ESM-only).</p><p>Install:</p><div class="doc-codeblock" data-code-language="bash">
176
+ </div><p>Then open the Vite URL shown in your terminal.</p><ul><li>Main app shell: <code>/index.html</code></li><li>Direct CAD workspace: <code>/cad.html</code></li></ul><h2>Build, Test, and Utility Commands</h2><table><thead><tr><th>Command</th><th>Purpose</th></tr></thead><tbody><tr><td><code>pnpm dev</code></td><td>Prepares fonts, builds the kernel bundle, then runs the Vite dev server.</td></tr><tr><td><code>pnpm build</code></td><td>Production build of the app into <code>dist/</code> (includes kernel build step).</td></tr><tr><td><code>pnpm build:manifoldPlus</code></td><td>Builds the local manifold wasm/js bundle from the <code>vendor/manifold3d</code> submodule plus local custom bindings, using project-local EMSDK from <code>vendor/emsdk</code>.</td></tr><tr><td><code>pnpm build:kernel</code></td><td>Builds the ESM kernel bundle into <code>dist-kernel/</code> and syncs assets.</td></tr><tr><td><code>pnpm use:manifold:npm</code></td><td>Switches runtime/builds to the published <code>manifold-3d</code> npm package.</td></tr><tr><td><code>pnpm use:manifold:local</code></td><td>Switches runtime/builds to the locally compiled manifold bundle.</td></tr><tr><td><code>pnpm which:manifold</code></td><td>Prints the currently selected manifold source.</td></tr><tr><td><code>pnpm test</code></td><td>Runs the Node test suite (<code>src/tests/tests.js</code>), writing artifacts to <code>tests/results/</code>.</td></tr><tr><td><code>pnpm test -- test_primitiveCube</code></td><td>Runs one registered test by exact test function name.</td></tr><tr><td><code>pnpm liveTesting</code></td><td>Watches <code>src/</code> and <code>tests/</code> and reruns tests on change.</td></tr><tr><td><code>pnpm capture</code></td><td>Captures docs/dialog screenshots.</td></tr><tr><td><code>pnpm generateLicenses</code></td><td>Regenerates dependency and bundled-font license summaries.</td></tr></tbody></table><p>Build outputs:</p><ul><li><code>dist/</code>: static web app (ready for CDN/web hosting)</li><li><code>dist-kernel/</code>: published kernel bundle artifacts</li></ul><h2>CI and Pages Deployments</h2><p>The kernel build compiles a custom wasm bundle from the <code>vendor/manifold3d</code> git submodule. CI environments must:</p><ul><li>fetch submodules, including <code>vendor/emsdk</code></li><li>allow <code>pnpm build</code> to download the pinned project-local Emscripten SDK payload through <code>vendor/emsdk</code></li></ul><p>This repo includes GitHub Actions workflows for:</p><ul><li>npm publishing with submodules + EMSDK</li><li>Cloudflare Pages deployment via Wrangler Direct Upload</li></ul><p>For Cloudflare Pages, use the GitHub Actions deploy workflow instead of relying on Cloudflare&#39;s Git build container to compile the wasm bundle. Configure these repository settings before enabling the workflow:</p><ul><li>secret <code>CLOUDFLARE_ACCOUNT_ID</code></li><li>secret <code>CLOUDFLARE_API_TOKEN</code></li><li>variable <code>CLOUDFLARE_PAGES_PROJECT_NAME</code></li></ul><h2>Use as an NPM Package</h2><p>Package name: <code>brep-io-kernel</code> (ESM-only).</p><p>Install:</p><div class="doc-codeblock" data-code-language="bash">
177
177
  <div class="doc-codeblock-header">
178
178
  <span class="doc-codeblock-lang">bash</span>
179
179
  <button type="button" class="doc-codeblock-copy" data-copy-code aria-label="Copy code" title="Copy code">
@@ -5,10 +5,10 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
7
  <title>BREP API Example: Booleans</title>
8
- <script type="module" crossorigin src="/assets/apiExample_BREP_Booleans-BYmpqcsp.js"></script>
8
+ <script type="module" crossorigin src="/assets/apiExample_BREP_Booleans-CTe2EMfJ.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
11
- <link rel="modulepreload" crossorigin href="/assets/brep-kernel-PNIMTlaV.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/brep-kernel-DJpirUxq.js">
12
12
  <link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
13
13
  </head>
14
14
  <body>
@@ -5,10 +5,10 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
7
  <title>BREP API Example: Export</title>
8
- <script type="module" crossorigin src="/assets/apiExample_BREP_Export-uBjod_wt.js"></script>
8
+ <script type="module" crossorigin src="/assets/apiExample_BREP_Export-drwwX-N0.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
11
- <link rel="modulepreload" crossorigin href="/assets/brep-kernel-PNIMTlaV.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/brep-kernel-DJpirUxq.js">
12
12
  <link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
13
13
  </head>
14
14
  <body>
@@ -5,10 +5,10 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
7
  <title>BREP API Example: Primitives</title>
8
- <script type="module" crossorigin src="/assets/apiExample_BREP_Primitives-6305hZzi.js"></script>
8
+ <script type="module" crossorigin src="/assets/apiExample_BREP_Primitives-DmkRC9x9.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
11
- <link rel="modulepreload" crossorigin href="/assets/brep-kernel-PNIMTlaV.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/brep-kernel-DJpirUxq.js">
12
12
  <link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
13
13
  </head>
14
14
  <body>
@@ -5,10 +5,10 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
7
  <title>BREP API Example: Transforms</title>
8
- <script type="module" crossorigin src="/assets/apiExample_BREP_Transforms-BzoYBAov.js"></script>
8
+ <script type="module" crossorigin src="/assets/apiExample_BREP_Transforms-BuSQlmou.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
11
- <link rel="modulepreload" crossorigin href="/assets/brep-kernel-PNIMTlaV.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/brep-kernel-DJpirUxq.js">
12
12
  <link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
13
13
  </head>
14
14
  <body>
@@ -5,10 +5,10 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
7
  <title>BREP API Example: Embeded 2D Sketcher</title>
8
- <script type="module" crossorigin src="/assets/apiExample_Embeded_2D_Sketcher-D1NLjBBJ.js"></script>
8
+ <script type="module" crossorigin src="/assets/apiExample_Embeded_2D_Sketcher-uhVSKDmJ.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
11
- <link rel="modulepreload" crossorigin href="/assets/brep-kernel-PNIMTlaV.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/brep-kernel-DJpirUxq.js">
12
12
  <link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
13
13
  </head>
14
14
  <body>
@@ -31,10 +31,10 @@
31
31
  background: #fff;
32
32
  }
33
33
  </style>
34
- <script type="module" crossorigin src="/assets/apiExample_Embeded_CAD-CyBvK6VA.js"></script>
34
+ <script type="module" crossorigin src="/assets/apiExample_Embeded_CAD-DHa-5wYS.js"></script>
35
35
  <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
36
36
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
37
- <link rel="modulepreload" crossorigin href="/assets/brep-kernel-PNIMTlaV.js">
37
+ <link rel="modulepreload" crossorigin href="/assets/brep-kernel-DJpirUxq.js">
38
38
  <link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
39
39
  </head>
40
40
  <body>
@@ -92,10 +92,10 @@
92
92
  }
93
93
  }
94
94
  </style>
95
- <script type="module" crossorigin src="/assets/apiExample_Embeded_CAD_Integration_Test-GmK-MuGv.js"></script>
95
+ <script type="module" crossorigin src="/assets/apiExample_Embeded_CAD_Integration_Test-ChPFgcn1.js"></script>
96
96
  <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
97
97
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
98
- <link rel="modulepreload" crossorigin href="/assets/brep-kernel-PNIMTlaV.js">
98
+ <link rel="modulepreload" crossorigin href="/assets/brep-kernel-DJpirUxq.js">
99
99
  <link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
100
100
  </head>
101
101
  <body>
@@ -1,2 +1,2 @@
1
- var E=Object.defineProperty;var o=(e,t)=>E(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as i}from"./brep-kernel-PNIMTlaV.js";import"./preload-helper-ZNr0Qq7Q.js";const m=document.getElementById("status"),b=document.getElementById("log"),f=document.getElementById("btn-run"),c=o((e,t)=>{m.textContent=e,m.className=`status ${t}`},"setStatus"),g=o(e=>Number(e).toFixed(6),"fmt"),u=o((...e)=>{const t=e.map(r=>typeof r=="string"?r:JSON.stringify(r)).join(" ");b.textContent+=`${t}
1
+ var E=Object.defineProperty;var o=(e,t)=>E(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as i}from"./brep-kernel-DJpirUxq.js";import"./preload-helper-ZNr0Qq7Q.js";const m=document.getElementById("status"),b=document.getElementById("log"),f=document.getElementById("btn-run"),c=o((e,t)=>{m.textContent=e,m.className=`status ${t}`},"setStatus"),g=o(e=>Number(e).toFixed(6),"fmt"),u=o((...e)=>{const t=e.map(r=>typeof r=="string"?r:JSON.stringify(r)).join(" ");b.textContent+=`${t}
2
2
  `,console.log(...e)},"write"),s=o(e=>({volume:e.volume(),surfaceArea:e.surfaceArea(),triangles:e.getTriangleCount()}),"summarize"),d=o(()=>{b.textContent="",c("Running...","pending");const e=new i.Cube({x:2.2,y:2.2,z:2.2,name:"Cube"}),t=new i.Sphere({r:1.35,resolution:40,name:"Sphere"}),r=e.union(t),h=e.subtract(t),p=e.intersect(t),n={cube:s(e),sphere:s(t),union:s(r),subtract:s(h),intersect:s(p)};u("--- Boolean Results ---");for(const[v,l]of Object.entries(n))u(`${v.padEnd(10)} volume=${g(l.volume)} area=${g(l.surfaceArea)} triangles=${l.triangles}`);const a=1e-6;if(n.union.volume+a<Math.max(n.cube.volume,n.sphere.volume))throw new Error("Union volume is unexpectedly smaller than both source solids.");if(n.intersect.volume-a>Math.min(n.cube.volume,n.sphere.volume))throw new Error("Intersection volume is unexpectedly larger than a source solid.");if(n.subtract.volume-a>n.cube.volume)throw new Error("Subtract volume is unexpectedly larger than the original cube.");c("Completed","ok")},"runExample");f.addEventListener("click",()=>{try{d()}catch(e){console.error(e),u("ERROR:",e?.stack||e?.message||String(e)),c("Failed","err")}});try{d()}catch(e){console.error(e),u("ERROR:",e?.stack||e?.message||String(e)),c("Failed","err")}
@@ -1,4 +1,4 @@
1
- var g=Object.defineProperty;var r=(t,n)=>g(t,"name",{value:n,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as c}from"./brep-kernel-PNIMTlaV.js";import"./preload-helper-ZNr0Qq7Q.js";const l=document.getElementById("status"),d=document.getElementById("log"),p=document.getElementById("btn-run"),s=r((t,n)=>{l.textContent=t,l.className=`status ${n}`},"setStatus"),e=r((...t)=>{const n=t.map(o=>typeof o=="string"?o:JSON.stringify(o)).join(" ");d.textContent+=`${n}
1
+ var g=Object.defineProperty;var r=(t,n)=>g(t,"name",{value:n,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as c}from"./brep-kernel-DJpirUxq.js";import"./preload-helper-ZNr0Qq7Q.js";const l=document.getElementById("status"),d=document.getElementById("log"),p=document.getElementById("btn-run"),s=r((t,n)=>{l.textContent=t,l.className=`status ${n}`},"setStatus"),e=r((...t)=>{const n=t.map(o=>typeof o=="string"?o:JSON.stringify(o)).join(" ");d.textContent+=`${n}
2
2
  `,console.log(...t)},"write"),u=r((t,n=8)=>t.split(`
3
3
  `).slice(0,n).join(`
4
4
  `),"firstLines"),m=r(()=>{d.textContent="",s("Running...","pending");const t=new c.Cylinder({radius:1,height:3,resolution:48,name:"Shaft"}).bakeTRS({position:[0,0,.6],rotationEuler:[90,0,0],scale:[1,1,1]}),n=new c.Cone({radius:1.55,height:1.6,resolution:48,name:"Head"}).bakeTRS({position:[0,1.65,.6],rotationEuler:[-90,0,0],scale:[1,1,1]}),o=t.union(n),i=o.toSTL("api_example_part",4),a=o.toSTEP("api_example_part",{precision:4});if(e("--- Export Summary ---"),e("Volume:",o.volume()),e("Surface area:",o.surfaceArea()),e("Triangles:",o.getTriangleCount()),e("STL characters:",i.length),e("STEP characters:",a.length),e(""),e("--- STL Preview ---"),e(u(i)),e(""),e("--- STEP Preview ---"),e(u(a)),!i.startsWith("solid"))throw new Error('STL output did not start with "solid".');if(!a.includes("ISO-10303-21"))throw new Error("STEP output did not contain expected ISO header.");s("Completed","ok")},"runExample");p.addEventListener("click",()=>{try{m()}catch(t){console.error(t),e("ERROR:",t?.stack||t?.message||String(t)),s("Failed","err")}});try{m()}catch(t){console.error(t),e("ERROR:",t?.stack||t?.message||String(t)),s("Failed","err")}
@@ -1,2 +1,2 @@
1
- var g=Object.defineProperty;var n=(e,t)=>g(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as o}from"./brep-kernel-PNIMTlaV.js";import"./preload-helper-ZNr0Qq7Q.js";const m=document.getElementById("status"),u=document.getElementById("log"),y=document.getElementById("btn-run"),s=n((e,t)=>{m.textContent=e,m.className=`status ${t}`},"setStatus"),l=n(e=>Number(e).toFixed(6),"fmt"),a=n((...e)=>{const t=e.map(r=>typeof r=="string"?r:JSON.stringify(r)).join(" ");u.textContent+=`${t}
1
+ var g=Object.defineProperty;var n=(e,t)=>g(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as o}from"./brep-kernel-DJpirUxq.js";import"./preload-helper-ZNr0Qq7Q.js";const m=document.getElementById("status"),u=document.getElementById("log"),y=document.getElementById("btn-run"),s=n((e,t)=>{m.textContent=e,m.className=`status ${t}`},"setStatus"),l=n(e=>Number(e).toFixed(6),"fmt"),a=n((...e)=>{const t=e.map(r=>typeof r=="string"?r:JSON.stringify(r)).join(" ");u.textContent+=`${t}
2
2
  `,console.log(...e)},"write"),C=n(e=>({volume:e.volume(),area:e.surfaceArea(),triangles:e.getTriangleCount()}),"summarize"),c=n(()=>{u.textContent="",s("Running...","pending");const e=[["Cube",()=>new o.Cube({x:2,y:3,z:4,name:"Cube"})],["Sphere",()=>new o.Sphere({r:1.2,resolution:32,name:"Sphere"})],["Cylinder",()=>new o.Cylinder({radius:1,height:2.4,resolution:48,name:"Cylinder"})],["Cone",()=>new o.Cone({radius:1.1,height:2.1,resolution:48,name:"Cone"})],["Torus",()=>new o.Torus({mR:2,tR:.55,resolution:64,name:"Torus"})],["Pyramid",()=>new o.Pyramid({bL:2,s:4,h:2.7,name:"Pyramid"})]];a("--- Primitive Summary ---");for(const[t,r]of e){const d=r(),i=C(d);a(`${t.padEnd(10)} volume=${l(i.volume)} area=${l(i.area)} triangles=${i.triangles}`)}s("Completed","ok")},"runExample");y.addEventListener("click",()=>{try{c()}catch(e){console.error(e),a("ERROR:",e?.stack||e?.message||String(e)),s("Failed","err")}});try{c()}catch(e){console.error(e),a("ERROR:",e?.stack||e?.message||String(e)),s("Failed","err")}
@@ -1,2 +1,2 @@
1
- var u=Object.defineProperty;var n=(e,t)=>u(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as g}from"./brep-kernel-PNIMTlaV.js";import"./preload-helper-ZNr0Qq7Q.js";const c=document.getElementById("status"),l=document.getElementById("log"),b=document.getElementById("btn-run"),s=n((e,t)=>{c.textContent=e,c.className=`status ${t}`},"setStatus"),i=n(e=>Number(e).toFixed(6),"fmt"),m=n((...e)=>{const t=e.map(o=>typeof o=="string"?o:JSON.stringify(o)).join(" ");l.textContent+=`${t}
1
+ var u=Object.defineProperty;var n=(e,t)=>u(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as g}from"./brep-kernel-DJpirUxq.js";import"./preload-helper-ZNr0Qq7Q.js";const c=document.getElementById("status"),l=document.getElementById("log"),b=document.getElementById("btn-run"),s=n((e,t)=>{c.textContent=e,c.className=`status ${t}`},"setStatus"),i=n(e=>Number(e).toFixed(6),"fmt"),m=n((...e)=>{const t=e.map(o=>typeof o=="string"?o:JSON.stringify(o)).join(" ");l.textContent+=`${t}
2
2
  `,console.log(...e)},"write"),r=n((e,t)=>{m(`${e.padEnd(16)} volume=${i(t.volume())} area=${i(t.surfaceArea())} triangles=${t.getTriangleCount()}`)},"describe"),d=n(()=>{l.textContent="",s("Running...","pending");const e=new g.Cube({x:2.2,y:1.4,z:1,name:"BaseCube"}),t=e.clone().bakeTRS({position:[2,.4,.3],rotationEuler:[0,35,20],scale:[1.1,.85,1.25]}),o=t.mirrorAcrossPlane([0,0,0],[1,0,0]),a=t.union(o);if(m("--- Transform Summary ---"),r("base",e),r("moved",t),r("mirrored",o),r("combined",a),a.volume()<=t.volume())throw new Error("Combined solid volume should be greater than a single moved solid.");s("Completed","ok")},"runExample");b.addEventListener("click",()=>{try{d()}catch(e){console.error(e),m("ERROR:",e?.stack||e?.message||String(e)),s("Failed","err")}});try{d()}catch(e){console.error(e),m("ERROR:",e?.stack||e?.message||String(e)),s("Failed","err")}
@@ -1,4 +1,4 @@
1
- var H=Object.defineProperty;var s=(e,o)=>H(e,"name",{value:o,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{Sketcher2DEmbed as J}from"./brep-kernel-PNIMTlaV.js";import"./preload-helper-ZNr0Qq7Q.js";const k=document.getElementById("btn-create"),C=document.getElementById("btn-destroy"),I=document.getElementById("btn-apply-css"),w=document.getElementById("btn-apply-theme"),B=document.getElementById("btn-export-svg"),$=document.getElementById("btn-export-dxf"),r=document.getElementById("btn-download-dxf"),D=document.getElementById("btn-export-polylines"),F=document.getElementById("geometry-color"),L=document.getElementById("point-color"),N=document.getElementById("constraint-color"),G=document.getElementById("background-color"),T=document.getElementById("point-size-px"),A=document.getElementById("curve-thickness-px"),f=document.getElementById("sidebar-expanded"),u=document.getElementById("grid-visible"),V=document.getElementById("grid-spacing"),W=document.getElementById("curve-resolution"),R=document.getElementById("css-input"),Y=document.getElementById("sketch-status"),q=document.getElementById("sketch-host"),d=document.getElementById("event-output"),g=document.getElementById("svg-preview"),O=document.getElementById("path-output"),P=document.getElementById("dxf-output"),M=document.getElementById("polyline-output");let t=null,i=null,m=0,h=0,y=0,c=null;const K=6,n=s(e=>{Y.textContent=e},"setSketchStatus"),b=s(()=>{c&&(URL.revokeObjectURL(c),c=null)},"revokeDxfDownload"),Q=s(e=>{if(b(),typeof e!="string"||!e.length){r.disabled=!0;return}const o=new Blob([e],{type:"application/dxf"});c=URL.createObjectURL(o),r.disabled=!1},"setDxfDownload"),E=s(e=>{k.disabled=e,C.disabled=!e,I.disabled=!e,w.disabled=!e,B.disabled=!e,$.disabled=!e,D.disabled=!e,r.disabled=!e||!c},"setSketchButtons"),p=s((e,o=null)=>{const a=new Date().toLocaleTimeString(),j=o==null?`[${a}] ${e}`:`[${a}] ${e} ${JSON.stringify(o)}`,z=d.textContent==="(No sketch events yet)"?[]:d.textContent.split(`
1
+ var H=Object.defineProperty;var s=(e,o)=>H(e,"name",{value:o,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{Sketcher2DEmbed as J}from"./brep-kernel-DJpirUxq.js";import"./preload-helper-ZNr0Qq7Q.js";const k=document.getElementById("btn-create"),C=document.getElementById("btn-destroy"),I=document.getElementById("btn-apply-css"),w=document.getElementById("btn-apply-theme"),B=document.getElementById("btn-export-svg"),$=document.getElementById("btn-export-dxf"),r=document.getElementById("btn-download-dxf"),D=document.getElementById("btn-export-polylines"),F=document.getElementById("geometry-color"),L=document.getElementById("point-color"),N=document.getElementById("constraint-color"),G=document.getElementById("background-color"),T=document.getElementById("point-size-px"),A=document.getElementById("curve-thickness-px"),f=document.getElementById("sidebar-expanded"),u=document.getElementById("grid-visible"),V=document.getElementById("grid-spacing"),W=document.getElementById("curve-resolution"),R=document.getElementById("css-input"),Y=document.getElementById("sketch-status"),q=document.getElementById("sketch-host"),d=document.getElementById("event-output"),g=document.getElementById("svg-preview"),O=document.getElementById("path-output"),P=document.getElementById("dxf-output"),M=document.getElementById("polyline-output");let t=null,i=null,m=0,h=0,y=0,c=null;const K=6,n=s(e=>{Y.textContent=e},"setSketchStatus"),b=s(()=>{c&&(URL.revokeObjectURL(c),c=null)},"revokeDxfDownload"),Q=s(e=>{if(b(),typeof e!="string"||!e.length){r.disabled=!0;return}const o=new Blob([e],{type:"application/dxf"});c=URL.createObjectURL(o),r.disabled=!1},"setDxfDownload"),E=s(e=>{k.disabled=e,C.disabled=!e,I.disabled=!e,w.disabled=!e,B.disabled=!e,$.disabled=!e,D.disabled=!e,r.disabled=!e||!c},"setSketchButtons"),p=s((e,o=null)=>{const a=new Date().toLocaleTimeString(),j=o==null?`[${a}] ${e}`:`[${a}] ${e} ${JSON.stringify(o)}`,z=d.textContent==="(No sketch events yet)"?[]:d.textContent.split(`
2
2
  `).filter(Boolean),S=[j,...z].slice(0,K);d.textContent=S.length?S.join(`
3
3
  `):"(No sketch events yet)"},"pushEvent"),U=s(()=>({geometryColor:F.value,pointColor:L.value,constraintColor:N.value,backgroundColor:G.value,pointSizePx:Math.max(1,Number(T.value)||10),curveThicknessPx:Math.max(.5,Number(A.value)||2)}),"currentTheme"),x=s(()=>{const e=Number(V.value);return Number.isFinite(e)&&e>0?e:1},"currentGridSpacing"),v=s(()=>{const e=Number(W.value);return Number.isFinite(e)?Math.max(3,Math.min(2048,Math.floor(e))):64},"currentCurveResolution"),Z=s(async()=>{t||(t=new J({cssText:R.value,...U(),sidebarExpanded:f.checked,gridVisible:u.checked,gridSpacing:x(),onChange:s(e=>{i=e,m+=1;const o=Array.isArray(e?.geometries)?e.geometries.length:0;n(`Sketch updated (${m}). Geometries: ${o}`),p("onChange",{geometries:o})},"onChange"),onFinished:s(e=>{i=e,h+=1;const o=Array.isArray(e?.geometries)?e.geometries.length:0;n(`Sketch finished (${h}). Geometries: ${o}`),p("onFinished",{geometries:o}),X().catch(a=>{console.error(a),n(`Failed to export SVG after Finish: ${a?.message||String(a)}`)})},"onFinished"),onCancelled:s(()=>{y+=1,n(`Sketch cancelled (${y}).`),p("onCancelled")},"onCancelled")}),await t.mount(q),i=await t.getSketch(),E(!0),n("Sketcher iframe mounted. Draw geometry and run any export action."))},"attachSketcher"),_=s(async()=>{t&&(await t.destroy(),t=null,i=null,m=0,h=0,y=0,E(!1),n("Sketcher destroyed."),d.textContent="(No sketch events yet)",g.innerHTML="",O.textContent="(No SVG exported yet)",P.textContent="(No DXF exported yet)",M.textContent="(No 3D polylines exported yet)",b())},"detachSketcher"),ee=s(async()=>{t&&(await t.setCss(R.value),n("Custom CSS applied to iframe."))},"applySketchCss"),l=s(async()=>{t&&(await t.setTheme(U()),await t.setSidebarExpanded(f.checked),typeof t.setGrid=="function"?await t.setGrid({visible:u.checked,spacing:x()}):(typeof t.setGridVisible=="function"&&await t.setGridVisible(u.checked),typeof t.setGridSpacing=="function"&&await t.setGridSpacing(x())),n("Theme + sidebar + grid state applied to iframe."))},"applySketchTheme"),X=s(async()=>{if(!t)return;const e=await t.exportSVG({flipY:!0,precision:3,stroke:"#111111",strokeWidth:1.5,fill:"none",padding:12,curveResolution:v()});i=await t.getSketch({preferCached:!0}),g.innerHTML=e.svg,O.textContent=e.paths.length?e.paths.map(o=>`id=${o.id} type=${o.type} d="${o.d}"`).join(`
4
4
  `):"(No sketch geometry to export)",n(`Exported ${e.paths.length} SVG paths.`),g.scrollIntoView({behavior:"smooth",block:"start"})},"exportSvg"),te=s(async()=>{if(!t)return;const e=await t.exportDXF({units:"mm",curveResolution:v(),includeConstruction:!1});P.textContent=e?.dxf||"(No DXF payload returned)",Q(e?.dxf||""),n(`Exported DXF with ${e?.polylines?.length||0} polylines.`)},"exportDxf"),ne=s(async()=>{if(!t)return;const e=await t.export3DPolylines({curveResolution:v(),includeConstruction:!1,origin:[0,0,0],xAxis:[1,0,0],yAxis:[0,1,0]});M.textContent=JSON.stringify(e,null,2),n(`Exported ${e?.polylines?.length||0} 3D polylines.`)},"export3DPolylines");k.addEventListener("click",()=>{Z().catch(e=>{console.error(e),n(`Failed to create sketcher: ${e?.message||String(e)}`)})});C.addEventListener("click",()=>{_().catch(e=>{console.error(e),n(`Failed to destroy sketcher: ${e?.message||String(e)}`)})});I.addEventListener("click",()=>{ee().catch(e=>{console.error(e),n(`Failed to apply CSS: ${e?.message||String(e)}`)})});w.addEventListener("click",()=>{l().catch(e=>{console.error(e),n(`Failed to apply theme: ${e?.message||String(e)}`)})});B.addEventListener("click",()=>{X().catch(e=>{console.error(e),n(`Failed to export SVG: ${e?.message||String(e)}`)})});$.addEventListener("click",()=>{te().catch(e=>{console.error(e),n(`Failed to export DXF: ${e?.message||String(e)}`)})});r.addEventListener("click",()=>{if(!c)return;const e=document.createElement("a");e.href=c,e.download="sketch-export.dxf",e.click()});D.addEventListener("click",()=>{ne().catch(e=>{console.error(e),n(`Failed to export 3D polylines: ${e?.message||String(e)}`)})});[F,L,N,G,T,A].forEach(e=>{e.addEventListener("input",()=>{t&&l().catch(o=>{console.error(o),n(`Failed to apply theme: ${o?.message||String(o)}`)})})});f.addEventListener("change",()=>{t&&l().catch(e=>{console.error(e),n(`Failed to apply sidebar state: ${e?.message||String(e)}`)})});u.addEventListener("change",()=>{t&&l().catch(e=>{console.error(e),n(`Failed to apply grid visibility: ${e?.message||String(e)}`)})});V.addEventListener("input",()=>{t&&l().catch(e=>{console.error(e),n(`Failed to apply grid spacing: ${e?.message||String(e)}`)})});window.addEventListener("beforeunload",()=>{t&&t.destroy().catch(()=>{}),b()});E(!1);i&&!Array.isArray(i?.geometries)&&console.warn("Unexpected sketch payload shape",i);
@@ -1,3 +1,3 @@
1
- var B=Object.defineProperty;var n=(t,o)=>B(t,"name",{value:o,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{CADEmbed as v}from"./brep-kernel-PNIMTlaV.js";import"./preload-helper-ZNr0Qq7Q.js";const u=document.getElementById("btn-create"),y=document.getElementById("btn-destroy"),p=document.getElementById("btn-state"),g=document.getElementById("btn-history"),b=document.getElementById("btn-sample"),E=document.getElementById("btn-reset"),h=document.getElementById("btn-css"),S=document.getElementById("viewer-only"),i=document.getElementById("sidebar-expanded"),x=document.getElementById("model-path"),w=document.getElementById("model-source"),$=document.getElementById("model-repo"),k=document.getElementById("model-branch"),C=document.getElementById("css-input"),F=document.getElementById("cad-status"),H=document.getElementById("cad-host"),I=document.getElementById("state-output"),f=document.getElementById("history-output");let e=null;const D={features:[{type:"Primitive Cube",inputParams:{id:"sample_cube_1",sizeX:24,sizeY:18,sizeZ:14,transform:{position:[0,0,0],rotationEuler:[0,0,0],scale:[1,1,1]},boolean:{targets:[],operation:"NONE"}},persistentData:{},timestamp:null}],idCounter:1,expressions:`//Examples:
1
+ var B=Object.defineProperty;var n=(t,o)=>B(t,"name",{value:o,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{CADEmbed as v}from"./brep-kernel-DJpirUxq.js";import"./preload-helper-ZNr0Qq7Q.js";const u=document.getElementById("btn-create"),y=document.getElementById("btn-destroy"),p=document.getElementById("btn-state"),g=document.getElementById("btn-history"),b=document.getElementById("btn-sample"),E=document.getElementById("btn-reset"),h=document.getElementById("btn-css"),S=document.getElementById("viewer-only"),i=document.getElementById("sidebar-expanded"),x=document.getElementById("model-path"),w=document.getElementById("model-source"),$=document.getElementById("model-repo"),k=document.getElementById("model-branch"),C=document.getElementById("css-input"),F=document.getElementById("cad-status"),H=document.getElementById("cad-host"),I=document.getElementById("state-output"),f=document.getElementById("history-output");let e=null;const D={features:[{type:"Primitive Cube",inputParams:{id:"sample_cube_1",sizeX:24,sizeY:18,sizeZ:14,transform:{position:[0,0,0],rotationEuler:[0,0,0],scale:[1,1,1]},boolean:{targets:[],operation:"NONE"}},persistentData:{},timestamp:null}],idCounter:1,expressions:`//Examples:
2
2
  x = 10 + 6;
3
3
  y = x * 2;`,pmiViews:[],metadata:{},assemblyConstraints:[],assemblyConstraintIdCounter:0},s=n(t=>{F.textContent=t},"setStatus"),r=n(t=>{u.disabled=t,y.disabled=!t,p.disabled=!t,g.disabled=!t,b.disabled=!t,E.disabled=!t,h.disabled=!t,S.disabled=t},"setButtons"),L=n(()=>{const t=String(x.value||"").trim();if(!t)return null;const o=String(w.value||"local").trim()||"local",a=String($.value||"").trim(),d=String(k.value||"").trim(),l={modelPath:t,source:o};return a&&(l.repoFull=a),d&&(l.branch=d),l},"currentModelRequest"),c=n((t,o="State updated")=>{I.textContent=JSON.stringify(t||{},null,2);const a=Number(t?.featureCount||0),d=t?.model?.name||"(unsaved/new)";s(`${o}. Features: ${a}. Model: ${d}`)},"renderState"),N=n(async()=>{if(e)return;const t=L();e=new v({mountTo:H,viewerOnlyMode:S.checked,sidebarExpanded:i.checked,cssText:C.value,initialModel:t,onReady:n(a=>{c(a,"CAD ready")},"onReady"),onHistoryChanged:n(a=>{c(a,`History changed (${a?.reason||"update"})`)},"onHistoryChanged")}),await e.mount(),r(!0);const o=await e.getState();c(o,"CAD iframe mounted")},"createCad"),O=n(async()=>{e&&(await e.destroy(),e=null,r(!1),s("CAD iframe destroyed."),I.textContent="(No state yet)",f.textContent="(No history exported yet)")},"destroyCad"),m=n(async()=>{if(!e)return;const t=await e.getState();c(t,"State fetched")},"refreshState"),A=n(async()=>{if(!e)return;const t=await e.getPartHistoryJSON();f.textContent=t||"(History is empty)",s(`History exported (${t?t.length:0} chars).`)},"exportHistory"),M=n(async()=>{e&&(await e.setPartHistory(D),await m(),s("Sample cube history loaded."))},"loadSampleCube"),P=n(async()=>{e&&(await e.reset(),await m(),s("Model reset complete."))},"resetModel"),R=n(async()=>{e&&(await e.setCss(C.value),await e.setSidebarExpanded(i.checked),s("Custom CSS and sidebar state applied."))},"applyCss");u.addEventListener("click",()=>{N().catch(t=>{console.error(t),s(`Failed to create CAD iframe: ${t?.message||String(t)}`)})});y.addEventListener("click",()=>{O().catch(t=>{console.error(t),s(`Failed to destroy CAD iframe: ${t?.message||String(t)}`)})});p.addEventListener("click",()=>{m().catch(t=>{console.error(t),s(`Failed to get state: ${t?.message||String(t)}`)})});g.addEventListener("click",()=>{A().catch(t=>{console.error(t),s(`Failed to export history: ${t?.message||String(t)}`)})});b.addEventListener("click",()=>{M().catch(t=>{console.error(t),s(`Failed to load sample history: ${t?.message||String(t)}`)})});E.addEventListener("click",()=>{P().catch(t=>{console.error(t),s(`Failed to reset model: ${t?.message||String(t)}`)})});h.addEventListener("click",()=>{R().catch(t=>{console.error(t),s(`Failed to apply CSS: ${t?.message||String(t)}`)})});i.addEventListener("change",()=>{e&&e.setSidebarExpanded(i.checked).catch(t=>{console.error(t),s(`Failed to set sidebar state: ${t?.message||String(t)}`)})});r(!1);
@@ -1,4 +1,4 @@
1
- var O=Object.defineProperty;var i=(t,s)=>O(t,"name",{value:s,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{CADEmbed as S}from"./brep-kernel-PNIMTlaV.js";import"./preload-helper-ZNr0Qq7Q.js";const h=document.getElementById("btn-run"),u=document.getElementById("btn-destroy"),P=document.getElementById("viewer-only"),H=document.getElementById("sidebar-expanded"),M=document.getElementById("model-path"),A=document.getElementById("model-source"),j=document.getElementById("model-repo"),B=document.getElementById("model-branch"),x=document.getElementById("css-input"),R=document.getElementById("run-status"),$=document.getElementById("cad-host"),C=document.getElementById("results"),g=document.getElementById("log-output");let n=null,w=!1;const v={features:[{type:"Primitive Cube",inputParams:{id:"integration_sample_cube_1",sizeX:16,sizeY:12,sizeZ:10,transform:{position:[0,0,0],rotationEuler:[0,0,0],scale:[1,1,1]},boolean:{targets:[],operation:"NONE"}},persistentData:{},timestamp:null}],idCounter:1,expressions:`//Examples:
1
+ var O=Object.defineProperty;var i=(t,s)=>O(t,"name",{value:s,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{CADEmbed as S}from"./brep-kernel-DJpirUxq.js";import"./preload-helper-ZNr0Qq7Q.js";const h=document.getElementById("btn-run"),u=document.getElementById("btn-destroy"),P=document.getElementById("viewer-only"),H=document.getElementById("sidebar-expanded"),M=document.getElementById("model-path"),A=document.getElementById("model-source"),j=document.getElementById("model-repo"),B=document.getElementById("model-branch"),x=document.getElementById("css-input"),R=document.getElementById("run-status"),$=document.getElementById("cad-host"),C=document.getElementById("results"),g=document.getElementById("log-output");let n=null,w=!1;const v={features:[{type:"Primitive Cube",inputParams:{id:"integration_sample_cube_1",sizeX:16,sizeY:12,sizeZ:10,transform:{position:[0,0,0],rotationEuler:[0,0,0],scale:[1,1,1]},boolean:{targets:[],operation:"NONE"}},persistentData:{},timestamp:null}],idCounter:1,expressions:`//Examples:
2
2
  x = 10 + 6;
3
3
  y = x * 2;`,pmiViews:[],metadata:{},assemblyConstraints:[],assemblyConstraintIdCounter:0};function l(t){const a=`[${new Date().toLocaleTimeString()}] ${t}`,o=g.textContent==="(No logs yet)"?[]:g.textContent.split(`
4
4
  `).filter(Boolean);o.unshift(a),g.textContent=o.slice(0,120).join(`
@@ -15161,11 +15161,15 @@ ${s}
15161
15161
  user-select: none;
15162
15162
  pointer-events: none;
15163
15163
  }
15164
- `;const t=document.createElement("div");t.className="wrap";const g=document.createElement("div");g.className="container";const o=document.createElement("div");o.className="loading",o.textContent="Loading editor...",t.append(g,o),this.shadowRoot.replaceChildren(A,e,t),this._container=g,this._loading=o}async _boot(){try{const A=await Ll._loadMonaco();Ll._registerRuntimeCompletion(A),this._createEditor(A),this._installEnvAutocomplete(),A.editor.setTheme(this.theme),this._loading.style.display="none"}catch(A){try{this._loading.textContent="Editor failed to load",this._loading.style.pointerEvents="auto"}catch{}try{console.warn("[EnvMonacoEditor] Failed to load Monaco",A)}catch{}}}_createEditor(A){const e=A.Uri.parse(`file:///env-monaco-editor/${Ll._uuid()}.js`),t=this._pendingLanguage||this.language;this._model=A.editor.createModel(this._pendingValue||"",t,e),this._editor=A.editor.create(this._container,{model:this._model,theme:this.theme,automaticLayout:!0,minimap:{enabled:!1},fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fontSize:13,lineHeight:19,tabSize:2,insertSpaces:!0,readOnly:this.readonly,scrollBeyondLastLine:!1,smoothScrolling:!0,quickSuggestions:!0,suggestOnTriggerCharacters:!0,cursorSmoothCaretAnimation:"on",renderLineHighlight:"all"}),this._editor.onDidChangeModelContent(()=>{this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{value:this._editor.getValue()},bubbles:!0,composed:!0}))})}_installEnvAutocomplete(){}_disposeEditor(){this._editor&&this._editor.dispose(),this._editor=null,this._model&&this._model.dispose(),this._model=null}_collectProps(A){const e=[],t=new Set;let g=A;for(;g&&g!==Object.prototype&&g!==Function.prototype&&!t.has(g);){t.add(g);let o=null;try{o=Object.getOwnPropertyDescriptors(g)}catch{o=null}if(!o){g=Object.getPrototypeOf(g);continue}for(const[s,I]of Object.entries(o)){if(s==="constructor"||e.some(a=>a.key===s))continue;const n=Object.prototype.hasOwnProperty.call(I,"value"),r=!n&&(!!I.get||!!I.set),C=n?I.value:void 0;e.push({key:s,value:C,getterOnly:r})}g=Object.getPrototypeOf(g)}return e}static _registerRuntimeCompletion(A){if(!Ll._runtimeCompletionRegistered){Ll._runtimeCompletionRegistered=!0;try{A.languages.registerCompletionItemProvider("javascript",{triggerCharacters:[".","?"],provideCompletionItems:B((e,t)=>{try{const g=e.getLineContent(t.lineNumber).slice(0,t.column-1).split(/[^A-Za-z0-9_$?.]/).pop()||"";if(!g||!g.startsWith("env"))return{suggestions:[]};const o=g.replace(/^\?/g,"").replace(/\?/g,"").split(".").filter(Boolean);if(o[0]!=="env")return{suggestions:[]};o.shift();let s=window.env;for(const C of o)if(s&&typeof s=="object"&&C in s)s=s[C];else return{suggestions:[]};if(s==null)return{suggestions:[]};const I=Array.from(new Set(this.prototype._collectProps?this.prototype._collectProps(s).map(C=>C.key):Object.keys(s))),n=e.getWordUntilPosition(t),r=new A.Range(t.lineNumber,n.startColumn,t.lineNumber,n.endColumn);return{suggestions:I.map(C=>({label:C,insertText:C,kind:A.languages.CompletionItemKind.Property,range:r}))}}catch{return{suggestions:[]}}},"provideCompletionItems")})}catch{}}}static _uuid(){return globalThis.crypto?.randomUUID?globalThis.crypto.randomUUID():`${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}static _loadMonaco(){return window.monaco?Promise.resolve(window.monaco):(Ll._monacoPromise||(Ll._monacoPromise=Promise.resolve().then(()=>{const A=globalThis.monaco||rYg;return window.monaco=A,A})),Ll._monacoPromise)}},E(Ll,"gw2"),Ll);B(hFi,"EnvMonacoEditor");let S4e=hFi;S4e._monacoPromise=null;S4e._runtimeCompletionRegistered=!1;customElements.get("env-monaco-editor")||customElements.define("env-monaco-editor",S4e);const Zre=Symbol("ScriptRunnerPanel"),BPA=300,aYg=`// Access the app environment via the global "env" object.
15164
+ `;const t=document.createElement("div");t.className="wrap";const g=document.createElement("div");g.className="container";const o=document.createElement("div");o.className="loading",o.textContent="Loading editor...",t.append(g,o),this.shadowRoot.replaceChildren(A,e,t),this._container=g,this._loading=o}async _boot(){try{const A=await Ll._loadMonaco();Ll._registerRuntimeCompletion(A),this._createEditor(A),this._installEnvAutocomplete(),A.editor.setTheme(this.theme),this._loading.style.display="none"}catch(A){try{this._loading.textContent="Editor failed to load",this._loading.style.pointerEvents="auto"}catch{}try{console.warn("[EnvMonacoEditor] Failed to load Monaco",A)}catch{}}}_createEditor(A){const e=A.Uri.parse(`file:///env-monaco-editor/${Ll._uuid()}.js`),t=this._pendingLanguage||this.language;this._model=A.editor.createModel(this._pendingValue||"",t,e),this._editor=A.editor.create(this._container,{model:this._model,theme:this.theme,automaticLayout:!0,minimap:{enabled:!1},fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fontSize:13,lineHeight:19,tabSize:2,insertSpaces:!0,readOnly:this.readonly,scrollBeyondLastLine:!1,smoothScrolling:!0,quickSuggestions:!0,suggestOnTriggerCharacters:!0,cursorSmoothCaretAnimation:"on",renderLineHighlight:"all"}),this._editor.onDidChangeModelContent(()=>{this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{value:this._editor.getValue()},bubbles:!0,composed:!0}))})}_installEnvAutocomplete(){}_disposeEditor(){this._editor&&this._editor.dispose(),this._editor=null,this._model&&this._model.dispose(),this._model=null}_collectProps(A){const e=[],t=new Set;let g=A;for(;g&&g!==Object.prototype&&g!==Function.prototype&&!t.has(g);){t.add(g);let o=null;try{o=Object.getOwnPropertyDescriptors(g)}catch{o=null}if(!o){g=Object.getPrototypeOf(g);continue}for(const[s,I]of Object.entries(o)){if(s==="constructor"||e.some(a=>a.key===s))continue;const n=Object.prototype.hasOwnProperty.call(I,"value"),r=!n&&(!!I.get||!!I.set),C=n?I.value:void 0;e.push({key:s,value:C,getterOnly:r})}g=Object.getPrototypeOf(g)}return e}static _registerRuntimeCompletion(A){if(!Ll._runtimeCompletionRegistered){Ll._runtimeCompletionRegistered=!0;try{A.languages.registerCompletionItemProvider("javascript",{triggerCharacters:[".","?"],provideCompletionItems:B((e,t)=>{try{const g=e.getLineContent(t.lineNumber).slice(0,t.column-1).split(/[^A-Za-z0-9_$?.]/).pop()||"";if(!g||!g.startsWith("env"))return{suggestions:[]};const o=g.replace(/^\?/g,"").replace(/\?/g,"").split(".").filter(Boolean);if(o[0]!=="env")return{suggestions:[]};o.shift();let s=window.env;for(const C of o)if(s&&typeof s=="object"&&C in s)s=s[C];else return{suggestions:[]};if(s==null)return{suggestions:[]};const I=Array.from(new Set(this.prototype._collectProps?this.prototype._collectProps(s).map(C=>C.key):Object.keys(s))),n=e.getWordUntilPosition(t),r=new A.Range(t.lineNumber,n.startColumn,t.lineNumber,n.endColumn);return{suggestions:I.map(C=>({label:C,insertText:C,kind:A.languages.CompletionItemKind.Property,range:r}))}}catch{return{suggestions:[]}}},"provideCompletionItems")})}catch{}}}static _uuid(){return globalThis.crypto?.randomUUID?globalThis.crypto.randomUUID():`${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`}static _loadMonaco(){return window.monaco?Promise.resolve(window.monaco):(Ll._monacoPromise||(Ll._monacoPromise=Promise.resolve().then(()=>{const A=globalThis.monaco||rYg;return window.monaco=A,A})),Ll._monacoPromise)}},E(Ll,"gw2"),Ll);B(hFi,"EnvMonacoEditor");let S4e=hFi;S4e._monacoPromise=null;S4e._runtimeCompletionRegistered=!1;customElements.get("env-monaco-editor")||customElements.define("env-monaco-editor",S4e);const Zre=Symbol("ScriptRunnerPanel"),BPA=300,aYg=`
15165
+ // Access the app environment via the global "env" object.
15165
15166
  console.log('env keys', Object.keys(env || {}));
15166
15167
 
15167
15168
  // Example: log the active part history entry
15168
- console.log('active history', viewer?.partHistory?.getActiveStep?.());
15169
+ console.log('active history', viewer?.partHistory);
15170
+
15171
+
15172
+
15169
15173
  `;var pyA;const wFi=(pyA=class{constructor(A){this.viewer=A,this.window=null,this.root=null,this.editorEl=null,this.editorWrap=null,this.outputEl=null,this.consoleWrap=null,this.splitterEl=null,this.contentRoot=null,this.introEl=null,this.statusEl=null,this._initializedValue=!1,this._consoleHeight=180,this._lastContentRect=null,this._isRunning=!1}toggle(){this.root&&this.root.style.display!=="none"?this.close():this.open()}open(){if(this._ensureWindow(),!!this.root){this.root.style.display="flex";try{this.editorEl?.refreshEnvAutocomplete?.()}catch{}}}close(){if(this.root)try{this.root.style.display="none"}catch{}}_ensureWindow(){if(this.root)return;const A=new E0({title:"Script Runner",width:760,height:520,right:16,top:56,shaded:!1,onClose:B(()=>this.close(),"onClose")}),e=document.createElement("button");e.className="fw-btn",e.textContent="Run",e.addEventListener("click",()=>this._runCode());const t=document.createElement("button");t.className="fw-btn",t.textContent="Refresh env autocomplete",t.addEventListener("click",()=>{try{this.editorEl?.refreshEnvAutocomplete?.(),this._setStatus("env autocomplete refreshed from window.env")}catch{this._setStatus("Unable to refresh env autocomplete")}}),A.addHeaderAction(e),A.addHeaderAction(t);const g=document.createElement("div");g.style.display="flex",g.style.flexDirection="column",g.style.gap="8px",g.style.width="100%",g.style.height="100%",g.style.boxSizing="border-box",g.style.minHeight="0",this.contentRoot=g;const o=document.createElement("div");o.textContent="Run ad-hoc JavaScript with Monaco highlighting and live window.env autocomplete.",o.style.color="#aeb6c5",o.style.font='12px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',o.style.opacity="0.9",this.introEl=o;const s=document.createElement("div");s.style.display="flex",s.style.flexDirection="column",s.style.flex="1 1 60%",s.style.minHeight="200px",s.style.minWidth="0",s.style.position="relative";const I=document.createElement("env-monaco-editor");I.style.position="absolute",I.style.inset="0",I.setAttribute("language","javascript"),this._initializedValue||(I.value=aYg,this._initializedValue=!0);const n=document.createElement("div");n.style.flex="0 0 10px",n.style.height="10px",n.style.cursor="row-resize",n.style.background="linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03))",n.style.border="1px solid #1f2530",n.style.borderRadius="8px",n.style.margin="6px 0",n.style.position="relative",n.style.zIndex="2",n.addEventListener("pointerdown",l=>this._onSplitterPointerDown(l));const r=document.createElement("div");r.style.display="flex",r.style.flexDirection="column",r.style.flex="0 0 180px",r.style.minHeight="120px",r.style.maxHeight="70vh",r.style.gap="6px",r.style.position="relative";const C=document.createElement("div");C.style.flex="1 1 auto",C.style.background="#0e1117",C.style.border="1px solid #1f2530",C.style.borderRadius="8px",C.style.padding="8px",C.style.overflowY="auto",C.style.overflowX="hidden",C.style.font='12px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',C.style.color="#d1d5db";const a=document.createElement("div");a.style.display="flex",a.style.alignItems="center",a.style.gap="8px";const Q=document.createElement("div");Q.style.flex="1",Q.style.color="#9ca3af",Q.style.font='12px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',Q.textContent="Idle";const c=document.createElement("button");c.className="fw-btn",c.textContent="Clear output",c.addEventListener("click",()=>{C.innerHTML=""}),a.appendChild(Q),a.appendChild(c),g.appendChild(o),s.appendChild(I),g.appendChild(s),g.appendChild(n),r.appendChild(a),r.appendChild(C),g.appendChild(r),A.content.appendChild(g),this.window=A,this.root=A.root,this.editorEl=I,this.editorWrap=s,this.outputEl=C,this.consoleWrap=r,this.splitterEl=n,this.statusEl=Q;try{this.root.style.display="none"}catch{}requestAnimationFrame(()=>this._applySplitHeights())}async _runCode(){if(this._isRunning){this._setStatus("Already running");return}const A=this.editorEl?.value||"";if(!A.trim()){this._setStatus("Nothing to run");return}this._appendOutput(`>>> Running at ${new Date().toLocaleTimeString()}`),this._setStatus("Running..."),this._isRunning=!0;const e=B(()=>{const t=window.viewer??this.viewer??null,g=window.env??t,o=window.monaco;return new Function("viewer","env","monaco",`"use strict";
15170
15174
  ${A}`)(t,g,o)},"exec");try{const t=await this._withConsoleCapture(async()=>{const g=e();return g&&typeof g.then=="function"?{value:await g,async:!0}:{value:g,async:!1}});this._appendOutput(this._stringify(t.value)),t.async?this._setStatus("Completed (async)"):this._setStatus("Completed")}catch(t){const g=t?.stack||t?.message||String(t);this._appendOutput(g,!0),this._setStatus("Error");try{console.error("[ScriptRunner]",t)}catch{}}finally{this._isRunning=!1}}async _withConsoleCapture(A){const e=window.console;if(!e)return A();const t=["log","info","warn","error","debug","table","trace"],g=new Map;for(const o of t){const s=e[o];if(typeof s=="function"){g.set(o,s);try{e[o]=(...I)=>{try{this._appendConsoleCall(o,I)}catch{}return s.apply(e,I)}}catch{}}}try{return await A()}finally{for(const[o,s]of g.entries())try{e[o]=s}catch{}}}_appendConsoleCall(A,e){if(!this.outputEl)return;const t=this._createOutputLine(A==="error"?!0:A);if(t.style.display="flex",t.style.flexWrap="wrap",t.style.alignItems="baseline",t.style.columnGap="6px",t.style.rowGap="2px",t.style.minWidth="0",t.style.width="100%",A!=="log"){const g=document.createElement("span");g.textContent=`${A}:`,g.style.color=this._outputColor(A),g.style.fontWeight="700",t.appendChild(g)}if(!e.length){const g=document.createElement("span");g.textContent=A==="log"?"":" ",t.appendChild(g)}for(const g of e)if(this._isExpandableConsoleValue(g))t.appendChild(this._createConsoleTreeNode(g,"",[]));else{const o=document.createElement("span");o.textContent=this._formatConsoleLeafValue(g),o.style.whiteSpace="pre-wrap",o.style.overflowWrap="anywhere",o.style.minWidth="0",t.appendChild(o)}this.outputEl.appendChild(t),this.outputEl.scrollTop=this.outputEl.scrollHeight}_stringifyConsoleArg(A){if(typeof A=="string")return A;if(A instanceof Error)return A.stack||A.message||String(A);if(typeof A=="function")return A.toString();if(A===void 0)return"undefined";if(A===null)return"null";if(typeof A=="symbol")return A.toString();if(typeof A=="bigint")return`${A.toString()}n`;try{const e=new WeakSet,t=JSON.stringify(A,(g,o)=>{if(typeof o=="bigint")return`${o.toString()}n`;if(typeof o=="function"||typeof o=="symbol")return o.toString();if(o&&typeof o=="object"){if(e.has(o))return"[Circular]";e.add(o)}return o},2);return typeof t=="string"?t:String(A)}catch{try{return String(A)}catch{return"[unprintable]"}}}_isInspectableConsoleValue(A){return A!==null&&(typeof A=="object"||typeof A=="function")}_isExpandableConsoleValue(A){return this._isInspectableConsoleValue(A)&&this._hasExpandableConsoleChildren(A)}_hasExpandableConsoleChildren(A){if(!this._isInspectableConsoleValue(A))return!1;let e=[];try{e=Reflect.ownKeys(A)}catch{return!1}for(const t of e){let g=null;try{g=Object.getOwnPropertyDescriptor(A,t)}catch{continue}if(g&&("get"in g||"set"in g)&&!("value"in g)){if(typeof g.get=="function")return!0;continue}const o=g&&"value"in g?g.value:void 0;if(this._isInspectableConsoleValue(o))return!0}return!1}_createConsoleTreeNode(A,e="",t=[]){if(!this._isInspectableConsoleValue(A)){const a=document.createElement("span");return a.textContent=e?`${e}: ${this._stringifyConsoleArg(A)}`:this._stringifyConsoleArg(A),a}if(t.includes(A)){const a=document.createElement("span");return a.textContent=e?`${e}: [Circular]`:"[Circular]",a.style.color="#fbbf24",a}const g=document.createElement("details");g.style.display="block",g.style.flex="1 1 100%",g.style.minWidth="0",g.style.width="100%",g.style.maxWidth="100%",g.style.verticalAlign="top",g.style.borderLeft="1px solid #263041",g.style.marginLeft="0",g.style.paddingLeft="6px",g.style.boxSizing="border-box",g.style.overflow="hidden";const o=document.createElement("summary");o.style.cursor="pointer",o.style.listStyle="none",o.style.userSelect="none",o.style.display="grid",o.style.gridTemplateColumns="14px minmax(0, auto) minmax(0, 1fr)",o.style.gap="4px",o.style.alignItems="baseline",o.style.whiteSpace="normal",o.style.overflow="visible",o.style.color="#d1d5db",o.style.minWidth="0";const s=document.createElement("span");s.textContent=">",s.style.display="inline-block",s.style.width="12px",s.style.color="#9ca3af",s.style.transition="transform .12s ease",o.appendChild(s);const I=document.createElement("span");I.textContent=e?`${e}: `:"",I.style.color="#e5e7eb",I.style.fontWeight=e?"700":"400",o.appendChild(I);const n=document.createElement("span");n.textContent=this._consoleValuePreview(A),n.style.color="#aeb6c5",n.style.minWidth="0",n.style.overflowWrap="anywhere",o.appendChild(n);const r=document.createElement("div");r.style.display="block",r.style.marginLeft="14px",r.style.paddingTop="2px",r.style.minWidth="0",r.style.maxWidth="100%",r.style.boxSizing="border-box";let C=!1;return g.addEventListener("toggle",()=>{s.textContent=g.open?"v":">",!(!g.open||C)&&(C=!0,this._loadConsoleTreeChildren(r,A,t.concat(A)))}),g.append(o,r),g}_loadConsoleTreeChildren(A,e,t){let g=[];try{g=Reflect.ownKeys(e)}catch(s){A.appendChild(this._createConsoleTreeMessage(`Unable to inspect: ${s?.message||String(s)}`,!0));return}if(!g.length){A.appendChild(this._createConsoleTreeMessage("(no own properties)"));return}const o=g.slice(0,BPA);for(const s of o)A.appendChild(this._createConsolePropertyRow(e,s,t));g.length>o.length&&A.appendChild(this._createConsoleTreeMessage(`... ${g.length-o.length} more properties not shown`))}_createConsolePropertyRow(A,e,t){const g=typeof e=="symbol"?e.toString():String(e);let o=null;try{o=Object.getOwnPropertyDescriptor(A,e)}catch{}if(o&&("get"in o||"set"in o)&&!("value"in o))return this._createConsoleAccessorRow(A,e,g,o,t);let s;try{s=o&&"value"in o?o.value:A[e]}catch(I){return this._createConsoleTreeMessage(`${g}: [Thrown: ${I?.message||String(I)}]`,!0)}return this._isExpandableConsoleValue(s)?this._createConsoleTreeNode(s,g,t):this._createConsolePropertyValueRow(g,s)}_createConsoleAccessorRow(A,e,t,g,o){const s=document.createElement("div");s.style.display="flex",s.style.flexWrap="wrap",s.style.alignItems="baseline",s.style.gap="8px",s.style.padding="1px 0",s.style.minWidth="0",s.style.maxWidth="100%",s.style.boxSizing="border-box";const I=document.createElement("span");I.textContent=`${t}:`,I.style.color="#e5e7eb",I.style.fontWeight="700",I.style.minWidth="0",I.style.overflowWrap="anywhere";const n=document.createElement("span");if(n.textContent=g.get&&g.set?"[Getter/Setter]":g.get?"[Getter]":"[Setter]",n.style.color="#9ca3af",n.style.minWidth="0",s.append(I,n),typeof g.get=="function"){const r=document.createElement("button");r.type="button",r.textContent="get",r.className="fw-btn",r.style.padding="1px 6px",r.addEventListener("click",C=>{try{C.preventDefault(),C.stopPropagation()}catch{}try{const a=g.get.call(A);s.replaceWith(this._isExpandableConsoleValue(a)?this._createConsoleTreeNode(a,t,o):this._createConsolePropertyValueRow(t,a))}catch(a){s.replaceWith(this._createConsoleTreeMessage(`${t}: [Thrown: ${a?.message||String(a)}]`,!0))}}),s.appendChild(r)}return s}_createConsolePropertyValueRow(A,e){const t=document.createElement("div");t.style.display="grid",t.style.gridTemplateColumns="minmax(0, 32%) minmax(0, 1fr)",t.style.gap="6px",t.style.alignItems="baseline",t.style.minWidth="0",t.style.maxWidth="100%",t.style.boxSizing="border-box",t.style.padding="1px 0";const g=document.createElement("span");g.textContent=A,g.style.color="#e5e7eb",g.style.fontWeight="700",g.style.minWidth="0",g.style.overflowWrap="anywhere";const o=document.createElement("span");return o.textContent=this._formatConsoleLeafValue(e),o.style.color=this._consolePrimitiveColor(e),o.style.whiteSpace="pre-wrap",o.style.overflowWrap="anywhere",o.style.minWidth="0",t.append(g,o),t}_createConsoleTreeMessage(A,e=!1){const t=document.createElement("div");return t.textContent=A,t.style.color=e?"#fca5a5":"#9ca3af",t.style.fontStyle="italic",t.style.padding="1px 0",t}_consoleValuePreview(A){if(typeof A=="function")return`[Function ${A.name||"anonymous"}]`;if(A instanceof Error)return`${A.name||"Error"}: ${A.message||""}`;if(A instanceof Date)return`Date ${Number.isNaN(A.getTime())?"Invalid":A.toISOString()}`;if(Array.isArray(A))return`Array(${A.length})`;const e=A?.constructor?.name;let t="";try{const g=Object.keys(A).slice(0,6);t=g.length?` { ${g.join(", ")}${Object.keys(A).length>g.length?", ...":""} }`:""}catch{}return`${e&&e!=="Object"?e:"Object"}${t}`}_formatConsoleLeafValue(A){if(!this._isInspectableConsoleValue(A))return this._stringifyConsoleArg(A);if(A instanceof Error)return A.stack||`${A.name||"Error"}: ${A.message||""}`;if(A instanceof Date)return Number.isNaN(A.getTime())?"Invalid Date":A.toISOString();if(Array.isArray(A))return`[${A.map(o=>this._formatConsoleLeafValue(o)).join(", ")}]`;if(typeof A=="function")return A.toString();let e=[];try{e=Reflect.ownKeys(A)}catch{return this._consoleValuePreview(A)}const t=[];for(const o of e.slice(0,BPA)){const s=typeof o=="symbol"?o.toString():String(o);let I=null;try{I=Object.getOwnPropertyDescriptor(A,o)}catch{}if(I&&("get"in I||"set"in I)&&!("value"in I)){t.push(`${s}: ${I.get&&I.set?"[Getter/Setter]":I.get?"[Getter]":"[Setter]"}`);continue}!I||!("value"in I)||t.push(`${s}: ${this._stringifyConsoleArg(I.value)}`)}e.length>BPA&&t.push(`... ${e.length-BPA} more`);const g=A?.constructor?.name;return`${g&&g!=="Object"?`${g} `:""}{ ${t.join(", ")} }`}_consolePrimitiveColor(A){return typeof A=="string"?"#86efac":typeof A=="number"||typeof A=="bigint"?"#fcd34d":typeof A=="boolean"?"#93c5fd":A==null?"#9ca3af":typeof A=="symbol"?"#c4b5fd":"#d1d5db"}_appendOutput(A,e=!1){if(!this.outputEl)return;const t=this._createOutputLine(e);t.textContent=A,this.outputEl.appendChild(t),this.outputEl.scrollTop=this.outputEl.scrollHeight}_createOutputLine(A=!1){const e=document.createElement("div");return e.style.whiteSpace="pre-wrap",e.style.overflowWrap="anywhere",e.style.minWidth="0",e.style.maxWidth="100%",e.style.boxSizing="border-box",e.style.color=this._outputColor(A),e.style.margin="1px 0",e}_outputColor(A){return A===!0||A==="error"?"#fca5a5":A==="warn"?"#fbbf24":A==="info"?"#93c5fd":A==="debug"?"#9ca3af":"#d1d5db"}_setStatus(A){this.statusEl&&(this.statusEl.textContent=A)}_stringify(A){try{if(typeof A=="string")return A;if(typeof A=="function")return A.toString();if(A===void 0)return"undefined";if(A===null)return"null";const e=JSON.stringify(A,null,2);return typeof e=="string"?e:String(A)}catch{try{return String(A)}catch{return"[unprintable]"}}}_onSplitterPointerDown(A){if(A.button!==0)return;const e=A.clientY,t=this.consoleWrap?.getBoundingClientRect?.().height||this._consoleHeight,g=B(s=>{const I=s.clientY-e;this._setConsoleHeight(t-I);try{s.preventDefault()}catch{}},"onMove"),o=B(s=>{window.removeEventListener("pointermove",g,!0),window.removeEventListener("pointerup",o,!0);try{this._consoleHeight=this.consoleWrap?.getBoundingClientRect?.().height||this._consoleHeight}catch{}},"onUp");window.addEventListener("pointermove",g,!0),window.addEventListener("pointerup",o,!0);try{A.preventDefault()}catch{}}_setConsoleHeight(A){if(!this.contentRoot||!this.consoleWrap||!this.editorWrap)return;const e=120,t=180,g=this.contentRoot.getBoundingClientRect?.()?.height||0,o=this.introEl?.offsetHeight||0,s=this.splitterEl?.offsetHeight||10,I=Math.max(0,g-o-s-8);if(I<=0)return;const n=Math.max(e,I-t),r=Math.min(Math.max(A,e),n),C=Math.max(t,I-r);this._consoleHeight=r,this.consoleWrap.style.flexBasis=`${r}px`,this.consoleWrap.style.height=`${r}px`,this.editorWrap.style.flexBasis=`${C}px`,this.editorWrap.style.height=`${C}px`;try{this.editorEl?.editor?.layout?.()}catch{}}_applySplitHeights(){this._setConsoleHeight(this._consoleHeight);try{this.editorEl?.editor?.layout?.()}catch{}}},E(pyA,"Nve2"),pyA);B(wFi,"ScriptRunnerPanel");let QYg=wFi;function dFi(i){if(!i)return null;i[Zre]||(i[Zre]=new QYg(i));const A=i[Zre];return{label:"</>",title:"Open Script Runner",onClick:B(()=>A.toggle(),"onClick")}}E(dFi,"cKi");B(dFi,"createScriptRunnerButton");const EYg=`//Examples:
15171
15175
  x = 10 + 6;