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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- import { jsxs as P, jsx as i, Fragment as Te } from "react/jsx-runtime";
2
- import { createContext as Yn, Component as Xn, useCallback as re, useMemo as j, useState as W, memo as Gn, useEffect as ne, useRef as le, forwardRef as Zn, createElement as Jt } from "react";
1
+ import { jsxs as L, jsx as i, Fragment as Te } from "react/jsx-runtime";
2
+ import { createContext as Yn, Component as Xn, useCallback as oe, useMemo as j, useState as E, memo as Gn, useEffect as re, useRef as le, forwardRef as Zn, createElement as Jt } from "react";
3
3
  import { useFrame as rn, useThree as sn, Canvas as Kn } from "@react-three/fiber";
4
4
  import { Html as Ye, Line as de, OrbitControls as ln } from "@react-three/drei";
5
5
  import * as O from "three";
6
- import { Plane as dt, Vector3 as M, Box3 as an, Line3 as cn, Raycaster as Un } from "three";
6
+ import { Plane as dt, Vector3 as C, Box3 as an, Line3 as cn, Raycaster as Un } from "three";
7
7
  import { create as Jn } from "zustand";
8
8
  import { OBJLoader as dn } from "three/examples/jsm/loaders/OBJLoader.js";
9
9
  import { STLLoader as Qn } from "three/examples/jsm/loaders/STLLoader.js";
@@ -39,7 +39,7 @@ let __tla = (async () => {
39
39
  ]
40
40
  }),
41
41
  removeLandmarkPoint: (t) => e((o) => ({
42
- landmarkPoints: o.landmarkPoints.filter((s, d) => d !== t)
42
+ landmarkPoints: o.landmarkPoints.filter((l, s) => s !== t)
43
43
  })),
