@solid-labs/fab-one-widget 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
1
- import { jsxs as F, jsx as i, Fragment as He } from "react/jsx-runtime";
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
- import * as O from "three";
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;
1
+ import { jsxs as F, jsx as i, Fragment as We } from "react/jsx-runtime";
2
+ import { createContext as $n, Component as Hn, useCallback as J, useMemo as j, useState as R, memo as jn, useEffect as U, useRef as re, forwardRef as Vn, createElement as Yt } from "react";
3
+ import { useFrame as en, useThree as tn, Canvas as Nn } from "@react-three/fiber";
4
+ import { Html as Oe, Line as ae, OrbitControls as nn } from "@react-three/drei";
5
+ import * as $ from "three";
6
+ import { Plane as dt, Vector3 as z, Box3 as on, Line3 as rn, Raycaster as Gn } from "three";
7
+ import { create as Yn } from "zustand";
8
+ import { OBJLoader as sn } from "three/examples/jsm/loaders/OBJLoader.js";
9
+ import { STLLoader as Xn } from "three/examples/jsm/loaders/STLLoader.js";
10
+ import { MeshBVH as ft } from "three-mesh-bvh";
11
+ let cr, lt, qo, mn;
12
12
  let __tla = (async () => {
13
- const ho = {
13
+ const Zn = {
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
- }, go = {
22
+ }, Kn = {
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
- }, mo = io(ho), Nt = uo((t, r) => ({
31
+ }, Un = $n(Zn), _t = Yn((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
- })), xo = 0.45, vt = 3, Vt = 1e-3, bt = 25.4, bo = [
67
+ })), Jn = 0.45, ut = 3, Lt = 1e-3, at = 25.4, Qn = [
68
68
  0.25,
69
69
  -0.25,
70
70
  0.5,
71
71
  -0.5
72
72
  ];
73
- function yo(t) {
73
+ function qn(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,68 +90,68 @@ let __tla = (async () => {
90
90
  colors: new Float32Array(s)
91
91
  } : null;
92
92
  }
93
- function wo(t, r, n, o) {
93
+ function eo(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
- for (let _ = 0; _ < l; _++) {
97
- const E = r[_ * 3] * o, V = r[_ * 3 + 1] * o, Y = r[_ * 3 + 2] * o;
96
+ for (let D = 0; D < l; D++) {
97
+ const E = r[D * 3] * o, V = r[D * 3 + 1] * o, Y = r[D * 3 + 2] * o;
98
98
  E < e && (e = E), E > f && (f = E), V < m && (m = V), V > u && (u = V), Y < d && (d = Y), Y > x && (x = Y);
99
99
  }
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
- for (let _ = 0; _ < l; _++) {
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 se = I.get(fe);
104
- se || (se = [], I.set(fe, se)), se.push(_);
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, P = x - d + 1e-6, v = b * 0.5, k = A * 0.5, w = P * 0.5, M = Math.min(128, Math.max(16, Math.round(Math.cbrt(l)))), h = b / M, C = A / M, L = P / M, _ = /* @__PURE__ */ new Map();
101
+ for (let D = 0; D < l; D++) {
102
+ const E = r[D * 3] * o - S, V = r[D * 3 + 1] * o - p, Y = r[D * 3 + 2] * o - g, Q = Math.min(M - 1, Math.max(0, Math.floor((E + v) / h))), me = Math.min(M - 1, Math.max(0, Math.floor((V + k) / C))), ie = Math.min(M - 1, Math.max(0, Math.floor((Y + w) / L))), ce = Q * M * M + me * M + ie;
103
+ let ne = _.get(ce);
104
+ ne || (ne = [], _.set(ce, ne)), ne.push(D);
105
105
  }
106
- for (let _ = 0; _ < a; _++) {
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, se = 0;
109
- for (let ee = 0; ee <= z && fe > 0; ee++) {
110
- for (let X = -ee; X <= ee; X++) for (let ue = -ee; ue <= ee; ue++) for (let Z = -ee; Z <= ee; Z++) {
111
- if (ee > 0 && Math.abs(X) < ee && Math.abs(ue) < ee && Math.abs(Z) < ee) continue;
112
- const pe = q + X, me = ye + ue, he = ae + Z;
113
- if (pe < 0 || pe >= z || me < 0 || me >= z || he < 0 || he >= z) continue;
114
- const $ = I.get(pe * z * z + me * z + he);
115
- if ($) for (const ne of $) {
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, se = ne);
106
+ for (let D = 0; D < a; D++) {
107
+ const E = s.getX(D), V = s.getY(D), Y = s.getZ(D), Q = Math.min(M - 1, Math.max(0, Math.floor((E + v) / h))), me = Math.min(M - 1, Math.max(0, Math.floor((V + k) / C))), ie = Math.min(M - 1, Math.max(0, Math.floor((Y + w) / L)));
108
+ let ce = 1 / 0, ne = 0;
109
+ for (let q = 0; q <= M && ce > 0; q++) {
110
+ for (let X = -q; X <= q; X++) for (let de = -q; de <= q; de++) for (let Z = -q; Z <= q; Z++) {
111
+ if (q > 0 && Math.abs(X) < q && Math.abs(de) < q && Math.abs(Z) < q) continue;
112
+ const fe = Q + X, he = me + de, ue = ie + Z;
113
+ if (fe < 0 || fe >= M || he < 0 || he >= M || ue < 0 || ue >= M) continue;
114
+ const H = _.get(fe * M * M + he * M + ue);
115
+ if (H) for (const ee of H) {
116
+ const ge = r[ee * 3] * o - S, ye = r[ee * 3 + 1] * o - p, xe = r[ee * 3 + 2] * o - g, te = (E - ge) ** 2 + (V - ye) ** 2 + (Y - xe) ** 2;
117
+ te < ce && (ce = te, ne = ee);
118
118
  }
119
119
  }
120
- if (fe < 1 / 0) break;
120
+ if (ce < 1 / 0) break;
121
121
  }
122
- c[_ * 3] = n[se * 3], c[_ * 3 + 1] = n[se * 3 + 1], c[_ * 3 + 2] = n[se * 3 + 2];
122
+ c[D * 3] = n[ne * 3], c[D * 3 + 1] = n[ne * 3 + 1], c[D * 3 + 2] = n[ne * 3 + 2];
123
123
  }
124
- t.setAttribute("color", new O.Float32BufferAttribute(c, 3));
124
+ t.setAttribute("color", new $.Float32BufferAttribute(c, 3));
125
125
  }
126
- const dn = {
126
+ const Xt = {
127
127
  debug: 0,
128
128
  info: 1,
129
129
  warn: 2,
130
130
  error: 3
131
131
  };
132
- let Cn = "warn", Mn = null;
133
- const ce = {
132
+ let ln = "warn", an = null;
133
+ const le = {
134
134
  setLevel(t) {
135
- Cn = t;
135
+ ln = t;
136
136
  },
137
137
  setHandler(t) {
138
- Mn = t;
138
+ an = t;
139
139
  },
140
140
  debug(t, r, n) {
141
- gt("debug", t, r, n);
141
+ it("debug", t, r, n);
142
142
  },
143
143
  info(t, r, n) {
144
- gt("info", t, r, n);
144
+ it("info", t, r, n);
145
145
  },
146
146
  warn(t, r, n) {
147
- gt("warn", t, r, n);
147
+ it("warn", t, r, n);
148
148
  },
149
149
  error(t, r, n) {
150
- gt("error", t, r, n);
150
+ it("error", t, r, n);
151
151
  }
152
152
  };
153
- function gt(t, r, n, o) {
154
- if (dn[t] < dn[Cn]) return;
153
+ function it(t, r, n, o) {
154
+ if (Xt[t] < Xt[ln]) 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
- Mn == null ? void 0 : Mn(t, r, n, o);
177
+ an == null ? void 0 : an(t, r, n, o);
178
178
  }
179
- function yt(t) {
179
+ function ct(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,32 +189,32 @@ let __tla = (async () => {
189
189
  indices: a
190
190
  };
191
191
  }
192
- function zn(t, r) {
193
- const n = new O.BufferGeometry();
194
- return n.setAttribute("position", new O.Float32BufferAttribute(t, 3)), n.setIndex(new O.BufferAttribute(r, 1)), n.computeVertexNormals(), n;
192
+ function cn(t, r) {
193
+ const n = new $.BufferGeometry();
194
+ return n.setAttribute("position", new $.Float32BufferAttribute(t, 3)), n.setIndex(new $.BufferAttribute(r, 1)), n.computeVertexNormals(), n;
195
195
  }
196
- async function So(t, r, n) {
196
+ async function to(t, r, n) {
197
197
  try {
198
- const o = yo(t);
198
+ const o = qn(t);
199
199
  n == null ? void 0 : n("Parsing mesh...");
200
- const a = new vn().parse(t);
200
+ const a = new sn().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 } = yt(c);
206
- if (l.length < 9 || e.length < 3) return ce.warn("wasm", `Mesh too small: positions=${l.length} indices=${e.length}`), null;
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;
205
+ const { positions: l, indices: e } = ct(c);
206
+ if (l.length < 9 || e.length < 3) return le.warn("wasm", `Mesh too small: positions=${l.length} indices=${e.length}`), null;
207
+ for (let b = 0; b < Math.min(l.length, 300); b++) if (!isFinite(l[b])) return le.error("wasm", `Invalid position data: NaN/Infinity at index ${b}`), null;
208
208
  const m = l.length / 3;
209
- for (let b = 0; b < Math.min(e.length, 300); b++) if (e[b] >= m) return ce.error("wasm", `Out-of-bounds index: ${e[b]} >= ${m}`), null;
209
+ for (let b = 0; b < Math.min(e.length, 300); b++) if (e[b] >= m) return le.error("wasm", `Out-of-bounds index: ${e[b]} >= ${m}`), null;
210
210
  n == null ? void 0 : n("Processing mesh (WASM)...");
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
- if (ce.debug("wasm", "preprocess result", p), f.length === 0) return null;
212
+ if (le.debug("wasm", "preprocess result", p), f.length === 0) return null;
213
213
  n == null ? void 0 : n("Building geometry...");
214
- const g = zn(f, u);
214
+ const g = cn(f, u);
215
215
  if (o) {
216
216
  const b = x ? 1e3 : 1;
217
- wo(g, o.positions, o.colors, b);
217
+ eo(g, o.positions, o.colors, b);
218
218
  }
219
219
  return {
220
220
  geometry: g,
@@ -223,18 +223,18 @@ let __tla = (async () => {
223
223
  detectedUnit: S
224
224
  };
225
225
  } catch (o) {
226
- return ce.error("wasm", "Processing failed", o), null;
226
+ return le.error("wasm", "Processing failed", o), null;
227
227
  }
228
228
  }
229
- function vo(t) {
230
- const n = new vn().parse(t);
229
+ function no(t) {
230
+ const n = new sn().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 $t(t) {
237
- const r = await t.arrayBuffer(), s = new po().parse(r).getAttribute("position");
236
+ async function kt(t) {
237
+ const r = await t.arrayBuffer(), s = new Xn().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 Co(t, r) {
245
+ function oo(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 Mo(t, r) {
249
+ function ro(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 Je(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 An(t, r = 1e-3, n = false) {
260
+ function dn(t, r = 1e-3, n = false) {
261
261
  if (!t.length) return [];
262
262
  const o = /* @__PURE__ */ new Map(), s = (f) => {
263
- const u = Co(f, r);
263
+ const u = oo(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 = Mo(u, r);
288
+ const S = ro(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) => Je(S) - Je(x));
294
- const f = Je(c[0]), u = c.filter((x) => Je(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,16 +306,16 @@ let __tla = (async () => {
306
306
  }
307
307
  return m;
308
308
  }
309
- function fn(t, r, n, o = false) {
310
- const s = new wt(new M(0, 1, 0), -n), a = [], c = new wn();
309
+ function Zt(t, r, n, o = false) {
310
+ const s = new dt(new z(0, 1, 0), -n), a = [], c = new on();
311
311
  c.setFromBufferAttribute(r.getAttribute("position"));
312
312
  const l = {
313
313
  linePoints: [],
314
314
  lineLength: 0,
315
- rightmostPoint: new M(0, n, 0)
315
+ rightmostPoint: new z(0, n, 0)
316
316
  };
317
317
  if (!s.intersectsBox(c)) return l;
318
- const e = new Sn(), m = new M();
318
+ const e = new rn(), m = new z();
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 = An(a, Vt, o);
329
+ const d = dn(a, Lt, o);
330
330
  if (d.length < 2) return l;
331
- const f = Je(d);
332
- let u = -1 / 0, x = new M(0, n, 0);
331
+ const f = je(d);
332
+ let u = -1 / 0, x = new z(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]) < Vt * 10;
334
+ const S = d.length > 2 && d[0].distanceTo(d[d.length - 1]) < Lt * 10;
335
335
  return {
336
336
  linePoints: d,
337
337
  lineLength: f,
@@ -339,22 +339,22 @@ let __tla = (async () => {
339
339
  isClosed: S
340
340
  };
341
341
  }
342
- function Ge(t, r, n, o = false) {
343
- const s = fn(t, r, n, o);
342
+ function Te(t, r, n, o = false) {
343
+ const s = Zt(t, r, n, o);
344
344
  if (s.isClosed && s.linePoints.length >= 3) return s;
345
- ce.debug("slice", `y=${n.toFixed(2)} failed (pts=${s.linePoints.length}, closed=${s.isClosed}), retrying...`);
345
+ le.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 bo) {
348
- const l = fn(t, r, n + c, o);
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;
347
+ for (const c of Qn) {
348
+ const l = Zt(t, r, n + c, o);
349
+ if (l.isClosed && l.linePoints.length >= 3) return le.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
- return ce.warn("slice", `y=${n.toFixed(2)} all retries exhausted (pts=${a.linePoints.length}, closed=${a.isClosed})`), a;
352
+ return le.warn("slice", `y=${n.toFixed(2)} all retries exhausted (pts=${a.linePoints.length}, closed=${a.isClosed})`), a;
353
353
  }
354
- function zo(t, r, n, o) {
355
- const s = new wt().setFromNormalAndCoplanarPoint(o.clone().normalize(), n), a = new wn();
354
+ function io(t, r, n, o) {
355
+ const s = new dt().setFromNormalAndCoplanarPoint(o.clone().normalize(), n), a = new on();
356
356
  if (a.setFromBufferAttribute(r.getAttribute("position")), !s.intersectsBox(a)) return 0;
357
- const c = [], l = new Sn(), e = new M();
357
+ const c = [], l = new rn(), e = new z();
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 = An(c, Vt);
369
- return Je(m);
368
+ const m = dn(c, Lt);
369
+ return je(m);
370
370
  }
371
- function jt(t) {
372
- return new St(t, {
373
- maxLeafTris: vt
371
+ function Pt(t) {
372
+ return new ft(t, {
373
+ maxLeafTris: ut
374
374
  });
375
375
  }
376
- function Ao(t, r, n, o) {
376
+ function so(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,9 +388,9 @@ let __tla = (async () => {
388
388
  valid: false,
389
389
  reason: `Height too large (${c.toFixed(1)}mm > 1000mm)`
390
390
  };
391
- const l = new St(t, {
392
- maxLeafTris: vt
393
- }), e = Ge(l, t, r);
391
+ const l = new ft(t, {
392
+ maxLeafTris: ut
393
+ }), e = Te(l, t, r);
394
394
  if (e.lineLength === 0) return {
395
395
  valid: false,
396
396
  reason: "No circumference at green point \u2014 mesh may be empty at that height"
@@ -400,7 +400,7 @@ let __tla = (async () => {
400
400
  valid: true,
401
401
  reason: ""
402
402
  };
403
- const d = Ge(l, t, m);
403
+ const d = Te(l, t, m);
404
404
  if (e.lineLength > 0 && d.lineLength > 0) {
405
405
  const u = e.lineLength / d.lineLength;
406
406
  if (u < 0.5) return {
@@ -410,7 +410,7 @@ let __tla = (async () => {
410
410
  }
411
411
  const f = r - o * 2;
412
412
  if (f > n) {
413
- const u = Ge(l, t, f);
413
+ const u = Te(l, t, f);
414
414
  if (d.lineLength > 0 && u.lineLength > 0) {
415
415
  const x = d.lineLength / u.lineLength;
416
416
  if (x < 0.5) return {
@@ -424,31 +424,31 @@ let __tla = (async () => {
424
424
  reason: ""
425
425
  };
426
426
  }
427
- const Le = "pipeline";
428
- function ko(t, r, n, o) {
427
+ const Ae = "pipeline";
428
+ function lo(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
432
432
  })), c = o.wasmModule;
433
433
  try {
434
- let l = t.geometry, e = a.map(($) => new M($.position.x, $.position.y, $.position.z));
434
+ let l = t.geometry, e = a.map((H) => new z(H.position.x, H.position.y, H.position.z));
435
435
  const m = e[0], d = e[1];
436
436
  if (!c) {
437
- o.onStatus("Aligning mesh (JS fallback)..."), ce.warn(Le, "WASM not available, using JS fallback alignment");
438
- const $ = new M(0, 1, 0), ne = new M().subVectors(d, m).normalize(), xe = ne.dot($), Se = new M().crossVectors(ne, $);
439
- if (Se.length() > 1e-4) {
440
- Se.normalize();
441
- const N = new O.Quaternion().setFromAxisAngle(Se, Math.acos(Math.min(1, Math.max(-1, xe))));
442
- l.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(N)), e = e.map((Ie) => Ie.clone().applyQuaternion(N));
437
+ o.onStatus("Aligning mesh (JS fallback)..."), le.warn(Ae, "WASM not available, using JS fallback alignment");
438
+ const H = new z(0, 1, 0), ee = new z().subVectors(d, m).normalize(), ge = ee.dot(H), ye = new z().crossVectors(ee, H);
439
+ if (ye.length() > 1e-4) {
440
+ ye.normalize();
441
+ const G = new $.Quaternion().setFromAxisAngle(ye, Math.acos(Math.min(1, Math.max(-1, ge))));
442
+ l.applyMatrix4(new $.Matrix4().makeRotationFromQuaternion(G)), e = e.map((ke) => ke.clone().applyQuaternion(G));
443
443
  }
444
444
  if (e[0].y > e[1].y) {
445
- const N = new O.Quaternion().setFromAxisAngle(new M(1, 0, 0), Math.PI);
446
- l.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(N)), e = e.map((Ie) => Ie.clone().applyQuaternion(N));
445
+ const G = new $.Quaternion().setFromAxisAngle(new z(1, 0, 0), Math.PI);
446
+ l.applyMatrix4(new $.Matrix4().makeRotationFromQuaternion(G)), e = e.map((ke) => ke.clone().applyQuaternion(G));
447
447
  }
448
- const we = e[0].clone();
449
- l.translate(-we.x, -we.y, -we.z), e = e.map((N) => new M(N.x - we.x, N.y - we.y, N.z - we.z)), l.computeVertexNormals(), l.computeBoundingBox();
450
- const re = new M(e[0].x, e[0].y, e[0].z);
451
- e.push(re), o.addLandmarkPoint({
448
+ const xe = e[0].clone();
449
+ l.translate(-xe.x, -xe.y, -xe.z), e = e.map((G) => new z(G.x - xe.x, G.y - xe.y, G.z - xe.z)), l.computeVertexNormals(), l.computeBoundingBox();
450
+ const te = new z(e[0].x, e[0].y, e[0].z);
451
+ e.push(te), o.addLandmarkPoint({
452
452
  faceIndex: -1,
453
453
  vertexIndices: [
454
454
  0,
@@ -456,25 +456,25 @@ let __tla = (async () => {
456
456
  2
457
457
  ],
458
458
  position: {
459
- x: re.x,
460
- y: re.y,
461
- z: re.z
459
+ x: te.x,
460
+ y: te.y,
461
+ z: te.z
462
462
  },
463
463
  barycentricCoords: {
464
464
  u: 0.33,
465
465
  v: 0.33,
466
466
  w: 0.34
467
467
  }
468
- }), o.updateLandmarkPositions(e.map((N) => ({
469
- x: N.x,
470
- y: N.y,
471
- z: N.z
472
- }))), o.setAligned(true), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 * bt);
473
- const j = new M();
474
- l.computeBoundingBox(), l.boundingBox.getSize(j), o.setModelSize(Math.max(j.x, j.y, j.z)), s.dispose();
468
+ }), o.updateLandmarkPositions(e.map((G) => ({
469
+ x: G.x,
470
+ y: G.y,
471
+ z: G.z
472
+ }))), o.setAligned(true), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 * at);
473
+ const N = new z();
474
+ l.computeBoundingBox(), l.boundingBox.getSize(N), o.setModelSize(Math.max(N.x, N.y, N.z)), s.dispose();
475
475
  return;
476
476
  }
477
- const { positions: f, indices: u } = yt(l), x = new Float32Array([
477
+ const { positions: f, indices: u } = ct(l), x = new Float32Array([
478
478
  m.x,
479
479
  m.y,
480
480
  m.z
@@ -485,65 +485,65 @@ let __tla = (async () => {
485
485
  ]);
486
486
  o.onStatus("Detecting shell type...");
487
487
  const p = c.detect_shell(f, u, S, 40), g = p.is_double_shell(), b = p.surface_normal();
488
- ce.info(Le, `Shell: ${g ? "DOUBLE" : "SINGLE"}`, p.details()), (_a = o.setDoubleShell) == null ? void 0 : _a.call(o, g), o.onStatus("Finding cross-section plane...");
488
+ le.info(Ae, `Shell: ${g ? "DOUBLE" : "SINGLE"}`, p.details()), (_a = o.setDoubleShell) == null ? void 0 : _a.call(o, g), o.onStatus("Finding cross-section plane...");
489
489
  const A = new Float32Array([
490
490
  b[0],
491
491
  b[1],
492
492
  b[2]
493
- ]), L = c.find_min_cross_section(f, u, S, A, 10), v = L.plane_normal();
494
- ce.info(Le, "Cross-section found", L.details()), o.onStatus("Aligning mesh...");
493
+ ]), P = c.find_min_cross_section(f, u, S, A, 10), v = P.plane_normal();
494
+ le.info(Ae, "Cross-section found", P.details()), o.onStatus("Aligning mesh...");
495
495
  const k = new Float32Array([
496
496
  v[0],
497
497
  v[1],
498
498
  v[2]
499
499
  ]), w = c.align_to_origin(f, x, S, k);
500
- let z = w.positions(), h = w.mpt(), C = w.origin();
501
- const P = w.transform();
502
- ce.info(Le, "Alignment complete", w.details());
503
- const I = [
504
- P[3],
505
- P[4],
506
- P[5],
507
- P[6],
508
- P[7],
509
- P[8],
510
- P[9],
511
- P[10],
512
- P[11]
513
- ], _ = new Float32Array([
514
- I[0] * v[0] + I[1] * v[1] + I[2] * v[2],
515
- I[3] * v[0] + I[4] * v[1] + I[5] * v[2],
516
- I[6] * v[0] + I[7] * v[1] + I[8] * v[2]
500
+ let M = w.positions(), h = w.mpt(), C = w.origin();
501
+ const L = w.transform();
502
+ le.info(Ae, "Alignment complete", w.details());
503
+ const _ = [
504
+ L[3],
505
+ L[4],
506
+ L[5],
507
+ L[6],
508
+ L[7],
509
+ L[8],
510
+ L[9],
511
+ L[10],
512
+ L[11]
513
+ ], D = new Float32Array([
514
+ _[0] * v[0] + _[1] * v[1] + _[2] * v[2],
515
+ _[3] * v[0] + _[4] * v[1] + _[5] * v[2],
516
+ _[6] * v[0] + _[7] * v[1] + _[8] * v[2]
517
517
  ]);
518
518
  o.onStatus("Generating measurement points...");
519
- const E = c.subdivide_origin_to_plane(new Float32Array(C), new Float32Array(h), _);
520
- ce.debug(Le, `Subdivide: ${E.count()} pts, spacing=${E.spacing().toFixed(1)}mm`);
521
- const V = E.points(), Y = E.count(), q = 2, ye = 1, ae = [];
522
- for (let $ = q; $ < Y - ye; $++) ae.push(V[$ * 3 + 1]);
519
+ const E = c.subdivide_origin_to_plane(new Float32Array(C), new Float32Array(h), D);
520
+ le.debug(Ae, `Subdivide: ${E.count()} pts, spacing=${E.spacing().toFixed(1)}mm`);
521
+ const V = E.points(), Y = E.count(), Q = 2, me = 1, ie = [];
522
+ for (let H = Q; H < Y - me; H++) ie.push(V[H * 3 + 1]);
523
523
  o.onStatus("Computing cross-sections...");
524
- let fe = [];
525
- if (ae.length >= 2) {
526
- const ne = (g ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(z, u, new Float32Array(ae), 10);
527
- ce.debug(Le, "Batch (subdivision)", ne.details());
528
- const xe = ne.all_loop_points(), Se = ne.offsets(), we = ne.circumferences();
529
- for (let re = 0; re < Se.length - 1; re++) {
530
- const j = Se[re], N = Se[re + 1];
531
- if (N <= j || we[re] <= 0) continue;
532
- const Ie = (N - j) / 3;
533
- if (Ie < 3) continue;
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);
524
+ let ce = [];
525
+ if (ie.length >= 2) {
526
+ const ee = (g ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(M, u, new Float32Array(ie), 10);
527
+ le.debug(Ae, "Batch (subdivision)", ee.details());
528
+ const ge = ee.all_loop_points(), ye = ee.offsets(), xe = ee.circumferences();
529
+ for (let te = 0; te < ye.length - 1; te++) {
530
+ const N = ye[te], G = ye[te + 1];
531
+ if (G <= N || xe[te] <= 0) continue;
532
+ const ke = (G - N) / 3;
533
+ if (ke < 3) continue;
534
+ let ze = 0, $e = 0, oe = 0;
535
+ for (let Ce = N; Ce < G; Ce += 3) ze += ge[Ce], $e += ge[Ce + 1], oe += ge[Ce + 2];
536
+ ce.push(ze / ke, $e / ke, oe / ke);
537
537
  }
538
538
  }
539
- if (fe.length >= 6) {
539
+ if (ce.length >= 6) {
540
540
  o.onStatus("Refining alignment...");
541
- const $ = c.refine_alignment(new Float32Array(fe), z, new Float32Array(C), new Float32Array(h));
542
- ce.info(Le, "Refinement complete", $.details()), z = $.positions(), h = $.mpt(), C = $.origin();
541
+ const H = c.refine_alignment(new Float32Array(ce), M, new Float32Array(C), new Float32Array(h));
542
+ le.info(Ae, "Refinement complete", H.details()), M = H.positions(), h = H.mpt(), C = H.origin();
543
543
  }
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
- const X = new M(e[0].x, e[0].y, e[0].z);
544
+ const ne = l.getAttribute("color"), q = cn(M, u);
545
+ ne && q.setAttribute("color", ne), l.dispose(), l = q, t.geometry = l, l.computeVertexNormals(), l.computeBoundingBox(), e[0] = new z(C[0], C[1], C[2]), e[1] = new z(h[0], h[1], h[2]), o.onStatus("Setting blue point...");
546
+ const X = new z(e[0].x, e[0].y, e[0].z);
547
547
  e.push(X), o.addLandmarkPoint({
548
548
  faceIndex: -1,
549
549
  vertexIndices: [
@@ -561,46 +561,46 @@ let __tla = (async () => {
561
561
  v: 0.33,
562
562
  w: 0.34
563
563
  }
564
- }), o.updateLandmarkPositions(e.map(($) => ({
565
- x: $.x,
566
- y: $.y,
567
- z: $.z
564
+ }), o.updateLandmarkPositions(e.map((H) => ({
565
+ x: H.x,
566
+ y: H.y,
567
+ z: H.z
568
568
  }))), o.setAligned(true);
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 * bt), o.onStatus("Computing final measurements...");
569
+ const de = l.boundingBox, Z = new z();
570
+ de.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 * at), o.onStatus("Computing final measurements...");
571
571
  {
572
- const $ = yt(l), ne = e[1].y, xe = e[0].y;
573
- let Se = 1 / 0, we = -1 / 0;
574
- const re = $.positions;
575
- for (let le = 1; le < re.length; le += 3) re[le] < Se && (Se = re[le]), re[le] > we && (we = re[le]);
576
- const j = 25.4, N = [];
577
- N.push(ne);
578
- for (let le = 1; le <= 2; le++) {
579
- const ke = ne + le * j;
580
- ke < we - 1 && N.push(ke);
572
+ const H = ct(l), ee = e[1].y, ge = e[0].y;
573
+ let ye = 1 / 0, xe = -1 / 0;
574
+ const te = H.positions;
575
+ for (let oe = 1; oe < te.length; oe += 3) te[oe] < ye && (ye = te[oe]), te[oe] > xe && (xe = te[oe]);
576
+ const N = 25.4, G = [];
577
+ G.push(ee);
578
+ for (let oe = 1; oe <= 2; oe++) {
579
+ const Ce = ee + oe * N;
580
+ Ce < xe - 1 && G.push(Ce);
581
581
  }
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
- 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
- ce.info(Le, `Horizontal slices (${g ? "inner" : "outer"}): ${Pe.count()}/${N.length} valid`), ce.debug(Le, "Slice details", Pe.details());
586
- const Ke = {
587
- yValues: N,
588
- circumferences: Array.from(Pe.circumferences()),
589
- allLoopPoints: new Float32Array(Pe.all_loop_points()),
590
- offsets: new Uint32Array(Pe.offsets()),
591
- mptY: ne,
592
- originY: xe
582
+ for (let oe = ee - N; oe > ge; oe -= N) G.push(oe);
583
+ G.sort((oe, Ce) => oe - Ce), le.info(Ae, `Horizontal slices: ${G.length} Y planes, range ${(_b = G[0]) == null ? void 0 : _b.toFixed(1)} \u2192 ${(_c = G[G.length - 1]) == null ? void 0 : _c.toFixed(1)} mm`);
584
+ const ze = (g ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(H.positions, H.indices, new Float32Array(G), 10);
585
+ le.info(Ae, `Horizontal slices (${g ? "inner" : "outer"}): ${ze.count()}/${G.length} valid`), le.debug(Ae, "Slice details", ze.details());
586
+ const $e = {
587
+ yValues: G,
588
+ circumferences: Array.from(ze.circumferences()),
589
+ allLoopPoints: new Float32Array(ze.all_loop_points()),
590
+ offsets: new Uint32Array(ze.offsets()),
591
+ mptY: ee,
592
+ originY: ge
593
593
  };
594
- (_d = o.setWasmSlices) == null ? void 0 : _d.call(o, Ke);
594
+ (_d = o.setWasmSlices) == null ? void 0 : _d.call(o, $e);
595
595
  }
596
596
  o.onStatus("Validating results...");
597
- const pe = e[1].y, me = e[0].y, he = Ao(l, pe, me, n);
598
- he.valid || ce.warn(Le, `Validation: ${he.reason}`), o.setClippedReferenceGeometry ? (s.computeVertexNormals(), o.setClippedReferenceGeometry(s)) : s.dispose();
597
+ const fe = e[1].y, he = e[0].y, ue = so(l, fe, he, n);
598
+ ue.valid || le.warn(Ae, `Validation: ${ue.reason}`), o.setClippedReferenceGeometry ? (s.computeVertexNormals(), o.setClippedReferenceGeometry(s)) : s.dispose();
599
599
  } catch (l) {
600
- ce.error(Le, "Processing failed", l), o.setError(l instanceof Error ? l.message : "Failed to process mesh."), s.dispose();
600
+ le.error(Ae, "Processing failed", l), o.setError(l instanceof Error ? l.message : "Failed to process mesh."), s.dispose();
601
601
  }
602
602
  }
603
- class Fo extends so {
603
+ class ao extends Hn {
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 Po = ({ message: t, onDismiss: r }) => F("div", {
670
+ const co = ({ 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
- }), un = ({ message: t }) => F("div", {
723
+ }), Kt = ({ message: t }) => F("div", {
724
724
  style: {
725
725
  position: "absolute",
726
726
  top: 0,
@@ -758,16 +758,16 @@ let __tla = (async () => {
758
758
  })
759
759
  ]
760
760
  });
761
- function Lo(t, r, n, o) {
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;
761
+ function fo(t, r, n, o) {
762
+ const s = new z().subVectors(n, r), a = new z().subVectors(o, r), c = new z().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,
765
765
  v: x,
766
766
  w: S
767
767
  };
768
768
  }
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) => {
769
+ const uo = ({ mesh: t, maxPoints: r = 2, meshColor: n = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: s = false, doubleShellTransparency: a = false }) => {
770
+ const { addLandmarkPoint: c, landmarkPoints: l } = _t(), e = J((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;
@@ -783,15 +783,15 @@ let __tla = (async () => {
783
783
  p * 3 + 1,
784
784
  p * 3 + 2
785
785
  ];
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]);
786
+ const P = g.getAttribute("position"), v = new z().fromBufferAttribute(P, A[0]), k = new z().fromBufferAttribute(P, A[1]), w = new z().fromBufferAttribute(P, A[2]);
787
787
  v.applyMatrix4(t.matrixWorld), k.applyMatrix4(t.matrixWorld), w.applyMatrix4(t.matrixWorld);
788
- const z = S.point, h = Lo(z, v, k, w), C = {
788
+ const M = S.point, h = fo(M, v, k, w), C = {
789
789
  faceIndex: p,
790
790
  vertexIndices: A,
791
791
  position: {
792
- x: z.x,
793
- y: z.y,
794
- z: z.z
792
+ x: M.x,
793
+ y: M.y,
794
+ z: M.z
795
795
  },
796
796
  barycentricCoords: h
797
797
  };
@@ -801,11 +801,11 @@ let __tla = (async () => {
801
801
  c,
802
802
  l.length,
803
803
  r
804
- ]), m = H(() => !!t.geometry.getAttribute("color"), [
804
+ ]), m = j(() => !!t.geometry.getAttribute("color"), [
805
805
  t
806
- ]), d = a ? Math.min(o, 0.65) : o, f = d < 1, u = H(() => new O.MeshStandardMaterial({
806
+ ]), d = a ? Math.min(o, 0.65) : o, f = d < 1, u = j(() => new $.MeshStandardMaterial({
807
807
  color: m ? "#ffffff" : n,
808
- side: s ? O.FrontSide : O.DoubleSide,
808
+ side: s ? $.FrontSide : $.DoubleSide,
809
809
  roughness: 0.6,
810
810
  metalness: 0.1,
811
811
  transparent: f,
@@ -826,8 +826,8 @@ let __tla = (async () => {
826
826
  material: u,
827
827
  renderOrder: a ? 0 : void 0
828
828
  });
829
- }, Do = ({ point: t, index: r, markerSize: n, color: o, label: s }) => {
830
- const [a, c] = B(false);
829
+ }, po = ({ point: t, index: r, markerSize: n, color: o, label: s }) => {
830
+ const [a, c] = R(false);
831
831
  return F("mesh", {
832
832
  position: [
833
833
  t.position.x,
@@ -847,7 +847,7 @@ let __tla = (async () => {
847
847
  i("meshBasicMaterial", {
848
848
  color: o
849
849
  }),
850
- a && i(Ze, {
850
+ a && i(Oe, {
851
851
  center: true,
852
852
  style: {
853
853
  pointerEvents: "none"
@@ -868,8 +868,8 @@ let __tla = (async () => {
868
868
  })
869
869
  ]
870
870
  }, r);
871
- }, _o = ({ modelSize: t, labels: r }) => {
872
- const { landmarkPoints: n } = Nt(), o = t * 0.02, s = [
871
+ }, ho = ({ modelSize: t, labels: r }) => {
872
+ const { landmarkPoints: n } = _t(), o = t * 0.02, s = [
873
873
  "#44ff44",
874
874
  "#ff4444",
875
875
  "#4444ff"
@@ -878,8 +878,8 @@ let __tla = (async () => {
878
878
  "Origin",
879
879
  "Cut Plane"
880
880
  ];
881
- return i(He, {
882
- children: n.map((l, e) => i(Do, {
881
+ return i(We, {
882
+ children: n.map((l, e) => i(po, {
883
883
  point: l,
884
884
  index: e,
885
885
  markerSize: o,
@@ -888,85 +888,85 @@ let __tla = (async () => {
888
888
  }, e))
889
889
  });
890
890
  };
891
- function kn(t) {
892
- return H(() => t ? new St(t, {
893
- maxLeafTris: vt
891
+ function fn(t) {
892
+ return j(() => t ? new ft(t, {
893
+ maxLeafTris: ut
894
894
  }) : null, [
895
895
  t
896
896
  ]);
897
897
  }
898
- const pn = (t, r) => {
898
+ const Ut = (t, r) => {
899
899
  const n = Math.abs(t - r);
900
900
  return n <= 7 ? "#8BC34A" : n <= 20 ? "#FFC107" : "#FF5722";
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();
901
+ }, Jt = new $.Color("#8BC34A"), Qt = new $.Color("#FFC107"), go = new $.Color("#FF5722"), mo = (t) => {
902
+ if (t <= 7) return Jt.clone();
903
903
  if (t <= 20) {
904
904
  const n = (t - 7) / 13;
905
- return hn.clone().lerp(gn, n);
905
+ return Jt.clone().lerp(Qt, n);
906
906
  }
907
907
  const r = Math.min((t - 20) / 20, 1);
908
- return gn.clone().lerp(Ro, r);
909
- }, Bo = (t, r) => {
908
+ return Qt.clone().lerp(go, r);
909
+ }, xo = (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 = Wo(f);
912
+ const m = t[e], d = r[e], f = m.distanceTo(d), u = mo(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);
916
916
  }
917
917
  }
918
- const c = new O.BufferGeometry();
919
- c.setAttribute("position", new O.Float32BufferAttribute(o, 3)), c.setAttribute("color", new O.Float32BufferAttribute(s, 3)), c.setIndex(a);
920
- const l = new O.MeshBasicMaterial({
918
+ const c = new $.BufferGeometry();
919
+ c.setAttribute("position", new $.Float32BufferAttribute(o, 3)), c.setAttribute("color", new $.Float32BufferAttribute(s, 3)), c.setIndex(a);
920
+ const l = new $.MeshBasicMaterial({
921
921
  vertexColors: true,
922
922
  transparent: true,
923
923
  opacity: 0.25,
924
- side: O.DoubleSide,
924
+ side: $.DoubleSide,
925
925
  depthTest: false,
926
926
  depthWrite: false
927
927
  });
928
- return new O.Mesh(c, l);
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
- const u = H(() => d && f != null ? null : Ge(t, r, n, l), [
928
+ return new $.Mesh(c, l);
929
+ }, bo = ({ 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
+ const u = j(() => d && f != null ? null : Te(t, r, n, l), [
931
931
  t,
932
932
  r,
933
933
  n,
934
934
  l,
935
935
  d,
936
936
  f
937
- ]), x = d ?? (u == null ? void 0 : u.linePoints) ?? [], S = f ?? (u == null ? void 0 : u.lineLength) ?? 0, p = H(() => {
937
+ ]), x = d ?? (u == null ? void 0 : u.linePoints) ?? [], S = f ?? (u == null ? void 0 : u.lineLength) ?? 0, p = j(() => {
938
938
  if (e == null || e === 0 || S <= 0 || x.length < 2) return null;
939
- const L = e / S, v = x.reduce((w, z) => w + z.x, 0) / x.length, k = x.reduce((w, z) => w + z.z, 0) / x.length;
940
- return x.map((w) => new M(v + (w.x - v) * L, w.y, k + (w.z - k) * L));
939
+ const P = e / S, v = x.reduce((w, M) => w + M.x, 0) / x.length, k = x.reduce((w, M) => w + M.z, 0) / x.length;
940
+ return x.map((w) => new z(v + (w.x - v) * P, w.y, k + (w.z - k) * P));
941
941
  }, [
942
942
  x,
943
943
  S,
944
944
  e
945
- ]), g = H(() => !p || x.length < 2 ? null : Bo(x, p), [
945
+ ]), g = j(() => !p || x.length < 2 ? null : xo(x, p), [
946
946
  x,
947
947
  p
948
948
  ]);
949
- K(() => () => {
949
+ U(() => () => {
950
950
  g && (g.geometry.dispose(), g.material.dispose());
951
951
  }, [
952
952
  g
953
953
  ]);
954
- const b = ie(null), A = H(() => {
955
- const L = new O.BufferGeometry();
956
- L.setAttribute("position", new O.Float32BufferAttribute(new Float32Array(6), 3));
957
- const v = new O.LineBasicMaterial({
954
+ const b = re(null), A = j(() => {
955
+ const P = new $.BufferGeometry();
956
+ P.setAttribute("position", new $.Float32BufferAttribute(new Float32Array(6), 3));
957
+ const v = new $.LineBasicMaterial({
958
958
  color: 6710886,
959
959
  depthTest: false,
960
960
  depthWrite: false,
961
961
  transparent: true
962
962
  });
963
- return new O.Line(L, v);
963
+ return new $.Line(P, v);
964
964
  }, []);
965
- return K(() => () => {
965
+ return U(() => () => {
966
966
  A.geometry.dispose(), A.material.dispose();
967
967
  }, [
968
968
  A
969
- ]), K(() => {
969
+ ]), U(() => {
970
970
  S > 0 && (a == null ? void 0 : a({
971
971
  yPosition: n,
972
972
  originalValue: S,
@@ -976,27 +976,27 @@ let __tla = (async () => {
976
976
  S,
977
977
  n,
978
978
  a
979
- ]), xn(({ camera: L }) => {
979
+ ]), en(({ camera: P }) => {
980
980
  if (!b.current || x.length < 2) return;
981
- const v = new M();
982
- L.getWorldDirection(v);
983
- const k = new M(v.x, 0, v.z);
981
+ const v = new z();
982
+ P.getWorldDirection(v);
983
+ const k = new z(v.x, 0, v.z);
984
984
  if (k.lengthSq() < 1e-8) return;
985
985
  k.normalize();
986
- const w = new M().crossVectors(k, new M(0, 1, 0)).normalize();
987
- let z = -1 / 0, h = x[0];
988
- for (const _ of x) {
989
- const E = w.x * _.x + w.z * _.z;
990
- E > z && (z = E, h = _);
986
+ const w = new z().crossVectors(k, new z(0, 1, 0)).normalize();
987
+ let M = -1 / 0, h = x[0];
988
+ for (const D of x) {
989
+ const E = w.x * D.x + w.z * D.z;
990
+ E > M && (M = E, h = D);
991
991
  }
992
- const C = s * 0.35, P = new M(h.x + w.x * C, n, h.z + w.z * C);
993
- b.current.position.copy(P);
994
- const I = A.geometry.getAttribute("position");
995
- I.setXYZ(0, h.x, h.y, h.z), I.setXYZ(1, P.x, P.y, P.z), I.needsUpdate = true;
992
+ const C = s * 0.35, L = new z(h.x + w.x * C, n, h.z + w.z * C);
993
+ b.current.position.copy(L);
994
+ const _ = A.geometry.getAttribute("position");
995
+ _.setXYZ(0, h.x, h.y, h.z), _.setXYZ(1, L.x, L.y, L.z), _.needsUpdate = true;
996
996
  }), x.length < 2 ? null : F("group", {
997
997
  renderOrder: 10,
998
998
  children: [
999
- i(de, {
999
+ i(ae, {
1000
1000
  points: x,
1001
1001
  color: o,
1002
1002
  lineWidth: m,
@@ -1009,9 +1009,9 @@ let __tla = (async () => {
1009
1009
  object: g,
1010
1010
  renderOrder: 10
1011
1011
  }),
1012
- p && e != null && e !== 0 && i(de, {
1012
+ p && e != null && e !== 0 && i(ae, {
1013
1013
  points: p,
1014
- color: pn(S, e),
1014
+ color: Ut(S, e),
1015
1015
  lineWidth: 2.5,
1016
1016
  dashed: true,
1017
1017
  dashSize: 2,
@@ -1028,7 +1028,7 @@ let __tla = (async () => {
1028
1028
  }),
1029
1029
  i("group", {
1030
1030
  ref: b,
1031
- children: i(Ze, {
1031
+ children: i(Oe, {
1032
1032
  zIndexRange: [
1033
1033
  100,
1034
1034
  0
@@ -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 = pn(S, e);
1081
+ const P = S - e, v = P > 0.5 ? "\u25B2" : P < -0.5 ? "\u25BC" : "", k = Ut(S, e);
1082
1082
  return F("div", {
1083
1083
  style: {
1084
1084
  display: "flex",
@@ -1106,8 +1106,8 @@ let __tla = (async () => {
1106
1106
  fontWeight: 600
1107
1107
  },
1108
1108
  children: [
1109
- L > 0 ? "+" : "",
1110
- c === "inch" ? (L / 25.4).toFixed(2) : L.toFixed(1)
1109
+ P > 0 ? "+" : "",
1110
+ c === "inch" ? (P / 25.4).toFixed(2) : P.toFixed(1)
1111
1111
  ]
1112
1112
  }),
1113
1113
  F("span", {
@@ -1130,20 +1130,20 @@ let __tla = (async () => {
1130
1130
  })
1131
1131
  ]
1132
1132
  });
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(() => {
1133
+ }, yo = jn(bo), wo = ({ 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 = re(/* @__PURE__ */ new Map()), x = t.geometry, S = fn(x), p = j(() => {
1135
1135
  if (f) {
1136
- let z = [
1136
+ let M = [
1137
1137
  ...f.yValues
1138
1138
  ];
1139
1139
  if (o > 25.4 + 0.1) {
1140
1140
  const h = f.mptY;
1141
- z = z.filter((C) => {
1142
- const P = Math.abs(C - h);
1143
- return P < 0.5 || Math.abs(Math.round(P / o) * o - P) < 0.5;
1141
+ M = M.filter((C) => {
1142
+ const L = Math.abs(C - h);
1143
+ return L < 0.5 || Math.abs(Math.round(L / o) * o - L) < 0.5;
1144
1144
  });
1145
1145
  }
1146
- return c ? z.sort((h, C) => C - h) : z.sort((h, C) => h - C), z;
1146
+ return c ? M.sort((h, C) => C - h) : M.sort((h, C) => h - C), M;
1147
1147
  }
1148
1148
  const k = [];
1149
1149
  if (c) for (let w = n; w >= r; w -= o) k.push(w);
@@ -1155,20 +1155,20 @@ let __tla = (async () => {
1155
1155
  o,
1156
1156
  c,
1157
1157
  f
1158
- ]), g = H(() => {
1158
+ ]), g = j(() => {
1159
1159
  if (!f) return null;
1160
- const k = /* @__PURE__ */ new Map(), { allLoopPoints: w, offsets: z, yValues: h } = f;
1161
- for (let C = 0; C < z.length - 1; C++) {
1162
- const P = z[C], I = z[C + 1];
1163
- if (I <= P) continue;
1164
- const _ = [];
1165
- for (let E = P; E < I; E += 3) _.push(new M(w[E], w[E + 1], w[E + 2]));
1166
- _.length >= 3 && k.set(h[C], _);
1160
+ const k = /* @__PURE__ */ new Map(), { allLoopPoints: w, offsets: M, yValues: h } = f;
1161
+ for (let C = 0; C < M.length - 1; C++) {
1162
+ const L = M[C], _ = M[C + 1];
1163
+ if (_ <= L) continue;
1164
+ const D = [];
1165
+ for (let E = L; E < _; E += 3) D.push(new z(w[E], w[E + 1], w[E + 2]));
1166
+ D.length >= 3 && k.set(h[C], D);
1167
1167
  }
1168
1168
  return k;
1169
1169
  }, [
1170
1170
  f
1171
- ]), b = H(() => {
1171
+ ]), b = j(() => {
1172
1172
  if (!f) return null;
1173
1173
  const k = /* @__PURE__ */ new Map();
1174
1174
  for (let w = 0; w < f.yValues.length; w++) k.set(f.yValues[w], f.circumferences[w]);
@@ -1176,11 +1176,11 @@ let __tla = (async () => {
1176
1176
  }, [
1177
1177
  f
1178
1178
  ]);
1179
- K(() => {
1179
+ U(() => {
1180
1180
  u.current.clear();
1181
1181
  }, [
1182
1182
  p
1183
- ]), K(() => {
1183
+ ]), U(() => {
1184
1184
  if (!b || !a) return;
1185
1185
  const k = p.filter((w) => (b.get(w) ?? 0) > 0).map((w) => ({
1186
1186
  yPosition: w,
@@ -1195,23 +1195,23 @@ let __tla = (async () => {
1195
1195
  ]);
1196
1196
  const A = [
1197
1197
  "#5B9BD5"
1198
- ], L = s * xo, v = Q((k) => {
1198
+ ], P = s * Jn, v = J((k) => {
1199
1199
  if (b) return;
1200
1200
  u.current.set(k.yPosition, k);
1201
- const w = Array.from(u.current.values()).sort((z, h) => c ? h.yPosition - z.yPosition : z.yPosition - h.yPosition);
1201
+ const w = Array.from(u.current.values()).sort((M, h) => c ? h.yPosition - M.yPosition : M.yPosition - h.yPosition);
1202
1202
  a == null ? void 0 : a(w);
1203
1203
  }, [
1204
1204
  a,
1205
1205
  c,
1206
1206
  b
1207
1207
  ]);
1208
- return S ? i(He, {
1209
- children: p.map((k, w) => i(To, {
1208
+ return S ? i(We, {
1209
+ children: p.map((k, w) => i(yo, {
1210
1210
  bvh: S,
1211
1211
  geometry: x,
1212
1212
  yPosition: k,
1213
1213
  color: d != null && Math.abs(k - d) < o * 0.5 ? "#44ff44" : A[w % A.length],
1214
- labelX: L,
1214
+ labelX: P,
1215
1215
  onDataChange: v,
1216
1216
  displayUnit: l,
1217
1217
  useInnerSurface: e,
@@ -1221,31 +1221,31 @@ let __tla = (async () => {
1221
1221
  wasmCircumference: b == null ? void 0 : b.get(k)
1222
1222
  }, k))
1223
1223
  }) : null;
1224
- }, $o = (t, r) => {
1224
+ }, So = (t, r) => {
1225
1225
  const n = Math.abs(t - r);
1226
1226
  return n <= 7 ? "#4caf50" : n <= 15 ? "#ff9800" : "#f44336";
1227
- }, Ho = ({ mesh: t, greenY: r, modelSize: n, displayUnit: o = "mm", bottomY: s, formHeight: a }) => {
1227
+ }, vo = ({ 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 = ie(null);
1232
- xn(({ 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 = re(null);
1232
+ en(({ camera: w }) => {
1233
1233
  if (!f.current) return;
1234
- const z = new M();
1235
- w.getWorldDirection(z);
1236
- const h = new M(z.x, 0, z.z);
1234
+ const M = new z();
1235
+ w.getWorldDirection(M);
1236
+ const h = new z(M.x, 0, M.z);
1237
1237
  if (h.lengthSq() < 1e-8) return;
1238
1238
  h.normalize();
1239
- const C = new M().crossVectors(new M(0, 1, 0), h).normalize();
1239
+ const C = new z().crossVectors(new z(0, 1, 0), h).normalize();
1240
1240
  f.current.position.set(C.x * m, 0, C.z * m);
1241
- const P = w.position.x - f.current.position.x, I = w.position.z - f.current.position.z;
1242
- f.current.rotation.y = Math.atan2(P, I);
1241
+ const L = w.position.x - f.current.position.x, _ = w.position.z - f.current.position.z;
1242
+ f.current.rotation.y = Math.atan2(L, _);
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 ? $o(e, a) : "#fff";
1244
+ const u = new z(0, r, 0), x = new z(0, l, 0), S = new z(0, (r + l) / 2, 0), p = new z(-d, r, 0), g = new z(d, r, 0), b = new z(-d, l, 0), A = new z(d, l, 0), P = a != null && a > 0, v = P ? e - a : 0, k = P ? So(e, a) : "#fff";
1245
1245
  return F("group", {
1246
1246
  ref: f,
1247
1247
  children: [
1248
- i(de, {
1248
+ i(ae, {
1249
1249
  points: [
1250
1250
  u,
1251
1251
  x
@@ -1253,7 +1253,7 @@ let __tla = (async () => {
1253
1253
  color: "#888888",
1254
1254
  lineWidth: 1.5
1255
1255
  }),
1256
- i(de, {
1256
+ i(ae, {
1257
1257
  points: [
1258
1258
  p,
1259
1259
  g
@@ -1261,7 +1261,7 @@ let __tla = (async () => {
1261
1261
  color: "#888888",
1262
1262
  lineWidth: 1.5
1263
1263
  }),
1264
- i(de, {
1264
+ i(ae, {
1265
1265
  points: [
1266
1266
  b,
1267
1267
  A
@@ -1271,7 +1271,7 @@ let __tla = (async () => {
1271
1271
  }),
1272
1272
  i("mesh", {
1273
1273
  position: S,
1274
- children: i(Ze, {
1274
+ children: i(Oe, {
1275
1275
  center: true,
1276
1276
  style: {
1277
1277
  pointerEvents: "none"
@@ -1295,7 +1295,7 @@ let __tla = (async () => {
1295
1295
  style: {
1296
1296
  padding: "4px 8px",
1297
1297
  backgroundColor: "rgba(0, 0, 0, 0.75)",
1298
- borderRadius: L ? "4px 4px 0 0" : 4,
1298
+ borderRadius: P ? "4px 4px 0 0" : 4,
1299
1299
  color: "#fff",
1300
1300
  fontSize: 16,
1301
1301
  fontFamily: "monospace",
@@ -1308,7 +1308,7 @@ let __tla = (async () => {
1308
1308
  o === "inch" ? "in" : "mm"
1309
1309
  ]
1310
1310
  }),
1311
- L && F("div", {
1311
+ P && F("div", {
1312
1312
  style: {
1313
1313
  display: "flex",
1314
1314
  alignItems: "center",
@@ -1360,26 +1360,26 @@ let __tla = (async () => {
1360
1360
  })
1361
1361
  ]
1362
1362
  });
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(() => {
1363
+ }, Co = ({ 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 } = tn(), x = re(false), S = re(s), p = re(new z()), g = re(null), b = re(c), A = re(r), P = re(n), v = re(l), k = re(0), w = J(() => {
1365
1365
  if (!o || t <= 0) return null;
1366
1366
  const h = l ?? o.geometry;
1367
1367
  h.computeBoundingBox();
1368
- const C = h.boundingBox, P = new M();
1369
- C.getCenter(P);
1370
- const I = new M();
1371
- C.getSize(I), p.current.copy(I);
1372
- const _ = d.width / d.height, E = Math.max(I.y, I.x / _) * 1.6, V = E * _, Y = P.y - I.y * 0.05;
1368
+ const C = h.boundingBox, L = new z();
1369
+ C.getCenter(L);
1370
+ const _ = new z();
1371
+ C.getSize(_), p.current.copy(_);
1372
+ const D = d.width / d.height, E = Math.max(_.y, _.x / D) * 1.6, V = E * D, Y = L.y - _.y * 0.05;
1373
1373
  k.current = Y;
1374
- const q = new O.OrthographicCamera(-V / 2, V / 2, E / 2, -E / 2, 0.1, t * 10);
1375
- return q.position.set(0, Y, t * 2), q.lookAt(0, Y, 0), q;
1374
+ const Q = new $.OrthographicCamera(-V / 2, V / 2, E / 2, -E / 2, 0.1, t * 10);
1375
+ return Q.position.set(0, Y, t * 2), Q.lookAt(0, Y, 0), Q;
1376
1376
  }, [
1377
1377
  o,
1378
1378
  t,
1379
1379
  d,
1380
1380
  l
1381
1381
  ]);
1382
- K(() => {
1382
+ U(() => {
1383
1383
  if (e) return e.current = () => {
1384
1384
  const h = w();
1385
1385
  h && (m({
@@ -1394,40 +1394,40 @@ let __tla = (async () => {
1394
1394
  m,
1395
1395
  u
1396
1396
  ]);
1397
- const z = Q((h) => {
1398
- const C = h.position.clone(), P = C.length(), I = Math.atan2(C.x, C.z), _ = Math.acos(C.y / P), V = I + 0.02;
1399
- h.position.set(P * Math.sin(_) * Math.sin(V), P * Math.cos(_), P * Math.sin(_) * Math.cos(V)), h.lookAt(0, 0, 0), h.updateMatrixWorld(true), u();
1397
+ const M = J((h) => {
1398
+ const C = h.position.clone(), L = C.length(), _ = Math.atan2(C.x, C.z), D = Math.acos(C.y / L), V = _ + 0.02;
1399
+ h.position.set(L * Math.sin(D) * Math.sin(V), L * Math.cos(D), L * Math.sin(D) * Math.cos(V)), h.lookAt(0, 0, 0), h.updateMatrixWorld(true), u();
1400
1400
  }, [
1401
1401
  u
1402
1402
  ]);
1403
- return K(() => {
1403
+ return U(() => {
1404
1404
  if (t > 0 && !x.current && !r) {
1405
1405
  x.current = true;
1406
- const h = new O.PerspectiveCamera(50, d.width / d.height, 0.1, t * 10);
1406
+ const h = new $.PerspectiveCamera(50, d.width / d.height, 0.1, t * 10);
1407
1407
  h.position.set(t * 0.3, t * 0.2, t * 1.5), h.lookAt(0, 0, 0), m({
1408
1408
  camera: h
1409
- }), requestAnimationFrame(() => z(h));
1409
+ }), requestAnimationFrame(() => M(h));
1410
1410
  }
1411
1411
  }, [
1412
1412
  t,
1413
1413
  d,
1414
1414
  m,
1415
1415
  r,
1416
- z
1417
- ]), K(() => {
1416
+ M
1417
+ ]), U(() => {
1418
1418
  const h = b.current;
1419
- b.current = c, h === 0 && c === 1 && !r && requestAnimationFrame(() => z(f));
1419
+ b.current = c, h === 0 && c === 1 && !r && requestAnimationFrame(() => M(f));
1420
1420
  }, [
1421
1421
  c,
1422
1422
  r,
1423
1423
  f,
1424
- z
1425
- ]), K(() => {
1426
- const h = A.current !== r, C = L.current !== n, P = !v.current && !!l;
1427
- if (A.current = r, L.current = n, v.current = l, !h && !C && !P || !r || s !== "3D") return;
1428
- const I = w();
1429
- I && m({
1430
- camera: I
1424
+ M
1425
+ ]), U(() => {
1426
+ const h = A.current !== r, C = P.current !== n, L = !v.current && !!l;
1427
+ if (A.current = r, P.current = n, v.current = l, !h && !C && !L || !r || s !== "3D") return;
1428
+ const _ = w();
1429
+ _ && m({
1430
+ camera: _
1431
1431
  });
1432
1432
  }, [
1433
1433
  r,
@@ -1436,29 +1436,29 @@ let __tla = (async () => {
1436
1436
  l,
1437
1437
  w,
1438
1438
  m
1439
- ]), K(() => {
1439
+ ]), U(() => {
1440
1440
  if (S.current === s) return;
1441
1441
  const h = S.current;
1442
1442
  if (S.current = s, !(!r || !o || t <= 0)) {
1443
1443
  if (s === "2D" && a != null) {
1444
1444
  g.current = f;
1445
- const C = o.geometry, P = C.getAttribute("position"), I = P.array, _ = t * 0.15;
1446
- let E = 1 / 0, V = -1 / 0, Y = 1 / 0, q = -1 / 0, ye = false;
1447
- for (let he = 0; he < P.count; he++) if (Math.abs(I[he * 3 + 1] - a) < _) {
1448
- const $ = I[he * 3], ne = I[he * 3 + 2];
1449
- $ < E && (E = $), $ > V && (V = $), ne < Y && (Y = ne), ne > q && (q = ne), ye = true;
1445
+ const C = o.geometry, L = C.getAttribute("position"), _ = L.array, D = t * 0.15;
1446
+ let E = 1 / 0, V = -1 / 0, Y = 1 / 0, Q = -1 / 0, me = false;
1447
+ for (let ue = 0; ue < L.count; ue++) if (Math.abs(_[ue * 3 + 1] - a) < D) {
1448
+ const H = _[ue * 3], ee = _[ue * 3 + 2];
1449
+ H < E && (E = H), H > V && (V = H), ee < Y && (Y = ee), ee > Q && (Q = ee), me = true;
1450
1450
  }
1451
- if (!ye) {
1451
+ if (!me) {
1452
1452
  C.computeBoundingBox();
1453
- const he = C.boundingBox;
1454
- E = he.min.x, V = he.max.x, Y = he.min.z, q = he.max.z;
1453
+ const ue = C.boundingBox;
1454
+ E = ue.min.x, V = ue.max.x, Y = ue.min.z, Q = ue.max.z;
1455
1455
  }
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
- let Z, pe;
1458
- X / ue > se ? (Z = X, pe = X / se) : (pe = ue, Z = ue * se);
1459
- const me = new O.OrthographicCamera(-Z / 2, Z / 2, pe / 2, -pe / 2, 0.1, t * 10);
1460
- me.position.set(ae, a + t * 2, fe), me.up.set(0, 0, -1), me.lookAt(ae, a, fe), m({
1461
- camera: me
1456
+ const ie = (E + V) / 2, ce = (Y + Q) / 2, ne = d.width / d.height, q = 1.4, X = (V - E) * q, de = (Q - Y) * q;
1457
+ let Z, fe;
1458
+ X / de > ne ? (Z = X, fe = X / ne) : (fe = de, Z = de * ne);
1459
+ const he = new $.OrthographicCamera(-Z / 2, Z / 2, fe / 2, -fe / 2, 0.1, t * 10);
1460
+ he.position.set(ie, a + t * 2, ce), he.up.set(0, 0, -1), he.lookAt(ie, a, ce), m({
1461
+ camera: he
1462
1462
  });
1463
1463
  } else if (h === "2D") if (g.current) m({
1464
1464
  camera: g.current
@@ -1480,28 +1480,28 @@ let __tla = (async () => {
1480
1480
  m,
1481
1481
  f,
1482
1482
  w
1483
- ]), K(() => {
1483
+ ]), U(() => {
1484
1484
  if (!r || !f || !f.isOrthographicCamera) return;
1485
1485
  const h = f;
1486
1486
  if (s === "2D") {
1487
1487
  if (!o || a == null) return;
1488
- const C = o.geometry, P = C.getAttribute("position"), I = P.array, _ = t * 0.15;
1489
- let E = 1 / 0, V = -1 / 0, Y = 1 / 0, q = -1 / 0, ye = false;
1490
- for (let Z = 0; Z < P.count; Z++) if (Math.abs(I[Z * 3 + 1] - a) < _) {
1491
- const pe = I[Z * 3], me = I[Z * 3 + 2];
1492
- pe < E && (E = pe), pe > V && (V = pe), me < Y && (Y = me), me > q && (q = me), ye = true;
1488
+ const C = o.geometry, L = C.getAttribute("position"), _ = L.array, D = t * 0.15;
1489
+ let E = 1 / 0, V = -1 / 0, Y = 1 / 0, Q = -1 / 0, me = false;
1490
+ for (let Z = 0; Z < L.count; Z++) if (Math.abs(_[Z * 3 + 1] - a) < D) {
1491
+ const fe = _[Z * 3], he = _[Z * 3 + 2];
1492
+ fe < E && (E = fe), fe > V && (V = fe), he < Y && (Y = he), he > Q && (Q = he), me = true;
1493
1493
  }
1494
- if (!ye) {
1494
+ if (!me) {
1495
1495
  C.computeBoundingBox();
1496
1496
  const Z = C.boundingBox;
1497
- E = Z.min.x, V = Z.max.x, Y = Z.min.z, q = Z.max.z;
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, se = (V - E) * fe, ee = (q - Y) * fe;
1500
- let X, ue;
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;
1499
+ const ie = d.width / d.height, ce = 1.4, ne = (V - E) * ce, q = (Q - Y) * ce;
1500
+ let X, de;
1501
+ ne / q > ie ? (X = ne, de = ne / ie) : (de = q, X = q * ie), h.left = -X / 2, h.right = X / 2, h.top = de / 2, h.bottom = -de / 2;
1502
1502
  } else {
1503
- const C = p.current, P = d.width / d.height, I = Math.max(C.y, C.x / P) * 1.6, _ = I * P;
1504
- h.left = -_ / 2, h.right = _ / 2, h.top = I / 2, h.bottom = -I / 2;
1503
+ const C = p.current, L = d.width / d.height, _ = Math.max(C.y, C.x / L) * 1.6, D = _ * L;
1504
+ h.left = -D / 2, h.right = D / 2, h.top = _ / 2, h.bottom = -_ / 2;
1505
1505
  }
1506
1506
  h.updateProjectionMatrix();
1507
1507
  }, [
@@ -1512,12 +1512,12 @@ let __tla = (async () => {
1512
1512
  s,
1513
1513
  o
1514
1514
  ]), null;
1515
- }, jo = ({ mesh: t, isDragging: r }) => {
1515
+ }, zo = ({ mesh: t, isDragging: r }) => {
1516
1516
  var _a;
1517
1517
  const n = t.geometry;
1518
1518
  n.computeBoundingBox();
1519
- const o = new M();
1520
- return (_a = n.boundingBox) == null ? void 0 : _a.getCenter(o), i(yn, {
1519
+ const o = new z();
1520
+ return (_a = n.boundingBox) == null ? void 0 : _a.getCenter(o), i(nn, {
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
- }, No = ({ wasAutoScaled: t, onDismiss: r }) => F("div", {
1534
+ }, Mo = ({ 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
- }), Yo = ({ isDoubleShell: t, onDismiss: r }) => F("div", {
1575
+ }), Ao = ({ 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
- }), Xo = ({ steps: t, currentStep: r, accentColor: n = "rgb(12, 67, 173)" }) => i("div", {
1616
+ }), ko = ({ 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,47 +1677,47 @@ let __tla = (async () => {
1677
1677
  ]
1678
1678
  }, o.number);
1679
1679
  })
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
1680
+ }), Fo = ({ mesh: t, upperY: r, originY: n, modelSize: o, meshColor: s = "#c8c8c8", displayUnit: a = "mm" }) => {
1681
+ const c = t.geometry, l = j(() => new ft(c, {
1682
+ maxLeafTris: ut
1683
1683
  }), [
1684
1684
  c
1685
- ]), e = H(() => Ge(l, c, n), [
1685
+ ]), e = j(() => Te(l, c, n), [
1686
1686
  l,
1687
1687
  c,
1688
1688
  n
1689
- ]), m = H(() => new wt(new M(0, -1, 0), r), [
1689
+ ]), m = j(() => new dt(new z(0, -1, 0), r), [
1690
1690
  r
1691
- ]), { mlLine: d, apLine: f, mlWidth: u, apWidth: x } = H(() => {
1692
- let g = null, b = null, A = 0, L = 0;
1691
+ ]), { mlLine: d, apLine: f, mlWidth: u, apWidth: x } = j(() => {
1692
+ let g = null, b = null, A = 0, P = 0;
1693
1693
  if (e.linePoints.length >= 2) {
1694
- let v = e.linePoints[0], k = e.linePoints[0], w = e.linePoints[0], z = e.linePoints[0];
1695
- for (const h of e.linePoints) h.x < v.x && (v = h), h.x > k.x && (k = h), h.z < w.z && (w = h), h.z > z.z && (z = h);
1694
+ let v = e.linePoints[0], k = e.linePoints[0], w = e.linePoints[0], M = e.linePoints[0];
1695
+ for (const h of e.linePoints) h.x < v.x && (v = h), h.x > k.x && (k = h), h.z < w.z && (w = h), h.z > M.z && (M = h);
1696
1696
  g = [
1697
- new M(v.x, n, v.z),
1698
- new M(k.x, n, k.z)
1697
+ new z(v.x, n, v.z),
1698
+ new z(k.x, n, k.z)
1699
1699
  ], b = [
1700
- new M(w.x, n, w.z),
1701
- new M(z.x, n, z.z)
1702
- ], A = g[0].distanceTo(g[1]), L = b[0].distanceTo(b[1]);
1700
+ new z(w.x, n, w.z),
1701
+ new z(M.x, n, M.z)
1702
+ ], A = g[0].distanceTo(g[1]), P = b[0].distanceTo(b[1]);
1703
1703
  }
1704
1704
  return {
1705
1705
  mlLine: g,
1706
1706
  apLine: b,
1707
1707
  mlWidth: A,
1708
- apWidth: L
1708
+ apWidth: P
1709
1709
  };
1710
1710
  }, [
1711
1711
  e,
1712
1712
  n
1713
1713
  ]), S = (g) => a === "inch" ? (g / 25.4).toFixed(2) : g.toFixed(1), p = a === "inch" ? "in" : "mm";
1714
- return F(He, {
1714
+ return F(We, {
1715
1715
  children: [
1716
1716
  i("mesh", {
1717
1717
  geometry: t.geometry,
1718
1718
  children: i("meshStandardMaterial", {
1719
1719
  color: s,
1720
- side: O.DoubleSide,
1720
+ side: $.DoubleSide,
1721
1721
  transparent: true,
1722
1722
  opacity: 0.15,
1723
1723
  depthWrite: false,
@@ -1726,7 +1726,7 @@ let __tla = (async () => {
1726
1726
  ]
1727
1727
  })
1728
1728
  }),
1729
- e.linePoints.length >= 2 && i(de, {
1729
+ e.linePoints.length >= 2 && i(ae, {
1730
1730
  points: e.linePoints,
1731
1731
  color: "#00ff00",
1732
1732
  lineWidth: 3,
@@ -1734,9 +1734,9 @@ let __tla = (async () => {
1734
1734
  depthWrite: false,
1735
1735
  transparent: true
1736
1736
  }),
1737
- d && F(He, {
1737
+ d && F(We, {
1738
1738
  children: [
1739
- i(de, {
1739
+ i(ae, {
1740
1740
  points: d,
1741
1741
  color: "#ff8800",
1742
1742
  lineWidth: 2,
@@ -1744,7 +1744,7 @@ let __tla = (async () => {
1744
1744
  depthWrite: false,
1745
1745
  transparent: true
1746
1746
  }),
1747
- i(Ze, {
1747
+ i(Oe, {
1748
1748
  position: [
1749
1749
  d[0].x,
1750
1750
  n,
@@ -1778,9 +1778,9 @@ let __tla = (async () => {
1778
1778
  })
1779
1779
  ]
1780
1780
  }),
1781
- f && F(He, {
1781
+ f && F(We, {
1782
1782
  children: [
1783
- i(de, {
1783
+ i(ae, {
1784
1784
  points: f,
1785
1785
  color: "#ff00ff",
1786
1786
  lineWidth: 2,
@@ -1788,7 +1788,7 @@ let __tla = (async () => {
1788
1788
  depthWrite: false,
1789
1789
  transparent: true
1790
1790
  }),
1791
- i(Ze, {
1791
+ i(Oe, {
1792
1792
  position: [
1793
1793
  Math.max(f[0].x, f[1].x) + o * 0.02,
1794
1794
  n,
@@ -1824,61 +1824,61 @@ let __tla = (async () => {
1824
1824
  })
1825
1825
  ]
1826
1826
  });
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) : {
1827
+ }, Lo = ({ 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] = R(false), [S, p] = R(false), { camera: g, gl: b } = tn(), A = re(0), P = t.geometry, v = fn(P), k = j(() => v ? Te(v, P, r) : {
1829
1829
  linePoints: [],
1830
1830
  lineLength: 0,
1831
- rightmostPoint: new M()
1831
+ rightmostPoint: new z()
1832
1832
  }, [
1833
1833
  v,
1834
- L,
1834
+ P,
1835
1835
  r
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 fo();
1838
- q.setFromCamera(new O.Vector2(V, Y), g);
1839
- const ye = new wt(new M(0, 0, 1), 0), ae = new M();
1840
- return q.ray.intersectPlane(ye, ae), ae ? ae.y : r;
1836
+ ]), w = J((_, D) => {
1837
+ const E = b.domElement.getBoundingClientRect(), V = (_ - E.left) / E.width * 2 - 1, Y = -((D - E.top) / E.height) * 2 + 1, Q = new Gn();
1838
+ Q.setFromCamera(new $.Vector2(V, Y), g);
1839
+ const me = new dt(new z(0, 0, 1), 0), ie = new z();
1840
+ return Q.ray.intersectPlane(me, ie), ie ? ie.y : r;
1841
1841
  }, [
1842
1842
  g,
1843
1843
  b,
1844
1844
  r
1845
- ]), z = Q((I) => {
1846
- I.stopPropagation(), x(true), b.domElement.style.cursor = "ns-resize", A.current = r - w(I.clientX, I.clientY), I.target.setPointerCapture(I.pointerId), d == null ? void 0 : d();
1845
+ ]), M = J((_) => {
1846
+ _.stopPropagation(), x(true), b.domElement.style.cursor = "ns-resize", A.current = r - w(_.clientX, _.clientY), _.target.setPointerCapture(_.pointerId), d == null ? void 0 : d();
1847
1847
  }, [
1848
1848
  r,
1849
1849
  b,
1850
1850
  w,
1851
1851
  d
1852
- ]), h = Q((I) => {
1852
+ ]), h = J((_) => {
1853
1853
  if (!u) return;
1854
- let _ = w(I.clientX, I.clientY) + A.current;
1855
- _ = Math.max(o, Math.min(s, _)), n(_);
1854
+ let D = w(_.clientX, _.clientY) + A.current;
1855
+ D = Math.max(o, Math.min(s, D)), n(D);
1856
1856
  }, [
1857
1857
  u,
1858
1858
  w,
1859
1859
  n,
1860
1860
  o,
1861
1861
  s
1862
- ]), C = Q((I) => {
1863
- x(false), b.domElement.style.cursor = "auto", I.target.releasePointerCapture(I.pointerId), f == null ? void 0 : f();
1862
+ ]), C = J((_) => {
1863
+ x(false), b.domElement.style.cursor = "auto", _.target.releasePointerCapture(_.pointerId), f == null ? void 0 : f();
1864
1864
  }, [
1865
1865
  b,
1866
1866
  f
1867
1867
  ]);
1868
1868
  if (k.linePoints.length < 2) return null;
1869
- const P = u ? e : S ? l : c;
1869
+ const L = u ? e : S ? l : c;
1870
1870
  return F("group", {
1871
1871
  renderOrder: 10,
1872
1872
  children: [
1873
- i(de, {
1873
+ i(ae, {
1874
1874
  points: k.linePoints,
1875
- color: P,
1875
+ color: L,
1876
1876
  lineWidth: u ? 6 : S ? 5 : 4,
1877
1877
  depthTest: false,
1878
1878
  depthWrite: false,
1879
1879
  transparent: true,
1880
1880
  renderOrder: 10,
1881
- onPointerDown: z,
1881
+ onPointerDown: M,
1882
1882
  onPointerMove: h,
1883
1883
  onPointerUp: C,
1884
1884
  onPointerEnter: () => {
@@ -1894,14 +1894,14 @@ let __tla = (async () => {
1894
1894
  r,
1895
1895
  0
1896
1896
  ],
1897
- children: i(Ze, {
1897
+ children: i(Oe, {
1898
1898
  center: true,
1899
1899
  children: i("div", {
1900
1900
  style: {
1901
1901
  padding: "4px 8px",
1902
1902
  backgroundColor: "rgba(0, 0, 0, 0.8)",
1903
1903
  borderRadius: 4,
1904
- color: P,
1904
+ color: L,
1905
1905
  fontSize: 11,
1906
1906
  whiteSpace: "nowrap",
1907
1907
  pointerEvents: "none"
@@ -1913,17 +1913,17 @@ let __tla = (async () => {
1913
1913
  ]
1914
1914
  });
1915
1915
  };
1916
- function Ko(t, r) {
1916
+ function Po(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 Uo = [
1922
+ var _o = [
1923
1923
  "color"
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({
1924
+ ], Do = Vn(function(t, r) {
1925
+ var n = t.color, o = n === void 0 ? "currentColor" : n, s = Po(t, _o);
1926
+ return Yt("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
- }), cn("path", {
1934
+ }), Yt("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 Qo = [
1941
+ const Io = [
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
- ], mt = {
1947
+ ], st = {
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
- }, qo = {
1956
+ }, Wo = {
1957
1957
  width: "100%",
1958
1958
  padding: "10px 12px",
1959
1959
  fontSize: 15,
@@ -1962,15 +1962,15 @@ let __tla = (async () => {
1962
1962
  outline: "none",
1963
1963
  boxSizing: "border-box",
1964
1964
  fontFamily: "system-ui, sans-serif"
1965
- }, Fn = ({ onSkip: t, onCancel: r }) => {
1966
- const [n, o] = B("confirm"), [s, a] = B(null), [c, l] = B(""), e = Q(() => {
1965
+ }, un = ({ onSkip: t, onCancel: r }) => {
1966
+ const [n, o] = R("confirm"), [s, a] = R(null), [c, l] = R(""), e = J(() => {
1967
1967
  o("reasons");
1968
- }, []), m = Q(() => {
1968
+ }, []), m = J(() => {
1969
1969
  n === "reasons" ? (o("confirm"), a(null), l("")) : r();
1970
1970
  }, [
1971
1971
  n,
1972
1972
  r
1973
- ]), d = s != null && (s !== "Other" || c.trim() !== ""), f = Q(() => {
1973
+ ]), d = s != null && (s !== "Other" || c.trim() !== ""), f = J(() => {
1974
1974
  !d || !s || t(s === "Other" ? `Other: ${c.trim()}` : s);
1975
1975
  }, [
1976
1976
  d,
@@ -2031,7 +2031,7 @@ let __tla = (async () => {
2031
2031
  },
2032
2032
  children: [
2033
2033
  [
2034
- ...Qo,
2034
+ ...Io,
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
- ...qo,
2081
+ ...Wo,
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
- ...mt,
2102
+ ...st,
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
- ...mt,
2113
+ ...st,
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
- ...mt,
2174
+ ...st,
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
- ...mt,
2184
+ ...st,
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
- }, Ht = {
2196
+ }, Ft = {
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
- }, mn = {
2205
+ }, qt = {
2206
2206
  width: "100%",
2207
2207
  padding: "10px 12px",
2208
2208
  fontSize: 15,
@@ -2211,8 +2211,8 @@ let __tla = (async () => {
2211
2211
  outline: "none",
2212
2212
  boxSizing: "border-box",
2213
2213
  fontFamily: "system-ui, sans-serif"
2214
- }, er = ({ amputationType: t, spacingInches: r, scanMeasurements: n, scanFrontalHeight: o, onSave: s, onSkip: a, onFormChange: c, onHeightChange: l, initialValues: e, initialFrontalHeight: m }) => {
2215
- const d = t === "AK" ? "IT" : "MPT", f = r, u = t === "AK" ? 18 : 9, x = H(() => {
2214
+ }, Ro = ({ amputationType: t, spacingInches: r, scanMeasurements: n, scanFrontalHeight: o, onSave: s, onSkip: a, onFormChange: c, onHeightChange: l, initialValues: e, initialFrontalHeight: m }) => {
2215
+ const d = t === "AK" ? "IT" : "MPT", f = r, u = t === "AK" ? 18 : 9, x = j(() => {
2216
2216
  const h = [];
2217
2217
  for (let C = 2; C >= 1; C -= f) h.push(`${C}\u2033 above ${d}`);
2218
2218
  h.push(`At ${d}`);
@@ -2222,38 +2222,38 @@ let __tla = (async () => {
2222
2222
  f,
2223
2223
  d,
2224
2224
  u
2225
- ]), [S, p] = B(() => {
2225
+ ]), [S, p] = R(() => {
2226
2226
  if (!e) return {};
2227
2227
  const h = {};
2228
- return x.forEach((C, P) => {
2229
- e[P] != null && e[P] !== 0 && (h[C] = e[P].toFixed(1));
2228
+ return x.forEach((C, L) => {
2229
+ e[L] != null && e[L] !== 0 && (h[C] = e[L].toFixed(1));
2230
2230
  }), h;
2231
- }), [g, b] = B(m && m > 0 ? m.toFixed(1) : ""), [A, L] = B(false), v = H(() => x.map((h) => {
2231
+ }), [g, b] = R(m && m > 0 ? m.toFixed(1) : ""), [A, P] = R(false), v = j(() => x.map((h) => {
2232
2232
  const C = S[h];
2233
2233
  return C != null && C !== "" && !isNaN(parseFloat(C)) ? parseFloat(C) : 0;
2234
2234
  }), [
2235
2235
  x,
2236
2236
  S
2237
2237
  ]);
2238
- K(() => {
2238
+ U(() => {
2239
2239
  c == null ? void 0 : c(v);
2240
2240
  }, [
2241
2241
  v,
2242
2242
  c
2243
- ]), K(() => {
2243
+ ]), U(() => {
2244
2244
  const h = g !== "" && !isNaN(parseFloat(g)) ? parseFloat(g) : void 0;
2245
2245
  l == null ? void 0 : l(h);
2246
2246
  }, [
2247
2247
  g,
2248
2248
  l
2249
2249
  ]);
2250
- const k = H(() => {
2251
- const h = g !== "" && !isNaN(parseFloat(g)), C = v.some((P) => P !== 0);
2250
+ const k = j(() => {
2251
+ const h = g !== "" && !isNaN(parseFloat(g)), C = v.some((L) => L !== 0);
2252
2252
  return h || C;
2253
2253
  }, [
2254
2254
  v,
2255
2255
  g
2256
- ]), w = Q(() => {
2256
+ ]), w = J(() => {
2257
2257
  if (!k) return;
2258
2258
  const h = g !== "" && !isNaN(parseFloat(g)) ? parseFloat(g) : 0;
2259
2259
  s({
@@ -2265,13 +2265,13 @@ let __tla = (async () => {
2265
2265
  v,
2266
2266
  g,
2267
2267
  s
2268
- ]), z = Q(() => {
2268
+ ]), M = J(() => {
2269
2269
  const h = {};
2270
- x.forEach((C, P) => {
2271
- const I = n[P];
2272
- if (I) {
2273
- const _ = I.modifiedValue ?? I.originalValue;
2274
- h[C] = _.toFixed(1);
2270
+ x.forEach((C, L) => {
2271
+ const _ = n[L];
2272
+ if (_) {
2273
+ const D = _.modifiedValue ?? _.originalValue;
2274
+ h[C] = D.toFixed(1);
2275
2275
  }
2276
2276
  }), p(h), o > 0 && b(o.toFixed(1));
2277
2277
  }, [
@@ -2288,9 +2288,9 @@ let __tla = (async () => {
2288
2288
  fontFamily: "system-ui, sans-serif"
2289
2289
  },
2290
2290
  children: [
2291
- A && i(Fn, {
2291
+ A && i(un, {
2292
2292
  onSkip: a,
2293
- onCancel: () => L(false)
2293
+ onCancel: () => P(false)
2294
2294
  }),
2295
2295
  F("div", {
2296
2296
  style: {
@@ -2325,9 +2325,9 @@ let __tla = (async () => {
2325
2325
  ]
2326
2326
  }),
2327
2327
  i("button", {
2328
- onClick: z,
2328
+ onClick: M,
2329
2329
  style: {
2330
- ...Ht,
2330
+ ...Ft,
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(Jo, {
2348
+ i(Do, {
2349
2349
  style: {
2350
2350
  width: 14,
2351
2351
  height: 14
@@ -2403,12 +2403,12 @@ let __tla = (async () => {
2403
2403
  type: "number",
2404
2404
  step: "0.1",
2405
2405
  value: S[h] ?? "",
2406
- onChange: (P) => p((I) => ({
2407
- ...I,
2408
- [h]: P.target.value
2406
+ onChange: (L) => p((_) => ({
2407
+ ..._,
2408
+ [h]: L.target.value
2409
2409
  })),
2410
2410
  style: {
2411
- ...mn,
2411
+ ...qt,
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
- ...mn,
2454
+ ...qt,
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
- ...Ht,
2481
+ ...Ft,
2482
2482
  backgroundColor: k ? "rgb(12, 67, 173)" : "#e0e0e0",
2483
2483
  border: "none",
2484
2484
  color: k ? "#fff" : "#9e9e9e",
@@ -2490,9 +2490,9 @@ let __tla = (async () => {
2490
2490
  children: "Save Measurements"
2491
2491
  }),
2492
2492
  i("button", {
2493
- onClick: () => L(true),
2493
+ onClick: () => P(true),
2494
2494
  style: {
2495
- ...Ht,
2495
+ ...Ft,
2496
2496
  backgroundColor: "#fff",
2497
2497
  border: "1px solid #bdbdbd",
2498
2498
  color: "#666",
@@ -2507,37 +2507,37 @@ let __tla = (async () => {
2507
2507
  ]
2508
2508
  });
2509
2509
  };
2510
- function Pn(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 = [];
2514
2514
  for (let g = 0; g < a; g++) {
2515
2515
  const b = r + g * c, A = r + (g + 1) * c;
2516
- let L = 0, v = 0, k = 0, w = 0;
2517
- for (let z = 0; z < o.count; z++) {
2518
- const h = o.getY(z);
2519
- h >= b && h < A && (L += o.getX(z), v += h, k += o.getZ(z), w++);
2516
+ let P = 0, v = 0, k = 0, w = 0;
2517
+ for (let M = 0; M < o.count; M++) {
2518
+ const h = o.getY(M);
2519
+ h >= b && h < A && (P += o.getX(M), v += h, k += o.getZ(M), w++);
2520
2520
  }
2521
- w > 20 && l.push(new M(L / w, v / w, k / w));
2521
+ w > 20 && l.push(new z(P / w, v / w, k / w));
2522
2522
  }
2523
2523
  if (l.length < 5) return null;
2524
- const e = new M();
2524
+ const e = new z();
2525
2525
  for (const g of l) e.add(g);
2526
2526
  e.divideScalar(l.length);
2527
2527
  let m = 0, d = 0, f = 0, u = 0, x = 0, S = 0;
2528
2528
  for (const g of l) {
2529
- const b = g.x - e.x, A = g.y - e.y, L = g.z - e.z;
2530
- m += b * b, d += b * A, f += b * L, u += A * A, x += A * L, S += L * L;
2529
+ const b = g.x - e.x, A = g.y - e.y, P = g.z - e.z;
2530
+ m += b * b, d += b * A, f += b * P, u += A * A, x += A * P, S += P * P;
2531
2531
  }
2532
- let p = new M(0.01, 1, 0.01).normalize();
2532
+ let p = new z(0.01, 1, 0.01).normalize();
2533
2533
  for (let g = 0; g < 30; g++) {
2534
- const b = m * p.x + d * p.y + f * p.z, A = d * p.x + u * p.y + x * p.z, L = f * p.x + x * p.y + S * p.z, v = new M(b, A, L), k = v.length();
2534
+ const b = m * p.x + d * p.y + f * p.z, A = d * p.x + u * p.y + x * p.z, P = f * p.x + x * p.y + S * p.z, v = new z(b, A, P), k = v.length();
2535
2535
  if (k < 1e-10 || (v.divideScalar(k), p.distanceTo(v) < 1e-8)) break;
2536
2536
  p = v;
2537
2537
  }
2538
2538
  return p.y < 0 && p.negate(), p;
2539
2539
  }
2540
- const tr = {
2540
+ const Bo = {
2541
2541
  pcaAxes: true,
2542
2542
  obb: true,
2543
2543
  obbAxis: true,
@@ -2547,13 +2547,13 @@ let __tla = (async () => {
2547
2547
  landmarkAxis: true,
2548
2548
  iterativePCA: false,
2549
2549
  fullRegionPCA: true
2550
- }, nr = [
2550
+ }, Eo = [
2551
2551
  "#ff4444",
2552
2552
  "#44cc44",
2553
2553
  "#4488ff"
2554
2554
  ];
2555
- function Ln(t) {
2556
- const r = t.getAttribute("position"), n = r.count, o = new M();
2555
+ function hn(t) {
2556
+ const r = t.getAttribute("position"), n = r.count, o = new z();
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);
2559
2559
  let s = 0, a = 0, c = 0, l = 0, e = 0, m = 0;
@@ -2580,9 +2580,9 @@ let __tla = (async () => {
2580
2580
  ]
2581
2581
  ];
2582
2582
  for (let p = 0; p < 3; p++) {
2583
- let g = new M(1 + p * 0.1, 1 - p * 0.1, 0.5 + p * 0.3).normalize(), b = 0;
2583
+ let g = new z(1 + p * 0.1, 1 - p * 0.1, 0.5 + p * 0.3).normalize(), b = 0;
2584
2584
  for (let A = 0; A < 100; A++) {
2585
- const L = u[0][0] * g.x + u[0][1] * g.y + u[0][2] * g.z, v = u[1][0] * g.x + u[1][1] * g.y + u[1][2] * g.z, k = u[2][0] * g.x + u[2][1] * g.y + u[2][2] * g.z, w = new M(L, v, k);
2585
+ const P = u[0][0] * g.x + u[0][1] * g.y + u[0][2] * g.z, v = u[1][0] * g.x + u[1][1] * g.y + u[1][2] * g.z, k = u[2][0] * g.x + u[2][1] * g.y + u[2][2] * g.z, w = new z(P, v, k);
2586
2586
  if (b = w.length(), b < 1e-12) break;
2587
2587
  if (w.divideScalar(b), g.distanceTo(w) < 1e-10) {
2588
2588
  g = w;
@@ -2591,7 +2591,7 @@ let __tla = (async () => {
2591
2591
  g = w;
2592
2592
  }
2593
2593
  d.push(g.clone()), f.push(b);
2594
- for (let A = 0; A < 3; A++) for (let L = 0; L < 3; L++) {
2594
+ for (let A = 0; A < 3; A++) for (let P = 0; P < 3; P++) {
2595
2595
  const v = [
2596
2596
  g.x,
2597
2597
  g.y,
@@ -2600,11 +2600,11 @@ let __tla = (async () => {
2600
2600
  g.x,
2601
2601
  g.y,
2602
2602
  g.z
2603
- ][L];
2604
- u[A][L] -= b * v * k;
2603
+ ][P];
2604
+ u[A][P] -= b * v * k;
2605
2605
  }
2606
2606
  }
2607
- const x = new M();
2607
+ const x = new z();
2608
2608
  for (let p = 0; p < n; p++) x.x += r.getX(p), x.y += r.getY(p), x.z += r.getZ(p);
2609
2609
  x.divideScalar(n);
2610
2610
  const S = [
@@ -2615,9 +2615,9 @@ let __tla = (async () => {
2615
2615
  for (let p = 0; p < 3; p++) {
2616
2616
  let g = 1 / 0, b = -1 / 0;
2617
2617
  const A = d[p];
2618
- for (let L = 0; L < n; L++) {
2619
- const v = r.getX(L) - x.x, k = r.getY(L) - x.y, w = r.getZ(L) - x.z, z = v * A.x + k * A.y + w * A.z;
2620
- z < g && (g = z), z > b && (b = z);
2618
+ for (let P = 0; P < n; P++) {
2619
+ const v = r.getX(P) - x.x, k = r.getY(P) - x.y, w = r.getZ(P) - x.z, M = v * A.x + k * A.y + w * A.z;
2620
+ M < g && (g = M), M > b && (b = M);
2621
2621
  }
2622
2622
  S[p] = (b - g) / 2;
2623
2623
  }
@@ -2628,23 +2628,23 @@ let __tla = (async () => {
2628
2628
  halfExtents: S
2629
2629
  };
2630
2630
  }
2631
- function or({ pca: t }) {
2631
+ function To({ 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]);
2635
- return i(de, {
2635
+ return i(ae, {
2636
2636
  points: [
2637
2637
  s,
2638
2638
  o
2639
2639
  ],
2640
- color: nr[n],
2640
+ color: Eo[n],
2641
2641
  lineWidth: 2
2642
2642
  }, n);
2643
2643
  })
2644
2644
  });
2645
2645
  }
2646
- function rr({ pca: t }) {
2647
- const r = H(() => {
2646
+ function Oo({ pca: t }) {
2647
+ const r = j(() => {
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]));
2650
2650
  return [
@@ -2704,7 +2704,7 @@ let __tla = (async () => {
2704
2704
  t
2705
2705
  ]);
2706
2706
  return i("group", {
2707
- children: r.map((n, o) => i(de, {
2707
+ children: r.map((n, o) => i(ae, {
2708
2708
  points: n,
2709
2709
  color: "#ffaa00",
2710
2710
  lineWidth: 1,
@@ -2713,19 +2713,19 @@ let __tla = (async () => {
2713
2713
  }, o))
2714
2714
  });
2715
2715
  }
2716
- function ir({ redPoint: t, greenPoint: r }) {
2717
- const n = H(() => new M().subVectors(r, t).normalize(), [
2716
+ function $o({ redPoint: t, greenPoint: r }) {
2717
+ const n = j(() => new z().subVectors(r, t).normalize(), [
2718
2718
  t,
2719
2719
  r
2720
- ]), o = H(() => {
2721
- const a = n.dot(new M(0, 1, 0));
2720
+ ]), o = j(() => {
2721
+ const a = n.dot(new z(0, 1, 0));
2722
2722
  return Math.acos(Math.min(1, Math.abs(a))) * 180 / Math.PI;
2723
2723
  }, [
2724
2724
  n
2725
2725
  ]), s = o < 1 ? "#44ff44" : o < 5 ? "#ffcc00" : "#ff4444";
2726
2726
  return F("group", {
2727
2727
  children: [
2728
- i(de, {
2728
+ i(ae, {
2729
2729
  points: [
2730
2730
  t,
2731
2731
  r
@@ -2766,13 +2766,13 @@ let __tla = (async () => {
2766
2766
  ]
2767
2767
  });
2768
2768
  }
2769
- function sr({ geometry: t, redY: r, greenY: n, modelSize: o }) {
2770
- const a = o * 0.15, c = H(() => {
2769
+ function Ho({ geometry: t, redY: r, greenY: n, modelSize: o }) {
2770
+ const a = o * 0.15, c = j(() => {
2771
2771
  const l = [];
2772
2772
  let e = n - 10;
2773
- const m = new M(0, 1, 0);
2773
+ const m = new z(0, 1, 0);
2774
2774
  for (; e > r; ) {
2775
- const d = Math.min(e, n), f = Math.max(e, n), u = Pn(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({
@@ -2792,10 +2792,10 @@ let __tla = (async () => {
2792
2792
  ]);
2793
2793
  return i("group", {
2794
2794
  children: c.map((l, e) => {
2795
- const m = (l.regionMin + l.regionMax) / 2, d = new M(0, m, 0), f = d.clone().addScaledVector(l.axis, a), u = d.clone().addScaledVector(l.axis, -a), x = e / Math.max(1, c.length - 1), S = l.angleDeg < 0.5 ? `hsl(${120 - x * 120}, 80%, 60%)` : `hsl(${40 - l.angleDeg * 2}, 90%, 55%)`;
2795
+ const m = (l.regionMin + l.regionMax) / 2, d = new z(0, m, 0), f = d.clone().addScaledVector(l.axis, a), u = d.clone().addScaledVector(l.axis, -a), x = e / Math.max(1, c.length - 1), S = l.angleDeg < 0.5 ? `hsl(${120 - x * 120}, 80%, 60%)` : `hsl(${40 - l.angleDeg * 2}, 90%, 55%)`;
2796
2796
  return F("group", {
2797
2797
  children: [
2798
- i(de, {
2798
+ i(ae, {
2799
2799
  points: [
2800
2800
  u,
2801
2801
  f
@@ -2805,10 +2805,10 @@ let __tla = (async () => {
2805
2805
  transparent: true,
2806
2806
  opacity: 0.7
2807
2807
  }),
2808
- i(de, {
2808
+ i(ae, {
2809
2809
  points: [
2810
- new M(-a * 0.3, l.regionMin, 0),
2811
- new M(a * 0.3, l.regionMin, 0)
2810
+ new z(-a * 0.3, l.regionMin, 0),
2811
+ new z(a * 0.3, l.regionMin, 0)
2812
2812
  ],
2813
2813
  color: S,
2814
2814
  lineWidth: 0.5,
@@ -2820,11 +2820,11 @@ let __tla = (async () => {
2820
2820
  })
2821
2821
  });
2822
2822
  }
2823
- function lr({ geometry: t, redY: r, greenY: n, modelSize: o }) {
2824
- const s = H(() => {
2825
- const f = Pn(t, r, n);
2823
+ function jo({ geometry: t, redY: r, greenY: n, modelSize: o }) {
2824
+ const s = j(() => {
2825
+ const f = pn(t, r, n);
2826
2826
  if (!f) return null;
2827
- const u = f.dot(new M(0, 1, 0)), x = Math.acos(Math.min(1, Math.abs(u))) * 180 / Math.PI;
2827
+ const u = f.dot(new z(0, 1, 0)), x = Math.acos(Math.min(1, Math.abs(u))) * 180 / Math.PI;
2828
2828
  return {
2829
2829
  axis: f,
2830
2830
  angleDeg: x
@@ -2835,9 +2835,9 @@ let __tla = (async () => {
2835
2835
  n
2836
2836
  ]);
2837
2837
  if (!s) return null;
2838
- const a = (r + n) / 2, c = new M(0, a, 0), l = o * 0.4, e = c.clone().addScaledVector(s.axis, l), m = c.clone().addScaledVector(s.axis, -l), d = s.angleDeg < 0.5 ? "#00ffff" : s.angleDeg < 2 ? "#ffcc00" : "#ff6600";
2838
+ const a = (r + n) / 2, c = new z(0, a, 0), l = o * 0.4, e = c.clone().addScaledVector(s.axis, l), m = c.clone().addScaledVector(s.axis, -l), d = s.angleDeg < 0.5 ? "#00ffff" : s.angleDeg < 2 ? "#ffcc00" : "#ff6600";
2839
2839
  return i("group", {
2840
- children: i(de, {
2840
+ children: i(ae, {
2841
2841
  points: [
2842
2842
  m,
2843
2843
  e
@@ -2850,9 +2850,9 @@ let __tla = (async () => {
2850
2850
  })
2851
2851
  });
2852
2852
  }
2853
- function ar({ pca: t, modelSize: r }) {
2853
+ function Vo({ 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
- return i(de, {
2855
+ return i(ae, {
2856
2856
  points: [
2857
2857
  a,
2858
2858
  s
@@ -2864,24 +2864,24 @@ let __tla = (async () => {
2864
2864
  gapSize: 2
2865
2865
  });
2866
2866
  }
2867
- function cr({ geometry: t, redY: r, greenY: n, modelSize: o, measurementGeometry: s }) {
2868
- const a = H(() => {
2869
- const d = s ?? t, f = jt(d), u = new M(0, 1, 0), x = 5, p = n + 3 * 25.4, g = [];
2867
+ function No({ geometry: t, redY: r, greenY: n, modelSize: o, measurementGeometry: s }) {
2868
+ const a = j(() => {
2869
+ const d = s ?? t, f = Pt(d), u = new z(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 = zo(f, d, new M(0, h, 0), u);
2871
+ const C = io(f, d, new z(0, h, 0), u);
2872
2872
  C > 0 && g.push({
2873
2873
  y: h,
2874
2874
  circ: C
2875
2875
  });
2876
2876
  }
2877
2877
  if (g.length < 5) return null;
2878
- const b = n - r, A = r + b * 0.3, L = r + b * 0.7, v = g.filter((h) => h.y >= A && h.y <= L);
2878
+ const b = n - r, A = r + b * 0.3, P = r + b * 0.7, v = g.filter((h) => h.y >= A && h.y <= P);
2879
2879
  if (v.length < 3) return null;
2880
- const k = v.map((h) => h.circ).sort((h, C) => h - C), w = k[Math.floor(k.length / 2)], z = Math.max(...g.map((h) => h.circ));
2880
+ const k = v.map((h) => h.circ).sort((h, C) => h - C), w = k[Math.floor(k.length / 2)], M = Math.max(...g.map((h) => h.circ));
2881
2881
  return {
2882
2882
  circumferences: g,
2883
2883
  baseline: w,
2884
- maxCirc: z
2884
+ maxCirc: M
2885
2885
  };
2886
2886
  }, [
2887
2887
  t,
@@ -2894,10 +2894,10 @@ let __tla = (async () => {
2894
2894
  children: [
2895
2895
  c.map(({ y: d, circ: f }, u) => {
2896
2896
  const x = f / l, S = x > 1.6 ? "#ff4444" : x > 1.3 ? "#ffcc00" : "#22cc66", p = f * m;
2897
- return i(de, {
2897
+ return i(ae, {
2898
2898
  points: [
2899
- new M(-p, d, 0),
2900
- new M(p, d, 0)
2899
+ new z(-p, d, 0),
2900
+ new z(p, d, 0)
2901
2901
  ],
2902
2902
  color: S,
2903
2903
  lineWidth: 1.5,
@@ -2907,12 +2907,12 @@ let __tla = (async () => {
2907
2907
  }),
2908
2908
  (() => {
2909
2909
  const d = l * 1.6 * m, f = c[0].y, u = c[c.length - 1].y;
2910
- return F(He, {
2910
+ return F(We, {
2911
2911
  children: [
2912
- i(de, {
2912
+ i(ae, {
2913
2913
  points: [
2914
- new M(-d, f, 0),
2915
- new M(-d, u, 0)
2914
+ new z(-d, f, 0),
2915
+ new z(-d, u, 0)
2916
2916
  ],
2917
2917
  color: "#ff4444",
2918
2918
  lineWidth: 1,
@@ -2922,10 +2922,10 @@ let __tla = (async () => {
2922
2922
  transparent: true,
2923
2923
  opacity: 0.4
2924
2924
  }),
2925
- i(de, {
2925
+ i(ae, {
2926
2926
  points: [
2927
- new M(d, f, 0),
2928
- new M(d, u, 0)
2927
+ new z(d, f, 0),
2928
+ new z(d, u, 0)
2929
2929
  ],
2930
2930
  color: "#ff4444",
2931
2931
  lineWidth: 1,
@@ -2941,12 +2941,12 @@ let __tla = (async () => {
2941
2941
  ]
2942
2942
  });
2943
2943
  }
2944
- function dr({ componentDebug: t }) {
2944
+ function Go({ 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;
2948
2948
  r.computeBoundingBox();
2949
- const a = new M();
2949
+ const a = new z();
2950
2950
  return r.boundingBox.getCenter(a), F("group", {
2951
2951
  children: [
2952
2952
  i("mesh", {
@@ -2956,7 +2956,7 @@ let __tla = (async () => {
2956
2956
  color: o,
2957
2957
  transparent: true,
2958
2958
  opacity: s ? 0.5 : 0.2,
2959
- side: O.DoubleSide,
2959
+ side: $.DoubleSide,
2960
2960
  depthWrite: false,
2961
2961
  polygonOffset: true,
2962
2962
  polygonOffsetFactor: 1,
@@ -2975,7 +2975,7 @@ let __tla = (async () => {
2975
2975
  }),
2976
2976
  i("group", {
2977
2977
  position: a,
2978
- children: i(Ze, {
2978
+ children: i(Oe, {
2979
2979
  center: true,
2980
2980
  style: {
2981
2981
  pointerEvents: "none"
@@ -3005,8 +3005,8 @@ let __tla = (async () => {
3005
3005
  })
3006
3006
  });
3007
3007
  }
3008
- function fr({ geometry: t, aoData: r }) {
3009
- const n = H(() => {
3008
+ function Yo({ geometry: t, aoData: r }) {
3009
+ const n = j(() => {
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++) {
3012
3012
  const m = r[e], d = m, f = m < 0.5 ? 0.8 - m * 1.2 : 0.2 * (1 - m), u = 1 - m;
@@ -3015,12 +3015,12 @@ let __tla = (async () => {
3015
3015
  l[S] = d, l[S + 1] = f, l[S + 2] = u;
3016
3016
  }
3017
3017
  }
3018
- return o.setAttribute("color", new O.Float32BufferAttribute(l, 3)), o;
3018
+ return o.setAttribute("color", new $.Float32BufferAttribute(l, 3)), o;
3019
3019
  }, [
3020
3020
  t,
3021
3021
  r
3022
3022
  ]);
3023
- return H(() => () => n.dispose(), [
3023
+ return j(() => () => n.dispose(), [
3024
3024
  n
3025
3025
  ]), i("mesh", {
3026
3026
  geometry: n,
@@ -3029,40 +3029,40 @@ let __tla = (async () => {
3029
3029
  vertexColors: true,
3030
3030
  transparent: true,
3031
3031
  opacity: 0.85,
3032
- side: O.DoubleSide,
3032
+ side: $.DoubleSide,
3033
3033
  depthWrite: false
3034
3034
  })
3035
3035
  });
3036
3036
  }
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, [
3037
+ function Xo({ mesh: t, layers: r, landmarkPoints: n, componentDebug: o, aoData: s, aoGeometry: a, measurementGeometry: c }) {
3038
+ const l = t.geometry, e = j(() => l.getAttribute("position") ? hn(l) : null, [
3039
3039
  l
3040
- ]), m = H(() => !n || n.length < 2 ? null : {
3041
- red: new M(n[1].position.x, n[1].position.y, n[1].position.z),
3042
- green: new M(n[0].position.x, n[0].position.y, n[0].position.z)
3040
+ ]), m = j(() => !n || n.length < 2 ? null : {
3041
+ red: new z(n[1].position.x, n[1].position.y, n[1].position.z),
3042
+ green: new z(n[0].position.x, n[0].position.y, n[0].position.z)
3043
3043
  }, [
3044
3044
  n
3045
3045
  ]);
3046
3046
  return F("group", {
3047
3047
  children: [
3048
- r.pcaAxes && e && i(or, {
3048
+ r.pcaAxes && e && i(To, {
3049
3049
  pca: e
3050
3050
  }),
3051
- r.obb && e && i(rr, {
3051
+ r.obb && e && i(Oo, {
3052
3052
  pca: e
3053
3053
  }),
3054
- r.obbAxis && e && i(ar, {
3054
+ r.obbAxis && e && i(Vo, {
3055
3055
  pca: e,
3056
3056
  modelSize: e.halfExtents[0] ? Math.max(...e.halfExtents) * 2 : 100
3057
3057
  }),
3058
- r.shellComponents && o && i(dr, {
3058
+ r.shellComponents && o && i(Go, {
3059
3059
  componentDebug: o
3060
3060
  }),
3061
- r.ambientOcclusion && s && s.length > 0 && i(fr, {
3061
+ r.ambientOcclusion && s && s.length > 0 && i(Yo, {
3062
3062
  geometry: a ?? l,
3063
3063
  aoData: s
3064
3064
  }),
3065
- r.circumferenceScan && m && i(cr, {
3065
+ r.circumferenceScan && m && i(No, {
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(ir, {
3083
+ r.landmarkAxis && m && i($o, {
3084
3084
  redPoint: m.red,
3085
3085
  greenPoint: m.green
3086
3086
  }),
3087
- r.iterativePCA && m && i(sr, {
3087
+ r.iterativePCA && m && i(Ho, {
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(lr, {
3093
+ r.fullRegionPCA && m && i(jo, {
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 pr({ mesh: t }) {
3103
- const r = t.geometry, n = H(() => {
3102
+ function Zo({ mesh: t }) {
3103
+ const r = t.geometry, n = j(() => {
3104
3104
  if (!r.getAttribute("position")) return null;
3105
- const a = Ln(r), c = a.axes[0], l = a.halfExtents[0] * 1.3;
3105
+ const a = hn(r), c = a.axes[0], l = a.halfExtents[0] * 1.3;
3106
3106
  return {
3107
3107
  axis: c,
3108
3108
  center: a.center,
@@ -3113,7 +3113,7 @@ let __tla = (async () => {
3113
3113
  ]);
3114
3114
  if (!n) return null;
3115
3115
  const o = n.center.clone().addScaledVector(n.axis, n.halfLen), s = n.center.clone().addScaledVector(n.axis, -n.halfLen);
3116
- return i(de, {
3116
+ return i(ae, {
3117
3117
  points: [
3118
3118
  s,
3119
3119
  o
@@ -3129,7 +3129,7 @@ let __tla = (async () => {
3129
3129
  renderOrder: 999
3130
3130
  });
3131
3131
  }
3132
- const In = [
3132
+ const gn = [
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
- ], hr = [
3189
- ...new Set(In.map((t) => t.group))
3188
+ ], Ko = [
3189
+ ...new Set(gn.map((t) => t.group))
3190
3190
  ];
3191
- function gr({ layers: t, onToggleLayer: r, isDoubleShell: n }) {
3191
+ function Uo({ 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
- hr.map((o) => {
3221
- const s = In.filter((a) => a.group === o && !(a.hideWhenDoubleShell && n));
3220
+ Ko.map((o) => {
3221
+ const s = gn.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,498 +3278,456 @@ let __tla = (async () => {
3278
3278
  ]
3279
3279
  });
3280
3280
  }
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) => {
3292
- const oe = await y(D, {
3293
- backgroundColor: null,
3294
- useCORS: true,
3295
- scale: R,
3296
- ignoreElements: (ot) => {
3297
- var _a, _b;
3298
- return ((_a = ot.style) == null ? void 0 : _a.zIndex) === "10" || ((_b = ot.hasAttribute) == null ? void 0 : _b.call(ot, "data-finalizing-overlay"));
3299
- }
3300
- }), te = D.getBoundingClientRect(), Fe = te.width, Be = te.height;
3301
- let Me, Ae, be, $e;
3302
- if (J) {
3303
- const _e = oe.getContext("2d").getImageData(0, 0, oe.width, oe.height).data;
3304
- let Re = oe.width, Ee = oe.height, rt = 0, ht = 0;
3305
- for (let Ye = 0; Ye < oe.height; Ye++) for (let Xe = 0; Xe < oe.width; Xe++) {
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));
3308
- }
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;
3310
- } else {
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();
3314
- if (_e.width === 0 || _e.height === 0) return;
3315
- const Re = _e.left - te.left, Ee = _e.top - te.top;
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);
3317
- }), Me === 1 / 0 && (Me = 0, Ae = 0, be = Fe, $e = Be);
3318
- }
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");
3281
+ const Jo = ({ config: t, spacingType: r, scanUrl: n, formMeasurements: o, onComplete: s, isDebugUser: a = false, onAnalyticsEvent: c, wasmModule: l }) => {
3282
+ const [e, m] = R(null), [d, f] = R(0), [u, x] = R(false), [S, p] = R(false), [g, b] = R(""), [A, P] = R("3D"), [v, k] = R(r === "AK" ? 2 : 1), [w, M] = R(false), [h, C] = R(null), [L, _] = R(r ?? null), [D, E] = R("mm"), [V, Y] = R(false), [Q, me] = R(""), [ie, ce] = R(false), [ne, q] = R(false), [X, de] = R(false), [Z, fe] = R(false), [he, ue] = R(null), [H, ee] = R(null), [ge, ye] = R(null), [xe, te] = R(false), [N, G] = R([]), [ke, ze] = R(null), [$e, oe] = R(null), [Ce, pt] = R(null), [ht, Dt] = R(null), [xn, It] = R(false), [gt, Wt] = R(null), [mt, Fe] = R(null), [Le, bn] = R(false), [Rt, yn] = R(Bo), [Re, Bt] = R("obj"), [we, xt] = R(o), [Ve, bt] = R(true), [Be, Ze] = R(false), [Ke, Et] = R(false), [ve, Ue] = R(false), [wn, yt] = R(false), [Ne, Sn] = R(null), [vn, Cn] = R(void 0), [zn, Mn] = R(void 0), [Tt] = R("#c8c8c8"), [An] = R(1), [Pe, kn] = R(false), [wt, Ot] = R([]), Je = re(null), Ee = re(null), Qe = re(false), Fn = re(null), St = re(null), vt = re(null), Ge = J(async () => {
3283
+ if (vt.current) try {
3284
+ const y = vt.current, I = () => y.querySelector("canvas"), B = () => {
3285
+ const T = I();
3286
+ if (T) return T.toDataURL("image/png");
3323
3287
  };
3324
- It.current && It.current(), await new Promise((J) => setTimeout(J, 100)), await new Promise((J) => requestAnimationFrame(() => requestAnimationFrame(J)));
3325
- const ge = await W();
3326
- L("2D"), await new Promise((J) => setTimeout(J, 200)), await new Promise((J) => requestAnimationFrame(() => requestAnimationFrame(J)));
3327
- const G = await W(true);
3328
- return L("3D"), {
3329
- frontal_view_png: ge,
3330
- side_view_png: G
3288
+ St.current && St.current(), await new Promise((T) => requestAnimationFrame(() => requestAnimationFrame(T)));
3289
+ const W = B();
3290
+ P("2D"), await new Promise((T) => setTimeout(T, 150)), await new Promise((T) => requestAnimationFrame(() => requestAnimationFrame(T)));
3291
+ const pe = B();
3292
+ return P("3D"), !W || !pe ? void 0 : {
3293
+ frontal_view_png: W,
3294
+ side_view_png: pe
3331
3295
  };
3332
3296
  } catch {
3333
3297
  return;
3334
3298
  }
3335
- }, []), Ce = Q((y) => {
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")}`;
3337
- Qt((W) => [
3299
+ }, []), Se = J((y) => {
3300
+ const I = /* @__PURE__ */ new Date(), B = `${String(I.getHours()).padStart(2, "0")}:${String(I.getMinutes()).padStart(2, "0")}:${String(I.getSeconds()).padStart(2, "0")}.${String(I.getMilliseconds()).padStart(3, "0")}`;
3301
+ Ot((W) => [
3338
3302
  ...W.slice(-200),
3339
- `[${R}] ${y}`
3303
+ `[${B}] ${y}`
3340
3304
  ]);
3341
- }, []), { landmarkPoints: T, clearLandmarkPoints: Yn, addLandmarkPoint: en, removeLandmarkPoint: tn, updateLandmarkPositions: nn, setAligned: on, isAligned: U, setCut: rn, isCut: _t, reset: dt } = Nt();
3342
- K(() => {
3343
- dt();
3305
+ }, []), { landmarkPoints: O, clearLandmarkPoints: Ln, addLandmarkPoint: $t, removeLandmarkPoint: Ht, updateLandmarkPositions: jt, setAligned: Vt, isAligned: K, setCut: Nt, isCut: Ct, reset: qe } = _t();
3306
+ U(() => {
3307
+ qe();
3344
3308
  }, [
3345
- dt
3309
+ qe
3346
3310
  ]);
3347
- const ft = v * bt;
3348
- K(() => {
3349
- if (!a || T.length === 0) return;
3350
- const y = T[T.length - 1];
3351
- Ce(`LANDMARK[${T.length - 1}]: placed at (${y.position.x.toFixed(1)}, ${y.position.y.toFixed(1)}, ${y.position.z.toFixed(1)}) face=${y.faceIndex}`);
3311
+ const et = v * at;
3312
+ U(() => {
3313
+ if (!a || O.length === 0) return;
3314
+ const y = O[O.length - 1];
3315
+ Se(`LANDMARK[${O.length - 1}]: placed at (${y.position.x.toFixed(1)}, ${y.position.y.toFixed(1)}, ${y.position.z.toFixed(1)}) face=${y.faceIndex}`);
3352
3316
  }, [
3353
- T.length,
3317
+ O.length,
3354
3318
  a,
3355
- Ce
3356
- ]), K(() => {
3357
- a && U && Ce("STATE: mesh aligned");
3319
+ Se
3320
+ ]), U(() => {
3321
+ a && K && Se("STATE: mesh aligned");
3358
3322
  }, [
3359
- U,
3323
+ K,
3360
3324
  a,
3361
- Ce
3362
- ]), K(() => {
3363
- a && _t && Ce("STATE: mesh cut");
3325
+ Se
3326
+ ]), U(() => {
3327
+ a && Ct && Se("STATE: mesh cut");
3364
3328
  }, [
3365
- _t,
3329
+ Ct,
3366
3330
  a,
3367
- Ce
3368
- ]), K(() => {
3369
- at.current && (at.current.scrollTop = at.current.scrollHeight);
3331
+ Se
3332
+ ]), U(() => {
3333
+ Je.current && (Je.current.scrollTop = Je.current.scrollHeight);
3370
3334
  }, [
3371
- Lt
3335
+ wt
3372
3336
  ]);
3373
- const Ue = H(() => xe ? new O.Mesh(xe) : null, [
3374
- xe
3337
+ const He = j(() => ge ? new $.Mesh(ge) : null, [
3338
+ ge
3375
3339
  ]);
3376
- K(() => {
3377
- o && kt(o);
3340
+ U(() => {
3341
+ o && xt(o);
3378
3342
  }, [
3379
3343
  o
3380
- ]), K(() => {
3381
- o || kt(void 0);
3344
+ ]), U(() => {
3345
+ o || xt(void 0);
3382
3346
  }, [
3383
3347
  v
3384
3348
  ]);
3385
- const ut = ie(false);
3386
- K(() => {
3387
- if (!U || j.length === 0 || ut.current || !c) return;
3388
- ut.current = true;
3389
- const y = T.length >= 3 ? Math.abs(T[2].position.y - T[0].position.y) : null;
3349
+ const tt = re(false);
3350
+ U(() => {
3351
+ if (!K || N.length === 0 || tt.current || !c) return;
3352
+ tt.current = true;
3353
+ const y = O.length >= 3 ? Math.abs(O[2].position.y - O[0].position.y) : null;
3390
3354
  c("dimensions_calculated", {
3391
- spacing_type: P,
3355
+ spacing_type: L,
3392
3356
  source_unit: "mm",
3393
- file_format: Ve,
3357
+ file_format: Re,
3394
3358
  measurement_source: "scan_derived",
3395
3359
  is_double_wall: X,
3396
3360
  is_unit_converted: false,
3397
- form_measurements: (ve == null ? void 0 : ve.filter((D) => D != null)) ?? null,
3398
- scan_measurements: j.map((D) => +(D.modifiedValue ?? D.originalValue).toFixed(1)),
3399
- measurement_variance: ve ? j.map((D, R) => {
3400
- const W = ve[R];
3401
- return W == null ? null : +((D.modifiedValue ?? D.originalValue) - W).toFixed(1);
3361
+ form_measurements: (we == null ? void 0 : we.filter((I) => I != null)) ?? null,
3362
+ scan_measurements: N.map((I) => +(I.modifiedValue ?? I.originalValue).toFixed(1)),
3363
+ measurement_variance: we ? N.map((I, B) => {
3364
+ const W = we[B];
3365
+ return W == null ? null : +((I.modifiedValue ?? I.originalValue) - W).toFixed(1);
3402
3366
  }) : null,
3403
3367
  frontal_height: y !== null ? +y.toFixed(1) : null
3404
3368
  });
3405
3369
  }, [
3406
- U,
3407
- j
3408
- ]), K(() => {
3409
- l !== void 0 && (Ne.current = l), l !== void 0 && jn(true);
3370
+ K,
3371
+ N
3372
+ ]), U(() => {
3373
+ l !== void 0 && (Ee.current = l), l !== void 0 && kn(true);
3410
3374
  }, [
3411
3375
  l
3412
3376
  ]);
3413
- const tt = Q((y, D) => {
3377
+ const Ye = J((y, I) => {
3414
3378
  y.computeBoundingBox();
3415
- const R = y.boundingBox, W = new M();
3416
- R.getCenter(W), y.translate(-W.x, -W.y, -W.z), y.computeBoundingBox();
3417
- const ge = y.boundingBox, G = new M();
3418
- ge.getSize(G), f(Math.max(G.x, G.y, G.z));
3419
- const J = new O.Mesh(y, new O.MeshStandardMaterial({
3379
+ const B = y.boundingBox, W = new z();
3380
+ B.getCenter(W), y.translate(-W.x, -W.y, -W.z), y.computeBoundingBox();
3381
+ const pe = y.boundingBox, T = new z();
3382
+ pe.getSize(T), f(Math.max(T.x, T.y, T.z));
3383
+ const be = new $.Mesh(y, new $.MeshStandardMaterial({
3420
3384
  color: 8947848,
3421
- side: O.DoubleSide
3385
+ side: $.DoubleSide
3422
3386
  }));
3423
- m(J), fe(D), ee(true), pe(false), ct.current = false;
3424
- }, []), Oe = Q(async (y, D) => {
3425
- De(null);
3426
- const R = D.toLowerCase(), W = R.endsWith(".stl");
3427
- if (!R.endsWith(".obj") && !W) {
3428
- De("Unsupported file format. Please use OBJ or STL.");
3387
+ m(be), ce(I), q(true), fe(false), Qe.current = false;
3388
+ }, []), _e = J(async (y, I) => {
3389
+ Fe(null);
3390
+ const B = I.toLowerCase(), W = B.endsWith(".stl");
3391
+ if (!B.endsWith(".obj") && !W) {
3392
+ Fe("Unsupported file format. Please use OBJ or STL.");
3429
3393
  return;
3430
3394
  }
3431
- Kt(W ? "stl" : "obj"), p(true), b("Processing file..."), Ce(`FILE_LOAD: ${D} (${W ? "STL" : "OBJ"})`);
3395
+ Bt(W ? "stl" : "obj"), p(true), b("Processing file..."), Se(`FILE_LOAD: ${I} (${W ? "STL" : "OBJ"})`);
3432
3396
  try {
3433
- let G;
3397
+ let T;
3434
3398
  if (W) if (b("Converting STL..."), y instanceof ArrayBuffer) {
3435
- const te = new Blob([
3399
+ const se = new Blob([
3436
3400
  y
3437
- ]), Fe = new File([
3438
- te
3439
- ], D);
3440
- G = await $t(Fe);
3401
+ ]), De = new File([
3402
+ se
3403
+ ], I);
3404
+ T = await kt(De);
3441
3405
  } else {
3442
- const te = new Blob([
3406
+ const se = new Blob([
3443
3407
  y
3444
- ]), Fe = new File([
3445
- te
3446
- ], D);
3447
- G = await $t(Fe);
3408
+ ]), De = new File([
3409
+ se
3410
+ ], I);
3411
+ T = await kt(De);
3448
3412
  }
3449
- else G = typeof y == "string" ? y : new TextDecoder().decode(y);
3450
- const J = performance.now(), oe = Ne.current ? await So(G, Ne.current, (te) => {
3451
- b(te), Ce(`PREPROCESS: ${te}`);
3413
+ else T = typeof y == "string" ? y : new TextDecoder().decode(y);
3414
+ const be = performance.now(), Me = Ee.current ? await to(T, Ee.current, (se) => {
3415
+ b(se), Se(`PREPROCESS: ${se}`);
3452
3416
  }) : null;
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);
3417
+ if (Me) Se(`PREPROCESS: done in ${(performance.now() - be).toFixed(0)}ms \u2014 unit=${Me.detectedUnit}, scaled=${Me.wasScaled}`), t.showAmputationModal && !r ? (C(Me), M(true)) : Ye(Me.geometry, Me.wasScaled);
3454
3418
  else {
3455
3419
  b("Using fallback loader...");
3456
- const te = vo(G);
3457
- te ? t.showAmputationModal && !r ? (C({
3458
- geometry: te,
3420
+ const se = no(T);
3421
+ se ? t.showAmputationModal && !r ? (C({
3422
+ geometry: se,
3459
3423
  wasScaled: false
3460
- }), z(true)) : tt(te, false) : De("Failed to parse the mesh.");
3424
+ }), M(true)) : Ye(se, false) : Fe("Failed to parse the mesh.");
3461
3425
  }
3462
- } catch (G) {
3463
- De(G instanceof Error ? G.message : "Failed to process the mesh file.");
3426
+ } catch (T) {
3427
+ Fe(T instanceof Error ? T.message : "Failed to process the mesh file.");
3464
3428
  } finally {
3465
3429
  p(false), b("");
3466
3430
  }
3467
3431
  }, [
3468
- Te,
3432
+ Pe,
3469
3433
  t.showAmputationModal,
3470
3434
  r,
3471
- tt
3435
+ Ye
3472
3436
  ]);
3473
- K(() => {
3474
- if (!n || !Te) return;
3437
+ U(() => {
3438
+ if (!n || !Pe) return;
3475
3439
  (async () => {
3476
3440
  p(true), b("Loading scan...");
3477
3441
  try {
3478
- const D = await fetch(n);
3479
- if (!D.ok) throw new Error(`Failed to download scan: ${D.status}`);
3442
+ const I = await fetch(n);
3443
+ if (!I.ok) throw new Error(`Failed to download scan: ${I.status}`);
3480
3444
  const W = new URL(n).pathname.split("/").pop() || "scan.obj";
3481
3445
  if (W.toLowerCase().endsWith(".stl")) {
3482
- const G = await D.arrayBuffer();
3483
- await Oe(G, W);
3446
+ const T = await I.arrayBuffer();
3447
+ await _e(T, W);
3484
3448
  } else {
3485
- const G = await D.text();
3486
- await Oe(G, W);
3449
+ const T = await I.text();
3450
+ await _e(T, W);
3487
3451
  }
3488
- } catch (D) {
3489
- De(D instanceof Error ? D.message : "Failed to load scan from URL."), p(false), b("");
3452
+ } catch (I) {
3453
+ Fe(I instanceof Error ? I.message : "Failed to load scan from URL."), p(false), b("");
3490
3454
  }
3491
3455
  })();
3492
3456
  }, [
3493
3457
  n,
3494
- Te
3458
+ Pe
3495
3459
  ]);
3496
- const Xn = Q((y) => {
3460
+ const Pn = J((y) => {
3497
3461
  y.preventDefault(), x(true);
3498
- }, []), Gn = Q((y) => {
3462
+ }, []), _n = J((y) => {
3499
3463
  y.preventDefault(), x(false);
3500
- }, []), Zn = Q(async (y) => {
3501
- if (y.preventDefault(), x(false), !Te) {
3502
- De("WASM module is still loading. Please wait.");
3464
+ }, []), Dn = J(async (y) => {
3465
+ if (y.preventDefault(), x(false), !Pe) {
3466
+ Fe("WASM module is still loading. Please wait.");
3503
3467
  return;
3504
3468
  }
3505
- const D = y.dataTransfer.files[0];
3506
- if (!D) return;
3507
- const R = D.name.toLowerCase();
3508
- if (!R.endsWith(".obj") && !R.endsWith(".stl")) {
3509
- De("Please drop an OBJ or STL file.");
3469
+ const I = y.dataTransfer.files[0];
3470
+ if (!I) return;
3471
+ const B = I.name.toLowerCase();
3472
+ if (!B.endsWith(".obj") && !B.endsWith(".stl")) {
3473
+ Fe("Please drop an OBJ or STL file.");
3510
3474
  return;
3511
3475
  }
3512
- if (R.endsWith(".stl")) {
3513
- Kt("stl"), p(true), b("Converting STL...");
3476
+ if (B.endsWith(".stl")) {
3477
+ Bt("stl"), p(true), b("Converting STL...");
3514
3478
  try {
3515
- const W = await $t(D);
3516
- await Oe(W, D.name.replace(/\.stl$/i, ".obj"));
3479
+ const W = await kt(I);
3480
+ await _e(W, I.name.replace(/\.stl$/i, ".obj"));
3517
3481
  } catch (W) {
3518
- De(W instanceof Error ? W.message : "Failed to process STL file."), p(false), b("");
3482
+ Fe(W instanceof Error ? W.message : "Failed to process STL file."), p(false), b("");
3519
3483
  }
3520
3484
  } else {
3521
- const W = await D.text();
3522
- await Oe(W, D.name);
3485
+ const W = await I.text();
3486
+ await _e(W, I.name);
3523
3487
  }
3524
3488
  }, [
3525
- Te,
3526
- Oe
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", {
3489
+ Pe,
3490
+ _e
3491
+ ]), In = J((y) => {
3492
+ _(y), k(y === "AK" ? 2 : 1), M(false), h && (Ye(h.geometry, h.wasScaled), C(null)), c == null ? void 0 : c("file_loaded", {
3529
3493
  spacing_type: y,
3530
- file_format: Ve,
3494
+ file_format: Re,
3531
3495
  is_double_wall: false
3532
3496
  });
3533
3497
  }, [
3534
3498
  h,
3535
- tt,
3499
+ Ye,
3536
3500
  c,
3537
- Ve
3501
+ Re
3538
3502
  ]);
3539
- K(() => {
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([
3503
+ U(() => {
3504
+ if (!e || O.length !== 1 || !Ee.current || Qe.current) return;
3505
+ Qe.current = true;
3506
+ const y = O[0], I = Ee.current, B = e.geometry, { positions: W, indices: pe } = ct(B), T = new Float32Array([
3543
3507
  y.position.x,
3544
3508
  y.position.y,
3545
3509
  y.position.z
3546
- ]), J = D.detect_shell(W, ge, G, 40), oe = J.details(), te = J.is_double_shell();
3547
- Ce(`SHELL_DETECT: ${te ? "DOUBLE" : "SINGLE"} \u2014 ${oe}`), te && (ue(true), re(true), Ce(`SHELL_DETECT: double shell, thickness=${J.thickness().toFixed(1)}mm`));
3510
+ ]), be = I.detect_shell(W, pe, T, 40), Me = be.details(), se = be.is_double_shell();
3511
+ Se(`SHELL_DETECT: ${se ? "DOUBLE" : "SINGLE"} \u2014 ${Me}`), se && (de(true), te(true), Se(`SHELL_DETECT: double shell, thickness=${be.thickness().toFixed(1)}mm`));
3548
3512
  }, [
3549
3513
  e,
3550
- T,
3551
- Ce
3514
+ O,
3515
+ Se
3552
3516
  ]);
3553
- const Un = Q(() => {
3554
- if (!e || T.length < 2) return;
3555
- Y(true), ye("Please wait..."), Ce("PIPELINE: starting processing pipeline...");
3517
+ const Wn = J(() => {
3518
+ if (!e || O.length < 2) return;
3519
+ Y(true), me("Please wait..."), Se("PIPELINE: starting processing pipeline...");
3556
3520
  const y = performance.now();
3557
3521
  setTimeout(() => {
3558
- const D = [
3559
- T[1],
3560
- T[0],
3561
- ...T.slice(2)
3522
+ const I = [
3523
+ O[1],
3524
+ O[0],
3525
+ ...O.slice(2)
3562
3526
  ];
3563
- ko(e, D, bt, {
3564
- onStatus: (R) => {
3565
- ye(R), Ce(`PIPELINE: ${R}`);
3527
+ lo(e, I, at, {
3528
+ onStatus: (B) => {
3529
+ me(B), Se(`PIPELINE: ${B}`);
3566
3530
  },
3567
- addLandmarkPoint: en,
3568
- removeLandmarkPoint: tn,
3569
- updateLandmarkPositions: (R) => {
3531
+ addLandmarkPoint: $t,
3532
+ removeLandmarkPoint: Ht,
3533
+ updateLandmarkPositions: (B) => {
3570
3534
  const W = [
3571
- R[1],
3572
- R[0],
3573
- ...R.slice(2)
3535
+ B[1],
3536
+ B[0],
3537
+ ...B.slice(2)
3574
3538
  ];
3575
- nn(W);
3539
+ jt(W);
3576
3540
  },
3577
- setAligned: on,
3578
- setCut: rn,
3541
+ setAligned: Vt,
3542
+ setCut: Nt,
3579
3543
  setModelSize: f,
3580
- setOriginalEndY: Yt,
3581
- setAdjustedStartY: le,
3582
- setAdjustedEndY: Ct,
3583
- setError: De,
3584
- setDoubleShell: (R) => {
3585
- ue(R), re(true);
3544
+ setOriginalEndY: Dt,
3545
+ setAdjustedStartY: oe,
3546
+ setAdjustedEndY: pt,
3547
+ setError: Fe,
3548
+ setDoubleShell: (B) => {
3549
+ de(B), te(true);
3586
3550
  },
3587
- setAoData: (R, W) => {
3588
- he(R), ne(W ?? null);
3551
+ setAoData: (B, W) => {
3552
+ ue(B), ee(W ?? null);
3589
3553
  },
3590
- setInnerShellExtracted: pe,
3591
- setMeasurementGeometry: Se,
3592
- setWasmSlices: Pe,
3593
- wasmModule: Ne.current ?? void 0
3594
- }), Ce(`PIPELINE: completed in ${(performance.now() - y).toFixed(0)}ms`), ut.current = false, Y(false);
3554
+ setInnerShellExtracted: fe,
3555
+ setMeasurementGeometry: ye,
3556
+ setWasmSlices: ze,
3557
+ wasmModule: Ee.current ?? void 0
3558
+ }), Se(`PIPELINE: completed in ${(performance.now() - y).toFixed(0)}ms`), tt.current = false, Y(false);
3595
3559
  }, 50);
3596
3560
  }, [
3597
3561
  e,
3598
- T,
3599
- nn,
3600
- on,
3601
- en,
3602
- tn,
3603
- rn,
3562
+ O,
3563
+ jt,
3564
+ Vt,
3565
+ $t,
3566
+ Ht,
3567
+ Nt,
3604
3568
  Z
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) {
3569
+ ]), zt = re(false), Rn = J(async () => {
3570
+ if (qe(), G([]), ze(null), ye(null), oe(null), pt(null), Wt(null), Dt(null), Ze(false), Et(false), bt(true), de(false), fe(false), Qe.current = false, zt.current = false, tt.current = false, P("3D"), n && Pe) {
3607
3571
  m(null);
3608
3572
  try {
3609
3573
  const y = await fetch(n);
3610
3574
  if (!y.ok) throw new Error(`Failed to download scan: ${y.status}`);
3611
- const R = new URL(n).pathname.split("/").pop() || "scan.obj";
3612
- R.toLowerCase().endsWith(".stl") ? await Oe(await y.arrayBuffer(), R) : await Oe(await y.text(), R);
3575
+ const B = new URL(n).pathname.split("/").pop() || "scan.obj";
3576
+ B.toLowerCase().endsWith(".stl") ? await _e(await y.arrayBuffer(), B) : await _e(await y.text(), B);
3613
3577
  } catch (y) {
3614
- De(y instanceof Error ? y.message : "Failed to reload scan.");
3578
+ Fe(y instanceof Error ? y.message : "Failed to reload scan.");
3615
3579
  }
3616
3580
  }
3617
3581
  }, [
3618
3582
  n,
3619
- Te,
3620
- Oe,
3621
- dt
3583
+ Pe,
3584
+ _e,
3585
+ qe
3622
3586
  ]);
3623
- K(() => {
3624
- U && j.length > 0 && !Rt.current && (Rt.current = true, it(true));
3587
+ U(() => {
3588
+ K && N.length > 0 && !zt.current && (zt.current = true, Ze(true));
3625
3589
  }, [
3626
- U,
3627
- j.length
3590
+ K,
3591
+ N.length
3628
3592
  ]);
3629
- const nt = H(() => {
3593
+ const Xe = j(() => {
3630
3594
  var _a;
3631
- if (!e || T.length < 3) return 0;
3632
- if (X) return Math.abs(T[0].position.y - T[2].position.y);
3595
+ if (!e || O.length < 3) return 0;
3596
+ if (X) return Math.abs(O[0].position.y - O[2].position.y);
3633
3597
  const y = e.geometry;
3634
3598
  y.computeBoundingBox();
3635
- const D = ((_a = y.boundingBox) == null ? void 0 : _a.min.y) ?? 0;
3636
- return Math.abs(T[0].position.y - D);
3599
+ const I = ((_a = y.boundingBox) == null ? void 0 : _a.min.y) ?? 0;
3600
+ return Math.abs(O[0].position.y - I);
3637
3601
  }, [
3638
3602
  e,
3639
- T,
3603
+ O,
3640
3604
  X
3641
- ]), Qn = Q((y) => {
3642
- En(y), kt(y.circumferences), Ft(true), Ut(true);
3643
- }, []), sn = Q(async (y) => {
3605
+ ]), Bn = J((y) => {
3606
+ Sn(y), xt(y.circumferences), bt(true), Et(true);
3607
+ }, []), Gt = J(async (y) => {
3644
3608
  if (!s) return;
3645
- it(false), Pt(false), lt(true);
3646
- const D = e ? await Promise.race([
3647
- et(),
3648
- new Promise((R) => setTimeout(() => R(void 0), 8e3))
3649
- ]).catch(() => {
3609
+ Ze(false), yt(false), Ue(true);
3610
+ const I = e ? await Ge().catch(() => {
3650
3611
  }) : void 0;
3651
3612
  try {
3652
3613
  s({
3653
- spacingType: P ?? "BK",
3614
+ spacingType: L ?? "BK",
3654
3615
  sourceUnit: "mm",
3655
- fileFormat: Ve,
3616
+ fileFormat: Re,
3656
3617
  measurementSource: "form_provided",
3657
3618
  isDoubleWall: X,
3658
3619
  isUnitConverted: false,
3659
- formMeasurements: ve,
3660
- scanMeasurements: j,
3661
- frontalHeight: nt,
3620
+ formMeasurements: we,
3621
+ scanMeasurements: N,
3622
+ frontalHeight: Xe,
3662
3623
  transverseML: 0,
3663
3624
  transverseAP: 0,
3664
3625
  scanUrl: n,
3665
3626
  decision: "skip",
3666
3627
  skipReason: y,
3667
- screenshots: D
3628
+ screenshots: I
3668
3629
  });
3669
3630
  } finally {
3670
- lt(false);
3631
+ Ue(false);
3671
3632
  }
3672
3633
  }, [
3673
3634
  s,
3674
3635
  e,
3675
- P,
3676
- Ve,
3636
+ L,
3637
+ Re,
3677
3638
  X,
3678
- ve,
3679
- j,
3680
- nt,
3639
+ we,
3640
+ N,
3641
+ Xe,
3681
3642
  n,
3682
- et
3683
- ]), Wt = ie(null);
3684
- K(() => {
3685
- if (!e || !U) {
3686
- Wt.current = null;
3643
+ Ge
3644
+ ]), Mt = re(null);
3645
+ U(() => {
3646
+ if (!e || !K) {
3647
+ Mt.current = null;
3687
3648
  return;
3688
3649
  }
3689
- const y = (Ue ?? e).geometry;
3690
- Wt.current = jt(y);
3650
+ const y = (He ?? e).geometry;
3651
+ Mt.current = Pt(y);
3691
3652
  }, [
3692
3653
  e,
3693
- U,
3694
- Ue
3654
+ K,
3655
+ He
3695
3656
  ]);
3696
- const Bt = Q(async (y) => {
3697
- if (!s || !e || j.length === 0 || !P) return;
3698
- lt(true);
3699
- const D = await Promise.race([
3700
- et(),
3701
- new Promise((R) => setTimeout(() => R(void 0), 8e3))
3702
- ]).catch(() => {
3657
+ const At = J(async (y) => {
3658
+ if (!s || !e || N.length === 0 || !L) return;
3659
+ Ue(true);
3660
+ const I = await Ge().catch(() => {
3703
3661
  });
3704
3662
  try {
3705
- let R = 0, W = 0;
3706
- if (T.length >= 2) {
3707
- const ge = (Ue ?? e).geometry, J = T[0].position.y;
3663
+ let B = 0, W = 0;
3664
+ if (O.length >= 2) {
3665
+ const pe = (He ?? e).geometry, be = O[0].position.y;
3708
3666
  try {
3709
- const oe = Wt.current ?? jt(ge), te = Ge(oe, ge, J);
3710
- if (te.linePoints.length >= 2) {
3711
- let Fe = te.linePoints[0], Be = te.linePoints[0], Me = te.linePoints[0], Ae = te.linePoints[0];
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);
3713
- R = new M(Fe.x, J, Fe.z).distanceTo(new M(Be.x, J, Be.z)), W = new M(Me.x, J, Me.z).distanceTo(new M(Ae.x, J, Ae.z));
3667
+ const Me = Mt.current ?? Pt(pe), se = Te(Me, pe, be);
3668
+ if (se.linePoints.length >= 2) {
3669
+ let De = se.linePoints[0], nt = se.linePoints[0], ot = se.linePoints[0], rt = se.linePoints[0];
3670
+ for (const Ie of se.linePoints) Ie.x < De.x && (De = Ie), Ie.x > nt.x && (nt = Ie), Ie.z < ot.z && (ot = Ie), Ie.z > rt.z && (rt = Ie);
3671
+ B = new z(De.x, be, De.z).distanceTo(new z(nt.x, be, nt.z)), W = new z(ot.x, be, ot.z).distanceTo(new z(rt.x, be, rt.z));
3714
3672
  }
3715
3673
  } catch {
3716
3674
  }
3717
3675
  }
3718
3676
  s({
3719
- spacingType: P,
3677
+ spacingType: L,
3720
3678
  sourceUnit: "mm",
3721
- fileFormat: Ve,
3679
+ fileFormat: Re,
3722
3680
  measurementSource: y === "use_form_measurements" ? "form_provided" : "scan_derived",
3723
3681
  isDoubleWall: X,
3724
3682
  isUnitConverted: false,
3725
- formMeasurements: ve,
3726
- scanMeasurements: j,
3727
- frontalHeight: (qe == null ? void 0 : qe.frontalHeight) ?? nt,
3728
- transverseML: R,
3683
+ formMeasurements: we,
3684
+ scanMeasurements: N,
3685
+ frontalHeight: (Ne == null ? void 0 : Ne.frontalHeight) ?? Xe,
3686
+ transverseML: B,
3729
3687
  transverseAP: W,
3730
3688
  scanUrl: n,
3731
3689
  decision: y,
3732
- userEnteredMeasurements: qe ?? void 0,
3733
- screenshots: D
3690
+ userEnteredMeasurements: Ne ?? void 0,
3691
+ screenshots: I
3734
3692
  });
3735
3693
  } finally {
3736
- lt(false);
3694
+ Ue(false);
3737
3695
  }
3738
3696
  }, [
3739
3697
  s,
3740
3698
  e,
3741
- Ue,
3742
- j,
3743
- P,
3744
- T,
3745
- Ve,
3699
+ He,
3700
+ N,
3701
+ L,
3702
+ O,
3703
+ Re,
3746
3704
  X,
3747
- ve,
3705
+ we,
3748
3706
  n,
3749
- qe,
3750
- nt,
3751
- et
3752
- ]), qn = H(() => {
3753
- if (!ve || j.length === 0) return false;
3754
- const y = Math.min(ve.length, j.length);
3707
+ Ne,
3708
+ Xe,
3709
+ Ge
3710
+ ]), En = j(() => {
3711
+ if (!we || N.length === 0) return false;
3712
+ const y = Math.min(we.length, N.length);
3755
3713
  if (y === 0) return false;
3756
- for (let D = 0; D < y; D++) {
3757
- const R = ve[D], W = j[D];
3758
- if (!W || R == null || R === 0) continue;
3759
- const ge = W.modifiedValue ?? W.originalValue;
3760
- if (Math.abs(ge - R) > 7) return false;
3714
+ for (let I = 0; I < y; I++) {
3715
+ const B = we[I], W = N[I];
3716
+ if (!W || B == null || B === 0) continue;
3717
+ const pe = W.modifiedValue ?? W.originalValue;
3718
+ if (Math.abs(pe - B) > 7) return false;
3761
3719
  }
3762
3720
  return true;
3763
3721
  }, [
3764
- ve,
3765
- j
3766
- ]), eo = st ? 5 : U && je || U ? 4 : e ? T.length === 0 ? 2 : 3 : 1, to = [
3722
+ we,
3723
+ N
3724
+ ]), Tn = Ke ? 5 : K && Be || K ? 4 : e ? O.length === 0 ? 2 : 3 : 1, On = [
3767
3725
  {
3768
3726
  label: "Load File",
3769
3727
  number: 1
3770
3728
  },
3771
3729
  {
3772
- label: P === "AK" ? "Set IT" : "Set MPT",
3730
+ label: L === "AK" ? "Set IT" : "Set MPT",
3773
3731
  number: 2
3774
3732
  },
3775
3733
  {
@@ -3785,7 +3743,7 @@ let __tla = (async () => {
3785
3743
  number: 5
3786
3744
  }
3787
3745
  ];
3788
- return F(mo.Provider, {
3746
+ return F(Un.Provider, {
3789
3747
  value: t,
3790
3748
  children: [
3791
3749
  F("div", {
@@ -3817,9 +3775,9 @@ let __tla = (async () => {
3817
3775
  }
3818
3776
  })
3819
3777
  }),
3820
- i(Xo, {
3821
- steps: to,
3822
- currentStep: eo
3778
+ i(ko, {
3779
+ steps: On,
3780
+ currentStep: Tn
3823
3781
  }),
3824
3782
  F("div", {
3825
3783
  style: {
@@ -3837,37 +3795,37 @@ let __tla = (async () => {
3837
3795
  minHeight: 0
3838
3796
  },
3839
3797
  children: [
3840
- U && je && P && i("div", {
3798
+ K && Be && L && i("div", {
3841
3799
  style: {
3842
3800
  width: 340,
3843
3801
  flexShrink: 0,
3844
3802
  borderRight: "1px solid #e0e0e0",
3845
3803
  overflow: "hidden"
3846
3804
  },
3847
- children: i(er, {
3848
- amputationType: P,
3805
+ children: i(Ro, {
3806
+ amputationType: L,
3849
3807
  spacingInches: v,
3850
- scanMeasurements: j,
3851
- scanFrontalHeight: nt,
3852
- onSave: Qn,
3853
- onSkip: sn,
3854
- onFormChange: On,
3855
- onHeightChange: Hn,
3856
- initialValues: ve,
3857
- initialFrontalHeight: qe == null ? void 0 : qe.frontalHeight
3808
+ scanMeasurements: N,
3809
+ scanFrontalHeight: Xe,
3810
+ onSave: Bn,
3811
+ onSkip: Gt,
3812
+ onFormChange: Cn,
3813
+ onHeightChange: Mn,
3814
+ initialValues: we,
3815
+ initialFrontalHeight: Ne == null ? void 0 : Ne.frontalHeight
3858
3816
  })
3859
3817
  }),
3860
3818
  F("div", {
3861
- ref: Dt,
3819
+ ref: vt,
3862
3820
  style: {
3863
3821
  flex: 1,
3864
3822
  position: "relative",
3865
3823
  minHeight: 0,
3866
3824
  overflow: "hidden"
3867
3825
  },
3868
- onDragOver: t.showDragDrop ? Xn : void 0,
3869
- onDragLeave: t.showDragDrop ? Gn : void 0,
3870
- onDrop: t.showDragDrop ? Zn : void 0,
3826
+ onDragOver: t.showDragDrop ? Pn : void 0,
3827
+ onDragLeave: t.showDragDrop ? _n : void 0,
3828
+ onDrop: t.showDragDrop ? Dn : void 0,
3871
3829
  children: [
3872
3830
  t.showDragDrop && !e && !S && i("div", {
3873
3831
  style: {
@@ -3880,7 +3838,7 @@ let __tla = (async () => {
3880
3838
  justifyContent: "center",
3881
3839
  pointerEvents: "none"
3882
3840
  },
3883
- children: Te ? i("div", {
3841
+ children: Pe ? i("div", {
3884
3842
  style: {
3885
3843
  fontSize: 18,
3886
3844
  color: "#aaa",
@@ -3918,7 +3876,7 @@ let __tla = (async () => {
3918
3876
  ]
3919
3877
  })
3920
3878
  }),
3921
- !t.showDragDrop && !e && !S && !At && i("div", {
3879
+ !t.showDragDrop && !e && !S && !mt && i("div", {
3922
3880
  style: {
3923
3881
  position: "absolute",
3924
3882
  inset: 0,
@@ -3956,7 +3914,7 @@ let __tla = (async () => {
3956
3914
  ]
3957
3915
  })
3958
3916
  }),
3959
- e && !U && T.length === 0 && F("div", {
3917
+ e && !K && O.length === 0 && F("div", {
3960
3918
  style: {
3961
3919
  position: "absolute",
3962
3920
  top: 16,
@@ -3985,10 +3943,10 @@ let __tla = (async () => {
3985
3943
  }
3986
3944
  }),
3987
3945
  "Click mesh to set ",
3988
- P === "AK" ? "IT" : "MPT"
3946
+ L === "AK" ? "IT" : "MPT"
3989
3947
  ]
3990
3948
  }),
3991
- e && !U && T.length === 1 && F("div", {
3949
+ e && !K && O.length === 1 && F("div", {
3992
3950
  style: {
3993
3951
  position: "absolute",
3994
3952
  top: 16,
@@ -4019,15 +3977,15 @@ let __tla = (async () => {
4019
3977
  "Click mesh to set Origin"
4020
3978
  ]
4021
3979
  }),
4022
- S && i(un, {
3980
+ S && i(Kt, {
4023
3981
  message: g || "Processing mesh..."
4024
3982
  }),
4025
- V && i(un, {
4026
- message: q
3983
+ V && i(Kt, {
3984
+ message: Q
4027
3985
  }),
4028
- At && i(Po, {
4029
- message: At,
4030
- onDismiss: () => De(null)
3986
+ mt && i(co, {
3987
+ message: mt,
3988
+ onDismiss: () => Fe(null)
4031
3989
  }),
4032
3990
  t.showAmputationModal && w && i("div", {
4033
3991
  style: {
@@ -4081,7 +4039,7 @@ let __tla = (async () => {
4081
4039
  "AK",
4082
4040
  "BK"
4083
4041
  ].map((y) => F("label", {
4084
- onClick: () => I(y),
4042
+ onClick: () => _(y),
4085
4043
  style: {
4086
4044
  flex: 1,
4087
4045
  display: "flex",
@@ -4090,16 +4048,16 @@ let __tla = (async () => {
4090
4048
  border: "2px solid",
4091
4049
  borderRadius: 4,
4092
4050
  cursor: "pointer",
4093
- borderColor: P === y ? "rgb(12, 67, 173)" : "#e0e0e0",
4094
- backgroundColor: P === y ? "rgba(12, 67, 173, 0.04)" : "#fff",
4051
+ borderColor: L === y ? "rgb(12, 67, 173)" : "#e0e0e0",
4052
+ backgroundColor: L === y ? "rgba(12, 67, 173, 0.04)" : "#fff",
4095
4053
  transition: "border-color 0.15s, background-color 0.15s"
4096
4054
  },
4097
4055
  children: [
4098
4056
  i("input", {
4099
4057
  type: "radio",
4100
4058
  name: "ampType",
4101
- checked: P === y,
4102
- onChange: () => I(y),
4059
+ checked: L === y,
4060
+ onChange: () => _(y),
4103
4061
  style: {
4104
4062
  accentColor: "rgb(12, 67, 173)",
4105
4063
  marginBottom: 12,
@@ -4142,7 +4100,7 @@ let __tla = (async () => {
4142
4100
  children: [
4143
4101
  i("button", {
4144
4102
  onClick: () => {
4145
- z(false), C(null);
4103
+ M(false), C(null);
4146
4104
  },
4147
4105
  style: {
4148
4106
  padding: "6px 16px",
@@ -4160,17 +4118,17 @@ let __tla = (async () => {
4160
4118
  children: "Cancel"
4161
4119
  }),
4162
4120
  i("button", {
4163
- onClick: () => P && Kn(P),
4164
- disabled: !P,
4121
+ onClick: () => L && In(L),
4122
+ disabled: !L,
4165
4123
  style: {
4166
4124
  padding: "6px 16px",
4167
4125
  borderRadius: 4,
4168
4126
  fontSize: 14,
4169
4127
  fontWeight: 500,
4170
- backgroundColor: P ? "rgb(12, 67, 173)" : "#e0e0e0",
4128
+ backgroundColor: L ? "rgb(12, 67, 173)" : "#e0e0e0",
4171
4129
  border: "none",
4172
- color: P ? "#fff" : "#9e9e9e",
4173
- cursor: P ? "pointer" : "not-allowed",
4130
+ color: L ? "#fff" : "#9e9e9e",
4131
+ cursor: L ? "pointer" : "not-allowed",
4174
4132
  fontFamily: "system-ui, sans-serif",
4175
4133
  lineHeight: "36px",
4176
4134
  letterSpacing: "0.4px"
@@ -4192,8 +4150,8 @@ let __tla = (async () => {
4192
4150
  zIndex: 10
4193
4151
  }
4194
4152
  }),
4195
- i(Fo, {
4196
- children: F(co, {
4153
+ i(ao, {
4154
+ children: F(Nn, {
4197
4155
  camera: {
4198
4156
  position: [
4199
4157
  0,
@@ -4203,14 +4161,14 @@ let __tla = (async () => {
4203
4161
  },
4204
4162
  style: {
4205
4163
  display: e ? "block" : "none",
4206
- backgroundColor: We ? "#070611" : void 0
4164
+ backgroundColor: Le ? "#070611" : void 0
4207
4165
  },
4208
4166
  gl: {
4209
4167
  localClippingEnabled: true,
4210
4168
  preserveDrawingBuffer: true
4211
4169
  },
4212
4170
  scene: {
4213
- background: We ? new O.Color("#070611") : null
4171
+ background: Le ? new $.Color("#070611") : null
4214
4172
  },
4215
4173
  children: [
4216
4174
  i("ambientLight", {
@@ -4240,114 +4198,114 @@ let __tla = (async () => {
4240
4198
  ],
4241
4199
  intensity: 0.2
4242
4200
  }),
4243
- e && A === "3D" && i(Io, {
4201
+ e && A === "3D" && i(uo, {
4244
4202
  mesh: e,
4245
4203
  maxPoints: 2,
4246
- meshColor: Jt,
4247
- meshOpacity: We ? 0.3 : Vn,
4204
+ meshColor: Tt,
4205
+ meshOpacity: Le ? 0.3 : An,
4248
4206
  frontFaceOnly: Z,
4249
- doubleShellTransparency: X && U
4207
+ doubleShellTransparency: X && K
4250
4208
  }),
4251
- e && A === "3D" && i(_o, {
4209
+ e && A === "3D" && i(ho, {
4252
4210
  modelSize: d,
4253
4211
  labels: [
4254
- P === "AK" ? "IT" : "MPT",
4212
+ L === "AK" ? "IT" : "MPT",
4255
4213
  "Origin",
4256
4214
  "Cut Plane"
4257
4215
  ]
4258
4216
  }),
4259
- i(Vo, {
4217
+ i(Co, {
4260
4218
  modelSize: d,
4261
- isAligned: U,
4262
- isCut: _t,
4219
+ isAligned: K,
4220
+ isCut: Ct,
4263
4221
  mesh: e,
4264
4222
  viewMode: A,
4265
- sliceY: U && T.length >= 2 ? ke ?? Mt ?? T[0].position.y : void 0,
4266
- landmarkCount: T.length,
4267
- measurementGeometry: xe,
4268
- resetCameraToFrontRef: It
4223
+ sliceY: K && O.length >= 2 ? Ce ?? ht ?? O[0].position.y : void 0,
4224
+ landmarkCount: O.length,
4225
+ measurementGeometry: ge,
4226
+ resetCameraToFrontRef: St
4269
4227
  }),
4270
- !U && i(yn, {
4228
+ !K && i(nn, {
4271
4229
  enableDamping: false
4272
4230
  }),
4273
- U && j.length > 0 && e && A === "3D" && i(jo, {
4231
+ K && N.length > 0 && e && A === "3D" && i(zo, {
4274
4232
  mesh: e,
4275
- isDragging: _n
4233
+ isDragging: xn
4276
4234
  }),
4277
- e && U && T.length >= 3 && (() => {
4278
- const D = e.geometry.getIndex();
4279
- if (!D || D.count < 30) return null;
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,
4283
- upperY: G,
4235
+ e && K && O.length >= 3 && (() => {
4236
+ const I = e.geometry.getIndex();
4237
+ if (!I || I.count < 30) return null;
4238
+ const B = O[2], W = O[0], pe = $e ?? B.position.y, T = Ce ?? ht ?? W.position.y;
4239
+ return A === "2D" ? i(Fo, {
4240
+ mesh: He ?? e,
4241
+ upperY: T,
4284
4242
  originY: W.position.y,
4285
4243
  modelSize: d,
4286
- meshColor: Jt,
4287
- displayUnit: _
4288
- }) : F(He, {
4244
+ meshColor: Tt,
4245
+ displayUnit: D
4246
+ }) : F(We, {
4289
4247
  children: [
4290
- i(Oo, {
4291
- mesh: Ue ?? e,
4292
- startY: ge,
4293
- endY: G,
4294
- spacing: ft,
4248
+ i(wo, {
4249
+ mesh: He ?? e,
4250
+ startY: pe,
4251
+ endY: T,
4252
+ spacing: et,
4295
4253
  modelSize: d,
4296
- onMeasurementsChange: N,
4254
+ onMeasurementsChange: G,
4297
4255
  reverseOrder: true,
4298
- displayUnit: _,
4256
+ displayUnit: D,
4299
4257
  useInnerSurface: X && !Z,
4300
- formMeasurements: je ? Tn ?? ve : Qe ? ve : void 0,
4301
- originY: zt ?? W.position.y,
4302
- wasmSlices: Ie
4258
+ formMeasurements: Be ? vn ?? we : Ve ? we : void 0,
4259
+ originY: gt ?? W.position.y,
4260
+ wasmSlices: ke
4303
4261
  }),
4304
- i(Ho, {
4262
+ i(vo, {
4305
4263
  mesh: e,
4306
- greenY: zt ?? W.position.y,
4264
+ greenY: gt ?? W.position.y,
4307
4265
  modelSize: d,
4308
- displayUnit: _,
4309
- bottomY: X ? R.position.y : void 0,
4310
- formHeight: je ? $n : Qe ? qe == null ? void 0 : qe.frontalHeight : void 0
4266
+ displayUnit: D,
4267
+ bottomY: X ? B.position.y : void 0,
4268
+ formHeight: Be ? zn : Ve ? Ne == null ? void 0 : Ne.frontalHeight : void 0
4311
4269
  }),
4312
- i(Zo, {
4270
+ i(Lo, {
4313
4271
  mesh: e,
4314
- yPosition: zt ?? W.position.y,
4315
- onYChange: (J) => {
4316
- Gt(J), Pe(null);
4317
- const oe = J - W.position.y;
4318
- Ct((Mt ?? W.position.y + ft * 2) + oe);
4272
+ yPosition: gt ?? W.position.y,
4273
+ onYChange: (be) => {
4274
+ Wt(be), ze(null);
4275
+ const Me = be - W.position.y;
4276
+ pt((ht ?? W.position.y + et * 2) + Me);
4319
4277
  },
4320
- minY: W.position.y - ft,
4321
- maxY: W.position.y + ft,
4278
+ minY: W.position.y - et,
4279
+ maxY: W.position.y + et,
4322
4280
  modelSize: d,
4323
4281
  color: "#44ff44",
4324
4282
  hoverColor: "#88ff88",
4325
4283
  dragColor: "#ffffff",
4326
- label: P === "AK" ? "IT" : "MPT",
4327
- onDragStart: () => Xt(true),
4328
- onDragEnd: () => Xt(false)
4284
+ label: L === "AK" ? "IT" : "MPT",
4285
+ onDragStart: () => It(true),
4286
+ onDragEnd: () => It(false)
4329
4287
  })
4330
4288
  ]
4331
4289
  });
4332
4290
  })(),
4333
- e && U && A === "3D" && We && i(pr, {
4291
+ e && K && A === "3D" && Le && i(Zo, {
4334
4292
  mesh: e
4335
4293
  }),
4336
- e && t.showDebug && We && A === "3D" && i(ur, {
4294
+ e && t.showDebug && Le && A === "3D" && i(Xo, {
4337
4295
  mesh: e,
4338
4296
  modelSize: d,
4339
- layers: Zt,
4340
- landmarkPoints: T,
4297
+ layers: Rt,
4298
+ landmarkPoints: O,
4341
4299
  componentDebug: null,
4342
- aoData: me,
4343
- aoGeometry: $,
4344
- measurementGeometry: xe
4300
+ aoData: he,
4301
+ aoGeometry: H,
4302
+ measurementGeometry: ge
4345
4303
  }),
4346
- i(xr, {
4347
- screenshotFnRef: Nn,
4304
+ i(Qo, {
4305
+ screenshotFnRef: Fn,
4348
4306
  mesh: e,
4349
4307
  modelSize: d,
4350
- measurementGeometry: xe
4308
+ measurementGeometry: ge
4351
4309
  })
4352
4310
  ]
4353
4311
  })
@@ -4379,8 +4337,8 @@ let __tla = (async () => {
4379
4337
  },
4380
4338
  children: "Start Over"
4381
4339
  }),
4382
- !U && T.length >= 1 && i("button", {
4383
- onClick: Yn,
4340
+ !K && O.length >= 1 && i("button", {
4341
+ onClick: Ln,
4384
4342
  style: {
4385
4343
  padding: "6px 16px",
4386
4344
  borderRadius: 4,
@@ -4396,8 +4354,8 @@ let __tla = (async () => {
4396
4354
  },
4397
4355
  children: "Reset Points"
4398
4356
  }),
4399
- U && !st && i("button", {
4400
- onClick: Jn,
4357
+ K && !Ke && i("button", {
4358
+ onClick: Rn,
4401
4359
  style: {
4402
4360
  padding: "6px 16px",
4403
4361
  borderRadius: 4,
@@ -4415,15 +4373,15 @@ let __tla = (async () => {
4415
4373
  })
4416
4374
  ]
4417
4375
  }),
4418
- t.showDebug && We && e && A === "3D" && i(gr, {
4419
- layers: Zt,
4420
- onToggleLayer: (y) => Wn((D) => ({
4421
- ...D,
4422
- [y]: !D[y]
4376
+ t.showDebug && Le && e && A === "3D" && i(Uo, {
4377
+ layers: Rt,
4378
+ onToggleLayer: (y) => yn((I) => ({
4379
+ ...I,
4380
+ [y]: !I[y]
4423
4381
  })),
4424
4382
  isDoubleShell: X
4425
4383
  }),
4426
- U && j.length > 0 && F("div", {
4384
+ K && N.length > 0 && F("div", {
4427
4385
  style: {
4428
4386
  position: "absolute",
4429
4387
  top: 16,
@@ -4443,7 +4401,7 @@ let __tla = (async () => {
4443
4401
  },
4444
4402
  children: [
4445
4403
  i("button", {
4446
- onClick: () => L("3D"),
4404
+ onClick: () => P("3D"),
4447
4405
  style: {
4448
4406
  padding: "6px 14px",
4449
4407
  fontSize: 13,
@@ -4457,7 +4415,7 @@ let __tla = (async () => {
4457
4415
  children: "Orbital"
4458
4416
  }),
4459
4417
  i("button", {
4460
- onClick: () => L("2D"),
4418
+ onClick: () => P("2D"),
4461
4419
  style: {
4462
4420
  padding: "6px 14px",
4463
4421
  fontSize: 13,
@@ -4487,9 +4445,9 @@ let __tla = (async () => {
4487
4445
  style: {
4488
4446
  padding: "6px 14px",
4489
4447
  fontSize: 13,
4490
- fontWeight: _ === "mm" ? 600 : 400,
4491
- backgroundColor: _ === "mm" ? "rgb(12, 67, 173)" : "#fff",
4492
- color: _ === "mm" ? "#fff" : "#666",
4448
+ fontWeight: D === "mm" ? 600 : 400,
4449
+ backgroundColor: D === "mm" ? "rgb(12, 67, 173)" : "#fff",
4450
+ color: D === "mm" ? "#fff" : "#666",
4493
4451
  border: "none",
4494
4452
  cursor: "pointer",
4495
4453
  fontFamily: "system-ui, sans-serif"
@@ -4501,9 +4459,9 @@ let __tla = (async () => {
4501
4459
  style: {
4502
4460
  padding: "6px 14px",
4503
4461
  fontSize: 13,
4504
- fontWeight: _ === "inch" ? 600 : 400,
4505
- backgroundColor: _ === "inch" ? "rgb(12, 67, 173)" : "#fff",
4506
- color: _ === "inch" ? "#fff" : "#666",
4462
+ fontWeight: D === "inch" ? 600 : 400,
4463
+ backgroundColor: D === "inch" ? "rgb(12, 67, 173)" : "#fff",
4464
+ color: D === "inch" ? "#fff" : "#666",
4507
4465
  border: "none",
4508
4466
  borderLeft: "1px solid #ccc",
4509
4467
  cursor: "pointer",
@@ -4553,7 +4511,7 @@ let __tla = (async () => {
4553
4511
  })
4554
4512
  ]
4555
4513
  }),
4556
- A === "3D" && ve && i("div", {
4514
+ A === "3D" && we && i("div", {
4557
4515
  style: {
4558
4516
  display: "flex",
4559
4517
  borderRadius: 6,
@@ -4562,13 +4520,13 @@ let __tla = (async () => {
4562
4520
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
4563
4521
  },
4564
4522
  children: i("button", {
4565
- onClick: () => Ft((y) => !y),
4523
+ onClick: () => bt((y) => !y),
4566
4524
  style: {
4567
4525
  padding: "6px 14px",
4568
4526
  fontSize: 13,
4569
- fontWeight: Qe ? 600 : 400,
4570
- backgroundColor: Qe ? "rgb(12, 67, 173)" : "#fff",
4571
- color: Qe ? "#fff" : "#666",
4527
+ fontWeight: Ve ? 600 : 400,
4528
+ backgroundColor: Ve ? "rgb(12, 67, 173)" : "#fff",
4529
+ color: Ve ? "#fff" : "#666",
4572
4530
  border: "none",
4573
4531
  cursor: "pointer",
4574
4532
  fontFamily: "system-ui, sans-serif"
@@ -4586,13 +4544,13 @@ let __tla = (async () => {
4586
4544
  },
4587
4545
  children: i("button", {
4588
4546
  onClick: async () => {
4589
- const y = await et();
4547
+ const y = await Ge();
4590
4548
  if (!y) return;
4591
- const D = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), R = (W, ge) => {
4592
- const G = document.createElement("a");
4593
- G.href = W, G.download = ge, G.click();
4549
+ const I = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), B = (W, pe) => {
4550
+ const T = document.createElement("a");
4551
+ T.href = W, T.download = pe, T.click();
4594
4552
  };
4595
- R(y.frontal_view_png, `measurements_front_${D}.png`), await new Promise((W) => setTimeout(W, 300)), R(y.side_view_png, `measurements_transverse_${D}.png`);
4553
+ B(y.frontal_view_png, `measurements_front_${I}.png`), await new Promise((W) => setTimeout(W, 300)), B(y.side_view_png, `measurements_transverse_${I}.png`);
4596
4554
  },
4597
4555
  style: {
4598
4556
  padding: "6px 14px",
@@ -4616,13 +4574,13 @@ let __tla = (async () => {
4616
4574
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
4617
4575
  },
4618
4576
  children: i("button", {
4619
- onClick: () => Rn((y) => !y),
4577
+ onClick: () => bn((y) => !y),
4620
4578
  style: {
4621
4579
  padding: "6px 14px",
4622
4580
  fontSize: 13,
4623
- fontWeight: We ? 600 : 400,
4624
- backgroundColor: We ? "#e65100" : "#fff",
4625
- color: We ? "#fff" : "#666",
4581
+ fontWeight: Le ? 600 : 400,
4582
+ backgroundColor: Le ? "#e65100" : "#fff",
4583
+ color: Le ? "#fff" : "#666",
4626
4584
  border: "none",
4627
4585
  cursor: "pointer",
4628
4586
  fontFamily: "system-ui, sans-serif"
@@ -4632,19 +4590,19 @@ let __tla = (async () => {
4632
4590
  })
4633
4591
  ]
4634
4592
  }),
4635
- e && se && i(No, {
4636
- wasAutoScaled: ae,
4637
- onDismiss: () => ee(false)
4593
+ e && ne && i(Mo, {
4594
+ wasAutoScaled: ie,
4595
+ onDismiss: () => q(false)
4638
4596
  }),
4639
- e && we && U && i(Yo, {
4597
+ e && xe && K && i(Ao, {
4640
4598
  isDoubleShell: X,
4641
- onDismiss: () => re(false)
4599
+ onDismiss: () => te(false)
4642
4600
  })
4643
4601
  ]
4644
4602
  })
4645
4603
  ]
4646
4604
  }),
4647
- ze && F("div", {
4605
+ ve && F("div", {
4648
4606
  "data-finalizing-overlay": true,
4649
4607
  style: {
4650
4608
  position: "absolute",
@@ -4693,9 +4651,9 @@ let __tla = (async () => {
4693
4651
  flexShrink: 0
4694
4652
  },
4695
4653
  children: [
4696
- !je && s && i("button", {
4697
- disabled: ze,
4698
- onClick: () => Pt(true),
4654
+ !Be && s && i("button", {
4655
+ disabled: ve,
4656
+ onClick: () => yt(true),
4699
4657
  style: {
4700
4658
  padding: "6px 16px",
4701
4659
  borderRadius: 4,
@@ -4703,23 +4661,23 @@ let __tla = (async () => {
4703
4661
  fontWeight: 500,
4704
4662
  backgroundColor: "#fff",
4705
4663
  border: "1px solid #bdbdbd",
4706
- color: ze ? "#999" : "#666",
4707
- cursor: ze ? "not-allowed" : "pointer",
4664
+ color: ve ? "#999" : "#666",
4665
+ cursor: ve ? "not-allowed" : "pointer",
4708
4666
  fontFamily: "system-ui, sans-serif",
4709
4667
  letterSpacing: "0.4px",
4710
4668
  lineHeight: "36px"
4711
4669
  },
4712
4670
  children: "Have Galileo Check My Measurements"
4713
4671
  }),
4714
- je && i("div", {}),
4672
+ Be && i("div", {}),
4715
4673
  F("div", {
4716
4674
  style: {
4717
4675
  display: "flex",
4718
4676
  gap: 8
4719
4677
  },
4720
4678
  children: [
4721
- e && !U && T.length >= 2 && i("button", {
4722
- onClick: Un,
4679
+ e && !K && O.length >= 2 && i("button", {
4680
+ onClick: Wn,
4723
4681
  style: {
4724
4682
  padding: "6px 16px",
4725
4683
  borderRadius: 4,
@@ -4735,8 +4693,8 @@ let __tla = (async () => {
4735
4693
  },
4736
4694
  children: "Next \xBB"
4737
4695
  }),
4738
- U && st && !je && i("button", {
4739
- onClick: () => it(true),
4696
+ K && Ke && !Be && i("button", {
4697
+ onClick: () => Ze(true),
4740
4698
  style: {
4741
4699
  padding: "6px 16px",
4742
4700
  borderRadius: 4,
@@ -4752,37 +4710,37 @@ let __tla = (async () => {
4752
4710
  },
4753
4711
  children: "Edit Measurements"
4754
4712
  }),
4755
- U && st && (qn ? i("button", {
4756
- disabled: ze,
4757
- onClick: () => Bt("continue"),
4713
+ K && Ke && (En ? i("button", {
4714
+ disabled: ve,
4715
+ onClick: () => At("continue"),
4758
4716
  style: {
4759
4717
  padding: "6px 16px",
4760
4718
  borderRadius: 4,
4761
4719
  fontSize: 14,
4762
4720
  fontWeight: 500,
4763
- backgroundColor: ze ? "#9e9e9e" : "rgb(12, 67, 173)",
4721
+ backgroundColor: ve ? "#9e9e9e" : "rgb(12, 67, 173)",
4764
4722
  border: "none",
4765
4723
  color: "#fff",
4766
- cursor: ze ? "not-allowed" : "pointer",
4724
+ cursor: ve ? "not-allowed" : "pointer",
4767
4725
  fontFamily: "system-ui, sans-serif",
4768
4726
  letterSpacing: "0.4px",
4769
4727
  lineHeight: "36px"
4770
4728
  },
4771
4729
  children: "Continue"
4772
- }) : F(He, {
4730
+ }) : F(We, {
4773
4731
  children: [
4774
4732
  i("button", {
4775
- disabled: ze,
4776
- onClick: () => Bt("use_form_measurements"),
4733
+ disabled: ve,
4734
+ onClick: () => At("use_form_measurements"),
4777
4735
  style: {
4778
4736
  padding: "6px 16px",
4779
4737
  borderRadius: 4,
4780
4738
  fontSize: 14,
4781
4739
  fontWeight: 500,
4782
- backgroundColor: ze ? "#9e9e9e" : "rgb(12, 67, 173)",
4740
+ backgroundColor: ve ? "#9e9e9e" : "rgb(12, 67, 173)",
4783
4741
  border: "none",
4784
4742
  color: "#fff",
4785
- cursor: ze ? "not-allowed" : "pointer",
4743
+ cursor: ve ? "not-allowed" : "pointer",
4786
4744
  fontFamily: "system-ui, sans-serif",
4787
4745
  letterSpacing: "0.4px",
4788
4746
  lineHeight: "36px"
@@ -4790,17 +4748,17 @@ let __tla = (async () => {
4790
4748
  children: "Set to Measurements"
4791
4749
  }),
4792
4750
  i("button", {
4793
- disabled: ze,
4794
- onClick: () => Bt("use_scan"),
4751
+ disabled: ve,
4752
+ onClick: () => At("use_scan"),
4795
4753
  style: {
4796
4754
  padding: "6px 16px",
4797
4755
  borderRadius: 4,
4798
4756
  fontSize: 14,
4799
4757
  fontWeight: 500,
4800
- backgroundColor: ze ? "#e0e0e0" : "#fff",
4758
+ backgroundColor: ve ? "#e0e0e0" : "#fff",
4801
4759
  border: "1px solid #bdbdbd",
4802
- color: ze ? "#999" : "#333",
4803
- cursor: ze ? "not-allowed" : "pointer",
4760
+ color: ve ? "#999" : "#333",
4761
+ cursor: ve ? "not-allowed" : "pointer",
4804
4762
  fontFamily: "system-ui, sans-serif",
4805
4763
  letterSpacing: "0.4px",
4806
4764
  lineHeight: "36px"
@@ -4815,7 +4773,7 @@ let __tla = (async () => {
4815
4773
  })
4816
4774
  ]
4817
4775
  }),
4818
- a && Lt.length > 0 && F("div", {
4776
+ a && wt.length > 0 && F("div", {
4819
4777
  style: {
4820
4778
  height: 120,
4821
4779
  flexShrink: 0,
@@ -4862,18 +4820,18 @@ let __tla = (async () => {
4862
4820
  },
4863
4821
  children: [
4864
4822
  "WASM ",
4865
- Ne.current ? "v2" : "N/A",
4823
+ Ee.current ? "v2" : "N/A",
4866
4824
  " | ",
4867
- T.length,
4825
+ O.length,
4868
4826
  " pts | ",
4869
- U ? "aligned" : "unaligned",
4827
+ K ? "aligned" : "unaligned",
4870
4828
  " | ",
4871
- j.length,
4829
+ N.length,
4872
4830
  " slices"
4873
4831
  ]
4874
4832
  }),
4875
4833
  i("button", {
4876
- onClick: () => Qt([]),
4834
+ onClick: () => Ot([]),
4877
4835
  style: {
4878
4836
  background: "none",
4879
4837
  border: "1px solid #30363d",
@@ -4890,43 +4848,43 @@ let __tla = (async () => {
4890
4848
  ]
4891
4849
  }),
4892
4850
  i("div", {
4893
- ref: at,
4851
+ ref: Je,
4894
4852
  style: {
4895
4853
  flex: 1,
4896
4854
  overflowY: "auto",
4897
4855
  padding: "4px 10px",
4898
4856
  lineHeight: 1.6
4899
4857
  },
4900
- children: Lt.map((y, D) => {
4901
- const R = y.includes("ERROR") || y.includes("failed"), W = y.includes("warning") || y.includes("WARN"), ge = y.includes("PIPELINE:"), G = y.includes("STATE:");
4858
+ children: wt.map((y, I) => {
4859
+ const B = y.includes("ERROR") || y.includes("failed"), W = y.includes("warning") || y.includes("WARN"), pe = y.includes("PIPELINE:"), T = y.includes("STATE:");
4902
4860
  return i("div", {
4903
4861
  style: {
4904
- color: R ? "#f85149" : W ? "#d29922" : ge ? "#58a6ff" : G ? "#3fb950" : "#8b949e",
4862
+ color: B ? "#f85149" : W ? "#d29922" : pe ? "#58a6ff" : T ? "#3fb950" : "#8b949e",
4905
4863
  whiteSpace: "pre"
4906
4864
  },
4907
4865
  children: y
4908
- }, D);
4866
+ }, I);
4909
4867
  })
4910
4868
  })
4911
4869
  ]
4912
4870
  })
4913
4871
  ]
4914
4872
  }),
4915
- Bn && i(Fn, {
4916
- onSkip: sn,
4917
- onCancel: () => Pt(false)
4873
+ wn && i(un, {
4874
+ onSkip: Gt,
4875
+ onCancel: () => yt(false)
4918
4876
  })
4919
4877
  ]
4920
4878
  });
4921
4879
  };
4922
- function xr({ screenshotFnRef: t }) {
4923
- return K(() => {
4880
+ function Qo({ screenshotFnRef: t }) {
4881
+ return U(() => {
4924
4882
  t.current = null;
4925
4883
  }, [
4926
4884
  t
4927
4885
  ]), null;
4928
4886
  }
4929
- Dn = function(t) {
4887
+ mn = function(t) {
4930
4888
  const r = t === "AK" ? 2 : 1, n = [];
4931
4889
  for (let o = 2; o >= 1; o -= r) n.push(`${o}_above`);
4932
4890
  n.push("at_ref");
@@ -4945,25 +4903,25 @@ let __tla = (async () => {
4945
4903
  ]) n.push(`${o}_below`);
4946
4904
  return n;
4947
4905
  };
4948
- xt = function(t, r) {
4949
- const n = Dn(r), o = {};
4906
+ lt = function(t, r) {
4907
+ const n = mn(r), o = {};
4950
4908
  for (let s = 0; s < Math.min(t.length, n.length); s++) {
4951
4909
  const a = t[s];
4952
4910
  a != null && !isNaN(a) && (o[n[s]] = a);
4953
4911
  }
4954
4912
  return o;
4955
4913
  };
4956
- br = function(t, r) {
4914
+ qo = function(t, r) {
4957
4915
  if (!t) return;
4958
- const o = Dn(r).map((s) => {
4916
+ const o = mn(r).map((s) => {
4959
4917
  const a = t[s];
4960
4918
  return a ?? void 0;
4961
4919
  });
4962
4920
  if (!o.every((s) => s == null)) return o;
4963
4921
  };
4964
- Pr = ({ request: t, onComplete: r, wasmModule: n }) => {
4965
- const [o, s] = B(null);
4966
- K(() => {
4922
+ cr = ({ request: t, onComplete: r, wasmModule: n }) => {
4923
+ const [o, s] = R(null);
4924
+ U(() => {
4967
4925
  if (n != null) return;
4968
4926
  let e = false;
4969
4927
  const m = async (d) => {
@@ -4983,23 +4941,23 @@ let __tla = (async () => {
4983
4941
  }, [
4984
4942
  n
4985
4943
  ]);
4986
- const a = n !== void 0 ? n : o ?? void 0, c = H(() => br(t.form_measurements, t.spacing_type), [
4944
+ const a = n !== void 0 ? n : o ?? void 0, c = j(() => qo(t.form_measurements, t.spacing_type), [
4987
4945
  t.form_measurements,
4988
4946
  t.spacing_type
4989
4947
  ]), l = (e) => {
4990
4948
  var _a, _b;
4991
- const m = e.scanMeasurements.map((A) => +(A.modifiedValue ?? A.originalValue).toFixed(1)), d = xt(m, t.spacing_type);
4949
+ const m = e.scanMeasurements.map((A) => +(A.modifiedValue ?? A.originalValue).toFixed(1)), d = lt(m, t.spacing_type);
4992
4950
  let f, u;
4993
4951
  if (e.formMeasurements) {
4994
- f = xt(e.formMeasurements, t.spacing_type);
4995
- const A = e.scanMeasurements.map((L, v) => {
4952
+ f = lt(e.formMeasurements, t.spacing_type);
4953
+ const A = e.scanMeasurements.map((P, v) => {
4996
4954
  var _a2;
4997
4955
  const k = (_a2 = e.formMeasurements) == null ? void 0 : _a2[v];
4998
- return k == null || isNaN(k) ? null : +((L.modifiedValue ?? L.originalValue) - k).toFixed(1);
4956
+ return k == null || isNaN(k) ? null : +((P.modifiedValue ?? P.originalValue) - k).toFixed(1);
4999
4957
  });
5000
- u = xt(A, t.spacing_type);
4958
+ u = lt(A, t.spacing_type);
5001
4959
  }
5002
- 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 = {
4960
+ const x = e.userEnteredMeasurements ? lt(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 = {
5003
4961
  spacing_type: t.spacing_type,
5004
4962
  source_unit: "mm",
5005
4963
  file_format: e.fileFormat,
@@ -5031,8 +4989,8 @@ let __tla = (async () => {
5031
4989
  height: "100%",
5032
4990
  display: "flex"
5033
4991
  },
5034
- children: i(mr, {
5035
- config: go,
4992
+ children: i(Jo, {
4993
+ config: Kn,
5036
4994
  spacingType: t.spacing_type,
5037
4995
  scanUrl: t.scan_url,
5038
4996
  formMeasurements: c,
@@ -5043,9 +5001,9 @@ let __tla = (async () => {
5043
5001
  };
5044
5002
  })();
5045
5003
  export {
5046
- Pr as G,
5004
+ cr as G,
5047
5005
  __tla,
5048
- xt as a,
5049
- br as c,
5050
- Dn as g
5006
+ lt as a,
5007
+ qo as c,
5008
+ mn as g
5051
5009
  };