@univerjs/drawing 0.16.1 → 0.17.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/cjs/index.js +1 -1
- package/lib/es/index.js +482 -481
- package/lib/index.js +482 -481
- package/lib/types/index.d.ts +1 -1
- package/lib/types/plugin.d.ts +3 -1
- package/lib/umd/index.js +1 -1
- package/package.json +3 -3
- /package/lib/types/{controllers/config.schema.d.ts → config/config.d.ts} +0 -0
package/lib/es/index.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { createIdentifier as
|
|
5
|
-
import { IImageIoService as
|
|
1
|
+
var xt = Object.defineProperty;
|
|
2
|
+
var Bt = (a, e, t) => e in a ? xt(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
3
|
+
var G = (a, e, t) => Bt(a, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { createIdentifier as Wt, CommandType as Lt, sortRules as Gt, sortRulesByDesc as qt, ImageSourceType as lt, ImageUploadStatusType as tt, generateRandomId as $t, Disposable as Kt, toDisposable as Ft, Inject as Vt, Injector as Ht, IConfigService as zt, ICommandService as Xt, Plugin as Jt, merge as Yt, mergeOverrideWithDependencies as Zt, IImageIoService as Qt, IURLImageService as en } from "@univerjs/core";
|
|
5
|
+
import { IImageIoService as Sn, ImageSourceType as Un, ImageUploadStatusType as An } from "@univerjs/core";
|
|
6
6
|
import { Subject as be } from "rxjs";
|
|
7
|
-
const
|
|
7
|
+
const In = 500, Cn = 500, En = 10, tn = 5 * 1024 * 1024, nn = ["image/png", "image/jpeg", "image/jpg", "image/gif", "image/bmp"], Ut = Wt("univer.drawing-manager.service"), rn = {
|
|
8
8
|
id: "drawing.operation.set-drawing-selected",
|
|
9
|
-
type:
|
|
9
|
+
type: Lt.OPERATION,
|
|
10
10
|
handler: (a, e) => {
|
|
11
|
-
const t = a.get(
|
|
11
|
+
const t = a.get(Ut);
|
|
12
12
|
return e == null ? !1 : (t.focusDrawing(e), !0);
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
}, sn = "@univerjs/drawing", on = "0.17.0", _t = {
|
|
15
|
+
name: sn,
|
|
16
|
+
version: on
|
|
17
|
+
}, an = "drawing.config", vt = {};
|
|
18
|
+
var Ve = {}, Ze = {}, nt = {}, Ot;
|
|
19
|
+
function ln() {
|
|
20
|
+
if (Ot) return nt;
|
|
21
|
+
Ot = 1, Object.defineProperty(nt, "__esModule", { value: !0 });
|
|
19
22
|
function a(n, r) {
|
|
20
23
|
if (Array.isArray(r))
|
|
21
24
|
return !1;
|
|
@@ -38,12 +41,12 @@ function sn() {
|
|
|
38
41
|
function t(n, r) {
|
|
39
42
|
return n === r ? !0 : n === null || r === null || typeof n != "object" || typeof r != "object" ? !1 : Array.isArray(n) ? e(n, r) : a(n, r);
|
|
40
43
|
}
|
|
41
|
-
return
|
|
44
|
+
return nt.default = t, nt;
|
|
42
45
|
}
|
|
43
|
-
var
|
|
44
|
-
function
|
|
45
|
-
if (
|
|
46
|
-
|
|
46
|
+
var rt = {}, wt;
|
|
47
|
+
function un() {
|
|
48
|
+
if (wt) return rt;
|
|
49
|
+
wt = 1, Object.defineProperty(rt, "__esModule", { value: !0 });
|
|
47
50
|
function a(e) {
|
|
48
51
|
if (e === null)
|
|
49
52
|
return null;
|
|
@@ -57,27 +60,27 @@ function on() {
|
|
|
57
60
|
} else
|
|
58
61
|
return e;
|
|
59
62
|
}
|
|
60
|
-
return
|
|
63
|
+
return rt.default = a, rt;
|
|
61
64
|
}
|
|
62
|
-
var
|
|
63
|
-
function
|
|
64
|
-
return
|
|
65
|
+
var ut = {}, bt;
|
|
66
|
+
function At() {
|
|
67
|
+
return bt || (bt = 1, (function(a) {
|
|
65
68
|
Object.defineProperty(a, "__esModule", { value: !0 }), a.eachChildOf = a.advancer = a.readCursor = a.writeCursor = a.WriteCursor = a.ReadCursor = a.isValidPathItem = void 0;
|
|
66
|
-
function e(
|
|
67
|
-
if (!
|
|
69
|
+
function e(m, s) {
|
|
70
|
+
if (!m)
|
|
68
71
|
throw new Error(s);
|
|
69
72
|
}
|
|
70
|
-
const t = (
|
|
73
|
+
const t = (m) => m != null && typeof m == "object" && !Array.isArray(m), n = (m, s) => (
|
|
71
74
|
// All the numbers, then all the letters. Just as the gods of ascii intended.
|
|
72
|
-
typeof
|
|
75
|
+
typeof m == typeof s ? m > s : typeof m == "string" && typeof s == "number"
|
|
73
76
|
);
|
|
74
|
-
function r(
|
|
75
|
-
for (let c in
|
|
77
|
+
function r(m, s) {
|
|
78
|
+
for (let c in m) {
|
|
76
79
|
const h = c;
|
|
77
|
-
s.write(h,
|
|
80
|
+
s.write(h, m[h]);
|
|
78
81
|
}
|
|
79
82
|
}
|
|
80
|
-
a.isValidPathItem = (
|
|
83
|
+
a.isValidPathItem = (m) => typeof m == "number" || typeof m == "string" && m !== "__proto__";
|
|
81
84
|
class u {
|
|
82
85
|
constructor(s = null) {
|
|
83
86
|
this.parents = [], this.indexes = [], this.lcIdx = -1, this.idx = -1, this.container = s;
|
|
@@ -253,52 +256,52 @@ function Ut() {
|
|
|
253
256
|
return s.push(...this.pendingDescent), s;
|
|
254
257
|
}
|
|
255
258
|
}
|
|
256
|
-
a.WriteCursor = l, a.writeCursor = () => new l(), a.readCursor = (
|
|
257
|
-
function E(
|
|
259
|
+
a.WriteCursor = l, a.writeCursor = () => new l(), a.readCursor = (m) => new o(m);
|
|
260
|
+
function E(m, s, c) {
|
|
258
261
|
let h, M;
|
|
259
|
-
M = h =
|
|
262
|
+
M = h = m ? m.descendFirst() : !1;
|
|
260
263
|
function Y(pe) {
|
|
261
264
|
let Z;
|
|
262
265
|
for (; M; ) {
|
|
263
|
-
const Ie = Z =
|
|
266
|
+
const Ie = Z = m.getKey();
|
|
264
267
|
if (pe != null) {
|
|
265
268
|
let qe = !1;
|
|
266
|
-
if (s && typeof Ie == "number" && (Z = s(Ie,
|
|
269
|
+
if (s && typeof Ie == "number" && (Z = s(Ie, m.getComponent()), Z < 0 && (Z = ~Z, qe = !0)), n(Z, pe))
|
|
267
270
|
return null;
|
|
268
271
|
if (Z === pe && !qe)
|
|
269
|
-
return
|
|
272
|
+
return m;
|
|
270
273
|
}
|
|
271
|
-
c && typeof Z == "number" && c(Z,
|
|
274
|
+
c && typeof Z == "number" && c(Z, m.getComponent()), M = m.nextSibling();
|
|
272
275
|
}
|
|
273
276
|
return null;
|
|
274
277
|
}
|
|
275
278
|
return Y.end = () => {
|
|
276
|
-
h &&
|
|
279
|
+
h && m.ascend();
|
|
277
280
|
}, Y;
|
|
278
281
|
}
|
|
279
282
|
a.advancer = E;
|
|
280
|
-
function B(
|
|
283
|
+
function B(m, s, c) {
|
|
281
284
|
let h, M, Y, pe;
|
|
282
|
-
for (h = M =
|
|
283
|
-
let Z = h ?
|
|
284
|
-
Z !== null && Ie !== null && (n(Ie, Z) ? Ie = null : Z !== Ie && (Z = null)), c(Z == null ? Ie : Z, Z != null ?
|
|
285
|
+
for (h = M = m && m.descendFirst(), Y = pe = s && s.descendFirst(); h || Y; ) {
|
|
286
|
+
let Z = h ? m.getKey() : null, Ie = Y ? s.getKey() : null;
|
|
287
|
+
Z !== null && Ie !== null && (n(Ie, Z) ? Ie = null : Z !== Ie && (Z = null)), c(Z == null ? Ie : Z, Z != null ? m : null, Ie != null ? s : null), Z != null && h && (h = m.nextSibling()), Ie != null && Y && (Y = s.nextSibling());
|
|
285
288
|
}
|
|
286
|
-
M &&
|
|
289
|
+
M && m.ascend(), pe && s.ascend();
|
|
287
290
|
}
|
|
288
291
|
a.eachChildOf = B;
|
|
289
|
-
})(
|
|
292
|
+
})(ut)), ut;
|
|
290
293
|
}
|
|
291
|
-
var
|
|
292
|
-
function
|
|
293
|
-
return
|
|
294
|
+
var ct = {}, It;
|
|
295
|
+
function Mt() {
|
|
296
|
+
return It || (It = 1, (function(a) {
|
|
294
297
|
Object.defineProperty(a, "__esModule", { value: !0 }), a.ConflictType = void 0, (function(e) {
|
|
295
298
|
e[e.RM_UNEXPECTED_CONTENT = 1] = "RM_UNEXPECTED_CONTENT", e[e.DROP_COLLISION = 2] = "DROP_COLLISION", e[e.BLACKHOLE = 3] = "BLACKHOLE";
|
|
296
299
|
})(a.ConflictType || (a.ConflictType = {}));
|
|
297
|
-
})(
|
|
300
|
+
})(ct)), ct;
|
|
298
301
|
}
|
|
299
|
-
var Me = {}, He = {},
|
|
302
|
+
var Me = {}, He = {}, Ct;
|
|
300
303
|
function pt() {
|
|
301
|
-
return
|
|
304
|
+
return Ct || (Ct = 1, Object.defineProperty(He, "__esModule", { value: !0 }), He.uniToStrPos = He.strPosToUni = void 0, He.strPosToUni = (a, e = a.length) => {
|
|
302
305
|
let t = 0, n = 0;
|
|
303
306
|
for (; n < e; n++) {
|
|
304
307
|
const r = a.charCodeAt(n);
|
|
@@ -316,61 +319,61 @@ function pt() {
|
|
|
316
319
|
return t;
|
|
317
320
|
}), He;
|
|
318
321
|
}
|
|
319
|
-
var
|
|
322
|
+
var dt = {}, Et;
|
|
320
323
|
function ht() {
|
|
321
|
-
return
|
|
324
|
+
return Et || (Et = 1, (function(a) {
|
|
322
325
|
Object.defineProperty(a, "__esModule", { value: !0 }), a.uniSlice = a.dlen = a.eachOp = void 0;
|
|
323
326
|
const e = pt(), t = (f) => {
|
|
324
327
|
if (!Array.isArray(f))
|
|
325
328
|
throw Error("Op must be an array of components");
|
|
326
329
|
let y = null;
|
|
327
330
|
for (let b = 0; b < f.length; b++) {
|
|
328
|
-
const
|
|
329
|
-
switch (typeof
|
|
331
|
+
const $ = f[b];
|
|
332
|
+
switch (typeof $) {
|
|
330
333
|
case "object":
|
|
331
|
-
if (typeof
|
|
334
|
+
if (typeof $.d != "number" && typeof $.d != "string")
|
|
332
335
|
throw Error("Delete must be number or string");
|
|
333
|
-
if (a.dlen(
|
|
336
|
+
if (a.dlen($.d) <= 0)
|
|
334
337
|
throw Error("Deletes must not be empty");
|
|
335
338
|
break;
|
|
336
339
|
case "string":
|
|
337
|
-
if (!(
|
|
340
|
+
if (!($.length > 0))
|
|
338
341
|
throw Error("Inserts cannot be empty");
|
|
339
342
|
break;
|
|
340
343
|
case "number":
|
|
341
|
-
if (!(
|
|
344
|
+
if (!($ > 0))
|
|
342
345
|
throw Error("Skip components must be >0");
|
|
343
346
|
if (typeof y == "number")
|
|
344
347
|
throw Error("Adjacent skip components should be combined");
|
|
345
348
|
break;
|
|
346
349
|
}
|
|
347
|
-
y =
|
|
350
|
+
y = $;
|
|
348
351
|
}
|
|
349
352
|
if (typeof y == "number")
|
|
350
353
|
throw Error("Op has a trailing skip");
|
|
351
354
|
};
|
|
352
355
|
function n(f, y) {
|
|
353
|
-
let b = 0,
|
|
356
|
+
let b = 0, $ = 0;
|
|
354
357
|
for (let z = 0; z < f.length; z++) {
|
|
355
|
-
const
|
|
356
|
-
switch (y(
|
|
358
|
+
const K = f[z];
|
|
359
|
+
switch (y(K, b, $), typeof K) {
|
|
357
360
|
case "object":
|
|
358
|
-
b += a.dlen(
|
|
361
|
+
b += a.dlen(K.d);
|
|
359
362
|
break;
|
|
360
363
|
case "string":
|
|
361
|
-
|
|
364
|
+
$ += e.strPosToUni(K);
|
|
362
365
|
break;
|
|
363
366
|
case "number":
|
|
364
|
-
b +=
|
|
367
|
+
b += K, $ += K;
|
|
365
368
|
break;
|
|
366
369
|
}
|
|
367
370
|
}
|
|
368
371
|
}
|
|
369
372
|
a.eachOp = n;
|
|
370
373
|
function r(f, y) {
|
|
371
|
-
const b = [],
|
|
372
|
-
return n(f, (z,
|
|
373
|
-
|
|
374
|
+
const b = [], $ = l(b);
|
|
375
|
+
return n(f, (z, K, Ee) => {
|
|
376
|
+
$(y(z, K, Ee));
|
|
374
377
|
}), s(b);
|
|
375
378
|
}
|
|
376
379
|
const u = (f) => f, o = (f) => r(f, u);
|
|
@@ -388,31 +391,31 @@ function ht() {
|
|
|
388
391
|
f.push(y);
|
|
389
392
|
}, E = (f) => typeof f == "number" ? f : typeof f == "string" ? e.strPosToUni(f) : typeof f.d == "number" ? f.d : e.strPosToUni(f.d);
|
|
390
393
|
a.uniSlice = (f, y, b) => {
|
|
391
|
-
const
|
|
392
|
-
return f.slice(
|
|
394
|
+
const $ = e.uniToStrPos(f, y), z = b == null ? 1 / 0 : e.uniToStrPos(f, b);
|
|
395
|
+
return f.slice($, z);
|
|
393
396
|
};
|
|
394
|
-
const B = (f, y, b) => typeof f == "number" ? b == null ? f - y : Math.min(f, b) - y : a.uniSlice(f, y, b),
|
|
397
|
+
const B = (f, y, b) => typeof f == "number" ? b == null ? f - y : Math.min(f, b) - y : a.uniSlice(f, y, b), m = (f) => {
|
|
395
398
|
let y = 0, b = 0;
|
|
396
|
-
return { take: (
|
|
399
|
+
return { take: (K, Ee) => {
|
|
397
400
|
if (y === f.length)
|
|
398
|
-
return
|
|
401
|
+
return K === -1 ? null : K;
|
|
399
402
|
const ce = f[y];
|
|
400
403
|
let ne;
|
|
401
404
|
if (typeof ce == "number")
|
|
402
|
-
return
|
|
405
|
+
return K === -1 || ce - b <= K ? (ne = ce - b, ++y, b = 0, ne) : (b += K, K);
|
|
403
406
|
if (typeof ce == "string") {
|
|
404
|
-
if (
|
|
407
|
+
if (K === -1 || Ee === "i" || e.strPosToUni(ce.slice(b)) <= K)
|
|
405
408
|
return ne = ce.slice(b), ++y, b = 0, ne;
|
|
406
409
|
{
|
|
407
|
-
const le = b + e.uniToStrPos(ce.slice(b),
|
|
410
|
+
const le = b + e.uniToStrPos(ce.slice(b), K);
|
|
408
411
|
return ne = ce.slice(b, le), b = le, ne;
|
|
409
412
|
}
|
|
410
413
|
} else {
|
|
411
|
-
if (
|
|
414
|
+
if (K === -1 || Ee === "d" || a.dlen(ce.d) - b <= K)
|
|
412
415
|
return ne = { d: B(ce.d, b) }, ++y, b = 0, ne;
|
|
413
416
|
{
|
|
414
|
-
let le = B(ce.d, b, b +
|
|
415
|
-
return b +=
|
|
417
|
+
let le = B(ce.d, b, b + K);
|
|
418
|
+
return b += K, { d: le };
|
|
416
419
|
}
|
|
417
420
|
}
|
|
418
421
|
}, peek: () => f[y] };
|
|
@@ -421,21 +424,21 @@ function ht() {
|
|
|
421
424
|
if (b !== "left" && b !== "right")
|
|
422
425
|
throw Error("side (" + b + ") must be 'left' or 'right'");
|
|
423
426
|
t(f), t(y);
|
|
424
|
-
const
|
|
427
|
+
const $ = [], z = l($), { take: K, peek: Ee } = m(f);
|
|
425
428
|
for (let ne = 0; ne < y.length; ne++) {
|
|
426
429
|
const le = y[ne];
|
|
427
430
|
let ge, De;
|
|
428
431
|
switch (typeof le) {
|
|
429
432
|
case "number":
|
|
430
433
|
for (ge = le; ge > 0; )
|
|
431
|
-
De =
|
|
434
|
+
De = K(ge, "i"), z(De), typeof De != "string" && (ge -= E(De));
|
|
432
435
|
break;
|
|
433
436
|
case "string":
|
|
434
|
-
b === "left" && typeof Ee() == "string" && z(
|
|
437
|
+
b === "left" && typeof Ee() == "string" && z(K(-1)), z(e.strPosToUni(le));
|
|
435
438
|
break;
|
|
436
439
|
case "object":
|
|
437
440
|
for (ge = a.dlen(le.d); ge > 0; )
|
|
438
|
-
switch (De =
|
|
441
|
+
switch (De = K(ge, "i"), typeof De) {
|
|
439
442
|
case "number":
|
|
440
443
|
ge -= De;
|
|
441
444
|
break;
|
|
@@ -449,23 +452,23 @@ function ht() {
|
|
|
449
452
|
}
|
|
450
453
|
}
|
|
451
454
|
let ce;
|
|
452
|
-
for (; ce =
|
|
455
|
+
for (; ce = K(-1); )
|
|
453
456
|
z(ce);
|
|
454
|
-
return s(
|
|
457
|
+
return s($);
|
|
455
458
|
}
|
|
456
459
|
function h(f, y) {
|
|
457
460
|
t(f), t(y);
|
|
458
|
-
const b = [],
|
|
461
|
+
const b = [], $ = l(b), { take: z } = m(f);
|
|
459
462
|
for (let Ee = 0; Ee < y.length; Ee++) {
|
|
460
463
|
const ce = y[Ee];
|
|
461
464
|
let ne, le;
|
|
462
465
|
switch (typeof ce) {
|
|
463
466
|
case "number":
|
|
464
467
|
for (ne = ce; ne > 0; )
|
|
465
|
-
le = z(ne, "d"),
|
|
468
|
+
le = z(ne, "d"), $(le), typeof le != "object" && (ne -= E(le));
|
|
466
469
|
break;
|
|
467
470
|
case "string":
|
|
468
|
-
|
|
471
|
+
$(ce);
|
|
469
472
|
break;
|
|
470
473
|
case "object":
|
|
471
474
|
ne = a.dlen(ce.d);
|
|
@@ -473,34 +476,34 @@ function ht() {
|
|
|
473
476
|
for (; ge < ne; )
|
|
474
477
|
switch (le = z(ne - ge, "d"), typeof le) {
|
|
475
478
|
case "number":
|
|
476
|
-
|
|
479
|
+
$({ d: B(ce.d, ge, ge + le) }), ge += le;
|
|
477
480
|
break;
|
|
478
481
|
case "string":
|
|
479
482
|
ge += e.strPosToUni(le);
|
|
480
483
|
break;
|
|
481
484
|
case "object":
|
|
482
|
-
|
|
485
|
+
$(le);
|
|
483
486
|
}
|
|
484
487
|
break;
|
|
485
488
|
}
|
|
486
489
|
}
|
|
487
|
-
let
|
|
488
|
-
for (;
|
|
489
|
-
|
|
490
|
+
let K;
|
|
491
|
+
for (; K = z(-1); )
|
|
492
|
+
$(K);
|
|
490
493
|
return s(b);
|
|
491
494
|
}
|
|
492
495
|
const M = (f, y) => {
|
|
493
496
|
let b = 0;
|
|
494
|
-
for (let
|
|
495
|
-
const z = y[
|
|
497
|
+
for (let $ = 0; $ < y.length && f > b; $++) {
|
|
498
|
+
const z = y[$];
|
|
496
499
|
switch (typeof z) {
|
|
497
500
|
case "number": {
|
|
498
501
|
b += z;
|
|
499
502
|
break;
|
|
500
503
|
}
|
|
501
504
|
case "string":
|
|
502
|
-
const
|
|
503
|
-
b +=
|
|
505
|
+
const K = e.strPosToUni(z);
|
|
506
|
+
b += K, f += K;
|
|
504
507
|
break;
|
|
505
508
|
case "object":
|
|
506
509
|
f -= Math.min(a.dlen(z.d), f - b);
|
|
@@ -510,7 +513,7 @@ function ht() {
|
|
|
510
513
|
return f;
|
|
511
514
|
}, Y = (f, y) => typeof f == "number" ? M(f, y) : f.map((b) => M(b, y));
|
|
512
515
|
function pe(f, y, b) {
|
|
513
|
-
return r(f, (
|
|
516
|
+
return r(f, ($, z) => typeof $ == "object" && typeof $.d == "number" ? { d: b.slice(y, z, z + $.d) } : $);
|
|
514
517
|
}
|
|
515
518
|
function Z(f) {
|
|
516
519
|
return r(f, (y) => {
|
|
@@ -537,7 +540,7 @@ function ht() {
|
|
|
537
540
|
typeof b == "object" && typeof b.d == "number" && (y = !1);
|
|
538
541
|
}), y;
|
|
539
542
|
}
|
|
540
|
-
function
|
|
543
|
+
function _e(f) {
|
|
541
544
|
return {
|
|
542
545
|
name: "text-unicode",
|
|
543
546
|
uri: "http://sharejs.org/types/text-unicode",
|
|
@@ -558,22 +561,22 @@ function ht() {
|
|
|
558
561
|
*/
|
|
559
562
|
apply(y, b) {
|
|
560
563
|
t(b);
|
|
561
|
-
const
|
|
564
|
+
const $ = f.builder(y);
|
|
562
565
|
for (let z = 0; z < b.length; z++) {
|
|
563
|
-
const
|
|
564
|
-
switch (typeof
|
|
566
|
+
const K = b[z];
|
|
567
|
+
switch (typeof K) {
|
|
565
568
|
case "number":
|
|
566
|
-
|
|
569
|
+
$.skip(K);
|
|
567
570
|
break;
|
|
568
571
|
case "string":
|
|
569
|
-
|
|
572
|
+
$.append(K);
|
|
570
573
|
break;
|
|
571
574
|
case "object":
|
|
572
|
-
|
|
575
|
+
$.del(a.dlen(K.d));
|
|
573
576
|
break;
|
|
574
577
|
}
|
|
575
578
|
}
|
|
576
|
-
return
|
|
579
|
+
return $.build();
|
|
577
580
|
},
|
|
578
581
|
transform: c,
|
|
579
582
|
compose: h,
|
|
@@ -591,13 +594,13 @@ function ht() {
|
|
|
591
594
|
isNoop: (y) => y.length === 0
|
|
592
595
|
};
|
|
593
596
|
}
|
|
594
|
-
a.default =
|
|
595
|
-
})(
|
|
597
|
+
a.default = _e;
|
|
598
|
+
})(dt)), dt;
|
|
596
599
|
}
|
|
597
|
-
var
|
|
598
|
-
function
|
|
599
|
-
if (
|
|
600
|
-
|
|
600
|
+
var it = {}, Dt;
|
|
601
|
+
function cn() {
|
|
602
|
+
if (Dt) return it;
|
|
603
|
+
Dt = 1, Object.defineProperty(it, "__esModule", { value: !0 });
|
|
601
604
|
const a = ht(), e = pt();
|
|
602
605
|
function t(n, r) {
|
|
603
606
|
return {
|
|
@@ -636,11 +639,11 @@ function an() {
|
|
|
636
639
|
onRemove: null
|
|
637
640
|
};
|
|
638
641
|
}
|
|
639
|
-
return
|
|
642
|
+
return it.default = t, t.provides = { text: !0 }, it;
|
|
640
643
|
}
|
|
641
|
-
var
|
|
642
|
-
function
|
|
643
|
-
return
|
|
644
|
+
var Pt;
|
|
645
|
+
function dn() {
|
|
646
|
+
return Pt || (Pt = 1, (function(a) {
|
|
644
647
|
var e = Me && Me.__createBinding || (Object.create ? (function(c, h, M, Y) {
|
|
645
648
|
Y === void 0 && (Y = M), Object.defineProperty(c, Y, { enumerable: !0, get: function() {
|
|
646
649
|
return h[M];
|
|
@@ -660,7 +663,7 @@ function ln() {
|
|
|
660
663
|
return c && c.__esModule ? c : { default: c };
|
|
661
664
|
};
|
|
662
665
|
Object.defineProperty(a, "__esModule", { value: !0 }), a.type = a.remove = a.insert = void 0;
|
|
663
|
-
const u = pt(), o = n(ht()), l = r(
|
|
666
|
+
const u = pt(), o = n(ht()), l = r(cn()), E = {
|
|
664
667
|
create(c) {
|
|
665
668
|
return c;
|
|
666
669
|
},
|
|
@@ -690,17 +693,17 @@ function ln() {
|
|
|
690
693
|
};
|
|
691
694
|
},
|
|
692
695
|
slice: o.uniSlice
|
|
693
|
-
}, B = o.default(E),
|
|
694
|
-
a.type =
|
|
696
|
+
}, B = o.default(E), m = Object.assign(Object.assign({}, B), { api: l.default });
|
|
697
|
+
a.type = m, a.insert = (c, h) => h.length === 0 ? [] : c === 0 ? [h] : [c, h], a.remove = (c, h) => o.dlen(h) === 0 ? [] : c === 0 ? [{ d: h }] : [c, { d: h }];
|
|
695
698
|
var s = ht();
|
|
696
699
|
Object.defineProperty(a, "makeType", { enumerable: !0, get: function() {
|
|
697
700
|
return s.default;
|
|
698
701
|
} });
|
|
699
702
|
})(Me)), Me;
|
|
700
703
|
}
|
|
701
|
-
var
|
|
702
|
-
function
|
|
703
|
-
return
|
|
704
|
+
var Tt;
|
|
705
|
+
function fn() {
|
|
706
|
+
return Tt || (Tt = 1, (function(a) {
|
|
704
707
|
var e = Ze && Ze.__importDefault || function(i) {
|
|
705
708
|
return i && i.__esModule ? i : {
|
|
706
709
|
default: i
|
|
@@ -709,7 +712,7 @@ function un() {
|
|
|
709
712
|
Object.defineProperty(a, "__esModule", {
|
|
710
713
|
value: !0
|
|
711
714
|
}), a.editOp = a.replaceOp = a.insertOp = a.moveOp = a.removeOp = a.type = void 0;
|
|
712
|
-
const t = e(
|
|
715
|
+
const t = e(ln()), n = e(un()), r = At(), u = Mt();
|
|
713
716
|
function o(i, d) {
|
|
714
717
|
if (!i) throw new Error(d);
|
|
715
718
|
}
|
|
@@ -724,15 +727,15 @@ function un() {
|
|
|
724
727
|
},
|
|
725
728
|
registerSubtype: Z,
|
|
726
729
|
checkValidOp: z,
|
|
727
|
-
normalize:
|
|
730
|
+
normalize: K,
|
|
728
731
|
apply: Ee,
|
|
729
732
|
transformPosition: ce,
|
|
730
733
|
compose: ne,
|
|
731
|
-
tryTransform:
|
|
732
|
-
transform:
|
|
734
|
+
tryTransform: ot,
|
|
735
|
+
transform: Nt,
|
|
733
736
|
makeInvertible: De,
|
|
734
737
|
invert: le,
|
|
735
|
-
invertWithDoc:
|
|
738
|
+
invertWithDoc: jt,
|
|
736
739
|
RM_UNEXPECTED_CONTENT: u.ConflictType.RM_UNEXPECTED_CONTENT,
|
|
737
740
|
DROP_COLLISION: u.ConflictType.DROP_COLLISION,
|
|
738
741
|
BLACKHOLE: u.ConflictType.BLACKHOLE,
|
|
@@ -745,7 +748,7 @@ function un() {
|
|
|
745
748
|
function E(i) {
|
|
746
749
|
return i && typeof i == "object" && !Array.isArray(i);
|
|
747
750
|
}
|
|
748
|
-
const B = (i) => Array.isArray(i) ? i.slice() : i !== null && typeof i == "object" ? Object.assign({}, i) : i,
|
|
751
|
+
const B = (i) => Array.isArray(i) ? i.slice() : i !== null && typeof i == "object" ? Object.assign({}, i) : i, m = (i) => i && (i.p != null || i.r !== void 0), s = (i) => i && (i.d != null || i.i !== void 0);
|
|
749
752
|
function c(i, d) {
|
|
750
753
|
return o(i != null), typeof d == "number" ? (o(Array.isArray(i), "Invalid key - child is not an array"), (i = i.slice()).splice(d, 1)) : (o(E(i), "Invalid key - child is not an object"), delete (i = Object.assign({}, i))[d]), i;
|
|
751
754
|
}
|
|
@@ -765,7 +768,7 @@ function un() {
|
|
|
765
768
|
if (d) return d;
|
|
766
769
|
throw Error("Missing type: " + i);
|
|
767
770
|
};
|
|
768
|
-
Z(
|
|
771
|
+
Z(dn());
|
|
769
772
|
const qe = (i, d) => i + d;
|
|
770
773
|
Z({
|
|
771
774
|
name: "number",
|
|
@@ -774,14 +777,14 @@ function un() {
|
|
|
774
777
|
invert: (i) => -i,
|
|
775
778
|
transform: (i) => i
|
|
776
779
|
});
|
|
777
|
-
const
|
|
780
|
+
const _e = (i) => i == null ? null : i.et ? Ie(i.et) : i.es ? pe["text-unicode"] : i.ena != null ? pe.number : null, f = (i) => i.es ? i.es : i.ena != null ? i.ena : i.e, y = (i, d, v, D = !1) => {
|
|
778
781
|
const [O, C] = typeof d == "string" ? [Ie(d), d] : [d, d.name];
|
|
779
782
|
!D && O.isNoop && O.isNoop(v) || (C === "number" ? i.write("ena", v) : C === "text-unicode" ? i.write("es", v) : (i.write("et", C), i.write("e", v)));
|
|
780
783
|
};
|
|
781
784
|
function b(i) {
|
|
782
785
|
o(typeof i == "number"), o(i >= 0), o(i === (0 | i));
|
|
783
786
|
}
|
|
784
|
-
function
|
|
787
|
+
function $(i) {
|
|
785
788
|
typeof i == "number" ? b(i) : o(typeof i == "string");
|
|
786
789
|
}
|
|
787
790
|
function z(i) {
|
|
@@ -789,12 +792,12 @@ function un() {
|
|
|
789
792
|
const d = /* @__PURE__ */ new Set(), v = /* @__PURE__ */ new Set(), D = (C) => {
|
|
790
793
|
let x = !0, N = !1;
|
|
791
794
|
for (let p in C) {
|
|
792
|
-
const
|
|
793
|
-
if (x = !1, o(p === "p" || p === "r" || p === "d" || p === "i" || p === "e" || p === "es" || p === "ena" || p === "et", "Invalid component item '" + p + "'"), p === "p") b(
|
|
794
|
-
else if (p === "d") b(
|
|
795
|
+
const _ = C[p];
|
|
796
|
+
if (x = !1, o(p === "p" || p === "r" || p === "d" || p === "i" || p === "e" || p === "es" || p === "ena" || p === "et", "Invalid component item '" + p + "'"), p === "p") b(_), o(!d.has(_)), d.add(_), o(C.r === void 0);
|
|
797
|
+
else if (p === "d") b(_), o(!v.has(_)), v.add(_), o(C.i === void 0);
|
|
795
798
|
else if (p === "e" || p === "es" || p === "ena") {
|
|
796
799
|
o(!N), N = !0;
|
|
797
|
-
const w =
|
|
800
|
+
const w = _e(C);
|
|
798
801
|
o(w, "Missing type in edit"), w.checkValidOp && w.checkValidOp(f(C));
|
|
799
802
|
}
|
|
800
803
|
}
|
|
@@ -802,36 +805,36 @@ function un() {
|
|
|
802
805
|
}, O = (C, x, N) => {
|
|
803
806
|
if (!Array.isArray(C)) throw Error("Op must be null or a list");
|
|
804
807
|
if (C.length === 0) throw Error("Empty descent");
|
|
805
|
-
x ||
|
|
806
|
-
let p = 1,
|
|
808
|
+
x || $(C[0]);
|
|
809
|
+
let p = 1, _ = 0, w = 0;
|
|
807
810
|
for (let I = 0; I < C.length; I++) {
|
|
808
811
|
const R = C[I];
|
|
809
812
|
if (o(R != null), Array.isArray(R)) {
|
|
810
813
|
const W = O(R, !1);
|
|
811
|
-
if (
|
|
814
|
+
if (_) {
|
|
812
815
|
const g = typeof w, U = typeof W;
|
|
813
816
|
g === U ? o(w < W, "descent keys are not in order") : o(g === "number" && U === "string");
|
|
814
817
|
}
|
|
815
|
-
w = W,
|
|
816
|
-
} else typeof R == "object" ? (o(p === 1, `Prev not scalar - instead ${p}`), D(R), p = 2) : (o(p !== 3),
|
|
818
|
+
w = W, _++, p = 3;
|
|
819
|
+
} else typeof R == "object" ? (o(p === 1, `Prev not scalar - instead ${p}`), D(R), p = 2) : (o(p !== 3), $(R), o(r.isValidPathItem(R), "Invalid path key"), p = 1);
|
|
817
820
|
}
|
|
818
|
-
return o(
|
|
821
|
+
return o(_ !== 1, "Operation makes multiple descents. Remove some []"), o(p === 2 || p === 3), C[0];
|
|
819
822
|
};
|
|
820
823
|
O(i, !0), o(d.size === v.size, "Mismatched picks and drops in op");
|
|
821
824
|
for (let C = 0; C < d.size; C++) o(d.has(C)), o(v.has(C));
|
|
822
825
|
}
|
|
823
|
-
function
|
|
826
|
+
function K(i) {
|
|
824
827
|
let d = 0, v = [];
|
|
825
828
|
const D = r.writeCursor();
|
|
826
829
|
return D.mergeTree(i, (O, C) => {
|
|
827
|
-
const x =
|
|
830
|
+
const x = _e(O);
|
|
828
831
|
if (x) {
|
|
829
832
|
const p = f(O);
|
|
830
833
|
y(C, x, x.normalize ? x.normalize(p) : p);
|
|
831
834
|
}
|
|
832
835
|
for (const p of ["r", "p", "i", "d"]) if (O[p] !== void 0) {
|
|
833
|
-
const
|
|
834
|
-
C.write(p,
|
|
836
|
+
const _ = p === "p" || p === "d" ? (N = O[p], v[N] == null && (v[N] = d++), v[N]) : O[p];
|
|
837
|
+
C.write(p, _);
|
|
835
838
|
}
|
|
836
839
|
var N;
|
|
837
840
|
}), D.get();
|
|
@@ -842,10 +845,10 @@ function un() {
|
|
|
842
845
|
return (function D(O, C) {
|
|
843
846
|
let x = O, N = 0, p = {
|
|
844
847
|
root: O
|
|
845
|
-
},
|
|
848
|
+
}, _ = 0, w = p, I = "root";
|
|
846
849
|
function R() {
|
|
847
|
-
for (;
|
|
848
|
-
let W = C[
|
|
850
|
+
for (; _ < N; _++) {
|
|
851
|
+
let W = C[_];
|
|
849
852
|
typeof W != "object" && (o(M(w, I)), w = w[I] = B(w[I]), I = W);
|
|
850
853
|
}
|
|
851
854
|
}
|
|
@@ -856,7 +859,7 @@ function un() {
|
|
|
856
859
|
g !== x && g !== void 0 && (R(), x = w[I] = g);
|
|
857
860
|
} else if (typeof W == "object") {
|
|
858
861
|
W.d != null ? (R(), x = h(w, I, v[W.d])) : W.i !== void 0 && (R(), x = h(w, I, W.i));
|
|
859
|
-
const g =
|
|
862
|
+
const g = _e(W);
|
|
860
863
|
if (g) R(), x = w[I] = g.apply(x, f(W));
|
|
861
864
|
else if (W.e !== void 0) throw Error("Subtype " + W.et + " undefined");
|
|
862
865
|
} else x = Y(x, W);
|
|
@@ -875,10 +878,10 @@ function un() {
|
|
|
875
878
|
const I = C[N];
|
|
876
879
|
if (typeof I != "object") {
|
|
877
880
|
const R = x.pop();
|
|
878
|
-
O = O === Y(R, I) ? R : O === void 0 ? c(R, I) : (
|
|
879
|
-
} else
|
|
881
|
+
O = O === Y(R, I) ? R : O === void 0 ? c(R, I) : (_ = I, w = O, (p = B(p = R))[_] = w, p);
|
|
882
|
+
} else m(I) && (o(O !== void 0, "Cannot pick up or remove undefined"), I.p != null && (v[I.p] = O), O = void 0);
|
|
880
883
|
}
|
|
881
|
-
var p,
|
|
884
|
+
var p, _, w;
|
|
882
885
|
return O;
|
|
883
886
|
})(i, d), d);
|
|
884
887
|
}
|
|
@@ -888,25 +891,25 @@ function un() {
|
|
|
888
891
|
let D, O, C = !1;
|
|
889
892
|
const x = [];
|
|
890
893
|
for (let p = 0; ; p++) {
|
|
891
|
-
const
|
|
894
|
+
const _ = i[p], w = v.getComponent();
|
|
892
895
|
if (w && (w.r !== void 0 ? C = !0 : w.p != null && (C = !1, D = w.p, O = p)), p >= i.length) break;
|
|
893
896
|
let I = 0;
|
|
894
897
|
const R = r.advancer(v, void 0, (g, U) => {
|
|
895
|
-
|
|
898
|
+
m(U) && I++;
|
|
896
899
|
});
|
|
897
900
|
x.unshift(R);
|
|
898
|
-
const W = R(
|
|
899
|
-
if (typeof
|
|
901
|
+
const W = R(_);
|
|
902
|
+
if (typeof _ == "number" && (i[p] -= I), !W) break;
|
|
900
903
|
}
|
|
901
904
|
if (x.forEach((p) => p.end()), C) return null;
|
|
902
905
|
const N = () => {
|
|
903
906
|
let p = 0;
|
|
904
907
|
if (D != null) {
|
|
905
|
-
const
|
|
906
|
-
p =
|
|
908
|
+
const _ = v.getPath();
|
|
909
|
+
p = _.length, i = _.concat(i.slice(O));
|
|
907
910
|
}
|
|
908
911
|
for (; p < i.length; p++) {
|
|
909
|
-
const
|
|
912
|
+
const _ = i[p], w = l(v), I = _e(w);
|
|
910
913
|
if (I) {
|
|
911
914
|
const g = f(w);
|
|
912
915
|
I.transformPosition && (i[p] = I.transformPosition(i[p], g));
|
|
@@ -915,8 +918,8 @@ function un() {
|
|
|
915
918
|
let R = 0;
|
|
916
919
|
const W = r.advancer(v, (g, U) => s(U) ? ~(g - R) : g - R, (g, U) => {
|
|
917
920
|
s(U) && R++;
|
|
918
|
-
})(
|
|
919
|
-
if (typeof
|
|
921
|
+
})(_);
|
|
922
|
+
if (typeof _ == "number" && (i[p] += R), !W) break;
|
|
920
923
|
}
|
|
921
924
|
};
|
|
922
925
|
return D != null ? v.eachDrop(null, (p) => {
|
|
@@ -927,24 +930,24 @@ function un() {
|
|
|
927
930
|
if (z(i), z(d), i == null) return d;
|
|
928
931
|
if (d == null) return i;
|
|
929
932
|
let v = 0;
|
|
930
|
-
const D = r.readCursor(i), O = r.readCursor(d), C = r.writeCursor(), x = [], N = [], p = [],
|
|
933
|
+
const D = r.readCursor(i), O = r.readCursor(d), C = r.writeCursor(), x = [], N = [], p = [], _ = [], w = [], I = [], R = /* @__PURE__ */ new Set();
|
|
931
934
|
D.traverse(null, (g) => {
|
|
932
935
|
g.p != null && (p[g.p] = D.clone());
|
|
933
936
|
}), O.traverse(null, (g) => {
|
|
934
|
-
g.d != null && (
|
|
937
|
+
g.d != null && (_[g.d] = O.clone());
|
|
935
938
|
});
|
|
936
939
|
const W = r.writeCursor();
|
|
937
|
-
return (function g(U, re, te,
|
|
940
|
+
return (function g(U, re, te, F, se, Re, Oe, ye) {
|
|
938
941
|
o(re || te);
|
|
939
|
-
const oe = l(re), Pe = l(te),
|
|
940
|
-
if (Ce != null)
|
|
941
|
-
else if (Pe && Pe.r !== void 0)
|
|
942
|
+
const oe = l(re), Pe = l(te), ke = !!Pe && Pe.r !== void 0, $e = !!oe && oe.i !== void 0, Te = oe ? oe.d : null, Ce = Pe ? Pe.p : null, xe = (Re || ke) && Ce == null;
|
|
943
|
+
if (Ce != null) F = _[Ce], Oe = N[Ce] = new r.WriteCursor();
|
|
944
|
+
else if (Pe && Pe.r !== void 0) F = null;
|
|
942
945
|
else {
|
|
943
|
-
const T = l(
|
|
944
|
-
T && T.d != null && (
|
|
946
|
+
const T = l(F);
|
|
947
|
+
T && T.d != null && (F = null);
|
|
945
948
|
}
|
|
946
|
-
const Q = l(
|
|
947
|
-
if (Te != null) if (U = p[Te], ye = x[Te] = new r.WriteCursor(), xe) Re && !
|
|
949
|
+
const Q = l(F);
|
|
950
|
+
if (Te != null) if (U = p[Te], ye = x[Te] = new r.WriteCursor(), xe) Re && !ke && ye.write("r", !0);
|
|
948
951
|
else {
|
|
949
952
|
const T = w[Te] = v++;
|
|
950
953
|
Oe.write("d", T);
|
|
@@ -954,61 +957,61 @@ function un() {
|
|
|
954
957
|
const T = l(U);
|
|
955
958
|
T && T.p != null && (U = null);
|
|
956
959
|
}
|
|
957
|
-
let
|
|
958
|
-
$e ? (o(se === void 0),
|
|
959
|
-
const L = (Ce == null ? !$e || Re ||
|
|
960
|
+
let k;
|
|
961
|
+
$e ? (o(se === void 0), k = oe.i) : k = se;
|
|
962
|
+
const L = (Ce == null ? !$e || Re || ke : k === void 0) ? null : Oe.getComponent();
|
|
960
963
|
if (Ce != null) {
|
|
961
964
|
if (!(se !== void 0 || $e)) {
|
|
962
965
|
const T = Te != null ? w[Te] : v++;
|
|
963
966
|
I[Ce] = T, ye.write("p", T);
|
|
964
967
|
}
|
|
965
|
-
} else
|
|
966
|
-
const
|
|
967
|
-
if ((
|
|
968
|
-
o(
|
|
969
|
-
const T = f(oe),
|
|
970
|
-
y(Oe,
|
|
971
|
-
} else
|
|
972
|
-
const A = typeof
|
|
968
|
+
} else ke && ($e || se !== void 0 || (Pe.r, ye.write("r", Pe.r)));
|
|
969
|
+
const S = xe ? null : _e(oe), P = _e(Q);
|
|
970
|
+
if ((S || P) && (S && S.name, P && P.name), S && P) {
|
|
971
|
+
o(S === P);
|
|
972
|
+
const T = f(oe), q = f(Q), he = S.compose(T, q);
|
|
973
|
+
y(Oe, S, he), R.add(Q);
|
|
974
|
+
} else S ? y(Oe, S, f(oe)) : P && (y(Oe, P, f(Q)), R.add(Q));
|
|
975
|
+
const A = typeof k == "object" && k != null;
|
|
973
976
|
let J = !1, X = 0, ee = 0, fe = 0, de = 0, ae = 0;
|
|
974
|
-
const ve = r.advancer(
|
|
975
|
-
s(
|
|
976
|
-
}), H = r.advancer(U, (T,
|
|
977
|
-
|
|
977
|
+
const ve = r.advancer(F, (T, q) => s(q) ? de - T - 1 : T - de, (T, q) => {
|
|
978
|
+
s(q) && de++;
|
|
979
|
+
}), H = r.advancer(U, (T, q) => m(q) ? X - T - 1 : T - X, (T, q) => {
|
|
980
|
+
m(q) && X++;
|
|
978
981
|
});
|
|
979
|
-
if (r.eachChildOf(re, te, (T,
|
|
980
|
-
let we, Be, Ke = T,
|
|
982
|
+
if (r.eachChildOf(re, te, (T, q, he) => {
|
|
983
|
+
let we, Be, Ke = T, Se = T, Ye = T;
|
|
981
984
|
if (typeof T == "number") {
|
|
982
|
-
let
|
|
983
|
-
Be = ve(
|
|
985
|
+
let me = T + fe;
|
|
986
|
+
Be = ve(me), Se = me + de;
|
|
984
987
|
let ue = T + ee;
|
|
985
|
-
we = H(ue), s(l(Be)) && (we = null), Ke = ue + X, Ye = T + ae, o(Ke >= 0, "p1PickKey is negative"), o(
|
|
986
|
-
const Ue = s(l(
|
|
988
|
+
we = H(ue), s(l(Be)) && (we = null), Ke = ue + X, Ye = T + ae, o(Ke >= 0, "p1PickKey is negative"), o(Se >= 0, "p2DropKey is negative");
|
|
989
|
+
const Ue = s(l(q)), We = m(l(he));
|
|
987
990
|
(Ue || We && !xe) && ae--, Ue && ee--, We && fe--;
|
|
988
991
|
} else we = H(T), Be = ve(T);
|
|
989
|
-
ye.descend(Ke), Oe.descend(
|
|
990
|
-
const Xe = A && !s(l(
|
|
992
|
+
ye.descend(Ke), Oe.descend(Se);
|
|
993
|
+
const Xe = A && !s(l(q)) ? k[Ye] : void 0, je = g(we, q, he, Be, Xe, xe, Oe, ye);
|
|
991
994
|
var Ne, j, ie;
|
|
992
|
-
A && !xe ? Xe !== je && (J || (
|
|
993
|
-
}), H.end(), ve.end(), L != null) L.i =
|
|
994
|
-
else if (!Re && !
|
|
995
|
+
A && !xe ? Xe !== je && (J || (k = Array.isArray(k) ? k.slice() : Object.assign({}, k), J = !0), Ne = k, ie = je, typeof (j = Ye) == "number" ? (o(Array.isArray(Ne)), o(j < Ne.length)) : (o(!Array.isArray(Ne)), o(Ne[j] !== void 0)), ie === void 0 ? typeof j == "number" ? Ne.splice(j, 1) : delete Ne[j] : Ne[j] = ie) : o(je === void 0), Oe.ascend(), ye.ascend();
|
|
996
|
+
}), H.end(), ve.end(), L != null) L.i = k;
|
|
997
|
+
else if (!Re && !ke && Ce == null) return k;
|
|
995
998
|
})(D, D.clone(), O, O.clone(), void 0, !1, C, W), C.reset(), C.mergeTree(W.get()), C.reset(), C.get(), x.map((g) => g.get()), N.map((g) => g.get()), D.traverse(C, (g, U) => {
|
|
996
999
|
const re = g.p;
|
|
997
1000
|
if (re != null) {
|
|
998
1001
|
const te = w[re];
|
|
999
1002
|
te != null && U.write("p", te);
|
|
1000
|
-
const
|
|
1001
|
-
|
|
1003
|
+
const F = x[re];
|
|
1004
|
+
F && F.get(), F && U.mergeTree(F.get());
|
|
1002
1005
|
} else g.r !== void 0 && U.write("r", g.r);
|
|
1003
1006
|
}), C.reset(), C.get(), O.traverse(C, (g, U) => {
|
|
1004
1007
|
const re = g.d;
|
|
1005
1008
|
if (re != null) {
|
|
1006
|
-
const
|
|
1007
|
-
|
|
1009
|
+
const F = I[re];
|
|
1010
|
+
F != null && U.write("d", F);
|
|
1008
1011
|
const se = N[re];
|
|
1009
1012
|
se && U.mergeTree(se.get());
|
|
1010
1013
|
} else g.i !== void 0 && U.write("i", g.i);
|
|
1011
|
-
const te =
|
|
1014
|
+
const te = _e(g);
|
|
1012
1015
|
te && !R.has(g) && y(U, te, f(g));
|
|
1013
1016
|
}), C.get();
|
|
1014
1017
|
}
|
|
@@ -1017,118 +1020,118 @@ function un() {
|
|
|
1017
1020
|
const d = new r.ReadCursor(i), v = new r.WriteCursor();
|
|
1018
1021
|
let D;
|
|
1019
1022
|
const O = [], C = [];
|
|
1020
|
-
return (function x(N, p,
|
|
1023
|
+
return (function x(N, p, _) {
|
|
1021
1024
|
const w = N.getComponent();
|
|
1022
1025
|
let I, R = !1;
|
|
1023
1026
|
if (w) {
|
|
1024
|
-
w.p != null && (p.write("d", w.p), O[w.p] = N.clone()), w.r !== void 0 && p.write("i", w.r), w.d != null && (p.write("p", w.d),
|
|
1025
|
-
const g =
|
|
1026
|
-
g && (
|
|
1027
|
+
w.p != null && (p.write("d", w.p), O[w.p] = N.clone()), w.r !== void 0 && p.write("i", w.r), w.d != null && (p.write("p", w.d), _ = void 0), w.i !== void 0 && (_ = I = w.i);
|
|
1028
|
+
const g = _e(w);
|
|
1029
|
+
g && (_ === void 0 ? (D || (D = /* @__PURE__ */ new Set()), D.add(w)) : (f(w), _ = g.apply(_, f(w)), R = !0));
|
|
1027
1030
|
}
|
|
1028
1031
|
let W = 0;
|
|
1029
1032
|
for (const g of N) {
|
|
1030
1033
|
p.descend(g);
|
|
1031
|
-
const U = typeof g == "number" ? g - W : g, re = Y(
|
|
1034
|
+
const U = typeof g == "number" ? g - W : g, re = Y(_, U);
|
|
1032
1035
|
s(N.getComponent()) && W++;
|
|
1033
1036
|
const te = x(N, p, re);
|
|
1034
|
-
if (
|
|
1035
|
-
if (R || (R = !0,
|
|
1036
|
-
|
|
1037
|
+
if (_ !== void 0 && te !== void 0) {
|
|
1038
|
+
if (R || (R = !0, _ = B(_)), !M(_, U)) throw Error("Cannot modify child - invalid operation");
|
|
1039
|
+
_[U] = te;
|
|
1037
1040
|
}
|
|
1038
1041
|
p.ascend();
|
|
1039
1042
|
}
|
|
1040
|
-
if (I === void 0) return R ?
|
|
1041
|
-
p.write("r",
|
|
1042
|
-
})(d, v, void 0), D && (v.reset(), (function x(N, p,
|
|
1043
|
+
if (I === void 0) return R ? _ : void 0;
|
|
1044
|
+
p.write("r", _);
|
|
1045
|
+
})(d, v, void 0), D && (v.reset(), (function x(N, p, _) {
|
|
1043
1046
|
const w = p.getComponent();
|
|
1044
1047
|
if (w) {
|
|
1045
1048
|
const g = w.d;
|
|
1046
|
-
if (g != null && (N = O[g],
|
|
1047
|
-
const U =
|
|
1049
|
+
if (g != null && (N = O[g], _ = C[g] = r.writeCursor()), D.has(w)) {
|
|
1050
|
+
const U = _e(w);
|
|
1048
1051
|
if (!U.invert) throw Error(`Cannot invert subtype ${U.name}`);
|
|
1049
|
-
y(
|
|
1052
|
+
y(_, U, U.invert(f(w)));
|
|
1050
1053
|
}
|
|
1051
1054
|
}
|
|
1052
1055
|
let I = 0, R = 0;
|
|
1053
|
-
const W = r.advancer(N, (g, U) =>
|
|
1054
|
-
|
|
1056
|
+
const W = r.advancer(N, (g, U) => m(U) ? I - g - 1 : g - I, (g, U) => {
|
|
1057
|
+
m(U) && I++;
|
|
1055
1058
|
});
|
|
1056
1059
|
for (const g of p) if (typeof g == "number") {
|
|
1057
1060
|
const U = g - R, re = W(U), te = U + I;
|
|
1058
|
-
|
|
1059
|
-
} else
|
|
1061
|
+
_.descend(te), x(re, p, _), s(p.getComponent()) && R++, _.ascend();
|
|
1062
|
+
} else _.descend(g), x(W(g), p, _), _.ascend();
|
|
1060
1063
|
W.end();
|
|
1061
1064
|
})(d.clone(), d, v), C.length && (v.reset(), d.traverse(v, (x, N) => {
|
|
1062
1065
|
const p = x.p;
|
|
1063
1066
|
if (p != null) {
|
|
1064
|
-
const
|
|
1065
|
-
|
|
1067
|
+
const _ = C[p];
|
|
1068
|
+
_ && _.get(), _ && N.mergeTree(_.get());
|
|
1066
1069
|
}
|
|
1067
1070
|
}))), v.get();
|
|
1068
1071
|
}
|
|
1069
1072
|
const ge = (i, d) => i.some((v) => typeof v == "object" && (Array.isArray(v) ? ge(v, d) : d(v)));
|
|
1070
1073
|
function De(i, d) {
|
|
1071
1074
|
if (i == null || !ge(i, (p) => {
|
|
1072
|
-
var
|
|
1073
|
-
return p.r !== void 0 || ((
|
|
1075
|
+
var _;
|
|
1076
|
+
return p.r !== void 0 || ((_ = _e(p)) === null || _ === void 0 ? void 0 : _.makeInvertible) != null;
|
|
1074
1077
|
})) return i;
|
|
1075
1078
|
const v = new r.ReadCursor(i), D = new r.WriteCursor();
|
|
1076
1079
|
let O = !1;
|
|
1077
|
-
const C = [], x = [], N = (p,
|
|
1080
|
+
const C = [], x = [], N = (p, _, w) => {
|
|
1078
1081
|
const I = p.getComponent();
|
|
1079
1082
|
let R = !1;
|
|
1080
1083
|
if (I) {
|
|
1081
|
-
I.d != null &&
|
|
1084
|
+
I.d != null && _.write("d", I.d), I.i !== void 0 && _.write("i", I.i);
|
|
1082
1085
|
const g = I.p;
|
|
1083
|
-
if (g != null && (C[g] = p.clone(), o(w !== void 0, "Operation picks up at an invalid key"), x[g] = w,
|
|
1084
|
-
const U =
|
|
1085
|
-
U && (U.makeInvertible ? O = !0 : y(
|
|
1086
|
+
if (g != null && (C[g] = p.clone(), o(w !== void 0, "Operation picks up at an invalid key"), x[g] = w, _.write("p", I.p)), I.r !== void 0 && w === void 0) throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");
|
|
1087
|
+
const U = _e(I);
|
|
1088
|
+
U && (U.makeInvertible ? O = !0 : y(_, U, f(I), !0));
|
|
1086
1089
|
}
|
|
1087
1090
|
let W = 0;
|
|
1088
1091
|
for (const g of p) {
|
|
1089
|
-
|
|
1090
|
-
const U = typeof g == "number" ? g - W : g, re = Y(w, U), te = N(p,
|
|
1091
|
-
re !== te && (R || (R = !0, w = B(w)), te === void 0 ? (w = c(w, U), typeof g == "number" && W++) : w[U] = te),
|
|
1092
|
+
_.descend(g);
|
|
1093
|
+
const U = typeof g == "number" ? g - W : g, re = Y(w, U), te = N(p, _, re);
|
|
1094
|
+
re !== te && (R || (R = !0, w = B(w)), te === void 0 ? (w = c(w, U), typeof g == "number" && W++) : w[U] = te), _.ascend();
|
|
1092
1095
|
}
|
|
1093
|
-
return I && (I.r !== void 0 ? (
|
|
1096
|
+
return I && (I.r !== void 0 ? (_.write("r", n.default(w)), w = void 0) : I.p != null && (w = void 0)), w;
|
|
1094
1097
|
};
|
|
1095
|
-
return N(v, D, d), D.get(), O && (D.reset(), (function p(
|
|
1098
|
+
return N(v, D, d), D.get(), O && (D.reset(), (function p(_, w, I, R, W) {
|
|
1096
1099
|
const g = w.getComponent();
|
|
1097
1100
|
if (g) {
|
|
1098
|
-
g.i !== void 0 ? (R = g.i, W = !0) : g.d != null && (R = x[g.d],
|
|
1099
|
-
let
|
|
1100
|
-
if (
|
|
1101
|
+
g.i !== void 0 ? (R = g.i, W = !0) : g.d != null && (R = x[g.d], _ = C[g.d], W = !1, g.d);
|
|
1102
|
+
let F = _e(g);
|
|
1103
|
+
if (F && F.makeInvertible) {
|
|
1101
1104
|
const se = f(g);
|
|
1102
|
-
y(I,
|
|
1105
|
+
y(I, F, F.makeInvertible(se, R), !0);
|
|
1103
1106
|
}
|
|
1104
1107
|
}
|
|
1105
1108
|
let U = 0, re = 0;
|
|
1106
|
-
const te = r.advancer(
|
|
1107
|
-
|
|
1109
|
+
const te = r.advancer(_, (F, se) => m(se) ? U - F - 1 : F - U, (F, se) => {
|
|
1110
|
+
m(se) && U++;
|
|
1108
1111
|
});
|
|
1109
|
-
for (const
|
|
1110
|
-
const se =
|
|
1111
|
-
I.descend(
|
|
1112
|
+
for (const F of w) if (typeof F == "number") {
|
|
1113
|
+
const se = F - re, Re = te(se), Oe = se + U, ye = Y(R, W ? se : Oe);
|
|
1114
|
+
I.descend(F), p(Re, w, I, ye, W), s(w.getComponent()) && re++, I.ascend();
|
|
1112
1115
|
} else {
|
|
1113
|
-
const se = Y(R,
|
|
1114
|
-
I.descend(
|
|
1116
|
+
const se = Y(R, F);
|
|
1117
|
+
I.descend(F), p(te(F), w, I, se, W), I.ascend();
|
|
1115
1118
|
}
|
|
1116
1119
|
te.end();
|
|
1117
1120
|
})(v.clone(), v, D, d, !1)), D.get();
|
|
1118
1121
|
}
|
|
1119
|
-
function
|
|
1122
|
+
function jt(i, d) {
|
|
1120
1123
|
return le(De(i, d));
|
|
1121
1124
|
}
|
|
1122
|
-
const
|
|
1125
|
+
const st = (i) => {
|
|
1123
1126
|
if (i == null) return null;
|
|
1124
1127
|
const d = i.slice();
|
|
1125
1128
|
for (let v = 0; v < i.length; v++) {
|
|
1126
1129
|
const D = d[v];
|
|
1127
|
-
Array.isArray(D) && (d[v] =
|
|
1130
|
+
Array.isArray(D) && (d[v] = st(D));
|
|
1128
1131
|
}
|
|
1129
1132
|
return d;
|
|
1130
1133
|
};
|
|
1131
|
-
function
|
|
1134
|
+
function ot(i, d, v) {
|
|
1132
1135
|
o(v === "left" || v === "right", "Direction must be left or right");
|
|
1133
1136
|
const D = v === "left" ? 0 : 1;
|
|
1134
1137
|
if (d == null) return {
|
|
@@ -1137,48 +1140,48 @@ function un() {
|
|
|
1137
1140
|
};
|
|
1138
1141
|
z(i), z(d);
|
|
1139
1142
|
let O = null;
|
|
1140
|
-
const C = [], x = [], N = [], p = [],
|
|
1143
|
+
const C = [], x = [], N = [], p = [], _ = [], w = [], I = [], R = [], W = [], g = [], U = [], re = [], te = [], F = [], se = [];
|
|
1141
1144
|
let Re = 0;
|
|
1142
1145
|
const Oe = r.readCursor(i), ye = r.readCursor(d), oe = r.writeCursor();
|
|
1143
|
-
if ((function Q(
|
|
1146
|
+
if ((function Q(k, L = null, S) {
|
|
1144
1147
|
const P = l(L);
|
|
1145
|
-
P && (P.r !== void 0 ?
|
|
1146
|
-
const A =
|
|
1148
|
+
P && (P.r !== void 0 ? S = L.clone() : P.p != null && (S = null, w[P.p] = k.clone()));
|
|
1149
|
+
const A = k.getComponent();
|
|
1147
1150
|
let J;
|
|
1148
|
-
A && (J = A.p) != null && (
|
|
1151
|
+
A && (J = A.p) != null && (_[J] = L ? L.clone() : null, N[J] = k.clone(), S && (g[J] = !0, W[J] = S), P && P.p != null && (F[J] = P.p));
|
|
1149
1152
|
const X = r.advancer(L);
|
|
1150
|
-
for (const ee of
|
|
1153
|
+
for (const ee of k) Q(k, X(ee), S);
|
|
1151
1154
|
X.end();
|
|
1152
|
-
})(ye, Oe, null), (function Q(
|
|
1153
|
-
const J =
|
|
1155
|
+
})(ye, Oe, null), (function Q(k, L, S, P, A) {
|
|
1156
|
+
const J = S.getComponent();
|
|
1154
1157
|
let X, ee = !1;
|
|
1155
|
-
J && ((X = J.d) != null ? (p[X] =
|
|
1158
|
+
J && ((X = J.d) != null ? (p[X] = S.clone(), P != null && (se[P] == null && (se[P] = []), se[P].push(X)), g[X], k = _[X] || null, L = N[X] || null, g[X] ? (A && (U[X] = !0), A = W[X] || null) : !A || D !== 1 && F[X] != null || O == null && (O = {
|
|
1156
1159
|
type: u.ConflictType.RM_UNEXPECTED_CONTENT,
|
|
1157
1160
|
op1: a.removeOp(A.getPath()),
|
|
1158
|
-
op2: a.moveOp(L.getPath(),
|
|
1159
|
-
}), ee = !0) : J.i !== void 0 && (
|
|
1161
|
+
op2: a.moveOp(L.getPath(), S.getPath())
|
|
1162
|
+
}), ee = !0) : J.i !== void 0 && (k = L = null, ee = !0, A && O == null && (O = {
|
|
1160
1163
|
type: u.ConflictType.RM_UNEXPECTED_CONTENT,
|
|
1161
1164
|
op1: a.removeOp(A.getPath()),
|
|
1162
|
-
op2: a.insertOp(
|
|
1165
|
+
op2: a.insertOp(S.getPath(), J.i)
|
|
1163
1166
|
})));
|
|
1164
|
-
const fe = l(
|
|
1165
|
-
fe && (fe.r !== void 0 ? A =
|
|
1166
|
-
const de =
|
|
1167
|
+
const fe = l(k);
|
|
1168
|
+
fe && (fe.r !== void 0 ? A = k.clone() : fe.p != null && (fe.p, P = fe.p, A = null));
|
|
1169
|
+
const de = _e(J);
|
|
1167
1170
|
de && A && O == null && (O = {
|
|
1168
1171
|
type: u.ConflictType.RM_UNEXPECTED_CONTENT,
|
|
1169
1172
|
op1: a.removeOp(A.getPath()),
|
|
1170
|
-
op2: a.editOp(
|
|
1173
|
+
op2: a.editOp(S.getPath(), de, f(J), !0)
|
|
1171
1174
|
});
|
|
1172
1175
|
let ae = 0, ve = 0;
|
|
1173
|
-
const H = r.advancer(L, (
|
|
1174
|
-
|
|
1175
|
-
}), T = r.advancer(
|
|
1176
|
-
for (const
|
|
1177
|
-
const he =
|
|
1178
|
-
ve += +Q(T(he + ae), we,
|
|
1176
|
+
const H = r.advancer(L, (q, he) => m(he) ? ae - q - 1 : q - ae, (q, he) => {
|
|
1177
|
+
m(he) && ae++;
|
|
1178
|
+
}), T = r.advancer(k);
|
|
1179
|
+
for (const q of S) if (typeof q == "number") {
|
|
1180
|
+
const he = q - ve, we = H(he);
|
|
1181
|
+
ve += +Q(T(he + ae), we, S, P, A);
|
|
1179
1182
|
} else {
|
|
1180
|
-
const he = H(
|
|
1181
|
-
Q(T(
|
|
1183
|
+
const he = H(q);
|
|
1184
|
+
Q(T(q), he, S, P, A);
|
|
1182
1185
|
}
|
|
1183
1186
|
return H.end(), T.end(), ee;
|
|
1184
1187
|
})(Oe, ye, ye.clone(), null, null), p.map((Q) => Q && Q.get()), O) return {
|
|
@@ -1187,52 +1190,52 @@ function un() {
|
|
|
1187
1190
|
};
|
|
1188
1191
|
U.map((Q) => !!Q);
|
|
1189
1192
|
const Pe = [];
|
|
1190
|
-
let
|
|
1191
|
-
(function Q(
|
|
1193
|
+
let ke = null;
|
|
1194
|
+
(function Q(k, L, S, P, A) {
|
|
1192
1195
|
let J = !1;
|
|
1193
1196
|
const X = l(L);
|
|
1194
|
-
if (
|
|
1197
|
+
if (m(X)) {
|
|
1195
1198
|
const H = X.p;
|
|
1196
|
-
H != null ? (
|
|
1197
|
-
} else s(l(
|
|
1198
|
-
const ee =
|
|
1199
|
+
H != null ? (S = p[H], P = re[H] = r.writeCursor(), J = !0, A = null) : (S = null, A = L.clone());
|
|
1200
|
+
} else s(l(S)) && (S = null);
|
|
1201
|
+
const ee = k.getComponent();
|
|
1199
1202
|
if (ee) {
|
|
1200
1203
|
const H = ee.p;
|
|
1201
|
-
H != null ? (A && (R[H] = A), Pe[H] = A || D === 1 && J ? null : P.getComponent(), C[H] =
|
|
1204
|
+
H != null ? (A && (R[H] = A), Pe[H] = A || D === 1 && J ? null : P.getComponent(), C[H] = k.clone(), S && (I[H] = S.clone())) : ee.r !== void 0 && (A || P.write("r", !0), (A || J) && (ke == null && (ke = /* @__PURE__ */ new Set()), ke.add(ee)));
|
|
1202
1205
|
}
|
|
1203
1206
|
let fe = 0, de = 0;
|
|
1204
1207
|
const ae = r.advancer(L, void 0, (H, T) => {
|
|
1205
|
-
|
|
1206
|
-
}), ve = r.advancer(
|
|
1208
|
+
m(T) && fe++;
|
|
1209
|
+
}), ve = r.advancer(S, (H, T) => s(T) ? ~(H - de) : H - de, (H, T) => {
|
|
1207
1210
|
s(T) && de++;
|
|
1208
1211
|
});
|
|
1209
|
-
if (
|
|
1210
|
-
const T = ae(H),
|
|
1211
|
-
P.descend(H), Q(
|
|
1212
|
+
if (k) for (const H of k) if (typeof H == "string") {
|
|
1213
|
+
const T = ae(H), q = ve(H);
|
|
1214
|
+
P.descend(H), Q(k, T, q, P, A), P.ascend();
|
|
1212
1215
|
} else {
|
|
1213
|
-
const T = ae(H),
|
|
1214
|
-
o(we >= 0), P.descend(we), Q(
|
|
1216
|
+
const T = ae(H), q = H - fe, he = m(l(T)) ? null : ve(q), we = q + de;
|
|
1217
|
+
o(we >= 0), P.descend(we), Q(k, T, he, P, A), P.ascend();
|
|
1215
1218
|
}
|
|
1216
1219
|
ae.end(), ve.end();
|
|
1217
1220
|
})(Oe, ye, ye.clone(), oe, null), oe.reset();
|
|
1218
1221
|
let $e = [];
|
|
1219
|
-
if ((function Q(
|
|
1222
|
+
if ((function Q(k, L, S, P, A, J) {
|
|
1220
1223
|
o(L);
|
|
1221
1224
|
const X = L.getComponent();
|
|
1222
1225
|
let ee = l(P), fe = !1;
|
|
1223
|
-
const de = (j, ie,
|
|
1226
|
+
const de = (j, ie, me) => j ? a.moveOp(j.getPath(), ie.getPath()) : a.insertOp(ie.getPath(), me.i);
|
|
1224
1227
|
if (s(X)) {
|
|
1225
1228
|
const j = X.d;
|
|
1226
1229
|
j != null && (x[j] = L.clone());
|
|
1227
1230
|
const ie = j != null ? Pe[j] : null;
|
|
1228
|
-
let
|
|
1231
|
+
let me = !1;
|
|
1229
1232
|
if (X.i !== void 0 || j != null && ie) {
|
|
1230
1233
|
let ue;
|
|
1231
|
-
ee && (ee.i !== void 0 || (ue = ee.d) != null && !g[ue]) && (
|
|
1234
|
+
ee && (ee.i !== void 0 || (ue = ee.d) != null && !g[ue]) && (me = ue != null ? j != null && j === F[ue] : t.default(ee.i, X.i), me || ue != null && D !== 1 && F[ue] != null || O == null && (O = {
|
|
1232
1235
|
type: u.ConflictType.DROP_COLLISION,
|
|
1233
1236
|
op1: de(j != null ? C[j] : null, L, X),
|
|
1234
1237
|
op2: de(ue != null ? N[ue] : null, P, ee)
|
|
1235
|
-
})),
|
|
1238
|
+
})), me || (J ? O == null && (O = {
|
|
1236
1239
|
type: u.ConflictType.RM_UNEXPECTED_CONTENT,
|
|
1237
1240
|
op1: de(j != null ? C[j] : null, L, X),
|
|
1238
1241
|
op2: a.removeOp(J.getPath())
|
|
@@ -1241,15 +1244,15 @@ function un() {
|
|
|
1241
1244
|
const ue = R[j];
|
|
1242
1245
|
ue && (J = ue.clone());
|
|
1243
1246
|
}
|
|
1244
|
-
j != null ? (
|
|
1245
|
-
} else
|
|
1246
|
-
const ae = l(
|
|
1247
|
-
if (
|
|
1247
|
+
j != null ? (k = C[j], S = w[j], P = I[j]) : X.i !== void 0 && (k = S = null, me || (P = null));
|
|
1248
|
+
} else m(l(k)) && (k = S = P = null);
|
|
1249
|
+
const ae = l(k), ve = l(S);
|
|
1250
|
+
if (m(ve)) {
|
|
1248
1251
|
const j = ve.p;
|
|
1249
|
-
ve.r !== void 0 && (!ae || ae.r === void 0) || g[j] ? (P = null, J =
|
|
1252
|
+
ve.r !== void 0 && (!ae || ae.r === void 0) || g[j] ? (P = null, J = S.clone()) : j != null && (P = p[j], D !== 1 && F[j] != null || ((A = te[j]) || (A = te[j] = r.writeCursor()), A.reset(), J = null));
|
|
1250
1253
|
} else !s(X) && s(ee) && (P = null);
|
|
1251
1254
|
ee = P != null ? P.getComponent() : null;
|
|
1252
|
-
const H =
|
|
1255
|
+
const H = _e(X);
|
|
1253
1256
|
if (H) {
|
|
1254
1257
|
const j = f(X);
|
|
1255
1258
|
if (J) O == null && (O = {
|
|
@@ -1258,105 +1261,105 @@ function un() {
|
|
|
1258
1261
|
op2: a.removeOp(J.getPath())
|
|
1259
1262
|
});
|
|
1260
1263
|
else {
|
|
1261
|
-
const ie =
|
|
1262
|
-
let
|
|
1264
|
+
const ie = _e(ee);
|
|
1265
|
+
let me;
|
|
1263
1266
|
if (ie) {
|
|
1264
1267
|
if (H !== ie) throw Error("Transforming incompatible types");
|
|
1265
1268
|
const ue = f(ee);
|
|
1266
|
-
|
|
1267
|
-
} else
|
|
1268
|
-
y(A, H,
|
|
1269
|
+
me = H.transform(j, ue, v);
|
|
1270
|
+
} else me = n.default(j);
|
|
1271
|
+
y(A, H, me);
|
|
1269
1272
|
}
|
|
1270
1273
|
}
|
|
1271
|
-
let T = 0,
|
|
1272
|
-
const Xe = r.advancer(
|
|
1273
|
-
|
|
1274
|
+
let T = 0, q = 0, he = 0, we = 0, Be = 0, Ke = 0, Se = k != null && k.descendFirst(), Ye = Se;
|
|
1275
|
+
const Xe = r.advancer(S, void 0, (j, ie) => {
|
|
1276
|
+
m(ie) && he++;
|
|
1274
1277
|
});
|
|
1275
1278
|
let je = P != null && P.descendFirst(), Ne = je;
|
|
1276
1279
|
for (const j of L) if (typeof j == "number") {
|
|
1277
1280
|
let ie;
|
|
1278
|
-
const
|
|
1281
|
+
const me = s(L.getComponent()), ue = j - q;
|
|
1279
1282
|
{
|
|
1280
1283
|
let Le;
|
|
1281
|
-
for (;
|
|
1284
|
+
for (; Se && typeof (Le = k.getKey()) == "number"; ) {
|
|
1282
1285
|
Le += T;
|
|
1283
|
-
const Ae =
|
|
1284
|
-
if (Le > ue || Le === ue && (!Je || D === 0 &&
|
|
1286
|
+
const Ae = k.getComponent(), Je = m(Ae);
|
|
1287
|
+
if (Le > ue || Le === ue && (!Je || D === 0 && me)) break;
|
|
1285
1288
|
if (Je) {
|
|
1286
1289
|
T--;
|
|
1287
1290
|
const Fe = Ae.p;
|
|
1288
|
-
|
|
1291
|
+
F.includes(Fe), Ae.d, l(te[Ae.d]), m(l(te[Ae.d])), (Ae.r === void 0 || ke && ke.has(Ae)) && (Fe == null || !Pe[Fe] || D !== 1 && F.includes(Fe)) || Be--;
|
|
1289
1292
|
}
|
|
1290
|
-
|
|
1293
|
+
Se = k.nextSibling();
|
|
1291
1294
|
}
|
|
1292
|
-
ie =
|
|
1295
|
+
ie = Se && Le === ue ? k : null;
|
|
1293
1296
|
}
|
|
1294
1297
|
const Ue = ue - T;
|
|
1295
1298
|
let We = Xe(Ue);
|
|
1296
|
-
const
|
|
1297
|
-
let
|
|
1299
|
+
const at = Ue - he;
|
|
1300
|
+
let et = null;
|
|
1298
1301
|
{
|
|
1299
1302
|
let Le, Ae;
|
|
1300
1303
|
for (; je && typeof (Le = P.getKey()) == "number"; ) {
|
|
1301
1304
|
Ae = Le - we;
|
|
1302
1305
|
const Je = P.getComponent(), Fe = s(Je);
|
|
1303
|
-
if (Ae >
|
|
1304
|
-
if (Ae ===
|
|
1306
|
+
if (Ae > at) break;
|
|
1307
|
+
if (Ae === at) {
|
|
1305
1308
|
if (!Fe) {
|
|
1306
|
-
|
|
1309
|
+
et = P;
|
|
1307
1310
|
break;
|
|
1308
1311
|
}
|
|
1309
1312
|
{
|
|
1310
|
-
if (D === 0 &&
|
|
1311
|
-
|
|
1313
|
+
if (D === 0 && me) {
|
|
1314
|
+
et = P;
|
|
1312
1315
|
break;
|
|
1313
1316
|
}
|
|
1314
|
-
const Ge = We &&
|
|
1317
|
+
const Ge = We && m(We.getComponent());
|
|
1315
1318
|
if (D === 0 && Ge) break;
|
|
1316
1319
|
}
|
|
1317
1320
|
}
|
|
1318
1321
|
if (Fe) {
|
|
1319
1322
|
const Ge = Je.d;
|
|
1320
|
-
g[Ge],
|
|
1323
|
+
g[Ge], F[Ge], Je.i === void 0 && (g[Ge] || F[Ge] != null && D !== 1) ? (g[Ge] || F[Ge] != null && D === 0) && (we++, Ke--) : we++;
|
|
1321
1324
|
}
|
|
1322
1325
|
je = P.nextSibling();
|
|
1323
1326
|
}
|
|
1324
1327
|
}
|
|
1325
|
-
const
|
|
1326
|
-
o(
|
|
1328
|
+
const mt = at + we + Be + Ke;
|
|
1329
|
+
o(mt >= 0, "trying to descend to a negative index"), A.descend(mt), me && (ie = We = et = null, q++), Q(ie, L, We, et, A, J) && Ke++, A.ascend();
|
|
1327
1330
|
} else {
|
|
1328
1331
|
let ie;
|
|
1329
|
-
for (;
|
|
1330
|
-
const
|
|
1332
|
+
for (; Se && (ie = k.getKey(), typeof ie != "string" || !(ie > j || ie === j)); ) Se = k.nextSibling();
|
|
1333
|
+
const me = Se && ie === j ? k : null, ue = Xe(j);
|
|
1331
1334
|
let Ue;
|
|
1332
1335
|
for (; je && (Ue = P.getKey(), typeof Ue != "string" || !(Ue > j || Ue === j)); ) je = P.nextSibling();
|
|
1333
1336
|
const We = je && Ue === j ? P : null;
|
|
1334
|
-
A.descend(j), Q(
|
|
1337
|
+
A.descend(j), Q(me, L, ue, We, A, J), A.ascend();
|
|
1335
1338
|
}
|
|
1336
|
-
return Xe.end(), Ye &&
|
|
1339
|
+
return Xe.end(), Ye && k.ascend(), Ne && P.ascend(), fe;
|
|
1337
1340
|
})(Oe, Oe.clone(), ye, ye.clone(), oe, null), O) return {
|
|
1338
1341
|
ok: !1,
|
|
1339
1342
|
conflict: O
|
|
1340
1343
|
};
|
|
1341
1344
|
oe.reset();
|
|
1342
|
-
const Te = (Q,
|
|
1343
|
-
|
|
1345
|
+
const Te = (Q, k, L) => Q.traverse(k, (S, P) => {
|
|
1346
|
+
S.d != null && L(S.d, Q, P);
|
|
1344
1347
|
});
|
|
1345
|
-
(g.length || re.length) && (Te(ye, oe, (Q,
|
|
1348
|
+
(g.length || re.length) && (Te(ye, oe, (Q, k, L) => {
|
|
1346
1349
|
g[Q] && !U[Q] && L.write("r", !0), re[Q] && L.mergeTree(re[Q].get());
|
|
1347
1350
|
}), oe.reset());
|
|
1348
1351
|
const Ce = [], xe = [];
|
|
1349
1352
|
if ((te.length || g.length) && !O) {
|
|
1350
|
-
const Q = r.readCursor(
|
|
1351
|
-
if (Te(Q, null, (
|
|
1352
|
-
Ce[
|
|
1353
|
-
}), te.forEach((
|
|
1354
|
-
|
|
1355
|
-
Ce[L] =
|
|
1353
|
+
const Q = r.readCursor(st(oe.get()));
|
|
1354
|
+
if (Te(Q, null, (k, L) => {
|
|
1355
|
+
Ce[k] = L.clone();
|
|
1356
|
+
}), te.forEach((k) => {
|
|
1357
|
+
k && Te(r.readCursor(k.get()), null, (L, S) => {
|
|
1358
|
+
Ce[L] = S.clone();
|
|
1356
1359
|
});
|
|
1357
|
-
}), (function
|
|
1358
|
-
const ee = l(
|
|
1359
|
-
if (ee &&
|
|
1360
|
+
}), (function k(L, S, P, A, J, X) {
|
|
1361
|
+
const ee = l(S);
|
|
1362
|
+
if (ee && m(ee)) if (ee.p != null) {
|
|
1360
1363
|
const T = ee.p;
|
|
1361
1364
|
Ce[T].getPath(), P = Ce[T], A = xe[T] = r.writeCursor();
|
|
1362
1365
|
} else ee.r !== void 0 && (P = null);
|
|
@@ -1365,45 +1368,45 @@ function un() {
|
|
|
1365
1368
|
if (fe) {
|
|
1366
1369
|
let T;
|
|
1367
1370
|
if ((T = fe.d) != null) {
|
|
1368
|
-
const
|
|
1369
|
-
|
|
1371
|
+
const q = te[T];
|
|
1372
|
+
q && (q.get(), A.mergeTree(q.get()), P = r.readCursor(q.get()));
|
|
1370
1373
|
}
|
|
1371
1374
|
}
|
|
1372
1375
|
let de = 0, ae = 0;
|
|
1373
|
-
const ve = r.advancer(
|
|
1374
|
-
|
|
1375
|
-
}), H = r.advancer(P, (T,
|
|
1376
|
-
s(
|
|
1376
|
+
const ve = r.advancer(S, void 0, (T, q) => {
|
|
1377
|
+
m(q) && de--;
|
|
1378
|
+
}), H = r.advancer(P, (T, q) => s(q) ? -(T - ae) - 1 : T - ae, (T, q) => {
|
|
1379
|
+
s(q) && ae++;
|
|
1377
1380
|
});
|
|
1378
1381
|
for (const T of L) if (typeof T == "number") {
|
|
1379
|
-
const
|
|
1380
|
-
A.descend(Be),
|
|
1381
|
-
} else A.descend(T),
|
|
1382
|
+
const q = ve(T), he = T + de, we = H(he), Be = he + ae;
|
|
1383
|
+
A.descend(Be), k(L, q, we, A), A.ascend();
|
|
1384
|
+
} else A.descend(T), k(L, ve(T), H(T), A), A.ascend();
|
|
1382
1385
|
ve.end(), H.end();
|
|
1383
1386
|
})(ye, Q, Q.clone(), oe), oe.reset(), O) return {
|
|
1384
1387
|
ok: !1,
|
|
1385
1388
|
conflict: O
|
|
1386
1389
|
};
|
|
1387
1390
|
if (oe.get(), xe.length) {
|
|
1388
|
-
const
|
|
1389
|
-
if (Te(L, oe, (
|
|
1390
|
-
const J = S
|
|
1391
|
-
J && (A.mergeTree(J), S
|
|
1392
|
-
}),
|
|
1393
|
-
const
|
|
1391
|
+
const k = xe.map((S) => S ? S.get() : null), L = r.readCursor(st(oe.get()));
|
|
1392
|
+
if (Te(L, oe, (S, P, A) => {
|
|
1393
|
+
const J = k[S];
|
|
1394
|
+
J && (A.mergeTree(J), k[S] = null);
|
|
1395
|
+
}), k.find((S) => S)) {
|
|
1396
|
+
const S = r.writeCursor(), P = r.writeCursor();
|
|
1394
1397
|
let A = 0, J = 0;
|
|
1395
|
-
|
|
1398
|
+
k.forEach((X) => {
|
|
1396
1399
|
X != null && Te(r.readCursor(X), null, (ee) => {
|
|
1397
1400
|
const fe = $e[ee];
|
|
1398
|
-
|
|
1401
|
+
S.writeMove(C[fe].getPath(), x[fe].getPath(), A++);
|
|
1399
1402
|
const de = se[fe];
|
|
1400
1403
|
de && de.forEach((ae) => {
|
|
1401
|
-
g[ae] || D !== 1 &&
|
|
1404
|
+
g[ae] || D !== 1 && F[ae] != null || P.writeMove(N[ae].getPath(), p[ae].getPath(), J++);
|
|
1402
1405
|
});
|
|
1403
1406
|
});
|
|
1404
1407
|
}), O = {
|
|
1405
1408
|
type: u.ConflictType.BLACKHOLE,
|
|
1406
|
-
op1:
|
|
1409
|
+
op1: S.get(),
|
|
1407
1410
|
op2: P.get()
|
|
1408
1411
|
};
|
|
1409
1412
|
}
|
|
@@ -1421,17 +1424,17 @@ function un() {
|
|
|
1421
1424
|
const d = new Error("Transform detected write conflict");
|
|
1422
1425
|
throw d.conflict = i, d.type = d.name = "writeConflict", d;
|
|
1423
1426
|
};
|
|
1424
|
-
function
|
|
1425
|
-
const D =
|
|
1427
|
+
function Nt(i, d, v) {
|
|
1428
|
+
const D = ot(i, d, v);
|
|
1426
1429
|
if (D.ok) return D.result;
|
|
1427
1430
|
gt(D.conflict);
|
|
1428
1431
|
}
|
|
1429
1432
|
const ze = (i) => {
|
|
1430
1433
|
const d = r.writeCursor();
|
|
1431
1434
|
return r.readCursor(i).traverse(d, (v, D) => {
|
|
1432
|
-
(s(v) ||
|
|
1435
|
+
(s(v) || _e(v)) && D.write("r", !0);
|
|
1433
1436
|
}), d.get();
|
|
1434
|
-
},
|
|
1437
|
+
}, Rt = (i, d) => {
|
|
1435
1438
|
const { type: v, op1: D, op2: O } = i;
|
|
1436
1439
|
switch (v) {
|
|
1437
1440
|
case u.ConflictType.DROP_COLLISION:
|
|
@@ -1450,21 +1453,21 @@ function un() {
|
|
|
1450
1453
|
function yt(i, d, v, D) {
|
|
1451
1454
|
let O = null;
|
|
1452
1455
|
for (; ; ) {
|
|
1453
|
-
const C =
|
|
1456
|
+
const C = ot(d, v, D);
|
|
1454
1457
|
if (C.ok) return ne(O, C.result);
|
|
1455
1458
|
{
|
|
1456
1459
|
const { conflict: x } = C;
|
|
1457
1460
|
i(x) || gt(x);
|
|
1458
|
-
const [N, p] =
|
|
1459
|
-
d = ne(
|
|
1461
|
+
const [N, p] = Rt(x, D);
|
|
1462
|
+
d = ne(K(d), N), v = ne(K(v), p), O = ne(O, p);
|
|
1460
1463
|
}
|
|
1461
1464
|
}
|
|
1462
1465
|
}
|
|
1463
1466
|
})(Ze)), Ze;
|
|
1464
1467
|
}
|
|
1465
|
-
var
|
|
1466
|
-
function
|
|
1467
|
-
return
|
|
1468
|
+
var kt;
|
|
1469
|
+
function hn() {
|
|
1470
|
+
return kt || (kt = 1, (function(a) {
|
|
1468
1471
|
var e = Ve && Ve.__createBinding || (Object.create ? (function(u, o, l, E) {
|
|
1469
1472
|
E === void 0 && (E = l), Object.defineProperty(u, E, { enumerable: !0, get: function() {
|
|
1470
1473
|
return o[l];
|
|
@@ -1474,59 +1477,59 @@ function cn() {
|
|
|
1474
1477
|
})), t = Ve && Ve.__exportStar || function(u, o) {
|
|
1475
1478
|
for (var l in u) l !== "default" && !o.hasOwnProperty(l) && e(o, u, l);
|
|
1476
1479
|
};
|
|
1477
|
-
Object.defineProperty(a, "__esModule", { value: !0 }), t(
|
|
1478
|
-
var n =
|
|
1480
|
+
Object.defineProperty(a, "__esModule", { value: !0 }), t(fn(), a);
|
|
1481
|
+
var n = At();
|
|
1479
1482
|
Object.defineProperty(a, "ReadCursor", { enumerable: !0, get: function() {
|
|
1480
1483
|
return n.ReadCursor;
|
|
1481
1484
|
} }), Object.defineProperty(a, "WriteCursor", { enumerable: !0, get: function() {
|
|
1482
1485
|
return n.WriteCursor;
|
|
1483
1486
|
} });
|
|
1484
|
-
var r =
|
|
1487
|
+
var r = Mt();
|
|
1485
1488
|
Object.defineProperty(a, "ConflictType", { enumerable: !0, get: function() {
|
|
1486
1489
|
return r.ConflictType;
|
|
1487
1490
|
} });
|
|
1488
1491
|
})(Ve)), Ve;
|
|
1489
1492
|
}
|
|
1490
|
-
var V =
|
|
1491
|
-
class
|
|
1493
|
+
var V = hn();
|
|
1494
|
+
class pn {
|
|
1492
1495
|
constructor() {
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1496
|
+
G(this, "drawingManagerData", {});
|
|
1497
|
+
G(this, "_oldDrawingManagerData", {});
|
|
1498
|
+
G(this, "_focusDrawings", []);
|
|
1499
|
+
G(this, "_remove$", new be());
|
|
1500
|
+
G(this, "remove$", this._remove$.asObservable());
|
|
1501
|
+
G(this, "_add$", new be());
|
|
1502
|
+
G(this, "add$", this._add$.asObservable());
|
|
1503
|
+
G(this, "_update$", new be());
|
|
1504
|
+
G(this, "update$", this._update$.asObservable());
|
|
1505
|
+
G(this, "_order$", new be());
|
|
1506
|
+
G(this, "order$", this._order$.asObservable());
|
|
1507
|
+
G(this, "_group$", new be());
|
|
1508
|
+
G(this, "group$", this._group$.asObservable());
|
|
1509
|
+
G(this, "_ungroup$", new be());
|
|
1510
|
+
G(this, "ungroup$", this._ungroup$.asObservable());
|
|
1511
|
+
G(this, "_refreshTransform$", new be());
|
|
1512
|
+
G(this, "refreshTransform$", this._refreshTransform$.asObservable());
|
|
1513
|
+
G(this, "_visible$", new be());
|
|
1514
|
+
G(this, "visible$", this._visible$.asObservable());
|
|
1512
1515
|
// private readonly _externalUpdate$ = new Subject<T[]>();
|
|
1513
1516
|
// readonly externalUpdate$ = this._externalUpdate$.asObservable();
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1517
|
+
G(this, "_focus$", new be());
|
|
1518
|
+
G(this, "focus$", this._focus$.asObservable());
|
|
1519
|
+
G(this, "_featurePluginUpdate$", new be());
|
|
1520
|
+
G(this, "featurePluginUpdate$", this._featurePluginUpdate$.asObservable());
|
|
1521
|
+
G(this, "_featurePluginAdd$", new be());
|
|
1522
|
+
G(this, "featurePluginAdd$", this._featurePluginAdd$.asObservable());
|
|
1523
|
+
G(this, "_featurePluginRemove$", new be());
|
|
1524
|
+
G(this, "featurePluginRemove$", this._featurePluginRemove$.asObservable());
|
|
1525
|
+
G(this, "_featurePluginOrderUpdate$", new be());
|
|
1526
|
+
G(this, "featurePluginOrderUpdate$", this._featurePluginOrderUpdate$.asObservable());
|
|
1527
|
+
G(this, "_featurePluginGroupUpdate$", new be());
|
|
1528
|
+
G(this, "featurePluginGroupUpdate$", this._featurePluginGroupUpdate$.asObservable());
|
|
1529
|
+
G(this, "_featurePluginUngroupUpdate$", new be());
|
|
1530
|
+
G(this, "featurePluginUngroupUpdate$", this._featurePluginUngroupUpdate$.asObservable());
|
|
1531
|
+
G(this, "_visible", !0);
|
|
1532
|
+
G(this, "_editable", !0);
|
|
1530
1533
|
}
|
|
1531
1534
|
dispose() {
|
|
1532
1535
|
this._remove$.complete(), this._add$.complete(), this._update$.complete(), this._order$.complete(), this._focus$.complete(), this._featurePluginUpdate$.complete(), this._featurePluginAdd$.complete(), this._featurePluginRemove$.complete(), this._featurePluginOrderUpdate$.complete(), this.drawingManagerData = {}, this._oldDrawingManagerData = {};
|
|
@@ -1580,8 +1583,8 @@ class dn {
|
|
|
1580
1583
|
getBatchAddOp(e) {
|
|
1581
1584
|
const t = [], n = [], r = [];
|
|
1582
1585
|
e.forEach((B) => {
|
|
1583
|
-
const { op:
|
|
1584
|
-
t.push({ unitId: B.unitId, subUnitId: B.subUnitId, drawingId: B.drawingId }), n.push(
|
|
1586
|
+
const { op: m, invertOp: s } = this._addByParam(B);
|
|
1587
|
+
t.push({ unitId: B.unitId, subUnitId: B.subUnitId, drawingId: B.drawingId }), n.push(m), r.push(s);
|
|
1585
1588
|
});
|
|
1586
1589
|
const u = n.reduce(V.type.compose, null), o = r.reduce(V.type.compose, null), { unitId: l, subUnitId: E } = e[0];
|
|
1587
1590
|
return { undo: o, redo: u, unitId: l, subUnitId: E, objects: t };
|
|
@@ -1589,8 +1592,8 @@ class dn {
|
|
|
1589
1592
|
getBatchRemoveOp(e) {
|
|
1590
1593
|
const t = [], n = [];
|
|
1591
1594
|
e.forEach((E) => {
|
|
1592
|
-
const { op: B, invertOp:
|
|
1593
|
-
t.unshift(B), n.push(
|
|
1595
|
+
const { op: B, invertOp: m } = this._removeByParam(E);
|
|
1596
|
+
t.unshift(B), n.push(m);
|
|
1594
1597
|
});
|
|
1595
1598
|
const r = t.reduce(V.type.compose, null), u = n.reduce(V.type.compose, null), { unitId: o, subUnitId: l } = e[0];
|
|
1596
1599
|
return { undo: u, redo: r, unitId: o, subUnitId: l, objects: e };
|
|
@@ -1598,8 +1601,8 @@ class dn {
|
|
|
1598
1601
|
getBatchUpdateOp(e) {
|
|
1599
1602
|
const t = [], n = [], r = [];
|
|
1600
1603
|
e.forEach((B) => {
|
|
1601
|
-
const { op:
|
|
1602
|
-
t.push({ unitId: B.unitId, subUnitId: B.subUnitId, drawingId: B.drawingId }), n.push(
|
|
1604
|
+
const { op: m, invertOp: s } = this._updateByParam(B);
|
|
1605
|
+
t.push({ unitId: B.unitId, subUnitId: B.subUnitId, drawingId: B.drawingId }), n.push(m), r.push(s);
|
|
1603
1606
|
});
|
|
1604
1607
|
const u = n.reduce(V.type.compose, null), o = r.reduce(V.type.compose, null), { unitId: l, subUnitId: E } = e[0];
|
|
1605
1608
|
return { undo: o, redo: u, unitId: l, subUnitId: E, objects: t };
|
|
@@ -1658,9 +1661,9 @@ class dn {
|
|
|
1658
1661
|
);
|
|
1659
1662
|
let E = Number.NEGATIVE_INFINITY;
|
|
1660
1663
|
return n.forEach((B) => {
|
|
1661
|
-
const { unitId:
|
|
1664
|
+
const { unitId: m, subUnitId: s, drawingId: c } = B, h = this._hasDrawingOrder({ unitId: m, subUnitId: s, drawingId: c });
|
|
1662
1665
|
E = Math.max(E, h), l.push(
|
|
1663
|
-
...this._getUpdateParamCompareOp(B, this.getDrawingByParam({ unitId:
|
|
1666
|
+
...this._getUpdateParamCompareOp(B, this.getDrawingByParam({ unitId: m, subUnitId: s, drawingId: c }))
|
|
1664
1667
|
);
|
|
1665
1668
|
}), E === Number.NEGATIVE_INFINITY && (E = this._getDrawingOrder(r, u).length), l.push(
|
|
1666
1669
|
V.insertOp([r, u, "order", E], o)
|
|
@@ -1669,9 +1672,9 @@ class dn {
|
|
|
1669
1672
|
_getUngroupDrawingOp(e) {
|
|
1670
1673
|
const { parent: t, children: n } = e, { unitId: r, subUnitId: u, drawingId: o } = t, l = [];
|
|
1671
1674
|
return n.forEach((E) => {
|
|
1672
|
-
const { unitId: B, subUnitId:
|
|
1675
|
+
const { unitId: B, subUnitId: m, drawingId: s } = E;
|
|
1673
1676
|
l.push(
|
|
1674
|
-
...this._getUpdateParamCompareOp(E, this.getDrawingByParam({ unitId: B, subUnitId:
|
|
1677
|
+
...this._getUpdateParamCompareOp(E, this.getDrawingByParam({ unitId: B, subUnitId: m, drawingId: s }))
|
|
1675
1678
|
);
|
|
1676
1679
|
}), l.push(
|
|
1677
1680
|
V.removeOp([r, u, "data", o], !0)
|
|
@@ -1762,8 +1765,8 @@ class dn {
|
|
|
1762
1765
|
}
|
|
1763
1766
|
getForwardDrawingsOp(e) {
|
|
1764
1767
|
const { unitId: t, subUnitId: n, drawingIds: r } = e, u = [], o = this.getDrawingOrder(t, n), l = [...r];
|
|
1765
|
-
r.forEach((
|
|
1766
|
-
const s = this._hasDrawingOrder({ unitId: t, subUnitId: n, drawingId:
|
|
1768
|
+
r.forEach((m) => {
|
|
1769
|
+
const s = this._hasDrawingOrder({ unitId: t, subUnitId: n, drawingId: m });
|
|
1767
1770
|
if (s === -1 || s === o.length - 1)
|
|
1768
1771
|
return;
|
|
1769
1772
|
const c = V.moveOp([t, n, "order", s], [t, n, "order", s + 1]);
|
|
@@ -1774,8 +1777,8 @@ class dn {
|
|
|
1774
1777
|
}
|
|
1775
1778
|
getBackwardDrawingOp(e) {
|
|
1776
1779
|
const { unitId: t, subUnitId: n, drawingIds: r } = e, u = [], o = this.getDrawingOrder(t, n), l = [...r];
|
|
1777
|
-
r.forEach((
|
|
1778
|
-
const s = this._hasDrawingOrder({ unitId: t, subUnitId: n, drawingId:
|
|
1780
|
+
r.forEach((m) => {
|
|
1781
|
+
const s = this._hasDrawingOrder({ unitId: t, subUnitId: n, drawingId: m });
|
|
1779
1782
|
if (s === -1 || s === 0)
|
|
1780
1783
|
return;
|
|
1781
1784
|
const c = V.moveOp([t, n, "order", s], [t, n, "order", s - 1]);
|
|
@@ -1809,7 +1812,7 @@ class dn {
|
|
|
1809
1812
|
return n.map((u) => {
|
|
1810
1813
|
const o = this._hasDrawingOrder({ unitId: e, subUnitId: t, drawingId: u });
|
|
1811
1814
|
return { drawingId: u, zIndex: o };
|
|
1812
|
-
}).sort(r === !1 ?
|
|
1815
|
+
}).sort(r === !1 ? Gt : qt);
|
|
1813
1816
|
}
|
|
1814
1817
|
_hasDrawingOrder(e) {
|
|
1815
1818
|
if (e == null)
|
|
@@ -1897,39 +1900,39 @@ class dn {
|
|
|
1897
1900
|
this._editable = e;
|
|
1898
1901
|
}
|
|
1899
1902
|
}
|
|
1900
|
-
class
|
|
1903
|
+
class gn extends pn {
|
|
1901
1904
|
}
|
|
1902
|
-
class
|
|
1905
|
+
class yn {
|
|
1903
1906
|
constructor() {
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1907
|
+
G(this, "_waitCount", 0);
|
|
1908
|
+
G(this, "_change$", new be());
|
|
1909
|
+
G(this, "change$", this._change$);
|
|
1910
|
+
G(this, "_imageSourceCache", /* @__PURE__ */ new Map());
|
|
1908
1911
|
}
|
|
1909
1912
|
setWaitCount(e) {
|
|
1910
1913
|
this._waitCount = e, this._change$.next(e);
|
|
1911
1914
|
}
|
|
1912
1915
|
getImageSourceCache(e, t) {
|
|
1913
|
-
if (t ===
|
|
1916
|
+
if (t === lt.BASE64) {
|
|
1914
1917
|
const n = new Image();
|
|
1915
1918
|
return n.src = e, n;
|
|
1916
1919
|
}
|
|
1917
1920
|
return this._imageSourceCache.get(e);
|
|
1918
1921
|
}
|
|
1919
1922
|
addImageSourceCache(e, t, n) {
|
|
1920
|
-
t ===
|
|
1923
|
+
t === lt.BASE64 || n == null || this._imageSourceCache.set(e, n);
|
|
1921
1924
|
}
|
|
1922
1925
|
async getImage(e) {
|
|
1923
1926
|
return Promise.resolve(e);
|
|
1924
1927
|
}
|
|
1925
1928
|
async saveImage(e) {
|
|
1926
1929
|
return new Promise((t, n) => {
|
|
1927
|
-
if (!
|
|
1928
|
-
n(new Error(
|
|
1930
|
+
if (!nn.includes(e.type)) {
|
|
1931
|
+
n(new Error(tt.ERROR_IMAGE_TYPE)), this._decreaseWaiting();
|
|
1929
1932
|
return;
|
|
1930
1933
|
}
|
|
1931
|
-
if (e.size >
|
|
1932
|
-
n(new Error(
|
|
1934
|
+
if (e.size > tn) {
|
|
1935
|
+
n(new Error(tt.ERROR_EXCEED_SIZE)), this._decreaseWaiting();
|
|
1933
1936
|
return;
|
|
1934
1937
|
}
|
|
1935
1938
|
const r = new FileReader();
|
|
@@ -1937,16 +1940,16 @@ class hn {
|
|
|
1937
1940
|
var E;
|
|
1938
1941
|
const o = (E = u.target) == null ? void 0 : E.result;
|
|
1939
1942
|
if (o == null) {
|
|
1940
|
-
n(new Error(
|
|
1943
|
+
n(new Error(tt.ERROR_IMAGE)), this._decreaseWaiting();
|
|
1941
1944
|
return;
|
|
1942
1945
|
}
|
|
1943
|
-
const l =
|
|
1946
|
+
const l = $t(6);
|
|
1944
1947
|
t({
|
|
1945
1948
|
imageId: l,
|
|
1946
|
-
imageSourceType:
|
|
1949
|
+
imageSourceType: lt.BASE64,
|
|
1947
1950
|
source: o,
|
|
1948
1951
|
base64Cache: o,
|
|
1949
|
-
status:
|
|
1952
|
+
status: tt.SUCCUSS
|
|
1950
1953
|
}), this._decreaseWaiting();
|
|
1951
1954
|
};
|
|
1952
1955
|
});
|
|
@@ -1955,13 +1958,13 @@ class hn {
|
|
|
1955
1958
|
this._waitCount -= 1, this._change$.next(this._waitCount);
|
|
1956
1959
|
}
|
|
1957
1960
|
}
|
|
1958
|
-
class
|
|
1961
|
+
class mn extends Kt {
|
|
1959
1962
|
constructor() {
|
|
1960
1963
|
super(...arguments);
|
|
1961
|
-
|
|
1964
|
+
G(this, "_urlImageDownloader", null);
|
|
1962
1965
|
}
|
|
1963
1966
|
registerURLImageDownloader(t) {
|
|
1964
|
-
return this._urlImageDownloader = t,
|
|
1967
|
+
return this._urlImageDownloader = t, Ft(() => {
|
|
1965
1968
|
this._urlImageDownloader = null;
|
|
1966
1969
|
});
|
|
1967
1970
|
}
|
|
@@ -1985,49 +1988,47 @@ class pn extends $t {
|
|
|
1985
1988
|
return await (await fetch(t)).blob();
|
|
1986
1989
|
}
|
|
1987
1990
|
}
|
|
1988
|
-
var
|
|
1989
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1991
|
+
var _n = Object.getOwnPropertyDescriptor, vn = (a, e, t, n) => {
|
|
1992
|
+
for (var r = n > 1 ? void 0 : n ? _n(e, t) : e, u = a.length - 1, o; u >= 0; u--)
|
|
1990
1993
|
(o = a[u]) && (r = o(r) || r);
|
|
1991
1994
|
return r;
|
|
1992
|
-
},
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
let St = (ft = class extends Xt {
|
|
1996
|
-
constructor(a = mt, e, t, n) {
|
|
1995
|
+
}, ft = (a, e) => (t, n) => e(t, n, a), Qe;
|
|
1996
|
+
let St = (Qe = class extends Jt {
|
|
1997
|
+
constructor(a = vt, e, t, n) {
|
|
1997
1998
|
super(), this._config = a, this._injector = e, this._configService = t, this._commandService = n;
|
|
1998
|
-
const { ...r } =
|
|
1999
|
+
const { ...r } = Yt(
|
|
1999
2000
|
{},
|
|
2000
|
-
|
|
2001
|
+
vt,
|
|
2001
2002
|
this._config
|
|
2002
2003
|
);
|
|
2003
|
-
this._configService.setConfig(
|
|
2004
|
+
this._configService.setConfig(an, r);
|
|
2004
2005
|
}
|
|
2005
2006
|
onStarting() {
|
|
2006
2007
|
this._initCommands(), this._initDependencies();
|
|
2007
2008
|
}
|
|
2008
2009
|
_initDependencies() {
|
|
2009
2010
|
var t;
|
|
2010
|
-
|
|
2011
|
-
[
|
|
2012
|
-
[
|
|
2013
|
-
[
|
|
2011
|
+
Zt([
|
|
2012
|
+
[Qt, { useClass: yn }],
|
|
2013
|
+
[en, { useClass: mn }],
|
|
2014
|
+
[Ut, { useClass: gn }]
|
|
2014
2015
|
], (t = this._config) == null ? void 0 : t.override).forEach((n) => this._injector.add(n));
|
|
2015
2016
|
}
|
|
2016
2017
|
_initCommands() {
|
|
2017
2018
|
[
|
|
2018
|
-
|
|
2019
|
+
rn
|
|
2019
2020
|
].forEach((a) => this.disposeWithMe(this._commandService.registerCommand(a)));
|
|
2020
2021
|
}
|
|
2021
|
-
},
|
|
2022
|
-
St =
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2022
|
+
}, G(Qe, "pluginName", "UNIVER_DRAWING_PLUGIN"), G(Qe, "packageName", _t.name), G(Qe, "version", _t.version), Qe);
|
|
2023
|
+
St = vn([
|
|
2024
|
+
ft(1, Vt(Ht)),
|
|
2025
|
+
ft(2, zt),
|
|
2026
|
+
ft(3, Xt)
|
|
2026
2027
|
], St);
|
|
2027
|
-
function
|
|
2028
|
+
function Dn({ unitId: a, subUnitId: e, drawingId: t }, n) {
|
|
2028
2029
|
return typeof n == "number" ? `${a}#-#${e}#-#${t}#-#${n}` : `${a}#-#${e}#-#${t}`;
|
|
2029
2030
|
}
|
|
2030
|
-
const
|
|
2031
|
+
const Pn = async (a) => new Promise((e, t) => {
|
|
2031
2032
|
const n = new Image();
|
|
2032
2033
|
n.src = a, n.onload = () => {
|
|
2033
2034
|
e({
|
|
@@ -2040,21 +2041,21 @@ const En = async (a) => new Promise((e, t) => {
|
|
|
2040
2041
|
};
|
|
2041
2042
|
});
|
|
2042
2043
|
export {
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2044
|
+
nn as DRAWING_IMAGE_ALLOW_IMAGE_LIST,
|
|
2045
|
+
tn as DRAWING_IMAGE_ALLOW_SIZE,
|
|
2046
|
+
En as DRAWING_IMAGE_COUNT_LIMIT,
|
|
2047
|
+
Cn as DRAWING_IMAGE_HEIGHT_LIMIT,
|
|
2048
|
+
In as DRAWING_IMAGE_WIDTH_LIMIT,
|
|
2049
|
+
gn as DrawingManagerService,
|
|
2050
|
+
Ut as IDrawingManagerService,
|
|
2051
|
+
Sn as IImageIoService,
|
|
2052
|
+
yn as ImageIoService,
|
|
2053
|
+
Un as ImageSourceType,
|
|
2054
|
+
An as ImageUploadStatusType,
|
|
2055
|
+
rn as SetDrawingSelectedOperation,
|
|
2056
|
+
mn as URLImageService,
|
|
2057
|
+
pn as UnitDrawingService,
|
|
2057
2058
|
St as UniverDrawingPlugin,
|
|
2058
|
-
|
|
2059
|
-
|
|
2059
|
+
Dn as getDrawingShapeKeyByDrawingSearch,
|
|
2060
|
+
Pn as getImageSize
|
|
2060
2061
|
};
|