@solid-labs/fab-one-widget 1.1.7 → 1.1.9

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
- import { jsxs as w, jsx as i, Fragment as Re } from "react/jsx-runtime";
2
- import { createContext as Mo, Component as Fo, useCallback as ce, useMemo as J, useState as E, memo as ko, useEffect as X, useRef as de, forwardRef as Po, createElement as An } from "react";
1
+ import { jsxs as y, jsx as i, Fragment as Re } from "react/jsx-runtime";
2
+ import { createContext as Mo, Component as Fo, useCallback as ce, useMemo as J, useState as E, memo as Po, useEffect as G, useRef as de, forwardRef as ko, createElement as An } from "react";
3
3
  import { useFrame as Rn, useThree as Wn, Canvas as Lo } from "@react-three/fiber";
4
4
  import { Html as Xe, Line as ye, OrbitControls as In } from "@react-three/drei";
5
5
  import * as Z from "three";
6
- import { Plane as Ct, Vector3 as M, Box3 as Bn, Line3 as En, Raycaster as Do } from "three";
6
+ import { Plane as St, Vector3 as M, Box3 as Bn, Line3 as En, Raycaster as Do } from "three";
7
7
  import { create as _o } from "zustand";
8
8
  import { OBJLoader as Tn } from "three/examples/jsm/loaders/OBJLoader.js";
9
9
  import { STLLoader as Ro } from "three/examples/jsm/loaders/STLLoader.js";
