@editora/plugins 1.2.5 → 1.2.7

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.
@@ -1,4 +1,4 @@
1
- const R = () => /* @__PURE__ */ new Map(), en = (e) => {
1
+ const R = () => /* @__PURE__ */ new Map(), nn = (e) => {
2
2
  const t = R();
3
3
  return e.forEach((n, s) => {
4
4
  t.set(s, n);
@@ -6,36 +6,36 @@ const R = () => /* @__PURE__ */ new Map(), en = (e) => {
6
6
  }, J = (e, t, n) => {
7
7
  let s = e.get(t);
8
8
  return s === void 0 && e.set(t, s = n()), s;
9
- }, gi = (e, t) => {
9
+ }, pi = (e, t) => {
10
10
  const n = [];
11
11
  for (const [s, r] of e)
12
12
  n.push(t(r, s));
13
13
  return n;
14
- }, pi = (e, t) => {
14
+ }, wi = (e, t) => {
15
15
  for (const [n, s] of e)
16
16
  if (t(s, n))
17
17
  return !0;
18
18
  return !1;
19
- }, rt = () => /* @__PURE__ */ new Set(), He = (e) => e[e.length - 1], wi = (e, t) => {
19
+ }, it = () => /* @__PURE__ */ new Set(), ze = (e) => e[e.length - 1], mi = (e, t) => {
20
20
  for (let n = 0; n < t.length; n++)
21
21
  e.push(t[n]);
22
- }, X = Array.from, pn = (e, t) => {
22
+ }, X = Array.from, mn = (e, t) => {
23
23
  for (let n = 0; n < e.length; n++)
24
24
  if (!t(e[n], n, e))
25
25
  return !1;
26
26
  return !0;
27
- }, wn = (e, t) => {
27
+ }, yn = (e, t) => {
28
28
  for (let n = 0; n < e.length; n++)
29
29
  if (t(e[n], n, e))
30
30
  return !0;
31
31
  return !1;
32
- }, mi = (e, t) => {
32
+ }, yi = (e, t) => {
33
33
  const n = new Array(e);
34
34
  for (let s = 0; s < e; s++)
35
35
  n[s] = t(s, n);
36
36
  return n;
37
37
  }, xt = Array.isArray;
38
- class mn {
38
+ class bn {
39
39
  constructor() {
40
40
  this._observers = R();
41
41
  }
@@ -49,7 +49,7 @@ class mn {
49
49
  this._observers,
50
50
  /** @type {string} */
51
51
  t,
52
- rt
52
+ it
53
53
  ).add(n), n;
54
54
  }
55
55
  /**
@@ -97,7 +97,7 @@ class mn {
97
97
  this._observers = R();
98
98
  }
99
99
  }
100
- class yi {
100
+ class bi {
101
101
  constructor() {
102
102
  this._observers = R();
103
103
  }
@@ -106,7 +106,7 @@ class yi {
106
106
  * @param {function} f
107
107
  */
108
108
  on(t, n) {
109
- J(this._observers, t, rt).add(n);
109
+ J(this._observers, t, it).add(n);
110
110
  }
111
111
  /**
112
112
  * @param {N} name
@@ -142,7 +142,7 @@ class yi {
142
142
  this._observers = R();
143
143
  }
144
144
  }
145
- const H = Math.floor, ce = Math.abs, yn = (e, t) => e < t ? e : t, wt = (e, t) => e > t ? e : t, bi = Math.pow, Ms = (e) => e !== 0 ? e < 0 : 1 / e < 0, qn = 1, Qn = 2, ze = 4, Pe = 8, jt = 32, W = 64, $ = 128, Te = 31, nn = 63, at = 127, ki = 2147483647, fe = Number.MAX_SAFE_INTEGER, Zn = Number.MIN_SAFE_INTEGER, _i = Number.isInteger || ((e) => typeof e == "number" && isFinite(e) && H(e) === e), vs = String.fromCharCode, Si = (e) => e.toLowerCase(), Ci = /^\s*/g, Ei = (e) => e.replace(Ci, ""), Di = /([A-Z])/g, ts = (e, t) => Ei(e.replace(Di, (n) => `${t}${Si(n)}`)), Ai = (e) => {
145
+ const H = Math.floor, ce = Math.abs, kn = (e, t) => e < t ? e : t, wt = (e, t) => e > t ? e : t, ki = Math.pow, vs = (e) => e !== 0 ? e < 0 : 1 / e < 0, Qn = 1, Zn = 2, Pe = 4, Ye = 8, jt = 32, W = 64, $ = 128, Te = 31, sn = 63, ut = 127, _i = 2147483647, fe = Number.MAX_SAFE_INTEGER, ts = Number.MIN_SAFE_INTEGER, Si = Number.isInteger || ((e) => typeof e == "number" && isFinite(e) && H(e) === e), Us = String.fromCharCode, Ci = (e) => e.toLowerCase(), Ei = /^\s*/g, Di = (e) => e.replace(Ei, ""), Ai = /([A-Z])/g, es = (e, t) => Di(e.replace(Ai, (n) => `${t}${Ci(n)}`)), Ti = (e) => {
146
146
  const t = unescape(encodeURIComponent(e)), n = t.length, s = new Uint8Array(n);
147
147
  for (let r = 0; r < n; r++)
148
148
  s[r] = /** @type {number} */
@@ -151,51 +151,51 @@ const H = Math.floor, ce = Math.abs, yn = (e, t) => e < t ? e : t, wt = (e, t) =
151
151
  }, Ht = (
152
152
  /** @type {TextEncoder} */
153
153
  typeof TextEncoder < "u" ? new TextEncoder() : null
154
- ), Ti = (e) => Ht.encode(e), xi = Ht ? Ti : Ai;
154
+ ), xi = (e) => Ht.encode(e), Ii = Ht ? xi : Ti;
155
155
  let Ft = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", { fatal: !0, ignoreBOM: !0 });
156
156
  Ft && Ft.decode(new Uint8Array()).length === 1 && (Ft = null);
157
- const Ii = (e, t) => mi(t, () => e).join("");
157
+ const Li = (e, t) => yi(t, () => e).join("");
158
158
  class qt {
159
159
  constructor() {
160
160
  this.cpos = 0, this.cbuf = new Uint8Array(100), this.bufs = [];
161
161
  }
162
162
  }
163
- const N = () => new qt(), bn = (e) => {
163
+ const N = () => new qt(), _n = (e) => {
164
164
  let t = e.cpos;
165
165
  for (let n = 0; n < e.bufs.length; n++)
166
166
  t += e.bufs[n].length;
167
167
  return t;
168
168
  }, C = (e) => {
169
- const t = new Uint8Array(bn(e));
169
+ const t = new Uint8Array(_n(e));
170
170
  let n = 0;
171
171
  for (let s = 0; s < e.bufs.length; s++) {
172
172
  const r = e.bufs[s];
173
173
  t.set(r, n), n += r.length;
174
174
  }
175
175
  return t.set(new Uint8Array(e.cbuf.buffer, 0, e.cpos), n), t;
176
- }, Li = (e, t) => {
176
+ }, Oi = (e, t) => {
177
177
  const n = e.cbuf.length;
178
178
  n - e.cpos < t && (e.bufs.push(new Uint8Array(e.cbuf.buffer, 0, e.cpos)), e.cbuf = new Uint8Array(wt(n, t) * 2), e.cpos = 0);
179
179
  }, x = (e, t) => {
180
180
  const n = e.cbuf.length;
181
181
  e.cpos === n && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(n * 2), e.cpos = 0), e.cbuf[e.cpos++] = t;
182
- }, sn = x, w = (e, t) => {
183
- for (; t > at; )
184
- x(e, $ | at & t), t = H(t / 128);
185
- x(e, at & t);
186
- }, kn = (e, t) => {
187
- const n = Ms(t);
188
- for (n && (t = -t), x(e, (t > nn ? $ : 0) | (n ? W : 0) | nn & t), t = H(t / 64); t > 0; )
189
- x(e, (t > at ? $ : 0) | at & t), t = H(t / 128);
190
- }, rn = new Uint8Array(3e4), Oi = rn.length / 3, Ni = (e, t) => {
191
- if (t.length < Oi) {
192
- const n = Ht.encodeInto(t, rn).written || 0;
182
+ }, rn = x, w = (e, t) => {
183
+ for (; t > ut; )
184
+ x(e, $ | ut & t), t = H(t / 128);
185
+ x(e, ut & t);
186
+ }, Sn = (e, t) => {
187
+ const n = vs(t);
188
+ for (n && (t = -t), x(e, (t > sn ? $ : 0) | (n ? W : 0) | sn & t), t = H(t / 64); t > 0; )
189
+ x(e, (t > ut ? $ : 0) | ut & t), t = H(t / 128);
190
+ }, on = new Uint8Array(3e4), Ni = on.length / 3, Mi = (e, t) => {
191
+ if (t.length < Ni) {
192
+ const n = Ht.encodeInto(t, on).written || 0;
193
193
  w(e, n);
194
194
  for (let s = 0; s < n; s++)
195
- x(e, rn[s]);
195
+ x(e, on[s]);
196
196
  } else
197
- E(e, xi(t));
198
- }, Mi = (e, t) => {
197
+ E(e, Ii(t));
198
+ }, vi = (e, t) => {
199
199
  const n = unescape(encodeURIComponent(t)), s = n.length;
200
200
  w(e, s);
201
201
  for (let r = 0; r < s; r++)
@@ -204,29 +204,29 @@ const N = () => new qt(), bn = (e) => {
204
204
  /** @type {number} */
205
205
  n.codePointAt(r)
206
206
  );
207
- }, ht = Ht && /** @type {any} */
208
- Ht.encodeInto ? Ni : Mi, xe = (e, t) => {
209
- const n = e.cbuf.length, s = e.cpos, r = yn(n - s, t.length), i = t.length - r;
207
+ }, dt = Ht && /** @type {any} */
208
+ Ht.encodeInto ? Mi : vi, xe = (e, t) => {
209
+ const n = e.cbuf.length, s = e.cpos, r = kn(n - s, t.length), i = t.length - r;
210
210
  e.cbuf.set(t.subarray(0, r), s), e.cpos += r, i > 0 && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(wt(n * 2, i)), e.cbuf.set(t.subarray(r)), e.cpos = i);
211
211
  }, E = (e, t) => {
212
212
  w(e, t.byteLength), xe(e, t);
213
- }, _n = (e, t) => {
214
- Li(e, t);
213
+ }, Cn = (e, t) => {
214
+ Oi(e, t);
215
215
  const n = new DataView(e.cbuf.buffer, e.cpos, t);
216
216
  return e.cpos += t, n;
217
- }, vi = (e, t) => _n(e, 4).setFloat32(0, t, !1), Ui = (e, t) => _n(e, 8).setFloat64(0, t, !1), Ri = (e, t) => (
217
+ }, Ui = (e, t) => Cn(e, 4).setFloat32(0, t, !1), Ri = (e, t) => Cn(e, 8).setFloat64(0, t, !1), $i = (e, t) => (
218
218
  /** @type {any} */
219
- _n(e, 8).setBigInt64(0, t, !1)
220
- ), es = new DataView(new ArrayBuffer(4)), $i = (e) => (es.setFloat32(0, e), es.getFloat32(0) === e), zt = (e, t) => {
219
+ Cn(e, 8).setBigInt64(0, t, !1)
220
+ ), ns = new DataView(new ArrayBuffer(4)), Bi = (e) => (ns.setFloat32(0, e), ns.getFloat32(0) === e), zt = (e, t) => {
221
221
  switch (typeof t) {
222
222
  case "string":
223
- x(e, 119), ht(e, t);
223
+ x(e, 119), dt(e, t);
224
224
  break;
225
225
  case "number":
226
- _i(t) && ce(t) <= ki ? (x(e, 125), kn(e, t)) : $i(t) ? (x(e, 124), vi(e, t)) : (x(e, 123), Ui(e, t));
226
+ Si(t) && ce(t) <= _i ? (x(e, 125), Sn(e, t)) : Bi(t) ? (x(e, 124), Ui(e, t)) : (x(e, 123), Ri(e, t));
227
227
  break;
228
228
  case "bigint":
229
- x(e, 122), Ri(e, t);
229
+ x(e, 122), $i(e, t);
230
230
  break;
231
231
  case "object":
232
232
  if (t === null)
@@ -243,7 +243,7 @@ Ht.encodeInto ? Ni : Mi, xe = (e, t) => {
243
243
  w(e, n.length);
244
244
  for (let s = 0; s < n.length; s++) {
245
245
  const r = n[s];
246
- ht(e, r), zt(e, t[r]);
246
+ dt(e, r), zt(e, t[r]);
247
247
  }
248
248
  }
249
249
  break;
@@ -254,7 +254,7 @@ Ht.encodeInto ? Ni : Mi, xe = (e, t) => {
254
254
  x(e, 127);
255
255
  }
256
256
  };
257
- class ns extends qt {
257
+ class ss extends qt {
258
258
  /**
259
259
  * @param {function(Encoder, T):void} writer
260
260
  */
@@ -268,8 +268,8 @@ class ns extends qt {
268
268
  this.s === t ? this.count++ : (this.count > 0 && w(this, this.count - 1), this.count = 1, this.w(this, t), this.s = t);
269
269
  }
270
270
  }
271
- const ss = (e) => {
272
- e.count > 0 && (kn(e.encoder, e.count === 1 ? e.s : -e.s), e.count > 1 && w(e.encoder, e.count - 2));
271
+ const rs = (e) => {
272
+ e.count > 0 && (Sn(e.encoder, e.count === 1 ? e.s : -e.s), e.count > 1 && w(e.encoder, e.count - 2));
273
273
  };
274
274
  class le {
275
275
  constructor() {
@@ -279,7 +279,7 @@ class le {
279
279
  * @param {number} v
280
280
  */
281
281
  write(t) {
282
- this.s === t ? this.count++ : (ss(this), this.count = 1, this.s = t);
282
+ this.s === t ? this.count++ : (rs(this), this.count = 1, this.s = t);
283
283
  }
284
284
  /**
285
285
  * Flush the encoded state and transform this to a Uint8Array.
@@ -287,16 +287,16 @@ class le {
287
287
  * Note that this should only be called once.
288
288
  */
289
289
  toUint8Array() {
290
- return ss(this), C(this.encoder);
290
+ return rs(this), C(this.encoder);
291
291
  }
292
292
  }
293
- const rs = (e) => {
293
+ const is = (e) => {
294
294
  if (e.count > 0) {
295
295
  const t = e.diff * 2 + (e.count === 1 ? 0 : 1);
296
- kn(e.encoder, t), e.count > 1 && w(e.encoder, e.count - 2);
296
+ Sn(e.encoder, t), e.count > 1 && w(e.encoder, e.count - 2);
297
297
  }
298
298
  };
299
- class Ye {
299
+ class Ge {
300
300
  constructor() {
301
301
  this.encoder = new qt(), this.s = 0, this.count = 0, this.diff = 0;
302
302
  }
@@ -304,7 +304,7 @@ class Ye {
304
304
  * @param {number} v
305
305
  */
306
306
  write(t) {
307
- this.diff === t - this.s ? (this.s = t, this.count++) : (rs(this), this.count = 1, this.diff = t - this.s, this.s = t);
307
+ this.diff === t - this.s ? (this.s = t, this.count++) : (is(this), this.count = 1, this.diff = t - this.s, this.s = t);
308
308
  }
309
309
  /**
310
310
  * Flush the encoded state and transform this to a Uint8Array.
@@ -312,10 +312,10 @@ class Ye {
312
312
  * Note that this should only be called once.
313
313
  */
314
314
  toUint8Array() {
315
- return rs(this), C(this.encoder);
315
+ return is(this), C(this.encoder);
316
316
  }
317
317
  }
318
- class Bi {
318
+ class Fi {
319
319
  constructor() {
320
320
  this.sarr = [], this.s = "", this.lensE = new le();
321
321
  }
@@ -327,18 +327,18 @@ class Bi {
327
327
  }
328
328
  toUint8Array() {
329
329
  const t = new qt();
330
- return this.sarr.push(this.s), this.s = "", ht(t, this.sarr.join("")), xe(t, this.lensE.toUint8Array()), C(t);
330
+ return this.sarr.push(this.s), this.s = "", dt(t, this.sarr.join("")), xe(t, this.lensE.toUint8Array()), C(t);
331
331
  }
332
332
  }
333
333
  const P = (e) => new Error(e), j = () => {
334
334
  throw P("Method unimplemented");
335
335
  }, V = () => {
336
336
  throw P("Unexpected case");
337
- }, Ie = P("Unexpected end of array"), Us = P("Integer out of Range"), Fi = (e, t, n) => {
337
+ }, Ie = P("Unexpected end of array"), Rs = P("Integer out of Range"), Vi = (e, t, n) => {
338
338
  if (t < 0 || n < 0 || t + n > e.length)
339
339
  throw Ie;
340
340
  return new Uint8Array(e.buffer, e.byteOffset + t, n);
341
- }, Vi = (e, t, n) => {
341
+ }, ji = (e, t, n) => {
342
342
  if (t < 0 || n < 0 || t + n > e.length)
343
343
  throw Ie;
344
344
  return new DataView(e.buffer, e.byteOffset + t, n);
@@ -351,34 +351,34 @@ class Le {
351
351
  this.arr = t, this.pos = 0;
352
352
  }
353
353
  }
354
- const ct = (e) => new Le(e), ji = (e) => e.pos !== e.arr.length, Hi = (e, t) => {
355
- const n = Fi(e.arr, e.pos, t);
354
+ const at = (e) => new Le(e), Hi = (e) => e.pos !== e.arr.length, zi = (e, t) => {
355
+ const n = Vi(e.arr, e.pos, t);
356
356
  return e.pos += t, n;
357
- }, O = (e) => Hi(e, m(e)), It = (e) => e.arr[e.pos++], m = (e) => {
357
+ }, O = (e) => zi(e, m(e)), It = (e) => e.arr[e.pos++], m = (e) => {
358
358
  let t = 0, n = 1;
359
359
  const s = e.arr.length;
360
360
  for (; e.pos < s; ) {
361
361
  const r = e.arr[e.pos++];
362
- if (t = t + (r & at) * n, n *= 128, r < $)
362
+ if (t = t + (r & ut) * n, n *= 128, r < $)
363
363
  return t;
364
364
  if (t > fe)
365
- throw Us;
365
+ throw Rs;
366
366
  }
367
367
  throw Ie;
368
- }, Sn = (e) => {
369
- let t = e.arr[e.pos++], n = t & nn, s = 64;
368
+ }, En = (e) => {
369
+ let t = e.arr[e.pos++], n = t & sn, s = 64;
370
370
  const r = (t & W) > 0 ? -1 : 1;
371
371
  if ((t & $) === 0)
372
372
  return r * n;
373
373
  const i = e.arr.length;
374
374
  for (; e.pos < i; ) {
375
- if (t = e.arr[e.pos++], n = n + (t & at) * s, s *= 128, t < $)
375
+ if (t = e.arr[e.pos++], n = n + (t & ut) * s, s *= 128, t < $)
376
376
  return r * n;
377
377
  if (n > fe)
378
- throw Us;
378
+ throw Rs;
379
379
  }
380
380
  throw Ie;
381
- }, zi = (e) => {
381
+ }, Pi = (e) => {
382
382
  let t = m(e);
383
383
  if (t === 0)
384
384
  return "";
@@ -398,39 +398,39 @@ const ct = (e) => new Le(e), ji = (e) => e.pos !== e.arr.length, Hi = (e, t) =>
398
398
  }
399
399
  return decodeURIComponent(escape(n));
400
400
  }
401
- }, Pi = (e) => (
401
+ }, Yi = (e) => (
402
402
  /** @type any */
403
403
  Ft.decode(O(e))
404
- ), st = Ft ? Pi : zi, Cn = (e, t) => {
405
- const n = Vi(e.arr, e.pos, t);
404
+ ), rt = Ft ? Yi : Pi, Dn = (e, t) => {
405
+ const n = ji(e.arr, e.pos, t);
406
406
  return e.pos += t, n;
407
- }, Yi = (e) => Cn(e, 4).getFloat32(0, !1), Gi = (e) => Cn(e, 8).getFloat64(0, !1), Ji = (e) => (
407
+ }, Gi = (e) => Dn(e, 4).getFloat32(0, !1), Ji = (e) => Dn(e, 8).getFloat64(0, !1), Ki = (e) => (
408
408
  /** @type {any} */
409
- Cn(e, 8).getBigInt64(0, !1)
410
- ), Ki = [
409
+ Dn(e, 8).getBigInt64(0, !1)
410
+ ), Wi = [
411
411
  (e) => {
412
412
  },
413
413
  // CASE 127: undefined
414
414
  (e) => null,
415
415
  // CASE 126: null
416
- Sn,
416
+ En,
417
417
  // CASE 125: integer
418
- Yi,
419
- // CASE 124: float32
420
418
  Gi,
421
- // CASE 123: float64
419
+ // CASE 124: float32
422
420
  Ji,
421
+ // CASE 123: float64
422
+ Ki,
423
423
  // CASE 122: bigint
424
424
  (e) => !1,
425
425
  // CASE 121: boolean (false)
426
426
  (e) => !0,
427
427
  // CASE 120: boolean (true)
428
- st,
428
+ rt,
429
429
  // CASE 119: string
430
430
  (e) => {
431
431
  const t = m(e), n = {};
432
432
  for (let s = 0; s < t; s++) {
433
- const r = st(e);
433
+ const r = rt(e);
434
434
  n[r] = Pt(e);
435
435
  }
436
436
  return n;
@@ -443,8 +443,8 @@ const ct = (e) => new Le(e), ji = (e) => e.pos !== e.arr.length, Hi = (e, t) =>
443
443
  },
444
444
  O
445
445
  // CASE 116: Uint8Array
446
- ], Pt = (e) => Ki[127 - It(e)](e);
447
- class is extends Le {
446
+ ], Pt = (e) => Wi[127 - It(e)](e);
447
+ class os extends Le {
448
448
  /**
449
449
  * @param {Uint8Array} uint8Array
450
450
  * @param {function(Decoder):T} reader
@@ -453,7 +453,7 @@ class is extends Le {
453
453
  super(t), this.reader = n, this.s = null, this.count = 0;
454
454
  }
455
455
  read() {
456
- return this.count === 0 && (this.s = this.reader(this), ji(this) ? this.count = m(this) + 1 : this.count = -1), this.count--, /** @type {T} */
456
+ return this.count === 0 && (this.s = this.reader(this), Hi(this) ? this.count = m(this) + 1 : this.count = -1), this.count--, /** @type {T} */
457
457
  this.s;
458
458
  }
459
459
  }
@@ -466,15 +466,15 @@ class ae extends Le {
466
466
  }
467
467
  read() {
468
468
  if (this.count === 0) {
469
- this.s = Sn(this);
470
- const t = Ms(this.s);
469
+ this.s = En(this);
470
+ const t = vs(this.s);
471
471
  this.count = 1, t && (this.s = -this.s, this.count = m(this) + 2);
472
472
  }
473
473
  return this.count--, /** @type {number} */
474
474
  this.s;
475
475
  }
476
476
  }
477
- class Ge extends Le {
477
+ class Je extends Le {
478
478
  /**
479
479
  * @param {Uint8Array} uint8Array
480
480
  */
@@ -486,18 +486,18 @@ class Ge extends Le {
486
486
  */
487
487
  read() {
488
488
  if (this.count === 0) {
489
- const t = Sn(this), n = t & 1;
489
+ const t = En(this), n = t & 1;
490
490
  this.diff = H(t / 2), this.count = 1, n && (this.count = m(this) + 2);
491
491
  }
492
492
  return this.s += this.diff, this.count--, this.s;
493
493
  }
494
494
  }
495
- class Wi {
495
+ class Xi {
496
496
  /**
497
497
  * @param {Uint8Array} uint8Array
498
498
  */
499
499
  constructor(t) {
500
- this.decoder = new ae(t), this.str = st(this.decoder), this.spos = 0;
500
+ this.decoder = new ae(t), this.str = rt(this.decoder), this.spos = 0;
501
501
  }
502
502
  /**
503
503
  * @return {string}
@@ -507,17 +507,17 @@ class Wi {
507
507
  return this.spos = t, n;
508
508
  }
509
509
  }
510
- const Xi = crypto.getRandomValues.bind(crypto), Rs = () => Xi(new Uint32Array(1))[0], qi = "10000000-1000-4000-8000" + -1e11, Qi = () => qi.replace(
510
+ const qi = crypto.getRandomValues.bind(crypto), $s = () => qi(new Uint32Array(1))[0], Qi = "10000000-1000-4000-8000" + -1e11, Zi = () => Qi.replace(
511
511
  /[018]/g,
512
512
  /** @param {number} c */
513
- (e) => (e ^ Rs() & 15 >> e / 4).toString(16)
514
- ), it = Date.now, os = (e) => (
513
+ (e) => (e ^ $s() & 15 >> e / 4).toString(16)
514
+ ), ot = Date.now, cs = (e) => (
515
515
  /** @type {Promise<T>} */
516
516
  new Promise(e)
517
517
  );
518
518
  Promise.all.bind(Promise);
519
- const cs = (e) => e === void 0 ? null : e;
520
- class Zi {
519
+ const ls = (e) => e === void 0 ? null : e;
520
+ class to {
521
521
  constructor() {
522
522
  this.map = /* @__PURE__ */ new Map();
523
523
  }
@@ -535,28 +535,28 @@ class Zi {
535
535
  return this.map.get(t);
536
536
  }
537
537
  }
538
- let $s = new Zi(), En = !0;
538
+ let Bs = new to(), An = !0;
539
539
  try {
540
- typeof localStorage < "u" && localStorage && ($s = localStorage, En = !1);
540
+ typeof localStorage < "u" && localStorage && (Bs = localStorage, An = !1);
541
541
  } catch {
542
542
  }
543
- const Bs = $s, to = (e) => En || addEventListener(
543
+ const Fs = Bs, eo = (e) => An || addEventListener(
544
544
  "storage",
545
545
  /** @type {any} */
546
546
  e
547
- ), eo = (e) => En || removeEventListener(
547
+ ), no = (e) => An || removeEventListener(
548
548
  "storage",
549
549
  /** @type {any} */
550
550
  e
551
- ), Yt = /* @__PURE__ */ Symbol("Equality"), Fs = (e, t) => e === t || !!e?.[Yt]?.(t) || !1, no = (e) => typeof e == "object", so = Object.assign, ro = Object.keys, io = (e, t) => {
551
+ ), Yt = /* @__PURE__ */ Symbol("Equality"), Vs = (e, t) => e === t || !!e?.[Yt]?.(t) || !1, so = (e) => typeof e == "object", ro = Object.assign, io = Object.keys, oo = (e, t) => {
552
552
  for (const n in e)
553
553
  t(e[n], n);
554
- }, oo = (e, t) => {
554
+ }, co = (e, t) => {
555
555
  const n = [];
556
556
  for (const s in e)
557
557
  n.push(t(e[s], s));
558
558
  return n;
559
- }, ge = (e) => ro(e).length, co = (e) => {
559
+ }, ge = (e) => io(e).length, lo = (e) => {
560
560
  for (const t in e)
561
561
  return !1;
562
562
  return !0;
@@ -565,20 +565,20 @@ const Bs = $s, to = (e) => En || addEventListener(
565
565
  if (!t(e[n], n))
566
566
  return !1;
567
567
  return !0;
568
- }, Dn = (e, t) => Object.prototype.hasOwnProperty.call(e, t), lo = (e, t) => e === t || ge(e) === ge(t) && Qt(e, (n, s) => (n !== void 0 || Dn(t, s)) && Fs(t[s], n)), ao = Object.freeze, Vs = (e) => {
568
+ }, Tn = (e, t) => Object.prototype.hasOwnProperty.call(e, t), ao = (e, t) => e === t || ge(e) === ge(t) && Qt(e, (n, s) => (n !== void 0 || Tn(t, s)) && Vs(t[s], n)), ho = Object.freeze, js = (e) => {
569
569
  for (const t in e) {
570
570
  const n = e[t];
571
- (typeof n == "object" || typeof n == "function") && Vs(e[t]);
571
+ (typeof n == "object" || typeof n == "function") && js(e[t]);
572
572
  }
573
- return ao(e);
574
- }, An = (e, t, n = 0) => {
573
+ return ho(e);
574
+ }, xn = (e, t, n = 0) => {
575
575
  try {
576
576
  for (; n < e.length; n++)
577
577
  e[n](...t);
578
578
  } finally {
579
- n < e.length && An(e, t, n + 1);
579
+ n < e.length && xn(e, t, n + 1);
580
580
  }
581
- }, ho = (e) => e, Ct = (e, t) => {
581
+ }, uo = (e) => e, Ct = (e, t) => {
582
582
  if (e === t)
583
583
  return !0;
584
584
  if (e == null || t == null || e.constructor !== t.constructor && (e.constructor || Object) !== (t.constructor || Object))
@@ -618,7 +618,7 @@ const Bs = $s, to = (e) => En || addEventListener(
618
618
  if (ge(e) !== ge(t))
619
619
  return !1;
620
620
  for (const n in e)
621
- if (!Dn(e, n) || !Ct(e[n], t[n]))
621
+ if (!Tn(e, n) || !Ct(e[n], t[n]))
622
622
  return !1;
623
623
  break;
624
624
  case Array:
@@ -632,11 +632,11 @@ const Bs = $s, to = (e) => En || addEventListener(
632
632
  return !1;
633
633
  }
634
634
  return !0;
635
- }, uo = (e, t) => t.includes(e), ot = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]", js = typeof window < "u" && typeof document < "u" && !ot;
635
+ }, fo = (e, t) => t.includes(e), ct = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]", Hs = typeof window < "u" && typeof document < "u" && !ct;
636
636
  let z;
637
- const fo = () => {
637
+ const go = () => {
638
638
  if (z === void 0)
639
- if (ot) {
639
+ if (ct) {
640
640
  z = R();
641
641
  const e = process.argv;
642
642
  let t = null;
@@ -648,26 +648,26 @@ const fo = () => {
648
648
  } else typeof location == "object" ? (z = R(), (location.search || "?").slice(1).split("&").forEach((e) => {
649
649
  if (e.length !== 0) {
650
650
  const [t, n] = e.split("=");
651
- z.set(`--${ts(t, "-")}`, n), z.set(`-${ts(t, "-")}`, n);
651
+ z.set(`--${es(t, "-")}`, n), z.set(`-${es(t, "-")}`, n);
652
652
  }
653
653
  })) : z = R();
654
654
  return z;
655
- }, on = (e) => fo().has(e), pe = (e) => cs(ot ? process.env[e.toUpperCase().replaceAll("-", "_")] : Bs.getItem(e)), Hs = (e) => on("--" + e) || pe(e) !== null, go = Hs("production"), po = ot && uo(process.env.FORCE_COLOR, ["true", "1", "2"]), wo = po || !on("--no-colors") && // @todo deprecate --no-colors
656
- !Hs("no-color") && (!ot || process.stdout.isTTY) && (!ot || on("--color") || pe("COLORTERM") !== null || (pe("TERM") || "").includes("color")), zs = (e) => new Uint8Array(e), mo = (e) => new Uint8Array(e), yo = (e) => {
655
+ }, cn = (e) => go().has(e), pe = (e) => ls(ct ? process.env[e.toUpperCase().replaceAll("-", "_")] : Fs.getItem(e)), zs = (e) => cn("--" + e) || pe(e) !== null, po = zs("production"), wo = ct && fo(process.env.FORCE_COLOR, ["true", "1", "2"]), mo = wo || !cn("--no-colors") && // @todo deprecate --no-colors
656
+ !zs("no-color") && (!ct || process.stdout.isTTY) && (!ct || cn("--color") || pe("COLORTERM") !== null || (pe("TERM") || "").includes("color")), Ps = (e) => new Uint8Array(e), yo = (e) => new Uint8Array(e), bo = (e) => {
657
657
  let t = "";
658
658
  for (let n = 0; n < e.byteLength; n++)
659
- t += vs(e[n]);
659
+ t += Us(e[n]);
660
660
  return btoa(t);
661
- }, bo = (e) => Buffer.from(e.buffer, e.byteOffset, e.byteLength).toString("base64"), ko = (e) => {
662
- const t = atob(e), n = zs(t.length);
661
+ }, ko = (e) => Buffer.from(e.buffer, e.byteOffset, e.byteLength).toString("base64"), _o = (e) => {
662
+ const t = atob(e), n = Ps(t.length);
663
663
  for (let s = 0; s < t.length; s++)
664
664
  n[s] = t.charCodeAt(s);
665
665
  return n;
666
- }, _o = (e) => new Uint8Array(Buffer.from(e, "base64")), So = js ? yo : bo, Co = js ? ko : _o, Eo = (e) => {
667
- const t = zs(e.byteLength);
666
+ }, So = (e) => new Uint8Array(Buffer.from(e, "base64")), Co = Hs ? bo : ko, Eo = Hs ? _o : So, Do = (e) => {
667
+ const t = Ps(e.byteLength);
668
668
  return t.set(e), t;
669
669
  };
670
- class Do {
670
+ class Ao {
671
671
  /**
672
672
  * @param {L} left
673
673
  * @param {R} right
@@ -676,14 +676,14 @@ class Do {
676
676
  this.left = t, this.right = n;
677
677
  }
678
678
  }
679
- const K = (e, t) => new Do(e, t), ls = (e) => e.next() >= 0.5, Je = (e, t, n) => H(e.next() * (n + 1 - t) + t), Ps = (e, t, n) => H(e.next() * (n + 1 - t) + t), Tn = (e, t, n) => Ps(e, t, n), Ao = (e) => vs(Tn(e, 97, 122)), To = (e, t = 0, n = 20) => {
680
- const s = Tn(e, t, n);
679
+ const K = (e, t) => new Ao(e, t), as = (e) => e.next() >= 0.5, Ke = (e, t, n) => H(e.next() * (n + 1 - t) + t), Ys = (e, t, n) => H(e.next() * (n + 1 - t) + t), In = (e, t, n) => Ys(e, t, n), To = (e) => Us(In(e, 97, 122)), xo = (e, t = 0, n = 20) => {
680
+ const s = In(e, t, n);
681
681
  let r = "";
682
682
  for (let i = 0; i < s; i++)
683
- r += Ao(e);
683
+ r += To(e);
684
684
  return r;
685
- }, Ke = (e, t) => t[Tn(e, 0, t.length - 1)], xo = /* @__PURE__ */ Symbol("0schema");
686
- class Io {
685
+ }, We = (e, t) => t[In(e, 0, t.length - 1)], Io = /* @__PURE__ */ Symbol("0schema");
686
+ class Lo {
687
687
  constructor() {
688
688
  this._rerrs = [];
689
689
  }
@@ -700,18 +700,18 @@ class Io {
700
700
  const t = [];
701
701
  for (let n = this._rerrs.length - 1; n > 0; n--) {
702
702
  const s = this._rerrs[n];
703
- t.push(Ii(" ", (this._rerrs.length - n) * 2) + `${s.path != null ? `[${s.path}] ` : ""}${s.has} doesn't match ${s.expected}. ${s.message}`);
703
+ t.push(Li(" ", (this._rerrs.length - n) * 2) + `${s.path != null ? `[${s.path}] ` : ""}${s.has} doesn't match ${s.expected}. ${s.message}`);
704
704
  }
705
705
  return t.join(`
706
706
  `);
707
707
  }
708
708
  }
709
- const cn = (e, t) => e === t ? !0 : e == null || t == null || e.constructor !== t.constructor ? !1 : e[Yt] ? Fs(e, t) : xt(e) ? pn(
709
+ const ln = (e, t) => e === t ? !0 : e == null || t == null || e.constructor !== t.constructor ? !1 : e[Yt] ? Vs(e, t) : xt(e) ? mn(
710
710
  e,
711
- (n) => wn(t, (s) => cn(n, s))
712
- ) : no(e) ? Qt(
711
+ (n) => yn(t, (s) => ln(n, s))
712
+ ) : so(e) ? Qt(
713
713
  e,
714
- (n, s) => cn(n, t[s])
714
+ (n, s) => ln(n, t[s])
715
715
  ) : !1;
716
716
  class v {
717
717
  // this.shape must not be defined on Schema. Otherwise typecheck on metatypes (e.g. $$object) won't work as expected anymore
@@ -733,7 +733,7 @@ class v {
733
733
  ];
734
734
  return (
735
735
  /** @type {typeof Schema<any>} */
736
- this.constructor._dilutes && ([s, n] = [n, s]), cn(n, s)
736
+ this.constructor._dilutes && ([s, n] = [n, s]), ln(n, s)
737
737
  );
738
738
  }
739
739
  /**
@@ -744,7 +744,7 @@ class v {
744
744
  equals(t) {
745
745
  return this.constructor === t.constructor && Ct(this.shape, t.shape);
746
746
  }
747
- [xo]() {
747
+ [Io]() {
748
748
  return !0;
749
749
  }
750
750
  /**
@@ -789,7 +789,7 @@ class v {
789
789
  * @type {$Optional<Schema<T>>}
790
790
  */
791
791
  get optional() {
792
- return new Js(
792
+ return new Ks(
793
793
  /** @type {Schema<T>} */
794
794
  this
795
795
  );
@@ -807,7 +807,7 @@ class v {
807
807
  * @return {Extract<OO, T> extends never ? T : (OO extends Array<never> ? T : Extract<OO,T>)}
808
808
  */
809
809
  cast(t) {
810
- return as(t, this), /** @type {any} */
810
+ return hs(t, this), /** @type {any} */
811
811
  t;
812
812
  }
813
813
  /**
@@ -830,10 +830,10 @@ class v {
830
830
  * @return {o extends T ? T : never}
831
831
  */
832
832
  expect(t) {
833
- return as(t, this), t;
833
+ return hs(t, this), t;
834
834
  }
835
835
  }
836
- class xn extends v {
836
+ class Ln extends v {
837
837
  /**
838
838
  * @param {C} c
839
839
  * @param {((o:Instance<C>)=>boolean)|null} check
@@ -851,9 +851,9 @@ class xn extends v {
851
851
  return !s && n?.extend(null, this.shape.name, t?.constructor.name, t?.constructor !== this.shape ? "Constructor match failed" : "Check failed"), s;
852
852
  }
853
853
  }
854
- const D = (e, t = null) => new xn(e, t);
855
- D(xn);
856
- class In extends v {
854
+ const D = (e, t = null) => new Ln(e, t);
855
+ D(Ln);
856
+ class On extends v {
857
857
  /**
858
858
  * @param {(o:any) => boolean} check
859
859
  */
@@ -870,8 +870,8 @@ class In extends v {
870
870
  return !s && n?.extend(null, "custom prop", t?.constructor.name, "failed to check custom prop"), s;
871
871
  }
872
872
  }
873
- const L = (e) => new In(e);
874
- D(In);
873
+ const L = (e) => new On(e);
874
+ D(On);
875
875
  class Oe extends v {
876
876
  /**
877
877
  * @param {Array<T>} literals
@@ -890,32 +890,32 @@ class Oe extends v {
890
890
  return !s && n?.extend(null, this.shape.join(" | "), t.toString()), s;
891
891
  }
892
892
  }
893
- const Ne = (...e) => new Oe(e), Ys = D(Oe), Lo = (
893
+ const Ne = (...e) => new Oe(e), Gs = D(Oe), Oo = (
894
894
  /** @type {any} */
895
895
  RegExp.escape || /** @type {(str:string) => string} */
896
896
  ((e) => e.replace(/[().|&,$^[\]]/g, (t) => "\\" + t))
897
- ), Gs = (e) => {
897
+ ), Js = (e) => {
898
898
  if (Lt.check(e))
899
- return [Lo(e)];
900
- if (Ys.check(e))
899
+ return [Oo(e)];
900
+ if (Gs.check(e))
901
901
  return (
902
902
  /** @type {Array<string|number>} */
903
903
  e.shape.map((t) => t + "")
904
904
  );
905
- if (nr.check(e))
906
- return ["[+-]?\\d+.?\\d*"];
907
905
  if (sr.check(e))
906
+ return ["[+-]?\\d+.?\\d*"];
907
+ if (rr.check(e))
908
908
  return [".*"];
909
909
  if (we.check(e))
910
- return e.shape.map(Gs).flat(1);
910
+ return e.shape.map(Js).flat(1);
911
911
  V();
912
912
  };
913
- class Oo extends v {
913
+ class No extends v {
914
914
  /**
915
915
  * @param {T} shape
916
916
  */
917
917
  constructor(t) {
918
- super(), this.shape = t, this._r = new RegExp("^" + t.map(Gs).map((n) => `(${n.join("|")})`).join("") + "$");
918
+ super(), this.shape = t, this._r = new RegExp("^" + t.map(Js).map((n) => `(${n.join("|")})`).join("") + "$");
919
919
  }
920
920
  /**
921
921
  * @param {any} o
@@ -927,9 +927,9 @@ class Oo extends v {
927
927
  return !s && n?.extend(null, this._r.toString(), t.toString(), "String doesn't match string template."), s;
928
928
  }
929
929
  }
930
- D(Oo);
931
- const No = /* @__PURE__ */ Symbol("optional");
932
- class Js extends v {
930
+ D(No);
931
+ const Mo = /* @__PURE__ */ Symbol("optional");
932
+ class Ks extends v {
933
933
  /**
934
934
  * @param {S} shape
935
935
  */
@@ -945,12 +945,12 @@ class Js extends v {
945
945
  const s = t === void 0 || this.shape.check(t);
946
946
  return !s && n?.extend(null, "undefined (optional)", "()"), s;
947
947
  }
948
- get [No]() {
948
+ get [Mo]() {
949
949
  return !0;
950
950
  }
951
951
  }
952
- const Mo = D(Js);
953
- class vo extends v {
952
+ const vo = D(Ks);
953
+ class Uo extends v {
954
954
  /**
955
955
  * @param {any} _o
956
956
  * @param {ValidationError} [err]
@@ -960,7 +960,7 @@ class vo extends v {
960
960
  return n?.extend(null, "never", typeof t), !1;
961
961
  }
962
962
  }
963
- D(vo);
963
+ D(Uo);
964
964
  class Me extends v {
965
965
  /**
966
966
  * @param {S} shape
@@ -983,16 +983,16 @@ class Me extends v {
983
983
  */
984
984
  check(t, n) {
985
985
  return t == null ? (n?.extend(null, "object", "null"), !1) : Qt(this.shape, (s, r) => {
986
- const i = this._isPartial && !Dn(t, r) || s.check(t[r], n);
986
+ const i = this._isPartial && !Tn(t, r) || s.check(t[r], n);
987
987
  return !i && n?.extend(r.toString(), s.toString(), typeof t[r], "Object property does not match"), i;
988
988
  });
989
989
  }
990
990
  }
991
- const Uo = (e) => (
991
+ const Ro = (e) => (
992
992
  /** @type {any} */
993
993
  new Me(e)
994
- ), Ro = D(Me), $o = L((e) => e != null && (e.constructor === Object || e.constructor == null));
995
- class Ks extends v {
994
+ ), $o = D(Me), Bo = L((e) => e != null && (e.constructor === Object || e.constructor == null));
995
+ class Ws extends v {
996
996
  /**
997
997
  * @param {Keys} keys
998
998
  * @param {Values} values
@@ -1015,8 +1015,8 @@ class Ks extends v {
1015
1015
  });
1016
1016
  }
1017
1017
  }
1018
- const Ws = (e, t) => new Ks(e, t), Bo = D(Ks);
1019
- class Xs extends v {
1018
+ const Xs = (e, t) => new Ws(e, t), Fo = D(Ws);
1019
+ class qs extends v {
1020
1020
  /**
1021
1021
  * @param {S} shape
1022
1022
  */
@@ -1038,14 +1038,14 @@ class Xs extends v {
1038
1038
  });
1039
1039
  }
1040
1040
  }
1041
- const Fo = (...e) => new Xs(e);
1042
- D(Xs);
1043
- class qs extends v {
1041
+ const Vo = (...e) => new qs(e);
1042
+ D(qs);
1043
+ class Qs extends v {
1044
1044
  /**
1045
1045
  * @param {Array<S>} v
1046
1046
  */
1047
1047
  constructor(t) {
1048
- super(), this.shape = t.length === 1 ? t[0] : new Ln(t);
1048
+ super(), this.shape = t.length === 1 ? t[0] : new Nn(t);
1049
1049
  }
1050
1050
  /**
1051
1051
  * @param {any} o
@@ -1053,12 +1053,12 @@ class qs extends v {
1053
1053
  * @return {o is Array<S extends Schema<infer T> ? T : never>} o
1054
1054
  */
1055
1055
  check(t, n) {
1056
- const s = xt(t) && pn(t, (r) => this.shape.check(r));
1056
+ const s = xt(t) && mn(t, (r) => this.shape.check(r));
1057
1057
  return !s && n?.extend(null, "Array", ""), s;
1058
1058
  }
1059
1059
  }
1060
- const Qs = (...e) => new qs(e), Vo = D(qs), jo = L((e) => xt(e));
1061
- class Zs extends v {
1060
+ const Zs = (...e) => new Qs(e), jo = D(Qs), Ho = L((e) => xt(e));
1061
+ class tr extends v {
1062
1062
  /**
1063
1063
  * @param {new (...args:any) => T} constructor
1064
1064
  * @param {((o:T) => boolean)|null} check
@@ -1076,15 +1076,15 @@ class Zs extends v {
1076
1076
  return !s && n?.extend(null, this.shape.name, t?.constructor.name), s;
1077
1077
  }
1078
1078
  }
1079
- const Ho = (e, t = null) => new Zs(e, t);
1080
- D(Zs);
1081
- const zo = Ho(v);
1082
- class Po extends v {
1079
+ const zo = (e, t = null) => new tr(e, t);
1080
+ D(tr);
1081
+ const Po = zo(v);
1082
+ class Yo extends v {
1083
1083
  /**
1084
1084
  * @param {Args} args
1085
1085
  */
1086
1086
  constructor(t) {
1087
- super(), this.len = t.length - 1, this.args = Fo(...t.slice(-1)), this.res = t[this.len];
1087
+ super(), this.len = t.length - 1, this.args = Vo(...t.slice(-1)), this.res = t[this.len];
1088
1088
  }
1089
1089
  /**
1090
1090
  * @param {any} f
@@ -1096,8 +1096,8 @@ class Po extends v {
1096
1096
  return !s && n?.extend(null, "function", typeof t), s;
1097
1097
  }
1098
1098
  }
1099
- const Yo = D(Po), Go = L((e) => typeof e == "function");
1100
- class Jo extends v {
1099
+ const Go = D(Yo), Jo = L((e) => typeof e == "function");
1100
+ class Ko extends v {
1101
1101
  /**
1102
1102
  * @param {T} v
1103
1103
  */
@@ -1110,12 +1110,12 @@ class Jo extends v {
1110
1110
  * @return {o is Intersect<UnwrapArray<T>>}
1111
1111
  */
1112
1112
  check(t, n) {
1113
- const s = pn(this.shape, (r) => r.check(t, n));
1113
+ const s = mn(this.shape, (r) => r.check(t, n));
1114
1114
  return !s && n?.extend(null, "Intersectinon", typeof t), s;
1115
1115
  }
1116
1116
  }
1117
- D(Jo, (e) => e.shape.length > 0);
1118
- class Ln extends v {
1117
+ D(Ko, (e) => e.shape.length > 0);
1118
+ class Nn extends v {
1119
1119
  static _dilutes = !0;
1120
1120
  /**
1121
1121
  * @param {Array<Schema<S>>} v
@@ -1129,76 +1129,76 @@ class Ln extends v {
1129
1129
  * @return {o is S}
1130
1130
  */
1131
1131
  check(t, n) {
1132
- const s = wn(this.shape, (r) => r.check(t, n));
1132
+ const s = yn(this.shape, (r) => r.check(t, n));
1133
1133
  return n?.extend(null, "Union", typeof t), s;
1134
1134
  }
1135
1135
  }
1136
- const Ut = (...e) => e.findIndex((t) => we.check(t)) >= 0 ? Ut(...e.map((t) => Gt(t)).map((t) => we.check(t) ? t.shape : [t]).flat(1)) : e.length === 1 ? e[0] : new Ln(e), we = (
1136
+ const Ut = (...e) => e.findIndex((t) => we.check(t)) >= 0 ? Ut(...e.map((t) => Gt(t)).map((t) => we.check(t) ? t.shape : [t]).flat(1)) : e.length === 1 ? e[0] : new Nn(e), we = (
1137
1137
  /** @type {Schema<$Union<any>>} */
1138
- D(Ln)
1139
- ), tr = () => !0, me = L(tr), Ko = (
1138
+ D(Nn)
1139
+ ), er = () => !0, me = L(er), Wo = (
1140
1140
  /** @type {Schema<Schema<any>>} */
1141
- D(In, (e) => e.shape === tr)
1142
- ), On = L((e) => typeof e == "bigint"), Wo = (
1141
+ D(On, (e) => e.shape === er)
1142
+ ), Mn = L((e) => typeof e == "bigint"), Xo = (
1143
1143
  /** @type {Schema<Schema<BigInt>>} */
1144
- L((e) => e === On)
1145
- ), er = L((e) => typeof e == "symbol");
1146
- L((e) => e === er);
1147
- const Et = L((e) => typeof e == "number"), nr = (
1144
+ L((e) => e === Mn)
1145
+ ), nr = L((e) => typeof e == "symbol");
1146
+ L((e) => e === nr);
1147
+ const Et = L((e) => typeof e == "number"), sr = (
1148
1148
  /** @type {Schema<Schema<number>>} */
1149
1149
  L((e) => e === Et)
1150
- ), Lt = L((e) => typeof e == "string"), sr = (
1150
+ ), Lt = L((e) => typeof e == "string"), rr = (
1151
1151
  /** @type {Schema<Schema<string>>} */
1152
1152
  L((e) => e === Lt)
1153
- ), ve = L((e) => typeof e == "boolean"), Xo = (
1153
+ ), ve = L((e) => typeof e == "boolean"), qo = (
1154
1154
  /** @type {Schema<Schema<Boolean>>} */
1155
1155
  L((e) => e === ve)
1156
- ), rr = Ne(void 0);
1156
+ ), ir = Ne(void 0);
1157
1157
  D(Oe, (e) => e.shape.length === 1 && e.shape[0] === void 0);
1158
1158
  Ne(void 0);
1159
- const Ue = Ne(null), qo = (
1159
+ const Ue = Ne(null), Qo = (
1160
1160
  /** @type {Schema<Schema<null>>} */
1161
1161
  D(Oe, (e) => e.shape.length === 1 && e.shape[0] === null)
1162
1162
  );
1163
1163
  D(Uint8Array);
1164
- D(xn, (e) => e.shape === Uint8Array);
1165
- const Qo = Ut(Et, Lt, Ue, rr, On, ve, er);
1164
+ D(Ln, (e) => e.shape === Uint8Array);
1165
+ const Zo = Ut(Et, Lt, Ue, ir, Mn, ve, nr);
1166
1166
  (() => {
1167
1167
  const e = (
1168
1168
  /** @type {$Array<$any>} */
1169
- Qs(me)
1169
+ Zs(me)
1170
1170
  ), t = (
1171
1171
  /** @type {$Record<$string,$any>} */
1172
- Ws(Lt, me)
1172
+ Xs(Lt, me)
1173
1173
  ), n = Ut(Et, Lt, Ue, ve, e, t);
1174
1174
  return e.shape = n, t.shape.values = n, n;
1175
1175
  })();
1176
1176
  const Gt = (e) => {
1177
- if (zo.check(e))
1177
+ if (Po.check(e))
1178
1178
  return (
1179
1179
  /** @type {any} */
1180
1180
  e
1181
1181
  );
1182
- if ($o.check(e)) {
1182
+ if (Bo.check(e)) {
1183
1183
  const t = {};
1184
1184
  for (const n in e)
1185
1185
  t[n] = Gt(e[n]);
1186
1186
  return (
1187
1187
  /** @type {any} */
1188
- Uo(t)
1188
+ Ro(t)
1189
1189
  );
1190
1190
  } else {
1191
- if (jo.check(e))
1191
+ if (Ho.check(e))
1192
1192
  return (
1193
1193
  /** @type {any} */
1194
1194
  Ut(...e.map(Gt))
1195
1195
  );
1196
- if (Qo.check(e))
1196
+ if (Zo.check(e))
1197
1197
  return (
1198
1198
  /** @type {any} */
1199
1199
  Ne(e)
1200
1200
  );
1201
- if (Go.check(e))
1201
+ if (Jo.check(e))
1202
1202
  return (
1203
1203
  /** @type {any} */
1204
1204
  D(
@@ -1208,14 +1208,14 @@ const Gt = (e) => {
1208
1208
  );
1209
1209
  }
1210
1210
  V();
1211
- }, as = go ? () => {
1211
+ }, hs = po ? () => {
1212
1212
  } : (e, t) => {
1213
- const n = new Io();
1213
+ const n = new Lo();
1214
1214
  if (!t.check(e, n))
1215
1215
  throw P(`Expected value to be of type ${t.constructor.name}.
1216
1216
  ${n.toString()}`);
1217
1217
  };
1218
- class Zo {
1218
+ class tc {
1219
1219
  /**
1220
1220
  * @param {Schema<State>} [$state]
1221
1221
  */
@@ -1258,45 +1258,45 @@ class Zo {
1258
1258
  );
1259
1259
  }
1260
1260
  }
1261
- const tc = (e) => new Zo(
1261
+ const ec = (e) => new tc(
1262
1262
  /** @type {any} */
1263
1263
  e
1264
- ), ir = (
1264
+ ), or = (
1265
1265
  /** @type {any} */
1266
- tc(
1266
+ ec(
1267
1267
  /** @type {Schema<prng.PRNG>} */
1268
1268
  me
1269
- ).if(nr, (e, t) => Je(t, Zn, fe)).if(sr, (e, t) => To(t)).if(Xo, (e, t) => ls(t)).if(Wo, (e, t) => BigInt(Je(t, Zn, fe))).if(we, (e, t) => bt(t, Ke(t, e.shape))).if(Ro, (e, t) => {
1269
+ ).if(sr, (e, t) => Ke(t, ts, fe)).if(rr, (e, t) => xo(t)).if(qo, (e, t) => as(t)).if(Xo, (e, t) => BigInt(Ke(t, ts, fe))).if(we, (e, t) => bt(t, We(t, e.shape))).if($o, (e, t) => {
1270
1270
  const n = {};
1271
1271
  for (const s in e.shape) {
1272
1272
  let r = e.shape[s];
1273
- if (Mo.check(r)) {
1274
- if (ls(t))
1273
+ if (vo.check(r)) {
1274
+ if (as(t))
1275
1275
  continue;
1276
1276
  r = r.shape;
1277
1277
  }
1278
- n[s] = ir(r, t);
1278
+ n[s] = or(r, t);
1279
1279
  }
1280
1280
  return n;
1281
- }).if(Vo, (e, t) => {
1282
- const n = [], s = Ps(t, 0, 42);
1281
+ }).if(jo, (e, t) => {
1282
+ const n = [], s = Ys(t, 0, 42);
1283
1283
  for (let r = 0; r < s; r++)
1284
1284
  n.push(bt(t, e.shape));
1285
1285
  return n;
1286
- }).if(Ys, (e, t) => Ke(t, e.shape)).if(qo, (e, t) => null).if(Yo, (e, t) => {
1286
+ }).if(Gs, (e, t) => We(t, e.shape)).if(Qo, (e, t) => null).if(Go, (e, t) => {
1287
1287
  const n = bt(t, e.res);
1288
1288
  return () => n;
1289
- }).if(Ko, (e, t) => bt(t, Ke(t, [
1289
+ }).if(Wo, (e, t) => bt(t, We(t, [
1290
1290
  Et,
1291
1291
  Lt,
1292
1292
  Ue,
1293
- rr,
1294
- On,
1293
+ ir,
1294
+ Mn,
1295
1295
  ve,
1296
- Qs(Et),
1297
- Ws(Ut("a", "b", "c"), Et)
1298
- ]))).if(Bo, (e, t) => {
1299
- const n = {}, s = Je(t, 0, 3);
1296
+ Zs(Et),
1297
+ Xs(Ut("a", "b", "c"), Et)
1298
+ ]))).if(Fo, (e, t) => {
1299
+ const n = {}, s = Ke(t, 0, 3);
1300
1300
  for (let r = 0; r < s; r++) {
1301
1301
  const i = bt(t, e.shape.keys), o = bt(t, e.shape.values);
1302
1302
  n[i] = o;
@@ -1305,18 +1305,18 @@ const tc = (e) => new Zo(
1305
1305
  }).done()
1306
1306
  ), bt = (e, t) => (
1307
1307
  /** @type {any} */
1308
- ir(Gt(t), e)
1308
+ or(Gt(t), e)
1309
1309
  ), Re = (
1310
1310
  /** @type {Document} */
1311
1311
  typeof document < "u" ? document : {}
1312
1312
  );
1313
- L((e) => e.nodeType === ic);
1313
+ L((e) => e.nodeType === oc);
1314
1314
  typeof DOMParser < "u" && new DOMParser();
1315
- L((e) => e.nodeType === nc);
1316
1315
  L((e) => e.nodeType === sc);
1317
- const ec = (e) => gi(e, (t, n) => `${n}:${t};`).join(""), nc = Re.ELEMENT_NODE, sc = Re.TEXT_NODE, rc = Re.DOCUMENT_NODE, ic = Re.DOCUMENT_FRAGMENT_NODE;
1318
1316
  L((e) => e.nodeType === rc);
1319
- const Z = Symbol, or = Z(), cr = Z(), oc = Z(), cc = Z(), lc = Z(), lr = Z(), ac = Z(), Nn = Z(), hc = Z(), uc = (e) => {
1317
+ const nc = (e) => pi(e, (t, n) => `${n}:${t};`).join(""), sc = Re.ELEMENT_NODE, rc = Re.TEXT_NODE, ic = Re.DOCUMENT_NODE, oc = Re.DOCUMENT_FRAGMENT_NODE;
1318
+ L((e) => e.nodeType === ic);
1319
+ const tt = Symbol, cr = tt(), lr = tt(), cc = tt(), lc = tt(), ac = tt(), ar = tt(), hc = tt(), vn = tt(), uc = tt(), dc = (e) => {
1320
1320
  e.length === 1 && e[0]?.constructor === Function && (e = /** @type {Array<string|Symbol|Object|number>} */
1321
1321
  /** @type {[function]} */
1322
1322
  e[0]());
@@ -1336,32 +1336,32 @@ const Z = Symbol, or = Z(), cr = Z(), oc = Z(), cc = Z(), lc = Z(), lr = Z(), ac
1336
1336
  r instanceof Symbol || n.push(r);
1337
1337
  }
1338
1338
  return n;
1339
- }, dc = {
1340
- [or]: K("font-weight", "bold"),
1341
- [cr]: K("font-weight", "normal"),
1342
- [oc]: K("color", "blue"),
1343
- [lc]: K("color", "green"),
1344
- [cc]: K("color", "grey"),
1345
- [lr]: K("color", "red"),
1346
- [ac]: K("color", "purple"),
1347
- [Nn]: K("color", "orange"),
1339
+ }, fc = {
1340
+ [cr]: K("font-weight", "bold"),
1341
+ [lr]: K("font-weight", "normal"),
1342
+ [cc]: K("color", "blue"),
1343
+ [ac]: K("color", "green"),
1344
+ [lc]: K("color", "grey"),
1345
+ [ar]: K("color", "red"),
1346
+ [hc]: K("color", "purple"),
1347
+ [vn]: K("color", "orange"),
1348
1348
  // not well supported in chrome when debugging node with inspector - TODO: deprecate
1349
- [hc]: K("color", "black")
1350
- }, fc = (e) => {
1349
+ [uc]: K("color", "black")
1350
+ }, gc = (e) => {
1351
1351
  e.length === 1 && e[0]?.constructor === Function && (e = /** @type {Array<string|Symbol|Object|number>} */
1352
1352
  /** @type {[function]} */
1353
1353
  e[0]());
1354
1354
  const t = [], n = [], s = R();
1355
1355
  let r = [], i = 0;
1356
1356
  for (; i < e.length; i++) {
1357
- const o = e[i], c = dc[o];
1357
+ const o = e[i], c = fc[o];
1358
1358
  if (c !== void 0)
1359
1359
  s.set(c.left, c.right);
1360
1360
  else {
1361
1361
  if (o === void 0)
1362
1362
  break;
1363
1363
  if (o.constructor === String || o.constructor === Number) {
1364
- const l = ec(s);
1364
+ const l = nc(s);
1365
1365
  i > 0 || l.length > 0 ? (t.push("%c" + o), n.push(l)) : t.push(o);
1366
1366
  } else
1367
1367
  break;
@@ -1372,11 +1372,11 @@ const Z = Symbol, or = Z(), cr = Z(), oc = Z(), cc = Z(), lc = Z(), lr = Z(), ac
1372
1372
  o instanceof Symbol || r.push(o);
1373
1373
  }
1374
1374
  return r;
1375
- }, ar = wo ? fc : uc, gc = (...e) => {
1376
- console.log(...ar(e)), ur.forEach((t) => t.print(e));
1377
- }, hr = (...e) => {
1378
- console.warn(...ar(e)), e.unshift(Nn), ur.forEach((t) => t.print(e));
1379
- }, ur = rt(), dr = (e) => ({
1375
+ }, hr = mo ? gc : dc, pc = (...e) => {
1376
+ console.log(...hr(e)), dr.forEach((t) => t.print(e));
1377
+ }, ur = (...e) => {
1378
+ console.warn(...hr(e)), e.unshift(vn), dr.forEach((t) => t.print(e));
1379
+ }, dr = it(), fr = (e) => ({
1380
1380
  /**
1381
1381
  * @return {IterableIterator<T>}
1382
1382
  */
@@ -1385,13 +1385,13 @@ const Z = Symbol, or = Z(), cr = Z(), oc = Z(), cc = Z(), lc = Z(), lr = Z(), ac
1385
1385
  },
1386
1386
  // @ts-ignore
1387
1387
  next: e
1388
- }), pc = (e, t) => dr(() => {
1388
+ }), wc = (e, t) => fr(() => {
1389
1389
  let n;
1390
1390
  do
1391
1391
  n = e.next();
1392
1392
  while (!n.done && !t(n.value));
1393
1393
  return n;
1394
- }), We = (e, t) => dr(() => {
1394
+ }), Xe = (e, t) => fr(() => {
1395
1395
  const { done: n, value: s } = e.next();
1396
1396
  return { done: n, value: n ? void 0 : t(s) };
1397
1397
  });
@@ -1417,9 +1417,9 @@ const Ot = (e, t, n) => t.clients.forEach((s, r) => {
1417
1417
  if (i != null) {
1418
1418
  const o = i[i.length - 1], c = o.id.clock + o.length;
1419
1419
  for (let l = 0, a = s[l]; l < s.length && a.clock < c; a = s[++l])
1420
- Er(e, i, a.clock, a.len, n);
1420
+ Dr(e, i, a.clock, a.len, n);
1421
1421
  }
1422
- }), wc = (e, t) => {
1422
+ }), mc = (e, t) => {
1423
1423
  let n = 0, s = e.length - 1;
1424
1424
  for (; n <= s; ) {
1425
1425
  const r = H((n + s) / 2), i = e[r], o = i.clock;
@@ -1433,8 +1433,8 @@ const Ot = (e, t, n) => t.clients.forEach((s, r) => {
1433
1433
  return null;
1434
1434
  }, Zt = (e, t) => {
1435
1435
  const n = e.clients.get(t.client);
1436
- return n !== void 0 && wc(n, t.clock) !== null;
1437
- }, Mn = (e) => {
1436
+ return n !== void 0 && mc(n, t.clock) !== null;
1437
+ }, Un = (e) => {
1438
1438
  e.clients.forEach((t) => {
1439
1439
  t.sort((r, i) => r.clock - i.clock);
1440
1440
  let n, s;
@@ -1444,25 +1444,25 @@ const Ot = (e, t, n) => t.clients.forEach((s, r) => {
1444
1444
  }
1445
1445
  t.length = s;
1446
1446
  });
1447
- }, ln = (e) => {
1447
+ }, an = (e) => {
1448
1448
  const t = new Rt();
1449
1449
  for (let n = 0; n < e.length; n++)
1450
1450
  e[n].clients.forEach((s, r) => {
1451
1451
  if (!t.clients.has(r)) {
1452
1452
  const i = s.slice();
1453
1453
  for (let o = n + 1; o < e.length; o++)
1454
- wi(i, e[o].clients.get(r) || []);
1454
+ mi(i, e[o].clients.get(r) || []);
1455
1455
  t.clients.set(r, i);
1456
1456
  }
1457
1457
  });
1458
- return Mn(t), t;
1458
+ return Un(t), t;
1459
1459
  }, Jt = (e, t, n, s) => {
1460
1460
  J(e.clients, t, () => (
1461
1461
  /** @type {Array<DeleteItem>} */
1462
1462
  []
1463
1463
  )).push(new $e(n, s));
1464
- }, mc = () => new Rt(), yc = (e) => {
1465
- const t = mc();
1464
+ }, yc = () => new Rt(), bc = (e) => {
1465
+ const t = yc();
1466
1466
  return e.clients.forEach((n, s) => {
1467
1467
  const r = [];
1468
1468
  for (let i = 0; i < n.length; i++) {
@@ -1488,7 +1488,7 @@ const Ot = (e, t, n) => t.clients.forEach((s, r) => {
1488
1488
  e.writeDsClock(o.clock), e.writeDsLen(o.len);
1489
1489
  }
1490
1490
  });
1491
- }, vn = (e) => {
1491
+ }, Rn = (e) => {
1492
1492
  const t = new Rt(), n = m(e.restDecoder);
1493
1493
  for (let s = 0; s < n; s++) {
1494
1494
  e.resetDsCurVal();
@@ -1503,7 +1503,7 @@ const Ot = (e, t, n) => t.clients.forEach((s, r) => {
1503
1503
  }
1504
1504
  }
1505
1505
  return t;
1506
- }, hs = (e, t, n) => {
1506
+ }, us = (e, t, n) => {
1507
1507
  const s = new Rt(), r = m(e.restDecoder);
1508
1508
  for (let i = 0; i < r; i++) {
1509
1509
  e.resetDsCurVal();
@@ -1520,22 +1520,22 @@ const Ot = (e, t, n) => t.clients.forEach((s, r) => {
1520
1520
  }
1521
1521
  }
1522
1522
  if (s.clients.size > 0) {
1523
- const i = new ut();
1523
+ const i = new ft();
1524
1524
  return w(i.restEncoder, 0), $t(i, s), i.toUint8Array();
1525
1525
  }
1526
1526
  return null;
1527
- }, fr = Rs;
1528
- class mt extends mn {
1527
+ }, gr = $s;
1528
+ class mt extends bn {
1529
1529
  /**
1530
1530
  * @param {DocOpts} opts configuration
1531
1531
  */
1532
- constructor({ guid: t = Qi(), collectionid: n = null, gc: s = !0, gcFilter: r = () => !0, meta: i = null, autoLoad: o = !1, shouldLoad: c = !0 } = {}) {
1533
- super(), this.gc = s, this.gcFilter = r, this.clientID = fr(), this.guid = t, this.collectionid = n, this.share = /* @__PURE__ */ new Map(), this.store = new Sr(), this._transaction = null, this._transactionCleanups = [], this.subdocs = /* @__PURE__ */ new Set(), this._item = null, this.shouldLoad = c, this.autoLoad = o, this.meta = i, this.isLoaded = !1, this.isSynced = !1, this.isDestroyed = !1, this.whenLoaded = os((a) => {
1532
+ constructor({ guid: t = Zi(), collectionid: n = null, gc: s = !0, gcFilter: r = () => !0, meta: i = null, autoLoad: o = !1, shouldLoad: c = !0 } = {}) {
1533
+ super(), this.gc = s, this.gcFilter = r, this.clientID = gr(), this.guid = t, this.collectionid = n, this.share = /* @__PURE__ */ new Map(), this.store = new Cr(), this._transaction = null, this._transactionCleanups = [], this.subdocs = /* @__PURE__ */ new Set(), this._item = null, this.shouldLoad = c, this.autoLoad = o, this.meta = i, this.isLoaded = !1, this.isSynced = !1, this.isDestroyed = !1, this.whenLoaded = cs((a) => {
1534
1534
  this.on("load", () => {
1535
1535
  this.isLoaded = !0, a(this);
1536
1536
  });
1537
1537
  });
1538
- const l = () => os((a) => {
1538
+ const l = () => cs((a) => {
1539
1539
  const h = (u) => {
1540
1540
  (u === void 0 || u === !0) && (this.off("sync", h), a());
1541
1541
  };
@@ -1696,7 +1696,7 @@ class mt extends mn {
1696
1696
  * @public
1697
1697
  */
1698
1698
  getXmlFragment(t = "") {
1699
- return this.get(t, dt);
1699
+ return this.get(t, gt);
1700
1700
  }
1701
1701
  /**
1702
1702
  * Converts the entire document into a js object, recursively traversing each yjs type
@@ -1738,7 +1738,7 @@ class mt extends mn {
1738
1738
  this.emit("destroyed", [!0]), this.emit("destroy", [this]), super.destroy();
1739
1739
  }
1740
1740
  }
1741
- class gr {
1741
+ class pr {
1742
1742
  /**
1743
1743
  * @param {decoding.Decoder} decoder
1744
1744
  */
@@ -1760,7 +1760,7 @@ class gr {
1760
1760
  return m(this.restDecoder);
1761
1761
  }
1762
1762
  }
1763
- class pr extends gr {
1763
+ class wr extends pr {
1764
1764
  /**
1765
1765
  * @return {ID}
1766
1766
  */
@@ -1790,7 +1790,7 @@ class pr extends gr {
1790
1790
  * @return {string}
1791
1791
  */
1792
1792
  readString() {
1793
- return st(this.restDecoder);
1793
+ return rt(this.restDecoder);
1794
1794
  }
1795
1795
  /**
1796
1796
  * @return {boolean} isKey
@@ -1822,7 +1822,7 @@ class pr extends gr {
1822
1822
  * @return {Uint8Array}
1823
1823
  */
1824
1824
  readBuf() {
1825
- return Eo(O(this.restDecoder));
1825
+ return Do(O(this.restDecoder));
1826
1826
  }
1827
1827
  /**
1828
1828
  * Legacy implementation uses JSON parse. We use any-decoding in v2.
@@ -1830,16 +1830,16 @@ class pr extends gr {
1830
1830
  * @return {any}
1831
1831
  */
1832
1832
  readJSON() {
1833
- return JSON.parse(st(this.restDecoder));
1833
+ return JSON.parse(rt(this.restDecoder));
1834
1834
  }
1835
1835
  /**
1836
1836
  * @return {string}
1837
1837
  */
1838
1838
  readKey() {
1839
- return st(this.restDecoder);
1839
+ return rt(this.restDecoder);
1840
1840
  }
1841
1841
  }
1842
- class bc {
1842
+ class kc {
1843
1843
  /**
1844
1844
  * @param {decoding.Decoder} decoder
1845
1845
  */
@@ -1863,12 +1863,12 @@ class bc {
1863
1863
  return this.dsCurrVal += t, t;
1864
1864
  }
1865
1865
  }
1866
- class Nt extends bc {
1866
+ class Nt extends kc {
1867
1867
  /**
1868
1868
  * @param {decoding.Decoder} decoder
1869
1869
  */
1870
1870
  constructor(t) {
1871
- super(t), this.keys = [], m(t), this.keyClockDecoder = new Ge(O(t)), this.clientDecoder = new ae(O(t)), this.leftClockDecoder = new Ge(O(t)), this.rightClockDecoder = new Ge(O(t)), this.infoDecoder = new is(O(t), It), this.stringDecoder = new Wi(O(t)), this.parentInfoDecoder = new is(O(t), It), this.typeRefDecoder = new ae(O(t)), this.lenDecoder = new ae(O(t));
1871
+ super(t), this.keys = [], m(t), this.keyClockDecoder = new Je(O(t)), this.clientDecoder = new ae(O(t)), this.leftClockDecoder = new Je(O(t)), this.rightClockDecoder = new Je(O(t)), this.infoDecoder = new os(O(t), It), this.stringDecoder = new Xi(O(t)), this.parentInfoDecoder = new os(O(t), It), this.typeRefDecoder = new ae(O(t)), this.lenDecoder = new ae(O(t));
1872
1872
  }
1873
1873
  /**
1874
1874
  * @return {ID}
@@ -1959,7 +1959,7 @@ class Nt extends bc {
1959
1959
  }
1960
1960
  }
1961
1961
  }
1962
- class wr {
1962
+ class mr {
1963
1963
  constructor() {
1964
1964
  this.restEncoder = N();
1965
1965
  }
@@ -1981,7 +1981,7 @@ class wr {
1981
1981
  w(this.restEncoder, t);
1982
1982
  }
1983
1983
  }
1984
- class te extends wr {
1984
+ class te extends mr {
1985
1985
  /**
1986
1986
  * @param {ID} id
1987
1987
  */
@@ -2005,13 +2005,13 @@ class te extends wr {
2005
2005
  * @param {number} info An unsigned 8-bit integer
2006
2006
  */
2007
2007
  writeInfo(t) {
2008
- sn(this.restEncoder, t);
2008
+ rn(this.restEncoder, t);
2009
2009
  }
2010
2010
  /**
2011
2011
  * @param {string} s
2012
2012
  */
2013
2013
  writeString(t) {
2014
- ht(this.restEncoder, t);
2014
+ dt(this.restEncoder, t);
2015
2015
  }
2016
2016
  /**
2017
2017
  * @param {boolean} isYKey
@@ -2049,16 +2049,16 @@ class te extends wr {
2049
2049
  * @param {any} embed
2050
2050
  */
2051
2051
  writeJSON(t) {
2052
- ht(this.restEncoder, JSON.stringify(t));
2052
+ dt(this.restEncoder, JSON.stringify(t));
2053
2053
  }
2054
2054
  /**
2055
2055
  * @param {string} key
2056
2056
  */
2057
2057
  writeKey(t) {
2058
- ht(this.restEncoder, t);
2058
+ dt(this.restEncoder, t);
2059
2059
  }
2060
2060
  }
2061
- class mr {
2061
+ class yr {
2062
2062
  constructor() {
2063
2063
  this.restEncoder = N(), this.dsCurrVal = 0;
2064
2064
  }
@@ -2082,9 +2082,9 @@ class mr {
2082
2082
  t === 0 && V(), w(this.restEncoder, t - 1), this.dsCurrVal += t;
2083
2083
  }
2084
2084
  }
2085
- class ut extends mr {
2085
+ class ft extends yr {
2086
2086
  constructor() {
2087
- super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new Ye(), this.clientEncoder = new le(), this.leftClockEncoder = new Ye(), this.rightClockEncoder = new Ye(), this.infoEncoder = new ns(sn), this.stringEncoder = new Bi(), this.parentInfoEncoder = new ns(sn), this.typeRefEncoder = new le(), this.lenEncoder = new le();
2087
+ super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new Ge(), this.clientEncoder = new le(), this.leftClockEncoder = new Ge(), this.rightClockEncoder = new Ge(), this.infoEncoder = new ss(rn), this.stringEncoder = new Fi(), this.parentInfoEncoder = new ss(rn), this.typeRefEncoder = new le(), this.lenEncoder = new le();
2088
2088
  }
2089
2089
  toUint8Array() {
2090
2090
  const t = N();
@@ -2175,7 +2175,7 @@ class ut extends mr {
2175
2175
  n === void 0 ? (this.keyClockEncoder.write(this.keyClock++), this.stringEncoder.write(t)) : this.keyClockEncoder.write(n);
2176
2176
  }
2177
2177
  }
2178
- const kc = (e, t, n, s) => {
2178
+ const _c = (e, t, n, s) => {
2179
2179
  s = wt(s, t[0].id.clock);
2180
2180
  const r = Y(t, s);
2181
2181
  w(e.restEncoder, t.length - r), e.writeClient(n), w(e.restEncoder, s);
@@ -2183,14 +2183,14 @@ const kc = (e, t, n, s) => {
2183
2183
  i.write(e, s - i.id.clock);
2184
2184
  for (let o = r + 1; o < t.length; o++)
2185
2185
  t[o].write(e, 0);
2186
- }, Un = (e, t, n) => {
2186
+ }, $n = (e, t, n) => {
2187
2187
  const s = /* @__PURE__ */ new Map();
2188
2188
  n.forEach((r, i) => {
2189
2189
  A(t, i) > r && s.set(i, r);
2190
2190
  }), Be(t).forEach((r, i) => {
2191
2191
  n.has(i) || s.set(i, 0);
2192
2192
  }), w(e.restEncoder, s.size), X(s.entries()).sort((r, i) => i[0] - r[0]).forEach(([r, i]) => {
2193
- kc(
2193
+ _c(
2194
2194
  e,
2195
2195
  /** @type {Array<GC|Item>} */
2196
2196
  t.clients.get(r),
@@ -2198,7 +2198,7 @@ const kc = (e, t, n, s) => {
2198
2198
  i
2199
2199
  );
2200
2200
  });
2201
- }, _c = (e, t) => {
2201
+ }, Sc = (e, t) => {
2202
2202
  const n = R(), s = m(e.restDecoder);
2203
2203
  for (let r = 0; r < s; r++) {
2204
2204
  const i = m(e.restDecoder), o = new Array(i), c = e.readClient();
@@ -2232,7 +2232,7 @@ const kc = (e, t, n, s) => {
2232
2232
  // parent
2233
2233
  u && (h & jt) === jt ? e.readString() : null,
2234
2234
  // parentSub
2235
- Pr(e, h)
2235
+ Yr(e, h)
2236
2236
  // item content
2237
2237
  );
2238
2238
  o[a] = d, l += d.length;
@@ -2241,7 +2241,7 @@ const kc = (e, t, n, s) => {
2241
2241
  }
2242
2242
  }
2243
2243
  return n;
2244
- }, Sc = (e, t, n) => {
2244
+ }, Cc = (e, t, n) => {
2245
2245
  const s = [];
2246
2246
  let r = X(n.keys()).sort((f, g) => f - g);
2247
2247
  if (r.length === 0)
@@ -2264,7 +2264,7 @@ const kc = (e, t, n, s) => {
2264
2264
  let o = i();
2265
2265
  if (o === null)
2266
2266
  return null;
2267
- const c = new Sr(), l = /* @__PURE__ */ new Map(), a = (f, g) => {
2267
+ const c = new Cr(), l = /* @__PURE__ */ new Map(), a = (f, g) => {
2268
2268
  const p = l.get(f);
2269
2269
  (p == null || p > g) && l.set(f, g);
2270
2270
  };
@@ -2322,14 +2322,14 @@ const kc = (e, t, n, s) => {
2322
2322
  }
2323
2323
  }
2324
2324
  if (c.clients.size > 0) {
2325
- const f = new ut();
2326
- return Un(f, c, /* @__PURE__ */ new Map()), w(f.restEncoder, 0), { missing: l, update: f.toUint8Array() };
2325
+ const f = new ft();
2326
+ return $n(f, c, /* @__PURE__ */ new Map()), w(f.restEncoder, 0), { missing: l, update: f.toUint8Array() };
2327
2327
  }
2328
2328
  return null;
2329
- }, Cc = (e, t) => Un(e, t.doc.store, t.beforeState), Ec = (e, t, n, s = new Nt(e)) => _(t, (r) => {
2329
+ }, Ec = (e, t) => $n(e, t.doc.store, t.beforeState), Dc = (e, t, n, s = new Nt(e)) => _(t, (r) => {
2330
2330
  r.local = !1;
2331
2331
  let i = !1;
2332
- const o = r.doc, c = o.store, l = _c(s, o), a = Sc(r, c, l), h = c.pendingStructs;
2332
+ const o = r.doc, c = o.store, l = Sc(s, o), a = Cc(r, c, l), h = c.pendingStructs;
2333
2333
  if (h) {
2334
2334
  for (const [d, f] of h.missing)
2335
2335
  if (f < A(c, d)) {
@@ -2345,11 +2345,11 @@ const kc = (e, t, n, s) => {
2345
2345
  }
2346
2346
  } else
2347
2347
  c.pendingStructs = a;
2348
- const u = hs(s, r, c);
2348
+ const u = us(s, r, c);
2349
2349
  if (c.pendingDs) {
2350
- const d = new Nt(ct(c.pendingDs));
2350
+ const d = new Nt(at(c.pendingDs));
2351
2351
  m(d.restDecoder);
2352
- const f = hs(d, r, c);
2352
+ const f = us(d, r, c);
2353
2353
  u && f ? c.pendingDs = be([u, f]) : c.pendingDs = u || f;
2354
2354
  } else
2355
2355
  c.pendingDs = u;
@@ -2358,43 +2358,43 @@ const kc = (e, t, n, s) => {
2358
2358
  /** @type {{update: Uint8Array}} */
2359
2359
  c.pendingStructs.update
2360
2360
  );
2361
- c.pendingStructs = null, yr(r.doc, d);
2362
- }
2363
- }, n, !1), yr = (e, t, n, s = Nt) => {
2364
- const r = ct(t);
2365
- Ec(r, e, n, new s(r));
2366
- }, Dc = (e, t, n) => yr(e, t, n, pr), Ac = (e, t, n = /* @__PURE__ */ new Map()) => {
2367
- Un(e, t.store, n), $t(e, yc(t.store));
2368
- }, Tc = (e, t = new Uint8Array([0]), n = new ut()) => {
2369
- const s = br(t);
2370
- Ac(n, e, s);
2361
+ c.pendingStructs = null, br(r.doc, d);
2362
+ }
2363
+ }, n, !1), br = (e, t, n, s = Nt) => {
2364
+ const r = at(t);
2365
+ Dc(r, e, n, new s(r));
2366
+ }, Ac = (e, t, n) => br(e, t, n, wr), Tc = (e, t, n = /* @__PURE__ */ new Map()) => {
2367
+ $n(e, t.store, n), $t(e, bc(t.store));
2368
+ }, xc = (e, t = new Uint8Array([0]), n = new ft()) => {
2369
+ const s = kr(t);
2370
+ Tc(n, e, s);
2371
2371
  const r = [n.toUint8Array()];
2372
- if (e.store.pendingDs && r.push(e.store.pendingDs), e.store.pendingStructs && r.push(Yc(e.store.pendingStructs.update, t)), r.length > 1) {
2372
+ if (e.store.pendingDs && r.push(e.store.pendingDs), e.store.pendingStructs && r.push(Gc(e.store.pendingStructs.update, t)), r.length > 1) {
2373
2373
  if (n.constructor === te)
2374
- return zc(r.map((i, o) => o === 0 ? i : Jc(i)));
2375
- if (n.constructor === ut)
2374
+ return Pc(r.map((i, o) => o === 0 ? i : Kc(i)));
2375
+ if (n.constructor === ft)
2376
2376
  return be(r);
2377
2377
  }
2378
2378
  return r[0];
2379
- }, xc = (e, t) => Tc(e, t, new te()), Ic = (e) => {
2379
+ }, Ic = (e, t) => xc(e, t, new te()), Lc = (e) => {
2380
2380
  const t = /* @__PURE__ */ new Map(), n = m(e.restDecoder);
2381
2381
  for (let s = 0; s < n; s++) {
2382
2382
  const r = m(e.restDecoder), i = m(e.restDecoder);
2383
2383
  t.set(r, i);
2384
2384
  }
2385
2385
  return t;
2386
- }, br = (e) => Ic(new gr(ct(e))), kr = (e, t) => (w(e.restEncoder, t.size), X(t.entries()).sort((n, s) => s[0] - n[0]).forEach(([n, s]) => {
2386
+ }, kr = (e) => Lc(new pr(at(e))), _r = (e, t) => (w(e.restEncoder, t.size), X(t.entries()).sort((n, s) => s[0] - n[0]).forEach(([n, s]) => {
2387
2387
  w(e.restEncoder, n), w(e.restEncoder, s);
2388
- }), e), Lc = (e, t) => kr(e, Be(t.store)), Oc = (e, t = new mr()) => (e instanceof Map ? kr(t, e) : Lc(t, e), t.toUint8Array()), Nc = (e) => Oc(e, new wr());
2389
- class Mc {
2388
+ }), e), Oc = (e, t) => _r(e, Be(t.store)), Nc = (e, t = new yr()) => (e instanceof Map ? _r(t, e) : Oc(t, e), t.toUint8Array()), Mc = (e) => Nc(e, new mr());
2389
+ class vc {
2390
2390
  constructor() {
2391
2391
  this.l = [];
2392
2392
  }
2393
2393
  }
2394
- const us = () => new Mc(), ds = (e, t) => e.l.push(t), fs = (e, t) => {
2394
+ const ds = () => new vc(), fs = (e, t) => e.l.push(t), gs = (e, t) => {
2395
2395
  const n = e.l, s = n.length;
2396
2396
  e.l = n.filter((r) => t !== r), s === e.l.length && console.error("[yjs] Tried to remove event handler that doesn't exist.");
2397
- }, _r = (e, t, n) => An(e.l, [t, n]);
2397
+ }, Sr = (e, t, n) => xn(e.l, [t, n]);
2398
2398
  class Dt {
2399
2399
  /**
2400
2400
  * @param {number} client client id
@@ -2404,7 +2404,7 @@ class Dt {
2404
2404
  this.client = t, this.clock = n;
2405
2405
  }
2406
2406
  }
2407
- const re = (e, t) => e === t || e !== null && t !== null && e.client === t.client && e.clock === t.clock, y = (e, t) => new Dt(e, t), vc = (e) => {
2407
+ const re = (e, t) => e === t || e !== null && t !== null && e.client === t.client && e.clock === t.clock, y = (e, t) => new Dt(e, t), Uc = (e) => {
2408
2408
  for (const [t, n] of e.doc.share.entries())
2409
2409
  if (n === e)
2410
2410
  return t;
@@ -2417,14 +2417,14 @@ const re = (e, t) => e === t || e !== null && t !== null && e.client === t.clien
2417
2417
  t.parent._item;
2418
2418
  }
2419
2419
  return !1;
2420
- }, kt = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.get(e.id.client) || 0) > e.id.clock && !Zt(t.ds, e.id), an = (e, t) => {
2421
- const n = J(e.meta, an, rt), s = e.doc.store;
2420
+ }, kt = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.get(e.id.client) || 0) > e.id.clock && !Zt(t.ds, e.id), hn = (e, t) => {
2421
+ const n = J(e.meta, hn, it), s = e.doc.store;
2422
2422
  n.has(t) || (t.sv.forEach((r, i) => {
2423
2423
  r < A(s, i) && U(e, y(i, r));
2424
2424
  }), Ot(e, t.ds, (r) => {
2425
2425
  }), n.add(t));
2426
2426
  };
2427
- class Sr {
2427
+ class Cr {
2428
2428
  constructor() {
2429
2429
  this.clients = /* @__PURE__ */ new Map(), this.pendingStructs = null, this.pendingDs = null;
2430
2430
  }
@@ -2441,7 +2441,7 @@ const Be = (e) => {
2441
2441
  return 0;
2442
2442
  const s = n[n.length - 1];
2443
2443
  return s.id.clock + s.length;
2444
- }, Cr = (e, t) => {
2444
+ }, Er = (e, t) => {
2445
2445
  let n = e.clients.get(t.id.client);
2446
2446
  if (n === void 0)
2447
2447
  n = [], e.clients.set(t.id.client, n);
@@ -2466,13 +2466,13 @@ const Be = (e) => {
2466
2466
  o = H((n + s) / 2);
2467
2467
  }
2468
2468
  throw V();
2469
- }, Uc = (e, t) => {
2469
+ }, Rc = (e, t) => {
2470
2470
  const n = e.clients.get(t.client);
2471
2471
  return n[Y(n, t.clock)];
2472
2472
  }, he = (
2473
2473
  /** @type {function(StructStore,ID):Item} */
2474
- Uc
2475
- ), hn = (e, t, n) => {
2474
+ Rc
2475
+ ), un = (e, t, n) => {
2476
2476
  const s = Y(t, n), r = t[s];
2477
2477
  return r.id.clock < n && r instanceof S ? (t.splice(s + 1, 0, Ee(e, r, n - r.id.clock)), s + 1) : s;
2478
2478
  }, U = (e, t) => {
@@ -2480,26 +2480,26 @@ const Be = (e) => {
2480
2480
  /** @type {Array<Item>} */
2481
2481
  e.doc.store.clients.get(t.client)
2482
2482
  );
2483
- return n[hn(e, n, t.clock)];
2484
- }, gs = (e, t, n) => {
2483
+ return n[un(e, n, t.clock)];
2484
+ }, ps = (e, t, n) => {
2485
2485
  const s = t.clients.get(n.client), r = Y(s, n.clock), i = s[r];
2486
2486
  return n.clock !== i.id.clock + i.length - 1 && i.constructor !== B && s.splice(r + 1, 0, Ee(e, i, n.clock - i.id.clock + 1)), i;
2487
- }, Rc = (e, t, n) => {
2487
+ }, $c = (e, t, n) => {
2488
2488
  const s = (
2489
2489
  /** @type {Array<GC|Item>} */
2490
2490
  e.clients.get(t.id.client)
2491
2491
  );
2492
2492
  s[Y(s, t.id.clock)] = n;
2493
- }, Er = (e, t, n, s, r) => {
2493
+ }, Dr = (e, t, n, s, r) => {
2494
2494
  if (s === 0)
2495
2495
  return;
2496
2496
  const i = n + s;
2497
- let o = hn(e, t, n), c;
2497
+ let o = un(e, t, n), c;
2498
2498
  do
2499
- c = t[o++], i < c.id.clock + c.length && hn(e, t, i), r(c);
2499
+ c = t[o++], i < c.id.clock + c.length && un(e, t, i), r(c);
2500
2500
  while (o < t.length && t[o].id.clock < i);
2501
2501
  };
2502
- class $c {
2502
+ class Bc {
2503
2503
  /**
2504
2504
  * @param {Doc} doc
2505
2505
  * @param {any} origin
@@ -2509,9 +2509,9 @@ class $c {
2509
2509
  this.doc = t, this.deleteSet = new Rt(), this.beforeState = Be(t.store), this.afterState = /* @__PURE__ */ new Map(), this.changed = /* @__PURE__ */ new Map(), this.changedParentTypes = /* @__PURE__ */ new Map(), this._mergeStructs = [], this.origin = n, 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;
2510
2510
  }
2511
2511
  }
2512
- const ps = (e, t) => t.deleteSet.clients.size === 0 && !pi(t.afterState, (n, s) => t.beforeState.get(s) !== n) ? !1 : (Mn(t.deleteSet), Cc(e, t), $t(e, t.deleteSet), !0), ws = (e, t, n) => {
2512
+ const ws = (e, t) => t.deleteSet.clients.size === 0 && !wi(t.afterState, (n, s) => t.beforeState.get(s) !== n) ? !1 : (Un(t.deleteSet), Ec(e, t), $t(e, t.deleteSet), !0), ms = (e, t, n) => {
2513
2513
  const s = t._item;
2514
- (s === null || s.id.clock < (e.beforeState.get(s.id.client) || 0) && !s.deleted) && J(e.changed, t, rt).add(n);
2514
+ (s === null || s.id.clock < (e.beforeState.get(s.id.client) || 0) && !s.deleted) && J(e.changed, t, it).add(n);
2515
2515
  }, ue = (e, t) => {
2516
2516
  let n = e[t], s = e[t - 1], r = t;
2517
2517
  for (; r > 0; n = s, s = e[--r - 1]) {
@@ -2528,7 +2528,7 @@ const ps = (e, t) => t.deleteSet.clients.size === 0 && !pi(t.afterState, (n, s)
2528
2528
  }
2529
2529
  const i = t - r;
2530
2530
  return i && e.splice(t + 1 - i, i), i;
2531
- }, Bc = (e, t, n) => {
2531
+ }, Fc = (e, t, n) => {
2532
2532
  for (const [s, r] of e.clients.entries()) {
2533
2533
  const i = (
2534
2534
  /** @type {Array<GC|Item>} */
@@ -2544,23 +2544,23 @@ const ps = (e, t) => t.deleteSet.clients.size === 0 && !pi(t.afterState, (n, s)
2544
2544
  }
2545
2545
  }
2546
2546
  }
2547
- }, Fc = (e, t) => {
2547
+ }, Vc = (e, t) => {
2548
2548
  e.clients.forEach((n, s) => {
2549
2549
  const r = (
2550
2550
  /** @type {Array<GC|Item>} */
2551
2551
  t.clients.get(s)
2552
2552
  );
2553
2553
  for (let i = n.length - 1; i >= 0; i--) {
2554
- const o = n[i], c = yn(r.length - 1, 1 + Y(r, o.clock + o.len - 1));
2554
+ const o = n[i], c = kn(r.length - 1, 1 + Y(r, o.clock + o.len - 1));
2555
2555
  for (let l = c, a = r[l]; l > 0 && a.id.clock >= o.clock; a = r[l])
2556
2556
  l -= 1 + ue(r, l);
2557
2557
  }
2558
2558
  });
2559
- }, Dr = (e, t) => {
2559
+ }, Ar = (e, t) => {
2560
2560
  if (t < e.length) {
2561
2561
  const n = e[t], s = n.doc, r = s.store, i = n.deleteSet, o = n._mergeStructs;
2562
2562
  try {
2563
- Mn(i), n.afterState = Be(n.doc.store), s.emit("beforeObserverCalls", [n, s]);
2563
+ Un(i), n.afterState = Be(n.doc.store), s.emit("beforeObserverCalls", [n, s]);
2564
2564
  const c = [];
2565
2565
  n.changed.forEach(
2566
2566
  (l, a) => c.push(() => {
@@ -2573,14 +2573,14 @@ const ps = (e, t) => t.deleteSet.clients.size === 0 && !pi(t.afterState, (n, s)
2573
2573
  (h) => h.target._item === null || !h.target._item.deleted
2574
2574
  ), l.forEach((h) => {
2575
2575
  h.currentTarget = a, h._path = null;
2576
- }), l.sort((h, u) => h.path.length - u.path.length), _r(a._dEH, l, n);
2576
+ }), l.sort((h, u) => h.path.length - u.path.length), Sr(a._dEH, l, n);
2577
2577
  });
2578
2578
  }), c.push(() => s.emit("afterTransaction", [n, s])), c.push(() => {
2579
- n._needFormattingCleanup && cl(n);
2579
+ n._needFormattingCleanup && ll(n);
2580
2580
  });
2581
- }), An(c, []);
2581
+ }), xn(c, []);
2582
2582
  } finally {
2583
- s.gc && Bc(i, r, s.gcFilter), Fc(i, r), n.afterState.forEach((h, u) => {
2583
+ s.gc && Fc(i, r, s.gcFilter), Vc(i, r), n.afterState.forEach((h, u) => {
2584
2584
  const d = n.beforeState.get(u) || 0;
2585
2585
  if (d !== h) {
2586
2586
  const f = (
@@ -2598,35 +2598,35 @@ const ps = (e, t) => t.deleteSet.clients.size === 0 && !pi(t.afterState, (n, s)
2598
2598
  ), g = Y(f, d);
2599
2599
  g + 1 < f.length && ue(f, g + 1) > 1 || g > 0 && ue(f, g);
2600
2600
  }
2601
- if (!n.local && n.afterState.get(s.clientID) !== n.beforeState.get(s.clientID) && (gc(Nn, or, "[yjs] ", cr, lr, "Changed the client-id because another client seems to be using it."), s.clientID = fr()), s.emit("afterTransactionCleanup", [n, s]), s._observers.has("update")) {
2601
+ if (!n.local && n.afterState.get(s.clientID) !== n.beforeState.get(s.clientID) && (pc(vn, cr, "[yjs] ", lr, ar, "Changed the client-id because another client seems to be using it."), s.clientID = gr()), s.emit("afterTransactionCleanup", [n, s]), s._observers.has("update")) {
2602
2602
  const h = new te();
2603
- ps(h, n) && s.emit("update", [h.toUint8Array(), n.origin, s, n]);
2603
+ ws(h, n) && s.emit("update", [h.toUint8Array(), n.origin, s, n]);
2604
2604
  }
2605
2605
  if (s._observers.has("updateV2")) {
2606
- const h = new ut();
2607
- ps(h, n) && s.emit("updateV2", [h.toUint8Array(), n.origin, s, n]);
2606
+ const h = new ft();
2607
+ ws(h, n) && s.emit("updateV2", [h.toUint8Array(), n.origin, s, n]);
2608
2608
  }
2609
2609
  const { subdocsAdded: c, subdocsLoaded: l, subdocsRemoved: a } = n;
2610
2610
  (c.size > 0 || a.size > 0 || l.size > 0) && (c.forEach((h) => {
2611
2611
  h.clientID = s.clientID, h.collectionid == null && (h.collectionid = s.collectionid), s.subdocs.add(h);
2612
- }), a.forEach((h) => s.subdocs.delete(h)), s.emit("subdocs", [{ loaded: l, added: c, removed: a }, s, n]), a.forEach((h) => h.destroy())), e.length <= t + 1 ? (s._transactionCleanups = [], s.emit("afterAllTransactions", [s, e])) : Dr(e, t + 1);
2612
+ }), a.forEach((h) => s.subdocs.delete(h)), s.emit("subdocs", [{ loaded: l, added: c, removed: a }, s, n]), a.forEach((h) => h.destroy())), e.length <= t + 1 ? (s._transactionCleanups = [], s.emit("afterAllTransactions", [s, e])) : Ar(e, t + 1);
2613
2613
  }
2614
2614
  }
2615
2615
  }, _ = (e, t, n = null, s = !0) => {
2616
2616
  const r = e._transactionCleanups;
2617
2617
  let i = !1, o = null;
2618
- e._transaction === null && (i = !0, e._transaction = new $c(e, n, s), r.push(e._transaction), r.length === 1 && e.emit("beforeAllTransactions", [e]), e.emit("beforeTransaction", [e._transaction, e]));
2618
+ e._transaction === null && (i = !0, e._transaction = new Bc(e, n, s), r.push(e._transaction), r.length === 1 && e.emit("beforeAllTransactions", [e]), e.emit("beforeTransaction", [e._transaction, e]));
2619
2619
  try {
2620
2620
  o = t(e._transaction);
2621
2621
  } finally {
2622
2622
  if (i) {
2623
2623
  const c = e._transaction === r[0];
2624
- e._transaction = null, c && Dr(r, 0);
2624
+ e._transaction = null, c && Ar(r, 0);
2625
2625
  }
2626
2626
  }
2627
2627
  return o;
2628
2628
  };
2629
- class Vc {
2629
+ class jc {
2630
2630
  /**
2631
2631
  * @param {DeleteSet} deletions
2632
2632
  * @param {DeleteSet} insertions
@@ -2635,15 +2635,15 @@ class Vc {
2635
2635
  this.insertions = n, this.deletions = t, this.meta = /* @__PURE__ */ new Map();
2636
2636
  }
2637
2637
  }
2638
- const ms = (e, t, n) => {
2638
+ const ys = (e, t, n) => {
2639
2639
  Ot(e, n.deletions, (s) => {
2640
2640
  s instanceof S && t.scope.some((r) => r === e.doc || ye(
2641
2641
  /** @type {AbstractType<any>} */
2642
2642
  r,
2643
2643
  s
2644
- )) && zn(s, !1);
2644
+ )) && Yn(s, !1);
2645
2645
  });
2646
- }, ys = (e, t, n) => {
2646
+ }, bs = (e, t, n) => {
2647
2647
  let s = null;
2648
2648
  const r = e.doc, i = e.scope;
2649
2649
  _(r, (c) => {
@@ -2656,7 +2656,7 @@ const ms = (e, t, n) => {
2656
2656
  Ot(c, a.insertions, (f) => {
2657
2657
  if (f instanceof S) {
2658
2658
  if (f.redone !== null) {
2659
- let { item: g, diff: p } = vl(l, f.id);
2659
+ let { item: g, diff: p } = Ul(l, f.id);
2660
2660
  p > 0 && (g = U(c, y(g.id.client, g.id.clock + p))), f = g;
2661
2661
  }
2662
2662
  !f.deleted && i.some((g) => g === c.doc || ye(
@@ -2674,7 +2674,7 @@ const ms = (e, t, n) => {
2674
2674
  )) && // Never redo structs in stackItem.insertions because they were created and deleted in the same capture interval.
2675
2675
  !Zt(a.insertions, f.id) && h.add(f);
2676
2676
  }), h.forEach((f) => {
2677
- d = zr(c, f, h, a.insertions, e.ignoreRemoteMapChanges, e) !== null || d;
2677
+ d = Pr(c, f, h, a.insertions, e.ignoreRemoteMapChanges, e) !== null || d;
2678
2678
  });
2679
2679
  for (let f = u.length - 1; f >= 0; f--) {
2680
2680
  const g = u[f];
@@ -2693,7 +2693,7 @@ const ms = (e, t, n) => {
2693
2693
  }
2694
2694
  return o;
2695
2695
  };
2696
- class jc extends mn {
2696
+ class Hc extends bn {
2697
2697
  /**
2698
2698
  * @param {Doc|AbstractType<any>|Array<AbstractType<any>>} typeScope Limits the scope of the UndoManager. If this is set to a ydoc instance, all changes on that ydoc will be undone. If set to a specific type, only changes on that type or its children will be undone. Also accepts an array of types.
2699
2699
  * @param {UndoManagerOptions} options
@@ -2719,16 +2719,16 @@ class jc extends mn {
2719
2719
  a ? this.stopCapturing() : h || this.clear(!1, !0);
2720
2720
  const d = new Rt();
2721
2721
  l.afterState.forEach((b, k) => {
2722
- const Wn = l.beforeState.get(k) || 0, Xn = b - Wn;
2723
- Xn > 0 && Jt(d, k, Wn, Xn);
2722
+ const Xn = l.beforeState.get(k) || 0, qn = b - Xn;
2723
+ qn > 0 && Jt(d, k, Xn, qn);
2724
2724
  });
2725
- const f = it();
2725
+ const f = ot();
2726
2726
  let g = !1;
2727
2727
  if (this.lastChange > 0 && f - this.lastChange < this.captureTimeout && u.length > 0 && !a && !h) {
2728
2728
  const b = u[u.length - 1];
2729
- b.deletions = ln([b.deletions, l.deleteSet]), b.insertions = ln([b.insertions, d]);
2729
+ b.deletions = an([b.deletions, l.deleteSet]), b.insertions = an([b.insertions, d]);
2730
2730
  } else
2731
- u.push(new Vc(l.deleteSet, d)), g = !0;
2731
+ u.push(new jc(l.deleteSet, d)), g = !0;
2732
2732
  !a && !h && (this.lastChange = f), Ot(
2733
2733
  l,
2734
2734
  l.deleteSet,
@@ -2738,7 +2738,7 @@ class jc extends mn {
2738
2738
  /** @type {AbstractType<any>} */
2739
2739
  k,
2740
2740
  b
2741
- )) && zn(b, !0);
2741
+ )) && Yn(b, !0);
2742
2742
  }
2743
2743
  );
2744
2744
  const p = [{ stackItem: u[u.length - 1], origin: l.origin, type: a ? "redo" : "undo", changedParentTypes: l.changedParentTypes }, this];
@@ -2753,7 +2753,7 @@ class jc extends mn {
2753
2753
  addToScope(t) {
2754
2754
  const n = new Set(this.scope);
2755
2755
  t = xt(t) ? t : [t], t.forEach((s) => {
2756
- n.has(s) || (n.add(s), (s instanceof I ? s.doc !== this.doc : s !== this.doc) && hr("[yjs#509] Not same Y.Doc"), this.scope.push(s));
2756
+ n.has(s) || (n.add(s), (s instanceof I ? s.doc !== this.doc : s !== this.doc) && ur("[yjs#509] Not same Y.Doc"), this.scope.push(s));
2757
2757
  });
2758
2758
  }
2759
2759
  /**
@@ -2770,7 +2770,7 @@ class jc extends mn {
2770
2770
  }
2771
2771
  clear(t = !0, n = !0) {
2772
2772
  (t && this.canUndo() || n && this.canRedo()) && this.doc.transact((s) => {
2773
- t && (this.undoStack.forEach((r) => ms(s, this, r)), this.undoStack = []), n && (this.redoStack.forEach((r) => ms(s, this, r)), this.redoStack = []), this.emit("stack-cleared", [{ undoStackCleared: t, redoStackCleared: n }]);
2773
+ t && (this.undoStack.forEach((r) => ys(s, this, r)), this.undoStack = []), n && (this.redoStack.forEach((r) => ys(s, this, r)), this.redoStack = []), this.emit("stack-cleared", [{ undoStackCleared: t, redoStackCleared: n }]);
2774
2774
  });
2775
2775
  }
2776
2776
  /**
@@ -2805,7 +2805,7 @@ class jc extends mn {
2805
2805
  this.undoing = !0;
2806
2806
  let t;
2807
2807
  try {
2808
- t = ys(this, this.undoStack, "undo");
2808
+ t = bs(this, this.undoStack, "undo");
2809
2809
  } finally {
2810
2810
  this.undoing = !1;
2811
2811
  }
@@ -2820,7 +2820,7 @@ class jc extends mn {
2820
2820
  this.redoing = !0;
2821
2821
  let t;
2822
2822
  try {
2823
- t = ys(this, this.redoStack, "redo");
2823
+ t = bs(this, this.redoStack, "redo");
2824
2824
  } finally {
2825
2825
  this.redoing = !1;
2826
2826
  }
@@ -2846,7 +2846,7 @@ class jc extends mn {
2846
2846
  this.trackedOrigins.delete(this), this.doc.off("afterTransaction", this.afterTransactionHandler), this.doc.off("destroy", this.destroy), super.destroy();
2847
2847
  }
2848
2848
  }
2849
- function* Hc(e) {
2849
+ function* zc(e) {
2850
2850
  const t = m(e.restDecoder);
2851
2851
  for (let n = 0; n < t; n++) {
2852
2852
  const s = m(e.restDecoder), r = e.readClient();
@@ -2872,7 +2872,7 @@ function* Hc(e) {
2872
2872
  // parent
2873
2873
  l && (c & jt) === jt ? e.readString() : null,
2874
2874
  // parentSub
2875
- Pr(e, c)
2875
+ Yr(e, c)
2876
2876
  // item content
2877
2877
  );
2878
2878
  yield a, i += a.length;
@@ -2883,13 +2883,13 @@ function* Hc(e) {
2883
2883
  }
2884
2884
  }
2885
2885
  }
2886
- class Rn {
2886
+ class Bn {
2887
2887
  /**
2888
2888
  * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder
2889
2889
  * @param {boolean} filterSkips
2890
2890
  */
2891
2891
  constructor(t, n) {
2892
- this.gen = Hc(t), this.curr = null, this.done = !1, this.filterSkips = n, this.next();
2892
+ this.gen = zc(t), this.curr = null, this.done = !1, this.filterSkips = n, this.next();
2893
2893
  }
2894
2894
  /**
2895
2895
  * @return {Item | GC | Skip |null}
@@ -2901,7 +2901,7 @@ class Rn {
2901
2901
  return this.curr;
2902
2902
  }
2903
2903
  }
2904
- class $n {
2904
+ class Fn {
2905
2905
  /**
2906
2906
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
2907
2907
  */
@@ -2909,7 +2909,7 @@ class $n {
2909
2909
  this.currClient = 0, this.startClock = 0, this.written = 0, this.encoder = t, this.clientStructs = [];
2910
2910
  }
2911
2911
  }
2912
- const zc = (e) => be(e, pr, te), Pc = (e, t) => {
2912
+ const Pc = (e) => be(e, wr, te), Yc = (e, t) => {
2913
2913
  if (e.constructor === B) {
2914
2914
  const { client: n, clock: s } = e.id;
2915
2915
  return new B(y(n, s + t), e.length - t);
@@ -2932,12 +2932,12 @@ const zc = (e) => be(e, pr, te), Pc = (e, t) => {
2932
2932
  n.content.splice(t)
2933
2933
  );
2934
2934
  }
2935
- }, be = (e, t = Nt, n = ut) => {
2935
+ }, be = (e, t = Nt, n = ft) => {
2936
2936
  if (e.length === 1)
2937
2937
  return e[0];
2938
- const s = e.map((h) => new t(ct(h)));
2939
- let r = s.map((h) => new Rn(h, !0)), i = null;
2940
- const o = new n(), c = new $n(o);
2938
+ const s = e.map((h) => new t(at(h)));
2939
+ let r = s.map((h) => new Bn(h, !0)), i = null;
2940
+ const o = new n(), c = new Fn(o);
2941
2941
  for (; r = r.filter((d) => d.curr !== null), r.sort(
2942
2942
  /** @type {function(any,any):number} */
2943
2943
  (d, f) => {
@@ -2964,21 +2964,21 @@ const zc = (e) => be(e, pr, te), Pc = (e, t) => {
2964
2964
  f && d.id.clock > i.struct.id.clock + i.struct.length)
2965
2965
  continue;
2966
2966
  if (u !== i.struct.id.client)
2967
- et(c, i.struct, i.offset), i = { struct: d, offset: 0 }, h.next();
2967
+ nt(c, i.struct, i.offset), i = { struct: d, offset: 0 }, h.next();
2968
2968
  else if (i.struct.id.clock + i.struct.length < d.id.clock)
2969
2969
  if (i.struct.constructor === F)
2970
2970
  i.struct.length = d.id.clock + d.length - i.struct.id.clock;
2971
2971
  else {
2972
- et(c, i.struct, i.offset);
2972
+ nt(c, i.struct, i.offset);
2973
2973
  const g = d.id.clock - i.struct.id.clock - i.struct.length;
2974
2974
  i = { struct: new F(y(u, i.struct.id.clock + i.struct.length), g), offset: 0 };
2975
2975
  }
2976
2976
  else {
2977
2977
  const g = i.struct.id.clock + i.struct.length - d.id.clock;
2978
- g > 0 && (i.struct.constructor === F ? i.struct.length -= g : d = Pc(d, g)), i.struct.mergeWith(
2978
+ g > 0 && (i.struct.constructor === F ? i.struct.length -= g : d = Yc(d, g)), i.struct.mergeWith(
2979
2979
  /** @type {any} */
2980
2980
  d
2981
- ) || (et(c, i.struct, i.offset), i = { struct: d, offset: 0 }, h.next());
2981
+ ) || (nt(c, i.struct, i.offset), i = { struct: d, offset: 0 }, h.next());
2982
2982
  }
2983
2983
  } else
2984
2984
  i = { struct: (
@@ -2986,13 +2986,13 @@ const zc = (e) => be(e, pr, te), Pc = (e, t) => {
2986
2986
  h.curr
2987
2987
  ), offset: 0 }, h.next();
2988
2988
  for (let d = h.curr; d !== null && d.id.client === u && d.id.clock === i.struct.id.clock + i.struct.length && d.constructor !== F; d = h.next())
2989
- et(c, i.struct, i.offset), i = { struct: d, offset: 0 };
2989
+ nt(c, i.struct, i.offset), i = { struct: d, offset: 0 };
2990
2990
  }
2991
- i !== null && (et(c, i.struct, i.offset), i = null), Bn(c);
2992
- const l = s.map((h) => vn(h)), a = ln(l);
2991
+ i !== null && (nt(c, i.struct, i.offset), i = null), Vn(c);
2992
+ const l = s.map((h) => Rn(h)), a = an(l);
2993
2993
  return $t(o, a), o.toUint8Array();
2994
- }, Yc = (e, t, n = Nt, s = ut) => {
2995
- const r = br(t), i = new s(), o = new $n(i), c = new n(ct(e)), l = new Rn(c, !1);
2994
+ }, Gc = (e, t, n = Nt, s = ft) => {
2995
+ const r = kr(t), i = new s(), o = new Fn(i), c = new n(at(e)), l = new Bn(c, !1);
2996
2996
  for (; l.curr; ) {
2997
2997
  const h = l.curr, u = h.id.client, d = r.get(u) || 0;
2998
2998
  if (l.curr.constructor === F) {
@@ -3000,35 +3000,35 @@ const zc = (e) => be(e, pr, te), Pc = (e, t) => {
3000
3000
  continue;
3001
3001
  }
3002
3002
  if (h.id.clock + h.length > d)
3003
- for (et(o, h, wt(d - h.id.clock, 0)), l.next(); l.curr && l.curr.id.client === u; )
3004
- et(o, l.curr, 0), l.next();
3003
+ for (nt(o, h, wt(d - h.id.clock, 0)), l.next(); l.curr && l.curr.id.client === u; )
3004
+ nt(o, l.curr, 0), l.next();
3005
3005
  else
3006
3006
  for (; l.curr && l.curr.id.client === u && l.curr.id.clock + l.curr.length <= d; )
3007
3007
  l.next();
3008
3008
  }
3009
- Bn(o);
3010
- const a = vn(c);
3009
+ Vn(o);
3010
+ const a = Rn(c);
3011
3011
  return $t(i, a), i.toUint8Array();
3012
- }, Ar = (e) => {
3012
+ }, Tr = (e) => {
3013
3013
  e.written > 0 && (e.clientStructs.push({ written: e.written, restEncoder: C(e.encoder.restEncoder) }), e.encoder.restEncoder = N(), e.written = 0);
3014
- }, et = (e, t, n) => {
3015
- e.written > 0 && e.currClient !== t.id.client && Ar(e), e.written === 0 && (e.currClient = t.id.client, e.encoder.writeClient(t.id.client), w(e.encoder.restEncoder, t.id.clock + n)), t.write(e.encoder, n), e.written++;
3016
- }, Bn = (e) => {
3017
- Ar(e);
3014
+ }, nt = (e, t, n) => {
3015
+ e.written > 0 && e.currClient !== t.id.client && Tr(e), e.written === 0 && (e.currClient = t.id.client, e.encoder.writeClient(t.id.client), w(e.encoder.restEncoder, t.id.clock + n)), t.write(e.encoder, n), e.written++;
3016
+ }, Vn = (e) => {
3017
+ Tr(e);
3018
3018
  const t = e.encoder.restEncoder;
3019
3019
  w(t, e.clientStructs.length);
3020
3020
  for (let n = 0; n < e.clientStructs.length; n++) {
3021
3021
  const s = e.clientStructs[n];
3022
3022
  w(t, s.written), xe(t, s.restEncoder);
3023
3023
  }
3024
- }, Gc = (e, t, n, s) => {
3025
- const r = new n(ct(e)), i = new Rn(r, !1), o = new s(), c = new $n(o);
3024
+ }, Jc = (e, t, n, s) => {
3025
+ const r = new n(at(e)), i = new Bn(r, !1), o = new s(), c = new Fn(o);
3026
3026
  for (let a = i.curr; a !== null; a = i.next())
3027
- et(c, t(a), 0);
3028
- Bn(c);
3029
- const l = vn(r);
3027
+ nt(c, t(a), 0);
3028
+ Vn(c);
3029
+ const l = Rn(r);
3030
3030
  return $t(o, l), o.toUint8Array();
3031
- }, Jc = (e) => Gc(e, ho, Nt, te), bs = "You must not compute changes after the event-handler fired.";
3031
+ }, Kc = (e) => Jc(e, uo, Nt, te), ks = "You must not compute changes after the event-handler fired.";
3032
3032
  class Fe {
3033
3033
  /**
3034
3034
  * @param {T} target The changed type.
@@ -3051,7 +3051,7 @@ class Fe {
3051
3051
  * type === event.target // => true
3052
3052
  */
3053
3053
  get path() {
3054
- return this._path || (this._path = Kc(this.currentTarget, this.target));
3054
+ return this._path || (this._path = Wc(this.currentTarget, this.target));
3055
3055
  }
3056
3056
  /**
3057
3057
  * Check if a struct is deleted by this event.
@@ -3070,7 +3070,7 @@ class Fe {
3070
3070
  get keys() {
3071
3071
  if (this._keys === null) {
3072
3072
  if (this.transaction.doc._transactionCleanups.length === 0)
3073
- throw P(bs);
3073
+ throw P(ks);
3074
3074
  const t = /* @__PURE__ */ new Map(), n = this.target;
3075
3075
  /** @type Set<string|null> */
3076
3076
  this.transaction.changed.get(n).forEach((r) => {
@@ -3086,13 +3086,13 @@ class Fe {
3086
3086
  l = l.left;
3087
3087
  if (this.deletes(i))
3088
3088
  if (l !== null && this.deletes(l))
3089
- o = "delete", c = He(l.content.getContent());
3089
+ o = "delete", c = ze(l.content.getContent());
3090
3090
  else
3091
3091
  return;
3092
3092
  else
3093
- l !== null && this.deletes(l) ? (o = "update", c = He(l.content.getContent())) : (o = "add", c = void 0);
3093
+ l !== null && this.deletes(l) ? (o = "update", c = ze(l.content.getContent())) : (o = "add", c = void 0);
3094
3094
  } else if (this.deletes(i))
3095
- o = "delete", c = He(
3095
+ o = "delete", c = ze(
3096
3096
  /** @type {Item} */
3097
3097
  i.content.getContent()
3098
3098
  );
@@ -3138,8 +3138,8 @@ class Fe {
3138
3138
  let t = this._changes;
3139
3139
  if (t === null) {
3140
3140
  if (this.transaction.doc._transactionCleanups.length === 0)
3141
- throw P(bs);
3142
- const n = this.target, s = rt(), r = rt(), i = [];
3141
+ throw P(ks);
3142
+ const n = this.target, s = it(), r = it(), i = [];
3143
3143
  if (t = {
3144
3144
  added: s,
3145
3145
  deleted: r,
@@ -3163,7 +3163,7 @@ class Fe {
3163
3163
  );
3164
3164
  }
3165
3165
  }
3166
- const Kc = (e, t) => {
3166
+ const Wc = (e, t) => {
3167
3167
  const n = [];
3168
3168
  for (; t._item !== null && t !== e; ) {
3169
3169
  if (t._item.parentSub !== null)
@@ -3182,28 +3182,28 @@ const Kc = (e, t) => {
3182
3182
  }
3183
3183
  return n;
3184
3184
  }, M = () => {
3185
- hr("Invalid access: Add Yjs type to a document before reading data.");
3186
- }, Tr = 80;
3187
- let Fn = 0;
3188
- class Wc {
3185
+ ur("Invalid access: Add Yjs type to a document before reading data.");
3186
+ }, xr = 80;
3187
+ let jn = 0;
3188
+ class Xc {
3189
3189
  /**
3190
3190
  * @param {Item} p
3191
3191
  * @param {number} index
3192
3192
  */
3193
3193
  constructor(t, n) {
3194
- t.marker = !0, this.p = t, this.index = n, this.timestamp = Fn++;
3194
+ t.marker = !0, this.p = t, this.index = n, this.timestamp = jn++;
3195
3195
  }
3196
3196
  }
3197
- const Xc = (e) => {
3198
- e.timestamp = Fn++;
3199
- }, xr = (e, t, n) => {
3200
- e.p.marker = !1, e.p = t, t.marker = !0, e.index = n, e.timestamp = Fn++;
3201
- }, qc = (e, t, n) => {
3202
- if (e.length >= Tr) {
3197
+ const qc = (e) => {
3198
+ e.timestamp = jn++;
3199
+ }, Ir = (e, t, n) => {
3200
+ e.p.marker = !1, e.p = t, t.marker = !0, e.index = n, e.timestamp = jn++;
3201
+ }, Qc = (e, t, n) => {
3202
+ if (e.length >= xr) {
3203
3203
  const s = e.reduce((r, i) => r.timestamp < i.timestamp ? r : i);
3204
- return xr(s, t, n), s;
3204
+ return Ir(s, t, n), s;
3205
3205
  } else {
3206
- const s = new Wc(t, n);
3206
+ const s = new Xc(t, n);
3207
3207
  return e.push(s), s;
3208
3208
  }
3209
3209
  }, Ve = (e, t) => {
@@ -3211,7 +3211,7 @@ const Xc = (e) => {
3211
3211
  return null;
3212
3212
  const n = e._searchMarker.length === 0 ? null : e._searchMarker.reduce((i, o) => ce(t - i.index) < ce(t - o.index) ? i : o);
3213
3213
  let s = e._start, r = 0;
3214
- for (n !== null && (s = n.p, r = n.index, Xc(n)); s.right !== null && r < t; ) {
3214
+ for (n !== null && (s = n.p, r = n.index, qc(n)); s.right !== null && r < t; ) {
3215
3215
  if (!s.deleted && s.countable) {
3216
3216
  if (t < r + s.length)
3217
3217
  break;
@@ -3224,7 +3224,7 @@ const Xc = (e) => {
3224
3224
  for (; s.left !== null && s.left.id.client === s.id.client && s.left.id.clock + s.left.length === s.id.clock; )
3225
3225
  s = s.left, !s.deleted && s.countable && (r -= s.length);
3226
3226
  return n !== null && ce(n.index - r) < /** @type {YText|YArray<any>} */
3227
- s.parent.length / Tr ? (xr(n, s, r), n) : qc(e._searchMarker, s, r);
3227
+ s.parent.length / xr ? (Ir(n, s, r), n) : Qc(e._searchMarker, s, r);
3228
3228
  }, Kt = (e, t, n) => {
3229
3229
  for (let s = e.length - 1; s >= 0; s--) {
3230
3230
  const r = e[s];
@@ -3245,11 +3245,11 @@ const Xc = (e) => {
3245
3245
  for (; J(r, e, () => []).push(n), e._item !== null; )
3246
3246
  e = /** @type {AbstractType<any>} */
3247
3247
  e._item.parent;
3248
- _r(s._eH, n, t);
3248
+ Sr(s._eH, n, t);
3249
3249
  };
3250
3250
  class I {
3251
3251
  constructor() {
3252
- this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH = us(), this._dEH = us(), this._searchMarker = null;
3252
+ this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH = ds(), this._dEH = ds(), this._searchMarker = null;
3253
3253
  }
3254
3254
  /**
3255
3255
  * @return {AbstractType<any>|null}
@@ -3319,7 +3319,7 @@ class I {
3319
3319
  * @param {function(EventType, Transaction):void} f Observer function
3320
3320
  */
3321
3321
  observe(t) {
3322
- ds(this._eH, t);
3322
+ fs(this._eH, t);
3323
3323
  }
3324
3324
  /**
3325
3325
  * Observe all events that are created by this type and its children.
@@ -3327,7 +3327,7 @@ class I {
3327
3327
  * @param {function(Array<YEvent<any>>,Transaction):void} f Observer function
3328
3328
  */
3329
3329
  observeDeep(t) {
3330
- ds(this._dEH, t);
3330
+ fs(this._dEH, t);
3331
3331
  }
3332
3332
  /**
3333
3333
  * Unregister an observer function.
@@ -3335,7 +3335,7 @@ class I {
3335
3335
  * @param {function(EventType,Transaction):void} f Observer function
3336
3336
  */
3337
3337
  unobserve(t) {
3338
- fs(this._eH, t);
3338
+ gs(this._eH, t);
3339
3339
  }
3340
3340
  /**
3341
3341
  * Unregister an observer function.
@@ -3343,7 +3343,7 @@ class I {
3343
3343
  * @param {function(Array<YEvent<any>>,Transaction):void} f Observer function
3344
3344
  */
3345
3345
  unobserveDeep(t) {
3346
- fs(this._dEH, t);
3346
+ gs(this._dEH, t);
3347
3347
  }
3348
3348
  /**
3349
3349
  * @abstract
@@ -3352,7 +3352,7 @@ class I {
3352
3352
  toJSON() {
3353
3353
  }
3354
3354
  }
3355
- const Ir = (e, t, n) => {
3355
+ const Lr = (e, t, n) => {
3356
3356
  e.doc ?? M(), t < 0 && (t = e._length + t), n < 0 && (n = e._length + n);
3357
3357
  let s = n - t;
3358
3358
  const r = [];
@@ -3371,7 +3371,7 @@ const Ir = (e, t, n) => {
3371
3371
  i = i.right;
3372
3372
  }
3373
3373
  return r;
3374
- }, Lr = (e) => {
3374
+ }, Or = (e) => {
3375
3375
  e.doc ?? M();
3376
3376
  const t = [];
3377
3377
  let n = e._start;
@@ -3394,12 +3394,12 @@ const Ir = (e, t, n) => {
3394
3394
  }
3395
3395
  s = s.right;
3396
3396
  }
3397
- }, Or = (e, t) => {
3397
+ }, Nr = (e, t) => {
3398
3398
  const n = [];
3399
3399
  return Wt(e, (s, r) => {
3400
3400
  n.push(t(s, r, e));
3401
3401
  }), n;
3402
- }, Qc = (e) => {
3402
+ }, Zc = (e) => {
3403
3403
  let t = e._start, n = null, s = 0;
3404
3404
  return {
3405
3405
  [Symbol.iterator]() {
@@ -3423,7 +3423,7 @@ const Ir = (e, t, n) => {
3423
3423
  };
3424
3424
  }
3425
3425
  };
3426
- }, Nr = (e, t) => {
3426
+ }, Mr = (e, t) => {
3427
3427
  e.doc ?? M();
3428
3428
  const n = Ve(e, t);
3429
3429
  let s = e._start;
@@ -3438,7 +3438,7 @@ const Ir = (e, t, n) => {
3438
3438
  const i = e.doc, o = i.clientID, c = i.store, l = n === null ? t._start : n.right;
3439
3439
  let a = [];
3440
3440
  const h = () => {
3441
- a.length > 0 && (r = new S(y(o, A(c, o)), r, r && r.lastId, l, l && l.id, t, null, new ft(a)), r.integrate(e, 0), a = []);
3441
+ a.length > 0 && (r = new S(y(o, A(c, o)), r, r && r.lastId, l, l && l.id, t, null, new pt(a)), r.integrate(e, 0), a = []);
3442
3442
  };
3443
3443
  s.forEach((u) => {
3444
3444
  if (u === null)
@@ -3469,15 +3469,15 @@ const Ir = (e, t, n) => {
3469
3469
  break;
3470
3470
  default:
3471
3471
  if (u instanceof I)
3472
- r = new S(y(o, A(c, o)), r, r && r.lastId, l, l && l.id, t, null, new tt(u)), r.integrate(e, 0);
3472
+ r = new S(y(o, A(c, o)), r, r && r.lastId, l, l && l.id, t, null, new et(u)), r.integrate(e, 0);
3473
3473
  else
3474
3474
  throw new Error("Unexpected content type in insert operation");
3475
3475
  }
3476
3476
  }
3477
3477
  }), h();
3478
- }, Mr = () => P("Length exceeded!"), vr = (e, t, n, s) => {
3478
+ }, vr = () => P("Length exceeded!"), Ur = (e, t, n, s) => {
3479
3479
  if (n > t._length)
3480
- throw Mr();
3480
+ throw vr();
3481
3481
  if (n === 0)
3482
3482
  return t._searchMarker && Kt(t._searchMarker, n, s.length), ke(e, t, null, s);
3483
3483
  const r = n, i = Ve(t, n);
@@ -3491,13 +3491,13 @@ const Ir = (e, t, n) => {
3491
3491
  n -= o.length;
3492
3492
  }
3493
3493
  return t._searchMarker && Kt(t._searchMarker, r, s.length), ke(e, t, o, s);
3494
- }, Zc = (e, t, n) => {
3494
+ }, tl = (e, t, n) => {
3495
3495
  let r = (t._searchMarker || []).reduce((i, o) => o.index > i.index ? o : i, { index: 0, p: t._start }).p;
3496
3496
  if (r)
3497
3497
  for (; r.right; )
3498
3498
  r = r.right;
3499
3499
  return ke(e, t, r, n);
3500
- }, Ur = (e, t, n, s) => {
3500
+ }, Rr = (e, t, n, s) => {
3501
3501
  if (s === 0)
3502
3502
  return;
3503
3503
  const r = n, i = s, o = Ve(t, n);
@@ -3507,7 +3507,7 @@ const Ir = (e, t, n) => {
3507
3507
  for (; s > 0 && c !== null; )
3508
3508
  c.deleted || (s < c.length && U(e, y(c.id.client, c.id.clock + s)), c.delete(e), s -= c.length), c = c.right;
3509
3509
  if (s > 0)
3510
- throw Mr();
3510
+ throw vr();
3511
3511
  t._searchMarker && Kt(
3512
3512
  t._searchMarker,
3513
3513
  r,
@@ -3517,11 +3517,11 @@ const Ir = (e, t, n) => {
3517
3517
  }, _e = (e, t, n) => {
3518
3518
  const s = t._map.get(n);
3519
3519
  s !== void 0 && s.delete(e);
3520
- }, Vn = (e, t, n, s) => {
3520
+ }, Hn = (e, t, n, s) => {
3521
3521
  const r = t._map.get(n) || null, i = e.doc, o = i.clientID;
3522
3522
  let c;
3523
3523
  if (s == null)
3524
- c = new ft([s]);
3524
+ c = new pt([s]);
3525
3525
  else
3526
3526
  switch (s.constructor) {
3527
3527
  case Number:
@@ -3531,7 +3531,7 @@ const Ir = (e, t, n) => {
3531
3531
  case String:
3532
3532
  case Date:
3533
3533
  case BigInt:
3534
- c = new ft([s]);
3534
+ c = new pt([s]);
3535
3535
  break;
3536
3536
  case Uint8Array:
3537
3537
  c = new ee(
@@ -3547,25 +3547,25 @@ const Ir = (e, t, n) => {
3547
3547
  break;
3548
3548
  default:
3549
3549
  if (s instanceof I)
3550
- c = new tt(s);
3550
+ c = new et(s);
3551
3551
  else
3552
3552
  throw new Error("Unexpected content type");
3553
3553
  }
3554
3554
  new S(y(o, A(i.store, o)), r, r && r.lastId, null, null, t, n, c).integrate(e, 0);
3555
- }, jn = (e, t) => {
3555
+ }, zn = (e, t) => {
3556
3556
  e.doc ?? M();
3557
3557
  const n = e._map.get(t);
3558
3558
  return n !== void 0 && !n.deleted ? n.content.getContent()[n.length - 1] : void 0;
3559
- }, Rr = (e) => {
3559
+ }, $r = (e) => {
3560
3560
  const t = {};
3561
3561
  return e.doc ?? M(), e._map.forEach((n, s) => {
3562
3562
  n.deleted || (t[s] = n.content.getContent()[n.length - 1]);
3563
3563
  }), t;
3564
- }, $r = (e, t) => {
3564
+ }, Br = (e, t) => {
3565
3565
  e.doc ?? M();
3566
3566
  const n = e._map.get(t);
3567
3567
  return n !== void 0 && !n.deleted;
3568
- }, tl = (e, t) => {
3568
+ }, el = (e, t) => {
3569
3569
  const n = {};
3570
3570
  return e._map.forEach((s, r) => {
3571
3571
  let i = s;
@@ -3573,12 +3573,12 @@ const Ir = (e, t, n) => {
3573
3573
  i = i.left;
3574
3574
  i !== null && kt(i, t) && (n[r] = i.content.getContent()[i.length - 1]);
3575
3575
  }), n;
3576
- }, ie = (e) => (e.doc ?? M(), pc(
3576
+ }, ie = (e) => (e.doc ?? M(), wc(
3577
3577
  e._map.entries(),
3578
3578
  /** @param {any} entry */
3579
3579
  (t) => !t[1].deleted
3580
3580
  ));
3581
- class el extends Fe {
3581
+ class nl extends Fe {
3582
3582
  }
3583
3583
  class At extends I {
3584
3584
  constructor() {
@@ -3643,7 +3643,7 @@ class At extends I {
3643
3643
  * @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
3644
3644
  */
3645
3645
  _callObserver(t, n) {
3646
- super._callObserver(t, n), je(this, t, new el(this, t));
3646
+ super._callObserver(t, n), je(this, t, new nl(this, t));
3647
3647
  }
3648
3648
  /**
3649
3649
  * Inserts new content at an index.
@@ -3663,7 +3663,7 @@ class At extends I {
3663
3663
  */
3664
3664
  insert(t, n) {
3665
3665
  this.doc !== null ? _(this.doc, (s) => {
3666
- vr(
3666
+ Ur(
3667
3667
  s,
3668
3668
  this,
3669
3669
  t,
@@ -3681,7 +3681,7 @@ class At extends I {
3681
3681
  */
3682
3682
  push(t) {
3683
3683
  this.doc !== null ? _(this.doc, (n) => {
3684
- Zc(
3684
+ tl(
3685
3685
  n,
3686
3686
  this,
3687
3687
  /** @type {any} */
@@ -3705,7 +3705,7 @@ class At extends I {
3705
3705
  */
3706
3706
  delete(t, n = 1) {
3707
3707
  this.doc !== null ? _(this.doc, (s) => {
3708
- Ur(s, this, t, n);
3708
+ Rr(s, this, t, n);
3709
3709
  }) : this._prelimContent.splice(t, n);
3710
3710
  }
3711
3711
  /**
@@ -3715,7 +3715,7 @@ class At extends I {
3715
3715
  * @return {T}
3716
3716
  */
3717
3717
  get(t) {
3718
- return Nr(this, t);
3718
+ return Mr(this, t);
3719
3719
  }
3720
3720
  /**
3721
3721
  * Transforms this YArray to a JavaScript Array.
@@ -3723,7 +3723,7 @@ class At extends I {
3723
3723
  * @return {Array<T>}
3724
3724
  */
3725
3725
  toArray() {
3726
- return Lr(this);
3726
+ return Or(this);
3727
3727
  }
3728
3728
  /**
3729
3729
  * Returns a portion of this YArray into a JavaScript Array selected
@@ -3734,7 +3734,7 @@ class At extends I {
3734
3734
  * @return {Array<T>}
3735
3735
  */
3736
3736
  slice(t = 0, n = this.length) {
3737
- return Ir(this, t, n);
3737
+ return Lr(this, t, n);
3738
3738
  }
3739
3739
  /**
3740
3740
  * Transforms this Shared Type to a JSON object.
@@ -3754,7 +3754,7 @@ class At extends I {
3754
3754
  * callback function
3755
3755
  */
3756
3756
  map(t) {
3757
- return Or(
3757
+ return Nr(
3758
3758
  this,
3759
3759
  /** @type {any} */
3760
3760
  t
@@ -3772,17 +3772,17 @@ class At extends I {
3772
3772
  * @return {IterableIterator<T>}
3773
3773
  */
3774
3774
  [Symbol.iterator]() {
3775
- return Qc(this);
3775
+ return Zc(this);
3776
3776
  }
3777
3777
  /**
3778
3778
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
3779
3779
  */
3780
3780
  _write(t) {
3781
- t.writeTypeRef(Al);
3781
+ t.writeTypeRef(Tl);
3782
3782
  }
3783
3783
  }
3784
- const nl = (e) => new At();
3785
- class sl extends Fe {
3784
+ const sl = (e) => new At();
3785
+ class rl extends Fe {
3786
3786
  /**
3787
3787
  * @param {YMap<T>} ymap The YArray that changed.
3788
3788
  * @param {Transaction} transaction
@@ -3844,7 +3844,7 @@ class Mt extends I {
3844
3844
  * @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
3845
3845
  */
3846
3846
  _callObserver(t, n) {
3847
- je(this, t, new sl(this, t, n));
3847
+ je(this, t, new rl(this, t, n));
3848
3848
  }
3849
3849
  /**
3850
3850
  * Transforms this Shared Type to a JSON object.
@@ -3875,7 +3875,7 @@ class Mt extends I {
3875
3875
  * @return {IterableIterator<string>}
3876
3876
  */
3877
3877
  keys() {
3878
- return We(
3878
+ return Xe(
3879
3879
  ie(this),
3880
3880
  /** @param {any} v */
3881
3881
  (t) => t[0]
@@ -3887,7 +3887,7 @@ class Mt extends I {
3887
3887
  * @return {IterableIterator<MapType>}
3888
3888
  */
3889
3889
  values() {
3890
- return We(
3890
+ return Xe(
3891
3891
  ie(this),
3892
3892
  /** @param {any} v */
3893
3893
  (t) => t[1].content.getContent()[t[1].length - 1]
@@ -3899,7 +3899,7 @@ class Mt extends I {
3899
3899
  * @return {IterableIterator<[string, MapType]>}
3900
3900
  */
3901
3901
  entries() {
3902
- return We(
3902
+ return Xe(
3903
3903
  ie(this),
3904
3904
  /** @param {any} v */
3905
3905
  (t) => (
@@ -3946,7 +3946,7 @@ class Mt extends I {
3946
3946
  */
3947
3947
  set(t, n) {
3948
3948
  return this.doc !== null ? _(this.doc, (s) => {
3949
- Vn(
3949
+ Hn(
3950
3950
  s,
3951
3951
  this,
3952
3952
  t,
@@ -3964,7 +3964,7 @@ class Mt extends I {
3964
3964
  get(t) {
3965
3965
  return (
3966
3966
  /** @type {any} */
3967
- jn(this, t)
3967
+ zn(this, t)
3968
3968
  );
3969
3969
  }
3970
3970
  /**
@@ -3974,7 +3974,7 @@ class Mt extends I {
3974
3974
  * @return {boolean}
3975
3975
  */
3976
3976
  has(t) {
3977
- return $r(this, t);
3977
+ return Br(this, t);
3978
3978
  }
3979
3979
  /**
3980
3980
  * Removes all elements from this YMap.
@@ -3990,11 +3990,11 @@ class Mt extends I {
3990
3990
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
3991
3991
  */
3992
3992
  _write(t) {
3993
- t.writeTypeRef(Tl);
3993
+ t.writeTypeRef(xl);
3994
3994
  }
3995
3995
  }
3996
- const rl = (e) => new Mt(), nt = (e, t) => e === t || typeof e == "object" && typeof t == "object" && e && t && lo(e, t);
3997
- class un {
3996
+ const il = (e) => new Mt(), st = (e, t) => e === t || typeof e == "object" && typeof t == "object" && e && t && ao(e, t);
3997
+ class dn {
3998
3998
  /**
3999
3999
  * @param {Item|null} left
4000
4000
  * @param {Item|null} right
@@ -4015,7 +4015,7 @@ class un {
4015
4015
  ) : this.right.deleted || (this.index += this.right.length), this.left = this.right, this.right = this.right.right;
4016
4016
  }
4017
4017
  }
4018
- const ks = (e, t, n) => {
4018
+ const _s = (e, t, n) => {
4019
4019
  for (; t.right !== null && n > 0; )
4020
4020
  t.right.content.constructor === T ? t.right.deleted || Bt(
4021
4021
  t.currentAttributes,
@@ -4026,14 +4026,14 @@ const ks = (e, t, n) => {
4026
4026
  }, oe = (e, t, n, s) => {
4027
4027
  const r = /* @__PURE__ */ new Map(), i = s ? Ve(t, n) : null;
4028
4028
  if (i) {
4029
- const o = new un(i.p.left, i.p, i.index, r);
4030
- return ks(e, o, n - i.index);
4029
+ const o = new dn(i.p.left, i.p, i.index, r);
4030
+ return _s(e, o, n - i.index);
4031
4031
  } else {
4032
- const o = new un(null, t._start, 0, r);
4033
- return ks(e, o, n);
4032
+ const o = new dn(null, t._start, 0, r);
4033
+ return _s(e, o, n);
4034
4034
  }
4035
- }, Br = (e, t, n, s) => {
4036
- for (; n.right !== null && (n.right.deleted === !0 || n.right.content.constructor === T && nt(
4035
+ }, Fr = (e, t, n, s) => {
4036
+ for (; n.right !== null && (n.right.deleted === !0 || n.right.content.constructor === T && st(
4037
4037
  s.get(
4038
4038
  /** @type {ContentFormat} */
4039
4039
  n.right.content.key
@@ -4053,9 +4053,9 @@ const ks = (e, t, n) => {
4053
4053
  }, Bt = (e, t) => {
4054
4054
  const { key: n, value: s } = t;
4055
4055
  s === null ? e.delete(n) : e.set(n, s);
4056
- }, Fr = (e, t) => {
4056
+ }, Vr = (e, t) => {
4057
4057
  for (; e.right !== null; ) {
4058
- if (!(e.right.deleted || e.right.content.constructor === T && nt(
4058
+ if (!(e.right.deleted || e.right.content.constructor === T && st(
4059
4059
  t[
4060
4060
  /** @type {ContentFormat} */
4061
4061
  e.right.content.key
@@ -4065,33 +4065,33 @@ const ks = (e, t, n) => {
4065
4065
  ))) break;
4066
4066
  e.forward();
4067
4067
  }
4068
- }, Vr = (e, t, n, s) => {
4068
+ }, jr = (e, t, n, s) => {
4069
4069
  const r = e.doc, i = r.clientID, o = /* @__PURE__ */ new Map();
4070
4070
  for (const c in s) {
4071
4071
  const l = s[c], a = n.currentAttributes.get(c) ?? null;
4072
- if (!nt(a, l)) {
4072
+ if (!st(a, l)) {
4073
4073
  o.set(c, a);
4074
4074
  const { left: h, right: u } = n;
4075
4075
  n.right = new S(y(i, A(r.store, i)), h, h && h.lastId, u, u && u.id, t, null, new T(c, l)), n.right.integrate(e, 0), n.forward();
4076
4076
  }
4077
4077
  }
4078
4078
  return o;
4079
- }, Xe = (e, t, n, s, r) => {
4079
+ }, qe = (e, t, n, s, r) => {
4080
4080
  n.currentAttributes.forEach((d, f) => {
4081
4081
  r[f] === void 0 && (r[f] = null);
4082
4082
  });
4083
4083
  const i = e.doc, o = i.clientID;
4084
- Fr(n, r);
4085
- const c = Vr(e, t, n, r), l = s.constructor === String ? new G(
4084
+ Vr(n, r);
4085
+ const c = jr(e, t, n, r), l = s.constructor === String ? new G(
4086
4086
  /** @type {string} */
4087
4087
  s
4088
- ) : s instanceof I ? new tt(s) : new yt(s);
4088
+ ) : s instanceof I ? new et(s) : new yt(s);
4089
4089
  let { left: a, right: h, index: u } = n;
4090
- t._searchMarker && Kt(t._searchMarker, n.index, l.getLength()), h = new S(y(o, A(i.store, o)), a, a && a.lastId, h, h && h.id, t, null, l), h.integrate(e, 0), n.right = h, n.index = u, n.forward(), Br(e, t, n, c);
4091
- }, _s = (e, t, n, s, r) => {
4090
+ t._searchMarker && Kt(t._searchMarker, n.index, l.getLength()), h = new S(y(o, A(i.store, o)), a, a && a.lastId, h, h && h.id, t, null, l), h.integrate(e, 0), n.right = h, n.index = u, n.forward(), Fr(e, t, n, c);
4091
+ }, Ss = (e, t, n, s, r) => {
4092
4092
  const i = e.doc, o = i.clientID;
4093
- Fr(n, r);
4094
- const c = Vr(e, t, n, r);
4093
+ Vr(n, r);
4094
+ const c = jr(e, t, n, r);
4095
4095
  t: for (; n.right !== null && (s > 0 || c.size > 0 && (n.right.deleted || n.right.content.constructor === T)); ) {
4096
4096
  if (!n.right.deleted)
4097
4097
  switch (n.right.content.constructor) {
@@ -4101,7 +4101,7 @@ const ks = (e, t, n) => {
4101
4101
  n.right.content
4102
4102
  ), h = r[l];
4103
4103
  if (h !== void 0) {
4104
- if (nt(h, a))
4104
+ if (st(h, a))
4105
4105
  c.delete(l);
4106
4106
  else {
4107
4107
  if (s === 0)
@@ -4126,8 +4126,8 @@ const ks = (e, t, n) => {
4126
4126
  `;
4127
4127
  n.right = new S(y(o, A(i.store, o)), n.left, n.left && n.left.lastId, n.right, n.right && n.right.id, t, null, new G(l)), n.right.integrate(e, 0), n.forward();
4128
4128
  }
4129
- Br(e, t, n, c);
4130
- }, jr = (e, t, n, s, r) => {
4129
+ Fr(e, t, n, c);
4130
+ }, Hr = (e, t, n, s, r) => {
4131
4131
  let i = t;
4132
4132
  const o = R();
4133
4133
  for (; i && (!i.countable || i.deleted); ) {
@@ -4160,7 +4160,7 @@ const ks = (e, t, n) => {
4160
4160
  t.right;
4161
4161
  }
4162
4162
  return c;
4163
- }, il = (e, t) => {
4163
+ }, ol = (e, t) => {
4164
4164
  for (; t && t.right && (t.right.deleted || !t.right.countable); )
4165
4165
  t = t.right;
4166
4166
  const n = /* @__PURE__ */ new Set();
@@ -4174,7 +4174,7 @@ const ks = (e, t, n) => {
4174
4174
  }
4175
4175
  t = t.left;
4176
4176
  }
4177
- }, ol = (e) => {
4177
+ }, cl = (e) => {
4178
4178
  let t = 0;
4179
4179
  return _(
4180
4180
  /** @type {Doc} */
@@ -4184,20 +4184,20 @@ const ks = (e, t, n) => {
4184
4184
  /** @type {Item} */
4185
4185
  e._start
4186
4186
  ), r = e._start, i = R();
4187
- const o = en(i);
4187
+ const o = nn(i);
4188
4188
  for (; r; )
4189
4189
  r.deleted === !1 && (r.content.constructor === T ? Bt(
4190
4190
  o,
4191
4191
  /** @type {ContentFormat} */
4192
4192
  r.content
4193
- ) : (t += jr(n, s, r, i, o), i = en(o), s = r)), r = r.right;
4193
+ ) : (t += Hr(n, s, r, i, o), i = nn(o), s = r)), r = r.right;
4194
4194
  }
4195
4195
  ), t;
4196
- }, cl = (e) => {
4196
+ }, ll = (e) => {
4197
4197
  const t = /* @__PURE__ */ new Set(), n = e.doc;
4198
4198
  for (const [s, r] of e.afterState.entries()) {
4199
4199
  const i = e.beforeState.get(s) || 0;
4200
- r !== i && Er(
4200
+ r !== i && Dr(
4201
4201
  e,
4202
4202
  /** @type {Array<Item|GC>} */
4203
4203
  n.store.clients.get(s),
@@ -4224,17 +4224,17 @@ const ks = (e, t, n) => {
4224
4224
  /** @type {YText} */
4225
4225
  r.parent
4226
4226
  );
4227
- r.content.constructor === T ? t.add(i) : il(s, r);
4227
+ r.content.constructor === T ? t.add(i) : ol(s, r);
4228
4228
  });
4229
4229
  for (const r of t)
4230
- ol(r);
4230
+ cl(r);
4231
4231
  });
4232
- }, Ss = (e, t, n) => {
4233
- const s = n, r = en(t.currentAttributes), i = t.right;
4232
+ }, Cs = (e, t, n) => {
4233
+ const s = n, r = nn(t.currentAttributes), i = t.right;
4234
4234
  for (; n > 0 && t.right !== null; ) {
4235
4235
  if (t.right.deleted === !1)
4236
4236
  switch (t.right.content.constructor) {
4237
- case tt:
4237
+ case et:
4238
4238
  case yt:
4239
4239
  case G:
4240
4240
  n < t.right.length && U(e, y(t.right.id.client, t.right.id.clock + n)), n -= t.right.length, t.right.delete(e);
@@ -4242,7 +4242,7 @@ const ks = (e, t, n) => {
4242
4242
  }
4243
4243
  t.forward();
4244
4244
  }
4245
- i && jr(e, i, t.right, r, t.currentAttributes);
4245
+ i && Hr(e, i, t.right, r, t.currentAttributes);
4246
4246
  const o = (
4247
4247
  /** @type {AbstractType<any>} */
4248
4248
  /** @type {Item} */
@@ -4250,7 +4250,7 @@ const ks = (e, t, n) => {
4250
4250
  );
4251
4251
  return o._searchMarker && Kt(o._searchMarker, t.index, -s + n), t;
4252
4252
  };
4253
- class ll extends Fe {
4253
+ class al extends Fe {
4254
4254
  /**
4255
4255
  * @param {YText} ytext
4256
4256
  * @param {Transaction} transaction
@@ -4311,7 +4311,7 @@ class ll extends Fe {
4311
4311
  }))), a = "";
4312
4312
  break;
4313
4313
  case "retain":
4314
- h > 0 && (f = { retain: h }, co(l) || (f.attributes = so({}, l))), h = 0;
4314
+ h > 0 && (f = { retain: h }, lo(l) || (f.attributes = ro({}, l))), h = 0;
4315
4315
  break;
4316
4316
  }
4317
4317
  f && n.push(f), c = null;
@@ -4319,7 +4319,7 @@ class ll extends Fe {
4319
4319
  };
4320
4320
  for (; o !== null; ) {
4321
4321
  switch (o.content.constructor) {
4322
- case tt:
4322
+ case et:
4323
4323
  case yt:
4324
4324
  this.adds(o) ? this.deletes(o) || (d(), c = "insert", a = o.content.getContent()[0], d()) : this.deletes(o) ? (c !== "delete" && (d(), c = "delete"), u += 1) : o.deleted || (c !== "retain" && (d(), c = "retain"), h += 1);
4325
4325
  break;
@@ -4335,16 +4335,16 @@ class ll extends Fe {
4335
4335
  if (this.adds(o)) {
4336
4336
  if (!this.deletes(o)) {
4337
4337
  const p = r.get(f) ?? null;
4338
- nt(p, g) ? g !== null && o.delete(s) : (c === "retain" && d(), nt(g, i.get(f) ?? null) ? delete l[f] : l[f] = g);
4338
+ st(p, g) ? g !== null && o.delete(s) : (c === "retain" && d(), st(g, i.get(f) ?? null) ? delete l[f] : l[f] = g);
4339
4339
  }
4340
4340
  } else if (this.deletes(o)) {
4341
4341
  i.set(f, g);
4342
4342
  const p = r.get(f) ?? null;
4343
- nt(p, g) || (c === "retain" && d(), l[f] = p);
4343
+ st(p, g) || (c === "retain" && d(), l[f] = p);
4344
4344
  } else if (!o.deleted) {
4345
4345
  i.set(f, g);
4346
4346
  const p = l[f];
4347
- p !== void 0 && (nt(p, g) ? p !== null && o.delete(s) : (c === "retain" && d(), g === null ? delete l[f] : l[f] = g));
4347
+ p !== void 0 && (st(p, g) ? p !== null && o.delete(s) : (c === "retain" && d(), g === null ? delete l[f] : l[f] = g));
4348
4348
  }
4349
4349
  o.deleted || (c === "insert" && d(), Bt(
4350
4350
  r,
@@ -4421,7 +4421,7 @@ class vt extends I {
4421
4421
  */
4422
4422
  _callObserver(t, n) {
4423
4423
  super._callObserver(t, n);
4424
- const s = new ll(this, t, n);
4424
+ const s = new al(this, t, n);
4425
4425
  je(this, t, s), !t.local && this._hasFormatting && (t._needFormattingCleanup = !0);
4426
4426
  }
4427
4427
  /**
@@ -4458,14 +4458,14 @@ class vt extends I {
4458
4458
  */
4459
4459
  applyDelta(t, { sanitize: n = !0 } = {}) {
4460
4460
  this.doc !== null ? _(this.doc, (s) => {
4461
- const r = new un(null, this._start, 0, /* @__PURE__ */ new Map());
4461
+ const r = new dn(null, this._start, 0, /* @__PURE__ */ new Map());
4462
4462
  for (let i = 0; i < t.length; i++) {
4463
4463
  const o = t[i];
4464
4464
  if (o.insert !== void 0) {
4465
4465
  const c = !n && typeof o.insert == "string" && i === t.length - 1 && r.right === null && o.insert.slice(-1) === `
4466
4466
  ` ? o.insert.slice(0, -1) : o.insert;
4467
- (typeof c != "string" || c.length > 0) && Xe(s, this, r, c, o.attributes || {});
4468
- } else o.retain !== void 0 ? _s(s, this, r, o.retain, o.attributes || {}) : o.delete !== void 0 && Ss(s, r, o.delete);
4467
+ (typeof c != "string" || c.length > 0) && qe(s, this, r, c, o.attributes || {});
4468
+ } else o.retain !== void 0 ? Ss(s, this, r, o.retain, o.attributes || {}) : o.delete !== void 0 && Cs(s, r, o.delete);
4469
4469
  }
4470
4470
  }) : this._pending.push(() => this.applyDelta(t));
4471
4471
  }
@@ -4507,7 +4507,7 @@ class vt extends I {
4507
4507
  l.content.str;
4508
4508
  break;
4509
4509
  }
4510
- case tt:
4510
+ case et:
4511
4511
  case yt: {
4512
4512
  a();
4513
4513
  const u = {
@@ -4538,7 +4538,7 @@ class vt extends I {
4538
4538
  a();
4539
4539
  };
4540
4540
  return t || n ? _(o, (u) => {
4541
- t && an(u, t), n && an(u, n), h();
4541
+ t && hn(u, t), n && hn(u, n), h();
4542
4542
  }, "cleanup") : h(), r;
4543
4543
  }
4544
4544
  /**
@@ -4559,7 +4559,7 @@ class vt extends I {
4559
4559
  const o = oe(i, this, t, !s);
4560
4560
  s || (s = {}, o.currentAttributes.forEach((c, l) => {
4561
4561
  s[l] = c;
4562
- })), Xe(i, this, o, n, s);
4562
+ })), qe(i, this, o, n, s);
4563
4563
  }) : this._pending.push(() => this.insert(t, n, s));
4564
4564
  }
4565
4565
  /**
@@ -4576,7 +4576,7 @@ class vt extends I {
4576
4576
  const r = this.doc;
4577
4577
  r !== null ? _(r, (i) => {
4578
4578
  const o = oe(i, this, t, !s);
4579
- Xe(i, this, o, n, s || {});
4579
+ qe(i, this, o, n, s || {});
4580
4580
  }) : this._pending.push(() => this.insertEmbed(t, n, s || {}));
4581
4581
  }
4582
4582
  /**
@@ -4592,7 +4592,7 @@ class vt extends I {
4592
4592
  return;
4593
4593
  const s = this.doc;
4594
4594
  s !== null ? _(s, (r) => {
4595
- Ss(r, oe(r, this, t, !0), n);
4595
+ Cs(r, oe(r, this, t, !0), n);
4596
4596
  }) : this._pending.push(() => this.delete(t, n));
4597
4597
  }
4598
4598
  /**
@@ -4611,7 +4611,7 @@ class vt extends I {
4611
4611
  const r = this.doc;
4612
4612
  r !== null ? _(r, (i) => {
4613
4613
  const o = oe(i, this, t, !1);
4614
- o.right !== null && _s(i, this, o, n, s);
4614
+ o.right !== null && Ss(i, this, o, n, s);
4615
4615
  }) : this._pending.push(() => this.format(t, n, s));
4616
4616
  }
4617
4617
  /**
@@ -4640,7 +4640,7 @@ class vt extends I {
4640
4640
  */
4641
4641
  setAttribute(t, n) {
4642
4642
  this.doc !== null ? _(this.doc, (s) => {
4643
- Vn(s, this, t, n);
4643
+ Hn(s, this, t, n);
4644
4644
  }) : this._pending.push(() => this.setAttribute(t, n));
4645
4645
  }
4646
4646
  /**
@@ -4657,7 +4657,7 @@ class vt extends I {
4657
4657
  getAttribute(t) {
4658
4658
  return (
4659
4659
  /** @type {any} */
4660
- jn(this, t)
4660
+ zn(this, t)
4661
4661
  );
4662
4662
  }
4663
4663
  /**
@@ -4670,17 +4670,17 @@ class vt extends I {
4670
4670
  * @public
4671
4671
  */
4672
4672
  getAttributes() {
4673
- return Rr(this);
4673
+ return $r(this);
4674
4674
  }
4675
4675
  /**
4676
4676
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
4677
4677
  */
4678
4678
  _write(t) {
4679
- t.writeTypeRef(xl);
4679
+ t.writeTypeRef(Il);
4680
4680
  }
4681
4681
  }
4682
- const al = (e) => new vt();
4683
- class qe {
4682
+ const hl = (e) => new vt();
4683
+ class Qe {
4684
4684
  /**
4685
4685
  * @param {YXmlFragment | YXmlElement} root
4686
4686
  * @param {function(AbstractType<any>):boolean} [f]
@@ -4705,7 +4705,7 @@ class qe {
4705
4705
  if (t !== null && (!this._firstCall || t.deleted || !this._filter(n)))
4706
4706
  do
4707
4707
  if (n = /** @type {any} */
4708
- t.content.type, !t.deleted && (n.constructor === q || n.constructor === dt) && n._start !== null)
4708
+ t.content.type, !t.deleted && (n.constructor === q || n.constructor === gt) && n._start !== null)
4709
4709
  t = n._start;
4710
4710
  else
4711
4711
  for (; t !== null; ) {
@@ -4726,7 +4726,7 @@ class qe {
4726
4726
  ), done: !1 });
4727
4727
  }
4728
4728
  }
4729
- class dt extends I {
4729
+ class gt extends I {
4730
4730
  constructor() {
4731
4731
  super(), this._prelimContent = [];
4732
4732
  }
@@ -4755,7 +4755,7 @@ class dt extends I {
4755
4755
  ), this._prelimContent = null;
4756
4756
  }
4757
4757
  _copy() {
4758
- return new dt();
4758
+ return new gt();
4759
4759
  }
4760
4760
  /**
4761
4761
  * Makes a copy of this data type that can be included somewhere else.
@@ -4765,7 +4765,7 @@ class dt extends I {
4765
4765
  * @return {YXmlFragment}
4766
4766
  */
4767
4767
  clone() {
4768
- const t = new dt();
4768
+ const t = new gt();
4769
4769
  return t.insert(0, this.toArray().map((n) => n instanceof I ? n.clone() : n)), t;
4770
4770
  }
4771
4771
  get length() {
@@ -4789,7 +4789,7 @@ class dt extends I {
4789
4789
  * @public
4790
4790
  */
4791
4791
  createTreeWalker(t) {
4792
- return new qe(this, t);
4792
+ return new Qe(this, t);
4793
4793
  }
4794
4794
  /**
4795
4795
  * Returns the first YXmlElement that matches the query.
@@ -4808,7 +4808,7 @@ class dt extends I {
4808
4808
  */
4809
4809
  querySelector(t) {
4810
4810
  t = t.toUpperCase();
4811
- const s = new qe(this, (r) => r.nodeName && r.nodeName.toUpperCase() === t).next();
4811
+ const s = new Qe(this, (r) => r.nodeName && r.nodeName.toUpperCase() === t).next();
4812
4812
  return s.done ? null : s.value;
4813
4813
  }
4814
4814
  /**
@@ -4823,7 +4823,7 @@ class dt extends I {
4823
4823
  * @public
4824
4824
  */
4825
4825
  querySelectorAll(t) {
4826
- return t = t.toUpperCase(), X(new qe(this, (n) => n.nodeName && n.nodeName.toUpperCase() === t));
4826
+ return t = t.toUpperCase(), X(new Qe(this, (n) => n.nodeName && n.nodeName.toUpperCase() === t));
4827
4827
  }
4828
4828
  /**
4829
4829
  * Creates YXmlEvent and calls observers.
@@ -4832,7 +4832,7 @@ class dt extends I {
4832
4832
  * @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
4833
4833
  */
4834
4834
  _callObserver(t, n) {
4835
- je(this, t, new dl(this, n, t));
4835
+ je(this, t, new fl(this, n, t));
4836
4836
  }
4837
4837
  /**
4838
4838
  * Get the string representation of all the children of this YXmlFragment.
@@ -4840,7 +4840,7 @@ class dt extends I {
4840
4840
  * @return {string} The string representation of all children.
4841
4841
  */
4842
4842
  toString() {
4843
- return Or(this, (t) => t.toString()).join("");
4843
+ return Nr(this, (t) => t.toString()).join("");
4844
4844
  }
4845
4845
  /**
4846
4846
  * @return {string}
@@ -4881,7 +4881,7 @@ class dt extends I {
4881
4881
  */
4882
4882
  insert(t, n) {
4883
4883
  this.doc !== null ? _(this.doc, (s) => {
4884
- vr(s, this, t, n);
4884
+ Ur(s, this, t, n);
4885
4885
  }) : this._prelimContent.splice(t, 0, ...n);
4886
4886
  }
4887
4887
  /**
@@ -4918,7 +4918,7 @@ class dt extends I {
4918
4918
  */
4919
4919
  delete(t, n = 1) {
4920
4920
  this.doc !== null ? _(this.doc, (s) => {
4921
- Ur(s, this, t, n);
4921
+ Rr(s, this, t, n);
4922
4922
  }) : this._prelimContent.splice(t, n);
4923
4923
  }
4924
4924
  /**
@@ -4927,7 +4927,7 @@ class dt extends I {
4927
4927
  * @return {Array<YXmlElement|YXmlText|YXmlHook>}
4928
4928
  */
4929
4929
  toArray() {
4930
- return Lr(this);
4930
+ return Or(this);
4931
4931
  }
4932
4932
  /**
4933
4933
  * Appends content to this YArray.
@@ -4952,7 +4952,7 @@ class dt extends I {
4952
4952
  * @return {YXmlElement|YXmlText}
4953
4953
  */
4954
4954
  get(t) {
4955
- return Nr(this, t);
4955
+ return Mr(this, t);
4956
4956
  }
4957
4957
  /**
4958
4958
  * Returns a portion of this YXmlFragment into a JavaScript Array selected
@@ -4963,7 +4963,7 @@ class dt extends I {
4963
4963
  * @return {Array<YXmlElement|YXmlText>}
4964
4964
  */
4965
4965
  slice(t = 0, n = this.length) {
4966
- return Ir(this, t, n);
4966
+ return Lr(this, t, n);
4967
4967
  }
4968
4968
  /**
4969
4969
  * Executes a provided function on once on every child element.
@@ -4982,11 +4982,11 @@ class dt extends I {
4982
4982
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
4983
4983
  */
4984
4984
  _write(t) {
4985
- t.writeTypeRef(Ll);
4985
+ t.writeTypeRef(Ol);
4986
4986
  }
4987
4987
  }
4988
- const hl = (e) => new dt();
4989
- class q extends dt {
4988
+ const ul = (e) => new gt();
4989
+ class q extends gt {
4990
4990
  constructor(t = "UNDEFINED") {
4991
4991
  super(), this.nodeName = t, this._prelimAttrs = /* @__PURE__ */ new Map();
4992
4992
  }
@@ -5045,7 +5045,7 @@ class q extends dt {
5045
5045
  */
5046
5046
  clone() {
5047
5047
  const t = new q(this.nodeName), n = this.getAttributes();
5048
- return io(n, (s, r) => {
5048
+ return oo(n, (s, r) => {
5049
5049
  t.setAttribute(
5050
5050
  r,
5051
5051
  /** @type {any} */
@@ -5099,7 +5099,7 @@ class q extends dt {
5099
5099
  */
5100
5100
  setAttribute(t, n) {
5101
5101
  this.doc !== null ? _(this.doc, (s) => {
5102
- Vn(s, this, t, n);
5102
+ Hn(s, this, t, n);
5103
5103
  }) : this._prelimAttrs.set(t, n);
5104
5104
  }
5105
5105
  /**
@@ -5116,7 +5116,7 @@ class q extends dt {
5116
5116
  getAttribute(t) {
5117
5117
  return (
5118
5118
  /** @type {any} */
5119
- jn(this, t)
5119
+ zn(this, t)
5120
5120
  );
5121
5121
  }
5122
5122
  /**
@@ -5130,7 +5130,7 @@ class q extends dt {
5130
5130
  hasAttribute(t) {
5131
5131
  return (
5132
5132
  /** @type {any} */
5133
- $r(this, t)
5133
+ Br(this, t)
5134
5134
  );
5135
5135
  }
5136
5136
  /**
@@ -5144,7 +5144,7 @@ class q extends dt {
5144
5144
  getAttributes(t) {
5145
5145
  return (
5146
5146
  /** @type {any} */
5147
- t ? tl(this, t) : Rr(this)
5147
+ t ? el(this, t) : $r(this)
5148
5148
  );
5149
5149
  }
5150
5150
  /**
@@ -5181,11 +5181,11 @@ class q extends dt {
5181
5181
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
5182
5182
  */
5183
5183
  _write(t) {
5184
- t.writeTypeRef(Il), t.writeKey(this.nodeName);
5184
+ t.writeTypeRef(Ll), t.writeKey(this.nodeName);
5185
5185
  }
5186
5186
  }
5187
- const ul = (e) => new q(e.readKey());
5188
- class dl extends Fe {
5187
+ const dl = (e) => new q(e.readKey());
5188
+ class fl extends Fe {
5189
5189
  /**
5190
5190
  * @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created.
5191
5191
  * @param {Set<string|null>} subs The set of changed attributes. `null` is included if the
@@ -5254,10 +5254,10 @@ class Se extends Mt {
5254
5254
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
5255
5255
  */
5256
5256
  _write(t) {
5257
- t.writeTypeRef(Ol), t.writeKey(this.hookName);
5257
+ t.writeTypeRef(Nl), t.writeKey(this.hookName);
5258
5258
  }
5259
5259
  }
5260
- const fl = (e) => new Se(e.readKey());
5260
+ const gl = (e) => new Se(e.readKey());
5261
5261
  class Q extends vt {
5262
5262
  /**
5263
5263
  * @type {YXmlElement|YXmlText|null}
@@ -5350,11 +5350,11 @@ class Q extends vt {
5350
5350
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
5351
5351
  */
5352
5352
  _write(t) {
5353
- t.writeTypeRef(Nl);
5353
+ t.writeTypeRef(Ml);
5354
5354
  }
5355
5355
  }
5356
- const gl = (e) => new Q();
5357
- class Hn {
5356
+ const pl = (e) => new Q();
5357
+ class Pn {
5358
5358
  /**
5359
5359
  * @param {ID} id
5360
5360
  * @param {number} length
@@ -5394,8 +5394,8 @@ class Hn {
5394
5394
  throw j();
5395
5395
  }
5396
5396
  }
5397
- const pl = 0;
5398
- class B extends Hn {
5397
+ const wl = 0;
5398
+ class B extends Pn {
5399
5399
  get deleted() {
5400
5400
  return !0;
5401
5401
  }
@@ -5413,14 +5413,14 @@ class B extends Hn {
5413
5413
  * @param {number} offset
5414
5414
  */
5415
5415
  integrate(t, n) {
5416
- n > 0 && (this.id.clock += n, this.length -= n), Cr(t.doc.store, this);
5416
+ n > 0 && (this.id.clock += n, this.length -= n), Er(t.doc.store, this);
5417
5417
  }
5418
5418
  /**
5419
5419
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
5420
5420
  * @param {number} offset
5421
5421
  */
5422
5422
  write(t, n) {
5423
- t.writeInfo(pl), t.writeLen(this.length - n);
5423
+ t.writeInfo(wl), t.writeLen(this.length - n);
5424
5424
  }
5425
5425
  /**
5426
5426
  * @param {Transaction} transaction
@@ -5506,7 +5506,7 @@ class ee {
5506
5506
  return 3;
5507
5507
  }
5508
5508
  }
5509
- const wl = (e) => new ee(e.readBuf());
5509
+ const ml = (e) => new ee(e.readBuf());
5510
5510
  class Xt {
5511
5511
  /**
5512
5512
  * @param {number} len
@@ -5584,7 +5584,7 @@ class Xt {
5584
5584
  return 1;
5585
5585
  }
5586
5586
  }
5587
- const ml = (e) => new Xt(e.readLen()), Hr = (e, t) => new mt({ guid: e, ...t, shouldLoad: t.shouldLoad || t.autoLoad || !1 });
5587
+ const yl = (e) => new Xt(e.readLen()), zr = (e, t) => new mt({ guid: e, ...t, shouldLoad: t.shouldLoad || t.autoLoad || !1 });
5588
5588
  class ne {
5589
5589
  /**
5590
5590
  * @param {Doc} doc
@@ -5616,7 +5616,7 @@ class ne {
5616
5616
  * @return {ContentDoc}
5617
5617
  */
5618
5618
  copy() {
5619
- return new ne(Hr(this.doc.guid, this.opts));
5619
+ return new ne(zr(this.doc.guid, this.opts));
5620
5620
  }
5621
5621
  /**
5622
5622
  * @param {number} offset
@@ -5664,7 +5664,7 @@ class ne {
5664
5664
  return 9;
5665
5665
  }
5666
5666
  }
5667
- const yl = (e) => new ne(Hr(e.readString(), e.readAny()));
5667
+ const bl = (e) => new ne(zr(e.readString(), e.readAny()));
5668
5668
  class yt {
5669
5669
  /**
5670
5670
  * @param {Object} embed
@@ -5740,7 +5740,7 @@ class yt {
5740
5740
  return 5;
5741
5741
  }
5742
5742
  }
5743
- const bl = (e) => new yt(e.readJSON());
5743
+ const kl = (e) => new yt(e.readJSON());
5744
5744
  class T {
5745
5745
  /**
5746
5746
  * @param {string} key
@@ -5822,7 +5822,7 @@ class T {
5822
5822
  return 6;
5823
5823
  }
5824
5824
  }
5825
- const kl = (e) => new T(e.readKey(), e.readJSON());
5825
+ const _l = (e) => new T(e.readKey(), e.readJSON());
5826
5826
  class Ce {
5827
5827
  /**
5828
5828
  * @param {Array<any>} arr
@@ -5904,20 +5904,20 @@ class Ce {
5904
5904
  return 2;
5905
5905
  }
5906
5906
  }
5907
- const _l = (e) => {
5907
+ const Sl = (e) => {
5908
5908
  const t = e.readLen(), n = [];
5909
5909
  for (let s = 0; s < t; s++) {
5910
5910
  const r = e.readString();
5911
5911
  r === "undefined" ? n.push(void 0) : n.push(JSON.parse(r));
5912
5912
  }
5913
5913
  return new Ce(n);
5914
- }, Sl = pe("node_env") === "development";
5915
- class ft {
5914
+ }, Cl = pe("node_env") === "development";
5915
+ class pt {
5916
5916
  /**
5917
5917
  * @param {Array<any>} arr
5918
5918
  */
5919
5919
  constructor(t) {
5920
- this.arr = t, Sl && Vs(t);
5920
+ this.arr = t, Cl && js(t);
5921
5921
  }
5922
5922
  /**
5923
5923
  * @return {number}
@@ -5941,14 +5941,14 @@ class ft {
5941
5941
  * @return {ContentAny}
5942
5942
  */
5943
5943
  copy() {
5944
- return new ft(this.arr);
5944
+ return new pt(this.arr);
5945
5945
  }
5946
5946
  /**
5947
5947
  * @param {number} offset
5948
5948
  * @return {ContentAny}
5949
5949
  */
5950
5950
  splice(t) {
5951
- const n = new ft(this.arr.slice(t));
5951
+ const n = new pt(this.arr.slice(t));
5952
5952
  return this.arr = this.arr.slice(0, t), n;
5953
5953
  }
5954
5954
  /**
@@ -5993,11 +5993,11 @@ class ft {
5993
5993
  return 8;
5994
5994
  }
5995
5995
  }
5996
- const Cl = (e) => {
5996
+ const El = (e) => {
5997
5997
  const t = e.readLen(), n = [];
5998
5998
  for (let s = 0; s < t; s++)
5999
5999
  n.push(e.readAny());
6000
- return new ft(n);
6000
+ return new pt(n);
6001
6001
  };
6002
6002
  class G {
6003
6003
  /**
@@ -6077,16 +6077,16 @@ class G {
6077
6077
  return 4;
6078
6078
  }
6079
6079
  }
6080
- const El = (e) => new G(e.readString()), Dl = [
6081
- nl,
6082
- rl,
6083
- al,
6084
- ul,
6080
+ const Dl = (e) => new G(e.readString()), Al = [
6081
+ sl,
6082
+ il,
6085
6083
  hl,
6086
- fl,
6087
- gl
6088
- ], Al = 0, Tl = 1, xl = 2, Il = 3, Ll = 4, Ol = 5, Nl = 6;
6089
- class tt {
6084
+ dl,
6085
+ ul,
6086
+ gl,
6087
+ pl
6088
+ ], Tl = 0, xl = 1, Il = 2, Ll = 3, Ol = 4, Nl = 5, Ml = 6;
6089
+ class et {
6090
6090
  /**
6091
6091
  * @param {AbstractType<any>} type
6092
6092
  */
@@ -6115,7 +6115,7 @@ class tt {
6115
6115
  * @return {ContentType}
6116
6116
  */
6117
6117
  copy() {
6118
- return new tt(this.type._copy());
6118
+ return new et(this.type._copy());
6119
6119
  }
6120
6120
  /**
6121
6121
  * @param {number} offset
@@ -6178,7 +6178,7 @@ class tt {
6178
6178
  return 7;
6179
6179
  }
6180
6180
  }
6181
- const Ml = (e) => new tt(Dl[e.readTypeRef()](e)), vl = (e, t) => {
6181
+ const vl = (e) => new et(Al[e.readTypeRef()](e)), Ul = (e, t) => {
6182
6182
  let n = t, s = 0, r;
6183
6183
  do
6184
6184
  s > 0 && (n = y(n.client, n.clock + s)), r = he(e, n), s = n.clock - r.id.clock, n = r.redone;
@@ -6187,7 +6187,7 @@ const Ml = (e) => new tt(Dl[e.readTypeRef()](e)), vl = (e, t) => {
6187
6187
  item: r,
6188
6188
  diff: s
6189
6189
  };
6190
- }, zn = (e, t) => {
6190
+ }, Yn = (e, t) => {
6191
6191
  for (; e !== null && e.keep !== t; )
6192
6192
  e.keep = t, e = /** @type {AbstractType<any>} */
6193
6193
  e.parent._item;
@@ -6203,11 +6203,11 @@ const Ml = (e) => new tt(Dl[e.readTypeRef()](e)), vl = (e, t) => {
6203
6203
  t.content.splice(n)
6204
6204
  );
6205
6205
  return t.deleted && i.markDeleted(), t.keep && (i.keep = !0), t.redone !== null && (i.redone = y(t.redone.client, t.redone.clock + n)), t.right = i, i.right !== null && (i.right.left = i), e._mergeStructs.push(i), i.parentSub !== null && i.right === null && i.parent._map.set(i.parentSub, i), t.length = n, i;
6206
- }, Cs = (e, t) => wn(
6206
+ }, Es = (e, t) => yn(
6207
6207
  e,
6208
6208
  /** @param {StackItem} s */
6209
6209
  (n) => Zt(n.deletions, t)
6210
- ), zr = (e, t, n, s, r, i) => {
6210
+ ), Pr = (e, t, n, s, r, i) => {
6211
6211
  const o = e.doc, c = o.store, l = o.clientID, a = t.redone;
6212
6212
  if (a !== null)
6213
6213
  return U(e, a);
@@ -6216,7 +6216,7 @@ const Ml = (e) => new tt(Dl[e.readTypeRef()](e)), vl = (e, t) => {
6216
6216
  t.parent._item
6217
6217
  ), u = null, d;
6218
6218
  if (h !== null && h.deleted === !0) {
6219
- if (h.redone === null && (!n.has(h) || zr(e, h, n, s, r, i) === null))
6219
+ if (h.redone === null && (!n.has(h) || Pr(e, h, n, s, r, i) === null))
6220
6220
  return null;
6221
6221
  for (; h.redone !== null; )
6222
6222
  h = U(e, h.redone);
@@ -6255,7 +6255,7 @@ const Ml = (e) => new tt(Dl[e.readTypeRef()](e)), vl = (e, t) => {
6255
6255
  }
6256
6256
  } else {
6257
6257
  if (d = null, t.right && !r) {
6258
- for (u = t; u !== null && u.right !== null && (u.right.redone || Zt(s, u.right.id) || Cs(i.undoStack, u.right.id) || Cs(i.redoStack, u.right.id)); )
6258
+ for (u = t; u !== null && u.right !== null && (u.right.redone || Zt(s, u.right.id) || Es(i.undoStack, u.right.id) || Es(i.redoStack, u.right.id)); )
6259
6259
  for (u = u.right; u.redone; ) u = U(e, u.redone);
6260
6260
  if (u && u.right !== null)
6261
6261
  return null;
@@ -6274,9 +6274,9 @@ const Ml = (e) => new tt(Dl[e.readTypeRef()](e)), vl = (e, t) => {
6274
6274
  t.parentSub,
6275
6275
  t.content.copy()
6276
6276
  );
6277
- return t.redone = p, zn(b, !0), b.integrate(e, 0), b;
6277
+ return t.redone = p, Yn(b, !0), b.integrate(e, 0), b;
6278
6278
  };
6279
- class S extends Hn {
6279
+ class S extends Pn {
6280
6280
  /**
6281
6281
  * @param {ID} id
6282
6282
  * @param {Item | null} left
@@ -6288,7 +6288,7 @@ class S extends Hn {
6288
6288
  * @param {AbstractContent} content
6289
6289
  */
6290
6290
  constructor(t, n, s, r, i, o, c, l) {
6291
- super(t, l.getLength()), this.origin = s, this.left = n, this.right = r, this.rightOrigin = i, this.parent = o, this.parentSub = c, this.redone = null, this.content = l, this.info = this.content.isCountable() ? Qn : 0;
6291
+ super(t, l.getLength()), this.origin = s, this.left = n, this.right = r, this.rightOrigin = i, this.parent = o, this.parentSub = c, this.redone = null, this.content = l, this.info = this.content.isCountable() ? Zn : 0;
6292
6292
  }
6293
6293
  /**
6294
6294
  * This is used to mark the item as an indexed fast-search marker
@@ -6296,35 +6296,35 @@ class S extends Hn {
6296
6296
  * @type {boolean}
6297
6297
  */
6298
6298
  set marker(t) {
6299
- (this.info & Pe) > 0 !== t && (this.info ^= Pe);
6299
+ (this.info & Ye) > 0 !== t && (this.info ^= Ye);
6300
6300
  }
6301
6301
  get marker() {
6302
- return (this.info & Pe) > 0;
6302
+ return (this.info & Ye) > 0;
6303
6303
  }
6304
6304
  /**
6305
6305
  * If true, do not garbage collect this Item.
6306
6306
  */
6307
6307
  get keep() {
6308
- return (this.info & qn) > 0;
6308
+ return (this.info & Qn) > 0;
6309
6309
  }
6310
6310
  set keep(t) {
6311
- this.keep !== t && (this.info ^= qn);
6311
+ this.keep !== t && (this.info ^= Qn);
6312
6312
  }
6313
6313
  get countable() {
6314
- return (this.info & Qn) > 0;
6314
+ return (this.info & Zn) > 0;
6315
6315
  }
6316
6316
  /**
6317
6317
  * Whether this item was deleted or not.
6318
6318
  * @type {Boolean}
6319
6319
  */
6320
6320
  get deleted() {
6321
- return (this.info & ze) > 0;
6321
+ return (this.info & Pe) > 0;
6322
6322
  }
6323
6323
  set deleted(t) {
6324
- this.deleted !== t && (this.info ^= ze);
6324
+ this.deleted !== t && (this.info ^= Pe);
6325
6325
  }
6326
6326
  markDeleted() {
6327
- this.info |= ze;
6327
+ this.info |= Pe;
6328
6328
  }
6329
6329
  /**
6330
6330
  * Return the creator clientID of the missing op or define missing items and return null.
@@ -6340,7 +6340,7 @@ class S extends Hn {
6340
6340
  return this.rightOrigin.client;
6341
6341
  if (this.parent && this.parent.constructor === Dt && this.id.client !== this.parent.client && this.parent.clock >= A(n, this.parent.client))
6342
6342
  return this.parent.client;
6343
- if (this.origin && (this.left = gs(t, n, this.origin), this.origin = this.left.lastId), this.rightOrigin && (this.right = U(t, this.rightOrigin), this.rightOrigin = this.right.id), this.left && this.left.constructor === B || this.right && this.right.constructor === B)
6343
+ if (this.origin && (this.left = ps(t, n, this.origin), this.origin = this.left.lastId), this.rightOrigin && (this.right = U(t, this.rightOrigin), this.rightOrigin = this.right.id), this.left && this.left.constructor === B || this.right && this.right.constructor === B)
6344
6344
  this.parent = null;
6345
6345
  else if (!this.parent)
6346
6346
  this.left && this.left.constructor === S ? (this.parent = this.left.parent, this.parentSub = this.left.parentSub) : this.right && this.right.constructor === S && (this.parent = this.right.parent, this.parentSub = this.right.parentSub);
@@ -6356,7 +6356,7 @@ class S extends Hn {
6356
6356
  * @param {number} offset
6357
6357
  */
6358
6358
  integrate(t, n) {
6359
- if (n > 0 && (this.id.clock += n, this.left = gs(t, t.doc.store, y(this.id.client, this.id.clock - 1)), this.origin = this.left.lastId, this.content = this.content.splice(n), this.length -= n), this.parent) {
6359
+ if (n > 0 && (this.id.clock += n, this.left = ps(t, t.doc.store, y(this.id.client, this.id.clock - 1)), this.origin = this.left.lastId, this.content = this.content.splice(n), this.length -= n), this.parent) {
6360
6360
  if (!this.left && (!this.right || this.right.left !== null) || this.left && this.left.right !== this.right) {
6361
6361
  let s = this.left, r;
6362
6362
  if (s !== null)
@@ -6397,7 +6397,7 @@ class S extends Hn {
6397
6397
  this.parent._start, this.parent._start = this;
6398
6398
  this.right = s;
6399
6399
  }
6400
- 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), Cr(t.doc.store, this), this.content.integrate(t, this), ws(
6400
+ 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), Er(t.doc.store, this), this.content.integrate(t, this), ms(
6401
6401
  t,
6402
6402
  /** @type {AbstractType<any>} */
6403
6403
  this.parent,
@@ -6461,7 +6461,7 @@ class S extends Hn {
6461
6461
  /** @type {AbstractType<any>} */
6462
6462
  this.parent
6463
6463
  );
6464
- this.countable && this.parentSub === null && (n._length -= this.length), this.markDeleted(), Jt(t.deleteSet, this.id.client, this.id.clock, this.length), ws(t, n, this.parentSub), this.content.delete(t);
6464
+ this.countable && this.parentSub === null && (n._length -= this.length), this.markDeleted(), Jt(t.deleteSet, this.id.client, this.id.clock, this.length), ms(t, n, this.parentSub), this.content.delete(t);
6465
6465
  }
6466
6466
  }
6467
6467
  /**
@@ -6471,7 +6471,7 @@ class S extends Hn {
6471
6471
  gc(t, n) {
6472
6472
  if (!this.deleted)
6473
6473
  throw V();
6474
- this.content.gc(t), n ? Rc(t, this, new B(this.id, this.length)) : this.content = new Xt(this.length);
6474
+ this.content.gc(t), n ? $c(t, this, new B(this.id, this.length)) : this.content = new Xt(this.length);
6475
6475
  }
6476
6476
  /**
6477
6477
  * Transform the properties of this type to binary and write it to an
@@ -6494,7 +6494,7 @@ class S extends Hn {
6494
6494
  if (c._item !== void 0) {
6495
6495
  const l = c._item;
6496
6496
  if (l === null) {
6497
- const a = vc(c);
6497
+ const a = Uc(c);
6498
6498
  t.writeParentInfo(!0), t.writeString(a);
6499
6499
  } else
6500
6500
  t.writeParentInfo(!1), t.writeLeftID(l.id);
@@ -6504,35 +6504,35 @@ class S extends Hn {
6504
6504
  this.content.write(t, n);
6505
6505
  }
6506
6506
  }
6507
- const Pr = (e, t) => Ul[t & Te](e), Ul = [
6507
+ const Yr = (e, t) => Rl[t & Te](e), Rl = [
6508
6508
  () => {
6509
6509
  V();
6510
6510
  },
6511
6511
  // GC is not ItemContent
6512
- ml,
6512
+ yl,
6513
6513
  // 1
6514
- _l,
6514
+ Sl,
6515
6515
  // 2
6516
- wl,
6516
+ ml,
6517
6517
  // 3
6518
- El,
6518
+ Dl,
6519
6519
  // 4
6520
- bl,
6521
- // 5
6522
6520
  kl,
6521
+ // 5
6522
+ _l,
6523
6523
  // 6
6524
- Ml,
6524
+ vl,
6525
6525
  // 7
6526
- Cl,
6526
+ El,
6527
6527
  // 8
6528
- yl,
6528
+ bl,
6529
6529
  // 9
6530
6530
  () => {
6531
6531
  V();
6532
6532
  }
6533
6533
  // 10 - Skip is not ItemContent
6534
- ], Rl = 10;
6535
- class F extends Hn {
6534
+ ], $l = 10;
6535
+ class F extends Pn {
6536
6536
  get deleted() {
6537
6537
  return !0;
6538
6538
  }
@@ -6557,7 +6557,7 @@ class F extends Hn {
6557
6557
  * @param {number} offset
6558
6558
  */
6559
6559
  write(t, n) {
6560
- t.writeInfo(Rl), w(t.restEncoder, this.length - n);
6560
+ t.writeInfo($l), w(t.restEncoder, this.length - n);
6561
6561
  }
6562
6562
  /**
6563
6563
  * @param {Transaction} transaction
@@ -6568,93 +6568,93 @@ class F extends Hn {
6568
6568
  return null;
6569
6569
  }
6570
6570
  }
6571
- const Yr = (
6571
+ const Gr = (
6572
6572
  /** @type {any} */
6573
6573
  typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : {}
6574
- ), Gr = "__ $YJS$ __";
6575
- Yr[Gr] === !0 && console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");
6576
- Yr[Gr] = !0;
6577
- const Jr = /* @__PURE__ */ new Map();
6578
- class $l {
6574
+ ), Jr = "__ $YJS$ __";
6575
+ Gr[Jr] === !0 && console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");
6576
+ Gr[Jr] = !0;
6577
+ const Kr = /* @__PURE__ */ new Map();
6578
+ class Bl {
6579
6579
  /**
6580
6580
  * @param {string} room
6581
6581
  */
6582
6582
  constructor(t) {
6583
- this.room = t, this.onmessage = null, this._onChange = (n) => n.key === t && this.onmessage !== null && this.onmessage({ data: Co(n.newValue || "") }), to(this._onChange);
6583
+ this.room = t, this.onmessage = null, this._onChange = (n) => n.key === t && this.onmessage !== null && this.onmessage({ data: Eo(n.newValue || "") }), eo(this._onChange);
6584
6584
  }
6585
6585
  /**
6586
6586
  * @param {ArrayBuffer} buf
6587
6587
  */
6588
6588
  postMessage(t) {
6589
- Bs.setItem(this.room, So(mo(t)));
6589
+ Fs.setItem(this.room, Co(yo(t)));
6590
6590
  }
6591
6591
  close() {
6592
- eo(this._onChange);
6592
+ no(this._onChange);
6593
6593
  }
6594
6594
  }
6595
- const Bl = typeof BroadcastChannel > "u" ? $l : BroadcastChannel, Pn = (e) => J(Jr, e, () => {
6596
- const t = rt(), n = new Bl(e);
6595
+ const Fl = typeof BroadcastChannel > "u" ? Bl : BroadcastChannel, Gn = (e) => J(Kr, e, () => {
6596
+ const t = it(), n = new Fl(e);
6597
6597
  return n.onmessage = (s) => t.forEach((r) => r(s.data, "broadcastchannel")), {
6598
6598
  bc: n,
6599
6599
  subs: t
6600
6600
  };
6601
- }), Fl = (e, t) => (Pn(e).subs.add(t), t), Vl = (e, t) => {
6602
- const n = Pn(e), s = n.subs.delete(t);
6603
- return s && n.subs.size === 0 && (n.bc.close(), Jr.delete(e)), s;
6601
+ }), Vl = (e, t) => (Gn(e).subs.add(t), t), jl = (e, t) => {
6602
+ const n = Gn(e), s = n.subs.delete(t);
6603
+ return s && n.subs.size === 0 && (n.bc.close(), Kr.delete(e)), s;
6604
6604
  }, _t = (e, t, n = null) => {
6605
- const s = Pn(e);
6605
+ const s = Gn(e);
6606
6606
  s.bc.postMessage(t), s.subs.forEach((r) => r(t, n));
6607
- }, Kr = 0, Yn = 1, Wr = 2, dn = (e, t) => {
6608
- w(e, Kr);
6609
- const n = Nc(t);
6607
+ }, Wr = 0, Jn = 1, Xr = 2, fn = (e, t) => {
6608
+ w(e, Wr);
6609
+ const n = Mc(t);
6610
6610
  E(e, n);
6611
- }, Xr = (e, t, n) => {
6612
- w(e, Yn), E(e, xc(t, n));
6613
- }, jl = (e, t, n) => Xr(t, n, O(e)), qr = (e, t, n, s) => {
6611
+ }, qr = (e, t, n) => {
6612
+ w(e, Jn), E(e, Ic(t, n));
6613
+ }, Hl = (e, t, n) => qr(t, n, O(e)), Qr = (e, t, n, s) => {
6614
6614
  try {
6615
- Dc(t, O(e), n);
6615
+ Ac(t, O(e), n);
6616
6616
  } catch (r) {
6617
6617
  s?.(
6618
6618
  /** @type {Error} */
6619
6619
  r
6620
6620
  ), console.error("Caught error while handling a Yjs update", r);
6621
6621
  }
6622
- }, Hl = (e, t) => {
6623
- w(e, Wr), E(e, t);
6624
- }, zl = qr, Pl = (e, t, n, s, r) => {
6622
+ }, zl = (e, t) => {
6623
+ w(e, Xr), E(e, t);
6624
+ }, Pl = Qr, Yl = (e, t, n, s, r) => {
6625
6625
  const i = m(e);
6626
6626
  switch (i) {
6627
- case Kr:
6628
- jl(e, t, n);
6627
+ case Wr:
6628
+ Hl(e, t, n);
6629
6629
  break;
6630
- case Yn:
6631
- qr(e, n, s, r);
6630
+ case Jn:
6631
+ Qr(e, n, s, r);
6632
6632
  break;
6633
- case Wr:
6634
- zl(e, n, s, r);
6633
+ case Xr:
6634
+ Pl(e, n, s, r);
6635
6635
  break;
6636
6636
  default:
6637
6637
  throw new Error("Unknown message type");
6638
6638
  }
6639
6639
  return i;
6640
- }, Yl = 0, Gl = (e, t, n) => {
6641
- m(e) === Yl && n(t, st(e));
6642
- }, Qe = 3e4;
6643
- class Jl extends yi {
6640
+ }, Gl = 0, Jl = (e, t, n) => {
6641
+ m(e) === Gl && n(t, rt(e));
6642
+ }, Ze = 3e4;
6643
+ class Kl extends bi {
6644
6644
  /**
6645
6645
  * @param {Y.Doc} doc
6646
6646
  */
6647
6647
  constructor(t) {
6648
6648
  super(), this.doc = t, this.clientID = t.clientID, this.states = /* @__PURE__ */ new Map(), this.meta = /* @__PURE__ */ new Map(), this._checkInterval = /** @type {any} */
6649
6649
  setInterval(() => {
6650
- const n = it();
6651
- this.getLocalState() !== null && Qe / 2 <= n - /** @type {{lastUpdated:number}} */
6650
+ const n = ot();
6651
+ this.getLocalState() !== null && Ze / 2 <= n - /** @type {{lastUpdated:number}} */
6652
6652
  this.meta.get(this.clientID).lastUpdated && this.setLocalState(this.getLocalState());
6653
6653
  const s = [];
6654
6654
  this.meta.forEach((r, i) => {
6655
- i !== this.clientID && Qe <= n - r.lastUpdated && this.states.has(i) && s.push(i);
6656
- }), s.length > 0 && Gn(this, s, "timeout");
6657
- }, H(Qe / 10)), t.on("destroy", () => {
6655
+ i !== this.clientID && Ze <= n - r.lastUpdated && this.states.has(i) && s.push(i);
6656
+ }), s.length > 0 && Kn(this, s, "timeout");
6657
+ }, H(Ze / 10)), t.on("destroy", () => {
6658
6658
  this.destroy();
6659
6659
  }), this.setLocalState({});
6660
6660
  }
@@ -6674,7 +6674,7 @@ class Jl extends yi {
6674
6674
  const n = this.clientID, s = this.meta.get(n), r = s === void 0 ? 0 : s.clock + 1, i = this.states.get(n);
6675
6675
  t === null ? this.states.delete(n) : this.states.set(n, t), this.meta.set(n, {
6676
6676
  clock: r,
6677
- lastUpdated: it()
6677
+ lastUpdated: ot()
6678
6678
  });
6679
6679
  const o = [], c = [], l = [], a = [];
6680
6680
  t === null ? a.push(n) : i == null ? t != null && o.push(n) : (c.push(n), Ct(i, t) || l.push(n)), (o.length > 0 || l.length > 0 || a.length > 0) && this.emit("change", [{ added: o, updated: l, removed: a }, "local"]), this.emit("update", [{ added: o, updated: c, removed: a }, "local"]);
@@ -6697,7 +6697,7 @@ class Jl extends yi {
6697
6697
  return this.states;
6698
6698
  }
6699
6699
  }
6700
- const Gn = (e, t, n) => {
6700
+ const Kn = (e, t, n) => {
6701
6701
  const s = [];
6702
6702
  for (let r = 0; r < t.length; r++) {
6703
6703
  const i = t[r];
@@ -6709,7 +6709,7 @@ const Gn = (e, t, n) => {
6709
6709
  );
6710
6710
  e.meta.set(i, {
6711
6711
  clock: o.clock + 1,
6712
- lastUpdated: it()
6712
+ lastUpdated: ot()
6713
6713
  });
6714
6714
  }
6715
6715
  s.push(i);
@@ -6724,15 +6724,15 @@ const Gn = (e, t, n) => {
6724
6724
  /** @type {MetaClientState} */
6725
6725
  e.meta.get(o).clock
6726
6726
  );
6727
- w(r, o), w(r, l), ht(r, JSON.stringify(c));
6727
+ w(r, o), w(r, l), dt(r, JSON.stringify(c));
6728
6728
  }
6729
6729
  return C(r);
6730
- }, Kl = (e, t, n) => {
6731
- const s = ct(t), r = it(), i = [], o = [], c = [], l = [], a = m(s);
6730
+ }, Wl = (e, t, n) => {
6731
+ const s = at(t), r = ot(), i = [], o = [], c = [], l = [], a = m(s);
6732
6732
  for (let h = 0; h < a; h++) {
6733
6733
  const u = m(s);
6734
6734
  let d = m(s);
6735
- const f = JSON.parse(st(s)), g = e.meta.get(u), p = e.states.get(u), b = g === void 0 ? 0 : g.clock;
6735
+ const f = JSON.parse(rt(s)), g = e.meta.get(u), p = e.states.get(u), b = g === void 0 ? 0 : g.clock;
6736
6736
  (b < d || b === d && f === null && e.states.has(u)) && (f === null ? u === e.clientID && e.getLocalState() != null ? d++ : e.states.delete(u) : e.states.set(u, f), e.meta.set(u, {
6737
6737
  clock: d,
6738
6738
  lastUpdated: r
@@ -6747,18 +6747,18 @@ const Gn = (e, t, n) => {
6747
6747
  updated: o,
6748
6748
  removed: l
6749
6749
  }, n]);
6750
- }, Wl = (e) => oo(e, (t, n) => `${encodeURIComponent(n)}=${encodeURIComponent(t)}`).join("&"), lt = 0, Qr = 3, Tt = 1, Xl = 2, se = [];
6751
- se[lt] = (e, t, n, s, r) => {
6752
- w(e, lt);
6753
- const i = Pl(
6750
+ }, Xl = (e) => co(e, (t, n) => `${encodeURIComponent(n)}=${encodeURIComponent(t)}`).join("&"), ht = 0, Zr = 3, Tt = 1, ql = 2, se = [];
6751
+ se[ht] = (e, t, n, s, r) => {
6752
+ w(e, ht);
6753
+ const i = Yl(
6754
6754
  t,
6755
6755
  e,
6756
6756
  n.doc,
6757
6757
  n
6758
6758
  );
6759
- s && i === Yn && !n.synced && (n.synced = !0);
6759
+ s && i === Jn && !n.synced && (n.synced = !0);
6760
6760
  };
6761
- se[Qr] = (e, t, n, s, r) => {
6761
+ se[Zr] = (e, t, n, s, r) => {
6762
6762
  w(e, Tt), E(
6763
6763
  e,
6764
6764
  Vt(
@@ -6768,25 +6768,25 @@ se[Qr] = (e, t, n, s, r) => {
6768
6768
  );
6769
6769
  };
6770
6770
  se[Tt] = (e, t, n, s, r) => {
6771
- Kl(
6771
+ Wl(
6772
6772
  n.awareness,
6773
6773
  O(t),
6774
6774
  n
6775
6775
  );
6776
6776
  };
6777
- se[Xl] = (e, t, n, s, r) => {
6778
- Gl(
6777
+ se[ql] = (e, t, n, s, r) => {
6778
+ Jl(
6779
6779
  t,
6780
6780
  n.doc,
6781
- (i, o) => ql(n, o)
6781
+ (i, o) => Ql(n, o)
6782
6782
  );
6783
6783
  };
6784
- const Es = 3e4, ql = (e, t) => console.warn(`Permission denied to access ${e.url}.
6785
- ${t}`), Zr = (e, t, n) => {
6786
- const s = ct(t), r = N(), i = m(s), o = e.messageHandlers[i];
6784
+ const Ds = 3e4, Ql = (e, t) => console.warn(`Permission denied to access ${e.url}.
6785
+ ${t}`), ti = (e, t, n) => {
6786
+ const s = at(t), r = N(), i = m(s), o = e.messageHandlers[i];
6787
6787
  return /** @type {any} */ o ? o(r, s, e, n, i) : console.error("Unable to compute message"), r;
6788
- }, fn = (e, t, n) => {
6789
- t === e.ws && (e.emit("connection-close", [n, e]), e.ws = null, t.close(), e.wsconnecting = !1, e.wsconnected ? (e.wsconnected = !1, e.synced = !1, Gn(
6788
+ }, gn = (e, t, n) => {
6789
+ t === e.ws && (e.emit("connection-close", [n, e]), e.ws = null, t.close(), e.wsconnecting = !1, e.wsconnected ? (e.wsconnected = !1, e.synced = !1, Kn(
6790
6790
  e.awareness,
6791
6791
  Array.from(e.awareness.getStates().keys()).filter(
6792
6792
  (s) => s !== e.doc.clientID
@@ -6795,30 +6795,30 @@ ${t}`), Zr = (e, t, n) => {
6795
6795
  ), e.emit("status", [{
6796
6796
  status: "disconnected"
6797
6797
  }])) : e.wsUnsuccessfulReconnects++, setTimeout(
6798
- ti,
6799
- yn(
6800
- bi(2, e.wsUnsuccessfulReconnects) * 100,
6798
+ ei,
6799
+ kn(
6800
+ ki(2, e.wsUnsuccessfulReconnects) * 100,
6801
6801
  e.maxBackoffTime
6802
6802
  ),
6803
6803
  e
6804
6804
  ));
6805
- }, ti = (e) => {
6805
+ }, ei = (e) => {
6806
6806
  if (e.shouldConnect && e.ws === null) {
6807
6807
  const t = new e._WS(e.url, e.protocols);
6808
6808
  t.binaryType = "arraybuffer", e.ws = t, e.wsconnecting = !0, e.wsconnected = !1, e.synced = !1, t.onmessage = (n) => {
6809
- e.wsLastMessageReceived = it();
6810
- const s = Zr(e, new Uint8Array(n.data), !0);
6811
- bn(s) > 1 && t.send(C(s));
6809
+ e.wsLastMessageReceived = ot();
6810
+ const s = ti(e, new Uint8Array(n.data), !0);
6811
+ _n(s) > 1 && t.send(C(s));
6812
6812
  }, t.onerror = (n) => {
6813
6813
  e.emit("connection-error", [n, e]);
6814
6814
  }, t.onclose = (n) => {
6815
- fn(e, t, n);
6815
+ gn(e, t, n);
6816
6816
  }, t.onopen = () => {
6817
- e.wsLastMessageReceived = it(), e.wsconnecting = !1, e.wsconnected = !0, e.wsUnsuccessfulReconnects = 0, e.emit("status", [{
6817
+ e.wsLastMessageReceived = ot(), e.wsconnecting = !1, e.wsconnected = !0, e.wsUnsuccessfulReconnects = 0, e.emit("status", [{
6818
6818
  status: "connected"
6819
6819
  }]);
6820
6820
  const n = N();
6821
- if (w(n, lt), dn(n, e.doc), t.send(C(n)), e.awareness.getLocalState() !== null) {
6821
+ if (w(n, ht), fn(n, e.doc), t.send(C(n)), e.awareness.getLocalState() !== null) {
6822
6822
  const s = N();
6823
6823
  w(s, Tt), E(
6824
6824
  s,
@@ -6831,11 +6831,11 @@ ${t}`), Zr = (e, t, n) => {
6831
6831
  status: "connecting"
6832
6832
  }]);
6833
6833
  }
6834
- }, Ze = (e, t) => {
6834
+ }, tn = (e, t) => {
6835
6835
  const n = e.ws;
6836
6836
  e.wsconnected && n && n.readyState === n.OPEN && n.send(t), e.bcconnected && _t(e.bcChannel, t, e);
6837
6837
  };
6838
- class Ql extends mn {
6838
+ class Zl extends bn {
6839
6839
  /**
6840
6840
  * @param {string} serverUrl
6841
6841
  * @param {string} roomname
@@ -6852,7 +6852,7 @@ class Ql extends mn {
6852
6852
  */
6853
6853
  constructor(t, n, s, {
6854
6854
  connect: r = !0,
6855
- awareness: i = new Jl(s),
6855
+ awareness: i = new Kl(s),
6856
6856
  params: o = {},
6857
6857
  protocols: c = [],
6858
6858
  WebSocketPolyfill: l = WebSocket,
@@ -6866,42 +6866,42 @@ class Ql extends mn {
6866
6866
  setInterval(() => {
6867
6867
  if (this.ws && this.ws.readyState === WebSocket.OPEN) {
6868
6868
  const d = N();
6869
- w(d, lt), dn(d, s), this.ws.send(C(d));
6869
+ w(d, ht), fn(d, s), this.ws.send(C(d));
6870
6870
  }
6871
6871
  }, a)), this._bcSubscriber = (d, f) => {
6872
6872
  if (f !== this) {
6873
- const g = Zr(this, new Uint8Array(d), !1);
6874
- bn(g) > 1 && _t(this.bcChannel, C(g), this);
6873
+ const g = ti(this, new Uint8Array(d), !1);
6874
+ _n(g) > 1 && _t(this.bcChannel, C(g), this);
6875
6875
  }
6876
6876
  }, this._updateHandler = (d, f) => {
6877
6877
  if (f !== this) {
6878
6878
  const g = N();
6879
- w(g, lt), Hl(g, d), Ze(this, C(g));
6879
+ w(g, ht), zl(g, d), tn(this, C(g));
6880
6880
  }
6881
6881
  }, this.doc.on("update", this._updateHandler), this._awarenessUpdateHandler = ({ added: d, updated: f, removed: g }, p) => {
6882
6882
  const b = d.concat(f).concat(g), k = N();
6883
6883
  w(k, Tt), E(
6884
6884
  k,
6885
6885
  Vt(i, b)
6886
- ), Ze(this, C(k));
6886
+ ), tn(this, C(k));
6887
6887
  }, this._exitHandler = () => {
6888
- Gn(
6888
+ Kn(
6889
6889
  this.awareness,
6890
6890
  [s.clientID],
6891
6891
  "app closed"
6892
6892
  );
6893
- }, ot && typeof process < "u" && process.on("exit", this._exitHandler), i.on("update", this._awarenessUpdateHandler), this._checkInterval = /** @type {any} */
6893
+ }, ct && typeof process < "u" && process.on("exit", this._exitHandler), i.on("update", this._awarenessUpdateHandler), this._checkInterval = /** @type {any} */
6894
6894
  setInterval(() => {
6895
- this.wsconnected && Es < it() - this.wsLastMessageReceived && fn(
6895
+ this.wsconnected && Ds < ot() - this.wsLastMessageReceived && gn(
6896
6896
  this,
6897
6897
  /** @type {WebSocket} */
6898
6898
  this.ws,
6899
6899
  null
6900
6900
  );
6901
- }, Es / 10), r && this.connect();
6901
+ }, Ds / 10), r && this.connect();
6902
6902
  }
6903
6903
  get url() {
6904
- const t = Wl(this.params);
6904
+ const t = Xl(this.params);
6905
6905
  return this.serverUrl + "/" + this.roomname + (t.length === 0 ? "" : "?" + t);
6906
6906
  }
6907
6907
  /**
@@ -6914,18 +6914,18 @@ class Ql extends mn {
6914
6914
  this._synced !== t && (this._synced = t, this.emit("synced", [t]), this.emit("sync", [t]));
6915
6915
  }
6916
6916
  destroy() {
6917
- this._resyncInterval !== 0 && clearInterval(this._resyncInterval), clearInterval(this._checkInterval), this.disconnect(), ot && typeof process < "u" && process.off("exit", this._exitHandler), this.awareness.off("update", this._awarenessUpdateHandler), this.doc.off("update", this._updateHandler), super.destroy();
6917
+ this._resyncInterval !== 0 && clearInterval(this._resyncInterval), clearInterval(this._checkInterval), this.disconnect(), ct && typeof process < "u" && process.off("exit", this._exitHandler), this.awareness.off("update", this._awarenessUpdateHandler), this.doc.off("update", this._updateHandler), super.destroy();
6918
6918
  }
6919
6919
  connectBc() {
6920
6920
  if (this.disableBc)
6921
6921
  return;
6922
- this.bcconnected || (Fl(this.bcChannel, this._bcSubscriber), this.bcconnected = !0);
6922
+ this.bcconnected || (Vl(this.bcChannel, this._bcSubscriber), this.bcconnected = !0);
6923
6923
  const t = N();
6924
- w(t, lt), dn(t, this.doc), _t(this.bcChannel, C(t), this);
6924
+ w(t, ht), fn(t, this.doc), _t(this.bcChannel, C(t), this);
6925
6925
  const n = N();
6926
- w(n, lt), Xr(n, this.doc), _t(this.bcChannel, C(n), this);
6926
+ w(n, ht), qr(n, this.doc), _t(this.bcChannel, C(n), this);
6927
6927
  const s = N();
6928
- w(s, Qr), _t(
6928
+ w(s, Zr), _t(
6929
6929
  this.bcChannel,
6930
6930
  C(s),
6931
6931
  this
@@ -6949,16 +6949,16 @@ class Ql extends mn {
6949
6949
  Vt(this.awareness, [
6950
6950
  this.doc.clientID
6951
6951
  ], /* @__PURE__ */ new Map())
6952
- ), Ze(this, C(t)), this.bcconnected && (Vl(this.bcChannel, this._bcSubscriber), this.bcconnected = !1);
6952
+ ), tn(this, C(t)), this.bcconnected && (jl(this.bcChannel, this._bcSubscriber), this.bcconnected = !1);
6953
6953
  }
6954
6954
  disconnect() {
6955
- this.shouldConnect = !1, this.disconnectBc(), this.ws !== null && fn(this, this.ws, null);
6955
+ this.shouldConnect = !1, this.disconnectBc(), this.ws !== null && gn(this, this.ws, null);
6956
6956
  }
6957
6957
  connect() {
6958
- this.shouldConnect = !0, !this.wsconnected && this.ws === null && (ti(this), this.connectBc());
6958
+ this.shouldConnect = !0, !this.wsconnected && this.ws === null && (ei(this), this.connectBc());
6959
6959
  }
6960
6960
  }
6961
- const ei = "data-collab-blocked", ni = /^[a-z][a-z0-9-]*$/, Zl = /^[a-z_:][-a-z0-9_:.]*$/i, ta = /* @__PURE__ */ new Set([
6961
+ const ni = "data-collab-blocked", si = /^[a-z][a-z0-9-]*$/, ta = /^[a-z_:][-a-z0-9_:.]*$/i, ea = /* @__PURE__ */ new Set([
6962
6962
  "script",
6963
6963
  "style",
6964
6964
  "iframe",
@@ -6973,7 +6973,7 @@ const ei = "data-collab-blocked", ni = /^[a-z][a-z0-9-]*$/, Zl = /^[a-z_:][-a-z0
6973
6973
  "noscript",
6974
6974
  "template",
6975
6975
  "portal"
6976
- ]), ea = /* @__PURE__ */ new Set([
6976
+ ]), na = /* @__PURE__ */ new Set([
6977
6977
  "href",
6978
6978
  "src",
6979
6979
  "xlink:href",
@@ -6990,12 +6990,12 @@ const ei = "data-collab-blocked", ni = /^[a-z][a-z0-9-]*$/, Zl = /^[a-z_:][-a-z0
6990
6990
  "usemap",
6991
6991
  "lowsrc",
6992
6992
  "dynsrc"
6993
- ]), na = /^data:image\/(?:png|gif|jpe?g|webp|avif|bmp|x-icon);/, sa = new RegExp("[\\u0000-\\u0020\\u007f-\\u009f\\u00ad\\u200b-\\u200f\\u2028\\u2029\\ufeff]", "g");
6994
- function ra(e) {
6995
- const t = e.replace(sa, "").toLowerCase();
6996
- return /^(?:javascript|vbscript|livescript|mocha):/.test(t) ? !1 : t.startsWith("data:") ? na.test(t) : !0;
6997
- }
6993
+ ]), sa = /^data:image\/(?:png|gif|jpe?g|webp|avif|bmp|x-icon);/, ra = new RegExp("[\\u0000-\\u0020\\u007f-\\u009f\\u00ad\\u200b-\\u200f\\u2028\\u2029\\ufeff]", "g");
6998
6994
  function ia(e) {
6995
+ const t = e.replace(ra, "").toLowerCase();
6996
+ return /^(?:javascript|vbscript|livescript|mocha):/.test(t) ? !1 : t.startsWith("data:") ? sa.test(t) : !0;
6997
+ }
6998
+ function oa(e) {
6999
6999
  if (!("data-editora-embed" in e)) return !1;
7000
7000
  const t = e.src?.trim();
7001
7001
  if (!t || /\s/.test(t)) return !1;
@@ -7006,29 +7006,29 @@ function ia(e) {
7006
7006
  return !1;
7007
7007
  }
7008
7008
  }
7009
- function oa(e, t) {
7009
+ function ca(e, t) {
7010
7010
  const n = e.toLowerCase();
7011
- return ni.test(n) ? n === "iframe" ? !ia(t) : ta.has(n) : !0;
7011
+ return si.test(n) ? n === "iframe" ? !oa(t) : ea.has(n) : !0;
7012
7012
  }
7013
- function si(e, t) {
7014
- if (!Zl.test(e)) return !1;
7013
+ function ri(e, t) {
7014
+ if (!ta.test(e)) return !1;
7015
7015
  const n = e.toLowerCase();
7016
- return n.startsWith("on") || n === "srcdoc" ? !1 : ea.has(n) ? ra(String(t)) : !0;
7016
+ return n.startsWith("on") || n === "srcdoc" ? !1 : na.has(n) ? ia(String(t)) : !0;
7017
7017
  }
7018
- function ca(e, t) {
7018
+ function la(e, t) {
7019
7019
  const n = e.createElement("span");
7020
- return n.setAttribute(ei, ni.test(t.toLowerCase()) ? t.toLowerCase().slice(0, 32) : "invalid"), n.hidden = !0, n;
7020
+ return n.setAttribute(ni, si.test(t.toLowerCase()) ? t.toLowerCase().slice(0, 32) : "invalid"), n.hidden = !0, n;
7021
7021
  }
7022
7022
  function De(e) {
7023
- return e.nodeType === Node.ELEMENT_NODE && e.hasAttribute(ei);
7023
+ return e.nodeType === Node.ELEMENT_NODE && e.hasAttribute(ni);
7024
7024
  }
7025
- function la(e) {
7025
+ function aa(e) {
7026
7026
  return e instanceof Q || e instanceof q;
7027
7027
  }
7028
- function Jn(e) {
7029
- return e.toArray().filter(la);
7028
+ function Wn(e) {
7029
+ return e.toArray().filter(aa);
7030
7030
  }
7031
- function aa(e, t) {
7031
+ function ha(e, t) {
7032
7032
  if (e === t) return null;
7033
7033
  let n = 0;
7034
7034
  const s = Math.min(e.length, t.length);
@@ -7042,73 +7042,73 @@ function aa(e, t) {
7042
7042
  insertText: t.slice(n, t.length - r)
7043
7043
  };
7044
7044
  }
7045
- function ha(e) {
7045
+ function ua(e) {
7046
7046
  const t = new q(e.tagName.toLowerCase());
7047
7047
  for (const s of Array.from(e.attributes))
7048
7048
  t.setAttribute(s.name, s.value);
7049
- const n = ri(e.childNodes);
7049
+ const n = ii(e.childNodes);
7050
7050
  return n.length && t.insert(0, n), t;
7051
7051
  }
7052
- function ri(e) {
7052
+ function ii(e) {
7053
7053
  const t = [];
7054
7054
  for (const n of Array.from(e))
7055
- n.nodeType === Node.TEXT_NODE ? t.push(new Q(n.textContent ?? "")) : n.nodeType === Node.ELEMENT_NODE && t.push(ha(n));
7055
+ n.nodeType === Node.TEXT_NODE ? t.push(new Q(n.textContent ?? "")) : n.nodeType === Node.ELEMENT_NODE && t.push(ua(n));
7056
7056
  return t;
7057
7057
  }
7058
- function ii(e) {
7059
- return oa(e.nodeName, e.getAttributes());
7058
+ function oi(e) {
7059
+ return ca(e.nodeName, e.getAttributes());
7060
7060
  }
7061
- function ua(e, t) {
7062
- if (ii(e)) return ca(t, e.nodeName);
7061
+ function da(e, t) {
7062
+ if (oi(e)) return la(t, e.nodeName);
7063
7063
  const n = t.createElement(e.nodeName);
7064
7064
  for (const [s, r] of Object.entries(e.getAttributes()))
7065
- si(s, r) && n.setAttribute(s, r);
7066
- for (const s of Jn(e))
7067
- n.appendChild(oi(s, t));
7065
+ ri(s, r) && n.setAttribute(s, r);
7066
+ for (const s of Wn(e))
7067
+ n.appendChild(ci(s, t));
7068
7068
  return n;
7069
7069
  }
7070
- function oi(e, t) {
7071
- return e instanceof Q ? t.createTextNode(e.toString()) : ua(e, t);
7072
- }
7073
7070
  function ci(e, t) {
7074
- return ii(t) ? De(e) : !De(e) && e.tagName.toLowerCase() === t.nodeName.toLowerCase();
7071
+ return e instanceof Q ? t.createTextNode(e.toString()) : da(e, t);
7072
+ }
7073
+ function li(e, t) {
7074
+ return oi(t) ? De(e) : !De(e) && e.tagName.toLowerCase() === t.nodeName.toLowerCase();
7075
7075
  }
7076
- function gn(e, t) {
7076
+ function pn(e, t) {
7077
7077
  const n = Array.from(t.childNodes).filter(
7078
7078
  (o) => o.nodeType === Node.TEXT_NODE || o.nodeType === Node.ELEMENT_NODE
7079
- ), s = Jn(e), r = Math.min(n.length, s.length);
7079
+ ), s = Wn(e), r = Math.min(n.length, s.length);
7080
7080
  let i = 0;
7081
7081
  for (; i < r; i++) {
7082
7082
  const o = n[i], c = s[i];
7083
7083
  if (o.nodeType === Node.TEXT_NODE) {
7084
7084
  if (c instanceof Q) {
7085
- const l = aa(c.toString(), o.textContent ?? "");
7085
+ const l = ha(c.toString(), o.textContent ?? "");
7086
7086
  l && (l.deleteCount > 0 && c.delete(l.start, l.deleteCount), l.insertText && c.insert(l.start, l.insertText));
7087
7087
  continue;
7088
7088
  }
7089
7089
  break;
7090
7090
  }
7091
- if (c instanceof q && ci(o, c)) {
7091
+ if (c instanceof q && li(o, c)) {
7092
7092
  if (De(o)) continue;
7093
- da(c, o), gn(c, o);
7093
+ fa(c, o), pn(c, o);
7094
7094
  continue;
7095
7095
  }
7096
7096
  break;
7097
7097
  }
7098
7098
  if (i < s.length && e.delete(i, s.length - i), i < n.length) {
7099
- const o = ri(n.slice(i));
7099
+ const o = ii(n.slice(i));
7100
7100
  o.length && e.insert(i, o);
7101
7101
  }
7102
7102
  }
7103
- function da(e, t) {
7103
+ function fa(e, t) {
7104
7104
  const n = e.getAttributes(), s = new Set(Array.from(t.attributes).map((r) => r.name));
7105
7105
  for (const r of Object.keys(n))
7106
7106
  s.has(r) || e.removeAttribute(r);
7107
7107
  for (const r of Array.from(t.attributes))
7108
7108
  n[r.name] !== r.value && e.setAttribute(r.name, r.value);
7109
7109
  }
7110
- function li(e, t, n) {
7111
- const s = Jn(t), r = Array.from(e.childNodes).filter(
7110
+ function ai(e, t, n) {
7111
+ const s = Wn(t), r = Array.from(e.childNodes).filter(
7112
7112
  (c) => c.nodeType === Node.TEXT_NODE || c.nodeType === Node.ELEMENT_NODE
7113
7113
  ), i = Math.min(s.length, r.length);
7114
7114
  let o = 0;
@@ -7122,9 +7122,9 @@ function li(e, t, n) {
7122
7122
  }
7123
7123
  break;
7124
7124
  }
7125
- if (l.nodeType === Node.ELEMENT_NODE && ci(l, c)) {
7125
+ if (l.nodeType === Node.ELEMENT_NODE && li(l, c)) {
7126
7126
  if (De(l)) continue;
7127
- fa(l, c), li(l, c, n);
7127
+ ga(l, c), ai(l, c, n);
7128
7128
  continue;
7129
7129
  }
7130
7130
  break;
@@ -7132,29 +7132,29 @@ function li(e, t, n) {
7132
7132
  for (let c = r.length - 1; c >= o; c--)
7133
7133
  e.removeChild(r[c]);
7134
7134
  for (let c = o; c < s.length; c++)
7135
- e.appendChild(oi(s[c], n));
7135
+ e.appendChild(ci(s[c], n));
7136
7136
  }
7137
- function fa(e, t) {
7137
+ function ga(e, t) {
7138
7138
  const n = t.getAttributes(), s = new Set(Array.from(e.attributes).map((r) => r.name));
7139
7139
  for (const r of s)
7140
7140
  r in n || e.removeAttribute(r);
7141
7141
  for (const [r, i] of Object.entries(n)) {
7142
- if (!si(r, i)) {
7142
+ if (!ri(r, i)) {
7143
7143
  e.removeAttribute(r);
7144
7144
  continue;
7145
7145
  }
7146
7146
  e.getAttribute(r) !== i && e.setAttribute(r, i);
7147
7147
  }
7148
7148
  }
7149
- class ga {
7149
+ class pa {
7150
7150
  constructor(t, n, s) {
7151
7151
  this.root = t, this.doc = n, this.fragment = s, this.pending = !1, this.destroyed = !1, this.onFragmentChange = (r, i) => {
7152
7152
  i.origin !== this && this.applyRemoteToDom();
7153
- }, this.observer = new MutationObserver(() => this.scheduleLocalSync()), this.fragment.length === 0 && this.root.childNodes.length > 0 ? this.doc.transact(() => gn(this.fragment, this.root), this) : this.applyRemoteToDom(), this.observer.observe(this.root, { childList: !0, characterData: !0, subtree: !0, attributes: !0 }), this.fragment.observeDeep(this.onFragmentChange);
7153
+ }, this.observer = new MutationObserver(() => this.scheduleLocalSync()), this.fragment.length === 0 && this.root.childNodes.length > 0 ? this.doc.transact(() => pn(this.fragment, this.root), this) : this.applyRemoteToDom(), this.observer.observe(this.root, { childList: !0, characterData: !0, subtree: !0, attributes: !0 }), this.fragment.observeDeep(this.onFragmentChange);
7154
7154
  }
7155
7155
  scheduleLocalSync() {
7156
7156
  this.pending || (this.pending = !0, queueMicrotask(() => {
7157
- this.pending = !1, !this.destroyed && this.doc.transact(() => gn(this.fragment, this.root), this);
7157
+ this.pending = !1, !this.destroyed && this.doc.transact(() => pn(this.fragment, this.root), this);
7158
7158
  }));
7159
7159
  }
7160
7160
  applyRemoteToDom() {
@@ -7162,7 +7162,7 @@ class ga {
7162
7162
  const t = this.captureSelection();
7163
7163
  this.observer.disconnect(), this.root.dispatchEvent(new CustomEvent("provenance:expect", { detail: { kind: "collaborator", timeoutMs: 1e3 }, bubbles: !0 }));
7164
7164
  try {
7165
- li(this.root, this.fragment, this.root.ownerDocument), this.root.dispatchEvent(new Event("input", { bubbles: !0, composed: !0 }));
7165
+ ai(this.root, this.fragment, this.root.ownerDocument), this.root.dispatchEvent(new Event("input", { bubbles: !0, composed: !0 }));
7166
7166
  } finally {
7167
7167
  this.observer.observe(this.root, { childList: !0, characterData: !0, subtree: !0, attributes: !0 });
7168
7168
  }
@@ -7210,11 +7210,11 @@ class ga {
7210
7210
  this.destroyed = !0, this.observer.disconnect(), this.fragment.unobserveDeep(this.onFragmentChange);
7211
7211
  }
7212
7212
  }
7213
- const Ds = "editora-collaboration-cursor-styles";
7214
- function pa() {
7215
- if (typeof document > "u" || document.getElementById(Ds)) return;
7213
+ const As = "editora-collaboration-cursor-styles";
7214
+ function wa() {
7215
+ if (typeof document > "u" || document.getElementById(As)) return;
7216
7216
  const e = document.createElement("style");
7217
- e.id = Ds, e.textContent = `
7217
+ e.id = As, e.textContent = `
7218
7218
  .editora-collab-caret {
7219
7219
  position: fixed;
7220
7220
  width: 2px;
@@ -7243,31 +7243,31 @@ function pa() {
7243
7243
  }
7244
7244
  `, document.head.appendChild(e);
7245
7245
  }
7246
- const wa = /^(?:#[0-9a-f]{3,8}|[a-z]{3,20}|(?:rgb|hsl)a?\([\d\s.,%/-]+\))$/i, ma = "#64748b";
7247
- function ai(e) {
7246
+ const ma = /^(?:#[0-9a-f]{3,8}|[a-z]{3,20}|(?:rgb|hsl)a?\([\d\s.,%/-]+\))$/i, ya = "#64748b";
7247
+ function hi(e) {
7248
7248
  if (!e || typeof e != "object") return null;
7249
7249
  const { name: t, color: n } = e;
7250
7250
  return typeof t != "string" || t.length === 0 ? null : {
7251
7251
  name: t.slice(0, 64),
7252
- color: typeof n == "string" && wa.test(n.trim()) ? n.trim() : ma
7252
+ color: typeof n == "string" && ma.test(n.trim()) ? n.trim() : ya
7253
7253
  };
7254
7254
  }
7255
- function As(e) {
7255
+ function Ts(e) {
7256
7256
  return Array.isArray(e) && e.length <= 256 && e.every((t) => Number.isInteger(t) && t >= 0);
7257
7257
  }
7258
- function ya(e) {
7258
+ function ba(e) {
7259
7259
  if (!e || typeof e != "object") return null;
7260
7260
  const t = e;
7261
- if (!As(t.anchorPath)) return null;
7261
+ if (!Ts(t.anchorPath)) return null;
7262
7262
  const n = (s) => typeof s == "number" && Number.isFinite(s) && s >= 0 ? Math.floor(s) : 0;
7263
7263
  return {
7264
7264
  anchorPath: t.anchorPath,
7265
7265
  anchorOffset: n(t.anchorOffset),
7266
- focusPath: As(t.focusPath) ? t.focusPath : void 0,
7266
+ focusPath: Ts(t.focusPath) ? t.focusPath : void 0,
7267
7267
  focusOffset: n(t.focusOffset)
7268
7268
  };
7269
7269
  }
7270
- function Ts(e, t) {
7270
+ function xs(e, t) {
7271
7271
  let n = e;
7272
7272
  for (const s of t) {
7273
7273
  const r = n.childNodes[s];
@@ -7276,7 +7276,7 @@ function Ts(e, t) {
7276
7276
  }
7277
7277
  return n;
7278
7278
  }
7279
- function xs(e, t, n) {
7279
+ function Is(e, t, n) {
7280
7280
  if (!e.contains(t)) return null;
7281
7281
  const s = [];
7282
7282
  let r = t;
@@ -7287,9 +7287,9 @@ function xs(e, t, n) {
7287
7287
  }
7288
7288
  return { path: s, offset: n };
7289
7289
  }
7290
- class ba {
7290
+ class ka {
7291
7291
  constructor(t, n, s) {
7292
- this.root = t, this.awareness = n, this.user = s, this.caretElements = /* @__PURE__ */ new Map(), this.pendingBroadcast = !1, this.onSelectionChange = () => this.scheduleBroadcast(), this.onAwarenessChange = () => this.renderRemoteCursors(), this.onViewportChange = () => this.renderRemoteCursors(), pa(), this.awareness.setLocalStateField("user", this.user), document.addEventListener("selectionchange", this.onSelectionChange), this.awareness.on("change", this.onAwarenessChange), window.addEventListener("scroll", this.onViewportChange, !0), window.addEventListener("resize", this.onViewportChange);
7292
+ this.root = t, this.awareness = n, this.user = s, this.caretElements = /* @__PURE__ */ new Map(), this.pendingBroadcast = !1, this.onSelectionChange = () => this.scheduleBroadcast(), this.onAwarenessChange = () => this.renderRemoteCursors(), this.onViewportChange = () => this.renderRemoteCursors(), wa(), this.awareness.setLocalStateField("user", this.user), document.addEventListener("selectionchange", this.onSelectionChange), this.awareness.on("change", this.onAwarenessChange), window.addEventListener("scroll", this.onViewportChange, !0), window.addEventListener("resize", this.onViewportChange);
7293
7293
  }
7294
7294
  scheduleBroadcast() {
7295
7295
  this.pendingBroadcast || (this.pendingBroadcast = !0, queueMicrotask(() => {
@@ -7306,7 +7306,7 @@ class ba {
7306
7306
  this.awareness.setLocalStateField("cursor", null);
7307
7307
  return;
7308
7308
  }
7309
- const n = xs(this.root, t.anchorNode, t.anchorOffset), s = xs(this.root, t.focusNode, t.focusOffset);
7309
+ const n = Is(this.root, t.anchorNode, t.anchorOffset), s = Is(this.root, t.focusNode, t.focusOffset);
7310
7310
  if (!n || !s) return;
7311
7311
  const r = {
7312
7312
  anchorPath: n.path,
@@ -7320,7 +7320,7 @@ class ba {
7320
7320
  const t = this.awareness.getStates(), n = /* @__PURE__ */ new Set();
7321
7321
  t.forEach((s, r) => {
7322
7322
  if (r === this.awareness.clientID) return;
7323
- const i = ai(s?.user), o = ya(s?.cursor);
7323
+ const i = hi(s?.user), o = ba(s?.cursor);
7324
7324
  if (!i || !o) {
7325
7325
  this.removeCursor(r);
7326
7326
  return;
@@ -7331,7 +7331,7 @@ class ba {
7331
7331
  n.has(s) || this.removeCursor(s);
7332
7332
  }
7333
7333
  renderCursor(t, n, s) {
7334
- const r = Ts(this.root, s.anchorPath);
7334
+ const r = xs(this.root, s.anchorPath);
7335
7335
  if (!r) {
7336
7336
  this.removeCursor(t);
7337
7337
  return;
@@ -7352,7 +7352,7 @@ class ba {
7352
7352
  c.setStart(r, l), c.setEnd(r, l);
7353
7353
  const a = c.getBoundingClientRect();
7354
7354
  if (i.caret.style.top = `${a.top}px`, i.caret.style.left = `${a.left}px`, i.caret.style.height = `${a.height || 16}px`, s.focusPath) {
7355
- const h = Ts(this.root, s.focusPath);
7355
+ const h = xs(this.root, s.focusPath);
7356
7356
  if (h) {
7357
7357
  const u = Math.min(s.focusOffset ?? 0, (h.textContent ?? "").length), d = document.createRange();
7358
7358
  d.setStart(r, l), d.setEnd(h, u);
@@ -7374,68 +7374,75 @@ class ba {
7374
7374
  for (const t of Array.from(this.caretElements.keys())) this.removeCursor(t);
7375
7375
  }
7376
7376
  }
7377
- const ka = "editora-content", hi = "wss://demos.yjs.dev", _a = "demos.yjs.dev", Sa = "editora-default-room", Is = ["#f97316", "#0ea5e9", "#22c55e", "#a855f7", "#ec4899", "#eab308", "#14b8a6", "#ef4444"], gt = /* @__PURE__ */ new WeakMap(), Kn = /* @__PURE__ */ new Set(), pt = /* @__PURE__ */ new Set(), Ae = /* @__PURE__ */ new Map();
7378
- let Ls = !1, Os = !1;
7379
- function Ca(e, t) {
7380
- Ls || (Ls = !0, console.warn(
7377
+ const _a = "editora-content", ui = "wss://demos.yjs.dev", Sa = "demos.yjs.dev", Ca = "editora-default-room", Ls = ["#f97316", "#0ea5e9", "#22c55e", "#a855f7", "#ec4899", "#eab308", "#14b8a6", "#ef4444"], lt = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new Set(), Z = /* @__PURE__ */ new Set(), Ae = /* @__PURE__ */ new Map();
7378
+ let Os = !1, Ns = !1;
7379
+ function Ea(e, t) {
7380
+ Os || (Os = !0, console.warn(
7381
7381
  `[@editora/collaboration] Room "${e}" is syncing through the public demo server (${t}); anyone who knows the room name can read and edit this document. Use it for demos only: pass your own y-websocket server via the websocketUrl option (or a provider) for real use.`
7382
7382
  ));
7383
7383
  }
7384
- function Ea(e) {
7384
+ function Da(e) {
7385
7385
  try {
7386
- return new URL(e).hostname === _a;
7386
+ return new URL(e).hostname === Sa;
7387
7387
  } catch {
7388
7388
  return !1;
7389
7389
  }
7390
7390
  }
7391
- function ui(e) {
7391
+ function di(e) {
7392
7392
  return (typeof e.websocketUrl == "string" ? e.websocketUrl.trim() : "") || void 0;
7393
7393
  }
7394
- function Da(e) {
7395
- return e.provider || ui(e) ? !0 : e.allowPublicDemoServer === !0;
7394
+ function Aa(e) {
7395
+ return e.provider || di(e) ? !0 : e.allowPublicDemoServer === !0;
7396
7396
  }
7397
- function Aa() {
7398
- Os || (Os = !0, console.warn(
7399
- `[@editora/collaboration] Not connecting: no websocketUrl or provider was configured. This plugin used to fall back to the public Yjs demo server (${hi}), where anyone who knows the room name can read and edit the document, so it now stays off until you pass your own y-websocket server via the websocketUrl option (or a provider). For a throwaway demo only, set allowPublicDemoServer: true.`
7397
+ function Ta() {
7398
+ Ns || (Ns = !0, console.warn(
7399
+ `[@editora/collaboration] Not connecting: no websocketUrl or provider was configured. This plugin used to fall back to the public Yjs demo server (${ui}), where anyone who knows the room name can read and edit the document, so it now stays off until you pass your own y-websocket server via the websocketUrl option (or a provider). For a throwaway demo only, set allowPublicDemoServer: true.`
7400
7400
  ));
7401
7401
  }
7402
- function Ns() {
7402
+ function Ms() {
7403
7403
  const e = Math.floor(Math.random() * 1e4);
7404
7404
  return {
7405
7405
  name: `Guest ${e}`,
7406
- color: Is[e % Is.length]
7406
+ color: Ls[e % Ls.length]
7407
7407
  };
7408
7408
  }
7409
- let Ta = 1;
7410
- const St = [], di = ".rte-content, .editora-content, [contenteditable]";
7411
- let tn = null;
7412
- function xa(e) {
7413
- return e.matches(di);
7414
- }
7409
+ let xa = 1;
7410
+ const St = [], fi = ".rte-content, .editora-content, [contenteditable]";
7411
+ let en = null;
7415
7412
  function Ia(e) {
7413
+ return e.matches(fi);
7414
+ }
7415
+ function La(e) {
7416
7416
  const t = [];
7417
- return e instanceof HTMLElement && xa(e) && !gt.has(e) && !pt.has(e) && t.push(e), e.querySelectorAll(di).forEach((n) => {
7418
- n instanceof HTMLElement && !gt.has(n) && !pt.has(n) && t.push(n);
7417
+ return e instanceof HTMLElement && Ia(e) && !lt.has(e) && !Z.has(e) && t.push(e), e.querySelectorAll(fi).forEach((n) => {
7418
+ n instanceof HTMLElement && !lt.has(n) && !Z.has(n) && t.push(n);
7419
7419
  }), t;
7420
7420
  }
7421
- function fi() {
7421
+ function gi() {
7422
7422
  if (St.length === 0 || typeof document > "u") return;
7423
- const e = Ia(document.body);
7423
+ const e = La(document.body);
7424
7424
  for (const t of e) {
7425
7425
  const n = St.find((s) => !s.claimed);
7426
7426
  if (!n) break;
7427
- n.claimed = !0, va(t, n.options);
7427
+ n.claimed = !0, n.element = t, Ra(t, n.options);
7428
7428
  }
7429
7429
  for (; St.length && St[0].claimed; ) St.shift();
7430
7430
  }
7431
- function La() {
7432
- tn || typeof document > "u" || typeof MutationObserver > "u" || (tn = new MutationObserver(() => fi()), tn.observe(document.body, { childList: !0, subtree: !0 }));
7433
- }
7434
- function Oa(e) {
7435
- const t = { id: Ta++, options: e, claimed: !1 };
7436
- return St.push(t), La(), fi(), t;
7431
+ function Oa() {
7432
+ (/* @__PURE__ */ new Set([...He, ...Z])).forEach((t) => {
7433
+ t.isConnected || wn(t);
7434
+ });
7437
7435
  }
7438
7436
  function Na() {
7437
+ en || typeof document > "u" || typeof MutationObserver > "u" || (en = new MutationObserver(() => {
7438
+ Oa(), gi();
7439
+ }), en.observe(document.body, { childList: !0, subtree: !0 }));
7440
+ }
7441
+ function Ma(e) {
7442
+ const t = { id: xa++, options: e, claimed: !1 };
7443
+ return St.push(t), Na(), gi(), t;
7444
+ }
7445
+ function va() {
7439
7446
  const e = "editora-collaboration-presence-styles";
7440
7447
  if (typeof document > "u" || document.getElementById(e)) return;
7441
7448
  const t = document.createElement("style");
@@ -7476,8 +7483,8 @@ function Na() {
7476
7483
  }
7477
7484
  `, document.head.appendChild(t);
7478
7485
  }
7479
- function Ma() {
7480
- Na();
7486
+ function Ua() {
7487
+ va();
7481
7488
  const e = document.createElement("div");
7482
7489
  e.className = "editora-collab-presence";
7483
7490
  const t = document.createElement("span");
@@ -7492,34 +7499,34 @@ function de(e, t, n) {
7492
7499
  if (!r) return;
7493
7500
  r.innerHTML = "", n.getStates().forEach((o, c) => {
7494
7501
  if (c === n.clientID) return;
7495
- const l = ai(o?.user);
7502
+ const l = hi(o?.user);
7496
7503
  if (!l) return;
7497
7504
  const a = document.createElement("span");
7498
7505
  a.className = "editora-collab-presence__avatar", a.style.backgroundColor = l.color, a.title = l.name, a.textContent = Array.from(l.name)[0].toUpperCase(), r.appendChild(a);
7499
7506
  });
7500
7507
  }
7501
- function va(e, t) {
7502
- if (gt.has(e) || pt.has(e)) return;
7503
- pt.add(e);
7504
- const n = t.doc ?? t.provider?.doc ?? new mt(), s = !t.doc && !t.provider, r = typeof t.roomName == "function" ? t.roomName(e) : t.roomName || e.id || Sa, i = !t.provider, o = ui(t) ?? hi;
7505
- i && Ea(o) && Ca(r, o);
7506
- const c = t.provider ?? new Ql(o, r, n), l = {
7507
- name: t.userName ?? Ns().name,
7508
- color: t.userColor ?? Ns().color
7509
- }, a = Ma();
7508
+ function Ra(e, t) {
7509
+ if (lt.has(e) || Z.has(e)) return;
7510
+ Z.add(e);
7511
+ const n = t.doc ?? t.provider?.doc ?? new mt(), s = !t.doc && !t.provider, r = typeof t.roomName == "function" ? t.roomName(e) : t.roomName || e.id || Ca, i = !t.provider, o = di(t) ?? ui;
7512
+ i && Da(o) && Ea(r, o);
7513
+ const c = t.provider ?? new Zl(o, r, n), l = {
7514
+ name: t.userName ?? Ms().name,
7515
+ color: t.userColor ?? Ms().color
7516
+ }, a = Ua();
7510
7517
  e.insertAdjacentElement("beforebegin", a), de(a, "connecting", c.awareness);
7511
7518
  const h = ({ status: f }) => de(a, f, c.awareness), u = () => de(a, c.wsconnected ? "connected" : "connecting", c.awareness);
7512
7519
  c.on("status", h), c.awareness.on("change", u);
7513
7520
  const d = (f) => {
7514
- f && (c.off("sync", d), Ae.delete(e), Ua(e, n, c, i, s, l, a, h, u));
7521
+ f && (c.off("sync", d), Ae.delete(e), $a(e, n, c, i, s, l, a, h, u));
7515
7522
  };
7516
7523
  Ae.set(e, () => {
7517
7524
  c.off("sync", d), c.off("status", h), c.awareness.off("change", u), a.remove(), i && c.destroy(), s && n.destroy();
7518
7525
  }), c.synced ? d(!0) : c.on("sync", d);
7519
7526
  }
7520
- function Ua(e, t, n, s, r, i, o, c, l) {
7521
- if (pt.delete(e), gt.has(e)) return;
7522
- const a = t.getXmlFragment(ka), h = new ga(e, t, a), u = new ba(e, n.awareness, i), d = new jc(a, { trackedOrigins: /* @__PURE__ */ new Set([h]) });
7527
+ function $a(e, t, n, s, r, i, o, c, l) {
7528
+ if (Z.delete(e), lt.has(e)) return;
7529
+ const a = t.getXmlFragment(_a), h = new pa(e, t, a), u = new ka(e, n.awareness, i), d = new Hc(a, { trackedOrigins: /* @__PURE__ */ new Set([h]) });
7523
7530
  de(o, n.wsconnected ? "connected" : "connecting", n.awareness);
7524
7531
  const f = (p) => {
7525
7532
  (p.metaKey || p.ctrlKey) && (p.key.toLowerCase() === "z" && !p.shiftKey ? (p.preventDefault(), p.stopImmediatePropagation(), d.undo()) : (p.key.toLowerCase() === "z" && p.shiftKey || p.key.toLowerCase() === "y") && (p.preventDefault(), p.stopImmediatePropagation(), d.redo()));
@@ -7528,36 +7535,41 @@ function Ua(e, t, n, s, r, i, o, c, l) {
7528
7535
  const g = () => {
7529
7536
  e.removeEventListener("keydown", f, { capture: !0 }), n.off("status", c), n.awareness.off("change", l), o.remove(), u.destroy();
7530
7537
  };
7531
- gt.set(e, { doc: t, provider: n, ownsProvider: s, ownsDoc: r, binding: h, undoManager: d, cursorCleanup: g, connectionIndicator: o }), Kn.add(e);
7538
+ lt.set(e, { doc: t, provider: n, ownsProvider: s, ownsDoc: r, binding: h, undoManager: d, cursorCleanup: g, connectionIndicator: o }), He.add(e);
7532
7539
  }
7533
- function Ra(e) {
7540
+ function wn(e) {
7534
7541
  const t = Ae.get(e);
7535
- t && (t(), Ae.delete(e), pt.delete(e));
7536
- const n = gt.get(e);
7537
- n && (n.cursorCleanup(), n.binding.destroy(), n.undoManager.destroy(), n.ownsProvider && n.provider.destroy(), n.ownsDoc && n.doc.destroy(), gt.delete(e), Kn.delete(e));
7542
+ t && (t(), Ae.delete(e), Z.delete(e));
7543
+ const n = lt.get(e);
7544
+ n && (n.cursorCleanup(), n.binding.destroy(), n.undoManager.destroy(), n.ownsProvider && n.provider.destroy(), n.ownsDoc && n.doc.destroy(), lt.delete(e), He.delete(e));
7538
7545
  }
7539
- const $a = (e = {}) => {
7540
- let t = !1;
7541
- const n = {
7546
+ const Ba = (e = {}) => {
7547
+ let t = null, n = !1;
7548
+ const s = {
7542
7549
  name: "collaboration",
7543
7550
  init: () => {
7544
- if (t) return;
7545
- t = !0;
7546
- const s = { ...e, ...n.__pluginConfig ?? {} };
7547
- if (!Da(s)) {
7548
- Aa();
7551
+ if (t) {
7552
+ if (!t.claimed) return;
7553
+ const i = t.element;
7554
+ if (i && i.isConnected && (lt.has(i) || Z.has(i))) return;
7555
+ i && wn(i), t = null;
7556
+ }
7557
+ if (n) return;
7558
+ const r = { ...e, ...s.__pluginConfig ?? {} };
7559
+ if (!Aa(r)) {
7560
+ n = !0, Ta();
7549
7561
  return;
7550
7562
  }
7551
- Oa(s);
7563
+ t = Ma(r);
7552
7564
  },
7553
7565
  commands: {},
7554
7566
  destroy: () => {
7555
- const s = /* @__PURE__ */ new Set([...Kn, ...pt]);
7556
- Array.from(s).forEach((r) => Ra(r));
7567
+ const r = /* @__PURE__ */ new Set([...He, ...Z]);
7568
+ Array.from(r).forEach((i) => wn(i));
7557
7569
  }
7558
7570
  };
7559
- return n;
7571
+ return s;
7560
7572
  };
7561
7573
  export {
7562
- $a as CollaborationPlugin
7574
+ Ba as CollaborationPlugin
7563
7575
  };