@jetprint/editor-sdk 1.0.4 → 1.0.6

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.
@@ -101,6 +101,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
101
101
  type: BooleanConstructor;
102
102
  default: boolean;
103
103
  };
104
+ /** 「查看大图」预览(单图大图 / theme1 mockup 画廊)打开时为 true:隐藏选中悬浮键,避免叠在大图上 */
105
+ previewOverlayOpen: {
106
+ type: BooleanConstructor;
107
+ default: boolean;
108
+ };
104
109
  /** default 主题标尺:Fabric 实例(由 Editor 传入) */
105
110
  getFabricCanvas: {
106
111
  type: PropType<() => FabricCanvas | null>;
@@ -205,6 +210,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
205
210
  type: BooleanConstructor;
206
211
  default: boolean;
207
212
  };
213
+ /** 「查看大图」预览(单图大图 / theme1 mockup 画廊)打开时为 true:隐藏选中悬浮键,避免叠在大图上 */
214
+ previewOverlayOpen: {
215
+ type: BooleanConstructor;
216
+ default: boolean;
217
+ };
208
218
  /** default 主题标尺:Fabric 实例(由 Editor 传入) */
209
219
  getFabricCanvas: {
210
220
  type: PropType<() => FabricCanvas | null>;
@@ -249,5 +259,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
249
259
  copying: boolean;
250
260
  loadingDesign: boolean;
251
261
  modeSwitchDisabled: boolean;
262
+ previewOverlayOpen: boolean;
252
263
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
253
264
  export default _default;
@@ -122,6 +122,41 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
122
122
  type: NumberConstructor;
123
123
  default: number;
124
124
  };
125
+ /** theme1 查看大图:可勾选的具体尺码列表(已去掉 SKU_ALL 等占位) */
126
+ sizeOptions: {
127
+ type: PropType<string[]>;
128
+ default: () => never[];
129
+ };
130
+ /** theme1 查看大图:已设计尺码集合(不在此集合且 isPerSizeDesign 时尺码禁用勾选) */
131
+ designedSizes: {
132
+ type: PropType<string[]>;
133
+ default: () => never[];
134
+ };
135
+ /** theme1 查看大图:是否按尺码区分设计(COMMON 同版共享时为 false,则不禁用任何尺码) */
136
+ isPerSizeDesign: {
137
+ type: BooleanConstructor;
138
+ default: boolean;
139
+ };
140
+ /**
141
+ * theme1 查看大图:批量出图方法(来自 index.vue renderEffectImagesForSizesColors)。
142
+ * 给定尺码/颜色集合,返回每张成品效果图 { size, color, index(模板序号), blob }。
143
+ */
144
+ renderEffectImages: {
145
+ type: PropType<(sizes: string[], colors: string[], onImage?: (img: {
146
+ size: string;
147
+ color: string;
148
+ index: number;
149
+ name?: string;
150
+ blob: Blob;
151
+ }) => void) => Promise<Array<{
152
+ size: string;
153
+ color: string;
154
+ index: number;
155
+ name?: string;
156
+ blob: Blob;
157
+ }>>>;
158
+ default: null;
159
+ };
125
160
  theme1LayersExpanded: {
126
161
  type: PropType<boolean>;
127
162
  };
@@ -146,6 +181,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
146
181
  "toggle-preview-render-mode": (...args: any[]) => void;
147
182
  "request-save-design": (...args: any[]) => void;
148
183
  "request-add-to-cart": (...args: any[]) => void;
184
+ "preview-overlay-change": (...args: any[]) => void;
149
185
  "update:theme1LayersExpanded": (value: boolean) => void;
150
186
  "update:theme1PreviewExpanded": (value: boolean) => void;
151
187
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -257,6 +293,41 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
257
293
  type: NumberConstructor;
258
294
  default: number;
259
295
  };
