playhtml 2.0.11 → 2.0.13

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.
@@ -45,12 +45,12 @@ var Gt = 1e6, wr = "y-pk-batch", An = !1, mr = (n, t) => {
45
45
  function Ln(n) {
46
46
  return `${wr}#${JSON.stringify(n)}`;
47
47
  }
48
- const O = () => /* @__PURE__ */ new Map(), Re = (n) => {
48
+ const O = () => /* @__PURE__ */ new Map(), Be = (n) => {
49
49
  const t = O();
50
50
  return n.forEach((e, s) => {
51
51
  t.set(s, e);
52
52
  }), t;
53
- }, W = (n, t, e) => {
53
+ }, J = (n, t, e) => {
54
54
  let s = n.get(t);
55
55
  return s === void 0 && n.set(t, s = e()), s;
56
56
  }, yr = (n, t) => {
@@ -63,7 +63,7 @@ const O = () => /* @__PURE__ */ new Map(), Re = (n) => {
63
63
  if (t(s, e))
64
64
  return !0;
65
65
  return !1;
66
- }, lt = () => /* @__PURE__ */ new Set(), Se = (n) => n[n.length - 1], kr = (n, t) => {
66
+ }, lt = () => /* @__PURE__ */ new Set(), De = (n) => n[n.length - 1], kr = (n, t) => {
67
67
  for (let e = 0; e < t.length; e++)
68
68
  n.push(t[e]);
69
69
  }, tt = Array.from, _r = Array.isArray;
@@ -76,7 +76,7 @@ class fe {
76
76
  * @param {function} f
77
77
  */
78
78
  on(t, e) {
79
- W(this._observers, t, lt).add(e);
79
+ J(this._observers, t, lt).add(e);
80
80
  }
81
81
  /**
82
82
  * @param {N} name
@@ -112,7 +112,7 @@ class fe {
112
112
  this._observers = O();
113
113
  }
114
114
  }
115
- const X = Math.floor, te = Math.abs, Ge = (n, t) => n < t ? n : t, ft = (n, t) => n > t ? n : t, Sr = Math.pow, es = (n) => n !== 0 ? n < 0 : 1 / n < 0, Dr = String.fromCharCode, Er = (n) => n.toLowerCase(), Cr = /^\s*/g, Ar = (n) => n.replace(Cr, ""), Lr = /([A-Z])/g, In = (n, t) => Ar(n.replace(Lr, (e) => `${t}${Er(e)}`)), Ir = (n) => {
115
+ const Y = Math.floor, te = Math.abs, Pe = (n, t) => n < t ? n : t, ft = (n, t) => n > t ? n : t, Sr = Math.pow, es = (n) => n !== 0 ? n < 0 : 1 / n < 0, Dr = String.fromCharCode, Er = (n) => n.toLowerCase(), Cr = /^\s*/g, Ar = (n) => n.replace(Cr, ""), Lr = /([A-Z])/g, In = (n, t) => Ar(n.replace(Lr, (e) => `${t}${Er(e)}`)), Ir = (n) => {
116
116
  const t = unescape(encodeURIComponent(n)), e = t.length, s = new Uint8Array(e);
117
117
  for (let r = 0; r < e; r++)
118
118
  s[r] = /** @type {number} */
@@ -121,10 +121,10 @@ const X = Math.floor, te = Math.abs, Ge = (n, t) => n < t ? n : t, ft = (n, t) =
121
121
  }, Tt = (
122
122
  /** @type {TextEncoder} */
123
123
  typeof TextEncoder < "u" ? new TextEncoder() : null
124
- ), vr = (n) => Tt.encode(n), Mr = Tt ? vr : Ir;
125
- let Mt = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", { fatal: !0, ignoreBOM: !0 });
126
- Mt && Mt.decode(new Uint8Array()).length === 1 && (Mt = null);
127
- const vn = (n) => n === void 0 ? null : n;
124
+ ), Mr = (n) => Tt.encode(n), vr = Tt ? Mr : Ir;
125
+ let vt = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", { fatal: !0, ignoreBOM: !0 });
126
+ vt && vt.decode(new Uint8Array()).length === 1 && (vt = null);
127
+ const Mn = (n) => n === void 0 ? null : n;
128
128
  class xr {
129
129
  constructor() {
130
130
  this.map = /* @__PURE__ */ new Map();
@@ -173,12 +173,12 @@ const ss = ns, Ur = (n) => qe || addEventListener(
173
173
  if (!t(n[e], e))
174
174
  return !1;
175
175
  return !0;
176
- }, rs = (n, t) => Object.prototype.hasOwnProperty.call(n, t), Hr = (n, t) => n === t || re(n) === re(t) && Vr(n, (e, s) => (e !== void 0 || rs(t, s)) && t[s] === e), Pe = (n, t, e = 0) => {
176
+ }, rs = (n, t) => Object.prototype.hasOwnProperty.call(n, t), Hr = (n, t) => n === t || re(n) === re(t) && Vr(n, (e, s) => (e !== void 0 || rs(t, s)) && t[s] === e), Ze = (n, t, e = 0) => {
177
177
  try {
178
178
  for (; e < n.length; e++)
179
179
  n[e](...t);
180
180
  } finally {
181
- e < n.length && Pe(n, t, e + 1);
181
+ e < n.length && Ze(n, t, e + 1);
182
182
  }
183
183
  }, $r = (n) => n, jr = (n, t) => n === t, xt = (n, t) => {
184
184
  if (n == null || t == null)
@@ -253,13 +253,13 @@ const zr = () => {
253
253
  }
254
254
  })) : R = O();
255
255
  return R;
256
- }, Be = (n) => zr().has(n), Ne = (n) => vn(_t ? process.env[n.toUpperCase()] : ss.getItem(n)), Yr = (n) => Be("--" + n) || Ne(n) !== null;
256
+ }, Ne = (n) => zr().has(n), Fe = (n) => Mn(_t ? process.env[n.toUpperCase()] : ss.getItem(n)), Yr = (n) => Ne("--" + n) || Fe(n) !== null;
257
257
  Yr("production");
258
- const Mn = _t && Kr(process.env.FORCE_COLOR, ["true", "1", "2"]), Xr = !Be("no-colors") && (!_t || process.stdout.isTTY || Mn) && (!_t || Be("color") || Mn || Ne("COLORTERM") !== null || (Ne("TERM") || "").includes("color")), xn = 1, Un = 2, De = 4, Ee = 8, Ot = 32, z = 64, x = 128, ge = 31, Fe = 63, it = 127, Jr = 2147483647, os = Number.MAX_SAFE_INTEGER, Wr = Number.isInteger || ((n) => typeof n == "number" && isFinite(n) && X(n) === n), J = (n) => new Error(n), B = () => {
259
- throw J("Method unimplemented");
258
+ const vn = _t && Kr(process.env.FORCE_COLOR, ["true", "1", "2"]), Xr = !Ne("no-colors") && (!_t || process.stdout.isTTY || vn) && (!_t || Ne("color") || vn || Fe("COLORTERM") !== null || (Fe("TERM") || "").includes("color")), xn = 1, Un = 2, Ee = 4, Ce = 8, Ot = 32, z = 64, x = 128, ge = 31, Ve = 63, it = 127, Jr = 2147483647, os = Number.MAX_SAFE_INTEGER, Wr = Number.isInteger || ((n) => typeof n == "number" && isFinite(n) && Y(n) === n), X = (n) => new Error(n), B = () => {
259
+ throw X("Method unimplemented");
260
260
  }, V = () => {
261
- throw J("Unexpected case");
262
- }, ls = J("Unexpected end of array"), cs = J("Integer out of Range");
261
+ throw X("Unexpected case");
262
+ }, ls = X("Unexpected end of array"), cs = X("Integer out of Range");
263
263
  class pe {
264
264
  /**
265
265
  * @param {Uint8Array} uint8Array Binary data to decode
@@ -268,10 +268,10 @@ class pe {
268
268
  this.arr = t, this.pos = 0;
269
269
  }
270
270
  }
271
- const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, qr = (n, t) => {
272
- const e = tn(n.arr.buffer, n.pos + n.arr.byteOffset, t);
271
+ const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, Pr = (n, t) => {
272
+ const e = en(n.arr.buffer, n.pos + n.arr.byteOffset, t);
273
273
  return n.pos += t, e;
274
- }, v = (n) => qr(n, m(n)), St = (n) => n.arr[n.pos++], m = (n) => {
274
+ }, M = (n) => Pr(n, m(n)), St = (n) => n.arr[n.pos++], m = (n) => {
275
275
  let t = 0, e = 1;
276
276
  const s = n.arr.length;
277
277
  for (; n.pos < s; ) {
@@ -282,8 +282,8 @@ const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, qr = (n, t) =>
282
282
  throw cs;
283
283
  }
284
284
  throw ls;
285
- }, Ze = (n) => {
286
- let t = n.arr[n.pos++], e = t & Fe, s = 64;
285
+ }, Qe = (n) => {
286
+ let t = n.arr[n.pos++], e = t & Ve, s = 64;
287
287
  const r = (t & z) > 0 ? -1 : 1;
288
288
  if (!(t & x))
289
289
  return r * e;
@@ -295,7 +295,7 @@ const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, qr = (n, t) =>
295
295
  throw cs;
296
296
  }
297
297
  throw ls;
298
- }, Pr = (n) => {
298
+ }, qr = (n) => {
299
299
  let t = m(n);
300
300
  if (t === 0)
301
301
  return "";
@@ -317,20 +317,20 @@ const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, qr = (n, t) =>
317
317
  }
318
318
  }, Zr = (n) => (
319
319
  /** @type any */
320
- Mt.decode(v(n))
321
- ), Q = Mt ? Zr : Pr, Qe = (n, t) => {
320
+ vt.decode(M(n))
321
+ ), Z = vt ? Zr : qr, tn = (n, t) => {
322
322
  const e = new DataView(n.arr.buffer, n.arr.byteOffset + n.pos, t);
323
323
  return n.pos += t, e;
324
- }, Qr = (n) => Qe(n, 4).getFloat32(0, !1), ti = (n) => Qe(n, 8).getFloat64(0, !1), ei = (n) => (
324
+ }, Qr = (n) => tn(n, 4).getFloat32(0, !1), ti = (n) => tn(n, 8).getFloat64(0, !1), ei = (n) => (
325
325
  /** @type {any} */
326
- Qe(n, 8).getBigInt64(0, !1)
326
+ tn(n, 8).getBigInt64(0, !1)
327
327
  ), ni = [
328
328
  (n) => {
329
329
  },
330
330
  // CASE 127: undefined
331
331
  (n) => null,
332
332
  // CASE 126: null
333
- Ze,
333
+ Qe,
334
334
  // CASE 125: integer
335
335
  Qr,
336
336
  // CASE 124: float32
@@ -342,12 +342,12 @@ const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, qr = (n, t) =>
342
342
  // CASE 121: boolean (false)
343
343
  (n) => !0,
344
344
  // CASE 120: boolean (true)
345
- Q,
345
+ Z,
346
346
  // CASE 119: string
347
347
  (n) => {
348
348
  const t = m(n), e = {};
349
349
  for (let s = 0; s < t; s++) {
350
- const r = Q(n);
350
+ const r = Z(n);
351
351
  e[r] = Rt(n);
352
352
  }
353
353
  return e;
@@ -358,7 +358,7 @@ const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, qr = (n, t) =>
358
358
  e.push(Rt(n));
359
359
  return e;
360
360
  },
361
- v
361
+ M
362
362
  // CASE 116: Uint8Array
363
363
  ], Rt = (n) => ni[127 - St(n)](n);
364
364
  class Tn extends pe {
@@ -383,7 +383,7 @@ class ee extends pe {
383
383
  }
384
384
  read() {
385
385
  if (this.count === 0) {
386
- this.s = Ze(this);
386
+ this.s = Qe(this);
387
387
  const t = es(this.s);
388
388
  this.count = 1, t && (this.s = -this.s, this.count = m(this) + 2);
389
389
  }
@@ -391,7 +391,7 @@ class ee extends pe {
391
391
  this.s;
392
392
  }
393
393
  }
394
- class Ce extends pe {
394
+ class Ae extends pe {
395
395
  /**
396
396
  * @param {Uint8Array} uint8Array
397
397
  */
@@ -403,8 +403,8 @@ class Ce extends pe {
403
403
  */
404
404
  read() {
405
405
  if (this.count === 0) {
406
- const t = Ze(this), e = t & 1;
407
- this.diff = X(t / 2), this.count = 1, e && (this.count = m(this) + 2);
406
+ const t = Qe(this), e = t & 1;
407
+ this.diff = Y(t / 2), this.count = 1, e && (this.count = m(this) + 2);
408
408
  }
409
409
  return this.s += this.diff, this.count--, this.s;
410
410
  }
@@ -414,7 +414,7 @@ class si {
414
414
  * @param {Uint8Array} uint8Array
415
415
  */
416
416
  constructor(t) {
417
- this.decoder = new ee(t), this.str = Q(this.decoder), this.spos = 0;
417
+ this.decoder = new ee(t), this.str = Z(this.decoder), this.spos = 0;
418
418
  }
419
419
  /**
420
420
  * @return {string}
@@ -424,7 +424,7 @@ class si {
424
424
  return this.spos = t, e;
425
425
  }
426
426
  }
427
- const as = (n) => new Uint8Array(n), tn = (n, t, e) => new Uint8Array(n, t, e), ri = (n) => new Uint8Array(n), ii = (n) => {
427
+ const as = (n) => new Uint8Array(n), en = (n, t, e) => new Uint8Array(n, t, e), ri = (n) => new Uint8Array(n), ii = (n) => {
428
428
  let t = "";
429
429
  for (let e = 0; e < n.byteLength; e++)
430
430
  t += Dr(n[e]);
@@ -446,41 +446,41 @@ class $t {
446
446
  this.cpos = 0, this.cbuf = new Uint8Array(100), this.bufs = [];
447
447
  }
448
448
  }
449
- const M = () => new $t(), en = (n) => {
449
+ const v = () => new $t(), nn = (n) => {
450
450
  let t = n.cpos;
451
451
  for (let e = 0; e < n.bufs.length; e++)
452
452
  t += n.bufs[e].length;
453
453
  return t;
454
454
  }, _ = (n) => {
455
- const t = new Uint8Array(en(n));
455
+ const t = new Uint8Array(nn(n));
456
456
  let e = 0;
457
457
  for (let s = 0; s < n.bufs.length; s++) {
458
458
  const r = n.bufs[s];
459
459
  t.set(r, e), e += r.length;
460
460
  }
461
- return t.set(tn(n.cbuf.buffer, 0, n.cpos), e), t;
461
+ return t.set(en(n.cbuf.buffer, 0, n.cpos), e), t;
462
462
  }, di = (n, t) => {
463
463
  const e = n.cbuf.length;
464
- e - n.cpos < t && (n.bufs.push(tn(n.cbuf.buffer, 0, n.cpos)), n.cbuf = new Uint8Array(ft(e, t) * 2), n.cpos = 0);
464
+ e - n.cpos < t && (n.bufs.push(en(n.cbuf.buffer, 0, n.cpos)), n.cbuf = new Uint8Array(ft(e, t) * 2), n.cpos = 0);
465
465
  }, A = (n, t) => {
466
466
  const e = n.cbuf.length;
467
467
  n.cpos === e && (n.bufs.push(n.cbuf), n.cbuf = new Uint8Array(e * 2), n.cpos = 0), n.cbuf[n.cpos++] = t;
468
- }, Ve = A, p = (n, t) => {
468
+ }, He = A, p = (n, t) => {
469
469
  for (; t > it; )
470
- A(n, x | it & t), t = X(t / 128);
470
+ A(n, x | it & t), t = Y(t / 128);
471
471
  A(n, it & t);
472
- }, nn = (n, t) => {
472
+ }, sn = (n, t) => {
473
473
  const e = es(t);
474
- for (e && (t = -t), A(n, (t > Fe ? x : 0) | (e ? z : 0) | Fe & t), t = X(t / 64); t > 0; )
475
- A(n, (t > it ? x : 0) | it & t), t = X(t / 128);
476
- }, He = new Uint8Array(3e4), fi = He.length / 3, gi = (n, t) => {
474
+ for (e && (t = -t), A(n, (t > Ve ? x : 0) | (e ? z : 0) | Ve & t), t = Y(t / 64); t > 0; )
475
+ A(n, (t > it ? x : 0) | it & t), t = Y(t / 128);
476
+ }, $e = new Uint8Array(3e4), fi = $e.length / 3, gi = (n, t) => {
477
477
  if (t.length < fi) {
478
- const e = Tt.encodeInto(t, He).written || 0;
478
+ const e = Tt.encodeInto(t, $e).written || 0;
479
479
  p(n, e);
480
480
  for (let s = 0; s < e; s++)
481
- A(n, He[s]);
481
+ A(n, $e[s]);
482
482
  } else
483
- D(n, Mr(t));
483
+ D(n, vr(t));
484
484
  }, pi = (n, t) => {
485
485
  const e = unescape(encodeURIComponent(t)), s = e.length;
486
486
  p(n, s);
@@ -492,24 +492,24 @@ const M = () => new $t(), en = (n) => {
492
492
  );
493
493
  }, ot = Tt && /** @type {any} */
494
494
  Tt.encodeInto ? gi : pi, we = (n, t) => {
495
- const e = n.cbuf.length, s = n.cpos, r = Ge(e - s, t.length), i = t.length - r;
495
+ const e = n.cbuf.length, s = n.cpos, r = Pe(e - s, t.length), i = t.length - r;
496
496
  n.cbuf.set(t.subarray(0, r), s), n.cpos += r, i > 0 && (n.bufs.push(n.cbuf), n.cbuf = new Uint8Array(ft(e * 2, i)), n.cbuf.set(t.subarray(r)), n.cpos = i);
497
497
  }, D = (n, t) => {
498
498
  p(n, t.byteLength), we(n, t);
499
- }, sn = (n, t) => {
499
+ }, rn = (n, t) => {
500
500
  di(n, t);
501
501
  const e = new DataView(n.cbuf.buffer, n.cpos, t);
502
502
  return n.cpos += t, e;
503
- }, wi = (n, t) => sn(n, 4).setFloat32(0, t, !1), mi = (n, t) => sn(n, 8).setFloat64(0, t, !1), yi = (n, t) => (
503
+ }, wi = (n, t) => rn(n, 4).setFloat32(0, t, !1), mi = (n, t) => rn(n, 8).setFloat64(0, t, !1), yi = (n, t) => (
504
504
  /** @type {any} */
505
- sn(n, 8).setBigInt64(0, t, !1)
505
+ rn(n, 8).setBigInt64(0, t, !1)
506
506
  ), On = new DataView(new ArrayBuffer(4)), bi = (n) => (On.setFloat32(0, n), On.getFloat32(0) === n), Bt = (n, t) => {
507
507
  switch (typeof t) {
508
508
  case "string":
509
509
  A(n, 119), ot(n, t);
510
510
  break;
511
511
  case "number":
512
- Wr(t) && te(t) <= Jr ? (A(n, 125), nn(n, t)) : bi(t) ? (A(n, 124), wi(n, t)) : (A(n, 123), mi(n, t));
512
+ Wr(t) && te(t) <= Jr ? (A(n, 125), sn(n, t)) : bi(t) ? (A(n, 124), wi(n, t)) : (A(n, 123), mi(n, t));
513
513
  break;
514
514
  case "bigint":
515
515
  A(n, 122), yi(n, t);
@@ -555,7 +555,7 @@ class Rn extends $t {
555
555
  }
556
556
  }
557
557
  const Bn = (n) => {
558
- n.count > 0 && (nn(n.encoder, n.count === 1 ? n.s : -n.s), n.count > 1 && p(n.encoder, n.count - 2));
558
+ n.count > 0 && (sn(n.encoder, n.count === 1 ? n.s : -n.s), n.count > 1 && p(n.encoder, n.count - 2));
559
559
  };
560
560
  class ne {
561
561
  constructor() {
@@ -574,10 +574,10 @@ class ne {
574
574
  const Nn = (n) => {
575
575
  if (n.count > 0) {
576
576
  const t = n.diff * 2 + (n.count === 1 ? 0 : 1);
577
- nn(n.encoder, t), n.count > 1 && p(n.encoder, n.count - 2);
577
+ sn(n.encoder, t), n.count > 1 && p(n.encoder, n.count - 2);
578
578
  }
579
579
  };
580
- class Ae {
580
+ class Le {
581
581
  constructor() {
582
582
  this.encoder = new $t(), this.s = 0, this.count = 0, this.diff = 0;
583
583
  }
@@ -626,7 +626,7 @@ class Ei {
626
626
  }
627
627
  const K = (n, t) => new Ei(n, t);
628
628
  typeof DOMParser < "u" && new DOMParser();
629
- const Ci = (n) => yr(n, (t, e) => `${e}:${t};`).join(""), G = Symbol, us = G(), ds = G(), Ai = G(), Li = G(), Ii = G(), fs = G(), vi = G(), gs = G(), Mi = G(), xi = (n) => {
629
+ const Ci = (n) => yr(n, (t, e) => `${e}:${t};`).join(""), W = Symbol, us = W(), ds = W(), Ai = W(), Li = W(), Ii = W(), fs = W(), Mi = W(), gs = W(), vi = W(), xi = (n) => {
630
630
  const t = [];
631
631
  let e = 0;
632
632
  for (; e < n.length; e++) {
@@ -641,10 +641,10 @@ const Ci = (n) => yr(n, (t, e) => `${e}:${t};`).join(""), G = Symbol, us = G(),
641
641
  [Ii]: K("color", "green"),
642
642
  [Li]: K("color", "grey"),
643
643
  [fs]: K("color", "red"),
644
- [vi]: K("color", "purple"),
644
+ [Mi]: K("color", "purple"),
645
645
  [gs]: K("color", "orange"),
646
646
  // not well supported in chrome when debugging node with inspector - TODO: deprecate
647
- [Mi]: K("color", "black")
647
+ [vi]: K("color", "black")
648
648
  }, Ti = (n) => {
649
649
  const t = [], e = [], s = O();
650
650
  let r = [], i = 0;
@@ -680,11 +680,11 @@ const Ci = (n) => yr(n, (t, e) => `${e}:${t};`).join(""), G = Symbol, us = G(),
680
680
  e = n.next();
681
681
  while (!e.done && !t(e.value));
682
682
  return e;
683
- }), Le = (n, t) => ps(() => {
683
+ }), Ie = (n, t) => ps(() => {
684
684
  const { done: e, value: s } = n.next();
685
685
  return { done: e, value: e ? void 0 : t(s) };
686
686
  });
687
- class rn {
687
+ class on {
688
688
  /**
689
689
  * @param {number} clock
690
690
  * @param {number} len
@@ -705,12 +705,12 @@ const ws = (n, t, e) => t.clients.forEach((s, r) => {
705
705
  );
706
706
  for (let o = 0; o < s.length; o++) {
707
707
  const l = s[o];
708
- Ms(n, i, l.clock, l.len, e);
708
+ vs(n, i, l.clock, l.len, e);
709
709
  }
710
710
  }), Fi = (n, t) => {
711
711
  let e = 0, s = n.length - 1;
712
712
  for (; e <= s; ) {
713
- const r = X((e + s) / 2), i = n[r], o = i.clock;
713
+ const r = Y((e + s) / 2), i = n[r], o = i.clock;
714
714
  if (o <= t) {
715
715
  if (t < o + i.len)
716
716
  return r;
@@ -722,7 +722,7 @@ const ws = (n, t, e) => t.clients.forEach((s, r) => {
722
722
  }, ms = (n, t) => {
723
723
  const e = n.clients.get(t.client);
724
724
  return e !== void 0 && Fi(e, t.clock) !== null;
725
- }, on = (n) => {
725
+ }, ln = (n) => {
726
726
  n.clients.forEach((t) => {
727
727
  t.sort((r, i) => r.clock - i.clock);
728
728
  let e, s;
@@ -743,12 +743,12 @@ const ws = (n, t, e) => t.clients.forEach((s, r) => {
743
743
  t.clients.set(r, i);
744
744
  }
745
745
  });
746
- return on(t), t;
746
+ return ln(t), t;
747
747
  }, ie = (n, t, e, s) => {
748
- W(n.clients, t, () => (
748
+ J(n.clients, t, () => (
749
749
  /** @type {Array<DeleteItem>} */
750
750
  []
751
- )).push(new rn(e, s));
751
+ )).push(new on(e, s));
752
752
  }, Hi = () => new jt(), $i = (n) => {
753
753
  const t = Hi();
754
754
  return n.clients.forEach((e, s) => {
@@ -761,7 +761,7 @@ const ws = (n, t, e) => t.clients.forEach((s, r) => {
761
761
  if (i + 1 < e.length)
762
762
  for (let a = e[i + 1]; i + 1 < e.length && a.deleted; a = e[++i + 1])
763
763
  c += a.length;
764
- r.push(new rn(l, c));
764
+ r.push(new on(l, c));
765
765
  }
766
766
  }
767
767
  r.length > 0 && t.clients.set(s, r);
@@ -776,18 +776,18 @@ const ws = (n, t, e) => t.clients.forEach((s, r) => {
776
776
  n.writeDsClock(o.clock), n.writeDsLen(o.len);
777
777
  }
778
778
  });
779
- }, ln = (n) => {
779
+ }, cn = (n) => {
780
780
  const t = new jt(), e = m(n.restDecoder);
781
781
  for (let s = 0; s < e; s++) {
782
782
  n.resetDsCurVal();
783
783
  const r = m(n.restDecoder), i = m(n.restDecoder);
784
784
  if (i > 0) {
785
- const o = W(t.clients, r, () => (
785
+ const o = J(t.clients, r, () => (
786
786
  /** @type {Array<DeleteItem>} */
787
787
  []
788
788
  ));
789
789
  for (let l = 0; l < i; l++)
790
- o.push(new rn(n.readDsClock(), n.readDsLen()));
790
+ o.push(new on(n.readDsClock(), n.readDsLen()));
791
791
  }
792
792
  }
793
793
  return t;
@@ -901,7 +901,7 @@ class gt extends fe {
901
901
  * @public
902
902
  */
903
903
  get(t, e = I) {
904
- const s = W(this.share, t, () => {
904
+ const s = J(this.share, t, () => {
905
905
  const i = new e();
906
906
  return i._integrate(this, null), i;
907
907
  }), r = s.constructor;
@@ -1066,7 +1066,7 @@ class ks extends bs {
1066
1066
  * @return {string}
1067
1067
  */
1068
1068
  readString() {
1069
- return Q(this.restDecoder);
1069
+ return Z(this.restDecoder);
1070
1070
  }
1071
1071
  /**
1072
1072
  * @return {boolean} isKey
@@ -1098,7 +1098,7 @@ class ks extends bs {
1098
1098
  * @return {Uint8Array}
1099
1099
  */
1100
1100
  readBuf() {
1101
- return ui(v(this.restDecoder));
1101
+ return ui(M(this.restDecoder));
1102
1102
  }
1103
1103
  /**
1104
1104
  * Legacy implementation uses JSON parse. We use any-decoding in v2.
@@ -1106,13 +1106,13 @@ class ks extends bs {
1106
1106
  * @return {any}
1107
1107
  */
1108
1108
  readJSON() {
1109
- return JSON.parse(Q(this.restDecoder));
1109
+ return JSON.parse(Z(this.restDecoder));
1110
1110
  }
1111
1111
  /**
1112
1112
  * @return {string}
1113
1113
  */
1114
1114
  readKey() {
1115
- return Q(this.restDecoder);
1115
+ return Z(this.restDecoder);
1116
1116
  }
1117
1117
  }
1118
1118
  class ji {
@@ -1144,7 +1144,7 @@ class Et extends ji {
1144
1144
  * @param {decoding.Decoder} decoder
1145
1145
  */
1146
1146
  constructor(t) {
1147
- super(t), this.keys = [], m(t), this.keyClockDecoder = new Ce(v(t)), this.clientDecoder = new ee(v(t)), this.leftClockDecoder = new Ce(v(t)), this.rightClockDecoder = new Ce(v(t)), this.infoDecoder = new Tn(v(t), St), this.stringDecoder = new si(v(t)), this.parentInfoDecoder = new Tn(v(t), St), this.typeRefDecoder = new ee(v(t)), this.lenDecoder = new ee(v(t));
1147
+ super(t), this.keys = [], m(t), this.keyClockDecoder = new Ae(M(t)), this.clientDecoder = new ee(M(t)), this.leftClockDecoder = new Ae(M(t)), this.rightClockDecoder = new Ae(M(t)), this.infoDecoder = new Tn(M(t), St), this.stringDecoder = new si(M(t)), this.parentInfoDecoder = new Tn(M(t), St), this.typeRefDecoder = new ee(M(t)), this.lenDecoder = new ee(M(t));
1148
1148
  }
1149
1149
  /**
1150
1150
  * @return {ID}
@@ -1210,7 +1210,7 @@ class Et extends ji {
1210
1210
  * @return {Uint8Array}
1211
1211
  */
1212
1212
  readBuf() {
1213
- return v(this.restDecoder);
1213
+ return M(this.restDecoder);
1214
1214
  }
1215
1215
  /**
1216
1216
  * This is mainly here for legacy purposes.
@@ -1237,7 +1237,7 @@ class Et extends ji {
1237
1237
  }
1238
1238
  class _s {
1239
1239
  constructor() {
1240
- this.restEncoder = M();
1240
+ this.restEncoder = v();
1241
1241
  }
1242
1242
  toUint8Array() {
1243
1243
  return _(this.restEncoder);
@@ -1281,7 +1281,7 @@ class Kt extends _s {
1281
1281
  * @param {number} info An unsigned 8-bit integer
1282
1282
  */
1283
1283
  writeInfo(t) {
1284
- Ve(this.restEncoder, t);
1284
+ He(this.restEncoder, t);
1285
1285
  }
1286
1286
  /**
1287
1287
  * @param {string} s
@@ -1336,7 +1336,7 @@ class Kt extends _s {
1336
1336
  }
1337
1337
  class Ss {
1338
1338
  constructor() {
1339
- this.restEncoder = M(), this.dsCurrVal = 0;
1339
+ this.restEncoder = v(), this.dsCurrVal = 0;
1340
1340
  }
1341
1341
  toUint8Array() {
1342
1342
  return _(this.restEncoder);
@@ -1360,10 +1360,10 @@ class Ss {
1360
1360
  }
1361
1361
  class at extends Ss {
1362
1362
  constructor() {
1363
- super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new Ae(), this.clientEncoder = new ne(), this.leftClockEncoder = new Ae(), this.rightClockEncoder = new Ae(), this.infoEncoder = new Rn(Ve), this.stringEncoder = new ki(), this.parentInfoEncoder = new Rn(Ve), this.typeRefEncoder = new ne(), this.lenEncoder = new ne();
1363
+ super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new Le(), this.clientEncoder = new ne(), this.leftClockEncoder = new Le(), this.rightClockEncoder = new Le(), this.infoEncoder = new Rn(He), this.stringEncoder = new ki(), this.parentInfoEncoder = new Rn(He), this.typeRefEncoder = new ne(), this.lenEncoder = new ne();
1364
1364
  }
1365
1365
  toUint8Array() {
1366
- const t = M();
1366
+ const t = v();
1367
1367
  return p(t, 0), D(t, this.keyClockEncoder.toUint8Array()), D(t, this.clientEncoder.toUint8Array()), D(t, this.leftClockEncoder.toUint8Array()), D(t, this.rightClockEncoder.toUint8Array()), D(t, _(this.infoEncoder)), D(t, this.stringEncoder.toUint8Array()), D(t, _(this.parentInfoEncoder)), D(t, this.typeRefEncoder.toUint8Array()), D(t, this.lenEncoder.toUint8Array()), we(t, _(this.restEncoder)), _(t);
1368
1368
  }
1369
1369
  /**
@@ -1459,7 +1459,7 @@ const Ki = (n, t, e, s) => {
1459
1459
  i.write(n, s - i.id.clock);
1460
1460
  for (let o = r + 1; o < t.length; o++)
1461
1461
  t[o].write(n, 0);
1462
- }, cn = (n, t, e) => {
1462
+ }, an = (n, t, e) => {
1463
1463
  const s = /* @__PURE__ */ new Map();
1464
1464
  e.forEach((r, i) => {
1465
1465
  L(t, i) > r && s.set(i, r);
@@ -1560,7 +1560,7 @@ const Ki = (n, t, e, s) => {
1560
1560
  };
1561
1561
  for (; ; ) {
1562
1562
  if (h.constructor !== T) {
1563
- const g = W(d, h.id.client, () => L(t, h.id.client)) - h.id.clock;
1563
+ const g = J(d, h.id.client, () => L(t, h.id.client)) - h.id.clock;
1564
1564
  if (g < 0)
1565
1565
  s.push(h), a(h.id.client, h.id.clock - 1), u();
1566
1566
  else {
@@ -1600,10 +1600,10 @@ const Ki = (n, t, e, s) => {
1600
1600
  }
1601
1601
  if (l.clients.size > 0) {
1602
1602
  const f = new at();
1603
- return cn(f, l, /* @__PURE__ */ new Map()), p(f.restEncoder, 0), { missing: c, update: f.toUint8Array() };
1603
+ return an(f, l, /* @__PURE__ */ new Map()), p(f.restEncoder, 0), { missing: c, update: f.toUint8Array() };
1604
1604
  }
1605
1605
  return null;
1606
- }, Xi = (n, t) => cn(n, t.doc.store, t.beforeState), Ji = (n, t, e, s = new Et(n)) => k(t, (r) => {
1606
+ }, Xi = (n, t) => an(n, t.doc.store, t.beforeState), Ji = (n, t, e, s = new Et(n)) => k(t, (r) => {
1607
1607
  r.local = !1;
1608
1608
  let i = !1;
1609
1609
  const o = r.doc, l = o.store, c = zi(s, o), a = Yi(r, l, c), h = l.pendingStructs;
@@ -1641,7 +1641,7 @@ const Ki = (n, t, e, s) => {
1641
1641
  const r = nt(t);
1642
1642
  Ji(r, n, e, new s(r));
1643
1643
  }, Es = (n, t, e) => Ds(n, t, e, ks), Wi = (n, t, e = /* @__PURE__ */ new Map()) => {
1644
- cn(n, t.store, e), At(n, $i(t.store));
1644
+ an(n, t.store, e), At(n, $i(t.store));
1645
1645
  }, Gi = (n, t = new Uint8Array([0]), e = new at()) => {
1646
1646
  const s = Cs(t);
1647
1647
  Wi(e, n, s);
@@ -1653,16 +1653,16 @@ const Ki = (n, t, e, s) => {
1653
1653
  return oe(r);
1654
1654
  }
1655
1655
  return r[0];
1656
- }, an = (n, t) => Gi(n, t, new Kt()), qi = (n) => {
1656
+ }, hn = (n, t) => Gi(n, t, new Kt()), Pi = (n) => {
1657
1657
  const t = /* @__PURE__ */ new Map(), e = m(n.restDecoder);
1658
1658
  for (let s = 0; s < e; s++) {
1659
1659
  const r = m(n.restDecoder), i = m(n.restDecoder);
1660
1660
  t.set(r, i);
1661
1661
  }
1662
1662
  return t;
1663
- }, Cs = (n) => qi(new bs(nt(n))), As = (n, t) => (p(n.restEncoder, t.size), tt(t.entries()).sort((e, s) => s[0] - e[0]).forEach(([e, s]) => {
1663
+ }, Cs = (n) => Pi(new bs(nt(n))), As = (n, t) => (p(n.restEncoder, t.size), tt(t.entries()).sort((e, s) => s[0] - e[0]).forEach(([e, s]) => {
1664
1664
  p(n.restEncoder, e), p(n.restEncoder, s);
1665
- }), n), Pi = (n, t) => As(n, me(t.store)), Zi = (n, t = new Ss()) => (n instanceof Map ? As(t, n) : Pi(t, n), t.toUint8Array()), Qi = (n) => Zi(n, new _s());
1665
+ }), n), qi = (n, t) => As(n, me(t.store)), Zi = (n, t = new Ss()) => (n instanceof Map ? As(t, n) : qi(t, n), t.toUint8Array()), Qi = (n) => Zi(n, new _s());
1666
1666
  class to {
1667
1667
  constructor() {
1668
1668
  this.l = [];
@@ -1671,7 +1671,7 @@ class to {
1671
1671
  const Vn = () => new to(), Hn = (n, t) => n.l.push(t), $n = (n, t) => {
1672
1672
  const e = n.l, s = e.length;
1673
1673
  n.l = e.filter((r) => t !== r), s === n.l.length && console.error("[yjs] Tried to remove event handler that doesn't exist.");
1674
- }, Ls = (n, t, e) => Pe(n.l, [t, e]);
1674
+ }, Ls = (n, t, e) => Ze(n.l, [t, e]);
1675
1675
  class yt {
1676
1676
  /**
1677
1677
  * @param {number} client client id
@@ -1681,13 +1681,13 @@ class yt {
1681
1681
  this.client = t, this.clock = e;
1682
1682
  }
1683
1683
  }
1684
- const qt = (n, t) => n === t || n !== null && t !== null && n.client === t.client && n.clock === t.clock, b = (n, t) => new yt(n, t), eo = (n) => {
1684
+ const Pt = (n, t) => n === t || n !== null && t !== null && n.client === t.client && n.clock === t.clock, b = (n, t) => new yt(n, t), eo = (n) => {
1685
1685
  for (const [t, e] of n.doc.share.entries())
1686
1686
  if (e === n)
1687
1687
  return t;
1688
1688
  throw V();
1689
- }, It = (n, t) => t === void 0 ? !n.deleted : t.sv.has(n.id.client) && (t.sv.get(n.id.client) || 0) > n.id.clock && !ms(t.ds, n.id), $e = (n, t) => {
1690
- const e = W(n.meta, $e, lt), s = n.doc.store;
1689
+ }, It = (n, t) => t === void 0 ? !n.deleted : t.sv.has(n.id.client) && (t.sv.get(n.id.client) || 0) > n.id.clock && !ms(t.ds, n.id), je = (n, t) => {
1690
+ const e = J(n.meta, je, lt), s = n.doc.store;
1691
1691
  e.has(t) || (t.sv.forEach((r, i) => {
1692
1692
  r < L(s, i) && et(n, b(i, r));
1693
1693
  }), ws(n, t.ds, (r) => {
@@ -1710,7 +1710,7 @@ const me = (n) => {
1710
1710
  return 0;
1711
1711
  const s = e[e.length - 1];
1712
1712
  return s.id.clock + s.length;
1713
- }, vs = (n, t) => {
1713
+ }, Ms = (n, t) => {
1714
1714
  let e = n.clients.get(t.id.client);
1715
1715
  if (e === void 0)
1716
1716
  e = [], n.clients.set(t.id.client, e);
@@ -1724,7 +1724,7 @@ const me = (n) => {
1724
1724
  let e = 0, s = n.length - 1, r = n[s], i = r.id.clock;
1725
1725
  if (i === t)
1726
1726
  return s;
1727
- let o = X(t / (i + r.length - 1) * s);
1727
+ let o = Y(t / (i + r.length - 1) * s);
1728
1728
  for (; e <= s; ) {
1729
1729
  if (r = n[o], i = r.id.clock, i <= t) {
1730
1730
  if (t < i + r.length)
@@ -1732,16 +1732,16 @@ const me = (n) => {
1732
1732
  e = o + 1;
1733
1733
  } else
1734
1734
  s = o - 1;
1735
- o = X((e + s) / 2);
1735
+ o = Y((e + s) / 2);
1736
1736
  }
1737
1737
  throw V();
1738
1738
  }, no = (n, t) => {
1739
1739
  const e = n.clients.get(t.client);
1740
1740
  return e[H(e, t.clock)];
1741
- }, Ie = (
1741
+ }, Me = (
1742
1742
  /** @type {function(StructStore,ID):Item} */
1743
1743
  no
1744
- ), je = (n, t, e) => {
1744
+ ), Ke = (n, t, e) => {
1745
1745
  const s = H(t, e), r = t[s];
1746
1746
  return r.id.clock < e && r instanceof E ? (t.splice(s + 1, 0, de(n, r, e - r.id.clock)), s + 1) : s;
1747
1747
  }, et = (n, t) => {
@@ -1749,7 +1749,7 @@ const me = (n) => {
1749
1749
  /** @type {Array<Item>} */
1750
1750
  n.doc.store.clients.get(t.client)
1751
1751
  );
1752
- return e[je(n, e, t.clock)];
1752
+ return e[Ke(n, e, t.clock)];
1753
1753
  }, jn = (n, t, e) => {
1754
1754
  const s = t.clients.get(e.client), r = H(s, e.clock), i = s[r];
1755
1755
  return e.clock !== i.id.clock + i.length - 1 && i.constructor !== U && s.splice(r + 1, 0, de(n, i, e.clock - i.id.clock + 1)), i;
@@ -1759,13 +1759,13 @@ const me = (n) => {
1759
1759
  n.clients.get(t.id.client)
1760
1760
  );
1761
1761
  s[H(s, t.id.clock)] = e;
1762
- }, Ms = (n, t, e, s, r) => {
1762
+ }, vs = (n, t, e, s, r) => {
1763
1763
  if (s === 0)
1764
1764
  return;
1765
1765
  const i = e + s;
1766
- let o = je(n, t, e), l;
1766
+ let o = Ke(n, t, e), l;
1767
1767
  do
1768
- l = t[o++], i < l.id.clock + l.length && je(n, t, i), r(l);
1768
+ l = t[o++], i < l.id.clock + l.length && Ke(n, t, i), r(l);
1769
1769
  while (o < t.length && t[o].id.clock < i);
1770
1770
  };
1771
1771
  class ro {
@@ -1778,9 +1778,9 @@ class ro {
1778
1778
  this.doc = t, this.deleteSet = new jt(), this.beforeState = me(t.store), this.afterState = /* @__PURE__ */ new Map(), this.changed = /* @__PURE__ */ new Map(), this.changedParentTypes = /* @__PURE__ */ new Map(), this._mergeStructs = [], this.origin = e, this.meta = /* @__PURE__ */ new Map(), this.local = s, this.subdocsAdded = /* @__PURE__ */ new Set(), this.subdocsRemoved = /* @__PURE__ */ new Set(), this.subdocsLoaded = /* @__PURE__ */ new Set(), this._needFormattingCleanup = !1;
1779
1779
  }
1780
1780
  }
1781
- const Kn = (n, t) => t.deleteSet.clients.size === 0 && !br(t.afterState, (e, s) => t.beforeState.get(s) !== e) ? !1 : (on(t.deleteSet), Xi(n, t), At(n, t.deleteSet), !0), zn = (n, t, e) => {
1781
+ const Kn = (n, t) => t.deleteSet.clients.size === 0 && !br(t.afterState, (e, s) => t.beforeState.get(s) !== e) ? !1 : (ln(t.deleteSet), Xi(n, t), At(n, t.deleteSet), !0), zn = (n, t, e) => {
1782
1782
  const s = t._item;
1783
- (s === null || s.id.clock < (n.beforeState.get(s.id.client) || 0) && !s.deleted) && W(n.changed, t, lt).add(e);
1783
+ (s === null || s.id.clock < (n.beforeState.get(s.id.client) || 0) && !s.deleted) && J(n.changed, t, lt).add(e);
1784
1784
  }, se = (n, t) => {
1785
1785
  let e = n[t], s = n[t - 1], r = t;
1786
1786
  for (; r > 0; e = s, s = n[--r - 1]) {
@@ -1820,7 +1820,7 @@ const Kn = (n, t) => t.deleteSet.clients.size === 0 && !br(t.afterState, (e, s)
1820
1820
  t.clients.get(s)
1821
1821
  );
1822
1822
  for (let i = e.length - 1; i >= 0; i--) {
1823
- const o = e[i], l = Ge(r.length - 1, 1 + H(r, o.clock + o.len - 1));
1823
+ const o = e[i], l = Pe(r.length - 1, 1 + H(r, o.clock + o.len - 1));
1824
1824
  for (let c = l, a = r[c]; c > 0 && a.id.clock >= o.clock; a = r[c])
1825
1825
  c -= 1 + se(r, c);
1826
1826
  }
@@ -1829,7 +1829,7 @@ const Kn = (n, t) => t.deleteSet.clients.size === 0 && !br(t.afterState, (e, s)
1829
1829
  if (t < n.length) {
1830
1830
  const e = n[t], s = e.doc, r = s.store, i = e.deleteSet, o = e._mergeStructs;
1831
1831
  try {
1832
- on(i), e.afterState = me(e.doc.store), s.emit("beforeObserverCalls", [e, s]);
1832
+ ln(i), e.afterState = me(e.doc.store), s.emit("beforeObserverCalls", [e, s]);
1833
1833
  const l = [];
1834
1834
  e.changed.forEach(
1835
1835
  (c, a) => l.push(() => {
@@ -1843,7 +1843,7 @@ const Kn = (n, t) => t.deleteSet.clients.size === 0 && !br(t.afterState, (e, s)
1843
1843
  h.currentTarget = a, h._path = null;
1844
1844
  }), c.sort((h, d) => h.path.length - d.path.length), Ls(a._dEH, c, e));
1845
1845
  });
1846
- }), l.push(() => s.emit("afterTransaction", [e, s])), Pe(l, []), e._needFormattingCleanup && Ao(e);
1846
+ }), l.push(() => s.emit("afterTransaction", [e, s])), Ze(l, []), e._needFormattingCleanup && Ao(e);
1847
1847
  } finally {
1848
1848
  s.gc && io(i, r, s.gcFilter), oo(i, r), e.afterState.forEach((h, d) => {
1849
1849
  const u = e.beforeState.get(d) || 0;
@@ -1928,7 +1928,7 @@ function* lo(n) {
1928
1928
  }
1929
1929
  }
1930
1930
  }
1931
- class hn {
1931
+ class un {
1932
1932
  /**
1933
1933
  * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder
1934
1934
  * @param {boolean} filterSkips
@@ -1946,7 +1946,7 @@ class hn {
1946
1946
  return this.curr;
1947
1947
  }
1948
1948
  }
1949
- class un {
1949
+ class dn {
1950
1950
  /**
1951
1951
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
1952
1952
  */
@@ -1981,8 +1981,8 @@ const co = (n) => oe(n, ks, Kt), ao = (n, t) => {
1981
1981
  if (n.length === 1)
1982
1982
  return n[0];
1983
1983
  const s = n.map((h) => new t(nt(h)));
1984
- let r = s.map((h) => new hn(h, !0)), i = null;
1985
- const o = new e(), l = new un(o);
1984
+ let r = s.map((h) => new un(h, !0)), i = null;
1985
+ const o = new e(), l = new dn(o);
1986
1986
  for (; r = r.filter((u) => u.curr !== null), r.sort(
1987
1987
  /** @type {function(any,any):number} */
1988
1988
  (u, f) => {
@@ -2033,11 +2033,11 @@ const co = (n) => oe(n, ks, Kt), ao = (n, t) => {
2033
2033
  for (let u = h.curr; u !== null && u.id.client === d && u.id.clock === i.struct.id.clock + i.struct.length && u.constructor !== T; u = h.next())
2034
2034
  P(l, i.struct, i.offset), i = { struct: u, offset: 0 };
2035
2035
  }
2036
- i !== null && (P(l, i.struct, i.offset), i = null), dn(l);
2037
- const c = s.map((h) => ln(h)), a = Vi(c);
2036
+ i !== null && (P(l, i.struct, i.offset), i = null), fn(l);
2037
+ const c = s.map((h) => cn(h)), a = Vi(c);
2038
2038
  return At(o, a), o.toUint8Array();
2039
2039
  }, ho = (n, t, e = Et, s = at) => {
2040
- const r = Cs(t), i = new s(), o = new un(i), l = new e(nt(n)), c = new hn(l, !1);
2040
+ const r = Cs(t), i = new s(), o = new dn(i), l = new e(nt(n)), c = new un(l, !1);
2041
2041
  for (; c.curr; ) {
2042
2042
  const h = c.curr, d = h.id.client, u = r.get(d) || 0;
2043
2043
  if (c.curr.constructor === T) {
@@ -2051,14 +2051,14 @@ const co = (n) => oe(n, ks, Kt), ao = (n, t) => {
2051
2051
  for (; c.curr && c.curr.id.client === d && c.curr.id.clock + c.curr.length <= u; )
2052
2052
  c.next();
2053
2053
  }
2054
- dn(o);
2055
- const a = ln(l);
2054
+ fn(o);
2055
+ const a = cn(l);
2056
2056
  return At(i, a), i.toUint8Array();
2057
2057
  }, Us = (n) => {
2058
- n.written > 0 && (n.clientStructs.push({ written: n.written, restEncoder: _(n.encoder.restEncoder) }), n.encoder.restEncoder = M(), n.written = 0);
2058
+ n.written > 0 && (n.clientStructs.push({ written: n.written, restEncoder: _(n.encoder.restEncoder) }), n.encoder.restEncoder = v(), n.written = 0);
2059
2059
  }, P = (n, t, e) => {
2060
2060
  n.written > 0 && n.currClient !== t.id.client && Us(n), n.written === 0 && (n.currClient = t.id.client, n.encoder.writeClient(t.id.client), p(n.encoder.restEncoder, t.id.clock + e)), t.write(n.encoder, e), n.written++;
2061
- }, dn = (n) => {
2061
+ }, fn = (n) => {
2062
2062
  Us(n);
2063
2063
  const t = n.encoder.restEncoder;
2064
2064
  p(t, n.clientStructs.length);
@@ -2067,11 +2067,11 @@ const co = (n) => oe(n, ks, Kt), ao = (n, t) => {
2067
2067
  p(t, s.written), we(t, s.restEncoder);
2068
2068
  }
2069
2069
  }, uo = (n, t, e, s) => {
2070
- const r = new e(nt(n)), i = new hn(r, !1), o = new s(), l = new un(o);
2070
+ const r = new e(nt(n)), i = new un(r, !1), o = new s(), l = new dn(o);
2071
2071
  for (let a = i.curr; a !== null; a = i.next())
2072
2072
  P(l, t(a), 0);
2073
- dn(l);
2074
- const c = ln(r);
2073
+ fn(l);
2074
+ const c = cn(r);
2075
2075
  return At(o, c), o.toUint8Array();
2076
2076
  }, fo = (n) => uo(n, $r, Et, Kt), Yn = "You must not compute changes after the event-handler fired.";
2077
2077
  class ye {
@@ -2115,7 +2115,7 @@ class ye {
2115
2115
  get keys() {
2116
2116
  if (this._keys === null) {
2117
2117
  if (this.transaction.doc._transactionCleanups.length === 0)
2118
- throw J(Yn);
2118
+ throw X(Yn);
2119
2119
  const t = /* @__PURE__ */ new Map(), e = this.target;
2120
2120
  /** @type Set<string|null> */
2121
2121
  this.transaction.changed.get(e).forEach((r) => {
@@ -2131,13 +2131,13 @@ class ye {
2131
2131
  c = c.left;
2132
2132
  if (this.deletes(i))
2133
2133
  if (c !== null && this.deletes(c))
2134
- o = "delete", l = Se(c.content.getContent());
2134
+ o = "delete", l = De(c.content.getContent());
2135
2135
  else
2136
2136
  return;
2137
2137
  else
2138
- c !== null && this.deletes(c) ? (o = "update", l = Se(c.content.getContent())) : (o = "add", l = void 0);
2138
+ c !== null && this.deletes(c) ? (o = "update", l = De(c.content.getContent())) : (o = "add", l = void 0);
2139
2139
  } else if (this.deletes(i))
2140
- o = "delete", l = Se(
2140
+ o = "delete", l = De(
2141
2141
  /** @type {Item} */
2142
2142
  i.content.getContent()
2143
2143
  );
@@ -2183,7 +2183,7 @@ class ye {
2183
2183
  let t = this._changes;
2184
2184
  if (t === null) {
2185
2185
  if (this.transaction.doc._transactionCleanups.length === 0)
2186
- throw J(Yn);
2186
+ throw X(Yn);
2187
2187
  const e = this.target, s = lt(), r = lt(), i = [];
2188
2188
  if (t = {
2189
2189
  added: s,
@@ -2227,20 +2227,20 @@ const go = (n, t) => {
2227
2227
  }
2228
2228
  return e;
2229
2229
  }, Ts = 80;
2230
- let fn = 0;
2230
+ let gn = 0;
2231
2231
  class po {
2232
2232
  /**
2233
2233
  * @param {Item} p
2234
2234
  * @param {number} index
2235
2235
  */
2236
2236
  constructor(t, e) {
2237
- t.marker = !0, this.p = t, this.index = e, this.timestamp = fn++;
2237
+ t.marker = !0, this.p = t, this.index = e, this.timestamp = gn++;
2238
2238
  }
2239
2239
  }
2240
2240
  const wo = (n) => {
2241
- n.timestamp = fn++;
2241
+ n.timestamp = gn++;
2242
2242
  }, Os = (n, t, e) => {
2243
- n.p.marker = !1, n.p = t, t.marker = !0, n.index = e, n.timestamp = fn++;
2243
+ n.p.marker = !1, n.p = t, t.marker = !0, n.index = e, n.timestamp = gn++;
2244
2244
  }, mo = (n, t, e) => {
2245
2245
  if (n.length >= Ts) {
2246
2246
  const s = n.reduce((r, i) => r.timestamp < i.timestamp ? r : i);
@@ -2285,7 +2285,7 @@ const wo = (n) => {
2285
2285
  }
2286
2286
  }, ke = (n, t, e) => {
2287
2287
  const s = n, r = t.changedParentTypes;
2288
- for (; W(r, n, () => []).push(e), n._item !== null; )
2288
+ for (; J(r, n, () => []).push(e), n._item !== null; )
2289
2289
  n = /** @type {AbstractType<any>} */
2290
2290
  n._item.parent;
2291
2291
  Ls(s._eH, e, t);
@@ -2506,13 +2506,13 @@ const Rs = (n, t, e) => {
2506
2506
  break;
2507
2507
  default:
2508
2508
  if (d instanceof I)
2509
- r = new E(b(o, L(l, o)), r, r && r.lastId, c, c && c.id, t, null, new q(d)), r.integrate(n, 0);
2509
+ r = new E(b(o, L(l, o)), r, r && r.lastId, c, c && c.id, t, null, new G(d)), r.integrate(n, 0);
2510
2510
  else
2511
2511
  throw new Error("Unexpected content type in insert operation");
2512
2512
  }
2513
2513
  }
2514
2514
  }), h();
2515
- }, Vs = () => J("Length exceeded!"), Hs = (n, t, e, s) => {
2515
+ }, Vs = () => X("Length exceeded!"), Hs = (n, t, e, s) => {
2516
2516
  if (e > t._length)
2517
2517
  throw Vs();
2518
2518
  if (e === 0)
@@ -2554,7 +2554,7 @@ const Rs = (n, t, e) => {
2554
2554
  }, ce = (n, t, e) => {
2555
2555
  const s = t._map.get(e);
2556
2556
  s !== void 0 && s.delete(n);
2557
- }, gn = (n, t, e, s) => {
2557
+ }, pn = (n, t, e, s) => {
2558
2558
  const r = t._map.get(e) || null, i = n.doc, o = i.clientID;
2559
2559
  let l;
2560
2560
  if (s == null)
@@ -2582,12 +2582,12 @@ const Rs = (n, t, e) => {
2582
2582
  break;
2583
2583
  default:
2584
2584
  if (s instanceof I)
2585
- l = new q(s);
2585
+ l = new G(s);
2586
2586
  else
2587
2587
  throw new Error("Unexpected content type");
2588
2588
  }
2589
2589
  new E(b(o, L(i.store, o)), r, r && r.lastId, null, null, t, e, l).integrate(n, 0);
2590
- }, pn = (n, t) => {
2590
+ }, wn = (n, t) => {
2591
2591
  const e = n._map.get(t);
2592
2592
  return e !== void 0 && !e.deleted ? e.content.getContent()[e.length - 1] : void 0;
2593
2593
  }, js = (n) => {
@@ -2598,7 +2598,7 @@ const Rs = (n, t, e) => {
2598
2598
  }, Ks = (n, t) => {
2599
2599
  const e = n._map.get(t);
2600
2600
  return e !== void 0 && !e.deleted;
2601
- }, Pt = (n) => Ni(
2601
+ }, qt = (n) => Ni(
2602
2602
  n.entries(),
2603
2603
  /** @param {any} entry */
2604
2604
  (t) => !t[1].deleted
@@ -2889,7 +2889,7 @@ class ht extends I {
2889
2889
  * @return {number}
2890
2890
  */
2891
2891
  get size() {
2892
- return [...Pt(this._map)].length;
2892
+ return [...qt(this._map)].length;
2893
2893
  }
2894
2894
  /**
2895
2895
  * Returns the keys for each element in the YMap Type.
@@ -2897,8 +2897,8 @@ class ht extends I {
2897
2897
  * @return {IterableIterator<string>}
2898
2898
  */
2899
2899
  keys() {
2900
- return Le(
2901
- Pt(this._map),
2900
+ return Ie(
2901
+ qt(this._map),
2902
2902
  /** @param {any} v */
2903
2903
  (t) => t[0]
2904
2904
  );
@@ -2909,8 +2909,8 @@ class ht extends I {
2909
2909
  * @return {IterableIterator<any>}
2910
2910
  */
2911
2911
  values() {
2912
- return Le(
2913
- Pt(this._map),
2912
+ return Ie(
2913
+ qt(this._map),
2914
2914
  /** @param {any} v */
2915
2915
  (t) => t[1].content.getContent()[t[1].length - 1]
2916
2916
  );
@@ -2921,8 +2921,8 @@ class ht extends I {
2921
2921
  * @return {IterableIterator<any>}
2922
2922
  */
2923
2923
  entries() {
2924
- return Le(
2925
- Pt(this._map),
2924
+ return Ie(
2925
+ qt(this._map),
2926
2926
  /** @param {any} v */
2927
2927
  (t) => [t[0], t[1].content.getContent()[t[1].length - 1]]
2928
2928
  );
@@ -2965,7 +2965,7 @@ class ht extends I {
2965
2965
  */
2966
2966
  set(t, e) {
2967
2967
  return this.doc !== null ? k(this.doc, (s) => {
2968
- gn(
2968
+ pn(
2969
2969
  s,
2970
2970
  this,
2971
2971
  t,
@@ -2983,7 +2983,7 @@ class ht extends I {
2983
2983
  get(t) {
2984
2984
  return (
2985
2985
  /** @type {any} */
2986
- pn(this, t)
2986
+ wn(this, t)
2987
2987
  );
2988
2988
  }
2989
2989
  /**
@@ -3012,8 +3012,8 @@ class ht extends I {
3012
3012
  t.writeTypeRef(Yo);
3013
3013
  }
3014
3014
  }
3015
- const Do = (n) => new ht(), Z = (n, t) => n === t || typeof n == "object" && typeof t == "object" && n && t && Hr(n, t);
3016
- class Ke {
3015
+ const Do = (n) => new ht(), q = (n, t) => n === t || typeof n == "object" && typeof t == "object" && n && t && Hr(n, t);
3016
+ class ze {
3017
3017
  /**
3018
3018
  * @param {Item|null} left
3019
3019
  * @param {Item|null} right
@@ -3062,14 +3062,14 @@ const Xn = (n, t, e) => {
3062
3062
  }, Zt = (n, t, e) => {
3063
3063
  const s = /* @__PURE__ */ new Map(), r = be(t, e);
3064
3064
  if (r) {
3065
- const i = new Ke(r.p.left, r.p, r.index, s);
3065
+ const i = new ze(r.p.left, r.p, r.index, s);
3066
3066
  return Xn(n, i, e - r.index);
3067
3067
  } else {
3068
- const i = new Ke(null, t._start, 0, s);
3068
+ const i = new ze(null, t._start, 0, s);
3069
3069
  return Xn(n, i, e);
3070
3070
  }
3071
3071
  }, zs = (n, t, e, s) => {
3072
- for (; e.right !== null && (e.right.deleted === !0 || e.right.content.constructor === C && Z(
3072
+ for (; e.right !== null && (e.right.deleted === !0 || e.right.content.constructor === C && q(
3073
3073
  s.get(
3074
3074
  /** @type {ContentFormat} */
3075
3075
  e.right.content.key
@@ -3091,7 +3091,7 @@ const Xn = (n, t, e) => {
3091
3091
  s === null ? n.delete(e) : n.set(e, s);
3092
3092
  }, Ys = (n, t) => {
3093
3093
  for (; n.right !== null; ) {
3094
- if (!(n.right.deleted || n.right.content.constructor === C && Z(
3094
+ if (!(n.right.deleted || n.right.content.constructor === C && q(
3095
3095
  t[
3096
3096
  /** @type {ContentFormat} */
3097
3097
  n.right.content.key
@@ -3106,7 +3106,7 @@ const Xn = (n, t, e) => {
3106
3106
  const r = n.doc, i = r.clientID, o = /* @__PURE__ */ new Map();
3107
3107
  for (const l in s) {
3108
3108
  const c = s[l], a = e.currentAttributes.get(l) || null;
3109
- if (!Z(a, c)) {
3109
+ if (!q(a, c)) {
3110
3110
  o.set(l, a);
3111
3111
  const { left: h, right: d } = e;
3112
3112
  e.right = new E(b(i, L(r.store, i)), h, h && h.lastId, d, d && d.id, t, null, new C(l, c)), e.right.integrate(n, 0), e.forward();
@@ -3122,7 +3122,7 @@ const Xn = (n, t, e) => {
3122
3122
  const l = Xs(n, t, e, r), c = s.constructor === String ? new $(
3123
3123
  /** @type {string} */
3124
3124
  s
3125
- ) : s instanceof I ? new q(s) : new pt(s);
3125
+ ) : s instanceof I ? new G(s) : new pt(s);
3126
3126
  let { left: a, right: h, index: d } = e;
3127
3127
  t._searchMarker && Nt(t._searchMarker, e.index, c.getLength()), h = new E(b(o, L(i.store, o)), a, a && a.lastId, h, h && h.id, t, null, c), h.integrate(n, 0), e.right = h, e.index = d, e.forward(), zs(n, t, e, l);
3128
3128
  }, Jn = (n, t, e, s, r) => {
@@ -3139,7 +3139,7 @@ const Xn = (n, t, e) => {
3139
3139
  e.right.content
3140
3140
  ), h = r[c];
3141
3141
  if (h !== void 0) {
3142
- if (Z(h, a))
3142
+ if (q(h, a))
3143
3143
  l.delete(c);
3144
3144
  else {
3145
3145
  if (s === 0)
@@ -3225,7 +3225,7 @@ const Xn = (n, t, e) => {
3225
3225
  /** @type {Item} */
3226
3226
  n._start
3227
3227
  ), r = n._start, i = O();
3228
- const o = Re(i);
3228
+ const o = Be(i);
3229
3229
  for (; r; ) {
3230
3230
  if (r.deleted === !1)
3231
3231
  switch (r.content.constructor) {
@@ -3237,7 +3237,7 @@ const Xn = (n, t, e) => {
3237
3237
  );
3238
3238
  break;
3239
3239
  default:
3240
- t += Js(e, s, r, i, o), i = Re(o), s = r;
3240
+ t += Js(e, s, r, i, o), i = Be(o), s = r;
3241
3241
  break;
3242
3242
  }
3243
3243
  r = r.right;
@@ -3248,7 +3248,7 @@ const Xn = (n, t, e) => {
3248
3248
  const t = /* @__PURE__ */ new Set(), e = n.doc;
3249
3249
  for (const [s, r] of n.afterState.entries()) {
3250
3250
  const i = n.beforeState.get(s) || 0;
3251
- r !== i && Ms(
3251
+ r !== i && vs(
3252
3252
  n,
3253
3253
  /** @type {Array<Item|GC>} */
3254
3254
  e.store.clients.get(s),
@@ -3281,11 +3281,11 @@ const Xn = (n, t, e) => {
3281
3281
  Co(r);
3282
3282
  });
3283
3283
  }, Wn = (n, t, e) => {
3284
- const s = e, r = Re(t.currentAttributes), i = t.right;
3284
+ const s = e, r = Be(t.currentAttributes), i = t.right;
3285
3285
  for (; e > 0 && t.right !== null; ) {
3286
3286
  if (t.right.deleted === !1)
3287
3287
  switch (t.right.content.constructor) {
3288
- case q:
3288
+ case G:
3289
3289
  case pt:
3290
3290
  case $:
3291
3291
  e < t.right.length && et(n, b(t.right.id.client, t.right.id.clock + e)), e -= t.right.length, t.right.delete(n);
@@ -3370,7 +3370,7 @@ class Lo extends ye {
3370
3370
  };
3371
3371
  for (; o !== null; ) {
3372
3372
  switch (o.content.constructor) {
3373
- case q:
3373
+ case G:
3374
3374
  case pt:
3375
3375
  this.adds(o) ? this.deletes(o) || (u(), l = "insert", a = o.content.getContent()[0], u()) : this.deletes(o) ? (l !== "delete" && (u(), l = "delete"), d += 1) : o.deleted || (l !== "retain" && (u(), l = "retain"), h += 1);
3376
3376
  break;
@@ -3386,16 +3386,16 @@ class Lo extends ye {
3386
3386
  if (this.adds(o)) {
3387
3387
  if (!this.deletes(o)) {
3388
3388
  const w = r.get(f) || null;
3389
- Z(w, g) ? g !== null && o.delete(s) : (l === "retain" && u(), Z(g, i.get(f) || null) ? delete c[f] : c[f] = g);
3389
+ q(w, g) ? g !== null && o.delete(s) : (l === "retain" && u(), q(g, i.get(f) || null) ? delete c[f] : c[f] = g);
3390
3390
  }
3391
3391
  } else if (this.deletes(o)) {
3392
3392
  i.set(f, g);
3393
3393
  const w = r.get(f) || null;
3394
- Z(w, g) || (l === "retain" && u(), c[f] = w);
3394
+ q(w, g) || (l === "retain" && u(), c[f] = w);
3395
3395
  } else if (!o.deleted) {
3396
3396
  i.set(f, g);
3397
3397
  const w = c[f];
3398
- w !== void 0 && (Z(w, g) ? w !== null && o.delete(s) : (l === "retain" && u(), g === null ? delete c[f] : c[f] = g));
3398
+ w !== void 0 && (q(w, g) ? w !== null && o.delete(s) : (l === "retain" && u(), g === null ? delete c[f] : c[f] = g));
3399
3399
  }
3400
3400
  o.deleted || (l === "insert" && u(), Lt(
3401
3401
  r,
@@ -3504,7 +3504,7 @@ class Ct extends I {
3504
3504
  */
3505
3505
  applyDelta(t, { sanitize: e = !0 } = {}) {
3506
3506
  this.doc !== null ? k(this.doc, (s) => {
3507
- const r = new Ke(null, this._start, 0, /* @__PURE__ */ new Map());
3507
+ const r = new ze(null, this._start, 0, /* @__PURE__ */ new Map());
3508
3508
  for (let i = 0; i < t.length; i++) {
3509
3509
  const o = t[i];
3510
3510
  if (o.insert !== void 0) {
@@ -3553,7 +3553,7 @@ class Ct extends I {
3553
3553
  c.content.str;
3554
3554
  break;
3555
3555
  }
3556
- case q:
3556
+ case G:
3557
3557
  case pt: {
3558
3558
  a();
3559
3559
  const d = {
@@ -3584,7 +3584,7 @@ class Ct extends I {
3584
3584
  a();
3585
3585
  };
3586
3586
  return t || e ? k(o, (d) => {
3587
- t && $e(d, t), e && $e(d, e), h();
3587
+ t && je(d, t), e && je(d, e), h();
3588
3588
  }, "cleanup") : h(), r;
3589
3589
  }
3590
3590
  /**
@@ -3686,7 +3686,7 @@ class Ct extends I {
3686
3686
  */
3687
3687
  setAttribute(t, e) {
3688
3688
  this.doc !== null ? k(this.doc, (s) => {
3689
- gn(s, this, t, e);
3689
+ pn(s, this, t, e);
3690
3690
  }) : this._pending.push(() => this.setAttribute(t, e));
3691
3691
  }
3692
3692
  /**
@@ -3703,7 +3703,7 @@ class Ct extends I {
3703
3703
  getAttribute(t) {
3704
3704
  return (
3705
3705
  /** @type {any} */
3706
- pn(this, t)
3706
+ wn(this, t)
3707
3707
  );
3708
3708
  }
3709
3709
  /**
@@ -3726,7 +3726,7 @@ class Ct extends I {
3726
3726
  }
3727
3727
  }
3728
3728
  const Io = (n) => new Ct();
3729
- class Me {
3729
+ class xe {
3730
3730
  /**
3731
3731
  * @param {YXmlFragment | YXmlElement} root
3732
3732
  * @param {function(AbstractType<any>):boolean} [f]
@@ -3830,7 +3830,7 @@ class ut extends I {
3830
3830
  * @public
3831
3831
  */
3832
3832
  createTreeWalker(t) {
3833
- return new Me(this, t);
3833
+ return new xe(this, t);
3834
3834
  }
3835
3835
  /**
3836
3836
  * Returns the first YXmlElement that matches the query.
@@ -3849,7 +3849,7 @@ class ut extends I {
3849
3849
  */
3850
3850
  querySelector(t) {
3851
3851
  t = t.toUpperCase();
3852
- const s = new Me(this, (r) => r.nodeName && r.nodeName.toUpperCase() === t).next();
3852
+ const s = new xe(this, (r) => r.nodeName && r.nodeName.toUpperCase() === t).next();
3853
3853
  return s.done ? null : s.value;
3854
3854
  }
3855
3855
  /**
@@ -3864,7 +3864,7 @@ class ut extends I {
3864
3864
  * @public
3865
3865
  */
3866
3866
  querySelectorAll(t) {
3867
- return t = t.toUpperCase(), tt(new Me(this, (e) => e.nodeName && e.nodeName.toUpperCase() === t));
3867
+ return t = t.toUpperCase(), tt(new xe(this, (e) => e.nodeName && e.nodeName.toUpperCase() === t));
3868
3868
  }
3869
3869
  /**
3870
3870
  * Creates YXmlEvent and calls observers.
@@ -3947,7 +3947,7 @@ class ut extends I {
3947
3947
  this._prelimContent
3948
3948
  ), r = t === null ? 0 : s.findIndex((i) => i === t) + 1;
3949
3949
  if (r === 0 && t !== null)
3950
- throw J("Reference item not found");
3950
+ throw X("Reference item not found");
3951
3951
  s.splice(r, 0, ...e);
3952
3952
  }
3953
3953
  }
@@ -4025,7 +4025,7 @@ class ut extends I {
4025
4025
  t.writeTypeRef(Wo);
4026
4026
  }
4027
4027
  }
4028
- const vo = (n) => new ut();
4028
+ const Mo = (n) => new ut();
4029
4029
  class Vt extends ut {
4030
4030
  constructor(t = "UNDEFINED") {
4031
4031
  super(), this.nodeName = t, this._prelimAttrs = /* @__PURE__ */ new Map();
@@ -4131,7 +4131,7 @@ class Vt extends ut {
4131
4131
  */
4132
4132
  setAttribute(t, e) {
4133
4133
  this.doc !== null ? k(this.doc, (s) => {
4134
- gn(s, this, t, e);
4134
+ pn(s, this, t, e);
4135
4135
  }) : this._prelimAttrs.set(t, e);
4136
4136
  }
4137
4137
  /**
@@ -4148,7 +4148,7 @@ class Vt extends ut {
4148
4148
  getAttribute(t) {
4149
4149
  return (
4150
4150
  /** @type {any} */
4151
- pn(this, t)
4151
+ wn(this, t)
4152
4152
  );
4153
4153
  }
4154
4154
  /**
@@ -4215,7 +4215,7 @@ class Vt extends ut {
4215
4215
  t.writeTypeRef(Jo), t.writeKey(this.nodeName);
4216
4216
  }
4217
4217
  }
4218
- const Mo = (n) => new Vt(n.readKey());
4218
+ const vo = (n) => new Vt(n.readKey());
4219
4219
  class xo extends ye {
4220
4220
  /**
4221
4221
  * @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created.
@@ -4373,11 +4373,11 @@ class he extends Ct {
4373
4373
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
4374
4374
  */
4375
4375
  _write(t) {
4376
- t.writeTypeRef(qo);
4376
+ t.writeTypeRef(Po);
4377
4377
  }
4378
4378
  }
4379
4379
  const To = (n) => new he();
4380
- class wn {
4380
+ class mn {
4381
4381
  /**
4382
4382
  * @param {ID} id
4383
4383
  * @param {number} length
@@ -4418,7 +4418,7 @@ class wn {
4418
4418
  }
4419
4419
  }
4420
4420
  const Oo = 0;
4421
- class U extends wn {
4421
+ class U extends mn {
4422
4422
  get deleted() {
4423
4423
  return !0;
4424
4424
  }
@@ -4436,7 +4436,7 @@ class U extends wn {
4436
4436
  * @param {number} offset
4437
4437
  */
4438
4438
  integrate(t, e) {
4439
- e > 0 && (this.id.clock += e, this.length -= e), vs(t.doc.store, this);
4439
+ e > 0 && (this.id.clock += e, this.length -= e), Ms(t.doc.store, this);
4440
4440
  }
4441
4441
  /**
4442
4442
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
@@ -5104,12 +5104,12 @@ const jo = (n) => new $(n.readString()), Ko = [
5104
5104
  _o,
5105
5105
  Do,
5106
5106
  Io,
5107
- Mo,
5108
5107
  vo,
5108
+ Mo,
5109
5109
  Uo,
5110
5110
  To
5111
- ], zo = 0, Yo = 1, Xo = 2, Jo = 3, Wo = 4, Go = 5, qo = 6;
5112
- class q {
5111
+ ], zo = 0, Yo = 1, Xo = 2, Jo = 3, Wo = 4, Go = 5, Po = 6;
5112
+ class G {
5113
5113
  /**
5114
5114
  * @param {AbstractType<any>} type
5115
5115
  */
@@ -5138,7 +5138,7 @@ class q {
5138
5138
  * @return {ContentType}
5139
5139
  */
5140
5140
  copy() {
5141
- return new q(this.type._copy());
5141
+ return new G(this.type._copy());
5142
5142
  }
5143
5143
  /**
5144
5144
  * @param {number} offset
@@ -5201,7 +5201,7 @@ class q {
5201
5201
  return 7;
5202
5202
  }
5203
5203
  }
5204
- const Po = (n) => new q(Ko[n.readTypeRef()](n)), de = (n, t, e) => {
5204
+ const qo = (n) => new G(Ko[n.readTypeRef()](n)), de = (n, t, e) => {
5205
5205
  const { client: s, clock: r } = t.id, i = new E(
5206
5206
  b(s, r + e),
5207
5207
  t,
@@ -5214,7 +5214,7 @@ const Po = (n) => new q(Ko[n.readTypeRef()](n)), de = (n, t, e) => {
5214
5214
  );
5215
5215
  return t.deleted && i.markDeleted(), t.keep && (i.keep = !0), t.redone !== null && (i.redone = b(t.redone.client, t.redone.clock + e)), t.right = i, i.right !== null && (i.right.left = i), n._mergeStructs.push(i), i.parentSub !== null && i.right === null && i.parent._map.set(i.parentSub, i), t.length = e, i;
5216
5216
  };
5217
- class E extends wn {
5217
+ class E extends mn {
5218
5218
  /**
5219
5219
  * @param {ID} id
5220
5220
  * @param {Item | null} left
@@ -5234,10 +5234,10 @@ class E extends wn {
5234
5234
  * @type {boolean}
5235
5235
  */
5236
5236
  set marker(t) {
5237
- (this.info & Ee) > 0 !== t && (this.info ^= Ee);
5237
+ (this.info & Ce) > 0 !== t && (this.info ^= Ce);
5238
5238
  }
5239
5239
  get marker() {
5240
- return (this.info & Ee) > 0;
5240
+ return (this.info & Ce) > 0;
5241
5241
  }
5242
5242
  /**
5243
5243
  * If true, do not garbage collect this Item.
@@ -5256,13 +5256,13 @@ class E extends wn {
5256
5256
  * @type {Boolean}
5257
5257
  */
5258
5258
  get deleted() {
5259
- return (this.info & De) > 0;
5259
+ return (this.info & Ee) > 0;
5260
5260
  }
5261
5261
  set deleted(t) {
5262
- this.deleted !== t && (this.info ^= De);
5262
+ this.deleted !== t && (this.info ^= Ee);
5263
5263
  }
5264
5264
  markDeleted() {
5265
- this.info |= De;
5265
+ this.info |= Ee;
5266
5266
  }
5267
5267
  /**
5268
5268
  * Return the creator clientID of the missing op or define missing items and return null.
@@ -5283,7 +5283,7 @@ class E extends wn {
5283
5283
  else if (!this.parent)
5284
5284
  this.left && this.left.constructor === E && (this.parent = this.left.parent, this.parentSub = this.left.parentSub), this.right && this.right.constructor === E && (this.parent = this.right.parent, this.parentSub = this.right.parentSub);
5285
5285
  else if (this.parent.constructor === yt) {
5286
- const s = Ie(e, this.parent);
5286
+ const s = Me(e, this.parent);
5287
5287
  s.constructor === U ? this.parent = null : this.parent = /** @type {ContentType} */
5288
5288
  s.content.type;
5289
5289
  }
@@ -5308,13 +5308,13 @@ class E extends wn {
5308
5308
  this.parent._start;
5309
5309
  const i = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
5310
5310
  for (; r !== null && r !== this.right; ) {
5311
- if (o.add(r), i.add(r), qt(this.origin, r.origin)) {
5311
+ if (o.add(r), i.add(r), Pt(this.origin, r.origin)) {
5312
5312
  if (r.id.client < this.id.client)
5313
5313
  s = r, i.clear();
5314
- else if (qt(this.rightOrigin, r.rightOrigin))
5314
+ else if (Pt(this.rightOrigin, r.rightOrigin))
5315
5315
  break;
5316
- } else if (r.origin !== null && o.has(Ie(t.doc.store, r.origin)))
5317
- i.has(Ie(t.doc.store, r.origin)) || (s = r, i.clear());
5316
+ } else if (r.origin !== null && o.has(Me(t.doc.store, r.origin)))
5317
+ i.has(Me(t.doc.store, r.origin)) || (s = r, i.clear());
5318
5318
  else
5319
5319
  break;
5320
5320
  r = r.right;
@@ -5335,7 +5335,7 @@ class E extends wn {
5335
5335
  this.parent._start, this.parent._start = this;
5336
5336
  this.right = s;
5337
5337
  }
5338
- this.right !== null ? this.right.left = this : this.parentSub !== null && (this.parent._map.set(this.parentSub, this), this.left !== null && this.left.delete(t)), this.parentSub === null && this.countable && !this.deleted && (this.parent._length += this.length), vs(t.doc.store, this), this.content.integrate(t, this), zn(
5338
+ this.right !== null ? this.right.left = this : this.parentSub !== null && (this.parent._map.set(this.parentSub, this), this.left !== null && this.left.delete(t)), this.parentSub === null && this.countable && !this.deleted && (this.parent._length += this.length), Ms(t.doc.store, this), this.content.integrate(t, this), zn(
5339
5339
  t,
5340
5340
  /** @type {AbstractType<any>} */
5341
5341
  this.parent,
@@ -5377,7 +5377,7 @@ class E extends wn {
5377
5377
  * @return {boolean}
5378
5378
  */
5379
5379
  mergeWith(t) {
5380
- if (this.constructor === t.constructor && qt(t.origin, this.lastId) && this.right === t && qt(this.rightOrigin, t.rightOrigin) && this.id.client === t.id.client && this.id.clock + this.length === t.id.clock && this.deleted === t.deleted && this.redone === null && t.redone === null && this.content.constructor === t.content.constructor && this.content.mergeWith(t.content)) {
5380
+ if (this.constructor === t.constructor && Pt(t.origin, this.lastId) && this.right === t && Pt(this.rightOrigin, t.rightOrigin) && this.id.client === t.id.client && this.id.clock + this.length === t.id.clock && this.deleted === t.deleted && this.redone === null && t.redone === null && this.content.constructor === t.content.constructor && this.content.mergeWith(t.content)) {
5381
5381
  const e = (
5382
5382
  /** @type {AbstractType<any>} */
5383
5383
  this.parent._searchMarker
@@ -5460,7 +5460,7 @@ const Gs = (n, t) => Zo[t & ge](n), Zo = [
5460
5460
  // 5
5461
5461
  Vo,
5462
5462
  // 6
5463
- Po,
5463
+ qo,
5464
5464
  // 7
5465
5465
  $o,
5466
5466
  // 8
@@ -5471,7 +5471,7 @@ const Gs = (n, t) => Zo[t & ge](n), Zo = [
5471
5471
  }
5472
5472
  // 10 - Skip is not ItemContent
5473
5473
  ], Qo = 10;
5474
- class T extends wn {
5474
+ class T extends mn {
5475
5475
  get deleted() {
5476
5476
  return !0;
5477
5477
  }
@@ -5507,12 +5507,12 @@ class T extends wn {
5507
5507
  return null;
5508
5508
  }
5509
5509
  }
5510
- const qs = (
5510
+ const Ps = (
5511
5511
  /** @type {any} */
5512
5512
  typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : {}
5513
- ), Ps = "__ $YJS$ __";
5514
- qs[Ps] === !0 && console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");
5515
- qs[Ps] = !0;
5513
+ ), qs = "__ $YJS$ __";
5514
+ Ps[qs] === !0 && console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");
5515
+ Ps[qs] = !0;
5516
5516
  const Zs = /* @__PURE__ */ new Map();
5517
5517
  class tl {
5518
5518
  /**
@@ -5531,27 +5531,27 @@ class tl {
5531
5531
  Tr(this._onChange);
5532
5532
  }
5533
5533
  }
5534
- const el = typeof BroadcastChannel > "u" ? tl : BroadcastChannel, mn = (n) => W(Zs, n, () => {
5534
+ const el = typeof BroadcastChannel > "u" ? tl : BroadcastChannel, yn = (n) => J(Zs, n, () => {
5535
5535
  const t = lt(), e = new el(n);
5536
5536
  return e.onmessage = (s) => t.forEach((r) => r(s.data, "broadcastchannel")), {
5537
5537
  bc: e,
5538
5538
  subs: t
5539
5539
  };
5540
- }), nl = (n, t) => (mn(n).subs.add(t), t), sl = (n, t) => {
5541
- const e = mn(n), s = e.subs.delete(t);
5540
+ }), nl = (n, t) => (yn(n).subs.add(t), t), sl = (n, t) => {
5541
+ const e = yn(n), s = e.subs.delete(t);
5542
5542
  return s && e.subs.size === 0 && (e.bc.close(), Zs.delete(n)), s;
5543
5543
  }, mt = (n, t, e = null) => {
5544
- const s = mn(n);
5544
+ const s = yn(n);
5545
5545
  s.bc.postMessage(t), s.subs.forEach((r) => r(t, e));
5546
- }, Qs = 0, yn = 1, tr = 2, ze = (n, t) => {
5546
+ }, Qs = 0, bn = 1, tr = 2, Ye = (n, t) => {
5547
5547
  p(n, Qs);
5548
5548
  const e = Qi(t);
5549
5549
  D(n, e);
5550
5550
  }, er = (n, t, e) => {
5551
- p(n, yn), D(n, an(t, e));
5552
- }, rl = (n, t, e) => er(t, e, v(n)), nr = (n, t, e) => {
5551
+ p(n, bn), D(n, hn(t, e));
5552
+ }, rl = (n, t, e) => er(t, e, M(n)), nr = (n, t, e) => {
5553
5553
  try {
5554
- Es(t, v(n), e);
5554
+ Es(t, M(n), e);
5555
5555
  } catch (s) {
5556
5556
  console.error("Caught error while handling a Yjs update", s);
5557
5557
  }
@@ -5563,7 +5563,7 @@ const el = typeof BroadcastChannel > "u" ? tl : BroadcastChannel, mn = (n) => W(
5563
5563
  case Qs:
5564
5564
  rl(n, t, e);
5565
5565
  break;
5566
- case yn:
5566
+ case bn:
5567
5567
  nr(n, e, s);
5568
5568
  break;
5569
5569
  case tr:
@@ -5576,9 +5576,9 @@ const el = typeof BroadcastChannel > "u" ? tl : BroadcastChannel, mn = (n) => W(
5576
5576
  }, cl = 0, al = (n, t, e) => {
5577
5577
  switch (m(n)) {
5578
5578
  case cl:
5579
- e(t, Q(n));
5579
+ e(t, Z(n));
5580
5580
  }
5581
- }, xe = 3e4;
5581
+ }, Ue = 3e4;
5582
5582
  class hl extends fe {
5583
5583
  /**
5584
5584
  * @param {Y.Doc} doc
@@ -5587,13 +5587,13 @@ class hl extends fe {
5587
5587
  super(), this.doc = t, this.clientID = t.clientID, this.states = /* @__PURE__ */ new Map(), this.meta = /* @__PURE__ */ new Map(), this._checkInterval = /** @type {any} */
5588
5588
  setInterval(() => {
5589
5589
  const e = ct();
5590
- this.getLocalState() !== null && xe / 2 <= e - /** @type {{lastUpdated:number}} */
5590
+ this.getLocalState() !== null && Ue / 2 <= e - /** @type {{lastUpdated:number}} */
5591
5591
  this.meta.get(this.clientID).lastUpdated && this.setLocalState(this.getLocalState());
5592
5592
  const s = [];
5593
5593
  this.meta.forEach((r, i) => {
5594
- i !== this.clientID && xe <= e - r.lastUpdated && this.states.has(i) && s.push(i);
5595
- }), s.length > 0 && bn(this, s, "timeout");
5596
- }, X(xe / 10)), t.on("destroy", () => {
5594
+ i !== this.clientID && Ue <= e - r.lastUpdated && this.states.has(i) && s.push(i);
5595
+ }), s.length > 0 && kn(this, s, "timeout");
5596
+ }, Y(Ue / 10)), t.on("destroy", () => {
5597
5597
  this.destroy();
5598
5598
  }), this.setLocalState({});
5599
5599
  }
@@ -5636,7 +5636,7 @@ class hl extends fe {
5636
5636
  return this.states;
5637
5637
  }
5638
5638
  }
5639
- const bn = (n, t, e) => {
5639
+ const kn = (n, t, e) => {
5640
5640
  const s = [];
5641
5641
  for (let r = 0; r < t.length; r++) {
5642
5642
  const i = t[r];
@@ -5656,7 +5656,7 @@ const bn = (n, t, e) => {
5656
5656
  }
5657
5657
  s.length > 0 && (n.emit("change", [{ added: [], updated: [], removed: s }, e]), n.emit("update", [{ added: [], updated: [], removed: s }, e]));
5658
5658
  }, Ut = (n, t, e = n.states) => {
5659
- const s = t.length, r = M();
5659
+ const s = t.length, r = v();
5660
5660
  p(r, s);
5661
5661
  for (let i = 0; i < s; i++) {
5662
5662
  const o = t[i], l = e.get(o) || null, c = (
@@ -5671,7 +5671,7 @@ const bn = (n, t, e) => {
5671
5671
  for (let h = 0; h < a; h++) {
5672
5672
  const d = m(s);
5673
5673
  let u = m(s);
5674
- const f = JSON.parse(Q(s)), g = n.meta.get(d), w = n.states.get(d), S = g === void 0 ? 0 : g.clock;
5674
+ const f = JSON.parse(Z(s)), g = n.meta.get(d), w = n.states.get(d), S = g === void 0 ? 0 : g.clock;
5675
5675
  (S < u || S === u && f === null && n.states.has(d)) && (f === null ? d === n.clientID && n.getLocalState() != null ? u++ : n.states.delete(d) : n.states.set(d, f), n.meta.set(d, {
5676
5676
  clock: u,
5677
5677
  lastUpdated: r
@@ -5701,7 +5701,7 @@ Xt[st] = (n, t, e, s, r) => {
5701
5701
  e.doc,
5702
5702
  e
5703
5703
  );
5704
- s && i === yn && !e.synced && (e.synced = !0);
5704
+ s && i === bn && !e.synced && (e.synced = !0);
5705
5705
  };
5706
5706
  Xt[sr] = (n, t, e, s, r) => {
5707
5707
  p(n, kt), D(
@@ -5715,7 +5715,7 @@ Xt[sr] = (n, t, e, s, r) => {
5715
5715
  Xt[kt] = (n, t, e, s, r) => {
5716
5716
  ul(
5717
5717
  e.awareness,
5718
- v(t),
5718
+ M(t),
5719
5719
  e
5720
5720
  );
5721
5721
  };
@@ -5732,7 +5732,7 @@ function wl(n, t) {
5732
5732
  ${t}`);
5733
5733
  }
5734
5734
  function rr(n, t, e) {
5735
- const s = nt(t), r = M(), i = m(s), o = n.messageHandlers[i];
5735
+ const s = nt(t), r = v(), i = m(s), o = n.messageHandlers[i];
5736
5736
  return /** @type {any} */ o ? o(r, s, n, e, i) : console.error("Unable to compute message"), r;
5737
5737
  }
5738
5738
  function ir(n) {
@@ -5743,11 +5743,11 @@ function ir(n) {
5743
5743
  return;
5744
5744
  n.wsLastMessageReceived = ct();
5745
5745
  const s = rr(n, new Uint8Array(e.data), !0);
5746
- en(s) > 1 && t.send(_(s));
5746
+ nn(s) > 1 && t.send(_(s));
5747
5747
  }, t.onerror = (e) => {
5748
5748
  n.emit("connection-error", [e, n]);
5749
5749
  }, t.onclose = (e) => {
5750
- n.emit("connection-close", [e, n]), n.ws = null, n.wsconnecting = !1, n.wsconnected ? (n.wsconnected = !1, n.synced = !1, bn(
5750
+ n.emit("connection-close", [e, n]), n.ws = null, n.wsconnecting = !1, n.wsconnected ? (n.wsconnected = !1, n.synced = !1, kn(
5751
5751
  n.awareness,
5752
5752
  Array.from(n.awareness.getStates().keys()).filter(
5753
5753
  (s) => s !== n.doc.clientID
@@ -5759,7 +5759,7 @@ function ir(n) {
5759
5759
  }
5760
5760
  ])) : n.wsUnsuccessfulReconnects++, setTimeout(
5761
5761
  ir,
5762
- Ge(
5762
+ Pe(
5763
5763
  Sr(2, n.wsUnsuccessfulReconnects) * 100,
5764
5764
  n.maxBackoffTime
5765
5765
  ),
@@ -5771,9 +5771,9 @@ function ir(n) {
5771
5771
  status: "connected"
5772
5772
  }
5773
5773
  ]);
5774
- const e = M();
5775
- if (p(e, st), ze(e, n.doc), t.send(_(e)), n.awareness.getLocalState() !== null) {
5776
- const s = M();
5774
+ const e = v();
5775
+ if (p(e, st), Ye(e, n.doc), t.send(_(e)), n.awareness.getLocalState() !== null) {
5776
+ const s = v();
5777
5777
  p(s, kt), D(
5778
5778
  s,
5779
5779
  Ut(n.awareness, [
@@ -5788,7 +5788,7 @@ function ir(n) {
5788
5788
  ]);
5789
5789
  }
5790
5790
  }
5791
- function Ue(n, t) {
5791
+ function Te(n, t) {
5792
5792
  const e = n.ws;
5793
5793
  n.wsconnected && e && e.readyState === e.OPEN && e.send(t), n.bcconnected && mt(n.bcChannel, t, n);
5794
5794
  }
@@ -5837,27 +5837,27 @@ var ml = class extends fe {
5837
5837
  this.maxBackoffTime = a, this.bcChannel = t + "/" + e, this.url = t + "/" + e + (d.length === 0 ? "" : "?" + d), this.roomname = e, this.doc = s, this._WS = l, this.awareness = i, this.wsconnected = !1, this.wsconnecting = !1, this.bcconnected = !1, this.disableBc = h, this.wsUnsuccessfulReconnects = 0, this.messageHandlers = Xt.slice(), this._synced = !1, this.ws = null, this.wsLastMessageReceived = 0, this.shouldConnect = r, this._resyncInterval = 0, c > 0 && (this._resyncInterval = /** @type {any} */
5838
5838
  setInterval(() => {
5839
5839
  if (this.ws && this.ws.readyState === WebSocket.OPEN) {
5840
- const u = M();
5841
- p(u, st), ze(u, s), this.ws.send(_(u));
5840
+ const u = v();
5841
+ p(u, st), Ye(u, s), this.ws.send(_(u));
5842
5842
  }
5843
5843
  }, c)), this._bcSubscriber = (u, f) => {
5844
5844
  if (f !== this) {
5845
5845
  const g = rr(this, new Uint8Array(u), !1);
5846
- en(g) > 1 && mt(this.bcChannel, _(g), this);
5846
+ nn(g) > 1 && mt(this.bcChannel, _(g), this);
5847
5847
  }
5848
5848
  }, this._updateHandler = (u, f) => {
5849
5849
  if (f !== this) {
5850
- const g = M();
5851
- p(g, st), il(g, u), Ue(this, _(g));
5850
+ const g = v();
5851
+ p(g, st), il(g, u), Te(this, _(g));
5852
5852
  }
5853
5853
  }, this.doc.on("update", this._updateHandler), this._awarenessUpdateHandler = ({ added: u, updated: f, removed: g }, w) => {
5854
- const S = u.concat(f).concat(g), j = M();
5854
+ const S = u.concat(f).concat(g), j = v();
5855
5855
  p(j, kt), D(
5856
5856
  j,
5857
5857
  Ut(i, S)
5858
- ), Ue(this, _(j));
5858
+ ), Te(this, _(j));
5859
5859
  }, this._unloadHandler = () => {
5860
- bn(
5860
+ kn(
5861
5861
  this.awareness,
5862
5862
  [s.clientID],
5863
5863
  "window unload"
@@ -5883,17 +5883,17 @@ var ml = class extends fe {
5883
5883
  if (this.disableBc)
5884
5884
  return;
5885
5885
  this.bcconnected || (nl(this.bcChannel, this._bcSubscriber), this.bcconnected = !0);
5886
- const t = M();
5887
- p(t, st), ze(t, this.doc), mt(this.bcChannel, _(t), this);
5888
- const e = M();
5886
+ const t = v();
5887
+ p(t, st), Ye(t, this.doc), mt(this.bcChannel, _(t), this);
5888
+ const e = v();
5889
5889
  p(e, st), er(e, this.doc), mt(this.bcChannel, _(e), this);
5890
- const s = M();
5890
+ const s = v();
5891
5891
  p(s, sr), mt(
5892
5892
  this.bcChannel,
5893
5893
  _(s),
5894
5894
  this
5895
5895
  );
5896
- const r = M();
5896
+ const r = v();
5897
5897
  p(r, kt), D(
5898
5898
  r,
5899
5899
  Ut(this.awareness, [
@@ -5906,7 +5906,7 @@ var ml = class extends fe {
5906
5906
  );
5907
5907
  }
5908
5908
  disconnectBc() {
5909
- const t = M();
5909
+ const t = v();
5910
5910
  p(t, kt), D(
5911
5911
  t,
5912
5912
  Ut(
@@ -5914,7 +5914,7 @@ var ml = class extends fe {
5914
5914
  [this.doc.clientID],
5915
5915
  /* @__PURE__ */ new Map()
5916
5916
  )
5917
- ), Ue(this, _(t)), this.bcconnected && (sl(this.bcChannel, this._bcSubscriber), this.bcconnected = !1);
5917
+ ), Te(this, _(t)), this.bcconnected && (sl(this.bcChannel, this._bcSubscriber), this.bcconnected = !1);
5918
5918
  }
5919
5919
  disconnect() {
5920
5920
  this.shouldConnect = !1, this.disconnectBc(), this.ws !== null && this.ws.close();
@@ -5932,7 +5932,7 @@ function yl() {
5932
5932
  return n > 0 ? (s = (n + s) % 16 | 0, n = Math.floor(n / 16)) : (s = (t + s) % 16 | 0, t = Math.floor(t / 16)), (e === "x" ? s : s & 3 | 8).toString(16);
5933
5933
  });
5934
5934
  }
5935
- function qn(n, t, e) {
5935
+ function Pn(n, t, e) {
5936
5936
  if (typeof n !== e)
5937
5937
  throw new Error(
5938
5938
  `Invalid "${t}" parameter provided to YPartyKitProvider. Expected: ${e}, received: ${n}`
@@ -5944,7 +5944,7 @@ var bl = class extends WebSocket {
5944
5944
  }
5945
5945
  }, rt, ts, kl = (ts = class extends ml {
5946
5946
  constructor(t, e, s, r = {}) {
5947
- qn(t, "host", "string"), qn(e, "room", "string"), t = t.replace(/^(http|https|ws|wss):\/\//, ""), t.endsWith("/") && t.slice(0, -1);
5947
+ Pn(t, "host", "string"), Pn(e, "room", "string"), t = t.replace(/^(http|https|ws|wss):\/\//, ""), t.endsWith("/") && t.slice(0, -1);
5948
5948
  const i = `${t.startsWith("localhost:") || t.startsWith("127.0.0.1:") ? "ws" : "wss"}://${t}${r.party ? `/parties/${r.party}` : "/party"}`, o = r.connectionId ?? yl(), { params: l, connect: c = !0, ...a } = r, h = {
5949
5949
  ...a,
5950
5950
  connect: !1,
@@ -5974,7 +5974,7 @@ const wt = (n) => Dt((t, e) => {
5974
5974
  n.onerror = (s) => e(new Error(s.target.error)), n.onsuccess = (s) => t(s.target.result);
5975
5975
  }), _l = (n, t) => Dt((e, s) => {
5976
5976
  const r = indexedDB.open(n);
5977
- r.onupgradeneeded = (i) => t(i.target.result), r.onerror = (i) => s(J(i.target.error)), r.onsuccess = (i) => {
5977
+ r.onupgradeneeded = (i) => t(i.target.result), r.onerror = (i) => s(X(i.target.error)), r.onsuccess = (i) => {
5978
5978
  const o = i.target.result;
5979
5979
  o.onversionchange = () => {
5980
5980
  o.close();
@@ -5985,23 +5985,23 @@ const wt = (n) => Dt((t, e) => {
5985
5985
  // @ts-ignore
5986
5986
  n.createObjectStore.apply(n, e)
5987
5987
  )
5988
- ), vt = (n, t, e = "readwrite") => {
5988
+ ), Mt = (n, t, e = "readwrite") => {
5989
5989
  const s = n.transaction(t, e);
5990
5990
  return t.map((r) => xl(s, r));
5991
- }, or = (n, t) => wt(n.count(t)), El = (n, t) => wt(n.get(t)), lr = (n, t) => wt(n.delete(t)), Cl = (n, t, e) => wt(n.put(t, e)), Ye = (n, t) => wt(n.add(t)), Al = (n, t, e) => wt(n.getAll(t, e)), Ll = (n, t, e) => {
5991
+ }, or = (n, t) => wt(n.count(t)), El = (n, t) => wt(n.get(t)), lr = (n, t) => wt(n.delete(t)), Cl = (n, t, e) => wt(n.put(t, e)), Xe = (n, t) => wt(n.add(t)), Al = (n, t, e) => wt(n.getAll(t, e)), Ll = (n, t, e) => {
5992
5992
  let s = null;
5993
- return Ml(n, t, (r) => (s = r, !1), e).then(() => s);
5994
- }, Il = (n, t = null) => Ll(n, t, "prev"), vl = (n, t) => Dt((e, s) => {
5993
+ return vl(n, t, (r) => (s = r, !1), e).then(() => s);
5994
+ }, Il = (n, t = null) => Ll(n, t, "prev"), Ml = (n, t) => Dt((e, s) => {
5995
5995
  n.onerror = s, n.onsuccess = async (r) => {
5996
5996
  const i = r.target.result;
5997
5997
  if (i === null || await t(i) === !1)
5998
5998
  return e();
5999
5999
  i.continue();
6000
6000
  };
6001
- }), Ml = (n, t, e, s = "next") => vl(n.openKeyCursor(t, s), (r) => e(r.key)), xl = (n, t) => n.objectStore(t), Ul = (n, t) => IDBKeyRange.upperBound(n, t), Tl = (n, t) => IDBKeyRange.lowerBound(n, t), Te = "custom", cr = "updates", ar = 500, hr = (n, t = () => {
6001
+ }), vl = (n, t, e, s = "next") => Ml(n.openKeyCursor(t, s), (r) => e(r.key)), xl = (n, t) => n.objectStore(t), Ul = (n, t) => IDBKeyRange.upperBound(n, t), Tl = (n, t) => IDBKeyRange.lowerBound(n, t), Oe = "custom", cr = "updates", ar = 500, hr = (n, t = () => {
6002
6002
  }, e = () => {
6003
6003
  }) => {
6004
- const [s] = vt(
6004
+ const [s] = Mt(
6005
6005
  /** @type {IDBDatabase} */
6006
6006
  n.db,
6007
6007
  [cr]
@@ -6016,7 +6016,7 @@ const wt = (n) => Dt((t, e) => {
6016
6016
  n._dbsize = r;
6017
6017
  })).then(() => s);
6018
6018
  }, Ol = (n, t = !0) => hr(n).then((e) => {
6019
- (t || n._dbsize >= ar) && Ye(e, an(n.doc)).then(() => lr(e, Ul(n._dbref, !0))).then(() => or(e).then((s) => {
6019
+ (t || n._dbsize >= ar) && Xe(e, hn(n.doc)).then(() => lr(e, Ul(n._dbref, !0))).then(() => or(e).then((s) => {
6020
6020
  n._dbsize = s;
6021
6021
  }));
6022
6022
  });
@@ -6033,19 +6033,19 @@ class Rl extends fe {
6033
6033
  ["custom"]
6034
6034
  ])
6035
6035
  ), this.whenSynced = Dt((s) => this.on("synced", () => s(this))), this._db.then((s) => {
6036
- this.db = s, hr(this, (o) => Ye(o, an(e)), () => {
6036
+ this.db = s, hr(this, (o) => Xe(o, hn(e)), () => {
6037
6037
  if (this._destroyed)
6038
6038
  return this;
6039
6039
  this.synced = !0, this.emit("synced", [this]);
6040
6040
  });
6041
6041
  }), this._storeTimeout = 1e3, this._storeTimeoutId = null, this._storeUpdate = (s, r) => {
6042
6042
  if (this.db && r !== this) {
6043
- const [i] = vt(
6043
+ const [i] = Mt(
6044
6044
  /** @type {IDBDatabase} */
6045
6045
  this.db,
6046
6046
  [cr]
6047
6047
  );
6048
- Ye(i, s), ++this._dbsize >= ar && (this._storeTimeoutId !== null && clearTimeout(this._storeTimeoutId), this._storeTimeoutId = setTimeout(() => {
6048
+ Xe(i, s), ++this._dbsize >= ar && (this._storeTimeoutId !== null && clearTimeout(this._storeTimeoutId), this._storeTimeoutId = setTimeout(() => {
6049
6049
  Ol(this, !1), this._storeTimeoutId = null;
6050
6050
  }, this._storeTimeout));
6051
6051
  }
@@ -6072,7 +6072,7 @@ class Rl extends fe {
6072
6072
  */
6073
6073
  get(t) {
6074
6074
  return this._db.then((e) => {
6075
- const [s] = vt(e, [Te], "readonly");
6075
+ const [s] = Mt(e, [Oe], "readonly");
6076
6076
  return El(s, t);
6077
6077
  });
6078
6078
  }
@@ -6083,7 +6083,7 @@ class Rl extends fe {
6083
6083
  */
6084
6084
  set(t, e) {
6085
6085
  return this._db.then((s) => {
6086
- const [r] = vt(s, [Te]);
6086
+ const [r] = Mt(s, [Oe]);
6087
6087
  return Cl(r, e, t);
6088
6088
  });
6089
6089
  }
@@ -6093,7 +6093,7 @@ class Rl extends fe {
6093
6093
  */
6094
6094
  del(t) {
6095
6095
  return this._db.then((e) => {
6096
- const [s] = vt(e, [Te]);
6096
+ const [s] = Mt(e, [Oe]);
6097
6097
  return lr(s, t);
6098
6098
  });
6099
6099
  }
@@ -6104,14 +6104,14 @@ const Bl = {
6104
6104
  shiftKey: "Shift",
6105
6105
  metaKey: "Meta"
6106
6106
  }, Nl = "can-duplicate-to";
6107
- var kn = /* @__PURE__ */ ((n) => (n.CanPlay = "can-play", n.CanMove = "can-move", n.CanSpin = "can-spin", n.CanGrow = "can-grow", n.CanToggle = "can-toggle", n.CanDuplicate = "can-duplicate", n))(kn || {});
6107
+ var _e = /* @__PURE__ */ ((n) => (n.CanPlay = "can-play", n.CanMove = "can-move", n.CanSpin = "can-spin", n.CanGrow = "can-grow", n.CanToggle = "can-toggle", n.CanDuplicate = "can-duplicate", n))(_e || {});
6108
6108
  function Fl(n) {
6109
6109
  return n.id;
6110
6110
  }
6111
6111
  const ur = `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='44' height='53' viewport='0 0 100 100' style='fill:black;font-size:26px;'><text y='40%'>🚿</text></svg>")
6112
6112
  16 0,
6113
6113
  auto`, Vl = `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='48' viewport='0 0 100 100' style='fill:black;font-size:24px;'><text y='50%'>✂️</text></svg>") 16 0,auto`;
6114
- function Pn(n, { getData: t, getElement: e, getLocalData: s, setLocalData: r }) {
6114
+ function qn(n, { getData: t, getElement: e, getLocalData: s, setLocalData: r }) {
6115
6115
  const i = t(), o = s(), l = e();
6116
6116
  if (o.isHovering = !0, n.altKey) {
6117
6117
  if (i.scale <= 0.5) {
@@ -6220,8 +6220,8 @@ const Hl = {
6220
6220
  },
6221
6221
  additionalSetup: (n) => {
6222
6222
  n.getElement().addEventListener("mouseenter", (t) => {
6223
- Pn(t, n);
6224
- const e = (s) => Pn(s, n);
6223
+ qn(t, n);
6224
+ const e = (s) => qn(s, n);
6225
6225
  document.addEventListener("keydown", e), document.addEventListener("keyup", e), n.getElement().addEventListener("mouseleave", (s) => {
6226
6226
  document.removeEventListener("keydown", e), document.removeEventListener("keyup", e);
6227
6227
  });
@@ -6466,24 +6466,24 @@ class $l {
6466
6466
  this.setData(this.defaultData);
6467
6467
  }
6468
6468
  }
6469
- const jl = "playhtml.spencerc99.partykit.dev", Oe = new gt();
6469
+ const jl = "playhtml.spencerc99.partykit.dev", Re = new gt();
6470
6470
  function Kl() {
6471
6471
  return window.location.pathname + window.location.search;
6472
6472
  }
6473
- let Y, N, F;
6473
+ let Q, N, F;
6474
6474
  const Qn = /* @__PURE__ */ new Map();
6475
6475
  let Jt = Hl;
6476
- function Xe() {
6477
- return Object.keys(Jt);
6476
+ function Je() {
6477
+ return [_e.CanPlay, ...Object.keys(Jt)];
6478
6478
  }
6479
- let _n = !1, Je = !0;
6480
- function dr({
6479
+ let _n = !1, We = !0;
6480
+ function zl({
6481
6481
  // TODO: if it is a localhost url, need to make some deterministic way to connect to the same room.
6482
6482
  room: n = Kl(),
6483
6483
  host: t = jl,
6484
6484
  extraCapabilities: e
6485
6485
  } = {}) {
6486
- if (!Je) {
6486
+ if (!We) {
6487
6487
  console.error("playhtml already set up!");
6488
6488
  return;
6489
6489
  }
@@ -6495,50 +6495,45 @@ function dr({
6495
6495
  ࿂࿂࿂࿂ https://playhtml.fun ࿂࿂࿂࿂
6496
6496
  ࿂࿂࿂࿂ ࿂ ࿂ ࿂ ࿂ ࿂࿂࿂࿂
6497
6497
  ࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂`
6498
- ), Y = new kl(r, s, Oe), N = Oe.getMap("playhtml-global"), F = /* @__PURE__ */ new Map(), new Rl(s, Oe), We.globalData = N, We.elementHandlers = F, e)
6498
+ ), Q = new kl(r, s, Re), N = Re.getMap("playhtml-global"), F = /* @__PURE__ */ new Map(), new Rl(s, Re), Ge.globalData = N, Ge.elementHandlers = F, e)
6499
6499
  for (const [i, o] of Object.entries(e))
6500
6500
  Jt[i] = o;
6501
- return Y.on("sync", (i) => {
6502
- i || console.error("Issue connecting to yjs..."), _n = !0, Wl();
6503
- }), Y;
6501
+ return Q.on("sync", (i) => {
6502
+ i || console.error("Issue connecting to yjs..."), _n = !0, fr();
6503
+ }), Q;
6504
6504
  }
6505
- setTimeout(() => {
6506
- Y || (console.error(
6507
- "You are using a deprecated version of playhtml. Please call `playhtml.init()` explicitly rather than just importing the library. Refer to https://github.com/spencerc99/playhtml#usage for reference."
6508
- ), dr());
6509
- }, 3e3);
6510
- function zl(n, t) {
6511
- const e = Y.awareness.getLocalState();
6505
+ function Yl(n, t) {
6506
+ const e = Q.awareness.getLocalState();
6512
6507
  return ((e == null ? void 0 : e[n]) ?? {})[t];
6513
6508
  }
6514
6509
  function Sn(n) {
6515
6510
  return n instanceof HTMLElement;
6516
6511
  }
6517
- function Yl(n, t, e, s) {
6512
+ function Xl(n, t, e, s) {
6518
6513
  const r = N.get(t);
6519
6514
  return {
6520
6515
  ...e,
6521
6516
  data: r.get(s) ?? e.defaultData,
6522
- awareness: zl(t, s) ?? e.myDefaultAwareness !== void 0 ? [e.myDefaultAwareness] : void 0,
6517
+ awareness: Yl(t, s) ?? e.myDefaultAwareness !== void 0 ? [e.myDefaultAwareness] : void 0,
6523
6518
  element: n,
6524
6519
  onChange: (o) => {
6525
6520
  r.get(s) !== o && r.set(s, o);
6526
6521
  },
6527
6522
  onAwarenessChange: (o) => {
6528
6523
  var c;
6529
- const l = ((c = Y.awareness.getLocalState()) == null ? void 0 : c[t]) || {};
6530
- l[s] !== o && (l[s] = o, Y.awareness.setLocalStateField(t, l));
6524
+ const l = ((c = Q.awareness.getLocalState()) == null ? void 0 : c[t]) || {};
6525
+ l[s] !== o && (l[s] = o, Q.awareness.setLocalStateField(t, l));
6531
6526
  },
6532
6527
  triggerAwarenessUpdate: () => {
6533
- fr();
6528
+ dr();
6534
6529
  }
6535
6530
  };
6536
6531
  }
6537
- function Xl(n) {
6538
- return n.defaultData !== void 0 && n.updateElement !== void 0;
6532
+ function Jl(n) {
6533
+ return n.defaultData !== void 0 && typeof n.defaultData == "object" && n.updateElement !== void 0;
6539
6534
  }
6540
- function Jl(n, t) {
6541
- if (n === kn.CanPlay) {
6535
+ function Wl(n, t) {
6536
+ if (n === _e.CanPlay) {
6542
6537
  const e = t;
6543
6538
  return {
6544
6539
  defaultData: e.defaultData,
@@ -6557,14 +6552,14 @@ function Jl(n, t) {
6557
6552
  }
6558
6553
  return Jt[n];
6559
6554
  }
6560
- function fr() {
6555
+ function dr() {
6561
6556
  const n = /* @__PURE__ */ new Map();
6562
6557
  function t(e, s, r, i) {
6563
6558
  n.has(e) || n.set(e, /* @__PURE__ */ new Map());
6564
6559
  const o = n.get(e);
6565
6560
  o.has(s) || o.set(s, /* @__PURE__ */ new Map()), o.get(s).set(r, i);
6566
6561
  }
6567
- Y.awareness.getStates().forEach((e, s) => {
6562
+ Q.awareness.getStates().forEach((e, s) => {
6568
6563
  var r;
6569
6564
  for (const [i, o] of Object.entries(e)) {
6570
6565
  const l = F.get(i);
@@ -6594,37 +6589,38 @@ function fr() {
6594
6589
  }
6595
6590
  });
6596
6591
  }
6597
- function Wl() {
6598
- console.log("[PLAYHTML]: Setting up elements... Time to have some fun 🛝"), console.log(Xe());
6599
- for (const n of Xe()) {
6592
+ function fr() {
6593
+ console.log("[PLAYHTML]: Setting up elements... Time to have some fun 🛝"), console.log(Je());
6594
+ for (const n of Je()) {
6600
6595
  const t = Array.from(
6601
6596
  document.querySelectorAll(`[${n}]`)
6602
6597
  ).filter(Sn);
6603
6598
  if (t.length)
6604
6599
  for (let e = 0; e < t.length; e++) {
6605
6600
  const s = t[e];
6606
- _e(s, n);
6601
+ Se(s, n);
6607
6602
  }
6608
6603
  }
6609
- Je && (N.observe((n) => {
6604
+ We && (N.observe((n) => {
6610
6605
  n.changes.keys.forEach((t, e) => {
6611
6606
  t.action === "add" && N.set(e, N.get(e));
6612
6607
  });
6613
- }), Y.awareness.on("change", () => fr()), Je = !1);
6608
+ }), Q.awareness.on("change", () => dr()), We = !1);
6614
6609
  }
6615
- const We = {
6616
- init: dr,
6617
- setupPlayElement: Pl,
6610
+ const Ge = {
6611
+ init: zl,
6612
+ setupPlayElements: fr,
6613
+ setupPlayElement: ql,
6618
6614
  removePlayElement: Zl,
6619
- setupPlayElementForTag: _e,
6615
+ setupPlayElementForTag: Se,
6620
6616
  globalData: void 0,
6621
6617
  elementHandlers: void 0
6622
6618
  };
6623
- window.playhtml = We;
6619
+ window.playhtml = Ge;
6624
6620
  function Gl(n) {
6625
6621
  if (F.has(n) || !_n)
6626
6622
  return;
6627
- F.set(n, /* @__PURE__ */ new Map()), n !== kn.CanPlay && Jt[n], N.get(n) || N.set(n, new ht());
6623
+ F.set(n, /* @__PURE__ */ new Map()), n !== _e.CanPlay && Jt[n], N.get(n) || N.set(n, new ht());
6628
6624
  const t = N.get(n);
6629
6625
  t.observe((e) => {
6630
6626
  e.changes.keys.forEach((s, r) => {
@@ -6635,7 +6631,7 @@ function Gl(n) {
6635
6631
  console.log(`Element ${r} not an HTML element. Ignoring.`);
6636
6632
  return;
6637
6633
  }
6638
- _e(o, n);
6634
+ Se(o, n);
6639
6635
  } else if (s.action === "update") {
6640
6636
  const o = i.get(r);
6641
6637
  o.__data = t.get(r);
@@ -6644,13 +6640,13 @@ function Gl(n) {
6644
6640
  });
6645
6641
  });
6646
6642
  }
6647
- function ql(n, t) {
6643
+ function Pl(n, t) {
6648
6644
  var e, s;
6649
6645
  return ((s = (e = Jt[t]) == null ? void 0 : e.isValidElementForTag) == null ? void 0 : s.call(e, n)) ?? !0;
6650
6646
  }
6651
- function _e(n, t) {
6647
+ function Se(n, t) {
6652
6648
  var l;
6653
- if (!ql(n, t) || !_n)
6649
+ if (!Pl(n, t) || !_n)
6654
6650
  return;
6655
6651
  if (!n.id) {
6656
6652
  const c = n.getAttribute("selector-id");
@@ -6668,17 +6664,17 @@ function _e(n, t) {
6668
6664
  return;
6669
6665
  }
6670
6666
  Gl(t);
6671
- const s = F.get(t), r = Jl(
6667
+ const s = F.get(t), r = Wl(
6672
6668
  t,
6673
6669
  n
6674
6670
  );
6675
- if (!Xl(r)) {
6671
+ if (!Jl(r)) {
6676
6672
  console.error(
6677
6673
  `Element ${e} does not have proper info to initial a playhtml element. Please refer to https://github.com/spencerc99/playhtml#can-play for troubleshooting help.`
6678
6674
  );
6679
6675
  return;
6680
6676
  }
6681
- const i = N.get(t), o = Yl(
6677
+ const i = N.get(t), o = Xl(
6682
6678
  n,
6683
6679
  t,
6684
6680
  r,
@@ -6691,13 +6687,13 @@ function _e(n, t) {
6691
6687
  s.set(e, new $l(o));
6692
6688
  i.get(e) === void 0 && r.defaultData !== void 0 && i.set(e, r.defaultData), (l = o.triggerAwarenessUpdate) == null || l.call(o), n.classList.add("__playhtml-element"), n.classList.add(`__playhtml-${t}`), n.style.setProperty("--jiggle-delay", `${Math.random() * 1}s;}`);
6693
6689
  }
6694
- function Pl(n) {
6690
+ function ql(n) {
6695
6691
  if (!Sn(n)) {
6696
6692
  console.log(`Element ${n.id} not an HTML element. Ignoring.`);
6697
6693
  return;
6698
6694
  }
6699
- for (const t of Xe())
6700
- n.hasAttribute(t) && _e(n, t);
6695
+ for (const t of Je())
6696
+ n.hasAttribute(t) && Se(n, t);
6701
6697
  }
6702
6698
  function Zl(n) {
6703
6699
  if (!(!n || !n.id))
@@ -6707,5 +6703,5 @@ function Zl(n) {
6707
6703
  }
6708
6704
  }
6709
6705
  export {
6710
- We as playhtml
6706
+ Ge as playhtml
6711
6707
  };