@solid-labs/fab-one-widget 0.1.9 → 0.1.10

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.
@@ -1,16 +1,16 @@
1
1
  import { jsxs as L, jsx as i, Fragment as Te } from "react/jsx-runtime";
2
- import { createContext as Yn, Component as Xn, useCallback as oe, useMemo as j, useState as E, memo as Gn, useEffect as re, useRef as le, forwardRef as Zn, createElement as Jt } from "react";
3
- import { useFrame as rn, useThree as sn, Canvas as Kn } from "@react-three/fiber";
4
- import { Html as Ye, Line as de, OrbitControls as ln } from "@react-three/drei";
2
+ import { createContext as Xn, Component as Gn, useCallback as re, useMemo as j, useState as E, memo as Zn, useEffect as ne, useRef as le, forwardRef as Kn, createElement as Qt } from "react";
3
+ import { useFrame as sn, useThree as ln, Canvas as Un } from "@react-three/fiber";
4
+ import { Html as Ye, Line as de, OrbitControls as an } from "@react-three/drei";
5
5
  import * as O from "three";
6
- import { Plane as dt, Vector3 as C, Box3 as an, Line3 as cn, Raycaster as Un } from "three";
7
- import { create as Jn } from "zustand";
8
- import { OBJLoader as dn } from "three/examples/jsm/loaders/OBJLoader.js";
9
- import { STLLoader as Qn } from "three/examples/jsm/loaders/STLLoader.js";
6
+ import { Plane as dt, Vector3 as C, Box3 as cn, Line3 as dn, Raycaster as Jn } from "three";
7
+ import { create as Qn } from "zustand";
8
+ import { OBJLoader as fn } from "three/examples/jsm/loaders/OBJLoader.js";
9
+ import { STLLoader as qn } from "three/examples/jsm/loaders/STLLoader.js";
10
10
  import { MeshBVH as ft } from "three-mesh-bvh";
