@solid-labs/fab-one-widget 1.0.18 → 1.0.19

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 C, jsx as i, Fragment as We } from "react/jsx-runtime";
2
- import { createContext as co, Component as fo, useCallback as Q, useMemo as V, useState as B, memo as uo, useEffect as q, useRef as le, forwardRef as po, createElement as un } from "react";
3
- import { useFrame as yn, useThree as wn, Canvas as ho } from "@react-three/fiber";
4
- import { Html as je, Line as fe, OrbitControls as Sn } from "@react-three/drei";
5
- import * as H from "three";
6
- import { Plane as bt, Vector3 as M, Box3 as vn, Line3 as Cn, Raycaster as go } from "three";
7
- import { create as mo } from "zustand";
1
+ import { jsxs as M, jsx as i, Fragment as We } from "react/jsx-runtime";
2
+ import { createContext as ao, Component as co, useCallback as J, useMemo as V, useState as B, memo as fo, useEffect as U, useRef as le, forwardRef as uo, createElement as fn } from "react";
3
+ import { useFrame as yn, useThree as wn, Canvas as po } from "@react-three/fiber";
4
+ import { Html as je, Line as de, OrbitControls as Sn } from "@react-three/drei";
5
+ import * as O from "three";
6
+ import { Plane as bt, Vector3 as F, Box3 as vn, Line3 as Cn, Raycaster as ho } from "three";
7
+ import { create as go } from "zustand";
8
8
  import { OBJLoader as zn } from "three/examples/jsm/loaders/OBJLoader.js";
9
- import { STLLoader as xo } from "three/examples/jsm/loaders/STLLoader.js";
9
+ import { STLLoader as mo } from "three/examples/jsm/loaders/STLLoader.js";
10
10
  import { MeshBVH as yt } from "three-mesh-bvh";
