@ssafy-mhk/e-ver 1.0.5 → 1.0.6

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.
package/dist/index.es.js CHANGED
@@ -96,19 +96,19 @@ function O(e, t = T) {
96
96
  }
97
97
  //#endregion
98
98
  //#region src/fitting/bodyFirstFitting.ts
99
- var k = .82, A = 2.1, j = .85, M = 1.8, N = .84, P = 2.1, ee = .8, F = 1.7, te = 1, ne = 1.25, re = {
99
+ var k = .82, A = 2.1, j = .85, M = 1.8, N = .84, P = 2.1, F = .8, I = 1.7, L = 1, R = 1.25, ee = {
100
100
  scaleX: 1,
101
101
  scaleY: 1,
102
102
  scaleZ: 1,
103
103
  sleeveScale: 1,
104
104
  fitEaseScale: 1.02
105
- }, ie = {
105
+ }, te = {
106
106
  scaleX: 1,
107
107
  scaleY: 1,
108
108
  scaleZ: 1,
109
109
  sleeveScale: 1,
110
110
  fitEaseScale: 1
111
- }, ae = {
111
+ }, ne = {
112
112
  slim: {
113
113
  x: .95,
114
114
  y: .95,
@@ -127,7 +127,7 @@ var k = .82, A = 2.1, j = .85, M = 1.8, N = .84, P = 2.1, ee = .8, F = 1.7, te =
127
127
  z: 1.02,
128
128
  ease: 1.03
129
129
  }
130
- }, oe = {
130
+ }, re = {
131
131
  narrow: {
132
132
  width: .97,
133
133
  shoulder: .97
@@ -140,7 +140,7 @@ var k = .82, A = 2.1, j = .85, M = 1.8, N = .84, P = 2.1, ee = .8, F = 1.7, te =
140
140
  width: 1.03,
141
141
  shoulder: 1.04
142
142
  }
143
- }, se = {
143
+ }, z = {
144
144
  tapered: {
145
145
  depth: .98,
146
146
  vertical: .995,
@@ -157,114 +157,114 @@ var k = .82, A = 2.1, j = .85, M = 1.8, N = .84, P = 2.1, ee = .8, F = 1.7, te =
157
157
  hip: 1.03
158
158
  }
159
159
  };
160
- function I(e, t, n) {
160
+ function B(e, t, n) {
161
161
  return Math.max(t, Math.min(n, e));
162
162
  }
163
- function L(e, t, n, r) {
164
- return !e || !t || t <= 0 ? 1 : I(e / t, n, r);
163
+ function V(e, t, n, r) {
164
+ return !e || !t || t <= 0 ? 1 : B(e / t, n, r);
165
165
  }
166
- function R(e, t, n, r, i) {
167
- return !e || t <= 0 ? 1 : I((e + n) / t, r, i);
166
+ function H(e, t, n, r, i) {
167
+ return !e || t <= 0 ? 1 : B((e + n) / t, r, i);
168
168
  }
169
- function ce(e) {
170
- return oe[e?.taxonomy.upperBodySilhouette ?? "balanced"] ?? oe.balanced;
169
+ function ie(e) {
170
+ return re[e?.taxonomy.upperBodySilhouette ?? "balanced"] ?? re.balanced;
171
171
  }
172
- function le(e) {
173
- return se[e?.taxonomy.torsoOrPelvisProfile ?? "balanced"] ?? se.balanced;
172
+ function ae(e) {
173
+ return z[e?.taxonomy.torsoOrPelvisProfile ?? "balanced"] ?? z.balanced;
174
174
  }
175
- function ue(e) {
175
+ function oe(e) {
176
176
  if (!e) return !1;
177
177
  let { metrics: t } = e;
178
178
  return !!(t.heightCm || t.chestCm || t.waistCm || t.shoulderWidthCm || t.armLengthCm || t.torsoLengthCm || t.neckToHipCm);
179
179
  }
180
- function de(e, t) {
181
- let { metrics: n } = e, r = ce(e), i = le(e), a = Math.max(R(n.shoulderWidthCm, t.refShoulderWidthCm, t.shoulderEaseCm * .55, .88, 1.3), R(n.chestCm, t.refChestCircumferenceCm, t.chestEaseCm * .35, .9, 1.34), R(n.waistCm, t.refWaistCircumferenceCm, t.waistEaseCm * .3, .9, 1.3)) * r.width, o = Math.max(L(n.heightCm, t.refHeightCm, .9, 1.18), R(n.torsoLengthCm ?? n.neckToHipCm, t.refTorsoLengthCm, t.torsoEaseCm * .2, .9, 1.16)) * i.vertical, s = Math.max(R(n.chestCm, t.refChestCircumferenceCm, t.chestEaseCm * .15, .9, 1.34), R(n.waistCm, t.refWaistCircumferenceCm, t.waistEaseCm * .1, .9, 1.28)) * i.depth;
180
+ function se(e, t) {
181
+ let { metrics: n } = e, r = ie(e), i = ae(e), a = Math.max(H(n.shoulderWidthCm, t.refShoulderWidthCm, t.shoulderEaseCm * .55, .88, 1.3), H(n.chestCm, t.refChestCircumferenceCm, t.chestEaseCm * .35, .9, 1.34), H(n.waistCm, t.refWaistCircumferenceCm, t.waistEaseCm * .3, .9, 1.3)) * r.width, o = Math.max(V(n.heightCm, t.refHeightCm, .9, 1.18), H(n.torsoLengthCm ?? n.neckToHipCm, t.refTorsoLengthCm, t.torsoEaseCm * .2, .9, 1.16)) * i.vertical, s = Math.max(H(n.chestCm, t.refChestCircumferenceCm, t.chestEaseCm * .15, .9, 1.34), H(n.waistCm, t.refWaistCircumferenceCm, t.waistEaseCm * .1, .9, 1.28)) * i.depth;
182
182
  return {
183
- scaleX: I(a, k, A),
184
- scaleY: I(o, j, M),
185
- scaleZ: I(s, N, P),
186
- sleeveScale: I(L(n.armLengthCm, t.refArmLengthCm, .9, 1.16), ee, F),
187
- fitEaseScale: I(t.fitEaseScale * (r.width * .5 + i.depth * .5), te, ne)
183
+ scaleX: B(a, k, A),
184
+ scaleY: B(o, j, M),
185
+ scaleZ: B(s, N, P),
186
+ sleeveScale: B(V(n.armLengthCm, t.refArmLengthCm, .9, 1.16), F, I),
187
+ fitEaseScale: B(t.fitEaseScale * (r.width * .5 + i.depth * .5), L, R)
188
188
  };
189
189
  }
190
- function fe(e, t) {
191
- let { metrics: n } = t, r = ce(t), i = le(t), a = L(e.shoulderWidthCm, n.shoulderWidthCm, .9, 1.14) * r.shoulder, o = L(e.chestCircumferenceCm, n.chestCm, .9, 1.15), s = L(e.waistCircumferenceCm, n.waistCm, .9, 1.15);
190
+ function ce(e, t) {
191
+ let { metrics: n } = t, r = ie(t), i = ae(t), a = V(e.shoulderWidthCm, n.shoulderWidthCm, .9, 1.14) * r.shoulder, o = V(e.chestCircumferenceCm, n.chestCm, .9, 1.15), s = V(e.waistCircumferenceCm, n.waistCm, .9, 1.15);
192
192
  return {
193
- torsoScale: L(e.torsoLengthCm, n.torsoLengthCm ?? n.neckToHipCm, .9, 1.14),
193
+ torsoScale: V(e.torsoLengthCm, n.torsoLengthCm ?? n.neckToHipCm, .9, 1.14),
194
194
  chestScale: o,
195
195
  waistScale: s,
196
- hipScale: I(s * .6 + i.hip * .4, .92, 1.14),
197
- shoulderAdjust: I(a - 1, -.12, .12),
196
+ hipScale: B(s * .6 + i.hip * .4, .92, 1.14),
197
+ shoulderAdjust: B(a - 1, -.12, .12),
198
198
  postureAdjust: "neutral"
199
199
  };
200
200
  }
201
- function pe(e, t, n) {
202
- let r = le(t), i = I(1 + n.shoulderAdjust, .92, 1.14) * .3 + n.chestScale * .45 + n.waistScale * .25, a = n.chestScale * .45 + n.waistScale * .25 + n.hipScale * .3, o = L(e.armLengthCm, t.metrics.armLengthCm, .9, 1.16), s = Math.max(n.chestScale, n.waistScale, n.hipScale);
201
+ function le(e, t, n) {
202
+ let r = ae(t), i = B(1 + n.shoulderAdjust, .92, 1.14) * .3 + n.chestScale * .45 + n.waistScale * .25, a = n.chestScale * .45 + n.waistScale * .25 + n.hipScale * .3, o = V(e.armLengthCm, t.metrics.armLengthCm, .9, 1.16), s = Math.max(n.chestScale, n.waistScale, n.hipScale);
203
203
  return {
204
- scaleX: I(i, .92, 1.16),
205
- scaleY: I(n.torsoScale * r.vertical, .92, 1.14),
206
- scaleZ: I(a * r.depth, .92, 1.18),
207
- sleeveScale: I(o, ee, F),
208
- fitEaseScale: I(1 + (s - 1) * .22, .99, 1.08)
204
+ scaleX: B(i, .92, 1.16),
205
+ scaleY: B(n.torsoScale * r.vertical, .92, 1.14),
206
+ scaleZ: B(a * r.depth, .92, 1.18),
207
+ sleeveScale: B(o, F, I),
208
+ fitEaseScale: B(1 + (s - 1) * .22, .99, 1.08)
209
209
  };
210
210
  }
211
- function me(e, t) {
211
+ function ue(e, t) {
212
212
  if (!t || !Number.isFinite(t) || t <= 0) return e;
213
- let n = I(t, .88, 1.2), r = 1 + (n - 1) * .35;
213
+ let n = B(t, .88, 1.2), r = 1 + (n - 1) * .35;
214
214
  return {
215
- scaleX: I(e.scaleX * n, k, A),
216
- scaleY: I(e.scaleY * r, j, M),
217
- scaleZ: I(e.scaleZ * n, N, P),
218
- sleeveScale: I(e.sleeveScale * r, ee, F),
219
- fitEaseScale: I(e.fitEaseScale * n, te, ne)
215
+ scaleX: B(e.scaleX * n, k, A),
216
+ scaleY: B(e.scaleY * r, j, M),
217
+ scaleZ: B(e.scaleZ * n, N, P),
218
+ sleeveScale: B(e.sleeveScale * r, F, I),
219
+ fitEaseScale: B(e.fitEaseScale * n, L, R)
220
220
  };
221
221
  }
222
- function he(e, t) {
223
- let n = ae[t];
222
+ function de(e, t) {
223
+ let n = ne[t];
224
224
  return {
225
- scaleX: I(e.scaleX * n.x, k, A),
226
- scaleY: I(e.scaleY * n.y, j, M),
227
- scaleZ: I(e.scaleZ * n.z, N, P),
225
+ scaleX: B(e.scaleX * n.x, k, A),
226
+ scaleY: B(e.scaleY * n.y, j, M),
227
+ scaleZ: B(e.scaleZ * n.z, N, P),
228
228
  sleeveScale: e.sleeveScale,
229
- fitEaseScale: I(e.fitEaseScale * n.ease, te, ne)
229
+ fitEaseScale: B(e.fitEaseScale * n.ease, L, R)
230
230
  };
231
231
  }
232
- function ge(e, t) {
232
+ function fe(e, t) {
233
233
  return {
234
- scaleX: I(e.scaleX * t.scaleX, k, A),
235
- scaleY: I(e.scaleY * t.scaleY, j, M),
236
- scaleZ: I(e.scaleZ * t.scaleZ, N, P),
237
- sleeveScale: I(e.sleeveScale * t.sleeveScale, ee, F),
238
- fitEaseScale: I(e.fitEaseScale * t.fitEaseScale, te, ne)
234
+ scaleX: B(e.scaleX * t.scaleX, k, A),
235
+ scaleY: B(e.scaleY * t.scaleY, j, M),
236
+ scaleZ: B(e.scaleZ * t.scaleZ, N, P),
237
+ sleeveScale: B(e.sleeveScale * t.sleeveScale, F, I),
238
+ fitEaseScale: B(e.fitEaseScale * t.fitEaseScale, L, R)
239
239
  };
240
240
  }
241
- function _e({ measurements: e, measurementScale: t, presetSelection: n, fitType: r = "regular", garmentScaleHint: i = null, spec: a = T }) {
242
- let o = ue(n), s = o && n ? de(n, a) : t ?? re, c = o && n && e ? fe(e, n) : null;
241
+ function pe({ measurements: e, measurementScale: t, presetSelection: n, fitType: r = "regular", garmentScaleHint: i = null, spec: a = T }) {
242
+ let o = oe(n), s = o && n ? se(n, a) : t ?? ee, c = o && n && e ? ce(e, n) : null;
243
243
  return {
244
- scale: he(me(ge(s, e && n && c ? pe(e, n, c) : ie), i), r),
244
+ scale: de(ue(fe(s, e && n && c ? le(e, n, c) : te), i), r),
245
245
  morph: c
246
246
  };
247
247
  }
248
248
  //#endregion
249
249
  //#region src/api/EverClient.ts
250
- var ve = "http://localhost:8000/api/v1";
251
- function ye(e) {
250
+ var me = "http://localhost:8000/api/v1";
251
+ function he(e) {
252
252
  return e.replace(/\/+$/, "");
253
253
  }
254
- function be(e) {
254
+ function ge(e) {
255
255
  try {
256
256
  return new URL(e).origin;
257
257
  } catch {
258
258
  return "";
259
259
  }
260
260
  }
261
- var xe = class {
261
+ var _e = class {
262
262
  baseUrl;
263
263
  apiOrigin;
264
264
  apiKey;
265
265
  constructor(e) {
266
- let t = typeof e == "string" ? { baseUrl: e } : e ?? {}, n = ye(t.baseUrl ?? "http://localhost:8000/api/v1");
267
- this.baseUrl = n, this.apiOrigin = be(n), this.apiKey = t.apiKey;
266
+ let t = typeof e == "string" ? { baseUrl: e } : e ?? {}, n = he(t.baseUrl ?? "http://localhost:8000/api/v1");
267
+ this.baseUrl = n, this.apiOrigin = ge(n), this.apiKey = t.apiKey;
268
268
  }
269
269
  resolveAssetUrl(e) {
270
270
  return e ? e.startsWith("http://") || e.startsWith("https://") ? e : e.startsWith("/") ? this.apiOrigin ? `${this.apiOrigin}${e}` : e : this.apiOrigin ? `${this.apiOrigin}/${e}` : `/${e}` : null;
@@ -391,32 +391,32 @@ var xe = class {
391
391
  return `Request failed with status ${e.status}`;
392
392
  }
393
393
  }
394
- }, Se = "M", Ce = "male-m-balanced-balanced", we = "female-m-balanced-balanced", Te = "rigged_avatar";
395
- function Ee(e, t) {
394
+ }, ve = "M", ye = "male-m-balanced-balanced", be = "female-m-balanced-balanced", xe = "rigged_avatar";
395
+ function Se(e, t) {
396
396
  if (!t) return "";
397
397
  if (/^https?:\/\//.test(t)) return t;
398
398
  let n = t.startsWith("/") ? t : `/${t}`;
399
399
  return n.startsWith("/assets/") || n.startsWith("/static/") ? n : e.resolveAssetUrl(n) ?? n;
400
400
  }
401
- function De(e) {
401
+ function Ce(e) {
402
402
  return e === "female" ? "female" : "male";
403
403
  }
404
- function Oe(e, t = {}) {
404
+ function we(e, t = {}) {
405
405
  let n = t.renderMode ?? "rigged_avatar", r = t.legacyPresetId ?? "rigged_avatar", i = `/assets/body-presets/${r}.glb`;
406
406
  return e === r || n !== "preset-native" ? i : `/assets/body-presets/archive/${e}.glb`;
407
407
  }
408
- function ke(e) {
409
- return e === "female" ? we : Ce;
408
+ function Te(e) {
409
+ return e === "female" ? be : ye;
410
410
  }
411
- function Ae(e, t) {
411
+ function Ee(e, t) {
412
412
  return {
413
413
  id: e.id,
414
414
  presetId: e.preset_id,
415
- baseGender: De(e.base_gender),
415
+ baseGender: Ce(e.base_gender),
416
416
  sizeBand: e.size_band,
417
417
  upperBodySilhouette: e.upper_body_silhouette,
418
418
  torsoOrPelvisProfile: e.torso_or_pelvis_profile,
419
- modelUrl: Ee(t, e.model_url),
419
+ modelUrl: Se(t, e.model_url),
420
420
  heightCm: e.height_cm ?? null,
421
421
  chestCm: e.chest_cm ?? null,
422
422
  waistCm: e.waist_cm ?? null,
@@ -428,26 +428,26 @@ function Ae(e, t) {
428
428
  neckToHipCm: e.neck_to_hip_cm ?? null
429
429
  };
430
430
  }
431
- function je(e, t = {}) {
431
+ function De(e, t = {}) {
432
432
  return {
433
433
  ...e,
434
- modelUrl: e.modelUrl || Oe(e.presetId, t)
434
+ modelUrl: e.modelUrl || we(e.presetId, t)
435
435
  };
436
436
  }
437
- function Me(e, t = {}) {
438
- return e.length === 0 ? null : je(e.find((e) => e.sizeBand === Se) || e[Math.floor(e.length / 2)], t);
437
+ function Oe(e, t = {}) {
438
+ return e.length === 0 ? null : De(e.find((e) => e.sizeBand === ve) || e[Math.floor(e.length / 2)], t);
439
439
  }
440
- function Ne(e, t = {}) {
441
- let n = ke(e);
440
+ function ke(e, t = {}) {
441
+ let n = Te(e);
442
442
  return {
443
443
  id: null,
444
444
  presetId: n,
445
- label: `${e === "female" ? "여성" : "남성"} 기본 ${Se}`,
446
- modelUrl: Oe(n, t),
445
+ label: `${e === "female" ? "여성" : "남성"} 기본 ${ve}`,
446
+ modelUrl: we(n, t),
447
447
  gender: e,
448
448
  source: "fallback",
449
449
  taxonomy: {
450
- sizeBand: Se,
450
+ sizeBand: ve,
451
451
  upperBodySilhouette: "balanced",
452
452
  torsoOrPelvisProfile: "balanced"
453
453
  },
@@ -464,8 +464,8 @@ function Ne(e, t = {}) {
464
464
  }
465
465
  };
466
466
  }
467
- function Pe(e, t, n = {}) {
468
- let r = je(e, n);
467
+ function Ae(e, t, n = {}) {
468
+ let r = De(e, n);
469
469
  return {
470
470
  id: r.id,
471
471
  presetId: r.presetId,
@@ -491,65 +491,69 @@ function Pe(e, t, n = {}) {
491
491
  }
492
492
  };
493
493
  }
494
- function Fe(e, t) {
494
+ function je(e, t) {
495
495
  let n = { gender: t };
496
496
  return Number.isFinite(e.heightCm) && (n.height_cm = e.heightCm), e.chestCircumferenceCm !== null && (n.chest_cm = e.chestCircumferenceCm), e.waistCircumferenceCm !== null && (n.waist_cm = e.waistCircumferenceCm), e.shoulderWidthCm !== null && (n.shoulder_width_cm = e.shoulderWidthCm), n;
497
497
  }
498
498
  //#endregion
499
499
  //#region src/hooks/useBodyPresetSelection.ts
500
- var Ie = new xe();
501
- function Le(e, t) {
500
+ var Me = new _e();
501
+ function Ne(e, t) {
502
502
  return {
503
- selection: Ne(e, t),
503
+ selection: ke(e, t),
504
504
  loading: !0,
505
505
  error: null
506
506
  };
507
507
  }
508
- function Re(e, t = {}) {
509
- let r = De(t.gender), i = t.renderMode, o = t.legacyPresetId, s = {
510
- gender: r,
511
- renderMode: i,
512
- legacyPresetId: o
513
- }, [c, l] = a(() => Le(r, s));
508
+ function Pe(e, t = {}) {
509
+ let i = Ce(t.gender), o = t.renderMode, s = t.legacyPresetId, c = r(() => ({
510
+ gender: i,
511
+ renderMode: o,
512
+ legacyPresetId: s
513
+ }), [
514
+ i,
515
+ s,
516
+ o
517
+ ]), [l, u] = a(() => Ne(i, c));
514
518
  return n(() => {
515
519
  let t = new AbortController();
516
520
  async function n() {
517
- l((e) => ({
521
+ u((e) => ({
518
522
  ...e,
519
523
  loading: !0,
520
524
  error: null
521
525
  }));
522
526
  try {
523
527
  if (e) {
524
- let n = Pe(Ae(await Ie.matchBodyPreset(Fe(e, r)), Ie), "match", s);
528
+ let n = Ae(Ee(await Me.matchBodyPreset(je(e, c.gender)), Me), "match", c);
525
529
  if (t.signal.aborted) return;
526
- l({
530
+ u({
527
531
  selection: n,
528
532
  loading: !1,
529
533
  error: null
530
534
  });
531
535
  return;
532
536
  }
533
- let n = (await Ie.listBodyPresets(r)).map((e) => Ae(e, Ie));
537
+ let n = (await Me.listBodyPresets(c.gender)).map((e) => Ee(e, Me));
534
538
  if (t.signal.aborted) return;
535
- let i = Me(n, s);
536
- if (i) {
537
- l({
538
- selection: Pe(i, "default", s),
539
+ let r = Oe(n, c);
540
+ if (r) {
541
+ u({
542
+ selection: Ae(r, "default", c),
539
543
  loading: !1,
540
544
  error: null
541
545
  });
542
546
  return;
543
547
  }
544
- l({
545
- selection: Ne(r, s),
548
+ u({
549
+ selection: ke(c.gender, c),
546
550
  loading: !1,
547
551
  error: "바디 프리셋 응답이 비어 있어 기본 프리셋으로 대체했습니다."
548
552
  });
549
553
  } catch (e) {
550
554
  if (t.signal.aborted) return;
551
- l({
552
- selection: Ne(r, s),
555
+ u({
556
+ selection: ke(c.gender, c),
553
557
  loading: !1,
554
558
  error: e instanceof Error ? e.message : "바디 프리셋을 불러오지 못해 기본 프리셋으로 대체했습니다."
555
559
  });
@@ -558,16 +562,11 @@ function Re(e, t = {}) {
558
562
  return n(), () => {
559
563
  t.abort();
560
564
  };
561
- }, [
562
- r,
563
- o,
564
- e,
565
- i
566
- ]), c;
565
+ }, [e, c]), l;
567
566
  }
568
567
  //#endregion
569
568
  //#region src/types/pose.ts
570
- var z = {
569
+ var U = {
571
570
  NOSE: 0,
572
571
  LEFT_EYE_INNER: 1,
573
572
  LEFT_EYE: 2,
@@ -601,25 +600,25 @@ var z = {
601
600
  RIGHT_HEEL: 30,
602
601
  LEFT_FOOT_INDEX: 31,
603
602
  RIGHT_FOOT_INDEX: 32
604
- }, ze = {
603
+ }, Fe = {
605
604
  positionAlpha: .7,
606
605
  rotationAlpha: .6,
607
606
  visibilityThreshold: .5
608
- }, Be = .5;
609
- function B(e) {
610
- return e ? (e.visibility ?? 1) >= Be : !1;
607
+ }, Ie = .5;
608
+ function Le(e) {
609
+ return e ? (e.visibility ?? 1) >= Ie : !1;
611
610
  }
612
- function Ve(e, t) {
613
- let n = e[z.NOSE], r = e[z.LEFT_EYE], i = e[z.LEFT_ANKLE], a = e[z.RIGHT_ANKLE];
614
- if (!B(n) || !B(r) || !B(i) || !B(a)) return 0;
611
+ function Re(e, t) {
612
+ let n = e[U.NOSE], r = e[U.LEFT_EYE], i = e[U.LEFT_ANKLE], a = e[U.RIGHT_ANKLE];
613
+ if (!Le(n) || !Le(r) || !Le(i) || !Le(a)) return 0;
615
614
  let o = n.y - (r.y - n.y) * 2, s = (Math.max(i.y, a.y) - o) * t;
616
615
  return Number.isFinite(s) && s > 0 ? s : 0;
617
616
  }
618
- function He(e, t, n = 720) {
619
- let r = Ve(e, n);
617
+ function ze(e, t, n = 720) {
618
+ let r = Re(e, n);
620
619
  return r <= 0 || t <= 0 ? 0 : t / r;
621
620
  }
622
- function Ue(e) {
621
+ function Be(e) {
623
622
  let t = [
624
623
  [15, .8],
625
624
  [18.5, .84],
@@ -636,39 +635,39 @@ function Ue(e) {
636
635
  }
637
636
  return .88;
638
637
  }
639
- function V(e, t, n, r) {
640
- if (!B(e) || !B(t)) return null;
638
+ function W(e, t, n, r) {
639
+ if (!Le(e) || !Le(t)) return null;
641
640
  let i = (e.x - t.x) * n, a = (e.y - t.y) * r, o = Math.hypot(i, a);
642
641
  return Number.isFinite(o) && o > 0 ? o : null;
643
642
  }
644
- function We(e) {
643
+ function Ve(e) {
645
644
  return Math.round(e * 10) / 10;
646
645
  }
647
- function H(e) {
648
- return e === null || !Number.isFinite(e) || e <= 0 ? null : We(e);
646
+ function G(e) {
647
+ return e === null || !Number.isFinite(e) || e <= 0 ? null : Ve(e);
649
648
  }
650
- function Ge(e) {
649
+ function He(e) {
651
650
  let t = e.filter((e) => e !== null);
652
651
  return t.length === 0 ? null : t.reduce((e, t) => e + t, 0) / t.length;
653
652
  }
654
- function Ke(e, t) {
653
+ function Ue(e, t) {
655
654
  return e && t !== null && t > 0 ? "silhouette_bmi" : "keypoint";
656
655
  }
657
- function qe(e, t, n) {
656
+ function We(e, t, n) {
658
657
  return n && t > 0 && e / t >= .85 ? "standard" : "estimate";
659
658
  }
660
- function Je(e, t, n, r) {
659
+ function Ge(e, t, n, r) {
661
660
  if (t <= 0 || e <= 0) return 0;
662
661
  let i = e / t * .8, a = n ? .15 : 0, o = r !== null && r > 0 ? .05 : 0;
663
- return Math.min(.99, We((i + a + o) * 10) / 10);
662
+ return Math.min(.99, Ve((i + a + o) * 10) / 10);
664
663
  }
665
- function Ye(e, t) {
664
+ function Ke(e, t) {
666
665
  if (e <= 0 || t <= 0) return 0;
667
666
  let n = (e - t) ** 2 / (e + t) ** 2;
668
667
  return Math.PI * (e + t) * (1 + 3 * n / (10 + Math.sqrt(4 - 3 * n)));
669
668
  }
670
- function Xe(e, t, n = null, r = null, i = 1280, a = 720) {
671
- let o = He(e, t, a), s = Ke(r, n);
669
+ function qe(e, t, n = null, r = null, i = 1280, a = 720) {
670
+ let o = ze(e, t, a), s = Ue(r, n);
672
671
  if (o <= 0) return {
673
672
  heightCm: t,
674
673
  shoulderWidthCm: null,
@@ -683,14 +682,14 @@ function Xe(e, t, n = null, r = null, i = 1280, a = 720) {
683
682
  measurementMethod: s,
684
683
  measuredAt: null
685
684
  };
686
- let c = V(e[z.LEFT_SHOULDER], e[z.RIGHT_SHOULDER], i, a), l = V(e[z.LEFT_HIP], e[z.RIGHT_HIP], i, a), u = V(e[z.LEFT_SHOULDER], e[z.LEFT_ELBOW], i, a), d = V(e[z.LEFT_ELBOW], e[z.LEFT_WRIST], i, a), f = V(e[z.RIGHT_SHOULDER], e[z.RIGHT_ELBOW], i, a), p = V(e[z.RIGHT_ELBOW], e[z.RIGHT_WRIST], i, a), m = u !== null && d !== null ? u + d : null, h = f !== null && p !== null ? f + p : null, g = V(e[z.LEFT_HIP], e[z.LEFT_KNEE], i, a), _ = V(e[z.LEFT_KNEE], e[z.LEFT_ANKLE], i, a), v = V(e[z.RIGHT_HIP], e[z.RIGHT_KNEE], i, a), y = V(e[z.RIGHT_KNEE], e[z.RIGHT_ANKLE], i, a), b = g !== null && _ !== null ? g + _ : null, x = v !== null && y !== null ? v + y : null, S = Ge([V(e[z.LEFT_SHOULDER], e[z.LEFT_HIP], i, a), V(e[z.RIGHT_SHOULDER], e[z.RIGHT_HIP], i, a)]), C = H(c === null ? null : c * o), w = H(l === null ? null : l * o), T = H(Ge([m === null ? null : m * o, h === null ? null : h * o])), E = H(Ge([b === null ? null : b * o, x === null ? null : x * o])), D = H(S === null ? null : S * o), O = C === null ? null : C * 2.2, k = w === null ? null : w * 2.1;
685
+ let c = W(e[U.LEFT_SHOULDER], e[U.RIGHT_SHOULDER], i, a), l = W(e[U.LEFT_HIP], e[U.RIGHT_HIP], i, a), u = W(e[U.LEFT_SHOULDER], e[U.LEFT_ELBOW], i, a), d = W(e[U.LEFT_ELBOW], e[U.LEFT_WRIST], i, a), f = W(e[U.RIGHT_SHOULDER], e[U.RIGHT_ELBOW], i, a), p = W(e[U.RIGHT_ELBOW], e[U.RIGHT_WRIST], i, a), m = u !== null && d !== null ? u + d : null, h = f !== null && p !== null ? f + p : null, g = W(e[U.LEFT_HIP], e[U.LEFT_KNEE], i, a), _ = W(e[U.LEFT_KNEE], e[U.LEFT_ANKLE], i, a), v = W(e[U.RIGHT_HIP], e[U.RIGHT_KNEE], i, a), y = W(e[U.RIGHT_KNEE], e[U.RIGHT_ANKLE], i, a), b = g !== null && _ !== null ? g + _ : null, x = v !== null && y !== null ? v + y : null, S = He([W(e[U.LEFT_SHOULDER], e[U.LEFT_HIP], i, a), W(e[U.RIGHT_SHOULDER], e[U.RIGHT_HIP], i, a)]), C = G(c === null ? null : c * o), w = G(l === null ? null : l * o), T = G(He([m === null ? null : m * o, h === null ? null : h * o])), E = G(He([b === null ? null : b * o, x === null ? null : x * o])), D = G(S === null ? null : S * o), O = C === null ? null : C * 2.2, k = w === null ? null : w * 2.1;
687
686
  if (r) {
688
687
  let e = r.shoulderWidthPx * o;
689
- if (O = H(Ye(Math.max(r.chestWidthPx * o / 2, 0), Math.max(e * .28 / 2, 0))), k = H(Ye(Math.max(r.waistWidthPx * o / 2, 0), Math.max(r.hipWidthPx * o * .26 / 2, 0))), n !== null && n > 0) {
690
- let e = Ue(n / (t / 100) ** 2);
691
- O = H(O === null ? null : O / e), k = H(k === null ? null : k / e);
688
+ if (O = G(Ke(Math.max(r.chestWidthPx * o / 2, 0), Math.max(e * .28 / 2, 0))), k = G(Ke(Math.max(r.waistWidthPx * o / 2, 0), Math.max(r.hipWidthPx * o * .26 / 2, 0))), n !== null && n > 0) {
689
+ let e = Be(n / (t / 100) ** 2);
690
+ O = G(O === null ? null : O / e), k = G(k === null ? null : k / e);
692
691
  }
693
- } else O = H(O), k = H(k);
692
+ } else O = G(O), k = G(k);
694
693
  let A = [
695
694
  C,
696
695
  O,
@@ -701,7 +700,7 @@ function Xe(e, t, n = null, r = null, i = 1280, a = 720) {
701
700
  D
702
701
  ].filter((e) => e !== null).length;
703
702
  return {
704
- heightCm: We(t),
703
+ heightCm: Ve(t),
705
704
  shoulderWidthCm: C,
706
705
  chestCircumferenceCm: O,
707
706
  waistCircumferenceCm: k,
@@ -709,15 +708,15 @@ function Xe(e, t, n = null, r = null, i = 1280, a = 720) {
709
708
  armLengthCm: T,
710
709
  legLengthCm: E,
711
710
  torsoLengthCm: D,
712
- accuracyGrade: qe(A, 7, r),
713
- confidenceScore: Je(A, 7, r, n),
711
+ accuracyGrade: We(A, 7, r),
712
+ confidenceScore: Ge(A, 7, r, n),
714
713
  measurementMethod: s,
715
714
  measuredAt: null
716
715
  };
717
716
  }
718
717
  //#endregion
719
718
  //#region src/measurement/sizeRecommender.ts
720
- var Ze = {
719
+ var Je = {
721
720
  S: {
722
721
  shoulder: [40, 42],
723
722
  chest: [86, 92],
@@ -744,7 +743,7 @@ var Ze = {
744
743
  waist: [96, 104]
745
744
  }
746
745
  };
747
- function Qe(e) {
746
+ function Ye(e) {
748
747
  let t = [
749
748
  "S",
750
749
  "M",
@@ -753,7 +752,7 @@ function Qe(e) {
753
752
  "2XL"
754
753
  ], n = "M", r = -Infinity, i = !1;
755
754
  for (let a of t) {
756
- let t = Ze[a], o = 0, s = 0;
755
+ let t = Je[a], o = 0, s = 0;
757
756
  if (e.shoulderWidthCm !== null) {
758
757
  let n = (t.shoulder[0] + t.shoulder[1]) / 2;
759
758
  o -= Math.abs(e.shoulderWidthCm - n), s += 1, i = !0;
@@ -769,7 +768,7 @@ function Qe(e) {
769
768
  s > 0 && (o /= s), o > r && (r = o, n = a);
770
769
  }
771
770
  if (!i) return null;
772
- let a = Ze[n], o = "true-to-size";
771
+ let a = Je[n], o = "true-to-size";
773
772
  if (e.chestCircumferenceCm !== null) {
774
773
  let t = (a.chest[0] + a.chest[1]) / 2;
775
774
  e.chestCircumferenceCm > t + 3 ? o = "slim" : e.chestCircumferenceCm < t - 3 && (o = "relaxed");
@@ -782,7 +781,7 @@ function Qe(e) {
782
781
  }
783
782
  //#endregion
784
783
  //#region src/types/measurement.ts
785
- var $e = {
784
+ var Xe = {
786
785
  referenceHeightCm: 170,
787
786
  weightKg: null,
788
787
  stableFrameCount: 15,
@@ -790,10 +789,10 @@ var $e = {
790
789
  };
791
790
  //#endregion
792
791
  //#region src/hooks/useMeasurement.ts
793
- function et(e) {
792
+ function Ze(e) {
794
793
  return e.map((e) => ({ ...e }));
795
794
  }
796
- function tt(e, t) {
795
+ function Qe(e, t) {
797
796
  let n = 0;
798
797
  for (let r = 0; r < 33; r += 1) {
799
798
  let i = e[r], a = t[r];
@@ -801,8 +800,8 @@ function tt(e, t) {
801
800
  }
802
801
  return n / 33;
803
802
  }
804
- function nt() {
805
- let [e, n] = a($e), [r, o] = a(null), [s, c] = a(null), [l, u] = a(null), [d, f] = a(!1), p = i(0), m = i(null), h = t(() => {
803
+ function $e() {
804
+ let [e, n] = a(Xe), [r, o] = a(null), [s, c] = a(null), [l, u] = a(null), [d, f] = a(!1), p = i(0), m = i(null), h = t(() => {
806
805
  p.current = 0, m.current = null;
807
806
  }, []), g = t(() => {
808
807
  o(null), c(null), u(null);
@@ -812,13 +811,13 @@ function nt() {
812
811
  return {
813
812
  measure: t((t, n = {}) => {
814
813
  if (!d || t.length < 33) return;
815
- let r = et(t);
814
+ let r = Ze(t);
816
815
  if (!m.current) {
817
816
  m.current = r, p.current = 1;
818
817
  return;
819
818
  }
820
- if (p.current = tt(m.current, r) < e.motionThreshold ? p.current + 1 : 1, m.current = r, p.current < e.stableFrameCount) return;
821
- let i = Xe(t, e.referenceHeightCm, e.weightKg, n.silhouetteWidths ?? null, n.imageWidth ?? 1280, n.imageHeight ?? 720), a = (/* @__PURE__ */ new Date()).toISOString(), s = Qe(i), l = O(i);
819
+ if (p.current = Qe(m.current, r) < e.motionThreshold ? p.current + 1 : 1, m.current = r, p.current < e.stableFrameCount) return;
820
+ let i = qe(t, e.referenceHeightCm, e.weightKg, n.silhouetteWidths ?? null, n.imageWidth ?? 1280, n.imageHeight ?? 720), a = (/* @__PURE__ */ new Date()).toISOString(), s = Ye(i), l = O(i);
822
821
  o({
823
822
  ...i,
824
823
  measuredAt: a
@@ -844,7 +843,7 @@ function nt() {
844
843
  }
845
844
  //#endregion
846
845
  //#region src/compositing/videoCover.ts
847
- function rt(e, t, n, r) {
846
+ function et(e, t, n, r) {
848
847
  if (e <= 0 || t <= 0 || n <= 0 || r <= 0) return {
849
848
  x: 0,
850
849
  y: 0,
@@ -869,7 +868,7 @@ function rt(e, t, n, r) {
869
868
  height: o
870
869
  };
871
870
  }
872
- function it(e, t, n, r) {
871
+ function tt(e, t, n, r) {
873
872
  if (e <= 0 || t <= 0 || n <= 0 || r <= 0) return {
874
873
  xMin: 0,
875
874
  xMax: 1,
@@ -896,8 +895,8 @@ function it(e, t, n, r) {
896
895
  }
897
896
  //#endregion
898
897
  //#region src/measurement/silhouetteExtractor.ts
899
- var at = 5, ot = .5;
900
- function st(e, t, n, r, i = at, a = ot) {
898
+ var nt = 5, rt = .5;
899
+ function it(e, t, n, r, i = nt, a = rt) {
901
900
  if (t <= 0 || n <= 0 || e.length !== t * n) return null;
902
901
  let o = Math.round(r), s = Math.floor(i / 2), c = Math.max(0, o - s), l = Math.min(n - 1, o + s), u = 0, d = 0, f = 0;
903
902
  for (let n = c; n <= l; n += 1) {
@@ -909,11 +908,11 @@ function st(e, t, n, r, i = at, a = ot) {
909
908
  let p = u / f;
910
909
  return d / f - p;
911
910
  }
912
- function ct(e, t, n, r) {
911
+ function at(e, t, n, r) {
913
912
  if (r.length < 33) return null;
914
- let i = r[z.LEFT_SHOULDER], a = r[z.RIGHT_SHOULDER], o = r[z.LEFT_HIP], s = r[z.RIGHT_HIP], c = r[z.LEFT_KNEE], l = r[z.RIGHT_KNEE];
913
+ let i = r[U.LEFT_SHOULDER], a = r[U.RIGHT_SHOULDER], o = r[U.LEFT_HIP], s = r[U.RIGHT_HIP], c = r[U.LEFT_KNEE], l = r[U.RIGHT_KNEE];
915
914
  if (!i || !a || !o || !s) return null;
916
- let u = (i.y + a.y) / 2 * n, d = (o.y + s.y) / 2 * n, f = u + (d - u) * .4, p = c && l ? d + ((c.y + l.y) / 2 * n - d) * .2 : d, m = st(e, t, n, u), h = st(e, t, n, f), g = st(e, t, n, d), _ = st(e, t, n, p);
915
+ let u = (i.y + a.y) / 2 * n, d = (o.y + s.y) / 2 * n, f = u + (d - u) * .4, p = c && l ? d + ((c.y + l.y) / 2 * n - d) * .2 : d, m = it(e, t, n, u), h = it(e, t, n, f), g = it(e, t, n, d), _ = it(e, t, n, p);
917
916
  return m === null || h === null || g === null || _ === null ? null : {
918
917
  shoulderWidthPx: m,
919
918
  chestWidthPx: h,
@@ -923,61 +922,61 @@ function ct(e, t, n, r) {
923
922
  }
924
923
  //#endregion
925
924
  //#region src/pose/interpolation.ts
926
- function U(e, t, n) {
925
+ function K(e, t, n) {
927
926
  return e + (t - e) * n;
928
927
  }
929
- function lt(e, t, n) {
928
+ function ot(e, t, n) {
930
929
  return t ? !e || e.length !== t.length ? t : e.map((e, r) => {
931
930
  let i = t[r];
932
931
  return {
933
- x: U(e.x, i.x, n),
934
- y: U(e.y, i.y, n),
935
- z: U(e.z ?? 0, i.z ?? 0, n),
936
- visibility: U(e.visibility ?? 0, i.visibility ?? 0, n)
932
+ x: K(e.x, i.x, n),
933
+ y: K(e.y, i.y, n),
934
+ z: K(e.z ?? 0, i.z ?? 0, n),
935
+ visibility: K(e.visibility ?? 0, i.visibility ?? 0, n)
937
936
  };
938
937
  }) : null;
939
938
  }
940
- function W(e, t, n) {
939
+ function q(e, t, n) {
941
940
  return {
942
- x: U(e.x, t.x, n),
943
- y: U(e.y, t.y, n),
944
- z: U(e.z, t.z, n)
941
+ x: K(e.x, t.x, n),
942
+ y: K(e.y, t.y, n),
943
+ z: K(e.z, t.z, n)
945
944
  };
946
945
  }
947
- function ut(e, t, n) {
948
- return !e || !t ? t ?? e : W(e, t, n);
946
+ function st(e, t, n) {
947
+ return !e || !t ? t ?? e : q(e, t, n);
949
948
  }
950
- function dt(e, t, n) {
949
+ function ct(e, t, n) {
951
950
  return t ? e ? {
952
951
  hips: {
953
952
  position: {
954
- x: U(e.hips.position.x, t.hips.position.x, n),
955
- y: U(e.hips.position.y, t.hips.position.y, n),
956
- z: U(e.hips.position.z, t.hips.position.z, n)
953
+ x: K(e.hips.position.x, t.hips.position.x, n),
954
+ y: K(e.hips.position.y, t.hips.position.y, n),
955
+ z: K(e.hips.position.z, t.hips.position.z, n)
957
956
  },
958
- rotation: W(e.hips.rotation, t.hips.rotation, n)
957
+ rotation: q(e.hips.rotation, t.hips.rotation, n)
959
958
  },
960
- spine: W(e.spine, t.spine, n),
961
- chest: W(e.chest, t.chest, n),
962
- leftUpperArm: W(e.leftUpperArm, t.leftUpperArm, n),
963
- leftLowerArm: W(e.leftLowerArm, t.leftLowerArm, n),
964
- rightUpperArm: W(e.rightUpperArm, t.rightUpperArm, n),
965
- rightLowerArm: W(e.rightLowerArm, t.rightLowerArm, n),
966
- leftUpperLeg: ut(e.leftUpperLeg, t.leftUpperLeg, n),
967
- leftLowerLeg: ut(e.leftLowerLeg, t.leftLowerLeg, n),
968
- rightUpperLeg: ut(e.rightUpperLeg, t.rightUpperLeg, n),
969
- rightLowerLeg: ut(e.rightLowerLeg, t.rightLowerLeg, n)
959
+ spine: q(e.spine, t.spine, n),
960
+ chest: q(e.chest, t.chest, n),
961
+ leftUpperArm: q(e.leftUpperArm, t.leftUpperArm, n),
962
+ leftLowerArm: q(e.leftLowerArm, t.leftLowerArm, n),
963
+ rightUpperArm: q(e.rightUpperArm, t.rightUpperArm, n),
964
+ rightLowerArm: q(e.rightLowerArm, t.rightLowerArm, n),
965
+ leftUpperLeg: st(e.leftUpperLeg, t.leftUpperLeg, n),
966
+ leftLowerLeg: st(e.leftLowerLeg, t.leftLowerLeg, n),
967
+ rightUpperLeg: st(e.rightUpperLeg, t.rightUpperLeg, n),
968
+ rightLowerLeg: st(e.rightLowerLeg, t.rightLowerLeg, n)
970
969
  } : t : null;
971
970
  }
972
- function ft(e, t, n) {
971
+ function lt(e, t, n) {
973
972
  return t ? e ? {
974
- shoulderWidthPx: U(e.shoulderWidthPx, t.shoulderWidthPx, n),
975
- chestWidthPx: U(e.chestWidthPx, t.chestWidthPx, n),
976
- waistWidthPx: U(e.waistWidthPx, t.waistWidthPx, n),
977
- hipWidthPx: U(e.hipWidthPx, t.hipWidthPx, n)
973
+ shoulderWidthPx: K(e.shoulderWidthPx, t.shoulderWidthPx, n),
974
+ chestWidthPx: K(e.chestWidthPx, t.chestWidthPx, n),
975
+ waistWidthPx: K(e.waistWidthPx, t.waistWidthPx, n),
976
+ hipWidthPx: K(e.hipWidthPx, t.hipWidthPx, n)
978
977
  } : t : null;
979
978
  }
980
- function pt() {
979
+ function ut() {
981
980
  return {
982
981
  landmarks: null,
983
982
  worldLandmarks: null,
@@ -987,25 +986,25 @@ function pt() {
987
986
  silhouetteWidths: null
988
987
  };
989
988
  }
990
- function mt(e, t, n) {
989
+ function dt(e, t, n) {
991
990
  return !e || !e.isTracking || !t.isTracking || !t.landmarks ? t : {
992
- landmarks: lt(e.landmarks, t.landmarks, n),
993
- worldLandmarks: lt(e.worldLandmarks, t.worldLandmarks, n),
994
- poseRig: dt(e.poseRig, t.poseRig, n),
995
- confidence: U(e.confidence, t.confidence, n),
991
+ landmarks: ot(e.landmarks, t.landmarks, n),
992
+ worldLandmarks: ot(e.worldLandmarks, t.worldLandmarks, n),
993
+ poseRig: ct(e.poseRig, t.poseRig, n),
994
+ confidence: K(e.confidence, t.confidence, n),
996
995
  isTracking: t.isTracking,
997
- silhouetteWidths: ft(e.silhouetteWidths, t.silhouetteWidths, n)
996
+ silhouetteWidths: lt(e.silhouetteWidths, t.silhouetteWidths, n)
998
997
  };
999
998
  }
1000
999
  //#endregion
1001
1000
  //#region src/pose/landmarkerFactory.ts
1002
- var ht = "0.10.32", gt = `https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@${ht}/wasm`, _t = 2, vt = 3, yt = .5, bt = {
1001
+ var ft = "0.10.32", pt = `https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@${ft}/wasm`, mt = 2, ht = 3, gt = .5, _t = {
1003
1002
  lite: "https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/latest/pose_landmarker_lite.task",
1004
1003
  full: "https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_full/float16/latest/pose_landmarker_full.task",
1005
1004
  heavy: "https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_heavy/float16/latest/pose_landmarker_heavy.task"
1006
1005
  };
1007
- async function xt(e, t, n, r, i = 3) {
1008
- let a = await v.forVisionTasks(gt), o = {
1006
+ async function vt(e, t, n, r, i = 3) {
1007
+ let a = await v.forVisionTasks(pt), o = {
1009
1008
  baseOptions: { modelAssetPath: e },
1010
1009
  runningMode: "VIDEO",
1011
1010
  numPoses: i,
@@ -1034,193 +1033,193 @@ async function xt(e, t, n, r, i = 3) {
1034
1033
  }
1035
1034
  //#endregion
1036
1035
  //#region src/pose/landmarkPoseSolver.ts
1037
- var St = new b.Vector3(), Ct = new b.Vector3(), wt = new b.Vector3(), Tt = new b.Quaternion(), Et = new b.Vector3(), Dt = new b.Vector3(), Ot = new b.Vector3(0, -1, 0), kt = new b.Vector3(1, 0, 0), At = new b.Vector3(-1, 0, 0), jt = new b.Vector3(0, 1, 0), Mt = [z.LEFT_SHOULDER, z.RIGHT_SHOULDER], Nt = [z.LEFT_HIP, z.RIGHT_HIP], Pt = [z.LEFT_EAR, z.RIGHT_EAR], Ft = [z.LEFT_INDEX, z.LEFT_PINKY], It = [z.RIGHT_INDEX, z.RIGHT_PINKY], Lt = {
1036
+ var yt = new b.Vector3(), bt = new b.Vector3(), xt = new b.Vector3(), St = new b.Quaternion(), Ct = new b.Vector3(), wt = new b.Vector3(), Tt = new b.Vector3(0, -1, 0), Et = new b.Vector3(1, 0, 0), Dt = new b.Vector3(-1, 0, 0), Ot = new b.Vector3(0, 1, 0), kt = [U.LEFT_SHOULDER, U.RIGHT_SHOULDER], At = [U.LEFT_HIP, U.RIGHT_HIP], jt = [U.LEFT_EAR, U.RIGHT_EAR], Mt = [U.LEFT_INDEX, U.LEFT_PINKY], Nt = [U.RIGHT_INDEX, U.RIGHT_PINKY], Pt = {
1038
1037
  Hips: {
1039
- from: Nt,
1040
- to: Mt,
1041
- restDir: jt,
1038
+ from: At,
1039
+ to: kt,
1040
+ restDir: Ot,
1042
1041
  influence: .35
1043
1042
  },
1044
1043
  Spine: {
1045
- from: Nt,
1046
- to: Mt,
1047
- restDir: jt,
1044
+ from: At,
1045
+ to: kt,
1046
+ restDir: Ot,
1048
1047
  influence: .55
1049
1048
  },
1050
1049
  Chest: {
1051
- from: Mt,
1052
- to: Pt,
1053
- restDir: jt,
1050
+ from: kt,
1051
+ to: jt,
1052
+ restDir: Ot,
1054
1053
  influence: .7
1055
1054
  },
1056
1055
  LeftShoulder: {
1057
- from: Mt,
1058
- to: z.LEFT_SHOULDER,
1059
- restDir: kt,
1056
+ from: kt,
1057
+ to: U.LEFT_SHOULDER,
1058
+ restDir: Et,
1060
1059
  influence: .45
1061
1060
  },
1062
1061
  LeftUpperArm: {
1063
- from: z.LEFT_SHOULDER,
1064
- to: z.LEFT_ELBOW,
1065
- restDir: kt
1062
+ from: U.LEFT_SHOULDER,
1063
+ to: U.LEFT_ELBOW,
1064
+ restDir: Et
1066
1065
  },
1067
1066
  LeftLowerArm: {
1068
- from: z.LEFT_ELBOW,
1069
- to: z.LEFT_WRIST,
1070
- restDir: kt
1067
+ from: U.LEFT_ELBOW,
1068
+ to: U.LEFT_WRIST,
1069
+ restDir: Et
1071
1070
  },
1072
1071
  LeftHand: {
1073
- from: z.LEFT_WRIST,
1074
- to: Ft,
1075
- restDir: kt,
1072
+ from: U.LEFT_WRIST,
1073
+ to: Mt,
1074
+ restDir: Et,
1076
1075
  influence: .65
1077
1076
  },
1078
1077
  RightShoulder: {
1079
- from: Mt,
1080
- to: z.RIGHT_SHOULDER,
1081
- restDir: At,
1078
+ from: kt,
1079
+ to: U.RIGHT_SHOULDER,
1080
+ restDir: Dt,
1082
1081
  influence: .45
1083
1082
  },
1084
1083
  RightUpperArm: {
1085
- from: z.RIGHT_SHOULDER,
1086
- to: z.RIGHT_ELBOW,
1087
- restDir: At
1084
+ from: U.RIGHT_SHOULDER,
1085
+ to: U.RIGHT_ELBOW,
1086
+ restDir: Dt
1088
1087
  },
1089
1088
  RightLowerArm: {
1090
- from: z.RIGHT_ELBOW,
1091
- to: z.RIGHT_WRIST,
1092
- restDir: At
1089
+ from: U.RIGHT_ELBOW,
1090
+ to: U.RIGHT_WRIST,
1091
+ restDir: Dt
1093
1092
  },
1094
1093
  RightHand: {
1095
- from: z.RIGHT_WRIST,
1096
- to: It,
1097
- restDir: At,
1094
+ from: U.RIGHT_WRIST,
1095
+ to: Nt,
1096
+ restDir: Dt,
1098
1097
  influence: .65
1099
1098
  },
1100
1099
  LeftUpperLeg: {
1101
- from: z.LEFT_HIP,
1102
- to: z.LEFT_KNEE,
1103
- restDir: Ot
1100
+ from: U.LEFT_HIP,
1101
+ to: U.LEFT_KNEE,
1102
+ restDir: Tt
1104
1103
  },
1105
1104
  LeftLowerLeg: {
1106
- from: z.LEFT_KNEE,
1107
- to: z.LEFT_ANKLE,
1108
- restDir: Ot
1105
+ from: U.LEFT_KNEE,
1106
+ to: U.LEFT_ANKLE,
1107
+ restDir: Tt
1109
1108
  },
1110
1109
  LeftFoot: {
1111
- from: z.LEFT_ANKLE,
1112
- to: z.LEFT_FOOT_INDEX,
1110
+ from: U.LEFT_ANKLE,
1111
+ to: U.LEFT_FOOT_INDEX,
1113
1112
  restDir: new b.Vector3(0, 0, 1)
1114
1113
  },
1115
1114
  RightUpperLeg: {
1116
- from: z.RIGHT_HIP,
1117
- to: z.RIGHT_KNEE,
1118
- restDir: Ot
1115
+ from: U.RIGHT_HIP,
1116
+ to: U.RIGHT_KNEE,
1117
+ restDir: Tt
1119
1118
  },
1120
1119
  RightLowerLeg: {
1121
- from: z.RIGHT_KNEE,
1122
- to: z.RIGHT_ANKLE,
1123
- restDir: Ot
1120
+ from: U.RIGHT_KNEE,
1121
+ to: U.RIGHT_ANKLE,
1122
+ restDir: Tt
1124
1123
  },
1125
1124
  RightFoot: {
1126
- from: z.RIGHT_ANKLE,
1127
- to: z.RIGHT_FOOT_INDEX,
1125
+ from: U.RIGHT_ANKLE,
1126
+ to: U.RIGHT_FOOT_INDEX,
1128
1127
  restDir: new b.Vector3(0, 0, 1)
1129
1128
  }
1130
1129
  };
1131
- function Rt(e, t, n) {
1130
+ function Ft(e, t, n) {
1132
1131
  return n === "world" ? (t.set(-e.x, -e.y, -(e.z ?? 0)), t) : (t.set(-(e.x - .5), -(e.y - .5), -(e.z ?? 0) * .5), t);
1133
1132
  }
1134
- function zt(e, t, n, r) {
1133
+ function It(e, t, n, r) {
1135
1134
  if (typeof e == "number") {
1136
1135
  let i = t[e];
1137
- return !i || (i.visibility ?? 0) < .4 ? !1 : (Rt(i, n, r), !0);
1136
+ return !i || (i.visibility ?? 0) < .4 ? !1 : (Ft(i, n, r), !0);
1138
1137
  }
1139
1138
  let i = t[e[0]], a = t[e[1]];
1140
- return !i || !a || (i.visibility ?? 0) < .4 || (a.visibility ?? 0) < .4 ? !1 : (Rt(i, Et, r), Rt(a, Dt, r), n.copy(Et).add(Dt).multiplyScalar(.5), !0);
1139
+ return !i || !a || (i.visibility ?? 0) < .4 || (a.visibility ?? 0) < .4 ? !1 : (Ft(i, Ct, r), Ft(a, wt, r), n.copy(Ct).add(wt).multiplyScalar(.5), !0);
1141
1140
  }
1142
- function Bt(e, t, n, r, i = "normalized") {
1143
- if (!zt(e, n, St, i) || !zt(t, n, Ct, i)) return !1;
1144
- r.subVectors(Ct, St);
1141
+ function Lt(e, t, n, r, i = "normalized") {
1142
+ if (!It(e, n, yt, i) || !It(t, n, bt, i)) return !1;
1143
+ r.subVectors(bt, yt);
1145
1144
  let a = r.length();
1146
1145
  return a < .001 ? !1 : (r.divideScalar(a), !0);
1147
1146
  }
1148
- function Vt(e, t, n, r = "normalized") {
1149
- let i = Lt[e];
1150
- return i ? Bt(i.from, i.to, t, n, r) : !1;
1147
+ function Rt(e, t, n, r = "normalized") {
1148
+ let i = Pt[e];
1149
+ return i ? Lt(i.from, i.to, t, n, r) : !1;
1151
1150
  }
1152
- function Ht(e) {
1153
- return Lt[e]?.influence;
1151
+ function zt(e) {
1152
+ return Pt[e]?.influence;
1154
1153
  }
1155
- function Ut(e, t, n, r = "normalized") {
1156
- let i = Lt[e];
1157
- return !i || !Vt(e, t, wt, r) ? !1 : (n.setFromUnitVectors(i.restDir, wt), i.influence !== void 0 && n.slerp(Tt.identity(), 1 - i.influence), !0);
1154
+ function Bt(e, t, n, r = "normalized") {
1155
+ let i = Pt[e];
1156
+ return !i || !Rt(e, t, xt, r) ? !1 : (n.setFromUnitVectors(i.restDir, xt), i.influence !== void 0 && n.slerp(St.identity(), 1 - i.influence), !0);
1158
1157
  }
1159
- function Wt(e) {
1160
- return e in Lt;
1158
+ function Vt(e) {
1159
+ return e in Pt;
1161
1160
  }
1162
1161
  //#endregion
1163
1162
  //#region src/pose/poseSolver.ts
1164
- var Gt = new b.Quaternion(), Kt = new b.Euler();
1165
- function qt() {
1163
+ var Ht = new b.Quaternion(), Ut = new b.Euler();
1164
+ function Wt() {
1166
1165
  return {
1167
1166
  x: 0,
1168
1167
  y: 0,
1169
1168
  z: 0
1170
1169
  };
1171
1170
  }
1172
- function Jt(e) {
1173
- return Kt.setFromQuaternion(e, "XYZ"), {
1174
- x: Kt.x,
1175
- y: Kt.y,
1176
- z: Kt.z
1171
+ function Gt(e) {
1172
+ return Ut.setFromQuaternion(e, "XYZ"), {
1173
+ x: Ut.x,
1174
+ y: Ut.y,
1175
+ z: Ut.z
1177
1176
  };
1178
1177
  }
1179
- function G(e, t, n) {
1180
- return Ut(e, t, Gt, n) ? Jt(Gt) : qt();
1178
+ function Kt(e, t, n) {
1179
+ return Bt(e, t, Ht, n) ? Gt(Ht) : Wt();
1181
1180
  }
1182
- function Yt(e, t, n) {
1183
- if (Ut(e, t, Gt, n)) return Jt(Gt);
1181
+ function qt(e, t, n) {
1182
+ if (Bt(e, t, Ht, n)) return Gt(Ht);
1184
1183
  }
1185
- function Xt(e) {
1186
- let t = e[z.LEFT_HIP], n = e[z.RIGHT_HIP];
1184
+ function Jt(e) {
1185
+ let t = e[U.LEFT_HIP], n = e[U.RIGHT_HIP];
1187
1186
  return {
1188
1187
  x: ((t?.x ?? 0) + (n?.x ?? 0)) * .5,
1189
1188
  y: ((t?.y ?? 0) + (n?.y ?? 0)) * .5,
1190
1189
  z: ((t?.z ?? 0) + (n?.z ?? 0)) * .5
1191
1190
  };
1192
1191
  }
1193
- function Zt(e, t) {
1192
+ function Yt(e, t) {
1194
1193
  if (e.length < 33) return null;
1195
1194
  let n = t && t.length >= 33 ? t : e, r = t && t.length >= 33 ? "world" : "normalized";
1196
1195
  return {
1197
1196
  hips: {
1198
- position: Xt(e),
1199
- rotation: G("Hips", n, r)
1197
+ position: Jt(e),
1198
+ rotation: Kt("Hips", n, r)
1200
1199
  },
1201
- spine: G("Spine", n, r),
1202
- chest: G("Chest", n, r),
1203
- leftUpperArm: G("LeftUpperArm", n, r),
1204
- leftLowerArm: G("LeftLowerArm", n, r),
1205
- rightUpperArm: G("RightUpperArm", n, r),
1206
- rightLowerArm: G("RightLowerArm", n, r),
1207
- leftUpperLeg: Yt("LeftUpperLeg", n, r),
1208
- leftLowerLeg: Yt("LeftLowerLeg", n, r),
1209
- rightUpperLeg: Yt("RightUpperLeg", n, r),
1210
- rightLowerLeg: Yt("RightLowerLeg", n, r)
1200
+ spine: Kt("Spine", n, r),
1201
+ chest: Kt("Chest", n, r),
1202
+ leftUpperArm: Kt("LeftUpperArm", n, r),
1203
+ leftLowerArm: Kt("LeftLowerArm", n, r),
1204
+ rightUpperArm: Kt("RightUpperArm", n, r),
1205
+ rightLowerArm: Kt("RightLowerArm", n, r),
1206
+ leftUpperLeg: qt("LeftUpperLeg", n, r),
1207
+ leftLowerLeg: qt("LeftLowerLeg", n, r),
1208
+ rightUpperLeg: qt("RightUpperLeg", n, r),
1209
+ rightLowerLeg: qt("RightLowerLeg", n, r)
1211
1210
  };
1212
1211
  }
1213
1212
  //#endregion
1214
1213
  //#region src/pose/segmentation.ts
1215
- function Qt(e) {
1214
+ function Xt(e) {
1216
1215
  if (!e || typeof e != "object") return null;
1217
1216
  let t = e;
1218
1217
  return typeof t.width != "number" || typeof t.height != "number" || typeof t.getAsFloat32Array != "function" ? null : t;
1219
1218
  }
1220
- function $t(e) {
1219
+ function Zt(e) {
1221
1220
  if (e) for (let t of e) t && typeof t == "object" && "close" in t && typeof t.close == "function" && t.close();
1222
1221
  }
1223
- function en(e, t, n) {
1222
+ function Qt(e, t, n) {
1224
1223
  let r = t / n;
1225
1224
  return {
1226
1225
  shoulderWidthPx: e.shoulderWidthPx * r,
@@ -1231,47 +1230,47 @@ function en(e, t, n) {
1231
1230
  }
1232
1231
  //#endregion
1233
1232
  //#region src/types/tracking.ts
1234
- var tn = "pose-0";
1233
+ var $t = "pose-0";
1235
1234
  //#endregion
1236
1235
  //#region src/pose/smoothing.ts
1237
- function nn(e) {
1236
+ function en(e) {
1238
1237
  return typeof e == "number" ? e : 0;
1239
1238
  }
1240
- function rn(e) {
1239
+ function tn(e) {
1241
1240
  return {
1242
1241
  x: e.x,
1243
1242
  y: e.y,
1244
1243
  z: e.z,
1245
- visibility: nn(e.visibility)
1244
+ visibility: en(e.visibility)
1246
1245
  };
1247
1246
  }
1248
- function an(e) {
1249
- return e.map(rn);
1247
+ function nn(e) {
1248
+ return e.map(tn);
1250
1249
  }
1251
- function on(e) {
1252
- return rn(e);
1250
+ function rn(e) {
1251
+ return tn(e);
1253
1252
  }
1254
- function sn(e) {
1253
+ function an(e) {
1255
1254
  let t = Math.PI * 2, n = (e + Math.PI) % t;
1256
1255
  return n < 0 && (n += t), n - Math.PI;
1257
1256
  }
1258
- function cn(e, t, n) {
1259
- return sn(e + sn(t - e) * n);
1257
+ function on(e, t, n) {
1258
+ return an(e + an(t - e) * n);
1260
1259
  }
1261
- var ln = class {
1260
+ var sn = class {
1262
1261
  prev = null;
1263
1262
  config;
1264
- constructor(e = ze) {
1263
+ constructor(e = Fe) {
1265
1264
  this.config = e;
1266
1265
  }
1267
1266
  smooth(e) {
1268
1267
  if (e.length === 0) return this.prev = null, [];
1269
- let t = an(e);
1270
- if (!this.prev || this.prev.length !== t.length) return this.prev = t.map(on), t.map(on);
1268
+ let t = nn(e);
1269
+ if (!this.prev || this.prev.length !== t.length) return this.prev = t.map(rn), t.map(rn);
1271
1270
  let n = this.config.positionAlpha, r = t.map((e, t) => {
1272
1271
  let r = this.prev[t];
1273
1272
  return (e.visibility ?? 0) < this.config.visibilityThreshold ? {
1274
- ...on(r),
1273
+ ...rn(r),
1275
1274
  visibility: e.visibility
1276
1275
  } : {
1277
1276
  x: r.x + n * (e.x - r.x),
@@ -1280,23 +1279,23 @@ var ln = class {
1280
1279
  visibility: e.visibility
1281
1280
  };
1282
1281
  });
1283
- return this.prev = r.map(on), r;
1282
+ return this.prev = r.map(rn), r;
1284
1283
  }
1285
1284
  reset() {
1286
1285
  this.prev = null;
1287
1286
  }
1288
1287
  };
1289
- function K(e, t, n) {
1288
+ function J(e, t, n) {
1290
1289
  return {
1291
- x: cn(e.x, t.x, n),
1292
- y: cn(e.y, t.y, n),
1293
- z: cn(e.z, t.z, n)
1290
+ x: on(e.x, t.x, n),
1291
+ y: on(e.y, t.y, n),
1292
+ z: on(e.z, t.z, n)
1294
1293
  };
1295
1294
  }
1296
- function un(e, t, n) {
1297
- return t ? e ? K(e, t, n) : t : e;
1295
+ function cn(e, t, n) {
1296
+ return t ? e ? J(e, t, n) : t : e;
1298
1297
  }
1299
- function dn(e, t, n = ze.rotationAlpha) {
1298
+ function ln(e, t, n = Fe.rotationAlpha) {
1300
1299
  return e ? {
1301
1300
  hips: {
1302
1301
  position: {
@@ -1304,29 +1303,29 @@ function dn(e, t, n = ze.rotationAlpha) {
1304
1303
  y: e.hips.position.y + n * (t.hips.position.y - e.hips.position.y),
1305
1304
  z: e.hips.position.z + n * (t.hips.position.z - e.hips.position.z)
1306
1305
  },
1307
- rotation: K(e.hips.rotation, t.hips.rotation, n)
1306
+ rotation: J(e.hips.rotation, t.hips.rotation, n)
1308
1307
  },
1309
- spine: K(e.spine, t.spine, n),
1310
- chest: K(e.chest, t.chest, n),
1311
- leftUpperArm: K(e.leftUpperArm, t.leftUpperArm, n),
1312
- leftLowerArm: K(e.leftLowerArm, t.leftLowerArm, n),
1313
- rightUpperArm: K(e.rightUpperArm, t.rightUpperArm, n),
1314
- rightLowerArm: K(e.rightLowerArm, t.rightLowerArm, n),
1315
- leftUpperLeg: un(e.leftUpperLeg, t.leftUpperLeg, n),
1316
- leftLowerLeg: un(e.leftLowerLeg, t.leftLowerLeg, n),
1317
- rightUpperLeg: un(e.rightUpperLeg, t.rightUpperLeg, n),
1318
- rightLowerLeg: un(e.rightLowerLeg, t.rightLowerLeg, n)
1308
+ spine: J(e.spine, t.spine, n),
1309
+ chest: J(e.chest, t.chest, n),
1310
+ leftUpperArm: J(e.leftUpperArm, t.leftUpperArm, n),
1311
+ leftLowerArm: J(e.leftLowerArm, t.leftLowerArm, n),
1312
+ rightUpperArm: J(e.rightUpperArm, t.rightUpperArm, n),
1313
+ rightLowerArm: J(e.rightLowerArm, t.rightLowerArm, n),
1314
+ leftUpperLeg: cn(e.leftUpperLeg, t.leftUpperLeg, n),
1315
+ leftLowerLeg: cn(e.leftLowerLeg, t.leftLowerLeg, n),
1316
+ rightUpperLeg: cn(e.rightUpperLeg, t.rightUpperLeg, n),
1317
+ rightLowerLeg: cn(e.rightLowerLeg, t.rightLowerLeg, n)
1319
1318
  } : t;
1320
1319
  }
1321
1320
  //#endregion
1322
1321
  //#region src/tracking/personLock.ts
1323
- var fn = .12, pn = .35, mn = .05, hn = [
1322
+ var un = .12, dn = .35, fn = .05, pn = [
1324
1323
  11,
1325
1324
  12,
1326
1325
  23,
1327
1326
  24
1328
- ], gn = 2, _n = .3;
1329
- function vn(e) {
1327
+ ], mn = 2, hn = .3;
1328
+ function gn(e) {
1330
1329
  if (!e) return null;
1331
1330
  let t = Math.max(0, Math.min(1, e.x)), n = Math.max(0, Math.min(1, e.y));
1332
1331
  return {
@@ -1336,41 +1335,41 @@ function vn(e) {
1336
1335
  h: Math.max(.01, Math.min(1 - n, e.h))
1337
1336
  };
1338
1337
  }
1339
- function yn(e) {
1338
+ function _n(e) {
1340
1339
  if (!Array.isArray(e) || e.length === 0) return null;
1341
1340
  let t = Infinity, n = Infinity, r = -Infinity, i = -Infinity, a = 0;
1342
1341
  return e.forEach((e) => {
1343
- !e || typeof e.x != "number" || typeof e.y != "number" || (e.visibility ?? 0) < pn || (t = Math.min(t, e.x), n = Math.min(n, e.y), r = Math.max(r, e.x), i = Math.max(i, e.y), a += 1);
1344
- }), a < 4 || !Number.isFinite(t) || !Number.isFinite(n) || !Number.isFinite(r) || !Number.isFinite(i) ? null : vn({
1342
+ !e || typeof e.x != "number" || typeof e.y != "number" || (e.visibility ?? 0) < dn || (t = Math.min(t, e.x), n = Math.min(n, e.y), r = Math.max(r, e.x), i = Math.max(i, e.y), a += 1);
1343
+ }), a < 4 || !Number.isFinite(t) || !Number.isFinite(n) || !Number.isFinite(r) || !Number.isFinite(i) ? null : gn({
1345
1344
  x: t,
1346
1345
  y: n,
1347
1346
  w: Math.max(.01, r - t),
1348
1347
  h: Math.max(.01, i - n)
1349
1348
  });
1350
1349
  }
1351
- function bn(e, t = fn) {
1350
+ function vn(e, t = un) {
1352
1351
  if (!e) return null;
1353
1352
  let n = e.w * t, r = e.h * t;
1354
- return vn({
1353
+ return gn({
1355
1354
  x: e.x - n / 2,
1356
1355
  y: e.y - r / 2,
1357
1356
  w: e.w + n,
1358
1357
  h: e.h + r
1359
1358
  });
1360
1359
  }
1361
- function xn(e, t) {
1360
+ function yn(e, t) {
1362
1361
  if (!e || !t) return 0;
1363
1362
  let n = Math.max(e.x, t.x), r = Math.max(e.y, t.y), i = Math.min(e.x + e.w, t.x + t.w), a = Math.min(e.y + e.h, t.y + t.h), o = Math.max(0, i - n) * Math.max(0, a - r);
1364
1363
  if (o <= 0) return 0;
1365
1364
  let s = e.w * e.h + t.w * t.h - o;
1366
1365
  return s <= 0 ? 0 : o / s;
1367
1366
  }
1368
- function Sn(e) {
1367
+ function bn(e) {
1369
1368
  return e.length === 0 ? 0 : e.reduce((e, t) => e + (t.visibility ?? 0), 0) / e.length;
1370
1369
  }
1371
- function Cn(e, t = []) {
1370
+ function xn(e, t = []) {
1372
1371
  return e.flatMap((e, n) => {
1373
- let r = yn(e), i = bn(r);
1372
+ let r = _n(e), i = vn(r);
1374
1373
  return !r || !i ? [] : [{
1375
1374
  poseIndex: n,
1376
1375
  personId: `pose-${n}`,
@@ -1378,43 +1377,43 @@ function Cn(e, t = []) {
1378
1377
  worldLandmarks: t[n] ?? null,
1379
1378
  bounds: r,
1380
1379
  expandedBounds: i,
1381
- meanVisibility: Sn(e),
1380
+ meanVisibility: bn(e),
1382
1381
  area: i.w * i.h
1383
1382
  }];
1384
1383
  });
1385
1384
  }
1386
- function wn(e, t) {
1387
- let n = xn(e.expandedBounds, t.expandedBounds);
1385
+ function Sn(e, t) {
1386
+ let n = yn(e.expandedBounds, t.expandedBounds);
1388
1387
  return {
1389
1388
  iou: n,
1390
1389
  score: n * .75 + e.area * .25
1391
1390
  };
1392
1391
  }
1393
- function Tn(e, { previousCandidate: t, allowRelock: n = !1, minIouToKeep: r = mn }) {
1392
+ function Cn(e, { previousCandidate: t, allowRelock: n = !1, minIouToKeep: r = fn }) {
1394
1393
  if (e.length === 0) return null;
1395
1394
  let i = [...e].sort((e, t) => t.area * t.meanVisibility - e.area * e.meanVisibility);
1396
1395
  if (!t) return i[0];
1397
1396
  let a = null, o = -Infinity, s = 0;
1398
1397
  return e.forEach((e) => {
1399
- let { iou: n, score: r } = wn(e, t);
1398
+ let { iou: n, score: r } = Sn(e, t);
1400
1399
  r > o && (a = e, o = r, s = n);
1401
1400
  }), a && s >= r ? a : n ? i[0] : null;
1402
1401
  }
1403
- function En(e, t) {
1402
+ function wn(e, t) {
1404
1403
  if (!t) return !0;
1405
1404
  let n = 0, r = 0, i = 0;
1406
- for (let t of hn) {
1405
+ for (let t of pn) {
1407
1406
  let a = e.landmarks[t];
1408
- a && (a.visibility ?? 0) > _n && (n += a.x, r += a.y, i += 1);
1407
+ a && (a.visibility ?? 0) > hn && (n += a.x, r += a.y, i += 1);
1409
1408
  }
1410
- if (i < gn) return !0;
1409
+ if (i < mn) return !0;
1411
1410
  let a = n / i, o = r / i;
1412
1411
  return a >= t.xMin && a <= t.xMax && o >= t.yMin && o <= t.yMax;
1413
1412
  }
1414
- function Dn(e, t) {
1415
- return t ? e.filter((e) => En(e, t)) : e;
1413
+ function Tn(e, t) {
1414
+ return t ? e.filter((e) => wn(e, t)) : e;
1416
1415
  }
1417
- function On(e) {
1416
+ function En(e) {
1418
1417
  return e ? {
1419
1418
  poseIndex: e.poseIndex,
1420
1419
  personId: e.personId,
@@ -1424,18 +1423,18 @@ function On(e) {
1424
1423
  }
1425
1424
  //#endregion
1426
1425
  //#region src/tracking/trackingState.ts
1427
- var kn = .55, An = 640, jn = 360;
1428
- function Mn(e = null) {
1426
+ var Dn = .55, On = 640, kn = 360;
1427
+ function An(e = null) {
1429
1428
  return {
1430
1429
  level: "idle",
1431
1430
  reasons: ["no_person_detected"],
1432
1431
  updatedAt: e
1433
1432
  };
1434
1433
  }
1435
- function Nn({ detectedPersonCount: e, isTracking: t, lockedPersonId: n = null, meanVisibility: r = null, frameWidth: i = 0, frameHeight: a = 0, updatedAt: o = Date.now() }) {
1436
- if (e < 1) return Mn(o);
1434
+ function jn({ detectedPersonCount: e, isTracking: t, lockedPersonId: n = null, meanVisibility: r = null, frameWidth: i = 0, frameHeight: a = 0, updatedAt: o = Date.now() }) {
1435
+ if (e < 1) return An(o);
1437
1436
  let s = [];
1438
- return e > 1 && s.push("multi_person_detected"), i > 0 && a > 0 && (i < An || a < jn) && s.push("resolution_too_low"), r !== null && r < kn && s.push("low_visibility"), (!n || !t) && s.push("pose_not_locked"), s.length === 0 ? {
1437
+ return e > 1 && s.push("multi_person_detected"), i > 0 && a > 0 && (i < On || a < kn) && s.push("resolution_too_low"), r !== null && r < Dn && s.push("low_visibility"), (!n || !t) && s.push("pose_not_locked"), s.length === 0 ? {
1439
1438
  level: "good",
1440
1439
  reasons: [],
1441
1440
  updatedAt: o
@@ -1445,19 +1444,19 @@ function Nn({ detectedPersonCount: e, isTracking: t, lockedPersonId: n = null, m
1445
1444
  updatedAt: o
1446
1445
  };
1447
1446
  }
1448
- function Pn() {
1447
+ function Mn() {
1449
1448
  return {
1450
1449
  detectedPersonCount: 0,
1451
1450
  lockedPersonId: null,
1452
- trackingQuality: Mn()
1451
+ trackingQuality: An()
1453
1452
  };
1454
1453
  }
1455
- function Fn({ detectedPersonCount: e, isTracking: t, lockedPersonId: n, meanVisibility: r, frameWidth: i, frameHeight: a, updatedAt: o }) {
1454
+ function Nn({ detectedPersonCount: e, isTracking: t, lockedPersonId: n, meanVisibility: r, frameWidth: i, frameHeight: a, updatedAt: o }) {
1456
1455
  let s = n ?? (t && e > 0 ? "pose-0" : null);
1457
1456
  return {
1458
1457
  detectedPersonCount: e,
1459
1458
  lockedPersonId: s,
1460
- trackingQuality: Nn({
1459
+ trackingQuality: jn({
1461
1460
  detectedPersonCount: e,
1462
1461
  isTracking: t,
1463
1462
  lockedPersonId: s,
@@ -1470,17 +1469,17 @@ function Fn({ detectedPersonCount: e, isTracking: t, lockedPersonId: n, meanVisi
1470
1469
  }
1471
1470
  //#endregion
1472
1471
  //#region src/tracking/trackingStability.ts
1473
- var In = 180;
1474
- function Ln(e, t, n = 180) {
1472
+ var Pn = 180;
1473
+ function Fn(e, t, n = 180) {
1475
1474
  return e === null ? !1 : t - e <= n;
1476
1475
  }
1477
- function Rn(e) {
1476
+ function In(e) {
1478
1477
  return !e || !e.isTracking || !e.landmarks || !e.poseRig ? null : {
1479
1478
  ...e,
1480
1479
  isTracking: !0
1481
1480
  };
1482
1481
  }
1483
- function zn(e, t, n = tn) {
1482
+ function Ln(e, t, n = $t) {
1484
1483
  return {
1485
1484
  detectedPersonCount: e,
1486
1485
  lockedPersonId: n,
@@ -1493,7 +1492,7 @@ function zn(e, t, n = tn) {
1493
1492
  }
1494
1493
  //#endregion
1495
1494
  //#region src/hooks/usePoseTracker.ts
1496
- function Bn() {
1495
+ function Rn() {
1497
1496
  return {
1498
1497
  landmarks: null,
1499
1498
  worldLandmarks: null,
@@ -1503,49 +1502,49 @@ function Bn() {
1503
1502
  isTracking: !1
1504
1503
  };
1505
1504
  }
1506
- var Vn = (e, r = {}) => {
1507
- let { enabled: o = !0, modelComplexity: s = "lite", numPoses: c = 3, minDetectionConfidence: l = .5, minTrackingConfidence: u = .5, outputSegmentationMasks: d = !1, viewportWidth: f = 0, viewportHeight: p = 0 } = r, m = i(null), h = i(new ln(ze)), g = i(null), v = i(null), b = i(null), x = i(-1), S = i({
1505
+ var zn = (e, r = {}) => {
1506
+ let { enabled: o = !0, modelComplexity: s = "lite", numPoses: c = 3, minDetectionConfidence: l = .5, minTrackingConfidence: u = .5, outputSegmentationMasks: d = !1, viewportWidth: f = 0, viewportHeight: p = 0 } = r, m = i(null), h = i(new sn(Fe)), g = i(null), v = i(null), b = i(null), x = i(-1), S = i({
1508
1507
  width: 0,
1509
1508
  height: 0
1510
- }), C = i(0), w = i(null), T = i(null), E = i(null), D = i(null), O = i(null), k = i(Pn()), A = i({
1509
+ }), C = i(0), w = i(null), T = i(null), E = i(null), D = i(null), O = i(null), k = i(Mn()), A = i({
1511
1510
  frames: 0,
1512
1511
  lastMeasuredAt: 0
1513
1512
  }), j = i(null), M = i({
1514
1513
  width: 0,
1515
1514
  height: 0
1516
- }), [N, P] = a(!1), [ee, F] = a(Bn), [te, ne] = a(null), [re, ie] = a({
1515
+ }), [N, P] = a(!1), [F, I] = a(Rn), [L, R] = a(null), [ee, te] = a({
1517
1516
  width: 0,
1518
1517
  height: 0
1519
- }), [ae, oe] = a(Pn()), se = t((e, t = k.current) => {
1520
- v.current = e.landmarks, k.current = t, F((t) => ({
1518
+ }), [ne, re] = a(Mn()), z = t((e, t = k.current) => {
1519
+ v.current = e.landmarks, k.current = t, I((t) => ({
1521
1520
  ...t,
1522
1521
  landmarks: e.landmarks,
1523
1522
  worldLandmarks: e.worldLandmarks,
1524
1523
  poseRig: e.poseRig,
1525
1524
  confidence: e.confidence,
1526
1525
  isTracking: e.isTracking
1527
- })), ne(e.silhouetteWidths), oe(t);
1528
- }, []), I = t(() => {
1526
+ })), R(e.silhouetteWidths), re(t);
1527
+ }, []), B = t(() => {
1529
1528
  h.current.reset(), g.current = null, v.current = null, x.current = -1, S.current = {
1530
1529
  width: 0,
1531
1530
  height: 0
1532
- }, C.current = 0, w.current = null, T.current = null, E.current = null, D.current = null, O.current = null, k.current = Pn(), A.current = {
1531
+ }, C.current = 0, w.current = null, T.current = null, E.current = null, D.current = null, O.current = null, k.current = Mn(), A.current = {
1533
1532
  frames: 0,
1534
1533
  lastMeasuredAt: 0
1535
- }, F(Bn()), ne(null), ie({
1534
+ }, I(Rn()), R(null), te({
1536
1535
  width: 0,
1537
1536
  height: 0
1538
- }), oe(Pn());
1537
+ }), re(Mn());
1539
1538
  }, []);
1540
1539
  n(() => {
1541
1540
  if (!o) {
1542
- P(!1), I();
1541
+ P(!1), B();
1543
1542
  return;
1544
1543
  }
1545
1544
  let e = !1;
1546
1545
  async function t() {
1547
1546
  try {
1548
- let t = await xt(bt[s], l, u, d, c);
1547
+ let t = await vt(_t[s], l, u, d, c);
1549
1548
  if (e) {
1550
1549
  t.close();
1551
1550
  return;
@@ -1556,7 +1555,7 @@ var Vn = (e, r = {}) => {
1556
1555
  }
1557
1556
  }
1558
1557
  return t(), () => {
1559
- e = !0, P(!1), b.current !== null && (cancelAnimationFrame(b.current), b.current = null), m.current?.close(), m.current = null, I();
1558
+ e = !0, P(!1), b.current !== null && (cancelAnimationFrame(b.current), b.current = null), m.current?.close(), m.current = null, B();
1560
1559
  };
1561
1560
  }, [
1562
1561
  o,
@@ -1565,7 +1564,7 @@ var Vn = (e, r = {}) => {
1565
1564
  s,
1566
1565
  c,
1567
1566
  d,
1568
- I
1567
+ B
1569
1568
  ]), M.current = {
1570
1569
  width: f,
1571
1570
  height: p
@@ -1586,30 +1585,30 @@ var Vn = (e, r = {}) => {
1586
1585
  (i !== S.current.width || a !== S.current.height) && (S.current = {
1587
1586
  width: i,
1588
1587
  height: a
1589
- }, ie({
1588
+ }, te({
1590
1589
  width: i,
1591
1590
  height: a
1592
1591
  }));
1593
1592
  let o = M.current;
1594
- j.current = o.width > 0 && o.height > 0 ? it(o.width, o.height, i, a) : null;
1593
+ j.current = o.width > 0 && o.height > 0 ? tt(o.width, o.height, i, a) : null;
1595
1594
  let s = performance.now();
1596
1595
  try {
1597
1596
  let e = w.current === null || C.current === 0;
1598
1597
  if (C.current = (C.current + 1) % 2, e) {
1599
1598
  let e = r.detectForVideo(n, s);
1600
1599
  try {
1601
- let t = Dn(Cn(e.landmarks, e.worldLandmarks), j.current), n = t.length, r = !Ln(D.current, s), o = Tn(t, {
1600
+ let t = Tn(xn(e.landmarks, e.worldLandmarks), j.current), n = t.length, r = !Fn(D.current, s), o = Cn(t, {
1602
1601
  previousCandidate: O.current,
1603
1602
  allowRelock: r
1604
- }), c = o?.landmarks ?? null, l = o?.worldLandmarks ?? null, f = o || O.current ? tn : null, p = pt(), m = Fn({
1603
+ }), c = o?.landmarks ?? null, l = o?.worldLandmarks ?? null, f = o || O.current ? $t : null, p = ut(), m = Nn({
1605
1604
  detectedPersonCount: n,
1606
1605
  isTracking: !1,
1607
1606
  lockedPersonId: f,
1608
1607
  frameWidth: i,
1609
1608
  frameHeight: a,
1610
1609
  updatedAt: s
1611
- }), _ = Ln(D.current, s) ? Rn(E.current) : null;
1612
- if (!c) _ ? (p = _, m = zn(n, s, f)) : (h.current.reset(), g.current = null, E.current = null, D.current = null, O.current = null, m = Fn({
1610
+ }), _ = Fn(D.current, s) ? In(E.current) : null;
1611
+ if (!c) _ ? (p = _, m = Ln(n, s, f)) : (h.current.reset(), g.current = null, E.current = null, D.current = null, O.current = null, m = Nn({
1613
1612
  detectedPersonCount: n,
1614
1613
  isTracking: !1,
1615
1614
  lockedPersonId: null,
@@ -1619,12 +1618,12 @@ var Vn = (e, r = {}) => {
1619
1618
  }));
1620
1619
  else {
1621
1620
  r && o && (h.current.reset(), g.current = null);
1622
- let t = h.current.smooth(an(c)), v = l ? an(l) : null, y = Zt(t, v), b = t.reduce((e, t) => e + (t.visibility ?? 0), 0) / t.length, x = b >= u ? y ? dn(g.current, y, ze.rotationAlpha) : g.current : null, S = x !== null, C = null;
1623
- if (O.current = o ? On(o) : O.current, d) {
1624
- let n = Qt(o ? e.segmentationMasks?.[o.poseIndex] : void 0);
1621
+ let t = h.current.smooth(nn(c)), v = l ? nn(l) : null, y = Yt(t, v), b = t.reduce((e, t) => e + (t.visibility ?? 0), 0) / t.length, x = b >= u ? y ? ln(g.current, y, Fe.rotationAlpha) : g.current : null, S = x !== null, C = null;
1622
+ if (O.current = o ? En(o) : O.current, d) {
1623
+ let n = Xt(o ? e.segmentationMasks?.[o.poseIndex] : void 0);
1625
1624
  if (n) {
1626
- let e = ct(new Float32Array(n.getAsFloat32Array()), n.width, n.height, t);
1627
- e && (C = en(e, i, n.width));
1625
+ let e = at(new Float32Array(n.getAsFloat32Array()), n.width, n.height, t);
1626
+ e && (C = Qt(e, i, n.width));
1628
1627
  }
1629
1628
  }
1630
1629
  S && x ? (g.current = x, p = {
@@ -1634,25 +1633,25 @@ var Vn = (e, r = {}) => {
1634
1633
  confidence: b,
1635
1634
  isTracking: S,
1636
1635
  silhouetteWidths: C
1637
- }, E.current = p, D.current = s, m = Fn({
1636
+ }, E.current = p, D.current = s, m = Nn({
1638
1637
  detectedPersonCount: n,
1639
1638
  isTracking: S,
1640
- lockedPersonId: tn,
1639
+ lockedPersonId: $t,
1641
1640
  meanVisibility: o?.meanVisibility ?? b,
1642
1641
  frameWidth: i,
1643
1642
  frameHeight: a,
1644
1643
  updatedAt: s
1645
- })) : _ ? (p = _, m = zn(n, s, f)) : (g.current = null, E.current = null, D.current = null, p = {
1644
+ })) : _ ? (p = _, m = Ln(n, s, f)) : (g.current = null, E.current = null, D.current = null, p = {
1646
1645
  landmarks: t,
1647
1646
  worldLandmarks: v,
1648
1647
  poseRig: null,
1649
1648
  confidence: b,
1650
1649
  isTracking: !1,
1651
1650
  silhouetteWidths: C
1652
- }, m = Fn({
1651
+ }, m = Nn({
1653
1652
  detectedPersonCount: n,
1654
1653
  isTracking: !1,
1655
- lockedPersonId: o ? tn : null,
1654
+ lockedPersonId: o ? $t : null,
1656
1655
  meanVisibility: o?.meanVisibility ?? b,
1657
1656
  frameWidth: i,
1658
1657
  frameHeight: a,
@@ -1661,17 +1660,17 @@ var Vn = (e, r = {}) => {
1661
1660
  }
1662
1661
  let v = w.current;
1663
1662
  w.current = p, k.current = m;
1664
- let y = mt(v, p, yt);
1665
- T.current = y, se(y, m);
1663
+ let y = dt(v, p, gt);
1664
+ T.current = y, z(y, m);
1666
1665
  } finally {
1667
- $t(e.segmentationMasks);
1666
+ Zt(e.segmentationMasks);
1668
1667
  }
1669
- } else T.current && se(T.current, k.current);
1668
+ } else T.current && z(T.current, k.current);
1670
1669
  } catch {}
1671
1670
  let c = A.current;
1672
1671
  if (c.frames += 1, c.lastMeasuredAt === 0 && (c.lastMeasuredAt = s), s - c.lastMeasuredAt >= 1e3) {
1673
1672
  let e = c.frames;
1674
- c.frames = 0, c.lastMeasuredAt = s, F((t) => ({
1673
+ c.frames = 0, c.lastMeasuredAt = s, I((t) => ({
1675
1674
  ...t,
1676
1675
  fps: e
1677
1676
  }));
@@ -1686,16 +1685,16 @@ var Vn = (e, r = {}) => {
1686
1685
  N,
1687
1686
  u,
1688
1687
  d,
1689
- se,
1688
+ z,
1690
1689
  e
1691
1690
  ]);
1692
- let L = t((t) => {
1691
+ let V = t((t) => {
1693
1692
  let n = e.current, r = t.getContext("2d");
1694
1693
  if (!n || !r) return;
1695
1694
  t.width = n.videoWidth || t.clientWidth || 1280, t.height = n.videoHeight || t.clientHeight || 720, r.clearRect(0, 0, t.width, t.height);
1696
1695
  let i = v.current;
1697
1696
  if (!i) return;
1698
- let a = an(i), o = new _(r);
1697
+ let a = nn(i), o = new _(r);
1699
1698
  o.drawLandmarks(a, {
1700
1699
  radius: 3,
1701
1700
  color: "#00FF88",
@@ -1706,20 +1705,20 @@ var Vn = (e, r = {}) => {
1706
1705
  });
1707
1706
  }, [e]);
1708
1707
  return {
1709
- ...ee,
1708
+ ...F,
1710
1709
  isTrackerReady: N,
1711
- drawLandmarks: L,
1712
- silhouetteWidths: te,
1713
- poseFrameWidth: re.width,
1714
- poseFrameHeight: re.height,
1715
- detectedPersonCount: ae.detectedPersonCount,
1716
- lockedPersonId: ae.lockedPersonId,
1717
- trackingQuality: ae.trackingQuality
1710
+ drawLandmarks: V,
1711
+ silhouetteWidths: L,
1712
+ poseFrameWidth: ee.width,
1713
+ poseFrameHeight: ee.height,
1714
+ detectedPersonCount: ne.detectedPersonCount,
1715
+ lockedPersonId: ne.lockedPersonId,
1716
+ trackingQuality: ne.trackingQuality
1718
1717
  };
1719
1718
  };
1720
1719
  //#endregion
1721
1720
  //#region src/hooks/useWebcam.ts
1722
- function Hn(e) {
1721
+ function Bn(e) {
1723
1722
  if (!(e instanceof DOMException)) return "Failed to start the camera.";
1724
1723
  switch (e.name) {
1725
1724
  case "NotAllowedError": return "Camera permission was denied.";
@@ -1729,93 +1728,100 @@ function Hn(e) {
1729
1728
  default: return "Failed to start the camera.";
1730
1729
  }
1731
1730
  }
1732
- function Un(e = {}) {
1733
- let { width: r = 1280, height: o = 720, facingMode: s = "user", enabled: c = !0, mockMode: l = !1, videoRef: u, onReadyChange: d, onErrorChange: f } = e, p = i(null), m = u ?? p, h = i(null), g = i(!1), _ = i(0), [v, y] = a(!1), [b, x] = a(null), S = t((e) => {
1734
- y(e), d?.(e);
1735
- }, [d]), C = t((e) => {
1736
- x(e), f?.(e);
1737
- }, [f]), w = t(() => {
1738
- h.current &&= (h.current.getTracks().forEach((e) => e.stop()), null), m.current && (m.current.pause(), m.current.srcObject = null), S(!1);
1739
- }, [S, m]), T = t(() => {
1740
- _.current += 1, w();
1741
- }, [w]), E = t(() => {
1742
- if (m.current) return m.current;
1731
+ function Vn(e = {}) {
1732
+ let { width: o = 1280, height: s = 720, facingMode: c = "user", enabled: l = !0, mockMode: u = !1, videoRef: d, onReadyChange: f, onErrorChange: p } = e, m = i(null), h = r(() => ({
1733
+ get current() {
1734
+ return m.current;
1735
+ },
1736
+ set current(e) {
1737
+ m.current = e, d && (d.current = e);
1738
+ }
1739
+ }), [d]), g = i(null), _ = i(!1), v = i(0), [y, b] = a(!1), [x, S] = a(null), C = t((e) => {
1740
+ b(e), f?.(e);
1741
+ }, [f]), w = t((e) => {
1742
+ S(e), p?.(e);
1743
+ }, [p]), T = t(() => {
1744
+ g.current &&= (g.current.getTracks().forEach((e) => e.stop()), null), h.current && (h.current.pause(), h.current.srcObject = null), C(!1);
1745
+ }, [C, h]), E = t(() => {
1746
+ v.current += 1, T();
1747
+ }, [T]), D = t(() => {
1748
+ if (h.current) return h.current;
1743
1749
  let e = document.createElement("video");
1744
- return e.playsInline = !0, e.autoplay = !0, e.muted = !0, e.setAttribute("playsinline", "true"), m.current = e, e;
1745
- }, [m]), D = t(async () => {
1746
- let e = _.current + 1;
1747
- if (_.current = e, w(), C(null), l) {
1748
- E(), S(!0);
1750
+ return e.playsInline = !0, e.autoplay = !0, e.muted = !0, e.setAttribute("playsinline", "true"), h.current = e, e;
1751
+ }, [h]), O = t(async () => {
1752
+ let e = v.current + 1;
1753
+ if (v.current = e, T(), w(null), u) {
1754
+ D(), C(!0);
1749
1755
  return;
1750
1756
  }
1751
1757
  if (!navigator.mediaDevices?.getUserMedia) {
1752
- C("This browser does not support camera access.");
1758
+ w("This browser does not support camera access.");
1753
1759
  return;
1754
1760
  }
1755
1761
  try {
1756
- let t = E(), n = await navigator.mediaDevices.getUserMedia({
1762
+ let t = D(), n = await navigator.mediaDevices.getUserMedia({
1757
1763
  video: {
1758
- width: r,
1759
- height: o,
1760
- facingMode: s
1764
+ width: o,
1765
+ height: s,
1766
+ facingMode: c
1761
1767
  },
1762
1768
  audio: !1
1763
1769
  });
1764
- if (!g.current || _.current !== e) {
1770
+ if (!_.current || v.current !== e) {
1765
1771
  n.getTracks().forEach((e) => e.stop());
1766
1772
  return;
1767
1773
  }
1768
- if (h.current = n, t.srcObject = n, await t.play(), !g.current || _.current !== e) {
1774
+ if (g.current = n, t.srcObject = n, await t.play(), !_.current || v.current !== e) {
1769
1775
  n.getTracks().forEach((e) => e.stop());
1770
1776
  return;
1771
1777
  }
1772
- S(!0);
1778
+ C(!0);
1773
1779
  } catch (t) {
1774
- if (_.current !== e) return;
1775
- w(), C(Hn(t));
1780
+ if (v.current !== e) return;
1781
+ T(), w(Bn(t));
1776
1782
  }
1777
1783
  }, [
1778
- E,
1784
+ D,
1785
+ c,
1779
1786
  s,
1780
- o,
1781
- l,
1782
- C,
1783
- S,
1787
+ u,
1784
1788
  w,
1785
- r
1789
+ C,
1790
+ T,
1791
+ o
1786
1792
  ]);
1787
- return n(() => (g.current = !0, () => {
1788
- g.current = !1, T();
1789
- }), [T]), n(() => {
1790
- if (g.current) {
1791
- if (!c) {
1792
- T();
1793
+ return n(() => (_.current = !0, () => {
1794
+ _.current = !1, E();
1795
+ }), [E]), n(() => {
1796
+ if (_.current) {
1797
+ if (!l) {
1798
+ E();
1793
1799
  return;
1794
1800
  }
1795
- D();
1801
+ O();
1796
1802
  }
1797
1803
  }, [
1798
- c,
1799
- D,
1800
- T
1804
+ l,
1805
+ O,
1806
+ E
1801
1807
  ]), {
1802
- videoRef: m,
1803
- isReady: v,
1804
- error: b,
1805
- start: D,
1806
- stop: T
1808
+ videoRef: h,
1809
+ isReady: y,
1810
+ error: x,
1811
+ start: O,
1812
+ stop: E
1807
1813
  };
1808
1814
  }
1809
1815
  //#endregion
1810
1816
  //#region src/hooks/useEverFitting.ts
1811
- function Wn(e = {}) {
1812
- let { width: t = 1280, height: i = 720, facingMode: a = "user", enabled: o = !0, mockMode: s = !1, modelComplexity: c = "lite", numPoses: l, minDetectionConfidence: u, minTrackingConfidence: d, outputSegmentationMasks: f = !0, viewportWidth: p = 0, viewportHeight: m = 0, measurementEnabled: h = !0, autoStartMeasurement: g = !1, measurementConfig: _, bodyPresetOptions: v, fitType: y = "regular", garmentScaleHint: b = null } = e, x = Un({
1817
+ function Hn(e = {}) {
1818
+ let { width: t = 1280, height: i = 720, facingMode: a = "user", enabled: o = !0, mockMode: s = !1, modelComplexity: c = "lite", numPoses: l, minDetectionConfidence: u, minTrackingConfidence: d, outputSegmentationMasks: f = !0, viewportWidth: p = 0, viewportHeight: m = 0, measurementEnabled: h = !0, autoStartMeasurement: g = !1, measurementConfig: _, bodyPresetOptions: v, fitType: y = "regular", garmentScaleHint: b = null } = e, x = Vn({
1813
1819
  width: t,
1814
1820
  height: i,
1815
1821
  facingMode: a,
1816
1822
  enabled: o,
1817
1823
  mockMode: s
1818
- }), S = Vn(x.videoRef, {
1824
+ }), S = zn(x.videoRef, {
1819
1825
  enabled: o,
1820
1826
  modelComplexity: c,
1821
1827
  numPoses: l,
@@ -1824,7 +1830,7 @@ function Wn(e = {}) {
1824
1830
  outputSegmentationMasks: f,
1825
1831
  viewportWidth: p,
1826
1832
  viewportHeight: m
1827
- }), { config: C, measurements: w, sizeRecommendation: T, garmentScale: E, isMeasuring: D, measure: O, startMeasurement: k, updateConfig: A } = nt(), j = o && x.isReady && S.isTracking, M = Re(w, v), N = r(() => _e({
1833
+ }), { config: C, measurements: w, sizeRecommendation: T, garmentScale: E, isMeasuring: D, measure: O, startMeasurement: k, updateConfig: A } = $e(), j = o && x.isReady && S.isTracking, M = Pe(w, v), N = r(() => pe({
1828
1834
  measurements: w,
1829
1835
  measurementScale: E,
1830
1836
  presetSelection: M.selection,
@@ -1934,7 +1940,7 @@ function Wn(e = {}) {
1934
1940
  }
1935
1941
  //#endregion
1936
1942
  //#region src/garment/garmentFitProfile.ts
1937
- function Gn(e) {
1943
+ function Un(e) {
1938
1944
  let t = new b.Vector3(), n = new b.Quaternion(), r = new b.Quaternion();
1939
1945
  return e.updateWorldMatrix(!0, !1), e.getWorldPosition(t), e.getWorldQuaternion(n), e.parent ? e.parent.getWorldQuaternion(r) : r.identity(), {
1940
1946
  bone: e,
@@ -1945,7 +1951,7 @@ function Gn(e) {
1945
1951
  restParentWorldQuaternion: r
1946
1952
  };
1947
1953
  }
1948
- function Kn(e) {
1954
+ function Wn(e) {
1949
1955
  let t = new b.Box3(), n = { current: !1 }, r = new b.Vector3(), i = new b.Box3();
1950
1956
  return e.updateMatrixWorld(!0), e.traverse((e) => {
1951
1957
  if (!(e instanceof b.Mesh) || e.name.startsWith("Collision") || !e.visible) return;
@@ -2008,23 +2014,23 @@ function Kn(e) {
2008
2014
  });
2009
2015
  }), n.current || t.makeEmpty(), t;
2010
2016
  }
2011
- function qn(e) {
2017
+ function Gn(e) {
2012
2018
  if (!e || e.length === 0) return null;
2013
2019
  let t = new b.Vector3(), n = new b.Vector3();
2014
2020
  return e.forEach(({ bone: e }) => {
2015
2021
  e.getWorldPosition(n), t.add(n);
2016
2022
  }), t.multiplyScalar(1 / e.length);
2017
2023
  }
2018
- function Jn(e, t) {
2024
+ function Kn(e, t) {
2019
2025
  for (let n = 0; n < t.length; n += 1) {
2020
- let r = qn(e.get(t[n]));
2026
+ let r = Gn(e.get(t[n]));
2021
2027
  if (r) return r;
2022
2028
  }
2023
2029
  return null;
2024
2030
  }
2025
- function Yn(e, t, n = 1) {
2031
+ function qn(e, t, n = 1) {
2026
2032
  e.updateMatrixWorld(!0);
2027
- let r = Kn(e), i = r.getCenter(new b.Vector3()), a = r.getSize(new b.Vector3()), o = new b.Vector3(i.x, r.min.y + a.y * .74, i.z), s = new b.Vector3(i.x, r.min.y + a.y * .42, i.z), c = Jn(t, ["LeftUpperArm", "LeftShoulder"]), l = Jn(t, ["RightUpperArm", "RightShoulder"]), u = Jn(t, ["Hips"]), d = Jn(t, ["LeftUpperLeg"]), f = Jn(t, ["RightUpperLeg"]), p = c ?? o.clone().setX(i.x + a.x * .18), m = l ?? o.clone().setX(i.x - a.x * .18), h = u ?? s, g = p.clone().add(m).multiplyScalar(.5), _ = d && f ? d.clone().add(f).multiplyScalar(.5) : h.clone(), v = !!(c && l), y = v && !!(u || d && f), x = p.distanceTo(m), S = g.distanceTo(_), C = v ? Math.max(x, 1e-4) : Math.max(x, a.x * .3, n), w = y ? Math.max(S, 1e-4) : Math.max(S, a.y * .28, 1e-4), T = y ? g.clone().add(_).multiplyScalar(.5) : i.clone(), E = r.clone();
2033
+ let r = Wn(e), i = r.getCenter(new b.Vector3()), a = r.getSize(new b.Vector3()), o = new b.Vector3(i.x, r.min.y + a.y * .74, i.z), s = new b.Vector3(i.x, r.min.y + a.y * .42, i.z), c = Kn(t, ["LeftUpperArm", "LeftShoulder"]), l = Kn(t, ["RightUpperArm", "RightShoulder"]), u = Kn(t, ["Hips"]), d = Kn(t, ["LeftUpperLeg"]), f = Kn(t, ["RightUpperLeg"]), p = c ?? o.clone().setX(i.x + a.x * .18), m = l ?? o.clone().setX(i.x - a.x * .18), h = u ?? s, g = p.clone().add(m).multiplyScalar(.5), _ = d && f ? d.clone().add(f).multiplyScalar(.5) : h.clone(), v = !!(c && l), y = v && !!(u || d && f), x = p.distanceTo(m), S = g.distanceTo(_), C = v ? Math.max(x, 1e-4) : Math.max(x, a.x * .3, n), w = y ? Math.max(S, 1e-4) : Math.max(S, a.y * .28, 1e-4), T = y ? g.clone().add(_).multiplyScalar(.5) : i.clone(), E = r.clone();
2028
2034
  if (y) {
2029
2035
  let e = Math.min(g.y, _.y), t = Math.max(g.y, _.y);
2030
2036
  E.min.y = Math.max(E.min.y, e), E.max.y = Math.min(E.max.y, t), E.max.y <= E.min.y && E.copy(r);
@@ -2042,47 +2048,47 @@ function Yn(e, t, n = 1) {
2042
2048
  hasBoneAnchors: y
2043
2049
  };
2044
2050
  }
2045
- function Xn(e) {
2051
+ function Jn(e) {
2046
2052
  for (let t of e.values()) t.forEach(({ bone: e, restQuaternion: t, restScale: n }) => {
2047
2053
  e.quaternion.copy(t), e.scale.copy(n);
2048
2054
  });
2049
2055
  }
2050
2056
  //#endregion
2051
2057
  //#region src/avatar/avatarLoader.ts
2052
- var Zn = "__nativeVRMPrepared";
2053
- function Qn(e) {
2058
+ var Yn = "__nativeVRMPrepared";
2059
+ function Xn(e) {
2054
2060
  try {
2055
2061
  return new URL(e, "https://avatar.local").pathname;
2056
2062
  } catch {
2057
2063
  return e;
2058
2064
  }
2059
2065
  }
2060
- function $n(e) {
2061
- return Qn(e).toLowerCase().endsWith(".vrm");
2066
+ function Zn(e) {
2067
+ return Xn(e).toLowerCase().endsWith(".vrm");
2062
2068
  }
2063
- function er(e) {
2064
- return $n(e) ? "vrm" : "gltf";
2069
+ function Qn(e) {
2070
+ return Zn(e) ? "vrm" : "gltf";
2065
2071
  }
2066
- function tr(e, t) {
2067
- $n(t) && e.register((e) => new S(e));
2072
+ function $n(e, t) {
2073
+ Zn(t) && e.register((e) => new S(e));
2068
2074
  }
2069
- function nr(e) {
2070
- if ($n(e)) return (t) => {
2071
- tr(t, e);
2075
+ function er(e) {
2076
+ if (Zn(e)) return (t) => {
2077
+ $n(t, e);
2072
2078
  };
2073
2079
  }
2074
- function rr(e) {
2080
+ function tr(e) {
2075
2081
  e.traverse((e) => {
2076
2082
  e.frustumCulled = !1;
2077
2083
  });
2078
2084
  }
2079
- function ir(e) {
2085
+ function nr(e) {
2080
2086
  let t = e.scene.userData;
2081
- t[Zn] || (C.rotateVRM0(e), t[Zn] = !0), rr(e.scene);
2087
+ t[Yn] || (C.rotateVRM0(e), t[Yn] = !0), tr(e.scene);
2082
2088
  }
2083
2089
  //#endregion
2084
2090
  //#region src/avatar/humanoidBindings.ts
2085
- var ar = {
2091
+ var rr = {
2086
2092
  Hips: ["hips"],
2087
2093
  Spine: ["spine"],
2088
2094
  Chest: ["chest", "upperChest"],
@@ -2103,13 +2109,13 @@ var ar = {
2103
2109
  RightLowerLeg: ["rightLowerLeg"],
2104
2110
  RightFoot: ["rightFoot"]
2105
2111
  };
2106
- function or(e) {
2112
+ function ir(e) {
2107
2113
  let t = /* @__PURE__ */ new Map();
2108
- return Object.entries(ar).forEach(([n, r]) => {
2114
+ return Object.entries(rr).forEach(([n, r]) => {
2109
2115
  for (let i = 0; i < r.length; i += 1) {
2110
2116
  let a = e.getNormalizedBoneNode(r[i]);
2111
2117
  if (a) {
2112
- t.set(n, [Gn(a)]);
2118
+ t.set(n, [Un(a)]);
2113
2119
  break;
2114
2120
  }
2115
2121
  }
@@ -2117,7 +2123,7 @@ function or(e) {
2117
2123
  }
2118
2124
  //#endregion
2119
2125
  //#region src/avatar/VRMCompat.ts
2120
- var sr = {
2126
+ var ar = {
2121
2127
  root: "hips",
2122
2128
  c_spine0: "spine",
2123
2129
  c_spine1: "spine",
@@ -2139,7 +2145,7 @@ var sr = {
2139
2145
  r_upleg: "rightUpperLeg",
2140
2146
  r_lowleg: "rightLowerLeg",
2141
2147
  r_foot: "rightFoot"
2142
- }, cr = {
2148
+ }, or = {
2143
2149
  bone_0: "hips",
2144
2150
  bone_1: "spine",
2145
2151
  bone_2: "chest",
@@ -2160,7 +2166,7 @@ var sr = {
2160
2166
  bone_48: "rightUpperLeg",
2161
2167
  bone_49: "rightLowerLeg",
2162
2168
  bone_50: "rightFoot"
2163
- }, lr = {
2169
+ }, sr = {
2164
2170
  Root: "hips",
2165
2171
  Hips: "hips",
2166
2172
  Spine: "spine",
@@ -2182,7 +2188,7 @@ var sr = {
2182
2188
  RightLowerLeg: "rightLowerLeg",
2183
2189
  RightFoot: "rightFoot"
2184
2190
  };
2185
- function ur(e, t) {
2191
+ function cr(e, t) {
2186
2192
  if (t?.humanoid) return {
2187
2193
  getNormalizedBoneNode: (e) => t.humanoid.getNormalizedBoneNode(e) ?? null,
2188
2194
  update: (e) => t.update(e),
@@ -2191,11 +2197,11 @@ function ur(e, t) {
2191
2197
  let n = /* @__PURE__ */ new Map();
2192
2198
  return e.traverse((e) => {
2193
2199
  if (!(e instanceof b.Bone)) return;
2194
- let t = e.name, r = sr[t];
2200
+ let t = e.name, r = ar[t];
2195
2201
  r && !n.has(r) && n.set(r, e);
2196
- let i = lr[t];
2202
+ let i = sr[t];
2197
2203
  i && !n.has(i) && n.set(i, e);
2198
- let a = cr[t];
2204
+ let a = or[t];
2199
2205
  a && !n.has(a) && n.set(a, e);
2200
2206
  }), {
2201
2207
  getNormalizedBoneNode: (e) => n.get(e) ?? null,
@@ -2205,9 +2211,9 @@ function ur(e, t) {
2205
2211
  }
2206
2212
  //#endregion
2207
2213
  //#region src/hooks/useAvatarVariant.ts
2208
- function dr(e) {
2214
+ function lr(e) {
2209
2215
  let t = x(e);
2210
- return rr(t), t.traverse((e) => {
2216
+ return tr(t), t.traverse((e) => {
2211
2217
  if (e instanceof b.Mesh) {
2212
2218
  if (Array.isArray(e.material)) {
2213
2219
  e.material = e.material.map((e) => e.clone());
@@ -2217,32 +2223,32 @@ function dr(e) {
2217
2223
  }
2218
2224
  }), t;
2219
2225
  }
2220
- function fr({ url: e }) {
2221
- let t = p(e, "/draco/", !0, r(() => nr(e), [e])), n = t.userData?.vrm ?? null, i = r(() => n ? (ir(n), n.scene) : dr(t.scene), [t.scene, n]), a = r(() => ur(i, n), [i, n]);
2226
+ function ur({ url: e }) {
2227
+ let t = p(e, "/draco/", !0, r(() => er(e), [e])), n = t.userData?.vrm ?? null, i = r(() => n ? (nr(n), n.scene) : lr(t.scene), [t.scene, n]), a = r(() => cr(i, n), [i, n]);
2222
2228
  return {
2223
2229
  scene: i,
2224
2230
  humanoid: a,
2225
- bones: r(() => or(a), [a])
2231
+ bones: r(() => ir(a), [a])
2226
2232
  };
2227
2233
  }
2228
2234
  //#endregion
2229
2235
  //#region src/pose/boneMapping.ts
2230
- var q = Math.PI / 180, pr = {
2231
- min: -70 * q,
2232
- max: 70 * q
2236
+ var Y = Math.PI / 180, dr = {
2237
+ min: -70 * Y,
2238
+ max: 70 * Y
2239
+ }, fr = {
2240
+ min: -45 * Y,
2241
+ max: 45 * Y
2242
+ }, pr = {
2243
+ min: -150 * Y,
2244
+ max: 150 * Y
2233
2245
  }, mr = {
2234
- min: -45 * q,
2235
- max: 45 * q
2246
+ min: -90 * Y,
2247
+ max: 90 * Y
2236
2248
  }, hr = {
2237
- min: -150 * q,
2238
- max: 150 * q
2239
- }, gr = {
2240
- min: -90 * q,
2241
- max: 90 * q
2242
- }, _r = {
2243
2249
  min: 0,
2244
- max: 150 * q
2245
- }, vr = {
2250
+ max: 150 * Y
2251
+ }, gr = {
2246
2252
  Hips: {
2247
2253
  rigKey: "hips",
2248
2254
  rotationScale: {
@@ -2273,22 +2279,22 @@ var q = Math.PI / 180, pr = {
2273
2279
  rigKey: "leftUpperArm",
2274
2280
  rotationScale: .45,
2275
2281
  rotationLimits: {
2276
- x: pr,
2277
- z: mr
2282
+ x: dr,
2283
+ z: fr
2278
2284
  }
2279
2285
  },
2280
2286
  LeftUpperArm: {
2281
2287
  rigKey: "leftUpperArm",
2282
2288
  rotationScale: 1,
2283
2289
  rotationLimits: {
2284
- x: hr,
2285
- z: gr
2290
+ x: pr,
2291
+ z: mr
2286
2292
  }
2287
2293
  },
2288
2294
  LeftLowerArm: {
2289
2295
  rigKey: "leftLowerArm",
2290
2296
  rotationScale: 1,
2291
- rotationLimits: { x: _r }
2297
+ rotationLimits: { x: hr }
2292
2298
  },
2293
2299
  LeftHand: {
2294
2300
  rigKey: "leftLowerArm",
@@ -2298,22 +2304,22 @@ var q = Math.PI / 180, pr = {
2298
2304
  rigKey: "rightUpperArm",
2299
2305
  rotationScale: .45,
2300
2306
  rotationLimits: {
2301
- x: pr,
2302
- z: mr
2307
+ x: dr,
2308
+ z: fr
2303
2309
  }
2304
2310
  },
2305
2311
  RightUpperArm: {
2306
2312
  rigKey: "rightUpperArm",
2307
2313
  rotationScale: 1,
2308
2314
  rotationLimits: {
2309
- x: hr,
2310
- z: gr
2315
+ x: pr,
2316
+ z: mr
2311
2317
  }
2312
2318
  },
2313
2319
  RightLowerArm: {
2314
2320
  rigKey: "rightLowerArm",
2315
2321
  rotationScale: 1,
2316
- rotationLimits: { x: _r }
2322
+ rotationLimits: { x: hr }
2317
2323
  },
2318
2324
  RightHand: {
2319
2325
  rigKey: "rightLowerArm",
@@ -2337,7 +2343,7 @@ var q = Math.PI / 180, pr = {
2337
2343
  rotationScale: .9
2338
2344
  },
2339
2345
  RightFoot: { rigKey: null }
2340
- }, yr = {
2346
+ }, _r = {
2341
2347
  Root: "Hips",
2342
2348
  root: "Hips",
2343
2349
  c_spine0: "Spine",
@@ -2380,22 +2386,22 @@ var q = Math.PI / 180, pr = {
2380
2386
  mixamorig_RightLeg: "RightLowerLeg",
2381
2387
  mixamorig_RightFoot: "RightFoot"
2382
2388
  };
2383
- function br(e) {
2384
- return vr[e] ? e : yr[e] ?? e;
2389
+ function vr(e) {
2390
+ return gr[e] ? e : _r[e] ?? e;
2385
2391
  }
2386
- function xr(e, t) {
2387
- let n = vr[br(e)];
2392
+ function yr(e, t) {
2393
+ let n = gr[vr(e)];
2388
2394
  if (!n || !n.rigKey) return null;
2389
2395
  let r = t[n.rigKey];
2390
2396
  if (!r) return null;
2391
- let i = Sr(n.rigKey === "hips" && "rotation" in r ? r.rotation : r, n.rotationScale);
2397
+ let i = br(n.rigKey === "hips" && "rotation" in r ? r.rotation : r, n.rotationScale);
2392
2398
  return {
2393
- x: Cr(i.x, n.rotationLimits?.x),
2394
- y: Cr(i.y, n.rotationLimits?.y),
2395
- z: Cr(i.z, n.rotationLimits?.z)
2399
+ x: xr(i.x, n.rotationLimits?.x),
2400
+ y: xr(i.y, n.rotationLimits?.y),
2401
+ z: xr(i.z, n.rotationLimits?.z)
2396
2402
  };
2397
2403
  }
2398
- function Sr(e, t = 1) {
2404
+ function br(e, t = 1) {
2399
2405
  return typeof t == "number" ? {
2400
2406
  x: e.x * t,
2401
2407
  y: e.y * t,
@@ -2406,12 +2412,12 @@ function Sr(e, t = 1) {
2406
2412
  z: e.z * (t.z ?? 1)
2407
2413
  };
2408
2414
  }
2409
- function Cr(e, t) {
2415
+ function xr(e, t) {
2410
2416
  return t ? Math.min(t.max, Math.max(t.min, e)) : e;
2411
2417
  }
2412
2418
  //#endregion
2413
2419
  //#region src/garment/poseApplication.ts
2414
- var wr = 12, Tr = new b.Quaternion(), J = new b.Quaternion(), Er = new b.Quaternion(), Dr = new b.Vector3(), Or = new b.Vector3(), Y = new b.Vector3(), kr = new b.Vector3(), Ar = new b.Vector3(), jr = new b.Vector3(), Mr = new b.Vector3(), Nr = new b.Vector3(), Pr = new b.Vector3(), Fr = new b.Quaternion(), Ir = new b.Quaternion(), Lr = new b.Quaternion(), Rr = new b.Quaternion(), zr = {
2420
+ var Sr = 12, Cr = new b.Quaternion(), X = new b.Quaternion(), wr = new b.Quaternion(), Tr = new b.Vector3(), Er = new b.Vector3(), Dr = new b.Vector3(), Or = new b.Vector3(), kr = new b.Vector3(), Ar = new b.Vector3(), jr = new b.Vector3(), Mr = new b.Vector3(), Nr = new b.Vector3(), Pr = new b.Quaternion(), Fr = new b.Quaternion(), Ir = new b.Quaternion(), Lr = new b.Quaternion(), Rr = {
2415
2421
  Hips: [
2416
2422
  "Spine",
2417
2423
  "Chest",
@@ -2430,7 +2436,7 @@ var wr = 12, Tr = new b.Quaternion(), J = new b.Quaternion(), Er = new b.Quatern
2430
2436
  LeftLowerLeg: ["LeftFoot"],
2431
2437
  RightUpperLeg: ["RightLowerLeg"],
2432
2438
  RightLowerLeg: ["RightFoot"]
2433
- }, Br = {
2439
+ }, zr = {
2434
2440
  Hips: [
2435
2441
  ["LeftUpperLeg", "RightUpperLeg"],
2436
2442
  ["LeftShoulder", "RightShoulder"],
@@ -2446,104 +2452,104 @@ var wr = 12, Tr = new b.Quaternion(), J = new b.Quaternion(), Er = new b.Quatern
2446
2452
  ["LeftUpperArm", "RightUpperArm"],
2447
2453
  ["LeftUpperLeg", "RightUpperLeg"]
2448
2454
  ]
2449
- }, Vr = {
2450
- Hips: [z.RIGHT_HIP, z.LEFT_HIP],
2451
- Spine: [z.RIGHT_SHOULDER, z.LEFT_SHOULDER],
2452
- Chest: [z.RIGHT_SHOULDER, z.LEFT_SHOULDER]
2455
+ }, Br = {
2456
+ Hips: [U.RIGHT_HIP, U.LEFT_HIP],
2457
+ Spine: [U.RIGHT_SHOULDER, U.LEFT_SHOULDER],
2458
+ Chest: [U.RIGHT_SHOULDER, U.LEFT_SHOULDER]
2453
2459
  };
2454
- function Hr(e) {
2460
+ function Vr(e) {
2455
2461
  return e.startsWith("Left") ? `Right${e.slice(4)}` : e.startsWith("Right") ? `Left${e.slice(5)}` : e;
2456
2462
  }
2457
- function Ur(e, t, n, r) {
2458
- let i = zr[e];
2463
+ function Hr(e, t, n, r) {
2464
+ let i = Rr[e];
2459
2465
  if (!i) return !1;
2460
2466
  for (let e = 0; e < i.length; e += 1) {
2461
2467
  let a = n.get(i[e])?.[0];
2462
- if (!(!a || a.bone === t.bone || !t.restWorldPosition || !t.restParentWorldQuaternion || !a.restWorldPosition) && (r.copy(a.restWorldPosition).sub(t.restWorldPosition), !(r.lengthSq() < 1e-6))) return r.applyQuaternion(Fr.copy(t.restParentWorldQuaternion).invert()).normalize(), !0;
2468
+ if (!(!a || a.bone === t.bone || !t.restWorldPosition || !t.restParentWorldQuaternion || !a.restWorldPosition) && (r.copy(a.restWorldPosition).sub(t.restWorldPosition), !(r.lengthSq() < 1e-6))) return r.applyQuaternion(Pr.copy(t.restParentWorldQuaternion).invert()).normalize(), !0;
2463
2469
  }
2464
2470
  return !1;
2465
2471
  }
2466
- function Wr(e) {
2467
- return e in Br;
2472
+ function Ur(e) {
2473
+ return e in zr;
2468
2474
  }
2469
- function Gr(e, t, n, r) {
2470
- let i = Br[e];
2475
+ function Wr(e, t, n, r) {
2476
+ let i = zr[e];
2471
2477
  if (!i || !t.restParentWorldQuaternion) return !1;
2472
2478
  for (let e = 0; e < i.length; e += 1) {
2473
2479
  let [a, o] = i[e], s = n.get(a)?.[0], c = n.get(o)?.[0];
2474
- if (!(!s?.restWorldPosition || !c?.restWorldPosition) && (r.copy(c.restWorldPosition).sub(s.restWorldPosition).applyQuaternion(Fr.copy(t.restParentWorldQuaternion).invert()), !(r.lengthSq() < 1e-6))) return r.normalize(), !0;
2480
+ if (!(!s?.restWorldPosition || !c?.restWorldPosition) && (r.copy(c.restWorldPosition).sub(s.restWorldPosition).applyQuaternion(Pr.copy(t.restParentWorldQuaternion).invert()), !(r.lengthSq() < 1e-6))) return r.normalize(), !0;
2475
2481
  }
2476
2482
  return !1;
2477
2483
  }
2478
- function Kr(e, t, n, r, i) {
2479
- let a = Vr[e];
2480
- return !a || !Bt(a[0], a[1], t, i, n) ? !1 : (i.applyQuaternion(Lr.copy(r).invert()).normalize(), i.lengthSq() >= 1e-6);
2484
+ function Gr(e, t, n, r, i) {
2485
+ let a = Br[e];
2486
+ return !a || !Lt(a[0], a[1], t, i, n) ? !1 : (i.applyQuaternion(Ir.copy(r).invert()).normalize(), i.lengthSq() >= 1e-6);
2481
2487
  }
2482
- function qr(e, t, n, r, i, a, o, s) {
2483
- if (!Gr(e, t, n, kr) || !Kr(e, r, i, a, Ar) || (jr.copy(kr).applyQuaternion(J), Mr.copy(jr).projectOnPlane(Y).normalize(), Nr.copy(Ar).projectOnPlane(Y).normalize(), Mr.lengthSq() < 1e-6 || Nr.lengthSq() < 1e-6)) return s.copy(J), !1;
2484
- Pr.crossVectors(Mr, Nr);
2485
- let c = Math.atan2(Y.dot(Pr), Mr.dot(Nr));
2486
- return Rr.setFromAxisAngle(Y, c), s.copy(Rr).multiply(J), o !== void 0 && s.slerp(Er, 1 - o), !0;
2488
+ function Kr(e, t, n, r, i, a, o, s) {
2489
+ if (!Wr(e, t, n, Or) || !Gr(e, r, i, a, kr) || (Ar.copy(Or).applyQuaternion(X), jr.copy(Ar).projectOnPlane(Dr).normalize(), Mr.copy(kr).projectOnPlane(Dr).normalize(), jr.lengthSq() < 1e-6 || Mr.lengthSq() < 1e-6)) return s.copy(X), !1;
2490
+ Nr.crossVectors(jr, Mr);
2491
+ let c = Math.atan2(Dr.dot(Nr), jr.dot(Mr));
2492
+ return Lr.setFromAxisAngle(Dr, c), s.copy(Lr).multiply(X), o !== void 0 && s.slerp(wr, 1 - o), !0;
2487
2493
  }
2488
- function Jr() {
2494
+ function qr() {
2489
2495
  let e = i(new b.Timer()), t = i(/* @__PURE__ */ new Map());
2490
2496
  return r(() => ({
2491
2497
  clockRef: e,
2492
2498
  prevRotationsRef: t
2493
2499
  }), []);
2494
2500
  }
2495
- function Yr(e, t, n, r = {}) {
2501
+ function Jr(e, t, n, r = {}) {
2496
2502
  if (t.size === 0) return;
2497
2503
  let { coordinateSpace: i = "normalized", excludeBones: a } = r;
2498
2504
  n.clockRef.current.update();
2499
- let o = n.clockRef.current.getDelta(), s = Math.min(1, o * wr);
2505
+ let o = n.clockRef.current.getDelta(), s = Math.min(1, o * Sr);
2500
2506
  for (let [n, r] of t) {
2501
- let o = br(n);
2507
+ let o = vr(n);
2502
2508
  if (a?.has(o)) continue;
2503
- let c = Hr(o);
2509
+ let c = Vr(o);
2504
2510
  if (o !== n && t.has(o)) continue;
2505
- let l = Wt(c);
2511
+ let l = Vt(c);
2506
2512
  if (!l) continue;
2507
- let u = l && Vt(c, e, Dr, i);
2513
+ let u = l && Rt(c, e, Tr, i);
2508
2514
  if (!u) continue;
2509
- let d = !1, f = Ht(c);
2515
+ let d = !1, f = zt(c);
2510
2516
  for (let n of r) {
2511
2517
  let { bone: r, restQuaternion: a } = n;
2512
- if (u && Ur(o, n, t, Or)) r.parent ? (r.parent.updateWorldMatrix(!0, !1), r.parent.getWorldQuaternion(Ir)) : (r.updateWorldMatrix(!0, !1), Ir.identity()), Y.copy(Dr).applyQuaternion(Lr.copy(Ir).invert()).normalize(), J.setFromUnitVectors(Or, Y), Wr(o) && qr(o, n, t, e, i, Ir, f, J) || f !== void 0 && J.slerp(Er, 1 - f), Tr.copy(J).multiply(a);
2518
+ if (u && Hr(o, n, t, Er)) r.parent ? (r.parent.updateWorldMatrix(!0, !1), r.parent.getWorldQuaternion(Fr)) : (r.updateWorldMatrix(!0, !1), Fr.identity()), Dr.copy(Tr).applyQuaternion(Ir.copy(Fr).invert()).normalize(), X.setFromUnitVectors(Er, Dr), Ur(o) && Kr(o, n, t, e, i, Fr, f, X) || f !== void 0 && X.slerp(wr, 1 - f), Cr.copy(X).multiply(a);
2513
2519
  else {
2514
- if (d ||= Ut(c, e, J, i), !d) continue;
2515
- Tr.copy(a).multiply(J);
2520
+ if (d ||= Bt(c, e, X, i), !d) continue;
2521
+ Cr.copy(a).multiply(X);
2516
2522
  }
2517
- r.quaternion.slerp(Tr, s), r.updateWorldMatrix(!1, !0);
2523
+ r.quaternion.slerp(Cr, s), r.updateWorldMatrix(!1, !0);
2518
2524
  }
2519
2525
  }
2520
2526
  }
2521
- function Xr(e, t) {
2522
- Xn(e), t.prevRotationsRef.current.clear();
2527
+ function Yr(e, t) {
2528
+ Jn(e), t.prevRotationsRef.current.clear();
2523
2529
  }
2524
- function Zr(e, t, n, r) {
2525
- let i = Math.min(1, n * wr);
2530
+ function Xr(e, t, n, r) {
2531
+ let i = Math.min(1, n * Sr);
2526
2532
  for (let [n, a] of e) {
2527
- let e = br(n);
2533
+ let e = vr(n);
2528
2534
  if (!(r && !r.has(e))) for (let { bone: e, restQuaternion: n } of a) e.quaternion.slerp(n, t * i);
2529
2535
  }
2530
2536
  }
2531
2537
  //#endregion
2532
2538
  //#region src/pose/yawDirectionStabilizer.ts
2533
- var Qr = 50 * Math.PI / 180, $r = 30 * Math.PI / 180, ei = 3;
2534
- function ti(e) {
2535
- return Math.abs(e) < Qr ? "unknown" : e >= 0 ? "positive" : "negative";
2539
+ var Zr = 50 * Math.PI / 180, Qr = 30 * Math.PI / 180, $r = 3;
2540
+ function ei(e) {
2541
+ return Math.abs(e) < Zr ? "unknown" : e >= 0 ? "positive" : "negative";
2536
2542
  }
2537
- function ni(e) {
2543
+ function ti(e) {
2538
2544
  return e === "positive" ? 1 : e === "negative" ? -1 : 0;
2539
2545
  }
2540
- var ri = class {
2546
+ var ni = class {
2541
2547
  _committedYawDirection = "unknown";
2542
2548
  _pendingYawDirection = "unknown";
2543
2549
  _pendingCount = 0;
2544
2550
  update(e, t) {
2545
- let n = Math.abs(t), r = ti(t);
2546
- return e === "back" || n < $r ? (this.reset(), this._buildState(r, "unknown", t)) : this._committedYawDirection === "unknown" ? r === "unknown" ? (this._clearPending(), this._buildState(r, "unknown", t)) : (this._pendingYawDirection === r ? this._pendingCount += 1 : (this._pendingYawDirection = r, this._pendingCount = 1), this._pendingCount >= ei ? (this._committedYawDirection = this._pendingYawDirection, this._clearPending(), this._buildState(r, this._committedYawDirection, n * ni(this._committedYawDirection))) : this._buildState(r, r, t)) : this._buildState(r, this._committedYawDirection, n * ni(this._committedYawDirection));
2551
+ let n = Math.abs(t), r = ei(t);
2552
+ return e === "back" || n < Qr ? (this.reset(), this._buildState(r, "unknown", t)) : this._committedYawDirection === "unknown" ? r === "unknown" ? (this._clearPending(), this._buildState(r, "unknown", t)) : (this._pendingYawDirection === r ? this._pendingCount += 1 : (this._pendingYawDirection = r, this._pendingCount = 1), this._pendingCount >= $r ? (this._committedYawDirection = this._pendingYawDirection, this._clearPending(), this._buildState(r, this._committedYawDirection, n * ti(this._committedYawDirection))) : this._buildState(r, r, t)) : this._buildState(r, this._committedYawDirection, n * ti(this._committedYawDirection));
2547
2553
  }
2548
2554
  reset() {
2549
2555
  this._committedYawDirection = "unknown", this._clearPending();
@@ -2561,41 +2567,41 @@ var ri = class {
2561
2567
  _clearPending() {
2562
2568
  this._pendingYawDirection = "unknown", this._pendingCount = 0;
2563
2569
  }
2564
- }, ii = 80 * Math.PI / 180, ai = 100 * Math.PI / 180, oi = 25 * Math.PI / 180, si = 8, ci = 5, li = 5, ui = 5, di = .5, fi = .3, pi = .2, mi = 5, hi = 8;
2565
- function gi(e) {
2570
+ }, ri = 80 * Math.PI / 180, ii = 100 * Math.PI / 180, ai = 25 * Math.PI / 180, oi = 8, si = 5, ci = 5, li = 5, ui = .5, di = .3, fi = .2, pi = 5, mi = 8;
2571
+ function hi(e) {
2566
2572
  return e?.visibility ?? 0;
2567
2573
  }
2568
- function _i(e) {
2574
+ function gi(e) {
2569
2575
  if (!e || e.length < 33) return {
2570
2576
  shoulderOrder: !1,
2571
2577
  noseVisible: !1,
2572
2578
  earSymmetry: !1
2573
2579
  };
2574
- let t = e[z.LEFT_SHOULDER], n = e[z.RIGHT_SHOULDER], r = e[z.NOSE], i = e[z.LEFT_EAR], a = e[z.RIGHT_EAR], o = t.x < n.x, s = gi(r) > di, c = gi(i), l = gi(a);
2580
+ let t = e[U.LEFT_SHOULDER], n = e[U.RIGHT_SHOULDER], r = e[U.NOSE], i = e[U.LEFT_EAR], a = e[U.RIGHT_EAR], o = t.x < n.x, s = hi(r) > ui, c = hi(i), l = hi(a);
2575
2581
  return {
2576
2582
  shoulderOrder: o,
2577
2583
  noseVisible: s,
2578
- earSymmetry: Math.abs(c - l) < fi && Math.max(c, l) > pi
2584
+ earSymmetry: Math.abs(c - l) < di && Math.max(c, l) > fi
2579
2585
  };
2580
2586
  }
2581
- function vi(e) {
2587
+ function _i(e) {
2582
2588
  let t = 0;
2583
2589
  return e.shoulderOrder && (t += 1), e.noseVisible && (t += 1), e.earSymmetry && (t += 1), t >= 2;
2584
2590
  }
2585
- function yi(e) {
2586
- return e < ii ? "front" : e < ai ? "side" : "back";
2591
+ function vi(e) {
2592
+ return e < ri ? "front" : e < ii ? "side" : "back";
2587
2593
  }
2588
- var bi = class {
2594
+ var yi = class {
2589
2595
  _zone = "front";
2590
2596
  _consecutiveCount = 0;
2591
2597
  _lastRawZone = "front";
2592
2598
  _2dFrontCount = 0;
2593
2599
  _2dBackCount = 0;
2594
2600
  _2dIsFront = !0;
2595
- _yawDirectionStabilizer = new ri();
2601
+ _yawDirectionStabilizer = new ni();
2596
2602
  update(e, t, n) {
2597
- let r = t ?? 0, i = n ?? 0, a = Math.abs(i) > oi, o;
2598
- t === void 0 ? o = this._resolve2dFallback(e) : (o = yi(Math.abs(t)), o === "front" && this._zone !== "front" && (vi(_i(e)) || (o = "back"))), this._applyHysteresis(o);
2603
+ let r = t ?? 0, i = n ?? 0, a = Math.abs(i) > ai, o;
2604
+ t === void 0 ? o = this._resolve2dFallback(e) : (o = vi(Math.abs(t)), o === "front" && this._zone !== "front" && (_i(gi(e)) || (o = "back"))), this._applyHysteresis(o);
2599
2605
  let s = t === void 0 ? null : this._yawDirectionStabilizer.update(this._zone, r);
2600
2606
  return t === void 0 && this._yawDirectionStabilizer.reset(), {
2601
2607
  zone: this._zone,
@@ -2613,7 +2619,7 @@ var bi = class {
2613
2619
  this._zone = "front", this._consecutiveCount = 0, this._lastRawZone = "front", this._2dFrontCount = 0, this._2dBackCount = 0, this._2dIsFront = !0, this._yawDirectionStabilizer.reset();
2614
2620
  }
2615
2621
  _resolve2dFallback(e) {
2616
- return vi(_i(e)) ? (this._2dFrontCount += 1, this._2dBackCount = 0) : (this._2dBackCount += 1, this._2dFrontCount = 0), this._2dIsFront ? this._2dBackCount >= mi && (this._2dIsFront = !1) : this._2dFrontCount >= hi && (this._2dIsFront = !0), this._2dIsFront ? "front" : "back";
2622
+ return _i(gi(e)) ? (this._2dFrontCount += 1, this._2dBackCount = 0) : (this._2dBackCount += 1, this._2dFrontCount = 0), this._2dIsFront ? this._2dBackCount >= pi && (this._2dIsFront = !1) : this._2dFrontCount >= mi && (this._2dIsFront = !0), this._2dIsFront ? "front" : "back";
2617
2623
  }
2618
2624
  _applyHysteresis(e) {
2619
2625
  e === this._lastRawZone ? this._consecutiveCount += 1 : (this._lastRawZone = e, this._consecutiveCount = 1);
@@ -2621,18 +2627,18 @@ var bi = class {
2621
2627
  t !== null && this._consecutiveCount >= t && (this._zone = e);
2622
2628
  }
2623
2629
  _getTransitionThreshold(e, t) {
2624
- return e === t ? null : e === "front" && t === "side" || e === "front" && t === "back" ? si : e === "side" && t === "back" ? ci : e === "back" && t === "side" ? li : e === "side" && t === "front" ? ui : e === "back" && t === "front" ? li : si;
2630
+ return e === t ? null : e === "front" && t === "side" || e === "front" && t === "back" ? oi : e === "side" && t === "back" ? si : e === "back" && t === "side" ? ci : e === "side" && t === "front" ? li : e === "back" && t === "front" ? ci : oi;
2625
2631
  }
2626
- }, xi = Math.PI / 2;
2627
- function Si(e) {
2628
- return e >= 0 ? xi : -xi;
2632
+ }, bi = Math.PI / 2;
2633
+ function xi(e) {
2634
+ return e >= 0 ? bi : -bi;
2629
2635
  }
2630
- var Ci = class {
2636
+ var Si = class {
2631
2637
  _isFrozen = !1;
2632
2638
  _frozenYaw = null;
2633
- update(e, t, n) {
2634
- let r = Math.abs(t);
2635
- return this._isFrozen ? e !== "back" && r < xi && this.reset() : e !== "front" && r >= xi && (this._isFrozen = !0, this._frozenYaw = Si(t)), {
2639
+ update(e, t) {
2640
+ let n = Math.abs(t);
2641
+ return this._isFrozen ? e !== "back" && n < bi && this.reset() : e !== "front" && n >= bi && (this._isFrozen = !0, this._frozenYaw = xi(t)), {
2636
2642
  isFrozen: this._isFrozen,
2637
2643
  frozenYaw: this._frozenYaw
2638
2644
  };
@@ -2643,7 +2649,7 @@ var Ci = class {
2643
2649
  };
2644
2650
  //#endregion
2645
2651
  //#region src/pose/coordinateTransform.ts
2646
- function wi(e, t) {
2652
+ function Ci(e, t) {
2647
2653
  return typeof e == "boolean" ? {
2648
2654
  mirrorX: e,
2649
2655
  sourceWidth: 0,
@@ -2656,27 +2662,27 @@ function wi(e, t) {
2656
2662
  target: e.target ?? t ?? new b.Vector3()
2657
2663
  };
2658
2664
  }
2659
- function X(e, t, n, r = !1, i) {
2660
- let a = wi(r, i), o = rt(t, n, a.sourceWidth || t, a.sourceHeight || n), s = a.mirrorX ? 1 - e.x : e.x, c = o.x + s * o.width, l = o.y + e.y * o.height, u = c - t * .5, d = n * .5 - l, f = -(e.z ?? 0) * o.width * .5;
2665
+ function Z(e, t, n, r = !1, i) {
2666
+ let a = Ci(r, i), o = et(t, n, a.sourceWidth || t, a.sourceHeight || n), s = a.mirrorX ? 1 - e.x : e.x, c = o.x + s * o.width, l = o.y + e.y * o.height, u = c - t * .5, d = n * .5 - l, f = -(e.z ?? 0) * o.width * .5;
2661
2667
  return a.target.set(u, d, f);
2662
2668
  }
2663
- function Ti(e, t, n, r, i = !1, a) {
2664
- return X({
2669
+ function wi(e, t, n, r, i = !1, a) {
2670
+ return Z({
2665
2671
  x: (e.x + t.x) / 2,
2666
2672
  y: (e.y + t.y) / 2,
2667
2673
  z: ((e.z ?? 0) + (t.z ?? 0)) / 2,
2668
2674
  visibility: Math.min(e.visibility ?? 0, t.visibility ?? 0)
2669
2675
  }, n, r, i, a);
2670
2676
  }
2671
- function Ei(e, t, n, r) {
2677
+ function Ti(e, t, n, r) {
2672
2678
  let i = (e.x - t.x) * n, a = (e.y - t.y) * r;
2673
2679
  return Math.sqrt(i * i + a * a);
2674
2680
  }
2675
2681
  //#endregion
2676
2682
  //#region src/garment/fitMotion.ts
2677
- var Di = .45, Oi = .72, ki = 1.02, Ai = 1.1, ji = Math.PI / 6, Z = 1e-4, Mi = Z * Z, Ni = .35, Pi = .6, Fi = new b.Vector3(), Ii = new b.Vector3(), Q = new b.Vector3(), $ = new b.Vector3(), Li = new b.Vector3(), Ri = new b.Vector3(), zi = new b.Matrix4();
2683
+ var Ei = .45, Di = .72, Oi = 1.02, ki = 1.1, Ai = Math.PI / 6, ji = 1e-4, Mi = ji * ji, Ni = .35, Pi = .6, Fi = new b.Vector3(), Ii = new b.Vector3(), Q = new b.Vector3(), $ = new b.Vector3(), Li = new b.Vector3(), Ri = new b.Vector3(), zi = new b.Matrix4();
2678
2684
  function Bi(e, t, n) {
2679
- let r = Math.min(Math.abs(n), Ai), i = 1 / Math.max(Math.cos(r), Di) * e, a = t * Oi;
2685
+ let r = Math.min(Math.abs(n), ki), i = 1 / Math.max(Math.cos(r), Ei) * e, a = t * Di;
2680
2686
  return Math.max(i, a, e);
2681
2687
  }
2682
2688
  function Vi({ projectedShoulderWidth: e, projectedTorsoHeight: t, bodyYaw: n, worldLandmarks: r }) {
@@ -2686,23 +2692,23 @@ function Vi({ projectedShoulderWidth: e, projectedTorsoHeight: t, bodyYaw: n, wo
2686
2692
  return i + (Math.max(i, a) - i) * o;
2687
2693
  }
2688
2694
  function Hi(e) {
2689
- return e ? Ji(e.hips.rotation.y * .85 + e.chest.y * .15, -Ai, Ai) : 0;
2695
+ return e ? Ji(e.hips.rotation.y * .85 + e.chest.y * .15, -ki, ki) : 0;
2690
2696
  }
2691
2697
  function Ui(e, t, n) {
2692
2698
  let r = e.x <= t.x ? e : t, i = e.x <= t.x ? t : e, a = i.x - r.x;
2693
- if (a <= Z) return 0;
2699
+ if (a <= ji) return 0;
2694
2700
  let o = -(i.y - r.y);
2695
- return Ji(Math.atan2(o, a) * Ji(1 - Math.abs(n) / Ai, 0, 1), -ji, ji);
2701
+ return Ji(Math.atan2(o, a) * Ji(1 - Math.abs(n) / ki, 0, 1), -Ai, Ai);
2696
2702
  }
2697
2703
  function Wi({ leftShoulder: e, rightShoulder: t, leftHip: n, rightHip: r }, i = new b.Quaternion()) {
2698
2704
  return Fi.copy(e).add(t).multiplyScalar(.5), Ii.copy(n).add(r).multiplyScalar(.5), Q.copy(t).sub(e), Q.lengthSq() <= Mi || (Q.normalize(), $.copy(Fi).sub(Ii), Li.copy(Q).multiplyScalar($.dot(Q)), $.sub(Li), $.lengthSq() <= Mi) || ($.normalize(), Ri.crossVectors(Q, $), Ri.lengthSq() <= Mi) ? null : (Ri.normalize(), $.crossVectors(Ri, Q).normalize(), zi.makeBasis(Q, $, Ri), i.setFromRotationMatrix(zi));
2699
2705
  }
2700
2706
  function Gi(e, t) {
2701
- if (!t || t.length <= z.RIGHT_HIP || e <= Z) return null;
2702
- let n = t[z.LEFT_SHOULDER], r = t[z.RIGHT_SHOULDER], i = t[z.LEFT_HIP], a = t[z.RIGHT_HIP];
2707
+ if (!t || t.length <= U.RIGHT_HIP || e <= ji) return null;
2708
+ let n = t[U.LEFT_SHOULDER], r = t[U.RIGHT_SHOULDER], i = t[U.LEFT_HIP], a = t[U.RIGHT_HIP];
2703
2709
  if (!n || !r || !i || !a) return null;
2704
2710
  let o = qi(n, r), s = qi(Ki(n, r), Ki(i, a));
2705
- return o <= Z || s <= Z ? null : e * Ji(o / s, Oi, ki);
2711
+ return o <= ji || s <= ji ? null : e * Ji(o / s, Di, Oi);
2706
2712
  }
2707
2713
  function Ki(e, t) {
2708
2714
  return {
@@ -2721,13 +2727,13 @@ function Ji(e, t, n) {
2721
2727
  //#endregion
2722
2728
  //#region src/garment/trackedModelTransform.ts
2723
2729
  var Yi = 1e-4, Xi = .15, Zi = 8, Qi = 1e-4, $i = 1.45, ea = .35, ta = 10, na = .18, ra = .55, ia = 6, aa = .3, oa = .08, sa = .05, ca = 1.35, la = .7, ua = new b.Quaternion(), da = new b.Vector3(), fa = [
2724
- [z.LEFT_EAR, z.RIGHT_EAR],
2725
- z.NOSE,
2726
- [z.LEFT_SHOULDER, z.RIGHT_SHOULDER]
2730
+ [U.LEFT_EAR, U.RIGHT_EAR],
2731
+ U.NOSE,
2732
+ [U.LEFT_SHOULDER, U.RIGHT_SHOULDER]
2727
2733
  ], pa = [
2728
- [z.LEFT_ANKLE, z.RIGHT_ANKLE],
2729
- [z.LEFT_HEEL, z.RIGHT_HEEL],
2730
- [z.LEFT_FOOT_INDEX, z.RIGHT_FOOT_INDEX]
2734
+ [U.LEFT_ANKLE, U.RIGHT_ANKLE],
2735
+ [U.LEFT_HEEL, U.RIGHT_HEEL],
2736
+ [U.LEFT_FOOT_INDEX, U.RIGHT_FOOT_INDEX]
2731
2737
  ];
2732
2738
  function ma(e, t, n) {
2733
2739
  return Math.max(t, Math.min(n, e));
@@ -2760,22 +2766,22 @@ function ha() {
2760
2766
  }
2761
2767
  function ga(e, t, n, r, i, a = {}) {
2762
2768
  if (t.length < 33) return !1;
2763
- X(t[z.LEFT_SHOULDER], n, r, {
2769
+ Z(t[U.LEFT_SHOULDER], n, r, {
2764
2770
  mirrorX: !0,
2765
2771
  sourceWidth: a.sourceWidth,
2766
2772
  sourceHeight: a.sourceHeight,
2767
2773
  target: i.leftShoulder
2768
- }), X(t[z.RIGHT_SHOULDER], n, r, {
2774
+ }), Z(t[U.RIGHT_SHOULDER], n, r, {
2769
2775
  mirrorX: !0,
2770
2776
  sourceWidth: a.sourceWidth,
2771
2777
  sourceHeight: a.sourceHeight,
2772
2778
  target: i.rightShoulder
2773
- }), X(t[z.LEFT_HIP], n, r, {
2779
+ }), Z(t[U.LEFT_HIP], n, r, {
2774
2780
  mirrorX: !0,
2775
2781
  sourceWidth: a.sourceWidth,
2776
2782
  sourceHeight: a.sourceHeight,
2777
2783
  target: i.leftHip
2778
- }), X(t[z.RIGHT_HIP], n, r, {
2784
+ }), Z(t[U.RIGHT_HIP], n, r, {
2779
2785
  mirrorX: !0,
2780
2786
  sourceWidth: a.sourceWidth,
2781
2787
  sourceHeight: a.sourceHeight,
@@ -2835,7 +2841,7 @@ function wa(e, t, n, r, i, a) {
2835
2841
  function Ta(e, t, n, r, i, a) {
2836
2842
  if (typeof e == "number") {
2837
2843
  let o = t[e];
2838
- return !o || (o.visibility ?? 0) < .4 ? !1 : (X(o, n, r, {
2844
+ return !o || (o.visibility ?? 0) < .4 ? !1 : (Z(o, n, r, {
2839
2845
  mirrorX: !0,
2840
2846
  sourceWidth: a.sourceWidth,
2841
2847
  sourceHeight: a.sourceHeight,
@@ -2844,13 +2850,13 @@ function Ta(e, t, n, r, i, a) {
2844
2850
  }
2845
2851
  let o = t[e[0]], s = t[e[1]];
2846
2852
  if (!o || !s || (o.visibility ?? 0) < .4 || (s.visibility ?? 0) < .4) return !1;
2847
- X(o, n, r, {
2853
+ Z(o, n, r, {
2848
2854
  mirrorX: !0,
2849
2855
  sourceWidth: a.sourceWidth,
2850
2856
  sourceHeight: a.sourceHeight,
2851
2857
  target: i
2852
2858
  });
2853
- let c = X(s, n, r, {
2859
+ let c = Z(s, n, r, {
2854
2860
  mirrorX: !0,
2855
2861
  sourceWidth: a.sourceWidth,
2856
2862
  sourceHeight: a.sourceHeight
@@ -2880,8 +2886,8 @@ function La(e, t, n) {
2880
2886
  function Ra() {
2881
2887
  return {
2882
2888
  transformScratch: ha(),
2883
- facingDetector: new bi(),
2884
- yawFreezeController: new Ci(),
2889
+ facingDetector: new yi(),
2890
+ yawFreezeController: new Si(),
2885
2891
  displayYaw: null,
2886
2892
  lastFacingState: null,
2887
2893
  hasInitialPosition: !1
@@ -2898,23 +2904,23 @@ function Ba({ fitProfile: e, garmentRoot: t, boneBindingMap: n, poseRefs: r, mot
2898
2904
  sourceHeight: u,
2899
2905
  worldLandmarks: o
2900
2906
  });
2901
- let p = f.shoulderCenter.y - f.hipCenter.y, m = f.shoulderCenter.distanceTo(f.hipCenter), h = Math.acos(Fa(Math.abs(p) / Math.max(m, .001), 0, 1)), g = f.effectiveYaw, _ = g > 0 ? g - Math.PI : g + Math.PI, v = i.facingDetector.update(a, _, h), y = v.bodyYaw, b = i.displayYaw === null ? y : La(i.displayYaw, y, ka * d), x = i.yawFreezeController.update(v.zone, y, b), S = x.isFrozen, C = S ? x.frozenYaw ?? b : b;
2902
- return i.displayYaw = C, i.lastFacingState = v, v.zone !== "back" && (S || (t.scale.copy(f.scale), i.hasInitialPosition ? t.position.lerp(f.position, Pa) : (t.position.copy(f.position), i.hasInitialPosition = !0)), t.quaternion.setFromAxisAngle(Ea, C)), v.zone === "front" && !S ? (Yr(a, n, r, {
2907
+ let p = f.shoulderCenter.y - f.hipCenter.y, m = f.shoulderCenter.distanceTo(f.hipCenter), h = Math.acos(Fa(Math.abs(p) / Math.max(m, .001), 0, 1)), g = f.effectiveYaw, _ = g > 0 ? g - Math.PI : g + Math.PI, v = i.facingDetector.update(a, _, h), y = v.bodyYaw, b = i.displayYaw === null ? y : La(i.displayYaw, y, ka * d), x = i.yawFreezeController.update(v.zone, y), S = x.isFrozen, C = S ? x.frozenYaw ?? b : b;
2908
+ return i.displayYaw = C, i.lastFacingState = v, v.zone !== "back" && (S || (t.scale.copy(f.scale), i.hasInitialPosition ? t.position.lerp(f.position, Pa) : (t.position.copy(f.position), i.hasInitialPosition = !0)), t.quaternion.setFromAxisAngle(Ea, C)), v.zone === "front" && !S ? (Jr(a, n, r, {
2903
2909
  coordinateSpace: "normalized",
2904
2910
  excludeBones: Da
2905
- }), v.pitchClamped && Zr(n, Fa((Math.abs(h) - Aa) / ja, 0, 1), d, Oa)) : v.zone === "side" && !S && (Yr(a, n, r, {
2911
+ }), v.pitchClamped && Xr(n, Fa((Math.abs(h) - Aa) / ja, 0, 1), d, Oa)) : v.zone === "side" && !S && (Jr(a, n, r, {
2906
2912
  coordinateSpace: "normalized",
2907
2913
  excludeBones: Da
2908
- }), Zr(n, Fa((Math.abs(y) - Ma) / Na, 0, 1), d)), v;
2914
+ }), Xr(n, Fa((Math.abs(y) - Ma) / Na, 0, 1), d)), v;
2909
2915
  }
2910
2916
  //#endregion
2911
2917
  //#region src/components/TrackedGarmentPoseDriver.tsx
2912
2918
  function Va({ garmentRootRef: e, boneBindingMap: t, fitProfile: r, landmarks: a, worldLandmarks: o, poseFrameWidth: l, poseFrameHeight: u }) {
2913
- let { viewport: d } = c(), f = Jr(), p = i(Ra());
2919
+ let { viewport: d } = c(), f = qr(), p = i(Ra());
2914
2920
  return n(() => {
2915
2921
  let n = e.current, r = p.current;
2916
- return n && (n.position.set(0, 0, 0), n.scale.set(1, 1, 1), n.quaternion.identity()), Xr(t, f), za(r), () => {
2917
- Xr(t, f), za(r);
2922
+ return n && (n.position.set(0, 0, 0), n.scale.set(1, 1, 1), n.quaternion.identity()), Yr(t, f), za(r), () => {
2923
+ Yr(t, f), za(r);
2918
2924
  };
2919
2925
  }, [
2920
2926
  t,
@@ -2950,7 +2956,7 @@ function Ha(e) {
2950
2956
  })) : null;
2951
2957
  }
2952
2958
  function Ua({ url: e, landmarks: t, worldLandmarks: a, poseFrameWidth: o, poseFrameHeight: s, debugMaterials: c = !1, onLoadStateChange: l }) {
2953
- let u = i(null), { scene: d, bones: f } = fr({ url: e }), p = r(() => Ha(t), [t]), m = r(() => Ha(a), [a]), _ = r(() => (d.updateMatrixWorld(!0), Yn(d, f, 1)), [f, d]);
2959
+ let u = i(null), { scene: d, bones: f } = ur({ url: e }), p = r(() => Ha(t), [t]), m = r(() => Ha(a), [a]), _ = r(() => (d.updateMatrixWorld(!0), qn(d, f, 1)), [f, d]);
2954
2960
  return n(() => {
2955
2961
  d.traverse((e) => {
2956
2962
  if (e instanceof b.Mesh) {
@@ -2996,10 +3002,10 @@ function Ka(e, t, n) {
2996
3002
  let r = e / t, i = n.width / n.height;
2997
3003
  return r > i ? [e, e / i] : [t * i, t];
2998
3004
  }
2999
- function qa({ videoRef: e, webcamReady: t }) {
3005
+ function qa({ videoElement: e, webcamReady: t }) {
3000
3006
  let { viewport: o } = c(), [l, u] = a(null), [d, f] = a(null), p = i(null), m = i(null), _ = i(0);
3001
3007
  n(() => {
3002
- let n = e.current;
3008
+ let n = e;
3003
3009
  if (!t || !n) {
3004
3010
  m.current !== null && (clearTimeout(m.current), m.current = null), _.current = 0;
3005
3011
  return;
@@ -3060,45 +3066,113 @@ function Ya() {
3060
3066
  args: ["#000000"]
3061
3067
  });
3062
3068
  }
3063
- function Xa({ garmentUrl: e, enabled: t = !0, width: r = 1280, height: i = 720, facingMode: a = "user", mockMode: o = !1, viewportWidth: s = 0, viewportHeight: c = 0, measurementEnabled: l = !0, autoStartMeasurement: u = !1, measurementConfig: p, fitType: m = "regular", garmentScaleHint: _ = null, bodyPresetOptions: v, className: y, style: b, debugMaterials: x = !1, showEnvironment: S = !1, showStats: C = !1, showWebcamBackground: T = !0, onCanvasReadyChange: E, onRuntimeStateChange: D, onGarmentLoadStateChange: O }) {
3064
- let k = Wn({
3065
- enabled: t,
3066
- width: r,
3067
- height: i,
3068
- facingMode: a,
3069
- mockMode: o,
3070
- viewportWidth: s,
3071
- viewportHeight: c,
3072
- measurementEnabled: l,
3073
- autoStartMeasurement: u,
3074
- measurementConfig: p,
3075
- bodyPresetOptions: v,
3076
- fitType: m,
3077
- garmentScaleHint: _
3078
- });
3069
+ function Xa({ garmentUrl: e, enabled: i = !0, width: o = 1280, height: s = 720, facingMode: c = "user", mockMode: l = !1, viewportWidth: u = 0, viewportHeight: p = 0, measurementEnabled: m = !0, autoStartMeasurement: _ = !1, measurementConfig: v, fitType: y = "regular", garmentScaleHint: b = null, bodyPresetOptions: x, className: S, style: C, debugMaterials: T = !1, showEnvironment: E = !1, showStats: D = !1, showWebcamBackground: O = !0, onCanvasReadyChange: k, onRuntimeStateChange: A, onGarmentLoadStateChange: j }) {
3070
+ let { videoRef: M, webcamReady: N, webcamError: P, startWebcam: F, stopWebcam: I, isTrackerReady: L, landmarks: R, worldLandmarks: ee, poseRig: te, confidence: ne, fps: re, isTracking: z, drawLandmarks: B, silhouetteWidths: V, poseFrameWidth: H, poseFrameHeight: ie, detectedPersonCount: ae, lockedPersonId: oe, trackingQuality: se, config: ce, measurements: le, sizeRecommendation: ue, garmentScale: de, finalGarmentScale: fe, bodyMorphResult: pe, isMeasuring: me, canMeasure: he, startMeasurement: ge, updateConfig: _e, bodyPresetSelection: ve, bodyPresetLoading: ye, bodyPresetError: be } = Hn({
3071
+ enabled: i,
3072
+ width: o,
3073
+ height: s,
3074
+ facingMode: c,
3075
+ mockMode: l,
3076
+ viewportWidth: u,
3077
+ viewportHeight: p,
3078
+ measurementEnabled: m,
3079
+ autoStartMeasurement: _,
3080
+ measurementConfig: v,
3081
+ bodyPresetOptions: x,
3082
+ fitType: y,
3083
+ garmentScaleHint: b
3084
+ }), [xe, Se] = a(null), Ce = t((e) => {
3085
+ M.current = e, Se(e);
3086
+ }, [M]), we = r(() => ({
3087
+ videoRef: M,
3088
+ webcamReady: N,
3089
+ webcamError: P,
3090
+ startWebcam: F,
3091
+ stopWebcam: I,
3092
+ isTrackerReady: L,
3093
+ landmarks: R,
3094
+ worldLandmarks: ee,
3095
+ poseRig: te,
3096
+ confidence: ne,
3097
+ fps: re,
3098
+ isTracking: z,
3099
+ drawLandmarks: B,
3100
+ silhouetteWidths: V,
3101
+ poseFrameWidth: H,
3102
+ poseFrameHeight: ie,
3103
+ detectedPersonCount: ae,
3104
+ lockedPersonId: oe,
3105
+ trackingQuality: se,
3106
+ config: ce,
3107
+ measurements: le,
3108
+ sizeRecommendation: ue,
3109
+ garmentScale: de,
3110
+ finalGarmentScale: fe,
3111
+ bodyMorphResult: pe,
3112
+ isMeasuring: me,
3113
+ canMeasure: he,
3114
+ startMeasurement: ge,
3115
+ updateConfig: _e,
3116
+ bodyPresetSelection: ve,
3117
+ bodyPresetLoading: ye,
3118
+ bodyPresetError: be
3119
+ }), [
3120
+ M,
3121
+ N,
3122
+ P,
3123
+ F,
3124
+ I,
3125
+ L,
3126
+ R,
3127
+ ee,
3128
+ te,
3129
+ ne,
3130
+ re,
3131
+ z,
3132
+ B,
3133
+ V,
3134
+ H,
3135
+ ie,
3136
+ ae,
3137
+ oe,
3138
+ se,
3139
+ ce,
3140
+ le,
3141
+ ue,
3142
+ de,
3143
+ fe,
3144
+ pe,
3145
+ me,
3146
+ he,
3147
+ ge,
3148
+ _e,
3149
+ ve,
3150
+ ye,
3151
+ be
3152
+ ]);
3079
3153
  return n(() => {
3080
- D?.(k);
3081
- }, [k, D]), /* @__PURE__ */ g("div", {
3082
- className: y,
3154
+ A?.(we);
3155
+ }, [A, we]), /* @__PURE__ */ g("div", {
3156
+ className: S,
3083
3157
  style: {
3084
3158
  position: "relative",
3085
3159
  width: "100%",
3086
3160
  height: "100%",
3087
3161
  overflow: "hidden",
3088
- ...b
3162
+ ...C
3089
3163
  },
3090
3164
  children: [/* @__PURE__ */ h("video", {
3091
- ref: k.videoRef,
3165
+ ref: Ce,
3092
3166
  autoPlay: !0,
3093
3167
  playsInline: !0,
3094
3168
  muted: !0,
3095
3169
  style: { display: "none" }
3096
3170
  }), /* @__PURE__ */ g(w, {
3097
- showEnvironment: S,
3171
+ showEnvironment: E,
3098
3172
  useDefaultLights: !1,
3099
3173
  enableOrbitControls: !1,
3100
3174
  children: [
3101
- /* @__PURE__ */ h(Ja, { onReady: E }),
3175
+ /* @__PURE__ */ h(Ja, { onReady: k }),
3102
3176
  /* @__PURE__ */ h(Ya, {}),
3103
3177
  /* @__PURE__ */ h(d, {
3104
3178
  makeDefault: !0,
@@ -3133,20 +3207,20 @@ function Xa({ garmentUrl: e, enabled: t = !0, width: r = 1280, height: i = 720,
3133
3207
  "#7d8aa6",
3134
3208
  .35
3135
3209
  ] }),
3136
- T ? /* @__PURE__ */ h(qa, {
3137
- videoRef: k.videoRef,
3138
- webcamReady: k.webcamReady
3210
+ O ? /* @__PURE__ */ h(qa, {
3211
+ videoElement: xe,
3212
+ webcamReady: N
3139
3213
  }) : null,
3140
- t && e ? /* @__PURE__ */ h(Ua, {
3214
+ i && e ? /* @__PURE__ */ h(Ua, {
3141
3215
  url: e,
3142
- landmarks: k.landmarks,
3143
- worldLandmarks: k.worldLandmarks,
3144
- poseFrameWidth: k.poseFrameWidth,
3145
- poseFrameHeight: k.poseFrameHeight,
3146
- debugMaterials: x,
3147
- onLoadStateChange: O
3216
+ landmarks: R,
3217
+ worldLandmarks: ee,
3218
+ poseFrameWidth: H,
3219
+ poseFrameHeight: ie,
3220
+ debugMaterials: T,
3221
+ onLoadStateChange: j
3148
3222
  }) : null,
3149
- C ? /* @__PURE__ */ h(f, {}) : null
3223
+ D ? /* @__PURE__ */ h(f, {}) : null
3150
3224
  ]
3151
3225
  })]
3152
3226
  });
@@ -3158,7 +3232,7 @@ function Qa(e, t) {
3158
3232
  return e instanceof Error && e.message ? e.message : t;
3159
3233
  }
3160
3234
  function $a(e) {
3161
- let n = r(() => new xe(e), [e]), [i, o] = a("idle"), [s, c] = a(null), [l, u] = a(null);
3235
+ let n = r(() => new _e(e), [e]), [i, o] = a("idle"), [s, c] = a(null), [l, u] = a(null);
3162
3236
  return {
3163
3237
  status: i,
3164
3238
  resultUrl: s,
@@ -3196,24 +3270,24 @@ function $a(e) {
3196
3270
  //#endregion
3197
3271
  //#region src/garment/constants.ts
3198
3272
  var eo = {
3199
- Hips: [z.LEFT_HIP, z.RIGHT_HIP],
3273
+ Hips: [U.LEFT_HIP, U.RIGHT_HIP],
3200
3274
  Spine: [
3201
- z.LEFT_SHOULDER,
3202
- z.RIGHT_SHOULDER,
3203
- z.LEFT_HIP,
3204
- z.RIGHT_HIP
3275
+ U.LEFT_SHOULDER,
3276
+ U.RIGHT_SHOULDER,
3277
+ U.LEFT_HIP,
3278
+ U.RIGHT_HIP
3205
3279
  ],
3206
- Chest: [z.LEFT_SHOULDER, z.RIGHT_SHOULDER],
3207
- LeftShoulder: [z.LEFT_SHOULDER, z.LEFT_ELBOW],
3208
- LeftUpperArm: [z.LEFT_SHOULDER, z.LEFT_ELBOW],
3209
- LeftLowerArm: [z.LEFT_ELBOW, z.LEFT_WRIST],
3210
- RightShoulder: [z.RIGHT_SHOULDER, z.RIGHT_ELBOW],
3211
- RightUpperArm: [z.RIGHT_SHOULDER, z.RIGHT_ELBOW],
3212
- RightLowerArm: [z.RIGHT_ELBOW, z.RIGHT_WRIST],
3213
- LeftUpperLeg: [z.LEFT_HIP, z.LEFT_KNEE],
3214
- LeftLowerLeg: [z.LEFT_KNEE, z.LEFT_ANKLE],
3215
- RightUpperLeg: [z.RIGHT_HIP, z.RIGHT_KNEE],
3216
- RightLowerLeg: [z.RIGHT_KNEE, z.RIGHT_ANKLE]
3280
+ Chest: [U.LEFT_SHOULDER, U.RIGHT_SHOULDER],
3281
+ LeftShoulder: [U.LEFT_SHOULDER, U.LEFT_ELBOW],
3282
+ LeftUpperArm: [U.LEFT_SHOULDER, U.LEFT_ELBOW],
3283
+ LeftLowerArm: [U.LEFT_ELBOW, U.LEFT_WRIST],
3284
+ RightShoulder: [U.RIGHT_SHOULDER, U.RIGHT_ELBOW],
3285
+ RightUpperArm: [U.RIGHT_SHOULDER, U.RIGHT_ELBOW],
3286
+ RightLowerArm: [U.RIGHT_ELBOW, U.RIGHT_WRIST],
3287
+ LeftUpperLeg: [U.LEFT_HIP, U.LEFT_KNEE],
3288
+ LeftLowerLeg: [U.LEFT_KNEE, U.LEFT_ANKLE],
3289
+ RightUpperLeg: [U.RIGHT_HIP, U.RIGHT_KNEE],
3290
+ RightLowerLeg: [U.RIGHT_KNEE, U.RIGHT_ANKLE]
3217
3291
  };
3218
3292
  //#endregion
3219
- export { vr as BONE_MAPPING, eo as BONE_VISIBILITY_MAP, ve as DEFAULT_EVER_API_BASE_URL, we as DEFAULT_FEMALE_BODY_PRESET_ID, T as DEFAULT_GARMENT_SPEC, tn as DEFAULT_LOCKED_PERSON_ID, Ce as DEFAULT_MALE_BODY_PRESET_ID, $e as DEFAULT_MEASUREMENT_CONFIG, vt as DEFAULT_NUM_POSES, ze as DEFAULT_SMOOTHING, w as EverCanvas, xe as EverClient, Xa as EverFittingScene, Ua as EverTrackedGarment, bi as FacingDetector, yt as INTERPOLATION_ALPHA, z as LANDMARK, Te as LEGACY_RIGGED_BODY_PRESET_ID, ln as LandmarkSmoother, ht as MEDIAPIPE_TASKS_VISION_VERSION, bt as MODEL_ASSET_PATHS, _t as POSE_DETECTION_INTERVAL, In as TRACKING_SNAPSHOT_HOLD_MS, Va as TrackedGarmentPoseDriver, gt as WASM_FILES_URL, qa as WebcamPlaneBackground, ri as YawDirectionStabilizer, Ci as YawFreezeController, Yr as applyLandmarkPoseToGarment, _a as applyTrackedModelTransform, Zr as blendBonesToRest, Oe as buildBodyPresetAssetUrl, Fe as buildBodyPresetMatchRequest, xn as calcRectIoU, Gn as captureBoneBinding, vn as clampNormalizedRect, $t as closeSegmentationMasks, Ue as computeBmiCorrectionFactor, _e as computeBodyFirstFitting, Vt as computeBoneDirectionFromLandmarks, Ut as computeBoneRotationFromLandmarks, rt as computeCoverRect, Bi as computeFacingAwareShoulderWidth, Yn as computeGarmentFitProfile, Ui as computeGarmentGroupRoll, Hi as computeGarmentGroupYaw, Wi as computeGarmentRootQuaternion, O as computeGarmentScale, yn as computeLandmarkBoundsNormalized, Bt as computeLandmarkSegmentDirection, He as computeScale, Vi as computeStableShoulderWidth, it as computeVisibleNormalizedRegion, tr as configureAvatarLoader, nr as createAvatarLoaderExtension, Ne as createFallbackBodyPresetSelection, Rn as createHeldTrackingSnapshot, or as createHumanoidBoneBindings, Mn as createIdleTrackingQuality, pt as createInitialPoseSnapshot, Pn as createInitialTrackingRuntimeState, Cn as createPoseCandidates, xt as createPoseLandmarker, Ra as createTrackedGarmentMotionState, ha as createTrackedModelTransformScratch, zn as createTrackingLostRuntimeState, Nn as createTrackingQuality, Fn as createTrackingRuntimeState, ur as createVRMCompat, fe as deriveBodyMorphResult, je as ensureBodyPresetModelUrl, bn as expandNormalizedRect, _i as extractFacingSignals, ct as extractSilhouetteWidths, Dn as filterCandidatesByVisibleRegion, er as getAvatarAssetKind, Ht as getBoneLandmarkInfluence, xr as getBoneRotation, ke as getDefaultBodyPresetId, Qt as getSegmentationMaskData, Wt as hasLandmarkMapping, lt as interpolateLandmarks, dt as interpolatePoseRig, mt as interpolatePoseSnapshot, ft as interpolateSilhouetteWidths, En as isCandidateInVisibleRegion, vi as isRawFrontFacing, $n as isVRMAssetUrl, Ei as landmarkDistance, X as landmarkToThreePosition, K as lerpRotation, U as lerpValue, Xe as measureBody, Ti as midpointToThree, De as normalizeBodyPresetGender, br as normalizeBoneName, rn as normalizeLandmark, an as normalizeLandmarks, Me as pickDefaultBodyPreset, rr as prepareAvatarScene, ir as prepareNativeVRM, Qe as recommendSize, Xn as resetBoneRotations, Xr as resetPoseState, za as resetTrackedGarmentMotionState, en as scaleSilhouetteWidths, Tn as selectLockedPoseCandidate, Ln as shouldHoldTrackingSnapshot, dn as smoothPoseRig, Zt as solvePose, Pe as toBodyPresetSelection, Ae as toBodyPresetSummary, On as toLockedPoseCandidate, Ba as updateTrackedGarmentMotion, ga as updateTrackedModelTransform, fr as useAvatarVariant, Re as useBodyPresetSelection, Wn as useEverFitting, $a as useEverGeneration, nt as useMeasurement, Jr as usePoseApplicationRefs, Vn as usePoseTracker, Un as useWebcam };
3293
+ export { gr as BONE_MAPPING, eo as BONE_VISIBILITY_MAP, me as DEFAULT_EVER_API_BASE_URL, be as DEFAULT_FEMALE_BODY_PRESET_ID, T as DEFAULT_GARMENT_SPEC, $t as DEFAULT_LOCKED_PERSON_ID, ye as DEFAULT_MALE_BODY_PRESET_ID, Xe as DEFAULT_MEASUREMENT_CONFIG, ht as DEFAULT_NUM_POSES, Fe as DEFAULT_SMOOTHING, w as EverCanvas, _e as EverClient, Xa as EverFittingScene, Ua as EverTrackedGarment, yi as FacingDetector, gt as INTERPOLATION_ALPHA, U as LANDMARK, xe as LEGACY_RIGGED_BODY_PRESET_ID, sn as LandmarkSmoother, ft as MEDIAPIPE_TASKS_VISION_VERSION, _t as MODEL_ASSET_PATHS, mt as POSE_DETECTION_INTERVAL, Pn as TRACKING_SNAPSHOT_HOLD_MS, Va as TrackedGarmentPoseDriver, pt as WASM_FILES_URL, qa as WebcamPlaneBackground, ni as YawDirectionStabilizer, Si as YawFreezeController, Jr as applyLandmarkPoseToGarment, _a as applyTrackedModelTransform, Xr as blendBonesToRest, we as buildBodyPresetAssetUrl, je as buildBodyPresetMatchRequest, yn as calcRectIoU, Un as captureBoneBinding, gn as clampNormalizedRect, Zt as closeSegmentationMasks, Be as computeBmiCorrectionFactor, pe as computeBodyFirstFitting, Rt as computeBoneDirectionFromLandmarks, Bt as computeBoneRotationFromLandmarks, et as computeCoverRect, Bi as computeFacingAwareShoulderWidth, qn as computeGarmentFitProfile, Ui as computeGarmentGroupRoll, Hi as computeGarmentGroupYaw, Wi as computeGarmentRootQuaternion, O as computeGarmentScale, _n as computeLandmarkBoundsNormalized, Lt as computeLandmarkSegmentDirection, ze as computeScale, Vi as computeStableShoulderWidth, tt as computeVisibleNormalizedRegion, $n as configureAvatarLoader, er as createAvatarLoaderExtension, ke as createFallbackBodyPresetSelection, In as createHeldTrackingSnapshot, ir as createHumanoidBoneBindings, An as createIdleTrackingQuality, ut as createInitialPoseSnapshot, Mn as createInitialTrackingRuntimeState, xn as createPoseCandidates, vt as createPoseLandmarker, Ra as createTrackedGarmentMotionState, ha as createTrackedModelTransformScratch, Ln as createTrackingLostRuntimeState, jn as createTrackingQuality, Nn as createTrackingRuntimeState, cr as createVRMCompat, ce as deriveBodyMorphResult, De as ensureBodyPresetModelUrl, vn as expandNormalizedRect, gi as extractFacingSignals, at as extractSilhouetteWidths, Tn as filterCandidatesByVisibleRegion, Qn as getAvatarAssetKind, zt as getBoneLandmarkInfluence, yr as getBoneRotation, Te as getDefaultBodyPresetId, Xt as getSegmentationMaskData, Vt as hasLandmarkMapping, ot as interpolateLandmarks, ct as interpolatePoseRig, dt as interpolatePoseSnapshot, lt as interpolateSilhouetteWidths, wn as isCandidateInVisibleRegion, _i as isRawFrontFacing, Zn as isVRMAssetUrl, Ti as landmarkDistance, Z as landmarkToThreePosition, J as lerpRotation, K as lerpValue, qe as measureBody, wi as midpointToThree, Ce as normalizeBodyPresetGender, vr as normalizeBoneName, tn as normalizeLandmark, nn as normalizeLandmarks, Oe as pickDefaultBodyPreset, tr as prepareAvatarScene, nr as prepareNativeVRM, Ye as recommendSize, Jn as resetBoneRotations, Yr as resetPoseState, za as resetTrackedGarmentMotionState, Qt as scaleSilhouetteWidths, Cn as selectLockedPoseCandidate, Fn as shouldHoldTrackingSnapshot, ln as smoothPoseRig, Yt as solvePose, Ae as toBodyPresetSelection, Ee as toBodyPresetSummary, En as toLockedPoseCandidate, Ba as updateTrackedGarmentMotion, ga as updateTrackedModelTransform, ur as useAvatarVariant, Pe as useBodyPresetSelection, Hn as useEverFitting, $a as useEverGeneration, $e as useMeasurement, qr as usePoseApplicationRefs, zn as usePoseTracker, Vn as useWebcam };