xactsize-webcomponents 1.0.37 → 1.0.38

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.
@@ -108,8 +108,8 @@ let H = class extends HTMLElement {
108
108
  this[e] = r;
109
109
  } };
110
110
  return { get: o, set(r) {
111
- const p = o == null ? void 0 : o.call(this);
112
- n == null || n.call(this, r), this.requestUpdate(t, p, s);
111
+ const l = o == null ? void 0 : o.call(this);
112
+ n == null || n.call(this, r), this.requestUpdate(t, l, s);
113
113
  }, configurable: !0, enumerable: !0 };
114
114
  }
115
115
  static getPropertyOptions(t) {
@@ -205,8 +205,8 @@ let H = class extends HTMLElement {
205
205
  var n, r;
206
206
  const s = this.constructor, o = s._$Eh.get(t);
207
207
  if (o !== void 0 && this._$Em !== o) {
208
- const p = s.getPropertyOptions(o), l = typeof p.converter == "function" ? { fromAttribute: p.converter } : ((n = p.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? p.converter : _;
209
- this._$Em = o, this[o] = l.fromAttribute(e, p.type) ?? ((r = this._$Ej) == null ? void 0 : r.get(o)) ?? null, this._$Em = null;
208
+ const l = s.getPropertyOptions(o), p = typeof l.converter == "function" ? { fromAttribute: l.converter } : ((n = l.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? l.converter : _;
209
+ this._$Em = o, this[o] = p.fromAttribute(e, l.type) ?? ((r = this._$Ej) == null ? void 0 : r.get(o)) ?? null, this._$Em = null;
210
210
  }
211
211
  }
212
212
  requestUpdate(t, e, s) {
@@ -244,8 +244,8 @@ let H = class extends HTMLElement {
244
244
  }
245
245
  const o = this.constructor.elementProperties;
246
246
  if (o.size > 0) for (const [n, r] of o) {
247
- const { wrapped: p } = r, l = this[n];
248
- p !== !0 || this._$AL.has(n) || l === void 0 || this.C(n, void 0, r, l);
247
+ const { wrapped: l } = r, p = this[n];
248
+ l !== !0 || this._$AL.has(n) || p === void 0 || this.C(n, void 0, r, p);
249
249
  }
250
250
  }
251
251
  let t = !1;
@@ -305,12 +305,12 @@ function Vt(i, t) {
305
305
  const oe = (i, t) => {
306
306
  const e = i.length - 1, s = [];
307
307
  let o, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", r = V;
308
- for (let p = 0; p < e; p++) {
309
- const l = i[p];
310
- let c, A, u = -1, C = 0;
311
- for (; C < l.length && (r.lastIndex = C, A = r.exec(l), A !== null); ) C = r.lastIndex, r === V ? A[1] === "!--" ? r = Et : A[1] !== void 0 ? r = Mt : A[2] !== void 0 ? (Tt.test(A[2]) && (o = RegExp("</" + A[2], "g")), r = L) : A[3] !== void 0 && (r = L) : r === L ? A[0] === ">" ? (r = o ?? V, u = -1) : A[1] === void 0 ? u = -2 : (u = r.lastIndex - A[2].length, c = A[1], r = A[3] === void 0 ? L : A[3] === '"' ? kt : bt) : r === kt || r === bt ? r = L : r === Et || r === Mt ? r = V : (r = L, o = void 0);
312
- const M = r === L && i[p + 1].startsWith("/>") ? " " : "";
313
- n += r === V ? l + ee : u >= 0 ? (s.push(c), l.slice(0, u) + Ot + l.slice(u) + b + M) : l + b + (u === -2 ? p : M);
308
+ for (let l = 0; l < e; l++) {
309
+ const p = i[l];
310
+ let d, u, f = -1, C = 0;
311
+ for (; C < p.length && (r.lastIndex = C, u = r.exec(p), u !== null); ) C = r.lastIndex, r === V ? u[1] === "!--" ? r = Et : u[1] !== void 0 ? r = Mt : u[2] !== void 0 ? (Tt.test(u[2]) && (o = RegExp("</" + u[2], "g")), r = L) : u[3] !== void 0 && (r = L) : r === L ? u[0] === ">" ? (r = o ?? V, f = -1) : u[1] === void 0 ? f = -2 : (f = r.lastIndex - u[2].length, d = u[1], r = u[3] === void 0 ? L : u[3] === '"' ? kt : bt) : r === kt || r === bt ? r = L : r === Et || r === Mt ? r = V : (r = L, o = void 0);
312
+ const M = r === L && i[l + 1].startsWith("/>") ? " " : "";
313
+ n += r === V ? p + ee : f >= 0 ? (s.push(d), p.slice(0, f) + Ot + p.slice(f) + b + M) : p + b + (f === -2 ? l : M);
314
314
  }
315
315
  return [Vt(i, n + (i[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
316
316
  };
@@ -319,29 +319,29 @@ class W {
319
319
  let o;
320
320
  this.parts = [];
321
321
  let n = 0, r = 0;
322
- const p = t.length - 1, l = this.parts, [c, A] = oe(t, e);
323
- if (this.el = W.createElement(c, s), D.currentNode = this.el.content, e === 2 || e === 3) {
324
- const u = this.el.content.firstChild;
325
- u.replaceWith(...u.childNodes);
322
+ const l = t.length - 1, p = this.parts, [d, u] = oe(t, e);
323
+ if (this.el = W.createElement(d, s), D.currentNode = this.el.content, e === 2 || e === 3) {
324
+ const f = this.el.content.firstChild;
325
+ f.replaceWith(...f.childNodes);
326
326
  }
327
- for (; (o = D.nextNode()) !== null && l.length < p; ) {
327
+ for (; (o = D.nextNode()) !== null && p.length < l; ) {
328
328
  if (o.nodeType === 1) {
329
- if (o.hasAttributes()) for (const u of o.getAttributeNames()) if (u.endsWith(Ot)) {
330
- const C = A[r++], M = o.getAttribute(u).split(b), K = /([.?@])?(.*)/.exec(C);
331
- l.push({ type: 1, index: n, name: K[2], strings: M, ctor: K[1] === "." ? re : K[1] === "?" ? ae : K[1] === "@" ? le : it }), o.removeAttribute(u);
332
- } else u.startsWith(b) && (l.push({ type: 6, index: n }), o.removeAttribute(u));
329
+ if (o.hasAttributes()) for (const f of o.getAttributeNames()) if (f.endsWith(Ot)) {
330
+ const C = u[r++], M = o.getAttribute(f).split(b), K = /([.?@])?(.*)/.exec(C);
331
+ p.push({ type: 1, index: n, name: K[2], strings: M, ctor: K[1] === "." ? re : K[1] === "?" ? ae : K[1] === "@" ? le : it }), o.removeAttribute(f);
332
+ } else f.startsWith(b) && (p.push({ type: 6, index: n }), o.removeAttribute(f));
333
333
  if (Tt.test(o.tagName)) {
334
- const u = o.textContent.split(b), C = u.length - 1;
334
+ const f = o.textContent.split(b), C = f.length - 1;
335
335
  if (C > 0) {
336
336
  o.textContent = $ ? $.emptyScript : "";
337
- for (let M = 0; M < C; M++) o.append(u[M], Z()), D.nextNode(), l.push({ type: 2, index: ++n });
338
- o.append(u[C], Z());
337
+ for (let M = 0; M < C; M++) o.append(f[M], Z()), D.nextNode(), p.push({ type: 2, index: ++n });
338
+ o.append(f[C], Z());
339
339
  }
340
340
  }
341
- } else if (o.nodeType === 8) if (o.data === It) l.push({ type: 2, index: n });
341
+ } else if (o.nodeType === 8) if (o.data === It) p.push({ type: 2, index: n });
342
342
  else {
343
- let u = -1;
344
- for (; (u = o.data.indexOf(b, u + 1)) !== -1; ) l.push({ type: 7, index: n }), u += b.length - 1;
343
+ let f = -1;
344
+ for (; (f = o.data.indexOf(b, f + 1)) !== -1; ) p.push({ type: 7, index: n }), f += b.length - 1;
345
345
  }
346
346
  n++;
347
347
  }
@@ -352,11 +352,11 @@ class W {
352
352
  }
353
353
  }
354
354
  function O(i, t, e = i, s) {
355
- var r, p;
355
+ var r, l;
356
356
  if (t === R) return t;
357
357
  let o = s !== void 0 ? (r = e._$Co) == null ? void 0 : r[s] : e._$Cl;
358
358
  const n = Q(t) ? void 0 : t._$litDirective$;
359
- return (o == null ? void 0 : o.constructor) !== n && ((p = o == null ? void 0 : o._$AO) == null || p.call(o, !1), n === void 0 ? o = void 0 : (o = new n(i), o._$AT(i, e, s)), s !== void 0 ? (e._$Co ?? (e._$Co = []))[s] = o : e._$Cl = o), o !== void 0 && (t = O(i, o._$AS(i, t.values), o, s)), t;
359
+ return (o == null ? void 0 : o.constructor) !== n && ((l = o == null ? void 0 : o._$AO) == null || l.call(o, !1), n === void 0 ? o = void 0 : (o = new n(i), o._$AT(i, e, s)), s !== void 0 ? (e._$Co ?? (e._$Co = []))[s] = o : e._$Cl = o), o !== void 0 && (t = O(i, o._$AS(i, t.values), o, s)), t;
360
360
  }
361
361
  class ne {
362
362
  constructor(t, e) {
@@ -371,13 +371,13 @@ class ne {
371
371
  u(t) {
372
372
  const { el: { content: e }, parts: s } = this._$AD, o = ((t == null ? void 0 : t.creationScope) ?? S).importNode(e, !0);
373
373
  D.currentNode = o;
374
- let n = D.nextNode(), r = 0, p = 0, l = s[0];
375
- for (; l !== void 0; ) {
376
- if (r === l.index) {
377
- let c;
378
- l.type === 2 ? c = new j(n, n.nextSibling, this, t) : l.type === 1 ? c = new l.ctor(n, l.name, l.strings, this, t) : l.type === 6 && (c = new pe(n, this, t)), this._$AV.push(c), l = s[++p];
374
+ let n = D.nextNode(), r = 0, l = 0, p = s[0];
375
+ for (; p !== void 0; ) {
376
+ if (r === p.index) {
377
+ let d;
378
+ p.type === 2 ? d = new j(n, n.nextSibling, this, t) : p.type === 1 ? d = new p.ctor(n, p.name, p.strings, this, t) : p.type === 6 && (d = new pe(n, this, t)), this._$AV.push(d), p = s[++l];
379
379
  }
380
- r !== (l == null ? void 0 : l.index) && (n = D.nextNode(), r++);
380
+ r !== (p == null ? void 0 : p.index) && (n = D.nextNode(), r++);
381
381
  }
382
382
  return D.currentNode = S, o;
383
383
  }
@@ -422,8 +422,8 @@ class j {
422
422
  const { values: e, _$litType$: s } = t, o = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = W.createElement(Vt(s.h, s.h[0]), this.options)), s);
423
423
  if (((n = this._$AH) == null ? void 0 : n._$AD) === o) this._$AH.p(e);
424
424
  else {
425
- const r = new ne(o, this), p = r.u(this.options);
426
- r.p(e), this.T(p), this._$AH = r;
425
+ const r = new ne(o, this), l = r.u(this.options);
426
+ r.p(e), this.T(l), this._$AH = r;
427
427
  }
428
428
  }
429
429
  _$AC(t) {
@@ -464,9 +464,9 @@ class it {
464
464
  let r = !1;
465
465
  if (n === void 0) t = O(this, t, e, 0), r = !Q(t) || t !== this._$AH && t !== R, r && (this._$AH = t);
466
466
  else {
467
- const p = t;
468
- let l, c;
469
- for (t = n[0], l = 0; l < n.length - 1; l++) c = O(this, p[s + l], e, l), c === R && (c = this._$AH[l]), r || (r = !Q(c) || c !== this._$AH[l]), c === g ? t = g : t !== g && (t += (c ?? "") + n[l + 1]), this._$AH[l] = c;
467
+ const l = t;
468
+ let p, d;
469
+ for (t = n[0], p = 0; p < n.length - 1; p++) d = O(this, l[s + p], e, p), d === R && (d = this._$AH[p]), r || (r = !Q(d) || d !== this._$AH[p]), d === g ? t = g : t !== g && (t += (d ?? "") + n[p + 1]), this._$AH[p] = d;
470
470
  }
471
471
  r && !o && this.j(t);
472
472
  }
@@ -582,23 +582,23 @@ const he = { attribute: !0, type: String, converter: _, reflect: !1, hasChanged:
582
582
  let n = globalThis.litPropertyMetadata.get(o);
583
583
  if (n === void 0 && globalThis.litPropertyMetadata.set(o, n = /* @__PURE__ */ new Map()), s === "setter" && ((i = Object.create(i)).wrapped = !0), n.set(e.name, i), s === "accessor") {
584
584
  const { name: r } = e;
585
- return { set(p) {
586
- const l = t.get.call(this);
587
- t.set.call(this, p), this.requestUpdate(r, l, i);
588
- }, init(p) {
589
- return p !== void 0 && this.C(r, void 0, i, p), p;
585
+ return { set(l) {
586
+ const p = t.get.call(this);
587
+ t.set.call(this, l), this.requestUpdate(r, p, i);
588
+ }, init(l) {
589
+ return l !== void 0 && this.C(r, void 0, i, l), l;
590
590
  } };
591
591
  }
592
592
  if (s === "setter") {
593
593
  const { name: r } = e;
594
- return function(p) {
595
- const l = this[r];
596
- t.call(this, p), this.requestUpdate(r, l, i);
594
+ return function(l) {
595
+ const p = this[r];
596
+ t.call(this, l), this.requestUpdate(r, p, i);
597
597
  };
598
598
  }
599
599
  throw Error("Unsupported decorator location: " + s);
600
600
  };
601
- function f(i) {
601
+ function A(i) {
602
602
  return (t, e) => typeof e == "object" ? de(i, t, e) : ((s, o, n) => {
603
603
  const r = o.hasOwnProperty(n);
604
604
  return o.constructor.createProperty(n, s), r ? Object.getOwnPropertyDescriptor(o, n) : void 0;
@@ -610,7 +610,7 @@ function f(i) {
610
610
  * SPDX-License-Identifier: BSD-3-Clause
611
611
  */
612
612
  function y(i) {
613
- return f({ ...i, state: !0, attribute: !1 });
613
+ return A({ ...i, state: !0, attribute: !1 });
614
614
  }
615
615
  /**
616
616
  * @license
@@ -697,10 +697,10 @@ const v = [];
697
697
  for (let i = 0; i < 256; i++)
698
698
  v[i] = (i >> 4 & 15).toString(16) + (i & 15).toString(16);
699
699
  function we(i) {
700
- let t = 0, e = 8997, s = 0, o = 33826, n = 0, r = 40164, p = 0, l = 52210;
701
- for (let c = 0; c < i.length; c++)
702
- e ^= i.charCodeAt(c), t = e * 435, s = o * 435, n = r * 435, p = l * 435, n += e << 8, p += o << 8, s += t >>> 16, e = t & 65535, n += s >>> 16, o = s & 65535, l = p + (n >>> 16) & 65535, r = n & 65535;
703
- return v[l >> 8] + v[l & 255] + v[r >> 8] + v[r & 255] + v[o >> 8] + v[o & 255] + v[e >> 8] + v[e & 255];
700
+ let t = 0, e = 8997, s = 0, o = 33826, n = 0, r = 40164, l = 0, p = 52210;
701
+ for (let d = 0; d < i.length; d++)
702
+ e ^= i.charCodeAt(d), t = e * 435, s = o * 435, n = r * 435, l = p * 435, n += e << 8, l += o << 8, s += t >>> 16, e = t & 65535, n += s >>> 16, o = s & 65535, p = l + (n >>> 16) & 65535, r = n & 65535;
703
+ return v[p >> 8] + v[p & 255] + v[r >> 8] + v[r & 255] + v[o >> 8] + v[o & 255] + v[e >> 8] + v[e & 255];
704
704
  }
705
705
  /**
706
706
  * @license
@@ -941,16 +941,16 @@ B.styles = I`
941
941
  }
942
942
  `;
943
943
  Y([
944
- f({ type: String })
944
+ A({ type: String })
945
945
  ], B.prototype, "type", 2);
946
946
  Y([
947
- f({ type: String })
947
+ A({ type: String })
948
948
  ], B.prototype, "label", 2);
949
949
  Y([
950
- f({ type: Boolean })
950
+ A({ type: Boolean })
951
951
  ], B.prototype, "disabled", 2);
952
952
  Y([
953
- f({ type: String })
953
+ A({ type: String })
954
954
  ], B.prototype, "variant", 2);
955
955
  B = Y([
956
956
  T("xact-button")
@@ -1209,10 +1209,10 @@ z.styles = I`
1209
1209
  }
1210
1210
  `;
1211
1211
  mt([
1212
- f({ type: Number })
1212
+ A({ type: Number })
1213
1213
  ], z.prototype, "height", 2);
1214
1214
  mt([
1215
- f({ type: Function })
1215
+ A({ type: Function })
1216
1216
  ], z.prototype, "onStartMeasurement", 2);
1217
1217
  z = mt([
1218
1218
  T("xact-step-one"),
@@ -1479,28 +1479,28 @@ x.styles = I`
1479
1479
  }
1480
1480
  `;
1481
1481
  E([
1482
- f({ type: String })
1482
+ A({ type: String })
1483
1483
  ], x.prototype, "productName", 2);
1484
1484
  E([
1485
- f({ type: String })
1485
+ A({ type: String })
1486
1486
  ], x.prototype, "recommendedSize", 2);
1487
1487
  E([
1488
- f({ type: String })
1488
+ A({ type: String })
1489
1489
  ], x.prototype, "productSku", 2);
1490
1490
  E([
1491
- f({ type: String })
1491
+ A({ type: String })
1492
1492
  ], x.prototype, "generatedImageUrl", 2);
1493
1493
  E([
1494
- f({ type: Boolean })
1494
+ A({ type: Boolean })
1495
1495
  ], x.prototype, "isVtonFetching", 2);
1496
1496
  E([
1497
- f({ type: Boolean })
1497
+ A({ type: Boolean })
1498
1498
  ], x.prototype, "vtonError", 2);
1499
1499
  E([
1500
- f({ type: Function })
1500
+ A({ type: Function })
1501
1501
  ], x.prototype, "onAccept", 2);
1502
1502
  E([
1503
- f({ type: Function })
1503
+ A({ type: Function })
1504
1504
  ], x.prototype, "onRetry", 2);
1505
1505
  x = E([
1506
1506
  T("xact-step-result"),
@@ -1863,10 +1863,10 @@ N.styles = I`
1863
1863
 
1864
1864
  `;
1865
1865
  gt([
1866
- f({ type: Number })
1866
+ A({ type: Number })
1867
1867
  ], N.prototype, "height", 2);
1868
1868
  gt([
1869
- f({ type: Function })
1869
+ A({ type: Function })
1870
1870
  ], N.prototype, "onStep2advancement", 2);
1871
1871
  N = gt([
1872
1872
  T("xact-step-informs"),
@@ -1926,60 +1926,61 @@ class Ke {
1926
1926
  }
1927
1927
  }
1928
1928
  class Je {
1929
- constructor(t) {
1930
- this.ws = null, this.apiUrl = t, this.audioManager = new Ke();
1929
+ constructor(t, e) {
1930
+ this.ws = null, this.apiUrl = t, this.apiKey = e, this.audioManager = new Ke();
1931
1931
  }
1932
1932
  async connect() {
1933
1933
  try {
1934
- const e = `${new URL(this.apiUrl).origin}`, s = await fetch(`${e}/api/ConversationalAI/ticket`, {
1934
+ const t = await fetch(`${this.apiUrl}/api/ConversationalAI/ticket`, {
1935
1935
  method: "POST",
1936
1936
  headers: {
1937
- "Content-Type": "application/json"
1937
+ "Content-Type": "application/json",
1938
+ "X-Api-Key": this.apiKey
1938
1939
  }
1939
1940
  });
1940
- if (!s.ok) {
1941
- console.error("Failed to get ticket", s.statusText);
1941
+ if (!t.ok) {
1942
+ console.error("Failed to get ticket", t.statusText);
1942
1943
  return;
1943
1944
  }
1944
- const o = await s.json();
1945
- if (!o || !o.ticket_id) {
1945
+ const e = await t.json();
1946
+ if (!e || !e.ticket_id) {
1946
1947
  console.error("Invalid ticket response");
1947
1948
  return;
1948
1949
  }
1949
- const n = "wss://conversational-ai-service-923169850574.southamerica-east1.run.app", r = crypto.randomUUID(), p = `${n}/ws/chat/${r}/${o.ticket_id}`;
1950
- this.ws = new WebSocket(p), this.ws.binaryType = "arraybuffer", this.ws.onopen = () => {
1950
+ const s = "wss://conversational-ai-service-923169850574.southamerica-east1.run.app", o = crypto.randomUUID(), n = `${s}/ws/chat/${o}/${e.ticket_id}`;
1951
+ this.ws = new WebSocket(n), this.ws.binaryType = "arraybuffer", this.ws.onopen = () => {
1951
1952
  console.log("AI session connected. Waiting for greeting...");
1952
- }, this.ws.onmessage = (l) => {
1953
- if (l.data instanceof ArrayBuffer) {
1954
- this.audioManager.queueAudio(l.data);
1953
+ }, this.ws.onmessage = (r) => {
1954
+ if (r.data instanceof ArrayBuffer) {
1955
+ this.audioManager.queueAudio(r.data);
1955
1956
  return;
1956
1957
  }
1957
1958
  try {
1958
- const c = JSON.parse(l.data);
1959
- switch (c.type) {
1959
+ const l = JSON.parse(r.data);
1960
+ switch (l.type) {
1960
1961
  case "user":
1961
- console.log("User said:", c.text);
1962
+ console.log("User said:", l.text);
1962
1963
  break;
1963
1964
  case "gemini":
1964
- console.log("Glamursa said:", c.text);
1965
+ console.log("Glamursa said:", l.text);
1965
1966
  break;
1966
1967
  case "interrupted":
1967
1968
  this.audioManager.clearPlaybackQueue();
1968
1969
  break;
1969
1970
  case "error":
1970
- console.error("AI session error:", c.error);
1971
+ console.error("AI session error:", l.error);
1971
1972
  break;
1972
1973
  case "turn_complete":
1973
1974
  this.onTurnComplete && this.onTurnComplete();
1974
1975
  break;
1975
1976
  }
1976
- } catch (c) {
1977
- console.error("Error parsing WS message:", c);
1977
+ } catch (l) {
1978
+ console.error("Error parsing WS message:", l);
1978
1979
  }
1979
- }, this.ws.onclose = (l) => {
1980
- l.code === 4003 && console.error("Ticket was invalid or expired"), console.log("AI session disconnected.");
1981
- }, this.ws.onerror = (l) => {
1982
- console.error("AI Session WebSocket Error:", l);
1980
+ }, this.ws.onclose = (r) => {
1981
+ r.code === 4003 && console.error("Ticket was invalid or expired"), console.log("AI session disconnected.");
1982
+ }, this.ws.onerror = (r) => {
1983
+ console.error("AI Session WebSocket Error:", r);
1983
1984
  };
1984
1985
  } catch (t) {
1985
1986
  console.error("Failed to connect to AI session:", t);
@@ -2000,7 +2001,7 @@ class Je {
2000
2001
  this.audioManager.stopAll(), this.ws && (this.ws.close(1e3, "Measurement complete"), this.ws = null);
2001
2002
  }
2002
2003
  }
2003
- var qe = Object.defineProperty, _e = Object.getOwnPropertyDescriptor, d = (i, t, e, s) => {
2004
+ var qe = Object.defineProperty, _e = Object.getOwnPropertyDescriptor, h = (i, t, e, s) => {
2004
2005
  for (var o = s > 1 ? void 0 : s ? _e(t, e) : t, n = i.length - 1, r; n >= 0; n--)
2005
2006
  (r = i[n]) && (o = (s ? r(t, e, o) : r(o)) || o);
2006
2007
  return s && o && qe(t, e, o), o;
@@ -2008,11 +2009,11 @@ var qe = Object.defineProperty, _e = Object.getOwnPropertyDescriptor, d = (i, t,
2008
2009
  const { getLocale: ii, setLocale: Rt } = Le({
2009
2010
  sourceLocale: zt,
2010
2011
  targetLocales: Ue,
2011
- loadLocale: (i) => Nt(/* @__PURE__ */ Object.assign({ "./generated/locales/pt-BR.ts": () => import("./pt-BR-BNfqJsJM.mjs") }), `./generated/locales/${i}.ts`, 4)
2012
+ loadLocale: (i) => Nt(/* @__PURE__ */ Object.assign({ "./generated/locales/pt-BR.ts": () => import("./pt-BR-IYFOldpG.mjs") }), `./generated/locales/${i}.ts`, 4)
2012
2013
  });
2013
- let h = class extends w {
2014
+ let c = class extends w {
2014
2015
  constructor() {
2015
- 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.vtonUrl = "https://xactsize-dotnet-api-923169850574.southamerica-east1.run.app/api/VirtualTryOn/generate", this.garmentUrl = "", this.vton = !1, 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 = a("Position yourself in front of the camera"), this.shouldStartMeasurement = !1, this.isLoading = !1, this.isFetching = !1, this.generatedImageUrl = "", this.isVtonFetching = !1, this.vtonError = !1, this.videoElement = null, this.stream = null, this.poolingTimeout = null, this.instructionMessageTimeout = null, this.aiSession = null, this.cameras = [], this.currentCameraId = null, this.snowflakesCache = null;
2016
+ super(...arguments), this.spinnerFrame = 0, this.apiKey = "DB8mP9gStPfvdyeYbbuCV4Zf3SH745dI", this.tenantId = "1", this.productSku = "123456", this.baseUrl = "https://xactsize-dotnet-api-923169850574.southamerica-east1.run.app", this.apiUrl = this.baseUrl + "/api/measurer/measure/body", this.vtonUrl = this.baseUrl + "/api/VirtualTryOn/generate", this.garmentUrl = "", this.vton = !1, 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 = a("Position yourself in front of the camera"), this.shouldStartMeasurement = !1, this.isLoading = !1, this.isFetching = !1, this.generatedImageUrl = "", this.isVtonFetching = !1, this.vtonError = !1, this.videoElement = null, this.stream = null, this.poolingTimeout = null, this.instructionMessageTimeout = null, this.aiSession = null, this.cameras = [], this.currentCameraId = null, this.snowflakesCache = null;
2016
2017
  }
2017
2018
  firstUpdated() {
2018
2019
  this.startSpinnerAnimation();
@@ -2117,7 +2118,7 @@ let h = class extends w {
2117
2118
  async initializeMeasurement() {
2118
2119
  this.videoElement = this.shadowRoot.querySelector("video");
2119
2120
  try {
2120
- this.stream = await navigator.mediaDevices.getUserMedia({ video: !0 }), this.videoElement && (this.videoElement.srcObject = this.stream, await this.videoElement.play(), await this.loadCameras(), this.aiSession = new Je(this.apiUrl), await this.aiSession.connect(), this.aiSession.startMicrophone(), this.startPolling());
2121
+ this.stream = await navigator.mediaDevices.getUserMedia({ video: !0 }), this.videoElement && (this.videoElement.srcObject = this.stream, await this.videoElement.play(), await this.loadCameras(), this.aiSession = new Je(this.baseUrl, this.apiKey), await this.aiSession.connect(), this.aiSession.startMicrophone(), this.startPolling());
2121
2122
  } catch {
2122
2123
  this.errorMessage = a("Error accessing webcam");
2123
2124
  }
@@ -2147,21 +2148,21 @@ let h = class extends w {
2147
2148
  }
2148
2149
  async startPolling() {
2149
2150
  const t = [], e = async () => {
2150
- var l;
2151
+ var p;
2151
2152
  if (!this.videoElement || !this.stream || this.isFetching) return;
2152
2153
  const s = document.createElement("canvas");
2153
2154
  s.width = this.videoElement.videoWidth, s.height = this.videoElement.videoHeight;
2154
2155
  const o = s.getContext("2d");
2155
2156
  o == null || o.drawImage(this.videoElement, 0, 0, s.width, s.height);
2156
2157
  const n = await new Promise(
2157
- (c) => s.toBlob((A) => c(A), "image/jpeg")
2158
- ), r = new File([n], "frame.jpg", { type: "image/jpeg" }), p = new FormData();
2159
- p.append("image", r), p.append("height", this.height.toString()), p.append("productSku", this.productSku), this.measurerKey && p.append("measurerKey", this.measurerKey);
2158
+ (d) => s.toBlob((u) => d(u), "image/jpeg")
2159
+ ), r = new File([n], "frame.jpg", { type: "image/jpeg" }), l = new FormData();
2160
+ l.append("image", r), l.append("height", this.height.toString()), l.append("productSku", this.productSku), this.measurerKey && l.append("measurerKey", this.measurerKey);
2160
2161
  try {
2161
2162
  this.isFetching = !0, this.isLoading = !0, this.poolingTimeout && clearTimeout(this.poolingTimeout), this.instructionMessageTimeout && clearTimeout(this.instructionMessageTimeout);
2162
- const A = await (await fetch(this.apiUrl, {
2163
+ const u = await (await fetch(this.apiUrl, {
2163
2164
  method: "POST",
2164
- body: p,
2165
+ body: l,
2165
2166
  headers: {
2166
2167
  Accept: "application/json",
2167
2168
  "Cache-Control": "no-store",
@@ -2169,12 +2170,12 @@ let h = class extends w {
2169
2170
  "X-Api-Key": this.apiKey
2170
2171
  }
2171
2172
  })).json();
2172
- if (this.isFetching = !1, this.isLoading = !1, A.success && A.chosenSize) {
2173
- this.generateVtonImage(r), t.push(A);
2174
- const u = t.length;
2175
- this.instructionMessage = a(ue`Scanning... ${u}/${3}`), u >= 3 ? (this.processFinalResults(t), this.stopPolling(), this.step = 4) : this.poolingTimeout = setTimeout(e, 500);
2173
+ if (this.isFetching = !1, this.isLoading = !1, u.success && u.chosenSize) {
2174
+ this.generateVtonImage(r), t.push(u);
2175
+ const f = t.length;
2176
+ this.instructionMessage = a(ue`Scanning... ${f}/${3}`), f >= 3 ? (this.processFinalResults(t), this.stopPolling(), this.step = 4) : this.poolingTimeout = setTimeout(e, 500);
2176
2177
  } else
2177
- this.instructionMessage = this.getTranslatedMessage(A.message || "UNKNOWN_ERROR"), A.message && ((l = this.aiSession) == null || l.forwardCvError(this.instructionMessage)), this.instructionMessageTimeout = setTimeout(() => {
2178
+ this.instructionMessage = this.getTranslatedMessage(u.message || "UNKNOWN_ERROR"), u.message && ((p = this.aiSession) == null || p.forwardCvError(this.instructionMessage)), this.instructionMessageTimeout = setTimeout(() => {
2178
2179
  t.length < 3 && (this.poolingTimeout = setTimeout(e, 0));
2179
2180
  }, 2e3);
2180
2181
  } catch {
@@ -2206,25 +2207,25 @@ let h = class extends w {
2206
2207
  }
2207
2208
  // New helper to average measurements and vote on size
2208
2209
  processFinalResults(i) {
2209
- console.group("Scan Debug Report"), console.log(`✅ Collected ${i.length} successful scans.`), i.forEach((r, p) => {
2210
- console.log(`Scan #${p + 1}: Size [${r.chosenSize}] | Chest: ${r.measurements.chest} | Waist: ${r.measurements.waist}`);
2210
+ console.group("Scan Debug Report"), console.log(`✅ Collected ${i.length} successful scans.`), i.forEach((r, l) => {
2211
+ console.log(`Scan #${l + 1}: Size [${r.chosenSize}] | Chest: ${r.measurements.chest} | Waist: ${r.measurements.waist}`);
2211
2212
  });
2212
2213
  const t = {};
2213
2214
  Object.keys(i[0].measurements || {}).forEach((r) => {
2214
- let p = 0, l = 0;
2215
- i.forEach((c) => {
2216
- const A = c.measurements[r];
2217
- typeof A == "number" && (p += A, l++);
2218
- }), t[r] = l > 0 ? Math.round(p / l * 100) / 100 : 0;
2215
+ let l = 0, p = 0;
2216
+ i.forEach((d) => {
2217
+ const u = d.measurements[r];
2218
+ typeof u == "number" && (l += u, p++);
2219
+ }), t[r] = p > 0 ? Math.round(l / p * 100) / 100 : 0;
2219
2220
  }), console.log("📏 Final Averaged Measurements:", t);
2220
2221
  const s = {};
2221
2222
  i.forEach((r) => {
2222
- const p = r.chosenSize;
2223
- p && (s[p] = (s[p] || 0) + 1);
2223
+ const l = r.chosenSize;
2224
+ l && (s[l] = (s[l] || 0) + 1);
2224
2225
  }), console.log("🗳️ Voting Results:", s);
2225
2226
  let o = "", n = 0;
2226
- for (const [r, p] of Object.entries(s))
2227
- p > n && (n = p, o = r);
2227
+ for (const [r, l] of Object.entries(s))
2228
+ l > n && (n = l, o = r);
2228
2229
  console.log(`🏆 WINNER: ${o}`), console.groupEnd(), this.measurements = t, this.recommendedSize = o, this.instructionMessage = a("Measurement successful!"), this.aiSession && (this.aiSession.onTurnComplete = () => {
2229
2230
  var r;
2230
2231
  (r = this.aiSession) == null || r.disconnect(), this.aiSession = null;
@@ -2338,7 +2339,7 @@ let h = class extends w {
2338
2339
  `;
2339
2340
  }
2340
2341
  };
2341
- h.styles = I`
2342
+ c.styles = I`
2342
2343
  :host {
2343
2344
  display: block;
2344
2345
  font-family: Arial, sans-serif;
@@ -2866,96 +2867,99 @@ h.styles = I`
2866
2867
 
2867
2868
 
2868
2869
  `;
2869
- d([
2870
- f({ type: String, attribute: "api-key" })
2871
- ], h.prototype, "apiKey", 2);
2872
- d([
2873
- f({ type: String, attribute: "tenant-id" })
2874
- ], h.prototype, "tenantId", 2);
2875
- d([
2876
- f({ type: String, attribute: "product-sku" })
2877
- ], h.prototype, "productSku", 2);
2878
- d([
2879
- f({ type: String, attribute: "api-url" })
2880
- ], h.prototype, "apiUrl", 2);
2881
- d([
2882
- f({ type: String, attribute: "vton-url" })
2883
- ], h.prototype, "vtonUrl", 2);
2884
- d([
2885
- f({ type: String, attribute: "garment-url" })
2886
- ], h.prototype, "garmentUrl", 2);
2887
- d([
2888
- f({ type: Boolean, attribute: "vton" })
2889
- ], h.prototype, "vton", 2);
2890
- d([
2891
- f({ type: Function, attribute: "onmeasurementaccepted" })
2892
- ], h.prototype, "onMeasurementAccepted", 2);
2893
- d([
2894
- f({ type: Function, attribute: "onmeasurementcanceled" })
2895
- ], h.prototype, "onMeasurementCanceled", 2);
2896
- d([
2897
- f({ type: String })
2898
- ], h.prototype, "culture", 1);
2899
- d([
2870
+ h([
2871
+ A({ type: String, attribute: "api-key" })
2872
+ ], c.prototype, "apiKey", 2);
2873
+ h([
2874
+ A({ type: String, attribute: "tenant-id" })
2875
+ ], c.prototype, "tenantId", 2);
2876
+ h([
2877
+ A({ type: String, attribute: "product-sku" })
2878
+ ], c.prototype, "productSku", 2);
2879
+ h([
2880
+ A({ type: String, attribute: "base-url" })
2881
+ ], c.prototype, "baseUrl", 2);
2882
+ h([
2883
+ A({ type: String, attribute: "api-url" })
2884
+ ], c.prototype, "apiUrl", 2);
2885
+ h([
2886
+ A({ type: String, attribute: "vton-url" })
2887
+ ], c.prototype, "vtonUrl", 2);
2888
+ h([
2889
+ A({ type: String, attribute: "garment-url" })
2890
+ ], c.prototype, "garmentUrl", 2);
2891
+ h([
2892
+ A({ type: Boolean, attribute: "vton" })
2893
+ ], c.prototype, "vton", 2);
2894
+ h([
2895
+ A({ type: Function, attribute: "onmeasurementaccepted" })
2896
+ ], c.prototype, "onMeasurementAccepted", 2);
2897
+ h([
2898
+ A({ type: Function, attribute: "onmeasurementcanceled" })
2899
+ ], c.prototype, "onMeasurementCanceled", 2);
2900
+ h([
2901
+ A({ type: String })
2902
+ ], c.prototype, "culture", 1);
2903
+ h([
2900
2904
  y()
2901
- ], h.prototype, "errorMap", 1);
2902
- d([
2905
+ ], c.prototype, "errorMap", 1);
2906
+ h([
2903
2907
  y()
2904
- ], h.prototype, "measurerKey", 2);
2905
- d([
2908
+ ], c.prototype, "measurerKey", 2);
2909
+ h([
2906
2910
  y()
2907
- ], h.prototype, "_isLocaleLoading", 2);
2908
- d([
2911
+ ], c.prototype, "_isLocaleLoading", 2);
2912
+ h([
2909
2913
  y()
2910
- ], h.prototype, "showModal", 2);
2911
- d([
2914
+ ], c.prototype, "showModal", 2);
2915
+ h([
2912
2916
  y()
2913
- ], h.prototype, "step", 2);
2914
- d([
2917
+ ], c.prototype, "step", 2);
2918
+ h([
2915
2919
  y()
2916
- ], h.prototype, "height", 2);
2917
- d([
2920
+ ], c.prototype, "height", 2);
2921
+ h([
2918
2922
  y()
2919
- ], h.prototype, "recommendedSize", 2);
2920
- d([
2923
+ ], c.prototype, "recommendedSize", 2);
2924
+ h([
2921
2925
  y()
2922
- ], h.prototype, "measurements", 2);
2923
- d([
2926
+ ], c.prototype, "measurements", 2);
2927
+ h([
2924
2928
  y()
2925
- ], h.prototype, "errorMessage", 2);
2926
- d([
2929
+ ], c.prototype, "errorMessage", 2);
2930
+ h([
2927
2931
  y()
2928
- ], h.prototype, "instructionMessage", 2);
2929
- d([
2932
+ ], c.prototype, "instructionMessage", 2);
2933
+ h([
2930
2934
  y()
2931
- ], h.prototype, "shouldStartMeasurement", 2);
2932
- d([
2935
+ ], c.prototype, "shouldStartMeasurement", 2);
2936
+ h([
2933
2937
  y()
2934
- ], h.prototype, "isLoading", 2);
2935
- d([
2938
+ ], c.prototype, "isLoading", 2);
2939
+ h([
2936
2940
  y()
2937
- ], h.prototype, "isFetching", 2);
2938
- d([
2941
+ ], c.prototype, "isFetching", 2);
2942
+ h([
2939
2943
  y()
2940
- ], h.prototype, "generatedImageUrl", 2);
2941
- d([
2944
+ ], c.prototype, "generatedImageUrl", 2);
2945
+ h([
2942
2946
  y()
2943
- ], h.prototype, "isVtonFetching", 2);
2944
- d([
2947
+ ], c.prototype, "isVtonFetching", 2);
2948
+ h([
2945
2949
  y()
2946
- ], h.prototype, "vtonError", 2);
2947
- d([
2950
+ ], c.prototype, "vtonError", 2);
2951
+ h([
2948
2952
  y()
2949
- ], h.prototype, "cameras", 2);
2950
- d([
2953
+ ], c.prototype, "cameras", 2);
2954
+ h([
2951
2955
  y()
2952
- ], h.prototype, "currentCameraId", 2);
2953
- h = d([
2956
+ ], c.prototype, "currentCameraId", 2);
2957
+ c = h([
2954
2958
  T("body-measurer"),
2955
2959
  G()
2956
- ], h);
2960
+ ], c);
2957
2961
  export {
2958
- h as B,
2962
+ c as B,
2959
2963
  Rt as a,
2960
2964
  ii as g,
2961
2965
  ue as s