@univerjs/drawing 0.2.2 → 0.2.4-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,59 +1,58 @@
1
- var Dt = Object.defineProperty;
2
- var Ut = (t, e, n) => e in t ? Dt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var V = (t, e, n) => Ut(t, typeof e != "symbol" ? e + "" : e, n);
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);
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";
7
- const on = 500, ln = 500, an = 10, $t = 5 * 1024 * 1024, Wt = ["image/png", "image/jpeg", "image/jpg", "image/gif", "image/bmp"];
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"];
8
7
  var Ce = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, F = {}, Ct = {}, ct = {};
9
8
  Object.defineProperty(ct, "__esModule", { value: !0 });
10
- function Gt(t, e) {
9
+ function Gt(n, e) {
11
10
  if (Array.isArray(e))
12
11
  return !1;
13
- for (let n in t)
14
- if (!ut(t[n], e[n]))
12
+ for (let t in n)
13
+ if (!ut(n[t], e[t]))
15
14
  return !1;
16
- for (let n in e)
17
- if (t[n] === void 0)
15
+ for (let t in e)
16
+ if (n[t] === void 0)
18
17
  return !1;
19
18
  return !0;
20
19
  }
21
- function Bt(t, e) {
22
- if (!Array.isArray(e) || t.length !== e.length)
20
+ function Bt(n, e) {
21
+ if (!Array.isArray(e) || n.length !== e.length)
23
22
  return !1;
24
- for (let n = 0; n < t.length; n++)
25
- if (!ut(t[n], e[n]))
23
+ for (let t = 0; t < n.length; t++)
24
+ if (!ut(n[t], e[t]))
26
25
  return !1;
27
26
  return !0;
28
27
  }
29
- function ut(t, e) {
30
- return t === e ? !0 : t === null || e === null || typeof t != "object" || typeof e != "object" ? !1 : Array.isArray(t) ? Bt(t, e) : Gt(t, e);
28
+ function ut(n, e) {
29
+ return n === e ? !0 : n === null || e === null || typeof n != "object" || typeof e != "object" ? !1 : Array.isArray(n) ? Bt(n, e) : Gt(n, e);
31
30
  }
32
31
  ct.default = ut;
33
32
  var dt = {};
34
33
  Object.defineProperty(dt, "__esModule", { value: !0 });
35
- function lt(t) {
36
- if (t === null)
34
+ function lt(n) {
35
+ if (n === null)
37
36
  return null;
38
- if (Array.isArray(t))
39
- return t.map(lt);
40
- if (typeof t == "object") {
37
+ if (Array.isArray(n))
38
+ return n.map(lt);
39
+ if (typeof n == "object") {
41
40
  const e = {};
42
- for (let n in t)
43
- e[n] = lt(t[n]);
41
+ for (let t in n)
42
+ e[t] = lt(n[t]);
44
43
  return e;
45
44
  } else
46
- return t;
45
+ return n;
47
46
  }
48
47
  dt.default = lt;
49
48
  var ft = {};
50
- (function(t) {
51
- Object.defineProperty(t, "__esModule", { value: !0 }), t.eachChildOf = t.advancer = t.readCursor = t.writeCursor = t.WriteCursor = t.ReadCursor = t.isValidPathItem = void 0;
49
+ (function(n) {
50
+ Object.defineProperty(n, "__esModule", { value: !0 }), n.eachChildOf = n.advancer = n.readCursor = n.writeCursor = n.WriteCursor = n.ReadCursor = n.isValidPathItem = void 0;
52
51
  function e(O, o) {
53
52
  if (!O)
54
53
  throw new Error(o);
55
54
  }
56
- const n = (O) => O != null && typeof O == "object" && !Array.isArray(O), s = (O, o) => (
55
+ const t = (O) => O != null && typeof O == "object" && !Array.isArray(O), s = (O, o) => (
57
56
  // All the numbers, then all the letters. Just as the gods of ascii intended.
58
57
  typeof O == typeof o ? O > o : typeof O == "string" && typeof o == "number"
59
58
  );
@@ -63,19 +62,19 @@ var ft = {};
63
62
  o.write(h, O[h]);
64
63
  }
65
64
  }
66
- t.isValidPathItem = (O) => typeof O == "number" || typeof O == "string" && O !== "__proto__";
65
+ n.isValidPathItem = (O) => typeof O == "number" || typeof O == "string" && O !== "__proto__";
67
66
  class d {
68
67
  constructor(o = null) {
69
68
  this.parents = [], this.indexes = [], this.lcIdx = -1, this.idx = -1, this.container = o;
70
69
  }
71
70
  ascend() {
72
- e(this.parents.length === this.indexes.length / 2), this.idx === 0 ? this.parents.length ? (this.lcIdx = this.indexes.pop(), this.container = this.parents.pop(), this.idx = this.indexes.pop()) : (this.lcIdx = 0, this.idx = -1) : (e(this.idx > 0), this.idx--, n(this.container[this.idx]) && this.idx--);
71
+ e(this.parents.length === this.indexes.length / 2), this.idx === 0 ? this.parents.length ? (this.lcIdx = this.indexes.pop(), this.container = this.parents.pop(), this.idx = this.indexes.pop()) : (this.lcIdx = 0, this.idx = -1) : (e(this.idx > 0), this.idx--, t(this.container[this.idx]) && this.idx--);
73
72
  }
74
73
  getPath() {
75
74
  const o = [];
76
75
  let c = this.container, h = this.parents.length - 1, R = this.idx;
77
76
  for (; R >= 0; )
78
- o.unshift(c[R]), R === 0 ? (R = this.indexes[h * 2], c = this.parents[h--]) : R -= n(c[R - 1]) ? 2 : 1;
77
+ o.unshift(c[R]), R === 0 ? (R = this.indexes[h * 2], c = this.parents[h--]) : R -= t(c[R - 1]) ? 2 : 1;
79
78
  return o;
80
79
  }
81
80
  }
@@ -89,13 +88,13 @@ var ft = {};
89
88
  }
90
89
  getComponent() {
91
90
  let o;
92
- return this.container && this.container.length > this.idx + 1 && n(o = this.container[this.idx + 1]) ? o : null;
91
+ return this.container && this.container.length > this.idx + 1 && t(o = this.container[this.idx + 1]) ? o : null;
93
92
  }
94
93
  descendFirst() {
95
94
  let o = this.idx + 1;
96
- if (!this.container || o >= this.container.length || n(this.container[o]) && o + 1 >= this.container.length)
95
+ if (!this.container || o >= this.container.length || t(this.container[o]) && o + 1 >= this.container.length)
97
96
  return !1;
98
- n(this.container[o]) && o++;
97
+ t(this.container[o]) && o++;
99
98
  const c = this.container[o];
100
99
  return Array.isArray(c) ? (this.indexes.push(this.idx), this.parents.push(this.container), this.indexes.push(o), this.idx = 0, this.container = c) : this.idx = o, !0;
101
100
  }
@@ -140,7 +139,7 @@ var ft = {};
140
139
  });
141
140
  }
142
141
  }
143
- t.ReadCursor = l;
142
+ n.ReadCursor = l;
144
143
  class a extends d {
145
144
  constructor(o = null) {
146
145
  super(o), this.pendingDescent = [], this._op = o;
@@ -150,7 +149,7 @@ var ft = {};
150
149
  for (let o = 0; o < this.pendingDescent.length; o++) {
151
150
  const c = this.pendingDescent[o];
152
151
  let h = this.idx + 1;
153
- if (h < this.container.length && n(this.container[h]) && h++, e(h === this.container.length || !n(this.container[h])), h === this.container.length)
152
+ if (h < this.container.length && t(this.container[h]) && h++, e(h === this.container.length || !t(this.container[h])), h === this.container.length)
154
153
  this.container.push(c), this.idx = h;
155
154
  else if (this.container[h] === c)
156
155
  this.idx = h;
@@ -180,7 +179,7 @@ var ft = {};
180
179
  getComponent() {
181
180
  this.flushDescent();
182
181
  const o = this.idx + 1;
183
- if (o < this.container.length && n(this.container[o]))
182
+ if (o < this.container.length && t(this.container[o]))
184
183
  return this.container[o];
185
184
  {
186
185
  const c = {};
@@ -195,7 +194,7 @@ var ft = {};
195
194
  return this._op;
196
195
  }
197
196
  descend(o) {
198
- if (!t.isValidPathItem(o))
197
+ if (!n.isValidPathItem(o))
199
198
  throw Error("Invalid JSON key");
200
199
  this.pendingDescent.push(o);
201
200
  }
@@ -239,7 +238,7 @@ var ft = {};
239
238
  return o.push(...this.pendingDescent), o;
240
239
  }
241
240
  }
242
- t.WriteCursor = a, t.writeCursor = () => new a(), t.readCursor = (O) => new l(O);
241
+ n.WriteCursor = a, n.writeCursor = () => new a(), n.readCursor = (O) => new l(O);
243
242
  function E(O, o, c) {
244
243
  let h, R;
245
244
  R = h = O ? O.descendFirst() : !1;
@@ -262,7 +261,7 @@ var ft = {};
262
261
  h && O.ascend();
263
262
  }, Z;
264
263
  }
265
- t.advancer = E;
264
+ n.advancer = E;
266
265
  function W(O, o, c) {
267
266
  let h, R, Z, pe;
268
267
  for (h = R = O && O.descendFirst(), Z = pe = o && o.descendFirst(); h || Z; ) {
@@ -271,39 +270,39 @@ var ft = {};
271
270
  }
272
271
  R && O.ascend(), pe && o.ascend();
273
272
  }
274
- t.eachChildOf = W;
273
+ n.eachChildOf = W;
275
274
  })(ft);
276
275
  var ht = {};
277
- (function(t) {
278
- Object.defineProperty(t, "__esModule", { value: !0 }), t.ConflictType = void 0, function(e) {
276
+ (function(n) {
277
+ Object.defineProperty(n, "__esModule", { value: !0 }), n.ConflictType = void 0, function(e) {
279
278
  e[e.RM_UNEXPECTED_CONTENT = 1] = "RM_UNEXPECTED_CONTENT", e[e.DROP_COLLISION = 2] = "DROP_COLLISION", e[e.BLACKHOLE = 3] = "BLACKHOLE";
280
- }(t.ConflictType || (t.ConflictType = {}));
279
+ }(n.ConflictType || (n.ConflictType = {}));
281
280
  })(ht);
282
281
  var it = {}, Fe = {}, vt;
283
282
  function pt() {
284
- return vt || (vt = 1, Object.defineProperty(Fe, "__esModule", { value: !0 }), Fe.uniToStrPos = Fe.strPosToUni = void 0, Fe.strPosToUni = (t, e = t.length) => {
285
- let n = 0, s = 0;
283
+ 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;
286
285
  for (; s < e; s++) {
287
- const i = t.charCodeAt(s);
288
- i >= 55296 && i <= 57343 && (n++, s++);
286
+ const i = n.charCodeAt(s);
287
+ i >= 55296 && i <= 57343 && (t++, s++);
289
288
  }
290
289
  if (s !== e)
291
290
  throw Error("Invalid offset - splits unicode bytes");
292
- return s - n;
293
- }, Fe.uniToStrPos = (t, e) => {
294
- let n = 0;
291
+ return s - t;
292
+ }, Fe.uniToStrPos = (n, e) => {
293
+ let t = 0;
295
294
  for (; e > 0; e--) {
296
- const s = t.charCodeAt(n);
297
- n += s >= 55296 && s <= 57343 ? 2 : 1;
295
+ const s = n.charCodeAt(t);
296
+ t += s >= 55296 && s <= 57343 ? 2 : 1;
298
297
  }
299
- return n;
298
+ return t;
300
299
  }), Fe;
301
300
  }
302
301
  var st = {}, yt;
303
302
  function at() {
304
- return yt || (yt = 1, function(t) {
305
- Object.defineProperty(t, "__esModule", { value: !0 }), t.uniSlice = t.dlen = t.eachOp = void 0;
306
- const e = pt(), n = (f) => {
303
+ return yt || (yt = 1, function(n) {
304
+ Object.defineProperty(n, "__esModule", { value: !0 }), n.uniSlice = n.dlen = n.eachOp = void 0;
305
+ const e = pt(), t = (f) => {
307
306
  if (!Array.isArray(f))
308
307
  throw Error("Op must be an array of components");
309
308
  let _ = null;
@@ -313,7 +312,7 @@ function at() {
313
312
  case "object":
314
313
  if (typeof L.d != "number" && typeof L.d != "string")
315
314
  throw Error("Delete must be number or string");
316
- if (t.dlen(L.d) <= 0)
315
+ if (n.dlen(L.d) <= 0)
317
316
  throw Error("Deletes must not be empty");
318
317
  break;
319
318
  case "string":
@@ -338,7 +337,7 @@ function at() {
338
337
  const H = f[z];
339
338
  switch (_(H, w, L), typeof H) {
340
339
  case "object":
341
- w += t.dlen(H.d);
340
+ w += n.dlen(H.d);
342
341
  break;
343
342
  case "string":
344
343
  L += e.strPosToUni(H);
@@ -349,34 +348,34 @@ function at() {
349
348
  }
350
349
  }
351
350
  }
352
- t.eachOp = s;
351
+ n.eachOp = s;
353
352
  function i(f, _) {
354
353
  const w = [], L = a(w);
355
- return s(f, (z, H, Ae) => {
356
- L(_(z, H, Ae));
354
+ return s(f, (z, H, De) => {
355
+ L(_(z, H, De));
357
356
  }), o(w);
358
357
  }
359
358
  const d = (f) => f, l = (f) => i(f, d);
360
- t.dlen = (f) => typeof f == "number" ? f : e.strPosToUni(f);
359
+ n.dlen = (f) => typeof f == "number" ? f : e.strPosToUni(f);
361
360
  const a = (f) => (_) => {
362
361
  if (!(!_ || _.d === 0 || _.d === "")) if (f.length === 0)
363
362
  f.push(_);
364
363
  else if (typeof _ == typeof f[f.length - 1])
365
364
  if (typeof _ == "object") {
366
365
  const w = f[f.length - 1];
367
- w.d = typeof w.d == "string" && typeof _.d == "string" ? w.d + _.d : t.dlen(w.d) + t.dlen(_.d);
366
+ w.d = typeof w.d == "string" && typeof _.d == "string" ? w.d + _.d : n.dlen(w.d) + n.dlen(_.d);
368
367
  } else
369
368
  f[f.length - 1] += _;
370
369
  else
371
370
  f.push(_);
372
371
  }, E = (f) => typeof f == "number" ? f : typeof f == "string" ? e.strPosToUni(f) : typeof f.d == "number" ? f.d : e.strPosToUni(f.d);
373
- t.uniSlice = (f, _, w) => {
372
+ n.uniSlice = (f, _, w) => {
374
373
  const L = e.uniToStrPos(f, _), z = w == null ? 1 / 0 : e.uniToStrPos(f, w);
375
374
  return f.slice(L, z);
376
375
  };
377
- const W = (f, _, w) => typeof f == "number" ? w == null ? f - _ : Math.min(f, w) - _ : t.uniSlice(f, _, w), O = (f) => {
376
+ const W = (f, _, w) => typeof f == "number" ? w == null ? f - _ : Math.min(f, w) - _ : n.uniSlice(f, _, w), O = (f) => {
378
377
  let _ = 0, w = 0;
379
- return { take: (H, Ae) => {
378
+ return { take: (H, De) => {
380
379
  if (_ === f.length)
381
380
  return H === -1 ? null : H;
382
381
  const ue = f[_];
@@ -384,14 +383,14 @@ function at() {
384
383
  if (typeof ue == "number")
385
384
  return H === -1 || ue - w <= H ? (ne = ue - w, ++_, w = 0, ne) : (w += H, H);
386
385
  if (typeof ue == "string") {
387
- if (H === -1 || Ae === "i" || e.strPosToUni(ue.slice(w)) <= H)
386
+ if (H === -1 || De === "i" || e.strPosToUni(ue.slice(w)) <= H)
388
387
  return ne = ue.slice(w), ++_, w = 0, ne;
389
388
  {
390
389
  const ae = w + e.uniToStrPos(ue.slice(w), H);
391
390
  return ne = ue.slice(w, ae), w = ae, ne;
392
391
  }
393
392
  } else {
394
- if (H === -1 || Ae === "d" || t.dlen(ue.d) - w <= H)
393
+ if (H === -1 || De === "d" || n.dlen(ue.d) - w <= H)
395
394
  return ne = { d: W(ue.d, w) }, ++_, w = 0, ne;
396
395
  {
397
396
  let ae = W(ue.d, w, w + H);
@@ -403,30 +402,30 @@ function at() {
403
402
  function c(f, _, w) {
404
403
  if (w !== "left" && w !== "right")
405
404
  throw Error("side (" + w + ") must be 'left' or 'right'");
406
- n(f), n(_);
407
- const L = [], z = a(L), { take: H, peek: Ae } = O(f);
405
+ t(f), t(_);
406
+ const L = [], z = a(L), { take: H, peek: De } = O(f);
408
407
  for (let ne = 0; ne < _.length; ne++) {
409
408
  const ae = _[ne];
410
- let ge, Pe;
409
+ let ge, Ae;
411
410
  switch (typeof ae) {
412
411
  case "number":
413
412
  for (ge = ae; ge > 0; )
414
- Pe = H(ge, "i"), z(Pe), typeof Pe != "string" && (ge -= E(Pe));
413
+ Ae = H(ge, "i"), z(Ae), typeof Ae != "string" && (ge -= E(Ae));
415
414
  break;
416
415
  case "string":
417
- w === "left" && typeof Ae() == "string" && z(H(-1)), z(e.strPosToUni(ae));
416
+ w === "left" && typeof De() == "string" && z(H(-1)), z(e.strPosToUni(ae));
418
417
  break;
419
418
  case "object":
420
- for (ge = t.dlen(ae.d); ge > 0; )
421
- switch (Pe = H(ge, "i"), typeof Pe) {
419
+ for (ge = n.dlen(ae.d); ge > 0; )
420
+ switch (Ae = H(ge, "i"), typeof Ae) {
422
421
  case "number":
423
- ge -= Pe;
422
+ ge -= Ae;
424
423
  break;
425
424
  case "string":
426
- z(Pe);
425
+ z(Ae);
427
426
  break;
428
427
  case "object":
429
- ge -= t.dlen(Pe.d);
428
+ ge -= n.dlen(Ae.d);
430
429
  }
431
430
  break;
432
431
  }
@@ -437,10 +436,10 @@ function at() {
437
436
  return o(L);
438
437
  }
439
438
  function h(f, _) {
440
- n(f), n(_);
439
+ t(f), t(_);
441
440
  const w = [], L = a(w), { take: z } = O(f);
442
- for (let Ae = 0; Ae < _.length; Ae++) {
443
- const ue = _[Ae];
441
+ for (let De = 0; De < _.length; De++) {
442
+ const ue = _[De];
444
443
  let ne, ae;
445
444
  switch (typeof ue) {
446
445
  case "number":
@@ -451,7 +450,7 @@ function at() {
451
450
  L(ue);
452
451
  break;
453
452
  case "object":
454
- ne = t.dlen(ue.d);
453
+ ne = n.dlen(ue.d);
455
454
  let ge = 0;
456
455
  for (; ge < ne; )
457
456
  switch (ae = z(ne - ge, "d"), typeof ae) {
@@ -486,7 +485,7 @@ function at() {
486
485
  w += H, f += H;
487
486
  break;
488
487
  case "object":
489
- f -= Math.min(t.dlen(z.d), f - w);
488
+ f -= Math.min(n.dlen(z.d), f - w);
490
489
  break;
491
490
  }
492
491
  }
@@ -524,7 +523,7 @@ function at() {
524
523
  uri: "http://sharejs.org/types/text-unicode",
525
524
  trim: o,
526
525
  normalize: l,
527
- checkOp: n,
526
+ checkOp: t,
528
527
  /** Create a new text snapshot.
529
528
  *
530
529
  * @param {string} initial - initial snapshot data. Optional. Defaults to ''.
@@ -538,7 +537,7 @@ function at() {
538
537
  /** Apply an operation to a document snapshot
539
538
  */
540
539
  apply(_, w) {
541
- n(w);
540
+ t(w);
542
541
  const L = f.builder(_);
543
542
  for (let z = 0; z < w.length; z++) {
544
543
  const H = w[z];
@@ -550,7 +549,7 @@ function at() {
550
549
  L.append(H);
551
550
  break;
552
551
  case "object":
553
- L.del(t.dlen(H.d));
552
+ L.del(n.dlen(H.d));
554
553
  break;
555
554
  }
556
555
  }
@@ -572,15 +571,15 @@ function at() {
572
571
  isNoop: (_) => _.length === 0
573
572
  };
574
573
  }
575
- t.default = ve;
574
+ n.default = ve;
576
575
  }(st)), st;
577
576
  }
578
577
  var Qe = {}, bt;
579
578
  function xt() {
580
579
  if (bt) return Qe;
581
580
  bt = 1, Object.defineProperty(Qe, "__esModule", { value: !0 });
582
- const t = at(), e = pt();
583
- function n(s, i) {
581
+ const n = at(), e = pt();
582
+ function t(s, i) {
584
583
  return {
585
584
  // Returns the text content of the document
586
585
  get: s,
@@ -602,13 +601,13 @@ function xt() {
602
601
  //onInsert: function(pos, text) {},
603
602
  //onRemove: function(pos, removedLength) {},
604
603
  _onOp(d) {
605
- t.eachOp(d, (l, a, E) => {
604
+ n.eachOp(d, (l, a, E) => {
606
605
  switch (typeof l) {
607
606
  case "string":
608
607
  this.onInsert && this.onInsert(E, l);
609
608
  break;
610
609
  case "object":
611
- const W = t.dlen(l.d);
610
+ const W = n.dlen(l.d);
612
611
  this.onRemove && this.onRemove(E, W);
613
612
  }
614
613
  });
@@ -617,18 +616,18 @@ function xt() {
617
616
  onRemove: null
618
617
  };
619
618
  }
620
- return Qe.default = n, n.provides = { text: !0 }, Qe;
619
+ return Qe.default = t, t.provides = { text: !0 }, Qe;
621
620
  }
622
621
  var mt;
623
622
  function Lt() {
624
- return mt || (mt = 1, function(t) {
623
+ return mt || (mt = 1, function(n) {
625
624
  var e = Ce && Ce.__createBinding || (Object.create ? function(c, h, R, Z) {
626
625
  Z === void 0 && (Z = R), Object.defineProperty(c, Z, { enumerable: !0, get: function() {
627
626
  return h[R];
628
627
  } });
629
628
  } : function(c, h, R, Z) {
630
629
  Z === void 0 && (Z = R), c[Z] = h[R];
631
- }), n = Ce && Ce.__setModuleDefault || (Object.create ? function(c, h) {
630
+ }), t = Ce && Ce.__setModuleDefault || (Object.create ? function(c, h) {
632
631
  Object.defineProperty(c, "default", { enumerable: !0, value: h });
633
632
  } : function(c, h) {
634
633
  c.default = h;
@@ -636,11 +635,11 @@ function Lt() {
636
635
  if (c && c.__esModule) return c;
637
636
  var h = {};
638
637
  if (c != null) for (var R in c) Object.hasOwnProperty.call(c, R) && e(h, c, R);
639
- return n(h, c), h;
638
+ return t(h, c), h;
640
639
  }, i = Ce && Ce.__importDefault || function(c) {
641
640
  return c && c.__esModule ? c : { default: c };
642
641
  };
643
- Object.defineProperty(t, "__esModule", { value: !0 }), t.type = t.remove = t.insert = void 0;
642
+ Object.defineProperty(n, "__esModule", { value: !0 }), n.type = n.remove = n.insert = void 0;
644
643
  const d = pt(), l = s(at()), a = i(xt()), E = {
645
644
  create(c) {
646
645
  return c;
@@ -672,27 +671,27 @@ function Lt() {
672
671
  },
673
672
  slice: l.uniSlice
674
673
  }, W = l.default(E), O = Object.assign(Object.assign({}, W), { api: a.default });
675
- t.type = O, t.insert = (c, h) => h.length === 0 ? [] : c === 0 ? [h] : [c, h], t.remove = (c, h) => l.dlen(h) === 0 ? [] : c === 0 ? [{ d: h }] : [c, { d: h }];
674
+ n.type = O, n.insert = (c, h) => h.length === 0 ? [] : c === 0 ? [h] : [c, h], n.remove = (c, h) => l.dlen(h) === 0 ? [] : c === 0 ? [{ d: h }] : [c, { d: h }];
676
675
  var o = at();
677
- Object.defineProperty(t, "makeType", { enumerable: !0, get: function() {
676
+ Object.defineProperty(n, "makeType", { enumerable: !0, get: function() {
678
677
  return o.default;
679
678
  } });
680
679
  }(it)), it;
681
680
  }
682
- (function(t) {
681
+ (function(n) {
683
682
  var e = Ce && Ce.__importDefault || function(r) {
684
683
  return r && r.__esModule ? r : {
685
684
  default: r
686
685
  };
687
686
  };
688
- Object.defineProperty(t, "__esModule", {
687
+ Object.defineProperty(n, "__esModule", {
689
688
  value: !0
690
- }), t.editOp = t.replaceOp = t.insertOp = t.moveOp = t.removeOp = t.type = void 0;
691
- const n = e(ct), s = e(dt), i = ft, d = ht;
689
+ }), 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;
692
691
  function l(r, u) {
693
692
  if (!r) throw new Error(u);
694
693
  }
695
- t.type = {
694
+ n.type = {
696
695
  name: "json1",
697
696
  uri: "http://sharejs.org/types/JSONv1",
698
697
  readCursor: i.readCursor,
@@ -704,20 +703,20 @@ function Lt() {
704
703
  registerSubtype: J,
705
704
  checkValidOp: z,
706
705
  normalize: H,
707
- apply: Ae,
706
+ apply: De,
708
707
  transformPosition: ue,
709
708
  compose: ne,
710
709
  tryTransform: nt,
711
- transform: At,
712
- makeInvertible: Pe,
710
+ transform: Dt,
711
+ makeInvertible: Ae,
713
712
  invert: ae,
714
713
  invertWithDoc: Et,
715
714
  RM_UNEXPECTED_CONTENT: d.ConflictType.RM_UNEXPECTED_CONTENT,
716
715
  DROP_COLLISION: d.ConflictType.DROP_COLLISION,
717
716
  BLACKHOLE: d.ConflictType.BLACKHOLE,
718
717
  transformNoConflict: (r, u, y) => _t(() => !0, r, u, y),
719
- typeAllowingConflictsPred: (r) => Object.assign(Object.assign({}, t.type), {
720
- transform: (u, y, A) => _t(r, u, y, A)
718
+ typeAllowingConflictsPred: (r) => Object.assign(Object.assign({}, n.type), {
719
+ transform: (u, y, D) => _t(r, u, y, D)
721
720
  })
722
721
  };
723
722
  const a = (r) => r ? r.getComponent() : null;
@@ -731,9 +730,9 @@ function Lt() {
731
730
  function h(r, u, y) {
732
731
  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
732
  }
734
- t.removeOp = (r, u = !0) => i.writeCursor().writeAtPath(r, "r", u).get(), t.moveOp = (r, u) => i.writeCursor().writeMove(r, u).get(), t.insertOp = (r, u) => i.writeCursor().writeAtPath(r, "i", u).get(), t.replaceOp = (r, u, y) => i.writeCursor().at(r, (A) => {
735
- A.write("r", u), A.write("i", y);
736
- }).get(), t.editOp = (r, u, y, A = !1) => i.writeCursor().at(r, (b) => _(b, u, y, A)).get();
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
+ 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();
737
736
  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
737
  function J(r) {
739
738
  let u = r.type ? r.type : r;
@@ -753,9 +752,9 @@ function Lt() {
753
752
  invert: (r) => -r,
754
753
  transform: (r) => r
755
754
  });
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, A = !1) => {
755
+ 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
756
  const [b, C] = typeof u == "string" ? [Ie(u), u] : [u, u.name];
758
- !A && 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
+ !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)));
759
758
  };
760
759
  function w(r) {
761
760
  l(typeof r == "number"), l(r >= 0), l(r === (0 | r));
@@ -765,7 +764,7 @@ function Lt() {
765
764
  }
766
765
  function z(r) {
767
766
  if (r === null) return;
768
- const u = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Set(), A = (C) => {
767
+ const u = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Set(), D = (C) => {
769
768
  let $ = !0, j = !1;
770
769
  for (let p in C) {
771
770
  const v = C[p];
@@ -792,7 +791,7 @@ function Lt() {
792
791
  g === N ? l(m < G, "descent keys are not in order") : l(g === "number" && N === "string");
793
792
  }
794
793
  m = G, v++, p = 3;
795
- } else typeof T == "object" ? (l(p === 1, `Prev not scalar - instead ${p}`), A(T), p = 2) : (l(p !== 3), L(T), l(i.isValidPathItem(T), "Invalid path key"), p = 1);
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);
796
795
  }
797
796
  return l(v !== 1, "Operation makes multiple descents. Remove some []"), l(p === 2 || p === 3), C[0];
798
797
  };
@@ -801,8 +800,8 @@ function Lt() {
801
800
  }
802
801
  function H(r) {
803
802
  let u = 0, y = [];
804
- const A = i.writeCursor();
805
- return A.mergeTree(r, (b, C) => {
803
+ const D = i.writeCursor();
804
+ return D.mergeTree(r, (b, C) => {
806
805
  const $ = ve(b);
807
806
  if ($) {
808
807
  const p = f(b);
@@ -813,12 +812,12 @@ function Lt() {
813
812
  C.write(p, v);
814
813
  }
815
814
  var j;
816
- }), A.get();
815
+ }), D.get();
817
816
  }
818
- function Ae(r, u) {
817
+ function De(r, u) {
819
818
  if (z(u), u === null) return r;
820
819
  const y = [];
821
- return function A(b, C) {
820
+ return function D(b, C) {
822
821
  let $ = b, j = 0, p = {
823
822
  root: b
824
823
  }, v = 0, m = p, I = "root";
@@ -831,7 +830,7 @@ function Lt() {
831
830
  for (; j < C.length; j++) {
832
831
  const G = C[j];
833
832
  if (Array.isArray(G)) {
834
- const g = A($, G);
833
+ const g = D($, G);
835
834
  g !== $ && g !== void 0 && (T(), $ = m[I] = g);
836
835
  } else if (typeof G == "object") {
837
836
  G.d != null ? (T(), $ = h(m, I, y[G.d])) : G.i !== void 0 && (T(), $ = h(m, I, G.i));
@@ -841,7 +840,7 @@ function Lt() {
841
840
  } else $ = Z($, G);
842
841
  }
843
842
  return p.root;
844
- }(r = function A(b, C) {
843
+ }(r = function D(b, C) {
845
844
  const $ = [];
846
845
  let j = 0;
847
846
  for (; j < C.length; j++) {
@@ -849,7 +848,7 @@ function Lt() {
849
848
  if (Array.isArray(I)) break;
850
849
  typeof I != "object" && ($.push(b), b = Z(b, I));
851
850
  }
852
- for (let I = C.length - 1; I >= j; I--) b = A(b, C[I]);
851
+ for (let I = C.length - 1; I >= j; I--) b = D(b, C[I]);
853
852
  for (--j; j >= 0; j--) {
854
853
  const I = C[j];
855
854
  if (typeof I != "object") {
@@ -864,11 +863,11 @@ function Lt() {
864
863
  function ue(r, u) {
865
864
  r = r.slice(), z(u);
866
865
  const y = i.readCursor(u);
867
- let A, b, C = !1;
866
+ let D, b, C = !1;
868
867
  const $ = [];
869
868
  for (let p = 0; ; p++) {
870
869
  const v = r[p], m = y.getComponent();
871
- if (m && (m.r !== void 0 ? C = !0 : m.p != null && (C = !1, A = m.p, b = p)), p >= r.length) break;
870
+ if (m && (m.r !== void 0 ? C = !0 : m.p != null && (C = !1, D = m.p, b = p)), p >= r.length) break;
872
871
  let I = 0;
873
872
  const T = i.advancer(y, void 0, (g, N) => {
874
873
  O(N) && I++;
@@ -880,7 +879,7 @@ function Lt() {
880
879
  if ($.forEach((p) => p.end()), C) return null;
881
880
  const j = () => {
882
881
  let p = 0;
883
- if (A != null) {
882
+ if (D != null) {
884
883
  const v = y.getPath();
885
884
  p = v.length, r = v.concat(r.slice(b));
886
885
  }
@@ -898,80 +897,80 @@ function Lt() {
898
897
  if (typeof v == "number" && (r[p] += T), !G) break;
899
898
  }
900
899
  };
901
- return A != null ? y.eachDrop(null, (p) => {
902
- p === A && j();
900
+ return D != null ? y.eachDrop(null, (p) => {
901
+ p === D && j();
903
902
  }) : j(), r;
904
903
  }
905
904
  function ne(r, u) {
906
905
  if (z(r), z(u), r == null) return u;
907
906
  if (u == null) return r;
908
907
  let y = 0;
909
- const A = i.readCursor(r), b = i.readCursor(u), C = i.writeCursor(), $ = [], j = [], p = [], v = [], m = [], I = [], T = /* @__PURE__ */ new Set();
910
- A.traverse(null, (g) => {
911
- g.p != null && (p[g.p] = A.clone());
908
+ const D = i.readCursor(r), b = i.readCursor(u), C = i.writeCursor(), $ = [], j = [], p = [], v = [], m = [], I = [], T = /* @__PURE__ */ new Set();
909
+ D.traverse(null, (g) => {
910
+ g.p != null && (p[g.p] = D.clone());
912
911
  }), b.traverse(null, (g) => {
913
912
  g.d != null && (v[g.d] = b.clone());
914
913
  });
915
914
  const G = i.writeCursor();
916
915
  return function g(N, re, te, K, se, Te, be, _e) {
917
916
  l(re || te);
918
- const oe = a(re), De = a(te), Me = !!De && De.r !== void 0, Le = !!oe && oe.i !== void 0, Ue = oe ? oe.d : null, Ee = De ? De.p : null, $e = (Te || Me) && Ee == null;
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;
919
918
  if (Ee != null) K = v[Ee], be = j[Ee] = new i.WriteCursor();
920
- else if (De && De.r !== void 0) K = null;
919
+ else if (Pe && Pe.r !== void 0) K = null;
921
920
  else {
922
- const D = a(K);
923
- D && D.d != null && (K = null);
921
+ const P = a(K);
922
+ P && P.d != null && (K = null);
924
923
  }
925
924
  const Q = a(K);
926
925
  if (Ue != null) if (N = p[Ue], _e = $[Ue] = new i.WriteCursor(), $e) Te && !Me && _e.write("r", !0);
927
926
  else {
928
- const D = m[Ue] = y++;
929
- be.write("d", D);
927
+ const P = m[Ue] = y++;
928
+ be.write("d", P);
930
929
  }
931
930
  else if (oe && oe.i !== void 0) N = null;
932
931
  else {
933
- const D = a(N);
934
- D && D.p != null && (N = null);
932
+ const P = a(N);
933
+ P && P.p != null && (N = null);
935
934
  }
936
935
  let U;
937
936
  Le ? (l(se === void 0), U = oe.i) : U = se;
938
937
  const B = (Ee == null ? !Le || Te || Me : U === void 0) ? null : be.getComponent();
939
938
  if (Ee != null) {
940
939
  if (!(se !== void 0 || Le)) {
941
- const D = Ue != null ? m[Ue] : y++;
942
- I[Ee] = D, _e.write("p", D);
940
+ const P = Ue != null ? m[Ue] : y++;
941
+ I[Ee] = P, _e.write("p", P);
943
942
  }
944
- } else Me && (Le || se !== void 0 || (De.r, _e.write("r", De.r)));
945
- const M = $e ? null : ve(oe), P = ve(Q);
946
- if ((M || P) && (M && M.name, P && P.name), M && P) {
947
- l(M === P);
948
- const D = f(oe), x = f(Q), he = M.compose(D, x);
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);
949
948
  _(be, M, he), T.add(Q);
950
- } else M ? _(be, M, f(oe)) : P && (_(be, P, f(Q)), T.add(Q));
949
+ } else M ? _(be, M, f(oe)) : A && (_(be, A, f(Q)), T.add(Q));
951
950
  const k = typeof U == "object" && U != null;
952
951
  let X = !1, Y = 0, ee = 0, fe = 0, de = 0, le = 0;
953
- const ye = i.advancer(K, (D, x) => o(x) ? de - D - 1 : D - de, (D, x) => {
952
+ const ye = i.advancer(K, (P, x) => o(x) ? de - P - 1 : P - de, (P, x) => {
954
953
  o(x) && de++;
955
- }), q = i.advancer(N, (D, x) => O(x) ? Y - D - 1 : D - Y, (D, x) => {
954
+ }), q = i.advancer(N, (P, x) => O(x) ? Y - P - 1 : P - Y, (P, x) => {
956
955
  O(x) && Y++;
957
956
  });
958
- if (i.eachChildOf(re, te, (D, x, he) => {
959
- let me, We, He = D, Ne = D, Ye = D;
960
- if (typeof D == "number") {
961
- let Oe = D + fe;
957
+ if (i.eachChildOf(re, te, (P, x, he) => {
958
+ let me, We, He = P, Ne = P, Ye = P;
959
+ if (typeof P == "number") {
960
+ let Oe = P + fe;
962
961
  We = ye(Oe), Ne = Oe + de;
963
- let ce = D + ee;
964
- me = q(ce), o(a(We)) && (me = null), He = ce + Y, Ye = D + le, l(He >= 0, "p1PickKey is negative"), l(Ne >= 0, "p2DropKey is negative");
962
+ 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");
965
964
  const ke = o(a(x)), Ge = O(a(he));
966
965
  (ke || Ge && !$e) && le--, ke && ee--, Ge && fe--;
967
- } else me = q(D), We = ye(D);
966
+ } else me = q(P), We = ye(P);
968
967
  _e.descend(He), be.descend(Ne);
969
968
  const ze = k && !o(a(x)) ? U[Ye] : void 0, Se = g(me, x, he, We, ze, $e, be, _e);
970
969
  var je, S, ie;
971
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();
972
971
  }), q.end(), ye.end(), B != null) B.i = U;
973
972
  else if (!Te && !Me && Ee == null) return U;
974
- }(A, A.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()), A.traverse(C, (g, N) => {
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) => {
975
974
  const re = g.p;
976
975
  if (re != null) {
977
976
  const te = m[re];
@@ -994,7 +993,7 @@ function Lt() {
994
993
  function ae(r) {
995
994
  if (r == null) return null;
996
995
  const u = new i.ReadCursor(r), y = new i.WriteCursor();
997
- let A;
996
+ let D;
998
997
  const b = [], C = [];
999
998
  return function $(j, p, v) {
1000
999
  const m = j.getComponent();
@@ -1002,7 +1001,7 @@ function Lt() {
1002
1001
  if (m) {
1003
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);
1004
1003
  const g = ve(m);
1005
- g && (v === void 0 ? (A || (A = /* @__PURE__ */ new Set()), A.add(m)) : (f(m), v = g.apply(v, f(m)), T = !0));
1004
+ g && (v === void 0 ? (D || (D = /* @__PURE__ */ new Set()), D.add(m)) : (f(m), v = g.apply(v, f(m)), T = !0));
1006
1005
  }
1007
1006
  let G = 0;
1008
1007
  for (const g of j) {
@@ -1018,11 +1017,11 @@ function Lt() {
1018
1017
  }
1019
1018
  if (I === void 0) return T ? v : void 0;
1020
1019
  p.write("r", v);
1021
- }(u, y, void 0), A && (y.reset(), function $(j, p, v) {
1020
+ }(u, y, void 0), D && (y.reset(), function $(j, p, v) {
1022
1021
  const m = p.getComponent();
1023
1022
  if (m) {
1024
1023
  const g = m.d;
1025
- if (g != null && (j = b[g], v = C[g] = i.writeCursor()), A.has(m)) {
1024
+ if (g != null && (j = b[g], v = C[g] = i.writeCursor()), D.has(m)) {
1026
1025
  const N = ve(m);
1027
1026
  if (!N.invert) throw Error(`Cannot invert subtype ${N.name}`);
1028
1027
  _(v, N, N.invert(f(m)));
@@ -1046,12 +1045,12 @@ function Lt() {
1046
1045
  }))), y.get();
1047
1046
  }
1048
1047
  const ge = (r, u) => r.some((y) => typeof y == "object" && (Array.isArray(y) ? ge(y, u) : u(y)));
1049
- function Pe(r, u) {
1048
+ function Ae(r, u) {
1050
1049
  if (r == null || !ge(r, (p) => {
1051
1050
  var v;
1052
1051
  return p.r !== void 0 || ((v = ve(p)) === null || v === void 0 ? void 0 : v.makeInvertible) != null;
1053
1052
  })) return r;
1054
- const y = new i.ReadCursor(r), A = new i.WriteCursor();
1053
+ const y = new i.ReadCursor(r), D = new i.WriteCursor();
1055
1054
  let b = !1;
1056
1055
  const C = [], $ = [], j = (p, v, m) => {
1057
1056
  const I = p.getComponent();
@@ -1071,7 +1070,7 @@ function Lt() {
1071
1070
  }
1072
1071
  return I && (I.r !== void 0 ? (v.write("r", s.default(m)), m = void 0) : I.p != null && (m = void 0)), m;
1073
1072
  };
1074
- return j(y, A, u), A.get(), b && (A.reset(), function p(v, m, I, T, G) {
1073
+ return j(y, D, u), D.get(), b && (D.reset(), function p(v, m, I, T, G) {
1075
1074
  const g = m.getComponent();
1076
1075
  if (g) {
1077
1076
  g.i !== void 0 ? (T = g.i, G = !0) : g.d != null && (T = $[g.d], v = C[g.d], G = !1, g.d);
@@ -1093,23 +1092,23 @@ function Lt() {
1093
1092
  I.descend(K), p(te(K), m, I, se, G), I.ascend();
1094
1093
  }
1095
1094
  te.end();
1096
- }(y.clone(), y, A, u, !1)), A.get();
1095
+ }(y.clone(), y, D, u, !1)), D.get();
1097
1096
  }
1098
1097
  function Et(r, u) {
1099
- return ae(Pe(r, u));
1098
+ return ae(Ae(r, u));
1100
1099
  }
1101
1100
  const tt = (r) => {
1102
1101
  if (r == null) return null;
1103
1102
  const u = r.slice();
1104
1103
  for (let y = 0; y < r.length; y++) {
1105
- const A = u[y];
1106
- Array.isArray(A) && (u[y] = tt(A));
1104
+ const D = u[y];
1105
+ Array.isArray(D) && (u[y] = tt(D));
1107
1106
  }
1108
1107
  return u;
1109
1108
  };
1110
1109
  function nt(r, u, y) {
1111
1110
  l(y === "left" || y === "right", "Direction must be left or right");
1112
- const A = y === "left" ? 0 : 1;
1111
+ const D = y === "left" ? 0 : 1;
1113
1112
  if (u == null) return {
1114
1113
  ok: !0,
1115
1114
  result: r
@@ -1120,121 +1119,121 @@ function Lt() {
1120
1119
  let Te = 0;
1121
1120
  const be = i.readCursor(r), _e = i.readCursor(u), oe = i.writeCursor();
1122
1121
  if (function Q(U, B = null, M) {
1123
- const P = a(B);
1124
- P && (P.r !== void 0 ? M = B.clone() : P.p != null && (M = null, m[P.p] = U.clone()));
1122
+ const A = a(B);
1123
+ A && (A.r !== void 0 ? M = B.clone() : A.p != null && (M = null, m[A.p] = U.clone()));
1125
1124
  const k = U.getComponent();
1126
1125
  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), P && P.p != null && (K[X] = P.p));
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));
1128
1127
  const Y = i.advancer(B);
1129
1128
  for (const ee of U) Q(U, Y(ee), M);
1130
1129
  Y.end();
1131
- }(_e, be, null), function Q(U, B, M, P, k) {
1130
+ }(_e, be, null), function Q(U, B, M, A, k) {
1132
1131
  const X = M.getComponent();
1133
1132
  let Y, ee = !1;
1134
- X && ((Y = X.d) != null ? (p[Y] = M.clone(), P != null && (se[P] == null && (se[P] = []), se[P].push(Y)), U = v[Y] || null, B = j[Y] || null, g[Y] ? (k && (N[Y] = !0), k = G[Y] || null) : !k || A !== 1 && K[Y] != null || b == null && (b = {
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 = {
1135
1134
  type: d.ConflictType.RM_UNEXPECTED_CONTENT,
1136
- op1: t.removeOp(k.getPath()),
1137
- op2: t.moveOp(B.getPath(), M.getPath())
1135
+ op1: n.removeOp(k.getPath()),
1136
+ op2: n.moveOp(B.getPath(), M.getPath())
1138
1137
  }), ee = !0) : X.i !== void 0 && (U = B = null, ee = !0, k && b == null && (b = {
1139
1138
  type: d.ConflictType.RM_UNEXPECTED_CONTENT,
1140
- op1: t.removeOp(k.getPath()),
1141
- op2: t.insertOp(M.getPath(), X.i)
1139
+ op1: n.removeOp(k.getPath()),
1140
+ op2: n.insertOp(M.getPath(), X.i)
1142
1141
  })));
1143
1142
  const fe = a(U);
1144
- fe && (fe.r !== void 0 ? k = U.clone() : fe.p != null && (fe.p, P = fe.p, k = null));
1143
+ fe && (fe.r !== void 0 ? k = U.clone() : fe.p != null && (fe.p, A = fe.p, k = null));
1145
1144
  const de = ve(X);
1146
1145
  de && k && b == null && (b = {
1147
1146
  type: d.ConflictType.RM_UNEXPECTED_CONTENT,
1148
- op1: t.removeOp(k.getPath()),
1149
- op2: t.editOp(M.getPath(), de, f(X), !0)
1147
+ op1: n.removeOp(k.getPath()),
1148
+ op2: n.editOp(M.getPath(), de, f(X), !0)
1150
1149
  });
1151
1150
  let le = 0, ye = 0;
1152
1151
  const q = i.advancer(B, (x, he) => O(he) ? le - x - 1 : x - le, (x, he) => {
1153
1152
  O(he) && le++;
1154
- }), D = i.advancer(U);
1153
+ }), P = i.advancer(U);
1155
1154
  for (const x of M) if (typeof x == "number") {
1156
1155
  const he = x - ye, me = q(he);
1157
- ye += +Q(D(he + le), me, M, P, k);
1156
+ ye += +Q(P(he + le), me, M, A, k);
1158
1157
  } else {
1159
1158
  const he = q(x);
1160
- Q(D(x), he, M, P, k);
1159
+ Q(P(x), he, M, A, k);
1161
1160
  }
1162
- return q.end(), D.end(), ee;
1161
+ return q.end(), P.end(), ee;
1163
1162
  }(be, _e, _e.clone(), null, null), p.map((Q) => Q && Q.get()), b) return {
1164
1163
  ok: !1,
1165
1164
  conflict: b
1166
1165
  };
1167
1166
  N.map((Q) => !!Q);
1168
- const De = [];
1167
+ const Pe = [];
1169
1168
  let Me = null;
1170
- (function Q(U, B, M, P, k) {
1169
+ (function Q(U, B, M, A, k) {
1171
1170
  let X = !1;
1172
1171
  const Y = a(B);
1173
1172
  if (O(Y)) {
1174
1173
  const q = Y.p;
1175
- q != null ? (M = p[q], P = re[q] = i.writeCursor(), X = !0, k = null) : (M = null, k = B.clone());
1174
+ q != null ? (M = p[q], A = re[q] = i.writeCursor(), X = !0, k = null) : (M = null, k = B.clone());
1176
1175
  } else o(a(M)) && (M = null);
1177
1176
  const ee = U.getComponent();
1178
1177
  if (ee) {
1179
1178
  const q = ee.p;
1180
- q != null ? (k && (T[q] = k), De[q] = k || A === 1 && X ? null : P.getComponent(), C[q] = U.clone(), M && (I[q] = M.clone())) : ee.r !== void 0 && (k || P.write("r", !0), (k || X) && (Me == null && (Me = /* @__PURE__ */ new Set()), Me.add(ee)));
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)));
1181
1180
  }
1182
1181
  let fe = 0, de = 0;
1183
- const le = i.advancer(B, void 0, (q, D) => {
1184
- O(D) && fe++;
1185
- }), ye = i.advancer(M, (q, D) => o(D) ? ~(q - de) : q - de, (q, D) => {
1186
- o(D) && de++;
1182
+ const le = i.advancer(B, void 0, (q, P) => {
1183
+ O(P) && fe++;
1184
+ }), ye = i.advancer(M, (q, P) => o(P) ? ~(q - de) : q - de, (q, P) => {
1185
+ o(P) && de++;
1187
1186
  });
1188
1187
  if (U) for (const q of U) if (typeof q == "string") {
1189
- const D = le(q), x = ye(q);
1190
- P.descend(q), Q(U, D, x, P, k), P.ascend();
1188
+ const P = le(q), x = ye(q);
1189
+ A.descend(q), Q(U, P, x, A, k), A.ascend();
1191
1190
  } else {
1192
- const D = le(q), x = q - fe, he = O(a(D)) ? null : ye(x), me = x + de;
1193
- l(me >= 0), P.descend(me), Q(U, D, he, P, k), P.ascend();
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();
1194
1193
  }
1195
1194
  le.end(), ye.end();
1196
1195
  })(be, _e, _e.clone(), oe, null), oe.reset();
1197
1196
  let Le = [];
1198
- if (function Q(U, B, M, P, k, X) {
1197
+ if (function Q(U, B, M, A, k, X) {
1199
1198
  l(B);
1200
1199
  const Y = B.getComponent();
1201
- let ee = a(P), fe = !1;
1202
- const de = (S, ie, Oe) => S ? t.moveOp(S.getPath(), ie.getPath()) : t.insertOp(ie.getPath(), Oe.i);
1200
+ let ee = a(A), fe = !1;
1201
+ const de = (S, ie, Oe) => S ? n.moveOp(S.getPath(), ie.getPath()) : n.insertOp(ie.getPath(), Oe.i);
1203
1202
  if (o(Y)) {
1204
1203
  const S = Y.d;
1205
1204
  S != null && ($[S] = B.clone());
1206
- const ie = S != null ? De[S] : null;
1205
+ const ie = S != null ? Pe[S] : null;
1207
1206
  let Oe = !1;
1208
1207
  if (Y.i !== void 0 || S != null && ie) {
1209
1208
  let ce;
1210
- ee && (ee.i !== void 0 || (ce = ee.d) != null && !g[ce]) && (Oe = ce != null ? S != null && S === K[ce] : n.default(ee.i, Y.i), Oe || ce != null && A !== 1 && K[ce] != null || b == null && (b = {
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 = {
1211
1210
  type: d.ConflictType.DROP_COLLISION,
1212
1211
  op1: de(S != null ? C[S] : null, B, Y),
1213
- op2: de(ce != null ? j[ce] : null, P, ee)
1212
+ op2: de(ce != null ? j[ce] : null, A, ee)
1214
1213
  })), Oe || (X ? b == null && (b = {
1215
1214
  type: d.ConflictType.RM_UNEXPECTED_CONTENT,
1216
1215
  op1: de(S != null ? C[S] : null, B, Y),
1217
- op2: t.removeOp(X.getPath())
1216
+ op2: n.removeOp(X.getPath())
1218
1217
  }) : (S != null ? (Le[Te] = S, k.write("d", ie.p = Te++)) : k.write("i", s.default(Y.i)), fe = !0));
1219
1218
  } else if (S != null && !ie) {
1220
1219
  const ce = T[S];
1221
1220
  ce && (X = ce.clone());
1222
1221
  }
1223
- S != null ? (U = C[S], M = m[S], P = I[S]) : Y.i !== void 0 && (U = M = null, Oe || (P = null));
1224
- } else O(a(U)) && (U = M = P = null);
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);
1225
1224
  const le = a(U), ye = a(M);
1226
1225
  if (O(ye)) {
1227
1226
  const S = ye.p;
1228
- ye.r !== void 0 && (!le || le.r === void 0) || g[S] ? (P = null, X = M.clone()) : S != null && (P = p[S], A !== 1 && K[S] != null || ((k = te[S]) || (k = te[S] = i.writeCursor()), k.reset(), X = null));
1229
- } else !o(Y) && o(ee) && (P = null);
1230
- ee = P != null ? P.getComponent() : null;
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
+ } else !o(Y) && o(ee) && (A = null);
1229
+ ee = A != null ? A.getComponent() : null;
1231
1230
  const q = ve(Y);
1232
1231
  if (q) {
1233
1232
  const S = f(Y);
1234
1233
  if (X) b == null && (b = {
1235
1234
  type: d.ConflictType.RM_UNEXPECTED_CONTENT,
1236
- op1: t.editOp(B.getPath(), q, S, !0),
1237
- op2: t.removeOp(X.getPath())
1235
+ op1: n.editOp(B.getPath(), q, S, !0),
1236
+ op2: n.removeOp(X.getPath())
1238
1237
  });
1239
1238
  else {
1240
1239
  const ie = ve(ee);
@@ -1247,58 +1246,58 @@ function Lt() {
1247
1246
  _(k, q, Oe);
1248
1247
  }
1249
1248
  }
1250
- let D = 0, x = 0, he = 0, me = 0, We = 0, He = 0, Ne = U != null && U.descendFirst(), Ye = Ne;
1249
+ let P = 0, x = 0, he = 0, me = 0, We = 0, He = 0, Ne = U != null && U.descendFirst(), Ye = Ne;
1251
1250
  const ze = i.advancer(M, void 0, (S, ie) => {
1252
1251
  O(ie) && he++;
1253
1252
  });
1254
- let Se = P != null && P.descendFirst(), je = Se;
1253
+ let Se = A != null && A.descendFirst(), je = Se;
1255
1254
  for (const S of B) if (typeof S == "number") {
1256
1255
  let ie;
1257
1256
  const Oe = o(B.getComponent()), ce = S - x;
1258
1257
  {
1259
1258
  let Be;
1260
1259
  for (; Ne && typeof (Be = U.getKey()) == "number"; ) {
1261
- Be += D;
1260
+ Be += P;
1262
1261
  const Re = U.getComponent(), Xe = O(Re);
1263
- if (Be > ce || Be === ce && (!Xe || A === 0 && Oe)) break;
1262
+ if (Be > ce || Be === ce && (!Xe || D === 0 && Oe)) break;
1264
1263
  if (Xe) {
1265
- D--;
1264
+ P--;
1266
1265
  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 || !De[Ke] || A !== 1 && K.includes(Ke)) || We--;
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--;
1268
1267
  }
1269
1268
  Ne = U.nextSibling();
1270
1269
  }
1271
1270
  ie = Ne && Be === ce ? U : null;
1272
1271
  }
1273
- const ke = ce - D;
1272
+ const ke = ce - P;
1274
1273
  let Ge = ze(ke);
1275
1274
  const rt = ke - he;
1276
1275
  let Je = null;
1277
1276
  {
1278
1277
  let Be, Re;
1279
- for (; Se && typeof (Be = P.getKey()) == "number"; ) {
1278
+ for (; Se && typeof (Be = A.getKey()) == "number"; ) {
1280
1279
  Re = Be - me;
1281
- const Xe = P.getComponent(), Ke = o(Xe);
1280
+ const Xe = A.getComponent(), Ke = o(Xe);
1282
1281
  if (Re > rt) break;
1283
1282
  if (Re === rt) {
1284
1283
  if (!Ke) {
1285
- Je = P;
1284
+ Je = A;
1286
1285
  break;
1287
1286
  }
1288
1287
  {
1289
- if (A === 0 && Oe) {
1290
- Je = P;
1288
+ if (D === 0 && Oe) {
1289
+ Je = A;
1291
1290
  break;
1292
1291
  }
1293
1292
  const Ve = Ge && O(Ge.getComponent());
1294
- if (A === 0 && Ve) break;
1293
+ if (D === 0 && Ve) break;
1295
1294
  }
1296
1295
  }
1297
1296
  if (Ke) {
1298
1297
  const Ve = Xe.d;
1299
- K[Ve], Xe.i === void 0 && (g[Ve] || K[Ve] != null && A !== 1) ? (g[Ve] || K[Ve] != null && A === 0) && (me++, He--) : me++;
1298
+ K[Ve], Xe.i === void 0 && (g[Ve] || K[Ve] != null && D !== 1) ? (g[Ve] || K[Ve] != null && D === 0) && (me++, He--) : me++;
1300
1299
  }
1301
- Se = P.nextSibling();
1300
+ Se = A.nextSibling();
1302
1301
  }
1303
1302
  }
1304
1303
  const Ot = rt + me + We + He;
@@ -1308,18 +1307,18 @@ function Lt() {
1308
1307
  for (; Ne && (ie = U.getKey(), typeof ie != "string" || !(ie > S || ie === S)); ) Ne = U.nextSibling();
1309
1308
  const Oe = Ne && ie === S ? U : null, ce = ze(S);
1310
1309
  let ke;
1311
- for (; Se && (ke = P.getKey(), typeof ke != "string" || !(ke > S || ke === S)); ) Se = P.nextSibling();
1312
- const Ge = Se && ke === S ? P : null;
1310
+ for (; Se && (ke = A.getKey(), typeof ke != "string" || !(ke > S || ke === S)); ) Se = A.nextSibling();
1311
+ const Ge = Se && ke === S ? A : null;
1313
1312
  k.descend(S), Q(Oe, B, ce, Ge, k, X), k.ascend();
1314
1313
  }
1315
- return ze.end(), Ye && U.ascend(), je && P.ascend(), fe;
1314
+ return ze.end(), Ye && U.ascend(), je && A.ascend(), fe;
1316
1315
  }(be, be.clone(), _e, _e.clone(), oe, null), b) return {
1317
1316
  ok: !1,
1318
1317
  conflict: b
1319
1318
  };
1320
1319
  oe.reset();
1321
- const Ue = (Q, U, B) => Q.traverse(U, (M, P) => {
1322
- M.d != null && B(M.d, Q, P);
1320
+ const Ue = (Q, U, B) => Q.traverse(U, (M, A) => {
1321
+ M.d != null && B(M.d, Q, A);
1323
1322
  });
1324
1323
  (g.length || re.length) && (Ue(_e, oe, (Q, U, B) => {
1325
1324
  g[Q] && !N[Q] && B.write("r", !0), re[Q] && B.mergeTree(re[Q].get());
@@ -1333,31 +1332,31 @@ function Lt() {
1333
1332
  U && Ue(i.readCursor(U.get()), null, (B, M) => {
1334
1333
  Ee[B] = M.clone();
1335
1334
  });
1336
- }), function U(B, M, P, k, X, Y) {
1335
+ }), function U(B, M, A, k, X, Y) {
1337
1336
  const ee = a(M);
1338
1337
  if (ee && O(ee)) if (ee.p != null) {
1339
- const D = ee.p;
1340
- Ee[D].getPath(), P = Ee[D], k = $e[D] = i.writeCursor();
1341
- } else ee.r !== void 0 && (P = null);
1342
- else o(a(P)) && (P = null);
1338
+ const P = ee.p;
1339
+ Ee[P].getPath(), A = Ee[P], k = $e[P] = i.writeCursor();
1340
+ } else ee.r !== void 0 && (A = null);
1341
+ else o(a(A)) && (A = null);
1343
1342
  const fe = B.getComponent();
1344
1343
  if (fe) {
1345
- let D;
1346
- if ((D = fe.d) != null) {
1347
- const x = te[D];
1348
- x && (x.get(), k.mergeTree(x.get()), P = i.readCursor(x.get()));
1344
+ let P;
1345
+ if ((P = fe.d) != null) {
1346
+ const x = te[P];
1347
+ x && (x.get(), k.mergeTree(x.get()), A = i.readCursor(x.get()));
1349
1348
  }
1350
1349
  }
1351
1350
  let de = 0, le = 0;
1352
- const ye = i.advancer(M, void 0, (D, x) => {
1351
+ const ye = i.advancer(M, void 0, (P, x) => {
1353
1352
  O(x) && de--;
1354
- }), q = i.advancer(P, (D, x) => o(x) ? -(D - le) - 1 : D - le, (D, x) => {
1353
+ }), q = i.advancer(A, (P, x) => o(x) ? -(P - le) - 1 : P - le, (P, x) => {
1355
1354
  o(x) && le++;
1356
1355
  });
1357
- for (const D of B) if (typeof D == "number") {
1358
- const x = ye(D), he = D + de, me = q(he), We = he + le;
1356
+ for (const P of B) if (typeof P == "number") {
1357
+ const x = ye(P), he = P + de, me = q(he), We = he + le;
1359
1358
  k.descend(We), U(B, x, me, k), k.ascend();
1360
- } else k.descend(D), U(B, ye(D), q(D), k), k.ascend();
1359
+ } else k.descend(P), U(B, ye(P), q(P), k), k.ascend();
1361
1360
  ye.end(), q.end();
1362
1361
  }(_e, Q, Q.clone(), oe), oe.reset(), b) return {
1363
1362
  ok: !1,
@@ -1365,11 +1364,11 @@ function Lt() {
1365
1364
  };
1366
1365
  if (oe.get(), $e.length) {
1367
1366
  const U = $e.map((M) => M ? M.get() : null), B = i.readCursor(tt(oe.get()));
1368
- if (Ue(B, oe, (M, P, k) => {
1367
+ if (Ue(B, oe, (M, A, k) => {
1369
1368
  const X = U[M];
1370
1369
  X && (k.mergeTree(X), U[M] = null);
1371
1370
  }), U.find((M) => M)) {
1372
- const M = i.writeCursor(), P = i.writeCursor();
1371
+ const M = i.writeCursor(), A = i.writeCursor();
1373
1372
  let k = 0, X = 0;
1374
1373
  U.forEach((Y) => {
1375
1374
  Y != null && Ue(i.readCursor(Y), null, (ee) => {
@@ -1377,13 +1376,13 @@ function Lt() {
1377
1376
  M.writeMove(C[fe].getPath(), $[fe].getPath(), k++);
1378
1377
  const de = se[fe];
1379
1378
  de && de.forEach((le) => {
1380
- g[le] || A !== 1 && K[le] != null || P.writeMove(j[le].getPath(), p[le].getPath(), X++);
1379
+ g[le] || D !== 1 && K[le] != null || A.writeMove(j[le].getPath(), p[le].getPath(), X++);
1381
1380
  });
1382
1381
  });
1383
1382
  }), b = {
1384
1383
  type: d.ConflictType.BLACKHOLE,
1385
1384
  op1: M.get(),
1386
- op2: P.get()
1385
+ op2: A.get()
1387
1386
  };
1388
1387
  }
1389
1388
  }
@@ -1400,65 +1399,65 @@ function Lt() {
1400
1399
  const u = new Error("Transform detected write conflict");
1401
1400
  throw u.conflict = r, u.type = u.name = "writeConflict", u;
1402
1401
  };
1403
- function At(r, u, y) {
1404
- const A = nt(r, u, y);
1405
- if (A.ok) return A.result;
1406
- gt(A.conflict);
1402
+ function Dt(r, u, y) {
1403
+ const D = nt(r, u, y);
1404
+ if (D.ok) return D.result;
1405
+ gt(D.conflict);
1407
1406
  }
1408
1407
  const qe = (r) => {
1409
1408
  const u = i.writeCursor();
1410
- return i.readCursor(r).traverse(u, (y, A) => {
1411
- (o(y) || ve(y)) && A.write("r", !0);
1409
+ return i.readCursor(r).traverse(u, (y, D) => {
1410
+ (o(y) || ve(y)) && D.write("r", !0);
1412
1411
  }), u.get();
1413
- }, Pt = (r, u) => {
1414
- const { type: y, op1: A, op2: b } = r;
1412
+ }, At = (r, u) => {
1413
+ const { type: y, op1: D, op2: b } = r;
1415
1414
  switch (y) {
1416
1415
  case d.ConflictType.DROP_COLLISION:
1417
- return u === "left" ? [null, qe(b)] : [qe(A), null];
1416
+ return u === "left" ? [null, qe(b)] : [qe(D), null];
1418
1417
  case d.ConflictType.RM_UNEXPECTED_CONTENT:
1419
1418
  let C = !1;
1420
- return i.readCursor(A).traverse(null, ($) => {
1419
+ return i.readCursor(D).traverse(null, ($) => {
1421
1420
  $.r !== void 0 && (C = !0);
1422
- }), C ? [null, qe(b)] : [qe(A), null];
1421
+ }), C ? [null, qe(b)] : [qe(D), null];
1423
1422
  case d.ConflictType.BLACKHOLE:
1424
- return [qe(A), qe(b)];
1423
+ return [qe(D), qe(b)];
1425
1424
  default:
1426
1425
  throw Error("Unrecognised conflict: " + y);
1427
1426
  }
1428
1427
  };
1429
- function _t(r, u, y, A) {
1428
+ function _t(r, u, y, D) {
1430
1429
  let b = null;
1431
1430
  for (; ; ) {
1432
- const C = nt(u, y, A);
1431
+ const C = nt(u, y, D);
1433
1432
  if (C.ok) return ne(b, C.result);
1434
1433
  {
1435
1434
  const { conflict: $ } = C;
1436
1435
  r($) || gt($);
1437
- const [j, p] = Pt($, A);
1436
+ const [j, p] = At($, D);
1438
1437
  u = ne(H(u), j), y = ne(H(y), p), b = ne(b, p);
1439
1438
  }
1440
1439
  }
1441
1440
  }
1442
1441
  })(Ct);
1443
- (function(t) {
1442
+ (function(n) {
1444
1443
  var e = Ce && Ce.__createBinding || (Object.create ? function(d, l, a, E) {
1445
1444
  E === void 0 && (E = a), Object.defineProperty(d, E, { enumerable: !0, get: function() {
1446
1445
  return l[a];
1447
1446
  } });
1448
1447
  } : function(d, l, a, E) {
1449
1448
  E === void 0 && (E = a), d[E] = l[a];
1450
- }), n = Ce && Ce.__exportStar || function(d, l) {
1449
+ }), t = Ce && Ce.__exportStar || function(d, l) {
1451
1450
  for (var a in d) a !== "default" && !l.hasOwnProperty(a) && e(l, d, a);
1452
1451
  };
1453
- Object.defineProperty(t, "__esModule", { value: !0 }), n(Ct, t);
1452
+ Object.defineProperty(n, "__esModule", { value: !0 }), t(Ct, n);
1454
1453
  var s = ft;
1455
- Object.defineProperty(t, "ReadCursor", { enumerable: !0, get: function() {
1454
+ Object.defineProperty(n, "ReadCursor", { enumerable: !0, get: function() {
1456
1455
  return s.ReadCursor;
1457
- } }), Object.defineProperty(t, "WriteCursor", { enumerable: !0, get: function() {
1456
+ } }), Object.defineProperty(n, "WriteCursor", { enumerable: !0, get: function() {
1458
1457
  return s.WriteCursor;
1459
1458
  } });
1460
1459
  var i = ht;
1461
- Object.defineProperty(t, "ConflictType", { enumerable: !0, get: function() {
1460
+ Object.defineProperty(n, "ConflictType", { enumerable: !0, get: function() {
1462
1461
  return i.ConflictType;
1463
1462
  } });
1464
1463
  })(F);
@@ -1509,72 +1508,76 @@ class Ht {
1509
1508
  this._visible$.next(e);
1510
1509
  }
1511
1510
  refreshTransform(e) {
1512
- e.forEach((n) => {
1513
- if (this.getDrawingByParam(n) == null)
1511
+ e.forEach((t) => {
1512
+ if (this.getDrawingByParam(t) == null)
1514
1513
  return;
1515
- const i = this._getCurrentBySearch(n);
1516
- i != null && (i.transform = n.transform);
1514
+ const i = this._getCurrentBySearch(t);
1515
+ i != null && (i.transform = t.transform);
1517
1516
  }), this.refreshTransformNotification(e);
1518
1517
  }
1519
1518
  getDrawingDataForUnit(e) {
1520
1519
  return this.drawingManagerData[e];
1521
1520
  }
1522
1521
  removeDrawingDataForUnit(e) {
1523
- const n = this.drawingManagerData[e];
1524
- if (n == null)
1522
+ const t = this.drawingManagerData[e];
1523
+ if (t == null)
1525
1524
  return;
1526
1525
  delete this.drawingManagerData[e];
1527
1526
  const s = [];
1528
- Object.keys(n).forEach((i) => {
1529
- const d = n[i];
1527
+ Object.keys(t).forEach((i) => {
1528
+ const d = t[i];
1530
1529
  (d == null ? void 0 : d.data) != null && Object.keys(d.data).forEach((l) => {
1531
1530
  s.push({ unitId: e, subUnitId: i, drawingId: l });
1532
1531
  });
1533
1532
  }), s.length > 0 && this.removeNotification(s);
1534
1533
  }
1535
- registerDrawingData(e, n) {
1536
- this.drawingManagerData[e] = n;
1534
+ registerDrawingData(e, t) {
1535
+ this.drawingManagerData[e] = t;
1537
1536
  }
1538
1537
  initializeNotification(e) {
1539
- const n = [], s = this.drawingManagerData[e];
1538
+ const t = [], s = this.drawingManagerData[e];
1540
1539
  s != null && (Object.keys(s).forEach((i) => {
1541
1540
  this._establishDrawingMap(e, i);
1542
1541
  const d = s[i];
1543
1542
  Object.keys(d.data).forEach((l) => {
1544
1543
  const a = d.data[l];
1545
- a.unitId = e, a.subUnitId = i, n.push(a);
1544
+ a.unitId = e, a.subUnitId = i, t.push(a);
1546
1545
  });
1547
- }), n.length > 0 && this.addNotification(n));
1546
+ }), t.length > 0 && this.addNotification(t));
1548
1547
  }
1549
- getDrawingData(e, n) {
1550
- return this._getDrawingData(e, n);
1548
+ getDrawingData(e, t) {
1549
+ return this._getDrawingData(e, t);
1550
+ }
1551
+ // Use in doc only.
1552
+ setDrawingData(e, t, s) {
1553
+ this.drawingManagerData[e][t].data = s;
1551
1554
  }
1552
1555
  getBatchAddOp(e) {
1553
- const n = [], s = [], i = [];
1556
+ const t = [], s = [], i = [];
1554
1557
  e.forEach((W) => {
1555
1558
  const { op: O, invertOp: o } = this._addByParam(W);
1556
- n.push({ unitId: W.unitId, subUnitId: W.subUnitId, drawingId: W.drawingId }), s.push(O), i.push(o);
1559
+ t.push({ unitId: W.unitId, subUnitId: W.subUnitId, drawingId: W.drawingId }), s.push(O), i.push(o);
1557
1560
  });
1558
1561
  const d = s.reduce(F.type.compose, null), l = i.reduce(F.type.compose, null), { unitId: a, subUnitId: E } = e[0];
1559
- return { undo: l, redo: d, unitId: a, subUnitId: E, objects: n };
1562
+ return { undo: l, redo: d, unitId: a, subUnitId: E, objects: t };
1560
1563
  }
1561
1564
  getBatchRemoveOp(e) {
1562
- const n = [], s = [];
1565
+ const t = [], s = [];
1563
1566
  e.forEach((E) => {
1564
1567
  const { op: W, invertOp: O } = this._removeByParam(E);
1565
- n.push(W), s.push(O);
1568
+ t.push(W), s.push(O);
1566
1569
  });
1567
- const i = n.reduce(F.type.compose, null), d = s.reduce(F.type.compose, null), { unitId: l, subUnitId: a } = e[0];
1570
+ const i = t.reduce(F.type.compose, null), d = s.reduce(F.type.compose, null), { unitId: l, subUnitId: a } = e[0];
1568
1571
  return { undo: d, redo: i, unitId: l, subUnitId: a, objects: e };
1569
1572
  }
1570
1573
  getBatchUpdateOp(e) {
1571
- const n = [], s = [], i = [];
1574
+ const t = [], s = [], i = [];
1572
1575
  e.forEach((W) => {
1573
1576
  const { op: O, invertOp: o } = this._updateByParam(W);
1574
- n.push({ unitId: W.unitId, subUnitId: W.subUnitId, drawingId: W.drawingId }), s.push(O), i.push(o);
1577
+ t.push({ unitId: W.unitId, subUnitId: W.subUnitId, drawingId: W.drawingId }), s.push(O), i.push(o);
1575
1578
  });
1576
1579
  const d = s.reduce(F.type.compose, null), l = i.reduce(F.type.compose, null), { unitId: a, subUnitId: E } = e[0];
1577
- return { undo: l, redo: d, unitId: a, subUnitId: E, objects: n };
1580
+ return { undo: l, redo: d, unitId: a, subUnitId: E, objects: t };
1578
1581
  }
1579
1582
  removeNotification(e) {
1580
1583
  this._remove$.next(e);
@@ -1598,35 +1601,35 @@ class Ht {
1598
1601
  this._refreshTransform$.next(e);
1599
1602
  }
1600
1603
  getGroupDrawingOp(e) {
1601
- const n = [], { unitId: s, subUnitId: i } = e[0].parent;
1604
+ const t = [], { unitId: s, subUnitId: i } = e[0].parent;
1602
1605
  e.forEach((a) => {
1603
- n.push(this._getGroupDrawingOp(a));
1606
+ t.push(this._getGroupDrawingOp(a));
1604
1607
  });
1605
- const d = n.reduce(F.type.compose, null);
1608
+ const d = t.reduce(F.type.compose, null);
1606
1609
  return { undo: F.type.invertWithDoc(d, this.drawingManagerData), redo: d, unitId: s, subUnitId: i, objects: e };
1607
1610
  }
1608
1611
  getUngroupDrawingOp(e) {
1609
- const n = [], { unitId: s, subUnitId: i } = e[0].parent;
1612
+ const t = [], { unitId: s, subUnitId: i } = e[0].parent;
1610
1613
  e.forEach((a) => {
1611
- n.push(this._getUngroupDrawingOp(a));
1614
+ t.push(this._getUngroupDrawingOp(a));
1612
1615
  });
1613
- const d = n.reduce(F.type.compose, null);
1616
+ const d = t.reduce(F.type.compose, null);
1614
1617
  return { undo: F.type.invertWithDoc(d, this.drawingManagerData), redo: d, unitId: s, subUnitId: i, objects: e };
1615
1618
  }
1616
1619
  getDrawingsByGroup(e) {
1617
- const { unitId: n, subUnitId: s, drawingId: i } = e;
1618
- if (this.getDrawingByParam({ unitId: n, subUnitId: s, drawingId: i }) == null)
1620
+ const { unitId: t, subUnitId: s, drawingId: i } = e;
1621
+ if (this.getDrawingByParam({ unitId: t, subUnitId: s, drawingId: i }) == null)
1619
1622
  return [];
1620
- const l = this._getDrawingData(n, s), a = [];
1623
+ const l = this._getDrawingData(t, s), a = [];
1621
1624
  return Object.keys(l).forEach((E) => {
1622
1625
  const W = l[E];
1623
1626
  W.groupId === i && a.push(W);
1624
1627
  }), a;
1625
1628
  }
1626
1629
  _getGroupDrawingOp(e) {
1627
- const { parent: n, children: s } = e, { unitId: i, subUnitId: d, drawingId: l } = n, a = [];
1630
+ const { parent: t, children: s } = e, { unitId: i, subUnitId: d, drawingId: l } = t, a = [];
1628
1631
  a.push(
1629
- F.insertOp([i, d, "data", l], n)
1632
+ F.insertOp([i, d, "data", l], t)
1630
1633
  );
1631
1634
  let E = Number.NEGATIVE_INFINITY;
1632
1635
  return s.forEach((W) => {
@@ -1639,7 +1642,7 @@ class Ht {
1639
1642
  ), a.reduce(F.type.compose, null);
1640
1643
  }
1641
1644
  _getUngroupDrawingOp(e) {
1642
- const { parent: n, children: s } = e, { unitId: i, subUnitId: d, drawingId: l } = n, a = [];
1645
+ const { parent: t, children: s } = e, { unitId: i, subUnitId: d, drawingId: l } = t, a = [];
1643
1646
  return s.forEach((E) => {
1644
1647
  const { unitId: W, subUnitId: O, drawingId: o } = E;
1645
1648
  a.push(
@@ -1651,8 +1654,8 @@ class Ht {
1651
1654
  F.removeOp([i, d, "order", this._getDrawingOrder(i, d).indexOf(l)], !0)
1652
1655
  ), a.reduce(F.type.compose, null);
1653
1656
  }
1654
- applyJson1(e, n, s) {
1655
- this._establishDrawingMap(e, n), this._oldDrawingManagerData = { ...this.drawingManagerData }, this.drawingManagerData = F.type.apply(this.drawingManagerData, s);
1657
+ applyJson1(e, t, s) {
1658
+ this._establishDrawingMap(e, t), this._oldDrawingManagerData = { ...this.drawingManagerData }, this.drawingManagerData = F.type.apply(this.drawingManagerData, s);
1656
1659
  }
1657
1660
  // private _fillMissingFields(jsonOp: JSONOp) {
1658
1661
  // if (jsonOp == null) {
@@ -1699,130 +1702,134 @@ class Ht {
1699
1702
  return this._getOldBySearch(e);
1700
1703
  }
1701
1704
  getDrawingOKey(e) {
1702
- const [n, s, i] = e.split("#-#");
1703
- return this._getCurrentBySearch({ unitId: n, subUnitId: s, drawingId: i });
1705
+ const [t, s, i] = e.split("#-#");
1706
+ return this._getCurrentBySearch({ unitId: t, subUnitId: s, drawingId: i });
1704
1707
  }
1705
1708
  focusDrawing(e) {
1706
1709
  if (e == null) {
1707
1710
  this._focusDrawings = [], this._focus$.next([]);
1708
1711
  return;
1709
1712
  }
1710
- const n = [];
1713
+ const t = [];
1711
1714
  e.forEach((s) => {
1712
1715
  var E;
1713
1716
  const { unitId: i, subUnitId: d, drawingId: l } = s, a = (E = this._getDrawingData(i, d)) == null ? void 0 : E[l];
1714
- a != null && n.push(a);
1715
- }), n.length > 0 && (this._focusDrawings = n, this._focus$.next(n));
1717
+ a != null && t.push(a);
1718
+ }), t.length > 0 && (this._focusDrawings = t, this._focus$.next(t));
1716
1719
  }
1717
1720
  getFocusDrawings() {
1718
1721
  const e = [];
1719
- return this._focusDrawings.forEach((n) => {
1722
+ return this._focusDrawings.forEach((t) => {
1720
1723
  var a;
1721
- const { unitId: s, subUnitId: i, drawingId: d } = n, l = (a = this._getDrawingData(s, i)) == null ? void 0 : a[d];
1724
+ const { unitId: s, subUnitId: i, drawingId: d } = t, l = (a = this._getDrawingData(s, i)) == null ? void 0 : a[d];
1722
1725
  l != null && e.push(l);
1723
1726
  }), e;
1724
1727
  }
1725
- getDrawingOrder(e, n) {
1726
- return this._getDrawingOrder(e, n);
1728
+ getDrawingOrder(e, t) {
1729
+ return this._getDrawingOrder(e, t);
1730
+ }
1731
+ // Use in doc only.
1732
+ setDrawingOrder(e, t, s) {
1733
+ this.drawingManagerData[e][t].order = s;
1727
1734
  }
1728
1735
  orderUpdateNotification(e) {
1729
1736
  this._order$.next(e);
1730
1737
  }
1731
1738
  getForwardDrawingsOp(e) {
1732
- const { unitId: n, subUnitId: s, drawingIds: i } = e, d = [], l = this.getDrawingOrder(n, s), a = [...i];
1739
+ const { unitId: t, subUnitId: s, drawingIds: i } = e, d = [], l = this.getDrawingOrder(t, s), a = [...i];
1733
1740
  i.forEach((O) => {
1734
- const o = this._hasDrawingOrder({ unitId: n, subUnitId: s, drawingId: O });
1741
+ const o = this._hasDrawingOrder({ unitId: t, subUnitId: s, drawingId: O });
1735
1742
  if (o === -1 || o === l.length - 1)
1736
1743
  return;
1737
- const c = F.moveOp([n, s, "order", o], [n, s, "order", o + 1]);
1744
+ const c = F.moveOp([t, s, "order", o], [t, s, "order", o + 1]);
1738
1745
  d.push(c), a.includes(l[o + 1]) || a.push(l[o + 1]);
1739
1746
  });
1740
1747
  const E = d.reduce(F.type.compose, null);
1741
- return { undo: F.type.invertWithDoc(E, this.drawingManagerData), redo: E, unitId: n, subUnitId: s, objects: { ...e, drawingIds: a } };
1748
+ return { undo: F.type.invertWithDoc(E, this.drawingManagerData), redo: E, unitId: t, subUnitId: s, objects: { ...e, drawingIds: a } };
1742
1749
  }
1743
1750
  getBackwardDrawingOp(e) {
1744
- const { unitId: n, subUnitId: s, drawingIds: i } = e, d = [], l = this.getDrawingOrder(n, s), a = [...i];
1751
+ const { unitId: t, subUnitId: s, drawingIds: i } = e, d = [], l = this.getDrawingOrder(t, s), a = [...i];
1745
1752
  i.forEach((O) => {
1746
- const o = this._hasDrawingOrder({ unitId: n, subUnitId: s, drawingId: O });
1753
+ const o = this._hasDrawingOrder({ unitId: t, subUnitId: s, drawingId: O });
1747
1754
  if (o === -1 || o === 0)
1748
1755
  return;
1749
- const c = F.moveOp([n, s, "order", o], [n, s, "order", o - 1]);
1756
+ const c = F.moveOp([t, s, "order", o], [t, s, "order", o - 1]);
1750
1757
  d.push(c), a.includes(l[o - 1]) || a.push(l[o - 1]);
1751
1758
  });
1752
1759
  const E = d.reduce(F.type.compose, null);
1753
- return { undo: F.type.invertWithDoc(E, this.drawingManagerData), redo: E, unitId: n, subUnitId: s, objects: { ...e, drawingIds: a } };
1760
+ return { undo: F.type.invertWithDoc(E, this.drawingManagerData), redo: E, unitId: t, subUnitId: s, objects: { ...e, drawingIds: a } };
1754
1761
  }
1755
1762
  getFrontDrawingsOp(e) {
1756
- const { unitId: n, subUnitId: s, drawingIds: i } = e, d = this._getOrderFromSearchParams(n, s, i), l = [...i], a = this.getDrawingOrder(n, s), E = [];
1763
+ const { unitId: t, subUnitId: s, drawingIds: i } = e, d = this._getOrderFromSearchParams(t, s, i), l = [...i], a = this.getDrawingOrder(t, s), E = [];
1757
1764
  d.forEach((o) => {
1758
- const { drawingId: c } = o, h = this._getDrawingCount(n, s) - 1, R = F.moveOp([n, s, "order", this._getDrawingOrder(n, s).indexOf(c)], [n, s, "order", h]);
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]);
1759
1766
  E.push(R), l.includes(a[h]) || l.push(a[h]);
1760
1767
  });
1761
1768
  const W = E.reduce(F.type.compose, null);
1762
- return { undo: F.type.invertWithDoc(W, this.drawingManagerData), redo: W, unitId: n, subUnitId: s, objects: { ...e, drawingIds: l } };
1769
+ return { undo: F.type.invertWithDoc(W, this.drawingManagerData), redo: W, unitId: t, subUnitId: s, objects: { ...e, drawingIds: l } };
1763
1770
  }
1764
1771
  getBackDrawingsOp(e) {
1765
- const { unitId: n, subUnitId: s, drawingIds: i } = e, d = this._getOrderFromSearchParams(n, s, i, !0), l = [...i], a = this.getDrawingOrder(n, s), 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 = [];
1766
1773
  d.forEach((o) => {
1767
- const { drawingId: c } = o, h = F.moveOp([n, s, "order", this._getDrawingOrder(n, s).indexOf(c)], [n, s, "order", 0]);
1774
+ const { drawingId: c } = o, h = F.moveOp([t, s, "order", this._getDrawingOrder(t, s).indexOf(c)], [t, s, "order", 0]);
1768
1775
  E.push(h), l.includes(a[0]) || l.push(a[0]);
1769
1776
  });
1770
1777
  const W = E.reduce(F.type.compose, null);
1771
- return { undo: F.type.invertWithDoc(W, this.drawingManagerData), redo: W, unitId: n, subUnitId: s, objects: { ...e, drawingIds: l } };
1778
+ return { undo: F.type.invertWithDoc(W, this.drawingManagerData), redo: W, unitId: t, subUnitId: s, objects: { ...e, drawingIds: l } };
1772
1779
  }
1773
- _getDrawingCount(e, n) {
1774
- return this.getDrawingOrder(e, n).length || 0;
1780
+ _getDrawingCount(e, t) {
1781
+ return this.getDrawingOrder(e, t).length || 0;
1775
1782
  }
1776
- _getOrderFromSearchParams(e, n, s, i = !1) {
1783
+ _getOrderFromSearchParams(e, t, s, i = !1) {
1777
1784
  return s.map((d) => {
1778
- const l = this._hasDrawingOrder({ unitId: e, subUnitId: n, drawingId: d });
1785
+ const l = this._hasDrawingOrder({ unitId: e, subUnitId: t, drawingId: d });
1779
1786
  return { drawingId: d, zIndex: l };
1780
1787
  }).sort(i === !1 ? Mt : Nt);
1781
1788
  }
1782
1789
  _hasDrawingOrder(e) {
1783
1790
  if (e == null)
1784
1791
  return -1;
1785
- const { unitId: n, subUnitId: s, drawingId: i } = e;
1786
- return this._establishDrawingMap(n, s), this._getDrawingOrder(n, s).indexOf(i);
1792
+ const { unitId: t, subUnitId: s, drawingId: i } = e;
1793
+ return this._establishDrawingMap(t, s), this._getDrawingOrder(t, s).indexOf(i);
1787
1794
  }
1788
1795
  _getCurrentBySearch(e) {
1789
1796
  var d, l, a;
1790
1797
  if (e == null)
1791
1798
  return;
1792
- const { unitId: n, subUnitId: s, drawingId: i } = e;
1793
- return (a = (l = (d = this.drawingManagerData[n]) == null ? void 0 : d[s]) == null ? void 0 : l.data) == null ? void 0 : a[i];
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];
1794
1801
  }
1795
1802
  _getOldBySearch(e) {
1796
1803
  var d, l, a;
1797
1804
  if (e == null)
1798
1805
  return;
1799
- const { unitId: n, subUnitId: s, drawingId: i } = e;
1800
- return (a = (l = (d = this._oldDrawingManagerData[n]) == null ? void 0 : d[s]) == null ? void 0 : l.data) == null ? void 0 : a[i];
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];
1801
1808
  }
1802
- _establishDrawingMap(e, n, s) {
1809
+ _establishDrawingMap(e, t, s) {
1803
1810
  var i;
1804
- return this.drawingManagerData[e] || (this.drawingManagerData[e] = {}), this.drawingManagerData[e][n] || (this.drawingManagerData[e][n] = {
1811
+ return this.drawingManagerData[e] || (this.drawingManagerData[e] = {}), this.drawingManagerData[e][t] || (this.drawingManagerData[e][t] = {
1805
1812
  data: {},
1806
1813
  order: []
1807
- }), s == null ? null : (i = this.drawingManagerData[e][n].data) == null ? void 0 : i[s];
1814
+ }), s == null ? null : (i = this.drawingManagerData[e][t].data) == null ? void 0 : i[s];
1808
1815
  }
1809
1816
  _addByParam(e) {
1810
- const { unitId: n, subUnitId: s, drawingId: i } = e;
1811
- this._establishDrawingMap(n, s, i);
1812
- const d = F.insertOp([n, s, "data", i], e), l = F.insertOp([n, s, "order", this._getDrawingOrder(n, s).length], i), a = [d, l].reduce(F.type.compose, null), E = F.type.invertWithDoc(a, this.drawingManagerData);
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);
1813
1820
  return { op: a, invertOp: E };
1814
1821
  }
1815
1822
  _removeByParam(e) {
1816
1823
  if (e == null)
1817
1824
  return { op: [], invertOp: [] };
1818
- const { unitId: n, subUnitId: s, drawingId: i } = e;
1819
- if (this._establishDrawingMap(n, s, i) == null)
1825
+ const { unitId: t, subUnitId: s, drawingId: i } = e;
1826
+ if (this._establishDrawingMap(t, s, i) == null)
1820
1827
  return { op: [], invertOp: [] };
1821
- const l = F.removeOp([n, s, "data", i], !0), a = F.removeOp([n, s, "order", this._getDrawingOrder(n, s).indexOf(i)], !0), E = [l, a].reduce(F.type.compose, null), W = F.type.invertWithDoc(E, this.drawingManagerData);
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);
1822
1829
  return { op: E, invertOp: W };
1823
1830
  }
1824
1831
  _updateByParam(e) {
1825
- const { unitId: n, subUnitId: s, drawingId: i } = e, d = this._establishDrawingMap(n, s, i);
1832
+ const { unitId: t, subUnitId: s, drawingId: i } = e, d = this._establishDrawingMap(t, s, i);
1826
1833
  if (d == null)
1827
1834
  return { op: [], invertOp: [] };
1828
1835
  const a = this._getUpdateParamCompareOp(e, d).reduce(F.type.compose, null), E = F.type.invertWithDoc(a, this.drawingManagerData);
@@ -1835,22 +1842,22 @@ class Ht {
1835
1842
  // }
1836
1843
  // });
1837
1844
  // }
1838
- _getUpdateParamCompareOp(e, n) {
1845
+ _getUpdateParamCompareOp(e, t) {
1839
1846
  const { unitId: s, subUnitId: i, drawingId: d } = e, l = [];
1840
1847
  return Object.keys(e).forEach((a) => {
1841
- const E = e[a], W = n[a];
1848
+ const E = e[a], W = t[a];
1842
1849
  W !== E && l.push(
1843
1850
  F.replaceOp([s, i, "data", d, a], W, E)
1844
1851
  );
1845
1852
  }), l;
1846
1853
  }
1847
- _getDrawingData(e, n) {
1854
+ _getDrawingData(e, t) {
1848
1855
  var s, i;
1849
- return ((i = (s = this.drawingManagerData[e]) == null ? void 0 : s[n]) == null ? void 0 : i.data) || {};
1856
+ return ((i = (s = this.drawingManagerData[e]) == null ? void 0 : s[t]) == null ? void 0 : i.data) || {};
1850
1857
  }
1851
- _getDrawingOrder(e, n) {
1858
+ _getDrawingOrder(e, t) {
1852
1859
  var s, i;
1853
- return ((i = (s = this.drawingManagerData[e]) == null ? void 0 : s[n]) == null ? void 0 : i.order) || [];
1860
+ return ((i = (s = this.drawingManagerData[e]) == null ? void 0 : s[t]) == null ? void 0 : i.order) || [];
1854
1861
  }
1855
1862
  getDrawingVisible() {
1856
1863
  return this._visible;
@@ -1867,23 +1874,23 @@ class Ht {
1867
1874
  }
1868
1875
  class Kt extends Ht {
1869
1876
  }
1870
- function cn(t) {
1871
- const { unitId: e, subUnitId: n, drawingId: s } = t;
1872
- return `${e}#-#${n}#-#${s}`;
1877
+ function an(n) {
1878
+ const { unitId: e, subUnitId: t, drawingId: s } = n;
1879
+ return `${e}#-#${t}#-#${s}`;
1873
1880
  }
1874
- const un = async (t) => new Promise((e, n) => {
1881
+ const cn = async (n) => new Promise((e, t) => {
1875
1882
  const s = new Image();
1876
- s.src = t, s.onload = () => {
1883
+ s.src = n, s.onload = () => {
1877
1884
  e({
1878
1885
  width: s.width,
1879
1886
  height: s.height,
1880
1887
  image: s
1881
1888
  });
1882
1889
  }, s.onerror = (i) => {
1883
- n(i);
1890
+ t(i);
1884
1891
  };
1885
1892
  });
1886
- var et = /* @__PURE__ */ ((t) => (t.URL = "URL", t.UUID = "UUID", t.BASE64 = "BASE64", t))(et || {}), Ze = /* @__PURE__ */ ((t) => (t.SUCCUSS = "0", t.ERROR_EXCEED_SIZE = "1", t.ERROR_IMAGE_TYPE = "2", t.ERROR_UPLOAD_COUNT_LIMIT = "3", t.ERROR_IMAGE = "4", t))(Ze || {});
1893
+ 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 || {});
1887
1894
  const Vt = It("core.image-io.service");
1888
1895
  class Ft {
1889
1896
  constructor() {
@@ -1895,21 +1902,21 @@ class Ft {
1895
1902
  setWaitCount(e) {
1896
1903
  this._waitCount = e, this._change$.next(e);
1897
1904
  }
1898
- getImageSourceCache(e, n) {
1899
- if (n === et.BASE64) {
1905
+ getImageSourceCache(e, t) {
1906
+ if (t === et.BASE64) {
1900
1907
  const s = new Image();
1901
1908
  return s.src = e, s;
1902
1909
  }
1903
1910
  return this._imageSourceCache.get(e);
1904
1911
  }
1905
- addImageSourceCache(e, n, s) {
1906
- n === et.BASE64 || s == null || this._imageSourceCache.set(e, s);
1912
+ addImageSourceCache(e, t, s) {
1913
+ t === et.BASE64 || s == null || this._imageSourceCache.set(e, s);
1907
1914
  }
1908
1915
  async getImage(e) {
1909
1916
  return Promise.resolve(e);
1910
1917
  }
1911
1918
  async saveImage(e) {
1912
- return new Promise((n, s) => {
1919
+ return new Promise((t, s) => {
1913
1920
  if (!Wt.includes(e.type)) {
1914
1921
  s(new Error(Ze.ERROR_IMAGE_TYPE)), this._decreaseWaiting();
1915
1922
  return;
@@ -1927,7 +1934,7 @@ class Ft {
1927
1934
  return;
1928
1935
  }
1929
1936
  const a = kt.generateRandomId(6);
1930
- n({
1937
+ t({
1931
1938
  imageId: a,
1932
1939
  imageSourceType: et.BASE64,
1933
1940
  source: l,
@@ -1941,42 +1948,42 @@ class Ft {
1941
1948
  this._waitCount -= 1, this._change$.next(this._waitCount);
1942
1949
  }
1943
1950
  }
1944
- const dn = "__default_document_sub_component_id20231101__";
1945
- var qt = /* @__PURE__ */ ((t) => (t[t.forward = 0] = "forward", t[t.backward = 1] = "backward", t[t.front = 2] = "front", t[t.back = 3] = "back", t))(qt || {}), zt = /* @__PURE__ */ ((t) => (t[t.UNRECOGNIZED = -1] = "UNRECOGNIZED", t[t.DRAWING_IMAGE = 0] = "DRAWING_IMAGE", t[t.DRAWING_SHAPE = 1] = "DRAWING_SHAPE", t[t.DRAWING_CHART = 2] = "DRAWING_CHART", t[t.DRAWING_TABLE = 3] = "DRAWING_TABLE", t[t.DRAWING_SMART_ART = 4] = "DRAWING_SMART_ART", t[t.DRAWING_VIDEO = 5] = "DRAWING_VIDEO", t[t.DRAWING_GROUP = 6] = "DRAWING_GROUP", t[t.DRAWING_UNIT = 7] = "DRAWING_UNIT", t[t.DRAWING_DOM = 8] = "DRAWING_DOM", t))(zt || {});
1951
+ const un = "__default_document_sub_component_id20231101__";
1952
+ 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 || {});
1946
1953
  const Xt = It("univer.drawing-manager.service");
1947
- var Yt = Object.defineProperty, Zt = Object.getOwnPropertyDescriptor, Jt = (t, e, n, s) => {
1948
- for (var i = s > 1 ? void 0 : s ? Zt(e, n) : e, d = t.length - 1, l; d >= 0; d--)
1949
- (l = t[d]) && (i = (s ? l(e, n, i) : l(i)) || i);
1950
- return s && i && Yt(e, n, i), i;
1951
- }, Qt = (t, e) => (n, s) => e(n, s, t);
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
1959
  const en = "DRAWING_PLUGIN";
1953
1960
  var ot;
1954
- let wt = (ot = class extends Rt {
1955
- constructor(t, e) {
1956
- super(), this._config = t, this._injector = e;
1961
+ let wt = (ot = class extends jt {
1962
+ constructor(n, e) {
1963
+ super(), this._config = n, this._injector = e;
1957
1964
  }
1958
- onStarting(t) {
1959
- this._initDependencies(t);
1965
+ onStarting(n) {
1966
+ this._initDependencies(n);
1960
1967
  }
1961
- _initDependencies(t) {
1968
+ _initDependencies(n) {
1962
1969
  var s;
1963
- St([
1970
+ Tt([
1964
1971
  [Vt, { useClass: Ft }],
1965
1972
  [Xt, { useClass: Kt }]
1966
- ], (s = this._config) == null ? void 0 : s.override).forEach((i) => t.add(i));
1973
+ ], (s = this._config) == null ? void 0 : s.override).forEach((i) => n.add(i));
1967
1974
  }
1968
1975
  }, V(ot, "pluginName", en), ot);
1969
1976
  wt = Jt([
1970
- Qt(1, jt(Tt))
1977
+ Qt(1, Rt(St))
1971
1978
  ], wt);
1972
1979
  export {
1973
1980
  qt as ArrangeTypeEnum,
1974
- dn as DEFAULT_DOCUMENT_SUB_COMPONENT_ID,
1981
+ un as DEFAULT_DOCUMENT_SUB_COMPONENT_ID,
1975
1982
  Wt as DRAWING_IMAGE_ALLOW_IMAGE_LIST,
1976
1983
  $t as DRAWING_IMAGE_ALLOW_SIZE,
1977
- an as DRAWING_IMAGE_COUNT_LIMIT,
1978
- ln as DRAWING_IMAGE_HEIGHT_LIMIT,
1979
- on as DRAWING_IMAGE_WIDTH_LIMIT,
1984
+ ln as DRAWING_IMAGE_COUNT_LIMIT,
1985
+ on as DRAWING_IMAGE_HEIGHT_LIMIT,
1986
+ sn as DRAWING_IMAGE_WIDTH_LIMIT,
1980
1987
  Kt as DrawingManagerService,
1981
1988
  zt as DrawingTypeEnum,
1982
1989
  Xt as IDrawingManagerService,
@@ -1986,6 +1993,6 @@ export {
1986
1993
  Ze as ImageUploadStatusType,
1987
1994
  Ht as UnitDrawingService,
1988
1995
  wt as UniverDrawingPlugin,
1989
- cn as getDrawingShapeKeyByDrawingSearch,
1990
- un as getImageSize
1996
+ an as getDrawingShapeKeyByDrawingSearch,
1997
+ cn as getImageSize
1991
1998
  };