44
44
  clearLandmarkPoints: () => e({
45
45
  landmarkPoints: [],
@@ -47,9 +47,9 @@ let __tla = (async () => {
47
47
  isCut: false
48
48
  }),
49
49
  updateLandmarkPositions: (t) => e((o) => ({
50
- landmarkPoints: o.landmarkPoints.map((s, d) => ({
51
- ...s,
52
- position: t[d] ?? s.position
50
+ landmarkPoints: o.landmarkPoints.map((l, s) => ({
51
+ ...l,
52
+ position: t[s] ?? l.position
53
53
  }))
54
54
  })),
55
55
  setAligned: (t) => e({
@@ -70,51 +70,51 @@ let __tla = (async () => {
70
70
  const r = e.match(/^v\s+\S+\s+\S+\s+\S+(.*)$/m);
71
71
  if (!r || !((_a = r[1]) == null ? void 0 : _a.trim().includes(" "))) return null;
72
72
  const t = e.split(`
73
- `), o = [], s = [];
74
- let d = false;
73
+ `), o = [], l = [];
74
+ let s = false;
75
75
  for (const c of t) if (c.startsWith("v ")) {
76
76
  const a = c.trim().split(/\s+/);
77
77
  if (a.length >= 7) {
78
78
  o.push(parseFloat(a[1]), parseFloat(a[2]), parseFloat(a[3]));
79
- let n = parseFloat(a[4]), h = parseFloat(a[5]), l = parseFloat(a[6]);
80
- (n > 1 || h > 1 || l > 1) && (n /= 255, h /= 255, l /= 255), s.push(n, h, l), d = true;
81
- } else a.length >= 4 && (o.push(parseFloat(a[1]), parseFloat(a[2]), parseFloat(a[3])), s.push(0, 0, 0));
79
+ let n = parseFloat(a[4]), h = parseFloat(a[5]), d = parseFloat(a[6]);
80
+ (n > 1 || h > 1 || d > 1) && (n /= 255, h /= 255, d /= 255), l.push(n, h, d), s = true;
81
+ } else a.length >= 4 && (o.push(parseFloat(a[1]), parseFloat(a[2]), parseFloat(a[3])), l.push(0, 0, 0));
82
82
  }
83
- return d ? {
83
+ return s ? {
84
84
  positions: new Float32Array(o),
85
- colors: new Float32Array(s)
85
+ colors: new Float32Array(l)
86
86
  } : null;
87
87
  }
88
88
  function io(e, r, t, o) {
89
- const s = e.getAttribute("position"), d = s.count, c = new Float32Array(d * 3), a = r.length / 3;
90
- let n = 1 / 0, h = 1 / 0, l = 1 / 0, f = -1 / 0, p = -1 / 0, g = -1 / 0;
91
- for (let F = 0; F < a; F++) {
92
- const B = r[F * 3] * o, $ = r[F * 3 + 1] * o, N = r[F * 3 + 2] * o;
93
- B < n && (n = B), B > f && (f = B), $ < h && (h = $), $ > p && (p = $), N < l && (l = N), N > g && (g = N);
89
+ const l = e.getAttribute("position"), s = l.count, c = new Float32Array(s * 3), a = r.length / 3;
90
+ let n = 1 / 0, h = 1 / 0, d = 1 / 0, u = -1 / 0, p = -1 / 0, g = -1 / 0;
91
+ for (let k = 0; k < a; k++) {
92
+ const B = r[k * 3] * o, $ = r[k * 3 + 1] * o, N = r[k * 3 + 2] * o;
93
+ B < n && (n = B), B > u && (u = B), $ < h && (h = $), $ > p && (p = $), N < d && (d = N), N > g && (g = N);
94
94
  }
95
- const z = (n + f) * 0.5, u = (h + p) * 0.5, m = (l + g) * 0.5, x = f - n + 1e-6, S = p - h + 1e-6, I = g - l + 1e-6, A = x * 0.5, L = S * 0.5, y = I * 0.5, v = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), b = x / v, D = S / v, w = I / v, k = /* @__PURE__ */ new Map();
96
- for (let F = 0; F < a; F++) {
97
- const B = r[F * 3] * o - z, $ = r[F * 3 + 1] * o - u, N = r[F * 3 + 2] * o - m, U = Math.min(v - 1, Math.max(0, Math.floor((B + A) / b))), be = Math.min(v - 1, Math.max(0, Math.floor(($ + L) / D))), ae = Math.min(v - 1, Math.max(0, Math.floor((N + y) / w))), fe = U * v * v + be * v + ae;
98
- let ie = k.get(fe);
99
- ie || (ie = [], k.set(fe, ie)), ie.push(F);
95
+ const M = (n + u) * 0.5, f = (h + p) * 0.5, m = (d + g) * 0.5, x = u - n + 1e-6, S = p - h + 1e-6, I = g - d + 1e-6, F = x * 0.5, P = S * 0.5, b = I * 0.5, z = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), y = x / z, D = S / z, w = I / z, A = /* @__PURE__ */ new Map();
96
+ for (let k = 0; k < a; k++) {
97
+ const B = r[k * 3] * o - M, $ = r[k * 3 + 1] * o - f, N = r[k * 3 + 2] * o - m, U = Math.min(z - 1, Math.max(0, Math.floor((B + F) / y))), be = Math.min(z - 1, Math.max(0, Math.floor(($ + P) / D))), ae = Math.min(z - 1, Math.max(0, Math.floor((N + b) / w))), fe = U * z * z + be * z + ae;
98
+ let ie = A.get(fe);
99
+ ie || (ie = [], A.set(fe, ie)), ie.push(k);
100
100
  }
101
- for (let F = 0; F < d; F++) {
102
- const B = s.getX(F), $ = s.getY(F), N = s.getZ(F), U = Math.min(v - 1, Math.max(0, Math.floor((B + A) / b))), be = Math.min(v - 1, Math.max(0, Math.floor(($ + L) / D))), ae = Math.min(v - 1, Math.max(0, Math.floor((N + y) / w)));
101
+ for (let k = 0; k < s; k++) {
102
+ const B = l.getX(k), $ = l.getY(k), N = l.getZ(k), U = Math.min(z - 1, Math.max(0, Math.floor((B + F) / y))), be = Math.min(z - 1, Math.max(0, Math.floor(($ + P) / D))), ae = Math.min(z - 1, Math.max(0, Math.floor((N + b) / w)));
103
103
  let fe = 1 / 0, ie = 0;
104
- for (let J = 0; J <= v && fe > 0; J++) {
104
+ for (let J = 0; J <= z && fe > 0; J++) {
105
105
  for (let Y = -J; Y <= J; Y++) for (let pe = -J; pe <= J; pe++) for (let Z = -J; Z <= J; Z++) {
106
106
  if (J > 0 && Math.abs(Y) < J && Math.abs(pe) < J && Math.abs(Z) < J) continue;
107
107
  const he = U + Y, me = be + pe, ue = ae + Z;
108
- if (he < 0 || he >= v || me < 0 || me >= v || ue < 0 || ue >= v) continue;
109
- const H = k.get(he * v * v + me * v + ue);
108
+ if (he < 0 || he >= z || me < 0 || me >= z || ue < 0 || ue >= z) continue;
109
+ const H = A.get(he * z * z + me * z + ue);
110
110
  if (H) for (const q of H) {
111
- const xe = r[q * 3] * o - z, Ce = r[q * 3 + 1] * o - u, we = r[q * 3 + 2] * o - m, oe = (B - xe) ** 2 + ($ - Ce) ** 2 + (N - we) ** 2;
112
- oe < fe && (fe = oe, ie = q);
111
+ const xe = r[q * 3] * o - M, Ce = r[q * 3 + 1] * o - f, we = r[q * 3 + 2] * o - m, ne = (B - xe) ** 2 + ($ - Ce) ** 2 + (N - we) ** 2;
112
+ ne < fe && (fe = ne, ie = q);
113
113
  }
114
114
  }
115
115
  if (fe < 1 / 0) break;
116
116
  }
117
- c[F * 3] = t[ie * 3], c[F * 3 + 1] = t[ie * 3 + 1], c[F * 3 + 2] = t[ie * 3 + 2];
117
+ c[k * 3] = t[ie * 3], c[k * 3 + 1] = t[ie * 3 + 1], c[k * 3 + 2] = t[ie * 3 + 2];
118
118
  }
119
119
  e.setAttribute("color", new O.Float32BufferAttribute(c, 3));
120
120
  }
@@ -147,26 +147,26 @@ let __tla = (async () => {
147
147
  };
148
148
  function st(e, r, t, o) {
149
149
  if (Qt[e] < Qt[fn]) return;
150
- const s = `[${r}]`, d = o !== void 0 ? [
151
- s,
150
+ const l = `[${r}]`, s = o !== void 0 ? [
151
+ l,
152
152
  t,
153
153
  o
154
154
  ] : [
155
- s,
155
+ l,
156
156
  t
157
157
  ];
158
158
  switch (e) {
159
159
  case "debug":
160
- console.debug(...d);
160
+ console.debug(...s);
161
161
  break;
162
162
  case "info":
163
- console.log(...d);
163
+ console.log(...s);
164
164
  break;
165
165
  case "warn":
166
- console.warn(...d);
166
+ console.warn(...s);
167
167
  break;
168
168
  case "error":
169
- console.error(...d);
169
+ console.error(...s);
170
170
  break;
171
171
  }
172
172
  un == null ? void 0 : un(e, r, t, o);
@@ -177,11 +177,11 @@ let __tla = (async () => {
177
177
  positions: t,
178
178
  indices: new Uint32Array(o.array)
179
179
  };
180
- const s = t.length / 3, d = new Uint32Array(s);
181
- for (let c = 0; c < s; c++) d[c] = c;
180
+ const l = t.length / 3, s = new Uint32Array(l);
181
+ for (let c = 0; c < l; c++) s[c] = c;
182
182
  return {
183
183
  positions: t,
184
- indices: d
184
+ indices: s
185
185
  };
186
186
  }
187
187
  function pn(e, r) {
@@ -192,9 +192,9 @@ let __tla = (async () => {
192
192
  try {
193
193
  const o = ro(e);
194
194
  t == null ? void 0 : t("Parsing mesh...");
195
- const d = new dn().parse(e);
195
+ const s = new dn().parse(e);
196
196
  let c = null;
197
- if (d.traverse((x) => {
197
+ if (s.traverse((x) => {
198
198
  x.isMesh && !c && (c = x.geometry);
199
199
  }), !c) return null;
200
200
  const { positions: a, indices: n } = ct(c);
@@ -203,10 +203,10 @@ let __tla = (async () => {
203
203
  const h = a.length / 3;
204
204
  for (let x = 0; x < Math.min(n.length, 300); x++) if (n[x] >= h) return ce.error("wasm", `Out-of-bounds index: ${n[x]} >= ${h}`), null;
205
205
  t == null ? void 0 : t("Processing mesh (WASM)...");
206
- const l = r.preprocess_mesh(a, n, 10, 1e-4, 500), f = l.positions(), p = l.indices(), g = l.unit_converted(), z = l.detected_unit(), u = l.log();
207
- if (ce.debug("wasm", "preprocess result", u), f.length === 0) return null;
206
+ const d = r.preprocess_mesh(a, n, 10, 1e-4, 500), u = d.positions(), p = d.indices(), g = d.unit_converted(), M = d.detected_unit(), f = d.log();
207
+ if (ce.debug("wasm", "preprocess result", f), u.length === 0) return null;
208
208
  t == null ? void 0 : t("Building geometry...");
209
- const m = pn(f, p);
209
+ const m = pn(u, p);
210
210
  if (o) {
211
211
  const x = g ? 1e3 : 1;
212
212
  io(m, o.positions, o.colors, x);
@@ -215,7 +215,7 @@ let __tla = (async () => {
215
215
  geometry: m,
216
216
  wasScaled: g,
217
217
  unitConverted: g,
218
- detectedUnit: z
218
+ detectedUnit: M
219
219
  };
220
220
  } catch (o) {
221
221
  return ce.error("wasm", "Processing failed", o), null;
@@ -224,17 +224,17 @@ let __tla = (async () => {
224
224
  function lo(e) {
225
225
  const t = new dn().parse(e);
226
226
  let o = null;
227
- return t.traverse((s) => {
228
- s.isMesh && !o && (o = s.geometry);
227
+ return t.traverse((l) => {
228
+ l.isMesh && !o && (o = l.geometry);
229
229
  }), o;
230
230
  }
231
231
  async function Ft(e) {
232
- const r = await e.arrayBuffer(), s = new Qn().parse(r).getAttribute("position");
233
- if (!s || s.count === 0) throw new Error("Empty STL geometry");
234
- const d = [];
235
- for (let c = 0; c < s.count; c++) d.push(`v ${s.getX(c)} ${s.getY(c)} ${s.getZ(c)}`);
236
- for (let c = 0; c < s.count; c += 3) d.push(`f ${c + 1} ${c + 2} ${c + 3}`);
237
- return d.join(`
232
+ const r = await e.arrayBuffer(), l = new Qn().parse(r).getAttribute("position");
233
+ if (!l || l.count === 0) throw new Error("Empty STL geometry");
234
+ const s = [];
235
+ for (let c = 0; c < l.count; c++) s.push(`v ${l.getX(c)} ${l.getY(c)} ${l.getZ(c)}`);
236
+ for (let c = 0; c < l.count; c += 3) s.push(`f ${c + 1} ${c + 2} ${c + 3}`);
237
+ return s.join(`
238
238
  `);
239
239
  }
240
240
  function ao(e, r) {
@@ -254,109 +254,109 @@ let __tla = (async () => {
254
254
  }
255
255
  function hn(e, r = 1e-3, t = false) {
256
256
  if (!e.length) return [];
257
- const o = /* @__PURE__ */ new Map(), s = (f) => {
258
- const p = ao(f, r);
257
+ const o = /* @__PURE__ */ new Map(), l = (u) => {
258
+ const p = ao(u, r);
259
259
  let g = o.get(p);
260
- return g || (g = f.clone(), o.set(p, g)), g;
261
- }, d = e.map((f) => ({
262
- a: s(f.a),
263
- b: s(f.b)
260
+ return g || (g = u.clone(), o.set(p, g)), g;
261
+ }, s = e.map((u) => ({
262
+ a: l(u.a),
263
+ b: l(u.b)
264
264
  })), c = [];
265
- for (; d.length; ) {
266
- const f = d.pop(), p = [
267
- f.a,
268
- f.b
265
+ for (; s.length; ) {
266
+ const u = s.pop(), p = [
267
+ u.a,
268
+ u.b
269
269
  ];
270
270
  let g = true;
271
271
  for (; g; ) {
272
272
  g = false;
273
- for (let u = d.length - 1; u >= 0; u--) {
274
- const { a: m, b: x } = d[u];
273
+ for (let f = s.length - 1; f >= 0; f--) {
274
+ const { a: m, b: x } = s[f];
275
275
  if (m.equals(p[p.length - 1])) p.push(x);
276
276
  else if (x.equals(p[p.length - 1])) p.push(m);
277
277
  else if (m.equals(p[0])) p.unshift(x);
278
278
  else if (x.equals(p[0])) p.unshift(m);
279
279
  else continue;
280
- d.splice(u, 1), g = true;
280
+ s.splice(f, 1), g = true;
281
281
  }
282
282
  }
283
- const z = co(p, r);
284
- z.length > 1 && c.push(z);
283
+ const M = co(p, r);
284
+ M.length > 1 && c.push(M);
285
285
  }
286
286
  if (!c.length) return [];
287
287
  if (t) {
288
- c.sort((g, z) => Ze(z) - Ze(g));
289
- const f = Ze(c[0]), p = c.filter((g) => Ze(g) >= f * 0.3);
288
+ c.sort((g, M) => Ze(M) - Ze(g));
289
+ const u = Ze(c[0]), p = c.filter((g) => Ze(g) >= u * 0.3);
290
290
  return p[p.length - 1] ?? c[0];
291
291
  }
292
- const a = c.filter((f) => f.length >= 3 && f[0].distanceTo(f[f.length - 1]) < r * 10), n = a.length > 0 ? a : c;
292
+ const a = c.filter((u) => u.length >= 3 && u[0].distanceTo(u[u.length - 1]) < r * 10), n = a.length > 0 ? a : c;
293
293
  if (n.length === 1) return n[0];
294
- let h = n[0], l = 1 / 0;
295
- for (const f of n) {
294
+ let h = n[0], d = 1 / 0;
295
+ for (const u of n) {
296
296
  let p = 0, g = 0;
297
- for (const u of f) p += u.x, g += u.z;
298
- p /= f.length, g /= f.length;
299
- const z = Math.sqrt(p * p + g * g);
300
- z < l && (l = z, h = f);
297
+ for (const f of u) p += f.x, g += f.z;
298
+ p /= u.length, g /= u.length;
299
+ const M = Math.sqrt(p * p + g * g);
300
+ M < d && (d = M, h = u);
301
301
  }
302
302
  return h;
303
303
  }
304
304
  function qt(e, r, t, o = false) {
305
- const s = new dt(new M(0, 1, 0), -t), d = [], c = new an();
305
+ const l = new dt(new C(0, 1, 0), -t), s = [], c = new an();
306
306
  c.setFromBufferAttribute(r.getAttribute("position"));
307
307
  const a = {
308
308
  linePoints: [],
309
309
  lineLength: 0,
310
- rightmostPoint: new M(0, t, 0)
310
+ rightmostPoint: new C(0, t, 0)
311
311
  };
312
- if (!s.intersectsBox(c)) return a;
313
- const n = new cn(), h = new M();
312
+ if (!l.intersectsBox(c)) return a;
313
+ const n = new cn(), h = new C();
314
314
  e.shapecast({
315
- intersectsBounds: (u) => s.intersectsBox(u),
316
- intersectsTriangle: (u) => {
315
+ intersectsBounds: (f) => l.intersectsBox(f),
316
+ intersectsTriangle: (f) => {
317
317
  const m = [];
318
- n.set(u.a, u.b), s.intersectLine(n, h) && m.push(h.clone()), n.set(u.b, u.c), s.intersectLine(n, h) && m.push(h.clone()), n.set(u.c, u.a), s.intersectLine(n, h) && m.push(h.clone()), m.length === 2 && d.push({
318
+ n.set(f.a, f.b), l.intersectLine(n, h) && m.push(h.clone()), n.set(f.b, f.c), l.intersectLine(n, h) && m.push(h.clone()), n.set(f.c, f.a), l.intersectLine(n, h) && m.push(h.clone()), m.length === 2 && s.push({
319
319
  a: m[0],
320
320
  b: m[1]
321
321
  });
322
322
  }
323
323
  });
324
- const l = hn(d, Pt, o);
325
- if (l.length < 2) return a;
326
- const f = Ze(l);
327
- let p = -1 / 0, g = new M(0, t, 0);
328
- for (const u of l) u.x > p && (p = u.x, g = u.clone());
329
- const z = l.length > 2 && l[0].distanceTo(l[l.length - 1]) < Pt * 10;
324
+ const d = hn(s, Pt, o);
325
+ if (d.length < 2) return a;
326
+ const u = Ze(d);
327
+ let p = -1 / 0, g = new C(0, t, 0);
328
+ for (const f of d) f.x > p && (p = f.x, g = f.clone());
329
+ const M = d.length > 2 && d[0].distanceTo(d[d.length - 1]) < Pt * 10;
330
330
  return {
331
- linePoints: l,
332
- lineLength: f,
331
+ linePoints: d,
332
+ lineLength: u,
333
333
  rightmostPoint: g,
334
- isClosed: z
334
+ isClosed: M
335
335
  };
336
336
  }
337
337
  function Ne(e, r, t, o = false) {
338
- const s = qt(e, r, t, o);
339
- if (s.isClosed && s.linePoints.length >= 3) return s;
340
- ce.debug("slice", `y=${t.toFixed(2)} failed (pts=${s.linePoints.length}, closed=${s.isClosed}), retrying...`);
341
- let d = s;
338
+ const l = qt(e, r, t, o);
339
+ if (l.isClosed && l.linePoints.length >= 3) return l;
340
+ ce.debug("slice", `y=${t.toFixed(2)} failed (pts=${l.linePoints.length}, closed=${l.isClosed}), retrying...`);
341
+ let s = l;
342
342
  for (const c of oo) {
343
343
  const a = qt(e, r, t + c, o);
344
344
  if (a.isClosed && a.linePoints.length >= 3) return ce.debug("slice", `y=${t.toFixed(2)} recovered with offset ${c > 0 ? "+" : ""}${c}mm (pts=${a.linePoints.length}, len=${a.lineLength.toFixed(1)}mm)`), a;
345
- a.linePoints.length > d.linePoints.length && (d = a);
345
+ a.linePoints.length > s.linePoints.length && (s = a);
346
346
  }
347
- return ce.warn("slice", `y=${t.toFixed(2)} all retries exhausted (pts=${d.linePoints.length}, closed=${d.isClosed})`), d;
347
+ return ce.warn("slice", `y=${t.toFixed(2)} all retries exhausted (pts=${s.linePoints.length}, closed=${s.isClosed})`), s;
348
348
  }
349
349
  function fo(e, r, t, o) {
350
- const s = new dt().setFromNormalAndCoplanarPoint(o.clone().normalize(), t), d = new an();
351
- if (d.setFromBufferAttribute(r.getAttribute("position")), !s.intersectsBox(d)) return 0;
352
- const c = [], a = new cn(), n = new M();
350
+ const l = new dt().setFromNormalAndCoplanarPoint(o.clone().normalize(), t), s = new an();
351
+ if (s.setFromBufferAttribute(r.getAttribute("position")), !l.intersectsBox(s)) return 0;
352
+ const c = [], a = new cn(), n = new C();
353
353
  e.shapecast({
354
- intersectsBounds: (l) => s.intersectsBox(l),
355
- intersectsTriangle: (l) => {
356
- const f = [];
357
- a.set(l.a, l.b), s.intersectLine(a, n) && f.push(n.clone()), a.set(l.b, l.c), s.intersectLine(a, n) && f.push(n.clone()), a.set(l.c, l.a), s.intersectLine(a, n) && f.push(n.clone()), f.length === 2 && c.push({
358
- a: f[0],
359
- b: f[1]
354
+ intersectsBounds: (d) => l.intersectsBox(d),
355
+ intersectsTriangle: (d) => {
356
+ const u = [];
357
+ a.set(d.a, d.b), l.intersectLine(a, n) && u.push(n.clone()), a.set(d.b, d.c), l.intersectLine(a, n) && u.push(n.clone()), a.set(d.c, d.a), l.intersectLine(a, n) && u.push(n.clone()), u.length === 2 && c.push({
358
+ a: u[0],
359
+ b: u[1]
360
360
  });
361
361
  }
362
362
  });
@@ -369,10 +369,10 @@ let __tla = (async () => {
369
369
  });
370
370
  }
371
371
  function uo(e, r, t, o) {
372
- const s = e.getIndex(), d = s ? s.count / 3 : 0;
373
- if (d < 10) return {
372
+ const l = e.getIndex(), s = l ? l.count / 3 : 0;
373
+ if (s < 10) return {
374
374
  valid: false,
375
- reason: `Geometry is empty or degenerate (${d} faces)`
375
+ reason: `Geometry is empty or degenerate (${s} faces)`
376
376
  };
377
377
  const c = r - t;
378
378
  if (c < 4) return {
@@ -395,19 +395,19 @@ let __tla = (async () => {
395
395
  valid: true,
396
396
  reason: ""
397
397
  };
398
- const l = Ne(a, e, h);
399
- if (n.lineLength > 0 && l.lineLength > 0) {
400
- const p = n.lineLength / l.lineLength;
398
+ const d = Ne(a, e, h);
399
+ if (n.lineLength > 0 && d.lineLength > 0) {
400
+ const p = n.lineLength / d.lineLength;
401
401
  if (p < 0.5) return {
402
402
  valid: false,
403
403
  reason: `First circumference is too small relative to second (ratio ${p.toFixed(2)} < 0.5) \u2014 possible trimmed angle`
404
404
  };
405
405
  }
406
- const f = r - o * 2;
407
- if (f > t) {
408
- const p = Ne(a, e, f);
409
- if (l.lineLength > 0 && p.lineLength > 0) {
410
- const g = l.lineLength / p.lineLength;
406
+ const u = r - o * 2;
407
+ if (u > t) {
408
+ const p = Ne(a, e, u);
409
+ if (d.lineLength > 0 && p.lineLength > 0) {
410
+ const g = d.lineLength / p.lineLength;
411
411
  if (g < 0.5) return {
412
412
  valid: false,
413
413
  reason: `Second circumference is too small relative to third (ratio ${g.toFixed(2)} < 0.5) \u2014 possible trimmed angle`
@@ -422,28 +422,28 @@ let __tla = (async () => {
422
422
  const Fe = "pipeline";
423
423
  function po(e, r, t, o) {
424
424
  var _a, _b, _c, _d;
425
- const s = e.geometry.clone(), d = r.map((a) => ({
425
+ const l = e.geometry.clone(), s = r.map((a) => ({
426
426
  ...a
427
427
  })), c = o.wasmModule;
428
428
  try {
429
- let a = e.geometry, n = d.map((H) => new M(H.position.x, H.position.y, H.position.z));
430
- const h = n[0], l = n[1];
429
+ let a = e.geometry, n = s.map((H) => new C(H.position.x, H.position.y, H.position.z));
430
+ const h = n[0], d = n[1];
431
431
  if (!c) {
432
432
  o.onStatus("Aligning mesh (JS fallback)..."), ce.warn(Fe, "WASM not available, using JS fallback alignment");
433
- const H = new M(0, 1, 0), q = new M().subVectors(l, h).normalize(), xe = q.dot(H), Ce = new M().crossVectors(q, H);
433
+ const H = new C(0, 1, 0), q = new C().subVectors(d, h).normalize(), xe = q.dot(H), Ce = new C().crossVectors(q, H);
434
434
  if (Ce.length() > 1e-4) {
435
435
  Ce.normalize();
436
436
  const X = new O.Quaternion().setFromAxisAngle(Ce, Math.acos(Math.min(1, Math.max(-1, xe))));
437
437
  a.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(X)), n = n.map((Le) => Le.clone().applyQuaternion(X));
438
438
  }
439
439
  if (n[0].y > n[1].y) {
440
- const X = new O.Quaternion().setFromAxisAngle(new M(1, 0, 0), Math.PI);
440
+ const X = new O.Quaternion().setFromAxisAngle(new C(1, 0, 0), Math.PI);
441
441
  a.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(X)), n = n.map((Le) => Le.clone().applyQuaternion(X));
442
442
  }
443
443
  const we = n[0].clone();
444
- a.translate(-we.x, -we.y, -we.z), n = n.map((X) => new M(X.x - we.x, X.y - we.y, X.z - we.z)), a.computeVertexNormals(), a.computeBoundingBox();
445
- const oe = new M(n[0].x, n[0].y, n[0].z);
446
- n.push(oe), o.addLandmarkPoint({
444
+ a.translate(-we.x, -we.y, -we.z), n = n.map((X) => new C(X.x - we.x, X.y - we.y, X.z - we.z)), a.computeVertexNormals(), a.computeBoundingBox();
445
+ const ne = new C(n[0].x, n[0].y, n[0].z);
446
+ n.push(ne), o.addLandmarkPoint({
447
447
  faceIndex: -1,
448
448
  vertexIndices: [
449
449
  0,
@@ -451,9 +451,9 @@ let __tla = (async () => {
451
451
  2
452
452
  ],
453
453
  position: {
454
- x: oe.x,
455
- y: oe.y,
456
- z: oe.z
454
+ x: ne.x,
455
+ y: ne.y,
456
+ z: ne.z
457
457
  },
458
458
  barycentricCoords: {
459
459
  u: 0.33,
@@ -465,37 +465,37 @@ let __tla = (async () => {
465
465
  y: X.y,
466
466
  z: X.z
467
467
  }))), o.setAligned(true), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(n[1].y + 2 * at);
468
- const V = new M();
469
- a.computeBoundingBox(), a.boundingBox.getSize(V), o.setModelSize(Math.max(V.x, V.y, V.z)), s.dispose();
468
+ const V = new C();
469
+ a.computeBoundingBox(), a.boundingBox.getSize(V), o.setModelSize(Math.max(V.x, V.y, V.z)), l.dispose();
470
470
  return;
471
471
  }
472
- const { positions: f, indices: p } = ct(a), g = new Float32Array([
472
+ const { positions: u, indices: p } = ct(a), g = new Float32Array([
473
473
  h.x,
474
474
  h.y,
475
475
  h.z
476
- ]), z = new Float32Array([
477
- l.x,
478
- l.y,
479
- l.z
476
+ ]), M = new Float32Array([
477
+ d.x,
478
+ d.y,
479
+ d.z
480
480
  ]);
481
481
  o.onStatus("Detecting shell type...");
482
- const u = c.detect_shell(f, p, z, 40), m = u.is_double_shell(), x = u.surface_normal();
483
- ce.info(Fe, `Shell: ${m ? "DOUBLE" : "SINGLE"}`, u.details()), (_a = o.setDoubleShell) == null ? void 0 : _a.call(o, m), o.onStatus("Finding cross-section plane...");
482
+ const f = c.detect_shell(u, p, M, 40), m = f.is_double_shell(), x = f.surface_normal();
483
+ ce.info(Fe, `Shell: ${m ? "DOUBLE" : "SINGLE"}`, f.details()), (_a = o.setDoubleShell) == null ? void 0 : _a.call(o, m), o.onStatus("Finding cross-section plane...");
484
484
  const S = new Float32Array([
485
485
  x[0],
486
486
  x[1],
487
487
  x[2]
488
- ]), I = c.find_min_cross_section(f, p, z, S, 10), A = I.plane_normal();
488
+ ]), I = c.find_min_cross_section(u, p, M, S, 10), F = I.plane_normal();
489
489
  ce.info(Fe, "Cross-section found", I.details()), o.onStatus("Aligning mesh...");
490
- const L = new Float32Array([
491
- A[0],
492
- A[1],
493
- A[2]
494
- ]), y = c.align_to_origin(f, g, z, L);
495
- let v = y.positions(), b = y.mpt(), D = y.origin();
496
- const w = y.transform();
497
- ce.info(Fe, "Alignment complete", y.details());
498
- const k = [
490
+ const P = new Float32Array([
491
+ F[0],
492
+ F[1],
493
+ F[2]
494
+ ]), b = c.align_to_origin(u, g, M, P);
495
+ let z = b.positions(), y = b.mpt(), D = b.origin();
496
+ const w = b.transform();
497
+ ce.info(Fe, "Alignment complete", b.details());
498
+ const A = [
499
499
  w[3],
500
500
  w[4],
501
501
  w[5],
@@ -505,25 +505,25 @@ let __tla = (async () => {
505
505
  w[9],
506
506
  w[10],
507
507
  w[11]
508
- ], F = new Float32Array([
509
- k[0] * A[0] + k[1] * A[1] + k[2] * A[2],
510
- k[3] * A[0] + k[4] * A[1] + k[5] * A[2],
511
- k[6] * A[0] + k[7] * A[1] + k[8] * A[2]
508
+ ], k = new Float32Array([
509
+ A[0] * F[0] + A[1] * F[1] + A[2] * F[2],
510
+ A[3] * F[0] + A[4] * F[1] + A[5] * F[2],
511
+ A[6] * F[0] + A[7] * F[1] + A[8] * F[2]
512
512
  ]);
513
513
  o.onStatus("Generating measurement points...");
514
- const B = c.subdivide_origin_to_plane(new Float32Array(D), new Float32Array(b), F);
514
+ const B = c.subdivide_origin_to_plane(new Float32Array(D), new Float32Array(y), k);
515
515
  ce.debug(Fe, `Subdivide: ${B.count()} pts, spacing=${B.spacing().toFixed(1)}mm`);
516
516
  const $ = B.points(), N = B.count(), U = 2, be = 1, ae = [];
517
517
  for (let H = U; H < N - be; H++) ae.push($[H * 3 + 1]);
518
518
  o.onStatus("Computing cross-sections...");
519
519
  let fe = [];
520
520
  if (ae.length >= 2) {
521
- const q = (m ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(v, p, new Float32Array(ae), 10);
521
+ const q = (m ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(z, p, new Float32Array(ae), 10);
522
522
  ce.debug(Fe, "Batch (subdivision)", q.details());
523
523
  const xe = q.all_loop_points(), Ce = q.offsets(), we = q.circumferences();
524
- for (let oe = 0; oe < Ce.length - 1; oe++) {
525
- const V = Ce[oe], X = Ce[oe + 1];
526
- if (X <= V || we[oe] <= 0) continue;
524
+ for (let ne = 0; ne < Ce.length - 1; ne++) {
525
+ const V = Ce[ne], X = Ce[ne + 1];
526
+ if (X <= V || we[ne] <= 0) continue;
527
527
  const Le = (X - V) / 3;
528
528
  if (Le < 3) continue;
529
529
  let Pe = 0, Xe = 0, se = 0;
@@ -533,12 +533,12 @@ let __tla = (async () => {
533
533
  }
534
534
  if (fe.length >= 6) {
535
535
  o.onStatus("Refining alignment...");
536
- const H = c.refine_alignment(new Float32Array(fe), v, new Float32Array(D), new Float32Array(b));
537
- ce.info(Fe, "Refinement complete", H.details()), v = H.positions(), b = H.mpt(), D = H.origin();
536
+ const H = c.refine_alignment(new Float32Array(fe), z, new Float32Array(D), new Float32Array(y));
537
+ ce.info(Fe, "Refinement complete", H.details()), z = H.positions(), y = H.mpt(), D = H.origin();
538
538
  }
539
- const ie = a.getAttribute("color"), J = pn(v, p);
540
- ie && J.setAttribute("color", ie), a.dispose(), a = J, e.geometry = a, a.computeVertexNormals(), a.computeBoundingBox(), n[0] = new M(D[0], D[1], D[2]), n[1] = new M(b[0], b[1], b[2]), o.onStatus("Setting blue point...");
541
- const Y = new M(n[0].x, n[0].y, n[0].z);
539
+ const ie = a.getAttribute("color"), J = pn(z, p);
540
+ ie && J.setAttribute("color", ie), a.dispose(), a = J, e.geometry = a, a.computeVertexNormals(), a.computeBoundingBox(), n[0] = new C(D[0], D[1], D[2]), n[1] = new C(y[0], y[1], y[2]), o.onStatus("Setting blue point...");
541
+ const Y = new C(n[0].x, n[0].y, n[0].z);
542
542
  n.push(Y), o.addLandmarkPoint({
543
543
  faceIndex: -1,
544
544
  vertexIndices: [
@@ -561,13 +561,13 @@ let __tla = (async () => {
561
561
  y: H.y,
562
562
  z: H.z
563
563
  }))), o.setAligned(true);
564
- const pe = a.boundingBox, Z = new M();
564
+ const pe = a.boundingBox, Z = new C();
565
565
  pe.getSize(Z), o.setModelSize(Math.max(Z.x, Z.y, Z.z)), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(n[1].y + 2 * at), o.onStatus("Computing final measurements...");
566
566
  {
567
567
  const H = ct(a), q = n[1].y, xe = n[0].y;
568
568
  let Ce = 1 / 0, we = -1 / 0;
569
- const oe = H.positions;
570
- for (let se = 1; se < oe.length; se += 3) oe[se] < Ce && (Ce = oe[se]), oe[se] > we && (we = oe[se]);
569
+ const ne = H.positions;
570
+ for (let se = 1; se < ne.length; se += 3) ne[se] < Ce && (Ce = ne[se]), ne[se] > we && (we = ne[se]);
571
571
  const V = 25.4, X = [];
572
572
  X.push(q);
573
573
  for (let se = 1; se <= 2; se++) {
@@ -590,9 +590,9 @@ let __tla = (async () => {
590
590
  }
591
591
  o.onStatus("Validating results...");
592
592
  const he = n[1].y, me = n[0].y, ue = uo(a, he, me, t);
593
- ue.valid || ce.warn(Fe, `Validation: ${ue.reason}`), o.setClippedReferenceGeometry ? (s.computeVertexNormals(), o.setClippedReferenceGeometry(s)) : s.dispose();
593
+ ue.valid || ce.warn(Fe, `Validation: ${ue.reason}`), o.setClippedReferenceGeometry ? (l.computeVertexNormals(), o.setClippedReferenceGeometry(l)) : l.dispose();
594
594
  } catch (a) {
595
- ce.error(Fe, "Processing failed", a), o.setError(a instanceof Error ? a.message : "Failed to process mesh."), s.dispose();
595
+ ce.error(Fe, "Processing failed", a), o.setError(a instanceof Error ? a.message : "Failed to process mesh."), l.dispose();
596
596
  }
597
597
  }
598
598
  class ho extends Xn {
@@ -614,7 +614,7 @@ let __tla = (async () => {
614
614
  console.error("[ErrorBoundary] Caught error:", r, t.componentStack);
615
615
  }
616
616
  render() {
617
- return this.state.error ? this.props.fallback ? this.props.fallback(this.state.error, this.reset) : P("div", {
617
+ return this.state.error ? this.props.fallback ? this.props.fallback(this.state.error, this.reset) : L("div", {
618
618
  style: {
619
619
  display: "flex",
620
620
  flexDirection: "column",
@@ -662,7 +662,7 @@ let __tla = (async () => {
662
662
  }) : this.props.children;
663
663
  }
664
664
  }
665
- const go = ({ message: e, onDismiss: r }) => P("div", {
665
+ const go = ({ message: e, onDismiss: r }) => L("div", {
666
666
  style: {
667
667
  position: "absolute",
668
668
  top: 16,
@@ -679,7 +679,7 @@ let __tla = (async () => {
679
679
  gap: 12
680
680
  },
681
681
  children: [
682
- P("div", {
682
+ L("div", {
683
683
  style: {
684
684
  flex: 1
685
685
  },
@@ -715,7 +715,7 @@ let __tla = (async () => {
715
715
  children: "x"
716
716
  })
717
717
  ]
718
- }), en = ({ message: e }) => P("div", {
718
+ }), en = ({ message: e }) => L("div", {
719
719
  style: {
720
720
  position: "absolute",
721
721
  top: 0,
@@ -754,41 +754,41 @@ let __tla = (async () => {
754
754
  ]
755
755
  });
756
756
  function mo(e, r, t, o) {
757
- const s = new M().subVectors(t, r), d = new M().subVectors(o, r), c = new M().subVectors(e, r), a = s.dot(s), n = s.dot(d), h = s.dot(c), l = d.dot(d), f = d.dot(c), p = 1 / (a * l - n * n), g = (l * h - n * f) * p, z = (a * f - n * h) * p;
757
+ const l = new C().subVectors(t, r), s = new C().subVectors(o, r), c = new C().subVectors(e, r), a = l.dot(l), n = l.dot(s), h = l.dot(c), d = s.dot(s), u = s.dot(c), p = 1 / (a * d - n * n), g = (d * h - n * u) * p, M = (a * u - n * h) * p;
758
758
  return {
759
- u: 1 - g - z,
759
+ u: 1 - g - M,
760
760
  v: g,
761
- w: z
761
+ w: M
762
762
  };
763
763
  }
764
- const xo = ({ mesh: e, maxPoints: r = 2, meshColor: t = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: s = false, doubleShellTransparency: d = false }) => {
765
- const { addLandmarkPoint: c, landmarkPoints: a } = It(), n = re((g) => {
764
+ const xo = ({ mesh: e, maxPoints: r = 2, meshColor: t = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: l = false, doubleShellTransparency: s = false }) => {
765
+ const { addLandmarkPoint: c, landmarkPoints: a } = It(), n = oe((g) => {
766
766
  if (a.length >= r) return;
767
767
  g.stopPropagation();
768
- const z = g.intersections[0], u = z == null ? void 0 : z.faceIndex;
769
- if (!z || u == null) return;
768
+ const M = g.intersections[0], f = M == null ? void 0 : M.faceIndex;
769
+ if (!M || f == null) return;
770
770
  const m = e.geometry, x = m.index;
771
771
  let S;
772
772
  x ? S = [
773
- x.getX(u * 3),
774
- x.getX(u * 3 + 1),
775
- x.getX(u * 3 + 2)
773
+ x.getX(f * 3),
774
+ x.getX(f * 3 + 1),
775
+ x.getX(f * 3 + 2)
776
776
  ] : S = [
777
- u * 3,
778
- u * 3 + 1,
779
- u * 3 + 2
777
+ f * 3,
778
+ f * 3 + 1,
779
+ f * 3 + 2
780
780
  ];
781
- const I = m.getAttribute("position"), A = new M().fromBufferAttribute(I, S[0]), L = new M().fromBufferAttribute(I, S[1]), y = new M().fromBufferAttribute(I, S[2]);
782
- A.applyMatrix4(e.matrixWorld), L.applyMatrix4(e.matrixWorld), y.applyMatrix4(e.matrixWorld);
783
- const v = z.point, b = mo(v, A, L, y), D = {
784
- faceIndex: u,
781
+ const I = m.getAttribute("position"), F = new C().fromBufferAttribute(I, S[0]), P = new C().fromBufferAttribute(I, S[1]), b = new C().fromBufferAttribute(I, S[2]);
782
+ F.applyMatrix4(e.matrixWorld), P.applyMatrix4(e.matrixWorld), b.applyMatrix4(e.matrixWorld);
783
+ const z = M.point, y = mo(z, F, P, b), D = {
784
+ faceIndex: f,
785
785
  vertexIndices: S,
786
786
  position: {
787
- x: v.x,
788
- y: v.y,
789
- z: v.z
787
+ x: z.x,
788
+ y: z.y,
789
+ z: z.z
790
790
  },
791
- barycentricCoords: b
791
+ barycentricCoords: y
792
792
  };
793
793
  c(D);
794
794
  }, [
@@ -798,32 +798,32 @@ let __tla = (async () => {
798
798
  r
799
799
  ]), h = j(() => !!e.geometry.getAttribute("color"), [
800
800
  e
801
- ]), l = d ? Math.min(o, 0.65) : o, f = l < 1, p = j(() => new O.MeshStandardMaterial({
801
+ ]), d = s ? Math.min(o, 0.65) : o, u = d < 1, p = j(() => new O.MeshStandardMaterial({
802
802
  color: h ? "#ffffff" : t,
803
- side: s ? O.FrontSide : O.DoubleSide,
803
+ side: l ? O.FrontSide : O.DoubleSide,
804
804
  roughness: 0.6,
805
805
  metalness: 0.1,
806
- transparent: f,
807
- opacity: l,
808
- depthWrite: !d,
806
+ transparent: u,
807
+ opacity: d,
808
+ depthWrite: !s,
809
809
  vertexColors: h
810
810
  }), [
811
811
  t,
812
- l,
813
- f,
812
+ d,
813
+ u,
814
814
  h,
815
- s,
816
- d
815
+ l,
816
+ s
817
817
  ]);
818
818
  return i("primitive", {
819
819
  object: e,
820
820
  onClick: n,
821
821
  material: p,
822
- renderOrder: d ? 0 : void 0
822
+ renderOrder: s ? 0 : void 0
823
823
  });
824
- }, yo = ({ point: e, index: r, markerSize: t, color: o, label: s }) => {
825
- const [d, c] = W(false);
826
- return P("mesh", {
824
+ }, yo = ({ point: e, index: r, markerSize: t, color: o, label: l }) => {
825
+ const [s, c] = E(false);
826
+ return L("mesh", {
827
827
  position: [
828
828
  e.position.x,
829
829
  e.position.y,
@@ -842,7 +842,7 @@ let __tla = (async () => {
842
842
  i("meshBasicMaterial", {
843
843
  color: o
844
844
  }),
845
- d && i(Ye, {
845
+ s && i(Ye, {
846
846
  center: true,
847
847
  style: {
848
848
  pointerEvents: "none"
@@ -858,13 +858,13 @@ let __tla = (async () => {
858
858
  whiteSpace: "nowrap",
859
859
  transform: "translateY(-24px)"
860
860
  },
861
- children: s
861
+ children: l
862
862
  })
863
863
  })
864
864
  ]
865
865
  }, r);
866
866
  }, bo = ({ modelSize: e, labels: r }) => {
867
- const { landmarkPoints: t } = It(), o = e * 0.02, s = [
867
+ const { landmarkPoints: t } = It(), o = e * 0.02, l = [
868
868
  "#44ff44",
869
869
  "#ff4444",
870
870
  "#4444ff"
@@ -878,7 +878,7 @@ let __tla = (async () => {
878
878
  point: a,
879
879
  index: n,
880
880
  markerSize: o,
881
- color: s[n],
881
+ color: l[n],
882
882
  label: c[n]
883
883
  }, n))
884
884
  });
@@ -902,16 +902,16 @@ let __tla = (async () => {
902
902
  const r = Math.min((e - 20) / 20, 1);
903
903
  return on.clone().lerp(wo, r);
904
904
  }, vo = (e, r) => {
905
- const t = e.length, o = new Float32Array(t * 2 * 3), s = new Float32Array(t * 2 * 3), d = [];
905
+ const t = e.length, o = new Float32Array(t * 2 * 3), l = new Float32Array(t * 2 * 3), s = [];
906
906
  for (let n = 0; n < t; n++) {
907
- const h = e[n], l = r[n], f = h.distanceTo(l), p = So(f);
908
- if (o[n * 6] = h.x, o[n * 6 + 1] = h.y, o[n * 6 + 2] = h.z, s[n * 6] = p.r, s[n * 6 + 1] = p.g, s[n * 6 + 2] = p.b, o[n * 6 + 3] = l.x, o[n * 6 + 4] = l.y, o[n * 6 + 5] = l.z, s[n * 6 + 3] = p.r, s[n * 6 + 4] = p.g, s[n * 6 + 5] = p.b, n < t - 1) {
909
- const g = n * 2, z = g + 1, u = (n + 1) * 2, m = u + 1;
910
- d.push(g, z, u, z, m, u);
907
+ const h = e[n], d = r[n], u = h.distanceTo(d), p = So(u);
908
+ if (o[n * 6] = h.x, o[n * 6 + 1] = h.y, o[n * 6 + 2] = h.z, l[n * 6] = p.r, l[n * 6 + 1] = p.g, l[n * 6 + 2] = p.b, o[n * 6 + 3] = d.x, o[n * 6 + 4] = d.y, o[n * 6 + 5] = d.z, l[n * 6 + 3] = p.r, l[n * 6 + 4] = p.g, l[n * 6 + 5] = p.b, n < t - 1) {
909
+ const g = n * 2, M = g + 1, f = (n + 1) * 2, m = f + 1;
910
+ s.push(g, M, f, M, m, f);
911
911
  }
912
912
  }
913
913
  const c = new O.BufferGeometry();
914
- c.setAttribute("position", new O.Float32BufferAttribute(o, 3)), c.setAttribute("color", new O.Float32BufferAttribute(s, 3)), c.setIndex(d);
914
+ c.setAttribute("position", new O.Float32BufferAttribute(o, 3)), c.setAttribute("color", new O.Float32BufferAttribute(l, 3)), c.setIndex(s);
915
915
  const a = new O.MeshBasicMaterial({
916
916
  vertexColors: true,
917
917
  transparent: true,
@@ -921,27 +921,27 @@ let __tla = (async () => {
921
921
  depthWrite: false
922
922
  });
923
923
  return new O.Mesh(c, a);
924
- }, Co = ({ bvh: e, geometry: r, yPosition: t, color: o = "#00ff00", labelX: s, onDataChange: d, displayUnit: c = "mm", useInnerSurface: a = false, formValue: n, lineWidth: h = 1.5, wasmLoopPoints: l, wasmCircumference: f }) => {
925
- const p = j(() => l && f != null ? null : Ne(e, r, t, a), [
924
+ }, Co = ({ bvh: e, geometry: r, yPosition: t, color: o = "#00ff00", labelX: l, onDataChange: s, displayUnit: c = "mm", useInnerSurface: a = false, formValue: n, lineWidth: h = 1.5, wasmLoopPoints: d, wasmCircumference: u }) => {
925
+ const p = j(() => d && u != null ? null : Ne(e, r, t, a), [
926
926
  e,
927
927
  r,
928
928
  t,
929
929
  a,
930
- l,
931
- f
932
- ]), g = l ?? (p == null ? void 0 : p.linePoints) ?? [], z = f ?? (p == null ? void 0 : p.lineLength) ?? 0, u = j(() => {
933
- if (n == null || z <= 0 || g.length < 2) return null;
934
- const I = n / z, A = g.reduce((y, v) => y + v.x, 0) / g.length, L = g.reduce((y, v) => y + v.z, 0) / g.length;
935
- return g.map((y) => new M(A + (y.x - A) * I, y.y, L + (y.z - L) * I));
930
+ d,
931
+ u
932
+ ]), g = d ?? (p == null ? void 0 : p.linePoints) ?? [], M = u ?? (p == null ? void 0 : p.lineLength) ?? 0, f = j(() => {
933
+ if (n == null || M <= 0 || g.length < 2) return null;
934
+ const I = n / M, F = g.reduce((b, z) => b + z.x, 0) / g.length, P = g.reduce((b, z) => b + z.z, 0) / g.length;
935
+ return g.map((b) => new C(F + (b.x - F) * I, b.y, P + (b.z - P) * I));
936
936
  }, [
937
937
  g,
938
- z,
938
+ M,
939
939
  n
940
- ]), m = j(() => !u || g.length < 2 ? null : vo(g, u), [
940
+ ]), m = j(() => !f || g.length < 2 ? null : vo(g, f), [
941
941
  g,
942
- u
942
+ f
943
943
  ]);
944
- ne(() => () => {
944
+ re(() => () => {
945
945
  m && (m.geometry.dispose(), m.material.dispose());
946
946
  }, [
947
947
  m
@@ -949,46 +949,46 @@ let __tla = (async () => {
949
949
  const x = le(null), S = j(() => {
950
950
  const I = new O.BufferGeometry();
951
951
  I.setAttribute("position", new O.Float32BufferAttribute(new Float32Array(6), 3));
952
- const A = new O.LineBasicMaterial({
952
+ const F = new O.LineBasicMaterial({
953
953
  color: 6710886,
954
954
  depthTest: false,
955
955
  depthWrite: false,
956
956
  transparent: true
957
957
  });
958
- return new O.Line(I, A);
958
+ return new O.Line(I, F);
959
959
  }, []);
960
- return ne(() => () => {
960
+ return re(() => () => {
961
961
  S.geometry.dispose(), S.material.dispose();
962
962
  }, [
963
963
  S
964
- ]), ne(() => {
965
- z > 0 && (d == null ? void 0 : d({
964
+ ]), re(() => {
965
+ M > 0 && (s == null ? void 0 : s({
966
966
  yPosition: t,
967
- originalValue: z,
967
+ originalValue: M,
968
968
  modifiedValue: null
969
969
  }));
970
970
  }, [
971
- z,
971
+ M,
972
972
  t,
973
- d
973
+ s
974
974
  ]), rn(({ camera: I }) => {
975
975
  if (!x.current || g.length < 2) return;
976
- const A = new M();
977
- I.getWorldDirection(A);
978
- const L = new M(A.x, 0, A.z);
979
- if (L.lengthSq() < 1e-8) return;
980
- L.normalize();
981
- const y = new M().crossVectors(L, new M(0, 1, 0)).normalize();
982
- let v = -1 / 0, b = g[0];
983
- for (const F of g) {
984
- const B = y.x * F.x + y.z * F.z;
985
- B > v && (v = B, b = F);
976
+ const F = new C();
977
+ I.getWorldDirection(F);
978
+ const P = new C(F.x, 0, F.z);
979
+ if (P.lengthSq() < 1e-8) return;
980
+ P.normalize();
981
+ const b = new C().crossVectors(P, new C(0, 1, 0)).normalize();
982
+ let z = -1 / 0, y = g[0];
983
+ for (const k of g) {
984
+ const B = b.x * k.x + b.z * k.z;
985
+ B > z && (z = B, y = k);
986
986
  }
987
- const D = s * 0.35, w = new M(b.x + y.x * D, t, b.z + y.z * D);
987
+ const D = l * 0.35, w = new C(y.x + b.x * D, t, y.z + b.z * D);
988
988
  x.current.position.copy(w);
989
- const k = S.geometry.getAttribute("position");
990
- k.setXYZ(0, b.x, b.y, b.z), k.setXYZ(1, w.x, w.y, w.z), k.needsUpdate = true;
991
- }), g.length < 2 ? null : P("group", {
989
+ const A = S.geometry.getAttribute("position");
990
+ A.setXYZ(0, y.x, y.y, y.z), A.setXYZ(1, w.x, w.y, w.z), A.needsUpdate = true;
991
+ }), g.length < 2 ? null : L("group", {
992
992
  renderOrder: 10,
993
993
  children: [
994
994
  i(de, {
@@ -1004,9 +1004,9 @@ let __tla = (async () => {
1004
1004
  object: m,
1005
1005
  renderOrder: 10
1006
1006
  }),
1007
- u && n != null && i(de, {
1008
- points: u,
1009
- color: tn(z, n),
1007
+ f && n != null && i(de, {
1008
+ points: f,
1009
+ color: tn(M, n),
1010
1010
  lineWidth: 2.5,
1011
1011
  dashed: true,
1012
1012
  dashSize: 2,
@@ -1032,7 +1032,7 @@ let __tla = (async () => {
1032
1032
  pointerEvents: "none",
1033
1033
  transform: "translateY(-50%)"
1034
1034
  },
1035
- children: P("div", {
1035
+ children: L("div", {
1036
1036
  style: {
1037
1037
  display: "flex",
1038
1038
  alignItems: "stretch",
@@ -1042,7 +1042,7 @@ let __tla = (async () => {
1042
1042
  whiteSpace: "nowrap"
1043
1043
  },
1044
1044
  children: [
1045
- P("div", {
1045
+ L("div", {
1046
1046
  style: {
1047
1047
  display: "flex",
1048
1048
  alignItems: "center",
@@ -1060,7 +1060,7 @@ let __tla = (async () => {
1060
1060
  minWidth: 52,
1061
1061
  textAlign: "right"
1062
1062
  },
1063
- children: c === "inch" ? (z / 25.4).toFixed(2) : z.toFixed(1)
1063
+ children: c === "inch" ? (M / 25.4).toFixed(2) : M.toFixed(1)
1064
1064
  }),
1065
1065
  i("span", {
1066
1066
  style: {
@@ -1072,9 +1072,9 @@ let __tla = (async () => {
1072
1072
  })
1073
1073
  ]
1074
1074
  }),
1075
- n != null && z > 0 && (() => {
1076
- const I = z - n, A = I > 0.5 ? "\u25B2" : I < -0.5 ? "\u25BC" : "", L = tn(z, n);
1077
- return P("div", {
1075
+ n != null && M > 0 && (() => {
1076
+ const I = M - n, F = I > 0.5 ? "\u25B2" : I < -0.5 ? "\u25BC" : "", P = tn(M, n);
1077
+ return L("div", {
1078
1078
  style: {
1079
1079
  display: "flex",
1080
1080
  alignItems: "center",
@@ -1085,18 +1085,18 @@ let __tla = (async () => {
1085
1085
  borderLeft: "1px solid rgba(255,255,255,0.12)"
1086
1086
  },
1087
1087
  children: [
1088
- A && i("span", {
1088
+ F && i("span", {
1089
1089
  style: {
1090
1090
  fontSize: 10,
1091
- color: L,
1091
+ color: P,
1092
1092
  lineHeight: 1
1093
1093
  },
1094
- children: A
1094
+ children: F
1095
1095
  }),
1096
- P("span", {
1096
+ L("span", {
1097
1097
  style: {
1098
1098
  fontSize: 13,
1099
- color: L,
1099
+ color: P,
1100
1100
  fontFamily: "monospace",
1101
1101
  fontWeight: 600
1102
1102
  },
@@ -1105,7 +1105,7 @@ let __tla = (async () => {
1105
1105
  c === "inch" ? (I / 25.4).toFixed(2) : I.toFixed(1)
1106
1106
  ]
1107
1107
  }),
1108
- P("span", {
1108
+ L("span", {
1109
1109
  style: {
1110
1110
  fontSize: 11,
1111
1111
  color: "rgba(255,255,255,0.4)",
@@ -1125,121 +1125,121 @@ let __tla = (async () => {
1125
1125
  })
1126
1126
  ]
1127
1127
  });
1128
- }, Mo = Gn(Co), zo = ({ mesh: e, startY: r, endY: t, spacing: o, modelSize: s, onMeasurementsChange: d, reverseOrder: c = false, displayUnit: a = "mm", useInnerSurface: n = false, formMeasurements: h, originY: l, wasmSlices: f }) => {
1129
- const p = le(/* @__PURE__ */ new Map()), g = e.geometry, z = mn(g), u = j(() => {
1130
- if (f) {
1131
- let v = [
1132
- ...f.yValues
1128
+ }, Mo = Gn(Co), zo = ({ mesh: e, startY: r, endY: t, spacing: o, modelSize: l, onMeasurementsChange: s, reverseOrder: c = false, displayUnit: a = "mm", useInnerSurface: n = false, formMeasurements: h, originY: d, wasmSlices: u }) => {
1129
+ const p = le(/* @__PURE__ */ new Map()), g = e.geometry, M = mn(g), f = j(() => {
1130
+ if (u) {
1131
+ let z = [
1132
+ ...u.yValues
1133
1133
  ];
1134
1134
  if (o > 25.4 + 0.1) {
1135
- const b = f.mptY;
1136
- v = v.filter((D) => {
1137
- const w = Math.abs(D - b);
1135
+ const y = u.mptY;
1136
+ z = z.filter((D) => {
1137
+ const w = Math.abs(D - y);
1138
1138
  return w < 0.5 || Math.abs(Math.round(w / o) * o - w) < 0.5;
1139
1139
  });
1140
1140
  }
1141
- return c ? v.sort((b, D) => D - b) : v.sort((b, D) => b - D), v;
1141
+ return c ? z.sort((y, D) => D - y) : z.sort((y, D) => y - D), z;
1142
1142
  }
1143
- const L = [];
1144
- if (c) for (let y = t; y >= r; y -= o) L.push(y);
1145
- else for (let y = r; y <= t; y += o) L.push(y);
1146
- return L;
1143
+ const P = [];
1144
+ if (c) for (let b = t; b >= r; b -= o) P.push(b);
1145
+ else for (let b = r; b <= t; b += o) P.push(b);
1146
+ return P;
1147
1147
  }, [
1148
1148
  r,
1149
1149
  t,
1150
1150
  o,
1151
1151
  c,
1152
- f
1152
+ u
1153
1153
  ]), m = j(() => {
1154
- if (!f) return null;
1155
- const L = /* @__PURE__ */ new Map(), { allLoopPoints: y, offsets: v, yValues: b } = f;
1156
- for (let D = 0; D < v.length - 1; D++) {
1157
- const w = v[D], k = v[D + 1];
1158
- if (k <= w) continue;
1159
- const F = [];
1160
- for (let B = w; B < k; B += 3) F.push(new M(y[B], y[B + 1], y[B + 2]));
1161
- F.length >= 3 && L.set(b[D], F);
1154
+ if (!u) return null;
1155
+ const P = /* @__PURE__ */ new Map(), { allLoopPoints: b, offsets: z, yValues: y } = u;
1156
+ for (let D = 0; D < z.length - 1; D++) {
1157
+ const w = z[D], A = z[D + 1];
1158
+ if (A <= w) continue;
1159
+ const k = [];
1160
+ for (let B = w; B < A; B += 3) k.push(new C(b[B], b[B + 1], b[B + 2]));
1161
+ k.length >= 3 && P.set(y[D], k);
1162
1162
  }
1163
- return L;
1163
+ return P;
1164
1164
  }, [
1165
- f
1165
+ u
1166
1166
  ]), x = j(() => {
1167
- if (!f) return null;
1168
- const L = /* @__PURE__ */ new Map();
1169
- for (let y = 0; y < f.yValues.length; y++) L.set(f.yValues[y], f.circumferences[y]);
1170
- return L;
1167
+ if (!u) return null;
1168
+ const P = /* @__PURE__ */ new Map();
1169
+ for (let b = 0; b < u.yValues.length; b++) P.set(u.yValues[b], u.circumferences[b]);
1170
+ return P;
1171
1171
  }, [
1172
- f
1172
+ u
1173
1173
  ]);
1174
- ne(() => {
1174
+ re(() => {
1175
1175
  p.current.clear();
1176
1176
  }, [
1177
- u
1178
- ]), ne(() => {
1179
- if (!x || !d) return;
1180
- const L = u.filter((y) => (x.get(y) ?? 0) > 0).map((y) => ({
1181
- yPosition: y,
1182
- originalValue: x.get(y) ?? 0,
1177
+ f
1178
+ ]), re(() => {
1179
+ if (!x || !s) return;
1180
+ const P = f.filter((b) => (x.get(b) ?? 0) > 0).map((b) => ({
1181
+ yPosition: b,
1182
+ originalValue: x.get(b) ?? 0,
1183
1183
  modifiedValue: null
1184
1184
  }));
1185
- d(L);
1185
+ s(P);
1186
1186
  }, [
1187
1187
  x,
1188
- u,
1189
- d
1188
+ f,
1189
+ s
1190
1190
  ]);
1191
1191
  const S = [
1192
1192
  "#5B9BD5"
1193
- ], I = s * no, A = re((L) => {
1193
+ ], I = l * no, F = oe((P) => {
1194
1194
  if (x) return;
1195
- p.current.set(L.yPosition, L);
1196
- const y = Array.from(p.current.values()).sort((v, b) => c ? b.yPosition - v.yPosition : v.yPosition - b.yPosition);
1197
- d == null ? void 0 : d(y);
1195
+ p.current.set(P.yPosition, P);
1196
+ const b = Array.from(p.current.values()).sort((z, y) => c ? y.yPosition - z.yPosition : z.yPosition - y.yPosition);
1197
+ s == null ? void 0 : s(b);
1198
1198
  }, [
1199
- d,
1199
+ s,
1200
1200
  c,
1201
1201
  x
1202
1202
  ]);
1203
- return z ? i(Te, {
1204
- children: u.map((L, y) => i(Mo, {
1205
- bvh: z,
1203
+ return M ? i(Te, {
1204
+ children: f.map((P, b) => i(Mo, {
1205
+ bvh: M,
1206
1206
  geometry: g,
1207
- yPosition: L,
1208
- color: l != null && Math.abs(L - l) < o * 0.5 ? "#44ff44" : S[y % S.length],
1207
+ yPosition: P,
1208
+ color: d != null && Math.abs(P - d) < o * 0.5 ? "#44ff44" : S[b % S.length],
1209
1209
  labelX: I,
1210
- onDataChange: A,
1210
+ onDataChange: F,
1211
1211
  displayUnit: a,
1212
1212
  useInnerSurface: n,
1213
- formValue: h == null ? void 0 : h[y],
1214
- lineWidth: l != null && Math.abs(L - l) < o * 0.5 ? 4 : 1.5,
1215
- wasmLoopPoints: m == null ? void 0 : m.get(L),
1216
- wasmCircumference: x == null ? void 0 : x.get(L)
1217
- }, L))
1213
+ formValue: h == null ? void 0 : h[b],
1214
+ lineWidth: d != null && Math.abs(P - d) < o * 0.5 ? 4 : 1.5,
1215
+ wasmLoopPoints: m == null ? void 0 : m.get(P),
1216
+ wasmCircumference: x == null ? void 0 : x.get(P)
1217
+ }, P))
1218
1218
  }) : null;
1219
- }, Ao = ({ mesh: e, greenY: r, modelSize: t, displayUnit: o = "mm", bottomY: s }) => {
1219
+ }, Ao = ({ mesh: e, greenY: r, modelSize: t, displayUnit: o = "mm", bottomY: l }) => {
1220
1220
  var _a;
1221
- const d = e.geometry;
1222
- d.computeBoundingBox();
1223
- const c = s ?? ((_a = d.boundingBox) == null ? void 0 : _a.min.y) ?? 0, a = r - c, n = t * 0.4, h = t * 0.03, l = le(null);
1221
+ const s = e.geometry;
1222
+ s.computeBoundingBox();
1223
+ const c = l ?? ((_a = s.boundingBox) == null ? void 0 : _a.min.y) ?? 0, a = r - c, n = t * 0.4, h = t * 0.03, d = le(null);
1224
1224
  rn(({ camera: S }) => {
1225
- if (!l.current) return;
1226
- const I = new M();
1225
+ if (!d.current) return;
1226
+ const I = new C();
1227
1227
  S.getWorldDirection(I);
1228
- const A = new M(I.x, 0, I.z);
1229
- if (A.lengthSq() < 1e-8) return;
1230
- A.normalize();
1231
- const L = new M().crossVectors(new M(0, 1, 0), A).normalize();
1232
- l.current.position.set(L.x * n, 0, L.z * n);
1233
- const y = S.position.x - l.current.position.x, v = S.position.z - l.current.position.z;
1234
- l.current.rotation.y = Math.atan2(y, v);
1228
+ const F = new C(I.x, 0, I.z);
1229
+ if (F.lengthSq() < 1e-8) return;
1230
+ F.normalize();
1231
+ const P = new C().crossVectors(new C(0, 1, 0), F).normalize();
1232
+ d.current.position.set(P.x * n, 0, P.z * n);
1233
+ const b = S.position.x - d.current.position.x, z = S.position.z - d.current.position.z;
1234
+ d.current.rotation.y = Math.atan2(b, z);
1235
1235
  });
1236
- const f = new M(0, r, 0), p = new M(0, c, 0), g = new M(0, (r + c) / 2, 0), z = new M(-h, r, 0), u = new M(h, r, 0), m = new M(-h, c, 0), x = new M(h, c, 0);
1237
- return P("group", {
1238
- ref: l,
1236
+ const u = new C(0, r, 0), p = new C(0, c, 0), g = new C(0, (r + c) / 2, 0), M = new C(-h, r, 0), f = new C(h, r, 0), m = new C(-h, c, 0), x = new C(h, c, 0);
1237
+ return L("group", {
1238
+ ref: d,
1239
1239
  children: [
1240
1240
  i(de, {
1241
1241
  points: [
1242
- f,
1242
+ u,
1243
1243
  p
1244
1244
  ],
1245
1245
  color: "#888888",
@@ -1247,8 +1247,8 @@ let __tla = (async () => {
1247
1247
  }),
1248
1248
  i(de, {
1249
1249
  points: [
1250
- z,
1251
- u
1250
+ M,
1251
+ f
1252
1252
  ],
1253
1253
  color: "#888888",
1254
1254
  lineWidth: 1.5
@@ -1272,7 +1272,7 @@ let __tla = (async () => {
1272
1272
  0,
1273
1273
  0
1274
1274
  ],
1275
- children: P("div", {
1275
+ children: L("div", {
1276
1276
  style: {
1277
1277
  padding: "4px 8px",
1278
1278
  backgroundColor: "rgba(0, 0, 0, 0.7)",
@@ -1295,92 +1295,92 @@ let __tla = (async () => {
1295
1295
  })
1296
1296
  ]
1297
1297
  });
1298
- }, ko = ({ modelSize: e, isAligned: r, isCut: t, mesh: o, viewMode: s, sliceY: d, landmarkCount: c = 0, measurementGeometry: a, resetCameraToFrontRef: n }) => {
1299
- const { set: h, size: l, camera: f, invalidate: p } = sn(), g = le(false), z = le(s), u = le(new M()), m = le(null), x = le(c), S = le(r), I = le(t), A = le(a), L = le(0), y = re(() => {
1298
+ }, ko = ({ modelSize: e, isAligned: r, isCut: t, mesh: o, viewMode: l, sliceY: s, landmarkCount: c = 0, measurementGeometry: a, resetCameraToFrontRef: n }) => {
1299
+ const { set: h, size: d, camera: u, invalidate: p } = sn(), g = le(false), M = le(l), f = le(new C()), m = le(null), x = le(c), S = le(r), I = le(t), F = le(a), P = le(0), b = oe(() => {
1300
1300
  if (!o || e <= 0) return null;
1301
- const b = a ?? o.geometry;
1302
- b.computeBoundingBox();
1303
- const D = b.boundingBox, w = new M();
1301
+ const y = a ?? o.geometry;
1302
+ y.computeBoundingBox();
1303
+ const D = y.boundingBox, w = new C();
1304
1304
  D.getCenter(w);
1305
- const k = new M();
1306
- D.getSize(k), u.current.copy(k);
1307
- const F = l.width / l.height, B = Math.max(k.y, k.x / F) * 1.6, $ = B * F, N = w.y - k.y * 0.05;
1308
- L.current = N;
1305
+ const A = new C();
1306
+ D.getSize(A), f.current.copy(A);
1307
+ const k = d.width / d.height, B = Math.max(A.y, A.x / k) * 1.6, $ = B * k, N = w.y - A.y * 0.05;
1308
+ P.current = N;
1309
1309
  const U = new O.OrthographicCamera(-$ / 2, $ / 2, B / 2, -B / 2, 0.1, e * 10);
1310
1310
  return U.position.set(0, N, e * 2), U.lookAt(0, N, 0), U;
1311
1311
  }, [
1312
1312
  o,
1313
1313
  e,
1314
- l,
1314
+ d,
1315
1315
  a
1316
1316
  ]);
1317
- ne(() => {
1317
+ re(() => {
1318
1318
  if (n) return n.current = () => {
1319
- const b = y();
1320
- b && (h({
1321
- camera: b
1319
+ const y = b();
1320
+ y && (h({
1321
+ camera: y
1322
1322
  }), p());
1323
1323
  }, () => {
1324
1324
  n && (n.current = null);
1325
1325
  };
1326
1326
  }, [
1327
1327
  n,
1328
- y,
1328
+ b,
1329
1329
  h,
1330
1330
  p
1331
1331
  ]);
1332
- const v = re((b) => {
1333
- const D = b.position.clone(), w = D.length(), k = Math.atan2(D.x, D.z), F = Math.acos(D.y / w), $ = k + 0.02;
1334
- b.position.set(w * Math.sin(F) * Math.sin($), w * Math.cos(F), w * Math.sin(F) * Math.cos($)), b.lookAt(0, 0, 0), b.updateMatrixWorld(true), p();
1332
+ const z = oe((y) => {
1333
+ const D = y.position.clone(), w = D.length(), A = Math.atan2(D.x, D.z), k = Math.acos(D.y / w), $ = A + 0.02;
1334
+ y.position.set(w * Math.sin(k) * Math.sin($), w * Math.cos(k), w * Math.sin(k) * Math.cos($)), y.lookAt(0, 0, 0), y.updateMatrixWorld(true), p();
1335
1335
  }, [
1336
1336
  p
1337
1337
  ]);
1338
- return ne(() => {
1338
+ return re(() => {
1339
1339
  if (e > 0 && !g.current && !r) {
1340
1340
  g.current = true;
1341
- const b = new O.PerspectiveCamera(50, l.width / l.height, 0.1, e * 10);
1342
- b.position.set(e * 0.3, e * 0.2, e * 1.5), b.lookAt(0, 0, 0), h({
1343
- camera: b
1344
- }), requestAnimationFrame(() => v(b));
1341
+ const y = new O.PerspectiveCamera(50, d.width / d.height, 0.1, e * 10);
1342
+ y.position.set(e * 0.3, e * 0.2, e * 1.5), y.lookAt(0, 0, 0), h({
1343
+ camera: y
1344
+ }), requestAnimationFrame(() => z(y));
1345
1345
  }
1346
1346
  }, [
1347
1347
  e,
1348
- l,
1348
+ d,
1349
1349
  h,
1350
1350
  r,
1351
- v
1352
- ]), ne(() => {
1353
- const b = x.current;
1354
- x.current = c, b === 0 && c === 1 && !r && requestAnimationFrame(() => v(f));
1351
+ z
1352
+ ]), re(() => {
1353
+ const y = x.current;
1354
+ x.current = c, y === 0 && c === 1 && !r && requestAnimationFrame(() => z(u));
1355
1355
  }, [
1356
1356
  c,
1357
1357
  r,
1358
- f,
1359
- v
1360
- ]), ne(() => {
1361
- const b = S.current !== r, D = I.current !== t, w = !A.current && !!a;
1362
- if (S.current = r, I.current = t, A.current = a, !b && !D && !w || !r || s !== "3D") return;
1363
- const k = y();
1364
- k && h({
1365
- camera: k
1358
+ u,
1359
+ z
1360
+ ]), re(() => {
1361
+ const y = S.current !== r, D = I.current !== t, w = !F.current && !!a;
1362
+ if (S.current = r, I.current = t, F.current = a, !y && !D && !w || !r || l !== "3D") return;
1363
+ const A = b();
1364
+ A && h({
1365
+ camera: A
1366
1366
  });
1367
1367
  }, [
1368
1368
  r,
1369
1369
  t,
1370
- s,
1370
+ l,
1371
1371
  a,
1372
- y,
1372
+ b,
1373
1373
  h
1374
- ]), ne(() => {
1375
- if (z.current === s) return;
1376
- const b = z.current;
1377
- if (z.current = s, !(!r || !o || e <= 0)) {
1378
- if (s === "2D" && d != null) {
1379
- m.current = f;
1380
- const D = o.geometry, w = D.getAttribute("position"), k = w.array, F = e * 0.15;
1374
+ ]), re(() => {
1375
+ if (M.current === l) return;
1376
+ const y = M.current;
1377
+ if (M.current = l, !(!r || !o || e <= 0)) {
1378
+ if (l === "2D" && s != null) {
1379
+ m.current = u;
1380
+ const D = o.geometry, w = D.getAttribute("position"), A = w.array, k = e * 0.15;
1381
1381
  let B = 1 / 0, $ = -1 / 0, N = 1 / 0, U = -1 / 0, be = false;
1382
- for (let ue = 0; ue < w.count; ue++) if (Math.abs(k[ue * 3 + 1] - d) < F) {
1383
- const H = k[ue * 3], q = k[ue * 3 + 2];
1382
+ for (let ue = 0; ue < w.count; ue++) if (Math.abs(A[ue * 3 + 1] - s) < k) {
1383
+ const H = A[ue * 3], q = A[ue * 3 + 2];
1384
1384
  H < B && (B = H), H > $ && ($ = H), q < N && (N = q), q > U && (U = q), be = true;
1385
1385
  }
1386
1386
  if (!be) {
@@ -1388,42 +1388,42 @@ let __tla = (async () => {
1388
1388
  const ue = D.boundingBox;
1389
1389
  B = ue.min.x, $ = ue.max.x, N = ue.min.z, U = ue.max.z;
1390
1390
  }
1391
- const ae = (B + $) / 2, fe = (N + U) / 2, ie = l.width / l.height, J = 1.4, Y = ($ - B) * J, pe = (U - N) * J;
1391
+ const ae = (B + $) / 2, fe = (N + U) / 2, ie = d.width / d.height, J = 1.4, Y = ($ - B) * J, pe = (U - N) * J;
1392
1392
  let Z, he;
1393
1393
  Y / pe > ie ? (Z = Y, he = Y / ie) : (he = pe, Z = pe * ie);
1394
1394
  const me = new O.OrthographicCamera(-Z / 2, Z / 2, he / 2, -he / 2, 0.1, e * 10);
1395
- me.position.set(ae, d + e * 2, fe), me.up.set(0, 0, -1), me.lookAt(ae, d, fe), h({
1395
+ me.position.set(ae, s + e * 2, fe), me.up.set(0, 0, -1), me.lookAt(ae, s, fe), h({
1396
1396
  camera: me
1397
1397
  });
1398
- } else if (b === "2D") if (m.current) h({
1398
+ } else if (y === "2D") if (m.current) h({
1399
1399
  camera: m.current
1400
1400
  }), m.current = null;
1401
1401
  else {
1402
- const D = y();
1402
+ const D = b();
1403
1403
  D && h({
1404
1404
  camera: D
1405
1405
  });
1406
1406
  }
1407
1407
  }
1408
1408
  }, [
1409
+ l,
1409
1410
  s,
1410
- d,
1411
1411
  r,
1412
1412
  o,
1413
1413
  e,
1414
- l,
1414
+ d,
1415
1415
  h,
1416
- f,
1417
- y
1418
- ]), ne(() => {
1419
- if (!r || !f || !f.isOrthographicCamera) return;
1420
- const b = f;
1421
- if (s === "2D") {
1422
- if (!o || d == null) return;
1423
- const D = o.geometry, w = D.getAttribute("position"), k = w.array, F = e * 0.15;
1416
+ u,
1417
+ b
1418
+ ]), re(() => {
1419
+ if (!r || !u || !u.isOrthographicCamera) return;
1420
+ const y = u;
1421
+ if (l === "2D") {
1422
+ if (!o || s == null) return;
1423
+ const D = o.geometry, w = D.getAttribute("position"), A = w.array, k = e * 0.15;
1424
1424
  let B = 1 / 0, $ = -1 / 0, N = 1 / 0, U = -1 / 0, be = false;
1425
- for (let Z = 0; Z < w.count; Z++) if (Math.abs(k[Z * 3 + 1] - d) < F) {
1426
- const he = k[Z * 3], me = k[Z * 3 + 2];
1425
+ for (let Z = 0; Z < w.count; Z++) if (Math.abs(A[Z * 3 + 1] - s) < k) {
1426
+ const he = A[Z * 3], me = A[Z * 3 + 2];
1427
1427
  he < B && (B = he), he > $ && ($ = he), me < N && (N = me), me > U && (U = me), be = true;
1428
1428
  }
1429
1429
  if (!be) {
@@ -1431,27 +1431,27 @@ let __tla = (async () => {
1431
1431
  const Z = D.boundingBox;
1432
1432
  B = Z.min.x, $ = Z.max.x, N = Z.min.z, U = Z.max.z;
1433
1433
  }
1434
- const ae = l.width / l.height, fe = 1.4, ie = ($ - B) * fe, J = (U - N) * fe;
1434
+ const ae = d.width / d.height, fe = 1.4, ie = ($ - B) * fe, J = (U - N) * fe;
1435
1435
  let Y, pe;
1436
- ie / J > ae ? (Y = ie, pe = ie / ae) : (pe = J, Y = J * ae), b.left = -Y / 2, b.right = Y / 2, b.top = pe / 2, b.bottom = -pe / 2;
1436
+ ie / J > ae ? (Y = ie, pe = ie / ae) : (pe = J, Y = J * ae), y.left = -Y / 2, y.right = Y / 2, y.top = pe / 2, y.bottom = -pe / 2;
1437
1437
  } else {
1438
- const D = u.current, w = l.width / l.height, k = Math.max(D.y, D.x / w) * 1.6, F = k * w;
1439
- b.left = -F / 2, b.right = F / 2, b.top = k / 2, b.bottom = -k / 2;
1438
+ const D = f.current, w = d.width / d.height, A = Math.max(D.y, D.x / w) * 1.6, k = A * w;
1439
+ y.left = -k / 2, y.right = k / 2, y.top = A / 2, y.bottom = -A / 2;
1440
1440
  }
1441
- b.updateProjectionMatrix();
1441
+ y.updateProjectionMatrix();
1442
1442
  }, [
1443
- l.width,
1444
- l.height,
1443
+ d.width,
1444
+ d.height,
1445
1445
  r,
1446
- f,
1447
- s,
1446
+ u,
1447
+ l,
1448
1448
  o
1449
1449
  ]), null;
1450
1450
  }, Fo = ({ mesh: e, isDragging: r }) => {
1451
1451
  var _a;
1452
1452
  const t = e.geometry;
1453
1453
  t.computeBoundingBox();
1454
- const o = new M();
1454
+ const o = new C();
1455
1455
  return (_a = t.boundingBox) == null ? void 0 : _a.getCenter(o), i(ln, {
1456
1456
  enableDamping: false,
1457
1457
  enablePan: false,
@@ -1466,7 +1466,7 @@ let __tla = (async () => {
1466
1466
  o.z
1467
1467
  ]
1468
1468
  });
1469
- }, Lo = ({ wasAutoScaled: e, onDismiss: r }) => P("div", {
1469
+ }, Lo = ({ wasAutoScaled: e, onDismiss: r }) => L("div", {
1470
1470
  style: {
1471
1471
  position: "absolute",
1472
1472
  bottom: 16,
@@ -1507,7 +1507,7 @@ let __tla = (async () => {
1507
1507
  children: "X"
1508
1508
  })
1509
1509
  ]
1510
- }), Po = ({ isDoubleShell: e, onDismiss: r }) => P("div", {
1510
+ }), Po = ({ isDoubleShell: e, onDismiss: r }) => L("div", {
1511
1511
  style: {
1512
1512
  position: "absolute",
1513
1513
  bottom: 68,
@@ -1557,14 +1557,14 @@ let __tla = (async () => {
1557
1557
  padding: "24px 24px",
1558
1558
  flexShrink: 0
1559
1559
  },
1560
- children: e.map((o, s) => {
1561
- const d = o.number < r, c = o.number === r;
1562
- return P("div", {
1560
+ children: e.map((o, l) => {
1561
+ const s = o.number < r, c = o.number === r;
1562
+ return L("div", {
1563
1563
  style: {
1564
1564
  display: "contents"
1565
1565
  },
1566
1566
  children: [
1567
- P("div", {
1567
+ L("div", {
1568
1568
  style: {
1569
1569
  display: "flex",
1570
1570
  alignItems: "center",
@@ -1579,7 +1579,7 @@ let __tla = (async () => {
1579
1579
  width: 24,
1580
1580
  height: 24,
1581
1581
  borderRadius: "50%",
1582
- backgroundColor: d || c ? t : "rgba(0, 0, 0, 0.38)",
1582
+ backgroundColor: s || c ? t : "rgba(0, 0, 0, 0.38)",
1583
1583
  color: "#fff",
1584
1584
  display: "flex",
1585
1585
  alignItems: "center",
@@ -1588,7 +1588,7 @@ let __tla = (async () => {
1588
1588
  fontFamily: "system-ui, sans-serif",
1589
1589
  flexShrink: 0
1590
1590
  },
1591
- children: d ? "\u2713" : o.number
1591
+ children: s ? "\u2713" : o.number
1592
1592
  }),
1593
1593
  i("div", {
1594
1594
  style: {
@@ -1602,7 +1602,7 @@ let __tla = (async () => {
1602
1602
  })
1603
1603
  ]
1604
1604
  }),
1605
- s < e.length - 1 && i("div", {
1605
+ l < e.length - 1 && i("div", {
1606
1606
  style: {
1607
1607
  flex: "auto",
1608
1608
  borderTop: "1px solid #bdbdbd",
@@ -1612,7 +1612,7 @@ let __tla = (async () => {
1612
1612
  ]
1613
1613
  }, o.number);
1614
1614
  })
1615
- }), _o = ({ mesh: e, upperY: r, originY: t, modelSize: o, meshColor: s = "#c8c8c8", displayUnit: d = "mm" }) => {
1615
+ }), _o = ({ mesh: e, upperY: r, originY: t, modelSize: o, meshColor: l = "#c8c8c8", displayUnit: s = "mm" }) => {
1616
1616
  const c = e.geometry, a = j(() => new ft(c, {
1617
1617
  maxLeafTris: ut
1618
1618
  }), [
@@ -1621,19 +1621,19 @@ let __tla = (async () => {
1621
1621
  a,
1622
1622
  c,
1623
1623
  t
1624
- ]), h = j(() => new dt(new M(0, -1, 0), r), [
1624
+ ]), h = j(() => new dt(new C(0, -1, 0), r), [
1625
1625
  r
1626
- ]), { mlLine: l, apLine: f, mlWidth: p, apWidth: g } = j(() => {
1626
+ ]), { mlLine: d, apLine: u, mlWidth: p, apWidth: g } = j(() => {
1627
1627
  let m = null, x = null, S = 0, I = 0;
1628
1628
  if (n.linePoints.length >= 2) {
1629
- let A = n.linePoints[0], L = n.linePoints[0], y = n.linePoints[0], v = n.linePoints[0];
1630
- for (const b of n.linePoints) b.x < A.x && (A = b), b.x > L.x && (L = b), b.z < y.z && (y = b), b.z > v.z && (v = b);
1629
+ let F = n.linePoints[0], P = n.linePoints[0], b = n.linePoints[0], z = n.linePoints[0];
1630
+ for (const y of n.linePoints) y.x < F.x && (F = y), y.x > P.x && (P = y), y.z < b.z && (b = y), y.z > z.z && (z = y);
1631
1631
  m = [
1632
- new M(A.x, t, A.z),
1633
- new M(L.x, t, L.z)
1632
+ new C(F.x, t, F.z),
1633
+ new C(P.x, t, P.z)
1634
1634
  ], x = [
1635
- new M(y.x, t, y.z),
1636
- new M(v.x, t, v.z)
1635
+ new C(b.x, t, b.z),
1636
+ new C(z.x, t, z.z)
1637
1637
  ], S = m[0].distanceTo(m[1]), I = x[0].distanceTo(x[1]);
1638
1638
  }
1639
1639
  return {
@@ -1645,13 +1645,13 @@ let __tla = (async () => {
1645
1645
  }, [
1646
1646
  n,
1647
1647
  t
1648
- ]), z = (m) => d === "inch" ? (m / 25.4).toFixed(2) : m.toFixed(1), u = d === "inch" ? "in" : "mm";
1649
- return P(Te, {
1648
+ ]), M = (m) => s === "inch" ? (m / 25.4).toFixed(2) : m.toFixed(1), f = s === "inch" ? "in" : "mm";
1649
+ return L(Te, {
1650
1650
  children: [
1651
1651
  i("mesh", {
1652
1652
  geometry: e.geometry,
1653
1653
  children: i("meshStandardMaterial", {
1654
- color: s,
1654
+ color: l,
1655
1655
  side: O.DoubleSide,
1656
1656
  transparent: true,
1657
1657
  opacity: 0.15,
@@ -1669,10 +1669,10 @@ let __tla = (async () => {
1669
1669
  depthWrite: false,
1670
1670
  transparent: true
1671
1671
  }),
1672
- l && P(Te, {
1672
+ d && L(Te, {
1673
1673
  children: [
1674
1674
  i(de, {
1675
- points: l,
1675
+ points: d,
1676
1676
  color: "#ff8800",
1677
1677
  lineWidth: 2,
1678
1678
  depthTest: false,
@@ -1681,9 +1681,9 @@ let __tla = (async () => {
1681
1681
  }),
1682
1682
  i(Ye, {
1683
1683
  position: [
1684
- l[0].x,
1684
+ d[0].x,
1685
1685
  t,
1686
- l[0].z - o * 0.02
1686
+ d[0].z - o * 0.02
1687
1687
  ],
1688
1688
  center: true,
1689
1689
  style: {
@@ -1696,7 +1696,7 @@ let __tla = (async () => {
1696
1696
  backgroundColor: "rgba(0,0,0,0.75)",
1697
1697
  borderRadius: 3
1698
1698
  },
1699
- children: P("span", {
1699
+ children: L("span", {
1700
1700
  style: {
1701
1701
  fontSize: 12,
1702
1702
  color: "#ff8800",
@@ -1704,19 +1704,19 @@ let __tla = (async () => {
1704
1704
  },
1705
1705
  children: [
1706
1706
  "ML ",
1707
- z(p),
1707
+ M(p),
1708
1708
  " ",
1709
- u
1709
+ f
1710
1710
  ]
1711
1711
  })
1712
1712
  })
1713
1713
  })
1714
1714
  ]
1715
1715
  }),
1716
- f && P(Te, {
1716
+ u && L(Te, {
1717
1717
  children: [
1718
1718
  i(de, {
1719
- points: f,
1719
+ points: u,
1720
1720
  color: "#ff00ff",
1721
1721
  lineWidth: 2,
1722
1722
  depthTest: false,
@@ -1725,9 +1725,9 @@ let __tla = (async () => {
1725
1725
  }),
1726
1726
  i(Ye, {
1727
1727
  position: [
1728
- Math.max(f[0].x, f[1].x) + o * 0.02,
1728
+ Math.max(u[0].x, u[1].x) + o * 0.02,
1729
1729
  t,
1730
- f[0].z > f[1].z ? f[0].z : f[1].z
1730
+ u[0].z > u[1].z ? u[0].z : u[1].z
1731
1731
  ],
1732
1732
  center: true,
1733
1733
  style: {
@@ -1740,7 +1740,7 @@ let __tla = (async () => {
1740
1740
  backgroundColor: "rgba(0,0,0,0.75)",
1741
1741
  borderRadius: 3
1742
1742
  },
1743
- children: P("span", {
1743
+ children: L("span", {
1744
1744
  style: {
1745
1745
  fontSize: 12,
1746
1746
  color: "#ff00ff",
@@ -1748,9 +1748,9 @@ let __tla = (async () => {
1748
1748
  },
1749
1749
  children: [
1750
1750
  "AP ",
1751
- z(g),
1751
+ M(g),
1752
1752
  " ",
1753
- u
1753
+ f
1754
1754
  ]
1755
1755
  })
1756
1756
  })
@@ -1759,73 +1759,73 @@ let __tla = (async () => {
1759
1759
  })
1760
1760
  ]
1761
1761
  });
1762
- }, Do = ({ mesh: e, yPosition: r, onYChange: t, minY: o, maxY: s, modelSize: d, color: c, hoverColor: a, dragColor: n, label: h, onDragStart: l, onDragEnd: f }) => {
1763
- const [p, g] = W(false), [z, u] = W(false), { camera: m, gl: x } = sn(), S = le(0), I = e.geometry, A = mn(I), L = j(() => A ? Ne(A, I, r) : {
1762
+ }, Do = ({ mesh: e, yPosition: r, onYChange: t, minY: o, maxY: l, modelSize: s, color: c, hoverColor: a, dragColor: n, label: h, onDragStart: d, onDragEnd: u }) => {
1763
+ const [p, g] = E(false), [M, f] = E(false), { camera: m, gl: x } = sn(), S = le(0), I = e.geometry, F = mn(I), P = j(() => F ? Ne(F, I, r) : {
1764
1764
  linePoints: [],
1765
1765
  lineLength: 0,
1766
- rightmostPoint: new M()
1766
+ rightmostPoint: new C()
1767
1767
  }, [
1768
- A,
1768
+ F,
1769
1769
  I,
1770
1770
  r
1771
- ]), y = re((k, F) => {
1772
- const B = x.domElement.getBoundingClientRect(), $ = (k - B.left) / B.width * 2 - 1, N = -((F - B.top) / B.height) * 2 + 1, U = new Un();
1771
+ ]), b = oe((A, k) => {
1772
+ const B = x.domElement.getBoundingClientRect(), $ = (A - B.left) / B.width * 2 - 1, N = -((k - B.top) / B.height) * 2 + 1, U = new Un();
1773
1773
  U.setFromCamera(new O.Vector2($, N), m);
1774
- const be = new dt(new M(0, 0, 1), 0), ae = new M();
1774
+ const be = new dt(new C(0, 0, 1), 0), ae = new C();
1775
1775
  return U.ray.intersectPlane(be, ae), ae ? ae.y : r;
1776
1776
  }, [
1777
1777
  m,
1778
1778
  x,
1779
1779
  r
1780
- ]), v = re((k) => {
1781
- k.stopPropagation(), g(true), x.domElement.style.cursor = "ns-resize", S.current = r - y(k.clientX, k.clientY), k.target.setPointerCapture(k.pointerId), l == null ? void 0 : l();
1780
+ ]), z = oe((A) => {
1781
+ A.stopPropagation(), g(true), x.domElement.style.cursor = "ns-resize", S.current = r - b(A.clientX, A.clientY), A.target.setPointerCapture(A.pointerId), d == null ? void 0 : d();
1782
1782
  }, [
1783
1783
  r,
1784
1784
  x,
1785
- y,
1786
- l
1787
- ]), b = re((k) => {
1785
+ b,
1786
+ d
1787
+ ]), y = oe((A) => {
1788
1788
  if (!p) return;
1789
- let F = y(k.clientX, k.clientY) + S.current;
1790
- F = Math.max(o, Math.min(s, F)), t(F);
1789
+ let k = b(A.clientX, A.clientY) + S.current;
1790
+ k = Math.max(o, Math.min(l, k)), t(k);
1791
1791
  }, [
1792
1792
  p,
1793
- y,
1793
+ b,
1794
1794
  t,
1795
1795
  o,
1796
- s
1797
- ]), D = re((k) => {
1798
- g(false), x.domElement.style.cursor = "auto", k.target.releasePointerCapture(k.pointerId), f == null ? void 0 : f();
1796
+ l
1797
+ ]), D = oe((A) => {
1798
+ g(false), x.domElement.style.cursor = "auto", A.target.releasePointerCapture(A.pointerId), u == null ? void 0 : u();
1799
1799
  }, [
1800
1800
  x,
1801
- f
1801
+ u
1802
1802
  ]);
1803
- if (L.linePoints.length < 2) return null;
1804
- const w = p ? n : z ? a : c;
1805
- return P("group", {
1803
+ if (P.linePoints.length < 2) return null;
1804
+ const w = p ? n : M ? a : c;
1805
+ return L("group", {
1806
1806
  renderOrder: 10,
1807
1807
  children: [
1808
1808
  i(de, {
1809
- points: L.linePoints,
1809
+ points: P.linePoints,
1810
1810
  color: w,
1811
- lineWidth: p ? 6 : z ? 5 : 4,
1811
+ lineWidth: p ? 6 : M ? 5 : 4,
1812
1812
  depthTest: false,
1813
1813
  depthWrite: false,
1814
1814
  transparent: true,
1815
1815
  renderOrder: 10,
1816
- onPointerDown: v,
1817
- onPointerMove: b,
1816
+ onPointerDown: z,
1817
+ onPointerMove: y,
1818
1818
  onPointerUp: D,
1819
1819
  onPointerEnter: () => {
1820
- u(true), x.domElement.style.cursor = "ns-resize";
1820
+ f(true), x.domElement.style.cursor = "ns-resize";
1821
1821
  },
1822
1822
  onPointerLeave: () => {
1823
- p || (u(false), x.domElement.style.cursor = "auto");
1823
+ p || (f(false), x.domElement.style.cursor = "auto");
1824
1824
  }
1825
1825
  }),
1826
- (z || p) && i("mesh", {
1826
+ (M || p) && i("mesh", {
1827
1827
  position: [
1828
- L.rightmostPoint.x + d * 0.15,
1828
+ P.rightmostPoint.x + s * 0.15,
1829
1829
  r,
1830
1830
  0
1831
1831
  ],
@@ -1850,21 +1850,21 @@ let __tla = (async () => {
1850
1850
  };
1851
1851
  function Bo(e, r) {
1852
1852
  if (e == null) return {};
1853
- var t = {}, o = Object.keys(e), s, d;
1854
- for (d = 0; d < o.length; d++) s = o[d], !(r.indexOf(s) >= 0) && (t[s] = e[s]);
1853
+ var t = {}, o = Object.keys(e), l, s;
1854
+ for (s = 0; s < o.length; s++) l = o[s], !(r.indexOf(l) >= 0) && (t[l] = e[l]);
1855
1855
  return t;
1856
1856
  }
1857
1857
  var Ro = [
1858
1858
  "color"
1859
1859
  ], Wo = Zn(function(e, r) {
1860
- var t = e.color, o = t === void 0 ? "currentColor" : t, s = Bo(e, Ro);
1860
+ var t = e.color, o = t === void 0 ? "currentColor" : t, l = Bo(e, Ro);
1861
1861
  return Jt("svg", Object.assign({
1862
1862
  width: "15",
1863
1863
  height: "15",
1864
1864
  viewBox: "0 0 15 15",
1865
1865
  fill: "none",
1866
1866
  xmlns: "http://www.w3.org/2000/svg"
1867
- }, s, {
1867
+ }, l, {
1868
1868
  ref: r
1869
1869
  }), Jt("path", {
1870
1870
  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",
@@ -1897,62 +1897,62 @@ let __tla = (async () => {
1897
1897
  outline: "none",
1898
1898
  boxSizing: "border-box",
1899
1899
  fontFamily: "system-ui, sans-serif"
1900
- }, To = ({ amputationType: e, spacingInches: r, scanMeasurements: t, scanFrontalHeight: o, onSave: s, onSkip: d }) => {
1900
+ }, To = ({ amputationType: e, spacingInches: r, scanMeasurements: t, scanFrontalHeight: o, onSave: l, onSkip: s }) => {
1901
1901
  const c = e === "AK" ? "IT" : "MPT", a = r, n = e === "AK" ? 18 : 9, h = j(() => {
1902
1902
  const w = [];
1903
- for (let k = 2; k >= 1; k -= a) w.push(`${k}\u2033 above ${c}`);
1903
+ for (let A = 2; A >= 1; A -= a) w.push(`${A}\u2033 above ${c}`);
1904
1904
  w.push(`At ${c}`);
1905
- for (let k = a; k <= n; k += a) w.push(`${k}\u2033 below ${c}`);
1905
+ for (let A = a; A <= n; A += a) w.push(`${A}\u2033 below ${c}`);
1906
1906
  return w;
1907
1907
  }, [
1908
1908
  a,
1909
1909
  c,
1910
1910
  n
1911
- ]), [l, f] = W({}), [p, g] = W(""), [z, u] = W(false), [m, x] = W(false), [S, I] = W(null), [A, L] = W(""), y = j(() => {
1912
- const w = p !== "" && !isNaN(parseFloat(p)), k = h.some((F) => {
1913
- const B = l[F];
1911
+ ]), [d, u] = E({}), [p, g] = E(""), [M, f] = E(false), [m, x] = E(false), [S, I] = E(null), [F, P] = E(""), b = j(() => {
1912
+ const w = p !== "" && !isNaN(parseFloat(p)), A = h.some((k) => {
1913
+ const B = d[k];
1914
1914
  return B != null && B !== "" && !isNaN(parseFloat(B));
1915
1915
  });
1916
- return w || k;
1916
+ return w || A;
1917
1917
  }, [
1918
- l,
1918
+ d,
1919
1919
  p,
1920
1920
  h
1921
- ]), v = re(() => {
1922
- if (!y) return;
1923
- const w = h.map((F) => {
1924
- const B = l[F];
1921
+ ]), z = oe(() => {
1922
+ if (!b) return;
1923
+ const w = h.map((k) => {
1924
+ const B = d[k];
1925
1925
  return B != null && B !== "" && !isNaN(parseFloat(B)) ? parseFloat(B) : 0;
1926
- }), k = p !== "" && !isNaN(parseFloat(p)) ? parseFloat(p) : 0;
1927
- s({
1926
+ }), A = p !== "" && !isNaN(parseFloat(p)) ? parseFloat(p) : 0;
1927
+ l({
1928
1928
  circumferences: w,
1929
- frontalHeight: k
1929
+ frontalHeight: A
1930
1930
  });
1931
1931
  }, [
1932
- y,
1932
+ b,
1933
1933
  h,
1934
- l,
1934
+ d,
1935
1935
  p,
1936
- s
1937
- ]), b = re(() => {
1936
+ l
1937
+ ]), y = oe(() => {
1938
1938
  const w = {};
1939
- h.forEach((k, F) => {
1940
- const B = t[F];
1939
+ h.forEach((A, k) => {
1940
+ const B = t[k];
1941
1941
  if (B) {
1942
1942
  const $ = B.modifiedValue ?? B.originalValue;
1943
- w[k] = $.toFixed(1);
1943
+ w[A] = $.toFixed(1);
1944
1944
  }
1945
- }), f(w), o > 0 && g(o.toFixed(1));
1945
+ }), u(w), o > 0 && g(o.toFixed(1));
1946
1946
  }, [
1947
1947
  h,
1948
1948
  t,
1949
1949
  o
1950
- ]), D = re(() => {
1951
- u(false), x(true);
1950
+ ]), D = oe(() => {
1951
+ f(false), x(true);
1952
1952
  }, []);
1953
1953
  if (m) {
1954
- const w = S != null && (S !== "Other" || A.trim() !== ""), k = () => {
1955
- w && d(S === "Other" ? `Other: ${A.trim()}` : S);
1954
+ const w = S != null && (S !== "Other" || F.trim() !== ""), A = () => {
1955
+ w && s(S === "Other" ? `Other: ${F.trim()}` : S);
1956
1956
  };
1957
1957
  return i("div", {
1958
1958
  style: {
@@ -1967,7 +1967,7 @@ let __tla = (async () => {
1967
1967
  zIndex: 9999,
1968
1968
  fontFamily: "system-ui, sans-serif"
1969
1969
  },
1970
- children: P("div", {
1970
+ children: L("div", {
1971
1971
  style: {
1972
1972
  backgroundColor: "#fff",
1973
1973
  borderRadius: 12,
@@ -1975,7 +1975,7 @@ let __tla = (async () => {
1975
1975
  boxShadow: "0 24px 38px 3px rgba(0,0,0,0.14)"
1976
1976
  },
1977
1977
  children: [
1978
- P("div", {
1978
+ L("div", {
1979
1979
  style: {
1980
1980
  padding: "24px 24px 0"
1981
1981
  },
@@ -1998,7 +1998,7 @@ let __tla = (async () => {
1998
1998
  })
1999
1999
  ]
2000
2000
  }),
2001
- P("div", {
2001
+ L("div", {
2002
2002
  style: {
2003
2003
  padding: "20px 24px",
2004
2004
  display: "flex",
@@ -2009,7 +2009,7 @@ let __tla = (async () => {
2009
2009
  [
2010
2010
  ...Eo,
2011
2011
  "Other"
2012
- ].map((F) => P("label", {
2012
+ ].map((k) => L("label", {
2013
2013
  style: {
2014
2014
  display: "flex",
2015
2015
  alignItems: "center",
@@ -2017,15 +2017,15 @@ let __tla = (async () => {
2017
2017
  padding: "10px 12px",
2018
2018
  borderRadius: 6,
2019
2019
  cursor: "pointer",
2020
- backgroundColor: S === F ? "rgba(12, 67, 173, 0.06)" : "transparent"
2020
+ backgroundColor: S === k ? "rgba(12, 67, 173, 0.06)" : "transparent"
2021
2021
  },
2022
2022
  children: [
2023
2023
  i("input", {
2024
2024
  type: "radio",
2025
2025
  name: "skip-reason",
2026
- checked: S === F,
2026
+ checked: S === k,
2027
2027
  onChange: () => {
2028
- I(F), F !== "Other" && L("");
2028
+ I(k), k !== "Other" && P("");
2029
2029
  },
2030
2030
  style: {
2031
2031
  accentColor: "rgb(12, 67, 173)",
@@ -2040,18 +2040,18 @@ let __tla = (async () => {
2040
2040
  fontSize: 14,
2041
2041
  color: "#333"
2042
2042
  },
2043
- children: F
2043
+ children: k
2044
2044
  })
2045
2045
  ]
2046
- }, F)),
2046
+ }, k)),
2047
2047
  S === "Other" && i("input", {
2048
2048
  autoFocus: true,
2049
2049
  type: "text",
2050
2050
  placeholder: "Please describe...",
2051
- value: A,
2052
- onChange: (F) => L(F.target.value),
2053
- onKeyDown: (F) => {
2054
- F.key === "Enter" && k();
2051
+ value: F,
2052
+ onChange: (k) => P(k.target.value),
2053
+ onKeyDown: (k) => {
2054
+ k.key === "Enter" && A();
2055
2055
  },
2056
2056
  style: {
2057
2057
  ...Lt,
@@ -2063,7 +2063,7 @@ let __tla = (async () => {
2063
2063
  })
2064
2064
  ]
2065
2065
  }),
2066
- P("div", {
2066
+ L("div", {
2067
2067
  style: {
2068
2068
  display: "flex",
2069
2069
  justifyContent: "flex-end",
@@ -2074,7 +2074,7 @@ let __tla = (async () => {
2074
2074
  children: [
2075
2075
  i("button", {
2076
2076
  onClick: () => {
2077
- x(false), I(null), L("");
2077
+ x(false), I(null), P("");
2078
2078
  },
2079
2079
  style: {
2080
2080
  ...je,
@@ -2085,7 +2085,7 @@ let __tla = (async () => {
2085
2085
  children: "Cancel"
2086
2086
  }),
2087
2087
  i("button", {
2088
- onClick: k,
2088
+ onClick: A,
2089
2089
  disabled: !w,
2090
2090
  style: {
2091
2091
  ...je,
@@ -2102,7 +2102,7 @@ let __tla = (async () => {
2102
2102
  })
2103
2103
  });
2104
2104
  }
2105
- return z ? i("div", {
2105
+ return M ? i("div", {
2106
2106
  style: {
2107
2107
  position: "fixed",
2108
2108
  inset: 0,
@@ -2115,7 +2115,7 @@ let __tla = (async () => {
2115
2115
  zIndex: 9999,
2116
2116
  fontFamily: "system-ui, sans-serif"
2117
2117
  },
2118
- children: P("div", {
2118
+ children: L("div", {
2119
2119
  style: {
2120
2120
  backgroundColor: "#fff",
2121
2121
  borderRadius: 8,
@@ -2141,7 +2141,7 @@ let __tla = (async () => {
2141
2141
  },
2142
2142
  children: "Your measurements will be submitted without comparing to the scan. Are you sure?"
2143
2143
  }),
2144
- P("div", {
2144
+ L("div", {
2145
2145
  style: {
2146
2146
  display: "flex",
2147
2147
  justifyContent: "flex-end",
@@ -2149,7 +2149,7 @@ let __tla = (async () => {
2149
2149
  },
2150
2150
  children: [
2151
2151
  i("button", {
2152
- onClick: () => u(false),
2152
+ onClick: () => f(false),
2153
2153
  style: {
2154
2154
  ...je,
2155
2155
  backgroundColor: "#fff",
@@ -2172,7 +2172,7 @@ let __tla = (async () => {
2172
2172
  })
2173
2173
  ]
2174
2174
  })
2175
- }) : P("div", {
2175
+ }) : L("div", {
2176
2176
  style: {
2177
2177
  position: "fixed",
2178
2178
  inset: 0,
@@ -2190,7 +2190,7 @@ let __tla = (async () => {
2190
2190
  borderBottom: "1px solid #e0e0e0",
2191
2191
  flexShrink: 0
2192
2192
  },
2193
- children: P("div", {
2193
+ children: L("div", {
2194
2194
  style: {
2195
2195
  display: "flex",
2196
2196
  alignItems: "center",
@@ -2199,9 +2199,9 @@ let __tla = (async () => {
2199
2199
  gap: 12
2200
2200
  },
2201
2201
  children: [
2202
- P("div", {
2202
+ L("div", {
2203
2203
  children: [
2204
- P("div", {
2204
+ L("div", {
2205
2205
  style: {
2206
2206
  fontSize: 22,
2207
2207
  fontWeight: 600,
@@ -2212,7 +2212,7 @@ let __tla = (async () => {
2212
2212
  " Measurements"
2213
2213
  ]
2214
2214
  }),
2215
- P("div", {
2215
+ L("div", {
2216
2216
  style: {
2217
2217
  fontSize: 13,
2218
2218
  color: "rgba(0,0,0,0.54)",
@@ -2228,7 +2228,7 @@ let __tla = (async () => {
2228
2228
  ]
2229
2229
  }),
2230
2230
  i("button", {
2231
- onClick: b,
2231
+ onClick: y,
2232
2232
  style: {
2233
2233
  ...je,
2234
2234
  backgroundColor: "#fff",
@@ -2238,7 +2238,7 @@ let __tla = (async () => {
2238
2238
  padding: "6px 16px",
2239
2239
  fontSize: 13
2240
2240
  },
2241
- children: P("span", {
2241
+ children: L("span", {
2242
2242
  style: {
2243
2243
  marginRight: 8,
2244
2244
  display: "flex",
@@ -2259,7 +2259,7 @@ let __tla = (async () => {
2259
2259
  ]
2260
2260
  })
2261
2261
  }),
2262
- P("div", {
2262
+ L("div", {
2263
2263
  style: {
2264
2264
  flex: 1,
2265
2265
  minHeight: 0,
@@ -2284,9 +2284,9 @@ let __tla = (async () => {
2284
2284
  gap: "12px 20px",
2285
2285
  marginBottom: 28
2286
2286
  },
2287
- children: h.map((w, k) => P("div", {
2287
+ children: h.map((w, A) => L("div", {
2288
2288
  children: [
2289
- P("label", {
2289
+ L("label", {
2290
2290
  style: {
2291
2291
  display: "block",
2292
2292
  fontSize: 12,
@@ -2308,21 +2308,21 @@ let __tla = (async () => {
2308
2308
  i("input", {
2309
2309
  type: "number",
2310
2310
  step: "0.1",
2311
- value: l[w] ?? "",
2312
- onChange: (F) => f((B) => ({
2311
+ value: d[w] ?? "",
2312
+ onChange: (k) => u((B) => ({
2313
2313
  ...B,
2314
- [w]: F.target.value
2314
+ [w]: k.target.value
2315
2315
  })),
2316
2316
  style: {
2317
2317
  ...Lt,
2318
2318
  padding: "8px 10px",
2319
2319
  fontSize: 14,
2320
- borderColor: l[w] ? "rgb(12, 67, 173)" : "#ccc"
2320
+ borderColor: d[w] ? "rgb(12, 67, 173)" : "#ccc"
2321
2321
  },
2322
2322
  placeholder: "0.0"
2323
2323
  })
2324
2324
  ]
2325
- }, k))
2325
+ }, A))
2326
2326
  }),
2327
2327
  i("div", {
2328
2328
  style: {
@@ -2339,9 +2339,9 @@ let __tla = (async () => {
2339
2339
  gridTemplateColumns: "repeat(auto-fill, minmax(180px, 1fr))",
2340
2340
  gap: "12px 20px"
2341
2341
  },
2342
- children: P("div", {
2342
+ children: L("div", {
2343
2343
  children: [
2344
- P("label", {
2344
+ L("label", {
2345
2345
  style: {
2346
2346
  display: "block",
2347
2347
  fontSize: 12,
@@ -2377,7 +2377,7 @@ let __tla = (async () => {
2377
2377
  })
2378
2378
  ]
2379
2379
  }),
2380
- P("div", {
2380
+ L("div", {
2381
2381
  style: {
2382
2382
  padding: "12px 24px",
2383
2383
  backgroundColor: "#fff",
@@ -2391,7 +2391,7 @@ let __tla = (async () => {
2391
2391
  },
2392
2392
  children: [
2393
2393
  i("button", {
2394
- onClick: () => u(true),
2394
+ onClick: () => f(true),
2395
2395
  style: {
2396
2396
  ...je,
2397
2397
  backgroundColor: "#fff",
@@ -2403,14 +2403,14 @@ let __tla = (async () => {
2403
2403
  children: "Have Galileo Check My Measurements"
2404
2404
  }),
2405
2405
  i("button", {
2406
- onClick: v,
2407
- disabled: !y,
2406
+ onClick: z,
2407
+ disabled: !b,
2408
2408
  style: {
2409
2409
  ...je,
2410
- backgroundColor: y ? "rgb(12, 67, 173)" : "#e0e0e0",
2410
+ backgroundColor: b ? "rgb(12, 67, 173)" : "#e0e0e0",
2411
2411
  border: "none",
2412
- color: y ? "#fff" : "#9e9e9e",
2413
- cursor: y ? "pointer" : "not-allowed",
2412
+ color: b ? "#fff" : "#9e9e9e",
2413
+ cursor: b ? "pointer" : "not-allowed",
2414
2414
  padding: "6px 16px",
2415
2415
  fontSize: 13
2416
2416
  },
@@ -2422,34 +2422,34 @@ let __tla = (async () => {
2422
2422
  });
2423
2423
  };
2424
2424
  function xn(e, r, t) {
2425
- const o = e.getAttribute("position"), s = t - r;
2426
- if (s < 1) return null;
2427
- const d = 30, c = s / d, a = [];
2428
- for (let m = 0; m < d; m++) {
2425
+ const o = e.getAttribute("position"), l = t - r;
2426
+ if (l < 1) return null;
2427
+ const s = 30, c = l / s, a = [];
2428
+ for (let m = 0; m < s; m++) {
2429
2429
  const x = r + m * c, S = r + (m + 1) * c;
2430
- let I = 0, A = 0, L = 0, y = 0;
2431
- for (let v = 0; v < o.count; v++) {
2432
- const b = o.getY(v);
2433
- b >= x && b < S && (I += o.getX(v), A += b, L += o.getZ(v), y++);
2430
+ let I = 0, F = 0, P = 0, b = 0;
2431
+ for (let z = 0; z < o.count; z++) {
2432
+ const y = o.getY(z);
2433
+ y >= x && y < S && (I += o.getX(z), F += y, P += o.getZ(z), b++);
2434
2434
  }
2435
- y > 20 && a.push(new M(I / y, A / y, L / y));
2435
+ b > 20 && a.push(new C(I / b, F / b, P / b));
2436
2436
  }
2437
2437
  if (a.length < 5) return null;
2438
- const n = new M();
2438
+ const n = new C();
2439
2439
  for (const m of a) n.add(m);
2440
2440
  n.divideScalar(a.length);
2441
- let h = 0, l = 0, f = 0, p = 0, g = 0, z = 0;
2441
+ let h = 0, d = 0, u = 0, p = 0, g = 0, M = 0;
2442
2442
  for (const m of a) {
2443
2443
  const x = m.x - n.x, S = m.y - n.y, I = m.z - n.z;
2444
- h += x * x, l += x * S, f += x * I, p += S * S, g += S * I, z += I * I;
2444
+ h += x * x, d += x * S, u += x * I, p += S * S, g += S * I, M += I * I;
2445
2445
  }
2446
- let u = new M(0.01, 1, 0.01).normalize();
2446
+ let f = new C(0.01, 1, 0.01).normalize();
2447
2447
  for (let m = 0; m < 30; m++) {
2448
- const x = h * u.x + l * u.y + f * u.z, S = l * u.x + p * u.y + g * u.z, I = f * u.x + g * u.y + z * u.z, A = new M(x, S, I), L = A.length();
2449
- if (L < 1e-10 || (A.divideScalar(L), u.distanceTo(A) < 1e-8)) break;
2450
- u = A;
2448
+ const x = h * f.x + d * f.y + u * f.z, S = d * f.x + p * f.y + g * f.z, I = u * f.x + g * f.y + M * f.z, F = new C(x, S, I), P = F.length();
2449
+ if (P < 1e-10 || (F.divideScalar(P), f.distanceTo(F) < 1e-8)) break;
2450
+ f = F;
2451
2451
  }
2452
- return u.y < 0 && u.negate(), u;
2452
+ return f.y < 0 && f.negate(), f;
2453
2453
  }
2454
2454
  const Oo = {
2455
2455
  pcaAxes: true,
@@ -2467,23 +2467,23 @@ let __tla = (async () => {
2467
2467
  "#4488ff"
2468
2468
  ];
2469
2469
  function yn(e) {
2470
- const r = e.getAttribute("position"), t = r.count, o = new M();
2471
- for (let u = 0; u < t; u++) o.x += r.getX(u), o.y += r.getY(u), o.z += r.getZ(u);
2470
+ const r = e.getAttribute("position"), t = r.count, o = new C();
2471
+ for (let f = 0; f < t; f++) o.x += r.getX(f), o.y += r.getY(f), o.z += r.getZ(f);
2472
2472
  o.divideScalar(t);
2473
- let s = 0, d = 0, c = 0, a = 0, n = 0, h = 0;
2474
- for (let u = 0; u < t; u++) {
2475
- const m = r.getX(u) - o.x, x = r.getY(u) - o.y, S = r.getZ(u) - o.z;
2476
- s += m * m, d += m * x, c += m * S, a += x * x, n += x * S, h += S * S;
2473
+ let l = 0, s = 0, c = 0, a = 0, n = 0, h = 0;
2474
+ for (let f = 0; f < t; f++) {
2475
+ const m = r.getX(f) - o.x, x = r.getY(f) - o.y, S = r.getZ(f) - o.z;
2476
+ l += m * m, s += m * x, c += m * S, a += x * x, n += x * S, h += S * S;
2477
2477
  }
2478
- s /= t, d /= t, c /= t, a /= t, n /= t, h /= t;
2479
- const l = [], f = [], p = [
2478
+ l /= t, s /= t, c /= t, a /= t, n /= t, h /= t;
2479
+ const d = [], u = [], p = [
2480
2480
  [
2481
+ l,
2481
2482
  s,
2482
- d,
2483
2483
  c
2484
2484
  ],
2485
2485
  [
2486
- d,
2486
+ s,
2487
2487
  a,
2488
2488
  n
2489
2489
  ],
@@ -2493,62 +2493,62 @@ let __tla = (async () => {
2493
2493
  h
2494
2494
  ]
2495
2495
  ];
2496
- for (let u = 0; u < 3; u++) {
2497
- let m = new M(1 + u * 0.1, 1 - u * 0.1, 0.5 + u * 0.3).normalize(), x = 0;
2496
+ for (let f = 0; f < 3; f++) {
2497
+ let m = new C(1 + f * 0.1, 1 - f * 0.1, 0.5 + f * 0.3).normalize(), x = 0;
2498
2498
  for (let S = 0; S < 100; S++) {
2499
- const I = p[0][0] * m.x + p[0][1] * m.y + p[0][2] * m.z, A = p[1][0] * m.x + p[1][1] * m.y + p[1][2] * m.z, L = p[2][0] * m.x + p[2][1] * m.y + p[2][2] * m.z, y = new M(I, A, L);
2500
- if (x = y.length(), x < 1e-12) break;
2501
- if (y.divideScalar(x), m.distanceTo(y) < 1e-10) {
2502
- m = y;
2499
+ const I = p[0][0] * m.x + p[0][1] * m.y + p[0][2] * m.z, F = p[1][0] * m.x + p[1][1] * m.y + p[1][2] * m.z, P = p[2][0] * m.x + p[2][1] * m.y + p[2][2] * m.z, b = new C(I, F, P);
2500
+ if (x = b.length(), x < 1e-12) break;
2501
+ if (b.divideScalar(x), m.distanceTo(b) < 1e-10) {
2502
+ m = b;
2503
2503
  break;
2504
2504
  }
2505
- m = y;
2505
+ m = b;
2506
2506
  }
2507
- l.push(m.clone()), f.push(x);
2507
+ d.push(m.clone()), u.push(x);
2508
2508
  for (let S = 0; S < 3; S++) for (let I = 0; I < 3; I++) {
2509
- const A = [
2509
+ const F = [
2510
2510
  m.x,
2511
2511
  m.y,
2512
2512
  m.z
2513
- ][S], L = [
2513
+ ][S], P = [
2514
2514
  m.x,
2515
2515
  m.y,
2516
2516
  m.z
2517
2517
  ][I];
2518
- p[S][I] -= x * A * L;
2518
+ p[S][I] -= x * F * P;
2519
2519
  }
2520
2520
  }
2521
- const g = new M();
2522
- for (let u = 0; u < t; u++) g.x += r.getX(u), g.y += r.getY(u), g.z += r.getZ(u);
2521
+ const g = new C();
2522
+ for (let f = 0; f < t; f++) g.x += r.getX(f), g.y += r.getY(f), g.z += r.getZ(f);
2523
2523
  g.divideScalar(t);
2524
- const z = [
2524
+ const M = [
2525
2525
  0,
2526
2526
  0,
2527
2527
  0
2528
2528
  ];
2529
- for (let u = 0; u < 3; u++) {
2529
+ for (let f = 0; f < 3; f++) {
2530
2530
  let m = 1 / 0, x = -1 / 0;
2531
- const S = l[u];
2531
+ const S = d[f];
2532
2532
  for (let I = 0; I < t; I++) {
2533
- const A = r.getX(I) - g.x, L = r.getY(I) - g.y, y = r.getZ(I) - g.z, v = A * S.x + L * S.y + y * S.z;
2534
- v < m && (m = v), v > x && (x = v);
2533
+ const F = r.getX(I) - g.x, P = r.getY(I) - g.y, b = r.getZ(I) - g.z, z = F * S.x + P * S.y + b * S.z;
2534
+ z < m && (m = z), z > x && (x = z);
2535
2535
  }
2536
- z[u] = (x - m) / 2;
2536
+ M[f] = (x - m) / 2;
2537
2537
  }
2538
2538
  return {
2539
- axes: l,
2540
- eigenvalues: f,
2539
+ axes: d,
2540
+ eigenvalues: u,
2541
2541
  center: g,
2542
- halfExtents: z
2542
+ halfExtents: M
2543
2543
  };
2544
2544
  }
2545
2545
  function Ho({ pca: e }) {
2546
2546
  return i("group", {
2547
2547
  children: e.axes.map((r, t) => {
2548
- const o = e.center.clone().addScaledVector(r, e.halfExtents[t]), s = e.center.clone().addScaledVector(r, -e.halfExtents[t]);
2548
+ const o = e.center.clone().addScaledVector(r, e.halfExtents[t]), l = e.center.clone().addScaledVector(r, -e.halfExtents[t]);
2549
2549
  return i(de, {
2550
2550
  points: [
2551
- s,
2551
+ l,
2552
2552
  o
2553
2553
  ],
2554
2554
  color: $o[t],
@@ -2559,8 +2559,8 @@ let __tla = (async () => {
2559
2559
  }
2560
2560
  function Vo({ pca: e }) {
2561
2561
  const r = j(() => {
2562
- const { center: t, axes: o, halfExtents: s } = e, d = [];
2563
- for (let a = -1; a <= 1; a += 2) for (let n = -1; n <= 1; n += 2) for (let h = -1; h <= 1; h += 2) d.push(t.clone().addScaledVector(o[0], a * s[0]).addScaledVector(o[1], n * s[1]).addScaledVector(o[2], h * s[2]));
2562
+ const { center: t, axes: o, halfExtents: l } = e, s = [];
2563
+ for (let a = -1; a <= 1; a += 2) for (let n = -1; n <= 1; n += 2) for (let h = -1; h <= 1; h += 2) s.push(t.clone().addScaledVector(o[0], a * l[0]).addScaledVector(o[1], n * l[1]).addScaledVector(o[2], h * l[2]));
2564
2564
  return [
2565
2565
  [
2566
2566
  0,
@@ -2611,8 +2611,8 @@ let __tla = (async () => {
2611
2611
  7
2612
2612
  ]
2613
2613
  ].map(([a, n]) => [
2614
- d[a],
2615
- d[n]
2614
+ s[a],
2615
+ s[n]
2616
2616
  ]);
2617
2617
  }, [
2618
2618
  e
@@ -2628,26 +2628,26 @@ let __tla = (async () => {
2628
2628
  });
2629
2629
  }
2630
2630
  function jo({ redPoint: e, greenPoint: r }) {
2631
- const t = j(() => new M().subVectors(r, e).normalize(), [
2631
+ const t = j(() => new C().subVectors(r, e).normalize(), [
2632
2632
  e,
2633
2633
  r
2634
2634
  ]), o = j(() => {
2635
- const d = t.dot(new M(0, 1, 0));
2636
- return Math.acos(Math.min(1, Math.abs(d))) * 180 / Math.PI;
2635
+ const s = t.dot(new C(0, 1, 0));
2636
+ return Math.acos(Math.min(1, Math.abs(s))) * 180 / Math.PI;
2637
2637
  }, [
2638
2638
  t
2639
- ]), s = o < 1 ? "#44ff44" : o < 5 ? "#ffcc00" : "#ff4444";
2640
- return P("group", {
2639
+ ]), l = o < 1 ? "#44ff44" : o < 5 ? "#ffcc00" : "#ff4444";
2640
+ return L("group", {
2641
2641
  children: [
2642
2642
  i(de, {
2643
2643
  points: [
2644
2644
  e,
2645
2645
  r
2646
2646
  ],
2647
- color: s,
2647
+ color: l,
2648
2648
  lineWidth: 3
2649
2649
  }),
2650
- P("mesh", {
2650
+ L("mesh", {
2651
2651
  position: e,
2652
2652
  children: [
2653
2653
  i("sphereGeometry", {
@@ -2662,7 +2662,7 @@ let __tla = (async () => {
2662
2662
  })
2663
2663
  ]
2664
2664
  }),
2665
- P("mesh", {
2665
+ L("mesh", {
2666
2666
  position: r,
2667
2667
  children: [
2668
2668
  i("sphereGeometry", {
@@ -2681,19 +2681,19 @@ let __tla = (async () => {
2681
2681
  });
2682
2682
  }
2683
2683
  function No({ geometry: e, redY: r, greenY: t, modelSize: o }) {
2684
- const d = o * 0.15, c = j(() => {
2684
+ const s = o * 0.15, c = j(() => {
2685
2685
  const a = [];
2686
2686
  let n = t - 10;
2687
- const h = new M(0, 1, 0);
2687
+ const h = new C(0, 1, 0);
2688
2688
  for (; n > r; ) {
2689
- const l = Math.min(n, t), f = Math.max(n, t), p = xn(e, l, f);
2689
+ const d = Math.min(n, t), u = Math.max(n, t), p = xn(e, d, u);
2690
2690
  if (p) {
2691
- const g = p.dot(h), z = Math.acos(Math.min(1, Math.abs(g))) * 180 / Math.PI;
2691
+ const g = p.dot(h), M = Math.acos(Math.min(1, Math.abs(g))) * 180 / Math.PI;
2692
2692
  a.push({
2693
2693
  axis: p,
2694
- regionMin: l,
2695
- regionMax: f,
2696
- angleDeg: z
2694
+ regionMin: d,
2695
+ regionMax: u,
2696
+ angleDeg: M
2697
2697
  });
2698
2698
  }
2699
2699
  n -= 10;
@@ -2706,25 +2706,25 @@ let __tla = (async () => {
2706
2706
  ]);
2707
2707
  return i("group", {
2708
2708
  children: c.map((a, n) => {
2709
- const h = (a.regionMin + a.regionMax) / 2, l = new M(0, h, 0), f = l.clone().addScaledVector(a.axis, d), p = l.clone().addScaledVector(a.axis, -d), g = n / Math.max(1, c.length - 1), z = a.angleDeg < 0.5 ? `hsl(${120 - g * 120}, 80%, 60%)` : `hsl(${40 - a.angleDeg * 2}, 90%, 55%)`;
2710
- return P("group", {
2709
+ const h = (a.regionMin + a.regionMax) / 2, d = new C(0, h, 0), u = d.clone().addScaledVector(a.axis, s), p = d.clone().addScaledVector(a.axis, -s), g = n / Math.max(1, c.length - 1), M = a.angleDeg < 0.5 ? `hsl(${120 - g * 120}, 80%, 60%)` : `hsl(${40 - a.angleDeg * 2}, 90%, 55%)`;
2710
+ return L("group", {
2711
2711
  children: [
2712
2712
  i(de, {
2713
2713
  points: [
2714
2714
  p,
2715
- f
2715
+ u
2716
2716
  ],
2717
- color: z,
2717
+ color: M,
2718
2718
  lineWidth: 1.5,
2719
2719
  transparent: true,
2720
2720
  opacity: 0.7
2721
2721
  }),
2722
2722
  i(de, {
2723
2723
  points: [
2724
- new M(-d * 0.3, a.regionMin, 0),
2725
- new M(d * 0.3, a.regionMin, 0)
2724
+ new C(-s * 0.3, a.regionMin, 0),
2725
+ new C(s * 0.3, a.regionMin, 0)
2726
2726
  ],
2727
- color: z,
2727
+ color: M,
2728
2728
  lineWidth: 0.5,
2729
2729
  transparent: true,
2730
2730
  opacity: 0.3
@@ -2735,12 +2735,12 @@ let __tla = (async () => {
2735
2735
  });
2736
2736
  }
2737
2737
  function Yo({ geometry: e, redY: r, greenY: t, modelSize: o }) {
2738
- const s = j(() => {
2739
- const f = xn(e, r, t);
2740
- if (!f) return null;
2741
- const p = f.dot(new M(0, 1, 0)), g = Math.acos(Math.min(1, Math.abs(p))) * 180 / Math.PI;
2738
+ const l = j(() => {
2739
+ const u = xn(e, r, t);
2740
+ if (!u) return null;
2741
+ const p = u.dot(new C(0, 1, 0)), g = Math.acos(Math.min(1, Math.abs(p))) * 180 / Math.PI;
2742
2742
  return {
2743
- axis: f,
2743
+ axis: u,
2744
2744
  angleDeg: g
2745
2745
  };
2746
2746
  }, [
@@ -2748,15 +2748,15 @@ let __tla = (async () => {
2748
2748
  r,
2749
2749
  t
2750
2750
  ]);
2751
- if (!s) return null;
2752
- const d = (r + t) / 2, c = new M(0, d, 0), a = o * 0.4, n = c.clone().addScaledVector(s.axis, a), h = c.clone().addScaledVector(s.axis, -a), l = s.angleDeg < 0.5 ? "#00ffff" : s.angleDeg < 2 ? "#ffcc00" : "#ff6600";
2751
+ if (!l) return null;
2752
+ const s = (r + t) / 2, c = new C(0, s, 0), a = o * 0.4, n = c.clone().addScaledVector(l.axis, a), h = c.clone().addScaledVector(l.axis, -a), d = l.angleDeg < 0.5 ? "#00ffff" : l.angleDeg < 2 ? "#ffcc00" : "#ff6600";
2753
2753
  return i("group", {
2754
2754
  children: i(de, {
2755
2755
  points: [
2756
2756
  h,
2757
2757
  n
2758
2758
  ],
2759
- color: l,
2759
+ color: d,
2760
2760
  lineWidth: 3,
2761
2761
  dashed: true,
2762
2762
  dashSize: 3,
@@ -2765,11 +2765,11 @@ let __tla = (async () => {
2765
2765
  });
2766
2766
  }
2767
2767
  function Xo({ pca: e, modelSize: r }) {
2768
- const t = e.axes[0], o = r * 0.6, s = e.center.clone().addScaledVector(t, o), d = e.center.clone().addScaledVector(t, -o);
2768
+ const t = e.axes[0], o = r * 0.6, l = e.center.clone().addScaledVector(t, o), s = e.center.clone().addScaledVector(t, -o);
2769
2769
  return i(de, {
2770
2770
  points: [
2771
- d,
2772
- s
2771
+ s,
2772
+ l
2773
2773
  ],
2774
2774
  color: "#ff8800",
2775
2775
  lineWidth: 2,
@@ -2778,55 +2778,55 @@ let __tla = (async () => {
2778
2778
  gapSize: 2
2779
2779
  });
2780
2780
  }
2781
- function Go({ geometry: e, redY: r, greenY: t, modelSize: o, measurementGeometry: s }) {
2782
- const d = j(() => {
2783
- const l = s ?? e, f = gn(l), p = new M(0, 1, 0), g = 5, u = t + 3 * 25.4, m = [];
2784
- for (let b = r + g; b < u; b += g) {
2785
- const D = fo(f, l, new M(0, b, 0), p);
2781
+ function Go({ geometry: e, redY: r, greenY: t, modelSize: o, measurementGeometry: l }) {
2782
+ const s = j(() => {
2783
+ const d = l ?? e, u = gn(d), p = new C(0, 1, 0), g = 5, f = t + 3 * 25.4, m = [];
2784
+ for (let y = r + g; y < f; y += g) {
2785
+ const D = fo(u, d, new C(0, y, 0), p);
2786
2786
  D > 0 && m.push({
2787
- y: b,
2787
+ y,
2788
2788
  circ: D
2789
2789
  });
2790
2790
  }
2791
2791
  if (m.length < 5) return null;
2792
- const x = t - r, S = r + x * 0.3, I = r + x * 0.7, A = m.filter((b) => b.y >= S && b.y <= I);
2793
- if (A.length < 3) return null;
2794
- const L = A.map((b) => b.circ).sort((b, D) => b - D), y = L[Math.floor(L.length / 2)], v = Math.max(...m.map((b) => b.circ));
2792
+ const x = t - r, S = r + x * 0.3, I = r + x * 0.7, F = m.filter((y) => y.y >= S && y.y <= I);
2793
+ if (F.length < 3) return null;
2794
+ const P = F.map((y) => y.circ).sort((y, D) => y - D), b = P[Math.floor(P.length / 2)], z = Math.max(...m.map((y) => y.circ));
2795
2795
  return {
2796
2796
  circumferences: m,
2797
- baseline: y,
2798
- maxCirc: v
2797
+ baseline: b,
2798
+ maxCirc: z
2799
2799
  };
2800
2800
  }, [
2801
2801
  e,
2802
2802
  r,
2803
2803
  t
2804
2804
  ]);
2805
- if (!d) return null;
2806
- const { circumferences: c, baseline: a, maxCirc: n } = d, h = o * 0.3 / n;
2807
- return P("group", {
2805
+ if (!s) return null;
2806
+ const { circumferences: c, baseline: a, maxCirc: n } = s, h = o * 0.3 / n;
2807
+ return L("group", {
2808
2808
  children: [
2809
- c.map(({ y: l, circ: f }, p) => {
2810
- const g = f / a, z = g > 1.6 ? "#ff4444" : g > 1.3 ? "#ffcc00" : "#22cc66", u = f * h;
2809
+ c.map(({ y: d, circ: u }, p) => {
2810
+ const g = u / a, M = g > 1.6 ? "#ff4444" : g > 1.3 ? "#ffcc00" : "#22cc66", f = u * h;
2811
2811
  return i(de, {
2812
2812
  points: [
2813
- new M(-u, l, 0),
2814
- new M(u, l, 0)
2813
+ new C(-f, d, 0),
2814
+ new C(f, d, 0)
2815
2815
  ],
2816
- color: z,
2816
+ color: M,
2817
2817
  lineWidth: 1.5,
2818
2818
  transparent: true,
2819
2819
  opacity: 0.6
2820
2820
  }, p);
2821
2821
  }),
2822
2822
  (() => {
2823
- const l = a * 1.6 * h, f = c[0].y, p = c[c.length - 1].y;
2824
- return P(Te, {
2823
+ const d = a * 1.6 * h, u = c[0].y, p = c[c.length - 1].y;
2824
+ return L(Te, {
2825
2825
  children: [
2826
2826
  i(de, {
2827
2827
  points: [
2828
- new M(-l, f, 0),
2829
- new M(-l, p, 0)
2828
+ new C(-d, u, 0),
2829
+ new C(-d, p, 0)
2830
2830
  ],
2831
2831
  color: "#ff4444",
2832
2832
  lineWidth: 1,
@@ -2838,8 +2838,8 @@ let __tla = (async () => {
2838
2838
  }),
2839
2839
  i(de, {
2840
2840
  points: [
2841
- new M(l, f, 0),
2842
- new M(l, p, 0)
2841
+ new C(d, u, 0),
2842
+ new C(d, p, 0)
2843
2843
  ],
2844
2844
  color: "#ff4444",
2845
2845
  lineWidth: 1,
@@ -2858,18 +2858,18 @@ let __tla = (async () => {
2858
2858
  function Zo({ componentDebug: e }) {
2859
2859
  return i("group", {
2860
2860
  children: e.geometries.map((r, t) => {
2861
- const o = e.colors[t] ?? "#888888", s = t === e.innerIdx;
2861
+ const o = e.colors[t] ?? "#888888", l = t === e.innerIdx;
2862
2862
  r.computeBoundingBox();
2863
- const d = new M();
2864
- return r.boundingBox.getCenter(d), P("group", {
2863
+ const s = new C();
2864
+ return r.boundingBox.getCenter(s), L("group", {
2865
2865
  children: [
2866
2866
  i("mesh", {
2867
2867
  geometry: r,
2868
- renderOrder: s ? 2 : 1,
2868
+ renderOrder: l ? 2 : 1,
2869
2869
  children: i("meshStandardMaterial", {
2870
2870
  color: o,
2871
2871
  transparent: true,
2872
- opacity: s ? 0.5 : 0.2,
2872
+ opacity: l ? 0.5 : 0.2,
2873
2873
  side: O.DoubleSide,
2874
2874
  depthWrite: false,
2875
2875
  polygonOffset: true,
@@ -2879,16 +2879,16 @@ let __tla = (async () => {
2879
2879
  }),
2880
2880
  i("mesh", {
2881
2881
  geometry: r,
2882
- renderOrder: s ? 2 : 1,
2882
+ renderOrder: l ? 2 : 1,
2883
2883
  children: i("meshBasicMaterial", {
2884
2884
  color: o,
2885
2885
  wireframe: true,
2886
2886
  transparent: true,
2887
- opacity: s ? 0.4 : 0.15
2887
+ opacity: l ? 0.4 : 0.15
2888
2888
  })
2889
2889
  }),
2890
2890
  i("group", {
2891
- position: d,
2891
+ position: s,
2892
2892
  children: i(Ye, {
2893
2893
  center: true,
2894
2894
  style: {
@@ -2907,7 +2907,7 @@ let __tla = (async () => {
2907
2907
  fontSize: 11,
2908
2908
  color: o,
2909
2909
  fontFamily: "monospace",
2910
- fontWeight: s ? 700 : 400
2910
+ fontWeight: l ? 700 : 400
2911
2911
  },
2912
2912
  children: e.labels[t]
2913
2913
  })
@@ -2921,12 +2921,12 @@ let __tla = (async () => {
2921
2921
  }
2922
2922
  function Ko({ geometry: e, aoData: r }) {
2923
2923
  const t = j(() => {
2924
- const o = e.toNonIndexed(), s = o.getAttribute("position"), d = r.length, c = s.count, a = new Float32Array(c * 3);
2925
- for (let n = 0; n < d && n * 3 + 2 < c; n++) {
2926
- const h = r[n], l = h, f = h < 0.5 ? 0.8 - h * 1.2 : 0.2 * (1 - h), p = 1 - h;
2924
+ const o = e.toNonIndexed(), l = o.getAttribute("position"), s = r.length, c = l.count, a = new Float32Array(c * 3);
2925
+ for (let n = 0; n < s && n * 3 + 2 < c; n++) {
2926
+ const h = r[n], d = h, u = h < 0.5 ? 0.8 - h * 1.2 : 0.2 * (1 - h), p = 1 - h;
2927
2927
  for (let g = 0; g < 3; g++) {
2928
- const z = (n * 3 + g) * 3;
2929
- a[z] = l, a[z + 1] = f, a[z + 2] = p;
2928
+ const M = (n * 3 + g) * 3;
2929
+ a[M] = d, a[M + 1] = u, a[M + 2] = p;
2930
2930
  }
2931
2931
  }
2932
2932
  return o.setAttribute("color", new O.Float32BufferAttribute(a, 3)), o;
@@ -2948,16 +2948,16 @@ let __tla = (async () => {
2948
2948
  })
2949
2949
  });
2950
2950
  }
2951
- function Uo({ mesh: e, layers: r, landmarkPoints: t, componentDebug: o, aoData: s, aoGeometry: d, measurementGeometry: c }) {
2951
+ function Uo({ mesh: e, layers: r, landmarkPoints: t, componentDebug: o, aoData: l, aoGeometry: s, measurementGeometry: c }) {
2952
2952
  const a = e.geometry, n = j(() => a.getAttribute("position") ? yn(a) : null, [
2953
2953
  a
2954
2954
  ]), h = j(() => !t || t.length < 2 ? null : {
2955
- red: new M(t[1].position.x, t[1].position.y, t[1].position.z),
2956
- green: new M(t[0].position.x, t[0].position.y, t[0].position.z)
2955
+ red: new C(t[1].position.x, t[1].position.y, t[1].position.z),
2956
+ green: new C(t[0].position.x, t[0].position.y, t[0].position.z)
2957
2957
  }, [
2958
2958
  t
2959
2959
  ]);
2960
- return P("group", {
2960
+ return L("group", {
2961
2961
  children: [
2962
2962
  r.pcaAxes && n && i(Ho, {
2963
2963
  pca: n
@@ -2972,9 +2972,9 @@ let __tla = (async () => {
2972
2972
  r.shellComponents && o && i(Zo, {
2973
2973
  componentDebug: o
2974
2974
  }),
2975
- r.ambientOcclusion && s && s.length > 0 && i(Ko, {
2976
- geometry: d ?? a,
2977
- aoData: s
2975
+ r.ambientOcclusion && l && l.length > 0 && i(Ko, {
2976
+ geometry: s ?? a,
2977
+ aoData: l
2978
2978
  }),
2979
2979
  r.circumferenceScan && h && i(Go, {
2980
2980
  geometry: a,
@@ -3016,20 +3016,20 @@ let __tla = (async () => {
3016
3016
  function Jo({ mesh: e }) {
3017
3017
  const r = e.geometry, t = j(() => {
3018
3018
  if (!r.getAttribute("position")) return null;
3019
- const d = yn(r), c = d.axes[0], a = d.halfExtents[0] * 1.3;
3019
+ const s = yn(r), c = s.axes[0], a = s.halfExtents[0] * 1.3;
3020
3020
  return {
3021
3021
  axis: c,
3022
- center: d.center,
3022
+ center: s.center,
3023
3023
  halfLen: a
3024
3024
  };
3025
3025
  }, [
3026
3026
  r
3027
3027
  ]);
3028
3028
  if (!t) return null;
3029
- const o = t.center.clone().addScaledVector(t.axis, t.halfLen), s = t.center.clone().addScaledVector(t.axis, -t.halfLen);
3029
+ const o = t.center.clone().addScaledVector(t.axis, t.halfLen), l = t.center.clone().addScaledVector(t.axis, -t.halfLen);
3030
3030
  return i(de, {
3031
3031
  points: [
3032
- s,
3032
+ l,
3033
3033
  o
3034
3034
  ],
3035
3035
  color: "#666",
@@ -3103,7 +3103,7 @@ let __tla = (async () => {
3103
3103
  ...new Set(bn.map((e) => e.group))
3104
3104
  ];
3105
3105
  function qo({ layers: e, onToggleLayer: r, isDoubleShell: t }) {
3106
- return P("div", {
3106
+ return L("div", {
3107
3107
  style: {
3108
3108
  position: "absolute",
3109
3109
  top: 16,
@@ -3132,8 +3132,8 @@ let __tla = (async () => {
3132
3132
  children: "Debug Layers"
3133
3133
  }),
3134
3134
  Qo.map((o) => {
3135
- const s = bn.filter((d) => d.group === o && !(d.hideWhenDoubleShell && t));
3136
- return s.length === 0 ? null : P("div", {
3135
+ const l = bn.filter((s) => s.group === o && !(s.hideWhenDoubleShell && t));
3136
+ return l.length === 0 ? null : L("div", {
3137
3137
  children: [
3138
3138
  i("div", {
3139
3139
  style: {
@@ -3147,7 +3147,7 @@ let __tla = (async () => {
3147
3147
  },
3148
3148
  children: o
3149
3149
  }),
3150
- s.map(({ key: d, label: c, color: a }) => P("label", {
3150
+ l.map(({ key: s, label: c, color: a }) => L("label", {
3151
3151
  style: {
3152
3152
  display: "flex",
3153
3153
  alignItems: "center",
@@ -3159,8 +3159,8 @@ let __tla = (async () => {
3159
3159
  children: [
3160
3160
  i("input", {
3161
3161
  type: "checkbox",
3162
- checked: e[d],
3163
- onChange: () => r(d),
3162
+ checked: e[s],
3163
+ onChange: () => r(s),
3164
3164
  style: {
3165
3165
  accentColor: a,
3166
3166
  width: 14,
@@ -3174,32 +3174,32 @@ let __tla = (async () => {
3174
3174
  height: 8,
3175
3175
  borderRadius: "50%",
3176
3176
  backgroundColor: a,
3177
- opacity: e[d] ? 1 : 0.3,
3177
+ opacity: e[s] ? 1 : 0.3,
3178
3178
  flexShrink: 0
3179
3179
  }
3180
3180
  }),
3181
3181
  i("span", {
3182
3182
  style: {
3183
- opacity: e[d] ? 1 : 0.5
3183
+ opacity: e[s] ? 1 : 0.5
3184
3184
  },
3185
3185
  children: c
3186
3186
  })
3187
3187
  ]
3188
- }, d))
3188
+ }, s))
3189
3189
  ]
3190
3190
  }, o);
3191
3191
  })
3192
3192
  ]
3193
3193
  });
3194
3194
  }
3195
- const er = ({ config: e, spacingType: r, scanUrl: t, formMeasurements: o, onComplete: s, isDebugUser: d = false, onAnalyticsEvent: c, wasmModule: a }) => {
3196
- const [n, h] = W(null), [l, f] = W(0), [p, g] = W(false), [z, u] = W(false), [m, x] = W(""), [S, I] = W("3D"), [A, L] = W(r === "AK" ? 2 : 1), [y, v] = W(false), [b, D] = W(null), [w, k] = W(r ?? null), [F, B] = W("mm"), [$, N] = W(false), [U, be] = W(""), [ae, fe] = W(false), [ie, J] = W(false), [Y, pe] = W(false), [Z, he] = W(false), [me, ue] = W(null), [H, q] = W(null), [xe, Ce] = W(null), [we, oe] = W(false), [V, X] = W([]), [Le, Pe] = W(null), [Xe, se] = W(null), [ze, _t] = W(null), [pt, Sn] = W(null), [vn, Dt] = W(false), [Bt, Cn] = W(null), [ht, Ie] = W(null), [Be, Mn] = W(false), [Rt, zn] = W(Oo), [Oe, Wt] = W("obj"), [Ae, gt] = W(o), [et, Et] = W(true), [Tt, mt] = W(false), [Ot, An] = W(false), [xt, kn] = W(null), [$t] = W("#c8c8c8"), [Fn] = W(1), [Ge, Ln] = W(false), [yt, Ht] = W([]), tt = le(null), $e = le(null), bt = le(false), Pn = le(null), wt = le(null), St = le(null), Ke = re(async () => {
3195
+ const er = ({ config: e, spacingType: r, scanUrl: t, formMeasurements: o, onComplete: l, isDebugUser: s = false, onAnalyticsEvent: c, wasmModule: a }) => {
3196
+ const [n, h] = E(null), [d, u] = E(0), [p, g] = E(false), [M, f] = E(false), [m, x] = E(""), [S, I] = E("3D"), [F, P] = E(r === "AK" ? 2 : 1), [b, z] = E(false), [y, D] = E(null), [w, A] = E(r ?? null), [k, B] = E("mm"), [$, N] = E(false), [U, be] = E(""), [ae, fe] = E(false), [ie, J] = E(false), [Y, pe] = E(false), [Z, he] = E(false), [me, ue] = E(null), [H, q] = E(null), [xe, Ce] = E(null), [we, ne] = E(false), [V, X] = E([]), [Le, Pe] = E(null), [Xe, se] = E(null), [ze, _t] = E(null), [pt, Sn] = E(null), [vn, Dt] = E(false), [Bt, Cn] = E(null), [ht, Ie] = E(null), [Be, Mn] = E(false), [Rt, zn] = E(Oo), [Oe, Wt] = E("obj"), [Ae, gt] = E(o), [et, Et] = E(true), [Tt, mt] = E(false), [Ot, An] = E(false), [xt, kn] = E(null), [$t] = E("#c8c8c8"), [Fn] = E(1), [Ge, Ln] = E(false), [yt, Ht] = E([]), tt = le(null), $e = le(null), bt = le(false), Pn = le(null), wt = le(null), St = le(null), Ke = oe(async () => {
3197
3197
  if (St.current) try {
3198
- const C = (await import("./html2canvas.esm-Dmi1NfiH.js")).default, _ = St.current, E = 2, R = async (K = false) => {
3199
- const te = await C(_, {
3198
+ const v = (await import("./html2canvas.esm-Dmi1NfiH.js")).default, _ = St.current, W = 2, R = async (K = false) => {
3199
+ const te = await v(_, {
3200
3200
  backgroundColor: null,
3201
3201
  useCORS: true,
3202
- scale: E,
3202
+ scale: W,
3203
3203
  ignoreElements: (rt) => {
3204
3204
  var _a;
3205
3205
  return ((_a = rt.style) == null ? void 0 : _a.zIndex) === "10";
@@ -3213,7 +3213,7 @@ let __tla = (async () => {
3213
3213
  const Nn = (He * te.width + Ve) * 4;
3214
3214
  _e[Nn + 3] > 20 && (Ve < De && (De = Ve), Ve > qe && (qe = Ve), He < We && (We = He), He > it && (it = He));
3215
3215
  }
3216
- qe <= De && (De = 0, We = 0, qe = te.width, it = te.height), ve = De / E, Me = We / E, ye = qe / E, Ee = it / E;
3216
+ qe <= De && (De = 0, We = 0, qe = te.width, it = te.height), ve = De / W, Me = We / W, ye = qe / W, Ee = it / W;
3217
3217
  } else {
3218
3218
  const rt = _.querySelectorAll("[style*='pointer-events: none']");
3219
3219
  ve = 1 / 0, Me = 1 / 0, ye = -1 / 0, Ee = -1 / 0, rt.forEach((kt) => {
@@ -3225,7 +3225,7 @@ let __tla = (async () => {
3225
3225
  }
3226
3226
  const Kt = Math.max(ke, Re) * 0.03, Ut = Math.max(ke, Re) * 0.06;
3227
3227
  ve = Math.max(0, ve - Kt), Me = Math.max(0, Me - Ut), ye = Math.min(ke, ye + Kt), Ee = Math.min(Re, Ee + Ut);
3228
- const zt = (ye - ve) * E, At = (Ee - Me) * E, Vn = Math.max(0, ve * E), jn = Math.max(0, Me * E), ot = document.createElement("canvas");
3228
+ const zt = (ye - ve) * W, At = (Ee - Me) * W, Vn = Math.max(0, ve * W), jn = Math.max(0, Me * W), ot = document.createElement("canvas");
3229
3229
  return ot.width = Math.round(zt), ot.height = Math.round(At), ot.getContext("2d").drawImage(te, Math.round(Vn), Math.round(jn), Math.round(zt), Math.round(At), 0, 0, Math.round(zt), Math.round(At)), ot.toDataURL("image/png");
3230
3230
  };
3231
3231
  wt.current && wt.current(), await new Promise((K) => setTimeout(K, 200)), await new Promise((K) => requestAnimationFrame(() => requestAnimationFrame(K)));
@@ -3239,34 +3239,34 @@ let __tla = (async () => {
3239
3239
  } catch {
3240
3240
  return;
3241
3241
  }
3242
- }, []), Se = re((C) => {
3243
- const _ = /* @__PURE__ */ new Date(), E = `${String(_.getHours()).padStart(2, "0")}:${String(_.getMinutes()).padStart(2, "0")}:${String(_.getSeconds()).padStart(2, "0")}.${String(_.getMilliseconds()).padStart(3, "0")}`;
3242
+ }, []), Se = oe((v) => {
3243
+ const _ = /* @__PURE__ */ new Date(), W = `${String(_.getHours()).padStart(2, "0")}:${String(_.getMinutes()).padStart(2, "0")}:${String(_.getSeconds()).padStart(2, "0")}.${String(_.getMilliseconds()).padStart(3, "0")}`;
3244
3244
  Ht((R) => [
3245
3245
  ...R.slice(-200),
3246
- `[${E}] ${C}`
3246
+ `[${W}] ${v}`
3247
3247
  ]);
3248
- }, []), { landmarkPoints: T, clearLandmarkPoints: In, addLandmarkPoint: Vt, removeLandmarkPoint: jt, updateLandmarkPositions: Nt, setAligned: Yt, isAligned: ee, setCut: Xt, isCut: vt } = It(), nt = A * at;
3249
- ne(() => {
3250
- if (!d || T.length === 0) return;
3251
- const C = T[T.length - 1];
3252
- Se(`LANDMARK[${T.length - 1}]: placed at (${C.position.x.toFixed(1)}, ${C.position.y.toFixed(1)}, ${C.position.z.toFixed(1)}) face=${C.faceIndex}`);
3248
+ }, []), { landmarkPoints: T, clearLandmarkPoints: In, addLandmarkPoint: Vt, removeLandmarkPoint: jt, updateLandmarkPositions: Nt, setAligned: Yt, isAligned: ee, setCut: Xt, isCut: vt } = It(), nt = F * at;
3249
+ re(() => {
3250
+ if (!s || T.length === 0) return;
3251
+ const v = T[T.length - 1];
3252
+ Se(`LANDMARK[${T.length - 1}]: placed at (${v.position.x.toFixed(1)}, ${v.position.y.toFixed(1)}, ${v.position.z.toFixed(1)}) face=${v.faceIndex}`);
3253
3253
  }, [
3254
3254
  T.length,
3255
- d,
3255
+ s,
3256
3256
  Se
3257
- ]), ne(() => {
3258
- d && ee && Se("STATE: mesh aligned");
3257
+ ]), re(() => {
3258
+ s && ee && Se("STATE: mesh aligned");
3259
3259
  }, [
3260
3260
  ee,
3261
- d,
3261
+ s,
3262
3262
  Se
3263
- ]), ne(() => {
3264
- d && vt && Se("STATE: mesh cut");
3263
+ ]), re(() => {
3264
+ s && vt && Se("STATE: mesh cut");
3265
3265
  }, [
3266
3266
  vt,
3267
- d,
3267
+ s,
3268
3268
  Se
3269
- ]), ne(() => {
3269
+ ]), re(() => {
3270
3270
  tt.current && (tt.current.scrollTop = tt.current.scrollHeight);
3271
3271
  }, [
3272
3272
  yt
@@ -3274,20 +3274,20 @@ let __tla = (async () => {
3274
3274
  const Gt = j(() => xe ? new O.Mesh(xe) : null, [
3275
3275
  xe
3276
3276
  ]);
3277
- ne(() => {
3277
+ re(() => {
3278
3278
  o && gt(o);
3279
3279
  }, [
3280
3280
  o
3281
- ]), ne(() => {
3281
+ ]), re(() => {
3282
3282
  o || gt(void 0);
3283
3283
  }, [
3284
- A
3284
+ F
3285
3285
  ]);
3286
3286
  const Ct = le(false);
3287
- ne(() => {
3287
+ re(() => {
3288
3288
  if (!ee || V.length === 0 || Ct.current || !c) return;
3289
3289
  Ct.current = true;
3290
- const C = T.length >= 3 ? Math.abs(T[2].position.y - T[0].position.y) : null;
3290
+ const v = T.length >= 3 ? Math.abs(T[2].position.y - T[0].position.y) : null;
3291
3291
  c("dimensions_calculated", {
3292
3292
  spacing_type: w,
3293
3293
  source_unit: "mm",
@@ -3297,73 +3297,73 @@ let __tla = (async () => {
3297
3297
  is_unit_converted: false,
3298
3298
  form_measurements: (Ae == null ? void 0 : Ae.filter((_) => _ != null)) ?? null,
3299
3299
  scan_measurements: V.map((_) => +(_.modifiedValue ?? _.originalValue).toFixed(1)),
3300
- measurement_variance: Ae ? V.map((_, E) => {
3301
- const R = Ae[E];
3300
+ measurement_variance: Ae ? V.map((_, W) => {
3301
+ const R = Ae[W];
3302
3302
  return R == null ? null : +((_.modifiedValue ?? _.originalValue) - R).toFixed(1);
3303
3303
  }) : null,
3304
- frontal_height: C !== null ? +C.toFixed(1) : null
3304
+ frontal_height: v !== null ? +v.toFixed(1) : null
3305
3305
  });
3306
3306
  }, [
3307
3307
  ee,
3308
3308
  V
3309
- ]), ne(() => {
3309
+ ]), re(() => {
3310
3310
  a !== void 0 && ($e.current = a), Ln(true);
3311
3311
  }, [
3312
3312
  a
3313
3313
  ]);
3314
- const Ue = re((C, _) => {
3315
- C.computeBoundingBox();
3316
- const E = C.boundingBox, R = new M();
3317
- E.getCenter(R), C.translate(-R.x, -R.y, -R.z), C.computeBoundingBox();
3318
- const ge = C.boundingBox, G = new M();
3319
- ge.getSize(G), f(Math.max(G.x, G.y, G.z));
3320
- const K = new O.Mesh(C, new O.MeshStandardMaterial({
3314
+ const Ue = oe((v, _) => {
3315
+ v.computeBoundingBox();
3316
+ const W = v.boundingBox, R = new C();
3317
+ W.getCenter(R), v.translate(-R.x, -R.y, -R.z), v.computeBoundingBox();
3318
+ const ge = v.boundingBox, G = new C();
3319
+ ge.getSize(G), u(Math.max(G.x, G.y, G.z));
3320
+ const K = new O.Mesh(v, new O.MeshStandardMaterial({
3321
3321
  color: 8947848,
3322
3322
  side: O.DoubleSide
3323
3323
  }));
3324
3324
  h(K), fe(_), J(true), he(false), bt.current = false;
3325
- }, []), Je = re(async (C, _) => {
3325
+ }, []), Je = oe(async (v, _) => {
3326
3326
  Ie(null);
3327
- const E = _.toLowerCase(), R = E.endsWith(".stl");
3328
- if (!E.endsWith(".obj") && !R) {
3327
+ const W = _.toLowerCase(), R = W.endsWith(".stl");
3328
+ if (!W.endsWith(".obj") && !R) {
3329
3329
  Ie("Unsupported file format. Please use OBJ or STL.");
3330
3330
  return;
3331
3331
  }
3332
- Wt(R ? "stl" : "obj"), u(true), x("Processing file..."), Se(`FILE_LOAD: ${_} (${R ? "STL" : "OBJ"})`);
3332
+ Wt(R ? "stl" : "obj"), f(true), x("Processing file..."), Se(`FILE_LOAD: ${_} (${R ? "STL" : "OBJ"})`);
3333
3333
  try {
3334
3334
  let G;
3335
- if (R) if (x("Converting STL..."), C instanceof ArrayBuffer) {
3335
+ if (R) if (x("Converting STL..."), v instanceof ArrayBuffer) {
3336
3336
  const Q = new Blob([
3337
- C
3337
+ v
3338
3338
  ]), ke = new File([
3339
3339
  Q
3340
3340
  ], _);
3341
3341
  G = await Ft(ke);
3342
3342
  } else {
3343
3343
  const Q = new Blob([
3344
- C
3344
+ v
3345
3345
  ]), ke = new File([
3346
3346
  Q
3347
3347
  ], _);
3348
3348
  G = await Ft(ke);
3349
3349
  }
3350
- else G = typeof C == "string" ? C : new TextDecoder().decode(C);
3350
+ else G = typeof v == "string" ? v : new TextDecoder().decode(v);
3351
3351
  const K = performance.now(), te = $e.current ? await so(G, $e.current, (Q) => {
3352
3352
  x(Q), Se(`PREPROCESS: ${Q}`);
3353
3353
  }) : null;
3354
- if (te) Se(`PREPROCESS: done in ${(performance.now() - K).toFixed(0)}ms \u2014 unit=${te.detectedUnit}, scaled=${te.wasScaled}`), e.showAmputationModal && !r ? (D(te), v(true)) : Ue(te.geometry, te.wasScaled);
3354
+ if (te) Se(`PREPROCESS: done in ${(performance.now() - K).toFixed(0)}ms \u2014 unit=${te.detectedUnit}, scaled=${te.wasScaled}`), e.showAmputationModal && !r ? (D(te), z(true)) : Ue(te.geometry, te.wasScaled);
3355
3355
  else {
3356
3356
  x("Using fallback loader...");
3357
3357
  const Q = lo(G);
3358
3358
  Q ? e.showAmputationModal && !r ? (D({
3359
3359
  geometry: Q,
3360
3360
  wasScaled: false
3361
- }), v(true)) : Ue(Q, false) : Ie("Failed to parse the mesh.");
3361
+ }), z(true)) : Ue(Q, false) : Ie("Failed to parse the mesh.");
3362
3362
  }
3363
3363
  } catch (G) {
3364
3364
  Ie(G instanceof Error ? G.message : "Failed to process the mesh file.");
3365
3365
  } finally {
3366
- u(false), x("");
3366
+ f(false), x("");
3367
3367
  }
3368
3368
  }, [
3369
3369
  Ge,
@@ -3371,10 +3371,10 @@ let __tla = (async () => {
3371
3371
  r,
3372
3372
  Ue
3373
3373
  ]);
3374
- ne(() => {
3374
+ re(() => {
3375
3375
  if (!t || !Ge) return;
3376
3376
  (async () => {
3377
- u(true), x("Loading scan...");
3377
+ f(true), x("Loading scan...");
3378
3378
  try {
3379
3379
  const _ = await fetch(t);
3380
3380
  if (!_.ok) throw new Error(`Failed to download scan: ${_.status}`);
@@ -3387,36 +3387,36 @@ let __tla = (async () => {
3387
3387
  await Je(G, R);
3388
3388
  }
3389
3389
  } catch (_) {
3390
- Ie(_ instanceof Error ? _.message : "Failed to load scan from URL."), u(false), x("");
3390
+ Ie(_ instanceof Error ? _.message : "Failed to load scan from URL."), f(false), x("");
3391
3391
  }
3392
3392
  })();
3393
3393
  }, [
3394
3394
  t,
3395
3395
  Ge
3396
3396
  ]);
3397
- const _n = re((C) => {
3398
- C.preventDefault(), g(true);
3399
- }, []), Dn = re((C) => {
3400
- C.preventDefault(), g(false);
3401
- }, []), Bn = re(async (C) => {
3402
- if (C.preventDefault(), g(false), !Ge) {
3397
+ const _n = oe((v) => {
3398
+ v.preventDefault(), g(true);
3399
+ }, []), Dn = oe((v) => {
3400
+ v.preventDefault(), g(false);
3401
+ }, []), Bn = oe(async (v) => {
3402
+ if (v.preventDefault(), g(false), !Ge) {
3403
3403
  Ie("WASM module is still loading. Please wait.");
3404
3404
  return;
3405
3405
  }
3406
- const _ = C.dataTransfer.files[0];
3406
+ const _ = v.dataTransfer.files[0];
3407
3407
  if (!_) return;
3408
- const E = _.name.toLowerCase();
3409
- if (!E.endsWith(".obj") && !E.endsWith(".stl")) {
3408
+ const W = _.name.toLowerCase();
3409
+ if (!W.endsWith(".obj") && !W.endsWith(".stl")) {
3410
3410
  Ie("Please drop an OBJ or STL file.");
3411
3411
  return;
3412
3412
  }
3413
- if (E.endsWith(".stl")) {
3414
- Wt("stl"), u(true), x("Converting STL...");
3413
+ if (W.endsWith(".stl")) {
3414
+ Wt("stl"), f(true), x("Converting STL...");
3415
3415
  try {
3416
3416
  const R = await Ft(_);
3417
3417
  await Je(R, _.name.replace(/\.stl$/i, ".obj"));
3418
3418
  } catch (R) {
3419
- Ie(R instanceof Error ? R.message : "Failed to process STL file."), u(false), x("");
3419
+ Ie(R instanceof Error ? R.message : "Failed to process STL file."), f(false), x("");
3420
3420
  }
3421
3421
  } else {
3422
3422
  const R = await _.text();
@@ -3425,36 +3425,36 @@ let __tla = (async () => {
3425
3425
  }, [
3426
3426
  Ge,
3427
3427
  Je
3428
- ]), Rn = re((C) => {
3429
- k(C), L(C === "AK" ? 2 : 1), v(false), b && (Ue(b.geometry, b.wasScaled), D(null)), c == null ? void 0 : c("file_loaded", {
3430
- spacing_type: C,
3428
+ ]), Rn = oe((v) => {
3429
+ A(v), P(v === "AK" ? 2 : 1), z(false), y && (Ue(y.geometry, y.wasScaled), D(null)), c == null ? void 0 : c("file_loaded", {
3430
+ spacing_type: v,
3431
3431
  file_format: Oe,
3432
3432
  is_double_wall: false
3433
3433
  });
3434
3434
  }, [
3435
- b,
3435
+ y,
3436
3436
  Ue,
3437
3437
  c,
3438
3438
  Oe
3439
3439
  ]);
3440
- ne(() => {
3440
+ re(() => {
3441
3441
  if (!n || T.length !== 1 || !$e.current || bt.current) return;
3442
3442
  bt.current = true;
3443
- const C = T[0], _ = $e.current, E = n.geometry, { positions: R, indices: ge } = ct(E), G = new Float32Array([
3444
- C.position.x,
3445
- C.position.y,
3446
- C.position.z
3443
+ const v = T[0], _ = $e.current, W = n.geometry, { positions: R, indices: ge } = ct(W), G = new Float32Array([
3444
+ v.position.x,
3445
+ v.position.y,
3446
+ v.position.z
3447
3447
  ]), K = _.detect_shell(R, ge, G, 40), te = K.details(), Q = K.is_double_shell();
3448
- Se(`SHELL_DETECT: ${Q ? "DOUBLE" : "SINGLE"} \u2014 ${te}`), Q && (pe(true), oe(true), Se(`SHELL_DETECT: double shell, thickness=${K.thickness().toFixed(1)}mm`));
3448
+ Se(`SHELL_DETECT: ${Q ? "DOUBLE" : "SINGLE"} \u2014 ${te}`), Q && (pe(true), ne(true), Se(`SHELL_DETECT: double shell, thickness=${K.thickness().toFixed(1)}mm`));
3449
3449
  }, [
3450
3450
  n,
3451
3451
  T,
3452
3452
  Se
3453
3453
  ]);
3454
- const Wn = re(() => {
3454
+ const Wn = oe(() => {
3455
3455
  if (!n || T.length < 2) return;
3456
3456
  N(true), be("Please wait..."), Se("PIPELINE: starting processing pipeline...");
3457
- const C = performance.now();
3457
+ const v = performance.now();
3458
3458
  setTimeout(() => {
3459
3459
  const _ = [
3460
3460
  T[1],
@@ -3462,37 +3462,37 @@ let __tla = (async () => {
3462
3462
  ...T.slice(2)
3463
3463
  ];
3464
3464
  po(n, _, at, {
3465
- onStatus: (E) => {
3466
- be(E), Se(`PIPELINE: ${E}`);
3465
+ onStatus: (W) => {
3466
+ be(W), Se(`PIPELINE: ${W}`);
3467
3467
  },
3468
3468
  addLandmarkPoint: Vt,
3469
3469
  removeLandmarkPoint: jt,
3470
- updateLandmarkPositions: (E) => {
3470
+ updateLandmarkPositions: (W) => {
3471
3471
  const R = [
3472
- E[1],
3473
- E[0],
3474
- ...E.slice(2)
3472
+ W[1],
3473
+ W[0],
3474
+ ...W.slice(2)
3475
3475
  ];
3476
3476
  Nt(R);
3477
3477
  },
3478
3478
  setAligned: Yt,
3479
3479
  setCut: Xt,
3480
- setModelSize: f,
3480
+ setModelSize: u,
3481
3481
  setOriginalEndY: Sn,
3482
3482
  setAdjustedStartY: se,
3483
3483
  setAdjustedEndY: _t,
3484
3484
  setError: Ie,
3485
- setDoubleShell: (E) => {
3486
- pe(E), oe(true);
3485
+ setDoubleShell: (W) => {
3486
+ pe(W), ne(true);
3487
3487
  },
3488
- setAoData: (E, R) => {
3489
- ue(E), q(R ?? null);
3488
+ setAoData: (W, R) => {
3489
+ ue(W), q(R ?? null);
3490
3490
  },
3491
3491
  setInnerShellExtracted: he,
3492
3492
  setMeasurementGeometry: Ce,
3493
3493
  setWasmSlices: Pe,
3494
3494
  wasmModule: $e.current ?? void 0
3495
- }), Se(`PIPELINE: completed in ${(performance.now() - C).toFixed(0)}ms`), Ct.current = false, N(false);
3495
+ }), Se(`PIPELINE: completed in ${(performance.now() - v).toFixed(0)}ms`), Ct.current = false, N(false);
3496
3496
  }, 50);
3497
3497
  }, [
3498
3498
  n,
@@ -3504,7 +3504,7 @@ let __tla = (async () => {
3504
3504
  Xt,
3505
3505
  Z
3506
3506
  ]), Zt = le(false);
3507
- ne(() => {
3507
+ re(() => {
3508
3508
  ee && V.length > 0 && !Zt.current && (Zt.current = true, mt(true));
3509
3509
  }, [
3510
3510
  ee,
@@ -3514,21 +3514,21 @@ let __tla = (async () => {
3514
3514
  var _a;
3515
3515
  if (!n || T.length < 3) return 0;
3516
3516
  if (Y) return Math.abs(T[0].position.y - T[2].position.y);
3517
- const C = n.geometry;
3518
- C.computeBoundingBox();
3519
- const _ = ((_a = C.boundingBox) == null ? void 0 : _a.min.y) ?? 0;
3517
+ const v = n.geometry;
3518
+ v.computeBoundingBox();
3519
+ const _ = ((_a = v.boundingBox) == null ? void 0 : _a.min.y) ?? 0;
3520
3520
  return Math.abs(T[0].position.y - _);
3521
3521
  }, [
3522
3522
  n,
3523
3523
  T,
3524
3524
  Y
3525
- ]), En = re((C) => {
3526
- kn(C), gt(C.circumferences), mt(false), Et(true), An(true);
3527
- }, []), Tn = re(async (C) => {
3528
- if (!s || !n || !w) return;
3525
+ ]), En = oe((v) => {
3526
+ kn(v), gt(v.circumferences), mt(false), Et(true), An(true);
3527
+ }, []), Tn = oe(async (v) => {
3528
+ if (!l || !n || !w) return;
3529
3529
  mt(false);
3530
3530
  const _ = await Ke();
3531
- s({
3531
+ l({
3532
3532
  spacingType: w,
3533
3533
  sourceUnit: "mm",
3534
3534
  fileFormat: Oe,
@@ -3542,11 +3542,11 @@ let __tla = (async () => {
3542
3542
  transverseAP: 0,
3543
3543
  scanUrl: t,
3544
3544
  decision: "skip",
3545
- skipReason: C,
3545
+ skipReason: v,
3546
3546
  screenshots: _
3547
3547
  });
3548
3548
  }, [
3549
- s,
3549
+ l,
3550
3550
  n,
3551
3551
  w,
3552
3552
  Oe,
@@ -3556,9 +3556,9 @@ let __tla = (async () => {
3556
3556
  Qe,
3557
3557
  t,
3558
3558
  Ke
3559
- ]), Mt = re(async (C) => {
3560
- if (!s || !n || V.length === 0 || !w) return;
3561
- let _ = 0, E = 0;
3559
+ ]), Mt = oe(async (v) => {
3560
+ if (!l || !n || V.length === 0 || !w) return;
3561
+ let _ = 0, W = 0;
3562
3562
  if (T.length >= 2) {
3563
3563
  const ge = n.geometry, K = T[0].position.y;
3564
3564
  try {
@@ -3566,31 +3566,31 @@ let __tla = (async () => {
3566
3566
  if (Q.linePoints.length >= 2) {
3567
3567
  let ke = Q.linePoints[0], Re = Q.linePoints[0], ve = Q.linePoints[0], Me = Q.linePoints[0];
3568
3568
  for (const ye of Q.linePoints) ye.x < ke.x && (ke = ye), ye.x > Re.x && (Re = ye), ye.z < ve.z && (ve = ye), ye.z > Me.z && (Me = ye);
3569
- _ = new M(ke.x, K, ke.z).distanceTo(new M(Re.x, K, Re.z)), E = new M(ve.x, K, ve.z).distanceTo(new M(Me.x, K, Me.z));
3569
+ _ = new C(ke.x, K, ke.z).distanceTo(new C(Re.x, K, Re.z)), W = new C(ve.x, K, ve.z).distanceTo(new C(Me.x, K, Me.z));
3570
3570
  }
3571
3571
  } catch {
3572
3572
  }
3573
3573
  }
3574
3574
  const R = await Ke();
3575
- s({
3575
+ l({
3576
3576
  spacingType: w,
3577
3577
  sourceUnit: "mm",
3578
3578
  fileFormat: Oe,
3579
- measurementSource: C === "use_form_measurements" ? "form_provided" : "scan_derived",
3579
+ measurementSource: v === "use_form_measurements" ? "form_provided" : "scan_derived",
3580
3580
  isDoubleWall: Y,
3581
3581
  isUnitConverted: false,
3582
3582
  formMeasurements: Ae,
3583
3583
  scanMeasurements: V,
3584
3584
  frontalHeight: (xt == null ? void 0 : xt.frontalHeight) ?? Qe,
3585
3585
  transverseML: _,
3586
- transverseAP: E,
3586
+ transverseAP: W,
3587
3587
  scanUrl: t,
3588
- decision: C,
3588
+ decision: v,
3589
3589
  userEnteredMeasurements: xt ?? void 0,
3590
3590
  screenshots: R
3591
3591
  });
3592
3592
  }, [
3593
- s,
3593
+ l,
3594
3594
  n,
3595
3595
  V,
3596
3596
  w,
@@ -3604,13 +3604,13 @@ let __tla = (async () => {
3604
3604
  Ke
3605
3605
  ]), On = j(() => {
3606
3606
  if (!Ae || V.length === 0) return false;
3607
- const C = Math.min(Ae.length, V.length);
3608
- if (C === 0) return false;
3609
- for (let _ = 0; _ < C; _++) {
3610
- const E = Ae[_], R = V[_];
3611
- if (!R || E == null || E === 0) continue;
3607
+ const v = Math.min(Ae.length, V.length);
3608
+ if (v === 0) return false;
3609
+ for (let _ = 0; _ < v; _++) {
3610
+ const W = Ae[_], R = V[_];
3611
+ if (!R || W == null || W === 0) continue;
3612
3612
  const ge = R.modifiedValue ?? R.originalValue;
3613
- if (Math.abs(ge - E) > 7) return false;
3613
+ if (Math.abs(ge - W) > 7) return false;
3614
3614
  }
3615
3615
  return true;
3616
3616
  }, [
@@ -3638,10 +3638,10 @@ let __tla = (async () => {
3638
3638
  number: 5
3639
3639
  }
3640
3640
  ];
3641
- return P(to.Provider, {
3641
+ return L(to.Provider, {
3642
3642
  value: e,
3643
3643
  children: [
3644
- P("div", {
3644
+ L("div", {
3645
3645
  style: {
3646
3646
  flex: 1,
3647
3647
  display: "flex",
@@ -3674,7 +3674,7 @@ let __tla = (async () => {
3674
3674
  steps: Hn,
3675
3675
  currentStep: $n
3676
3676
  }),
3677
- P("div", {
3677
+ L("div", {
3678
3678
  style: {
3679
3679
  flex: 1,
3680
3680
  display: "flex",
@@ -3682,7 +3682,7 @@ let __tla = (async () => {
3682
3682
  minHeight: 0
3683
3683
  },
3684
3684
  children: [
3685
- P("div", {
3685
+ L("div", {
3686
3686
  ref: St,
3687
3687
  style: {
3688
3688
  flex: 1,
@@ -3694,7 +3694,7 @@ let __tla = (async () => {
3694
3694
  onDragLeave: e.showDragDrop ? Dn : void 0,
3695
3695
  onDrop: e.showDragDrop ? Bn : void 0,
3696
3696
  children: [
3697
- e.showDragDrop && !n && !z && i("div", {
3697
+ e.showDragDrop && !n && !M && i("div", {
3698
3698
  style: {
3699
3699
  position: "absolute",
3700
3700
  inset: 16,
@@ -3713,7 +3713,7 @@ let __tla = (async () => {
3713
3713
  fontFamily: "system-ui, sans-serif"
3714
3714
  },
3715
3715
  children: "Drag & Drop Files Here"
3716
- }) : P("div", {
3716
+ }) : L("div", {
3717
3717
  style: {
3718
3718
  textAlign: "center"
3719
3719
  },
@@ -3743,7 +3743,7 @@ let __tla = (async () => {
3743
3743
  ]
3744
3744
  })
3745
3745
  }),
3746
- !e.showDragDrop && !n && !z && !ht && i("div", {
3746
+ !e.showDragDrop && !n && !M && !ht && i("div", {
3747
3747
  style: {
3748
3748
  position: "absolute",
3749
3749
  inset: 0,
@@ -3751,7 +3751,7 @@ let __tla = (async () => {
3751
3751
  alignItems: "center",
3752
3752
  justifyContent: "center"
3753
3753
  },
3754
- children: P("div", {
3754
+ children: L("div", {
3755
3755
  style: {
3756
3756
  textAlign: "center"
3757
3757
  },
@@ -3781,7 +3781,7 @@ let __tla = (async () => {
3781
3781
  ]
3782
3782
  })
3783
3783
  }),
3784
- n && !ee && T.length === 0 && P("div", {
3784
+ n && !ee && T.length === 0 && L("div", {
3785
3785
  style: {
3786
3786
  position: "absolute",
3787
3787
  top: 16,
@@ -3813,7 +3813,7 @@ let __tla = (async () => {
3813
3813
  w === "AK" ? "IT" : "MPT"
3814
3814
  ]
3815
3815
  }),
3816
- n && !ee && T.length === 1 && P("div", {
3816
+ n && !ee && T.length === 1 && L("div", {
3817
3817
  style: {
3818
3818
  position: "absolute",
3819
3819
  top: 16,
@@ -3844,7 +3844,7 @@ let __tla = (async () => {
3844
3844
  "Click mesh to set Origin"
3845
3845
  ]
3846
3846
  }),
3847
- z && i(en, {
3847
+ M && i(en, {
3848
3848
  message: m || "Processing mesh..."
3849
3849
  }),
3850
3850
  $ && i(en, {
@@ -3854,7 +3854,7 @@ let __tla = (async () => {
3854
3854
  message: ht,
3855
3855
  onDismiss: () => Ie(null)
3856
3856
  }),
3857
- e.showAmputationModal && y && i("div", {
3857
+ e.showAmputationModal && b && i("div", {
3858
3858
  style: {
3859
3859
  position: "absolute",
3860
3860
  inset: 0,
@@ -3866,7 +3866,7 @@ let __tla = (async () => {
3866
3866
  justifyContent: "center",
3867
3867
  zIndex: 20
3868
3868
  },
3869
- children: P("div", {
3869
+ children: L("div", {
3870
3870
  style: {
3871
3871
  backgroundColor: "#fff",
3872
3872
  borderRadius: 4,
@@ -3875,7 +3875,7 @@ let __tla = (async () => {
3875
3875
  fontFamily: "system-ui, sans-serif"
3876
3876
  },
3877
3877
  children: [
3878
- P("div", {
3878
+ L("div", {
3879
3879
  style: {
3880
3880
  padding: "24px 24px 20px"
3881
3881
  },
@@ -3905,8 +3905,8 @@ let __tla = (async () => {
3905
3905
  children: [
3906
3906
  "AK",
3907
3907
  "BK"
3908
- ].map((C) => P("label", {
3909
- onClick: () => k(C),
3908
+ ].map((v) => L("label", {
3909
+ onClick: () => A(v),
3910
3910
  style: {
3911
3911
  flex: 1,
3912
3912
  display: "flex",
@@ -3915,16 +3915,16 @@ let __tla = (async () => {
3915
3915
  border: "2px solid",
3916
3916
  borderRadius: 4,
3917
3917
  cursor: "pointer",
3918
- borderColor: w === C ? "rgb(12, 67, 173)" : "#e0e0e0",
3919
- backgroundColor: w === C ? "rgba(12, 67, 173, 0.04)" : "#fff",
3918
+ borderColor: w === v ? "rgb(12, 67, 173)" : "#e0e0e0",
3919
+ backgroundColor: w === v ? "rgba(12, 67, 173, 0.04)" : "#fff",
3920
3920
  transition: "border-color 0.15s, background-color 0.15s"
3921
3921
  },
3922
3922
  children: [
3923
3923
  i("input", {
3924
3924
  type: "radio",
3925
3925
  name: "ampType",
3926
- checked: w === C,
3927
- onChange: () => k(C),
3926
+ checked: w === v,
3927
+ onChange: () => A(v),
3928
3928
  style: {
3929
3929
  accentColor: "rgb(12, 67, 173)",
3930
3930
  marginBottom: 12,
@@ -3939,24 +3939,24 @@ let __tla = (async () => {
3939
3939
  color: "rgba(0,0,0,0.87)",
3940
3940
  marginBottom: 4
3941
3941
  },
3942
- children: C
3942
+ children: v
3943
3943
  }),
3944
- P("span", {
3944
+ L("span", {
3945
3945
  style: {
3946
3946
  fontSize: 13,
3947
3947
  color: "rgba(0,0,0,0.54)"
3948
3948
  },
3949
3949
  children: [
3950
- C === "AK" ? "2" : "1",
3950
+ v === "AK" ? "2" : "1",
3951
3951
  "-inch measurement spacing"
3952
3952
  ]
3953
3953
  })
3954
3954
  ]
3955
- }, C))
3955
+ }, v))
3956
3956
  })
3957
3957
  ]
3958
3958
  }),
3959
- P("div", {
3959
+ L("div", {
3960
3960
  style: {
3961
3961
  display: "flex",
3962
3962
  justifyContent: "flex-end",
@@ -3967,7 +3967,7 @@ let __tla = (async () => {
3967
3967
  children: [
3968
3968
  i("button", {
3969
3969
  onClick: () => {
3970
- v(false), D(null);
3970
+ z(false), D(null);
3971
3971
  },
3972
3972
  style: {
3973
3973
  padding: "6px 16px",
@@ -4018,7 +4018,7 @@ let __tla = (async () => {
4018
4018
  }
4019
4019
  }),
4020
4020
  i(ho, {
4021
- children: P(Kn, {
4021
+ children: L(Kn, {
4022
4022
  camera: {
4023
4023
  position: [
4024
4024
  0,
@@ -4074,7 +4074,7 @@ let __tla = (async () => {
4074
4074
  doubleShellTransparency: Y && ee
4075
4075
  }),
4076
4076
  n && S === "3D" && i(bo, {
4077
- modelSize: l,
4077
+ modelSize: d,
4078
4078
  labels: [
4079
4079
  w === "AK" ? "IT" : "MPT",
4080
4080
  "Origin",
@@ -4082,7 +4082,7 @@ let __tla = (async () => {
4082
4082
  ]
4083
4083
  }),
4084
4084
  i(ko, {
4085
- modelSize: l,
4085
+ modelSize: d,
4086
4086
  isAligned: ee,
4087
4087
  isCut: vt,
4088
4088
  mesh: n,
@@ -4102,25 +4102,25 @@ let __tla = (async () => {
4102
4102
  n && ee && T.length >= 3 && (() => {
4103
4103
  const _ = n.geometry.getIndex();
4104
4104
  if (!_ || _.count < 30) return null;
4105
- const E = T[2], R = T[0], ge = Xe ?? E.position.y, G = ze ?? pt ?? R.position.y;
4105
+ const W = T[2], R = T[0], ge = Xe ?? W.position.y, G = ze ?? pt ?? R.position.y;
4106
4106
  return S === "2D" ? i(_o, {
4107
4107
  mesh: Gt ?? n,
4108
4108
  upperY: G,
4109
4109
  originY: R.position.y,
4110
- modelSize: l,
4110
+ modelSize: d,
4111
4111
  meshColor: $t,
4112
- displayUnit: F
4113
- }) : P(Te, {
4112
+ displayUnit: k
4113
+ }) : L(Te, {
4114
4114
  children: [
4115
4115
  i(zo, {
4116
4116
  mesh: Gt ?? n,
4117
4117
  startY: ge,
4118
4118
  endY: G,
4119
4119
  spacing: nt,
4120
- modelSize: l,
4120
+ modelSize: d,
4121
4121
  onMeasurementsChange: X,
4122
4122
  reverseOrder: true,
4123
- displayUnit: F,
4123
+ displayUnit: k,
4124
4124
  useInnerSurface: Y && !Z,
4125
4125
  formMeasurements: et ? Ae : void 0,
4126
4126
  originY: Bt ?? R.position.y,
@@ -4129,9 +4129,9 @@ let __tla = (async () => {
4129
4129
  i(Ao, {
4130
4130
  mesh: n,
4131
4131
  greenY: R.position.y,
4132
- modelSize: l,
4133
- displayUnit: F,
4134
- bottomY: Y ? E.position.y : void 0
4132
+ modelSize: d,
4133
+ displayUnit: k,
4134
+ bottomY: Y ? W.position.y : void 0
4135
4135
  }),
4136
4136
  i(Do, {
4137
4137
  mesh: n,
@@ -4143,7 +4143,7 @@ let __tla = (async () => {
4143
4143
  },
4144
4144
  minY: R.position.y - nt,
4145
4145
  maxY: R.position.y + nt,
4146
- modelSize: l,
4146
+ modelSize: d,
4147
4147
  color: "#44ff44",
4148
4148
  hoverColor: "#88ff88",
4149
4149
  dragColor: "#ffffff",
@@ -4159,7 +4159,7 @@ let __tla = (async () => {
4159
4159
  }),
4160
4160
  n && e.showDebug && Be && S === "3D" && i(Uo, {
4161
4161
  mesh: n,
4162
- modelSize: l,
4162
+ modelSize: d,
4163
4163
  layers: Rt,
4164
4164
  landmarkPoints: T,
4165
4165
  componentDebug: null,
@@ -4170,13 +4170,13 @@ let __tla = (async () => {
4170
4170
  i(tr, {
4171
4171
  screenshotFnRef: Pn,
4172
4172
  mesh: n,
4173
- modelSize: l,
4173
+ modelSize: d,
4174
4174
  measurementGeometry: xe
4175
4175
  })
4176
4176
  ]
4177
4177
  })
4178
4178
  }),
4179
- n && P("div", {
4179
+ n && L("div", {
4180
4180
  style: {
4181
4181
  position: "absolute",
4182
4182
  top: 16,
@@ -4224,13 +4224,13 @@ let __tla = (async () => {
4224
4224
  }),
4225
4225
  e.showDebug && Be && n && S === "3D" && i(qo, {
4226
4226
  layers: Rt,
4227
- onToggleLayer: (C) => zn((_) => ({
4227
+ onToggleLayer: (v) => zn((_) => ({
4228
4228
  ..._,
4229
- [C]: !_[C]
4229
+ [v]: !_[v]
4230
4230
  })),
4231
4231
  isDoubleShell: Y
4232
4232
  }),
4233
- ee && V.length > 0 && P("div", {
4233
+ ee && V.length > 0 && L("div", {
4234
4234
  style: {
4235
4235
  position: "absolute",
4236
4236
  top: 16,
@@ -4240,7 +4240,7 @@ let __tla = (async () => {
4240
4240
  zIndex: 10
4241
4241
  },
4242
4242
  children: [
4243
- P("div", {
4243
+ L("div", {
4244
4244
  style: {
4245
4245
  display: "flex",
4246
4246
  borderRadius: 6,
@@ -4280,7 +4280,7 @@ let __tla = (async () => {
4280
4280
  })
4281
4281
  ]
4282
4282
  }),
4283
- P("div", {
4283
+ L("div", {
4284
4284
  style: {
4285
4285
  display: "flex",
4286
4286
  borderRadius: 6,
@@ -4294,9 +4294,9 @@ let __tla = (async () => {
4294
4294
  style: {
4295
4295
  padding: "6px 14px",
4296
4296
  fontSize: 13,
4297
- fontWeight: F === "mm" ? 600 : 400,
4298
- backgroundColor: F === "mm" ? "rgb(12, 67, 173)" : "#fff",
4299
- color: F === "mm" ? "#fff" : "#666",
4297
+ fontWeight: k === "mm" ? 600 : 400,
4298
+ backgroundColor: k === "mm" ? "rgb(12, 67, 173)" : "#fff",
4299
+ color: k === "mm" ? "#fff" : "#666",
4300
4300
  border: "none",
4301
4301
  cursor: "pointer",
4302
4302
  fontFamily: "system-ui, sans-serif"
@@ -4308,9 +4308,9 @@ let __tla = (async () => {
4308
4308
  style: {
4309
4309
  padding: "6px 14px",
4310
4310
  fontSize: 13,
4311
- fontWeight: F === "inch" ? 600 : 400,
4312
- backgroundColor: F === "inch" ? "rgb(12, 67, 173)" : "#fff",
4313
- color: F === "inch" ? "#fff" : "#666",
4311
+ fontWeight: k === "inch" ? 600 : 400,
4312
+ backgroundColor: k === "inch" ? "rgb(12, 67, 173)" : "#fff",
4313
+ color: k === "inch" ? "#fff" : "#666",
4314
4314
  border: "none",
4315
4315
  borderLeft: "1px solid #ccc",
4316
4316
  cursor: "pointer",
@@ -4320,7 +4320,7 @@ let __tla = (async () => {
4320
4320
  })
4321
4321
  ]
4322
4322
  }),
4323
- e.showSpacingToggle && S === "3D" && P("div", {
4323
+ e.showSpacingToggle && S === "3D" && L("div", {
4324
4324
  style: {
4325
4325
  display: "flex",
4326
4326
  borderRadius: 6,
@@ -4330,13 +4330,13 @@ let __tla = (async () => {
4330
4330
  },
4331
4331
  children: [
4332
4332
  i("button", {
4333
- onClick: () => L(1),
4333
+ onClick: () => P(1),
4334
4334
  style: {
4335
4335
  padding: "6px 14px",
4336
4336
  fontSize: 13,
4337
- fontWeight: A === 1 ? 600 : 400,
4338
- backgroundColor: A === 1 ? "rgb(12, 67, 173)" : "#fff",
4339
- color: A === 1 ? "#fff" : "#666",
4337
+ fontWeight: F === 1 ? 600 : 400,
4338
+ backgroundColor: F === 1 ? "rgb(12, 67, 173)" : "#fff",
4339
+ color: F === 1 ? "#fff" : "#666",
4340
4340
  border: "none",
4341
4341
  cursor: "pointer",
4342
4342
  fontFamily: "system-ui, sans-serif"
@@ -4344,13 +4344,13 @@ let __tla = (async () => {
4344
4344
  children: '1"'
4345
4345
  }),
4346
4346
  i("button", {
4347
- onClick: () => L(2),
4347
+ onClick: () => P(2),
4348
4348
  style: {
4349
4349
  padding: "6px 14px",
4350
4350
  fontSize: 13,
4351
- fontWeight: A === 2 ? 600 : 400,
4352
- backgroundColor: A === 2 ? "rgb(12, 67, 173)" : "#fff",
4353
- color: A === 2 ? "#fff" : "#666",
4351
+ fontWeight: F === 2 ? 600 : 400,
4352
+ backgroundColor: F === 2 ? "rgb(12, 67, 173)" : "#fff",
4353
+ color: F === 2 ? "#fff" : "#666",
4354
4354
  border: "none",
4355
4355
  borderLeft: "1px solid #ccc",
4356
4356
  cursor: "pointer",
@@ -4369,7 +4369,7 @@ let __tla = (async () => {
4369
4369
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
4370
4370
  },
4371
4371
  children: i("button", {
4372
- onClick: () => Et((C) => !C),
4372
+ onClick: () => Et((v) => !v),
4373
4373
  style: {
4374
4374
  padding: "6px 14px",
4375
4375
  fontSize: 13,
@@ -4393,13 +4393,13 @@ let __tla = (async () => {
4393
4393
  },
4394
4394
  children: i("button", {
4395
4395
  onClick: async () => {
4396
- const C = await Ke();
4397
- if (!C) return;
4398
- const _ = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), E = (R, ge) => {
4396
+ const v = await Ke();
4397
+ if (!v) return;
4398
+ const _ = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), W = (R, ge) => {
4399
4399
  const G = document.createElement("a");
4400
4400
  G.href = R, G.download = ge, G.click();
4401
4401
  };
4402
- E(C.frontal_view_png, `measurements_front_${_}.png`), await new Promise((R) => setTimeout(R, 300)), E(C.side_view_png, `measurements_transverse_${_}.png`);
4402
+ W(v.frontal_view_png, `measurements_front_${_}.png`), await new Promise((R) => setTimeout(R, 300)), W(v.side_view_png, `measurements_transverse_${_}.png`);
4403
4403
  },
4404
4404
  style: {
4405
4405
  padding: "6px 14px",
@@ -4414,7 +4414,7 @@ let __tla = (async () => {
4414
4414
  children: "Save"
4415
4415
  })
4416
4416
  }),
4417
- e.showDebug && d && i("div", {
4417
+ e.showDebug && s && i("div", {
4418
4418
  style: {
4419
4419
  display: "flex",
4420
4420
  borderRadius: 6,
@@ -4423,7 +4423,7 @@ let __tla = (async () => {
4423
4423
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
4424
4424
  },
4425
4425
  children: i("button", {
4426
- onClick: () => Mn((C) => !C),
4426
+ onClick: () => Mn((v) => !v),
4427
4427
  style: {
4428
4428
  padding: "6px 14px",
4429
4429
  fontSize: 13,
@@ -4445,11 +4445,11 @@ let __tla = (async () => {
4445
4445
  }),
4446
4446
  n && we && ee && i(Po, {
4447
4447
  isDoubleShell: Y,
4448
- onDismiss: () => oe(false)
4448
+ onDismiss: () => ne(false)
4449
4449
  })
4450
4450
  ]
4451
4451
  }),
4452
- P("div", {
4452
+ L("div", {
4453
4453
  style: {
4454
4454
  padding: "12px 24px",
4455
4455
  backgroundColor: "#fff",
@@ -4494,7 +4494,7 @@ let __tla = (async () => {
4494
4494
  lineHeight: "36px"
4495
4495
  },
4496
4496
  children: "Continue"
4497
- }) : P(Te, {
4497
+ }) : L(Te, {
4498
4498
  children: [
4499
4499
  i("button", {
4500
4500
  onClick: () => Mt("use_form_measurements"),
@@ -4536,7 +4536,7 @@ let __tla = (async () => {
4536
4536
  })
4537
4537
  ]
4538
4538
  }),
4539
- d && yt.length > 0 && P("div", {
4539
+ s && yt.length > 0 && L("div", {
4540
4540
  style: {
4541
4541
  height: 120,
4542
4542
  flexShrink: 0,
@@ -4549,7 +4549,7 @@ let __tla = (async () => {
4549
4549
  flexDirection: "column"
4550
4550
  },
4551
4551
  children: [
4552
- P("div", {
4552
+ L("div", {
4553
4553
  style: {
4554
4554
  display: "flex",
4555
4555
  alignItems: "center",
@@ -4569,14 +4569,14 @@ let __tla = (async () => {
4569
4569
  },
4570
4570
  children: "GALILEO DEBUG"
4571
4571
  }),
4572
- P("div", {
4572
+ L("div", {
4573
4573
  style: {
4574
4574
  display: "flex",
4575
4575
  gap: 8,
4576
4576
  alignItems: "center"
4577
4577
  },
4578
4578
  children: [
4579
- P("span", {
4579
+ L("span", {
4580
4580
  style: {
4581
4581
  color: "#484f58",
4582
4582
  fontSize: 9
@@ -4618,14 +4618,14 @@ let __tla = (async () => {
4618
4618
  padding: "4px 10px",
4619
4619
  lineHeight: 1.6
4620
4620
  },
4621
- children: yt.map((C, _) => {
4622
- const E = C.includes("ERROR") || C.includes("failed"), R = C.includes("warning") || C.includes("WARN"), ge = C.includes("PIPELINE:"), G = C.includes("STATE:");
4621
+ children: yt.map((v, _) => {
4622
+ const W = v.includes("ERROR") || v.includes("failed"), R = v.includes("warning") || v.includes("WARN"), ge = v.includes("PIPELINE:"), G = v.includes("STATE:");
4623
4623
  return i("div", {
4624
4624
  style: {
4625
- color: E ? "#f85149" : R ? "#d29922" : ge ? "#58a6ff" : G ? "#3fb950" : "#8b949e",
4625
+ color: W ? "#f85149" : R ? "#d29922" : ge ? "#58a6ff" : G ? "#3fb950" : "#8b949e",
4626
4626
  whiteSpace: "pre"
4627
4627
  },
4628
- children: C
4628
+ children: v
4629
4629
  }, _);
4630
4630
  })
4631
4631
  })
@@ -4635,7 +4635,7 @@ let __tla = (async () => {
4635
4635
  }),
4636
4636
  ee && Tt && w && i(To, {
4637
4637
  amputationType: w,
4638
- spacingInches: A,
4638
+ spacingInches: F,
4639
4639
  scanMeasurements: V,
4640
4640
  scanFrontalHeight: Qe,
4641
4641
  onSave: En,
@@ -4645,7 +4645,7 @@ let __tla = (async () => {
4645
4645
  });
4646
4646
  };
4647
4647
  function tr({ screenshotFnRef: e }) {
4648
- return ne(() => {
4648
+ return re(() => {
4649
4649
  e.current = null;
4650
4650
  }, [
4651
4651
  e
@@ -4672,84 +4672,64 @@ let __tla = (async () => {
4672
4672
  };
4673
4673
  lt = function(e, r) {
4674
4674
  const t = wn(r), o = {};
4675
- for (let s = 0; s < Math.min(e.length, t.length); s++) {
4676
- const d = e[s];
4677
- d != null && !isNaN(d) && (o[t[s]] = d);
4675
+ for (let l = 0; l < Math.min(e.length, t.length); l++) {
4676
+ const s = e[l];
4677
+ s != null && !isNaN(s) && (o[t[l]] = s);
4678
4678
  }
4679
4679
  return o;
4680
4680
  };
4681
4681
  nr = function(e, r) {
4682
4682
  if (!e) return;
4683
- const o = wn(r).map((s) => {
4684
- const d = e[s];
4685
- return d ?? void 0;
4683
+ const o = wn(r).map((l) => {
4684
+ const s = e[l];
4685
+ return s ?? void 0;
4686
4686
  });
4687
- if (!o.every((s) => s == null)) return o;
4687
+ if (!o.every((l) => l == null)) return o;
4688
4688
  };
4689
4689
  pr = ({ request: e, onComplete: r, wasmModule: t }) => {
4690
- const [o, s] = W(null), [d, c] = W(t !== void 0);
4691
- ne(() => {
4692
- if (t !== void 0) {
4693
- c(true);
4694
- return;
4695
- }
4696
- let l = false;
4697
- return import("geo-wasm").then(async (m) => {
4698
- await m.__tla;
4699
- return m;
4700
- }).then(async (f) => {
4701
- await f.default(), l || (s(f), c(true));
4702
- }).catch(() => {
4703
- l || c(true);
4704
- }), () => {
4705
- l = true;
4706
- };
4707
- }, [
4708
- t
4709
- ]);
4710
- const a = t !== void 0 ? t : o, n = j(() => nr(e.form_measurements, e.spacing_type), [
4690
+ const o = j(() => nr(e.form_measurements, e.spacing_type), [
4711
4691
  e.form_measurements,
4712
4692
  e.spacing_type
4713
- ]), h = (l) => {
4693
+ ]), l = (s) => {
4714
4694
  var _a, _b;
4715
- const f = l.scanMeasurements.map((A) => +(A.modifiedValue ?? A.originalValue).toFixed(1)), p = lt(f, e.spacing_type);
4716
- let g, z;
4717
- if (l.formMeasurements) {
4718
- g = lt(l.formMeasurements, e.spacing_type);
4719
- const A = l.scanMeasurements.map((L, y) => {
4695
+ const c = s.scanMeasurements.map((f) => +(f.modifiedValue ?? f.originalValue).toFixed(1)), a = lt(c, e.spacing_type);
4696
+ let n, h;
4697
+ if (s.formMeasurements) {
4698
+ n = lt(s.formMeasurements, e.spacing_type);
4699
+ const f = s.scanMeasurements.map((m, x) => {
4720
4700
  var _a2;
4721
- const v = (_a2 = l.formMeasurements) == null ? void 0 : _a2[y];
4722
- return v == null || isNaN(v) ? null : +((L.modifiedValue ?? L.originalValue) - v).toFixed(1);
4701
+ const S = (_a2 = s.formMeasurements) == null ? void 0 : _a2[x];
4702
+ return S == null || isNaN(S) ? null : +((m.modifiedValue ?? m.originalValue) - S).toFixed(1);
4723
4703
  });
4724
- z = lt(A, e.spacing_type);
4704
+ h = lt(f, e.spacing_type);
4725
4705
  }
4726
- const u = l.userEnteredMeasurements ? lt(l.userEnteredMeasurements.circumferences, e.spacing_type) : void 0, m = l.decision === "use_scan" || l.decision === "continue", x = m ? p : u ?? g ?? p, S = m ? +l.frontalHeight.toFixed(1) : +(((_a = l.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? l.frontalHeight).toFixed(1), I = {
4706
+ const d = s.userEnteredMeasurements ? lt(s.userEnteredMeasurements.circumferences, e.spacing_type) : void 0, u = s.decision === "use_scan" || s.decision === "continue", p = u ? a : d ?? n ?? a, g = u ? +s.frontalHeight.toFixed(1) : +(((_a = s.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? s.frontalHeight).toFixed(1), M = {
4727
4707
  spacing_type: e.spacing_type,
4728
4708
  source_unit: "mm",
4729
- file_format: l.fileFormat,
4730
- measurement_source: l.formMeasurements ? "form_provided" : "scan_derived",
4731
- is_double_wall: l.isDoubleWall,
4709
+ file_format: s.fileFormat,
4710
+ measurement_source: s.formMeasurements ? "form_provided" : "scan_derived",
4711
+ is_double_wall: s.isDoubleWall,
4732
4712
  is_unit_converted: false,
4733
- form_measurements: g,
4734
- scan_measurements: p,
4735
- measurement_variance: z,
4713
+ form_measurements: n,
4714
+ scan_measurements: a,
4715
+ measurement_variance: h,
4736
4716
  scan_url: e.scan_url,
4737
- frontal_height: +l.frontalHeight.toFixed(1),
4738
- transverse_ml: +l.transverseML.toFixed(1),
4739
- transverse_ap: +l.transverseAP.toFixed(1),
4740
- decision: l.decision,
4741
- skip_reason: l.skipReason,
4742
- user_measurements: u,
4743
- user_frontal_height: (_b = l.userEnteredMeasurements) == null ? void 0 : _b.frontalHeight,
4744
- final_measurements: x,
4745
- final_frontal_height: S,
4746
- final_transverse_ml: +l.transverseML.toFixed(1),
4747
- final_transverse_ap: +l.transverseAP.toFixed(1),
4748
- screenshots: l.screenshots
4717
+ frontal_height: +s.frontalHeight.toFixed(1),
4718
+ transverse_ml: +s.transverseML.toFixed(1),
4719
+ transverse_ap: +s.transverseAP.toFixed(1),
4720
+ decision: s.decision,
4721
+ skip_reason: s.skipReason,
4722
+ user_measurements: d,
4723
+ user_frontal_height: (_b = s.userEnteredMeasurements) == null ? void 0 : _b.frontalHeight,
4724
+ final_measurements: p,
4725
+ final_frontal_height: g,
4726
+ final_transverse_ml: +s.transverseML.toFixed(1),
4727
+ final_transverse_ap: +s.transverseAP.toFixed(1),
4728
+ screenshots: s.screenshots
4749
4729
  };
4750
- r == null ? void 0 : r(I);
4730
+ r == null ? void 0 : r(M);
4751
4731
  };
4752
- return d ? i("div", {
4732
+ return i("div", {
4753
4733
  style: {
4754
4734
  width: "100%",
4755
4735
  height: "100%",
@@ -4759,20 +4739,9 @@ let __tla = (async () => {
4759
4739
  config: eo,
4760
4740
  spacingType: e.spacing_type,
4761
4741
  scanUrl: e.scan_url,
4762
- formMeasurements: n,
4763
- onComplete: h,
4764
- wasmModule: a
4765
- })
4766
- }) : i("div", {
4767
- style: {
4768
- width: "100%",
4769
- height: "100%",
4770
- display: "flex",
4771
- alignItems: "center",
4772
- justifyContent: "center"
4773
- },
4774
- children: i("span", {
4775
- children: "Initializing..."
4742
+ formMeasurements: o,
4743
+ onComplete: l,
4744
+ wasmModule: t
4776
4745
  })
4777
4746
  });
4778
4747
  };