playhtml 2.0.13 → 2.0.15
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/CHANGELOG.md +2 -1
- package/dist/playhtml.cjs.js +6 -6
- package/dist/playhtml.es.js +367 -364
- package/package.json +4 -3
package/dist/playhtml.es.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
var gr = Object.defineProperty;
|
|
2
2
|
var pr = (n, t, e) => t in n ? gr(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
-
var y = (n, t, e) => (pr(n, typeof t != "symbol" ? t + "" : t, e), e),
|
|
3
|
+
var y = (n, t, e) => (pr(n, typeof t != "symbol" ? t + "" : t, e), e), Sn = (n, t, e) => {
|
|
4
4
|
if (!t.has(n))
|
|
5
5
|
throw TypeError("Cannot " + e);
|
|
6
6
|
};
|
|
7
|
-
var Wt = (n, t, e) => (
|
|
7
|
+
var Wt = (n, t, e) => (Sn(n, t, "read from private field"), e ? e.call(n) : t.get(n)), Dn = (n, t, e) => {
|
|
8
8
|
if (t.has(n))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
10
|
t instanceof WeakSet ? t.add(n) : t.set(n, e);
|
|
11
|
-
},
|
|
12
|
-
var Gt = 1e6, wr = "y-pk-batch",
|
|
11
|
+
}, En = (n, t, e, s) => (Sn(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e);
|
|
12
|
+
var Gt = 1e6, wr = "y-pk-batch", Cn = !1, mr = (n, t) => {
|
|
13
13
|
if (n.byteLength <= Gt) {
|
|
14
14
|
t(n);
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
Cn || (console.warn(
|
|
18
18
|
"[y-partykit]",
|
|
19
19
|
"The Y.js update size exceeds 1MB, which is the maximum size for an individual update. The update will be split into chunks. This is an experimental feature.",
|
|
20
20
|
`Message size: ${(n.byteLength / 1e3 / 1e3).toFixed(1)}MB`
|
|
21
|
-
),
|
|
21
|
+
), Cn = !0);
|
|
22
22
|
const e = (Date.now() + Math.random()).toString(36).substring(10), s = Math.ceil(n.byteLength / Gt);
|
|
23
23
|
t(
|
|
24
|
-
|
|
24
|
+
An({
|
|
25
25
|
id: e,
|
|
26
26
|
type: "start",
|
|
27
27
|
size: n.byteLength,
|
|
@@ -34,7 +34,7 @@ var Gt = 1e6, wr = "y-pk-batch", An = !1, mr = (n, t) => {
|
|
|
34
34
|
t(l), i += 1, r += l.byteLength;
|
|
35
35
|
}
|
|
36
36
|
t(
|
|
37
|
-
|
|
37
|
+
An({
|
|
38
38
|
id: e,
|
|
39
39
|
type: "end",
|
|
40
40
|
size: r,
|
|
@@ -42,11 +42,11 @@ var Gt = 1e6, wr = "y-pk-batch", An = !1, mr = (n, t) => {
|
|
|
42
42
|
})
|
|
43
43
|
);
|
|
44
44
|
};
|
|
45
|
-
function
|
|
45
|
+
function An(n) {
|
|
46
46
|
return `${wr}#${JSON.stringify(n)}`;
|
|
47
47
|
}
|
|
48
|
-
const
|
|
49
|
-
const t =
|
|
48
|
+
const R = () => /* @__PURE__ */ new Map(), Ne = (n) => {
|
|
49
|
+
const t = R();
|
|
50
50
|
return n.forEach((e, s) => {
|
|
51
51
|
t.set(s, e);
|
|
52
52
|
}), t;
|
|
@@ -63,13 +63,13 @@ const O = () => /* @__PURE__ */ new Map(), Be = (n) => {
|
|
|
63
63
|
if (t(s, e))
|
|
64
64
|
return !0;
|
|
65
65
|
return !1;
|
|
66
|
-
}, lt = () => /* @__PURE__ */ new Set(),
|
|
66
|
+
}, lt = () => /* @__PURE__ */ new Set(), Ee = (n) => n[n.length - 1], kr = (n, t) => {
|
|
67
67
|
for (let e = 0; e < t.length; e++)
|
|
68
68
|
n.push(t[e]);
|
|
69
69
|
}, tt = Array.from, _r = Array.isArray;
|
|
70
70
|
class fe {
|
|
71
71
|
constructor() {
|
|
72
|
-
this._observers =
|
|
72
|
+
this._observers = R();
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* @param {N} name
|
|
@@ -106,13 +106,13 @@ class fe {
|
|
|
106
106
|
* @param {Array<any>} args The arguments that are applied to the event listener.
|
|
107
107
|
*/
|
|
108
108
|
emit(t, e) {
|
|
109
|
-
return tt((this._observers.get(t) ||
|
|
109
|
+
return tt((this._observers.get(t) || R()).values()).forEach((s) => s(...e));
|
|
110
110
|
}
|
|
111
111
|
destroy() {
|
|
112
|
-
this._observers =
|
|
112
|
+
this._observers = R();
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
const Y = Math.floor, te = Math.abs, Pe = (n, t) => n < t ? n : t, ft = (n, t) => n > t ? n : t, Sr = Math.pow,
|
|
115
|
+
const Y = Math.floor, te = Math.abs, Pe = (n, t) => n < t ? n : t, ft = (n, t) => n > t ? n : t, Sr = Math.pow, ts = (n) => n !== 0 ? n < 0 : 1 / n < 0, Dr = String.fromCharCode, Er = (n) => n.toLowerCase(), Cr = /^\s*/g, Ar = (n) => n.replace(Cr, ""), Lr = /([A-Z])/g, Ln = (n, t) => Ar(n.replace(Lr, (e) => `${t}${Er(e)}`)), Ir = (n) => {
|
|
116
116
|
const t = unescape(encodeURIComponent(n)), e = t.length, s = new Uint8Array(e);
|
|
117
117
|
for (let r = 0; r < e; r++)
|
|
118
118
|
s[r] = /** @type {number} */
|
|
@@ -124,7 +124,7 @@ const Y = Math.floor, te = Math.abs, Pe = (n, t) => n < t ? n : t, ft = (n, t) =
|
|
|
124
124
|
), Mr = (n) => Tt.encode(n), vr = Tt ? Mr : Ir;
|
|
125
125
|
let vt = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", { fatal: !0, ignoreBOM: !0 });
|
|
126
126
|
vt && vt.decode(new Uint8Array()).length === 1 && (vt = null);
|
|
127
|
-
const
|
|
127
|
+
const In = (n) => n === void 0 ? null : n;
|
|
128
128
|
class xr {
|
|
129
129
|
constructor() {
|
|
130
130
|
this.map = /* @__PURE__ */ new Map();
|
|
@@ -143,12 +143,12 @@ class xr {
|
|
|
143
143
|
return this.map.get(t);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
let
|
|
146
|
+
let es = new xr(), qe = !0;
|
|
147
147
|
try {
|
|
148
|
-
typeof localStorage < "u" && (
|
|
148
|
+
typeof localStorage < "u" && (es = localStorage, qe = !1);
|
|
149
149
|
} catch {
|
|
150
150
|
}
|
|
151
|
-
const
|
|
151
|
+
const ns = es, Ur = (n) => qe || addEventListener(
|
|
152
152
|
"storage",
|
|
153
153
|
/** @type {any} */
|
|
154
154
|
n
|
|
@@ -173,7 +173,7 @@ const ss = ns, Ur = (n) => qe || addEventListener(
|
|
|
173
173
|
if (!t(n[e], e))
|
|
174
174
|
return !1;
|
|
175
175
|
return !0;
|
|
176
|
-
},
|
|
176
|
+
}, ss = (n, t) => Object.prototype.hasOwnProperty.call(n, t), Hr = (n, t) => n === t || re(n) === re(t) && Vr(n, (e, s) => (e !== void 0 || ss(t, s)) && t[s] === e), Ze = (n, t, e = 0) => {
|
|
177
177
|
try {
|
|
178
178
|
for (; e < n.length; e++)
|
|
179
179
|
n[e](...t);
|
|
@@ -218,7 +218,7 @@ const ss = ns, Ur = (n) => qe || addEventListener(
|
|
|
218
218
|
if (re(n) !== re(t))
|
|
219
219
|
return !1;
|
|
220
220
|
for (const e in n)
|
|
221
|
-
if (!
|
|
221
|
+
if (!ss(n, e) || !xt(n[e], t[e]))
|
|
222
222
|
return !1;
|
|
223
223
|
break;
|
|
224
224
|
case Array:
|
|
@@ -232,34 +232,34 @@ const ss = ns, Ur = (n) => qe || addEventListener(
|
|
|
232
232
|
return !1;
|
|
233
233
|
}
|
|
234
234
|
return !0;
|
|
235
|
-
}, Kr = (n, t) => t.includes(n), _t = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name),
|
|
236
|
-
let
|
|
235
|
+
}, Kr = (n, t) => t.includes(n), _t = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name), rs = typeof window < "u" && typeof document < "u" && !_t;
|
|
236
|
+
let B;
|
|
237
237
|
const zr = () => {
|
|
238
|
-
if (
|
|
238
|
+
if (B === void 0)
|
|
239
239
|
if (_t) {
|
|
240
|
-
|
|
240
|
+
B = R();
|
|
241
241
|
const n = process.argv;
|
|
242
242
|
let t = null;
|
|
243
243
|
for (let e = 0; e < n.length; e++) {
|
|
244
244
|
const s = n[e];
|
|
245
|
-
s[0] === "-" ? (t !== null &&
|
|
245
|
+
s[0] === "-" ? (t !== null && B.set(t, ""), t = s) : t !== null && (B.set(t, s), t = null);
|
|
246
246
|
}
|
|
247
|
-
t !== null &&
|
|
247
|
+
t !== null && B.set(t, "");
|
|
248
248
|
} else
|
|
249
|
-
typeof location == "object" ? (
|
|
249
|
+
typeof location == "object" ? (B = R(), (location.search || "?").slice(1).split("&").forEach((n) => {
|
|
250
250
|
if (n.length !== 0) {
|
|
251
251
|
const [t, e] = n.split("=");
|
|
252
|
-
|
|
252
|
+
B.set(`--${Ln(t, "-")}`, e), B.set(`-${Ln(t, "-")}`, e);
|
|
253
253
|
}
|
|
254
|
-
})) :
|
|
255
|
-
return
|
|
256
|
-
},
|
|
254
|
+
})) : B = R();
|
|
255
|
+
return B;
|
|
256
|
+
}, Fe = (n) => zr().has(n), Ve = (n) => In(_t ? process.env[n.toUpperCase()] : ns.getItem(n)), Yr = (n) => Fe("--" + n) || Ve(n) !== null;
|
|
257
257
|
Yr("production");
|
|
258
|
-
const
|
|
258
|
+
const Mn = _t && Kr(process.env.FORCE_COLOR, ["true", "1", "2"]), Xr = !Fe("no-colors") && (!_t || process.stdout.isTTY || Mn) && (!_t || Fe("color") || Mn || Ve("COLORTERM") !== null || (Ve("TERM") || "").includes("color")), vn = 1, xn = 2, Ce = 4, Ae = 8, Ot = 32, z = 64, x = 128, ge = 31, He = 63, it = 127, Jr = 2147483647, is = Number.MAX_SAFE_INTEGER, Wr = Number.isInteger || ((n) => typeof n == "number" && isFinite(n) && Y(n) === n), X = (n) => new Error(n), N = () => {
|
|
259
259
|
throw X("Method unimplemented");
|
|
260
260
|
}, V = () => {
|
|
261
261
|
throw X("Unexpected case");
|
|
262
|
-
},
|
|
262
|
+
}, os = X("Unexpected end of array"), ls = X("Integer out of Range");
|
|
263
263
|
class pe {
|
|
264
264
|
/**
|
|
265
265
|
* @param {Uint8Array} uint8Array Binary data to decode
|
|
@@ -278,12 +278,12 @@ const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, Pr = (n, t) =>
|
|
|
278
278
|
const r = n.arr[n.pos++];
|
|
279
279
|
if (t = t + (r & it) * e, e *= 128, r < x)
|
|
280
280
|
return t;
|
|
281
|
-
if (t >
|
|
282
|
-
throw
|
|
281
|
+
if (t > is)
|
|
282
|
+
throw ls;
|
|
283
283
|
}
|
|
284
|
-
throw
|
|
284
|
+
throw os;
|
|
285
285
|
}, Qe = (n) => {
|
|
286
|
-
let t = n.arr[n.pos++], e = t &
|
|
286
|
+
let t = n.arr[n.pos++], e = t & He, s = 64;
|
|
287
287
|
const r = (t & z) > 0 ? -1 : 1;
|
|
288
288
|
if (!(t & x))
|
|
289
289
|
return r * e;
|
|
@@ -291,10 +291,10 @@ const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, Pr = (n, t) =>
|
|
|
291
291
|
for (; n.pos < i; ) {
|
|
292
292
|
if (t = n.arr[n.pos++], e = e + (t & it) * s, s *= 128, t < x)
|
|
293
293
|
return r * e;
|
|
294
|
-
if (e >
|
|
295
|
-
throw
|
|
294
|
+
if (e > is)
|
|
295
|
+
throw ls;
|
|
296
296
|
}
|
|
297
|
-
throw
|
|
297
|
+
throw os;
|
|
298
298
|
}, qr = (n) => {
|
|
299
299
|
let t = m(n);
|
|
300
300
|
if (t === 0)
|
|
@@ -361,7 +361,7 @@ const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, Pr = (n, t) =>
|
|
|
361
361
|
M
|
|
362
362
|
// CASE 116: Uint8Array
|
|
363
363
|
], Rt = (n) => ni[127 - St(n)](n);
|
|
364
|
-
class
|
|
364
|
+
class Un extends pe {
|
|
365
365
|
/**
|
|
366
366
|
* @param {Uint8Array} uint8Array
|
|
367
367
|
* @param {function(Decoder):T} reader
|
|
@@ -384,14 +384,14 @@ class ee extends pe {
|
|
|
384
384
|
read() {
|
|
385
385
|
if (this.count === 0) {
|
|
386
386
|
this.s = Qe(this);
|
|
387
|
-
const t =
|
|
387
|
+
const t = ts(this.s);
|
|
388
388
|
this.count = 1, t && (this.s = -this.s, this.count = m(this) + 2);
|
|
389
389
|
}
|
|
390
390
|
return this.count--, /** @type {number} */
|
|
391
391
|
this.s;
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
|
-
class
|
|
394
|
+
class Le extends pe {
|
|
395
395
|
/**
|
|
396
396
|
* @param {Uint8Array} uint8Array
|
|
397
397
|
*/
|
|
@@ -424,21 +424,21 @@ class si {
|
|
|
424
424
|
return this.spos = t, e;
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
-
const
|
|
427
|
+
const cs = (n) => new Uint8Array(n), en = (n, t, e) => new Uint8Array(n, t, e), ri = (n) => new Uint8Array(n), ii = (n) => {
|
|
428
428
|
let t = "";
|
|
429
429
|
for (let e = 0; e < n.byteLength; e++)
|
|
430
430
|
t += Dr(n[e]);
|
|
431
431
|
return btoa(t);
|
|
432
432
|
}, oi = (n) => Buffer.from(n.buffer, n.byteOffset, n.byteLength).toString("base64"), li = (n) => {
|
|
433
|
-
const t = atob(n), e =
|
|
433
|
+
const t = atob(n), e = cs(t.length);
|
|
434
434
|
for (let s = 0; s < t.length; s++)
|
|
435
435
|
e[s] = t.charCodeAt(s);
|
|
436
436
|
return e;
|
|
437
437
|
}, ci = (n) => {
|
|
438
438
|
const t = Buffer.from(n, "base64");
|
|
439
439
|
return new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
|
|
440
|
-
}, ai =
|
|
441
|
-
const t =
|
|
440
|
+
}, ai = rs ? ii : oi, hi = rs ? li : ci, ui = (n) => {
|
|
441
|
+
const t = cs(n.byteLength);
|
|
442
442
|
return t.set(n), t;
|
|
443
443
|
};
|
|
444
444
|
class $t {
|
|
@@ -465,20 +465,20 @@ const v = () => new $t(), nn = (n) => {
|
|
|
465
465
|
}, A = (n, t) => {
|
|
466
466
|
const e = n.cbuf.length;
|
|
467
467
|
n.cpos === e && (n.bufs.push(n.cbuf), n.cbuf = new Uint8Array(e * 2), n.cpos = 0), n.cbuf[n.cpos++] = t;
|
|
468
|
-
},
|
|
468
|
+
}, $e = A, p = (n, t) => {
|
|
469
469
|
for (; t > it; )
|
|
470
470
|
A(n, x | it & t), t = Y(t / 128);
|
|
471
471
|
A(n, it & t);
|
|
472
472
|
}, sn = (n, t) => {
|
|
473
|
-
const e =
|
|
474
|
-
for (e && (t = -t), A(n, (t >
|
|
473
|
+
const e = ts(t);
|
|
474
|
+
for (e && (t = -t), A(n, (t > He ? x : 0) | (e ? z : 0) | He & t), t = Y(t / 64); t > 0; )
|
|
475
475
|
A(n, (t > it ? x : 0) | it & t), t = Y(t / 128);
|
|
476
|
-
},
|
|
476
|
+
}, je = new Uint8Array(3e4), fi = je.length / 3, gi = (n, t) => {
|
|
477
477
|
if (t.length < fi) {
|
|
478
|
-
const e = Tt.encodeInto(t,
|
|
478
|
+
const e = Tt.encodeInto(t, je).written || 0;
|
|
479
479
|
p(n, e);
|
|
480
480
|
for (let s = 0; s < e; s++)
|
|
481
|
-
A(n,
|
|
481
|
+
A(n, je[s]);
|
|
482
482
|
} else
|
|
483
483
|
D(n, vr(t));
|
|
484
484
|
}, pi = (n, t) => {
|
|
@@ -503,7 +503,7 @@ Tt.encodeInto ? gi : pi, we = (n, t) => {
|
|
|
503
503
|
}, wi = (n, t) => rn(n, 4).setFloat32(0, t, !1), mi = (n, t) => rn(n, 8).setFloat64(0, t, !1), yi = (n, t) => (
|
|
504
504
|
/** @type {any} */
|
|
505
505
|
rn(n, 8).setBigInt64(0, t, !1)
|
|
506
|
-
),
|
|
506
|
+
), Tn = new DataView(new ArrayBuffer(4)), bi = (n) => (Tn.setFloat32(0, n), Tn.getFloat32(0) === n), Bt = (n, t) => {
|
|
507
507
|
switch (typeof t) {
|
|
508
508
|
case "string":
|
|
509
509
|
A(n, 119), ot(n, t);
|
|
@@ -540,7 +540,7 @@ Tt.encodeInto ? gi : pi, we = (n, t) => {
|
|
|
540
540
|
A(n, 127);
|
|
541
541
|
}
|
|
542
542
|
};
|
|
543
|
-
class
|
|
543
|
+
class On extends $t {
|
|
544
544
|
/**
|
|
545
545
|
* @param {function(Encoder, T):void} writer
|
|
546
546
|
*/
|
|
@@ -554,7 +554,7 @@ class Rn extends $t {
|
|
|
554
554
|
this.s === t ? this.count++ : (this.count > 0 && p(this, this.count - 1), this.count = 1, this.w(this, t), this.s = t);
|
|
555
555
|
}
|
|
556
556
|
}
|
|
557
|
-
const
|
|
557
|
+
const Rn = (n) => {
|
|
558
558
|
n.count > 0 && (sn(n.encoder, n.count === 1 ? n.s : -n.s), n.count > 1 && p(n.encoder, n.count - 2));
|
|
559
559
|
};
|
|
560
560
|
class ne {
|
|
@@ -565,19 +565,19 @@ class ne {
|
|
|
565
565
|
* @param {number} v
|
|
566
566
|
*/
|
|
567
567
|
write(t) {
|
|
568
|
-
this.s === t ? this.count++ : (
|
|
568
|
+
this.s === t ? this.count++ : (Rn(this), this.count = 1, this.s = t);
|
|
569
569
|
}
|
|
570
570
|
toUint8Array() {
|
|
571
|
-
return
|
|
571
|
+
return Rn(this), _(this.encoder);
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
|
-
const
|
|
574
|
+
const Bn = (n) => {
|
|
575
575
|
if (n.count > 0) {
|
|
576
576
|
const t = n.diff * 2 + (n.count === 1 ? 0 : 1);
|
|
577
577
|
sn(n.encoder, t), n.count > 1 && p(n.encoder, n.count - 2);
|
|
578
578
|
}
|
|
579
579
|
};
|
|
580
|
-
class
|
|
580
|
+
class Ie {
|
|
581
581
|
constructor() {
|
|
582
582
|
this.encoder = new $t(), this.s = 0, this.count = 0, this.diff = 0;
|
|
583
583
|
}
|
|
@@ -585,10 +585,10 @@ class Le {
|
|
|
585
585
|
* @param {number} v
|
|
586
586
|
*/
|
|
587
587
|
write(t) {
|
|
588
|
-
this.diff === t - this.s ? (this.s = t, this.count++) : (
|
|
588
|
+
this.diff === t - this.s ? (this.s = t, this.count++) : (Bn(this), this.count = 1, this.diff = t - this.s, this.s = t);
|
|
589
589
|
}
|
|
590
590
|
toUint8Array() {
|
|
591
|
-
return
|
|
591
|
+
return Bn(this), _(this.encoder);
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
594
|
class ki {
|
|
@@ -606,10 +606,10 @@ class ki {
|
|
|
606
606
|
return this.sarr.push(this.s), this.s = "", ot(t, this.sarr.join("")), we(t, this.lensE.toUint8Array()), _(t);
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
|
-
const _i = crypto.getRandomValues.bind(crypto),
|
|
609
|
+
const _i = crypto.getRandomValues.bind(crypto), as = () => _i(new Uint32Array(1))[0], Si = [1e7] + -1e3 + -4e3 + -8e3 + -1e11, Di = () => Si.replace(
|
|
610
610
|
/[018]/g,
|
|
611
611
|
/** @param {number} c */
|
|
612
|
-
(n) => (n ^
|
|
612
|
+
(n) => (n ^ as() & 15 >> n / 4).toString(16)
|
|
613
613
|
), ct = Date.now, Dt = (n) => (
|
|
614
614
|
/** @type {Promise<T>} */
|
|
615
615
|
new Promise(n)
|
|
@@ -626,7 +626,7 @@ class Ei {
|
|
|
626
626
|
}
|
|
627
627
|
const K = (n, t) => new Ei(n, t);
|
|
628
628
|
typeof DOMParser < "u" && new DOMParser();
|
|
629
|
-
const Ci = (n) => yr(n, (t, e) => `${e}:${t};`).join(""), W = Symbol,
|
|
629
|
+
const Ci = (n) => yr(n, (t, e) => `${e}:${t};`).join(""), W = Symbol, hs = W(), us = W(), Ai = W(), Li = W(), Ii = W(), ds = W(), Mi = W(), fs = W(), vi = W(), xi = (n) => {
|
|
630
630
|
const t = [];
|
|
631
631
|
let e = 0;
|
|
632
632
|
for (; e < n.length; e++) {
|
|
@@ -635,18 +635,18 @@ const Ci = (n) => yr(n, (t, e) => `${e}:${t};`).join(""), W = Symbol, us = W(),
|
|
|
635
635
|
}
|
|
636
636
|
return t;
|
|
637
637
|
}, Ui = {
|
|
638
|
-
[
|
|
639
|
-
[
|
|
638
|
+
[hs]: K("font-weight", "bold"),
|
|
639
|
+
[us]: K("font-weight", "normal"),
|
|
640
640
|
[Ai]: K("color", "blue"),
|
|
641
641
|
[Ii]: K("color", "green"),
|
|
642
642
|
[Li]: K("color", "grey"),
|
|
643
|
-
[
|
|
643
|
+
[ds]: K("color", "red"),
|
|
644
644
|
[Mi]: K("color", "purple"),
|
|
645
|
-
[
|
|
645
|
+
[fs]: K("color", "orange"),
|
|
646
646
|
// not well supported in chrome when debugging node with inspector - TODO: deprecate
|
|
647
647
|
[vi]: K("color", "black")
|
|
648
648
|
}, Ti = (n) => {
|
|
649
|
-
const t = [], e = [], s =
|
|
649
|
+
const t = [], e = [], s = R();
|
|
650
650
|
let r = [], i = 0;
|
|
651
651
|
for (; i < n.length; i++) {
|
|
652
652
|
const o = n[i], l = Ui[o];
|
|
@@ -665,7 +665,7 @@ const Ci = (n) => yr(n, (t, e) => `${e}:${t};`).join(""), W = Symbol, us = W(),
|
|
|
665
665
|
return r;
|
|
666
666
|
}, Oi = Xr ? Ti : xi, Ri = (...n) => {
|
|
667
667
|
console.log(...Oi(n)), Bi.forEach((t) => t.print(n));
|
|
668
|
-
}, Bi = lt(),
|
|
668
|
+
}, Bi = lt(), gs = (n) => ({
|
|
669
669
|
/**
|
|
670
670
|
* @return {IterableIterator<T>}
|
|
671
671
|
*/
|
|
@@ -674,13 +674,13 @@ const Ci = (n) => yr(n, (t, e) => `${e}:${t};`).join(""), W = Symbol, us = W(),
|
|
|
674
674
|
},
|
|
675
675
|
// @ts-ignore
|
|
676
676
|
next: n
|
|
677
|
-
}), Ni = (n, t) =>
|
|
677
|
+
}), Ni = (n, t) => gs(() => {
|
|
678
678
|
let e;
|
|
679
679
|
do
|
|
680
680
|
e = n.next();
|
|
681
681
|
while (!e.done && !t(e.value));
|
|
682
682
|
return e;
|
|
683
|
-
}),
|
|
683
|
+
}), Me = (n, t) => gs(() => {
|
|
684
684
|
const { done: e, value: s } = n.next();
|
|
685
685
|
return { done: e, value: e ? void 0 : t(s) };
|
|
686
686
|
});
|
|
@@ -698,14 +698,14 @@ class jt {
|
|
|
698
698
|
this.clients = /* @__PURE__ */ new Map();
|
|
699
699
|
}
|
|
700
700
|
}
|
|
701
|
-
const
|
|
701
|
+
const ps = (n, t, e) => t.clients.forEach((s, r) => {
|
|
702
702
|
const i = (
|
|
703
703
|
/** @type {Array<GC|Item>} */
|
|
704
704
|
n.doc.store.clients.get(r)
|
|
705
705
|
);
|
|
706
706
|
for (let o = 0; o < s.length; o++) {
|
|
707
707
|
const l = s[o];
|
|
708
|
-
|
|
708
|
+
Ms(n, i, l.clock, l.len, e);
|
|
709
709
|
}
|
|
710
710
|
}), Fi = (n, t) => {
|
|
711
711
|
let e = 0, s = n.length - 1;
|
|
@@ -719,7 +719,7 @@ const ws = (n, t, e) => t.clients.forEach((s, r) => {
|
|
|
719
719
|
s = r - 1;
|
|
720
720
|
}
|
|
721
721
|
return null;
|
|
722
|
-
},
|
|
722
|
+
}, ws = (n, t) => {
|
|
723
723
|
const e = n.clients.get(t.client);
|
|
724
724
|
return e !== void 0 && Fi(e, t.clock) !== null;
|
|
725
725
|
}, ln = (n) => {
|
|
@@ -791,7 +791,7 @@ const ws = (n, t, e) => t.clients.forEach((s, r) => {
|
|
|
791
791
|
}
|
|
792
792
|
}
|
|
793
793
|
return t;
|
|
794
|
-
},
|
|
794
|
+
}, Nn = (n, t, e) => {
|
|
795
795
|
const s = new jt(), r = m(n.restDecoder);
|
|
796
796
|
for (let i = 0; i < r; i++) {
|
|
797
797
|
n.resetDsCurVal();
|
|
@@ -812,13 +812,13 @@ const ws = (n, t, e) => t.clients.forEach((s, r) => {
|
|
|
812
812
|
return p(i.restEncoder, 0), At(i, s), i.toUint8Array();
|
|
813
813
|
}
|
|
814
814
|
return null;
|
|
815
|
-
},
|
|
815
|
+
}, ms = as;
|
|
816
816
|
class gt extends fe {
|
|
817
817
|
/**
|
|
818
818
|
* @param {DocOpts} opts configuration
|
|
819
819
|
*/
|
|
820
820
|
constructor({ guid: t = Di(), collectionid: e = null, gc: s = !0, gcFilter: r = () => !0, meta: i = null, autoLoad: o = !1, shouldLoad: l = !0 } = {}) {
|
|
821
|
-
super(), this.gc = s, this.gcFilter = r, this.clientID =
|
|
821
|
+
super(), this.gc = s, this.gcFilter = r, this.clientID = ms(), this.guid = t, this.collectionid = e, this.share = /* @__PURE__ */ new Map(), this.store = new Ls(), this._transaction = null, this._transactionCleanups = [], this.subdocs = /* @__PURE__ */ new Set(), this._item = null, this.shouldLoad = l, this.autoLoad = o, this.meta = i, this.isLoaded = !1, this.isSynced = !1, this.whenLoaded = Dt((a) => {
|
|
822
822
|
this.on("load", () => {
|
|
823
823
|
this.isLoaded = !0, a(this);
|
|
824
824
|
});
|
|
@@ -1014,7 +1014,7 @@ class gt extends fe {
|
|
|
1014
1014
|
super.off(t, e);
|
|
1015
1015
|
}
|
|
1016
1016
|
}
|
|
1017
|
-
class
|
|
1017
|
+
class ys {
|
|
1018
1018
|
/**
|
|
1019
1019
|
* @param {decoding.Decoder} decoder
|
|
1020
1020
|
*/
|
|
@@ -1036,7 +1036,7 @@ class bs {
|
|
|
1036
1036
|
return m(this.restDecoder);
|
|
1037
1037
|
}
|
|
1038
1038
|
}
|
|
1039
|
-
class
|
|
1039
|
+
class bs extends ys {
|
|
1040
1040
|
/**
|
|
1041
1041
|
* @return {ID}
|
|
1042
1042
|
*/
|
|
@@ -1144,7 +1144,7 @@ class Et extends ji {
|
|
|
1144
1144
|
* @param {decoding.Decoder} decoder
|
|
1145
1145
|
*/
|
|
1146
1146
|
constructor(t) {
|
|
1147
|
-
super(t), this.keys = [], m(t), this.keyClockDecoder = new
|
|
1147
|
+
super(t), this.keys = [], m(t), this.keyClockDecoder = new Le(M(t)), this.clientDecoder = new ee(M(t)), this.leftClockDecoder = new Le(M(t)), this.rightClockDecoder = new Le(M(t)), this.infoDecoder = new Un(M(t), St), this.stringDecoder = new si(M(t)), this.parentInfoDecoder = new Un(M(t), St), this.typeRefDecoder = new ee(M(t)), this.lenDecoder = new ee(M(t));
|
|
1148
1148
|
}
|
|
1149
1149
|
/**
|
|
1150
1150
|
* @return {ID}
|
|
@@ -1235,7 +1235,7 @@ class Et extends ji {
|
|
|
1235
1235
|
}
|
|
1236
1236
|
}
|
|
1237
1237
|
}
|
|
1238
|
-
class
|
|
1238
|
+
class ks {
|
|
1239
1239
|
constructor() {
|
|
1240
1240
|
this.restEncoder = v();
|
|
1241
1241
|
}
|
|
@@ -1257,7 +1257,7 @@ class _s {
|
|
|
1257
1257
|
p(this.restEncoder, t);
|
|
1258
1258
|
}
|
|
1259
1259
|
}
|
|
1260
|
-
class Kt extends
|
|
1260
|
+
class Kt extends ks {
|
|
1261
1261
|
/**
|
|
1262
1262
|
* @param {ID} id
|
|
1263
1263
|
*/
|
|
@@ -1281,7 +1281,7 @@ class Kt extends _s {
|
|
|
1281
1281
|
* @param {number} info An unsigned 8-bit integer
|
|
1282
1282
|
*/
|
|
1283
1283
|
writeInfo(t) {
|
|
1284
|
-
|
|
1284
|
+
$e(this.restEncoder, t);
|
|
1285
1285
|
}
|
|
1286
1286
|
/**
|
|
1287
1287
|
* @param {string} s
|
|
@@ -1334,7 +1334,7 @@ class Kt extends _s {
|
|
|
1334
1334
|
ot(this.restEncoder, t);
|
|
1335
1335
|
}
|
|
1336
1336
|
}
|
|
1337
|
-
class
|
|
1337
|
+
class _s {
|
|
1338
1338
|
constructor() {
|
|
1339
1339
|
this.restEncoder = v(), this.dsCurrVal = 0;
|
|
1340
1340
|
}
|
|
@@ -1358,9 +1358,9 @@ class Ss {
|
|
|
1358
1358
|
t === 0 && V(), p(this.restEncoder, t - 1), this.dsCurrVal += t;
|
|
1359
1359
|
}
|
|
1360
1360
|
}
|
|
1361
|
-
class at extends
|
|
1361
|
+
class at extends _s {
|
|
1362
1362
|
constructor() {
|
|
1363
|
-
super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new
|
|
1363
|
+
super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new Ie(), this.clientEncoder = new ne(), this.leftClockEncoder = new Ie(), this.rightClockEncoder = new Ie(), this.infoEncoder = new On($e), this.stringEncoder = new ki(), this.parentInfoEncoder = new On($e), this.typeRefEncoder = new ne(), this.lenEncoder = new ne();
|
|
1364
1364
|
}
|
|
1365
1365
|
toUint8Array() {
|
|
1366
1366
|
const t = v();
|
|
@@ -1475,7 +1475,7 @@ const Ki = (n, t, e, s) => {
|
|
|
1475
1475
|
);
|
|
1476
1476
|
});
|
|
1477
1477
|
}, zi = (n, t) => {
|
|
1478
|
-
const e =
|
|
1478
|
+
const e = R(), s = m(n.restDecoder);
|
|
1479
1479
|
for (let r = 0; r < s; r++) {
|
|
1480
1480
|
const i = m(n.restDecoder), o = new Array(i), l = n.readClient();
|
|
1481
1481
|
let c = m(n.restDecoder);
|
|
@@ -1508,7 +1508,7 @@ const Ki = (n, t, e, s) => {
|
|
|
1508
1508
|
// parent
|
|
1509
1509
|
d && (h & Ot) === Ot ? n.readString() : null,
|
|
1510
1510
|
// parentSub
|
|
1511
|
-
|
|
1511
|
+
Ws(n, h)
|
|
1512
1512
|
// item content
|
|
1513
1513
|
);
|
|
1514
1514
|
o[a] = u, c += u.length;
|
|
@@ -1540,7 +1540,7 @@ const Ki = (n, t, e, s) => {
|
|
|
1540
1540
|
let o = i();
|
|
1541
1541
|
if (o === null && s.length === 0)
|
|
1542
1542
|
return null;
|
|
1543
|
-
const l = new
|
|
1543
|
+
const l = new Ls(), c = /* @__PURE__ */ new Map(), a = (f, g) => {
|
|
1544
1544
|
const w = c.get(f);
|
|
1545
1545
|
(w == null || w > g) && c.set(f, g);
|
|
1546
1546
|
};
|
|
@@ -1622,11 +1622,11 @@ const Ki = (n, t, e, s) => {
|
|
|
1622
1622
|
}
|
|
1623
1623
|
} else
|
|
1624
1624
|
l.pendingStructs = a;
|
|
1625
|
-
const d =
|
|
1625
|
+
const d = Nn(s, r, l);
|
|
1626
1626
|
if (l.pendingDs) {
|
|
1627
1627
|
const u = new Et(nt(l.pendingDs));
|
|
1628
1628
|
m(u.restDecoder);
|
|
1629
|
-
const f =
|
|
1629
|
+
const f = Nn(u, r, l);
|
|
1630
1630
|
d && f ? l.pendingDs = oe([d, f]) : l.pendingDs = d || f;
|
|
1631
1631
|
} else
|
|
1632
1632
|
l.pendingDs = d;
|
|
@@ -1635,15 +1635,15 @@ const Ki = (n, t, e, s) => {
|
|
|
1635
1635
|
/** @type {{update: Uint8Array}} */
|
|
1636
1636
|
l.pendingStructs.update
|
|
1637
1637
|
);
|
|
1638
|
-
l.pendingStructs = null,
|
|
1638
|
+
l.pendingStructs = null, Ss(r.doc, u);
|
|
1639
1639
|
}
|
|
1640
|
-
}, e, !1),
|
|
1640
|
+
}, e, !1), Ss = (n, t, e, s = Et) => {
|
|
1641
1641
|
const r = nt(t);
|
|
1642
1642
|
Ji(r, n, e, new s(r));
|
|
1643
|
-
},
|
|
1643
|
+
}, Ds = (n, t, e) => Ss(n, t, e, bs), Wi = (n, t, e = /* @__PURE__ */ new Map()) => {
|
|
1644
1644
|
an(n, t.store, e), At(n, $i(t.store));
|
|
1645
1645
|
}, Gi = (n, t = new Uint8Array([0]), e = new at()) => {
|
|
1646
|
-
const s =
|
|
1646
|
+
const s = Es(t);
|
|
1647
1647
|
Wi(e, n, s);
|
|
1648
1648
|
const r = [e.toUint8Array()];
|
|
1649
1649
|
if (n.store.pendingDs && r.push(n.store.pendingDs), n.store.pendingStructs && r.push(ho(n.store.pendingStructs.update, t)), r.length > 1) {
|
|
@@ -1660,18 +1660,18 @@ const Ki = (n, t, e, s) => {
|
|
|
1660
1660
|
t.set(r, i);
|
|
1661
1661
|
}
|
|
1662
1662
|
return t;
|
|
1663
|
-
},
|
|
1663
|
+
}, Es = (n) => Pi(new ys(nt(n))), Cs = (n, t) => (p(n.restEncoder, t.size), tt(t.entries()).sort((e, s) => s[0] - e[0]).forEach(([e, s]) => {
|
|
1664
1664
|
p(n.restEncoder, e), p(n.restEncoder, s);
|
|
1665
|
-
}), n), qi = (n, t) =>
|
|
1665
|
+
}), n), qi = (n, t) => Cs(n, me(t.store)), Zi = (n, t = new _s()) => (n instanceof Map ? Cs(t, n) : qi(t, n), t.toUint8Array()), Qi = (n) => Zi(n, new ks());
|
|
1666
1666
|
class to {
|
|
1667
1667
|
constructor() {
|
|
1668
1668
|
this.l = [];
|
|
1669
1669
|
}
|
|
1670
1670
|
}
|
|
1671
|
-
const
|
|
1671
|
+
const Fn = () => new to(), Vn = (n, t) => n.l.push(t), Hn = (n, t) => {
|
|
1672
1672
|
const e = n.l, s = e.length;
|
|
1673
1673
|
n.l = e.filter((r) => t !== r), s === n.l.length && console.error("[yjs] Tried to remove event handler that doesn't exist.");
|
|
1674
|
-
},
|
|
1674
|
+
}, As = (n, t, e) => Ze(n.l, [t, e]);
|
|
1675
1675
|
class yt {
|
|
1676
1676
|
/**
|
|
1677
1677
|
* @param {number} client client id
|
|
@@ -1686,14 +1686,14 @@ const Pt = (n, t) => n === t || n !== null && t !== null && n.client === t.clien
|
|
|
1686
1686
|
if (e === n)
|
|
1687
1687
|
return t;
|
|
1688
1688
|
throw V();
|
|
1689
|
-
}, It = (n, t) => t === void 0 ? !n.deleted : t.sv.has(n.id.client) && (t.sv.get(n.id.client) || 0) > n.id.clock && !
|
|
1690
|
-
const e = J(n.meta,
|
|
1689
|
+
}, It = (n, t) => t === void 0 ? !n.deleted : t.sv.has(n.id.client) && (t.sv.get(n.id.client) || 0) > n.id.clock && !ws(t.ds, n.id), Ke = (n, t) => {
|
|
1690
|
+
const e = J(n.meta, Ke, lt), s = n.doc.store;
|
|
1691
1691
|
e.has(t) || (t.sv.forEach((r, i) => {
|
|
1692
1692
|
r < L(s, i) && et(n, b(i, r));
|
|
1693
|
-
}),
|
|
1693
|
+
}), ps(n, t.ds, (r) => {
|
|
1694
1694
|
}), e.add(t));
|
|
1695
1695
|
};
|
|
1696
|
-
class
|
|
1696
|
+
class Ls {
|
|
1697
1697
|
constructor() {
|
|
1698
1698
|
this.clients = /* @__PURE__ */ new Map(), this.pendingStructs = null, this.pendingDs = null;
|
|
1699
1699
|
}
|
|
@@ -1710,7 +1710,7 @@ const me = (n) => {
|
|
|
1710
1710
|
return 0;
|
|
1711
1711
|
const s = e[e.length - 1];
|
|
1712
1712
|
return s.id.clock + s.length;
|
|
1713
|
-
},
|
|
1713
|
+
}, Is = (n, t) => {
|
|
1714
1714
|
let e = n.clients.get(t.id.client);
|
|
1715
1715
|
if (e === void 0)
|
|
1716
1716
|
e = [], n.clients.set(t.id.client, e);
|
|
@@ -1738,10 +1738,10 @@ const me = (n) => {
|
|
|
1738
1738
|
}, no = (n, t) => {
|
|
1739
1739
|
const e = n.clients.get(t.client);
|
|
1740
1740
|
return e[H(e, t.clock)];
|
|
1741
|
-
},
|
|
1741
|
+
}, ve = (
|
|
1742
1742
|
/** @type {function(StructStore,ID):Item} */
|
|
1743
1743
|
no
|
|
1744
|
-
),
|
|
1744
|
+
), ze = (n, t, e) => {
|
|
1745
1745
|
const s = H(t, e), r = t[s];
|
|
1746
1746
|
return r.id.clock < e && r instanceof E ? (t.splice(s + 1, 0, de(n, r, e - r.id.clock)), s + 1) : s;
|
|
1747
1747
|
}, et = (n, t) => {
|
|
@@ -1749,8 +1749,8 @@ const me = (n) => {
|
|
|
1749
1749
|
/** @type {Array<Item>} */
|
|
1750
1750
|
n.doc.store.clients.get(t.client)
|
|
1751
1751
|
);
|
|
1752
|
-
return e[
|
|
1753
|
-
},
|
|
1752
|
+
return e[ze(n, e, t.clock)];
|
|
1753
|
+
}, $n = (n, t, e) => {
|
|
1754
1754
|
const s = t.clients.get(e.client), r = H(s, e.clock), i = s[r];
|
|
1755
1755
|
return e.clock !== i.id.clock + i.length - 1 && i.constructor !== U && s.splice(r + 1, 0, de(n, i, e.clock - i.id.clock + 1)), i;
|
|
1756
1756
|
}, so = (n, t, e) => {
|
|
@@ -1759,13 +1759,13 @@ const me = (n) => {
|
|
|
1759
1759
|
n.clients.get(t.id.client)
|
|
1760
1760
|
);
|
|
1761
1761
|
s[H(s, t.id.clock)] = e;
|
|
1762
|
-
},
|
|
1762
|
+
}, Ms = (n, t, e, s, r) => {
|
|
1763
1763
|
if (s === 0)
|
|
1764
1764
|
return;
|
|
1765
1765
|
const i = e + s;
|
|
1766
|
-
let o =
|
|
1766
|
+
let o = ze(n, t, e), l;
|
|
1767
1767
|
do
|
|
1768
|
-
l = t[o++], i < l.id.clock + l.length &&
|
|
1768
|
+
l = t[o++], i < l.id.clock + l.length && ze(n, t, i), r(l);
|
|
1769
1769
|
while (o < t.length && t[o].id.clock < i);
|
|
1770
1770
|
};
|
|
1771
1771
|
class ro {
|
|
@@ -1778,7 +1778,7 @@ class ro {
|
|
|
1778
1778
|
this.doc = t, this.deleteSet = new jt(), this.beforeState = me(t.store), this.afterState = /* @__PURE__ */ new Map(), this.changed = /* @__PURE__ */ new Map(), this.changedParentTypes = /* @__PURE__ */ new Map(), this._mergeStructs = [], this.origin = e, this.meta = /* @__PURE__ */ new Map(), this.local = s, this.subdocsAdded = /* @__PURE__ */ new Set(), this.subdocsRemoved = /* @__PURE__ */ new Set(), this.subdocsLoaded = /* @__PURE__ */ new Set(), this._needFormattingCleanup = !1;
|
|
1779
1779
|
}
|
|
1780
1780
|
}
|
|
1781
|
-
const
|
|
1781
|
+
const jn = (n, t) => t.deleteSet.clients.size === 0 && !br(t.afterState, (e, s) => t.beforeState.get(s) !== e) ? !1 : (ln(t.deleteSet), Xi(n, t), At(n, t.deleteSet), !0), Kn = (n, t, e) => {
|
|
1782
1782
|
const s = t._item;
|
|
1783
1783
|
(s === null || s.id.clock < (n.beforeState.get(s.id.client) || 0) && !s.deleted) && J(n.changed, t, lt).add(e);
|
|
1784
1784
|
}, se = (n, t) => {
|
|
@@ -1825,7 +1825,7 @@ const Kn = (n, t) => t.deleteSet.clients.size === 0 && !br(t.afterState, (e, s)
|
|
|
1825
1825
|
c -= 1 + se(r, c);
|
|
1826
1826
|
}
|
|
1827
1827
|
});
|
|
1828
|
-
},
|
|
1828
|
+
}, vs = (n, t) => {
|
|
1829
1829
|
if (t < n.length) {
|
|
1830
1830
|
const e = n[t], s = e.doc, r = s.store, i = e.deleteSet, o = e._mergeStructs;
|
|
1831
1831
|
try {
|
|
@@ -1841,7 +1841,7 @@ const Kn = (n, t) => t.deleteSet.clients.size === 0 && !br(t.afterState, (e, s)
|
|
|
1841
1841
|
(h) => h.target._item === null || !h.target._item.deleted
|
|
1842
1842
|
), c.forEach((h) => {
|
|
1843
1843
|
h.currentTarget = a, h._path = null;
|
|
1844
|
-
}), c.sort((h, d) => h.path.length - d.path.length),
|
|
1844
|
+
}), c.sort((h, d) => h.path.length - d.path.length), As(a._dEH, c, e));
|
|
1845
1845
|
});
|
|
1846
1846
|
}), l.push(() => s.emit("afterTransaction", [e, s])), Ze(l, []), e._needFormattingCleanup && Ao(e);
|
|
1847
1847
|
} finally {
|
|
@@ -1863,18 +1863,18 @@ const Kn = (n, t) => t.deleteSet.clients.size === 0 && !br(t.afterState, (e, s)
|
|
|
1863
1863
|
), g = H(f, u);
|
|
1864
1864
|
g + 1 < f.length && se(f, g + 1) > 1 || g > 0 && se(f, g);
|
|
1865
1865
|
}
|
|
1866
|
-
if (!e.local && e.afterState.get(s.clientID) !== e.beforeState.get(s.clientID) && (Ri(
|
|
1866
|
+
if (!e.local && e.afterState.get(s.clientID) !== e.beforeState.get(s.clientID) && (Ri(fs, hs, "[yjs] ", us, ds, "Changed the client-id because another client seems to be using it."), s.clientID = ms()), s.emit("afterTransactionCleanup", [e, s]), s._observers.has("update")) {
|
|
1867
1867
|
const h = new Kt();
|
|
1868
|
-
|
|
1868
|
+
jn(h, e) && s.emit("update", [h.toUint8Array(), e.origin, s, e]);
|
|
1869
1869
|
}
|
|
1870
1870
|
if (s._observers.has("updateV2")) {
|
|
1871
1871
|
const h = new at();
|
|
1872
|
-
|
|
1872
|
+
jn(h, e) && s.emit("updateV2", [h.toUint8Array(), e.origin, s, e]);
|
|
1873
1873
|
}
|
|
1874
1874
|
const { subdocsAdded: l, subdocsLoaded: c, subdocsRemoved: a } = e;
|
|
1875
1875
|
(l.size > 0 || a.size > 0 || c.size > 0) && (l.forEach((h) => {
|
|
1876
1876
|
h.clientID = s.clientID, h.collectionid == null && (h.collectionid = s.collectionid), s.subdocs.add(h);
|
|
1877
|
-
}), a.forEach((h) => s.subdocs.delete(h)), s.emit("subdocs", [{ loaded: c, added: l, removed: a }, s, e]), a.forEach((h) => h.destroy())), n.length <= t + 1 ? (s._transactionCleanups = [], s.emit("afterAllTransactions", [s, n])) :
|
|
1877
|
+
}), a.forEach((h) => s.subdocs.delete(h)), s.emit("subdocs", [{ loaded: c, added: l, removed: a }, s, e]), a.forEach((h) => h.destroy())), n.length <= t + 1 ? (s._transactionCleanups = [], s.emit("afterAllTransactions", [s, n])) : vs(n, t + 1);
|
|
1878
1878
|
}
|
|
1879
1879
|
}
|
|
1880
1880
|
}, k = (n, t, e = null, s = !0) => {
|
|
@@ -1886,7 +1886,7 @@ const Kn = (n, t) => t.deleteSet.clients.size === 0 && !br(t.afterState, (e, s)
|
|
|
1886
1886
|
} finally {
|
|
1887
1887
|
if (i) {
|
|
1888
1888
|
const l = n._transaction === r[0];
|
|
1889
|
-
n._transaction = null, l &&
|
|
1889
|
+
n._transaction = null, l && vs(r, 0);
|
|
1890
1890
|
}
|
|
1891
1891
|
}
|
|
1892
1892
|
return o;
|
|
@@ -1917,7 +1917,7 @@ function* lo(n) {
|
|
|
1917
1917
|
// parent
|
|
1918
1918
|
c && (l & Ot) === Ot ? n.readString() : null,
|
|
1919
1919
|
// parentSub
|
|
1920
|
-
|
|
1920
|
+
Ws(n, l)
|
|
1921
1921
|
// item content
|
|
1922
1922
|
);
|
|
1923
1923
|
yield a, i += a.length;
|
|
@@ -1954,7 +1954,7 @@ class dn {
|
|
|
1954
1954
|
this.currClient = 0, this.startClock = 0, this.written = 0, this.encoder = t, this.clientStructs = [];
|
|
1955
1955
|
}
|
|
1956
1956
|
}
|
|
1957
|
-
const co = (n) => oe(n,
|
|
1957
|
+
const co = (n) => oe(n, bs, Kt), ao = (n, t) => {
|
|
1958
1958
|
if (n.constructor === U) {
|
|
1959
1959
|
const { client: e, clock: s } = n.id;
|
|
1960
1960
|
return new U(b(e, s + t), n.length - t);
|
|
@@ -2037,7 +2037,7 @@ const co = (n) => oe(n, ks, Kt), ao = (n, t) => {
|
|
|
2037
2037
|
const c = s.map((h) => cn(h)), a = Vi(c);
|
|
2038
2038
|
return At(o, a), o.toUint8Array();
|
|
2039
2039
|
}, ho = (n, t, e = Et, s = at) => {
|
|
2040
|
-
const r =
|
|
2040
|
+
const r = Es(t), i = new s(), o = new dn(i), l = new e(nt(n)), c = new un(l, !1);
|
|
2041
2041
|
for (; c.curr; ) {
|
|
2042
2042
|
const h = c.curr, d = h.id.client, u = r.get(d) || 0;
|
|
2043
2043
|
if (c.curr.constructor === T) {
|
|
@@ -2054,12 +2054,12 @@ const co = (n) => oe(n, ks, Kt), ao = (n, t) => {
|
|
|
2054
2054
|
fn(o);
|
|
2055
2055
|
const a = cn(l);
|
|
2056
2056
|
return At(i, a), i.toUint8Array();
|
|
2057
|
-
},
|
|
2057
|
+
}, xs = (n) => {
|
|
2058
2058
|
n.written > 0 && (n.clientStructs.push({ written: n.written, restEncoder: _(n.encoder.restEncoder) }), n.encoder.restEncoder = v(), n.written = 0);
|
|
2059
2059
|
}, P = (n, t, e) => {
|
|
2060
|
-
n.written > 0 && n.currClient !== t.id.client &&
|
|
2060
|
+
n.written > 0 && n.currClient !== t.id.client && xs(n), n.written === 0 && (n.currClient = t.id.client, n.encoder.writeClient(t.id.client), p(n.encoder.restEncoder, t.id.clock + e)), t.write(n.encoder, e), n.written++;
|
|
2061
2061
|
}, fn = (n) => {
|
|
2062
|
-
|
|
2062
|
+
xs(n);
|
|
2063
2063
|
const t = n.encoder.restEncoder;
|
|
2064
2064
|
p(t, n.clientStructs.length);
|
|
2065
2065
|
for (let e = 0; e < n.clientStructs.length; e++) {
|
|
@@ -2073,7 +2073,7 @@ const co = (n) => oe(n, ks, Kt), ao = (n, t) => {
|
|
|
2073
2073
|
fn(l);
|
|
2074
2074
|
const c = cn(r);
|
|
2075
2075
|
return At(o, c), o.toUint8Array();
|
|
2076
|
-
}, fo = (n) => uo(n, $r, Et, Kt),
|
|
2076
|
+
}, fo = (n) => uo(n, $r, Et, Kt), zn = "You must not compute changes after the event-handler fired.";
|
|
2077
2077
|
class ye {
|
|
2078
2078
|
/**
|
|
2079
2079
|
* @param {T} target The changed type.
|
|
@@ -2107,7 +2107,7 @@ class ye {
|
|
|
2107
2107
|
* @return {boolean}
|
|
2108
2108
|
*/
|
|
2109
2109
|
deletes(t) {
|
|
2110
|
-
return
|
|
2110
|
+
return ws(this.transaction.deleteSet, t.id);
|
|
2111
2111
|
}
|
|
2112
2112
|
/**
|
|
2113
2113
|
* @type {Map<string, { action: 'add' | 'update' | 'delete', oldValue: any, newValue: any }>}
|
|
@@ -2115,7 +2115,7 @@ class ye {
|
|
|
2115
2115
|
get keys() {
|
|
2116
2116
|
if (this._keys === null) {
|
|
2117
2117
|
if (this.transaction.doc._transactionCleanups.length === 0)
|
|
2118
|
-
throw X(
|
|
2118
|
+
throw X(zn);
|
|
2119
2119
|
const t = /* @__PURE__ */ new Map(), e = this.target;
|
|
2120
2120
|
/** @type Set<string|null> */
|
|
2121
2121
|
this.transaction.changed.get(e).forEach((r) => {
|
|
@@ -2131,13 +2131,13 @@ class ye {
|
|
|
2131
2131
|
c = c.left;
|
|
2132
2132
|
if (this.deletes(i))
|
|
2133
2133
|
if (c !== null && this.deletes(c))
|
|
2134
|
-
o = "delete", l =
|
|
2134
|
+
o = "delete", l = Ee(c.content.getContent());
|
|
2135
2135
|
else
|
|
2136
2136
|
return;
|
|
2137
2137
|
else
|
|
2138
|
-
c !== null && this.deletes(c) ? (o = "update", l =
|
|
2138
|
+
c !== null && this.deletes(c) ? (o = "update", l = Ee(c.content.getContent())) : (o = "add", l = void 0);
|
|
2139
2139
|
} else if (this.deletes(i))
|
|
2140
|
-
o = "delete", l =
|
|
2140
|
+
o = "delete", l = Ee(
|
|
2141
2141
|
/** @type {Item} */
|
|
2142
2142
|
i.content.getContent()
|
|
2143
2143
|
);
|
|
@@ -2183,7 +2183,7 @@ class ye {
|
|
|
2183
2183
|
let t = this._changes;
|
|
2184
2184
|
if (t === null) {
|
|
2185
2185
|
if (this.transaction.doc._transactionCleanups.length === 0)
|
|
2186
|
-
throw X(
|
|
2186
|
+
throw X(zn);
|
|
2187
2187
|
const e = this.target, s = lt(), r = lt(), i = [];
|
|
2188
2188
|
if (t = {
|
|
2189
2189
|
added: s,
|
|
@@ -2226,7 +2226,7 @@ const go = (n, t) => {
|
|
|
2226
2226
|
t._item.parent;
|
|
2227
2227
|
}
|
|
2228
2228
|
return e;
|
|
2229
|
-
},
|
|
2229
|
+
}, Us = 80;
|
|
2230
2230
|
let gn = 0;
|
|
2231
2231
|
class po {
|
|
2232
2232
|
/**
|
|
@@ -2239,12 +2239,12 @@ class po {
|
|
|
2239
2239
|
}
|
|
2240
2240
|
const wo = (n) => {
|
|
2241
2241
|
n.timestamp = gn++;
|
|
2242
|
-
},
|
|
2242
|
+
}, Ts = (n, t, e) => {
|
|
2243
2243
|
n.p.marker = !1, n.p = t, t.marker = !0, n.index = e, n.timestamp = gn++;
|
|
2244
2244
|
}, mo = (n, t, e) => {
|
|
2245
|
-
if (n.length >=
|
|
2245
|
+
if (n.length >= Us) {
|
|
2246
2246
|
const s = n.reduce((r, i) => r.timestamp < i.timestamp ? r : i);
|
|
2247
|
-
return
|
|
2247
|
+
return Ts(s, t, e), s;
|
|
2248
2248
|
} else {
|
|
2249
2249
|
const s = new po(t, e);
|
|
2250
2250
|
return n.push(s), s;
|
|
@@ -2267,7 +2267,7 @@ const wo = (n) => {
|
|
|
2267
2267
|
for (; s.left !== null && s.left.id.client === s.id.client && s.left.id.clock + s.left.length === s.id.clock; )
|
|
2268
2268
|
s = s.left, !s.deleted && s.countable && (r -= s.length);
|
|
2269
2269
|
return e !== null && te(e.index - r) < /** @type {YText|YArray<any>} */
|
|
2270
|
-
s.parent.length /
|
|
2270
|
+
s.parent.length / Us ? (Ts(e, s, r), e) : mo(n._searchMarker, s, r);
|
|
2271
2271
|
}, Nt = (n, t, e) => {
|
|
2272
2272
|
for (let s = n.length - 1; s >= 0; s--) {
|
|
2273
2273
|
const r = n[s];
|
|
@@ -2288,11 +2288,11 @@ const wo = (n) => {
|
|
|
2288
2288
|
for (; J(r, n, () => []).push(e), n._item !== null; )
|
|
2289
2289
|
n = /** @type {AbstractType<any>} */
|
|
2290
2290
|
n._item.parent;
|
|
2291
|
-
|
|
2291
|
+
As(s._eH, e, t);
|
|
2292
2292
|
};
|
|
2293
2293
|
class I {
|
|
2294
2294
|
constructor() {
|
|
2295
|
-
this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH =
|
|
2295
|
+
this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH = Fn(), this._dEH = Fn(), this._searchMarker = null;
|
|
2296
2296
|
}
|
|
2297
2297
|
/**
|
|
2298
2298
|
* @return {AbstractType<any>|null}
|
|
@@ -2320,13 +2320,13 @@ class I {
|
|
|
2320
2320
|
* @return {AbstractType<EventType>}
|
|
2321
2321
|
*/
|
|
2322
2322
|
_copy() {
|
|
2323
|
-
throw
|
|
2323
|
+
throw N();
|
|
2324
2324
|
}
|
|
2325
2325
|
/**
|
|
2326
2326
|
* @return {AbstractType<EventType>}
|
|
2327
2327
|
*/
|
|
2328
2328
|
clone() {
|
|
2329
|
-
throw
|
|
2329
|
+
throw N();
|
|
2330
2330
|
}
|
|
2331
2331
|
/**
|
|
2332
2332
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} _encoder
|
|
@@ -2358,7 +2358,7 @@ class I {
|
|
|
2358
2358
|
* @param {function(EventType, Transaction):void} f Observer function
|
|
2359
2359
|
*/
|
|
2360
2360
|
observe(t) {
|
|
2361
|
-
|
|
2361
|
+
Vn(this._eH, t);
|
|
2362
2362
|
}
|
|
2363
2363
|
/**
|
|
2364
2364
|
* Observe all events that are created by this type and its children.
|
|
@@ -2366,7 +2366,7 @@ class I {
|
|
|
2366
2366
|
* @param {function(Array<YEvent<any>>,Transaction):void} f Observer function
|
|
2367
2367
|
*/
|
|
2368
2368
|
observeDeep(t) {
|
|
2369
|
-
|
|
2369
|
+
Vn(this._dEH, t);
|
|
2370
2370
|
}
|
|
2371
2371
|
/**
|
|
2372
2372
|
* Unregister an observer function.
|
|
@@ -2374,7 +2374,7 @@ class I {
|
|
|
2374
2374
|
* @param {function(EventType,Transaction):void} f Observer function
|
|
2375
2375
|
*/
|
|
2376
2376
|
unobserve(t) {
|
|
2377
|
-
|
|
2377
|
+
Hn(this._eH, t);
|
|
2378
2378
|
}
|
|
2379
2379
|
/**
|
|
2380
2380
|
* Unregister an observer function.
|
|
@@ -2382,7 +2382,7 @@ class I {
|
|
|
2382
2382
|
* @param {function(Array<YEvent<any>>,Transaction):void} f Observer function
|
|
2383
2383
|
*/
|
|
2384
2384
|
unobserveDeep(t) {
|
|
2385
|
-
|
|
2385
|
+
Hn(this._dEH, t);
|
|
2386
2386
|
}
|
|
2387
2387
|
/**
|
|
2388
2388
|
* @abstract
|
|
@@ -2391,7 +2391,7 @@ class I {
|
|
|
2391
2391
|
toJSON() {
|
|
2392
2392
|
}
|
|
2393
2393
|
}
|
|
2394
|
-
const
|
|
2394
|
+
const Os = (n, t, e) => {
|
|
2395
2395
|
t < 0 && (t = n._length + t), e < 0 && (e = n._length + e);
|
|
2396
2396
|
let s = e - t;
|
|
2397
2397
|
const r = [];
|
|
@@ -2410,7 +2410,7 @@ const Rs = (n, t, e) => {
|
|
|
2410
2410
|
i = i.right;
|
|
2411
2411
|
}
|
|
2412
2412
|
return r;
|
|
2413
|
-
},
|
|
2413
|
+
}, Rs = (n) => {
|
|
2414
2414
|
const t = [];
|
|
2415
2415
|
let e = n._start;
|
|
2416
2416
|
for (; e !== null; ) {
|
|
@@ -2432,7 +2432,7 @@ const Rs = (n, t, e) => {
|
|
|
2432
2432
|
}
|
|
2433
2433
|
s = s.right;
|
|
2434
2434
|
}
|
|
2435
|
-
},
|
|
2435
|
+
}, Bs = (n, t) => {
|
|
2436
2436
|
const e = [];
|
|
2437
2437
|
return Ft(n, (s, r) => {
|
|
2438
2438
|
e.push(t(s, r, n));
|
|
@@ -2461,7 +2461,7 @@ const Rs = (n, t, e) => {
|
|
|
2461
2461
|
};
|
|
2462
2462
|
}
|
|
2463
2463
|
};
|
|
2464
|
-
},
|
|
2464
|
+
}, Ns = (n, t) => {
|
|
2465
2465
|
const e = be(n, t);
|
|
2466
2466
|
let s = n._start;
|
|
2467
2467
|
for (e !== null && (s = e.p, t -= e.index); s !== null; s = s.right)
|
|
@@ -2512,9 +2512,9 @@ const Rs = (n, t, e) => {
|
|
|
2512
2512
|
}
|
|
2513
2513
|
}
|
|
2514
2514
|
}), h();
|
|
2515
|
-
},
|
|
2515
|
+
}, Fs = () => X("Length exceeded!"), Vs = (n, t, e, s) => {
|
|
2516
2516
|
if (e > t._length)
|
|
2517
|
-
throw
|
|
2517
|
+
throw Fs();
|
|
2518
2518
|
if (e === 0)
|
|
2519
2519
|
return t._searchMarker && Nt(t._searchMarker, e, s.length), le(n, t, null, s);
|
|
2520
2520
|
const r = e, i = be(t, e);
|
|
@@ -2534,7 +2534,7 @@ const Rs = (n, t, e) => {
|
|
|
2534
2534
|
for (; r.right; )
|
|
2535
2535
|
r = r.right;
|
|
2536
2536
|
return le(n, t, r, e);
|
|
2537
|
-
},
|
|
2537
|
+
}, Hs = (n, t, e, s) => {
|
|
2538
2538
|
if (s === 0)
|
|
2539
2539
|
return;
|
|
2540
2540
|
const r = e, i = s, o = be(t, e);
|
|
@@ -2544,7 +2544,7 @@ const Rs = (n, t, e) => {
|
|
|
2544
2544
|
for (; s > 0 && l !== null; )
|
|
2545
2545
|
l.deleted || (s < l.length && et(n, b(l.id.client, l.id.clock + s)), l.delete(n), s -= l.length), l = l.right;
|
|
2546
2546
|
if (s > 0)
|
|
2547
|
-
throw
|
|
2547
|
+
throw Fs();
|
|
2548
2548
|
t._searchMarker && Nt(
|
|
2549
2549
|
t._searchMarker,
|
|
2550
2550
|
r,
|
|
@@ -2590,12 +2590,12 @@ const Rs = (n, t, e) => {
|
|
|
2590
2590
|
}, wn = (n, t) => {
|
|
2591
2591
|
const e = n._map.get(t);
|
|
2592
2592
|
return e !== void 0 && !e.deleted ? e.content.getContent()[e.length - 1] : void 0;
|
|
2593
|
-
},
|
|
2593
|
+
}, $s = (n) => {
|
|
2594
2594
|
const t = {};
|
|
2595
2595
|
return n._map.forEach((e, s) => {
|
|
2596
2596
|
e.deleted || (t[s] = e.content.getContent()[e.length - 1]);
|
|
2597
2597
|
}), t;
|
|
2598
|
-
},
|
|
2598
|
+
}, js = (n, t) => {
|
|
2599
2599
|
const e = n._map.get(t);
|
|
2600
2600
|
return e !== void 0 && !e.deleted;
|
|
2601
2601
|
}, qt = (n) => Ni(
|
|
@@ -2691,7 +2691,7 @@ class bt extends I {
|
|
|
2691
2691
|
*/
|
|
2692
2692
|
insert(t, e) {
|
|
2693
2693
|
this.doc !== null ? k(this.doc, (s) => {
|
|
2694
|
-
|
|
2694
|
+
Vs(
|
|
2695
2695
|
s,
|
|
2696
2696
|
this,
|
|
2697
2697
|
t,
|
|
@@ -2733,7 +2733,7 @@ class bt extends I {
|
|
|
2733
2733
|
*/
|
|
2734
2734
|
delete(t, e = 1) {
|
|
2735
2735
|
this.doc !== null ? k(this.doc, (s) => {
|
|
2736
|
-
|
|
2736
|
+
Hs(s, this, t, e);
|
|
2737
2737
|
}) : this._prelimContent.splice(t, e);
|
|
2738
2738
|
}
|
|
2739
2739
|
/**
|
|
@@ -2743,7 +2743,7 @@ class bt extends I {
|
|
|
2743
2743
|
* @return {T}
|
|
2744
2744
|
*/
|
|
2745
2745
|
get(t) {
|
|
2746
|
-
return
|
|
2746
|
+
return Ns(this, t);
|
|
2747
2747
|
}
|
|
2748
2748
|
/**
|
|
2749
2749
|
* Transforms this YArray to a JavaScript Array.
|
|
@@ -2751,7 +2751,7 @@ class bt extends I {
|
|
|
2751
2751
|
* @return {Array<T>}
|
|
2752
2752
|
*/
|
|
2753
2753
|
toArray() {
|
|
2754
|
-
return
|
|
2754
|
+
return Rs(this);
|
|
2755
2755
|
}
|
|
2756
2756
|
/**
|
|
2757
2757
|
* Transforms this YArray to a JavaScript Array.
|
|
@@ -2761,7 +2761,7 @@ class bt extends I {
|
|
|
2761
2761
|
* @return {Array<T>}
|
|
2762
2762
|
*/
|
|
2763
2763
|
slice(t = 0, e = this.length) {
|
|
2764
|
-
return
|
|
2764
|
+
return Os(this, t, e);
|
|
2765
2765
|
}
|
|
2766
2766
|
/**
|
|
2767
2767
|
* Transforms this Shared Type to a JSON object.
|
|
@@ -2781,7 +2781,7 @@ class bt extends I {
|
|
|
2781
2781
|
* callback function
|
|
2782
2782
|
*/
|
|
2783
2783
|
map(t) {
|
|
2784
|
-
return
|
|
2784
|
+
return Bs(
|
|
2785
2785
|
this,
|
|
2786
2786
|
/** @type {any} */
|
|
2787
2787
|
t
|
|
@@ -2897,7 +2897,7 @@ class ht extends I {
|
|
|
2897
2897
|
* @return {IterableIterator<string>}
|
|
2898
2898
|
*/
|
|
2899
2899
|
keys() {
|
|
2900
|
-
return
|
|
2900
|
+
return Me(
|
|
2901
2901
|
qt(this._map),
|
|
2902
2902
|
/** @param {any} v */
|
|
2903
2903
|
(t) => t[0]
|
|
@@ -2909,7 +2909,7 @@ class ht extends I {
|
|
|
2909
2909
|
* @return {IterableIterator<any>}
|
|
2910
2910
|
*/
|
|
2911
2911
|
values() {
|
|
2912
|
-
return
|
|
2912
|
+
return Me(
|
|
2913
2913
|
qt(this._map),
|
|
2914
2914
|
/** @param {any} v */
|
|
2915
2915
|
(t) => t[1].content.getContent()[t[1].length - 1]
|
|
@@ -2921,7 +2921,7 @@ class ht extends I {
|
|
|
2921
2921
|
* @return {IterableIterator<any>}
|
|
2922
2922
|
*/
|
|
2923
2923
|
entries() {
|
|
2924
|
-
return
|
|
2924
|
+
return Me(
|
|
2925
2925
|
qt(this._map),
|
|
2926
2926
|
/** @param {any} v */
|
|
2927
2927
|
(t) => [t[0], t[1].content.getContent()[t[1].length - 1]]
|
|
@@ -2993,7 +2993,7 @@ class ht extends I {
|
|
|
2993
2993
|
* @return {boolean}
|
|
2994
2994
|
*/
|
|
2995
2995
|
has(t) {
|
|
2996
|
-
return
|
|
2996
|
+
return js(this, t);
|
|
2997
2997
|
}
|
|
2998
2998
|
/**
|
|
2999
2999
|
* Removes all elements from this YMap.
|
|
@@ -3013,7 +3013,7 @@ class ht extends I {
|
|
|
3013
3013
|
}
|
|
3014
3014
|
}
|
|
3015
3015
|
const Do = (n) => new ht(), q = (n, t) => n === t || typeof n == "object" && typeof t == "object" && n && t && Hr(n, t);
|
|
3016
|
-
class
|
|
3016
|
+
class Ye {
|
|
3017
3017
|
/**
|
|
3018
3018
|
* @param {Item|null} left
|
|
3019
3019
|
* @param {Item|null} right
|
|
@@ -3042,7 +3042,7 @@ class ze {
|
|
|
3042
3042
|
this.left = this.right, this.right = this.right.right;
|
|
3043
3043
|
}
|
|
3044
3044
|
}
|
|
3045
|
-
const
|
|
3045
|
+
const Yn = (n, t, e) => {
|
|
3046
3046
|
for (; t.right !== null && e > 0; ) {
|
|
3047
3047
|
switch (t.right.content.constructor) {
|
|
3048
3048
|
case C:
|
|
@@ -3062,13 +3062,13 @@ const Xn = (n, t, e) => {
|
|
|
3062
3062
|
}, Zt = (n, t, e) => {
|
|
3063
3063
|
const s = /* @__PURE__ */ new Map(), r = be(t, e);
|
|
3064
3064
|
if (r) {
|
|
3065
|
-
const i = new
|
|
3066
|
-
return
|
|
3065
|
+
const i = new Ye(r.p.left, r.p, r.index, s);
|
|
3066
|
+
return Yn(n, i, e - r.index);
|
|
3067
3067
|
} else {
|
|
3068
|
-
const i = new
|
|
3069
|
-
return
|
|
3068
|
+
const i = new Ye(null, t._start, 0, s);
|
|
3069
|
+
return Yn(n, i, e);
|
|
3070
3070
|
}
|
|
3071
|
-
},
|
|
3071
|
+
}, Ks = (n, t, e, s) => {
|
|
3072
3072
|
for (; e.right !== null && (e.right.deleted === !0 || e.right.content.constructor === C && q(
|
|
3073
3073
|
s.get(
|
|
3074
3074
|
/** @type {ContentFormat} */
|
|
@@ -3089,7 +3089,7 @@ const Xn = (n, t, e) => {
|
|
|
3089
3089
|
}, Lt = (n, t) => {
|
|
3090
3090
|
const { key: e, value: s } = t;
|
|
3091
3091
|
s === null ? n.delete(e) : n.set(e, s);
|
|
3092
|
-
},
|
|
3092
|
+
}, zs = (n, t) => {
|
|
3093
3093
|
for (; n.right !== null; ) {
|
|
3094
3094
|
if (!(n.right.deleted || n.right.content.constructor === C && q(
|
|
3095
3095
|
t[
|
|
@@ -3102,7 +3102,7 @@ const Xn = (n, t, e) => {
|
|
|
3102
3102
|
break;
|
|
3103
3103
|
n.forward();
|
|
3104
3104
|
}
|
|
3105
|
-
},
|
|
3105
|
+
}, Ys = (n, t, e, s) => {
|
|
3106
3106
|
const r = n.doc, i = r.clientID, o = /* @__PURE__ */ new Map();
|
|
3107
3107
|
for (const l in s) {
|
|
3108
3108
|
const c = s[l], a = e.currentAttributes.get(l) || null;
|
|
@@ -3113,22 +3113,22 @@ const Xn = (n, t, e) => {
|
|
|
3113
3113
|
}
|
|
3114
3114
|
}
|
|
3115
3115
|
return o;
|
|
3116
|
-
},
|
|
3116
|
+
}, xe = (n, t, e, s, r) => {
|
|
3117
3117
|
e.currentAttributes.forEach((u, f) => {
|
|
3118
3118
|
r[f] === void 0 && (r[f] = null);
|
|
3119
3119
|
});
|
|
3120
3120
|
const i = n.doc, o = i.clientID;
|
|
3121
|
-
|
|
3122
|
-
const l =
|
|
3121
|
+
zs(e, r);
|
|
3122
|
+
const l = Ys(n, t, e, r), c = s.constructor === String ? new $(
|
|
3123
3123
|
/** @type {string} */
|
|
3124
3124
|
s
|
|
3125
3125
|
) : s instanceof I ? new G(s) : new pt(s);
|
|
3126
3126
|
let { left: a, right: h, index: d } = e;
|
|
3127
|
-
t._searchMarker && Nt(t._searchMarker, e.index, c.getLength()), h = new E(b(o, L(i.store, o)), a, a && a.lastId, h, h && h.id, t, null, c), h.integrate(n, 0), e.right = h, e.index = d, e.forward(),
|
|
3128
|
-
},
|
|
3127
|
+
t._searchMarker && Nt(t._searchMarker, e.index, c.getLength()), h = new E(b(o, L(i.store, o)), a, a && a.lastId, h, h && h.id, t, null, c), h.integrate(n, 0), e.right = h, e.index = d, e.forward(), Ks(n, t, e, l);
|
|
3128
|
+
}, Xn = (n, t, e, s, r) => {
|
|
3129
3129
|
const i = n.doc, o = i.clientID;
|
|
3130
|
-
|
|
3131
|
-
const l =
|
|
3130
|
+
zs(e, r);
|
|
3131
|
+
const l = Ys(n, t, e, r);
|
|
3132
3132
|
t:
|
|
3133
3133
|
for (; e.right !== null && (s > 0 || l.size > 0 && (e.right.deleted || e.right.content.constructor === C)); ) {
|
|
3134
3134
|
if (!e.right.deleted)
|
|
@@ -3164,10 +3164,10 @@ const Xn = (n, t, e) => {
|
|
|
3164
3164
|
`;
|
|
3165
3165
|
e.right = new E(b(o, L(i.store, o)), e.left, e.left && e.left.lastId, e.right, e.right && e.right.id, t, null, new $(c)), e.right.integrate(n, 0), e.forward();
|
|
3166
3166
|
}
|
|
3167
|
-
|
|
3168
|
-
},
|
|
3167
|
+
Ks(n, t, e, l);
|
|
3168
|
+
}, Xs = (n, t, e, s, r) => {
|
|
3169
3169
|
let i = t;
|
|
3170
|
-
const o =
|
|
3170
|
+
const o = R();
|
|
3171
3171
|
for (; i && (!i.countable || i.deleted); ) {
|
|
3172
3172
|
if (!i.deleted && i.content.constructor === C) {
|
|
3173
3173
|
const a = (
|
|
@@ -3224,8 +3224,8 @@ const Xn = (n, t, e) => {
|
|
|
3224
3224
|
let s = (
|
|
3225
3225
|
/** @type {Item} */
|
|
3226
3226
|
n._start
|
|
3227
|
-
), r = n._start, i =
|
|
3228
|
-
const o =
|
|
3227
|
+
), r = n._start, i = R();
|
|
3228
|
+
const o = Ne(i);
|
|
3229
3229
|
for (; r; ) {
|
|
3230
3230
|
if (r.deleted === !1)
|
|
3231
3231
|
switch (r.content.constructor) {
|
|
@@ -3237,7 +3237,7 @@ const Xn = (n, t, e) => {
|
|
|
3237
3237
|
);
|
|
3238
3238
|
break;
|
|
3239
3239
|
default:
|
|
3240
|
-
t +=
|
|
3240
|
+
t += Xs(e, s, r, i, o), i = Ne(o), s = r;
|
|
3241
3241
|
break;
|
|
3242
3242
|
}
|
|
3243
3243
|
r = r.right;
|
|
@@ -3248,7 +3248,7 @@ const Xn = (n, t, e) => {
|
|
|
3248
3248
|
const t = /* @__PURE__ */ new Set(), e = n.doc;
|
|
3249
3249
|
for (const [s, r] of n.afterState.entries()) {
|
|
3250
3250
|
const i = n.beforeState.get(s) || 0;
|
|
3251
|
-
r !== i &&
|
|
3251
|
+
r !== i && Ms(
|
|
3252
3252
|
n,
|
|
3253
3253
|
/** @type {Array<Item|GC>} */
|
|
3254
3254
|
e.store.clients.get(s),
|
|
@@ -3264,7 +3264,7 @@ const Xn = (n, t, e) => {
|
|
|
3264
3264
|
);
|
|
3265
3265
|
}
|
|
3266
3266
|
k(e, (s) => {
|
|
3267
|
-
|
|
3267
|
+
ps(n, n.deleteSet, (r) => {
|
|
3268
3268
|
if (r instanceof U || !/** @type {YText} */
|
|
3269
3269
|
r.parent._hasFormatting || t.has(
|
|
3270
3270
|
/** @type {YText} */
|
|
@@ -3280,8 +3280,8 @@ const Xn = (n, t, e) => {
|
|
|
3280
3280
|
for (const r of t)
|
|
3281
3281
|
Co(r);
|
|
3282
3282
|
});
|
|
3283
|
-
},
|
|
3284
|
-
const s = e, r =
|
|
3283
|
+
}, Jn = (n, t, e) => {
|
|
3284
|
+
const s = e, r = Ne(t.currentAttributes), i = t.right;
|
|
3285
3285
|
for (; e > 0 && t.right !== null; ) {
|
|
3286
3286
|
if (t.right.deleted === !1)
|
|
3287
3287
|
switch (t.right.content.constructor) {
|
|
@@ -3293,7 +3293,7 @@ const Xn = (n, t, e) => {
|
|
|
3293
3293
|
}
|
|
3294
3294
|
t.forward();
|
|
3295
3295
|
}
|
|
3296
|
-
i &&
|
|
3296
|
+
i && Xs(n, i, t.right, r, t.currentAttributes);
|
|
3297
3297
|
const o = (
|
|
3298
3298
|
/** @type {AbstractType<any>} */
|
|
3299
3299
|
/** @type {Item} */
|
|
@@ -3504,15 +3504,15 @@ class Ct extends I {
|
|
|
3504
3504
|
*/
|
|
3505
3505
|
applyDelta(t, { sanitize: e = !0 } = {}) {
|
|
3506
3506
|
this.doc !== null ? k(this.doc, (s) => {
|
|
3507
|
-
const r = new
|
|
3507
|
+
const r = new Ye(null, this._start, 0, /* @__PURE__ */ new Map());
|
|
3508
3508
|
for (let i = 0; i < t.length; i++) {
|
|
3509
3509
|
const o = t[i];
|
|
3510
3510
|
if (o.insert !== void 0) {
|
|
3511
3511
|
const l = !e && typeof o.insert == "string" && i === t.length - 1 && r.right === null && o.insert.slice(-1) === `
|
|
3512
3512
|
` ? o.insert.slice(0, -1) : o.insert;
|
|
3513
|
-
(typeof l != "string" || l.length > 0) &&
|
|
3513
|
+
(typeof l != "string" || l.length > 0) && xe(s, this, r, l, o.attributes || {});
|
|
3514
3514
|
} else
|
|
3515
|
-
o.retain !== void 0 ?
|
|
3515
|
+
o.retain !== void 0 ? Xn(s, this, r, o.retain, o.attributes || {}) : o.delete !== void 0 && Jn(s, r, o.delete);
|
|
3516
3516
|
}
|
|
3517
3517
|
}) : this._pending.push(() => this.applyDelta(t));
|
|
3518
3518
|
}
|
|
@@ -3584,7 +3584,7 @@ class Ct extends I {
|
|
|
3584
3584
|
a();
|
|
3585
3585
|
};
|
|
3586
3586
|
return t || e ? k(o, (d) => {
|
|
3587
|
-
t &&
|
|
3587
|
+
t && Ke(d, t), e && Ke(d, e), h();
|
|
3588
3588
|
}, "cleanup") : h(), r;
|
|
3589
3589
|
}
|
|
3590
3590
|
/**
|
|
@@ -3605,7 +3605,7 @@ class Ct extends I {
|
|
|
3605
3605
|
const o = Zt(i, this, t);
|
|
3606
3606
|
s || (s = {}, o.currentAttributes.forEach((l, c) => {
|
|
3607
3607
|
s[c] = l;
|
|
3608
|
-
})),
|
|
3608
|
+
})), xe(i, this, o, e, s);
|
|
3609
3609
|
}) : this._pending.push(() => this.insert(t, e, s));
|
|
3610
3610
|
}
|
|
3611
3611
|
/**
|
|
@@ -3622,7 +3622,7 @@ class Ct extends I {
|
|
|
3622
3622
|
const r = this.doc;
|
|
3623
3623
|
r !== null ? k(r, (i) => {
|
|
3624
3624
|
const o = Zt(i, this, t);
|
|
3625
|
-
|
|
3625
|
+
xe(i, this, o, e, s);
|
|
3626
3626
|
}) : this._pending.push(() => this.insertEmbed(t, e, s));
|
|
3627
3627
|
}
|
|
3628
3628
|
/**
|
|
@@ -3638,7 +3638,7 @@ class Ct extends I {
|
|
|
3638
3638
|
return;
|
|
3639
3639
|
const s = this.doc;
|
|
3640
3640
|
s !== null ? k(s, (r) => {
|
|
3641
|
-
|
|
3641
|
+
Jn(r, Zt(r, this, t), e);
|
|
3642
3642
|
}) : this._pending.push(() => this.delete(t, e));
|
|
3643
3643
|
}
|
|
3644
3644
|
/**
|
|
@@ -3657,7 +3657,7 @@ class Ct extends I {
|
|
|
3657
3657
|
const r = this.doc;
|
|
3658
3658
|
r !== null ? k(r, (i) => {
|
|
3659
3659
|
const o = Zt(i, this, t);
|
|
3660
|
-
o.right !== null &&
|
|
3660
|
+
o.right !== null && Xn(i, this, o, e, s);
|
|
3661
3661
|
}) : this._pending.push(() => this.format(t, e, s));
|
|
3662
3662
|
}
|
|
3663
3663
|
/**
|
|
@@ -3716,7 +3716,7 @@ class Ct extends I {
|
|
|
3716
3716
|
* @public
|
|
3717
3717
|
*/
|
|
3718
3718
|
getAttributes() {
|
|
3719
|
-
return
|
|
3719
|
+
return $s(this);
|
|
3720
3720
|
}
|
|
3721
3721
|
/**
|
|
3722
3722
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
|
|
@@ -3726,7 +3726,7 @@ class Ct extends I {
|
|
|
3726
3726
|
}
|
|
3727
3727
|
}
|
|
3728
3728
|
const Io = (n) => new Ct();
|
|
3729
|
-
class
|
|
3729
|
+
class Ue {
|
|
3730
3730
|
/**
|
|
3731
3731
|
* @param {YXmlFragment | YXmlElement} root
|
|
3732
3732
|
* @param {function(AbstractType<any>):boolean} [f]
|
|
@@ -3830,7 +3830,7 @@ class ut extends I {
|
|
|
3830
3830
|
* @public
|
|
3831
3831
|
*/
|
|
3832
3832
|
createTreeWalker(t) {
|
|
3833
|
-
return new
|
|
3833
|
+
return new Ue(this, t);
|
|
3834
3834
|
}
|
|
3835
3835
|
/**
|
|
3836
3836
|
* Returns the first YXmlElement that matches the query.
|
|
@@ -3849,7 +3849,7 @@ class ut extends I {
|
|
|
3849
3849
|
*/
|
|
3850
3850
|
querySelector(t) {
|
|
3851
3851
|
t = t.toUpperCase();
|
|
3852
|
-
const s = new
|
|
3852
|
+
const s = new Ue(this, (r) => r.nodeName && r.nodeName.toUpperCase() === t).next();
|
|
3853
3853
|
return s.done ? null : s.value;
|
|
3854
3854
|
}
|
|
3855
3855
|
/**
|
|
@@ -3864,7 +3864,7 @@ class ut extends I {
|
|
|
3864
3864
|
* @public
|
|
3865
3865
|
*/
|
|
3866
3866
|
querySelectorAll(t) {
|
|
3867
|
-
return t = t.toUpperCase(), tt(new
|
|
3867
|
+
return t = t.toUpperCase(), tt(new Ue(this, (e) => e.nodeName && e.nodeName.toUpperCase() === t));
|
|
3868
3868
|
}
|
|
3869
3869
|
/**
|
|
3870
3870
|
* Creates YXmlEvent and calls observers.
|
|
@@ -3881,7 +3881,7 @@ class ut extends I {
|
|
|
3881
3881
|
* @return {string} The string representation of all children.
|
|
3882
3882
|
*/
|
|
3883
3883
|
toString() {
|
|
3884
|
-
return
|
|
3884
|
+
return Bs(this, (t) => t.toString()).join("");
|
|
3885
3885
|
}
|
|
3886
3886
|
/**
|
|
3887
3887
|
* @return {string}
|
|
@@ -3922,7 +3922,7 @@ class ut extends I {
|
|
|
3922
3922
|
*/
|
|
3923
3923
|
insert(t, e) {
|
|
3924
3924
|
this.doc !== null ? k(this.doc, (s) => {
|
|
3925
|
-
|
|
3925
|
+
Vs(s, this, t, e);
|
|
3926
3926
|
}) : this._prelimContent.splice(t, 0, ...e);
|
|
3927
3927
|
}
|
|
3928
3928
|
/**
|
|
@@ -3959,7 +3959,7 @@ class ut extends I {
|
|
|
3959
3959
|
*/
|
|
3960
3960
|
delete(t, e = 1) {
|
|
3961
3961
|
this.doc !== null ? k(this.doc, (s) => {
|
|
3962
|
-
|
|
3962
|
+
Hs(s, this, t, e);
|
|
3963
3963
|
}) : this._prelimContent.splice(t, e);
|
|
3964
3964
|
}
|
|
3965
3965
|
/**
|
|
@@ -3968,7 +3968,7 @@ class ut extends I {
|
|
|
3968
3968
|
* @return {Array<YXmlElement|YXmlText|YXmlHook>}
|
|
3969
3969
|
*/
|
|
3970
3970
|
toArray() {
|
|
3971
|
-
return
|
|
3971
|
+
return Rs(this);
|
|
3972
3972
|
}
|
|
3973
3973
|
/**
|
|
3974
3974
|
* Appends content to this YArray.
|
|
@@ -3993,7 +3993,7 @@ class ut extends I {
|
|
|
3993
3993
|
* @return {YXmlElement|YXmlText}
|
|
3994
3994
|
*/
|
|
3995
3995
|
get(t) {
|
|
3996
|
-
return
|
|
3996
|
+
return Ns(this, t);
|
|
3997
3997
|
}
|
|
3998
3998
|
/**
|
|
3999
3999
|
* Transforms this YArray to a JavaScript Array.
|
|
@@ -4003,7 +4003,7 @@ class ut extends I {
|
|
|
4003
4003
|
* @return {Array<YXmlElement|YXmlText>}
|
|
4004
4004
|
*/
|
|
4005
4005
|
slice(t = 0, e = this.length) {
|
|
4006
|
-
return
|
|
4006
|
+
return Os(this, t, e);
|
|
4007
4007
|
}
|
|
4008
4008
|
/**
|
|
4009
4009
|
* Executes a provided function on once on overy child element.
|
|
@@ -4162,7 +4162,7 @@ class Vt extends ut {
|
|
|
4162
4162
|
hasAttribute(t) {
|
|
4163
4163
|
return (
|
|
4164
4164
|
/** @type {any} */
|
|
4165
|
-
|
|
4165
|
+
js(this, t)
|
|
4166
4166
|
);
|
|
4167
4167
|
}
|
|
4168
4168
|
/**
|
|
@@ -4175,7 +4175,7 @@ class Vt extends ut {
|
|
|
4175
4175
|
getAttributes() {
|
|
4176
4176
|
return (
|
|
4177
4177
|
/** @type {any} */
|
|
4178
|
-
|
|
4178
|
+
$s(this)
|
|
4179
4179
|
);
|
|
4180
4180
|
}
|
|
4181
4181
|
/**
|
|
@@ -4389,7 +4389,7 @@ class mn {
|
|
|
4389
4389
|
* @type {boolean}
|
|
4390
4390
|
*/
|
|
4391
4391
|
get deleted() {
|
|
4392
|
-
throw
|
|
4392
|
+
throw N();
|
|
4393
4393
|
}
|
|
4394
4394
|
/**
|
|
4395
4395
|
* Merge this struct with the item to the right.
|
|
@@ -4407,14 +4407,14 @@ class mn {
|
|
|
4407
4407
|
* @param {number} encodingRef
|
|
4408
4408
|
*/
|
|
4409
4409
|
write(t, e, s) {
|
|
4410
|
-
throw
|
|
4410
|
+
throw N();
|
|
4411
4411
|
}
|
|
4412
4412
|
/**
|
|
4413
4413
|
* @param {Transaction} transaction
|
|
4414
4414
|
* @param {number} offset
|
|
4415
4415
|
*/
|
|
4416
4416
|
integrate(t, e) {
|
|
4417
|
-
throw
|
|
4417
|
+
throw N();
|
|
4418
4418
|
}
|
|
4419
4419
|
}
|
|
4420
4420
|
const Oo = 0;
|
|
@@ -4436,7 +4436,7 @@ class U extends mn {
|
|
|
4436
4436
|
* @param {number} offset
|
|
4437
4437
|
*/
|
|
4438
4438
|
integrate(t, e) {
|
|
4439
|
-
e > 0 && (this.id.clock += e, this.length -= e),
|
|
4439
|
+
e > 0 && (this.id.clock += e, this.length -= e), Is(t.doc.store, this);
|
|
4440
4440
|
}
|
|
4441
4441
|
/**
|
|
4442
4442
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
|
|
@@ -4490,7 +4490,7 @@ class zt {
|
|
|
4490
4490
|
* @return {ContentBinary}
|
|
4491
4491
|
*/
|
|
4492
4492
|
splice(t) {
|
|
4493
|
-
throw
|
|
4493
|
+
throw N();
|
|
4494
4494
|
}
|
|
4495
4495
|
/**
|
|
4496
4496
|
* @param {ContentBinary} right
|
|
@@ -4607,7 +4607,7 @@ class Ht {
|
|
|
4607
4607
|
return 1;
|
|
4608
4608
|
}
|
|
4609
4609
|
}
|
|
4610
|
-
const Bo = (n) => new Ht(n.readLen()),
|
|
4610
|
+
const Bo = (n) => new Ht(n.readLen()), Js = (n, t) => new gt({ guid: n, ...t, shouldLoad: t.shouldLoad || t.autoLoad || !1 });
|
|
4611
4611
|
class Yt {
|
|
4612
4612
|
/**
|
|
4613
4613
|
* @param {Doc} doc
|
|
@@ -4639,14 +4639,14 @@ class Yt {
|
|
|
4639
4639
|
* @return {ContentDoc}
|
|
4640
4640
|
*/
|
|
4641
4641
|
copy() {
|
|
4642
|
-
return new Yt(
|
|
4642
|
+
return new Yt(Js(this.doc.guid, this.opts));
|
|
4643
4643
|
}
|
|
4644
4644
|
/**
|
|
4645
4645
|
* @param {number} offset
|
|
4646
4646
|
* @return {ContentDoc}
|
|
4647
4647
|
*/
|
|
4648
4648
|
splice(t) {
|
|
4649
|
-
throw
|
|
4649
|
+
throw N();
|
|
4650
4650
|
}
|
|
4651
4651
|
/**
|
|
4652
4652
|
* @param {ContentDoc} right
|
|
@@ -4687,7 +4687,7 @@ class Yt {
|
|
|
4687
4687
|
return 9;
|
|
4688
4688
|
}
|
|
4689
4689
|
}
|
|
4690
|
-
const No = (n) => new Yt(
|
|
4690
|
+
const No = (n) => new Yt(Js(n.readString(), n.readAny()));
|
|
4691
4691
|
class pt {
|
|
4692
4692
|
/**
|
|
4693
4693
|
* @param {Object} embed
|
|
@@ -4724,7 +4724,7 @@ class pt {
|
|
|
4724
4724
|
* @return {ContentEmbed}
|
|
4725
4725
|
*/
|
|
4726
4726
|
splice(t) {
|
|
4727
|
-
throw
|
|
4727
|
+
throw N();
|
|
4728
4728
|
}
|
|
4729
4729
|
/**
|
|
4730
4730
|
* @param {ContentEmbed} right
|
|
@@ -4801,7 +4801,7 @@ class C {
|
|
|
4801
4801
|
* @return {ContentFormat}
|
|
4802
4802
|
*/
|
|
4803
4803
|
splice(t) {
|
|
4804
|
-
throw
|
|
4804
|
+
throw N();
|
|
4805
4805
|
}
|
|
4806
4806
|
/**
|
|
4807
4807
|
* @param {ContentFormat} _right
|
|
@@ -5145,7 +5145,7 @@ class G {
|
|
|
5145
5145
|
* @return {ContentType}
|
|
5146
5146
|
*/
|
|
5147
5147
|
splice(t) {
|
|
5148
|
-
throw
|
|
5148
|
+
throw N();
|
|
5149
5149
|
}
|
|
5150
5150
|
/**
|
|
5151
5151
|
* @param {ContentType} right
|
|
@@ -5226,7 +5226,7 @@ class E extends mn {
|
|
|
5226
5226
|
* @param {AbstractContent} content
|
|
5227
5227
|
*/
|
|
5228
5228
|
constructor(t, e, s, r, i, o, l, c) {
|
|
5229
|
-
super(t, c.getLength()), this.origin = s, this.left = e, this.right = r, this.rightOrigin = i, this.parent = o, this.parentSub = l, this.redone = null, this.content = c, this.info = this.content.isCountable() ?
|
|
5229
|
+
super(t, c.getLength()), this.origin = s, this.left = e, this.right = r, this.rightOrigin = i, this.parent = o, this.parentSub = l, this.redone = null, this.content = c, this.info = this.content.isCountable() ? xn : 0;
|
|
5230
5230
|
}
|
|
5231
5231
|
/**
|
|
5232
5232
|
* This is used to mark the item as an indexed fast-search marker
|
|
@@ -5234,35 +5234,35 @@ class E extends mn {
|
|
|
5234
5234
|
* @type {boolean}
|
|
5235
5235
|
*/
|
|
5236
5236
|
set marker(t) {
|
|
5237
|
-
(this.info &
|
|
5237
|
+
(this.info & Ae) > 0 !== t && (this.info ^= Ae);
|
|
5238
5238
|
}
|
|
5239
5239
|
get marker() {
|
|
5240
|
-
return (this.info &
|
|
5240
|
+
return (this.info & Ae) > 0;
|
|
5241
5241
|
}
|
|
5242
5242
|
/**
|
|
5243
5243
|
* If true, do not garbage collect this Item.
|
|
5244
5244
|
*/
|
|
5245
5245
|
get keep() {
|
|
5246
|
-
return (this.info &
|
|
5246
|
+
return (this.info & vn) > 0;
|
|
5247
5247
|
}
|
|
5248
5248
|
set keep(t) {
|
|
5249
|
-
this.keep !== t && (this.info ^=
|
|
5249
|
+
this.keep !== t && (this.info ^= vn);
|
|
5250
5250
|
}
|
|
5251
5251
|
get countable() {
|
|
5252
|
-
return (this.info &
|
|
5252
|
+
return (this.info & xn) > 0;
|
|
5253
5253
|
}
|
|
5254
5254
|
/**
|
|
5255
5255
|
* Whether this item was deleted or not.
|
|
5256
5256
|
* @type {Boolean}
|
|
5257
5257
|
*/
|
|
5258
5258
|
get deleted() {
|
|
5259
|
-
return (this.info &
|
|
5259
|
+
return (this.info & Ce) > 0;
|
|
5260
5260
|
}
|
|
5261
5261
|
set deleted(t) {
|
|
5262
|
-
this.deleted !== t && (this.info ^=
|
|
5262
|
+
this.deleted !== t && (this.info ^= Ce);
|
|
5263
5263
|
}
|
|
5264
5264
|
markDeleted() {
|
|
5265
|
-
this.info |=
|
|
5265
|
+
this.info |= Ce;
|
|
5266
5266
|
}
|
|
5267
5267
|
/**
|
|
5268
5268
|
* Return the creator clientID of the missing op or define missing items and return null.
|
|
@@ -5278,12 +5278,12 @@ class E extends mn {
|
|
|
5278
5278
|
return this.rightOrigin.client;
|
|
5279
5279
|
if (this.parent && this.parent.constructor === yt && this.id.client !== this.parent.client && this.parent.clock >= L(e, this.parent.client))
|
|
5280
5280
|
return this.parent.client;
|
|
5281
|
-
if (this.origin && (this.left =
|
|
5281
|
+
if (this.origin && (this.left = $n(t, e, this.origin), this.origin = this.left.lastId), this.rightOrigin && (this.right = et(t, this.rightOrigin), this.rightOrigin = this.right.id), this.left && this.left.constructor === U || this.right && this.right.constructor === U)
|
|
5282
5282
|
this.parent = null;
|
|
5283
5283
|
else if (!this.parent)
|
|
5284
5284
|
this.left && this.left.constructor === E && (this.parent = this.left.parent, this.parentSub = this.left.parentSub), this.right && this.right.constructor === E && (this.parent = this.right.parent, this.parentSub = this.right.parentSub);
|
|
5285
5285
|
else if (this.parent.constructor === yt) {
|
|
5286
|
-
const s =
|
|
5286
|
+
const s = ve(e, this.parent);
|
|
5287
5287
|
s.constructor === U ? this.parent = null : this.parent = /** @type {ContentType} */
|
|
5288
5288
|
s.content.type;
|
|
5289
5289
|
}
|
|
@@ -5294,7 +5294,7 @@ class E extends mn {
|
|
|
5294
5294
|
* @param {number} offset
|
|
5295
5295
|
*/
|
|
5296
5296
|
integrate(t, e) {
|
|
5297
|
-
if (e > 0 && (this.id.clock += e, this.left =
|
|
5297
|
+
if (e > 0 && (this.id.clock += e, this.left = $n(t, t.doc.store, b(this.id.client, this.id.clock - 1)), this.origin = this.left.lastId, this.content = this.content.splice(e), this.length -= e), this.parent) {
|
|
5298
5298
|
if (!this.left && (!this.right || this.right.left !== null) || this.left && this.left.right !== this.right) {
|
|
5299
5299
|
let s = this.left, r;
|
|
5300
5300
|
if (s !== null)
|
|
@@ -5313,8 +5313,8 @@ class E extends mn {
|
|
|
5313
5313
|
s = r, i.clear();
|
|
5314
5314
|
else if (Pt(this.rightOrigin, r.rightOrigin))
|
|
5315
5315
|
break;
|
|
5316
|
-
} else if (r.origin !== null && o.has(
|
|
5317
|
-
i.has(
|
|
5316
|
+
} else if (r.origin !== null && o.has(ve(t.doc.store, r.origin)))
|
|
5317
|
+
i.has(ve(t.doc.store, r.origin)) || (s = r, i.clear());
|
|
5318
5318
|
else
|
|
5319
5319
|
break;
|
|
5320
5320
|
r = r.right;
|
|
@@ -5335,7 +5335,7 @@ class E extends mn {
|
|
|
5335
5335
|
this.parent._start, this.parent._start = this;
|
|
5336
5336
|
this.right = s;
|
|
5337
5337
|
}
|
|
5338
|
-
this.right !== null ? this.right.left = this : this.parentSub !== null && (this.parent._map.set(this.parentSub, this), this.left !== null && this.left.delete(t)), this.parentSub === null && this.countable && !this.deleted && (this.parent._length += this.length),
|
|
5338
|
+
this.right !== null ? this.right.left = this : this.parentSub !== null && (this.parent._map.set(this.parentSub, this), this.left !== null && this.left.delete(t)), this.parentSub === null && this.countable && !this.deleted && (this.parent._length += this.length), Is(t.doc.store, this), this.content.integrate(t, this), Kn(
|
|
5339
5339
|
t,
|
|
5340
5340
|
/** @type {AbstractType<any>} */
|
|
5341
5341
|
this.parent,
|
|
@@ -5399,7 +5399,7 @@ class E extends mn {
|
|
|
5399
5399
|
/** @type {AbstractType<any>} */
|
|
5400
5400
|
this.parent
|
|
5401
5401
|
);
|
|
5402
|
-
this.countable && this.parentSub === null && (e._length -= this.length), this.markDeleted(), ie(t.deleteSet, this.id.client, this.id.clock, this.length),
|
|
5402
|
+
this.countable && this.parentSub === null && (e._length -= this.length), this.markDeleted(), ie(t.deleteSet, this.id.client, this.id.clock, this.length), Kn(t, e, this.parentSub), this.content.delete(t);
|
|
5403
5403
|
}
|
|
5404
5404
|
}
|
|
5405
5405
|
/**
|
|
@@ -5443,7 +5443,7 @@ class E extends mn {
|
|
|
5443
5443
|
this.content.write(t, e);
|
|
5444
5444
|
}
|
|
5445
5445
|
}
|
|
5446
|
-
const
|
|
5446
|
+
const Ws = (n, t) => Zo[t & ge](n), Zo = [
|
|
5447
5447
|
() => {
|
|
5448
5448
|
V();
|
|
5449
5449
|
},
|
|
@@ -5507,13 +5507,13 @@ class T extends mn {
|
|
|
5507
5507
|
return null;
|
|
5508
5508
|
}
|
|
5509
5509
|
}
|
|
5510
|
-
const
|
|
5510
|
+
const Gs = (
|
|
5511
5511
|
/** @type {any} */
|
|
5512
5512
|
typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : {}
|
|
5513
|
-
),
|
|
5514
|
-
Ps
|
|
5515
|
-
Ps
|
|
5516
|
-
const
|
|
5513
|
+
), Ps = "__ $YJS$ __";
|
|
5514
|
+
Gs[Ps] === !0 && console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");
|
|
5515
|
+
Gs[Ps] = !0;
|
|
5516
|
+
const qs = /* @__PURE__ */ new Map();
|
|
5517
5517
|
class tl {
|
|
5518
5518
|
/**
|
|
5519
5519
|
* @param {string} room
|
|
@@ -5525,13 +5525,13 @@ class tl {
|
|
|
5525
5525
|
* @param {ArrayBuffer} buf
|
|
5526
5526
|
*/
|
|
5527
5527
|
postMessage(t) {
|
|
5528
|
-
|
|
5528
|
+
ns.setItem(this.room, ai(ri(t)));
|
|
5529
5529
|
}
|
|
5530
5530
|
close() {
|
|
5531
5531
|
Tr(this._onChange);
|
|
5532
5532
|
}
|
|
5533
5533
|
}
|
|
5534
|
-
const el = typeof BroadcastChannel > "u" ? tl : BroadcastChannel, yn = (n) => J(
|
|
5534
|
+
const el = typeof BroadcastChannel > "u" ? tl : BroadcastChannel, yn = (n) => J(qs, n, () => {
|
|
5535
5535
|
const t = lt(), e = new el(n);
|
|
5536
5536
|
return e.onmessage = (s) => t.forEach((r) => r(s.data, "broadcastchannel")), {
|
|
5537
5537
|
bc: e,
|
|
@@ -5539,34 +5539,34 @@ const el = typeof BroadcastChannel > "u" ? tl : BroadcastChannel, yn = (n) => J(
|
|
|
5539
5539
|
};
|
|
5540
5540
|
}), nl = (n, t) => (yn(n).subs.add(t), t), sl = (n, t) => {
|
|
5541
5541
|
const e = yn(n), s = e.subs.delete(t);
|
|
5542
|
-
return s && e.subs.size === 0 && (e.bc.close(),
|
|
5542
|
+
return s && e.subs.size === 0 && (e.bc.close(), qs.delete(n)), s;
|
|
5543
5543
|
}, mt = (n, t, e = null) => {
|
|
5544
5544
|
const s = yn(n);
|
|
5545
5545
|
s.bc.postMessage(t), s.subs.forEach((r) => r(t, e));
|
|
5546
|
-
},
|
|
5547
|
-
p(n,
|
|
5546
|
+
}, Zs = 0, bn = 1, Qs = 2, Xe = (n, t) => {
|
|
5547
|
+
p(n, Zs);
|
|
5548
5548
|
const e = Qi(t);
|
|
5549
5549
|
D(n, e);
|
|
5550
|
-
},
|
|
5550
|
+
}, tr = (n, t, e) => {
|
|
5551
5551
|
p(n, bn), D(n, hn(t, e));
|
|
5552
|
-
}, rl = (n, t, e) =>
|
|
5552
|
+
}, rl = (n, t, e) => tr(t, e, M(n)), er = (n, t, e) => {
|
|
5553
5553
|
try {
|
|
5554
|
-
|
|
5554
|
+
Ds(t, M(n), e);
|
|
5555
5555
|
} catch (s) {
|
|
5556
5556
|
console.error("Caught error while handling a Yjs update", s);
|
|
5557
5557
|
}
|
|
5558
5558
|
}, il = (n, t) => {
|
|
5559
|
-
p(n,
|
|
5560
|
-
}, ol =
|
|
5559
|
+
p(n, Qs), D(n, t);
|
|
5560
|
+
}, ol = er, ll = (n, t, e, s) => {
|
|
5561
5561
|
const r = m(n);
|
|
5562
5562
|
switch (r) {
|
|
5563
|
-
case
|
|
5563
|
+
case Zs:
|
|
5564
5564
|
rl(n, t, e);
|
|
5565
5565
|
break;
|
|
5566
5566
|
case bn:
|
|
5567
|
-
|
|
5567
|
+
er(n, e, s);
|
|
5568
5568
|
break;
|
|
5569
|
-
case
|
|
5569
|
+
case Qs:
|
|
5570
5570
|
ol(n, e, s);
|
|
5571
5571
|
break;
|
|
5572
5572
|
default:
|
|
@@ -5578,7 +5578,7 @@ const el = typeof BroadcastChannel > "u" ? tl : BroadcastChannel, yn = (n) => J(
|
|
|
5578
5578
|
case cl:
|
|
5579
5579
|
e(t, Z(n));
|
|
5580
5580
|
}
|
|
5581
|
-
},
|
|
5581
|
+
}, Te = 3e4;
|
|
5582
5582
|
class hl extends fe {
|
|
5583
5583
|
/**
|
|
5584
5584
|
* @param {Y.Doc} doc
|
|
@@ -5587,13 +5587,13 @@ class hl extends fe {
|
|
|
5587
5587
|
super(), this.doc = t, this.clientID = t.clientID, this.states = /* @__PURE__ */ new Map(), this.meta = /* @__PURE__ */ new Map(), this._checkInterval = /** @type {any} */
|
|
5588
5588
|
setInterval(() => {
|
|
5589
5589
|
const e = ct();
|
|
5590
|
-
this.getLocalState() !== null &&
|
|
5590
|
+
this.getLocalState() !== null && Te / 2 <= e - /** @type {{lastUpdated:number}} */
|
|
5591
5591
|
this.meta.get(this.clientID).lastUpdated && this.setLocalState(this.getLocalState());
|
|
5592
5592
|
const s = [];
|
|
5593
5593
|
this.meta.forEach((r, i) => {
|
|
5594
|
-
i !== this.clientID &&
|
|
5594
|
+
i !== this.clientID && Te <= e - r.lastUpdated && this.states.has(i) && s.push(i);
|
|
5595
5595
|
}), s.length > 0 && kn(this, s, "timeout");
|
|
5596
|
-
}, Y(
|
|
5596
|
+
}, Y(Te / 10)), t.on("destroy", () => {
|
|
5597
5597
|
this.destroy();
|
|
5598
5598
|
}), this.setLocalState({});
|
|
5599
5599
|
}
|
|
@@ -5687,7 +5687,7 @@ const kn = (n, t, e) => {
|
|
|
5687
5687
|
removed: c
|
|
5688
5688
|
}, e]);
|
|
5689
5689
|
}, dl = (n) => Nr(n, (t, e) => `${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&");
|
|
5690
|
-
var st = 0,
|
|
5690
|
+
var st = 0, nr = 3, kt = 1, fl = 2, gl = typeof window > "u";
|
|
5691
5691
|
function pl(n, t) {
|
|
5692
5692
|
if (!n)
|
|
5693
5693
|
throw new Error(t);
|
|
@@ -5703,7 +5703,7 @@ Xt[st] = (n, t, e, s, r) => {
|
|
|
5703
5703
|
);
|
|
5704
5704
|
s && i === bn && !e.synced && (e.synced = !0);
|
|
5705
5705
|
};
|
|
5706
|
-
Xt[
|
|
5706
|
+
Xt[nr] = (n, t, e, s, r) => {
|
|
5707
5707
|
p(n, kt), D(
|
|
5708
5708
|
n,
|
|
5709
5709
|
Ut(
|
|
@@ -5726,23 +5726,23 @@ Xt[fl] = (n, t, e, s, r) => {
|
|
|
5726
5726
|
(i, o) => wl(e, o)
|
|
5727
5727
|
);
|
|
5728
5728
|
};
|
|
5729
|
-
var
|
|
5729
|
+
var Wn = 3e4;
|
|
5730
5730
|
function wl(n, t) {
|
|
5731
5731
|
console.warn(`Permission denied to access ${n.url}.
|
|
5732
5732
|
${t}`);
|
|
5733
5733
|
}
|
|
5734
|
-
function
|
|
5734
|
+
function sr(n, t, e) {
|
|
5735
5735
|
const s = nt(t), r = v(), i = m(s), o = n.messageHandlers[i];
|
|
5736
5736
|
return /** @type {any} */ o ? o(r, s, n, e, i) : console.error("Unable to compute message"), r;
|
|
5737
5737
|
}
|
|
5738
|
-
function
|
|
5738
|
+
function rr(n) {
|
|
5739
5739
|
if (n.shouldConnect && n.ws === null) {
|
|
5740
5740
|
const t = new n._WS(n.url);
|
|
5741
5741
|
t.binaryType = "arraybuffer", n.ws = t, n.wsconnecting = !0, n.wsconnected = !1, n.synced = !1, t.onmessage = (e) => {
|
|
5742
5742
|
if (typeof e.data == "string")
|
|
5743
5743
|
return;
|
|
5744
5744
|
n.wsLastMessageReceived = ct();
|
|
5745
|
-
const s =
|
|
5745
|
+
const s = sr(n, new Uint8Array(e.data), !0);
|
|
5746
5746
|
nn(s) > 1 && t.send(_(s));
|
|
5747
5747
|
}, t.onerror = (e) => {
|
|
5748
5748
|
n.emit("connection-error", [e, n]);
|
|
@@ -5758,7 +5758,7 @@ function ir(n) {
|
|
|
5758
5758
|
status: "disconnected"
|
|
5759
5759
|
}
|
|
5760
5760
|
])) : n.wsUnsuccessfulReconnects++, setTimeout(
|
|
5761
|
-
|
|
5761
|
+
rr,
|
|
5762
5762
|
Pe(
|
|
5763
5763
|
Sr(2, n.wsUnsuccessfulReconnects) * 100,
|
|
5764
5764
|
n.maxBackoffTime
|
|
@@ -5772,7 +5772,7 @@ function ir(n) {
|
|
|
5772
5772
|
}
|
|
5773
5773
|
]);
|
|
5774
5774
|
const e = v();
|
|
5775
|
-
if (p(e, st),
|
|
5775
|
+
if (p(e, st), Xe(e, n.doc), t.send(_(e)), n.awareness.getLocalState() !== null) {
|
|
5776
5776
|
const s = v();
|
|
5777
5777
|
p(s, kt), D(
|
|
5778
5778
|
s,
|
|
@@ -5788,7 +5788,7 @@ function ir(n) {
|
|
|
5788
5788
|
]);
|
|
5789
5789
|
}
|
|
5790
5790
|
}
|
|
5791
|
-
function
|
|
5791
|
+
function Oe(n, t) {
|
|
5792
5792
|
const e = n.ws;
|
|
5793
5793
|
n.wsconnected && e && e.readyState === e.OPEN && e.send(t), n.bcconnected && mt(n.bcChannel, t, n);
|
|
5794
5794
|
}
|
|
@@ -5838,24 +5838,24 @@ var ml = class extends fe {
|
|
|
5838
5838
|
setInterval(() => {
|
|
5839
5839
|
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
|
5840
5840
|
const u = v();
|
|
5841
|
-
p(u, st),
|
|
5841
|
+
p(u, st), Xe(u, s), this.ws.send(_(u));
|
|
5842
5842
|
}
|
|
5843
5843
|
}, c)), this._bcSubscriber = (u, f) => {
|
|
5844
5844
|
if (f !== this) {
|
|
5845
|
-
const g =
|
|
5845
|
+
const g = sr(this, new Uint8Array(u), !1);
|
|
5846
5846
|
nn(g) > 1 && mt(this.bcChannel, _(g), this);
|
|
5847
5847
|
}
|
|
5848
5848
|
}, this._updateHandler = (u, f) => {
|
|
5849
5849
|
if (f !== this) {
|
|
5850
5850
|
const g = v();
|
|
5851
|
-
p(g, st), il(g, u),
|
|
5851
|
+
p(g, st), il(g, u), Oe(this, _(g));
|
|
5852
5852
|
}
|
|
5853
5853
|
}, this.doc.on("update", this._updateHandler), this._awarenessUpdateHandler = ({ added: u, updated: f, removed: g }, w) => {
|
|
5854
5854
|
const S = u.concat(f).concat(g), j = v();
|
|
5855
5855
|
p(j, kt), D(
|
|
5856
5856
|
j,
|
|
5857
5857
|
Ut(i, S)
|
|
5858
|
-
),
|
|
5858
|
+
), Oe(this, _(j));
|
|
5859
5859
|
}, this._unloadHandler = () => {
|
|
5860
5860
|
kn(
|
|
5861
5861
|
this.awareness,
|
|
@@ -5864,8 +5864,8 @@ var ml = class extends fe {
|
|
|
5864
5864
|
);
|
|
5865
5865
|
}, typeof window < "u" ? window.addEventListener("unload", this._unloadHandler) : typeof process < "u" && process.on("exit", this._unloadHandler), i.on("update", this._awarenessUpdateHandler), this._checkInterval = /** @type {any} */
|
|
5866
5866
|
setInterval(() => {
|
|
5867
|
-
this.wsconnected &&
|
|
5868
|
-
},
|
|
5867
|
+
this.wsconnected && Wn < ct() - this.wsLastMessageReceived && (pl(this.ws !== null, "ws must not be null"), this.ws.close());
|
|
5868
|
+
}, Wn / 10), r && this.connect();
|
|
5869
5869
|
}
|
|
5870
5870
|
/**
|
|
5871
5871
|
* @type {boolean}
|
|
@@ -5884,11 +5884,11 @@ var ml = class extends fe {
|
|
|
5884
5884
|
return;
|
|
5885
5885
|
this.bcconnected || (nl(this.bcChannel, this._bcSubscriber), this.bcconnected = !0);
|
|
5886
5886
|
const t = v();
|
|
5887
|
-
p(t, st),
|
|
5887
|
+
p(t, st), Xe(t, this.doc), mt(this.bcChannel, _(t), this);
|
|
5888
5888
|
const e = v();
|
|
5889
|
-
p(e, st),
|
|
5889
|
+
p(e, st), tr(e, this.doc), mt(this.bcChannel, _(e), this);
|
|
5890
5890
|
const s = v();
|
|
5891
|
-
p(s,
|
|
5891
|
+
p(s, nr), mt(
|
|
5892
5892
|
this.bcChannel,
|
|
5893
5893
|
_(s),
|
|
5894
5894
|
this
|
|
@@ -5914,13 +5914,13 @@ var ml = class extends fe {
|
|
|
5914
5914
|
[this.doc.clientID],
|
|
5915
5915
|
/* @__PURE__ */ new Map()
|
|
5916
5916
|
)
|
|
5917
|
-
),
|
|
5917
|
+
), Oe(this, _(t)), this.bcconnected && (sl(this.bcChannel, this._bcSubscriber), this.bcconnected = !1);
|
|
5918
5918
|
}
|
|
5919
5919
|
disconnect() {
|
|
5920
5920
|
this.shouldConnect = !1, this.disconnectBc(), this.ws !== null && this.ws.close();
|
|
5921
5921
|
}
|
|
5922
5922
|
connect() {
|
|
5923
|
-
this.shouldConnect = !0, !this.wsconnected && this.ws === null && (
|
|
5923
|
+
this.shouldConnect = !0, !this.wsconnected && this.ws === null && (rr(this), this.connectBc());
|
|
5924
5924
|
}
|
|
5925
5925
|
};
|
|
5926
5926
|
function yl() {
|
|
@@ -5932,7 +5932,7 @@ function yl() {
|
|
|
5932
5932
|
return n > 0 ? (s = (n + s) % 16 | 0, n = Math.floor(n / 16)) : (s = (t + s) % 16 | 0, t = Math.floor(t / 16)), (e === "x" ? s : s & 3 | 8).toString(16);
|
|
5933
5933
|
});
|
|
5934
5934
|
}
|
|
5935
|
-
function
|
|
5935
|
+
function Gn(n, t, e) {
|
|
5936
5936
|
if (typeof n !== e)
|
|
5937
5937
|
throw new Error(
|
|
5938
5938
|
`Invalid "${t}" parameter provided to YPartyKitProvider. Expected: ${e}, received: ${n}`
|
|
@@ -5942,9 +5942,9 @@ var bl = class extends WebSocket {
|
|
|
5942
5942
|
send(n) {
|
|
5943
5943
|
typeof n != "string" && mr(n, (t) => super.send(t));
|
|
5944
5944
|
}
|
|
5945
|
-
}, rt,
|
|
5945
|
+
}, rt, Qn, kl = (Qn = class extends ml {
|
|
5946
5946
|
constructor(t, e, s, r = {}) {
|
|
5947
|
-
|
|
5947
|
+
Gn(t, "host", "string"), Gn(e, "room", "string"), t = t.replace(/^(http|https|ws|wss):\/\//, ""), t.endsWith("/") && t.slice(0, -1);
|
|
5948
5948
|
const i = `${t.startsWith("localhost:") || t.startsWith("127.0.0.1:") ? "ws" : "wss"}://${t}${r.party ? `/parties/${r.party}` : "/party"}`, o = r.connectionId ?? yl(), { params: l, connect: c = !0, ...a } = r, h = {
|
|
5949
5949
|
...a,
|
|
5950
5950
|
connect: !1,
|
|
@@ -5952,8 +5952,8 @@ var bl = class extends WebSocket {
|
|
|
5952
5952
|
};
|
|
5953
5953
|
super(i, e, s ?? new gt(), h);
|
|
5954
5954
|
y(this, "id");
|
|
5955
|
-
|
|
5956
|
-
this.id = o,
|
|
5955
|
+
Dn(this, rt, void 0);
|
|
5956
|
+
this.id = o, En(this, rt, l), c && this.connect();
|
|
5957
5957
|
}
|
|
5958
5958
|
connect() {
|
|
5959
5959
|
Promise.resolve(
|
|
@@ -5969,7 +5969,7 @@ var bl = class extends WebSocket {
|
|
|
5969
5969
|
throw console.error("Failed to open connecton to PartyKit", t), new Error(t);
|
|
5970
5970
|
});
|
|
5971
5971
|
}
|
|
5972
|
-
}, rt = new WeakMap(),
|
|
5972
|
+
}, rt = new WeakMap(), Qn);
|
|
5973
5973
|
const wt = (n) => Dt((t, e) => {
|
|
5974
5974
|
n.onerror = (s) => e(new Error(s.target.error)), n.onsuccess = (s) => t(s.target.result);
|
|
5975
5975
|
}), _l = (n, t) => Dt((e, s) => {
|
|
@@ -5988,7 +5988,7 @@ const wt = (n) => Dt((t, e) => {
|
|
|
5988
5988
|
), Mt = (n, t, e = "readwrite") => {
|
|
5989
5989
|
const s = n.transaction(t, e);
|
|
5990
5990
|
return t.map((r) => xl(s, r));
|
|
5991
|
-
},
|
|
5991
|
+
}, ir = (n, t) => wt(n.count(t)), El = (n, t) => wt(n.get(t)), or = (n, t) => wt(n.delete(t)), Cl = (n, t, e) => wt(n.put(t, e)), Je = (n, t) => wt(n.add(t)), Al = (n, t, e) => wt(n.getAll(t, e)), Ll = (n, t, e) => {
|
|
5992
5992
|
let s = null;
|
|
5993
5993
|
return vl(n, t, (r) => (s = r, !1), e).then(() => s);
|
|
5994
5994
|
}, Il = (n, t = null) => Ll(n, t, "prev"), Ml = (n, t) => Dt((e, s) => {
|
|
@@ -5998,25 +5998,25 @@ const wt = (n) => Dt((t, e) => {
|
|
|
5998
5998
|
return e();
|
|
5999
5999
|
i.continue();
|
|
6000
6000
|
};
|
|
6001
|
-
}), vl = (n, t, e, s = "next") => Ml(n.openKeyCursor(t, s), (r) => e(r.key)), xl = (n, t) => n.objectStore(t), Ul = (n, t) => IDBKeyRange.upperBound(n, t), Tl = (n, t) => IDBKeyRange.lowerBound(n, t),
|
|
6001
|
+
}), vl = (n, t, e, s = "next") => Ml(n.openKeyCursor(t, s), (r) => e(r.key)), xl = (n, t) => n.objectStore(t), Ul = (n, t) => IDBKeyRange.upperBound(n, t), Tl = (n, t) => IDBKeyRange.lowerBound(n, t), Re = "custom", lr = "updates", cr = 500, ar = (n, t = () => {
|
|
6002
6002
|
}, e = () => {
|
|
6003
6003
|
}) => {
|
|
6004
6004
|
const [s] = Mt(
|
|
6005
6005
|
/** @type {IDBDatabase} */
|
|
6006
6006
|
n.db,
|
|
6007
|
-
[
|
|
6007
|
+
[lr]
|
|
6008
6008
|
);
|
|
6009
6009
|
return Al(s, Tl(n._dbref, !1)).then((r) => {
|
|
6010
6010
|
n._destroyed || (t(s), k(n.doc, () => {
|
|
6011
|
-
r.forEach((i) =>
|
|
6011
|
+
r.forEach((i) => Ds(n.doc, i));
|
|
6012
6012
|
}, n, !1), e(s));
|
|
6013
6013
|
}).then(() => Il(s).then((r) => {
|
|
6014
6014
|
n._dbref = r + 1;
|
|
6015
|
-
})).then(() =>
|
|
6015
|
+
})).then(() => ir(s).then((r) => {
|
|
6016
6016
|
n._dbsize = r;
|
|
6017
6017
|
})).then(() => s);
|
|
6018
|
-
}, Ol = (n, t = !0) =>
|
|
6019
|
-
(t || n._dbsize >=
|
|
6018
|
+
}, Ol = (n, t = !0) => ar(n).then((e) => {
|
|
6019
|
+
(t || n._dbsize >= cr) && Je(e, hn(n.doc)).then(() => or(e, Ul(n._dbref, !0))).then(() => ir(e).then((s) => {
|
|
6020
6020
|
n._dbsize = s;
|
|
6021
6021
|
}));
|
|
6022
6022
|
});
|
|
@@ -6033,7 +6033,7 @@ class Rl extends fe {
|
|
|
6033
6033
|
["custom"]
|
|
6034
6034
|
])
|
|
6035
6035
|
), this.whenSynced = Dt((s) => this.on("synced", () => s(this))), this._db.then((s) => {
|
|
6036
|
-
this.db = s,
|
|
6036
|
+
this.db = s, ar(this, (o) => Je(o, hn(e)), () => {
|
|
6037
6037
|
if (this._destroyed)
|
|
6038
6038
|
return this;
|
|
6039
6039
|
this.synced = !0, this.emit("synced", [this]);
|
|
@@ -6043,9 +6043,9 @@ class Rl extends fe {
|
|
|
6043
6043
|
const [i] = Mt(
|
|
6044
6044
|
/** @type {IDBDatabase} */
|
|
6045
6045
|
this.db,
|
|
6046
|
-
[
|
|
6046
|
+
[lr]
|
|
6047
6047
|
);
|
|
6048
|
-
|
|
6048
|
+
Je(i, s), ++this._dbsize >= cr && (this._storeTimeoutId !== null && clearTimeout(this._storeTimeoutId), this._storeTimeoutId = setTimeout(() => {
|
|
6049
6049
|
Ol(this, !1), this._storeTimeoutId = null;
|
|
6050
6050
|
}, this._storeTimeout));
|
|
6051
6051
|
}
|
|
@@ -6072,7 +6072,7 @@ class Rl extends fe {
|
|
|
6072
6072
|
*/
|
|
6073
6073
|
get(t) {
|
|
6074
6074
|
return this._db.then((e) => {
|
|
6075
|
-
const [s] = Mt(e, [
|
|
6075
|
+
const [s] = Mt(e, [Re], "readonly");
|
|
6076
6076
|
return El(s, t);
|
|
6077
6077
|
});
|
|
6078
6078
|
}
|
|
@@ -6083,7 +6083,7 @@ class Rl extends fe {
|
|
|
6083
6083
|
*/
|
|
6084
6084
|
set(t, e) {
|
|
6085
6085
|
return this._db.then((s) => {
|
|
6086
|
-
const [r] = Mt(s, [
|
|
6086
|
+
const [r] = Mt(s, [Re]);
|
|
6087
6087
|
return Cl(r, e, t);
|
|
6088
6088
|
});
|
|
6089
6089
|
}
|
|
@@ -6093,8 +6093,8 @@ class Rl extends fe {
|
|
|
6093
6093
|
*/
|
|
6094
6094
|
del(t) {
|
|
6095
6095
|
return this._db.then((e) => {
|
|
6096
|
-
const [s] = Mt(e, [
|
|
6097
|
-
return
|
|
6096
|
+
const [s] = Mt(e, [Re]);
|
|
6097
|
+
return or(s, t);
|
|
6098
6098
|
});
|
|
6099
6099
|
}
|
|
6100
6100
|
}
|
|
@@ -6108,10 +6108,10 @@ var _e = /* @__PURE__ */ ((n) => (n.CanPlay = "can-play", n.CanMove = "can-move"
|
|
|
6108
6108
|
function Fl(n) {
|
|
6109
6109
|
return n.id;
|
|
6110
6110
|
}
|
|
6111
|
-
const
|
|
6111
|
+
const hr = `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='44' height='53' viewport='0 0 100 100' style='fill:black;font-size:26px;'><text y='40%'>🚿</text></svg>")
|
|
6112
6112
|
16 0,
|
|
6113
6113
|
auto`, Vl = `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='48' viewport='0 0 100 100' style='fill:black;font-size:24px;'><text y='50%'>✂️</text></svg>") 16 0,auto`;
|
|
6114
|
-
function
|
|
6114
|
+
function Pn(n, { getData: t, getElement: e, getLocalData: s, setLocalData: r }) {
|
|
6115
6115
|
const i = t(), o = s(), l = e();
|
|
6116
6116
|
if (o.isHovering = !0, n.altKey) {
|
|
6117
6117
|
if (i.scale <= 0.5) {
|
|
@@ -6124,7 +6124,7 @@ function qn(n, { getData: t, getElement: e, getLocalData: s, setLocalData: r })
|
|
|
6124
6124
|
l.style.cursor = "not-allowed";
|
|
6125
6125
|
return;
|
|
6126
6126
|
}
|
|
6127
|
-
l.style.cursor =
|
|
6127
|
+
l.style.cursor = hr;
|
|
6128
6128
|
}
|
|
6129
6129
|
r(o);
|
|
6130
6130
|
}
|
|
@@ -6187,12 +6187,14 @@ const Hl = {
|
|
|
6187
6187
|
"can-toggle"
|
|
6188
6188
|
/* CanToggle */
|
|
6189
6189
|
]: {
|
|
6190
|
-
defaultData: !1,
|
|
6190
|
+
defaultData: { on: !1 },
|
|
6191
6191
|
updateElement: ({ element: n, data: t }) => {
|
|
6192
|
-
|
|
6192
|
+
const e = typeof t == "object" ? t.on : t;
|
|
6193
|
+
n.classList.toggle("clicked", e);
|
|
6193
6194
|
},
|
|
6194
6195
|
onClick: (n, { data: t, setData: e }) => {
|
|
6195
|
-
|
|
6196
|
+
const s = typeof t == "object" ? t.on : t;
|
|
6197
|
+
e({ on: !s });
|
|
6196
6198
|
},
|
|
6197
6199
|
resetShortcut: "shiftKey"
|
|
6198
6200
|
},
|
|
@@ -6212,7 +6214,7 @@ const Hl = {
|
|
|
6212
6214
|
return;
|
|
6213
6215
|
i -= 0.1;
|
|
6214
6216
|
} else {
|
|
6215
|
-
if (e.style.cursor =
|
|
6217
|
+
if (e.style.cursor = hr, t.scale >= r.maxScale)
|
|
6216
6218
|
return;
|
|
6217
6219
|
i += 0.1;
|
|
6218
6220
|
}
|
|
@@ -6220,8 +6222,8 @@ const Hl = {
|
|
|
6220
6222
|
},
|
|
6221
6223
|
additionalSetup: (n) => {
|
|
6222
6224
|
n.getElement().addEventListener("mouseenter", (t) => {
|
|
6223
|
-
|
|
6224
|
-
const e = (s) =>
|
|
6225
|
+
Pn(t, n);
|
|
6226
|
+
const e = (s) => Pn(s, n);
|
|
6225
6227
|
document.addEventListener("keydown", e), document.addEventListener("keyup", e), n.getElement().addEventListener("mouseleave", (s) => {
|
|
6226
6228
|
document.removeEventListener("keydown", e), document.removeEventListener("keyup", e);
|
|
6227
6229
|
});
|
|
@@ -6291,7 +6293,7 @@ const Hl = {
|
|
|
6291
6293
|
), !0) : !1;
|
|
6292
6294
|
}
|
|
6293
6295
|
}
|
|
6294
|
-
},
|
|
6296
|
+
}, qn = (n, t = 300) => {
|
|
6295
6297
|
let e;
|
|
6296
6298
|
return function(...s) {
|
|
6297
6299
|
clearTimeout(e), e = setTimeout(() => n.apply(this, s), t);
|
|
@@ -6333,7 +6335,7 @@ class $l {
|
|
|
6333
6335
|
debounceMs: f,
|
|
6334
6336
|
triggerAwarenessUpdate: g
|
|
6335
6337
|
} = t;
|
|
6336
|
-
this.element = e, this.defaultData = i instanceof Function ? i(e) : i, this.localData = o instanceof Function ? o(e) : o, this.triggerAwarenessUpdate = g, this.onChange = s, this.debouncedOnChange =
|
|
6338
|
+
this.element = e, this.defaultData = i instanceof Function ? i(e) : i, this.localData = o instanceof Function ? o(e) : o, this.triggerAwarenessUpdate = g, this.onChange = s, this.debouncedOnChange = qn(this.onChange, f), this.onAwarenessChange = r, this.updateElement = h, this.updateElementAwareness = d;
|
|
6337
6339
|
const w = c === void 0 ? this.defaultData : c;
|
|
6338
6340
|
a !== void 0 && (this.__awareness = a);
|
|
6339
6341
|
const S = l instanceof Function ? l(e) : l;
|
|
@@ -6352,7 +6354,7 @@ class $l {
|
|
|
6352
6354
|
debounceMs: h,
|
|
6353
6355
|
triggerAwarenessUpdate: d
|
|
6354
6356
|
}) {
|
|
6355
|
-
this.triggerAwarenessUpdate = d, this.onChange = e, this.debouncedOnChange =
|
|
6357
|
+
this.triggerAwarenessUpdate = d, this.onChange = e, this.debouncedOnChange = qn(this.onChange, h), this.onAwarenessChange = s, this.updateElement = r, this.updateElementAwareness = i, o && !this.onClick && t.addEventListener("click", (u) => {
|
|
6356
6358
|
var f;
|
|
6357
6359
|
(f = this.onClick) == null || f.call(this, u, this.getEventHandlerData());
|
|
6358
6360
|
}), this.onClick = o, l && !this.onDrag && (t.addEventListener("touchstart", (u) => {
|
|
@@ -6466,17 +6468,17 @@ class $l {
|
|
|
6466
6468
|
this.setData(this.defaultData);
|
|
6467
6469
|
}
|
|
6468
6470
|
}
|
|
6469
|
-
const jl = "playhtml.spencerc99.partykit.dev",
|
|
6471
|
+
const jl = "playhtml.spencerc99.partykit.dev", Be = new gt();
|
|
6470
6472
|
function Kl() {
|
|
6471
6473
|
return window.location.pathname + window.location.search;
|
|
6472
6474
|
}
|
|
6473
|
-
let Q,
|
|
6474
|
-
const
|
|
6475
|
+
let Q, F, O;
|
|
6476
|
+
const Zn = /* @__PURE__ */ new Map();
|
|
6475
6477
|
let Jt = Hl;
|
|
6476
|
-
function
|
|
6478
|
+
function ur() {
|
|
6477
6479
|
return [_e.CanPlay, ...Object.keys(Jt)];
|
|
6478
6480
|
}
|
|
6479
|
-
let
|
|
6481
|
+
let Se = !1, We = !0;
|
|
6480
6482
|
function zl({
|
|
6481
6483
|
// TODO: if it is a localhost url, need to make some deterministic way to connect to the same room.
|
|
6482
6484
|
room: n = Kl(),
|
|
@@ -6495,22 +6497,22 @@ function zl({
|
|
|
6495
6497
|
࿂࿂࿂࿂ https://playhtml.fun ࿂࿂࿂࿂
|
|
6496
6498
|
࿂࿂࿂࿂ ࿂ ࿂ ࿂ ࿂ ࿂࿂࿂࿂
|
|
6497
6499
|
࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂`
|
|
6498
|
-
), Q = new kl(r, s,
|
|
6500
|
+
), Q = new kl(r, s, Be), F = Be.getMap("playhtml-global"), O = /* @__PURE__ */ new Map(), new Rl(s, Be), Ge.globalData = F, Ge.elementHandlers = O, e)
|
|
6499
6501
|
for (const [i, o] of Object.entries(e))
|
|
6500
6502
|
Jt[i] = o;
|
|
6501
6503
|
return Q.on("sync", (i) => {
|
|
6502
|
-
i || console.error("Issue connecting to yjs..."),
|
|
6504
|
+
i || console.error("Issue connecting to yjs..."), Se = !0, console.log("[PLAYHTML]: Setting up elements... Time to have some fun 🛝"), fr();
|
|
6503
6505
|
}), Q;
|
|
6504
6506
|
}
|
|
6505
6507
|
function Yl(n, t) {
|
|
6506
6508
|
const e = Q.awareness.getLocalState();
|
|
6507
6509
|
return ((e == null ? void 0 : e[n]) ?? {})[t];
|
|
6508
6510
|
}
|
|
6509
|
-
function
|
|
6511
|
+
function _n(n) {
|
|
6510
6512
|
return n instanceof HTMLElement;
|
|
6511
6513
|
}
|
|
6512
6514
|
function Xl(n, t, e, s) {
|
|
6513
|
-
const r =
|
|
6515
|
+
const r = F.get(t);
|
|
6514
6516
|
return {
|
|
6515
6517
|
...e,
|
|
6516
6518
|
data: r.get(s) ?? e.defaultData,
|
|
@@ -6562,7 +6564,7 @@ function dr() {
|
|
|
6562
6564
|
Q.awareness.getStates().forEach((e, s) => {
|
|
6563
6565
|
var r;
|
|
6564
6566
|
for (const [i, o] of Object.entries(e)) {
|
|
6565
|
-
const l =
|
|
6567
|
+
const l = O.get(i);
|
|
6566
6568
|
if (l)
|
|
6567
6569
|
for (const [c, a] of l) {
|
|
6568
6570
|
if (!(c in o))
|
|
@@ -6577,7 +6579,7 @@ function dr() {
|
|
|
6577
6579
|
}
|
|
6578
6580
|
}
|
|
6579
6581
|
for (const [i, o] of n) {
|
|
6580
|
-
const l =
|
|
6582
|
+
const l = O.get(i);
|
|
6581
6583
|
if (l)
|
|
6582
6584
|
for (const [c, a] of l) {
|
|
6583
6585
|
const h = (r = o.get(c)) == null ? void 0 : r.values();
|
|
@@ -6590,48 +6592,49 @@ function dr() {
|
|
|
6590
6592
|
});
|
|
6591
6593
|
}
|
|
6592
6594
|
function fr() {
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6595
|
+
if (Se) {
|
|
6596
|
+
for (const n of ur()) {
|
|
6597
|
+
const t = Array.from(
|
|
6598
|
+
document.querySelectorAll(`[${n}]`)
|
|
6599
|
+
).filter(_n);
|
|
6600
|
+
if (t.length)
|
|
6601
|
+
for (let e = 0; e < t.length; e++) {
|
|
6602
|
+
const s = t[e];
|
|
6603
|
+
De(s, n);
|
|
6604
|
+
}
|
|
6605
|
+
}
|
|
6606
|
+
We && (F.observe((n) => {
|
|
6607
|
+
n.changes.keys.forEach((t, e) => {
|
|
6608
|
+
t.action === "add" && F.set(e, F.get(e));
|
|
6609
|
+
});
|
|
6610
|
+
}), Q.awareness.on("change", () => dr()), We = !1);
|
|
6603
6611
|
}
|
|
6604
|
-
We && (N.observe((n) => {
|
|
6605
|
-
n.changes.keys.forEach((t, e) => {
|
|
6606
|
-
t.action === "add" && N.set(e, N.get(e));
|
|
6607
|
-
});
|
|
6608
|
-
}), Q.awareness.on("change", () => dr()), We = !1);
|
|
6609
6612
|
}
|
|
6610
6613
|
const Ge = {
|
|
6611
6614
|
init: zl,
|
|
6612
6615
|
setupPlayElements: fr,
|
|
6613
6616
|
setupPlayElement: ql,
|
|
6614
6617
|
removePlayElement: Zl,
|
|
6615
|
-
setupPlayElementForTag:
|
|
6618
|
+
setupPlayElementForTag: De,
|
|
6616
6619
|
globalData: void 0,
|
|
6617
6620
|
elementHandlers: void 0
|
|
6618
6621
|
};
|
|
6619
6622
|
window.playhtml = Ge;
|
|
6620
6623
|
function Gl(n) {
|
|
6621
|
-
if (
|
|
6624
|
+
if (O.has(n) || !Se)
|
|
6622
6625
|
return;
|
|
6623
|
-
|
|
6624
|
-
const t =
|
|
6626
|
+
O.has(n) || O.set(n, /* @__PURE__ */ new Map()), n !== _e.CanPlay && Jt[n], F.get(n) || F.set(n, new ht());
|
|
6627
|
+
const t = F.get(n);
|
|
6625
6628
|
t.observe((e) => {
|
|
6626
6629
|
e.changes.keys.forEach((s, r) => {
|
|
6627
|
-
const i =
|
|
6630
|
+
const i = O.get(n);
|
|
6628
6631
|
if (s.action === "add") {
|
|
6629
6632
|
const o = document.getElementById(r);
|
|
6630
|
-
if (!
|
|
6633
|
+
if (!_n(o)) {
|
|
6631
6634
|
console.log(`Element ${r} not an HTML element. Ignoring.`);
|
|
6632
6635
|
return;
|
|
6633
6636
|
}
|
|
6634
|
-
|
|
6637
|
+
De(o, n);
|
|
6635
6638
|
} else if (s.action === "update") {
|
|
6636
6639
|
const o = i.get(r);
|
|
6637
6640
|
o.__data = t.get(r);
|
|
@@ -6644,15 +6647,15 @@ function Pl(n, t) {
|
|
|
6644
6647
|
var e, s;
|
|
6645
6648
|
return ((s = (e = Jt[t]) == null ? void 0 : e.isValidElementForTag) == null ? void 0 : s.call(e, n)) ?? !0;
|
|
6646
6649
|
}
|
|
6647
|
-
function
|
|
6650
|
+
function De(n, t) {
|
|
6648
6651
|
var l;
|
|
6649
|
-
if (!Pl(n, t) || !
|
|
6652
|
+
if (!Pl(n, t) || !Se)
|
|
6650
6653
|
return;
|
|
6651
6654
|
if (!n.id) {
|
|
6652
6655
|
const c = n.getAttribute("selector-id");
|
|
6653
6656
|
if (c) {
|
|
6654
|
-
const a =
|
|
6655
|
-
n.id = btoa(`${t}-${c}-${a}`),
|
|
6657
|
+
const a = Zn.get(c) ?? 0;
|
|
6658
|
+
n.id = btoa(`${t}-${c}-${a}`), Zn.set(c, a + 1);
|
|
6656
6659
|
} else
|
|
6657
6660
|
n.id = btoa(`${t}-${n.innerHTML}}`);
|
|
6658
6661
|
}
|
|
@@ -6664,7 +6667,7 @@ function Se(n, t) {
|
|
|
6664
6667
|
return;
|
|
6665
6668
|
}
|
|
6666
6669
|
Gl(t);
|
|
6667
|
-
const s =
|
|
6670
|
+
const s = O.get(t), r = Wl(
|
|
6668
6671
|
t,
|
|
6669
6672
|
n
|
|
6670
6673
|
);
|
|
@@ -6674,7 +6677,7 @@ function Se(n, t) {
|
|
|
6674
6677
|
);
|
|
6675
6678
|
return;
|
|
6676
6679
|
}
|
|
6677
|
-
const i =
|
|
6680
|
+
const i = F.get(t), o = Xl(
|
|
6678
6681
|
n,
|
|
6679
6682
|
t,
|
|
6680
6683
|
r,
|
|
@@ -6688,17 +6691,17 @@ function Se(n, t) {
|
|
|
6688
6691
|
i.get(e) === void 0 && r.defaultData !== void 0 && i.set(e, r.defaultData), (l = o.triggerAwarenessUpdate) == null || l.call(o), n.classList.add("__playhtml-element"), n.classList.add(`__playhtml-${t}`), n.style.setProperty("--jiggle-delay", `${Math.random() * 1}s;}`);
|
|
6689
6692
|
}
|
|
6690
6693
|
function ql(n) {
|
|
6691
|
-
if (!
|
|
6694
|
+
if (!_n(n)) {
|
|
6692
6695
|
console.log(`Element ${n.id} not an HTML element. Ignoring.`);
|
|
6693
6696
|
return;
|
|
6694
6697
|
}
|
|
6695
|
-
for (const t of
|
|
6696
|
-
n.hasAttribute(t) &&
|
|
6698
|
+
for (const t of ur())
|
|
6699
|
+
n.hasAttribute(t) && De(n, t);
|
|
6697
6700
|
}
|
|
6698
6701
|
function Zl(n) {
|
|
6699
6702
|
if (!(!n || !n.id))
|
|
6700
|
-
for (const t of Object.keys(
|
|
6701
|
-
const e =
|
|
6703
|
+
for (const t of Object.keys(O)) {
|
|
6704
|
+
const e = O.get(t);
|
|
6702
6705
|
e.has(n.id) && e.delete(n.id);
|
|
6703
6706
|
}
|
|
6704
6707
|
}
|