@spiffcommerce/core 32.2.4-beta.22910d0f-1efc-5606-9b55-50e06d6770a9 → 32.2.4-beta.37bc688d-3d85-536a-ba61-02a441df130e
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.js +57 -57
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +463 -463
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -4,26 +4,26 @@ import { onError as hr } from "@apollo/client/link/error";
|
|
4
4
|
import { renderToStaticMarkup as mr } from "preact-render-to-string";
|
5
5
|
import { removeTypenameFromVariables as gr } from "@apollo/client/link/remove-typename";
|
6
6
|
import { orientation as pr } from "exifr/dist/mini.umd.cjs";
|
7
|
-
import { parse as
|
7
|
+
import { parse as on } from "css";
|
8
8
|
import fr from "fuse.js";
|
9
|
-
import { Pith as
|
10
|
-
import
|
11
|
-
import { toString as
|
9
|
+
import { Pith as Aa } from "pith";
|
10
|
+
import Et from "lodash.clonedeep";
|
11
|
+
import { toString as ln } from "qrcode";
|
12
12
|
import Cr from "svg-path-bbox";
|
13
|
-
import { parse as
|
14
|
-
import { jsx as D, jsxs as
|
13
|
+
import { parse as ta } from "opentype.js";
|
14
|
+
import { jsx as D, jsxs as ct, Fragment as Gt } from "preact/jsx-runtime";
|
15
15
|
import wr from "handlebars";
|
16
16
|
import { dataUriToBuffer as yr } from "data-uri-to-buffer";
|
17
|
-
import
|
18
|
-
import { CognitoIdentityProviderClient as Sr, InitiateAuthCommand as
|
17
|
+
import Fa from "lodash.chunk";
|
18
|
+
import { CognitoIdentityProviderClient as Sr, InitiateAuthCommand as xa, RespondToAuthChallengeCommand as vr } from "@aws-sdk/client-cognito-identity-provider";
|
19
19
|
import Er from "dinero.js";
|
20
|
-
import * as
|
21
|
-
import
|
22
|
-
import { split as
|
20
|
+
import * as ka from "currency-codes";
|
21
|
+
import cn from "lodash.isequal";
|
22
|
+
import { split as ea } from "unicode-default-word-boundary";
|
23
23
|
import dn from "lodash.debounce";
|
24
24
|
import "fs";
|
25
25
|
import "path";
|
26
|
-
var
|
26
|
+
var ye = /* @__PURE__ */ ((r) => (r.Data = "Data", r.Font = "Font", r.Frame = "Frame", r.Illustration = "Illustration", r.Image = "Image", r.Model = "Model", r.Material = "Material", r.Color = "Color", r.QuestionnaireCollateral = "QuestionnaireCollateral", r.RequestCollateral = "RequestCollateral", r.SignupCollateral = "SignupCollateral", r.Video = "Video", r.ColorProfile = "ColorProfile", r.Environment = "Environment", r))(ye || {}), U = /* @__PURE__ */ ((r) => (r.FileUpload = "FileUpload", r.Option = "Option", r.ColorOption = "ColorOption", r.Text = "Text", r))(U || {}), v = /* @__PURE__ */ ((r) => (r.Information = "Information", r.Bulk = "Bulk", r.DigitalContent = "DigitalContent", r.Finish = "Finish", r.Frame = "Frame", r.Illustration = "Illustration", r.Introduction = "Introduction", r.Material = "Material", r.Model = "Model", r.Module = "Module", r.Picture = "Picture", r.Photo = "Photo", r.ProductOverlay = "ProductOverlay", r.Question = "Question", r.Shape = "Shape", r.SilentIllustration = "SilentIllustration", r.Text = "Text", r))(v || {}), br = /* @__PURE__ */ ((r) => (r.Color = "Color", r.Colors = "Colors", r.Selection = "Selection", r.Selections = "Selections", r.Text = "Text", r.Upload = "Upload", r))(br || {}), Ht = /* @__PURE__ */ ((r) => (r.ThreeD = "ThreeD", r.FreeDesign = "FreeDesign", r.Print = "Print", r))(Ht || {}), x = /* @__PURE__ */ ((r) => (r.Frame = "frame", r.Group = "group", r.Image = "image", r.Pattern = "pattern", r.Illustration = "illustration", r.Textbox = "textbox", r))(x || {}), Br = /* @__PURE__ */ ((r) => (r.Default = "Default", r.FirstTransaction = "FirstTransaction", r.OneToOne = "OneToOne", r))(Br || {}), An = /* @__PURE__ */ ((r) => (r.Pending = "Pending", r.Failed = "Failed", r.Validated = "Validated", r.Overridden = "Overridden", r))(An || {}), Ir = /* @__PURE__ */ ((r) => (r.Hyperlink = "Hyperlink", r.Edit = "Edit", r.Approve = "Approve", r))(Ir || {}), Pr = /* @__PURE__ */ ((r) => (r.Hub = "Hub", r.Shopify = "Shopify", r))(Pr || {}), ua = /* @__PURE__ */ ((r) => (r.BackgroundRemover = "BackgroundRemover", r.ConversionAccelerator = "Conversion Accelerator", r.ProcessBuilder = "ProcessBuilder", r))(ua || {}), Dr = /* @__PURE__ */ ((r) => (r[r.Orbit = 0] = "Orbit", r[r.Pan = 1] = "Pan", r))(Dr || {}), Se = /* @__PURE__ */ ((r) => (r.Owner = "Owner", r.Approver = "Approver", r.Editor = "Editor", r.Viewer = "Viewer", r))(Se || {}), Mt = /* @__PURE__ */ ((r) => (r.Autosize = "Autosize", r.Traditional = "Traditional", r))(Mt || {}), j = /* @__PURE__ */ ((r) => (r[r.North = 0] = "North", r[r.Northeast = 1] = "Northeast", r[r.East = 2] = "East", r[r.Southeast = 3] = "Southeast", r[r.South = 4] = "South", r[r.Southwest = 5] = "Southwest", r[r.West = 6] = "West", r[r.Northwest = 7] = "Northwest", r))(j || {}), Fr = /* @__PURE__ */ ((r) => (r.Pixel = "px", r.Millimeter = "mm", r.Centimeter = "cm", r))(Fr || {});
|
27
27
|
class un extends Error {
|
28
28
|
constructor(t) {
|
29
29
|
super(t), this.name = this.constructor.name;
|
@@ -34,7 +34,7 @@ class Xt extends un {
|
|
34
34
|
super(`ConfigurationError - ${t}`);
|
35
35
|
}
|
36
36
|
}
|
37
|
-
class
|
37
|
+
class ve extends Xt {
|
38
38
|
constructor(t) {
|
39
39
|
super(`Option not Configured: ${t.stepTitle}`), this.optionId = t?.optionId || "N/A";
|
40
40
|
}
|
@@ -54,32 +54,32 @@ class Yt extends Xt {
|
|
54
54
|
super(`Resource not found for asset: ${t.name}`), this.asset = t;
|
55
55
|
}
|
56
56
|
}
|
57
|
-
class
|
57
|
+
class Ee extends Xt {
|
58
58
|
constructor(t, e) {
|
59
59
|
super(`Workflow Misconfiguration: ${t.stepName} - ${e}`), this.step = t;
|
60
60
|
}
|
61
61
|
}
|
62
|
-
class
|
62
|
+
class xe extends un {
|
63
63
|
constructor(t) {
|
64
64
|
super(`ImplementationError - ${t}`);
|
65
65
|
}
|
66
66
|
}
|
67
|
-
class V extends
|
67
|
+
class V extends xe {
|
68
68
|
constructor(t) {
|
69
69
|
super(`Unhandled Behavior Encountered: ${t}`);
|
70
70
|
}
|
71
71
|
}
|
72
|
-
class Dt extends
|
72
|
+
class Dt extends xe {
|
73
73
|
constructor(t) {
|
74
74
|
super(`Parsing Error: ${t}`);
|
75
75
|
}
|
76
76
|
}
|
77
|
-
class
|
77
|
+
class ht extends xe {
|
78
78
|
constructor(t) {
|
79
79
|
super(`Client Error: ${t}`);
|
80
80
|
}
|
81
81
|
}
|
82
|
-
class
|
82
|
+
class ke extends xe {
|
83
83
|
constructor(t) {
|
84
84
|
super(`Resource Generation Failed: ${t}`);
|
85
85
|
}
|
@@ -104,7 +104,7 @@ class xr {
|
|
104
104
|
this.set(t, a);
|
105
105
|
}
|
106
106
|
}
|
107
|
-
class
|
107
|
+
class Ma {
|
108
108
|
constructor() {
|
109
109
|
this.storage = /* @__PURE__ */ new Map();
|
110
110
|
}
|
@@ -129,9 +129,9 @@ class Ta {
|
|
129
129
|
}
|
130
130
|
const kr = () => {
|
131
131
|
try {
|
132
|
-
return localStorage ? new xr() : new
|
132
|
+
return localStorage ? new xr() : new Ma();
|
133
133
|
} catch {
|
134
|
-
return console.warn("Local storage was unavilable due to browser security settings. Using in-memory storage instead."), new
|
134
|
+
return console.warn("Local storage was unavilable due to browser security settings. Using in-memory storage instead."), new Ma();
|
135
135
|
}
|
136
136
|
}, k = kr();
|
137
137
|
class Mr {
|
@@ -160,53 +160,53 @@ class Mr {
|
|
160
160
|
this.serverUrlCallbacks.push(t);
|
161
161
|
}
|
162
162
|
}
|
163
|
-
const
|
164
|
-
let
|
163
|
+
const gt = new Mr();
|
164
|
+
let aa, na;
|
165
165
|
function Qc(r) {
|
166
|
-
|
166
|
+
aa = r;
|
167
167
|
}
|
168
168
|
function Rc(r) {
|
169
|
-
|
169
|
+
na = r;
|
170
170
|
}
|
171
171
|
function Zt() {
|
172
|
-
return
|
172
|
+
return aa ? new aa().window : (console.log(
|
173
173
|
"DOM constructor is not registered. Assuming browser environment. If not, please register DOM constructor before calling this function."
|
174
174
|
), window);
|
175
175
|
}
|
176
176
|
function rt(r, t) {
|
177
|
-
if (!
|
177
|
+
if (!na) {
|
178
178
|
if (typeof window < "u" && window.fetch)
|
179
179
|
return window.fetch(r, t);
|
180
180
|
if (typeof global < "u" && global.fetch)
|
181
181
|
return global.fetch(r, t);
|
182
182
|
throw new Error("Fetch implementation is not registered. Please register it before calling this function.");
|
183
183
|
}
|
184
|
-
return
|
184
|
+
return na(r, t);
|
185
185
|
}
|
186
|
-
const hn = /* @__PURE__ */ new Map(),
|
187
|
-
const t =
|
186
|
+
const hn = /* @__PURE__ */ new Map(), Ta = /* @__PURE__ */ new Map(), Na = /* @__PURE__ */ new Map(), mn = async (r) => {
|
187
|
+
const t = Ta.get(r);
|
188
188
|
if (t) return t;
|
189
189
|
const a = (async () => {
|
190
190
|
const n = await rt(r);
|
191
191
|
return hn.set(r, n.headers?.get("content-type") || ""), await n.arrayBuffer();
|
192
192
|
})();
|
193
|
-
return
|
193
|
+
return Ta.set(r, a), a;
|
194
194
|
}, Tr = async (r) => {
|
195
|
-
const t =
|
195
|
+
const t = Na.get(r);
|
196
196
|
if (t) return t;
|
197
197
|
const a = (async () => await (await rt(r)).text())();
|
198
|
-
return
|
198
|
+
return Na.set(r, a), a;
|
199
199
|
}, Tt = (r) => r.every((t) => t !== "undefined"), se = (r) => Tt([typeof document]) ? document.createElement(r) : Zt().document.createElement(r), Nr = (r, t) => {
|
200
200
|
if (Tt([typeof document]))
|
201
201
|
return document.createElementNS(r, t);
|
202
202
|
const a = Zt().document.createElement(t);
|
203
203
|
return a.setAttribute("xmlns", r), a;
|
204
|
-
},
|
204
|
+
}, dt = () => {
|
205
205
|
if (Tt([typeof DOMParser]))
|
206
206
|
return new DOMParser();
|
207
207
|
const r = Zt();
|
208
208
|
return new r.DOMParser();
|
209
|
-
}, Qr = () => Tt([typeof DOMParser]) ? DOMParser : Zt().DOMParser,
|
209
|
+
}, Qr = () => Tt([typeof DOMParser]) ? DOMParser : Zt().DOMParser, Me = (r, t) => new Promise((e, a) => {
|
210
210
|
t ? mn(r).then(e).catch(a) : rt(r).then((n) => {
|
211
211
|
n.arrayBuffer().then(e).catch(a);
|
212
212
|
}).catch((n) => {
|
@@ -216,21 +216,21 @@ const hn = /* @__PURE__ */ new Map(), Na = /* @__PURE__ */ new Map(), Qa = /* @_
|
|
216
216
|
t ? Tr(r).then(e).catch(a) : rt(r).then((n) => {
|
217
217
|
n.text().then(e).catch(a);
|
218
218
|
}).catch(a);
|
219
|
-
}), gn = (r) => mr(r),
|
219
|
+
}), gn = (r) => mr(r), Ue = /* @__PURE__ */ new Map(), Rr = async (r, t) => {
|
220
220
|
if (Tt([typeof FontFace])) {
|
221
|
-
if (
|
222
|
-
return
|
221
|
+
if (Ue.has(t))
|
222
|
+
return Ue.get(t);
|
223
223
|
const e = r.names.fullName.en, a = new FontFace(e, `url(${t})`);
|
224
224
|
document.fonts.add(a);
|
225
225
|
const n = a.load();
|
226
|
-
return
|
226
|
+
return Ue.set(t, n), n;
|
227
227
|
}
|
228
228
|
}, It = () => {
|
229
229
|
if (Tt([typeof XMLSerializer]))
|
230
230
|
return new XMLSerializer();
|
231
231
|
const r = Zt();
|
232
232
|
return new r.XMLSerializer();
|
233
|
-
},
|
233
|
+
}, Qa = (r) => btoa(r), Te = (r) => {
|
234
234
|
function t() {
|
235
235
|
const a = new Uint8Array(r), n = 4;
|
236
236
|
if (a.length >= n) {
|
@@ -257,7 +257,7 @@ const hn = /* @__PURE__ */ new Map(), Na = /* @__PURE__ */ new Map(), Qa = /* @_
|
|
257
257
|
const e = t();
|
258
258
|
return e || "image/svg+xml";
|
259
259
|
}, Oc = async (r) => {
|
260
|
-
const t = await mn(r), e = hn.get(r) ||
|
260
|
+
const t = await mn(r), e = hn.get(r) || Te(t);
|
261
261
|
return await Ur(new Blob([t], { type: e }));
|
262
262
|
}, Or = (r) => {
|
263
263
|
let t = "";
|
@@ -266,9 +266,9 @@ const hn = /* @__PURE__ */ new Map(), Na = /* @__PURE__ */ new Map(), Qa = /* @_
|
|
266
266
|
t += String.fromCharCode(r[a]);
|
267
267
|
return t;
|
268
268
|
}, $r = async (r) => {
|
269
|
-
const t =
|
269
|
+
const t = Te(r), e = new Uint8Array(r), a = Or(e), n = btoa(a);
|
270
270
|
return `data:${t};base64,${n}`;
|
271
|
-
},
|
271
|
+
}, ha = (r) => `data:image/svg+xml;base64,${btoa(r)}`, pn = (r) => {
|
272
272
|
const t = r.replace(/\r?\n/g, ""), e = t.indexOf(",");
|
273
273
|
if (e === -1 || e <= 4)
|
274
274
|
throw new TypeError("malformed data: URI");
|
@@ -287,34 +287,34 @@ const hn = /* @__PURE__ */ new Map(), Na = /* @__PURE__ */ new Map(), Qa = /* @_
|
|
287
287
|
!i || !i.result ? e() : t(i.result.toString());
|
288
288
|
}, a.readAsDataURL(r);
|
289
289
|
});
|
290
|
-
let Lr,
|
290
|
+
let Lr, ma;
|
291
291
|
const Vr = (r) => {
|
292
|
-
|
293
|
-
}, zr = () =>
|
292
|
+
ma = r;
|
293
|
+
}, zr = () => ma;
|
294
294
|
let fn;
|
295
295
|
const Gr = (r) => {
|
296
296
|
fn = r;
|
297
297
|
}, Wr = () => new Promise((r) => {
|
298
|
-
const t =
|
298
|
+
const t = gt.getHubUrl(), e = (a) => {
|
299
299
|
a.origin === t && (window.removeEventListener("message", e), r(a.data));
|
300
300
|
};
|
301
301
|
window.parent !== window && (window.addEventListener("message", e, !1), window.parent.postMessage("ready", t));
|
302
302
|
}), qr = async () => {
|
303
303
|
const r = {
|
304
|
-
applicationKey:
|
304
|
+
applicationKey: ma,
|
305
305
|
customerToken: Lr,
|
306
306
|
bearer: fn
|
307
307
|
};
|
308
308
|
return typeof window < "u" && (window.location.href.includes("/workflows/product/") || window.location.href.includes("hub=true")) ? { ...await Wr(), ...r } : r;
|
309
309
|
};
|
310
310
|
async function jr(r, t) {
|
311
|
-
const e =
|
311
|
+
const e = gt.getServerUrl(), a = e.includes(".aumelbdev.spiffcommerce.com") ? "https://moonlight.aumelbdev.spiffcommerce.com" : e.includes(".us.spiffcommerce.com") ? "https://moonlight.us.spiffcommerce.com" : "https://moonlight.au.spiffcommerce.com";
|
312
312
|
let n = await rt(r, { ...t, redirect: "manual" });
|
313
313
|
return n.type === "opaqueredirect" && (typeof r != "string" && "url" in r ? n = await rt({ ...r, url: `${a}/graphql` }, t) : n = await rt(`${a}/graphql`, t)), n;
|
314
314
|
}
|
315
315
|
class Hr {
|
316
316
|
constructor() {
|
317
|
-
this.shadowGraphqlClient = this.constructShadowGraphqlClient(),
|
317
|
+
this.shadowGraphqlClient = this.constructShadowGraphqlClient(), gt.addServerUrlCallback(() => {
|
318
318
|
this.shadowGraphqlClient = this.constructShadowGraphqlClient();
|
319
319
|
});
|
320
320
|
}
|
@@ -326,7 +326,7 @@ class Hr {
|
|
326
326
|
}
|
327
327
|
constructShadowGraphqlClient() {
|
328
328
|
const t = lr({
|
329
|
-
uri: `${
|
329
|
+
uri: `${gt.getServerUrl()}/graphql`,
|
330
330
|
fetch: jr
|
331
331
|
}), e = ur(async (i, s) => {
|
332
332
|
const { headers: o } = s, l = o || {}, c = await qr();
|
@@ -364,10 +364,10 @@ class Hr {
|
|
364
364
|
}
|
365
365
|
}
|
366
366
|
const y = new Hr();
|
367
|
-
let
|
368
|
-
const
|
369
|
-
if (
|
370
|
-
return
|
367
|
+
let ra, ia;
|
368
|
+
const pt = (r, t, e) => {
|
369
|
+
if (ra !== void 0)
|
370
|
+
return ra(r, t, e);
|
371
371
|
try {
|
372
372
|
const a = wn(!0);
|
373
373
|
return Cn(a), a.createCanvas(r, t, e);
|
@@ -375,8 +375,8 @@ const ft = (r, t, e) => {
|
|
375
375
|
throw new Error("Canvas module not set");
|
376
376
|
}
|
377
377
|
}, te = (r, t) => {
|
378
|
-
if (
|
379
|
-
return
|
378
|
+
if (ia !== void 0)
|
379
|
+
return ia(r, t);
|
380
380
|
try {
|
381
381
|
const e = wn(!0);
|
382
382
|
return Cn(e), e.loadImage(r, t);
|
@@ -385,7 +385,7 @@ const ft = (r, t, e) => {
|
|
385
385
|
}
|
386
386
|
};
|
387
387
|
function Cn(r) {
|
388
|
-
|
388
|
+
ra = r?.createCanvas, ia = r?.loadImage;
|
389
389
|
}
|
390
390
|
function wn(r) {
|
391
391
|
try {
|
@@ -406,13 +406,13 @@ function wn(r) {
|
|
406
406
|
throw t;
|
407
407
|
}
|
408
408
|
}
|
409
|
-
let
|
410
|
-
function
|
411
|
-
return
|
409
|
+
let Le;
|
410
|
+
function ga() {
|
411
|
+
return Le === void 0 && (Le = Qr()), Le;
|
412
412
|
}
|
413
413
|
let oe = null;
|
414
414
|
const Yr = (r) => new Promise((t) => {
|
415
|
-
if (
|
415
|
+
if (Te(r) !== "image/jpeg")
|
416
416
|
return t(1);
|
417
417
|
pr(r).then((a) => t(a || 1)).catch(() => t(1));
|
418
418
|
}), Jr = async () => {
|
@@ -426,10 +426,10 @@ const Yr = (r) => new Promise((t) => {
|
|
426
426
|
}, _r = async (r) => {
|
427
427
|
const t = await $r(r), e = await te(t), [a, n] = Kr(e);
|
428
428
|
if (!await Jr()) {
|
429
|
-
const A =
|
429
|
+
const A = pt(a, n);
|
430
430
|
return A.getContext("2d")?.drawImage(e, 0, 0, a, n), A;
|
431
431
|
}
|
432
|
-
const s = await Yr(r), [o, l] = s > 4 ? [n, a] : [a, n], c =
|
432
|
+
const s = await Yr(r), [o, l] = s > 4 ? [n, a] : [a, n], c = pt(o, l), d = c.getContext("2d");
|
433
433
|
switch (s) {
|
434
434
|
case 2:
|
435
435
|
d.translate(o, 0), d.scale(-1, 1);
|
@@ -454,9 +454,9 @@ const Yr = (r) => new Promise((t) => {
|
|
454
454
|
break;
|
455
455
|
}
|
456
456
|
return d.drawImage(e, 0, 0, o, l), c;
|
457
|
-
},
|
457
|
+
}, Ne = async (r) => {
|
458
458
|
const t = await _r(r);
|
459
|
-
return
|
459
|
+
return Te(r) === "image/jpeg" ? {
|
460
460
|
dataUrl: t.toDataURL("image/jpeg", 1),
|
461
461
|
height: t.height,
|
462
462
|
width: t.width
|
@@ -3149,7 +3149,7 @@ const Yr = (r) => new Promise((t) => {
|
|
3149
3149
|
"3E2B2E",
|
3150
3150
|
"101820",
|
3151
3151
|
"3D3935"
|
3152
|
-
],
|
3152
|
+
], Ve = xt.map((r) => [
|
3153
3153
|
parseInt(r.substring(0, 2), 16),
|
3154
3154
|
parseInt(r.substring(2, 4), 16),
|
3155
3155
|
parseInt(r.substring(4, 6), 16)
|
@@ -3172,7 +3172,7 @@ function Uc(r, t = 64) {
|
|
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
3173
|
let l, c, d;
|
3174
3174
|
for (let A = 0; A < xt.length; A++) {
|
3175
|
-
l =
|
3175
|
+
l = Ve[A][0], c = Ve[A][1], d = Ve[A][2];
|
3176
3176
|
const u = Math.sqrt(Math.pow(i - l, 2) + Math.pow(s - c, 2) + Math.pow(o - d, 2));
|
3177
3177
|
a.push(u);
|
3178
3178
|
}
|
@@ -3187,16 +3187,16 @@ function Lc(r, t) {
|
|
3187
3187
|
let Qt = null;
|
3188
3188
|
function ei(r) {
|
3189
3189
|
if (r.startsWith("#"))
|
3190
|
-
return
|
3190
|
+
return Ra(r);
|
3191
3191
|
if (!document)
|
3192
3192
|
throw new Error("browserColorToHex is only supported on browsers");
|
3193
3193
|
if (Qt || (Qt = document.createElement("canvas").getContext("2d")), !Qt)
|
3194
3194
|
throw new Error("Failed to create canvas context required to convert colors");
|
3195
3195
|
Qt.fillStyle = r;
|
3196
|
-
const t =
|
3196
|
+
const t = Ra(Qt.fillStyle);
|
3197
3197
|
return t || console.error(`Unknown browser color ${r}`), t;
|
3198
3198
|
}
|
3199
|
-
function
|
3199
|
+
function Ra(r) {
|
3200
3200
|
const t = r.substring(1).toUpperCase();
|
3201
3201
|
return t.length === 6 ? t : t.length === 3 ? `${t[0]}${t[0]}${t[1]}${t[1]}${t[2]}${t[2]}` : "";
|
3202
3202
|
}
|
@@ -3211,7 +3211,7 @@ const le = (r) => {
|
|
3211
3211
|
return `icc-named-color(${t.slice(e + 1).slice(0, -4)}, ${r.namedColor})`;
|
3212
3212
|
}
|
3213
3213
|
return `icc-named-color(${r.profileName}, ${r.namedColor})`;
|
3214
|
-
},
|
3214
|
+
}, Oa = (r) => {
|
3215
3215
|
const t = r.split(/[ ](?=[^)]*?(?:\(|$))/);
|
3216
3216
|
if (t.length === 0)
|
3217
3217
|
return { browserValue: "#000000" };
|
@@ -3245,7 +3245,7 @@ const le = (r) => {
|
|
3245
3245
|
} catch {
|
3246
3246
|
return r.classList.contains(t.substring(1));
|
3247
3247
|
}
|
3248
|
-
},
|
3248
|
+
}, pa = (r, t = !1) => {
|
3249
3249
|
!t && r.setAttribute("preserveAspectRatio", "none");
|
3250
3250
|
const e = [];
|
3251
3251
|
kt(r, (a) => {
|
@@ -3255,7 +3255,7 @@ const le = (r) => {
|
|
3255
3255
|
}
|
3256
3256
|
if (a.tagName === "style") {
|
3257
3257
|
try {
|
3258
|
-
|
3258
|
+
on(a.innerHTML).stylesheet?.rules.forEach((s) => {
|
3259
3259
|
e.push(s);
|
3260
3260
|
}), a.remove();
|
3261
3261
|
} catch (i) {
|
@@ -3287,7 +3287,7 @@ const le = (r) => {
|
|
3287
3287
|
const t = /pt|pc|mm|cm|in/gm, e = r.getAttribute("viewBox"), a = r.getAttribute("width"), n = r.getAttribute("height");
|
3288
3288
|
if (!e) throw new Error("viewBox not specified on SVG!");
|
3289
3289
|
a && r.setAttribute("width", a.replace(t, "")), n && r.setAttribute("height", n.replace(t, ""));
|
3290
|
-
}, Sn = (r) =>
|
3290
|
+
}, Sn = (r) => dt().parseFromString(r, "image/svg+xml").firstElementChild, si = (r, t, e) => {
|
3291
3291
|
r.setAttribute("height", `${e}px`), r.setAttribute("width", `${t}px`);
|
3292
3292
|
}, vn = (r, t, e) => {
|
3293
3293
|
kt(r, (a) => {
|
@@ -3328,35 +3328,35 @@ const le = (r) => {
|
|
3328
3328
|
}
|
3329
3329
|
});
|
3330
3330
|
});
|
3331
|
-
}, En = (r) => It().serializeToString(r),
|
3331
|
+
}, En = (r) => It().serializeToString(r), fa = (r, t, e, a, n) => {
|
3332
3332
|
const i = Sn(r);
|
3333
3333
|
if (!i)
|
3334
3334
|
throw new Error("Failed to read SVG.");
|
3335
3335
|
return si(i, t, e), vn(i, a, n), En(i);
|
3336
|
-
},
|
3336
|
+
}, Ca = (r, t, e) => {
|
3337
3337
|
const a = Sn(r);
|
3338
3338
|
if (!a)
|
3339
3339
|
throw new Error("Failed to read SVG.");
|
3340
3340
|
return vn(a, t, e), En(a);
|
3341
3341
|
}, oi = (r) => {
|
3342
3342
|
const t = /<svg.*<\/svg>/s, e = r.match(t) || [], a = e?.length > 0 ? e[0] : "";
|
3343
|
-
return
|
3343
|
+
return dt().parseFromString(a, "image/svg+xml");
|
3344
3344
|
}, ot = async (r) => {
|
3345
3345
|
const e = oi(r).firstElementChild;
|
3346
3346
|
if (!e)
|
3347
3347
|
throw new Error("Failed to read SVG.");
|
3348
|
-
|
3348
|
+
pa(e);
|
3349
3349
|
const a = {};
|
3350
3350
|
kt(e, (s) => {
|
3351
3351
|
ai.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 =
|
3354
|
+
const c = Oa(o.value), d = c.browserValue.replace(/\W/g, ""), A = `spiff-fill-${d}`;
|
3355
3355
|
s.setAttribute("fill", c.browserValue), s.classList.add(A), a[d] = 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 =
|
3359
|
+
const c = Oa(l.value), d = c.browserValue.replace(/\W/g, ""), A = `spiff-stroke-${d}`;
|
3360
3360
|
s.classList.add(A), s.setAttribute("stroke", c.browserValue), a[d] = c;
|
3361
3361
|
}
|
3362
3362
|
});
|
@@ -3422,7 +3422,7 @@ const le = (r) => {
|
|
3422
3422
|
...AssetFields
|
3423
3423
|
}
|
3424
3424
|
}
|
3425
|
-
`,
|
3425
|
+
`, wa = w`
|
3426
3426
|
fragment MaterialFields on Material {
|
3427
3427
|
id
|
3428
3428
|
name
|
@@ -3470,7 +3470,7 @@ const le = (r) => {
|
|
3470
3470
|
}
|
3471
3471
|
}
|
3472
3472
|
`, di = w`
|
3473
|
-
${
|
3473
|
+
${wa}
|
3474
3474
|
query GetMaterials($ids: [String]) {
|
3475
3475
|
materials(id: $ids) {
|
3476
3476
|
...MaterialFields
|
@@ -3497,7 +3497,7 @@ const le = (r) => {
|
|
3497
3497
|
...AssetFields
|
3498
3498
|
}
|
3499
3499
|
}
|
3500
|
-
`,
|
3500
|
+
`, be = async (r) => (await y.getShadowGraphqlClient().query({
|
3501
3501
|
query: ci,
|
3502
3502
|
errorPolicy: "all",
|
3503
3503
|
fetchPolicy: "no-cache",
|
@@ -3525,7 +3525,7 @@ const le = (r) => {
|
|
3525
3525
|
class gi {
|
3526
3526
|
constructor() {
|
3527
3527
|
this.cache = /* @__PURE__ */ new Map(), this.bgrmProcessCache = /* @__PURE__ */ new Map(), this.materialCache = /* @__PURE__ */ new Map(), this.loadImageAsFileInfo = async (t) => {
|
3528
|
-
const e = await t.arrayBuffer(), a = await
|
3528
|
+
const e = await t.arrayBuffer(), a = await Ne(e), n = (i, s) => {
|
3529
3529
|
const o = atob(i.split(",")[1]), l = [];
|
3530
3530
|
for (let c = 0; c < o.length; c++)
|
3531
3531
|
l.push(o.charCodeAt(c));
|
@@ -3546,14 +3546,14 @@ class gi {
|
|
3546
3546
|
if (!n) throw new V("Failed to get asset from cache!");
|
3547
3547
|
return n;
|
3548
3548
|
}
|
3549
|
-
const a = (async () => (await
|
3549
|
+
const a = (async () => (await be([t]))[0])();
|
3550
3550
|
return this.cache.set(t, a), a;
|
3551
3551
|
}
|
3552
3552
|
/**
|
3553
3553
|
* Retrieves the asset from the server, bypassing cache (but still writing the result to cache)
|
3554
3554
|
*/
|
3555
3555
|
async getFromServer(t) {
|
3556
|
-
const a = (async () => (await
|
3556
|
+
const a = (async () => (await be([t]))[0])();
|
3557
3557
|
return this.cache.set(t, a), a;
|
3558
3558
|
}
|
3559
3559
|
keyFromURL(t) {
|
@@ -3603,7 +3603,7 @@ class gi {
|
|
3603
3603
|
d.lengthComputable && a(d.loaded * 100 / d.total);
|
3604
3604
|
}, c.onload = () => {
|
3605
3605
|
const d = s.assetResponse.asset;
|
3606
|
-
|
3606
|
+
At.add(s.assetResponse.asset), o(d);
|
3607
3607
|
}, c.onerror = l, this.postProcessFileUpload(t, s.mimeType).then((d) => c.send(d.blob)).catch(l);
|
3608
3608
|
}), this.cacheAsset(s.assetResponse.asset), s.assetResponse.asset;
|
3609
3609
|
}
|
@@ -3612,7 +3612,7 @@ class gi {
|
|
3612
3612
|
}, a, n);
|
3613
3613
|
}
|
3614
3614
|
async uploadFile(t, e) {
|
3615
|
-
const n = this.isRaster(t) ?
|
3615
|
+
const n = this.isRaster(t) ? ye.Image : ye.Illustration, i = await this.loadImageAsFileInfo(t);
|
3616
3616
|
return await this.uploadAssetWithProgress(i, n, e, !0);
|
3617
3617
|
}
|
3618
3618
|
async removeBackgroundFromAsset(t) {
|
@@ -3634,7 +3634,7 @@ class gi {
|
|
3634
3634
|
});
|
3635
3635
|
if (this.bgrmProcessCache.delete(e), !i.data?.assetRemoveBackground?.key)
|
3636
3636
|
throw new Error("Failed to remove background from image");
|
3637
|
-
return
|
3637
|
+
return At.add(i.data.assetRemoveBackground), J.add(e, i.data.assetRemoveBackground.key), this.cache.set(
|
3638
3638
|
i.data.assetRemoveBackground.key,
|
3639
3639
|
Promise.resolve(i.data.assetRemoveBackground)
|
3640
3640
|
), i.data.assetRemoveBackground;
|
@@ -3642,16 +3642,16 @@ class gi {
|
|
3642
3642
|
return this.bgrmProcessCache.set(e, n), n;
|
3643
3643
|
}
|
3644
3644
|
removePersistedAsset(t) {
|
3645
|
-
|
3645
|
+
At.remove(t), J.delete(t), J.deleteForBgRemovedKey(t);
|
3646
3646
|
}
|
3647
3647
|
getPersistedAssets() {
|
3648
|
-
return
|
3648
|
+
return At.list();
|
3649
3649
|
}
|
3650
3650
|
registerPersistedAssetListener(t) {
|
3651
|
-
|
3651
|
+
At.addCallback(t);
|
3652
3652
|
}
|
3653
3653
|
unRegisterPersistedAssetListener(t) {
|
3654
|
-
|
3654
|
+
At.removeCallback(t);
|
3655
3655
|
}
|
3656
3656
|
isRaster(t) {
|
3657
3657
|
return !(t.type === "image/svg+xml" || t.type === "application/pdf" || t.type === "application/postscript");
|
@@ -3747,8 +3747,8 @@ const Rt = "persistentAssets", lt = class lt {
|
|
3747
3747
|
}
|
3748
3748
|
};
|
3749
3749
|
lt.callbacks = [];
|
3750
|
-
let
|
3751
|
-
const
|
3750
|
+
let At = lt;
|
3751
|
+
const $a = "bgrmPersistentAssets";
|
3752
3752
|
class J {
|
3753
3753
|
static has(t) {
|
3754
3754
|
return J.getMap().has(t);
|
@@ -3775,10 +3775,10 @@ class J {
|
|
3775
3775
|
a && (e.delete(a), J.setMap(e));
|
3776
3776
|
}
|
3777
3777
|
static getMap() {
|
3778
|
-
return k.getMap(
|
3778
|
+
return k.getMap($a) || /* @__PURE__ */ new Map();
|
3779
3779
|
}
|
3780
3780
|
static setMap(t) {
|
3781
|
-
k.setMap(
|
3781
|
+
k.setMap($a, t);
|
3782
3782
|
}
|
3783
3783
|
}
|
3784
3784
|
const O = new gi();
|
@@ -3850,7 +3850,7 @@ const Kt = new pi(), bn = w`
|
|
3850
3850
|
}
|
3851
3851
|
`, fi = w`
|
3852
3852
|
${ee(!1)}
|
3853
|
-
${
|
3853
|
+
${wa}
|
3854
3854
|
${bn}
|
3855
3855
|
query GetOptions($ids: [String]!) {
|
3856
3856
|
options(ids: $ids) {
|
@@ -3939,7 +3939,7 @@ const H = new Si(), Bn = w`
|
|
3939
3939
|
currencyCode
|
3940
3940
|
}
|
3941
3941
|
}
|
3942
|
-
`,
|
3942
|
+
`, Qe = w`
|
3943
3943
|
fragment AdditionalIntegrationProductFields on IntegrationProduct {
|
3944
3944
|
id
|
3945
3945
|
product {
|
@@ -3958,7 +3958,7 @@ const H = new Si(), Bn = w`
|
|
3958
3958
|
}
|
3959
3959
|
}
|
3960
3960
|
`, vi = w`
|
3961
|
-
${
|
3961
|
+
${Qe}
|
3962
3962
|
mutation CreateTransactions(
|
3963
3963
|
$inputs: [TransactionCreateInput]!
|
3964
3964
|
$marketplaceThemeInstallId: String
|
@@ -4066,7 +4066,7 @@ const H = new Si(), Bn = w`
|
|
4066
4066
|
url
|
4067
4067
|
}
|
4068
4068
|
`, Ei = w`
|
4069
|
-
${
|
4069
|
+
${Qe}
|
4070
4070
|
${In}
|
4071
4071
|
${Pn}
|
4072
4072
|
${Bn}
|
@@ -4351,7 +4351,7 @@ const H = new Si(), Bn = w`
|
|
4351
4351
|
}
|
4352
4352
|
}
|
4353
4353
|
`, Fn = (r) => w`
|
4354
|
-
${
|
4354
|
+
${Qe}
|
4355
4355
|
fragment IntegrationProductFields on IntegrationProduct {
|
4356
4356
|
id
|
4357
4357
|
externalProductId
|
@@ -4588,7 +4588,7 @@ const H = new Si(), Bn = w`
|
|
4588
4588
|
}
|
4589
4589
|
`, Oi = (r) => w`
|
4590
4590
|
${ee(r)}
|
4591
|
-
${
|
4591
|
+
${wa}
|
4592
4592
|
${bn}
|
4593
4593
|
${Ti}
|
4594
4594
|
${Ni}
|
@@ -5028,7 +5028,7 @@ const H = new Si(), Bn = w`
|
|
5028
5028
|
}
|
5029
5029
|
}
|
5030
5030
|
}
|
5031
|
-
`,
|
5031
|
+
`, Re = w`
|
5032
5032
|
fragment MarketplaceThemeInstallConfigurationFields on MarketplaceThemeInstallConfiguration {
|
5033
5033
|
id
|
5034
5034
|
themeInstallId
|
@@ -5108,7 +5108,7 @@ const H = new Si(), Bn = w`
|
|
5108
5108
|
}
|
5109
5109
|
}
|
5110
5110
|
`, Li = w`
|
5111
|
-
${
|
5111
|
+
${Re}
|
5112
5112
|
query GetMarketplaceThemeInstallConfiguration($themeConfigurationId: String!, $themeInstallId: String!) {
|
5113
5113
|
marketplaceThemeInstallConfiguration(id: $themeConfigurationId, themeInstallId: $themeInstallId, raw: false) {
|
5114
5114
|
...MarketplaceThemeInstallConfigurationFields
|
@@ -5116,7 +5116,7 @@ const H = new Si(), Bn = w`
|
|
5116
5116
|
}
|
5117
5117
|
`, Vi = w`
|
5118
5118
|
${Bn}
|
5119
|
-
${
|
5119
|
+
${Re}
|
5120
5120
|
query GetCurrentIntegration($themeConfigurationId: String) {
|
5121
5121
|
currentIntegration {
|
5122
5122
|
id
|
@@ -5128,7 +5128,7 @@ const H = new Si(), Bn = w`
|
|
5128
5128
|
}
|
5129
5129
|
}
|
5130
5130
|
`, zi = w`
|
5131
|
-
${
|
5131
|
+
${Re}
|
5132
5132
|
query ReadTransactionForMarketplaceTheme($id: String!) {
|
5133
5133
|
transactions(ids: [$id]) {
|
5134
5134
|
marketplaceThemeInstallConfiguration(raw: false) {
|
@@ -5137,7 +5137,7 @@ const H = new Si(), Bn = w`
|
|
5137
5137
|
}
|
5138
5138
|
}
|
5139
5139
|
`, Gi = w`
|
5140
|
-
${
|
5140
|
+
${Re}
|
5141
5141
|
query ReadBundleForMarketplaceTheme($id: String!) {
|
5142
5142
|
bundles(ids: [$id]) {
|
5143
5143
|
marketplaceThemeInstallConfiguration(raw: false) {
|
@@ -5215,7 +5215,7 @@ const H = new Si(), Bn = w`
|
|
5215
5215
|
],
|
5216
5216
|
silentSteps: []
|
5217
5217
|
}), t;
|
5218
|
-
}, Hi = (r, t) => t.find((e) => e.stepNames.includes(r)),
|
5218
|
+
}, Hi = (r, t) => t.find((e) => e.stepNames.includes(r)), vt = (r, t) => (r.conditions || []).every((e) => {
|
5219
5219
|
const a = t[e.targetStepName];
|
5220
5220
|
if (a && a.selectedVariants) {
|
5221
5221
|
const n = a.selectedVariants;
|
@@ -5228,12 +5228,12 @@ const H = new Si(), Bn = w`
|
|
5228
5228
|
const e = {
|
5229
5229
|
name: r.name,
|
5230
5230
|
title: r.title,
|
5231
|
-
renderableSteps: r.renderableSteps.filter((a) =>
|
5232
|
-
silentSteps: r.silentSteps.filter((a) =>
|
5231
|
+
renderableSteps: r.renderableSteps.filter((a) => vt(a, t)),
|
5232
|
+
silentSteps: r.silentSteps.filter((a) => vt(a, t))
|
5233
5233
|
};
|
5234
5234
|
return e.silentSteps.length === 0 && e.renderableSteps.length === 0 ? null : e;
|
5235
|
-
},
|
5236
|
-
const a =
|
5235
|
+
}, yt = (r, t) => r.map((e) => Yi(e, t)).filter((e) => e !== null), Ji = async (r, t, e = !1) => {
|
5236
|
+
const a = yt(r, t), n = [];
|
5237
5237
|
for (const s of a)
|
5238
5238
|
for (const o of s.renderableSteps) {
|
5239
5239
|
const l = (o.option?.variants || []).length;
|
@@ -5348,8 +5348,8 @@ const M = () => {
|
|
5348
5348
|
...E,
|
5349
5349
|
_renderingConfiguration: a,
|
5350
5350
|
mask: l ? `url(#viewmask-${f})` : void 0
|
5351
|
-
})), C =
|
5352
|
-
return /* @__PURE__ */
|
5351
|
+
})), C = Sa(I);
|
5352
|
+
return /* @__PURE__ */ ct(
|
5353
5353
|
"svg",
|
5354
5354
|
{
|
5355
5355
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -5401,7 +5401,7 @@ const M = () => {
|
|
5401
5401
|
strokeDasharray: `${m * 2} ${m}`
|
5402
5402
|
}
|
5403
5403
|
),
|
5404
|
-
l && /* @__PURE__ */
|
5404
|
+
l && /* @__PURE__ */ ct("mask", { id: `viewmask-${f}`, children: [
|
5405
5405
|
/* @__PURE__ */ D(
|
5406
5406
|
"rect",
|
5407
5407
|
{
|
@@ -5427,7 +5427,7 @@ const M = () => {
|
|
5427
5427
|
}
|
5428
5428
|
);
|
5429
5429
|
}, Vc = (r, t, e, a, n) => {
|
5430
|
-
const i =
|
5430
|
+
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, b = h * d + g * A, I = Math.max(Math.abs(p), Math.abs(f)), C = Math.max(Math.abs(S), Math.abs(b));
|
5431
5431
|
return {
|
5432
5432
|
minX: l - I,
|
5433
5433
|
maxX: l + I,
|
@@ -5437,8 +5437,8 @@ const M = () => {
|
|
5437
5437
|
}, zc = (r, t, e) => {
|
5438
5438
|
const a = Math.sqrt(Math.pow(t.x - r.x, 2) + Math.pow(t.y - r.y, 2)), n = Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2)), i = Math.sqrt(Math.pow(e.x - r.x, 2) + Math.pow(e.y - r.y, 2));
|
5439
5439
|
return Math.acos((n * n + a * a - i * i) / (2 * n * a)) * (180 / Math.PI);
|
5440
|
-
},
|
5441
|
-
const a = Math.sin(
|
5440
|
+
}, ft = (r) => r * (Math.PI / 180), Gc = (r, t, e) => Math.abs(r - t) < e, Wc = (r, t, e) => {
|
5441
|
+
const a = Math.sin(ft(e)), n = Math.cos(ft(e));
|
5442
5442
|
return {
|
5443
5443
|
x: (r.x - t.x) * n - (r.y - t.y) * a + t.x,
|
5444
5444
|
y: (r.x - t.x) * a + (r.y - t.y) * n + t.y
|
@@ -5475,7 +5475,7 @@ const M = () => {
|
|
5475
5475
|
return j.Northwest;
|
5476
5476
|
}
|
5477
5477
|
}, Jc = (r, t) => t > 45 && t <= 135 ? Pt(r) : t > 135 && t <= 225 ? Pt(Pt(r)) : t > 225 && t <= 315 ? Pt(Pt(Pt(r))) : r, Kc = (r, t = { x: 0, y: 0 }, e = { x: 1, y: 1 }) => {
|
5478
|
-
const a =
|
5478
|
+
const a = ft(r.rotation), n = {
|
5479
5479
|
x: t.x + r.x * e.x,
|
5480
5480
|
y: t.x + r.y * e.y
|
5481
5481
|
}, i = {
|
@@ -5505,7 +5505,7 @@ const M = () => {
|
|
5505
5505
|
y: (r.x - t.x) * a + (r.y - t.y) * n + t.y
|
5506
5506
|
};
|
5507
5507
|
}, _c = 0.352778, Xc = 0.035277, Mn = (r) => {
|
5508
|
-
const t = r.rotation || 0, e =
|
5508
|
+
const t = r.rotation || 0, e = ft(t), a = Math.cos(e), n = -Math.sin(e);
|
5509
5509
|
return /* @__PURE__ */ D("g", { mask: r.stepName || r.productOverlay ? void 0 : r.mask, children: /* @__PURE__ */ D(
|
5510
5510
|
"g",
|
5511
5511
|
{
|
@@ -5527,10 +5527,10 @@ const M = () => {
|
|
5527
5527
|
}
|
5528
5528
|
) });
|
5529
5529
|
}, Tn = (r) => {
|
5530
|
-
const t = `spiff-group-clip-${r.id}`, e = r.rotation || 0, a =
|
5531
|
-
return /* @__PURE__ */
|
5530
|
+
const t = `spiff-group-clip-${r.id}`, e = r.rotation || 0, a = ft(e), n = Math.cos(a), i = -Math.sin(a), s = Sa(r.children);
|
5531
|
+
return /* @__PURE__ */ ct(Gt, { children: [
|
5532
5532
|
/* @__PURE__ */ D("defs", { children: /* @__PURE__ */ D("clipPath", { id: t, preserveAspectRatio: "none", children: r.clipPath ? /* @__PURE__ */ D("path", { d: r.clipPath }) : /* @__PURE__ */ D("rect", { x: 0, y: 0, width: r.width, height: r.height }) }) }),
|
5533
|
-
/* @__PURE__ */
|
5533
|
+
/* @__PURE__ */ ct(
|
5534
5534
|
"g",
|
5535
5535
|
{
|
5536
5536
|
transform: `
|
@@ -5562,14 +5562,14 @@ const M = () => {
|
|
5562
5562
|
if (!r.pattern)
|
5563
5563
|
return "";
|
5564
5564
|
if (r.pattern.svg) {
|
5565
|
-
const A =
|
5566
|
-
return
|
5565
|
+
const A = Ca(r.pattern.svg, r.pattern.colors || {}, !1);
|
5566
|
+
return ha(A);
|
5567
5567
|
}
|
5568
5568
|
return r.pattern.src;
|
5569
5569
|
};
|
5570
5570
|
if (!a())
|
5571
5571
|
return /* @__PURE__ */ D(Gt, {});
|
5572
|
-
const n = () => r.threshold ? r.invertThreshold ? "1 ".repeat(r.threshold) + "0 ".repeat(256 - r.threshold) : "0 ".repeat(r.threshold) + "1 ".repeat(256 - r.threshold) : "", i = () => /* @__PURE__ */ D(Gt, { children: r.useThreshold && /* @__PURE__ */ D("defs", { children: /* @__PURE__ */
|
5572
|
+
const n = () => r.threshold ? r.invertThreshold ? "1 ".repeat(r.threshold) + "0 ".repeat(256 - r.threshold) : "0 ".repeat(r.threshold) + "1 ".repeat(256 - r.threshold) : "", i = () => /* @__PURE__ */ D(Gt, { children: r.useThreshold && /* @__PURE__ */ D("defs", { children: /* @__PURE__ */ ct("filter", { id: e, "color-interpolation-filters": "sRGB", children: [
|
5573
5573
|
/* @__PURE__ */ D(
|
5574
5574
|
"feColorMatrix",
|
5575
5575
|
{
|
@@ -5583,12 +5583,12 @@ const M = () => {
|
|
5583
5583
|
result: "greyscale"
|
5584
5584
|
}
|
5585
5585
|
),
|
5586
|
-
/* @__PURE__ */
|
5586
|
+
/* @__PURE__ */ ct("feComponentTransfer", { in: "greyscale", children: [
|
5587
5587
|
/* @__PURE__ */ D("feFuncR", { type: "discrete", tableValues: n() }),
|
5588
5588
|
/* @__PURE__ */ D("feFuncG", { type: "discrete", tableValues: n() }),
|
5589
5589
|
/* @__PURE__ */ D("feFuncB", { type: "discrete", tableValues: n() })
|
5590
5590
|
] })
|
5591
|
-
] }) }) }), s = r.rotation || 0, o =
|
5591
|
+
] }) }) }), s = r.rotation || 0, o = ft(s), l = Math.cos(o), c = -Math.sin(o), d = () => {
|
5592
5592
|
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;
|
5593
5593
|
return [r.pattern?.svg ? {
|
5594
5594
|
id: `${t}-contents`,
|
@@ -5612,7 +5612,7 @@ const M = () => {
|
|
5612
5612
|
src: a()
|
5613
5613
|
}];
|
5614
5614
|
};
|
5615
|
-
return /* @__PURE__ */
|
5615
|
+
return /* @__PURE__ */ ct(Gt, { children: [
|
5616
5616
|
i(),
|
5617
5617
|
/* @__PURE__ */ D(
|
5618
5618
|
"g",
|
@@ -5698,38 +5698,38 @@ class Xi {
|
|
5698
5698
|
}), a - n;
|
5699
5699
|
}
|
5700
5700
|
}
|
5701
|
-
const Zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:",
|
5702
|
-
if (
|
5703
|
-
return
|
5701
|
+
const Zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", ze = /* @__PURE__ */ new Map(), Nt = async (r) => {
|
5702
|
+
if (ze.has(r))
|
5703
|
+
return ze.get(r);
|
5704
5704
|
const e = (async () => {
|
5705
5705
|
try {
|
5706
|
-
return
|
5706
|
+
return Ct(r).getFont();
|
5707
5707
|
} catch {
|
5708
5708
|
if (Zi(r)) {
|
5709
|
-
const a = pn(r), n =
|
5710
|
-
return
|
5709
|
+
const a = pn(r), n = ta(a);
|
5710
|
+
return sa(r, n), n;
|
5711
5711
|
} else {
|
5712
|
-
const a = await
|
5713
|
-
return
|
5712
|
+
const a = await Me(r, !0), n = ta(a);
|
5713
|
+
return sa(r, n), await Rr(n, r), n;
|
5714
5714
|
}
|
5715
5715
|
}
|
5716
5716
|
})();
|
5717
|
-
return
|
5717
|
+
return ze.set(r, e), e;
|
5718
5718
|
}, ts = (r) => {
|
5719
|
-
const t = pn(r), e =
|
5720
|
-
return
|
5721
|
-
},
|
5719
|
+
const t = pn(r), e = ta(t);
|
5720
|
+
return sa(r, e), e;
|
5721
|
+
}, Ct = (r) => {
|
5722
5722
|
const t = Nn.get(r);
|
5723
5723
|
if (t)
|
5724
5724
|
return t;
|
5725
5725
|
throw new Error("Font metrics unavailable for font");
|
5726
|
-
},
|
5726
|
+
}, sa = (r, t) => {
|
5727
5727
|
const e = new Xi(t);
|
5728
5728
|
return Nn.set(r, e), e;
|
5729
5729
|
}, Zc = async (r) => {
|
5730
|
-
const t =
|
5730
|
+
const t = dt(), e = t.parseFromString(r, "image/svg+xml"), a = e.firstElementChild, n = /* @__PURE__ */ new Map();
|
5731
5731
|
a.querySelectorAll("style").forEach((d) => {
|
5732
|
-
|
5732
|
+
on(d.innerHTML).stylesheet?.rules.forEach((u) => {
|
5733
5733
|
if (u.type === "font-face" && u.declarations) {
|
5734
5734
|
const h = u.declarations.find(
|
5735
5735
|
(p) => p.property === "font-family"
|
@@ -5760,8 +5760,8 @@ const Zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Ge = /* @_
|
|
5760
5760
|
h.appendChild(Q);
|
5761
5761
|
}
|
5762
5762
|
return e.querySelectorAll("text").forEach((d) => d.remove()), It().serializeToString(a);
|
5763
|
-
},
|
5764
|
-
`), e, a), t),
|
5763
|
+
}, Be = (r, t, e, a) => Math.max(rs(r.join(`
|
5764
|
+
`), e, a), t), Ua = (r, t, e, a, n, i) => {
|
5765
5765
|
const s = (i || On) * n.getApproximateHeight(), o = t.split(`
|
5766
5766
|
`);
|
5767
5767
|
try {
|
@@ -5770,7 +5770,7 @@ const Zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Ge = /* @_
|
|
5770
5770
|
lines: c,
|
5771
5771
|
requiredHeight: l.flatMap((d) => d.lines).length * (a * s),
|
5772
5772
|
fontSize: e,
|
5773
|
-
requiredWidth:
|
5773
|
+
requiredWidth: Be(c, r.width, a, n)
|
5774
5774
|
};
|
5775
5775
|
} catch {
|
5776
5776
|
const c = t.split("");
|
@@ -5778,11 +5778,11 @@ const Zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Ge = /* @_
|
|
5778
5778
|
lines: c,
|
5779
5779
|
requiredHeight: c.length * (a * s),
|
5780
5780
|
fontSize: e,
|
5781
|
-
requiredWidth:
|
5781
|
+
requiredWidth: Be(c, r.width, a, n)
|
5782
5782
|
};
|
5783
5783
|
}
|
5784
5784
|
}, ge = (r, t, e, a) => {
|
5785
|
-
const n =
|
5785
|
+
const n = mt(r, e, a);
|
5786
5786
|
if (n <= t)
|
5787
5787
|
return { lines: [r], width: n };
|
5788
5788
|
if (!(r.indexOf(" ") > -1)) {
|
@@ -5795,15 +5795,15 @@ const Zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Ge = /* @_
|
|
5795
5795
|
let l = -1 / 0, c = 0;
|
5796
5796
|
for (; c < s.length; ) {
|
5797
5797
|
const d = s[c];
|
5798
|
-
if (
|
5798
|
+
if (mt(d, e, a) > t) {
|
5799
5799
|
const A = ge(d, t, e, a);
|
5800
5800
|
o.push(...A.lines), l = Math.max(l, A.width), c++;
|
5801
5801
|
} else {
|
5802
5802
|
const A = [d];
|
5803
|
-
l = Math.max(l,
|
5803
|
+
l = Math.max(l, mt(d, e, a));
|
5804
5804
|
let u = c + 1, h = !0;
|
5805
5805
|
for (; u < s.length && h; ) {
|
5806
|
-
const m = s[u], g =
|
5806
|
+
const m = s[u], g = mt(`${A.join(" ")} ${m}`, e, a);
|
5807
5807
|
g <= t ? (A.push(m), l = Math.max(l, g), u++) : h = !1;
|
5808
5808
|
}
|
5809
5809
|
o.push(A.join(" ")), c = u;
|
@@ -5816,9 +5816,9 @@ const Zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Ge = /* @_
|
|
5816
5816
|
const s = (i ?? On) * t.getApproximateHeight(), o = 1 / e.unitsPerEm, l = Qn(r, o, t), c = r.length * s * o, d = a / l, A = n / c;
|
5817
5817
|
return Math.min(A, d);
|
5818
5818
|
}, as = (r, t, e, a) => {
|
5819
|
-
const n =
|
5819
|
+
const n = Ct(t.fontData.assetUrl), i = n.getFont(), s = t.fontSize / i.unitsPerEm;
|
5820
5820
|
if (!e)
|
5821
|
-
return
|
5821
|
+
return Ua(t, r, t.fontSize, s, n, a);
|
5822
5822
|
let o;
|
5823
5823
|
if (t.text ? o = t.text.split(`
|
5824
5824
|
`) : o = t.input?.split(`
|
@@ -5826,22 +5826,22 @@ const Zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Ge = /* @_
|
|
5826
5826
|
return {
|
5827
5827
|
lines: o,
|
5828
5828
|
requiredHeight: t.height,
|
5829
|
-
requiredWidth:
|
5829
|
+
requiredWidth: Be(o, t.width, s, n),
|
5830
5830
|
fontSize: t.fontSize
|
5831
5831
|
};
|
5832
5832
|
const l = t.width !== e.width != (t.height !== e.height);
|
5833
5833
|
return t.lineHeight === e.lineHeight && !l && e.input === r ? {
|
5834
5834
|
lines: o,
|
5835
5835
|
requiredHeight: t.height,
|
5836
|
-
requiredWidth:
|
5836
|
+
requiredWidth: Be(o, t.width, s, n),
|
5837
5837
|
fontSize: es(o, n, i, t.width, t.height, a)
|
5838
|
-
} :
|
5838
|
+
} : Ua(t, r, t.fontSize, s, n, a);
|
5839
5839
|
}, ns = (r, t, e, a, n) => {
|
5840
|
-
const s =
|
5840
|
+
const s = Ct(t.assetUrl).getFont();
|
5841
5841
|
let o = { ...r };
|
5842
|
-
const l = { ...r }, c = Qn(a, e / s.unitsPerEm,
|
5842
|
+
const l = { ...r }, c = Qn(a, e / s.unitsPerEm, Ct(t.assetUrl));
|
5843
5843
|
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 && is(a, a).every(([d, A]) => d === A) && (o = l)), o;
|
5844
|
-
},
|
5844
|
+
}, Ge = 1, mt = (r, t, e) => {
|
5845
5845
|
let a = 0;
|
5846
5846
|
const n = e.getGlyphs(r);
|
5847
5847
|
return n.forEach((i, s) => {
|
@@ -5862,14 +5862,14 @@ const Zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Ge = /* @_
|
|
5862
5862
|
}, Qn = (r, t, e) => {
|
5863
5863
|
let a = 0;
|
5864
5864
|
return r.forEach((n) => {
|
5865
|
-
a = Math.max(a,
|
5865
|
+
a = Math.max(a, mt(n, t, e));
|
5866
5866
|
}), a;
|
5867
|
-
},
|
5867
|
+
}, La = {
|
5868
5868
|
stripControlCharacters: !0,
|
5869
5869
|
vertical: !1,
|
5870
5870
|
uppercase: !1
|
5871
|
-
},
|
5872
|
-
const e = { ...
|
5871
|
+
}, Ie = (r, t = La) => {
|
5872
|
+
const e = { ...La, ...t };
|
5873
5873
|
let a = r || "";
|
5874
5874
|
return e.stripControlCharacters && (a = a.replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, "")), e.uppercase && (a = a.toUpperCase()), e.vertical && (a = a.split("").join(`
|
5875
5875
|
`)), a;
|
@@ -5909,8 +5909,8 @@ const os = (r) => {
|
|
5909
5909
|
if (r.curved && !r.paths || !r.fontData)
|
5910
5910
|
return null;
|
5911
5911
|
const h = () => r.textFillImage ? `url("#${s}")` : r._renderingConfiguration?.spotColors && r.fillSpotColorDefinition ? `${r.fill} ${yn(r.fillSpotColorDefinition)}` : r.fill;
|
5912
|
-
return /* @__PURE__ */
|
5913
|
-
/* @__PURE__ */
|
5912
|
+
return /* @__PURE__ */ ct(Gt, { children: [
|
5913
|
+
/* @__PURE__ */ ct("defs", { children: [
|
5914
5914
|
r.textFillImage && /* @__PURE__ */ D(
|
5915
5915
|
"pattern",
|
5916
5916
|
{
|
@@ -5987,7 +5987,7 @@ const os = (r) => {
|
|
5987
5987
|
const t = () => {
|
5988
5988
|
if (r.lineHeight !== void 0)
|
5989
5989
|
return r.lineHeight * r.fontSize;
|
5990
|
-
const n =
|
5990
|
+
const n = Ct(r.fontData.assetUrl), i = n.getFont(), s = r.fontSize / i.unitsPerEm;
|
5991
5991
|
return n.getApproximateHeight() * s;
|
5992
5992
|
}, e = () => r.align === "left" ? -r.textboxWidth / 2 : r.align === "right" ? r.textboxWidth / 2 : 0, a = () => {
|
5993
5993
|
const n = t(), i = r.textboxHeight / 2;
|
@@ -6030,7 +6030,7 @@ const os = (r) => {
|
|
6030
6030
|
mask: r.stepName ? void 0 : r.mask
|
6031
6031
|
}
|
6032
6032
|
);
|
6033
|
-
const t = r.rotation || 0, e =
|
6033
|
+
const t = r.rotation || 0, e = ft(t), a = Math.cos(e), n = -Math.sin(e), i = `
|
6034
6034
|
matrix(1, 0, 0, 1, ${r.x}, ${r.y})
|
6035
6035
|
matrix(1, 0, 0, 1, ${r.width / 2}, ${r.height / 2})
|
6036
6036
|
matrix(${a}, ${-n}, ${n}, ${a}, 0, 0)
|
@@ -6045,7 +6045,7 @@ const os = (r) => {
|
|
6045
6045
|
{
|
6046
6046
|
transform: i,
|
6047
6047
|
dangerouslySetInnerHTML: {
|
6048
|
-
__html:
|
6048
|
+
__html: fa(
|
6049
6049
|
r.svg,
|
6050
6050
|
r.width,
|
6051
6051
|
r.height,
|
@@ -6121,7 +6121,7 @@ class As {
|
|
6121
6121
|
layout: t,
|
6122
6122
|
elements: e
|
6123
6123
|
},
|
6124
|
-
getComponentWithProps: (a) =>
|
6124
|
+
getComponentWithProps: (a) => ya(t, e, a)
|
6125
6125
|
};
|
6126
6126
|
}
|
6127
6127
|
initialize(t, e) {
|
@@ -6146,7 +6146,7 @@ class As {
|
|
6146
6146
|
return { ...t, transaction: e.apply(a) };
|
6147
6147
|
}
|
6148
6148
|
}
|
6149
|
-
const Un = (r) => r.type === x.Image ? /* @__PURE__ */ D(Mn, { ...r }, r.id) : r.type === x.Frame ? /* @__PURE__ */ D(_i, { ...r }, r.id) : r.type === x.Illustration ? /* @__PURE__ */ D(ds, { ...r }, r.id) : r.type === x.Textbox ? /* @__PURE__ */ D(os, { ...r }, r.id) : r.type === x.Group ? /* @__PURE__ */ D(Tn, { ...r }, r.id) : null,
|
6149
|
+
const Un = (r) => r.type === x.Image ? /* @__PURE__ */ D(Mn, { ...r }, r.id) : r.type === x.Frame ? /* @__PURE__ */ D(_i, { ...r }, r.id) : r.type === x.Illustration ? /* @__PURE__ */ D(ds, { ...r }, r.id) : r.type === x.Textbox ? /* @__PURE__ */ D(os, { ...r }, r.id) : r.type === x.Group ? /* @__PURE__ */ D(Tn, { ...r }, r.id) : null, ya = (r, t, e) => {
|
6150
6150
|
const a = e.renderingConfiguration, n = a?.removeExcludedElements ? t.filter((i) => !i.excludeFromExport) : t;
|
6151
6151
|
return /* @__PURE__ */ D(
|
6152
6152
|
Ki,
|
@@ -6177,7 +6177,7 @@ const Un = (r) => r.type === x.Image ? /* @__PURE__ */ D(Mn, { ...r }, r.id) : r
|
|
6177
6177
|
}
|
6178
6178
|
);
|
6179
6179
|
};
|
6180
|
-
function
|
6180
|
+
function Sa(r) {
|
6181
6181
|
return r.sort((t, e) => {
|
6182
6182
|
const a = t.layer || 0, n = e.layer || 0;
|
6183
6183
|
if (a < n) return -1;
|
@@ -6194,13 +6194,13 @@ const ne = (r) => {
|
|
6194
6194
|
if (r.defaultVariant !== void 0)
|
6195
6195
|
return t.find((e) => e.id === r.defaultVariant);
|
6196
6196
|
}
|
6197
|
-
},
|
6197
|
+
}, ut = /* @__PURE__ */ new Map(), Vt = /* @__PURE__ */ new Map(), We = /* @__PURE__ */ new Map(), Ln = async (r, t) => {
|
6198
6198
|
if (!t) {
|
6199
6199
|
if (!r) throw new Error("No region or src supplied. Cannot construct frame!");
|
6200
|
-
return
|
6200
|
+
return oa(r);
|
6201
6201
|
}
|
6202
6202
|
return nt(t);
|
6203
|
-
},
|
6203
|
+
}, oa = (r) => {
|
6204
6204
|
const t = r.width, e = r.height;
|
6205
6205
|
return `<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 ${t} ${e}'>
|
6206
6206
|
<path id="target-path" d='M0 0 h ${t} v ${e} h ${-t} Z' />
|
@@ -6215,14 +6215,14 @@ const ne = (r) => {
|
|
6215
6215
|
if (!e.asset)
|
6216
6216
|
throw new Error(`No asset for variant with ID: ${r.frameVariantId}`);
|
6217
6217
|
return e;
|
6218
|
-
},
|
6219
|
-
if (
|
6220
|
-
return
|
6218
|
+
}, Oe = async (r) => {
|
6219
|
+
if (We.has(r))
|
6220
|
+
return We.get(r);
|
6221
6221
|
const e = (async () => {
|
6222
6222
|
if (Vt.has(r))
|
6223
6223
|
return Vt.get(r);
|
6224
6224
|
await new Promise((u) => setTimeout(u, 0));
|
6225
|
-
const n =
|
6225
|
+
const n = dt().parseFromString(r, "image/svg+xml"), i = n.querySelector("svg");
|
6226
6226
|
if (!i)
|
6227
6227
|
throw new Error("Malformed frame SVG: <svg> tag not found");
|
6228
6228
|
const s = i.getAttribute("viewBox");
|
@@ -6253,8 +6253,8 @@ const ne = (r) => {
|
|
6253
6253
|
}
|
6254
6254
|
throw new Error("Malformed frame SVG");
|
6255
6255
|
})();
|
6256
|
-
return
|
6257
|
-
},
|
6256
|
+
return We.set(r, e), e;
|
6257
|
+
}, va = (r, t, e, a) => {
|
6258
6258
|
const n = t.width / t.height, i = r.width / r.height;
|
6259
6259
|
let s;
|
6260
6260
|
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);
|
@@ -6264,9 +6264,9 @@ const ne = (r) => {
|
|
6264
6264
|
y: u,
|
6265
6265
|
zoom: s
|
6266
6266
|
};
|
6267
|
-
},
|
6268
|
-
if (
|
6269
|
-
return
|
6267
|
+
}, la = async (r) => {
|
6268
|
+
if (ut.has(r))
|
6269
|
+
return ut.get(r);
|
6270
6270
|
if (r.startsWith("data:image/svg+xml")) {
|
6271
6271
|
const e = yr(r), a = new TextDecoder().decode(e.buffer), n = Vn(a), i = {
|
6272
6272
|
src: r,
|
@@ -6274,33 +6274,33 @@ const ne = (r) => {
|
|
6274
6274
|
height: n.height,
|
6275
6275
|
aspect: n.width / n.height
|
6276
6276
|
};
|
6277
|
-
return
|
6277
|
+
return ut.set(r, i), i;
|
6278
6278
|
}
|
6279
6279
|
if ((r.split(".").pop()?.toLowerCase() ?? "") === "svg") {
|
6280
|
-
const e = await
|
6280
|
+
const e = await Ea(r), a = e.width, n = e.height, i = {
|
6281
6281
|
src: r,
|
6282
6282
|
width: a,
|
6283
6283
|
height: n,
|
6284
6284
|
aspect: a / n
|
6285
6285
|
};
|
6286
|
-
return
|
6286
|
+
return ut.set(r, i), i;
|
6287
6287
|
} else {
|
6288
|
-
const e = await
|
6288
|
+
const e = await Me(r, !0), a = await Ne(e), n = {
|
6289
6289
|
src: r,
|
6290
6290
|
width: a.width,
|
6291
6291
|
height: a.height,
|
6292
6292
|
aspect: a.width / a.height
|
6293
6293
|
};
|
6294
|
-
return
|
6294
|
+
return ut.set(r, n), n;
|
6295
6295
|
}
|
6296
|
-
},
|
6296
|
+
}, Ea = async (r) => {
|
6297
6297
|
const t = await nt(r);
|
6298
6298
|
return Vn(t);
|
6299
|
-
},
|
6300
|
-
const a =
|
6299
|
+
}, Va = (r) => r.endsWith("mm") ? Number(r.replace("mm", "")) * 3.7795275591 : r.endsWith("px") ? Number(r.replace("px", "")) : Number(r), Vn = (r) => {
|
6300
|
+
const a = dt().parseFromString(r, "image/svg+xml").querySelector("svg");
|
6301
6301
|
if (!a)
|
6302
6302
|
throw new Error("No svg tag found, this svg must be malformed!");
|
6303
|
-
const n = a.getAttribute("viewBox"), i = a.getAttribute("width"), s = a.getAttribute("height"), o = s && i ? [0, 0,
|
6303
|
+
const n = a.getAttribute("viewBox"), i = a.getAttribute("width"), s = a.getAttribute("height"), o = s && i ? [0, 0, Va(i), Va(s)] : n?.split(" ").map((l) => Number(l));
|
6304
6304
|
if (!o)
|
6305
6305
|
throw new Error("No viewbox or width/height values detected on SVG file!");
|
6306
6306
|
return {
|
@@ -6314,9 +6314,9 @@ const ne = (r) => {
|
|
6314
6314
|
nt(r).then((e) => {
|
6315
6315
|
t(e);
|
6316
6316
|
}).catch((e) => console.error(e));
|
6317
|
-
}),
|
6318
|
-
if (
|
6319
|
-
return
|
6317
|
+
}), qe = /* @__PURE__ */ new Map(), _t = async (r) => {
|
6318
|
+
if (qe.has(r))
|
6319
|
+
return qe.get(r);
|
6320
6320
|
const t = async (n) => new Promise((i, s) => {
|
6321
6321
|
try {
|
6322
6322
|
if (!(!!URL && !!URL.createObjectURL)) throw new Error("Environment incapable of generating ObjectURL");
|
@@ -6329,15 +6329,15 @@ const ne = (r) => {
|
|
6329
6329
|
s(o);
|
6330
6330
|
}
|
6331
6331
|
}), a = (async () => {
|
6332
|
-
const s =
|
6332
|
+
const s = dt().parseFromString(r, "image/svg+xml").firstElementChild;
|
6333
6333
|
if (!s)
|
6334
6334
|
throw new Error("Failed to read SVG");
|
6335
|
-
const l = It().serializeToString(s), c =
|
6335
|
+
const l = It().serializeToString(s), c = pt(), d = c.getContext("2d"), A = await Aa.from(d, l, {
|
6336
6336
|
anonymousCrossOrigin: !0,
|
6337
6337
|
ignoreDimensions: !1,
|
6338
|
-
createCanvas:
|
6338
|
+
createCanvas: pt,
|
6339
6339
|
createImage: te,
|
6340
|
-
DOMParser:
|
6340
|
+
DOMParser: ga(),
|
6341
6341
|
fetch: rt
|
6342
6342
|
}), u = s.getAttribute("width"), h = s.getAttribute("height"), m = 2048;
|
6343
6343
|
if (h && u) {
|
@@ -6347,7 +6347,7 @@ const ne = (r) => {
|
|
6347
6347
|
A.resize(m, m);
|
6348
6348
|
return await A.render(), await t(c);
|
6349
6349
|
})();
|
6350
|
-
return
|
6350
|
+
return qe.set(r, a), a;
|
6351
6351
|
}, Ut = async (r, t, e, a) => {
|
6352
6352
|
const n = r.layoutState.layout.useEditableArea && r.layoutState.layout.editableArea || {
|
6353
6353
|
width: r.layoutState.layout.width,
|
@@ -6363,25 +6363,25 @@ const ne = (r) => {
|
|
6363
6363
|
panelId: r.layoutState.layout.panelId
|
6364
6364
|
};
|
6365
6365
|
if (e && t === x.Illustration) {
|
6366
|
-
const l = await ot(await zn(e)), u =
|
6366
|
+
const l = await ot(await zn(e)), u = dt().parseFromString(l.svg, "image/svg+xml").firstElementChild.getAttribute("viewBox");
|
6367
6367
|
if (!u) throw new Error("SVG missing viewBox.");
|
6368
6368
|
const h = o.height, m = u.split(" "), g = parseFloat(m[2]) || 1, p = parseFloat(m[3]) || 1, f = g / p;
|
6369
6369
|
o.height = o.width / f, o.top += (h - o.height) / 2;
|
6370
6370
|
}
|
6371
6371
|
if (e && t === x.Image) {
|
6372
|
-
const l = o.height, c = await
|
6372
|
+
const l = o.height, c = await Me(e), d = await Ne(c), A = d.width / d.height;
|
6373
6373
|
o.height = o.width / A, o.top += (l - o.height) / 2;
|
6374
6374
|
}
|
6375
6375
|
if (e && t === x.Textbox && a?.text && a?.fontScale) {
|
6376
6376
|
await Nt(e);
|
6377
|
-
const l =
|
6377
|
+
const l = Ct(e), c = mt(a.text, a?.fontScale, l);
|
6378
6378
|
o.width = Math.min(c, n.width * 0.85), o.left = n.x + n.width / 2 - o.width / 2;
|
6379
6379
|
}
|
6380
6380
|
return o;
|
6381
6381
|
};
|
6382
6382
|
class td {
|
6383
6383
|
static async getFrame(t, e) {
|
6384
|
-
const a = await Ln(e.region, e.src), n = await
|
6384
|
+
const a = await Ln(e.region, e.src), n = await Oe(a), i = e.region || await Ut(t, x.Frame);
|
6385
6385
|
return {
|
6386
6386
|
id: M(),
|
6387
6387
|
x: i.left,
|
@@ -6427,7 +6427,7 @@ class td {
|
|
6427
6427
|
const { configuration: a, fontSrc: n, designInputStep: i } = e, s = await Nt(n), o = {
|
6428
6428
|
assetUrl: n,
|
6429
6429
|
name: s.names.fullName.en
|
6430
|
-
}, l = i?.text || a.defaultText || "", c = a.replaceableText ? a.replaceableText.replace("{{}}", l) : l, d =
|
6430
|
+
}, l = i?.text || a.defaultText || "", c = a.replaceableText ? a.replaceableText.replace("{{}}", l) : l, d = Ie(c, {
|
6431
6431
|
vertical: a.vertical,
|
6432
6432
|
uppercase: a.uppercase
|
6433
6433
|
}), A = e.region || await Ut(t, x.Textbox, n, {
|
@@ -6545,13 +6545,13 @@ const $ = (r, t) => _(r, t).elements.find((n) => n.id === r), _ = (r, t) => {
|
|
6545
6545
|
throw new L();
|
6546
6546
|
return e;
|
6547
6547
|
}, X = (r, t) => {
|
6548
|
-
const e = [...t.elements.filter((n) => n.id !== r.id), r], a =
|
6548
|
+
const e = [...t.elements.filter((n) => n.id !== r.id), r], a = Sa(e);
|
6549
6549
|
return {
|
6550
6550
|
layout: t.layout,
|
6551
6551
|
elements: a,
|
6552
6552
|
modificationID: M()
|
6553
6553
|
};
|
6554
|
-
},
|
6554
|
+
}, za = async (r) => {
|
6555
6555
|
const t = [...Object.keys(r.layouts)], e = [...new Set(t)];
|
6556
6556
|
for (let a = 0; a < e.length; a++) {
|
6557
6557
|
const n = e[a], i = r.layouts[n];
|
@@ -6561,7 +6561,7 @@ const $ = (r, t) => _(r, t).elements.find((n) => n.id === r), _ = (r, t) => {
|
|
6561
6561
|
const o = s;
|
6562
6562
|
if (o.src && !o.svg) {
|
6563
6563
|
const l = await nt(o.src), c = await ot(l);
|
6564
|
-
o.svg =
|
6564
|
+
o.svg = fa(
|
6565
6565
|
c.svg,
|
6566
6566
|
o.width,
|
6567
6567
|
o.height,
|
@@ -6611,7 +6611,7 @@ class N {
|
|
6611
6611
|
this.oldState = t;
|
6612
6612
|
}
|
6613
6613
|
}
|
6614
|
-
class
|
6614
|
+
class Ga extends N {
|
6615
6615
|
constructor(t) {
|
6616
6616
|
super(), this.serializableWorkflow = t;
|
6617
6617
|
}
|
@@ -6829,7 +6829,7 @@ class hs extends N {
|
|
6829
6829
|
};
|
6830
6830
|
}
|
6831
6831
|
}
|
6832
|
-
class
|
6832
|
+
class je extends N {
|
6833
6833
|
constructor(t, e) {
|
6834
6834
|
super(), this.id = t, this.imageFill = e;
|
6835
6835
|
}
|
@@ -6873,7 +6873,7 @@ class ms extends N {
|
|
6873
6873
|
};
|
6874
6874
|
}
|
6875
6875
|
}
|
6876
|
-
class
|
6876
|
+
class Wa extends N {
|
6877
6877
|
constructor(t, e) {
|
6878
6878
|
super(), this.id = t, this.fontData = e;
|
6879
6879
|
}
|
@@ -7019,7 +7019,7 @@ class Cs extends N {
|
|
7019
7019
|
};
|
7020
7020
|
}
|
7021
7021
|
}
|
7022
|
-
class
|
7022
|
+
class He extends N {
|
7023
7023
|
constructor(t, e, a) {
|
7024
7024
|
super(), this.id = t, this.strokeColor = e, this.strokeThickness = a;
|
7025
7025
|
}
|
@@ -7042,7 +7042,7 @@ class Ye extends N {
|
|
7042
7042
|
};
|
7043
7043
|
}
|
7044
7044
|
}
|
7045
|
-
class
|
7045
|
+
class ca extends N {
|
7046
7046
|
constructor(t, e, a) {
|
7047
7047
|
super(), this.id = t, this.className = e, this.fill = a;
|
7048
7048
|
}
|
@@ -7211,7 +7211,7 @@ class ld extends N {
|
|
7211
7211
|
};
|
7212
7212
|
}
|
7213
7213
|
}
|
7214
|
-
class
|
7214
|
+
class qa {
|
7215
7215
|
constructor(t, e, a) {
|
7216
7216
|
this.processRegion = async (n) => {
|
7217
7217
|
const i = this.layouts.find((l) => l.panelId === n.panelId);
|
@@ -7221,7 +7221,7 @@ class ja {
|
|
7221
7221
|
if (this.configuration.type === v.ProductOverlay) {
|
7222
7222
|
let l = "";
|
7223
7223
|
if (this.product?.overlayImageUrl && (l = this.product.overlayImageUrl), s = l, !l)
|
7224
|
-
throw new
|
7224
|
+
throw new Ee(this.configuration, "Couldn't find an asset for product overlay step");
|
7225
7225
|
}
|
7226
7226
|
const o = this.evaluateAssetType();
|
7227
7227
|
if (o === x.Image) {
|
@@ -7292,7 +7292,7 @@ class ja {
|
|
7292
7292
|
}
|
7293
7293
|
async trigger() {
|
7294
7294
|
if (!this.configuration.data.regions)
|
7295
|
-
throw new
|
7295
|
+
throw new Ee(this.configuration, "Missing regions.");
|
7296
7296
|
if (this.configuration.type === v.SilentIllustration) {
|
7297
7297
|
const t = this.configuration.data.regions.map(this.processRegion);
|
7298
7298
|
return Promise.all(t);
|
@@ -7310,7 +7310,7 @@ class ja {
|
|
7310
7310
|
}
|
7311
7311
|
}
|
7312
7312
|
const ys = async (r) => {
|
7313
|
-
const t = `${
|
7313
|
+
const t = `${gt.getServicesApiUrl()}/shortener`;
|
7314
7314
|
try {
|
7315
7315
|
return (await (await rt(t, {
|
7316
7316
|
method: "POST",
|
@@ -7320,7 +7320,7 @@ const ys = async (r) => {
|
|
7320
7320
|
}
|
7321
7321
|
})).json()).shortUrl;
|
7322
7322
|
} catch (e) {
|
7323
|
-
throw console.error(e), new
|
7323
|
+
throw console.error(e), new ke("Failed to shorten URL, see console.");
|
7324
7324
|
}
|
7325
7325
|
};
|
7326
7326
|
class Wn {
|
@@ -7365,7 +7365,7 @@ class Ss {
|
|
7365
7365
|
}
|
7366
7366
|
async regenerateQRCode(t, e, a, n) {
|
7367
7367
|
const i = async () => {
|
7368
|
-
const h = (await
|
7368
|
+
const h = (await be([e]))[0], m = h?.versions?.find((g) => g.name === "mpeg4")?.link;
|
7369
7369
|
return { asset: h, link: m };
|
7370
7370
|
}, s = await new Promise((h, m) => {
|
7371
7371
|
new Wn(
|
@@ -7391,10 +7391,10 @@ class Ss {
|
|
7391
7391
|
l.searchParams.append("video", btoa(JSON.stringify([s]))), l.pathname = l.pathname + (l.pathname.slice(-1) === "/" ? "" : "/");
|
7392
7392
|
const c = l.toString();
|
7393
7393
|
if (c.length >= 2e3)
|
7394
|
-
throw new
|
7394
|
+
throw new ke("Cannot create QR code, URL too long.");
|
7395
7395
|
const d = await ys(c);
|
7396
7396
|
if (!n.data || !n.data.regions)
|
7397
|
-
throw new
|
7397
|
+
throw new Ee(n, "Missing regions.");
|
7398
7398
|
const A = await this.regionElements(n), u = await this.command(d, A, a, n.stepName);
|
7399
7399
|
return u && (u.command && a.getCommandDispatcher()(u.command), u.followup && await u.followup()), await a.setSelectionsAndElements(n.stepName, [], A, async () => {
|
7400
7400
|
a.updateStorage(n.stepName, {
|
@@ -7408,7 +7408,7 @@ class Ss {
|
|
7408
7408
|
return t.data.regions.map(e);
|
7409
7409
|
}
|
7410
7410
|
async command(t, e, a, n) {
|
7411
|
-
const i = a.getLayouts(), o = `data:image/svg+xml;base64,${btoa(await
|
7411
|
+
const i = a.getLayouts(), o = `data:image/svg+xml;base64,${btoa(await ln(t, { type: "svg" }))}`, l = e.map((c) => {
|
7412
7412
|
const d = c.region, A = i.find((u) => u.panelId === d?.panelId);
|
7413
7413
|
if (!A && d)
|
7414
7414
|
throw new Y(d);
|
@@ -7437,11 +7437,11 @@ class Ss {
|
|
7437
7437
|
}
|
7438
7438
|
}
|
7439
7439
|
const qn = new Ss();
|
7440
|
-
class
|
7440
|
+
class Pe {
|
7441
7441
|
constructor() {
|
7442
7442
|
this.frameSourceSvg = async (t, e) => {
|
7443
7443
|
if (!t)
|
7444
|
-
return
|
7444
|
+
return oa(e);
|
7445
7445
|
const a = t.asset;
|
7446
7446
|
if (!a)
|
7447
7447
|
throw new bt(t);
|
@@ -7490,7 +7490,7 @@ class De {
|
|
7490
7490
|
a.serializableWorkflow.steps
|
7491
7491
|
), l = Object.values(a.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === t.stepName).map((c) => ({ id: c.id, region: c.stepRegion }));
|
7492
7492
|
if (!t.option || (t.option.variants || []).length === 0) {
|
7493
|
-
const c = t.data.regions.map((d) =>
|
7493
|
+
const c = t.data.regions.map((d) => oa(d));
|
7494
7494
|
e.updateStorage(t.stepName, {
|
7495
7495
|
currentFrameSources: c
|
7496
7496
|
});
|
@@ -7544,7 +7544,7 @@ class De {
|
|
7544
7544
|
})) ?? [];
|
7545
7545
|
}
|
7546
7546
|
selectImage(t, e, a, n = !0) {
|
7547
|
-
const i =
|
7547
|
+
const i = Pe.patternSource(e), s = a.getStepStorage(t.stepName)?.framePatternSrc;
|
7548
7548
|
if (s && s === i)
|
7549
7549
|
return Promise.resolve();
|
7550
7550
|
a.setEditedStatus(t.stepName, !0);
|
@@ -7564,7 +7564,7 @@ class De {
|
|
7564
7564
|
});
|
7565
7565
|
},
|
7566
7566
|
() => {
|
7567
|
-
throw new
|
7567
|
+
throw new ke("Failed to resolve transcoded PDF");
|
7568
7568
|
}
|
7569
7569
|
)
|
7570
7570
|
);
|
@@ -7608,7 +7608,7 @@ class De {
|
|
7608
7608
|
}
|
7609
7609
|
async loadPatternFromString(t, e, a = !0, n = void 0, i) {
|
7610
7610
|
if (t.endsWith("svg")) {
|
7611
|
-
const s = await
|
7611
|
+
const s = await Ea(t), o = s.width, l = s.height, c = await nt(t);
|
7612
7612
|
if (i) {
|
7613
7613
|
const u = c.match(/<(image|linearGradient|radialGradient)(\s|>|\/>)/gim);
|
7614
7614
|
if (u && u.length > 0)
|
@@ -7624,9 +7624,9 @@ class De {
|
|
7624
7624
|
svg: d.svg,
|
7625
7625
|
colors: n ?? d.colors
|
7626
7626
|
};
|
7627
|
-
|
7627
|
+
ut.set(t, A), e.setPatternData(A, a);
|
7628
7628
|
} else {
|
7629
|
-
const s = await
|
7629
|
+
const s = await Me(t, !0), o = await Ne(s), l = {
|
7630
7630
|
src: t,
|
7631
7631
|
width: o.width,
|
7632
7632
|
height: o.height,
|
@@ -7634,7 +7634,7 @@ class De {
|
|
7634
7634
|
svg: void 0,
|
7635
7635
|
colors: void 0
|
7636
7636
|
};
|
7637
|
-
|
7637
|
+
ut.set(t, l), e.setPatternData(l, a);
|
7638
7638
|
}
|
7639
7639
|
}
|
7640
7640
|
changeColors(t, e, a) {
|
@@ -7711,7 +7711,7 @@ class De {
|
|
7711
7711
|
i && i(!0);
|
7712
7712
|
const c = t.data.initialZoomLevel, d = await Promise.all(
|
7713
7713
|
t.data.regions.map(async (h, m) => {
|
7714
|
-
const g = await
|
7714
|
+
const g = await Oe(l[m]), p = o.getImageData(), f = a.map((P) => new Bt(P.id)), S = p ? va(
|
7715
7715
|
p,
|
7716
7716
|
g,
|
7717
7717
|
c && !t.data.forceImageCover ? { scale: c } : void 0,
|
@@ -7775,7 +7775,7 @@ class De {
|
|
7775
7775
|
throw new Yt(t);
|
7776
7776
|
}
|
7777
7777
|
async loadPatternFromAsset(t, e, a, n) {
|
7778
|
-
const i =
|
7778
|
+
const i = Pe.patternSource(t), s = a.markUpdatePending(), o = a.getWorkflowExperience().getStepById(e.stepName)?.frameService;
|
7779
7779
|
if (!o)
|
7780
7780
|
throw a.markUpdateCompleted(s), new Error("Frame service unavailable, cannot load pattern!");
|
7781
7781
|
try {
|
@@ -7802,7 +7802,7 @@ class De {
|
|
7802
7802
|
), this.validateColorCount(e, a);
|
7803
7803
|
}
|
7804
7804
|
}
|
7805
|
-
const
|
7805
|
+
const St = new Pe();
|
7806
7806
|
class vs {
|
7807
7807
|
async getIllustrationBody(t) {
|
7808
7808
|
return new Promise((e) => {
|
@@ -7907,10 +7907,10 @@ class vs {
|
|
7907
7907
|
spotColor: A.spotColor,
|
7908
7908
|
pmsValue: A.pmsValue
|
7909
7909
|
};
|
7910
|
-
const o =
|
7910
|
+
const o = fa(t, e, a, s), l = await _t(o), c = [];
|
7911
7911
|
for (const d of n) {
|
7912
7912
|
for (const [A, u] of i.entries())
|
7913
|
-
c.push(new
|
7913
|
+
c.push(new ca(d, A, u));
|
7914
7914
|
c.push(new ws(d, o, l));
|
7915
7915
|
}
|
7916
7916
|
return new R(c);
|
@@ -7957,7 +7957,7 @@ class vs {
|
|
7957
7957
|
}
|
7958
7958
|
async selectVariantCommand(t, e, a, n, i) {
|
7959
7959
|
if (!t.data || !t.data.regions)
|
7960
|
-
throw new
|
7960
|
+
throw new Ee(t, "Missing regions.");
|
7961
7961
|
n(!0);
|
7962
7962
|
const s = a.map((f) => new Bt(f.id));
|
7963
7963
|
t.mandatory && i.setMandatoryFulfilled(t.stepName, !1);
|
@@ -8040,7 +8040,7 @@ class Es {
|
|
8040
8040
|
async init(t, e, a) {
|
8041
8041
|
const n = t.option;
|
8042
8042
|
if (!n)
|
8043
|
-
throw new
|
8043
|
+
throw new ve(t);
|
8044
8044
|
if (a)
|
8045
8045
|
await this.reload(t, e, a);
|
8046
8046
|
else {
|
@@ -8056,7 +8056,7 @@ class Es {
|
|
8056
8056
|
t.stepName,
|
8057
8057
|
a.serializableWorkflow.steps
|
8058
8058
|
), o = Object.values(a.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === t.stepName), l = t.option;
|
8059
|
-
if (!l) throw new
|
8059
|
+
if (!l) throw new ve(t);
|
8060
8060
|
if (n?.selectedVariants) {
|
8061
8061
|
const c = n.selectedVariants[0].id;
|
8062
8062
|
if (c) {
|
@@ -8115,7 +8115,7 @@ const jn = new Es();
|
|
8115
8115
|
class bs {
|
8116
8116
|
async init(t, e, a) {
|
8117
8117
|
const n = t.option;
|
8118
|
-
if (!n) throw new
|
8118
|
+
if (!n) throw new ve(t);
|
8119
8119
|
if (a)
|
8120
8120
|
await this.reload(t, e, a);
|
8121
8121
|
else {
|
@@ -8293,7 +8293,7 @@ class Bs {
|
|
8293
8293
|
}
|
8294
8294
|
if (!/^$|^[a-zA-Z0-9 ]+$/.test(e))
|
8295
8295
|
return n("Unsupported characters."), { input: e, helperData: {}, errorData: { unsupportedCharacters: !0 } };
|
8296
|
-
const i =
|
8296
|
+
const i = ea(e.toLowerCase());
|
8297
8297
|
for (const s of i)
|
8298
8298
|
for (const o in a) {
|
8299
8299
|
const l = a[o].toLowerCase().replace(/\s/g, "");
|
@@ -8467,14 +8467,14 @@ class Ds {
|
|
8467
8467
|
const n = a.getLayouts(), s = (a.getRegionElements(e.stepName) || []).map((o) => {
|
8468
8468
|
const l = o.region;
|
8469
8469
|
if (!n.find((d) => d.panelId === l?.panelId)) throw new Y(l);
|
8470
|
-
return new
|
8470
|
+
return new ca(o.id, this.shapeFillId, t);
|
8471
8471
|
}).filter((o) => !!o);
|
8472
8472
|
a.getCommandDispatcher()(new R(s)), a.updateStorage(e.stepName, { colour: t });
|
8473
8473
|
}
|
8474
8474
|
async init(t, e, a) {
|
8475
8475
|
const n = t.option;
|
8476
8476
|
if (!n)
|
8477
|
-
throw new
|
8477
|
+
throw new ve(t);
|
8478
8478
|
if (a)
|
8479
8479
|
await this.reload(t, e, a);
|
8480
8480
|
else {
|
@@ -8533,7 +8533,7 @@ class Ds {
|
|
8533
8533
|
if (!i.find((m) => m.panelId === A?.panelId))
|
8534
8534
|
throw new Y(A);
|
8535
8535
|
const h = o();
|
8536
|
-
return new
|
8536
|
+
return new ca(d.id, this.shapeFillId, h);
|
8537
8537
|
}, c = a.map(l).filter((d) => !!d);
|
8538
8538
|
return {
|
8539
8539
|
command: new R(c),
|
@@ -8640,11 +8640,11 @@ class Fs {
|
|
8640
8640
|
);
|
8641
8641
|
}
|
8642
8642
|
}
|
8643
|
-
const xs = new Fs(),
|
8643
|
+
const xs = new Fs(), Ye = (r, t, e, a, n) => {
|
8644
8644
|
if (t.some((d) => d == null))
|
8645
8645
|
throw new Error(`Failed to autosize lines: ${t.join(", ")}`);
|
8646
8646
|
let i = t.map((d) => d.split(`
|
8647
|
-
`)).flat(), s = i.length, o = i.map((d) =>
|
8647
|
+
`)).flat(), s = i.length, o = i.map((d) => mt(d, a, n));
|
8648
8648
|
const l = n.getApproximateHeight() * a;
|
8649
8649
|
let c = !0;
|
8650
8650
|
for (; c; ) {
|
@@ -8657,7 +8657,7 @@ const xs = new Fs(), Je = (r, t, e, a, n) => {
|
|
8657
8657
|
let m = !1, g = h.length;
|
8658
8658
|
for (; !m && g > -1; ) {
|
8659
8659
|
g = h.lastIndexOf(" ", g - 1);
|
8660
|
-
const p = [h.slice(0, g), h.slice(g + 1)], f = p.map((b) =>
|
8660
|
+
const p = [h.slice(0, g), h.slice(g + 1)], f = p.map((b) => mt(b, a, n));
|
8661
8661
|
f[0] <= r.width && (i = [...i.slice(0, u), ...p, ...i.slice(u + 1)], o = [
|
8662
8662
|
...o.slice(0, u),
|
8663
8663
|
...f,
|
@@ -8669,32 +8669,32 @@ const xs = new Fs(), Je = (r, t, e, a, n) => {
|
|
8669
8669
|
return [null, null];
|
8670
8670
|
}, fe = (r, t, e, a, n) => {
|
8671
8671
|
let i, s;
|
8672
|
-
const o =
|
8672
|
+
const o = Ct(t.assetUrl), l = o.getFont();
|
8673
8673
|
if (n.size) {
|
8674
8674
|
const u = r / l.unitsPerEm;
|
8675
|
-
return [i, s] =
|
8675
|
+
return [i, s] = Ye(e, a, r, u, o), [n.size, i, s];
|
8676
8676
|
}
|
8677
8677
|
const c = 6;
|
8678
|
-
let d = c -
|
8678
|
+
let d = c - Ge;
|
8679
8679
|
if (a.length > 0) {
|
8680
8680
|
let u = a, h = 0;
|
8681
8681
|
for (; (!n.maxSize || d <= n.maxSize) && u; )
|
8682
|
-
d +=
|
8682
|
+
d += Ge, h = d / l.unitsPerEm, [u, s] = Ye(e, a, d, h, o);
|
8683
8683
|
}
|
8684
|
-
d > c && (d -=
|
8684
|
+
d > c && (d -= Ge), n.minSize && d < n.minSize && (d = n.minSize);
|
8685
8685
|
const A = d / l.unitsPerEm;
|
8686
|
-
return [i, s] =
|
8687
|
-
},
|
8688
|
-
class
|
8686
|
+
return [i, s] = Ye(e, a, d, A, o), [d, i, s];
|
8687
|
+
}, Je = 30;
|
8688
|
+
class De extends Error {
|
8689
8689
|
constructor(t) {
|
8690
|
-
super(t), Object.setPrototypeOf(this, new.target.prototype), this.name =
|
8690
|
+
super(t), Object.setPrototypeOf(this, new.target.prototype), this.name = De.name;
|
8691
8691
|
}
|
8692
8692
|
}
|
8693
8693
|
const ks = ["‘", "’", "“", "”", `
|
8694
8694
|
`];
|
8695
|
-
class
|
8695
|
+
class Fe extends Error {
|
8696
8696
|
constructor(t) {
|
8697
|
-
super(t), Object.setPrototypeOf(this, new.target.prototype), this.name =
|
8697
|
+
super(t), Object.setPrototypeOf(this, new.target.prototype), this.name = Fe.name;
|
8698
8698
|
}
|
8699
8699
|
}
|
8700
8700
|
class Ms {
|
@@ -8704,7 +8704,7 @@ class Ms {
|
|
8704
8704
|
/(\r\n|\r|(\u2665|\u00a9|\u00ae|[\u2000-\u2017]|[\u201E-\u3300]]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]))/gm,
|
8705
8705
|
""
|
8706
8706
|
);
|
8707
|
-
const n = [], i = e ?
|
8707
|
+
const n = [], i = e ? Ct(e.assetUrl) : void 0;
|
8708
8708
|
if (i) {
|
8709
8709
|
const s = a.split("").filter((l) => !ks.includes(l)).join(""), o = s.split("").map((l) => i.getFont().charToGlyph(l));
|
8710
8710
|
for (let l = 0; l < o.length; l++)
|
@@ -8716,7 +8716,7 @@ class Ms {
|
|
8716
8716
|
}, this.textAlign = (t) => t.vertical ? "center" : t.textAlign || "center", this.getErrorsForText = (t, e, a, n) => {
|
8717
8717
|
let i;
|
8718
8718
|
a.data && a.data.maxLength && e.length > a.data.maxLength && (i || (i = {}), i.hitCharacterLimit = !0);
|
8719
|
-
const s = n.getProfanities(), o =
|
8719
|
+
const s = n.getProfanities(), o = ea(t.toLowerCase());
|
8720
8720
|
for (const c of o)
|
8721
8721
|
for (const d in s) {
|
8722
8722
|
const A = s[d].toLowerCase().replace(/\s/g, "");
|
@@ -8736,7 +8736,7 @@ class Ms {
|
|
8736
8736
|
if (a)
|
8737
8737
|
await this.reload(t, e, a);
|
8738
8738
|
else {
|
8739
|
-
const i = this.getDefaultImageFillVariant(t.data), s = i?.asset?.fileLink, o = s ? await
|
8739
|
+
const i = this.getDefaultImageFillVariant(t.data), s = i?.asset?.fileLink, o = s ? await la(s) : void 0, l = o ? {
|
8740
8740
|
src: o.src,
|
8741
8741
|
height: o.height,
|
8742
8742
|
width: o.width,
|
@@ -8843,7 +8843,7 @@ class Ms {
|
|
8843
8843
|
const a = e.variants?.map((n) => n.asset?.fileLink)?.filter((n) => !!n) || [];
|
8844
8844
|
return Promise.all(
|
8845
8845
|
a.map(async (n) => {
|
8846
|
-
const i = await
|
8846
|
+
const i = await la(n);
|
8847
8847
|
return {
|
8848
8848
|
src: n,
|
8849
8849
|
width: i.width,
|
@@ -8863,7 +8863,7 @@ class Ms {
|
|
8863
8863
|
fillImage: e
|
8864
8864
|
});
|
8865
8865
|
for (const o of a) {
|
8866
|
-
const l = new
|
8866
|
+
const l = new je(o.id, e);
|
8867
8867
|
i(l);
|
8868
8868
|
}
|
8869
8869
|
}
|
@@ -8900,13 +8900,13 @@ class Ms {
|
|
8900
8900
|
strokeColor: s
|
8901
8901
|
});
|
8902
8902
|
for (const o of a) {
|
8903
|
-
const l = new
|
8903
|
+
const l = new He(o.id, s, t.data?.strokeThickness);
|
8904
8904
|
i(l);
|
8905
8905
|
}
|
8906
8906
|
}
|
8907
8907
|
getProcessedInput(t, e, a) {
|
8908
8908
|
const n = a ? t : this.injectReplaceableText(t, e);
|
8909
|
-
return
|
8909
|
+
return Ie(n, {
|
8910
8910
|
vertical: e.vertical,
|
8911
8911
|
uppercase: e.uppercase
|
8912
8912
|
});
|
@@ -8990,7 +8990,7 @@ class Ms {
|
|
8990
8990
|
u,
|
8991
8991
|
async () => {
|
8992
8992
|
e.updateMetadata(t.stepName, { color: h, text: m }), e.updateStorage(t.stepName, { text: m, inputText: m });
|
8993
|
-
const p = o.map((S) => new
|
8993
|
+
const p = o.map((S) => new Wa(S.id, A)), f = new R(p);
|
8994
8994
|
e.getCommandDispatcher()(f);
|
8995
8995
|
}
|
8996
8996
|
), o.length === 0 && l) {
|
@@ -9093,20 +9093,20 @@ class Ms {
|
|
9093
9093
|
async selectVariantCommand(t, e, a, n, i, s, o, l, c) {
|
9094
9094
|
const d = i.markUpdatePending(), A = await this.fontDataFromVariant(e);
|
9095
9095
|
if (n.length > 0) {
|
9096
|
-
const u = n.map((g) => new
|
9096
|
+
const u = n.map((g) => new Wa(g.id, A));
|
9097
9097
|
if (l) {
|
9098
|
-
const g = n.map((p) => new
|
9098
|
+
const g = n.map((p) => new je(p.id, l));
|
9099
9099
|
u.push(...g);
|
9100
9100
|
}
|
9101
9101
|
if (c) {
|
9102
9102
|
const g = n.map(
|
9103
|
-
(p) => new
|
9103
|
+
(p) => new He(p.id, c, t.data.strokeThickness)
|
9104
9104
|
);
|
9105
9105
|
u.push(...g);
|
9106
9106
|
}
|
9107
9107
|
const h = await this.changeInputTextWithRegion(
|
9108
9108
|
t,
|
9109
|
-
t.data.size ||
|
9109
|
+
t.data.size || Je,
|
9110
9110
|
A,
|
9111
9111
|
a.text || "",
|
9112
9112
|
a,
|
@@ -9131,7 +9131,7 @@ class Ms {
|
|
9131
9131
|
i
|
9132
9132
|
), h = await this.changeInputTextWithRegion(
|
9133
9133
|
t,
|
9134
|
-
t.data.size ||
|
9134
|
+
t.data.size || Je,
|
9135
9135
|
A,
|
9136
9136
|
u[0]?.newElement.input || a.text || t.data.defaultText || "",
|
9137
9137
|
a,
|
@@ -9142,13 +9142,13 @@ class Ms {
|
|
9142
9142
|
), m = u.flatMap((p) => p.commands);
|
9143
9143
|
if (l) {
|
9144
9144
|
const p = u.map(
|
9145
|
-
(f) => new
|
9145
|
+
(f) => new je(f.regionElement.id, l)
|
9146
9146
|
);
|
9147
9147
|
m.push(...p);
|
9148
9148
|
}
|
9149
9149
|
if (c) {
|
9150
9150
|
const p = n.map(
|
9151
|
-
(f) => new
|
9151
|
+
(f) => new He(f.id, c, t.data.strokeThickness)
|
9152
9152
|
);
|
9153
9153
|
m.push(...p);
|
9154
9154
|
}
|
@@ -9175,7 +9175,7 @@ class Ms {
|
|
9175
9175
|
const m = s.getLayouts().find((p) => p.panelId === u.panelId), g = M();
|
9176
9176
|
try {
|
9177
9177
|
if (!m)
|
9178
|
-
throw new
|
9178
|
+
throw new Fe("Failed to find layout for region: " + u.panelId);
|
9179
9179
|
const p = a.colorOption;
|
9180
9180
|
let f;
|
9181
9181
|
if (p && p.variants) {
|
@@ -9189,7 +9189,7 @@ class Ms {
|
|
9189
9189
|
stepName: t,
|
9190
9190
|
align: this.textAlign(a),
|
9191
9191
|
fill: i.color ? i.color : b,
|
9192
|
-
fontSize: a.size ||
|
9192
|
+
fontSize: a.size || Je,
|
9193
9193
|
fontData: n,
|
9194
9194
|
id: g,
|
9195
9195
|
layer: u.layer,
|
@@ -9238,10 +9238,10 @@ class Ms {
|
|
9238
9238
|
fontData: n
|
9239
9239
|
};
|
9240
9240
|
} catch (p) {
|
9241
|
-
throw console.log(p), new
|
9241
|
+
throw console.log(p), new De("Error adding font to region");
|
9242
9242
|
}
|
9243
9243
|
}, A = await Promise.all(a.regions.map(d)).catch((u) => {
|
9244
|
-
throw u instanceof
|
9244
|
+
throw u instanceof De ? (xs.setLatestToast("Failed to load font.", $e.Error), u) : u instanceof Fe ? u : new Error(u);
|
9245
9245
|
});
|
9246
9246
|
return await s.setSelectionsAndElements(
|
9247
9247
|
t,
|
@@ -9283,7 +9283,7 @@ class Ms {
|
|
9283
9283
|
const S = (() => {
|
9284
9284
|
if (t.data && t.data.maxLength && h.length > t.data.maxLength)
|
9285
9285
|
return d && d(!0), { info: "0" };
|
9286
|
-
const C = s.getProfanities(), E =
|
9286
|
+
const C = s.getProfanities(), E = ea(h.toLowerCase());
|
9287
9287
|
for (const P of E)
|
9288
9288
|
for (const B in C) {
|
9289
9289
|
const F = C[B].toLowerCase().replace(/\s/g, "");
|
@@ -9353,7 +9353,7 @@ function Us(r, t, e, a) {
|
|
9353
9353
|
const n = e / r, i = a / t;
|
9354
9354
|
return n > 1 && i > 1 ? Math.min(n, i) : n > 1 && i < 1 ? i : n < 1 && i > 1 ? n : Math.min(n, i);
|
9355
9355
|
}
|
9356
|
-
const
|
9356
|
+
const ja = {
|
9357
9357
|
m: ["x", "y"],
|
9358
9358
|
z: [],
|
9359
9359
|
l: ["x", "y"],
|
@@ -9383,7 +9383,7 @@ class Ls {
|
|
9383
9383
|
const n = (i) => {
|
9384
9384
|
const s = [], o = i.relative ? i.type : i.type.toUpperCase();
|
9385
9385
|
let l = e !== o;
|
9386
|
-
const c =
|
9386
|
+
const c = ja[i.type];
|
9387
9387
|
l && (s.push(o), e = o);
|
9388
9388
|
for (const d of c) {
|
9389
9389
|
const A = i[d];
|
@@ -9408,7 +9408,7 @@ class Ls {
|
|
9408
9408
|
const e = /([mzlhvcsqta])([^mzlhvcsqta]*)/gi, a = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi, n = [];
|
9409
9409
|
let i;
|
9410
9410
|
for (e.lastIndex = 0; i = e.exec(t); ) {
|
9411
|
-
const s = i[1].toLowerCase(), o = (i[2].match(a) || []).map(parseFloat), l = s === i[1], c =
|
9411
|
+
const s = i[1].toLowerCase(), o = (i[2].match(a) || []).map(parseFloat), l = s === i[1], c = ja[s];
|
9412
9412
|
if (o.length < c.length)
|
9413
9413
|
throw new Dt(
|
9414
9414
|
`Path type "${s}" given ${o.length} arguments, expected ${c.length}.`
|
@@ -9570,7 +9570,7 @@ const re = w`
|
|
9570
9570
|
bundleId: r
|
9571
9571
|
}
|
9572
9572
|
})).data.globalPropertyState, qs = (r) => w`
|
9573
|
-
${
|
9573
|
+
${Qe}
|
9574
9574
|
fragment ProductFields on Product {
|
9575
9575
|
id
|
9576
9576
|
basePrice
|
@@ -9614,7 +9614,7 @@ const re = w`
|
|
9614
9614
|
name
|
9615
9615
|
}
|
9616
9616
|
}
|
9617
|
-
`,
|
9617
|
+
`, ba = (r) => w`
|
9618
9618
|
${qs(r)}
|
9619
9619
|
fragment ProductCollectionProductFields on ProductCollectionProduct {
|
9620
9620
|
id
|
@@ -9625,7 +9625,7 @@ const re = w`
|
|
9625
9625
|
}
|
9626
9626
|
}
|
9627
9627
|
`, ie = (r, t = !1) => w`
|
9628
|
-
${r ?
|
9628
|
+
${r ? ba(t) : ""}
|
9629
9629
|
fragment ProductCollectionFields on ProductCollection {
|
9630
9630
|
id
|
9631
9631
|
name
|
@@ -9738,7 +9738,7 @@ const re = w`
|
|
9738
9738
|
quoteId
|
9739
9739
|
}
|
9740
9740
|
}
|
9741
|
-
`,
|
9741
|
+
`, Ha = w`
|
9742
9742
|
query GetBundleStakeholders($id: String!) {
|
9743
9743
|
bundles(ids: [$id]) {
|
9744
9744
|
id
|
@@ -9813,7 +9813,7 @@ const re = w`
|
|
9813
9813
|
}
|
9814
9814
|
}
|
9815
9815
|
`, Ys = w`
|
9816
|
-
${
|
9816
|
+
${ba(!1)}
|
9817
9817
|
query GetProductCollectionProducts($id: String!, $productIds: [String!]) {
|
9818
9818
|
productCollections(ids: [$id], productIds: $productIds) {
|
9819
9819
|
id
|
@@ -9846,7 +9846,7 @@ const re = w`
|
|
9846
9846
|
}
|
9847
9847
|
}
|
9848
9848
|
`, Ks = w`
|
9849
|
-
${
|
9849
|
+
${ba(!0)}
|
9850
9850
|
query GetProductCollectionForProductsFeed(
|
9851
9851
|
$id: String!
|
9852
9852
|
$limit: Int
|
@@ -10227,9 +10227,9 @@ const re = w`
|
|
10227
10227
|
}
|
10228
10228
|
}
|
10229
10229
|
`;
|
10230
|
-
var
|
10230
|
+
var $e = /* @__PURE__ */ ((r) => (r.Error = "Error", r.Warning = "Warning", r.Info = "Info", r))($e || {});
|
10231
10231
|
const yo = 1e3;
|
10232
|
-
class
|
10232
|
+
class Ya extends xn {
|
10233
10233
|
constructor(t) {
|
10234
10234
|
super(), this.createdAt = /* @__PURE__ */ new Date(), this.update = t;
|
10235
10235
|
}
|
@@ -10397,7 +10397,7 @@ class So {
|
|
10397
10397
|
this.reloadedState && this.reloadedState.serializableWorkflow.steps.forEach((o) => {
|
10398
10398
|
this.storage[o.stepName] = o.storage || {};
|
10399
10399
|
}), await this.fetchConversionConfiguration(), this.allScenes = await ji(t);
|
10400
|
-
const n =
|
10400
|
+
const n = yt(this.allScenes, this.stepSelections).map((o) => o.silentSteps).flat(), { stepElements: i, commands: s } = await this.stepElementsForIntroducedSilentSteps(n, !!this.reloadedState);
|
10401
10401
|
this.commandContext.apply(new R(s), !0), this.stepElements = { ...this.stepElements, ...i }, await this.ensureStepsAreLoaded(), !this.isReloadedTransaction && this.updateStateWithServer(), this.renderLayouts(), this.reloadedState && e();
|
10402
10402
|
}
|
10403
10403
|
getWorkflowExperience() {
|
@@ -10570,7 +10570,7 @@ class So {
|
|
10570
10570
|
this.mandatorySteps[t] !== e && (this.mandatorySteps = { ...this.mandatorySteps, [t]: e }, this.onMandatoryChange());
|
10571
10571
|
}
|
10572
10572
|
getMandatoryUnfulfilledSteps() {
|
10573
|
-
return
|
10573
|
+
return yt(this.allScenes, this.stepSelections).flatMap((i) => i.renderableSteps).filter((i) => i.mandatory).filter((i) => !this.mandatorySteps[i.stepName]).map((i) => i.stepName);
|
10574
10574
|
}
|
10575
10575
|
setStepError(t, e, a) {
|
10576
10576
|
let n = !1;
|
@@ -10605,7 +10605,7 @@ class So {
|
|
10605
10605
|
},
|
10606
10606
|
{ refocusCamera: e }
|
10607
10607
|
);
|
10608
|
-
this.setModelContainer(a),
|
10608
|
+
this.setModelContainer(a), yt(this.allScenes, this.stepSelections).filter((s) => s).map((s) => s.renderableSteps).flat().filter((s) => s.type === v.Model || s.type === v.Material).forEach((s) => {
|
10609
10609
|
if (!s.option?.id) {
|
10610
10610
|
console.error(`Failed to read option id from step: ${s.stepName}`);
|
10611
10611
|
return;
|
@@ -10661,9 +10661,9 @@ class So {
|
|
10661
10661
|
...this.storage,
|
10662
10662
|
[t]: { ...this.storage[t], ...e }
|
10663
10663
|
};
|
10664
|
-
if (!
|
10664
|
+
if (!cn(a, this.storage)) {
|
10665
10665
|
this.storage = a;
|
10666
|
-
const n = new
|
10666
|
+
const n = new Ga(this.constructSerializableWorkflow());
|
10667
10667
|
this.commandContext.apply(n, !0), this.onStepSpecificStorageChange(t), this.onStorageChange();
|
10668
10668
|
}
|
10669
10669
|
}
|
@@ -10682,7 +10682,7 @@ class So {
|
|
10682
10682
|
if (this.readOnly) return;
|
10683
10683
|
const t = this.serialize();
|
10684
10684
|
this.workflowStatePromiseQueue.enqueue(
|
10685
|
-
new
|
10685
|
+
new Ya(async () => {
|
10686
10686
|
await new Promise((e) => {
|
10687
10687
|
setTimeout(() => {
|
10688
10688
|
e();
|
@@ -10699,7 +10699,7 @@ class So {
|
|
10699
10699
|
async updateStateWithServerImmediate() {
|
10700
10700
|
if (this.readOnly) return;
|
10701
10701
|
const t = this.serialize();
|
10702
|
-
return new
|
10702
|
+
return new Ya(async () => {
|
10703
10703
|
await this.updateTransaction({
|
10704
10704
|
variables: {
|
10705
10705
|
id: this.transaction.id,
|
@@ -10712,7 +10712,7 @@ class So {
|
|
10712
10712
|
const t = this.getCommandContext().getState();
|
10713
10713
|
if (!t)
|
10714
10714
|
throw new V("Attempted to serialize state before it was initialized.");
|
10715
|
-
const e =
|
10715
|
+
const e = Et(t.transaction), a = this.dehydrateState(e);
|
10716
10716
|
return JSON.stringify(a);
|
10717
10717
|
}
|
10718
10718
|
/**
|
@@ -10748,12 +10748,12 @@ class So {
|
|
10748
10748
|
this.stepElements = e(this.stepElements, t);
|
10749
10749
|
}
|
10750
10750
|
getInvalidCanvasRegions() {
|
10751
|
-
return this.workflow.steps.reduce((t, e) => (
|
10751
|
+
return this.workflow.steps.reduce((t, e) => (vt(e, this.stepSelections) || this.stepElements[e.stepName] && this.stepElements[e.stepName].forEach(
|
10752
10752
|
(a) => t.push(a)
|
10753
10753
|
), t), []);
|
10754
10754
|
}
|
10755
10755
|
getInvalidModelVariants() {
|
10756
|
-
return this.workflow.steps.reduce((t, e) => (e.type === v.Model && !
|
10756
|
+
return this.workflow.steps.reduce((t, e) => (e.type === v.Model && !vt(e, this.stepSelections) && t.push(e.stepName), t), []);
|
10757
10757
|
}
|
10758
10758
|
async stepElementsForIntroducedSilentSteps(t, e) {
|
10759
10759
|
const a = this.product;
|
@@ -10761,10 +10761,10 @@ class So {
|
|
10761
10761
|
return Promise.resolve({ stepElements: {}, commands: [] });
|
10762
10762
|
const n = async (c, d, A) => {
|
10763
10763
|
if (c.type === v.SilentIllustration) {
|
10764
|
-
const u = await new
|
10764
|
+
const u = await new qa(c, d).trigger();
|
10765
10765
|
return { step: c, results: u };
|
10766
10766
|
} else if (c.type === v.ProductOverlay) {
|
10767
|
-
const u = await new
|
10767
|
+
const u = await new qa(
|
10768
10768
|
c,
|
10769
10769
|
d,
|
10770
10770
|
A
|
@@ -10853,13 +10853,13 @@ class So {
|
|
10853
10853
|
...this.stepSelections,
|
10854
10854
|
[t]: { selectedVariants: e }
|
10855
10855
|
}, this.selectionCost = Object.values(this.stepSelections).reduce((C, E) => C + E.selectedVariants.map((P) => P.priceModifier || 0).reduce((P, B) => P + B, 0), 0), this.workflow.steps.forEach((C) => {
|
10856
|
-
|
10856
|
+
vt(C, this.stepSelections) || (this.stepInitialised[C.stepName] = !1, delete this.stepMetadata[C.stepName], delete this.stepSelections[C.stepName], delete this.storage[C.stepName]);
|
10857
10857
|
});
|
10858
|
-
const s = this.allScenes, o =
|
10858
|
+
const s = this.allScenes, o = yt(s, i), l = yt(s, this.stepSelections), c = o.map((C) => C.silentSteps).flat(), A = l.map((C) => C.silentSteps).flat().filter(
|
10859
10859
|
(C) => !c.some((E) => E.stepName === C.stepName)
|
10860
10860
|
);
|
10861
10861
|
c.forEach((C) => {
|
10862
|
-
|
10862
|
+
vt(C, this.stepSelections) || (this.stepInitialised[C.stepName] = !1);
|
10863
10863
|
});
|
10864
10864
|
const u = this.getInvalidCanvasRegions(), { stepElements: h, commands: m } = await this.stepElementsForIntroducedSilentSteps(A, !1);
|
10865
10865
|
this.stepElements = {
|
@@ -10869,7 +10869,7 @@ class So {
|
|
10869
10869
|
}, this.removeElements(u);
|
10870
10870
|
const g = this.workflow.steps.find((C) => C.stepName === t);
|
10871
10871
|
g?.type === v.Frame && this.getWorkflowExperience().getStepById(g.stepName)?.frameService?.setTargetElements(a.map((E) => E.id));
|
10872
|
-
const p = u.map((C) => new Bt(C.id)), f = new
|
10872
|
+
const p = u.map((C) => new Bt(C.id)), f = new Ga(this.constructSerializableWorkflow()), S = [...m, ...p, f];
|
10873
10873
|
S.length > 0 && this.commandContext.apply(new R(S), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
|
10874
10874
|
const b = this.getInvalidModelVariants(), I = this.modelContainer;
|
10875
10875
|
if (I) {
|
@@ -10887,7 +10887,7 @@ class So {
|
|
10887
10887
|
await this.onSelectionChange(), n && await n();
|
10888
10888
|
}
|
10889
10889
|
async ensureStepsAreLoaded() {
|
10890
|
-
const e =
|
10890
|
+
const e = yt(this.allScenes, this.stepSelections).map((l) => l.renderableSteps), a = [], n = e.flat();
|
10891
10891
|
for (const l of n)
|
10892
10892
|
if (!this.stepInitialised[l.stepName])
|
10893
10893
|
switch (this.stepInitialised[l.stepName] = !0, l.type) {
|
@@ -10901,7 +10901,7 @@ class So {
|
|
10901
10901
|
);
|
10902
10902
|
break;
|
10903
10903
|
case v.Frame:
|
10904
|
-
a.push(
|
10904
|
+
a.push(St.init(l, this, this.reloadedState));
|
10905
10905
|
break;
|
10906
10906
|
case v.Illustration:
|
10907
10907
|
a.push(
|
@@ -11412,7 +11412,7 @@ class Do extends Z {
|
|
11412
11412
|
...this.manager.getInformationResults(),
|
11413
11413
|
{
|
11414
11414
|
message: "An issue has occurred with text",
|
11415
|
-
messageType:
|
11415
|
+
messageType: $e.Error,
|
11416
11416
|
stepID: this.step.stepName
|
11417
11417
|
}
|
11418
11418
|
]);
|
@@ -11660,7 +11660,7 @@ class ko extends Z {
|
|
11660
11660
|
...this.manager.getInformationResults(),
|
11661
11661
|
{
|
11662
11662
|
message: e,
|
11663
|
-
messageType:
|
11663
|
+
messageType: $e.Error,
|
11664
11664
|
stepID: this.step.stepName
|
11665
11665
|
}
|
11666
11666
|
];
|
@@ -11832,7 +11832,7 @@ const No = async (r, t) => {
|
|
11832
11832
|
headers: e
|
11833
11833
|
}
|
11834
11834
|
})).data?.designCreateMany;
|
11835
|
-
},
|
11835
|
+
}, Ja = (r, t, e) => {
|
11836
11836
|
const a = (i) => {
|
11837
11837
|
const s = {};
|
11838
11838
|
if (i.type === "Frame") {
|
@@ -11928,7 +11928,7 @@ const No = async (r, t) => {
|
|
11928
11928
|
T.errors && console.log("Server Error:", et.message);
|
11929
11929
|
}), null) : tt ?? null;
|
11930
11930
|
})() || (console.warn("State mismatch detected. Uploading known state explicitly"), console.warn("State Object:", JSON.stringify(a())), await r.updateStateWithServerImmediate(a), console.log("Server state is undefined @ Workflow completion"));
|
11931
|
-
const u = r.getPreviewService(), h = t?.finalizeStepConfig?.lookAtAnimation, m = u && t.showModelOnFinishStep && !!h, g = l &&
|
11931
|
+
const u = r.getPreviewService(), h = t?.finalizeStepConfig?.lookAtAnimation, m = u && t.showModelOnFinishStep && !!h, g = l && Ja(l, t, !0), p = l && Ja(l, t, !1), f = async (B) => {
|
11932
11932
|
const F = {};
|
11933
11933
|
let Q = 0;
|
11934
11934
|
if (Object.keys(i).length > 0)
|
@@ -11937,12 +11937,12 @@ const No = async (r, t) => {
|
|
11937
11937
|
for (let W = 0; W < tt.selections.length; ++W) {
|
11938
11938
|
const q = tt.selections[W];
|
11939
11939
|
if (et && (!B || et.option && (et.option.variants || []).length > 1 && !et.data.hideSelectionInCart && !et.data.hideSelectionsInCart)) {
|
11940
|
-
const
|
11941
|
-
F[
|
11940
|
+
const wt = et.stepTitle;
|
11941
|
+
F[wt] ? F[wt].push({
|
11942
11942
|
id: q.id || "",
|
11943
11943
|
name: q.name,
|
11944
11944
|
priceModifier: q.priceModifier
|
11945
|
-
}) : F[
|
11945
|
+
}) : F[wt] = [
|
11946
11946
|
{
|
11947
11947
|
id: q.id || "",
|
11948
11948
|
name: q.name,
|
@@ -11967,7 +11967,7 @@ const No = async (r, t) => {
|
|
11967
11967
|
const B = await (await rt(E)).blob();
|
11968
11968
|
E = (await O.uploadAsset(
|
11969
11969
|
{ name: `${n.id}-preview-image.png`, blob: B },
|
11970
|
-
|
11970
|
+
ye.Image,
|
11971
11971
|
!0,
|
11972
11972
|
!1
|
11973
11973
|
)).fileLink;
|
@@ -12146,7 +12146,7 @@ class Uo {
|
|
12146
12146
|
throw new V("Unexpected storage method requested");
|
12147
12147
|
}
|
12148
12148
|
}
|
12149
|
-
const
|
12149
|
+
const Ke = new Uo(), Lo = w`
|
12150
12150
|
mutation AddTransactionStakeholder($id: String!, $type: String!, $details: CustomerDetailsInput!) {
|
12151
12151
|
transactionAddStakeholder(id: $id, details: $details, type: $type) {
|
12152
12152
|
id
|
@@ -12193,7 +12193,7 @@ var Go = /* @__PURE__ */ ((r) => (r.QuantityChanged = "QuantityChanged", r.Price
|
|
12193
12193
|
class Wo {
|
12194
12194
|
constructor(t, e) {
|
12195
12195
|
if (this.cachedStepHandles = /* @__PURE__ */ new Map(), this.currentPriceBreak = 1, this.renderableScenes = [], this.renderableSceneCallbacks = [], this.eventCallbacks = /* @__PURE__ */ new Map(), this.debouncedSavedDesignUpdate = dn(async () => {
|
12196
|
-
await
|
12196
|
+
await Ke.getSavedDesignByTransaction(
|
12197
12197
|
this.getWorkflowManager().getTransaction().id
|
12198
12198
|
) && this.save();
|
12199
12199
|
}, 2500), this.getCanvasObjectURLAsync = async (n) => new Promise((i, s) => {
|
@@ -12300,7 +12300,7 @@ class Wo {
|
|
12300
12300
|
}
|
12301
12301
|
let i = 2048;
|
12302
12302
|
e && e <= 2048 && (i = e);
|
12303
|
-
const s =
|
12303
|
+
const s = pt(i, i), o = this.commandContext.getAllLayouts(), l = a.defaultPreviewPanelIndex || 0, c = a.panels[l], d = o.find((b) => b.layoutState?.layout.panelId === c?.name) || o[0], A = d.layoutState.layout.previewRegion ? {
|
12304
12304
|
x: d.layoutState.layout.previewRegion.left,
|
12305
12305
|
y: d.layoutState.layout.previewRegion.top,
|
12306
12306
|
width: d.layoutState.layout.previewRegion.width,
|
@@ -12312,20 +12312,20 @@ class Wo {
|
|
12312
12312
|
height: d.layoutState.layout.height
|
12313
12313
|
}, u = this.commandContext.getLayoutById(d.layoutState.layout.id), h = s.getContext("2d");
|
12314
12314
|
if (!h)
|
12315
|
-
throw new
|
12316
|
-
const m = this.workflowManager.getTemplatingContext(), g =
|
12315
|
+
throw new ke("Failed to obtain 2D context for preview image creation");
|
12316
|
+
const m = this.workflowManager.getTemplatingContext(), g = ya(u.layoutState.layout, u.layoutState.elements, {
|
12317
12317
|
renderingConfiguration: {
|
12318
12318
|
purpose: Ht.Print,
|
12319
12319
|
region: { left: A.x, top: A.y, width: A.width, height: A.height },
|
12320
12320
|
templatingContext: m
|
12321
12321
|
}
|
12322
12322
|
}), p = gn(g);
|
12323
|
-
await (await
|
12323
|
+
await (await Aa.from(h, p, {
|
12324
12324
|
anonymousCrossOrigin: !0,
|
12325
12325
|
ignoreDimensions: !1,
|
12326
|
-
createCanvas:
|
12326
|
+
createCanvas: pt,
|
12327
12327
|
createImage: te,
|
12328
|
-
DOMParser:
|
12328
|
+
DOMParser: ga(),
|
12329
12329
|
fetch
|
12330
12330
|
})).render();
|
12331
12331
|
const S = await this.getCanvasObjectURLAsync(s);
|
@@ -12346,7 +12346,7 @@ class Wo {
|
|
12346
12346
|
getStepsConditionallyActive() {
|
12347
12347
|
return this.getScenes().flatMap(
|
12348
12348
|
(t) => this.getStepsByScene(t).filter(
|
12349
|
-
(e) =>
|
12349
|
+
(e) => vt(e.getRaw(), this.getWorkflowManager().getStepSelections())
|
12350
12350
|
)
|
12351
12351
|
);
|
12352
12352
|
}
|
@@ -12483,7 +12483,7 @@ class Wo {
|
|
12483
12483
|
const n = {
|
12484
12484
|
title: await (async () => {
|
12485
12485
|
if (t) return t;
|
12486
|
-
const i = this.getWorkflowManager().getTransaction().id, o = (await
|
12486
|
+
const i = this.getWorkflowManager().getTransaction().id, o = (await Ke.getSavedDesigns()).find((l) => l.transactionId === i)?.title;
|
12487
12487
|
return o || "My design";
|
12488
12488
|
})(),
|
12489
12489
|
thumbnail: await this.createPreviewImage(!1, 256),
|
@@ -12494,10 +12494,10 @@ class Wo {
|
|
12494
12494
|
workflowId: this.getWorkflowManager().getWorkflow().id,
|
12495
12495
|
lastEdited: /* @__PURE__ */ new Date()
|
12496
12496
|
};
|
12497
|
-
return await
|
12497
|
+
return await Ke.addDesign(n), n;
|
12498
12498
|
}
|
12499
12499
|
async copy() {
|
12500
|
-
const t =
|
12500
|
+
const t = Et(this.getCommandContext().getState());
|
12501
12501
|
if (!t) throw new V("Internal state is undefined! Cannot copy experience!");
|
12502
12502
|
const e = JSON.stringify(t.transaction), a = this.getWorkflowManager().getWorkflow(), n = this.getWorkflowManager().getTransaction().integrationProduct?.id;
|
12503
12503
|
if (!n) throw new V("Integration product id is undefined!");
|
@@ -12684,8 +12684,8 @@ const qo = (r) => {
|
|
12684
12684
|
"tspan"
|
12685
12685
|
], Yo = async (r, t, e) => {
|
12686
12686
|
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);
|
12687
|
-
o.searchParams.append("video",
|
12688
|
-
const l = o.toString(), d = `data:image/svg+xml;base64,${
|
12687
|
+
o.searchParams.append("video", Qa(JSON.stringify([{ href: i }]))), o.pathname = o.pathname + (o.pathname.slice(-1) === "/" ? "" : "/");
|
12688
|
+
const l = o.toString(), d = `data:image/svg+xml;base64,${Qa(await ln(l, { type: "svg" }))}`, A = (h) => {
|
12689
12689
|
const m = r.find((p) => p.panelId === h.panelId);
|
12690
12690
|
if (!m)
|
12691
12691
|
throw new Y(h);
|
@@ -12710,15 +12710,15 @@ const qo = (r) => {
|
|
12710
12710
|
return console.error(h), [];
|
12711
12711
|
}
|
12712
12712
|
}, Jo = async (r, t, e, a) => {
|
12713
|
-
const n = e.data, i = n.assetUrl, s = await
|
12713
|
+
const n = e.data, i = n.assetUrl, s = await la(i);
|
12714
12714
|
try {
|
12715
12715
|
const o = us(n, a.option);
|
12716
12716
|
o && (t[a.stepName] = { selectedVariants: [o] });
|
12717
12717
|
const l = async (c) => {
|
12718
|
-
const d = await Ln(c, o?.asset?.fileLink), A = await
|
12718
|
+
const d = await Ln(c, o?.asset?.fileLink), A = await Oe(d), u = M(), h = r.find((g) => g.panelId === c.panelId);
|
12719
12719
|
if (!h)
|
12720
12720
|
throw new Y(c);
|
12721
|
-
const m =
|
12721
|
+
const m = va(
|
12722
12722
|
s,
|
12723
12723
|
A,
|
12724
12724
|
{
|
@@ -12779,10 +12779,10 @@ const qo = (r) => {
|
|
12779
12779
|
const o = s.asset?.fileLink;
|
12780
12780
|
if (!o)
|
12781
12781
|
return console.error(`No asset link for variant with ID: ${n.illustrationVariantId}`), [];
|
12782
|
-
const l = await nt(o, !0), c = /<svg.*?<\/svg>/s, d = l.match(c) || [], A = d?.length > 0 ? d[0] : "", m =
|
12782
|
+
const l = await nt(o, !0), c = /<svg.*?<\/svg>/s, d = l.match(c) || [], A = d?.length > 0 ? d[0] : "", m = dt().parseFromString(A, "image/svg+xml").firstElementChild;
|
12783
12783
|
if (!m)
|
12784
12784
|
return console.error("Failed to read SVG."), [];
|
12785
|
-
|
12785
|
+
pa(m);
|
12786
12786
|
const g = {};
|
12787
12787
|
kt(m, (C) => {
|
12788
12788
|
Ho.includes(C.tagName) && !C.attributes.getNamedItem("fill") && C.setAttribute("fill", "#000000");
|
@@ -12993,10 +12993,10 @@ const qo = (r) => {
|
|
12993
12993
|
}
|
12994
12994
|
else {
|
12995
12995
|
const c = await nt(i, !0), d = (A) => {
|
12996
|
-
const u = /<svg.*?<\/svg>/s, h = A.match(u) || [], m = h?.length > 0 ? h[0] : "", f =
|
12996
|
+
const u = /<svg.*?<\/svg>/s, h = A.match(u) || [], m = h?.length > 0 ? h[0] : "", f = dt().parseFromString(m, "image/svg+xml").firstElementChild;
|
12997
12997
|
if (!f)
|
12998
12998
|
throw new Dt("Failed to read SVG.");
|
12999
|
-
return
|
12999
|
+
return pa(f), It().serializeToString(f);
|
13000
13000
|
};
|
13001
13001
|
l.forEach((A) => {
|
13002
13002
|
const u = r.find((m) => m.panelId === A.panelId);
|
@@ -13046,7 +13046,7 @@ const qo = (r) => {
|
|
13046
13046
|
assetUrl: p,
|
13047
13047
|
name: f.names.fullName.en
|
13048
13048
|
};
|
13049
|
-
})(), A = (a.data.replaceableText ? a.data.replaceableText.replace("{{}}", i.text) : i.text) || "", u =
|
13049
|
+
})(), A = (a.data.replaceableText ? a.data.replaceableText.replace("{{}}", i.text) : i.text) || "", u = Ie(A, {
|
13050
13050
|
vertical: a.data.vertical,
|
13051
13051
|
uppercase: a.data.uppercase
|
13052
13052
|
}), h = async (p) => {
|
@@ -13084,7 +13084,7 @@ const qo = (r) => {
|
|
13084
13084
|
d,
|
13085
13085
|
p,
|
13086
13086
|
[
|
13087
|
-
|
13087
|
+
Ie(u, {
|
13088
13088
|
vertical: a.data.vertical,
|
13089
13089
|
uppercase: a.data.uppercase
|
13090
13090
|
})
|
@@ -13207,7 +13207,7 @@ class rl {
|
|
13207
13207
|
}
|
13208
13208
|
const il = () => new Promise((r, t) => {
|
13209
13209
|
try {
|
13210
|
-
const a =
|
13210
|
+
const a = pt().getContext("webgl2");
|
13211
13211
|
r(!!a);
|
13212
13212
|
} catch {
|
13213
13213
|
r(!1);
|
@@ -13261,7 +13261,7 @@ class ol {
|
|
13261
13261
|
* Actions to perform when a static render event is fired for this canvas.
|
13262
13262
|
*/
|
13263
13263
|
async render(t) {
|
13264
|
-
const e =
|
13264
|
+
const e = Et(t);
|
13265
13265
|
this.lastRequestedRenderArguments = e;
|
13266
13266
|
const a = this.getStaticContext();
|
13267
13267
|
if (!a) {
|
@@ -13332,21 +13332,21 @@ class ll extends xn {
|
|
13332
13332
|
l = p.width, c = p.height;
|
13333
13333
|
} else
|
13334
13334
|
l = i.width, c = i.height;
|
13335
|
-
const d = this.getWorkflowManager?.()?.getTemplatingContext(), A =
|
13335
|
+
const d = this.getWorkflowManager?.()?.getTemplatingContext(), A = ya(t.layoutState.layout, e, {
|
13336
13336
|
renderingConfiguration: {
|
13337
13337
|
purpose: Ht.ThreeD,
|
13338
13338
|
templatingContext: d
|
13339
13339
|
}
|
13340
|
-
}), u = gn(A), h = await
|
13340
|
+
}), u = gn(A), h = await Aa.from(this.ctx, u, {
|
13341
13341
|
anonymousCrossOrigin: !0,
|
13342
13342
|
ignoreDimensions: !this.nonPOTSupport,
|
13343
13343
|
ignoreAnimation: !0,
|
13344
13344
|
ignoreClear: !0,
|
13345
13345
|
ignoreMouse: !0,
|
13346
13346
|
enableRedraw: !1,
|
13347
|
-
createCanvas:
|
13347
|
+
createCanvas: pt,
|
13348
13348
|
createImage: te,
|
13349
|
-
DOMParser:
|
13349
|
+
DOMParser: ga(),
|
13350
13350
|
fetch
|
13351
13351
|
});
|
13352
13352
|
h.resize(l, c), await h.render(), this.onRender();
|
@@ -13416,14 +13416,14 @@ class cl {
|
|
13416
13416
|
case U.FileUpload:
|
13417
13417
|
return new dl(this.bundle, t).initialize();
|
13418
13418
|
case U.ColorOption:
|
13419
|
-
return new
|
13419
|
+
return new Ka(
|
13420
13420
|
this.bundle,
|
13421
13421
|
t,
|
13422
13422
|
t.entityId ? await H.getOption(t.entityId) : void 0
|
13423
13423
|
);
|
13424
13424
|
case U.Option: {
|
13425
13425
|
const e = t.entityId ? await H.getOption(t.entityId) : void 0;
|
13426
|
-
return e?.type === "Color" ? new
|
13426
|
+
return e?.type === "Color" ? new Ka(this.bundle, t, e) : new er(this.bundle, t, e);
|
13427
13427
|
}
|
13428
13428
|
case U.Text:
|
13429
13429
|
return new Al(this.bundle, t);
|
@@ -13432,7 +13432,7 @@ class cl {
|
|
13432
13432
|
}
|
13433
13433
|
}
|
13434
13434
|
}
|
13435
|
-
class
|
13435
|
+
class Ba {
|
13436
13436
|
constructor(t, e) {
|
13437
13437
|
this.bundle = t, this.property = e;
|
13438
13438
|
}
|
@@ -13493,7 +13493,7 @@ class Ia {
|
|
13493
13493
|
return this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);
|
13494
13494
|
}
|
13495
13495
|
}
|
13496
|
-
class dl extends
|
13496
|
+
class dl extends Ba {
|
13497
13497
|
constructor(t, e) {
|
13498
13498
|
super(t, e);
|
13499
13499
|
}
|
@@ -13504,7 +13504,7 @@ class dl extends Ia {
|
|
13504
13504
|
const t = await this.getImage();
|
13505
13505
|
if (t?.fileLink)
|
13506
13506
|
if (t?.fileLink.endsWith(".svg")) {
|
13507
|
-
const e = await nt(t?.fileLink), a = await
|
13507
|
+
const e = await nt(t?.fileLink), a = await Ea(t?.fileLink), n = a.width, i = a.height, s = await ot(e);
|
13508
13508
|
this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name)?.colors?.forEach((c) => {
|
13509
13509
|
s.colors[c.key] = {
|
13510
13510
|
browserValue: c.browserValue,
|
@@ -13519,7 +13519,7 @@ class dl extends Ia {
|
|
13519
13519
|
svg: s.svg,
|
13520
13520
|
colors: s.colors
|
13521
13521
|
};
|
13522
|
-
|
13522
|
+
ut.set(t?.fileLink, l), this.imageData = l;
|
13523
13523
|
} else
|
13524
13524
|
this.imageData = void 0;
|
13525
13525
|
}
|
@@ -13547,7 +13547,7 @@ class dl extends Ia {
|
|
13547
13547
|
]);
|
13548
13548
|
}
|
13549
13549
|
async canUseBackgroundRemover() {
|
13550
|
-
return this.bundle.getClient().canUseAddon(
|
13550
|
+
return this.bundle.getClient().canUseAddon(ua.BackgroundRemover);
|
13551
13551
|
}
|
13552
13552
|
/**
|
13553
13553
|
* Removes the background from an image, stores it in the state, and returns the new asset.
|
@@ -13585,7 +13585,7 @@ class dl extends Ia {
|
|
13585
13585
|
return O.getLocalOrFromServer(t);
|
13586
13586
|
}
|
13587
13587
|
async getImageWithColors() {
|
13588
|
-
return await this.loadImageData(), this.imageData?.svg ?
|
13588
|
+
return await this.loadImageData(), this.imageData?.svg ? ha(Ca(this.imageData.svg, this.imageData.colors ?? {}, !1)) : this.imageData?.src;
|
13589
13589
|
}
|
13590
13590
|
/**
|
13591
13591
|
* Retrieves the original, unmodified image selection, if one exists.
|
@@ -13719,7 +13719,7 @@ class dl extends Ia {
|
|
13719
13719
|
);
|
13720
13720
|
}
|
13721
13721
|
}
|
13722
|
-
class Al extends
|
13722
|
+
class Al extends Ba {
|
13723
13723
|
constructor(t, e) {
|
13724
13724
|
super(t, e);
|
13725
13725
|
}
|
@@ -13758,7 +13758,7 @@ class Al extends Ia {
|
|
13758
13758
|
await Promise.all(n);
|
13759
13759
|
}
|
13760
13760
|
}
|
13761
|
-
class er extends
|
13761
|
+
class er extends Ba {
|
13762
13762
|
constructor(t, e, a) {
|
13763
13763
|
super(t, e), this.optionResource = a;
|
13764
13764
|
}
|
@@ -13820,7 +13820,7 @@ class er extends Ia {
|
|
13820
13820
|
await Promise.all(n);
|
13821
13821
|
}
|
13822
13822
|
}
|
13823
|
-
class
|
13823
|
+
class Ka extends er {
|
13824
13824
|
constructor(t, e, a) {
|
13825
13825
|
super(t, e, a);
|
13826
13826
|
}
|
@@ -13918,7 +13918,7 @@ class ml {
|
|
13918
13918
|
}
|
13919
13919
|
async setGlobalPropertyState(t) {
|
13920
13920
|
this.globalPropertyState || await this.initPromise;
|
13921
|
-
const e =
|
13921
|
+
const e = Et(this.globalPropertyState);
|
13922
13922
|
this.globalPropertyState = { ...t, id: e.id }, this.recalculateMandatoryStates(), await this.updateGlobalPropertyState(), await this.onGlobalPropertyStateChange(e, this.globalPropertyState);
|
13923
13923
|
}
|
13924
13924
|
getAspectMandatoryFulfilled(t) {
|
@@ -13945,7 +13945,7 @@ class ml {
|
|
13945
13945
|
if (!i)
|
13946
13946
|
throw new Error(`Failed to find configuration aspect with name: ${t}`);
|
13947
13947
|
this.mandatoryFulfilledAspects.set(t, e !== "");
|
13948
|
-
const s =
|
13948
|
+
const s = Et(this.globalPropertyState), o = this.globalPropertyState.aspects.filter((l) => l.name === t);
|
13949
13949
|
if (o.length > 0)
|
13950
13950
|
if (n) {
|
13951
13951
|
const l = o.find((c) => c.channel === n);
|
@@ -13978,7 +13978,7 @@ class ml {
|
|
13978
13978
|
storage: a !== null ? a : void 0,
|
13979
13979
|
channel: n
|
13980
13980
|
});
|
13981
|
-
|
13981
|
+
await this.updateGlobalPropertyState(), await this.onGlobalPropertyStateChange(s, this.globalPropertyState);
|
13982
13982
|
}
|
13983
13983
|
async setAspectStorage(t, e, a) {
|
13984
13984
|
if (!this.globalPropertyState)
|
@@ -13988,7 +13988,7 @@ class ml {
|
|
13988
13988
|
const n = this.configuration.aspects.find((o) => o.name === t);
|
13989
13989
|
if (!n)
|
13990
13990
|
throw new Error(`Failed to find configuration aspect with name: ${t}`);
|
13991
|
-
const i =
|
13991
|
+
const i = Et(this.globalPropertyState), s = this.globalPropertyState.aspects.filter((o) => o.name === t);
|
13992
13992
|
if (s.length > 0)
|
13993
13993
|
if (a) {
|
13994
13994
|
const o = s.find((l) => l.channel === a);
|
@@ -14005,7 +14005,7 @@ class ml {
|
|
14005
14005
|
storage: e !== null ? e : void 0,
|
14006
14006
|
channel: a
|
14007
14007
|
});
|
14008
|
-
|
14008
|
+
await this.updateGlobalPropertyState(), await this.onGlobalPropertyStateChange(i, this.globalPropertyState);
|
14009
14009
|
}
|
14010
14010
|
async updateGlobalPropertyState() {
|
14011
14011
|
if (!this.globalPropertyState)
|
@@ -14390,7 +14390,7 @@ class nr {
|
|
14390
14390
|
if (h || g.partial && (!g.data.productCollections || g.data.productCollections.length === 0 || !g.data.productCollections[0].productCollectionProductsFeed?.items || g.data.productCollections[0].productCollectionProductsFeed?.items.length === 0))
|
14391
14391
|
return;
|
14392
14392
|
c.abort(), h = !0, m.unsubscribe();
|
14393
|
-
const p = g.data.productCollections?.[0].productCollectionProductsFeed?.items.filter((f) => !!f.product).map((f) => new Ae(
|
14393
|
+
const p = g.data.productCollections?.[0].productCollectionProductsFeed?.items.filter((f) => !!f.product).map((f) => new Ae(Et(f))) || [];
|
14394
14394
|
u({
|
14395
14395
|
items: p,
|
14396
14396
|
// Clone items because it could be cached data (immutable)
|
@@ -14462,11 +14462,11 @@ class Ae {
|
|
14462
14462
|
getDefaultWorkflow() {
|
14463
14463
|
const t = this.product.workflows;
|
14464
14464
|
if (t === void 0)
|
14465
|
-
throw new
|
14465
|
+
throw new ht(
|
14466
14466
|
"Called getDefaultWorkflow() before fetching collection products. Use collection.fetchProducts() first to ensure the data is available."
|
14467
14467
|
);
|
14468
14468
|
if (t.length === 0)
|
14469
|
-
throw new
|
14469
|
+
throw new ht(
|
14470
14470
|
"Called getDefaultWorkflow() but no workflows on requested product. Ensure at least 1 workflow is assigned to this product."
|
14471
14471
|
);
|
14472
14472
|
const e = this.productResource.workflowId;
|
@@ -14478,7 +14478,7 @@ class Ae {
|
|
14478
14478
|
return console.warn(
|
14479
14479
|
"Called getDefaultWorkflow() but no default was configured. There is only one workflow available so we will fall back to using this!"
|
14480
14480
|
), new qt(t[0]);
|
14481
|
-
throw new
|
14481
|
+
throw new ht(
|
14482
14482
|
"Called getDefaultWorkflow() but no default workflow is configured for the requested product. Multiple workflows exist so we can't assume!"
|
14483
14483
|
);
|
14484
14484
|
}
|
@@ -14487,7 +14487,7 @@ class Ae {
|
|
14487
14487
|
*/
|
14488
14488
|
getAllWorkflows() {
|
14489
14489
|
if ((this.product.workflows || []).length === 0)
|
14490
|
-
throw new
|
14490
|
+
throw new ht(
|
14491
14491
|
"No workflows on configured product. Ensure at least 1 workflow is assigned to this product."
|
14492
14492
|
);
|
14493
14493
|
return this.product.workflows.sort((e, a) => (e.index ?? 0) - (a.index ?? 0)).map((e) => new qt(e));
|
@@ -14685,7 +14685,7 @@ const bl = w`
|
|
14685
14685
|
}
|
14686
14686
|
}
|
14687
14687
|
`;
|
14688
|
-
class
|
14688
|
+
class _e {
|
14689
14689
|
constructor(t, e, a, n, i, s) {
|
14690
14690
|
this.workflowExperiences = [], this.eventEmitter = new El(), this.updatesLocked = !1, this.client = t, this.id = e.id, this.name = e.name || "", this.dispatchDate = e.dispatchDate, this.template = e.template || !1, this.quoteId = e.quoteId, this.shareActions = e.bundleShareActions, this.workflowViewerLink = e.workflowViewerLink, this.workflowViewerAmendLink = e.workflowViewerAmendLink, this.ownerId = i, this.metadata = new Map(e.metadata?.map((c) => [c.key, c.value]) || []), this.completed = e.completed ?? !1, this.productCollection = e.productCollection, this.bundleStateManager = new gl(e.bundleStateData);
|
14691
14691
|
const o = this.productCollection?.globalPropertyConfiguration;
|
@@ -14843,7 +14843,7 @@ class Xe {
|
|
14843
14843
|
if (i)
|
14844
14844
|
switch (a.type) {
|
14845
14845
|
case U.FileUpload: {
|
14846
|
-
const s = i, o = await
|
14846
|
+
const s = i, o = await be([a.value]);
|
14847
14847
|
o.length > 0 && await s.selectImage(o[0]);
|
14848
14848
|
const l = a.storage?.colors;
|
14849
14849
|
if (l) {
|
@@ -15100,7 +15100,7 @@ class Xe {
|
|
15100
15100
|
variables: {
|
15101
15101
|
id: this.id,
|
15102
15102
|
details: t,
|
15103
|
-
type: e ||
|
15103
|
+
type: e || Se.Owner
|
15104
15104
|
},
|
15105
15105
|
context: {
|
15106
15106
|
bundleOwnerId: this.ownerId
|
@@ -15139,7 +15139,7 @@ class Xe {
|
|
15139
15139
|
}
|
15140
15140
|
async getAllStakeholders() {
|
15141
15141
|
const t = await y.getShadowGraphqlClient().query({
|
15142
|
-
query:
|
15142
|
+
query: Ha,
|
15143
15143
|
errorPolicy: "all",
|
15144
15144
|
fetchPolicy: "no-cache",
|
15145
15145
|
variables: {
|
@@ -15155,7 +15155,7 @@ class Xe {
|
|
15155
15155
|
}
|
15156
15156
|
async getCurrentStakeholder() {
|
15157
15157
|
const t = await y.getShadowGraphqlClient().query({
|
15158
|
-
query:
|
15158
|
+
query: Ha,
|
15159
15159
|
errorPolicy: "all",
|
15160
15160
|
fetchPolicy: "no-cache",
|
15161
15161
|
variables: {
|
@@ -15567,7 +15567,7 @@ class ue {
|
|
15567
15567
|
return this.getArtifacts().get(t);
|
15568
15568
|
}
|
15569
15569
|
}
|
15570
|
-
class
|
15570
|
+
class Ia {
|
15571
15571
|
constructor(t) {
|
15572
15572
|
this.value = t;
|
15573
15573
|
}
|
@@ -15580,12 +15580,12 @@ class Pa {
|
|
15580
15580
|
}
|
15581
15581
|
}
|
15582
15582
|
var xl = /* @__PURE__ */ ((r) => (r.Transaction = "Transaction", r.Bundle = "Bundle", r.Product = "Product", r.Variant = "Variant", r.Option = "Option", r.LineItem = "LineItem", r.Asset = "Asset", r))(xl || {});
|
15583
|
-
class hd extends
|
15583
|
+
class hd extends Ia {
|
15584
15584
|
constructor(t) {
|
15585
15585
|
super(`"${t}"`);
|
15586
15586
|
}
|
15587
15587
|
}
|
15588
|
-
class rr extends
|
15588
|
+
class rr extends Ia {
|
15589
15589
|
constructor(t, e) {
|
15590
15590
|
if (e !== "Asset" && !rr.validUUID(t))
|
15591
15591
|
throw new Error("Invalid ID, must be a valid v4 UUID. https://www.uuidgenerator.net/");
|
@@ -15595,12 +15595,12 @@ class rr extends Pa {
|
|
15595
15595
|
return t.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i);
|
15596
15596
|
}
|
15597
15597
|
}
|
15598
|
-
class md extends
|
15598
|
+
class md extends Ia {
|
15599
15599
|
constructor(t) {
|
15600
15600
|
super(`[${t.map((e) => e.getRaw()).join(",")}]`);
|
15601
15601
|
}
|
15602
15602
|
}
|
15603
|
-
class
|
15603
|
+
class _a {
|
15604
15604
|
constructor(t) {
|
15605
15605
|
this.integrationProduct = t;
|
15606
15606
|
}
|
@@ -15788,7 +15788,7 @@ class Ql {
|
|
15788
15788
|
}
|
15789
15789
|
async generateCode(t) {
|
15790
15790
|
const e = await this.cognitoClient?.send(
|
15791
|
-
new
|
15791
|
+
new xa({
|
15792
15792
|
AuthFlow: "CUSTOM_AUTH",
|
15793
15793
|
ClientId: this.userPoolClientId,
|
15794
15794
|
AuthParameters: {
|
@@ -15822,7 +15822,7 @@ class Ql {
|
|
15822
15822
|
throw new Error("Failed to find existing tokens.");
|
15823
15823
|
const e = JSON.parse(t);
|
15824
15824
|
return await this.cognitoClient?.send(
|
15825
|
-
new
|
15825
|
+
new xa({
|
15826
15826
|
AuthFlow: "REFRESH_TOKEN_AUTH",
|
15827
15827
|
ClientId: this.userPoolClientId,
|
15828
15828
|
AuthParameters: {
|
@@ -15852,7 +15852,7 @@ class Rl {
|
|
15852
15852
|
* @param currency The currency to determine precision for.
|
15853
15853
|
*/
|
15854
15854
|
getPrecisionForCurrency(t) {
|
15855
|
-
const e = t, a =
|
15855
|
+
const e = t, a = ka.code(e);
|
15856
15856
|
return a ? a.digits : 2;
|
15857
15857
|
}
|
15858
15858
|
/**
|
@@ -15863,11 +15863,11 @@ class Rl {
|
|
15863
15863
|
*/
|
15864
15864
|
getSpecialFormat(t) {
|
15865
15865
|
const e = t;
|
15866
|
-
if (
|
15866
|
+
if (ka.code(e)?.code === "CLP")
|
15867
15867
|
return "USD0,0";
|
15868
15868
|
}
|
15869
15869
|
}
|
15870
|
-
const
|
15870
|
+
const Xa = new Rl();
|
15871
15871
|
class Ol {
|
15872
15872
|
constructor(t, e, a, n) {
|
15873
15873
|
this.presentmentCurrency = void 0, this.presentmentCurrency = n, this.partnerCurrency = a, this.rateFrom = t, this.rateTo = e;
|
@@ -15899,13 +15899,13 @@ class Ol {
|
|
15899
15899
|
* Converts a monetary value from the database to the units of its currency.
|
15900
15900
|
*/
|
15901
15901
|
units(t, e) {
|
15902
|
-
return t / Math.pow(10,
|
15902
|
+
return t / Math.pow(10, Xa.getPrecisionForCurrency(e));
|
15903
15903
|
}
|
15904
15904
|
/**
|
15905
15905
|
* Converts a monetary value in units to the subunits of its currency.
|
15906
15906
|
*/
|
15907
15907
|
subunits(t, e) {
|
15908
|
-
return t * Math.pow(10,
|
15908
|
+
return t * Math.pow(10, Xa.getPrecisionForCurrency(e));
|
15909
15909
|
}
|
15910
15910
|
}
|
15911
15911
|
const $l = async (r, t) => {
|
@@ -15970,12 +15970,12 @@ class pd {
|
|
15970
15970
|
mutation: bi
|
15971
15971
|
});
|
15972
15972
|
} catch (a) {
|
15973
|
-
throw console.error(a), new
|
15973
|
+
throw console.error(a), new ht("Critical - Unable to synchronize workflow state with server.");
|
15974
15974
|
}
|
15975
|
-
}, this.options = t, this.options.applicationKey && Vr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 32.2.4-beta.
|
15975
|
+
}, this.options = t, this.options.applicationKey && Vr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 32.2.4-beta.2a1f0ff0-c7c4-56e0-afbf-fd744926c42c"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
15976
15976
|
}
|
15977
15977
|
configure(t) {
|
15978
|
-
|
15978
|
+
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 && Gr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Lt.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
|
15979
15979
|
}
|
15980
15980
|
/**
|
15981
15981
|
* @returns The asset manager allows for common operations related to assets
|
@@ -16022,7 +16022,7 @@ class pd {
|
|
16022
16022
|
*/
|
16023
16023
|
async authenticateBundleFromLocalStorage(t) {
|
16024
16024
|
if (k.getMap("bundleOwnerIds")?.has(t))
|
16025
|
-
return Promise.resolve({ success: !0, stakeholderType:
|
16025
|
+
return Promise.resolve({ success: !0, stakeholderType: Se.Owner });
|
16026
16026
|
const a = k.getMap("bundlePartnerIds") || /* @__PURE__ */ new Map();
|
16027
16027
|
if (a.has(t)) {
|
16028
16028
|
const n = a.get(t);
|
@@ -16066,7 +16066,7 @@ class pd {
|
|
16066
16066
|
if (n.isOrdered)
|
16067
16067
|
return Promise.resolve({ success: !1, transactionReadOnly: !0 });
|
16068
16068
|
if (k.getMap("transactionOwnerIds")?.has(t))
|
16069
|
-
return Promise.resolve({ success: !0, stakeholderType:
|
16069
|
+
return Promise.resolve({ success: !0, stakeholderType: Se.Owner });
|
16070
16070
|
const o = k.getMap("transactionCustomerIds");
|
16071
16071
|
if (o?.has(t) && o.get(t) && await this.reloadLoggedInCustomer()) {
|
16072
16072
|
const u = this.customer?.bundleStakeholders?.find(
|
@@ -16272,7 +16272,7 @@ class pd {
|
|
16272
16272
|
s.set(i.id, i.partner.id), k.setMap("bundlePartnerIds", s);
|
16273
16273
|
const o = k.getMap("bundleOwnerIds") || /* @__PURE__ */ new Map();
|
16274
16274
|
o.set(i.id, i.bundleOwnerId), k.setMap("bundleOwnerIds", o);
|
16275
|
-
const l = new
|
16275
|
+
const l = new _e(this, i, void 0, void 0, i.bundleOwnerId, {
|
16276
16276
|
eagerFetchProducts: a?.graphql?.productCollection?.eagerFetchProducts
|
16277
16277
|
});
|
16278
16278
|
return await l.getInitializationPromise(), l;
|
@@ -16312,7 +16312,7 @@ class pd {
|
|
16312
16312
|
throw new Error(`Unable to find bundle: ${t}`);
|
16313
16313
|
const d = c.data?.bundles[0], A = k.getMap("bundlePartnerIds") || /* @__PURE__ */ new Map();
|
16314
16314
|
A.set(d.id, d.partner.id), k.setMap("bundlePartnerIds", A);
|
16315
|
-
const u = new
|
16315
|
+
const u = new _e(this, d, e, a, s, {
|
16316
16316
|
additionalHeaders: n?.graphql?.additionalHeaders,
|
16317
16317
|
eagerFetchProducts: n?.graphql?.productCollection?.eagerFetchProducts,
|
16318
16318
|
existingGlobalPropertyState: c.data.globalPropertyState,
|
@@ -16359,7 +16359,7 @@ class pd {
|
|
16359
16359
|
d.set(c.id, c.partner.id), k.setMap("bundlePartnerIds", d);
|
16360
16360
|
const A = k.getMap("bundleOwnerIds") || /* @__PURE__ */ new Map();
|
16361
16361
|
return A.set(c.id, c.bundleOwnerId), k.setMap("bundleOwnerIds", A), async () => {
|
16362
|
-
const u = new
|
16362
|
+
const u = new _e(this, c, void 0, void 0, c.bundleOwnerId, {
|
16363
16363
|
eagerFetchProducts: n?.graphql?.productCollection?.eagerFetchProducts,
|
16364
16364
|
existingGlobalPropertyState: c.globalPropertyState
|
16365
16365
|
});
|
@@ -16430,7 +16430,7 @@ class pd {
|
|
16430
16430
|
*/
|
16431
16431
|
async getWorkflowExperiences(t, e) {
|
16432
16432
|
if (t.length === 0)
|
16433
|
-
throw new
|
16433
|
+
throw new ht("No options provided!");
|
16434
16434
|
const a = y.getShadowGraphqlClient(), n = async (C) => {
|
16435
16435
|
if (C.length === 0)
|
16436
16436
|
return [];
|
@@ -16444,7 +16444,7 @@ class pd {
|
|
16444
16444
|
}), B = P.data.transactions;
|
16445
16445
|
if (B.length !== C.length) {
|
16446
16446
|
const F = P.errors?.[0]?.message || "Unknown error";
|
16447
|
-
throw new
|
16447
|
+
throw new ht(`Not all transactions were found: ${F}`);
|
16448
16448
|
}
|
16449
16449
|
return !this.activeIntegration && B[0].integrationProduct?.integration && (this.activeIntegration = Promise.resolve(B[0].integrationProduct.integration)), B.map((F, Q) => ({
|
16450
16450
|
transaction: F,
|
@@ -16474,7 +16474,7 @@ class pd {
|
|
16474
16474
|
}), P = E.data?.transactionCreateMany;
|
16475
16475
|
if (!P || P.length === 0) {
|
16476
16476
|
const B = E.errors?.[0]?.message || "Unknown error";
|
16477
|
-
throw new
|
16477
|
+
throw new ht(`Failed to create transactions: ${B}`);
|
16478
16478
|
}
|
16479
16479
|
return P.map((B, F) => ({
|
16480
16480
|
transaction: B,
|
@@ -16484,7 +16484,7 @@ class pd {
|
|
16484
16484
|
}));
|
16485
16485
|
}, s = t.map((C, E) => ({ option: C, index: E })), o = s.filter((C) => C.option.type === "transaction"), l = s.filter(
|
16486
16486
|
(C) => C.option.type === "integration" || C.option.type === "external"
|
16487
|
-
), c =
|
16487
|
+
), c = Fa(o, 10), d = Fa(l, 10), A = (await Promise.all([
|
16488
16488
|
...c.map(n),
|
16489
16489
|
...d.map(i)
|
16490
16490
|
])).flat(), u = [...new Set(A.map((C) => C.workflowId))], h = await ir(u, e), m = new Map(h.map((C) => [C.id, C])), g = k.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), p = A.map(async (C) => {
|
@@ -16511,10 +16511,10 @@ class pd {
|
|
16511
16511
|
};
|
16512
16512
|
if (T.type === "transaction" && E.workflowState) {
|
16513
16513
|
const q = JSON.parse(E.workflowState);
|
16514
|
-
W.layouts = Object.values(q.layouts || {}).map((
|
16514
|
+
W.layouts = Object.values(q.layouts || {}).map((wt) => wt.layout), await za(q), W.reloadedState = q;
|
16515
16515
|
} else if (!B && T.workflowState) {
|
16516
16516
|
const q = JSON.parse(T.workflowState);
|
16517
|
-
W.layouts = Object.values(q.layouts || {}).map((
|
16517
|
+
W.layouts = Object.values(q.layouts || {}).map((wt) => wt.layout), await za(q), W.reloadedState = q;
|
16518
16518
|
} else
|
16519
16519
|
W.layouts = Vl(
|
16520
16520
|
W.transaction,
|
@@ -16546,7 +16546,7 @@ class pd {
|
|
16546
16546
|
})).data?.integrationProducts;
|
16547
16547
|
if (!i || i.length === 0 || !i[0]?.id)
|
16548
16548
|
throw new Error("Integration product not found.");
|
16549
|
-
return new
|
16549
|
+
return new _a(i[0]);
|
16550
16550
|
}
|
16551
16551
|
async getIntegrationProductFromExternalIds(t, e, a) {
|
16552
16552
|
const s = (await y.getShadowGraphqlClient().query({
|
@@ -16560,7 +16560,7 @@ class pd {
|
|
16560
16560
|
})).data?.integrationProductFromExternalIds;
|
16561
16561
|
if (!s?.id)
|
16562
16562
|
throw new Error("Integration product not found.");
|
16563
|
-
return new
|
16563
|
+
return new _a(s);
|
16564
16564
|
}
|
16565
16565
|
async getIntegrationProduct(t) {
|
16566
16566
|
return t.type === "integration" ? this.getIntegrationProductById(t.integrationProductId) : this.getIntegrationProductFromExternalIds(t.externalIntegrationId, t.externalProductId);
|
@@ -16677,8 +16677,8 @@ class Wl {
|
|
16677
16677
|
if (n.currentFrameSources) {
|
16678
16678
|
let i = !1;
|
16679
16679
|
for (let s = 0; s < n.currentFrameSources.length; s++) {
|
16680
|
-
const o = n.currentFrameSources[s], l = await
|
16681
|
-
|
16680
|
+
const o = n.currentFrameSources[s], l = await Oe(o), c = this.frameData ? this.frameData[s] : void 0;
|
16681
|
+
cn(l, c) || (this.frameData || (this.frameData = new Array(n.currentFrameSources.length)), this.frameData[s] = l, i = !0);
|
16682
16682
|
}
|
16683
16683
|
i && (this.onFrameDataChangeListeners.forEach(
|
16684
16684
|
(s) => s(this.frameData)
|
@@ -16730,8 +16730,8 @@ class Wl {
|
|
16730
16730
|
getImageSrc() {
|
16731
16731
|
if (this.imageData) {
|
16732
16732
|
if (this.imageData.svg) {
|
16733
|
-
const t =
|
16734
|
-
return
|
16733
|
+
const t = Ca(this.imageData.svg, this.imageData.colors || {}, !1);
|
16734
|
+
return ha(t);
|
16735
16735
|
}
|
16736
16736
|
return this.imageData.src;
|
16737
16737
|
}
|
@@ -16867,7 +16867,7 @@ class Wl {
|
|
16867
16867
|
}
|
16868
16868
|
recalculateOffsets(t) {
|
16869
16869
|
this.frameData && ((!this.offsets || this.offsets.length !== this.frameData.length) && (this.offsets = new Array(this.frameData.length)), this.frameData.forEach((e, a) => {
|
16870
|
-
this.offsets[a] =
|
16870
|
+
this.offsets[a] = va(
|
16871
16871
|
t,
|
16872
16872
|
e,
|
16873
16873
|
this.initialZoom && !this.forceImageCover ? { scale: this.initialZoom } : void 0,
|
@@ -17050,7 +17050,7 @@ class jl extends Z {
|
|
17050
17050
|
}
|
17051
17051
|
selectVariant(t) {
|
17052
17052
|
const e = this.manager.getRegionElements(this.step.stepName);
|
17053
|
-
return
|
17053
|
+
return St.selectVariant(
|
17054
17054
|
this.step,
|
17055
17055
|
t.getResource(),
|
17056
17056
|
e,
|
@@ -17070,7 +17070,7 @@ class jl extends Z {
|
|
17070
17070
|
* @param [recalculateOffsets=true] Optional: Recalculates the offsets of the image inside the frame. Default: `true`.
|
17071
17071
|
*/
|
17072
17072
|
async selectImage(t, e = !0, a = !0) {
|
17073
|
-
if (await
|
17073
|
+
if (await St.selectImage(this.step, t, this.manager, a), e) {
|
17074
17074
|
const n = this.manager.getStepStorage(this.step.stepName)?.framePatternData || {};
|
17075
17075
|
this.manager.updateStorage(this.step.stepName, {
|
17076
17076
|
framePatternData: {
|
@@ -17086,7 +17086,7 @@ class jl extends Z {
|
|
17086
17086
|
* Returns `true` if the Background Remover is available for the current session.
|
17087
17087
|
*/
|
17088
17088
|
async canUseBackgroundRemover() {
|
17089
|
-
return this.manager.getClient().canUseAddon(
|
17089
|
+
return this.manager.getClient().canUseAddon(ua.BackgroundRemover);
|
17090
17090
|
}
|
17091
17091
|
/**
|
17092
17092
|
* Returns `true` if the Background Remover is available for the current session and if the associated frame has a user-supplied raster image.
|
@@ -17108,7 +17108,7 @@ class jl extends Z {
|
|
17108
17108
|
if (!e)
|
17109
17109
|
throw new Error("You must supply an image selection before attempting to remove the background.");
|
17110
17110
|
const a = await O.removeBackgroundFromAsset(e);
|
17111
|
-
t && await
|
17111
|
+
t && await St.selectImage(this.step, a, this.manager, !1);
|
17112
17112
|
const n = this.manager.getStepStorage(this.step.stepName)?.framePatternData || {};
|
17113
17113
|
return this.manager.updateStorage(this.step.stepName, {
|
17114
17114
|
framePatternData: {
|
@@ -17119,7 +17119,7 @@ class jl extends Z {
|
|
17119
17119
|
}), a;
|
17120
17120
|
}
|
17121
17121
|
changeColors(t) {
|
17122
|
-
|
17122
|
+
St.changeColors(this.step, this.manager, t);
|
17123
17123
|
}
|
17124
17124
|
getImageData() {
|
17125
17125
|
if (this.frameService)
|
@@ -17129,7 +17129,7 @@ class jl extends Z {
|
|
17129
17129
|
return this.step.data.colorOption;
|
17130
17130
|
}
|
17131
17131
|
getAvailableColors() {
|
17132
|
-
return this.step.data.colorPickerEnabled ?
|
17132
|
+
return this.step.data.colorPickerEnabled ? St.availableColors(this.step, this.manager) : Promise.resolve([]);
|
17133
17133
|
}
|
17134
17134
|
isColorPickerEnabled() {
|
17135
17135
|
return this.step.data.colorPickerEnabled ?? !1;
|
@@ -17142,7 +17142,7 @@ class jl extends Z {
|
|
17142
17142
|
return this.step.data.maxColors;
|
17143
17143
|
}
|
17144
17144
|
getUniqueColorCount() {
|
17145
|
-
return
|
17145
|
+
return St.getUniqueColorCount(this.step, this.manager);
|
17146
17146
|
}
|
17147
17147
|
getCurrentFrameStep(t, e, a, n) {
|
17148
17148
|
return n && n.length > 1 && t === void 0 ? "SelectFrame" : e || a || this.getImageData() ? "Position" : "SelectImage";
|
@@ -17212,7 +17212,7 @@ const Hl = w`
|
|
17212
17212
|
id
|
17213
17213
|
}
|
17214
17214
|
}
|
17215
|
-
`,
|
17215
|
+
`, Pa = w`
|
17216
17216
|
query GetCustomerTransactions(
|
17217
17217
|
$id: String!
|
17218
17218
|
$limit: Int!
|
@@ -17379,7 +17379,7 @@ const Hl = w`
|
|
17379
17379
|
},
|
17380
17380
|
context: t
|
17381
17381
|
}), Fd = async (r, t, e) => (await y.getShadowGraphqlClient().query({
|
17382
|
-
query:
|
17382
|
+
query: Pa,
|
17383
17383
|
errorPolicy: "all",
|
17384
17384
|
fetchPolicy: "no-cache",
|
17385
17385
|
variables: {
|
@@ -17399,7 +17399,7 @@ const Hl = w`
|
|
17399
17399
|
limit: t
|
17400
17400
|
}
|
17401
17401
|
}))?.data.customerTransactionsFeed?.items || [], xd = async (r, t, e) => (await y.getShadowGraphqlClient().query({
|
17402
|
-
query:
|
17402
|
+
query: Pa,
|
17403
17403
|
errorPolicy: "all",
|
17404
17404
|
fetchPolicy: "no-cache",
|
17405
17405
|
variables: {
|
@@ -17419,7 +17419,7 @@ const Hl = w`
|
|
17419
17419
|
limit: t
|
17420
17420
|
}
|
17421
17421
|
}))?.data.customerTransactionsFeed?.items || [], kd = async (r, t, e) => (await y.getShadowGraphqlClient().query({
|
17422
|
-
query:
|
17422
|
+
query: Pa,
|
17423
17423
|
errorPolicy: "all",
|
17424
17424
|
fetchPolicy: "no-cache",
|
17425
17425
|
variables: {
|
@@ -17466,44 +17466,44 @@ K = { __e: function(r, t, e, a) {
|
|
17466
17466
|
}
|
17467
17467
|
throw r;
|
17468
17468
|
} }, typeof Promise == "function" && Promise.prototype.then.bind(Promise.resolve());
|
17469
|
-
var st,
|
17469
|
+
var st, Xe, Za, sr = [], Ze = [], tn = K.__b, en = K.__r, an = K.diffed, nn = K.__c, rn = K.unmount;
|
17470
17470
|
function ac() {
|
17471
17471
|
for (var r; r = sr.shift(); )
|
17472
17472
|
if (r.__P && r.__H)
|
17473
17473
|
try {
|
17474
|
-
r.__H.__h.forEach(we), r.__H.__h.forEach(
|
17474
|
+
r.__H.__h.forEach(we), r.__H.__h.forEach(da), r.__H.__h = [];
|
17475
17475
|
} catch (t) {
|
17476
17476
|
r.__H.__h = [], K.__e(t, r.__v);
|
17477
17477
|
}
|
17478
17478
|
}
|
17479
17479
|
K.__b = function(r) {
|
17480
|
-
st = null,
|
17480
|
+
st = null, tn && tn(r);
|
17481
17481
|
}, K.__r = function(r) {
|
17482
|
-
|
17482
|
+
en && en(r);
|
17483
17483
|
var t = (st = r.__c).__H;
|
17484
|
-
t && (
|
17485
|
-
e.__N && (e.__ = e.__N), e.__V =
|
17486
|
-
})) : (t.__h.forEach(we), t.__h.forEach(
|
17484
|
+
t && (Xe === st ? (t.__h = [], st.__h = [], t.__.forEach(function(e) {
|
17485
|
+
e.__N && (e.__ = e.__N), e.__V = Ze, e.__N = e.i = void 0;
|
17486
|
+
})) : (t.__h.forEach(we), t.__h.forEach(da), t.__h = [])), Xe = st;
|
17487
17487
|
}, K.diffed = function(r) {
|
17488
|
-
|
17488
|
+
an && an(r);
|
17489
17489
|
var t = r.__c;
|
17490
|
-
t && t.__H && (t.__H.__h.length && (sr.push(t) !== 1 &&
|
17491
|
-
e.i && (e.__H = e.i), e.__V !==
|
17492
|
-
})),
|
17490
|
+
t && t.__H && (t.__H.__h.length && (sr.push(t) !== 1 && Za === K.requestAnimationFrame || ((Za = K.requestAnimationFrame) || nc)(ac)), t.__H.__.forEach(function(e) {
|
17491
|
+
e.i && (e.__H = e.i), e.__V !== Ze && (e.__ = e.__V), e.i = void 0, e.__V = Ze;
|
17492
|
+
})), Xe = st = null;
|
17493
17493
|
}, K.__c = function(r, t) {
|
17494
17494
|
t.some(function(e) {
|
17495
17495
|
try {
|
17496
17496
|
e.__h.forEach(we), e.__h = e.__h.filter(function(a) {
|
17497
|
-
return !a.__ ||
|
17497
|
+
return !a.__ || da(a);
|
17498
17498
|
});
|
17499
17499
|
} catch (a) {
|
17500
17500
|
t.some(function(n) {
|
17501
17501
|
n.__h && (n.__h = []);
|
17502
17502
|
}), t = [], K.__e(a, e.__v);
|
17503
17503
|
}
|
17504
|
-
}),
|
17504
|
+
}), nn && nn(r, t);
|
17505
17505
|
}, K.unmount = function(r) {
|
17506
|
-
|
17506
|
+
rn && rn(r);
|
17507
17507
|
var t, e = r.__c;
|
17508
17508
|
e && e.__H && (e.__H.__.forEach(function(a) {
|
17509
17509
|
try {
|
@@ -17513,18 +17513,18 @@ K.__b = function(r) {
|
|
17513
17513
|
}
|
17514
17514
|
}), e.__H = void 0, t && K.__e(t, e.__v));
|
17515
17515
|
};
|
17516
|
-
var
|
17516
|
+
var sn = typeof requestAnimationFrame == "function";
|
17517
17517
|
function nc(r) {
|
17518
17518
|
var t, e = function() {
|
17519
|
-
clearTimeout(a),
|
17519
|
+
clearTimeout(a), sn && cancelAnimationFrame(t), setTimeout(r);
|
17520
17520
|
}, a = setTimeout(e, 100);
|
17521
|
-
|
17521
|
+
sn && (t = requestAnimationFrame(e));
|
17522
17522
|
}
|
17523
17523
|
function we(r) {
|
17524
17524
|
var t = st, e = r.__c;
|
17525
17525
|
typeof e == "function" && (r.__c = void 0, e()), st = t;
|
17526
17526
|
}
|
17527
|
-
function
|
17527
|
+
function da(r) {
|
17528
17528
|
var t = st;
|
17529
17529
|
r.__c = r.__(), st = t;
|
17530
17530
|
}
|
@@ -17550,7 +17550,7 @@ const or = w`
|
|
17550
17550
|
}
|
17551
17551
|
missingComponentTypes
|
17552
17552
|
}
|
17553
|
-
`,
|
17553
|
+
`, Da = w`
|
17554
17554
|
${or}
|
17555
17555
|
fragment AddressValidationJobFields on AddressValidationJob {
|
17556
17556
|
id
|
@@ -17563,14 +17563,14 @@ const or = w`
|
|
17563
17563
|
}
|
17564
17564
|
}
|
17565
17565
|
`, rc = w`
|
17566
|
-
${
|
17566
|
+
${Da}
|
17567
17567
|
query GetAddressValidationJobs($ids: [String!]!) {
|
17568
17568
|
addressValidationJobs(ids: $ids) {
|
17569
17569
|
...AddressValidationJobFields
|
17570
17570
|
}
|
17571
17571
|
}
|
17572
17572
|
`, ic = w`
|
17573
|
-
${
|
17573
|
+
${Da}
|
17574
17574
|
query GetRecipientsWithAddressValidationJobs($ids: [String!]!) {
|
17575
17575
|
recipients(ids: $ids) {
|
17576
17576
|
id
|
@@ -17587,7 +17587,7 @@ const or = w`
|
|
17587
17587
|
}
|
17588
17588
|
}
|
17589
17589
|
`, oc = w`
|
17590
|
-
${
|
17590
|
+
${Da}
|
17591
17591
|
mutation BatchValidateRecipientAddress($ids: [String!]!) {
|
17592
17592
|
recipientValidateBatch(ids: $ids) {
|
17593
17593
|
...AddressValidationJobFields
|
@@ -17657,21 +17657,21 @@ const Td = async (r) => {
|
|
17657
17657
|
})).data?.recipientOverrideAddress?.id && (r.getWorkflowManager().getTransaction().addressValidationStatus = An.Overridden);
|
17658
17658
|
};
|
17659
17659
|
export {
|
17660
|
-
|
17660
|
+
ua as AddonHandle,
|
17661
17661
|
dc as AddressValidationJobStatus,
|
17662
17662
|
cc as AddressValidationResultConfirmationLevel,
|
17663
17663
|
An as AddressValidationStatus,
|
17664
17664
|
md as ArrayInput,
|
17665
17665
|
U as AspectType,
|
17666
17666
|
bt as AssetNotFoundError,
|
17667
|
-
|
17667
|
+
ye as AssetType,
|
17668
17668
|
od as BringForwardCommand,
|
17669
17669
|
sd as BringToBackCommand,
|
17670
17670
|
id as BringToFrontCommand,
|
17671
17671
|
Br as BundleDesignCreationCartAddMode,
|
17672
17672
|
N as CanvasCommand,
|
17673
17673
|
Ae as CollectionProduct,
|
17674
|
-
|
17674
|
+
Ka as ColorOptionGlobalPropertyHandle,
|
17675
17675
|
As as CommandContext,
|
17676
17676
|
Ce as ConversionDataType,
|
17677
17677
|
ec as ConversionLocation,
|
@@ -17688,23 +17688,23 @@ export {
|
|
17688
17688
|
gs as FontAlignmentCommand,
|
17689
17689
|
hs as FontColorCommand,
|
17690
17690
|
ms as FontSizeCommand,
|
17691
|
-
|
17691
|
+
Wa as FontSourceCommand,
|
17692
17692
|
Wl as FrameService,
|
17693
17693
|
ql as FrameStep,
|
17694
17694
|
jl as FrameStepHandle,
|
17695
|
-
|
17695
|
+
Ba as GlobalPropertyHandle,
|
17696
17696
|
R as GroupCommand,
|
17697
17697
|
vo as IllustrationStepHandle,
|
17698
|
-
|
17698
|
+
$e as InformationMessageType,
|
17699
17699
|
Fo as InformationStepHandle,
|
17700
|
-
|
17700
|
+
_a as IntegrationProduct,
|
17701
17701
|
Pr as IntegrationType,
|
17702
17702
|
td as LayoutElementFactory,
|
17703
17703
|
x as LayoutElementType,
|
17704
17704
|
Y as LayoutNotFoundError,
|
17705
17705
|
Ht as LayoutRenderingPurpose,
|
17706
17706
|
Eo as MaterialStepHandle,
|
17707
|
-
|
17707
|
+
Ee as MisconfigurationError,
|
17708
17708
|
Sd as MockWorkflowManager,
|
17709
17709
|
bo as ModelStepHandle,
|
17710
17710
|
ko as ModuleStepHandle,
|
@@ -17712,7 +17712,7 @@ export {
|
|
17712
17712
|
rr as ObjectInput,
|
17713
17713
|
xl as ObjectInputType,
|
17714
17714
|
er as OptionGlobalPropertyHandle,
|
17715
|
-
|
17715
|
+
ve as OptionNotFoundError,
|
17716
17716
|
Dt as ParseError,
|
17717
17717
|
Bo as PictureStepHandle,
|
17718
17718
|
Dr as ProductCameraRig,
|
@@ -17731,7 +17731,7 @@ export {
|
|
17731
17731
|
Po as ShapeStepHandle,
|
17732
17732
|
Ir as ShareActionType,
|
17733
17733
|
pd as SpiffCommerceClient,
|
17734
|
-
|
17734
|
+
Se as StakeholderType,
|
17735
17735
|
br as StepAspectType,
|
17736
17736
|
Z as StepHandle,
|
17737
17737
|
v as StepType,
|
@@ -17754,10 +17754,10 @@ export {
|
|
17754
17754
|
Oo as createDesign,
|
17755
17755
|
Jc as currentDirection,
|
17756
17756
|
Oc as dataUrlFromExternalUrl,
|
17757
|
-
|
17757
|
+
Ke as designService,
|
17758
17758
|
fe as determineCorrectFontSizeAndLines,
|
17759
17759
|
qn as digitalContentStepService,
|
17760
|
-
|
17760
|
+
dt as domParser,
|
17761
17761
|
bd as duplicateBundle,
|
17762
17762
|
Bd as duplicateTransaction,
|
17763
17763
|
nt as fetchAsString,
|
@@ -17765,20 +17765,20 @@ export {
|
|
17765
17765
|
$ as findElement,
|
17766
17766
|
Lc as findPmsColors,
|
17767
17767
|
Vt as frameDataCache,
|
17768
|
-
|
17768
|
+
St as frameStepService,
|
17769
17769
|
M as generate,
|
17770
17770
|
nl as generateCommands,
|
17771
17771
|
ot as generateSVGWithUnknownColors,
|
17772
17772
|
Ad as generateStateFromDesignInputSteps,
|
17773
17773
|
Nd as getAddressValidationJobs,
|
17774
|
-
|
17774
|
+
Ne as getAttributesFromArrayBuffer,
|
17775
17775
|
Vc as getAxisAlignedBoundingBox,
|
17776
17776
|
Gl as getBoundedOffsets,
|
17777
17777
|
wd as getBundleThemeConfiguration,
|
17778
17778
|
Id as getCustomer,
|
17779
17779
|
Pd as getCustomerBundles,
|
17780
17780
|
Kc as getElementVertices,
|
17781
|
-
|
17781
|
+
Oe as getFrameData,
|
17782
17782
|
cd as getGlobalPropertyStateForBundle,
|
17783
17783
|
zl as getIntegration,
|
17784
17784
|
Hc as getNEPoint,
|
@@ -17788,7 +17788,7 @@ export {
|
|
17788
17788
|
qc as getPointOfRotation,
|
17789
17789
|
ud as getProductCollections,
|
17790
17790
|
Yc as getSEPoint,
|
17791
|
-
|
17791
|
+
ya as getSvgElement,
|
17792
17792
|
Md as getTemplateBundles,
|
17793
17793
|
kd as getTemplateTransactions,
|
17794
17794
|
fd as getTransaction,
|
@@ -17808,33 +17808,33 @@ export {
|
|
17808
17808
|
Cl as metafieldManager,
|
17809
17809
|
_c as mmPerPixel,
|
17810
17810
|
Hn as modelStepService,
|
17811
|
-
|
17811
|
+
Ca as modifySVGColors,
|
17812
17812
|
Yn as moduleStepService,
|
17813
17813
|
vd as nameBundle,
|
17814
17814
|
Ed as nameTransaction,
|
17815
17815
|
H as optionService,
|
17816
17816
|
Zc as outlineFontsInSvg,
|
17817
17817
|
Od as overrideWorkflowExperienceRecipientAddress,
|
17818
|
-
|
17818
|
+
ut as patternImageDataCache,
|
17819
17819
|
k as persistenceService,
|
17820
17820
|
Jn as pictureStepService,
|
17821
17821
|
$c as pmsToRgb,
|
17822
17822
|
Kn as questionStepService,
|
17823
17823
|
Rc as registerFetchImplementation,
|
17824
17824
|
Qc as registerWindowImplementation,
|
17825
|
-
|
17825
|
+
za as rehydrateSerializedLayout,
|
17826
17826
|
Xr as rgbToPms,
|
17827
17827
|
ce as rotateAroundPoint,
|
17828
|
-
|
17828
|
+
pa as sanitizeSvgTree,
|
17829
17829
|
Gr as setBearerAuthenticationToken,
|
17830
17830
|
Cn as setCanvasModule,
|
17831
17831
|
zt as shapeStepService,
|
17832
17832
|
ys as shortenUrl,
|
17833
|
-
|
17833
|
+
gt as spiffCoreConfiguration,
|
17834
17834
|
dd as stepAspectValuesToDesignInputSteps,
|
17835
|
-
|
17835
|
+
Oa as svgColorValueToDefinition,
|
17836
17836
|
Vn as svgStringDimensions,
|
17837
|
-
|
17837
|
+
ha as svgToDataUrl,
|
17838
17838
|
G as textStepService,
|
17839
17839
|
xs as toast,
|
17840
17840
|
Qd as validateWorkflowExperienceRecipient,
|