@netless/appliance-plugin 1.1.44-beta.0 → 1.1.44

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.
Files changed (64) hide show
  1. package/dist/appliance-plugin.js +1 -1
  2. package/dist/appliance-plugin.mjs +12 -12
  3. package/dist/{bridge-CskJoX5M.js → bridge-B7BW1lpB.js} +1 -1
  4. package/dist/{bridge-rKHCYJ6m.mjs → bridge-DQud78k4.mjs} +1 -1
  5. package/dist/bridge.js +1 -1
  6. package/dist/bridge.mjs +1 -1
  7. package/dist/collector/types.d.ts +0 -3
  8. package/dist/component/textEditor/types.d.ts +0 -5
  9. package/dist/core/mainThread/base.d.ts +5 -1
  10. package/dist/core/mainThread/snapshotThread.d.ts +2 -3
  11. package/dist/core/mainThread/subLocalThread.d.ts +2 -5
  12. package/dist/core/mainThread/subServiceThread.d.ts +2 -1
  13. package/dist/core/mainThread/subTopThread.d.ts +2 -2
  14. package/dist/core/tools/arrow.d.ts +1 -423
  15. package/dist/core/tools/base.d.ts +2 -444
  16. package/dist/core/tools/ellipse.d.ts +1 -423
  17. package/dist/core/tools/eraser.d.ts +2 -846
  18. package/dist/core/tools/eraserFaces.d.ts +0 -2
  19. package/dist/core/tools/image.d.ts +1 -0
  20. package/dist/core/tools/laserPen.d.ts +2 -846
  21. package/dist/core/tools/pencil.d.ts +2 -848
  22. package/dist/core/tools/pencilEraser.d.ts +4 -1692
  23. package/dist/core/tools/pencilEraserBitMap.d.ts +5 -2115
  24. package/dist/core/tools/polygon.d.ts +1 -423
  25. package/dist/core/tools/rectangle.d.ts +1 -423
  26. package/dist/core/tools/selector.d.ts +7 -2121
  27. package/dist/core/tools/speechBalloon.d.ts +1 -423
  28. package/dist/core/tools/star.d.ts +1 -423
  29. package/dist/core/tools/straight.d.ts +1 -423
  30. package/dist/core/tools/text.d.ts +3 -3
  31. package/dist/core/tools/utils.d.ts +2 -2
  32. package/dist/core/types.d.ts +0 -9
  33. package/dist/core/utils/index.d.ts +0 -2
  34. package/dist/core/utils/serviceImageRecovery.d.ts +9 -0
  35. package/dist/core/vNodeManager.d.ts +1 -1
  36. package/dist/core/worker/base.d.ts +6 -2
  37. package/dist/core/worker/fullWorkerLocal.d.ts +0 -1
  38. package/dist/core/worker/fullWorkerService.d.ts +4 -2
  39. package/dist/core/worker/simpleWorker.d.ts +2 -2
  40. package/dist/core/worker/subWorkerTopLayer.d.ts +2 -2
  41. package/dist/fullWorker.js +148 -149
  42. package/dist/{index-Ca2t53R7.mjs → index-4ZI3GxVI.mjs} +1 -1
  43. package/dist/{index-ZMuKk-bl.js → index-AJCkfnUu.js} +1 -1
  44. package/dist/{index-ConirzkM.mjs → index-B8Ls8sf_.mjs} +1 -1
  45. package/dist/{index-BbBSxLGe.mjs → index-BBtV40zU.mjs} +563 -490
  46. package/dist/{index-C-tBYq0K.js → index-BOzOWS7h.js} +1 -1
  47. package/dist/index-BQiBrpib.js +1 -0
  48. package/dist/index-BYriQtGa.js +1 -0
  49. package/dist/{index-_3yxgNoj.mjs → index-C2tUvh2a.mjs} +11964 -12224
  50. package/dist/{index-DWevrjrE.mjs → index-DSFxl2wM.mjs} +11917 -12168
  51. package/dist/index-DnJkIouU.js +570 -0
  52. package/dist/index-DptnZ-h8.js +570 -0
  53. package/dist/{index-LcCU1tMV.mjs → index-ZUpKkvbD.mjs} +563 -490
  54. package/dist/subWorker.js +132 -133
  55. package/package.json +3 -4
  56. package/dist/core/utils/affineMatrix.d.ts +0 -33
  57. package/dist/core/utils/fontFamily.d.ts +0 -8
  58. package/dist/core/utils/selectorMatrix.d.ts +0 -4
  59. package/dist/core/utils/selectorRefresh.d.ts +0 -8
  60. package/dist/core/utils/textRaster.d.ts +0 -2
  61. package/dist/index-B0SB7Efu.js +0 -570
  62. package/dist/index-BIVRfc_x.js +0 -570
  63. package/dist/index-Bzg5OMdP.js +0 -1
  64. package/dist/index-CsNG_bzI.js +0 -1
