@printine/pod-editor 0.1.17 → 0.1.19
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/contracts/api-design.d.ts +8 -0
- package/dist/{design-BF_TXP1X.js → design-BXbmX1Tb.js} +5392 -5374
- package/dist/full-designer.js +3 -2
- package/dist/index.js +4 -4
- package/dist/pixel-map-BvQ0VU_i.js +199 -0
- package/dist/pixi-print-base-CKs4lF7h.js +91 -0
- package/dist/renderer/default-print-color.d.ts +6 -0
- package/dist/renderer/material-preview.d.ts +10 -0
- package/dist/renderer/pixi-print-base.d.ts +11 -0
- package/dist/renderer/render-layer-output.d.ts +3 -0
- package/dist/{semi-interact-editor-CNcIzYjP.js → semi-interact-editor-nZVBXXQn.js} +469 -464
- package/dist/semi-renderer.js +1 -1
- package/dist/style.css +1 -1
- package/docs/DEFAULT_PRINT_COLOR.md +58 -0
- package/package.json +4 -2
- package/dist/pixel-map-7kj7mLV1.js +0 -134
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { LAYER_BLACK_LIST as
|
|
4
|
-
import { P as
|
|
1
|
+
import { jsxs as Ae, jsx as H } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Ge, useRef as S, useState as Z, useCallback as N, useEffect as ie, useImperativeHandle as Je } from "react";
|
|
3
|
+
import { LAYER_BLACK_LIST as Oe, BLEND_MODES_MAP as Ke } from "./engine/constants.js";
|
|
4
|
+
import { P as Ye, h as Qe, r as Ze, i as pe, M as $e, a as je } from "./pixel-map-BvQ0VU_i.js";
|
|
5
5
|
import "./engine/fabric.js";
|
|
6
|
-
import { v4 as
|
|
7
|
-
import { cloneObject as
|
|
8
|
-
import { ImageProcessor as
|
|
9
|
-
import { TemplateProcessor as
|
|
10
|
-
import { TextProcessor as
|
|
11
|
-
import { ResizeManager as
|
|
12
|
-
import { loadOverlaySvgImage as
|
|
13
|
-
import { WorkspaceManager as
|
|
14
|
-
import { HistoryManager as
|
|
15
|
-
import
|
|
6
|
+
import { v4 as et } from "uuid";
|
|
7
|
+
import { cloneObject as G, urlToDataURL as tt } from "./engine/utils/common.js";
|
|
8
|
+
import { ImageProcessor as rt } from "./engine/processors/image.js";
|
|
9
|
+
import { TemplateProcessor as it } from "./engine/processors/template.js";
|
|
10
|
+
import { TextProcessor as st } from "./engine/processors/text.js";
|
|
11
|
+
import { ResizeManager as nt } from "./engine/managers/resize.js";
|
|
12
|
+
import { loadOverlaySvgImage as at, loadImage as ct } from "./engine/utils/image.js";
|
|
13
|
+
import { WorkspaceManager as ot } from "./engine/managers/workspace.js";
|
|
14
|
+
import { HistoryManager as lt } from "./engine/history.js";
|
|
15
|
+
import ht from "./engine/events.js";
|
|
16
16
|
import { fabric as L } from "fabric";
|
|
17
|
-
import { setDefaultControls as
|
|
18
|
-
class
|
|
19
|
-
constructor(e,
|
|
20
|
-
this.imageCache = /* @__PURE__ */ new Map(), this.overlayCache = /* @__PURE__ */ new Map(), this.destroyed = !1, this.deleteObject = (
|
|
21
|
-
if (
|
|
22
|
-
const a = this.canvas._objects.find((n) => n.id ===
|
|
17
|
+
import { setDefaultControls as ut } from "./engine/utils/setting.js";
|
|
18
|
+
class Ie {
|
|
19
|
+
constructor(e, i, r, t = 0.85) {
|
|
20
|
+
this.imageCache = /* @__PURE__ */ new Map(), this.overlayCache = /* @__PURE__ */ new Map(), this.destroyed = !1, this.deleteObject = (s) => {
|
|
21
|
+
if (s) {
|
|
22
|
+
const a = this.canvas._objects.find((n) => n.id === s);
|
|
23
23
|
a && (this.canvas.remove(a), this.revokeImgBlobLink(a));
|
|
24
24
|
} else {
|
|
25
25
|
const a = this.canvas.getActiveObjects();
|
|
@@ -30,8 +30,8 @@ class xe {
|
|
|
30
30
|
this.canvas.requestRenderAll();
|
|
31
31
|
}, this.canvas = new L.Canvas(e, {
|
|
32
32
|
enableRetinaScaling: !0,
|
|
33
|
-
width:
|
|
34
|
-
height:
|
|
33
|
+
width: i.width,
|
|
34
|
+
height: i.height,
|
|
35
35
|
preserveObjectStacking: !0,
|
|
36
36
|
stopContextMenu: !1,
|
|
37
37
|
centeredRotation: !0,
|
|
@@ -43,7 +43,7 @@ class xe {
|
|
|
43
43
|
controlsAboveOverlay: !0,
|
|
44
44
|
fireRightClick: !0
|
|
45
45
|
// 允许识别右键点击
|
|
46
|
-
}), this.overlayScale = t, this.imageProcessor = new
|
|
46
|
+
}), this.overlayScale = t, this.imageProcessor = new rt(this), this.templateProcessor = new it(this), this.textProcessor = new st(this), this.resizeManager = new nt(this, r), this.workspaceManager = new ot(this);
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* ImageProcessor/TextProcessor are shared with the interactive editor and
|
|
@@ -65,8 +65,8 @@ class xe {
|
|
|
65
65
|
* @param changeView 是否切换视图,如果为true,则需要重新设置画布和背景图
|
|
66
66
|
|
|
67
67
|
*/
|
|
68
|
-
async renderOverlayImage(e,
|
|
69
|
-
const { image: r, clipPath: t } = await this.getOverlayImage(e.image),
|
|
68
|
+
async renderOverlayImage(e, i = !1) {
|
|
69
|
+
const { image: r, clipPath: t } = await this.getOverlayImage(e.image), s = Math.min(this.canvas.width, this.canvas.height) * this.overlayScale, a = s / r.width, n = s / r.height, c = Math.min(a, n);
|
|
70
70
|
return r.set({
|
|
71
71
|
scaleX: c,
|
|
72
72
|
scaleY: c,
|
|
@@ -81,7 +81,7 @@ class xe {
|
|
|
81
81
|
absolutePositioned: !0,
|
|
82
82
|
selectable: !1,
|
|
83
83
|
evented: !1
|
|
84
|
-
}),
|
|
84
|
+
}), i && this.canvas.setViewportTransform([1, 0, 0, 1, 0, 0]), new Promise((o) => {
|
|
85
85
|
this.canvas.setOverlayImage(r, async () => {
|
|
86
86
|
this.workspaceManager.setClipPath(t ?? r, {
|
|
87
87
|
width: r.width,
|
|
@@ -95,25 +95,25 @@ class xe {
|
|
|
95
95
|
* 会返回深拷贝,确保不同视图间互不影响
|
|
96
96
|
*/
|
|
97
97
|
async getOverlayImage(e) {
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
100
|
-
const a = await
|
|
98
|
+
const i = this.overlayCache.get(e);
|
|
99
|
+
if (i) {
|
|
100
|
+
const a = await G(i.image), n = i.clipPath ? await G(i.clipPath) : void 0;
|
|
101
101
|
return { image: a, clipPath: n };
|
|
102
102
|
}
|
|
103
|
-
const r = await
|
|
103
|
+
const r = await at(e);
|
|
104
104
|
this.overlayCache.set(e, r);
|
|
105
|
-
const t = await
|
|
106
|
-
return { image: t, clipPath:
|
|
105
|
+
const t = await G(r.image), s = r.clipPath ? await G(r.clipPath) : void 0;
|
|
106
|
+
return { image: t, clipPath: s };
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* 绘制可设计区域边框,优先使用 clipPath 的真实形状
|
|
110
110
|
*/
|
|
111
|
-
setupOverlayBorders(e,
|
|
111
|
+
setupOverlayBorders(e, i) {
|
|
112
112
|
this.overlayBorderHandler && this.canvas.off("after:render", this.overlayBorderHandler);
|
|
113
|
-
const r =
|
|
113
|
+
const r = i ?? e;
|
|
114
114
|
this.overlayBorderHandler = () => {
|
|
115
|
-
const t = this.canvas.getContext(),
|
|
116
|
-
t.save(), t.transform(
|
|
115
|
+
const t = this.canvas.getContext(), s = this.canvas.viewportTransform || [1, 0, 0, 1, 0, 0];
|
|
116
|
+
t.save(), t.transform(s[0], s[1], s[2], s[3], s[4], s[5]);
|
|
117
117
|
const a = {
|
|
118
118
|
stroke: r.stroke,
|
|
119
119
|
strokeWidth: r.strokeWidth,
|
|
@@ -129,13 +129,13 @@ class xe {
|
|
|
129
129
|
strokeUniform: !0,
|
|
130
130
|
objectCaching: !1
|
|
131
131
|
}), r.render(t);
|
|
132
|
-
const n = 6, c = (r.getScaledWidth() + n * 2) / r.getScaledWidth(), o = (r.getScaledHeight() + n * 2) / r.getScaledHeight(), m = r.left ?? 0, g = r.top ?? 0,
|
|
132
|
+
const n = 6, c = (r.getScaledWidth() + n * 2) / r.getScaledWidth(), o = (r.getScaledHeight() + n * 2) / r.getScaledHeight(), m = r.left ?? 0, g = r.top ?? 0, P = r.scaleX ?? 1, h = r.scaleY ?? 1;
|
|
133
133
|
r.set({
|
|
134
134
|
strokeDashArray: [4, 4],
|
|
135
135
|
stroke: "#C3C3CC",
|
|
136
136
|
strokeWidth: 1,
|
|
137
137
|
strokeUniform: !0,
|
|
138
|
-
scaleX:
|
|
138
|
+
scaleX: P * c,
|
|
139
139
|
scaleY: h * o,
|
|
140
140
|
left: m - n,
|
|
141
141
|
top: g - n
|
|
@@ -145,7 +145,7 @@ class xe {
|
|
|
145
145
|
strokeDashArray: a.strokeDashArray,
|
|
146
146
|
fill: a.fill,
|
|
147
147
|
strokeUniform: a.strokeUniform,
|
|
148
|
-
scaleX:
|
|
148
|
+
scaleX: P,
|
|
149
149
|
scaleY: h,
|
|
150
150
|
left: m,
|
|
151
151
|
top: g
|
|
@@ -182,17 +182,17 @@ class xe {
|
|
|
182
182
|
* 设置背景遮罩
|
|
183
183
|
*/
|
|
184
184
|
async setBackgroundMask(e) {
|
|
185
|
-
const
|
|
186
|
-
if (
|
|
187
|
-
return
|
|
188
|
-
const r = await
|
|
185
|
+
const i = document.querySelector(".lower-canvas");
|
|
186
|
+
if (i && !e)
|
|
187
|
+
return i.style.backgroundImage = "", Promise.resolve();
|
|
188
|
+
const r = await ct(e);
|
|
189
189
|
if (r == null) return Promise.resolve();
|
|
190
190
|
r.set({
|
|
191
191
|
scaleX: this.canvas.width / r.width,
|
|
192
192
|
scaleY: this.canvas.height / r.height
|
|
193
193
|
});
|
|
194
194
|
const t = r.toDataURL({ format: "png" });
|
|
195
|
-
|
|
195
|
+
i && (i.style.backgroundImage = `url(${t})`, i.style.backgroundSize = "100% 100%");
|
|
196
196
|
}
|
|
197
197
|
/**
|
|
198
198
|
* 设置背景颜色、透明图案
|
|
@@ -210,12 +210,12 @@ class xe {
|
|
|
210
210
|
* 获取对象经过画布转换后的实际尺寸
|
|
211
211
|
*/
|
|
212
212
|
getObjectActualSize(e) {
|
|
213
|
-
const { left:
|
|
213
|
+
const { left: i = 0, top: r = 0, width: t = 0, height: s = 0 } = e.getBoundingRect(), a = e.getCenterPoint(), n = this.canvas.viewportTransform;
|
|
214
214
|
return {
|
|
215
|
-
left:
|
|
215
|
+
left: i * n[0] + n[4],
|
|
216
216
|
top: r * n[3] + n[5],
|
|
217
217
|
width: t * n[0],
|
|
218
|
-
height:
|
|
218
|
+
height: s * n[3],
|
|
219
219
|
centerX: a.x * n[0] + n[4],
|
|
220
220
|
centerY: a.y * n[3] + n[5]
|
|
221
221
|
};
|
|
@@ -224,29 +224,29 @@ class xe {
|
|
|
224
224
|
* 添加对象
|
|
225
225
|
*
|
|
226
226
|
*/
|
|
227
|
-
addObject(e,
|
|
227
|
+
addObject(e, i = !0) {
|
|
228
228
|
e.set({
|
|
229
|
-
id:
|
|
230
|
-
}), this.canvas.add(e),
|
|
229
|
+
id: et()
|
|
230
|
+
}), this.canvas.add(e), i && this.canvas.setActiveObject(e);
|
|
231
231
|
}
|
|
232
232
|
/**
|
|
233
233
|
* 恢复对象
|
|
234
234
|
*/
|
|
235
235
|
async restoreObject(e) {
|
|
236
|
-
return new Promise((
|
|
237
|
-
L.util.enlivenObjects([e], (r) =>
|
|
236
|
+
return new Promise((i) => {
|
|
237
|
+
L.util.enlivenObjects([e], (r) => i(r), "");
|
|
238
238
|
});
|
|
239
239
|
}
|
|
240
240
|
/**
|
|
241
241
|
* 半定制文本更新:如果存在 originalWidth / originalHeight,则按固定框重新计算 fitScale;
|
|
242
242
|
* 否则只更新文本内容/字体等基础属性。
|
|
243
243
|
*/
|
|
244
|
-
async updateText(e,
|
|
244
|
+
async updateText(e, i) {
|
|
245
245
|
if (!(typeof e?.type == "string" && (e.type.includes("i-text") || e.type === "text"))) return null;
|
|
246
|
-
await this.textProcessor.ensureFontLoaded(
|
|
246
|
+
await this.textProcessor.ensureFontLoaded(i);
|
|
247
247
|
const [t] = await this.restoreObject(e);
|
|
248
248
|
if (!t) return null;
|
|
249
|
-
const
|
|
249
|
+
const s = e.scaleX || 1, a = e.scaleY || 1, n = e?.customConfig, c = typeof n?.originalWidth == "number" && n.originalWidth > 0 && typeof n?.originalHeight == "number" && n.originalHeight > 0 && !n.moveable, o = t.type === "advanced-i-text" && t.radius, m = () => ({
|
|
250
250
|
...typeof t.__baseWidth < "u" ? { __baseWidth: t.__baseWidth } : {},
|
|
251
251
|
...typeof t.__baseHeight < "u" ? { __baseHeight: t.__baseHeight } : {},
|
|
252
252
|
...typeof t.__basePadding < "u" ? { __basePadding: t.__basePadding } : {},
|
|
@@ -263,14 +263,14 @@ class xe {
|
|
|
263
263
|
...typeof t.spacing < "u" ? { spacing: t.spacing } : {}
|
|
264
264
|
});
|
|
265
265
|
if (!c) {
|
|
266
|
-
const
|
|
267
|
-
t.set(
|
|
266
|
+
const y = o ? t.getCenterPoint() : null;
|
|
267
|
+
t.set(i), o && (t.__restoredGeometry = !1);
|
|
268
268
|
try {
|
|
269
269
|
t.initDimensions?.();
|
|
270
270
|
} catch {
|
|
271
271
|
}
|
|
272
|
-
return
|
|
273
|
-
...
|
|
272
|
+
return y && t.setPositionByOrigin(y, "center", "center"), t.setCoords(), {
|
|
273
|
+
...i,
|
|
274
274
|
text: t.text,
|
|
275
275
|
left: t.left,
|
|
276
276
|
top: t.top,
|
|
@@ -285,31 +285,31 @@ class xe {
|
|
|
285
285
|
...m()
|
|
286
286
|
};
|
|
287
287
|
}
|
|
288
|
-
const g = e?.__semiTargetInfo,
|
|
288
|
+
const g = e?.__semiTargetInfo, P = !!g && typeof g.width == "number" && g.width > 0 && typeof g.height == "number" && g.height > 0 && typeof g.centerX == "number" && typeof g.centerY == "number";
|
|
289
289
|
let h;
|
|
290
|
-
if (
|
|
291
|
-
const
|
|
290
|
+
if (P) {
|
|
291
|
+
const y = t.getCenterPoint();
|
|
292
292
|
h = {
|
|
293
293
|
width: n.originalWidth,
|
|
294
294
|
height: n.originalHeight,
|
|
295
|
-
centerX: typeof g.centerX == "number" ? g.centerX :
|
|
296
|
-
centerY: typeof g.centerY == "number" ? g.centerY :
|
|
297
|
-
signX: typeof g.signX == "number" && g.signX !== 0 ? Math.sign(g.signX) : Math.sign(
|
|
295
|
+
centerX: typeof g.centerX == "number" ? g.centerX : y.x,
|
|
296
|
+
centerY: typeof g.centerY == "number" ? g.centerY : y.y,
|
|
297
|
+
signX: typeof g.signX == "number" && g.signX !== 0 ? Math.sign(g.signX) : Math.sign(s) || 1,
|
|
298
298
|
signY: typeof g.signY == "number" && g.signY !== 0 ? Math.sign(g.signY) : Math.sign(a) || 1
|
|
299
299
|
};
|
|
300
300
|
} else {
|
|
301
|
-
const
|
|
301
|
+
const y = t.getCenterPoint();
|
|
302
302
|
h = {
|
|
303
303
|
width: n.originalWidth,
|
|
304
304
|
height: n.originalHeight,
|
|
305
|
-
centerX:
|
|
306
|
-
centerY:
|
|
307
|
-
signX: Math.sign(
|
|
305
|
+
centerX: y.x,
|
|
306
|
+
centerY: y.y,
|
|
307
|
+
signX: Math.sign(s) || 1,
|
|
308
308
|
signY: Math.sign(a) || 1
|
|
309
309
|
};
|
|
310
310
|
}
|
|
311
311
|
t.set({
|
|
312
|
-
...
|
|
312
|
+
...i,
|
|
313
313
|
scaleX: h.signX,
|
|
314
314
|
scaleY: h.signY
|
|
315
315
|
}), o && (t.__restoredGeometry = !1);
|
|
@@ -319,12 +319,12 @@ class xe {
|
|
|
319
319
|
}
|
|
320
320
|
t.setCoords();
|
|
321
321
|
const X = t.getBoundingRect(!0, !0), x = Math.max(1, X.width || 1), A = Math.max(1, X.height || 1);
|
|
322
|
-
let
|
|
323
|
-
return (!Number.isFinite(
|
|
324
|
-
scaleX:
|
|
325
|
-
scaleY:
|
|
322
|
+
let M = Math.min(h.width / x, h.height / A);
|
|
323
|
+
return (!Number.isFinite(M) || M <= 0) && (M = 1), t.set({
|
|
324
|
+
scaleX: M * h.signX,
|
|
325
|
+
scaleY: M * h.signY
|
|
326
326
|
}), t.setPositionByOrigin(new L.Point(h.centerX, h.centerY), "center", "center"), t.setCoords(), {
|
|
327
|
-
...
|
|
327
|
+
...i,
|
|
328
328
|
text: t.text,
|
|
329
329
|
left: t.left,
|
|
330
330
|
top: t.top,
|
|
@@ -343,31 +343,31 @@ class xe {
|
|
|
343
343
|
/**
|
|
344
344
|
* 半定制图片替换:使用 cover 模式重新计算缩放,保持原始占位框中心不变。
|
|
345
345
|
*/
|
|
346
|
-
async updateImage(e,
|
|
346
|
+
async updateImage(e, i) {
|
|
347
347
|
if (e?.type !== "image") return null;
|
|
348
|
-
const r =
|
|
348
|
+
const r = i.src;
|
|
349
349
|
if (!r) return null;
|
|
350
350
|
const [t] = await this.restoreObject(e);
|
|
351
351
|
if (!t) return null;
|
|
352
|
-
const
|
|
352
|
+
const s = t, a = e.scaleX || 1, n = e.scaleY || 1, c = e.width || 1, o = e.height || 1, m = c * Math.abs(a), g = o * Math.abs(n), P = t.getCenterPoint();
|
|
353
353
|
return new Promise((h) => {
|
|
354
|
-
|
|
355
|
-
const X =
|
|
356
|
-
|
|
357
|
-
...
|
|
354
|
+
s.setSrc(r, () => {
|
|
355
|
+
const X = s.width || 1, x = s.height || 1, A = Math.max(m / X, g / x);
|
|
356
|
+
s.set({
|
|
357
|
+
...i,
|
|
358
358
|
scaleX: A * Math.sign(a),
|
|
359
359
|
scaleY: A * Math.sign(n)
|
|
360
|
-
}),
|
|
361
|
-
...
|
|
360
|
+
}), s.setPositionByOrigin(P, "center", "center"), s.setCoords(), h({
|
|
361
|
+
...i,
|
|
362
362
|
width: X,
|
|
363
363
|
height: x,
|
|
364
|
-
left:
|
|
365
|
-
top:
|
|
366
|
-
scaleX:
|
|
367
|
-
scaleY:
|
|
368
|
-
angle:
|
|
369
|
-
originX:
|
|
370
|
-
originY:
|
|
364
|
+
left: s.left,
|
|
365
|
+
top: s.top,
|
|
366
|
+
scaleX: s.scaleX,
|
|
367
|
+
scaleY: s.scaleY,
|
|
368
|
+
angle: s.angle,
|
|
369
|
+
originX: s.originX,
|
|
370
|
+
originY: s.originY,
|
|
371
371
|
selectable: e.selectable
|
|
372
372
|
});
|
|
373
373
|
});
|
|
@@ -379,10 +379,10 @@ class xe {
|
|
|
379
379
|
*/
|
|
380
380
|
revokeImgBlobLink(e) {
|
|
381
381
|
if (e.type === "image" && e.getSrc) {
|
|
382
|
-
const
|
|
382
|
+
const i = e, r = i.getSrc(), t = i.originSrc || r;
|
|
383
383
|
if (r && r.startsWith("blob:")) {
|
|
384
|
-
const
|
|
385
|
-
if (!
|
|
384
|
+
const s = this.imageCache.get(t);
|
|
385
|
+
if (!s || s.blobUrl !== r)
|
|
386
386
|
try {
|
|
387
387
|
URL.revokeObjectURL(r);
|
|
388
388
|
} catch {
|
|
@@ -395,14 +395,14 @@ class xe {
|
|
|
395
395
|
* @param {String} id 对象id
|
|
396
396
|
* @param {Record<string, any>} obj 对象属性集合
|
|
397
397
|
*/
|
|
398
|
-
updateObject(e,
|
|
398
|
+
updateObject(e, i) {
|
|
399
399
|
const r = this.canvas._objects.find((t) => t.id === e);
|
|
400
400
|
if (r) {
|
|
401
|
-
if (
|
|
402
|
-
r.rotate(
|
|
403
|
-
else if (
|
|
404
|
-
const { left: t, right:
|
|
405
|
-
switch (
|
|
401
|
+
if (i.hasOwnProperty("angle"))
|
|
402
|
+
r.rotate(i.angle);
|
|
403
|
+
else if (i.hasOwnProperty("align")) {
|
|
404
|
+
const { left: t, right: s, top: a, bottom: n, center: c } = this.workspaceManager.dimension, o = r.getBoundingRect(!0, !0);
|
|
405
|
+
switch (i.align) {
|
|
406
406
|
case "top":
|
|
407
407
|
r.set({
|
|
408
408
|
top: r.top + (a - o.top)
|
|
@@ -420,7 +420,7 @@ class xe {
|
|
|
420
420
|
break;
|
|
421
421
|
case "right":
|
|
422
422
|
r.set({
|
|
423
|
-
left: r.left + (
|
|
423
|
+
left: r.left + (s - (o.left + o.width))
|
|
424
424
|
});
|
|
425
425
|
break;
|
|
426
426
|
case "vertical-center":
|
|
@@ -434,16 +434,16 @@ class xe {
|
|
|
434
434
|
});
|
|
435
435
|
break;
|
|
436
436
|
}
|
|
437
|
-
} else if (
|
|
438
|
-
this.canvas.moveTo(r,
|
|
439
|
-
else if (
|
|
440
|
-
this.updateObjectScale(r,
|
|
441
|
-
else if (
|
|
442
|
-
const t =
|
|
437
|
+
} else if (i.hasOwnProperty("zIndex"))
|
|
438
|
+
this.canvas.moveTo(r, i.zIndex);
|
|
439
|
+
else if (i.hasOwnProperty("scale"))
|
|
440
|
+
this.updateObjectScale(r, i.scale);
|
|
441
|
+
else if (i.hasOwnProperty("width") || i.hasOwnProperty("height")) {
|
|
442
|
+
const t = i.hasOwnProperty("width") ? r.width : r.height, a = (i.width || i.height) / t * this.workspaceManager.scale;
|
|
443
443
|
this.updateObjectScale(r, a);
|
|
444
444
|
} else
|
|
445
|
-
r.set(
|
|
446
|
-
r.setCoords(), this.canvas.requestRenderAll(),
|
|
445
|
+
r.set(i);
|
|
446
|
+
r.setCoords(), this.canvas.requestRenderAll(), i.hasOwnProperty("selectable") || this.canvas.fire("object:modified", {
|
|
447
447
|
target: r
|
|
448
448
|
});
|
|
449
449
|
}
|
|
@@ -451,17 +451,17 @@ class xe {
|
|
|
451
451
|
/**
|
|
452
452
|
* 对象缩放
|
|
453
453
|
*/
|
|
454
|
-
updateObjectScale(e,
|
|
454
|
+
updateObjectScale(e, i) {
|
|
455
455
|
const r = e.getCenterPoint(), t = this.workspaceManager.dimension.width * 0.01 / e.width;
|
|
456
|
-
e.scale(
|
|
456
|
+
e.scale(i < t ? t : i), e.setPositionByOrigin(r, "center", "center");
|
|
457
457
|
}
|
|
458
458
|
/**
|
|
459
459
|
* 修改画布上的对象的选中状态和事件状态
|
|
460
460
|
* @param status
|
|
461
461
|
*/
|
|
462
462
|
updateObjectsEvents(e) {
|
|
463
|
-
this.canvas.forEachObject((
|
|
464
|
-
|
|
463
|
+
this.canvas.forEachObject((i) => {
|
|
464
|
+
i.set({
|
|
465
465
|
selectable: e,
|
|
466
466
|
evented: e
|
|
467
467
|
});
|
|
@@ -471,21 +471,21 @@ class xe {
|
|
|
471
471
|
* 获取当前可选择的对象,不包括背景图、裁剪区域
|
|
472
472
|
*/
|
|
473
473
|
getLayerList() {
|
|
474
|
-
return this.canvas._objects.filter((e) => !
|
|
474
|
+
return this.canvas._objects.filter((e) => !Oe.includes(e.id || ""));
|
|
475
475
|
}
|
|
476
476
|
/**
|
|
477
477
|
* 设置当前选中的对象
|
|
478
478
|
*/
|
|
479
479
|
setActiveObject(e) {
|
|
480
|
-
const
|
|
481
|
-
t && (this.canvas.discardActiveObject(), (!r ||
|
|
480
|
+
const i = this.canvas.getActiveObjects(), r = i.some((s) => s.id === e), t = this.getLayerList().find((s) => s.id === e);
|
|
481
|
+
t && (this.canvas.discardActiveObject(), (!r || i.length > 1) && this.canvas.setActiveObject(t), this.canvas.requestRenderAll());
|
|
482
482
|
}
|
|
483
483
|
/**
|
|
484
484
|
* 同时选中多个对象
|
|
485
485
|
*/
|
|
486
486
|
setActiveObjects(e) {
|
|
487
|
-
const
|
|
488
|
-
this.canvas.setActiveObject(
|
|
487
|
+
const i = new L.ActiveSelection(e, { canvas: this.canvas });
|
|
488
|
+
this.canvas.setActiveObject(i), this.canvas.requestRenderAll();
|
|
489
489
|
}
|
|
490
490
|
/**
|
|
491
491
|
* 以画布中心点缩放画布
|
|
@@ -494,7 +494,7 @@ class xe {
|
|
|
494
494
|
if (e === 1)
|
|
495
495
|
this.canvas.setViewportTransform([1, 0, 0, 1, 0, 0]);
|
|
496
496
|
else {
|
|
497
|
-
const
|
|
497
|
+
const i = this.canvas.viewportTransform, r = i[0], t = i[4], s = i[5], a = this.canvas.width / 2, n = this.canvas.height / 2, c = e - r, o = t - a * c, m = s - n * c;
|
|
498
498
|
this.canvas.setViewportTransform([e, 0, 0, e, o, m]);
|
|
499
499
|
}
|
|
500
500
|
this.canvas.requestRenderAll();
|
|
@@ -503,14 +503,14 @@ class xe {
|
|
|
503
503
|
* 获取当前画布上渲染的对象
|
|
504
504
|
*/
|
|
505
505
|
getRenderedObjects() {
|
|
506
|
-
const { objects: e } = this.canvas.toJSON(
|
|
506
|
+
const { objects: e } = this.canvas.toJSON(lt.DEFAULT_SAVE_PROPERTIES), i = this.workspaceManager.dimension;
|
|
507
507
|
return {
|
|
508
|
-
objects: e.filter((r) => !
|
|
508
|
+
objects: e.filter((r) => !Oe.includes(r.id || "")),
|
|
509
509
|
workspaceMetadata: {
|
|
510
|
-
width:
|
|
511
|
-
height:
|
|
512
|
-
centerX:
|
|
513
|
-
centerY:
|
|
510
|
+
width: i.width,
|
|
511
|
+
height: i.height,
|
|
512
|
+
centerX: i.center.x,
|
|
513
|
+
centerY: i.center.y
|
|
514
514
|
}
|
|
515
515
|
};
|
|
516
516
|
}
|
|
@@ -524,34 +524,34 @@ class xe {
|
|
|
524
524
|
* 将图片对象的 clipPath 重新关联到画布上的对象
|
|
525
525
|
*/
|
|
526
526
|
relinkClipPaths() {
|
|
527
|
-
const e = /* @__PURE__ */ new Map(),
|
|
528
|
-
const a =
|
|
529
|
-
a && e.set(String(a),
|
|
527
|
+
const e = /* @__PURE__ */ new Map(), i = this.canvas.getObjects(), r = (s) => {
|
|
528
|
+
const a = s.id;
|
|
529
|
+
a && e.set(String(a), s), s.type === "group" && s._objects?.forEach(r);
|
|
530
530
|
};
|
|
531
|
-
|
|
532
|
-
const t = (
|
|
533
|
-
const n =
|
|
531
|
+
i.forEach(r);
|
|
532
|
+
const t = (s) => {
|
|
533
|
+
const n = s.clipPath?.id;
|
|
534
534
|
if (n && e.has(String(n))) {
|
|
535
535
|
const c = e.get(String(n));
|
|
536
|
-
c.set({ absolutePositioned: !0 }),
|
|
536
|
+
c.set({ absolutePositioned: !0 }), s.set("clipPath", c), s.dirty = !0;
|
|
537
537
|
}
|
|
538
|
-
|
|
538
|
+
s.type === "group" && s._objects?.forEach(t);
|
|
539
539
|
};
|
|
540
|
-
|
|
540
|
+
i.forEach(t);
|
|
541
541
|
}
|
|
542
542
|
/**
|
|
543
543
|
* 切换视图,重新渲染画布
|
|
544
544
|
*/
|
|
545
|
-
async switchView(e,
|
|
545
|
+
async switchView(e, i, r) {
|
|
546
546
|
if (this.canvas.clear(), r && r.objects && r.objects.length)
|
|
547
547
|
return await this.textProcessor.preloadFontsFromState(r), new Promise((t) => {
|
|
548
548
|
this.canvas.loadFromJSON(
|
|
549
549
|
r,
|
|
550
550
|
async () => {
|
|
551
|
-
this.relinkClipPaths(), await this.renderOverlayImage(e, !0), await this.setBackground(
|
|
552
|
-
const
|
|
553
|
-
|
|
554
|
-
|
|
551
|
+
this.relinkClipPaths(), await this.renderOverlayImage(e, !0), await this.setBackground(i), r.workspaceMetadata && this._scaleObjectsToWorkspace(r.workspaceMetadata);
|
|
552
|
+
const s = this.canvas.getObjects().filter((a) => a.type === "image");
|
|
553
|
+
s.length > 0 && await Promise.all(
|
|
554
|
+
s.map((a) => new Promise((n) => {
|
|
555
555
|
const c = a.getElement(), o = a.getSrc() || a.originSrc;
|
|
556
556
|
if (!o) {
|
|
557
557
|
n();
|
|
@@ -563,11 +563,11 @@ class xe {
|
|
|
563
563
|
n();
|
|
564
564
|
}) : n();
|
|
565
565
|
}))
|
|
566
|
-
), this.canvas.renderAll(),
|
|
566
|
+
), this.canvas.renderAll(), ht.emit("design:layerChange"), t();
|
|
567
567
|
},
|
|
568
|
-
(
|
|
569
|
-
|
|
570
|
-
[
|
|
568
|
+
(s, a) => {
|
|
569
|
+
s.clipPath && !r.objects.some((n) => n.id === s.clipPath.id) && (delete a.clipPath, L.util.enlivenObjects(
|
|
570
|
+
[s.clipPath],
|
|
571
571
|
(n) => {
|
|
572
572
|
const c = n[0];
|
|
573
573
|
c && (a.set("clipPath", c), a.dirty = !0, this.canvas.requestRenderAll());
|
|
@@ -577,7 +577,7 @@ class xe {
|
|
|
577
577
|
}
|
|
578
578
|
);
|
|
579
579
|
});
|
|
580
|
-
await this.renderOverlayImage(e, !0), await this.setBackground(
|
|
580
|
+
await this.renderOverlayImage(e, !0), await this.setBackground(i), r && r.object && await this.imageProcessor.addBitmapImage(r.object);
|
|
581
581
|
}
|
|
582
582
|
/**
|
|
583
583
|
* 半定制固定文本在修改内容/字体后,按 originalWidth/originalHeight 重新计算自适应缩放。
|
|
@@ -587,33 +587,33 @@ class xe {
|
|
|
587
587
|
* 根据 workspace 尺寸变化,按比例缩放所有对象
|
|
588
588
|
*/
|
|
589
589
|
_scaleObjectsToWorkspace(e) {
|
|
590
|
-
const
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
), t = e.centerX,
|
|
590
|
+
const i = this.workspaceManager.dimension, r = Math.min(
|
|
591
|
+
i.width / e.width,
|
|
592
|
+
i.height / e.height
|
|
593
|
+
), t = e.centerX, s = e.centerY, a = i.center.x, n = i.center.y, c = Math.abs(a - t), o = Math.abs(n - s), m = Math.abs(r - 1) >= 1e-3, g = c >= 0.1 || o >= 0.1;
|
|
594
594
|
if (!m && !g) return;
|
|
595
|
-
const
|
|
595
|
+
const P = this.canvas.getObjects(), h = new Set(P), X = /* @__PURE__ */ new Set(), x = (f) => {
|
|
596
596
|
const u = f.clipPath;
|
|
597
597
|
u && h.has(u) && X.add(u);
|
|
598
598
|
};
|
|
599
|
-
|
|
599
|
+
P.forEach(x);
|
|
600
600
|
const A = (f) => {
|
|
601
|
-
const u = (f.left || 0) - t, T = (f.top || 0) -
|
|
601
|
+
const u = (f.left || 0) - t, T = (f.top || 0) - s, W = a + u * r, l = n + T * r;
|
|
602
602
|
f.set({
|
|
603
603
|
left: W,
|
|
604
604
|
top: l,
|
|
605
605
|
scaleX: (f.scaleX || 1) * r,
|
|
606
606
|
scaleY: (f.scaleY || 1) * r
|
|
607
607
|
}), f.setCoords(), f.dirty = !0;
|
|
608
|
-
},
|
|
609
|
-
!f.selectable && !X.has(f) || (A(f),
|
|
608
|
+
}, M = /* @__PURE__ */ new Set(), y = (f) => {
|
|
609
|
+
!f.selectable && !X.has(f) || (A(f), M.add(f));
|
|
610
610
|
};
|
|
611
|
-
|
|
612
|
-
const
|
|
611
|
+
P.forEach(y);
|
|
612
|
+
const B = (f) => {
|
|
613
613
|
const u = f.clipPath;
|
|
614
|
-
u && u.absolutePositioned && !h.has(u) && !
|
|
614
|
+
u && u.absolutePositioned && !h.has(u) && !M.has(u) && (A(u), M.add(u));
|
|
615
615
|
};
|
|
616
|
-
|
|
616
|
+
P.forEach(B);
|
|
617
617
|
}
|
|
618
618
|
/**
|
|
619
619
|
* 计算对象相对于画布的全局变换矩阵(包括父组的影响)
|
|
@@ -625,10 +625,10 @@ class xe {
|
|
|
625
625
|
* 判断对象是否位于 activeSelection 中
|
|
626
626
|
*/
|
|
627
627
|
isInActiveSelection(e) {
|
|
628
|
-
let
|
|
629
|
-
for (;
|
|
630
|
-
if (
|
|
631
|
-
|
|
628
|
+
let i = e.group;
|
|
629
|
+
for (; i; ) {
|
|
630
|
+
if (i.type === "activeSelection") return !0;
|
|
631
|
+
i = i.group;
|
|
632
632
|
}
|
|
633
633
|
return !1;
|
|
634
634
|
}
|
|
@@ -638,12 +638,12 @@ class xe {
|
|
|
638
638
|
* @param img fabric.Image 对象
|
|
639
639
|
* @param blobUrl 可选的 blob URL(用于撤销/重做)
|
|
640
640
|
*/
|
|
641
|
-
registerImageCache(e,
|
|
641
|
+
registerImageCache(e, i, r) {
|
|
642
642
|
if (!e || e.startsWith("data:")) return;
|
|
643
|
-
const t =
|
|
643
|
+
const t = i.getElement(), s = this.imageCache.get(e);
|
|
644
644
|
this.imageCache.set(e, {
|
|
645
645
|
element: t,
|
|
646
|
-
blobUrl: r ||
|
|
646
|
+
blobUrl: r || s?.blobUrl,
|
|
647
647
|
lastUsed: Date.now()
|
|
648
648
|
});
|
|
649
649
|
}
|
|
@@ -674,30 +674,30 @@ class xe {
|
|
|
674
674
|
async getCachedDataURL(e) {
|
|
675
675
|
if (!e)
|
|
676
676
|
return "";
|
|
677
|
-
const
|
|
678
|
-
if (
|
|
677
|
+
const i = this.imageCache.get(e);
|
|
678
|
+
if (i?.element && i.element.complete) {
|
|
679
679
|
const r = document.createElement("canvas");
|
|
680
|
-
r.width =
|
|
680
|
+
r.width = i.element.naturalWidth || i.element.width, r.height = i.element.naturalHeight || i.element.height;
|
|
681
681
|
const t = r.getContext("2d");
|
|
682
682
|
if (t) {
|
|
683
|
-
t.drawImage(
|
|
684
|
-
const
|
|
685
|
-
return r.width = 0, r.height = 0,
|
|
683
|
+
t.drawImage(i.element, 0, 0);
|
|
684
|
+
const s = r.toDataURL("image/png");
|
|
685
|
+
return r.width = 0, r.height = 0, s;
|
|
686
686
|
}
|
|
687
687
|
return "";
|
|
688
688
|
}
|
|
689
|
-
return await
|
|
689
|
+
return await tt(e);
|
|
690
690
|
}
|
|
691
691
|
/**
|
|
692
692
|
* 从缓存克隆图片,避免重复下载
|
|
693
693
|
*/
|
|
694
|
-
async cloneImageFromCache(e,
|
|
695
|
-
const r = e.getSrc() || "", t = e.originSrc || "",
|
|
694
|
+
async cloneImageFromCache(e, i) {
|
|
695
|
+
const r = e.getSrc() || "", t = e.originSrc || "", s = e.isCropped, a = t || r;
|
|
696
696
|
if (a.startsWith("data:"))
|
|
697
697
|
return new Promise((c) => {
|
|
698
698
|
e.clone(
|
|
699
699
|
(o) => {
|
|
700
|
-
o.set(
|
|
700
|
+
o.set(i), c(o);
|
|
701
701
|
},
|
|
702
702
|
["absolutePositioned"]
|
|
703
703
|
);
|
|
@@ -707,19 +707,19 @@ class xe {
|
|
|
707
707
|
const o = new L.Image(n.element, {
|
|
708
708
|
width: e.width,
|
|
709
709
|
height: e.height,
|
|
710
|
-
...
|
|
710
|
+
...i
|
|
711
711
|
});
|
|
712
712
|
if (e.clipPath)
|
|
713
713
|
try {
|
|
714
|
-
const m = await
|
|
714
|
+
const m = await G(e.clipPath, ["absolutePositioned"]);
|
|
715
715
|
o.set({ clipPath: m });
|
|
716
716
|
} catch {
|
|
717
717
|
}
|
|
718
|
-
|
|
718
|
+
s && (o.isCropped = !0, o.cropBlob = e.cropBlob), c(o);
|
|
719
719
|
}) : new Promise((c) => {
|
|
720
720
|
e.clone(
|
|
721
721
|
(o) => {
|
|
722
|
-
this.registerImageCache(a, o), o.set(
|
|
722
|
+
this.registerImageCache(a, o), o.set(i), s && (o.isCropped = !0, o.cropBlob = e.cropBlob), c(o);
|
|
723
723
|
},
|
|
724
724
|
["absolutePositioned"]
|
|
725
725
|
);
|
|
@@ -733,25 +733,25 @@ class xe {
|
|
|
733
733
|
* overlay and selection controls, capture the existing lower canvas, and
|
|
734
734
|
* scale only the printable workspace to the requested longest edge.
|
|
735
735
|
*/
|
|
736
|
-
async exportPreviewBitmap(e = 600,
|
|
736
|
+
async exportPreviewBitmap(e = 600, i) {
|
|
737
737
|
if (this.destroyed) throw new Error("Canvas is not ready");
|
|
738
|
-
const r = this.workspaceManager.dimension, t = this.workspaceManager.printAreaSize?.width ?? r.width,
|
|
739
|
-
if (!r.width || !r.height || !t || !
|
|
738
|
+
const r = this.workspaceManager.dimension, t = this.workspaceManager.printAreaSize?.width ?? r.width, s = this.workspaceManager.printAreaSize?.height ?? r.height;
|
|
739
|
+
if (!r.width || !r.height || !t || !s)
|
|
740
740
|
throw new Error("Printable workspace has no dimensions");
|
|
741
|
-
const a = Math.max(t,
|
|
741
|
+
const a = Math.max(t, s), n = Math.max(1, e) / a, c = Math.max(1, Math.round(t * n)), o = Math.max(1, Math.round(s * n)), m = this.canvas.viewportTransform?.slice(), g = this.canvas.overlayImage?.visible, P = this.canvas.backgroundColor, h = this.canvas.getActiveObject(), X = h ? { hasBorders: h.hasBorders, hasControls: h.hasControls } : null;
|
|
742
742
|
try {
|
|
743
|
-
this.canvas.overlayImage && (this.canvas.overlayImage.visible = !1), h?.set({ hasBorders: !1, hasControls: !1 }), this.canvas.backgroundColor =
|
|
743
|
+
this.canvas.overlayImage && (this.canvas.overlayImage.visible = !1), h?.set({ hasBorders: !1, hasControls: !1 }), this.canvas.backgroundColor = i || "transparent", this.canvas.viewportTransform = [1, 0, 0, 1, 0, 0], this.canvas.renderAll();
|
|
744
744
|
const x = document.createElement("canvas");
|
|
745
745
|
x.width = c, x.height = o;
|
|
746
746
|
const A = x.getContext("2d", { alpha: !0 });
|
|
747
747
|
if (!A) throw new Error("Could not create preview canvas context");
|
|
748
|
-
const
|
|
748
|
+
const M = this.canvas, y = M.getRetinaScaling?.() ?? window.devicePixelRatio ?? 1;
|
|
749
749
|
A.drawImage(
|
|
750
|
-
|
|
751
|
-
r.left *
|
|
752
|
-
r.top *
|
|
753
|
-
r.width *
|
|
754
|
-
r.height *
|
|
750
|
+
M.lowerCanvasEl,
|
|
751
|
+
r.left * y,
|
|
752
|
+
r.top * y,
|
|
753
|
+
r.width * y,
|
|
754
|
+
r.height * y,
|
|
755
755
|
0,
|
|
756
756
|
0,
|
|
757
757
|
c,
|
|
@@ -763,7 +763,7 @@ class xe {
|
|
|
763
763
|
x.width = 0, x.height = 0;
|
|
764
764
|
}
|
|
765
765
|
} finally {
|
|
766
|
-
this.canvas.backgroundColor =
|
|
766
|
+
this.canvas.backgroundColor = P, this.canvas.overlayImage && g !== void 0 && (this.canvas.overlayImage.visible = g), h && X && h.set(X), m && (this.canvas.viewportTransform = m), this.destroyed || this.canvas.requestRenderAll();
|
|
767
767
|
}
|
|
768
768
|
}
|
|
769
769
|
/**
|
|
@@ -772,9 +772,9 @@ class xe {
|
|
|
772
772
|
* @param {String?} color 背景颜色
|
|
773
773
|
* @returns {Promise<string[]>} SVG 字符串
|
|
774
774
|
*/
|
|
775
|
-
async export(e = !1,
|
|
776
|
-
const t = this.workspaceManager.dimension,
|
|
777
|
-
let
|
|
775
|
+
async export(e = !1, i, r) {
|
|
776
|
+
const t = this.workspaceManager.dimension, s = this.workspaceManager.printAreaSize?.width ?? t.width, a = this.workspaceManager.printAreaSize?.height ?? t.height, n = window.devicePixelRatio || 1, c = Math.max(s / t.width, a / t.height), o = r?.objectCloneMultiplierCap ?? 8, m = Math.max(1, Math.min(r?.minObjectCloneMultiplier ?? 2, o)), g = Math.max(m, Math.min(o, Math.ceil(c * n)));
|
|
777
|
+
let P = new L.Rect({
|
|
778
778
|
left: 0,
|
|
779
779
|
top: 0,
|
|
780
780
|
width: t.width,
|
|
@@ -782,7 +782,7 @@ class xe {
|
|
|
782
782
|
absolutePositioned: !0,
|
|
783
783
|
strokeWidth: 0
|
|
784
784
|
});
|
|
785
|
-
this.canvas.clipPath && (
|
|
785
|
+
this.canvas.clipPath && (P = await G(this.canvas.clipPath, ["absolutePositioned"]), P.set({
|
|
786
786
|
left: this.canvas.clipPath.left - t.left,
|
|
787
787
|
top: this.canvas.clipPath.top - t.top,
|
|
788
788
|
absolutePositioned: !0
|
|
@@ -791,17 +791,17 @@ class xe {
|
|
|
791
791
|
width: t.width,
|
|
792
792
|
height: t.height,
|
|
793
793
|
enableRetinaScaling: !1,
|
|
794
|
-
backgroundColor:
|
|
794
|
+
backgroundColor: i || "transparent",
|
|
795
795
|
preserveObjectStacking: !0,
|
|
796
|
-
clipPath:
|
|
796
|
+
clipPath: P
|
|
797
797
|
}), X = this.getLayerList();
|
|
798
798
|
(await Promise.all(
|
|
799
799
|
X.map(
|
|
800
|
-
(l) => new Promise((
|
|
800
|
+
(l) => new Promise((_) => {
|
|
801
801
|
try {
|
|
802
|
-
const
|
|
802
|
+
const O = l.sourceType === "svg";
|
|
803
803
|
if (l.type === "image") {
|
|
804
|
-
const
|
|
804
|
+
const R = l;
|
|
805
805
|
let p = {
|
|
806
806
|
selectable: !1,
|
|
807
807
|
evented: !1,
|
|
@@ -809,14 +809,14 @@ class xe {
|
|
|
809
809
|
flipY: l.flipY || !1
|
|
810
810
|
};
|
|
811
811
|
if (this.isInActiveSelection(l)) {
|
|
812
|
-
const
|
|
812
|
+
const C = this.getGlobalTransformMatrix(l), v = L.util.qrDecompose(C);
|
|
813
813
|
p = {
|
|
814
814
|
...p,
|
|
815
|
-
left: (
|
|
816
|
-
top: (
|
|
817
|
-
angle:
|
|
818
|
-
scaleX:
|
|
819
|
-
scaleY:
|
|
815
|
+
left: (v.translateX || 0) - (t.left || 0),
|
|
816
|
+
top: (v.translateY || 0) - (t.top || 0),
|
|
817
|
+
angle: v.angle || 0,
|
|
818
|
+
scaleX: v.scaleX || 1,
|
|
819
|
+
scaleY: v.scaleY || 1,
|
|
820
820
|
originX: "center",
|
|
821
821
|
originY: "center"
|
|
822
822
|
};
|
|
@@ -831,37 +831,37 @@ class xe {
|
|
|
831
831
|
originX: "left",
|
|
832
832
|
originY: "top"
|
|
833
833
|
};
|
|
834
|
-
this.cloneImageFromCache(
|
|
835
|
-
if (
|
|
836
|
-
const
|
|
837
|
-
|
|
838
|
-
left: (
|
|
839
|
-
top: (
|
|
834
|
+
this.cloneImageFromCache(R, p).then(async (C) => {
|
|
835
|
+
if (C.clipPath) {
|
|
836
|
+
const v = C.clipPath;
|
|
837
|
+
v.absolutePositioned && v.set({
|
|
838
|
+
left: (v.left || 0) - t.left,
|
|
839
|
+
top: (v.top || 0) - t.top
|
|
840
840
|
});
|
|
841
841
|
}
|
|
842
|
-
if (e &&
|
|
842
|
+
if (e && C.type === "image")
|
|
843
843
|
try {
|
|
844
|
-
const
|
|
844
|
+
const v = C, I = v.getSrc() || v.originSrc || "";
|
|
845
845
|
if (I) {
|
|
846
846
|
const q = await this.getCachedDataURL(I);
|
|
847
|
-
|
|
847
|
+
v.setSrc(q, () => _(C));
|
|
848
848
|
return;
|
|
849
849
|
}
|
|
850
850
|
} catch {
|
|
851
851
|
}
|
|
852
|
-
|
|
852
|
+
_(C);
|
|
853
853
|
}).catch(() => {
|
|
854
|
-
|
|
854
|
+
_(l);
|
|
855
855
|
});
|
|
856
|
-
} else
|
|
856
|
+
} else O ? G(l, ["absolutePositioned"]).then((R) => {
|
|
857
857
|
if (this.isInActiveSelection(l)) {
|
|
858
|
-
const
|
|
859
|
-
|
|
860
|
-
left: (
|
|
861
|
-
top: (
|
|
862
|
-
angle:
|
|
863
|
-
scaleX:
|
|
864
|
-
scaleY:
|
|
858
|
+
const C = this.getGlobalTransformMatrix(l), v = L.util.qrDecompose(C);
|
|
859
|
+
R.set({
|
|
860
|
+
left: (v.translateX || 0) - (t.left || 0),
|
|
861
|
+
top: (v.translateY || 0) - (t.top || 0),
|
|
862
|
+
angle: v.angle || 0,
|
|
863
|
+
scaleX: v.scaleX || 1,
|
|
864
|
+
scaleY: v.scaleY || 1,
|
|
865
865
|
flipX: l.flipX || !1,
|
|
866
866
|
flipY: l.flipY || !1,
|
|
867
867
|
selectable: !1,
|
|
@@ -870,7 +870,7 @@ class xe {
|
|
|
870
870
|
originY: "center"
|
|
871
871
|
});
|
|
872
872
|
} else
|
|
873
|
-
|
|
873
|
+
R.set({
|
|
874
874
|
left: (l.left || 0) - t.left,
|
|
875
875
|
top: (l.top || 0) - t.top,
|
|
876
876
|
angle: l.angle || 0,
|
|
@@ -883,21 +883,21 @@ class xe {
|
|
|
883
883
|
originX: l.originX || "left",
|
|
884
884
|
originY: l.originY || "top"
|
|
885
885
|
});
|
|
886
|
-
const p =
|
|
886
|
+
const p = R.clipPath;
|
|
887
887
|
p && p.absolutePositioned && p.set({
|
|
888
888
|
left: (p.left || 0) - t.left,
|
|
889
889
|
top: (p.top || 0) - t.top
|
|
890
|
-
}),
|
|
891
|
-
}).catch(() =>
|
|
892
|
-
(
|
|
890
|
+
}), R.setCoords(), R.dirty = !0, _(R);
|
|
891
|
+
}).catch(() => _(l)) : l.cloneAsImage(
|
|
892
|
+
(R) => {
|
|
893
893
|
if (this.isInActiveSelection(l)) {
|
|
894
|
-
const p = this.getGlobalTransformMatrix(l),
|
|
895
|
-
|
|
896
|
-
left: (
|
|
897
|
-
top: (
|
|
898
|
-
angle:
|
|
899
|
-
scaleX: (
|
|
900
|
-
scaleY: (
|
|
894
|
+
const p = this.getGlobalTransformMatrix(l), C = L.util.qrDecompose(p);
|
|
895
|
+
R.set({
|
|
896
|
+
left: (C.translateX || 0) - (t.left || 0),
|
|
897
|
+
top: (C.translateY || 0) - (t.top || 0),
|
|
898
|
+
angle: C.angle || 0,
|
|
899
|
+
scaleX: (C.scaleX || 1) / g,
|
|
900
|
+
scaleY: (C.scaleY || 1) / g,
|
|
901
901
|
selectable: !1,
|
|
902
902
|
hasControls: !1,
|
|
903
903
|
hasBorders: !1,
|
|
@@ -906,7 +906,7 @@ class xe {
|
|
|
906
906
|
});
|
|
907
907
|
} else {
|
|
908
908
|
const p = l.getBoundingRect(!0, !0);
|
|
909
|
-
|
|
909
|
+
R.set({
|
|
910
910
|
left: p.left - t.left,
|
|
911
911
|
top: p.top - t.top,
|
|
912
912
|
scaleX: 1 / g,
|
|
@@ -919,47 +919,47 @@ class xe {
|
|
|
919
919
|
originY: "top"
|
|
920
920
|
});
|
|
921
921
|
}
|
|
922
|
-
|
|
922
|
+
_(R);
|
|
923
923
|
},
|
|
924
924
|
{ multiplier: g }
|
|
925
925
|
);
|
|
926
926
|
} catch {
|
|
927
|
-
|
|
927
|
+
_(l);
|
|
928
928
|
}
|
|
929
929
|
})
|
|
930
930
|
)
|
|
931
931
|
)).forEach((l) => h.add(l));
|
|
932
|
-
const A =
|
|
933
|
-
h.setViewportTransform([A, 0, 0,
|
|
934
|
-
const
|
|
935
|
-
let
|
|
936
|
-
(
|
|
932
|
+
const A = s / t.width, M = a / t.height;
|
|
933
|
+
h.setViewportTransform([A, 0, 0, M, 0, 0]), h.renderAll();
|
|
934
|
+
const y = r?.minOutputSize ?? 1024;
|
|
935
|
+
let B = 1;
|
|
936
|
+
(s > y || a > y) && (B = Math.max(1, y / Math.max(s, a))), typeof r?.outputMultiplierCap == "number" && (B = Math.min(B, r.outputMultiplierCap));
|
|
937
937
|
let f = "";
|
|
938
938
|
const u = () => h.toDataURL({
|
|
939
939
|
format: "webp",
|
|
940
940
|
quality: r?.quality ?? 0.5,
|
|
941
|
-
width:
|
|
941
|
+
width: s,
|
|
942
942
|
height: a,
|
|
943
|
-
multiplier:
|
|
943
|
+
multiplier: B
|
|
944
944
|
}), T = r?.preferImageBitmap ?? !0, W = r?.returnBlobUrl ?? !1;
|
|
945
945
|
if (T && window.createImageBitmap && typeof h.toCanvasElement == "function") {
|
|
946
|
-
const l = h.toCanvasElement(
|
|
946
|
+
const l = h.toCanvasElement(B, { width: s, height: a });
|
|
947
947
|
try {
|
|
948
948
|
f = await createImageBitmap(l);
|
|
949
949
|
} finally {
|
|
950
950
|
l.width = 0, l.height = 0;
|
|
951
951
|
}
|
|
952
952
|
} else if (W && typeof h.toCanvasElement == "function") {
|
|
953
|
-
const l = h.toCanvasElement(
|
|
954
|
-
l.width = 0, l.height = 0, f =
|
|
953
|
+
const l = h.toCanvasElement(B, { width: s, height: a }), _ = await new Promise((O) => l.toBlob(O, "image/webp", r?.quality ?? 0.5));
|
|
954
|
+
l.width = 0, l.height = 0, f = _ ? URL.createObjectURL(_) : u();
|
|
955
955
|
} else
|
|
956
956
|
f = u();
|
|
957
957
|
return h.dispose(), f;
|
|
958
958
|
}
|
|
959
959
|
}
|
|
960
|
-
class
|
|
961
|
-
constructor(e,
|
|
962
|
-
this.onBusy = e, this.onIdle =
|
|
960
|
+
class dt {
|
|
961
|
+
constructor(e, i) {
|
|
962
|
+
this.onBusy = e, this.onIdle = i, this.pending = null, this.running = !1;
|
|
963
963
|
}
|
|
964
964
|
get active() {
|
|
965
965
|
return this.running;
|
|
@@ -982,19 +982,19 @@ class rt {
|
|
|
982
982
|
}
|
|
983
983
|
}
|
|
984
984
|
}
|
|
985
|
-
class
|
|
986
|
-
constructor(e = 32 * 1024 * 1024,
|
|
987
|
-
this.budget = e, this.concurrency =
|
|
985
|
+
class ft {
|
|
986
|
+
constructor(e = 32 * 1024 * 1024, i = 4, r) {
|
|
987
|
+
this.budget = e, this.concurrency = i, this.onEvict = r, this.entries = /* @__PURE__ */ new Map(), this.bytes = 0, this.active = 0, this.waiting = [], this.pinned = /* @__PURE__ */ new Set();
|
|
988
988
|
}
|
|
989
989
|
setPinnedSources(e) {
|
|
990
|
-
this.pinned = new Set(e), this.waiting.forEach((
|
|
991
|
-
|
|
992
|
-
}), this.waiting.sort((
|
|
990
|
+
this.pinned = new Set(e), this.waiting.forEach((i) => {
|
|
991
|
+
i.foreground = this.pinned.has(i.source);
|
|
992
|
+
}), this.waiting.sort((i, r) => Number(r.foreground) - Number(i.foreground)), this.trim();
|
|
993
993
|
}
|
|
994
994
|
trim() {
|
|
995
|
-
for (const [e,
|
|
995
|
+
for (const [e, i] of this.entries) {
|
|
996
996
|
if (this.bytes <= this.budget) break;
|
|
997
|
-
!
|
|
997
|
+
!i.bytes || this.pinned.has(e) || (this.entries.delete(e), this.bytes -= i.bytes, this.onEvict?.(e));
|
|
998
998
|
}
|
|
999
999
|
}
|
|
1000
1000
|
clear() {
|
|
@@ -1003,19 +1003,19 @@ class st {
|
|
|
1003
1003
|
this.entries.clear(), this.pinned.clear(), this.bytes = 0;
|
|
1004
1004
|
}
|
|
1005
1005
|
promote(e) {
|
|
1006
|
-
const
|
|
1007
|
-
if (
|
|
1008
|
-
const [r] = this.waiting.splice(
|
|
1006
|
+
const i = this.waiting.findIndex((s) => s.source === e && !s.foreground);
|
|
1007
|
+
if (i < 0) return;
|
|
1008
|
+
const [r] = this.waiting.splice(i, 1);
|
|
1009
1009
|
r.foreground = !0;
|
|
1010
|
-
const t = this.waiting.findIndex((
|
|
1010
|
+
const t = this.waiting.findIndex((s) => !s.foreground);
|
|
1011
1011
|
this.waiting.splice(t < 0 ? this.waiting.length : t, 0, r);
|
|
1012
1012
|
}
|
|
1013
|
-
async fetchBlob(e,
|
|
1013
|
+
async fetchBlob(e, i) {
|
|
1014
1014
|
await new Promise((r, t) => {
|
|
1015
|
-
const
|
|
1015
|
+
const s = () => {
|
|
1016
1016
|
this.active += 1, r();
|
|
1017
1017
|
};
|
|
1018
|
-
this.active < this.concurrency ?
|
|
1018
|
+
this.active < this.concurrency ? s() : (this.waiting.push({ source: e, foreground: !1, start: s, cancel: () => t(new Error("Resource cache was released")) }), i && this.promote(e));
|
|
1019
1019
|
});
|
|
1020
1020
|
try {
|
|
1021
1021
|
const r = await fetch(e);
|
|
@@ -1025,30 +1025,30 @@ class st {
|
|
|
1025
1025
|
this.active -= 1, this.waiting.shift()?.start();
|
|
1026
1026
|
}
|
|
1027
1027
|
}
|
|
1028
|
-
load(e,
|
|
1028
|
+
load(e, i = !0) {
|
|
1029
1029
|
const r = this.entries.get(e);
|
|
1030
1030
|
if (r)
|
|
1031
|
-
return this.entries.delete(e), this.entries.set(e, r),
|
|
1032
|
-
const t = { ready: this.fetchBlob(e,
|
|
1033
|
-
return this.entries.set(e, t), t.ready.then((
|
|
1034
|
-
this.entries.get(e) === t && (t.bytes =
|
|
1031
|
+
return this.entries.delete(e), this.entries.set(e, r), i && this.promote(e), r.ready;
|
|
1032
|
+
const t = { ready: this.fetchBlob(e, i), bytes: 0 };
|
|
1033
|
+
return this.entries.set(e, t), t.ready.then((s) => {
|
|
1034
|
+
this.entries.get(e) === t && (t.bytes = s.size, this.bytes += t.bytes, this.trim());
|
|
1035
1035
|
}).catch(() => {
|
|
1036
1036
|
this.entries.get(e) === t && this.entries.delete(e);
|
|
1037
1037
|
}), t.ready;
|
|
1038
1038
|
}
|
|
1039
1039
|
}
|
|
1040
|
-
class
|
|
1040
|
+
class Be {
|
|
1041
1041
|
constructor() {
|
|
1042
|
-
this.urls = /* @__PURE__ */ new Map(), this.disposed = !1, this.current = /* @__PURE__ */ new Set(), this.holds = /* @__PURE__ */ new Map(), this.cache = new
|
|
1043
|
-
const
|
|
1044
|
-
|
|
1042
|
+
this.urls = /* @__PURE__ */ new Map(), this.disposed = !1, this.current = /* @__PURE__ */ new Set(), this.holds = /* @__PURE__ */ new Map(), this.cache = new ft(32 * 1024 * 1024, 4, (e) => {
|
|
1043
|
+
const i = this.urls.get(e);
|
|
1044
|
+
i && URL.revokeObjectURL(i), this.urls.delete(e);
|
|
1045
1045
|
});
|
|
1046
1046
|
}
|
|
1047
1047
|
key(e) {
|
|
1048
1048
|
return new URL(e, document.baseURI).href;
|
|
1049
1049
|
}
|
|
1050
1050
|
sources(e) {
|
|
1051
|
-
return e.filter((
|
|
1051
|
+
return e.filter((i) => i && !i.startsWith("data:") && !i.startsWith("blob:")).map((i) => this.key(i));
|
|
1052
1052
|
}
|
|
1053
1053
|
updatePins() {
|
|
1054
1054
|
this.cache.setPinnedSources([...this.current, ...this.holds.keys()]);
|
|
@@ -1057,62 +1057,62 @@ class Me {
|
|
|
1057
1057
|
this.current = new Set(this.sources(e)), this.updatePins();
|
|
1058
1058
|
}
|
|
1059
1059
|
hold(e) {
|
|
1060
|
-
const
|
|
1061
|
-
return
|
|
1062
|
-
|
|
1060
|
+
const i = new Set(this.sources(e));
|
|
1061
|
+
return i.forEach((r) => this.holds.set(r, (this.holds.get(r) ?? 0) + 1)), this.updatePins(), () => {
|
|
1062
|
+
i.forEach((r) => {
|
|
1063
1063
|
const t = (this.holds.get(r) ?? 1) - 1;
|
|
1064
1064
|
t ? this.holds.set(r, t) : this.holds.delete(r);
|
|
1065
1065
|
}), this.updatePins();
|
|
1066
1066
|
};
|
|
1067
1067
|
}
|
|
1068
|
-
async preload(e,
|
|
1069
|
-
await Promise.all([...new Set(this.sources(e))].map((r) => this.cache.load(r,
|
|
1068
|
+
async preload(e, i = !1) {
|
|
1069
|
+
await Promise.all([...new Set(this.sources(e))].map((r) => this.cache.load(r, i)));
|
|
1070
1070
|
}
|
|
1071
1071
|
async url(e) {
|
|
1072
1072
|
if (!e || e.startsWith("data:") || e.startsWith("blob:")) return e;
|
|
1073
|
-
const
|
|
1073
|
+
const i = this.key(e), r = await this.cache.load(i, !0);
|
|
1074
1074
|
if (this.disposed) throw new Error("Resource session was released");
|
|
1075
|
-
let t = this.urls.get(
|
|
1076
|
-
return t || (t = URL.createObjectURL(r), this.urls.set(
|
|
1075
|
+
let t = this.urls.get(i);
|
|
1076
|
+
return t || (t = URL.createObjectURL(r), this.urls.set(i, t)), t;
|
|
1077
1077
|
}
|
|
1078
1078
|
async acquire(e) {
|
|
1079
|
-
const
|
|
1079
|
+
const i = this.hold(e);
|
|
1080
1080
|
try {
|
|
1081
|
-
return { urls: Object.fromEntries(await Promise.all([...new Set(e.filter(Boolean))].map(async (t) => [t, await this.url(t)]))), release:
|
|
1081
|
+
return { urls: Object.fromEntries(await Promise.all([...new Set(e.filter(Boolean))].map(async (t) => [t, await this.url(t)]))), release: i };
|
|
1082
1082
|
} catch (r) {
|
|
1083
|
-
throw
|
|
1083
|
+
throw i(), r;
|
|
1084
1084
|
}
|
|
1085
1085
|
}
|
|
1086
1086
|
dispose() {
|
|
1087
1087
|
this.disposed = !0, this.cache.clear();
|
|
1088
1088
|
}
|
|
1089
1089
|
}
|
|
1090
|
-
function
|
|
1091
|
-
const e = /* @__PURE__ */ new Set(),
|
|
1090
|
+
function ve(d) {
|
|
1091
|
+
const e = /* @__PURE__ */ new Set(), i = (r) => {
|
|
1092
1092
|
if (!r || typeof r != "object") return;
|
|
1093
1093
|
if (Array.isArray(r)) {
|
|
1094
|
-
r.forEach(
|
|
1094
|
+
r.forEach(i);
|
|
1095
1095
|
return;
|
|
1096
1096
|
}
|
|
1097
1097
|
const t = r;
|
|
1098
|
-
typeof t.src == "string" && t.src && e.add(t.src), typeof t.sourcePath == "string" && /^(https?:|\/)/.test(t.sourcePath) && e.add(t.sourcePath), Object.values(t).forEach(
|
|
1098
|
+
typeof t.src == "string" && t.src && e.add(t.src), typeof t.sourcePath == "string" && /^(https?:|\/)/.test(t.sourcePath) && e.add(t.sourcePath), Object.values(t).forEach(i);
|
|
1099
1099
|
};
|
|
1100
|
-
return
|
|
1100
|
+
return i(d), [...e];
|
|
1101
1101
|
}
|
|
1102
|
-
async function
|
|
1103
|
-
const
|
|
1104
|
-
if (!
|
|
1105
|
-
if (Array.isArray(
|
|
1106
|
-
|
|
1102
|
+
async function Ee(d, e) {
|
|
1103
|
+
const i = JSON.parse(JSON.stringify(d)), r = new Map(await Promise.all(ve(i).map(async (s) => [s, await e.url(s)]))), t = (s) => {
|
|
1104
|
+
if (!s || typeof s != "object") return;
|
|
1105
|
+
if (Array.isArray(s)) {
|
|
1106
|
+
s.forEach(t);
|
|
1107
1107
|
return;
|
|
1108
1108
|
}
|
|
1109
|
-
const a =
|
|
1109
|
+
const a = s;
|
|
1110
1110
|
typeof a.src == "string" && (a.src = r.get(a.src) ?? a.src, a.originSrc && (a.originSrc = a.src)), typeof a.sourcePath == "string" && (a.sourcePath = r.get(a.sourcePath) ?? a.sourcePath), Object.values(a).forEach(t);
|
|
1111
1111
|
};
|
|
1112
|
-
return t(
|
|
1112
|
+
return t(i), i;
|
|
1113
1113
|
}
|
|
1114
|
-
function
|
|
1115
|
-
const r = JSON.parse(JSON.stringify(d)), t = new Map(Object.entries(e.urls).map(([n, c]) => [c, n])),
|
|
1114
|
+
function gt(d, e, i) {
|
|
1115
|
+
const r = JSON.parse(JSON.stringify(d)), t = new Map(Object.entries(e.urls).map(([n, c]) => [c, n])), s = /* @__PURE__ */ new Map(), a = (n, c) => {
|
|
1116
1116
|
if (!n || typeof n != "object") return;
|
|
1117
1117
|
if (Array.isArray(n)) {
|
|
1118
1118
|
n.forEach((m) => a(m, c));
|
|
@@ -1121,204 +1121,207 @@ function it(d, e, s) {
|
|
|
1121
1121
|
const o = n;
|
|
1122
1122
|
c(o), Object.values(o).forEach((m) => a(m, c));
|
|
1123
1123
|
};
|
|
1124
|
-
return a(
|
|
1125
|
-
n.id !== void 0 &&
|
|
1124
|
+
return a(i, (n) => {
|
|
1125
|
+
n.id !== void 0 && s.set(String(n.id), n);
|
|
1126
1126
|
}), a(r, (n) => {
|
|
1127
|
-
const c = n.id !== void 0 ?
|
|
1127
|
+
const c = n.id !== void 0 ? s.get(String(n.id)) : void 0;
|
|
1128
1128
|
for (const o of ["src", "originSrc", "sourcePath"])
|
|
1129
1129
|
typeof n[o] == "string" && (c && typeof c[o] == "string" ? n[o] = c[o] : n[o] = t.get(n[o]) ?? n[o]);
|
|
1130
1130
|
}), r;
|
|
1131
1131
|
}
|
|
1132
|
-
function
|
|
1132
|
+
function $(d) {
|
|
1133
1133
|
return d.designKey || d.area?.name || d.name;
|
|
1134
1134
|
}
|
|
1135
|
-
function
|
|
1136
|
-
const r = e[
|
|
1137
|
-
return
|
|
1135
|
+
function me(d, e, i) {
|
|
1136
|
+
const r = e[$(d)]?.color;
|
|
1137
|
+
return i ?? (typeof r == "string" ? r : void 0);
|
|
1138
1138
|
}
|
|
1139
|
-
function
|
|
1140
|
-
return
|
|
1139
|
+
function Ue(d, e, i) {
|
|
1140
|
+
return i ?? d.render_areas.filter((r) => r.design).map((r) => e[$(r)]?.color).find((r) => typeof r == "string");
|
|
1141
1141
|
}
|
|
1142
|
-
function
|
|
1142
|
+
function we(d, e, i, r = !0, t = "global") {
|
|
1143
1143
|
if (!r) return d.render_areas;
|
|
1144
|
-
const
|
|
1144
|
+
const s = t === "global" ? Ue(d, e, i) : void 0;
|
|
1145
1145
|
return d.render_areas.filter((a) => {
|
|
1146
|
-
const n = e[
|
|
1147
|
-
return
|
|
1146
|
+
const n = e[$(a)], c = t === "placement" ? me(a, e, i) : s;
|
|
1147
|
+
return je({ design: a.design, defaultPrintColor: pe(a.defaultPrintColor, a.area?.defaultPrintColor, d.defaultPrintColor) }, c, !!(a.area && Array.isArray(n?.objects) && n.objects.length));
|
|
1148
1148
|
});
|
|
1149
1149
|
}
|
|
1150
|
-
function
|
|
1151
|
-
return
|
|
1152
|
-
const a = e[
|
|
1153
|
-
return [
|
|
1150
|
+
function Xe(d, e, i, r = !0, t = "global") {
|
|
1151
|
+
return we(d, e, i, r, t).flatMap((s) => {
|
|
1152
|
+
const a = e[$(s)];
|
|
1153
|
+
return [s.image, ...s.design && s.area && Array.isArray(a?.objects) && a.objects.length ? [s.area.image, ...ve(a)] : []];
|
|
1154
1154
|
}).filter(Boolean);
|
|
1155
1155
|
}
|
|
1156
|
-
function
|
|
1156
|
+
function pt(d) {
|
|
1157
1157
|
return d.render_areas.find((e) => e.name === "bg")?.image || d.image || "";
|
|
1158
1158
|
}
|
|
1159
|
-
function
|
|
1160
|
-
const
|
|
1159
|
+
function mt(d, e) {
|
|
1160
|
+
const i = d.render_areas.find((t) => t.name === "bg") ?? d.render_areas.find((t) => !t.design), r = Math.max(i?.width ?? 0, i?.height ?? 0);
|
|
1161
1161
|
return Math.max(1, Math.min(768, Math.round(r ? r * e : 600)));
|
|
1162
1162
|
}
|
|
1163
|
-
function
|
|
1163
|
+
function ge(d) {
|
|
1164
1164
|
if (typeof d != "string") {
|
|
1165
1165
|
d.close();
|
|
1166
1166
|
return;
|
|
1167
1167
|
}
|
|
1168
1168
|
d.startsWith("blob:") && URL.revokeObjectURL(d);
|
|
1169
1169
|
}
|
|
1170
|
-
const
|
|
1170
|
+
const Bt = Ge(
|
|
1171
1171
|
function({
|
|
1172
1172
|
render: e,
|
|
1173
|
-
designData:
|
|
1173
|
+
designData: i,
|
|
1174
1174
|
enabled: r = !0,
|
|
1175
1175
|
preloadSources: t,
|
|
1176
|
-
preloadDesignData:
|
|
1176
|
+
preloadDesignData: s,
|
|
1177
1177
|
onAssetReady: a,
|
|
1178
1178
|
backgroundColor: n,
|
|
1179
1179
|
colorMode: c = "global",
|
|
1180
1180
|
scale: o = 0.8,
|
|
1181
1181
|
renderer: m = "pixel-map",
|
|
1182
1182
|
className: g,
|
|
1183
|
-
style:
|
|
1183
|
+
style: P,
|
|
1184
1184
|
alt: h = "Product preview",
|
|
1185
1185
|
onLoadingChange: X,
|
|
1186
1186
|
onRendered: x,
|
|
1187
1187
|
onError: A
|
|
1188
|
-
},
|
|
1189
|
-
const
|
|
1188
|
+
}, M) {
|
|
1189
|
+
const y = S(null), B = S(null), f = S(null), u = S(null), T = S(null), W = S(void 0), l = S(null), _ = S(null), O = S(0), R = S(/* @__PURE__ */ new Map()), p = S(null), C = S(0), v = S(!1), I = S(!1), q = S({ onLoadingChange: X, onRendered: x, onError: A, onAssetReady: a });
|
|
1190
1190
|
q.current = { onLoadingChange: X, onRendered: x, onError: A, onAssetReady: a };
|
|
1191
|
-
const Y = m === "pixel-map" &&
|
|
1192
|
-
|
|
1193
|
-
const [
|
|
1194
|
-
|
|
1195
|
-
}, []),
|
|
1191
|
+
const Y = m === "pixel-map" && Ye.isSupported(), se = S(Y);
|
|
1192
|
+
se.current = Y;
|
|
1193
|
+
const [j, k] = Z(""), [ne, Te] = Z(!1), [Le, We] = Z(""), [qe, he] = Z(!1), ue = Qe(Ze(e).render_areas), J = N(() => (T.current ??= new Be(), T.current), []), ee = N((w) => {
|
|
1194
|
+
Te(w), q.current.onLoadingChange?.(w);
|
|
1195
|
+
}, []), ae = N(() => {
|
|
1196
1196
|
if (f.current) return f.current;
|
|
1197
|
-
if (!
|
|
1197
|
+
if (!y.current || !B.current) return null;
|
|
1198
1198
|
const w = 800;
|
|
1199
|
-
return
|
|
1200
|
-
|
|
1199
|
+
return y.current.width = w, y.current.height = w, f.current = new Ie(
|
|
1200
|
+
y.current,
|
|
1201
1201
|
{ width: w, height: w },
|
|
1202
|
-
|
|
1202
|
+
B.current,
|
|
1203
1203
|
0.85
|
|
1204
1204
|
), f.current;
|
|
1205
|
-
}, []),
|
|
1205
|
+
}, []), ye = N(async () => {
|
|
1206
1206
|
if (u.current) return u.current;
|
|
1207
|
-
if (Y) u.current = new
|
|
1207
|
+
if (Y) u.current = new Ye();
|
|
1208
1208
|
else {
|
|
1209
1209
|
const { StickerPlugin: w } = await import("./renderer/sticker.js");
|
|
1210
|
-
if (I.current ||
|
|
1210
|
+
if (I.current || se.current !== Y) return null;
|
|
1211
1211
|
if (u.current) return u.current;
|
|
1212
1212
|
u.current = new w({ width: 1, height: 1 }, !0, { subdiv: 8 });
|
|
1213
1213
|
}
|
|
1214
1214
|
return u.current;
|
|
1215
|
-
}, [Y]),
|
|
1216
|
-
f.current?.destroy(), f.current = null, u.current?.destroy(), u.current = null, T.current?.dispose(), T.current = null, W.current = void 0,
|
|
1217
|
-
}, []),
|
|
1218
|
-
() =>
|
|
1215
|
+
}, [Y]), ce = N(() => {
|
|
1216
|
+
f.current?.destroy(), f.current = null, u.current?.destroy(), u.current = null, T.current?.dispose(), T.current = null, W.current = void 0, R.current.forEach(({ texture: w }) => ge(w)), R.current.clear(), _.current && URL.revokeObjectURL(_.current), _.current = null, l.current = null;
|
|
1217
|
+
}, []), be = N(() => (p.current || (p.current = new dt(
|
|
1218
|
+
() => ee(!0),
|
|
1219
1219
|
() => {
|
|
1220
|
-
I.current ?
|
|
1220
|
+
I.current ? ce() : ee(!1);
|
|
1221
1221
|
}
|
|
1222
|
-
)), p.current), [
|
|
1223
|
-
const w = ++
|
|
1224
|
-
|
|
1225
|
-
let
|
|
1222
|
+
)), p.current), [ce, ee]), te = N(() => {
|
|
1223
|
+
const w = ++O.current, K = C.current;
|
|
1224
|
+
be().enqueue(async () => {
|
|
1225
|
+
let F;
|
|
1226
1226
|
try {
|
|
1227
|
-
if (I.current || w !==
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1227
|
+
if (I.current || w !== O.current) return;
|
|
1228
|
+
he(!1);
|
|
1229
|
+
const U = ae();
|
|
1230
|
+
v.current && (u.current?.destroy(), u.current = null, v.current = !1);
|
|
1231
|
+
const V = await ye();
|
|
1232
|
+
if (!U || !V || I.current || w !== O.current) return;
|
|
1233
|
+
const z = J();
|
|
1234
|
+
F = z.hold(Xe(e, i, n, Y, c));
|
|
1235
|
+
const Ce = we(e, i, n, Y, c), Se = c === "global" ? Ue(e, i, n) : n, ze = e.render_areas.filter((b) => !!b.design), oe = mt(e, o), Re = Promise.all(Ce.map(async (b) => [b.image, await z.url(b.image)]));
|
|
1236
|
+
Re.catch(() => {
|
|
1236
1237
|
});
|
|
1237
|
-
for (const
|
|
1238
|
-
const
|
|
1239
|
-
if (!
|
|
1240
|
-
const
|
|
1241
|
-
|
|
1238
|
+
for (const b of ze) {
|
|
1239
|
+
const D = $(b), E = i[D], Q = c === "placement" ? me(b, i, n) ?? "" : typeof E?.color == "string" ? E.color : "", fe = pe(b.defaultPrintColor, b.area?.defaultPrintColor, e.defaultPrintColor), _e = fe ? "" : Q, De = !fe && c === "placement" && !Y && n === void 0 && !!Q;
|
|
1240
|
+
if (!b.area || (!Array.isArray(E?.objects) || !E.objects.length) && !De) {
|
|
1241
|
+
const re = R.current.get(D);
|
|
1242
|
+
re && (ge(re.texture), R.current.delete(D));
|
|
1242
1243
|
continue;
|
|
1243
1244
|
}
|
|
1244
|
-
const
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1245
|
+
const Me = JSON.stringify([
|
|
1246
|
+
K,
|
|
1247
|
+
oe,
|
|
1248
|
+
b.area.id,
|
|
1249
|
+
b.area.image,
|
|
1250
|
+
E,
|
|
1250
1251
|
c,
|
|
1251
|
-
|
|
1252
|
+
Q,
|
|
1253
|
+
fe
|
|
1252
1254
|
]);
|
|
1253
|
-
if (
|
|
1254
|
-
const [
|
|
1255
|
-
|
|
1256
|
-
|
|
1255
|
+
if (R.current.get(D)?.fingerprint === Me) continue;
|
|
1256
|
+
const [Ne, Ve] = await Promise.all([
|
|
1257
|
+
z.url(b.area.image),
|
|
1258
|
+
Ee(E, z)
|
|
1257
1259
|
]);
|
|
1258
|
-
if (I.current || w !==
|
|
1259
|
-
const
|
|
1260
|
-
minOutputSize:
|
|
1260
|
+
if (I.current || w !== O.current || (await U.switchView({ ...b.area, image: Ne }, Q, Ve), I.current || w !== O.current)) return;
|
|
1261
|
+
const xe = typeof createImageBitmap == "function" ? await U.exportPreviewBitmap(oe, _e) : await U.export(!1, _e, {
|
|
1262
|
+
minOutputSize: oe,
|
|
1261
1263
|
preferImageBitmap: !1,
|
|
1262
1264
|
returnBlobUrl: !1,
|
|
1263
1265
|
outputMultiplierCap: 1,
|
|
1264
1266
|
quality: 0.72
|
|
1265
1267
|
});
|
|
1266
|
-
if (
|
|
1267
|
-
const
|
|
1268
|
-
|
|
1268
|
+
if (xe) {
|
|
1269
|
+
const re = R.current.get(D);
|
|
1270
|
+
re && ge(re.texture), R.current.set(D, { fingerprint: Me, texture: xe });
|
|
1269
1271
|
}
|
|
1270
|
-
if (I.current || w !==
|
|
1272
|
+
if (I.current || w !== O.current) return;
|
|
1271
1273
|
}
|
|
1272
|
-
const
|
|
1273
|
-
if (I.current || w !==
|
|
1274
|
-
const
|
|
1275
|
-
const
|
|
1274
|
+
const Fe = new Map(await Re);
|
|
1275
|
+
if (I.current || w !== O.current) return;
|
|
1276
|
+
const ke = Ce.map((b) => {
|
|
1277
|
+
const D = b.design ? R.current.get($(b))?.texture : void 0, E = b.texture_transform, Q = typeof E?.blendMode == "number" ? E.blendMode : typeof E?.blendMode == "string" ? Ke[E.blendMode.toLowerCase()] : void 0;
|
|
1276
1278
|
return {
|
|
1277
|
-
...
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1279
|
+
...b,
|
|
1280
|
+
defaultPrintColor: pe(b.defaultPrintColor, b.area?.defaultPrintColor, e.defaultPrintColor),
|
|
1281
|
+
image: Fe.get(b.image) ?? b.image,
|
|
1282
|
+
texture: D,
|
|
1283
|
+
color: c === "placement" && b.design ? me(b, i) : void 0,
|
|
1281
1284
|
// PixelMapRenderer consumes the source blend-mode string; Pixi
|
|
1282
1285
|
// still receives its enum value exactly as before.
|
|
1283
|
-
config:
|
|
1286
|
+
config: E ? Y ? { ...E } : { ...E, blendMode: Q } : void 0
|
|
1284
1287
|
};
|
|
1285
|
-
}),
|
|
1286
|
-
color:
|
|
1287
|
-
targetSize:
|
|
1288
|
+
}), le = Y ? await V.onOffscreenRender(ke, {
|
|
1289
|
+
color: Se,
|
|
1290
|
+
targetSize: oe,
|
|
1288
1291
|
quality: 0.85,
|
|
1289
1292
|
format: "image/png",
|
|
1290
1293
|
cacheKey: e.id
|
|
1291
|
-
}) : await
|
|
1292
|
-
color:
|
|
1294
|
+
}) : await (await import("./pixi-print-base-CKs4lF7h.js")).renderPixiWithPrintBase(V, ke, {
|
|
1295
|
+
color: Se,
|
|
1293
1296
|
cleanCache: !1,
|
|
1294
1297
|
scale: o,
|
|
1295
1298
|
quality: 0.85
|
|
1296
1299
|
});
|
|
1297
|
-
if (I.current || w !==
|
|
1298
|
-
if (!
|
|
1299
|
-
const
|
|
1300
|
-
|
|
1300
|
+
if (I.current || w !== O.current) return;
|
|
1301
|
+
if (!le) throw new Error("Could not render the product preview");
|
|
1302
|
+
const de = URL.createObjectURL(le);
|
|
1303
|
+
_.current && URL.revokeObjectURL(_.current), l.current = le, _.current = de, k(de), q.current.onRendered?.({ renderId: e.id, blob: le, url: de });
|
|
1301
1304
|
} catch (U) {
|
|
1302
|
-
!I.current && w ===
|
|
1305
|
+
!I.current && w === O.current && (he(!0), q.current.onError?.(U instanceof Error ? U : new Error("Could not render the product preview")));
|
|
1303
1306
|
} finally {
|
|
1304
|
-
|
|
1307
|
+
F?.();
|
|
1305
1308
|
}
|
|
1306
1309
|
});
|
|
1307
|
-
}, [n, c,
|
|
1308
|
-
|
|
1309
|
-
I.current = !0,
|
|
1310
|
-
}), [
|
|
1310
|
+
}, [n, c, i, ae, be, ye, J, e, o, Y]);
|
|
1311
|
+
ie(() => (I.current = !1, () => {
|
|
1312
|
+
I.current = !0, O.current += 1, p.current?.clear(), p.current?.active || ce();
|
|
1313
|
+
}), [ce]), ie(() => {
|
|
1311
1314
|
u.current?.destroy(), u.current = null;
|
|
1312
|
-
}, [m, Y]),
|
|
1313
|
-
const w =
|
|
1314
|
-
w.pin(
|
|
1315
|
+
}, [m, Y]), ie(() => {
|
|
1316
|
+
const w = J(), K = s ?? i, F = Xe(e, K, n, Y, c);
|
|
1317
|
+
w.pin(F);
|
|
1315
1318
|
let U = !0;
|
|
1316
|
-
return w.preload(
|
|
1319
|
+
return w.preload(F, !0).then(async () => {
|
|
1317
1320
|
if (U)
|
|
1318
|
-
for (const V of
|
|
1319
|
-
const
|
|
1321
|
+
for (const V of we(e, K, n, Y, c).map((z) => z.image).filter(Boolean)) {
|
|
1322
|
+
const z = await w.url(V);
|
|
1320
1323
|
if (!U) return;
|
|
1321
|
-
q.current.onAssetReady?.(V,
|
|
1324
|
+
q.current.onAssetReady?.(V, z), V === pt(e) && We(z);
|
|
1322
1325
|
}
|
|
1323
1326
|
}).catch(() => {
|
|
1324
1327
|
}).finally(() => {
|
|
@@ -1327,91 +1330,93 @@ const Rt = qe(
|
|
|
1327
1330
|
}), () => {
|
|
1328
1331
|
U = !1;
|
|
1329
1332
|
};
|
|
1330
|
-
}, [n, c,
|
|
1331
|
-
|
|
1332
|
-
}), [r,
|
|
1333
|
-
acquireResources: (w) =>
|
|
1333
|
+
}, [n, c, i, s, J, t, e, Y]), ie(() => (r ? te() : ee(!1), () => {
|
|
1334
|
+
O.current += 1, p.current?.clear();
|
|
1335
|
+
}), [r, te, ee]), Je(M, () => ({
|
|
1336
|
+
acquireResources: (w) => J().acquire(w),
|
|
1334
1337
|
getPreviewBlob: async () => l.current,
|
|
1335
1338
|
getPreviewUrl: async () => l.current ? URL.createObjectURL(l.current) : null,
|
|
1336
1339
|
refresh: () => {
|
|
1337
|
-
|
|
1340
|
+
C.current += 1, v.current = !0, r && te();
|
|
1338
1341
|
},
|
|
1339
|
-
updateText: async (w,
|
|
1340
|
-
const
|
|
1341
|
-
return
|
|
1342
|
+
updateText: async (w, K) => {
|
|
1343
|
+
const F = ae();
|
|
1344
|
+
return F ? F.updateText(w, K) : null;
|
|
1342
1345
|
}
|
|
1343
|
-
}), [r,
|
|
1344
|
-
const
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
/* @__PURE__ */
|
|
1346
|
+
}), [r, ae, J, te]);
|
|
1347
|
+
const He = () => {
|
|
1348
|
+
C.current += 1, v.current = !0, he(!1), r && te();
|
|
1349
|
+
}, Pe = j || (ue ? "" : Le);
|
|
1350
|
+
return /* @__PURE__ */ Ae("div", { className: g, style: { position: "relative", ...P }, children: [
|
|
1351
|
+
ue ? /* @__PURE__ */ H($e, { image: j, alt: h, loading: ne, failed: qe, onRetry: He }) : Pe && /* @__PURE__ */ H("img", { src: Pe, alt: h, style: { display: "block", width: "100%", height: "100%", objectFit: "contain" } }),
|
|
1352
|
+
!ue && ne && /* @__PURE__ */ H("div", { "aria-live": "polite", "aria-label": "Rendering product preview", style: { position: "absolute", inset: 0 } }),
|
|
1353
|
+
/* @__PURE__ */ H("div", { "aria-hidden": "true", style: { position: "absolute", width: 1, height: 1, overflow: "hidden", opacity: 0, pointerEvents: "none" }, children: /* @__PURE__ */ H("div", { ref: B, style: { width: 800, height: 800 }, children: /* @__PURE__ */ H("canvas", { ref: y, width: 800, height: 800 }) }) })
|
|
1349
1354
|
] });
|
|
1350
1355
|
}
|
|
1351
1356
|
);
|
|
1352
|
-
function
|
|
1357
|
+
function Et({
|
|
1353
1358
|
viewArea: d,
|
|
1354
1359
|
viewState: e,
|
|
1355
|
-
activeObjectId:
|
|
1360
|
+
activeObjectId: i,
|
|
1356
1361
|
onChange: r,
|
|
1357
1362
|
acquireResources: t,
|
|
1358
|
-
onLoadingChange:
|
|
1363
|
+
onLoadingChange: s,
|
|
1359
1364
|
className: a,
|
|
1360
1365
|
style: n
|
|
1361
1366
|
}) {
|
|
1362
|
-
const c =
|
|
1363
|
-
g.current = r,
|
|
1364
|
-
const
|
|
1367
|
+
const c = S(null), o = S(null), m = S(null), g = S(r), P = S(s), h = S(null), X = S(e), [x, A] = Z(!1), [M, y] = Z("");
|
|
1368
|
+
g.current = r, P.current = s;
|
|
1369
|
+
const B = N(() => {
|
|
1365
1370
|
const f = m.current;
|
|
1366
1371
|
if (!f) return;
|
|
1367
1372
|
const u = f.getRenderedObjects();
|
|
1368
|
-
g.current(h.current ?
|
|
1373
|
+
g.current(h.current ? gt(u, h.current, X.current) : u);
|
|
1369
1374
|
}, []);
|
|
1370
|
-
return
|
|
1371
|
-
let f = !1, u = null, T = !1, W = !1, l = null,
|
|
1372
|
-
const
|
|
1373
|
-
T || (T = !0, u?.destroy(), m.current === u && (m.current = null), l?.release(), h.current === l && (h.current = null),
|
|
1375
|
+
return ie(() => {
|
|
1376
|
+
let f = !1, u = null, T = !1, W = !1, l = null, _ = null;
|
|
1377
|
+
const O = () => {
|
|
1378
|
+
T || (T = !0, u?.destroy(), m.current === u && (m.current = null), l?.release(), h.current === l && (h.current = null), _?.dispose());
|
|
1374
1379
|
};
|
|
1375
1380
|
return (async () => {
|
|
1376
|
-
if (
|
|
1377
|
-
const p = c.current,
|
|
1378
|
-
if (!p || !
|
|
1379
|
-
const
|
|
1380
|
-
if (t ? l = await t(q) : (
|
|
1381
|
+
if (P.current?.(!0), await new Promise((k) => requestAnimationFrame(() => k())), f) return;
|
|
1382
|
+
const p = c.current, C = o.current;
|
|
1383
|
+
if (!p || !C) return;
|
|
1384
|
+
const v = p.clientWidth || 400, I = p.clientHeight || 400, q = [d.image, ...ve(e)];
|
|
1385
|
+
if (t ? l = await t(q) : (_ = new Be(), l = await _.acquire(q)), f) return;
|
|
1381
1386
|
h.current = l;
|
|
1382
|
-
const Y = await
|
|
1387
|
+
const Y = await Ee(e, { url: async (k) => l.urls[k] ?? k });
|
|
1383
1388
|
if (f) return;
|
|
1384
|
-
u = new
|
|
1385
|
-
const
|
|
1389
|
+
u = new Ie(C, { width: v, height: I }, p, 0.85), m.current = u, ut(typeof window < "u" && window.innerWidth < 768 ? 16 : 8);
|
|
1390
|
+
const se = {
|
|
1386
1391
|
...Y,
|
|
1387
1392
|
objects: (Array.isArray(Y.objects) ? Y.objects : []).map(
|
|
1388
|
-
(
|
|
1393
|
+
(k) => k?.selectable === !1 ? { ...k, selectable: !0 } : k
|
|
1389
1394
|
)
|
|
1390
1395
|
};
|
|
1391
|
-
if (await u.switchView({ ...d, image: l.urls[d.image] ?? d.image }, typeof e.color == "string" ? e.color : "",
|
|
1392
|
-
const
|
|
1393
|
-
(Array.isArray(e.objects) ? e.objects : []).filter((
|
|
1396
|
+
if (await u.switchView({ ...d, image: l.urls[d.image] ?? d.image }, typeof e.color == "string" ? e.color : "", se), f) return;
|
|
1397
|
+
const j = new Set(
|
|
1398
|
+
(Array.isArray(e.objects) ? e.objects : []).filter((k) => k?.customConfig?.moveable === !0).map((k) => String(k.id ?? ""))
|
|
1394
1399
|
);
|
|
1395
|
-
if (u.canvas.forEachObject((
|
|
1396
|
-
|
|
1397
|
-
}),
|
|
1398
|
-
const
|
|
1399
|
-
|
|
1400
|
+
if (u.canvas.forEachObject((k) => {
|
|
1401
|
+
j.has(String(k.id ?? "")) || k.set({ selectable: !1, evented: !1 });
|
|
1402
|
+
}), i) {
|
|
1403
|
+
const k = u.canvas.getObjects().find((ne) => String(ne.id ?? "") === String(i));
|
|
1404
|
+
k && j.has(String(i)) && u.canvas.setActiveObject(k);
|
|
1400
1405
|
}
|
|
1401
|
-
u.canvas.on("object:modified", () =>
|
|
1406
|
+
u.canvas.on("object:modified", () => B()), u.canvas.requestRenderAll(), await new Promise((k) => requestAnimationFrame(() => k())), f || A(!0);
|
|
1402
1407
|
})().catch((p) => {
|
|
1403
|
-
f ||
|
|
1408
|
+
f || y(p instanceof Error ? p.message : "Could not load the editor.");
|
|
1404
1409
|
}).finally(() => {
|
|
1405
|
-
W = !0, f &&
|
|
1410
|
+
W = !0, f && O(), P.current?.(!1);
|
|
1406
1411
|
}), () => {
|
|
1407
|
-
f = !0, A(!1), W &&
|
|
1412
|
+
f = !0, A(!1), W && O();
|
|
1408
1413
|
};
|
|
1409
|
-
}, []), /* @__PURE__ */
|
|
1410
|
-
/* @__PURE__ */
|
|
1411
|
-
!x && /* @__PURE__ */
|
|
1414
|
+
}, []), /* @__PURE__ */ Ae("div", { className: a, style: { position: "relative", width: "100%", height: "100%", ...n }, children: [
|
|
1415
|
+
/* @__PURE__ */ H("div", { ref: c, style: { position: "absolute", inset: 0, overflow: "hidden" }, children: /* @__PURE__ */ H("canvas", { ref: o }) }),
|
|
1416
|
+
!x && /* @__PURE__ */ H("div", { style: { position: "absolute", inset: 0, background: "#f2f2f2" }, "aria-label": M ? "Editor failed to load" : "Loading editor", children: M && /* @__PURE__ */ H("span", { role: "alert", children: M }) })
|
|
1412
1417
|
] });
|
|
1413
1418
|
}
|
|
1414
1419
|
export {
|
|
1415
|
-
|
|
1416
|
-
|
|
1420
|
+
Et as P,
|
|
1421
|
+
Bt as a
|
|
1417
1422
|
};
|