@solid-labs/fab-one-widget 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
1
1
  import { jsxs as F, jsx as i, Fragment as He } from "react/jsx-runtime";
2
- import { createContext as oo, Component as ro, useCallback as Q, useMemo as H, useState as B, memo as io, useEffect as K, useRef as le, forwardRef as so, createElement as sn } from "react";
3
- import { useFrame as hn, useThree as gn, Canvas as lo } from "@react-three/fiber";
4
- import { Html as Ze, Line as de, OrbitControls as mn } from "@react-three/drei";
2
+ import { createContext as io, Component as so, useCallback as Q, useMemo as H, useState as B, memo as lo, useEffect as K, useRef as ie, forwardRef as ao, createElement as cn } from "react";
3
+ import { useFrame as xn, useThree as bn, Canvas as co } from "@react-three/fiber";
4
+ import { Html as Ze, Line as de, OrbitControls as yn } from "@react-three/drei";
5
5
  import * as O from "three";
6
- import { Plane as yt, Vector3 as M, Box3 as xn, Line3 as bn, Raycaster as ao } from "three";
7
- import { create as co } from "zustand";
8
- import { OBJLoader as yn } from "three/examples/jsm/loaders/OBJLoader.js";
9
- import { STLLoader as fo } from "three/examples/jsm/loaders/STLLoader.js";
10
- import { MeshBVH as wt } from "three-mesh-bvh";
11
- let kr, mt, mr, Ln;
6
+ import { Plane as wt, Vector3 as M, Box3 as wn, Line3 as Sn, Raycaster as fo } from "three";
7
+ import { create as uo } from "zustand";
8
+ import { OBJLoader as vn } from "three/examples/jsm/loaders/OBJLoader.js";
9
+ import { STLLoader as po } from "three/examples/jsm/loaders/STLLoader.js";
10
+ import { MeshBVH as St } from "three-mesh-bvh";
11
+ let Pr, xt, br, Dn;
12
12
  let __tla = (async () => {
13
- const uo = {
13
+ const ho = {
14
14
  showDragDrop: true,
15
15
  showStartOver: true,
16
16
  showDebug: true,
@@ -19,7 +19,7 @@ let __tla = (async () => {
19
19
  showNavigation: true,
20
20
  showToolbar: false,
21
21
  showSaveButton: true
22
- }, po = {
22
+ }, go = {
23
23
  showDragDrop: false,
24
24
  showStartOver: false,
25
25
  showDebug: false,
@@ -28,7 +28,7 @@ let __tla = (async () => {
28
28
  showNavigation: false,
29
29
  showToolbar: false,
30
30
  showSaveButton: false
31
- }, ho = oo(uo), Ht = co((t, r) => ({
31
+ }, mo = io(ho), Nt = uo((t, r) => ({
32
32
  landmarkPoints: [],
33
33
  isAligned: false,
34
34
  isCut: false,
@@ -64,13 +64,13 @@ let __tla = (async () => {
64
64
  isAligned: false,
65
65
  isCut: false
66
66
  })
67
- })), go = 0.45, St = 3, $t = 1e-3, xt = 25.4, mo = [
67
+ })), xo = 0.45, vt = 3, Vt = 1e-3, bt = 25.4, bo = [
68
68
  0.25,
69
69
  -0.25,
70
70
  0.5,
71
71
  -0.5
72
72
  ];
73
- function xo(t) {
73
+ function yo(t) {
74
74
  var _a;
75
75
  const r = t.match(/^v\s+\S+\s+\S+\s+\S+(.*)$/m);
76
76
  if (!r || !((_a = r[1]) == null ? void 0 : _a.trim().includes(" "))) return null;
@@ -90,7 +90,7 @@ let __tla = (async () => {
90
90
  colors: new Float32Array(s)
91
91
  } : null;
92
92
  }
93
- function bo(t, r, n, o) {
93
+ function wo(t, r, n, o) {
94
94
  const s = t.getAttribute("position"), a = s.count, c = new Float32Array(a * 3), l = r.length / 3;
95
95
  let e = 1 / 0, m = 1 / 0, d = 1 / 0, f = -1 / 0, u = -1 / 0, x = -1 / 0;
96
96
  for (let _ = 0; _ < l; _++) {
@@ -100,12 +100,12 @@ let __tla = (async () => {
100
100
  const S = (e + f) * 0.5, p = (m + u) * 0.5, g = (d + x) * 0.5, b = f - e + 1e-6, A = u - m + 1e-6, L = x - d + 1e-6, v = b * 0.5, k = A * 0.5, w = L * 0.5, z = Math.min(128, Math.max(16, Math.round(Math.cbrt(l)))), h = b / z, C = A / z, P = L / z, I = /* @__PURE__ */ new Map();
101
101
  for (let _ = 0; _ < l; _++) {
102
102
  const E = r[_ * 3] * o - S, V = r[_ * 3 + 1] * o - p, Y = r[_ * 3 + 2] * o - g, q = Math.min(z - 1, Math.max(0, Math.floor((E + v) / h))), ye = Math.min(z - 1, Math.max(0, Math.floor((V + k) / C))), ae = Math.min(z - 1, Math.max(0, Math.floor((Y + w) / P))), fe = q * z * z + ye * z + ae;
103
- let ie = I.get(fe);
104
- ie || (ie = [], I.set(fe, ie)), ie.push(_);
103
+ let se = I.get(fe);
104
+ se || (se = [], I.set(fe, se)), se.push(_);
105
105
  }
106
106
  for (let _ = 0; _ < a; _++) {
107
107
  const E = s.getX(_), V = s.getY(_), Y = s.getZ(_), q = Math.min(z - 1, Math.max(0, Math.floor((E + v) / h))), ye = Math.min(z - 1, Math.max(0, Math.floor((V + k) / C))), ae = Math.min(z - 1, Math.max(0, Math.floor((Y + w) / P)));
108
- let fe = 1 / 0, ie = 0;
108
+ let fe = 1 / 0, se = 0;
109
109
  for (let ee = 0; ee <= z && fe > 0; ee++) {
110
110
  for (let X = -ee; X <= ee; X++) for (let ue = -ee; ue <= ee; ue++) for (let Z = -ee; Z <= ee; Z++) {
111
111
  if (ee > 0 && Math.abs(X) < ee && Math.abs(ue) < ee && Math.abs(Z) < ee) continue;
@@ -114,44 +114,44 @@ let __tla = (async () => {
114
114
  const $ = I.get(pe * z * z + me * z + he);
115
115
  if ($) for (const ne of $) {
116
116
  const xe = r[ne * 3] * o - S, Se = r[ne * 3 + 1] * o - p, we = r[ne * 3 + 2] * o - g, re = (E - xe) ** 2 + (V - Se) ** 2 + (Y - we) ** 2;
117
- re < fe && (fe = re, ie = ne);
117
+ re < fe && (fe = re, se = ne);
118
118
  }
119
119
  }
120
120
  if (fe < 1 / 0) break;
121
121
  }
122
- c[_ * 3] = n[ie * 3], c[_ * 3 + 1] = n[ie * 3 + 1], c[_ * 3 + 2] = n[ie * 3 + 2];
122
+ c[_ * 3] = n[se * 3], c[_ * 3 + 1] = n[se * 3 + 1], c[_ * 3 + 2] = n[se * 3 + 2];
123
123
  }
124
124
  t.setAttribute("color", new O.Float32BufferAttribute(c, 3));
125
125
  }
126
- const ln = {
126
+ const dn = {
127
127
  debug: 0,
128
128
  info: 1,
129
129
  warn: 2,
130
130
  error: 3
131
131
  };
132
- let wn = "warn", Sn = null;
132
+ let Cn = "warn", Mn = null;
133
133
  const ce = {
134
134
  setLevel(t) {
135
- wn = t;
135
+ Cn = t;
136
136
  },
137
137
  setHandler(t) {
138
- Sn = t;
138
+ Mn = t;
139
139
  },
140
140
  debug(t, r, n) {
141
- ht("debug", t, r, n);
141
+ gt("debug", t, r, n);
142
142
  },
143
143
  info(t, r, n) {
144
- ht("info", t, r, n);
144
+ gt("info", t, r, n);
145
145
  },
146
146
  warn(t, r, n) {
147
- ht("warn", t, r, n);
147
+ gt("warn", t, r, n);
148
148
  },
149
149
  error(t, r, n) {
150
- ht("error", t, r, n);
150
+ gt("error", t, r, n);
151
151
  }
152
152
  };
153
- function ht(t, r, n, o) {
154
- if (ln[t] < ln[wn]) return;
153
+ function gt(t, r, n, o) {
154
+ if (dn[t] < dn[Cn]) return;
155
155
  const s = `[${r}]`, a = o !== void 0 ? [
156
156
  s,
157
157
  n,
@@ -174,9 +174,9 @@ let __tla = (async () => {
174
174
  console.error(...a);
175
175
  break;
176
176
  }
177
- Sn == null ? void 0 : Sn(t, r, n, o);
177
+ Mn == null ? void 0 : Mn(t, r, n, o);
178
178
  }
179
- function bt(t) {
179
+ function yt(t) {
180
180
  const r = t.getAttribute("position"), n = new Float32Array(r.array), o = t.getIndex();
181
181
  if (o) return {
182
182
  positions: n,
@@ -189,20 +189,20 @@ let __tla = (async () => {
189
189
  indices: a
190
190
  };
191
191
  }
192
- function vn(t, r) {
192
+ function zn(t, r) {
193
193
  const n = new O.BufferGeometry();
194
194
  return n.setAttribute("position", new O.Float32BufferAttribute(t, 3)), n.setIndex(new O.BufferAttribute(r, 1)), n.computeVertexNormals(), n;
195
195
  }
196
- async function yo(t, r, n) {
196
+ async function So(t, r, n) {
197
197
  try {
198
- const o = xo(t);
198
+ const o = yo(t);
199
199
  n == null ? void 0 : n("Parsing mesh...");
200
- const a = new yn().parse(t);
200
+ const a = new vn().parse(t);
201
201
  let c = null;
202
202
  if (a.traverse((b) => {
203
203
  b.isMesh && !c && (c = b.geometry);
204
204
  }), !c) return null;
205
- const { positions: l, indices: e } = bt(c);
205
+ const { positions: l, indices: e } = yt(c);
206
206
  if (l.length < 9 || e.length < 3) return ce.warn("wasm", `Mesh too small: positions=${l.length} indices=${e.length}`), null;
207
207
  for (let b = 0; b < Math.min(l.length, 300); b++) if (!isFinite(l[b])) return ce.error("wasm", `Invalid position data: NaN/Infinity at index ${b}`), null;
208
208
  const m = l.length / 3;
@@ -211,10 +211,10 @@ let __tla = (async () => {
211
211
  const d = r.preprocess_mesh(l, e, 10, 1e-4, 500), f = d.positions(), u = d.indices(), x = d.unit_converted(), S = d.detected_unit(), p = d.log();
212
212
  if (ce.debug("wasm", "preprocess result", p), f.length === 0) return null;
213
213
  n == null ? void 0 : n("Building geometry...");
214
- const g = vn(f, u);
214
+ const g = zn(f, u);
215
215
  if (o) {
216
216
  const b = x ? 1e3 : 1;
217
- bo(g, o.positions, o.colors, b);
217
+ wo(g, o.positions, o.colors, b);
218
218
  }
219
219
  return {
220
220
  geometry: g,
@@ -226,15 +226,15 @@ let __tla = (async () => {
226
226
  return ce.error("wasm", "Processing failed", o), null;
227
227
  }
228
228
  }
229
- function wo(t) {
230
- const n = new yn().parse(t);
229
+ function vo(t) {
230
+ const n = new vn().parse(t);
231
231
  let o = null;
232
232
  return n.traverse((s) => {
233
233
  s.isMesh && !o && (o = s.geometry);
234
234
  }), o;
235
235
  }
236
- async function Tt(t) {
237
- const r = await t.arrayBuffer(), s = new fo().parse(r).getAttribute("position");
236
+ async function $t(t) {
237
+ const r = await t.arrayBuffer(), s = new po().parse(r).getAttribute("position");
238
238
  if (!s || s.count === 0) throw new Error("Empty STL geometry");
239
239
  const a = [];
240
240
  for (let c = 0; c < s.count; c++) a.push(`v ${s.getX(c)} ${s.getY(c)} ${s.getZ(c)}`);
@@ -242,25 +242,25 @@ let __tla = (async () => {
242
242
  return a.join(`
243
243
  `);
244
244
  }
245
- function So(t, r) {
245
+ function Co(t, r) {
246
246
  const n = 1 / r;
247
247
  return `${Math.round(t.x * n)}_${Math.round(t.y * n)}_${Math.round(t.z * n)}`;
248
248
  }
249
- function vo(t, r) {
249
+ function Mo(t, r) {
250
250
  if (!t.length) return [];
251
251
  const n = [];
252
252
  for (const o of t) (n.length === 0 || n[n.length - 1].distanceTo(o) > r) && n.push(o.clone());
253
253
  return n.length > 2 && n[0].distanceTo(n[n.length - 1]) > r && n.push(n[0].clone()), n;
254
254
  }
255
- function Ue(t) {
255
+ function Je(t) {
256
256
  let r = 0;
257
257
  for (let n = 0; n < t.length - 1; n++) r += t[n].distanceTo(t[n + 1]);
258
258
  return r;
259
259
  }
260
- function Cn(t, r = 1e-3, n = false) {
260
+ function An(t, r = 1e-3, n = false) {
261
261
  if (!t.length) return [];
262
262
  const o = /* @__PURE__ */ new Map(), s = (f) => {
263
- const u = So(f, r);
263
+ const u = Co(f, r);
264
264
  let x = o.get(u);
265
265
  return x || (x = f.clone(), o.set(u, x)), x;
266
266
  }, a = t.map((f) => ({
@@ -285,13 +285,13 @@ let __tla = (async () => {
285
285
  a.splice(p, 1), x = true;
286
286
  }
287
287
  }
288
- const S = vo(u, r);
288
+ const S = Mo(u, r);
289
289
  S.length > 1 && c.push(S);
290
290
  }
291
291
  if (!c.length) return [];
292
292
  if (n) {
293
- c.sort((x, S) => Ue(S) - Ue(x));
294
- const f = Ue(c[0]), u = c.filter((x) => Ue(x) >= f * 0.3);
293
+ c.sort((x, S) => Je(S) - Je(x));
294
+ const f = Je(c[0]), u = c.filter((x) => Je(x) >= f * 0.3);
295
295
  return u[u.length - 1] ?? c[0];
296
296
  }
297
297
  const l = c.filter((f) => f.length >= 3 && f[0].distanceTo(f[f.length - 1]) < r * 10), e = l.length > 0 ? l : c;
@@ -306,8 +306,8 @@ let __tla = (async () => {
306
306
  }
307
307
  return m;
308
308
  }
309
- function an(t, r, n, o = false) {
310
- const s = new yt(new M(0, 1, 0), -n), a = [], c = new xn();
309
+ function fn(t, r, n, o = false) {
310
+ const s = new wt(new M(0, 1, 0), -n), a = [], c = new wn();
311
311
  c.setFromBufferAttribute(r.getAttribute("position"));
312
312
  const l = {
313
313
  linePoints: [],
@@ -315,7 +315,7 @@ let __tla = (async () => {
315
315
  rightmostPoint: new M(0, n, 0)
316
316
  };
317
317
  if (!s.intersectsBox(c)) return l;
318
- const e = new bn(), m = new M();
318
+ const e = new Sn(), m = new M();
319
319
  t.shapecast({
320
320
  intersectsBounds: (p) => s.intersectsBox(p),
321
321
  intersectsTriangle: (p) => {
@@ -326,12 +326,12 @@ let __tla = (async () => {
326
326
  });
327
327
  }
328
328
  });
329
- const d = Cn(a, $t, o);
329
+ const d = An(a, Vt, o);
330
330
  if (d.length < 2) return l;
331
- const f = Ue(d);
331
+ const f = Je(d);
332
332
  let u = -1 / 0, x = new M(0, n, 0);
333
333
  for (const p of d) p.x > u && (u = p.x, x = p.clone());
334
- const S = d.length > 2 && d[0].distanceTo(d[d.length - 1]) < $t * 10;
334
+ const S = d.length > 2 && d[0].distanceTo(d[d.length - 1]) < Vt * 10;
335
335
  return {
336
336
  linePoints: d,
337
337
  lineLength: f,
@@ -340,21 +340,21 @@ let __tla = (async () => {
340
340
  };
341
341
  }
342
342
  function Ge(t, r, n, o = false) {
343
- const s = an(t, r, n, o);
343
+ const s = fn(t, r, n, o);
344
344
  if (s.isClosed && s.linePoints.length >= 3) return s;
345
345
  ce.debug("slice", `y=${n.toFixed(2)} failed (pts=${s.linePoints.length}, closed=${s.isClosed}), retrying...`);
346
346
  let a = s;
347
- for (const c of mo) {
348
- const l = an(t, r, n + c, o);
347
+ for (const c of bo) {
348
+ const l = fn(t, r, n + c, o);
349
349
  if (l.isClosed && l.linePoints.length >= 3) return ce.debug("slice", `y=${n.toFixed(2)} recovered with offset ${c > 0 ? "+" : ""}${c}mm (pts=${l.linePoints.length}, len=${l.lineLength.toFixed(1)}mm)`), l;
350
350
  l.linePoints.length > a.linePoints.length && (a = l);
351
351
  }
352
352
  return ce.warn("slice", `y=${n.toFixed(2)} all retries exhausted (pts=${a.linePoints.length}, closed=${a.isClosed})`), a;
353
353
  }
354
- function Co(t, r, n, o) {
355
- const s = new yt().setFromNormalAndCoplanarPoint(o.clone().normalize(), n), a = new xn();
354
+ function zo(t, r, n, o) {
355
+ const s = new wt().setFromNormalAndCoplanarPoint(o.clone().normalize(), n), a = new wn();
356
356
  if (a.setFromBufferAttribute(r.getAttribute("position")), !s.intersectsBox(a)) return 0;
357
- const c = [], l = new bn(), e = new M();
357
+ const c = [], l = new Sn(), e = new M();
358
358
  t.shapecast({
359
359
  intersectsBounds: (d) => s.intersectsBox(d),
360
360
  intersectsTriangle: (d) => {
@@ -365,15 +365,15 @@ let __tla = (async () => {
365
365
  });
366
366
  }
367
367
  });
368
- const m = Cn(c, $t);
369
- return Ue(m);
368
+ const m = An(c, Vt);
369
+ return Je(m);
370
370
  }
371
- function Mn(t) {
372
- return new wt(t, {
373
- maxLeafTris: St
371
+ function jt(t) {
372
+ return new St(t, {
373
+ maxLeafTris: vt
374
374
  });
375
375
  }
376
- function Mo(t, r, n, o) {
376
+ function Ao(t, r, n, o) {
377
377
  const s = t.getIndex(), a = s ? s.count / 3 : 0;
378
378
  if (a < 10) return {
379
379
  valid: false,
@@ -388,8 +388,8 @@ let __tla = (async () => {
388
388
  valid: false,
389
389
  reason: `Height too large (${c.toFixed(1)}mm > 1000mm)`
390
390
  };
391
- const l = new wt(t, {
392
- maxLeafTris: St
391
+ const l = new St(t, {
392
+ maxLeafTris: vt
393
393
  }), e = Ge(l, t, r);
394
394
  if (e.lineLength === 0) return {
395
395
  valid: false,
@@ -425,7 +425,7 @@ let __tla = (async () => {
425
425
  };
426
426
  }
427
427
  const Le = "pipeline";
428
- function zo(t, r, n, o) {
428
+ function ko(t, r, n, o) {
429
429
  var _a, _b, _c, _d;
430
430
  const s = t.geometry.clone(), a = r.map((l) => ({
431
431
  ...l
@@ -469,12 +469,12 @@ let __tla = (async () => {
469
469
  x: N.x,
470
470
  y: N.y,
471
471
  z: N.z
472
- }))), o.setAligned(true), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 * xt);
472
+ }))), o.setAligned(true), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 * bt);
473
473
  const j = new M();
474
474
  l.computeBoundingBox(), l.boundingBox.getSize(j), o.setModelSize(Math.max(j.x, j.y, j.z)), s.dispose();
475
475
  return;
476
476
  }
477
- const { positions: f, indices: u } = bt(l), x = new Float32Array([
477
+ const { positions: f, indices: u } = yt(l), x = new Float32Array([
478
478
  m.x,
479
479
  m.y,
480
480
  m.z
@@ -531,9 +531,9 @@ let __tla = (async () => {
531
531
  if (N <= j || we[re] <= 0) continue;
532
532
  const Ie = (N - j) / 3;
533
533
  if (Ie < 3) continue;
534
- let Pe = 0, Ke = 0, se = 0;
535
- for (let ke = j; ke < N; ke += 3) Pe += xe[ke], Ke += xe[ke + 1], se += xe[ke + 2];
536
- fe.push(Pe / Ie, Ke / Ie, se / Ie);
534
+ let Pe = 0, Ke = 0, le = 0;
535
+ for (let ke = j; ke < N; ke += 3) Pe += xe[ke], Ke += xe[ke + 1], le += xe[ke + 2];
536
+ fe.push(Pe / Ie, Ke / Ie, le / Ie);
537
537
  }
538
538
  }
539
539
  if (fe.length >= 6) {
@@ -541,8 +541,8 @@ let __tla = (async () => {
541
541
  const $ = c.refine_alignment(new Float32Array(fe), z, new Float32Array(C), new Float32Array(h));
542
542
  ce.info(Le, "Refinement complete", $.details()), z = $.positions(), h = $.mpt(), C = $.origin();
543
543
  }
544
- const ie = l.getAttribute("color"), ee = vn(z, u);
545
- ie && ee.setAttribute("color", ie), l.dispose(), l = ee, t.geometry = l, l.computeVertexNormals(), l.computeBoundingBox(), e[0] = new M(C[0], C[1], C[2]), e[1] = new M(h[0], h[1], h[2]), o.onStatus("Setting blue point...");
544
+ const se = l.getAttribute("color"), ee = zn(z, u);
545
+ se && ee.setAttribute("color", se), l.dispose(), l = ee, t.geometry = l, l.computeVertexNormals(), l.computeBoundingBox(), e[0] = new M(C[0], C[1], C[2]), e[1] = new M(h[0], h[1], h[2]), o.onStatus("Setting blue point...");
546
546
  const X = new M(e[0].x, e[0].y, e[0].z);
547
547
  e.push(X), o.addLandmarkPoint({
548
548
  faceIndex: -1,
@@ -567,20 +567,20 @@ let __tla = (async () => {
567
567
  z: $.z
568
568
  }))), o.setAligned(true);
569
569
  const ue = l.boundingBox, Z = new M();
570
- ue.getSize(Z), o.setModelSize(Math.max(Z.x, Z.y, Z.z)), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 * xt), o.onStatus("Computing final measurements...");
570
+ ue.getSize(Z), o.setModelSize(Math.max(Z.x, Z.y, Z.z)), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 * bt), o.onStatus("Computing final measurements...");
571
571
  {
572
- const $ = bt(l), ne = e[1].y, xe = e[0].y;
572
+ const $ = yt(l), ne = e[1].y, xe = e[0].y;
573
573
  let Se = 1 / 0, we = -1 / 0;
574
574
  const re = $.positions;
575
- for (let se = 1; se < re.length; se += 3) re[se] < Se && (Se = re[se]), re[se] > we && (we = re[se]);
575
+ for (let le = 1; le < re.length; le += 3) re[le] < Se && (Se = re[le]), re[le] > we && (we = re[le]);
576
576
  const j = 25.4, N = [];
577
577
  N.push(ne);
578
- for (let se = 1; se <= 2; se++) {
579
- const ke = ne + se * j;
578
+ for (let le = 1; le <= 2; le++) {
579
+ const ke = ne + le * j;
580
580
  ke < we - 1 && N.push(ke);
581
581
  }
582
- for (let se = ne - j; se > xe; se -= j) N.push(se);
583
- N.sort((se, ke) => se - ke), ce.info(Le, `Horizontal slices: ${N.length} Y planes, range ${(_b = N[0]) == null ? void 0 : _b.toFixed(1)} \u2192 ${(_c = N[N.length - 1]) == null ? void 0 : _c.toFixed(1)} mm`);
582
+ for (let le = ne - j; le > xe; le -= j) N.push(le);
583
+ N.sort((le, ke) => le - ke), ce.info(Le, `Horizontal slices: ${N.length} Y planes, range ${(_b = N[0]) == null ? void 0 : _b.toFixed(1)} \u2192 ${(_c = N[N.length - 1]) == null ? void 0 : _c.toFixed(1)} mm`);
584
584
  const Pe = (g ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))($.positions, $.indices, new Float32Array(N), 10);
585
585
  ce.info(Le, `Horizontal slices (${g ? "inner" : "outer"}): ${Pe.count()}/${N.length} valid`), ce.debug(Le, "Slice details", Pe.details());
586
586
  const Ke = {
@@ -594,13 +594,13 @@ let __tla = (async () => {
594
594
  (_d = o.setWasmSlices) == null ? void 0 : _d.call(o, Ke);
595
595
  }
596
596
  o.onStatus("Validating results...");
597
- const pe = e[1].y, me = e[0].y, he = Mo(l, pe, me, n);
597
+ const pe = e[1].y, me = e[0].y, he = Ao(l, pe, me, n);
598
598
  he.valid || ce.warn(Le, `Validation: ${he.reason}`), o.setClippedReferenceGeometry ? (s.computeVertexNormals(), o.setClippedReferenceGeometry(s)) : s.dispose();
599
599
  } catch (l) {
600
600
  ce.error(Le, "Processing failed", l), o.setError(l instanceof Error ? l.message : "Failed to process mesh."), s.dispose();
601
601
  }
602
602
  }
603
- class Ao extends ro {
603
+ class Fo extends so {
604
604
  constructor() {
605
605
  super(...arguments), this.state = {
606
606
  error: null
@@ -667,7 +667,7 @@ let __tla = (async () => {
667
667
  }) : this.props.children;
668
668
  }
669
669
  }
670
- const ko = ({ message: t, onDismiss: r }) => F("div", {
670
+ const Po = ({ message: t, onDismiss: r }) => F("div", {
671
671
  style: {
672
672
  position: "absolute",
673
673
  top: 16,
@@ -720,7 +720,7 @@ let __tla = (async () => {
720
720
  children: "x"
721
721
  })
722
722
  ]
723
- }), cn = ({ message: t }) => F("div", {
723
+ }), un = ({ message: t }) => F("div", {
724
724
  style: {
725
725
  position: "absolute",
726
726
  top: 0,
@@ -758,7 +758,7 @@ let __tla = (async () => {
758
758
  })
759
759
  ]
760
760
  });
761
- function Fo(t, r, n, o) {
761
+ function Lo(t, r, n, o) {
762
762
  const s = new M().subVectors(n, r), a = new M().subVectors(o, r), c = new M().subVectors(t, r), l = s.dot(s), e = s.dot(a), m = s.dot(c), d = a.dot(a), f = a.dot(c), u = 1 / (l * d - e * e), x = (d * m - e * f) * u, S = (l * f - e * m) * u;
763
763
  return {
764
764
  u: 1 - x - S,
@@ -766,8 +766,8 @@ let __tla = (async () => {
766
766
  w: S
767
767
  };
768
768
  }
769
- const Po = ({ mesh: t, maxPoints: r = 2, meshColor: n = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: s = false, doubleShellTransparency: a = false }) => {
770
- const { addLandmarkPoint: c, landmarkPoints: l } = Ht(), e = Q((x) => {
769
+ const Io = ({ mesh: t, maxPoints: r = 2, meshColor: n = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: s = false, doubleShellTransparency: a = false }) => {
770
+ const { addLandmarkPoint: c, landmarkPoints: l } = Nt(), e = Q((x) => {
771
771
  if (l.length >= r) return;
772
772
  x.stopPropagation();
773
773
  const S = x.intersections[0], p = S == null ? void 0 : S.faceIndex;
@@ -785,7 +785,7 @@ let __tla = (async () => {
785
785
  ];
786
786
  const L = g.getAttribute("position"), v = new M().fromBufferAttribute(L, A[0]), k = new M().fromBufferAttribute(L, A[1]), w = new M().fromBufferAttribute(L, A[2]);
787
787
  v.applyMatrix4(t.matrixWorld), k.applyMatrix4(t.matrixWorld), w.applyMatrix4(t.matrixWorld);
788
- const z = S.point, h = Fo(z, v, k, w), C = {
788
+ const z = S.point, h = Lo(z, v, k, w), C = {
789
789
  faceIndex: p,
790
790
  vertexIndices: A,
791
791
  position: {
@@ -826,7 +826,7 @@ let __tla = (async () => {
826
826
  material: u,
827
827
  renderOrder: a ? 0 : void 0
828
828
  });
829
- }, Lo = ({ point: t, index: r, markerSize: n, color: o, label: s }) => {
829
+ }, Do = ({ point: t, index: r, markerSize: n, color: o, label: s }) => {
830
830
  const [a, c] = B(false);
831
831
  return F("mesh", {
832
832
  position: [
@@ -868,8 +868,8 @@ let __tla = (async () => {
868
868
  })
869
869
  ]
870
870
  }, r);
871
- }, Io = ({ modelSize: t, labels: r }) => {
872
- const { landmarkPoints: n } = Ht(), o = t * 0.02, s = [
871
+ }, _o = ({ modelSize: t, labels: r }) => {
872
+ const { landmarkPoints: n } = Nt(), o = t * 0.02, s = [
873
873
  "#44ff44",
874
874
  "#ff4444",
875
875
  "#4444ff"
@@ -879,7 +879,7 @@ let __tla = (async () => {
879
879
  "Cut Plane"
880
880
  ];
881
881
  return i(He, {
882
- children: n.map((l, e) => i(Lo, {
882
+ children: n.map((l, e) => i(Do, {
883
883
  point: l,
884
884
  index: e,
885
885
  markerSize: o,
@@ -888,28 +888,28 @@ let __tla = (async () => {
888
888
  }, e))
889
889
  });
890
890
  };
891
- function zn(t) {
892
- return H(() => t ? new wt(t, {
893
- maxLeafTris: St
891
+ function kn(t) {
892
+ return H(() => t ? new St(t, {
893
+ maxLeafTris: vt
894
894
  }) : null, [
895
895
  t
896
896
  ]);
897
897
  }
898
- const dn = (t, r) => {
898
+ const pn = (t, r) => {
899
899
  const n = Math.abs(t - r);
900
900
  return n <= 7 ? "#8BC34A" : n <= 20 ? "#FFC107" : "#FF5722";
901
- }, fn = new O.Color("#8BC34A"), un = new O.Color("#FFC107"), Do = new O.Color("#FF5722"), _o = (t) => {
902
- if (t <= 7) return fn.clone();
901
+ }, hn = new O.Color("#8BC34A"), gn = new O.Color("#FFC107"), Ro = new O.Color("#FF5722"), Wo = (t) => {
902
+ if (t <= 7) return hn.clone();
903
903
  if (t <= 20) {
904
904
  const n = (t - 7) / 13;
905
- return fn.clone().lerp(un, n);
905
+ return hn.clone().lerp(gn, n);
906
906
  }
907
907
  const r = Math.min((t - 20) / 20, 1);
908
- return un.clone().lerp(Do, r);
909
- }, Ro = (t, r) => {
908
+ return gn.clone().lerp(Ro, r);
909
+ }, Bo = (t, r) => {
910
910
  const n = t.length, o = new Float32Array(n * 2 * 3), s = new Float32Array(n * 2 * 3), a = [];
911
911
  for (let e = 0; e < n; e++) {
912
- const m = t[e], d = r[e], f = m.distanceTo(d), u = _o(f);
912
+ const m = t[e], d = r[e], f = m.distanceTo(d), u = Wo(f);
913
913
  if (o[e * 6] = m.x, o[e * 6 + 1] = m.y, o[e * 6 + 2] = m.z, s[e * 6] = u.r, s[e * 6 + 1] = u.g, s[e * 6 + 2] = u.b, o[e * 6 + 3] = d.x, o[e * 6 + 4] = d.y, o[e * 6 + 5] = d.z, s[e * 6 + 3] = u.r, s[e * 6 + 4] = u.g, s[e * 6 + 5] = u.b, e < n - 1) {
914
914
  const x = e * 2, S = x + 1, p = (e + 1) * 2, g = p + 1;
915
915
  a.push(x, S, p, S, g, p);
@@ -926,7 +926,7 @@ let __tla = (async () => {
926
926
  depthWrite: false
927
927
  });
928
928
  return new O.Mesh(c, l);
929
- }, Wo = ({ bvh: t, geometry: r, yPosition: n, color: o = "#00ff00", labelX: s, onDataChange: a, displayUnit: c = "mm", useInnerSurface: l = false, formValue: e, lineWidth: m = 1.5, wasmLoopPoints: d, wasmCircumference: f }) => {
929
+ }, Eo = ({ bvh: t, geometry: r, yPosition: n, color: o = "#00ff00", labelX: s, onDataChange: a, displayUnit: c = "mm", useInnerSurface: l = false, formValue: e, lineWidth: m = 1.5, wasmLoopPoints: d, wasmCircumference: f }) => {
930
930
  const u = H(() => d && f != null ? null : Ge(t, r, n, l), [
931
931
  t,
932
932
  r,
@@ -942,7 +942,7 @@ let __tla = (async () => {
942
942
  x,
943
943
  S,
944
944
  e
945
- ]), g = H(() => !p || x.length < 2 ? null : Ro(x, p), [
945
+ ]), g = H(() => !p || x.length < 2 ? null : Bo(x, p), [
946
946
  x,
947
947
  p
948
948
  ]);
@@ -951,7 +951,7 @@ let __tla = (async () => {
951
951
  }, [
952
952
  g
953
953
  ]);
954
- const b = le(null), A = H(() => {
954
+ const b = ie(null), A = H(() => {
955
955
  const L = new O.BufferGeometry();
956
956
  L.setAttribute("position", new O.Float32BufferAttribute(new Float32Array(6), 3));
957
957
  const v = new O.LineBasicMaterial({
@@ -976,7 +976,7 @@ let __tla = (async () => {
976
976
  S,
977
977
  n,
978
978
  a
979
- ]), hn(({ camera: L }) => {
979
+ ]), xn(({ camera: L }) => {
980
980
  if (!b.current || x.length < 2) return;
981
981
  const v = new M();
982
982
  L.getWorldDirection(v);
@@ -1011,7 +1011,7 @@ let __tla = (async () => {
1011
1011
  }),
1012
1012
  p && e != null && e !== 0 && i(de, {
1013
1013
  points: p,
1014
- color: dn(S, e),
1014
+ color: pn(S, e),
1015
1015
  lineWidth: 2.5,
1016
1016
  dashed: true,
1017
1017
  dashSize: 2,
@@ -1078,7 +1078,7 @@ let __tla = (async () => {
1078
1078
  ]
1079
1079
  }),
1080
1080
  e != null && e !== 0 && S > 0 && (() => {
1081
- const L = S - e, v = L > 0.5 ? "\u25B2" : L < -0.5 ? "\u25BC" : "", k = dn(S, e);
1081
+ const L = S - e, v = L > 0.5 ? "\u25B2" : L < -0.5 ? "\u25BC" : "", k = pn(S, e);
1082
1082
  return F("div", {
1083
1083
  style: {
1084
1084
  display: "flex",
@@ -1130,8 +1130,8 @@ let __tla = (async () => {
1130
1130
  })
1131
1131
  ]
1132
1132
  });
1133
- }, Bo = io(Wo), Eo = ({ mesh: t, startY: r, endY: n, spacing: o, modelSize: s, onMeasurementsChange: a, reverseOrder: c = false, displayUnit: l = "mm", useInnerSurface: e = false, formMeasurements: m, originY: d, wasmSlices: f }) => {
1134
- const u = le(/* @__PURE__ */ new Map()), x = t.geometry, S = zn(x), p = H(() => {
1133
+ }, To = lo(Eo), Oo = ({ mesh: t, startY: r, endY: n, spacing: o, modelSize: s, onMeasurementsChange: a, reverseOrder: c = false, displayUnit: l = "mm", useInnerSurface: e = false, formMeasurements: m, originY: d, wasmSlices: f }) => {
1134
+ const u = ie(/* @__PURE__ */ new Map()), x = t.geometry, S = kn(x), p = H(() => {
1135
1135
  if (f) {
1136
1136
  let z = [
1137
1137
  ...f.yValues
@@ -1195,7 +1195,7 @@ let __tla = (async () => {
1195
1195
  ]);
1196
1196
  const A = [
1197
1197
  "#5B9BD5"
1198
- ], L = s * go, v = Q((k) => {
1198
+ ], L = s * xo, v = Q((k) => {
1199
1199
  if (b) return;
1200
1200
  u.current.set(k.yPosition, k);
1201
1201
  const w = Array.from(u.current.values()).sort((z, h) => c ? h.yPosition - z.yPosition : z.yPosition - h.yPosition);
@@ -1206,7 +1206,7 @@ let __tla = (async () => {
1206
1206
  b
1207
1207
  ]);
1208
1208
  return S ? i(He, {
1209
- children: p.map((k, w) => i(Bo, {
1209
+ children: p.map((k, w) => i(To, {
1210
1210
  bvh: S,
1211
1211
  geometry: x,
1212
1212
  yPosition: k,
@@ -1221,15 +1221,15 @@ let __tla = (async () => {
1221
1221
  wasmCircumference: b == null ? void 0 : b.get(k)
1222
1222
  }, k))
1223
1223
  }) : null;
1224
- }, To = (t, r) => {
1224
+ }, $o = (t, r) => {
1225
1225
  const n = Math.abs(t - r);
1226
1226
  return n <= 7 ? "#4caf50" : n <= 15 ? "#ff9800" : "#f44336";
1227
- }, Oo = ({ mesh: t, greenY: r, modelSize: n, displayUnit: o = "mm", bottomY: s, formHeight: a }) => {
1227
+ }, Ho = ({ mesh: t, greenY: r, modelSize: n, displayUnit: o = "mm", bottomY: s, formHeight: a }) => {
1228
1228
  var _a;
1229
1229
  const c = t.geometry;
1230
1230
  c.computeBoundingBox();
1231
- const l = s ?? ((_a = c.boundingBox) == null ? void 0 : _a.min.y) ?? 0, e = r - l, m = n * 0.4, d = n * 0.03, f = le(null);
1232
- hn(({ camera: w }) => {
1231
+ const l = s ?? ((_a = c.boundingBox) == null ? void 0 : _a.min.y) ?? 0, e = r - l, m = n * 0.4, d = n * 0.03, f = ie(null);
1232
+ xn(({ camera: w }) => {
1233
1233
  if (!f.current) return;
1234
1234
  const z = new M();
1235
1235
  w.getWorldDirection(z);
@@ -1241,7 +1241,7 @@ let __tla = (async () => {
1241
1241
  const P = w.position.x - f.current.position.x, I = w.position.z - f.current.position.z;
1242
1242
  f.current.rotation.y = Math.atan2(P, I);
1243
1243
  });
1244
- const u = new M(0, r, 0), x = new M(0, l, 0), S = new M(0, (r + l) / 2, 0), p = new M(-d, r, 0), g = new M(d, r, 0), b = new M(-d, l, 0), A = new M(d, l, 0), L = a != null && a > 0, v = L ? e - a : 0, k = L ? To(e, a) : "#fff";
1244
+ const u = new M(0, r, 0), x = new M(0, l, 0), S = new M(0, (r + l) / 2, 0), p = new M(-d, r, 0), g = new M(d, r, 0), b = new M(-d, l, 0), A = new M(d, l, 0), L = a != null && a > 0, v = L ? e - a : 0, k = L ? $o(e, a) : "#fff";
1245
1245
  return F("group", {
1246
1246
  ref: f,
1247
1247
  children: [
@@ -1360,8 +1360,8 @@ let __tla = (async () => {
1360
1360
  })
1361
1361
  ]
1362
1362
  });
1363
- }, $o = ({ modelSize: t, isAligned: r, isCut: n, mesh: o, viewMode: s, sliceY: a, landmarkCount: c = 0, measurementGeometry: l, resetCameraToFrontRef: e }) => {
1364
- const { set: m, size: d, camera: f, invalidate: u } = gn(), x = le(false), S = le(s), p = le(new M()), g = le(null), b = le(c), A = le(r), L = le(n), v = le(l), k = le(0), w = Q(() => {
1363
+ }, Vo = ({ modelSize: t, isAligned: r, isCut: n, mesh: o, viewMode: s, sliceY: a, landmarkCount: c = 0, measurementGeometry: l, resetCameraToFrontRef: e }) => {
1364
+ const { set: m, size: d, camera: f, invalidate: u } = bn(), x = ie(false), S = ie(s), p = ie(new M()), g = ie(null), b = ie(c), A = ie(r), L = ie(n), v = ie(l), k = ie(0), w = Q(() => {
1365
1365
  if (!o || t <= 0) return null;
1366
1366
  const h = l ?? o.geometry;
1367
1367
  h.computeBoundingBox();
@@ -1453,9 +1453,9 @@ let __tla = (async () => {
1453
1453
  const he = C.boundingBox;
1454
1454
  E = he.min.x, V = he.max.x, Y = he.min.z, q = he.max.z;
1455
1455
  }
1456
- const ae = (E + V) / 2, fe = (Y + q) / 2, ie = d.width / d.height, ee = 1.4, X = (V - E) * ee, ue = (q - Y) * ee;
1456
+ const ae = (E + V) / 2, fe = (Y + q) / 2, se = d.width / d.height, ee = 1.4, X = (V - E) * ee, ue = (q - Y) * ee;
1457
1457
  let Z, pe;
1458
- X / ue > ie ? (Z = X, pe = X / ie) : (pe = ue, Z = ue * ie);
1458
+ X / ue > se ? (Z = X, pe = X / se) : (pe = ue, Z = ue * se);
1459
1459
  const me = new O.OrthographicCamera(-Z / 2, Z / 2, pe / 2, -pe / 2, 0.1, t * 10);
1460
1460
  me.position.set(ae, a + t * 2, fe), me.up.set(0, 0, -1), me.lookAt(ae, a, fe), m({
1461
1461
  camera: me
@@ -1496,9 +1496,9 @@ let __tla = (async () => {
1496
1496
  const Z = C.boundingBox;
1497
1497
  E = Z.min.x, V = Z.max.x, Y = Z.min.z, q = Z.max.z;
1498
1498
  }
1499
- const ae = d.width / d.height, fe = 1.4, ie = (V - E) * fe, ee = (q - Y) * fe;
1499
+ const ae = d.width / d.height, fe = 1.4, se = (V - E) * fe, ee = (q - Y) * fe;
1500
1500
  let X, ue;
1501
- ie / ee > ae ? (X = ie, ue = ie / ae) : (ue = ee, X = ee * ae), h.left = -X / 2, h.right = X / 2, h.top = ue / 2, h.bottom = -ue / 2;
1501
+ se / ee > ae ? (X = se, ue = se / ae) : (ue = ee, X = ee * ae), h.left = -X / 2, h.right = X / 2, h.top = ue / 2, h.bottom = -ue / 2;
1502
1502
  } else {
1503
1503
  const C = p.current, P = d.width / d.height, I = Math.max(C.y, C.x / P) * 1.6, _ = I * P;
1504
1504
  h.left = -_ / 2, h.right = _ / 2, h.top = I / 2, h.bottom = -I / 2;
@@ -1512,12 +1512,12 @@ let __tla = (async () => {
1512
1512
  s,
1513
1513
  o
1514
1514
  ]), null;
1515
- }, Ho = ({ mesh: t, isDragging: r }) => {
1515
+ }, jo = ({ mesh: t, isDragging: r }) => {
1516
1516
  var _a;
1517
1517
  const n = t.geometry;
1518
1518
  n.computeBoundingBox();
1519
1519
  const o = new M();
1520
- return (_a = n.boundingBox) == null ? void 0 : _a.getCenter(o), i(mn, {
1520
+ return (_a = n.boundingBox) == null ? void 0 : _a.getCenter(o), i(yn, {
1521
1521
  enableDamping: false,
1522
1522
  enablePan: false,
1523
1523
  minPolarAngle: Math.PI * 0.15,
@@ -1531,7 +1531,7 @@ let __tla = (async () => {
1531
1531
  o.z
1532
1532
  ]
1533
1533
  });
1534
- }, Vo = ({ wasAutoScaled: t, onDismiss: r }) => F("div", {
1534
+ }, No = ({ wasAutoScaled: t, onDismiss: r }) => F("div", {
1535
1535
  style: {
1536
1536
  position: "absolute",
1537
1537
  bottom: 16,
@@ -1572,7 +1572,7 @@ let __tla = (async () => {
1572
1572
  children: "X"
1573
1573
  })
1574
1574
  ]
1575
- }), jo = ({ isDoubleShell: t, onDismiss: r }) => F("div", {
1575
+ }), Yo = ({ isDoubleShell: t, onDismiss: r }) => F("div", {
1576
1576
  style: {
1577
1577
  position: "absolute",
1578
1578
  bottom: 68,
@@ -1613,7 +1613,7 @@ let __tla = (async () => {
1613
1613
  children: "X"
1614
1614
  })
1615
1615
  ]
1616
- }), No = ({ steps: t, currentStep: r, accentColor: n = "rgb(12, 67, 173)" }) => i("div", {
1616
+ }), Xo = ({ steps: t, currentStep: r, accentColor: n = "rgb(12, 67, 173)" }) => i("div", {
1617
1617
  style: {
1618
1618
  backgroundColor: "#fff",
1619
1619
  borderBottom: "1px solid #e0e0e0",
@@ -1677,16 +1677,16 @@ let __tla = (async () => {
1677
1677
  ]
1678
1678
  }, o.number);
1679
1679
  })
1680
- }), Yo = ({ mesh: t, upperY: r, originY: n, modelSize: o, meshColor: s = "#c8c8c8", displayUnit: a = "mm" }) => {
1681
- const c = t.geometry, l = H(() => new wt(c, {
1682
- maxLeafTris: St
1680
+ }), Go = ({ mesh: t, upperY: r, originY: n, modelSize: o, meshColor: s = "#c8c8c8", displayUnit: a = "mm" }) => {
1681
+ const c = t.geometry, l = H(() => new St(c, {
1682
+ maxLeafTris: vt
1683
1683
  }), [
1684
1684
  c
1685
1685
  ]), e = H(() => Ge(l, c, n), [
1686
1686
  l,
1687
1687
  c,
1688
1688
  n
1689
- ]), m = H(() => new yt(new M(0, -1, 0), r), [
1689
+ ]), m = H(() => new wt(new M(0, -1, 0), r), [
1690
1690
  r
1691
1691
  ]), { mlLine: d, apLine: f, mlWidth: u, apWidth: x } = H(() => {
1692
1692
  let g = null, b = null, A = 0, L = 0;
@@ -1824,8 +1824,8 @@ let __tla = (async () => {
1824
1824
  })
1825
1825
  ]
1826
1826
  });
1827
- }, Xo = ({ mesh: t, yPosition: r, onYChange: n, minY: o, maxY: s, modelSize: a, color: c, hoverColor: l, dragColor: e, label: m, onDragStart: d, onDragEnd: f }) => {
1828
- const [u, x] = B(false), [S, p] = B(false), { camera: g, gl: b } = gn(), A = le(0), L = t.geometry, v = zn(L), k = H(() => v ? Ge(v, L, r) : {
1827
+ }, Zo = ({ mesh: t, yPosition: r, onYChange: n, minY: o, maxY: s, modelSize: a, color: c, hoverColor: l, dragColor: e, label: m, onDragStart: d, onDragEnd: f }) => {
1828
+ const [u, x] = B(false), [S, p] = B(false), { camera: g, gl: b } = bn(), A = ie(0), L = t.geometry, v = kn(L), k = H(() => v ? Ge(v, L, r) : {
1829
1829
  linePoints: [],
1830
1830
  lineLength: 0,
1831
1831
  rightmostPoint: new M()
@@ -1834,9 +1834,9 @@ let __tla = (async () => {
1834
1834
  L,
1835
1835
  r
1836
1836
  ]), w = Q((I, _) => {
1837
- const E = b.domElement.getBoundingClientRect(), V = (I - E.left) / E.width * 2 - 1, Y = -((_ - E.top) / E.height) * 2 + 1, q = new ao();
1837
+ const E = b.domElement.getBoundingClientRect(), V = (I - E.left) / E.width * 2 - 1, Y = -((_ - E.top) / E.height) * 2 + 1, q = new fo();
1838
1838
  q.setFromCamera(new O.Vector2(V, Y), g);
1839
- const ye = new yt(new M(0, 0, 1), 0), ae = new M();
1839
+ const ye = new wt(new M(0, 0, 1), 0), ae = new M();
1840
1840
  return q.ray.intersectPlane(ye, ae), ae ? ae.y : r;
1841
1841
  }, [
1842
1842
  g,
@@ -1913,17 +1913,17 @@ let __tla = (async () => {
1913
1913
  ]
1914
1914
  });
1915
1915
  };
1916
- function Go(t, r) {
1916
+ function Ko(t, r) {
1917
1917
  if (t == null) return {};
1918
1918
  var n = {}, o = Object.keys(t), s, a;
1919
1919
  for (a = 0; a < o.length; a++) s = o[a], !(r.indexOf(s) >= 0) && (n[s] = t[s]);
1920
1920
  return n;
1921
1921
  }
1922
- var Zo = [
1922
+ var Uo = [
1923
1923
  "color"
1924
- ], Ko = so(function(t, r) {
1925
- var n = t.color, o = n === void 0 ? "currentColor" : n, s = Go(t, Zo);
1926
- return sn("svg", Object.assign({
1924
+ ], Jo = ao(function(t, r) {
1925
+ var n = t.color, o = n === void 0 ? "currentColor" : n, s = Ko(t, Uo);
1926
+ return cn("svg", Object.assign({
1927
1927
  width: "15",
1928
1928
  height: "15",
1929
1929
  viewBox: "0 0 15 15",
@@ -1931,20 +1931,20 @@ let __tla = (async () => {
1931
1931
  xmlns: "http://www.w3.org/2000/svg"
1932
1932
  }, s, {
1933
1933
  ref: r
1934
- }), sn("path", {
1934
+ }), cn("path", {
1935
1935
  d: "M7.5 2C7.77614 2 8 2.22386 8 2.5L8 11.2929L11.1464 8.14645C11.3417 7.95118 11.6583 7.95118 11.8536 8.14645C12.0488 8.34171 12.0488 8.65829 11.8536 8.85355L7.85355 12.8536C7.75979 12.9473 7.63261 13 7.5 13C7.36739 13 7.24021 12.9473 7.14645 12.8536L3.14645 8.85355C2.95118 8.65829 2.95118 8.34171 3.14645 8.14645C3.34171 7.95118 3.65829 7.95118 3.85355 8.14645L7 11.2929L7 2.5C7 2.22386 7.22386 2 7.5 2Z",
1936
1936
  fill: o,
1937
1937
  fillRule: "evenodd",
1938
1938
  clipRule: "evenodd"
1939
1939
  }));
1940
1940
  });
1941
- const Uo = [
1941
+ const Qo = [
1942
1942
  "Scan doesn't load properly",
1943
1943
  "Takes too long",
1944
1944
  "I don't want to",
1945
1945
  "I want a second opinion",
1946
1946
  "I measured from IT"
1947
- ], gt = {
1947
+ ], mt = {
1948
1948
  padding: "8px 20px",
1949
1949
  borderRadius: 4,
1950
1950
  fontSize: 14,
@@ -1953,7 +1953,7 @@ let __tla = (async () => {
1953
1953
  fontFamily: "system-ui, sans-serif",
1954
1954
  letterSpacing: "0.4px",
1955
1955
  lineHeight: "36px"
1956
- }, Jo = {
1956
+ }, qo = {
1957
1957
  width: "100%",
1958
1958
  padding: "10px 12px",
1959
1959
  fontSize: 15,
@@ -1962,7 +1962,7 @@ let __tla = (async () => {
1962
1962
  outline: "none",
1963
1963
  boxSizing: "border-box",
1964
1964
  fontFamily: "system-ui, sans-serif"
1965
- }, An = ({ onSkip: t, onCancel: r }) => {
1965
+ }, Fn = ({ onSkip: t, onCancel: r }) => {
1966
1966
  const [n, o] = B("confirm"), [s, a] = B(null), [c, l] = B(""), e = Q(() => {
1967
1967
  o("reasons");
1968
1968
  }, []), m = Q(() => {
@@ -2031,7 +2031,7 @@ let __tla = (async () => {
2031
2031
  },
2032
2032
  children: [
2033
2033
  [
2034
- ...Uo,
2034
+ ...Qo,
2035
2035
  "Other"
2036
2036
  ].map((u) => F("label", {
2037
2037
  style: {
@@ -2078,7 +2078,7 @@ let __tla = (async () => {
2078
2078
  u.key === "Enter" && f();
2079
2079
  },
2080
2080
  style: {
2081
- ...Jo,
2081
+ ...qo,
2082
2082
  marginTop: 8,
2083
2083
  marginLeft: 40,
2084
2084
  width: "calc(100% - 40px)",
@@ -2099,7 +2099,7 @@ let __tla = (async () => {
2099
2099
  i("button", {
2100
2100
  onClick: m,
2101
2101
  style: {
2102
- ...gt,
2102
+ ...mt,
2103
2103
  backgroundColor: "#fff",
2104
2104
  border: "1px solid #ddd",
2105
2105
  color: "#666"
@@ -2110,7 +2110,7 @@ let __tla = (async () => {
2110
2110
  onClick: f,
2111
2111
  disabled: !d,
2112
2112
  style: {
2113
- ...gt,
2113
+ ...mt,
2114
2114
  backgroundColor: d ? "rgb(12, 67, 173)" : "#e0e0e0",
2115
2115
  border: "none",
2116
2116
  color: d ? "#fff" : "#9e9e9e",
@@ -2171,7 +2171,7 @@ let __tla = (async () => {
2171
2171
  i("button", {
2172
2172
  onClick: r,
2173
2173
  style: {
2174
- ...gt,
2174
+ ...mt,
2175
2175
  backgroundColor: "#fff",
2176
2176
  border: "1px solid #bdbdbd",
2177
2177
  color: "#333"
@@ -2181,7 +2181,7 @@ let __tla = (async () => {
2181
2181
  i("button", {
2182
2182
  onClick: e,
2183
2183
  style: {
2184
- ...gt,
2184
+ ...mt,
2185
2185
  backgroundColor: "rgb(12, 67, 173)",
2186
2186
  border: "none",
2187
2187
  color: "#fff"
@@ -2193,7 +2193,7 @@ let __tla = (async () => {
2193
2193
  ]
2194
2194
  })
2195
2195
  });
2196
- }, Ot = {
2196
+ }, Ht = {
2197
2197
  padding: "8px 20px",
2198
2198
  borderRadius: 4,
2199
2199
  fontSize: 14,
@@ -2202,7 +2202,7 @@ let __tla = (async () => {
2202
2202
  fontFamily: "system-ui, sans-serif",
2203
2203
  letterSpacing: "0.4px",
2204
2204
  lineHeight: "36px"
2205
- }, pn = {
2205
+ }, mn = {
2206
2206
  width: "100%",
2207
2207
  padding: "10px 12px",
2208
2208
  fontSize: 15,
@@ -2211,7 +2211,7 @@ let __tla = (async () => {
2211
2211
  outline: "none",
2212
2212
  boxSizing: "border-box",
2213
2213
  fontFamily: "system-ui, sans-serif"
2214
- }, Qo = ({ amputationType: t, spacingInches: r, scanMeasurements: n, scanFrontalHeight: o, onSave: s, onSkip: a, onFormChange: c, onHeightChange: l, initialValues: e, initialFrontalHeight: m }) => {
2214
+ }, er = ({ amputationType: t, spacingInches: r, scanMeasurements: n, scanFrontalHeight: o, onSave: s, onSkip: a, onFormChange: c, onHeightChange: l, initialValues: e, initialFrontalHeight: m }) => {
2215
2215
  const d = t === "AK" ? "IT" : "MPT", f = r, u = t === "AK" ? 18 : 9, x = H(() => {
2216
2216
  const h = [];
2217
2217
  for (let C = 2; C >= 1; C -= f) h.push(`${C}\u2033 above ${d}`);
@@ -2288,7 +2288,7 @@ let __tla = (async () => {
2288
2288
  fontFamily: "system-ui, sans-serif"
2289
2289
  },
2290
2290
  children: [
2291
- A && i(An, {
2291
+ A && i(Fn, {
2292
2292
  onSkip: a,
2293
2293
  onCancel: () => L(false)
2294
2294
  }),
@@ -2327,7 +2327,7 @@ let __tla = (async () => {
2327
2327
  i("button", {
2328
2328
  onClick: z,
2329
2329
  style: {
2330
- ...Ot,
2330
+ ...Ht,
2331
2331
  backgroundColor: "#fff",
2332
2332
  border: "2px solid rgb(12, 67, 173)",
2333
2333
  color: "rgb(12, 67, 173)",
@@ -2345,7 +2345,7 @@ let __tla = (async () => {
2345
2345
  gap: 4
2346
2346
  },
2347
2347
  children: [
2348
- i(Ko, {
2348
+ i(Jo, {
2349
2349
  style: {
2350
2350
  width: 14,
2351
2351
  height: 14
@@ -2408,7 +2408,7 @@ let __tla = (async () => {
2408
2408
  [h]: P.target.value
2409
2409
  })),
2410
2410
  style: {
2411
- ...pn,
2411
+ ...mn,
2412
2412
  padding: "6px 8px",
2413
2413
  fontSize: 13,
2414
2414
  borderColor: S[h] ? "rgb(12, 67, 173)" : "#ccc",
@@ -2451,7 +2451,7 @@ let __tla = (async () => {
2451
2451
  value: g,
2452
2452
  onChange: (h) => b(h.target.value),
2453
2453
  style: {
2454
- ...pn,
2454
+ ...mn,
2455
2455
  padding: "6px 8px",
2456
2456
  fontSize: 13,
2457
2457
  borderColor: g ? "rgb(12, 67, 173)" : "#ccc",
@@ -2478,7 +2478,7 @@ let __tla = (async () => {
2478
2478
  onClick: w,
2479
2479
  disabled: !k,
2480
2480
  style: {
2481
- ...Ot,
2481
+ ...Ht,
2482
2482
  backgroundColor: k ? "rgb(12, 67, 173)" : "#e0e0e0",
2483
2483
  border: "none",
2484
2484
  color: k ? "#fff" : "#9e9e9e",
@@ -2492,7 +2492,7 @@ let __tla = (async () => {
2492
2492
  i("button", {
2493
2493
  onClick: () => L(true),
2494
2494
  style: {
2495
- ...Ot,
2495
+ ...Ht,
2496
2496
  backgroundColor: "#fff",
2497
2497
  border: "1px solid #bdbdbd",
2498
2498
  color: "#666",
@@ -2507,7 +2507,7 @@ let __tla = (async () => {
2507
2507
  ]
2508
2508
  });
2509
2509
  };
2510
- function kn(t, r, n) {
2510
+ function Pn(t, r, n) {
2511
2511
  const o = t.getAttribute("position"), s = n - r;
2512
2512
  if (s < 1) return null;
2513
2513
  const a = 30, c = s / a, l = [];
@@ -2537,7 +2537,7 @@ let __tla = (async () => {
2537
2537
  }
2538
2538
  return p.y < 0 && p.negate(), p;
2539
2539
  }
2540
- const qo = {
2540
+ const tr = {
2541
2541
  pcaAxes: true,
2542
2542
  obb: true,
2543
2543
  obbAxis: true,
@@ -2547,12 +2547,12 @@ let __tla = (async () => {
2547
2547
  landmarkAxis: true,
2548
2548
  iterativePCA: false,
2549
2549
  fullRegionPCA: true
2550
- }, er = [
2550
+ }, nr = [
2551
2551
  "#ff4444",
2552
2552
  "#44cc44",
2553
2553
  "#4488ff"
2554
2554
  ];
2555
- function Fn(t) {
2555
+ function Ln(t) {
2556
2556
  const r = t.getAttribute("position"), n = r.count, o = new M();
2557
2557
  for (let p = 0; p < n; p++) o.x += r.getX(p), o.y += r.getY(p), o.z += r.getZ(p);
2558
2558
  o.divideScalar(n);
@@ -2628,7 +2628,7 @@ let __tla = (async () => {
2628
2628
  halfExtents: S
2629
2629
  };
2630
2630
  }
2631
- function tr({ pca: t }) {
2631
+ function or({ pca: t }) {
2632
2632
  return i("group", {
2633
2633
  children: t.axes.map((r, n) => {
2634
2634
  const o = t.center.clone().addScaledVector(r, t.halfExtents[n]), s = t.center.clone().addScaledVector(r, -t.halfExtents[n]);
@@ -2637,13 +2637,13 @@ let __tla = (async () => {
2637
2637
  s,
2638
2638
  o
2639
2639
  ],
2640
- color: er[n],
2640
+ color: nr[n],
2641
2641
  lineWidth: 2
2642
2642
  }, n);
2643
2643
  })
2644
2644
  });
2645
2645
  }
2646
- function nr({ pca: t }) {
2646
+ function rr({ pca: t }) {
2647
2647
  const r = H(() => {
2648
2648
  const { center: n, axes: o, halfExtents: s } = t, a = [];
2649
2649
  for (let l = -1; l <= 1; l += 2) for (let e = -1; e <= 1; e += 2) for (let m = -1; m <= 1; m += 2) a.push(n.clone().addScaledVector(o[0], l * s[0]).addScaledVector(o[1], e * s[1]).addScaledVector(o[2], m * s[2]));
@@ -2713,7 +2713,7 @@ let __tla = (async () => {
2713
2713
  }, o))
2714
2714
  });
2715
2715
  }
2716
- function or({ redPoint: t, greenPoint: r }) {
2716
+ function ir({ redPoint: t, greenPoint: r }) {
2717
2717
  const n = H(() => new M().subVectors(r, t).normalize(), [
2718
2718
  t,
2719
2719
  r
@@ -2766,13 +2766,13 @@ let __tla = (async () => {
2766
2766
  ]
2767
2767
  });
2768
2768
  }
2769
- function rr({ geometry: t, redY: r, greenY: n, modelSize: o }) {
2769
+ function sr({ geometry: t, redY: r, greenY: n, modelSize: o }) {
2770
2770
  const a = o * 0.15, c = H(() => {
2771
2771
  const l = [];
2772
2772
  let e = n - 10;
2773
2773
  const m = new M(0, 1, 0);
2774
2774
  for (; e > r; ) {
2775
- const d = Math.min(e, n), f = Math.max(e, n), u = kn(t, d, f);
2775
+ const d = Math.min(e, n), f = Math.max(e, n), u = Pn(t, d, f);
2776
2776
  if (u) {
2777
2777
  const x = u.dot(m), S = Math.acos(Math.min(1, Math.abs(x))) * 180 / Math.PI;
2778
2778
  l.push({
@@ -2820,9 +2820,9 @@ let __tla = (async () => {
2820
2820
  })
2821
2821
  });
2822
2822
  }
2823
- function ir({ geometry: t, redY: r, greenY: n, modelSize: o }) {
2823
+ function lr({ geometry: t, redY: r, greenY: n, modelSize: o }) {
2824
2824
  const s = H(() => {
2825
- const f = kn(t, r, n);
2825
+ const f = Pn(t, r, n);
2826
2826
  if (!f) return null;
2827
2827
  const u = f.dot(new M(0, 1, 0)), x = Math.acos(Math.min(1, Math.abs(u))) * 180 / Math.PI;
2828
2828
  return {
@@ -2850,7 +2850,7 @@ let __tla = (async () => {
2850
2850
  })
2851
2851
  });
2852
2852
  }
2853
- function sr({ pca: t, modelSize: r }) {
2853
+ function ar({ pca: t, modelSize: r }) {
2854
2854
  const n = t.axes[0], o = r * 0.6, s = t.center.clone().addScaledVector(n, o), a = t.center.clone().addScaledVector(n, -o);
2855
2855
  return i(de, {
2856
2856
  points: [
@@ -2864,11 +2864,11 @@ let __tla = (async () => {
2864
2864
  gapSize: 2
2865
2865
  });
2866
2866
  }
2867
- function lr({ geometry: t, redY: r, greenY: n, modelSize: o, measurementGeometry: s }) {
2867
+ function cr({ geometry: t, redY: r, greenY: n, modelSize: o, measurementGeometry: s }) {
2868
2868
  const a = H(() => {
2869
- const d = s ?? t, f = Mn(d), u = new M(0, 1, 0), x = 5, p = n + 3 * 25.4, g = [];
2869
+ const d = s ?? t, f = jt(d), u = new M(0, 1, 0), x = 5, p = n + 3 * 25.4, g = [];
2870
2870
  for (let h = r + x; h < p; h += x) {
2871
- const C = Co(f, d, new M(0, h, 0), u);
2871
+ const C = zo(f, d, new M(0, h, 0), u);
2872
2872
  C > 0 && g.push({
2873
2873
  y: h,
2874
2874
  circ: C
@@ -2941,7 +2941,7 @@ let __tla = (async () => {
2941
2941
  ]
2942
2942
  });
2943
2943
  }
2944
- function ar({ componentDebug: t }) {
2944
+ function dr({ componentDebug: t }) {
2945
2945
  return i("group", {
2946
2946
  children: t.geometries.map((r, n) => {
2947
2947
  const o = t.colors[n] ?? "#888888", s = n === t.innerIdx;
@@ -3005,7 +3005,7 @@ let __tla = (async () => {
3005
3005
  })
3006
3006
  });
3007
3007
  }
3008
- function cr({ geometry: t, aoData: r }) {
3008
+ function fr({ geometry: t, aoData: r }) {
3009
3009
  const n = H(() => {
3010
3010
  const o = t.toNonIndexed(), s = o.getAttribute("position"), a = r.length, c = s.count, l = new Float32Array(c * 3);
3011
3011
  for (let e = 0; e < a && e * 3 + 2 < c; e++) {
@@ -3034,8 +3034,8 @@ let __tla = (async () => {
3034
3034
  })
3035
3035
  });
3036
3036
  }
3037
- function dr({ mesh: t, layers: r, landmarkPoints: n, componentDebug: o, aoData: s, aoGeometry: a, measurementGeometry: c }) {
3038
- const l = t.geometry, e = H(() => l.getAttribute("position") ? Fn(l) : null, [
3037
+ function ur({ mesh: t, layers: r, landmarkPoints: n, componentDebug: o, aoData: s, aoGeometry: a, measurementGeometry: c }) {
3038
+ const l = t.geometry, e = H(() => l.getAttribute("position") ? Ln(l) : null, [
3039
3039
  l
3040
3040
  ]), m = H(() => !n || n.length < 2 ? null : {
3041
3041
  red: new M(n[1].position.x, n[1].position.y, n[1].position.z),
@@ -3045,24 +3045,24 @@ let __tla = (async () => {
3045
3045
  ]);
3046
3046
  return F("group", {
3047
3047
  children: [
3048
- r.pcaAxes && e && i(tr, {
3048
+ r.pcaAxes && e && i(or, {
3049
3049
  pca: e
3050
3050
  }),
3051
- r.obb && e && i(nr, {
3051
+ r.obb && e && i(rr, {
3052
3052
  pca: e
3053
3053
  }),
3054
- r.obbAxis && e && i(sr, {
3054
+ r.obbAxis && e && i(ar, {
3055
3055
  pca: e,
3056
3056
  modelSize: e.halfExtents[0] ? Math.max(...e.halfExtents) * 2 : 100
3057
3057
  }),
3058
- r.shellComponents && o && i(ar, {
3058
+ r.shellComponents && o && i(dr, {
3059
3059
  componentDebug: o
3060
3060
  }),
3061
- r.ambientOcclusion && s && s.length > 0 && i(cr, {
3061
+ r.ambientOcclusion && s && s.length > 0 && i(fr, {
3062
3062
  geometry: a ?? l,
3063
3063
  aoData: s
3064
3064
  }),
3065
- r.circumferenceScan && m && i(lr, {
3065
+ r.circumferenceScan && m && i(cr, {
3066
3066
  geometry: l,
3067
3067
  redY: m.red.y,
3068
3068
  greenY: m.green.y,
@@ -3080,17 +3080,17 @@ let __tla = (async () => {
3080
3080
  depthWrite: false
3081
3081
  })
3082
3082
  }),
3083
- r.landmarkAxis && m && i(or, {
3083
+ r.landmarkAxis && m && i(ir, {
3084
3084
  redPoint: m.red,
3085
3085
  greenPoint: m.green
3086
3086
  }),
3087
- r.iterativePCA && m && i(rr, {
3087
+ r.iterativePCA && m && i(sr, {
3088
3088
  geometry: l,
3089
3089
  redY: m.red.y,
3090
3090
  greenY: m.green.y,
3091
3091
  modelSize: (e == null ? void 0 : e.halfExtents[0]) ? Math.max(...e.halfExtents) * 2 : 100
3092
3092
  }),
3093
- r.fullRegionPCA && m && i(ir, {
3093
+ r.fullRegionPCA && m && i(lr, {
3094
3094
  geometry: l,
3095
3095
  redY: m.red.y,
3096
3096
  greenY: m.green.y,
@@ -3099,10 +3099,10 @@ let __tla = (async () => {
3099
3099
  ]
3100
3100
  });
3101
3101
  }
3102
- function fr({ mesh: t }) {
3102
+ function pr({ mesh: t }) {
3103
3103
  const r = t.geometry, n = H(() => {
3104
3104
  if (!r.getAttribute("position")) return null;
3105
- const a = Fn(r), c = a.axes[0], l = a.halfExtents[0] * 1.3;
3105
+ const a = Ln(r), c = a.axes[0], l = a.halfExtents[0] * 1.3;
3106
3106
  return {
3107
3107
  axis: c,
3108
3108
  center: a.center,
@@ -3129,7 +3129,7 @@ let __tla = (async () => {
3129
3129
  renderOrder: 999
3130
3130
  });
3131
3131
  }
3132
- const Pn = [
3132
+ const In = [
3133
3133
  {
3134
3134
  key: "pcaAxes",
3135
3135
  label: "PCA Axes (full mesh)",
@@ -3185,10 +3185,10 @@ let __tla = (async () => {
3185
3185
  color: "#00ffff",
3186
3186
  group: "Alignment"
3187
3187
  }
3188
- ], ur = [
3189
- ...new Set(Pn.map((t) => t.group))
3188
+ ], hr = [
3189
+ ...new Set(In.map((t) => t.group))
3190
3190
  ];
3191
- function pr({ layers: t, onToggleLayer: r, isDoubleShell: n }) {
3191
+ function gr({ layers: t, onToggleLayer: r, isDoubleShell: n }) {
3192
3192
  return F("div", {
3193
3193
  style: {
3194
3194
  position: "absolute",
@@ -3217,8 +3217,8 @@ let __tla = (async () => {
3217
3217
  },
3218
3218
  children: "Debug Layers"
3219
3219
  }),
3220
- ur.map((o) => {
3221
- const s = Pn.filter((a) => a.group === o && !(a.hideWhenDoubleShell && n));
3220
+ hr.map((o) => {
3221
+ const s = In.filter((a) => a.group === o && !(a.hideWhenDoubleShell && n));
3222
3222
  return s.length === 0 ? null : F("div", {
3223
3223
  children: [
3224
3224
  i("div", {
@@ -3278,43 +3278,50 @@ let __tla = (async () => {
3278
3278
  ]
3279
3279
  });
3280
3280
  }
3281
- const hr = ({ config: t, spacingType: r, scanUrl: n, formMeasurements: o, onComplete: s, isDebugUser: a = false, onAnalyticsEvent: c, wasmModule: l }) => {
3282
- const [e, m] = B(null), [d, f] = B(0), [u, x] = B(false), [S, p] = B(false), [g, b] = B(""), [A, L] = B("3D"), [v, k] = B(r === "AK" ? 2 : 1), [w, z] = B(false), [h, C] = B(null), [P, I] = B(r ?? null), [_, E] = B("mm"), [V, Y] = B(false), [q, ye] = B(""), [ae, fe] = B(false), [ie, ee] = B(false), [X, ue] = B(false), [Z, pe] = B(false), [me, he] = B(null), [$, ne] = B(null), [xe, Se] = B(null), [we, re] = B(false), [j, N] = B([]), [Ie, Pe] = B(null), [Ke, se] = B(null), [ke, vt] = B(null), [Ct, Vt] = B(null), [In, jt] = B(false), [Mt, Nt] = B(null), [zt, De] = B(null), [We, Dn] = B(false), [Yt, _n] = B(qo), [Ve, Xt] = B("obj"), [ve, At] = B(o), [Je, kt] = B(true), [je, rt] = B(false), [it, Gt] = B(false), [ze, st] = B(false), [Rn, Ft] = B(false), [Qe, Wn] = B(null), [Bn, En] = B(void 0), [Tn, On] = B(void 0), [Zt] = B("#c8c8c8"), [$n] = B(1), [Te, Hn] = B(false), [Pt, Kt] = B([]), lt = le(null), Ne = le(null), at = le(false), Vn = le(null), Lt = le(null), It = le(null), qe = Q(async () => {
3283
- if (It.current) try {
3284
- const y = (await import("./html2canvas.esm-Dmi1NfiH.js")).default, D = It.current, R = 2, W = async (J = false) => {
3281
+ const mr = ({ config: t, spacingType: r, scanUrl: n, formMeasurements: o, onComplete: s, isDebugUser: a = false, onAnalyticsEvent: c, wasmModule: l }) => {
3282
+ const [e, m] = B(null), [d, f] = B(0), [u, x] = B(false), [S, p] = B(false), [g, b] = B(""), [A, L] = B("3D"), [v, k] = B(r === "AK" ? 2 : 1), [w, z] = B(false), [h, C] = B(null), [P, I] = B(r ?? null), [_, E] = B("mm"), [V, Y] = B(false), [q, ye] = B(""), [ae, fe] = B(false), [se, ee] = B(false), [X, ue] = B(false), [Z, pe] = B(false), [me, he] = B(null), [$, ne] = B(null), [xe, Se] = B(null), [we, re] = B(false), [j, N] = B([]), [Ie, Pe] = B(null), [Ke, le] = B(null), [ke, Ct] = B(null), [Mt, Yt] = B(null), [_n, Xt] = B(false), [zt, Gt] = B(null), [At, De] = B(null), [We, Rn] = B(false), [Zt, Wn] = B(tr), [Ve, Kt] = B("obj"), [ve, kt] = B(o), [Qe, Ft] = B(true), [je, it] = B(false), [st, Ut] = B(false), [ze, lt] = B(false), [Bn, Pt] = B(false), [qe, En] = B(null), [Tn, On] = B(void 0), [$n, Hn] = B(void 0), [Jt] = B("#c8c8c8"), [Vn] = B(1), [Te, jn] = B(false), [Lt, Qt] = B([]), at = ie(null), Ne = ie(null), ct = ie(false), Nn = ie(null), It = ie(null), Dt = ie(null), qt = ie(null);
3283
+ K(() => {
3284
+ import("./html2canvas.esm-Dmi1NfiH.js").then((y) => {
3285
+ qt.current = y.default;
3286
+ }).catch(() => {
3287
+ });
3288
+ }, []);
3289
+ const et = Q(async () => {
3290
+ if (Dt.current) try {
3291
+ const y = qt.current ?? (await import("./html2canvas.esm-Dmi1NfiH.js")).default, D = Dt.current, R = 2, W = async (J = false) => {
3285
3292
  const oe = await y(D, {
3286
3293
  backgroundColor: null,
3287
3294
  useCORS: true,
3288
3295
  scale: R,
3289
- ignoreElements: (nt) => {
3296
+ ignoreElements: (ot) => {
3290
3297
  var _a, _b;
3291
- return ((_a = nt.style) == null ? void 0 : _a.zIndex) === "10" || ((_b = nt.hasAttribute) == null ? void 0 : _b.call(nt, "data-finalizing-overlay"));
3298
+ return ((_a = ot.style) == null ? void 0 : _a.zIndex) === "10" || ((_b = ot.hasAttribute) == null ? void 0 : _b.call(ot, "data-finalizing-overlay"));
3292
3299
  }
3293
3300
  }), te = D.getBoundingClientRect(), Fe = te.width, Be = te.height;
3294
3301
  let Me, Ae, be, $e;
3295
3302
  if (J) {
3296
3303
  const _e = oe.getContext("2d").getImageData(0, 0, oe.width, oe.height).data;
3297
- let Re = oe.width, Ee = oe.height, ot = 0, pt = 0;
3304
+ let Re = oe.width, Ee = oe.height, rt = 0, ht = 0;
3298
3305
  for (let Ye = 0; Ye < oe.height; Ye++) for (let Xe = 0; Xe < oe.width; Xe++) {
3299
- const no = (Ye * oe.width + Xe) * 4;
3300
- _e[no + 3] > 20 && (Xe < Re && (Re = Xe), Xe > ot && (ot = Xe), Ye < Ee && (Ee = Ye), Ye > pt && (pt = Ye));
3306
+ const ro = (Ye * oe.width + Xe) * 4;
3307
+ _e[ro + 3] > 20 && (Xe < Re && (Re = Xe), Xe > rt && (rt = Xe), Ye < Ee && (Ee = Ye), Ye > ht && (ht = Ye));
3301
3308
  }
3302
- ot <= Re && (Re = 0, Ee = 0, ot = oe.width, pt = oe.height), Me = Re / R, Ae = Ee / R, be = ot / R, $e = pt / R;
3309
+ rt <= Re && (Re = 0, Ee = 0, rt = oe.width, ht = oe.height), Me = Re / R, Ae = Ee / R, be = rt / R, $e = ht / R;
3303
3310
  } else {
3304
- const nt = D.querySelectorAll("[style*='pointer-events: none']");
3305
- Me = 1 / 0, Ae = 1 / 0, be = -1 / 0, $e = -1 / 0, nt.forEach((Et) => {
3306
- const _e = Et.getBoundingClientRect();
3311
+ const ot = D.querySelectorAll("[style*='pointer-events: none']");
3312
+ Me = 1 / 0, Ae = 1 / 0, be = -1 / 0, $e = -1 / 0, ot.forEach((Ot) => {
3313
+ const _e = Ot.getBoundingClientRect();
3307
3314
  if (_e.width === 0 || _e.height === 0) return;
3308
3315
  const Re = _e.left - te.left, Ee = _e.top - te.top;
3309
3316
  Re < Me && (Me = Re), Ee < Ae && (Ae = Ee), Re + _e.width > be && (be = Re + _e.width), Ee + _e.height > $e && ($e = Ee + _e.height);
3310
3317
  }), Me === 1 / 0 && (Me = 0, Ae = 0, be = Fe, $e = Be);
3311
3318
  }
3312
- const on = Math.max(Fe, Be) * 0.03, rn = Math.max(Fe, Be) * 0.06;
3313
- Me = Math.max(0, Me - on), Ae = Math.max(0, Ae - rn), be = Math.min(Fe, be + on), $e = Math.min(Be, $e + rn);
3314
- const Wt = (be - Me) * R, Bt = ($e - Ae) * R, eo = Math.max(0, Me * R), to = Math.max(0, Ae * R), ut = document.createElement("canvas");
3315
- return ut.width = Math.round(Wt), ut.height = Math.round(Bt), ut.getContext("2d").drawImage(oe, Math.round(eo), Math.round(to), Math.round(Wt), Math.round(Bt), 0, 0, Math.round(Wt), Math.round(Bt)), ut.toDataURL("image/png");
3319
+ const ln = Math.max(Fe, Be) * 0.03, an = Math.max(Fe, Be) * 0.06;
3320
+ Me = Math.max(0, Me - ln), Ae = Math.max(0, Ae - an), be = Math.min(Fe, be + ln), $e = Math.min(Be, $e + an);
3321
+ const Et = (be - Me) * R, Tt = ($e - Ae) * R, no = Math.max(0, Me * R), oo = Math.max(0, Ae * R), pt = document.createElement("canvas");
3322
+ return pt.width = Math.round(Et), pt.height = Math.round(Tt), pt.getContext("2d").drawImage(oe, Math.round(no), Math.round(oo), Math.round(Et), Math.round(Tt), 0, 0, Math.round(Et), Math.round(Tt)), pt.toDataURL("image/png");
3316
3323
  };
3317
- Lt.current && Lt.current(), await new Promise((J) => setTimeout(J, 100)), await new Promise((J) => requestAnimationFrame(() => requestAnimationFrame(J)));
3324
+ It.current && It.current(), await new Promise((J) => setTimeout(J, 100)), await new Promise((J) => requestAnimationFrame(() => requestAnimationFrame(J)));
3318
3325
  const ge = await W();
3319
3326
  L("2D"), await new Promise((J) => setTimeout(J, 200)), await new Promise((J) => requestAnimationFrame(() => requestAnimationFrame(J)));
3320
3327
  const G = await W(true);
@@ -3327,17 +3334,17 @@ let __tla = (async () => {
3327
3334
  }
3328
3335
  }, []), Ce = Q((y) => {
3329
3336
  const D = /* @__PURE__ */ new Date(), R = `${String(D.getHours()).padStart(2, "0")}:${String(D.getMinutes()).padStart(2, "0")}:${String(D.getSeconds()).padStart(2, "0")}.${String(D.getMilliseconds()).padStart(3, "0")}`;
3330
- Kt((W) => [
3337
+ Qt((W) => [
3331
3338
  ...W.slice(-200),
3332
3339
  `[${R}] ${y}`
3333
3340
  ]);
3334
- }, []), { landmarkPoints: T, clearLandmarkPoints: jn, addLandmarkPoint: Ut, removeLandmarkPoint: Jt, updateLandmarkPositions: Qt, setAligned: qt, isAligned: U, setCut: en, isCut: Dt, reset: ct } = Ht();
3341
+ }, []), { landmarkPoints: T, clearLandmarkPoints: Yn, addLandmarkPoint: en, removeLandmarkPoint: tn, updateLandmarkPositions: nn, setAligned: on, isAligned: U, setCut: rn, isCut: _t, reset: dt } = Nt();
3335
3342
  K(() => {
3336
- ct();
3343
+ dt();
3337
3344
  }, [
3338
- ct
3345
+ dt
3339
3346
  ]);
3340
- const dt = v * xt;
3347
+ const ft = v * bt;
3341
3348
  K(() => {
3342
3349
  if (!a || T.length === 0) return;
3343
3350
  const y = T[T.length - 1];
@@ -3353,32 +3360,32 @@ let __tla = (async () => {
3353
3360
  a,
3354
3361
  Ce
3355
3362
  ]), K(() => {
3356
- a && Dt && Ce("STATE: mesh cut");
3363
+ a && _t && Ce("STATE: mesh cut");
3357
3364
  }, [
3358
- Dt,
3365
+ _t,
3359
3366
  a,
3360
3367
  Ce
3361
3368
  ]), K(() => {
3362
- lt.current && (lt.current.scrollTop = lt.current.scrollHeight);
3369
+ at.current && (at.current.scrollTop = at.current.scrollHeight);
3363
3370
  }, [
3364
- Pt
3371
+ Lt
3365
3372
  ]);
3366
- const tn = H(() => xe ? new O.Mesh(xe) : null, [
3373
+ const Ue = H(() => xe ? new O.Mesh(xe) : null, [
3367
3374
  xe
3368
3375
  ]);
3369
3376
  K(() => {
3370
- o && At(o);
3377
+ o && kt(o);
3371
3378
  }, [
3372
3379
  o
3373
3380
  ]), K(() => {
3374
- o || At(void 0);
3381
+ o || kt(void 0);
3375
3382
  }, [
3376
3383
  v
3377
3384
  ]);
3378
- const ft = le(false);
3385
+ const ut = ie(false);
3379
3386
  K(() => {
3380
- if (!U || j.length === 0 || ft.current || !c) return;
3381
- ft.current = true;
3387
+ if (!U || j.length === 0 || ut.current || !c) return;
3388
+ ut.current = true;
3382
3389
  const y = T.length >= 3 ? Math.abs(T[2].position.y - T[0].position.y) : null;
3383
3390
  c("dimensions_calculated", {
3384
3391
  spacing_type: P,
@@ -3399,11 +3406,11 @@ let __tla = (async () => {
3399
3406
  U,
3400
3407
  j
3401
3408
  ]), K(() => {
3402
- l !== void 0 && (Ne.current = l), Hn(true);
3409
+ l !== void 0 && (Ne.current = l), jn(true);
3403
3410
  }, [
3404
3411
  l
3405
3412
  ]);
3406
- const et = Q((y, D) => {
3413
+ const tt = Q((y, D) => {
3407
3414
  y.computeBoundingBox();
3408
3415
  const R = y.boundingBox, W = new M();
3409
3416
  R.getCenter(W), y.translate(-W.x, -W.y, -W.z), y.computeBoundingBox();
@@ -3413,7 +3420,7 @@ let __tla = (async () => {
3413
3420
  color: 8947848,
3414
3421
  side: O.DoubleSide
3415
3422
  }));
3416
- m(J), fe(D), ee(true), pe(false), at.current = false;
3423
+ m(J), fe(D), ee(true), pe(false), ct.current = false;
3417
3424
  }, []), Oe = Q(async (y, D) => {
3418
3425
  De(null);
3419
3426
  const R = D.toLowerCase(), W = R.endsWith(".stl");
@@ -3421,7 +3428,7 @@ let __tla = (async () => {
3421
3428
  De("Unsupported file format. Please use OBJ or STL.");
3422
3429
  return;
3423
3430
  }
3424
- Xt(W ? "stl" : "obj"), p(true), b("Processing file..."), Ce(`FILE_LOAD: ${D} (${W ? "STL" : "OBJ"})`);
3431
+ Kt(W ? "stl" : "obj"), p(true), b("Processing file..."), Ce(`FILE_LOAD: ${D} (${W ? "STL" : "OBJ"})`);
3425
3432
  try {
3426
3433
  let G;
3427
3434
  if (W) if (b("Converting STL..."), y instanceof ArrayBuffer) {
@@ -3430,27 +3437,27 @@ let __tla = (async () => {
3430
3437
  ]), Fe = new File([
3431
3438
  te
3432
3439
  ], D);
3433
- G = await Tt(Fe);
3440
+ G = await $t(Fe);
3434
3441
  } else {
3435
3442
  const te = new Blob([
3436
3443
  y
3437
3444
  ]), Fe = new File([
3438
3445
  te
3439
3446
  ], D);
3440
- G = await Tt(Fe);
3447
+ G = await $t(Fe);
3441
3448
  }
3442
3449
  else G = typeof y == "string" ? y : new TextDecoder().decode(y);
3443
- const J = performance.now(), oe = Ne.current ? await yo(G, Ne.current, (te) => {
3450
+ const J = performance.now(), oe = Ne.current ? await So(G, Ne.current, (te) => {
3444
3451
  b(te), Ce(`PREPROCESS: ${te}`);
3445
3452
  }) : null;
3446
- if (oe) Ce(`PREPROCESS: done in ${(performance.now() - J).toFixed(0)}ms \u2014 unit=${oe.detectedUnit}, scaled=${oe.wasScaled}`), t.showAmputationModal && !r ? (C(oe), z(true)) : et(oe.geometry, oe.wasScaled);
3453
+ if (oe) Ce(`PREPROCESS: done in ${(performance.now() - J).toFixed(0)}ms \u2014 unit=${oe.detectedUnit}, scaled=${oe.wasScaled}`), t.showAmputationModal && !r ? (C(oe), z(true)) : tt(oe.geometry, oe.wasScaled);
3447
3454
  else {
3448
3455
  b("Using fallback loader...");
3449
- const te = wo(G);
3456
+ const te = vo(G);
3450
3457
  te ? t.showAmputationModal && !r ? (C({
3451
3458
  geometry: te,
3452
3459
  wasScaled: false
3453
- }), z(true)) : et(te, false) : De("Failed to parse the mesh.");
3460
+ }), z(true)) : tt(te, false) : De("Failed to parse the mesh.");
3454
3461
  }
3455
3462
  } catch (G) {
3456
3463
  De(G instanceof Error ? G.message : "Failed to process the mesh file.");
@@ -3461,7 +3468,7 @@ let __tla = (async () => {
3461
3468
  Te,
3462
3469
  t.showAmputationModal,
3463
3470
  r,
3464
- et
3471
+ tt
3465
3472
  ]);
3466
3473
  K(() => {
3467
3474
  if (!n || !Te) return;
@@ -3486,11 +3493,11 @@ let __tla = (async () => {
3486
3493
  n,
3487
3494
  Te
3488
3495
  ]);
3489
- const Nn = Q((y) => {
3496
+ const Xn = Q((y) => {
3490
3497
  y.preventDefault(), x(true);
3491
- }, []), Yn = Q((y) => {
3498
+ }, []), Gn = Q((y) => {
3492
3499
  y.preventDefault(), x(false);
3493
- }, []), Xn = Q(async (y) => {
3500
+ }, []), Zn = Q(async (y) => {
3494
3501
  if (y.preventDefault(), x(false), !Te) {
3495
3502
  De("WASM module is still loading. Please wait.");
3496
3503
  return;
@@ -3503,9 +3510,9 @@ let __tla = (async () => {
3503
3510
  return;
3504
3511
  }
3505
3512
  if (R.endsWith(".stl")) {
3506
- Xt("stl"), p(true), b("Converting STL...");
3513
+ Kt("stl"), p(true), b("Converting STL...");
3507
3514
  try {
3508
- const W = await Tt(D);
3515
+ const W = await $t(D);
3509
3516
  await Oe(W, D.name.replace(/\.stl$/i, ".obj"));
3510
3517
  } catch (W) {
3511
3518
  De(W instanceof Error ? W.message : "Failed to process STL file."), p(false), b("");
@@ -3517,22 +3524,22 @@ let __tla = (async () => {
3517
3524
  }, [
3518
3525
  Te,
3519
3526
  Oe
3520
- ]), Gn = Q((y) => {
3521
- I(y), k(y === "AK" ? 2 : 1), z(false), h && (et(h.geometry, h.wasScaled), C(null)), c == null ? void 0 : c("file_loaded", {
3527
+ ]), Kn = Q((y) => {
3528
+ I(y), k(y === "AK" ? 2 : 1), z(false), h && (tt(h.geometry, h.wasScaled), C(null)), c == null ? void 0 : c("file_loaded", {
3522
3529
  spacing_type: y,
3523
3530
  file_format: Ve,
3524
3531
  is_double_wall: false
3525
3532
  });
3526
3533
  }, [
3527
3534
  h,
3528
- et,
3535
+ tt,
3529
3536
  c,
3530
3537
  Ve
3531
3538
  ]);
3532
3539
  K(() => {
3533
- if (!e || T.length !== 1 || !Ne.current || at.current) return;
3534
- at.current = true;
3535
- const y = T[0], D = Ne.current, R = e.geometry, { positions: W, indices: ge } = bt(R), G = new Float32Array([
3540
+ if (!e || T.length !== 1 || !Ne.current || ct.current) return;
3541
+ ct.current = true;
3542
+ const y = T[0], D = Ne.current, R = e.geometry, { positions: W, indices: ge } = yt(R), G = new Float32Array([
3536
3543
  y.position.x,
3537
3544
  y.position.y,
3538
3545
  y.position.z
@@ -3543,7 +3550,7 @@ let __tla = (async () => {
3543
3550
  T,
3544
3551
  Ce
3545
3552
  ]);
3546
- const Zn = Q(() => {
3553
+ const Un = Q(() => {
3547
3554
  if (!e || T.length < 2) return;
3548
3555
  Y(true), ye("Please wait..."), Ce("PIPELINE: starting processing pipeline...");
3549
3556
  const y = performance.now();
@@ -3553,26 +3560,26 @@ let __tla = (async () => {
3553
3560
  T[0],
3554
3561
  ...T.slice(2)
3555
3562
  ];
3556
- zo(e, D, xt, {
3563
+ ko(e, D, bt, {
3557
3564
  onStatus: (R) => {
3558
3565
  ye(R), Ce(`PIPELINE: ${R}`);
3559
3566
  },
3560
- addLandmarkPoint: Ut,
3561
- removeLandmarkPoint: Jt,
3567
+ addLandmarkPoint: en,
3568
+ removeLandmarkPoint: tn,
3562
3569
  updateLandmarkPositions: (R) => {
3563
3570
  const W = [
3564
3571
  R[1],
3565
3572
  R[0],
3566
3573
  ...R.slice(2)
3567
3574
  ];
3568
- Qt(W);
3575
+ nn(W);
3569
3576
  },
3570
- setAligned: qt,
3571
- setCut: en,
3577
+ setAligned: on,
3578
+ setCut: rn,
3572
3579
  setModelSize: f,
3573
- setOriginalEndY: Vt,
3574
- setAdjustedStartY: se,
3575
- setAdjustedEndY: vt,
3580
+ setOriginalEndY: Yt,
3581
+ setAdjustedStartY: le,
3582
+ setAdjustedEndY: Ct,
3576
3583
  setError: De,
3577
3584
  setDoubleShell: (R) => {
3578
3585
  ue(R), re(true);
@@ -3584,19 +3591,19 @@ let __tla = (async () => {
3584
3591
  setMeasurementGeometry: Se,
3585
3592
  setWasmSlices: Pe,
3586
3593
  wasmModule: Ne.current ?? void 0
3587
- }), Ce(`PIPELINE: completed in ${(performance.now() - y).toFixed(0)}ms`), ft.current = false, Y(false);
3594
+ }), Ce(`PIPELINE: completed in ${(performance.now() - y).toFixed(0)}ms`), ut.current = false, Y(false);
3588
3595
  }, 50);
3589
3596
  }, [
3590
3597
  e,
3591
3598
  T,
3592
- Qt,
3593
- qt,
3594
- Ut,
3595
- Jt,
3599
+ nn,
3600
+ on,
3596
3601
  en,
3602
+ tn,
3603
+ rn,
3597
3604
  Z
3598
- ]), _t = le(false), Kn = Q(async () => {
3599
- if (ct(), N([]), Pe(null), Se(null), se(null), vt(null), Nt(null), Vt(null), rt(false), Gt(false), kt(true), ue(false), pe(false), at.current = false, _t.current = false, ft.current = false, L("3D"), n && Te) {
3605
+ ]), Rt = ie(false), Jn = Q(async () => {
3606
+ if (dt(), N([]), Pe(null), Se(null), le(null), Ct(null), Gt(null), Yt(null), it(false), Ut(false), Ft(true), ue(false), pe(false), ct.current = false, Rt.current = false, ut.current = false, L("3D"), n && Te) {
3600
3607
  m(null);
3601
3608
  try {
3602
3609
  const y = await fetch(n);
@@ -3611,15 +3618,15 @@ let __tla = (async () => {
3611
3618
  n,
3612
3619
  Te,
3613
3620
  Oe,
3614
- ct
3621
+ dt
3615
3622
  ]);
3616
3623
  K(() => {
3617
- U && j.length > 0 && !_t.current && (_t.current = true, rt(true));
3624
+ U && j.length > 0 && !Rt.current && (Rt.current = true, it(true));
3618
3625
  }, [
3619
3626
  U,
3620
3627
  j.length
3621
3628
  ]);
3622
- const tt = H(() => {
3629
+ const nt = H(() => {
3623
3630
  var _a;
3624
3631
  if (!e || T.length < 3) return 0;
3625
3632
  if (X) return Math.abs(T[0].position.y - T[2].position.y);
@@ -3631,15 +3638,16 @@ let __tla = (async () => {
3631
3638
  e,
3632
3639
  T,
3633
3640
  X
3634
- ]), Un = Q((y) => {
3635
- Wn(y), At(y.circumferences), kt(true), Gt(true);
3636
- }, []), nn = Q(async (y) => {
3641
+ ]), Qn = Q((y) => {
3642
+ En(y), kt(y.circumferences), Ft(true), Ut(true);
3643
+ }, []), sn = Q(async (y) => {
3637
3644
  if (!s) return;
3645
+ it(false), Pt(false), lt(true);
3638
3646
  const D = e ? await Promise.race([
3639
- qe(),
3647
+ et(),
3640
3648
  new Promise((R) => setTimeout(() => R(void 0), 8e3))
3641
- ]) : void 0;
3642
- rt(false), Ft(false), st(true);
3649
+ ]).catch(() => {
3650
+ }) : void 0;
3643
3651
  try {
3644
3652
  s({
3645
3653
  spacingType: P ?? "BK",
@@ -3650,7 +3658,7 @@ let __tla = (async () => {
3650
3658
  isUnitConverted: false,
3651
3659
  formMeasurements: ve,
3652
3660
  scanMeasurements: j,
3653
- frontalHeight: tt,
3661
+ frontalHeight: nt,
3654
3662
  transverseML: 0,
3655
3663
  transverseAP: 0,
3656
3664
  scanUrl: n,
@@ -3659,7 +3667,7 @@ let __tla = (async () => {
3659
3667
  screenshots: D
3660
3668
  });
3661
3669
  } finally {
3662
- st(false);
3670
+ lt(false);
3663
3671
  }
3664
3672
  }, [
3665
3673
  s,
@@ -3669,22 +3677,36 @@ let __tla = (async () => {
3669
3677
  X,
3670
3678
  ve,
3671
3679
  j,
3672
- tt,
3680
+ nt,
3673
3681
  n,
3674
- qe
3675
- ]), Rt = Q(async (y) => {
3682
+ et
3683
+ ]), Wt = ie(null);
3684
+ K(() => {
3685
+ if (!e || !U) {
3686
+ Wt.current = null;
3687
+ return;
3688
+ }
3689
+ const y = (Ue ?? e).geometry;
3690
+ Wt.current = jt(y);
3691
+ }, [
3692
+ e,
3693
+ U,
3694
+ Ue
3695
+ ]);
3696
+ const Bt = Q(async (y) => {
3676
3697
  if (!s || !e || j.length === 0 || !P) return;
3698
+ lt(true);
3677
3699
  const D = await Promise.race([
3678
- qe(),
3700
+ et(),
3679
3701
  new Promise((R) => setTimeout(() => R(void 0), 8e3))
3680
- ]);
3681
- st(true);
3702
+ ]).catch(() => {
3703
+ });
3682
3704
  try {
3683
3705
  let R = 0, W = 0;
3684
3706
  if (T.length >= 2) {
3685
- const ge = e.geometry, J = T[0].position.y;
3707
+ const ge = (Ue ?? e).geometry, J = T[0].position.y;
3686
3708
  try {
3687
- const oe = Mn(ge), te = Ge(oe, ge, J);
3709
+ const oe = Wt.current ?? jt(ge), te = Ge(oe, ge, J);
3688
3710
  if (te.linePoints.length >= 2) {
3689
3711
  let Fe = te.linePoints[0], Be = te.linePoints[0], Me = te.linePoints[0], Ae = te.linePoints[0];
3690
3712
  for (const be of te.linePoints) be.x < Fe.x && (Fe = be), be.x > Be.x && (Be = be), be.z < Me.z && (Me = be), be.z > Ae.z && (Ae = be);
@@ -3702,20 +3724,21 @@ let __tla = (async () => {
3702
3724
  isUnitConverted: false,
3703
3725
  formMeasurements: ve,
3704
3726
  scanMeasurements: j,
3705
- frontalHeight: (Qe == null ? void 0 : Qe.frontalHeight) ?? tt,
3727
+ frontalHeight: (qe == null ? void 0 : qe.frontalHeight) ?? nt,
3706
3728
  transverseML: R,
3707
3729
  transverseAP: W,
3708
3730
  scanUrl: n,
3709
3731
  decision: y,
3710
- userEnteredMeasurements: Qe ?? void 0,
3732
+ userEnteredMeasurements: qe ?? void 0,
3711
3733
  screenshots: D
3712
3734
  });
3713
3735
  } finally {
3714
- st(false);
3736
+ lt(false);
3715
3737
  }
3716
3738
  }, [
3717
3739
  s,
3718
3740
  e,
3741
+ Ue,
3719
3742
  j,
3720
3743
  P,
3721
3744
  T,
@@ -3723,10 +3746,10 @@ let __tla = (async () => {
3723
3746
  X,
3724
3747
  ve,
3725
3748
  n,
3726
- Qe,
3727
- tt,
3728
- qe
3729
- ]), Jn = H(() => {
3749
+ qe,
3750
+ nt,
3751
+ et
3752
+ ]), qn = H(() => {
3730
3753
  if (!ve || j.length === 0) return false;
3731
3754
  const y = Math.min(ve.length, j.length);
3732
3755
  if (y === 0) return false;
@@ -3740,7 +3763,7 @@ let __tla = (async () => {
3740
3763
  }, [
3741
3764
  ve,
3742
3765
  j
3743
- ]), Qn = it ? 5 : U && je || U ? 4 : e ? T.length === 0 ? 2 : 3 : 1, qn = [
3766
+ ]), eo = st ? 5 : U && je || U ? 4 : e ? T.length === 0 ? 2 : 3 : 1, to = [
3744
3767
  {
3745
3768
  label: "Load File",
3746
3769
  number: 1
@@ -3762,7 +3785,7 @@ let __tla = (async () => {
3762
3785
  number: 5
3763
3786
  }
3764
3787
  ];
3765
- return F(ho.Provider, {
3788
+ return F(mo.Provider, {
3766
3789
  value: t,
3767
3790
  children: [
3768
3791
  F("div", {
@@ -3794,9 +3817,9 @@ let __tla = (async () => {
3794
3817
  }
3795
3818
  })
3796
3819
  }),
3797
- i(No, {
3798
- steps: qn,
3799
- currentStep: Qn
3820
+ i(Xo, {
3821
+ steps: to,
3822
+ currentStep: eo
3800
3823
  }),
3801
3824
  F("div", {
3802
3825
  style: {
@@ -3821,30 +3844,30 @@ let __tla = (async () => {
3821
3844
  borderRight: "1px solid #e0e0e0",
3822
3845
  overflow: "hidden"
3823
3846
  },
3824
- children: i(Qo, {
3847
+ children: i(er, {
3825
3848
  amputationType: P,
3826
3849
  spacingInches: v,
3827
3850
  scanMeasurements: j,
3828
- scanFrontalHeight: tt,
3829
- onSave: Un,
3830
- onSkip: nn,
3831
- onFormChange: En,
3832
- onHeightChange: On,
3851
+ scanFrontalHeight: nt,
3852
+ onSave: Qn,
3853
+ onSkip: sn,
3854
+ onFormChange: On,
3855
+ onHeightChange: Hn,
3833
3856
  initialValues: ve,
3834
- initialFrontalHeight: Qe == null ? void 0 : Qe.frontalHeight
3857
+ initialFrontalHeight: qe == null ? void 0 : qe.frontalHeight
3835
3858
  })
3836
3859
  }),
3837
3860
  F("div", {
3838
- ref: It,
3861
+ ref: Dt,
3839
3862
  style: {
3840
3863
  flex: 1,
3841
3864
  position: "relative",
3842
3865
  minHeight: 0,
3843
3866
  overflow: "hidden"
3844
3867
  },
3845
- onDragOver: t.showDragDrop ? Nn : void 0,
3846
- onDragLeave: t.showDragDrop ? Yn : void 0,
3847
- onDrop: t.showDragDrop ? Xn : void 0,
3868
+ onDragOver: t.showDragDrop ? Xn : void 0,
3869
+ onDragLeave: t.showDragDrop ? Gn : void 0,
3870
+ onDrop: t.showDragDrop ? Zn : void 0,
3848
3871
  children: [
3849
3872
  t.showDragDrop && !e && !S && i("div", {
3850
3873
  style: {
@@ -3895,7 +3918,7 @@ let __tla = (async () => {
3895
3918
  ]
3896
3919
  })
3897
3920
  }),
3898
- !t.showDragDrop && !e && !S && !zt && i("div", {
3921
+ !t.showDragDrop && !e && !S && !At && i("div", {
3899
3922
  style: {
3900
3923
  position: "absolute",
3901
3924
  inset: 0,
@@ -3996,14 +4019,14 @@ let __tla = (async () => {
3996
4019
  "Click mesh to set Origin"
3997
4020
  ]
3998
4021
  }),
3999
- S && i(cn, {
4022
+ S && i(un, {
4000
4023
  message: g || "Processing mesh..."
4001
4024
  }),
4002
- V && i(cn, {
4025
+ V && i(un, {
4003
4026
  message: q
4004
4027
  }),
4005
- zt && i(ko, {
4006
- message: zt,
4028
+ At && i(Po, {
4029
+ message: At,
4007
4030
  onDismiss: () => De(null)
4008
4031
  }),
4009
4032
  t.showAmputationModal && w && i("div", {
@@ -4137,7 +4160,7 @@ let __tla = (async () => {
4137
4160
  children: "Cancel"
4138
4161
  }),
4139
4162
  i("button", {
4140
- onClick: () => P && Gn(P),
4163
+ onClick: () => P && Kn(P),
4141
4164
  disabled: !P,
4142
4165
  style: {
4143
4166
  padding: "6px 16px",
@@ -4169,8 +4192,8 @@ let __tla = (async () => {
4169
4192
  zIndex: 10
4170
4193
  }
4171
4194
  }),
4172
- i(Ao, {
4173
- children: F(lo, {
4195
+ i(Fo, {
4196
+ children: F(co, {
4174
4197
  camera: {
4175
4198
  position: [
4176
4199
  0,
@@ -4217,15 +4240,15 @@ let __tla = (async () => {
4217
4240
  ],
4218
4241
  intensity: 0.2
4219
4242
  }),
4220
- e && A === "3D" && i(Po, {
4243
+ e && A === "3D" && i(Io, {
4221
4244
  mesh: e,
4222
4245
  maxPoints: 2,
4223
- meshColor: Zt,
4224
- meshOpacity: We ? 0.3 : $n,
4246
+ meshColor: Jt,
4247
+ meshOpacity: We ? 0.3 : Vn,
4225
4248
  frontFaceOnly: Z,
4226
4249
  doubleShellTransparency: X && U
4227
4250
  }),
4228
- e && A === "3D" && i(Io, {
4251
+ e && A === "3D" && i(_o, {
4229
4252
  modelSize: d,
4230
4253
  labels: [
4231
4254
  P === "AK" ? "IT" : "MPT",
@@ -4233,95 +4256,95 @@ let __tla = (async () => {
4233
4256
  "Cut Plane"
4234
4257
  ]
4235
4258
  }),
4236
- i($o, {
4259
+ i(Vo, {
4237
4260
  modelSize: d,
4238
4261
  isAligned: U,
4239
- isCut: Dt,
4262
+ isCut: _t,
4240
4263
  mesh: e,
4241
4264
  viewMode: A,
4242
- sliceY: U && T.length >= 2 ? ke ?? Ct ?? T[0].position.y : void 0,
4265
+ sliceY: U && T.length >= 2 ? ke ?? Mt ?? T[0].position.y : void 0,
4243
4266
  landmarkCount: T.length,
4244
4267
  measurementGeometry: xe,
4245
- resetCameraToFrontRef: Lt
4268
+ resetCameraToFrontRef: It
4246
4269
  }),
4247
- !U && i(mn, {
4270
+ !U && i(yn, {
4248
4271
  enableDamping: false
4249
4272
  }),
4250
- U && j.length > 0 && e && A === "3D" && i(Ho, {
4273
+ U && j.length > 0 && e && A === "3D" && i(jo, {
4251
4274
  mesh: e,
4252
- isDragging: In
4275
+ isDragging: _n
4253
4276
  }),
4254
4277
  e && U && T.length >= 3 && (() => {
4255
4278
  const D = e.geometry.getIndex();
4256
4279
  if (!D || D.count < 30) return null;
4257
- const R = T[2], W = T[0], ge = Ke ?? R.position.y, G = ke ?? Ct ?? W.position.y;
4258
- return A === "2D" ? i(Yo, {
4259
- mesh: tn ?? e,
4280
+ const R = T[2], W = T[0], ge = Ke ?? R.position.y, G = ke ?? Mt ?? W.position.y;
4281
+ return A === "2D" ? i(Go, {
4282
+ mesh: Ue ?? e,
4260
4283
  upperY: G,
4261
4284
  originY: W.position.y,
4262
4285
  modelSize: d,
4263
- meshColor: Zt,
4286
+ meshColor: Jt,
4264
4287
  displayUnit: _
4265
4288
  }) : F(He, {
4266
4289
  children: [
4267
- i(Eo, {
4268
- mesh: tn ?? e,
4290
+ i(Oo, {
4291
+ mesh: Ue ?? e,
4269
4292
  startY: ge,
4270
4293
  endY: G,
4271
- spacing: dt,
4294
+ spacing: ft,
4272
4295
  modelSize: d,
4273
4296
  onMeasurementsChange: N,
4274
4297
  reverseOrder: true,
4275
4298
  displayUnit: _,
4276
4299
  useInnerSurface: X && !Z,
4277
- formMeasurements: je ? Bn ?? ve : Je ? ve : void 0,
4278
- originY: Mt ?? W.position.y,
4300
+ formMeasurements: je ? Tn ?? ve : Qe ? ve : void 0,
4301
+ originY: zt ?? W.position.y,
4279
4302
  wasmSlices: Ie
4280
4303
  }),
4281
- i(Oo, {
4304
+ i(Ho, {
4282
4305
  mesh: e,
4283
- greenY: Mt ?? W.position.y,
4306
+ greenY: zt ?? W.position.y,
4284
4307
  modelSize: d,
4285
4308
  displayUnit: _,
4286
4309
  bottomY: X ? R.position.y : void 0,
4287
- formHeight: je ? Tn : Je ? Qe == null ? void 0 : Qe.frontalHeight : void 0
4310
+ formHeight: je ? $n : Qe ? qe == null ? void 0 : qe.frontalHeight : void 0
4288
4311
  }),
4289
- i(Xo, {
4312
+ i(Zo, {
4290
4313
  mesh: e,
4291
- yPosition: Mt ?? W.position.y,
4314
+ yPosition: zt ?? W.position.y,
4292
4315
  onYChange: (J) => {
4293
- Nt(J), Pe(null);
4316
+ Gt(J), Pe(null);
4294
4317
  const oe = J - W.position.y;
4295
- vt((Ct ?? W.position.y + dt * 2) + oe);
4318
+ Ct((Mt ?? W.position.y + ft * 2) + oe);
4296
4319
  },
4297
- minY: W.position.y - dt,
4298
- maxY: W.position.y + dt,
4320
+ minY: W.position.y - ft,
4321
+ maxY: W.position.y + ft,
4299
4322
  modelSize: d,
4300
4323
  color: "#44ff44",
4301
4324
  hoverColor: "#88ff88",
4302
4325
  dragColor: "#ffffff",
4303
4326
  label: P === "AK" ? "IT" : "MPT",
4304
- onDragStart: () => jt(true),
4305
- onDragEnd: () => jt(false)
4327
+ onDragStart: () => Xt(true),
4328
+ onDragEnd: () => Xt(false)
4306
4329
  })
4307
4330
  ]
4308
4331
  });
4309
4332
  })(),
4310
- e && U && A === "3D" && We && i(fr, {
4333
+ e && U && A === "3D" && We && i(pr, {
4311
4334
  mesh: e
4312
4335
  }),
4313
- e && t.showDebug && We && A === "3D" && i(dr, {
4336
+ e && t.showDebug && We && A === "3D" && i(ur, {
4314
4337
  mesh: e,
4315
4338
  modelSize: d,
4316
- layers: Yt,
4339
+ layers: Zt,
4317
4340
  landmarkPoints: T,
4318
4341
  componentDebug: null,
4319
4342
  aoData: me,
4320
4343
  aoGeometry: $,
4321
4344
  measurementGeometry: xe
4322
4345
  }),
4323
- i(gr, {
4324
- screenshotFnRef: Vn,
4346
+ i(xr, {
4347
+ screenshotFnRef: Nn,
4325
4348
  mesh: e,
4326
4349
  modelSize: d,
4327
4350
  measurementGeometry: xe
@@ -4357,7 +4380,7 @@ let __tla = (async () => {
4357
4380
  children: "Start Over"
4358
4381
  }),
4359
4382
  !U && T.length >= 1 && i("button", {
4360
- onClick: jn,
4383
+ onClick: Yn,
4361
4384
  style: {
4362
4385
  padding: "6px 16px",
4363
4386
  borderRadius: 4,
@@ -4373,8 +4396,8 @@ let __tla = (async () => {
4373
4396
  },
4374
4397
  children: "Reset Points"
4375
4398
  }),
4376
- U && !it && i("button", {
4377
- onClick: Kn,
4399
+ U && !st && i("button", {
4400
+ onClick: Jn,
4378
4401
  style: {
4379
4402
  padding: "6px 16px",
4380
4403
  borderRadius: 4,
@@ -4392,9 +4415,9 @@ let __tla = (async () => {
4392
4415
  })
4393
4416
  ]
4394
4417
  }),
4395
- t.showDebug && We && e && A === "3D" && i(pr, {
4396
- layers: Yt,
4397
- onToggleLayer: (y) => _n((D) => ({
4418
+ t.showDebug && We && e && A === "3D" && i(gr, {
4419
+ layers: Zt,
4420
+ onToggleLayer: (y) => Wn((D) => ({
4398
4421
  ...D,
4399
4422
  [y]: !D[y]
4400
4423
  })),
@@ -4539,13 +4562,13 @@ let __tla = (async () => {
4539
4562
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
4540
4563
  },
4541
4564
  children: i("button", {
4542
- onClick: () => kt((y) => !y),
4565
+ onClick: () => Ft((y) => !y),
4543
4566
  style: {
4544
4567
  padding: "6px 14px",
4545
4568
  fontSize: 13,
4546
- fontWeight: Je ? 600 : 400,
4547
- backgroundColor: Je ? "rgb(12, 67, 173)" : "#fff",
4548
- color: Je ? "#fff" : "#666",
4569
+ fontWeight: Qe ? 600 : 400,
4570
+ backgroundColor: Qe ? "rgb(12, 67, 173)" : "#fff",
4571
+ color: Qe ? "#fff" : "#666",
4549
4572
  border: "none",
4550
4573
  cursor: "pointer",
4551
4574
  fontFamily: "system-ui, sans-serif"
@@ -4563,7 +4586,7 @@ let __tla = (async () => {
4563
4586
  },
4564
4587
  children: i("button", {
4565
4588
  onClick: async () => {
4566
- const y = await qe();
4589
+ const y = await et();
4567
4590
  if (!y) return;
4568
4591
  const D = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), R = (W, ge) => {
4569
4592
  const G = document.createElement("a");
@@ -4593,7 +4616,7 @@ let __tla = (async () => {
4593
4616
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
4594
4617
  },
4595
4618
  children: i("button", {
4596
- onClick: () => Dn((y) => !y),
4619
+ onClick: () => Rn((y) => !y),
4597
4620
  style: {
4598
4621
  padding: "6px 14px",
4599
4622
  fontSize: 13,
@@ -4609,11 +4632,11 @@ let __tla = (async () => {
4609
4632
  })
4610
4633
  ]
4611
4634
  }),
4612
- e && ie && i(Vo, {
4635
+ e && se && i(No, {
4613
4636
  wasAutoScaled: ae,
4614
4637
  onDismiss: () => ee(false)
4615
4638
  }),
4616
- e && we && U && i(jo, {
4639
+ e && we && U && i(Yo, {
4617
4640
  isDoubleShell: X,
4618
4641
  onDismiss: () => re(false)
4619
4642
  })
@@ -4672,7 +4695,7 @@ let __tla = (async () => {
4672
4695
  children: [
4673
4696
  !je && s && i("button", {
4674
4697
  disabled: ze,
4675
- onClick: () => Ft(true),
4698
+ onClick: () => Pt(true),
4676
4699
  style: {
4677
4700
  padding: "6px 16px",
4678
4701
  borderRadius: 4,
@@ -4696,7 +4719,7 @@ let __tla = (async () => {
4696
4719
  },
4697
4720
  children: [
4698
4721
  e && !U && T.length >= 2 && i("button", {
4699
- onClick: Zn,
4722
+ onClick: Un,
4700
4723
  style: {
4701
4724
  padding: "6px 16px",
4702
4725
  borderRadius: 4,
@@ -4712,8 +4735,8 @@ let __tla = (async () => {
4712
4735
  },
4713
4736
  children: "Next \xBB"
4714
4737
  }),
4715
- U && it && !je && i("button", {
4716
- onClick: () => rt(true),
4738
+ U && st && !je && i("button", {
4739
+ onClick: () => it(true),
4717
4740
  style: {
4718
4741
  padding: "6px 16px",
4719
4742
  borderRadius: 4,
@@ -4729,9 +4752,9 @@ let __tla = (async () => {
4729
4752
  },
4730
4753
  children: "Edit Measurements"
4731
4754
  }),
4732
- U && it && (Jn ? i("button", {
4755
+ U && st && (qn ? i("button", {
4733
4756
  disabled: ze,
4734
- onClick: () => Rt("continue"),
4757
+ onClick: () => Bt("continue"),
4735
4758
  style: {
4736
4759
  padding: "6px 16px",
4737
4760
  borderRadius: 4,
@@ -4750,7 +4773,7 @@ let __tla = (async () => {
4750
4773
  children: [
4751
4774
  i("button", {
4752
4775
  disabled: ze,
4753
- onClick: () => Rt("use_form_measurements"),
4776
+ onClick: () => Bt("use_form_measurements"),
4754
4777
  style: {
4755
4778
  padding: "6px 16px",
4756
4779
  borderRadius: 4,
@@ -4768,7 +4791,7 @@ let __tla = (async () => {
4768
4791
  }),
4769
4792
  i("button", {
4770
4793
  disabled: ze,
4771
- onClick: () => Rt("use_scan"),
4794
+ onClick: () => Bt("use_scan"),
4772
4795
  style: {
4773
4796
  padding: "6px 16px",
4774
4797
  borderRadius: 4,
@@ -4792,7 +4815,7 @@ let __tla = (async () => {
4792
4815
  })
4793
4816
  ]
4794
4817
  }),
4795
- a && Pt.length > 0 && F("div", {
4818
+ a && Lt.length > 0 && F("div", {
4796
4819
  style: {
4797
4820
  height: 120,
4798
4821
  flexShrink: 0,
@@ -4850,7 +4873,7 @@ let __tla = (async () => {
4850
4873
  ]
4851
4874
  }),
4852
4875
  i("button", {
4853
- onClick: () => Kt([]),
4876
+ onClick: () => Qt([]),
4854
4877
  style: {
4855
4878
  background: "none",
4856
4879
  border: "1px solid #30363d",
@@ -4867,14 +4890,14 @@ let __tla = (async () => {
4867
4890
  ]
4868
4891
  }),
4869
4892
  i("div", {
4870
- ref: lt,
4893
+ ref: at,
4871
4894
  style: {
4872
4895
  flex: 1,
4873
4896
  overflowY: "auto",
4874
4897
  padding: "4px 10px",
4875
4898
  lineHeight: 1.6
4876
4899
  },
4877
- children: Pt.map((y, D) => {
4900
+ children: Lt.map((y, D) => {
4878
4901
  const R = y.includes("ERROR") || y.includes("failed"), W = y.includes("warning") || y.includes("WARN"), ge = y.includes("PIPELINE:"), G = y.includes("STATE:");
4879
4902
  return i("div", {
4880
4903
  style: {
@@ -4889,21 +4912,21 @@ let __tla = (async () => {
4889
4912
  })
4890
4913
  ]
4891
4914
  }),
4892
- Rn && i(An, {
4893
- onSkip: nn,
4894
- onCancel: () => Ft(false)
4915
+ Bn && i(Fn, {
4916
+ onSkip: sn,
4917
+ onCancel: () => Pt(false)
4895
4918
  })
4896
4919
  ]
4897
4920
  });
4898
4921
  };
4899
- function gr({ screenshotFnRef: t }) {
4922
+ function xr({ screenshotFnRef: t }) {
4900
4923
  return K(() => {
4901
4924
  t.current = null;
4902
4925
  }, [
4903
4926
  t
4904
4927
  ]), null;
4905
4928
  }
4906
- Ln = function(t) {
4929
+ Dn = function(t) {
4907
4930
  const r = t === "AK" ? 2 : 1, n = [];
4908
4931
  for (let o = 2; o >= 1; o -= r) n.push(`${o}_above`);
4909
4932
  n.push("at_ref");
@@ -4922,23 +4945,23 @@ let __tla = (async () => {
4922
4945
  ]) n.push(`${o}_below`);
4923
4946
  return n;
4924
4947
  };
4925
- mt = function(t, r) {
4926
- const n = Ln(r), o = {};
4948
+ xt = function(t, r) {
4949
+ const n = Dn(r), o = {};
4927
4950
  for (let s = 0; s < Math.min(t.length, n.length); s++) {
4928
4951
  const a = t[s];
4929
4952
  a != null && !isNaN(a) && (o[n[s]] = a);
4930
4953
  }
4931
4954
  return o;
4932
4955
  };
4933
- mr = function(t, r) {
4956
+ br = function(t, r) {
4934
4957
  if (!t) return;
4935
- const o = Ln(r).map((s) => {
4958
+ const o = Dn(r).map((s) => {
4936
4959
  const a = t[s];
4937
4960
  return a ?? void 0;
4938
4961
  });
4939
4962
  if (!o.every((s) => s == null)) return o;
4940
4963
  };
4941
- kr = ({ request: t, onComplete: r, wasmModule: n }) => {
4964
+ Pr = ({ request: t, onComplete: r, wasmModule: n }) => {
4942
4965
  const [o, s] = B(null);
4943
4966
  K(() => {
4944
4967
  if (n != null) return;
@@ -4956,23 +4979,23 @@ let __tla = (async () => {
4956
4979
  }, [
4957
4980
  n
4958
4981
  ]);
4959
- const a = n ?? o, c = H(() => mr(t.form_measurements, t.spacing_type), [
4982
+ const a = n ?? o, c = H(() => br(t.form_measurements, t.spacing_type), [
4960
4983
  t.form_measurements,
4961
4984
  t.spacing_type
4962
4985
  ]), l = (e) => {
4963
4986
  var _a, _b;
4964
- const m = e.scanMeasurements.map((A) => +(A.modifiedValue ?? A.originalValue).toFixed(1)), d = mt(m, t.spacing_type);
4987
+ const m = e.scanMeasurements.map((A) => +(A.modifiedValue ?? A.originalValue).toFixed(1)), d = xt(m, t.spacing_type);
4965
4988
  let f, u;
4966
4989
  if (e.formMeasurements) {
4967
- f = mt(e.formMeasurements, t.spacing_type);
4990
+ f = xt(e.formMeasurements, t.spacing_type);
4968
4991
  const A = e.scanMeasurements.map((L, v) => {
4969
4992
  var _a2;
4970
4993
  const k = (_a2 = e.formMeasurements) == null ? void 0 : _a2[v];
4971
4994
  return k == null || isNaN(k) ? null : +((L.modifiedValue ?? L.originalValue) - k).toFixed(1);
4972
4995
  });
4973
- u = mt(A, t.spacing_type);
4996
+ u = xt(A, t.spacing_type);
4974
4997
  }
4975
- const x = e.userEnteredMeasurements ? mt(e.userEnteredMeasurements.circumferences, t.spacing_type) : void 0, S = e.decision === "use_scan" || e.decision === "continue", p = S ? d : x ?? f ?? d, g = S ? +e.frontalHeight.toFixed(1) : +(((_a = e.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? e.frontalHeight).toFixed(1), b = {
4998
+ const x = e.userEnteredMeasurements ? xt(e.userEnteredMeasurements.circumferences, t.spacing_type) : void 0, S = e.decision === "use_scan" || e.decision === "continue", p = S ? d : x ?? f ?? d, g = S ? +e.frontalHeight.toFixed(1) : +(((_a = e.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? e.frontalHeight).toFixed(1), b = {
4976
4999
  spacing_type: t.spacing_type,
4977
5000
  source_unit: "mm",
4978
5001
  file_format: e.fileFormat,
@@ -5004,8 +5027,8 @@ let __tla = (async () => {
5004
5027
  height: "100%",
5005
5028
  display: "flex"
5006
5029
  },
5007
- children: i(hr, {
5008
- config: po,
5030
+ children: i(mr, {
5031
+ config: go,
5009
5032
  spacingType: t.spacing_type,
5010
5033
  scanUrl: t.scan_url,
5011
5034
  formMeasurements: c,
@@ -5016,9 +5039,9 @@ let __tla = (async () => {
5016
5039
  };
5017
5040
  })();
5018
5041
  export {
5019
- kr as G,
5042
+ Pr as G,
5020
5043
  __tla,
5021
- mt as a,
5022
- mr as c,
5023
- Ln as g
5044
+ xt as a,
5045
+ br as c,
5046
+ Dn as g
5024
5047
  };