10
- import { MeshBVH as At } from "three-mesh-bvh";
11
- let Ur, wt, Tr, Yn, qt;
10
+ import { MeshBVH as Ct } from "three-mesh-bvh";
11
+ let Ur, yt, Tr, Yn, Zt;
12
12
  let __tla = (async () => {
13
- let Wo, Io, Bo, Eo, zt, Kt, vt, To;
13
+ let Wo, Io, Bo, Eo, At, Yt, wt, To;
14
14
  Wo = {
15
15
  showDragDrop: true,
16
16
  showStartOver: true,
@@ -32,7 +32,7 @@ let __tla = (async () => {
32
32
  showSaveButton: false
33
33
  };
34
34
  Bo = Mo(Wo);
35
- qt = _o((e, r) => ({
35
+ Zt = _o((e, r) => ({
36
36
  landmarkPoints: [],
37
37
  isAligned: false,
38
38
  isCut: false,
@@ -70,9 +70,9 @@ let __tla = (async () => {
70
70
  })
71
71
  }));
72
72
  Eo = 0.45;
73
- zt = 3;
74
- Kt = 1e-3;
75
- vt = 25.4;
73
+ At = 3;
74
+ Yt = 1e-3;
75
+ wt = 25.4;
76
76
  To = [
77
77
  0.25,
78
78
  -0.25,
@@ -103,17 +103,17 @@ let __tla = (async () => {
103
103
  const s = e.getAttribute("position"), l = s.count, c = new Float32Array(l * 3), a = r.length / 3;
104
104
  let o = 1 / 0, d = 1 / 0, p = 1 / 0, u = -1 / 0, f = -1 / 0, h = -1 / 0;
105
105
  for (let I = 0; I < a; I++) {
106
- const P = r[I * 3] * n, T = r[I * 3 + 1] * n, j = r[I * 3 + 2] * n;
107
- P < o && (o = P), P > u && (u = P), T < d && (d = T), T > f && (f = T), j < p && (p = j), j > h && (h = j);
106
+ const k = r[I * 3] * n, T = r[I * 3 + 1] * n, j = r[I * 3 + 2] * n;
107
+ k < o && (o = k), k > u && (u = k), T < d && (d = T), T > f && (f = T), j < p && (p = j), j > h && (h = j);
108
108
  }
109
- const v = (o + u) * 0.5, g = (d + f) * 0.5, x = (p + h) * 0.5, y = u - o + 1e-6, A = f - d + 1e-6, b = h - p + 1e-6, k = y * 0.5, S = A * 0.5, C = b * 0.5, z = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), _ = y / z, B = A / z, V = b / z, F = /* @__PURE__ */ new Map();
109
+ const v = (o + u) * 0.5, g = (d + f) * 0.5, x = (p + h) * 0.5, w = u - o + 1e-6, A = f - d + 1e-6, b = h - p + 1e-6, P = w * 0.5, S = A * 0.5, C = b * 0.5, z = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), _ = w / z, B = A / z, V = b / z, F = /* @__PURE__ */ new Map();
110
110
  for (let I = 0; I < a; I++) {
111
- const P = r[I * 3] * n - v, T = r[I * 3 + 1] * n - g, j = r[I * 3 + 2] * n - x, ee = Math.min(z - 1, Math.max(0, Math.floor((P + k) / _))), ie = Math.min(z - 1, Math.max(0, Math.floor((T + S) / B))), oe = Math.min(z - 1, Math.max(0, Math.floor((j + C) / V))), q = ee * z * z + ie * z + oe;
111
+ const k = r[I * 3] * n - v, T = r[I * 3 + 1] * n - g, j = r[I * 3 + 2] * n - x, ee = Math.min(z - 1, Math.max(0, Math.floor((k + P) / _))), ie = Math.min(z - 1, Math.max(0, Math.floor((T + S) / B))), oe = Math.min(z - 1, Math.max(0, Math.floor((j + C) / V))), q = ee * z * z + ie * z + oe;
112
112
  let re = F.get(q);
113
113
  re || (re = [], F.set(q, re)), re.push(I);
114
114
  }
115
115
  for (let I = 0; I < l; I++) {
116
- const P = s.getX(I), T = s.getY(I), j = s.getZ(I), ee = Math.min(z - 1, Math.max(0, Math.floor((P + k) / _))), ie = Math.min(z - 1, Math.max(0, Math.floor((T + S) / B))), oe = Math.min(z - 1, Math.max(0, Math.floor((j + C) / V)));
116
+ const k = s.getX(I), T = s.getY(I), j = s.getZ(I), ee = Math.min(z - 1, Math.max(0, Math.floor((k + P) / _))), ie = Math.min(z - 1, Math.max(0, Math.floor((T + S) / B))), oe = Math.min(z - 1, Math.max(0, Math.floor((j + C) / V)));
117
117
  let q = 1 / 0, re = 0;
118
118
  for (let K = 0; K <= z && q > 0; K++) {
119
119
  for (let he = -K; he <= K; he++) for (let te = -K; te <= K; te++) for (let D = -K; D <= K; D++) {
@@ -122,7 +122,7 @@ let __tla = (async () => {
122
122
  if (O < 0 || O >= z || Q < 0 || Q >= z || U < 0 || U >= z) continue;
123
123
  const N = F.get(O * z * z + Q * z + U);
124
124
  if (N) for (const Y of N) {
125
- const fe = r[Y * 3] * n - v, se = r[Y * 3 + 1] * n - g, ge = r[Y * 3 + 2] * n - x, ue = (P - fe) ** 2 + (T - se) ** 2 + (j - ge) ** 2;
125
+ const fe = r[Y * 3] * n - v, se = r[Y * 3 + 1] * n - g, ge = r[Y * 3 + 2] * n - x, ue = (k - fe) ** 2 + (T - se) ** 2 + (j - ge) ** 2;
126
126
  ue < q && (q = ue, re = Y);
127
127
  }
128
128
  }
@@ -147,19 +147,19 @@ let __tla = (async () => {
147
147
  On = e;
148
148
  },
149
149
  debug(e, r, t) {
150
- bt("debug", e, r, t);
150
+ xt("debug", e, r, t);
151
151
  },
152
152
  info(e, r, t) {
153
- bt("info", e, r, t);
153
+ xt("info", e, r, t);
154
154
  },
155
155
  warn(e, r, t) {
156
- bt("warn", e, r, t);
156
+ xt("warn", e, r, t);
157
157
  },
158
158
  error(e, r, t) {
159
- bt("error", e, r, t);
159
+ xt("error", e, r, t);
160
160
  }
161
161
  };
162
- function bt(e, r, t, n) {
162
+ function xt(e, r, t, n) {
163
163
  if (zn[e] < zn[$n]) return;
164
164
  const s = `[${r}]`, l = n !== void 0 ? [
165
165
  s,
@@ -185,7 +185,7 @@ let __tla = (async () => {
185
185
  }
186
186
  On == null ? void 0 : On(e, r, t, n);
187
187
  }
188
- function St(e) {
188
+ function vt(e) {
189
189
  const r = e.getAttribute("position"), t = new Float32Array(r.array), n = e.getIndex();
190
190
  if (n) return {
191
191
  positions: t,
@@ -208,22 +208,22 @@ let __tla = (async () => {
208
208
  t == null ? void 0 : t("Parsing mesh...");
209
209
  const l = new Tn().parse(e);
210
210
  let c = null;
211
- if (l.traverse((y) => {
212
- y.isMesh && !c && (c = y.geometry);
211
+ if (l.traverse((w) => {
212
+ w.isMesh && !c && (c = w.geometry);
213
213
  }), !c) return null;
214
- const { positions: a, indices: o } = St(c);
214
+ const { positions: a, indices: o } = vt(c);
215
215
  if (a.length < 9 || o.length < 3) return be.warn("wasm", `Mesh too small: positions=${a.length} indices=${o.length}`), null;
216
- for (let y = 0; y < Math.min(a.length, 300); y++) if (!isFinite(a[y])) return be.error("wasm", `Invalid position data: NaN/Infinity at index ${y}`), null;
216
+ for (let w = 0; w < Math.min(a.length, 300); w++) if (!isFinite(a[w])) return be.error("wasm", `Invalid position data: NaN/Infinity at index ${w}`), null;
217
217
  const d = a.length / 3;
218
- for (let y = 0; y < Math.min(o.length, 300); y++) if (o[y] >= d) return be.error("wasm", `Out-of-bounds index: ${o[y]} >= ${d}`), null;
218
+ for (let w = 0; w < Math.min(o.length, 300); w++) if (o[w] >= d) return be.error("wasm", `Out-of-bounds index: ${o[w]} >= ${d}`), null;
219
219
  t == null ? void 0 : t("Processing mesh (WASM)...");
220
220
  const p = r.preprocess_mesh(a, o, 10, 1e-4, 500), u = p.positions(), f = p.indices(), h = p.unit_converted(), v = p.detected_unit(), g = p.log();
221
221
  if (be.debug("wasm", "preprocess result", g), u.length === 0) return null;
222
222
  t == null ? void 0 : t("Building geometry...");
223
223
  const x = Hn(u, f);
224
224
  if (n) {
225
- const y = h ? 1e3 : 1;
226
- Oo(x, n.positions, n.colors, y);
225
+ const w = h ? 1e3 : 1;
226
+ Oo(x, n.positions, n.colors, w);
227
227
  }
228
228
  return {
229
229
  geometry: x,
@@ -242,7 +242,7 @@ let __tla = (async () => {
242
242
  s.isMesh && !n && (n = s.geometry);
243
243
  }), n;
244
244
  }
245
- async function Yt(e) {
245
+ async function Gt(e) {
246
246
  const r = await e.arrayBuffer(), s = new Ro().parse(r).getAttribute("position");
247
247
  if (!s || s.count === 0) throw new Error("Empty STL geometry");
248
248
  const l = [];
@@ -261,7 +261,7 @@ let __tla = (async () => {
261
261
  for (const n of e) (t.length === 0 || t[t.length - 1].distanceTo(n) > r) && t.push(n.clone());
262
262
  return t.length > 2 && t[0].distanceTo(t[t.length - 1]) > r && t.push(t[0].clone()), t;
263
263
  }
264
- function Ue(e) {
264
+ function qe(e) {
265
265
  let r = 0;
266
266
  for (let t = 0; t < e.length - 1; t++) r += e[t].distanceTo(e[t + 1]);
267
267
  return r;
@@ -285,11 +285,11 @@ let __tla = (async () => {
285
285
  for (; h; ) {
286
286
  h = false;
287
287
  for (let g = l.length - 1; g >= 0; g--) {
288
- const { a: x, b: y } = l[g];
289
- if (x.equals(f[f.length - 1])) f.push(y);
290
- else if (y.equals(f[f.length - 1])) f.push(x);
291
- else if (x.equals(f[0])) f.unshift(y);
292
- else if (y.equals(f[0])) f.unshift(x);
288
+ const { a: x, b: w } = l[g];
289
+ if (x.equals(f[f.length - 1])) f.push(w);
290
+ else if (w.equals(f[f.length - 1])) f.push(x);
291
+ else if (x.equals(f[0])) f.unshift(w);
292
+ else if (w.equals(f[0])) f.unshift(x);
293
293
  else continue;
294
294
  l.splice(g, 1), h = true;
295
295
  }
@@ -299,8 +299,8 @@ let __tla = (async () => {
299
299
  }
300
300
  if (!c.length) return [];
301
301
  if (t) {
302
- c.sort((h, v) => Ue(v) - Ue(h));
303
- const u = Ue(c[0]), f = c.filter((h) => Ue(h) >= u * 0.3);
302
+ c.sort((h, v) => qe(v) - qe(h));
303
+ const u = qe(c[0]), f = c.filter((h) => qe(h) >= u * 0.3);
304
304
  return f[f.length - 1] ?? c[0];
305
305
  }
306
306
  const a = c.filter((u) => u.length >= 3 && u[0].distanceTo(u[u.length - 1]) < r * 10), o = a.length > 0 ? a : c;
@@ -316,7 +316,7 @@ let __tla = (async () => {
316
316
  return d;
317
317
  }
318
318
  function Mn(e, r, t, n = false) {
319
- const s = new Ct(new M(0, 1, 0), -t), l = [], c = new Bn();
319
+ const s = new St(new M(0, 1, 0), -t), l = [], c = new Bn();
320
320
  c.setFromBufferAttribute(r.getAttribute("position"));
321
321
  const a = {
322
322
  linePoints: [],
@@ -335,12 +335,12 @@ let __tla = (async () => {
335
335
  });
336
336
  }
337
337
  });
338
- const p = Vn(l, Kt, n);
338
+ const p = Vn(l, Yt, n);
339
339
  if (p.length < 2) return a;
340
- const u = Ue(p);
340
+ const u = qe(p);
341
341
  let f = -1 / 0, h = new M(0, t, 0);
342
342
  for (const g of p) g.x > f && (f = g.x, h = g.clone());
343
- const v = p.length > 2 && p[0].distanceTo(p[p.length - 1]) < Kt * 10;
343
+ const v = p.length > 2 && p[0].distanceTo(p[p.length - 1]) < Yt * 10;
344
344
  return {
345
345
  linePoints: p,
346
346
  lineLength: u,
@@ -348,7 +348,7 @@ let __tla = (async () => {
348
348
  isClosed: v
349
349
  };
350
350
  }
351
- function Ge(e, r, t, n = false) {
351
+ function je(e, r, t, n = false) {
352
352
  const s = Mn(e, r, t, n);
353
353
  if (s.isClosed && s.linePoints.length >= 3) return s;
354
354
  be.debug("slice", `y=${t.toFixed(2)} failed (pts=${s.linePoints.length}, closed=${s.isClosed}), retrying...`);
@@ -360,8 +360,8 @@ let __tla = (async () => {
360
360
  }
361
361
  return be.warn("slice", `y=${t.toFixed(2)} all retries exhausted (pts=${l.linePoints.length}, closed=${l.isClosed})`), l;
362
362
  }
363
- function Go(e, r, t, n) {
364
- const s = new Ct().setFromNormalAndCoplanarPoint(n.clone().normalize(), t), l = new Bn();
363
+ function Xo(e, r, t, n) {
364
+ const s = new St().setFromNormalAndCoplanarPoint(n.clone().normalize(), t), l = new Bn();
365
365
  if (l.setFromBufferAttribute(r.getAttribute("position")), !s.intersectsBox(l)) return 0;
366
366
  const c = [], a = new En(), o = new M();
367
367
  e.shapecast({
@@ -374,15 +374,15 @@ let __tla = (async () => {
374
374
  });
375
375
  }
376
376
  });
377
- const d = Vn(c, Kt);
378
- return Ue(d);
377
+ const d = Vn(c, Yt);
378
+ return qe(d);
379
379
  }
380
- function Zt(e) {
381
- return new At(e, {
382
- maxLeafTris: zt
380
+ function Kt(e) {
381
+ return new Ct(e, {
382
+ maxLeafTris: At
383
383
  });
384
384
  }
385
- function Xo(e, r, t, n) {
385
+ function Go(e, r, t, n) {
386
386
  const s = e.getIndex(), l = s ? s.count / 3 : 0;
387
387
  if (l < 10) return {
388
388
  valid: false,
@@ -397,9 +397,9 @@ let __tla = (async () => {
397
397
  valid: false,
398
398
  reason: `Height too large (${c.toFixed(1)}mm > 1000mm)`
399
399
  };
400
- const a = new At(e, {
401
- maxLeafTris: zt
402
- }), o = Ge(a, e, r);
400
+ const a = new Ct(e, {
401
+ maxLeafTris: At
402
+ }), o = je(a, e, r);
403
403
  if (o.lineLength === 0) return {
404
404
  valid: false,
405
405
  reason: "No circumference at green point \u2014 mesh may be empty at that height"
@@ -409,7 +409,7 @@ let __tla = (async () => {
409
409
  valid: true,
410
410
  reason: ""
411
411
  };
412
- const p = Ge(a, e, d);
412
+ const p = je(a, e, d);
413
413
  if (o.lineLength > 0 && p.lineLength > 0) {
414
414
  const f = o.lineLength / p.lineLength;
415
415
  if (f < 0.5) return {
@@ -419,7 +419,7 @@ let __tla = (async () => {
419
419
  }
420
420
  const u = r - n * 2;
421
421
  if (u > t) {
422
- const f = Ge(a, e, u);
422
+ const f = je(a, e, u);
423
423
  if (p.lineLength > 0 && f.lineLength > 0) {
424
424
  const h = p.lineLength / f.lineLength;
425
425
  if (h < 0.5) return {
@@ -433,7 +433,7 @@ let __tla = (async () => {
433
433
  reason: ""
434
434
  };
435
435
  }
436
- const Pe = "pipeline";
436
+ const ke = "pipeline";
437
437
  function Yo(e, r, t, n) {
438
438
  var _a, _b, _c, _d;
439
439
  const s = e.geometry.clone(), l = r.map((a) => ({
@@ -443,16 +443,16 @@ let __tla = (async () => {
443
443
  let a = e.geometry, o = l.map((N) => new M(N.position.x, N.position.y, N.position.z));
444
444
  const d = o[0], p = o[1];
445
445
  if (!c) {
446
- n.onStatus("Aligning mesh (JS fallback)..."), be.warn(Pe, "WASM not available, using JS fallback alignment");
446
+ n.onStatus("Aligning mesh (JS fallback)..."), be.warn(ke, "WASM not available, using JS fallback alignment");
447
447
  const N = new M(0, 1, 0), Y = new M().subVectors(p, d).normalize(), fe = Y.dot(N), se = new M().crossVectors(Y, N);
448
448
  if (se.length() > 1e-4) {
449
449
  se.normalize();
450
450
  const $ = new Z.Quaternion().setFromAxisAngle(se, Math.acos(Math.min(1, Math.max(-1, fe))));
451
- a.applyMatrix4(new Z.Matrix4().makeRotationFromQuaternion($)), o = o.map((ke) => ke.clone().applyQuaternion($));
451
+ a.applyMatrix4(new Z.Matrix4().makeRotationFromQuaternion($)), o = o.map((Pe) => Pe.clone().applyQuaternion($));
452
452
  }
453
453
  if (o[0].y > o[1].y) {
454
454
  const $ = new Z.Quaternion().setFromAxisAngle(new M(1, 0, 0), Math.PI);
455
- a.applyMatrix4(new Z.Matrix4().makeRotationFromQuaternion($)), o = o.map((ke) => ke.clone().applyQuaternion($));
455
+ a.applyMatrix4(new Z.Matrix4().makeRotationFromQuaternion($)), o = o.map((Pe) => Pe.clone().applyQuaternion($));
456
456
  }
457
457
  const ge = o[0].clone();
458
458
  a.translate(-ge.x, -ge.y, -ge.z), o = o.map(($) => new M($.x - ge.x, $.y - ge.y, $.z - ge.z)), a.computeVertexNormals(), a.computeBoundingBox();
@@ -478,12 +478,12 @@ let __tla = (async () => {
478
478
  x: $.x,
479
479
  y: $.y,
480
480
  z: $.z
481
- }))), n.setAligned(true), n.setCut(true), n.setAdjustedStartY(null), n.setAdjustedEndY(null), n.setOriginalEndY(o[1].y + 2 * vt);
481
+ }))), n.setAligned(true), n.setCut(true), n.setAdjustedStartY(null), n.setAdjustedEndY(null), n.setOriginalEndY(o[1].y + 2 * wt);
482
482
  const we = new M();
483
483
  a.computeBoundingBox(), a.boundingBox.getSize(we), n.setModelSize(Math.max(we.x, we.y, we.z)), s.dispose();
484
484
  return;
485
485
  }
486
- const { positions: u, indices: f } = St(a), h = new Float32Array([
486
+ const { positions: u, indices: f } = vt(a), h = new Float32Array([
487
487
  d.x,
488
488
  d.y,
489
489
  d.z
@@ -493,22 +493,22 @@ let __tla = (async () => {
493
493
  p.z
494
494
  ]);
495
495
  n.onStatus("Detecting shell type...");
496
- const g = c.detect_shell(u, f, v, 40), x = g.is_double_shell(), y = g.surface_normal();
497
- be.info(Pe, `Shell: ${x ? "DOUBLE" : "SINGLE"}`, g.details()), (_a = n.setDoubleShell) == null ? void 0 : _a.call(n, x), n.onStatus("Finding cross-section plane...");
496
+ const g = c.detect_shell(u, f, v, 40), x = g.is_double_shell(), w = g.surface_normal();
497
+ be.info(ke, `Shell: ${x ? "DOUBLE" : "SINGLE"}`, g.details()), (_a = n.setDoubleShell) == null ? void 0 : _a.call(n, x), n.onStatus("Finding cross-section plane...");
498
498
  const A = new Float32Array([
499
- y[0],
500
- y[1],
501
- y[2]
502
- ]), b = c.find_min_cross_section(u, f, v, A, 10), k = b.plane_normal();
503
- be.info(Pe, "Cross-section found", b.details()), n.onStatus("Aligning mesh...");
499
+ w[0],
500
+ w[1],
501
+ w[2]
502
+ ]), b = c.find_min_cross_section(u, f, v, A, 10), P = b.plane_normal();
503
+ be.info(ke, "Cross-section found", b.details()), n.onStatus("Aligning mesh...");
504
504
  const S = new Float32Array([
505
- k[0],
506
- k[1],
507
- k[2]
505
+ P[0],
506
+ P[1],
507
+ P[2]
508
508
  ]), C = c.align_to_origin(u, h, v, S);
509
509
  let z = C.positions(), _ = C.mpt(), B = C.origin();
510
510
  const V = C.transform();
511
- be.info(Pe, "Alignment complete", C.details());
511
+ be.info(ke, "Alignment complete", C.details());
512
512
  const F = [
513
513
  V[3],
514
514
  V[4],
@@ -520,35 +520,35 @@ let __tla = (async () => {
520
520
  V[10],
521
521
  V[11]
522
522
  ], I = new Float32Array([
523
- F[0] * k[0] + F[1] * k[1] + F[2] * k[2],
524
- F[3] * k[0] + F[4] * k[1] + F[5] * k[2],
525
- F[6] * k[0] + F[7] * k[1] + F[8] * k[2]
523
+ F[0] * P[0] + F[1] * P[1] + F[2] * P[2],
524
+ F[3] * P[0] + F[4] * P[1] + F[5] * P[2],
525
+ F[6] * P[0] + F[7] * P[1] + F[8] * P[2]
526
526
  ]);
527
527
  n.onStatus("Generating measurement points...");
528
- const P = c.subdivide_origin_to_plane(new Float32Array(B), new Float32Array(_), I);
529
- be.debug(Pe, `Subdivide: ${P.count()} pts, spacing=${P.spacing().toFixed(1)}mm`);
530
- const T = P.points(), j = P.count(), ee = 2, ie = 1, oe = [];
528
+ const k = c.subdivide_origin_to_plane(new Float32Array(B), new Float32Array(_), I);
529
+ be.debug(ke, `Subdivide: ${k.count()} pts, spacing=${k.spacing().toFixed(1)}mm`);
530
+ const T = k.points(), j = k.count(), ee = 2, ie = 1, oe = [];
531
531
  for (let N = ee; N < j - ie; N++) oe.push(T[N * 3 + 1]);
532
532
  n.onStatus("Computing cross-sections...");
533
533
  let q = [];
534
534
  if (oe.length >= 2) {
535
535
  const Y = (x ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(z, f, new Float32Array(oe), 10);
536
- be.debug(Pe, "Batch (subdivision)", Y.details());
536
+ be.debug(ke, "Batch (subdivision)", Y.details());
537
537
  const fe = Y.all_loop_points(), se = Y.offsets(), ge = Y.circumferences();
538
538
  for (let ue = 0; ue < se.length - 1; ue++) {
539
539
  const we = se[ue], $ = se[ue + 1];
540
540
  if ($ <= we || ge[ue] <= 0) continue;
541
- const ke = ($ - we) / 3;
542
- if (ke < 3) continue;
541
+ const Pe = ($ - we) / 3;
542
+ if (Pe < 3) continue;
543
543
  let De = 0, Ie = 0, me = 0;
544
544
  for (let Me = we; Me < $; Me += 3) De += fe[Me], Ie += fe[Me + 1], me += fe[Me + 2];
545
- q.push(De / ke, Ie / ke, me / ke);
545
+ q.push(De / Pe, Ie / Pe, me / Pe);
546
546
  }
547
547
  }
548
548
  if (q.length >= 6) {
549
549
  n.onStatus("Refining alignment...");
550
550
  const N = c.refine_alignment(new Float32Array(q), z, new Float32Array(B), new Float32Array(_));
551
- be.info(Pe, "Refinement complete", N.details()), z = N.positions(), _ = N.mpt(), B = N.origin();
551
+ be.info(ke, "Refinement complete", N.details()), z = N.positions(), _ = N.mpt(), B = N.origin();
552
552
  }
553
553
  const re = a.getAttribute("color"), K = Hn(z, f);
554
554
  re && K.setAttribute("color", re), a.dispose(), a = K, e.geometry = a, a.computeVertexNormals(), a.computeBoundingBox(), o[0] = new M(B[0], B[1], B[2]), o[1] = new M(_[0], _[1], _[2]), n.onStatus("Setting blue point...");
@@ -576,9 +576,9 @@ let __tla = (async () => {
576
576
  z: N.z
577
577
  }))), n.setAligned(true);
578
578
  const te = a.boundingBox, D = new M();
579
- te.getSize(D), n.setModelSize(Math.max(D.x, D.y, D.z)), n.setCut(true), n.setAdjustedStartY(null), n.setAdjustedEndY(null), n.setOriginalEndY(o[1].y + 2 * vt), n.onStatus("Computing final measurements...");
579
+ te.getSize(D), n.setModelSize(Math.max(D.x, D.y, D.z)), n.setCut(true), n.setAdjustedStartY(null), n.setAdjustedEndY(null), n.setOriginalEndY(o[1].y + 2 * wt), n.onStatus("Computing final measurements...");
580
580
  {
581
- const N = St(a), Y = o[1].y, fe = o[0].y;
581
+ const N = vt(a), Y = o[1].y, fe = o[0].y;
582
582
  let se = 1 / 0, ge = -1 / 0;
583
583
  const ue = N.positions;
584
584
  for (let me = 1; me < ue.length; me += 3) ue[me] < se && (se = ue[me]), ue[me] > ge && (ge = ue[me]);
@@ -589,9 +589,9 @@ let __tla = (async () => {
589
589
  Me < ge - 1 && $.push(Me);
590
590
  }
591
591
  for (let me = Y - we; me > fe; me -= we) $.push(me);
592
- $.sort((me, Me) => me - Me), be.info(Pe, `Horizontal slices: ${$.length} Y planes, range ${(_b = $[0]) == null ? void 0 : _b.toFixed(1)} \u2192 ${(_c = $[$.length - 1]) == null ? void 0 : _c.toFixed(1)} mm`);
592
+ $.sort((me, Me) => me - Me), be.info(ke, `Horizontal slices: ${$.length} Y planes, range ${(_b = $[0]) == null ? void 0 : _b.toFixed(1)} \u2192 ${(_c = $[$.length - 1]) == null ? void 0 : _c.toFixed(1)} mm`);
593
593
  const De = (x ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(N.positions, N.indices, new Float32Array($), 10);
594
- be.info(Pe, `Horizontal slices (${x ? "inner" : "outer"}): ${De.count()}/${$.length} valid`), be.debug(Pe, "Slice details", De.details());
594
+ be.info(ke, `Horizontal slices (${x ? "inner" : "outer"}): ${De.count()}/${$.length} valid`), be.debug(ke, "Slice details", De.details());
595
595
  const Ie = {
596
596
  yValues: $,
597
597
  circumferences: Array.from(De.circumferences()),
@@ -603,10 +603,10 @@ let __tla = (async () => {
603
603
  (_d = n.setWasmSlices) == null ? void 0 : _d.call(n, Ie);
604
604
  }
605
605
  n.onStatus("Validating results...");
606
- const O = o[1].y, Q = o[0].y, U = Xo(a, O, Q, t);
607
- U.valid || be.warn(Pe, `Validation: ${U.reason}`), n.setClippedReferenceGeometry ? (s.computeVertexNormals(), n.setClippedReferenceGeometry(s)) : s.dispose();
606
+ const O = o[1].y, Q = o[0].y, U = Go(a, O, Q, t);
607
+ U.valid || be.warn(ke, `Validation: ${U.reason}`), n.setClippedReferenceGeometry ? (s.computeVertexNormals(), n.setClippedReferenceGeometry(s)) : s.dispose();
608
608
  } catch (a) {
609
- be.error(Pe, "Processing failed", a), n.setError(a instanceof Error ? a.message : "Failed to process mesh."), s.dispose();
609
+ be.error(ke, "Processing failed", a), n.setError(a instanceof Error ? a.message : "Failed to process mesh."), s.dispose();
610
610
  }
611
611
  }
612
612
  class Ko extends Fo {
@@ -628,7 +628,7 @@ let __tla = (async () => {
628
628
  console.error("[ErrorBoundary] Caught error:", r, t.componentStack);
629
629
  }
630
630
  render() {
631
- return this.state.error ? this.props.fallback ? this.props.fallback(this.state.error, this.reset) : w("div", {
631
+ return this.state.error ? this.props.fallback ? this.props.fallback(this.state.error, this.reset) : y("div", {
632
632
  style: {
633
633
  display: "flex",
634
634
  flexDirection: "column",
@@ -676,7 +676,7 @@ let __tla = (async () => {
676
676
  }) : this.props.children;
677
677
  }
678
678
  }
679
- const Zo = ({ message: e, onDismiss: r }) => w("div", {
679
+ const Zo = ({ message: e, onDismiss: r }) => y("div", {
680
680
  style: {
681
681
  position: "absolute",
682
682
  top: 16,
@@ -693,7 +693,7 @@ let __tla = (async () => {
693
693
  gap: 12
694
694
  },
695
695
  children: [
696
- w("div", {
696
+ y("div", {
697
697
  style: {
698
698
  flex: 1
699
699
  },
@@ -729,7 +729,7 @@ let __tla = (async () => {
729
729
  children: "x"
730
730
  })
731
731
  ]
732
- }), Fn = ({ message: e }) => w("div", {
732
+ }), Fn = ({ message: e }) => y("div", {
733
733
  style: {
734
734
  position: "absolute",
735
735
  top: 0,
@@ -776,25 +776,25 @@ let __tla = (async () => {
776
776
  };
777
777
  }
778
778
  const Uo = ({ mesh: e, maxPoints: r = 2, meshColor: t = "#c8c8c8", meshOpacity: n = 1, frontFaceOnly: s = false, doubleShellTransparency: l = false }) => {
779
- const { addLandmarkPoint: c, landmarkPoints: a } = qt(), o = ce((h) => {
779
+ const { addLandmarkPoint: c, landmarkPoints: a } = Zt(), o = ce((h) => {
780
780
  if (a.length >= r) return;
781
781
  h.stopPropagation();
782
782
  const v = h.intersections[0], g = v == null ? void 0 : v.faceIndex;
783
783
  if (!v || g == null) return;
784
- const x = e.geometry, y = x.index;
784
+ const x = e.geometry, w = x.index;
785
785
  let A;
786
- y ? A = [
787
- y.getX(g * 3),
788
- y.getX(g * 3 + 1),
789
- y.getX(g * 3 + 2)
786
+ w ? A = [
787
+ w.getX(g * 3),
788
+ w.getX(g * 3 + 1),
789
+ w.getX(g * 3 + 2)
790
790
  ] : A = [
791
791
  g * 3,
792
792
  g * 3 + 1,
793
793
  g * 3 + 2
794
794
  ];
795
- const b = x.getAttribute("position"), k = new M().fromBufferAttribute(b, A[0]), S = new M().fromBufferAttribute(b, A[1]), C = new M().fromBufferAttribute(b, A[2]);
796
- k.applyMatrix4(e.matrixWorld), S.applyMatrix4(e.matrixWorld), C.applyMatrix4(e.matrixWorld);
797
- const z = v.point, _ = qo(z, k, S, C), B = {
795
+ const b = x.getAttribute("position"), P = new M().fromBufferAttribute(b, A[0]), S = new M().fromBufferAttribute(b, A[1]), C = new M().fromBufferAttribute(b, A[2]);
796
+ P.applyMatrix4(e.matrixWorld), S.applyMatrix4(e.matrixWorld), C.applyMatrix4(e.matrixWorld);
797
+ const z = v.point, _ = qo(z, P, S, C), B = {
798
798
  faceIndex: g,
799
799
  vertexIndices: A,
800
800
  position: {
@@ -837,7 +837,7 @@ let __tla = (async () => {
837
837
  });
838
838
  }, Jo = ({ point: e, index: r, markerSize: t, color: n, label: s }) => {
839
839
  const [l, c] = E(false);
840
- return w("mesh", {
840
+ return y("mesh", {
841
841
  position: [
842
842
  e.position.x,
843
843
  e.position.y,
@@ -878,7 +878,7 @@ let __tla = (async () => {
878
878
  ]
879
879
  }, r);
880
880
  }, Qo = ({ modelSize: e, labels: r }) => {
881
- const { landmarkPoints: t } = qt(), n = e * 0.02, s = [
881
+ const { landmarkPoints: t } = Zt(), n = e * 0.02, s = [
882
882
  "#44ff44",
883
883
  "#ff4444",
884
884
  "#4444ff"
@@ -898,20 +898,20 @@ let __tla = (async () => {
898
898
  });
899
899
  };
900
900
  function Nn(e) {
901
- return J(() => e ? new At(e, {
902
- maxLeafTris: zt
901
+ return J(() => e ? new Ct(e, {
902
+ maxLeafTris: At
903
903
  }) : null, [
904
904
  e
905
905
  ]);
906
906
  }
907
- const kn = (e, r) => {
907
+ const Pn = (e, r) => {
908
908
  const t = Math.abs(e - r);
909
909
  return t <= 7 ? "#8BC34A" : t <= 20 ? "#FFC107" : "#FF5722";
910
- }, Pn = new Z.Color("#8BC34A"), Ln = new Z.Color("#FFC107"), er = new Z.Color("#FF5722"), tr = (e) => {
911
- if (e <= 7) return Pn.clone();
910
+ }, kn = new Z.Color("#8BC34A"), Ln = new Z.Color("#FFC107"), er = new Z.Color("#FF5722"), tr = (e) => {
911
+ if (e <= 7) return kn.clone();
912
912
  if (e <= 20) {
913
913
  const t = (e - 7) / 13;
914
- return Pn.clone().lerp(Ln, t);
914
+ return kn.clone().lerp(Ln, t);
915
915
  }
916
916
  const r = Math.min((e - 20) / 20, 1);
917
917
  return Ln.clone().lerp(er, r);
@@ -936,7 +936,7 @@ let __tla = (async () => {
936
936
  });
937
937
  return new Z.Mesh(c, a);
938
938
  }, or = ({ bvh: e, geometry: r, yPosition: t, color: n = "#00ff00", labelX: s, onDataChange: l, displayUnit: c = "cm", useInnerSurface: a = false, formValue: o, lineWidth: d = 1.5, wasmLoopPoints: p, wasmCircumference: u }) => {
939
- const f = J(() => p && u != null ? null : Ge(e, r, t, a), [
939
+ const f = J(() => p && u != null ? null : je(e, r, t, a), [
940
940
  e,
941
941
  r,
942
942
  t,
@@ -945,8 +945,8 @@ let __tla = (async () => {
945
945
  u
946
946
  ]), h = p ?? (f == null ? void 0 : f.linePoints) ?? [], v = u ?? (f == null ? void 0 : f.lineLength) ?? 0, g = J(() => {
947
947
  if (o == null || o === 0 || v <= 0 || h.length < 2) return null;
948
- const b = o / v, k = h.reduce((C, z) => C + z.x, 0) / h.length, S = h.reduce((C, z) => C + z.z, 0) / h.length;
949
- return h.map((C) => new M(k + (C.x - k) * b, C.y, S + (C.z - S) * b));
948
+ const b = o / v, P = h.reduce((C, z) => C + z.x, 0) / h.length, S = h.reduce((C, z) => C + z.z, 0) / h.length;
949
+ return h.map((C) => new M(P + (C.x - P) * b, C.y, S + (C.z - S) * b));
950
950
  }, [
951
951
  h,
952
952
  v,
@@ -955,27 +955,27 @@ let __tla = (async () => {
955
955
  h,
956
956
  g
957
957
  ]);
958
- X(() => () => {
958
+ G(() => () => {
959
959
  x && (x.geometry.dispose(), x.material.dispose());
960
960
  }, [
961
961
  x
962
962
  ]);
963
- const y = de(null), A = J(() => {
963
+ const w = de(null), A = J(() => {
964
964
  const b = new Z.BufferGeometry();
965
965
  b.setAttribute("position", new Z.Float32BufferAttribute(new Float32Array(6), 3));
966
- const k = new Z.LineBasicMaterial({
966
+ const P = new Z.LineBasicMaterial({
967
967
  color: 6710886,
968
968
  depthTest: false,
969
969
  depthWrite: false,
970
970
  transparent: true
971
971
  });
972
- return new Z.Line(b, k);
972
+ return new Z.Line(b, P);
973
973
  }, []);
974
- return X(() => () => {
974
+ return G(() => () => {
975
975
  A.geometry.dispose(), A.material.dispose();
976
976
  }, [
977
977
  A
978
- ]), X(() => {
978
+ ]), G(() => {
979
979
  v > 0 && (l == null ? void 0 : l({
980
980
  yPosition: t,
981
981
  originalValue: v,
@@ -986,23 +986,23 @@ let __tla = (async () => {
986
986
  t,
987
987
  l
988
988
  ]), Rn(({ camera: b }) => {
989
- if (!y.current || h.length < 2) return;
990
- const k = new M();
991
- b.getWorldDirection(k);
992
- const S = new M(k.x, 0, k.z);
989
+ if (!w.current || h.length < 2) return;
990
+ const P = new M();
991
+ b.getWorldDirection(P);
992
+ const S = new M(P.x, 0, P.z);
993
993
  if (S.lengthSq() < 1e-8) return;
994
994
  S.normalize();
995
995
  const C = new M().crossVectors(S, new M(0, 1, 0)).normalize();
996
996
  let z = -1 / 0, _ = h[0];
997
997
  for (const I of h) {
998
- const P = C.x * I.x + C.z * I.z;
999
- P > z && (z = P, _ = I);
998
+ const k = C.x * I.x + C.z * I.z;
999
+ k > z && (z = k, _ = I);
1000
1000
  }
1001
1001
  const B = s * 0.35, V = new M(_.x + C.x * B, t, _.z + C.z * B);
1002
- y.current.position.copy(V);
1002
+ w.current.position.copy(V);
1003
1003
  const F = A.geometry.getAttribute("position");
1004
1004
  F.setXYZ(0, _.x, _.y, _.z), F.setXYZ(1, V.x, V.y, V.z), F.needsUpdate = true;
1005
- }), h.length < 2 ? null : w("group", {
1005
+ }), h.length < 2 ? null : y("group", {
1006
1006
  renderOrder: 10,
1007
1007
  children: [
1008
1008
  i(ye, {
@@ -1020,7 +1020,7 @@ let __tla = (async () => {
1020
1020
  }),
1021
1021
  g && o != null && o !== 0 && i(ye, {
1022
1022
  points: g,
1023
- color: kn(v, o),
1023
+ color: Pn(v, o),
1024
1024
  lineWidth: 2.5,
1025
1025
  dashed: true,
1026
1026
  dashSize: 2,
@@ -1036,7 +1036,7 @@ let __tla = (async () => {
1036
1036
  renderOrder: 10
1037
1037
  }),
1038
1038
  i("group", {
1039
- ref: y,
1039
+ ref: w,
1040
1040
  children: i(Xe, {
1041
1041
  zIndexRange: [
1042
1042
  100,
@@ -1046,7 +1046,7 @@ let __tla = (async () => {
1046
1046
  pointerEvents: "none",
1047
1047
  transform: "translateY(-50%)"
1048
1048
  },
1049
- children: w("div", {
1049
+ children: y("div", {
1050
1050
  style: {
1051
1051
  display: "flex",
1052
1052
  alignItems: "stretch",
@@ -1056,7 +1056,7 @@ let __tla = (async () => {
1056
1056
  whiteSpace: "nowrap"
1057
1057
  },
1058
1058
  children: [
1059
- w("div", {
1059
+ y("div", {
1060
1060
  style: {
1061
1061
  display: "flex",
1062
1062
  alignItems: "center",
@@ -1087,8 +1087,8 @@ let __tla = (async () => {
1087
1087
  ]
1088
1088
  }),
1089
1089
  o != null && o !== 0 && v > 0 && (() => {
1090
- const b = v - o, k = b > 0.5 ? "\u25B2" : b < -0.5 ? "\u25BC" : "", S = kn(v, o);
1091
- return w("div", {
1090
+ const b = v - o, P = b > 0.5 ? "\u25B2" : b < -0.5 ? "\u25BC" : "", S = Pn(v, o);
1091
+ return y("div", {
1092
1092
  style: {
1093
1093
  display: "flex",
1094
1094
  alignItems: "center",
@@ -1099,15 +1099,15 @@ let __tla = (async () => {
1099
1099
  borderLeft: "1px solid rgba(255,255,255,0.12)"
1100
1100
  },
1101
1101
  children: [
1102
- k && i("span", {
1102
+ P && i("span", {
1103
1103
  style: {
1104
1104
  fontSize: 10,
1105
1105
  color: S,
1106
1106
  lineHeight: 1
1107
1107
  },
1108
- children: k
1108
+ children: P
1109
1109
  }),
1110
- w("span", {
1110
+ y("span", {
1111
1111
  style: {
1112
1112
  fontSize: 13,
1113
1113
  color: S,
@@ -1119,7 +1119,7 @@ let __tla = (async () => {
1119
1119
  c === "inch" ? (b / 25.4).toFixed(2) : (b / 10).toFixed(1)
1120
1120
  ]
1121
1121
  }),
1122
- w("span", {
1122
+ y("span", {
1123
1123
  style: {
1124
1124
  fontSize: 11,
1125
1125
  color: "rgba(255,255,255,0.4)",
@@ -1139,7 +1139,7 @@ let __tla = (async () => {
1139
1139
  })
1140
1140
  ]
1141
1141
  });
1142
- }, rr = ko(or), ir = ({ mesh: e, startY: r, endY: t, spacing: n, modelSize: s, onMeasurementsChange: l, reverseOrder: c = false, displayUnit: a = "cm", useInnerSurface: o = false, formMeasurements: d, originY: p, wasmSlices: u }) => {
1142
+ }, rr = Po(or), ir = ({ mesh: e, startY: r, endY: t, spacing: n, modelSize: s, onMeasurementsChange: l, reverseOrder: c = false, displayUnit: a = "cm", useInnerSurface: o = false, formMeasurements: d, originY: p, wasmSlices: u }) => {
1143
1143
  const f = de(/* @__PURE__ */ new Map()), h = e.geometry, v = Nn(h), g = J(() => {
1144
1144
  if (u) {
1145
1145
  let z = [
@@ -1171,13 +1171,13 @@ let __tla = (async () => {
1171
1171
  const V = z[B], F = z[B + 1];
1172
1172
  if (F <= V) continue;
1173
1173
  const I = [];
1174
- for (let P = V; P < F; P += 3) I.push(new M(C[P], C[P + 1], C[P + 2]));
1174
+ for (let k = V; k < F; k += 3) I.push(new M(C[k], C[k + 1], C[k + 2]));
1175
1175
  I.length >= 3 && S.set(_[B], I);
1176
1176
  }
1177
1177
  return S;
1178
1178
  }, [
1179
1179
  u
1180
- ]), y = J(() => {
1180
+ ]), w = J(() => {
1181
1181
  if (!u) return null;
1182
1182
  const S = /* @__PURE__ */ new Map();
1183
1183
  for (let C = 0; C < u.yValues.length; C++) S.set(u.yValues[C], u.circumferences[C]);
@@ -1185,34 +1185,34 @@ let __tla = (async () => {
1185
1185
  }, [
1186
1186
  u
1187
1187
  ]);
1188
- X(() => {
1188
+ G(() => {
1189
1189
  f.current.clear();
1190
1190
  }, [
1191
1191
  g
1192
- ]), X(() => {
1193
- if (!y || !l) return;
1194
- const S = g.filter((C) => (y.get(C) ?? 0) > 0).map((C) => ({
1192
+ ]), G(() => {
1193
+ if (!w || !l) return;
1194
+ const S = g.filter((C) => (w.get(C) ?? 0) > 0).map((C) => ({
1195
1195
  yPosition: C,
1196
- originalValue: y.get(C) ?? 0,
1196
+ originalValue: w.get(C) ?? 0,
1197
1197
  modifiedValue: null
1198
1198
  }));
1199
1199
  l(S);
1200
1200
  }, [
1201
- y,
1201
+ w,
1202
1202
  g,
1203
1203
  l
1204
1204
  ]);
1205
1205
  const A = [
1206
1206
  "#5B9BD5"
1207
- ], b = s * Eo, k = ce((S) => {
1208
- if (y) return;
1207
+ ], b = s * Eo, P = ce((S) => {
1208
+ if (w) return;
1209
1209
  f.current.set(S.yPosition, S);
1210
1210
  const C = Array.from(f.current.values()).sort((z, _) => c ? _.yPosition - z.yPosition : z.yPosition - _.yPosition);
1211
1211
  l == null ? void 0 : l(C);
1212
1212
  }, [
1213
1213
  l,
1214
1214
  c,
1215
- y
1215
+ w
1216
1216
  ]);
1217
1217
  return v ? i(Re, {
1218
1218
  children: g.map((S, C) => i(rr, {
@@ -1221,13 +1221,13 @@ let __tla = (async () => {
1221
1221
  yPosition: S,
1222
1222
  color: p != null && Math.abs(S - p) < n * 0.5 ? "#44ff44" : A[C % A.length],
1223
1223
  labelX: b,
1224
- onDataChange: k,
1224
+ onDataChange: P,
1225
1225
  displayUnit: a,
1226
1226
  useInnerSurface: o,
1227
1227
  formValue: d == null ? void 0 : d[C],
1228
1228
  lineWidth: p != null && Math.abs(S - p) < n * 0.5 ? 4 : 1.5,
1229
1229
  wasmLoopPoints: x == null ? void 0 : x.get(S),
1230
- wasmCircumference: y == null ? void 0 : y.get(S)
1230
+ wasmCircumference: w == null ? void 0 : w.get(S)
1231
1231
  }, S))
1232
1232
  }) : null;
1233
1233
  }, sr = (e, r) => {
@@ -1250,8 +1250,8 @@ let __tla = (async () => {
1250
1250
  const V = C.position.x - u.current.position.x, F = C.position.z - u.current.position.z;
1251
1251
  u.current.rotation.y = Math.atan2(V, F);
1252
1252
  });
1253
- const f = new M(0, r, 0), h = new M(0, a, 0), v = new M(0, (r + a) / 2, 0), g = new M(-p, r, 0), x = new M(p, r, 0), y = new M(-p, a, 0), A = new M(p, a, 0), b = l != null && l > 0, k = b ? o - l : 0, S = b ? sr(o, l) : "#fff";
1254
- return w("group", {
1253
+ const f = new M(0, r, 0), h = new M(0, a, 0), v = new M(0, (r + a) / 2, 0), g = new M(-p, r, 0), x = new M(p, r, 0), w = new M(-p, a, 0), A = new M(p, a, 0), b = l != null && l > 0, P = b ? o - l : 0, S = b ? sr(o, l) : "#fff";
1254
+ return y("group", {
1255
1255
  ref: u,
1256
1256
  children: [
1257
1257
  i(ye, {
@@ -1272,7 +1272,7 @@ let __tla = (async () => {
1272
1272
  }),
1273
1273
  i(ye, {
1274
1274
  points: [
1275
- y,
1275
+ w,
1276
1276
  A
1277
1277
  ],
1278
1278
  color: "#888888",
@@ -1289,7 +1289,7 @@ let __tla = (async () => {
1289
1289
  0,
1290
1290
  0
1291
1291
  ],
1292
- children: w("div", {
1292
+ children: y("div", {
1293
1293
  style: {
1294
1294
  display: "flex",
1295
1295
  flexDirection: "column",
@@ -1300,7 +1300,7 @@ let __tla = (async () => {
1300
1300
  pointerEvents: "none"
1301
1301
  },
1302
1302
  children: [
1303
- w("div", {
1303
+ y("div", {
1304
1304
  style: {
1305
1305
  padding: "4px 8px",
1306
1306
  backgroundColor: "rgba(0, 0, 0, 0.75)",
@@ -1317,7 +1317,7 @@ let __tla = (async () => {
1317
1317
  n === "inch" ? "in" : "cm"
1318
1318
  ]
1319
1319
  }),
1320
- b && w("div", {
1320
+ b && y("div", {
1321
1321
  style: {
1322
1322
  display: "flex",
1323
1323
  alignItems: "center",
@@ -1330,15 +1330,15 @@ let __tla = (async () => {
1330
1330
  pointerEvents: "none"
1331
1331
  },
1332
1332
  children: [
1333
- Math.abs(k) > 0.5 && i("span", {
1333
+ Math.abs(P) > 0.5 && i("span", {
1334
1334
  style: {
1335
1335
  fontSize: 10,
1336
1336
  color: S,
1337
1337
  lineHeight: 1
1338
1338
  },
1339
- children: k > 0.5 ? "\u25B2" : "\u25BC"
1339
+ children: P > 0.5 ? "\u25B2" : "\u25BC"
1340
1340
  }),
1341
- w("span", {
1341
+ y("span", {
1342
1342
  style: {
1343
1343
  fontSize: 13,
1344
1344
  color: S,
@@ -1346,11 +1346,11 @@ let __tla = (async () => {
1346
1346
  fontWeight: 600
1347
1347
  },
1348
1348
  children: [
1349
- k > 0 ? "+" : "",
1350
- n === "inch" ? (k / 25.4).toFixed(2) : (k / 10).toFixed(1)
1349
+ P > 0 ? "+" : "",
1350
+ n === "inch" ? (P / 25.4).toFixed(2) : (P / 10).toFixed(1)
1351
1351
  ]
1352
1352
  }),
1353
- w("span", {
1353
+ y("span", {
1354
1354
  style: {
1355
1355
  fontSize: 11,
1356
1356
  color: "rgba(255,255,255,0.4)",
@@ -1370,15 +1370,15 @@ let __tla = (async () => {
1370
1370
  ]
1371
1371
  });
1372
1372
  }, ar = ({ modelSize: e, isAligned: r, isCut: t, mesh: n, viewMode: s, sliceY: l, landmarkCount: c = 0, measurementGeometry: a, fitYMin: o, fitYMax: d, resetCameraToFrontRef: p }) => {
1373
- const { set: u, size: f, camera: h, invalidate: v } = Wn(), g = de(false), x = de(s), y = de(new M()), A = de(null), b = de(c), k = de(r), S = de(t), C = de(a), z = de({
1373
+ const { set: u, size: f, camera: h, invalidate: v } = Wn(), g = de(false), x = de(s), w = de(new M()), A = de(null), b = de(c), P = de(r), S = de(t), C = de(a), z = de({
1374
1374
  min: o,
1375
1375
  max: d
1376
1376
  }), _ = de(0), B = ce(() => {
1377
1377
  if (!n || e <= 0) return null;
1378
1378
  const F = a ?? n.geometry;
1379
1379
  F.computeBoundingBox();
1380
- const I = F.boundingBox, P = new M();
1381
- I.getCenter(P);
1380
+ const I = F.boundingBox, k = new M();
1381
+ I.getCenter(k);
1382
1382
  const T = new M();
1383
1383
  I.getSize(T);
1384
1384
  const j = o != null && d != null && d > o;
@@ -1393,11 +1393,11 @@ let __tla = (async () => {
1393
1393
  const $ = Q[ue * 3];
1394
1394
  $ < N && (N = $), $ > Y && (Y = $), ge = true;
1395
1395
  }
1396
- ge && (P.set((N + Y) / 2, (fe + se) / 2, 0), T.set(Y - N, se - fe, 0));
1396
+ ge && (k.set((N + Y) / 2, (fe + se) / 2, 0), T.set(Y - N, se - fe, 0));
1397
1397
  }
1398
1398
  }
1399
- y.current.copy(T);
1400
- const ee = f.width / f.height, ie = 1.35, oe = j ? 1.15 : 1.6, q = Math.max(T.y * oe, T.x * ie / ee), re = q * ee, K = P.y - T.y * 0.05;
1399
+ w.current.copy(T);
1400
+ const ee = f.width / f.height, ie = 1.35, oe = j ? 1.15 : 1.6, q = Math.max(T.y * oe, T.x * ie / ee), re = q * ee, K = k.y - T.y * 0.05;
1401
1401
  _.current = K;
1402
1402
  const he = new Z.OrthographicCamera(-re / 2, re / 2, q / 2, -q / 2, 0.1, e * 10);
1403
1403
  return he.position.set(0, K, e * 2), he.lookAt(0, K, 0), he;
@@ -1409,7 +1409,7 @@ let __tla = (async () => {
1409
1409
  o,
1410
1410
  d
1411
1411
  ]);
1412
- X(() => {
1412
+ G(() => {
1413
1413
  if (p) return p.current = () => {
1414
1414
  const F = B();
1415
1415
  F && (u({
@@ -1425,12 +1425,12 @@ let __tla = (async () => {
1425
1425
  v
1426
1426
  ]);
1427
1427
  const V = ce((F) => {
1428
- const I = F.position.clone(), P = I.length(), T = Math.atan2(I.x, I.z), j = Math.acos(I.y / P), ie = T + 0.02;
1429
- F.position.set(P * Math.sin(j) * Math.sin(ie), P * Math.cos(j), P * Math.sin(j) * Math.cos(ie)), F.lookAt(0, 0, 0), F.updateMatrixWorld(true), v();
1428
+ const I = F.position.clone(), k = I.length(), T = Math.atan2(I.x, I.z), j = Math.acos(I.y / k), ie = T + 0.02;
1429
+ F.position.set(k * Math.sin(j) * Math.sin(ie), k * Math.cos(j), k * Math.sin(j) * Math.cos(ie)), F.lookAt(0, 0, 0), F.updateMatrixWorld(true), v();
1430
1430
  }, [
1431
1431
  v
1432
1432
  ]);
1433
- return X(() => {
1433
+ return G(() => {
1434
1434
  if (e > 0 && !g.current && !r) {
1435
1435
  g.current = true;
1436
1436
  const F = new Z.PerspectiveCamera(50, f.width / f.height, 0.1, e * 10);
@@ -1444,7 +1444,7 @@ let __tla = (async () => {
1444
1444
  u,
1445
1445
  r,
1446
1446
  V
1447
- ]), X(() => {
1447
+ ]), G(() => {
1448
1448
  const F = b.current;
1449
1449
  b.current = c, F === 0 && c === 1 && !r && requestAnimationFrame(() => V(h));
1450
1450
  }, [
@@ -1452,12 +1452,12 @@ let __tla = (async () => {
1452
1452
  r,
1453
1453
  h,
1454
1454
  V
1455
- ]), X(() => {
1456
- const F = k.current !== r, I = S.current !== t, P = !C.current && !!a, T = (z.current.min == null || z.current.max == null) && o != null && d != null;
1457
- if (k.current = r, S.current = t, C.current = a, z.current = {
1455
+ ]), G(() => {
1456
+ const F = P.current !== r, I = S.current !== t, k = !C.current && !!a, T = (z.current.min == null || z.current.max == null) && o != null && d != null;
1457
+ if (P.current = r, S.current = t, C.current = a, z.current = {
1458
1458
  min: o,
1459
1459
  max: d
1460
- }, !F && !I && !P && !T || !r || s !== "3D") return;
1460
+ }, !F && !I && !k && !T || !r || s !== "3D") return;
1461
1461
  const j = B();
1462
1462
  j && u({
1463
1463
  camera: j
@@ -1471,15 +1471,15 @@ let __tla = (async () => {
1471
1471
  d,
1472
1472
  B,
1473
1473
  u
1474
- ]), X(() => {
1474
+ ]), G(() => {
1475
1475
  if (x.current === s) return;
1476
1476
  const F = x.current;
1477
1477
  if (x.current = s, !(!r || !n || e <= 0)) {
1478
1478
  if (s === "2D" && l != null) {
1479
1479
  A.current = h;
1480
- const I = n.geometry, P = I.getAttribute("position"), T = P.array, j = e * 0.15;
1480
+ const I = n.geometry, k = I.getAttribute("position"), T = k.array, j = e * 0.15;
1481
1481
  let ee = 1 / 0, ie = -1 / 0, oe = 1 / 0, q = -1 / 0, re = false;
1482
- for (let fe = 0; fe < P.count; fe++) if (Math.abs(T[fe * 3 + 1] - l) < j) {
1482
+ for (let fe = 0; fe < k.count; fe++) if (Math.abs(T[fe * 3 + 1] - l) < j) {
1483
1483
  const se = T[fe * 3], ge = T[fe * 3 + 2];
1484
1484
  se < ee && (ee = se), se > ie && (ie = se), ge < oe && (oe = ge), ge > q && (q = ge), re = true;
1485
1485
  }
@@ -1515,14 +1515,14 @@ let __tla = (async () => {
1515
1515
  u,
1516
1516
  h,
1517
1517
  B
1518
- ]), X(() => {
1518
+ ]), G(() => {
1519
1519
  if (!r || !h || !h.isOrthographicCamera) return;
1520
1520
  const F = h;
1521
1521
  if (s === "2D") {
1522
1522
  if (!n || l == null) return;
1523
- const I = n.geometry, P = I.getAttribute("position"), T = P.array, j = e * 0.15;
1523
+ const I = n.geometry, k = I.getAttribute("position"), T = k.array, j = e * 0.15;
1524
1524
  let ee = 1 / 0, ie = -1 / 0, oe = 1 / 0, q = -1 / 0, re = false;
1525
- for (let U = 0; U < P.count; U++) if (Math.abs(T[U * 3 + 1] - l) < j) {
1525
+ for (let U = 0; U < k.count; U++) if (Math.abs(T[U * 3 + 1] - l) < j) {
1526
1526
  const N = T[U * 3], Y = T[U * 3 + 2];
1527
1527
  N < ee && (ee = N), N > ie && (ie = N), Y < oe && (oe = Y), Y > q && (q = Y), re = true;
1528
1528
  }
@@ -1535,7 +1535,7 @@ let __tla = (async () => {
1535
1535
  let O, Q;
1536
1536
  te / D > K ? (O = te, Q = te / K) : (Q = D, O = D * K), F.left = -O / 2, F.right = O / 2, F.top = Q / 2, F.bottom = -Q / 2;
1537
1537
  } else {
1538
- const I = y.current, P = f.width / f.height, T = Math.max(I.y, I.x / P) * 1.6, j = T * P;
1538
+ const I = w.current, k = f.width / f.height, T = Math.max(I.y, I.x / k) * 1.6, j = T * k;
1539
1539
  F.left = -j / 2, F.right = j / 2, F.top = T / 2, F.bottom = -T / 2;
1540
1540
  }
1541
1541
  F.updateProjectionMatrix();
@@ -1566,7 +1566,7 @@ let __tla = (async () => {
1566
1566
  n.z
1567
1567
  ]
1568
1568
  });
1569
- }, dr = ({ wasAutoScaled: e, onDismiss: r }) => w("div", {
1569
+ }, dr = ({ wasAutoScaled: e, onDismiss: r }) => y("div", {
1570
1570
  style: {
1571
1571
  position: "absolute",
1572
1572
  top: 16,
@@ -1607,10 +1607,10 @@ let __tla = (async () => {
1607
1607
  children: "X"
1608
1608
  })
1609
1609
  ]
1610
- }), fr = ({ isDoubleShell: e, onDismiss: r }) => (X(() => {
1610
+ }), fr = ({ isDoubleShell: e, onDismiss: r }) => (G(() => {
1611
1611
  const t = setTimeout(r, 1e4);
1612
1612
  return () => clearTimeout(t);
1613
- }, []), w("div", {
1613
+ }, []), y("div", {
1614
1614
  style: {
1615
1615
  position: "absolute",
1616
1616
  top: 64,
@@ -1655,18 +1655,18 @@ let __tla = (async () => {
1655
1655
  const t = Math.abs(e - r);
1656
1656
  return t <= 7 ? "#4caf50" : t <= 15 ? "#ff9800" : "#f44336";
1657
1657
  }, ur = ({ mesh: e, upperY: r, originY: t, modelSize: n, meshColor: s = "#c8c8c8", displayUnit: l = "cm", formML: c, formAP: a }) => {
1658
- const o = e.geometry, d = J(() => new At(o, {
1659
- maxLeafTris: zt
1658
+ const o = e.geometry, d = J(() => new Ct(o, {
1659
+ maxLeafTris: At
1660
1660
  }), [
1661
1661
  o
1662
- ]), p = J(() => Ge(d, o, t), [
1662
+ ]), p = J(() => je(d, o, t), [
1663
1663
  d,
1664
1664
  o,
1665
1665
  t
1666
- ]), u = J(() => new Ct(new M(0, -1, 0), r), [
1666
+ ]), u = J(() => new St(new M(0, -1, 0), r), [
1667
1667
  r
1668
1668
  ]), { mlLine: f, apLine: h, mlWidth: v, apWidth: g } = J(() => {
1669
- let A = null, b = null, k = 0, S = 0;
1669
+ let A = null, b = null, P = 0, S = 0;
1670
1670
  if (p.linePoints.length >= 2) {
1671
1671
  let C = p.linePoints[0], z = p.linePoints[0], _ = p.linePoints[0], B = p.linePoints[0];
1672
1672
  for (const V of p.linePoints) V.x < C.x && (C = V), V.x > z.x && (z = V), V.z < _.z && (_ = V), V.z > B.z && (B = V);
@@ -1676,19 +1676,19 @@ let __tla = (async () => {
1676
1676
  ], b = [
1677
1677
  new M(_.x, t, _.z),
1678
1678
  new M(B.x, t, B.z)
1679
- ], k = A[0].distanceTo(A[1]), S = b[0].distanceTo(b[1]);
1679
+ ], P = A[0].distanceTo(A[1]), S = b[0].distanceTo(b[1]);
1680
1680
  }
1681
1681
  return {
1682
1682
  mlLine: A,
1683
1683
  apLine: b,
1684
- mlWidth: k,
1684
+ mlWidth: P,
1685
1685
  apWidth: S
1686
1686
  };
1687
1687
  }, [
1688
1688
  p,
1689
1689
  t
1690
- ]), x = (A) => l === "inch" ? (A / 25.4).toFixed(2) : (A / 10).toFixed(1), y = l === "inch" ? "in" : "cm";
1691
- return w(Re, {
1690
+ ]), x = (A) => l === "inch" ? (A / 25.4).toFixed(2) : (A / 10).toFixed(1), w = l === "inch" ? "in" : "cm";
1691
+ return y(Re, {
1692
1692
  children: [
1693
1693
  i("mesh", {
1694
1694
  geometry: e.geometry,
@@ -1711,7 +1711,7 @@ let __tla = (async () => {
1711
1711
  depthWrite: false,
1712
1712
  transparent: true
1713
1713
  }),
1714
- f && w(Re, {
1714
+ f && y(Re, {
1715
1715
  children: [
1716
1716
  i(ye, {
1717
1717
  points: f,
@@ -1731,7 +1731,7 @@ let __tla = (async () => {
1731
1731
  style: {
1732
1732
  pointerEvents: "none"
1733
1733
  },
1734
- children: w("div", {
1734
+ children: y("div", {
1735
1735
  style: {
1736
1736
  display: "flex",
1737
1737
  flexDirection: "column",
@@ -1745,7 +1745,7 @@ let __tla = (async () => {
1745
1745
  backgroundColor: "rgba(0,0,0,0.75)",
1746
1746
  borderRadius: c != null && c > 0 ? "3px 3px 0 0" : 3
1747
1747
  },
1748
- children: w("span", {
1748
+ children: y("span", {
1749
1749
  style: {
1750
1750
  fontSize: 12,
1751
1751
  color: "#ff8800",
@@ -1755,13 +1755,13 @@ let __tla = (async () => {
1755
1755
  "ML ",
1756
1756
  x(v),
1757
1757
  " ",
1758
- y
1758
+ w
1759
1759
  ]
1760
1760
  })
1761
1761
  }),
1762
1762
  c != null && c > 0 && (() => {
1763
- const A = v - c, b = Dn(v, c), k = A > 0.5 ? "\u25B2" : A < -0.5 ? "\u25BC" : "";
1764
- return w("div", {
1763
+ const A = v - c, b = Dn(v, c), P = A > 0.5 ? "\u25B2" : A < -0.5 ? "\u25BC" : "";
1764
+ return y("div", {
1765
1765
  style: {
1766
1766
  display: "flex",
1767
1767
  alignItems: "center",
@@ -1772,15 +1772,15 @@ let __tla = (async () => {
1772
1772
  borderTop: "1px solid rgba(255,255,255,0.12)"
1773
1773
  },
1774
1774
  children: [
1775
- k && i("span", {
1775
+ P && i("span", {
1776
1776
  style: {
1777
1777
  fontSize: 9,
1778
1778
  color: b,
1779
1779
  lineHeight: 1
1780
1780
  },
1781
- children: k
1781
+ children: P
1782
1782
  }),
1783
- w("span", {
1783
+ y("span", {
1784
1784
  style: {
1785
1785
  fontSize: 11,
1786
1786
  color: b,
@@ -1792,7 +1792,7 @@ let __tla = (async () => {
1792
1792
  l === "inch" ? (A / 25.4).toFixed(2) : (A / 10).toFixed(1)
1793
1793
  ]
1794
1794
  }),
1795
- w("span", {
1795
+ y("span", {
1796
1796
  style: {
1797
1797
  fontSize: 10,
1798
1798
  color: "rgba(255,255,255,0.4)",
@@ -1811,7 +1811,7 @@ let __tla = (async () => {
1811
1811
  })
1812
1812
  ]
1813
1813
  }),
1814
- h && w(Re, {
1814
+ h && y(Re, {
1815
1815
  children: [
1816
1816
  i(ye, {
1817
1817
  points: h,
@@ -1831,7 +1831,7 @@ let __tla = (async () => {
1831
1831
  style: {
1832
1832
  pointerEvents: "none"
1833
1833
  },
1834
- children: w("div", {
1834
+ children: y("div", {
1835
1835
  style: {
1836
1836
  display: "flex",
1837
1837
  flexDirection: "column",
@@ -1845,7 +1845,7 @@ let __tla = (async () => {
1845
1845
  backgroundColor: "rgba(0,0,0,0.75)",
1846
1846
  borderRadius: a != null && a > 0 ? "3px 3px 0 0" : 3
1847
1847
  },
1848
- children: w("span", {
1848
+ children: y("span", {
1849
1849
  style: {
1850
1850
  fontSize: 12,
1851
1851
  color: "#ff00ff",
@@ -1855,13 +1855,13 @@ let __tla = (async () => {
1855
1855
  "AP ",
1856
1856
  x(g),
1857
1857
  " ",
1858
- y
1858
+ w
1859
1859
  ]
1860
1860
  })
1861
1861
  }),
1862
1862
  a != null && a > 0 && (() => {
1863
- const A = g - a, b = Dn(g, a), k = A > 0.5 ? "\u25B2" : A < -0.5 ? "\u25BC" : "";
1864
- return w("div", {
1863
+ const A = g - a, b = Dn(g, a), P = A > 0.5 ? "\u25B2" : A < -0.5 ? "\u25BC" : "";
1864
+ return y("div", {
1865
1865
  style: {
1866
1866
  display: "flex",
1867
1867
  alignItems: "center",
@@ -1872,15 +1872,15 @@ let __tla = (async () => {
1872
1872
  borderTop: "1px solid rgba(255,255,255,0.12)"
1873
1873
  },
1874
1874
  children: [
1875
- k && i("span", {
1875
+ P && i("span", {
1876
1876
  style: {
1877
1877
  fontSize: 9,
1878
1878
  color: b,
1879
1879
  lineHeight: 1
1880
1880
  },
1881
- children: k
1881
+ children: P
1882
1882
  }),
1883
- w("span", {
1883
+ y("span", {
1884
1884
  style: {
1885
1885
  fontSize: 11,
1886
1886
  color: b,
@@ -1892,7 +1892,7 @@ let __tla = (async () => {
1892
1892
  l === "inch" ? (A / 25.4).toFixed(2) : (A / 10).toFixed(1)
1893
1893
  ]
1894
1894
  }),
1895
- w("span", {
1895
+ y("span", {
1896
1896
  style: {
1897
1897
  fontSize: 10,
1898
1898
  color: "rgba(255,255,255,0.4)",
@@ -1914,44 +1914,44 @@ let __tla = (async () => {
1914
1914
  ]
1915
1915
  });
1916
1916
  }, pr = ({ mesh: e, yPosition: r, onYChange: t, minY: n, maxY: s, modelSize: l, color: c, hoverColor: a, dragColor: o, label: d, onDragStart: p, onDragEnd: u }) => {
1917
- const [f, h] = E(false), [v, g] = E(false), { camera: x, gl: y } = Wn(), A = de(0), b = de(null), k = e.geometry, S = Nn(k), C = J(() => S ? Ge(S, k, r) : {
1917
+ const [f, h] = E(false), [v, g] = E(false), { camera: x, gl: w } = Wn(), A = de(0), b = de(null), P = e.geometry, S = Nn(P), C = J(() => S ? je(S, P, r) : {
1918
1918
  linePoints: [],
1919
1919
  lineLength: 0,
1920
1920
  rightmostPoint: new M()
1921
1921
  }, [
1922
1922
  S,
1923
- k,
1923
+ P,
1924
1924
  r
1925
- ]), z = ce((P, T, j) => {
1926
- const ee = y.domElement.getBoundingClientRect(), ie = (P - ee.left) / ee.width * 2 - 1, oe = -((T - ee.top) / ee.height) * 2 + 1, q = new Do();
1925
+ ]), z = ce((k, T, j) => {
1926
+ const ee = w.domElement.getBoundingClientRect(), ie = (k - ee.left) / ee.width * 2 - 1, oe = -((T - ee.top) / ee.height) * 2 + 1, q = new Do();
1927
1927
  q.setFromCamera(new Z.Vector2(ie, oe), x);
1928
1928
  const re = new M();
1929
1929
  return q.ray.intersectPlane(j, re) ? re.y : null;
1930
1930
  }, [
1931
1931
  x,
1932
- y
1933
- ]), _ = ce((P) => {
1932
+ w
1933
+ ]), _ = ce((k) => {
1934
1934
  const T = new M();
1935
1935
  x.getWorldDirection(T), T.y = 0, T.lengthSq() < 1e-6 && T.set(0, 0, 1), T.normalize();
1936
1936
  const j = T.multiplyScalar(-1);
1937
- return new Ct().setFromNormalAndCoplanarPoint(j, new M(0, P, 0));
1937
+ return new St().setFromNormalAndCoplanarPoint(j, new M(0, k, 0));
1938
1938
  }, [
1939
1939
  x
1940
- ]), B = ce((P) => {
1941
- P.stopPropagation(), h(true), y.domElement.style.cursor = "ns-resize";
1940
+ ]), B = ce((k) => {
1941
+ k.stopPropagation(), h(true), w.domElement.style.cursor = "ns-resize";
1942
1942
  const T = _(r);
1943
1943
  b.current = T;
1944
- const j = z(P.clientX, P.clientY, T);
1945
- A.current = j != null ? r - j : 0, P.target.setPointerCapture(P.pointerId), p == null ? void 0 : p();
1944
+ const j = z(k.clientX, k.clientY, T);
1945
+ A.current = j != null ? r - j : 0, k.target.setPointerCapture(k.pointerId), p == null ? void 0 : p();
1946
1946
  }, [
1947
1947
  r,
1948
- y,
1948
+ w,
1949
1949
  _,
1950
1950
  z,
1951
1951
  p
1952
- ]), V = ce((P) => {
1952
+ ]), V = ce((k) => {
1953
1953
  if (!f || !b.current) return;
1954
- const T = z(P.clientX, P.clientY, b.current);
1954
+ const T = z(k.clientX, k.clientY, b.current);
1955
1955
  if (T == null) return;
1956
1956
  let j = T + A.current;
1957
1957
  j = Math.max(n, Math.min(s, j)), t(j);
@@ -1961,15 +1961,15 @@ let __tla = (async () => {
1961
1961
  t,
1962
1962
  n,
1963
1963
  s
1964
- ]), F = ce((P) => {
1965
- h(false), y.domElement.style.cursor = "auto", b.current = null, P.target.releasePointerCapture(P.pointerId), u == null ? void 0 : u();
1964
+ ]), F = ce((k) => {
1965
+ h(false), w.domElement.style.cursor = "auto", b.current = null, k.target.releasePointerCapture(k.pointerId), u == null ? void 0 : u();
1966
1966
  }, [
1967
- y,
1967
+ w,
1968
1968
  u
1969
1969
  ]);
1970
1970
  if (C.linePoints.length < 2) return null;
1971
1971
  const I = f ? o : v ? a : c;
1972
- return w("group", {
1972
+ return y("group", {
1973
1973
  renderOrder: 10,
1974
1974
  children: [
1975
1975
  i(ye, {
@@ -1984,10 +1984,10 @@ let __tla = (async () => {
1984
1984
  onPointerMove: V,
1985
1985
  onPointerUp: F,
1986
1986
  onPointerEnter: () => {
1987
- g(true), y.domElement.style.cursor = "ns-resize";
1987
+ g(true), w.domElement.style.cursor = "ns-resize";
1988
1988
  },
1989
1989
  onPointerLeave: () => {
1990
- f || (g(false), y.domElement.style.cursor = "auto");
1990
+ f || (g(false), w.domElement.style.cursor = "auto");
1991
1991
  }
1992
1992
  }),
1993
1993
  (v || f) && i("mesh", {
@@ -2023,7 +2023,7 @@ let __tla = (async () => {
2023
2023
  }
2024
2024
  var gr = [
2025
2025
  "color"
2026
- ], mr = Po(function(e, r) {
2026
+ ], mr = ko(function(e, r) {
2027
2027
  var t = e.color, n = t === void 0 ? "currentColor" : t, s = hr(e, gr);
2028
2028
  return An("svg", Object.assign({
2029
2029
  width: "15",
@@ -2049,7 +2049,7 @@ let __tla = (async () => {
2049
2049
  fontFamily: "system-ui, sans-serif",
2050
2050
  letterSpacing: "0.4px",
2051
2051
  lineHeight: "36px"
2052
- }, qe = {
2052
+ }, Ze = {
2053
2053
  width: "100%",
2054
2054
  padding: "10px 12px",
2055
2055
  fontSize: 15,
@@ -2059,7 +2059,7 @@ let __tla = (async () => {
2059
2059
  boxSizing: "border-box",
2060
2060
  fontFamily: "system-ui, sans-serif"
2061
2061
  }, xr = ({ amputationType: e, spacingInches: r, scanMeasurements: t, scanFrontalHeight: n, scanTransverseML: s = 0, scanTransverseAP: l = 0, onSave: c, onSkip: a, onFormChange: o, onHeightChange: d, onTransverseMLChange: p, onTransverseAPChange: u, initialValues: f, initialFrontalHeight: h }) => {
2062
- const v = e === "AK" ? "Perineum" : "MPT", g = r, x = e === "AK" ? 18 : 9, y = J(() => {
2062
+ const v = e === "AK" ? "Perineum" : "MPT", g = r, x = e === "AK" ? 18 : 9, w = J(() => {
2063
2063
  const D = [];
2064
2064
  for (let O = 2; O >= 1; O -= g) D.push(`${O}\u2033 above ${v}`);
2065
2065
  D.push(`At ${v}`);
@@ -2080,39 +2080,39 @@ let __tla = (async () => {
2080
2080
  ]), [
2081
2081
  e,
2082
2082
  v
2083
- ]), [b, k] = E(() => {
2083
+ ]), [b, P] = E(() => {
2084
2084
  if (!f) return {};
2085
2085
  const D = {};
2086
- return y.forEach((O, Q) => {
2086
+ return w.forEach((O, Q) => {
2087
2087
  f[Q] != null && f[Q] !== 0 && (D[O] = (f[Q] / 10).toFixed(1));
2088
2088
  }), D;
2089
- }), [S, C] = E(h && h > 0 ? (h / 10).toFixed(1) : ""), [z, _] = E(""), [B, V] = E(""), [F, I] = E(""), [P, T] = E(""), j = e === "AK" ? "Perineum to Distal (Axial)" : "MPT to Distal (Axial)", ee = e === "AK" ? "M/L at Perineum" : "M/L at MPT", ie = e === "AK" ? "A/P at Perineum" : "A/P at MPT", oe = J(() => y.map((D) => {
2089
+ }), [S, C] = E(h && h > 0 ? (h / 10).toFixed(1) : ""), [z, _] = E(""), [B, V] = E(""), [F, I] = E(""), [k, T] = E(""), j = e === "AK" ? "Perineum to Distal (Axial)" : "MPT to Distal (Axial)", ee = e === "AK" ? "M/L at Perineum" : "M/L at MPT", ie = e === "AK" ? "A/P at Perineum" : "A/P at MPT", oe = J(() => w.map((D) => {
2090
2090
  const O = b[D];
2091
2091
  return O != null && O !== "" && !isNaN(parseFloat(O)) ? parseFloat(O) * 10 : 0;
2092
2092
  }), [
2093
- y,
2093
+ w,
2094
2094
  b
2095
2095
  ]);
2096
- X(() => {
2096
+ G(() => {
2097
2097
  o == null ? void 0 : o(oe);
2098
2098
  }, [
2099
2099
  oe,
2100
2100
  o
2101
- ]), X(() => {
2101
+ ]), G(() => {
2102
2102
  const D = S !== "" && !isNaN(parseFloat(S)) ? parseFloat(S) * 10 : void 0;
2103
2103
  d == null ? void 0 : d(D);
2104
2104
  }, [
2105
2105
  S,
2106
2106
  d
2107
2107
  ]);
2108
- const q = e === "AK" ? z : F, re = e === "AK" ? B : P;
2109
- X(() => {
2108
+ const q = e === "AK" ? z : F, re = e === "AK" ? B : k;
2109
+ G(() => {
2110
2110
  const D = q !== "" && !isNaN(parseFloat(q)) ? parseFloat(q) * 10 : void 0;
2111
2111
  p == null ? void 0 : p(D);
2112
2112
  }, [
2113
2113
  q,
2114
2114
  p
2115
- ]), X(() => {
2115
+ ]), G(() => {
2116
2116
  const D = re !== "" && !isNaN(parseFloat(re)) ? parseFloat(re) * 10 : void 0;
2117
2117
  u == null ? void 0 : u(D);
2118
2118
  }, [
@@ -2121,14 +2121,14 @@ let __tla = (async () => {
2121
2121
  ]);
2122
2122
  const K = J(() => {
2123
2123
  for (const D of A) {
2124
- const O = y.indexOf(D);
2124
+ const O = w.indexOf(D);
2125
2125
  if (O === -1) continue;
2126
2126
  if (oe[O] === 0) return false;
2127
2127
  }
2128
2128
  return !(!S || isNaN(parseFloat(S)) || parseFloat(S) === 0);
2129
2129
  }, [
2130
2130
  oe,
2131
- y,
2131
+ w,
2132
2132
  A,
2133
2133
  S
2134
2134
  ]), he = ce(() => {
@@ -2140,7 +2140,7 @@ let __tla = (async () => {
2140
2140
  perineumML: e === "AK" ? D(z) : void 0,
2141
2141
  perineumAP: e === "AK" ? D(B) : void 0,
2142
2142
  mptML: e === "BK" ? D(F) : void 0,
2143
- mptAP: e === "BK" ? D(P) : void 0
2143
+ mptAP: e === "BK" ? D(k) : void 0
2144
2144
  });
2145
2145
  }, [
2146
2146
  K,
@@ -2149,18 +2149,18 @@ let __tla = (async () => {
2149
2149
  z,
2150
2150
  B,
2151
2151
  F,
2152
- P,
2152
+ k,
2153
2153
  e,
2154
2154
  c
2155
2155
  ]), te = ce(() => {
2156
2156
  const D = {};
2157
- if (y.forEach((O, Q) => {
2157
+ if (w.forEach((O, Q) => {
2158
2158
  const U = t[Q];
2159
2159
  if (U) {
2160
2160
  const N = U.modifiedValue ?? U.originalValue;
2161
2161
  D[O] = (N / 10).toFixed(1);
2162
2162
  }
2163
- }), k(D), n > 0 && C((n / 10).toFixed(1)), s > 0) {
2163
+ }), P(D), n > 0 && C((n / 10).toFixed(1)), s > 0) {
2164
2164
  const O = (s / 10).toFixed(1);
2165
2165
  e === "AK" ? _(O) : I(O);
2166
2166
  }
@@ -2169,14 +2169,14 @@ let __tla = (async () => {
2169
2169
  e === "AK" ? V(O) : T(O);
2170
2170
  }
2171
2171
  }, [
2172
- y,
2172
+ w,
2173
2173
  t,
2174
2174
  n,
2175
2175
  s,
2176
2176
  l,
2177
2177
  e
2178
2178
  ]);
2179
- return w("div", {
2179
+ return y("div", {
2180
2180
  style: {
2181
2181
  display: "flex",
2182
2182
  flexDirection: "column",
@@ -2185,7 +2185,7 @@ let __tla = (async () => {
2185
2185
  fontFamily: "system-ui, sans-serif"
2186
2186
  },
2187
2187
  children: [
2188
- w("div", {
2188
+ y("div", {
2189
2189
  style: {
2190
2190
  padding: "20px 22px 16px",
2191
2191
  backgroundColor: "#fff",
@@ -2196,7 +2196,7 @@ let __tla = (async () => {
2196
2196
  flexShrink: 0
2197
2197
  },
2198
2198
  children: [
2199
- w("div", {
2199
+ y("div", {
2200
2200
  style: {
2201
2201
  display: "flex",
2202
2202
  alignItems: "center",
@@ -2230,7 +2230,7 @@ let __tla = (async () => {
2230
2230
  })
2231
2231
  ]
2232
2232
  }),
2233
- w("div", {
2233
+ y("div", {
2234
2234
  style: {
2235
2235
  display: "flex",
2236
2236
  alignItems: "center",
@@ -2247,7 +2247,7 @@ let __tla = (async () => {
2247
2247
  boxShadow: "0 0 0 3px rgba(12, 67, 173, 0.13)"
2248
2248
  }
2249
2249
  }),
2250
- w("div", {
2250
+ y("div", {
2251
2251
  style: {
2252
2252
  fontSize: 17,
2253
2253
  fontWeight: 600,
@@ -2262,14 +2262,14 @@ let __tla = (async () => {
2262
2262
  })
2263
2263
  ]
2264
2264
  }),
2265
- w("div", {
2265
+ y("div", {
2266
2266
  style: {
2267
2267
  fontSize: 13,
2268
2268
  color: "rgba(0,0,0,0.6)",
2269
2269
  lineHeight: "19px"
2270
2270
  },
2271
2271
  children: [
2272
- "Values in cm, ",
2272
+ "Enter the patient's hand measurements below to compare them against the scan. Values in cm, ",
2273
2273
  g,
2274
2274
  "\u2033",
2275
2275
  " spacing. ",
@@ -2279,7 +2279,22 @@ let __tla = (async () => {
2279
2279
  },
2280
2280
  children: "*"
2281
2281
  }),
2282
- " required. Save to review against the scan."
2282
+ " required."
2283
+ ]
2284
+ }),
2285
+ y("div", {
2286
+ style: {
2287
+ fontSize: 12,
2288
+ color: "rgba(0,0,0,0.55)",
2289
+ lineHeight: "17px",
2290
+ fontStyle: "italic"
2291
+ },
2292
+ children: [
2293
+ "No hand measurements? Tap ",
2294
+ i("strong", {
2295
+ children: "Pull from Scan"
2296
+ }),
2297
+ " to prefill from the 3D scan."
2283
2298
  ]
2284
2299
  }),
2285
2300
  i("button", {
@@ -2294,7 +2309,7 @@ let __tla = (async () => {
2294
2309
  fontSize: 12,
2295
2310
  width: "100%"
2296
2311
  },
2297
- children: w("span", {
2312
+ children: y("span", {
2298
2313
  style: {
2299
2314
  display: "flex",
2300
2315
  alignItems: "center",
@@ -2314,7 +2329,7 @@ let __tla = (async () => {
2314
2329
  })
2315
2330
  ]
2316
2331
  }),
2317
- w("div", {
2332
+ y("div", {
2318
2333
  style: {
2319
2334
  flex: 1,
2320
2335
  minHeight: 0,
@@ -2339,9 +2354,9 @@ let __tla = (async () => {
2339
2354
  gap: 10,
2340
2355
  marginBottom: 20
2341
2356
  },
2342
- children: y.map((D, O) => {
2357
+ children: w.map((D, O) => {
2343
2358
  const Q = A.has(D), U = !!b[D];
2344
- return w("div", {
2359
+ return y("div", {
2345
2360
  style: {
2346
2361
  display: "flex",
2347
2362
  flexDirection: "column",
@@ -2349,7 +2364,7 @@ let __tla = (async () => {
2349
2364
  minWidth: 0
2350
2365
  },
2351
2366
  children: [
2352
- w("label", {
2367
+ y("label", {
2353
2368
  style: {
2354
2369
  fontSize: 11,
2355
2370
  fontWeight: 500,
@@ -2375,12 +2390,12 @@ let __tla = (async () => {
2375
2390
  type: "number",
2376
2391
  step: "0.1",
2377
2392
  value: b[D] ?? "",
2378
- onChange: (N) => k((Y) => ({
2393
+ onChange: (N) => P((Y) => ({
2379
2394
  ...Y,
2380
2395
  [D]: N.target.value
2381
2396
  })),
2382
2397
  style: {
2383
- ...qe,
2398
+ ...Ze,
2384
2399
  padding: "6px 8px",
2385
2400
  fontSize: 13,
2386
2401
  borderColor: U ? "rgb(12, 67, 173)" : "#ccc",
@@ -2401,14 +2416,14 @@ let __tla = (async () => {
2401
2416
  },
2402
2417
  children: "Lengths"
2403
2418
  }),
2404
- w("div", {
2419
+ y("div", {
2405
2420
  style: {
2406
2421
  display: "grid",
2407
2422
  gridTemplateColumns: "repeat(auto-fill, minmax(180px, 1fr))",
2408
2423
  gap: 10
2409
2424
  },
2410
2425
  children: [
2411
- w("div", {
2426
+ y("div", {
2412
2427
  style: {
2413
2428
  display: "flex",
2414
2429
  flexDirection: "column",
@@ -2416,7 +2431,7 @@ let __tla = (async () => {
2416
2431
  minWidth: 0
2417
2432
  },
2418
2433
  children: [
2419
- w("label", {
2434
+ y("label", {
2420
2435
  style: {
2421
2436
  fontSize: 11,
2422
2437
  fontWeight: 500,
@@ -2444,7 +2459,7 @@ let __tla = (async () => {
2444
2459
  value: S,
2445
2460
  onChange: (D) => C(D.target.value),
2446
2461
  style: {
2447
- ...qe,
2462
+ ...Ze,
2448
2463
  padding: "6px 8px",
2449
2464
  fontSize: 13,
2450
2465
  borderColor: S ? "rgb(12, 67, 173)" : "#ccc",
@@ -2454,9 +2469,9 @@ let __tla = (async () => {
2454
2469
  })
2455
2470
  ]
2456
2471
  }),
2457
- e === "AK" ? w(Re, {
2472
+ e === "AK" ? y(Re, {
2458
2473
  children: [
2459
- w("div", {
2474
+ y("div", {
2460
2475
  style: {
2461
2476
  display: "flex",
2462
2477
  flexDirection: "column",
@@ -2483,7 +2498,7 @@ let __tla = (async () => {
2483
2498
  value: z,
2484
2499
  onChange: (D) => _(D.target.value),
2485
2500
  style: {
2486
- ...qe,
2501
+ ...Ze,
2487
2502
  padding: "6px 8px",
2488
2503
  fontSize: 13,
2489
2504
  borderColor: z ? "rgb(12, 67, 173)" : "#ccc",
@@ -2493,7 +2508,7 @@ let __tla = (async () => {
2493
2508
  })
2494
2509
  ]
2495
2510
  }),
2496
- w("div", {
2511
+ y("div", {
2497
2512
  style: {
2498
2513
  display: "flex",
2499
2514
  flexDirection: "column",
@@ -2520,7 +2535,7 @@ let __tla = (async () => {
2520
2535
  value: B,
2521
2536
  onChange: (D) => V(D.target.value),
2522
2537
  style: {
2523
- ...qe,
2538
+ ...Ze,
2524
2539
  padding: "6px 8px",
2525
2540
  fontSize: 13,
2526
2541
  borderColor: B ? "rgb(12, 67, 173)" : "#ccc",
@@ -2531,9 +2546,9 @@ let __tla = (async () => {
2531
2546
  ]
2532
2547
  })
2533
2548
  ]
2534
- }) : w(Re, {
2549
+ }) : y(Re, {
2535
2550
  children: [
2536
- w("div", {
2551
+ y("div", {
2537
2552
  style: {
2538
2553
  display: "flex",
2539
2554
  flexDirection: "column",
@@ -2560,7 +2575,7 @@ let __tla = (async () => {
2560
2575
  value: F,
2561
2576
  onChange: (D) => I(D.target.value),
2562
2577
  style: {
2563
- ...qe,
2578
+ ...Ze,
2564
2579
  padding: "6px 8px",
2565
2580
  fontSize: 13,
2566
2581
  borderColor: F ? "rgb(12, 67, 173)" : "#ccc",
@@ -2570,7 +2585,7 @@ let __tla = (async () => {
2570
2585
  })
2571
2586
  ]
2572
2587
  }),
2573
- w("div", {
2588
+ y("div", {
2574
2589
  style: {
2575
2590
  display: "flex",
2576
2591
  flexDirection: "column",
@@ -2594,13 +2609,13 @@ let __tla = (async () => {
2594
2609
  i("input", {
2595
2610
  type: "number",
2596
2611
  step: "0.1",
2597
- value: P,
2612
+ value: k,
2598
2613
  onChange: (D) => T(D.target.value),
2599
2614
  style: {
2600
- ...qe,
2615
+ ...Ze,
2601
2616
  padding: "6px 8px",
2602
2617
  fontSize: 13,
2603
- borderColor: P ? "rgb(12, 67, 173)" : "#ccc",
2618
+ borderColor: k ? "rgb(12, 67, 173)" : "#ccc",
2604
2619
  borderWidth: 1
2605
2620
  },
2606
2621
  placeholder: "0.0"
@@ -2647,7 +2662,7 @@ let __tla = (async () => {
2647
2662
  "I don't want to",
2648
2663
  "I want a second opinion",
2649
2664
  "I measured from Perineum"
2650
- ], yt = {
2665
+ ], bt = {
2651
2666
  padding: "8px 20px",
2652
2667
  borderRadius: 4,
2653
2668
  fontSize: 14,
@@ -2694,7 +2709,7 @@ let __tla = (async () => {
2694
2709
  zIndex: 9999,
2695
2710
  fontFamily: "system-ui, sans-serif"
2696
2711
  },
2697
- children: w("div", {
2712
+ children: y("div", {
2698
2713
  style: {
2699
2714
  backgroundColor: "#fff",
2700
2715
  borderRadius: 12,
@@ -2702,7 +2717,7 @@ let __tla = (async () => {
2702
2717
  boxShadow: "0 24px 38px 3px rgba(0,0,0,0.14)"
2703
2718
  },
2704
2719
  children: [
2705
- w("div", {
2720
+ y("div", {
2706
2721
  style: {
2707
2722
  padding: "24px 24px 0"
2708
2723
  },
@@ -2725,7 +2740,7 @@ let __tla = (async () => {
2725
2740
  })
2726
2741
  ]
2727
2742
  }),
2728
- w("div", {
2743
+ y("div", {
2729
2744
  style: {
2730
2745
  padding: "20px 24px",
2731
2746
  display: "flex",
@@ -2736,7 +2751,7 @@ let __tla = (async () => {
2736
2751
  [
2737
2752
  ...br,
2738
2753
  "Other"
2739
- ].map((f) => w("label", {
2754
+ ].map((f) => y("label", {
2740
2755
  style: {
2741
2756
  display: "flex",
2742
2757
  alignItems: "center",
@@ -2790,7 +2805,7 @@ let __tla = (async () => {
2790
2805
  })
2791
2806
  ]
2792
2807
  }),
2793
- w("div", {
2808
+ y("div", {
2794
2809
  style: {
2795
2810
  display: "flex",
2796
2811
  justifyContent: "flex-end",
@@ -2802,7 +2817,7 @@ let __tla = (async () => {
2802
2817
  i("button", {
2803
2818
  onClick: d,
2804
2819
  style: {
2805
- ...yt,
2820
+ ...bt,
2806
2821
  backgroundColor: "#fff",
2807
2822
  border: "1px solid #ddd",
2808
2823
  color: "#666"
@@ -2813,7 +2828,7 @@ let __tla = (async () => {
2813
2828
  onClick: u,
2814
2829
  disabled: !p,
2815
2830
  style: {
2816
- ...yt,
2831
+ ...bt,
2817
2832
  backgroundColor: p ? "rgb(12, 67, 173)" : "#e0e0e0",
2818
2833
  border: "none",
2819
2834
  color: p ? "#fff" : "#9e9e9e",
@@ -2838,7 +2853,7 @@ let __tla = (async () => {
2838
2853
  zIndex: 9999,
2839
2854
  fontFamily: "system-ui, sans-serif"
2840
2855
  },
2841
- children: w("div", {
2856
+ children: y("div", {
2842
2857
  style: {
2843
2858
  backgroundColor: "#fff",
2844
2859
  borderRadius: 8,
@@ -2864,7 +2879,7 @@ let __tla = (async () => {
2864
2879
  },
2865
2880
  children: "Your measurements will be submitted without comparing to the scan. Are you sure?"
2866
2881
  }),
2867
- w("div", {
2882
+ y("div", {
2868
2883
  style: {
2869
2884
  display: "flex",
2870
2885
  justifyContent: "flex-end",
@@ -2874,7 +2889,7 @@ let __tla = (async () => {
2874
2889
  i("button", {
2875
2890
  onClick: r,
2876
2891
  style: {
2877
- ...yt,
2892
+ ...bt,
2878
2893
  backgroundColor: "#fff",
2879
2894
  border: "1px solid #bdbdbd",
2880
2895
  color: "#333"
@@ -2884,7 +2899,7 @@ let __tla = (async () => {
2884
2899
  i("button", {
2885
2900
  onClick: o,
2886
2901
  style: {
2887
- ...yt,
2902
+ ...bt,
2888
2903
  backgroundColor: "rgb(12, 67, 173)",
2889
2904
  border: "none",
2890
2905
  color: "#fff"
@@ -2902,13 +2917,13 @@ let __tla = (async () => {
2902
2917
  if (s < 1) return null;
2903
2918
  const l = 30, c = s / l, a = [];
2904
2919
  for (let x = 0; x < l; x++) {
2905
- const y = r + x * c, A = r + (x + 1) * c;
2906
- let b = 0, k = 0, S = 0, C = 0;
2920
+ const w = r + x * c, A = r + (x + 1) * c;
2921
+ let b = 0, P = 0, S = 0, C = 0;
2907
2922
  for (let z = 0; z < n.count; z++) {
2908
2923
  const _ = n.getY(z);
2909
- _ >= y && _ < A && (b += n.getX(z), k += _, S += n.getZ(z), C++);
2924
+ _ >= w && _ < A && (b += n.getX(z), P += _, S += n.getZ(z), C++);
2910
2925
  }
2911
- C > 20 && a.push(new M(b / C, k / C, S / C));
2926
+ C > 20 && a.push(new M(b / C, P / C, S / C));
2912
2927
  }
2913
2928
  if (a.length < 5) return null;
2914
2929
  const o = new M();
@@ -2916,14 +2931,14 @@ let __tla = (async () => {
2916
2931
  o.divideScalar(a.length);
2917
2932
  let d = 0, p = 0, u = 0, f = 0, h = 0, v = 0;
2918
2933
  for (const x of a) {
2919
- const y = x.x - o.x, A = x.y - o.y, b = x.z - o.z;
2920
- d += y * y, p += y * A, u += y * b, f += A * A, h += A * b, v += b * b;
2934
+ const w = x.x - o.x, A = x.y - o.y, b = x.z - o.z;
2935
+ d += w * w, p += w * A, u += w * b, f += A * A, h += A * b, v += b * b;
2921
2936
  }
2922
2937
  let g = new M(0.01, 1, 0.01).normalize();
2923
2938
  for (let x = 0; x < 30; x++) {
2924
- const y = d * g.x + p * g.y + u * g.z, A = p * g.x + f * g.y + h * g.z, b = u * g.x + h * g.y + v * g.z, k = new M(y, A, b), S = k.length();
2925
- if (S < 1e-10 || (k.divideScalar(S), g.distanceTo(k) < 1e-8)) break;
2926
- g = k;
2939
+ const w = d * g.x + p * g.y + u * g.z, A = p * g.x + f * g.y + h * g.z, b = u * g.x + h * g.y + v * g.z, P = new M(w, A, b), S = P.length();
2940
+ if (S < 1e-10 || (P.divideScalar(S), g.distanceTo(P) < 1e-8)) break;
2941
+ g = P;
2927
2942
  }
2928
2943
  return g.y < 0 && g.negate(), g;
2929
2944
  }
@@ -2942,14 +2957,14 @@ let __tla = (async () => {
2942
2957
  "#44cc44",
2943
2958
  "#4488ff"
2944
2959
  ];
2945
- function Gn(e) {
2960
+ function Xn(e) {
2946
2961
  const r = e.getAttribute("position"), t = r.count, n = new M();
2947
2962
  for (let g = 0; g < t; g++) n.x += r.getX(g), n.y += r.getY(g), n.z += r.getZ(g);
2948
2963
  n.divideScalar(t);
2949
2964
  let s = 0, l = 0, c = 0, a = 0, o = 0, d = 0;
2950
2965
  for (let g = 0; g < t; g++) {
2951
- const x = r.getX(g) - n.x, y = r.getY(g) - n.y, A = r.getZ(g) - n.z;
2952
- s += x * x, l += x * y, c += x * A, a += y * y, o += y * A, d += A * A;
2966
+ const x = r.getX(g) - n.x, w = r.getY(g) - n.y, A = r.getZ(g) - n.z;
2967
+ s += x * x, l += x * w, c += x * A, a += w * w, o += w * A, d += A * A;
2953
2968
  }
2954
2969
  s /= t, l /= t, c /= t, a /= t, o /= t, d /= t;
2955
2970
  const p = [], u = [], f = [
@@ -2970,19 +2985,19 @@ let __tla = (async () => {
2970
2985
  ]
2971
2986
  ];
2972
2987
  for (let g = 0; g < 3; g++) {
2973
- let x = new M(1 + g * 0.1, 1 - g * 0.1, 0.5 + g * 0.3).normalize(), y = 0;
2988
+ let x = new M(1 + g * 0.1, 1 - g * 0.1, 0.5 + g * 0.3).normalize(), w = 0;
2974
2989
  for (let A = 0; A < 100; A++) {
2975
- const b = f[0][0] * x.x + f[0][1] * x.y + f[0][2] * x.z, k = f[1][0] * x.x + f[1][1] * x.y + f[1][2] * x.z, S = f[2][0] * x.x + f[2][1] * x.y + f[2][2] * x.z, C = new M(b, k, S);
2976
- if (y = C.length(), y < 1e-12) break;
2977
- if (C.divideScalar(y), x.distanceTo(C) < 1e-10) {
2990
+ const b = f[0][0] * x.x + f[0][1] * x.y + f[0][2] * x.z, P = f[1][0] * x.x + f[1][1] * x.y + f[1][2] * x.z, S = f[2][0] * x.x + f[2][1] * x.y + f[2][2] * x.z, C = new M(b, P, S);
2991
+ if (w = C.length(), w < 1e-12) break;
2992
+ if (C.divideScalar(w), x.distanceTo(C) < 1e-10) {
2978
2993
  x = C;
2979
2994
  break;
2980
2995
  }
2981
2996
  x = C;
2982
2997
  }
2983
- p.push(x.clone()), u.push(y);
2998
+ p.push(x.clone()), u.push(w);
2984
2999
  for (let A = 0; A < 3; A++) for (let b = 0; b < 3; b++) {
2985
- const k = [
3000
+ const P = [
2986
3001
  x.x,
2987
3002
  x.y,
2988
3003
  x.z
@@ -2991,7 +3006,7 @@ let __tla = (async () => {
2991
3006
  x.y,
2992
3007
  x.z
2993
3008
  ][b];
2994
- f[A][b] -= y * k * S;
3009
+ f[A][b] -= w * P * S;
2995
3010
  }
2996
3011
  }
2997
3012
  const h = new M();
@@ -3003,13 +3018,13 @@ let __tla = (async () => {
3003
3018
  0
3004
3019
  ];
3005
3020
  for (let g = 0; g < 3; g++) {
3006
- let x = 1 / 0, y = -1 / 0;
3021
+ let x = 1 / 0, w = -1 / 0;
3007
3022
  const A = p[g];
3008
3023
  for (let b = 0; b < t; b++) {
3009
- const k = r.getX(b) - h.x, S = r.getY(b) - h.y, C = r.getZ(b) - h.z, z = k * A.x + S * A.y + C * A.z;
3010
- z < x && (x = z), z > y && (y = z);
3024
+ const P = r.getX(b) - h.x, S = r.getY(b) - h.y, C = r.getZ(b) - h.z, z = P * A.x + S * A.y + C * A.z;
3025
+ z < x && (x = z), z > w && (w = z);
3011
3026
  }
3012
- v[g] = (y - x) / 2;
3027
+ v[g] = (w - x) / 2;
3013
3028
  }
3014
3029
  return {
3015
3030
  axes: p,
@@ -3113,7 +3128,7 @@ let __tla = (async () => {
3113
3128
  }, [
3114
3129
  t
3115
3130
  ]), s = n < 1 ? "#44ff44" : n < 5 ? "#ffcc00" : "#ff4444";
3116
- return w("group", {
3131
+ return y("group", {
3117
3132
  children: [
3118
3133
  i(ye, {
3119
3134
  points: [
@@ -3123,7 +3138,7 @@ let __tla = (async () => {
3123
3138
  color: s,
3124
3139
  lineWidth: 3
3125
3140
  }),
3126
- w("mesh", {
3141
+ y("mesh", {
3127
3142
  position: e,
3128
3143
  children: [
3129
3144
  i("sphereGeometry", {
@@ -3138,7 +3153,7 @@ let __tla = (async () => {
3138
3153
  })
3139
3154
  ]
3140
3155
  }),
3141
- w("mesh", {
3156
+ y("mesh", {
3142
3157
  position: r,
3143
3158
  children: [
3144
3159
  i("sphereGeometry", {
@@ -3183,7 +3198,7 @@ let __tla = (async () => {
3183
3198
  return i("group", {
3184
3199
  children: c.map((a, o) => {
3185
3200
  const d = (a.regionMin + a.regionMax) / 2, p = new M(0, d, 0), u = p.clone().addScaledVector(a.axis, l), f = p.clone().addScaledVector(a.axis, -l), h = o / Math.max(1, c.length - 1), v = a.angleDeg < 0.5 ? `hsl(${120 - h * 120}, 80%, 60%)` : `hsl(${40 - a.angleDeg * 2}, 90%, 55%)`;
3186
- return w("group", {
3201
+ return y("group", {
3187
3202
  children: [
3188
3203
  i(ye, {
3189
3204
  points: [
@@ -3240,7 +3255,7 @@ let __tla = (async () => {
3240
3255
  })
3241
3256
  });
3242
3257
  }
3243
- function kr({ pca: e, modelSize: r }) {
3258
+ function Pr({ pca: e, modelSize: r }) {
3244
3259
  const t = e.axes[0], n = r * 0.6, s = e.center.clone().addScaledVector(t, n), l = e.center.clone().addScaledVector(t, -n);
3245
3260
  return i(ye, {
3246
3261
  points: [
@@ -3254,20 +3269,20 @@ let __tla = (async () => {
3254
3269
  gapSize: 2
3255
3270
  });
3256
3271
  }
3257
- function Pr({ geometry: e, redY: r, greenY: t, modelSize: n, measurementGeometry: s }) {
3272
+ function kr({ geometry: e, redY: r, greenY: t, modelSize: n, measurementGeometry: s }) {
3258
3273
  const l = J(() => {
3259
- const p = s ?? e, u = Zt(p), f = new M(0, 1, 0), h = 5, g = t + 3 * 25.4, x = [];
3274
+ const p = s ?? e, u = Kt(p), f = new M(0, 1, 0), h = 5, g = t + 3 * 25.4, x = [];
3260
3275
  for (let _ = r + h; _ < g; _ += h) {
3261
- const B = Go(u, p, new M(0, _, 0), f);
3276
+ const B = Xo(u, p, new M(0, _, 0), f);
3262
3277
  B > 0 && x.push({
3263
3278
  y: _,
3264
3279
  circ: B
3265
3280
  });
3266
3281
  }
3267
3282
  if (x.length < 5) return null;
3268
- const y = t - r, A = r + y * 0.3, b = r + y * 0.7, k = x.filter((_) => _.y >= A && _.y <= b);
3269
- if (k.length < 3) return null;
3270
- const S = k.map((_) => _.circ).sort((_, B) => _ - B), C = S[Math.floor(S.length / 2)], z = Math.max(...x.map((_) => _.circ));
3283
+ const w = t - r, A = r + w * 0.3, b = r + w * 0.7, P = x.filter((_) => _.y >= A && _.y <= b);
3284
+ if (P.length < 3) return null;
3285
+ const S = P.map((_) => _.circ).sort((_, B) => _ - B), C = S[Math.floor(S.length / 2)], z = Math.max(...x.map((_) => _.circ));
3271
3286
  return {
3272
3287
  circumferences: x,
3273
3288
  baseline: C,
@@ -3280,7 +3295,7 @@ let __tla = (async () => {
3280
3295
  ]);
3281
3296
  if (!l) return null;
3282
3297
  const { circumferences: c, baseline: a, maxCirc: o } = l, d = n * 0.3 / o;
3283
- return w("group", {
3298
+ return y("group", {
3284
3299
  children: [
3285
3300
  c.map(({ y: p, circ: u }, f) => {
3286
3301
  const h = u / a, v = h > 1.6 ? "#ff4444" : h > 1.3 ? "#ffcc00" : "#22cc66", g = u * d;
@@ -3297,7 +3312,7 @@ let __tla = (async () => {
3297
3312
  }),
3298
3313
  (() => {
3299
3314
  const p = a * 1.6 * d, u = c[0].y, f = c[c.length - 1].y;
3300
- return w(Re, {
3315
+ return y(Re, {
3301
3316
  children: [
3302
3317
  i(ye, {
3303
3318
  points: [
@@ -3337,7 +3352,7 @@ let __tla = (async () => {
3337
3352
  const n = e.colors[t] ?? "#888888", s = t === e.innerIdx;
3338
3353
  r.computeBoundingBox();
3339
3354
  const l = new M();
3340
- return r.boundingBox.getCenter(l), w("group", {
3355
+ return r.boundingBox.getCenter(l), y("group", {
3341
3356
  children: [
3342
3357
  i("mesh", {
3343
3358
  geometry: r,
@@ -3425,7 +3440,7 @@ let __tla = (async () => {
3425
3440
  });
3426
3441
  }
3427
3442
  function _r({ mesh: e, layers: r, landmarkPoints: t, componentDebug: n, aoData: s, aoGeometry: l, measurementGeometry: c }) {
3428
- const a = e.geometry, o = J(() => a.getAttribute("position") ? Gn(a) : null, [
3443
+ const a = e.geometry, o = J(() => a.getAttribute("position") ? Xn(a) : null, [
3429
3444
  a
3430
3445
  ]), d = J(() => !t || t.length < 2 ? null : {
3431
3446
  red: new M(t[1].position.x, t[1].position.y, t[1].position.z),
@@ -3433,7 +3448,7 @@ let __tla = (async () => {
3433
3448
  }, [
3434
3449
  t
3435
3450
  ]);
3436
- return w("group", {
3451
+ return y("group", {
3437
3452
  children: [
3438
3453
  r.pcaAxes && o && i(Cr, {
3439
3454
  pca: o
@@ -3441,7 +3456,7 @@ let __tla = (async () => {
3441
3456
  r.obb && o && i(Ar, {
3442
3457
  pca: o
3443
3458
  }),
3444
- r.obbAxis && o && i(kr, {
3459
+ r.obbAxis && o && i(Pr, {
3445
3460
  pca: o,
3446
3461
  modelSize: o.halfExtents[0] ? Math.max(...o.halfExtents) * 2 : 100
3447
3462
  }),
@@ -3452,7 +3467,7 @@ let __tla = (async () => {
3452
3467
  geometry: l ?? a,
3453
3468
  aoData: s
3454
3469
  }),
3455
- r.circumferenceScan && d && i(Pr, {
3470
+ r.circumferenceScan && d && i(kr, {
3456
3471
  geometry: a,
3457
3472
  redY: d.red.y,
3458
3473
  greenY: d.green.y,
@@ -3492,7 +3507,7 @@ let __tla = (async () => {
3492
3507
  function Rr({ mesh: e }) {
3493
3508
  const r = e.geometry, t = J(() => {
3494
3509
  if (!r.getAttribute("position")) return null;
3495
- const l = Gn(r), c = l.axes[0], a = l.halfExtents[0] * 1.3;
3510
+ const l = Xn(r), c = l.axes[0], a = l.halfExtents[0] * 1.3;
3496
3511
  return {
3497
3512
  axis: c,
3498
3513
  center: l.center,
@@ -3519,7 +3534,7 @@ let __tla = (async () => {
3519
3534
  renderOrder: 999
3520
3535
  });
3521
3536
  }
3522
- const Xn = [
3537
+ const Gn = [
3523
3538
  {
3524
3539
  key: "pcaAxes",
3525
3540
  label: "PCA Axes (full mesh)",
@@ -3576,10 +3591,10 @@ let __tla = (async () => {
3576
3591
  group: "Alignment"
3577
3592
  }
3578
3593
  ], Wr = [
3579
- ...new Set(Xn.map((e) => e.group))
3594
+ ...new Set(Gn.map((e) => e.group))
3580
3595
  ];
3581
3596
  function Ir({ layers: e, onToggleLayer: r, isDoubleShell: t }) {
3582
- return w("div", {
3597
+ return y("div", {
3583
3598
  style: {
3584
3599
  position: "absolute",
3585
3600
  top: 16,
@@ -3608,8 +3623,8 @@ let __tla = (async () => {
3608
3623
  children: "Debug Layers"
3609
3624
  }),
3610
3625
  Wr.map((n) => {
3611
- const s = Xn.filter((l) => l.group === n && !(l.hideWhenDoubleShell && t));
3612
- return s.length === 0 ? null : w("div", {
3626
+ const s = Gn.filter((l) => l.group === n && !(l.hideWhenDoubleShell && t));
3627
+ return s.length === 0 ? null : y("div", {
3613
3628
  children: [
3614
3629
  i("div", {
3615
3630
  style: {
@@ -3623,7 +3638,7 @@ let __tla = (async () => {
3623
3638
  },
3624
3639
  children: n
3625
3640
  }),
3626
- s.map(({ key: l, label: c, color: a }) => w("label", {
3641
+ s.map(({ key: l, label: c, color: a }) => y("label", {
3627
3642
  style: {
3628
3643
  display: "flex",
3629
3644
  alignItems: "center",
@@ -3669,15 +3684,15 @@ let __tla = (async () => {
3669
3684
  });
3670
3685
  }
3671
3686
  const Br = ({ config: e, spacingType: r, scanUrl: t, formMeasurements: n, onComplete: s, isDebugUser: l = false, onAnalyticsEvent: c, wasmModule: a, autoProcessOnTwoPoints: o = false }) => {
3672
- const [d, p] = E(null), [u, f] = E(0), [h, v] = E(false), [g, x] = E(false), [y, A] = E(""), [b, k] = E("3D"), [S, C] = E(r === "AK" ? 2 : 1), [z, _] = E(false), [B, V] = E(null), [F, I] = E(r ?? null), [P, T] = E("cm"), [j, ee] = E(false), [ie, oe] = E(""), [q, re] = E(false), [K, he] = E(false), [te, D] = E(false), [O, Q] = E(false), [U, N] = E(null), [Y, fe] = E(null), [se, ge] = E(null), [ue, we] = E(false), [$, ke] = E([]), [De, Ie] = E(null), [me, Me] = E(null), [Mt, Ft] = E(null), [it, Ut] = E(null), [Kn, Jt] = E(false), [st, Qt] = E(null), [kt, Le] = E(null), [We, Zn] = E(false), [en, qn] = E(vr), [He, tn] = E("obj"), [Ae, Pt] = E(n), [Ve, Lt] = E(true), [Ye, Je] = E(false), [Dt, nn] = E(false), [Be, lt] = E(false), Ke = de(false), [Un, at] = E(false), [_t, on] = E(() => {
3687
+ const [d, p] = E(null), [u, f] = E(0), [h, v] = E(false), [g, x] = E(false), [w, A] = E(""), [b, P] = E("3D"), [S, C] = E(r === "AK" ? 2 : 1), [z, _] = E(false), [B, V] = E(null), [F, I] = E(r ?? null), [k, T] = E("cm"), [j, ee] = E(false), [ie, oe] = E(""), [q, re] = E(false), [K, he] = E(false), [te, D] = E(false), [O, Q] = E(false), [U, N] = E(null), [Y, fe] = E(null), [se, ge] = E(null), [ue, we] = E(false), [$, Pe] = E([]), [De, Ie] = E(null), [me, Me] = E(null), [zt, Mt] = E(null), [rt, qt] = E(null), [Kn, Ut] = E(false), [it, Jt] = E(null), [Ft, Le] = E(null), [We, Zn] = E(false), [Qt, qn] = E(vr), [Oe, en] = E("obj"), [Ae, Pt] = E(n), [He, kt] = E(true), [Ge, Ue] = E(false), [Lt, tn] = E(false), [st, lt] = E(false), Ye = de(false), [Un, nn] = E(false), [Dt, on] = E(() => {
3673
3688
  try {
3674
3689
  return localStorage.getItem("gm_helpTipDismissed") !== "1";
3675
3690
  } catch {
3676
3691
  return true;
3677
3692
  }
3678
3693
  });
3679
- X(() => {
3680
- if (!_t) return;
3694
+ G(() => {
3695
+ if (!Dt) return;
3681
3696
  const m = setTimeout(() => {
3682
3697
  on(false);
3683
3698
  try {
@@ -3687,76 +3702,76 @@ let __tla = (async () => {
3687
3702
  }, 1e4);
3688
3703
  return () => clearTimeout(m);
3689
3704
  }, [
3690
- _t
3691
- ]), X(() => {
3705
+ Dt
3706
+ ]), G(() => {
3692
3707
  if (!K) return;
3693
3708
  const m = setTimeout(() => he(false), 5e3);
3694
3709
  return () => clearTimeout(m);
3695
3710
  }, [
3696
3711
  K
3697
3712
  ]);
3698
- const Rt = de(null), [Ne, Jn] = E(0);
3699
- X(() => {
3700
- if (!Rt.current) return;
3713
+ const _t = de(null), [Ve, Jn] = E(0);
3714
+ G(() => {
3715
+ if (!_t.current) return;
3701
3716
  const m = new ResizeObserver((L) => {
3702
3717
  for (const R of L) Jn(R.contentRect.width);
3703
3718
  });
3704
- return m.observe(Rt.current), () => m.disconnect();
3719
+ return m.observe(_t.current), () => m.disconnect();
3705
3720
  }, []);
3706
- const [ve, Qn] = E(null), [eo, to] = E(void 0), [no, oo] = E(void 0), [ro, io] = E(void 0), [so, lo] = E(void 0), [rn] = E("#c8c8c8"), [ao] = E(1), [Ee, co] = E(false), [Wt, sn] = E([]), ct = de(null), je = de(null), dt = de(false), fo = de(null), It = de(null), Bt = de(null), Qe = ce(async (m) => {
3707
- if (!Bt.current) return;
3721
+ const [ve, Qn] = E(null), [eo, to] = E(void 0), [no, oo] = E(void 0), [ro, io] = E(void 0), [so, lo] = E(void 0), [rn] = E("#c8c8c8"), [ao] = E(1), [Be, co] = E(false), [Rt, sn] = E([]), at = de(null), Ne = de(null), ct = de(false), fo = de(null), Wt = de(null), It = de(null), Je = ce(async (m) => {
3722
+ if (!It.current) return;
3708
3723
  const L = (m == null ? void 0 : m.restoreView) ?? true;
3709
3724
  try {
3710
- const R = Bt.current, W = () => {
3725
+ const R = It.current, W = () => {
3711
3726
  const ne = R.querySelector("canvas");
3712
3727
  if (!ne) return;
3713
- const ae = R.getBoundingClientRect(), Se = ne.width, Oe = ne.height, Fe = Se / ae.width, nt = Oe / ae.height, ht = document.createElement("canvas");
3714
- ht.width = Se, ht.height = Oe;
3715
- const Ce = ht.getContext("2d");
3728
+ const ae = R.getBoundingClientRect(), Se = ne.width, $e = ne.height, Fe = Se / ae.width, tt = $e / ae.height, pt = document.createElement("canvas");
3729
+ pt.width = Se, pt.height = $e;
3730
+ const Ce = pt.getContext("2d");
3716
3731
  return Ce.drawImage(ne, 0, 0), R.querySelectorAll("[style*='pointer-events']").forEach((wo) => {
3717
3732
  const mn = wo;
3718
3733
  if (mn.hasAttribute("data-finalizing-overlay")) return;
3719
3734
  const xn = mn.querySelectorAll("div[style*='background']");
3720
- xn.length !== 0 && xn.forEach((Ze) => {
3735
+ xn.length !== 0 && xn.forEach((Ke) => {
3721
3736
  var _a;
3722
- const _e = Ze.getBoundingClientRect();
3737
+ const _e = Ke.getBoundingClientRect();
3723
3738
  if (_e.width === 0 || _e.height === 0) return;
3724
- let jt = 0, ot = Ze;
3725
- for (; ot && ot !== R; ) {
3726
- const xt = (ot.style.transform || "").match(/rotate\((-?\d+)deg\)/);
3727
- if (xt) {
3728
- jt = parseFloat(xt[1]);
3739
+ let Nt = 0, nt = Ke;
3740
+ for (; nt && nt !== R; ) {
3741
+ const mt = (nt.style.transform || "").match(/rotate\((-?\d+)deg\)/);
3742
+ if (mt) {
3743
+ Nt = parseFloat(mt[1]);
3729
3744
  break;
3730
3745
  }
3731
- ot = ot.parentElement;
3746
+ nt = nt.parentElement;
3732
3747
  }
3733
- const bn = (_e.left + _e.width / 2 - ae.left) * Fe, yn = (_e.top + _e.height / 2 - ae.top) * nt, gt = Math.abs(jt) > 1, wn = (gt ? _e.height : _e.width) * Fe, vn = (gt ? _e.width : _e.height) * nt;
3734
- Ce.save(), Ce.translate(bn, yn), gt && Ce.rotate(jt * Math.PI / 180);
3735
- const vo = Ze.style.backgroundColor || "rgba(0,0,0,0.75)";
3748
+ const bn = (_e.left + _e.width / 2 - ae.left) * Fe, yn = (_e.top + _e.height / 2 - ae.top) * tt, ht = Math.abs(Nt) > 1, wn = (ht ? _e.height : _e.width) * Fe, vn = (ht ? _e.width : _e.height) * tt;
3749
+ Ce.save(), Ce.translate(bn, yn), ht && Ce.rotate(Nt * Math.PI / 180);
3750
+ const vo = Ke.style.backgroundColor || "rgba(0,0,0,0.75)";
3736
3751
  Ce.fillStyle = vo;
3737
3752
  const So = 4 * Fe;
3738
3753
  Ce.beginPath(), Ce.roundRect(-wn / 2, -vn / 2, wn, vn, So), Ce.fill();
3739
- const Sn = ((_a = Ze.textContent) == null ? void 0 : _a.trim()) || "";
3754
+ const Sn = ((_a = Ke.textContent) == null ? void 0 : _a.trim()) || "";
3740
3755
  if (Sn) {
3741
- const mt = window.getComputedStyle(Ze), xt = parseFloat(mt.fontSize || "14") * nt;
3742
- Ce.font = `${mt.fontWeight || "normal"} ${xt}px monospace`, Ce.fillStyle = mt.color || "#fff", Ce.textAlign = "center", Ce.textBaseline = "middle";
3743
- const Cn = Ze.querySelectorAll("span");
3744
- Cn.length > 0 && !gt ? Cn.forEach((Gt) => {
3745
- const rt = Gt.getBoundingClientRect();
3746
- if (rt.width === 0) return;
3747
- const Co = (rt.left + rt.width / 2 - ae.left) * Fe - bn, Ao = (rt.top + rt.height / 2 - ae.top) * nt - yn, Xt = window.getComputedStyle(Gt), zo = parseFloat(Xt.fontSize) * nt;
3748
- Ce.font = `${Xt.fontWeight || "normal"} ${zo}px monospace`, Ce.fillStyle = Xt.color || "#fff", Ce.fillText(Gt.textContent || "", Co, Ao);
3756
+ const gt = window.getComputedStyle(Ke), mt = parseFloat(gt.fontSize || "14") * tt;
3757
+ Ce.font = `${gt.fontWeight || "normal"} ${mt}px monospace`, Ce.fillStyle = gt.color || "#fff", Ce.textAlign = "center", Ce.textBaseline = "middle";
3758
+ const Cn = Ke.querySelectorAll("span");
3759
+ Cn.length > 0 && !ht ? Cn.forEach((jt) => {
3760
+ const ot = jt.getBoundingClientRect();
3761
+ if (ot.width === 0) return;
3762
+ const Co = (ot.left + ot.width / 2 - ae.left) * Fe - bn, Ao = (ot.top + ot.height / 2 - ae.top) * tt - yn, Xt = window.getComputedStyle(jt), zo = parseFloat(Xt.fontSize) * tt;
3763
+ Ce.font = `${Xt.fontWeight || "normal"} ${zo}px monospace`, Ce.fillStyle = Xt.color || "#fff", Ce.fillText(jt.textContent || "", Co, Ao);
3749
3764
  }) : Ce.fillText(Sn, 0, 0);
3750
3765
  }
3751
3766
  Ce.restore();
3752
3767
  });
3753
- }), ht.toDataURL("image/png");
3768
+ }), pt.toDataURL("image/png");
3754
3769
  };
3755
- It.current && It.current(), await new Promise((ne) => requestAnimationFrame(() => requestAnimationFrame(ne)));
3770
+ Wt.current && Wt.current(), await new Promise((ne) => requestAnimationFrame(() => requestAnimationFrame(ne)));
3756
3771
  const pe = W();
3757
- k("2D"), await new Promise((ne) => setTimeout(ne, 150)), await new Promise((ne) => requestAnimationFrame(() => requestAnimationFrame(ne)));
3772
+ P("2D"), await new Promise((ne) => setTimeout(ne, 150)), await new Promise((ne) => requestAnimationFrame(() => requestAnimationFrame(ne)));
3758
3773
  const H = W();
3759
- return L && k("3D"), !pe || !H ? void 0 : {
3774
+ return L && P("3D"), !pe || !H ? void 0 : {
3760
3775
  frontal_view_png: pe,
3761
3776
  side_view_png: H
3762
3777
  };
@@ -3769,75 +3784,75 @@ let __tla = (async () => {
3769
3784
  ...W.slice(-200),
3770
3785
  `[${R}] ${m}`
3771
3786
  ]);
3772
- }, []), { landmarkPoints: G, clearLandmarkPoints: uo, addLandmarkPoint: ln, removeLandmarkPoint: an, updateLandmarkPositions: cn, setAligned: dn, isAligned: le, setCut: fn, isCut: Et, reset: ft } = qt();
3773
- X(() => {
3774
- ft();
3787
+ }, []), { landmarkPoints: X, clearLandmarkPoints: uo, addLandmarkPoint: ln, removeLandmarkPoint: an, updateLandmarkPositions: cn, setAligned: dn, isAligned: le, setCut: fn, isCut: Bt, reset: dt } = Zt();
3788
+ G(() => {
3789
+ dt();
3775
3790
  }, [
3776
- ft
3791
+ dt
3777
3792
  ]);
3778
- const ut = S * vt;
3779
- X(() => {
3780
- if (!l || G.length === 0) return;
3781
- const m = G[G.length - 1];
3782
- ze(`LANDMARK[${G.length - 1}]: placed at (${m.position.x.toFixed(1)}, ${m.position.y.toFixed(1)}, ${m.position.z.toFixed(1)}) face=${m.faceIndex}`);
3793
+ const ft = S * wt;
3794
+ G(() => {
3795
+ if (!l || X.length === 0) return;
3796
+ const m = X[X.length - 1];
3797
+ ze(`LANDMARK[${X.length - 1}]: placed at (${m.position.x.toFixed(1)}, ${m.position.y.toFixed(1)}, ${m.position.z.toFixed(1)}) face=${m.faceIndex}`);
3783
3798
  }, [
3784
- G.length,
3799
+ X.length,
3785
3800
  l,
3786
3801
  ze
3787
- ]), X(() => {
3802
+ ]), G(() => {
3788
3803
  l && le && ze("STATE: mesh aligned");
3789
3804
  }, [
3790
3805
  le,
3791
3806
  l,
3792
3807
  ze
3793
- ]), X(() => {
3794
- l && Et && ze("STATE: mesh cut");
3808
+ ]), G(() => {
3809
+ l && Bt && ze("STATE: mesh cut");
3795
3810
  }, [
3796
- Et,
3811
+ Bt,
3797
3812
  l,
3798
3813
  ze
3799
- ]), X(() => {
3800
- ct.current && (ct.current.scrollTop = ct.current.scrollHeight);
3814
+ ]), G(() => {
3815
+ at.current && (at.current.scrollTop = at.current.scrollHeight);
3801
3816
  }, [
3802
- Wt
3817
+ Rt
3803
3818
  ]);
3804
- const Te = J(() => se ? new Z.Mesh(se) : null, [
3819
+ const Ee = J(() => se ? new Z.Mesh(se) : null, [
3805
3820
  se
3806
3821
  ]);
3807
- X(() => () => {
3822
+ G(() => () => {
3808
3823
  d && d.geometry.dispose();
3809
3824
  }, [
3810
3825
  d
3811
- ]), X(() => () => {
3826
+ ]), G(() => () => {
3812
3827
  se && se.dispose();
3813
3828
  }, [
3814
3829
  se
3815
- ]), X(() => () => {
3830
+ ]), G(() => () => {
3816
3831
  Y && Y.dispose();
3817
3832
  }, [
3818
3833
  Y
3819
- ]), X(() => () => {
3834
+ ]), G(() => () => {
3820
3835
  B && B.geometry.dispose();
3821
3836
  }, [
3822
3837
  B
3823
- ]), X(() => {
3838
+ ]), G(() => {
3824
3839
  n && Pt(n);
3825
3840
  }, [
3826
3841
  n
3827
- ]), X(() => {
3842
+ ]), G(() => {
3828
3843
  n || Pt(void 0);
3829
3844
  }, [
3830
3845
  S
3831
3846
  ]);
3832
- const pt = de(false);
3833
- X(() => {
3834
- if (!le || $.length === 0 || pt.current || !c) return;
3835
- pt.current = true;
3836
- const m = G.length >= 3 ? Math.abs(G[2].position.y - G[0].position.y) : null;
3847
+ const ut = de(false);
3848
+ G(() => {
3849
+ if (!le || $.length === 0 || ut.current || !c) return;
3850
+ ut.current = true;
3851
+ const m = X.length >= 3 ? Math.abs(X[2].position.y - X[0].position.y) : null;
3837
3852
  c("dimensions_calculated", {
3838
3853
  spacing_type: F,
3839
3854
  source_unit: "mm",
3840
- file_format: He,
3855
+ file_format: Oe,
3841
3856
  measurement_source: "scan_derived",
3842
3857
  is_double_wall: te,
3843
3858
  is_unit_converted: false,
@@ -3852,12 +3867,12 @@ let __tla = (async () => {
3852
3867
  }, [
3853
3868
  le,
3854
3869
  $
3855
- ]), X(() => {
3856
- a !== void 0 && (je.current = a), a !== void 0 && co(true);
3870
+ ]), G(() => {
3871
+ a !== void 0 && (Ne.current = a), a !== void 0 && co(true);
3857
3872
  }, [
3858
3873
  a
3859
3874
  ]);
3860
- const et = ce((m, L) => {
3875
+ const Qe = ce((m, L) => {
3861
3876
  m.computeBoundingBox();
3862
3877
  const R = m.boundingBox, W = new M();
3863
3878
  R.getCenter(W), m.translate(-W.x, -W.y, -W.z), m.computeBoundingBox();
@@ -3867,44 +3882,44 @@ let __tla = (async () => {
3867
3882
  color: 8947848,
3868
3883
  side: Z.DoubleSide
3869
3884
  }));
3870
- p(ne), re(L), he(true), Q(false), dt.current = false;
3871
- }, []), $e = ce(async (m, L) => {
3885
+ p(ne), re(L), he(true), Q(false), ct.current = false;
3886
+ }, []), Te = ce(async (m, L) => {
3872
3887
  Le(null);
3873
3888
  const R = L.toLowerCase(), W = R.endsWith(".stl");
3874
3889
  if (!R.endsWith(".obj") && !W) {
3875
3890
  Le("Unsupported file format. Please use OBJ or STL.");
3876
3891
  return;
3877
3892
  }
3878
- tn(W ? "stl" : "obj"), x(true), A("Processing file..."), ze(`FILE_LOAD: ${L} (${W ? "STL" : "OBJ"})`);
3893
+ en(W ? "stl" : "obj"), x(true), A("Processing file..."), ze(`FILE_LOAD: ${L} (${W ? "STL" : "OBJ"})`);
3879
3894
  try {
3880
3895
  let H;
3881
3896
  if (W) if (A("Converting STL..."), m instanceof ArrayBuffer) {
3882
3897
  const Se = new Blob([
3883
3898
  m
3884
- ]), Oe = new File([
3899
+ ]), $e = new File([
3885
3900
  Se
3886
3901
  ], L);
3887
- H = await Yt(Oe);
3902
+ H = await Gt($e);
3888
3903
  } else {
3889
3904
  const Se = new Blob([
3890
3905
  m
3891
- ]), Oe = new File([
3906
+ ]), $e = new File([
3892
3907
  Se
3893
3908
  ], L);
3894
- H = await Yt(Oe);
3909
+ H = await Gt($e);
3895
3910
  }
3896
3911
  else H = typeof m == "string" ? m : new TextDecoder().decode(m);
3897
- const ne = performance.now(), ae = je.current ? await Ho(H, je.current, (Se) => {
3912
+ const ne = performance.now(), ae = Ne.current ? await Ho(H, Ne.current, (Se) => {
3898
3913
  A(Se), ze(`PREPROCESS: ${Se}`);
3899
3914
  }) : null;
3900
- if (ae) ze(`PREPROCESS: done in ${(performance.now() - ne).toFixed(0)}ms \u2014 unit=${ae.detectedUnit}, scaled=${ae.wasScaled}`), e.showAmputationModal && !r ? (V(ae), _(true)) : et(ae.geometry, ae.wasScaled);
3915
+ if (ae) ze(`PREPROCESS: done in ${(performance.now() - ne).toFixed(0)}ms \u2014 unit=${ae.detectedUnit}, scaled=${ae.wasScaled}`), e.showAmputationModal && !r ? (V(ae), _(true)) : Qe(ae.geometry, ae.wasScaled);
3901
3916
  else {
3902
3917
  A("Using fallback loader...");
3903
3918
  const Se = Vo(H);
3904
3919
  Se ? e.showAmputationModal && !r ? (V({
3905
3920
  geometry: Se,
3906
3921
  wasScaled: false
3907
- }), _(true)) : et(Se, false) : Le("Failed to parse the mesh.");
3922
+ }), _(true)) : Qe(Se, false) : Le("Failed to parse the mesh.");
3908
3923
  }
3909
3924
  } catch (H) {
3910
3925
  Le(H instanceof Error ? H.message : "Failed to process the mesh file.");
@@ -3912,13 +3927,13 @@ let __tla = (async () => {
3912
3927
  x(false), A("");
3913
3928
  }
3914
3929
  }, [
3915
- Ee,
3930
+ Be,
3916
3931
  e.showAmputationModal,
3917
3932
  r,
3918
- et
3933
+ Qe
3919
3934
  ]);
3920
- X(() => {
3921
- if (!t || !Ee) return;
3935
+ G(() => {
3936
+ if (!t || !Be) return;
3922
3937
  (async () => {
3923
3938
  x(true), A("Loading scan...");
3924
3939
  try {
@@ -3927,10 +3942,10 @@ let __tla = (async () => {
3927
3942
  const W = new URL(t).pathname.split("/").pop() || "scan.obj";
3928
3943
  if (W.toLowerCase().endsWith(".stl")) {
3929
3944
  const H = await L.arrayBuffer();
3930
- await $e(H, W);
3945
+ await Te(H, W);
3931
3946
  } else {
3932
3947
  const H = await L.text();
3933
- await $e(H, W);
3948
+ await Te(H, W);
3934
3949
  }
3935
3950
  } catch (L) {
3936
3951
  Le(L instanceof Error ? L.message : "Failed to load scan from URL."), x(false), A("");
@@ -3938,14 +3953,14 @@ let __tla = (async () => {
3938
3953
  })();
3939
3954
  }, [
3940
3955
  t,
3941
- Ee
3956
+ Be
3942
3957
  ]);
3943
3958
  const po = ce((m) => {
3944
3959
  m.preventDefault(), v(true);
3945
3960
  }, []), ho = ce((m) => {
3946
3961
  m.preventDefault(), v(false);
3947
3962
  }, []), go = ce(async (m) => {
3948
- if (m.preventDefault(), v(false), !Ee) {
3963
+ if (m.preventDefault(), v(false), !Be) {
3949
3964
  Le("WASM module is still loading. Please wait.");
3950
3965
  return;
3951
3966
  }
@@ -3957,36 +3972,36 @@ let __tla = (async () => {
3957
3972
  return;
3958
3973
  }
3959
3974
  if (R.endsWith(".stl")) {
3960
- tn("stl"), x(true), A("Converting STL...");
3975
+ en("stl"), x(true), A("Converting STL...");
3961
3976
  try {
3962
- const W = await Yt(L);
3963
- await $e(W, L.name.replace(/\.stl$/i, ".obj"));
3977
+ const W = await Gt(L);
3978
+ await Te(W, L.name.replace(/\.stl$/i, ".obj"));
3964
3979
  } catch (W) {
3965
3980
  Le(W instanceof Error ? W.message : "Failed to process STL file."), x(false), A("");
3966
3981
  }
3967
3982
  } else {
3968
3983
  const W = await L.text();
3969
- await $e(W, L.name);
3984
+ await Te(W, L.name);
3970
3985
  }
3971
3986
  }, [
3972
- Ee,
3973
- $e
3987
+ Be,
3988
+ Te
3974
3989
  ]), mo = ce((m) => {
3975
- I(m), C(m === "AK" ? 2 : 1), _(false), B && (et(B.geometry, B.wasScaled), V(null)), c == null ? void 0 : c("file_loaded", {
3990
+ I(m), C(m === "AK" ? 2 : 1), _(false), B && (Qe(B.geometry, B.wasScaled), V(null)), c == null ? void 0 : c("file_loaded", {
3976
3991
  spacing_type: m,
3977
- file_format: He,
3992
+ file_format: Oe,
3978
3993
  is_double_wall: false
3979
3994
  });
3980
3995
  }, [
3981
3996
  B,
3982
- et,
3997
+ Qe,
3983
3998
  c,
3984
- He
3999
+ Oe
3985
4000
  ]);
3986
- X(() => {
3987
- if (!d || G.length !== 1 || !je.current || dt.current) return;
3988
- dt.current = true;
3989
- const m = G[0], L = je.current, R = d.geometry, { positions: W, indices: pe } = St(R), H = new Float32Array([
4001
+ G(() => {
4002
+ if (!d || X.length !== 1 || !Ne.current || ct.current) return;
4003
+ ct.current = true;
4004
+ const m = X[0], L = Ne.current, R = d.geometry, { positions: W, indices: pe } = vt(R), H = new Float32Array([
3990
4005
  m.position.x,
3991
4006
  m.position.y,
3992
4007
  m.position.z
@@ -3994,20 +4009,20 @@ let __tla = (async () => {
3994
4009
  ze(`SHELL_DETECT: ${Se ? "DOUBLE" : "SINGLE"} \u2014 ${ae}`), Se && (D(true), we(true), ze(`SHELL_DETECT: double shell, thickness=${ne.thickness().toFixed(1)}mm`));
3995
4010
  }, [
3996
4011
  d,
3997
- G,
4012
+ X,
3998
4013
  ze
3999
4014
  ]);
4000
- const Tt = ce(() => {
4001
- if (!d || G.length < 2) return;
4015
+ const Et = ce(() => {
4016
+ if (!d || X.length < 2) return;
4002
4017
  ee(true), oe("Please wait..."), ze("PIPELINE: starting processing pipeline...");
4003
4018
  const m = performance.now();
4004
4019
  setTimeout(() => {
4005
4020
  const L = [
4006
- G[1],
4007
- G[0],
4008
- ...G.slice(2)
4021
+ X[1],
4022
+ X[0],
4023
+ ...X.slice(2)
4009
4024
  ];
4010
- Yo(d, L, vt, {
4025
+ Yo(d, L, wt, {
4011
4026
  onStatus: (R) => {
4012
4027
  oe(R), ze(`PIPELINE: ${R}`);
4013
4028
  },
@@ -4024,9 +4039,9 @@ let __tla = (async () => {
4024
4039
  setAligned: dn,
4025
4040
  setCut: fn,
4026
4041
  setModelSize: f,
4027
- setOriginalEndY: Ut,
4042
+ setOriginalEndY: qt,
4028
4043
  setAdjustedStartY: Me,
4029
- setAdjustedEndY: Ft,
4044
+ setAdjustedEndY: Mt,
4030
4045
  setError: Le,
4031
4046
  setDoubleShell: (R) => {
4032
4047
  D(R), we(true);
@@ -4037,74 +4052,74 @@ let __tla = (async () => {
4037
4052
  setInnerShellExtracted: Q,
4038
4053
  setMeasurementGeometry: ge,
4039
4054
  setWasmSlices: Ie,
4040
- wasmModule: je.current ?? void 0
4041
- }), ze(`PIPELINE: completed in ${(performance.now() - m).toFixed(0)}ms`), pt.current = false, ee(false);
4055
+ wasmModule: Ne.current ?? void 0
4056
+ }), ze(`PIPELINE: completed in ${(performance.now() - m).toFixed(0)}ms`), ut.current = false, ee(false);
4042
4057
  }, 50);
4043
4058
  }, [
4044
4059
  d,
4045
- G,
4060
+ X,
4046
4061
  cn,
4047
4062
  dn,
4048
4063
  ln,
4049
4064
  an,
4050
4065
  fn,
4051
4066
  O
4052
- ]), $t = de(false);
4053
- X(() => {
4054
- o && ($t.current || !d || le || j || G.length < 2 || ($t.current = true, Tt()));
4067
+ ]), Tt = de(false);
4068
+ G(() => {
4069
+ o && (Tt.current || !d || le || j || X.length < 2 || (Tt.current = true, Et()));
4055
4070
  }, [
4056
4071
  o,
4057
4072
  d,
4058
- G.length,
4073
+ X.length,
4059
4074
  le,
4060
4075
  j,
4061
- Tt
4062
- ]), X(() => {
4063
- G.length < 2 && ($t.current = false);
4076
+ Et
4077
+ ]), G(() => {
4078
+ X.length < 2 && (Tt.current = false);
4064
4079
  }, [
4065
- G.length
4080
+ X.length
4066
4081
  ]);
4067
- const Ot = de(false), xo = ce(async () => {
4068
- if (ft(), ke([]), Ie(null), ge(null), Me(null), Ft(null), Qt(null), Ut(null), Je(false), nn(false), Lt(true), D(false), Q(false), dt.current = false, Ot.current = false, pt.current = false, k("3D"), t && Ee) {
4082
+ const $t = de(false), xo = ce(async () => {
4083
+ if (dt(), Pe([]), Ie(null), ge(null), Me(null), Mt(null), Jt(null), qt(null), Ue(false), tn(false), kt(true), D(false), Q(false), ct.current = false, $t.current = false, ut.current = false, P("3D"), t && Be) {
4069
4084
  p(null);
4070
4085
  try {
4071
4086
  const m = await fetch(t);
4072
4087
  if (!m.ok) throw new Error(`Failed to download scan: ${m.status}`);
4073
4088
  const R = new URL(t).pathname.split("/").pop() || "scan.obj";
4074
- R.toLowerCase().endsWith(".stl") ? await $e(await m.arrayBuffer(), R) : await $e(await m.text(), R);
4089
+ R.toLowerCase().endsWith(".stl") ? await Te(await m.arrayBuffer(), R) : await Te(await m.text(), R);
4075
4090
  } catch (m) {
4076
4091
  Le(m instanceof Error ? m.message : "Failed to reload scan.");
4077
4092
  }
4078
4093
  }
4079
4094
  }, [
4080
4095
  t,
4081
- Ee,
4082
- $e,
4083
- ft
4096
+ Be,
4097
+ Te,
4098
+ dt
4084
4099
  ]);
4085
- X(() => {
4086
- le && $.length > 0 && !Ot.current && (Ot.current = true, Je(true));
4100
+ G(() => {
4101
+ le && $.length > 0 && !$t.current && ($t.current = true, Ue(true));
4087
4102
  }, [
4088
4103
  le,
4089
4104
  $.length
4090
4105
  ]);
4091
- const { scanTransverseML: Ht, scanTransverseAP: Vt } = J(() => {
4092
- if (!d || !le || G.length < 1) return {
4106
+ const { scanTransverseML: Ot, scanTransverseAP: Ht } = J(() => {
4107
+ if (!d || !le || X.length < 1) return {
4093
4108
  scanTransverseML: 0,
4094
4109
  scanTransverseAP: 0
4095
4110
  };
4096
4111
  try {
4097
- const m = (Te ?? d).geometry, L = G[0].position.y, R = Zt(m), W = Ge(R, m, L);
4112
+ const m = (Ee ?? d).geometry, L = X[0].position.y, R = Kt(m), W = je(R, m, L);
4098
4113
  if (W.linePoints.length < 2) return {
4099
4114
  scanTransverseML: 0,
4100
4115
  scanTransverseAP: 0
4101
4116
  };
4102
4117
  let pe = W.linePoints[0], H = W.linePoints[0], ne = W.linePoints[0], ae = W.linePoints[0];
4103
4118
  for (const Fe of W.linePoints) Fe.x < pe.x && (pe = Fe), Fe.x > H.x && (H = Fe), Fe.z < ne.z && (ne = Fe), Fe.z > ae.z && (ae = Fe);
4104
- const Se = new M(pe.x, L, pe.z).distanceTo(new M(H.x, L, H.z)), Oe = new M(ne.x, L, ne.z).distanceTo(new M(ae.x, L, ae.z));
4119
+ const Se = new M(pe.x, L, pe.z).distanceTo(new M(H.x, L, H.z)), $e = new M(ne.x, L, ne.z).distanceTo(new M(ae.x, L, ae.z));
4105
4120
  return {
4106
4121
  scanTransverseML: Se,
4107
- scanTransverseAP: Oe
4122
+ scanTransverseAP: $e
4108
4123
  };
4109
4124
  } catch {
4110
4125
  return {
@@ -4114,27 +4129,30 @@ let __tla = (async () => {
4114
4129
  }
4115
4130
  }, [
4116
4131
  d,
4117
- Te,
4132
+ Ee,
4118
4133
  le,
4119
- G
4120
- ]), tt = J(() => {
4134
+ X
4135
+ ]), et = J(() => {
4121
4136
  var _a;
4122
- if (!d || G.length < 3) return 0;
4123
- if (te) return Math.abs(G[0].position.y - G[2].position.y);
4137
+ if (!d || X.length < 1) return 0;
4124
4138
  const m = d.geometry;
4125
4139
  m.computeBoundingBox();
4126
- const L = ((_a = m.boundingBox) == null ? void 0 : _a.min.y) ?? 0;
4127
- return Math.abs(G[0].position.y - L);
4140
+ const L = ((_a = m.boundingBox) == null ? void 0 : _a.min.y) ?? 0, R = X[0].position.y;
4141
+ if (te && X.length >= 3) {
4142
+ const W = Math.abs(R - X[2].position.y);
4143
+ if (W > 0.5) return W;
4144
+ }
4145
+ return Math.abs(R - L);
4128
4146
  }, [
4129
4147
  d,
4130
- G,
4148
+ X,
4131
4149
  te
4132
4150
  ]), bo = ce((m) => {
4133
- Qn(m), Pt(m.circumferences), Lt(true), nn(true), Je(false);
4151
+ Qn(m), Pt(m.circumferences), kt(true), tn(true), Ue(false);
4134
4152
  }, []), xe = (m) => m == null ? m : +(m / 10).toFixed(2), un = ce(async (m) => {
4135
- if (!s || Ke.current) return;
4136
- Ke.current = true, Je(false), at(false), lt(true), await new Promise((R) => requestAnimationFrame(() => requestAnimationFrame(() => R())));
4137
- const L = d ? await Qe({
4153
+ if (!s || Ye.current) return;
4154
+ Ye.current = true, Ue(false), nn(false), lt(true), await new Promise((R) => requestAnimationFrame(() => requestAnimationFrame(() => R())));
4155
+ const L = d ? await Je({
4138
4156
  restoreView: false
4139
4157
  }).catch(() => {
4140
4158
  }) : void 0;
@@ -4142,7 +4160,7 @@ let __tla = (async () => {
4142
4160
  s({
4143
4161
  spacingType: F ?? "BK",
4144
4162
  sourceUnit: "cm",
4145
- fileFormat: He,
4163
+ fileFormat: Oe,
4146
4164
  measurementSource: "form_provided",
4147
4165
  isDoubleWall: te,
4148
4166
  isUnitConverted: false,
@@ -4152,7 +4170,7 @@ let __tla = (async () => {
4152
4170
  originalValue: xe(R.originalValue),
4153
4171
  modifiedValue: R.modifiedValue == null ? null : xe(R.modifiedValue)
4154
4172
  })),
4155
- frontalHeight: xe(tt),
4173
+ frontalHeight: xe(et),
4156
4174
  transverseML: 0,
4157
4175
  transverseAP: 0,
4158
4176
  scanUrl: t,
@@ -4162,41 +4180,41 @@ let __tla = (async () => {
4162
4180
  alignedGeometry: d == null ? void 0 : d.geometry
4163
4181
  });
4164
4182
  } finally {
4165
- Ke.current = false, lt(false);
4183
+ Ye.current = false, lt(false);
4166
4184
  }
4167
4185
  }, [
4168
4186
  s,
4169
4187
  d,
4170
4188
  F,
4171
- He,
4189
+ Oe,
4172
4190
  te,
4173
4191
  Ae,
4174
4192
  $,
4175
- tt,
4193
+ et,
4176
4194
  t,
4177
- Qe
4195
+ Je
4178
4196
  ]), pn = de(null);
4179
- X(() => {
4197
+ G(() => {
4180
4198
  if (!d || !le) {
4181
4199
  pn.current = null;
4182
4200
  return;
4183
4201
  }
4184
- const m = (Te ?? d).geometry;
4185
- pn.current = Zt(m);
4202
+ const m = (Ee ?? d).geometry;
4203
+ pn.current = Kt(m);
4186
4204
  }, [
4187
4205
  d,
4188
4206
  le,
4189
- Te
4207
+ Ee
4190
4208
  ]);
4191
- const Nt = ce(async (m) => {
4192
- if (!s || !d || $.length === 0 || !F || Ke.current) return;
4193
- Ke.current = true, lt(true), await new Promise((R) => requestAnimationFrame(() => requestAnimationFrame(() => R())));
4194
- const L = await Qe({
4209
+ const Vt = ce(async (m) => {
4210
+ if (!s || !d || $.length === 0 || !F || Ye.current) return;
4211
+ Ye.current = true, lt(true), await new Promise((R) => requestAnimationFrame(() => requestAnimationFrame(() => R())));
4212
+ const L = await Je({
4195
4213
  restoreView: false
4196
4214
  }).catch(() => {
4197
4215
  });
4198
4216
  try {
4199
- const R = Ht, W = Vt, pe = ve ? {
4217
+ const R = Ot, W = Ht, pe = ve ? {
4200
4218
  circumferences: ve.circumferences.map((H) => xe(H)),
4201
4219
  frontalHeight: xe(ve.frontalHeight),
4202
4220
  perineumML: xe(ve.perineumML),
@@ -4207,7 +4225,7 @@ let __tla = (async () => {
4207
4225
  s({
4208
4226
  spacingType: F,
4209
4227
  sourceUnit: "cm",
4210
- fileFormat: He,
4228
+ fileFormat: Oe,
4211
4229
  measurementSource: m === "use_form_measurements" ? "form_provided" : "scan_derived",
4212
4230
  isDoubleWall: te,
4213
4231
  isUnitConverted: false,
@@ -4217,7 +4235,7 @@ let __tla = (async () => {
4217
4235
  originalValue: xe(H.originalValue),
4218
4236
  modifiedValue: H.modifiedValue == null ? null : xe(H.modifiedValue)
4219
4237
  })),
4220
- frontalHeight: xe((ve == null ? void 0 : ve.frontalHeight) ?? tt),
4238
+ frontalHeight: xe((ve == null ? void 0 : ve.frontalHeight) ?? et),
4221
4239
  transverseML: xe(R),
4222
4240
  transverseAP: xe(W),
4223
4241
  perineumML: xe(ve == null ? void 0 : ve.perineumML),
@@ -4228,27 +4246,27 @@ let __tla = (async () => {
4228
4246
  decision: m,
4229
4247
  userEnteredMeasurements: pe,
4230
4248
  screenshots: L,
4231
- alignedGeometry: (Te ?? d).geometry
4249
+ alignedGeometry: (Ee ?? d).geometry
4232
4250
  });
4233
4251
  } finally {
4234
- Ke.current = false, lt(false);
4252
+ Ye.current = false, lt(false);
4235
4253
  }
4236
4254
  }, [
4237
4255
  s,
4238
4256
  d,
4239
- Te,
4257
+ Ee,
4240
4258
  $,
4241
4259
  F,
4242
- G,
4243
- He,
4260
+ X,
4261
+ Oe,
4244
4262
  te,
4245
4263
  Ae,
4246
4264
  t,
4247
4265
  ve,
4248
- tt,
4266
+ et,
4267
+ Ot,
4249
4268
  Ht,
4250
- Vt,
4251
- Qe
4269
+ Je
4252
4270
  ]), yo = J(() => {
4253
4271
  if (!Ae || $.length === 0) return false;
4254
4272
  const m = Math.min(Ae.length, $.length);
@@ -4263,11 +4281,11 @@ let __tla = (async () => {
4263
4281
  }, [
4264
4282
  Ae,
4265
4283
  $
4266
- ]), hn = Ne === 0 ? 320 : Ne < 520 ? Math.max(200, Math.round(Ne * 0.42)) : Ne < 900 ? 280 : Ne < 1400 ? 340 : 400, gn = Ne < 520 ? 16 : Ne < 900 ? 20 : 24;
4267
- return w(Bo.Provider, {
4284
+ ]), hn = Ve === 0 ? 320 : Ve < 520 ? Math.max(200, Math.round(Ve * 0.42)) : Ve < 900 ? 280 : Ve < 1400 ? 340 : 400, gn = Ve < 520 ? 16 : Ve < 900 ? 20 : 24;
4285
+ return y(Bo.Provider, {
4268
4286
  value: e,
4269
4287
  children: [
4270
- w("div", {
4288
+ y("div", {
4271
4289
  style: {
4272
4290
  flex: 1,
4273
4291
  display: "flex",
@@ -4296,7 +4314,7 @@ let __tla = (async () => {
4296
4314
  }
4297
4315
  })
4298
4316
  }),
4299
- w("div", {
4317
+ y("div", {
4300
4318
  style: {
4301
4319
  flex: 1,
4302
4320
  display: "flex",
@@ -4304,8 +4322,8 @@ let __tla = (async () => {
4304
4322
  minHeight: 0
4305
4323
  },
4306
4324
  children: [
4307
- w("div", {
4308
- ref: Rt,
4325
+ y("div", {
4326
+ ref: _t,
4309
4327
  style: {
4310
4328
  flex: 1,
4311
4329
  display: "flex",
@@ -4314,8 +4332,8 @@ let __tla = (async () => {
4314
4332
  },
4315
4333
  children: [
4316
4334
  d && !le && (() => {
4317
- const m = G.length === 0 ? 1 : G.length === 1 ? 2 : 3, L = F === "AK" ? "Perineum" : "MPT", R = m === 1 ? `Place Point at ${L}` : m === 2 ? "Place Point at Distal Most Point" : "Ready to Continue", W = m === 1 ? `Click on the model to mark the ${L}.` : m === 2 ? "Click on the model to mark the Distal Most Point." : "Both points are placed. Click Continue to process the scan.", pe = m === 1 ? "#2fbf4a" : m === 2 ? "#e53935" : "#2fbf4a", H = G.length >= 2;
4318
- return w("div", {
4335
+ const m = X.length === 0 ? 1 : X.length === 1 ? 2 : 3, L = F === "AK" ? "Perineum" : "MPT", R = m === 1 ? `Place Point at ${L}` : m === 2 ? "Place Point at Distal Most Point" : "Ready to Continue", W = m === 1 ? `Click on the model to mark the ${L}.` : m === 2 ? "Click on the model to mark the Distal Most Point." : "Both points are placed. Click Continue to process the scan.", pe = m === 1 ? "#2fbf4a" : m === 2 ? "#e53935" : "#2fbf4a", H = X.length >= 2;
4336
+ return y("div", {
4319
4337
  style: {
4320
4338
  width: hn,
4321
4339
  flexShrink: 0,
@@ -4331,7 +4349,7 @@ let __tla = (async () => {
4331
4349
  i("style", {
4332
4350
  children: "@keyframes gm-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(12, 67, 173, 0.45) } 50% { box-shadow: 0 0 0 6px rgba(12, 67, 173, 0) } }"
4333
4351
  }),
4334
- w("div", {
4352
+ y("div", {
4335
4353
  style: {
4336
4354
  position: "relative",
4337
4355
  display: "flex",
@@ -4379,7 +4397,7 @@ let __tla = (async () => {
4379
4397
  },
4380
4398
  children: "i"
4381
4399
  }),
4382
- _t && w("div", {
4400
+ Dt && y("div", {
4383
4401
  role: "tooltip",
4384
4402
  style: {
4385
4403
  position: "absolute",
@@ -4419,7 +4437,7 @@ let __tla = (async () => {
4419
4437
  })
4420
4438
  ]
4421
4439
  }),
4422
- w("div", {
4440
+ y("div", {
4423
4441
  style: {
4424
4442
  display: "flex",
4425
4443
  alignItems: "center",
@@ -4442,7 +4460,7 @@ let __tla = (async () => {
4442
4460
  transition: "background-color 200ms"
4443
4461
  }
4444
4462
  }, ne)),
4445
- w("div", {
4463
+ y("div", {
4446
4464
  style: {
4447
4465
  fontSize: 11,
4448
4466
  fontWeight: 500,
@@ -4457,7 +4475,7 @@ let __tla = (async () => {
4457
4475
  })
4458
4476
  ]
4459
4477
  }),
4460
- w("div", {
4478
+ y("div", {
4461
4479
  style: {
4462
4480
  display: "flex",
4463
4481
  alignItems: "center",
@@ -4496,7 +4514,7 @@ let __tla = (async () => {
4496
4514
  }),
4497
4515
  i("button", {
4498
4516
  disabled: !H,
4499
- onClick: Tt,
4517
+ onClick: Et,
4500
4518
  style: {
4501
4519
  marginTop: 4,
4502
4520
  padding: "11px 14px",
@@ -4513,25 +4531,6 @@ let __tla = (async () => {
4513
4531
  animation: H ? "gm-pulse 1.8s ease-in-out infinite" : "none"
4514
4532
  },
4515
4533
  children: "Continue"
4516
- }),
4517
- s && i("button", {
4518
- disabled: Be,
4519
- onClick: () => at(true),
4520
- style: {
4521
- alignSelf: "center",
4522
- backgroundColor: "#fff",
4523
- border: "1px solid #d0d7de",
4524
- color: Be ? "#999" : "#2d333a",
4525
- fontSize: 14,
4526
- fontWeight: 600,
4527
- cursor: Be ? "not-allowed" : "pointer",
4528
- fontFamily: "system-ui, sans-serif",
4529
- padding: "10px 16px",
4530
- borderRadius: 8,
4531
- boxShadow: "0 1px 3px rgba(0,0,0,0.06)",
4532
- letterSpacing: "0.3px"
4533
- },
4534
- children: "Have Galileo Check My Measurements"
4535
4534
  })
4536
4535
  ]
4537
4536
  }),
@@ -4553,7 +4552,7 @@ let __tla = (async () => {
4553
4552
  ]
4554
4553
  });
4555
4554
  })(),
4556
- le && Ye && F && i("div", {
4555
+ le && Ge && F && i("div", {
4557
4556
  style: {
4558
4557
  width: hn,
4559
4558
  flexShrink: 0,
@@ -4581,9 +4580,9 @@ let __tla = (async () => {
4581
4580
  amputationType: F,
4582
4581
  spacingInches: S,
4583
4582
  scanMeasurements: $,
4584
- scanFrontalHeight: tt,
4585
- scanTransverseML: Ht,
4586
- scanTransverseAP: Vt,
4583
+ scanFrontalHeight: et,
4584
+ scanTransverseML: Ot,
4585
+ scanTransverseAP: Ht,
4587
4586
  onSave: bo,
4588
4587
  onSkip: un,
4589
4588
  onFormChange: to,
@@ -4595,8 +4594,8 @@ let __tla = (async () => {
4595
4594
  })
4596
4595
  })
4597
4596
  }),
4598
- w("div", {
4599
- ref: Bt,
4597
+ y("div", {
4598
+ ref: It,
4600
4599
  style: {
4601
4600
  flex: 1,
4602
4601
  position: "relative",
@@ -4618,7 +4617,7 @@ let __tla = (async () => {
4618
4617
  justifyContent: "center",
4619
4618
  pointerEvents: "none"
4620
4619
  },
4621
- children: Ee ? i("div", {
4620
+ children: Be ? i("div", {
4622
4621
  style: {
4623
4622
  fontSize: 18,
4624
4623
  color: "#aaa",
@@ -4626,7 +4625,7 @@ let __tla = (async () => {
4626
4625
  fontFamily: "system-ui, sans-serif"
4627
4626
  },
4628
4627
  children: "Drag & Drop Files Here"
4629
- }) : w("div", {
4628
+ }) : y("div", {
4630
4629
  style: {
4631
4630
  textAlign: "center"
4632
4631
  },
@@ -4656,7 +4655,7 @@ let __tla = (async () => {
4656
4655
  ]
4657
4656
  })
4658
4657
  }),
4659
- !e.showDragDrop && !d && !g && !kt && i("div", {
4658
+ !e.showDragDrop && !d && !g && !Ft && i("div", {
4660
4659
  style: {
4661
4660
  position: "absolute",
4662
4661
  inset: 0,
@@ -4664,7 +4663,7 @@ let __tla = (async () => {
4664
4663
  alignItems: "center",
4665
4664
  justifyContent: "center"
4666
4665
  },
4667
- children: w("div", {
4666
+ children: y("div", {
4668
4667
  style: {
4669
4668
  textAlign: "center"
4670
4669
  },
@@ -4695,13 +4694,13 @@ let __tla = (async () => {
4695
4694
  })
4696
4695
  }),
4697
4696
  g && i(Fn, {
4698
- message: y || "Processing mesh..."
4697
+ message: w || "Processing mesh..."
4699
4698
  }),
4700
4699
  j && i(Fn, {
4701
4700
  message: ie
4702
4701
  }),
4703
- kt && i(Zo, {
4704
- message: kt,
4702
+ Ft && i(Zo, {
4703
+ message: Ft,
4705
4704
  onDismiss: () => Le(null)
4706
4705
  }),
4707
4706
  e.showAmputationModal && z && i("div", {
@@ -4716,7 +4715,7 @@ let __tla = (async () => {
4716
4715
  justifyContent: "center",
4717
4716
  zIndex: 20
4718
4717
  },
4719
- children: w("div", {
4718
+ children: y("div", {
4720
4719
  style: {
4721
4720
  backgroundColor: "#fff",
4722
4721
  borderRadius: 4,
@@ -4725,7 +4724,7 @@ let __tla = (async () => {
4725
4724
  fontFamily: "system-ui, sans-serif"
4726
4725
  },
4727
4726
  children: [
4728
- w("div", {
4727
+ y("div", {
4729
4728
  style: {
4730
4729
  padding: "24px 24px 20px"
4731
4730
  },
@@ -4755,7 +4754,7 @@ let __tla = (async () => {
4755
4754
  children: [
4756
4755
  "AK",
4757
4756
  "BK"
4758
- ].map((m) => w("label", {
4757
+ ].map((m) => y("label", {
4759
4758
  onClick: () => I(m),
4760
4759
  style: {
4761
4760
  flex: 1,
@@ -4791,7 +4790,7 @@ let __tla = (async () => {
4791
4790
  },
4792
4791
  children: m
4793
4792
  }),
4794
- w("span", {
4793
+ y("span", {
4795
4794
  style: {
4796
4795
  fontSize: 13,
4797
4796
  color: "rgba(0,0,0,0.54)"
@@ -4806,7 +4805,7 @@ let __tla = (async () => {
4806
4805
  })
4807
4806
  ]
4808
4807
  }),
4809
- w("div", {
4808
+ y("div", {
4810
4809
  style: {
4811
4810
  display: "flex",
4812
4811
  justifyContent: "flex-end",
@@ -4868,7 +4867,7 @@ let __tla = (async () => {
4868
4867
  }
4869
4868
  }),
4870
4869
  i(Ko, {
4871
- children: w(Lo, {
4870
+ children: y(Lo, {
4872
4871
  camera: {
4873
4872
  position: [
4874
4873
  0,
@@ -4934,15 +4933,15 @@ let __tla = (async () => {
4934
4933
  i(ar, {
4935
4934
  modelSize: u,
4936
4935
  isAligned: le,
4937
- isCut: Et,
4936
+ isCut: Bt,
4938
4937
  mesh: d,
4939
4938
  viewMode: b,
4940
- sliceY: le && G.length >= 2 ? Mt ?? it ?? G[0].position.y : void 0,
4941
- landmarkCount: G.length,
4939
+ sliceY: le && X.length >= 2 ? zt ?? rt ?? X[0].position.y : void 0,
4940
+ landmarkCount: X.length,
4942
4941
  measurementGeometry: se,
4943
- fitYMin: le && G.length >= 2 ? Mt ?? it ?? void 0 : void 0,
4944
- fitYMax: le && G.length >= 2 ? st ?? G[0].position.y : void 0,
4945
- resetCameraToFrontRef: It
4942
+ fitYMin: le && X.length >= 2 ? zt ?? rt ?? void 0 : void 0,
4943
+ fitYMax: le && X.length >= 2 ? it ?? X[0].position.y : void 0,
4944
+ resetCameraToFrontRef: Wt
4946
4945
  }),
4947
4946
  !le && i(In, {
4948
4947
  enableDamping: false
@@ -4951,64 +4950,64 @@ let __tla = (async () => {
4951
4950
  mesh: d,
4952
4951
  isDragging: Kn
4953
4952
  }),
4954
- d && le && G.length >= 3 && (() => {
4953
+ d && le && X.length >= 3 && (() => {
4955
4954
  const L = d.geometry.getIndex();
4956
4955
  if (!L || L.count < 30) return null;
4957
- const R = G[2], W = G[0], pe = me ?? R.position.y, H = Mt ?? it ?? W.position.y;
4956
+ const R = X[2], W = X[0], pe = me ?? R.position.y, H = zt ?? rt ?? W.position.y;
4958
4957
  if (b === "2D") {
4959
- const ne = Ye ? ro : Ve ? F === "AK" ? ve == null ? void 0 : ve.perineumML : ve == null ? void 0 : ve.mptML : void 0, ae = Ye ? so : Ve ? F === "AK" ? ve == null ? void 0 : ve.perineumAP : ve == null ? void 0 : ve.mptAP : void 0;
4958
+ const ne = Ge ? ro : He ? F === "AK" ? ve == null ? void 0 : ve.perineumML : ve == null ? void 0 : ve.mptML : void 0, ae = Ge ? so : He ? F === "AK" ? ve == null ? void 0 : ve.perineumAP : ve == null ? void 0 : ve.mptAP : void 0;
4960
4959
  return i(ur, {
4961
- mesh: Te ?? d,
4960
+ mesh: Ee ?? d,
4962
4961
  upperY: H,
4963
4962
  originY: W.position.y,
4964
4963
  modelSize: u,
4965
4964
  meshColor: rn,
4966
- displayUnit: P,
4965
+ displayUnit: k,
4967
4966
  formML: ne,
4968
4967
  formAP: ae
4969
4968
  });
4970
4969
  }
4971
- return w(Re, {
4970
+ return y(Re, {
4972
4971
  children: [
4973
4972
  i(ir, {
4974
- mesh: Te ?? d,
4973
+ mesh: Ee ?? d,
4975
4974
  startY: pe,
4976
4975
  endY: H,
4977
- spacing: ut,
4976
+ spacing: ft,
4978
4977
  modelSize: u,
4979
- onMeasurementsChange: ke,
4978
+ onMeasurementsChange: Pe,
4980
4979
  reverseOrder: true,
4981
- displayUnit: P,
4980
+ displayUnit: k,
4982
4981
  useInnerSurface: te && !O,
4983
- formMeasurements: Ye ? eo ?? Ae : Ve ? Ae : void 0,
4984
- originY: st ?? W.position.y,
4982
+ formMeasurements: Ge ? eo ?? Ae : He ? Ae : void 0,
4983
+ originY: it ?? W.position.y,
4985
4984
  wasmSlices: De
4986
4985
  }),
4987
4986
  i(lr, {
4988
4987
  mesh: d,
4989
- greenY: st ?? W.position.y,
4988
+ greenY: it ?? W.position.y,
4990
4989
  modelSize: u,
4991
- displayUnit: P,
4990
+ displayUnit: k,
4992
4991
  bottomY: te ? R.position.y : void 0,
4993
- formHeight: Ye ? no : Ve ? ve == null ? void 0 : ve.frontalHeight : void 0
4992
+ formHeight: Ge ? no : He ? ve == null ? void 0 : ve.frontalHeight : void 0
4994
4993
  }),
4995
4994
  i(pr, {
4996
4995
  mesh: d,
4997
- yPosition: st ?? W.position.y,
4996
+ yPosition: it ?? W.position.y,
4998
4997
  onYChange: (ne) => {
4999
- Qt(ne), Ie(null);
4998
+ Jt(ne), Ie(null);
5000
4999
  const ae = ne - W.position.y;
5001
- Ft((it ?? W.position.y + ut * 2) + ae);
5000
+ Mt((rt ?? W.position.y + ft * 2) + ae);
5002
5001
  },
5003
- minY: W.position.y - ut,
5004
- maxY: W.position.y + ut,
5002
+ minY: W.position.y - ft,
5003
+ maxY: W.position.y + ft,
5005
5004
  modelSize: u,
5006
5005
  color: "#44ff44",
5007
5006
  hoverColor: "#88ff88",
5008
5007
  dragColor: "#ffffff",
5009
5008
  label: F === "AK" ? "Perineum" : "MPT",
5010
- onDragStart: () => Jt(true),
5011
- onDragEnd: () => Jt(false)
5009
+ onDragStart: () => Ut(true),
5010
+ onDragEnd: () => Ut(false)
5012
5011
  })
5013
5012
  ]
5014
5013
  });
@@ -5019,8 +5018,8 @@ let __tla = (async () => {
5019
5018
  d && e.showDebug && We && b === "3D" && i(_r, {
5020
5019
  mesh: d,
5021
5020
  modelSize: u,
5022
- layers: en,
5023
- landmarkPoints: G,
5021
+ layers: Qt,
5022
+ landmarkPoints: X,
5024
5023
  componentDebug: null,
5025
5024
  aoData: U,
5026
5025
  aoGeometry: Y,
@@ -5035,7 +5034,7 @@ let __tla = (async () => {
5035
5034
  ]
5036
5035
  })
5037
5036
  }),
5038
- d && w("div", {
5037
+ d && y("div", {
5039
5038
  style: {
5040
5039
  position: "absolute",
5041
5040
  top: 16,
@@ -5062,7 +5061,7 @@ let __tla = (async () => {
5062
5061
  },
5063
5062
  children: "Start Over"
5064
5063
  }),
5065
- !le && G.length >= 1 && i("button", {
5064
+ !le && X.length >= 1 && i("button", {
5066
5065
  onClick: uo,
5067
5066
  style: {
5068
5067
  padding: "6px 16px",
@@ -5079,7 +5078,7 @@ let __tla = (async () => {
5079
5078
  },
5080
5079
  children: "Reset Points"
5081
5080
  }),
5082
- le && !Dt && i("button", {
5081
+ le && !Lt && i("button", {
5083
5082
  onClick: xo,
5084
5083
  style: {
5085
5084
  padding: "6px 16px",
@@ -5099,14 +5098,14 @@ let __tla = (async () => {
5099
5098
  ]
5100
5099
  }),
5101
5100
  e.showDebug && We && d && b === "3D" && i(Ir, {
5102
- layers: en,
5101
+ layers: Qt,
5103
5102
  onToggleLayer: (m) => qn((L) => ({
5104
5103
  ...L,
5105
5104
  [m]: !L[m]
5106
5105
  })),
5107
5106
  isDoubleShell: te
5108
5107
  }),
5109
- le && $.length > 0 && w("div", {
5108
+ le && $.length > 0 && y("div", {
5110
5109
  style: {
5111
5110
  position: "absolute",
5112
5111
  top: 16,
@@ -5116,7 +5115,7 @@ let __tla = (async () => {
5116
5115
  zIndex: 10
5117
5116
  },
5118
5117
  children: [
5119
- w("div", {
5118
+ y("div", {
5120
5119
  style: {
5121
5120
  display: "flex",
5122
5121
  borderRadius: 6,
@@ -5126,7 +5125,7 @@ let __tla = (async () => {
5126
5125
  },
5127
5126
  children: [
5128
5127
  i("button", {
5129
- onClick: () => k("3D"),
5128
+ onClick: () => P("3D"),
5130
5129
  style: {
5131
5130
  padding: "6px 14px",
5132
5131
  fontSize: 13,
@@ -5140,7 +5139,7 @@ let __tla = (async () => {
5140
5139
  children: "Orbital"
5141
5140
  }),
5142
5141
  i("button", {
5143
- onClick: () => k("2D"),
5142
+ onClick: () => P("2D"),
5144
5143
  style: {
5145
5144
  padding: "6px 14px",
5146
5145
  fontSize: 13,
@@ -5156,7 +5155,7 @@ let __tla = (async () => {
5156
5155
  })
5157
5156
  ]
5158
5157
  }),
5159
- w("div", {
5158
+ y("div", {
5160
5159
  style: {
5161
5160
  display: "flex",
5162
5161
  borderRadius: 6,
@@ -5170,9 +5169,9 @@ let __tla = (async () => {
5170
5169
  style: {
5171
5170
  padding: "6px 14px",
5172
5171
  fontSize: 13,
5173
- fontWeight: P === "cm" ? 600 : 400,
5174
- backgroundColor: P === "cm" ? "rgb(12, 67, 173)" : "#fff",
5175
- color: P === "cm" ? "#fff" : "#666",
5172
+ fontWeight: k === "cm" ? 600 : 400,
5173
+ backgroundColor: k === "cm" ? "rgb(12, 67, 173)" : "#fff",
5174
+ color: k === "cm" ? "#fff" : "#666",
5176
5175
  border: "none",
5177
5176
  cursor: "pointer",
5178
5177
  fontFamily: "system-ui, sans-serif"
@@ -5184,9 +5183,9 @@ let __tla = (async () => {
5184
5183
  style: {
5185
5184
  padding: "6px 14px",
5186
5185
  fontSize: 13,
5187
- fontWeight: P === "inch" ? 600 : 400,
5188
- backgroundColor: P === "inch" ? "rgb(12, 67, 173)" : "#fff",
5189
- color: P === "inch" ? "#fff" : "#666",
5186
+ fontWeight: k === "inch" ? 600 : 400,
5187
+ backgroundColor: k === "inch" ? "rgb(12, 67, 173)" : "#fff",
5188
+ color: k === "inch" ? "#fff" : "#666",
5190
5189
  border: "none",
5191
5190
  borderLeft: "1px solid #ccc",
5192
5191
  cursor: "pointer",
@@ -5196,7 +5195,7 @@ let __tla = (async () => {
5196
5195
  })
5197
5196
  ]
5198
5197
  }),
5199
- e.showSpacingToggle && b === "3D" && w("div", {
5198
+ e.showSpacingToggle && b === "3D" && y("div", {
5200
5199
  style: {
5201
5200
  display: "flex",
5202
5201
  borderRadius: 6,
@@ -5245,13 +5244,13 @@ let __tla = (async () => {
5245
5244
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
5246
5245
  },
5247
5246
  children: i("button", {
5248
- onClick: () => Lt((m) => !m),
5247
+ onClick: () => kt((m) => !m),
5249
5248
  style: {
5250
5249
  padding: "6px 14px",
5251
5250
  fontSize: 13,
5252
- fontWeight: Ve ? 600 : 400,
5253
- backgroundColor: Ve ? "rgb(12, 67, 173)" : "#fff",
5254
- color: Ve ? "#fff" : "#666",
5251
+ fontWeight: He ? 600 : 400,
5252
+ backgroundColor: He ? "rgb(12, 67, 173)" : "#fff",
5253
+ color: He ? "#fff" : "#666",
5255
5254
  border: "none",
5256
5255
  cursor: "pointer",
5257
5256
  fontFamily: "system-ui, sans-serif"
@@ -5269,7 +5268,7 @@ let __tla = (async () => {
5269
5268
  },
5270
5269
  children: i("button", {
5271
5270
  onClick: async () => {
5272
- const m = await Qe();
5271
+ const m = await Je();
5273
5272
  if (!m) return;
5274
5273
  const L = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), R = (W, pe) => {
5275
5274
  const H = document.createElement("a");
@@ -5334,7 +5333,7 @@ let __tla = (async () => {
5334
5333
  containerType: "inline-size",
5335
5334
  pointerEvents: "none"
5336
5335
  },
5337
- children: w("div", {
5336
+ children: y("div", {
5338
5337
  className: "gm-action-row",
5339
5338
  style: {
5340
5339
  display: "flex",
@@ -5370,37 +5369,31 @@ let __tla = (async () => {
5370
5369
  }
5371
5370
  `
5372
5371
  }),
5373
- w("div", {
5372
+ y("div", {
5374
5373
  className: "gm-btn-group",
5375
5374
  children: [
5376
- i("button", {
5377
- className: "gm-btn gm-btn-secondary",
5378
- disabled: Be,
5379
- onClick: () => at(true),
5380
- children: "Have Galileo Check My Measurements"
5381
- }),
5382
- Dt && !Ye && i("button", {
5375
+ Lt && !Ge && i("button", {
5383
5376
  className: "gm-btn gm-btn-secondary",
5384
- onClick: () => Je(true),
5377
+ onClick: () => Ue(true),
5385
5378
  children: "Edit Measurements"
5386
5379
  }),
5387
- Dt && (yo ? i("button", {
5380
+ Lt && (yo ? i("button", {
5388
5381
  className: "gm-btn gm-btn-primary",
5389
- disabled: Be,
5390
- onClick: () => Nt("continue"),
5382
+ disabled: st,
5383
+ onClick: () => Vt("continue"),
5391
5384
  children: "Continue \u2192"
5392
- }) : w(Re, {
5385
+ }) : y(Re, {
5393
5386
  children: [
5394
5387
  i("button", {
5395
5388
  className: "gm-btn gm-btn-primary",
5396
- disabled: Be,
5397
- onClick: () => Nt("use_scan"),
5389
+ disabled: st,
5390
+ onClick: () => Vt("use_scan"),
5398
5391
  children: "Go with Scan"
5399
5392
  }),
5400
5393
  i("button", {
5401
5394
  className: "gm-btn gm-btn-primary",
5402
- disabled: Be,
5403
- onClick: () => Nt("use_form_measurements"),
5395
+ disabled: st,
5396
+ onClick: () => Vt("use_form_measurements"),
5404
5397
  children: "Go with Measurements"
5405
5398
  })
5406
5399
  ]
@@ -5414,7 +5407,7 @@ let __tla = (async () => {
5414
5407
  })
5415
5408
  ]
5416
5409
  }),
5417
- Be && w("div", {
5410
+ st && y("div", {
5418
5411
  "data-finalizing-overlay": true,
5419
5412
  style: {
5420
5413
  position: "absolute",
@@ -5453,7 +5446,7 @@ let __tla = (async () => {
5453
5446
  })
5454
5447
  ]
5455
5448
  }),
5456
- l && Wt.length > 0 && w("div", {
5449
+ l && Rt.length > 0 && y("div", {
5457
5450
  style: {
5458
5451
  height: 120,
5459
5452
  flexShrink: 0,
@@ -5466,7 +5459,7 @@ let __tla = (async () => {
5466
5459
  flexDirection: "column"
5467
5460
  },
5468
5461
  children: [
5469
- w("div", {
5462
+ y("div", {
5470
5463
  style: {
5471
5464
  display: "flex",
5472
5465
  alignItems: "center",
@@ -5486,23 +5479,23 @@ let __tla = (async () => {
5486
5479
  },
5487
5480
  children: "GALILEO DEBUG"
5488
5481
  }),
5489
- w("div", {
5482
+ y("div", {
5490
5483
  style: {
5491
5484
  display: "flex",
5492
5485
  gap: 8,
5493
5486
  alignItems: "center"
5494
5487
  },
5495
5488
  children: [
5496
- w("span", {
5489
+ y("span", {
5497
5490
  style: {
5498
5491
  color: "#484f58",
5499
5492
  fontSize: 9
5500
5493
  },
5501
5494
  children: [
5502
5495
  "WASM ",
5503
- je.current ? "v2" : "N/A",
5496
+ Ne.current ? "v2" : "N/A",
5504
5497
  " | ",
5505
- G.length,
5498
+ X.length,
5506
5499
  " pts | ",
5507
5500
  le ? "aligned" : "unaligned",
5508
5501
  " | ",
@@ -5528,14 +5521,14 @@ let __tla = (async () => {
5528
5521
  ]
5529
5522
  }),
5530
5523
  i("div", {
5531
- ref: ct,
5524
+ ref: at,
5532
5525
  style: {
5533
5526
  flex: 1,
5534
5527
  overflowY: "auto",
5535
5528
  padding: "4px 10px",
5536
5529
  lineHeight: 1.6
5537
5530
  },
5538
- children: Wt.map((m, L) => {
5531
+ children: Rt.map((m, L) => {
5539
5532
  const R = m.includes("ERROR") || m.includes("failed"), W = m.includes("warning") || m.includes("WARN"), pe = m.includes("PIPELINE:"), H = m.includes("STATE:");
5540
5533
  return i("div", {
5541
5534
  style: {
@@ -5552,13 +5545,13 @@ let __tla = (async () => {
5552
5545
  }),
5553
5546
  Un && i(wr, {
5554
5547
  onSkip: un,
5555
- onCancel: () => at(false)
5548
+ onCancel: () => nn(false)
5556
5549
  })
5557
5550
  ]
5558
5551
  });
5559
5552
  };
5560
5553
  function Er({ screenshotFnRef: e }) {
5561
- return X(() => {
5554
+ return G(() => {
5562
5555
  e.current = null;
5563
5556
  }, [
5564
5557
  e
@@ -5583,7 +5576,7 @@ let __tla = (async () => {
5583
5576
  ]) t.push(`${n}_below`);
5584
5577
  return t;
5585
5578
  };
5586
- wt = function(e, r) {
5579
+ yt = function(e, r) {
5587
5580
  const t = Yn(r), n = {};
5588
5581
  for (let s = 0; s < Math.min(e.length, t.length); s++) {
5589
5582
  const l = e[s];
@@ -5661,7 +5654,7 @@ let __tla = (async () => {
5661
5654
  }
5662
5655
  Ur = ({ request: e, onComplete: r, wasmModule: t }) => {
5663
5656
  const [n, s] = E(null);
5664
- X(() => {
5657
+ G(() => {
5665
5658
  if (t != null) return;
5666
5659
  let o = false;
5667
5660
  const d = async (p) => {
@@ -5686,35 +5679,35 @@ let __tla = (async () => {
5686
5679
  e.spacing_type
5687
5680
  ]), a = async (o) => {
5688
5681
  var _a, _b;
5689
- const d = o.scanMeasurements.map((b) => +(b.modifiedValue ?? b.originalValue).toFixed(1)), p = wt(d, e.spacing_type);
5682
+ const d = o.scanMeasurements.map((b) => +(b.modifiedValue ?? b.originalValue).toFixed(1)), p = yt(d, e.spacing_type);
5690
5683
  let u, f;
5691
5684
  if (o.formMeasurements) {
5692
- u = wt(o.formMeasurements, e.spacing_type);
5693
- const b = o.scanMeasurements.map((k, S) => {
5685
+ u = yt(o.formMeasurements, e.spacing_type);
5686
+ const b = o.scanMeasurements.map((P, S) => {
5694
5687
  var _a2;
5695
5688
  const C = (_a2 = o.formMeasurements) == null ? void 0 : _a2[S];
5696
- return C == null || isNaN(C) ? null : +((k.modifiedValue ?? k.originalValue) - C).toFixed(1);
5689
+ return C == null || isNaN(C) ? null : +((P.modifiedValue ?? P.originalValue) - C).toFixed(1);
5697
5690
  });
5698
- f = wt(b, e.spacing_type);
5691
+ f = yt(b, e.spacing_type);
5699
5692
  }
5700
- const h = o.userEnteredMeasurements ? wt(o.userEnteredMeasurements.circumferences, e.spacing_type) : void 0, v = o.decision === "use_scan" || o.decision === "continue", g = v ? p : h ?? u ?? p, x = v ? +o.frontalHeight.toFixed(1) : +(((_a = o.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? o.frontalHeight).toFixed(1);
5701
- let y;
5702
- if (e.upload_url) if (!o.alignedGeometry) y = {
5693
+ const h = o.userEnteredMeasurements ? yt(o.userEnteredMeasurements.circumferences, e.spacing_type) : void 0, v = o.decision === "use_scan" || o.decision === "continue", g = v ? p : h ?? u ?? p, x = v ? +o.frontalHeight.toFixed(1) : +(((_a = o.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? o.frontalHeight).toFixed(1);
5694
+ let w;
5695
+ if (e.upload_url) if (!o.alignedGeometry) w = {
5703
5696
  success: false,
5704
5697
  url: e.upload_url,
5705
5698
  message: "No aligned geometry available \u2014 mesh processing may not have completed."
5706
5699
  };
5707
5700
  else try {
5708
- const b = $r(o.alignedGeometry), k = new Blob([
5701
+ const b = $r(o.alignedGeometry), P = new Blob([
5709
5702
  b
5710
- ]), S = await Or(e.upload_url, k);
5711
- y = {
5703
+ ]), S = await Or(e.upload_url, P);
5704
+ w = {
5712
5705
  ...S,
5713
5706
  url: e.upload_url,
5714
5707
  message: S.success ? "Cleaned mesh uploaded successfully." : `Upload failed: ${S.error ?? "unknown error"}`
5715
5708
  };
5716
5709
  } catch (b) {
5717
- y = {
5710
+ w = {
5718
5711
  success: false,
5719
5712
  url: e.upload_url,
5720
5713
  message: `Upload failed: ${b instanceof Error ? b.message : String(b)}`,
@@ -5748,7 +5741,7 @@ let __tla = (async () => {
5748
5741
  mpt_ml: o.mptML,
5749
5742
  mpt_ap: o.mptAP,
5750
5743
  screenshots: o.screenshots,
5751
- upload: y
5744
+ upload: w
5752
5745
  };
5753
5746
  r == null ? void 0 : r(A);
5754
5747
  };
@@ -5772,8 +5765,8 @@ let __tla = (async () => {
5772
5765
  export {
5773
5766
  Ur as G,
5774
5767
  __tla,
5775
- wt as a,
5768
+ yt as a,
5776
5769
  Tr as c,
5777
5770
  Yn as g,
5778
- qt as u
5771
+ Zt as u
5779
5772
  };