296
+ /** theme1 查看大图:可勾选的具体尺码列表(已去掉 SKU_ALL 等占位) */
297
+ sizeOptions: {
298
+ type: PropType<string[]>;
299
+ default: () => never[];
300
+ };
301
+ /** theme1 查看大图:已设计尺码集合(不在此集合且 isPerSizeDesign 时尺码禁用勾选) */
302
+ designedSizes: {
303
+ type: PropType<string[]>;
304
+ default: () => never[];
305
+ };
306
+ /** theme1 查看大图:是否按尺码区分设计(COMMON 同版共享时为 false,则不禁用任何尺码) */
307
+ isPerSizeDesign: {
308
+ type: BooleanConstructor;
309
+ default: boolean;
310
+ };
311
+ /**
312
+ * theme1 查看大图:批量出图方法(来自 index.vue renderEffectImagesForSizesColors)。
313
+ * 给定尺码/颜色集合,返回每张成品效果图 { size, color, index(模板序号), blob }。
314
+ */
315
+ renderEffectImages: {
316
+ type: PropType<(sizes: string[], colors: string[], onImage?: (img: {
317
+ size: string;
318
+ color: string;
319
+ index: number;
320
+ name?: string;
321
+ blob: Blob;
322
+ }) => void) => Promise<Array<{
323
+ size: string;
324
+ color: string;
325
+ index: number;
326
+ name?: string;
327
+ blob: Blob;
328
+ }>>>;
329
+ default: null;
330
+ };
260
331
  theme1LayersExpanded: {
261
332
  type: PropType<boolean>;
262
333
  };
@@ -273,12 +344,14 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
273
344
  "onToggle-preview-render-mode"?: ((...args: any[]) => any) | undefined;
274
345
  "onRequest-save-design"?: ((...args: any[]) => any) | undefined;
275
346
  "onRequest-add-to-cart"?: ((...args: any[]) => any) | undefined;
347
+ "onPreview-overlay-change"?: ((...args: any[]) => any) | undefined;
276
348
  "onUpdate:theme1LayersExpanded"?: ((value: boolean) => any) | undefined;
277
349
  "onUpdate:theme1PreviewExpanded"?: ((value: boolean) => any) | undefined;
