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

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 (63) hide show
  1. package/dist/appliance-plugin.js +1 -1
  2. package/dist/appliance-plugin.mjs +12 -12
  3. package/dist/{bridge-GmRa7-tp.js → bridge-CskJoX5M.js} +1 -1
  4. package/dist/{bridge-D30E9dr6.mjs → bridge-rKHCYJ6m.mjs} +1 -1
  5. package/dist/bridge.js +1 -1
  6. package/dist/bridge.mjs +1 -1
  7. package/dist/collector/types.d.ts +3 -0
  8. package/dist/component/textEditor/types.d.ts +5 -0
  9. package/dist/core/mainEngine.d.ts +10 -2
  10. package/dist/core/mainThread/snapshotThread.d.ts +3 -2
  11. package/dist/core/mainThread/subLocalThread.d.ts +5 -2
  12. package/dist/core/mainThread/subServiceThread.d.ts +1 -0
  13. package/dist/core/mainThread/subTopThread.d.ts +2 -2
  14. package/dist/core/tools/arrow.d.ts +423 -1
  15. package/dist/core/tools/base.d.ts +444 -2
  16. package/dist/core/tools/ellipse.d.ts +423 -1
  17. package/dist/core/tools/eraser.d.ts +846 -2
  18. package/dist/core/tools/eraserFaces.d.ts +2 -0
  19. package/dist/core/tools/laserPen.d.ts +846 -2
  20. package/dist/core/tools/pencil.d.ts +848 -2
  21. package/dist/core/tools/pencilEraser.d.ts +1692 -4
  22. package/dist/core/tools/pencilEraserBitMap.d.ts +2115 -5
  23. package/dist/core/tools/polygon.d.ts +423 -1
  24. package/dist/core/tools/rectangle.d.ts +423 -1
  25. package/dist/core/tools/selector.d.ts +2121 -7
  26. package/dist/core/tools/speechBalloon.d.ts +423 -1
  27. package/dist/core/tools/star.d.ts +423 -1
  28. package/dist/core/tools/straight.d.ts +423 -1
  29. package/dist/core/tools/text.d.ts +3 -3
  30. package/dist/core/tools/utils.d.ts +2 -2
  31. package/dist/core/types.d.ts +9 -0
  32. package/dist/core/utils/affineMatrix.d.ts +33 -0
  33. package/dist/core/utils/fontFamily.d.ts +8 -0
  34. package/dist/core/utils/index.d.ts +2 -0
  35. package/dist/core/utils/selectorMatrix.d.ts +4 -0
  36. package/dist/core/utils/selectorRefresh.d.ts +8 -0
  37. package/dist/core/utils/textRaster.d.ts +2 -0
  38. package/dist/core/vNodeManager.d.ts +1 -1
  39. package/dist/core/worker/base.d.ts +1 -1
  40. package/dist/core/worker/fullWorkerLocal.d.ts +1 -0
  41. package/dist/core/worker/fullWorkerService.d.ts +2 -1
  42. package/dist/core/worker/simpleWorker.d.ts +1 -1
  43. package/dist/core/worker/subWorkerTopLayer.d.ts +2 -2
  44. package/dist/fullWorker.js +148 -147
  45. package/dist/index-B0SB7Efu.js +570 -0
  46. package/dist/index-BIVRfc_x.js +570 -0
  47. package/dist/{index-CQuJ6lL1.mjs → index-BbBSxLGe.mjs} +473 -442
  48. package/dist/index-Bzg5OMdP.js +1 -0
  49. package/dist/{index-Ct5ShjRI.js → index-C-tBYq0K.js} +1 -1
  50. package/dist/{index-CatWUcZt.mjs → index-Ca2t53R7.mjs} +1 -1
  51. package/dist/{index-rDe1jjPM.mjs → index-ConirzkM.mjs} +1 -1
  52. package/dist/index-CsNG_bzI.js +1 -0
  53. package/dist/{index-C-pO2InQ.mjs → index-DWevrjrE.mjs} +12001 -11664
  54. package/dist/{index-DYDy0dd5.mjs → index-LcCU1tMV.mjs} +473 -442
  55. package/dist/{index-DGdruTPt.js → index-ZMuKk-bl.js} +1 -1
  56. package/dist/{index-CrJWLjuD.mjs → index-_3yxgNoj.mjs} +19490 -19158
  57. package/dist/plugin/baseApplianceManager.d.ts +2 -2
  58. package/dist/subWorker.js +133 -132
  59. package/package.json +58 -56
  60. package/dist/index-B44Av4kp.js +0 -1
  61. package/dist/index-CKtpWZ9L.js +0 -1
  62. package/dist/index-DLzvL8jo.js +0 -570
  63. package/dist/index-LmgcnMI8.js +0 -570
@@ -1,15 +1,15 @@
1
- var ye = Object.defineProperty;
2
- var we = (M, e, t) => e in M ? ye(M, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : M[e] = t;
3
- var u = (M, e, t) => we(M, typeof e != "symbol" ? e + "" : e, t);
4
- import { D as K, e as b, c as m, r as $, b as R, f as Z, t as V, a as h, h as de, M as ve, i as D, j, k as ke, C as H, l as z, m as Se, n as te, o as Ie, p as se, q as ge, s as Te, u as re, v as ie, w as Y, x as _, E as N, y as ee, z as Q, A as We, B as Re, F as Ee, G as be, H as Le, I as pe, J as ue, T as oe, K as ae, L as Ce, N as Ne, P as fe, Q as me, R as ne, U as Be, S as ce, W as q, X as Oe, V as he, Y as De } from "./index-CrJWLjuD.mjs";
5
- import { cloneDeep as J, xor as Me, isNumber as G, isEqual as le } from "lodash";
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, f as Z, t as V, a as h, h as de, M as ke, i as D, j, k as Se, C as H, l as z, m as Ie, n as te, o as ge, p as se, q as Te, s as We, u as re, v as ie, w as Y, x as _, y as pe, E as C, z as ee, A as Q, B as Re, F as Ee, G as be, H as Le, I as Ne, J as ue, K as fe, T as oe, L as ae, N as Ce, P as Be, Q as me, R as ye, U as ne, W as Oe, X as De, S as ce, Y as q, Z as Me, V as he, _ as Pe } from "./index-_3yxgNoj.mjs";
5
+ import { cloneDeep as J, xor as Ae, isNumber as G, isEqual as le } from "lodash";
6
6
  import "clipper-lib";
7
7
  import "lineclip";
8
- import "rbush";
9
8
  import "xss";
9
+ import "rbush";
10
10
  import "react-dom";
11
11
  import "react";