@@ -1,16 +1,52 @@
1
- var we = Object.defineProperty;
2
- var ve = (M, e, t) => e in M ? we(M, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : M[e] = t;
3
- var u = (M, e, t) => ve(M, typeof e != "symbol" ? e + "" : e, t);
4
- import { D as K, e as b, c as m, r as $, b as E, g as Z, t as V, a as h, f as de, M as ke, h as D, i as j, j as Se, C as H, k as z, l as Ie, m as te, n as ge, o as se, p as Te, q as We, s as re, u as ie, v as Y, w as _, x as pe, E as C, y as ee, z as Q, A as Re, B as Ee, F as be, G as Le, H as Ne, I as ue, J as fe, T as oe, K as ae, L as Ce, N as Be, P as me, Q as ye, R as ne, U as Oe, W as De, S as ce, X as q, Y as Me, V as he, Z as Pe } from "./index-DWevrjrE.mjs";
5
- import { cloneDeep as J, xor as Ae, isNumber as G, isEqual as le } from "lodash";
1
+ var ke = Object.defineProperty;
2
+ var Se = (D, e, t) => e in D ? ke(D, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : D[e] = t;
3
+ var u = (D, e, t) => Se(D, typeof e != "symbol" ? e + "" : e, t);
4
+ import { D as Y, e as b, c as m, r as K, b as R, g as J, t as H, a as h, f as fe, M as Ie, h as P, i as ee, j as ge, C as j, k as _, l as Te, m as ie, n as We, o as oe, p as Re, q as Ee, s as ae, u as ne, v as Z, w as Q, E as N, x as se, y as X, z as be, A as me, B as ye, F as Le, G as Ce, H as Ne, I as Be, T as ce, J as he, K as Oe, L as De, N as we, P as ve, Q as le, R as Me, S as de, U as $, W as Pe, V as pe, X as Ae } from "./index-DSFxl2wM.mjs";
5
+ import { cloneDeep as te, xor as Fe, isNumber as z, isEqual as ue } from "lodash";
6
6
  import "clipper-lib";
7
7
  import "lineclip";
8
- import "xss";
9
8
  import "rbush";
9
+ import "xss";
10
10
  import "white-web-sdk";
11
11
  import "react-dom";
12
12
  import "react";
13
- class Fe {
13
+ class Ue {
14
+ constructor() {
15
+ u(this, "jobs", /* @__PURE__ */ new Map());
16
+ }
17
+ request(e, t, s, r, i) {
18
+ const o = this.jobs.get(e);
19
+ if ((o == null ? void 0 : o.src) === t) return;
20
+ this.cancel(e);
21
+ const a = { src: t };
22
+ this.jobs.set(e, a), (async () => {
23
+ if (this.jobs.get(e) !== a) return;
24
+ if (!r()) {
25
+ this.cancel(e);
26
+ return;
27
+ }
28
+ let c;
29
+ try {
30
+ c = await s();
31
+ } catch {
32
+ }
33
+ if (this.jobs.get(e) === a) {
34
+ if (!r()) {
35
+ this.cancel(e);
36
+ return;
37
+ }
38
+ c && (this.jobs.delete(e), i(c));
39
+ }
40
+ })();
41
+ }
42
+ cancel(e) {
43
+ this.jobs.delete(e);
44
+ }
45
+ clear() {
46
+ for (const e of this.jobs.keys()) this.cancel(e);
47
+ }
48
+ }
49
+ class xe {
14
50
  constructor(e) {
15
51
  u(this, "vNodes");
16
52
  u(this, "thread");
@@ -18,7 +54,7 @@ class Fe {
18
54
  u(this, "localWorkShapes", /* @__PURE__ */ new Map());
19
55
  u(this, "tmpOpt");
20
56
  u(this, "animationId");
21
- u(this, "syncUnitTime", K.syncOpt.interval);
57
+ u(this, "syncUnitTime", Y.syncOpt.interval);
22
58
  this.vNodes = e.vNodes, this.thread = e.thread;
23
59
  }
24
60
  createLocalWork(e) {
@@ -56,14 +92,14 @@ class Fe {
56
92
  clearAll() {
57
93
  this.thread.topLayer.children.length && (this.thread.topLayer.parent.children.forEach((e) => {
58
94
  e.name !== "viewport" && e.remove();
59
- }), $(
95
+ }), K(
60
96
  this.thread.serviceLayer,
61
97
  this.thread.serviceLayer.parent
62
98
  )), this.serviceWorkShapes.clear(), this.localWorkShapes.clear();
63
99
  }
64
100
  consumeDraw(e) {
65
101
  const { workId: t, dataType: s } = e;
66
- if (s === E.Service)
102
+ if (s === R.Service)
67
103
  this.activeServiceWorkShape(e);
68
104
  else {
69
105
  const r = t == null ? void 0 : t.toString(), i = r && this.localWorkShapes.get(r);
@@ -88,7 +124,7 @@ class Fe {
88
124
  createWorkShapeNode(e) {
89
125
  const { toolsType: t } = e;
90
126
  if (t === m.LaserPen)
91
- return Z({
127
+ return J({
92
128
  ...e,
93
129
  vNodes: this.vNodes,
94
130
  fullLayer: this.thread.topLayer,
@@ -121,7 +157,7 @@ class Fe {
121
157
  r && s && (w = this.setNodeKey(c, w, r, s)), this.serviceWorkShapes.set(c, w);
122
158
  }
123
159
  const l = this.serviceWorkShapes.get(c);
124
- i && (l.type = i), a && (l.animationWorkData = V(a), l.ops = a), o && (l.updateNodeOpt = o), n && (l.animationWorkData = n), l.node && l.node.getWorkId() !== c && l.node.setWorkId(c), d && (l.oldRect = d), r && s && (l.toolsType !== r && r && s && this.setNodeKey(c, l, r, s), l.node && l.node.setWorkOptions(s));
160
+ i && (l.type = i), a && (l.animationWorkData = H(a), l.ops = a), o && (l.updateNodeOpt = o), n && (l.animationWorkData = n), l.node && l.node.getWorkId() !== c && l.node.setWorkId(c), d && (l.oldRect = d), r && s && (l.toolsType !== r && r && s && this.setNodeKey(c, l, r, s), l.node && l.node.setWorkOptions(s));
125
161
  }
126
162
  computNextAnimationIndex(e, t) {
127
163
  var i;
@@ -185,7 +221,7 @@ class Fe {
185
221
  e && this.runAnimation(), t.size && t.forEach((n, c) => {
186
222
  s.push({
187
223
  type: h.Cursor,
188
- uid: c.split(de)[0],
224
+ uid: c.split(fe)[0],
189
225
  op: n.op,
190
226
  workState: n.workState,
191
227
  viewId: this.thread.viewId
@@ -210,7 +246,7 @@ class Fe {
210
246
  }
211
247
  consumeDrawAll(e) {
212
248
  const { workId: t, dataType: s } = e;
213
- if (s === E.Service)
249
+ if (s === R.Service)
214
250
  this.activeServiceWorkShape(e);
215
251
  else {
216
252
  const r = t == null ? void 0 : t.toString(), i = r && this.localWorkShapes.get(r);
@@ -224,7 +260,7 @@ class Fe {
224
260
  this.runAnimation();
225
261
  }
226
262
  }
227
- class xe {
263
+ class Ge {
228
264
  constructor(e) {
229
265
  u(this, "vNodes");
230
266
  u(this, "thread");
@@ -233,12 +269,12 @@ class xe {
233
269
  u(this, "batchEraserRemoveNodes", /* @__PURE__ */ new Set());
234
270
  u(this, "batchEraserWorks", /* @__PURE__ */ new Set());
235
271
  u(this, "tmpOpt");
236
- u(this, "syncUnitTime", K.syncOpt.interval);
272
+ u(this, "syncUnitTime", Y.syncOpt.interval);
237
273
  u(this, "fullWorkerDrawCount", 0);
238
274
  u(this, "drawWorkActiveId");
239
275
  u(this, "consumeCount", 0);
240
276
  u(this, "combineDrawActiveId");
241
- u(this, "eraserBatchScheduler", new ke());
277
+ u(this, "eraserBatchScheduler", new Ie());
242
278
  u(this, "disposeVNodeRevisionObserver");
243
279
  u(this, "bitmapEraserRenderQueue", Promise.resolve());
244
280
  u(this, "bitmapEraserRevalidationQueued", !1);
@@ -285,26 +321,25 @@ class xe {
285
321
  async updateSelector(e) {
286
322
  var f;
287
323
  const t = this.workShapes.get(
288
- D
324
+ P
289
325
  );
290
326
  if (!((f = t == null ? void 0 : t.selectIds) != null && f.length)) return;
291
327
  const { callback: s, ...r } = e, { updateSelectorOpt: i, willSerializeData: o, smoothSync: a } = r, n = await (t == null ? void 0 : t.updateSelector({
292
328
  updateSelectorOpt: i,
293
- selectIds: J(t.selectIds),
329
+ selectIds: te(t.selectIds),
294
330
  vNodes: this.vNodes,
295
331
  willSerializeData: o,
296
332
  worker: this
297
333
  })), c = /* @__PURE__ */ new Map();
298
334
  let d;
299
- n != null && n.selectIds && (d = Ae(t.selectIds, n.selectIds), n.selectIds.forEach((w) => {
335
+ n != null && n.selectIds && (d = Fe(t.selectIds, n.selectIds), n.selectIds.forEach((w) => {
300
336
  const k = this.vNodes.get(w);
301
337
  if (k) {
302
- const { toolsType: I, op: R, opt: g } = k;
338
+ const { toolsType: I, op: E, opt: g } = k;
303
339
  c.set(w, {
304
340
  opt: g,
305
341
  toolsType: I,
306
- ops: (R == null ? void 0 : R.length) && j(R) || void 0,
307
- previewMatrix: k.previewMatrix
342
+ ops: (E == null ? void 0 : E.length) && ee(E) || void 0
308
343
  });
309
344
  }
310
345
  }), t.selectIds = n.selectIds);
@@ -329,16 +364,16 @@ class xe {
329
364
  clearAll() {
330
365
  if (this.eraserBatchScheduler.cancel(), this.thread.localLayer.children.length && (this.thread.topLayer.parent.children.forEach((t) => {
331
366
  t.name !== "viewport" && t.remove();
332
- }), $(
367
+ }), K(
333
368
  this.thread.localLayer,
334
369
  this.thread.localLayer.parent
335
370
  )), this.workShapes.get(
336
- D
371
+ P
337
372
  )) {
338
373
  const t = [];
339
374
  t.push({
340
375
  type: h.Select,
341
- dataType: E.Local,
376
+ dataType: R.Local,
342
377
  selectIds: [],
343
378
  willSyncService: !1
344
379
  }), this.thread.post({ sp: t });
@@ -351,7 +386,7 @@ class xe {
351
386
  let i;
352
387
  for (const o of this.vNodes.curNodeMap.values()) {
353
388
  const { rect: a, name: n, toolsType: c, opt: d } = o, l = t[0] * this.thread.fullLayer.worldScaling[0] + this.thread.fullLayer.worldPosition[0], p = t[1] * this.thread.fullLayer.worldScaling[1] + this.thread.fullLayer.worldPosition[1];
354
- if (c === m.Text && Se([l, p], a) && d.workState === b.Done) {
389
+ if (c === m.Text && ge([l, p], a) && d.workState === b.Done) {
355
390
  i = n;
356
391
  break;
357
392
  }
@@ -374,7 +409,7 @@ class xe {
374
409
  }
375
410
  cursorHover(e) {
376
411
  const { opt: t, toolsType: s, point: r } = e, i = this.setFullWork({
377
- workId: H,
412
+ workId: j,
378
413
  toolsType: s,
379
414
  opt: t
380
415
  });
@@ -382,15 +417,15 @@ class xe {
382
417
  }
383
418
  cursorBlur() {
384
419
  var t;
385
- const e = this.getWorkShape(H);
386
- e && ((t = e.selectIds) != null && t.length) && (e.cursorBlur(), this.clearWorkShapeNodeCache(H)), this.thread.fullLayer.parent.children.forEach((s) => {
420
+ const e = this.getWorkShape(j);
421
+ e && ((t = e.selectIds) != null && t.length) && (e.cursorBlur(), this.clearWorkShapeNodeCache(j)), this.thread.fullLayer.parent.children.forEach((s) => {
387
422
  s.name === "Cursor_Hover_Id" && s.remove();
388
423
  });
389
424
  }
390
425
  async updateFullSelectWork(e) {
391
426
  var r, i, o, a, n;
392
427
  const t = this.workShapes.get(
393
- D
428
+ P
394
429
  ), { selectIds: s } = e;
395
430
  if (!(s != null && s.length)) {
396
431
  await this.blurSelector(e);
@@ -398,7 +433,7 @@ class xe {
398
433
  }
399
434
  if (!t) {
400
435
  this.setFullWork({
401
- workId: D,
436
+ workId: P,
402
437
  toolsType: m.Selector,
403
438
  opt: e.opt || (((r = this.tmpOpt) == null ? void 0 : r.toolsType) === m.Selector ? this.tmpOpt.toolsOpt : {})
404
439
  }) && await this.updateFullSelectWork(e);
@@ -416,7 +451,7 @@ class xe {
416
451
  scaleType: t.scaleType,
417
452
  type: h.Select,
418
453
  viewId: this.thread.viewId,
419
- dataType: E.Local,
454
+ dataType: R.Local,
420
455
  selectIds: s,
421
456
  selectRect: c,
422
457
  points: t.getChildrenPoints(),
@@ -436,7 +471,7 @@ class xe {
436
471
  }
437
472
  async removeSelector(e) {
438
473
  const { willSyncService: t, needUndoTicker: s } = e, r = [], i = [], o = this.workShapes.get(
439
- D
474
+ P
440
475
  );
441
476
  if (!o)
442
477
  return;
@@ -450,7 +485,7 @@ class xe {
450
485
  type: h.TextUpdate,
451
486
  toolsType: m.Text,
452
487
  workId: n,
453
- dataType: E.Local
488
+ dataType: R.Local
454
489
  });
455
490
  break;
456
491
  }
@@ -459,7 +494,7 @@ class xe {
459
494
  type: h.BackgroundSVGDelete,
460
495
  toolsType: m.BackgroundSVG,
461
496
  workId: n,
462
- dataType: E.Local,
497
+ dataType: R.Local,
463
498
  viewId: this.thread.viewId
464
499
  });
465
500
  break;
@@ -494,14 +529,14 @@ class xe {
494
529
  type: h.BackgroundSVGDelete,
495
530
  toolsType: m.BackgroundSVG,
496
531
  workId: e,
497
- dataType: E.Local,
532
+ dataType: R.Local,
498
533
  viewId: this.thread.viewId
499
534
  }
500
535
  ]
501
536
  }), (r = this.thread.fullLayer) == null || r.getElementsByName(e).forEach((i) => {
502
- i.remove(), z(i, this.thread.fullLayer.parent);
537
+ i.remove(), _(i, this.thread.fullLayer.parent);
503
538
  }), this.vNodes.delete(e)), this.workShapes.has(e) && (this.thread.localLayer.getElementsByName(e).forEach((i) => {
504
- i.remove(), z(i, this.thread.localLayer.parent);
539
+ i.remove(), _(i, this.thread.localLayer.parent);
505
540
  }), this.clearWorkShapeNodeCache(e));
506
541
  }
507
542
  setFullWork(e) {
@@ -521,27 +556,27 @@ class xe {
521
556
  }
522
557
  }
523
558
  async consumeFull(e) {
524
- var o, a, n;
559
+ var o, a;
525
560
  const t = (o = e.workId) == null ? void 0 : o.toString(), s = (a = e.updateNodeOpt) == null ? void 0 : a.eraserGeometryDelta;
526
561
  if (t) {
527
- const c = this.vNodes.get(t), d = e.ops && V(e.ops) || e.op || [];
562
+ const n = this.vNodes.get(t), c = e.ops && H(e.ops) || e.op || [];
528
563
  if (s) {
529
- if (!c || !e.centerPos || !Ie(
564
+ if (!n || !e.centerPos || !Te(
530
565
  this.vNodes,
531
566
  t,
532
567
  s,
533
- c,
534
- { op: d, centerPos: e.centerPos }
568
+ n,
569
+ { op: c, centerPos: e.centerPos }
535
570
  )) {
536
- te(this.vNodes, t);
571
+ ie(this.vNodes, t);
537
572
  return;
538
573
  }
539
- } else c && e.centerPos && ge(this.vNodes, t) && se(c.op, c.centerPos) !== se(d, e.centerPos) && te(this.vNodes, t);
574
+ } else n && e.centerPos && We(this.vNodes, t) && oe(n.op, n.centerPos) !== oe(c, e.centerPos) && ie(this.vNodes, t);
540
575
  }
541
- const r = this.setFullWork(e), i = e.ops && V(e.ops);
576
+ const r = this.setFullWork(e), i = e.ops && H(e.ops);
542
577
  if (r) {
543
- if (t && e.clearPreviewLocalWork && this.thread.localLayer.getElementsByName(t).forEach((d) => {
544
- d.remove(), z(d, this.thread.localLayer.parent);
578
+ t && e.clearPreviewLocalWork && this.thread.localLayer.getElementsByName(t).forEach((c) => {
579
+ c.remove(), _(c, this.thread.localLayer.parent);
545
580
  }), r.toolsType === m.BackgroundSVG ? r.consumeService({
546
581
  isFullWork: !0,
547
582
  replaceId: t
@@ -557,18 +592,9 @@ class xe {
557
592
  op: i,
558
593
  isFullWork: !0,
559
594
  replaceId: t
560
- }), t && ((n = e.opt) != null && n.matrix) && e.opt.matrix.some(
561
- (d, l) => d !== [1, 0, 0, 1, 0, 0][l]
562
- )) {
563
- const d = this.vNodes.getNodeRectFormShape(
564
- t,
565
- this.vNodes.get(t)
566
- );
567
- d && this.vNodes.setInfo(t, { rect: d });
568
- }
569
- e != null && e.updateNodeOpt && r.updataOptService(e.updateNodeOpt);
570
- const c = [];
571
- e.workId && this.workShapes.delete(e.workId.toString()), e.willSyncService && c.push({
595
+ }), e != null && e.updateNodeOpt && r.updataOptService(e.updateNodeOpt);
596
+ const n = [];
597
+ e.workId && this.workShapes.delete(e.workId.toString()), e.willSyncService && n.push({
572
598
  opt: e.opt,
573
599
  toolsType: e.toolsType,
574
600
  type: h.FullWork,
@@ -580,22 +606,22 @@ class xe {
580
606
  requestId: e.requestId,
581
607
  emitEventType: e.emitEventType,
582
608
  scenePath: e.scenePath
583
- }), e.isLockSentEventCursor && c.push({
609
+ }), e.isLockSentEventCursor && n.push({
584
610
  type: h.None,
585
611
  isLockSentEventCursor: !0,
586
612
  scenePath: e.scenePath
587
- }), e.needUndoTicker && c.push({
613
+ }), e.needUndoTicker && n.push({
588
614
  type: h.None,
589
615
  needUndoTicker: e.needUndoTicker,
590
616
  emitEventType: e.emitEventType,
591
617
  requestId: e.requestId,
592
618
  scenePath: e.scenePath
593
- }), c.length && this.thread.post({ sp: c });
619
+ }), n.length && this.thread.post({ sp: n });
594
620
  }
595
621
  }
596
622
  async colloctEffectSelectWork(e) {
597
623
  const t = this.workShapes.get(
598
- D
624
+ P
599
625
  ), { workId: s, msgType: r } = e;
600
626
  if (t && s && t.selectIds && t.selectIds.includes(s.toString())) {
601
627
  r === h.RemoveNode ? t.selectIds = t.selectIds.filter(
@@ -629,7 +655,7 @@ class xe {
629
655
  boxRect: this.thread.getSceneRect()
630
656
  });
631
657
  else {
632
- const o = s.ops && V(s.ops);
658
+ const o = s.ops && H(s.ops);
633
659
  r.consumeService({
634
660
  op: o,
635
661
  isFullWork: !0,
@@ -643,15 +669,15 @@ class xe {
643
669
  this.reRenderSelector(e);
644
670
  }
645
671
  hasSelector() {
646
- return this.workShapes.has(D);
672
+ return this.workShapes.has(P);
647
673
  }
648
674
  getSelector() {
649
- return this.workShapes.get(D);
675
+ return this.workShapes.get(P);
650
676
  }
651
677
  reRenderSelector(e = !1) {
652
678
  var r;
653
679
  const t = this.workShapes.get(
654
- D
680
+ P
655
681
  );
656
682
  if (!t) return;
657
683
  if (t && !((r = t.selectIds) != null && r.length))
@@ -688,10 +714,10 @@ class xe {
688
714
  async blurSelector(e) {
689
715
  var r;
690
716
  const t = this.workShapes.get(
691
- D
717
+ P
692
718
  ), s = t == null ? void 0 : t.blurSelector();
693
- if (this.clearWorkShapeNodeCache(D), ((r = this.thread.fullLayer) == null ? void 0 : r.parent).children.forEach((i) => {
694
- i.name === D && i.remove();
719
+ if (this.clearWorkShapeNodeCache(P), ((r = this.thread.fullLayer) == null ? void 0 : r.parent).children.forEach((i) => {
720
+ i.name === P && i.remove();
695
721
  }), s) {
696
722
  const i = [];
697
723
  i.push({
@@ -756,7 +782,7 @@ class xe {
756
782
  for (const [p, f] of i)
757
783
  l.push({
758
784
  type: h.UpdateNode,
759
- dataType: E.Local,
785
+ dataType: R.Local,
760
786
  opt: f.opt,
761
787
  workId: p,
762
788
  updateNodeOpt: {
@@ -804,9 +830,9 @@ class xe {
804
830
  for (const [d, l] of i)
805
831
  c.push({
806
832
  type: h.FullWork,
807
- dataType: E.Local,
833
+ dataType: R.Local,
808
834
  toolsType: l.toolsType,
809
- ops: j(l.op),
835
+ ops: ee(l.op),
810
836
  opt: l.opt,
811
837
  workId: d,
812
838
  updateNodeOpt: {
@@ -862,7 +888,7 @@ class xe {
862
888
  scenePath: i,
863
889
  viewId: this.thread.viewId,
864
890
  msgType: h.DrawWork,
865
- dataType: E.Local
891
+ dataType: R.Local
866
892
  },
867
893
  t
868
894
  );
@@ -873,10 +899,10 @@ class xe {
873
899
  scenePath: i,
874
900
  viewId: this.thread.viewId,
875
901
  msgType: h.DrawWork,
876
- dataType: E.Local
902
+ dataType: R.Local
877
903
  },
878
904
  t
879
- ), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && n !== D && (this.drawWorkActiveId = n), G(o) && (this.consumeCount = o), d) {
905
+ ), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && n !== P && (this.drawWorkActiveId = n), z(o) && (this.consumeCount = o), d) {
880
906
  case m.Selector: {
881
907
  const l = c.consume({
882
908
  data: e,
@@ -907,7 +933,7 @@ class xe {
907
933
  e.needUndoTicker,
908
934
  e.collectUndoTicker
909
935
  );
910
- }, Te(this.thread.master.maxCombineEraserTime));
936
+ }, Re(this.thread.master.maxCombineEraserTime));
911
937
  break;
912
938
  }
913
939
  case m.BitMapEraser: {
@@ -992,18 +1018,18 @@ class xe {
992
1018
  ...r
993
1019
  };
994
1020
  if (i != null && i.rect) {
995
- const I = We(i.rect);
1021
+ const I = Ee(i.rect);
996
1022
  (a = k.render) == null || a.push(
997
1023
  {
998
1024
  rect: I,
999
1025
  isClear: !0,
1000
- clearCanvas: re.Bg,
1026
+ clearCanvas: ae.Bg,
1001
1027
  viewId: this.thread.viewId,
1002
1028
  eraseTxnId: e
1003
1029
  },
1004
1030
  {
1005
1031
  rect: I,
1006
- drawCanvas: re.Bg,
1032
+ drawCanvas: ae.Bg,
1007
1033
  viewId: this.thread.viewId,
1008
1034
  eraseTxnId: e
1009
1035
  }
@@ -1021,13 +1047,13 @@ class xe {
1021
1047
  needUndoTicker: t,
1022
1048
  collectUndoTicker: s
1023
1049
  })), f != null && f.size)
1024
- for (const [I, R] of f)
1050
+ for (const [I, E] of f)
1025
1051
  (l = k.sp) == null || l.push({
1026
1052
  type: h.FullWork,
1027
- dataType: E.Local,
1028
- toolsType: R.toolsType,
1029
- ops: j(R.op),
1030
- opt: R.opt,
1053
+ dataType: R.Local,
1054
+ toolsType: E.toolsType,
1055
+ ops: ee(E.op),
1056
+ opt: E.opt,
1031
1057
  workId: I,
1032
1058
  updateNodeOpt: {
1033
1059
  useAnimation: !1
@@ -1053,7 +1079,7 @@ class xe {
1053
1079
  if (p === m.LaserPen)
1054
1080
  return;
1055
1081
  p === m.BitMapEraser && await this.bitmapEraserRenderQueue;
1056
- const f = this.workShapes.get(H), w = (a = f == null ? void 0 : f.selectIds) == null ? void 0 : a[0], k = await l.consumeAll({ data: e, workerEngine: this });
1082
+ const f = this.workShapes.get(j), w = (a = f == null ? void 0 : f.selectIds) == null ? void 0 : a[0], k = await l.consumeAll({ data: e, workerEngine: this });
1057
1083
  switch (p) {
1058
1084
  case m.Selector:
1059
1085
  {
@@ -1105,7 +1131,7 @@ class xe {
1105
1131
  scenePath: r
1106
1132
  }), k) {
1107
1133
  const g = p === m.Pencil && k.type === h.RemoveNode;
1108
- g ? $(
1134
+ g ? K(
1109
1135
  this.thread.localLayer,
1110
1136
  this.thread.localLayer.parent
1111
1137
  ) : I.push({
@@ -1141,7 +1167,7 @@ class xe {
1141
1167
  if ((t = this.tmpOpt) != null && t.toolsType && this.tmpOpt.toolsType !== e.toolsType) {
1142
1168
  this.eraserBatchScheduler.cancel();
1143
1169
  for (const [r, i] of this.workShapes)
1144
- r !== D && (i.clearTmpPoints(), this.workShapes.delete(r));
1170
+ r !== P && (i.clearTmpPoints(), this.workShapes.delete(r));
1145
1171
  }
1146
1172
  this.tmpOpt = e, (s = e.toolsOpt) != null && s.syncUnitTime && (this.syncUnitTime = e.toolsOpt.syncUnitTime);
1147
1173
  }
@@ -1154,7 +1180,7 @@ class xe {
1154
1180
  t.syncUnitTime || (t.syncUnitTime = this.syncUnitTime), s == null || s.setWorkOptions(t);
1155
1181
  }
1156
1182
  createWorkShapeNode(e) {
1157
- return Z(
1183
+ return J(
1158
1184
  {
1159
1185
  ...e,
1160
1186
  vNodes: this.vNodes,
@@ -1165,22 +1191,24 @@ class xe {
1165
1191
  );
1166
1192
  }
1167
1193
  }
1168
- class Ue {
1194
+ class qe {
1169
1195
  constructor(e) {
1170
1196
  u(this, "vNodes");
1171
1197
  u(this, "thread");
1172
1198
  u(this, "workShapes", /* @__PURE__ */ new Map());
1173
1199
  u(this, "selectorWorkShapes", /* @__PURE__ */ new Map());
1174
1200
  u(this, "willRunEffectSelectorIds", /* @__PURE__ */ new Set());
1175
- u(this, "syncUnitTime", K.syncOpt.interval);
1201
+ u(this, "syncUnitTime", Y.syncOpt.interval);
1176
1202
  u(this, "animationScheduler");
1177
1203
  u(this, "effectScheduler");
1178
- this.vNodes = e.vNodes, this.thread = e.thread, this.animationScheduler = new ie({
1204
+ u(this, "imageRecovery", new Ue());
1205
+ u(this, "readyImages", /* @__PURE__ */ new Map());
1206
+ this.vNodes = e.vNodes, this.thread = e.thread, this.animationScheduler = new ne({
1179
1207
  run: async () => {
1180
1208
  try {
1181
1209
  await this.animationDraw();
1182
1210
  } catch (t) {
1183
- throw Y(t, {
1211
+ throw Z(t, {
1184
1212
  business: "service-render",
1185
1213
  stage: "animation-draw"
1186
1214
  });
@@ -1192,12 +1220,12 @@ class Ue {
1192
1220
  business: "service-render",
1193
1221
  stage: "animation-draw"
1194
1222
  })
1195
- }), this.effectScheduler = new ie({
1223
+ }), this.effectScheduler = new ne({
1196
1224
  run: async () => {
1197
1225
  try {
1198
1226
  await this.effectRunSelector();
1199
1227
  } catch (t) {
1200
- throw Y(t, {
1228
+ throw Z(t, {
1201
1229
  business: "service-render",
1202
1230
  stage: "selector-effect"
1203
1231
  });
@@ -1218,9 +1246,9 @@ class Ue {
1218
1246
  this.animationScheduler.destroy(), this.effectScheduler.destroy(), this.clearAll();
1219
1247
  }
1220
1248
  clearAll() {
1221
- this.thread.serviceLayer.children.length && (this.thread.serviceLayer.parent.children.forEach((e) => {
1249
+ this.imageRecovery.clear(), this.readyImages.clear(), this.thread.serviceLayer.children.length && (this.thread.serviceLayer.parent.children.forEach((e) => {
1222
1250
  e.name !== "viewport" && e.remove();
1223
- }), $(
1251
+ }), K(
1224
1252
  this.thread.serviceLayer,
1225
1253
  this.thread.serviceLayer.parent
1226
1254
  )), this.workShapes.clear(), this.selectorWorkShapes.clear(), this.willRunEffectSelectorIds.clear();
@@ -1247,7 +1275,7 @@ class Ue {
1247
1275
  removeWork(e) {
1248
1276
  const { workId: t } = e, s = t == null ? void 0 : t.toString();
1249
1277
  if (s) {
1250
- if (this.workShapes.get(s)) {
1278
+ if (this.imageRecovery.cancel(s), this.readyImages.delete(s), this.workShapes.get(s)) {
1251
1279
  this.workShapes.delete(s), this.removeNode(s, e);
1252
1280
  return;
1253
1281
  }
@@ -1285,7 +1313,7 @@ class Ue {
1285
1313
  );
1286
1314
  }
1287
1315
  async animationDraw() {
1288
- var r, i, o, a, n, c, d, l, p, f, w, k, I, R, g, y, S, T, L, N, A;
1316
+ var r, i, o, a, n, c, d, l, p, f, w, k, I, E, g, y, S, T, C, L, O, A;
1289
1317
  let e = !1;
1290
1318
  const t = /* @__PURE__ */ new Map(), s = [];
1291
1319
  for (const [W, v] of this.workShapes.entries())
@@ -1294,36 +1322,66 @@ class Ue {
1294
1322
  (r = v.node) == null || r.consumeService({
1295
1323
  isFullWork: !0,
1296
1324
  replaceId: W
1297
- }), this.syncMatrixRect(W, v.node), this.selectorWorkShapes.forEach((B, O) => {
1298
- var P;
1299
- (P = B.selectIds) != null && P.includes(W) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1325
+ }), this.selectorWorkShapes.forEach((B, F) => {
1326
+ var M;
1327
+ (M = B.selectIds) != null && M.includes(W) && (this.willRunEffectSelectorIds.add(F), this.runEffect());
1300
1328
  }), this.workShapes.delete(W);
1301
1329
  break;
1302
1330
  }
1303
1331
  case m.Image: {
1304
- await ((i = v.node) == null ? void 0 : i.consumeServiceAsync({
1332
+ const B = (i = v.node) == null ? void 0 : i.getWorkOptions(), M = (B == null ? void 0 : B.src) && this.thread.getImageSourceKey(B), U = this.readyImages.get(W);
1333
+ this.readyImages.delete(W);
1334
+ const x = U && U.src === M && U.image || M && this.thread.getCachedImages(M) || null;
1335
+ await ((o = v.node) == null ? void 0 : o.consumeServiceAsync({
1305
1336
  isFullWork: !0,
1306
- worker: this
1307
- })), this.syncMatrixRect(W, v.node), this.selectorWorkShapes.forEach((B, O) => {
1308
- var P;
1309
- (P = B.selectIds) != null && P.includes(W) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1337
+ worker: this,
1338
+ imageSourceOverride: x
1339
+ })), M && !x ? this.imageRecovery.request(
1340
+ W,
1341
+ M,
1342
+ () => this.thread.loadImageBitMap({
1343
+ toolsType: m.Image,
1344
+ opt: B,
1345
+ workId: W,
1346
+ timeoutMs: 15e3
1347
+ }),
1348
+ () => {
1349
+ const G = this.vNodes.get(W), V = this.workShapes.get(W);
1350
+ return (G == null ? void 0 : G.toolsType) === m.Image && this.thread.getImageSourceKey(G.opt) === M && (!V || !!V.node && this.thread.getImageSourceKey(
1351
+ V.node.getWorkOptions()
1352
+ ) === M);
1353
+ },
1354
+ (G) => {
1355
+ const V = this.vNodes.get(W);
1356
+ V && (this.readyImages.set(W, { src: M, image: G }), this.consumeFull({
1357
+ msgType: h.FullWork,
1358
+ dataType: R.Service,
1359
+ viewId: this.thread.viewId,
1360
+ workId: W,
1361
+ toolsType: m.Image,
1362
+ opt: V.opt
1363
+ }));
1364
+ }
1365
+ ) : this.imageRecovery.cancel(W), this.selectorWorkShapes.forEach((G, V) => {
1366
+ var re;
1367
+ (re = G.selectIds) != null && re.includes(W) && (this.willRunEffectSelectorIds.add(V), this.runEffect());
1310
1368
  }), this.workShapes.delete(W);
1311
1369
  break;
1312
1370
  }
1313
1371
  case m.Text: {
1314
- v.node && (await ((o = v.node) == null ? void 0 : o.consumeServiceAsync({
1372
+ v.node && (await ((a = v.node) == null ? void 0 : a.consumeServiceAsync({
1315
1373
  isFullWork: !0,
1316
1374
  replaceId: W,
1317
1375
  boxRect: this.thread.getSceneRect()
1318
- })), this.syncMatrixRect(W, v.node), this.selectorWorkShapes.forEach((B, O) => {
1319
- var P;
1320
- (P = B.selectIds) != null && P.includes(W) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1376
+ })), this.selectorWorkShapes.forEach((B, F) => {
1377
+ var M;
1378
+ (M = B.selectIds) != null && M.includes(W) && (this.willRunEffectSelectorIds.add(F), this.runEffect());
1321
1379
  }), v.refreshTextRender && v.requestId && s.push({
1322
1380
  type: h.RefreshTextRender,
1323
1381
  requestId: v.requestId,
1324
1382
  workId: W,
1325
1383
  viewId: this.thread.viewId
1326
- }), (a = v.node) == null || a.clearTmpPoints(), this.workShapes.delete(W));
1384
+ }), (n = v.node) == null || n.clearTmpPoints(), this.workShapes.delete(W));
1327
1385
  break;
1328
1386
  }
1329
1387
  case m.Arrow:
@@ -1334,23 +1392,23 @@ class Ue {
1334
1392
  case m.Polygon:
1335
1393
  case m.SpeechBalloon: {
1336
1394
  const B = !!v.ops;
1337
- if ((n = v.animationWorkData) != null && n.length) {
1338
- const O = v.oldRect;
1339
- (c = v.node) == null || c.consumeService({
1395
+ if ((c = v.animationWorkData) != null && c.length) {
1396
+ const F = v.oldRect;
1397
+ (d = v.node) == null || d.consumeService({
1340
1398
  op: v.animationWorkData,
1341
1399
  isFullWork: B
1342
- }), B && this.syncMatrixRect(W, v.node), B && (this.selectorWorkShapes.forEach((P, F) => {
1400
+ }), B && (this.selectorWorkShapes.forEach((M, U) => {
1343
1401
  var x;
1344
- (x = P.selectIds) != null && x.includes(W) && (this.willRunEffectSelectorIds.add(F), this.runEffect());
1345
- }), (d = v.node) == null || d.clearTmpPoints(), this.workShapes.delete(W)), v.isEnableCursor ? t.set(W, {
1346
- cursorTool: _(v.toolsType),
1347
- workState: O ? v.ops ? b.Done : b.Doing : b.Start,
1402
+ (x = M.selectIds) != null && x.includes(W) && (this.willRunEffectSelectorIds.add(U), this.runEffect());
1403
+ }), (l = v.node) == null || l.clearTmpPoints(), this.workShapes.delete(W)), v.isEnableCursor ? t.set(W, {
1404
+ cursorTool: Q(v.toolsType),
1405
+ workState: F ? v.ops ? b.Done : b.Doing : b.Start,
1348
1406
  op: v.animationWorkData.slice(-3, -1)
1349
- }) : B && !v.useAnimation && ((l = v.updateNodeOpt) != null && l.useAnimation) && t.set(W, {
1350
- cursorTool: _(v.toolsType),
1407
+ }) : B && !v.useAnimation && ((p = v.updateNodeOpt) != null && p.useAnimation) && t.set(W, {
1408
+ cursorTool: Q(v.toolsType),
1351
1409
  workState: b.Done,
1352
1410
  op: v.animationWorkData.slice(-3, -1),
1353
- uid: (p = v.updateNodeOpt) == null ? void 0 : p.uid
1411
+ uid: (f = v.updateNodeOpt) == null ? void 0 : f.uid
1354
1412
  }), v.animationWorkData.length = 0;
1355
1413
  }
1356
1414
  break;
@@ -1359,60 +1417,60 @@ class Ue {
1359
1417
  if (v.useAnimation) {
1360
1418
  if (v.useAnimation) {
1361
1419
  if (v.isDel) {
1362
- (y = v.node) == null || y.clearTmpPoints(), this.workShapes.delete(W);
1420
+ (S = v.node) == null || S.clearTmpPoints(), this.workShapes.delete(W);
1363
1421
  break;
1364
1422
  }
1365
- const B = 3, O = this.computNextAnimationIndex(
1423
+ const B = 3, F = this.computNextAnimationIndex(
1366
1424
  v,
1367
1425
  B
1368
- ), P = v.isDiff ? 0 : Math.max(0, (v.animationIndex || 0) - B), F = (v.animationWorkData || []).slice(
1369
- P,
1370
- O
1371
- ), x = (T = (S = v.node) == null ? void 0 : S.getWorkId()) == null ? void 0 : T.toString();
1372
- if ((v.animationIndex || 0) < O || v.isDiff) {
1426
+ ), M = v.isDiff ? 0 : Math.max(0, (v.animationIndex || 0) - B), U = (v.animationWorkData || []).slice(
1427
+ M,
1428
+ F
1429
+ ), x = (C = (T = v.node) == null ? void 0 : T.getWorkId()) == null ? void 0 : C.toString();
1430
+ if ((v.animationIndex || 0) < F || v.isDiff) {
1373
1431
  if ((L = v.node) == null || L.consumeService({
1374
- op: F,
1432
+ op: U,
1375
1433
  isFullWork: !1
1376
- }), v.animationIndex = O, v.isDiff && (v.isDiff = !1), F.length && v.isEnableCursor) {
1377
- const X = F.slice(-3, -1);
1434
+ }), v.animationIndex = F, v.isDiff && (v.isDiff = !1), U.length && v.isEnableCursor) {
1435
+ const G = U.slice(-3, -1);
1378
1436
  t.set(W, {
1379
- cursorTool: _(v.toolsType),
1380
- workState: P === 0 ? b.Start : O === ((N = v.animationWorkData) == null ? void 0 : N.length) ? b.Done : b.Doing,
1381
- op: X
1437
+ cursorTool: Q(v.toolsType),
1438
+ workState: M === 0 ? b.Start : F === ((O = v.animationWorkData) == null ? void 0 : O.length) ? b.Done : b.Doing,
1439
+ op: G
1382
1440
  });
1383
1441
  }
1384
1442
  } else v.ops && ((A = v.node) == null || A.consumeService({
1385
1443
  op: v.animationWorkData || [],
1386
1444
  isFullWork: !0,
1387
1445
  replaceId: x
1388
- }), this.syncMatrixRect(x || W, v.node), v.isDel = !0, v.isEnableCursor && t.set(W, {
1389
- cursorTool: _(v.toolsType),
1446
+ }), v.isDel = !0, v.isEnableCursor && t.set(W, {
1447
+ cursorTool: Q(v.toolsType),
1390
1448
  workState: b.Done,
1391
- op: F.slice(-3, -1)
1449
+ op: U.slice(-3, -1)
1392
1450
  }));
1393
1451
  e = !0;
1394
1452
  break;
1395
1453
  }
1396
1454
  } else {
1397
1455
  const B = !!v.ops;
1398
- if ((f = v.node) == null || f.consumeService({
1456
+ if ((w = v.node) == null || w.consumeService({
1399
1457
  op: v.animationWorkData || [],
1400
1458
  isFullWork: B,
1401
1459
  replaceId: W
1402
- }), (w = v.node) == null || w.updataOptService(v.updateNodeOpt), B) {
1403
- if (this.syncMatrixRect(W, v.node), !v.isEnableCursor && ((k = v.updateNodeOpt) != null && k.useAnimation) && ((I = v.animationWorkData) != null && I.length)) {
1404
- const O = v.animationWorkData.slice(-3, -1);
1460
+ }), (k = v.node) == null || k.updataOptService(v.updateNodeOpt), B) {
1461
+ if (!v.isEnableCursor && ((I = v.updateNodeOpt) != null && I.useAnimation) && ((E = v.animationWorkData) != null && E.length)) {
1462
+ const F = v.animationWorkData.slice(-3, -1);
1405
1463
  t.set(W, {
1406
- cursorTool: _(v.toolsType),
1464
+ cursorTool: Q(v.toolsType),
1407
1465
  workState: b.Done,
1408
- op: O,
1409
- uid: (R = v.updateNodeOpt) == null ? void 0 : R.uid
1466
+ op: F,
1467
+ uid: (g = v.updateNodeOpt) == null ? void 0 : g.uid
1410
1468
  });
1411
1469
  }
1412
- this.selectorWorkShapes.forEach((O, P) => {
1413
- var F;
1414
- (F = O.selectIds) != null && F.includes(W) && (this.willRunEffectSelectorIds.add(P), this.runEffect());
1415
- }), (g = v.node) == null || g.clearTmpPoints(), this.workShapes.delete(W);
1470
+ this.selectorWorkShapes.forEach((F, M) => {
1471
+ var U;
1472
+ (U = F.selectIds) != null && U.includes(W) && (this.willRunEffectSelectorIds.add(M), this.runEffect());
1473
+ }), (y = v.node) == null || y.clearTmpPoints(), this.workShapes.delete(W);
1416
1474
  }
1417
1475
  }
1418
1476
  break;
@@ -1421,7 +1479,7 @@ class Ue {
1421
1479
  e && this.runAnimation(), t.size && t.forEach((W, v) => {
1422
1480
  s.push({
1423
1481
  type: h.Cursor,
1424
- uid: W.uid || v.split(de)[0],
1482
+ uid: W.uid || v.split(fe)[0],
1425
1483
  op: W.op,
1426
1484
  workState: W.workState,
1427
1485
  cursorTool: W.cursorTool,
@@ -1455,20 +1513,8 @@ class Ue {
1455
1513
  }
1456
1514
  return !1;
1457
1515
  }
1458
- syncMatrixRect(e, t) {
1459
- const s = t == null ? void 0 : t.getWorkOptions().matrix;
1460
- if (!s || pe(s).every(
1461
- (i, o) => i === [1, 0, 0, 1, 0, 0][o]
1462
- ))
1463
- return;
1464
- const r = this.vNodes.getNodeRectFormShape(
1465
- e,
1466
- this.vNodes.get(e)
1467
- );
1468
- r && this.vNodes.setInfo(e, { rect: r });
1469
- }
1470
1516
  activeWorkShape(e) {
1471
- var R, g, y, S;
1517
+ var E, g, y, S;
1472
1518
  const {
1473
1519
  workId: t,
1474
1520
  opt: s,
@@ -1485,7 +1531,7 @@ class Ue {
1485
1531
  } = e;
1486
1532
  if (!t)
1487
1533
  return;
1488
- const w = t.toString(), k = (R = this.vNodes.get(w)) == null ? void 0 : R.rect;
1534
+ const w = t.toString(), k = (E = this.vNodes.get(w)) == null ? void 0 : E.rect;
1489
1535
  if (!((g = this.workShapes) != null && g.has(w))) {
1490
1536
  let T = {
1491
1537
  toolsType: r,
@@ -1503,17 +1549,17 @@ class Ue {
1503
1549
  r && s && (T = this.setNodeKey(w, T, r, s)), (y = this.workShapes) == null || y.set(w, T);
1504
1550
  }
1505
1551
  const I = (S = this.workShapes) == null ? void 0 : S.get(w);
1506
- I.isEnableCursor = l, I.requestId = p, I.refreshTextRender = !!f, i && (I.type = i), a && (I.animationWorkData = V(a), I.ops = a), o && (I.updateNodeOpt = o), n && (I.isDiff = this.hasDiffData(
1552
+ I.isEnableCursor = l, I.requestId = p, I.refreshTextRender = !!f, i && (I.type = i), a && (I.animationWorkData = H(a), I.ops = a), o && (I.updateNodeOpt = o), n && (I.isDiff = this.hasDiffData(
1507
1553
  I.animationWorkData || [],
1508
1554
  n,
1509
1555
  I.toolsType
1510
1556
  ), I.toolsType, m.Pencil, I.animationWorkData = n), I.node && I.node.getWorkId() !== w && I.node.setWorkId(w), k && (I.oldRect = k), r && s && (s.syncUnitTime && (this.syncUnitTime = s.syncUnitTime), I.toolsType !== r && r && s && this.setNodeKey(w, I, r, s), I.node && I.node.setWorkOptions(s)), d && (I.imageBitmap = d);
1511
1557
  }
1512
1558
  removeNode(e, t) {
1513
- e.indexOf(D) > -1 && this.removeSelectWork(t), this.thread.fullLayer.getElementsByName(e).forEach((r) => {
1514
- r.remove(), z(r, this.thread.fullLayer.parent);
1559
+ e.indexOf(P) > -1 && this.removeSelectWork(t), this.thread.fullLayer.getElementsByName(e).forEach((r) => {
1560
+ r.remove(), _(r, this.thread.fullLayer.parent);
1515
1561
  }), this.thread.serviceLayer.getElementsByName(e).forEach((r) => {
1516
- r.remove(), z(r, this.thread.serviceLayer.parent);
1562
+ r.remove(), _(r, this.thread.serviceLayer.parent);
1517
1563
  });
1518
1564
  const s = this.vNodes.get(e);
1519
1565
  s && s.toolsType === m.BackgroundSVG && this.thread.post({
@@ -1522,7 +1568,7 @@ class Ue {
1522
1568
  type: h.BackgroundSVGDelete,
1523
1569
  toolsType: m.BackgroundSVG,
1524
1570
  workId: e,
1525
- dataType: E.Service,
1571
+ dataType: R.Service,
1526
1572
  viewId: this.thread.viewId
1527
1573
  }
1528
1574
  ]
@@ -1551,7 +1597,7 @@ class Ue {
1551
1597
  i && (n.type = i), n.node && n.node.getWorkId() !== a && n.node.setWorkId(a), n.selectIds = o || [];
1552
1598
  }
1553
1599
  setNodeKey(e, t, s, r) {
1554
- return t.toolsType = s, t.node = Z(
1600
+ return t.toolsType = s, t.node = J(
1555
1601
  {
1556
1602
  toolsType: s,
1557
1603
  toolsOpt: r,
@@ -1564,7 +1610,7 @@ class Ue {
1564
1610
  ), t;
1565
1611
  }
1566
1612
  }
1567
- class U {
1613
+ class q {
1568
1614
  constructor() {
1569
1615
  u(this, "localWork");
1570
1616
  u(this, "serviceWork");
@@ -1574,14 +1620,14 @@ class U {
1574
1620
  return this.threadEngine = e, this.localWork = e.localWork, this.serviceWork = e.serviceWork, this;
1575
1621
  }
1576
1622
  }
1577
- class Ge extends U {
1623
+ class ze extends q {
1578
1624
  constructor() {
1579
1625
  super(...arguments);
1580
- u(this, "emitEventType", C.CopyNode);
1626
+ u(this, "emitEventType", N.CopyNode);
1581
1627
  }
1582
1628
  async consume(t) {
1583
1629
  const { msgType: s, dataType: r, emitEventType: i } = t;
1584
- if (s === h.FullWork && r === E.Local && i === this.emitEventType)
1630
+ if (s === h.FullWork && r === R.Local && i === this.emitEventType)
1585
1631
  return await this.consumeForLocalWorker(t), !0;
1586
1632
  }
1587
1633
  async consumeForLocalWorker(t) {
@@ -1590,14 +1636,14 @@ class Ge extends U {
1590
1636
  s && await ((r = this.localWork) == null ? void 0 : r.consumeFull(t));
1591
1637
  }
1592
1638
  }
1593
- class qe extends U {
1639
+ class Ve extends q {
1594
1640
  constructor() {
1595
1641
  super(...arguments);
1596
- u(this, "emitEventType", C.SetColorNode);
1642
+ u(this, "emitEventType", N.SetColorNode);
1597
1643
  }
1598
1644
  async consume(t) {
1599
1645
  const { msgType: s, dataType: r, emitEventType: i } = t;
1600
- if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
1646
+ if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
1601
1647
  return await this.consumeForLocalWorker(t), !0;
1602
1648
  }
1603
1649
  async consumeForLocalWorker(t) {
@@ -1612,7 +1658,7 @@ class qe extends U {
1612
1658
  needUndoTicker: c,
1613
1659
  requestId: d
1614
1660
  } = t;
1615
- s === D && r && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
1661
+ s === P && r && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
1616
1662
  updateSelectorOpt: r,
1617
1663
  willRefreshSelector: i,
1618
1664
  willSyncService: o,
@@ -1639,7 +1685,7 @@ class qe extends U {
1639
1685
  ...w,
1640
1686
  workId: f,
1641
1687
  type: h.TextUpdate,
1642
- dataType: E.Local,
1688
+ dataType: R.Local,
1643
1689
  willSyncService: !0,
1644
1690
  emitEventType: l,
1645
1691
  requestId: d,
@@ -1664,14 +1710,14 @@ class qe extends U {
1664
1710
  };
1665
1711
  }
1666
1712
  }
1667
- class ze extends U {
1713
+ class $e extends q {
1668
1714
  constructor() {
1669
1715
  super(...arguments);
1670
- u(this, "emitEventType", C.ZIndexNode);
1716
+ u(this, "emitEventType", N.ZIndexNode);
1671
1717
  }
1672
1718
  async consume(t) {
1673
1719
  const { msgType: s, dataType: r, emitEventType: i } = t;
1674
- if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
1720
+ if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
1675
1721
  return await this.consumeForLocalWorker(t), !0;
1676
1722
  }
1677
1723
  async consumeForLocalWorker(t) {
@@ -1685,7 +1731,7 @@ class ze extends U {
1685
1731
  needUndoTicker: n,
1686
1732
  requestId: c
1687
1733
  } = t;
1688
- s === D && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
1734
+ s === P && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
1689
1735
  updateSelectorOpt: r,
1690
1736
  willRefreshSelector: i,
1691
1737
  willSyncService: o,
@@ -1710,7 +1756,7 @@ class ze extends U {
1710
1756
  ...f,
1711
1757
  workId: p,
1712
1758
  type: h.BackgroundSVGUpdate,
1713
- dataType: E.Local,
1759
+ dataType: R.Local,
1714
1760
  updateNodeOpt: {
1715
1761
  useAnimation: !1
1716
1762
  },
@@ -1737,12 +1783,12 @@ class ze extends U {
1737
1783
  };
1738
1784
  }
1739
1785
  }
1740
- class Ve extends U {
1786
+ class _e extends q {
1741
1787
  constructor() {
1742
1788
  super(...arguments);
1743
- u(this, "emitEventType", C.TranslateNode);
1789
+ u(this, "emitEventType", N.TranslateNode);
1744
1790
  u(this, "updateSelectorCallback", (t) => {
1745
- var R;
1791
+ var E;
1746
1792
  const { param: s, postData: r, newServiceStore: i, workShapeNode: o, res: a, smoothSync: n } = t, {
1747
1793
  willSyncService: c,
1748
1794
  isSync: d,
@@ -1785,7 +1831,7 @@ class Ve extends U {
1785
1831
  ...T,
1786
1832
  workId: S,
1787
1833
  type: h.BackgroundSVGUpdate,
1788
- dataType: E.Local,
1834
+ dataType: R.Local,
1789
1835
  willSyncService: w === b.Done ? !0 : n,
1790
1836
  updateNodeOpt: y,
1791
1837
  needUndoTicker: g,
@@ -1794,7 +1840,7 @@ class Ve extends U {
1794
1840
  ...T,
1795
1841
  workId: S,
1796
1842
  type: h.TextUpdate,
1797
- dataType: E.Local,
1843
+ dataType: R.Local,
1798
1844
  willSyncService: w === b.Done ? !0 : n,
1799
1845
  updateNodeOpt: y,
1800
1846
  needUndoTicker: g,
@@ -1805,8 +1851,8 @@ class Ve extends U {
1805
1851
  type: h.UpdateNode,
1806
1852
  updateNodeOpt: {
1807
1853
  ...y,
1808
- eraserGeometryDelta: ee(
1809
- (R = this.localWork) == null ? void 0 : R.vNodes,
1854
+ eraserGeometryDelta: se(
1855
+ (E = this.localWork) == null ? void 0 : E.vNodes,
1810
1856
  S
1811
1857
  )
1812
1858
  },
@@ -1829,7 +1875,7 @@ class Ve extends U {
1829
1875
  }
1830
1876
  async consume(t) {
1831
1877
  const { msgType: s, dataType: r, emitEventType: i } = t;
1832
- if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
1878
+ if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
1833
1879
  return await this.consumeForLocalWorker(t), !0;
1834
1880
  }
1835
1881
  async consumeForLocalWorker(t) {
@@ -1845,7 +1891,7 @@ class Ve extends U {
1845
1891
  smoothSync: d,
1846
1892
  needUndoTicker: l
1847
1893
  } = t;
1848
- s === D && r && (r.workState === b.Done && (r != null && r.translate) && (r.translate[0] || r.translate[1]) || r.workState !== b.Done ? await ((p = this.localWork) == null ? void 0 : p.updateSelector({
1894
+ s === P && r && (r.workState === b.Done && (r != null && r.translate) && (r.translate[0] || r.translate[1]) || r.workState !== b.Done ? await ((p = this.localWork) == null ? void 0 : p.updateSelector({
1849
1895
  updateSelectorOpt: r,
1850
1896
  willRefreshSelector: i,
1851
1897
  willSyncService: o,
@@ -1859,10 +1905,10 @@ class Ve extends U {
1859
1905
  })) : r.workState === b.Done && ((f = this.localWork) == null || f.vNodes.deleteLastTarget()));
1860
1906
  }
1861
1907
  }
1862
- class $e extends U {
1908
+ class He extends q {
1863
1909
  constructor() {
1864
1910
  super(...arguments);
1865
- u(this, "emitEventType", C.ScaleNode);
1911
+ u(this, "emitEventType", N.ScaleNode);
1866
1912
  u(this, "updateSelectorCallback", (t) => {
1867
1913
  var I;
1868
1914
  const { param: s, postData: r, workShapeNode: i, res: o, newServiceStore: a, smoothSync: n } = t, { updateSelectorOpt: c, willSyncService: d, needUndoTicker: l } = s, p = c.workState, f = r.sp || [], w = o == null ? void 0 : o.selectRect, k = p === b.Done ? l : void 0;
@@ -1887,27 +1933,27 @@ class $e extends U {
1887
1933
  points: p === b.Done && i.getChildrenPoints() || void 0,
1888
1934
  textOpt: i.textOpt
1889
1935
  });
1890
- const R = {
1936
+ const E = {
1891
1937
  useAnimation: c.useAnimation || !1
1892
1938
  };
1893
- c.uid && (R.uid = c.uid);
1939
+ c.uid && (E.uid = c.uid);
1894
1940
  for (const [g, y] of a.entries())
1895
1941
  y.toolsType === m.BackgroundSVG && f.push({
1896
1942
  ...y,
1897
1943
  workId: g,
1898
1944
  type: h.BackgroundSVGUpdate,
1899
- dataType: E.Local,
1945
+ dataType: R.Local,
1900
1946
  willSyncService: p === b.Done ? !0 : n,
1901
- updateNodeOpt: R,
1947
+ updateNodeOpt: E,
1902
1948
  needUndoTicker: k,
1903
1949
  emitEventType: this.emitEventType
1904
1950
  }), y.toolsType === m.Text ? f.push({
1905
1951
  ...y,
1906
1952
  workId: g,
1907
1953
  type: h.TextUpdate,
1908
- dataType: E.Local,
1954
+ dataType: R.Local,
1909
1955
  willSyncService: p === b.Done ? !0 : n,
1910
- updateNodeOpt: R,
1956
+ updateNodeOpt: E,
1911
1957
  needUndoTicker: k,
1912
1958
  emitEventType: this.emitEventType
1913
1959
  }) : (n || p === b.Done) && f.push({
@@ -1915,8 +1961,8 @@ class $e extends U {
1915
1961
  workId: g,
1916
1962
  type: h.UpdateNode,
1917
1963
  updateNodeOpt: {
1918
- ...R,
1919
- eraserGeometryDelta: ee(
1964
+ ...E,
1965
+ eraserGeometryDelta: se(
1920
1966
  (I = this.localWork) == null ? void 0 : I.vNodes,
1921
1967
  g
1922
1968
  )
@@ -1940,7 +1986,7 @@ class $e extends U {
1940
1986
  }
1941
1987
  async consume(t) {
1942
1988
  const { msgType: s, dataType: r, emitEventType: i } = t;
1943
- if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
1989
+ if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
1944
1990
  return await this.consumeForLocalWorker(t), !0;
1945
1991
  }
1946
1992
  async consumeForLocalWorker(t) {
@@ -1953,7 +1999,7 @@ class $e extends U {
1953
1999
  smoothSync: a,
1954
2000
  needUndoTicker: n
1955
2001
  } = t;
1956
- s === D && r && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
2002
+ s === P && r && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
1957
2003
  updateSelectorOpt: r,
1958
2004
  willSyncService: i,
1959
2005
  willSerializeData: o,
@@ -1964,10 +2010,10 @@ class $e extends U {
1964
2010
  }));
1965
2011
  }
1966
2012
  }
1967
- class _e extends U {
2013
+ class Ke extends q {
1968
2014
  constructor() {
1969
2015
  super(...arguments);
1970
- u(this, "emitEventType", C.RotateNode);
2016
+ u(this, "emitEventType", N.RotateNode);
1971
2017
  u(this, "updateSelectorCallback", (t) => {
1972
2018
  var g;
1973
2019
  const { param: s, postData: r, workShapeNode: i, res: o, newServiceStore: a, smoothSync: n } = t, {
@@ -1976,7 +2022,7 @@ class _e extends U {
1976
2022
  willSerializeData: l,
1977
2023
  isSync: p,
1978
2024
  needUndoTicker: f
1979
- } = s, w = c.workState, k = r.sp || [], I = o == null ? void 0 : o.selectRect, R = w === b.Done ? f : void 0;
2025
+ } = s, w = c.workState, k = r.sp || [], I = o == null ? void 0 : o.selectRect, E = w === b.Done ? f : void 0;
1980
2026
  if (d) {
1981
2027
  l && w === b.Done && k.push({
1982
2028
  type: h.Select,
@@ -1997,13 +2043,13 @@ class _e extends U {
1997
2043
  type: h.UpdateNode,
1998
2044
  updateNodeOpt: {
1999
2045
  ...y,
2000
- eraserGeometryDelta: ee(
2046
+ eraserGeometryDelta: se(
2001
2047
  (g = this.localWork) == null ? void 0 : g.vNodes,
2002
2048
  S
2003
2049
  )
2004
2050
  },
2005
2051
  isSync: p,
2006
- needUndoTicker: R,
2052
+ needUndoTicker: E,
2007
2053
  emitEventType: this.emitEventType
2008
2054
  });
2009
2055
  }
@@ -2021,7 +2067,7 @@ class _e extends U {
2021
2067
  }
2022
2068
  async consume(t) {
2023
2069
  const { msgType: s, dataType: r, emitEventType: i } = t;
2024
- if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2070
+ if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2025
2071
  return await this.consumeForLocalWorker(t), !0;
2026
2072
  }
2027
2073
  async consumeForLocalWorker(t) {
@@ -2036,7 +2082,7 @@ class _e extends U {
2036
2082
  smoothSync: c,
2037
2083
  needUndoTicker: d
2038
2084
  } = t;
2039
- s === D && r && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
2085
+ s === P && r && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
2040
2086
  updateSelectorOpt: r,
2041
2087
  willRefreshSelector: i,
2042
2088
  willSyncService: o,
@@ -2049,14 +2095,14 @@ class _e extends U {
2049
2095
  }));
2050
2096
  }
2051
2097
  }
2052
- class He extends U {
2098
+ class Qe extends q {
2053
2099
  constructor() {
2054
2100
  super(...arguments);
2055
- u(this, "emitEventType", C.SetFontStyle);
2101
+ u(this, "emitEventType", N.SetFontStyle);
2056
2102
  }
2057
2103
  async consume(t) {
2058
2104
  const { msgType: s, dataType: r, emitEventType: i } = t;
2059
- if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2105
+ if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2060
2106
  return await this.consumeForLocalWorker(t), !0;
2061
2107
  }
2062
2108
  async consumeForLocalWorker(t) {
@@ -2070,7 +2116,7 @@ class He extends U {
2070
2116
  textUpdateForWoker: n,
2071
2117
  requestId: c
2072
2118
  } = t;
2073
- s === D && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2119
+ s === P && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2074
2120
  updateSelectorOpt: r,
2075
2121
  willRefreshSelector: i,
2076
2122
  willSyncService: o,
@@ -2099,17 +2145,17 @@ class He extends U {
2099
2145
  isSync: c,
2100
2146
  points: o.getChildrenPoints()
2101
2147
  });
2102
- for (const [I, R] of i.entries())
2103
- l && R.toolsType === m.Text ? w.push({
2104
- ...R,
2148
+ for (const [I, E] of i.entries())
2149
+ l && E.toolsType === m.Text ? w.push({
2150
+ ...E,
2105
2151
  workId: I,
2106
2152
  type: h.TextUpdate,
2107
- dataType: E.Local,
2153
+ dataType: R.Local,
2108
2154
  willSyncService: !0,
2109
2155
  emitEventType: f,
2110
2156
  requestId: p
2111
2157
  }) : w.push({
2112
- ...R,
2158
+ ...E,
2113
2159
  workId: I,
2114
2160
  type: h.UpdateNode,
2115
2161
  updateNodeOpt: {
@@ -2125,10 +2171,10 @@ class He extends U {
2125
2171
  };
2126
2172
  }
2127
2173
  }
2128
- class Qe extends U {
2174
+ class je extends q {
2129
2175
  constructor() {
2130
2176
  super(...arguments);
2131
- u(this, "emitEventType", C.SetPoint);
2177
+ u(this, "emitEventType", N.SetPoint);
2132
2178
  u(this, "updateSelectorCallback", (t) => {
2133
2179
  const { param: s, postData: r, newServiceStore: i, workShapeNode: o, res: a } = t, { willSyncService: n, isSync: c, needUndoTicker: d } = s, l = r.sp || [], p = a == null ? void 0 : a.selectRect;
2134
2180
  if (n && l) {
@@ -2167,7 +2213,7 @@ class Qe extends U {
2167
2213
  }
2168
2214
  async consume(t) {
2169
2215
  const { msgType: s, dataType: r, emitEventType: i } = t;
2170
- if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2216
+ if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2171
2217
  return await this.consumeForLocalWorker(t), !0;
2172
2218
  }
2173
2219
  async consumeForLocalWorker(t) {
@@ -2181,7 +2227,7 @@ class Qe extends U {
2181
2227
  textUpdateForWoker: n,
2182
2228
  needUndoTicker: c
2183
2229
  } = t;
2184
- s === D && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2230
+ s === P && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2185
2231
  updateSelectorOpt: r,
2186
2232
  willRefreshSelector: i,
2187
2233
  willSyncService: o,
@@ -2194,14 +2240,14 @@ class Qe extends U {
2194
2240
  }));
2195
2241
  }
2196
2242
  }
2197
- class Ke extends U {
2243
+ class Xe extends q {
2198
2244
  constructor() {
2199
2245
  super(...arguments);
2200
- u(this, "emitEventType", C.SetLock);
2246
+ u(this, "emitEventType", N.SetLock);
2201
2247
  }
2202
2248
  async consume(t) {
2203
2249
  const { msgType: s, dataType: r, emitEventType: i } = t;
2204
- if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2250
+ if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2205
2251
  return await this.consumeForLocalWorker(t), !0;
2206
2252
  }
2207
2253
  async consumeForLocalWorker(t) {
@@ -2215,7 +2261,7 @@ class Ke extends U {
2215
2261
  needUndoTicker: n,
2216
2262
  requestId: c
2217
2263
  } = t;
2218
- s === D && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2264
+ s === P && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2219
2265
  updateSelectorOpt: r,
2220
2266
  willRefreshSelector: i,
2221
2267
  willSyncService: o,
@@ -2236,9 +2282,9 @@ class Ke extends U {
2236
2282
  emitEventType: f
2237
2283
  } = s, w = r.sp || [], k = a == null ? void 0 : a.selectRect;
2238
2284
  if (n && w) {
2239
- for (const [I, R] of i.entries())
2285
+ for (const [I, E] of i.entries())
2240
2286
  w.push({
2241
- ...R,
2287
+ ...E,
2242
2288
  workId: I,
2243
2289
  type: h.UpdateNode,
2244
2290
  updateNodeOpt: {
@@ -2268,14 +2314,14 @@ class Ke extends U {
2268
2314
  };
2269
2315
  }
2270
2316
  }
2271
- class Xe extends U {
2317
+ class Ye extends q {
2272
2318
  constructor() {
2273
2319
  super(...arguments);
2274
- u(this, "emitEventType", C.SetShapeOpt);
2320
+ u(this, "emitEventType", N.SetShapeOpt);
2275
2321
  }
2276
2322
  async consume(t) {
2277
2323
  const { msgType: s, dataType: r, emitEventType: i } = t;
2278
- if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2324
+ if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2279
2325
  return await this.consumeForLocalWorker(t), !0;
2280
2326
  }
2281
2327
  async consumeForLocalWorker(t) {
@@ -2289,7 +2335,7 @@ class Xe extends U {
2289
2335
  needUndoTicker: n,
2290
2336
  requestId: c
2291
2337
  } = t;
2292
- s === D && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2338
+ s === P && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2293
2339
  updateSelectorOpt: r,
2294
2340
  willRefreshSelector: i,
2295
2341
  willSyncService: o,
@@ -2329,33 +2375,33 @@ class Xe extends U {
2329
2375
  };
2330
2376
  }
2331
2377
  }
2332
- class Ye {
2378
+ class Ze {
2333
2379
  constructor(e) {
2334
2380
  u(this, "builders", /* @__PURE__ */ new Map());
2335
2381
  this.builders = new Map(e.map((t) => [t, this.build(t)]));
2336
2382
  }
2337
2383
  build(e) {
2338
2384
  switch (e) {
2339
- case C.TranslateNode:
2340
- return new Ve();
2341
- case C.ZIndexNode:
2342
- return new ze();
2343
- case C.CopyNode:
2344
- return new Ge();
2345
- case C.SetColorNode:
2346
- return new qe();
2347
- case C.ScaleNode:
2348
- return new $e();
2349
- case C.RotateNode:
2385
+ case N.TranslateNode:
2350
2386
  return new _e();
2351
- case C.SetFontStyle:
2387
+ case N.ZIndexNode:
2388
+ return new $e();
2389
+ case N.CopyNode:
2390
+ return new ze();
2391
+ case N.SetColorNode:
2392
+ return new Ve();
2393
+ case N.ScaleNode:
2352
2394
  return new He();
2353
- case C.SetPoint:
2354
- return new Qe();
2355
- case C.SetLock:
2395
+ case N.RotateNode:
2356
2396
  return new Ke();
2357
- case C.SetShapeOpt:
2397
+ case N.SetFontStyle:
2398
+ return new Qe();
2399
+ case N.SetPoint:
2400
+ return new je();
2401
+ case N.SetLock:
2358
2402
  return new Xe();
2403
+ case N.SetShapeOpt:
2404
+ return new Ye();
2359
2405
  }
2360
2406
  }
2361
2407
  registerForMainThread(e) {
@@ -2370,14 +2416,14 @@ class Ye {
2370
2416
  return !1;
2371
2417
  }
2372
2418
  }
2373
- function Ze({
2374
- subThreads: M,
2419
+ function Je({
2420
+ subThreads: D,
2375
2421
  layers: e,
2376
2422
  scene: t,
2377
2423
  removeLayerTexture: s
2378
2424
  }) {
2379
2425
  let r;
2380
- for (const i of M)
2426
+ for (const i of D)
2381
2427
  try {
2382
2428
  i.destroy();
2383
2429
  } catch (o) {
@@ -2405,8 +2451,8 @@ function Ze({
2405
2451
  if (r)
2406
2452
  throw r;
2407
2453
  }
2408
- const je = 4;
2409
- class Je {
2454
+ const et = 4;
2455
+ class tt {
2410
2456
  constructor(e = {}) {
2411
2457
  u(this, "pendingFrames", /* @__PURE__ */ new Map());
2412
2458
  u(this, "failedCanvases", /* @__PURE__ */ new Set());
@@ -2418,7 +2464,7 @@ class Je {
2418
2464
  u(this, "destroyed", !1);
2419
2465
  this.tailFrameCount = Math.max(
2420
2466
  1,
2421
- Math.floor(e.tailFrameCount ?? je)
2467
+ Math.floor(e.tailFrameCount ?? et)
2422
2468
  ), this.requestFrame = e.requestFrame ?? ((t) => requestAnimationFrame(t)), this.cancelFrame = e.cancelFrame ?? ((t) => cancelAnimationFrame(t)), this.onReadbackError = e.onReadbackError;
2423
2469
  }
2424
2470
  markRendered(e) {
@@ -2449,7 +2495,7 @@ class Je {
2449
2495
  }
2450
2496
  }
2451
2497
  }
2452
- class et {
2498
+ class st {
2453
2499
  constructor(e, t) {
2454
2500
  u(this, "viewId");
2455
2501
  u(this, "fullLayer");
@@ -2485,50 +2531,60 @@ class et {
2485
2531
  ...t.canvasOpt,
2486
2532
  container: t.container
2487
2533
  }), this.master = t.master;
2488
- const s = K.bufferSize.full, r = K.bufferSize.sub;
2534
+ const s = Y.bufferSize.full, r = Y.bufferSize.sub;
2489
2535
  this.fullLayer = this.createLayer("fullLayer", this.scene, {
2490
2536
  ...t.layerOpt,
2491
- bufferSize: this.viewId === Q ? s : r * 2
2537
+ bufferSize: this.viewId === X ? s : r * 2
2492
2538
  }), this.topLayer = this.createLayer("topLayer", this.scene, {
2493
2539
  ...t.layerOpt,
2494
- bufferSize: (this.viewId === Q, r),
2540
+ bufferSize: (this.viewId === X, r),
2495
2541
  contextType: "2d"
2496
2542
  }), this.localLayer = this.createLayer("localLayer", this.scene, {
2497
2543
  ...t.layerOpt,
2498
- bufferSize: (this.viewId === Q, r),
2544
+ bufferSize: (this.viewId === X, r),
2499
2545
  contextType: "2d"
2500
2546
  }), this.serviceLayer = this.createLayer("serviceLayer", this.scene, {
2501
2547
  ...t.layerOpt,
2502
- bufferSize: (this.viewId === Q, r),
2548
+ bufferSize: (this.viewId === X, r),
2503
2549
  contextType: "2d"
2504
2550
  }), t.mainThreadRenderMode === "readback" && this.enableCanvas2DReadback([
2505
2551
  this.fullLayer.parent,
2506
2552
  this.topLayer.parent,
2507
2553
  this.localLayer.parent,
2508
2554
  this.serviceLayer.parent
2509
- ]), this.vNodes = new Re(e, this.scene);
2555
+ ]), this.vNodes = new be(e, this.scene);
2510
2556
  const i = {
2511
2557
  thread: this,
2512
2558
  vNodes: this.vNodes
2513
2559
  };
2514
- this.localWork = new xe(i), this.serviceWork = new Ue(i), this.topWork = new Fe(i), this.vNodes.init(this.fullLayer), this.methodBuilder = new Ye([
2515
- C.CopyNode,
2516
- C.SetColorNode,
2517
- C.DeleteNode,
2518
- C.RotateNode,
2519
- C.ScaleNode,
2520
- C.TranslateNode,
2521
- C.ZIndexNode,
2522
- C.SetFontStyle,
2523
- C.SetPoint,
2524
- C.SetLock,
2525
- C.SetShapeOpt
2560
+ this.localWork = new Ge(i), this.serviceWork = new qe(i), this.topWork = new xe(i), this.vNodes.init(this.fullLayer), this.methodBuilder = new Ze([
2561
+ N.CopyNode,
2562
+ N.SetColorNode,
2563
+ N.DeleteNode,
2564
+ N.RotateNode,
2565
+ N.ScaleNode,
2566
+ N.TranslateNode,
2567
+ N.ZIndexNode,
2568
+ N.SetFontStyle,
2569
+ N.SetPoint,
2570
+ N.SetLock,
2571
+ N.SetShapeOpt
2526
2572
  ]).registerForMainThread(this);
2527
2573
  }
2528
2574
  getCachedImages(e) {
2529
2575
  var t;
2530
2576
  return (t = this.cacheImages.get(e)) == null ? void 0 : t.imageSource;
2531
2577
  }
2578
+ getImageSourceKey(e) {
2579
+ if (!e.src) return;
2580
+ if (e.type !== me.Iconify) return e.src;
2581
+ const [t, s] = this.getIconSize(
2582
+ e.width,
2583
+ e.height,
2584
+ this.opt.displayer.dpr
2585
+ );
2586
+ return ye(e.src, t, s, e.strokeColor);
2587
+ }
2532
2588
  getCachedImagesByWorkId(e) {
2533
2589
  for (const [t, s] of this.cacheImages.entries())
2534
2590
  if (t === e && s.imageSource)
@@ -2557,7 +2613,7 @@ class et {
2557
2613
  this.destroyed || (this.combinePostMsg.add(e), this.runBatchPostData());
2558
2614
  }
2559
2615
  reportRendererBusinessError(e, t) {
2560
- const s = Y(e, t);
2616
+ const s = Z(e, t);
2561
2617
  s.reported || (s.reported = !0, this.post({
2562
2618
  sp: [
2563
2619
  {
@@ -2567,7 +2623,7 @@ class et {
2567
2623
  reportErrorCode: "RENDERER_RUNTIME_ERROR",
2568
2624
  reportStage: s.stage,
2569
2625
  reportError: s.message,
2570
- reportString: Ee(s, t, {
2626
+ reportString: Le(s, t, {
2571
2627
  viewId: this.viewId,
2572
2628
  renderer: "mainThread"
2573
2629
  })
@@ -2599,12 +2655,12 @@ class et {
2599
2655
  imageBitmap: w,
2600
2656
  imageElement: k,
2601
2657
  workIds: I,
2602
- isLockSentEventCursor: R,
2658
+ isLockSentEventCursor: E,
2603
2659
  requestId: g
2604
2660
  } = e, y = l == null ? void 0 : l.toString();
2605
2661
  switch (a) {
2606
2662
  case h.UpdateDpr:
2607
- G(e.dpr) && this.updateDpr(e.dpr);
2663
+ z(e.dpr) && this.updateDpr(e.dpr);
2608
2664
  break;
2609
2665
  case h.AuthClear: {
2610
2666
  const { clearUids: S, localUid: T } = e;
@@ -2631,9 +2687,9 @@ class et {
2631
2687
  (o = this.serviceLayer) == null ? void 0 : o.parent
2632
2688
  ].filter(Boolean);
2633
2689
  try {
2634
- await Le(
2690
+ await Ne(
2635
2691
  (async () => {
2636
- await Ne(
2692
+ await Be(
2637
2693
  this.serviceWork,
2638
2694
  S
2639
2695
  );
@@ -2645,7 +2701,7 @@ class et {
2645
2701
  }
2646
2702
  );
2647
2703
  } catch (T) {
2648
- throw Y(T, {
2704
+ throw Z(T, {
2649
2705
  business: "service-sync-commit",
2650
2706
  stage: "flush-and-prepare-render"
2651
2707
  });
@@ -2667,7 +2723,7 @@ class et {
2667
2723
  }
2668
2724
  case h.UpdateCamera:
2669
2725
  try {
2670
- await be(
2726
+ await Ce(
2671
2727
  e.cameraTaskId,
2672
2728
  async (S) => {
2673
2729
  this.activeCameraTaskContext = S;
@@ -2707,11 +2763,11 @@ class et {
2707
2763
  }
2708
2764
  break;
2709
2765
  case h.DrawWork:
2710
- p === b.Done && d === E.Local ? (await this.consumeDrawAll(d, e), n === m.LaserPen && R && this.post({
2766
+ p === b.Done && d === R.Local ? (await this.consumeDrawAll(d, e), n === m.LaserPen && E && this.post({
2711
2767
  sp: [
2712
2768
  {
2713
2769
  type: h.None,
2714
- isLockSentEventCursor: R
2770
+ isLockSentEventCursor: E
2715
2771
  }
2716
2772
  ]
2717
2773
  })) : await this.consumeDraw(d, e);
@@ -2728,7 +2784,7 @@ class et {
2728
2784
  await this.removeNode(e);
2729
2785
  return;
2730
2786
  case h.Select:
2731
- d === E.Local || l === D ? await this.localWork.updateFullSelectWork(e) : d === E.Service && this.serviceWork.runSelectWork(e);
2787
+ d === R.Local || l === P ? await this.localWork.updateFullSelectWork(e) : d === R.Service && this.serviceWork.runSelectWork(e);
2732
2788
  break;
2733
2789
  case h.CursorBlur:
2734
2790
  this.localWork.cursorBlur();
@@ -2737,22 +2793,48 @@ class et {
2737
2793
  this.localWork.cursorHover(e);
2738
2794
  break;
2739
2795
  case h.GetTextActive:
2740
- d === E.Local && this.localWork.checkTextActive(e);
2796
+ d === R.Local && this.localWork.checkTextActive(e);
2741
2797
  break;
2742
2798
  case h.GetImageBitMap:
2743
- if (f && (w || k) && l) {
2799
+ if (f && l) {
2744
2800
  const S = this.imageResolveMap.get(f);
2745
2801
  if (!S || S.requestId !== g) {
2746
- this.closeImageSource(w || k);
2802
+ const L = w || k;
2803
+ if (L && !S && this.serviceWork) {
2804
+ const O = [
2805
+ ...this.vNodes.getNodesByType(m.Image)
2806
+ ].filter(
2807
+ ([, A]) => A.opt && this.getImageSourceKey(A.opt) === f
2808
+ );
2809
+ if (O.length && !this.cacheImages.has(f)) {
2810
+ this.cacheImages.set(f, {
2811
+ imageSource: L,
2812
+ workId: O[0][0]
2813
+ }), O.forEach(([A, W]) => {
2814
+ this.serviceWork.consumeFull({
2815
+ msgType: h.FullWork,
2816
+ dataType: R.Service,
2817
+ viewId: this.viewId,
2818
+ workId: A,
2819
+ toolsType: m.Image,
2820
+ opt: W.opt
2821
+ });
2822
+ });
2823
+ break;
2824
+ }
2825
+ }
2826
+ this.closeImageSource(L);
2747
2827
  break;
2748
2828
  }
2749
- const T = l.toString();
2750
- this.deleteCachedImagesByWorkId(T), this.cacheImages.set(f, {
2751
- imageSource: w || k,
2752
- workId: T
2753
- });
2754
- const { resolve: L, timer: N } = S;
2755
- N && clearTimeout(N), L && L(f);
2829
+ if (w || k) {
2830
+ const L = l.toString();
2831
+ this.deleteCachedImagesByWorkId(L), this.cacheImages.set(f, {
2832
+ imageSource: w || k,
2833
+ workId: L
2834
+ });
2835
+ }
2836
+ const { resolve: T, timer: C } = S;
2837
+ C && clearTimeout(C), T && T(f);
2756
2838
  }
2757
2839
  break;
2758
2840
  case h.GetVNodeInfo:
@@ -2762,7 +2844,7 @@ class et {
2762
2844
  sp: [
2763
2845
  {
2764
2846
  type: h.GetVNodeInfo,
2765
- dataType: E.Local,
2847
+ dataType: R.Local,
2766
2848
  workId: l,
2767
2849
  vInfo: S
2768
2850
  }
@@ -2778,16 +2860,12 @@ class et {
2778
2860
  return r <= 50 || i <= 50 ? [50, 50] : r <= 100 || i <= 100 ? [100, 100] : r <= 200 || i <= 200 ? [200, 200] : r <= 400 || i <= 400 ? [400, 400] : r <= 800 || i <= 800 ? [800, 800] : [1600, 1600];
2779
2861
  }
2780
2862
  async loadImageBitMap(e) {
2781
- const { toolsType: t, opt: s, workId: r, requestId: i } = e;
2863
+ const { toolsType: t, opt: s, workId: r, requestId: i, timeoutMs: o } = e;
2782
2864
  if (t === m.Image && s && r) {
2783
- const o = r.toString(), { src: a, type: n, width: c, height: d, strokeColor: l } = s;
2784
- if (!a || !n || !c || !d)
2865
+ const a = r.toString(), { src: n, type: c, width: d, height: l } = s;
2866
+ if (!n || !c || !d || !l)
2785
2867
  return;
2786
- let p = a;
2787
- if (n === ue.Iconify) {
2788
- const [y, S] = this.getIconSize(c, d, this.opt.displayer.dpr);
2789
- p = fe(a, y, S, l);
2790
- }
2868
+ const p = this.getImageSourceKey(s);
2791
2869
  if (this.cacheImages.has(p)) {
2792
2870
  const y = this.getCachedImages(p);
2793
2871
  if (y)
@@ -2797,22 +2875,22 @@ class et {
2797
2875
  if (w)
2798
2876
  return await w.promise, this.getCachedImages(p);
2799
2877
  let k, I;
2800
- const R = new Promise((y, S) => {
2878
+ const E = new Promise((y, S) => {
2801
2879
  k = y, I = S;
2802
2880
  }), g = {
2803
2881
  resolve: k,
2804
2882
  reject: I,
2805
2883
  timer: void 0,
2806
2884
  requestId: i,
2807
- promise: R
2885
+ promise: E
2808
2886
  };
2809
2887
  return g.timer = setTimeout(() => {
2810
2888
  this.imageResolveMap.get(p) === g && k(p);
2811
- }, 5e3), this.imageResolveMap.set(p, g), this.opt.post({
2889
+ }, o ?? 5e3), this.imageResolveMap.set(p, g), this.opt.post({
2812
2890
  sp: [
2813
2891
  {
2814
2892
  imageSrc: p,
2815
- workId: o,
2893
+ workId: a,
2816
2894
  viewId: this.viewId,
2817
2895
  isgl: !!this.fullLayer.parent.gl,
2818
2896
  isSubWorker: !1,
@@ -2820,23 +2898,23 @@ class et {
2820
2898
  type: h.GetImageBitMap
2821
2899
  }
2822
2900
  ]
2823
- }), await R, this.imageResolveMap.get(p) === g && this.imageResolveMap.delete(p), this.getCachedImages(p);
2901
+ }), await E, this.imageResolveMap.get(p) === g && this.imageResolveMap.delete(p), this.getCachedImages(p);
2824
2902
  }
2825
2903
  }
2826
2904
  async removeNode(e) {
2827
2905
  const { dataType: t, workId: s, removeIds: r } = e, i = r || [];
2828
2906
  if (s && i.push(s.toString()), i.length)
2829
2907
  for (const o of i) {
2830
- if (o === D) {
2908
+ if (o === P) {
2831
2909
  await this.localWork.removeSelector(e);
2832
2910
  continue;
2833
2911
  }
2834
- t === E.Local ? this.localWork.removeWork(e) : t === E.Service && this.serviceWork.removeWork(e), await this.localWork.colloctEffectSelectWork(e);
2912
+ t === R.Local ? this.localWork.removeWork(e) : t === R.Service && this.serviceWork.removeWork(e), await this.localWork.colloctEffectSelectWork(e);
2835
2913
  }
2836
2914
  }
2837
2915
  async consumeFull(e, t) {
2838
2916
  const s = await this.localWork.colloctEffectSelectWork(t);
2839
- s && e === E.Local && await this.localWork.consumeFull(s), s && e === E.Service && this.serviceWork.consumeFull(s);
2917
+ s && e === R.Local && await this.localWork.consumeFull(s), s && e === R.Service && this.serviceWork.consumeFull(s);
2840
2918
  }
2841
2919
  setCameraOpt(e) {
2842
2920
  this.cameraOpt = e;
@@ -2863,13 +2941,13 @@ class et {
2863
2941
  };
2864
2942
  let c = !1;
2865
2943
  for (const d of e)
2866
- if (le(n, d)) {
2944
+ if (ue(n, d)) {
2867
2945
  c = !0;
2868
2946
  break;
2869
2947
  }
2870
2948
  c || e.push(n);
2871
2949
  }
2872
- G(o.fullWorkerDrawCount) && (t = o.fullWorkerDrawCount), G(o.consumeCount) && (s = o.consumeCount, r = o.consumeWorkId);
2950
+ z(o.fullWorkerDrawCount) && (t = o.fullWorkerDrawCount), z(o.consumeCount) && (s = o.consumeCount, r = o.consumeWorkId);
2873
2951
  }
2874
2952
  return this.combinePostMsg.clear(), {
2875
2953
  sp: e,
@@ -2899,7 +2977,7 @@ class et {
2899
2977
  clearAll() {
2900
2978
  this.cancelCameraSettledRender(), this.debounceUpdateCache.clear(), this.fullLayer.children.length && (this.fullLayer.parent.children.forEach((e) => {
2901
2979
  e.name !== "viewport" && e.remove();
2902
- }), $(this.fullLayer, this.fullLayer.parent)), this.clearCacheImages(), this.clearImageResolveMap(), this.localWork.clearAll(), this.topWork.clearAll(), this.serviceWork.clearAll(), this.vNodes.clear(), this.post({
2980
+ }), K(this.fullLayer, this.fullLayer.parent)), this.clearCacheImages(), this.clearImageResolveMap(), this.localWork.clearAll(), this.topWork.clearAll(), this.serviceWork.clearAll(), this.vNodes.clear(), this.post({
2903
2981
  sp: [
2904
2982
  {
2905
2983
  type: h.Clear
@@ -2912,12 +2990,12 @@ class et {
2912
2990
  if (r) {
2913
2991
  const i = r.toString();
2914
2992
  if (s && this.topWork.canUseTopLayer(s)) {
2915
- e === E.Local && (this.topWork.getLocalWorkShape(
2993
+ e === R.Local && (this.topWork.getLocalWorkShape(
2916
2994
  r.toString()
2917
2995
  ) || this.topWork.createLocalWork(t)), await this.topWork.consumeDrawAll(t);
2918
2996
  return;
2919
2997
  }
2920
- e === E.Local && (this.localWork.getWorkShape(i) || this.localWork.createLocalWork(t), await this.localWork.consumeDrawAll(t, this.serviceWork));
2998
+ e === R.Local && (this.localWork.getWorkShape(i) || this.localWork.createLocalWork(t), await this.localWork.consumeDrawAll(t, this.serviceWork));
2921
2999
  }
2922
3000
  }
2923
3001
  async consumeDraw(e, t) {
@@ -2925,10 +3003,10 @@ class et {
2925
3003
  if (r && i && s) {
2926
3004
  const o = r.toString();
2927
3005
  if (this.topWork.canUseTopLayer(i)) {
2928
- e === E.Local && (this.topWork.getLocalWorkShape(o) || this.topWork.createLocalWork(t)), this.topWork.consumeDraw(t);
3006
+ e === R.Local && (this.topWork.getLocalWorkShape(o) || this.topWork.createLocalWork(t)), this.topWork.consumeDraw(t);
2929
3007
  return;
2930
3008
  }
2931
- e === E.Local ? (this.localWork.getWorkShape(o) || this.localWork.createLocalWork(t), await this.localWork.consumeDraw(t, this.serviceWork)) : e === E.Service && this.serviceWork.consumeDraw(t);
3009
+ e === R.Local ? (this.localWork.getWorkShape(o) || this.localWork.createLocalWork(t), await this.localWork.consumeDraw(t, this.serviceWork)) : e === R.Service && this.serviceWork.consumeDraw(t);
2932
3010
  return;
2933
3011
  }
2934
3012
  }
@@ -2936,13 +3014,13 @@ class et {
2936
3014
  var d, l;
2937
3015
  const { cameraOpt: s, scenePath: r, cameraTaskId: i } = e;
2938
3016
  let o = !1;
2939
- const a = this.cameraOpt, n = !!(s && le(a, s));
3017
+ const a = this.cameraOpt, n = !!(s && ue(a, s));
2940
3018
  let c = !1;
2941
3019
  if (s && n) {
2942
3020
  const p = !!this.activeCameraSettledRender;
2943
3021
  if (this.retargetCameraSettledRender(i)) return;
2944
3022
  if (!p) {
2945
- G(i) && this.opt.post({
3023
+ z(i) && this.opt.post({
2946
3024
  viewId: this.viewId,
2947
3025
  viewGeneration: this.viewGeneration,
2948
3026
  cameraSettledTaskId: i
@@ -2958,8 +3036,8 @@ class et {
2958
3036
  let y;
2959
3037
  do {
2960
3038
  y = [];
2961
- for (const [T, L] of this.localWork.getWorkShapes().entries())
2962
- switch (L.toolsType) {
3039
+ for (const [T, C] of this.localWork.getWorkShapes().entries())
3040
+ switch (C.toolsType) {
2963
3041
  case m.Text:
2964
3042
  case m.BitMapEraser:
2965
3043
  case m.PencilEraser:
@@ -2968,14 +3046,14 @@ class et {
2968
3046
  case m.LaserPen:
2969
3047
  break;
2970
3048
  default:
2971
- T !== H && T !== D && y.push(`${T}:${L.toolsType}`);
3049
+ T !== j && T !== P && y.push(`${T}:${C.toolsType}`);
2972
3050
  break;
2973
3051
  }
2974
3052
  if (t && (t.stage = "blocking-works", t.blockingWorks = y), !y.length) break;
2975
3053
  if (!await new Promise((T) => {
2976
3054
  this.taskUpdateCameraResolve = T, this.taskUpdateCameraId = setTimeout(() => {
2977
3055
  this.taskUpdateCameraId = void 0, this.taskUpdateCameraResolve = void 0, T(!0);
2978
- }, oe);
3056
+ }, ce);
2979
3057
  }) || t != null && t.aborted) return;
2980
3058
  } while (y.length);
2981
3059
  t && (t.stage = "update-camera", t.blockingWorks = void 0);
@@ -2984,10 +3062,10 @@ class et {
2984
3062
  const f = /* @__PURE__ */ new Map();
2985
3063
  for (const [y, S] of this.vNodes.getNodesByType(m.Text).entries()) {
2986
3064
  const T = S.rect;
2987
- f.set(y, J(T));
3065
+ f.set(y, te(T));
2988
3066
  }
2989
3067
  for (const [y, S] of this.vNodes.gethasEraserNodes().entries())
2990
- f.set(y, J(S.rect));
3068
+ f.set(y, te(S.rect));
2991
3069
  const w = new Set(f.keys());
2992
3070
  let k = !1;
2993
3071
  if (this.localWork.hasSelector()) {
@@ -3010,26 +3088,26 @@ class et {
3010
3088
  }
3011
3089
  if (this.setCameraOpt(s), this.vNodes.curNodeMap.size) {
3012
3090
  this.vNodes.clearTarget(), this.vNodes.updateHighLevelNodesRect(w);
3013
- for (const [T, L] of f.entries()) {
3014
- const N = this.vNodes.get(T);
3015
- if (N) {
3016
- const A = L, W = N.rect, v = this.getSceneRect(), B = ae(A, v), O = ae(W, v);
3017
- let P = c;
3018
- (B !== O || A.w !== W.w || A.h !== W.h || O === Ce.intersect) && (P = !0);
3019
- const { toolsType: F, opt: x } = N, X = x.eraserlines && x.eraserlines.length > 0 || !!x.eraserFaces;
3020
- (P || p && X) && (F === m.Text || X) && this.debounceUpdateCache.add(T);
3091
+ for (const [T, C] of f.entries()) {
3092
+ const L = this.vNodes.get(T);
3093
+ if (L) {
3094
+ const O = C, A = L.rect, W = this.getSceneRect(), v = he(O, W), B = he(A, W);
3095
+ let F = c;
3096
+ (v !== B || O.w !== A.w || O.h !== A.h || B === Oe.intersect) && (F = !0);
3097
+ const { toolsType: M, opt: U } = L, x = U.eraserlines && U.eraserlines.length > 0 || !!U.eraserFaces;
3098
+ (F || p && x) && (M === m.Text || x) && this.debounceUpdateCache.add(T);
3021
3099
  }
3022
3100
  }
3023
3101
  if (k && this.localWork.reRenderSelector(), I)
3024
3102
  for (const [
3025
3103
  T,
3026
- L
3104
+ C
3027
3105
  ] of this.serviceWork.selectorWorkShapes.entries())
3028
3106
  this.serviceWork.runSelectWork({
3029
3107
  workId: T,
3030
- selectIds: L.selectIds,
3108
+ selectIds: C.selectIds,
3031
3109
  msgType: h.Select,
3032
- dataType: E.Service,
3110
+ dataType: R.Service,
3033
3111
  viewId: this.viewId
3034
3112
  });
3035
3113
  o = !0;
@@ -3041,44 +3119,44 @@ class et {
3041
3119
  this.debounceUpdateCameraId = void 0;
3042
3120
  try {
3043
3121
  if (!S()) return;
3044
- const L = [];
3045
- for (const W of this.debounceUpdateCache.values()) {
3046
- const v = (T = this.fullLayer) == null ? void 0 : T.getElementsByName(W)[0], B = this.vNodes.get(W);
3047
- if (B) {
3048
- const { toolsType: O, opt: P } = B;
3049
- if (v || O !== m.Text) {
3050
- const F = this.localWork.setFullWork({
3051
- toolsType: O,
3052
- opt: P,
3053
- workId: W
3122
+ const C = [];
3123
+ for (const A of this.debounceUpdateCache.values()) {
3124
+ const W = (T = this.fullLayer) == null ? void 0 : T.getElementsByName(A)[0], v = this.vNodes.get(A);
3125
+ if (v) {
3126
+ const { toolsType: B, opt: F } = v;
3127
+ if (W || B !== m.Text) {
3128
+ const M = this.localWork.setFullWork({
3129
+ toolsType: B,
3130
+ opt: F,
3131
+ workId: A
3054
3132
  });
3055
- if (F) {
3056
- if (O === m.Text)
3057
- L.push(
3058
- F.consumeServiceAsync({
3133
+ if (M) {
3134
+ if (B === m.Text)
3135
+ C.push(
3136
+ M.consumeServiceAsync({
3059
3137
  isFullWork: !0,
3060
- replaceId: W,
3138
+ replaceId: A,
3061
3139
  boxRect: this.getSceneRect(),
3062
3140
  isActive: S
3063
3141
  })
3064
3142
  );
3065
- else if (P.eraserlines && P.eraserlines.length > 0 || P.eraserFaces) {
3066
- const x = F.consumeService({
3067
- op: B.op,
3143
+ else if (F.eraserlines && F.eraserlines.length > 0 || F.eraserFaces) {
3144
+ const U = M.consumeService({
3145
+ op: v.op,
3068
3146
  isFullWork: !0,
3069
- replaceId: W,
3147
+ replaceId: A,
3070
3148
  workState: b.Done
3071
3149
  });
3072
- this.localWork.clearWorkShapeNodeCache(W), L.push(Promise.resolve(x));
3150
+ this.localWork.clearWorkShapeNodeCache(A), C.push(Promise.resolve(U));
3073
3151
  }
3074
3152
  }
3075
3153
  }
3076
3154
  }
3077
- this.debounceUpdateCache.delete(W);
3155
+ this.debounceUpdateCache.delete(A);
3078
3156
  }
3079
- if (await Promise.all(L), !S()) return;
3080
- this.vNodes.updateLowLevelNodesRect(), this.vNodes.clearHighLevelIds(), k && L.length && this.localWork.reRenderSelector();
3081
- const N = [
3157
+ if (await Promise.all(C), !S()) return;
3158
+ this.vNodes.updateLowLevelNodesRect(), this.vNodes.clearHighLevelIds();
3159
+ const L = [
3082
3160
  this.fullLayer.parent.prepareRender,
3083
3161
  this.topLayer.parent.prepareRender,
3084
3162
  this.localLayer.parent.prepareRender,
@@ -3089,63 +3167,63 @@ class et {
3089
3167
  this.topLayer.parent,
3090
3168
  this.localLayer.parent,
3091
3169
  this.serviceLayer.parent
3092
- ], await Promise.all(N), y.renderLayers = void 0, !S()) return;
3093
- const A = y.cameraTaskId;
3094
- G(A) && this.opt.post({
3170
+ ], await Promise.all(L), y.renderLayers = void 0, !S()) return;
3171
+ const O = y.cameraTaskId;
3172
+ z(O) && this.opt.post({
3095
3173
  viewId: this.viewId,
3096
3174
  viewGeneration: this.viewGeneration,
3097
- cameraSettledTaskId: A
3175
+ cameraSettledTaskId: O
3098
3176
  });
3099
- } catch (L) {
3177
+ } catch (C) {
3100
3178
  if (!S()) return;
3101
- const N = {
3179
+ const L = {
3102
3180
  code: "RENDERER_BUSINESS_ERROR",
3103
3181
  business: "updateCamera",
3104
- message: L instanceof Error ? L.message : String(L),
3182
+ message: C instanceof Error ? C.message : String(C),
3105
3183
  stage: "camera-settled-render",
3106
3184
  workerType: "mainThread"
3107
- }, A = y.cameraTaskId;
3108
- if (G(A))
3185
+ }, O = y.cameraTaskId;
3186
+ if (z(O))
3109
3187
  try {
3110
3188
  this.opt.post({
3111
3189
  viewId: this.viewId,
3112
3190
  viewGeneration: this.viewGeneration,
3113
- cameraTaskId: A,
3191
+ cameraTaskId: O,
3114
3192
  cameraTaskStatus: "failed",
3115
- cameraTaskError: N
3193
+ cameraTaskError: L
3116
3194
  });
3117
- } catch (W) {
3195
+ } catch (A) {
3118
3196
  console.error(
3119
- `[cameraSettledRender] failed ACK post failed viewId=${this.viewId} taskId=${A}`,
3120
- W
3197
+ `[cameraSettledRender] failed ACK post failed viewId=${this.viewId} taskId=${O}`,
3198
+ A
3121
3199
  );
3122
3200
  }
3123
3201
  } finally {
3124
3202
  y.renderLayers = void 0, this.activeCameraSettledRender === y && (this.activeCameraSettledRender = void 0);
3125
3203
  }
3126
- }, oe);
3204
+ }, ce);
3127
3205
  }
3128
- const R = [
3206
+ const E = [
3129
3207
  this.fullLayer.parent,
3130
3208
  this.topLayer.parent,
3131
3209
  this.localLayer.parent,
3132
3210
  this.serviceLayer.parent
3133
3211
  ], g = Promise.all(
3134
- R.map((y) => y.prepareRender)
3212
+ E.map((y) => y.prepareRender)
3135
3213
  );
3136
- if (t && !await Be(
3214
+ if (t && !await De(
3137
3215
  t,
3138
3216
  g,
3139
3217
  "prepare-render"
3140
3218
  )) {
3141
- R.filter(
3219
+ E.filter(
3142
3220
  (S) => S.cancelPendingRender()
3143
3221
  ).forEach((S) => S.render()), g.catch(() => {
3144
3222
  });
3145
3223
  return;
3146
3224
  }
3147
3225
  if (t || await g, t != null && t.aborted) return;
3148
- !o && G(i) && this.opt.post({
3226
+ !o && z(i) && this.opt.post({
3149
3227
  viewId: this.viewId,
3150
3228
  viewGeneration: this.viewGeneration,
3151
3229
  cameraSettledTaskId: i
@@ -3162,7 +3240,7 @@ class et {
3162
3240
  };
3163
3241
  }
3164
3242
  createScene(e) {
3165
- return new me({
3243
+ return new we({
3166
3244
  displayRatio: this.opt.displayer.dpr,
3167
3245
  depth: !1,
3168
3246
  desynchronized: !0,
@@ -3173,7 +3251,7 @@ class et {
3173
3251
  });
3174
3252
  }
3175
3253
  createLayer(e, t, s) {
3176
- const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, { ...s, offscreen: !1 }), n = new ye({
3254
+ const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, { ...s, offscreen: !1 }), n = new ve({
3177
3255
  anchor: [0.5, 0.5],
3178
3256
  pos: [r * 0.5, i * 0.5],
3179
3257
  size: [r, i],
@@ -3183,7 +3261,7 @@ class et {
3183
3261
  return a.append(n), n;
3184
3262
  }
3185
3263
  enableCanvas2DReadback(e) {
3186
- this.readbackScheduler = new Je({
3264
+ this.readbackScheduler = new tt({
3187
3265
  onReadbackError: (t) => this.opt.master.Logger.warn(
3188
3266
  `[Appliance]: [main-thread-readback] stage=failed viewId=${this.viewId} error=${t instanceof Error ? t.message : String(t)}`
3189
3267
  )
@@ -3221,7 +3299,7 @@ class et {
3221
3299
  }
3222
3300
  retargetCameraSettledRender(e) {
3223
3301
  var s;
3224
- if (!G(e)) return !1;
3302
+ if (!z(e)) return !1;
3225
3303
  const t = this.activeCameraSettledRender;
3226
3304
  return !t || t.cancelled || (s = t.context) != null && s.aborted ? !1 : (t.cameraTaskId = e, !0);
3227
3305
  }
@@ -3234,7 +3312,7 @@ class et {
3234
3312
  var e, t;
3235
3313
  this.destroyed || (this.destroyed = !0, this.disableCanvas2DReadback(), (t = (e = this.activeCameraTaskContext) == null ? void 0 : e.abort) == null || t.call(e), this.activeCameraTaskContext = void 0, this.mainThreadPostId !== void 0 && (cancelAnimationFrame(this.mainThreadPostId), this.mainThreadPostId = void 0), this.combinePostMsg.clear(), this.cancelCameraBlockingWait(), this.cancelCameraSettledRender(), this.debounceUpdateCache.clear(), this.clearCacheImages(), this.clearImageResolveMap(
3236
3314
  new Error(`main-thread view destroyed: ${this.viewId}`)
3237
- ), this.vNodes.clear(), Ze({
3315
+ ), this.vNodes.clear(), Je({
3238
3316
  subThreads: [this.localWork, this.serviceWork, this.topWork],
3239
3317
  layers: [
3240
3318
  this.fullLayer,
@@ -3243,11 +3321,11 @@ class et {
3243
3321
  this.serviceLayer
3244
3322
  ],
3245
3323
  scene: this.scene,
3246
- removeLayerTexture: (s, r) => z(s, r)
3324
+ removeLayerTexture: (s, r) => _(s, r)
3247
3325
  }));
3248
3326
  }
3249
3327
  }
3250
- class tt {
3328
+ class rt {
3251
3329
  constructor(e, t) {
3252
3330
  u(this, "viewId");
3253
3331
  u(this, "fullLayer");
@@ -3268,7 +3346,7 @@ class tt {
3268
3346
  container: t.container
3269
3347
  }), this.master = t.master, this.fullLayer = this.createLayer("fullLayer", this.scene, {
3270
3348
  ...t.layerOpt,
3271
- bufferSize: this.viewId === Q ? 6e3 : 3e3,
3349
+ bufferSize: this.viewId === X ? 6e3 : 3e3,
3272
3350
  contextType: "2d"
3273
3351
  });
3274
3352
  }
@@ -3393,18 +3471,22 @@ class tt {
3393
3471
  return;
3394
3472
  }
3395
3473
  case h.GetImageBitMap: {
3396
- if (s && (r || i) && o) {
3397
- const n = o.toString(), c = this.imageResolveMap.get(s);
3398
- if (!c || c.requestId !== a) {
3474
+ if (s && o) {
3475
+ const n = this.imageResolveMap.get(s);
3476
+ if (!n || n.requestId !== a) {
3399
3477
  this.closeImageSource(r || i);
3400
3478
  break;
3401
3479
  }
3402
- if (this.deleteCachedImagesByWorkId(n), this.cacheImages.set(s, {
3403
- imageSource: r || i,
3404
- workId: n
3405
- }), c) {
3406
- const { resolve: d, timer: l } = c;
3407
- l && clearTimeout(l), d && d(s);
3480
+ if (r || i) {
3481
+ const c = o.toString();
3482
+ this.deleteCachedImagesByWorkId(c), this.cacheImages.set(s, {
3483
+ imageSource: r || i,
3484
+ workId: c
3485
+ });
3486
+ }
3487
+ if (n) {
3488
+ const { resolve: c, timer: d } = n;
3489
+ d && clearTimeout(d), c && c(s);
3408
3490
  }
3409
3491
  }
3410
3492
  break;
@@ -3422,9 +3504,9 @@ class tt {
3422
3504
  if (!a || !n || !c || !d)
3423
3505
  return;
3424
3506
  let p = a;
3425
- if (n === ue.Iconify) {
3507
+ if (n === me.Iconify) {
3426
3508
  const [g, y] = this.getIconSize(c, d, this.opt.displayer.dpr);
3427
- p = fe(a, g, y, l);
3509
+ p = ye(a, g, y, l);
3428
3510
  }
3429
3511
  if (this.cacheImages.has(p)) {
3430
3512
  const g = this.getCachedImages(p);
@@ -3437,15 +3519,15 @@ class tt {
3437
3519
  let k;
3438
3520
  const I = new Promise((g) => {
3439
3521
  k = g;
3440
- }), R = {
3522
+ }), E = {
3441
3523
  resolve: k,
3442
3524
  timer: void 0,
3443
3525
  requestId: i,
3444
3526
  promise: I
3445
3527
  };
3446
- return R.timer = setTimeout(() => {
3447
- this.imageResolveMap.get(p) === R && k(p);
3448
- }, 5e3), this.imageResolveMap.set(p, R), this.opt.post({
3528
+ return E.timer = setTimeout(() => {
3529
+ this.imageResolveMap.get(p) === E && k(p);
3530
+ }, 5e3), this.imageResolveMap.set(p, E), this.opt.post({
3449
3531
  viewId: this.viewId,
3450
3532
  viewGeneration: this.viewGeneration,
3451
3533
  viewOwner: this.viewOwner,
@@ -3460,11 +3542,11 @@ class tt {
3460
3542
  requestId: i
3461
3543
  }
3462
3544
  ]
3463
- }), await I, this.imageResolveMap.get(p) === R && this.imageResolveMap.delete(p), this.getCachedImages(p);
3545
+ }), await I, this.imageResolveMap.get(p) === E && this.imageResolveMap.delete(p), this.getCachedImages(p);
3464
3546
  }
3465
3547
  }
3466
3548
  createWorkShapeNode(e) {
3467
- return Z({
3549
+ return J({
3468
3550
  ...e,
3469
3551
  fullLayer: this.fullLayer,
3470
3552
  drawLayer: void 0
@@ -3484,7 +3566,7 @@ class tt {
3484
3566
  }
3485
3567
  async runFullWork(e) {
3486
3568
  var r;
3487
- const t = this.setFullWork(e), s = e.ops && V(e.ops);
3569
+ const t = this.setFullWork(e), s = e.ops && H(e.ops);
3488
3570
  if (t) {
3489
3571
  let i, o;
3490
3572
  const a = (r = t.getWorkId()) == null ? void 0 : r.toString();
@@ -3503,18 +3585,9 @@ class tt {
3503
3585
  op: s,
3504
3586
  isFullWork: !0,
3505
3587
  replaceId: a
3506
- }), o = (e == null ? void 0 : e.updateNodeOpt) && t.updataOptService(e.updateNodeOpt)), i = this.syncMatrixRect(a, t, i), ne(i, o);
3588
+ }), o = (e == null ? void 0 : e.updateNodeOpt) && t.updataOptService(e.updateNodeOpt)), le(i, o);
3507
3589
  }
3508
3590
  }
3509
- syncMatrixRect(e, t, s) {
3510
- const r = t.getWorkOptions().matrix;
3511
- if (!e || !r || pe(r).every(
3512
- (o, a) => o === [1, 0, 0, 1, 0, 0][a]
3513
- ))
3514
- return s;
3515
- const i = Oe.getRectFromLayer(this.fullLayer, e);
3516
- return i || s;
3517
- }
3518
3591
  async getSnapshot(e) {
3519
3592
  const { scenePath: t, scenes: s, cameraOpt: r, w: i, h: o, requestId: a } = e;
3520
3593
  if (!(t && s && r))
@@ -3530,7 +3603,7 @@ class tt {
3530
3603
  opt: l,
3531
3604
  workId: c,
3532
3605
  msgType: h.FullWork,
3533
- dataType: E.Service,
3606
+ dataType: R.Service,
3534
3607
  viewId: this.viewId,
3535
3608
  requestId: a
3536
3609
  };
@@ -3588,7 +3661,7 @@ class tt {
3588
3661
  requestId: r
3589
3662
  }
3590
3663
  ]
3591
- }), this.fullLayer && !this.destroyed && $(this.fullLayer, this.fullLayer.parent);
3664
+ }), this.fullLayer && !this.destroyed && K(this.fullLayer, this.fullLayer.parent);
3592
3665
  }
3593
3666
  }
3594
3667
  async getBoundingRect(e) {
@@ -3606,11 +3679,11 @@ class tt {
3606
3679
  ...n,
3607
3680
  workId: a,
3608
3681
  msgType: h.FullWork,
3609
- dataType: E.Service,
3682
+ dataType: R.Service,
3610
3683
  viewId: this.viewId,
3611
3684
  requestId: i
3612
3685
  });
3613
- o = ne(o, c);
3686
+ o = le(o, c);
3614
3687
  break;
3615
3688
  }
3616
3689
  }
@@ -3647,7 +3720,7 @@ class tt {
3647
3720
  for (const r of s.sp) {
3648
3721
  let i = !1;
3649
3722
  for (const o of e)
3650
- if (De(r, o)) {
3723
+ if (Me(r, o)) {
3651
3724
  i = !0;
3652
3725
  break;
3653
3726
  }
@@ -3687,7 +3760,7 @@ class tt {
3687
3760
  this.releaseBatchImageBitmaps(e);
3688
3761
  }
3689
3762
  createScene(e) {
3690
- return new me({
3763
+ return new we({
3691
3764
  displayRatio: this.opt.displayer.dpr,
3692
3765
  depth: !1,
3693
3766
  desynchronized: !0,
@@ -3697,7 +3770,7 @@ class tt {
3697
3770
  });
3698
3771
  }
3699
3772
  createLayer(e, t, s) {
3700
- const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, s), n = new ye({
3773
+ const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, s), n = new ve({
3701
3774
  anchor: [0.5, 0.5],
3702
3775
  pos: [r * 0.5, i * 0.5],
3703
3776
  size: [r, i],
@@ -3751,7 +3824,7 @@ class tt {
3751
3824
  t.push(r);
3752
3825
  }
3753
3826
  try {
3754
- s && z(this.fullLayer, s);
3827
+ s && _(this.fullLayer, s);
3755
3828
  } catch (r) {
3756
3829
  t.push(r);
3757
3830
  }
@@ -3764,7 +3837,7 @@ class tt {
3764
3837
  throw t[0];
3765
3838
  }
3766
3839
  }
3767
- class pt {
3840
+ class ft {
3768
3841
  constructor(e) {
3769
3842
  u(this, "mainThreadMap", /* @__PURE__ */ new Map());
3770
3843
  u(this, "cameraRenderQueueByView", /* @__PURE__ */ new Map());
@@ -3799,8 +3872,8 @@ class pt {
3799
3872
  consumeCount: l,
3800
3873
  consumeWorkId: p
3801
3874
  } = e;
3802
- if (c && q(i)) {
3803
- const f = Me(
3875
+ if (c && $(i)) {
3876
+ const f = Pe(
3804
3877
  o,
3805
3878
  a,
3806
3879
  "mainThread"
@@ -3812,11 +3885,11 @@ class pt {
3812
3885
  d
3813
3886
  ) : this.master.ackCameraTask(c, i, d);
3814
3887
  }
3815
- c && q(n) && this.master.ackCameraSettledTask(
3888
+ c && $(n) && this.master.ackCameraSettledTask(
3816
3889
  c,
3817
3890
  n,
3818
3891
  d
3819
- ), this.master.isBusy && q(r) && this.master.setWorkerTasksqueueCount(r), q(t) && this.master.setMaxDrawCount(t), q(l) && this.master.setConsumeCount(l, p), s && this.master.collectorSyncData(
3892
+ ), this.master.isBusy && $(r) && this.master.setWorkerTasksqueueCount(r), $(t) && this.master.setMaxDrawCount(t), $(l) && this.master.setConsumeCount(l, p), s && this.master.collectorSyncData(
3820
3893
  e.viewOwner === void 0 ? s : s.map(
3821
3894
  (f) => f.type === h.GetImageBitMap && f.viewOwner === void 0 ? { ...f, viewOwner: e.viewOwner } : f
3822
3895
  )
@@ -3830,7 +3903,7 @@ class pt {
3830
3903
  return this.cameraRenderQueueByView.set(e, r), r;
3831
3904
  }
3832
3905
  isStaleViewMessage(e) {
3833
- if (!e.viewId || e.viewId === ce || e.viewGeneration === void 0)
3906
+ if (!e.viewId || e.viewId === de || e.viewGeneration === void 0)
3834
3907
  return !1;
3835
3908
  const t = this.viewGenerationById.get(e.viewId);
3836
3909
  return t !== void 0 && e.viewGeneration < t;
@@ -3885,10 +3958,10 @@ class pt {
3885
3958
  );
3886
3959
  }
3887
3960
  createMainThread(e, t) {
3888
- return new et(e, t);
3961
+ return new st(e, t);
3889
3962
  }
3890
3963
  createSnapshotThread(e, t) {
3891
- return new tt(e, t);
3964
+ return new rt(e, t);
3892
3965
  }
3893
3966
  getSnapshotRequestKey(e) {
3894
3967
  return e.requestId || `${e.viewId}\0${e.scenePath || ""}\0${e.msgType}`;
@@ -3955,36 +4028,36 @@ class pt {
3955
4028
  if (o === h.Init) {
3956
4029
  const g = i.viewGeneration ?? (this.viewGenerationById.get(a) || 0) + 1;
3957
4030
  await this.enqueueViewTask(a, async () => {
3958
- var W, v, B;
4031
+ var A, W, v;
3959
4032
  const y = this.viewGenerationById.get(a);
3960
4033
  if (y !== void 0 && g < y)
3961
4034
  return;
3962
4035
  this.viewGenerationById.set(a, g);
3963
- const S = i.viewOwner || `${a}:${g}:${++this.ownerSequence}`, T = (W = this.master.control.viewContainerManager.getView(a)) == null ? void 0 : W.displayer, L = T == null ? void 0 : T.canvasContainerRef.current;
3964
- if (!T || !L || !l || !p) {
4036
+ const S = i.viewOwner || `${a}:${g}:${++this.ownerSequence}`, T = (A = this.master.control.viewContainerManager.getView(a)) == null ? void 0 : A.displayer, C = T == null ? void 0 : T.canvasContainerRef.current;
4037
+ if (!T || !C || !l || !p) {
3965
4038
  this.viewOwnerById.delete(a);
3966
4039
  return;
3967
4040
  }
3968
4041
  this.viewOwnerById.set(a, S);
3969
- const N = this.mainThreadMap.get(a);
3970
- N == null || N.destroy();
3971
- const A = this.createMainThread(a, {
4042
+ const L = this.mainThreadMap.get(a);
4043
+ L == null || L.destroy();
4044
+ const O = this.createMainThread(a, {
3972
4045
  displayer: T,
3973
- container: L,
4046
+ container: C,
3974
4047
  layerOpt: l,
3975
4048
  master: this.master,
3976
4049
  canvasOpt: p,
3977
4050
  viewOwner: S,
3978
4051
  viewGeneration: g,
3979
- mainThreadRenderMode: ((B = (v = this.master.control) == null ? void 0 : v.renderingCompatibilityDecision) == null ? void 0 : B.mainThreadRenderMode) ?? "normal",
3980
- post: (O) => this.post({
3981
- ...O,
3982
- viewId: O.viewId || a,
3983
- viewGeneration: O.viewGeneration ?? g,
4052
+ mainThreadRenderMode: ((v = (W = this.master.control) == null ? void 0 : W.renderingCompatibilityDecision) == null ? void 0 : v.mainThreadRenderMode) ?? "normal",
4053
+ post: (B) => this.post({
4054
+ ...B,
4055
+ viewId: B.viewId || a,
4056
+ viewGeneration: B.viewGeneration ?? g,
3984
4057
  viewOwner: S
3985
4058
  })
3986
4059
  });
3987
- this.mainThreadMap.set(a, A), A && f && A.setCameraOpt(f), this.post({
4060
+ this.mainThreadMap.set(a, O), O && f && O.setCameraOpt(f), this.post({
3988
4061
  sp: [
3989
4062
  {
3990
4063
  type: h.Init,
@@ -3999,38 +4072,38 @@ class pt {
3999
4072
  if (o === h.Snapshot || o === h.BoundingBox) {
4000
4073
  const g = (t = this.master.control.viewContainerManager.getView(a)) == null ? void 0 : t.displayer, y = (s = this.master.control.viewContainerManager.mainView) == null ? void 0 : s.displayer, S = (r = y == null ? void 0 : y.snapshotContainerRef) == null ? void 0 : r.current;
4001
4074
  if (g && S && f) {
4002
- const T = this.getSnapshotRequestKey(i), L = this.snapshotThreadsByRequest.get(T);
4003
- L && this.disposeSnapshotThread(T, L.thread, "replaced");
4004
- const N = document.createElement("div");
4005
- N.style.width = `${f.width}px`, N.style.height = `${f.height}px`, S.append(N);
4006
- const A = {
4007
- ...he.defaultLayerOpt,
4075
+ const T = this.getSnapshotRequestKey(i), C = this.snapshotThreadsByRequest.get(T);
4076
+ C && this.disposeSnapshotThread(T, C.thread, "replaced");
4077
+ const L = document.createElement("div");
4078
+ L.style.width = `${f.width}px`, L.style.height = `${f.height}px`, S.append(L);
4079
+ const O = {
4080
+ ...pe.defaultLayerOpt,
4008
4081
  offscreen: !1,
4009
4082
  width: f.width,
4010
4083
  height: f.height
4011
- }, W = {
4012
- ...he.defaultScreenCanvasOpt,
4084
+ }, A = {
4085
+ ...pe.defaultScreenCanvasOpt,
4013
4086
  width: f.width,
4014
4087
  height: f.height
4015
- }, v = this.createSnapshotThread(a, {
4088
+ }, W = this.createSnapshotThread(a, {
4016
4089
  displayer: g,
4017
- container: N,
4018
- layerOpt: A,
4090
+ container: L,
4091
+ layerOpt: O,
4019
4092
  master: this.master,
4020
- canvasOpt: W,
4093
+ canvasOpt: A,
4021
4094
  post: this.post,
4022
4095
  viewOwner: this.viewOwnerById.get(a),
4023
4096
  viewGeneration: this.viewGenerationById.get(a)
4024
4097
  });
4025
4098
  this.snapshotThreadsByRequest.set(T, {
4026
- thread: v,
4027
- surface: N
4028
- }), v.on(i).then(() => {
4029
- this.disposeSnapshotThread(T, v);
4030
- }).catch((B) => {
4099
+ thread: W,
4100
+ surface: L
4101
+ }), W.on(i).then(() => {
4102
+ this.disposeSnapshotThread(T, W);
4103
+ }).catch((v) => {
4031
4104
  this.master.Logger.error(
4032
- `[Appliance]: snapshot render failed; viewId=${a}; error=${B instanceof Error ? B.message : String(B)}`
4033
- ), this.disposeSnapshotThread(T, v);
4105
+ `[Appliance]: snapshot render failed; viewId=${a}; error=${v instanceof Error ? v.message : String(v)}`
4106
+ ), this.disposeSnapshotThread(T, W);
4034
4107
  });
4035
4108
  continue;
4036
4109
  }
@@ -4071,37 +4144,37 @@ class pt {
4071
4144
  }
4072
4145
  if (o === h.TasksQueue && (n != null && n.size)) {
4073
4146
  const g = n.get(a), y = this.mainThreadMap.get(a), S = this.viewGenerationById.get(a), T = this.viewOwnerById.get(a);
4074
- let L;
4147
+ let C;
4075
4148
  if (g && y)
4076
4149
  try {
4077
4150
  await this.enqueueViewTask(a, async () => {
4078
4151
  this.viewGenerationById.get(a) !== S || this.viewOwnerById.get(a) !== T || this.mainThreadMap.get(a) !== y || await y.on(g);
4079
4152
  });
4080
- } catch (N) {
4081
- if (g.msgType !== h.UpdateCamera) throw N;
4082
- const A = Pe(N);
4083
- L = {
4084
- code: A ? "RENDERER_BUSINESS_TIMEOUT" : "RENDERER_BUSINESS_ERROR",
4153
+ } catch (L) {
4154
+ if (g.msgType !== h.UpdateCamera) throw L;
4155
+ const O = Ae(L);
4156
+ C = {
4157
+ code: O ? "RENDERER_BUSINESS_TIMEOUT" : "RENDERER_BUSINESS_ERROR",
4085
4158
  business: "updateCamera",
4086
- message: N instanceof Error ? N.message : String(N),
4087
- elapsedMs: A ? N.elapsedMs : void 0,
4088
- stage: A ? N.stage : "update-camera",
4089
- blockingWorks: A ? N.blockingWorks : void 0,
4159
+ message: L instanceof Error ? L.message : String(L),
4160
+ elapsedMs: O ? L.elapsedMs : void 0,
4161
+ stage: O ? L.stage : "update-camera",
4162
+ blockingWorks: O ? L.blockingWorks : void 0,
4090
4163
  workerType: "mainThread"
4091
4164
  };
4092
4165
  }
4093
- if (L && q(d)) {
4166
+ if (C && $(d)) {
4094
4167
  this.post({
4095
4168
  viewId: a,
4096
4169
  viewGeneration: S,
4097
4170
  viewOwner: T,
4098
4171
  cameraTaskId: d,
4099
- cameraTaskStatus: L.code === "RENDERER_BUSINESS_TIMEOUT" ? "timeout" : "failed",
4100
- cameraTaskError: L
4172
+ cameraTaskStatus: C.code === "RENDERER_BUSINESS_TIMEOUT" ? "timeout" : "failed",
4173
+ cameraTaskError: C
4101
4174
  });
4102
4175
  continue;
4103
4176
  }
4104
- c && q(d) && this.post({
4177
+ c && $(d) && this.post({
4105
4178
  workerTasksqueueCount: c,
4106
4179
  cameraTaskId: d,
4107
4180
  viewId: a,
@@ -4110,7 +4183,7 @@ class pt {
4110
4183
  });
4111
4184
  continue;
4112
4185
  }
4113
- if (a === ce) {
4186
+ if (a === de) {
4114
4187
  const g = [...this.mainThreadMap.entries()];
4115
4188
  for (const [y, S] of g) {
4116
4189
  const T = this.enqueueViewTask(y, async () => {
@@ -4135,10 +4208,10 @@ class pt {
4135
4208
  }
4136
4209
  if (!k)
4137
4210
  continue;
4138
- const I = this.viewGenerationById.get(a), R = this.enqueueViewTask(a, async () => {
4211
+ const I = this.viewGenerationById.get(a), E = this.enqueueViewTask(a, async () => {
4139
4212
  this.viewGenerationById.get(a) !== I || this.mainThreadMap.get(a) !== k || await k.on(i);
4140
4213
  });
4141
- o === h.Destroy && (await R, this.mainThreadMap.get(a) === k && this.mainThreadMap.delete(a), this.viewOwnerById.delete(a), this.cameraRenderQueueByView.get(a) === R && this.cameraRenderQueueByView.delete(a), this.viewGenerationById.set(
4214
+ o === h.Destroy && (await E, this.mainThreadMap.get(a) === k && this.mainThreadMap.delete(a), this.viewOwnerById.delete(a), this.cameraRenderQueueByView.get(a) === E && this.cameraRenderQueueByView.delete(a), this.viewGenerationById.set(
4142
4215
  a,
4143
4216
  i.viewGeneration ?? (I || 0) + 1
4144
4217
  ));
@@ -4146,5 +4219,5 @@ class pt {
4146
4219
  }
4147
4220
  }
4148
4221
  export {
4149
- pt as MainThreadManagerImpl
4222
+ ft as MainThreadManagerImpl
4150
4223
  };