@univerjs/drawing 0.2.4-alpha.0 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  var Pt = Object.defineProperty;
2
- var Ut = (n, e, t) => e in n ? Pt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var V = (n, e, t) => Ut(n, typeof e != "symbol" ? e + "" : e, t);
2
+ var Mt = (n, e, t) => e in n ? Pt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var V = (n, e, t) => Mt(n, typeof e != "symbol" ? e + "" : e, t);
4
4
  import { Subject as we } from "rxjs";
5
- import { sortRules as Mt, sortRulesByDesc as Nt, createIdentifier as It, Tools as kt, Inject as Rt, Injector as St, Plugin as jt, mergeOverrideWithDependencies as Tt } from "@univerjs/core";
6
- const sn = 500, on = 500, ln = 10, $t = 5 * 1024 * 1024, Wt = ["image/png", "image/jpeg", "image/jpg", "image/gif", "image/bmp"];
5
+ import { sortRules as Ut, sortRulesByDesc as Nt, Tools as kt, Plugin as Rt, mergeOverrideWithDependencies as St } from "@univerjs/core";
6
+ import { createIdentifier as It, Inject as Tt, Injector as jt } from "@wendellhu/redi";
7
+ const on = 500, ln = 500, an = 10, $t = 5 * 1024 * 1024, Wt = ["image/png", "image/jpeg", "image/jpg", "image/gif", "image/bmp"];
7
8
  var Ce = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, F = {}, Ct = {}, ct = {};
8
9
  Object.defineProperty(ct, "__esModule", { value: !0 });
9
10
  function Gt(n, e) {
@@ -52,11 +53,11 @@ var ft = {};
52
53
  if (!O)
53
54
  throw new Error(o);
54
55
  }
