@primestyleai/tryon 5.10.112 → 5.10.113
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/react/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { P as Jg, L as xg, b as Gt, d as
|
|
2
|
+
import { P as Jg, L as xg, b as Gt, d as Zo, a as Co, c as Ot, A as Lt, S as zt, i as Nt } from "../index-YDYXhM8c.js";
|
|
3
3
|
import { jsxs as e, jsx as A, Fragment as eA } from "react/jsx-runtime";
|
|
4
4
|
import { useState as Q, useRef as hA, useCallback as bA, useEffect as kA, useMemo as He } from "react";
|
|
5
5
|
import { createPortal as dg } from "react-dom";
|
|
6
6
|
const Ut = "primestyle-photos", to = "photos", Jt = 1;
|
|
7
|
-
let
|
|
7
|
+
let Ko = null;
|
|
8
8
|
function Dg() {
|
|
9
|
-
return
|
|
9
|
+
return Ko || (Ko = new Promise((o) => {
|
|
10
10
|
try {
|
|
11
11
|
if (typeof indexedDB > "u") return o(null);
|
|
12
12
|
const g = indexedDB.open(Ut, Jt);
|
|
@@ -17,7 +17,7 @@ function Dg() {
|
|
|
17
17
|
} catch {
|
|
18
18
|
o(null);
|
|
19
19
|
}
|
|
20
|
-
}),
|
|
20
|
+
}), Ko);
|
|
21
21
|
}
|
|
22
22
|
async function Kt(o, g) {
|
|
23
23
|
const t = await Dg();
|
|
@@ -59,10 +59,10 @@ async function jt(o) {
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
const Kg = 11, Sg = 12, Rt = 13, Tt = 14, Xt = 15, Wt = 16, jg = 23, Rg = 24, Vt = 25, qt = 26, Zt = 27, $t = 28, _t = 0;
|
|
62
|
-
let
|
|
62
|
+
let qo = null, So = null;
|
|
63
63
|
async function Tg() {
|
|
64
|
-
if (!
|
|
65
|
-
return
|
|
64
|
+
if (!qo)
|
|
65
|
+
return So || (So = (async () => {
|
|
66
66
|
const o = await import(
|
|
67
67
|
/* webpackIgnore: true */
|
|
68
68
|
// @ts-ignore dynamic CDN import
|
|
@@ -70,7 +70,7 @@ async function Tg() {
|
|
|
70
70
|
), { FilesetResolver: g, PoseLandmarker: t } = o, r = await g.forVisionTasks(
|
|
71
71
|
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.33/wasm"
|
|
72
72
|
);
|
|
73
|
-
|
|
73
|
+
qo = await t.createFromOptions(r, {
|
|
74
74
|
baseOptions: {
|
|
75
75
|
modelAssetPath: "https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/1/pose_landmarker_lite.task",
|
|
76
76
|
delegate: "GPU"
|
|
@@ -78,12 +78,12 @@ async function Tg() {
|
|
|
78
78
|
runningMode: "IMAGE",
|
|
79
79
|
numPoses: 1
|
|
80
80
|
});
|
|
81
|
-
})(),
|
|
81
|
+
})(), So);
|
|
82
82
|
}
|
|
83
|
-
async function
|
|
83
|
+
async function Vo(o) {
|
|
84
84
|
try {
|
|
85
85
|
await Tg();
|
|
86
|
-
const g = await Xg(o), t =
|
|
86
|
+
const g = await Xg(o), t = qo.detect(g);
|
|
87
87
|
if (!t?.landmarks?.length || t.landmarks[0].length < 25)
|
|
88
88
|
return null;
|
|
89
89
|
const r = t.landmarks[0], B = r[Kg], a = r[Sg], n = r[jg], w = r[Rg], s = (B.y + a.y) / 2, l = (n.y + w.y) / 2, f = l - s, D = s + f * 0.28, m = Math.abs(a.x - B.x), P = Math.min(B.x, a.x) - m * 0.05, x = Math.max(B.x, a.x) + m * 0.05, L = Math.abs(w.x - n.x), G = Math.min(n.x, w.x) - L * 0.15, I = Math.max(n.x, w.x) + L * 0.15, d = D + (l - D) * 0.55, W = m * 0.85, V = (B.x + a.x + n.x + w.x) / 4, i = V - W / 2, b = V + W / 2;
|
|
@@ -118,7 +118,7 @@ async function ao(o) {
|
|
|
118
118
|
await Tg();
|
|
119
119
|
let g;
|
|
120
120
|
typeof o == "string" ? g = await Xg(o) : g = o;
|
|
121
|
-
const t = await An(g, 1024), r = t.width || g.naturalWidth || g.width, B = t.height || g.naturalHeight || g.height, a =
|
|
121
|
+
const t = await An(g, 1024), r = t.width || g.naturalWidth || g.width, B = t.height || g.naturalHeight || g.height, a = qo.detect(t);
|
|
122
122
|
if (!a?.landmarks?.length || a.landmarks[0].length < 29)
|
|
123
123
|
return console.warn("[PS-SDK:MediaPipe] detection returned no usable landmarks", {
|
|
124
124
|
gotLandmarks: !!a?.landmarks?.length,
|
|
@@ -9363,7 +9363,7 @@ function Ar({
|
|
|
9363
9363
|
null
|
|
9364
9364
|
] });
|
|
9365
9365
|
}
|
|
9366
|
-
const
|
|
9366
|
+
const jo = 22;
|
|
9367
9367
|
function Yg({
|
|
9368
9368
|
tryOnStartedAt: o,
|
|
9369
9369
|
t: g
|
|
@@ -9374,7 +9374,7 @@ function Yg({
|
|
|
9374
9374
|
const D = setInterval(() => t((m) => m + 1), 200);
|
|
9375
9375
|
return () => clearInterval(D);
|
|
9376
9376
|
}, [o]), o == null) return null;
|
|
9377
|
-
const r = (Date.now() - o) / 1e3, B = Math.min(95, r /
|
|
9377
|
+
const r = (Date.now() - o) / 1e3, B = Math.min(95, r / jo * 100), a = Math.round(B), n = Math.max(0, jo - Math.floor(r)), w = r >= jo ? g("almost done") : `~${n}s ${g("left")}`, s = [
|
|
9378
9378
|
g("Preparing your image"),
|
|
9379
9379
|
g("Analyzing body proportions"),
|
|
9380
9380
|
g("Mapping garment to body"),
|
|
@@ -9382,7 +9382,7 @@ function Yg({
|
|
|
9382
9382
|
g("Almost done")
|
|
9383
9383
|
], l = Math.min(
|
|
9384
9384
|
s.length - 1,
|
|
9385
|
-
Math.floor(r /
|
|
9385
|
+
Math.floor(r / jo * s.length)
|
|
9386
9386
|
), f = s[l];
|
|
9387
9387
|
return /* @__PURE__ */ e("div", { className: "ps-tryon-badge", role: "status", "aria-live": "polite", children: [
|
|
9388
9388
|
/* @__PURE__ */ e("div", { className: "ps-tryon-badge-row", children: [
|
|
@@ -9795,7 +9795,7 @@ function ig(o, g) {
|
|
|
9795
9795
|
return B === t || t.includes(B) || B.includes(t);
|
|
9796
9796
|
}) || null;
|
|
9797
9797
|
}
|
|
9798
|
-
function
|
|
9798
|
+
function Ro({
|
|
9799
9799
|
sectionName: o,
|
|
9800
9800
|
section: g,
|
|
9801
9801
|
sectionResult: t,
|
|
@@ -10638,7 +10638,7 @@ function Br({
|
|
|
10638
10638
|
me(null), DA(!1);
|
|
10639
10639
|
return;
|
|
10640
10640
|
}
|
|
10641
|
-
DA(!1),
|
|
10641
|
+
DA(!1), Vo(r).then((v) => {
|
|
10642
10642
|
me(v), DA(!0);
|
|
10643
10643
|
}).catch(() => {
|
|
10644
10644
|
DA(!0);
|
|
@@ -10843,7 +10843,7 @@ function Br({
|
|
|
10843
10843
|
return v ? BA ? /* @__PURE__ */ e(eA, { children: [
|
|
10844
10844
|
be && /* @__PURE__ */ A("div", { style: { padding: "0 16px" }, children: be }),
|
|
10845
10845
|
/* @__PURE__ */ A(
|
|
10846
|
-
|
|
10846
|
+
Ro,
|
|
10847
10847
|
{
|
|
10848
10848
|
sectionName: v.name,
|
|
10849
10849
|
section: v.section,
|
|
@@ -10894,7 +10894,7 @@ function Br({
|
|
|
10894
10894
|
/* @__PURE__ */ e("div", { className: "ps-tryon-v2-panel", children: [
|
|
10895
10895
|
be,
|
|
10896
10896
|
/* @__PURE__ */ A(
|
|
10897
|
-
|
|
10897
|
+
Ro,
|
|
10898
10898
|
{
|
|
10899
10899
|
sectionName: v.name,
|
|
10900
10900
|
section: v.section,
|
|
@@ -11100,7 +11100,7 @@ function Br({
|
|
|
11100
11100
|
return BA ? /* @__PURE__ */ e(eA, { children: [
|
|
11101
11101
|
be && /* @__PURE__ */ A("div", { style: { padding: "0 16px" }, children: be }),
|
|
11102
11102
|
/* @__PURE__ */ A(
|
|
11103
|
-
|
|
11103
|
+
Ro,
|
|
11104
11104
|
{
|
|
11105
11105
|
sectionName: N,
|
|
11106
11106
|
section: v,
|
|
@@ -11165,7 +11165,7 @@ function Br({
|
|
|
11165
11165
|
E === N ? (
|
|
11166
11166
|
/* DETAIL VIEW — full size table, same as multi-garment */
|
|
11167
11167
|
/* @__PURE__ */ A(
|
|
11168
|
-
|
|
11168
|
+
Ro,
|
|
11169
11169
|
{
|
|
11170
11170
|
sectionName: N,
|
|
11171
11171
|
section: v,
|
|
@@ -11680,7 +11680,7 @@ function zg({
|
|
|
11680
11680
|
if (o && g) {
|
|
11681
11681
|
I(!0), W(D("Analyzing photo…"));
|
|
11682
11682
|
try {
|
|
11683
|
-
const GA = await
|
|
11683
|
+
const GA = await Zo(O, o, g);
|
|
11684
11684
|
if (!GA.isAdult) {
|
|
11685
11685
|
const T = GA.reasoning?.trim() || D("This photo appears to be of a minor. Please upload a photo of someone 18 or older.");
|
|
11686
11686
|
i(T), I(!1), W("");
|
|
@@ -12245,7 +12245,7 @@ function Ke({
|
|
|
12245
12245
|
}
|
|
12246
12246
|
);
|
|
12247
12247
|
}
|
|
12248
|
-
function
|
|
12248
|
+
function To({
|
|
12249
12249
|
stepKey: o,
|
|
12250
12250
|
title: g,
|
|
12251
12251
|
subtitle: t,
|
|
@@ -12298,7 +12298,7 @@ function Or({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: B, o
|
|
|
12298
12298
|
}
|
|
12299
12299
|
T(""), jA(!0), MA(n("Analyzing photo…"));
|
|
12300
12300
|
try {
|
|
12301
|
-
const PA = t && r ?
|
|
12301
|
+
const PA = t && r ? Zo(Z, t, r) : Promise.resolve({ isAdult: !0, confidence: "low" }), ae = Co(Z), qA = await PA;
|
|
12302
12302
|
if (!qA.isAdult) {
|
|
12303
12303
|
const Ie = qA.reasoning?.trim() || n("This photo appears to be of a minor. Please upload a photo of someone 18 or older.");
|
|
12304
12304
|
he(Ie);
|
|
@@ -12667,7 +12667,7 @@ function Or({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: B, o
|
|
|
12667
12667
|
GA && /* @__PURE__ */ A("div", { className: "ps-cpw-error", children: GA })
|
|
12668
12668
|
] }, "manual-identity"),
|
|
12669
12669
|
w === "manual" && l === "chest" && !yA && /* @__PURE__ */ e(
|
|
12670
|
-
|
|
12670
|
+
To,
|
|
12671
12671
|
{
|
|
12672
12672
|
stepKey: "chest",
|
|
12673
12673
|
title: n("CHEST PROFILE"),
|
|
@@ -12680,7 +12680,7 @@ function Or({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: B, o
|
|
|
12680
12680
|
}
|
|
12681
12681
|
),
|
|
12682
12682
|
w === "manual" && l === "stomach" && /* @__PURE__ */ e(
|
|
12683
|
-
|
|
12683
|
+
To,
|
|
12684
12684
|
{
|
|
12685
12685
|
stepKey: "stomach",
|
|
12686
12686
|
title: n("STOMACH PROFILE"),
|
|
@@ -12693,7 +12693,7 @@ function Or({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: B, o
|
|
|
12693
12693
|
}
|
|
12694
12694
|
),
|
|
12695
12695
|
w === "manual" && l === "seat" && /* @__PURE__ */ e(
|
|
12696
|
-
|
|
12696
|
+
To,
|
|
12697
12697
|
{
|
|
12698
12698
|
stepKey: "seat",
|
|
12699
12699
|
title: n("BACK & SEAT"),
|
|
@@ -12706,7 +12706,7 @@ function Or({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: B, o
|
|
|
12706
12706
|
}
|
|
12707
12707
|
),
|
|
12708
12708
|
w === "manual" && l === "hips" && yA && q.hips && /* @__PURE__ */ e(
|
|
12709
|
-
|
|
12709
|
+
To,
|
|
12710
12710
|
{
|
|
12711
12711
|
stepKey: "hips",
|
|
12712
12712
|
title: n("HIP PROFILE"),
|
|
@@ -14360,7 +14360,7 @@ function Qt({
|
|
|
14360
14360
|
] })
|
|
14361
14361
|
] });
|
|
14362
14362
|
}
|
|
14363
|
-
function
|
|
14363
|
+
function Xo({
|
|
14364
14364
|
stepNumber: o,
|
|
14365
14365
|
totalSteps: g,
|
|
14366
14366
|
title: t,
|
|
@@ -14576,7 +14576,7 @@ function si({
|
|
|
14576
14576
|
const Be = URL.createObjectURL(dA);
|
|
14577
14577
|
DA(Be);
|
|
14578
14578
|
try {
|
|
14579
|
-
const ue = D && m ?
|
|
14579
|
+
const ue = D && m ? Zo(dA, D, m) : Promise.resolve({ isAdult: !0, confidence: "low" }), We = Co(dA, { maxDimension: 1024, quality: 0.85 }), Ue = await ue;
|
|
14580
14580
|
if (!Ue.isAdult) {
|
|
14581
14581
|
const Ve = Ue.reasoning?.trim() || i("This photo appears to be of a minor. Please upload a photo of someone 18 or older.");
|
|
14582
14582
|
tA(Ve), DA(null), me(null);
|
|
@@ -15615,7 +15615,7 @@ function si({
|
|
|
15615
15615
|
] }, "step-basics");
|
|
15616
15616
|
})(),
|
|
15617
15617
|
E === "chest" && !t && (z ? /* @__PURE__ */ A(
|
|
15618
|
-
|
|
15618
|
+
Xo,
|
|
15619
15619
|
{
|
|
15620
15620
|
stepNumber: b.indexOf("chest") + 1,
|
|
15621
15621
|
totalSteps: b.length,
|
|
@@ -15640,7 +15640,7 @@ function si({
|
|
|
15640
15640
|
/* @__PURE__ */ A("p", { className: "ps-bp-hover-hint", children: yA || " " })
|
|
15641
15641
|
] }, "step-chest")),
|
|
15642
15642
|
E === "midsection" && (z ? /* @__PURE__ */ A(
|
|
15643
|
-
|
|
15643
|
+
Xo,
|
|
15644
15644
|
{
|
|
15645
15645
|
stepNumber: b.indexOf("midsection") + 1,
|
|
15646
15646
|
totalSteps: b.length,
|
|
@@ -15673,7 +15673,7 @@ function si({
|
|
|
15673
15673
|
/* @__PURE__ */ A("p", { className: "ps-bp-hover-hint", children: yA || " " })
|
|
15674
15674
|
] }, "step-midsection")),
|
|
15675
15675
|
E === "seat" && (z ? /* @__PURE__ */ A(
|
|
15676
|
-
|
|
15676
|
+
Xo,
|
|
15677
15677
|
{
|
|
15678
15678
|
stepNumber: b.indexOf("seat") + 1,
|
|
15679
15679
|
totalSteps: b.length,
|
|
@@ -15706,7 +15706,7 @@ function si({
|
|
|
15706
15706
|
/* @__PURE__ */ A("p", { className: "ps-bp-hover-hint", children: yA || " " })
|
|
15707
15707
|
] }, "step-seat")),
|
|
15708
15708
|
E === "hips" && t && (z ? /* @__PURE__ */ A(
|
|
15709
|
-
|
|
15709
|
+
Xo,
|
|
15710
15710
|
{
|
|
15711
15711
|
stepNumber: b.indexOf("hips") + 1,
|
|
15712
15712
|
totalSteps: b.length,
|
|
@@ -15864,7 +15864,7 @@ function vg({
|
|
|
15864
15864
|
const Qe = URL.createObjectURL(lA);
|
|
15865
15865
|
Ce(lA), ne(Qe), pA(!0), jA("Analyzing photo…");
|
|
15866
15866
|
try {
|
|
15867
|
-
const we = G && I ?
|
|
15867
|
+
const we = G && I ? Zo(lA, G, I) : Promise.resolve({ isAdult: !0, confidence: "low" }), Oe = Co(lA, W ? { maxDimension: 1536, quality: 0.85 } : {}), ZA = await we;
|
|
15868
15868
|
if (!ZA.isAdult) {
|
|
15869
15869
|
const re = ZA.reasoning?.trim() || d("This photo appears to be of a minor. Please upload a photo of someone 18 or older.");
|
|
15870
15870
|
MA(re), Ce(null), ne(null);
|
|
@@ -16528,7 +16528,7 @@ function vg({
|
|
|
16528
16528
|
] })
|
|
16529
16529
|
] }) }) });
|
|
16530
16530
|
}
|
|
16531
|
-
const
|
|
16531
|
+
const Wo = [
|
|
16532
16532
|
{
|
|
16533
16533
|
key: "footLengthCm",
|
|
16534
16534
|
label: "Foot Length",
|
|
@@ -16541,10 +16541,10 @@ const Xo = [
|
|
|
16541
16541
|
];
|
|
16542
16542
|
function ai(o) {
|
|
16543
16543
|
const g = o?.requiredFields;
|
|
16544
|
-
if (!g || g.length === 0) return
|
|
16544
|
+
if (!g || g.length === 0) return Wo;
|
|
16545
16545
|
const t = /* @__PURE__ */ new Set(["size", "country", "eu", "__skip__", "shoeEU", "shoeUS", "shoeUK", "shoeJP"]), r = (a, n) => {
|
|
16546
|
-
const w =
|
|
16547
|
-
return w ? w.placeholder : /foot|length/i.test(a) || /foot|length/i.test(n) ?
|
|
16546
|
+
const w = Wo.find((l) => l.key === a);
|
|
16547
|
+
return w ? w.placeholder : /foot|length/i.test(a) || /foot|length/i.test(n) ? Wo[0].placeholder : { cm: "", in: "" };
|
|
16548
16548
|
}, B = g.filter((a) => !t.has(a.key) && a.unit !== "size").map((a) => {
|
|
16549
16549
|
const n = r(a.key, a.label || "");
|
|
16550
16550
|
return {
|
|
@@ -16558,7 +16558,7 @@ function ai(o) {
|
|
|
16558
16558
|
step: 0.5
|
|
16559
16559
|
};
|
|
16560
16560
|
});
|
|
16561
|
-
return B.length > 0 ? B :
|
|
16561
|
+
return B.length > 0 ? B : Wo;
|
|
16562
16562
|
}
|
|
16563
16563
|
function Bi(o) {
|
|
16564
16564
|
const { sizeGuide: g, ...t } = o, r = ai(g);
|
|
@@ -16760,7 +16760,7 @@ function hi({
|
|
|
16760
16760
|
}, []), [JA, WA] = Q(!1), [fe, HA] = Q(null), [ke, p] = Q(null), Z = hA(null), PA = hA(() => !1), ae = hA(() => {
|
|
16761
16761
|
}), qA = bA((c, C) => {
|
|
16762
16762
|
PA.current = c, ae.current = C;
|
|
16763
|
-
}, []), xe = hA(null), Ie = hA(null), Le = hA(null), Xe = hA(null), k = hA(null), dA = hA(!1), Be = hA(null), ue = hA(null), [We, Ue] = Q(null), [sA, Ve] = Q(null), ze = hA(null), Oo = hA(null),
|
|
16763
|
+
}, []), xe = hA(null), Ie = hA(null), Le = hA(null), Xe = hA(null), k = hA(null), dA = hA(!1), Be = hA(null), ue = hA(null), [We, Ue] = Q(null), [sA, Ve] = Q(null), ze = hA(null), Oo = hA(null), Lo = hA(!1);
|
|
16764
16764
|
kA(() => {
|
|
16765
16765
|
try {
|
|
16766
16766
|
const c = Se(), C = je(s);
|
|
@@ -16771,11 +16771,11 @@ function hi({
|
|
|
16771
16771
|
Xe.current?.(), Le.current?.disconnect(), k.current && clearInterval(k.current);
|
|
16772
16772
|
};
|
|
16773
16773
|
}, [s]);
|
|
16774
|
-
const $o = 22,
|
|
16774
|
+
const $o = 22, zo = hA(0), Qo = hA(null), fo = hA(null), ho = hA(null), vo = hA(null), Eo = hA(null), _o = hA(null), Ag = hA(""), no = hA(null);
|
|
16775
16775
|
kA(() => {
|
|
16776
16776
|
if (oA === "processing") {
|
|
16777
16777
|
if (no.current) return;
|
|
16778
|
-
|
|
16778
|
+
zo.current = 0, _o.current = Date.now(), Ag.current = "";
|
|
16779
16779
|
const c = [
|
|
16780
16780
|
{ at: 0, text: J("Preparing your image...") },
|
|
16781
16781
|
{ at: 15, text: J("Analyzing body proportions...") },
|
|
@@ -16787,7 +16787,7 @@ function hi({
|
|
|
16787
16787
|
return no.current = setInterval(() => {
|
|
16788
16788
|
if (dA.current) return;
|
|
16789
16789
|
const U = _o.current || Date.now(), $ = (Date.now() - U) / 1e3, QA = Math.min(95, $ / $o * 100);
|
|
16790
|
-
|
|
16790
|
+
zo.current = QA;
|
|
16791
16791
|
const gA = Math.round(QA);
|
|
16792
16792
|
if (Qo.current && (Qo.current.style.width = `${gA}%`), fo.current && (fo.current.textContent = `${gA}%`), Eo.current) {
|
|
16793
16793
|
const Y = C * (1 - QA / 100);
|
|
@@ -17018,7 +17018,7 @@ function hi({
|
|
|
17018
17018
|
}
|
|
17019
17019
|
T(c), ze.current = c, Oo.current = null;
|
|
17020
17020
|
const C = URL.createObjectURL(c);
|
|
17021
|
-
pA(C), V?.(c), ue.current = null,
|
|
17021
|
+
pA(C), V?.(c), ue.current = null, Vo(C).then((U) => {
|
|
17022
17022
|
ue.current = U;
|
|
17023
17023
|
}).catch(() => {
|
|
17024
17024
|
});
|
|
@@ -17033,7 +17033,7 @@ function hi({
|
|
|
17033
17033
|
}
|
|
17034
17034
|
if (c.status === "completed" && c.imageUrl) {
|
|
17035
17035
|
if (jA((C) => !C || C.startsWith("data:") || !c.imageUrl.startsWith("data:") ? c.imageUrl : C), !dA.current) {
|
|
17036
|
-
if (dA.current = !0,
|
|
17036
|
+
if (dA.current = !0, zo.current = 100, Qo.current && (Qo.current.style.width = "100%"), fo.current && (fo.current.textContent = "100%"), Eo.current && (Eo.current.style.strokeDashoffset = "0"), vo.current && (vo.current.textContent = J("Done")), ho.current) {
|
|
17037
17037
|
const C = ho.current;
|
|
17038
17038
|
C.style.opacity = "0", setTimeout(() => {
|
|
17039
17039
|
C.textContent = J("Complete!"), C.style.opacity = "1";
|
|
@@ -17255,7 +17255,7 @@ function hi({
|
|
|
17255
17255
|
lA(!1);
|
|
17256
17256
|
return;
|
|
17257
17257
|
}
|
|
17258
|
-
ue.current = null, Ue(null),
|
|
17258
|
+
ue.current = null, Ue(null), Vo($).then((fA) => (ue.current = fA, fA)).catch(() => null);
|
|
17259
17259
|
const gA = ao($).then((fA) => (Ue(fA), fA)).catch(() => null), Y = 8e3, R = await Promise.race([
|
|
17260
17260
|
gA,
|
|
17261
17261
|
new Promise((fA) => setTimeout(() => fA(null), Y))
|
|
@@ -17352,7 +17352,7 @@ function hi({
|
|
|
17352
17352
|
}
|
|
17353
17353
|
c && c !== GA && (T(c), ze.current = c), dA.current = !1, ZA(!0), ee(Date.now());
|
|
17354
17354
|
const U = fi(so(r)), $ = U === "apparel", QA = (c ? null : _) || URL.createObjectURL(C);
|
|
17355
|
-
(c || !_) && pA(QA), $ && (!ue.current || !We) && (ue.current = null, Ue(null),
|
|
17355
|
+
(c || !_) && pA(QA), $ && (!ue.current || !We) && (ue.current = null, Ue(null), Vo(QA).then((gA) => {
|
|
17356
17356
|
ue.current = gA;
|
|
17357
17357
|
}).catch(() => {
|
|
17358
17358
|
}), ao(QA).then((gA) => {
|
|
@@ -17362,11 +17362,11 @@ function hi({
|
|
|
17362
17362
|
try {
|
|
17363
17363
|
const gA = await Co(C, $ ? { maxDimension: 1024, quality: 0.85 } : {}), Y = iA.current, R = Object.keys(Y), rA = R.length > 0, KA = rA ? (() => {
|
|
17364
17364
|
const pe = /* @__PURE__ */ new Set(), qe = [];
|
|
17365
|
-
for (const
|
|
17366
|
-
const Je = Y[
|
|
17365
|
+
for (const No of R) {
|
|
17366
|
+
const Je = Y[No]?.matchDetails || [];
|
|
17367
17367
|
for (const wo of Je) {
|
|
17368
|
-
const
|
|
17369
|
-
pe.has(
|
|
17368
|
+
const Uo = wo.measurement.toLowerCase().trim();
|
|
17369
|
+
pe.has(Uo) || (pe.add(Uo), qe.push(wo));
|
|
17370
17370
|
}
|
|
17371
17371
|
}
|
|
17372
17372
|
return qe;
|
|
@@ -17385,18 +17385,18 @@ function hi({
|
|
|
17385
17385
|
const SA = () => {
|
|
17386
17386
|
const pe = /* @__PURE__ */ new Set(), qe = [];
|
|
17387
17387
|
console.log("[ps-sdk:flatten] sizingResult keys:", Object.keys(DA || {})), console.log("[ps-sdk:flatten] root matchDetails:", (DA?.matchDetails || []).map((Je) => Je.measurement)), console.log("[ps-sdk:flatten] sections:", DA?.sections ? Object.keys(DA.sections) : "none");
|
|
17388
|
-
const
|
|
17388
|
+
const No = (Je, wo, Uo) => {
|
|
17389
17389
|
if (Je) {
|
|
17390
|
-
console.log(`[ps-sdk:flatten] ${wo} →`, Je.map((
|
|
17391
|
-
for (const
|
|
17392
|
-
const bg =
|
|
17393
|
-
pe.has(bg) || (pe.add(bg), qe.push({ ...
|
|
17390
|
+
console.log(`[ps-sdk:flatten] ${wo} →`, Je.map((Jo) => Jo.measurement));
|
|
17391
|
+
for (const Jo of Je) {
|
|
17392
|
+
const bg = Jo.measurement.toLowerCase().replace(/\s*\(.*?\)\s*/g, "").trim();
|
|
17393
|
+
pe.has(bg) || (pe.add(bg), qe.push({ ...Jo, section: Uo }));
|
|
17394
17394
|
}
|
|
17395
17395
|
}
|
|
17396
17396
|
};
|
|
17397
|
-
if (
|
|
17397
|
+
if (No(DA?.matchDetails, "root", void 0), DA?.sections)
|
|
17398
17398
|
for (const [Je, wo] of Object.entries(DA.sections))
|
|
17399
|
-
|
|
17399
|
+
No(wo?.matchDetails, `section:${Je}`, Je);
|
|
17400
17400
|
return console.log("[ps-sdk:flatten] final unique:", qe.map((Je) => Je.measurement)), qe;
|
|
17401
17401
|
}, te = VA?.matchDetails && VA.matchDetails.length ? VA.matchDetails : SA();
|
|
17402
17402
|
let aA;
|
|
@@ -17450,10 +17450,10 @@ function hi({
|
|
|
17450
17450
|
}, [GA, o, r, DA, i, E, tg]);
|
|
17451
17451
|
kA(() => {
|
|
17452
17452
|
if (!DA) {
|
|
17453
|
-
|
|
17453
|
+
Lo.current = !1;
|
|
17454
17454
|
return;
|
|
17455
17455
|
}
|
|
17456
|
-
DA.found !== !1 && (LA.current ||
|
|
17456
|
+
DA.found !== !1 && (LA.current || Lo.current || Oe || nA || !GA && !ze.current || (Lo.current = !0, Po()));
|
|
17457
17457
|
}, [DA, Oe, nA, GA, Po]);
|
|
17458
17458
|
const xt = bA(() => {
|
|
17459
17459
|
if (nA)
|
|
@@ -17603,7 +17603,7 @@ function hi({
|
|
|
17603
17603
|
})) : (oA === "welcome" || oA === "body-profile") && (io.current = !1, bo.current = !1);
|
|
17604
17604
|
}, [oA, DA, nA]);
|
|
17605
17605
|
const yt = bA((c) => {
|
|
17606
|
-
if (io.current = !0, bo.current = !!c.resultImageUrl, c.sizingResult ? mA(c.sizingResult) : c.recommendedSize && mA({
|
|
17606
|
+
if (io.current = !0, bo.current = !!c.resultImageUrl, Lo.current = !0, c.sizingResult ? mA(c.sizingResult) : c.recommendedSize && mA({
|
|
17607
17607
|
recommendedSize: c.recommendedSize,
|
|
17608
17608
|
confidence: c.confidence || "high",
|
|
17609
17609
|
reasoning: c.reasoning || "",
|
|
@@ -17835,7 +17835,7 @@ function hi({
|
|
|
17835
17835
|
lr,
|
|
17836
17836
|
{
|
|
17837
17837
|
previewUrl: _,
|
|
17838
|
-
progressRef:
|
|
17838
|
+
progressRef: zo,
|
|
17839
17839
|
progressBarRef: Qo,
|
|
17840
17840
|
progressTextRef: fo,
|
|
17841
17841
|
progressStatusRef: ho,
|