xactsize-webcomponents 1.0.22 → 1.0.25
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/body-measurer.es.js +135 -65
- package/dist/body-measurer.umd.js +138 -68
- package/package.json +1 -1
package/dist/body-measurer.es.js
CHANGED
|
@@ -16,7 +16,7 @@ const wA = (l, A, t) => {
|
|
|
16
16
|
* Copyright 2019 Google LLC
|
|
17
17
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
18
18
|
*/
|
|
19
|
-
const B = globalThis,
|
|
19
|
+
const B = globalThis, yA = B.ShadowRoot && (B.ShadyCSS === void 0 || B.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, uA = Symbol(), TA = /* @__PURE__ */ new WeakMap();
|
|
20
20
|
let ZA = class {
|
|
21
21
|
constructor(A, t, r) {
|
|
22
22
|
if (this._$cssResult$ = !0, r !== uA) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
@@ -25,7 +25,7 @@ let ZA = class {
|
|
|
25
25
|
get styleSheet() {
|
|
26
26
|
let A = this.o;
|
|
27
27
|
const t = this.t;
|
|
28
|
-
if (
|
|
28
|
+
if (yA && A === void 0) {
|
|
29
29
|
const r = t !== void 0 && t.length === 1;
|
|
30
30
|
r && (A = TA.get(t)), A === void 0 && ((this.o = A = new CSSStyleSheet()).replaceSync(this.cssText), r && TA.set(t, A));
|
|
31
31
|
}
|
|
@@ -43,12 +43,12 @@ const CA = (l) => new ZA(typeof l == "string" ? l : l + "", void 0, uA), N = (l,
|
|
|
43
43
|
})(e) + l[p + 1], l[0]);
|
|
44
44
|
return new ZA(t, l, uA);
|
|
45
45
|
}, YA = (l, A) => {
|
|
46
|
-
if (
|
|
46
|
+
if (yA) l.adoptedStyleSheets = A.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
|
|
47
47
|
else for (const t of A) {
|
|
48
48
|
const r = document.createElement("style"), e = B.litNonce;
|
|
49
49
|
e !== void 0 && r.setAttribute("nonce", e), r.textContent = t.cssText, l.appendChild(r);
|
|
50
50
|
}
|
|
51
|
-
}, XA =
|
|
51
|
+
}, XA = yA ? (l) => l : (l) => l instanceof CSSStyleSheet ? ((A) => {
|
|
52
52
|
let t = "";
|
|
53
53
|
for (const r of A.cssRules) t += r.cssText;
|
|
54
54
|
return CA(t);
|
|
@@ -307,10 +307,10 @@ const rt = (l, A) => {
|
|
|
307
307
|
let e, p = A === 2 ? "<svg>" : A === 3 ? "<math>" : "", V = H;
|
|
308
308
|
for (let S = 0; S < t; S++) {
|
|
309
309
|
const q = l[S];
|
|
310
|
-
let u, k,
|
|
311
|
-
for (; x < q.length && (V.lastIndex = x, k = V.exec(q), k !== null); ) x = V.lastIndex, V === H ? k[1] === "!--" ? V = KA : k[1] !== void 0 ? V = UA : k[2] !== void 0 ? (HA.test(k[2]) && (e = RegExp("</" + k[2], "g")), V = W) : k[3] !== void 0 && (V = W) : V === W ? k[0] === ">" ? (V = e ?? H,
|
|
310
|
+
let u, k, d = -1, x = 0;
|
|
311
|
+
for (; x < q.length && (V.lastIndex = x, k = V.exec(q), k !== null); ) x = V.lastIndex, V === H ? k[1] === "!--" ? V = KA : k[1] !== void 0 ? V = UA : k[2] !== void 0 ? (HA.test(k[2]) && (e = RegExp("</" + k[2], "g")), V = W) : k[3] !== void 0 && (V = W) : V === W ? k[0] === ">" ? (V = e ?? H, d = -1) : k[1] === void 0 ? d = -2 : (d = V.lastIndex - k[2].length, u = k[1], V = k[3] === void 0 ? W : k[3] === '"' ? vA : WA) : V === vA || V === WA ? V = W : V === KA || V === UA ? V = H : (V = W, e = void 0);
|
|
312
312
|
const s = V === W && l[S + 1].startsWith("/>") ? " " : "";
|
|
313
|
-
p += V === H ? q + tt :
|
|
313
|
+
p += V === H ? q + tt : d >= 0 ? (r.push(u), q.slice(0, d) + NA + q.slice(d) + K + s) : q + K + (d === -2 ? S : s);
|
|
314
314
|
}
|
|
315
315
|
return [zA(l, p + (l[t] || "<?>") + (A === 2 ? "</svg>" : A === 3 ? "</math>" : "")), r];
|
|
316
316
|
};
|
|
@@ -321,27 +321,27 @@ class h {
|
|
|
321
321
|
let p = 0, V = 0;
|
|
322
322
|
const S = A.length - 1, q = this.parts, [u, k] = rt(A, t);
|
|
323
323
|
if (this.el = h.createElement(u, r), O.currentNode = this.el.content, t === 2 || t === 3) {
|
|
324
|
-
const
|
|
325
|
-
|
|
324
|
+
const d = this.el.content.firstChild;
|
|
325
|
+
d.replaceWith(...d.childNodes);
|
|
326
326
|
}
|
|
327
327
|
for (; (e = O.nextNode()) !== null && q.length < S; ) {
|
|
328
328
|
if (e.nodeType === 1) {
|
|
329
|
-
if (e.hasAttributes()) for (const
|
|
330
|
-
const x = k[V++], s = e.getAttribute(
|
|
331
|
-
q.push({ type: 1, index: p, name: Q[2], strings: s, ctor: Q[1] === "." ? Vt : Q[1] === "?" ? nt : Q[1] === "@" ? qt : lA }), e.removeAttribute(
|
|
332
|
-
} else
|
|
329
|
+
if (e.hasAttributes()) for (const d of e.getAttributeNames()) if (d.endsWith(NA)) {
|
|
330
|
+
const x = k[V++], s = e.getAttribute(d).split(K), Q = /([.?@])?(.*)/.exec(x);
|
|
331
|
+
q.push({ type: 1, index: p, name: Q[2], strings: s, ctor: Q[1] === "." ? Vt : Q[1] === "?" ? nt : Q[1] === "@" ? qt : lA }), e.removeAttribute(d);
|
|
332
|
+
} else d.startsWith(K) && (q.push({ type: 6, index: p }), e.removeAttribute(d));
|
|
333
333
|
if (HA.test(e.tagName)) {
|
|
334
|
-
const
|
|
334
|
+
const d = e.textContent.split(K), x = d.length - 1;
|
|
335
335
|
if (x > 0) {
|
|
336
336
|
e.textContent = $ ? $.emptyScript : "";
|
|
337
|
-
for (let s = 0; s < x; s++) e.append(
|
|
338
|
-
e.append(
|
|
337
|
+
for (let s = 0; s < x; s++) e.append(d[s], F()), O.nextNode(), q.push({ type: 2, index: ++p });
|
|
338
|
+
e.append(d[x], F());
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
341
|
} else if (e.nodeType === 8) if (e.data === RA) q.push({ type: 2, index: p });
|
|
342
342
|
else {
|
|
343
|
-
let
|
|
344
|
-
for (; (
|
|
343
|
+
let d = -1;
|
|
344
|
+
for (; (d = e.data.indexOf(K, d + 1)) !== -1; ) q.push({ type: 7, index: p }), d += K.length - 1;
|
|
345
345
|
}
|
|
346
346
|
p++;
|
|
347
347
|
}
|
|
@@ -577,7 +577,7 @@ const R = (l) => (A, t) => {
|
|
|
577
577
|
* Copyright 2017 Google LLC
|
|
578
578
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
579
579
|
*/
|
|
580
|
-
const
|
|
580
|
+
const dt = { attribute: !0, type: String, converter: _, reflect: !1, hasChanged: jA }, yt = (l = dt, A, t) => {
|
|
581
581
|
const { kind: r, metadata: e } = t;
|
|
582
582
|
let p = globalThis.litPropertyMetadata.get(e);
|
|
583
583
|
if (p === void 0 && globalThis.litPropertyMetadata.set(e, p = /* @__PURE__ */ new Map()), r === "setter" && ((l = Object.create(l)).wrapped = !0), p.set(t.name, l), r === "accessor") {
|
|
@@ -599,7 +599,7 @@ const yt = { attribute: !0, type: String, converter: _, reflect: !1, hasChanged:
|
|
|
599
599
|
throw Error("Unsupported decorator location: " + r);
|
|
600
600
|
};
|
|
601
601
|
function j(l) {
|
|
602
|
-
return (A, t) => typeof t == "object" ?
|
|
602
|
+
return (A, t) => typeof t == "object" ? yt(l, A, t) : ((r, e, p) => {
|
|
603
603
|
const V = e.hasOwnProperty(p);
|
|
604
604
|
return e.constructor.createProperty(p, r), V ? Object.getOwnPropertyDescriptor(e, p) : void 0;
|
|
605
605
|
})(l, A, t);
|
|
@@ -1201,55 +1201,125 @@ E.styles = N`
|
|
|
1201
1201
|
margin: 0 auto;
|
|
1202
1202
|
}
|
|
1203
1203
|
|
|
1204
|
+
/* Ajuste da responsividade para mobile */
|
|
1204
1205
|
@media (max-width: 754px) {
|
|
1205
1206
|
.main-section {
|
|
1206
1207
|
flex-direction: column;
|
|
1207
|
-
gap:
|
|
1208
|
+
gap: 5px; /* menor gap */
|
|
1209
|
+
align-items: center;
|
|
1208
1210
|
}
|
|
1209
1211
|
|
|
1210
1212
|
.images-section {
|
|
1211
|
-
order: -1;
|
|
1212
|
-
|
|
1213
|
-
margin-bottom: 8px;
|
|
1213
|
+
order: -1;
|
|
1214
|
+
width: 100%;
|
|
1214
1215
|
}
|
|
1215
1216
|
|
|
1216
1217
|
.images-section svg {
|
|
1217
|
-
width: 80%;
|
|
1218
|
-
max-width:
|
|
1218
|
+
width: 80%; /* reduzir para não quebrar botão */
|
|
1219
|
+
max-width: 180px; /* altura menor */
|
|
1219
1220
|
height: auto;
|
|
1220
|
-
margin-bottom: 8px;
|
|
1221
1221
|
}
|
|
1222
1222
|
|
|
1223
1223
|
.tips-section {
|
|
1224
1224
|
width: 100%;
|
|
1225
|
-
gap:
|
|
1225
|
+
gap: 6px;
|
|
1226
|
+
align-items: flex-start; /* alinhar à esquerda */
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
form {
|
|
1230
|
+
align-items: flex-start; /* alinhar labels e inputs à esquerda */
|
|
1231
|
+
width: 100%;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
input {
|
|
1235
|
+
max-width: 100%;
|
|
1236
|
+
font-size: 14px;
|
|
1237
|
+
padding: 10px;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
label {
|
|
1241
|
+
text-align: left;
|
|
1242
|
+
font-size: 14px;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
.xact-button {
|
|
1246
|
+
max-width: 100%;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
.header-text {
|
|
1250
|
+
font-size: 20px;
|
|
1251
|
+
text-align: center;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
.description-text {
|
|
1255
|
+
font-size: 14px;
|
|
1256
|
+
text-align: center;
|
|
1226
1257
|
}
|
|
1227
1258
|
|
|
1228
1259
|
.tip-title {
|
|
1229
1260
|
font-size: 12px;
|
|
1230
|
-
|
|
1261
|
+
text-align: left;
|
|
1231
1262
|
}
|
|
1232
1263
|
|
|
1233
1264
|
.tip-text {
|
|
1234
|
-
font-size:
|
|
1235
|
-
|
|
1265
|
+
font-size: 11px;
|
|
1266
|
+
text-align: left;
|
|
1267
|
+
margin-left: 0; /* remove centralização */
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
.tip-item {
|
|
1271
|
+
margin-bottom: 6px;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
.buttons {
|
|
1275
|
+
gap: 8px;
|
|
1276
|
+
width: 100%;
|
|
1277
|
+
max-width: 100%;
|
|
1278
|
+
margin-top: 12px;
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
/* Ajuste fino para iPhones muito pequenos */
|
|
1283
|
+
@media (max-width: 380px) {
|
|
1284
|
+
:host {
|
|
1285
|
+
padding: 12px;
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
.images-section svg {
|
|
1289
|
+
max-width: 150px;
|
|
1236
1290
|
}
|
|
1237
1291
|
|
|
1238
1292
|
.header-text {
|
|
1239
|
-
font-size:
|
|
1293
|
+
font-size: 18px;
|
|
1240
1294
|
}
|
|
1241
1295
|
|
|
1242
1296
|
.description-text {
|
|
1243
|
-
font-size:
|
|
1244
|
-
|
|
1297
|
+
font-size: 13px;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
.tip-title {
|
|
1301
|
+
font-size: 11px;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
.tip-text {
|
|
1305
|
+
font-size: 10px;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
.tip-item {
|
|
1309
|
+
margin-bottom: 4px;
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
.xact-button {
|
|
1313
|
+
padding: 8px;
|
|
1245
1314
|
}
|
|
1246
1315
|
|
|
1247
1316
|
.buttons {
|
|
1248
|
-
gap:
|
|
1249
|
-
max-width: 180px;
|
|
1317
|
+
gap: 6px;
|
|
1250
1318
|
}
|
|
1251
|
-
|
|
1252
1319
|
}
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
|
|
1253
1323
|
`;
|
|
1254
1324
|
kA([
|
|
1255
1325
|
j({ type: Number })
|
|
@@ -1266,7 +1336,7 @@ var Ht = Object.getOwnPropertyDescriptor, zt = (l, A, t, r) => {
|
|
|
1266
1336
|
(V = l[p]) && (e = V(e) || e);
|
|
1267
1337
|
return e;
|
|
1268
1338
|
};
|
|
1269
|
-
let
|
|
1339
|
+
let dA = class extends X {
|
|
1270
1340
|
render() {
|
|
1271
1341
|
return T`
|
|
1272
1342
|
<footer class="modal-footer">
|
|
@@ -1314,7 +1384,7 @@ let yA = class extends X {
|
|
|
1314
1384
|
`;
|
|
1315
1385
|
}
|
|
1316
1386
|
};
|
|
1317
|
-
|
|
1387
|
+
dA.styles = N`
|
|
1318
1388
|
.modal-footer {
|
|
1319
1389
|
text-align: center;
|
|
1320
1390
|
font-size: 12px;
|
|
@@ -1351,10 +1421,10 @@ yA.styles = N`
|
|
|
1351
1421
|
outline-offset: 2px;
|
|
1352
1422
|
}
|
|
1353
1423
|
`;
|
|
1354
|
-
|
|
1424
|
+
dA = zt([
|
|
1355
1425
|
R("xact-footer"),
|
|
1356
1426
|
C()
|
|
1357
|
-
],
|
|
1427
|
+
], dA);
|
|
1358
1428
|
var Gt = Object.defineProperty, Ft = Object.getOwnPropertyDescriptor, D = (l, A, t, r) => {
|
|
1359
1429
|
for (var e = r > 1 ? void 0 : r ? Ft(A, t) : A, p = l.length - 1, V; p >= 0; p--)
|
|
1360
1430
|
(V = l[p]) && (e = (r ? V(A, t, e) : V(e)) || e);
|
|
@@ -1821,7 +1891,7 @@ I = JA([
|
|
|
1821
1891
|
C()
|
|
1822
1892
|
], I);
|
|
1823
1893
|
const oA = "data:image/svg+xml,%3csvg%20width='22'%20height='40'%20viewBox='0%200%2022%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.517%200L0%2013.3362V0H21.517Z'%20fill='white'/%3e%3cpath%20d='M21.517%2013.339L0%2026.6724V13.3362H21.517V13.339Z'%20fill='white'/%3e%3cpath%20d='M21.517%2026.6755L0%2040.0089V26.6726H21.517V26.6755Z'%20fill='%231C28BA'/%3e%3c/svg%3e", Et = "data:image/svg+xml,%3csvg%20width='22'%20height='41'%20viewBox='0%200%2022%2041'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.517%200.00878906L0%2013.345V0.00878906H21.517Z'%20fill='white'/%3e%3cpath%20d='M21.517%2013.3478L0%2026.6812V13.345H21.517V13.3478Z'%20fill='%231C28BA'/%3e%3cpath%20d='M21.517%2026.6843L0%2040.0176V26.6814H21.517V26.6843Z'%20fill='white'/%3e%3c/svg%3e", It = "data:image/svg+xml,%3csvg%20width='22'%20height='41'%20viewBox='0%200%2022%2041'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.517%200.0204381L0%2013.3538V0.0175781H21.517V0.0204381Z'%20fill='%231C28BA'/%3e%3cpath%20d='M21.517%2013.3538L0%2026.69V13.3538H21.517Z'%20fill='white'/%3e%3cpath%20d='M21.517%2026.693L0%2040.0264V26.6902H21.517V26.693Z'%20fill='white'/%3e%3c/svg%3e";
|
|
1824
|
-
var wt = Object.defineProperty, Ct = Object.getOwnPropertyDescriptor,
|
|
1894
|
+
var wt = Object.defineProperty, Ct = Object.getOwnPropertyDescriptor, y = (l, A, t, r) => {
|
|
1825
1895
|
for (var e = r > 1 ? void 0 : r ? Ct(A, t) : A, p = l.length - 1, V; p >= 0; p--)
|
|
1826
1896
|
(V = l[p]) && (e = (r ? V(A, t, e) : V(e)) || e);
|
|
1827
1897
|
return r && e && wt(A, t, e), e;
|
|
@@ -2507,73 +2577,73 @@ a.styles = N`
|
|
|
2507
2577
|
|
|
2508
2578
|
|
|
2509
2579
|
`;
|
|
2510
|
-
|
|
2580
|
+
y([
|
|
2511
2581
|
j({ type: String, attribute: "api-key" })
|
|
2512
2582
|
], a.prototype, "apiKey", 2);
|
|
2513
|
-
|
|
2583
|
+
y([
|
|
2514
2584
|
j({ type: String, attribute: "tenant-id" })
|
|
2515
2585
|
], a.prototype, "tenantId", 2);
|
|
2516
|
-
|
|
2586
|
+
y([
|
|
2517
2587
|
j({ type: String, attribute: "product-sku" })
|
|
2518
2588
|
], a.prototype, "productSku", 2);
|
|
2519
|
-
|
|
2589
|
+
y([
|
|
2520
2590
|
j({ type: String, attribute: "api-url" })
|
|
2521
2591
|
], a.prototype, "apiUrl", 2);
|
|
2522
|
-
|
|
2592
|
+
y([
|
|
2523
2593
|
j({ type: Function, attribute: "onmeasurementaccepted" })
|
|
2524
2594
|
], a.prototype, "onMeasurementAccepted", 2);
|
|
2525
|
-
|
|
2595
|
+
y([
|
|
2526
2596
|
j({ type: Function, attribute: "onmeasurementcanceled" })
|
|
2527
2597
|
], a.prototype, "onMeasurementCanceled", 2);
|
|
2528
|
-
|
|
2598
|
+
y([
|
|
2529
2599
|
j({ type: String })
|
|
2530
2600
|
], a.prototype, "culture", 1);
|
|
2531
|
-
|
|
2601
|
+
y([
|
|
2532
2602
|
J()
|
|
2533
2603
|
], a.prototype, "errorMap", 1);
|
|
2534
|
-
|
|
2604
|
+
y([
|
|
2535
2605
|
J()
|
|
2536
2606
|
], a.prototype, "measurerKey", 2);
|
|
2537
|
-
|
|
2607
|
+
y([
|
|
2538
2608
|
J()
|
|
2539
2609
|
], a.prototype, "_isLocaleLoading", 2);
|
|
2540
|
-
|
|
2610
|
+
y([
|
|
2541
2611
|
J()
|
|
2542
2612
|
], a.prototype, "showModal", 2);
|
|
2543
|
-
|
|
2613
|
+
y([
|
|
2544
2614
|
J()
|
|
2545
2615
|
], a.prototype, "step", 2);
|
|
2546
|
-
|
|
2616
|
+
y([
|
|
2547
2617
|
J()
|
|
2548
2618
|
], a.prototype, "height", 2);
|
|
2549
|
-
|
|
2619
|
+
y([
|
|
2550
2620
|
J()
|
|
2551
2621
|
], a.prototype, "recommendedSize", 2);
|
|
2552
|
-
|
|
2622
|
+
y([
|
|
2553
2623
|
J()
|
|
2554
2624
|
], a.prototype, "measurements", 2);
|
|
2555
|
-
|
|
2625
|
+
y([
|
|
2556
2626
|
J()
|
|
2557
2627
|
], a.prototype, "errorMessage", 2);
|
|
2558
|
-
|
|
2628
|
+
y([
|
|
2559
2629
|
J()
|
|
2560
2630
|
], a.prototype, "instructionMessage", 2);
|
|
2561
|
-
|
|
2631
|
+
y([
|
|
2562
2632
|
J()
|
|
2563
2633
|
], a.prototype, "shouldStartMeasurement", 2);
|
|
2564
|
-
|
|
2634
|
+
y([
|
|
2565
2635
|
J()
|
|
2566
2636
|
], a.prototype, "isLoading", 2);
|
|
2567
|
-
|
|
2637
|
+
y([
|
|
2568
2638
|
J()
|
|
2569
2639
|
], a.prototype, "isFetching", 2);
|
|
2570
|
-
|
|
2640
|
+
y([
|
|
2571
2641
|
J()
|
|
2572
2642
|
], a.prototype, "cameras", 2);
|
|
2573
|
-
|
|
2643
|
+
y([
|
|
2574
2644
|
J()
|
|
2575
2645
|
], a.prototype, "currentCameraId", 2);
|
|
2576
|
-
a =
|
|
2646
|
+
a = y([
|
|
2577
2647
|
R("body-measurer"),
|
|
2578
2648
|
C()
|
|
2579
2649
|
], a);
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const g=globalThis,rA=g.ShadowRoot&&(g.ShadyCSS===void 0||g.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,pA=Symbol(),sA=new WeakMap;let iA=class{constructor(A,t,l){if(this._$cssResult$=!0,l!==pA)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=A,this.t=t}get styleSheet(){let A=this.o;const t=this.t;if(rA&&A===void 0){const l=t!==void 0&&t.length===1;l&&(A=sA.get(t)),A===void 0&&((this.o=A=new CSSStyleSheet).replaceSync(this.cssText),l&&sA.set(t,A))}return A}toString(){return this.cssText}};const CA=r=>new iA(typeof r=="string"?r:r+"",void 0,pA),m=(r,...A)=>{const t=r.length===1?r[0]:A.reduce((l,e,p)=>l+(
|
|
5
|
+
*/const g=globalThis,rA=g.ShadowRoot&&(g.ShadyCSS===void 0||g.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,pA=Symbol(),sA=new WeakMap;let iA=class{constructor(A,t,l){if(this._$cssResult$=!0,l!==pA)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=A,this.t=t}get styleSheet(){let A=this.o;const t=this.t;if(rA&&A===void 0){const l=t!==void 0&&t.length===1;l&&(A=sA.get(t)),A===void 0&&((this.o=A=new CSSStyleSheet).replaceSync(this.cssText),l&&sA.set(t,A))}return A}toString(){return this.cssText}};const CA=r=>new iA(typeof r=="string"?r:r+"",void 0,pA),m=(r,...A)=>{const t=r.length===1?r[0]:A.reduce((l,e,p)=>l+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(e)+r[p+1],r[0]);return new iA(t,r,pA)},YA=(r,A)=>{if(rA)r.adoptedStyleSheets=A.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of A){const l=document.createElement("style"),e=g.litNonce;e!==void 0&&l.setAttribute("nonce",e),l.textContent=t.cssText,r.appendChild(l)}},xA=rA?r=>r:r=>r instanceof CSSStyleSheet?(A=>{let t="";for(const l of A.cssRules)t+=l.cssText;return CA(t)})(r):r;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:DA,defineProperty:QA,getOwnPropertyDescriptor:gA,getOwnPropertyNames:BA,getOwnPropertySymbols:_A,getPrototypeOf:$A}=Object,x=globalThis,KA=x.trustedTypes,At=KA?KA.emptyScript:"",
|
|
9
|
+
*/const{is:DA,defineProperty:QA,getOwnPropertyDescriptor:gA,getOwnPropertyNames:BA,getOwnPropertySymbols:_A,getPrototypeOf:$A}=Object,x=globalThis,KA=x.trustedTypes,At=KA?KA.emptyScript:"",nA=x.reactiveElementPolyfillSupport,z=(r,A)=>r,B={toAttribute(r,A){switch(A){case Boolean:r=r?At:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,A){let t=r;switch(A){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},VA=(r,A)=>!DA(r,A),UA={attribute:!0,type:String,converter:B,reflect:!1,useDefault:!1,hasChanged:VA};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),x.litPropertyMetadata??(x.litPropertyMetadata=new WeakMap);let Z=class extends HTMLElement{static addInitializer(A){this._$Ei(),(this.l??(this.l=[])).push(A)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(A,t=UA){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(A)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(A,t),!t.noAccessor){const l=Symbol(),e=this.getPropertyDescriptor(A,l,t);e!==void 0&&QA(this.prototype,A,e)}}static getPropertyDescriptor(A,t,l){const{get:e,set:p}=gA(this.prototype,A)??{get(){return this[t]},set(n){this[t]=n}};return{get:e,set(n){const S=e==null?void 0:e.call(this);p==null||p.call(this,n),this.requestUpdate(A,S,l)},configurable:!0,enumerable:!0}}static getPropertyOptions(A){return this.elementProperties.get(A)??UA}static _$Ei(){if(this.hasOwnProperty(z("elementProperties")))return;const A=$A(this);A.finalize(),A.l!==void 0&&(this.l=[...A.l]),this.elementProperties=new Map(A.elementProperties)}static finalize(){if(this.hasOwnProperty(z("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(z("properties"))){const t=this.properties,l=[...BA(t),..._A(t)];for(const e of l)this.createProperty(e,t[e])}const A=this[Symbol.metadata];if(A!==null){const t=litPropertyMetadata.get(A);if(t!==void 0)for(const[l,e]of t)this.elementProperties.set(l,e)}this._$Eh=new Map;for(const[t,l]of this.elementProperties){const e=this._$Eu(t,l);e!==void 0&&this._$Eh.set(e,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(A){const t=[];if(Array.isArray(A)){const l=new Set(A.flat(1/0).reverse());for(const e of l)t.unshift(xA(e))}else A!==void 0&&t.push(xA(A));return t}static _$Eu(A,t){const l=t.attribute;return l===!1?void 0:typeof l=="string"?l:typeof A=="string"?A.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var A;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(A=this.constructor.l)==null||A.forEach(t=>t(this))}addController(A){var t;(this._$EO??(this._$EO=new Set)).add(A),this.renderRoot!==void 0&&this.isConnected&&((t=A.hostConnected)==null||t.call(A))}removeController(A){var t;(t=this._$EO)==null||t.delete(A)}_$E_(){const A=new Map,t=this.constructor.elementProperties;for(const l of t.keys())this.hasOwnProperty(l)&&(A.set(l,this[l]),delete this[l]);A.size>0&&(this._$Ep=A)}createRenderRoot(){const A=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return YA(A,this.constructor.elementStyles),A}connectedCallback(){var A;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(A=this._$EO)==null||A.forEach(t=>{var l;return(l=t.hostConnected)==null?void 0:l.call(t)})}enableUpdating(A){}disconnectedCallback(){var A;(A=this._$EO)==null||A.forEach(t=>{var l;return(l=t.hostDisconnected)==null?void 0:l.call(t)})}attributeChangedCallback(A,t,l){this._$AK(A,l)}_$ET(A,t){var p;const l=this.constructor.elementProperties.get(A),e=this.constructor._$Eu(A,l);if(e!==void 0&&l.reflect===!0){const n=(((p=l.converter)==null?void 0:p.toAttribute)!==void 0?l.converter:B).toAttribute(t,l.type);this._$Em=A,n==null?this.removeAttribute(e):this.setAttribute(e,n),this._$Em=null}}_$AK(A,t){var p,n;const l=this.constructor,e=l._$Eh.get(A);if(e!==void 0&&this._$Em!==e){const S=l.getPropertyOptions(e),q=typeof S.converter=="function"?{fromAttribute:S.converter}:((p=S.converter)==null?void 0:p.fromAttribute)!==void 0?S.converter:B;this._$Em=e,this[e]=q.fromAttribute(t,S.type)??((n=this._$Ej)==null?void 0:n.get(e))??null,this._$Em=null}}requestUpdate(A,t,l){var e;if(A!==void 0){const p=this.constructor,n=this[A];if(l??(l=p.getPropertyOptions(A)),!((l.hasChanged??VA)(n,t)||l.useDefault&&l.reflect&&n===((e=this._$Ej)==null?void 0:e.get(A))&&!this.hasAttribute(p._$Eu(A,l))))return;this.C(A,t,l)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(A,t,{useDefault:l,reflect:e,wrapped:p},n){l&&!(this._$Ej??(this._$Ej=new Map)).has(A)&&(this._$Ej.set(A,n??t??this[A]),p!==!0||n!==void 0)||(this._$AL.has(A)||(this.hasUpdated||l||(t=void 0),this._$AL.set(A,t)),e===!0&&this._$Em!==A&&(this._$Eq??(this._$Eq=new Set)).add(A))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const A=this.scheduleUpdate();return A!=null&&await A,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var l;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[p,n]of this._$Ep)this[p]=n;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[p,n]of e){const{wrapped:S}=n,q=this[p];S!==!0||this._$AL.has(p)||q===void 0||this.C(p,void 0,n,q)}}let A=!1;const t=this._$AL;try{A=this.shouldUpdate(t),A?(this.willUpdate(t),(l=this._$EO)==null||l.forEach(e=>{var p;return(p=e.hostUpdate)==null?void 0:p.call(e)}),this.update(t)):this._$EM()}catch(e){throw A=!1,this._$EM(),e}A&&this._$AE(t)}willUpdate(A){}_$AE(A){var t;(t=this._$EO)==null||t.forEach(l=>{var e;return(e=l.hostUpdated)==null?void 0:e.call(l)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(A)),this.updated(A)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(A){return!0}update(A){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(A){}firstUpdated(A){}};Z.elementStyles=[],Z.shadowRootOptions={mode:"open"},Z[z("elementProperties")]=new Map,Z[z("finalized")]=new Map,nA==null||nA({ReactiveElement:Z}),(x.reactiveElementVersions??(x.reactiveElementVersions=[])).push("2.1.0");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const G=globalThis,_=G.trustedTypes,
|
|
14
|
-
\f\r]`,h=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,bA=/-->/g,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
13
|
+
*/const G=globalThis,_=G.trustedTypes,vA=_?_.createPolicy("lit-html",{createHTML:r=>r}):void 0,OA="$lit$",K=`lit$${Math.random().toFixed(9).slice(2)}$`,WA="?"+K,tt=`<${WA}>`,v=document,F=()=>v.createComment(""),M=r=>r===null||typeof r!="object"&&typeof r!="function",qA=Array.isArray,lt=r=>qA(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",SA=`[
|
|
14
|
+
\f\r]`,h=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,bA=/-->/g,oA=/>/g,O=RegExp(`>|${SA}(?:([^\\s"'>=/]+)(${SA}*=${SA}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),LA=/'/g,fA=/"/g,PA=/^(?:script|style|textarea|title)$/i,et=r=>(A,...t)=>({_$litType$:r,strings:A,values:t}),J=et(1),W=Symbol.for("lit-noChange"),j=Symbol.for("lit-nothing"),mA=new WeakMap,b=v.createTreeWalker(v,129);function ZA(r,A){if(!qA(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return vA!==void 0?vA.createHTML(A):A}const rt=(r,A)=>{const t=r.length-1,l=[];let e,p=A===2?"<svg>":A===3?"<math>":"",n=h;for(let S=0;S<t;S++){const q=r[S];let y,k,d=-1,i=0;for(;i<q.length&&(n.lastIndex=i,k=n.exec(q),k!==null);)i=n.lastIndex,n===h?k[1]==="!--"?n=bA:k[1]!==void 0?n=oA:k[2]!==void 0?(PA.test(k[2])&&(e=RegExp("</"+k[2],"g")),n=O):k[3]!==void 0&&(n=O):n===O?k[0]===">"?(n=e??h,d=-1):k[1]===void 0?d=-2:(d=n.lastIndex-k[2].length,y=k[1],n=k[3]===void 0?O:k[3]==='"'?fA:LA):n===fA||n===LA?n=O:n===bA||n===oA?n=h:(n=O,e=void 0);const U=n===O&&r[S+1].startsWith("/>")?" ":"";p+=n===h?q+tt:d>=0?(l.push(y),q.slice(0,d)+OA+q.slice(d)+K+U):q+K+(d===-2?S:U)}return[ZA(r,p+(r[t]||"<?>")+(A===2?"</svg>":A===3?"</math>":"")),l]};class E{constructor({strings:A,_$litType$:t},l){let e;this.parts=[];let p=0,n=0;const S=A.length-1,q=this.parts,[y,k]=rt(A,t);if(this.el=E.createElement(y,l),b.currentNode=this.el.content,t===2||t===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(e=b.nextNode())!==null&&q.length<S;){if(e.nodeType===1){if(e.hasAttributes())for(const d of e.getAttributeNames())if(d.endsWith(OA)){const i=k[n++],U=e.getAttribute(d).split(K),eA=/([.?@])?(.*)/.exec(i);q.push({type:1,index:p,name:eA[2],strings:U,ctor:eA[1]==="."?nt:eA[1]==="?"?Vt:eA[1]==="@"?qt:$}),e.removeAttribute(d)}else d.startsWith(K)&&(q.push({type:6,index:p}),e.removeAttribute(d));if(PA.test(e.tagName)){const d=e.textContent.split(K),i=d.length-1;if(i>0){e.textContent=_?_.emptyScript:"";for(let U=0;U<i;U++)e.append(d[U],F()),b.nextNode(),q.push({type:2,index:++p});e.append(d[i],F())}}}else if(e.nodeType===8)if(e.data===WA)q.push({type:2,index:p});else{let d=-1;for(;(d=e.data.indexOf(K,d+1))!==-1;)q.push({type:7,index:p}),d+=K.length-1}p++}}static createElement(A,t){const l=v.createElement("template");return l.innerHTML=A,l}}function N(r,A,t=r,l){var n,S;if(A===W)return A;let e=l!==void 0?(n=t._$Co)==null?void 0:n[l]:t._$Cl;const p=M(A)?void 0:A._$litDirective$;return(e==null?void 0:e.constructor)!==p&&((S=e==null?void 0:e._$AO)==null||S.call(e,!1),p===void 0?e=void 0:(e=new p(r),e._$AT(r,t,l)),l!==void 0?(t._$Co??(t._$Co=[]))[l]=e:t._$Cl=e),e!==void 0&&(A=N(r,e._$AS(r,A.values),e,l)),A}class pt{constructor(A,t){this._$AV=[],this._$AN=void 0,this._$AD=A,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(A){const{el:{content:t},parts:l}=this._$AD,e=((A==null?void 0:A.creationScope)??v).importNode(t,!0);b.currentNode=e;let p=b.nextNode(),n=0,S=0,q=l[0];for(;q!==void 0;){if(n===q.index){let y;q.type===2?y=new I(p,p.nextSibling,this,A):q.type===1?y=new q.ctor(p,q.name,q.strings,this,A):q.type===6&&(y=new St(p,this,A)),this._$AV.push(y),q=l[++S]}n!==(q==null?void 0:q.index)&&(p=b.nextNode(),n++)}return b.currentNode=v,e}p(A){let t=0;for(const l of this._$AV)l!==void 0&&(l.strings!==void 0?(l._$AI(A,l,t),t+=l.strings.length-2):l._$AI(A[t])),t++}}class I{get _$AU(){var A;return((A=this._$AM)==null?void 0:A._$AU)??this._$Cv}constructor(A,t,l,e){this.type=2,this._$AH=j,this._$AN=void 0,this._$AA=A,this._$AB=t,this._$AM=l,this.options=e,this._$Cv=(e==null?void 0:e.isConnected)??!0}get parentNode(){let A=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(A==null?void 0:A.nodeType)===11&&(A=t.parentNode),A}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(A,t=this){A=N(this,A,t),M(A)?A===j||A==null||A===""?(this._$AH!==j&&this._$AR(),this._$AH=j):A!==this._$AH&&A!==W&&this._(A):A._$litType$!==void 0?this.$(A):A.nodeType!==void 0?this.T(A):lt(A)?this.k(A):this._(A)}O(A){return this._$AA.parentNode.insertBefore(A,this._$AB)}T(A){this._$AH!==A&&(this._$AR(),this._$AH=this.O(A))}_(A){this._$AH!==j&&M(this._$AH)?this._$AA.nextSibling.data=A:this.T(v.createTextNode(A)),this._$AH=A}$(A){var p;const{values:t,_$litType$:l}=A,e=typeof l=="number"?this._$AC(A):(l.el===void 0&&(l.el=E.createElement(ZA(l.h,l.h[0]),this.options)),l);if(((p=this._$AH)==null?void 0:p._$AD)===e)this._$AH.p(t);else{const n=new pt(e,this),S=n.u(this.options);n.p(t),this.T(S),this._$AH=n}}_$AC(A){let t=mA.get(A.strings);return t===void 0&&mA.set(A.strings,t=new E(A)),t}k(A){qA(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let l,e=0;for(const p of A)e===t.length?t.push(l=new I(this.O(F()),this.O(F()),this,this.options)):l=t[e],l._$AI(p),e++;e<t.length&&(this._$AR(l&&l._$AB.nextSibling,e),t.length=e)}_$AR(A=this._$AA.nextSibling,t){var l;for((l=this._$AP)==null?void 0:l.call(this,!1,!0,t);A&&A!==this._$AB;){const e=A.nextSibling;A.remove(),A=e}}setConnected(A){var t;this._$AM===void 0&&(this._$Cv=A,(t=this._$AP)==null||t.call(this,A))}}class ${get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(A,t,l,e,p){this.type=1,this._$AH=j,this._$AN=void 0,this.element=A,this.name=t,this._$AM=e,this.options=p,l.length>2||l[0]!==""||l[1]!==""?(this._$AH=Array(l.length-1).fill(new String),this.strings=l):this._$AH=j}_$AI(A,t=this,l,e){const p=this.strings;let n=!1;if(p===void 0)A=N(this,A,t,0),n=!M(A)||A!==this._$AH&&A!==W,n&&(this._$AH=A);else{const S=A;let q,y;for(A=p[0],q=0;q<p.length-1;q++)y=N(this,S[l+q],t,q),y===W&&(y=this._$AH[q]),n||(n=!M(y)||y!==this._$AH[q]),y===j?A=j:A!==j&&(A+=(y??"")+p[q+1]),this._$AH[q]=y}n&&!e&&this.j(A)}j(A){A===j?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,A??"")}}class nt extends ${constructor(){super(...arguments),this.type=3}j(A){this.element[this.name]=A===j?void 0:A}}class Vt extends ${constructor(){super(...arguments),this.type=4}j(A){this.element.toggleAttribute(this.name,!!A&&A!==j)}}class qt extends ${constructor(A,t,l,e,p){super(A,t,l,e,p),this.type=5}_$AI(A,t=this){if((A=N(this,A,t,0)??j)===W)return;const l=this._$AH,e=A===j&&l!==j||A.capture!==l.capture||A.once!==l.once||A.passive!==l.passive,p=A!==j&&(l===j||e);e&&this.element.removeEventListener(this.name,this,l),p&&this.element.addEventListener(this.name,this,A),this._$AH=A}handleEvent(A){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,A):this._$AH.handleEvent(A)}}class St{constructor(A,t,l){this.element=A,this.type=6,this._$AN=void 0,this._$AM=t,this.options=l}get _$AU(){return this._$AM._$AU}_$AI(A){N(this,A)}}const aA=G.litHtmlPolyfillSupport;aA==null||aA(E,I),(G.litHtmlVersions??(G.litHtmlVersions=[])).push("3.3.0");const at=(r,A,t)=>{const l=(t==null?void 0:t.renderBefore)??A;let e=l._$litPart$;if(e===void 0){const p=(t==null?void 0:t.renderBefore)??null;l._$litPart$=e=new I(A.insertBefore(F(),p),p,void 0,t??{})}return e._$AI(r),e};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/const
|
|
19
|
+
*/const o=globalThis;let X=class extends Z{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const A=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=A.firstChild),A}update(A){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(A),this._$Do=at(t,this.renderRoot,this.renderOptions)}connectedCallback(){var A;super.connectedCallback(),(A=this._$Do)==null||A.setConnected(!0)}disconnectedCallback(){var A;super.disconnectedCallback(),(A=this._$Do)==null||A.setConnected(!1)}render(){return W}};X._$litElement$=!0,X.finalized=!0,(wA=o.litElementHydrateSupport)==null||wA.call(o,{LitElement:X});const dA=o.litElementPolyfillSupport;dA==null||dA({LitElement:X}),(o.litElementVersions??(o.litElementVersions=[])).push("4.2.0");/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const dt={attribute:!0,type:String,converter:B,reflect:!1,hasChanged:
|
|
27
|
+
*/const dt={attribute:!0,type:String,converter:B,reflect:!1,hasChanged:VA},ut=(r=dt,A,t)=>{const{kind:l,metadata:e}=t;let p=globalThis.litPropertyMetadata.get(e);if(p===void 0&&globalThis.litPropertyMetadata.set(e,p=new Map),l==="setter"&&((r=Object.create(r)).wrapped=!0),p.set(t.name,r),l==="accessor"){const{name:n}=t;return{set(S){const q=A.get.call(this);A.set.call(this,S),this.requestUpdate(n,q,r)},init(S){return S!==void 0&&this.C(n,void 0,r,S),S}}}if(l==="setter"){const{name:n}=t;return function(S){const q=this[n];A.call(this,S),this.requestUpdate(n,q,r)}}throw Error("Unsupported decorator location: "+l)};function c(r){return(A,t)=>typeof t=="object"?ut(r,A,t):((l,e,p)=>{const n=e.hasOwnProperty(p);return e.constructor.createProperty(p,l),n?Object.getOwnPropertyDescriptor(e,p):void 0})(r,A,t)}/**
|
|
28
28
|
* @license
|
|
29
29
|
* Copyright 2017 Google LLC
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
* @license
|
|
41
41
|
* Copyright 2021 Google LLC
|
|
42
42
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
43
|
-
*/const RA=r=>yt(r)?NA(r.strings,r.values):r;let
|
|
43
|
+
*/const RA=r=>yt(r)?NA(r.strings,r.values):r;let V=RA,HA=!1;function ct(r){if(HA)throw new Error("lit-localize can only be configured once");V=r,HA=!0}/**
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright 2021 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
* @license
|
|
57
57
|
* Copyright 2014 Travis Webb
|
|
58
58
|
* SPDX-License-Identifier: MIT
|
|
59
|
-
*/const s=[];for(let r=0;r<256;r++)s[r]=(r>>4&15).toString(16)+(r&15).toString(16);function Tt(r){let A=0,t=8997,l=0,e=33826,p=0,
|
|
59
|
+
*/const s=[];for(let r=0;r<256;r++)s[r]=(r>>4&15).toString(16)+(r&15).toString(16);function Tt(r){let A=0,t=8997,l=0,e=33826,p=0,n=40164,S=0,q=52210;for(let y=0;y<r.length;y++)t^=r.charCodeAt(y),A=t*435,l=e*435,p=n*435,S=q*435,p+=t<<8,S+=e<<8,l+=A>>>16,t=A&65535,p+=l>>>16,e=l&65535,q=S+(p>>>16)&65535,n=p&65535;return s[q>>8]+s[q&255]+s[n>>8]+s[n&255]+s[e>>8]+s[e&255]+s[t>>8]+s[t&255]}/**
|
|
60
60
|
* @license
|
|
61
61
|
* Copyright 2020 Google LLC
|
|
62
62
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -64,19 +64,19 @@
|
|
|
64
64
|
* @license
|
|
65
65
|
* Copyright 2021 Google LLC
|
|
66
66
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
67
|
-
*/const GA=new WeakMap,FA=new Map;function xt(r,A,t){if(r){const l=(t==null?void 0:t.id)??Kt(A),e=r[l];if(e){if(typeof e=="string")return e;if("strTag"in e)return NA(e.strings,A.values,e.values);{let p=GA.get(e);return p===void 0&&(p=e.values,GA.set(e,p)),{...e,values:p.map(
|
|
67
|
+
*/const GA=new WeakMap,FA=new Map;function xt(r,A,t){if(r){const l=(t==null?void 0:t.id)??Kt(A),e=r[l];if(e){if(typeof e=="string")return e;if("strTag"in e)return NA(e.strings,A.values,e.values);{let p=GA.get(e);return p===void 0&&(p=e.values,GA.set(e,p)),{...e,values:p.map(n=>A.values[n])}}}}return RA(A)}function Kt(r){const A=typeof r=="string"?r:r.strings;let t=FA.get(A);return t===void 0&&(t=it(A,typeof r!="string"&&!("strTag"in r)),FA.set(A,t)),t}/**
|
|
68
68
|
* @license
|
|
69
69
|
* Copyright 2021 Google LLC
|
|
70
70
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
71
|
-
*/function yA(r){window.dispatchEvent(new CustomEvent(uA,{detail:r}))}let AA="",cA,MA,tA,jA,hA,
|
|
71
|
+
*/function yA(r){window.dispatchEvent(new CustomEvent(uA,{detail:r}))}let AA="",cA,MA,tA,jA,hA,L=new zA;L.resolve();let lA=0;const Ut=r=>(ct((A,t)=>xt(hA,A,t)),AA=MA=r.sourceLocale,tA=new Set(r.targetLocales),tA.add(r.sourceLocale),jA=r.loadLocale,{getLocale:vt,setLocale:Ot}),vt=()=>AA,Ot=r=>{if(r===(cA??AA))return L.promise;if(!tA||!jA)throw new Error("Internal error");if(!tA.has(r))throw new Error("Invalid locale code");lA++;const A=lA;return cA=r,L.settled&&(L=new zA),yA({status:"loading",loadingLocale:r}),(r===MA?Promise.resolve({templates:void 0}):jA(r)).then(l=>{lA===A&&(AA=r,cA=void 0,hA=l.templates,yA({status:"ready",readyLocale:r}),L.resolve())},l=>{lA===A&&(yA({status:"error",errorLocale:r,errorMessage:l.toString()}),L.reject(l))}),L.promise},EA="en",Wt=["pt-BR"];/**
|
|
72
72
|
* @license
|
|
73
73
|
* Copyright 2017 Google LLC
|
|
74
74
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
75
|
-
*/const bt={ATTRIBUTE:1},
|
|
75
|
+
*/const bt={ATTRIBUTE:1},ot=r=>(...A)=>({_$litDirective$:r,values:A});class Lt{constructor(A){}get _$AU(){return this._$AM._$AU}_$AT(A,t,l){this._$Ct=A,this._$AM=t,this._$Ci=l}_$AS(A,t){return this.update(A,t)}update(A,t){return this.render(...t)}}/**
|
|
76
76
|
* @license
|
|
77
77
|
* Copyright 2018 Google LLC
|
|
78
78
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
79
|
-
*/const ft=
|
|
79
|
+
*/const ft=ot(class extends Lt{constructor(r){var A;if(super(r),r.type!==bt.ATTRIBUTE||r.name!=="class"||((A=r.strings)==null?void 0:A.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return" "+Object.keys(r).filter(A=>r[A]).join(" ")+" "}update(r,[A]){var l,e;if(this.st===void 0){this.st=new Set,r.strings!==void 0&&(this.nt=new Set(r.strings.join(" ").split(/\s/).filter(p=>p!=="")));for(const p in A)A[p]&&!((l=this.nt)!=null&&l.has(p))&&this.st.add(p);return this.render(A)}const t=r.element.classList;for(const p of this.st)p in A||(t.remove(p),this.st.delete(p));for(const p in A){const n=!!A[p];n===this.st.has(p)||(e=this.nt)!=null&&e.has(p)||(n?(t.add(p),this.st.add(p)):(t.remove(p),this.st.delete(p)))}return W}});var Pt=Object.defineProperty,mt=Object.getOwnPropertyDescriptor,C=(r,A,t,l)=>{for(var e=l>1?void 0:l?mt(A,t):A,p=r.length-1,n;p>=0;p--)(n=r[p])&&(e=(l?n(A,t,e):n(e))||e);return l&&e&&Pt(A,t,e),e};let f=class extends X{constructor(){super(...arguments),this.type="button",this.label="",this.disabled=!1,this.variant="contained"}render(){return J`
|
|
80
80
|
<div class="button-wrapper">
|
|
81
81
|
<button
|
|
82
82
|
class=${this.variant}
|
|
@@ -158,41 +158,41 @@
|
|
|
158
158
|
cursor: not-allowed;
|
|
159
159
|
box-shadow: none;
|
|
160
160
|
}
|
|
161
|
-
`,C([c({type:String})],f.prototype,"type",2),C([c({type:String})],f.prototype,"label",2),C([c({type:Boolean})],f.prototype,"disabled",2),C([c({type:String})],f.prototype,"variant",2),f=C([R("xact-button")],f);var Zt=Object.defineProperty,Nt=Object.getOwnPropertyDescriptor,kA=(r,A,t,l)=>{for(var e=l>1?void 0:l?Nt(A,t):A,p=r.length-1,
|
|
161
|
+
`,C([c({type:String})],f.prototype,"type",2),C([c({type:String})],f.prototype,"label",2),C([c({type:Boolean})],f.prototype,"disabled",2),C([c({type:String})],f.prototype,"variant",2),f=C([R("xact-button")],f);var Zt=Object.defineProperty,Nt=Object.getOwnPropertyDescriptor,kA=(r,A,t,l)=>{for(var e=l>1?void 0:l?Nt(A,t):A,p=r.length-1,n;p>=0;p--)(n=r[p])&&(e=(l?n(A,t,e):n(e))||e);return l&&e&&Zt(A,t,e),e};let Y=class extends X{constructor(){super(...arguments),this.height=0}render(){return J`
|
|
162
162
|
<div class="component-content">
|
|
163
163
|
<div class="header-section">
|
|
164
|
-
<h2 class="header-text">${
|
|
164
|
+
<h2 class="header-text">${V("Before you begin")}</h2>
|
|
165
165
|
<p class="description-text">
|
|
166
|
-
${
|
|
166
|
+
${V("Maintain an upright posture with your arms away from your body.")}
|
|
167
167
|
</p>
|
|
168
168
|
</div>
|
|
169
169
|
|
|
170
170
|
<div class="main-section">
|
|
171
171
|
<div class="tips-section">
|
|
172
|
-
<h3>${
|
|
172
|
+
<h3>${V("Tips")}</h3>
|
|
173
173
|
<div class="tip-item">
|
|
174
|
-
<span class="tip-title">${
|
|
175
|
-
<p class="tip-text">${
|
|
174
|
+
<span class="tip-title">${V("Good Lighting")}</span>
|
|
175
|
+
<p class="tip-text">${V("Choose a well-lit area where you can see your image clearly.")}</p>
|
|
176
176
|
</div>
|
|
177
177
|
<div class="tip-item">
|
|
178
|
-
<span class="tip-title">${
|
|
179
|
-
<p class="tip-text">${
|
|
178
|
+
<span class="tip-title">${V("Clean Background")}</span>
|
|
179
|
+
<p class="tip-text">${V("Position yourself against a plain background.")}</p>
|
|
180
180
|
</div>
|
|
181
181
|
<div class="tip-item">
|
|
182
|
-
<span class="tip-title">${
|
|
183
|
-
<p class="tip-text">${
|
|
182
|
+
<span class="tip-title">${V("Clothes")}</span>
|
|
183
|
+
<p class="tip-text">${V("Wear clothes that you usually wear on a daily basis.")}</p>
|
|
184
184
|
</div>
|
|
185
185
|
<div class="tip-item">
|
|
186
|
-
<span class="tip-title">${
|
|
187
|
-
<p class="tip-text">${
|
|
186
|
+
<span class="tip-title">${V("Framing")}</span>
|
|
187
|
+
<p class="tip-text">${V("Make sure your entire body is visible. The app will guide you.")}</p>
|
|
188
188
|
</div>
|
|
189
189
|
|
|
190
190
|
<form>
|
|
191
191
|
<label for="height-input">
|
|
192
|
-
${
|
|
192
|
+
${V("To get started, please tell us your height.")}
|
|
193
193
|
</label>
|
|
194
194
|
<input id="height-input" type="number" min="50" max="300"
|
|
195
|
-
placeholder=${
|
|
195
|
+
placeholder=${V("Height (cm)")} required tabindex="1"/>
|
|
196
196
|
</form>
|
|
197
197
|
</div>
|
|
198
198
|
|
|
@@ -263,7 +263,7 @@
|
|
|
263
263
|
|
|
264
264
|
<xact-button class="xact-button buttons"
|
|
265
265
|
@click=${()=>{var A;const r=this.shadowRoot.querySelector("#height-input");if(r!=null&&r.value){const t=parseInt(r.value);this.height=t,(A=this.onStartMeasurement)==null||A.call(this,t)}}}
|
|
266
|
-
label="${
|
|
266
|
+
label="${V("Let's go!")}"
|
|
267
267
|
></xact-button>
|
|
268
268
|
|
|
269
269
|
`}};Y.styles=m`
|
|
@@ -397,59 +397,129 @@ label="${n("Let's go!")}"
|
|
|
397
397
|
margin: 0 auto;
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
+
/* Ajuste da responsividade para mobile */
|
|
400
401
|
@media (max-width: 754px) {
|
|
401
402
|
.main-section {
|
|
402
403
|
flex-direction: column;
|
|
403
|
-
gap:
|
|
404
|
+
gap: 5px; /* menor gap */
|
|
405
|
+
align-items: center;
|
|
404
406
|
}
|
|
405
407
|
|
|
406
408
|
.images-section {
|
|
407
|
-
order: -1;
|
|
408
|
-
|
|
409
|
-
margin-bottom: 8px;
|
|
409
|
+
order: -1;
|
|
410
|
+
width: 100%;
|
|
410
411
|
}
|
|
411
412
|
|
|
412
413
|
.images-section svg {
|
|
413
|
-
width: 80%;
|
|
414
|
-
max-width:
|
|
414
|
+
width: 80%; /* reduzir para não quebrar botão */
|
|
415
|
+
max-width: 180px; /* altura menor */
|
|
415
416
|
height: auto;
|
|
416
|
-
margin-bottom: 8px;
|
|
417
417
|
}
|
|
418
418
|
|
|
419
419
|
.tips-section {
|
|
420
420
|
width: 100%;
|
|
421
|
-
gap:
|
|
421
|
+
gap: 6px;
|
|
422
|
+
align-items: flex-start; /* alinhar à esquerda */
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
form {
|
|
426
|
+
align-items: flex-start; /* alinhar labels e inputs à esquerda */
|
|
427
|
+
width: 100%;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
input {
|
|
431
|
+
max-width: 100%;
|
|
432
|
+
font-size: 14px;
|
|
433
|
+
padding: 10px;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
label {
|
|
437
|
+
text-align: left;
|
|
438
|
+
font-size: 14px;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.xact-button {
|
|
442
|
+
max-width: 100%;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.header-text {
|
|
446
|
+
font-size: 20px;
|
|
447
|
+
text-align: center;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.description-text {
|
|
451
|
+
font-size: 14px;
|
|
452
|
+
text-align: center;
|
|
422
453
|
}
|
|
423
454
|
|
|
424
455
|
.tip-title {
|
|
425
456
|
font-size: 12px;
|
|
426
|
-
|
|
457
|
+
text-align: left;
|
|
427
458
|
}
|
|
428
459
|
|
|
429
460
|
.tip-text {
|
|
430
|
-
font-size:
|
|
431
|
-
|
|
461
|
+
font-size: 11px;
|
|
462
|
+
text-align: left;
|
|
463
|
+
margin-left: 0; /* remove centralização */
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.tip-item {
|
|
467
|
+
margin-bottom: 6px;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.buttons {
|
|
471
|
+
gap: 8px;
|
|
472
|
+
width: 100%;
|
|
473
|
+
max-width: 100%;
|
|
474
|
+
margin-top: 12px;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/* Ajuste fino para iPhones muito pequenos */
|
|
479
|
+
@media (max-width: 380px) {
|
|
480
|
+
:host {
|
|
481
|
+
padding: 12px;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.images-section svg {
|
|
485
|
+
max-width: 150px;
|
|
432
486
|
}
|
|
433
487
|
|
|
434
488
|
.header-text {
|
|
435
|
-
font-size:
|
|
489
|
+
font-size: 18px;
|
|
436
490
|
}
|
|
437
491
|
|
|
438
492
|
.description-text {
|
|
439
|
-
font-size:
|
|
440
|
-
|
|
493
|
+
font-size: 13px;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.tip-title {
|
|
497
|
+
font-size: 11px;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.tip-text {
|
|
501
|
+
font-size: 10px;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
.tip-item {
|
|
505
|
+
margin-bottom: 4px;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.xact-button {
|
|
509
|
+
padding: 8px;
|
|
441
510
|
}
|
|
442
511
|
|
|
443
512
|
.buttons {
|
|
444
|
-
gap:
|
|
445
|
-
max-width: 180px;
|
|
513
|
+
gap: 6px;
|
|
446
514
|
}
|
|
447
|
-
|
|
448
515
|
}
|
|
449
|
-
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
`,kA([c({type:Number})],Y.prototype,"height",2),kA([c({type:Function})],Y.prototype,"onStartMeasurement",2),Y=kA([R("xact-step-one"),w()],Y);var Rt=Object.getOwnPropertyDescriptor,Ht=(r,A,t,l)=>{for(var e=l>1?void 0:l?Rt(A,t):A,p=r.length-1,n;p>=0;p--)(n=r[p])&&(e=n(e)||e);return e};let TA=class extends X{render(){return J`
|
|
450
520
|
<footer class="modal-footer">
|
|
451
521
|
<span>
|
|
452
|
-
<span class="powered-by">${
|
|
522
|
+
<span class="powered-by">${V("Powered by")}</span>
|
|
453
523
|
<a tabindex="0" class="xactsize-link" href="http://xactsize.com" target="_blank" rel="noopener">
|
|
454
524
|
<svg class="xactsize-icon" width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
455
525
|
<path d="M5.82764 11.3511L11.5446 7.80768V11.3511H5.82764Z" fill="url(#paint0_linear_2010_6151)"/>
|
|
@@ -525,7 +595,7 @@ label="${n("Let's go!")}"
|
|
|
525
595
|
outline: 2px solid var(--brand-primary);
|
|
526
596
|
outline-offset: 2px;
|
|
527
597
|
}
|
|
528
|
-
`,TA=Ht([R("xact-footer"),w()],TA);var zt=Object.defineProperty,Gt=Object.getOwnPropertyDescriptor,D=(r,A,t,l)=>{for(var e=l>1?void 0:l?Gt(A,t):A,p=r.length-1,
|
|
598
|
+
`,TA=Ht([R("xact-footer"),w()],TA);var zt=Object.defineProperty,Gt=Object.getOwnPropertyDescriptor,D=(r,A,t,l)=>{for(var e=l>1?void 0:l?Gt(A,t):A,p=r.length-1,n;p>=0;p--)(n=r[p])&&(e=(l?n(A,t,e):n(e))||e);return l&&e&&zt(A,t,e),e};let P=class extends X{constructor(){super(...arguments),this.productName="",this.recommendedSize=""}render(){return J`
|
|
529
599
|
<div class="image-container">
|
|
530
600
|
<!-- Imagem da roupa como SVG exportado -->
|
|
531
601
|
<svg class="product-image" width="180" height="240" viewBox="0 0 180 240" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -564,21 +634,21 @@ label="${n("Let's go!")}"
|
|
|
564
634
|
|
|
565
635
|
|
|
566
636
|
|
|
567
|
-
<h2 class="title">${
|
|
637
|
+
<h2 class="title">${V("Your ideal size")}</h2>
|
|
568
638
|
<p class="description">
|
|
569
|
-
${
|
|
639
|
+
${V("Based on your measurements and the exact dimensions of the garment, the size recommendation provided is the most accurate for an ideal fit.")}
|
|
570
640
|
</p>
|
|
571
641
|
|
|
572
642
|
<div class="buttons">
|
|
573
643
|
<xact-button
|
|
574
644
|
variant="outlined"
|
|
575
645
|
@click=${this.onRetry}
|
|
576
|
-
label=${
|
|
646
|
+
label=${V("Measure Again")}>
|
|
577
647
|
</xact-button>
|
|
578
648
|
|
|
579
649
|
<xact-button
|
|
580
650
|
@click=${this.onAccept}
|
|
581
|
-
label=${
|
|
651
|
+
label=${V("Accept Suggestion")}>
|
|
582
652
|
</xact-button>
|
|
583
653
|
</div>
|
|
584
654
|
`}};P.styles=m`
|
|
@@ -655,33 +725,33 @@ label="${n("Let's go!")}"
|
|
|
655
725
|
justify-content: center;
|
|
656
726
|
}
|
|
657
727
|
}
|
|
658
|
-
`,D([c({type:String})],P.prototype,"productName",2),D([c({type:String})],P.prototype,"recommendedSize",2),D([c({type:Function})],P.prototype,"onAccept",2),D([c({type:Function})],P.prototype,"onRetry",2),P=D([R("xact-step-result"),w()],P);var Ft=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,JA=(r,A,t,l)=>{for(var e=l>1?void 0:l?Mt(A,t):A,p=r.length-1,
|
|
728
|
+
`,D([c({type:String})],P.prototype,"productName",2),D([c({type:String})],P.prototype,"recommendedSize",2),D([c({type:Function})],P.prototype,"onAccept",2),D([c({type:Function})],P.prototype,"onRetry",2),P=D([R("xact-step-result"),w()],P);var Ft=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,JA=(r,A,t,l)=>{for(var e=l>1?void 0:l?Mt(A,t):A,p=r.length-1,n;p>=0;p--)(n=r[p])&&(e=(l?n(A,t,e):n(e))||e);return l&&e&&Ft(A,t,e),e};let Q=class extends X{constructor(){super(...arguments),this.height=0}render(){return J`
|
|
659
729
|
<div class="component-content">
|
|
660
730
|
<div class="header-section">
|
|
661
|
-
<h2 class="header-text">${
|
|
731
|
+
<h2 class="header-text">${V("Before you begin")}</h2>
|
|
662
732
|
<p class="description-text">
|
|
663
|
-
${
|
|
733
|
+
${V("To ensure accurate measurements, we'll take two scans: one from the front and one from the side. Maintain an upright posture with your arms slightly away from your body and stretched out. In the side view, stand up straight with your arms straight and aligned with your body.")}
|
|
664
734
|
</p>
|
|
665
735
|
</div>
|
|
666
736
|
|
|
667
737
|
<div class="main-section">
|
|
668
738
|
<div class="tips-section">
|
|
669
|
-
<h3>${
|
|
739
|
+
<h3>${V("Tips")}</h3>
|
|
670
740
|
<div class="tip-item">
|
|
671
|
-
<span class="tip-title">${
|
|
672
|
-
<p class="tip-text">${
|
|
741
|
+
<span class="tip-title">${V("Good Lighting")}</span>
|
|
742
|
+
<p class="tip-text">${V("Choose a well-lit area where you can see your image clearly.")}</p>
|
|
673
743
|
</div>
|
|
674
744
|
<div class="tip-item">
|
|
675
|
-
<span class="tip-title">${
|
|
676
|
-
<p class="tip-text">${
|
|
745
|
+
<span class="tip-title">${V("Clean Background")}</span>
|
|
746
|
+
<p class="tip-text">${V("Position yourself against a plain background.")}</p>
|
|
677
747
|
</div>
|
|
678
748
|
<div class="tip-item">
|
|
679
|
-
<span class="tip-title">${
|
|
680
|
-
<p class="tip-text">${
|
|
749
|
+
<span class="tip-title">${V("Clothes")}</span>
|
|
750
|
+
<p class="tip-text">${V("Wear clothes that you usually wear on a daily basis.")}</p>
|
|
681
751
|
</div>
|
|
682
752
|
<div class="tip-item">
|
|
683
|
-
<span class="tip-title">${
|
|
684
|
-
<p class="tip-text">${
|
|
753
|
+
<span class="tip-title">${V("Framing")}</span>
|
|
754
|
+
<p class="tip-text">${V("Make sure your entire body is visible. The app will guide you.")}</p>
|
|
685
755
|
</div>
|
|
686
756
|
</div>
|
|
687
757
|
|
|
@@ -790,7 +860,7 @@ label="${n("Let's go!")}"
|
|
|
790
860
|
</div>
|
|
791
861
|
<xact-button class="buttons"
|
|
792
862
|
@click=${()=>{var r;(r=this.onStep2advancement)==null||r.call(this)}}
|
|
793
|
-
label="${
|
|
863
|
+
label="${V("To start")}"
|
|
794
864
|
></xact-button>
|
|
795
865
|
</div>
|
|
796
866
|
`}};Q.styles=m`
|
|
@@ -933,8 +1003,8 @@ label="${n("Let's go!")}"
|
|
|
933
1003
|
}
|
|
934
1004
|
}
|
|
935
1005
|
|
|
936
|
-
`,JA([c({type:Number})],Q.prototype,"height",2),JA([c({type:Function})],Q.prototype,"onStep2advancement",2),Q=JA([R("xact-step-informs"),w()],Q);const IA="data:image/svg+xml,%3csvg%20width='22'%20height='40'%20viewBox='0%200%2022%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.517%200L0%2013.3362V0H21.517Z'%20fill='white'/%3e%3cpath%20d='M21.517%2013.339L0%2026.6724V13.3362H21.517V13.339Z'%20fill='white'/%3e%3cpath%20d='M21.517%2026.6755L0%2040.0089V26.6726H21.517V26.6755Z'%20fill='%231C28BA'/%3e%3c/svg%3e",ht="data:image/svg+xml,%3csvg%20width='22'%20height='41'%20viewBox='0%200%2022%2041'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.517%200.00878906L0%2013.345V0.00878906H21.517Z'%20fill='white'/%3e%3cpath%20d='M21.517%2013.3478L0%2026.6812V13.345H21.517V13.3478Z'%20fill='%231C28BA'/%3e%3cpath%20d='M21.517%2026.6843L0%2040.0176V26.6814H21.517V26.6843Z'%20fill='white'/%3e%3c/svg%3e",Et="data:image/svg+xml,%3csvg%20width='22'%20height='41'%20viewBox='0%200%2022%2041'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.517%200.0204381L0%2013.3538V0.0175781H21.517V0.0204381Z'%20fill='%231C28BA'/%3e%3cpath%20d='M21.517%2013.3538L0%2026.69V13.3538H21.517Z'%20fill='white'/%3e%3cpath%20d='M21.517%2026.693L0%2040.0264V26.6902H21.517V26.693Z'%20fill='white'/%3e%3c/svg%3e";var It=Object.defineProperty,wt=Object.getOwnPropertyDescriptor,u=(r,A,t,l)=>{for(var e=l>1?void 0:l?wt(A,t):A,p=r.length-1,V;p>=0;p--)(V=r[p])&&(e=(l?V(A,t,e):V(e))||e);return l&&e&&It(A,t,e),e};const{getLocale:Ct,setLocale:XA}=Ut({sourceLocale:EA,targetLocales:Wt,loadLocale:r=>H(Object.assign({"./generated/locales/pt-BR.ts":()=>Promise.resolve().then(()=>Yt)}),`./generated/locales/${r}.ts`,4)});a.BodyMeasurer=class extends X{constructor(){super(...arguments),this.spinnerFrame=0,this.apiKey="DB8mP9gStPfvdyeYbbuCV4Zf3SH745dI",this.tenantId="1",this.productSku="123456",this.apiUrl="https://xactsize-dotnet-api-923169850574.southamerica-east1.run.app/api/measurer/measure/body",this._culture="pt-BR",this.measurerKey="",this._isLocaleLoading=!1,this.showModal=!1,this.step=1,this.height=0,this.recommendedSize="",this.measurements={},this.errorMessage="",this.instructionMessage=n("Position yourself in front of the camera"),this.shouldStartMeasurement=!1,this.isLoading=!1,this.isFetching=!1,this.videoElement=null,this.stream=null,this.poolingTimeout=null,this.instructionMessageTimeout=null,this.cameras=[],this.currentCameraId=null}firstUpdated(){this.startSpinnerAnimation()}startSpinnerAnimation(){const A=[Et,ht,IA];this.spinnerInterval=setInterval(()=>{var l;const t=(l=this.shadowRoot)==null?void 0:l.querySelector(".spinner");t&&(t.src=A[this.spinnerFrame],this.spinnerFrame=(this.spinnerFrame+1)%A.length)},300)}get culture(){return this._culture}set culture(A){const t=this._culture;this._culture=A,this.requestUpdate("culture",t),this._applyLocale(A).catch(console.error)}async _applyLocale(A){try{this._isLocaleLoading=!0,this.requestUpdate(),await XA(A)}catch(t){console.error("Failed to load locale",A,t),await XA(EA)}finally{this._isLocaleLoading=!1,this.requestUpdate()}}get errorMap(){return{ERR_RIGHT_ARM_TOO_HIGH:n("Lower your right arm",{id:"ERR_RIGHT_ARM_TOO_HIGH"}),ERR_LEFT_ARM_TOO_HIGH:n("Lower your left arm",{id:"ERR_LEFT_ARM_TOO_HIGH"}),ERR_ARMS_NOT_RAISED:n("Raise both arms to a 45-degree angle",{id:"ERR_ARMS_NOT_RAISED"}),ERR_RIGHT_ARM_NOT_RAISED:n("Raise your right arm to a 45-degree angle",{id:"ERR_RIGHT_ARM_NOT_RAISED"}),ERR_LEFT_ARM_NOT_RAISED:n("Raise your left arm to a 45-degree angle",{id:"ERR_LEFT_ARM_NOT_RAISED"}),ERR_BODY_LANDMARKS_NOT_DETECTED:n("Ensure your full body is visible in the camera",{id:"ERR_BODY_LANDMARKS_NOT_DETECTED"}),ERR_HIPS_NOT_VISIBLE:n("Adjust your position to show your hips",{id:"ERR_HIPS_NOT_VISIBLE"}),ERR_TOO_CLOSE_TO_CAMERA:n("Step back from the camera",{id:"ERR_TOO_CLOSE_TO_CAMERA"}),ERR_NOT_SIDE_VIEW:n("Turn to show your side profile",{id:"ERR_NOT_SIDE_VIEW"}),ERR_INVALID_CLOTHING_TYPE:n("This clothing type is not supported; please contact support",{id:"ERR_INVALID_CLOTHING_TYPE"}),ERR_UPPER_BODY_NOT_VISIBLE:n("Adjust your position to show your upper body",{id:"ERR_UPPER_BODY_NOT_VISIBLE"}),ERR_HEAD_TOO_CLOSE_TO_EDGE:n("Move your head away from the edge of the frame",{id:"ERR_HEAD_TOO_CLOSE_TO_EDGE"}),ERR_LOWER_BODY_NOT_VISIBLE:n("Adjust your position to show your lower body",{id:"ERR_LOWER_BODY_NOT_VISIBLE"}),ERR_FEET_TOO_CLOSE_TO_EDGE:n("Move your feet away from the edge of the frame",{id:"ERR_FEET_TOO_CLOSE_TO_EDGE"}),ERR_BODY_TOO_CLOSE_TO_EDGE:n("Move your body away from the edge of the frame",{id:"ERR_BODY_TOO_CLOSE_TO_EDGE"}),ERR_BODY_TOO_CLOSE_TO_EDGE_MOVE_LEFT:n("Move to the left to center your body",{id:"ERR_BODY_TOO_CLOSE_TO_EDGE_MOVE_LEFT"}),ERR_BODY_TOO_CLOSE_TO_EDGE_MOVE_RIGHT:n("Move to the right to center your body",{id:"ERR_BODY_TOO_CLOSE_TO_EDGE_MOVE_RIGHT"}),ERR_SHOULDERS_NOT_VISIBLE:n("Adjust your position to show your shoulders",{id:"ERR_SHOULDERS_NOT_VISIBLE"}),ERR_HEIGHT_MEASUREMENT_FAILED:n("Stand straight and ensure your full body is visible",{id:"ERR_HEIGHT_MEASUREMENT_FAILED"}),ERR_HEAD_POINT_NOT_DETECTED:n("Ensure your head is fully visible in the frame",{id:"ERR_HEAD_POINT_NOT_DETECTED"}),ERR_INCORRECT_POSTURE:n("Stand straight with your shoulders back",{id:"ERR_INCORRECT_POSTURE"}),ERR_HEM_MEASUREMENT_FAILED:n("Ensure your clothing hem is visible and clear",{id:"ERR_HEM_MEASUREMENT_FAILED"}),ERR_SHOULDER_MEASUREMENT_FAILED:n("Keep your shoulders relaxed and visible",{id:"ERR_SHOULDER_MEASUREMENT_FAILED"}),ERR_ARM_NOT_STRETCHED:n("Stretch your arms fully",{id:"ERR_ARM_NOT_STRETCHED"}),ERR_LEGS_NOT_DETECTED:n("Ensure your legs are fully visible in the frame",{id:"ERR_LEGS_NOT_DETECTED"}),ERR_HIPS_MEASUREMENT_FAILED:n("Stand straight and ensure your hips are visible",{id:"ERR_HIPS_MEASUREMENT_FAILED"}),ERR_WAIST_MEASUREMENT_FAILED:n("Stand straight and ensure your waist is visible",{id:"ERR_WAIST_MEASUREMENT_FAILED"}),ERR_INVALID_MEASURE_SIDE_VIEW:n("Turn to show a clear side profile",{id:"ERR_INVALID_MEASURE_SIDE_VIEW"}),ERR_INVALID_BODY_HEIGHT_TYPE:n("Ensure your full body is visible for height measurement",{id:"ERR_INVALID_BODY_HEIGHT_TYPE"}),ERR_IMAGE_LOAD_FAILED:n("Try again later; the image could not be processed",{id:"ERR_IMAGE_LOAD_FAILED"}),ERR_HEIGHT_INVALID:n("Height must be between 50 and 300 cm",{id:"ERR_HEIGHT_INVALID"})}}getTranslatedMessage(A){const t=this.errorMap[A];return t||(console.info("Error code is missing",A),n("An unexpected error occurred"))}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleEscKey.bind(this))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleEscKey.bind(this)),this.stopPolling(),clearInterval(this.spinnerInterval)}handleEscKey(A){A.key==="Escape"&&this.showModal&&this.closeModal()}openModal(){this.showModal=!0,this.step=1,this.height=0,this.instructionMessage=n("Position yourself in front of the camera")}closeModal(){this.showModal=!1,this.onMeasurementCanceled&&typeof this.onMeasurementCanceled=="function"&&this.onMeasurementCanceled(),this.stopPolling(),this.dispatchEvent(new CustomEvent("measurementCanceled",{detail:{}}))}async step2advancement(){if(this.height<50||this.height>300){this.errorMessage=this.getTranslatedMessage("ERR_HEIGHT_INVALID");return}this.step=3,this.errorMessage=""}async startMeasurement(){this.step=3,this.errorMessage="",this.shouldStartMeasurement=!0}updated(A){super.updated(A),A.has("step")&&this.step===3&&this.shouldStartMeasurement&&(this.initializeMeasurement(),this.shouldStartMeasurement=!1)}async initializeMeasurement(){this.videoElement=this.shadowRoot.querySelector("video");try{this.stream=await navigator.mediaDevices.getUserMedia({video:!0}),this.videoElement&&(this.videoElement.srcObject=this.stream,await this.videoElement.play(),await this.loadCameras(),this.startPolling())}catch{this.errorMessage=n("Error accessing webcam")}}async loadCameras(){try{const A=await navigator.mediaDevices.enumerateDevices();this.cameras=A.filter(t=>t.kind==="videoinput"),this.cameras.length>0&&(this.currentCameraId=this.cameras[0].deviceId)}catch(A){console.error("Error enumerating devices:",A)}}async flipCamera(){if(this.cameras.length<2)return;this.isLoading=!0,this.stopPolling();const t=(this.cameras.findIndex(l=>l.deviceId===this.currentCameraId)+1)%this.cameras.length;this.currentCameraId=this.cameras[t].deviceId;try{this.stream&&this.stream.getTracks().forEach(l=>l.stop()),this.stream=await navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:this.currentCameraId}}}),this.videoElement&&(this.videoElement.srcObject=this.stream,await this.videoElement.play(),this.startPolling())}catch{this.errorMessage=n("Error switching camera")}finally{this.isLoading=!1}}async startPolling(){const A=async()=>{if(!this.videoElement||!this.stream||this.isFetching)return;const t=document.createElement("canvas");t.width=this.videoElement.videoWidth,t.height=this.videoElement.videoHeight;const l=t.getContext("2d");l==null||l.drawImage(this.videoElement,0,0,t.width,t.height);const e=await new Promise(S=>t.toBlob(q=>S(q),"image/jpeg")),p=new File([e],"frame.jpg",{type:"image/jpeg"}),V=new FormData;V.append("image",p),V.append("height",this.height.toString()),V.append("productSku",this.productSku),this.measurerKey&&V.append("measurerKey",this.measurerKey);try{this.isFetching=!0,this.isLoading=!0,this.poolingTimeout!==null&&(clearTimeout(this.poolingTimeout),this.poolingTimeout=null),this.instructionMessageTimeout!==null&&(clearTimeout(this.instructionMessageTimeout),this.instructionMessageTimeout=null);const q=await(await fetch(this.apiUrl,{method:"POST",body:V,headers:{Accept:"application/json","Cache-Control":"no-store",Pragma:"no-cache","X-Api-Key":this.apiKey}})).json();this.isFetching=!1,this.isLoading=!1,this.errorMessage=JSON.stringify(q),q.success?(this.measurements=q.measurements,this.recommendedSize=q.chosenSize,this.instructionMessage=n("Measurement successful!"),this.stopPolling(),this.step=4):(this.instructionMessage=this.getTranslatedMessage(q.message||"UNKNOWN_ERROR"),this.instructionMessageTimeout=setTimeout(()=>{this.recommendedSize||(this.instructionMessage=n("Position yourself in front of the camera"),this.poolingTimeout=setTimeout(A,0))},2e3))}catch{this.isFetching=!1,this.isLoading=!1,this.instructionMessage=n("Error processing measurement"),this.instructionMessageTimeout=setTimeout(()=>{this.recommendedSize||(this.instructionMessage=n("Position yourself in front of the camera"),this.poolingTimeout=setTimeout(A,0))},2e3)}};A()}stopPolling(){this.poolingTimeout!==null&&(clearTimeout(this.poolingTimeout),this.poolingTimeout=null),this.instructionMessageTimeout!==null&&(clearTimeout(this.instructionMessageTimeout),this.instructionMessageTimeout=null),this.stream&&(this.stream.getTracks().forEach(A=>A.stop()),this.stream=null)}acceptMeasurement(){this.dispatchEvent(new CustomEvent("measurementAccepted",{detail:{size:this.recommendedSize}})),this.onMeasurementAccepted&&typeof this.onMeasurementAccepted=="function"&&this.onMeasurementAccepted(),this.showModal=!1,this.stopPolling()}resetMeasurement(){this.step=1,this.height=0,this.recommendedSize="",this.measurements={},this.stopPolling()}stopMeasurement(){this.resetMeasurement(),this.showModal=!1}render(){return this._isLocaleLoading?J`<div hidden></div>`:J`
|
|
937
|
-
<xact-button @click=${this.openModal} label="${
|
|
1006
|
+
`,JA([c({type:Number})],Q.prototype,"height",2),JA([c({type:Function})],Q.prototype,"onStep2advancement",2),Q=JA([R("xact-step-informs"),w()],Q);const IA="data:image/svg+xml,%3csvg%20width='22'%20height='40'%20viewBox='0%200%2022%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.517%200L0%2013.3362V0H21.517Z'%20fill='white'/%3e%3cpath%20d='M21.517%2013.339L0%2026.6724V13.3362H21.517V13.339Z'%20fill='white'/%3e%3cpath%20d='M21.517%2026.6755L0%2040.0089V26.6726H21.517V26.6755Z'%20fill='%231C28BA'/%3e%3c/svg%3e",ht="data:image/svg+xml,%3csvg%20width='22'%20height='41'%20viewBox='0%200%2022%2041'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.517%200.00878906L0%2013.345V0.00878906H21.517Z'%20fill='white'/%3e%3cpath%20d='M21.517%2013.3478L0%2026.6812V13.345H21.517V13.3478Z'%20fill='%231C28BA'/%3e%3cpath%20d='M21.517%2026.6843L0%2040.0176V26.6814H21.517V26.6843Z'%20fill='white'/%3e%3c/svg%3e",Et="data:image/svg+xml,%3csvg%20width='22'%20height='41'%20viewBox='0%200%2022%2041'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.517%200.0204381L0%2013.3538V0.0175781H21.517V0.0204381Z'%20fill='%231C28BA'/%3e%3cpath%20d='M21.517%2013.3538L0%2026.69V13.3538H21.517Z'%20fill='white'/%3e%3cpath%20d='M21.517%2026.693L0%2040.0264V26.6902H21.517V26.693Z'%20fill='white'/%3e%3c/svg%3e";var It=Object.defineProperty,wt=Object.getOwnPropertyDescriptor,u=(r,A,t,l)=>{for(var e=l>1?void 0:l?wt(A,t):A,p=r.length-1,n;p>=0;p--)(n=r[p])&&(e=(l?n(A,t,e):n(e))||e);return l&&e&&It(A,t,e),e};const{getLocale:Ct,setLocale:XA}=Ut({sourceLocale:EA,targetLocales:Wt,loadLocale:r=>H(Object.assign({"./generated/locales/pt-BR.ts":()=>Promise.resolve().then(()=>Yt)}),`./generated/locales/${r}.ts`,4)});a.BodyMeasurer=class extends X{constructor(){super(...arguments),this.spinnerFrame=0,this.apiKey="DB8mP9gStPfvdyeYbbuCV4Zf3SH745dI",this.tenantId="1",this.productSku="123456",this.apiUrl="https://xactsize-dotnet-api-923169850574.southamerica-east1.run.app/api/measurer/measure/body",this._culture="pt-BR",this.measurerKey="",this._isLocaleLoading=!1,this.showModal=!1,this.step=1,this.height=0,this.recommendedSize="",this.measurements={},this.errorMessage="",this.instructionMessage=V("Position yourself in front of the camera"),this.shouldStartMeasurement=!1,this.isLoading=!1,this.isFetching=!1,this.videoElement=null,this.stream=null,this.poolingTimeout=null,this.instructionMessageTimeout=null,this.cameras=[],this.currentCameraId=null}firstUpdated(){this.startSpinnerAnimation()}startSpinnerAnimation(){const A=[Et,ht,IA];this.spinnerInterval=setInterval(()=>{var l;const t=(l=this.shadowRoot)==null?void 0:l.querySelector(".spinner");t&&(t.src=A[this.spinnerFrame],this.spinnerFrame=(this.spinnerFrame+1)%A.length)},300)}get culture(){return this._culture}set culture(A){const t=this._culture;this._culture=A,this.requestUpdate("culture",t),this._applyLocale(A).catch(console.error)}async _applyLocale(A){try{this._isLocaleLoading=!0,this.requestUpdate(),await XA(A)}catch(t){console.error("Failed to load locale",A,t),await XA(EA)}finally{this._isLocaleLoading=!1,this.requestUpdate()}}get errorMap(){return{ERR_RIGHT_ARM_TOO_HIGH:V("Lower your right arm",{id:"ERR_RIGHT_ARM_TOO_HIGH"}),ERR_LEFT_ARM_TOO_HIGH:V("Lower your left arm",{id:"ERR_LEFT_ARM_TOO_HIGH"}),ERR_ARMS_NOT_RAISED:V("Raise both arms to a 45-degree angle",{id:"ERR_ARMS_NOT_RAISED"}),ERR_RIGHT_ARM_NOT_RAISED:V("Raise your right arm to a 45-degree angle",{id:"ERR_RIGHT_ARM_NOT_RAISED"}),ERR_LEFT_ARM_NOT_RAISED:V("Raise your left arm to a 45-degree angle",{id:"ERR_LEFT_ARM_NOT_RAISED"}),ERR_BODY_LANDMARKS_NOT_DETECTED:V("Ensure your full body is visible in the camera",{id:"ERR_BODY_LANDMARKS_NOT_DETECTED"}),ERR_HIPS_NOT_VISIBLE:V("Adjust your position to show your hips",{id:"ERR_HIPS_NOT_VISIBLE"}),ERR_TOO_CLOSE_TO_CAMERA:V("Step back from the camera",{id:"ERR_TOO_CLOSE_TO_CAMERA"}),ERR_NOT_SIDE_VIEW:V("Turn to show your side profile",{id:"ERR_NOT_SIDE_VIEW"}),ERR_INVALID_CLOTHING_TYPE:V("This clothing type is not supported; please contact support",{id:"ERR_INVALID_CLOTHING_TYPE"}),ERR_UPPER_BODY_NOT_VISIBLE:V("Adjust your position to show your upper body",{id:"ERR_UPPER_BODY_NOT_VISIBLE"}),ERR_HEAD_TOO_CLOSE_TO_EDGE:V("Move your head away from the edge of the frame",{id:"ERR_HEAD_TOO_CLOSE_TO_EDGE"}),ERR_LOWER_BODY_NOT_VISIBLE:V("Adjust your position to show your lower body",{id:"ERR_LOWER_BODY_NOT_VISIBLE"}),ERR_FEET_TOO_CLOSE_TO_EDGE:V("Move your feet away from the edge of the frame",{id:"ERR_FEET_TOO_CLOSE_TO_EDGE"}),ERR_BODY_TOO_CLOSE_TO_EDGE:V("Move your body away from the edge of the frame",{id:"ERR_BODY_TOO_CLOSE_TO_EDGE"}),ERR_BODY_TOO_CLOSE_TO_EDGE_MOVE_LEFT:V("Move to the left to center your body",{id:"ERR_BODY_TOO_CLOSE_TO_EDGE_MOVE_LEFT"}),ERR_BODY_TOO_CLOSE_TO_EDGE_MOVE_RIGHT:V("Move to the right to center your body",{id:"ERR_BODY_TOO_CLOSE_TO_EDGE_MOVE_RIGHT"}),ERR_SHOULDERS_NOT_VISIBLE:V("Adjust your position to show your shoulders",{id:"ERR_SHOULDERS_NOT_VISIBLE"}),ERR_HEIGHT_MEASUREMENT_FAILED:V("Stand straight and ensure your full body is visible",{id:"ERR_HEIGHT_MEASUREMENT_FAILED"}),ERR_HEAD_POINT_NOT_DETECTED:V("Ensure your head is fully visible in the frame",{id:"ERR_HEAD_POINT_NOT_DETECTED"}),ERR_INCORRECT_POSTURE:V("Stand straight with your shoulders back",{id:"ERR_INCORRECT_POSTURE"}),ERR_HEM_MEASUREMENT_FAILED:V("Ensure your clothing hem is visible and clear",{id:"ERR_HEM_MEASUREMENT_FAILED"}),ERR_SHOULDER_MEASUREMENT_FAILED:V("Keep your shoulders relaxed and visible",{id:"ERR_SHOULDER_MEASUREMENT_FAILED"}),ERR_ARM_NOT_STRETCHED:V("Stretch your arms fully",{id:"ERR_ARM_NOT_STRETCHED"}),ERR_LEGS_NOT_DETECTED:V("Ensure your legs are fully visible in the frame",{id:"ERR_LEGS_NOT_DETECTED"}),ERR_HIPS_MEASUREMENT_FAILED:V("Stand straight and ensure your hips are visible",{id:"ERR_HIPS_MEASUREMENT_FAILED"}),ERR_WAIST_MEASUREMENT_FAILED:V("Stand straight and ensure your waist is visible",{id:"ERR_WAIST_MEASUREMENT_FAILED"}),ERR_INVALID_MEASURE_SIDE_VIEW:V("Turn to show a clear side profile",{id:"ERR_INVALID_MEASURE_SIDE_VIEW"}),ERR_INVALID_BODY_HEIGHT_TYPE:V("Ensure your full body is visible for height measurement",{id:"ERR_INVALID_BODY_HEIGHT_TYPE"}),ERR_IMAGE_LOAD_FAILED:V("Try again later; the image could not be processed",{id:"ERR_IMAGE_LOAD_FAILED"}),ERR_HEIGHT_INVALID:V("Height must be between 50 and 300 cm",{id:"ERR_HEIGHT_INVALID"})}}getTranslatedMessage(A){const t=this.errorMap[A];return t||(console.info("Error code is missing",A),V("An unexpected error occurred"))}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleEscKey.bind(this))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleEscKey.bind(this)),this.stopPolling(),clearInterval(this.spinnerInterval)}handleEscKey(A){A.key==="Escape"&&this.showModal&&this.closeModal()}openModal(){this.showModal=!0,this.step=1,this.height=0,this.instructionMessage=V("Position yourself in front of the camera")}closeModal(){this.showModal=!1,this.onMeasurementCanceled&&typeof this.onMeasurementCanceled=="function"&&this.onMeasurementCanceled(),this.stopPolling(),this.dispatchEvent(new CustomEvent("measurementCanceled",{detail:{}}))}async step2advancement(){if(this.height<50||this.height>300){this.errorMessage=this.getTranslatedMessage("ERR_HEIGHT_INVALID");return}this.step=3,this.errorMessage=""}async startMeasurement(){this.step=3,this.errorMessage="",this.shouldStartMeasurement=!0}updated(A){super.updated(A),A.has("step")&&this.step===3&&this.shouldStartMeasurement&&(this.initializeMeasurement(),this.shouldStartMeasurement=!1)}async initializeMeasurement(){this.videoElement=this.shadowRoot.querySelector("video");try{this.stream=await navigator.mediaDevices.getUserMedia({video:!0}),this.videoElement&&(this.videoElement.srcObject=this.stream,await this.videoElement.play(),await this.loadCameras(),this.startPolling())}catch{this.errorMessage=V("Error accessing webcam")}}async loadCameras(){try{const A=await navigator.mediaDevices.enumerateDevices();this.cameras=A.filter(t=>t.kind==="videoinput"),this.cameras.length>0&&(this.currentCameraId=this.cameras[0].deviceId)}catch(A){console.error("Error enumerating devices:",A)}}async flipCamera(){if(this.cameras.length<2)return;this.isLoading=!0,this.stopPolling();const t=(this.cameras.findIndex(l=>l.deviceId===this.currentCameraId)+1)%this.cameras.length;this.currentCameraId=this.cameras[t].deviceId;try{this.stream&&this.stream.getTracks().forEach(l=>l.stop()),this.stream=await navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:this.currentCameraId}}}),this.videoElement&&(this.videoElement.srcObject=this.stream,await this.videoElement.play(),this.startPolling())}catch{this.errorMessage=V("Error switching camera")}finally{this.isLoading=!1}}async startPolling(){const A=async()=>{if(!this.videoElement||!this.stream||this.isFetching)return;const t=document.createElement("canvas");t.width=this.videoElement.videoWidth,t.height=this.videoElement.videoHeight;const l=t.getContext("2d");l==null||l.drawImage(this.videoElement,0,0,t.width,t.height);const e=await new Promise(S=>t.toBlob(q=>S(q),"image/jpeg")),p=new File([e],"frame.jpg",{type:"image/jpeg"}),n=new FormData;n.append("image",p),n.append("height",this.height.toString()),n.append("productSku",this.productSku),this.measurerKey&&n.append("measurerKey",this.measurerKey);try{this.isFetching=!0,this.isLoading=!0,this.poolingTimeout!==null&&(clearTimeout(this.poolingTimeout),this.poolingTimeout=null),this.instructionMessageTimeout!==null&&(clearTimeout(this.instructionMessageTimeout),this.instructionMessageTimeout=null);const q=await(await fetch(this.apiUrl,{method:"POST",body:n,headers:{Accept:"application/json","Cache-Control":"no-store",Pragma:"no-cache","X-Api-Key":this.apiKey}})).json();this.isFetching=!1,this.isLoading=!1,this.errorMessage=JSON.stringify(q),q.success?(this.measurements=q.measurements,this.recommendedSize=q.chosenSize,this.instructionMessage=V("Measurement successful!"),this.stopPolling(),this.step=4):(this.instructionMessage=this.getTranslatedMessage(q.message||"UNKNOWN_ERROR"),this.instructionMessageTimeout=setTimeout(()=>{this.recommendedSize||(this.instructionMessage=V("Position yourself in front of the camera"),this.poolingTimeout=setTimeout(A,0))},2e3))}catch{this.isFetching=!1,this.isLoading=!1,this.instructionMessage=V("Error processing measurement"),this.instructionMessageTimeout=setTimeout(()=>{this.recommendedSize||(this.instructionMessage=V("Position yourself in front of the camera"),this.poolingTimeout=setTimeout(A,0))},2e3)}};A()}stopPolling(){this.poolingTimeout!==null&&(clearTimeout(this.poolingTimeout),this.poolingTimeout=null),this.instructionMessageTimeout!==null&&(clearTimeout(this.instructionMessageTimeout),this.instructionMessageTimeout=null),this.stream&&(this.stream.getTracks().forEach(A=>A.stop()),this.stream=null)}acceptMeasurement(){this.dispatchEvent(new CustomEvent("measurementAccepted",{detail:{size:this.recommendedSize}})),this.onMeasurementAccepted&&typeof this.onMeasurementAccepted=="function"&&this.onMeasurementAccepted(),this.showModal=!1,this.stopPolling()}resetMeasurement(){this.step=1,this.height=0,this.recommendedSize="",this.measurements={},this.stopPolling()}stopMeasurement(){this.resetMeasurement(),this.showModal=!1}render(){return this._isLocaleLoading?J`<div hidden></div>`:J`
|
|
1007
|
+
<xact-button @click=${this.openModal} label="${V("Find your Xactsize")}"></xact-button>
|
|
938
1008
|
|
|
939
1009
|
${this.showModal?J`
|
|
940
1010
|
<div class="modal">
|
|
@@ -957,7 +1027,7 @@ label="${n("Let's go!")}"
|
|
|
957
1027
|
${this.step===3?J`
|
|
958
1028
|
<div class="step-3">
|
|
959
1029
|
|
|
960
|
-
<p>${
|
|
1030
|
+
<p>${V("Ensure your full body is visible in the camera")}</p>
|
|
961
1031
|
<div class='video-container'>
|
|
962
1032
|
<div class="video-overlay">
|
|
963
1033
|
<h2>${this.instructionMessage}</h2>
|
package/package.json
CHANGED