@spiffcommerce/core 32.4.0-beta.31f8a4dd-4f9f-572b-8792-9d8d6243c25e → 32.4.0-beta.35245b6b-54e5-5ca9-b645-8fe9cfe2f057

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
@@ -24,7 +24,7 @@ import hn from "lodash.debounce";
24
24
  import "fs";
25
25
  import "path";
26
26
  import Pr from "lodash.omit";
27
- var ve = /* @__PURE__ */ ((n) => (n.Data = "Data", n.Font = "Font", n.Frame = "Frame", n.Illustration = "Illustration", n.Image = "Image", n.Model = "Model", n.Material = "Material", n.Color = "Color", n.QuestionnaireCollateral = "QuestionnaireCollateral", n.RequestCollateral = "RequestCollateral", n.SignupCollateral = "SignupCollateral", n.Video = "Video", n.ColorProfile = "ColorProfile", n.Environment = "Environment", n))(ve || {}), L = /* @__PURE__ */ ((n) => (n.FileUpload = "FileUpload", n.Option = "Option", n.ColorOption = "ColorOption", n.Text = "Text", n))(L || {}), E = /* @__PURE__ */ ((n) => (n.Information = "Information", n.Bulk = "Bulk", n.DigitalContent = "DigitalContent", n.Finish = "Finish", n.Frame = "Frame", n.Illustration = "Illustration", n.Introduction = "Introduction", n.Material = "Material", n.Model = "Model", n.Module = "Module", n.Picture = "Picture", n.Photo = "Photo", n.ProductOverlay = "ProductOverlay", n.Question = "Question", n.Shape = "Shape", n.SilentIllustration = "SilentIllustration", n.Text = "Text", n))(E || {}), Dr = /* @__PURE__ */ ((n) => (n.Color = "Color", n.Colors = "Colors", n.Selection = "Selection", n.Selections = "Selections", n.Text = "Text", n.Upload = "Upload", n))(Dr || {}), Ht = /* @__PURE__ */ ((n) => (n.ThreeD = "ThreeD", n.FreeDesign = "FreeDesign", n.Print = "Print", n))(Ht || {}), x = /* @__PURE__ */ ((n) => (n.Frame = "frame", n.Group = "group", n.Image = "image", n.Pattern = "pattern", n.Illustration = "illustration", n.Textbox = "textbox", n))(x || {}), Fr = /* @__PURE__ */ ((n) => (n.Default = "Default", n.FirstTransaction = "FirstTransaction", n.OneToOne = "OneToOne", n))(Fr || {}), mn = /* @__PURE__ */ ((n) => (n.Pending = "Pending", n.Failed = "Failed", n.Validated = "Validated", n.Overridden = "Overridden", n))(mn || {}), xr = /* @__PURE__ */ ((n) => (n.Hyperlink = "Hyperlink", n.Edit = "Edit", n.Approve = "Approve", n))(xr || {}), kr = /* @__PURE__ */ ((n) => (n.Hub = "Hub", n.Shopify = "Shopify", n))(kr || {}), ga = /* @__PURE__ */ ((n) => (n.BackgroundRemover = "BackgroundRemover", n.ConversionAccelerator = "Conversion Accelerator", n.ProcessBuilder = "ProcessBuilder", n))(ga || {}), Mr = /* @__PURE__ */ ((n) => (n[n.Orbit = 0] = "Orbit", n[n.Pan = 1] = "Pan", n))(Mr || {}), Ee = /* @__PURE__ */ ((n) => (n.Owner = "Owner", n.Approver = "Approver", n.Editor = "Editor", n.Viewer = "Viewer", n))(Ee || {}), kt = /* @__PURE__ */ ((n) => (n.Autosize = "Autosize", n.Traditional = "Traditional", n))(kt || {}), W = /* @__PURE__ */ ((n) => (n[n.North = 0] = "North", n[n.Northeast = 1] = "Northeast", n[n.East = 2] = "East", n[n.Southeast = 3] = "Southeast", n[n.South = 4] = "South", n[n.Southwest = 5] = "Southwest", n[n.West = 6] = "West", n[n.Northwest = 7] = "Northwest", n))(W || {}), Tr = /* @__PURE__ */ ((n) => (n.Pixel = "px", n.Millimeter = "mm", n.Centimeter = "cm", n))(Tr || {});
27
+ var ve = /* @__PURE__ */ ((n) => (n.Data = "Data", n.Font = "Font", n.Frame = "Frame", n.Illustration = "Illustration", n.Image = "Image", n.Model = "Model", n.Material = "Material", n.Color = "Color", n.QuestionnaireCollateral = "QuestionnaireCollateral", n.RequestCollateral = "RequestCollateral", n.SignupCollateral = "SignupCollateral", n.Video = "Video", n.ColorProfile = "ColorProfile", n.Environment = "Environment", n))(ve || {}), L = /* @__PURE__ */ ((n) => (n.FileUpload = "FileUpload", n.Option = "Option", n.ColorOption = "ColorOption", n.Text = "Text", n))(L || {}), E = /* @__PURE__ */ ((n) => (n.Information = "Information", n.Bulk = "Bulk", n.DigitalContent = "DigitalContent", n.Finish = "Finish", n.Frame = "Frame", n.Illustration = "Illustration", n.Introduction = "Introduction", n.Material = "Material", n.Model = "Model", n.Module = "Module", n.Picture = "Picture", n.Photo = "Photo", n.ProductOverlay = "ProductOverlay", n.Question = "Question", n.Shape = "Shape", n.SilentIllustration = "SilentIllustration", n.Text = "Text", n))(E || {}), Dr = /* @__PURE__ */ ((n) => (n.Color = "Color", n.Colors = "Colors", n.Selection = "Selection", n.Selections = "Selections", n.Text = "Text", n.Upload = "Upload", n))(Dr || {}), Ht = /* @__PURE__ */ ((n) => (n.ThreeD = "ThreeD", n.FreeDesign = "FreeDesign", n.Print = "Print", n))(Ht || {}), x = /* @__PURE__ */ ((n) => (n.Frame = "frame", n.Group = "group", n.Image = "image", n.Pattern = "pattern", n.Illustration = "illustration", n.Textbox = "textbox", n))(x || {}), Fr = /* @__PURE__ */ ((n) => (n.Default = "Default", n.FirstTransaction = "FirstTransaction", n.OneToOne = "OneToOne", n))(Fr || {}), mn = /* @__PURE__ */ ((n) => (n.Pending = "Pending", n.Failed = "Failed", n.Validated = "Validated", n.Overridden = "Overridden", n))(mn || {}), xr = /* @__PURE__ */ ((n) => (n.Hyperlink = "Hyperlink", n.Edit = "Edit", n.Approve = "Approve", n))(xr || {}), kr = /* @__PURE__ */ ((n) => (n.Hub = "Hub", n.Shopify = "Shopify", n))(kr || {}), ga = /* @__PURE__ */ ((n) => (n.BackgroundRemover = "BackgroundRemover", n.ConversionAccelerator = "Conversion Accelerator", n.ProcessBuilder = "ProcessBuilder", n))(ga || {}), Mr = /* @__PURE__ */ ((n) => (n[n.Orbit = 0] = "Orbit", n[n.Pan = 1] = "Pan", n))(Mr || {}), Ee = /* @__PURE__ */ ((n) => (n.Owner = "Owner", n.Approver = "Approver", n.Editor = "Editor", n.Viewer = "Viewer", n))(Ee || {}), xt = /* @__PURE__ */ ((n) => (n.Autosize = "Autosize", n.Traditional = "Traditional", n))(xt || {}), W = /* @__PURE__ */ ((n) => (n[n.North = 0] = "North", n[n.Northeast = 1] = "Northeast", n[n.East = 2] = "East", n[n.Southeast = 3] = "Southeast", n[n.South = 4] = "South", n[n.Southwest = 5] = "Southwest", n[n.West = 6] = "West", n[n.Northwest = 7] = "Northwest", n))(W || {}), Tr = /* @__PURE__ */ ((n) => (n.Pixel = "px", n.Millimeter = "mm", n.Centimeter = "cm", n))(Tr || {});
28
28
  class gn extends Error {
29
29
  constructor(t) {
30
30
  super(t), this.name = this.constructor.name;
@@ -65,12 +65,12 @@ class Me extends gn {
65
65
  super(`ImplementationError - ${t}`);
66
66
  }
67
67
  }
68
- class N extends Me {
68
+ class T extends Me {
69
69
  constructor(t) {
70
70
  super(`Unhandled Behavior Encountered: ${t}`);
71
71
  }
72
72
  }
73
- class Pt extends Me {
73
+ class Bt extends Me {
74
74
  constructor(t) {
75
75
  super(`Parsing Error: ${t}`);
76
76
  }
@@ -197,17 +197,17 @@ const pn = /* @__PURE__ */ new Map(), Ra = /* @__PURE__ */ new Map(), Oa = /* @_
197
197
  if (t) return t;
198
198
  const a = (async () => await (await nt(n)).text())();
199
199
  return Oa.set(n, a), a;
200
- }, Mt = (n) => n.every((t) => t !== "undefined"), se = (n) => Mt([typeof document]) ? document.createElement(n) : Xt().document.createElement(n), $r = (n, t) => {
201
- if (Mt([typeof document]))
200
+ }, kt = (n) => n.every((t) => t !== "undefined"), se = (n) => kt([typeof document]) ? document.createElement(n) : Xt().document.createElement(n), $r = (n, t) => {
201
+ if (kt([typeof document]))
202
202
  return document.createElementNS(n, t);
203
203
  const a = Xt().document.createElement(t);
204
204
  return a.setAttribute("xmlns", n), a;
205
205
  }, dt = () => {
206
- if (Mt([typeof DOMParser]))
206
+ if (kt([typeof DOMParser]))
207
207
  return new DOMParser();
208
208
  const n = Xt();
209
209
  return new n.DOMParser();
210
- }, Ur = () => Mt([typeof DOMParser]) ? DOMParser : Xt().DOMParser, Ne = (n, t) => new Promise((e, a) => {
210
+ }, Ur = () => kt([typeof DOMParser]) ? DOMParser : Xt().DOMParser, Ne = (n, t) => new Promise((e, a) => {
211
211
  t ? fn(n).then(e).catch(a) : nt(n).then((r) => {
212
212
  r.arrayBuffer().then(e).catch(a);
213
213
  }).catch((r) => {
@@ -218,7 +218,7 @@ const pn = /* @__PURE__ */ new Map(), Ra = /* @__PURE__ */ new Map(), Oa = /* @_
218
218
  r.text().then(e).catch(a);
219
219
  }).catch(a);
220
220
  }), Cn = (n) => fr(n), Ve = /* @__PURE__ */ new Map(), Lr = async (n, t) => {
221
- if (Mt([typeof FontFace])) {
221
+ if (kt([typeof FontFace])) {
222
222
  if (Ve.has(t))
223
223
  return Ve.get(t);
224
224
  const e = n.names.fullName.en, a = new FontFace(e, `url(${t})`);
@@ -226,8 +226,8 @@ const pn = /* @__PURE__ */ new Map(), Ra = /* @__PURE__ */ new Map(), Oa = /* @_
226
226
  const r = a.load();
227
227
  return Ve.set(t, r), r;
228
228
  }
229
- }, It = () => {
230
- if (Mt([typeof XMLSerializer]))
229
+ }, bt = () => {
230
+ if (kt([typeof XMLSerializer]))
231
231
  return new XMLSerializer();
232
232
  const n = Xt();
233
233
  return new n.XMLSerializer();
@@ -1808,7 +1808,7 @@ const Xr = (n) => new Promise((t) => {
1808
1808
  "Black 5 C",
1809
1809
  "Black 6 C",
1810
1810
  "Black 7 C"
1811
- ], Ft = [
1811
+ ], Dt = [
1812
1812
  "FEDD00",
1813
1813
  "FFD700",
1814
1814
  "FE5000",
@@ -3150,17 +3150,17 @@ const Xr = (n) => new Promise((t) => {
3150
3150
  "3E2B2E",
3151
3151
  "101820",
3152
3152
  "3D3935"
3153
- ], Ge = Ft.map((n) => [
3153
+ ], Ge = Dt.map((n) => [
3154
3154
  parseInt(n.substring(0, 2), 16),
3155
3155
  parseInt(n.substring(2, 4), 16),
3156
3156
  parseInt(n.substring(4, 6), 16)
3157
3157
  ]);
3158
3158
  function jc(n) {
3159
3159
  const t = Yt.indexOf(n);
3160
- return t >= 0 ? Ft[t] : "";
3160
+ return t >= 0 ? Dt[t] : "";
3161
3161
  }
3162
3162
  function ai(n) {
3163
- const t = Ft.indexOf(n);
3163
+ const t = Dt.indexOf(n);
3164
3164
  return t >= 0 ? Yt[t] : "";
3165
3165
  }
3166
3166
  function Yc(n, t = 64) {
@@ -3172,16 +3172,16 @@ function Yc(n, t = 64) {
3172
3172
  });
3173
3173
  const i = parseInt(n.substring(0, 2), 16), s = parseInt(n.substring(2, 4), 16), o = parseInt(n.substring(4, 6), 16);
3174
3174
  let l, c, d;
3175
- for (let A = 0; A < Ft.length; A++) {
3175
+ for (let A = 0; A < Dt.length; A++) {
3176
3176
  l = Ge[A][0], c = Ge[A][1], d = Ge[A][2];
3177
3177
  const u = Math.sqrt(Math.pow(i - l, 2) + Math.pow(s - c, 2) + Math.pow(o - d, 2));
3178
3178
  a.push(u);
3179
3179
  }
3180
3180
  for (let A = 0; A < a.length; A++)
3181
- a[A] <= t && !e.some((u) => u.pms === Yt[A]) && e.push({ pms: Yt[A], hex: Ft[A], distance: a[A] });
3181
+ a[A] <= t && !e.some((u) => u.pms === Yt[A]) && e.push({ pms: Yt[A], hex: Dt[A], distance: a[A] });
3182
3182
  return e.sort((A, u) => A.distance - u.distance);
3183
3183
  }
3184
- const ni = Yt.map((n, t) => ({ pms: n, hex: Ft[t] })), ri = new yr(ni, { keys: ["pms"] });
3184
+ const ni = Yt.map((n, t) => ({ pms: n, hex: Dt[t] })), ri = new yr(ni, { keys: ["pms"] });
3185
3185
  function Jc(n, t) {
3186
3186
  return ri.search(n, t ? { limit: t } : void 0);
3187
3187
  }
@@ -3238,8 +3238,8 @@ const le = (n) => {
3238
3238
  "textPath",
3239
3239
  "tref",
3240
3240
  "tspan"
3241
- ], oi = ["fill", "stroke"], xt = (n, t) => {
3242
- t(n), n.children.length > 0 && Array.from(n.children).forEach((e) => xt(e, t));
3241
+ ], oi = ["fill", "stroke"], Ft = (n, t) => {
3242
+ t(n), n.children.length > 0 && Array.from(n.children).forEach((e) => Ft(e, t));
3243
3243
  }, li = (n, t) => {
3244
3244
  try {
3245
3245
  return n.matches(t);
@@ -3249,7 +3249,7 @@ const le = (n) => {
3249
3249
  }, wa = (n, t = !1) => {
3250
3250
  !t && n.setAttribute("preserveAspectRatio", "none");
3251
3251
  const e = [];
3252
- xt(n, (a) => {
3252
+ Ft(n, (a) => {
3253
3253
  if (a.tagName === "script") {
3254
3254
  a.remove();
3255
3255
  return;
@@ -3275,7 +3275,7 @@ const le = (n) => {
3275
3275
  }
3276
3276
  }), i.length > 0 ? a.setAttribute("style", i.join(";")) : a.removeAttribute("style");
3277
3277
  }
3278
- }), xt(n, (a) => {
3278
+ }), Ft(n, (a) => {
3279
3279
  e.forEach((r) => {
3280
3280
  r.selectors?.forEach((i) => {
3281
3281
  li(a, i) && r.declarations?.forEach((s) => {
@@ -3291,7 +3291,7 @@ const le = (n) => {
3291
3291
  }, bn = (n) => dt().parseFromString(n, "image/svg+xml").firstElementChild, di = (n, t, e) => {
3292
3292
  n.setAttribute("height", `${e}px`), n.setAttribute("width", `${t}px`);
3293
3293
  }, In = (n, t, e) => {
3294
- xt(n, (a) => {
3294
+ Ft(n, (a) => {
3295
3295
  const r = a.attributes.getNamedItem("fill");
3296
3296
  r && r.value !== "none" && a.classList.forEach((s) => {
3297
3297
  if (s.startsWith("spiff-fill")) {
@@ -3329,7 +3329,7 @@ const le = (n) => {
3329
3329
  }
3330
3330
  });
3331
3331
  });
3332
- }, Bn = (n) => It().serializeToString(n), ya = (n, t, e, a, r) => {
3332
+ }, Bn = (n) => bt().serializeToString(n), ya = (n, t, e, a, r) => {
3333
3333
  const i = bn(n);
3334
3334
  if (!i)
3335
3335
  throw new Error("Failed to read SVG.");
@@ -3348,7 +3348,7 @@ const le = (n) => {
3348
3348
  throw new Error("Failed to read SVG.");
3349
3349
  wa(e);
3350
3350
  const a = {};
3351
- xt(e, (s) => {
3351
+ Ft(e, (s) => {
3352
3352
  si.includes(s.tagName) && !s.attributes.getNamedItem("fill") && s.setAttribute("fill", "black");
3353
3353
  const o = s.attributes.getNamedItem("fill");
3354
3354
  if (o && o.value !== "none" && !o.value.startsWith("url(")) {
@@ -3361,7 +3361,7 @@ const le = (n) => {
3361
3361
  s.classList.add(A), s.setAttribute("stroke", c.browserValue), a[d] = c;
3362
3362
  }
3363
3363
  });
3364
- const i = It().serializeToString(e);
3364
+ const i = bt().serializeToString(e);
3365
3365
  return {
3366
3366
  colors: a,
3367
3367
  svg: i
@@ -3544,7 +3544,7 @@ class wi {
3544
3544
  async getLocalOrFromServer(t) {
3545
3545
  if (this.cache.has(t)) {
3546
3546
  const r = this.cache.get(t);
3547
- if (!r) throw new N("Failed to get asset from cache!");
3547
+ if (!r) throw new T("Failed to get asset from cache!");
3548
3548
  return r;
3549
3549
  }
3550
3550
  const a = (async () => (await Be([t]))[0])();
@@ -3570,14 +3570,14 @@ class wi {
3570
3570
  * Caches an asset if it doesn't already exist.
3571
3571
  */
3572
3572
  cacheAsset(t) {
3573
- if (!t.key) throw new N("Asset has no key!");
3573
+ if (!t.key) throw new T("Asset has no key!");
3574
3574
  this.cache.has(t.key) || this.cache.set(t.key, Promise.resolve(t));
3575
3575
  }
3576
3576
  /**
3577
3577
  * Caches a material if it doesn't already exist.
3578
3578
  */
3579
3579
  cacheMaterial(t) {
3580
- if (!t.id) throw new N("Material has no id!");
3580
+ if (!t.id) throw new T("Material has no id!");
3581
3581
  this.materialCache.has(t.id) || this.materialCache.set(t.id, Promise.resolve(t));
3582
3582
  }
3583
3583
  /**
@@ -3660,9 +3660,9 @@ class wi {
3660
3660
  async postProcessFileUpload(t, e) {
3661
3661
  if (e === "image/svg+xml") {
3662
3662
  const a = await t.blob.text(), s = new window.DOMParser().parseFromString(a, "image/svg+xml").documentElement;
3663
- if (!s) throw new Pt("Failed to read SVG.");
3663
+ if (!s) throw new Bt("Failed to read SVG.");
3664
3664
  ci(s);
3665
- const l = It().serializeToString(s);
3665
+ const l = bt().serializeToString(s);
3666
3666
  return {
3667
3667
  name: t.name,
3668
3668
  blob: new Blob([l], { type: "image/svg+xml" })
@@ -3693,7 +3693,7 @@ class wi {
3693
3693
  case "mkv":
3694
3694
  return "video/x-matroska";
3695
3695
  default:
3696
- throw new N("Unexpected mimetype: " + e);
3696
+ throw new T("Unexpected mimetype: " + e);
3697
3697
  }
3698
3698
  }
3699
3699
  }
@@ -5456,7 +5456,7 @@ const M = () => {
5456
5456
  }), nd = (n, t, e, a) => ({
5457
5457
  x: n.x + (t?.x + t?.width) * e,
5458
5458
  y: n.y + (t?.y + t?.height) * a
5459
- }), Bt = (n) => {
5459
+ }), It = (n) => {
5460
5460
  switch (n) {
5461
5461
  case W.North:
5462
5462
  return W.East;
@@ -5475,7 +5475,7 @@ const M = () => {
5475
5475
  case W.Southwest:
5476
5476
  return W.Northwest;
5477
5477
  }
5478
- }, rd = (n, t) => t > 45 && t <= 135 ? Bt(n) : t > 135 && t <= 225 ? Bt(Bt(n)) : t > 225 && t <= 315 ? Bt(Bt(Bt(n))) : n, id = (n, t = { x: 0, y: 0 }, e = { x: 1, y: 1 }) => {
5478
+ }, rd = (n, t) => t > 45 && t <= 135 ? It(n) : t > 135 && t <= 225 ? It(It(n)) : t > 225 && t <= 315 ? It(It(It(n))) : n, id = (n, t = { x: 0, y: 0 }, e = { x: 1, y: 1 }) => {
5479
5479
  const a = ft(n.rotation), r = {
5480
5480
  x: t.x + n.x * e.x,
5481
5481
  y: t.x + n.y * e.y
@@ -5699,7 +5699,7 @@ class as {
5699
5699
  }), a - r;
5700
5700
  }
5701
5701
  }
5702
- const ns = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", We = /* @__PURE__ */ new Map(), Tt = async (n) => {
5702
+ const ns = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", We = /* @__PURE__ */ new Map(), Mt = async (n) => {
5703
5703
  if (We.has(n))
5704
5704
  return We.get(n);
5705
5705
  const e = (async () => {
@@ -5741,7 +5741,7 @@ const ns = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", We = /* @_
5741
5741
  });
5742
5742
  const s = e.querySelectorAll("tspan");
5743
5743
  for (let d = 0; d < s.length; d++) {
5744
- const A = s.item(d), u = A.closest("text"), h = A.closest("g"), m = u.getAttribute("font-family"), p = await Tt(r.get(m)), g = u.getAttribute("fill"), f = u.getAttribute("stroke"), C = u.getAttribute("stroke-width"), I = p.getPath(
5744
+ const A = s.item(d), u = A.closest("text"), h = A.closest("g"), m = u.getAttribute("font-family"), p = await Mt(r.get(m)), g = u.getAttribute("fill"), f = u.getAttribute("stroke"), C = u.getAttribute("stroke-width"), I = p.getPath(
5745
5745
  A.innerHTML,
5746
5746
  0,
5747
5747
  0,
@@ -5760,7 +5760,7 @@ const ns = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", We = /* @_
5760
5760
  const b = B.toSVG(2), R = t.parseFromString(b, "image/svg+xml").firstElementChild;
5761
5761
  h.appendChild(R);
5762
5762
  }
5763
- return e.querySelectorAll("text").forEach((d) => d.remove()), It().serializeToString(a);
5763
+ return e.querySelectorAll("text").forEach((d) => d.remove()), bt().serializeToString(a);
5764
5764
  }, Pe = (n, t, e, a) => Math.max(ls(n.join(`
5765
5765
  `), e, a), t), za = (n, t, e, a, r, i) => {
5766
5766
  const s = (i || Ln) * r.getApproximateHeight(), o = t.split(`
@@ -5877,7 +5877,7 @@ const ns = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", We = /* @_
5877
5877
  }, cs = (n, t) => n.map((e, a) => [e, t[a]]), ds = (n = "center", t = !1) => t ? "center" : n, Un = (n) => n === "left" ? "start" : n === "right" ? "end" : "middle", ae = (n, t, e) => n.fontData ? {
5878
5878
  ...n,
5879
5879
  ...(() => {
5880
- if (n.algorithm === kt.Traditional) {
5880
+ if (n.algorithm === xt.Traditional) {
5881
5881
  const r = ss(t, n, e, n.lineHeight);
5882
5882
  return {
5883
5883
  text: r.lines.join(`
@@ -5893,7 +5893,7 @@ const ns = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", We = /* @_
5893
5893
  };
5894
5894
  })()
5895
5895
  } : n, Ln = 1.1;
5896
- function Dt(n, t) {
5896
+ function Pt(n, t) {
5897
5897
  return Vn(n, t.getTemplatingContext());
5898
5898
  }
5899
5899
  function Vn(n, t) {
@@ -6333,7 +6333,7 @@ const ne = (n) => {
6333
6333
  const s = dt().parseFromString(n, "image/svg+xml").firstElementChild;
6334
6334
  if (!s)
6335
6335
  throw new Error("Failed to read SVG");
6336
- const l = It().serializeToString(s), c = pt(), d = c.getContext("2d"), A = await ma.from(d, l, {
6336
+ const l = bt().serializeToString(s), c = pt(), d = c.getContext("2d"), A = await ma.from(d, l, {
6337
6337
  anonymousCrossOrigin: !0,
6338
6338
  ignoreDimensions: !1,
6339
6339
  createCanvas: pt,
@@ -6374,7 +6374,7 @@ const ne = (n) => {
6374
6374
  o.height = o.width / A, o.top += (l - o.height) / 2;
6375
6375
  }
6376
6376
  if (e && t === x.Textbox && a?.text && a?.fontScale) {
6377
- await Tt(e);
6377
+ await Mt(e);
6378
6378
  const l = Ct(e), c = mt(a.text, a?.fontScale, l);
6379
6379
  o.width = Math.min(c, r.width * 0.85), o.left = r.x + r.width / 2 - o.width / 2;
6380
6380
  }
@@ -6425,7 +6425,7 @@ class cd {
6425
6425
  };
6426
6426
  }
6427
6427
  static async getTextbox(t, e) {
6428
- const { configuration: a, fontSrc: r, designInputStep: i } = e, s = await Tt(r), o = {
6428
+ const { configuration: a, fontSrc: r, designInputStep: i } = e, s = await Mt(r), o = {
6429
6429
  assetUrl: r,
6430
6430
  name: s.names.fullName.en
6431
6431
  }, l = i?.text || a.defaultText || "", c = a.replaceableText ? a.replaceableText.replace("{{}}", l) : l, d = De(c, {
@@ -6452,7 +6452,7 @@ class cd {
6452
6452
  rotation: A.rotation,
6453
6453
  vertical: a.vertical,
6454
6454
  verticalAlign: a.verticalAlign || "middle",
6455
- algorithm: kt.Traditional,
6455
+ algorithm: xt.Traditional,
6456
6456
  fontSize: a.size || Math.max(Math.round(A.height * 0.025), 1),
6457
6457
  text: d,
6458
6458
  input: l
@@ -6598,7 +6598,7 @@ const U = (n, t) => J(n, t).elements.find((r) => r.id === n), J = (n, t) => {
6598
6598
  );
6599
6599
  for (let s = 0; s < i.length; ++s) {
6600
6600
  const o = i[s];
6601
- o.fontData?.assetUrl && await Tt(o.fontData.assetUrl);
6601
+ o.fontData?.assetUrl && await Mt(o.fontData.assetUrl);
6602
6602
  }
6603
6603
  }
6604
6604
  };
@@ -6686,7 +6686,7 @@ class ud extends Q {
6686
6686
  const s = a;
6687
6687
  s.scaleX = s.scaleX * this.width / e.width, s.scaleY = s.scaleY * this.height / e.height;
6688
6688
  } else if (e.type === "textbox") {
6689
- const s = a, o = (!s.algorithm || s.algorithm === kt.Autosize ? s.text : s.input) ?? "";
6689
+ const s = a, o = (!s.algorithm || s.algorithm === xt.Autosize ? s.text : s.input) ?? "";
6690
6690
  a = ae(s, o, e);
6691
6691
  }
6692
6692
  const r = J(e.id, Object.values(t.layouts)), i = _(a, r);
@@ -6784,7 +6784,7 @@ class z extends Q {
6784
6784
  return a !== void 0 ? a + 1 : 0;
6785
6785
  }
6786
6786
  }
6787
- class bt extends Q {
6787
+ class Tt extends Q {
6788
6788
  constructor(t) {
6789
6789
  super(), this.id = t;
6790
6790
  }
@@ -6864,7 +6864,7 @@ class Cs extends Q {
6864
6864
  const a = {
6865
6865
  ...e,
6866
6866
  fontSize: this.size
6867
- }, r = J(e.id, Object.values(t.layouts)), i = (!e.algorithm || e.algorithm === kt.Autosize ? e.text : e.input) ?? "", s = _(ae(a, i), r);
6867
+ }, r = J(e.id, Object.values(t.layouts)), i = (!e.algorithm || e.algorithm === xt.Autosize ? e.text : e.input) ?? "", s = _(ae(a, i), r);
6868
6868
  return {
6869
6869
  ...t,
6870
6870
  layouts: {
@@ -6886,7 +6886,7 @@ class ja extends Q {
6886
6886
  const a = {
6887
6887
  ...e,
6888
6888
  fontData: this.fontData
6889
- }, r = J(e.id, Object.values(t.layouts)), i = (!e.algorithm || e.algorithm === kt.Autosize ? e.text : e.input) ?? "", s = _(ae(a, i), r);
6889
+ }, r = J(e.id, Object.values(t.layouts)), i = (!e.algorithm || e.algorithm === xt.Autosize ? e.text : e.input) ?? "", s = _(ae(a, i), r);
6890
6890
  return {
6891
6891
  ...t,
6892
6892
  layouts: {
@@ -7387,7 +7387,7 @@ class Is {
7387
7387
  40
7388
7388
  );
7389
7389
  });
7390
- t.forEach((h) => a.getCommandDispatcher()(new bt(h.id)));
7390
+ t.forEach((h) => a.getCommandDispatcher()(new Tt(h.id)));
7391
7391
  const o = r.data.baseUrl.slice(0, 4) === "http" ? "" : "https://", l = new URL(o + r.data.baseUrl);
7392
7392
  l.searchParams.append("video", btoa(JSON.stringify([s]))), l.pathname = l.pathname + (l.pathname.slice(-1) === "/" ? "" : "/");
7393
7393
  const c = l.toString();
@@ -7712,7 +7712,7 @@ class Fe {
7712
7712
  i && i(!0);
7713
7713
  const c = t.data.initialZoomLevel, d = await Promise.all(
7714
7714
  t.data.regions.map(async (h, m) => {
7715
- const p = await $e(l[m]), g = o.getImageData(), f = a.map((B) => new bt(B.id)), C = g ? Ia(
7715
+ const p = await $e(l[m]), g = o.getImageData(), f = a.map((B) => new Tt(B.id)), C = g ? Ia(
7716
7716
  g,
7717
7717
  p,
7718
7718
  c && !t.data.forceImageCover ? { scale: c } : void 0,
@@ -7960,7 +7960,7 @@ class Bs {
7960
7960
  if (!t.data || !t.data.regions)
7961
7961
  throw new Ie(t, "Missing regions.");
7962
7962
  r(!0);
7963
- const s = a.map((f) => new bt(f.id));
7963
+ const s = a.map((f) => new Tt(f.id));
7964
7964
  t.mandatory && i.setMandatoryFulfilled(t.stepName, !1);
7965
7965
  const o = e.asset;
7966
7966
  if (!o)
@@ -8231,7 +8231,7 @@ class Fs {
8231
8231
  if (!p)
8232
8232
  return console.error(`Can not find layout for region: ${A.panelId}`), null;
8233
8233
  const g = [];
8234
- return u && g.push(new bt(h)), g.push(
8234
+ return u && g.push(new Tt(h)), g.push(
8235
8235
  new z(
8236
8236
  {
8237
8237
  stepRegion: A,
@@ -8352,7 +8352,7 @@ class xs {
8352
8352
  if (!s)
8353
8353
  return console.error("No URL for picture!"), null;
8354
8354
  r(!0), t.mandatory && a.setMandatoryFulfilled(t.stepName, !1);
8355
- const l = a.getRegionElements(t.stepName).map((A) => new bt(A.id)), c = (A) => {
8355
+ const l = a.getRegionElements(t.stepName).map((A) => new Tt(A.id)), c = (A) => {
8356
8356
  const h = a.getLayouts().find((p) => p.panelId === A.panelId);
8357
8357
  if (!h)
8358
8358
  throw new H(A);
@@ -8913,7 +8913,7 @@ class Rs {
8913
8913
  });
8914
8914
  }
8915
8915
  updateInputText(t, e, a, r) {
8916
- const i = r.getStepStorage(a.stepName), s = Dt(t, r), o = this.getProcessedInput(s, a.data, i?.customiseAllText ?? !1), l = {
8916
+ const i = r.getStepStorage(a.stepName), s = Pt(t, r), o = this.getProcessedInput(s, a.data, i?.customiseAllText ?? !1), l = {
8917
8917
  command: void 0,
8918
8918
  helperData: {},
8919
8919
  errorData: this.getErrorsForText(t, o, a, r)
@@ -8923,7 +8923,7 @@ class Rs {
8923
8923
  l.helperData.charactersRemaining = a.data.maxLength - o.length;
8924
8924
  const c = [], d = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map();
8925
8925
  for (const u of e) {
8926
- if (!u.fontData) throw new N("Failed to resolve font data for text.");
8926
+ if (!u.fontData) throw new T("Failed to resolve font data for text.");
8927
8927
  const [h, m] = Ce(
8928
8928
  u.fontSize,
8929
8929
  u.fontData,
@@ -9085,7 +9085,7 @@ class Rs {
9085
9085
  const a = e.fileLink;
9086
9086
  if (!a)
9087
9087
  throw new jt(e);
9088
- const r = await Tt(a);
9088
+ const r = await Mt(a);
9089
9089
  return {
9090
9090
  assetUrl: a,
9091
9091
  name: r.names.fullName.en
@@ -9172,7 +9172,7 @@ class Rs {
9172
9172
  async createTextboxRegions(t, e, a, r, i, s) {
9173
9173
  if (!a || !a.regions)
9174
9174
  throw new Error("Step data not supplied");
9175
- const o = i.text || a.defaultText || "", l = Dt(o, s), c = this.getProcessedInput(l, a, !1), d = async (u) => {
9175
+ const o = i.text || a.defaultText || "", l = Pt(o, s), c = this.getProcessedInput(l, a, !1), d = async (u) => {
9176
9176
  const m = s.getLayouts().find((g) => g.panelId === u.panelId), p = M();
9177
9177
  try {
9178
9178
  if (!m)
@@ -9210,7 +9210,7 @@ class Rs {
9210
9210
  paths: a.paths,
9211
9211
  fillSpotColorDefinition: f
9212
9212
  }, y = [], S = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Map();
9213
- if (!P.fontData) throw new N("Failed to resolve font data for text.");
9213
+ if (!P.fontData) throw new T("Failed to resolve font data for text.");
9214
9214
  const [b, F] = Ce(
9215
9215
  P.fontSize,
9216
9216
  P.fontData,
@@ -9231,10 +9231,10 @@ class Rs {
9231
9231
  y.push(
9232
9232
  this.generateTextChangeCommandsForRegion(b, a, P.id, R)
9233
9233
  );
9234
- const T = new z(P, m);
9234
+ const N = new z(P, m);
9235
9235
  return {
9236
9236
  regionElement: { id: p, region: u },
9237
- commands: [T, ...y],
9237
+ commands: [N, ...y],
9238
9238
  newElement: P,
9239
9239
  fontData: r
9240
9240
  };
@@ -9269,7 +9269,7 @@ class Rs {
9269
9269
  * @deprecated
9270
9270
  */
9271
9271
  async changeInputTextWithRegion(t, e, a, r, i, s, o, l, c, d) {
9272
- const A = (r || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), u = Dt(A, s), h = this.getProcessedInput(u, t.data, o), m = s.getRegionElements(t.stepName), p = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
9272
+ const A = (r || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), u = Pt(A, s), h = this.getProcessedInput(u, t.data, o), m = s.getRegionElements(t.stepName), p = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
9273
9273
  for (const y of m)
9274
9274
  if (y.region) {
9275
9275
  const [S, B] = Ce(
@@ -9397,7 +9397,7 @@ class Ws {
9397
9397
  u = (A * 100 | 0) / 100;
9398
9398
  break;
9399
9399
  default:
9400
- throw new Pt("Failed to encode path.");
9400
+ throw new Bt("Failed to encode path.");
9401
9401
  }
9402
9402
  l || s.push(" "), s.push(u), l = !1;
9403
9403
  }
@@ -9411,12 +9411,12 @@ class Ws {
9411
9411
  for (e.lastIndex = 0; i = e.exec(t); ) {
9412
9412
  const s = i[1].toLowerCase(), o = (i[2].match(a) || []).map(parseFloat), l = s === i[1], c = Ja[s];
9413
9413
  if (o.length < c.length)
9414
- throw new Pt(
9414
+ throw new Bt(
9415
9415
  `Path type "${s}" given ${o.length} arguments, expected ${c.length}.`
9416
9416
  );
9417
9417
  if (c.length > 0) {
9418
9418
  if (o.length % c.length !== 0)
9419
- throw new Pt(
9419
+ throw new Bt(
9420
9420
  `Path type "${s}" given ${o.length} arguments, not divisible by ${c.length}`
9421
9421
  );
9422
9422
  for (let d = 0; d < o.length / c.length; d++) {
@@ -9441,7 +9441,7 @@ class Ws {
9441
9441
  if (o in i && l in i) {
9442
9442
  const c = [i[o], i[l]], d = e(c);
9443
9443
  if (d.length < 2)
9444
- throw new Pt("Transformer must return at least 2 points.");
9444
+ throw new Bt("Transformer must return at least 2 points.");
9445
9445
  i[o] = d[0], i[l] = d[1];
9446
9446
  }
9447
9447
  }
@@ -9489,7 +9489,7 @@ class qs extends Os {
9489
9489
  const b = et("g");
9490
9490
  b.classList.add("module-layer2"), I.appendChild(b), b.setAttribute("fill", "rgb(255,209,0)"), b.setAttribute("transform", "translate(1,-0.1)"), b.innerHTML = o;
9491
9491
  const F = et("g");
9492
- return F.classList.add("module-layer3"), I.appendChild(F), F.setAttribute("fill", "white"), F.innerHTML = o, new Ws(I).transform(([T, Z]) => [T, Z + (c / 2 - T) ** 2 / (c * 6)]), I;
9492
+ return F.classList.add("module-layer3"), I.appendChild(F), F.setAttribute("fill", "white"), F.innerHTML = o, new Ws(I).transform(([N, Z]) => [N, Z + (c / 2 - N) ** 2 / (c * 6)]), I;
9493
9493
  }, u = et("g");
9494
9494
  u.classList.add("module-root");
9495
9495
  const h = et("defs");
@@ -9509,7 +9509,7 @@ class qs extends Os {
9509
9509
  async function tr(n) {
9510
9510
  if (n === "Vegemite")
9511
9511
  return new qs();
9512
- throw new N(`Failed to resolve Module, Module ${n} not found`);
9512
+ throw new T(`Failed to resolve Module, Module ${n} not found`);
9513
9513
  }
9514
9514
  const Hs = [
9515
9515
  "altGlyph",
@@ -9625,7 +9625,7 @@ const Hs = [
9625
9625
  return console.error("Failed to read SVG."), [];
9626
9626
  wa(m);
9627
9627
  const p = {};
9628
- xt(m, (y) => {
9628
+ Ft(m, (y) => {
9629
9629
  Hs.includes(y.tagName) && !y.attributes.getNamedItem("fill") && y.setAttribute("fill", "#000000");
9630
9630
  const S = y.attributes.getNamedItem("fill");
9631
9631
  if (S && S.value !== "none") {
@@ -9638,7 +9638,7 @@ const Hs = [
9638
9638
  y.classList.add(R), p[R] = { browserValue: b };
9639
9639
  }
9640
9640
  });
9641
- const f = It().serializeToString(m), C = r.colors;
9641
+ const f = bt().serializeToString(m), C = r.colors;
9642
9642
  if (C) {
9643
9643
  for (const [y, S] of Object.entries(p))
9644
9644
  for (const B of Object.keys(C))
@@ -9836,8 +9836,8 @@ const Hs = [
9836
9836
  const c = await at(i, !0), d = (A) => {
9837
9837
  const u = /<svg.*?<\/svg>/s, h = A.match(u) || [], m = h?.length > 0 ? h[0] : "", f = dt().parseFromString(m, "image/svg+xml").firstElementChild;
9838
9838
  if (!f)
9839
- throw new Pt("Failed to read SVG.");
9840
- return wa(f), It().serializeToString(f);
9839
+ throw new Bt("Failed to read SVG.");
9840
+ return wa(f), bt().serializeToString(f);
9841
9841
  };
9842
9842
  l.forEach((A) => {
9843
9843
  const u = n.find((m) => m.panelId === A.panelId);
@@ -9882,7 +9882,7 @@ const Hs = [
9882
9882
  const g = l();
9883
9883
  if (!g)
9884
9884
  return;
9885
- const f = await Tt(g);
9885
+ const f = await Mt(g);
9886
9886
  return {
9887
9887
  assetUrl: g,
9888
9888
  name: f.names.fullName.en
@@ -10975,7 +10975,7 @@ class Go {
10975
10975
  }), this.initializationPromise.catch((h) => {
10976
10976
  throw console.error(h), this.initialized = !1, new Error("Workflow initialization failed due to an error. See console.");
10977
10977
  }), this.initializationPromise.finally(
10978
- () => this.getCommandContext().registerStateCallback(() => {
10978
+ () => this.commandContext.registerStateCallback(() => {
10979
10979
  this.updateStateWithServer(), this.renderLayouts();
10980
10980
  })
10981
10981
  );
@@ -11326,7 +11326,7 @@ class Go {
11326
11326
  const c = l[0];
11327
11327
  if (o.type === E.Model) {
11328
11328
  if (!this.modelContainer)
11329
- throw new N(
11329
+ throw new T(
11330
11330
  "We should always have a model container when injecting a preview!"
11331
11331
  );
11332
11332
  const d = c.asset?.fileLink;
@@ -11351,7 +11351,7 @@ class Go {
11351
11351
  }
11352
11352
  o.data.targetMaterials.forEach((u) => {
11353
11353
  if (!this.modelContainer)
11354
- throw new N(
11354
+ throw new T(
11355
11355
  "We should always have a model container when injecting a preview!"
11356
11356
  );
11357
11357
  this.modelContainer.applyMaterialVariant(u, o.option.id, d);
@@ -11422,7 +11422,7 @@ class Go {
11422
11422
  serialize() {
11423
11423
  const t = this.getCommandContext().getState();
11424
11424
  if (!t)
11425
- throw new N("Attempted to serialize state before it was initialized.");
11425
+ throw new T("Attempted to serialize state before it was initialized.");
11426
11426
  const e = vt(t.transaction), a = this.dehydrateState(e);
11427
11427
  return JSON.stringify(a);
11428
11428
  }
@@ -11552,11 +11552,7 @@ class Go {
11552
11552
  });
11553
11553
  }
11554
11554
  async reset() {
11555
- this.commandContext.getAllLayouts().forEach(
11556
- (e) => e.layoutState.elements.forEach((a) => {
11557
- this.getCommandDispatcher()(new bt(a.id));
11558
- })
11559
- ), this.stepElements = {}, this.stepInitialised = {}, this.stepMetadata = {}, this.stepSelections = {}, this.storage = {}, await this.ensureStepsAreLoaded();
11555
+ this.stepElements = {}, this.stepInitialised = {}, this.stepMetadata = {}, this.stepSelections = {}, this.storage = {}, await this.ensureStepsAreLoaded();
11560
11556
  }
11561
11557
  async setSelectionsAndElements(t, e, a, r) {
11562
11558
  const i = this.experience.getWorkflow();
@@ -11582,7 +11578,7 @@ class Go {
11582
11578
  }, this.removeElements(h);
11583
11579
  const g = i.steps.find((S) => S.stepName === t);
11584
11580
  g?.type === E.Frame && this.getWorkflowExperience().getStepById(g.stepName)?.frameService?.setTargetElements(a.map((B) => B.id));
11585
- const f = h.map((S) => new bt(S.id)), C = new Ha(this.constructSerializableWorkflow()), I = [...p, ...f, C];
11581
+ const f = h.map((S) => new Tt(S.id)), C = new Ha(this.constructSerializableWorkflow()), I = [...p, ...f, C];
11586
11582
  I.length > 0 && this.commandContext.apply(new O(I), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
11587
11583
  const P = this.getInvalidModelVariants(), y = this.modelContainer;
11588
11584
  if (y) {
@@ -12208,7 +12204,7 @@ class Ko extends X {
12208
12204
  const e = {
12209
12205
  input: t,
12210
12206
  helperData: {}
12211
- }, a = G.findLayoutElements(this.manager, this.step), r = G.filterUnsupportedCharacters(t, a[0]?.fontData), i = Dt(r, this.manager).length, s = !!this.step.data && !!this.step.data.maxLength && i > this.step.data.maxLength;
12207
+ }, a = G.findLayoutElements(this.manager, this.step), r = G.filterUnsupportedCharacters(t, a[0]?.fontData), i = Pt(r, this.manager).length, s = !!this.step.data && !!this.step.data.maxLength && i > this.step.data.maxLength;
12212
12208
  s || (e.input = r);
12213
12209
  const o = a.length <= 0, l = o ? { inputText: r, text: r } : { inputText: r };
12214
12210
  this.manager.updateStorage(this.step.stepName, l);
@@ -12284,7 +12280,7 @@ class Ko extends X {
12284
12280
  const t = this.step.data.maxLength;
12285
12281
  if (t === void 0)
12286
12282
  return;
12287
- const e = Dt(this.getText(), this.manager);
12283
+ const e = Pt(this.getText(), this.manager);
12288
12284
  return t - e.length;
12289
12285
  }
12290
12286
  setCustomColor(t) {
@@ -12365,7 +12361,7 @@ class Zo extends X {
12365
12361
  const t = this.step.data.maxLength;
12366
12362
  if (t === void 0)
12367
12363
  return;
12368
- const e = Dt(this.getText(), this.manager);
12364
+ const e = Pt(this.getText(), this.manager);
12369
12365
  return t - e.length;
12370
12366
  }
12371
12367
  /**
@@ -12423,7 +12419,7 @@ class de {
12423
12419
  case E.Module:
12424
12420
  return new Zo(t, e, t.getStepTags(e.stepName));
12425
12421
  default:
12426
- throw new N(`Step type ${e.type} not yet supported in Core SDK`);
12422
+ throw new T(`Step type ${e.type} not yet supported in Core SDK`);
12427
12423
  }
12428
12424
  }
12429
12425
  }
@@ -12640,7 +12636,7 @@ const al = async (n, t) => {
12640
12636
  await (async () => {
12641
12637
  if (c !== void 0) return c;
12642
12638
  await n.outstandingRequestsPromise();
12643
- const F = (k.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map()).get(r.id), T = await v.getShadowGraphqlClient().query({
12639
+ const F = (k.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map()).get(r.id), N = await v.getShadowGraphqlClient().query({
12644
12640
  query: kn,
12645
12641
  variables: { ids: [r.id] },
12646
12642
  fetchPolicy: "no-cache",
@@ -12648,17 +12644,17 @@ const al = async (n, t) => {
12648
12644
  context: {
12649
12645
  transactionOwnerId: F
12650
12646
  }
12651
- }), Z = T.data?.transactions[0].workflowState;
12652
- return T.errors ? (T.errors.forEach((tt) => {
12653
- T.errors && console.log("Server Error:", tt.message);
12647
+ }), Z = N.data?.transactions[0].workflowState;
12648
+ return N.errors ? (N.errors.forEach((tt) => {
12649
+ N.errors && console.log("Server Error:", tt.message);
12654
12650
  }), null) : Z ?? null;
12655
12651
  })() || (console.warn("State mismatch detected. Uploading known state explicitly"), console.warn("State Object:", JSON.stringify(a())), await n.updateStateWithServerImmediate(a), console.log("Server state is undefined @ Workflow completion"));
12656
12652
  const u = n.getPreviewService(), h = t?.finalizeStepConfig?.lookAtAnimation, m = u && t.showModelOnFinishStep && !!h, p = l && Za(l, t, !0), g = l && Za(l, t, !1), f = async (b) => {
12657
12653
  const F = {};
12658
12654
  let R = 0;
12659
12655
  if (Object.keys(i).length > 0)
12660
- for (const T of Object.keys(i)) {
12661
- const Z = i[T], tt = t.steps.find((rt) => rt.stepName === T);
12656
+ for (const N of Object.keys(i)) {
12657
+ const Z = i[N], tt = t.steps.find((rt) => rt.stepName === N);
12662
12658
  for (let rt = 0; rt < Z.selections.length; ++rt) {
12663
12659
  const K = Z.selections[rt];
12664
12660
  if (tt && (!b || tt.option && (tt.option.variants || []).length > 1 && !tt.data.hideSelectionInCart && !tt.data.hideSelectionsInCart)) {
@@ -12712,14 +12708,14 @@ const al = async (n, t) => {
12712
12708
  };
12713
12709
  if (g) {
12714
12710
  const F = [];
12715
- for (const [R, T] of Object.entries(g))
12716
- F.push({ key: R, value: T });
12711
+ for (const [R, N] of Object.entries(g))
12712
+ F.push({ key: R, value: N });
12717
12713
  b.metadata = F;
12718
12714
  }
12719
12715
  if (I) {
12720
12716
  const F = [];
12721
- for (const [R, T] of Object.entries(y))
12722
- F.push({ key: R, ids: T });
12717
+ for (const [R, N] of Object.entries(y))
12718
+ F.push({ key: R, ids: N });
12723
12719
  b.selectedVariants = F;
12724
12720
  }
12725
12721
  return b;
@@ -12828,7 +12824,7 @@ class ol {
12828
12824
  const t = k.get(this.localPersistenceKey);
12829
12825
  return t ? JSON.parse(t) : [];
12830
12826
  }
12831
- throw new N("Unexpected storage method requested");
12827
+ throw new T("Unexpected storage method requested");
12832
12828
  }
12833
12829
  /**
12834
12830
  * Search for a transaction that has been saved.
@@ -12868,7 +12864,7 @@ class ol {
12868
12864
  k.set(this.localPersistenceKey, JSON.stringify(t));
12869
12865
  return;
12870
12866
  }
12871
- throw new N("Unexpected storage method requested");
12867
+ throw new T("Unexpected storage method requested");
12872
12868
  }
12873
12869
  }
12874
12870
  const Xe = new ol(), ll = w`
@@ -13066,7 +13062,7 @@ class hl {
13066
13062
  return this.profanityList;
13067
13063
  }
13068
13064
  async setProduct(t) {
13069
- this.workflow = void 0, this.workflowManager.reset();
13065
+ this.workflow = void 0;
13070
13066
  const a = (await this.graphQlClient().mutate({
13071
13067
  mutation: Al,
13072
13068
  variables: {
@@ -13075,23 +13071,28 @@ class hl {
13075
13071
  }
13076
13072
  })).data?.transactionUpdateIntegrationProduct.product;
13077
13073
  if (!a)
13078
- throw new Error("Failed to set product. No product returned from server.");
13079
- const r = this.bundle?.getProductCollection()?.getProducts().find((i) => i.getCurrentIntegration()?.id === a.id);
13074
+ throw new T("Failed to set product. No product returned from server.");
13075
+ if (!this.bundle)
13076
+ throw new T("Cannot set product on experience that is not part of a bundle.");
13077
+ const r = (await this.bundle.getProductCollection().fetchProducts()).find(
13078
+ (i) => i.getCurrentIntegration()?.id === a.id
13079
+ );
13080
+ this.product = a, this.currentPriceBreak = this.priceBreakToBeApplied();
13080
13081
  try {
13081
13082
  const i = r?.getDefaultWorkflow();
13082
13083
  if (i) {
13083
13084
  const s = await Jl(i.getId());
13084
- await this.setWorkflow(s);
13085
+ await this.setWorkflow(s), console.log("Setting Product - Workflow set to default for product.");
13085
13086
  }
13086
13087
  } catch {
13088
+ console.log("Setting Product - No default workflow available, must be set manually.");
13087
13089
  }
13088
- this.product = a, this.currentPriceBreak = this.priceBreakToBeApplied();
13089
13090
  }
13090
13091
  getWorkflow() {
13091
13092
  return this.workflow;
13092
13093
  }
13093
13094
  async setWorkflow(t) {
13094
- this.workflowManager.reset(), this.workflow = t, await this.workflowManager.setWorkflow(t);
13095
+ return this.workflow = t, this.workflowManager.setWorkflow(t);
13095
13096
  }
13096
13097
  async attachAddress(t, e, a, r, i, s) {
13097
13098
  await this.graphQlClient().mutate({
@@ -13319,9 +13320,9 @@ class hl {
13319
13320
  }
13320
13321
  async save(t) {
13321
13322
  const e = this.getProduct(), a = this.getWorkflow(), r = this.getCommandContext().getState();
13322
- if (!e) throw new N("Product undefined!");
13323
- if (!a) throw new N("Workflow undefined!");
13324
- if (!r) throw new N("State undefined!");
13323
+ if (!e) throw new T("Product undefined!");
13324
+ if (!a) throw new T("Workflow undefined!");
13325
+ if (!r) throw new T("State undefined!");
13325
13326
  const s = {
13326
13327
  title: await (async () => {
13327
13328
  if (t) return t;
@@ -13340,11 +13341,11 @@ class hl {
13340
13341
  }
13341
13342
  async copy() {
13342
13343
  const t = vt(this.getCommandContext().getState());
13343
- if (!t) throw new N("Internal state is undefined! Cannot copy experience!");
13344
+ if (!t) throw new T("Internal state is undefined! Cannot copy experience!");
13344
13345
  const e = JSON.stringify(t.transaction), a = this.getWorkflow();
13345
- if (!a) throw new N("Workflow is undefined! Cannot copy experience!");
13346
+ if (!a) throw new T("Workflow is undefined! Cannot copy experience!");
13346
13347
  const r = this.getTransaction().integrationProduct?.id;
13347
- if (!r) throw new N("Integration product id is undefined!");
13348
+ if (!r) throw new T("Integration product id is undefined!");
13348
13349
  return await this.getClient().getWorkflowExperience({
13349
13350
  type: "integration",
13350
13351
  integrationProductId: r,
@@ -13355,9 +13356,9 @@ class hl {
13355
13356
  async onDesignFinished(t, e = !0) {
13356
13357
  const a = this.getTransaction(), r = this.getProduct(), i = this.getWorkflow();
13357
13358
  if (!r)
13358
- throw new N("Product undefined! Cannot finish an experience without a product.");
13359
+ throw new T("Product undefined! Cannot finish an experience without a product.");
13359
13360
  if (!i)
13360
- throw new N("Workflow undefined! Cannot finish an experience without a workflow.");
13361
+ throw new T("Workflow undefined! Cannot finish an experience without a workflow.");
13361
13362
  return a.completed ? (await this.graphQlClient().mutate({
13362
13363
  mutation: Ri,
13363
13364
  variables: {
@@ -16135,7 +16136,7 @@ class bd {
16135
16136
  } catch (a) {
16136
16137
  throw console.error(a), new ht("Critical - Unable to synchronize workflow state with server.");
16137
16138
  }
16138
- }, this.options = t, this.options.applicationKey && qr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 32.4.0-beta.8897ea88-ee5b-526f-a5cc-8b19f8c7e3a8"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
16139
+ }, this.options = t, this.options.applicationKey && qr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 32.4.0-beta.10d6c3f0-b67c-57ea-8493-e129d6bd348f"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
16139
16140
  }
16140
16141
  configure(t) {
16141
16142
  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 && jr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Ut.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
@@ -16612,7 +16613,7 @@ class bd {
16612
16613
  return !this.activeIntegration && b[0].integrationProduct?.integration && (this.activeIntegration = Promise.resolve(b[0].integrationProduct.integration)), b.map((F, R) => ({
16613
16614
  transaction: F,
16614
16615
  workflowId: F.workflowId,
16615
- readOnly: y.find((T) => T.option.transactionId === F.id)?.option.readOnly ?? !1,
16616
+ readOnly: y.find((N) => N.option.transactionId === F.id)?.option.readOnly ?? !1,
16616
16617
  index: y[R].index
16617
16618
  }));
16618
16619
  }, i = async (y) => {
@@ -16655,7 +16656,7 @@ class bd {
16655
16656
  ])).flat(), h = [...new Set(u.map((y) => y.workflowId))].filter(
16656
16657
  (y) => y !== void 0
16657
16658
  ), m = h.length > 0 ? await lr(h, e) : [], p = new Map(m.map((y) => [y.id, y])), g = k.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), f = u.map(async (y) => {
16658
- const { transaction: S, workflowId: B, readOnly: b, index: F } = y, R = B ? p.get(B) : void 0, T = t[F];
16659
+ const { transaction: S, workflowId: B, readOnly: b, index: F } = y, R = B ? p.get(B) : void 0, N = t[F];
16659
16660
  !g.get(S.id) && S.transactionOwnerId && g.set(S.id, S.transactionOwnerId);
16660
16661
  const Z = g.get(S.id) || void 0, tt = new Gl({
16661
16662
  onMutate: () => ({ context: { transactionOwnerId: Z, bundleOwnerId: e?.bundleOwnerId } }),
@@ -16663,25 +16664,25 @@ class bd {
16663
16664
  }), rt = {
16664
16665
  workflow: R,
16665
16666
  transaction: S,
16666
- singleVariantsRenderable: T?.workflowConfiguration?.singleVariantsRenderable,
16667
+ singleVariantsRenderable: N?.workflowConfiguration?.singleVariantsRenderable,
16667
16668
  stateMutationFunc: b ? async () => {
16668
- throw new N("State mutation is forbidden in read only mode!");
16669
+ throw new T("State mutation is forbidden in read only mode!");
16669
16670
  } : async (K) => this.updateTransactionState({
16670
16671
  ...K,
16671
16672
  context: { transactionOwnerId: Z, bundleOwnerId: e?.bundleOwnerId }
16672
16673
  }),
16673
16674
  graphQlClient: () => tt,
16674
16675
  readOnly: b,
16675
- isReloadedTransaction: T.type === "transaction"
16676
+ isReloadedTransaction: N.type === "transaction"
16676
16677
  };
16677
- if (T.type === "transaction" && S.workflowState) {
16678
+ if (N.type === "transaction" && S.workflowState) {
16678
16679
  const K = JSON.parse(S.workflowState);
16679
16680
  await qa(K), rt.reloadedState = K;
16680
- } else if (!b && T.workflowState) {
16681
- const K = JSON.parse(T.workflowState);
16681
+ } else if (!b && N.workflowState) {
16682
+ const K = JSON.parse(N.workflowState);
16682
16683
  await qa(K), rt.reloadedState = K;
16683
16684
  }
16684
- return rt.delayWorkflowStateSync = !0, { experienceOptions: rt, index: F, options: T };
16685
+ return rt.delayWorkflowStateSync = !0, { experienceOptions: rt, index: F, options: N };
16685
16686
  }), C = await Promise.all(f);
16686
16687
  k.setMap("transactionOwnerIds", g);
16687
16688
  const I = C.sort((y, S) => y.index - S.index);
@@ -16962,7 +16963,7 @@ class Xl {
16962
16963
  if (!r || !this.frameData)
16963
16964
  return;
16964
16965
  if (this.frameData.length !== t.length)
16965
- throw new N(
16966
+ throw new T(
16966
16967
  "Frame data and offsets are not the same length. This is a bug. Please report it."
16967
16968
  );
16968
16969
  if (!this.offsets.some((s, o) => !(t[o].x === s.x && t[o].y === s.y && t[o].zoom === s.zoom)) && !a) {
@@ -17006,8 +17007,8 @@ class Xl {
17006
17007
  */
17007
17008
  updateFrameOffsets(t, e, a, r, i) {
17008
17009
  if (!a || a.length === 0 || a.some((o) => !o))
17009
- throw new N("Frame data not set. This is a bug");
17010
- if (!this.workflowManager) throw new N("No workflow manager set, cannot update offsets.");
17010
+ throw new T("Frame data not set. This is a bug");
17011
+ if (!this.workflowManager) throw new T("No workflow manager set, cannot update offsets.");
17011
17012
  const s = this.workflowManager.getCommandDispatcher();
17012
17013
  this.targetElements.forEach((o, l) => {
17013
17014
  s(
@@ -17848,7 +17849,7 @@ export {
17848
17849
  Hn as CreateLayoutCommand,
17849
17850
  Hl as CurrencyContext,
17850
17851
  ql as CurrencyService,
17851
- bt as DeleteElementCommand,
17852
+ Tt as DeleteElementCommand,
17852
17853
  Xo as DigitalContentStepHandle,
17853
17854
  fl as FileUploadGlobalPropertyHandle,
17854
17855
  he as FlowExecutionNodeResult,
@@ -17882,7 +17883,7 @@ export {
17882
17883
  Ul as ObjectInputType,
17883
17884
  rr as OptionGlobalPropertyHandle,
17884
17885
  be as OptionNotFoundError,
17885
- Pt as ParseError,
17886
+ Bt as ParseError,
17886
17887
  jo as PictureStepHandle,
17887
17888
  Mr as ProductCameraRig,
17888
17889
  sr as ProductCollection,
@@ -17904,14 +17905,14 @@ export {
17904
17905
  Dr as StepAspectType,
17905
17906
  X as StepHandle,
17906
17907
  E as StepType,
17907
- kt as TextAlgorithm,
17908
+ xt as TextAlgorithm,
17908
17909
  vs as TextChangeCommand,
17909
17910
  Cl as TextGlobalPropertyHandle,
17910
17911
  vd as TextInput,
17911
17912
  Ko as TextStepHandle,
17912
17913
  xl as Transform,
17913
17914
  Fl as TransformCollection,
17914
- N as UnhandledBehaviorError,
17915
+ T as UnhandledBehaviorError,
17915
17916
  Tr as UnitOfMeasurement,
17916
17917
  hd as UpdateImageSourceCommand,
17917
17918
  it as Variant,
@@ -17972,7 +17973,7 @@ export {
17972
17973
  v as graphQlManager,
17973
17974
  fe as illustrationStepService,
17974
17975
  Xc as isCloseToValue,
17975
- Tt as loadFont,
17976
+ Mt as loadFont,
17976
17977
  Yc as matchHexToPms,
17977
17978
  Jn as materialStepService,
17978
17979
  Pl as metafieldManager,
@@ -18009,6 +18010,6 @@ export {
18009
18010
  Ns as toast,
18010
18011
  Wd as validateWorkflowExperienceRecipient,
18011
18012
  qd as validateWorkflowExperienceRecipients,
18012
- It as xmlSerializer
18013
+ bt as xmlSerializer
18013
18014
  };
18014
18015
  //# sourceMappingURL=index.mjs.map