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