12
- class Pe {
12
+ class Fe {
13
13
  constructor(e) {
14
14
  u(this, "vNodes");
15
15
  u(this, "thread");
@@ -62,7 +62,7 @@ class Pe {
62
62
  }
63
63
  consumeDraw(e) {
64
64
  const { workId: t, dataType: s } = e;
65
- if (s === R.Service)
65
+ if (s === E.Service)
66
66
  this.activeServiceWorkShape(e);
67
67
  else {
68
68
  const r = t == null ? void 0 : t.toString(), i = r && this.localWorkShapes.get(r);
@@ -209,7 +209,7 @@ class Pe {
209
209
  }
210
210
  consumeDrawAll(e) {
211
211
  const { workId: t, dataType: s } = e;
212
- if (s === R.Service)
212
+ if (s === E.Service)
213
213
  this.activeServiceWorkShape(e);
214
214
  else {
215
215
  const r = t == null ? void 0 : t.toString(), i = r && this.localWorkShapes.get(r);
@@ -223,7 +223,7 @@ class Pe {
223
223
  this.runAnimation();
224
224
  }
225
225
  }
226
- class Ae {
226
+ class xe {
227
227
  constructor(e) {
228
228
  u(this, "vNodes");
229
229
  u(this, "thread");
@@ -237,7 +237,7 @@ class Ae {
237
237
  u(this, "drawWorkActiveId");
238
238
  u(this, "consumeCount", 0);
239
239
  u(this, "combineDrawActiveId");
240
- u(this, "eraserBatchScheduler", new ve());
240
+ u(this, "eraserBatchScheduler", new ke());
241
241
  u(this, "disposeVNodeRevisionObserver");
242
242
  u(this, "bitmapEraserRenderQueue", Promise.resolve());
243
243
  u(this, "bitmapEraserRevalidationQueued", !1);
@@ -295,14 +295,15 @@ class Ae {
295
295
  worker: this
296
296
  })), c = /* @__PURE__ */ new Map();
297
297
  let d;
298
- n != null && n.selectIds && (d = Me(t.selectIds, n.selectIds), n.selectIds.forEach((w) => {
299
- const S = this.vNodes.get(w);
300
- if (S) {
301
- const { toolsType: I, op: W, opt: g } = S;
298
+ n != null && n.selectIds && (d = Ae(t.selectIds, n.selectIds), n.selectIds.forEach((w) => {
299
+ const k = this.vNodes.get(w);
300
+ if (k) {
301
+ const { toolsType: I, op: R, opt: g } = k;
302
302
  c.set(w, {
303
303
  opt: g,
304
304
  toolsType: I,
305
- ops: (W == null ? void 0 : W.length) && j(W) || void 0
305
+ ops: (R == null ? void 0 : R.length) && j(R) || void 0,
306
+ previewMatrix: k.previewMatrix
306
307
  });
307
308
  }
308
309
  }), t.selectIds = n.selectIds);
@@ -336,7 +337,7 @@ class Ae {
336
337
  const t = [];
337
338
  t.push({
338
339
  type: h.Select,
339
- dataType: R.Local,
340
+ dataType: E.Local,
340
341
  selectIds: [],
341
342
  willSyncService: !1
342
343
  }), this.thread.post({ sp: t });
@@ -349,7 +350,7 @@ class Ae {
349
350
  let i;
350
351
  for (const o of this.vNodes.curNodeMap.values()) {
351
352
  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];
352
- if (c === m.Text && ke([l, p], a) && d.workState === b.Done) {
353
+ if (c === m.Text && Se([l, p], a) && d.workState === b.Done) {
353
354
  i = n;
354
355
  break;
355
356
  }
@@ -414,7 +415,7 @@ class Ae {
414
415
  scaleType: t.scaleType,
415
416
  type: h.Select,
416
417
  viewId: this.thread.viewId,
417
- dataType: R.Local,
418
+ dataType: E.Local,
418
419
  selectIds: s,
419
420
  selectRect: c,
420
421
  points: t.getChildrenPoints(),
@@ -448,7 +449,7 @@ class Ae {
448
449
  type: h.TextUpdate,
449
450
  toolsType: m.Text,
450
451
  workId: n,
451
- dataType: R.Local
452
+ dataType: E.Local
452
453
  });
453
454
  break;
454
455
  }
@@ -457,7 +458,7 @@ class Ae {
457
458
  type: h.BackgroundSVGDelete,
458
459
  toolsType: m.BackgroundSVG,
459
460
  workId: n,
460
- dataType: R.Local,
461
+ dataType: E.Local,
461
462
  viewId: this.thread.viewId
462
463
  });
463
464
  break;
@@ -492,7 +493,7 @@ class Ae {
492
493
  type: h.BackgroundSVGDelete,
493
494
  toolsType: m.BackgroundSVG,
494
495
  workId: e,
495
- dataType: R.Local,
496
+ dataType: E.Local,
496
497
  viewId: this.thread.viewId
497
498
  }
498
499
  ]
@@ -519,27 +520,27 @@ class Ae {
519
520
  }
520
521
  }
521
522
  async consumeFull(e) {
522
- var o, a;
523
+ var o, a, n;
523
524
  const t = (o = e.workId) == null ? void 0 : o.toString(), s = (a = e.updateNodeOpt) == null ? void 0 : a.eraserGeometryDelta;
524
525
  if (t) {
525
- const n = this.vNodes.get(t), c = e.ops && V(e.ops) || e.op || [];
526
+ const c = this.vNodes.get(t), d = e.ops && V(e.ops) || e.op || [];
526
527
  if (s) {
527
- if (!n || !e.centerPos || !Se(
528
+ if (!c || !e.centerPos || !Ie(
528
529
  this.vNodes,
529
530
  t,
530
531
  s,
531
- n,
532
- { op: c, centerPos: e.centerPos }
532
+ c,
533
+ { op: d, centerPos: e.centerPos }
533
534
  )) {
534
535
  te(this.vNodes, t);
535
536
  return;
536
537
  }
537
- } else n && e.centerPos && Ie(this.vNodes, t) && se(n.op, n.centerPos) !== se(c, e.centerPos) && te(this.vNodes, t);
538
+ } else c && e.centerPos && ge(this.vNodes, t) && se(c.op, c.centerPos) !== se(d, e.centerPos) && te(this.vNodes, t);
538
539
  }
539
540
  const r = this.setFullWork(e), i = e.ops && V(e.ops);
540
541
  if (r) {
541
- t && e.clearPreviewLocalWork && this.thread.localLayer.getElementsByName(t).forEach((c) => {
542
- c.remove(), z(c, this.thread.localLayer.parent);
542
+ if (t && e.clearPreviewLocalWork && this.thread.localLayer.getElementsByName(t).forEach((d) => {
543
+ d.remove(), z(d, this.thread.localLayer.parent);
543
544
  }), r.toolsType === m.BackgroundSVG ? r.consumeService({
544
545
  isFullWork: !0,
545
546
  replaceId: t
@@ -555,9 +556,18 @@ class Ae {
555
556
  op: i,
556
557
  isFullWork: !0,
557
558
  replaceId: t
558
- }), e != null && e.updateNodeOpt && r.updataOptService(e.updateNodeOpt);
559
- const n = [];
560
- e.workId && this.workShapes.delete(e.workId.toString()), e.willSyncService && n.push({
559
+ }), t && ((n = e.opt) != null && n.matrix) && e.opt.matrix.some(
560
+ (d, l) => d !== [1, 0, 0, 1, 0, 0][l]
561
+ )) {
562
+ const d = this.vNodes.getNodeRectFormShape(
563
+ t,
564
+ this.vNodes.get(t)
565
+ );
566
+ d && this.vNodes.setInfo(t, { rect: d });
567
+ }
568
+ e != null && e.updateNodeOpt && r.updataOptService(e.updateNodeOpt);
569
+ const c = [];
570
+ e.workId && this.workShapes.delete(e.workId.toString()), e.willSyncService && c.push({
561
571
  opt: e.opt,
562
572
  toolsType: e.toolsType,
563
573
  type: h.FullWork,
@@ -569,17 +579,17 @@ class Ae {
569
579
  requestId: e.requestId,
570
580
  emitEventType: e.emitEventType,
571
581
  scenePath: e.scenePath
572
- }), e.isLockSentEventCursor && n.push({
582
+ }), e.isLockSentEventCursor && c.push({
573
583
  type: h.None,
574
584
  isLockSentEventCursor: !0,
575
585
  scenePath: e.scenePath
576
- }), e.needUndoTicker && n.push({
586
+ }), e.needUndoTicker && c.push({
577
587
  type: h.None,
578
588
  needUndoTicker: e.needUndoTicker,
579
589
  emitEventType: e.emitEventType,
580
590
  requestId: e.requestId,
581
591
  scenePath: e.scenePath
582
- }), n.length && this.thread.post({ sp: n });
592
+ }), c.length && this.thread.post({ sp: c });
583
593
  }
584
594
  }
585
595
  async colloctEffectSelectWork(e) {
@@ -745,7 +755,7 @@ class Ae {
745
755
  for (const [p, f] of i)
746
756
  l.push({
747
757
  type: h.UpdateNode,
748
- dataType: R.Local,
758
+ dataType: E.Local,
749
759
  opt: f.opt,
750
760
  workId: p,
751
761
  updateNodeOpt: {
@@ -793,7 +803,7 @@ class Ae {
793
803
  for (const [d, l] of i)
794
804
  c.push({
795
805
  type: h.FullWork,
796
- dataType: R.Local,
806
+ dataType: E.Local,
797
807
  toolsType: l.toolsType,
798
808
  ops: j(l.op),
799
809
  opt: l.opt,
@@ -851,7 +861,7 @@ class Ae {
851
861
  scenePath: i,
852
862
  viewId: this.thread.viewId,
853
863
  msgType: h.DrawWork,
854
- dataType: R.Local
864
+ dataType: E.Local
855
865
  },
856
866
  t
857
867
  );
@@ -862,7 +872,7 @@ class Ae {
862
872
  scenePath: i,
863
873
  viewId: this.thread.viewId,
864
874
  msgType: h.DrawWork,
865
- dataType: R.Local
875
+ dataType: E.Local
866
876
  },
867
877
  t
868
878
  ), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && n !== D && (this.drawWorkActiveId = n), G(o) && (this.consumeCount = o), d) {
@@ -896,7 +906,7 @@ class Ae {
896
906
  e.needUndoTicker,
897
907
  e.collectUndoTicker
898
908
  );
899
- }, ge(this.thread.master.maxCombineEraserTime));
909
+ }, Te(this.thread.master.maxCombineEraserTime));
900
910
  break;
901
911
  }
902
912
  case m.BitMapEraser: {
@@ -975,14 +985,14 @@ class Ae {
975
985
  if (i || r) {
976
986
  const p = i == null ? void 0 : i.willDeleteNodes, f = i == null ? void 0 : i.willNewNodes, w = [
977
987
  ...p ? Array.from(p) : []
978
- ], S = {
988
+ ], k = {
979
989
  render: [],
980
990
  sp: [],
981
991
  ...r
982
992
  };
983
993
  if (i != null && i.rect) {
984
- const I = Te(i.rect);
985
- (a = S.render) == null || a.push(
994
+ const I = We(i.rect);
995
+ (a = k.render) == null || a.push(
986
996
  {
987
997
  rect: I,
988
998
  isClear: !0,
@@ -998,25 +1008,25 @@ class Ae {
998
1008
  }
999
1009
  );
1000
1010
  }
1001
- if (s && w.length && ((n = this.getWorkShape(e)) == null ? void 0 : n.toolsType) === m.BitMapEraser && ((c = S.sp) == null || c.push({
1011
+ if (s && w.length && ((n = this.getWorkShape(e)) == null ? void 0 : n.toolsType) === m.BitMapEraser && ((c = k.sp) == null || c.push({
1002
1012
  type: h.None,
1003
1013
  collectUndoTicker: s,
1004
1014
  undoScopeIds: w,
1005
1015
  undoScopePhase: "collect"
1006
- })), p != null && p.size && ((d = S.sp) == null || d.push({
1016
+ })), p != null && p.size && ((d = k.sp) == null || d.push({
1007
1017
  type: h.RemoveNode,
1008
1018
  removeIds: [...p],
1009
1019
  viewId: this.thread.viewId,
1010
1020
  needUndoTicker: t,
1011
1021
  collectUndoTicker: s
1012
1022
  })), f != null && f.size)
1013
- for (const [I, W] of f)
1014
- (l = S.sp) == null || l.push({
1023
+ for (const [I, R] of f)
1024
+ (l = k.sp) == null || l.push({
1015
1025
  type: h.FullWork,
1016
- dataType: R.Local,
1017
- toolsType: W.toolsType,
1018
- ops: j(W.op),
1019
- opt: W.opt,
1026
+ dataType: E.Local,
1027
+ toolsType: R.toolsType,
1028
+ ops: j(R.op),
1029
+ opt: R.opt,
1020
1030
  workId: I,
1021
1031
  updateNodeOpt: {
1022
1032
  useAnimation: !1
@@ -1024,7 +1034,7 @@ class Ae {
1024
1034
  needUndoTicker: t,
1025
1035
  collectUndoTicker: s
1026
1036
  });
1027
- i != null && i.rect && await this.thread.fullLayer.parent.prepareRender, this.thread.post(S);
1037
+ i != null && i.rect && await this.thread.fullLayer.parent.prepareRender, this.thread.post(k);
1028
1038
  }
1029
1039
  }
1030
1040
  async consumeDrawAll(e, t) {
@@ -1042,23 +1052,23 @@ class Ae {
1042
1052
  if (p === m.LaserPen)
1043
1053
  return;
1044
1054
  p === m.BitMapEraser && await this.bitmapEraserRenderQueue;
1045
- const f = this.workShapes.get(H), w = (a = f == null ? void 0 : f.selectIds) == null ? void 0 : a[0], S = await l.consumeAll({ data: e, workerEngine: this });
1055
+ 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 });
1046
1056
  switch (p) {
1047
1057
  case m.Selector:
1048
1058
  {
1049
- S.selectIds && w && ((n = S.selectIds) != null && n.includes(w)) && f.cursorBlur();
1059
+ k.selectIds && w && ((n = k.selectIds) != null && n.includes(w)) && f.cursorBlur();
1050
1060
  const I = [];
1051
1061
  i && I.push({
1052
1062
  type: h.None,
1053
1063
  isLockSentEventCursor: i,
1054
1064
  scenePath: r
1055
- }), S.type === h.Select && (S.selectIds && t.runReverseSelectWork(S.selectIds), I.push({ ...S, scenePath: r })), I.length && this.thread.post({ sp: I }), (c = l.selectIds) != null && c.length ? l.clearTmpPoints() : this.clearWorkShapeNodeCache(d);
1065
+ }), k.type === h.Select && (k.selectIds && t.runReverseSelectWork(k.selectIds), I.push({ ...k, scenePath: r })), I.length && this.thread.post({ sp: I }), (c = l.selectIds) != null && c.length ? l.clearTmpPoints() : this.clearWorkShapeNodeCache(d);
1056
1066
  }
1057
1067
  break;
1058
1068
  case m.PencilEraser:
1059
1069
  await this.drawPencilEraserFull(
1060
1070
  l,
1061
- S,
1071
+ k,
1062
1072
  i,
1063
1073
  o
1064
1074
  ), this.fullWorkerDrawCount = 0, this.clearWorkShapeNodeCache(d);
@@ -1066,14 +1076,14 @@ class Ae {
1066
1076
  case m.BitMapEraser:
1067
1077
  await this.drawBitMapEraserFull(
1068
1078
  l,
1069
- S,
1079
+ k,
1070
1080
  i,
1071
1081
  o
1072
1082
  ), this.fullWorkerDrawCount = 0, this.clearWorkShapeNodeCache(d);
1073
1083
  break;
1074
1084
  case m.Eraser:
1075
1085
  await this.drawEraser(
1076
- { ...S, scenePath: r },
1086
+ { ...k, scenePath: r },
1077
1087
  i,
1078
1088
  o,
1079
1089
  e.collectUndoTicker
@@ -1092,17 +1102,17 @@ class Ae {
1092
1102
  type: h.None,
1093
1103
  isLockSentEventCursor: i,
1094
1104
  scenePath: r
1095
- }), S) {
1096
- const g = p === m.Pencil && S.type === h.RemoveNode;
1105
+ }), k) {
1106
+ const g = p === m.Pencil && k.type === h.RemoveNode;
1097
1107
  g ? $(
1098
1108
  this.thread.localLayer,
1099
1109
  this.thread.localLayer.parent
1100
1110
  ) : I.push({
1101
- ...S,
1111
+ ...k,
1102
1112
  scenePath: r,
1103
1113
  needUndoTicker: e.needUndoTicker,
1104
- undoScopeIds: S.undoScopeIds || (S.workId !== void 0 ? [S.workId.toString()] : void 0),
1105
- undoScopePhase: S.undoScopePhase || "finalize"
1114
+ undoScopeIds: k.undoScopeIds || (k.workId !== void 0 ? [k.workId.toString()] : void 0),
1115
+ undoScopePhase: k.undoScopePhase || "finalize"
1106
1116
  }), this.fullWorkerDrawCount = 0, e.needUndoTicker && I.push({
1107
1117
  type: h.None,
1108
1118
  needUndoTicker: e.needUndoTicker,
@@ -1154,7 +1164,7 @@ class Ae {
1154
1164
  );
1155
1165
  }
1156
1166
  }
1157
- class Fe {
1167
+ class Ue {
1158
1168
  constructor(e) {
1159
1169
  u(this, "vNodes");
1160
1170
  u(this, "thread");
@@ -1274,45 +1284,45 @@ class Fe {
1274
1284
  );
1275
1285
  }
1276
1286
  async animationDraw() {
1277
- var r, i, o, a, n, c, d, l, p, f, w, S, I, W, g, y, v, T, C, L, A;
1287
+ var r, i, o, a, n, c, d, l, p, f, w, k, I, R, g, y, S, T, L, N, A;
1278
1288
  let e = !1;
1279
1289
  const t = /* @__PURE__ */ new Map(), s = [];
1280
- for (const [E, k] of this.workShapes.entries())
1281
- switch (k.toolsType) {
1290
+ for (const [W, v] of this.workShapes.entries())
1291
+ switch (v.toolsType) {
1282
1292
  case m.BackgroundSVG: {
1283
- (r = k.node) == null || r.consumeService({
1293
+ (r = v.node) == null || r.consumeService({
1284
1294
  isFullWork: !0,
1285
- replaceId: E
1286
- }), this.selectorWorkShapes.forEach((B, O) => {
1295
+ replaceId: W
1296
+ }), this.syncMatrixRect(W, v.node), this.selectorWorkShapes.forEach((B, O) => {
1287
1297
  var P;
1288
- (P = B.selectIds) != null && P.includes(E) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1289
- }), this.workShapes.delete(E);
1298
+ (P = B.selectIds) != null && P.includes(W) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1299
+ }), this.workShapes.delete(W);
1290
1300
  break;
1291
1301
  }
1292
1302
  case m.Image: {
1293
- await ((i = k.node) == null ? void 0 : i.consumeServiceAsync({
1303
+ await ((i = v.node) == null ? void 0 : i.consumeServiceAsync({
1294
1304
  isFullWork: !0,
1295
1305
  worker: this
1296
- })), this.selectorWorkShapes.forEach((B, O) => {
1306
+ })), this.syncMatrixRect(W, v.node), this.selectorWorkShapes.forEach((B, O) => {
1297
1307
  var P;
1298
- (P = B.selectIds) != null && P.includes(E) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1299
- }), this.workShapes.delete(E);
1308
+ (P = B.selectIds) != null && P.includes(W) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1309
+ }), this.workShapes.delete(W);
1300
1310
  break;
1301
1311
  }
1302
1312
  case m.Text: {
1303
- k.node && (await ((o = k.node) == null ? void 0 : o.consumeServiceAsync({
1313
+ v.node && (await ((o = v.node) == null ? void 0 : o.consumeServiceAsync({
1304
1314
  isFullWork: !0,
1305
- replaceId: E,
1315
+ replaceId: W,
1306
1316
  boxRect: this.thread.getSceneRect()
1307
- })), this.selectorWorkShapes.forEach((B, O) => {
1317
+ })), this.syncMatrixRect(W, v.node), this.selectorWorkShapes.forEach((B, O) => {
1308
1318
  var P;
1309
- (P = B.selectIds) != null && P.includes(E) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1310
- }), k.refreshTextRender && k.requestId && s.push({
1319
+ (P = B.selectIds) != null && P.includes(W) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1320
+ }), v.refreshTextRender && v.requestId && s.push({
1311
1321
  type: h.RefreshTextRender,
1312
- requestId: k.requestId,
1313
- workId: E,
1322
+ requestId: v.requestId,
1323
+ workId: W,
1314
1324
  viewId: this.thread.viewId
1315
- }), (a = k.node) == null || a.clearTmpPoints(), this.workShapes.delete(E));
1325
+ }), (a = v.node) == null || a.clearTmpPoints(), this.workShapes.delete(W));
1316
1326
  break;
1317
1327
  }
1318
1328
  case m.Arrow:
@@ -1322,60 +1332,60 @@ class Fe {
1322
1332
  case m.Star:
1323
1333
  case m.Polygon:
1324
1334
  case m.SpeechBalloon: {
1325
- const B = !!k.ops;
1326
- if ((n = k.animationWorkData) != null && n.length) {
1327
- const O = k.oldRect;
1328
- (c = k.node) == null || c.consumeService({
1329
- op: k.animationWorkData,
1335
+ const B = !!v.ops;
1336
+ if ((n = v.animationWorkData) != null && n.length) {
1337
+ const O = v.oldRect;
1338
+ (c = v.node) == null || c.consumeService({
1339
+ op: v.animationWorkData,
1330
1340
  isFullWork: B
1331
- }), B && (this.selectorWorkShapes.forEach((P, F) => {
1332
- var U;
1333
- (U = P.selectIds) != null && U.includes(E) && (this.willRunEffectSelectorIds.add(F), this.runEffect());
1334
- }), (d = k.node) == null || d.clearTmpPoints(), this.workShapes.delete(E)), k.isEnableCursor ? t.set(E, {
1335
- cursorTool: _(k.toolsType),
1336
- workState: O ? k.ops ? b.Done : b.Doing : b.Start,
1337
- op: k.animationWorkData.slice(-3, -1)
1338
- }) : B && !k.useAnimation && ((l = k.updateNodeOpt) != null && l.useAnimation) && t.set(E, {
1339
- cursorTool: _(k.toolsType),
1341
+ }), B && this.syncMatrixRect(W, v.node), B && (this.selectorWorkShapes.forEach((P, F) => {
1342
+ var x;
1343
+ (x = P.selectIds) != null && x.includes(W) && (this.willRunEffectSelectorIds.add(F), this.runEffect());
1344
+ }), (d = v.node) == null || d.clearTmpPoints(), this.workShapes.delete(W)), v.isEnableCursor ? t.set(W, {
1345
+ cursorTool: _(v.toolsType),
1346
+ workState: O ? v.ops ? b.Done : b.Doing : b.Start,
1347
+ op: v.animationWorkData.slice(-3, -1)
1348
+ }) : B && !v.useAnimation && ((l = v.updateNodeOpt) != null && l.useAnimation) && t.set(W, {
1349
+ cursorTool: _(v.toolsType),
1340
1350
  workState: b.Done,
1341
- op: k.animationWorkData.slice(-3, -1),
1342
- uid: (p = k.updateNodeOpt) == null ? void 0 : p.uid
1343
- }), k.animationWorkData.length = 0;
1351
+ op: v.animationWorkData.slice(-3, -1),
1352
+ uid: (p = v.updateNodeOpt) == null ? void 0 : p.uid
1353
+ }), v.animationWorkData.length = 0;
1344
1354
  }
1345
1355
  break;
1346
1356
  }
1347
1357
  case m.Pencil: {
1348
- if (k.useAnimation) {
1349
- if (k.useAnimation) {
1350
- if (k.isDel) {
1351
- (y = k.node) == null || y.clearTmpPoints(), this.workShapes.delete(E);
1358
+ if (v.useAnimation) {
1359
+ if (v.useAnimation) {
1360
+ if (v.isDel) {
1361
+ (y = v.node) == null || y.clearTmpPoints(), this.workShapes.delete(W);
1352
1362
  break;
1353
1363
  }
1354
1364
  const B = 3, O = this.computNextAnimationIndex(
1355
- k,
1365
+ v,
1356
1366
  B
1357
- ), P = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - B), F = (k.animationWorkData || []).slice(
1367
+ ), P = v.isDiff ? 0 : Math.max(0, (v.animationIndex || 0) - B), F = (v.animationWorkData || []).slice(
1358
1368
  P,
1359
1369
  O
1360
- ), U = (T = (v = k.node) == null ? void 0 : v.getWorkId()) == null ? void 0 : T.toString();
1361
- if ((k.animationIndex || 0) < O || k.isDiff) {
1362
- if ((C = k.node) == null || C.consumeService({
1370
+ ), x = (T = (S = v.node) == null ? void 0 : S.getWorkId()) == null ? void 0 : T.toString();
1371
+ if ((v.animationIndex || 0) < O || v.isDiff) {
1372
+ if ((L = v.node) == null || L.consumeService({
1363
1373
  op: F,
1364
1374
  isFullWork: !1
1365
- }), k.animationIndex = O, k.isDiff && (k.isDiff = !1), F.length && k.isEnableCursor) {
1375
+ }), v.animationIndex = O, v.isDiff && (v.isDiff = !1), F.length && v.isEnableCursor) {
1366
1376
  const X = F.slice(-3, -1);
1367
- t.set(E, {
1368
- cursorTool: _(k.toolsType),
1369
- workState: P === 0 ? b.Start : O === ((L = k.animationWorkData) == null ? void 0 : L.length) ? b.Done : b.Doing,
1377
+ t.set(W, {
1378
+ cursorTool: _(v.toolsType),
1379
+ workState: P === 0 ? b.Start : O === ((N = v.animationWorkData) == null ? void 0 : N.length) ? b.Done : b.Doing,
1370
1380
  op: X
1371
1381
  });
1372
1382
  }
1373
- } else k.ops && ((A = k.node) == null || A.consumeService({
1374
- op: k.animationWorkData || [],
1383
+ } else v.ops && ((A = v.node) == null || A.consumeService({
1384
+ op: v.animationWorkData || [],
1375
1385
  isFullWork: !0,
1376
- replaceId: U
1377
- }), k.isDel = !0, k.isEnableCursor && t.set(E, {
1378
- cursorTool: _(k.toolsType),
1386
+ replaceId: x
1387
+ }), this.syncMatrixRect(x || W, v.node), v.isDel = !0, v.isEnableCursor && t.set(W, {
1388
+ cursorTool: _(v.toolsType),
1379
1389
  workState: b.Done,
1380
1390
  op: F.slice(-3, -1)
1381
1391
  }));
@@ -1383,37 +1393,37 @@ class Fe {
1383
1393
  break;
1384
1394
  }
1385
1395
  } else {
1386
- const B = !!k.ops;
1387
- if ((f = k.node) == null || f.consumeService({
1388
- op: k.animationWorkData || [],
1396
+ const B = !!v.ops;
1397
+ if ((f = v.node) == null || f.consumeService({
1398
+ op: v.animationWorkData || [],
1389
1399
  isFullWork: B,
1390
- replaceId: E
1391
- }), (w = k.node) == null || w.updataOptService(k.updateNodeOpt), B) {
1392
- if (!k.isEnableCursor && ((S = k.updateNodeOpt) != null && S.useAnimation) && ((I = k.animationWorkData) != null && I.length)) {
1393
- const O = k.animationWorkData.slice(-3, -1);
1394
- t.set(E, {
1395
- cursorTool: _(k.toolsType),
1400
+ replaceId: W
1401
+ }), (w = v.node) == null || w.updataOptService(v.updateNodeOpt), B) {
1402
+ if (this.syncMatrixRect(W, v.node), !v.isEnableCursor && ((k = v.updateNodeOpt) != null && k.useAnimation) && ((I = v.animationWorkData) != null && I.length)) {
1403
+ const O = v.animationWorkData.slice(-3, -1);
1404
+ t.set(W, {
1405
+ cursorTool: _(v.toolsType),
1396
1406
  workState: b.Done,
1397
1407
  op: O,
1398
- uid: (W = k.updateNodeOpt) == null ? void 0 : W.uid
1408
+ uid: (R = v.updateNodeOpt) == null ? void 0 : R.uid
1399
1409
  });
1400
1410
  }
1401
1411
  this.selectorWorkShapes.forEach((O, P) => {
1402
1412
  var F;
1403
- (F = O.selectIds) != null && F.includes(E) && (this.willRunEffectSelectorIds.add(P), this.runEffect());
1404
- }), (g = k.node) == null || g.clearTmpPoints(), this.workShapes.delete(E);
1413
+ (F = O.selectIds) != null && F.includes(W) && (this.willRunEffectSelectorIds.add(P), this.runEffect());
1414
+ }), (g = v.node) == null || g.clearTmpPoints(), this.workShapes.delete(W);
1405
1415
  }
1406
1416
  }
1407
1417
  break;
1408
1418
  }
1409
1419
  }
1410
- e && this.runAnimation(), t.size && t.forEach((E, k) => {
1420
+ e && this.runAnimation(), t.size && t.forEach((W, v) => {
1411
1421
  s.push({
1412
1422
  type: h.Cursor,
1413
- uid: E.uid || k.split(de)[0],
1414
- op: E.op,
1415
- workState: E.workState,
1416
- cursorTool: E.cursorTool,
1423
+ uid: W.uid || v.split(de)[0],
1424
+ op: W.op,
1425
+ workState: W.workState,
1426
+ cursorTool: W.cursorTool,
1417
1427
  viewId: this.thread.viewId
1418
1428
  });
1419
1429
  }), s.length && this.thread.post({ sp: s });
@@ -1444,8 +1454,20 @@ class Fe {
1444
1454
  }
1445
1455
  return !1;
1446
1456
  }
1457
+ syncMatrixRect(e, t) {
1458
+ const s = t == null ? void 0 : t.getWorkOptions().matrix;
1459
+ if (!s || pe(s).every(
1460
+ (i, o) => i === [1, 0, 0, 1, 0, 0][o]
1461
+ ))
1462
+ return;
1463
+ const r = this.vNodes.getNodeRectFormShape(
1464
+ e,
1465
+ this.vNodes.get(e)
1466
+ );
1467
+ r && this.vNodes.setInfo(e, { rect: r });
1468
+ }
1447
1469
  activeWorkShape(e) {
1448
- var W, g, y, v;
1470
+ var R, g, y, S;
1449
1471
  const {
1450
1472
  workId: t,
1451
1473
  opt: s,
@@ -1462,7 +1484,7 @@ class Fe {
1462
1484
  } = e;
1463
1485
  if (!t)
1464
1486
  return;
1465
- const w = t.toString(), S = (W = this.vNodes.get(w)) == null ? void 0 : W.rect;
1487
+ const w = t.toString(), k = (R = this.vNodes.get(w)) == null ? void 0 : R.rect;
1466
1488
  if (!((g = this.workShapes) != null && g.has(w))) {
1467
1489
  let T = {
1468
1490
  toolsType: r,
@@ -1472,19 +1494,19 @@ class Fe {
1472
1494
  updateNodeOpt: o,
1473
1495
  ops: a,
1474
1496
  useAnimation: typeof c < "u" ? c : typeof (o == null ? void 0 : o.useAnimation) < "u" ? o == null ? void 0 : o.useAnimation : !0,
1475
- oldRect: S,
1497
+ oldRect: k,
1476
1498
  isDiff: !1,
1477
1499
  imageBitmap: d,
1478
1500
  isEnableCursor: l
1479
1501
  };
1480
1502
  r && s && (T = this.setNodeKey(w, T, r, s)), (y = this.workShapes) == null || y.set(w, T);
1481
1503
  }
1482
- const I = (v = this.workShapes) == null ? void 0 : v.get(w);
1504
+ const I = (S = this.workShapes) == null ? void 0 : S.get(w);
1483
1505
  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(
1484
1506
  I.animationWorkData || [],
1485
1507
  n,
1486
1508
  I.toolsType
1487
- ), I.toolsType, m.Pencil, I.animationWorkData = n), I.node && I.node.getWorkId() !== w && I.node.setWorkId(w), S && (I.oldRect = S), 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);
1509
+ ), 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);
1488
1510
  }
1489
1511
  removeNode(e, t) {
1490
1512
  e.indexOf(D) > -1 && this.removeSelectWork(t), this.thread.fullLayer.getElementsByName(e).forEach((r) => {
@@ -1499,7 +1521,7 @@ class Fe {
1499
1521
  type: h.BackgroundSVGDelete,
1500
1522
  toolsType: m.BackgroundSVG,
1501
1523
  workId: e,
1502
- dataType: R.Service,
1524
+ dataType: E.Service,
1503
1525
  viewId: this.thread.viewId
1504
1526
  }
1505
1527
  ]
@@ -1541,7 +1563,7 @@ class Fe {
1541
1563
  ), t;
1542
1564
  }
1543
1565
  }
1544
- class x {
1566
+ class U {
1545
1567
  constructor() {
1546
1568
  u(this, "localWork");
1547
1569
  u(this, "serviceWork");
@@ -1551,14 +1573,14 @@ class x {
1551
1573
  return this.threadEngine = e, this.localWork = e.localWork, this.serviceWork = e.serviceWork, this;
1552
1574
  }
1553
1575
  }
1554
- class Ue extends x {
1576
+ class Ge extends U {
1555
1577
  constructor() {
1556
1578
  super(...arguments);
1557
- u(this, "emitEventType", N.CopyNode);
1579
+ u(this, "emitEventType", C.CopyNode);
1558
1580
  }
1559
1581
  async consume(t) {
1560
1582
  const { msgType: s, dataType: r, emitEventType: i } = t;
1561
- if (s === h.FullWork && r === R.Local && i === this.emitEventType)
1583
+ if (s === h.FullWork && r === E.Local && i === this.emitEventType)
1562
1584
  return await this.consumeForLocalWorker(t), !0;
1563
1585
  }
1564
1586
  async consumeForLocalWorker(t) {
@@ -1567,14 +1589,14 @@ class Ue extends x {
1567
1589
  s && await ((r = this.localWork) == null ? void 0 : r.consumeFull(t));
1568
1590
  }
1569
1591
  }
1570
- class xe extends x {
1592
+ class qe extends U {
1571
1593
  constructor() {
1572
1594
  super(...arguments);
1573
- u(this, "emitEventType", N.SetColorNode);
1595
+ u(this, "emitEventType", C.SetColorNode);
1574
1596
  }
1575
1597
  async consume(t) {
1576
1598
  const { msgType: s, dataType: r, emitEventType: i } = t;
1577
- if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
1599
+ if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
1578
1600
  return await this.consumeForLocalWorker(t), !0;
1579
1601
  }
1580
1602
  async consumeForLocalWorker(t) {
@@ -1616,7 +1638,7 @@ class xe extends x {
1616
1638
  ...w,
1617
1639
  workId: f,
1618
1640
  type: h.TextUpdate,
1619
- dataType: R.Local,
1641
+ dataType: E.Local,
1620
1642
  willSyncService: !0,
1621
1643
  emitEventType: l,
1622
1644
  requestId: d,
@@ -1641,14 +1663,14 @@ class xe extends x {
1641
1663
  };
1642
1664
  }
1643
1665
  }
1644
- class Ge extends x {
1666
+ class ze extends U {
1645
1667
  constructor() {
1646
1668
  super(...arguments);
1647
- u(this, "emitEventType", N.ZIndexNode);
1669
+ u(this, "emitEventType", C.ZIndexNode);
1648
1670
  }
1649
1671
  async consume(t) {
1650
1672
  const { msgType: s, dataType: r, emitEventType: i } = t;
1651
- if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
1673
+ if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
1652
1674
  return await this.consumeForLocalWorker(t), !0;
1653
1675
  }
1654
1676
  async consumeForLocalWorker(t) {
@@ -1687,7 +1709,7 @@ class Ge extends x {
1687
1709
  ...f,
1688
1710
  workId: p,
1689
1711
  type: h.BackgroundSVGUpdate,
1690
- dataType: R.Local,
1712
+ dataType: E.Local,
1691
1713
  updateNodeOpt: {
1692
1714
  useAnimation: !1
1693
1715
  },
@@ -1714,19 +1736,19 @@ class Ge extends x {
1714
1736
  };
1715
1737
  }
1716
1738
  }
1717
- class qe extends x {
1739
+ class Ve extends U {
1718
1740
  constructor() {
1719
1741
  super(...arguments);
1720
- u(this, "emitEventType", N.TranslateNode);
1742
+ u(this, "emitEventType", C.TranslateNode);
1721
1743
  u(this, "updateSelectorCallback", (t) => {
1722
- var W;
1744
+ var R;
1723
1745
  const { param: s, postData: r, newServiceStore: i, workShapeNode: o, res: a, smoothSync: n } = t, {
1724
1746
  willSyncService: c,
1725
1747
  isSync: d,
1726
1748
  updateSelectorOpt: l,
1727
1749
  textUpdateForWoker: p,
1728
1750
  needUndoTicker: f
1729
- } = s, w = l.workState, S = r.sp || [];
1751
+ } = s, w = l.workState, k = r.sp || [];
1730
1752
  if (w === b.Start)
1731
1753
  return {
1732
1754
  sp: [
@@ -1741,7 +1763,7 @@ class qe extends x {
1741
1763
  const I = a == null ? void 0 : a.selectRect;
1742
1764
  if (c) {
1743
1765
  const g = w === b.Done ? f : void 0;
1744
- S.push({
1766
+ k.push({
1745
1767
  type: h.Select,
1746
1768
  selectIds: o.selectIds,
1747
1769
  selectRect: I,
@@ -1757,34 +1779,34 @@ class qe extends x {
1757
1779
  useAnimation: l.useAnimation || !1
1758
1780
  };
1759
1781
  l.uid && (y.uid = l.uid);
1760
- for (const [v, T] of i.entries())
1761
- T.toolsType === m.BackgroundSVG && S.push({
1782
+ for (const [S, T] of i.entries())
1783
+ T.toolsType === m.BackgroundSVG && k.push({
1762
1784
  ...T,
1763
- workId: v,
1785
+ workId: S,
1764
1786
  type: h.BackgroundSVGUpdate,
1765
- dataType: R.Local,
1787
+ dataType: E.Local,
1766
1788
  willSyncService: w === b.Done ? !0 : n,
1767
1789
  updateNodeOpt: y,
1768
1790
  needUndoTicker: g,
1769
1791
  emitEventType: this.emitEventType
1770
- }), p && T.toolsType === m.Text ? S.push({
1792
+ }), p && T.toolsType === m.Text ? k.push({
1771
1793
  ...T,
1772
- workId: v,
1794
+ workId: S,
1773
1795
  type: h.TextUpdate,
1774
- dataType: R.Local,
1796
+ dataType: E.Local,
1775
1797
  willSyncService: w === b.Done ? !0 : n,
1776
1798
  updateNodeOpt: y,
1777
1799
  needUndoTicker: g,
1778
1800
  emitEventType: this.emitEventType
1779
- }) : (n || w === b.Done) && S.push({
1801
+ }) : (n || w === b.Done) && k.push({
1780
1802
  ...T,
1781
- workId: v,
1803
+ workId: S,
1782
1804
  type: h.UpdateNode,
1783
1805
  updateNodeOpt: {
1784
1806
  ...y,
1785
1807
  eraserGeometryDelta: ee(
1786
- (W = this.localWork) == null ? void 0 : W.vNodes,
1787
- v
1808
+ (R = this.localWork) == null ? void 0 : R.vNodes,
1809
+ S
1788
1810
  )
1789
1811
  },
1790
1812
  isSync: d,
@@ -1792,21 +1814,21 @@ class qe extends x {
1792
1814
  emitEventType: this.emitEventType
1793
1815
  });
1794
1816
  }
1795
- return f && S.push({
1817
+ return f && k.push({
1796
1818
  type: h.None,
1797
1819
  needUndoTicker: f
1798
- }), S.push({
1820
+ }), k.push({
1799
1821
  type: h.SelectorTransform,
1800
1822
  emitEventType: this.emitEventType,
1801
1823
  workState: w
1802
1824
  }), {
1803
- sp: S
1825
+ sp: k
1804
1826
  };
1805
1827
  });
1806
1828
  }
1807
1829
  async consume(t) {
1808
1830
  const { msgType: s, dataType: r, emitEventType: i } = t;
1809
- if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
1831
+ if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
1810
1832
  return await this.consumeForLocalWorker(t), !0;
1811
1833
  }
1812
1834
  async consumeForLocalWorker(t) {
@@ -1836,13 +1858,13 @@ class qe extends x {
1836
1858
  })) : r.workState === b.Done && ((f = this.localWork) == null || f.vNodes.deleteLastTarget()));
1837
1859
  }
1838
1860
  }
1839
- class ze extends x {
1861
+ class $e extends U {
1840
1862
  constructor() {
1841
1863
  super(...arguments);
1842
- u(this, "emitEventType", N.ScaleNode);
1864
+ u(this, "emitEventType", C.ScaleNode);
1843
1865
  u(this, "updateSelectorCallback", (t) => {
1844
1866
  var I;
1845
- 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, S = p === b.Done ? l : void 0;
1867
+ 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;
1846
1868
  if (p === b.Start)
1847
1869
  return {
1848
1870
  sp: [
@@ -1864,42 +1886,42 @@ class ze extends x {
1864
1886
  points: p === b.Done && i.getChildrenPoints() || void 0,
1865
1887
  textOpt: i.textOpt
1866
1888
  });
1867
- const W = {
1889
+ const R = {
1868
1890
  useAnimation: c.useAnimation || !1
1869
1891
  };
1870
- c.uid && (W.uid = c.uid);
1892
+ c.uid && (R.uid = c.uid);
1871
1893
  for (const [g, y] of a.entries())
1872
1894
  y.toolsType === m.BackgroundSVG && f.push({
1873
1895
  ...y,
1874
1896
  workId: g,
1875
1897
  type: h.BackgroundSVGUpdate,
1876
- dataType: R.Local,
1898
+ dataType: E.Local,
1877
1899
  willSyncService: p === b.Done ? !0 : n,
1878
- updateNodeOpt: W,
1879
- needUndoTicker: S,
1900
+ updateNodeOpt: R,
1901
+ needUndoTicker: k,
1880
1902
  emitEventType: this.emitEventType
1881
1903
  }), y.toolsType === m.Text ? f.push({
1882
1904
  ...y,
1883
1905
  workId: g,
1884
1906
  type: h.TextUpdate,
1885
- dataType: R.Local,
1907
+ dataType: E.Local,
1886
1908
  willSyncService: p === b.Done ? !0 : n,
1887
- updateNodeOpt: W,
1888
- needUndoTicker: S,
1909
+ updateNodeOpt: R,
1910
+ needUndoTicker: k,
1889
1911
  emitEventType: this.emitEventType
1890
1912
  }) : (n || p === b.Done) && f.push({
1891
1913
  ...y,
1892
1914
  workId: g,
1893
1915
  type: h.UpdateNode,
1894
1916
  updateNodeOpt: {
1895
- ...W,
1917
+ ...R,
1896
1918
  eraserGeometryDelta: ee(
1897
1919
  (I = this.localWork) == null ? void 0 : I.vNodes,
1898
1920
  g
1899
1921
  )
1900
1922
  },
1901
1923
  isSync: !0,
1902
- needUndoTicker: S,
1924
+ needUndoTicker: k,
1903
1925
  emitEventType: this.emitEventType
1904
1926
  });
1905
1927
  }
@@ -1917,7 +1939,7 @@ class ze extends x {
1917
1939
  }
1918
1940
  async consume(t) {
1919
1941
  const { msgType: s, dataType: r, emitEventType: i } = t;
1920
- if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
1942
+ if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
1921
1943
  return await this.consumeForLocalWorker(t), !0;
1922
1944
  }
1923
1945
  async consumeForLocalWorker(t) {
@@ -1941,10 +1963,10 @@ class ze extends x {
1941
1963
  }));
1942
1964
  }
1943
1965
  }
1944
- class Ve extends x {
1966
+ class _e extends U {
1945
1967
  constructor() {
1946
1968
  super(...arguments);
1947
- u(this, "emitEventType", N.RotateNode);
1969
+ u(this, "emitEventType", C.RotateNode);
1948
1970
  u(this, "updateSelectorCallback", (t) => {
1949
1971
  var g;
1950
1972
  const { param: s, postData: r, workShapeNode: i, res: o, newServiceStore: a, smoothSync: n } = t, {
@@ -1953,9 +1975,9 @@ class Ve extends x {
1953
1975
  willSerializeData: l,
1954
1976
  isSync: p,
1955
1977
  needUndoTicker: f
1956
- } = s, w = c.workState, S = r.sp || [], I = o == null ? void 0 : o.selectRect, W = w === b.Done ? f : void 0;
1978
+ } = s, w = c.workState, k = r.sp || [], I = o == null ? void 0 : o.selectRect, R = w === b.Done ? f : void 0;
1957
1979
  if (d) {
1958
- l && w === b.Done && S.push({
1980
+ l && w === b.Done && k.push({
1959
1981
  type: h.Select,
1960
1982
  selectIds: i.selectIds,
1961
1983
  selectRect: I,
@@ -1967,38 +1989,38 @@ class Ve extends x {
1967
1989
  useAnimation: c.useAnimation || !1
1968
1990
  };
1969
1991
  if (c.uid && (y.uid = c.uid), n || w === b.Done)
1970
- for (const [v, T] of a.entries())
1971
- S.push({
1992
+ for (const [S, T] of a.entries())
1993
+ k.push({
1972
1994
  ...T,
1973
- workId: v,
1995
+ workId: S,
1974
1996
  type: h.UpdateNode,
1975
1997
  updateNodeOpt: {
1976
1998
  ...y,
1977
1999
  eraserGeometryDelta: ee(
1978
2000
  (g = this.localWork) == null ? void 0 : g.vNodes,
1979
- v
2001
+ S
1980
2002
  )
1981
2003
  },
1982
2004
  isSync: p,
1983
- needUndoTicker: W,
2005
+ needUndoTicker: R,
1984
2006
  emitEventType: this.emitEventType
1985
2007
  });
1986
2008
  }
1987
- return f && S.push({
2009
+ return f && k.push({
1988
2010
  type: h.None,
1989
2011
  needUndoTicker: f
1990
- }), S.push({
2012
+ }), k.push({
1991
2013
  type: h.SelectorTransform,
1992
2014
  emitEventType: this.emitEventType,
1993
2015
  workState: w
1994
2016
  }), {
1995
- sp: S
2017
+ sp: k
1996
2018
  };
1997
2019
  });
1998
2020
  }
1999
2021
  async consume(t) {
2000
2022
  const { msgType: s, dataType: r, emitEventType: i } = t;
2001
- if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2023
+ if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2002
2024
  return await this.consumeForLocalWorker(t), !0;
2003
2025
  }
2004
2026
  async consumeForLocalWorker(t) {
@@ -2026,14 +2048,14 @@ class Ve extends x {
2026
2048
  }));
2027
2049
  }
2028
2050
  }
2029
- class $e extends x {
2051
+ class He extends U {
2030
2052
  constructor() {
2031
2053
  super(...arguments);
2032
- u(this, "emitEventType", N.SetFontStyle);
2054
+ u(this, "emitEventType", C.SetFontStyle);
2033
2055
  }
2034
2056
  async consume(t) {
2035
2057
  const { msgType: s, dataType: r, emitEventType: i } = t;
2036
- if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2058
+ if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2037
2059
  return await this.consumeForLocalWorker(t), !0;
2038
2060
  }
2039
2061
  async consumeForLocalWorker(t) {
@@ -2066,27 +2088,27 @@ class $e extends x {
2066
2088
  textUpdateForWoker: l,
2067
2089
  requestId: p,
2068
2090
  emitEventType: f
2069
- } = s, w = r.sp || [], S = a == null ? void 0 : a.selectRect;
2091
+ } = s, w = r.sp || [], k = a == null ? void 0 : a.selectRect;
2070
2092
  if (n && w) {
2071
2093
  d.fontSize && w.push({
2072
2094
  type: h.Select,
2073
2095
  selectIds: o.selectIds,
2074
- selectRect: S,
2096
+ selectRect: k,
2075
2097
  willSyncService: n,
2076
2098
  isSync: c,
2077
2099
  points: o.getChildrenPoints()
2078
2100
  });
2079
- for (const [I, W] of i.entries())
2080
- l && W.toolsType === m.Text ? w.push({
2081
- ...W,
2101
+ for (const [I, R] of i.entries())
2102
+ l && R.toolsType === m.Text ? w.push({
2103
+ ...R,
2082
2104
  workId: I,
2083
2105
  type: h.TextUpdate,
2084
- dataType: R.Local,
2106
+ dataType: E.Local,
2085
2107
  willSyncService: !0,
2086
2108
  emitEventType: f,
2087
2109
  requestId: p
2088
2110
  }) : w.push({
2089
- ...W,
2111
+ ...R,
2090
2112
  workId: I,
2091
2113
  type: h.UpdateNode,
2092
2114
  updateNodeOpt: {
@@ -2102,10 +2124,10 @@ class $e extends x {
2102
2124
  };
2103
2125
  }
2104
2126
  }
2105
- class _e extends x {
2127
+ class Qe extends U {
2106
2128
  constructor() {
2107
2129
  super(...arguments);
2108
- u(this, "emitEventType", N.SetPoint);
2130
+ u(this, "emitEventType", C.SetPoint);
2109
2131
  u(this, "updateSelectorCallback", (t) => {
2110
2132
  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;
2111
2133
  if (n && l) {
@@ -2144,7 +2166,7 @@ class _e extends x {
2144
2166
  }
2145
2167
  async consume(t) {
2146
2168
  const { msgType: s, dataType: r, emitEventType: i } = t;
2147
- if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2169
+ if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2148
2170
  return await this.consumeForLocalWorker(t), !0;
2149
2171
  }
2150
2172
  async consumeForLocalWorker(t) {
@@ -2171,14 +2193,14 @@ class _e extends x {
2171
2193
  }));
2172
2194
  }
2173
2195
  }
2174
- class He extends x {
2196
+ class Ke extends U {
2175
2197
  constructor() {
2176
2198
  super(...arguments);
2177
- u(this, "emitEventType", N.SetLock);
2199
+ u(this, "emitEventType", C.SetLock);
2178
2200
  }
2179
2201
  async consume(t) {
2180
2202
  const { msgType: s, dataType: r, emitEventType: i } = t;
2181
- if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2203
+ if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2182
2204
  return await this.consumeForLocalWorker(t), !0;
2183
2205
  }
2184
2206
  async consumeForLocalWorker(t) {
@@ -2211,11 +2233,11 @@ class He extends x {
2211
2233
  needUndoTicker: l,
2212
2234
  requestId: p,
2213
2235
  emitEventType: f
2214
- } = s, w = r.sp || [], S = a == null ? void 0 : a.selectRect;
2236
+ } = s, w = r.sp || [], k = a == null ? void 0 : a.selectRect;
2215
2237
  if (n && w) {
2216
- for (const [I, W] of i.entries())
2238
+ for (const [I, R] of i.entries())
2217
2239
  w.push({
2218
- ...W,
2240
+ ...R,
2219
2241
  workId: I,
2220
2242
  type: h.UpdateNode,
2221
2243
  updateNodeOpt: {
@@ -2232,7 +2254,7 @@ class He extends x {
2232
2254
  canRotate: o.canRotate,
2233
2255
  type: h.Select,
2234
2256
  selectIds: o.selectIds,
2235
- selectRect: S,
2257
+ selectRect: k,
2236
2258
  willSyncService: n,
2237
2259
  isSync: c
2238
2260
  });
@@ -2245,14 +2267,14 @@ class He extends x {
2245
2267
  };
2246
2268
  }
2247
2269
  }
2248
- class Qe extends x {
2270
+ class Xe extends U {
2249
2271
  constructor() {
2250
2272
  super(...arguments);
2251
- u(this, "emitEventType", N.SetShapeOpt);
2273
+ u(this, "emitEventType", C.SetShapeOpt);
2252
2274
  }
2253
2275
  async consume(t) {
2254
2276
  const { msgType: s, dataType: r, emitEventType: i } = t;
2255
- if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2277
+ if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2256
2278
  return await this.consumeForLocalWorker(t), !0;
2257
2279
  }
2258
2280
  async consumeForLocalWorker(t) {
@@ -2306,33 +2328,33 @@ class Qe extends x {
2306
2328
  };
2307
2329
  }
2308
2330
  }
2309
- class Ke {
2331
+ class Ye {
2310
2332
  constructor(e) {
2311
2333
  u(this, "builders", /* @__PURE__ */ new Map());
2312
2334
  this.builders = new Map(e.map((t) => [t, this.build(t)]));
2313
2335
  }
2314
2336
  build(e) {
2315
2337
  switch (e) {
2316
- case N.TranslateNode:
2317
- return new qe();
2318
- case N.ZIndexNode:
2319
- return new Ge();
2320
- case N.CopyNode:
2321
- return new Ue();
2322
- case N.SetColorNode:
2323
- return new xe();
2324
- case N.ScaleNode:
2325
- return new ze();
2326
- case N.RotateNode:
2338
+ case C.TranslateNode:
2327
2339
  return new Ve();
2328
- case N.SetFontStyle:
2340
+ case C.ZIndexNode:
2341
+ return new ze();
2342
+ case C.CopyNode:
2343
+ return new Ge();
2344
+ case C.SetColorNode:
2345
+ return new qe();
2346
+ case C.ScaleNode:
2329
2347
  return new $e();
2330
- case N.SetPoint:
2348
+ case C.RotateNode:
2331
2349
  return new _e();
2332
- case N.SetLock:
2350
+ case C.SetFontStyle:
2333
2351
  return new He();
2334
- case N.SetShapeOpt:
2352
+ case C.SetPoint:
2335
2353
  return new Qe();
2354
+ case C.SetLock:
2355
+ return new Ke();
2356
+ case C.SetShapeOpt:
2357
+ return new Xe();
2336
2358
  }
2337
2359
  }
2338
2360
  registerForMainThread(e) {
@@ -2347,7 +2369,7 @@ class Ke {
2347
2369
  return !1;
2348
2370
  }
2349
2371
  }
2350
- function Xe({
2372
+ function Ze({
2351
2373
  subThreads: M,
2352
2374
  layers: e,
2353
2375
  scene: t,
@@ -2382,8 +2404,8 @@ function Xe({
2382
2404
  if (r)
2383
2405
  throw r;
2384
2406
  }
2385
- const Ye = 4;
2386
- class Ze {
2407
+ const je = 4;
2408
+ class Je {
2387
2409
  constructor(e = {}) {
2388
2410
  u(this, "pendingFrames", /* @__PURE__ */ new Map());
2389
2411
  u(this, "failedCanvases", /* @__PURE__ */ new Set());
@@ -2395,7 +2417,7 @@ class Ze {
2395
2417
  u(this, "destroyed", !1);
2396
2418
  this.tailFrameCount = Math.max(
2397
2419
  1,
2398
- Math.floor(e.tailFrameCount ?? Ye)
2420
+ Math.floor(e.tailFrameCount ?? je)
2399
2421
  ), this.requestFrame = e.requestFrame ?? ((t) => requestAnimationFrame(t)), this.cancelFrame = e.cancelFrame ?? ((t) => cancelAnimationFrame(t)), this.onReadbackError = e.onReadbackError;
2400
2422
  }
2401
2423
  markRendered(e) {
@@ -2426,7 +2448,7 @@ class Ze {
2426
2448
  }
2427
2449
  }
2428
2450
  }
2429
- class je {
2451
+ class et {
2430
2452
  constructor(e, t) {
2431
2453
  u(this, "viewId");
2432
2454
  u(this, "fullLayer");
@@ -2483,23 +2505,23 @@ class je {
2483
2505
  this.topLayer.parent,
2484
2506
  this.localLayer.parent,
2485
2507
  this.serviceLayer.parent
2486
- ]), this.vNodes = new We(e, this.scene);
2508
+ ]), this.vNodes = new Re(e, this.scene);
2487
2509
  const i = {
2488
2510
  thread: this,
2489
2511
  vNodes: this.vNodes
2490
2512
  };
2491
- this.localWork = new Ae(i), this.serviceWork = new Fe(i), this.topWork = new Pe(i), this.vNodes.init(this.fullLayer), this.methodBuilder = new Ke([
2492
- N.CopyNode,
2493
- N.SetColorNode,
2494
- N.DeleteNode,
2495
- N.RotateNode,
2496
- N.ScaleNode,
2497
- N.TranslateNode,
2498
- N.ZIndexNode,
2499
- N.SetFontStyle,
2500
- N.SetPoint,
2501
- N.SetLock,
2502
- N.SetShapeOpt
2513
+ this.localWork = new xe(i), this.serviceWork = new Ue(i), this.topWork = new Fe(i), this.vNodes.init(this.fullLayer), this.methodBuilder = new Ye([
2514
+ C.CopyNode,
2515
+ C.SetColorNode,
2516
+ C.DeleteNode,
2517
+ C.RotateNode,
2518
+ C.ScaleNode,
2519
+ C.TranslateNode,
2520
+ C.ZIndexNode,
2521
+ C.SetFontStyle,
2522
+ C.SetPoint,
2523
+ C.SetLock,
2524
+ C.SetShapeOpt
2503
2525
  ]).registerForMainThread(this);
2504
2526
  }
2505
2527
  getCachedImages(e) {
@@ -2544,7 +2566,7 @@ class je {
2544
2566
  reportErrorCode: "RENDERER_RUNTIME_ERROR",
2545
2567
  reportStage: s.stage,
2546
2568
  reportError: s.message,
2547
- reportString: Re(s, t, {
2569
+ reportString: Ee(s, t, {
2548
2570
  viewId: this.viewId,
2549
2571
  renderer: "mainThread"
2550
2572
  })
@@ -2574,9 +2596,9 @@ class je {
2574
2596
  workState: p,
2575
2597
  imageSrc: f,
2576
2598
  imageBitmap: w,
2577
- imageElement: S,
2599
+ imageElement: k,
2578
2600
  workIds: I,
2579
- isLockSentEventCursor: W,
2601
+ isLockSentEventCursor: R,
2580
2602
  requestId: g
2581
2603
  } = e, y = l == null ? void 0 : l.toString();
2582
2604
  switch (a) {
@@ -2584,16 +2606,16 @@ class je {
2584
2606
  G(e.dpr) && this.updateDpr(e.dpr);
2585
2607
  break;
2586
2608
  case h.AuthClear: {
2587
- const { clearUids: v, localUid: T } = e;
2588
- this.vNodes.setCanClearUids(v), this.vNodes.setLocalUid(T);
2609
+ const { clearUids: S, localUid: T } = e;
2610
+ this.vNodes.setCanClearUids(S), this.vNodes.setLocalUid(T);
2589
2611
  break;
2590
2612
  }
2591
2613
  case h.Destroy:
2592
2614
  this.destroy();
2593
2615
  break;
2594
2616
  case h.CancelBitmapEraser: {
2595
- const v = y;
2596
- v && this.localWork.abortBitmapEraser(v);
2617
+ const S = y;
2618
+ S && this.localWork.abortBitmapEraser(S);
2597
2619
  break;
2598
2620
  }
2599
2621
  case h.Clear:
@@ -2601,18 +2623,18 @@ class je {
2601
2623
  break;
2602
2624
  case h.ServiceSyncCommit: {
2603
2625
  if (this.destroyed) break;
2604
- const v = [
2626
+ const S = [
2605
2627
  (s = this.fullLayer) == null ? void 0 : s.parent,
2606
2628
  (r = this.topLayer) == null ? void 0 : r.parent,
2607
2629
  (i = this.localLayer) == null ? void 0 : i.parent,
2608
2630
  (o = this.serviceLayer) == null ? void 0 : o.parent
2609
2631
  ].filter(Boolean);
2610
2632
  try {
2611
- await be(
2633
+ await Le(
2612
2634
  (async () => {
2613
- await Le(
2635
+ await Ne(
2614
2636
  this.serviceWork,
2615
- v
2637
+ S
2616
2638
  );
2617
2639
  })(),
2618
2640
  {
@@ -2644,28 +2666,28 @@ class je {
2644
2666
  }
2645
2667
  case h.UpdateCamera:
2646
2668
  try {
2647
- await Ee(
2669
+ await be(
2648
2670
  e.cameraTaskId,
2649
- async (v) => {
2650
- this.activeCameraTaskContext = v;
2671
+ async (S) => {
2672
+ this.activeCameraTaskContext = S;
2651
2673
  try {
2652
- await this.updateCamera(e, v);
2674
+ await this.updateCamera(e, S);
2653
2675
  } finally {
2654
- this.activeCameraTaskContext === v && (this.activeCameraTaskContext = void 0);
2676
+ this.activeCameraTaskContext === S && (this.activeCameraTaskContext = void 0);
2655
2677
  }
2656
2678
  }
2657
2679
  );
2658
- } catch (v) {
2659
- throw this.cameraOpt = void 0, this.cancelCameraSettledRender(), v;
2680
+ } catch (S) {
2681
+ throw this.cameraOpt = void 0, this.cancelCameraSettledRender(), S;
2660
2682
  }
2661
2683
  break;
2662
2684
  case h.UpdateTools:
2663
2685
  if (n && c) {
2664
- const v = {
2686
+ const S = {
2665
2687
  toolsType: n,
2666
2688
  toolsOpt: c
2667
2689
  };
2668
- this.topWork.canUseTopLayer(n) ? this.topWork.setToolsOpt(v) : this.localWork.setToolsOpt(v);
2690
+ this.topWork.canUseTopLayer(n) ? this.topWork.setToolsOpt(S) : this.localWork.setToolsOpt(S);
2669
2691
  }
2670
2692
  break;
2671
2693
  case h.CreateWork:
@@ -2684,11 +2706,11 @@ class je {
2684
2706
  }
2685
2707
  break;
2686
2708
  case h.DrawWork:
2687
- p === b.Done && d === R.Local ? (await this.consumeDrawAll(d, e), n === m.LaserPen && W && this.post({
2709
+ p === b.Done && d === E.Local ? (await this.consumeDrawAll(d, e), n === m.LaserPen && R && this.post({
2688
2710
  sp: [
2689
2711
  {
2690
2712
  type: h.None,
2691
- isLockSentEventCursor: W
2713
+ isLockSentEventCursor: R
2692
2714
  }
2693
2715
  ]
2694
2716
  })) : await this.consumeDraw(d, e);
@@ -2705,7 +2727,7 @@ class je {
2705
2727
  await this.removeNode(e);
2706
2728
  return;
2707
2729
  case h.Select:
2708
- d === R.Local || l === D ? await this.localWork.updateFullSelectWork(e) : d === R.Service && this.serviceWork.runSelectWork(e);
2730
+ d === E.Local || l === D ? await this.localWork.updateFullSelectWork(e) : d === E.Service && this.serviceWork.runSelectWork(e);
2709
2731
  break;
2710
2732
  case h.CursorBlur:
2711
2733
  this.localWork.cursorBlur();
@@ -2714,34 +2736,34 @@ class je {
2714
2736
  this.localWork.cursorHover(e);
2715
2737
  break;
2716
2738
  case h.GetTextActive:
2717
- d === R.Local && this.localWork.checkTextActive(e);
2739
+ d === E.Local && this.localWork.checkTextActive(e);
2718
2740
  break;
2719
2741
  case h.GetImageBitMap:
2720
- if (f && (w || S) && l) {
2721
- const v = this.imageResolveMap.get(f);
2722
- if (!v || v.requestId !== g) {
2723
- this.closeImageSource(w || S);
2742
+ if (f && (w || k) && l) {
2743
+ const S = this.imageResolveMap.get(f);
2744
+ if (!S || S.requestId !== g) {
2745
+ this.closeImageSource(w || k);
2724
2746
  break;
2725
2747
  }
2726
2748
  const T = l.toString();
2727
2749
  this.deleteCachedImagesByWorkId(T), this.cacheImages.set(f, {
2728
- imageSource: w || S,
2750
+ imageSource: w || k,
2729
2751
  workId: T
2730
2752
  });
2731
- const { resolve: C, timer: L } = v;
2732
- L && clearTimeout(L), C && C(f);
2753
+ const { resolve: L, timer: N } = S;
2754
+ N && clearTimeout(N), L && L(f);
2733
2755
  }
2734
2756
  break;
2735
2757
  case h.GetVNodeInfo:
2736
2758
  if (l && I) {
2737
- const v = I.map((T) => this.vNodes.get(T));
2759
+ const S = I.map((T) => this.vNodes.get(T));
2738
2760
  this.post({
2739
2761
  sp: [
2740
2762
  {
2741
2763
  type: h.GetVNodeInfo,
2742
- dataType: R.Local,
2764
+ dataType: E.Local,
2743
2765
  workId: l,
2744
- vInfo: v
2766
+ vInfo: S
2745
2767
  }
2746
2768
  ]
2747
2769
  });
@@ -2761,9 +2783,9 @@ class je {
2761
2783
  if (!a || !n || !c || !d)
2762
2784
  return;
2763
2785
  let p = a;
2764
- if (n === pe.Iconify) {
2765
- const [y, v] = this.getIconSize(c, d, this.opt.displayer.dpr);
2766
- p = ue(a, y, v, l);
2786
+ if (n === ue.Iconify) {
2787
+ const [y, S] = this.getIconSize(c, d, this.opt.displayer.dpr);
2788
+ p = fe(a, y, S, l);
2767
2789
  }
2768
2790
  if (this.cacheImages.has(p)) {
2769
2791
  const y = this.getCachedImages(p);
@@ -2773,18 +2795,18 @@ class je {
2773
2795
  const w = this.imageResolveMap.get(p);
2774
2796
  if (w)
2775
2797
  return await w.promise, this.getCachedImages(p);
2776
- let S, I;
2777
- const W = new Promise((y, v) => {
2778
- S = y, I = v;
2798
+ let k, I;
2799
+ const R = new Promise((y, S) => {
2800
+ k = y, I = S;
2779
2801
  }), g = {
2780
- resolve: S,
2802
+ resolve: k,
2781
2803
  reject: I,
2782
2804
  timer: void 0,
2783
2805
  requestId: i,
2784
- promise: W
2806
+ promise: R
2785
2807
  };
2786
2808
  return g.timer = setTimeout(() => {
2787
- this.imageResolveMap.get(p) === g && S(p);
2809
+ this.imageResolveMap.get(p) === g && k(p);
2788
2810
  }, 5e3), this.imageResolveMap.set(p, g), this.opt.post({
2789
2811
  sp: [
2790
2812
  {
@@ -2797,7 +2819,7 @@ class je {
2797
2819
  type: h.GetImageBitMap
2798
2820
  }
2799
2821
  ]
2800
- }), await W, this.imageResolveMap.get(p) === g && this.imageResolveMap.delete(p), this.getCachedImages(p);
2822
+ }), await R, this.imageResolveMap.get(p) === g && this.imageResolveMap.delete(p), this.getCachedImages(p);
2801
2823
  }
2802
2824
  }
2803
2825
  async removeNode(e) {
@@ -2808,12 +2830,12 @@ class je {
2808
2830
  await this.localWork.removeSelector(e);
2809
2831
  continue;
2810
2832
  }
2811
- t === R.Local ? this.localWork.removeWork(e) : t === R.Service && this.serviceWork.removeWork(e), await this.localWork.colloctEffectSelectWork(e);
2833
+ t === E.Local ? this.localWork.removeWork(e) : t === E.Service && this.serviceWork.removeWork(e), await this.localWork.colloctEffectSelectWork(e);
2812
2834
  }
2813
2835
  }
2814
2836
  async consumeFull(e, t) {
2815
2837
  const s = await this.localWork.colloctEffectSelectWork(t);
2816
- s && e === R.Local && await this.localWork.consumeFull(s), s && e === R.Service && this.serviceWork.consumeFull(s);
2838
+ s && e === E.Local && await this.localWork.consumeFull(s), s && e === E.Service && this.serviceWork.consumeFull(s);
2817
2839
  }
2818
2840
  setCameraOpt(e) {
2819
2841
  this.cameraOpt = e;
@@ -2889,12 +2911,12 @@ class je {
2889
2911
  if (r) {
2890
2912
  const i = r.toString();
2891
2913
  if (s && this.topWork.canUseTopLayer(s)) {
2892
- e === R.Local && (this.topWork.getLocalWorkShape(
2914
+ e === E.Local && (this.topWork.getLocalWorkShape(
2893
2915
  r.toString()
2894
2916
  ) || this.topWork.createLocalWork(t)), await this.topWork.consumeDrawAll(t);
2895
2917
  return;
2896
2918
  }
2897
- e === R.Local && (this.localWork.getWorkShape(i) || this.localWork.createLocalWork(t), await this.localWork.consumeDrawAll(t, this.serviceWork));
2919
+ e === E.Local && (this.localWork.getWorkShape(i) || this.localWork.createLocalWork(t), await this.localWork.consumeDrawAll(t, this.serviceWork));
2898
2920
  }
2899
2921
  }
2900
2922
  async consumeDraw(e, t) {
@@ -2902,10 +2924,10 @@ class je {
2902
2924
  if (r && i && s) {
2903
2925
  const o = r.toString();
2904
2926
  if (this.topWork.canUseTopLayer(i)) {
2905
- e === R.Local && (this.topWork.getLocalWorkShape(o) || this.topWork.createLocalWork(t)), this.topWork.consumeDraw(t);
2927
+ e === E.Local && (this.topWork.getLocalWorkShape(o) || this.topWork.createLocalWork(t)), this.topWork.consumeDraw(t);
2906
2928
  return;
2907
2929
  }
2908
- 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);
2930
+ 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);
2909
2931
  return;
2910
2932
  }
2911
2933
  }
@@ -2935,8 +2957,8 @@ class je {
2935
2957
  let y;
2936
2958
  do {
2937
2959
  y = [];
2938
- for (const [T, C] of this.localWork.getWorkShapes().entries())
2939
- switch (C.toolsType) {
2960
+ for (const [T, L] of this.localWork.getWorkShapes().entries())
2961
+ switch (L.toolsType) {
2940
2962
  case m.Text:
2941
2963
  case m.BitMapEraser:
2942
2964
  case m.PencilEraser:
@@ -2945,7 +2967,7 @@ class je {
2945
2967
  case m.LaserPen:
2946
2968
  break;
2947
2969
  default:
2948
- T !== H && T !== D && y.push(`${T}:${C.toolsType}`);
2970
+ T !== H && T !== D && y.push(`${T}:${L.toolsType}`);
2949
2971
  break;
2950
2972
  }
2951
2973
  if (t && (t.stage = "blocking-works", t.blockingWorks = y), !y.length) break;
@@ -2959,103 +2981,103 @@ class je {
2959
2981
  }
2960
2982
  if (t != null && t.aborted) return;
2961
2983
  const f = /* @__PURE__ */ new Map();
2962
- for (const [y, v] of this.vNodes.getNodesByType(m.Text).entries()) {
2963
- const T = v.rect;
2984
+ for (const [y, S] of this.vNodes.getNodesByType(m.Text).entries()) {
2985
+ const T = S.rect;
2964
2986
  f.set(y, J(T));
2965
2987
  }
2966
- for (const [y, v] of this.vNodes.gethasEraserNodes().entries())
2967
- f.set(y, J(v.rect));
2988
+ for (const [y, S] of this.vNodes.gethasEraserNodes().entries())
2989
+ f.set(y, J(S.rect));
2968
2990
  const w = new Set(f.keys());
2969
- let S = !1;
2991
+ let k = !1;
2970
2992
  if (this.localWork.hasSelector()) {
2971
2993
  const y = (l = this.localWork.getSelector()) == null ? void 0 : l.selectIds;
2972
2994
  if (y) {
2973
- S = !0;
2974
- for (const v of y)
2975
- w.add(v);
2995
+ k = !0;
2996
+ for (const S of y)
2997
+ w.add(S);
2976
2998
  }
2977
2999
  }
2978
3000
  let I = !1;
2979
3001
  if (this.serviceWork.selectorWorkShapes.size)
2980
3002
  for (const y of this.serviceWork.selectorWorkShapes.values()) {
2981
- const v = y.selectIds;
2982
- if (v) {
3003
+ const S = y.selectIds;
3004
+ if (S) {
2983
3005
  I = !0;
2984
- for (const T of v)
3006
+ for (const T of S)
2985
3007
  w.add(T);
2986
3008
  }
2987
3009
  }
2988
3010
  if (this.setCameraOpt(s), this.vNodes.curNodeMap.size) {
2989
3011
  this.vNodes.clearTarget(), this.vNodes.updateHighLevelNodesRect(w);
2990
- for (const [T, C] of f.entries()) {
2991
- const L = this.vNodes.get(T);
2992
- if (L) {
2993
- const A = C, E = L.rect, k = this.getSceneRect(), B = ae(A, k), O = ae(E, k);
3012
+ for (const [T, L] of f.entries()) {
3013
+ const N = this.vNodes.get(T);
3014
+ if (N) {
3015
+ const A = L, W = N.rect, v = this.getSceneRect(), B = ae(A, v), O = ae(W, v);
2994
3016
  let P = c;
2995
- (B !== O || A.w !== E.w || A.h !== E.h || O === Ce.intersect) && (P = !0);
2996
- const { toolsType: F, opt: U } = L, X = U.eraserlines && U.eraserlines.length > 0 || !!U.eraserFaces;
3017
+ (B !== O || A.w !== W.w || A.h !== W.h || O === Ce.intersect) && (P = !0);
3018
+ const { toolsType: F, opt: x } = N, X = x.eraserlines && x.eraserlines.length > 0 || !!x.eraserFaces;
2997
3019
  (P || p && X) && (F === m.Text || X) && this.debounceUpdateCache.add(T);
2998
3020
  }
2999
3021
  }
3000
- if (S && this.localWork.reRenderSelector(), I)
3022
+ if (k && this.localWork.reRenderSelector(), I)
3001
3023
  for (const [
3002
3024
  T,
3003
- C
3025
+ L
3004
3026
  ] of this.serviceWork.selectorWorkShapes.entries())
3005
3027
  this.serviceWork.runSelectWork({
3006
3028
  workId: T,
3007
- selectIds: C.selectIds,
3029
+ selectIds: L.selectIds,
3008
3030
  msgType: h.Select,
3009
- dataType: R.Service,
3031
+ dataType: E.Service,
3010
3032
  viewId: this.viewId
3011
3033
  });
3012
3034
  o = !0;
3013
3035
  const y = { cancelled: !1, cameraTaskId: i, context: t };
3014
3036
  this.activeCameraSettledRender = y;
3015
- const v = () => !this.destroyed && !y.cancelled && this.activeCameraSettledRender === y && !(t != null && t.aborted);
3037
+ const S = () => !this.destroyed && !y.cancelled && this.activeCameraSettledRender === y && !(t != null && t.aborted);
3016
3038
  this.debounceUpdateCameraId = setTimeout(async () => {
3017
3039
  var T;
3018
3040
  this.debounceUpdateCameraId = void 0;
3019
3041
  try {
3020
- if (!v()) return;
3021
- const C = [];
3022
- for (const E of this.debounceUpdateCache.values()) {
3023
- const k = (T = this.fullLayer) == null ? void 0 : T.getElementsByName(E)[0], B = this.vNodes.get(E);
3042
+ if (!S()) return;
3043
+ const L = [];
3044
+ for (const W of this.debounceUpdateCache.values()) {
3045
+ const v = (T = this.fullLayer) == null ? void 0 : T.getElementsByName(W)[0], B = this.vNodes.get(W);
3024
3046
  if (B) {
3025
3047
  const { toolsType: O, opt: P } = B;
3026
- if (k || O !== m.Text) {
3048
+ if (v || O !== m.Text) {
3027
3049
  const F = this.localWork.setFullWork({
3028
3050
  toolsType: O,
3029
3051
  opt: P,
3030
- workId: E
3052
+ workId: W
3031
3053
  });
3032
3054
  if (F) {
3033
3055
  if (O === m.Text)
3034
- C.push(
3056
+ L.push(
3035
3057
  F.consumeServiceAsync({
3036
3058
  isFullWork: !0,
3037
- replaceId: E,
3059
+ replaceId: W,
3038
3060
  boxRect: this.getSceneRect(),
3039
- isActive: v
3061
+ isActive: S
3040
3062
  })
3041
3063
  );
3042
3064
  else if (P.eraserlines && P.eraserlines.length > 0 || P.eraserFaces) {
3043
- const U = F.consumeService({
3065
+ const x = F.consumeService({
3044
3066
  op: B.op,
3045
3067
  isFullWork: !0,
3046
- replaceId: E,
3068
+ replaceId: W,
3047
3069
  workState: b.Done
3048
3070
  });
3049
- this.localWork.clearWorkShapeNodeCache(E), C.push(Promise.resolve(U));
3071
+ this.localWork.clearWorkShapeNodeCache(W), L.push(Promise.resolve(x));
3050
3072
  }
3051
3073
  }
3052
3074
  }
3053
3075
  }
3054
- this.debounceUpdateCache.delete(E);
3076
+ this.debounceUpdateCache.delete(W);
3055
3077
  }
3056
- if (await Promise.all(C), !v()) return;
3057
- this.vNodes.updateLowLevelNodesRect(), this.vNodes.clearHighLevelIds();
3058
- const L = [
3078
+ if (await Promise.all(L), !S()) return;
3079
+ this.vNodes.updateLowLevelNodesRect(), this.vNodes.clearHighLevelIds(), k && L.length && this.localWork.reRenderSelector();
3080
+ const N = [
3059
3081
  this.fullLayer.parent.prepareRender,
3060
3082
  this.topLayer.parent.prepareRender,
3061
3083
  this.localLayer.parent.prepareRender,
@@ -3066,19 +3088,19 @@ class je {
3066
3088
  this.topLayer.parent,
3067
3089
  this.localLayer.parent,
3068
3090
  this.serviceLayer.parent
3069
- ], await Promise.all(L), y.renderLayers = void 0, !v()) return;
3091
+ ], await Promise.all(N), y.renderLayers = void 0, !S()) return;
3070
3092
  const A = y.cameraTaskId;
3071
3093
  G(A) && this.opt.post({
3072
3094
  viewId: this.viewId,
3073
3095
  viewGeneration: this.viewGeneration,
3074
3096
  cameraSettledTaskId: A
3075
3097
  });
3076
- } catch (C) {
3077
- if (!v()) return;
3078
- const L = {
3098
+ } catch (L) {
3099
+ if (!S()) return;
3100
+ const N = {
3079
3101
  code: "RENDERER_BUSINESS_ERROR",
3080
3102
  business: "updateCamera",
3081
- message: C instanceof Error ? C.message : String(C),
3103
+ message: L instanceof Error ? L.message : String(L),
3082
3104
  stage: "camera-settled-render",
3083
3105
  workerType: "mainThread"
3084
3106
  }, A = y.cameraTaskId;
@@ -3089,12 +3111,12 @@ class je {
3089
3111
  viewGeneration: this.viewGeneration,
3090
3112
  cameraTaskId: A,
3091
3113
  cameraTaskStatus: "failed",
3092
- cameraTaskError: L
3114
+ cameraTaskError: N
3093
3115
  });
3094
- } catch (E) {
3116
+ } catch (W) {
3095
3117
  console.error(
3096
3118
  `[cameraSettledRender] failed ACK post failed viewId=${this.viewId} taskId=${A}`,
3097
- E
3119
+ W
3098
3120
  );
3099
3121
  }
3100
3122
  } finally {
@@ -3102,22 +3124,22 @@ class je {
3102
3124
  }
3103
3125
  }, oe);
3104
3126
  }
3105
- const W = [
3127
+ const R = [
3106
3128
  this.fullLayer.parent,
3107
3129
  this.topLayer.parent,
3108
3130
  this.localLayer.parent,
3109
3131
  this.serviceLayer.parent
3110
3132
  ], g = Promise.all(
3111
- W.map((y) => y.prepareRender)
3133
+ R.map((y) => y.prepareRender)
3112
3134
  );
3113
- if (t && !await Ne(
3135
+ if (t && !await Be(
3114
3136
  t,
3115
3137
  g,
3116
3138
  "prepare-render"
3117
3139
  )) {
3118
- W.filter(
3119
- (v) => v.cancelPendingRender()
3120
- ).forEach((v) => v.render()), g.catch(() => {
3140
+ R.filter(
3141
+ (S) => S.cancelPendingRender()
3142
+ ).forEach((S) => S.render()), g.catch(() => {
3121
3143
  });
3122
3144
  return;
3123
3145
  }
@@ -3139,7 +3161,7 @@ class je {
3139
3161
  };
3140
3162
  }
3141
3163
  createScene(e) {
3142
- return new fe({
3164
+ return new me({
3143
3165
  displayRatio: this.opt.displayer.dpr,
3144
3166
  depth: !1,
3145
3167
  desynchronized: !0,
@@ -3150,7 +3172,7 @@ class je {
3150
3172
  });
3151
3173
  }
3152
3174
  createLayer(e, t, s) {
3153
- const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, { ...s, offscreen: !1 }), n = new me({
3175
+ const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, { ...s, offscreen: !1 }), n = new ye({
3154
3176
  anchor: [0.5, 0.5],
3155
3177
  pos: [r * 0.5, i * 0.5],
3156
3178
  size: [r, i],
@@ -3160,7 +3182,7 @@ class je {
3160
3182
  return a.append(n), n;
3161
3183
  }
3162
3184
  enableCanvas2DReadback(e) {
3163
- this.readbackScheduler = new Ze({
3185
+ this.readbackScheduler = new Je({
3164
3186
  onReadbackError: (t) => this.opt.master.Logger.warn(
3165
3187
  `[Appliance]: [main-thread-readback] stage=failed viewId=${this.viewId} error=${t instanceof Error ? t.message : String(t)}`
3166
3188
  )
@@ -3211,7 +3233,7 @@ class je {
3211
3233
  var e, t;
3212
3234
  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(
3213
3235
  new Error(`main-thread view destroyed: ${this.viewId}`)
3214
- ), this.vNodes.clear(), Xe({
3236
+ ), this.vNodes.clear(), Ze({
3215
3237
  subThreads: [this.localWork, this.serviceWork, this.topWork],
3216
3238
  layers: [
3217
3239
  this.fullLayer,
@@ -3224,7 +3246,7 @@ class je {
3224
3246
  }));
3225
3247
  }
3226
3248
  }
3227
- class Je {
3249
+ class tt {
3228
3250
  constructor(e, t) {
3229
3251
  u(this, "viewId");
3230
3252
  u(this, "fullLayer");
@@ -3399,9 +3421,9 @@ class Je {
3399
3421
  if (!a || !n || !c || !d)
3400
3422
  return;
3401
3423
  let p = a;
3402
- if (n === pe.Iconify) {
3424
+ if (n === ue.Iconify) {
3403
3425
  const [g, y] = this.getIconSize(c, d, this.opt.displayer.dpr);
3404
- p = ue(a, g, y, l);
3426
+ p = fe(a, g, y, l);
3405
3427
  }
3406
3428
  if (this.cacheImages.has(p)) {
3407
3429
  const g = this.getCachedImages(p);
@@ -3411,18 +3433,18 @@ class Je {
3411
3433
  const w = this.imageResolveMap.get(p);
3412
3434
  if (w)
3413
3435
  return await w.promise, this.getCachedImages(p);
3414
- let S;
3436
+ let k;
3415
3437
  const I = new Promise((g) => {
3416
- S = g;
3417
- }), W = {
3418
- resolve: S,
3438
+ k = g;
3439
+ }), R = {
3440
+ resolve: k,
3419
3441
  timer: void 0,
3420
3442
  requestId: i,
3421
3443
  promise: I
3422
3444
  };
3423
- return W.timer = setTimeout(() => {
3424
- this.imageResolveMap.get(p) === W && S(p);
3425
- }, 5e3), this.imageResolveMap.set(p, W), this.opt.post({
3445
+ return R.timer = setTimeout(() => {
3446
+ this.imageResolveMap.get(p) === R && k(p);
3447
+ }, 5e3), this.imageResolveMap.set(p, R), this.opt.post({
3426
3448
  viewId: this.viewId,
3427
3449
  viewGeneration: this.viewGeneration,
3428
3450
  viewOwner: this.viewOwner,
@@ -3437,7 +3459,7 @@ class Je {
3437
3459
  requestId: i
3438
3460
  }
3439
3461
  ]
3440
- }), await I, this.imageResolveMap.get(p) === W && this.imageResolveMap.delete(p), this.getCachedImages(p);
3462
+ }), await I, this.imageResolveMap.get(p) === R && this.imageResolveMap.delete(p), this.getCachedImages(p);
3441
3463
  }
3442
3464
  }
3443
3465
  createWorkShapeNode(e) {
@@ -3480,9 +3502,18 @@ class Je {
3480
3502
  op: s,
3481
3503
  isFullWork: !0,
3482
3504
  replaceId: a
3483
- }), o = (e == null ? void 0 : e.updateNodeOpt) && t.updataOptService(e.updateNodeOpt)), ne(i, o);
3505
+ }), o = (e == null ? void 0 : e.updateNodeOpt) && t.updataOptService(e.updateNodeOpt)), i = this.syncMatrixRect(a, t, i), ne(i, o);
3484
3506
  }
3485
3507
  }
3508
+ syncMatrixRect(e, t, s) {
3509
+ const r = t.getWorkOptions().matrix;
3510
+ if (!e || !r || pe(r).every(
3511
+ (o, a) => o === [1, 0, 0, 1, 0, 0][a]
3512
+ ))
3513
+ return s;
3514
+ const i = Oe.getRectFromLayer(this.fullLayer, e);
3515
+ return i || s;
3516
+ }
3486
3517
  async getSnapshot(e) {
3487
3518
  const { scenePath: t, scenes: s, cameraOpt: r, w: i, h: o, requestId: a } = e;
3488
3519
  if (!(t && s && r))
@@ -3498,7 +3529,7 @@ class Je {
3498
3529
  opt: l,
3499
3530
  workId: c,
3500
3531
  msgType: h.FullWork,
3501
- dataType: R.Service,
3532
+ dataType: E.Service,
3502
3533
  viewId: this.viewId,
3503
3534
  requestId: a
3504
3535
  };
@@ -3574,7 +3605,7 @@ class Je {
3574
3605
  ...n,
3575
3606
  workId: a,
3576
3607
  msgType: h.FullWork,
3577
- dataType: R.Service,
3608
+ dataType: E.Service,
3578
3609
  viewId: this.viewId,
3579
3610
  requestId: i
3580
3611
  });
@@ -3615,7 +3646,7 @@ class Je {
3615
3646
  for (const r of s.sp) {
3616
3647
  let i = !1;
3617
3648
  for (const o of e)
3618
- if (Be(r, o)) {
3649
+ if (De(r, o)) {
3619
3650
  i = !0;
3620
3651
  break;
3621
3652
  }
@@ -3655,7 +3686,7 @@ class Je {
3655
3686
  this.releaseBatchImageBitmaps(e);
3656
3687
  }
3657
3688
  createScene(e) {
3658
- return new fe({
3689
+ return new me({
3659
3690
  displayRatio: this.opt.displayer.dpr,
3660
3691
  depth: !1,
3661
3692
  desynchronized: !0,
@@ -3665,7 +3696,7 @@ class Je {
3665
3696
  });
3666
3697
  }
3667
3698
  createLayer(e, t, s) {
3668
- const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, s), n = new me({
3699
+ const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, s), n = new ye({
3669
3700
  anchor: [0.5, 0.5],
3670
3701
  pos: [r * 0.5, i * 0.5],
3671
3702
  size: [r, i],
@@ -3732,7 +3763,7 @@ class Je {
3732
3763
  throw t[0];
3733
3764
  }
3734
3765
  }
3735
- class ht {
3766
+ class dt {
3736
3767
  constructor(e) {
3737
3768
  u(this, "mainThreadMap", /* @__PURE__ */ new Map());
3738
3769
  u(this, "cameraRenderQueueByView", /* @__PURE__ */ new Map());
@@ -3768,7 +3799,7 @@ class ht {
3768
3799
  consumeWorkId: p
3769
3800
  } = e;
3770
3801
  if (c && q(i)) {
3771
- const f = Oe(
3802
+ const f = Me(
3772
3803
  o,
3773
3804
  a,
3774
3805
  "mainThread"
@@ -3853,10 +3884,10 @@ class ht {
3853
3884
  );
3854
3885
  }
3855
3886
  createMainThread(e, t) {
3856
- return new je(e, t);
3887
+ return new et(e, t);
3857
3888
  }
3858
3889
  createSnapshotThread(e, t) {
3859
- return new Je(e, t);
3890
+ return new tt(e, t);
3860
3891
  }
3861
3892
  getSnapshotRequestKey(e) {
3862
3893
  return e.requestId || `${e.viewId}\0${e.scenePath || ""}\0${e.msgType}`;
@@ -3923,33 +3954,33 @@ class ht {
3923
3954
  if (o === h.Init) {
3924
3955
  const g = i.viewGeneration ?? (this.viewGenerationById.get(a) || 0) + 1;
3925
3956
  await this.enqueueViewTask(a, async () => {
3926
- var E, k, B;
3957
+ var W, v, B;
3927
3958
  const y = this.viewGenerationById.get(a);
3928
3959
  if (y !== void 0 && g < y)
3929
3960
  return;
3930
3961
  this.viewGenerationById.set(a, g);
3931
- const v = i.viewOwner || `${a}:${g}:${++this.ownerSequence}`, T = (E = this.master.control.viewContainerManager.getView(a)) == null ? void 0 : E.displayer, C = T == null ? void 0 : T.canvasContainerRef.current;
3932
- if (!T || !C || !l || !p) {
3962
+ 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;
3963
+ if (!T || !L || !l || !p) {
3933
3964
  this.viewOwnerById.delete(a);
3934
3965
  return;
3935
3966
  }
3936
- this.viewOwnerById.set(a, v);
3937
- const L = this.mainThreadMap.get(a);
3938
- L == null || L.destroy();
3967
+ this.viewOwnerById.set(a, S);
3968
+ const N = this.mainThreadMap.get(a);
3969
+ N == null || N.destroy();
3939
3970
  const A = this.createMainThread(a, {
3940
3971
  displayer: T,
3941
- container: C,
3972
+ container: L,
3942
3973
  layerOpt: l,
3943
3974
  master: this.master,
3944
3975
  canvasOpt: p,
3945
- viewOwner: v,
3976
+ viewOwner: S,
3946
3977
  viewGeneration: g,
3947
- mainThreadRenderMode: ((B = (k = this.master.control) == null ? void 0 : k.renderingCompatibilityDecision) == null ? void 0 : B.mainThreadRenderMode) ?? "normal",
3978
+ mainThreadRenderMode: ((B = (v = this.master.control) == null ? void 0 : v.renderingCompatibilityDecision) == null ? void 0 : B.mainThreadRenderMode) ?? "normal",
3948
3979
  post: (O) => this.post({
3949
3980
  ...O,
3950
3981
  viewId: O.viewId || a,
3951
3982
  viewGeneration: O.viewGeneration ?? g,
3952
- viewOwner: v
3983
+ viewOwner: S
3953
3984
  })
3954
3985
  });
3955
3986
  this.mainThreadMap.set(a, A), A && f && A.setCameraOpt(f), this.post({
@@ -3965,40 +3996,40 @@ class ht {
3965
3996
  continue;
3966
3997
  }
3967
3998
  if (o === h.Snapshot || o === h.BoundingBox) {
3968
- 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, v = (r = y == null ? void 0 : y.snapshotContainerRef) == null ? void 0 : r.current;
3969
- if (g && v && f) {
3970
- const T = this.getSnapshotRequestKey(i), C = this.snapshotThreadsByRequest.get(T);
3971
- C && this.disposeSnapshotThread(T, C.thread, "replaced");
3972
- const L = document.createElement("div");
3973
- L.style.width = `${f.width}px`, L.style.height = `${f.height}px`, v.append(L);
3999
+ 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;
4000
+ if (g && S && f) {
4001
+ const T = this.getSnapshotRequestKey(i), L = this.snapshotThreadsByRequest.get(T);
4002
+ L && this.disposeSnapshotThread(T, L.thread, "replaced");
4003
+ const N = document.createElement("div");
4004
+ N.style.width = `${f.width}px`, N.style.height = `${f.height}px`, S.append(N);
3974
4005
  const A = {
3975
4006
  ...he.defaultLayerOpt,
3976
4007
  offscreen: !1,
3977
4008
  width: f.width,
3978
4009
  height: f.height
3979
- }, E = {
4010
+ }, W = {
3980
4011
  ...he.defaultScreenCanvasOpt,
3981
4012
  width: f.width,
3982
4013
  height: f.height
3983
- }, k = this.createSnapshotThread(a, {
4014
+ }, v = this.createSnapshotThread(a, {
3984
4015
  displayer: g,
3985
- container: L,
4016
+ container: N,
3986
4017
  layerOpt: A,
3987
4018
  master: this.master,
3988
- canvasOpt: E,
4019
+ canvasOpt: W,
3989
4020
  post: this.post,
3990
4021
  viewOwner: this.viewOwnerById.get(a),
3991
4022
  viewGeneration: this.viewGenerationById.get(a)
3992
4023
  });
3993
4024
  this.snapshotThreadsByRequest.set(T, {
3994
- thread: k,
3995
- surface: L
3996
- }), k.on(i).then(() => {
3997
- this.disposeSnapshotThread(T, k);
4025
+ thread: v,
4026
+ surface: N
4027
+ }), v.on(i).then(() => {
4028
+ this.disposeSnapshotThread(T, v);
3998
4029
  }).catch((B) => {
3999
4030
  this.master.Logger.error(
4000
4031
  `[Appliance]: snapshot render failed; viewId=${a}; error=${B instanceof Error ? B.message : String(B)}`
4001
- ), this.disposeSnapshotThread(T, k);
4032
+ ), this.disposeSnapshotThread(T, v);
4002
4033
  });
4003
4034
  continue;
4004
4035
  }
@@ -4029,8 +4060,8 @@ class ht {
4029
4060
  continue;
4030
4061
  }
4031
4062
  if (o === h.GetImageBitMap) {
4032
- const g = this.mainThreadMap.get(a), y = this.viewGenerationById.get(a), v = this.viewOwnerById.get(a);
4033
- if (!g || i.viewGeneration !== void 0 && i.viewGeneration !== y || i.viewOwner !== void 0 && i.viewOwner !== v || this.mainThreadMap.get(a) !== g) {
4063
+ const g = this.mainThreadMap.get(a), y = this.viewGenerationById.get(a), S = this.viewOwnerById.get(a);
4064
+ if (!g || i.viewGeneration !== void 0 && i.viewGeneration !== y || i.viewOwner !== void 0 && i.viewOwner !== S || this.mainThreadMap.get(a) !== g) {
4034
4065
  this.releaseMessageBitmap(i);
4035
4066
  continue;
4036
4067
  }
@@ -4038,34 +4069,34 @@ class ht {
4038
4069
  continue;
4039
4070
  }
4040
4071
  if (o === h.TasksQueue && (n != null && n.size)) {
4041
- const g = n.get(a), y = this.mainThreadMap.get(a), v = this.viewGenerationById.get(a), T = this.viewOwnerById.get(a);
4042
- let C;
4072
+ const g = n.get(a), y = this.mainThreadMap.get(a), S = this.viewGenerationById.get(a), T = this.viewOwnerById.get(a);
4073
+ let L;
4043
4074
  if (g && y)
4044
4075
  try {
4045
4076
  await this.enqueueViewTask(a, async () => {
4046
- this.viewGenerationById.get(a) !== v || this.viewOwnerById.get(a) !== T || this.mainThreadMap.get(a) !== y || await y.on(g);
4077
+ this.viewGenerationById.get(a) !== S || this.viewOwnerById.get(a) !== T || this.mainThreadMap.get(a) !== y || await y.on(g);
4047
4078
  });
4048
- } catch (L) {
4049
- if (g.msgType !== h.UpdateCamera) throw L;
4050
- const A = De(L);
4051
- C = {
4079
+ } catch (N) {
4080
+ if (g.msgType !== h.UpdateCamera) throw N;
4081
+ const A = Pe(N);
4082
+ L = {
4052
4083
  code: A ? "RENDERER_BUSINESS_TIMEOUT" : "RENDERER_BUSINESS_ERROR",
4053
4084
  business: "updateCamera",
4054
- message: L instanceof Error ? L.message : String(L),
4055
- elapsedMs: A ? L.elapsedMs : void 0,
4056
- stage: A ? L.stage : "update-camera",
4057
- blockingWorks: A ? L.blockingWorks : void 0,
4085
+ message: N instanceof Error ? N.message : String(N),
4086
+ elapsedMs: A ? N.elapsedMs : void 0,
4087
+ stage: A ? N.stage : "update-camera",
4088
+ blockingWorks: A ? N.blockingWorks : void 0,
4058
4089
  workerType: "mainThread"
4059
4090
  };
4060
4091
  }
4061
- if (C && q(d)) {
4092
+ if (L && q(d)) {
4062
4093
  this.post({
4063
4094
  viewId: a,
4064
- viewGeneration: v,
4095
+ viewGeneration: S,
4065
4096
  viewOwner: T,
4066
4097
  cameraTaskId: d,
4067
- cameraTaskStatus: C.code === "RENDERER_BUSINESS_TIMEOUT" ? "timeout" : "failed",
4068
- cameraTaskError: C
4098
+ cameraTaskStatus: L.code === "RENDERER_BUSINESS_TIMEOUT" ? "timeout" : "failed",
4099
+ cameraTaskError: L
4069
4100
  });
4070
4101
  continue;
4071
4102
  }
@@ -4073,26 +4104,26 @@ class ht {
4073
4104
  workerTasksqueueCount: c,
4074
4105
  cameraTaskId: d,
4075
4106
  viewId: a,
4076
- viewGeneration: v,
4107
+ viewGeneration: S,
4077
4108
  viewOwner: T
4078
4109
  });
4079
4110
  continue;
4080
4111
  }
4081
4112
  if (a === ce) {
4082
4113
  const g = [...this.mainThreadMap.entries()];
4083
- for (const [y, v] of g) {
4114
+ for (const [y, S] of g) {
4084
4115
  const T = this.enqueueViewTask(y, async () => {
4085
- this.mainThreadMap.get(y) === v && (o === h.Destroy ? (v.destroy(), this.mainThreadMap.delete(y), this.viewOwnerById.delete(y), this.viewGenerationById.set(
4116
+ this.mainThreadMap.get(y) === S && (o === h.Destroy ? (S.destroy(), this.mainThreadMap.delete(y), this.viewOwnerById.delete(y), this.viewGenerationById.set(
4086
4117
  y,
4087
4118
  (this.viewGenerationById.get(y) || 0) + 1
4088
- )) : await v.on(i));
4119
+ )) : await S.on(i));
4089
4120
  });
4090
4121
  await T, this.cameraRenderQueueByView.get(y) === T && this.cameraRenderQueueByView.delete(y);
4091
4122
  }
4092
4123
  continue;
4093
4124
  }
4094
- const S = this.mainThreadMap.get(a);
4095
- if (o === h.Destroy && !S) {
4125
+ const k = this.mainThreadMap.get(a);
4126
+ if (o === h.Destroy && !k) {
4096
4127
  await this.enqueueViewTask(a, async () => {
4097
4128
  this.viewGenerationById.set(
4098
4129
  a,
@@ -4101,12 +4132,12 @@ class ht {
4101
4132
  });
4102
4133
  continue;
4103
4134
  }
4104
- if (!S)
4135
+ if (!k)
4105
4136
  continue;
4106
- const I = this.viewGenerationById.get(a), W = this.enqueueViewTask(a, async () => {
4107
- this.viewGenerationById.get(a) !== I || this.mainThreadMap.get(a) !== S || await S.on(i);
4137
+ const I = this.viewGenerationById.get(a), R = this.enqueueViewTask(a, async () => {
4138
+ this.viewGenerationById.get(a) !== I || this.mainThreadMap.get(a) !== k || await k.on(i);
4108
4139
  });
4109
- o === h.Destroy && (await W, this.mainThreadMap.get(a) === S && this.mainThreadMap.delete(a), this.viewOwnerById.delete(a), this.cameraRenderQueueByView.get(a) === W && this.cameraRenderQueueByView.delete(a), this.viewGenerationById.set(
4140
+ 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(
4110
4141
  a,
4111
4142
  i.viewGeneration ?? (I || 0) + 1
4112
4143
  ));
@@ -4114,5 +4145,5 @@ class ht {
4114
4145
  }
4115
4146
  }
4116
4147
  export {
4117
- ht as MainThreadManagerImpl
4148
+ dt as MainThreadManagerImpl
4118
4149
  };