11
- let Rr, gt, vr, Rn;
11
+ let Rr, gt, vr, Dn;
12
12
  let __tla = (async () => {
13
- const bo = {
13
+ const xo = {
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
- }, yo = {
22
+ }, bo = {
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
- }, wo = co(bo), Nt = mo((t, r) => ({
31
+ }, yo = ao(xo), Ht = go((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
- })), So = 0.45, wt = 3, Ot = 1e-3, mt = 25.4, vo = [
67
+ })), wo = 0.45, wt = 3, Tt = 1e-3, mt = 25.4, So = [
68
68
  0.25,
69
69
  -0.25,
70
70
  0.5,
71
71
  -0.5
72
72
  ];
73
- function Co(t) {
73
+ function vo(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,47 +90,47 @@ let __tla = (async () => {
90
90
  colors: new Float32Array(s)
91
91
  } : null;
92
92
  }
93
- function zo(t, r, n, o) {
93
+ function Co(t, r, n, o) {
94
94
  const s = t.getAttribute("position"), l = s.count, c = new Float32Array(l * 3), a = r.length / 3;
95
95
  let e = 1 / 0, g = 1 / 0, d = 1 / 0, f = -1 / 0, u = -1 / 0, h = -1 / 0;
96
- for (let R = 0; R < a; R++) {
97
- const P = r[R * 3] * o, E = r[R * 3 + 1] * o, T = r[R * 3 + 2] * o;
98
- P < e && (e = P), P > f && (f = P), E < g && (g = E), E > u && (u = E), T < d && (d = T), T > h && (h = T);
96
+ for (let k = 0; k < a; k++) {
97
+ const R = r[k * 3] * o, T = r[k * 3 + 1] * o, N = r[k * 3 + 2] * o;
98
+ R < e && (e = R), R > f && (f = R), T < g && (g = T), T > u && (u = T), N < d && (d = N), N > h && (h = N);
99
99
  }
100
- const z = (e + f) * 0.5, p = (g + u) * 0.5, x = (d + h) * 0.5, m = f - e + 1e-6, k = u - g + 1e-6, S = h - d + 1e-6, F = m * 0.5, v = k * 0.5, w = S * 0.5, A = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), b = m / A, _ = k / A, L = S / A, I = /* @__PURE__ */ new Map();
101
- for (let R = 0; R < a; R++) {
102
- const P = r[R * 3] * o - z, E = r[R * 3 + 1] * o - p, T = r[R * 3 + 2] * o - x, Y = Math.min(A - 1, Math.max(0, Math.floor((P + F) / b))), ae = Math.min(A - 1, Math.max(0, Math.floor((E + v) / _))), ce = Math.min(A - 1, Math.max(0, Math.floor((T + w) / L))), ue = Y * A * A + ae * A + ce;
103
- let re = I.get(ue);
104
- re || (re = [], I.set(ue, re)), re.push(R);
100
+ const A = (e + f) * 0.5, p = (g + u) * 0.5, x = (d + h) * 0.5, m = f - e + 1e-6, L = u - g + 1e-6, S = h - d + 1e-6, P = m * 0.5, z = L * 0.5, w = S * 0.5, C = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), b = m / C, I = L / C, _ = S / C, v = /* @__PURE__ */ new Map();
101
+ for (let k = 0; k < a; k++) {
102
+ const R = r[k * 3] * o - A, T = r[k * 3 + 1] * o - p, N = r[k * 3 + 2] * o - x, Q = Math.min(C - 1, Math.max(0, Math.floor((R + P) / b))), be = Math.min(C - 1, Math.max(0, Math.floor((T + z) / I))), ae = Math.min(C - 1, Math.max(0, Math.floor((N + w) / _))), fe = Q * C * C + be * C + ae;
103
+ let re = v.get(fe);
104
+ re || (re = [], v.set(fe, re)), re.push(k);
105
105
  }
106
- for (let R = 0; R < l; R++) {
107
- const P = s.getX(R), E = s.getY(R), T = s.getZ(R), Y = Math.min(A - 1, Math.max(0, Math.floor((P + F) / b))), ae = Math.min(A - 1, Math.max(0, Math.floor((E + v) / _))), ce = Math.min(A - 1, Math.max(0, Math.floor((T + w) / L)));
108
- let ue = 1 / 0, re = 0;
109
- for (let ee = 0; ee <= A && ue > 0; ee++) {
110
- for (let Z = -ee; Z <= ee; Z++) for (let pe = -ee; pe <= ee; pe++) for (let K = -ee; K <= ee; K++) {
111
- if (ee > 0 && Math.abs(Z) < ee && Math.abs(pe) < ee && Math.abs(K) < ee) continue;
112
- const he = Y + Z, xe = ae + pe, ge = ce + K;
113
- if (he < 0 || he >= A || xe < 0 || xe >= A || ge < 0 || ge >= A) continue;
114
- const j = I.get(he * A * A + xe * A + ge);
106
+ for (let k = 0; k < l; k++) {
107
+ const R = s.getX(k), T = s.getY(k), N = s.getZ(k), Q = Math.min(C - 1, Math.max(0, Math.floor((R + P) / b))), be = Math.min(C - 1, Math.max(0, Math.floor((T + z) / I))), ae = Math.min(C - 1, Math.max(0, Math.floor((N + w) / _)));
108
+ let fe = 1 / 0, re = 0;
109
+ for (let ee = 0; ee <= C && fe > 0; ee++) {
110
+ for (let Y = -ee; Y <= ee; Y++) for (let ue = -ee; ue <= ee; ue++) for (let Z = -ee; Z <= ee; Z++) {
111
+ if (ee > 0 && Math.abs(Y) < ee && Math.abs(ue) < ee && Math.abs(Z) < ee) continue;
112
+ const pe = Q + Y, me = be + ue, he = ae + Z;
113
+ if (pe < 0 || pe >= C || me < 0 || me >= C || he < 0 || he >= C) continue;
114
+ const j = v.get(pe * C * C + me * C + he);
115
115
  if (j) for (const ne of j) {
116
- const be = r[ne * 3] * o - z, we = r[ne * 3 + 1] * o - p, ye = r[ne * 3 + 2] * o - x, oe = (P - be) ** 2 + (E - we) ** 2 + (T - ye) ** 2;
117
- oe < ue && (ue = oe, re = ne);
116
+ const xe = r[ne * 3] * o - A, we = r[ne * 3 + 1] * o - p, ye = r[ne * 3 + 2] * o - x, oe = (R - xe) ** 2 + (T - we) ** 2 + (N - ye) ** 2;
117
+ oe < fe && (fe = oe, re = ne);
118
118
  }
119
119
  }
120
- if (ue < 1 / 0) break;
120
+ if (fe < 1 / 0) break;
121
121
  }
122
- c[R * 3] = n[re * 3], c[R * 3 + 1] = n[re * 3 + 1], c[R * 3 + 2] = n[re * 3 + 2];
122
+ c[k * 3] = n[re * 3], c[k * 3 + 1] = n[re * 3 + 1], c[k * 3 + 2] = n[re * 3 + 2];
123
123
  }
124
- t.setAttribute("color", new H.Float32BufferAttribute(c, 3));
124
+ t.setAttribute("color", new O.Float32BufferAttribute(c, 3));
125
125
  }
126
- const pn = {
126
+ const un = {
127
127
  debug: 0,
128
128
  info: 1,
129
129
  warn: 2,
130
130
  error: 3
131
131
  };
132
132
  let Mn = "warn", An = null;
133
- const de = {
133
+ const ce = {
134
134
  setLevel(t) {
135
135
  Mn = t;
136
136
  },
@@ -151,7 +151,7 @@ let __tla = (async () => {
151
151
  }
152
152
  };
153
153
  function ut(t, r, n, o) {
154
- if (pn[t] < pn[Mn]) return;
154
+ if (un[t] < un[Mn]) return;
155
155
  const s = `[${r}]`, l = o !== void 0 ? [
156
156
  s,
157
157
  n,
@@ -190,12 +190,12 @@ let __tla = (async () => {
190
190
  };
191
191
  }
192
192
  function Fn(t, r) {
193
- const n = new H.BufferGeometry();
194
- return n.setAttribute("position", new H.Float32BufferAttribute(t, 3)), n.setIndex(new H.BufferAttribute(r, 1)), n.computeVertexNormals(), n;
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;
195
195
  }
196
- async function Mo(t, r, n) {
196
+ async function zo(t, r, n) {
197
197
  try {
198
- const o = Co(t);
198
+ const o = vo(t);
199
199
  n == null ? void 0 : n("Parsing mesh...");
200
200
  const l = new zn().parse(t);
201
201
  let c = null;
@@ -203,30 +203,30 @@ let __tla = (async () => {
203
203
  m.isMesh && !c && (c = m.geometry);
204
204
  }), !c) return null;
205
205
  const { positions: a, indices: e } = xt(c);
206
- if (a.length < 9 || e.length < 3) return de.warn("wasm", `Mesh too small: positions=${a.length} indices=${e.length}`), null;
207
- for (let m = 0; m < Math.min(a.length, 300); m++) if (!isFinite(a[m])) return de.error("wasm", `Invalid position data: NaN/Infinity at index ${m}`), null;
206
+ if (a.length < 9 || e.length < 3) return ce.warn("wasm", `Mesh too small: positions=${a.length} indices=${e.length}`), null;
207
+ for (let m = 0; m < Math.min(a.length, 300); m++) if (!isFinite(a[m])) return ce.error("wasm", `Invalid position data: NaN/Infinity at index ${m}`), null;
208
208
  const g = a.length / 3;
209
- for (let m = 0; m < Math.min(e.length, 300); m++) if (e[m] >= g) return de.error("wasm", `Out-of-bounds index: ${e[m]} >= ${g}`), null;
209
+ for (let m = 0; m < Math.min(e.length, 300); m++) if (e[m] >= g) return ce.error("wasm", `Out-of-bounds index: ${e[m]} >= ${g}`), null;
210
210
  n == null ? void 0 : n("Processing mesh (WASM)...");
211
- const d = r.preprocess_mesh(a, e, 10, 1e-4, 500), f = d.positions(), u = d.indices(), h = d.unit_converted(), z = d.detected_unit(), p = d.log();
212
- if (de.debug("wasm", "preprocess result", p), f.length === 0) return null;
211
+ const d = r.preprocess_mesh(a, e, 10, 1e-4, 500), f = d.positions(), u = d.indices(), h = d.unit_converted(), A = d.detected_unit(), p = d.log();
212
+ if (ce.debug("wasm", "preprocess result", p), f.length === 0) return null;
213
213
  n == null ? void 0 : n("Building geometry...");
214
214
  const x = Fn(f, u);
215
215
  if (o) {
216
216
  const m = h ? 1e3 : 1;
217
- zo(x, o.positions, o.colors, m);
217
+ Co(x, o.positions, o.colors, m);
218
218
  }
219
219
  return {
220
220
  geometry: x,
221
221
  wasScaled: h,
222
222
  unitConverted: h,
223
- detectedUnit: z
223
+ detectedUnit: A
224
224
  };
225
225
  } catch (o) {
226
- return de.error("wasm", "Processing failed", o), null;
226
+ return ce.error("wasm", "Processing failed", o), null;
227
227
  }
228
228
  }
229
- function Ao(t) {
229
+ function Mo(t) {
230
230
  const n = new zn().parse(t);
231
231
  let o = null;
232
232
  return n.traverse((s) => {
@@ -234,7 +234,7 @@ let __tla = (async () => {
234
234
  }), o;
235
235
  }
236
236
  async function $t(t) {
237
- const r = await t.arrayBuffer(), s = new xo().parse(r).getAttribute("position");
237
+ const r = await t.arrayBuffer(), s = new mo().parse(r).getAttribute("position");
238
238
  if (!s || s.count === 0) throw new Error("Empty STL geometry");
239
239
  const l = [];
240
240
  for (let c = 0; c < s.count; c++) l.push(`v ${s.getX(c)} ${s.getY(c)} ${s.getZ(c)}`);
@@ -242,11 +242,11 @@ let __tla = (async () => {
242
242
  return l.join(`
243
243
  `);
244
244
  }
245
- function Fo(t, r) {
245
+ function Ao(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 ko(t, r) {
249
+ function Fo(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());
@@ -260,7 +260,7 @@ let __tla = (async () => {
260
260
  function kn(t, r = 1e-3, n = false) {
261
261
  if (!t.length) return [];
262
262
  const o = /* @__PURE__ */ new Map(), s = (f) => {
263
- const u = Fo(f, r);
263
+ const u = Ao(f, r);
264
264
  let h = o.get(u);
265
265
  return h || (h = f.clone(), o.set(u, h)), h;
266
266
  }, l = t.map((f) => ({
@@ -285,12 +285,12 @@ let __tla = (async () => {
285
285
  l.splice(p, 1), h = true;
286
286
  }
287
287
  }
288
- const z = ko(u, r);
289
- z.length > 1 && c.push(z);
288
+ const A = Fo(u, r);
289
+ A.length > 1 && c.push(A);
290
290
  }
291
291
  if (!c.length) return [];
292
292
  if (n) {
293
- c.sort((h, z) => Ge(z) - Ge(h));
293
+ c.sort((h, A) => Ge(A) - Ge(h));
294
294
  const f = Ge(c[0]), u = c.filter((h) => Ge(h) >= f * 0.3);
295
295
  return u[u.length - 1] ?? c[0];
296
296
  }
@@ -301,21 +301,21 @@ let __tla = (async () => {
301
301
  let u = 0, h = 0;
302
302
  for (const p of f) u += p.x, h += p.z;
303
303
  u /= f.length, h /= f.length;
304
- const z = Math.sqrt(u * u + h * h);
305
- z < d && (d = z, g = f);
304
+ const A = Math.sqrt(u * u + h * h);
305
+ A < d && (d = A, g = f);
306
306
  }
307
307
  return g;
308
308
  }
309
- function hn(t, r, n, o = false) {
310
- const s = new bt(new M(0, 1, 0), -n), l = [], c = new vn();
309
+ function pn(t, r, n, o = false) {
310
+ const s = new bt(new F(0, 1, 0), -n), l = [], c = new vn();
311
311
  c.setFromBufferAttribute(r.getAttribute("position"));
312
312
  const a = {
313
313
  linePoints: [],
314
314
  lineLength: 0,
315
- rightmostPoint: new M(0, n, 0)
315
+ rightmostPoint: new F(0, n, 0)
316
316
  };
317
317
  if (!s.intersectsBox(c)) return a;
318
- const e = new Cn(), g = new M();
318
+ const e = new Cn(), g = new F();
319
319
  t.shapecast({
320
320
  intersectsBounds: (p) => s.intersectsBox(p),
321
321
  intersectsTriangle: (p) => {
@@ -326,35 +326,35 @@ let __tla = (async () => {
326
326
  });
327
327
  }
328
328
  });
329
- const d = kn(l, Ot, o);
329
+ const d = kn(l, Tt, o);
330
330
  if (d.length < 2) return a;
331
331
  const f = Ge(d);
332
- let u = -1 / 0, h = new M(0, n, 0);
332
+ let u = -1 / 0, h = new F(0, n, 0);
333
333
  for (const p of d) p.x > u && (u = p.x, h = p.clone());
334
- const z = d.length > 2 && d[0].distanceTo(d[d.length - 1]) < Ot * 10;
334
+ const A = d.length > 2 && d[0].distanceTo(d[d.length - 1]) < Tt * 10;
335
335
  return {
336
336
  linePoints: d,
337
337
  lineLength: f,
338
338
  rightmostPoint: h,
339
- isClosed: z
339
+ isClosed: A
340
340
  };
341
341
  }
342
342
  function Ne(t, r, n, o = false) {
343
- const s = hn(t, r, n, o);
343
+ const s = pn(t, r, n, o);
344
344
  if (s.isClosed && s.linePoints.length >= 3) return s;
345
- de.debug("slice", `y=${n.toFixed(2)} failed (pts=${s.linePoints.length}, closed=${s.isClosed}), retrying...`);
345
+ ce.debug("slice", `y=${n.toFixed(2)} failed (pts=${s.linePoints.length}, closed=${s.isClosed}), retrying...`);
346
346
  let l = s;
347
- for (const c of vo) {
348
- const a = hn(t, r, n + c, o);
349
- if (a.isClosed && a.linePoints.length >= 3) return de.debug("slice", `y=${n.toFixed(2)} recovered with offset ${c > 0 ? "+" : ""}${c}mm (pts=${a.linePoints.length}, len=${a.lineLength.toFixed(1)}mm)`), a;
347
+ for (const c of So) {
348
+ const a = pn(t, r, n + c, o);
349
+ if (a.isClosed && a.linePoints.length >= 3) return ce.debug("slice", `y=${n.toFixed(2)} recovered with offset ${c > 0 ? "+" : ""}${c}mm (pts=${a.linePoints.length}, len=${a.lineLength.toFixed(1)}mm)`), a;
350
350
  a.linePoints.length > l.linePoints.length && (l = a);
351
351
  }
352
- return de.warn("slice", `y=${n.toFixed(2)} all retries exhausted (pts=${l.linePoints.length}, closed=${l.isClosed})`), l;
352
+ return ce.warn("slice", `y=${n.toFixed(2)} all retries exhausted (pts=${l.linePoints.length}, closed=${l.isClosed})`), l;
353
353
  }
354
- function Po(t, r, n, o) {
354
+ function ko(t, r, n, o) {
355
355
  const s = new bt().setFromNormalAndCoplanarPoint(o.clone().normalize(), n), l = new vn();
356
356
  if (l.setFromBufferAttribute(r.getAttribute("position")), !s.intersectsBox(l)) return 0;
357
- const c = [], a = new Cn(), e = new M();
357
+ const c = [], a = new Cn(), e = new F();
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 g = kn(c, Ot);
368
+ const g = kn(c, Tt);
369
369
  return Ge(g);
370
370
  }
371
- function Ht(t) {
371
+ function Ot(t) {
372
372
  return new yt(t, {
373
373
  maxLeafTris: wt
374
374
  });
375
375
  }
376
- function Lo(t, r, n, o) {
376
+ function Po(t, r, n, o) {
377
377
  const s = t.getIndex(), l = s ? s.count / 3 : 0;
378
378
  if (l < 10) return {
379
379
  valid: false,
@@ -425,29 +425,29 @@ let __tla = (async () => {
425
425
  };
426
426
  }
427
427
  const ke = "pipeline";
428
- function _o(t, r, n, o) {
428
+ function Lo(t, r, n, o) {
429
429
  var _a, _b, _c, _d;
430
430
  const s = t.geometry.clone(), l = r.map((a) => ({
431
431
  ...a
432
432
  })), c = o.wasmModule;
433
433
  try {
434
- let a = t.geometry, e = l.map((j) => new M(j.position.x, j.position.y, j.position.z));
434
+ let a = t.geometry, e = l.map((j) => new F(j.position.x, j.position.y, j.position.z));
435
435
  const g = e[0], d = e[1];
436
436
  if (!c) {
437
- o.onStatus("Aligning mesh (JS fallback)..."), de.warn(ke, "WASM not available, using JS fallback alignment");
438
- const j = new M(0, 1, 0), ne = new M().subVectors(d, g).normalize(), be = ne.dot(j), we = new M().crossVectors(ne, j);
437
+ o.onStatus("Aligning mesh (JS fallback)..."), ce.warn(ke, "WASM not available, using JS fallback alignment");
438
+ const j = new F(0, 1, 0), ne = new F().subVectors(d, g).normalize(), xe = ne.dot(j), we = new F().crossVectors(ne, j);
439
439
  if (we.length() > 1e-4) {
440
440
  we.normalize();
441
- const G = new H.Quaternion().setFromAxisAngle(we, Math.acos(Math.min(1, Math.max(-1, be))));
442
- a.applyMatrix4(new H.Matrix4().makeRotationFromQuaternion(G)), e = e.map((Pe) => Pe.clone().applyQuaternion(G));
441
+ const G = new O.Quaternion().setFromAxisAngle(we, Math.acos(Math.min(1, Math.max(-1, xe))));
442
+ a.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(G)), e = e.map((Pe) => Pe.clone().applyQuaternion(G));
443
443
  }
444
444
  if (e[0].y > e[1].y) {
445
- const G = new H.Quaternion().setFromAxisAngle(new M(1, 0, 0), Math.PI);
446
- a.applyMatrix4(new H.Matrix4().makeRotationFromQuaternion(G)), e = e.map((Pe) => Pe.clone().applyQuaternion(G));
445
+ const G = new O.Quaternion().setFromAxisAngle(new F(1, 0, 0), Math.PI);
446
+ a.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(G)), e = e.map((Pe) => Pe.clone().applyQuaternion(G));
447
447
  }
448
448
  const ye = e[0].clone();
449
- a.translate(-ye.x, -ye.y, -ye.z), e = e.map((G) => new M(G.x - ye.x, G.y - ye.y, G.z - ye.z)), a.computeVertexNormals(), a.computeBoundingBox();
450
- const oe = new M(e[0].x, e[0].y, e[0].z);
449
+ a.translate(-ye.x, -ye.y, -ye.z), e = e.map((G) => new F(G.x - ye.x, G.y - ye.y, G.z - ye.z)), a.computeVertexNormals(), a.computeBoundingBox();
450
+ const oe = new F(e[0].x, e[0].y, e[0].z);
451
451
  e.push(oe), o.addLandmarkPoint({
452
452
  faceIndex: -1,
453
453
  vertexIndices: [
@@ -470,7 +470,7 @@ let __tla = (async () => {
470
470
  y: G.y,
471
471
  z: G.z
472
472
  }))), o.setAligned(true), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 * mt);
473
- const X = new M();
473
+ const X = new F();
474
474
  a.computeBoundingBox(), a.boundingBox.getSize(X), o.setModelSize(Math.max(X.x, X.y, X.z)), s.dispose();
475
475
  return;
476
476
  }
@@ -478,73 +478,73 @@ let __tla = (async () => {
478
478
  g.x,
479
479
  g.y,
480
480
  g.z
481
- ]), z = new Float32Array([
481
+ ]), A = new Float32Array([
482
482
  d.x,
483
483
  d.y,
484
484
  d.z
485
485
  ]);
486
486
  o.onStatus("Detecting shell type...");
487
- const p = c.detect_shell(f, u, z, 40), x = p.is_double_shell(), m = p.surface_normal();
488
- de.info(ke, `Shell: ${x ? "DOUBLE" : "SINGLE"}`, p.details()), (_a = o.setDoubleShell) == null ? void 0 : _a.call(o, x), o.onStatus("Finding cross-section plane...");
489
- const k = new Float32Array([
487
+ const p = c.detect_shell(f, u, A, 40), x = p.is_double_shell(), m = p.surface_normal();
488
+ ce.info(ke, `Shell: ${x ? "DOUBLE" : "SINGLE"}`, p.details()), (_a = o.setDoubleShell) == null ? void 0 : _a.call(o, x), o.onStatus("Finding cross-section plane...");
489
+ const L = new Float32Array([
490
490
  m[0],
491
491
  m[1],
492
492
  m[2]
493
- ]), S = c.find_min_cross_section(f, u, z, k, 10), F = S.plane_normal();
494
- de.info(ke, "Cross-section found", S.details()), o.onStatus("Aligning mesh...");
495
- const v = new Float32Array([
496
- F[0],
497
- F[1],
498
- F[2]
499
- ]), w = c.align_to_origin(f, h, z, v);
500
- let A = w.positions(), b = w.mpt(), _ = w.origin();
501
- const L = w.transform();
502
- de.info(ke, "Alignment complete", w.details());
503
- const I = [
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
- ], R = new Float32Array([
514
- I[0] * F[0] + I[1] * F[1] + I[2] * F[2],
515
- I[3] * F[0] + I[4] * F[1] + I[5] * F[2],
516
- I[6] * F[0] + I[7] * F[1] + I[8] * F[2]
493
+ ]), S = c.find_min_cross_section(f, u, A, L, 10), P = S.plane_normal();
494
+ ce.info(ke, "Cross-section found", S.details()), o.onStatus("Aligning mesh...");
495
+ const z = new Float32Array([
496
+ P[0],
497
+ P[1],
498
+ P[2]
499
+ ]), w = c.align_to_origin(f, h, A, z);
500
+ let C = w.positions(), b = w.mpt(), I = w.origin();
501
+ const _ = w.transform();
502
+ ce.info(ke, "Alignment complete", w.details());
503
+ const v = [
504
+ _[3],
505
+ _[4],
506
+ _[5],
507
+ _[6],
508
+ _[7],
509
+ _[8],
510
+ _[9],
511
+ _[10],
512
+ _[11]
513
+ ], k = new Float32Array([
514
+ v[0] * P[0] + v[1] * P[1] + v[2] * P[2],
515
+ v[3] * P[0] + v[4] * P[1] + v[5] * P[2],
516
+ v[6] * P[0] + v[7] * P[1] + v[8] * P[2]
517
517
  ]);
518
518
  o.onStatus("Generating measurement points...");
519
- const P = c.subdivide_origin_to_plane(new Float32Array(_), new Float32Array(b), R);
520
- de.debug(ke, `Subdivide: ${P.count()} pts, spacing=${P.spacing().toFixed(1)}mm`);
521
- const E = P.points(), T = P.count(), Y = 2, ae = 1, ce = [];
522
- for (let j = Y; j < T - ae; j++) ce.push(E[j * 3 + 1]);
519
+ const R = c.subdivide_origin_to_plane(new Float32Array(I), new Float32Array(b), k);
520
+ ce.debug(ke, `Subdivide: ${R.count()} pts, spacing=${R.spacing().toFixed(1)}mm`);
521
+ const T = R.points(), N = R.count(), Q = 2, be = 1, ae = [];
522
+ for (let j = Q; j < N - be; j++) ae.push(T[j * 3 + 1]);
523
523
  o.onStatus("Computing cross-sections...");
524
- let ue = [];
525
- if (ce.length >= 2) {
526
- const ne = (x ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(A, u, new Float32Array(ce), 10);
527
- de.debug(ke, "Batch (subdivision)", ne.details());
528
- const be = ne.all_loop_points(), we = ne.offsets(), ye = ne.circumferences();
524
+ let fe = [];
525
+ if (ae.length >= 2) {
526
+ const ne = (x ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(C, u, new Float32Array(ae), 10);
527
+ ce.debug(ke, "Batch (subdivision)", ne.details());
528
+ const xe = ne.all_loop_points(), we = ne.offsets(), ye = ne.circumferences();
529
529
  for (let oe = 0; oe < we.length - 1; oe++) {
530
530
  const X = we[oe], G = we[oe + 1];
531
531
  if (G <= X || ye[oe] <= 0) continue;
532
532
  const Pe = (G - X) / 3;
533
533
  if (Pe < 3) continue;
534
534
  let Fe = 0, Ve = 0, ie = 0;
535
- for (let Ae = X; Ae < G; Ae += 3) Fe += be[Ae], Ve += be[Ae + 1], ie += be[Ae + 2];
536
- ue.push(Fe / Pe, Ve / Pe, ie / Pe);
535
+ for (let Ae = X; Ae < G; Ae += 3) Fe += xe[Ae], Ve += xe[Ae + 1], ie += xe[Ae + 2];
536
+ fe.push(Fe / Pe, Ve / Pe, ie / Pe);
537
537
  }
538
538
  }
539
- if (ue.length >= 6) {
539
+ if (fe.length >= 6) {
540
540
  o.onStatus("Refining alignment...");
541
- const j = c.refine_alignment(new Float32Array(ue), A, new Float32Array(_), new Float32Array(b));
542
- de.info(ke, "Refinement complete", j.details()), A = j.positions(), b = j.mpt(), _ = j.origin();
541
+ const j = c.refine_alignment(new Float32Array(fe), C, new Float32Array(I), new Float32Array(b));
542
+ ce.info(ke, "Refinement complete", j.details()), C = j.positions(), b = j.mpt(), I = j.origin();
543
543
  }
544
- const re = a.getAttribute("color"), ee = Fn(A, u);
545
- re && ee.setAttribute("color", re), a.dispose(), a = ee, t.geometry = a, a.computeVertexNormals(), a.computeBoundingBox(), e[0] = new M(_[0], _[1], _[2]), e[1] = new M(b[0], b[1], b[2]), o.onStatus("Setting blue point...");
546
- const Z = new M(e[0].x, e[0].y, e[0].z);
547
- e.push(Z), o.addLandmarkPoint({
544
+ const re = a.getAttribute("color"), ee = Fn(C, u);
545
+ re && ee.setAttribute("color", re), a.dispose(), a = ee, t.geometry = a, a.computeVertexNormals(), a.computeBoundingBox(), e[0] = new F(I[0], I[1], I[2]), e[1] = new F(b[0], b[1], b[2]), o.onStatus("Setting blue point...");
546
+ const Y = new F(e[0].x, e[0].y, e[0].z);
547
+ e.push(Y), o.addLandmarkPoint({
548
548
  faceIndex: -1,
549
549
  vertexIndices: [
550
550
  0,
@@ -552,9 +552,9 @@ let __tla = (async () => {
552
552
  2
553
553
  ],
554
554
  position: {
555
- x: Z.x,
556
- y: Z.y,
557
- z: Z.z
555
+ x: Y.x,
556
+ y: Y.y,
557
+ z: Y.z
558
558
  },
559
559
  barycentricCoords: {
560
560
  u: 0.33,
@@ -566,10 +566,10 @@ let __tla = (async () => {
566
566
  y: j.y,
567
567
  z: j.z
568
568
  }))), o.setAligned(true);
569
- const pe = a.boundingBox, K = new M();
570
- pe.getSize(K), o.setModelSize(Math.max(K.x, K.y, K.z)), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 * mt), o.onStatus("Computing final measurements...");
569
+ const ue = a.boundingBox, Z = new F();
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 * mt), o.onStatus("Computing final measurements...");
571
571
  {
572
- const j = xt(a), ne = e[1].y, be = e[0].y;
572
+ const j = xt(a), ne = e[1].y, xe = e[0].y;
573
573
  let we = 1 / 0, ye = -1 / 0;
574
574
  const oe = j.positions;
575
575
  for (let ie = 1; ie < oe.length; ie += 3) oe[ie] < we && (we = oe[ie]), oe[ie] > ye && (ye = oe[ie]);
@@ -579,28 +579,28 @@ let __tla = (async () => {
579
579
  const Ae = ne + ie * X;
580
580
  Ae < ye - 1 && G.push(Ae);
581
581
  }
582
- for (let ie = ne - X; ie > be; ie -= X) G.push(ie);
583
- G.sort((ie, Ae) => ie - Ae), de.info(ke, `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`);
582
+ for (let ie = ne - X; ie > xe; ie -= X) G.push(ie);
583
+ G.sort((ie, Ae) => ie - Ae), ce.info(ke, `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
584
  const Fe = (x ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(j.positions, j.indices, new Float32Array(G), 10);
585
- de.info(ke, `Horizontal slices (${x ? "inner" : "outer"}): ${Fe.count()}/${G.length} valid`), de.debug(ke, "Slice details", Fe.details());
585
+ ce.info(ke, `Horizontal slices (${x ? "inner" : "outer"}): ${Fe.count()}/${G.length} valid`), ce.debug(ke, "Slice details", Fe.details());
586
586
  const Ve = {
587
587
  yValues: G,
588
588
  circumferences: Array.from(Fe.circumferences()),
589
589
  allLoopPoints: new Float32Array(Fe.all_loop_points()),
590
590
  offsets: new Uint32Array(Fe.offsets()),
591
591
  mptY: ne,
592
- originY: be
592
+ originY: xe
593
593
  };
594
594
  (_d = o.setWasmSlices) == null ? void 0 : _d.call(o, Ve);
595
595
  }
596
596
  o.onStatus("Validating results...");
597
- const he = e[1].y, xe = e[0].y, ge = Lo(a, he, xe, n);
598
- ge.valid || de.warn(ke, `Validation: ${ge.reason}`), o.setClippedReferenceGeometry ? (s.computeVertexNormals(), o.setClippedReferenceGeometry(s)) : s.dispose();
597
+ const pe = e[1].y, me = e[0].y, he = Po(a, pe, me, n);
598
+ he.valid || ce.warn(ke, `Validation: ${he.reason}`), o.setClippedReferenceGeometry ? (s.computeVertexNormals(), o.setClippedReferenceGeometry(s)) : s.dispose();
599
599
  } catch (a) {
600
- de.error(ke, "Processing failed", a), o.setError(a instanceof Error ? a.message : "Failed to process mesh."), s.dispose();
600
+ ce.error(ke, "Processing failed", a), o.setError(a instanceof Error ? a.message : "Failed to process mesh."), s.dispose();
601
601
  }
602
602
  }
603
- class Io extends fo {
603
+ class _o extends co {
604
604
  constructor() {
605
605
  super(...arguments), this.state = {
606
606
  error: null
@@ -619,7 +619,7 @@ let __tla = (async () => {
619
619
  console.error("[ErrorBoundary] Caught error:", r, n.componentStack);
620
620
  }
621
621
  render() {
622
- return this.state.error ? this.props.fallback ? this.props.fallback(this.state.error, this.reset) : C("div", {
622
+ return this.state.error ? this.props.fallback ? this.props.fallback(this.state.error, this.reset) : M("div", {
623
623
  style: {
624
624
  display: "flex",
625
625
  flexDirection: "column",
@@ -667,7 +667,7 @@ let __tla = (async () => {
667
667
  }) : this.props.children;
668
668
  }
669
669
  }
670
- const Do = ({ message: t, onDismiss: r }) => C("div", {
670
+ const Io = ({ message: t, onDismiss: r }) => M("div", {
671
671
  style: {
672
672
  position: "absolute",
673
673
  top: 16,
@@ -684,7 +684,7 @@ let __tla = (async () => {
684
684
  gap: 12
685
685
  },
686
686
  children: [
687
- C("div", {
687
+ M("div", {
688
688
  style: {
689
689
  flex: 1
690
690
  },
@@ -720,7 +720,7 @@ let __tla = (async () => {
720
720
  children: "x"
721
721
  })
722
722
  ]
723
- }), gn = ({ message: t }) => C("div", {
723
+ }), hn = ({ message: t }) => M("div", {
724
724
  style: {
725
725
  position: "absolute",
726
726
  top: 0,
@@ -758,44 +758,44 @@ let __tla = (async () => {
758
758
  })
759
759
  ]
760
760
  });
761
- function Ro(t, r, n, o) {
762
- const s = new M().subVectors(n, r), l = new M().subVectors(o, r), c = new M().subVectors(t, r), a = s.dot(s), e = s.dot(l), g = s.dot(c), d = l.dot(l), f = l.dot(c), u = 1 / (a * d - e * e), h = (d * g - e * f) * u, z = (a * f - e * g) * u;
761
+ function Do(t, r, n, o) {
762
+ const s = new F().subVectors(n, r), l = new F().subVectors(o, r), c = new F().subVectors(t, r), a = s.dot(s), e = s.dot(l), g = s.dot(c), d = l.dot(l), f = l.dot(c), u = 1 / (a * d - e * e), h = (d * g - e * f) * u, A = (a * f - e * g) * u;
763
763
  return {
764
- u: 1 - h - z,
764
+ u: 1 - h - A,
765
765
  v: h,
766
- w: z
766
+ w: A
767
767
  };
768
768
  }
769
- const Wo = ({ mesh: t, maxPoints: r = 2, meshColor: n = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: s = false, doubleShellTransparency: l = false }) => {
770
- const { addLandmarkPoint: c, landmarkPoints: a } = Nt(), e = Q((h) => {
769
+ const Ro = ({ mesh: t, maxPoints: r = 2, meshColor: n = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: s = false, doubleShellTransparency: l = false }) => {
770
+ const { addLandmarkPoint: c, landmarkPoints: a } = Ht(), e = J((h) => {
771
771
  if (a.length >= r) return;
772
772
  h.stopPropagation();
773
- const z = h.intersections[0], p = z == null ? void 0 : z.faceIndex;
774
- if (!z || p == null) return;
773
+ const A = h.intersections[0], p = A == null ? void 0 : A.faceIndex;
774
+ if (!A || p == null) return;
775
775
  const x = t.geometry, m = x.index;
776
- let k;
777
- m ? k = [
776
+ let L;
777
+ m ? L = [
778
778
  m.getX(p * 3),
779
779
  m.getX(p * 3 + 1),
780
780
  m.getX(p * 3 + 2)
781
- ] : k = [
781
+ ] : L = [
782
782
  p * 3,
783
783
  p * 3 + 1,
784
784
  p * 3 + 2
785
785
  ];
786
- const S = x.getAttribute("position"), F = new M().fromBufferAttribute(S, k[0]), v = new M().fromBufferAttribute(S, k[1]), w = new M().fromBufferAttribute(S, k[2]);
787
- F.applyMatrix4(t.matrixWorld), v.applyMatrix4(t.matrixWorld), w.applyMatrix4(t.matrixWorld);
788
- const A = z.point, b = Ro(A, F, v, w), _ = {
786
+ const S = x.getAttribute("position"), P = new F().fromBufferAttribute(S, L[0]), z = new F().fromBufferAttribute(S, L[1]), w = new F().fromBufferAttribute(S, L[2]);
787
+ P.applyMatrix4(t.matrixWorld), z.applyMatrix4(t.matrixWorld), w.applyMatrix4(t.matrixWorld);
788
+ const C = A.point, b = Do(C, P, z, w), I = {
789
789
  faceIndex: p,
790
- vertexIndices: k,
790
+ vertexIndices: L,
791
791
  position: {
792
- x: A.x,
793
- y: A.y,
794
- z: A.z
792
+ x: C.x,
793
+ y: C.y,
794
+ z: C.z
795
795
  },
796
796
  barycentricCoords: b
797
797
  };
798
- c(_);
798
+ c(I);
799
799
  }, [
800
800
  t,
801
801
  c,
@@ -803,9 +803,9 @@ let __tla = (async () => {
803
803
  r
804
804
  ]), g = V(() => !!t.geometry.getAttribute("color"), [
805
805
  t
806
- ]), d = l ? Math.min(o, 0.65) : o, f = d < 1, u = V(() => new H.MeshStandardMaterial({
806
+ ]), d = l ? Math.min(o, 0.65) : o, f = d < 1, u = V(() => new O.MeshStandardMaterial({
807
807
  color: g ? "#ffffff" : n,
808
- side: s ? H.FrontSide : H.DoubleSide,
808
+ side: s ? O.FrontSide : O.DoubleSide,
809
809
  roughness: 0.6,
810
810
  metalness: 0.1,
811
811
  transparent: f,
@@ -826,9 +826,9 @@ let __tla = (async () => {
826
826
  material: u,
827
827
  renderOrder: l ? 0 : void 0
828
828
  });
829
- }, Bo = ({ point: t, index: r, markerSize: n, color: o, label: s }) => {
829
+ }, Wo = ({ point: t, index: r, markerSize: n, color: o, label: s }) => {
830
830
  const [l, c] = B(false);
831
- return C("mesh", {
831
+ return M("mesh", {
832
832
  position: [
833
833
  t.position.x,
834
834
  t.position.y,
@@ -868,8 +868,8 @@ let __tla = (async () => {
868
868
  })
869
869
  ]
870
870
  }, r);
871
- }, Eo = ({ modelSize: t, labels: r }) => {
872
- const { landmarkPoints: n } = Nt(), o = t * 0.02, s = [
871
+ }, Bo = ({ modelSize: t, labels: r }) => {
872
+ const { landmarkPoints: n } = Ht(), o = t * 0.02, s = [
873
873
  "#44ff44",
874
874
  "#ff4444",
875
875
  "#4444ff"
@@ -879,7 +879,7 @@ let __tla = (async () => {
879
879
  "Cut Plane"
880
880
  ];
881
881
  return i(We, {
882
- children: n.map((a, e) => i(Bo, {
882
+ children: n.map((a, e) => i(Wo, {
883
883
  point: a,
884
884
  index: e,
885
885
  markerSize: o,
@@ -895,38 +895,38 @@ let __tla = (async () => {
895
895
  t
896
896
  ]);
897
897
  }
898
- const mn = (t, r) => {
898
+ const gn = (t, r) => {
899
899
  const n = Math.abs(t - r);
900
900
  return n <= 7 ? "#8BC34A" : n <= 20 ? "#FFC107" : "#FF5722";
901
- }, xn = new H.Color("#8BC34A"), bn = new H.Color("#FFC107"), $o = new H.Color("#FF5722"), To = (t) => {
902
- if (t <= 7) return xn.clone();
901
+ }, mn = new O.Color("#8BC34A"), xn = new O.Color("#FFC107"), Eo = new O.Color("#FF5722"), $o = (t) => {
902
+ if (t <= 7) return mn.clone();
903
903
  if (t <= 20) {
904
904
  const n = (t - 7) / 13;
905
- return xn.clone().lerp(bn, n);
905
+ return mn.clone().lerp(xn, n);
906
906
  }
907
907
  const r = Math.min((t - 20) / 20, 1);
908
- return bn.clone().lerp($o, r);
909
- }, Oo = (t, r) => {
908
+ return xn.clone().lerp(Eo, r);
909
+ }, To = (t, r) => {
910
910
  const n = t.length, o = new Float32Array(n * 2 * 3), s = new Float32Array(n * 2 * 3), l = [];
911
911
  for (let e = 0; e < n; e++) {
912
- const g = t[e], d = r[e], f = g.distanceTo(d), u = To(f);
912
+ const g = t[e], d = r[e], f = g.distanceTo(d), u = $o(f);
913
913
  if (o[e * 6] = g.x, o[e * 6 + 1] = g.y, o[e * 6 + 2] = g.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
- const h = e * 2, z = h + 1, p = (e + 1) * 2, x = p + 1;
915
- l.push(h, z, p, z, x, p);
914
+ const h = e * 2, A = h + 1, p = (e + 1) * 2, x = p + 1;
915
+ l.push(h, A, p, A, x, p);
916
916
  }
917
917
  }
918
- const c = new H.BufferGeometry();
919
- c.setAttribute("position", new H.Float32BufferAttribute(o, 3)), c.setAttribute("color", new H.Float32BufferAttribute(s, 3)), c.setIndex(l);
920
- const a = new H.MeshBasicMaterial({
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(l);
920
+ const a = new O.MeshBasicMaterial({
921
921
  vertexColors: true,
922
922
  transparent: true,
923
923
  opacity: 0.25,
924
- side: H.DoubleSide,
924
+ side: O.DoubleSide,
925
925
  depthTest: false,
926
926
  depthWrite: false
927
927
  });
928
- return new H.Mesh(c, a);
929
- }, Ho = ({ bvh: t, geometry: r, yPosition: n, color: o = "#00ff00", labelX: s, onDataChange: l, displayUnit: c = "mm", useInnerSurface: a = false, formValue: e, lineWidth: g = 1.5, wasmLoopPoints: d, wasmCircumference: f }) => {
928
+ return new O.Mesh(c, a);
929
+ }, Oo = ({ bvh: t, geometry: r, yPosition: n, color: o = "#00ff00", labelX: s, onDataChange: l, displayUnit: c = "mm", useInnerSurface: a = false, formValue: e, lineWidth: g = 1.5, wasmLoopPoints: d, wasmCircumference: f }) => {
930
930
  const u = V(() => d && f != null ? null : Ne(t, r, n, a), [
931
931
  t,
932
932
  r,
@@ -934,69 +934,69 @@ let __tla = (async () => {
934
934
  a,
935
935
  d,
936
936
  f
937
- ]), h = d ?? (u == null ? void 0 : u.linePoints) ?? [], z = f ?? (u == null ? void 0 : u.lineLength) ?? 0, p = V(() => {
938
- if (e == null || e === 0 || z <= 0 || h.length < 2) return null;
939
- const S = e / z, F = h.reduce((w, A) => w + A.x, 0) / h.length, v = h.reduce((w, A) => w + A.z, 0) / h.length;
940
- return h.map((w) => new M(F + (w.x - F) * S, w.y, v + (w.z - v) * S));
937
+ ]), h = d ?? (u == null ? void 0 : u.linePoints) ?? [], A = f ?? (u == null ? void 0 : u.lineLength) ?? 0, p = V(() => {
938
+ if (e == null || e === 0 || A <= 0 || h.length < 2) return null;
939
+ const S = e / A, P = h.reduce((w, C) => w + C.x, 0) / h.length, z = h.reduce((w, C) => w + C.z, 0) / h.length;
940
+ return h.map((w) => new F(P + (w.x - P) * S, w.y, z + (w.z - z) * S));
941
941
  }, [
942
942
  h,
943
- z,
943
+ A,
944
944
  e
945
- ]), x = V(() => !p || h.length < 2 ? null : Oo(h, p), [
945
+ ]), x = V(() => !p || h.length < 2 ? null : To(h, p), [
946
946
  h,
947
947
  p
948
948
  ]);
949
- q(() => () => {
949
+ U(() => () => {
950
950
  x && (x.geometry.dispose(), x.material.dispose());
951
951
  }, [
952
952
  x
953
953
  ]);
954
- const m = le(null), k = V(() => {
955
- const S = new H.BufferGeometry();
956
- S.setAttribute("position", new H.Float32BufferAttribute(new Float32Array(6), 3));
957
- const F = new H.LineBasicMaterial({
954
+ const m = le(null), L = V(() => {
955
+ const S = new O.BufferGeometry();
956
+ S.setAttribute("position", new O.Float32BufferAttribute(new Float32Array(6), 3));
957
+ const P = new O.LineBasicMaterial({
958
958
  color: 6710886,
959
959
  depthTest: false,
960
960
  depthWrite: false,
961
961
  transparent: true
962
962
  });
963
- return new H.Line(S, F);
963
+ return new O.Line(S, P);
964
964
  }, []);
965
- return q(() => () => {
966
- k.geometry.dispose(), k.material.dispose();
965
+ return U(() => () => {
966
+ L.geometry.dispose(), L.material.dispose();
967
967
  }, [
968
- k
969
- ]), q(() => {
970
- z > 0 && (l == null ? void 0 : l({
968
+ L
969
+ ]), U(() => {
970
+ A > 0 && (l == null ? void 0 : l({
971
971
  yPosition: n,
972
- originalValue: z,
972
+ originalValue: A,
973
973
  modifiedValue: null
974
974
  }));
975
975
  }, [
976
- z,
976
+ A,
977
977
  n,
978
978
  l
979
979
  ]), yn(({ camera: S }) => {
980
980
  if (!m.current || h.length < 2) return;
981
- const F = new M();
982
- S.getWorldDirection(F);
983
- const v = new M(F.x, 0, F.z);
984
- if (v.lengthSq() < 1e-8) return;
985
- v.normalize();
986
- const w = new M().crossVectors(v, new M(0, 1, 0)).normalize();
987
- let A = -1 / 0, b = h[0];
988
- for (const R of h) {
989
- const P = w.x * R.x + w.z * R.z;
990
- P > A && (A = P, b = R);
981
+ const P = new F();
982
+ S.getWorldDirection(P);
983
+ const z = new F(P.x, 0, P.z);
984
+ if (z.lengthSq() < 1e-8) return;
985
+ z.normalize();
986
+ const w = new F().crossVectors(z, new F(0, 1, 0)).normalize();
987
+ let C = -1 / 0, b = h[0];
988
+ for (const k of h) {
989
+ const R = w.x * k.x + w.z * k.z;
990
+ R > C && (C = R, b = k);
991
991
  }
992
- const _ = s * 0.35, L = new M(b.x + w.x * _, n, b.z + w.z * _);
993
- m.current.position.copy(L);
994
- const I = k.geometry.getAttribute("position");
995
- I.setXYZ(0, b.x, b.y, b.z), I.setXYZ(1, L.x, L.y, L.z), I.needsUpdate = true;
996
- }), h.length < 2 ? null : C("group", {
992
+ const I = s * 0.35, _ = new F(b.x + w.x * I, n, b.z + w.z * I);
993
+ m.current.position.copy(_);
994
+ const v = L.geometry.getAttribute("position");
995
+ v.setXYZ(0, b.x, b.y, b.z), v.setXYZ(1, _.x, _.y, _.z), v.needsUpdate = true;
996
+ }), h.length < 2 ? null : M("group", {
997
997
  renderOrder: 10,
998
998
  children: [
999
- i(fe, {
999
+ i(de, {
1000
1000
  points: h,
1001
1001
  color: o,
1002
1002
  lineWidth: g,
@@ -1009,9 +1009,9 @@ let __tla = (async () => {
1009
1009
  object: x,
1010
1010
  renderOrder: 10
1011
1011
  }),
1012
- p && e != null && e !== 0 && i(fe, {
1012
+ p && e != null && e !== 0 && i(de, {
1013
1013
  points: p,
1014
- color: mn(z, e),
1014
+ color: gn(A, e),
1015
1015
  lineWidth: 2.5,
1016
1016
  dashed: true,
1017
1017
  dashSize: 2,
@@ -1023,7 +1023,7 @@ let __tla = (async () => {
1023
1023
  renderOrder: 10
1024
1024
  }),
1025
1025
  i("primitive", {
1026
- object: k,
1026
+ object: L,
1027
1027
  renderOrder: 10
1028
1028
  }),
1029
1029
  i("group", {
@@ -1037,7 +1037,7 @@ let __tla = (async () => {
1037
1037
  pointerEvents: "none",
1038
1038
  transform: "translateY(-50%)"
1039
1039
  },
1040
- children: C("div", {
1040
+ children: M("div", {
1041
1041
  style: {
1042
1042
  display: "flex",
1043
1043
  alignItems: "stretch",
@@ -1047,7 +1047,7 @@ let __tla = (async () => {
1047
1047
  whiteSpace: "nowrap"
1048
1048
  },
1049
1049
  children: [
1050
- C("div", {
1050
+ M("div", {
1051
1051
  style: {
1052
1052
  display: "flex",
1053
1053
  alignItems: "center",
@@ -1065,7 +1065,7 @@ let __tla = (async () => {
1065
1065
  minWidth: 52,
1066
1066
  textAlign: "right"
1067
1067
  },
1068
- children: c === "inch" ? (z / 25.4).toFixed(2) : z.toFixed(1)
1068
+ children: c === "inch" ? (A / 25.4).toFixed(2) : A.toFixed(1)
1069
1069
  }),
1070
1070
  i("span", {
1071
1071
  style: {
@@ -1077,9 +1077,9 @@ let __tla = (async () => {
1077
1077
  })
1078
1078
  ]
1079
1079
  }),
1080
- e != null && e !== 0 && z > 0 && (() => {
1081
- const S = z - e, F = S > 0.5 ? "\u25B2" : S < -0.5 ? "\u25BC" : "", v = mn(z, e);
1082
- return C("div", {
1080
+ e != null && e !== 0 && A > 0 && (() => {
1081
+ const S = A - e, P = S > 0.5 ? "\u25B2" : S < -0.5 ? "\u25BC" : "", z = gn(A, e);
1082
+ return M("div", {
1083
1083
  style: {
1084
1084
  display: "flex",
1085
1085
  alignItems: "center",
@@ -1090,18 +1090,18 @@ let __tla = (async () => {
1090
1090
  borderLeft: "1px solid rgba(255,255,255,0.12)"
1091
1091
  },
1092
1092
  children: [
1093
- F && i("span", {
1093
+ P && i("span", {
1094
1094
  style: {
1095
1095
  fontSize: 10,
1096
- color: v,
1096
+ color: z,
1097
1097
  lineHeight: 1
1098
1098
  },
1099
- children: F
1099
+ children: P
1100
1100
  }),
1101
- C("span", {
1101
+ M("span", {
1102
1102
  style: {
1103
1103
  fontSize: 13,
1104
- color: v,
1104
+ color: z,
1105
1105
  fontFamily: "monospace",
1106
1106
  fontWeight: 600
1107
1107
  },
@@ -1110,7 +1110,7 @@ let __tla = (async () => {
1110
1110
  c === "inch" ? (S / 25.4).toFixed(2) : S.toFixed(1)
1111
1111
  ]
1112
1112
  }),
1113
- C("span", {
1113
+ M("span", {
1114
1114
  style: {
1115
1115
  fontSize: 11,
1116
1116
  color: "rgba(255,255,255,0.4)",
@@ -1130,25 +1130,25 @@ let __tla = (async () => {
1130
1130
  })
1131
1131
  ]
1132
1132
  });
1133
- }, No = uo(Ho), jo = ({ mesh: t, startY: r, endY: n, spacing: o, modelSize: s, onMeasurementsChange: l, reverseOrder: c = false, displayUnit: a = "mm", useInnerSurface: e = false, formMeasurements: g, originY: d, wasmSlices: f }) => {
1134
- const u = le(/* @__PURE__ */ new Map()), h = t.geometry, z = Pn(h), p = V(() => {
1133
+ }, Ho = fo(Oo), No = ({ mesh: t, startY: r, endY: n, spacing: o, modelSize: s, onMeasurementsChange: l, reverseOrder: c = false, displayUnit: a = "mm", useInnerSurface: e = false, formMeasurements: g, originY: d, wasmSlices: f }) => {
1134
+ const u = le(/* @__PURE__ */ new Map()), h = t.geometry, A = Pn(h), p = V(() => {
1135
1135
  if (f) {
1136
- let A = [
1136
+ let C = [
1137
1137
  ...f.yValues
1138
1138
  ];
1139
1139
  if (o > 25.4 + 0.1) {
1140
1140
  const b = f.mptY;
1141
- A = A.filter((_) => {
1142
- const L = Math.abs(_ - b);
1143
- return L < 0.5 || Math.abs(Math.round(L / o) * o - L) < 0.5;
1141
+ C = C.filter((I) => {
1142
+ const _ = Math.abs(I - b);
1143
+ return _ < 0.5 || Math.abs(Math.round(_ / o) * o - _) < 0.5;
1144
1144
  });
1145
1145
  }
1146
- return c ? A.sort((b, _) => _ - b) : A.sort((b, _) => b - _), A;
1146
+ return c ? C.sort((b, I) => I - b) : C.sort((b, I) => b - I), C;
1147
1147
  }
1148
- const v = [];
1149
- if (c) for (let w = n; w >= r; w -= o) v.push(w);
1150
- else for (let w = r; w <= n; w += o) v.push(w);
1151
- return v;
1148
+ const z = [];
1149
+ if (c) for (let w = n; w >= r; w -= o) z.push(w);
1150
+ else for (let w = r; w <= n; w += o) z.push(w);
1151
+ return z;
1152
1152
  }, [
1153
1153
  r,
1154
1154
  n,
@@ -1157,95 +1157,95 @@ let __tla = (async () => {
1157
1157
  f
1158
1158
  ]), x = V(() => {
1159
1159
  if (!f) return null;
1160
- const v = /* @__PURE__ */ new Map(), { allLoopPoints: w, offsets: A, yValues: b } = f;
1161
- for (let _ = 0; _ < A.length - 1; _++) {
1162
- const L = A[_], I = A[_ + 1];
1163
- if (I <= L) continue;
1164
- const R = [];
1165
- for (let P = L; P < I; P += 3) R.push(new M(w[P], w[P + 1], w[P + 2]));
1166
- R.length >= 3 && v.set(b[_], R);
1160
+ const z = /* @__PURE__ */ new Map(), { allLoopPoints: w, offsets: C, yValues: b } = f;
1161
+ for (let I = 0; I < C.length - 1; I++) {
1162
+ const _ = C[I], v = C[I + 1];
1163
+ if (v <= _) continue;
1164
+ const k = [];
1165
+ for (let R = _; R < v; R += 3) k.push(new F(w[R], w[R + 1], w[R + 2]));
1166
+ k.length >= 3 && z.set(b[I], k);
1167
1167
  }
1168
- return v;
1168
+ return z;
1169
1169
  }, [
1170
1170
  f
1171
1171
  ]), m = V(() => {
1172
1172
  if (!f) return null;
1173
- const v = /* @__PURE__ */ new Map();
1174
- for (let w = 0; w < f.yValues.length; w++) v.set(f.yValues[w], f.circumferences[w]);
1175
- return v;
1173
+ const z = /* @__PURE__ */ new Map();
1174
+ for (let w = 0; w < f.yValues.length; w++) z.set(f.yValues[w], f.circumferences[w]);
1175
+ return z;
1176
1176
  }, [
1177
1177
  f
1178
1178
  ]);
1179
- q(() => {
1179
+ U(() => {
1180
1180
  u.current.clear();
1181
1181
  }, [
1182
1182
  p
1183
- ]), q(() => {
1183
+ ]), U(() => {
1184
1184
  if (!m || !l) return;
1185
- const v = p.filter((w) => (m.get(w) ?? 0) > 0).map((w) => ({
1185
+ const z = p.filter((w) => (m.get(w) ?? 0) > 0).map((w) => ({
1186
1186
  yPosition: w,
1187
1187
  originalValue: m.get(w) ?? 0,
1188
1188
  modifiedValue: null
1189
1189
  }));
1190
- l(v);
1190
+ l(z);
1191
1191
  }, [
1192
1192
  m,
1193
1193
  p,
1194
1194
  l
1195
1195
  ]);
1196
- const k = [
1196
+ const L = [
1197
1197
  "#5B9BD5"
1198
- ], S = s * So, F = Q((v) => {
1198
+ ], S = s * wo, P = J((z) => {
1199
1199
  if (m) return;
1200
- u.current.set(v.yPosition, v);
1201
- const w = Array.from(u.current.values()).sort((A, b) => c ? b.yPosition - A.yPosition : A.yPosition - b.yPosition);
1200
+ u.current.set(z.yPosition, z);
1201
+ const w = Array.from(u.current.values()).sort((C, b) => c ? b.yPosition - C.yPosition : C.yPosition - b.yPosition);
1202
1202
  l == null ? void 0 : l(w);
1203
1203
  }, [
1204
1204
  l,
1205
1205
  c,
1206
1206
  m
1207
1207
  ]);
1208
- return z ? i(We, {
1209
- children: p.map((v, w) => i(No, {
1210
- bvh: z,
1208
+ return A ? i(We, {
1209
+ children: p.map((z, w) => i(Ho, {
1210
+ bvh: A,
1211
1211
  geometry: h,
1212
- yPosition: v,
1213
- color: d != null && Math.abs(v - d) < o * 0.5 ? "#44ff44" : k[w % k.length],
1212
+ yPosition: z,
1213
+ color: d != null && Math.abs(z - d) < o * 0.5 ? "#44ff44" : L[w % L.length],
1214
1214
  labelX: S,
1215
- onDataChange: F,
1215
+ onDataChange: P,
1216
1216
  displayUnit: a,
1217
1217
  useInnerSurface: e,
1218
1218
  formValue: g == null ? void 0 : g[w],
1219
- lineWidth: d != null && Math.abs(v - d) < o * 0.5 ? 4 : 1.5,
1220
- wasmLoopPoints: x == null ? void 0 : x.get(v),
1221
- wasmCircumference: m == null ? void 0 : m.get(v)
1222
- }, v))
1219
+ lineWidth: d != null && Math.abs(z - d) < o * 0.5 ? 4 : 1.5,
1220
+ wasmLoopPoints: x == null ? void 0 : x.get(z),
1221
+ wasmCircumference: m == null ? void 0 : m.get(z)
1222
+ }, z))
1223
1223
  }) : null;
1224
- }, Vo = (t, r) => {
1224
+ }, jo = (t, r) => {
1225
1225
  const n = Math.abs(t - r);
1226
1226
  return n <= 7 ? "#4caf50" : n <= 15 ? "#ff9800" : "#f44336";
1227
- }, Xo = ({ mesh: t, greenY: r, modelSize: n, displayUnit: o = "mm", bottomY: s, formHeight: l }) => {
1227
+ }, Vo = ({ mesh: t, greenY: r, modelSize: n, displayUnit: o = "mm", bottomY: s, formHeight: l }) => {
1228
1228
  var _a;
1229
1229
  const c = t.geometry;
1230
1230
  c.computeBoundingBox();
1231
1231
  const a = s ?? ((_a = c.boundingBox) == null ? void 0 : _a.min.y) ?? 0, e = r - a, g = n * 0.4, d = n * 0.03, f = le(null);
1232
1232
  yn(({ camera: w }) => {
1233
1233
  if (!f.current) return;
1234
- const A = new M();
1235
- w.getWorldDirection(A);
1236
- const b = new M(A.x, 0, A.z);
1234
+ const C = new F();
1235
+ w.getWorldDirection(C);
1236
+ const b = new F(C.x, 0, C.z);
1237
1237
  if (b.lengthSq() < 1e-8) return;
1238
1238
  b.normalize();
1239
- const _ = new M().crossVectors(new M(0, 1, 0), b).normalize();
1240
- f.current.position.set(_.x * g, 0, _.z * g);
1241
- const L = w.position.x - f.current.position.x, I = w.position.z - f.current.position.z;
1242
- f.current.rotation.y = Math.atan2(L, I);
1239
+ const I = new F().crossVectors(new F(0, 1, 0), b).normalize();
1240
+ f.current.position.set(I.x * g, 0, I.z * g);
1241
+ const _ = w.position.x - f.current.position.x, v = w.position.z - f.current.position.z;
1242
+ f.current.rotation.y = Math.atan2(_, v);
1243
1243
  });
1244
- const u = new M(0, r, 0), h = new M(0, a, 0), z = new M(0, (r + a) / 2, 0), p = new M(-d, r, 0), x = new M(d, r, 0), m = new M(-d, a, 0), k = new M(d, a, 0), S = l != null && l > 0, F = S ? e - l : 0, v = S ? Vo(e, l) : "#fff";
1245
- return C("group", {
1244
+ const u = new F(0, r, 0), h = new F(0, a, 0), A = new F(0, (r + a) / 2, 0), p = new F(-d, r, 0), x = new F(d, r, 0), m = new F(-d, a, 0), L = new F(d, a, 0), S = l != null && l > 0, P = S ? e - l : 0, z = S ? jo(e, l) : "#fff";
1245
+ return M("group", {
1246
1246
  ref: f,
1247
1247
  children: [
1248
- i(fe, {
1248
+ i(de, {
1249
1249
  points: [
1250
1250
  u,
1251
1251
  h
@@ -1253,7 +1253,7 @@ let __tla = (async () => {
1253
1253
  color: "#888888",
1254
1254
  lineWidth: 1.5
1255
1255
  }),
1256
- i(fe, {
1256
+ i(de, {
1257
1257
  points: [
1258
1258
  p,
1259
1259
  x
@@ -1261,16 +1261,16 @@ let __tla = (async () => {
1261
1261
  color: "#888888",
1262
1262
  lineWidth: 1.5
1263
1263
  }),
1264
- i(fe, {
1264
+ i(de, {
1265
1265
  points: [
1266
1266
  m,
1267
- k
1267
+ L
1268
1268
  ],
1269
1269
  color: "#888888",
1270
1270
  lineWidth: 1.5
1271
1271
  }),
1272
1272
  i("mesh", {
1273
- position: z,
1273
+ position: A,
1274
1274
  children: i(je, {
1275
1275
  center: true,
1276
1276
  style: {
@@ -1280,7 +1280,7 @@ let __tla = (async () => {
1280
1280
  0,
1281
1281
  0
1282
1282
  ],
1283
- children: C("div", {
1283
+ children: M("div", {
1284
1284
  style: {
1285
1285
  display: "flex",
1286
1286
  flexDirection: "column",
@@ -1291,7 +1291,7 @@ let __tla = (async () => {
1291
1291
  pointerEvents: "none"
1292
1292
  },
1293
1293
  children: [
1294
- C("div", {
1294
+ M("div", {
1295
1295
  style: {
1296
1296
  padding: "4px 8px",
1297
1297
  backgroundColor: "rgba(0, 0, 0, 0.75)",
@@ -1308,7 +1308,7 @@ let __tla = (async () => {
1308
1308
  o === "inch" ? "in" : "mm"
1309
1309
  ]
1310
1310
  }),
1311
- S && C("div", {
1311
+ S && M("div", {
1312
1312
  style: {
1313
1313
  display: "flex",
1314
1314
  alignItems: "center",
@@ -1321,27 +1321,27 @@ let __tla = (async () => {
1321
1321
  pointerEvents: "none"
1322
1322
  },
1323
1323
  children: [
1324
- Math.abs(F) > 0.5 && i("span", {
1324
+ Math.abs(P) > 0.5 && i("span", {
1325
1325
  style: {
1326
1326
  fontSize: 10,
1327
- color: v,
1327
+ color: z,
1328
1328
  lineHeight: 1
1329
1329
  },
1330
- children: F > 0.5 ? "\u25B2" : "\u25BC"
1330
+ children: P > 0.5 ? "\u25B2" : "\u25BC"
1331
1331
  }),
1332
- C("span", {
1332
+ M("span", {
1333
1333
  style: {
1334
1334
  fontSize: 13,
1335
- color: v,
1335
+ color: z,
1336
1336
  fontFamily: "monospace",
1337
1337
  fontWeight: 600
1338
1338
  },
1339
1339
  children: [
1340
- F > 0 ? "+" : "",
1341
- o === "inch" ? (F / 25.4).toFixed(2) : F.toFixed(1)
1340
+ P > 0 ? "+" : "",
1341
+ o === "inch" ? (P / 25.4).toFixed(2) : P.toFixed(1)
1342
1342
  ]
1343
1343
  }),
1344
- C("span", {
1344
+ M("span", {
1345
1345
  style: {
1346
1346
  fontSize: 11,
1347
1347
  color: "rgba(255,255,255,0.4)",
@@ -1360,26 +1360,26 @@ let __tla = (async () => {
1360
1360
  })
1361
1361
  ]
1362
1362
  });
1363
- }, Go = ({ modelSize: t, isAligned: r, isCut: n, mesh: o, viewMode: s, sliceY: l, landmarkCount: c = 0, measurementGeometry: a, resetCameraToFrontRef: e }) => {
1364
- const { set: g, size: d, camera: f, invalidate: u } = wn(), h = le(false), z = le(s), p = le(new M()), x = le(null), m = le(c), k = le(r), S = le(n), F = le(a), v = le(0), w = Q(() => {
1363
+ }, Xo = ({ modelSize: t, isAligned: r, isCut: n, mesh: o, viewMode: s, sliceY: l, landmarkCount: c = 0, measurementGeometry: a, resetCameraToFrontRef: e }) => {
1364
+ const { set: g, size: d, camera: f, invalidate: u } = wn(), h = le(false), A = le(s), p = le(new F()), x = le(null), m = le(c), L = le(r), S = le(n), P = le(a), z = le(0), w = J(() => {
1365
1365
  if (!o || t <= 0) return null;
1366
1366
  const b = a ?? o.geometry;
1367
1367
  b.computeBoundingBox();
1368
- const _ = b.boundingBox, L = new M();
1369
- _.getCenter(L);
1370
- const I = new M();
1371
- _.getSize(I), p.current.copy(I);
1372
- const R = d.width / d.height, P = Math.max(I.y, I.x / R) * 1.6, E = P * R, T = L.y - I.y * 0.05;
1373
- v.current = T;
1374
- const Y = new H.OrthographicCamera(-E / 2, E / 2, P / 2, -P / 2, 0.1, t * 10);
1375
- return Y.position.set(0, T, t * 2), Y.lookAt(0, T, 0), Y;
1368
+ const I = b.boundingBox, _ = new F();
1369
+ I.getCenter(_);
1370
+ const v = new F();
1371
+ I.getSize(v), p.current.copy(v);
1372
+ const k = d.width / d.height, R = Math.max(v.y, v.x / k) * 1.6, T = R * k, N = _.y - v.y * 0.05;
1373
+ z.current = N;
1374
+ const Q = new O.OrthographicCamera(-T / 2, T / 2, R / 2, -R / 2, 0.1, t * 10);
1375
+ return Q.position.set(0, N, t * 2), Q.lookAt(0, N, 0), Q;
1376
1376
  }, [
1377
1377
  o,
1378
1378
  t,
1379
1379
  d,
1380
1380
  a
1381
1381
  ]);
1382
- q(() => {
1382
+ U(() => {
1383
1383
  if (e) return e.current = () => {
1384
1384
  const b = w();
1385
1385
  b && (g({
@@ -1394,40 +1394,40 @@ let __tla = (async () => {
1394
1394
  g,
1395
1395
  u
1396
1396
  ]);
1397
- const A = Q((b) => {
1398
- const _ = b.position.clone(), L = _.length(), I = Math.atan2(_.x, _.z), R = Math.acos(_.y / L), E = I + 0.02;
1399
- b.position.set(L * Math.sin(R) * Math.sin(E), L * Math.cos(R), L * Math.sin(R) * Math.cos(E)), b.lookAt(0, 0, 0), b.updateMatrixWorld(true), u();
1397
+ const C = J((b) => {
1398
+ const I = b.position.clone(), _ = I.length(), v = Math.atan2(I.x, I.z), k = Math.acos(I.y / _), T = v + 0.02;
1399
+ b.position.set(_ * Math.sin(k) * Math.sin(T), _ * Math.cos(k), _ * Math.sin(k) * Math.cos(T)), b.lookAt(0, 0, 0), b.updateMatrixWorld(true), u();
1400
1400
  }, [
1401
1401
  u
1402
1402
  ]);
1403
- return q(() => {
1403
+ return U(() => {
1404
1404
  if (t > 0 && !h.current && !r) {
1405
1405
  h.current = true;
1406
- const b = new H.PerspectiveCamera(50, d.width / d.height, 0.1, t * 10);
1406
+ const b = new O.PerspectiveCamera(50, d.width / d.height, 0.1, t * 10);
1407
1407
  b.position.set(t * 0.3, t * 0.2, t * 1.5), b.lookAt(0, 0, 0), g({
1408
1408
  camera: b
1409
- }), requestAnimationFrame(() => A(b));
1409
+ }), requestAnimationFrame(() => C(b));
1410
1410
  }
1411
1411
  }, [
1412
1412
  t,
1413
1413
  d,
1414
1414
  g,
1415
1415
  r,
1416
- A
1417
- ]), q(() => {
1416
+ C
1417
+ ]), U(() => {
1418
1418
  const b = m.current;
1419
- m.current = c, b === 0 && c === 1 && !r && requestAnimationFrame(() => A(f));
1419
+ m.current = c, b === 0 && c === 1 && !r && requestAnimationFrame(() => C(f));
1420
1420
  }, [
1421
1421
  c,
1422
1422
  r,
1423
1423
  f,
1424
- A
1425
- ]), q(() => {
1426
- const b = k.current !== r, _ = S.current !== n, L = !F.current && !!a;
1427
- if (k.current = r, S.current = n, F.current = a, !b && !_ && !L || !r || s !== "3D") return;
1428
- const I = w();
1429
- I && g({
1430
- camera: I
1424
+ C
1425
+ ]), U(() => {
1426
+ const b = L.current !== r, I = S.current !== n, _ = !P.current && !!a;
1427
+ if (L.current = r, S.current = n, P.current = a, !b && !I && !_ || !r || s !== "3D") return;
1428
+ const v = w();
1429
+ v && g({
1430
+ camera: v
1431
1431
  });
1432
1432
  }, [
1433
1433
  r,
@@ -1436,37 +1436,37 @@ let __tla = (async () => {
1436
1436
  a,
1437
1437
  w,
1438
1438
  g
1439
- ]), q(() => {
1440
- if (z.current === s) return;
1441
- const b = z.current;
1442
- if (z.current = s, !(!r || !o || t <= 0)) {
1439
+ ]), U(() => {
1440
+ if (A.current === s) return;
1441
+ const b = A.current;
1442
+ if (A.current = s, !(!r || !o || t <= 0)) {
1443
1443
  if (s === "2D" && l != null) {
1444
1444
  x.current = f;
1445
- const _ = o.geometry, L = _.getAttribute("position"), I = L.array, R = t * 0.15;
1446
- let P = 1 / 0, E = -1 / 0, T = 1 / 0, Y = -1 / 0, ae = false;
1447
- for (let ge = 0; ge < L.count; ge++) if (Math.abs(I[ge * 3 + 1] - l) < R) {
1448
- const j = I[ge * 3], ne = I[ge * 3 + 2];
1449
- j < P && (P = j), j > E && (E = j), ne < T && (T = ne), ne > Y && (Y = ne), ae = true;
1445
+ const I = o.geometry, _ = I.getAttribute("position"), v = _.array, k = t * 0.15;
1446
+ let R = 1 / 0, T = -1 / 0, N = 1 / 0, Q = -1 / 0, be = false;
1447
+ for (let he = 0; he < _.count; he++) if (Math.abs(v[he * 3 + 1] - l) < k) {
1448
+ const j = v[he * 3], ne = v[he * 3 + 2];
1449
+ j < R && (R = j), j > T && (T = j), ne < N && (N = ne), ne > Q && (Q = ne), be = true;
1450
1450
  }
1451
- if (!ae) {
1452
- _.computeBoundingBox();
1453
- const ge = _.boundingBox;
1454
- P = ge.min.x, E = ge.max.x, T = ge.min.z, Y = ge.max.z;
1451
+ if (!be) {
1452
+ I.computeBoundingBox();
1453
+ const he = I.boundingBox;
1454
+ R = he.min.x, T = he.max.x, N = he.min.z, Q = he.max.z;
1455
1455
  }
1456
- const ce = (P + E) / 2, ue = (T + Y) / 2, re = d.width / d.height, ee = 1.4, Z = (E - P) * ee, pe = (Y - T) * ee;
1457
- let K, he;
1458
- Z / pe > re ? (K = Z, he = Z / re) : (he = pe, K = pe * re);
1459
- const xe = new H.OrthographicCamera(-K / 2, K / 2, he / 2, -he / 2, 0.1, t * 10);
1460
- xe.position.set(ce, l + t * 2, ue), xe.up.set(0, 0, -1), xe.lookAt(ce, l, ue), g({
1461
- camera: xe
1456
+ const ae = (R + T) / 2, fe = (N + Q) / 2, re = d.width / d.height, ee = 1.4, Y = (T - R) * ee, ue = (Q - N) * ee;
1457
+ let Z, pe;
1458
+ Y / ue > re ? (Z = Y, pe = Y / re) : (pe = ue, Z = ue * re);
1459
+ const me = new O.OrthographicCamera(-Z / 2, Z / 2, pe / 2, -pe / 2, 0.1, t * 10);
1460
+ me.position.set(ae, l + t * 2, fe), me.up.set(0, 0, -1), me.lookAt(ae, l, fe), g({
1461
+ camera: me
1462
1462
  });
1463
1463
  } else if (b === "2D") if (x.current) g({
1464
1464
  camera: x.current
1465
1465
  }), x.current = null;
1466
1466
  else {
1467
- const _ = w();
1468
- _ && g({
1469
- camera: _
1467
+ const I = w();
1468
+ I && g({
1469
+ camera: I
1470
1470
  });
1471
1471
  }
1472
1472
  }
@@ -1480,28 +1480,28 @@ let __tla = (async () => {
1480
1480
  g,
1481
1481
  f,
1482
1482
  w
1483
- ]), q(() => {
1483
+ ]), U(() => {
1484
1484
  if (!r || !f || !f.isOrthographicCamera) return;
1485
1485
  const b = f;
1486
1486
  if (s === "2D") {
1487
1487
  if (!o || l == null) return;
1488
- const _ = o.geometry, L = _.getAttribute("position"), I = L.array, R = t * 0.15;
1489
- let P = 1 / 0, E = -1 / 0, T = 1 / 0, Y = -1 / 0, ae = false;
1490
- for (let K = 0; K < L.count; K++) if (Math.abs(I[K * 3 + 1] - l) < R) {
1491
- const he = I[K * 3], xe = I[K * 3 + 2];
1492
- he < P && (P = he), he > E && (E = he), xe < T && (T = xe), xe > Y && (Y = xe), ae = true;
1488
+ const I = o.geometry, _ = I.getAttribute("position"), v = _.array, k = t * 0.15;
1489
+ let R = 1 / 0, T = -1 / 0, N = 1 / 0, Q = -1 / 0, be = false;
1490
+ for (let Z = 0; Z < _.count; Z++) if (Math.abs(v[Z * 3 + 1] - l) < k) {
1491
+ const pe = v[Z * 3], me = v[Z * 3 + 2];
1492
+ pe < R && (R = pe), pe > T && (T = pe), me < N && (N = me), me > Q && (Q = me), be = true;
1493
1493
  }
1494
- if (!ae) {
1495
- _.computeBoundingBox();
1496
- const K = _.boundingBox;
1497
- P = K.min.x, E = K.max.x, T = K.min.z, Y = K.max.z;
1494
+ if (!be) {
1495
+ I.computeBoundingBox();
1496
+ const Z = I.boundingBox;
1497
+ R = Z.min.x, T = Z.max.x, N = Z.min.z, Q = Z.max.z;
1498
1498
  }
1499
- const ce = d.width / d.height, ue = 1.4, re = (E - P) * ue, ee = (Y - T) * ue;
1500
- let Z, pe;
1501
- re / ee > ce ? (Z = re, pe = re / ce) : (pe = ee, Z = ee * ce), b.left = -Z / 2, b.right = Z / 2, b.top = pe / 2, b.bottom = -pe / 2;
1499
+ const ae = d.width / d.height, fe = 1.4, re = (T - R) * fe, ee = (Q - N) * fe;
1500
+ let Y, ue;
1501
+ re / ee > ae ? (Y = re, ue = re / ae) : (ue = ee, Y = ee * ae), b.left = -Y / 2, b.right = Y / 2, b.top = ue / 2, b.bottom = -ue / 2;
1502
1502
  } else {
1503
- const _ = p.current, L = d.width / d.height, I = Math.max(_.y, _.x / L) * 1.6, R = I * L;
1504
- b.left = -R / 2, b.right = R / 2, b.top = I / 2, b.bottom = -I / 2;
1503
+ const I = p.current, _ = d.width / d.height, v = Math.max(I.y, I.x / _) * 1.6, k = v * _;
1504
+ b.left = -k / 2, b.right = k / 2, b.top = v / 2, b.bottom = -v / 2;
1505
1505
  }
1506
1506
  b.updateProjectionMatrix();
1507
1507
  }, [
@@ -1512,11 +1512,11 @@ let __tla = (async () => {
1512
1512
  s,
1513
1513
  o
1514
1514
  ]), null;
1515
- }, Yo = ({ mesh: t, isDragging: r }) => {
1515
+ }, Go = ({ mesh: t, isDragging: r }) => {
1516
1516
  var _a;
1517
1517
  const n = t.geometry;
1518
1518
  n.computeBoundingBox();
1519
- const o = new M();
1519
+ const o = new F();
1520
1520
  return (_a = n.boundingBox) == null ? void 0 : _a.getCenter(o), i(Sn, {
1521
1521
  enableDamping: false,
1522
1522
  enablePan: false,
@@ -1531,7 +1531,7 @@ let __tla = (async () => {
1531
1531
  o.z
1532
1532
  ]
1533
1533
  });
1534
- }, Zo = ({ wasAutoScaled: t, onDismiss: r }) => C("div", {
1534
+ }, Yo = ({ wasAutoScaled: t, onDismiss: r }) => M("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
- }), Ko = ({ isDoubleShell: t, onDismiss: r }) => C("div", {
1575
+ }), Zo = ({ isDoubleShell: t, onDismiss: r }) => M("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
- }), Uo = ({ 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",
@@ -1624,12 +1624,12 @@ let __tla = (async () => {
1624
1624
  },
1625
1625
  children: t.map((o, s) => {
1626
1626
  const l = o.number < r, c = o.number === r;
1627
- return C("div", {
1627
+ return M("div", {
1628
1628
  style: {
1629
1629
  display: "contents"
1630
1630
  },
1631
1631
  children: [
1632
- C("div", {
1632
+ M("div", {
1633
1633
  style: {
1634
1634
  display: "flex",
1635
1635
  alignItems: "center",
@@ -1677,7 +1677,7 @@ let __tla = (async () => {
1677
1677
  ]
1678
1678
  }, o.number);
1679
1679
  })
1680
- }), qo = ({ mesh: t, upperY: r, originY: n, modelSize: o, meshColor: s = "#c8c8c8", displayUnit: l = "mm" }) => {
1680
+ }), Uo = ({ mesh: t, upperY: r, originY: n, modelSize: o, meshColor: s = "#c8c8c8", displayUnit: l = "mm" }) => {
1681
1681
  const c = t.geometry, a = V(() => new yt(c, {
1682
1682
  maxLeafTris: wt
1683
1683
  }), [
@@ -1686,38 +1686,38 @@ let __tla = (async () => {
1686
1686
  a,
1687
1687
  c,
1688
1688
  n
1689
- ]), g = V(() => new bt(new M(0, -1, 0), r), [
1689
+ ]), g = V(() => new bt(new F(0, -1, 0), r), [
1690
1690
  r
1691
1691
  ]), { mlLine: d, apLine: f, mlWidth: u, apWidth: h } = V(() => {
1692
- let x = null, m = null, k = 0, S = 0;
1692
+ let x = null, m = null, L = 0, S = 0;
1693
1693
  if (e.linePoints.length >= 2) {
1694
- let F = e.linePoints[0], v = e.linePoints[0], w = e.linePoints[0], A = e.linePoints[0];
1695
- for (const b of e.linePoints) b.x < F.x && (F = b), b.x > v.x && (v = b), b.z < w.z && (w = b), b.z > A.z && (A = b);
1694
+ let P = e.linePoints[0], z = e.linePoints[0], w = e.linePoints[0], C = e.linePoints[0];
1695
+ for (const b of e.linePoints) b.x < P.x && (P = b), b.x > z.x && (z = b), b.z < w.z && (w = b), b.z > C.z && (C = b);
1696
1696
  x = [
1697
- new M(F.x, n, F.z),
1698
- new M(v.x, n, v.z)
1697
+ new F(P.x, n, P.z),
1698
+ new F(z.x, n, z.z)
1699
1699
  ], m = [
1700
- new M(w.x, n, w.z),
1701
- new M(A.x, n, A.z)
1702
- ], k = x[0].distanceTo(x[1]), S = m[0].distanceTo(m[1]);
1700
+ new F(w.x, n, w.z),
1701
+ new F(C.x, n, C.z)
1702
+ ], L = x[0].distanceTo(x[1]), S = m[0].distanceTo(m[1]);
1703
1703
  }
1704
1704
  return {
1705
1705
  mlLine: x,
1706
1706
  apLine: m,
1707
- mlWidth: k,
1707
+ mlWidth: L,
1708
1708
  apWidth: S
1709
1709
  };
1710
1710
  }, [
1711
1711
  e,
1712
1712
  n
1713
- ]), z = (x) => l === "inch" ? (x / 25.4).toFixed(2) : x.toFixed(1), p = l === "inch" ? "in" : "mm";
1714
- return C(We, {
1713
+ ]), A = (x) => l === "inch" ? (x / 25.4).toFixed(2) : x.toFixed(1), p = l === "inch" ? "in" : "mm";
1714
+ return M(We, {
1715
1715
  children: [
1716
1716
  i("mesh", {
1717
1717
  geometry: t.geometry,
1718
1718
  children: i("meshStandardMaterial", {
1719
1719
  color: s,
1720
- side: H.DoubleSide,
1720
+ side: O.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(fe, {
1729
+ e.linePoints.length >= 2 && i(de, {
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 && C(We, {
1737
+ d && M(We, {
1738
1738
  children: [
1739
- i(fe, {
1739
+ i(de, {
1740
1740
  points: d,
1741
1741
  color: "#ff8800",
1742
1742
  lineWidth: 2,
@@ -1761,7 +1761,7 @@ let __tla = (async () => {
1761
1761
  backgroundColor: "rgba(0,0,0,0.75)",
1762
1762
  borderRadius: 3
1763
1763
  },
1764
- children: C("span", {
1764
+ children: M("span", {
1765
1765
  style: {
1766
1766
  fontSize: 12,
1767
1767
  color: "#ff8800",
@@ -1769,7 +1769,7 @@ let __tla = (async () => {
1769
1769
  },
1770
1770
  children: [
1771
1771
  "ML ",
1772
- z(u),
1772
+ A(u),
1773
1773
  " ",
1774
1774
  p
1775
1775
  ]
@@ -1778,9 +1778,9 @@ let __tla = (async () => {
1778
1778
  })
1779
1779
  ]
1780
1780
  }),
1781
- f && C(We, {
1781
+ f && M(We, {
1782
1782
  children: [
1783
- i(fe, {
1783
+ i(de, {
1784
1784
  points: f,
1785
1785
  color: "#ff00ff",
1786
1786
  lineWidth: 2,
@@ -1805,7 +1805,7 @@ let __tla = (async () => {
1805
1805
  backgroundColor: "rgba(0,0,0,0.75)",
1806
1806
  borderRadius: 3
1807
1807
  },
1808
- children: C("span", {
1808
+ children: M("span", {
1809
1809
  style: {
1810
1810
  fontSize: 12,
1811
1811
  color: "#ff00ff",
@@ -1813,7 +1813,7 @@ let __tla = (async () => {
1813
1813
  },
1814
1814
  children: [
1815
1815
  "AP ",
1816
- z(h),
1816
+ A(h),
1817
1817
  " ",
1818
1818
  p
1819
1819
  ]
@@ -1824,63 +1824,63 @@ let __tla = (async () => {
1824
1824
  })
1825
1825
  ]
1826
1826
  });
1827
- }, Jo = ({ mesh: t, yPosition: r, onYChange: n, minY: o, maxY: s, modelSize: l, color: c, hoverColor: a, dragColor: e, label: g, onDragStart: d, onDragEnd: f }) => {
1828
- const [u, h] = B(false), [z, p] = B(false), { camera: x, gl: m } = wn(), k = le(0), S = t.geometry, F = Pn(S), v = V(() => F ? Ne(F, S, r) : {
1827
+ }, qo = ({ mesh: t, yPosition: r, onYChange: n, minY: o, maxY: s, modelSize: l, color: c, hoverColor: a, dragColor: e, label: g, onDragStart: d, onDragEnd: f }) => {
1828
+ const [u, h] = B(false), [A, p] = B(false), { camera: x, gl: m } = wn(), L = le(0), S = t.geometry, P = Pn(S), z = V(() => P ? Ne(P, S, r) : {
1829
1829
  linePoints: [],
1830
1830
  lineLength: 0,
1831
- rightmostPoint: new M()
1831
+ rightmostPoint: new F()
1832
1832
  }, [
1833
- F,
1833
+ P,
1834
1834
  S,
1835
1835
  r
1836
- ]), w = Q((I, R) => {
1837
- const P = m.domElement.getBoundingClientRect(), E = (I - P.left) / P.width * 2 - 1, T = -((R - P.top) / P.height) * 2 + 1, Y = new go();
1838
- Y.setFromCamera(new H.Vector2(E, T), x);
1839
- const ae = new bt(new M(0, 0, 1), 0), ce = new M();
1840
- return Y.ray.intersectPlane(ae, ce), ce ? ce.y : r;
1836
+ ]), w = J((v, k) => {
1837
+ const R = m.domElement.getBoundingClientRect(), T = (v - R.left) / R.width * 2 - 1, N = -((k - R.top) / R.height) * 2 + 1, Q = new ho();
1838
+ Q.setFromCamera(new O.Vector2(T, N), x);
1839
+ const be = new bt(new F(0, 0, 1), 0), ae = new F();
1840
+ return Q.ray.intersectPlane(be, ae), ae ? ae.y : r;
1841
1841
  }, [
1842
1842
  x,
1843
1843
  m,
1844
1844
  r
1845
- ]), A = Q((I) => {
1846
- I.stopPropagation(), h(true), m.domElement.style.cursor = "ns-resize", k.current = r - w(I.clientX, I.clientY), I.target.setPointerCapture(I.pointerId), d == null ? void 0 : d();
1845
+ ]), C = J((v) => {
1846
+ v.stopPropagation(), h(true), m.domElement.style.cursor = "ns-resize", L.current = r - w(v.clientX, v.clientY), v.target.setPointerCapture(v.pointerId), d == null ? void 0 : d();
1847
1847
  }, [
1848
1848
  r,
1849
1849
  m,
1850
1850
  w,
1851
1851
  d
1852
- ]), b = Q((I) => {
1852
+ ]), b = J((v) => {
1853
1853
  if (!u) return;
1854
- let R = w(I.clientX, I.clientY) + k.current;
1855
- R = Math.max(o, Math.min(s, R)), n(R);
1854
+ let k = w(v.clientX, v.clientY) + L.current;
1855
+ k = Math.max(o, Math.min(s, k)), n(k);
1856
1856
  }, [
1857
1857
  u,
1858
1858
  w,
1859
1859
  n,
1860
1860
  o,
1861
1861
  s
1862
- ]), _ = Q((I) => {
1863
- h(false), m.domElement.style.cursor = "auto", I.target.releasePointerCapture(I.pointerId), f == null ? void 0 : f();
1862
+ ]), I = J((v) => {
1863
+ h(false), m.domElement.style.cursor = "auto", v.target.releasePointerCapture(v.pointerId), f == null ? void 0 : f();
1864
1864
  }, [
1865
1865
  m,
1866
1866
  f
1867
1867
  ]);
1868
- if (v.linePoints.length < 2) return null;
1869
- const L = u ? e : z ? a : c;
1870
- return C("group", {
1868
+ if (z.linePoints.length < 2) return null;
1869
+ const _ = u ? e : A ? a : c;
1870
+ return M("group", {
1871
1871
  renderOrder: 10,
1872
1872
  children: [
1873
- i(fe, {
1874
- points: v.linePoints,
1875
- color: L,
1876
- lineWidth: u ? 6 : z ? 5 : 4,
1873
+ i(de, {
1874
+ points: z.linePoints,
1875
+ color: _,
1876
+ lineWidth: u ? 6 : A ? 5 : 4,
1877
1877
  depthTest: false,
1878
1878
  depthWrite: false,
1879
1879
  transparent: true,
1880
1880
  renderOrder: 10,
1881
- onPointerDown: A,
1881
+ onPointerDown: C,
1882
1882
  onPointerMove: b,
1883
- onPointerUp: _,
1883
+ onPointerUp: I,
1884
1884
  onPointerEnter: () => {
1885
1885
  p(true), m.domElement.style.cursor = "ns-resize";
1886
1886
  },
@@ -1888,9 +1888,9 @@ let __tla = (async () => {
1888
1888
  u || (p(false), m.domElement.style.cursor = "auto");
1889
1889
  }
1890
1890
  }),
1891
- (z || u) && i("mesh", {
1891
+ (A || u) && i("mesh", {
1892
1892
  position: [
1893
- v.rightmostPoint.x + l * 0.15,
1893
+ z.rightmostPoint.x + l * 0.15,
1894
1894
  r,
1895
1895
  0
1896
1896
  ],
@@ -1901,7 +1901,7 @@ let __tla = (async () => {
1901
1901
  padding: "4px 8px",
1902
1902
  backgroundColor: "rgba(0, 0, 0, 0.8)",
1903
1903
  borderRadius: 4,
1904
- color: L,
1904
+ color: _,
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 Qo(t, r) {
1916
+ function Jo(t, r) {
1917
1917
  if (t == null) return {};
1918
1918
  var n = {}, o = Object.keys(t), s, l;
1919
1919
  for (l = 0; l < o.length; l++) s = o[l], !(r.indexOf(s) >= 0) && (n[s] = t[s]);
1920
1920
  return n;
1921
1921
  }
1922
- var er = [
1922
+ var Qo = [
1923
1923
  "color"
1924
- ], tr = po(function(t, r) {
1925
- var n = t.color, o = n === void 0 ? "currentColor" : n, s = Qo(t, er);
1926
- return un("svg", Object.assign({
1924
+ ], er = uo(function(t, r) {
1925
+ var n = t.color, o = n === void 0 ? "currentColor" : n, s = Jo(t, Qo);
1926
+ return fn("svg", Object.assign({
1927
1927
  width: "15",
1928
1928
  height: "15",
1929
1929
  viewBox: "0 0 15 15",
@@ -1931,20 +1931,463 @@ let __tla = (async () => {
1931
1931
  xmlns: "http://www.w3.org/2000/svg"
1932
1932
  }, s, {
1933
1933
  ref: r
1934
- }), un("path", {
1934
+ }), fn("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 nr = [
1941
+ const bn = {
1942
+ padding: "8px 20px",
1943
+ borderRadius: 4,
1944
+ fontSize: 14,
1945
+ fontWeight: 500,
1946
+ cursor: "pointer",
1947
+ fontFamily: "system-ui, sans-serif",
1948
+ letterSpacing: "0.4px",
1949
+ lineHeight: "36px"
1950
+ }, pt = {
1951
+ width: "100%",
1952
+ padding: "10px 12px",
1953
+ fontSize: 15,
1954
+ border: "2px solid #ccc",
1955
+ borderRadius: 4,
1956
+ outline: "none",
1957
+ boxSizing: "border-box",
1958
+ fontFamily: "system-ui, sans-serif"
1959
+ }, tr = ({ amputationType: t, spacingInches: r, scanMeasurements: n, scanFrontalHeight: o, onSave: s, onSkip: l, onFormChange: c, onHeightChange: a, initialValues: e, initialFrontalHeight: g }) => {
1960
+ const d = t === "AK" ? "IT" : "MPT", f = r, u = t === "AK" ? 18 : 9, h = V(() => {
1961
+ const v = [];
1962
+ for (let k = 2; k >= 1; k -= f) v.push(`${k}\u2033 above ${d}`);
1963
+ v.push(`At ${d}`);
1964
+ for (let k = f; k <= u; k += f) v.push(`${k}\u2033 below ${d}`);
1965
+ return v;
1966
+ }, [
1967
+ f,
1968
+ d,
1969
+ u
1970
+ ]), A = V(() => t === "BK" ? /* @__PURE__ */ new Set([
1971
+ `At ${d}`,
1972
+ `2\u2033 below ${d}`,
1973
+ `4\u2033 below ${d}`
1974
+ ]) : /* @__PURE__ */ new Set([
1975
+ `At ${d}`,
1976
+ `2\u2033 below ${d}`,
1977
+ `4\u2033 below ${d}`
1978
+ ]), [
1979
+ t,
1980
+ d
1981
+ ]), [p, x] = B(() => {
1982
+ if (!e) return {};
1983
+ const v = {};
1984
+ return h.forEach((k, R) => {
1985
+ e[R] != null && e[R] !== 0 && (v[k] = e[R].toFixed(1));
1986
+ }), v;
1987
+ }), [m, L] = B(g && g > 0 ? g.toFixed(1) : ""), [S, P] = B(""), [z, w] = B(""), C = V(() => h.map((v) => {
1988
+ const k = p[v];
1989
+ return k != null && k !== "" && !isNaN(parseFloat(k)) ? parseFloat(k) : 0;
1990
+ }), [
1991
+ h,
1992
+ p
1993
+ ]);
1994
+ U(() => {
1995
+ c == null ? void 0 : c(C);
1996
+ }, [
1997
+ C,
1998
+ c
1999
+ ]), U(() => {
2000
+ const v = m !== "" && !isNaN(parseFloat(m)) ? parseFloat(m) : void 0;
2001
+ a == null ? void 0 : a(v);
2002
+ }, [
2003
+ m,
2004
+ a
2005
+ ]);
2006
+ const b = V(() => {
2007
+ for (const v of A) {
2008
+ const k = h.indexOf(v);
2009
+ if (k === -1) continue;
2010
+ if (C[k] === 0) return false;
2011
+ }
2012
+ return !(t === "AK" && (!S || isNaN(parseFloat(S)) || parseFloat(S) === 0 || !z || isNaN(parseFloat(z)) || parseFloat(z) === 0));
2013
+ }, [
2014
+ C,
2015
+ h,
2016
+ A,
2017
+ t,
2018
+ S,
2019
+ z
2020
+ ]), I = J(() => {
2021
+ if (!b) return;
2022
+ const v = m !== "" && !isNaN(parseFloat(m)) ? parseFloat(m) : 0, k = S !== "" && !isNaN(parseFloat(S)) ? parseFloat(S) : void 0, R = z !== "" && !isNaN(parseFloat(z)) ? parseFloat(z) : void 0;
2023
+ s({
2024
+ circumferences: C,
2025
+ frontalHeight: v,
2026
+ perineumML: k,
2027
+ perineumAP: R
2028
+ });
2029
+ }, [
2030
+ b,
2031
+ C,
2032
+ m,
2033
+ S,
2034
+ z,
2035
+ s
2036
+ ]), _ = J(() => {
2037
+ const v = {};
2038
+ h.forEach((k, R) => {
2039
+ const T = n[R];
2040
+ if (T) {
2041
+ const N = T.modifiedValue ?? T.originalValue;
2042
+ v[k] = N.toFixed(1);
2043
+ }
2044
+ }), x(v), o > 0 && L(o.toFixed(1));
2045
+ }, [
2046
+ h,
2047
+ n,
2048
+ o
2049
+ ]);
2050
+ return M("div", {
2051
+ style: {
2052
+ display: "flex",
2053
+ flexDirection: "column",
2054
+ height: "100%",
2055
+ backgroundColor: "#f5f5f5",
2056
+ fontFamily: "system-ui, sans-serif"
2057
+ },
2058
+ children: [
2059
+ M("div", {
2060
+ style: {
2061
+ padding: "16px 20px 12px",
2062
+ backgroundColor: "#fff",
2063
+ borderBottom: "1px solid #e0e0e0",
2064
+ flexShrink: 0
2065
+ },
2066
+ children: [
2067
+ M("div", {
2068
+ style: {
2069
+ fontSize: 18,
2070
+ fontWeight: 600,
2071
+ color: "rgba(0,0,0,0.87)"
2072
+ },
2073
+ children: [
2074
+ t,
2075
+ " Measurements"
2076
+ ]
2077
+ }),
2078
+ M("div", {
2079
+ style: {
2080
+ fontSize: 12,
2081
+ color: "rgba(0,0,0,0.54)",
2082
+ marginTop: 2
2083
+ },
2084
+ children: [
2085
+ "Enter measurements (mm). ",
2086
+ f,
2087
+ "\u2033",
2088
+ " spacing. ",
2089
+ i("span", {
2090
+ style: {
2091
+ color: "#e53935"
2092
+ },
2093
+ children: "*"
2094
+ }),
2095
+ " = required"
2096
+ ]
2097
+ }),
2098
+ i("button", {
2099
+ onClick: _,
2100
+ style: {
2101
+ ...bn,
2102
+ backgroundColor: "#fff",
2103
+ border: "2px solid rgb(12, 67, 173)",
2104
+ color: "rgb(12, 67, 173)",
2105
+ fontWeight: 600,
2106
+ padding: "4px 12px",
2107
+ fontSize: 12,
2108
+ marginTop: 8,
2109
+ width: "100%"
2110
+ },
2111
+ children: M("span", {
2112
+ style: {
2113
+ display: "flex",
2114
+ alignItems: "center",
2115
+ justifyContent: "center",
2116
+ gap: 4
2117
+ },
2118
+ children: [
2119
+ i(er, {
2120
+ style: {
2121
+ width: 14,
2122
+ height: 14
2123
+ }
2124
+ }),
2125
+ "Pull from Scan"
2126
+ ]
2127
+ })
2128
+ })
2129
+ ]
2130
+ }),
2131
+ M("div", {
2132
+ style: {
2133
+ flex: 1,
2134
+ minHeight: 0,
2135
+ overflow: "auto",
2136
+ padding: "16px 20px",
2137
+ WebkitOverflowScrolling: "touch"
2138
+ },
2139
+ children: [
2140
+ i("div", {
2141
+ style: {
2142
+ fontSize: 13,
2143
+ fontWeight: 600,
2144
+ color: "rgba(0,0,0,0.87)",
2145
+ marginBottom: 8
2146
+ },
2147
+ children: "Circumferences"
2148
+ }),
2149
+ i("div", {
2150
+ style: {
2151
+ display: "flex",
2152
+ flexDirection: "column",
2153
+ gap: 8,
2154
+ marginBottom: 20
2155
+ },
2156
+ children: h.map((v, k) => {
2157
+ const R = A.has(v);
2158
+ return M("div", {
2159
+ style: {
2160
+ display: "flex",
2161
+ alignItems: "center",
2162
+ gap: 8
2163
+ },
2164
+ children: [
2165
+ M("label", {
2166
+ style: {
2167
+ fontSize: 11,
2168
+ fontWeight: 500,
2169
+ color: "rgb(12, 67, 173)",
2170
+ minWidth: 100,
2171
+ flexShrink: 0
2172
+ },
2173
+ children: [
2174
+ v,
2175
+ R && i("span", {
2176
+ style: {
2177
+ color: "#e53935",
2178
+ marginLeft: 2
2179
+ },
2180
+ children: "*"
2181
+ })
2182
+ ]
2183
+ }),
2184
+ i("input", {
2185
+ type: "number",
2186
+ step: "0.1",
2187
+ value: p[v] ?? "",
2188
+ onChange: (T) => x((N) => ({
2189
+ ...N,
2190
+ [v]: T.target.value
2191
+ })),
2192
+ style: {
2193
+ ...pt,
2194
+ padding: "6px 8px",
2195
+ fontSize: 13,
2196
+ borderColor: p[v] ? "rgb(12, 67, 173)" : "#ccc",
2197
+ borderWidth: 1
2198
+ },
2199
+ placeholder: "0.0"
2200
+ })
2201
+ ]
2202
+ }, k);
2203
+ })
2204
+ }),
2205
+ t === "AK" && M(We, {
2206
+ children: [
2207
+ i("div", {
2208
+ style: {
2209
+ fontSize: 13,
2210
+ fontWeight: 600,
2211
+ color: "rgba(0,0,0,0.87)",
2212
+ marginBottom: 8
2213
+ },
2214
+ children: "Perineum"
2215
+ }),
2216
+ M("div", {
2217
+ style: {
2218
+ display: "flex",
2219
+ flexDirection: "column",
2220
+ gap: 8,
2221
+ marginBottom: 20
2222
+ },
2223
+ children: [
2224
+ M("div", {
2225
+ style: {
2226
+ display: "flex",
2227
+ alignItems: "center",
2228
+ gap: 8
2229
+ },
2230
+ children: [
2231
+ M("label", {
2232
+ style: {
2233
+ fontSize: 11,
2234
+ fontWeight: 500,
2235
+ color: "rgb(12, 67, 173)",
2236
+ minWidth: 100,
2237
+ flexShrink: 0
2238
+ },
2239
+ children: [
2240
+ "ML",
2241
+ i("span", {
2242
+ style: {
2243
+ color: "#e53935",
2244
+ marginLeft: 2
2245
+ },
2246
+ children: "*"
2247
+ })
2248
+ ]
2249
+ }),
2250
+ i("input", {
2251
+ type: "number",
2252
+ step: "0.1",
2253
+ value: S,
2254
+ onChange: (v) => P(v.target.value),
2255
+ style: {
2256
+ ...pt,
2257
+ padding: "6px 8px",
2258
+ fontSize: 13,
2259
+ borderColor: S ? "rgb(12, 67, 173)" : "#ccc",
2260
+ borderWidth: 1
2261
+ },
2262
+ placeholder: "0.0"
2263
+ })
2264
+ ]
2265
+ }),
2266
+ M("div", {
2267
+ style: {
2268
+ display: "flex",
2269
+ alignItems: "center",
2270
+ gap: 8
2271
+ },
2272
+ children: [
2273
+ M("label", {
2274
+ style: {
2275
+ fontSize: 11,
2276
+ fontWeight: 500,
2277
+ color: "rgb(12, 67, 173)",
2278
+ minWidth: 100,
2279
+ flexShrink: 0
2280
+ },
2281
+ children: [
2282
+ "AP",
2283
+ i("span", {
2284
+ style: {
2285
+ color: "#e53935",
2286
+ marginLeft: 2
2287
+ },
2288
+ children: "*"
2289
+ })
2290
+ ]
2291
+ }),
2292
+ i("input", {
2293
+ type: "number",
2294
+ step: "0.1",
2295
+ value: z,
2296
+ onChange: (v) => w(v.target.value),
2297
+ style: {
2298
+ ...pt,
2299
+ padding: "6px 8px",
2300
+ fontSize: 13,
2301
+ borderColor: z ? "rgb(12, 67, 173)" : "#ccc",
2302
+ borderWidth: 1
2303
+ },
2304
+ placeholder: "0.0"
2305
+ })
2306
+ ]
2307
+ })
2308
+ ]
2309
+ })
2310
+ ]
2311
+ }),
2312
+ i("div", {
2313
+ style: {
2314
+ fontSize: 13,
2315
+ fontWeight: 600,
2316
+ color: "rgba(0,0,0,0.87)",
2317
+ marginBottom: 8
2318
+ },
2319
+ children: "Lengths"
2320
+ }),
2321
+ M("div", {
2322
+ style: {
2323
+ display: "flex",
2324
+ alignItems: "center",
2325
+ gap: 8
2326
+ },
2327
+ children: [
2328
+ i("label", {
2329
+ style: {
2330
+ fontSize: 11,
2331
+ fontWeight: 500,
2332
+ color: "rgb(12, 67, 173)",
2333
+ minWidth: 100,
2334
+ flexShrink: 0
2335
+ },
2336
+ children: "Starting Pt Height"
2337
+ }),
2338
+ i("input", {
2339
+ type: "number",
2340
+ step: "0.1",
2341
+ value: m,
2342
+ onChange: (v) => L(v.target.value),
2343
+ style: {
2344
+ ...pt,
2345
+ padding: "6px 8px",
2346
+ fontSize: 13,
2347
+ borderColor: m ? "rgb(12, 67, 173)" : "#ccc",
2348
+ borderWidth: 1
2349
+ },
2350
+ placeholder: "0.0"
2351
+ })
2352
+ ]
2353
+ })
2354
+ ]
2355
+ }),
2356
+ i("div", {
2357
+ style: {
2358
+ padding: "12px 20px",
2359
+ backgroundColor: "#fff",
2360
+ borderTop: "1px solid #e0e0e0",
2361
+ display: "flex",
2362
+ flexDirection: "column",
2363
+ gap: 8,
2364
+ flexShrink: 0
2365
+ },
2366
+ children: i("button", {
2367
+ onClick: I,
2368
+ disabled: !b,
2369
+ style: {
2370
+ ...bn,
2371
+ backgroundColor: b ? "rgb(12, 67, 173)" : "#e0e0e0",
2372
+ border: "none",
2373
+ color: b ? "#fff" : "#9e9e9e",
2374
+ cursor: b ? "pointer" : "not-allowed",
2375
+ padding: "6px 16px",
2376
+ fontSize: 13,
2377
+ width: "100%"
2378
+ },
2379
+ children: "Save Measurements"
2380
+ })
2381
+ })
2382
+ ]
2383
+ });
2384
+ }, nr = [
1942
2385
  "Scan doesn't load properly",
1943
2386
  "Modified CAD",
1944
2387
  "I don't want to",
1945
2388
  "I want a second opinion",
1946
2389
  "I measured from IT"
1947
- ], pt = {
2390
+ ], ht = {
1948
2391
  padding: "8px 20px",
1949
2392
  borderRadius: 4,
1950
2393
  fontSize: 14,
@@ -1962,15 +2405,15 @@ let __tla = (async () => {
1962
2405
  outline: "none",
1963
2406
  boxSizing: "border-box",
1964
2407
  fontFamily: "system-ui, sans-serif"
1965
- }, Ln = ({ onSkip: t, onCancel: r }) => {
1966
- const [n, o] = B("confirm"), [s, l] = B(null), [c, a] = B(""), e = Q(() => {
2408
+ }, rr = ({ onSkip: t, onCancel: r }) => {
2409
+ const [n, o] = B("confirm"), [s, l] = B(null), [c, a] = B(""), e = J(() => {
1967
2410
  o("reasons");
1968
- }, []), g = Q(() => {
2411
+ }, []), g = J(() => {
1969
2412
  n === "reasons" ? (o("confirm"), l(null), a("")) : r();
1970
2413
  }, [
1971
2414
  n,
1972
2415
  r
1973
- ]), d = s != null && (s !== "Other" || c.trim() !== ""), f = Q(() => {
2416
+ ]), d = s != null && (s !== "Other" || c.trim() !== ""), f = J(() => {
1974
2417
  !d || !s || t(s === "Other" ? `Other: ${c.trim()}` : s);
1975
2418
  }, [
1976
2419
  d,
@@ -1991,7 +2434,7 @@ let __tla = (async () => {
1991
2434
  zIndex: 9999,
1992
2435
  fontFamily: "system-ui, sans-serif"
1993
2436
  },
1994
- children: C("div", {
2437
+ children: M("div", {
1995
2438
  style: {
1996
2439
  backgroundColor: "#fff",
1997
2440
  borderRadius: 12,
@@ -1999,7 +2442,7 @@ let __tla = (async () => {
1999
2442
  boxShadow: "0 24px 38px 3px rgba(0,0,0,0.14)"
2000
2443
  },
2001
2444
  children: [
2002
- C("div", {
2445
+ M("div", {
2003
2446
  style: {
2004
2447
  padding: "24px 24px 0"
2005
2448
  },
@@ -2022,7 +2465,7 @@ let __tla = (async () => {
2022
2465
  })
2023
2466
  ]
2024
2467
  }),
2025
- C("div", {
2468
+ M("div", {
2026
2469
  style: {
2027
2470
  padding: "20px 24px",
2028
2471
  display: "flex",
@@ -2033,7 +2476,7 @@ let __tla = (async () => {
2033
2476
  [
2034
2477
  ...nr,
2035
2478
  "Other"
2036
- ].map((u) => C("label", {
2479
+ ].map((u) => M("label", {
2037
2480
  style: {
2038
2481
  display: "flex",
2039
2482
  alignItems: "center",
@@ -2087,7 +2530,7 @@ let __tla = (async () => {
2087
2530
  })
2088
2531
  ]
2089
2532
  }),
2090
- C("div", {
2533
+ M("div", {
2091
2534
  style: {
2092
2535
  display: "flex",
2093
2536
  justifyContent: "flex-end",
@@ -2099,7 +2542,7 @@ let __tla = (async () => {
2099
2542
  i("button", {
2100
2543
  onClick: g,
2101
2544
  style: {
2102
- ...pt,
2545
+ ...ht,
2103
2546
  backgroundColor: "#fff",
2104
2547
  border: "1px solid #ddd",
2105
2548
  color: "#666"
@@ -2110,7 +2553,7 @@ let __tla = (async () => {
2110
2553
  onClick: f,
2111
2554
  disabled: !d,
2112
2555
  style: {
2113
- ...pt,
2556
+ ...ht,
2114
2557
  backgroundColor: d ? "rgb(12, 67, 173)" : "#e0e0e0",
2115
2558
  border: "none",
2116
2559
  color: d ? "#fff" : "#9e9e9e",
@@ -2135,7 +2578,7 @@ let __tla = (async () => {
2135
2578
  zIndex: 9999,
2136
2579
  fontFamily: "system-ui, sans-serif"
2137
2580
  },
2138
- children: C("div", {
2581
+ children: M("div", {
2139
2582
  style: {
2140
2583
  backgroundColor: "#fff",
2141
2584
  borderRadius: 8,
@@ -2161,7 +2604,7 @@ let __tla = (async () => {
2161
2604
  },
2162
2605
  children: "Your measurements will be submitted without comparing to the scan. Are you sure?"
2163
2606
  }),
2164
- C("div", {
2607
+ M("div", {
2165
2608
  style: {
2166
2609
  display: "flex",
2167
2610
  justifyContent: "flex-end",
@@ -2171,7 +2614,7 @@ let __tla = (async () => {
2171
2614
  i("button", {
2172
2615
  onClick: r,
2173
2616
  style: {
2174
- ...pt,
2617
+ ...ht,
2175
2618
  backgroundColor: "#fff",
2176
2619
  border: "1px solid #bdbdbd",
2177
2620
  color: "#333"
@@ -2179,510 +2622,48 @@ let __tla = (async () => {
2179
2622
  children: "Cancel"
2180
2623
  }),
2181
2624
  i("button", {
2182
- onClick: e,
2183
- style: {
2184
- ...pt,
2185
- backgroundColor: "rgb(12, 67, 173)",
2186
- border: "none",
2187
- color: "#fff"
2188
- },
2189
- children: "Confirm"
2190
- })
2191
- ]
2192
- })
2193
- ]
2194
- })
2195
- });
2196
- }, Tt = {
2197
- padding: "8px 20px",
2198
- borderRadius: 4,
2199
- fontSize: 14,
2200
- fontWeight: 500,
2201
- cursor: "pointer",
2202
- fontFamily: "system-ui, sans-serif",
2203
- letterSpacing: "0.4px",
2204
- lineHeight: "36px"
2205
- }, ht = {
2206
- width: "100%",
2207
- padding: "10px 12px",
2208
- fontSize: 15,
2209
- border: "2px solid #ccc",
2210
- borderRadius: 4,
2211
- outline: "none",
2212
- boxSizing: "border-box",
2213
- fontFamily: "system-ui, sans-serif"
2214
- }, rr = ({ amputationType: t, spacingInches: r, scanMeasurements: n, scanFrontalHeight: o, onSave: s, onSkip: l, onFormChange: c, onHeightChange: a, initialValues: e, initialFrontalHeight: g }) => {
2215
- const d = t === "AK" ? "IT" : "MPT", f = r, u = t === "AK" ? 18 : 9, h = V(() => {
2216
- const P = [];
2217
- for (let E = 2; E >= 1; E -= f) P.push(`${E}\u2033 above ${d}`);
2218
- P.push(`At ${d}`);
2219
- for (let E = f; E <= u; E += f) P.push(`${E}\u2033 below ${d}`);
2220
- return P;
2221
- }, [
2222
- f,
2223
- d,
2224
- u
2225
- ]), z = V(() => t === "BK" ? /* @__PURE__ */ new Set([
2226
- `At ${d}`,
2227
- `2\u2033 below ${d}`,
2228
- `4\u2033 below ${d}`
2229
- ]) : /* @__PURE__ */ new Set([
2230
- `At ${d}`,
2231
- `2\u2033 below ${d}`,
2232
- `4\u2033 below ${d}`
2233
- ]), [
2234
- t,
2235
- d
2236
- ]), [p, x] = B(() => {
2237
- if (!e) return {};
2238
- const P = {};
2239
- return h.forEach((E, T) => {
2240
- e[T] != null && e[T] !== 0 && (P[E] = e[T].toFixed(1));
2241
- }), P;
2242
- }), [m, k] = B(g && g > 0 ? g.toFixed(1) : ""), [S, F] = B(""), [v, w] = B(""), [A, b] = B(false), _ = V(() => h.map((P) => {
2243
- const E = p[P];
2244
- return E != null && E !== "" && !isNaN(parseFloat(E)) ? parseFloat(E) : 0;
2245
- }), [
2246
- h,
2247
- p
2248
- ]);
2249
- q(() => {
2250
- c == null ? void 0 : c(_);
2251
- }, [
2252
- _,
2253
- c
2254
- ]), q(() => {
2255
- const P = m !== "" && !isNaN(parseFloat(m)) ? parseFloat(m) : void 0;
2256
- a == null ? void 0 : a(P);
2257
- }, [
2258
- m,
2259
- a
2260
- ]);
2261
- const L = V(() => {
2262
- for (const P of z) {
2263
- const E = h.indexOf(P);
2264
- if (E === -1) continue;
2265
- if (_[E] === 0) return false;
2266
- }
2267
- return !(t === "AK" && (!S || isNaN(parseFloat(S)) || parseFloat(S) === 0 || !v || isNaN(parseFloat(v)) || parseFloat(v) === 0));
2268
- }, [
2269
- _,
2270
- h,
2271
- z,
2272
- t,
2273
- S,
2274
- v
2275
- ]), I = Q(() => {
2276
- if (!L) return;
2277
- const P = m !== "" && !isNaN(parseFloat(m)) ? parseFloat(m) : 0, E = S !== "" && !isNaN(parseFloat(S)) ? parseFloat(S) : void 0, T = v !== "" && !isNaN(parseFloat(v)) ? parseFloat(v) : void 0;
2278
- s({
2279
- circumferences: _,
2280
- frontalHeight: P,
2281
- perineumML: E,
2282
- perineumAP: T
2283
- });
2284
- }, [
2285
- L,
2286
- _,
2287
- m,
2288
- S,
2289
- v,
2290
- s
2291
- ]), R = Q(() => {
2292
- const P = {};
2293
- h.forEach((E, T) => {
2294
- const Y = n[T];
2295
- if (Y) {
2296
- const ae = Y.modifiedValue ?? Y.originalValue;
2297
- P[E] = ae.toFixed(1);
2298
- }
2299
- }), x(P), o > 0 && k(o.toFixed(1));
2300
- }, [
2301
- h,
2302
- n,
2303
- o
2304
- ]);
2305
- return C("div", {
2306
- style: {
2307
- display: "flex",
2308
- flexDirection: "column",
2309
- height: "100%",
2310
- backgroundColor: "#f5f5f5",
2311
- fontFamily: "system-ui, sans-serif"
2312
- },
2313
- children: [
2314
- A && i(Ln, {
2315
- onSkip: l,
2316
- onCancel: () => b(false)
2317
- }),
2318
- C("div", {
2319
- style: {
2320
- padding: "16px 20px 12px",
2321
- backgroundColor: "#fff",
2322
- borderBottom: "1px solid #e0e0e0",
2323
- flexShrink: 0
2324
- },
2325
- children: [
2326
- C("div", {
2327
- style: {
2328
- fontSize: 18,
2329
- fontWeight: 600,
2330
- color: "rgba(0,0,0,0.87)"
2331
- },
2332
- children: [
2333
- t,
2334
- " Measurements"
2335
- ]
2336
- }),
2337
- C("div", {
2338
- style: {
2339
- fontSize: 12,
2340
- color: "rgba(0,0,0,0.54)",
2341
- marginTop: 2
2342
- },
2343
- children: [
2344
- "Enter measurements (mm). ",
2345
- f,
2346
- "\u2033",
2347
- " spacing. ",
2348
- i("span", {
2349
- style: {
2350
- color: "#e53935"
2351
- },
2352
- children: "*"
2353
- }),
2354
- " = required"
2355
- ]
2356
- }),
2357
- i("button", {
2358
- onClick: R,
2359
- style: {
2360
- ...Tt,
2361
- backgroundColor: "#fff",
2362
- border: "2px solid rgb(12, 67, 173)",
2363
- color: "rgb(12, 67, 173)",
2364
- fontWeight: 600,
2365
- padding: "4px 12px",
2366
- fontSize: 12,
2367
- marginTop: 8,
2368
- width: "100%"
2369
- },
2370
- children: C("span", {
2625
+ onClick: e,
2371
2626
  style: {
2372
- display: "flex",
2373
- alignItems: "center",
2374
- justifyContent: "center",
2375
- gap: 4
2627
+ ...ht,
2628
+ backgroundColor: "rgb(12, 67, 173)",
2629
+ border: "none",
2630
+ color: "#fff"
2376
2631
  },
2377
- children: [
2378
- i(tr, {
2379
- style: {
2380
- width: 14,
2381
- height: 14
2382
- }
2383
- }),
2384
- "Pull from Scan"
2385
- ]
2386
- })
2387
- })
2388
- ]
2389
- }),
2390
- C("div", {
2391
- style: {
2392
- flex: 1,
2393
- minHeight: 0,
2394
- overflow: "auto",
2395
- padding: "16px 20px",
2396
- WebkitOverflowScrolling: "touch"
2397
- },
2398
- children: [
2399
- i("div", {
2400
- style: {
2401
- fontSize: 13,
2402
- fontWeight: 600,
2403
- color: "rgba(0,0,0,0.87)",
2404
- marginBottom: 8
2405
- },
2406
- children: "Circumferences"
2407
- }),
2408
- i("div", {
2409
- style: {
2410
- display: "flex",
2411
- flexDirection: "column",
2412
- gap: 8,
2413
- marginBottom: 20
2414
- },
2415
- children: h.map((P, E) => {
2416
- const T = z.has(P);
2417
- return C("div", {
2418
- style: {
2419
- display: "flex",
2420
- alignItems: "center",
2421
- gap: 8
2422
- },
2423
- children: [
2424
- C("label", {
2425
- style: {
2426
- fontSize: 11,
2427
- fontWeight: 500,
2428
- color: "rgb(12, 67, 173)",
2429
- minWidth: 100,
2430
- flexShrink: 0
2431
- },
2432
- children: [
2433
- P,
2434
- T && i("span", {
2435
- style: {
2436
- color: "#e53935",
2437
- marginLeft: 2
2438
- },
2439
- children: "*"
2440
- })
2441
- ]
2442
- }),
2443
- i("input", {
2444
- type: "number",
2445
- step: "0.1",
2446
- value: p[P] ?? "",
2447
- onChange: (Y) => x((ae) => ({
2448
- ...ae,
2449
- [P]: Y.target.value
2450
- })),
2451
- style: {
2452
- ...ht,
2453
- padding: "6px 8px",
2454
- fontSize: 13,
2455
- borderColor: p[P] ? "rgb(12, 67, 173)" : "#ccc",
2456
- borderWidth: 1
2457
- },
2458
- placeholder: "0.0"
2459
- })
2460
- ]
2461
- }, E);
2632
+ children: "Confirm"
2462
2633
  })
2463
- }),
2464
- t === "AK" && C(We, {
2465
- children: [
2466
- i("div", {
2467
- style: {
2468
- fontSize: 13,
2469
- fontWeight: 600,
2470
- color: "rgba(0,0,0,0.87)",
2471
- marginBottom: 8
2472
- },
2473
- children: "Perineum"
2474
- }),
2475
- C("div", {
2476
- style: {
2477
- display: "flex",
2478
- flexDirection: "column",
2479
- gap: 8,
2480
- marginBottom: 20
2481
- },
2482
- children: [
2483
- C("div", {
2484
- style: {
2485
- display: "flex",
2486
- alignItems: "center",
2487
- gap: 8
2488
- },
2489
- children: [
2490
- C("label", {
2491
- style: {
2492
- fontSize: 11,
2493
- fontWeight: 500,
2494
- color: "rgb(12, 67, 173)",
2495
- minWidth: 100,
2496
- flexShrink: 0
2497
- },
2498
- children: [
2499
- "ML",
2500
- i("span", {
2501
- style: {
2502
- color: "#e53935",
2503
- marginLeft: 2
2504
- },
2505
- children: "*"
2506
- })
2507
- ]
2508
- }),
2509
- i("input", {
2510
- type: "number",
2511
- step: "0.1",
2512
- value: S,
2513
- onChange: (P) => F(P.target.value),
2514
- style: {
2515
- ...ht,
2516
- padding: "6px 8px",
2517
- fontSize: 13,
2518
- borderColor: S ? "rgb(12, 67, 173)" : "#ccc",
2519
- borderWidth: 1
2520
- },
2521
- placeholder: "0.0"
2522
- })
2523
- ]
2524
- }),
2525
- C("div", {
2526
- style: {
2527
- display: "flex",
2528
- alignItems: "center",
2529
- gap: 8
2530
- },
2531
- children: [
2532
- C("label", {
2533
- style: {
2534
- fontSize: 11,
2535
- fontWeight: 500,
2536
- color: "rgb(12, 67, 173)",
2537
- minWidth: 100,
2538
- flexShrink: 0
2539
- },
2540
- children: [
2541
- "AP",
2542
- i("span", {
2543
- style: {
2544
- color: "#e53935",
2545
- marginLeft: 2
2546
- },
2547
- children: "*"
2548
- })
2549
- ]
2550
- }),
2551
- i("input", {
2552
- type: "number",
2553
- step: "0.1",
2554
- value: v,
2555
- onChange: (P) => w(P.target.value),
2556
- style: {
2557
- ...ht,
2558
- padding: "6px 8px",
2559
- fontSize: 13,
2560
- borderColor: v ? "rgb(12, 67, 173)" : "#ccc",
2561
- borderWidth: 1
2562
- },
2563
- placeholder: "0.0"
2564
- })
2565
- ]
2566
- })
2567
- ]
2568
- })
2569
- ]
2570
- }),
2571
- i("div", {
2572
- style: {
2573
- fontSize: 13,
2574
- fontWeight: 600,
2575
- color: "rgba(0,0,0,0.87)",
2576
- marginBottom: 8
2577
- },
2578
- children: "Lengths"
2579
- }),
2580
- C("div", {
2581
- style: {
2582
- display: "flex",
2583
- alignItems: "center",
2584
- gap: 8
2585
- },
2586
- children: [
2587
- i("label", {
2588
- style: {
2589
- fontSize: 11,
2590
- fontWeight: 500,
2591
- color: "rgb(12, 67, 173)",
2592
- minWidth: 100,
2593
- flexShrink: 0
2594
- },
2595
- children: "Starting Pt Height"
2596
- }),
2597
- i("input", {
2598
- type: "number",
2599
- step: "0.1",
2600
- value: m,
2601
- onChange: (P) => k(P.target.value),
2602
- style: {
2603
- ...ht,
2604
- padding: "6px 8px",
2605
- fontSize: 13,
2606
- borderColor: m ? "rgb(12, 67, 173)" : "#ccc",
2607
- borderWidth: 1
2608
- },
2609
- placeholder: "0.0"
2610
- })
2611
- ]
2612
- })
2613
- ]
2614
- }),
2615
- C("div", {
2616
- style: {
2617
- padding: "12px 20px",
2618
- backgroundColor: "#fff",
2619
- borderTop: "1px solid #e0e0e0",
2620
- display: "flex",
2621
- flexDirection: "column",
2622
- gap: 8,
2623
- flexShrink: 0
2624
- },
2625
- children: [
2626
- i("button", {
2627
- onClick: I,
2628
- disabled: !L,
2629
- style: {
2630
- ...Tt,
2631
- backgroundColor: L ? "rgb(12, 67, 173)" : "#e0e0e0",
2632
- border: "none",
2633
- color: L ? "#fff" : "#9e9e9e",
2634
- cursor: L ? "pointer" : "not-allowed",
2635
- padding: "6px 16px",
2636
- fontSize: 13,
2637
- width: "100%"
2638
- },
2639
- children: "Save Measurements"
2640
- }),
2641
- i("button", {
2642
- onClick: () => b(true),
2643
- style: {
2644
- ...Tt,
2645
- backgroundColor: "#fff",
2646
- border: "1px solid #bdbdbd",
2647
- color: "#666",
2648
- padding: "6px 16px",
2649
- fontSize: 12,
2650
- width: "100%"
2651
- },
2652
- children: "Have Galileo Check My Measurements"
2653
- })
2654
- ]
2655
- })
2656
- ]
2634
+ ]
2635
+ })
2636
+ ]
2637
+ })
2657
2638
  });
2658
2639
  };
2659
- function _n(t, r, n) {
2640
+ function Ln(t, r, n) {
2660
2641
  const o = t.getAttribute("position"), s = n - r;
2661
2642
  if (s < 1) return null;
2662
2643
  const l = 30, c = s / l, a = [];
2663
2644
  for (let x = 0; x < l; x++) {
2664
- const m = r + x * c, k = r + (x + 1) * c;
2665
- let S = 0, F = 0, v = 0, w = 0;
2666
- for (let A = 0; A < o.count; A++) {
2667
- const b = o.getY(A);
2668
- b >= m && b < k && (S += o.getX(A), F += b, v += o.getZ(A), w++);
2645
+ const m = r + x * c, L = r + (x + 1) * c;
2646
+ let S = 0, P = 0, z = 0, w = 0;
2647
+ for (let C = 0; C < o.count; C++) {
2648
+ const b = o.getY(C);
2649
+ b >= m && b < L && (S += o.getX(C), P += b, z += o.getZ(C), w++);
2669
2650
  }
2670
- w > 20 && a.push(new M(S / w, F / w, v / w));
2651
+ w > 20 && a.push(new F(S / w, P / w, z / w));
2671
2652
  }
2672
2653
  if (a.length < 5) return null;
2673
- const e = new M();
2654
+ const e = new F();
2674
2655
  for (const x of a) e.add(x);
2675
2656
  e.divideScalar(a.length);
2676
- let g = 0, d = 0, f = 0, u = 0, h = 0, z = 0;
2657
+ let g = 0, d = 0, f = 0, u = 0, h = 0, A = 0;
2677
2658
  for (const x of a) {
2678
- const m = x.x - e.x, k = x.y - e.y, S = x.z - e.z;
2679
- g += m * m, d += m * k, f += m * S, u += k * k, h += k * S, z += S * S;
2659
+ const m = x.x - e.x, L = x.y - e.y, S = x.z - e.z;
2660
+ g += m * m, d += m * L, f += m * S, u += L * L, h += L * S, A += S * S;
2680
2661
  }
2681
- let p = new M(0.01, 1, 0.01).normalize();
2662
+ let p = new F(0.01, 1, 0.01).normalize();
2682
2663
  for (let x = 0; x < 30; x++) {
2683
- const m = g * p.x + d * p.y + f * p.z, k = d * p.x + u * p.y + h * p.z, S = f * p.x + h * p.y + z * p.z, F = new M(m, k, S), v = F.length();
2684
- if (v < 1e-10 || (F.divideScalar(v), p.distanceTo(F) < 1e-8)) break;
2685
- p = F;
2664
+ const m = g * p.x + d * p.y + f * p.z, L = d * p.x + u * p.y + h * p.z, S = f * p.x + h * p.y + A * p.z, P = new F(m, L, S), z = P.length();
2665
+ if (z < 1e-10 || (P.divideScalar(z), p.distanceTo(P) < 1e-8)) break;
2666
+ p = P;
2686
2667
  }
2687
2668
  return p.y < 0 && p.negate(), p;
2688
2669
  }
@@ -2701,14 +2682,14 @@ let __tla = (async () => {
2701
2682
  "#44cc44",
2702
2683
  "#4488ff"
2703
2684
  ];
2704
- function In(t) {
2705
- const r = t.getAttribute("position"), n = r.count, o = new M();
2685
+ function _n(t) {
2686
+ const r = t.getAttribute("position"), n = r.count, o = new F();
2706
2687
  for (let p = 0; p < n; p++) o.x += r.getX(p), o.y += r.getY(p), o.z += r.getZ(p);
2707
2688
  o.divideScalar(n);
2708
2689
  let s = 0, l = 0, c = 0, a = 0, e = 0, g = 0;
2709
2690
  for (let p = 0; p < n; p++) {
2710
- const x = r.getX(p) - o.x, m = r.getY(p) - o.y, k = r.getZ(p) - o.z;
2711
- s += x * x, l += x * m, c += x * k, a += m * m, e += m * k, g += k * k;
2691
+ const x = r.getX(p) - o.x, m = r.getY(p) - o.y, L = r.getZ(p) - o.z;
2692
+ s += x * x, l += x * m, c += x * L, a += m * m, e += m * L, g += L * L;
2712
2693
  }
2713
2694
  s /= n, l /= n, c /= n, a /= n, e /= n, g /= n;
2714
2695
  const d = [], f = [], u = [
@@ -2729,9 +2710,9 @@ let __tla = (async () => {
2729
2710
  ]
2730
2711
  ];
2731
2712
  for (let p = 0; p < 3; p++) {
2732
- let x = new M(1 + p * 0.1, 1 - p * 0.1, 0.5 + p * 0.3).normalize(), m = 0;
2733
- for (let k = 0; k < 100; k++) {
2734
- const S = u[0][0] * x.x + u[0][1] * x.y + u[0][2] * x.z, F = u[1][0] * x.x + u[1][1] * x.y + u[1][2] * x.z, v = u[2][0] * x.x + u[2][1] * x.y + u[2][2] * x.z, w = new M(S, F, v);
2713
+ let x = new F(1 + p * 0.1, 1 - p * 0.1, 0.5 + p * 0.3).normalize(), m = 0;
2714
+ for (let L = 0; L < 100; L++) {
2715
+ const S = u[0][0] * x.x + u[0][1] * x.y + u[0][2] * x.z, P = u[1][0] * x.x + u[1][1] * x.y + u[1][2] * x.z, z = u[2][0] * x.x + u[2][1] * x.y + u[2][2] * x.z, w = new F(S, P, z);
2735
2716
  if (m = w.length(), m < 1e-12) break;
2736
2717
  if (w.divideScalar(m), x.distanceTo(w) < 1e-10) {
2737
2718
  x = w;
@@ -2740,48 +2721,48 @@ let __tla = (async () => {
2740
2721
  x = w;
2741
2722
  }
2742
2723
  d.push(x.clone()), f.push(m);
2743
- for (let k = 0; k < 3; k++) for (let S = 0; S < 3; S++) {
2744
- const F = [
2724
+ for (let L = 0; L < 3; L++) for (let S = 0; S < 3; S++) {
2725
+ const P = [
2745
2726
  x.x,
2746
2727
  x.y,
2747
2728
  x.z
2748
- ][k], v = [
2729
+ ][L], z = [
2749
2730
  x.x,
2750
2731
  x.y,
2751
2732
  x.z
2752
2733
  ][S];
2753
- u[k][S] -= m * F * v;
2734
+ u[L][S] -= m * P * z;
2754
2735
  }
2755
2736
  }
2756
- const h = new M();
2737
+ const h = new F();
2757
2738
  for (let p = 0; p < n; p++) h.x += r.getX(p), h.y += r.getY(p), h.z += r.getZ(p);
2758
2739
  h.divideScalar(n);
2759
- const z = [
2740
+ const A = [
2760
2741
  0,
2761
2742
  0,
2762
2743
  0
2763
2744
  ];
2764
2745
  for (let p = 0; p < 3; p++) {
2765
2746
  let x = 1 / 0, m = -1 / 0;
2766
- const k = d[p];
2747
+ const L = d[p];
2767
2748
  for (let S = 0; S < n; S++) {
2768
- const F = r.getX(S) - h.x, v = r.getY(S) - h.y, w = r.getZ(S) - h.z, A = F * k.x + v * k.y + w * k.z;
2769
- A < x && (x = A), A > m && (m = A);
2749
+ const P = r.getX(S) - h.x, z = r.getY(S) - h.y, w = r.getZ(S) - h.z, C = P * L.x + z * L.y + w * L.z;
2750
+ C < x && (x = C), C > m && (m = C);
2770
2751
  }
2771
- z[p] = (m - x) / 2;
2752
+ A[p] = (m - x) / 2;
2772
2753
  }
2773
2754
  return {
2774
2755
  axes: d,
2775
2756
  eigenvalues: f,
2776
2757
  center: h,
2777
- halfExtents: z
2758
+ halfExtents: A
2778
2759
  };
2779
2760
  }
2780
2761
  function lr({ pca: t }) {
2781
2762
  return i("group", {
2782
2763
  children: t.axes.map((r, n) => {
2783
2764
  const o = t.center.clone().addScaledVector(r, t.halfExtents[n]), s = t.center.clone().addScaledVector(r, -t.halfExtents[n]);
2784
- return i(fe, {
2765
+ return i(de, {
2785
2766
  points: [
2786
2767
  s,
2787
2768
  o
@@ -2853,7 +2834,7 @@ let __tla = (async () => {
2853
2834
  t
2854
2835
  ]);
2855
2836
  return i("group", {
2856
- children: r.map((n, o) => i(fe, {
2837
+ children: r.map((n, o) => i(de, {
2857
2838
  points: n,
2858
2839
  color: "#ffaa00",
2859
2840
  lineWidth: 1,
@@ -2863,18 +2844,18 @@ let __tla = (async () => {
2863
2844
  });
2864
2845
  }
2865
2846
  function cr({ redPoint: t, greenPoint: r }) {
2866
- const n = V(() => new M().subVectors(r, t).normalize(), [
2847
+ const n = V(() => new F().subVectors(r, t).normalize(), [
2867
2848
  t,
2868
2849
  r
2869
2850
  ]), o = V(() => {
2870
- const l = n.dot(new M(0, 1, 0));
2851
+ const l = n.dot(new F(0, 1, 0));
2871
2852
  return Math.acos(Math.min(1, Math.abs(l))) * 180 / Math.PI;
2872
2853
  }, [
2873
2854
  n
2874
2855
  ]), s = o < 1 ? "#44ff44" : o < 5 ? "#ffcc00" : "#ff4444";
2875
- return C("group", {
2856
+ return M("group", {
2876
2857
  children: [
2877
- i(fe, {
2858
+ i(de, {
2878
2859
  points: [
2879
2860
  t,
2880
2861
  r
@@ -2882,7 +2863,7 @@ let __tla = (async () => {
2882
2863
  color: s,
2883
2864
  lineWidth: 3
2884
2865
  }),
2885
- C("mesh", {
2866
+ M("mesh", {
2886
2867
  position: t,
2887
2868
  children: [
2888
2869
  i("sphereGeometry", {
@@ -2897,7 +2878,7 @@ let __tla = (async () => {
2897
2878
  })
2898
2879
  ]
2899
2880
  }),
2900
- C("mesh", {
2881
+ M("mesh", {
2901
2882
  position: r,
2902
2883
  children: [
2903
2884
  i("sphereGeometry", {
@@ -2919,16 +2900,16 @@ let __tla = (async () => {
2919
2900
  const l = o * 0.15, c = V(() => {
2920
2901
  const a = [];
2921
2902
  let e = n - 10;
2922
- const g = new M(0, 1, 0);
2903
+ const g = new F(0, 1, 0);
2923
2904
  for (; e > r; ) {
2924
- const d = Math.min(e, n), f = Math.max(e, n), u = _n(t, d, f);
2905
+ const d = Math.min(e, n), f = Math.max(e, n), u = Ln(t, d, f);
2925
2906
  if (u) {
2926
- const h = u.dot(g), z = Math.acos(Math.min(1, Math.abs(h))) * 180 / Math.PI;
2907
+ const h = u.dot(g), A = Math.acos(Math.min(1, Math.abs(h))) * 180 / Math.PI;
2927
2908
  a.push({
2928
2909
  axis: u,
2929
2910
  regionMin: d,
2930
2911
  regionMax: f,
2931
- angleDeg: z
2912
+ angleDeg: A
2932
2913
  });
2933
2914
  }
2934
2915
  e -= 10;
@@ -2941,25 +2922,25 @@ let __tla = (async () => {
2941
2922
  ]);
2942
2923
  return i("group", {
2943
2924
  children: c.map((a, e) => {
2944
- const g = (a.regionMin + a.regionMax) / 2, d = new M(0, g, 0), f = d.clone().addScaledVector(a.axis, l), u = d.clone().addScaledVector(a.axis, -l), h = e / Math.max(1, c.length - 1), z = a.angleDeg < 0.5 ? `hsl(${120 - h * 120}, 80%, 60%)` : `hsl(${40 - a.angleDeg * 2}, 90%, 55%)`;
2945
- return C("group", {
2925
+ const g = (a.regionMin + a.regionMax) / 2, d = new F(0, g, 0), f = d.clone().addScaledVector(a.axis, l), u = d.clone().addScaledVector(a.axis, -l), h = e / Math.max(1, c.length - 1), A = a.angleDeg < 0.5 ? `hsl(${120 - h * 120}, 80%, 60%)` : `hsl(${40 - a.angleDeg * 2}, 90%, 55%)`;
2926
+ return M("group", {
2946
2927
  children: [
2947
- i(fe, {
2928
+ i(de, {
2948
2929
  points: [
2949
2930
  u,
2950
2931
  f
2951
2932
  ],
2952
- color: z,
2933
+ color: A,
2953
2934
  lineWidth: 1.5,
2954
2935
  transparent: true,
2955
2936
  opacity: 0.7
2956
2937
  }),
2957
- i(fe, {
2938
+ i(de, {
2958
2939
  points: [
2959
- new M(-l * 0.3, a.regionMin, 0),
2960
- new M(l * 0.3, a.regionMin, 0)
2940
+ new F(-l * 0.3, a.regionMin, 0),
2941
+ new F(l * 0.3, a.regionMin, 0)
2961
2942
  ],
2962
- color: z,
2943
+ color: A,
2963
2944
  lineWidth: 0.5,
2964
2945
  transparent: true,
2965
2946
  opacity: 0.3
@@ -2971,9 +2952,9 @@ let __tla = (async () => {
2971
2952
  }
2972
2953
  function fr({ geometry: t, redY: r, greenY: n, modelSize: o }) {
2973
2954
  const s = V(() => {
2974
- const f = _n(t, r, n);
2955
+ const f = Ln(t, r, n);
2975
2956
  if (!f) return null;
2976
- const u = f.dot(new M(0, 1, 0)), h = Math.acos(Math.min(1, Math.abs(u))) * 180 / Math.PI;
2957
+ const u = f.dot(new F(0, 1, 0)), h = Math.acos(Math.min(1, Math.abs(u))) * 180 / Math.PI;
2977
2958
  return {
2978
2959
  axis: f,
2979
2960
  angleDeg: h
@@ -2984,9 +2965,9 @@ let __tla = (async () => {
2984
2965
  n
2985
2966
  ]);
2986
2967
  if (!s) return null;
2987
- const l = (r + n) / 2, c = new M(0, l, 0), a = o * 0.4, e = c.clone().addScaledVector(s.axis, a), g = c.clone().addScaledVector(s.axis, -a), d = s.angleDeg < 0.5 ? "#00ffff" : s.angleDeg < 2 ? "#ffcc00" : "#ff6600";
2968
+ const l = (r + n) / 2, c = new F(0, l, 0), a = o * 0.4, e = c.clone().addScaledVector(s.axis, a), g = c.clone().addScaledVector(s.axis, -a), d = s.angleDeg < 0.5 ? "#00ffff" : s.angleDeg < 2 ? "#ffcc00" : "#ff6600";
2988
2969
  return i("group", {
2989
- children: i(fe, {
2970
+ children: i(de, {
2990
2971
  points: [
2991
2972
  g,
2992
2973
  e
@@ -3001,7 +2982,7 @@ let __tla = (async () => {
3001
2982
  }
3002
2983
  function ur({ pca: t, modelSize: r }) {
3003
2984
  const n = t.axes[0], o = r * 0.6, s = t.center.clone().addScaledVector(n, o), l = t.center.clone().addScaledVector(n, -o);
3004
- return i(fe, {
2985
+ return i(de, {
3005
2986
  points: [
3006
2987
  l,
3007
2988
  s
@@ -3015,22 +2996,22 @@ let __tla = (async () => {
3015
2996
  }
3016
2997
  function pr({ geometry: t, redY: r, greenY: n, modelSize: o, measurementGeometry: s }) {
3017
2998
  const l = V(() => {
3018
- const d = s ?? t, f = Ht(d), u = new M(0, 1, 0), h = 5, p = n + 3 * 25.4, x = [];
2999
+ const d = s ?? t, f = Ot(d), u = new F(0, 1, 0), h = 5, p = n + 3 * 25.4, x = [];
3019
3000
  for (let b = r + h; b < p; b += h) {
3020
- const _ = Po(f, d, new M(0, b, 0), u);
3021
- _ > 0 && x.push({
3001
+ const I = ko(f, d, new F(0, b, 0), u);
3002
+ I > 0 && x.push({
3022
3003
  y: b,
3023
- circ: _
3004
+ circ: I
3024
3005
  });
3025
3006
  }
3026
3007
  if (x.length < 5) return null;
3027
- const m = n - r, k = r + m * 0.3, S = r + m * 0.7, F = x.filter((b) => b.y >= k && b.y <= S);
3028
- if (F.length < 3) return null;
3029
- const v = F.map((b) => b.circ).sort((b, _) => b - _), w = v[Math.floor(v.length / 2)], A = Math.max(...x.map((b) => b.circ));
3008
+ const m = n - r, L = r + m * 0.3, S = r + m * 0.7, P = x.filter((b) => b.y >= L && b.y <= S);
3009
+ if (P.length < 3) return null;
3010
+ const z = P.map((b) => b.circ).sort((b, I) => b - I), w = z[Math.floor(z.length / 2)], C = Math.max(...x.map((b) => b.circ));
3030
3011
  return {
3031
3012
  circumferences: x,
3032
3013
  baseline: w,
3033
- maxCirc: A
3014
+ maxCirc: C
3034
3015
  };
3035
3016
  }, [
3036
3017
  t,
@@ -3039,16 +3020,16 @@ let __tla = (async () => {
3039
3020
  ]);
3040
3021
  if (!l) return null;
3041
3022
  const { circumferences: c, baseline: a, maxCirc: e } = l, g = o * 0.3 / e;
3042
- return C("group", {
3023
+ return M("group", {
3043
3024
  children: [
3044
3025
  c.map(({ y: d, circ: f }, u) => {
3045
- const h = f / a, z = h > 1.6 ? "#ff4444" : h > 1.3 ? "#ffcc00" : "#22cc66", p = f * g;
3046
- return i(fe, {
3026
+ const h = f / a, A = h > 1.6 ? "#ff4444" : h > 1.3 ? "#ffcc00" : "#22cc66", p = f * g;
3027
+ return i(de, {
3047
3028
  points: [
3048
- new M(-p, d, 0),
3049
- new M(p, d, 0)
3029
+ new F(-p, d, 0),
3030
+ new F(p, d, 0)
3050
3031
  ],
3051
- color: z,
3032
+ color: A,
3052
3033
  lineWidth: 1.5,
3053
3034
  transparent: true,
3054
3035
  opacity: 0.6
@@ -3056,12 +3037,12 @@ let __tla = (async () => {
3056
3037
  }),
3057
3038
  (() => {
3058
3039
  const d = a * 1.6 * g, f = c[0].y, u = c[c.length - 1].y;
3059
- return C(We, {
3040
+ return M(We, {
3060
3041
  children: [
3061
- i(fe, {
3042
+ i(de, {
3062
3043
  points: [
3063
- new M(-d, f, 0),
3064
- new M(-d, u, 0)
3044
+ new F(-d, f, 0),
3045
+ new F(-d, u, 0)
3065
3046
  ],
3066
3047
  color: "#ff4444",
3067
3048
  lineWidth: 1,
@@ -3071,10 +3052,10 @@ let __tla = (async () => {
3071
3052
  transparent: true,
3072
3053
  opacity: 0.4
3073
3054
  }),
3074
- i(fe, {
3055
+ i(de, {
3075
3056
  points: [
3076
- new M(d, f, 0),
3077
- new M(d, u, 0)
3057
+ new F(d, f, 0),
3058
+ new F(d, u, 0)
3078
3059
  ],
3079
3060
  color: "#ff4444",
3080
3061
  lineWidth: 1,
@@ -3095,8 +3076,8 @@ let __tla = (async () => {
3095
3076
  children: t.geometries.map((r, n) => {
3096
3077
  const o = t.colors[n] ?? "#888888", s = n === t.innerIdx;
3097
3078
  r.computeBoundingBox();
3098
- const l = new M();
3099
- return r.boundingBox.getCenter(l), C("group", {
3079
+ const l = new F();
3080
+ return r.boundingBox.getCenter(l), M("group", {
3100
3081
  children: [
3101
3082
  i("mesh", {
3102
3083
  geometry: r,
@@ -3105,7 +3086,7 @@ let __tla = (async () => {
3105
3086
  color: o,
3106
3087
  transparent: true,
3107
3088
  opacity: s ? 0.5 : 0.2,
3108
- side: H.DoubleSide,
3089
+ side: O.DoubleSide,
3109
3090
  depthWrite: false,
3110
3091
  polygonOffset: true,
3111
3092
  polygonOffsetFactor: 1,
@@ -3160,11 +3141,11 @@ let __tla = (async () => {
3160
3141
  for (let e = 0; e < l && e * 3 + 2 < c; e++) {
3161
3142
  const g = r[e], d = g, f = g < 0.5 ? 0.8 - g * 1.2 : 0.2 * (1 - g), u = 1 - g;
3162
3143
  for (let h = 0; h < 3; h++) {
3163
- const z = (e * 3 + h) * 3;
3164
- a[z] = d, a[z + 1] = f, a[z + 2] = u;
3144
+ const A = (e * 3 + h) * 3;
3145
+ a[A] = d, a[A + 1] = f, a[A + 2] = u;
3165
3146
  }
3166
3147
  }
3167
- return o.setAttribute("color", new H.Float32BufferAttribute(a, 3)), o;
3148
+ return o.setAttribute("color", new O.Float32BufferAttribute(a, 3)), o;
3168
3149
  }, [
3169
3150
  t,
3170
3151
  r
@@ -3178,21 +3159,21 @@ let __tla = (async () => {
3178
3159
  vertexColors: true,
3179
3160
  transparent: true,
3180
3161
  opacity: 0.85,
3181
- side: H.DoubleSide,
3162
+ side: O.DoubleSide,
3182
3163
  depthWrite: false
3183
3164
  })
3184
3165
  });
3185
3166
  }
3186
3167
  function mr({ mesh: t, layers: r, landmarkPoints: n, componentDebug: o, aoData: s, aoGeometry: l, measurementGeometry: c }) {
3187
- const a = t.geometry, e = V(() => a.getAttribute("position") ? In(a) : null, [
3168
+ const a = t.geometry, e = V(() => a.getAttribute("position") ? _n(a) : null, [
3188
3169
  a
3189
3170
  ]), g = V(() => !n || n.length < 2 ? null : {
3190
- red: new M(n[1].position.x, n[1].position.y, n[1].position.z),
3191
- green: new M(n[0].position.x, n[0].position.y, n[0].position.z)
3171
+ red: new F(n[1].position.x, n[1].position.y, n[1].position.z),
3172
+ green: new F(n[0].position.x, n[0].position.y, n[0].position.z)
3192
3173
  }, [
3193
3174
  n
3194
3175
  ]);
3195
- return C("group", {
3176
+ return M("group", {
3196
3177
  children: [
3197
3178
  r.pcaAxes && e && i(lr, {
3198
3179
  pca: e
@@ -3251,7 +3232,7 @@ let __tla = (async () => {
3251
3232
  function xr({ mesh: t }) {
3252
3233
  const r = t.geometry, n = V(() => {
3253
3234
  if (!r.getAttribute("position")) return null;
3254
- const l = In(r), c = l.axes[0], a = l.halfExtents[0] * 1.3;
3235
+ const l = _n(r), c = l.axes[0], a = l.halfExtents[0] * 1.3;
3255
3236
  return {
3256
3237
  axis: c,
3257
3238
  center: l.center,
@@ -3262,7 +3243,7 @@ let __tla = (async () => {
3262
3243
  ]);
3263
3244
  if (!n) return null;
3264
3245
  const o = n.center.clone().addScaledVector(n.axis, n.halfLen), s = n.center.clone().addScaledVector(n.axis, -n.halfLen);
3265
- return i(fe, {
3246
+ return i(de, {
3266
3247
  points: [
3267
3248
  s,
3268
3249
  o
@@ -3278,7 +3259,7 @@ let __tla = (async () => {
3278
3259
  renderOrder: 999
3279
3260
  });
3280
3261
  }
3281
- const Dn = [
3262
+ const In = [
3282
3263
  {
3283
3264
  key: "pcaAxes",
3284
3265
  label: "PCA Axes (full mesh)",
@@ -3335,10 +3316,10 @@ let __tla = (async () => {
3335
3316
  group: "Alignment"
3336
3317
  }
3337
3318
  ], br = [
3338
- ...new Set(Dn.map((t) => t.group))
3319
+ ...new Set(In.map((t) => t.group))
3339
3320
  ];
3340
3321
  function yr({ layers: t, onToggleLayer: r, isDoubleShell: n }) {
3341
- return C("div", {
3322
+ return M("div", {
3342
3323
  style: {
3343
3324
  position: "absolute",
3344
3325
  top: 16,
@@ -3367,8 +3348,8 @@ let __tla = (async () => {
3367
3348
  children: "Debug Layers"
3368
3349
  }),
3369
3350
  br.map((o) => {
3370
- const s = Dn.filter((l) => l.group === o && !(l.hideWhenDoubleShell && n));
3371
- return s.length === 0 ? null : C("div", {
3351
+ const s = In.filter((l) => l.group === o && !(l.hideWhenDoubleShell && n));
3352
+ return s.length === 0 ? null : M("div", {
3372
3353
  children: [
3373
3354
  i("div", {
3374
3355
  style: {
@@ -3382,7 +3363,7 @@ let __tla = (async () => {
3382
3363
  },
3383
3364
  children: o
3384
3365
  }),
3385
- s.map(({ key: l, label: c, color: a }) => C("label", {
3366
+ s.map(({ key: l, label: c, color: a }) => M("label", {
3386
3367
  style: {
3387
3368
  display: "flex",
3388
3369
  alignItems: "center",
@@ -3428,19 +3409,19 @@ let __tla = (async () => {
3428
3409
  });
3429
3410
  }
3430
3411
  const wr = ({ config: t, spacingType: r, scanUrl: n, formMeasurements: o, onComplete: s, isDebugUser: l = false, onAnalyticsEvent: c, wasmModule: a }) => {
3431
- const [e, g] = B(null), [d, f] = B(0), [u, h] = B(false), [z, p] = B(false), [x, m] = B(""), [k, S] = B("3D"), [F, v] = B(r === "AK" ? 2 : 1), [w, A] = B(false), [b, _] = B(null), [L, I] = B(r ?? null), [R, P] = B("mm"), [E, T] = B(false), [Y, ae] = B(""), [ce, ue] = B(false), [re, ee] = B(false), [Z, pe] = B(false), [K, he] = B(false), [xe, ge] = B(null), [j, ne] = B(null), [be, we] = B(null), [ye, oe] = B(false), [X, G] = B([]), [Pe, Fe] = B(null), [Ve, ie] = B(null), [Ae, St] = B(null), [vt, jt] = B(null), [Wn, Vt] = B(false), [Ct, Xt] = B(null), [zt, Le] = B(null), [De, Bn] = B(false), [Gt, En] = B(ir), [$e, Yt] = B("obj"), [Se, Mt] = B(o), [Ye, At] = B(true), [Ze, tt] = B(false), [nt, Zt] = B(false), [ze, ot] = B(false), [$n, Ft] = B(false), [Te, Tn] = B(null), [On, Hn] = B(void 0), [Nn, jn] = B(void 0), [Kt] = B("#c8c8c8"), [Vn] = B(1), [Be, Xn] = B(false), [kt, Ut] = B([]), rt = le(null), Oe = le(null), it = le(false), Gn = le(null), Pt = le(null), Lt = le(null), Ke = Q(async () => {
3412
+ const [e, g] = B(null), [d, f] = B(0), [u, h] = B(false), [A, p] = B(false), [x, m] = B(""), [L, S] = B("3D"), [P, z] = B(r === "AK" ? 2 : 1), [w, C] = B(false), [b, I] = B(null), [_, v] = B(r ?? null), [k, R] = B("mm"), [T, N] = B(false), [Q, be] = B(""), [ae, fe] = B(false), [re, ee] = B(false), [Y, ue] = B(false), [Z, pe] = B(false), [me, he] = B(null), [j, ne] = B(null), [xe, we] = B(null), [ye, oe] = B(false), [X, G] = B([]), [Pe, Fe] = B(null), [Ve, ie] = B(null), [Ae, St] = B(null), [vt, Nt] = B(null), [Rn, jt] = B(false), [Ct, Vt] = B(null), [zt, Le] = B(null), [De, Wn] = B(false), [Xt, Bn] = B(ir), [$e, Gt] = B("obj"), [Se, Mt] = B(o), [Ye, At] = B(true), [Ze, tt] = B(false), [nt, Yt] = B(false), [ze, ot] = B(false), [En, Ft] = B(false), [Te, $n] = B(null), [Tn, On] = B(void 0), [Hn, Nn] = B(void 0), [Zt] = B("#c8c8c8"), [jn] = B(1), [Be, Vn] = B(false), [kt, Kt] = B([]), rt = le(null), Oe = le(null), it = le(false), Xn = le(null), Pt = le(null), Lt = le(null), Ke = J(async () => {
3432
3413
  if (Lt.current) try {
3433
3414
  const y = Lt.current, D = () => {
3434
- const J = y.querySelector("canvas");
3435
- if (!J) return;
3436
- const N = y.getBoundingClientRect(), me = J.width, Ce = J.height, te = me / N.width, Me = Ce / N.height, Re = document.createElement("canvas");
3437
- Re.width = me, Re.height = Ce;
3415
+ const q = y.querySelector("canvas");
3416
+ if (!q) return;
3417
+ const H = y.getBoundingClientRect(), ge = q.width, Ce = q.height, te = ge / H.width, Me = Ce / H.height, Re = document.createElement("canvas");
3418
+ Re.width = ge, Re.height = Ce;
3438
3419
  const se = Re.getContext("2d");
3439
- return se.drawImage(J, 0, 0), y.querySelectorAll("[style*='pointer-events']").forEach((_e) => {
3440
- const on = _e;
3441
- if (on.hasAttribute("data-finalizing-overlay")) return;
3442
- const rn = on.querySelectorAll("div[style*='background']");
3443
- rn.length !== 0 && rn.forEach((Xe) => {
3420
+ return se.drawImage(q, 0, 0), y.querySelectorAll("[style*='pointer-events']").forEach((_e) => {
3421
+ const nn = _e;
3422
+ if (nn.hasAttribute("data-finalizing-overlay")) return;
3423
+ const on = nn.querySelectorAll("div[style*='background']");
3424
+ on.length !== 0 && on.forEach((Xe) => {
3444
3425
  var _a;
3445
3426
  const Ie = Xe.getBoundingClientRect();
3446
3427
  if (Ie.width === 0 || Ie.height === 0) return;
@@ -3453,168 +3434,168 @@ let __tla = (async () => {
3453
3434
  }
3454
3435
  Qe = Qe.parentElement;
3455
3436
  }
3456
- const sn = (Ie.left + Ie.width / 2 - N.left) * te, ln = (Ie.top + Ie.height / 2 - N.top) * Me, ct = Math.abs(Wt) > 1, an = (ct ? Ie.height : Ie.width) * te, cn = (ct ? Ie.width : Ie.height) * Me;
3457
- se.save(), se.translate(sn, ln), ct && se.rotate(Wt * Math.PI / 180);
3458
- const ro = Xe.style.backgroundColor || "rgba(0,0,0,0.75)";
3459
- se.fillStyle = ro;
3460
- const io = 4 * te;
3461
- se.beginPath(), se.roundRect(-an / 2, -cn / 2, an, cn, io), se.fill();
3462
- const dn = ((_a = Xe.textContent) == null ? void 0 : _a.trim()) || "";
3463
- if (dn) {
3437
+ const rn = (Ie.left + Ie.width / 2 - H.left) * te, sn = (Ie.top + Ie.height / 2 - H.top) * Me, ct = Math.abs(Wt) > 1, ln = (ct ? Ie.height : Ie.width) * te, an = (ct ? Ie.width : Ie.height) * Me;
3438
+ se.save(), se.translate(rn, sn), ct && se.rotate(Wt * Math.PI / 180);
3439
+ const oo = Xe.style.backgroundColor || "rgba(0,0,0,0.75)";
3440
+ se.fillStyle = oo;
3441
+ const ro = 4 * te;
3442
+ se.beginPath(), se.roundRect(-ln / 2, -an / 2, ln, an, ro), se.fill();
3443
+ const cn = ((_a = Xe.textContent) == null ? void 0 : _a.trim()) || "";
3444
+ if (cn) {
3464
3445
  const dt = window.getComputedStyle(Xe), ft = parseFloat(dt.fontSize || "14") * Me;
3465
3446
  se.font = `${dt.fontWeight || "normal"} ${ft}px monospace`, se.fillStyle = dt.color || "#fff", se.textAlign = "center", se.textBaseline = "middle";
3466
- const fn = Xe.querySelectorAll("span");
3467
- fn.length > 0 && !ct ? fn.forEach((Bt) => {
3447
+ const dn = Xe.querySelectorAll("span");
3448
+ dn.length > 0 && !ct ? dn.forEach((Bt) => {
3468
3449
  const et = Bt.getBoundingClientRect();
3469
3450
  if (et.width === 0) return;
3470
- const so = (et.left + et.width / 2 - N.left) * te - sn, lo = (et.top + et.height / 2 - N.top) * Me - ln, Et = window.getComputedStyle(Bt), ao = parseFloat(Et.fontSize) * Me;
3471
- se.font = `${Et.fontWeight || "normal"} ${ao}px monospace`, se.fillStyle = Et.color || "#fff", se.fillText(Bt.textContent || "", so, lo);
3472
- }) : se.fillText(dn, 0, 0);
3451
+ const io = (et.left + et.width / 2 - H.left) * te - rn, so = (et.top + et.height / 2 - H.top) * Me - sn, Et = window.getComputedStyle(Bt), lo = parseFloat(Et.fontSize) * Me;
3452
+ se.font = `${Et.fontWeight || "normal"} ${lo}px monospace`, se.fillStyle = Et.color || "#fff", se.fillText(Bt.textContent || "", io, so);
3453
+ }) : se.fillText(cn, 0, 0);
3473
3454
  }
3474
3455
  se.restore();
3475
3456
  });
3476
3457
  }), Re.toDataURL("image/png");
3477
3458
  };
3478
- Pt.current && Pt.current(), await new Promise((J) => requestAnimationFrame(() => requestAnimationFrame(J)));
3479
- const $ = D();
3480
- S("2D"), await new Promise((J) => setTimeout(J, 150)), await new Promise((J) => requestAnimationFrame(() => requestAnimationFrame(J)));
3459
+ Pt.current && Pt.current(), await new Promise((q) => requestAnimationFrame(() => requestAnimationFrame(q)));
3460
+ const E = D();
3461
+ S("2D"), await new Promise((q) => setTimeout(q, 150)), await new Promise((q) => requestAnimationFrame(() => requestAnimationFrame(q)));
3481
3462
  const W = D();
3482
- return S("3D"), !$ || !W ? void 0 : {
3483
- frontal_view_png: $,
3463
+ return S("3D"), !E || !W ? void 0 : {
3464
+ frontal_view_png: E,
3484
3465
  side_view_png: W
3485
3466
  };
3486
3467
  } catch {
3487
3468
  return;
3488
3469
  }
3489
- }, []), ve = Q((y) => {
3490
- const D = /* @__PURE__ */ new Date(), $ = `${String(D.getHours()).padStart(2, "0")}:${String(D.getMinutes()).padStart(2, "0")}:${String(D.getSeconds()).padStart(2, "0")}.${String(D.getMilliseconds()).padStart(3, "0")}`;
3491
- Ut((W) => [
3470
+ }, []), ve = J((y) => {
3471
+ const D = /* @__PURE__ */ new Date(), E = `${String(D.getHours()).padStart(2, "0")}:${String(D.getMinutes()).padStart(2, "0")}:${String(D.getSeconds()).padStart(2, "0")}.${String(D.getMilliseconds()).padStart(3, "0")}`;
3472
+ Kt((W) => [
3492
3473
  ...W.slice(-200),
3493
- `[${$}] ${y}`
3474
+ `[${E}] ${y}`
3494
3475
  ]);
3495
- }, []), { landmarkPoints: O, clearLandmarkPoints: Yn, addLandmarkPoint: qt, removeLandmarkPoint: Jt, updateLandmarkPositions: Qt, setAligned: en, isAligned: U, setCut: tn, isCut: _t, reset: st } = Nt();
3496
- q(() => {
3476
+ }, []), { landmarkPoints: $, clearLandmarkPoints: Gn, addLandmarkPoint: Ut, removeLandmarkPoint: qt, updateLandmarkPositions: Jt, setAligned: Qt, isAligned: K, setCut: en, isCut: _t, reset: st } = Ht();
3477
+ U(() => {
3497
3478
  st();
3498
3479
  }, [
3499
3480
  st
3500
3481
  ]);
3501
- const lt = F * mt;
3502
- q(() => {
3503
- if (!l || O.length === 0) return;
3504
- const y = O[O.length - 1];
3505
- ve(`LANDMARK[${O.length - 1}]: placed at (${y.position.x.toFixed(1)}, ${y.position.y.toFixed(1)}, ${y.position.z.toFixed(1)}) face=${y.faceIndex}`);
3482
+ const lt = P * mt;
3483
+ U(() => {
3484
+ if (!l || $.length === 0) return;
3485
+ const y = $[$.length - 1];
3486
+ ve(`LANDMARK[${$.length - 1}]: placed at (${y.position.x.toFixed(1)}, ${y.position.y.toFixed(1)}, ${y.position.z.toFixed(1)}) face=${y.faceIndex}`);
3506
3487
  }, [
3507
- O.length,
3488
+ $.length,
3508
3489
  l,
3509
3490
  ve
3510
- ]), q(() => {
3511
- l && U && ve("STATE: mesh aligned");
3491
+ ]), U(() => {
3492
+ l && K && ve("STATE: mesh aligned");
3512
3493
  }, [
3513
- U,
3494
+ K,
3514
3495
  l,
3515
3496
  ve
3516
- ]), q(() => {
3497
+ ]), U(() => {
3517
3498
  l && _t && ve("STATE: mesh cut");
3518
3499
  }, [
3519
3500
  _t,
3520
3501
  l,
3521
3502
  ve
3522
- ]), q(() => {
3503
+ ]), U(() => {
3523
3504
  rt.current && (rt.current.scrollTop = rt.current.scrollHeight);
3524
3505
  }, [
3525
3506
  kt
3526
3507
  ]);
3527
- const He = V(() => be ? new H.Mesh(be) : null, [
3528
- be
3508
+ const He = V(() => xe ? new O.Mesh(xe) : null, [
3509
+ xe
3529
3510
  ]);
3530
- q(() => {
3511
+ U(() => {
3531
3512
  o && Mt(o);
3532
3513
  }, [
3533
3514
  o
3534
- ]), q(() => {
3515
+ ]), U(() => {
3535
3516
  o || Mt(void 0);
3536
3517
  }, [
3537
- F
3518
+ P
3538
3519
  ]);
3539
3520
  const at = le(false);
3540
- q(() => {
3541
- if (!U || X.length === 0 || at.current || !c) return;
3521
+ U(() => {
3522
+ if (!K || X.length === 0 || at.current || !c) return;
3542
3523
  at.current = true;
3543
- const y = O.length >= 3 ? Math.abs(O[2].position.y - O[0].position.y) : null;
3524
+ const y = $.length >= 3 ? Math.abs($[2].position.y - $[0].position.y) : null;
3544
3525
  c("dimensions_calculated", {
3545
- spacing_type: L,
3526
+ spacing_type: _,
3546
3527
  source_unit: "mm",
3547
3528
  file_format: $e,
3548
3529
  measurement_source: "scan_derived",
3549
- is_double_wall: Z,
3530
+ is_double_wall: Y,
3550
3531
  is_unit_converted: false,
3551
3532
  form_measurements: (Se == null ? void 0 : Se.filter((D) => D != null)) ?? null,
3552
3533
  scan_measurements: X.map((D) => +(D.modifiedValue ?? D.originalValue).toFixed(1)),
3553
- measurement_variance: Se ? X.map((D, $) => {
3554
- const W = Se[$];
3534
+ measurement_variance: Se ? X.map((D, E) => {
3535
+ const W = Se[E];
3555
3536
  return W == null ? null : +((D.modifiedValue ?? D.originalValue) - W).toFixed(1);
3556
3537
  }) : null,
3557
3538
  frontal_height: y !== null ? +y.toFixed(1) : null
3558
3539
  });
3559
3540
  }, [
3560
- U,
3541
+ K,
3561
3542
  X
3562
- ]), q(() => {
3563
- a !== void 0 && (Oe.current = a), a !== void 0 && Xn(true);
3543
+ ]), U(() => {
3544
+ a !== void 0 && (Oe.current = a), a !== void 0 && Vn(true);
3564
3545
  }, [
3565
3546
  a
3566
3547
  ]);
3567
- const Ue = Q((y, D) => {
3548
+ const Ue = J((y, D) => {
3568
3549
  y.computeBoundingBox();
3569
- const $ = y.boundingBox, W = new M();
3570
- $.getCenter(W), y.translate(-W.x, -W.y, -W.z), y.computeBoundingBox();
3571
- const J = y.boundingBox, N = new M();
3572
- J.getSize(N), f(Math.max(N.x, N.y, N.z));
3573
- const me = new H.Mesh(y, new H.MeshStandardMaterial({
3550
+ const E = y.boundingBox, W = new F();
3551
+ E.getCenter(W), y.translate(-W.x, -W.y, -W.z), y.computeBoundingBox();
3552
+ const q = y.boundingBox, H = new F();
3553
+ q.getSize(H), f(Math.max(H.x, H.y, H.z));
3554
+ const ge = new O.Mesh(y, new O.MeshStandardMaterial({
3574
3555
  color: 8947848,
3575
- side: H.DoubleSide
3556
+ side: O.DoubleSide
3576
3557
  }));
3577
- g(me), ue(D), ee(true), he(false), it.current = false;
3578
- }, []), Ee = Q(async (y, D) => {
3558
+ g(ge), fe(D), ee(true), pe(false), it.current = false;
3559
+ }, []), Ee = J(async (y, D) => {
3579
3560
  Le(null);
3580
- const $ = D.toLowerCase(), W = $.endsWith(".stl");
3581
- if (!$.endsWith(".obj") && !W) {
3561
+ const E = D.toLowerCase(), W = E.endsWith(".stl");
3562
+ if (!E.endsWith(".obj") && !W) {
3582
3563
  Le("Unsupported file format. Please use OBJ or STL.");
3583
3564
  return;
3584
3565
  }
3585
- Yt(W ? "stl" : "obj"), p(true), m("Processing file..."), ve(`FILE_LOAD: ${D} (${W ? "STL" : "OBJ"})`);
3566
+ Gt(W ? "stl" : "obj"), p(true), m("Processing file..."), ve(`FILE_LOAD: ${D} (${W ? "STL" : "OBJ"})`);
3586
3567
  try {
3587
- let N;
3568
+ let H;
3588
3569
  if (W) if (m("Converting STL..."), y instanceof ArrayBuffer) {
3589
3570
  const te = new Blob([
3590
3571
  y
3591
3572
  ]), Me = new File([
3592
3573
  te
3593
3574
  ], D);
3594
- N = await $t(Me);
3575
+ H = await $t(Me);
3595
3576
  } else {
3596
3577
  const te = new Blob([
3597
3578
  y
3598
3579
  ]), Me = new File([
3599
3580
  te
3600
3581
  ], D);
3601
- N = await $t(Me);
3582
+ H = await $t(Me);
3602
3583
  }
3603
- else N = typeof y == "string" ? y : new TextDecoder().decode(y);
3604
- const me = performance.now(), Ce = Oe.current ? await Mo(N, Oe.current, (te) => {
3584
+ else H = typeof y == "string" ? y : new TextDecoder().decode(y);
3585
+ const ge = performance.now(), Ce = Oe.current ? await zo(H, Oe.current, (te) => {
3605
3586
  m(te), ve(`PREPROCESS: ${te}`);
3606
3587
  }) : null;
3607
- if (Ce) ve(`PREPROCESS: done in ${(performance.now() - me).toFixed(0)}ms \u2014 unit=${Ce.detectedUnit}, scaled=${Ce.wasScaled}`), t.showAmputationModal && !r ? (_(Ce), A(true)) : Ue(Ce.geometry, Ce.wasScaled);
3588
+ if (Ce) ve(`PREPROCESS: done in ${(performance.now() - ge).toFixed(0)}ms \u2014 unit=${Ce.detectedUnit}, scaled=${Ce.wasScaled}`), t.showAmputationModal && !r ? (I(Ce), C(true)) : Ue(Ce.geometry, Ce.wasScaled);
3608
3589
  else {
3609
3590
  m("Using fallback loader...");
3610
- const te = Ao(N);
3611
- te ? t.showAmputationModal && !r ? (_({
3591
+ const te = Mo(H);
3592
+ te ? t.showAmputationModal && !r ? (I({
3612
3593
  geometry: te,
3613
3594
  wasScaled: false
3614
- }), A(true)) : Ue(te, false) : Le("Failed to parse the mesh.");
3595
+ }), C(true)) : Ue(te, false) : Le("Failed to parse the mesh.");
3615
3596
  }
3616
- } catch (N) {
3617
- Le(N instanceof Error ? N.message : "Failed to process the mesh file.");
3597
+ } catch (H) {
3598
+ Le(H instanceof Error ? H.message : "Failed to process the mesh file.");
3618
3599
  } finally {
3619
3600
  p(false), m("");
3620
3601
  }
@@ -3624,7 +3605,7 @@ let __tla = (async () => {
3624
3605
  r,
3625
3606
  Ue
3626
3607
  ]);
3627
- q(() => {
3608
+ U(() => {
3628
3609
  if (!n || !Be) return;
3629
3610
  (async () => {
3630
3611
  p(true), m("Loading scan...");
@@ -3633,11 +3614,11 @@ let __tla = (async () => {
3633
3614
  if (!D.ok) throw new Error(`Failed to download scan: ${D.status}`);
3634
3615
  const W = new URL(n).pathname.split("/").pop() || "scan.obj";
3635
3616
  if (W.toLowerCase().endsWith(".stl")) {
3636
- const N = await D.arrayBuffer();
3637
- await Ee(N, W);
3617
+ const H = await D.arrayBuffer();
3618
+ await Ee(H, W);
3638
3619
  } else {
3639
- const N = await D.text();
3640
- await Ee(N, W);
3620
+ const H = await D.text();
3621
+ await Ee(H, W);
3641
3622
  }
3642
3623
  } catch (D) {
3643
3624
  Le(D instanceof Error ? D.message : "Failed to load scan from URL."), p(false), m("");
@@ -3647,24 +3628,24 @@ let __tla = (async () => {
3647
3628
  n,
3648
3629
  Be
3649
3630
  ]);
3650
- const Zn = Q((y) => {
3631
+ const Yn = J((y) => {
3651
3632
  y.preventDefault(), h(true);
3652
- }, []), Kn = Q((y) => {
3633
+ }, []), Zn = J((y) => {
3653
3634
  y.preventDefault(), h(false);
3654
- }, []), Un = Q(async (y) => {
3635
+ }, []), Kn = J(async (y) => {
3655
3636
  if (y.preventDefault(), h(false), !Be) {
3656
3637
  Le("WASM module is still loading. Please wait.");
3657
3638
  return;
3658
3639
  }
3659
3640
  const D = y.dataTransfer.files[0];
3660
3641
  if (!D) return;
3661
- const $ = D.name.toLowerCase();
3662
- if (!$.endsWith(".obj") && !$.endsWith(".stl")) {
3642
+ const E = D.name.toLowerCase();
3643
+ if (!E.endsWith(".obj") && !E.endsWith(".stl")) {
3663
3644
  Le("Please drop an OBJ or STL file.");
3664
3645
  return;
3665
3646
  }
3666
- if ($.endsWith(".stl")) {
3667
- Yt("stl"), p(true), m("Converting STL...");
3647
+ if (E.endsWith(".stl")) {
3648
+ Gt("stl"), p(true), m("Converting STL...");
3668
3649
  try {
3669
3650
  const W = await $t(D);
3670
3651
  await Ee(W, D.name.replace(/\.stl$/i, ".obj"));
@@ -3678,8 +3659,8 @@ let __tla = (async () => {
3678
3659
  }, [
3679
3660
  Be,
3680
3661
  Ee
3681
- ]), qn = Q((y) => {
3682
- I(y), v(y === "AK" ? 2 : 1), A(false), b && (Ue(b.geometry, b.wasScaled), _(null)), c == null ? void 0 : c("file_loaded", {
3662
+ ]), Un = J((y) => {
3663
+ v(y), z(y === "AK" ? 2 : 1), C(false), b && (Ue(b.geometry, b.wasScaled), I(null)), c == null ? void 0 : c("file_loaded", {
3683
3664
  spacing_type: y,
3684
3665
  file_format: $e,
3685
3666
  is_double_wall: false
@@ -3690,80 +3671,80 @@ let __tla = (async () => {
3690
3671
  c,
3691
3672
  $e
3692
3673
  ]);
3693
- q(() => {
3694
- if (!e || O.length !== 1 || !Oe.current || it.current) return;
3674
+ U(() => {
3675
+ if (!e || $.length !== 1 || !Oe.current || it.current) return;
3695
3676
  it.current = true;
3696
- const y = O[0], D = Oe.current, $ = e.geometry, { positions: W, indices: J } = xt($), N = new Float32Array([
3677
+ const y = $[0], D = Oe.current, E = e.geometry, { positions: W, indices: q } = xt(E), H = new Float32Array([
3697
3678
  y.position.x,
3698
3679
  y.position.y,
3699
3680
  y.position.z
3700
- ]), me = D.detect_shell(W, J, N, 40), Ce = me.details(), te = me.is_double_shell();
3701
- ve(`SHELL_DETECT: ${te ? "DOUBLE" : "SINGLE"} \u2014 ${Ce}`), te && (pe(true), oe(true), ve(`SHELL_DETECT: double shell, thickness=${me.thickness().toFixed(1)}mm`));
3681
+ ]), ge = D.detect_shell(W, q, H, 40), Ce = ge.details(), te = ge.is_double_shell();
3682
+ ve(`SHELL_DETECT: ${te ? "DOUBLE" : "SINGLE"} \u2014 ${Ce}`), te && (ue(true), oe(true), ve(`SHELL_DETECT: double shell, thickness=${ge.thickness().toFixed(1)}mm`));
3702
3683
  }, [
3703
3684
  e,
3704
- O,
3685
+ $,
3705
3686
  ve
3706
3687
  ]);
3707
- const Jn = Q(() => {
3708
- if (!e || O.length < 2) return;
3709
- T(true), ae("Please wait..."), ve("PIPELINE: starting processing pipeline...");
3688
+ const qn = J(() => {
3689
+ if (!e || $.length < 2) return;
3690
+ N(true), be("Please wait..."), ve("PIPELINE: starting processing pipeline...");
3710
3691
  const y = performance.now();
3711
3692
  setTimeout(() => {
3712
3693
  const D = [
3713
- O[1],
3714
- O[0],
3715
- ...O.slice(2)
3694
+ $[1],
3695
+ $[0],
3696
+ ...$.slice(2)
3716
3697
  ];
3717
- _o(e, D, mt, {
3718
- onStatus: ($) => {
3719
- ae($), ve(`PIPELINE: ${$}`);
3698
+ Lo(e, D, mt, {
3699
+ onStatus: (E) => {
3700
+ be(E), ve(`PIPELINE: ${E}`);
3720
3701
  },
3721
- addLandmarkPoint: qt,
3722
- removeLandmarkPoint: Jt,
3723
- updateLandmarkPositions: ($) => {
3702
+ addLandmarkPoint: Ut,
3703
+ removeLandmarkPoint: qt,
3704
+ updateLandmarkPositions: (E) => {
3724
3705
  const W = [
3725
- $[1],
3726
- $[0],
3727
- ...$.slice(2)
3706
+ E[1],
3707
+ E[0],
3708
+ ...E.slice(2)
3728
3709
  ];
3729
- Qt(W);
3710
+ Jt(W);
3730
3711
  },
3731
- setAligned: en,
3732
- setCut: tn,
3712
+ setAligned: Qt,
3713
+ setCut: en,
3733
3714
  setModelSize: f,
3734
- setOriginalEndY: jt,
3715
+ setOriginalEndY: Nt,
3735
3716
  setAdjustedStartY: ie,
3736
3717
  setAdjustedEndY: St,
3737
3718
  setError: Le,
3738
- setDoubleShell: ($) => {
3739
- pe($), oe(true);
3719
+ setDoubleShell: (E) => {
3720
+ ue(E), oe(true);
3740
3721
  },
3741
- setAoData: ($, W) => {
3742
- ge($), ne(W ?? null);
3722
+ setAoData: (E, W) => {
3723
+ he(E), ne(W ?? null);
3743
3724
  },
3744
- setInnerShellExtracted: he,
3725
+ setInnerShellExtracted: pe,
3745
3726
  setMeasurementGeometry: we,
3746
3727
  setWasmSlices: Fe,
3747
3728
  wasmModule: Oe.current ?? void 0
3748
- }), ve(`PIPELINE: completed in ${(performance.now() - y).toFixed(0)}ms`), at.current = false, T(false);
3729
+ }), ve(`PIPELINE: completed in ${(performance.now() - y).toFixed(0)}ms`), at.current = false, N(false);
3749
3730
  }, 50);
3750
3731
  }, [
3751
3732
  e,
3752
- O,
3733
+ $,
3734
+ Jt,
3753
3735
  Qt,
3754
- en,
3736
+ Ut,
3755
3737
  qt,
3756
- Jt,
3757
- tn,
3758
- K
3759
- ]), It = le(false), Qn = Q(async () => {
3760
- if (st(), G([]), Fe(null), we(null), ie(null), St(null), Xt(null), jt(null), tt(false), Zt(false), At(true), pe(false), he(false), it.current = false, It.current = false, at.current = false, S("3D"), n && Be) {
3738
+ en,
3739
+ Z
3740
+ ]), It = le(false), Jn = J(async () => {
3741
+ if (st(), G([]), Fe(null), we(null), ie(null), St(null), Vt(null), Nt(null), tt(false), Yt(false), At(true), ue(false), pe(false), it.current = false, It.current = false, at.current = false, S("3D"), n && Be) {
3761
3742
  g(null);
3762
3743
  try {
3763
3744
  const y = await fetch(n);
3764
3745
  if (!y.ok) throw new Error(`Failed to download scan: ${y.status}`);
3765
- const $ = new URL(n).pathname.split("/").pop() || "scan.obj";
3766
- $.toLowerCase().endsWith(".stl") ? await Ee(await y.arrayBuffer(), $) : await Ee(await y.text(), $);
3746
+ const E = new URL(n).pathname.split("/").pop() || "scan.obj";
3747
+ E.toLowerCase().endsWith(".stl") ? await Ee(await y.arrayBuffer(), E) : await Ee(await y.text(), E);
3767
3748
  } catch (y) {
3768
3749
  Le(y instanceof Error ? y.message : "Failed to reload scan.");
3769
3750
  }
@@ -3774,38 +3755,38 @@ let __tla = (async () => {
3774
3755
  Ee,
3775
3756
  st
3776
3757
  ]);
3777
- q(() => {
3778
- U && X.length > 0 && !It.current && (It.current = true, tt(true));
3758
+ U(() => {
3759
+ K && X.length > 0 && !It.current && (It.current = true, tt(true));
3779
3760
  }, [
3780
- U,
3761
+ K,
3781
3762
  X.length
3782
3763
  ]);
3783
3764
  const qe = V(() => {
3784
3765
  var _a;
3785
- if (!e || O.length < 3) return 0;
3786
- if (Z) return Math.abs(O[0].position.y - O[2].position.y);
3766
+ if (!e || $.length < 3) return 0;
3767
+ if (Y) return Math.abs($[0].position.y - $[2].position.y);
3787
3768
  const y = e.geometry;
3788
3769
  y.computeBoundingBox();
3789
3770
  const D = ((_a = y.boundingBox) == null ? void 0 : _a.min.y) ?? 0;
3790
- return Math.abs(O[0].position.y - D);
3771
+ return Math.abs($[0].position.y - D);
3791
3772
  }, [
3792
3773
  e,
3793
- O,
3794
- Z
3795
- ]), eo = Q((y) => {
3796
- Tn(y), Mt(y.circumferences), At(true), Zt(true);
3797
- }, []), nn = Q(async (y) => {
3774
+ $,
3775
+ Y
3776
+ ]), Qn = J((y) => {
3777
+ $n(y), Mt(y.circumferences), At(true), Yt(true);
3778
+ }, []), tn = J(async (y) => {
3798
3779
  if (!s) return;
3799
3780
  tt(false), Ft(false), ot(true);
3800
3781
  const D = e ? await Ke().catch(() => {
3801
3782
  }) : void 0;
3802
3783
  try {
3803
3784
  s({
3804
- spacingType: L ?? "BK",
3785
+ spacingType: _ ?? "BK",
3805
3786
  sourceUnit: "mm",
3806
3787
  fileFormat: $e,
3807
3788
  measurementSource: "form_provided",
3808
- isDoubleWall: Z,
3789
+ isDoubleWall: Y,
3809
3790
  isUnitConverted: false,
3810
3791
  formMeasurements: Se,
3811
3792
  scanMeasurements: X,
@@ -3824,57 +3805,57 @@ let __tla = (async () => {
3824
3805
  }, [
3825
3806
  s,
3826
3807
  e,
3827
- L,
3808
+ _,
3828
3809
  $e,
3829
- Z,
3810
+ Y,
3830
3811
  Se,
3831
3812
  X,
3832
3813
  qe,
3833
3814
  n,
3834
3815
  Ke
3835
3816
  ]), Dt = le(null);
3836
- q(() => {
3837
- if (!e || !U) {
3817
+ U(() => {
3818
+ if (!e || !K) {
3838
3819
  Dt.current = null;
3839
3820
  return;
3840
3821
  }
3841
3822
  const y = (He ?? e).geometry;
3842
- Dt.current = Ht(y);
3823
+ Dt.current = Ot(y);
3843
3824
  }, [
3844
3825
  e,
3845
- U,
3826
+ K,
3846
3827
  He
3847
3828
  ]);
3848
- const Rt = Q(async (y) => {
3849
- if (!s || !e || X.length === 0 || !L) return;
3829
+ const Rt = J(async (y) => {
3830
+ if (!s || !e || X.length === 0 || !_) return;
3850
3831
  ot(true);
3851
3832
  const D = await Ke().catch(() => {
3852
3833
  });
3853
3834
  try {
3854
- let $ = 0, W = 0;
3855
- if (O.length >= 2) {
3856
- const J = (He ?? e).geometry, me = O[0].position.y;
3835
+ let E = 0, W = 0;
3836
+ if ($.length >= 2) {
3837
+ const q = (He ?? e).geometry, ge = $[0].position.y;
3857
3838
  try {
3858
- const Ce = Dt.current ?? Ht(J), te = Ne(Ce, J, me);
3839
+ const Ce = Dt.current ?? Ot(q), te = Ne(Ce, q, ge);
3859
3840
  if (te.linePoints.length >= 2) {
3860
3841
  let Me = te.linePoints[0], Re = te.linePoints[0], se = te.linePoints[0], Je = te.linePoints[0];
3861
3842
  for (const _e of te.linePoints) _e.x < Me.x && (Me = _e), _e.x > Re.x && (Re = _e), _e.z < se.z && (se = _e), _e.z > Je.z && (Je = _e);
3862
- $ = new M(Me.x, me, Me.z).distanceTo(new M(Re.x, me, Re.z)), W = new M(se.x, me, se.z).distanceTo(new M(Je.x, me, Je.z));
3843
+ E = new F(Me.x, ge, Me.z).distanceTo(new F(Re.x, ge, Re.z)), W = new F(se.x, ge, se.z).distanceTo(new F(Je.x, ge, Je.z));
3863
3844
  }
3864
3845
  } catch {
3865
3846
  }
3866
3847
  }
3867
3848
  s({
3868
- spacingType: L,
3849
+ spacingType: _,
3869
3850
  sourceUnit: "mm",
3870
3851
  fileFormat: $e,
3871
3852
  measurementSource: y === "use_form_measurements" ? "form_provided" : "scan_derived",
3872
- isDoubleWall: Z,
3853
+ isDoubleWall: Y,
3873
3854
  isUnitConverted: false,
3874
3855
  formMeasurements: Se,
3875
3856
  scanMeasurements: X,
3876
3857
  frontalHeight: (Te == null ? void 0 : Te.frontalHeight) ?? qe,
3877
- transverseML: $,
3858
+ transverseML: E,
3878
3859
  transverseAP: W,
3879
3860
  perineumML: Te == null ? void 0 : Te.perineumML,
3880
3861
  perineumAP: Te == null ? void 0 : Te.perineumAP,
@@ -3892,36 +3873,36 @@ let __tla = (async () => {
3892
3873
  e,
3893
3874
  He,
3894
3875
  X,
3895
- L,
3896
- O,
3876
+ _,
3877
+ $,
3897
3878
  $e,
3898
- Z,
3879
+ Y,
3899
3880
  Se,
3900
3881
  n,
3901
3882
  Te,
3902
3883
  qe,
3903
3884
  Ke
3904
- ]), to = V(() => {
3885
+ ]), eo = V(() => {
3905
3886
  if (!Se || X.length === 0) return false;
3906
3887
  const y = Math.min(Se.length, X.length);
3907
3888
  if (y === 0) return false;
3908
3889
  for (let D = 0; D < y; D++) {
3909
- const $ = Se[D], W = X[D];
3910
- if (!W || $ == null || $ === 0) continue;
3911
- const J = W.modifiedValue ?? W.originalValue;
3912
- if (Math.abs(J - $) > 7) return false;
3890
+ const E = Se[D], W = X[D];
3891
+ if (!W || E == null || E === 0) continue;
3892
+ const q = W.modifiedValue ?? W.originalValue;
3893
+ if (Math.abs(q - E) > 7) return false;
3913
3894
  }
3914
3895
  return true;
3915
3896
  }, [
3916
3897
  Se,
3917
3898
  X
3918
- ]), no = nt ? 5 : U && Ze || U ? 4 : e ? O.length === 0 ? 2 : 3 : 1, oo = [
3899
+ ]), to = nt ? 5 : K && Ze || K ? 4 : e ? $.length === 0 ? 2 : 3 : 1, no = [
3919
3900
  {
3920
3901
  label: "Load File",
3921
3902
  number: 1
3922
3903
  },
3923
3904
  {
3924
- label: L === "AK" ? "Set IT" : "Set MPT",
3905
+ label: _ === "AK" ? "Set IT" : "Set MPT",
3925
3906
  number: 2
3926
3907
  },
3927
3908
  {
@@ -3937,10 +3918,10 @@ let __tla = (async () => {
3937
3918
  number: 5
3938
3919
  }
3939
3920
  ];
3940
- return C(wo.Provider, {
3921
+ return M(yo.Provider, {
3941
3922
  value: t,
3942
3923
  children: [
3943
- C("div", {
3924
+ M("div", {
3944
3925
  style: {
3945
3926
  flex: 1,
3946
3927
  display: "flex",
@@ -3969,11 +3950,11 @@ let __tla = (async () => {
3969
3950
  }
3970
3951
  })
3971
3952
  }),
3972
- i(Uo, {
3973
- steps: oo,
3974
- currentStep: no
3953
+ i(Ko, {
3954
+ steps: no,
3955
+ currentStep: to
3975
3956
  }),
3976
- C("div", {
3957
+ M("div", {
3977
3958
  style: {
3978
3959
  flex: 1,
3979
3960
  display: "flex",
@@ -3981,7 +3962,7 @@ let __tla = (async () => {
3981
3962
  minHeight: 0
3982
3963
  },
3983
3964
  children: [
3984
- C("div", {
3965
+ M("div", {
3985
3966
  style: {
3986
3967
  flex: 1,
3987
3968
  display: "flex",
@@ -3989,27 +3970,27 @@ let __tla = (async () => {
3989
3970
  minHeight: 0
3990
3971
  },
3991
3972
  children: [
3992
- U && Ze && L && i("div", {
3973
+ K && Ze && _ && i("div", {
3993
3974
  style: {
3994
3975
  width: 340,
3995
3976
  flexShrink: 0,
3996
3977
  borderRight: "1px solid #e0e0e0",
3997
3978
  overflow: "hidden"
3998
3979
  },
3999
- children: i(rr, {
4000
- amputationType: L,
4001
- spacingInches: F,
3980
+ children: i(tr, {
3981
+ amputationType: _,
3982
+ spacingInches: P,
4002
3983
  scanMeasurements: X,
4003
3984
  scanFrontalHeight: qe,
4004
- onSave: eo,
4005
- onSkip: nn,
4006
- onFormChange: Hn,
4007
- onHeightChange: jn,
3985
+ onSave: Qn,
3986
+ onSkip: tn,
3987
+ onFormChange: On,
3988
+ onHeightChange: Nn,
4008
3989
  initialValues: Se,
4009
3990
  initialFrontalHeight: Te == null ? void 0 : Te.frontalHeight
4010
3991
  })
4011
3992
  }),
4012
- C("div", {
3993
+ M("div", {
4013
3994
  ref: Lt,
4014
3995
  style: {
4015
3996
  flex: 1,
@@ -4017,11 +3998,11 @@ let __tla = (async () => {
4017
3998
  minHeight: 0,
4018
3999
  overflow: "hidden"
4019
4000
  },
4020
- onDragOver: t.showDragDrop ? Zn : void 0,
4021
- onDragLeave: t.showDragDrop ? Kn : void 0,
4022
- onDrop: t.showDragDrop ? Un : void 0,
4001
+ onDragOver: t.showDragDrop ? Yn : void 0,
4002
+ onDragLeave: t.showDragDrop ? Zn : void 0,
4003
+ onDrop: t.showDragDrop ? Kn : void 0,
4023
4004
  children: [
4024
- t.showDragDrop && !e && !z && i("div", {
4005
+ t.showDragDrop && !e && !A && i("div", {
4025
4006
  style: {
4026
4007
  position: "absolute",
4027
4008
  inset: 16,
@@ -4040,7 +4021,7 @@ let __tla = (async () => {
4040
4021
  fontFamily: "system-ui, sans-serif"
4041
4022
  },
4042
4023
  children: "Drag & Drop Files Here"
4043
- }) : C("div", {
4024
+ }) : M("div", {
4044
4025
  style: {
4045
4026
  textAlign: "center"
4046
4027
  },
@@ -4070,7 +4051,7 @@ let __tla = (async () => {
4070
4051
  ]
4071
4052
  })
4072
4053
  }),
4073
- !t.showDragDrop && !e && !z && !zt && i("div", {
4054
+ !t.showDragDrop && !e && !A && !zt && i("div", {
4074
4055
  style: {
4075
4056
  position: "absolute",
4076
4057
  inset: 0,
@@ -4078,7 +4059,7 @@ let __tla = (async () => {
4078
4059
  alignItems: "center",
4079
4060
  justifyContent: "center"
4080
4061
  },
4081
- children: C("div", {
4062
+ children: M("div", {
4082
4063
  style: {
4083
4064
  textAlign: "center"
4084
4065
  },
@@ -4108,7 +4089,7 @@ let __tla = (async () => {
4108
4089
  ]
4109
4090
  })
4110
4091
  }),
4111
- e && !U && O.length === 0 && C("div", {
4092
+ e && !K && $.length === 0 && M("div", {
4112
4093
  style: {
4113
4094
  position: "absolute",
4114
4095
  top: 16,
@@ -4137,10 +4118,10 @@ let __tla = (async () => {
4137
4118
  }
4138
4119
  }),
4139
4120
  "Click mesh to set ",
4140
- L === "AK" ? "IT" : "MPT"
4121
+ _ === "AK" ? "IT" : "MPT"
4141
4122
  ]
4142
4123
  }),
4143
- e && !U && O.length === 1 && C("div", {
4124
+ e && !K && $.length === 1 && M("div", {
4144
4125
  style: {
4145
4126
  position: "absolute",
4146
4127
  top: 16,
@@ -4171,13 +4152,13 @@ let __tla = (async () => {
4171
4152
  "Click mesh to set Origin"
4172
4153
  ]
4173
4154
  }),
4174
- z && i(gn, {
4155
+ A && i(hn, {
4175
4156
  message: x || "Processing mesh..."
4176
4157
  }),
4177
- E && i(gn, {
4178
- message: Y
4158
+ T && i(hn, {
4159
+ message: Q
4179
4160
  }),
4180
- zt && i(Do, {
4161
+ zt && i(Io, {
4181
4162
  message: zt,
4182
4163
  onDismiss: () => Le(null)
4183
4164
  }),
@@ -4193,7 +4174,7 @@ let __tla = (async () => {
4193
4174
  justifyContent: "center",
4194
4175
  zIndex: 20
4195
4176
  },
4196
- children: C("div", {
4177
+ children: M("div", {
4197
4178
  style: {
4198
4179
  backgroundColor: "#fff",
4199
4180
  borderRadius: 4,
@@ -4202,7 +4183,7 @@ let __tla = (async () => {
4202
4183
  fontFamily: "system-ui, sans-serif"
4203
4184
  },
4204
4185
  children: [
4205
- C("div", {
4186
+ M("div", {
4206
4187
  style: {
4207
4188
  padding: "24px 24px 20px"
4208
4189
  },
@@ -4232,8 +4213,8 @@ let __tla = (async () => {
4232
4213
  children: [
4233
4214
  "AK",
4234
4215
  "BK"
4235
- ].map((y) => C("label", {
4236
- onClick: () => I(y),
4216
+ ].map((y) => M("label", {
4217
+ onClick: () => v(y),
4237
4218
  style: {
4238
4219
  flex: 1,
4239
4220
  display: "flex",
@@ -4242,16 +4223,16 @@ let __tla = (async () => {
4242
4223
  border: "2px solid",
4243
4224
  borderRadius: 4,
4244
4225
  cursor: "pointer",
4245
- borderColor: L === y ? "rgb(12, 67, 173)" : "#e0e0e0",
4246
- backgroundColor: L === y ? "rgba(12, 67, 173, 0.04)" : "#fff",
4226
+ borderColor: _ === y ? "rgb(12, 67, 173)" : "#e0e0e0",
4227
+ backgroundColor: _ === y ? "rgba(12, 67, 173, 0.04)" : "#fff",
4247
4228
  transition: "border-color 0.15s, background-color 0.15s"
4248
4229
  },
4249
4230
  children: [
4250
4231
  i("input", {
4251
4232
  type: "radio",
4252
4233
  name: "ampType",
4253
- checked: L === y,
4254
- onChange: () => I(y),
4234
+ checked: _ === y,
4235
+ onChange: () => v(y),
4255
4236
  style: {
4256
4237
  accentColor: "rgb(12, 67, 173)",
4257
4238
  marginBottom: 12,
@@ -4268,7 +4249,7 @@ let __tla = (async () => {
4268
4249
  },
4269
4250
  children: y
4270
4251
  }),
4271
- C("span", {
4252
+ M("span", {
4272
4253
  style: {
4273
4254
  fontSize: 13,
4274
4255
  color: "rgba(0,0,0,0.54)"
@@ -4283,7 +4264,7 @@ let __tla = (async () => {
4283
4264
  })
4284
4265
  ]
4285
4266
  }),
4286
- C("div", {
4267
+ M("div", {
4287
4268
  style: {
4288
4269
  display: "flex",
4289
4270
  justifyContent: "flex-end",
@@ -4294,7 +4275,7 @@ let __tla = (async () => {
4294
4275
  children: [
4295
4276
  i("button", {
4296
4277
  onClick: () => {
4297
- A(false), _(null);
4278
+ C(false), I(null);
4298
4279
  },
4299
4280
  style: {
4300
4281
  padding: "6px 16px",
@@ -4312,17 +4293,17 @@ let __tla = (async () => {
4312
4293
  children: "Cancel"
4313
4294
  }),
4314
4295
  i("button", {
4315
- onClick: () => L && qn(L),
4316
- disabled: !L,
4296
+ onClick: () => _ && Un(_),
4297
+ disabled: !_,
4317
4298
  style: {
4318
4299
  padding: "6px 16px",
4319
4300
  borderRadius: 4,
4320
4301
  fontSize: 14,
4321
4302
  fontWeight: 500,
4322
- backgroundColor: L ? "rgb(12, 67, 173)" : "#e0e0e0",
4303
+ backgroundColor: _ ? "rgb(12, 67, 173)" : "#e0e0e0",
4323
4304
  border: "none",
4324
- color: L ? "#fff" : "#9e9e9e",
4325
- cursor: L ? "pointer" : "not-allowed",
4305
+ color: _ ? "#fff" : "#9e9e9e",
4306
+ cursor: _ ? "pointer" : "not-allowed",
4326
4307
  fontFamily: "system-ui, sans-serif",
4327
4308
  lineHeight: "36px",
4328
4309
  letterSpacing: "0.4px"
@@ -4344,8 +4325,8 @@ let __tla = (async () => {
4344
4325
  zIndex: 10
4345
4326
  }
4346
4327
  }),
4347
- i(Io, {
4348
- children: C(ho, {
4328
+ i(_o, {
4329
+ children: M(po, {
4349
4330
  camera: {
4350
4331
  position: [
4351
4332
  0,
@@ -4362,7 +4343,7 @@ let __tla = (async () => {
4362
4343
  preserveDrawingBuffer: true
4363
4344
  },
4364
4345
  scene: {
4365
- background: De ? new H.Color("#070611") : null
4346
+ background: De ? new O.Color("#070611") : null
4366
4347
  },
4367
4348
  children: [
4368
4349
  i("ambientLight", {
@@ -4392,81 +4373,81 @@ let __tla = (async () => {
4392
4373
  ],
4393
4374
  intensity: 0.2
4394
4375
  }),
4395
- e && k === "3D" && i(Wo, {
4376
+ e && L === "3D" && i(Ro, {
4396
4377
  mesh: e,
4397
4378
  maxPoints: 2,
4398
- meshColor: Kt,
4399
- meshOpacity: De ? 0.3 : Vn,
4400
- frontFaceOnly: K,
4401
- doubleShellTransparency: Z && U
4379
+ meshColor: Zt,
4380
+ meshOpacity: De ? 0.3 : jn,
4381
+ frontFaceOnly: Z,
4382
+ doubleShellTransparency: Y && K
4402
4383
  }),
4403
- e && k === "3D" && i(Eo, {
4384
+ e && L === "3D" && i(Bo, {
4404
4385
  modelSize: d,
4405
4386
  labels: [
4406
- L === "AK" ? "IT" : "MPT",
4387
+ _ === "AK" ? "IT" : "MPT",
4407
4388
  "Origin",
4408
4389
  "Cut Plane"
4409
4390
  ]
4410
4391
  }),
4411
- i(Go, {
4392
+ i(Xo, {
4412
4393
  modelSize: d,
4413
- isAligned: U,
4394
+ isAligned: K,
4414
4395
  isCut: _t,
4415
4396
  mesh: e,
4416
- viewMode: k,
4417
- sliceY: U && O.length >= 2 ? Ae ?? vt ?? O[0].position.y : void 0,
4418
- landmarkCount: O.length,
4419
- measurementGeometry: be,
4397
+ viewMode: L,
4398
+ sliceY: K && $.length >= 2 ? Ae ?? vt ?? $[0].position.y : void 0,
4399
+ landmarkCount: $.length,
4400
+ measurementGeometry: xe,
4420
4401
  resetCameraToFrontRef: Pt
4421
4402
  }),
4422
- !U && i(Sn, {
4403
+ !K && i(Sn, {
4423
4404
  enableDamping: false
4424
4405
  }),
4425
- U && X.length > 0 && e && k === "3D" && i(Yo, {
4406
+ K && X.length > 0 && e && L === "3D" && i(Go, {
4426
4407
  mesh: e,
4427
- isDragging: Wn
4408
+ isDragging: Rn
4428
4409
  }),
4429
- e && U && O.length >= 3 && (() => {
4410
+ e && K && $.length >= 3 && (() => {
4430
4411
  const D = e.geometry.getIndex();
4431
4412
  if (!D || D.count < 30) return null;
4432
- const $ = O[2], W = O[0], J = Ve ?? $.position.y, N = Ae ?? vt ?? W.position.y;
4433
- return k === "2D" ? i(qo, {
4413
+ const E = $[2], W = $[0], q = Ve ?? E.position.y, H = Ae ?? vt ?? W.position.y;
4414
+ return L === "2D" ? i(Uo, {
4434
4415
  mesh: He ?? e,
4435
- upperY: N,
4416
+ upperY: H,
4436
4417
  originY: W.position.y,
4437
4418
  modelSize: d,
4438
- meshColor: Kt,
4439
- displayUnit: R
4440
- }) : C(We, {
4419
+ meshColor: Zt,
4420
+ displayUnit: k
4421
+ }) : M(We, {
4441
4422
  children: [
4442
- i(jo, {
4423
+ i(No, {
4443
4424
  mesh: He ?? e,
4444
- startY: J,
4445
- endY: N,
4425
+ startY: q,
4426
+ endY: H,
4446
4427
  spacing: lt,
4447
4428
  modelSize: d,
4448
4429
  onMeasurementsChange: G,
4449
4430
  reverseOrder: true,
4450
- displayUnit: R,
4451
- useInnerSurface: Z && !K,
4452
- formMeasurements: Ze ? On ?? Se : Ye ? Se : void 0,
4431
+ displayUnit: k,
4432
+ useInnerSurface: Y && !Z,
4433
+ formMeasurements: Ze ? Tn ?? Se : Ye ? Se : void 0,
4453
4434
  originY: Ct ?? W.position.y,
4454
4435
  wasmSlices: Pe
4455
4436
  }),
4456
- i(Xo, {
4437
+ i(Vo, {
4457
4438
  mesh: e,
4458
4439
  greenY: Ct ?? W.position.y,
4459
4440
  modelSize: d,
4460
- displayUnit: R,
4461
- bottomY: Z ? $.position.y : void 0,
4462
- formHeight: Ze ? Nn : Ye ? Te == null ? void 0 : Te.frontalHeight : void 0
4441
+ displayUnit: k,
4442
+ bottomY: Y ? E.position.y : void 0,
4443
+ formHeight: Ze ? Hn : Ye ? Te == null ? void 0 : Te.frontalHeight : void 0
4463
4444
  }),
4464
- i(Jo, {
4445
+ i(qo, {
4465
4446
  mesh: e,
4466
4447
  yPosition: Ct ?? W.position.y,
4467
- onYChange: (me) => {
4468
- Xt(me), Fe(null);
4469
- const Ce = me - W.position.y;
4448
+ onYChange: (ge) => {
4449
+ Vt(ge), Fe(null);
4450
+ const Ce = ge - W.position.y;
4470
4451
  St((vt ?? W.position.y + lt * 2) + Ce);
4471
4452
  },
4472
4453
  minY: W.position.y - lt,
@@ -4475,36 +4456,36 @@ let __tla = (async () => {
4475
4456
  color: "#44ff44",
4476
4457
  hoverColor: "#88ff88",
4477
4458
  dragColor: "#ffffff",
4478
- label: L === "AK" ? "IT" : "MPT",
4479
- onDragStart: () => Vt(true),
4480
- onDragEnd: () => Vt(false)
4459
+ label: _ === "AK" ? "IT" : "MPT",
4460
+ onDragStart: () => jt(true),
4461
+ onDragEnd: () => jt(false)
4481
4462
  })
4482
4463
  ]
4483
4464
  });
4484
4465
  })(),
4485
- e && U && k === "3D" && De && i(xr, {
4466
+ e && K && L === "3D" && De && i(xr, {
4486
4467
  mesh: e
4487
4468
  }),
4488
- e && t.showDebug && De && k === "3D" && i(mr, {
4469
+ e && t.showDebug && De && L === "3D" && i(mr, {
4489
4470
  mesh: e,
4490
4471
  modelSize: d,
4491
- layers: Gt,
4492
- landmarkPoints: O,
4472
+ layers: Xt,
4473
+ landmarkPoints: $,
4493
4474
  componentDebug: null,
4494
- aoData: xe,
4475
+ aoData: me,
4495
4476
  aoGeometry: j,
4496
- measurementGeometry: be
4477
+ measurementGeometry: xe
4497
4478
  }),
4498
4479
  i(Sr, {
4499
- screenshotFnRef: Gn,
4480
+ screenshotFnRef: Xn,
4500
4481
  mesh: e,
4501
4482
  modelSize: d,
4502
- measurementGeometry: be
4483
+ measurementGeometry: xe
4503
4484
  })
4504
4485
  ]
4505
4486
  })
4506
4487
  }),
4507
- e && C("div", {
4488
+ e && M("div", {
4508
4489
  style: {
4509
4490
  position: "absolute",
4510
4491
  top: 16,
@@ -4531,8 +4512,8 @@ let __tla = (async () => {
4531
4512
  },
4532
4513
  children: "Start Over"
4533
4514
  }),
4534
- !U && O.length >= 1 && i("button", {
4535
- onClick: Yn,
4515
+ !K && $.length >= 1 && i("button", {
4516
+ onClick: Gn,
4536
4517
  style: {
4537
4518
  padding: "6px 16px",
4538
4519
  borderRadius: 4,
@@ -4548,8 +4529,8 @@ let __tla = (async () => {
4548
4529
  },
4549
4530
  children: "Reset Points"
4550
4531
  }),
4551
- U && !nt && i("button", {
4552
- onClick: Qn,
4532
+ K && !nt && i("button", {
4533
+ onClick: Jn,
4553
4534
  style: {
4554
4535
  padding: "6px 16px",
4555
4536
  borderRadius: 4,
@@ -4567,15 +4548,15 @@ let __tla = (async () => {
4567
4548
  })
4568
4549
  ]
4569
4550
  }),
4570
- t.showDebug && De && e && k === "3D" && i(yr, {
4571
- layers: Gt,
4572
- onToggleLayer: (y) => En((D) => ({
4551
+ t.showDebug && De && e && L === "3D" && i(yr, {
4552
+ layers: Xt,
4553
+ onToggleLayer: (y) => Bn((D) => ({
4573
4554
  ...D,
4574
4555
  [y]: !D[y]
4575
4556
  })),
4576
- isDoubleShell: Z
4557
+ isDoubleShell: Y
4577
4558
  }),
4578
- U && X.length > 0 && C("div", {
4559
+ K && X.length > 0 && M("div", {
4579
4560
  style: {
4580
4561
  position: "absolute",
4581
4562
  top: 16,
@@ -4585,7 +4566,7 @@ let __tla = (async () => {
4585
4566
  zIndex: 10
4586
4567
  },
4587
4568
  children: [
4588
- C("div", {
4569
+ M("div", {
4589
4570
  style: {
4590
4571
  display: "flex",
4591
4572
  borderRadius: 6,
@@ -4599,9 +4580,9 @@ let __tla = (async () => {
4599
4580
  style: {
4600
4581
  padding: "6px 14px",
4601
4582
  fontSize: 13,
4602
- fontWeight: k === "3D" ? 600 : 400,
4603
- backgroundColor: k === "3D" ? "rgb(12, 67, 173)" : "#fff",
4604
- color: k === "3D" ? "#fff" : "#666",
4583
+ fontWeight: L === "3D" ? 600 : 400,
4584
+ backgroundColor: L === "3D" ? "rgb(12, 67, 173)" : "#fff",
4585
+ color: L === "3D" ? "#fff" : "#666",
4605
4586
  border: "none",
4606
4587
  cursor: "pointer",
4607
4588
  fontFamily: "system-ui, sans-serif"
@@ -4613,9 +4594,9 @@ let __tla = (async () => {
4613
4594
  style: {
4614
4595
  padding: "6px 14px",
4615
4596
  fontSize: 13,
4616
- fontWeight: k === "2D" ? 600 : 400,
4617
- backgroundColor: k === "2D" ? "rgb(12, 67, 173)" : "#fff",
4618
- color: k === "2D" ? "#fff" : "#666",
4597
+ fontWeight: L === "2D" ? 600 : 400,
4598
+ backgroundColor: L === "2D" ? "rgb(12, 67, 173)" : "#fff",
4599
+ color: L === "2D" ? "#fff" : "#666",
4619
4600
  border: "none",
4620
4601
  borderLeft: "1px solid #ccc",
4621
4602
  cursor: "pointer",
@@ -4625,7 +4606,7 @@ let __tla = (async () => {
4625
4606
  })
4626
4607
  ]
4627
4608
  }),
4628
- C("div", {
4609
+ M("div", {
4629
4610
  style: {
4630
4611
  display: "flex",
4631
4612
  borderRadius: 6,
@@ -4635,13 +4616,13 @@ let __tla = (async () => {
4635
4616
  },
4636
4617
  children: [
4637
4618
  i("button", {
4638
- onClick: () => P("mm"),
4619
+ onClick: () => R("mm"),
4639
4620
  style: {
4640
4621
  padding: "6px 14px",
4641
4622
  fontSize: 13,
4642
- fontWeight: R === "mm" ? 600 : 400,
4643
- backgroundColor: R === "mm" ? "rgb(12, 67, 173)" : "#fff",
4644
- color: R === "mm" ? "#fff" : "#666",
4623
+ fontWeight: k === "mm" ? 600 : 400,
4624
+ backgroundColor: k === "mm" ? "rgb(12, 67, 173)" : "#fff",
4625
+ color: k === "mm" ? "#fff" : "#666",
4645
4626
  border: "none",
4646
4627
  cursor: "pointer",
4647
4628
  fontFamily: "system-ui, sans-serif"
@@ -4649,13 +4630,13 @@ let __tla = (async () => {
4649
4630
  children: "mm"
4650
4631
  }),
4651
4632
  i("button", {
4652
- onClick: () => P("inch"),
4633
+ onClick: () => R("inch"),
4653
4634
  style: {
4654
4635
  padding: "6px 14px",
4655
4636
  fontSize: 13,
4656
- fontWeight: R === "inch" ? 600 : 400,
4657
- backgroundColor: R === "inch" ? "rgb(12, 67, 173)" : "#fff",
4658
- color: R === "inch" ? "#fff" : "#666",
4637
+ fontWeight: k === "inch" ? 600 : 400,
4638
+ backgroundColor: k === "inch" ? "rgb(12, 67, 173)" : "#fff",
4639
+ color: k === "inch" ? "#fff" : "#666",
4659
4640
  border: "none",
4660
4641
  borderLeft: "1px solid #ccc",
4661
4642
  cursor: "pointer",
@@ -4665,7 +4646,7 @@ let __tla = (async () => {
4665
4646
  })
4666
4647
  ]
4667
4648
  }),
4668
- t.showSpacingToggle && k === "3D" && C("div", {
4649
+ t.showSpacingToggle && L === "3D" && M("div", {
4669
4650
  style: {
4670
4651
  display: "flex",
4671
4652
  borderRadius: 6,
@@ -4675,13 +4656,13 @@ let __tla = (async () => {
4675
4656
  },
4676
4657
  children: [
4677
4658
  i("button", {
4678
- onClick: () => v(1),
4659
+ onClick: () => z(1),
4679
4660
  style: {
4680
4661
  padding: "6px 14px",
4681
4662
  fontSize: 13,
4682
- fontWeight: F === 1 ? 600 : 400,
4683
- backgroundColor: F === 1 ? "rgb(12, 67, 173)" : "#fff",
4684
- color: F === 1 ? "#fff" : "#666",
4663
+ fontWeight: P === 1 ? 600 : 400,
4664
+ backgroundColor: P === 1 ? "rgb(12, 67, 173)" : "#fff",
4665
+ color: P === 1 ? "#fff" : "#666",
4685
4666
  border: "none",
4686
4667
  cursor: "pointer",
4687
4668
  fontFamily: "system-ui, sans-serif"
@@ -4689,13 +4670,13 @@ let __tla = (async () => {
4689
4670
  children: '1"'
4690
4671
  }),
4691
4672
  i("button", {
4692
- onClick: () => v(2),
4673
+ onClick: () => z(2),
4693
4674
  style: {
4694
4675
  padding: "6px 14px",
4695
4676
  fontSize: 13,
4696
- fontWeight: F === 2 ? 600 : 400,
4697
- backgroundColor: F === 2 ? "rgb(12, 67, 173)" : "#fff",
4698
- color: F === 2 ? "#fff" : "#666",
4677
+ fontWeight: P === 2 ? 600 : 400,
4678
+ backgroundColor: P === 2 ? "rgb(12, 67, 173)" : "#fff",
4679
+ color: P === 2 ? "#fff" : "#666",
4699
4680
  border: "none",
4700
4681
  borderLeft: "1px solid #ccc",
4701
4682
  cursor: "pointer",
@@ -4705,7 +4686,7 @@ let __tla = (async () => {
4705
4686
  })
4706
4687
  ]
4707
4688
  }),
4708
- k === "3D" && Se && i("div", {
4689
+ L === "3D" && Se && i("div", {
4709
4690
  style: {
4710
4691
  display: "flex",
4711
4692
  borderRadius: 6,
@@ -4740,11 +4721,11 @@ let __tla = (async () => {
4740
4721
  onClick: async () => {
4741
4722
  const y = await Ke();
4742
4723
  if (!y) return;
4743
- const D = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), $ = (W, J) => {
4744
- const N = document.createElement("a");
4745
- N.href = W, N.download = J, N.click();
4724
+ const D = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), E = (W, q) => {
4725
+ const H = document.createElement("a");
4726
+ H.href = W, H.download = q, H.click();
4746
4727
  };
4747
- $(y.frontal_view_png, `measurements_front_${D}.png`), await new Promise((W) => setTimeout(W, 300)), $(y.side_view_png, `measurements_transverse_${D}.png`);
4728
+ E(y.frontal_view_png, `measurements_front_${D}.png`), await new Promise((W) => setTimeout(W, 300)), E(y.side_view_png, `measurements_transverse_${D}.png`);
4748
4729
  },
4749
4730
  style: {
4750
4731
  padding: "6px 14px",
@@ -4768,7 +4749,7 @@ let __tla = (async () => {
4768
4749
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
4769
4750
  },
4770
4751
  children: i("button", {
4771
- onClick: () => Bn((y) => !y),
4752
+ onClick: () => Wn((y) => !y),
4772
4753
  style: {
4773
4754
  padding: "6px 14px",
4774
4755
  fontSize: 13,
@@ -4784,15 +4765,15 @@ let __tla = (async () => {
4784
4765
  })
4785
4766
  ]
4786
4767
  }),
4787
- e && re && i(Zo, {
4788
- wasAutoScaled: ce,
4768
+ e && re && i(Yo, {
4769
+ wasAutoScaled: ae,
4789
4770
  onDismiss: () => ee(false)
4790
4771
  }),
4791
- e && ye && U && i(Ko, {
4792
- isDoubleShell: Z,
4772
+ e && ye && K && i(Zo, {
4773
+ isDoubleShell: Y,
4793
4774
  onDismiss: () => oe(false)
4794
4775
  }),
4795
- s && C("div", {
4776
+ s && M("div", {
4796
4777
  style: {
4797
4778
  position: "absolute",
4798
4779
  bottom: 16,
@@ -4820,25 +4801,25 @@ let __tla = (async () => {
4820
4801
  },
4821
4802
  children: "Have Galileo Check My Measurements"
4822
4803
  }),
4823
- e && !U && i("button", {
4824
- disabled: O.length < 2,
4825
- onClick: Jn,
4804
+ e && !K && i("button", {
4805
+ disabled: $.length < 2,
4806
+ onClick: qn,
4826
4807
  style: {
4827
4808
  padding: "6px 16px",
4828
4809
  borderRadius: 4,
4829
4810
  fontSize: 14,
4830
4811
  fontWeight: 500,
4831
- backgroundColor: O.length >= 2 ? "rgb(12, 67, 173)" : "#9e9e9e",
4812
+ backgroundColor: $.length >= 2 ? "rgb(12, 67, 173)" : "#9e9e9e",
4832
4813
  border: "none",
4833
4814
  color: "#fff",
4834
- cursor: O.length >= 2 ? "pointer" : "not-allowed",
4815
+ cursor: $.length >= 2 ? "pointer" : "not-allowed",
4835
4816
  fontFamily: "system-ui, sans-serif",
4836
4817
  letterSpacing: "0.4px",
4837
4818
  lineHeight: "36px"
4838
4819
  },
4839
4820
  children: "Next \xBB"
4840
4821
  }),
4841
- U && nt && !Ze && i("button", {
4822
+ K && nt && !Ze && i("button", {
4842
4823
  onClick: () => tt(true),
4843
4824
  style: {
4844
4825
  padding: "6px 16px",
@@ -4855,7 +4836,7 @@ let __tla = (async () => {
4855
4836
  },
4856
4837
  children: "Edit Measurements"
4857
4838
  }),
4858
- U && nt && (to ? i("button", {
4839
+ K && nt && (eo ? i("button", {
4859
4840
  disabled: ze,
4860
4841
  onClick: () => Rt("continue"),
4861
4842
  style: {
@@ -4872,7 +4853,7 @@ let __tla = (async () => {
4872
4853
  lineHeight: "36px"
4873
4854
  },
4874
4855
  children: "Continue"
4875
- }) : C(We, {
4856
+ }) : M(We, {
4876
4857
  children: [
4877
4858
  i("button", {
4878
4859
  disabled: ze,
@@ -4918,7 +4899,7 @@ let __tla = (async () => {
4918
4899
  })
4919
4900
  ]
4920
4901
  }),
4921
- ze && C("div", {
4902
+ ze && M("div", {
4922
4903
  "data-finalizing-overlay": true,
4923
4904
  style: {
4924
4905
  position: "absolute",
@@ -4957,7 +4938,7 @@ let __tla = (async () => {
4957
4938
  })
4958
4939
  ]
4959
4940
  }),
4960
- l && kt.length > 0 && C("div", {
4941
+ l && kt.length > 0 && M("div", {
4961
4942
  style: {
4962
4943
  height: 120,
4963
4944
  flexShrink: 0,
@@ -4970,7 +4951,7 @@ let __tla = (async () => {
4970
4951
  flexDirection: "column"
4971
4952
  },
4972
4953
  children: [
4973
- C("div", {
4954
+ M("div", {
4974
4955
  style: {
4975
4956
  display: "flex",
4976
4957
  alignItems: "center",
@@ -4990,14 +4971,14 @@ let __tla = (async () => {
4990
4971
  },
4991
4972
  children: "GALILEO DEBUG"
4992
4973
  }),
4993
- C("div", {
4974
+ M("div", {
4994
4975
  style: {
4995
4976
  display: "flex",
4996
4977
  gap: 8,
4997
4978
  alignItems: "center"
4998
4979
  },
4999
4980
  children: [
5000
- C("span", {
4981
+ M("span", {
5001
4982
  style: {
5002
4983
  color: "#484f58",
5003
4984
  fontSize: 9
@@ -5006,16 +4987,16 @@ let __tla = (async () => {
5006
4987
  "WASM ",
5007
4988
  Oe.current ? "v2" : "N/A",
5008
4989
  " | ",
5009
- O.length,
4990
+ $.length,
5010
4991
  " pts | ",
5011
- U ? "aligned" : "unaligned",
4992
+ K ? "aligned" : "unaligned",
5012
4993
  " | ",
5013
4994
  X.length,
5014
4995
  " slices"
5015
4996
  ]
5016
4997
  }),
5017
4998
  i("button", {
5018
- onClick: () => Ut([]),
4999
+ onClick: () => Kt([]),
5019
5000
  style: {
5020
5001
  background: "none",
5021
5002
  border: "1px solid #30363d",
@@ -5040,10 +5021,10 @@ let __tla = (async () => {
5040
5021
  lineHeight: 1.6
5041
5022
  },
5042
5023
  children: kt.map((y, D) => {
5043
- const $ = y.includes("ERROR") || y.includes("failed"), W = y.includes("warning") || y.includes("WARN"), J = y.includes("PIPELINE:"), N = y.includes("STATE:");
5024
+ const E = y.includes("ERROR") || y.includes("failed"), W = y.includes("warning") || y.includes("WARN"), q = y.includes("PIPELINE:"), H = y.includes("STATE:");
5044
5025
  return i("div", {
5045
5026
  style: {
5046
- color: $ ? "#f85149" : W ? "#d29922" : J ? "#58a6ff" : N ? "#3fb950" : "#8b949e",
5027
+ color: E ? "#f85149" : W ? "#d29922" : q ? "#58a6ff" : H ? "#3fb950" : "#8b949e",
5047
5028
  whiteSpace: "pre"
5048
5029
  },
5049
5030
  children: y
@@ -5054,21 +5035,21 @@ let __tla = (async () => {
5054
5035
  })
5055
5036
  ]
5056
5037
  }),
5057
- $n && i(Ln, {
5058
- onSkip: nn,
5038
+ En && i(rr, {
5039
+ onSkip: tn,
5059
5040
  onCancel: () => Ft(false)
5060
5041
  })
5061
5042
  ]
5062
5043
  });
5063
5044
  };
5064
5045
  function Sr({ screenshotFnRef: t }) {
5065
- return q(() => {
5046
+ return U(() => {
5066
5047
  t.current = null;
5067
5048
  }, [
5068
5049
  t
5069
5050
  ]), null;
5070
5051
  }
5071
- Rn = function(t) {
5052
+ Dn = function(t) {
5072
5053
  const r = t === "AK" ? 2 : 1, n = [];
5073
5054
  for (let o = 2; o >= 1; o -= r) n.push(`${o}_above`);
5074
5055
  n.push("at_ref");
@@ -5088,7 +5069,7 @@ let __tla = (async () => {
5088
5069
  return n;
5089
5070
  };
5090
5071
  gt = function(t, r) {
5091
- const n = Rn(r), o = {};
5072
+ const n = Dn(r), o = {};
5092
5073
  for (let s = 0; s < Math.min(t.length, n.length); s++) {
5093
5074
  const l = t[s];
5094
5075
  l != null && !isNaN(l) && (o[n[s]] = l);
@@ -5097,7 +5078,7 @@ let __tla = (async () => {
5097
5078
  };
5098
5079
  vr = function(t, r) {
5099
5080
  if (!t) return;
5100
- const o = Rn(r).map((s) => {
5081
+ const o = Dn(r).map((s) => {
5101
5082
  const l = t[s];
5102
5083
  return l ?? void 0;
5103
5084
  });
@@ -5165,7 +5146,7 @@ let __tla = (async () => {
5165
5146
  }
5166
5147
  Rr = ({ request: t, onComplete: r, wasmModule: n }) => {
5167
5148
  const [o, s] = B(null);
5168
- q(() => {
5149
+ U(() => {
5169
5150
  if (n != null) return;
5170
5151
  let e = false;
5171
5152
  const g = async (d) => {
@@ -5194,14 +5175,14 @@ let __tla = (async () => {
5194
5175
  let f, u;
5195
5176
  if (e.formMeasurements) {
5196
5177
  f = gt(e.formMeasurements, t.spacing_type);
5197
- const S = e.scanMeasurements.map((F, v) => {
5178
+ const S = e.scanMeasurements.map((P, z) => {
5198
5179
  var _a2;
5199
- const w = (_a2 = e.formMeasurements) == null ? void 0 : _a2[v];
5200
- return w == null || isNaN(w) ? null : +((F.modifiedValue ?? F.originalValue) - w).toFixed(1);
5180
+ const w = (_a2 = e.formMeasurements) == null ? void 0 : _a2[z];
5181
+ return w == null || isNaN(w) ? null : +((P.modifiedValue ?? P.originalValue) - w).toFixed(1);
5201
5182
  });
5202
5183
  u = gt(S, t.spacing_type);
5203
5184
  }
5204
- const h = e.userEnteredMeasurements ? gt(e.userEnteredMeasurements.circumferences, t.spacing_type) : void 0, z = e.decision === "use_scan" || e.decision === "continue", p = z ? d : h ?? f ?? d, x = z ? +e.frontalHeight.toFixed(1) : +(((_a = e.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? e.frontalHeight).toFixed(1);
5185
+ const h = e.userEnteredMeasurements ? gt(e.userEnteredMeasurements.circumferences, t.spacing_type) : void 0, A = e.decision === "use_scan" || e.decision === "continue", p = A ? d : h ?? f ?? d, x = A ? +e.frontalHeight.toFixed(1) : +(((_a = e.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? e.frontalHeight).toFixed(1);
5205
5186
  let m;
5206
5187
  if (t.upload_url) if (!e.alignedGeometry) m = {
5207
5188
  success: false,
@@ -5209,13 +5190,13 @@ let __tla = (async () => {
5209
5190
  message: "No aligned geometry available \u2014 mesh processing may not have completed."
5210
5191
  };
5211
5192
  else try {
5212
- const S = Cr(e.alignedGeometry), F = new Blob([
5193
+ const S = Cr(e.alignedGeometry), P = new Blob([
5213
5194
  S
5214
- ]), v = await zr(t.upload_url, F);
5195
+ ]), z = await zr(t.upload_url, P);
5215
5196
  m = {
5216
- ...v,
5197
+ ...z,
5217
5198
  url: t.upload_url,
5218
- message: v.success ? "Cleaned mesh uploaded successfully." : `Upload failed: ${v.error ?? "unknown error"}`
5199
+ message: z.success ? "Cleaned mesh uploaded successfully." : `Upload failed: ${z.error ?? "unknown error"}`
5219
5200
  };
5220
5201
  } catch (S) {
5221
5202
  m = {
@@ -5225,7 +5206,7 @@ let __tla = (async () => {
5225
5206
  error: S instanceof Error ? S.message : String(S)
5226
5207
  };
5227
5208
  }
5228
- const k = {
5209
+ const L = {
5229
5210
  spacing_type: t.spacing_type,
5230
5211
  source_unit: "mm",
5231
5212
  file_format: e.fileFormat,
@@ -5252,7 +5233,7 @@ let __tla = (async () => {
5252
5233
  screenshots: e.screenshots,
5253
5234
  upload: m
5254
5235
  };
5255
- r == null ? void 0 : r(k);
5236
+ r == null ? void 0 : r(L);
5256
5237
  };
5257
5238
  return i("div", {
5258
5239
  style: {
@@ -5261,7 +5242,7 @@ let __tla = (async () => {
5261
5242
  display: "flex"
5262
5243
  },
5263
5244
  children: i(wr, {
5264
- config: yo,
5245
+ config: bo,
5265
5246
  spacingType: t.spacing_type,
5266
5247
  scanUrl: t.scan_url,
5267
5248
  formMeasurements: c,
@@ -5276,5 +5257,5 @@ export {
5276
5257
  __tla,
5277
5258
  gt as a,
5278
5259
  vr as c,
5279
- Rn as g
5260
+ Dn as g
5280
5261
  };