11
- let pr, lt, nr, wn;
11
+ let hr, lt, or, Sn;
12
12
  let __tla = (async () => {
13
- const qn = {
13
+ const eo = {
14
14
  showDragDrop: true,
15
15
  showStartOver: true,
16
16
  showDebug: true,
@@ -19,7 +19,7 @@ let __tla = (async () => {
19
19
  showNavigation: true,
20
20
  showToolbar: false,
21
21
  showSaveButton: true
22
- }, eo = {
22
+ }, to = {
23
23
  showDragDrop: false,
24
24
  showStartOver: false,
25
25
  showDebug: false,
@@ -28,7 +28,7 @@ let __tla = (async () => {
28
28
  showNavigation: false,
29
29
  showToolbar: false,
30
30
  showSaveButton: false
31
- }, to = Yn(qn), It = Jn((e, r) => ({
31
+ }, no = Xn(eo), It = Qn((e, r) => ({
32
32
  landmarkPoints: [],
33
33
  isAligned: false,
34
34
  isCut: false,
@@ -58,14 +58,19 @@ let __tla = (async () => {
58
58
  setCut: (t) => e({
59
59
  isCut: t
60
60
  }),
61
- isSelectionComplete: () => r().landmarkPoints.length === 3
62
- })), no = 0.45, ut = 3, Pt = 1e-3, at = 25.4, oo = [
61
+ isSelectionComplete: () => r().landmarkPoints.length === 3,
62
+ reset: () => e({
63
+ landmarkPoints: [],
64
+ isAligned: false,
65
+ isCut: false
66
+ })
67
+ })), oo = 0.45, ut = 3, Pt = 1e-3, at = 25.4, ro = [
63
68
  0.25,
64
69
  -0.25,
65
70
  0.5,
66
71
  -0.5
67
72
  ];
68
- function ro(e) {
73
+ function io(e) {
69
74
  var _a;
70
75
  const r = e.match(/^v\s+\S+\s+\S+\s+\S+(.*)$/m);
71
76
  if (!r || !((_a = r[1]) == null ? void 0 : _a.trim().includes(" "))) return null;
@@ -85,7 +90,7 @@ let __tla = (async () => {
85
90
  colors: new Float32Array(l)
86
91
  } : null;
87
92
  }
88
- function io(e, r, t, o) {
93
+ function so(e, r, t, o) {
89
94
  const l = e.getAttribute("position"), s = l.count, c = new Float32Array(s * 3), a = r.length / 3;
90
95
  let n = 1 / 0, h = 1 / 0, d = 1 / 0, u = -1 / 0, p = -1 / 0, g = -1 / 0;
91
96
  for (let k = 0; k < a; k++) {
@@ -108,8 +113,8 @@ let __tla = (async () => {
108
113
  if (he < 0 || he >= z || me < 0 || me >= z || ue < 0 || ue >= z) continue;
109
114
  const H = A.get(he * z * z + me * z + ue);
110
115
  if (H) for (const q of H) {
111
- const xe = r[q * 3] * o - M, Ce = r[q * 3 + 1] * o - f, we = r[q * 3 + 2] * o - m, ne = (B - xe) ** 2 + ($ - Ce) ** 2 + (N - we) ** 2;
112
- ne < fe && (fe = ne, ie = q);
116
+ const xe = r[q * 3] * o - M, Ce = r[q * 3 + 1] * o - f, we = r[q * 3 + 2] * o - m, oe = (B - xe) ** 2 + ($ - Ce) ** 2 + (N - we) ** 2;
117
+ oe < fe && (fe = oe, ie = q);
113
118
  }
114
119
  }
115
120
  if (fe < 1 / 0) break;
@@ -118,19 +123,19 @@ let __tla = (async () => {
118
123
  }
119
124
  e.setAttribute("color", new O.Float32BufferAttribute(c, 3));
120
125
  }
121
- const Qt = {
126
+ const qt = {
122
127
  debug: 0,
123
128
  info: 1,
124
129
  warn: 2,
125
130
  error: 3
126
131
  };
127
- let fn = "warn", un = null;
132
+ let un = "warn", pn = null;
128
133
  const ce = {
129
134
  setLevel(e) {
130
- fn = e;
135
+ un = e;
131
136
  },
132
137
  setHandler(e) {
133
- un = e;
138
+ pn = e;
134
139
  },
135
140
  debug(e, r, t) {
136
141
  st("debug", e, r, t);
@@ -146,7 +151,7 @@ let __tla = (async () => {
146
151
  }
147
152
  };
148
153
  function st(e, r, t, o) {
149
- if (Qt[e] < Qt[fn]) return;
154
+ if (qt[e] < qt[un]) return;
150
155
  const l = `[${r}]`, s = o !== void 0 ? [
151
156
  l,
152
157
  t,
@@ -169,7 +174,7 @@ let __tla = (async () => {
169
174
  console.error(...s);
170
175
  break;
171
176
  }
172
- un == null ? void 0 : un(e, r, t, o);
177
+ pn == null ? void 0 : pn(e, r, t, o);
173
178
  }
174
179
  function ct(e) {
175
180
  const r = e.getAttribute("position"), t = new Float32Array(r.array), o = e.getIndex();
@@ -184,15 +189,15 @@ let __tla = (async () => {
184
189
  indices: s
185
190
  };
186
191
  }
187
- function pn(e, r) {
192
+ function hn(e, r) {
188
193
  const t = new O.BufferGeometry();
189
194
  return t.setAttribute("position", new O.Float32BufferAttribute(e, 3)), t.setIndex(new O.BufferAttribute(r, 1)), t.computeVertexNormals(), t;
190
195
  }
191
- async function so(e, r, t) {
196
+ async function lo(e, r, t) {
192
197
  try {
193
- const o = ro(e);
198
+ const o = io(e);
194
199
  t == null ? void 0 : t("Parsing mesh...");
195
- const s = new dn().parse(e);
200
+ const s = new fn().parse(e);
196
201
  let c = null;
197
202
  if (s.traverse((x) => {
198
203
  x.isMesh && !c && (c = x.geometry);
@@ -206,10 +211,10 @@ let __tla = (async () => {
206
211
  const d = r.preprocess_mesh(a, n, 10, 1e-4, 500), u = d.positions(), p = d.indices(), g = d.unit_converted(), M = d.detected_unit(), f = d.log();
207
212
  if (ce.debug("wasm", "preprocess result", f), u.length === 0) return null;
208
213
  t == null ? void 0 : t("Building geometry...");
209
- const m = pn(u, p);
214
+ const m = hn(u, p);
210
215
  if (o) {
211
216
  const x = g ? 1e3 : 1;
212
- io(m, o.positions, o.colors, x);
217
+ so(m, o.positions, o.colors, x);
213
218
  }
214
219
  return {
215
220
  geometry: m,
@@ -221,15 +226,15 @@ let __tla = (async () => {
221
226
  return ce.error("wasm", "Processing failed", o), null;
222
227
  }
223
228
  }
224
- function lo(e) {
225
- const t = new dn().parse(e);
229
+ function ao(e) {
230
+ const t = new fn().parse(e);
226
231
  let o = null;
227
232
  return t.traverse((l) => {
228
233
  l.isMesh && !o && (o = l.geometry);
229
234
  }), o;
230
235
  }
231
236
  async function Ft(e) {
232
- const r = await e.arrayBuffer(), l = new Qn().parse(r).getAttribute("position");
237
+ const r = await e.arrayBuffer(), l = new qn().parse(r).getAttribute("position");
233
238
  if (!l || l.count === 0) throw new Error("Empty STL geometry");
234
239
  const s = [];
235
240
  for (let c = 0; c < l.count; c++) s.push(`v ${l.getX(c)} ${l.getY(c)} ${l.getZ(c)}`);
@@ -237,11 +242,11 @@ let __tla = (async () => {
237
242
  return s.join(`
238
243
  `);
239
244
  }
240
- function ao(e, r) {
245
+ function co(e, r) {
241
246
  const t = 1 / r;
242
247
  return `${Math.round(e.x * t)}_${Math.round(e.y * t)}_${Math.round(e.z * t)}`;
243
248
  }
244
- function co(e, r) {
249
+ function fo(e, r) {
245
250
  if (!e.length) return [];
246
251
  const t = [];
247
252
  for (const o of e) (t.length === 0 || t[t.length - 1].distanceTo(o) > r) && t.push(o.clone());
@@ -252,10 +257,10 @@ let __tla = (async () => {
252
257
  for (let t = 0; t < e.length - 1; t++) r += e[t].distanceTo(e[t + 1]);
253
258
  return r;
254
259
  }
255
- function hn(e, r = 1e-3, t = false) {
260
+ function gn(e, r = 1e-3, t = false) {
256
261
  if (!e.length) return [];
257
262
  const o = /* @__PURE__ */ new Map(), l = (u) => {
258
- const p = ao(u, r);
263
+ const p = co(u, r);
259
264
  let g = o.get(p);
260
265
  return g || (g = u.clone(), o.set(p, g)), g;
261
266
  }, s = e.map((u) => ({
@@ -280,7 +285,7 @@ let __tla = (async () => {
280
285
  s.splice(f, 1), g = true;
281
286
  }
282
287
  }
283
- const M = co(p, r);
288
+ const M = fo(p, r);
284
289
  M.length > 1 && c.push(M);
285
290
  }
286
291
  if (!c.length) return [];
@@ -301,8 +306,8 @@ let __tla = (async () => {
301
306
  }
302
307
  return h;
303
308
  }
304
- function qt(e, r, t, o = false) {
305
- const l = new dt(new C(0, 1, 0), -t), s = [], c = new an();
309
+ function en(e, r, t, o = false) {
310
+ const l = new dt(new C(0, 1, 0), -t), s = [], c = new cn();
306
311
  c.setFromBufferAttribute(r.getAttribute("position"));
307
312
  const a = {
308
313
  linePoints: [],
@@ -310,7 +315,7 @@ let __tla = (async () => {
310
315
  rightmostPoint: new C(0, t, 0)
311
316
  };
312
317
  if (!l.intersectsBox(c)) return a;
313
- const n = new cn(), h = new C();
318
+ const n = new dn(), h = new C();
314
319
  e.shapecast({
315
320
  intersectsBounds: (f) => l.intersectsBox(f),
316
321
  intersectsTriangle: (f) => {
@@ -321,7 +326,7 @@ let __tla = (async () => {
321
326
  });
322
327
  }
323
328
  });
324
- const d = hn(s, Pt, o);
329
+ const d = gn(s, Pt, o);
325
330
  if (d.length < 2) return a;
326
331
  const u = Ze(d);
327
332
  let p = -1 / 0, g = new C(0, t, 0);
@@ -335,21 +340,21 @@ let __tla = (async () => {
335
340
  };
336
341
  }
337
342
  function Ne(e, r, t, o = false) {
338
- const l = qt(e, r, t, o);
343
+ const l = en(e, r, t, o);
339
344
  if (l.isClosed && l.linePoints.length >= 3) return l;
340
345
  ce.debug("slice", `y=${t.toFixed(2)} failed (pts=${l.linePoints.length}, closed=${l.isClosed}), retrying...`);
341
346
  let s = l;
342
- for (const c of oo) {
343
- const a = qt(e, r, t + c, o);
347
+ for (const c of ro) {
348
+ const a = en(e, r, t + c, o);
344
349
  if (a.isClosed && a.linePoints.length >= 3) return ce.debug("slice", `y=${t.toFixed(2)} recovered with offset ${c > 0 ? "+" : ""}${c}mm (pts=${a.linePoints.length}, len=${a.lineLength.toFixed(1)}mm)`), a;
345
350
  a.linePoints.length > s.linePoints.length && (s = a);
346
351
  }
347
352
  return ce.warn("slice", `y=${t.toFixed(2)} all retries exhausted (pts=${s.linePoints.length}, closed=${s.isClosed})`), s;
348
353
  }
349
- function fo(e, r, t, o) {
350
- const l = new dt().setFromNormalAndCoplanarPoint(o.clone().normalize(), t), s = new an();
354
+ function uo(e, r, t, o) {
355
+ const l = new dt().setFromNormalAndCoplanarPoint(o.clone().normalize(), t), s = new cn();
351
356
  if (s.setFromBufferAttribute(r.getAttribute("position")), !l.intersectsBox(s)) return 0;
352
- const c = [], a = new cn(), n = new C();
357
+ const c = [], a = new dn(), n = new C();
353
358
  e.shapecast({
354
359
  intersectsBounds: (d) => l.intersectsBox(d),
355
360
  intersectsTriangle: (d) => {
@@ -360,15 +365,15 @@ let __tla = (async () => {
360
365
  });
361
366
  }
362
367
  });
363
- const h = hn(c, Pt);
368
+ const h = gn(c, Pt);
364
369
  return Ze(h);
365
370
  }
366
- function gn(e) {
371
+ function mn(e) {
367
372
  return new ft(e, {
368
373
  maxLeafTris: ut
369
374
  });
370
375
  }
371
- function uo(e, r, t, o) {
376
+ function po(e, r, t, o) {
372
377
  const l = e.getIndex(), s = l ? l.count / 3 : 0;
373
378
  if (s < 10) return {
374
379
  valid: false,
@@ -420,7 +425,7 @@ let __tla = (async () => {
420
425
  };
421
426
  }
422
427
  const Fe = "pipeline";
423
- function po(e, r, t, o) {
428
+ function ho(e, r, t, o) {
424
429
  var _a, _b, _c, _d;
425
430
  const l = e.geometry.clone(), s = r.map((a) => ({
426
431
  ...a
@@ -442,8 +447,8 @@ let __tla = (async () => {
442
447
  }
443
448
  const we = n[0].clone();
444
449
  a.translate(-we.x, -we.y, -we.z), n = n.map((X) => new C(X.x - we.x, X.y - we.y, X.z - we.z)), a.computeVertexNormals(), a.computeBoundingBox();
445
- const ne = new C(n[0].x, n[0].y, n[0].z);
446
- n.push(ne), o.addLandmarkPoint({
450
+ const oe = new C(n[0].x, n[0].y, n[0].z);
451
+ n.push(oe), o.addLandmarkPoint({
447
452
  faceIndex: -1,
448
453
  vertexIndices: [
449
454
  0,
@@ -451,9 +456,9 @@ let __tla = (async () => {
451
456
  2
452
457
  ],
453
458
  position: {
454
- x: ne.x,
455
- y: ne.y,
456
- z: ne.z
459
+ x: oe.x,
460
+ y: oe.y,
461
+ z: oe.z
457
462
  },
458
463
  barycentricCoords: {
459
464
  u: 0.33,
@@ -521,9 +526,9 @@ let __tla = (async () => {
521
526
  const q = (m ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(z, p, new Float32Array(ae), 10);
522
527
  ce.debug(Fe, "Batch (subdivision)", q.details());
523
528
  const xe = q.all_loop_points(), Ce = q.offsets(), we = q.circumferences();
524
- for (let ne = 0; ne < Ce.length - 1; ne++) {
525
- const V = Ce[ne], X = Ce[ne + 1];
526
- if (X <= V || we[ne] <= 0) continue;
529
+ for (let oe = 0; oe < Ce.length - 1; oe++) {
530
+ const V = Ce[oe], X = Ce[oe + 1];
531
+ if (X <= V || we[oe] <= 0) continue;
527
532
  const Le = (X - V) / 3;
528
533
  if (Le < 3) continue;
529
534
  let Pe = 0, Xe = 0, se = 0;
@@ -536,7 +541,7 @@ let __tla = (async () => {
536
541
  const H = c.refine_alignment(new Float32Array(fe), z, new Float32Array(D), new Float32Array(y));
537
542
  ce.info(Fe, "Refinement complete", H.details()), z = H.positions(), y = H.mpt(), D = H.origin();
538
543
  }
539
- const ie = a.getAttribute("color"), J = pn(z, p);
544
+ const ie = a.getAttribute("color"), J = hn(z, p);
540
545
  ie && J.setAttribute("color", ie), a.dispose(), a = J, e.geometry = a, a.computeVertexNormals(), a.computeBoundingBox(), n[0] = new C(D[0], D[1], D[2]), n[1] = new C(y[0], y[1], y[2]), o.onStatus("Setting blue point...");
541
546
  const Y = new C(n[0].x, n[0].y, n[0].z);
542
547
  n.push(Y), o.addLandmarkPoint({
@@ -566,8 +571,8 @@ let __tla = (async () => {
566
571
  {
567
572
  const H = ct(a), q = n[1].y, xe = n[0].y;
568
573
  let Ce = 1 / 0, we = -1 / 0;
569
- const ne = H.positions;
570
- for (let se = 1; se < ne.length; se += 3) ne[se] < Ce && (Ce = ne[se]), ne[se] > we && (we = ne[se]);
574
+ const oe = H.positions;
575
+ for (let se = 1; se < oe.length; se += 3) oe[se] < Ce && (Ce = oe[se]), oe[se] > we && (we = oe[se]);
571
576
  const V = 25.4, X = [];
572
577
  X.push(q);
573
578
  for (let se = 1; se <= 2; se++) {
@@ -589,13 +594,13 @@ let __tla = (async () => {
589
594
  (_d = o.setWasmSlices) == null ? void 0 : _d.call(o, Xe);
590
595
  }
591
596
  o.onStatus("Validating results...");
592
- const he = n[1].y, me = n[0].y, ue = uo(a, he, me, t);
597
+ const he = n[1].y, me = n[0].y, ue = po(a, he, me, t);
593
598
  ue.valid || ce.warn(Fe, `Validation: ${ue.reason}`), o.setClippedReferenceGeometry ? (l.computeVertexNormals(), o.setClippedReferenceGeometry(l)) : l.dispose();
594
599
  } catch (a) {
595
600
  ce.error(Fe, "Processing failed", a), o.setError(a instanceof Error ? a.message : "Failed to process mesh."), l.dispose();
596
601
  }
597
602
  }
598
- class ho extends Xn {
603
+ class go extends Gn {
599
604
  constructor() {
600
605
  super(...arguments), this.state = {
601
606
  error: null
@@ -662,7 +667,7 @@ let __tla = (async () => {
662
667
  }) : this.props.children;
663
668
  }
664
669
  }
665
- const go = ({ message: e, onDismiss: r }) => L("div", {
670
+ const mo = ({ message: e, onDismiss: r }) => L("div", {
666
671
  style: {
667
672
  position: "absolute",
668
673
  top: 16,
@@ -715,7 +720,7 @@ let __tla = (async () => {
715
720
  children: "x"
716
721
  })
717
722
  ]
718
- }), en = ({ message: e }) => L("div", {
723
+ }), tn = ({ message: e }) => L("div", {
719
724
  style: {
720
725
  position: "absolute",
721
726
  top: 0,
@@ -753,7 +758,7 @@ let __tla = (async () => {
753
758
  })
754
759
  ]
755
760
  });
756
- function mo(e, r, t, o) {
761
+ function xo(e, r, t, o) {
757
762
  const l = new C().subVectors(t, r), s = new C().subVectors(o, r), c = new C().subVectors(e, r), a = l.dot(l), n = l.dot(s), h = l.dot(c), d = s.dot(s), u = s.dot(c), p = 1 / (a * d - n * n), g = (d * h - n * u) * p, M = (a * u - n * h) * p;
758
763
  return {
759
764
  u: 1 - g - M,
@@ -761,8 +766,8 @@ let __tla = (async () => {
761
766
  w: M
762
767
  };
763
768
  }
764
- const xo = ({ mesh: e, maxPoints: r = 2, meshColor: t = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: l = false, doubleShellTransparency: s = false }) => {
765
- const { addLandmarkPoint: c, landmarkPoints: a } = It(), n = oe((g) => {
769
+ const yo = ({ mesh: e, maxPoints: r = 2, meshColor: t = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: l = false, doubleShellTransparency: s = false }) => {
770
+ const { addLandmarkPoint: c, landmarkPoints: a } = It(), n = re((g) => {
766
771
  if (a.length >= r) return;
767
772
  g.stopPropagation();
768
773
  const M = g.intersections[0], f = M == null ? void 0 : M.faceIndex;
@@ -780,7 +785,7 @@ let __tla = (async () => {
780
785
  ];
781
786
  const I = m.getAttribute("position"), F = new C().fromBufferAttribute(I, S[0]), P = new C().fromBufferAttribute(I, S[1]), b = new C().fromBufferAttribute(I, S[2]);
782
787
  F.applyMatrix4(e.matrixWorld), P.applyMatrix4(e.matrixWorld), b.applyMatrix4(e.matrixWorld);
783
- const z = M.point, y = mo(z, F, P, b), D = {
788
+ const z = M.point, y = xo(z, F, P, b), D = {
784
789
  faceIndex: f,
785
790
  vertexIndices: S,
786
791
  position: {
@@ -821,7 +826,7 @@ let __tla = (async () => {
821
826
  material: p,
822
827
  renderOrder: s ? 0 : void 0
823
828
  });
824
- }, yo = ({ point: e, index: r, markerSize: t, color: o, label: l }) => {
829
+ }, bo = ({ point: e, index: r, markerSize: t, color: o, label: l }) => {
825
830
  const [s, c] = E(false);
826
831
  return L("mesh", {
827
832
  position: [
@@ -863,7 +868,7 @@ let __tla = (async () => {
863
868
  })
864
869
  ]
865
870
  }, r);
866
- }, bo = ({ modelSize: e, labels: r }) => {
871
+ }, wo = ({ modelSize: e, labels: r }) => {
867
872
  const { landmarkPoints: t } = It(), o = e * 0.02, l = [
868
873
  "#44ff44",
869
874
  "#ff4444",
@@ -874,7 +879,7 @@ let __tla = (async () => {
874
879
  "Cut Plane"
875
880
  ];
876
881
  return i(Te, {
877
- children: t.map((a, n) => i(yo, {
882
+ children: t.map((a, n) => i(bo, {
878
883
  point: a,
879
884
  index: n,
880
885
  markerSize: o,
@@ -883,28 +888,28 @@ let __tla = (async () => {
883
888
  }, n))
884
889
  });
885
890
  };
886
- function mn(e) {
891
+ function xn(e) {
887
892
  return j(() => e ? new ft(e, {
888
893
  maxLeafTris: ut
889
894
  }) : null, [
890
895
  e
891
896
  ]);
892
897
  }
893
- const tn = (e, r) => {
898
+ const nn = (e, r) => {
894
899
  const t = Math.abs(e - r);
895
900
  return t <= 7 ? "#8BC34A" : t <= 20 ? "#FFC107" : "#FF5722";
896
- }, nn = new O.Color("#8BC34A"), on = new O.Color("#FFC107"), wo = new O.Color("#FF5722"), So = (e) => {
897
- if (e <= 7) return nn.clone();
901
+ }, on = new O.Color("#8BC34A"), rn = new O.Color("#FFC107"), So = new O.Color("#FF5722"), vo = (e) => {
902
+ if (e <= 7) return on.clone();
898
903
  if (e <= 20) {
899
904
  const t = (e - 7) / 13;
900
- return nn.clone().lerp(on, t);
905
+ return on.clone().lerp(rn, t);
901
906
  }
902
907
  const r = Math.min((e - 20) / 20, 1);
903
- return on.clone().lerp(wo, r);
904
- }, vo = (e, r) => {
908
+ return rn.clone().lerp(So, r);
909
+ }, Co = (e, r) => {
905
910
  const t = e.length, o = new Float32Array(t * 2 * 3), l = new Float32Array(t * 2 * 3), s = [];
906
911
  for (let n = 0; n < t; n++) {
907
- const h = e[n], d = r[n], u = h.distanceTo(d), p = So(u);
912
+ const h = e[n], d = r[n], u = h.distanceTo(d), p = vo(u);
908
913
  if (o[n * 6] = h.x, o[n * 6 + 1] = h.y, o[n * 6 + 2] = h.z, l[n * 6] = p.r, l[n * 6 + 1] = p.g, l[n * 6 + 2] = p.b, o[n * 6 + 3] = d.x, o[n * 6 + 4] = d.y, o[n * 6 + 5] = d.z, l[n * 6 + 3] = p.r, l[n * 6 + 4] = p.g, l[n * 6 + 5] = p.b, n < t - 1) {
909
914
  const g = n * 2, M = g + 1, f = (n + 1) * 2, m = f + 1;
910
915
  s.push(g, M, f, M, m, f);
@@ -921,7 +926,7 @@ let __tla = (async () => {
921
926
  depthWrite: false
922
927
  });
923
928
  return new O.Mesh(c, a);
924
- }, Co = ({ bvh: e, geometry: r, yPosition: t, color: o = "#00ff00", labelX: l, onDataChange: s, displayUnit: c = "mm", useInnerSurface: a = false, formValue: n, lineWidth: h = 1.5, wasmLoopPoints: d, wasmCircumference: u }) => {
929
+ }, Mo = ({ bvh: e, geometry: r, yPosition: t, color: o = "#00ff00", labelX: l, onDataChange: s, displayUnit: c = "mm", useInnerSurface: a = false, formValue: n, lineWidth: h = 1.5, wasmLoopPoints: d, wasmCircumference: u }) => {
925
930
  const p = j(() => d && u != null ? null : Ne(e, r, t, a), [
926
931
  e,
927
932
  r,
@@ -937,11 +942,11 @@ let __tla = (async () => {
937
942
  g,
938
943
  M,
939
944
  n
940
- ]), m = j(() => !f || g.length < 2 ? null : vo(g, f), [
945
+ ]), m = j(() => !f || g.length < 2 ? null : Co(g, f), [
941
946
  g,
942
947
  f
943
948
  ]);
944
- re(() => () => {
949
+ ne(() => () => {
945
950
  m && (m.geometry.dispose(), m.material.dispose());
946
951
  }, [
947
952
  m
@@ -957,11 +962,11 @@ let __tla = (async () => {
957
962
  });
958
963
  return new O.Line(I, F);
959
964
  }, []);
960
- return re(() => () => {
965
+ return ne(() => () => {
961
966
  S.geometry.dispose(), S.material.dispose();
962
967
  }, [
963
968
  S
964
- ]), re(() => {
969
+ ]), ne(() => {
965
970
  M > 0 && (s == null ? void 0 : s({
966
971
  yPosition: t,
967
972
  originalValue: M,
@@ -971,7 +976,7 @@ let __tla = (async () => {
971
976
  M,
972
977
  t,
973
978
  s
974
- ]), rn(({ camera: I }) => {
979
+ ]), sn(({ camera: I }) => {
975
980
  if (!x.current || g.length < 2) return;
976
981
  const F = new C();
977
982
  I.getWorldDirection(F);
@@ -1006,7 +1011,7 @@ let __tla = (async () => {
1006
1011
  }),
1007
1012
  f && n != null && i(de, {
1008
1013
  points: f,
1009
- color: tn(M, n),
1014
+ color: nn(M, n),
1010
1015
  lineWidth: 2.5,
1011
1016
  dashed: true,
1012
1017
  dashSize: 2,
@@ -1073,7 +1078,7 @@ let __tla = (async () => {
1073
1078
  ]
1074
1079
  }),
1075
1080
  n != null && M > 0 && (() => {
1076
- const I = M - n, F = I > 0.5 ? "\u25B2" : I < -0.5 ? "\u25BC" : "", P = tn(M, n);
1081
+ const I = M - n, F = I > 0.5 ? "\u25B2" : I < -0.5 ? "\u25BC" : "", P = nn(M, n);
1077
1082
  return L("div", {
1078
1083
  style: {
1079
1084
  display: "flex",
@@ -1125,8 +1130,8 @@ let __tla = (async () => {
1125
1130
  })
1126
1131
  ]
1127
1132
  });
1128
- }, Mo = Gn(Co), zo = ({ mesh: e, startY: r, endY: t, spacing: o, modelSize: l, onMeasurementsChange: s, reverseOrder: c = false, displayUnit: a = "mm", useInnerSurface: n = false, formMeasurements: h, originY: d, wasmSlices: u }) => {
1129
- const p = le(/* @__PURE__ */ new Map()), g = e.geometry, M = mn(g), f = j(() => {
1133
+ }, zo = Zn(Mo), Ao = ({ mesh: e, startY: r, endY: t, spacing: o, modelSize: l, onMeasurementsChange: s, reverseOrder: c = false, displayUnit: a = "mm", useInnerSurface: n = false, formMeasurements: h, originY: d, wasmSlices: u }) => {
1134
+ const p = le(/* @__PURE__ */ new Map()), g = e.geometry, M = xn(g), f = j(() => {
1130
1135
  if (u) {
1131
1136
  let z = [
1132
1137
  ...u.yValues
@@ -1171,11 +1176,11 @@ let __tla = (async () => {
1171
1176
  }, [
1172
1177
  u
1173
1178
  ]);
1174
- re(() => {
1179
+ ne(() => {
1175
1180
  p.current.clear();
1176
1181
  }, [
1177
1182
  f
1178
- ]), re(() => {
1183
+ ]), ne(() => {
1179
1184
  if (!x || !s) return;
1180
1185
  const P = f.filter((b) => (x.get(b) ?? 0) > 0).map((b) => ({
1181
1186
  yPosition: b,
@@ -1190,7 +1195,7 @@ let __tla = (async () => {
1190
1195
  ]);
1191
1196
  const S = [
1192
1197
  "#5B9BD5"
1193
- ], I = l * no, F = oe((P) => {
1198
+ ], I = l * oo, F = re((P) => {
1194
1199
  if (x) return;
1195
1200
  p.current.set(P.yPosition, P);
1196
1201
  const b = Array.from(p.current.values()).sort((z, y) => c ? y.yPosition - z.yPosition : z.yPosition - y.yPosition);
@@ -1201,7 +1206,7 @@ let __tla = (async () => {
1201
1206
  x
1202
1207
  ]);
1203
1208
  return M ? i(Te, {
1204
- children: f.map((P, b) => i(Mo, {
1209
+ children: f.map((P, b) => i(zo, {
1205
1210
  bvh: M,
1206
1211
  geometry: g,
1207
1212
  yPosition: P,
@@ -1216,12 +1221,12 @@ let __tla = (async () => {
1216
1221
  wasmCircumference: x == null ? void 0 : x.get(P)
1217
1222
  }, P))
1218
1223
  }) : null;
1219
- }, Ao = ({ mesh: e, greenY: r, modelSize: t, displayUnit: o = "mm", bottomY: l }) => {
1224
+ }, ko = ({ mesh: e, greenY: r, modelSize: t, displayUnit: o = "mm", bottomY: l }) => {
1220
1225
  var _a;
1221
1226
  const s = e.geometry;
1222
1227
  s.computeBoundingBox();
1223
1228
  const c = l ?? ((_a = s.boundingBox) == null ? void 0 : _a.min.y) ?? 0, a = r - c, n = t * 0.4, h = t * 0.03, d = le(null);
1224
- rn(({ camera: S }) => {
1229
+ sn(({ camera: S }) => {
1225
1230
  if (!d.current) return;
1226
1231
  const I = new C();
1227
1232
  S.getWorldDirection(I);
@@ -1295,8 +1300,8 @@ let __tla = (async () => {
1295
1300
  })
1296
1301
  ]
1297
1302
  });
1298
- }, ko = ({ modelSize: e, isAligned: r, isCut: t, mesh: o, viewMode: l, sliceY: s, landmarkCount: c = 0, measurementGeometry: a, resetCameraToFrontRef: n }) => {
1299
- const { set: h, size: d, camera: u, invalidate: p } = sn(), g = le(false), M = le(l), f = le(new C()), m = le(null), x = le(c), S = le(r), I = le(t), F = le(a), P = le(0), b = oe(() => {
1303
+ }, Fo = ({ modelSize: e, isAligned: r, isCut: t, mesh: o, viewMode: l, sliceY: s, landmarkCount: c = 0, measurementGeometry: a, resetCameraToFrontRef: n }) => {
1304
+ const { set: h, size: d, camera: u, invalidate: p } = ln(), g = le(false), M = le(l), f = le(new C()), m = le(null), x = le(c), S = le(r), I = le(t), F = le(a), P = le(0), b = re(() => {
1300
1305
  if (!o || e <= 0) return null;
1301
1306
  const y = a ?? o.geometry;
1302
1307
  y.computeBoundingBox();
@@ -1314,7 +1319,7 @@ let __tla = (async () => {
1314
1319
  d,
1315
1320
  a
1316
1321
  ]);
1317
- re(() => {
1322
+ ne(() => {
1318
1323
  if (n) return n.current = () => {
1319
1324
  const y = b();
1320
1325
  y && (h({
@@ -1329,13 +1334,13 @@ let __tla = (async () => {
1329
1334
  h,
1330
1335
  p
1331
1336
  ]);
1332
- const z = oe((y) => {
1337
+ const z = re((y) => {
1333
1338
  const D = y.position.clone(), w = D.length(), A = Math.atan2(D.x, D.z), k = Math.acos(D.y / w), $ = A + 0.02;
1334
1339
  y.position.set(w * Math.sin(k) * Math.sin($), w * Math.cos(k), w * Math.sin(k) * Math.cos($)), y.lookAt(0, 0, 0), y.updateMatrixWorld(true), p();
1335
1340
  }, [
1336
1341
  p
1337
1342
  ]);
1338
- return re(() => {
1343
+ return ne(() => {
1339
1344
  if (e > 0 && !g.current && !r) {
1340
1345
  g.current = true;
1341
1346
  const y = new O.PerspectiveCamera(50, d.width / d.height, 0.1, e * 10);
@@ -1349,7 +1354,7 @@ let __tla = (async () => {
1349
1354
  h,
1350
1355
  r,
1351
1356
  z
1352
- ]), re(() => {
1357
+ ]), ne(() => {
1353
1358
  const y = x.current;
1354
1359
  x.current = c, y === 0 && c === 1 && !r && requestAnimationFrame(() => z(u));
1355
1360
  }, [
@@ -1357,7 +1362,7 @@ let __tla = (async () => {
1357
1362
  r,
1358
1363
  u,
1359
1364
  z
1360
- ]), re(() => {
1365
+ ]), ne(() => {
1361
1366
  const y = S.current !== r, D = I.current !== t, w = !F.current && !!a;
1362
1367
  if (S.current = r, I.current = t, F.current = a, !y && !D && !w || !r || l !== "3D") return;
1363
1368
  const A = b();
@@ -1371,7 +1376,7 @@ let __tla = (async () => {
1371
1376
  a,
1372
1377
  b,
1373
1378
  h
1374
- ]), re(() => {
1379
+ ]), ne(() => {
1375
1380
  if (M.current === l) return;
1376
1381
  const y = M.current;
1377
1382
  if (M.current = l, !(!r || !o || e <= 0)) {
@@ -1415,7 +1420,7 @@ let __tla = (async () => {
1415
1420
  h,
1416
1421
  u,
1417
1422
  b
1418
- ]), re(() => {
1423
+ ]), ne(() => {
1419
1424
  if (!r || !u || !u.isOrthographicCamera) return;
1420
1425
  const y = u;
1421
1426
  if (l === "2D") {
@@ -1447,12 +1452,12 @@ let __tla = (async () => {
1447
1452
  l,
1448
1453
  o
1449
1454
  ]), null;
1450
- }, Fo = ({ mesh: e, isDragging: r }) => {
1455
+ }, Lo = ({ mesh: e, isDragging: r }) => {
1451
1456
  var _a;
1452
1457
  const t = e.geometry;
1453
1458
  t.computeBoundingBox();
1454
1459
  const o = new C();
1455
- return (_a = t.boundingBox) == null ? void 0 : _a.getCenter(o), i(ln, {
1460
+ return (_a = t.boundingBox) == null ? void 0 : _a.getCenter(o), i(an, {
1456
1461
  enableDamping: false,
1457
1462
  enablePan: false,
1458
1463
  minPolarAngle: Math.PI * 0.15,
@@ -1466,7 +1471,7 @@ let __tla = (async () => {
1466
1471
  o.z
1467
1472
  ]
1468
1473
  });
1469
- }, Lo = ({ wasAutoScaled: e, onDismiss: r }) => L("div", {
1474
+ }, Po = ({ wasAutoScaled: e, onDismiss: r }) => L("div", {
1470
1475
  style: {
1471
1476
  position: "absolute",
1472
1477
  bottom: 16,
@@ -1507,7 +1512,7 @@ let __tla = (async () => {
1507
1512
  children: "X"
1508
1513
  })
1509
1514
  ]
1510
- }), Po = ({ isDoubleShell: e, onDismiss: r }) => L("div", {
1515
+ }), Io = ({ isDoubleShell: e, onDismiss: r }) => L("div", {
1511
1516
  style: {
1512
1517
  position: "absolute",
1513
1518
  bottom: 68,
@@ -1548,7 +1553,7 @@ let __tla = (async () => {
1548
1553
  children: "X"
1549
1554
  })
1550
1555
  ]
1551
- }), Io = ({ steps: e, currentStep: r, accentColor: t = "rgb(12, 67, 173)" }) => i("div", {
1556
+ }), _o = ({ steps: e, currentStep: r, accentColor: t = "rgb(12, 67, 173)" }) => i("div", {
1552
1557
  style: {
1553
1558
  backgroundColor: "#fff",
1554
1559
  borderBottom: "1px solid #e0e0e0",
@@ -1612,7 +1617,7 @@ let __tla = (async () => {
1612
1617
  ]
1613
1618
  }, o.number);
1614
1619
  })
1615
- }), _o = ({ mesh: e, upperY: r, originY: t, modelSize: o, meshColor: l = "#c8c8c8", displayUnit: s = "mm" }) => {
1620
+ }), Do = ({ mesh: e, upperY: r, originY: t, modelSize: o, meshColor: l = "#c8c8c8", displayUnit: s = "mm" }) => {
1616
1621
  const c = e.geometry, a = j(() => new ft(c, {
1617
1622
  maxLeafTris: ut
1618
1623
  }), [
@@ -1759,8 +1764,8 @@ let __tla = (async () => {
1759
1764
  })
1760
1765
  ]
1761
1766
  });
1762
- }, Do = ({ mesh: e, yPosition: r, onYChange: t, minY: o, maxY: l, modelSize: s, color: c, hoverColor: a, dragColor: n, label: h, onDragStart: d, onDragEnd: u }) => {
1763
- const [p, g] = E(false), [M, f] = E(false), { camera: m, gl: x } = sn(), S = le(0), I = e.geometry, F = mn(I), P = j(() => F ? Ne(F, I, r) : {
1767
+ }, Bo = ({ mesh: e, yPosition: r, onYChange: t, minY: o, maxY: l, modelSize: s, color: c, hoverColor: a, dragColor: n, label: h, onDragStart: d, onDragEnd: u }) => {
1768
+ const [p, g] = E(false), [M, f] = E(false), { camera: m, gl: x } = ln(), S = le(0), I = e.geometry, F = xn(I), P = j(() => F ? Ne(F, I, r) : {
1764
1769
  linePoints: [],
1765
1770
  lineLength: 0,
1766
1771
  rightmostPoint: new C()
@@ -1768,8 +1773,8 @@ let __tla = (async () => {
1768
1773
  F,
1769
1774
  I,
1770
1775
  r
1771
- ]), b = oe((A, k) => {
1772
- const B = x.domElement.getBoundingClientRect(), $ = (A - B.left) / B.width * 2 - 1, N = -((k - B.top) / B.height) * 2 + 1, U = new Un();
1776
+ ]), b = re((A, k) => {
1777
+ const B = x.domElement.getBoundingClientRect(), $ = (A - B.left) / B.width * 2 - 1, N = -((k - B.top) / B.height) * 2 + 1, U = new Jn();
1773
1778
  U.setFromCamera(new O.Vector2($, N), m);
1774
1779
  const be = new dt(new C(0, 0, 1), 0), ae = new C();
1775
1780
  return U.ray.intersectPlane(be, ae), ae ? ae.y : r;
@@ -1777,14 +1782,14 @@ let __tla = (async () => {
1777
1782
  m,
1778
1783
  x,
1779
1784
  r
1780
- ]), z = oe((A) => {
1785
+ ]), z = re((A) => {
1781
1786
  A.stopPropagation(), g(true), x.domElement.style.cursor = "ns-resize", S.current = r - b(A.clientX, A.clientY), A.target.setPointerCapture(A.pointerId), d == null ? void 0 : d();
1782
1787
  }, [
1783
1788
  r,
1784
1789
  x,
1785
1790
  b,
1786
1791
  d
1787
- ]), y = oe((A) => {
1792
+ ]), y = re((A) => {
1788
1793
  if (!p) return;
1789
1794
  let k = b(A.clientX, A.clientY) + S.current;
1790
1795
  k = Math.max(o, Math.min(l, k)), t(k);
@@ -1794,7 +1799,7 @@ let __tla = (async () => {
1794
1799
  t,
1795
1800
  o,
1796
1801
  l
1797
- ]), D = oe((A) => {
1802
+ ]), D = re((A) => {
1798
1803
  g(false), x.domElement.style.cursor = "auto", A.target.releasePointerCapture(A.pointerId), u == null ? void 0 : u();
1799
1804
  }, [
1800
1805
  x,
@@ -1848,17 +1853,17 @@ let __tla = (async () => {
1848
1853
  ]
1849
1854
  });
1850
1855
  };
1851
- function Bo(e, r) {
1856
+ function Ro(e, r) {
1852
1857
  if (e == null) return {};
1853
1858
  var t = {}, o = Object.keys(e), l, s;
1854
1859
  for (s = 0; s < o.length; s++) l = o[s], !(r.indexOf(l) >= 0) && (t[l] = e[l]);
1855
1860
  return t;
1856
1861
  }
1857
- var Ro = [
1862
+ var Wo = [
1858
1863
  "color"
1859
- ], Wo = Zn(function(e, r) {
1860
- var t = e.color, o = t === void 0 ? "currentColor" : t, l = Bo(e, Ro);
1861
- return Jt("svg", Object.assign({
1864
+ ], Eo = Kn(function(e, r) {
1865
+ var t = e.color, o = t === void 0 ? "currentColor" : t, l = Ro(e, Wo);
1866
+ return Qt("svg", Object.assign({
1862
1867
  width: "15",
1863
1868
  height: "15",
1864
1869
  viewBox: "0 0 15 15",
@@ -1866,14 +1871,14 @@ let __tla = (async () => {
1866
1871
  xmlns: "http://www.w3.org/2000/svg"
1867
1872
  }, l, {
1868
1873
  ref: r
1869
- }), Jt("path", {
1874
+ }), Qt("path", {
1870
1875
  d: "M7.5 2C7.77614 2 8 2.22386 8 2.5L8 11.2929L11.1464 8.14645C11.3417 7.95118 11.6583 7.95118 11.8536 8.14645C12.0488 8.34171 12.0488 8.65829 11.8536 8.85355L7.85355 12.8536C7.75979 12.9473 7.63261 13 7.5 13C7.36739 13 7.24021 12.9473 7.14645 12.8536L3.14645 8.85355C2.95118 8.65829 2.95118 8.34171 3.14645 8.14645C3.34171 7.95118 3.65829 7.95118 3.85355 8.14645L7 11.2929L7 2.5C7 2.22386 7.22386 2 7.5 2Z",
1871
1876
  fill: o,
1872
1877
  fillRule: "evenodd",
1873
1878
  clipRule: "evenodd"
1874
1879
  }));
1875
1880
  });
1876
- const Eo = [
1881
+ const To = [
1877
1882
  "Scan doesn't load properly",
1878
1883
  "Takes too long",
1879
1884
  "I don't want to",
@@ -1897,7 +1902,7 @@ let __tla = (async () => {
1897
1902
  outline: "none",
1898
1903
  boxSizing: "border-box",
1899
1904
  fontFamily: "system-ui, sans-serif"
1900
- }, To = ({ amputationType: e, spacingInches: r, scanMeasurements: t, scanFrontalHeight: o, onSave: l, onSkip: s }) => {
1905
+ }, Oo = ({ amputationType: e, spacingInches: r, scanMeasurements: t, scanFrontalHeight: o, onSave: l, onSkip: s }) => {
1901
1906
  const c = e === "AK" ? "IT" : "MPT", a = r, n = e === "AK" ? 18 : 9, h = j(() => {
1902
1907
  const w = [];
1903
1908
  for (let A = 2; A >= 1; A -= a) w.push(`${A}\u2033 above ${c}`);
@@ -1918,7 +1923,7 @@ let __tla = (async () => {
1918
1923
  d,
1919
1924
  p,
1920
1925
  h
1921
- ]), z = oe(() => {
1926
+ ]), z = re(() => {
1922
1927
  if (!b) return;
1923
1928
  const w = h.map((k) => {
1924
1929
  const B = d[k];
@@ -1934,7 +1939,7 @@ let __tla = (async () => {
1934
1939
  d,
1935
1940
  p,
1936
1941
  l
1937
- ]), y = oe(() => {
1942
+ ]), y = re(() => {
1938
1943
  const w = {};
1939
1944
  h.forEach((A, k) => {
1940
1945
  const B = t[k];
@@ -1947,7 +1952,7 @@ let __tla = (async () => {
1947
1952
  h,
1948
1953
  t,
1949
1954
  o
1950
- ]), D = oe(() => {
1955
+ ]), D = re(() => {
1951
1956
  f(false), x(true);
1952
1957
  }, []);
1953
1958
  if (m) {
@@ -2007,7 +2012,7 @@ let __tla = (async () => {
2007
2012
  },
2008
2013
  children: [
2009
2014
  [
2010
- ...Eo,
2015
+ ...To,
2011
2016
  "Other"
2012
2017
  ].map((k) => L("label", {
2013
2018
  style: {
@@ -2246,7 +2251,7 @@ let __tla = (async () => {
2246
2251
  gap: 4
2247
2252
  },
2248
2253
  children: [
2249
- i(Wo, {
2254
+ i(Eo, {
2250
2255
  style: {
2251
2256
  width: 16,
2252
2257
  height: 16
@@ -2421,7 +2426,7 @@ let __tla = (async () => {
2421
2426
  ]
2422
2427
  });
2423
2428
  };
2424
- function xn(e, r, t) {
2429
+ function yn(e, r, t) {
2425
2430
  const o = e.getAttribute("position"), l = t - r;
2426
2431
  if (l < 1) return null;
2427
2432
  const s = 30, c = l / s, a = [];
@@ -2451,7 +2456,7 @@ let __tla = (async () => {
2451
2456
  }
2452
2457
  return f.y < 0 && f.negate(), f;
2453
2458
  }
2454
- const Oo = {
2459
+ const $o = {
2455
2460
  pcaAxes: true,
2456
2461
  obb: true,
2457
2462
  obbAxis: true,
@@ -2461,12 +2466,12 @@ let __tla = (async () => {
2461
2466
  landmarkAxis: true,
2462
2467
  iterativePCA: false,
2463
2468
  fullRegionPCA: true
2464
- }, $o = [
2469
+ }, Ho = [
2465
2470
  "#ff4444",
2466
2471
  "#44cc44",
2467
2472
  "#4488ff"
2468
2473
  ];
2469
- function yn(e) {
2474
+ function bn(e) {
2470
2475
  const r = e.getAttribute("position"), t = r.count, o = new C();
2471
2476
  for (let f = 0; f < t; f++) o.x += r.getX(f), o.y += r.getY(f), o.z += r.getZ(f);
2472
2477
  o.divideScalar(t);
@@ -2542,7 +2547,7 @@ let __tla = (async () => {
2542
2547
  halfExtents: M
2543
2548
  };
2544
2549
  }
2545
- function Ho({ pca: e }) {
2550
+ function Vo({ pca: e }) {
2546
2551
  return i("group", {
2547
2552
  children: e.axes.map((r, t) => {
2548
2553
  const o = e.center.clone().addScaledVector(r, e.halfExtents[t]), l = e.center.clone().addScaledVector(r, -e.halfExtents[t]);
@@ -2551,13 +2556,13 @@ let __tla = (async () => {
2551
2556
  l,
2552
2557
  o
2553
2558
  ],
2554
- color: $o[t],
2559
+ color: Ho[t],
2555
2560
  lineWidth: 2
2556
2561
  }, t);
2557
2562
  })
2558
2563
  });
2559
2564
  }
2560
- function Vo({ pca: e }) {
2565
+ function jo({ pca: e }) {
2561
2566
  const r = j(() => {
2562
2567
  const { center: t, axes: o, halfExtents: l } = e, s = [];
2563
2568
  for (let a = -1; a <= 1; a += 2) for (let n = -1; n <= 1; n += 2) for (let h = -1; h <= 1; h += 2) s.push(t.clone().addScaledVector(o[0], a * l[0]).addScaledVector(o[1], n * l[1]).addScaledVector(o[2], h * l[2]));
@@ -2627,7 +2632,7 @@ let __tla = (async () => {
2627
2632
  }, o))
2628
2633
  });
2629
2634
  }
2630
- function jo({ redPoint: e, greenPoint: r }) {
2635
+ function No({ redPoint: e, greenPoint: r }) {
2631
2636
  const t = j(() => new C().subVectors(r, e).normalize(), [
2632
2637
  e,
2633
2638
  r
@@ -2680,13 +2685,13 @@ let __tla = (async () => {
2680
2685
  ]
2681
2686
  });
2682
2687
  }
2683
- function No({ geometry: e, redY: r, greenY: t, modelSize: o }) {
2688
+ function Yo({ geometry: e, redY: r, greenY: t, modelSize: o }) {
2684
2689
  const s = o * 0.15, c = j(() => {
2685
2690
  const a = [];
2686
2691
  let n = t - 10;
2687
2692
  const h = new C(0, 1, 0);
2688
2693
  for (; n > r; ) {
2689
- const d = Math.min(n, t), u = Math.max(n, t), p = xn(e, d, u);
2694
+ const d = Math.min(n, t), u = Math.max(n, t), p = yn(e, d, u);
2690
2695
  if (p) {
2691
2696
  const g = p.dot(h), M = Math.acos(Math.min(1, Math.abs(g))) * 180 / Math.PI;
2692
2697
  a.push({
@@ -2734,9 +2739,9 @@ let __tla = (async () => {
2734
2739
  })
2735
2740
  });
2736
2741
  }
2737
- function Yo({ geometry: e, redY: r, greenY: t, modelSize: o }) {
2742
+ function Xo({ geometry: e, redY: r, greenY: t, modelSize: o }) {
2738
2743
  const l = j(() => {
2739
- const u = xn(e, r, t);
2744
+ const u = yn(e, r, t);
2740
2745
  if (!u) return null;
2741
2746
  const p = u.dot(new C(0, 1, 0)), g = Math.acos(Math.min(1, Math.abs(p))) * 180 / Math.PI;
2742
2747
  return {
@@ -2764,7 +2769,7 @@ let __tla = (async () => {
2764
2769
  })
2765
2770
  });
2766
2771
  }
2767
- function Xo({ pca: e, modelSize: r }) {
2772
+ function Go({ pca: e, modelSize: r }) {
2768
2773
  const t = e.axes[0], o = r * 0.6, l = e.center.clone().addScaledVector(t, o), s = e.center.clone().addScaledVector(t, -o);
2769
2774
  return i(de, {
2770
2775
  points: [
@@ -2778,11 +2783,11 @@ let __tla = (async () => {
2778
2783
  gapSize: 2
2779
2784
  });
2780
2785
  }
2781
- function Go({ geometry: e, redY: r, greenY: t, modelSize: o, measurementGeometry: l }) {
2786
+ function Zo({ geometry: e, redY: r, greenY: t, modelSize: o, measurementGeometry: l }) {
2782
2787
  const s = j(() => {
2783
- const d = l ?? e, u = gn(d), p = new C(0, 1, 0), g = 5, f = t + 3 * 25.4, m = [];
2788
+ const d = l ?? e, u = mn(d), p = new C(0, 1, 0), g = 5, f = t + 3 * 25.4, m = [];
2784
2789
  for (let y = r + g; y < f; y += g) {
2785
- const D = fo(u, d, new C(0, y, 0), p);
2790
+ const D = uo(u, d, new C(0, y, 0), p);
2786
2791
  D > 0 && m.push({
2787
2792
  y,
2788
2793
  circ: D
@@ -2855,7 +2860,7 @@ let __tla = (async () => {
2855
2860
  ]
2856
2861
  });
2857
2862
  }
2858
- function Zo({ componentDebug: e }) {
2863
+ function Ko({ componentDebug: e }) {
2859
2864
  return i("group", {
2860
2865
  children: e.geometries.map((r, t) => {
2861
2866
  const o = e.colors[t] ?? "#888888", l = t === e.innerIdx;
@@ -2919,7 +2924,7 @@ let __tla = (async () => {
2919
2924
  })
2920
2925
  });
2921
2926
  }
2922
- function Ko({ geometry: e, aoData: r }) {
2927
+ function Uo({ geometry: e, aoData: r }) {
2923
2928
  const t = j(() => {
2924
2929
  const o = e.toNonIndexed(), l = o.getAttribute("position"), s = r.length, c = l.count, a = new Float32Array(c * 3);
2925
2930
  for (let n = 0; n < s && n * 3 + 2 < c; n++) {
@@ -2948,8 +2953,8 @@ let __tla = (async () => {
2948
2953
  })
2949
2954
  });
2950
2955
  }
2951
- function Uo({ mesh: e, layers: r, landmarkPoints: t, componentDebug: o, aoData: l, aoGeometry: s, measurementGeometry: c }) {
2952
- const a = e.geometry, n = j(() => a.getAttribute("position") ? yn(a) : null, [
2956
+ function Jo({ mesh: e, layers: r, landmarkPoints: t, componentDebug: o, aoData: l, aoGeometry: s, measurementGeometry: c }) {
2957
+ const a = e.geometry, n = j(() => a.getAttribute("position") ? bn(a) : null, [
2953
2958
  a
2954
2959
  ]), h = j(() => !t || t.length < 2 ? null : {
2955
2960
  red: new C(t[1].position.x, t[1].position.y, t[1].position.z),
@@ -2959,24 +2964,24 @@ let __tla = (async () => {
2959
2964
  ]);
2960
2965
  return L("group", {
2961
2966
  children: [
2962
- r.pcaAxes && n && i(Ho, {
2967
+ r.pcaAxes && n && i(Vo, {
2963
2968
  pca: n
2964
2969
  }),
2965
- r.obb && n && i(Vo, {
2970
+ r.obb && n && i(jo, {
2966
2971
  pca: n
2967
2972
  }),
2968
- r.obbAxis && n && i(Xo, {
2973
+ r.obbAxis && n && i(Go, {
2969
2974
  pca: n,
2970
2975
  modelSize: n.halfExtents[0] ? Math.max(...n.halfExtents) * 2 : 100
2971
2976
  }),
2972
- r.shellComponents && o && i(Zo, {
2977
+ r.shellComponents && o && i(Ko, {
2973
2978
  componentDebug: o
2974
2979
  }),
2975
- r.ambientOcclusion && l && l.length > 0 && i(Ko, {
2980
+ r.ambientOcclusion && l && l.length > 0 && i(Uo, {
2976
2981
  geometry: s ?? a,
2977
2982
  aoData: l
2978
2983
  }),
2979
- r.circumferenceScan && h && i(Go, {
2984
+ r.circumferenceScan && h && i(Zo, {
2980
2985
  geometry: a,
2981
2986
  redY: h.red.y,
2982
2987
  greenY: h.green.y,
@@ -2994,17 +2999,17 @@ let __tla = (async () => {
2994
2999
  depthWrite: false
2995
3000
  })
2996
3001
  }),
2997
- r.landmarkAxis && h && i(jo, {
3002
+ r.landmarkAxis && h && i(No, {
2998
3003
  redPoint: h.red,
2999
3004
  greenPoint: h.green
3000
3005
  }),
3001
- r.iterativePCA && h && i(No, {
3006
+ r.iterativePCA && h && i(Yo, {
3002
3007
  geometry: a,
3003
3008
  redY: h.red.y,
3004
3009
  greenY: h.green.y,
3005
3010
  modelSize: (n == null ? void 0 : n.halfExtents[0]) ? Math.max(...n.halfExtents) * 2 : 100
3006
3011
  }),
3007
- r.fullRegionPCA && h && i(Yo, {
3012
+ r.fullRegionPCA && h && i(Xo, {
3008
3013
  geometry: a,
3009
3014
  redY: h.red.y,
3010
3015
  greenY: h.green.y,
@@ -3013,10 +3018,10 @@ let __tla = (async () => {
3013
3018
  ]
3014
3019
  });
3015
3020
  }
3016
- function Jo({ mesh: e }) {
3021
+ function Qo({ mesh: e }) {
3017
3022
  const r = e.geometry, t = j(() => {
3018
3023
  if (!r.getAttribute("position")) return null;
3019
- const s = yn(r), c = s.axes[0], a = s.halfExtents[0] * 1.3;
3024
+ const s = bn(r), c = s.axes[0], a = s.halfExtents[0] * 1.3;
3020
3025
  return {
3021
3026
  axis: c,
3022
3027
  center: s.center,
@@ -3043,7 +3048,7 @@ let __tla = (async () => {
3043
3048
  renderOrder: 999
3044
3049
  });
3045
3050
  }
3046
- const bn = [
3051
+ const wn = [
3047
3052
  {
3048
3053
  key: "pcaAxes",
3049
3054
  label: "PCA Axes (full mesh)",
@@ -3099,10 +3104,10 @@ let __tla = (async () => {
3099
3104
  color: "#00ffff",
3100
3105
  group: "Alignment"
3101
3106
  }
3102
- ], Qo = [
3103
- ...new Set(bn.map((e) => e.group))
3107
+ ], qo = [
3108
+ ...new Set(wn.map((e) => e.group))
3104
3109
  ];
3105
- function qo({ layers: e, onToggleLayer: r, isDoubleShell: t }) {
3110
+ function er({ layers: e, onToggleLayer: r, isDoubleShell: t }) {
3106
3111
  return L("div", {
3107
3112
  style: {
3108
3113
  position: "absolute",
@@ -3131,8 +3136,8 @@ let __tla = (async () => {
3131
3136
  },
3132
3137
  children: "Debug Layers"
3133
3138
  }),
3134
- Qo.map((o) => {
3135
- const l = bn.filter((s) => s.group === o && !(s.hideWhenDoubleShell && t));
3139
+ qo.map((o) => {
3140
+ const l = wn.filter((s) => s.group === o && !(s.hideWhenDoubleShell && t));
3136
3141
  return l.length === 0 ? null : L("div", {
3137
3142
  children: [
3138
3143
  i("div", {
@@ -3192,8 +3197,8 @@ let __tla = (async () => {
3192
3197
  ]
3193
3198
  });
3194
3199
  }
3195
- const er = ({ config: e, spacingType: r, scanUrl: t, formMeasurements: o, onComplete: l, isDebugUser: s = false, onAnalyticsEvent: c, wasmModule: a }) => {
3196
- const [n, h] = E(null), [d, u] = E(0), [p, g] = E(false), [M, f] = E(false), [m, x] = E(""), [S, I] = E("3D"), [F, P] = E(r === "AK" ? 2 : 1), [b, z] = E(false), [y, D] = E(null), [w, A] = E(r ?? null), [k, B] = E("mm"), [$, N] = E(false), [U, be] = E(""), [ae, fe] = E(false), [ie, J] = E(false), [Y, pe] = E(false), [Z, he] = E(false), [me, ue] = E(null), [H, q] = E(null), [xe, Ce] = E(null), [we, ne] = E(false), [V, X] = E([]), [Le, Pe] = E(null), [Xe, se] = E(null), [ze, _t] = E(null), [pt, Sn] = E(null), [vn, Dt] = E(false), [Bt, Cn] = E(null), [ht, Ie] = E(null), [Be, Mn] = E(false), [Rt, zn] = E(Oo), [Oe, Wt] = E("obj"), [Ae, gt] = E(o), [et, Et] = E(true), [Tt, mt] = E(false), [Ot, An] = E(false), [xt, kn] = E(null), [$t] = E("#c8c8c8"), [Fn] = E(1), [Ge, Ln] = E(false), [yt, Ht] = E([]), tt = le(null), $e = le(null), bt = le(false), Pn = le(null), wt = le(null), St = le(null), Ke = oe(async () => {
3200
+ const tr = ({ config: e, spacingType: r, scanUrl: t, formMeasurements: o, onComplete: l, isDebugUser: s = false, onAnalyticsEvent: c, wasmModule: a }) => {
3201
+ const [n, h] = E(null), [d, u] = E(0), [p, g] = E(false), [M, f] = E(false), [m, x] = E(""), [S, I] = E("3D"), [F, P] = E(r === "AK" ? 2 : 1), [b, z] = E(false), [y, D] = E(null), [w, A] = E(r ?? null), [k, B] = E("mm"), [$, N] = E(false), [U, be] = E(""), [ae, fe] = E(false), [ie, J] = E(false), [Y, pe] = E(false), [Z, he] = E(false), [me, ue] = E(null), [H, q] = E(null), [xe, Ce] = E(null), [we, oe] = E(false), [V, X] = E([]), [Le, Pe] = E(null), [Xe, se] = E(null), [ze, _t] = E(null), [pt, vn] = E(null), [Cn, Dt] = E(false), [Bt, Mn] = E(null), [ht, Ie] = E(null), [Be, zn] = E(false), [Rt, An] = E($o), [Oe, Wt] = E("obj"), [Ae, gt] = E(o), [et, Et] = E(true), [Tt, mt] = E(false), [Ot, kn] = E(false), [xt, Fn] = E(null), [$t] = E("#c8c8c8"), [Ln] = E(1), [Ge, Pn] = E(false), [yt, Ht] = E([]), tt = le(null), $e = le(null), bt = le(false), In = le(null), wt = le(null), St = le(null), Ke = re(async () => {
3197
3202
  if (St.current) try {
3198
3203
  const v = (await import("./html2canvas.esm-Dmi1NfiH.js")).default, _ = St.current, W = 2, R = async (K = false) => {
3199
3204
  const te = await v(_, {
@@ -3210,8 +3215,8 @@ let __tla = (async () => {
3210
3215
  const _e = te.getContext("2d").getImageData(0, 0, te.width, te.height).data;
3211
3216
  let De = te.width, We = te.height, qe = 0, it = 0;
3212
3217
  for (let He = 0; He < te.height; He++) for (let Ve = 0; Ve < te.width; Ve++) {
3213
- const Nn = (He * te.width + Ve) * 4;
3214
- _e[Nn + 3] > 20 && (Ve < De && (De = Ve), Ve > qe && (qe = Ve), He < We && (We = He), He > it && (it = He));
3218
+ const Yn = (He * te.width + Ve) * 4;
3219
+ _e[Yn + 3] > 20 && (Ve < De && (De = Ve), Ve > qe && (qe = Ve), He < We && (We = He), He > it && (it = He));
3215
3220
  }
3216
3221
  qe <= De && (De = 0, We = 0, qe = te.width, it = te.height), ve = De / W, Me = We / W, ye = qe / W, Ee = it / W;
3217
3222
  } else {
@@ -3223,10 +3228,10 @@ let __tla = (async () => {
3223
3228
  De < ve && (ve = De), We < Me && (Me = We), De + _e.width > ye && (ye = De + _e.width), We + _e.height > Ee && (Ee = We + _e.height);
3224
3229
  }), ve === 1 / 0 && (ve = 0, Me = 0, ye = ke, Ee = Re);
3225
3230
  }
3226
- const Kt = Math.max(ke, Re) * 0.03, Ut = Math.max(ke, Re) * 0.06;
3227
- ve = Math.max(0, ve - Kt), Me = Math.max(0, Me - Ut), ye = Math.min(ke, ye + Kt), Ee = Math.min(Re, Ee + Ut);
3228
- const zt = (ye - ve) * W, At = (Ee - Me) * W, Vn = Math.max(0, ve * W), jn = Math.max(0, Me * W), ot = document.createElement("canvas");
3229
- return ot.width = Math.round(zt), ot.height = Math.round(At), ot.getContext("2d").drawImage(te, Math.round(Vn), Math.round(jn), Math.round(zt), Math.round(At), 0, 0, Math.round(zt), Math.round(At)), ot.toDataURL("image/png");
3231
+ const Ut = Math.max(ke, Re) * 0.03, Jt = Math.max(ke, Re) * 0.06;
3232
+ ve = Math.max(0, ve - Ut), Me = Math.max(0, Me - Jt), ye = Math.min(ke, ye + Ut), Ee = Math.min(Re, Ee + Jt);
3233
+ const zt = (ye - ve) * W, At = (Ee - Me) * W, jn = Math.max(0, ve * W), Nn = Math.max(0, Me * W), ot = document.createElement("canvas");
3234
+ return ot.width = Math.round(zt), ot.height = Math.round(At), ot.getContext("2d").drawImage(te, Math.round(jn), Math.round(Nn), Math.round(zt), Math.round(At), 0, 0, Math.round(zt), Math.round(At)), ot.toDataURL("image/png");
3230
3235
  };
3231
3236
  wt.current && wt.current(), await new Promise((K) => setTimeout(K, 200)), await new Promise((K) => requestAnimationFrame(() => requestAnimationFrame(K)));
3232
3237
  const ge = await R();
@@ -3239,14 +3244,20 @@ let __tla = (async () => {
3239
3244
  } catch {
3240
3245
  return;
3241
3246
  }
3242
- }, []), Se = oe((v) => {
3247
+ }, []), Se = re((v) => {
3243
3248
  const _ = /* @__PURE__ */ new Date(), W = `${String(_.getHours()).padStart(2, "0")}:${String(_.getMinutes()).padStart(2, "0")}:${String(_.getSeconds()).padStart(2, "0")}.${String(_.getMilliseconds()).padStart(3, "0")}`;
3244
3249
  Ht((R) => [
3245
3250
  ...R.slice(-200),
3246
3251
  `[${W}] ${v}`
3247
3252
  ]);
3248
- }, []), { landmarkPoints: T, clearLandmarkPoints: In, addLandmarkPoint: Vt, removeLandmarkPoint: jt, updateLandmarkPositions: Nt, setAligned: Yt, isAligned: ee, setCut: Xt, isCut: vt } = It(), nt = F * at;
3249
- re(() => {
3253
+ }, []), { landmarkPoints: T, clearLandmarkPoints: _n, addLandmarkPoint: Vt, removeLandmarkPoint: jt, updateLandmarkPositions: Nt, setAligned: Yt, isAligned: ee, setCut: Xt, isCut: vt, reset: Gt } = It();
3254
+ ne(() => {
3255
+ Gt();
3256
+ }, [
3257
+ Gt
3258
+ ]);
3259
+ const nt = F * at;
3260
+ ne(() => {
3250
3261
  if (!s || T.length === 0) return;
3251
3262
  const v = T[T.length - 1];
3252
3263
  Se(`LANDMARK[${T.length - 1}]: placed at (${v.position.x.toFixed(1)}, ${v.position.y.toFixed(1)}, ${v.position.z.toFixed(1)}) face=${v.faceIndex}`);
@@ -3254,37 +3265,37 @@ let __tla = (async () => {
3254
3265
  T.length,
3255
3266
  s,
3256
3267
  Se
3257
- ]), re(() => {
3268
+ ]), ne(() => {
3258
3269
  s && ee && Se("STATE: mesh aligned");
3259
3270
  }, [
3260
3271
  ee,
3261
3272
  s,
3262
3273
  Se
3263
- ]), re(() => {
3274
+ ]), ne(() => {
3264
3275
  s && vt && Se("STATE: mesh cut");
3265
3276
  }, [
3266
3277
  vt,
3267
3278
  s,
3268
3279
  Se
3269
- ]), re(() => {
3280
+ ]), ne(() => {
3270
3281
  tt.current && (tt.current.scrollTop = tt.current.scrollHeight);
3271
3282
  }, [
3272
3283
  yt
3273
3284
  ]);
3274
- const Gt = j(() => xe ? new O.Mesh(xe) : null, [
3285
+ const Zt = j(() => xe ? new O.Mesh(xe) : null, [
3275
3286
  xe
3276
3287
  ]);
3277
- re(() => {
3288
+ ne(() => {
3278
3289
  o && gt(o);
3279
3290
  }, [
3280
3291
  o
3281
- ]), re(() => {
3292
+ ]), ne(() => {
3282
3293
  o || gt(void 0);
3283
3294
  }, [
3284
3295
  F
3285
3296
  ]);
3286
3297
  const Ct = le(false);
3287
- re(() => {
3298
+ ne(() => {
3288
3299
  if (!ee || V.length === 0 || Ct.current || !c) return;
3289
3300
  Ct.current = true;
3290
3301
  const v = T.length >= 3 ? Math.abs(T[2].position.y - T[0].position.y) : null;
@@ -3306,12 +3317,12 @@ let __tla = (async () => {
3306
3317
  }, [
3307
3318
  ee,
3308
3319
  V
3309
- ]), re(() => {
3310
- a !== void 0 && ($e.current = a), Ln(true);
3320
+ ]), ne(() => {
3321
+ a !== void 0 && ($e.current = a), Pn(true);
3311
3322
  }, [
3312
3323
  a
3313
3324
  ]);
3314
- const Ue = oe((v, _) => {
3325
+ const Ue = re((v, _) => {
3315
3326
  v.computeBoundingBox();
3316
3327
  const W = v.boundingBox, R = new C();
3317
3328
  W.getCenter(R), v.translate(-R.x, -R.y, -R.z), v.computeBoundingBox();
@@ -3322,7 +3333,7 @@ let __tla = (async () => {
3322
3333
  side: O.DoubleSide
3323
3334
  }));
3324
3335
  h(K), fe(_), J(true), he(false), bt.current = false;
3325
- }, []), Je = oe(async (v, _) => {
3336
+ }, []), Je = re(async (v, _) => {
3326
3337
  Ie(null);
3327
3338
  const W = _.toLowerCase(), R = W.endsWith(".stl");
3328
3339
  if (!W.endsWith(".obj") && !R) {
@@ -3348,13 +3359,13 @@ let __tla = (async () => {
3348
3359
  G = await Ft(ke);
3349
3360
  }
3350
3361
  else G = typeof v == "string" ? v : new TextDecoder().decode(v);
3351
- const K = performance.now(), te = $e.current ? await so(G, $e.current, (Q) => {
3362
+ const K = performance.now(), te = $e.current ? await lo(G, $e.current, (Q) => {
3352
3363
  x(Q), Se(`PREPROCESS: ${Q}`);
3353
3364
  }) : null;
3354
3365
  if (te) Se(`PREPROCESS: done in ${(performance.now() - K).toFixed(0)}ms \u2014 unit=${te.detectedUnit}, scaled=${te.wasScaled}`), e.showAmputationModal && !r ? (D(te), z(true)) : Ue(te.geometry, te.wasScaled);
3355
3366
  else {
3356
3367
  x("Using fallback loader...");
3357
- const Q = lo(G);
3368
+ const Q = ao(G);
3358
3369
  Q ? e.showAmputationModal && !r ? (D({
3359
3370
  geometry: Q,
3360
3371
  wasScaled: false
@@ -3371,7 +3382,7 @@ let __tla = (async () => {
3371
3382
  r,
3372
3383
  Ue
3373
3384
  ]);
3374
- re(() => {
3385
+ ne(() => {
3375
3386
  if (!t || !Ge) return;
3376
3387
  (async () => {
3377
3388
  f(true), x("Loading scan...");
@@ -3394,11 +3405,11 @@ let __tla = (async () => {
3394
3405
  t,
3395
3406
  Ge
3396
3407
  ]);
3397
- const _n = oe((v) => {
3408
+ const Dn = re((v) => {
3398
3409
  v.preventDefault(), g(true);
3399
- }, []), Dn = oe((v) => {
3410
+ }, []), Bn = re((v) => {
3400
3411
  v.preventDefault(), g(false);
3401
- }, []), Bn = oe(async (v) => {
3412
+ }, []), Rn = re(async (v) => {
3402
3413
  if (v.preventDefault(), g(false), !Ge) {
3403
3414
  Ie("WASM module is still loading. Please wait.");
3404
3415
  return;
@@ -3425,7 +3436,7 @@ let __tla = (async () => {
3425
3436
  }, [
3426
3437
  Ge,
3427
3438
  Je
3428
- ]), Rn = oe((v) => {
3439
+ ]), Wn = re((v) => {
3429
3440
  A(v), P(v === "AK" ? 2 : 1), z(false), y && (Ue(y.geometry, y.wasScaled), D(null)), c == null ? void 0 : c("file_loaded", {
3430
3441
  spacing_type: v,
3431
3442
  file_format: Oe,
@@ -3437,7 +3448,7 @@ let __tla = (async () => {
3437
3448
  c,
3438
3449
  Oe
3439
3450
  ]);
3440
- re(() => {
3451
+ ne(() => {
3441
3452
  if (!n || T.length !== 1 || !$e.current || bt.current) return;
3442
3453
  bt.current = true;
3443
3454
  const v = T[0], _ = $e.current, W = n.geometry, { positions: R, indices: ge } = ct(W), G = new Float32Array([
@@ -3445,13 +3456,13 @@ let __tla = (async () => {
3445
3456
  v.position.y,
3446
3457
  v.position.z
3447
3458
  ]), K = _.detect_shell(R, ge, G, 40), te = K.details(), Q = K.is_double_shell();
3448
- Se(`SHELL_DETECT: ${Q ? "DOUBLE" : "SINGLE"} \u2014 ${te}`), Q && (pe(true), ne(true), Se(`SHELL_DETECT: double shell, thickness=${K.thickness().toFixed(1)}mm`));
3459
+ Se(`SHELL_DETECT: ${Q ? "DOUBLE" : "SINGLE"} \u2014 ${te}`), Q && (pe(true), oe(true), Se(`SHELL_DETECT: double shell, thickness=${K.thickness().toFixed(1)}mm`));
3449
3460
  }, [
3450
3461
  n,
3451
3462
  T,
3452
3463
  Se
3453
3464
  ]);
3454
- const Wn = oe(() => {
3465
+ const En = re(() => {
3455
3466
  if (!n || T.length < 2) return;
3456
3467
  N(true), be("Please wait..."), Se("PIPELINE: starting processing pipeline...");
3457
3468
  const v = performance.now();
@@ -3461,7 +3472,7 @@ let __tla = (async () => {
3461
3472
  T[0],
3462
3473
  ...T.slice(2)
3463
3474
  ];
3464
- po(n, _, at, {
3475
+ ho(n, _, at, {
3465
3476
  onStatus: (W) => {
3466
3477
  be(W), Se(`PIPELINE: ${W}`);
3467
3478
  },
@@ -3478,12 +3489,12 @@ let __tla = (async () => {
3478
3489
  setAligned: Yt,
3479
3490
  setCut: Xt,
3480
3491
  setModelSize: u,
3481
- setOriginalEndY: Sn,
3492
+ setOriginalEndY: vn,
3482
3493
  setAdjustedStartY: se,
3483
3494
  setAdjustedEndY: _t,
3484
3495
  setError: Ie,
3485
3496
  setDoubleShell: (W) => {
3486
- pe(W), ne(true);
3497
+ pe(W), oe(true);
3487
3498
  },
3488
3499
  setAoData: (W, R) => {
3489
3500
  ue(W), q(R ?? null);
@@ -3503,9 +3514,9 @@ let __tla = (async () => {
3503
3514
  jt,
3504
3515
  Xt,
3505
3516
  Z
3506
- ]), Zt = le(false);
3507
- re(() => {
3508
- ee && V.length > 0 && !Zt.current && (Zt.current = true, mt(true));
3517
+ ]), Kt = le(false);
3518
+ ne(() => {
3519
+ ee && V.length > 0 && !Kt.current && (Kt.current = true, mt(true));
3509
3520
  }, [
3510
3521
  ee,
3511
3522
  V.length
@@ -3522,9 +3533,9 @@ let __tla = (async () => {
3522
3533
  n,
3523
3534
  T,
3524
3535
  Y
3525
- ]), En = oe((v) => {
3526
- kn(v), gt(v.circumferences), mt(false), Et(true), An(true);
3527
- }, []), Tn = oe(async (v) => {
3536
+ ]), Tn = re((v) => {
3537
+ Fn(v), gt(v.circumferences), mt(false), Et(true), kn(true);
3538
+ }, []), On = re(async (v) => {
3528
3539
  if (!l || !n || !w) return;
3529
3540
  mt(false);
3530
3541
  const _ = await Ke();
@@ -3556,13 +3567,13 @@ let __tla = (async () => {
3556
3567
  Qe,
3557
3568
  t,
3558
3569
  Ke
3559
- ]), Mt = oe(async (v) => {
3570
+ ]), Mt = re(async (v) => {
3560
3571
  if (!l || !n || V.length === 0 || !w) return;
3561
3572
  let _ = 0, W = 0;
3562
3573
  if (T.length >= 2) {
3563
3574
  const ge = n.geometry, K = T[0].position.y;
3564
3575
  try {
3565
- const te = gn(ge), Q = Ne(te, ge, K);
3576
+ const te = mn(ge), Q = Ne(te, ge, K);
3566
3577
  if (Q.linePoints.length >= 2) {
3567
3578
  let ke = Q.linePoints[0], Re = Q.linePoints[0], ve = Q.linePoints[0], Me = Q.linePoints[0];
3568
3579
  for (const ye of Q.linePoints) ye.x < ke.x && (ke = ye), ye.x > Re.x && (Re = ye), ye.z < ve.z && (ve = ye), ye.z > Me.z && (Me = ye);
@@ -3602,7 +3613,7 @@ let __tla = (async () => {
3602
3613
  xt,
3603
3614
  Qe,
3604
3615
  Ke
3605
- ]), On = j(() => {
3616
+ ]), $n = j(() => {
3606
3617
  if (!Ae || V.length === 0) return false;
3607
3618
  const v = Math.min(Ae.length, V.length);
3608
3619
  if (v === 0) return false;
@@ -3616,7 +3627,7 @@ let __tla = (async () => {
3616
3627
  }, [
3617
3628
  Ae,
3618
3629
  V
3619
- ]), $n = Ot ? 5 : ee && Tt || ee ? 4 : n ? T.length === 0 ? 2 : 3 : 1, Hn = [
3630
+ ]), Hn = Ot ? 5 : ee && Tt || ee ? 4 : n ? T.length === 0 ? 2 : 3 : 1, Vn = [
3620
3631
  {
3621
3632
  label: "Load File",
3622
3633
  number: 1
@@ -3638,7 +3649,7 @@ let __tla = (async () => {
3638
3649
  number: 5
3639
3650
  }
3640
3651
  ];
3641
- return L(to.Provider, {
3652
+ return L(no.Provider, {
3642
3653
  value: e,
3643
3654
  children: [
3644
3655
  L("div", {
@@ -3670,9 +3681,9 @@ let __tla = (async () => {
3670
3681
  }
3671
3682
  })
3672
3683
  }),
3673
- i(Io, {
3674
- steps: Hn,
3675
- currentStep: $n
3684
+ i(_o, {
3685
+ steps: Vn,
3686
+ currentStep: Hn
3676
3687
  }),
3677
3688
  L("div", {
3678
3689
  style: {
@@ -3690,9 +3701,9 @@ let __tla = (async () => {
3690
3701
  minHeight: 0,
3691
3702
  overflow: "hidden"
3692
3703
  },
3693
- onDragOver: e.showDragDrop ? _n : void 0,
3694
- onDragLeave: e.showDragDrop ? Dn : void 0,
3695
- onDrop: e.showDragDrop ? Bn : void 0,
3704
+ onDragOver: e.showDragDrop ? Dn : void 0,
3705
+ onDragLeave: e.showDragDrop ? Bn : void 0,
3706
+ onDrop: e.showDragDrop ? Rn : void 0,
3696
3707
  children: [
3697
3708
  e.showDragDrop && !n && !M && i("div", {
3698
3709
  style: {
@@ -3844,13 +3855,13 @@ let __tla = (async () => {
3844
3855
  "Click mesh to set Origin"
3845
3856
  ]
3846
3857
  }),
3847
- M && i(en, {
3858
+ M && i(tn, {
3848
3859
  message: m || "Processing mesh..."
3849
3860
  }),
3850
- $ && i(en, {
3861
+ $ && i(tn, {
3851
3862
  message: U
3852
3863
  }),
3853
- ht && i(go, {
3864
+ ht && i(mo, {
3854
3865
  message: ht,
3855
3866
  onDismiss: () => Ie(null)
3856
3867
  }),
@@ -3985,7 +3996,7 @@ let __tla = (async () => {
3985
3996
  children: "Cancel"
3986
3997
  }),
3987
3998
  i("button", {
3988
- onClick: () => w && Rn(w),
3999
+ onClick: () => w && Wn(w),
3989
4000
  disabled: !w,
3990
4001
  style: {
3991
4002
  padding: "6px 16px",
@@ -4017,8 +4028,8 @@ let __tla = (async () => {
4017
4028
  zIndex: 10
4018
4029
  }
4019
4030
  }),
4020
- i(ho, {
4021
- children: L(Kn, {
4031
+ i(go, {
4032
+ children: L(Un, {
4022
4033
  camera: {
4023
4034
  position: [
4024
4035
  0,
@@ -4065,15 +4076,15 @@ let __tla = (async () => {
4065
4076
  ],
4066
4077
  intensity: 0.2
4067
4078
  }),
4068
- n && S === "3D" && i(xo, {
4079
+ n && S === "3D" && i(yo, {
4069
4080
  mesh: n,
4070
4081
  maxPoints: 2,
4071
4082
  meshColor: $t,
4072
- meshOpacity: Be ? 0.3 : Fn,
4083
+ meshOpacity: Be ? 0.3 : Ln,
4073
4084
  frontFaceOnly: Z,
4074
4085
  doubleShellTransparency: Y && ee
4075
4086
  }),
4076
- n && S === "3D" && i(bo, {
4087
+ n && S === "3D" && i(wo, {
4077
4088
  modelSize: d,
4078
4089
  labels: [
4079
4090
  w === "AK" ? "IT" : "MPT",
@@ -4081,7 +4092,7 @@ let __tla = (async () => {
4081
4092
  "Cut Plane"
4082
4093
  ]
4083
4094
  }),
4084
- i(ko, {
4095
+ i(Fo, {
4085
4096
  modelSize: d,
4086
4097
  isAligned: ee,
4087
4098
  isCut: vt,
@@ -4092,19 +4103,19 @@ let __tla = (async () => {
4092
4103
  measurementGeometry: xe,
4093
4104
  resetCameraToFrontRef: wt
4094
4105
  }),
4095
- !ee && i(ln, {
4106
+ !ee && i(an, {
4096
4107
  enableDamping: false
4097
4108
  }),
4098
- ee && V.length > 0 && n && S === "3D" && i(Fo, {
4109
+ ee && V.length > 0 && n && S === "3D" && i(Lo, {
4099
4110
  mesh: n,
4100
- isDragging: vn
4111
+ isDragging: Cn
4101
4112
  }),
4102
4113
  n && ee && T.length >= 3 && (() => {
4103
4114
  const _ = n.geometry.getIndex();
4104
4115
  if (!_ || _.count < 30) return null;
4105
4116
  const W = T[2], R = T[0], ge = Xe ?? W.position.y, G = ze ?? pt ?? R.position.y;
4106
- return S === "2D" ? i(_o, {
4107
- mesh: Gt ?? n,
4117
+ return S === "2D" ? i(Do, {
4118
+ mesh: Zt ?? n,
4108
4119
  upperY: G,
4109
4120
  originY: R.position.y,
4110
4121
  modelSize: d,
@@ -4112,8 +4123,8 @@ let __tla = (async () => {
4112
4123
  displayUnit: k
4113
4124
  }) : L(Te, {
4114
4125
  children: [
4115
- i(zo, {
4116
- mesh: Gt ?? n,
4126
+ i(Ao, {
4127
+ mesh: Zt ?? n,
4117
4128
  startY: ge,
4118
4129
  endY: G,
4119
4130
  spacing: nt,
@@ -4126,18 +4137,18 @@ let __tla = (async () => {
4126
4137
  originY: Bt ?? R.position.y,
4127
4138
  wasmSlices: Le
4128
4139
  }),
4129
- i(Ao, {
4140
+ i(ko, {
4130
4141
  mesh: n,
4131
4142
  greenY: R.position.y,
4132
4143
  modelSize: d,
4133
4144
  displayUnit: k,
4134
4145
  bottomY: Y ? W.position.y : void 0
4135
4146
  }),
4136
- i(Do, {
4147
+ i(Bo, {
4137
4148
  mesh: n,
4138
4149
  yPosition: Bt ?? R.position.y,
4139
4150
  onYChange: (K) => {
4140
- Cn(K), Pe(null);
4151
+ Mn(K), Pe(null);
4141
4152
  const te = K - R.position.y;
4142
4153
  _t((pt ?? R.position.y + nt * 2) + te);
4143
4154
  },
@@ -4154,10 +4165,10 @@ let __tla = (async () => {
4154
4165
  ]
4155
4166
  });
4156
4167
  })(),
4157
- n && ee && S === "3D" && Be && i(Jo, {
4168
+ n && ee && S === "3D" && Be && i(Qo, {
4158
4169
  mesh: n
4159
4170
  }),
4160
- n && e.showDebug && Be && S === "3D" && i(Uo, {
4171
+ n && e.showDebug && Be && S === "3D" && i(Jo, {
4161
4172
  mesh: n,
4162
4173
  modelSize: d,
4163
4174
  layers: Rt,
@@ -4167,8 +4178,8 @@ let __tla = (async () => {
4167
4178
  aoGeometry: H,
4168
4179
  measurementGeometry: xe
4169
4180
  }),
4170
- i(tr, {
4171
- screenshotFnRef: Pn,
4181
+ i(nr, {
4182
+ screenshotFnRef: In,
4172
4183
  mesh: n,
4173
4184
  modelSize: d,
4174
4185
  measurementGeometry: xe
@@ -4204,7 +4215,7 @@ let __tla = (async () => {
4204
4215
  children: "Start Over"
4205
4216
  }),
4206
4217
  !ee && T.length >= 1 && i("button", {
4207
- onClick: In,
4218
+ onClick: _n,
4208
4219
  style: {
4209
4220
  padding: "6px 16px",
4210
4221
  borderRadius: 4,
@@ -4222,9 +4233,9 @@ let __tla = (async () => {
4222
4233
  })
4223
4234
  ]
4224
4235
  }),
4225
- e.showDebug && Be && n && S === "3D" && i(qo, {
4236
+ e.showDebug && Be && n && S === "3D" && i(er, {
4226
4237
  layers: Rt,
4227
- onToggleLayer: (v) => zn((_) => ({
4238
+ onToggleLayer: (v) => An((_) => ({
4228
4239
  ..._,
4229
4240
  [v]: !_[v]
4230
4241
  })),
@@ -4423,7 +4434,7 @@ let __tla = (async () => {
4423
4434
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
4424
4435
  },
4425
4436
  children: i("button", {
4426
- onClick: () => Mn((v) => !v),
4437
+ onClick: () => zn((v) => !v),
4427
4438
  style: {
4428
4439
  padding: "6px 14px",
4429
4440
  fontSize: 13,
@@ -4439,13 +4450,13 @@ let __tla = (async () => {
4439
4450
  })
4440
4451
  ]
4441
4452
  }),
4442
- n && ie && i(Lo, {
4453
+ n && ie && i(Po, {
4443
4454
  wasAutoScaled: ae,
4444
4455
  onDismiss: () => J(false)
4445
4456
  }),
4446
- n && we && ee && i(Po, {
4457
+ n && we && ee && i(Io, {
4447
4458
  isDoubleShell: Y,
4448
- onDismiss: () => ne(false)
4459
+ onDismiss: () => oe(false)
4449
4460
  })
4450
4461
  ]
4451
4462
  }),
@@ -4462,7 +4473,7 @@ let __tla = (async () => {
4462
4473
  },
4463
4474
  children: [
4464
4475
  n && !ee && T.length >= 2 && i("button", {
4465
- onClick: Wn,
4476
+ onClick: En,
4466
4477
  style: {
4467
4478
  padding: "6px 16px",
4468
4479
  borderRadius: 4,
@@ -4478,7 +4489,7 @@ let __tla = (async () => {
4478
4489
  },
4479
4490
  children: "Next \xBB"
4480
4491
  }),
4481
- ee && Ot && (On ? i("button", {
4492
+ ee && Ot && ($n ? i("button", {
4482
4493
  onClick: () => Mt("continue"),
4483
4494
  style: {
4484
4495
  padding: "6px 16px",
@@ -4633,25 +4644,25 @@ let __tla = (async () => {
4633
4644
  })
4634
4645
  ]
4635
4646
  }),
4636
- ee && Tt && w && i(To, {
4647
+ ee && Tt && w && i(Oo, {
4637
4648
  amputationType: w,
4638
4649
  spacingInches: F,
4639
4650
  scanMeasurements: V,
4640
4651
  scanFrontalHeight: Qe,
4641
- onSave: En,
4642
- onSkip: Tn
4652
+ onSave: Tn,
4653
+ onSkip: On
4643
4654
  })
4644
4655
  ]
4645
4656
  });
4646
4657
  };
4647
- function tr({ screenshotFnRef: e }) {
4648
- return re(() => {
4658
+ function nr({ screenshotFnRef: e }) {
4659
+ return ne(() => {
4649
4660
  e.current = null;
4650
4661
  }, [
4651
4662
  e
4652
4663
  ]), null;
4653
4664
  }
4654
- wn = function(e) {
4665
+ Sn = function(e) {
4655
4666
  const r = e === "AK" ? 2 : 1, t = [];
4656
4667
  for (let o = 2; o >= 1; o -= r) t.push(`${o}_above`);
4657
4668
  t.push("at_ref");
@@ -4671,23 +4682,23 @@ let __tla = (async () => {
4671
4682
  return t;
4672
4683
  };
4673
4684
  lt = function(e, r) {
4674
- const t = wn(r), o = {};
4685
+ const t = Sn(r), o = {};
4675
4686
  for (let l = 0; l < Math.min(e.length, t.length); l++) {
4676
4687
  const s = e[l];
4677
4688
  s != null && !isNaN(s) && (o[t[l]] = s);
4678
4689
  }
4679
4690
  return o;
4680
4691
  };
4681
- nr = function(e, r) {
4692
+ or = function(e, r) {
4682
4693
  if (!e) return;
4683
- const o = wn(r).map((l) => {
4694
+ const o = Sn(r).map((l) => {
4684
4695
  const s = e[l];
4685
4696
  return s ?? void 0;
4686
4697
  });
4687
4698
  if (!o.every((l) => l == null)) return o;
4688
4699
  };
4689
- pr = ({ request: e, onComplete: r, wasmModule: t }) => {
4690
- const o = j(() => nr(e.form_measurements, e.spacing_type), [
4700
+ hr = ({ request: e, onComplete: r, wasmModule: t }) => {
4701
+ const o = j(() => or(e.form_measurements, e.spacing_type), [
4691
4702
  e.form_measurements,
4692
4703
  e.spacing_type
4693
4704
  ]), l = (s) => {
@@ -4735,8 +4746,8 @@ let __tla = (async () => {
4735
4746
  height: "100%",
4736
4747
  display: "flex"
4737
4748
  },
4738
- children: i(er, {
4739
- config: eo,
4749
+ children: i(tr, {
4750
+ config: to,
4740
4751
  spacingType: e.spacing_type,
4741
4752
  scanUrl: e.scan_url,
4742
4753
  formMeasurements: o,
@@ -4747,9 +4758,9 @@ let __tla = (async () => {
4747
4758
  };
4748
4759
  })();
4749
4760
  export {
4750
- pr as G,
4761
+ hr as G,
4751
4762
  __tla,
4752
4763
  lt as a,
4753
- nr as c,
4754
- wn as g
4764
+ or as c,
4765
+ Sn as g
4755
4766
  };