@spiffcommerce/core 31.0.0 → 31.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -330,13 +330,13 @@ class jr {
330
330
  fetch: qr
331
331
  }), e = Ar(async (i, s) => {
332
332
  const { headers: o } = s, l = o || {}, c = await Wr();
333
- let d = s.bearer ?? c.bearer;
333
+ let A = s.bearer ?? c.bearer;
334
334
  if (this.spiffClient)
335
335
  try {
336
- d = await this.spiffClient.loggedInBearerToken();
336
+ A = await this.spiffClient.loggedInBearerToken();
337
337
  } catch {
338
338
  }
339
- const A = s.partnerId ?? c.partnerId, u = s.activeIntegration ?? c.activeIntegration, h = s.transactionOwnerId, m = s.customerToken ?? c.customerToken, g = s.applicationKey ?? c.applicationKey, p = s.bundleOwnerId;
339
+ const d = s.partnerId ?? c.partnerId, u = s.activeIntegration ?? c.activeIntegration, h = s.transactionOwnerId, m = s.customerToken ?? c.customerToken, g = s.applicationKey ?? c.applicationKey, p = s.bundleOwnerId;
340
340
  try {
341
341
  if (window && window.__SENTRY__) {
342
342
  const f = window.__SENTRY__.hub;
@@ -349,7 +349,7 @@ class jr {
349
349
  }
350
350
  } catch {
351
351
  }
352
- return d && (l.Authorization = `Bearer ${d}`), A && (l.partnerId = A), u && (l.activeIntegration = u), h && (l.transactionOwnerId = h), m && (l.customerToken = m), g && (l["X-Application-Key"] = g), p && (l.bundleOwnerId = p), l["Allow-Moonlight-Redirect"] = "true", {
352
+ return A && (l.Authorization = `Bearer ${A}`), d && (l.partnerId = d), u && (l.activeIntegration = u), h && (l.transactionOwnerId = h), m && (l.customerToken = m), g && (l["X-Application-Key"] = g), p && (l.bundleOwnerId = p), l["Allow-Moonlight-Redirect"] = "true", {
353
353
  headers: l
354
354
  };
355
355
  }), a = ur(({ operation: i, graphQLErrors: s, networkError: o }) => {
@@ -426,34 +426,34 @@ const Hr = (r) => new Promise((t) => {
426
426
  }, Kr = async (r) => {
427
427
  const t = await Or(r), e = await te(t), [a, n] = Jr(e);
428
428
  if (!await Yr()) {
429
- const A = pt(a, n);
430
- return A.getContext("2d")?.drawImage(e, 0, 0, a, n), A;
429
+ const d = pt(a, n);
430
+ return d.getContext("2d")?.drawImage(e, 0, 0, a, n), d;
431
431
  }
432
- const s = await Hr(r), [o, l] = s > 4 ? [n, a] : [a, n], c = pt(o, l), d = c.getContext("2d");
432
+ const s = await Hr(r), [o, l] = s > 4 ? [n, a] : [a, n], c = pt(o, l), A = c.getContext("2d");
433
433
  switch (s) {
434
434
  case 2:
435
- d.translate(o, 0), d.scale(-1, 1);
435
+ A.translate(o, 0), A.scale(-1, 1);
436
436
  break;
437
437
  case 3:
438
- d.translate(o, l), d.rotate(Math.PI);
438
+ A.translate(o, l), A.rotate(Math.PI);
439
439
  break;
440
440
  case 4:
441
- d.translate(0, l), d.scale(1, -1);
441
+ A.translate(0, l), A.scale(1, -1);
442
442
  break;
443
443
  case 5:
444
- d.rotate(-0.5 * Math.PI), d.scale(-1, 1);
444
+ A.rotate(-0.5 * Math.PI), A.scale(-1, 1);
445
445
  break;
446
446
  case 6:
447
- d.rotate(-0.5 * Math.PI), d.translate(-o, 0);
447
+ A.rotate(-0.5 * Math.PI), A.translate(-o, 0);
448
448
  break;
449
449
  case 7:
450
- d.rotate(-0.5 * Math.PI), d.translate(-o, l), d.scale(1, -1);
450
+ A.rotate(-0.5 * Math.PI), A.translate(-o, l), A.scale(1, -1);
451
451
  break;
452
452
  case 8:
453
- d.rotate(0.5 * Math.PI), d.translate(0, -l);
453
+ A.rotate(0.5 * Math.PI), A.translate(0, -l);
454
454
  break;
455
455
  }
456
- return d.drawImage(e, 0, 0, o, l), c;
456
+ return A.drawImage(e, 0, 0, o, l), c;
457
457
  }, Te = async (r) => {
458
458
  const t = await Kr(r);
459
459
  return Me(r) === "image/jpeg" ? {
@@ -3170,15 +3170,15 @@ function Oc(r, t = 64) {
3170
3170
  distance: 0
3171
3171
  });
3172
3172
  const i = parseInt(r.substring(0, 2), 16), s = parseInt(r.substring(2, 4), 16), o = parseInt(r.substring(4, 6), 16);
3173
- let l, c, d;
3174
- for (let A = 0; A < Ft.length; A++) {
3175
- l = Le[A][0], c = Le[A][1], d = Le[A][2];
3176
- const u = Math.sqrt(Math.pow(i - l, 2) + Math.pow(s - c, 2) + Math.pow(o - d, 2));
3173
+ let l, c, A;
3174
+ for (let d = 0; d < Ft.length; d++) {
3175
+ l = Le[d][0], c = Le[d][1], A = Le[d][2];
3176
+ const u = Math.sqrt(Math.pow(i - l, 2) + Math.pow(s - c, 2) + Math.pow(o - A, 2));
3177
3177
  a.push(u);
3178
3178
  }
3179
- for (let A = 0; A < a.length; A++)
3180
- a[A] <= t && !e.some((u) => u.pms === Yt[A]) && e.push({ pms: Yt[A], hex: Ft[A], distance: a[A] });
3181
- return e.sort((A, u) => A.distance - u.distance);
3179
+ for (let d = 0; d < a.length; d++)
3180
+ a[d] <= t && !e.some((u) => u.pms === Yt[d]) && e.push({ pms: Yt[d], hex: Ft[d], distance: a[d] });
3181
+ return e.sort((d, u) => d.distance - u.distance);
3182
3182
  }
3183
3183
  const Xr = Yt.map((r, t) => ({ pms: r, hex: Ft[t] })), Zr = new pr(Xr, { keys: ["pms"] });
3184
3184
  function $c(r, t) {
@@ -3269,8 +3269,8 @@ const le = (r) => {
3269
3269
  n.split(";").forEach((o) => {
3270
3270
  const l = o.trim();
3271
3271
  if (l) {
3272
- const [c, d] = l.split(":"), A = c.toLowerCase();
3273
- ai.indexOf(A) > -1 ? a.setAttribute(A, d.trim()) : i.push(l);
3272
+ const [c, A] = l.split(":"), d = c.toLowerCase();
3273
+ ai.indexOf(d) > -1 ? a.setAttribute(d, A.trim()) : i.push(l);
3274
3274
  }
3275
3275
  }), i.length > 0 ? a.setAttribute("style", i.join(";")) : a.removeAttribute("style");
3276
3276
  }
@@ -3351,13 +3351,13 @@ const le = (r) => {
3351
3351
  ei.includes(s.tagName) && !s.attributes.getNamedItem("fill") && s.setAttribute("fill", "black");
3352
3352
  const o = s.attributes.getNamedItem("fill");
3353
3353
  if (o && o.value !== "none" && !o.value.startsWith("url(")) {
3354
- const c = Oa(o.value), d = c.browserValue.replace(/\W/g, ""), A = `spiff-fill-${d}`;
3355
- s.setAttribute("fill", c.browserValue), s.classList.add(A), a[d] = c;
3354
+ const c = Oa(o.value), A = c.browserValue.replace(/\W/g, ""), d = `spiff-fill-${A}`;
3355
+ s.setAttribute("fill", c.browserValue), s.classList.add(d), a[A] = c;
3356
3356
  }
3357
3357
  const l = s.attributes.getNamedItem("stroke");
3358
3358
  if (l && l.value !== "none" && !l.value.startsWith("url(")) {
3359
- const c = Oa(l.value), d = c.browserValue.replace(/\W/g, ""), A = `spiff-stroke-${d}`;
3360
- s.classList.add(A), s.setAttribute("stroke", c.browserValue), a[d] = c;
3359
+ const c = Oa(l.value), A = c.browserValue.replace(/\W/g, ""), d = `spiff-stroke-${A}`;
3360
+ s.classList.add(d), s.setAttribute("stroke", c.browserValue), a[A] = c;
3361
3361
  }
3362
3362
  });
3363
3363
  const i = Bt().serializeToString(e);
@@ -3599,12 +3599,12 @@ class mi {
3599
3599
  throw new Error("Failed to create asset.");
3600
3600
  return await new Promise((o, l) => {
3601
3601
  const c = new XMLHttpRequest();
3602
- c.open("PUT", s.assetResponse.uploadUrl, !0), c.setRequestHeader("Content-Type", s.mimeType), c.setRequestHeader("Cache-Control", "public,max-age=31536000,immutable"), c.upload.onprogress = (d) => {
3603
- d.lengthComputable && a(d.loaded * 100 / d.total);
3602
+ c.open("PUT", s.assetResponse.uploadUrl, !0), c.setRequestHeader("Content-Type", s.mimeType), c.setRequestHeader("Cache-Control", "public,max-age=31536000,immutable"), c.upload.onprogress = (A) => {
3603
+ A.lengthComputable && a(A.loaded * 100 / A.total);
3604
3604
  }, c.onload = () => {
3605
- const d = s.assetResponse.asset;
3606
- At.add(s.assetResponse.asset), o(d);
3607
- }, c.onerror = l, this.postProcessFileUpload(t, s.mimeType).then((d) => c.send(d.blob)).catch(l);
3605
+ const A = s.assetResponse.asset;
3606
+ At.add(s.assetResponse.asset), o(A);
3607
+ }, c.onerror = l, this.postProcessFileUpload(t, s.mimeType).then((A) => c.send(A.blob)).catch(l);
3608
3608
  }), this.cacheAsset(s.assetResponse.asset), s.assetResponse.asset;
3609
3609
  }
3610
3610
  async uploadAsset(t, e, a, n) {
@@ -5335,11 +5335,11 @@ const M = () => {
5335
5335
  maxWidth: o,
5336
5336
  outlineArea: l,
5337
5337
  position: c,
5338
- preserveAspectRatio: d,
5339
- viewBox: A,
5338
+ preserveAspectRatio: A,
5339
+ viewBox: d,
5340
5340
  width: u
5341
5341
  }) => {
5342
- const h = e || 0, m = 2 * (l?.scale || 1), g = A || { x: 0, y: 0, width: u, height: i }, p = `${g.x} ${g.y} ${g.width} ${g.height}`, f = M(), S = a.purpose === jt.FreeDesign && /* @__PURE__ */ D("defs", { children: /* @__PURE__ */ D("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ D("rect", { width: g.width, height: g.height, rx: h }) }) }), v = a.colorProfiles?.map((b, P) => (
5342
+ const h = e || 0, m = 2 * (l?.scale || 1), g = d || { x: 0, y: 0, width: u, height: i }, p = `${g.x} ${g.y} ${g.width} ${g.height}`, f = M(), S = a.purpose === jt.FreeDesign && /* @__PURE__ */ D("defs", { children: /* @__PURE__ */ D("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ D("rect", { width: g.width, height: g.height, rx: h }) }) }), v = a.colorProfiles?.map((b, P) => (
5343
5343
  /* @ts-ignore */
5344
5344
  /* @__PURE__ */ D("color-profile", { name: b.name, xlinkHref: b.key, children: " " }, P)
5345
5345
  )), I = n.map((b) => ({
@@ -5354,7 +5354,7 @@ const M = () => {
5354
5354
  xmlnsXlink: "http://www.w3.org/1999/xlink",
5355
5355
  xmlSpace: "preserve",
5356
5356
  version: "1.1",
5357
- preserveAspectRatio: d,
5357
+ preserveAspectRatio: A,
5358
5358
  width: u,
5359
5359
  height: i,
5360
5360
  style: {
@@ -5425,7 +5425,7 @@ const M = () => {
5425
5425
  }
5426
5426
  );
5427
5427
  }, Uc = (r, t, e, a, n) => {
5428
- const i = ft(n), s = e / 2, o = a / 2, l = r + s, c = t + o, d = Math.sin(i), A = Math.cos(i), u = s, h = s, m = -o, g = o, p = u * A - m * d, f = h * A - g * d, S = u * d + m * A, v = h * d + g * A, I = Math.max(Math.abs(p), Math.abs(f)), C = Math.max(Math.abs(S), Math.abs(v));
5428
+ const i = ft(n), s = e / 2, o = a / 2, l = r + s, c = t + o, A = Math.sin(i), d = Math.cos(i), u = s, h = s, m = -o, g = o, p = u * d - m * A, f = h * d - g * A, S = u * A + m * d, v = h * A + g * d, I = Math.max(Math.abs(p), Math.abs(f)), C = Math.max(Math.abs(S), Math.abs(v));
5429
5429
  return {
5430
5430
  minX: l - I,
5431
5431
  maxX: l + I,
@@ -5560,8 +5560,8 @@ const M = () => {
5560
5560
  if (!r.pattern)
5561
5561
  return "";
5562
5562
  if (r.pattern.svg) {
5563
- const A = fa(r.pattern.svg, r.pattern.colors || {}, !1);
5564
- return ua(A);
5563
+ const d = fa(r.pattern.svg, r.pattern.colors || {}, !1);
5564
+ return ua(d);
5565
5565
  }
5566
5566
  return r.pattern.src;
5567
5567
  };
@@ -5586,12 +5586,12 @@ const M = () => {
5586
5586
  /* @__PURE__ */ D("feFuncG", { type: "discrete", tableValues: n() }),
5587
5587
  /* @__PURE__ */ D("feFuncB", { type: "discrete", tableValues: n() })
5588
5588
  ] })
5589
- ] }) }) }), s = r.rotation || 0, o = ft(s), l = Math.cos(o), c = -Math.sin(o), d = () => {
5590
- const A = r.pattern?.x || 0, u = r.pattern?.y || 0, h = r.pattern?.width || 0, m = r.pattern?.height || 0, g = r.pattern?.scaleX || 1, p = r.pattern?.scaleY || 1, f = r.pattern?.rotation || 0;
5589
+ ] }) }) }), s = r.rotation || 0, o = ft(s), l = Math.cos(o), c = -Math.sin(o), A = () => {
5590
+ const d = r.pattern?.x || 0, u = r.pattern?.y || 0, h = r.pattern?.width || 0, m = r.pattern?.height || 0, g = r.pattern?.scaleX || 1, p = r.pattern?.scaleY || 1, f = r.pattern?.rotation || 0;
5591
5591
  return [r.pattern?.svg ? {
5592
5592
  id: `${t}-contents`,
5593
5593
  type: x.Illustration,
5594
- x: A,
5594
+ x: d,
5595
5595
  y: u,
5596
5596
  rotation: f,
5597
5597
  width: h * g,
@@ -5602,7 +5602,7 @@ const M = () => {
5602
5602
  } : {
5603
5603
  id: `${t}-contents`,
5604
5604
  type: x.Image,
5605
- x: A,
5605
+ x: d,
5606
5606
  y: u,
5607
5607
  rotation: f,
5608
5608
  width: h * g,
@@ -5638,7 +5638,7 @@ const M = () => {
5638
5638
  width: r.width,
5639
5639
  height: r.height,
5640
5640
  clipPath: r.path,
5641
- children: d()
5641
+ children: A()
5642
5642
  }
5643
5643
  )
5644
5644
  }
@@ -5726,8 +5726,8 @@ const Xi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Ve = /* @_
5726
5726
  return Tn.set(r, e), e;
5727
5727
  }, _c = async (r) => {
5728
5728
  const t = dt(), e = t.parseFromString(r, "image/svg+xml"), a = e.firstElementChild, n = /* @__PURE__ */ new Map();
5729
- a.querySelectorAll("style").forEach((d) => {
5730
- on(d.innerHTML).stylesheet?.rules.forEach((u) => {
5729
+ a.querySelectorAll("style").forEach((A) => {
5730
+ on(A.innerHTML).stylesheet?.rules.forEach((u) => {
5731
5731
  if (u.type === "font-face" && u.declarations) {
5732
5732
  const h = u.declarations.find(
5733
5733
  (p) => p.property === "font-family"
@@ -5737,36 +5737,36 @@ const Xi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Ve = /* @_
5737
5737
  });
5738
5738
  });
5739
5739
  const s = e.querySelectorAll("tspan");
5740
- for (let d = 0; d < s.length; d++) {
5741
- const A = s.item(d), u = A.closest("text"), h = A.closest("g"), m = u.getAttribute("font-family"), g = await Tt(n.get(m)), p = u.getAttribute("fill"), f = u.getAttribute("stroke"), S = u.getAttribute("stroke-width"), v = g.getPath(
5742
- A.innerHTML,
5740
+ for (let A = 0; A < s.length; A++) {
5741
+ const d = s.item(A), u = d.closest("text"), h = d.closest("g"), m = u.getAttribute("font-family"), g = await Tt(n.get(m)), p = u.getAttribute("fill"), f = u.getAttribute("stroke"), S = u.getAttribute("stroke-width"), v = g.getPath(
5742
+ d.innerHTML,
5743
5743
  0,
5744
5744
  0,
5745
5745
  parseInt(u.getAttribute("font-size") ?? "72")
5746
5746
  ), I = v.getBoundingBox().x2 - v.getBoundingBox().x1;
5747
5747
  let C = 0;
5748
- const b = A.getAttribute("text-anchor");
5748
+ const b = d.getAttribute("text-anchor");
5749
5749
  b === "middle" ? C = I / 2 : b === "end" && (C = I);
5750
5750
  const P = g.getPath(
5751
- A.innerHTML,
5752
- parseFloat(A.getAttribute("x") ?? "0") - C,
5753
- parseFloat(A.getAttribute("y") ?? "0"),
5751
+ d.innerHTML,
5752
+ parseFloat(d.getAttribute("x") ?? "0") - C,
5753
+ parseFloat(d.getAttribute("y") ?? "0"),
5754
5754
  parseInt(u.getAttribute("font-size") ?? "72")
5755
5755
  );
5756
5756
  P.fill = p, P.stroke = f, P.strokeWidth = parseFloat(S ?? "0");
5757
5757
  const B = P.toSVG(2), Q = t.parseFromString(B, "image/svg+xml").firstElementChild;
5758
5758
  h.appendChild(Q);
5759
5759
  }
5760
- return e.querySelectorAll("text").forEach((d) => d.remove()), Bt().serializeToString(a);
5760
+ return e.querySelectorAll("text").forEach((A) => A.remove()), Bt().serializeToString(a);
5761
5761
  }, be = (r, t, e, a) => Math.max(ns(r.join(`
5762
5762
  `), e, a), t), Ua = (r, t, e, a, n, i) => {
5763
5763
  const s = (i || wa) * n.getApproximateHeight(), o = t.split(`
5764
5764
  `);
5765
5765
  try {
5766
- const l = o.flatMap((d) => ge(d, r.width, a, n)), c = l.flatMap((d) => d.lines);
5766
+ const l = o.flatMap((A) => ge(A, r.width, a, n)), c = l.flatMap((A) => A.lines);
5767
5767
  return {
5768
5768
  lines: c,
5769
- requiredHeight: l.flatMap((d) => d.lines).length * (a * s),
5769
+ requiredHeight: l.flatMap((A) => A.lines).length * (a * s),
5770
5770
  fontSize: e,
5771
5771
  requiredWidth: be(c, r.width, a, n)
5772
5772
  };
@@ -5786,33 +5786,33 @@ const Xi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Ve = /* @_
5786
5786
  if (!(r.indexOf(" ") > -1)) {
5787
5787
  if (r.length <= 1)
5788
5788
  throw new Error(`Character ${r} is wider than region`);
5789
- const d = Math.floor(r.length / 2), A = ge(r.slice(0, d), t, e, a), u = ge(r.slice(d), t, e, a);
5790
- return { lines: [...A.lines, ...u.lines], width: Math.max(A.width, u.width) };
5789
+ const A = Math.floor(r.length / 2), d = ge(r.slice(0, A), t, e, a), u = ge(r.slice(A), t, e, a);
5790
+ return { lines: [...d.lines, ...u.lines], width: Math.max(d.width, u.width) };
5791
5791
  }
5792
5792
  const s = r.split(" "), o = [];
5793
5793
  let l = -1 / 0, c = 0;
5794
5794
  for (; c < s.length; ) {
5795
- const d = s[c];
5796
- if (mt(d, e, a) > t) {
5797
- const A = ge(d, t, e, a);
5798
- o.push(...A.lines), l = Math.max(l, A.width), c++;
5795
+ const A = s[c];
5796
+ if (mt(A, e, a) > t) {
5797
+ const d = ge(A, t, e, a);
5798
+ o.push(...d.lines), l = Math.max(l, d.width), c++;
5799
5799
  } else {
5800
- const A = [d];
5801
- l = Math.max(l, mt(d, e, a));
5800
+ const d = [A];
5801
+ l = Math.max(l, mt(A, e, a));
5802
5802
  let u = c + 1, h = !0;
5803
5803
  for (; u < s.length && h; ) {
5804
- const m = s[u], g = mt(`${A.join(" ")} ${m}`, e, a);
5805
- g <= t ? (A.push(m), l = Math.max(l, g), u++) : h = !1;
5804
+ const m = s[u], g = mt(`${d.join(" ")} ${m}`, e, a);
5805
+ g <= t ? (d.push(m), l = Math.max(l, g), u++) : h = !1;
5806
5806
  }
5807
- o.push(A.join(" ")), c = u;
5807
+ o.push(d.join(" ")), c = u;
5808
5808
  }
5809
5809
  }
5810
5810
  if (l < 0)
5811
5811
  throw new Error(`No max width calculated for text: ${o}.`);
5812
5812
  return { lines: o, width: l };
5813
5813
  }, ts = (r, t, e, a, n, i) => {
5814
- const s = (i ?? wa) * t.getApproximateHeight(), o = 1 / e.unitsPerEm, l = Nn(r, o, t), c = r.length * s * o, d = a / l, A = n / c;
5815
- return Math.min(A, d);
5814
+ const s = (i ?? wa) * t.getApproximateHeight(), o = 1 / e.unitsPerEm, l = Nn(r, o, t), c = r.length * s * o, A = a / l, d = n / c;
5815
+ return Math.min(d, A);
5816
5816
  }, es = (r, t, e, a) => {
5817
5817
  const n = Et(t.fontData.assetUrl), i = n.getFont(), s = t.fontSize / i.unitsPerEm;
5818
5818
  if (!e)
@@ -5838,7 +5838,7 @@ const Xi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Ve = /* @_
5838
5838
  const s = Et(t.assetUrl).getFont();
5839
5839
  let o = { ...r };
5840
5840
  const l = { ...r }, c = Nn(a, e / s.unitsPerEm, Et(t.assetUrl));
5841
- return c && c < o.width && (l.width = c, n === "left" ? (l.left += Math.sin(o.rotation * Math.PI / 360) * (o.width - c), l.top += Math.sin(o.rotation * Math.PI / 180) * (c - o.width) / 2) : n === "right" ? l.left += o.width - c : l.left += (o.width - c) / 2, a && rs(a, a).every(([d, A]) => d === A) && (o = l)), o;
5841
+ return c && c < o.width && (l.width = c, n === "left" ? (l.left += Math.sin(o.rotation * Math.PI / 360) * (o.width - c), l.top += Math.sin(o.rotation * Math.PI / 180) * (c - o.width) / 2) : n === "right" ? l.left += o.width - c : l.left += (o.width - c) / 2, a && rs(a, a).every(([A, d]) => A === d) && (o = l)), o;
5842
5842
  }, ze = 1, mt = (r, t, e) => {
5843
5843
  let a = 0;
5844
5844
  const n = e.getGlyphs(r);
@@ -5902,8 +5902,8 @@ function Rn(r, t) {
5902
5902
  return r;
5903
5903
  }
5904
5904
  const ss = (r) => {
5905
- const e = (r.rotation || 0) * Math.PI / 180, a = Math.cos(e), n = -Math.sin(e), i = `text-path-${r.id}`, s = `text-fill-${r.id}`, o = r.x + (r.curved ? 0 : r.width / 2), l = r.y + (r.curved ? 0 : r.height / 2), c = Rn(r.text || "", r._renderingConfiguration?.templatingContext), d = c.split(`
5906
- `), A = r.strokeColor?.browserValue && r.strokeThickness ? r.strokeColor?.browserValue : void 0, u = r.strokeColor?.browserValue && r.strokeThickness ? r.strokeThickness : void 0;
5905
+ const e = (r.rotation || 0) * Math.PI / 180, a = Math.cos(e), n = -Math.sin(e), i = `text-path-${r.id}`, s = `text-fill-${r.id}`, o = r.x + (r.curved ? 0 : r.width / 2), l = r.y + (r.curved ? 0 : r.height / 2), c = Rn(r.text || "", r._renderingConfiguration?.templatingContext), A = c.split(`
5906
+ `), d = r.strokeColor?.browserValue && r.strokeThickness ? r.strokeColor?.browserValue : void 0, u = r.strokeColor?.browserValue && r.strokeThickness ? r.strokeThickness : void 0;
5907
5907
  if (r.curved && !r.paths || !r.fontData)
5908
5908
  return null;
5909
5909
  const h = () => r.textFillImage ? `url("#${s}")` : r._renderingConfiguration?.spotColors && r.fillSpotColorDefinition ? `${r.fill} ${wn(r.fillSpotColorDefinition)}` : r.fill;
@@ -5959,15 +5959,15 @@ const ss = (r) => {
5959
5959
  whiteSpace: "pre",
5960
5960
  userSelect: "none"
5961
5961
  },
5962
- stroke: A,
5962
+ stroke: d,
5963
5963
  strokeWidth: u,
5964
- children: r.curved ? /* @__PURE__ */ D(ls, { text: c, curvedPathId: i, align: r.align }) : d.map((m, g) => /* @__PURE__ */ D(
5964
+ children: r.curved ? /* @__PURE__ */ D(ls, { text: c, curvedPathId: i, align: r.align }) : A.map((m, g) => /* @__PURE__ */ D(
5965
5965
  os,
5966
5966
  {
5967
5967
  align: r.vertical ? "center" : r.align,
5968
5968
  fontSize: r.fontSize,
5969
5969
  thisLineIdx: g,
5970
- amountLines: d.length,
5970
+ amountLines: A.length,
5971
5971
  text: m,
5972
5972
  textboxHeight: r.height,
5973
5973
  textboxWidth: r.width,
@@ -6220,9 +6220,9 @@ const ne = (r) => {
6220
6220
  const s = i.getAttribute("viewBox");
6221
6221
  if (!s)
6222
6222
  throw new Error("SVG missing viewBox.");
6223
- const o = s.split(" "), l = parseFloat(o[3]) || 1, c = parseFloat(o[2]) || 1, d = n.getElementById("target-path"), A = n.getElementsByClassName("st0").item(0);
6224
- if (d) {
6225
- const u = d.getAttribute("d");
6223
+ const o = s.split(" "), l = parseFloat(o[3]) || 1, c = parseFloat(o[2]) || 1, A = n.getElementById("target-path"), d = n.getElementsByClassName("st0").item(0);
6224
+ if (A) {
6225
+ const u = A.getAttribute("d");
6226
6226
  if (!u)
6227
6227
  throw new Error("Malformed frame SVG: 'd' attribute not found on target element");
6228
6228
  const h = {
@@ -6232,8 +6232,8 @@ const ne = (r) => {
6232
6232
  };
6233
6233
  return Lt.set(u, h), h;
6234
6234
  }
6235
- if (A) {
6236
- const u = A.getAttribute("d");
6235
+ if (d) {
6236
+ const u = d.getAttribute("d");
6237
6237
  if (!u)
6238
6238
  throw new Error("Malformed frame SVG: 'd' attribute not found on target element");
6239
6239
  const h = {
@@ -6250,9 +6250,9 @@ const ne = (r) => {
6250
6250
  const n = t.width / t.height, i = r.width / r.height;
6251
6251
  let s;
6252
6252
  a ? i > n ? s = t.height / r.height : s = t.width / r.width : i > n ? s = t.width / r.width : s = t.height / r.height, e?.scale !== void 0 && (s *= e?.scale);
6253
- const o = t.width / 2, l = t.height / 2, c = o - r.width / 2 * s, d = e?.left || c, A = l - r.height / 2 * s, u = e?.top || A;
6253
+ const o = t.width / 2, l = t.height / 2, c = o - r.width / 2 * s, A = e?.left || c, d = l - r.height / 2 * s, u = e?.top || d;
6254
6254
  return {
6255
- x: d,
6255
+ x: A,
6256
6256
  y: u,
6257
6257
  zoom: s
6258
6258
  };
@@ -6324,7 +6324,7 @@ const ne = (r) => {
6324
6324
  const s = dt().parseFromString(r, "image/svg+xml").firstElementChild;
6325
6325
  if (!s)
6326
6326
  throw new Error("Failed to read SVG");
6327
- const l = Bt().serializeToString(s), c = pt(), d = c.getContext("2d"), A = await da.from(d, l, {
6327
+ const l = Bt().serializeToString(s), c = pt(), A = c.getContext("2d"), d = await da.from(A, l, {
6328
6328
  anonymousCrossOrigin: !0,
6329
6329
  ignoreDimensions: !1,
6330
6330
  createCanvas: pt,
@@ -6334,10 +6334,10 @@ const ne = (r) => {
6334
6334
  }), u = s.getAttribute("width"), h = s.getAttribute("height"), m = 2048;
6335
6335
  if (h && u) {
6336
6336
  const g = parseFloat(h), f = parseFloat(u) / g;
6337
- f > 1 ? A.resize(m, m / f) : A.resize(m * f, m);
6337
+ f > 1 ? d.resize(m, m / f) : d.resize(m * f, m);
6338
6338
  } else
6339
- A.resize(m, m);
6340
- return await A.render(), await t(c);
6339
+ d.resize(m, m);
6340
+ return await d.render(), await t(c);
6341
6341
  })();
6342
6342
  return We.set(r, a), a;
6343
6343
  }, $t = async (r, t, e, a) => {
@@ -6361,8 +6361,8 @@ const ne = (r) => {
6361
6361
  o.height = o.width / f, o.top += (h - o.height) / 2;
6362
6362
  }
6363
6363
  if (e && t === x.Image) {
6364
- const l = o.height, c = await ke(e), d = await Te(c), A = d.width / d.height;
6365
- o.height = o.width / A, o.top += (l - o.height) / 2;
6364
+ const l = o.height, c = await ke(e), A = await Te(c), d = A.width / A.height;
6365
+ o.height = o.width / d, o.top += (l - o.height) / 2;
6366
6366
  }
6367
6367
  if (e && t === x.Textbox && a?.text && a?.fontScale) {
6368
6368
  await Tt(e);
@@ -6419,38 +6419,38 @@ class Xc {
6419
6419
  const { configuration: a, fontSrc: n, designInputStep: i } = e, s = await Tt(n), o = {
6420
6420
  assetUrl: n,
6421
6421
  name: s.names.fullName.en
6422
- }, l = i?.text || a.defaultText || "", c = a.replaceableText ? a.replaceableText.replace("{{}}", l) : l, d = Be(c, {
6422
+ }, l = i?.text || a.defaultText || "", c = a.replaceableText ? a.replaceableText.replace("{{}}", l) : l, A = Be(c, {
6423
6423
  vertical: a.vertical,
6424
6424
  uppercase: a.uppercase
6425
- }), A = e.region || await $t(t, x.Textbox, n, {
6426
- text: d,
6425
+ }), d = e.region || await $t(t, x.Textbox, n, {
6426
+ text: A,
6427
6427
  fontScale: a.size ? a.size / s.unitsPerEm : void 0
6428
6428
  }), u = ae(
6429
6429
  {
6430
6430
  id: M(),
6431
6431
  type: x.Textbox,
6432
- x: A.left,
6433
- y: A.top,
6434
- width: A.width,
6435
- height: A.height,
6432
+ x: d.left,
6433
+ y: d.top,
6434
+ width: d.width,
6435
+ height: d.height,
6436
6436
  align: is(a.textAlign, a.vertical),
6437
6437
  curved: a.curved,
6438
6438
  fill: i?.color || a.colour || "#000000",
6439
6439
  fontData: o,
6440
- layer: A.layer || 0,
6441
- layerIndex: A.layerIndex || Ot(t, A.layer || 0),
6440
+ layer: d.layer || 0,
6441
+ layerIndex: d.layerIndex || Ot(t, d.layer || 0),
6442
6442
  paths: a.paths,
6443
- rotation: A.rotation,
6443
+ rotation: d.rotation,
6444
6444
  vertical: a.vertical,
6445
6445
  verticalAlign: a.verticalAlign || "middle",
6446
6446
  algorithm: kt.Traditional,
6447
- fontSize: a.size || Math.max(Math.round(A.height * 0.025), 1),
6448
- text: d,
6447
+ fontSize: a.size || Math.max(Math.round(d.height * 0.025), 1),
6448
+ text: A,
6449
6449
  input: l
6450
6450
  },
6451
- d
6451
+ A
6452
6452
  ), h = as(
6453
- { ...A, height: u.height },
6453
+ { ...d, height: u.height },
6454
6454
  o,
6455
6455
  u.fontSize,
6456
6456
  u?.text?.split(`
@@ -6460,7 +6460,7 @@ class Xc {
6460
6460
  return {
6461
6461
  ...u,
6462
6462
  x: h.left,
6463
- y: h.top + (A.height - h.height) / 2,
6463
+ y: h.top + (d.height - h.height) / 2,
6464
6464
  width: h.width,
6465
6465
  height: h.height
6466
6466
  };
@@ -7245,7 +7245,7 @@ class qa {
7245
7245
  command: new z(c, i)
7246
7246
  };
7247
7247
  } else {
7248
- const l = this.configuration.type === E.SilentIllustration ? this.configuration.data.asset?.fileLink : s, d = await ot(await (async () => new Promise((u, h) => {
7248
+ const l = this.configuration.type === E.SilentIllustration ? this.configuration.data.asset?.fileLink : s, A = await ot(await (async () => new Promise((u, h) => {
7249
7249
  if (!l) {
7250
7250
  h("Undefined vector silent step source");
7251
7251
  return;
@@ -7253,13 +7253,13 @@ class qa {
7253
7253
  at(l, !0).then((m) => {
7254
7254
  u(m);
7255
7255
  }).catch((m) => console.error(m));
7256
- }))()), A = {
7256
+ }))()), d = {
7257
7257
  stepName: this.configuration.stepName,
7258
7258
  id: M(),
7259
- cachedObjectURL: await _t(d.svg),
7259
+ cachedObjectURL: await _t(A.svg),
7260
7260
  src: l,
7261
- svg: d.svg,
7262
- colors: d.colors,
7261
+ svg: A.svg,
7262
+ colors: A.colors,
7263
7263
  type: o,
7264
7264
  y: n.top,
7265
7265
  x: n.left,
@@ -7274,10 +7274,10 @@ class qa {
7274
7274
  };
7275
7275
  return {
7276
7276
  regionElement: {
7277
- id: A.id,
7277
+ id: d.id,
7278
7278
  region: n
7279
7279
  },
7280
- command: new z(A, i)
7280
+ command: new z(d, i)
7281
7281
  };
7282
7282
  }
7283
7283
  }, this.configuration = t, this.layouts = e, this.product = a || void 0;
@@ -7348,10 +7348,10 @@ class ys {
7348
7348
  a.serializableWorkflow.steps
7349
7349
  ), l = Object.values(a.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === t.stepName).map((c) => ({ id: c.id, region: c.stepRegion }));
7350
7350
  await e.setSelectionsAndElements(t.stepName, [], l, async () => {
7351
- const c = n?.storage?.videoShortUrl, d = n?.storage?.videoUrl;
7351
+ const c = n?.storage?.videoShortUrl, A = n?.storage?.videoUrl;
7352
7352
  e.updateStorage(t.stepName, {
7353
7353
  videoShortUrl: c,
7354
- videoUrl: d
7354
+ videoUrl: A
7355
7355
  });
7356
7356
  });
7357
7357
  }
@@ -7384,16 +7384,16 @@ class ys {
7384
7384
  const c = l.toString();
7385
7385
  if (c.length >= 2e3)
7386
7386
  throw new xe("Cannot create QR code, URL too long.");
7387
- const d = await ws(c);
7387
+ const A = await ws(c);
7388
7388
  if (!n.data || !n.data.regions)
7389
7389
  throw new ve(n, "Missing regions.");
7390
- const A = await this.regionElements(n), u = await this.command(d, A, a, n.stepName);
7391
- return u && (u.command && a.getCommandDispatcher()(u.command), u.followup && await u.followup()), await a.setSelectionsAndElements(n.stepName, [], A, async () => {
7390
+ const d = await this.regionElements(n), u = await this.command(A, d, a, n.stepName);
7391
+ return u && (u.command && a.getCommandDispatcher()(u.command), u.followup && await u.followup()), await a.setSelectionsAndElements(n.stepName, [], d, async () => {
7392
7392
  a.updateStorage(n.stepName, {
7393
- videoShortUrl: d,
7393
+ videoShortUrl: A,
7394
7394
  videoUrl: s.href
7395
7395
  });
7396
- }), d;
7396
+ }), A;
7397
7397
  }
7398
7398
  async regionElements(t) {
7399
7399
  const e = (a) => ({ id: M(), region: a });
@@ -7401,27 +7401,27 @@ class ys {
7401
7401
  }
7402
7402
  async command(t, e, a, n) {
7403
7403
  const i = a.getLayouts(), o = `data:image/svg+xml;base64,${btoa(await ln(t, { type: "svg" }))}`, l = e.map((c) => {
7404
- const d = c.region, A = i.find((u) => u.panelId === d?.panelId);
7405
- if (!A && d)
7406
- throw new Y(d);
7407
- if (A && !d)
7404
+ const A = c.region, d = i.find((u) => u.panelId === A?.panelId);
7405
+ if (!d && A)
7406
+ throw new Y(A);
7407
+ if (d && !A)
7408
7408
  throw new Error("Region not found");
7409
- if (!A || !d)
7409
+ if (!d || !A)
7410
7410
  throw new Error("Neither a region or layout found!");
7411
7411
  return new z(
7412
7412
  {
7413
- stepRegion: d,
7413
+ stepRegion: A,
7414
7414
  stepName: n,
7415
7415
  id: c.id,
7416
7416
  src: o,
7417
7417
  type: x.Image,
7418
- y: d.top,
7419
- x: d.left,
7420
- width: d.width,
7421
- height: d.height,
7418
+ y: A.top,
7419
+ x: A.left,
7420
+ width: A.width,
7421
+ height: A.height,
7422
7422
  rotation: 0
7423
7423
  },
7424
- A
7424
+ d
7425
7425
  );
7426
7426
  });
7427
7427
  return { command: new R(l), followup: async () => {
@@ -7482,22 +7482,22 @@ class Ie {
7482
7482
  a.serializableWorkflow.steps
7483
7483
  ), l = Object.values(a.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === t.stepName).map((c) => ({ id: c.id, region: c.stepRegion }));
7484
7484
  if (!t.option || (t.option.variants || []).length === 0) {
7485
- const c = t.data.regions.map((d) => sa(d));
7485
+ const c = t.data.regions.map((A) => sa(A));
7486
7486
  e.updateStorage(t.stepName, {
7487
7487
  currentFrameSources: c
7488
7488
  });
7489
7489
  }
7490
7490
  if (n) {
7491
7491
  const c = async () => {
7492
- const d = n.storage?.colors, A = n.storage?.framePatternSrc, u = n.storage?.frameOffsetsList;
7492
+ const A = n.storage?.colors, d = n.storage?.framePatternSrc, u = n.storage?.frameOffsetsList;
7493
7493
  if (e.updateMetadata(t.stepName, {
7494
7494
  frameOffsetsList: u,
7495
- framePatternSrc: A
7496
- }), A) {
7495
+ framePatternSrc: d
7496
+ }), d) {
7497
7497
  const h = e.getWorkflowExperience().getStepById(t.stepName)?.frameService;
7498
7498
  if (!h) throw new Error("Frame service unavailable, cannot load pattern!");
7499
- await this.loadPatternFromString(A, h, !0, d), e.updateMetadata(t.stepName, { image: A }), e.updateStorage(t.stepName, {
7500
- framePatternSrc: A
7499
+ await this.loadPatternFromString(d, h, !0, A), e.updateMetadata(t.stepName, { image: d }), e.updateStorage(t.stepName, {
7500
+ framePatternSrc: d
7501
7501
  }), this.validateColorCount(t, e);
7502
7502
  }
7503
7503
  if (u?.some((h) => h.zoom)) {
@@ -7508,16 +7508,16 @@ class Ie {
7508
7508
  e.setMandatoryFulfilled(t.stepName, !0);
7509
7509
  };
7510
7510
  if (n.selectedVariants && n.selectedVariants.length > 0) {
7511
- const d = n.selectedVariants[0].id;
7512
- if (t.option && d) {
7513
- const A = t.option.variants?.find((u) => u.id === d);
7514
- A && await e.setSelectionsAndElements(
7511
+ const A = n.selectedVariants[0].id;
7512
+ if (t.option && A) {
7513
+ const d = t.option.variants?.find((u) => u.id === A);
7514
+ d && await e.setSelectionsAndElements(
7515
7515
  t.stepName,
7516
- [A],
7516
+ [d],
7517
7517
  l,
7518
7518
  async () => {
7519
7519
  const u = await Promise.all(
7520
- t.data.regions.map((h) => this.frameSourceSvg(A, h))
7520
+ t.data.regions.map((h) => this.frameSourceSvg(d, h))
7521
7521
  );
7522
7522
  e.updateStorage(t.stepName, { currentFrameSources: u }), await c();
7523
7523
  }
@@ -7545,8 +7545,8 @@ class Ie {
7545
7545
  a.addPoller(
7546
7546
  new zn(
7547
7547
  async () => {
7548
- const d = (await O.getFromServer(e.key || "")).versions?.find((u) => u.name === "svg");
7549
- return d ? (await nt(d.link)).status === 200 : !1;
7548
+ const A = (await O.getFromServer(e.key || "")).versions?.find((u) => u.name === "svg");
7549
+ return A ? (await nt(A.link)).status === 200 : !1;
7550
7550
  },
7551
7551
  () => {
7552
7552
  O.getLocalOrFromServer(e.key || "").then((c) => {
@@ -7608,15 +7608,15 @@ class Ie {
7608
7608
  "Vector files may not include images or gradients when a color limit is specified."
7609
7609
  );
7610
7610
  }
7611
- const d = await ot(c), A = {
7611
+ const A = await ot(c), d = {
7612
7612
  src: t,
7613
7613
  width: o,
7614
7614
  height: l,
7615
7615
  aspect: o / l,
7616
- svg: d.svg,
7617
- colors: n ?? d.colors
7616
+ svg: A.svg,
7617
+ colors: n ?? A.colors
7618
7618
  };
7619
- ut.set(t, A), e.setPatternData(A, a);
7619
+ ut.set(t, d), e.setPatternData(d, a);
7620
7620
  } else {
7621
7621
  const s = await ke(t, !0), o = await Te(s), l = {
7622
7622
  src: t,
@@ -7671,8 +7671,8 @@ class Ie {
7671
7671
  };
7672
7672
  const n = { ...t.getImageData().colors ?? {} }, i = {};
7673
7673
  Object.entries(n).forEach(([l, c]) => {
7674
- const d = { browserValue: c.browserValue };
7675
- i[l] = d;
7674
+ const A = { browserValue: c.browserValue };
7675
+ i[l] = A;
7676
7676
  });
7677
7677
  for (const [l, c] of a.entries())
7678
7678
  n[l] = { browserValue: c.browserValue, pmsValue: c.pmsValue }, i[l] = c;
@@ -7701,7 +7701,7 @@ class Ie {
7701
7701
  t.data.regions.map((h) => this.frameSourceSvg(e, h))
7702
7702
  );
7703
7703
  i && i(!0);
7704
- const c = t.data.initialZoomLevel, d = await Promise.all(
7704
+ const c = t.data.initialZoomLevel, A = await Promise.all(
7705
7705
  t.data.regions.map(async (h, m) => {
7706
7706
  const g = await Re(l[m]), p = o.getImageData(), f = a.map((P) => new bt(P.id)), S = p ? va(
7707
7707
  p,
@@ -7735,14 +7735,14 @@ class Ie {
7735
7735
  removeExistingCommands: f
7736
7736
  };
7737
7737
  })
7738
- ), A = d.map((h) => h.command), u = d.map((h) => h.removeExistingCommands).flat();
7738
+ ), d = A.map((h) => h.command), u = A.map((h) => h.removeExistingCommands).flat();
7739
7739
  return {
7740
- command: new R([...A, ...u]),
7740
+ command: new R([...d, ...u]),
7741
7741
  followup: async () => {
7742
7742
  i && i(!1), await n.setSelectionsAndElements(
7743
7743
  t.stepName,
7744
7744
  e ? [e] : [],
7745
- [...d.map((h) => h.regionEl)],
7745
+ [...A.map((h) => h.regionEl)],
7746
7746
  async () => {
7747
7747
  if (n.updateStorage(t.stepName, { currentFrameSources: l }), s) {
7748
7748
  const h = n.getWorkflowExperience().getStepById(t.stepName)?.frameService;
@@ -7860,13 +7860,13 @@ class Ss {
7860
7860
  if (n?.selectedVariants) {
7861
7861
  const c = n.selectedVariants[0].id;
7862
7862
  if (l && c) {
7863
- const d = l.variants?.find((A) => A.id === c);
7864
- if (d) {
7865
- const A = o.map((u) => ({ id: u.id, region: u.stepRegion }));
7863
+ const A = l.variants?.find((d) => d.id === c);
7864
+ if (A) {
7865
+ const d = o.map((u) => ({ id: u.id, region: u.stepRegion }));
7866
7866
  await e.setSelectionsAndElements(
7867
7867
  t.stepName,
7868
- [d],
7869
- A,
7868
+ [A],
7869
+ d,
7870
7870
  async () => {
7871
7871
  e.updateMetadata(t.stepName, {
7872
7872
  colors: n.storage?.colors
@@ -7889,21 +7889,21 @@ class Ss {
7889
7889
  }
7890
7890
  async changeColorsCommand(t, e, a, n, i) {
7891
7891
  const s = {};
7892
- for (const [d, A] of i.entries())
7893
- typeof A == "string" ? s[d] = {
7894
- browserValue: A,
7892
+ for (const [A, d] of i.entries())
7893
+ typeof d == "string" ? s[A] = {
7894
+ browserValue: d,
7895
7895
  spotColor: void 0,
7896
7896
  pmsValue: void 0
7897
- } : s[d] = {
7898
- browserValue: A.browserValue,
7899
- spotColor: A.spotColor,
7900
- pmsValue: A.pmsValue
7897
+ } : s[A] = {
7898
+ browserValue: d.browserValue,
7899
+ spotColor: d.spotColor,
7900
+ pmsValue: d.pmsValue
7901
7901
  };
7902
7902
  const o = pa(t, e, a, s), l = await _t(o), c = [];
7903
- for (const d of n) {
7904
- for (const [A, u] of i.entries())
7905
- c.push(new la(d, A, u));
7906
- c.push(new Cs(d, o, l));
7903
+ for (const A of n) {
7904
+ for (const [d, u] of i.entries())
7905
+ c.push(new la(A, d, u));
7906
+ c.push(new Cs(A, o, l));
7907
7907
  }
7908
7908
  return new R(c);
7909
7909
  }
@@ -7923,13 +7923,13 @@ class Ss {
7923
7923
  o[h] = { browserValue: g, spotColor: o[h]?.spotColor, pmsValue: p }, l[h] = { browserValue: g };
7924
7924
  }
7925
7925
  let c = Array.from(Object.values(o)).map((h) => h.browserValue);
7926
- const d = t.data.colorOption;
7927
- d && d.variants?.forEach((h) => {
7926
+ const A = t.data.colorOption;
7927
+ A && A.variants?.forEach((h) => {
7928
7928
  c = c.map((m) => m.toLowerCase() === h.color?.toLowerCase() ? h.name : m);
7929
7929
  }), a.updateMetadata(t.stepName, { colors: c });
7930
- const A = /* @__PURE__ */ new Map();
7930
+ const d = /* @__PURE__ */ new Map();
7931
7931
  if (Object.entries(o).forEach(([h, m]) => {
7932
- A.set(h, m);
7932
+ d.set(h, m);
7933
7933
  }), !s.svg)
7934
7934
  throw new Error("Colors changed before SVG loaded. This should never happen!");
7935
7935
  const u = await this.changeColorsCommand(
@@ -7937,7 +7937,7 @@ class Ss {
7937
7937
  s.width,
7938
7938
  s.height,
7939
7939
  e.map((h) => h.id),
7940
- A
7940
+ d
7941
7941
  );
7942
7942
  a.updateStorage(t.stepName, {
7943
7943
  colors: l
@@ -7959,7 +7959,7 @@ class Ss {
7959
7959
  const l = o.fileLink;
7960
7960
  if (!l)
7961
7961
  throw new Ht(o);
7962
- const c = await ot(await this.getIllustrationBody(l)), d = await _t(c.svg), A = (f) => {
7962
+ const c = await ot(await this.getIllustrationBody(l)), A = await _t(c.svg), d = (f) => {
7963
7963
  const S = i.getLayouts().find((I) => I.panelId === f.panelId);
7964
7964
  if (!S)
7965
7965
  throw new Y(f);
@@ -7969,11 +7969,11 @@ class Ss {
7969
7969
  command: this.getCreateElementCommand(v, f, S, {
7970
7970
  stepName: t.stepName,
7971
7971
  src: l,
7972
- objectURL: d,
7972
+ objectURL: A,
7973
7973
  svg: c
7974
7974
  })
7975
7975
  };
7976
- }, u = t.data.regions.map(A), m = [...u.map((f) => f.command), ...s];
7976
+ }, u = t.data.regions.map(d), m = [...u.map((f) => f.command), ...s];
7977
7977
  let g = Array.from(Object.values(c.colors)).map((f) => f.browserValue);
7978
7978
  const p = t.data.colorOption;
7979
7979
  return p && p.variants?.forEach((f) => {
@@ -8052,12 +8052,12 @@ class vs {
8052
8052
  if (n?.selectedVariants) {
8053
8053
  const c = n.selectedVariants[0].id;
8054
8054
  if (c) {
8055
- const d = l.variants?.find((A) => A.id === c);
8056
- if (d) {
8057
- const A = d.material, u = o.map((h) => ({ id: h.id, region: h.stepRegion }));
8055
+ const A = l.variants?.find((d) => d.id === c);
8056
+ if (A) {
8057
+ const d = A.material, u = o.map((h) => ({ id: h.id, region: h.stepRegion }));
8058
8058
  await e.setSelectionsAndElements(
8059
8059
  t.stepName,
8060
- [d],
8060
+ [A],
8061
8061
  u,
8062
8062
  async () => {
8063
8063
  const h = e.getModelContainer();
@@ -8065,7 +8065,7 @@ class vs {
8065
8065
  const m = t.data.targetMaterials.map((g) => h.applyMaterialVariant(
8066
8066
  g,
8067
8067
  l.id || "",
8068
- A || {}
8068
+ d || {}
8069
8069
  ));
8070
8070
  Promise.all(m).then(
8071
8071
  () => e.setMandatoryFulfilled(t.stepName, !0)
@@ -8126,18 +8126,18 @@ class Es {
8126
8126
  if (n?.selectedVariants) {
8127
8127
  const c = n.selectedVariants[0].id;
8128
8128
  if (l && c) {
8129
- const d = l.variants?.find((A) => A.id === c);
8130
- if (d) {
8131
- const A = o.map((u) => ({ id: u.id, region: u.stepRegion }));
8129
+ const A = l.variants?.find((d) => d.id === c);
8130
+ if (A) {
8131
+ const d = o.map((u) => ({ id: u.id, region: u.stepRegion }));
8132
8132
  await e.setSelectionsAndElements(
8133
8133
  t.stepName,
8134
- [d],
8135
- A,
8134
+ [A],
8135
+ d,
8136
8136
  async () => {
8137
8137
  const u = e.getModelContainer();
8138
8138
  if (u && t.option) {
8139
- const h = d.asset?.fileLink;
8140
- if (!h) throw new vt(d);
8139
+ const h = A.asset?.fileLink;
8140
+ if (!h) throw new vt(A);
8141
8141
  await u.applyModelVariant(
8142
8142
  t.stepName || "",
8143
8143
  {
@@ -8217,57 +8217,57 @@ class bs {
8217
8217
  if (a.setMandatoryFulfilled(t.stepName, e !== ""), !t.data || !t.data.regions || t.data.regions.length <= 0)
8218
8218
  return console.error("Missing configuration."), null;
8219
8219
  a.updateStorage(t.stepName, { text: e }), a.updateMetadata(t.stepName, { text: e });
8220
- const c = (d, A, u) => {
8221
- const h = u || M(), g = a.getLayouts().find((f) => f.panelId === A.panelId);
8220
+ const c = (A, d, u) => {
8221
+ const h = u || M(), g = a.getLayouts().find((f) => f.panelId === d.panelId);
8222
8222
  if (!g)
8223
- return console.error(`Can not find layout for region: ${A.panelId}`), null;
8223
+ return console.error(`Can not find layout for region: ${d.panelId}`), null;
8224
8224
  const p = [];
8225
8225
  return u && p.push(new bt(h)), p.push(
8226
8226
  new z(
8227
8227
  {
8228
- stepRegion: A,
8228
+ stepRegion: d,
8229
8229
  stepName: t.stepName,
8230
8230
  colors: {},
8231
8231
  id: h,
8232
- svg: d,
8232
+ svg: A,
8233
8233
  type: x.Illustration,
8234
- y: A.top,
8235
- x: A.left,
8236
- rotation: A.rotation,
8237
- width: A.width,
8238
- height: A.height,
8239
- layer: A.layer,
8240
- layerIndex: A.layerIndex,
8241
- immutable: A.immutable
8234
+ y: d.top,
8235
+ x: d.left,
8236
+ rotation: d.rotation,
8237
+ width: d.width,
8238
+ height: d.height,
8239
+ layer: d.layer,
8240
+ layerIndex: d.layerIndex,
8241
+ immutable: d.immutable
8242
8242
  },
8243
8243
  g
8244
8244
  )
8245
8245
  ), {
8246
8246
  id: h,
8247
- region: A,
8247
+ region: d,
8248
8248
  command: new R(p)
8249
8249
  };
8250
8250
  };
8251
8251
  if (i.length > 0) {
8252
- const A = i.map((u) => {
8252
+ const d = i.map((u) => {
8253
8253
  if (!u.region)
8254
8254
  return null;
8255
8255
  const h = s.svgPrint(e, u.region);
8256
8256
  return c(h, u.region, u.id);
8257
8257
  }).filter((u) => !!u).filter((u) => !!u).map((u) => u && u.command);
8258
8258
  return {
8259
- command: new R(A),
8259
+ command: new R(d),
8260
8260
  followup: async () => {
8261
8261
  }
8262
8262
  };
8263
8263
  } else {
8264
- const d = t.data.regions.map(
8264
+ const A = t.data.regions.map(
8265
8265
  (u) => c(s.svgPrint(e, u), u)
8266
- ), A = d.filter((u) => !!u).map((u) => u && u.command);
8266
+ ), d = A.filter((u) => !!u).map((u) => u && u.command);
8267
8267
  return {
8268
- command: new R(A),
8268
+ command: new R(d),
8269
8269
  followup: async () => {
8270
- const u = d.filter((h) => h).map((h) => h && { id: h.id, region: h.region });
8270
+ const u = A.filter((h) => h).map((h) => h && { id: h.id, region: h.region });
8271
8271
  await a.setSelectionsAndElements(
8272
8272
  t.stepName,
8273
8273
  [],
@@ -8316,13 +8316,13 @@ class Bs {
8316
8316
  if (n?.selectedVariants) {
8317
8317
  const c = n.selectedVariants[0].id;
8318
8318
  if (l && c) {
8319
- const d = l.variants?.find((A) => A.id === c);
8320
- if (d) {
8321
- const A = o.map((u) => ({ id: u.id, region: u.stepRegion }));
8319
+ const A = l.variants?.find((d) => d.id === c);
8320
+ if (A) {
8321
+ const d = o.map((u) => ({ id: u.id, region: u.stepRegion }));
8322
8322
  await e.setSelectionsAndElements(
8323
8323
  t.stepName,
8324
- [d],
8325
- A,
8324
+ [A],
8325
+ d,
8326
8326
  async () => {
8327
8327
  e.setMandatoryFulfilled(t.stepName, !0);
8328
8328
  }
@@ -8343,41 +8343,41 @@ class Bs {
8343
8343
  if (!s)
8344
8344
  return console.error("No URL for picture!"), null;
8345
8345
  n(!0), t.mandatory && a.setMandatoryFulfilled(t.stepName, !1);
8346
- const l = a.getRegionElements(t.stepName).map((A) => new bt(A.id)), c = (A) => {
8347
- const h = a.getLayouts().find((g) => g.panelId === A.panelId);
8346
+ const l = a.getRegionElements(t.stepName).map((d) => new bt(d.id)), c = (d) => {
8347
+ const h = a.getLayouts().find((g) => g.panelId === d.panelId);
8348
8348
  if (!h)
8349
- throw new Y(A);
8349
+ throw new Y(d);
8350
8350
  const m = M();
8351
8351
  return {
8352
- regionElement: { id: m, region: A },
8352
+ regionElement: { id: m, region: d },
8353
8353
  command: new z(
8354
8354
  {
8355
8355
  stepName: t.stepName,
8356
- stepRegion: A,
8356
+ stepRegion: d,
8357
8357
  id: m,
8358
8358
  src: s,
8359
8359
  type: x.Image,
8360
- y: A.top,
8361
- x: A.left,
8362
- rotation: A.rotation,
8363
- width: A.width,
8364
- height: A.height,
8365
- layer: A.layer,
8366
- layerIndex: A.layerIndex,
8367
- immutable: A.immutable,
8360
+ y: d.top,
8361
+ x: d.left,
8362
+ rotation: d.rotation,
8363
+ width: d.width,
8364
+ height: d.height,
8365
+ layer: d.layer,
8366
+ layerIndex: d.layerIndex,
8367
+ immutable: d.immutable,
8368
8368
  preserveAspectRatio: "none"
8369
8369
  },
8370
8370
  h
8371
8371
  )
8372
8372
  };
8373
- }, d = t.data.regions.map(c);
8373
+ }, A = t.data.regions.map(c);
8374
8374
  return {
8375
- command: new R([...l, ...d.map((A) => A.command)]),
8375
+ command: new R([...l, ...A.map((d) => d.command)]),
8376
8376
  followup: async () => {
8377
8377
  await a.setSelectionsAndElements(
8378
8378
  t.stepName,
8379
8379
  [e],
8380
- d.map((A) => A.regionElement),
8380
+ A.map((d) => d.regionElement),
8381
8381
  async () => {
8382
8382
  a.setMandatoryFulfilled(t.stepName, !0), n(!1);
8383
8383
  }
@@ -8458,7 +8458,7 @@ class Ps {
8458
8458
  setCustomColor(t, e, a) {
8459
8459
  const n = a.getLayouts(), s = (a.getRegionElements(e.stepName) || []).map((o) => {
8460
8460
  const l = o.region;
8461
- if (!n.find((d) => d.panelId === l?.panelId)) throw new Y(l);
8461
+ if (!n.find((A) => A.panelId === l?.panelId)) throw new Y(l);
8462
8462
  return new la(o.id, this.shapeFillId, t);
8463
8463
  }).filter((o) => !!o);
8464
8464
  a.getCommandDispatcher()(new R(s)), a.updateStorage(e.stepName, { colour: t });
@@ -8496,13 +8496,13 @@ class Ps {
8496
8496
  if (n?.selectedVariants) {
8497
8497
  const c = n.selectedVariants[0].id;
8498
8498
  if (l && c) {
8499
- const d = l.variants?.find((A) => A.id === c);
8500
- if (d) {
8501
- const A = o.map((u) => ({ id: u.id, region: u.stepRegion }));
8499
+ const A = l.variants?.find((d) => d.id === c);
8500
+ if (A) {
8501
+ const d = o.map((u) => ({ id: u.id, region: u.stepRegion }));
8502
8502
  await e.setSelectionsAndElements(
8503
8503
  t.stepName,
8504
- [d],
8505
- A,
8504
+ [A],
8505
+ d,
8506
8506
  async () => {
8507
8507
  e.updateStorage(t.stepName, {
8508
8508
  colour: n?.storage?.colour || ""
@@ -8520,13 +8520,13 @@ class Ps {
8520
8520
  throw new Error("Failed to resolve color for shape step.");
8521
8521
  };
8522
8522
  if (a.length > 0) {
8523
- const l = (d) => {
8524
- const A = d.region;
8525
- if (!i.find((m) => m.panelId === A?.panelId))
8526
- throw new Y(A);
8523
+ const l = (A) => {
8524
+ const d = A.region;
8525
+ if (!i.find((m) => m.panelId === d?.panelId))
8526
+ throw new Y(d);
8527
8527
  const h = o();
8528
- return new la(d.id, this.shapeFillId, h);
8529
- }, c = a.map(l).filter((d) => !!d);
8528
+ return new la(A.id, this.shapeFillId, h);
8529
+ }, c = a.map(l).filter((A) => !!A);
8530
8530
  return {
8531
8531
  command: new R(c),
8532
8532
  followup: async () => {
@@ -8589,14 +8589,14 @@ class Ps {
8589
8589
  h
8590
8590
  )
8591
8591
  };
8592
- }, c = t.data.regions.map(l), d = c.filter((u) => !!u).map((u) => u?.command), A = c.filter((u) => !!u).map((u) => ({ id: u.id, region: u.region }));
8592
+ }, c = t.data.regions.map(l), A = c.filter((u) => !!u).map((u) => u?.command), d = c.filter((u) => !!u).map((u) => ({ id: u.id, region: u.region }));
8593
8593
  return {
8594
- command: new R(d),
8594
+ command: new R(A),
8595
8595
  followup: async () => {
8596
8596
  await n.setSelectionsAndElements(
8597
8597
  t.stepName,
8598
8598
  e.variant ? [e.variant] : [],
8599
- A,
8599
+ d,
8600
8600
  async () => {
8601
8601
  n.updateStorage(t.stepName, { colour: o() });
8602
8602
  }
@@ -8633,18 +8633,18 @@ class Ds {
8633
8633
  }
8634
8634
  }
8635
8635
  const Fs = new Ds(), He = (r, t, e, a, n) => {
8636
- if (t.some((d) => d == null))
8636
+ if (t.some((A) => A == null))
8637
8637
  throw new Error(`Failed to autosize lines: ${t.join(", ")}`);
8638
- let i = t.map((d) => d.split(`
8639
- `)).flat(), s = i.length, o = i.map((d) => mt(d, a, n));
8638
+ let i = t.map((A) => A.split(`
8639
+ `)).flat(), s = i.length, o = i.map((A) => mt(A, a, n));
8640
8640
  const l = n.getApproximateHeight() * a;
8641
8641
  let c = !0;
8642
8642
  for (; c; ) {
8643
8643
  if (l + (s - 1) * e > r.height)
8644
8644
  return [null, null];
8645
- const A = Math.max(...o);
8646
- if (A <= r.width)
8647
- return [i, A];
8645
+ const d = Math.max(...o);
8646
+ if (d <= r.width)
8647
+ return [i, d];
8648
8648
  const u = o.reduce((p, f, S, v) => f > v[p] ? S : p, 0), h = i[u];
8649
8649
  let m = !1, g = h.length;
8650
8650
  for (; !m && g > -1; ) {
@@ -8667,15 +8667,15 @@ const Fs = new Ds(), He = (r, t, e, a, n) => {
8667
8667
  return [i, s] = He(e, a, r, u, o), [n.size, i, s];
8668
8668
  }
8669
8669
  const c = 6;
8670
- let d = c - ze;
8670
+ let A = c - ze;
8671
8671
  if (a.length > 0) {
8672
8672
  let u = a, h = 0;
8673
- for (; (!n.maxSize || d <= n.maxSize) && u; )
8674
- d += ze, h = d / l.unitsPerEm, [u, s] = He(e, a, d, h, o);
8673
+ for (; (!n.maxSize || A <= n.maxSize) && u; )
8674
+ A += ze, h = A / l.unitsPerEm, [u, s] = He(e, a, A, h, o);
8675
8675
  }
8676
- d > c && (d -= ze), n.minSize && d < n.minSize && (d = n.minSize);
8677
- const A = d / l.unitsPerEm;
8678
- return [i, s] = He(e, a, d, A, o), [d, i, s];
8676
+ A > c && (A -= ze), n.minSize && A < n.minSize && (A = n.minSize);
8677
+ const d = A / l.unitsPerEm;
8678
+ return [i, s] = He(e, a, A, d, o), [A, i, s];
8679
8679
  }, Ye = 30;
8680
8680
  class Pe extends Error {
8681
8681
  constructor(t) {
@@ -8710,9 +8710,9 @@ class ks {
8710
8710
  a.data && a.data.maxLength && e.length > a.data.maxLength && (i || (i = {}), i.hitCharacterLimit = !0);
8711
8711
  const s = n.getProfanities(), o = ta(t.toLowerCase());
8712
8712
  for (const c of o)
8713
- for (const d in s) {
8714
- const A = s[d].toLowerCase().replace(/\s/g, "");
8715
- if (c === A) {
8713
+ for (const A in s) {
8714
+ const d = s[A].toLowerCase().replace(/\s/g, "");
8715
+ if (c === d) {
8716
8716
  i || (i = {}), i.blockedProfanity = !0;
8717
8717
  break;
8718
8718
  }
@@ -8733,11 +8733,11 @@ class ks {
8733
8733
  height: o.height,
8734
8734
  width: o.width,
8735
8735
  scale: t.data.imageFillScale || 1
8736
- } : void 0, c = this.getDefaultStrokeColorVariant(t.data), d = t.data.strokeEnabled && c?.color ? {
8736
+ } : void 0, c = this.getDefaultStrokeColorVariant(t.data), A = t.data.strokeEnabled && c?.color ? {
8737
8737
  browserValue: c.color,
8738
8738
  pmsValue: c.name
8739
8739
  } : void 0;
8740
- let A = t.data.defaultText || "";
8740
+ let d = t.data.defaultText || "";
8741
8741
  const u = e.getWorkflowExperience().getBundle();
8742
8742
  if (u && t.globalPropertyAspectConfigurations) {
8743
8743
  const g = u.getGlobalPropertyConfiguration()?.aspects?.find(
@@ -8745,17 +8745,17 @@ class ks {
8745
8745
  );
8746
8746
  if (g) {
8747
8747
  const f = u.getGlobalPropertyStateManager().getAspect(g.name);
8748
- f && (A = f);
8748
+ f && (d = f);
8749
8749
  }
8750
8750
  }
8751
8751
  e.updateStorage(t.stepName, {
8752
- text: A,
8752
+ text: d,
8753
8753
  inputText: t.data.defaultText || "",
8754
8754
  color: this.getDefaultColorVariant(t.data)?.color || this.getDefaultColor(t.data),
8755
8755
  fillImage: l,
8756
- strokeColor: d
8756
+ strokeColor: A
8757
8757
  }), e.updateMetadata(t.stepName, {
8758
- text: A,
8758
+ text: d,
8759
8759
  color: this.getDefaultColorVariant(t.data)?.name || this.getDefaultColor(t.data),
8760
8760
  fillImage: i?.name,
8761
8761
  strokeColor: t.data.strokeEnabled ? c?.color : void 0
@@ -8765,7 +8765,7 @@ class ks {
8765
8765
  return this.selectVariantCommand(
8766
8766
  t,
8767
8767
  h,
8768
- { text: A },
8768
+ { text: d },
8769
8769
  [],
8770
8770
  e,
8771
8771
  () => {
@@ -8773,7 +8773,7 @@ class ks {
8773
8773
  () => {
8774
8774
  },
8775
8775
  l,
8776
- d
8776
+ A
8777
8777
  );
8778
8778
  }
8779
8779
  return null;
@@ -8912,7 +8912,7 @@ class ks {
8912
8912
  if (l.errorData)
8913
8913
  return l;
8914
8914
  l.helperData.charactersRemaining = a.data.maxLength - o.length;
8915
- const c = [], d = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map();
8915
+ const c = [], A = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
8916
8916
  for (const u of e) {
8917
8917
  if (!u.fontData) throw new V("Failed to resolve font data for text.");
8918
8918
  const [h, m] = fe(
@@ -8922,12 +8922,12 @@ class ks {
8922
8922
  [s],
8923
8923
  { size: a.data.size, minSize: a.data.minSize, maxSize: a.data.maxSize }
8924
8924
  );
8925
- d.set(u.id, h), A.set(u.id, m);
8925
+ A.set(u.id, h), d.set(u.id, m);
8926
8926
  const g = a.data.curved ? s : (m || []).join(`
8927
8927
  `);
8928
8928
  c.push(this.generateTextChangeCommandsForRegion(h, a.data, u.id, g));
8929
8929
  }
8930
- return !a.data.curved && e.length > 0 && !Array.from(A.values()).every((h) => h) ? (l.errorData || (l.errorData = {}), l.errorData.doesNotFit = !0, l) : (n.updateStorage(a.stepName, { text: t }), n.updateMetadata(a.stepName, {
8930
+ return !a.data.curved && e.length > 0 && !Array.from(d.values()).every((h) => h) ? (l.errorData || (l.errorData = {}), l.errorData.doesNotFit = !0, l) : (n.updateStorage(a.stepName, { text: t }), n.updateMetadata(a.stepName, {
8931
8931
  text: s
8932
8932
  }), (i?.defaultCleared || !a.data.deleteDefaultOnFocus) && s.trim() !== "" && n.setMandatoryFulfilled(a.stepName, !0), l.command = new R(c), l);
8933
8933
  }
@@ -8962,9 +8962,9 @@ class ks {
8962
8962
  if (n?.selectedVariants) {
8963
8963
  const c = n.selectedVariants[0].id;
8964
8964
  if (l && c) {
8965
- const d = l.variants?.find((A) => A.id === c);
8966
- if (d) {
8967
- const A = await this.fontDataFromVariant(d), u = o.map((p) => ({ id: p.id, region: p.stepRegion })), h = n.storage?.color;
8965
+ const A = l.variants?.find((d) => d.id === c);
8966
+ if (A) {
8967
+ const d = await this.fontDataFromVariant(A), u = o.map((p) => ({ id: p.id, region: p.stepRegion })), h = n.storage?.color;
8968
8968
  let m = n.storage?.text;
8969
8969
  const g = e.getWorkflowExperience().getBundle();
8970
8970
  if (g && t.globalPropertyAspectConfigurations) {
@@ -8978,11 +8978,11 @@ class ks {
8978
8978
  }
8979
8979
  if (await e.setSelectionsAndElements(
8980
8980
  t.stepName,
8981
- [d],
8981
+ [A],
8982
8982
  u,
8983
8983
  async () => {
8984
8984
  e.updateMetadata(t.stepName, { color: h, text: m }), e.updateStorage(t.stepName, { text: m, inputText: m });
8985
- const p = o.map((S) => new Wa(S.id, A)), f = new R(p);
8985
+ const p = o.map((S) => new Wa(S.id, d)), f = new R(p);
8986
8986
  e.getCommandDispatcher()(f);
8987
8987
  }
8988
8988
  ), o.length === 0 && l) {
@@ -9015,11 +9015,11 @@ class ks {
9015
9015
  } else {
9016
9016
  const c = e.getWorkflowExperience().getBundle();
9017
9017
  if (c && t.globalPropertyAspectConfigurations) {
9018
- const A = c.getGlobalPropertyConfiguration()?.aspects?.find(
9018
+ const d = c.getGlobalPropertyConfiguration()?.aspects?.find(
9019
9019
  (u) => u.type === L.Text && t.globalPropertyAspectConfigurations?.map((h) => h.aspectName).includes(u.name)
9020
9020
  );
9021
- if (A) {
9022
- const h = c.getGlobalPropertyStateManager().getAspect(A.name);
9021
+ if (d) {
9022
+ const h = c.getGlobalPropertyStateManager().getAspect(d.name);
9023
9023
  if (h)
9024
9024
  if (o.length === 0 && l) {
9025
9025
  const m = H.getDefaultVariant(l);
@@ -9083,9 +9083,9 @@ class ks {
9083
9083
  };
9084
9084
  }
9085
9085
  async selectVariantCommand(t, e, a, n, i, s, o, l, c) {
9086
- const d = i.markUpdatePending(), A = await this.fontDataFromVariant(e);
9086
+ const A = i.markUpdatePending(), d = await this.fontDataFromVariant(e);
9087
9087
  if (n.length > 0) {
9088
- const u = n.map((g) => new Wa(g.id, A));
9088
+ const u = n.map((g) => new Wa(g.id, d));
9089
9089
  if (l) {
9090
9090
  const g = n.map((p) => new qe(p.id, l));
9091
9091
  u.push(...g);
@@ -9099,7 +9099,7 @@ class ks {
9099
9099
  const h = await this.changeInputTextWithRegion(
9100
9100
  t,
9101
9101
  t.data.size || Ye,
9102
- A,
9102
+ d,
9103
9103
  a.text || "",
9104
9104
  a,
9105
9105
  i,
@@ -9110,7 +9110,7 @@ class ks {
9110
9110
  return h && u.push(h), {
9111
9111
  command: new R(u),
9112
9112
  followup: async () => {
9113
- i.markUpdateCompleted(d), await i.setSelectionsAndElements(t.stepName, [e], n);
9113
+ i.markUpdateCompleted(A), await i.setSelectionsAndElements(t.stepName, [e], n);
9114
9114
  }
9115
9115
  };
9116
9116
  } else {
@@ -9118,13 +9118,13 @@ class ks {
9118
9118
  t.stepName,
9119
9119
  e,
9120
9120
  t.data,
9121
- A,
9121
+ d,
9122
9122
  a,
9123
9123
  i
9124
9124
  ), h = await this.changeInputTextWithRegion(
9125
9125
  t,
9126
9126
  t.data.size || Ye,
9127
- A,
9127
+ d,
9128
9128
  u[0]?.newElement.input || a.text || t.data.defaultText || "",
9129
9129
  a,
9130
9130
  i,
@@ -9147,7 +9147,7 @@ class ks {
9147
9147
  return h && m.push(h), {
9148
9148
  command: new R(m),
9149
9149
  followup: async () => {
9150
- i.markUpdateCompleted(d);
9150
+ i.markUpdateCompleted(A);
9151
9151
  }
9152
9152
  };
9153
9153
  }
@@ -9163,11 +9163,11 @@ class ks {
9163
9163
  async createTextboxRegions(t, e, a, n, i, s) {
9164
9164
  if (!a || !a.regions)
9165
9165
  throw new Error("Step data not supplied");
9166
- const o = i.text || a.defaultText || "", l = this.getProcessedInput(o, a, !1), c = async (A) => {
9167
- const h = s.getLayouts().find((g) => g.panelId === A.panelId), m = M();
9166
+ const o = i.text || a.defaultText || "", l = this.getProcessedInput(o, a, !1), c = async (d) => {
9167
+ const h = s.getLayouts().find((g) => g.panelId === d.panelId), m = M();
9168
9168
  try {
9169
9169
  if (!h)
9170
- throw new De("Failed to find layout for region: " + A.panelId);
9170
+ throw new De("Failed to find layout for region: " + d.panelId);
9171
9171
  const g = a.colorOption;
9172
9172
  let p;
9173
9173
  if (g && g.variants) {
@@ -9177,25 +9177,25 @@ class ks {
9177
9177
  });
9178
9178
  }
9179
9179
  const f = await this.getDefaultColor(a), S = f || "#000000", v = {
9180
- stepRegion: A,
9180
+ stepRegion: d,
9181
9181
  stepName: t,
9182
9182
  align: this.textAlign(a),
9183
9183
  fill: i.color ? i.color : S,
9184
9184
  fontSize: a.size || Ye,
9185
9185
  fontData: n,
9186
9186
  id: m,
9187
- layer: A.layer,
9188
- layerIndex: A.layerIndex,
9189
- rotation: A.rotation,
9187
+ layer: d.layer,
9188
+ layerIndex: d.layerIndex,
9189
+ rotation: d.rotation,
9190
9190
  text: l,
9191
9191
  input: o,
9192
9192
  type: x.Textbox,
9193
9193
  vertical: a.vertical,
9194
- x: A.left,
9195
- y: A.top,
9196
- height: A.height,
9197
- width: A.width,
9198
- immutable: A.immutable,
9194
+ x: d.left,
9195
+ y: d.top,
9196
+ height: d.height,
9197
+ width: d.width,
9198
+ immutable: d.immutable,
9199
9199
  verticalAlign: a.verticalAlign || "middle",
9200
9200
  curved: a.curved,
9201
9201
  paths: a.paths,
@@ -9224,7 +9224,7 @@ class ks {
9224
9224
  );
9225
9225
  const Q = new z(v, h);
9226
9226
  return {
9227
- regionElement: { id: m, region: A },
9227
+ regionElement: { id: m, region: d },
9228
9228
  commands: [Q, ...I],
9229
9229
  newElement: v,
9230
9230
  fontData: n
@@ -9232,13 +9232,13 @@ class ks {
9232
9232
  } catch (g) {
9233
9233
  throw console.log(g), new Pe("Error adding font to region");
9234
9234
  }
9235
- }, d = await Promise.all(a.regions.map(c)).catch((A) => {
9236
- throw A instanceof Pe ? (Fs.setLatestToast("Failed to load font.", Oe.Error), A) : A instanceof De ? A : new Error(A);
9235
+ }, A = await Promise.all(a.regions.map(c)).catch((d) => {
9236
+ throw d instanceof Pe ? (Fs.setLatestToast("Failed to load font.", Oe.Error), d) : d instanceof De ? d : new Error(d);
9237
9237
  });
9238
9238
  return await s.setSelectionsAndElements(
9239
9239
  t,
9240
9240
  [e],
9241
- d.map((A) => A.regionElement),
9241
+ A.map((d) => d.regionElement),
9242
9242
  async () => {
9243
9243
  s.updateMetadata(t, {
9244
9244
  text: o
@@ -9246,7 +9246,7 @@ class ks {
9246
9246
  text: o
9247
9247
  });
9248
9248
  }
9249
- ), d;
9249
+ ), A;
9250
9250
  }
9251
9251
  generateTextChangeCommandsForRegion(t, e, a, n) {
9252
9252
  const i = [], s = new fs(a, n);
@@ -9259,8 +9259,8 @@ class ks {
9259
9259
  /**
9260
9260
  * @deprecated
9261
9261
  */
9262
- async changeInputTextWithRegion(t, e, a, n, i, s, o, l, c, d) {
9263
- const A = (n || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), u = this.getProcessedInput(A, t.data, o), h = s.getRegionElements(t.stepName), m = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
9262
+ async changeInputTextWithRegion(t, e, a, n, i, s, o, l, c, A) {
9263
+ const d = (n || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), u = this.getProcessedInput(d, t.data, o), h = s.getRegionElements(t.stepName), m = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
9264
9264
  for (const I of h)
9265
9265
  if (I.region) {
9266
9266
  const [C, b] = fe(
@@ -9275,7 +9275,7 @@ class ks {
9275
9275
  const f = (() => {
9276
9276
  const I = Kt(u, s);
9277
9277
  if (t.data && t.data.maxLength && I.length > t.data.maxLength)
9278
- return d && d(!0), { info: "0" };
9278
+ return A && A(!0), { info: "0" };
9279
9279
  const C = s.getProfanities(), b = ta(u.toLowerCase());
9280
9280
  for (const P of b)
9281
9281
  for (const B in C) {
@@ -9290,11 +9290,11 @@ class ks {
9290
9290
  c(f.error);
9291
9291
  return;
9292
9292
  }
9293
- if (c(`${f.info} characters remaining` || ""), d)
9293
+ if (c(`${f.info} characters remaining` || ""), A)
9294
9294
  return;
9295
- s.updateStorage(t.stepName, { text: A }), s.updateMetadata(t.stepName, {
9296
- text: this.injectReplaceableText(A, t.data)
9297
- }), (i.defaultCleared || !t.data.deleteDefaultOnFocus) && A.trim() !== "" && s.setMandatoryFulfilled(t.stepName, !0);
9295
+ s.updateStorage(t.stepName, { text: d }), s.updateMetadata(t.stepName, {
9296
+ text: this.injectReplaceableText(d, t.data)
9297
+ }), (i.defaultCleared || !t.data.deleteDefaultOnFocus) && d.trim() !== "" && s.setMandatoryFulfilled(t.stepName, !0);
9298
9298
  const S = [];
9299
9299
  for (const I of h) {
9300
9300
  const C = t.data.curved ? u : (g.get(I.id) || []).join(`
@@ -9339,8 +9339,8 @@ function Os(r, t, e, a, n, i) {
9339
9339
  };
9340
9340
  if (l.width <= 0)
9341
9341
  return;
9342
- const c = $s(l.height, l.width, e * s, a * o), d = (a - c * l.width) / 2 - c * l.x, A = (e - c * l.height) / 2 - c * l.y;
9343
- r.setAttribute("transform", `translate(${d} ${A}) scale(${c} ${c})`);
9342
+ const c = $s(l.height, l.width, e * s, a * o), A = (a - c * l.width) / 2 - c * l.x, d = (e - c * l.height) / 2 - c * l.y;
9343
+ r.setAttribute("transform", `translate(${A} ${d}) scale(${c} ${c})`);
9344
9344
  }
9345
9345
  function $s(r, t, e, a) {
9346
9346
  const n = e / r, i = a / t;
@@ -9378,15 +9378,15 @@ class Us {
9378
9378
  let l = e !== o;
9379
9379
  const c = ja[i.type];
9380
9380
  l && (s.push(o), e = o);
9381
- for (const d of c) {
9382
- const A = i[d];
9381
+ for (const A of c) {
9382
+ const d = i[A];
9383
9383
  let u;
9384
- switch (typeof A) {
9384
+ switch (typeof d) {
9385
9385
  case "boolean":
9386
- u = A | 0;
9386
+ u = d | 0;
9387
9387
  break;
9388
9388
  case "number":
9389
- u = (A * 100 | 0) / 100;
9389
+ u = (d * 100 | 0) / 100;
9390
9390
  break;
9391
9391
  default:
9392
9392
  throw new Dt("Failed to encode path.");
@@ -9411,11 +9411,11 @@ class Us {
9411
9411
  throw new Dt(
9412
9412
  `Path type "${s}" given ${o.length} arguments, not divisible by ${c.length}`
9413
9413
  );
9414
- for (let d = 0; d < o.length / c.length; d++) {
9415
- const A = { type: s, relative: l };
9414
+ for (let A = 0; A < o.length / c.length; A++) {
9415
+ const d = { type: s, relative: l };
9416
9416
  for (let u = 0; u < c.length; u++)
9417
- A[c[u]] = o[d * c.length + u];
9418
- n.push(A);
9417
+ d[c[u]] = o[A * c.length + u];
9418
+ n.push(d);
9419
9419
  }
9420
9420
  } else
9421
9421
  n.push({ type: s, relative: l });
@@ -9431,10 +9431,10 @@ class Us {
9431
9431
  for (let s = 0; s < a.length; s++) {
9432
9432
  const [o, l] = a[s];
9433
9433
  if (o in i && l in i) {
9434
- const c = [i[o], i[l]], d = e(c);
9435
- if (d.length < 2)
9434
+ const c = [i[o], i[l]], A = e(c);
9435
+ if (A.length < 2)
9436
9436
  throw new Dt("Transformer must return at least 2 points.");
9437
- i[o] = d[0], i[l] = d[1];
9437
+ i[o] = A[0], i[l] = A[1];
9438
9438
  }
9439
9439
  }
9440
9440
  return i;
@@ -9467,13 +9467,13 @@ class Ls extends Ms {
9467
9467
  return this.svgElement(t, e);
9468
9468
  }
9469
9469
  svgElement(t, e) {
9470
- const a = Zi(Ts), i = t !== "" ? ((v) => v.charAt(0).toUpperCase() + v.substr(1).toLowerCase())(t) : "", s = a.getPath(i, 0, 72, 72), o = s.toSVG(2), l = s.getBoundingBox(), c = l.x2 - l.x1, d = s.toPathData(3), A = () => {
9470
+ const a = Zi(Ts), i = t !== "" ? ((v) => v.charAt(0).toUpperCase() + v.substr(1).toLowerCase())(t) : "", s = a.getPath(i, 0, 72, 72), o = s.toSVG(2), l = s.getBoundingBox(), c = l.x2 - l.x1, A = s.toPathData(3), d = () => {
9471
9471
  const v = et("g");
9472
9472
  v.classList.add("module-text-group");
9473
9473
  const I = et("defs");
9474
9474
  v.appendChild(I), I.appendChild(Qs(0, 2, 2, "shadow"));
9475
9475
  const C = et("path");
9476
- C.setAttribute("d", d), C.setAttribute("stroke", "black"), C.setAttribute("stroke-width", "3"), I.appendChild(C);
9476
+ C.setAttribute("d", A), C.setAttribute("stroke", "black"), C.setAttribute("stroke-width", "3"), I.appendChild(C);
9477
9477
  const b = et("g");
9478
9478
  b.classList.add("module-layer0"), v.appendChild(b), b.setAttribute("filter", "url(#shadow)"), b.innerHTML = C.outerHTML;
9479
9479
  const P = et("g");
@@ -9492,9 +9492,9 @@ class Ls extends Ms {
9492
9492
  g.setAttribute("opacity", "0"), m.appendChild(g);
9493
9493
  const p = et("g");
9494
9494
  p.classList.add("module-text-enclosure"), u.appendChild(p);
9495
- const f = A();
9495
+ const f = d();
9496
9496
  p.appendChild(f);
9497
- const S = fr(d);
9497
+ const S = fr(A);
9498
9498
  return Os(p, S, e.height, e.width, 0.35, 0.65), Rs(u.outerHTML);
9499
9499
  }
9500
9500
  }
@@ -9842,6 +9842,7 @@ const re = w`
9842
9842
  $tags: ProductCollectionProductTagFilterInput
9843
9843
  $sortKey: ProductCollectionProductSortKey
9844
9844
  $sortDescending: Boolean
9845
+ $quickSearch: String
9845
9846
  ) {
9846
9847
  productCollections(ids: [$id]) {
9847
9848
  id
@@ -9852,6 +9853,7 @@ const re = w`
9852
9853
  offset: $offset
9853
9854
  sortKey: $sortKey
9854
9855
  sortDescending: $sortDescending
9856
+ quickSearch: $quickSearch
9855
9857
  ) {
9856
9858
  items {
9857
9859
  ...ProductCollectionProductFields
@@ -10225,14 +10227,14 @@ class Ya extends Fn {
10225
10227
  }
10226
10228
  }
10227
10229
  class yo {
10228
- constructor(t, e, a, n, i, s, o, l, c, d, A, u, h, m = !1, g, p = !1, f = !1, S = !1) {
10230
+ constructor(t, e, a, n, i, s, o, l, c, A, d, u, h, m = !1, g, p = !1, f = !1, S = !1) {
10229
10231
  this.workflowStatePromiseQueue = new xn(1), this.initialized = !1, this.readOnly = !1, this.isReloadedTransaction = !1, this.singleVariantsRenderable = !1, this.stepTags = {}, this.renderLayouts = () => {
10230
10232
  if (!this.previewService) return;
10231
10233
  const v = this.getCommandContext().getAllLayouts(), I = this.getLayoutPreviewService()?.getAll();
10232
10234
  if (I)
10233
10235
  for (const [, C] of I)
10234
10236
  C.render(v);
10235
- }, this.experience = t, this.client = e, this.updateTransaction = o, this.graphQlClient = l, this.commandContext = s, this.reloadedState = h, this.transaction = c, this.readOnly = m, this.singleVariantsRenderable = f, this.confirmedDesign = !1, this.editedSteps = {}, this.informationResults = [], this.mandatorySteps = {}, this.pendingUpdates = [], this.selectionCost = 0, this.workflow = a, this.stepSpecificServices = {}, this.profanityFilter = n, this.pollers = [], this.allScenes = [], this.layouts = i, this.product = d, this.previewService = A, this.modelContainer = g, this.stepElements = {}, this.stepInitialised = {}, this.stepMetadata = {}, this.stepSelections = {}, this.storage = {}, this.validationErrors = { steps: /* @__PURE__ */ new Map() }, this.confirmCallbacks = [], this.editedCallbacks = [], this.elementsCallbacks = [], this.informationResultCallbacks = [], this.initCallbacks = [], this.mandatoryCallbacks = [], this.makingAdjustmentsCallback = [], this.metadataCallbacks = [], this.selectionCallbacks = [], this.stepSpecificStorageCallbacks = {}, this.storageCallbacks = [], this.validationCallbacks = [], this.recipientCallbacks = [], this.currentAdjustingStepId = "", this.renderableContextService = u, this.renderableContextService?.setWorkflowManager(this), this.isReloadedTransaction = p, this.workflow.steps.forEach((v) => {
10237
+ }, this.experience = t, this.client = e, this.updateTransaction = o, this.graphQlClient = l, this.commandContext = s, this.reloadedState = h, this.transaction = c, this.readOnly = m, this.singleVariantsRenderable = f, this.confirmedDesign = !1, this.editedSteps = {}, this.informationResults = [], this.mandatorySteps = {}, this.pendingUpdates = [], this.selectionCost = 0, this.workflow = a, this.stepSpecificServices = {}, this.profanityFilter = n, this.pollers = [], this.allScenes = [], this.layouts = i, this.product = A, this.previewService = d, this.modelContainer = g, this.stepElements = {}, this.stepInitialised = {}, this.stepMetadata = {}, this.stepSelections = {}, this.storage = {}, this.validationErrors = { steps: /* @__PURE__ */ new Map() }, this.confirmCallbacks = [], this.editedCallbacks = [], this.elementsCallbacks = [], this.informationResultCallbacks = [], this.initCallbacks = [], this.mandatoryCallbacks = [], this.makingAdjustmentsCallback = [], this.metadataCallbacks = [], this.selectionCallbacks = [], this.stepSpecificStorageCallbacks = {}, this.storageCallbacks = [], this.validationCallbacks = [], this.recipientCallbacks = [], this.currentAdjustingStepId = "", this.renderableContextService = u, this.renderableContextService?.setWorkflowManager(this), this.isReloadedTransaction = p, this.workflow.steps.forEach((v) => {
10236
10238
  this.stepTags[v.stepName] = v.tags ?? [];
10237
10239
  }), S && (this.workflowStatePromiseQueue.enabled = !1), this.initializationPromise = this.initializeDefaultWorkflowState(a), this.initializationPromise.then(() => {
10238
10240
  this.initialized = !0;
@@ -10265,7 +10267,7 @@ class yo {
10265
10267
  }
10266
10268
  }), e;
10267
10269
  }
10268
- async updateRecipient(t, e, a, n, i, s, o, l, c, d, A, u, h, m, g, p, f) {
10270
+ async updateRecipient(t, e, a, n, i, s, o, l, c, A, d, u, h, m, g, p, f) {
10269
10271
  if (this.transaction.recipient?.id)
10270
10272
  this.transaction.recipient = {
10271
10273
  id: this.transaction.recipient.id,
@@ -10278,8 +10280,8 @@ class yo {
10278
10280
  postalCode: o || this.transaction.recipient.postalCode,
10279
10281
  country: l || this.transaction.recipient.country,
10280
10282
  mobile: c || this.transaction.recipient.mobile,
10281
- company: d || this.transaction.recipient.company,
10282
- apartment: A || this.transaction.recipient.apartment,
10283
+ company: A || this.transaction.recipient.company,
10284
+ apartment: d || this.transaction.recipient.apartment,
10283
10285
  customField1: u || this.transaction.recipient.customField1,
10284
10286
  customField2: h || this.transaction.recipient.customField2,
10285
10287
  customField3: m || this.transaction.recipient.customField3,
@@ -10301,8 +10303,8 @@ class yo {
10301
10303
  postalCode: o || this.transaction.recipient.postalCode,
10302
10304
  country: l || this.transaction.recipient.country,
10303
10305
  mobile: c || this.transaction.recipient.mobile,
10304
- company: d || this.transaction.recipient.company,
10305
- apartment: A || this.transaction.recipient.apartment,
10306
+ company: A || this.transaction.recipient.company,
10307
+ apartment: d || this.transaction.recipient.apartment,
10306
10308
  customField1: u || this.transaction.recipient.customField1,
10307
10309
  customField2: h || this.transaction.recipient.customField2,
10308
10310
  customField3: m || this.transaction.recipient.customField3,
@@ -10326,8 +10328,8 @@ class yo {
10326
10328
  postalCode: o,
10327
10329
  country: l,
10328
10330
  mobile: c,
10329
- company: d,
10330
- apartment: A,
10331
+ company: A,
10332
+ apartment: d,
10331
10333
  customField1: u,
10332
10334
  customField2: h,
10333
10335
  customField3: m,
@@ -10347,8 +10349,8 @@ class yo {
10347
10349
  postalCode: o,
10348
10350
  country: l,
10349
10351
  mobile: c,
10350
- company: d,
10351
- apartment: A,
10352
+ company: A,
10353
+ apartment: d,
10352
10354
  customField1: u,
10353
10355
  customField2: h,
10354
10356
  customField3: m,
@@ -10603,14 +10605,14 @@ class yo {
10603
10605
  console.error(`Failed to read model url from variant: ${l.id} for step: ${s.stepName}`);
10604
10606
  return;
10605
10607
  }
10606
- const d = s.data;
10608
+ const A = s.data;
10607
10609
  this.modelContainer.applyModelVariant(
10608
10610
  s.stepName,
10609
10611
  {
10610
10612
  model: c,
10611
10613
  contextService: this.getLayoutPreviewService()
10612
10614
  },
10613
- d.replaceProductModel || !1
10615
+ A.replaceProductModel || !1
10614
10616
  );
10615
10617
  } else {
10616
10618
  const c = l.material;
@@ -10618,12 +10620,12 @@ class yo {
10618
10620
  console.error(`Failed to read material from variant: ${l.id} for step: ${s.stepName}`);
10619
10621
  return;
10620
10622
  }
10621
- s.data.targetMaterials.forEach((A) => {
10623
+ s.data.targetMaterials.forEach((d) => {
10622
10624
  if (!this.modelContainer)
10623
10625
  throw new V(
10624
10626
  "We should always have a model container when injecting a preview!"
10625
10627
  );
10626
- this.modelContainer.applyMaterialVariant(A, s.option.id, c);
10628
+ this.modelContainer.applyMaterialVariant(d, s.option.id, c);
10627
10629
  });
10628
10630
  }
10629
10631
  }), await a.getInitializationPromise(), this.renderLayouts();
@@ -10721,7 +10723,7 @@ class yo {
10721
10723
  const e = (a, n) => Object.keys(a).reduce((i, s) => {
10722
10724
  const o = [...a[s] || []];
10723
10725
  return n.forEach((l) => {
10724
- const c = o.findIndex((d) => d.id === l.id);
10726
+ const c = o.findIndex((A) => A.id === l.id);
10725
10727
  c > -1 && o.splice(c, 1);
10726
10728
  }), i[s] = o, i;
10727
10729
  }, {});
@@ -10739,15 +10741,15 @@ class yo {
10739
10741
  const a = this.product;
10740
10742
  if (!a)
10741
10743
  return Promise.resolve({ stepElements: {}, commands: [] });
10742
- const n = async (c, d, A) => {
10744
+ const n = async (c, A, d) => {
10743
10745
  if (c.type === E.SilentIllustration) {
10744
- const u = await new qa(c, d).trigger();
10746
+ const u = await new qa(c, A).trigger();
10745
10747
  return { step: c, results: u };
10746
10748
  } else if (c.type === E.ProductOverlay) {
10747
10749
  const u = await new qa(
10748
10750
  c,
10749
- d,
10750
- A
10751
+ A,
10752
+ d
10751
10753
  ).trigger();
10752
10754
  return { step: c, results: u };
10753
10755
  }
@@ -10762,7 +10764,7 @@ class yo {
10762
10764
  this.markStepsAsInitialised([c.stepName]), e || o.push(n(c, this.layouts, a));
10763
10765
  const l = await Promise.all(o);
10764
10766
  for (const c of l)
10765
- s.stepElements[c.step.stepName] = c.results.map((d) => d.regionElement), s.commands = [...s.commands, ...c.results.map((d) => d.command)];
10767
+ s.stepElements[c.step.stepName] = c.results.map((A) => A.regionElement), s.commands = [...s.commands, ...c.results.map((A) => A.command)];
10766
10768
  return s;
10767
10769
  }
10768
10770
  getStepStorage(t) {
@@ -10835,13 +10837,13 @@ class yo {
10835
10837
  }, this.selectionCost = Object.values(this.stepSelections).reduce((C, b) => C + b.selectedVariants.map((P) => P.priceModifier || 0).reduce((P, B) => P + B, 0), 0), this.workflow.steps.forEach((C) => {
10836
10838
  yt(C, this.stepSelections) || (this.stepInitialised[C.stepName] = !1, delete this.stepMetadata[C.stepName], delete this.stepSelections[C.stepName], delete this.storage[C.stepName]);
10837
10839
  });
10838
- const s = this.allScenes, o = Pt(s, i), l = Pt(s, this.stepSelections), c = o.map((C) => C.silentSteps).flat(), A = l.map((C) => C.silentSteps).flat().filter(
10840
+ const s = this.allScenes, o = Pt(s, i), l = Pt(s, this.stepSelections), c = o.map((C) => C.silentSteps).flat(), d = l.map((C) => C.silentSteps).flat().filter(
10839
10841
  (C) => !c.some((b) => b.stepName === C.stepName)
10840
10842
  );
10841
10843
  c.forEach((C) => {
10842
10844
  yt(C, this.stepSelections) || (this.stepInitialised[C.stepName] = !1);
10843
10845
  });
10844
- const u = this.getInvalidCanvasRegions(), { stepElements: h, commands: m } = await this.stepElementsForIntroducedSilentSteps(A, !1);
10846
+ const u = this.getInvalidCanvasRegions(), { stepElements: h, commands: m } = await this.stepElementsForIntroducedSilentSteps(d, !1);
10845
10847
  this.stepElements = {
10846
10848
  ...this.stepElements,
10847
10849
  ...h,
@@ -11217,10 +11219,10 @@ class So extends Z {
11217
11219
  if (s.length !== 0) {
11218
11220
  const o = {};
11219
11221
  return s.forEach((l) => {
11220
- const c = i.channelNumbers.find((d) => d.number === l.channelNumber);
11222
+ const c = i.channelNumbers.find((A) => A.number === l.channelNumber);
11221
11223
  if (c) {
11222
- const d = c.id.replace(/\W/g, "");
11223
- o[l.channelNumber] = { browserValue: a[d]?.browserValue || "" };
11224
+ const A = c.id.replace(/\W/g, "");
11225
+ o[l.channelNumber] = { browserValue: a[A]?.browserValue || "" };
11224
11226
  }
11225
11227
  }), o;
11226
11228
  }
@@ -11467,24 +11469,24 @@ class Po extends Z {
11467
11469
  s || (e.input = n);
11468
11470
  const o = a.length <= 0, l = o ? { inputText: n, text: n } : { inputText: n };
11469
11471
  this.manager.updateStorage(this.step.stepName, l);
11470
- const c = this.manager.getStepStorage(this.step.stepName), d = G.getProcessedInput(
11472
+ const c = this.manager.getStepStorage(this.step.stepName), A = G.getProcessedInput(
11471
11473
  n,
11472
11474
  this.step.data,
11473
11475
  c?.customiseAllText ?? !1
11474
11476
  );
11475
11477
  if (o)
11476
11478
  s || this.manager.updateMetadata(this.step.stepName, {
11477
- text: d
11479
+ text: A
11478
11480
  });
11479
11481
  else {
11480
- const { command: A, errorData: u, helperData: h } = G.updateInputText(
11482
+ const { command: d, errorData: u, helperData: h } = G.updateInputText(
11481
11483
  n,
11482
11484
  a,
11483
11485
  this.step,
11484
11486
  this.manager
11485
11487
  );
11486
- A && this.manager.getCommandDispatcher()(A), e.helperData = h, e.errorData = u, !s && !u && this.manager.updateMetadata(this.step.stepName, {
11487
- text: d
11488
+ d && this.manager.getCommandDispatcher()(d), e.helperData = h, e.errorData = u, !s && !u && this.manager.updateMetadata(this.step.stepName, {
11489
+ text: A
11488
11490
  });
11489
11491
  }
11490
11492
  return e;
@@ -11852,11 +11854,11 @@ const To = async (r, t) => {
11852
11854
  const n = {};
11853
11855
  let i = {};
11854
11856
  a && (i = a);
11855
- const o = t.steps.map((l) => l.stepTitle).filter((l, c, d) => d.indexOf(l) == c);
11857
+ const o = t.steps.map((l) => l.stepTitle).filter((l, c, A) => A.indexOf(l) == c);
11856
11858
  for (const l of o) {
11857
11859
  if (Object.keys(r).includes(l)) {
11858
- const c = r[l], d = t.steps.find((A) => A.stepTitle === l);
11859
- n[`${d?.stepTitle} selection`] = {
11860
+ const c = r[l], A = t.steps.find((d) => d.stepTitle === l);
11861
+ n[`${A?.stepTitle} selection`] = {
11860
11862
  value: c[0].name,
11861
11863
  priceModifier: c[0].priceModifier
11862
11864
  };
@@ -11869,7 +11871,7 @@ const To = async (r, t) => {
11869
11871
  }
11870
11872
  return n;
11871
11873
  }, _n = (r, t, e, a, n, i, s, o) => {
11872
- const l = t.basePrice || 0, c = r.priceModifierTotal || 0, d = Qo(a, e, void 0, i), u = (k.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map()).get(r.id), h = {
11874
+ const l = t.basePrice || 0, c = r.priceModifierTotal || 0, A = Qo(a, e, void 0, i), u = (k.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map()).get(r.id), h = {
11873
11875
  additionalExternalProductId: r.integrationProduct?.additionalExternalProductId,
11874
11876
  additionalExternalVariantId: r.integrationProduct?.additionalExternalVariantId,
11875
11877
  baseCost: l,
@@ -11877,7 +11879,7 @@ const To = async (r, t) => {
11877
11879
  designProductId: r.externalDesignProductId,
11878
11880
  designProductVariantId: r.externalDesignProductVariantId,
11879
11881
  event: "onComplete",
11880
- exportedData: d,
11882
+ exportedData: A,
11881
11883
  externalCartProductId: r.externalCartProductId,
11882
11884
  externalCartProductVariantId: r.externalCartProductVariantId,
11883
11885
  lineItemImageUrl: s || "",
@@ -11982,9 +11984,9 @@ const To = async (r, t) => {
11982
11984
  cartSelectionsWithPrices: S,
11983
11985
  cartMetadata: g
11984
11986
  };
11985
- }, Ro = async (r, t, e, a, n, i, s, o, l, c, d) => {
11987
+ }, Ro = async (r, t, e, a, n, i, s, o, l, c, A) => {
11986
11988
  l("workflow.steps.finish.finalize.buildingLayouts");
11987
- const { designDetails: A, cartSelectionsWithPrices: u, cartMetadata: h } = await Xn(
11989
+ const { designDetails: d, cartSelectionsWithPrices: u, cartMetadata: h } = await Xn(
11988
11990
  r,
11989
11991
  t,
11990
11992
  e,
@@ -11993,10 +11995,10 @@ const To = async (r, t) => {
11993
11995
  s,
11994
11996
  o,
11995
11997
  c,
11996
- d
11998
+ A
11997
11999
  );
11998
12000
  l("workflow.steps.finish.finalize.creatingDesign");
11999
- const m = await To(A), g = m?.transaction?.previewImageLink;
12001
+ const m = await To(d), g = m?.transaction?.previewImageLink;
12000
12002
  if (!m?.transaction)
12001
12003
  throw new Error("Failed to create design");
12002
12004
  l("workflow.steps.finish.finalize.updatingTransaction");
@@ -12046,15 +12048,15 @@ const To = async (r, t) => {
12046
12048
  if (!s)
12047
12049
  throw new Error("Failed to create designs");
12048
12050
  return t("workflow.steps.finish.finalize.updatingTransaction"), s.map((o, l) => {
12049
- const c = r[l], d = i[l], A = o.transaction;
12051
+ const c = r[l], A = i[l], d = o.transaction;
12050
12052
  return _n(
12051
- A,
12053
+ d,
12052
12054
  c.product,
12053
12055
  c.workflow,
12054
- d.cartSelectionsWithPrices,
12056
+ A.cartSelectionsWithPrices,
12055
12057
  o.sku,
12056
- d.cartMetadata,
12057
- A.previewImageLink,
12058
+ A.cartMetadata,
12059
+ d.previewImageLink,
12058
12060
  o.processExecution?.id
12059
12061
  );
12060
12062
  });
@@ -12280,23 +12282,23 @@ class Go {
12280
12282
  }
12281
12283
  let i = 2048;
12282
12284
  e && e <= 2048 && (i = e);
12283
- const s = pt(i, i), o = this.commandContext.getAllLayouts(), l = a.defaultPreviewPanelIndex || 0, c = a.panels[l], d = o.find((v) => v.layoutState?.layout.panelId === c?.name) || o[0], A = d.layoutState.layout.previewRegion ? {
12284
- x: d.layoutState.layout.previewRegion.left,
12285
- y: d.layoutState.layout.previewRegion.top,
12286
- width: d.layoutState.layout.previewRegion.width,
12287
- height: d.layoutState.layout.previewRegion.height
12285
+ const s = pt(i, i), o = this.commandContext.getAllLayouts(), l = a.defaultPreviewPanelIndex || 0, c = a.panels[l], A = o.find((v) => v.layoutState?.layout.panelId === c?.name) || o[0], d = A.layoutState.layout.previewRegion ? {
12286
+ x: A.layoutState.layout.previewRegion.left,
12287
+ y: A.layoutState.layout.previewRegion.top,
12288
+ width: A.layoutState.layout.previewRegion.width,
12289
+ height: A.layoutState.layout.previewRegion.height
12288
12290
  } : {
12289
12291
  x: 0,
12290
12292
  y: 0,
12291
- width: d.layoutState.layout.width,
12292
- height: d.layoutState.layout.height
12293
- }, u = this.commandContext.getLayoutById(d.layoutState.layout.id), h = s.getContext("2d");
12293
+ width: A.layoutState.layout.width,
12294
+ height: A.layoutState.layout.height
12295
+ }, u = this.commandContext.getLayoutById(A.layoutState.layout.id), h = s.getContext("2d");
12294
12296
  if (!h)
12295
12297
  throw new xe("Failed to obtain 2D context for preview image creation");
12296
12298
  const m = await this.workflowManager.getTemplatingContext(), g = ya(u.layoutState.layout, u.layoutState.elements, {
12297
12299
  renderingConfiguration: {
12298
12300
  purpose: jt.Print,
12299
- region: { left: A.x, top: A.y, width: A.width, height: A.height },
12301
+ region: { left: d.x, top: d.y, width: d.width, height: d.height },
12300
12302
  templatingContext: m
12301
12303
  }
12302
12304
  }), p = mn(g);
@@ -12396,20 +12398,20 @@ class Go {
12396
12398
  );
12397
12399
  }
12398
12400
  async copySelectionsViaGlobalConfiguration(t, e, a) {
12399
- const n = await t.getGlobalProperties(), i = a?.map((c) => c.getId()), s = this.getSteps().filter((c) => i === void 0 || i.includes(c.getId())), o = e.getSteps(), l = (c) => n.find((d) => d.getRawProperty().name === c.aspectName);
12401
+ const n = await t.getGlobalProperties(), i = a?.map((c) => c.getId()), s = this.getSteps().filter((c) => i === void 0 || i.includes(c.getId())), o = e.getSteps(), l = (c) => n.find((A) => A.getRawProperty().name === c.aspectName);
12400
12402
  s.forEach((c) => {
12401
- const d = /* @__PURE__ */ new Set(), A = c.getRaw().globalPropertyAspectConfigurations;
12402
- A !== void 0 && (A.forEach((u) => d.add(JSON.stringify(u))), o.forEach((u) => {
12403
+ const A = /* @__PURE__ */ new Set(), d = c.getRaw().globalPropertyAspectConfigurations;
12404
+ d !== void 0 && (d.forEach((u) => A.add(JSON.stringify(u))), o.forEach((u) => {
12403
12405
  const h = u.getRaw().globalPropertyAspectConfigurations;
12404
12406
  h !== void 0 && h.forEach((m) => {
12405
- const g = l(m), p = d.has(JSON.stringify(m));
12407
+ const g = l(m), p = A.has(JSON.stringify(m));
12406
12408
  if (p && g?.getType() === "Option") {
12407
12409
  const f = u.getCurrentVariant();
12408
12410
  if (!f) return;
12409
- c.selectVariant(f), d.delete(JSON.stringify(m));
12411
+ c.selectVariant(f), A.delete(JSON.stringify(m));
12410
12412
  } else if (p && g?.getType() === "Text") {
12411
12413
  const f = u.getText();
12412
- c.setText(f), d.delete(JSON.stringify(m));
12414
+ c.setText(f), A.delete(JSON.stringify(m));
12413
12415
  }
12414
12416
  });
12415
12417
  }));
@@ -12545,19 +12547,19 @@ class Go {
12545
12547
  switch (i.type) {
12546
12548
  case E.Frame:
12547
12549
  {
12548
- const d = i.data, A = o;
12549
- A.image && d.displayImageOnFinishStep && c.properties.push({
12550
+ const A = i.data, d = o;
12551
+ d.image && A.displayImageOnFinishStep && c.properties.push({
12550
12552
  type: "image",
12551
- value: A.image,
12553
+ value: d.image,
12552
12554
  priceModifier: 0
12553
12555
  });
12554
12556
  }
12555
12557
  break;
12556
12558
  case E.Illustration:
12557
12559
  {
12558
- const d = i.data, A = o;
12559
- if (A && A.colors && A.colors.length > 0 && d.displayColorsOnFinishStep) {
12560
- const u = A.colors.join(", ").toUpperCase();
12560
+ const A = i.data, d = o;
12561
+ if (d && d.colors && d.colors.length > 0 && A.displayColorsOnFinishStep) {
12562
+ const u = d.colors.join(", ").toUpperCase();
12561
12563
  c.properties.push({
12562
12564
  type: "color",
12563
12565
  value: u,
@@ -12568,23 +12570,23 @@ class Go {
12568
12570
  break;
12569
12571
  case E.Module:
12570
12572
  {
12571
- const d = i.data, A = o;
12572
- A && A.text && d.displayTextOnFinishStep && c.properties.push({
12573
+ const A = i.data, d = o;
12574
+ d && d.text && A.displayTextOnFinishStep && c.properties.push({
12573
12575
  type: "text",
12574
- value: A.text,
12576
+ value: d.text,
12575
12577
  priceModifier: 0
12576
12578
  });
12577
12579
  }
12578
12580
  break;
12579
12581
  case E.Text: {
12580
- const d = i.data, A = o;
12581
- A && A.text && d.displayTextOnFinishStep && c.properties.push({
12582
+ const A = i.data, d = o;
12583
+ d && d.text && A.displayTextOnFinishStep && c.properties.push({
12582
12584
  type: "text",
12583
- value: A.text,
12585
+ value: d.text,
12584
12586
  priceModifier: 0
12585
- }), A && A.color && d.displayColorOnFinishStep && c.properties.push({
12587
+ }), d && d.color && A.displayColorOnFinishStep && c.properties.push({
12586
12588
  type: "color",
12587
- value: A.color,
12589
+ value: d.color,
12588
12590
  priceModifier: 0
12589
12591
  });
12590
12592
  }
@@ -12665,7 +12667,7 @@ const Wo = (r) => {
12665
12667
  ], Ho = async (r, t, e) => {
12666
12668
  const a = t.data, n = e.data.baseUrl, i = a.assetUrl.replace("localhost", "localstack"), s = n.slice(0, 4) === "http" ? "" : "https://", o = new URL(s + n);
12667
12669
  o.searchParams.append("video", Qa(JSON.stringify([{ href: i }]))), o.pathname = o.pathname + (o.pathname.slice(-1) === "/" ? "" : "/");
12668
- const l = o.toString(), d = `data:image/svg+xml;base64,${Qa(await ln(l, { type: "svg" }))}`, A = (h) => {
12670
+ const l = o.toString(), A = `data:image/svg+xml;base64,${Qa(await ln(l, { type: "svg" }))}`, d = (h) => {
12669
12671
  const m = r.find((p) => p.panelId === h.panelId);
12670
12672
  if (!m)
12671
12673
  throw new Y(h);
@@ -12673,7 +12675,7 @@ const Wo = (r) => {
12673
12675
  return new z(
12674
12676
  {
12675
12677
  id: g,
12676
- src: d,
12678
+ src: A,
12677
12679
  type: x.Image,
12678
12680
  y: h.top,
12679
12681
  x: h.left,
@@ -12685,7 +12687,7 @@ const Wo = (r) => {
12685
12687
  );
12686
12688
  }, u = e.data.regions;
12687
12689
  try {
12688
- return u.map(A);
12690
+ return u.map(d);
12689
12691
  } catch (h) {
12690
12692
  return console.error(h), [];
12691
12693
  }
@@ -12695,12 +12697,12 @@ const Wo = (r) => {
12695
12697
  const o = As(n, a.option);
12696
12698
  o && (t[a.stepName] = { selectedVariants: [o] });
12697
12699
  const l = async (c) => {
12698
- const d = await $n(c, o?.asset?.fileLink), A = await Re(d), u = M(), h = r.find((g) => g.panelId === c.panelId);
12700
+ const A = await $n(c, o?.asset?.fileLink), d = await Re(A), u = M(), h = r.find((g) => g.panelId === c.panelId);
12699
12701
  if (!h)
12700
12702
  throw new Y(c);
12701
12703
  const m = va(
12702
12704
  s,
12703
- A,
12705
+ d,
12704
12706
  {
12705
12707
  scale: n.scale,
12706
12708
  left: n.x,
@@ -12712,7 +12714,7 @@ const Wo = (r) => {
12712
12714
  new z(
12713
12715
  {
12714
12716
  id: u,
12715
- path: A.path,
12717
+ path: d.path,
12716
12718
  type: x.Frame,
12717
12719
  forceImageCover: a.data.forceImageCover,
12718
12720
  x: c.left,
@@ -12722,8 +12724,8 @@ const Wo = (r) => {
12722
12724
  layer: c.layer,
12723
12725
  layerIndex: c.layerIndex,
12724
12726
  rotation: c.rotation,
12725
- scaleX: c.width / A.width,
12726
- scaleY: c.height / A.height,
12727
+ scaleX: c.width / d.width,
12728
+ scaleY: c.height / d.height,
12727
12729
  pattern: {
12728
12730
  id: `${u}-pattern`,
12729
12731
  src: s.src,
@@ -12759,7 +12761,7 @@ const Wo = (r) => {
12759
12761
  const o = s.asset?.fileLink;
12760
12762
  if (!o)
12761
12763
  return console.error(`No asset link for variant with ID: ${n.illustrationVariantId}`), [];
12762
- const l = await at(o, !0), c = /<svg.*?<\/svg>/s, d = l.match(c) || [], A = d?.length > 0 ? d[0] : "", m = dt().parseFromString(A, "image/svg+xml").firstElementChild;
12764
+ const l = await at(o, !0), c = /<svg.*?<\/svg>/s, A = l.match(c) || [], d = A?.length > 0 ? A[0] : "", m = dt().parseFromString(d, "image/svg+xml").firstElementChild;
12763
12765
  if (!m)
12764
12766
  return console.error("Failed to read SVG."), [];
12765
12767
  ga(m);
@@ -12816,14 +12818,14 @@ const Wo = (r) => {
12816
12818
  }
12817
12819
  }, Ko = async (r, t, e) => {
12818
12820
  const a = await Jn(e.data.module), n = t.data, i = (o, l) => {
12819
- const c = r.find((A) => A.panelId === l.panelId);
12821
+ const c = r.find((d) => d.panelId === l.panelId);
12820
12822
  if (!c)
12821
12823
  throw new Y(l);
12822
- const d = M();
12824
+ const A = M();
12823
12825
  return new z(
12824
12826
  {
12825
12827
  colors: {},
12826
- id: d,
12828
+ id: A,
12827
12829
  svg: o,
12828
12830
  type: x.Illustration,
12829
12831
  y: l.top,
@@ -12848,7 +12850,7 @@ const Wo = (r) => {
12848
12850
  const n = e.data, i = a.option;
12849
12851
  if (!i)
12850
12852
  return console.error(`No option for step ${a.stepName}.`), [];
12851
- const s = i.variants?.find((d) => d.id === n.pictureVariantId) || ne(i);
12853
+ const s = i.variants?.find((A) => A.id === n.pictureVariantId) || ne(i);
12852
12854
  if (!s)
12853
12855
  return console.error(`No variant with ID: ${n.pictureVariantId}`), [];
12854
12856
  if (!s.asset)
@@ -12857,33 +12859,33 @@ const Wo = (r) => {
12857
12859
  const o = s.asset?.fileLink;
12858
12860
  if (!o)
12859
12861
  return console.error(`No asset link for variant with ID: ${n.pictureVariantId}`), [];
12860
- const l = (d) => {
12861
- const A = r.find((h) => h.panelId === d.panelId);
12862
- if (!A)
12863
- throw new Y(d);
12862
+ const l = (A) => {
12863
+ const d = r.find((h) => h.panelId === A.panelId);
12864
+ if (!d)
12865
+ throw new Y(A);
12864
12866
  const u = M();
12865
12867
  return new z(
12866
12868
  {
12867
12869
  id: u,
12868
12870
  src: o,
12869
12871
  type: x.Image,
12870
- y: d.top,
12871
- x: d.left,
12872
- rotation: d.rotation,
12873
- width: d.width,
12874
- height: d.height,
12875
- layer: d.layer,
12876
- layerIndex: d.layerIndex,
12877
- immutable: d.immutable,
12872
+ y: A.top,
12873
+ x: A.left,
12874
+ rotation: A.rotation,
12875
+ width: A.width,
12876
+ height: A.height,
12877
+ layer: A.layer,
12878
+ layerIndex: A.layerIndex,
12879
+ immutable: A.immutable,
12878
12880
  preserveAspectRatio: "none"
12879
12881
  },
12880
- A
12882
+ d
12881
12883
  );
12882
12884
  }, c = a.data.regions;
12883
12885
  try {
12884
12886
  return c.map(l);
12885
- } catch (d) {
12886
- return console.error(d), [];
12887
+ } catch (A) {
12888
+ return console.error(A), [];
12887
12889
  }
12888
12890
  }, Xo = async (r, t, e, a) => {
12889
12891
  const n = e.data, i = a.option;
@@ -12894,10 +12896,10 @@ const Wo = (r) => {
12894
12896
  return console.error(`No variant with ID: ${n.colorVariantId}`), [];
12895
12897
  t[a.stepName] = { selectedVariants: [s] };
12896
12898
  const o = (c) => {
12897
- const d = r.find((g) => g.panelId === c.panelId);
12898
- if (!d)
12899
+ const A = r.find((g) => g.panelId === c.panelId);
12900
+ if (!A)
12899
12901
  throw new Y(c);
12900
- const A = `
12902
+ const d = `
12901
12903
  <svg
12902
12904
  xmlns="http://www.w3.org/2000/svg"
12903
12905
  xmlnsXlink="http://www.w3.org/1999/xlink"
@@ -12922,7 +12924,7 @@ const Wo = (r) => {
12922
12924
  {
12923
12925
  colors: h,
12924
12926
  id: m,
12925
- svg: A,
12927
+ svg: d,
12926
12928
  type: x.Illustration,
12927
12929
  y: c.top,
12928
12930
  x: c.left,
@@ -12933,7 +12935,7 @@ const Wo = (r) => {
12933
12935
  layerIndex: c.layerIndex,
12934
12936
  immutable: c.immutable
12935
12937
  },
12936
- d
12938
+ A
12937
12939
  );
12938
12940
  }, l = a.data.regions;
12939
12941
  try {
@@ -12946,10 +12948,10 @@ const Wo = (r) => {
12946
12948
  if (o === "image")
12947
12949
  try {
12948
12950
  l.forEach((c) => {
12949
- const d = r.find((u) => u.panelId === c.panelId);
12950
- if (!d)
12951
+ const A = r.find((u) => u.panelId === c.panelId);
12952
+ if (!A)
12951
12953
  throw new Y(c);
12952
- const A = {
12954
+ const d = {
12953
12955
  id: M(),
12954
12956
  src: i,
12955
12957
  type: o,
@@ -12966,38 +12968,38 @@ const Wo = (r) => {
12966
12968
  excludeFromExport: t.data.excludeFromPrint,
12967
12969
  preserveAspectRatio: "none"
12968
12970
  };
12969
- a.push(new z(A, d));
12971
+ a.push(new z(d, A));
12970
12972
  });
12971
12973
  } catch (c) {
12972
12974
  console.error(c);
12973
12975
  }
12974
12976
  else {
12975
- const c = await at(i, !0), d = (A) => {
12976
- const u = /<svg.*?<\/svg>/s, h = A.match(u) || [], m = h?.length > 0 ? h[0] : "", f = dt().parseFromString(m, "image/svg+xml").firstElementChild;
12977
+ const c = await at(i, !0), A = (d) => {
12978
+ const u = /<svg.*?<\/svg>/s, h = d.match(u) || [], m = h?.length > 0 ? h[0] : "", f = dt().parseFromString(m, "image/svg+xml").firstElementChild;
12977
12979
  if (!f)
12978
12980
  throw new Dt("Failed to read SVG.");
12979
12981
  return ga(f), Bt().serializeToString(f);
12980
12982
  };
12981
- l.forEach((A) => {
12982
- const u = r.find((m) => m.panelId === A.panelId);
12983
+ l.forEach((d) => {
12984
+ const u = r.find((m) => m.panelId === d.panelId);
12983
12985
  if (!u)
12984
- throw new Y(A);
12986
+ throw new Y(d);
12985
12987
  const h = {
12986
12988
  id: M(),
12987
12989
  src: i,
12988
12990
  asset_key: i,
12989
- svg: d(c),
12991
+ svg: A(c),
12990
12992
  colors: {},
12991
12993
  type: o,
12992
- y: A.top,
12993
- x: A.left,
12994
- width: A.width,
12995
- height: A.height,
12996
- layer: A.layer,
12997
- layerIndex: A.layerIndex,
12994
+ y: d.top,
12995
+ x: d.left,
12996
+ width: d.width,
12997
+ height: d.height,
12998
+ layer: d.layer,
12999
+ layerIndex: d.layerIndex,
12998
13000
  scaleX: 1,
12999
13001
  scaleY: 1,
13000
- rotation: A.rotation,
13002
+ rotation: d.rotation,
13001
13003
  productOverlay: t.type === E.ProductOverlay ? !0 : void 0,
13002
13004
  excludeFromExport: t.data.excludeFromPrint
13003
13005
  };
@@ -13017,7 +13019,7 @@ const Wo = (r) => {
13017
13019
  const S = f.asset.fileLink;
13018
13020
  if (S)
13019
13021
  return S;
13020
- }, d = await (async () => {
13022
+ }, A = await (async () => {
13021
13023
  const p = l();
13022
13024
  if (!p)
13023
13025
  return;
@@ -13026,7 +13028,7 @@ const Wo = (r) => {
13026
13028
  assetUrl: p,
13027
13029
  name: f.names.fullName.en
13028
13030
  };
13029
- })(), A = (a.data.replaceableText ? a.data.replaceableText.replace("{{}}", i.text) : i.text) || "", u = Be(A, {
13031
+ })(), d = (a.data.replaceableText ? a.data.replaceableText.replace("{{}}", i.text) : i.text) || "", u = Be(d, {
13030
13032
  vertical: a.data.vertical,
13031
13033
  uppercase: a.data.uppercase
13032
13034
  }), h = async (p) => {
@@ -13043,7 +13045,7 @@ const Wo = (r) => {
13043
13045
  align: o(a.data),
13044
13046
  curved: a.data.curved,
13045
13047
  fill: i.color || m || "#000000",
13046
- fontData: d,
13048
+ fontData: A,
13047
13049
  fontSize: a.data.size || s,
13048
13050
  height: p.height,
13049
13051
  layer: p.layer,
@@ -13058,10 +13060,10 @@ const Wo = (r) => {
13058
13060
  x: p.left,
13059
13061
  y: p.top
13060
13062
  };
13061
- if (d) {
13063
+ if (A) {
13062
13064
  const [v, I] = fe(
13063
13065
  a.data.size || s,
13064
- d,
13066
+ A,
13065
13067
  p,
13066
13068
  [
13067
13069
  Be(u, {
@@ -13312,12 +13314,12 @@ class ol extends Fn {
13312
13314
  l = p.width, c = p.height;
13313
13315
  } else
13314
13316
  l = i.width, c = i.height;
13315
- const d = await this.getWorkflowManager?.()?.getTemplatingContext(), A = ya(t.layoutState.layout, e, {
13317
+ const A = await this.getWorkflowManager?.()?.getTemplatingContext(), d = ya(t.layoutState.layout, e, {
13316
13318
  renderingConfiguration: {
13317
13319
  purpose: jt.ThreeD,
13318
- templatingContext: d
13320
+ templatingContext: A
13319
13321
  }
13320
- }), u = mn(A), h = await da.from(this.ctx, u, {
13322
+ }), u = mn(d), h = await da.from(this.ctx, u, {
13321
13323
  anonymousCrossOrigin: !0,
13322
13324
  ignoreDimensions: !this.nonPOTSupport,
13323
13325
  ignoreAnimation: !0,
@@ -13937,7 +13939,7 @@ class hl {
13937
13939
  else {
13938
13940
  if (n === 1) {
13939
13941
  const c = this.globalPropertyState.aspects.findIndex(
13940
- (d) => !d.channel && d.name === t
13942
+ (A) => !A.channel && A.name === t
13941
13943
  );
13942
13944
  c && c > 0 && this.globalPropertyState.aspects.splice(c, 1);
13943
13945
  }
@@ -14321,9 +14323,12 @@ class er {
14321
14323
  * @param limit The maximum number of products to return.
14322
14324
  * @param filters Optional metafield filters to apply to the query.
14323
14325
  * @param tags Optional object of tag filters to apply.
14326
+ * @param sortKey Optional field of the products to sort by.
14327
+ * @param sortDescending Optional boolean to indicate if the sort should be in descending order.
14328
+ * @param quickSearch Optional string to filter products by name.
14324
14329
  * @returns
14325
14330
  */
14326
- async fetchProductsFeed(t, e, a, n, i, s) {
14331
+ async fetchProductsFeed(t, e, a, n, i, s, o) {
14327
14332
  if (this.fullFetched) {
14328
14333
  const d = await (a ? this.filterProducts(a) : this.fetchProducts());
14329
14334
  return {
@@ -14331,7 +14336,7 @@ class er {
14331
14336
  items: d.slice(t, t + e)
14332
14337
  };
14333
14338
  }
14334
- const o = new AbortController(), { signal: l } = o, c = y.getShadowGraphqlClient().watchQuery({
14339
+ const l = new AbortController(), { signal: c } = l, A = y.getShadowGraphqlClient().watchQuery({
14335
14340
  query: Js,
14336
14341
  variables: {
14337
14342
  id: this.getId(),
@@ -14346,33 +14351,34 @@ class er {
14346
14351
  exclude: n.exclude ?? []
14347
14352
  } : void 0,
14348
14353
  sortKey: i,
14349
- sortDescending: s
14354
+ sortDescending: s,
14355
+ quickSearch: o
14350
14356
  },
14351
14357
  errorPolicy: "all",
14352
14358
  fetchPolicy: "cache-first",
14353
14359
  returnPartialData: !0,
14354
14360
  context: {
14355
14361
  fetchOptions: {
14356
- signal: l
14362
+ signal: c
14357
14363
  }
14358
14364
  }
14359
14365
  });
14360
14366
  return new Promise((d) => {
14361
- let A = !1;
14362
- const u = c.subscribe({
14363
- next(h) {
14364
- if (A || h.partial && (!h.data.productCollections || h.data.productCollections.length === 0 || !h.data.productCollections[0].productCollectionProductsFeed?.items || h.data.productCollections[0].productCollectionProductsFeed?.items.length === 0))
14367
+ let u = !1;
14368
+ const h = A.subscribe({
14369
+ next(m) {
14370
+ if (u || m.partial && (!m.data.productCollections || m.data.productCollections.length === 0 || !m.data.productCollections[0].productCollectionProductsFeed?.items || m.data.productCollections[0].productCollectionProductsFeed?.items.length === 0))
14365
14371
  return;
14366
- o.abort(), A = !0, u.unsubscribe();
14367
- const m = h.data.productCollections?.[0].productCollectionProductsFeed?.items.filter((g) => !!g.product).map((g) => new Ae(St(g))) || [];
14372
+ l.abort(), u = !0, h.unsubscribe();
14373
+ const g = m.data.productCollections?.[0].productCollectionProductsFeed?.items.filter((p) => !!p.product).map((p) => new Ae(St(p))) || [];
14368
14374
  d({
14369
- items: m,
14375
+ items: g,
14370
14376
  // Clone items because it could be cached data (immutable)
14371
- total: h.data.productCollections?.[0].productCollectionProductsFeed?.total ?? 0
14377
+ total: m.data.productCollections?.[0].productCollectionProductsFeed?.total ?? 0
14372
14378
  });
14373
14379
  },
14374
14380
  error() {
14375
- A || (A = !0, u.unsubscribe(), d({ items: [], total: 0 }));
14381
+ u || (u = !0, h.unsubscribe(), d({ items: [], total: 0 }));
14376
14382
  }
14377
14383
  });
14378
14384
  });
@@ -14670,22 +14676,22 @@ class Ke {
14670
14676
  this.onGlobalPropertiesChanged.bind(this),
14671
14677
  s
14672
14678
  ), this.globalPropertyHandleService = new ll(this), this.setPreviewService(a);
14673
- const l = new Promise((c, d) => {
14679
+ const l = new Promise((c, A) => {
14674
14680
  if (s?.readonly) {
14675
14681
  c([]);
14676
14682
  return;
14677
14683
  }
14678
14684
  console.log("Setting default global variants.");
14679
- const A = this.globalPropertyStateManager.getGlobalPropertyState();
14680
- A ? this.globalPropertyHandleService.getHandles().then((u) => {
14685
+ const d = this.globalPropertyStateManager.getGlobalPropertyState();
14686
+ d ? this.globalPropertyHandleService.getHandles().then((u) => {
14681
14687
  const h = u.map((m) => {
14682
14688
  if (m.getType() === L.ColorOption || m.getType() === L.Option) {
14683
14689
  const g = m;
14684
- if (!A.aspects.find((f) => f.name === g.getName()))
14690
+ if (!d.aspects.find((f) => f.name === g.getName()))
14685
14691
  return g.initDefaultVariant();
14686
14692
  }
14687
14693
  });
14688
- Promise.all(h).then(c).catch(d);
14694
+ Promise.all(h).then(c).catch(A);
14689
14695
  }) : (console.log("Attempted to set global default variant before state was initialized."), c([]));
14690
14696
  });
14691
14697
  this.initializationPromise = Promise.all([
@@ -14820,9 +14826,9 @@ class Ke {
14820
14826
  const l = a.storage?.colors;
14821
14827
  if (l) {
14822
14828
  const c = Object.fromEntries(
14823
- l.map((d) => [
14824
- d.key,
14825
- { browserValue: d.browserValue, pmsValue: d.pmsValue }
14829
+ l.map((A) => [
14830
+ A.key,
14831
+ { browserValue: A.browserValue, pmsValue: A.pmsValue }
14826
14832
  ]) ?? []
14827
14833
  );
14828
14834
  await s.changeColors(c);
@@ -14875,9 +14881,9 @@ class Ke {
14875
14881
  this.getWorkflowExperiences(),
14876
14882
  this.globalConfigurationPropertyId || "",
14877
14883
  n
14878
- ), d = [...new Set(o.map((u) => u.number))];
14879
- if (d.length > c)
14880
- for (const u of d) {
14884
+ ), A = [...new Set(o.map((u) => u.number))];
14885
+ if (A.length > c)
14886
+ for (const u of A) {
14881
14887
  const h = this.getGlobalPropertyStateManager(), m = l.find((g) => g.channelNumber === u);
14882
14888
  m && await h.setAspect(n, m.variant.id || "", void 0, m.channelNumber);
14883
14889
  }
@@ -15401,16 +15407,16 @@ class Pl {
15401
15407
  mutation: Il,
15402
15408
  variables: {
15403
15409
  processFlowId: t,
15404
- inputs: [...e.map((A) => A.getValueForTransmission())]
15410
+ inputs: [...e.map((d) => d.getValueForTransmission())]
15405
15411
  }
15406
15412
  })).data?.processExecutionCreate?.id;
15407
15413
  if (!i) throw new Error("Failed to create process execution.");
15408
- function s(A) {
15414
+ function s(d) {
15409
15415
  return new Promise((u) => {
15410
- setTimeout(u, A);
15416
+ setTimeout(u, d);
15411
15417
  });
15412
15418
  }
15413
- let o = !1, l = 0, c, d;
15419
+ let o = !1, l = 0, c, A;
15414
15420
  for (; !o; ) {
15415
15421
  c = await y.getShadowGraphqlClient().query({
15416
15422
  query: w`
@@ -15431,14 +15437,14 @@ class Pl {
15431
15437
  ids: [i]
15432
15438
  }
15433
15439
  });
15434
- const A = c.data?.processExecutions[0];
15435
- if (!c || !A) throw new Error("Failed to retrieve server response for execution.");
15436
- if (A.failedAt)
15440
+ const d = c.data?.processExecutions[0];
15441
+ if (!c || !d) throw new Error("Failed to retrieve server response for execution.");
15442
+ if (d.failedAt)
15437
15443
  throw new Error(
15438
15444
  "Execution has failed to complete. See Automation > FLows in Flight on partner account on SpiffCommerce Hub."
15439
15445
  );
15440
- if (A.completedAt) {
15441
- o = !0, d = new Dl(A);
15446
+ if (d.completedAt) {
15447
+ o = !0, A = new Dl(d);
15442
15448
  break;
15443
15449
  }
15444
15450
  l += 1;
@@ -15446,8 +15452,8 @@ class Pl {
15446
15452
  if (l >= u) throw new Error("Maximum wait time exceeded for execution result.");
15447
15453
  await s(a?.sleepTime ? Math.max(a.sleepTime, 500) : 2e3);
15448
15454
  }
15449
- if (!d) throw new Error("Failed to retrieve server response for execution.");
15450
- return Promise.resolve(d);
15455
+ if (!A) throw new Error("Failed to retrieve server response for execution.");
15456
+ return Promise.resolve(A);
15451
15457
  }
15452
15458
  }
15453
15459
  class Dl {
@@ -15922,7 +15928,7 @@ class md {
15922
15928
  } catch (a) {
15923
15929
  throw console.error(a), new ht("Critical - Unable to synchronize workflow state with server.");
15924
15930
  }
15925
- }, this.options = t, this.options.applicationKey && Lr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 31.0.0"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15931
+ }, this.options = t, this.options.applicationKey && Lr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 31.1.0"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15926
15932
  }
15927
15933
  configure(t) {
15928
15934
  gt.setHubUrl(t.hubUrl), gt.setServerUrl(t.serverUrl), gt.setServicesApiUrl(t.servicesApiUrl), this.marketplaceThemeInstallId = t.marketplaceThemeInstallId, this.marketplaceThemeInstallConfigurationId = t.marketplaceThemeInstallConfigurationId, this.userPoolClientId = t.userPoolClientId, this.userPoolRegion = t.userPoolRegion, this.spiffRegion = t.spiffRegion, t.bearerAuthenticationToken && zr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Ut.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
@@ -16210,7 +16216,7 @@ class md {
16210
16216
  mutation: Ks(a?.graphql?.productCollection?.eagerFetchProducts || !1),
16211
16217
  variables: {
16212
16218
  collectionId: t,
16213
- initialMetadata: e ? Object.entries(e).map((c, d) => ({ key: c[0], value: c[1] })) : void 0,
16219
+ initialMetadata: e ? Object.entries(e).map((c, A) => ({ key: c[0], value: c[1] })) : void 0,
16214
16220
  marketplaceThemeInstallId: this.marketplaceThemeInstallId,
16215
16221
  marketplaceThemeInstallConfigurationId: this.marketplaceThemeInstallConfigurationId
16216
16222
  },
@@ -16260,9 +16266,9 @@ class md {
16260
16266
  });
16261
16267
  if (!c.data?.bundles || c.data?.bundles.length === 0 || !c.data?.bundles[0])
16262
16268
  throw new Error(`Unable to find bundle: ${t}`);
16263
- const d = c.data?.bundles[0], A = k.getMap("bundlePartnerIds") || /* @__PURE__ */ new Map();
16264
- A.set(d.id, d.partner.id), k.setMap("bundlePartnerIds", A);
16265
- const u = new Ke(this, d, e, a, s, {
16269
+ const A = c.data?.bundles[0], d = k.getMap("bundlePartnerIds") || /* @__PURE__ */ new Map();
16270
+ d.set(A.id, A.partner.id), k.setMap("bundlePartnerIds", d);
16271
+ const u = new Ke(this, A, e, a, s, {
16266
16272
  additionalHeaders: n?.graphql?.additionalHeaders,
16267
16273
  eagerFetchProducts: n?.graphql?.productCollection?.eagerFetchProducts,
16268
16274
  existingGlobalPropertyState: c.data.globalPropertyState,
@@ -16305,10 +16311,10 @@ class md {
16305
16311
  })).data?.bundleDuplicate;
16306
16312
  if (!c?.id)
16307
16313
  throw new Error("Unable to duplicate bundle");
16308
- const d = k.getMap("bundlePartnerIds") || /* @__PURE__ */ new Map();
16309
- d.set(c.id, c.partner.id), k.setMap("bundlePartnerIds", d);
16310
- const A = k.getMap("bundleOwnerIds") || /* @__PURE__ */ new Map();
16311
- return A.set(c.id, c.bundleOwnerId), k.setMap("bundleOwnerIds", A), async () => {
16314
+ const A = k.getMap("bundlePartnerIds") || /* @__PURE__ */ new Map();
16315
+ A.set(c.id, c.partner.id), k.setMap("bundlePartnerIds", A);
16316
+ const d = k.getMap("bundleOwnerIds") || /* @__PURE__ */ new Map();
16317
+ return d.set(c.id, c.bundleOwnerId), k.setMap("bundleOwnerIds", d), async () => {
16312
16318
  const u = new Ke(this, c, void 0, void 0, c.bundleOwnerId, {
16313
16319
  eagerFetchProducts: n?.graphql?.productCollection?.eagerFetchProducts,
16314
16320
  existingGlobalPropertyState: c.globalPropertyState
@@ -16434,10 +16440,10 @@ class md {
16434
16440
  }));
16435
16441
  }, s = t.map((C, b) => ({ option: C, index: b })), o = s.filter((C) => C.option.type === "transaction"), l = s.filter(
16436
16442
  (C) => C.option.type === "integration" || C.option.type === "external"
16437
- ), c = Fa(o, 10), d = Fa(l, 10), A = (await Promise.all([
16443
+ ), c = Fa(o, 10), A = Fa(l, 10), d = (await Promise.all([
16438
16444
  ...c.map(n),
16439
- ...d.map(i)
16440
- ])).flat(), u = [...new Set(A.map((C) => C.workflowId))], h = await nr(u, e), m = new Map(h.map((C) => [C.id, C])), g = k.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), p = A.map(async (C) => {
16445
+ ...A.map(i)
16446
+ ])).flat(), u = [...new Set(d.map((C) => C.workflowId))], h = await nr(u, e), m = new Map(h.map((C) => [C.id, C])), g = k.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), p = d.map(async (C) => {
16441
16447
  const { transaction: b, workflowId: P, readOnly: B, index: F } = C, Q = m.get(P), T = t[F];
16442
16448
  !g.get(b.id) && b.transactionOwnerId && g.set(b.id, b.transactionOwnerId);
16443
16449
  const tt = g.get(b.id) || void 0, rt = new Tl({
@@ -16596,8 +16602,8 @@ function zl(r, t, e, a) {
16596
16602
  if (a) {
16597
16603
  const o = r, l = Math.max(t.width / e.width, t.height / e.height);
16598
16604
  o.zoom = Math.max(l, r.zoom);
16599
- const c = e.width * o.zoom, d = e.height * o.zoom;
16600
- return o.x = me(r.x, t.width - c, 0), o.y = me(r.y, t.height - d, 0), o;
16605
+ const c = e.width * o.zoom, A = e.height * o.zoom;
16606
+ return o.x = me(r.x, t.width - c, 0), o.y = me(r.y, t.height - A, 0), o;
16601
16607
  }
16602
16608
  const s = r;
16603
16609
  return s.x = me(s.x, -n, t.width), s.y = me(s.y, -i, t.height), s;
@@ -16710,10 +16716,10 @@ class Gl {
16710
16716
  if (this.imageData && this.offsets && this.frameData) {
16711
16717
  (!this.offsets || this.offsets.length !== this.frameData.length) && (this.offsets = new Array(this.frameData.length));
16712
16718
  const i = this.frameData.map((s, o) => {
16713
- const l = (e[o] - this.offsets[o].x) / this.offsets[o].zoom, c = (a[o] - this.offsets[o].y) / this.offsets[o].zoom, d = e[o] - l * t[o], A = a[o] - c * t[o];
16719
+ const l = (e[o] - this.offsets[o].x) / this.offsets[o].zoom, c = (a[o] - this.offsets[o].y) / this.offsets[o].zoom, A = e[o] - l * t[o], d = a[o] - c * t[o];
16714
16720
  return {
16715
- x: d,
16716
- y: A,
16721
+ x: A,
16722
+ y: d,
16717
16723
  zoom: this.imageData.width * t[o] / this.imageData.width
16718
16724
  };
16719
16725
  });
@@ -16827,7 +16833,7 @@ class Gl {
16827
16833
  }
16828
16834
  }
16829
16835
  class wd {
16830
- updateRecipient(t, e, a, n, i, s, o, l, c, d, A, u, h, m, g, p, f) {
16836
+ updateRecipient(t, e, a, n, i, s, o, l, c, A, d, u, h, m, g, p, f) {
16831
16837
  throw new Error("Method not implemented.");
16832
16838
  }
16833
16839
  approveTransaction(t) {