55
- const t = (O) => O != null && typeof O == "object" && !Array.isArray(O), s = (O, o) => (
56
+ const t = (O) => O != null && typeof O == "object" && !Array.isArray(O), i = (O, o) => (
56
57
  // All the numbers, then all the letters. Just as the gods of ascii intended.
57
58
  typeof O == typeof o ? O > o : typeof O == "string" && typeof o == "number"
58
59
  );
59
- function i(O, o) {
60
+ function s(O, o) {
60
61
  for (let c in O) {
61
62
  const h = c;
62
63
  o.write(h, O[h]);
@@ -158,7 +159,7 @@ var ft = {};
158
159
  const R = this.container.splice(h, this.container.length - h);
159
160
  this.container.push(R), this.lcIdx > -1 && (this.lcIdx = h);
160
161
  }
161
- for (this.indexes.push(this.idx), this.parents.push(this.container), this.lcIdx !== -1 && (e(s(c, this.container[this.lcIdx][0])), h = this.lcIdx + 1, this.lcIdx = -1); h < this.container.length && s(c, this.container[h][0]); )
162
+ for (this.indexes.push(this.idx), this.parents.push(this.container), this.lcIdx !== -1 && (e(i(c, this.container[this.lcIdx][0])), h = this.lcIdx + 1, this.lcIdx = -1); h < this.container.length && i(c, this.container[h][0]); )
162
163
  h++;
163
164
  if (this.indexes.push(h), this.idx = 0, h < this.container.length && this.container[h][0] === c)
164
165
  this.container = this.container[h];
@@ -204,7 +205,7 @@ var ft = {};
204
205
  ascend() {
205
206
  this.pendingDescent.length ? this.pendingDescent.pop() : super.ascend();
206
207
  }
207
- mergeTree(o, c = i) {
208
+ mergeTree(o, c = s) {
208
209
  if (o === null)
209
210
  return;
210
211
  if (e(Array.isArray(o)), o === this._op)
@@ -248,7 +249,7 @@ var ft = {};
248
249
  const Ie = J = O.getKey();
249
250
  if (pe != null) {
250
251
  let xe = !1;
251
- if (o && typeof Ie == "number" && (J = o(Ie, O.getComponent()), J < 0 && (J = ~J, xe = !0)), s(J, pe))
252
+ if (o && typeof Ie == "number" && (J = o(Ie, O.getComponent()), J < 0 && (J = ~J, xe = !0)), i(J, pe))
252
253
  return null;
253
254
  if (J === pe && !xe)
254
255
  return O;
@@ -266,7 +267,7 @@ var ft = {};
266
267
  let h, R, Z, pe;
267
268
  for (h = R = O && O.descendFirst(), Z = pe = o && o.descendFirst(); h || Z; ) {
268
269
  let J = h ? O.getKey() : null, Ie = Z ? o.getKey() : null;
269
- J !== null && Ie !== null && (s(Ie, J) ? Ie = null : J !== Ie && (J = null)), c(J == null ? Ie : J, J != null ? O : null, Ie != null ? o : null), J != null && h && (h = O.nextSibling()), Ie != null && Z && (Z = o.nextSibling());
270
+ J !== null && Ie !== null && (i(Ie, J) ? Ie = null : J !== Ie && (J = null)), c(J == null ? Ie : J, J != null ? O : null, Ie != null ? o : null), J != null && h && (h = O.nextSibling()), Ie != null && Z && (Z = o.nextSibling());
270
271
  }
271
272
  R && O.ascend(), pe && o.ascend();
272
273
  }
@@ -281,19 +282,19 @@ var ht = {};
281
282
  var it = {}, Fe = {}, vt;
282
283
  function pt() {
283
284
  return vt || (vt = 1, Object.defineProperty(Fe, "__esModule", { value: !0 }), Fe.uniToStrPos = Fe.strPosToUni = void 0, Fe.strPosToUni = (n, e = n.length) => {
284
- let t = 0, s = 0;
285
- for (; s < e; s++) {
286
- const i = n.charCodeAt(s);
287
- i >= 55296 && i <= 57343 && (t++, s++);
285
+ let t = 0, i = 0;
286
+ for (; i < e; i++) {
287
+ const s = n.charCodeAt(i);
288
+ s >= 55296 && s <= 57343 && (t++, i++);
288
289
  }
289
- if (s !== e)
290
+ if (i !== e)
290
291
  throw Error("Invalid offset - splits unicode bytes");
291
- return s - t;
292
+ return i - t;
292
293
  }, Fe.uniToStrPos = (n, e) => {
293
294
  let t = 0;
294
295
  for (; e > 0; e--) {
295
- const s = n.charCodeAt(t);
296
- t += s >= 55296 && s <= 57343 ? 2 : 1;
296
+ const i = n.charCodeAt(t);
297
+ t += i >= 55296 && i <= 57343 ? 2 : 1;
297
298
  }
298
299
  return t;
299
300
  }), Fe;
@@ -331,7 +332,7 @@ function at() {
331
332
  if (typeof _ == "number")
332
333
  throw Error("Op has a trailing skip");
333
334
  };
334
- function s(f, _) {
335
+ function i(f, _) {
335
336
  let w = 0, L = 0;
336
337
  for (let z = 0; z < f.length; z++) {
337
338
  const H = f[z];
@@ -348,14 +349,14 @@ function at() {
348
349
  }
349
350
  }
350
351
  }
351
- n.eachOp = s;
352
- function i(f, _) {
352
+ n.eachOp = i;
353
+ function s(f, _) {
353
354
  const w = [], L = a(w);
354
- return s(f, (z, H, De) => {
355
+ return i(f, (z, H, De) => {
355
356
  L(_(z, H, De));
356
357
  }), o(w);
357
358
  }
358
- const d = (f) => f, l = (f) => i(f, d);
359
+ const d = (f) => f, l = (f) => s(f, d);
359
360
  n.dlen = (f) => typeof f == "number" ? f : e.strPosToUni(f);
360
361
  const a = (f) => (_) => {
361
362
  if (!(!_ || _.d === 0 || _.d === "")) if (f.length === 0)
@@ -492,10 +493,10 @@ function at() {
492
493
  return f;
493
494
  }, Z = (f, _) => typeof f == "number" ? R(f, _) : f.map((w) => R(w, _));
494
495
  function pe(f, _, w) {
495
- return i(f, (L, z) => typeof L == "object" && typeof L.d == "number" ? { d: w.slice(_, z, z + L.d) } : L);
496
+ return s(f, (L, z) => typeof L == "object" && typeof L.d == "number" ? { d: w.slice(_, z, z + L.d) } : L);
496
497
  }
497
498
  function J(f) {
498
- return i(f, (_) => {
499
+ return s(f, (_) => {
499
500
  switch (typeof _) {
500
501
  case "object":
501
502
  if (typeof _.d == "number")
@@ -509,11 +510,11 @@ function at() {
509
510
  });
510
511
  }
511
512
  function Ie(f) {
512
- return i(f, (_) => typeof _ == "object" && typeof _.d == "string" ? { d: e.strPosToUni(_.d) } : _);
513
+ return s(f, (_) => typeof _ == "object" && typeof _.d == "string" ? { d: e.strPosToUni(_.d) } : _);
513
514
  }
514
515
  function xe(f) {
515
516
  let _ = !0;
516
- return s(f, (w) => {
517
+ return i(f, (w) => {
517
518
  typeof w == "object" && typeof w.d == "number" && (_ = !1);
518
519
  }), _;
519
520
  }
@@ -574,27 +575,27 @@ function at() {
574
575
  n.default = ve;
575
576
  }(st)), st;
576
577
  }
577
- var Qe = {}, bt;
578
+ var Qe = {}, mt;
578
579
  function xt() {
579
- if (bt) return Qe;
580
- bt = 1, Object.defineProperty(Qe, "__esModule", { value: !0 });
580
+ if (mt) return Qe;
581
+ mt = 1, Object.defineProperty(Qe, "__esModule", { value: !0 });
581
582
  const n = at(), e = pt();
582
- function t(s, i) {
583
+ function t(i, s) {
583
584
  return {
584
585
  // Returns the text content of the document
585
- get: s,
586
+ get: i,
586
587
  // Returns the number of characters in the string
587
588
  getLength() {
588
- return s().length;
589
+ return i().length;
589
590
  },
590
591
  // Insert the specified text at the given position in the document
591
592
  insert(d, l, a) {
592
- const E = e.strPosToUni(s(), d);
593
- return i([E, l], a);
593
+ const E = e.strPosToUni(i(), d);
594
+ return s([E, l], a);
594
595
  },
595
596
  remove(d, l, a) {
596
- const E = e.strPosToUni(s(), d);
597
- return i([E, { d: l }], a);
597
+ const E = e.strPosToUni(i(), d);
598
+ return s([E, { d: l }], a);
598
599
  },
599
600
  // When you use this API, you should implement these two methods
600
601
  // in your editing context.
@@ -618,9 +619,9 @@ function xt() {
618
619
  }
619
620
  return Qe.default = t, t.provides = { text: !0 }, Qe;
620
621
  }
621
- var mt;
622
+ var bt;
622
623
  function Lt() {
623
- return mt || (mt = 1, function(n) {
624
+ return bt || (bt = 1, function(n) {
624
625
  var e = Ce && Ce.__createBinding || (Object.create ? function(c, h, R, Z) {
625
626
  Z === void 0 && (Z = R), Object.defineProperty(c, Z, { enumerable: !0, get: function() {
626
627
  return h[R];
@@ -631,16 +632,16 @@ function Lt() {
631
632
  Object.defineProperty(c, "default", { enumerable: !0, value: h });
632
633
  } : function(c, h) {
633
634
  c.default = h;
634
- }), s = Ce && Ce.__importStar || function(c) {
635
+ }), i = Ce && Ce.__importStar || function(c) {
635
636
  if (c && c.__esModule) return c;
636
637
  var h = {};
637
638
  if (c != null) for (var R in c) Object.hasOwnProperty.call(c, R) && e(h, c, R);
638
639
  return t(h, c), h;
639
- }, i = Ce && Ce.__importDefault || function(c) {
640
+ }, s = Ce && Ce.__importDefault || function(c) {
640
641
  return c && c.__esModule ? c : { default: c };
641
642
  };
642
643
  Object.defineProperty(n, "__esModule", { value: !0 }), n.type = n.remove = n.insert = void 0;
643
- const d = pt(), l = s(at()), a = i(xt()), E = {
644
+ const d = pt(), l = i(at()), a = s(xt()), E = {
644
645
  create(c) {
645
646
  return c;
646
647
  },
@@ -687,15 +688,15 @@ function Lt() {
687
688
  Object.defineProperty(n, "__esModule", {
688
689
  value: !0
689
690
  }), n.editOp = n.replaceOp = n.insertOp = n.moveOp = n.removeOp = n.type = void 0;
690
- const t = e(ct), s = e(dt), i = ft, d = ht;
691
+ const t = e(ct), i = e(dt), s = ft, d = ht;
691
692
  function l(r, u) {
692
693
  if (!r) throw new Error(u);
693
694
  }
694
695
  n.type = {
695
696
  name: "json1",
696
697
  uri: "http://sharejs.org/types/JSONv1",
697
- readCursor: i.readCursor,
698
- writeCursor: i.writeCursor,
698
+ readCursor: s.readCursor,
699
+ writeCursor: s.writeCursor,
699
700
  create: (r) => r,
700
701
  isNoop: (r) => r == null,
701
702
  setDebug(r) {
@@ -730,9 +731,9 @@ function Lt() {
730
731
  function h(r, u, y) {
731
732
  return typeof u == "number" ? (l(r != null, "Container is missing for key"), l(Array.isArray(r), "Cannot use numerical key for object container"), l(r.length >= u, "Cannot insert into out of bounds index"), r.splice(u, 0, y)) : (l(E(r), "Cannot insert into missing item"), l(r[u] === void 0, "Trying to overwrite value at key. Your op needs to remove it first"), r[u] = y), y;
732
733
  }
733
- n.removeOp = (r, u = !0) => i.writeCursor().writeAtPath(r, "r", u).get(), n.moveOp = (r, u) => i.writeCursor().writeMove(r, u).get(), n.insertOp = (r, u) => i.writeCursor().writeAtPath(r, "i", u).get(), n.replaceOp = (r, u, y) => i.writeCursor().at(r, (D) => {
734
+ n.removeOp = (r, u = !0) => s.writeCursor().writeAtPath(r, "r", u).get(), n.moveOp = (r, u) => s.writeCursor().writeMove(r, u).get(), n.insertOp = (r, u) => s.writeCursor().writeAtPath(r, "i", u).get(), n.replaceOp = (r, u, y) => s.writeCursor().at(r, (D) => {
734
735
  D.write("r", u), D.write("i", y);
735
- }).get(), n.editOp = (r, u, y, D = !1) => i.writeCursor().at(r, (b) => _(b, u, y, D)).get();
736
+ }).get(), n.editOp = (r, u, y, D = !1) => s.writeCursor().at(r, (m) => _(m, u, y, D)).get();
736
737
  const R = (r, u) => r != null && (typeof u == "number" ? Array.isArray(r) : typeof r == "object"), Z = (r, u) => R(r, u) ? r[u] : void 0, pe = {};
737
738
  function J(r) {
738
739
  let u = r.type ? r.type : r;
@@ -753,8 +754,8 @@ function Lt() {
753
754
  transform: (r) => r
754
755
  });
755
756
  const ve = (r) => r == null ? null : r.et ? Ie(r.et) : r.es ? pe["text-unicode"] : r.ena != null ? pe.number : null, f = (r) => r.es ? r.es : r.ena != null ? r.ena : r.e, _ = (r, u, y, D = !1) => {
756
- const [b, C] = typeof u == "string" ? [Ie(u), u] : [u, u.name];
757
- !D && b.isNoop && b.isNoop(y) || (C === "number" ? r.write("ena", y) : C === "text-unicode" ? r.write("es", y) : (r.write("et", C), r.write("e", y)));
757
+ const [m, C] = typeof u == "string" ? [Ie(u), u] : [u, u.name];
758
+ !D && m.isNoop && m.isNoop(y) || (C === "number" ? r.write("ena", y) : C === "text-unicode" ? r.write("es", y) : (r.write("et", C), r.write("e", y)));
758
759
  };
759
760
  function w(r) {
760
761
  l(typeof r == "number"), l(r >= 0), l(r === (0 | r));
@@ -765,282 +766,282 @@ function Lt() {
765
766
  function z(r) {
766
767
  if (r === null) return;
767
768
  const u = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Set(), D = (C) => {
768
- let $ = !0, j = !1;
769
+ let $ = !0, T = !1;
769
770
  for (let p in C) {
770
771
  const v = C[p];
771
772
  if ($ = !1, l(p === "p" || p === "r" || p === "d" || p === "i" || p === "e" || p === "es" || p === "ena" || p === "et", "Invalid component item '" + p + "'"), p === "p") w(v), l(!u.has(v)), u.add(v), l(C.r === void 0);
772
773
  else if (p === "d") w(v), l(!y.has(v)), y.add(v), l(C.i === void 0);
773
774
  else if (p === "e" || p === "es" || p === "ena") {
774
- l(!j), j = !0;
775
- const m = ve(C);
776
- l(m, "Missing type in edit"), m.checkValidOp && m.checkValidOp(f(C));
775
+ l(!T), T = !0;
776
+ const b = ve(C);
777
+ l(b, "Missing type in edit"), b.checkValidOp && b.checkValidOp(f(C));
777
778
  }
778
779
  }
779
780
  l(!$);
780
- }, b = (C, $, j) => {
781
+ }, m = (C, $, T) => {
781
782
  if (!Array.isArray(C)) throw Error("Op must be null or a list");
782
783
  if (C.length === 0) throw Error("Empty descent");
783
784
  $ || L(C[0]);
784
- let p = 1, v = 0, m = 0;
785
+ let p = 1, v = 0, b = 0;
785
786
  for (let I = 0; I < C.length; I++) {
786
- const T = C[I];
787
- if (l(T != null), Array.isArray(T)) {
788
- const G = b(T, !1);
787
+ const j = C[I];
788
+ if (l(j != null), Array.isArray(j)) {
789
+ const G = m(j, !1);
789
790
  if (v) {
790
- const g = typeof m, N = typeof G;
791
- g === N ? l(m < G, "descent keys are not in order") : l(g === "number" && N === "string");
791
+ const g = typeof b, N = typeof G;
792
+ g === N ? l(b < G, "descent keys are not in order") : l(g === "number" && N === "string");
792
793
  }
793
- m = G, v++, p = 3;
794
- } else typeof T == "object" ? (l(p === 1, `Prev not scalar - instead ${p}`), D(T), p = 2) : (l(p !== 3), L(T), l(i.isValidPathItem(T), "Invalid path key"), p = 1);
794
+ b = G, v++, p = 3;
795
+ } else typeof j == "object" ? (l(p === 1, `Prev not scalar - instead ${p}`), D(j), p = 2) : (l(p !== 3), L(j), l(s.isValidPathItem(j), "Invalid path key"), p = 1);
795
796
  }
796
797
  return l(v !== 1, "Operation makes multiple descents. Remove some []"), l(p === 2 || p === 3), C[0];
797
798
  };
798
- b(r, !0), l(u.size === y.size, "Mismatched picks and drops in op");
799
+ m(r, !0), l(u.size === y.size, "Mismatched picks and drops in op");
799
800
  for (let C = 0; C < u.size; C++) l(u.has(C)), l(y.has(C));
800
801
  }
801
802
  function H(r) {
802
803
  let u = 0, y = [];
803
- const D = i.writeCursor();
804
- return D.mergeTree(r, (b, C) => {
805
- const $ = ve(b);
804
+ const D = s.writeCursor();
805
+ return D.mergeTree(r, (m, C) => {
806
+ const $ = ve(m);
806
807
  if ($) {
807
- const p = f(b);
808
+ const p = f(m);
808
809
  _(C, $, $.normalize ? $.normalize(p) : p);
809
810
  }
810
- for (const p of ["r", "p", "i", "d"]) if (b[p] !== void 0) {
811
- const v = p === "p" || p === "d" ? (j = b[p], y[j] == null && (y[j] = u++), y[j]) : b[p];
811
+ for (const p of ["r", "p", "i", "d"]) if (m[p] !== void 0) {
812
+ const v = p === "p" || p === "d" ? (T = m[p], y[T] == null && (y[T] = u++), y[T]) : m[p];
812
813
  C.write(p, v);
813
814
  }
814
- var j;
815
+ var T;
815
816
  }), D.get();
816
817
  }
817
818
  function De(r, u) {
818
819
  if (z(u), u === null) return r;
819
820
  const y = [];
820
- return function D(b, C) {
821
- let $ = b, j = 0, p = {
822
- root: b
823
- }, v = 0, m = p, I = "root";
824
- function T() {
825
- for (; v < j; v++) {
821
+ return function D(m, C) {
822
+ let $ = m, T = 0, p = {
823
+ root: m
824
+ }, v = 0, b = p, I = "root";
825
+ function j() {
826
+ for (; v < T; v++) {
826
827
  let G = C[v];
827
- typeof G != "object" && (l(R(m, I)), m = m[I] = W(m[I]), I = G);
828
+ typeof G != "object" && (l(R(b, I)), b = b[I] = W(b[I]), I = G);
828
829
  }
829
830
  }
830
- for (; j < C.length; j++) {
831
- const G = C[j];
831
+ for (; T < C.length; T++) {
832
+ const G = C[T];
832
833
  if (Array.isArray(G)) {
833
834
  const g = D($, G);
834
- g !== $ && g !== void 0 && (T(), $ = m[I] = g);
835
+ g !== $ && g !== void 0 && (j(), $ = b[I] = g);
835
836
  } else if (typeof G == "object") {
836
- G.d != null ? (T(), $ = h(m, I, y[G.d])) : G.i !== void 0 && (T(), $ = h(m, I, G.i));
837
+ G.d != null ? (j(), $ = h(b, I, y[G.d])) : G.i !== void 0 && (j(), $ = h(b, I, G.i));
837
838
  const g = ve(G);
838
- if (g) T(), $ = m[I] = g.apply($, f(G));
839
+ if (g) j(), $ = b[I] = g.apply($, f(G));
839
840
  else if (G.e !== void 0) throw Error("Subtype " + G.et + " undefined");
840
841
  } else $ = Z($, G);
841
842
  }
842
843
  return p.root;
843
- }(r = function D(b, C) {
844
+ }(r = function D(m, C) {
844
845
  const $ = [];
845
- let j = 0;
846
- for (; j < C.length; j++) {
847
- const I = C[j];
846
+ let T = 0;
847
+ for (; T < C.length; T++) {
848
+ const I = C[T];
848
849
  if (Array.isArray(I)) break;
849
- typeof I != "object" && ($.push(b), b = Z(b, I));
850
+ typeof I != "object" && ($.push(m), m = Z(m, I));
850
851
  }
851
- for (let I = C.length - 1; I >= j; I--) b = D(b, C[I]);
852
- for (--j; j >= 0; j--) {
853
- const I = C[j];
852
+ for (let I = C.length - 1; I >= T; I--) m = D(m, C[I]);
853
+ for (--T; T >= 0; T--) {
854
+ const I = C[T];
854
855
  if (typeof I != "object") {
855
- const T = $.pop();
856
- b = b === Z(T, I) ? T : b === void 0 ? c(T, I) : (v = I, m = b, (p = W(p = T))[v] = m, p);
857
- } else O(I) && (l(b !== void 0, "Cannot pick up or remove undefined"), I.p != null && (y[I.p] = b), b = void 0);
856
+ const j = $.pop();
857
+ m = m === Z(j, I) ? j : m === void 0 ? c(j, I) : (v = I, b = m, (p = W(p = j))[v] = b, p);
858
+ } else O(I) && (l(m !== void 0, "Cannot pick up or remove undefined"), I.p != null && (y[I.p] = m), m = void 0);
858
859
  }
859
- var p, v, m;
860
- return b;
860
+ var p, v, b;
861
+ return m;
861
862
  }(r, u), u);
862
863
  }
863
864
  function ue(r, u) {
864
865
  r = r.slice(), z(u);
865
- const y = i.readCursor(u);
866
- let D, b, C = !1;
866
+ const y = s.readCursor(u);
867
+ let D, m, C = !1;
867
868
  const $ = [];
868
869
  for (let p = 0; ; p++) {
869
- const v = r[p], m = y.getComponent();
870
- if (m && (m.r !== void 0 ? C = !0 : m.p != null && (C = !1, D = m.p, b = p)), p >= r.length) break;
870
+ const v = r[p], b = y.getComponent();
871
+ if (b && (b.r !== void 0 ? C = !0 : b.p != null && (C = !1, D = b.p, m = p)), p >= r.length) break;
871
872
  let I = 0;
872
- const T = i.advancer(y, void 0, (g, N) => {
873
+ const j = s.advancer(y, void 0, (g, N) => {
873
874
  O(N) && I++;
874
875
  });
875
- $.unshift(T);
876
- const G = T(v);
876
+ $.unshift(j);
877
+ const G = j(v);
877
878
  if (typeof v == "number" && (r[p] -= I), !G) break;
878
879
  }
879
880
  if ($.forEach((p) => p.end()), C) return null;
880
- const j = () => {
881
+ const T = () => {
881
882
  let p = 0;
882
883
  if (D != null) {
883
884
  const v = y.getPath();
884
- p = v.length, r = v.concat(r.slice(b));
885
+ p = v.length, r = v.concat(r.slice(m));
885
886
  }
886
887
  for (; p < r.length; p++) {
887
- const v = r[p], m = a(y), I = ve(m);
888
+ const v = r[p], b = a(y), I = ve(b);
888
889
  if (I) {
889
- const g = f(m);
890
+ const g = f(b);
890
891
  I.transformPosition && (r[p] = I.transformPosition(r[p], g));
891
892
  break;
892
893
  }
893
- let T = 0;
894
- const G = i.advancer(y, (g, N) => o(N) ? ~(g - T) : g - T, (g, N) => {
895
- o(N) && T++;
894
+ let j = 0;
895
+ const G = s.advancer(y, (g, N) => o(N) ? ~(g - j) : g - j, (g, N) => {
896
+ o(N) && j++;
896
897
  })(v);
897
- if (typeof v == "number" && (r[p] += T), !G) break;
898
+ if (typeof v == "number" && (r[p] += j), !G) break;
898
899
  }
899
900
  };
900
901
  return D != null ? y.eachDrop(null, (p) => {
901
- p === D && j();
902
- }) : j(), r;
902
+ p === D && T();
903
+ }) : T(), r;
903
904
  }
904
905
  function ne(r, u) {
905
906
  if (z(r), z(u), r == null) return u;
906
907
  if (u == null) return r;
907
908
  let y = 0;
908
- const D = i.readCursor(r), b = i.readCursor(u), C = i.writeCursor(), $ = [], j = [], p = [], v = [], m = [], I = [], T = /* @__PURE__ */ new Set();
909
+ const D = s.readCursor(r), m = s.readCursor(u), C = s.writeCursor(), $ = [], T = [], p = [], v = [], b = [], I = [], j = /* @__PURE__ */ new Set();
909
910
  D.traverse(null, (g) => {
910
911
  g.p != null && (p[g.p] = D.clone());
911
- }), b.traverse(null, (g) => {
912
- g.d != null && (v[g.d] = b.clone());
912
+ }), m.traverse(null, (g) => {
913
+ g.d != null && (v[g.d] = m.clone());
913
914
  });
914
- const G = i.writeCursor();
915
- return function g(N, re, te, K, se, Te, be, _e) {
915
+ const G = s.writeCursor();
916
+ return function g(N, re, te, K, se, je, me, _e) {
916
917
  l(re || te);
917
- const oe = a(re), Pe = a(te), Me = !!Pe && Pe.r !== void 0, Le = !!oe && oe.i !== void 0, Ue = oe ? oe.d : null, Ee = Pe ? Pe.p : null, $e = (Te || Me) && Ee == null;
918
- if (Ee != null) K = v[Ee], be = j[Ee] = new i.WriteCursor();
918
+ const oe = a(re), Pe = a(te), Ue = !!Pe && Pe.r !== void 0, Le = !!oe && oe.i !== void 0, Me = oe ? oe.d : null, Ee = Pe ? Pe.p : null, $e = (je || Ue) && Ee == null;
919
+ if (Ee != null) K = v[Ee], me = T[Ee] = new s.WriteCursor();
919
920
  else if (Pe && Pe.r !== void 0) K = null;
920
921
  else {
921
922
  const P = a(K);
922
923
  P && P.d != null && (K = null);
923
924
  }
924
925
  const Q = a(K);
925
- if (Ue != null) if (N = p[Ue], _e = $[Ue] = new i.WriteCursor(), $e) Te && !Me && _e.write("r", !0);
926
+ if (Me != null) if (N = p[Me], _e = $[Me] = new s.WriteCursor(), $e) je && !Ue && _e.write("r", !0);
926
927
  else {
927
- const P = m[Ue] = y++;
928
- be.write("d", P);
928
+ const P = b[Me] = y++;
929
+ me.write("d", P);
929
930
  }
930
931
  else if (oe && oe.i !== void 0) N = null;
931
932
  else {
932
933
  const P = a(N);
933
934
  P && P.p != null && (N = null);
934
935
  }
935
- let U;
936
- Le ? (l(se === void 0), U = oe.i) : U = se;
937
- const B = (Ee == null ? !Le || Te || Me : U === void 0) ? null : be.getComponent();
936
+ let M;
937
+ Le ? (l(se === void 0), M = oe.i) : M = se;
938
+ const B = (Ee == null ? !Le || je || Ue : M === void 0) ? null : me.getComponent();
938
939
  if (Ee != null) {
939
940
  if (!(se !== void 0 || Le)) {
940
- const P = Ue != null ? m[Ue] : y++;
941
+ const P = Me != null ? b[Me] : y++;
941
942
  I[Ee] = P, _e.write("p", P);
942
943
  }
943
- } else Me && (Le || se !== void 0 || (Pe.r, _e.write("r", Pe.r)));
944
- const M = $e ? null : ve(oe), A = ve(Q);
945
- if ((M || A) && (M && M.name, A && A.name), M && A) {
946
- l(M === A);
947
- const P = f(oe), x = f(Q), he = M.compose(P, x);
948
- _(be, M, he), T.add(Q);
949
- } else M ? _(be, M, f(oe)) : A && (_(be, A, f(Q)), T.add(Q));
950
- const k = typeof U == "object" && U != null;
944
+ } else Ue && (Le || se !== void 0 || (Pe.r, _e.write("r", Pe.r)));
945
+ const U = $e ? null : ve(oe), A = ve(Q);
946
+ if ((U || A) && (U && U.name, A && A.name), U && A) {
947
+ l(U === A);
948
+ const P = f(oe), x = f(Q), he = U.compose(P, x);
949
+ _(me, U, he), j.add(Q);
950
+ } else U ? _(me, U, f(oe)) : A && (_(me, A, f(Q)), j.add(Q));
951
+ const k = typeof M == "object" && M != null;
951
952
  let X = !1, Y = 0, ee = 0, fe = 0, de = 0, le = 0;
952
- const ye = i.advancer(K, (P, x) => o(x) ? de - P - 1 : P - de, (P, x) => {
953
+ const ye = s.advancer(K, (P, x) => o(x) ? de - P - 1 : P - de, (P, x) => {
953
954
  o(x) && de++;
954
- }), q = i.advancer(N, (P, x) => O(x) ? Y - P - 1 : P - Y, (P, x) => {
955
+ }), q = s.advancer(N, (P, x) => O(x) ? Y - P - 1 : P - Y, (P, x) => {
955
956
  O(x) && Y++;
956
957
  });
957
- if (i.eachChildOf(re, te, (P, x, he) => {
958
- let me, We, He = P, Ne = P, Ye = P;
958
+ if (s.eachChildOf(re, te, (P, x, he) => {
959
+ let be, We, He = P, Ne = P, Ye = P;
959
960
  if (typeof P == "number") {
960
961
  let Oe = P + fe;
961
962
  We = ye(Oe), Ne = Oe + de;
962
963
  let ce = P + ee;
963
- me = q(ce), o(a(We)) && (me = null), He = ce + Y, Ye = P + le, l(He >= 0, "p1PickKey is negative"), l(Ne >= 0, "p2DropKey is negative");
964
+ be = q(ce), o(a(We)) && (be = null), He = ce + Y, Ye = P + le, l(He >= 0, "p1PickKey is negative"), l(Ne >= 0, "p2DropKey is negative");
964
965
  const ke = o(a(x)), Ge = O(a(he));
965
966
  (ke || Ge && !$e) && le--, ke && ee--, Ge && fe--;
966
- } else me = q(P), We = ye(P);
967
- _e.descend(He), be.descend(Ne);
968
- const ze = k && !o(a(x)) ? U[Ye] : void 0, Se = g(me, x, he, We, ze, $e, be, _e);
969
- var je, S, ie;
970
- k && !$e ? ze !== Se && (X || (U = Array.isArray(U) ? U.slice() : Object.assign({}, U), X = !0), je = U, ie = Se, typeof (S = Ye) == "number" ? (l(Array.isArray(je)), l(S < je.length)) : (l(!Array.isArray(je)), l(je[S] !== void 0)), ie === void 0 ? typeof S == "number" ? je.splice(S, 1) : delete je[S] : je[S] = ie) : l(Se === void 0), be.ascend(), _e.ascend();
971
- }), q.end(), ye.end(), B != null) B.i = U;
972
- else if (!Te && !Me && Ee == null) return U;
973
- }(D, D.clone(), b, b.clone(), void 0, !1, C, G), C.reset(), C.mergeTree(G.get()), C.reset(), C.get(), $.map((g) => g.get()), j.map((g) => g.get()), D.traverse(C, (g, N) => {
967
+ } else be = q(P), We = ye(P);
968
+ _e.descend(He), me.descend(Ne);
969
+ const ze = k && !o(a(x)) ? M[Ye] : void 0, Se = g(be, x, he, We, ze, $e, me, _e);
970
+ var Te, S, ie;
971
+ k && !$e ? ze !== Se && (X || (M = Array.isArray(M) ? M.slice() : Object.assign({}, M), X = !0), Te = M, ie = Se, typeof (S = Ye) == "number" ? (l(Array.isArray(Te)), l(S < Te.length)) : (l(!Array.isArray(Te)), l(Te[S] !== void 0)), ie === void 0 ? typeof S == "number" ? Te.splice(S, 1) : delete Te[S] : Te[S] = ie) : l(Se === void 0), me.ascend(), _e.ascend();
972
+ }), q.end(), ye.end(), B != null) B.i = M;
973
+ else if (!je && !Ue && Ee == null) return M;
974
+ }(D, D.clone(), m, m.clone(), void 0, !1, C, G), C.reset(), C.mergeTree(G.get()), C.reset(), C.get(), $.map((g) => g.get()), T.map((g) => g.get()), D.traverse(C, (g, N) => {
974
975
  const re = g.p;
975
976
  if (re != null) {
976
- const te = m[re];
977
+ const te = b[re];
977
978
  te != null && N.write("p", te);
978
979
  const K = $[re];
979
980
  K && K.get(), K && N.mergeTree(K.get());
980
981
  } else g.r !== void 0 && N.write("r", g.r);
981
- }), C.reset(), C.get(), b.traverse(C, (g, N) => {
982
+ }), C.reset(), C.get(), m.traverse(C, (g, N) => {
982
983
  const re = g.d;
983
984
  if (re != null) {
984
985
  const K = I[re];
985
986
  K != null && N.write("d", K);
986
- const se = j[re];
987
+ const se = T[re];
987
988
  se && N.mergeTree(se.get());
988
989
  } else g.i !== void 0 && N.write("i", g.i);
989
990
  const te = ve(g);
990
- te && !T.has(g) && _(N, te, f(g));
991
+ te && !j.has(g) && _(N, te, f(g));
991
992
  }), C.get();
992
993
  }
993
994
  function ae(r) {
994
995
  if (r == null) return null;
995
- const u = new i.ReadCursor(r), y = new i.WriteCursor();
996
+ const u = new s.ReadCursor(r), y = new s.WriteCursor();
996
997
  let D;
997
- const b = [], C = [];
998
- return function $(j, p, v) {
999
- const m = j.getComponent();
1000
- let I, T = !1;
1001
- if (m) {
1002
- m.p != null && (p.write("d", m.p), b[m.p] = j.clone()), m.r !== void 0 && p.write("i", m.r), m.d != null && (p.write("p", m.d), v = void 0), m.i !== void 0 && (v = I = m.i);
1003
- const g = ve(m);
1004
- g && (v === void 0 ? (D || (D = /* @__PURE__ */ new Set()), D.add(m)) : (f(m), v = g.apply(v, f(m)), T = !0));
998
+ const m = [], C = [];
999
+ return function $(T, p, v) {
1000
+ const b = T.getComponent();
1001
+ let I, j = !1;
1002
+ if (b) {
1003
+ b.p != null && (p.write("d", b.p), m[b.p] = T.clone()), b.r !== void 0 && p.write("i", b.r), b.d != null && (p.write("p", b.d), v = void 0), b.i !== void 0 && (v = I = b.i);
1004
+ const g = ve(b);
1005
+ g && (v === void 0 ? (D || (D = /* @__PURE__ */ new Set()), D.add(b)) : (f(b), v = g.apply(v, f(b)), j = !0));
1005
1006
  }
1006
1007
  let G = 0;
1007
- for (const g of j) {
1008
+ for (const g of T) {
1008
1009
  p.descend(g);
1009
1010
  const N = typeof g == "number" ? g - G : g, re = Z(v, N);
1010
- o(j.getComponent()) && G++;
1011
- const te = $(j, p, re);
1011
+ o(T.getComponent()) && G++;
1012
+ const te = $(T, p, re);
1012
1013
  if (v !== void 0 && te !== void 0) {
1013
- if (T || (T = !0, v = W(v)), !R(v, N)) throw Error("Cannot modify child - invalid operation");
1014
+ if (j || (j = !0, v = W(v)), !R(v, N)) throw Error("Cannot modify child - invalid operation");
1014
1015
  v[N] = te;
1015
1016
  }
1016
1017
  p.ascend();
1017
1018
  }
1018
- if (I === void 0) return T ? v : void 0;
1019
+ if (I === void 0) return j ? v : void 0;
1019
1020
  p.write("r", v);
1020
- }(u, y, void 0), D && (y.reset(), function $(j, p, v) {
1021
- const m = p.getComponent();
1022
- if (m) {
1023
- const g = m.d;
1024
- if (g != null && (j = b[g], v = C[g] = i.writeCursor()), D.has(m)) {
1025
- const N = ve(m);
1021
+ }(u, y, void 0), D && (y.reset(), function $(T, p, v) {
1022
+ const b = p.getComponent();
1023
+ if (b) {
1024
+ const g = b.d;
1025
+ if (g != null && (T = m[g], v = C[g] = s.writeCursor()), D.has(b)) {
1026
+ const N = ve(b);
1026
1027
  if (!N.invert) throw Error(`Cannot invert subtype ${N.name}`);
1027
- _(v, N, N.invert(f(m)));
1028
+ _(v, N, N.invert(f(b)));
1028
1029
  }
1029
1030
  }
1030
- let I = 0, T = 0;
1031
- const G = i.advancer(j, (g, N) => O(N) ? I - g - 1 : g - I, (g, N) => {
1031
+ let I = 0, j = 0;
1032
+ const G = s.advancer(T, (g, N) => O(N) ? I - g - 1 : g - I, (g, N) => {
1032
1033
  O(N) && I++;
1033
1034
  });
1034
1035
  for (const g of p) if (typeof g == "number") {
1035
- const N = g - T, re = G(N), te = N + I;
1036
- v.descend(te), $(re, p, v), o(p.getComponent()) && T++, v.ascend();
1036
+ const N = g - j, re = G(N), te = N + I;
1037
+ v.descend(te), $(re, p, v), o(p.getComponent()) && j++, v.ascend();
1037
1038
  } else v.descend(g), $(G(g), p, v), v.ascend();
1038
1039
  G.end();
1039
- }(u.clone(), u, y), C.length && (y.reset(), u.traverse(y, ($, j) => {
1040
+ }(u.clone(), u, y), C.length && (y.reset(), u.traverse(y, ($, T) => {
1040
1041
  const p = $.p;
1041
1042
  if (p != null) {
1042
1043
  const v = C[p];
1043
- v && v.get(), v && j.mergeTree(v.get());
1044
+ v && v.get(), v && T.mergeTree(v.get());
1044
1045
  }
1045
1046
  }))), y.get();
1046
1047
  }
@@ -1050,46 +1051,46 @@ function Lt() {
1050
1051
  var v;
1051
1052
  return p.r !== void 0 || ((v = ve(p)) === null || v === void 0 ? void 0 : v.makeInvertible) != null;
1052
1053
  })) return r;
1053
- const y = new i.ReadCursor(r), D = new i.WriteCursor();
1054
- let b = !1;
1055
- const C = [], $ = [], j = (p, v, m) => {
1054
+ const y = new s.ReadCursor(r), D = new s.WriteCursor();
1055
+ let m = !1;
1056
+ const C = [], $ = [], T = (p, v, b) => {
1056
1057
  const I = p.getComponent();
1057
- let T = !1;
1058
+ let j = !1;
1058
1059
  if (I) {
1059
1060
  I.d != null && v.write("d", I.d), I.i !== void 0 && v.write("i", I.i);
1060
1061
  const g = I.p;
1061
- if (g != null && (C[g] = p.clone(), l(m !== void 0, "Operation picks up at an invalid key"), $[g] = m, v.write("p", I.p)), I.r !== void 0 && m === void 0) throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");
1062
+ if (g != null && (C[g] = p.clone(), l(b !== void 0, "Operation picks up at an invalid key"), $[g] = b, v.write("p", I.p)), I.r !== void 0 && b === void 0) throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");
1062
1063
  const N = ve(I);
1063
- N && (N.makeInvertible ? b = !0 : _(v, N, f(I), !0));
1064
+ N && (N.makeInvertible ? m = !0 : _(v, N, f(I), !0));
1064
1065
  }
1065
1066
  let G = 0;
1066
1067
  for (const g of p) {
1067
1068
  v.descend(g);
1068
- const N = typeof g == "number" ? g - G : g, re = Z(m, N), te = j(p, v, re);
1069
- re !== te && (T || (T = !0, m = W(m)), te === void 0 ? (m = c(m, N), typeof g == "number" && G++) : m[N] = te), v.ascend();
1069
+ const N = typeof g == "number" ? g - G : g, re = Z(b, N), te = T(p, v, re);
1070
+ re !== te && (j || (j = !0, b = W(b)), te === void 0 ? (b = c(b, N), typeof g == "number" && G++) : b[N] = te), v.ascend();
1070
1071
  }
1071
- return I && (I.r !== void 0 ? (v.write("r", s.default(m)), m = void 0) : I.p != null && (m = void 0)), m;
1072
+ return I && (I.r !== void 0 ? (v.write("r", i.default(b)), b = void 0) : I.p != null && (b = void 0)), b;
1072
1073
  };
1073
- return j(y, D, u), D.get(), b && (D.reset(), function p(v, m, I, T, G) {
1074
- const g = m.getComponent();
1074
+ return T(y, D, u), D.get(), m && (D.reset(), function p(v, b, I, j, G) {
1075
+ const g = b.getComponent();
1075
1076
  if (g) {
1076
- g.i !== void 0 ? (T = g.i, G = !0) : g.d != null && (T = $[g.d], v = C[g.d], G = !1, g.d);
1077
+ g.i !== void 0 ? (j = g.i, G = !0) : g.d != null && (j = $[g.d], v = C[g.d], G = !1, g.d);
1077
1078
  let K = ve(g);
1078
1079
  if (K && K.makeInvertible) {
1079
1080
  const se = f(g);
1080
- _(I, K, K.makeInvertible(se, T), !0);
1081
+ _(I, K, K.makeInvertible(se, j), !0);
1081
1082
  }
1082
1083
  }
1083
1084
  let N = 0, re = 0;
1084
- const te = i.advancer(v, (K, se) => O(se) ? N - K - 1 : K - N, (K, se) => {
1085
+ const te = s.advancer(v, (K, se) => O(se) ? N - K - 1 : K - N, (K, se) => {
1085
1086
  O(se) && N++;
1086
1087
  });
1087
- for (const K of m) if (typeof K == "number") {
1088
- const se = K - re, Te = te(se), be = se + N, _e = Z(T, G ? se : be);
1089
- I.descend(K), p(Te, m, I, _e, G), o(m.getComponent()) && re++, I.ascend();
1088
+ for (const K of b) if (typeof K == "number") {
1089
+ const se = K - re, je = te(se), me = se + N, _e = Z(j, G ? se : me);
1090
+ I.descend(K), p(je, b, I, _e, G), o(b.getComponent()) && re++, I.ascend();
1090
1091
  } else {
1091
- const se = Z(T, K);
1092
- I.descend(K), p(te(K), m, I, se, G), I.ascend();
1092
+ const se = Z(j, K);
1093
+ I.descend(K), p(te(K), b, I, se, G), I.ascend();
1093
1094
  }
1094
1095
  te.end();
1095
1096
  }(y.clone(), y, D, u, !1)), D.get();
@@ -1114,87 +1115,87 @@ function Lt() {
1114
1115
  result: r
1115
1116
  };
1116
1117
  z(r), z(u);
1117
- let b = null;
1118
- const C = [], $ = [], j = [], p = [], v = [], m = [], I = [], T = [], G = [], g = [], N = [], re = [], te = [], K = [], se = [];
1119
- let Te = 0;
1120
- const be = i.readCursor(r), _e = i.readCursor(u), oe = i.writeCursor();
1121
- if (function Q(U, B = null, M) {
1118
+ let m = null;
1119
+ const C = [], $ = [], T = [], p = [], v = [], b = [], I = [], j = [], G = [], g = [], N = [], re = [], te = [], K = [], se = [];
1120
+ let je = 0;
1121
+ const me = s.readCursor(r), _e = s.readCursor(u), oe = s.writeCursor();
1122
+ if (function Q(M, B = null, U) {
1122
1123
  const A = a(B);
1123
- A && (A.r !== void 0 ? M = B.clone() : A.p != null && (M = null, m[A.p] = U.clone()));
1124
- const k = U.getComponent();
1124
+ A && (A.r !== void 0 ? U = B.clone() : A.p != null && (U = null, b[A.p] = M.clone()));
1125
+ const k = M.getComponent();
1125
1126
  let X;
1126
- k && (X = k.p) != null && (v[X] = B ? B.clone() : null, j[X] = U.clone(), M && (g[X] = !0, G[X] = M), A && A.p != null && (K[X] = A.p));
1127
- const Y = i.advancer(B);
1128
- for (const ee of U) Q(U, Y(ee), M);
1127
+ k && (X = k.p) != null && (v[X] = B ? B.clone() : null, T[X] = M.clone(), U && (g[X] = !0, G[X] = U), A && A.p != null && (K[X] = A.p));
1128
+ const Y = s.advancer(B);
1129
+ for (const ee of M) Q(M, Y(ee), U);
1129
1130
  Y.end();
1130
- }(_e, be, null), function Q(U, B, M, A, k) {
1131
- const X = M.getComponent();
1131
+ }(_e, me, null), function Q(M, B, U, A, k) {
1132
+ const X = U.getComponent();
1132
1133
  let Y, ee = !1;
1133
- X && ((Y = X.d) != null ? (p[Y] = M.clone(), A != null && (se[A] == null && (se[A] = []), se[A].push(Y)), U = v[Y] || null, B = j[Y] || null, g[Y] ? (k && (N[Y] = !0), k = G[Y] || null) : !k || D !== 1 && K[Y] != null || b == null && (b = {
1134
+ X && ((Y = X.d) != null ? (p[Y] = U.clone(), A != null && (se[A] == null && (se[A] = []), se[A].push(Y)), M = v[Y] || null, B = T[Y] || null, g[Y] ? (k && (N[Y] = !0), k = G[Y] || null) : !k || D !== 1 && K[Y] != null || m == null && (m = {
1134
1135
  type: d.ConflictType.RM_UNEXPECTED_CONTENT,
1135
1136
  op1: n.removeOp(k.getPath()),
1136
- op2: n.moveOp(B.getPath(), M.getPath())
1137
- }), ee = !0) : X.i !== void 0 && (U = B = null, ee = !0, k && b == null && (b = {
1137
+ op2: n.moveOp(B.getPath(), U.getPath())
1138
+ }), ee = !0) : X.i !== void 0 && (M = B = null, ee = !0, k && m == null && (m = {
1138
1139
  type: d.ConflictType.RM_UNEXPECTED_CONTENT,
1139
1140
  op1: n.removeOp(k.getPath()),
1140
- op2: n.insertOp(M.getPath(), X.i)
1141
+ op2: n.insertOp(U.getPath(), X.i)
1141
1142
  })));
1142
- const fe = a(U);
1143
- fe && (fe.r !== void 0 ? k = U.clone() : fe.p != null && (fe.p, A = fe.p, k = null));
1143
+ const fe = a(M);
1144
+ fe && (fe.r !== void 0 ? k = M.clone() : fe.p != null && (fe.p, A = fe.p, k = null));
1144
1145
  const de = ve(X);
1145
- de && k && b == null && (b = {
1146
+ de && k && m == null && (m = {
1146
1147
  type: d.ConflictType.RM_UNEXPECTED_CONTENT,
1147
1148
  op1: n.removeOp(k.getPath()),
1148
- op2: n.editOp(M.getPath(), de, f(X), !0)
1149
+ op2: n.editOp(U.getPath(), de, f(X), !0)
1149
1150
  });
1150
1151
  let le = 0, ye = 0;
1151
- const q = i.advancer(B, (x, he) => O(he) ? le - x - 1 : x - le, (x, he) => {
1152
+ const q = s.advancer(B, (x, he) => O(he) ? le - x - 1 : x - le, (x, he) => {
1152
1153
  O(he) && le++;
1153
- }), P = i.advancer(U);
1154
- for (const x of M) if (typeof x == "number") {
1155
- const he = x - ye, me = q(he);
1156
- ye += +Q(P(he + le), me, M, A, k);
1154
+ }), P = s.advancer(M);
1155
+ for (const x of U) if (typeof x == "number") {
1156
+ const he = x - ye, be = q(he);
1157
+ ye += +Q(P(he + le), be, U, A, k);
1157
1158
  } else {
1158
1159
  const he = q(x);
1159
- Q(P(x), he, M, A, k);
1160
+ Q(P(x), he, U, A, k);
1160
1161
  }
1161
1162
  return q.end(), P.end(), ee;
1162
- }(be, _e, _e.clone(), null, null), p.map((Q) => Q && Q.get()), b) return {
1163
+ }(me, _e, _e.clone(), null, null), p.map((Q) => Q && Q.get()), m) return {
1163
1164
  ok: !1,
1164
- conflict: b
1165
+ conflict: m
1165
1166
  };
1166
1167
  N.map((Q) => !!Q);
1167
1168
  const Pe = [];
1168
- let Me = null;
1169
- (function Q(U, B, M, A, k) {
1169
+ let Ue = null;
1170
+ (function Q(M, B, U, A, k) {
1170
1171
  let X = !1;
1171
1172
  const Y = a(B);
1172
1173
  if (O(Y)) {
1173
1174
  const q = Y.p;
1174
- q != null ? (M = p[q], A = re[q] = i.writeCursor(), X = !0, k = null) : (M = null, k = B.clone());
1175
- } else o(a(M)) && (M = null);
1176
- const ee = U.getComponent();
1175
+ q != null ? (U = p[q], A = re[q] = s.writeCursor(), X = !0, k = null) : (U = null, k = B.clone());
1176
+ } else o(a(U)) && (U = null);
1177
+ const ee = M.getComponent();
1177
1178
  if (ee) {
1178
1179
  const q = ee.p;
1179
- q != null ? (k && (T[q] = k), Pe[q] = k || D === 1 && X ? null : A.getComponent(), C[q] = U.clone(), M && (I[q] = M.clone())) : ee.r !== void 0 && (k || A.write("r", !0), (k || X) && (Me == null && (Me = /* @__PURE__ */ new Set()), Me.add(ee)));
1180
+ q != null ? (k && (j[q] = k), Pe[q] = k || D === 1 && X ? null : A.getComponent(), C[q] = M.clone(), U && (I[q] = U.clone())) : ee.r !== void 0 && (k || A.write("r", !0), (k || X) && (Ue == null && (Ue = /* @__PURE__ */ new Set()), Ue.add(ee)));
1180
1181
  }
1181
1182
  let fe = 0, de = 0;
1182
- const le = i.advancer(B, void 0, (q, P) => {
1183
+ const le = s.advancer(B, void 0, (q, P) => {
1183
1184
  O(P) && fe++;
1184
- }), ye = i.advancer(M, (q, P) => o(P) ? ~(q - de) : q - de, (q, P) => {
1185
+ }), ye = s.advancer(U, (q, P) => o(P) ? ~(q - de) : q - de, (q, P) => {
1185
1186
  o(P) && de++;
1186
1187
  });
1187
- if (U) for (const q of U) if (typeof q == "string") {
1188
+ if (M) for (const q of M) if (typeof q == "string") {
1188
1189
  const P = le(q), x = ye(q);
1189
- A.descend(q), Q(U, P, x, A, k), A.ascend();
1190
+ A.descend(q), Q(M, P, x, A, k), A.ascend();
1190
1191
  } else {
1191
- const P = le(q), x = q - fe, he = O(a(P)) ? null : ye(x), me = x + de;
1192
- l(me >= 0), A.descend(me), Q(U, P, he, A, k), A.ascend();
1192
+ const P = le(q), x = q - fe, he = O(a(P)) ? null : ye(x), be = x + de;
1193
+ l(be >= 0), A.descend(be), Q(M, P, he, A, k), A.ascend();
1193
1194
  }
1194
1195
  le.end(), ye.end();
1195
- })(be, _e, _e.clone(), oe, null), oe.reset();
1196
+ })(me, _e, _e.clone(), oe, null), oe.reset();
1196
1197
  let Le = [];
1197
- if (function Q(U, B, M, A, k, X) {
1198
+ if (function Q(M, B, U, A, k, X) {
1198
1199
  l(B);
1199
1200
  const Y = B.getComponent();
1200
1201
  let ee = a(A), fe = !1;
@@ -1206,31 +1207,31 @@ function Lt() {
1206
1207
  let Oe = !1;
1207
1208
  if (Y.i !== void 0 || S != null && ie) {
1208
1209
  let ce;
1209
- ee && (ee.i !== void 0 || (ce = ee.d) != null && !g[ce]) && (Oe = ce != null ? S != null && S === K[ce] : t.default(ee.i, Y.i), Oe || ce != null && D !== 1 && K[ce] != null || b == null && (b = {
1210
+ ee && (ee.i !== void 0 || (ce = ee.d) != null && !g[ce]) && (Oe = ce != null ? S != null && S === K[ce] : t.default(ee.i, Y.i), Oe || ce != null && D !== 1 && K[ce] != null || m == null && (m = {
1210
1211
  type: d.ConflictType.DROP_COLLISION,
1211
1212
  op1: de(S != null ? C[S] : null, B, Y),
1212
- op2: de(ce != null ? j[ce] : null, A, ee)
1213
- })), Oe || (X ? b == null && (b = {
1213
+ op2: de(ce != null ? T[ce] : null, A, ee)
1214
+ })), Oe || (X ? m == null && (m = {
1214
1215
  type: d.ConflictType.RM_UNEXPECTED_CONTENT,
1215
1216
  op1: de(S != null ? C[S] : null, B, Y),
1216
1217
  op2: n.removeOp(X.getPath())
1217
- }) : (S != null ? (Le[Te] = S, k.write("d", ie.p = Te++)) : k.write("i", s.default(Y.i)), fe = !0));
1218
+ }) : (S != null ? (Le[je] = S, k.write("d", ie.p = je++)) : k.write("i", i.default(Y.i)), fe = !0));
1218
1219
  } else if (S != null && !ie) {
1219
- const ce = T[S];
1220
+ const ce = j[S];
1220
1221
  ce && (X = ce.clone());
1221
1222
  }
1222
- S != null ? (U = C[S], M = m[S], A = I[S]) : Y.i !== void 0 && (U = M = null, Oe || (A = null));
1223
- } else O(a(U)) && (U = M = A = null);
1224
- const le = a(U), ye = a(M);
1223
+ S != null ? (M = C[S], U = b[S], A = I[S]) : Y.i !== void 0 && (M = U = null, Oe || (A = null));
1224
+ } else O(a(M)) && (M = U = A = null);
1225
+ const le = a(M), ye = a(U);
1225
1226
  if (O(ye)) {
1226
1227
  const S = ye.p;
1227
- ye.r !== void 0 && (!le || le.r === void 0) || g[S] ? (A = null, X = M.clone()) : S != null && (A = p[S], D !== 1 && K[S] != null || ((k = te[S]) || (k = te[S] = i.writeCursor()), k.reset(), X = null));
1228
+ ye.r !== void 0 && (!le || le.r === void 0) || g[S] ? (A = null, X = U.clone()) : S != null && (A = p[S], D !== 1 && K[S] != null || ((k = te[S]) || (k = te[S] = s.writeCursor()), k.reset(), X = null));
1228
1229
  } else !o(Y) && o(ee) && (A = null);
1229
1230
  ee = A != null ? A.getComponent() : null;
1230
1231
  const q = ve(Y);
1231
1232
  if (q) {
1232
1233
  const S = f(Y);
1233
- if (X) b == null && (b = {
1234
+ if (X) m == null && (m = {
1234
1235
  type: d.ConflictType.RM_UNEXPECTED_CONTENT,
1235
1236
  op1: n.editOp(B.getPath(), q, S, !0),
1236
1237
  op2: n.removeOp(X.getPath())
@@ -1242,32 +1243,32 @@ function Lt() {
1242
1243
  if (q !== ie) throw Error("Transforming incompatible types");
1243
1244
  const ce = f(ee);
1244
1245
  Oe = q.transform(S, ce, y);
1245
- } else Oe = s.default(S);
1246
+ } else Oe = i.default(S);
1246
1247
  _(k, q, Oe);
1247
1248
  }
1248
1249
  }
1249
- let P = 0, x = 0, he = 0, me = 0, We = 0, He = 0, Ne = U != null && U.descendFirst(), Ye = Ne;
1250
- const ze = i.advancer(M, void 0, (S, ie) => {
1250
+ let P = 0, x = 0, he = 0, be = 0, We = 0, He = 0, Ne = M != null && M.descendFirst(), Ye = Ne;
1251
+ const ze = s.advancer(U, void 0, (S, ie) => {
1251
1252
  O(ie) && he++;
1252
1253
  });
1253
- let Se = A != null && A.descendFirst(), je = Se;
1254
+ let Se = A != null && A.descendFirst(), Te = Se;
1254
1255
  for (const S of B) if (typeof S == "number") {
1255
1256
  let ie;
1256
1257
  const Oe = o(B.getComponent()), ce = S - x;
1257
1258
  {
1258
1259
  let Be;
1259
- for (; Ne && typeof (Be = U.getKey()) == "number"; ) {
1260
+ for (; Ne && typeof (Be = M.getKey()) == "number"; ) {
1260
1261
  Be += P;
1261
- const Re = U.getComponent(), Xe = O(Re);
1262
+ const Re = M.getComponent(), Xe = O(Re);
1262
1263
  if (Be > ce || Be === ce && (!Xe || D === 0 && Oe)) break;
1263
1264
  if (Xe) {
1264
1265
  P--;
1265
1266
  const Ke = Re.p;
1266
- K.includes(Ke), Re.d, a(te[Re.d]), O(a(te[Re.d])), (Re.r === void 0 || Me && Me.has(Re)) && (Ke == null || !Pe[Ke] || D !== 1 && K.includes(Ke)) || We--;
1267
+ K.includes(Ke), Re.d, a(te[Re.d]), O(a(te[Re.d])), (Re.r === void 0 || Ue && Ue.has(Re)) && (Ke == null || !Pe[Ke] || D !== 1 && K.includes(Ke)) || We--;
1267
1268
  }
1268
- Ne = U.nextSibling();
1269
+ Ne = M.nextSibling();
1269
1270
  }
1270
- ie = Ne && Be === ce ? U : null;
1271
+ ie = Ne && Be === ce ? M : null;
1271
1272
  }
1272
1273
  const ke = ce - P;
1273
1274
  let Ge = ze(ke);
@@ -1276,7 +1277,7 @@ function Lt() {
1276
1277
  {
1277
1278
  let Be, Re;
1278
1279
  for (; Se && typeof (Be = A.getKey()) == "number"; ) {
1279
- Re = Be - me;
1280
+ Re = Be - be;
1280
1281
  const Xe = A.getComponent(), Ke = o(Xe);
1281
1282
  if (Re > rt) break;
1282
1283
  if (Re === rt) {
@@ -1295,48 +1296,48 @@ function Lt() {
1295
1296
  }
1296
1297
  if (Ke) {
1297
1298
  const Ve = Xe.d;
1298
- K[Ve], Xe.i === void 0 && (g[Ve] || K[Ve] != null && D !== 1) ? (g[Ve] || K[Ve] != null && D === 0) && (me++, He--) : me++;
1299
+ K[Ve], Xe.i === void 0 && (g[Ve] || K[Ve] != null && D !== 1) ? (g[Ve] || K[Ve] != null && D === 0) && (be++, He--) : be++;
1299
1300
  }
1300
1301
  Se = A.nextSibling();
1301
1302
  }
1302
1303
  }
1303
- const Ot = rt + me + We + He;
1304
+ const Ot = rt + be + We + He;
1304
1305
  l(Ot >= 0, "trying to descend to a negative index"), k.descend(Ot), Oe && (ie = Ge = Je = null, x++), Q(ie, B, Ge, Je, k, X) && He++, k.ascend();
1305
1306
  } else {
1306
1307
  let ie;
1307
- for (; Ne && (ie = U.getKey(), typeof ie != "string" || !(ie > S || ie === S)); ) Ne = U.nextSibling();
1308
- const Oe = Ne && ie === S ? U : null, ce = ze(S);
1308
+ for (; Ne && (ie = M.getKey(), typeof ie != "string" || !(ie > S || ie === S)); ) Ne = M.nextSibling();
1309
+ const Oe = Ne && ie === S ? M : null, ce = ze(S);
1309
1310
  let ke;
1310
1311
  for (; Se && (ke = A.getKey(), typeof ke != "string" || !(ke > S || ke === S)); ) Se = A.nextSibling();
1311
1312
  const Ge = Se && ke === S ? A : null;
1312
1313
  k.descend(S), Q(Oe, B, ce, Ge, k, X), k.ascend();
1313
1314
  }
1314
- return ze.end(), Ye && U.ascend(), je && A.ascend(), fe;
1315
- }(be, be.clone(), _e, _e.clone(), oe, null), b) return {
1315
+ return ze.end(), Ye && M.ascend(), Te && A.ascend(), fe;
1316
+ }(me, me.clone(), _e, _e.clone(), oe, null), m) return {
1316
1317
  ok: !1,
1317
- conflict: b
1318
+ conflict: m
1318
1319
  };
1319
1320
  oe.reset();
1320
- const Ue = (Q, U, B) => Q.traverse(U, (M, A) => {
1321
- M.d != null && B(M.d, Q, A);
1321
+ const Me = (Q, M, B) => Q.traverse(M, (U, A) => {
1322
+ U.d != null && B(U.d, Q, A);
1322
1323
  });
1323
- (g.length || re.length) && (Ue(_e, oe, (Q, U, B) => {
1324
+ (g.length || re.length) && (Me(_e, oe, (Q, M, B) => {
1324
1325
  g[Q] && !N[Q] && B.write("r", !0), re[Q] && B.mergeTree(re[Q].get());
1325
1326
  }), oe.reset());
1326
1327
  const Ee = [], $e = [];
1327
- if ((te.length || g.length) && !b) {
1328
- const Q = i.readCursor(tt(oe.get()));
1329
- if (Ue(Q, null, (U, B) => {
1330
- Ee[U] = B.clone();
1331
- }), te.forEach((U) => {
1332
- U && Ue(i.readCursor(U.get()), null, (B, M) => {
1333
- Ee[B] = M.clone();
1328
+ if ((te.length || g.length) && !m) {
1329
+ const Q = s.readCursor(tt(oe.get()));
1330
+ if (Me(Q, null, (M, B) => {
1331
+ Ee[M] = B.clone();
1332
+ }), te.forEach((M) => {
1333
+ M && Me(s.readCursor(M.get()), null, (B, U) => {
1334
+ Ee[B] = U.clone();
1334
1335
  });
1335
- }), function U(B, M, A, k, X, Y) {
1336
- const ee = a(M);
1336
+ }), function M(B, U, A, k, X, Y) {
1337
+ const ee = a(U);
1337
1338
  if (ee && O(ee)) if (ee.p != null) {
1338
1339
  const P = ee.p;
1339
- Ee[P].getPath(), A = Ee[P], k = $e[P] = i.writeCursor();
1340
+ Ee[P].getPath(), A = Ee[P], k = $e[P] = s.writeCursor();
1340
1341
  } else ee.r !== void 0 && (A = null);
1341
1342
  else o(a(A)) && (A = null);
1342
1343
  const fe = B.getComponent();
@@ -1344,52 +1345,52 @@ function Lt() {
1344
1345
  let P;
1345
1346
  if ((P = fe.d) != null) {
1346
1347
  const x = te[P];
1347
- x && (x.get(), k.mergeTree(x.get()), A = i.readCursor(x.get()));
1348
+ x && (x.get(), k.mergeTree(x.get()), A = s.readCursor(x.get()));
1348
1349
  }
1349
1350
  }
1350
1351
  let de = 0, le = 0;
1351
- const ye = i.advancer(M, void 0, (P, x) => {
1352
+ const ye = s.advancer(U, void 0, (P, x) => {
1352
1353
  O(x) && de--;
1353
- }), q = i.advancer(A, (P, x) => o(x) ? -(P - le) - 1 : P - le, (P, x) => {
1354
+ }), q = s.advancer(A, (P, x) => o(x) ? -(P - le) - 1 : P - le, (P, x) => {
1354
1355
  o(x) && le++;
1355
1356
  });
1356
1357
  for (const P of B) if (typeof P == "number") {
1357
- const x = ye(P), he = P + de, me = q(he), We = he + le;
1358
- k.descend(We), U(B, x, me, k), k.ascend();
1359
- } else k.descend(P), U(B, ye(P), q(P), k), k.ascend();
1358
+ const x = ye(P), he = P + de, be = q(he), We = he + le;
1359
+ k.descend(We), M(B, x, be, k), k.ascend();
1360
+ } else k.descend(P), M(B, ye(P), q(P), k), k.ascend();
1360
1361
  ye.end(), q.end();
1361
- }(_e, Q, Q.clone(), oe), oe.reset(), b) return {
1362
+ }(_e, Q, Q.clone(), oe), oe.reset(), m) return {
1362
1363
  ok: !1,
1363
- conflict: b
1364
+ conflict: m
1364
1365
  };
1365
1366
  if (oe.get(), $e.length) {
1366
- const U = $e.map((M) => M ? M.get() : null), B = i.readCursor(tt(oe.get()));
1367
- if (Ue(B, oe, (M, A, k) => {
1368
- const X = U[M];
1369
- X && (k.mergeTree(X), U[M] = null);
1370
- }), U.find((M) => M)) {
1371
- const M = i.writeCursor(), A = i.writeCursor();
1367
+ const M = $e.map((U) => U ? U.get() : null), B = s.readCursor(tt(oe.get()));
1368
+ if (Me(B, oe, (U, A, k) => {
1369
+ const X = M[U];
1370
+ X && (k.mergeTree(X), M[U] = null);
1371
+ }), M.find((U) => U)) {
1372
+ const U = s.writeCursor(), A = s.writeCursor();
1372
1373
  let k = 0, X = 0;
1373
- U.forEach((Y) => {
1374
- Y != null && Ue(i.readCursor(Y), null, (ee) => {
1374
+ M.forEach((Y) => {
1375
+ Y != null && Me(s.readCursor(Y), null, (ee) => {
1375
1376
  const fe = Le[ee];
1376
- M.writeMove(C[fe].getPath(), $[fe].getPath(), k++);
1377
+ U.writeMove(C[fe].getPath(), $[fe].getPath(), k++);
1377
1378
  const de = se[fe];
1378
1379
  de && de.forEach((le) => {
1379
- g[le] || D !== 1 && K[le] != null || A.writeMove(j[le].getPath(), p[le].getPath(), X++);
1380
+ g[le] || D !== 1 && K[le] != null || A.writeMove(T[le].getPath(), p[le].getPath(), X++);
1380
1381
  });
1381
1382
  });
1382
- }), b = {
1383
+ }), m = {
1383
1384
  type: d.ConflictType.BLACKHOLE,
1384
- op1: M.get(),
1385
+ op1: U.get(),
1385
1386
  op2: A.get()
1386
1387
  };
1387
1388
  }
1388
1389
  }
1389
1390
  }
1390
- return b ? {
1391
+ return m ? {
1391
1392
  ok: !1,
1392
- conflict: b
1393
+ conflict: m
1393
1394
  } : {
1394
1395
  ok: !0,
1395
1396
  result: oe.get()
@@ -1405,36 +1406,36 @@ function Lt() {
1405
1406
  gt(D.conflict);
1406
1407
  }
1407
1408
  const qe = (r) => {
1408
- const u = i.writeCursor();
1409
- return i.readCursor(r).traverse(u, (y, D) => {
1409
+ const u = s.writeCursor();
1410
+ return s.readCursor(r).traverse(u, (y, D) => {
1410
1411
  (o(y) || ve(y)) && D.write("r", !0);
1411
1412
  }), u.get();
1412
1413
  }, At = (r, u) => {
1413
- const { type: y, op1: D, op2: b } = r;
1414
+ const { type: y, op1: D, op2: m } = r;
1414
1415
  switch (y) {
1415
1416
  case d.ConflictType.DROP_COLLISION:
1416
- return u === "left" ? [null, qe(b)] : [qe(D), null];
1417
+ return u === "left" ? [null, qe(m)] : [qe(D), null];
1417
1418
  case d.ConflictType.RM_UNEXPECTED_CONTENT:
1418
1419
  let C = !1;
1419
- return i.readCursor(D).traverse(null, ($) => {
1420
+ return s.readCursor(D).traverse(null, ($) => {
1420
1421
  $.r !== void 0 && (C = !0);
1421
- }), C ? [null, qe(b)] : [qe(D), null];
1422
+ }), C ? [null, qe(m)] : [qe(D), null];
1422
1423
  case d.ConflictType.BLACKHOLE:
1423
- return [qe(D), qe(b)];
1424
+ return [qe(D), qe(m)];
1424
1425
  default:
1425
1426
  throw Error("Unrecognised conflict: " + y);
1426
1427
  }
1427
1428
  };
1428
1429
  function _t(r, u, y, D) {
1429
- let b = null;
1430
+ let m = null;
1430
1431
  for (; ; ) {
1431
1432
  const C = nt(u, y, D);
1432
- if (C.ok) return ne(b, C.result);
1433
+ if (C.ok) return ne(m, C.result);
1433
1434
  {
1434
1435
  const { conflict: $ } = C;
1435
1436
  r($) || gt($);
1436
- const [j, p] = At($, D);
1437
- u = ne(H(u), j), y = ne(H(y), p), b = ne(b, p);
1437
+ const [T, p] = At($, D);
1438
+ u = ne(H(u), T), y = ne(H(y), p), m = ne(m, p);
1438
1439
  }
1439
1440
  }
1440
1441
  }
@@ -1450,15 +1451,15 @@ function Lt() {
1450
1451
  for (var a in d) a !== "default" && !l.hasOwnProperty(a) && e(l, d, a);
1451
1452
  };
1452
1453
  Object.defineProperty(n, "__esModule", { value: !0 }), t(Ct, n);
1453
- var s = ft;
1454
+ var i = ft;
1454
1455
  Object.defineProperty(n, "ReadCursor", { enumerable: !0, get: function() {
1455
- return s.ReadCursor;
1456
+ return i.ReadCursor;
1456
1457
  } }), Object.defineProperty(n, "WriteCursor", { enumerable: !0, get: function() {
1457
- return s.WriteCursor;
1458
+ return i.WriteCursor;
1458
1459
  } });
1459
- var i = ht;
1460
+ var s = ht;
1460
1461
  Object.defineProperty(n, "ConflictType", { enumerable: !0, get: function() {
1461
- return i.ConflictType;
1462
+ return s.ConflictType;
1462
1463
  } });
1463
1464
  })(F);
1464
1465
  class Ht {
@@ -1509,10 +1510,8 @@ class Ht {
1509
1510
  }
1510
1511
  refreshTransform(e) {
1511
1512
  e.forEach((t) => {
1512
- if (this.getDrawingByParam(t) == null)
1513
- return;
1514
1513
  const i = this._getCurrentBySearch(t);
1515
- i != null && (i.transform = t.transform);
1514
+ i != null && (i.transform = t.transform, i.transforms = t.transforms, i.isMultiTransform = t.isMultiTransform);
1516
1515
  }), this.refreshTransformNotification(e);
1517
1516
  }
1518
1517
  getDrawingDataForUnit(e) {
@@ -1523,25 +1522,25 @@ class Ht {
1523
1522
  if (t == null)
1524
1523
  return;
1525
1524
  delete this.drawingManagerData[e];
1526
- const s = [];
1527
- Object.keys(t).forEach((i) => {
1528
- const d = t[i];
1525
+ const i = [];
1526
+ Object.keys(t).forEach((s) => {
1527
+ const d = t[s];
1529
1528
  (d == null ? void 0 : d.data) != null && Object.keys(d.data).forEach((l) => {
1530
- s.push({ unitId: e, subUnitId: i, drawingId: l });
1529
+ i.push({ unitId: e, subUnitId: s, drawingId: l });
1531
1530
  });
1532
- }), s.length > 0 && this.removeNotification(s);
1531
+ }), i.length > 0 && this.removeNotification(i);
1533
1532
  }
1534
1533
  registerDrawingData(e, t) {
1535
1534
  this.drawingManagerData[e] = t;
1536
1535
  }
1537
1536
  initializeNotification(e) {
1538
- const t = [], s = this.drawingManagerData[e];
1539
- s != null && (Object.keys(s).forEach((i) => {
1540
- this._establishDrawingMap(e, i);
1541
- const d = s[i];
1537
+ const t = [], i = this.drawingManagerData[e];
1538
+ i != null && (Object.keys(i).forEach((s) => {
1539
+ this._establishDrawingMap(e, s);
1540
+ const d = i[s];
1542
1541
  Object.keys(d.data).forEach((l) => {
1543
1542
  const a = d.data[l];
1544
- a.unitId = e, a.subUnitId = i, t.push(a);
1543
+ a.unitId = e, a.subUnitId = s, t.push(a);
1545
1544
  });
1546
1545
  }), t.length > 0 && this.addNotification(t));
1547
1546
  }
@@ -1549,34 +1548,34 @@ class Ht {
1549
1548
  return this._getDrawingData(e, t);
1550
1549
  }
1551
1550
  // Use in doc only.
1552
- setDrawingData(e, t, s) {
1553
- this.drawingManagerData[e][t].data = s;
1551
+ setDrawingData(e, t, i) {
1552
+ this.drawingManagerData[e][t].data = i;
1554
1553
  }
1555
1554
  getBatchAddOp(e) {
1556
- const t = [], s = [], i = [];
1555
+ const t = [], i = [], s = [];
1557
1556
  e.forEach((W) => {
1558
1557
  const { op: O, invertOp: o } = this._addByParam(W);
1559
- t.push({ unitId: W.unitId, subUnitId: W.subUnitId, drawingId: W.drawingId }), s.push(O), i.push(o);
1558
+ t.push({ unitId: W.unitId, subUnitId: W.subUnitId, drawingId: W.drawingId }), i.push(O), s.push(o);
1560
1559
  });
1561
- const d = s.reduce(F.type.compose, null), l = i.reduce(F.type.compose, null), { unitId: a, subUnitId: E } = e[0];
1560
+ const d = i.reduce(F.type.compose, null), l = s.reduce(F.type.compose, null), { unitId: a, subUnitId: E } = e[0];
1562
1561
  return { undo: l, redo: d, unitId: a, subUnitId: E, objects: t };
1563
1562
  }
1564
1563
  getBatchRemoveOp(e) {
1565
- const t = [], s = [];
1564
+ const t = [], i = [];
1566
1565
  e.forEach((E) => {
1567
1566
  const { op: W, invertOp: O } = this._removeByParam(E);
1568
- t.push(W), s.push(O);
1567
+ t.push(W), i.push(O);
1569
1568
  });
1570
- const i = t.reduce(F.type.compose, null), d = s.reduce(F.type.compose, null), { unitId: l, subUnitId: a } = e[0];
1571
- return { undo: d, redo: i, unitId: l, subUnitId: a, objects: e };
1569
+ const s = t.reduce(F.type.compose, null), d = i.reduce(F.type.compose, null), { unitId: l, subUnitId: a } = e[0];
1570
+ return { undo: d, redo: s, unitId: l, subUnitId: a, objects: e };
1572
1571
  }
1573
1572
  getBatchUpdateOp(e) {
1574
- const t = [], s = [], i = [];
1573
+ const t = [], i = [], s = [];
1575
1574
  e.forEach((W) => {
1576
1575
  const { op: O, invertOp: o } = this._updateByParam(W);
1577
- t.push({ unitId: W.unitId, subUnitId: W.subUnitId, drawingId: W.drawingId }), s.push(O), i.push(o);
1576
+ t.push({ unitId: W.unitId, subUnitId: W.subUnitId, drawingId: W.drawingId }), i.push(O), s.push(o);
1578
1577
  });
1579
- const d = s.reduce(F.type.compose, null), l = i.reduce(F.type.compose, null), { unitId: a, subUnitId: E } = e[0];
1578
+ const d = i.reduce(F.type.compose, null), l = s.reduce(F.type.compose, null), { unitId: a, subUnitId: E } = e[0];
1580
1579
  return { undo: l, redo: d, unitId: a, subUnitId: E, objects: t };
1581
1580
  }
1582
1581
  removeNotification(e) {
@@ -1601,61 +1600,61 @@ class Ht {
1601
1600
  this._refreshTransform$.next(e);
1602
1601
  }
1603
1602
  getGroupDrawingOp(e) {
1604
- const t = [], { unitId: s, subUnitId: i } = e[0].parent;
1603
+ const t = [], { unitId: i, subUnitId: s } = e[0].parent;
1605
1604
  e.forEach((a) => {
1606
1605
  t.push(this._getGroupDrawingOp(a));
1607
1606
  });
1608
1607
  const d = t.reduce(F.type.compose, null);
1609
- return { undo: F.type.invertWithDoc(d, this.drawingManagerData), redo: d, unitId: s, subUnitId: i, objects: e };
1608
+ return { undo: F.type.invertWithDoc(d, this.drawingManagerData), redo: d, unitId: i, subUnitId: s, objects: e };
1610
1609
  }
1611
1610
  getUngroupDrawingOp(e) {
1612
- const t = [], { unitId: s, subUnitId: i } = e[0].parent;
1611
+ const t = [], { unitId: i, subUnitId: s } = e[0].parent;
1613
1612
  e.forEach((a) => {
1614
1613
  t.push(this._getUngroupDrawingOp(a));
1615
1614
  });
1616
1615
  const d = t.reduce(F.type.compose, null);
1617
- return { undo: F.type.invertWithDoc(d, this.drawingManagerData), redo: d, unitId: s, subUnitId: i, objects: e };
1616
+ return { undo: F.type.invertWithDoc(d, this.drawingManagerData), redo: d, unitId: i, subUnitId: s, objects: e };
1618
1617
  }
1619
1618
  getDrawingsByGroup(e) {
1620
- const { unitId: t, subUnitId: s, drawingId: i } = e;
1621
- if (this.getDrawingByParam({ unitId: t, subUnitId: s, drawingId: i }) == null)
1619
+ const { unitId: t, subUnitId: i, drawingId: s } = e;
1620
+ if (this.getDrawingByParam({ unitId: t, subUnitId: i, drawingId: s }) == null)
1622
1621
  return [];
1623
- const l = this._getDrawingData(t, s), a = [];
1622
+ const l = this._getDrawingData(t, i), a = [];
1624
1623
  return Object.keys(l).forEach((E) => {
1625
1624
  const W = l[E];
1626
- W.groupId === i && a.push(W);
1625
+ W.groupId === s && a.push(W);
1627
1626
  }), a;
1628
1627
  }
1629
1628
  _getGroupDrawingOp(e) {
1630
- const { parent: t, children: s } = e, { unitId: i, subUnitId: d, drawingId: l } = t, a = [];
1629
+ const { parent: t, children: i } = e, { unitId: s, subUnitId: d, drawingId: l } = t, a = [];
1631
1630
  a.push(
1632
- F.insertOp([i, d, "data", l], t)
1631
+ F.insertOp([s, d, "data", l], t)
1633
1632
  );
1634
1633
  let E = Number.NEGATIVE_INFINITY;
1635
- return s.forEach((W) => {
1634
+ return i.forEach((W) => {
1636
1635
  const { unitId: O, subUnitId: o, drawingId: c } = W, h = this._hasDrawingOrder({ unitId: O, subUnitId: o, drawingId: c });
1637
1636
  E = Math.max(E, h), a.push(
1638
1637
  ...this._getUpdateParamCompareOp(W, this.getDrawingByParam({ unitId: O, subUnitId: o, drawingId: c }))
1639
1638
  );
1640
- }), E === Number.NEGATIVE_INFINITY && (E = this._getDrawingOrder(i, d).length), a.push(
1641
- F.insertOp([i, d, "order", E], l)
1639
+ }), E === Number.NEGATIVE_INFINITY && (E = this._getDrawingOrder(s, d).length), a.push(
1640
+ F.insertOp([s, d, "order", E], l)
1642
1641
  ), a.reduce(F.type.compose, null);
1643
1642
  }
1644
1643
  _getUngroupDrawingOp(e) {
1645
- const { parent: t, children: s } = e, { unitId: i, subUnitId: d, drawingId: l } = t, a = [];
1646
- return s.forEach((E) => {
1644
+ const { parent: t, children: i } = e, { unitId: s, subUnitId: d, drawingId: l } = t, a = [];
1645
+ return i.forEach((E) => {
1647
1646
  const { unitId: W, subUnitId: O, drawingId: o } = E;
1648
1647
  a.push(
1649
1648
  ...this._getUpdateParamCompareOp(E, this.getDrawingByParam({ unitId: W, subUnitId: O, drawingId: o }))
1650
1649
  );
1651
1650
  }), a.push(
1652
- F.removeOp([i, d, "data", l], !0)
1651
+ F.removeOp([s, d, "data", l], !0)
1653
1652
  ), a.push(
1654
- F.removeOp([i, d, "order", this._getDrawingOrder(i, d).indexOf(l)], !0)
1653
+ F.removeOp([s, d, "order", this._getDrawingOrder(s, d).indexOf(l)], !0)
1655
1654
  ), a.reduce(F.type.compose, null);
1656
1655
  }
1657
- applyJson1(e, t, s) {
1658
- this._establishDrawingMap(e, t), this._oldDrawingManagerData = { ...this.drawingManagerData }, this.drawingManagerData = F.type.apply(this.drawingManagerData, s);
1656
+ applyJson1(e, t, i) {
1657
+ this._establishDrawingMap(e, t), this._oldDrawingManagerData = { ...this.drawingManagerData }, this.drawingManagerData = F.type.apply(this.drawingManagerData, i);
1659
1658
  }
1660
1659
  // private _fillMissingFields(jsonOp: JSONOp) {
1661
1660
  // if (jsonOp == null) {
@@ -1702,8 +1701,8 @@ class Ht {
1702
1701
  return this._getOldBySearch(e);
1703
1702
  }
1704
1703
  getDrawingOKey(e) {
1705
- const [t, s, i] = e.split("#-#");
1706
- return this._getCurrentBySearch({ unitId: t, subUnitId: s, drawingId: i });
1704
+ const [t, i, s] = e.split("#-#");
1705
+ return this._getCurrentBySearch({ unitId: t, subUnitId: i, drawingId: s });
1707
1706
  }
1708
1707
  focusDrawing(e) {
1709
1708
  if (e == null) {
@@ -1711,9 +1710,9 @@ class Ht {
1711
1710
  return;
1712
1711
  }
1713
1712
  const t = [];
1714
- e.forEach((s) => {
1713
+ e.forEach((i) => {
1715
1714
  var E;
1716
- const { unitId: i, subUnitId: d, drawingId: l } = s, a = (E = this._getDrawingData(i, d)) == null ? void 0 : E[l];
1715
+ const { unitId: s, subUnitId: d, drawingId: l } = i, a = (E = this._getDrawingData(s, d)) == null ? void 0 : E[l];
1717
1716
  a != null && t.push(a);
1718
1717
  }), t.length > 0 && (this._focusDrawings = t, this._focus$.next(t));
1719
1718
  }
@@ -1721,7 +1720,7 @@ class Ht {
1721
1720
  const e = [];
1722
1721
  return this._focusDrawings.forEach((t) => {
1723
1722
  var a;
1724
- const { unitId: s, subUnitId: i, drawingId: d } = t, l = (a = this._getDrawingData(s, i)) == null ? void 0 : a[d];
1723
+ const { unitId: i, subUnitId: s, drawingId: d } = t, l = (a = this._getDrawingData(i, s)) == null ? void 0 : a[d];
1725
1724
  l != null && e.push(l);
1726
1725
  }), e;
1727
1726
  }
@@ -1729,107 +1728,107 @@ class Ht {
1729
1728
  return this._getDrawingOrder(e, t);
1730
1729
  }
1731
1730
  // Use in doc only.
1732
- setDrawingOrder(e, t, s) {
1733
- this.drawingManagerData[e][t].order = s;
1731
+ setDrawingOrder(e, t, i) {
1732
+ this.drawingManagerData[e][t].order = i;
1734
1733
  }
1735
1734
  orderUpdateNotification(e) {
1736
1735
  this._order$.next(e);
1737
1736
  }
1738
1737
  getForwardDrawingsOp(e) {
1739
- const { unitId: t, subUnitId: s, drawingIds: i } = e, d = [], l = this.getDrawingOrder(t, s), a = [...i];
1740
- i.forEach((O) => {
1741
- const o = this._hasDrawingOrder({ unitId: t, subUnitId: s, drawingId: O });
1738
+ const { unitId: t, subUnitId: i, drawingIds: s } = e, d = [], l = this.getDrawingOrder(t, i), a = [...s];
1739
+ s.forEach((O) => {
1740
+ const o = this._hasDrawingOrder({ unitId: t, subUnitId: i, drawingId: O });
1742
1741
  if (o === -1 || o === l.length - 1)
1743
1742
  return;
1744
- const c = F.moveOp([t, s, "order", o], [t, s, "order", o + 1]);
1743
+ const c = F.moveOp([t, i, "order", o], [t, i, "order", o + 1]);
1745
1744
  d.push(c), a.includes(l[o + 1]) || a.push(l[o + 1]);
1746
1745
  });
1747
1746
  const E = d.reduce(F.type.compose, null);
1748
- return { undo: F.type.invertWithDoc(E, this.drawingManagerData), redo: E, unitId: t, subUnitId: s, objects: { ...e, drawingIds: a } };
1747
+ return { undo: F.type.invertWithDoc(E, this.drawingManagerData), redo: E, unitId: t, subUnitId: i, objects: { ...e, drawingIds: a } };
1749
1748
  }
1750
1749
  getBackwardDrawingOp(e) {
1751
- const { unitId: t, subUnitId: s, drawingIds: i } = e, d = [], l = this.getDrawingOrder(t, s), a = [...i];
1752
- i.forEach((O) => {
1753
- const o = this._hasDrawingOrder({ unitId: t, subUnitId: s, drawingId: O });
1750
+ const { unitId: t, subUnitId: i, drawingIds: s } = e, d = [], l = this.getDrawingOrder(t, i), a = [...s];
1751
+ s.forEach((O) => {
1752
+ const o = this._hasDrawingOrder({ unitId: t, subUnitId: i, drawingId: O });
1754
1753
  if (o === -1 || o === 0)
1755
1754
  return;
1756
- const c = F.moveOp([t, s, "order", o], [t, s, "order", o - 1]);
1755
+ const c = F.moveOp([t, i, "order", o], [t, i, "order", o - 1]);
1757
1756
  d.push(c), a.includes(l[o - 1]) || a.push(l[o - 1]);
1758
1757
  });
1759
1758
  const E = d.reduce(F.type.compose, null);
1760
- return { undo: F.type.invertWithDoc(E, this.drawingManagerData), redo: E, unitId: t, subUnitId: s, objects: { ...e, drawingIds: a } };
1759
+ return { undo: F.type.invertWithDoc(E, this.drawingManagerData), redo: E, unitId: t, subUnitId: i, objects: { ...e, drawingIds: a } };
1761
1760
  }
1762
1761
  getFrontDrawingsOp(e) {
1763
- const { unitId: t, subUnitId: s, drawingIds: i } = e, d = this._getOrderFromSearchParams(t, s, i), l = [...i], a = this.getDrawingOrder(t, s), E = [];
1762
+ const { unitId: t, subUnitId: i, drawingIds: s } = e, d = this._getOrderFromSearchParams(t, i, s), l = [...s], a = this.getDrawingOrder(t, i), E = [];
1764
1763
  d.forEach((o) => {
1765
- const { drawingId: c } = o, h = this._getDrawingCount(t, s) - 1, R = F.moveOp([t, s, "order", this._getDrawingOrder(t, s).indexOf(c)], [t, s, "order", h]);
1764
+ const { drawingId: c } = o, h = this._getDrawingCount(t, i) - 1, R = F.moveOp([t, i, "order", this._getDrawingOrder(t, i).indexOf(c)], [t, i, "order", h]);
1766
1765
  E.push(R), l.includes(a[h]) || l.push(a[h]);
1767
1766
  });
1768
1767
  const W = E.reduce(F.type.compose, null);
1769
- return { undo: F.type.invertWithDoc(W, this.drawingManagerData), redo: W, unitId: t, subUnitId: s, objects: { ...e, drawingIds: l } };
1768
+ return { undo: F.type.invertWithDoc(W, this.drawingManagerData), redo: W, unitId: t, subUnitId: i, objects: { ...e, drawingIds: l } };
1770
1769
  }
1771
1770
  getBackDrawingsOp(e) {
1772
- const { unitId: t, subUnitId: s, drawingIds: i } = e, d = this._getOrderFromSearchParams(t, s, i, !0), l = [...i], a = this.getDrawingOrder(t, s), E = [];
1771
+ const { unitId: t, subUnitId: i, drawingIds: s } = e, d = this._getOrderFromSearchParams(t, i, s, !0), l = [...s], a = this.getDrawingOrder(t, i), E = [];
1773
1772
  d.forEach((o) => {
1774
- const { drawingId: c } = o, h = F.moveOp([t, s, "order", this._getDrawingOrder(t, s).indexOf(c)], [t, s, "order", 0]);
1773
+ const { drawingId: c } = o, h = F.moveOp([t, i, "order", this._getDrawingOrder(t, i).indexOf(c)], [t, i, "order", 0]);
1775
1774
  E.push(h), l.includes(a[0]) || l.push(a[0]);
1776
1775
  });
1777
1776
  const W = E.reduce(F.type.compose, null);
1778
- return { undo: F.type.invertWithDoc(W, this.drawingManagerData), redo: W, unitId: t, subUnitId: s, objects: { ...e, drawingIds: l } };
1777
+ return { undo: F.type.invertWithDoc(W, this.drawingManagerData), redo: W, unitId: t, subUnitId: i, objects: { ...e, drawingIds: l } };
1779
1778
  }
1780
1779
  _getDrawingCount(e, t) {
1781
1780
  return this.getDrawingOrder(e, t).length || 0;
1782
1781
  }
1783
- _getOrderFromSearchParams(e, t, s, i = !1) {
1784
- return s.map((d) => {
1782
+ _getOrderFromSearchParams(e, t, i, s = !1) {
1783
+ return i.map((d) => {
1785
1784
  const l = this._hasDrawingOrder({ unitId: e, subUnitId: t, drawingId: d });
1786
1785
  return { drawingId: d, zIndex: l };
1787
- }).sort(i === !1 ? Mt : Nt);
1786
+ }).sort(s === !1 ? Ut : Nt);
1788
1787
  }
1789
1788
  _hasDrawingOrder(e) {
1790
1789
  if (e == null)
1791
1790
  return -1;
1792
- const { unitId: t, subUnitId: s, drawingId: i } = e;
1793
- return this._establishDrawingMap(t, s), this._getDrawingOrder(t, s).indexOf(i);
1791
+ const { unitId: t, subUnitId: i, drawingId: s } = e;
1792
+ return this._establishDrawingMap(t, i), this._getDrawingOrder(t, i).indexOf(s);
1794
1793
  }
1795
1794
  _getCurrentBySearch(e) {
1796
1795
  var d, l, a;
1797
1796
  if (e == null)
1798
1797
  return;
1799
- const { unitId: t, subUnitId: s, drawingId: i } = e;
1800
- return (a = (l = (d = this.drawingManagerData[t]) == null ? void 0 : d[s]) == null ? void 0 : l.data) == null ? void 0 : a[i];
1798
+ const { unitId: t, subUnitId: i, drawingId: s } = e;
1799
+ return (a = (l = (d = this.drawingManagerData[t]) == null ? void 0 : d[i]) == null ? void 0 : l.data) == null ? void 0 : a[s];
1801
1800
  }
1802
1801
  _getOldBySearch(e) {
1803
1802
  var d, l, a;
1804
1803
  if (e == null)
1805
1804
  return;
1806
- const { unitId: t, subUnitId: s, drawingId: i } = e;
1807
- return (a = (l = (d = this._oldDrawingManagerData[t]) == null ? void 0 : d[s]) == null ? void 0 : l.data) == null ? void 0 : a[i];
1805
+ const { unitId: t, subUnitId: i, drawingId: s } = e;
1806
+ return (a = (l = (d = this._oldDrawingManagerData[t]) == null ? void 0 : d[i]) == null ? void 0 : l.data) == null ? void 0 : a[s];
1808
1807
  }
1809
- _establishDrawingMap(e, t, s) {
1810
- var i;
1808
+ _establishDrawingMap(e, t, i) {
1809
+ var s;
1811
1810
  return this.drawingManagerData[e] || (this.drawingManagerData[e] = {}), this.drawingManagerData[e][t] || (this.drawingManagerData[e][t] = {
1812
1811
  data: {},
1813
1812
  order: []
1814
- }), s == null ? null : (i = this.drawingManagerData[e][t].data) == null ? void 0 : i[s];
1813
+ }), i == null ? null : (s = this.drawingManagerData[e][t].data) == null ? void 0 : s[i];
1815
1814
  }
1816
1815
  _addByParam(e) {
1817
- const { unitId: t, subUnitId: s, drawingId: i } = e;
1818
- this._establishDrawingMap(t, s, i);
1819
- const d = F.insertOp([t, s, "data", i], e), l = F.insertOp([t, s, "order", this._getDrawingOrder(t, s).length], i), a = [d, l].reduce(F.type.compose, null), E = F.type.invertWithDoc(a, this.drawingManagerData);
1816
+ const { unitId: t, subUnitId: i, drawingId: s } = e;
1817
+ this._establishDrawingMap(t, i, s);
1818
+ const d = F.insertOp([t, i, "data", s], e), l = F.insertOp([t, i, "order", this._getDrawingOrder(t, i).length], s), a = [d, l].reduce(F.type.compose, null), E = F.type.invertWithDoc(a, this.drawingManagerData);
1820
1819
  return { op: a, invertOp: E };
1821
1820
  }
1822
1821
  _removeByParam(e) {
1823
1822
  if (e == null)
1824
1823
  return { op: [], invertOp: [] };
1825
- const { unitId: t, subUnitId: s, drawingId: i } = e;
1826
- if (this._establishDrawingMap(t, s, i) == null)
1824
+ const { unitId: t, subUnitId: i, drawingId: s } = e;
1825
+ if (this._establishDrawingMap(t, i, s) == null)
1827
1826
  return { op: [], invertOp: [] };
1828
- const l = F.removeOp([t, s, "data", i], !0), a = F.removeOp([t, s, "order", this._getDrawingOrder(t, s).indexOf(i)], !0), E = [l, a].reduce(F.type.compose, null), W = F.type.invertWithDoc(E, this.drawingManagerData);
1827
+ const l = F.removeOp([t, i, "data", s], !0), a = F.removeOp([t, i, "order", this._getDrawingOrder(t, i).indexOf(s)], !0), E = [l, a].reduce(F.type.compose, null), W = F.type.invertWithDoc(E, this.drawingManagerData);
1829
1828
  return { op: E, invertOp: W };
1830
1829
  }
1831
1830
  _updateByParam(e) {
1832
- const { unitId: t, subUnitId: s, drawingId: i } = e, d = this._establishDrawingMap(t, s, i);
1831
+ const { unitId: t, subUnitId: i, drawingId: s } = e, d = this._establishDrawingMap(t, i, s);
1833
1832
  if (d == null)
1834
1833
  return { op: [], invertOp: [] };
1835
1834
  const a = this._getUpdateParamCompareOp(e, d).reduce(F.type.compose, null), E = F.type.invertWithDoc(a, this.drawingManagerData);
@@ -1843,21 +1842,21 @@ class Ht {
1843
1842
  // });
1844
1843
  // }
1845
1844
  _getUpdateParamCompareOp(e, t) {
1846
- const { unitId: s, subUnitId: i, drawingId: d } = e, l = [];
1845
+ const { unitId: i, subUnitId: s, drawingId: d } = e, l = [];
1847
1846
  return Object.keys(e).forEach((a) => {
1848
1847
  const E = e[a], W = t[a];
1849
1848
  W !== E && l.push(
1850
- F.replaceOp([s, i, "data", d, a], W, E)
1849
+ F.replaceOp([i, s, "data", d, a], W, E)
1851
1850
  );
1852
1851
  }), l;
1853
1852
  }
1854
1853
  _getDrawingData(e, t) {
1855
- var s, i;
1856
- return ((i = (s = this.drawingManagerData[e]) == null ? void 0 : s[t]) == null ? void 0 : i.data) || {};
1854
+ var i, s;
1855
+ return ((s = (i = this.drawingManagerData[e]) == null ? void 0 : i[t]) == null ? void 0 : s.data) || {};
1857
1856
  }
1858
1857
  _getDrawingOrder(e, t) {
1859
- var s, i;
1860
- return ((i = (s = this.drawingManagerData[e]) == null ? void 0 : s[t]) == null ? void 0 : i.order) || [];
1858
+ var i, s;
1859
+ return ((s = (i = this.drawingManagerData[e]) == null ? void 0 : i[t]) == null ? void 0 : s.order) || [];
1861
1860
  }
1862
1861
  getDrawingVisible() {
1863
1862
  return this._visible;
@@ -1874,20 +1873,19 @@ class Ht {
1874
1873
  }
1875
1874
  class Kt extends Ht {
1876
1875
  }
1877
- function an(n) {
1878
- const { unitId: e, subUnitId: t, drawingId: s } = n;
1879
- return `${e}#-#${t}#-#${s}`;
1876
+ function cn({ unitId: n, subUnitId: e, drawingId: t }, i) {
1877
+ return typeof i == "number" ? `${n}#-#${e}#-#${t}#-#${i}` : `${n}#-#${e}#-#${t}`;
1880
1878
  }
1881
- const cn = async (n) => new Promise((e, t) => {
1882
- const s = new Image();
1883
- s.src = n, s.onload = () => {
1879
+ const un = async (n) => new Promise((e, t) => {
1880
+ const i = new Image();
1881
+ i.src = n, i.onload = () => {
1884
1882
  e({
1885
- width: s.width,
1886
- height: s.height,
1887
- image: s
1883
+ width: i.width,
1884
+ height: i.height,
1885
+ image: i
1888
1886
  });
1889
- }, s.onerror = (i) => {
1890
- t(i);
1887
+ }, i.onerror = (s) => {
1888
+ t(s);
1891
1889
  };
1892
1890
  });
1893
1891
  var et = /* @__PURE__ */ ((n) => (n.URL = "URL", n.UUID = "UUID", n.BASE64 = "BASE64", n))(et || {}), Ze = /* @__PURE__ */ ((n) => (n.SUCCUSS = "0", n.ERROR_EXCEED_SIZE = "1", n.ERROR_IMAGE_TYPE = "2", n.ERROR_UPLOAD_COUNT_LIMIT = "3", n.ERROR_IMAGE = "4", n))(Ze || {});
@@ -1904,33 +1902,33 @@ class Ft {
1904
1902
  }
1905
1903
  getImageSourceCache(e, t) {
1906
1904
  if (t === et.BASE64) {
1907
- const s = new Image();
1908
- return s.src = e, s;
1905
+ const i = new Image();
1906
+ return i.src = e, i;
1909
1907
  }
1910
1908
  return this._imageSourceCache.get(e);
1911
1909
  }
1912
- addImageSourceCache(e, t, s) {
1913
- t === et.BASE64 || s == null || this._imageSourceCache.set(e, s);
1910
+ addImageSourceCache(e, t, i) {
1911
+ t === et.BASE64 || i == null || this._imageSourceCache.set(e, i);
1914
1912
  }
1915
1913
  async getImage(e) {
1916
1914
  return Promise.resolve(e);
1917
1915
  }
1918
1916
  async saveImage(e) {
1919
- return new Promise((t, s) => {
1917
+ return new Promise((t, i) => {
1920
1918
  if (!Wt.includes(e.type)) {
1921
- s(new Error(Ze.ERROR_IMAGE_TYPE)), this._decreaseWaiting();
1919
+ i(new Error(Ze.ERROR_IMAGE_TYPE)), this._decreaseWaiting();
1922
1920
  return;
1923
1921
  }
1924
1922
  if (e.size > $t) {
1925
- s(new Error(Ze.ERROR_EXCEED_SIZE)), this._decreaseWaiting();
1923
+ i(new Error(Ze.ERROR_EXCEED_SIZE)), this._decreaseWaiting();
1926
1924
  return;
1927
1925
  }
1928
- const i = new FileReader();
1929
- i.readAsDataURL(e), i.onload = (d) => {
1926
+ const s = new FileReader();
1927
+ s.readAsDataURL(e), s.onload = (d) => {
1930
1928
  var E;
1931
1929
  const l = (E = d.target) == null ? void 0 : E.result;
1932
1930
  if (l == null) {
1933
- s(new Error(Ze.ERROR_IMAGE)), this._decreaseWaiting();
1931
+ i(new Error(Ze.ERROR_IMAGE)), this._decreaseWaiting();
1934
1932
  return;
1935
1933
  }
1936
1934
  const a = kt.generateRandomId(6);
@@ -1948,17 +1946,17 @@ class Ft {
1948
1946
  this._waitCount -= 1, this._change$.next(this._waitCount);
1949
1947
  }
1950
1948
  }
1951
- const un = "__default_document_sub_component_id20231101__";
1949
+ const dn = "__default_document_sub_component_id20231101__";
1952
1950
  var qt = /* @__PURE__ */ ((n) => (n[n.forward = 0] = "forward", n[n.backward = 1] = "backward", n[n.front = 2] = "front", n[n.back = 3] = "back", n))(qt || {}), zt = /* @__PURE__ */ ((n) => (n[n.UNRECOGNIZED = -1] = "UNRECOGNIZED", n[n.DRAWING_IMAGE = 0] = "DRAWING_IMAGE", n[n.DRAWING_SHAPE = 1] = "DRAWING_SHAPE", n[n.DRAWING_CHART = 2] = "DRAWING_CHART", n[n.DRAWING_TABLE = 3] = "DRAWING_TABLE", n[n.DRAWING_SMART_ART = 4] = "DRAWING_SMART_ART", n[n.DRAWING_VIDEO = 5] = "DRAWING_VIDEO", n[n.DRAWING_GROUP = 6] = "DRAWING_GROUP", n[n.DRAWING_UNIT = 7] = "DRAWING_UNIT", n[n.DRAWING_DOM = 8] = "DRAWING_DOM", n))(zt || {});
1953
1951
  const Xt = It("univer.drawing-manager.service");
1954
- var Yt = Object.defineProperty, Zt = Object.getOwnPropertyDescriptor, Jt = (n, e, t, s) => {
1955
- for (var i = s > 1 ? void 0 : s ? Zt(e, t) : e, d = n.length - 1, l; d >= 0; d--)
1956
- (l = n[d]) && (i = (s ? l(e, t, i) : l(i)) || i);
1957
- return s && i && Yt(e, t, i), i;
1958
- }, Qt = (n, e) => (t, s) => e(t, s, n);
1952
+ var Yt = Object.defineProperty, Zt = Object.getOwnPropertyDescriptor, Jt = (n, e, t, i) => {
1953
+ for (var s = i > 1 ? void 0 : i ? Zt(e, t) : e, d = n.length - 1, l; d >= 0; d--)
1954
+ (l = n[d]) && (s = (i ? l(e, t, s) : l(s)) || s);
1955
+ return i && s && Yt(e, t, s), s;
1956
+ }, Qt = (n, e) => (t, i) => e(t, i, n);
1959
1957
  const en = "DRAWING_PLUGIN";
1960
1958
  var ot;
1961
- let wt = (ot = class extends jt {
1959
+ let wt = (ot = class extends Rt {
1962
1960
  constructor(n, e) {
1963
1961
  super(), this._config = n, this._injector = e;
1964
1962
  }
@@ -1966,24 +1964,24 @@ let wt = (ot = class extends jt {
1966
1964
  this._initDependencies(n);
1967
1965
  }
1968
1966
  _initDependencies(n) {
1969
- var s;
1970
- Tt([
1967
+ var i;
1968
+ St([
1971
1969
  [Vt, { useClass: Ft }],
1972
1970
  [Xt, { useClass: Kt }]
1973
- ], (s = this._config) == null ? void 0 : s.override).forEach((i) => n.add(i));
1971
+ ], (i = this._config) == null ? void 0 : i.override).forEach((s) => n.add(s));
1974
1972
  }
1975
1973
  }, V(ot, "pluginName", en), ot);
1976
1974
  wt = Jt([
1977
- Qt(1, Rt(St))
1975
+ Qt(1, Tt(jt))
1978
1976
  ], wt);
1979
1977
  export {
1980
1978
  qt as ArrangeTypeEnum,
1981
- un as DEFAULT_DOCUMENT_SUB_COMPONENT_ID,
1979
+ dn as DEFAULT_DOCUMENT_SUB_COMPONENT_ID,
1982
1980
  Wt as DRAWING_IMAGE_ALLOW_IMAGE_LIST,
1983
1981
  $t as DRAWING_IMAGE_ALLOW_SIZE,
1984
- ln as DRAWING_IMAGE_COUNT_LIMIT,
1985
- on as DRAWING_IMAGE_HEIGHT_LIMIT,
1986
- sn as DRAWING_IMAGE_WIDTH_LIMIT,
1982
+ an as DRAWING_IMAGE_COUNT_LIMIT,
1983
+ ln as DRAWING_IMAGE_HEIGHT_LIMIT,
1984
+ on as DRAWING_IMAGE_WIDTH_LIMIT,
1987
1985
  Kt as DrawingManagerService,
1988
1986
  zt as DrawingTypeEnum,
1989
1987
  Xt as IDrawingManagerService,
@@ -1993,6 +1991,6 @@ export {
1993
1991
  Ze as ImageUploadStatusType,
1994
1992
  Ht as UnitDrawingService,
1995
1993
  wt as UniverDrawingPlugin,
1996
- an as getDrawingShapeKeyByDrawingSearch,
1997
- cn as getImageSize
1994
+ cn as getDrawingShapeKeyByDrawingSearch,
1995
+ un as getImageSize
1998
1996
  };