278
350
  }>, {
279
351
  selectedColor: string;
280
352
  templateIndex: number;
281
353
  selectedSize: string;
354
+ sizeOptions: string[];
282
355
  colorOptions: string[];
283
356
  colorLabelByValue: Record<string, string>;
284
357
  loadingDesign: boolean;
@@ -302,6 +375,21 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
302
375
  renderInvalidationKey: string | number;
303
376
  useLiveWebglPreview: boolean;
304
377
  liveWebglInternalRenderSize: number;
378
+ designedSizes: string[];
379
+ isPerSizeDesign: boolean;
380
+ renderEffectImages: (sizes: string[], colors: string[], onImage?: (img: {
381
+ size: string;
382
+ color: string;
383
+ index: number;
384
+ name?: string;
385
+ blob: Blob;
386
+ }) => void) => Promise<Array<{
387
+ size: string;
388
+ color: string;
389
+ index: number;
390
+ name?: string;
391
+ blob: Blob;
392
+ }>>;
305
393
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
306
394
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
307
395
  export default _default;
@@ -22,6 +22,7 @@ export interface UseCopyToDiecutsOptions {
22
22
  targetJsonMap: Record<string, any>;
23
23
  objectIndex: number;
24
24
  targetScaleMap?: Record<string, number>;
25
+ patternScaleMap?: Record<string, number>;
25
26
  sourceCenter?: {
26
27
  x: number;
27
28
  y: number;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * approach B 生产图拼贴(SDK 自包含渲染器内部层):把每分片印刷位图按 productJson 槽位 cover 拼成生产图。
3
+ * 移植自手工镜像 editor-preview.html 的 composeProductionImageToBlob(非 fabricDirect 分支)——拼贴层本就稳定无 bug,
4
+ * 喂入的是真实 SDK 渲染的分片位图。按分片 name 映射(回退 id),不依赖 guideline 中转。
5
+ */
6
+ export interface FabricScreenshotItem {
7
+ id: number | string;
8
+ name?: string;
9
+ blob: Blob;
10
+ }
11
+ export interface PartBounds {
12
+ left: number;
13
+ top: number;
14
+ width: number;
15
+ height: number;
16
+ }
17
+ export interface SplitChild {
18
+ id: number;
19
+ name: string;
20
+ bounds: PartBounds;
21
+ }
22
+ export interface ComposeResult {
23
+ blob: Blob;
24
+ canvasWidth: number;
25
+ canvasHeight: number;
26
+ drawn: string[];
27
+ skipped: string[];
28
+ }
29
+ export declare function getSplitChildrenWithBounds(layerList: any[], layerName?: string): SplitChild[];
30
+ /**
31
+ * @param fabricScreenshotList 每分片印刷位图({id,name,blob})
32
+ * @param productJson 生产图布局:{ canvasWidth, canvasHeight?, layerList(含 split 分组 bounds) }
33
+ */
34
+ export declare function composeProductionImage(fabricScreenshotList: FabricScreenshotItem[], productJson: any, format?: 'png' | 'jpeg'): Promise<ComposeResult>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * 无头生产图渲染 —— 独立打包入口(自包含:内联 Fabric,不含 Vue/编辑器)。
3
+ *
4
+ * 构建产物 `dist/headless.global.js` 暴露 `window.generateProductionImage`,供 Go 切图服务的无头 host 页
5
+ * 在 chromedp 中加载调用:
6
+ * window.generateProductionImage({ fabricJson, productJson, fileToken, size, imageFormat }) → Promise<Blob>
7
+ *
8
+ * 是 @jetprint/editor-sdk 包的一部分(随 SDK 版本同步),Go 侧 `npm i @jetprint/editor-sdk` 后 go:embed 此文件即可。
9
+ */
10
+ import { generateProductionImage, type GenerateProductionImageInput } from './productionRender';
11
+ declare global {
12
+ interface Window {
13
+ generateProductionImage?: (input: GenerateProductionImageInput) => Promise<Blob>;
14
+ }
15
+ }
16
+ export { generateProductionImage };
17
+ export type { GenerateProductionImageInput };
@@ -0,0 +1,47 @@
1
+ import { type FabricScreenshotItem } from './composeProductionImage';
2
+ export interface GenerateProductionImageInput {
3
+ /** 保存的画布 JSON:URL 字符串 或 已解析对象 */
4
+ fabricJson: string | Record<string, unknown>;
5
+ /** 生产图布局 JSON:URL 字符串 或 已解析对象 */
6
+ productJson: string | Record<string, unknown>;
7
+ /** 资源访问 token(拼到 img.r480.cn 等资源 URL) */
8
+ fileToken?: string;
9
+ /** 要渲染的尺码(多尺码必传;旧单尺码/COMMON 可空) */
10
+ size?: string;
11
+ /** 输出格式,默认 png */
12
+ imageFormat?: 'png' | 'jpeg';
13
+ /**
14
+ * 调试:整稿还原模式(复用旧 ?fabric_direct=1 链路)。true 时每分片只做 fabric 还原,
15
+ * 跳过刀模 MASK 与裁切,按分片画布原样拼贴 —— 用于在切图前核对图层还原是否正确。
16
+ */
17
+ fabricDirect?: boolean;
18
+ }
19
+ /** 一个待渲染分片:设计状态 + 该分片保存时画布尺寸 + 刀模/引导信息 */
20
+ export interface DiecutPieceRenderTask {
21
+ /** 分片 groupId(与 productJson 槽位按 name/id 对应) */
22
+ groupId: string;
23
+ name: string;
24
+ /** 该分片的设计状态(fabric stateMap entry:{version, objects, ...}) */
25
+ state: Record<string, unknown>;
26
+ /** 该分片保存时的画布逻辑宽高(新格式每分片自带;旧格式回退顶层/默认) */
27
+ savedCanvasW: number;
28
+ savedCanvasH: number;
29
+ /** 该分片对应的刀模资源(MASK / DOTTED_LINE 等,含 url/width/height) */
30
+ resources: any[];
31
+ /** 该尺码刀模模板的 guideline(PSD 结构,含 split 分片 bounds),用于裁切几何 */
32
+ guideline: any;
33
+ }
34
+ /**
35
+ * 解析 fabricJson 并按 size 取该尺码各分片的渲染任务。兼容新/旧格式:
36
+ * - stateMap 键:新=`${groupId}::${size}` 复合键;旧=裸 `${groupId}`(单尺码)。
37
+ * - 每分片画布尺寸:新=entry.designCanvasSize/Height;旧=回退顶层 designCanvasSize/Height,再回退默认。
38
+ * - data[]:按 size 取该尺码的刀模模板(含内联 guideline 与 resources);旧=default/COMMON。
39
+ */
40
+ export declare function resolveSizePieceTasks(fabric: any, mode: 'COMPLETE' | 'SPLIT', size?: string): DiecutPieceRenderTask[];
41
+ /**
42
+ * 每个分片离屏还原 → 应用刀模 mask → 裁切 → 印刷位图。复用 SDK 真实渲染核心(PatternLayer)+ 每分片画布尺寸(免缩放)。
43
+ * 注:当前为 SPLIT 单片路径(每 task=一分片)。COMPLETE 单稿→多分片裁切为下一步。
44
+ */
45
+ export declare function renderDiecutPieceBitmaps(tasks: DiecutPieceRenderTask[], fileToken?: string, restoreOnly?: boolean): Promise<FabricScreenshotItem[]>;
46
+ /** 自包含生产图:解析 → 每分片渲染 → productJson 拼贴。 */
47
+ export declare function generateProductionImage(input: GenerateProductionImageInput): Promise<Blob>;
@@ -42,15 +42,15 @@ type EditorProps = {
42
42
  /** 左侧栏额外 Tab(竖条 + 内容区由宿主传入 Vue 组件) */
43
43
  customSidebarTabs?: CustomSidebarTabDef[];
44
44
  };
45
- declare var __VLS_21: {}, __VLS_27: {}, __VLS_134: {}, __VLS_140: {};
45
+ declare var __VLS_21: {}, __VLS_27: {}, __VLS_135: {}, __VLS_141: {};
46
46
  type __VLS_Slots = {} & {
47
47
  'topbar-left'?: (props: typeof __VLS_21) => any;
48
48
  } & {
49
49
  'topbar-right'?: (props: typeof __VLS_27) => any;
50
50
  } & {
51
- 'topbar-left'?: (props: typeof __VLS_134) => any;
51
+ 'topbar-left'?: (props: typeof __VLS_135) => any;
52
52
  } & {
53
- 'topbar-right'?: (props: typeof __VLS_140) => any;
53
+ 'topbar-right'?: (props: typeof __VLS_141) => any;
54
54
  };
55
55
  declare const __VLS_component: import("vue").DefineComponent<EditorProps, {
56
56
  renderAllTemplates: () => Promise<Array<{
@@ -66,7 +66,13 @@ declare const __VLS_component: import("vue").DefineComponent<EditorProps, {
66
66
  color: string;
67
67
  bundle: any;
68
68
  }>>;
69
- renderEffectImagesForSizesColors: (sizes?: string[], colors?: string[]) => Promise<Array<{
69
+ renderEffectImagesForSizesColors: (sizes?: string[], colors?: string[], onImage?: (img: {
70
+ size: string;
71
+ color: string;
72
+ index: number;
73
+ name?: string;
74
+ blob: Blob;
75
+ }) => void) => Promise<Array<{
70
76
  size: string;
71
77
  color: string;
72
78
  index: number;
@@ -8,6 +8,8 @@ type CopyDiecutsWorkerRequest = {
8
8
  targetJsonMap: Record<string, any>;
9
9
  objectIndex: number;
10
10
  targetScaleMap?: Record<string, number>;
11
+ /** 平铺专用:每个目标分片的「最长边比例」(源最长边/目标最长边),平铺 rect 的瓦片+cover 按此缩放(物理一致) */
12
+ patternScaleMap?: Record<string, number>;
11
13
  /** 源分片在画布上 contain-fit 矩形中心;与 targetCenterMap 配合按"在分片内的相对位置"映射 */
12
14
  sourceCenter?: Vec2;
13
15
  /** 各目标分片在画布上 contain-fit 矩形中心 */
@@ -20,7 +22,7 @@ type CopyDiecutsWorkerRequest = {
20
22
  * - 缩放保持原 contain-fit 比例换算(scaleFactor)。
21
23
  * - 位置按"在源分片内的相对位置"映射到目标分片对应位置(sourceCenter → targetCenter)。
22
24
  */
23
- declare const cloneForCopy: (obj: any, startId: number, scaleFactor: number, sourceCenter?: Vec2, targetCenter?: Vec2) => {
25
+ declare const cloneForCopy: (obj: any, startId: number, scaleFactor: number, sourceCenter?: Vec2, targetCenter?: Vec2, patternFactor?: number) => {
24
26
  cloned: any;
25
27
  nextId: number;
26
28
  };
@@ -1,67 +1,77 @@
1
- const B = (t, i, s, c, r) => {
2
- const n = JSON.parse(JSON.stringify(t));
3
- n.customData || (n.customData = {}), n.customData.id = i;
4
- const a = C(n), f = (a.minL + a.maxR) / 2, l = (a.minT + a.maxB) / 2, o = !!n.customData?.isPatternRect;
5
- if (s !== 1 && !o && (n.scaleX = (n.scaleX ?? 1) * s, n.scaleY = (n.scaleY ?? 1) * s), c && r) {
6
- const e = C(n), x = (e.minL + e.maxR) / 2, g = (e.minT + e.maxB) / 2, p = r.x + (f - c.x) * s, y = r.y + (l - c.y) * s;
7
- n.left = (n.left ?? 0) + p - x, n.top = (n.top ?? 0) + y - g;
1
+ const D = (e, l, i, o, f, r = 1) => {
2
+ const t = JSON.parse(JSON.stringify(e));
3
+ t.customData || (t.customData = {}), t.customData.id = l;
4
+ const m = T(t), h = (m.minL + m.maxR) / 2, a = (m.minT + m.maxB) / 2, n = !!t.customData?.isPatternRect, p = n ? r : i;
5
+ if (!n)
6
+ i !== 1 && (t.scaleX = (t.scaleX ?? 1) * i, t.scaleY = (t.scaleY ?? 1) * i);
7
+ else if (r !== 1) {
8
+ const s = t.customData;
9
+ Number(s.patternTileWidth) > 0 && (s.patternTileWidth = Number(s.patternTileWidth) * r), Number(s.patternTileHeight) > 0 && (s.patternTileHeight = Number(s.patternTileHeight) * r), Number(t.width) > 0 && (t.width = Number(t.width) * r), Number(t.height) > 0 && (t.height = Number(t.height) * r);
8
10
  }
9
- return { cloned: n, nextId: i + 1 };
10
- }, A = (t) => t === "left" || t === "top" ? -0.5 : t === "center" ? 0 : t === "right" || t === "bottom" ? 0.5 : 0, C = (t) => {
11
- const i = t.left ?? 0, s = t.top ?? 0, c = (t.width ?? 0) * (t.scaleX ?? 1), r = (t.height ?? 0) * (t.scaleY ?? 1), a = (t.angle ?? 0) * Math.PI / 180, f = Math.cos(a), l = Math.sin(a), o = -A(t.originX ?? "left") * c, e = -A(t.originY ?? "top") * r, x = i + o * f - e * l, g = s + o * l + e * f, p = c / 2, y = r / 2, d = [-p, p].flatMap(
12
- (m) => [-y, y].map((M) => ({
13
- x: x + m * f - M * l,
14
- y: g + m * l + M * f
11
+ if (o && f) {
12
+ const s = T(t), d = (s.minL + s.maxR) / 2, y = (s.minT + s.maxB) / 2, g = f.x + (h - o.x) * p, u = f.y + (a - o.y) * p;
13
+ if (t.left = (t.left ?? 0) + g - d, t.top = (t.top ?? 0) + u - y, n && t.customData) {
14
+ const c = t.customData;
15
+ typeof c.patternPhaseX == "number" && (c.patternPhaseX = f.x + (c.patternPhaseX - o.x) * p), typeof c.patternPhaseY == "number" && (c.patternPhaseY = f.y + (c.patternPhaseY - o.y) * p);
16
+ }
17
+ }
18
+ return { cloned: t, nextId: l + 1 };
19
+ }, M = (e) => e === "left" || e === "top" ? -0.5 : e === "center" ? 0 : e === "right" || e === "bottom" ? 0.5 : 0, T = (e) => {
20
+ const l = e.left ?? 0, i = e.top ?? 0, o = (e.width ?? 0) * (e.scaleX ?? 1), f = (e.height ?? 0) * (e.scaleY ?? 1), t = (e.angle ?? 0) * Math.PI / 180, m = Math.cos(t), h = Math.sin(t), a = -M(e.originX ?? "left") * o, n = -M(e.originY ?? "top") * f, p = l + a * m - n * h, s = i + a * h + n * m, d = o / 2, y = f / 2, g = [-d, d].flatMap(
21
+ (x) => [-y, y].map((N) => ({
22
+ x: p + x * m - N * h,
23
+ y: s + x * h + N * m
15
24
  }))
16
25
  );
17
- let h = 1 / 0, u = 1 / 0, b = -1 / 0, I = -1 / 0;
18
- for (const m of d)
19
- m.x < h && (h = m.x), m.y < u && (u = m.y), m.x > b && (b = m.x), m.y > I && (I = m.y);
20
- return { minL: h, minT: u, maxR: b, maxB: I };
21
- }, O = (t, i, s) => {
22
- if (!t.length) return;
23
- let c = 1 / 0, r = 1 / 0, n = -1 / 0, a = -1 / 0;
24
- for (const o of t) {
25
- const e = C(o);
26
- e.minL < c && (c = e.minL), e.minT < r && (r = e.minT), e.maxR > n && (n = e.maxR), e.maxB > a && (a = e.maxB);
26
+ let u = 1 / 0, c = 1 / 0, I = -1 / 0, b = -1 / 0;
27
+ for (const x of g)
28
+ x.x < u && (u = x.x), x.y < c && (c = x.y), x.x > I && (I = x.x), x.y > b && (b = x.y);
29
+ return { minL: u, minT: c, maxR: I, maxB: b };
30
+ }, P = (e, l, i) => {
31
+ if (!e.length) return;
32
+ let o = 1 / 0, f = 1 / 0, r = -1 / 0, t = -1 / 0;
33
+ for (const a of e) {
34
+ const n = T(a);
35
+ n.minL < o && (o = n.minL), n.minT < f && (f = n.minT), n.maxR > r && (r = n.maxR), n.maxB > t && (t = n.maxB);
27
36
  }
28
- const f = i - (c + n) / 2, l = s - (r + a) / 2;
29
- for (const o of t)
30
- o.left = (o.left ?? 0) + f, o.top = (o.top ?? 0) + l;
31
- }, R = (t) => {
37
+ const m = l - (o + r) / 2, h = i - (f + t) / 2;
38
+ for (const a of e)
39
+ a.left = (a.left ?? 0) + m, a.top = (a.top ?? 0) + h;
40
+ }, w = (e) => {
32
41
  const {
33
- sourceObjects: i,
34
- targetJsonMap: s,
35
- objectIndex: c,
36
- targetScaleMap: r,
37
- sourceCenter: n,
38
- targetCenterMap: a,
39
- canvasCenter: f
40
- } = t;
41
- let l = Number.isFinite(c) ? c : 1;
42
- const o = {};
43
- return Object.entries(s || {}).forEach(([e, x]) => {
44
- const g = Array.isArray(x?.objects) ? x.objects : [], p = r?.[e] ?? 1, y = a?.[e], d = [];
45
- i.forEach((h) => {
46
- const u = B(h, l, p, n, y);
47
- d.push(u.cloned), l = u.nextId;
48
- }), (!n || !y) && f && d.length && O(d, f.x, f.y), o[e] = { ...x, objects: [...g, ...d] };
49
- }), { updates: o, nextObjectIndex: l };
42
+ sourceObjects: l,
43
+ targetJsonMap: i,
44
+ objectIndex: o,
45
+ targetScaleMap: f,
46
+ patternScaleMap: r,
47
+ sourceCenter: t,
48
+ targetCenterMap: m,
49
+ canvasCenter: h
50
+ } = e;
51
+ let a = Number.isFinite(o) ? o : 1;
52
+ const n = {};
53
+ return Object.entries(i || {}).forEach(([p, s]) => {
54
+ const d = Array.isArray(s?.objects) ? s.objects : [], y = f?.[p] ?? 1, g = r?.[p] ?? 1, u = m?.[p], c = [];
55
+ l.forEach((I) => {
56
+ const b = D(I, a, y, t, u, g);
57
+ c.push(b.cloned), a = b.nextId;
58
+ }), (!t || !u) && h && c.length && P(c, h.x, h.y), n[p] = { ...s, objects: [...d, ...c] };
59
+ }), { updates: n, nextObjectIndex: a };
50
60
  };
51
- self.onmessage = (t) => {
52
- const i = t.data;
61
+ self.onmessage = (e) => {
62
+ const l = e.data;
53
63
  try {
54
- const s = R(i);
64
+ const i = w(l);
55
65
  self.postMessage({
56
- id: i.id,
66
+ id: l.id,
57
67
  ok: !0,
58
- data: s
68
+ data: i
59
69
  });
60
- } catch (s) {
70
+ } catch (i) {
61
71
  self.postMessage({
62
- id: i.id,
72
+ id: l.id,
63
73
  ok: !1,
64
- error: s instanceof Error ? s.message : String(s)
74
+ error: i instanceof Error ? i.message : String(i)
65
75
  });
66
76
  }
67
77
  };