playhtml 2.1.3 → 2.1.5

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,16 +1,16 @@
1
1
  var zr = Object.defineProperty;
2
2
  var Yr = (e, t, n) => t in e ? zr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var y = (e, t, n) => (Yr(e, typeof t != "symbol" ? t + "" : t, n), n), Hn = (e, t, n) => {
3
+ var y = (e, t, n) => (Yr(e, typeof t != "symbol" ? t + "" : t, n), n), Vn = (e, t, n) => {
4
4
  if (!t.has(e))
5
5
  throw TypeError("Cannot " + n);
6
6
  };
7
- var re = (e, t, n) => (Hn(e, t, "read from private field"), n ? n.call(e) : t.get(e)), Vn = (e, t, n) => {
7
+ var ie = (e, t, n) => (Vn(e, t, "read from private field"), n ? n.call(e) : t.get(e)), Fn = (e, t, n) => {
8
8
  if (t.has(e))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
10
  t instanceof WeakSet ? t.add(e) : t.set(e, n);
11
- }, Fn = (e, t, n, s) => (Hn(e, t, "write to private field"), s ? s.call(e, n) : t.set(e, n), n);
12
- var ie = 1e6, Xr = "y-pk-batch", jn = !1, Rt = (e, t) => {
13
- if (e.byteLength <= ie) {
11
+ }, Hn = (e, t, n, s) => (Vn(e, t, "write to private field"), s ? s.call(e, n) : t.set(e, n), n);
12
+ var oe = 1e6, Xr = "y-pk-batch", jn = !1, $t = (e, t) => {
13
+ if (e.byteLength <= oe) {
14
14
  t.send(e);
15
15
  return;
16
16
  }
@@ -19,7 +19,7 @@ var ie = 1e6, Xr = "y-pk-batch", jn = !1, Rt = (e, t) => {
19
19
  "The Y.js update size exceeds 1MB, which is the maximum size for an individual update. The update will be split into chunks. This is an experimental feature.",
20
20
  `Message size: ${(e.byteLength / 1e3 / 1e3).toFixed(1)}MB`
21
21
  ), jn = !0);
22
- const n = (Date.now() + Math.random()).toString(36).substring(10), s = Math.ceil(e.byteLength / ie);
22
+ const n = (Date.now() + Math.random()).toString(36).substring(10), s = Math.ceil(e.byteLength / oe);
23
23
  t.send(
24
24
  Kn({
25
25
  id: n,
@@ -30,7 +30,7 @@ var ie = 1e6, Xr = "y-pk-batch", jn = !1, Rt = (e, t) => {
30
30
  );
31
31
  let r = 0, i = 0;
32
32
  for (let o = 0; o < s; o++) {
33
- const c = e.slice(ie * o, ie * (o + 1));
33
+ const c = e.slice(oe * o, oe * (o + 1));
34
34
  t.send(c), i += 1, r += c.byteLength;
35
35
  }
36
36
  t.send(
@@ -54,10 +54,10 @@ const _t = () => /* @__PURE__ */ new Map(), Ss = (e, t, n) => {
54
54
  s[r] = /** @type {number} */
55
55
  t.codePointAt(r);
56
56
  return s;
57
- }, Ht = (
57
+ }, Ft = (
58
58
  /** @type {TextEncoder} */
59
59
  typeof TextEncoder < "u" ? new TextEncoder() : null
60
- ), ti = (e) => Ht.encode(e), ei = Ht ? ti : Qr;
60
+ ), ti = (e) => Ft.encode(e), ei = Ft ? ti : Qr;
61
61
  let Ne = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", { fatal: !0, ignoreBOM: !0 });
62
62
  Ne && Ne.decode(new Uint8Array()).length === 1 && (Ne = null);
63
63
  const Yn = (e) => e === void 0 ? null : e;
@@ -96,32 +96,32 @@ const Ds = ks, si = (e) => gn || addEventListener(
96
96
  for (const s in e)
97
97
  n.push(t(e[s], s));
98
98
  return n;
99
- }, oi = (e, t) => t.includes(e), At = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]", Es = typeof window < "u" && typeof document < "u" && !At;
100
- let H;
99
+ }, oi = (e, t) => t.includes(e), Lt = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]", Es = typeof window < "u" && typeof document < "u" && !Lt;
100
+ let V;
101
101
  const ci = () => {
102
- if (H === void 0)
103
- if (At) {
104
- H = _t();
102
+ if (V === void 0)
103
+ if (Lt) {
104
+ V = _t();
105
105
  const e = process.argv;
106
106
  let t = null;
107
107
  for (let n = 0; n < e.length; n++) {
108
108
  const s = e[n];
109
- s[0] === "-" ? (t !== null && H.set(t, ""), t = s) : t !== null && (H.set(t, s), t = null);
109
+ s[0] === "-" ? (t !== null && V.set(t, ""), t = s) : t !== null && (V.set(t, s), t = null);
110
110
  }
111
- t !== null && H.set(t, "");
111
+ t !== null && V.set(t, "");
112
112
  } else
113
- typeof location == "object" ? (H = _t(), (location.search || "?").slice(1).split("&").forEach((e) => {
113
+ typeof location == "object" ? (V = _t(), (location.search || "?").slice(1).split("&").forEach((e) => {
114
114
  if (e.length !== 0) {
115
115
  const [t, n] = e.split("=");
116
- H.set(`--${zn(t, "-")}`, n), H.set(`-${zn(t, "-")}`, n);
116
+ V.set(`--${zn(t, "-")}`, n), V.set(`-${zn(t, "-")}`, n);
117
117
  }
118
- })) : H = _t();
119
- return H;
120
- }, Ge = (e) => ci().has(e), qe = (e) => Yn(At ? process.env[e.toUpperCase()] : Ds.getItem(e)), li = (e) => Ge("--" + e) || qe(e) !== null;
118
+ })) : V = _t();
119
+ return V;
120
+ }, Ge = (e) => ci().has(e), qe = (e) => Yn(Lt ? process.env[e.toUpperCase()] : Ds.getItem(e)), li = (e) => Ge("--" + e) || qe(e) !== null;
121
121
  li("production");
122
- const Xn = At && oi(process.env.FORCE_COLOR, ["true", "1", "2"]);
123
- !Ge("no-colors") && (!At || process.stdout.isTTY || Xn) && (!At || Ge("color") || Xn || qe("COLORTERM") !== null || (qe("TERM") || "").includes("color"));
124
- const ai = Math.floor, Cs = (e, t) => e < t ? e : t, hi = (e, t) => e > t ? e : t, ui = Math.pow, As = 128, he = 127, di = Number.MAX_SAFE_INTEGER;
122
+ const Xn = Lt && oi(process.env.FORCE_COLOR, ["true", "1", "2"]);
123
+ !Ge("no-colors") && (!Lt || process.stdout.isTTY || Xn) && (!Lt || Ge("color") || Xn || qe("COLORTERM") !== null || (qe("TERM") || "").includes("color"));
124
+ const ai = Math.floor, Cs = (e, t) => e < t ? e : t, hi = (e, t) => e > t ? e : t, ui = Math.pow, As = 128, ue = 127, di = Number.MAX_SAFE_INTEGER;
125
125
  let fi = class {
126
126
  constructor() {
127
127
  this.cpos = 0, this.cbuf = new Uint8Array(100), this.bufs = [];
@@ -140,33 +140,33 @@ const R = () => new fi(), pn = (e) => {
140
140
  t.set(r, n), n += r.length;
141
141
  }
142
142
  return t.set(new Uint8Array(e.cbuf.buffer, 0, e.cpos), n), t;
143
- }, pe = (e, t) => {
143
+ }, we = (e, t) => {
144
144
  const n = e.cbuf.length;
145
145
  e.cpos === n && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(n * 2), e.cpos = 0), e.cbuf[e.cpos++] = t;
146
146
  }, v = (e, t) => {
147
- for (; t > he; )
148
- pe(e, As | he & t), t = ai(t / 128);
149
- pe(e, he & t);
147
+ for (; t > ue; )
148
+ we(e, As | ue & t), t = ai(t / 128);
149
+ we(e, ue & t);
150
150
  }, Ze = new Uint8Array(3e4), gi = Ze.length / 3, pi = (e, t) => {
151
151
  if (t.length < gi) {
152
- const n = Ht.encodeInto(t, Ze).written || 0;
152
+ const n = Ft.encodeInto(t, Ze).written || 0;
153
153
  v(e, n);
154
154
  for (let s = 0; s < n; s++)
155
- pe(e, Ze[s]);
155
+ we(e, Ze[s]);
156
156
  } else
157
157
  kt(e, ei(t));
158
158
  }, wi = (e, t) => {
159
159
  const n = unescape(encodeURIComponent(t)), s = n.length;
160
160
  v(e, s);
161
161
  for (let r = 0; r < s; r++)
162
- pe(
162
+ we(
163
163
  e,
164
164
  /** @type {number} */
165
165
  n.codePointAt(r)
166
166
  );
167
167
  };
168
- Ht && /** @type {any} */
169
- Ht.encodeInto;
168
+ Ft && /** @type {any} */
169
+ Ft.encodeInto;
170
170
  const mi = (e, t) => {
171
171
  const n = e.cbuf.length, s = e.cpos, r = Cs(n - s, t.length), i = t.length - r;
172
172
  e.cbuf.set(t.subarray(0, r), s), e.cpos += r, i > 0 && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(hi(n * 2, i)), e.cbuf.set(t.subarray(r)), e.cpos = i);
@@ -189,7 +189,7 @@ const _i = (e) => new Si(e), ki = (e, t) => {
189
189
  const s = e.arr.length;
190
190
  for (; e.pos < s; ) {
191
191
  const r = e.arr[e.pos++];
192
- if (t = t + (r & he) * n, n *= 128, r < As)
192
+ if (t = t + (r & ue) * n, n *= 128, r < As)
193
193
  return t;
194
194
  if (t > di)
195
195
  throw bi;
@@ -292,17 +292,17 @@ const Qe = Date.now, Bi = (e) => ii(e, (t, n) => `${encodeURIComponent(n)}=${enc
292
292
  }, rt = (e, t, n) => {
293
293
  let s = e.get(t);
294
294
  return s === void 0 && e.set(t, s = n()), s;
295
- }, Hi = (e, t) => {
295
+ }, Vi = (e, t) => {
296
296
  const n = [];
297
297
  for (const [s, r] of e)
298
298
  n.push(t(r, s));
299
299
  return n;
300
- }, Vi = (e, t) => {
300
+ }, Fi = (e, t) => {
301
301
  for (const [n, s] of e)
302
302
  if (t(s, n))
303
303
  return !0;
304
304
  return !1;
305
- }, Lt = () => /* @__PURE__ */ new Set(), Be = (e) => e[e.length - 1], Fi = (e, t) => {
305
+ }, It = () => /* @__PURE__ */ new Set(), Be = (e) => e[e.length - 1], Hi = (e, t) => {
306
306
  for (let n = 0; n < t.length; n++)
307
307
  e.push(t[n]);
308
308
  }, nt = Array.from, ji = Array.isArray;
@@ -315,7 +315,7 @@ class mn {
315
315
  * @param {function} f
316
316
  */
317
317
  on(t, n) {
318
- rt(this._observers, t, Lt).add(n);
318
+ rt(this._observers, t, It).add(n);
319
319
  }
320
320
  /**
321
321
  * @param {N} name
@@ -351,18 +351,18 @@ class mn {
351
351
  this._observers = B();
352
352
  }
353
353
  }
354
- const P = Math.floor, ue = Math.abs, Ms = (e, t) => e < t ? e : t, gt = (e, t) => e > t ? e : t, xs = (e) => e !== 0 ? e < 0 : 1 / e < 0, Ki = (e) => e.toLowerCase(), zi = /^\s*/g, Yi = (e) => e.replace(zi, ""), Xi = /([A-Z])/g, Jn = (e, t) => Yi(e.replace(Xi, (n) => `${t}${Ki(n)}`)), Ji = (e) => {
354
+ const P = Math.floor, de = Math.abs, Ms = (e, t) => e < t ? e : t, gt = (e, t) => e > t ? e : t, xs = (e) => e !== 0 ? e < 0 : 1 / e < 0, Ki = (e) => e.toLowerCase(), zi = /^\s*/g, Yi = (e) => e.replace(zi, ""), Xi = /([A-Z])/g, Jn = (e, t) => Yi(e.replace(Xi, (n) => `${t}${Ki(n)}`)), Ji = (e) => {
355
355
  const t = unescape(encodeURIComponent(e)), n = t.length, s = new Uint8Array(n);
356
356
  for (let r = 0; r < n; r++)
357
357
  s[r] = /** @type {number} */
358
358
  t.codePointAt(r);
359
359
  return s;
360
- }, Vt = (
360
+ }, Ht = (
361
361
  /** @type {TextEncoder} */
362
362
  typeof TextEncoder < "u" ? new TextEncoder() : null
363
- ), Wi = (e) => Vt.encode(e), Pi = Vt ? Wi : Ji;
364
- let $t = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", { fatal: !0, ignoreBOM: !0 });
365
- $t && $t.decode(new Uint8Array()).length === 1 && ($t = null);
363
+ ), Wi = (e) => Ht.encode(e), Pi = Ht ? Wi : Ji;
364
+ let Nt = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", { fatal: !0, ignoreBOM: !0 });
365
+ Nt && Nt.decode(new Uint8Array()).length === 1 && (Nt = null);
366
366
  const Wn = (e) => e === void 0 ? null : e;
367
367
  class Gi {
368
368
  constructor() {
@@ -390,7 +390,7 @@ try {
390
390
  const Zi = Us, Qi = Object.assign, to = Object.keys, eo = (e, t) => {
391
391
  for (const n in e)
392
392
  t(e[n], n);
393
- }, we = (e) => to(e).length, no = (e) => {
393
+ }, me = (e) => to(e).length, no = (e) => {
394
394
  for (const t in e)
395
395
  return !1;
396
396
  return !0;
@@ -399,14 +399,14 @@ const Zi = Us, Qi = Object.assign, to = Object.keys, eo = (e, t) => {
399
399
  if (!t(e[n], n))
400
400
  return !1;
401
401
  return !0;
402
- }, Ts = (e, t) => Object.prototype.hasOwnProperty.call(e, t), ro = (e, t) => e === t || we(e) === we(t) && so(e, (n, s) => (n !== void 0 || Ts(t, s)) && t[s] === n), yn = (e, t, n = 0) => {
402
+ }, Ts = (e, t) => Object.prototype.hasOwnProperty.call(e, t), ro = (e, t) => e === t || me(e) === me(t) && so(e, (n, s) => (n !== void 0 || Ts(t, s)) && t[s] === n), yn = (e, t, n = 0) => {
403
403
  try {
404
404
  for (; n < e.length; n++)
405
405
  e[n](...t);
406
406
  } finally {
407
407
  n < e.length && yn(e, t, n + 1);
408
408
  }
409
- }, io = (e) => e, oo = (e, t) => e === t, Nt = (e, t) => {
409
+ }, io = (e) => e, oo = (e, t) => e === t, Bt = (e, t) => {
410
410
  if (e == null || t == null)
411
411
  return oo(e, t);
412
412
  if (e.constructor !== t.constructor)
@@ -436,57 +436,57 @@ const Zi = Us, Qi = Object.assign, to = Object.keys, eo = (e, t) => {
436
436
  if (e.size !== t.size)
437
437
  return !1;
438
438
  for (const n of e.keys())
439
- if (!t.has(n) || !Nt(e.get(n), t.get(n)))
439
+ if (!t.has(n) || !Bt(e.get(n), t.get(n)))
440
440
  return !1;
441
441
  break;
442
442
  }
443
443
  case Object:
444
- if (we(e) !== we(t))
444
+ if (me(e) !== me(t))
445
445
  return !1;
446
446
  for (const n in e)
447
- if (!Ts(e, n) || !Nt(e[n], t[n]))
447
+ if (!Ts(e, n) || !Bt(e[n], t[n]))
448
448
  return !1;
449
449
  break;
450
450
  case Array:
451
451
  if (e.length !== t.length)
452
452
  return !1;
453
453
  for (let n = 0; n < e.length; n++)
454
- if (!Nt(e[n], t[n]))
454
+ if (!Bt(e[n], t[n]))
455
455
  return !1;
456
456
  break;
457
457
  default:
458
458
  return !1;
459
459
  }
460
460
  return !0;
461
- }, co = (e, t) => t.includes(e), Ft = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name);
462
- let V;
461
+ }, co = (e, t) => t.includes(e), jt = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name);
462
+ let F;
463
463
  const lo = () => {
464
- if (V === void 0)
465
- if (Ft) {
466
- V = B();
464
+ if (F === void 0)
465
+ if (jt) {
466
+ F = B();
467
467
  const e = process.argv;
468
468
  let t = null;
469
469
  for (let n = 0; n < e.length; n++) {
470
470
  const s = e[n];
471
- s[0] === "-" ? (t !== null && V.set(t, ""), t = s) : t !== null && (V.set(t, s), t = null);
471
+ s[0] === "-" ? (t !== null && F.set(t, ""), t = s) : t !== null && (F.set(t, s), t = null);
472
472
  }
473
- t !== null && V.set(t, "");
473
+ t !== null && F.set(t, "");
474
474
  } else
475
- typeof location == "object" ? (V = B(), (location.search || "?").slice(1).split("&").forEach((e) => {
475
+ typeof location == "object" ? (F = B(), (location.search || "?").slice(1).split("&").forEach((e) => {
476
476
  if (e.length !== 0) {
477
477
  const [t, n] = e.split("=");
478
- V.set(`--${Jn(t, "-")}`, n), V.set(`-${Jn(t, "-")}`, n);
478
+ F.set(`--${Jn(t, "-")}`, n), F.set(`-${Jn(t, "-")}`, n);
479
479
  }
480
- })) : V = B();
481
- return V;
482
- }, en = (e) => lo().has(e), nn = (e) => Wn(Ft ? process.env[e.toUpperCase()] : Zi.getItem(e)), ao = (e) => en("--" + e) || nn(e) !== null;
480
+ })) : F = B();
481
+ return F;
482
+ }, en = (e) => lo().has(e), nn = (e) => Wn(jt ? process.env[e.toUpperCase()] : Zi.getItem(e)), ao = (e) => en("--" + e) || nn(e) !== null;
483
483
  ao("production");
484
- const Pn = Ft && co(process.env.FORCE_COLOR, ["true", "1", "2"]), ho = !en("no-colors") && (!Ft || process.stdout.isTTY || Pn) && (!Ft || en("color") || Pn || nn("COLORTERM") !== null || (nn("TERM") || "").includes("color")), Gn = 1, qn = 2, He = 4, Ve = 8, jt = 32, J = 64, M = 128, Le = 31, sn = 63, ct = 127, uo = 2147483647, Os = Number.MAX_SAFE_INTEGER, fo = Number.isInteger || ((e) => typeof e == "number" && isFinite(e) && P(e) === e), G = (e) => new Error(e), F = () => {
484
+ const Pn = jt && co(process.env.FORCE_COLOR, ["true", "1", "2"]), ho = !en("no-colors") && (!jt || process.stdout.isTTY || Pn) && (!jt || en("color") || Pn || nn("COLORTERM") !== null || (nn("TERM") || "").includes("color")), Gn = 1, qn = 2, Ve = 4, Fe = 8, Kt = 32, J = 64, M = 128, Ie = 31, sn = 63, ct = 127, uo = 2147483647, Os = Number.MAX_SAFE_INTEGER, fo = Number.isInteger || ((e) => typeof e == "number" && isFinite(e) && P(e) === e), G = (e) => new Error(e), H = () => {
485
485
  throw G("Method unimplemented");
486
486
  }, j = () => {
487
487
  throw G("Unexpected case");
488
488
  }, Rs = G("Unexpected end of array"), $s = G("Integer out of Range");
489
- class Ie {
489
+ class ve {
490
490
  /**
491
491
  * @param {Uint8Array} uint8Array Binary data to decode
492
492
  */
@@ -494,10 +494,10 @@ class Ie {
494
494
  this.arr = t, this.pos = 0;
495
495
  }
496
496
  }
497
- const pt = (e) => new Ie(e), go = (e) => e.pos !== e.arr.length, po = (e, t) => {
497
+ const pt = (e) => new ve(e), go = (e) => e.pos !== e.arr.length, po = (e, t) => {
498
498
  const n = _n(e.arr.buffer, e.pos + e.arr.byteOffset, t);
499
499
  return e.pos += t, n;
500
- }, I = (e) => po(e, w(e)), It = (e) => e.arr[e.pos++], w = (e) => {
500
+ }, I = (e) => po(e, w(e)), vt = (e) => e.arr[e.pos++], w = (e) => {
501
501
  let t = 0, n = 1;
502
502
  const s = e.arr.length;
503
503
  for (; e.pos < s; ) {
@@ -526,10 +526,10 @@ const pt = (e) => new Ie(e), go = (e) => e.pos !== e.arr.length, po = (e, t) =>
526
526
  if (t === 0)
527
527
  return "";
528
528
  {
529
- let n = String.fromCodePoint(It(e));
529
+ let n = String.fromCodePoint(vt(e));
530
530
  if (--t < 100)
531
531
  for (; t--; )
532
- n += String.fromCodePoint(It(e));
532
+ n += String.fromCodePoint(vt(e));
533
533
  else
534
534
  for (; t > 0; ) {
535
535
  const s = t < 1e4 ? t : 1e4, r = e.arr.subarray(e.pos, e.pos + s);
@@ -543,8 +543,8 @@ const pt = (e) => new Ie(e), go = (e) => e.pos !== e.arr.length, po = (e, t) =>
543
543
  }
544
544
  }, mo = (e) => (
545
545
  /** @type any */
546
- $t.decode(I(e))
547
- ), et = $t ? mo : wo, Sn = (e, t) => {
546
+ Nt.decode(I(e))
547
+ ), et = Nt ? mo : wo, Sn = (e, t) => {
548
548
  const n = new DataView(e.arr.buffer, e.arr.byteOffset + e.pos, t);
549
549
  return e.pos += t, n;
550
550
  }, yo = (e) => Sn(e, 4).getFloat32(0, !1), bo = (e) => Sn(e, 8).getFloat64(0, !1), So = (e) => (
@@ -574,20 +574,20 @@ const pt = (e) => new Ie(e), go = (e) => e.pos !== e.arr.length, po = (e, t) =>
574
574
  const t = w(e), n = {};
575
575
  for (let s = 0; s < t; s++) {
576
576
  const r = et(e);
577
- n[r] = Kt(e);
577
+ n[r] = zt(e);
578
578
  }
579
579
  return n;
580
580
  },
581
581
  (e) => {
582
582
  const t = w(e), n = [];
583
583
  for (let s = 0; s < t; s++)
584
- n.push(Kt(e));
584
+ n.push(zt(e));
585
585
  return n;
586
586
  },
587
587
  I
588
588
  // CASE 116: Uint8Array
589
- ], Kt = (e) => _o[127 - It(e)](e);
590
- class Zn extends Ie {
589
+ ], zt = (e) => _o[127 - vt(e)](e);
590
+ class Zn extends ve {
591
591
  /**
592
592
  * @param {Uint8Array} uint8Array
593
593
  * @param {function(Decoder):T} reader
@@ -600,7 +600,7 @@ class Zn extends Ie {
600
600
  this.s;
601
601
  }
602
602
  }
603
- class de extends Ie {
603
+ class fe extends ve {
604
604
  /**
605
605
  * @param {Uint8Array} uint8Array
606
606
  */
@@ -617,7 +617,7 @@ class de extends Ie {
617
617
  this.s;
618
618
  }
619
619
  }
620
- class Fe extends Ie {
620
+ class He extends ve {
621
621
  /**
622
622
  * @param {Uint8Array} uint8Array
623
623
  */
@@ -640,7 +640,7 @@ class ko {
640
640
  * @param {Uint8Array} uint8Array
641
641
  */
642
642
  constructor(t) {
643
- this.decoder = new de(t), this.str = et(this.decoder), this.spos = 0;
643
+ this.decoder = new fe(t), this.str = et(this.decoder), this.spos = 0;
644
644
  }
645
645
  /**
646
646
  * @return {string}
@@ -654,12 +654,12 @@ const Do = (e) => new Uint8Array(e), _n = (e, t, n) => new Uint8Array(e, t, n),
654
654
  const t = Do(e.byteLength);
655
655
  return t.set(e), t;
656
656
  };
657
- class Gt {
657
+ class qt {
658
658
  constructor() {
659
659
  this.cpos = 0, this.cbuf = new Uint8Array(100), this.bufs = [];
660
660
  }
661
661
  }
662
- const qt = () => new Gt(), Co = (e) => {
662
+ const Zt = () => new qt(), Co = (e) => {
663
663
  let t = e.cpos;
664
664
  for (let n = 0; n < e.bufs.length; n++)
665
665
  t += e.bufs[n].length;
@@ -688,7 +688,7 @@ const qt = () => new Gt(), Co = (e) => {
688
688
  E(e, (t > ct ? M : 0) | ct & t), t = P(t / 128);
689
689
  }, on = new Uint8Array(3e4), Lo = on.length / 3, Io = (e, t) => {
690
690
  if (t.length < Lo) {
691
- const n = Vt.encodeInto(t, on).written || 0;
691
+ const n = Ht.encodeInto(t, on).written || 0;
692
692
  m(e, n);
693
693
  for (let s = 0; s < n; s++)
694
694
  E(e, on[s]);
@@ -703,12 +703,12 @@ const qt = () => new Gt(), Co = (e) => {
703
703
  /** @type {number} */
704
704
  n.codePointAt(r)
705
705
  );
706
- }, lt = Vt && /** @type {any} */
707
- Vt.encodeInto ? Io : vo, ve = (e, t) => {
706
+ }, lt = Ht && /** @type {any} */
707
+ Ht.encodeInto ? Io : vo, Me = (e, t) => {
708
708
  const n = e.cbuf.length, s = e.cpos, r = Ms(n - s, t.length), i = t.length - r;
709
709
  e.cbuf.set(t.subarray(0, r), s), e.cpos += r, i > 0 && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(gt(n * 2, i)), e.cbuf.set(t.subarray(r)), e.cpos = i);
710
710
  }, L = (e, t) => {
711
- m(e, t.byteLength), ve(e, t);
711
+ m(e, t.byteLength), Me(e, t);
712
712
  }, Dn = (e, t) => {
713
713
  Ao(e, t);
714
714
  const n = new DataView(e.cbuf.buffer, e.cpos, t);
@@ -716,13 +716,13 @@ Vt.encodeInto ? Io : vo, ve = (e, t) => {
716
716
  }, Mo = (e, t) => Dn(e, 4).setFloat32(0, t, !1), xo = (e, t) => Dn(e, 8).setFloat64(0, t, !1), Uo = (e, t) => (
717
717
  /** @type {any} */
718
718
  Dn(e, 8).setBigInt64(0, t, !1)
719
- ), Qn = new DataView(new ArrayBuffer(4)), To = (e) => (Qn.setFloat32(0, e), Qn.getFloat32(0) === e), zt = (e, t) => {
719
+ ), Qn = new DataView(new ArrayBuffer(4)), To = (e) => (Qn.setFloat32(0, e), Qn.getFloat32(0) === e), Yt = (e, t) => {
720
720
  switch (typeof t) {
721
721
  case "string":
722
722
  E(e, 119), lt(e, t);
723
723
  break;
724
724
  case "number":
725
- fo(t) && ue(t) <= uo ? (E(e, 125), kn(e, t)) : To(t) ? (E(e, 124), Mo(e, t)) : (E(e, 123), xo(e, t));
725
+ fo(t) && de(t) <= uo ? (E(e, 125), kn(e, t)) : To(t) ? (E(e, 124), Mo(e, t)) : (E(e, 123), xo(e, t));
726
726
  break;
727
727
  case "bigint":
728
728
  E(e, 122), Uo(e, t);
@@ -733,7 +733,7 @@ Vt.encodeInto ? Io : vo, ve = (e, t) => {
733
733
  else if (ji(t)) {
734
734
  E(e, 117), m(e, t.length);
735
735
  for (let n = 0; n < t.length; n++)
736
- zt(e, t[n]);
736
+ Yt(e, t[n]);
737
737
  } else if (t instanceof Uint8Array)
738
738
  E(e, 116), L(e, t);
739
739
  else {
@@ -742,7 +742,7 @@ Vt.encodeInto ? Io : vo, ve = (e, t) => {
742
742
  m(e, n.length);
743
743
  for (let s = 0; s < n.length; s++) {
744
744
  const r = n[s];
745
- lt(e, r), zt(e, t[r]);
745
+ lt(e, r), Yt(e, t[r]);
746
746
  }
747
747
  }
748
748
  break;
@@ -753,7 +753,7 @@ Vt.encodeInto ? Io : vo, ve = (e, t) => {
753
753
  E(e, 127);
754
754
  }
755
755
  };
756
- class ts extends Gt {
756
+ class ts extends qt {
757
757
  /**
758
758
  * @param {function(Encoder, T):void} writer
759
759
  */
@@ -770,9 +770,9 @@ class ts extends Gt {
770
770
  const es = (e) => {
771
771
  e.count > 0 && (kn(e.encoder, e.count === 1 ? e.s : -e.s), e.count > 1 && m(e.encoder, e.count - 2));
772
772
  };
773
- class fe {
773
+ class ge {
774
774
  constructor() {
775
- this.encoder = new Gt(), this.s = 0, this.count = 0;
775
+ this.encoder = new qt(), this.s = 0, this.count = 0;
776
776
  }
777
777
  /**
778
778
  * @param {number} v
@@ -792,7 +792,7 @@ const ns = (e) => {
792
792
  };
793
793
  class je {
794
794
  constructor() {
795
- this.encoder = new Gt(), this.s = 0, this.count = 0, this.diff = 0;
795
+ this.encoder = new qt(), this.s = 0, this.count = 0, this.diff = 0;
796
796
  }
797
797
  /**
798
798
  * @param {number} v
@@ -806,7 +806,7 @@ class je {
806
806
  }
807
807
  class Oo {
808
808
  constructor() {
809
- this.sarr = [], this.s = "", this.lensE = new fe();
809
+ this.sarr = [], this.s = "", this.lensE = new ge();
810
810
  }
811
811
  /**
812
812
  * @param {string} string
@@ -815,15 +815,15 @@ class Oo {
815
815
  this.s += t, this.s.length > 19 && (this.sarr.push(this.s), this.s = ""), this.lensE.write(t.length);
816
816
  }
817
817
  toUint8Array() {
818
- const t = new Gt();
819
- return this.sarr.push(this.s), this.s = "", lt(t, this.sarr.join("")), ve(t, this.lensE.toUint8Array()), $(t);
818
+ const t = new qt();
819
+ return this.sarr.push(this.s), this.s = "", lt(t, this.sarr.join("")), Me(t, this.lensE.toUint8Array()), $(t);
820
820
  }
821
821
  }
822
822
  const Ro = crypto.getRandomValues.bind(crypto), Ns = () => Ro(new Uint32Array(1))[0], $o = [1e7] + -1e3 + -4e3 + -8e3 + -1e11, No = () => $o.replace(
823
823
  /[018]/g,
824
824
  /** @param {number} c */
825
825
  (e) => (e ^ Ns() & 15 >> e / 4).toString(16)
826
- ), me = Date.now, vt = (e) => (
826
+ ), ye = Date.now, Mt = (e) => (
827
827
  /** @type {Promise<T>} */
828
828
  new Promise(e)
829
829
  );
@@ -839,7 +839,7 @@ class Bo {
839
839
  }
840
840
  const X = (e, t) => new Bo(e, t);
841
841
  typeof DOMParser < "u" && new DOMParser();
842
- const Ho = (e) => Hi(e, (t, n) => `${n}:${t};`).join(""), q = Symbol, Bs = q(), Hs = q(), Vo = q(), Fo = q(), jo = q(), Vs = q(), Ko = q(), Fs = q(), zo = q(), Yo = (e) => {
842
+ const Vo = (e) => Vi(e, (t, n) => `${n}:${t};`).join(""), q = Symbol, Bs = q(), Vs = q(), Fo = q(), Ho = q(), jo = q(), Fs = q(), Ko = q(), Hs = q(), zo = q(), Yo = (e) => {
843
843
  const t = [];
844
844
  let n = 0;
845
845
  for (; n < e.length; n++) {
@@ -849,13 +849,13 @@ const Ho = (e) => Hi(e, (t, n) => `${n}:${t};`).join(""), q = Symbol, Bs = q(),
849
849
  return t;
850
850
  }, Xo = {
851
851
  [Bs]: X("font-weight", "bold"),
852
- [Hs]: X("font-weight", "normal"),
853
- [Vo]: X("color", "blue"),
852
+ [Vs]: X("font-weight", "normal"),
853
+ [Fo]: X("color", "blue"),
854
854
  [jo]: X("color", "green"),
855
- [Fo]: X("color", "grey"),
856
- [Vs]: X("color", "red"),
855
+ [Ho]: X("color", "grey"),
856
+ [Fs]: X("color", "red"),
857
857
  [Ko]: X("color", "purple"),
858
- [Fs]: X("color", "orange"),
858
+ [Hs]: X("color", "orange"),
859
859
  // not well supported in chrome when debugging node with inspector - TODO: deprecate
860
860
  [zo]: X("color", "black")
861
861
  }, Jo = (e) => {
@@ -866,7 +866,7 @@ const Ho = (e) => Hi(e, (t, n) => `${n}:${t};`).join(""), q = Symbol, Bs = q(),
866
866
  if (c !== void 0)
867
867
  s.set(c.left, c.right);
868
868
  else if (o.constructor === String || o.constructor === Number) {
869
- const l = Ho(s);
869
+ const l = Vo(s);
870
870
  i > 0 || l.length > 0 ? (t.push("%c" + o), n.push(l)) : t.push(o);
871
871
  } else
872
872
  break;
@@ -878,7 +878,7 @@ const Ho = (e) => Hi(e, (t, n) => `${n}:${t};`).join(""), q = Symbol, Bs = q(),
878
878
  return r;
879
879
  }, Wo = ho ? Jo : Yo, Po = (...e) => {
880
880
  console.log(...Wo(e)), Go.forEach((t) => t.print(e));
881
- }, Go = Lt(), js = (e) => ({
881
+ }, Go = It(), js = (e) => ({
882
882
  /**
883
883
  * @return {IterableIterator<T>}
884
884
  */
@@ -906,7 +906,7 @@ class En {
906
906
  this.clock = t, this.len = n;
907
907
  }
908
908
  }
909
- class Zt {
909
+ class Qt {
910
910
  constructor() {
911
911
  this.clients = /* @__PURE__ */ new Map();
912
912
  }
@@ -946,23 +946,23 @@ const Ks = (e, t, n) => t.clients.forEach((s, r) => {
946
946
  t.length = s;
947
947
  });
948
948
  }, Qo = (e) => {
949
- const t = new Zt();
949
+ const t = new Qt();
950
950
  for (let n = 0; n < e.length; n++)
951
951
  e[n].clients.forEach((s, r) => {
952
952
  if (!t.clients.has(r)) {
953
953
  const i = s.slice();
954
954
  for (let o = n + 1; o < e.length; o++)
955
- Fi(i, e[o].clients.get(r) || []);
955
+ Hi(i, e[o].clients.get(r) || []);
956
956
  t.clients.set(r, i);
957
957
  }
958
958
  });
959
959
  return Cn(t), t;
960
- }, ye = (e, t, n, s) => {
960
+ }, be = (e, t, n, s) => {
961
961
  rt(e.clients, t, () => (
962
962
  /** @type {Array<DeleteItem>} */
963
963
  []
964
964
  )).push(new En(n, s));
965
- }, tc = () => new Zt(), ec = (e) => {
965
+ }, tc = () => new Qt(), ec = (e) => {
966
966
  const t = tc();
967
967
  return e.clients.forEach((n, s) => {
968
968
  const r = [];
@@ -979,7 +979,7 @@ const Ks = (e, t, n) => t.clients.forEach((s, r) => {
979
979
  }
980
980
  r.length > 0 && t.clients.set(s, r);
981
981
  }), t;
982
- }, Ut = (e, t) => {
982
+ }, Tt = (e, t) => {
983
983
  m(e.restEncoder, t.clients.size), nt(t.clients.entries()).sort((n, s) => s[0] - n[0]).forEach(([n, s]) => {
984
984
  e.resetDsCurVal(), m(e.restEncoder, n);
985
985
  const r = s.length;
@@ -990,7 +990,7 @@ const Ks = (e, t, n) => t.clients.forEach((s, r) => {
990
990
  }
991
991
  });
992
992
  }, An = (e) => {
993
- const t = new Zt(), n = w(e.restDecoder);
993
+ const t = new Qt(), n = w(e.restDecoder);
994
994
  for (let s = 0; s < n; s++) {
995
995
  e.resetDsCurVal();
996
996
  const r = w(e.restDecoder), i = w(e.restDecoder);
@@ -1005,24 +1005,24 @@ const Ks = (e, t, n) => t.clients.forEach((s, r) => {
1005
1005
  }
1006
1006
  return t;
1007
1007
  }, ss = (e, t, n) => {
1008
- const s = new Zt(), r = w(e.restDecoder);
1008
+ const s = new Qt(), r = w(e.restDecoder);
1009
1009
  for (let i = 0; i < r; i++) {
1010
1010
  e.resetDsCurVal();
1011
1011
  const o = w(e.restDecoder), c = w(e.restDecoder), l = n.clients.get(o) || [], a = C(n, o);
1012
1012
  for (let h = 0; h < c; h++) {
1013
1013
  const d = e.readDsClock(), u = d + e.readDsLen();
1014
1014
  if (d < a) {
1015
- a < u && ye(s, o, a, u - a);
1015
+ a < u && be(s, o, a, u - a);
1016
1016
  let f = K(l, d), g = l[f];
1017
- for (!g.deleted && g.id.clock < d && (l.splice(f + 1, 0, Ce(t, g, d - g.id.clock)), f++); f < l.length && (g = l[f++], g.id.clock < u); )
1018
- g.deleted || (u < g.id.clock + g.length && l.splice(f, 0, Ce(t, g, u - g.id.clock)), g.delete(t));
1017
+ for (!g.deleted && g.id.clock < d && (l.splice(f + 1, 0, Ae(t, g, d - g.id.clock)), f++); f < l.length && (g = l[f++], g.id.clock < u); )
1018
+ g.deleted || (u < g.id.clock + g.length && l.splice(f, 0, Ae(t, g, u - g.id.clock)), g.delete(t));
1019
1019
  } else
1020
- ye(s, o, d, u - d);
1020
+ be(s, o, d, u - d);
1021
1021
  }
1022
1022
  }
1023
1023
  if (s.clients.size > 0) {
1024
1024
  const i = new at();
1025
- return m(i.restEncoder, 0), Ut(i, s), i.toUint8Array();
1025
+ return m(i.restEncoder, 0), Tt(i, s), i.toUint8Array();
1026
1026
  }
1027
1027
  return null;
1028
1028
  }, Ys = Ns;
@@ -1031,12 +1031,12 @@ class wt extends mn {
1031
1031
  * @param {DocOpts} opts configuration
1032
1032
  */
1033
1033
  constructor({ guid: t = No(), collectionid: n = null, gc: s = !0, gcFilter: r = () => !0, meta: i = null, autoLoad: o = !1, shouldLoad: c = !0 } = {}) {
1034
- super(), this.gc = s, this.gcFilter = r, this.clientID = Ys(), this.guid = t, this.collectionid = n, this.share = /* @__PURE__ */ new Map(), this.store = new er(), 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.whenLoaded = vt((a) => {
1034
+ super(), this.gc = s, this.gcFilter = r, this.clientID = Ys(), this.guid = t, this.collectionid = n, this.share = /* @__PURE__ */ new Map(), this.store = new er(), 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.whenLoaded = Mt((a) => {
1035
1035
  this.on("load", () => {
1036
1036
  this.isLoaded = !0, a(this);
1037
1037
  });
1038
1038
  });
1039
- const l = () => vt((a) => {
1039
+ const l = () => Mt((a) => {
1040
1040
  const h = (d) => {
1041
1041
  (d === void 0 || d === !0) && (this.off("sync", h), a());
1042
1042
  };
@@ -1152,7 +1152,7 @@ class wt extends mn {
1152
1152
  * @public
1153
1153
  */
1154
1154
  getText(t = "") {
1155
- return this.get(t, xt);
1155
+ return this.get(t, Ut);
1156
1156
  }
1157
1157
  /**
1158
1158
  * @template T
@@ -1273,7 +1273,7 @@ class Js extends Xs {
1273
1273
  * @return {number} info An unsigned 8-bit integer
1274
1274
  */
1275
1275
  readInfo() {
1276
- return It(this.restDecoder);
1276
+ return vt(this.restDecoder);
1277
1277
  }
1278
1278
  /**
1279
1279
  * @return {string}
@@ -1305,7 +1305,7 @@ class Js extends Xs {
1305
1305
  * @return {any}
1306
1306
  */
1307
1307
  readAny() {
1308
- return Kt(this.restDecoder);
1308
+ return zt(this.restDecoder);
1309
1309
  }
1310
1310
  /**
1311
1311
  * @return {Uint8Array}
@@ -1352,12 +1352,12 @@ class nc {
1352
1352
  return this.dsCurrVal += t, t;
1353
1353
  }
1354
1354
  }
1355
- class Mt extends nc {
1355
+ class xt extends nc {
1356
1356
  /**
1357
1357
  * @param {decoding.Decoder} decoder
1358
1358
  */
1359
1359
  constructor(t) {
1360
- super(t), this.keys = [], w(t), this.keyClockDecoder = new Fe(I(t)), this.clientDecoder = new de(I(t)), this.leftClockDecoder = new Fe(I(t)), this.rightClockDecoder = new Fe(I(t)), this.infoDecoder = new Zn(I(t), It), this.stringDecoder = new ko(I(t)), this.parentInfoDecoder = new Zn(I(t), It), this.typeRefDecoder = new de(I(t)), this.lenDecoder = new de(I(t));
1360
+ super(t), this.keys = [], w(t), this.keyClockDecoder = new He(I(t)), this.clientDecoder = new fe(I(t)), this.leftClockDecoder = new He(I(t)), this.rightClockDecoder = new He(I(t)), this.infoDecoder = new Zn(I(t), vt), this.stringDecoder = new ko(I(t)), this.parentInfoDecoder = new Zn(I(t), vt), this.typeRefDecoder = new fe(I(t)), this.lenDecoder = new fe(I(t));
1361
1361
  }
1362
1362
  /**
1363
1363
  * @return {ID}
@@ -1417,7 +1417,7 @@ class Mt extends nc {
1417
1417
  * @return {any}
1418
1418
  */
1419
1419
  readAny() {
1420
- return Kt(this.restDecoder);
1420
+ return zt(this.restDecoder);
1421
1421
  }
1422
1422
  /**
1423
1423
  * @return {Uint8Array}
@@ -1433,7 +1433,7 @@ class Mt extends nc {
1433
1433
  * @return {any}
1434
1434
  */
1435
1435
  readJSON() {
1436
- return Kt(this.restDecoder);
1436
+ return zt(this.restDecoder);
1437
1437
  }
1438
1438
  /**
1439
1439
  * @return {string}
@@ -1450,7 +1450,7 @@ class Mt extends nc {
1450
1450
  }
1451
1451
  class Ws {
1452
1452
  constructor() {
1453
- this.restEncoder = qt();
1453
+ this.restEncoder = Zt();
1454
1454
  }
1455
1455
  toUint8Array() {
1456
1456
  return $(this.restEncoder);
@@ -1470,7 +1470,7 @@ class Ws {
1470
1470
  m(this.restEncoder, t);
1471
1471
  }
1472
1472
  }
1473
- class Qt extends Ws {
1473
+ class te extends Ws {
1474
1474
  /**
1475
1475
  * @param {ID} id
1476
1476
  */
@@ -1526,7 +1526,7 @@ class Qt extends Ws {
1526
1526
  * @param {any} any
1527
1527
  */
1528
1528
  writeAny(t) {
1529
- zt(this.restEncoder, t);
1529
+ Yt(this.restEncoder, t);
1530
1530
  }
1531
1531
  /**
1532
1532
  * @param {Uint8Array} buf
@@ -1549,7 +1549,7 @@ class Qt extends Ws {
1549
1549
  }
1550
1550
  class Ps {
1551
1551
  constructor() {
1552
- this.restEncoder = qt(), this.dsCurrVal = 0;
1552
+ this.restEncoder = Zt(), this.dsCurrVal = 0;
1553
1553
  }
1554
1554
  toUint8Array() {
1555
1555
  return $(this.restEncoder);
@@ -1573,11 +1573,11 @@ class Ps {
1573
1573
  }
1574
1574
  class at extends Ps {
1575
1575
  constructor() {
1576
- super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new je(), this.clientEncoder = new fe(), this.leftClockEncoder = new je(), this.rightClockEncoder = new je(), this.infoEncoder = new ts(rn), this.stringEncoder = new Oo(), this.parentInfoEncoder = new ts(rn), this.typeRefEncoder = new fe(), this.lenEncoder = new fe();
1576
+ super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new je(), this.clientEncoder = new ge(), this.leftClockEncoder = new je(), this.rightClockEncoder = new je(), this.infoEncoder = new ts(rn), this.stringEncoder = new Oo(), this.parentInfoEncoder = new ts(rn), this.typeRefEncoder = new ge(), this.lenEncoder = new ge();
1577
1577
  }
1578
1578
  toUint8Array() {
1579
- const t = qt();
1580
- return m(t, 0), L(t, this.keyClockEncoder.toUint8Array()), L(t, this.clientEncoder.toUint8Array()), L(t, this.leftClockEncoder.toUint8Array()), L(t, this.rightClockEncoder.toUint8Array()), L(t, $(this.infoEncoder)), L(t, this.stringEncoder.toUint8Array()), L(t, $(this.parentInfoEncoder)), L(t, this.typeRefEncoder.toUint8Array()), L(t, this.lenEncoder.toUint8Array()), ve(t, $(this.restEncoder)), $(t);
1579
+ const t = Zt();
1580
+ return m(t, 0), L(t, this.keyClockEncoder.toUint8Array()), L(t, this.clientEncoder.toUint8Array()), L(t, this.leftClockEncoder.toUint8Array()), L(t, this.rightClockEncoder.toUint8Array()), L(t, $(this.infoEncoder)), L(t, this.stringEncoder.toUint8Array()), L(t, $(this.parentInfoEncoder)), L(t, this.typeRefEncoder.toUint8Array()), L(t, this.lenEncoder.toUint8Array()), Me(t, $(this.restEncoder)), $(t);
1581
1581
  }
1582
1582
  /**
1583
1583
  * @param {ID} id
@@ -1633,7 +1633,7 @@ class at extends Ps {
1633
1633
  * @param {any} any
1634
1634
  */
1635
1635
  writeAny(t) {
1636
- zt(this.restEncoder, t);
1636
+ Yt(this.restEncoder, t);
1637
1637
  }
1638
1638
  /**
1639
1639
  * @param {Uint8Array} buf
@@ -1649,7 +1649,7 @@ class at extends Ps {
1649
1649
  * @param {any} embed
1650
1650
  */
1651
1651
  writeJSON(t) {
1652
- zt(this.restEncoder, t);
1652
+ Yt(this.restEncoder, t);
1653
1653
  }
1654
1654
  /**
1655
1655
  * Property keys are often reused. For example, in y-prosemirror the key `bold` might
@@ -1676,7 +1676,7 @@ const sc = (e, t, n, s) => {
1676
1676
  const s = /* @__PURE__ */ new Map();
1677
1677
  n.forEach((r, i) => {
1678
1678
  C(t, i) > r && s.set(i, r);
1679
- }), Me(t).forEach((r, i) => {
1679
+ }), xe(t).forEach((r, i) => {
1680
1680
  n.has(i) || s.set(i, 0);
1681
1681
  }), m(e.restEncoder, s.size), nt(s.entries()).sort((r, i) => i[0] - r[0]).forEach(([r, i]) => {
1682
1682
  sc(
@@ -1695,7 +1695,7 @@ const sc = (e, t, n, s) => {
1695
1695
  n.set(c, { i: 0, refs: o });
1696
1696
  for (let a = 0; a < i; a++) {
1697
1697
  const h = e.readInfo();
1698
- switch (Le & h) {
1698
+ switch (Ie & h) {
1699
1699
  case 0: {
1700
1700
  const d = e.readLen();
1701
1701
  o[a] = new U(b(c, l), d), l += d;
@@ -1719,7 +1719,7 @@ const sc = (e, t, n, s) => {
1719
1719
  // right origin
1720
1720
  d ? e.readParentInfo() ? t.get(e.readString()) : e.readLeftID() : null,
1721
1721
  // parent
1722
- d && (h & jt) === jt ? e.readString() : null,
1722
+ d && (h & Kt) === Kt ? e.readString() : null,
1723
1723
  // parentSub
1724
1724
  kr(e, h)
1725
1725
  // item content
@@ -1816,7 +1816,7 @@ const sc = (e, t, n, s) => {
1816
1816
  return Ln(f, c, /* @__PURE__ */ new Map()), m(f.restEncoder, 0), { missing: l, update: f.toUint8Array() };
1817
1817
  }
1818
1818
  return null;
1819
- }, oc = (e, t) => Ln(e, t.doc.store, t.beforeState), cc = (e, t, n, s = new Mt(e)) => S(t, (r) => {
1819
+ }, oc = (e, t) => Ln(e, t.doc.store, t.beforeState), cc = (e, t, n, s = new xt(e)) => S(t, (r) => {
1820
1820
  r.local = !1;
1821
1821
  let i = !1;
1822
1822
  const o = r.doc, c = o.store, l = rc(s, o), a = ic(r, c, l), h = c.pendingStructs;
@@ -1831,16 +1831,16 @@ const sc = (e, t, n, s) => {
1831
1831
  const g = h.missing.get(u);
1832
1832
  (g == null || g > f) && h.missing.set(u, f);
1833
1833
  }
1834
- h.update = be([h.update, a.update]);
1834
+ h.update = Se([h.update, a.update]);
1835
1835
  }
1836
1836
  } else
1837
1837
  c.pendingStructs = a;
1838
1838
  const d = ss(s, r, c);
1839
1839
  if (c.pendingDs) {
1840
- const u = new Mt(pt(c.pendingDs));
1840
+ const u = new xt(pt(c.pendingDs));
1841
1841
  w(u.restDecoder);
1842
1842
  const f = ss(u, r, c);
1843
- d && f ? c.pendingDs = be([d, f]) : c.pendingDs = d || f;
1843
+ d && f ? c.pendingDs = Se([d, f]) : c.pendingDs = d || f;
1844
1844
  } else
1845
1845
  c.pendingDs = d;
1846
1846
  if (i) {
@@ -1850,23 +1850,23 @@ const sc = (e, t, n, s) => {
1850
1850
  );
1851
1851
  c.pendingStructs = null, Gs(r.doc, u);
1852
1852
  }
1853
- }, n, !1), Gs = (e, t, n, s = Mt) => {
1853
+ }, n, !1), Gs = (e, t, n, s = xt) => {
1854
1854
  const r = pt(t);
1855
1855
  cc(r, e, n, new s(r));
1856
1856
  }, qs = (e, t, n) => Gs(e, t, n, Js), lc = (e, t, n = /* @__PURE__ */ new Map()) => {
1857
- Ln(e, t.store, n), Ut(e, ec(t.store));
1857
+ Ln(e, t.store, n), Tt(e, ec(t.store));
1858
1858
  }, ac = (e, t = new Uint8Array([0]), n = new at()) => {
1859
1859
  const s = Zs(t);
1860
1860
  lc(n, e, s);
1861
1861
  const r = [n.toUint8Array()];
1862
1862
  if (e.store.pendingDs && r.push(e.store.pendingDs), e.store.pendingStructs && r.push(Ec(e.store.pendingStructs.update, t)), r.length > 1) {
1863
- if (n.constructor === Qt)
1863
+ if (n.constructor === te)
1864
1864
  return kc(r.map((i, o) => o === 0 ? i : Ac(i)));
1865
1865
  if (n.constructor === at)
1866
- return be(r);
1866
+ return Se(r);
1867
1867
  }
1868
1868
  return r[0];
1869
- }, In = (e, t) => ac(e, t, new Qt()), hc = (e) => {
1869
+ }, In = (e, t) => ac(e, t, new te()), hc = (e) => {
1870
1870
  const t = /* @__PURE__ */ new Map(), n = w(e.restDecoder);
1871
1871
  for (let s = 0; s < n; s++) {
1872
1872
  const r = w(e.restDecoder), i = w(e.restDecoder);
@@ -1875,7 +1875,7 @@ const sc = (e, t, n, s) => {
1875
1875
  return t;
1876
1876
  }, Zs = (e) => hc(new Xs(pt(e))), Qs = (e, t) => (m(e.restEncoder, t.size), nt(t.entries()).sort((n, s) => s[0] - n[0]).forEach(([n, s]) => {
1877
1877
  m(e.restEncoder, n), m(e.restEncoder, s);
1878
- }), e), uc = (e, t) => Qs(e, Me(t.store)), dc = (e, t = new Ps()) => (e instanceof Map ? Qs(t, e) : uc(t, e), t.toUint8Array()), fc = (e) => dc(e, new Ws());
1878
+ }), e), uc = (e, t) => Qs(e, xe(t.store)), dc = (e, t = new Ps()) => (e instanceof Map ? Qs(t, e) : uc(t, e), t.toUint8Array()), fc = (e) => dc(e, new Ws());
1879
1879
  class gc {
1880
1880
  constructor() {
1881
1881
  this.l = [];
@@ -1894,13 +1894,13 @@ class Dt {
1894
1894
  this.client = t, this.clock = n;
1895
1895
  }
1896
1896
  }
1897
- const oe = (e, t) => e === t || e !== null && t !== null && e.client === t.client && e.clock === t.clock, b = (e, t) => new Dt(e, t), pc = (e) => {
1897
+ const ce = (e, t) => e === t || e !== null && t !== null && e.client === t.client && e.clock === t.clock, b = (e, t) => new Dt(e, t), pc = (e) => {
1898
1898
  for (const [t, n] of e.doc.share.entries())
1899
1899
  if (n === e)
1900
1900
  return t;
1901
1901
  throw j();
1902
1902
  }, St = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.get(e.id.client) || 0) > e.id.clock && !zs(t.ds, e.id), cn = (e, t) => {
1903
- const n = rt(e.meta, cn, Lt), s = e.doc.store;
1903
+ const n = rt(e.meta, cn, It), s = e.doc.store;
1904
1904
  n.has(t) || (t.sv.forEach((r, i) => {
1905
1905
  r < C(s, i) && st(e, b(i, r));
1906
1906
  }), Ks(e, t.ds, (r) => {
@@ -1911,7 +1911,7 @@ class er {
1911
1911
  this.clients = /* @__PURE__ */ new Map(), this.pendingStructs = null, this.pendingDs = null;
1912
1912
  }
1913
1913
  }
1914
- const Me = (e) => {
1914
+ const xe = (e) => {
1915
1915
  const t = /* @__PURE__ */ new Map();
1916
1916
  return e.clients.forEach((n, s) => {
1917
1917
  const r = n[n.length - 1];
@@ -1956,7 +1956,7 @@ const Me = (e) => {
1956
1956
  wc
1957
1957
  ), ln = (e, t, n) => {
1958
1958
  const s = K(t, n), r = t[s];
1959
- return r.id.clock < n && r instanceof k ? (t.splice(s + 1, 0, Ce(e, r, n - r.id.clock)), s + 1) : s;
1959
+ return r.id.clock < n && r instanceof k ? (t.splice(s + 1, 0, Ae(e, r, n - r.id.clock)), s + 1) : s;
1960
1960
  }, st = (e, t) => {
1961
1961
  const n = (
1962
1962
  /** @type {Array<Item>} */
@@ -1965,7 +1965,7 @@ const Me = (e) => {
1965
1965
  return n[ln(e, n, t.clock)];
1966
1966
  }, cs = (e, t, n) => {
1967
1967
  const s = t.clients.get(n.client), r = K(s, n.clock), i = s[r];
1968
- return n.clock !== i.id.clock + i.length - 1 && i.constructor !== U && s.splice(r + 1, 0, Ce(e, i, n.clock - i.id.clock + 1)), i;
1968
+ return n.clock !== i.id.clock + i.length - 1 && i.constructor !== U && s.splice(r + 1, 0, Ae(e, i, n.clock - i.id.clock + 1)), i;
1969
1969
  }, mc = (e, t, n) => {
1970
1970
  const s = (
1971
1971
  /** @type {Array<GC|Item>} */
@@ -1988,13 +1988,13 @@ class yc {
1988
1988
  * @param {boolean} local
1989
1989
  */
1990
1990
  constructor(t, n, s) {
1991
- this.doc = t, this.deleteSet = new Zt(), this.beforeState = Me(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;
1991
+ this.doc = t, this.deleteSet = new Qt(), this.beforeState = xe(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;
1992
1992
  }
1993
1993
  }
1994
- const ls = (e, t) => t.deleteSet.clients.size === 0 && !Vi(t.afterState, (n, s) => t.beforeState.get(s) !== n) ? !1 : (Cn(t.deleteSet), oc(e, t), Ut(e, t.deleteSet), !0), as = (e, t, n) => {
1994
+ const ls = (e, t) => t.deleteSet.clients.size === 0 && !Fi(t.afterState, (n, s) => t.beforeState.get(s) !== n) ? !1 : (Cn(t.deleteSet), oc(e, t), Tt(e, t.deleteSet), !0), as = (e, t, n) => {
1995
1995
  const s = t._item;
1996
- (s === null || s.id.clock < (e.beforeState.get(s.id.client) || 0) && !s.deleted) && rt(e.changed, t, Lt).add(n);
1997
- }, ge = (e, t) => {
1996
+ (s === null || s.id.clock < (e.beforeState.get(s.id.client) || 0) && !s.deleted) && rt(e.changed, t, It).add(n);
1997
+ }, pe = (e, t) => {
1998
1998
  let n = e[t], s = e[t - 1], r = t;
1999
1999
  for (; r > 0; n = s, s = e[--r - 1]) {
2000
2000
  if (s.deleted === n.deleted && s.constructor === n.constructor && s.mergeWith(n)) {
@@ -2035,14 +2035,14 @@ const ls = (e, t) => t.deleteSet.clients.size === 0 && !Vi(t.afterState, (n, s)
2035
2035
  for (let i = n.length - 1; i >= 0; i--) {
2036
2036
  const o = n[i], c = Ms(r.length - 1, 1 + K(r, o.clock + o.len - 1));
2037
2037
  for (let l = c, a = r[l]; l > 0 && a.id.clock >= o.clock; a = r[l])
2038
- l -= 1 + ge(r, l);
2038
+ l -= 1 + pe(r, l);
2039
2039
  }
2040
2040
  });
2041
2041
  }, rr = (e, t) => {
2042
2042
  if (t < e.length) {
2043
2043
  const n = e[t], s = n.doc, r = s.store, i = n.deleteSet, o = n._mergeStructs;
2044
2044
  try {
2045
- Cn(i), n.afterState = Me(n.doc.store), s.emit("beforeObserverCalls", [n, s]);
2045
+ Cn(i), n.afterState = xe(n.doc.store), s.emit("beforeObserverCalls", [n, s]);
2046
2046
  const c = [];
2047
2047
  n.changed.forEach(
2048
2048
  (l, a) => c.push(() => {
@@ -2056,7 +2056,7 @@ const ls = (e, t) => t.deleteSet.clients.size === 0 && !Vi(t.afterState, (n, s)
2056
2056
  h.currentTarget = a, h._path = null;
2057
2057
  }), l.sort((h, d) => h.path.length - d.path.length), tr(a._dEH, l, n));
2058
2058
  });
2059
- }), c.push(() => s.emit("afterTransaction", [n, s])), yn(c, []), n._needFormattingCleanup && Vc(n);
2059
+ }), c.push(() => s.emit("afterTransaction", [n, s])), yn(c, []), n._needFormattingCleanup && Fc(n);
2060
2060
  } finally {
2061
2061
  s.gc && bc(i, r, s.gcFilter), Sc(i, r), n.afterState.forEach((h, d) => {
2062
2062
  const u = n.beforeState.get(d) || 0;
@@ -2066,7 +2066,7 @@ const ls = (e, t) => t.deleteSet.clients.size === 0 && !Vi(t.afterState, (n, s)
2066
2066
  r.clients.get(d)
2067
2067
  ), g = gt(K(f, u), 1);
2068
2068
  for (let p = f.length - 1; p >= g; )
2069
- p -= 1 + ge(f, p);
2069
+ p -= 1 + pe(f, p);
2070
2070
  }
2071
2071
  });
2072
2072
  for (let h = o.length - 1; h >= 0; h--) {
@@ -2074,10 +2074,10 @@ const ls = (e, t) => t.deleteSet.clients.size === 0 && !Vi(t.afterState, (n, s)
2074
2074
  /** @type {Array<GC|Item>} */
2075
2075
  r.clients.get(d)
2076
2076
  ), g = K(f, u);
2077
- g + 1 < f.length && ge(f, g + 1) > 1 || g > 0 && ge(f, g);
2077
+ g + 1 < f.length && pe(f, g + 1) > 1 || g > 0 && pe(f, g);
2078
2078
  }
2079
- if (!n.local && n.afterState.get(s.clientID) !== n.beforeState.get(s.clientID) && (Po(Fs, Bs, "[yjs] ", Hs, Vs, "Changed the client-id because another client seems to be using it."), s.clientID = Ys()), s.emit("afterTransactionCleanup", [n, s]), s._observers.has("update")) {
2080
- const h = new Qt();
2079
+ if (!n.local && n.afterState.get(s.clientID) !== n.beforeState.get(s.clientID) && (Po(Hs, Bs, "[yjs] ", Vs, Fs, "Changed the client-id because another client seems to be using it."), s.clientID = Ys()), s.emit("afterTransactionCleanup", [n, s]), s._observers.has("update")) {
2080
+ const h = new te();
2081
2081
  ls(h, n) && s.emit("update", [h.toUint8Array(), n.origin, s, n]);
2082
2082
  }
2083
2083
  if (s._observers.has("updateV2")) {
@@ -2114,7 +2114,7 @@ function* _c(e) {
2114
2114
  if (c === 10) {
2115
2115
  const l = w(e.restDecoder);
2116
2116
  yield new T(b(r, i), l), i += l;
2117
- } else if (Le & c) {
2117
+ } else if (Ie & c) {
2118
2118
  const l = (c & (J | M)) === 0, a = new k(
2119
2119
  b(r, i),
2120
2120
  null,
@@ -2128,7 +2128,7 @@ function* _c(e) {
2128
2128
  // @ts-ignore Force writing a string here.
2129
2129
  l ? e.readParentInfo() ? e.readString() : e.readLeftID() : null,
2130
2130
  // parent
2131
- l && (c & jt) === jt ? e.readString() : null,
2131
+ l && (c & Kt) === Kt ? e.readString() : null,
2132
2132
  // parentSub
2133
2133
  kr(e, c)
2134
2134
  // item content
@@ -2167,7 +2167,7 @@ class Mn {
2167
2167
  this.currClient = 0, this.startClock = 0, this.written = 0, this.encoder = t, this.clientStructs = [];
2168
2168
  }
2169
2169
  }
2170
- const kc = (e) => be(e, Js, Qt), Dc = (e, t) => {
2170
+ const kc = (e) => Se(e, Js, te), Dc = (e, t) => {
2171
2171
  if (e.constructor === U) {
2172
2172
  const { client: n, clock: s } = e.id;
2173
2173
  return new U(b(n, s + t), e.length - t);
@@ -2190,7 +2190,7 @@ const kc = (e) => be(e, Js, Qt), Dc = (e, t) => {
2190
2190
  n.content.splice(t)
2191
2191
  );
2192
2192
  }
2193
- }, be = (e, t = Mt, n = at) => {
2193
+ }, Se = (e, t = xt, n = at) => {
2194
2194
  if (e.length === 1)
2195
2195
  return e[0];
2196
2196
  const s = e.map((h) => new t(pt(h)));
@@ -2248,8 +2248,8 @@ const kc = (e) => be(e, Js, Qt), Dc = (e, t) => {
2248
2248
  }
2249
2249
  i !== null && (Q(c, i.struct, i.offset), i = null), xn(c);
2250
2250
  const l = s.map((h) => An(h)), a = Qo(l);
2251
- return Ut(o, a), o.toUint8Array();
2252
- }, Ec = (e, t, n = Mt, s = at) => {
2251
+ return Tt(o, a), o.toUint8Array();
2252
+ }, Ec = (e, t, n = xt, s = at) => {
2253
2253
  const r = Zs(t), i = new s(), o = new Mn(i), c = new n(pt(e)), l = new vn(c, !1);
2254
2254
  for (; l.curr; ) {
2255
2255
  const h = l.curr, d = h.id.client, u = r.get(d) || 0;
@@ -2266,9 +2266,9 @@ const kc = (e) => be(e, Js, Qt), Dc = (e, t) => {
2266
2266
  }
2267
2267
  xn(o);
2268
2268
  const a = An(c);
2269
- return Ut(i, a), i.toUint8Array();
2269
+ return Tt(i, a), i.toUint8Array();
2270
2270
  }, ir = (e) => {
2271
- e.written > 0 && (e.clientStructs.push({ written: e.written, restEncoder: $(e.encoder.restEncoder) }), e.encoder.restEncoder = qt(), e.written = 0);
2271
+ e.written > 0 && (e.clientStructs.push({ written: e.written, restEncoder: $(e.encoder.restEncoder) }), e.encoder.restEncoder = Zt(), e.written = 0);
2272
2272
  }, Q = (e, t, n) => {
2273
2273
  e.written > 0 && e.currClient !== t.id.client && ir(e), e.written === 0 && (e.currClient = t.id.client, e.encoder.writeClient(t.id.client), m(e.encoder.restEncoder, t.id.clock + n)), t.write(e.encoder, n), e.written++;
2274
2274
  }, xn = (e) => {
@@ -2277,7 +2277,7 @@ const kc = (e) => be(e, Js, Qt), Dc = (e, t) => {
2277
2277
  m(t, e.clientStructs.length);
2278
2278
  for (let n = 0; n < e.clientStructs.length; n++) {
2279
2279
  const s = e.clientStructs[n];
2280
- m(t, s.written), ve(t, s.restEncoder);
2280
+ m(t, s.written), Me(t, s.restEncoder);
2281
2281
  }
2282
2282
  }, Cc = (e, t, n, s) => {
2283
2283
  const r = new n(pt(e)), i = new vn(r, !1), o = new s(), c = new Mn(o);
@@ -2285,9 +2285,9 @@ const kc = (e) => be(e, Js, Qt), Dc = (e, t) => {
2285
2285
  Q(c, t(a), 0);
2286
2286
  xn(c);
2287
2287
  const l = An(r);
2288
- return Ut(o, l), o.toUint8Array();
2289
- }, Ac = (e) => Cc(e, io, Mt, Qt), hs = "You must not compute changes after the event-handler fired.";
2290
- class xe {
2288
+ return Tt(o, l), o.toUint8Array();
2289
+ }, Ac = (e) => Cc(e, io, xt, te), hs = "You must not compute changes after the event-handler fired.";
2290
+ class Ue {
2291
2291
  /**
2292
2292
  * @param {T} target The changed type.
2293
2293
  * @param {Transaction} transaction
@@ -2397,7 +2397,7 @@ class xe {
2397
2397
  if (t === null) {
2398
2398
  if (this.transaction.doc._transactionCleanups.length === 0)
2399
2399
  throw G(hs);
2400
- const n = this.target, s = Lt(), r = Lt(), i = [];
2400
+ const n = this.target, s = It(), r = It(), i = [];
2401
2401
  if (t = {
2402
2402
  added: s,
2403
2403
  deleted: r,
@@ -2462,10 +2462,10 @@ const vc = (e) => {
2462
2462
  const s = new Ic(t, n);
2463
2463
  return e.push(s), s;
2464
2464
  }
2465
- }, Ue = (e, t) => {
2465
+ }, Te = (e, t) => {
2466
2466
  if (e._start === null || t === 0 || e._searchMarker === null)
2467
2467
  return null;
2468
- const n = e._searchMarker.length === 0 ? null : e._searchMarker.reduce((i, o) => ue(t - i.index) < ue(t - o.index) ? i : o);
2468
+ const n = e._searchMarker.length === 0 ? null : e._searchMarker.reduce((i, o) => de(t - i.index) < de(t - o.index) ? i : o);
2469
2469
  let s = e._start, r = 0;
2470
2470
  for (n !== null && (s = n.p, r = n.index, vc(n)); s.right !== null && r < t; ) {
2471
2471
  if (!s.deleted && s.countable) {
@@ -2479,9 +2479,9 @@ const vc = (e) => {
2479
2479
  s = s.left, !s.deleted && s.countable && (r -= s.length);
2480
2480
  for (; s.left !== null && s.left.id.client === s.id.client && s.left.id.clock + s.left.length === s.id.clock; )
2481
2481
  s = s.left, !s.deleted && s.countable && (r -= s.length);
2482
- return n !== null && ue(n.index - r) < /** @type {YText|YArray<any>} */
2482
+ return n !== null && de(n.index - r) < /** @type {YText|YArray<any>} */
2483
2483
  s.parent.length / or ? (cr(n, s, r), n) : Mc(e._searchMarker, s, r);
2484
- }, Yt = (e, t, n) => {
2484
+ }, Xt = (e, t, n) => {
2485
2485
  for (let s = e.length - 1; s >= 0; s--) {
2486
2486
  const r = e[s];
2487
2487
  if (n > 0) {
@@ -2496,7 +2496,7 @@ const vc = (e) => {
2496
2496
  }
2497
2497
  (t < r.index || n > 0 && t === r.index) && (r.index = gt(t, r.index + n));
2498
2498
  }
2499
- }, Te = (e, t, n) => {
2499
+ }, Oe = (e, t, n) => {
2500
2500
  const s = e, r = t.changedParentTypes;
2501
2501
  for (; rt(r, e, () => []).push(n), e._item !== null; )
2502
2502
  e = /** @type {AbstractType<any>} */
@@ -2533,13 +2533,13 @@ class A {
2533
2533
  * @return {AbstractType<EventType>}
2534
2534
  */
2535
2535
  _copy() {
2536
- throw F();
2536
+ throw H();
2537
2537
  }
2538
2538
  /**
2539
2539
  * @return {AbstractType<EventType>}
2540
2540
  */
2541
2541
  clone() {
2542
- throw F();
2542
+ throw H();
2543
2543
  }
2544
2544
  /**
2545
2545
  * @param {UpdateEncoderV1 | UpdateEncoderV2} _encoder
@@ -2635,7 +2635,7 @@ const lr = (e, t, n) => {
2635
2635
  n = n.right;
2636
2636
  }
2637
2637
  return t;
2638
- }, Xt = (e, t) => {
2638
+ }, Jt = (e, t) => {
2639
2639
  let n = 0, s = e._start;
2640
2640
  for (; s !== null; ) {
2641
2641
  if (s.countable && !s.deleted) {
@@ -2647,7 +2647,7 @@ const lr = (e, t, n) => {
2647
2647
  }
2648
2648
  }, hr = (e, t) => {
2649
2649
  const n = [];
2650
- return Xt(e, (s, r) => {
2650
+ return Jt(e, (s, r) => {
2651
2651
  n.push(t(s, r, e));
2652
2652
  }), n;
2653
2653
  }, xc = (e) => {
@@ -2675,7 +2675,7 @@ const lr = (e, t, n) => {
2675
2675
  }
2676
2676
  };
2677
2677
  }, ur = (e, t) => {
2678
- const n = Ue(e, t);
2678
+ const n = Te(e, t);
2679
2679
  let s = e._start;
2680
2680
  for (n !== null && (s = n.p, t -= n.index); s !== null; s = s.right)
2681
2681
  if (!s.deleted && s.countable) {
@@ -2683,7 +2683,7 @@ const lr = (e, t, n) => {
2683
2683
  return s.content.getContent()[t];
2684
2684
  t -= s.length;
2685
2685
  }
2686
- }, Se = (e, t, n, s) => {
2686
+ }, _e = (e, t, n, s) => {
2687
2687
  let r = n;
2688
2688
  const i = e.doc, o = i.clientID, c = i.store, l = n === null ? t._start : n.right;
2689
2689
  let a = [];
@@ -2706,13 +2706,13 @@ const lr = (e, t, n) => {
2706
2706
  switch (h(), d.constructor) {
2707
2707
  case Uint8Array:
2708
2708
  case ArrayBuffer:
2709
- r = new k(b(o, C(c, o)), r, r && r.lastId, l, l && l.id, t, null, new te(new Uint8Array(
2709
+ r = new k(b(o, C(c, o)), r, r && r.lastId, l, l && l.id, t, null, new ee(new Uint8Array(
2710
2710
  /** @type {Uint8Array} */
2711
2711
  d
2712
2712
  ))), r.integrate(e, 0);
2713
2713
  break;
2714
2714
  case wt:
2715
- r = new k(b(o, C(c, o)), r, r && r.lastId, l, l && l.id, t, null, new ee(
2715
+ r = new k(b(o, C(c, o)), r, r && r.lastId, l, l && l.id, t, null, new ne(
2716
2716
  /** @type {Doc} */
2717
2717
  d
2718
2718
  )), r.integrate(e, 0);
@@ -2729,8 +2729,8 @@ const lr = (e, t, n) => {
2729
2729
  if (n > t._length)
2730
2730
  throw dr();
2731
2731
  if (n === 0)
2732
- return t._searchMarker && Yt(t._searchMarker, n, s.length), Se(e, t, null, s);
2733
- const r = n, i = Ue(t, n);
2732
+ return t._searchMarker && Xt(t._searchMarker, n, s.length), _e(e, t, null, s);
2733
+ const r = n, i = Te(t, n);
2734
2734
  let o = t._start;
2735
2735
  for (i !== null && (o = i.p, n -= i.index, n === 0 && (o = o.prev, n += o && o.countable && !o.deleted ? o.length : 0)); o !== null; o = o.right)
2736
2736
  if (!o.deleted && o.countable) {
@@ -2740,17 +2740,17 @@ const lr = (e, t, n) => {
2740
2740
  }
2741
2741
  n -= o.length;
2742
2742
  }
2743
- return t._searchMarker && Yt(t._searchMarker, r, s.length), Se(e, t, o, s);
2743
+ return t._searchMarker && Xt(t._searchMarker, r, s.length), _e(e, t, o, s);
2744
2744
  }, Uc = (e, t, n) => {
2745
2745
  let r = (t._searchMarker || []).reduce((i, o) => o.index > i.index ? o : i, { index: 0, p: t._start }).p;
2746
2746
  if (r)
2747
2747
  for (; r.right; )
2748
2748
  r = r.right;
2749
- return Se(e, t, r, n);
2749
+ return _e(e, t, r, n);
2750
2750
  }, gr = (e, t, n, s) => {
2751
2751
  if (s === 0)
2752
2752
  return;
2753
- const r = n, i = s, o = Ue(t, n);
2753
+ const r = n, i = s, o = Te(t, n);
2754
2754
  let c = t._start;
2755
2755
  for (o !== null && (c = o.p, n -= o.index); c !== null && n > 0; c = c.right)
2756
2756
  !c.deleted && c.countable && (n < c.length && st(e, b(c.id.client, c.id.clock + n)), n -= c.length);
@@ -2758,13 +2758,13 @@ const lr = (e, t, n) => {
2758
2758
  c.deleted || (s < c.length && st(e, b(c.id.client, c.id.clock + s)), c.delete(e), s -= c.length), c = c.right;
2759
2759
  if (s > 0)
2760
2760
  throw dr();
2761
- t._searchMarker && Yt(
2761
+ t._searchMarker && Xt(
2762
2762
  t._searchMarker,
2763
2763
  r,
2764
2764
  -i + s
2765
2765
  /* in case we remove the above exception */
2766
2766
  );
2767
- }, _e = (e, t, n) => {
2767
+ }, ke = (e, t, n) => {
2768
2768
  const s = t._map.get(n);
2769
2769
  s !== void 0 && s.delete(e);
2770
2770
  }, Tn = (e, t, n, s) => {
@@ -2782,13 +2782,13 @@ const lr = (e, t, n) => {
2782
2782
  c = new dt([s]);
2783
2783
  break;
2784
2784
  case Uint8Array:
2785
- c = new te(
2785
+ c = new ee(
2786
2786
  /** @type {Uint8Array} */
2787
2787
  s
2788
2788
  );
2789
2789
  break;
2790
2790
  case wt:
2791
- c = new ee(
2791
+ c = new ne(
2792
2792
  /** @type {Doc} */
2793
2793
  s
2794
2794
  );
@@ -2819,12 +2819,12 @@ const lr = (e, t, n) => {
2819
2819
  i = i.left;
2820
2820
  i !== null && St(i, t) && (n[r] = i.content.getContent()[i.length - 1]);
2821
2821
  }), n;
2822
- }, ce = (e) => qo(
2822
+ }, le = (e) => qo(
2823
2823
  e.entries(),
2824
2824
  /** @param {any} entry */
2825
2825
  (t) => !t[1].deleted
2826
2826
  );
2827
- class Oc extends xe {
2827
+ class Oc extends Ue {
2828
2828
  /**
2829
2829
  * @param {YArray<T>} yarray The changed type
2830
2830
  * @param {Transaction} transaction The transaction object
@@ -2892,7 +2892,7 @@ class Et extends A {
2892
2892
  * @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
2893
2893
  */
2894
2894
  _callObserver(t, n) {
2895
- super._callObserver(t, n), Te(this, t, new Oc(this, t));
2895
+ super._callObserver(t, n), Oe(this, t, new Oc(this, t));
2896
2896
  }
2897
2897
  /**
2898
2898
  * Inserts new content at an index.
@@ -3014,7 +3014,7 @@ class Et extends A {
3014
3014
  * @param {function(T,number,YArray<T>):void} f A function to execute on every element of this YArray.
3015
3015
  */
3016
3016
  forEach(t) {
3017
- Xt(this, t);
3017
+ Jt(this, t);
3018
3018
  }
3019
3019
  /**
3020
3020
  * @return {IterableIterator<T>}
@@ -3030,7 +3030,7 @@ class Et extends A {
3030
3030
  }
3031
3031
  }
3032
3032
  const Rc = (e) => new Et();
3033
- class $c extends xe {
3033
+ class $c extends Ue {
3034
3034
  /**
3035
3035
  * @param {YMap<T>} ymap The YArray that changed.
3036
3036
  * @param {Transaction} transaction
@@ -3088,7 +3088,7 @@ class ht extends A {
3088
3088
  * @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
3089
3089
  */
3090
3090
  _callObserver(t, n) {
3091
- Te(this, t, new $c(this, t, n));
3091
+ Oe(this, t, new $c(this, t, n));
3092
3092
  }
3093
3093
  /**
3094
3094
  * Transforms this Shared Type to a JSON object.
@@ -3110,7 +3110,7 @@ class ht extends A {
3110
3110
  * @return {number}
3111
3111
  */
3112
3112
  get size() {
3113
- return [...ce(this._map)].length;
3113
+ return [...le(this._map)].length;
3114
3114
  }
3115
3115
  /**
3116
3116
  * Returns the keys for each element in the YMap Type.
@@ -3119,7 +3119,7 @@ class ht extends A {
3119
3119
  */
3120
3120
  keys() {
3121
3121
  return Ke(
3122
- ce(this._map),
3122
+ le(this._map),
3123
3123
  /** @param {any} v */
3124
3124
  (t) => t[0]
3125
3125
  );
@@ -3131,7 +3131,7 @@ class ht extends A {
3131
3131
  */
3132
3132
  values() {
3133
3133
  return Ke(
3134
- ce(this._map),
3134
+ le(this._map),
3135
3135
  /** @param {any} v */
3136
3136
  (t) => t[1].content.getContent()[t[1].length - 1]
3137
3137
  );
@@ -3143,7 +3143,7 @@ class ht extends A {
3143
3143
  */
3144
3144
  entries() {
3145
3145
  return Ke(
3146
- ce(this._map),
3146
+ le(this._map),
3147
3147
  /** @param {any} v */
3148
3148
  (t) => (
3149
3149
  /** @type {any} */
@@ -3176,7 +3176,7 @@ class ht extends A {
3176
3176
  */
3177
3177
  delete(t) {
3178
3178
  this.doc !== null ? S(this.doc, (n) => {
3179
- _e(n, this, t);
3179
+ ke(n, this, t);
3180
3180
  }) : this._prelimContent.delete(t);
3181
3181
  }
3182
3182
  /**
@@ -3225,7 +3225,7 @@ class ht extends A {
3225
3225
  clear() {
3226
3226
  this.doc !== null ? S(this.doc, (t) => {
3227
3227
  this.forEach(function(n, s, r) {
3228
- _e(t, r, s);
3228
+ ke(t, r, s);
3229
3229
  });
3230
3230
  }) : this._prelimContent.clear();
3231
3231
  }
@@ -3253,7 +3253,7 @@ class an {
3253
3253
  forward() {
3254
3254
  switch (this.right === null && j(), this.right.content.constructor) {
3255
3255
  case D:
3256
- this.right.deleted || Tt(
3256
+ this.right.deleted || Ot(
3257
3257
  this.currentAttributes,
3258
3258
  /** @type {ContentFormat} */
3259
3259
  this.right.content
@@ -3270,7 +3270,7 @@ const us = (e, t, n) => {
3270
3270
  for (; t.right !== null && n > 0; ) {
3271
3271
  switch (t.right.content.constructor) {
3272
3272
  case D:
3273
- t.right.deleted || Tt(
3273
+ t.right.deleted || Ot(
3274
3274
  t.currentAttributes,
3275
3275
  /** @type {ContentFormat} */
3276
3276
  t.right.content
@@ -3283,8 +3283,8 @@ const us = (e, t, n) => {
3283
3283
  t.left = t.right, t.right = t.right.right;
3284
3284
  }
3285
3285
  return t;
3286
- }, le = (e, t, n, s) => {
3287
- const r = /* @__PURE__ */ new Map(), i = s ? Ue(t, n) : null;
3286
+ }, ae = (e, t, n, s) => {
3287
+ const r = /* @__PURE__ */ new Map(), i = s ? Te(t, n) : null;
3288
3288
  if (i) {
3289
3289
  const o = new an(i.p.left, i.p, i.index, r);
3290
3290
  return us(e, o, n - i.index);
@@ -3310,7 +3310,7 @@ const us = (e, t, n) => {
3310
3310
  const l = n.left, a = n.right, h = new k(b(i, C(r.store, i)), l, l && l.lastId, a, a && a.id, t, null, new D(c, o));
3311
3311
  h.integrate(e, 0), n.right = h, n.forward();
3312
3312
  });
3313
- }, Tt = (e, t) => {
3313
+ }, Ot = (e, t) => {
3314
3314
  const { key: n, value: s } = t;
3315
3315
  s === null ? e.delete(n) : e.set(n, s);
3316
3316
  }, yr = (e, t) => {
@@ -3348,7 +3348,7 @@ const us = (e, t, n) => {
3348
3348
  s
3349
3349
  ) : s instanceof A ? new Z(s) : new mt(s);
3350
3350
  let { left: a, right: h, index: d } = n;
3351
- t._searchMarker && Yt(t._searchMarker, n.index, l.getLength()), h = new k(b(o, C(i.store, o)), a, a && a.lastId, h, h && h.id, t, null, l), h.integrate(e, 0), n.right = h, n.index = d, n.forward(), mr(e, t, n, c);
3351
+ t._searchMarker && Xt(t._searchMarker, n.index, l.getLength()), h = new k(b(o, C(i.store, o)), a, a && a.lastId, h, h && h.id, t, null, l), h.integrate(e, 0), n.right = h, n.index = d, n.forward(), mr(e, t, n, c);
3352
3352
  }, ds = (e, t, n, s, r) => {
3353
3353
  const i = e.doc, o = i.clientID;
3354
3354
  yr(n, r);
@@ -3412,7 +3412,7 @@ const us = (e, t, n) => {
3412
3412
  /** @type {ContentFormat} */
3413
3413
  a
3414
3414
  ), u = s.get(h) || null;
3415
- (o.get(h) !== a || u === d) && (t.delete(e), c++, !l && (r.get(h) || null) === d && u !== d && (u === null ? r.delete(h) : r.set(h, u))), !l && !t.deleted && Tt(
3415
+ (o.get(h) !== a || u === d) && (t.delete(e), c++, !l && (r.get(h) || null) === d && u !== d && (u === null ? r.delete(h) : r.set(h, u))), !l && !t.deleted && Ot(
3416
3416
  r,
3417
3417
  /** @type {ContentFormat} */
3418
3418
  a
@@ -3439,7 +3439,7 @@ const us = (e, t, n) => {
3439
3439
  }
3440
3440
  t = t.left;
3441
3441
  }
3442
- }, Hc = (e) => {
3442
+ }, Vc = (e) => {
3443
3443
  let t = 0;
3444
3444
  return S(
3445
3445
  /** @type {Doc} */
@@ -3454,7 +3454,7 @@ const us = (e, t, n) => {
3454
3454
  if (r.deleted === !1)
3455
3455
  switch (r.content.constructor) {
3456
3456
  case D:
3457
- Tt(
3457
+ Ot(
3458
3458
  o,
3459
3459
  /** @type {ContentFormat} */
3460
3460
  r.content
@@ -3468,7 +3468,7 @@ const us = (e, t, n) => {
3468
3468
  }
3469
3469
  }
3470
3470
  ), t;
3471
- }, Vc = (e) => {
3471
+ }, Fc = (e) => {
3472
3472
  const t = /* @__PURE__ */ new Set(), n = e.doc;
3473
3473
  for (const [s, r] of e.afterState.entries()) {
3474
3474
  const i = e.beforeState.get(s) || 0;
@@ -3502,7 +3502,7 @@ const us = (e, t, n) => {
3502
3502
  r.content.constructor === D ? t.add(i) : Bc(s, r);
3503
3503
  });
3504
3504
  for (const r of t)
3505
- Hc(r);
3505
+ Vc(r);
3506
3506
  });
3507
3507
  }, fs = (e, t, n) => {
3508
3508
  const s = n, r = tn(t.currentAttributes), i = t.right;
@@ -3523,9 +3523,9 @@ const us = (e, t, n) => {
3523
3523
  /** @type {Item} */
3524
3524
  (t.left || t.right).parent
3525
3525
  );
3526
- return o._searchMarker && Yt(o._searchMarker, t.index, -s + n), t;
3526
+ return o._searchMarker && Xt(o._searchMarker, t.index, -s + n), t;
3527
3527
  };
3528
- class Fc extends xe {
3528
+ class Hc extends Ue {
3529
3529
  /**
3530
3530
  * @param {YText} ytext
3531
3531
  * @param {Transaction} transaction
@@ -3621,7 +3621,7 @@ class Fc extends xe {
3621
3621
  const p = l[f];
3622
3622
  p !== void 0 && (tt(p, g) ? p !== null && o.delete(s) : (c === "retain" && u(), g === null ? delete l[f] : l[f] = g));
3623
3623
  }
3624
- o.deleted || (c === "insert" && u(), Tt(
3624
+ o.deleted || (c === "insert" && u(), Ot(
3625
3625
  r,
3626
3626
  /** @type {ContentFormat} */
3627
3627
  o.content
@@ -3646,7 +3646,7 @@ class Fc extends xe {
3646
3646
  );
3647
3647
  }
3648
3648
  }
3649
- class xt extends A {
3649
+ class Ut extends A {
3650
3650
  /**
3651
3651
  * @param {String} [string] The initial value of the YText.
3652
3652
  */
@@ -3675,13 +3675,13 @@ class xt extends A {
3675
3675
  this._pending = null;
3676
3676
  }
3677
3677
  _copy() {
3678
- return new xt();
3678
+ return new Ut();
3679
3679
  }
3680
3680
  /**
3681
3681
  * @return {YText}
3682
3682
  */
3683
3683
  clone() {
3684
- const t = new xt();
3684
+ const t = new Ut();
3685
3685
  return t.applyDelta(this.toDelta()), t;
3686
3686
  }
3687
3687
  /**
@@ -3692,8 +3692,8 @@ class xt extends A {
3692
3692
  */
3693
3693
  _callObserver(t, n) {
3694
3694
  super._callObserver(t, n);
3695
- const s = new Fc(this, t, n);
3696
- Te(this, t, s), !t.local && this._hasFormatting && (t._needFormattingCleanup = !0);
3695
+ const s = new Hc(this, t, n);
3696
+ Oe(this, t, s), !t.local && this._hasFormatting && (t._needFormattingCleanup = !0);
3697
3697
  }
3698
3698
  /**
3699
3699
  * Returns the unformatted string representation of this YText type.
@@ -3796,7 +3796,7 @@ class xt extends A {
3796
3796
  break;
3797
3797
  }
3798
3798
  case D:
3799
- St(l, t) && (a(), Tt(
3799
+ St(l, t) && (a(), Ot(
3800
3800
  i,
3801
3801
  /** @type {ContentFormat} */
3802
3802
  l.content
@@ -3826,7 +3826,7 @@ class xt extends A {
3826
3826
  return;
3827
3827
  const r = this.doc;
3828
3828
  r !== null ? S(r, (i) => {
3829
- const o = le(i, this, t, !s);
3829
+ const o = ae(i, this, t, !s);
3830
3830
  s || (s = {}, o.currentAttributes.forEach((c, l) => {
3831
3831
  s[l] = c;
3832
3832
  })), Ye(i, this, o, n, s);
@@ -3845,7 +3845,7 @@ class xt extends A {
3845
3845
  insertEmbed(t, n, s) {
3846
3846
  const r = this.doc;
3847
3847
  r !== null ? S(r, (i) => {
3848
- const o = le(i, this, t, !s);
3848
+ const o = ae(i, this, t, !s);
3849
3849
  Ye(i, this, o, n, s || {});
3850
3850
  }) : this._pending.push(() => this.insertEmbed(t, n, s || {}));
3851
3851
  }
@@ -3862,7 +3862,7 @@ class xt extends A {
3862
3862
  return;
3863
3863
  const s = this.doc;
3864
3864
  s !== null ? S(s, (r) => {
3865
- fs(r, le(r, this, t, !0), n);
3865
+ fs(r, ae(r, this, t, !0), n);
3866
3866
  }) : this._pending.push(() => this.delete(t, n));
3867
3867
  }
3868
3868
  /**
@@ -3880,7 +3880,7 @@ class xt extends A {
3880
3880
  return;
3881
3881
  const r = this.doc;
3882
3882
  r !== null ? S(r, (i) => {
3883
- const o = le(i, this, t, !1);
3883
+ const o = ae(i, this, t, !1);
3884
3884
  o.right !== null && ds(i, this, o, n, s);
3885
3885
  }) : this._pending.push(() => this.format(t, n, s));
3886
3886
  }
@@ -3895,7 +3895,7 @@ class xt extends A {
3895
3895
  */
3896
3896
  removeAttribute(t) {
3897
3897
  this.doc !== null ? S(this.doc, (n) => {
3898
- _e(n, this, t);
3898
+ ke(n, this, t);
3899
3899
  }) : this._pending.push(() => this.removeAttribute(t));
3900
3900
  }
3901
3901
  /**
@@ -3949,7 +3949,7 @@ class xt extends A {
3949
3949
  t.writeTypeRef(ol);
3950
3950
  }
3951
3951
  }
3952
- const jc = (e) => new xt();
3952
+ const jc = (e) => new Ut();
3953
3953
  class Xe {
3954
3954
  /**
3955
3955
  * @param {YXmlFragment | YXmlElement} root
@@ -3975,7 +3975,7 @@ class Xe {
3975
3975
  if (t !== null && (!this._firstCall || t.deleted || !this._filter(n)))
3976
3976
  do
3977
3977
  if (n = /** @type {any} */
3978
- t.content.type, !t.deleted && (n.constructor === Jt || n.constructor === ut) && n._start !== null)
3978
+ t.content.type, !t.deleted && (n.constructor === Wt || n.constructor === ut) && n._start !== null)
3979
3979
  t = n._start;
3980
3980
  else
3981
3981
  for (; t !== null; )
@@ -4097,7 +4097,7 @@ class ut extends A {
4097
4097
  * @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
4098
4098
  */
4099
4099
  _callObserver(t, n) {
4100
- Te(this, t, new Yc(this, n, t));
4100
+ Oe(this, t, new Yc(this, n, t));
4101
4101
  }
4102
4102
  /**
4103
4103
  * Get the string representation of all the children of this YXmlFragment.
@@ -4130,7 +4130,7 @@ class ut extends A {
4130
4130
  */
4131
4131
  toDOM(t = document, n = {}, s) {
4132
4132
  const r = t.createDocumentFragment();
4133
- return s !== void 0 && s._createAssociation(r, this), Xt(this, (i) => {
4133
+ return s !== void 0 && s._createAssociation(r, this), Jt(this, (i) => {
4134
4134
  r.insertBefore(i.toDOM(t, n, s), null);
4135
4135
  }), r;
4136
4136
  }
@@ -4163,7 +4163,7 @@ class ut extends A {
4163
4163
  if (this.doc !== null)
4164
4164
  S(this.doc, (s) => {
4165
4165
  const r = t && t instanceof A ? t._item : t;
4166
- Se(s, this, r, n);
4166
+ _e(s, this, r, n);
4167
4167
  });
4168
4168
  else {
4169
4169
  const s = (
@@ -4235,7 +4235,7 @@ class ut extends A {
4235
4235
  * @param {function(YXmlElement|YXmlText,number, typeof self):void} f A function to execute on every element of this YArray.
4236
4236
  */
4237
4237
  forEach(t) {
4238
- Xt(this, t);
4238
+ Jt(this, t);
4239
4239
  }
4240
4240
  /**
4241
4241
  * Transform the properties of this type to binary and write it to an
@@ -4250,7 +4250,7 @@ class ut extends A {
4250
4250
  }
4251
4251
  }
4252
4252
  const Kc = (e) => new ut();
4253
- class Jt extends ut {
4253
+ class Wt extends ut {
4254
4254
  constructor(t = "UNDEFINED") {
4255
4255
  super(), this.nodeName = t, this._prelimAttrs = /* @__PURE__ */ new Map();
4256
4256
  }
@@ -4298,13 +4298,13 @@ class Jt extends ut {
4298
4298
  * @return {YXmlElement}
4299
4299
  */
4300
4300
  _copy() {
4301
- return new Jt(this.nodeName);
4301
+ return new Wt(this.nodeName);
4302
4302
  }
4303
4303
  /**
4304
4304
  * @return {YXmlElement<KV>}
4305
4305
  */
4306
4306
  clone() {
4307
- const t = new Jt(this.nodeName), n = this.getAttributes();
4307
+ const t = new Wt(this.nodeName), n = this.getAttributes();
4308
4308
  return eo(n, (s, r) => {
4309
4309
  typeof s == "string" && t.setAttribute(r, s);
4310
4310
  }), t.insert(0, this.toArray().map((s) => s instanceof A ? s.clone() : s)), t;
@@ -4340,7 +4340,7 @@ class Jt extends ut {
4340
4340
  */
4341
4341
  removeAttribute(t) {
4342
4342
  this.doc !== null ? S(this.doc, (n) => {
4343
- _e(n, this, t);
4343
+ ke(n, this, t);
4344
4344
  }) : this._prelimAttrs.delete(t);
4345
4345
  }
4346
4346
  /**
@@ -4424,7 +4424,7 @@ class Jt extends ut {
4424
4424
  const c = i[o];
4425
4425
  typeof c == "string" && r.setAttribute(o, c);
4426
4426
  }
4427
- return Xt(this, (o) => {
4427
+ return Jt(this, (o) => {
4428
4428
  r.appendChild(o.toDOM(t, n, s));
4429
4429
  }), s !== void 0 && s._createAssociation(r, this), r;
4430
4430
  }
@@ -4440,8 +4440,8 @@ class Jt extends ut {
4440
4440
  t.writeTypeRef(cl), t.writeKey(this.nodeName);
4441
4441
  }
4442
4442
  }
4443
- const zc = (e) => new Jt(e.readKey());
4444
- class Yc extends xe {
4443
+ const zc = (e) => new Wt(e.readKey());
4444
+ class Yc extends Ue {
4445
4445
  /**
4446
4446
  * @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created.
4447
4447
  * @param {Set<string|null>} subs The set of changed attributes. `null` is included if the
@@ -4455,7 +4455,7 @@ class Yc extends xe {
4455
4455
  });
4456
4456
  }
4457
4457
  }
4458
- class ke extends ht {
4458
+ class De extends ht {
4459
4459
  /**
4460
4460
  * @param {string} hookName nodeName of the Dom Node.
4461
4461
  */
@@ -4466,13 +4466,13 @@ class ke extends ht {
4466
4466
  * Creates an Item with the same effect as this Item (without position effect)
4467
4467
  */
4468
4468
  _copy() {
4469
- return new ke(this.hookName);
4469
+ return new De(this.hookName);
4470
4470
  }
4471
4471
  /**
4472
4472
  * @return {YXmlHook}
4473
4473
  */
4474
4474
  clone() {
4475
- const t = new ke(this.hookName);
4475
+ const t = new De(this.hookName);
4476
4476
  return this.forEach((n, s) => {
4477
4477
  t.set(s, n);
4478
4478
  }), t;
@@ -4509,8 +4509,8 @@ class ke extends ht {
4509
4509
  t.writeTypeRef(al), t.writeKey(this.hookName);
4510
4510
  }
4511
4511
  }
4512
- const Xc = (e) => new ke(e.readKey());
4513
- class De extends xt {
4512
+ const Xc = (e) => new De(e.readKey());
4513
+ class Ee extends Ut {
4514
4514
  /**
4515
4515
  * @type {YXmlElement|YXmlText|null}
4516
4516
  */
@@ -4534,13 +4534,13 @@ class De extends xt {
4534
4534
  ) : null;
4535
4535
  }
4536
4536
  _copy() {
4537
- return new De();
4537
+ return new Ee();
4538
4538
  }
4539
4539
  /**
4540
4540
  * @return {YXmlText}
4541
4541
  */
4542
4542
  clone() {
4543
- const t = new De();
4543
+ const t = new Ee();
4544
4544
  return t.applyDelta(this.toDelta()), t;
4545
4545
  }
4546
4546
  /**
@@ -4601,7 +4601,7 @@ class De extends xt {
4601
4601
  t.writeTypeRef(hl);
4602
4602
  }
4603
4603
  }
4604
- const Jc = (e) => new De();
4604
+ const Jc = (e) => new Ee();
4605
4605
  class Rn {
4606
4606
  /**
4607
4607
  * @param {ID} id
@@ -4614,7 +4614,7 @@ class Rn {
4614
4614
  * @type {boolean}
4615
4615
  */
4616
4616
  get deleted() {
4617
- throw F();
4617
+ throw H();
4618
4618
  }
4619
4619
  /**
4620
4620
  * Merge this struct with the item to the right.
@@ -4632,14 +4632,14 @@ class Rn {
4632
4632
  * @param {number} encodingRef
4633
4633
  */
4634
4634
  write(t, n, s) {
4635
- throw F();
4635
+ throw H();
4636
4636
  }
4637
4637
  /**
4638
4638
  * @param {Transaction} transaction
4639
4639
  * @param {number} offset
4640
4640
  */
4641
4641
  integrate(t, n) {
4642
- throw F();
4642
+ throw H();
4643
4643
  }
4644
4644
  }
4645
4645
  const Wc = 0;
@@ -4679,7 +4679,7 @@ class U extends Rn {
4679
4679
  return null;
4680
4680
  }
4681
4681
  }
4682
- class te {
4682
+ class ee {
4683
4683
  /**
4684
4684
  * @param {Uint8Array} content
4685
4685
  */
@@ -4708,14 +4708,14 @@ class te {
4708
4708
  * @return {ContentBinary}
4709
4709
  */
4710
4710
  copy() {
4711
- return new te(this.content);
4711
+ return new ee(this.content);
4712
4712
  }
4713
4713
  /**
4714
4714
  * @param {number} offset
4715
4715
  * @return {ContentBinary}
4716
4716
  */
4717
4717
  splice(t) {
4718
- throw F();
4718
+ throw H();
4719
4719
  }
4720
4720
  /**
4721
4721
  * @param {ContentBinary} right
@@ -4754,8 +4754,8 @@ class te {
4754
4754
  return 3;
4755
4755
  }
4756
4756
  }
4757
- const Pc = (e) => new te(e.readBuf());
4758
- class Wt {
4757
+ const Pc = (e) => new ee(e.readBuf());
4758
+ class Pt {
4759
4759
  /**
4760
4760
  * @param {number} len
4761
4761
  */
@@ -4784,14 +4784,14 @@ class Wt {
4784
4784
  * @return {ContentDeleted}
4785
4785
  */
4786
4786
  copy() {
4787
- return new Wt(this.len);
4787
+ return new Pt(this.len);
4788
4788
  }
4789
4789
  /**
4790
4790
  * @param {number} offset
4791
4791
  * @return {ContentDeleted}
4792
4792
  */
4793
4793
  splice(t) {
4794
- const n = new Wt(this.len - t);
4794
+ const n = new Pt(this.len - t);
4795
4795
  return this.len = t, n;
4796
4796
  }
4797
4797
  /**
@@ -4806,7 +4806,7 @@ class Wt {
4806
4806
  * @param {Item} item
4807
4807
  */
4808
4808
  integrate(t, n) {
4809
- ye(t.deleteSet, n.id.client, n.id.clock, this.len), n.markDeleted();
4809
+ be(t.deleteSet, n.id.client, n.id.clock, this.len), n.markDeleted();
4810
4810
  }
4811
4811
  /**
4812
4812
  * @param {Transaction} transaction
@@ -4832,8 +4832,8 @@ class Wt {
4832
4832
  return 1;
4833
4833
  }
4834
4834
  }
4835
- const Gc = (e) => new Wt(e.readLen()), _r = (e, t) => new wt({ guid: e, ...t, shouldLoad: t.shouldLoad || t.autoLoad || !1 });
4836
- class ee {
4835
+ const Gc = (e) => new Pt(e.readLen()), _r = (e, t) => new wt({ guid: e, ...t, shouldLoad: t.shouldLoad || t.autoLoad || !1 });
4836
+ class ne {
4837
4837
  /**
4838
4838
  * @param {Doc} doc
4839
4839
  */
@@ -4864,14 +4864,14 @@ class ee {
4864
4864
  * @return {ContentDoc}
4865
4865
  */
4866
4866
  copy() {
4867
- return new ee(_r(this.doc.guid, this.opts));
4867
+ return new ne(_r(this.doc.guid, this.opts));
4868
4868
  }
4869
4869
  /**
4870
4870
  * @param {number} offset
4871
4871
  * @return {ContentDoc}
4872
4872
  */
4873
4873
  splice(t) {
4874
- throw F();
4874
+ throw H();
4875
4875
  }
4876
4876
  /**
4877
4877
  * @param {ContentDoc} right
@@ -4912,7 +4912,7 @@ class ee {
4912
4912
  return 9;
4913
4913
  }
4914
4914
  }
4915
- const qc = (e) => new ee(_r(e.readString(), e.readAny()));
4915
+ const qc = (e) => new ne(_r(e.readString(), e.readAny()));
4916
4916
  class mt {
4917
4917
  /**
4918
4918
  * @param {Object} embed
@@ -4949,7 +4949,7 @@ class mt {
4949
4949
  * @return {ContentEmbed}
4950
4950
  */
4951
4951
  splice(t) {
4952
- throw F();
4952
+ throw H();
4953
4953
  }
4954
4954
  /**
4955
4955
  * @param {ContentEmbed} right
@@ -5026,7 +5026,7 @@ class D {
5026
5026
  * @return {ContentFormat}
5027
5027
  */
5028
5028
  splice(t) {
5029
- throw F();
5029
+ throw H();
5030
5030
  }
5031
5031
  /**
5032
5032
  * @param {ContentFormat} _right
@@ -5071,7 +5071,7 @@ class D {
5071
5071
  }
5072
5072
  }
5073
5073
  const Qc = (e) => new D(e.readKey(), e.readJSON());
5074
- class Ee {
5074
+ class Ce {
5075
5075
  /**
5076
5076
  * @param {Array<any>} arr
5077
5077
  */
@@ -5100,14 +5100,14 @@ class Ee {
5100
5100
  * @return {ContentJSON}
5101
5101
  */
5102
5102
  copy() {
5103
- return new Ee(this.arr);
5103
+ return new Ce(this.arr);
5104
5104
  }
5105
5105
  /**
5106
5106
  * @param {number} offset
5107
5107
  * @return {ContentJSON}
5108
5108
  */
5109
5109
  splice(t) {
5110
- const n = new Ee(this.arr.slice(t));
5110
+ const n = new Ce(this.arr.slice(t));
5111
5111
  return this.arr = this.arr.slice(0, t), n;
5112
5112
  }
5113
5113
  /**
@@ -5158,7 +5158,7 @@ const tl = (e) => {
5158
5158
  const r = e.readString();
5159
5159
  r === "undefined" ? n.push(void 0) : n.push(JSON.parse(r));
5160
5160
  }
5161
- return new Ee(n);
5161
+ return new Ce(n);
5162
5162
  };
5163
5163
  class dt {
5164
5164
  /**
@@ -5370,7 +5370,7 @@ class Z {
5370
5370
  * @return {ContentType}
5371
5371
  */
5372
5372
  splice(t) {
5373
- throw F();
5373
+ throw H();
5374
5374
  }
5375
5375
  /**
5376
5376
  * @param {ContentType} right
@@ -5426,7 +5426,7 @@ class Z {
5426
5426
  return 7;
5427
5427
  }
5428
5428
  }
5429
- const ul = (e) => new Z(sl[e.readTypeRef()](e)), Ce = (e, t, n) => {
5429
+ const ul = (e) => new Z(sl[e.readTypeRef()](e)), Ae = (e, t, n) => {
5430
5430
  const { client: s, clock: r } = t.id, i = new k(
5431
5431
  b(s, r + n),
5432
5432
  t,
@@ -5459,10 +5459,10 @@ class k extends Rn {
5459
5459
  * @type {boolean}
5460
5460
  */
5461
5461
  set marker(t) {
5462
- (this.info & Ve) > 0 !== t && (this.info ^= Ve);
5462
+ (this.info & Fe) > 0 !== t && (this.info ^= Fe);
5463
5463
  }
5464
5464
  get marker() {
5465
- return (this.info & Ve) > 0;
5465
+ return (this.info & Fe) > 0;
5466
5466
  }
5467
5467
  /**
5468
5468
  * If true, do not garbage collect this Item.
@@ -5481,13 +5481,13 @@ class k extends Rn {
5481
5481
  * @type {Boolean}
5482
5482
  */
5483
5483
  get deleted() {
5484
- return (this.info & He) > 0;
5484
+ return (this.info & Ve) > 0;
5485
5485
  }
5486
5486
  set deleted(t) {
5487
- this.deleted !== t && (this.info ^= He);
5487
+ this.deleted !== t && (this.info ^= Ve);
5488
5488
  }
5489
5489
  markDeleted() {
5490
- this.info |= He;
5490
+ this.info |= Ve;
5491
5491
  }
5492
5492
  /**
5493
5493
  * Return the creator clientID of the missing op or define missing items and return null.
@@ -5533,10 +5533,10 @@ class k extends Rn {
5533
5533
  this.parent._start;
5534
5534
  const i = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
5535
5535
  for (; r !== null && r !== this.right; ) {
5536
- if (o.add(r), i.add(r), oe(this.origin, r.origin)) {
5536
+ if (o.add(r), i.add(r), ce(this.origin, r.origin)) {
5537
5537
  if (r.id.client < this.id.client)
5538
5538
  s = r, i.clear();
5539
- else if (oe(this.rightOrigin, r.rightOrigin))
5539
+ else if (ce(this.rightOrigin, r.rightOrigin))
5540
5540
  break;
5541
5541
  } else if (r.origin !== null && o.has(ze(t.doc.store, r.origin)))
5542
5542
  i.has(ze(t.doc.store, r.origin)) || (s = r, i.clear());
@@ -5602,7 +5602,7 @@ class k extends Rn {
5602
5602
  * @return {boolean}
5603
5603
  */
5604
5604
  mergeWith(t) {
5605
- if (this.constructor === t.constructor && oe(t.origin, this.lastId) && this.right === t && oe(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)) {
5605
+ if (this.constructor === t.constructor && ce(t.origin, this.lastId) && this.right === t && ce(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)) {
5606
5606
  const n = (
5607
5607
  /** @type {AbstractType<any>} */
5608
5608
  this.parent._searchMarker
@@ -5624,7 +5624,7 @@ class k extends Rn {
5624
5624
  /** @type {AbstractType<any>} */
5625
5625
  this.parent
5626
5626
  );
5627
- this.countable && this.parentSub === null && (n._length -= this.length), this.markDeleted(), ye(t.deleteSet, this.id.client, this.id.clock, this.length), as(t, n, this.parentSub), this.content.delete(t);
5627
+ this.countable && this.parentSub === null && (n._length -= this.length), this.markDeleted(), be(t.deleteSet, this.id.client, this.id.clock, this.length), as(t, n, this.parentSub), this.content.delete(t);
5628
5628
  }
5629
5629
  }
5630
5630
  /**
@@ -5634,7 +5634,7 @@ class k extends Rn {
5634
5634
  gc(t, n) {
5635
5635
  if (!this.deleted)
5636
5636
  throw j();
5637
- this.content.gc(t), n ? mc(t, this, new U(this.id, this.length)) : this.content = new Wt(this.length);
5637
+ this.content.gc(t), n ? mc(t, this, new U(this.id, this.length)) : this.content = new Pt(this.length);
5638
5638
  }
5639
5639
  /**
5640
5640
  * Transform the properties of this type to binary and write it to an
@@ -5646,9 +5646,9 @@ class k extends Rn {
5646
5646
  * @param {number} offset
5647
5647
  */
5648
5648
  write(t, n) {
5649
- const s = n > 0 ? b(this.id.client, this.id.clock + n - 1) : this.origin, r = this.rightOrigin, i = this.parentSub, o = this.content.getRef() & Le | (s === null ? 0 : M) | // origin is defined
5649
+ const s = n > 0 ? b(this.id.client, this.id.clock + n - 1) : this.origin, r = this.rightOrigin, i = this.parentSub, o = this.content.getRef() & Ie | (s === null ? 0 : M) | // origin is defined
5650
5650
  (r === null ? 0 : J) | // right origin is defined
5651
- (i === null ? 0 : jt);
5651
+ (i === null ? 0 : Kt);
5652
5652
  if (t.writeInfo(o), s !== null && t.writeLeftID(s), r !== null && t.writeRightID(r), s === null && r === null) {
5653
5653
  const c = (
5654
5654
  /** @type {AbstractType<any>} */
@@ -5668,7 +5668,7 @@ class k extends Rn {
5668
5668
  this.content.write(t, n);
5669
5669
  }
5670
5670
  }
5671
- const kr = (e, t) => dl[t & Le](e), dl = [
5671
+ const kr = (e, t) => dl[t & Ie](e), dl = [
5672
5672
  () => {
5673
5673
  j();
5674
5674
  },
@@ -5751,7 +5751,7 @@ class wl extends mn {
5751
5751
  constructor(t) {
5752
5752
  super(), this.doc = t, this.clientID = t.clientID, this.states = /* @__PURE__ */ new Map(), this.meta = /* @__PURE__ */ new Map(), this._checkInterval = /** @type {any} */
5753
5753
  setInterval(() => {
5754
- const n = me();
5754
+ const n = ye();
5755
5755
  this.getLocalState() !== null && Je / 2 <= n - /** @type {{lastUpdated:number}} */
5756
5756
  this.meta.get(this.clientID).lastUpdated && this.setLocalState(this.getLocalState());
5757
5757
  const s = [];
@@ -5778,10 +5778,10 @@ class wl extends mn {
5778
5778
  const n = this.clientID, s = this.meta.get(n), r = s === void 0 ? 0 : s.clock + 1, i = this.states.get(n);
5779
5779
  t === null ? this.states.delete(n) : this.states.set(n, t), this.meta.set(n, {
5780
5780
  clock: r,
5781
- lastUpdated: me()
5781
+ lastUpdated: ye()
5782
5782
  });
5783
5783
  const o = [], c = [], l = [], a = [];
5784
- t === null ? a.push(n) : i == null ? t != null && o.push(n) : (c.push(n), Nt(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"]);
5784
+ t === null ? a.push(n) : i == null ? t != null && o.push(n) : (c.push(n), Bt(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"]);
5785
5785
  }
5786
5786
  /**
5787
5787
  * @param {string} field
@@ -5813,15 +5813,15 @@ const $n = (e, t, n) => {
5813
5813
  );
5814
5814
  e.meta.set(i, {
5815
5815
  clock: o.clock + 1,
5816
- lastUpdated: me()
5816
+ lastUpdated: ye()
5817
5817
  });
5818
5818
  }
5819
5819
  s.push(i);
5820
5820
  }
5821
5821
  }
5822
5822
  s.length > 0 && (e.emit("change", [{ added: [], updated: [], removed: s }, n]), e.emit("update", [{ added: [], updated: [], removed: s }, n]));
5823
- }, Bt = (e, t, n = e.states) => {
5824
- const s = t.length, r = qt();
5823
+ }, Vt = (e, t, n = e.states) => {
5824
+ const s = t.length, r = Zt();
5825
5825
  m(r, s);
5826
5826
  for (let i = 0; i < s; i++) {
5827
5827
  const o = t[i], c = n.get(o) || null, l = (
@@ -5832,7 +5832,7 @@ const $n = (e, t, n) => {
5832
5832
  }
5833
5833
  return $(r);
5834
5834
  }, ml = (e, t, n) => {
5835
- const s = pt(t), r = me(), i = [], o = [], c = [], l = [], a = w(s);
5835
+ const s = pt(t), r = ye(), i = [], o = [], c = [], l = [], a = w(s);
5836
5836
  for (let h = 0; h < a; h++) {
5837
5837
  const d = w(s);
5838
5838
  let u = w(s);
@@ -5840,7 +5840,7 @@ const $n = (e, t, n) => {
5840
5840
  (_ < u || _ === u && f === null && e.states.has(d)) && (f === null ? d === e.clientID && e.getLocalState() != null ? u++ : e.states.delete(d) : e.states.set(d, f), e.meta.set(d, {
5841
5841
  clock: u,
5842
5842
  lastUpdated: r
5843
- }), g === void 0 && f !== null ? i.push(d) : g !== void 0 && f === null ? l.push(d) : f !== null && (Nt(f, p) || c.push(d), o.push(d)));
5843
+ }), g === void 0 && f !== null ? i.push(d) : g !== void 0 && f === null ? l.push(d) : f !== null && (Bt(f, p) || c.push(d), o.push(d)));
5844
5844
  }
5845
5845
  (i.length > 0 || c.length > 0 || l.length > 0) && e.emit("change", [{
5846
5846
  added: i,
@@ -5887,8 +5887,8 @@ function El(e, t) {
5887
5887
  if (!e)
5888
5888
  throw new Error(t);
5889
5889
  }
5890
- var ne = [];
5891
- ne[it] = (e, t, n, s, r) => {
5890
+ var se = [];
5891
+ se[it] = (e, t, n, s, r) => {
5892
5892
  v(e, it);
5893
5893
  const i = _l(
5894
5894
  t,
@@ -5898,23 +5898,23 @@ ne[it] = (e, t, n, s, r) => {
5898
5898
  );
5899
5899
  s && i === Nn && !n.synced && (n.synced = !0);
5900
5900
  };
5901
- ne[vr] = (e, t, n, s, r) => {
5901
+ se[vr] = (e, t, n, s, r) => {
5902
5902
  v(e, Ct), kt(
5903
5903
  e,
5904
- Bt(
5904
+ Vt(
5905
5905
  n.awareness,
5906
5906
  Array.from(n.awareness.getStates().keys())
5907
5907
  )
5908
5908
  );
5909
5909
  };
5910
- ne[Ct] = (e, t, n, s, r) => {
5910
+ se[Ct] = (e, t, n, s, r) => {
5911
5911
  ml(
5912
5912
  n.awareness,
5913
5913
  Di(t),
5914
5914
  n
5915
5915
  );
5916
5916
  };
5917
- ne[kl] = (e, t, n, s, r) => {
5917
+ se[kl] = (e, t, n, s, r) => {
5918
5918
  pl(
5919
5919
  t,
5920
5920
  n.doc,
@@ -5942,7 +5942,7 @@ function xr(e) {
5942
5942
  return;
5943
5943
  e.wsLastMessageReceived = Qe();
5944
5944
  const s = Mr(e, new Uint8Array(n.data), !0);
5945
- pn(s) > 1 && Rt(x(s), t);
5945
+ pn(s) > 1 && $t(x(s), t);
5946
5946
  }, t.onerror = (n) => {
5947
5947
  e.emit("connection-error", [n, e]);
5948
5948
  }, t.onclose = (n) => {
@@ -5971,14 +5971,14 @@ function xr(e) {
5971
5971
  }
5972
5972
  ]);
5973
5973
  const n = R();
5974
- if (v(n, it), hn(n, e.doc), Rt(x(n), t), e.awareness.getLocalState() !== null) {
5974
+ if (v(n, it), hn(n, e.doc), $t(x(n), t), e.awareness.getLocalState() !== null) {
5975
5975
  const s = R();
5976
5976
  v(s, Ct), kt(
5977
5977
  s,
5978
- Bt(e.awareness, [
5978
+ Vt(e.awareness, [
5979
5979
  e.doc.clientID
5980
5980
  ])
5981
- ), Rt(x(s), t);
5981
+ ), $t(x(s), t);
5982
5982
  }
5983
5983
  }, e.emit("status", [
5984
5984
  {
@@ -5989,7 +5989,7 @@ function xr(e) {
5989
5989
  }
5990
5990
  function We(e, t) {
5991
5991
  const n = e.ws;
5992
- e.wsconnected && n && n.readyState === n.OPEN && Rt(t, n), e.bcconnected && bt(e.bcChannel, t, e);
5992
+ e.wsconnected && n && n.readyState === n.OPEN && $t(t, n), e.bcconnected && bt(e.bcChannel, t, e);
5993
5993
  }
5994
5994
  var Al = typeof WebSocket > "u" ? null : WebSocket, Ll = class extends Ni {
5995
5995
  constructor(t, n, s, {
@@ -6033,11 +6033,11 @@ var Al = typeof WebSocket > "u" ? null : WebSocket, Ll = class extends Ni {
6033
6033
  for (; t[t.length - 1] === "/"; )
6034
6034
  t = t.slice(0, t.length - 1);
6035
6035
  const d = Bi(o);
6036
- this.maxBackoffTime = a, this.bcChannel = t + "/" + n, this.url = t + "/" + n + (d.length === 0 ? "" : "?" + d), this.roomname = n, this.doc = s, this._WS = c, this.awareness = i, this.wsconnected = !1, this.wsconnecting = !1, this.bcconnected = !1, this.disableBc = h, this.wsUnsuccessfulReconnects = 0, this.messageHandlers = ne.slice(), this._synced = !1, this.ws = null, this.wsLastMessageReceived = 0, this.shouldConnect = r, this._resyncInterval = 0, l > 0 && (this._resyncInterval = /** @type {any} */
6036
+ this.maxBackoffTime = a, this.bcChannel = t + "/" + n, this.url = t + "/" + n + (d.length === 0 ? "" : "?" + d), this.roomname = n, this.doc = s, this._WS = c, this.awareness = i, this.wsconnected = !1, this.wsconnecting = !1, this.bcconnected = !1, this.disableBc = h, this.wsUnsuccessfulReconnects = 0, this.messageHandlers = se.slice(), this._synced = !1, this.ws = null, this.wsLastMessageReceived = 0, this.shouldConnect = r, this._resyncInterval = 0, l > 0 && (this._resyncInterval = /** @type {any} */
6037
6037
  setInterval(() => {
6038
6038
  if (this.ws && this.ws.readyState === WebSocket.OPEN) {
6039
6039
  const u = R();
6040
- v(u, it), hn(u, s), Rt(x(u), this.ws);
6040
+ v(u, it), hn(u, s), $t(x(u), this.ws);
6041
6041
  }
6042
6042
  }, l)), this._bcSubscriber = (u, f) => {
6043
6043
  if (f !== this) {
@@ -6053,7 +6053,7 @@ var Al = typeof WebSocket > "u" ? null : WebSocket, Ll = class extends Ni {
6053
6053
  const _ = u.concat(f).concat(g), Y = R();
6054
6054
  v(Y, Ct), kt(
6055
6055
  Y,
6056
- Bt(i, _)
6056
+ Vt(i, _)
6057
6057
  ), We(this, x(Y));
6058
6058
  }, this._unloadHandler = () => {
6059
6059
  $n(
@@ -6095,7 +6095,7 @@ var Al = typeof WebSocket > "u" ? null : WebSocket, Ll = class extends Ni {
6095
6095
  const r = R();
6096
6096
  v(r, Ct), kt(
6097
6097
  r,
6098
- Bt(this.awareness, [
6098
+ Vt(this.awareness, [
6099
6099
  this.doc.clientID
6100
6100
  ])
6101
6101
  ), bt(
@@ -6108,7 +6108,7 @@ var Al = typeof WebSocket > "u" ? null : WebSocket, Ll = class extends Ni {
6108
6108
  const t = R();
6109
6109
  v(t, Ct), kt(
6110
6110
  t,
6111
- Bt(
6111
+ Vt(
6112
6112
  this.awareness,
6113
6113
  [this.doc.clientID],
6114
6114
  /* @__PURE__ */ new Map()
@@ -6146,12 +6146,12 @@ var ot, bs, vl = (bs = class extends Ll {
6146
6146
  };
6147
6147
  super(i, n, s ?? new wt(), h);
6148
6148
  y(this, "id");
6149
- Vn(this, ot, void 0);
6150
- this.id = o, Fn(this, ot, c), l && this.connect();
6149
+ Fn(this, ot, void 0);
6150
+ this.id = o, Hn(this, ot, c), l && this.connect();
6151
6151
  }
6152
6152
  connect() {
6153
6153
  Promise.resolve(
6154
- typeof re(this, ot) == "function" ? re(this, ot).call(this) : re(this, ot)
6154
+ typeof ie(this, ot) == "function" ? ie(this, ot).call(this) : ie(this, ot)
6155
6155
  ).then((t) => {
6156
6156
  const n = new URLSearchParams([["_pk", this.id]]);
6157
6157
  if (t)
@@ -6164,9 +6164,9 @@ var ot, bs, vl = (bs = class extends Ll {
6164
6164
  });
6165
6165
  }
6166
6166
  }, ot = new WeakMap(), bs);
6167
- const yt = (e) => vt((t, n) => {
6167
+ const yt = (e) => Mt((t, n) => {
6168
6168
  e.onerror = (s) => n(new Error(s.target.error)), e.onsuccess = (s) => t(s.target.result);
6169
- }), Ml = (e, t) => vt((n, s) => {
6169
+ }), Ml = (e, t) => Mt((n, s) => {
6170
6170
  const r = indexedDB.open(e);
6171
6171
  r.onupgradeneeded = (i) => t(i.target.result), r.onerror = (i) => s(G(i.target.error)), r.onsuccess = (i) => {
6172
6172
  const o = i.target.result;
@@ -6179,23 +6179,23 @@ const yt = (e) => vt((t, n) => {
6179
6179
  // @ts-ignore
6180
6180
  e.createObjectStore.apply(e, n)
6181
6181
  )
6182
- ), Ot = (e, t, n = "readwrite") => {
6182
+ ), Rt = (e, t, n = "readwrite") => {
6183
6183
  const s = e.transaction(t, n);
6184
- return t.map((r) => Vl(s, r));
6184
+ return t.map((r) => Fl(s, r));
6185
6185
  }, Ur = (e, t) => yt(e.count(t)), Tl = (e, t) => yt(e.get(t)), Tr = (e, t) => yt(e.delete(t)), Ol = (e, t, n) => yt(e.put(t, n)), un = (e, t) => yt(e.add(t)), Rl = (e, t, n) => yt(e.getAll(t, n)), $l = (e, t, n) => {
6186
6186
  let s = null;
6187
- return Hl(e, t, (r) => (s = r, !1), n).then(() => s);
6188
- }, Nl = (e, t = null) => $l(e, t, "prev"), Bl = (e, t) => vt((n, s) => {
6187
+ return Vl(e, t, (r) => (s = r, !1), n).then(() => s);
6188
+ }, Nl = (e, t = null) => $l(e, t, "prev"), Bl = (e, t) => Mt((n, s) => {
6189
6189
  e.onerror = s, e.onsuccess = async (r) => {
6190
6190
  const i = r.target.result;
6191
6191
  if (i === null || await t(i) === !1)
6192
6192
  return n();
6193
6193
  i.continue();
6194
6194
  };
6195
- }), Hl = (e, t, n, s = "next") => Bl(e.openKeyCursor(t, s), (r) => n(r.key)), Vl = (e, t) => e.objectStore(t), Fl = (e, t) => IDBKeyRange.upperBound(e, t), jl = (e, t) => IDBKeyRange.lowerBound(e, t), Pe = "custom", Or = "updates", Rr = 500, $r = (e, t = () => {
6195
+ }), Vl = (e, t, n, s = "next") => Bl(e.openKeyCursor(t, s), (r) => n(r.key)), Fl = (e, t) => e.objectStore(t), Hl = (e, t) => IDBKeyRange.upperBound(e, t), jl = (e, t) => IDBKeyRange.lowerBound(e, t), Pe = "custom", Or = "updates", Rr = 500, $r = (e, t = () => {
6196
6196
  }, n = () => {
6197
6197
  }) => {
6198
- const [s] = Ot(
6198
+ const [s] = Rt(
6199
6199
  /** @type {IDBDatabase} */
6200
6200
  e.db,
6201
6201
  [Or]
@@ -6210,7 +6210,7 @@ const yt = (e) => vt((t, n) => {
6210
6210
  e._dbsize = r;
6211
6211
  })).then(() => s);
6212
6212
  }, Kl = (e, t = !0) => $r(e).then((n) => {
6213
- (t || e._dbsize >= Rr) && un(n, In(e.doc)).then(() => Tr(n, Fl(e._dbref, !0))).then(() => Ur(n).then((s) => {
6213
+ (t || e._dbsize >= Rr) && un(n, In(e.doc)).then(() => Tr(n, Hl(e._dbref, !0))).then(() => Ur(n).then((s) => {
6214
6214
  e._dbsize = s;
6215
6215
  }));
6216
6216
  });
@@ -6226,7 +6226,7 @@ class zl extends mn {
6226
6226
  ["updates", { autoIncrement: !0 }],
6227
6227
  ["custom"]
6228
6228
  ])
6229
- ), this.whenSynced = vt((s) => this.on("synced", () => s(this))), this._db.then((s) => {
6229
+ ), this.whenSynced = Mt((s) => this.on("synced", () => s(this))), this._db.then((s) => {
6230
6230
  this.db = s, $r(this, (o) => un(o, In(n)), () => {
6231
6231
  if (this._destroyed)
6232
6232
  return this;
@@ -6234,7 +6234,7 @@ class zl extends mn {
6234
6234
  });
6235
6235
  }), this._storeTimeout = 1e3, this._storeTimeoutId = null, this._storeUpdate = (s, r) => {
6236
6236
  if (this.db && r !== this) {
6237
- const [i] = Ot(
6237
+ const [i] = Rt(
6238
6238
  /** @type {IDBDatabase} */
6239
6239
  this.db,
6240
6240
  [Or]
@@ -6266,7 +6266,7 @@ class zl extends mn {
6266
6266
  */
6267
6267
  get(t) {
6268
6268
  return this._db.then((n) => {
6269
- const [s] = Ot(n, [Pe], "readonly");
6269
+ const [s] = Rt(n, [Pe], "readonly");
6270
6270
  return Tl(s, t);
6271
6271
  });
6272
6272
  }
@@ -6277,7 +6277,7 @@ class zl extends mn {
6277
6277
  */
6278
6278
  set(t, n) {
6279
6279
  return this._db.then((s) => {
6280
- const [r] = Ot(s, [Pe]);
6280
+ const [r] = Rt(s, [Pe]);
6281
6281
  return Ol(r, n, t);
6282
6282
  });
6283
6283
  }
@@ -6287,7 +6287,7 @@ class zl extends mn {
6287
6287
  */
6288
6288
  del(t) {
6289
6289
  return this._db.then((n) => {
6290
- const [s] = Ot(n, [Pe]);
6290
+ const [s] = Rt(n, [Pe]);
6291
6291
  return Tr(s, t);
6292
6292
  });
6293
6293
  }
@@ -6298,7 +6298,7 @@ const Yl = {
6298
6298
  shiftKey: "Shift",
6299
6299
  metaKey: "Meta"
6300
6300
  }, Xl = "can-duplicate-to";
6301
- var Oe = /* @__PURE__ */ ((e) => (e.CanPlay = "can-play", e.CanMove = "can-move", e.CanSpin = "can-spin", e.CanGrow = "can-grow", e.CanToggle = "can-toggle", e.CanDuplicate = "can-duplicate", e.CanHover = "can-hover", e.CanResize = "can-resize", e.CanMirror = "can-mirror", e))(Oe || {});
6301
+ var Re = /* @__PURE__ */ ((e) => (e.CanPlay = "can-play", e.CanMove = "can-move", e.CanSpin = "can-spin", e.CanGrow = "can-grow", e.CanToggle = "can-toggle", e.CanDuplicate = "can-duplicate", e.CanHover = "can-hover", e.CanResize = "can-resize", e.CanMirror = "can-mirror", e))(Re || {});
6302
6302
  function Jl(e) {
6303
6303
  return e.id;
6304
6304
  }
@@ -6322,7 +6322,7 @@ function ws(e, { getData: t, getElement: n, getLocalData: s, setLocalData: r })
6322
6322
  }
6323
6323
  r(o);
6324
6324
  }
6325
- function ae(e) {
6325
+ function he(e) {
6326
6326
  if ("touches" in e) {
6327
6327
  const { clientX: t, clientY: n } = e.touches[0];
6328
6328
  return { clientX: t, clientY: n };
@@ -6340,14 +6340,14 @@ const Pl = {
6340
6340
  e.style.transform = `translate(${t.x}px, ${t.y}px)`;
6341
6341
  },
6342
6342
  onDragStart: (e, { setLocalData: t }) => {
6343
- const { clientX: n, clientY: s } = ae(e);
6343
+ const { clientX: n, clientY: s } = he(e);
6344
6344
  t({
6345
6345
  startMouseX: n,
6346
6346
  startMouseY: s
6347
6347
  });
6348
6348
  },
6349
6349
  onDrag: (e, { data: t, localData: n, setData: s, setLocalData: r, element: i }) => {
6350
- const { clientX: o, clientY: c } = ae(e), { top: l, left: a, bottom: h, right: d } = i.getBoundingClientRect();
6350
+ const { clientX: o, clientY: c } = he(e), { top: l, left: a, bottom: h, right: d } = i.getBoundingClientRect();
6351
6351
  d > window.outerWidth && o > n.startMouseX || h > window.innerHeight && c > n.startMouseY || a < 0 && o < n.startMouseX || l < 0 && c < n.startMouseY || (s({
6352
6352
  x: t.x + o - n.startMouseX,
6353
6353
  y: t.y + c - n.startMouseY
@@ -6365,13 +6365,13 @@ const Pl = {
6365
6365
  e.style.transform = `rotate(${t.rotation}deg)`;
6366
6366
  },
6367
6367
  onDragStart: (e, { setLocalData: t }) => {
6368
- const { clientX: n } = ae(e);
6368
+ const { clientX: n } = he(e);
6369
6369
  t({
6370
6370
  startMouseX: n
6371
6371
  });
6372
6372
  },
6373
6373
  onDrag: (e, { data: t, localData: n, setData: s, setLocalData: r }) => {
6374
- const { clientX: i } = ae(e);
6374
+ const { clientX: i } = he(e);
6375
6375
  let o = Math.abs(i - n.startMouseX) * 2, c = t.rotation;
6376
6376
  i > n.startMouseX ? c += o : i < n.startMouseX && (c -= o), s({ rotation: c }), r({ startMouseX: i });
6377
6377
  },
@@ -6487,36 +6487,11 @@ const Pl = {
6487
6487
  ), !0) : !1;
6488
6488
  }
6489
6489
  },
6490
- [
6491
- "can-hover"
6492
- /* CanHover */
6493
- ]: {
6494
- defaultData: {},
6495
- myDefaultAwareness: { isHovering: !1 },
6496
- onMount: ({ setMyAwareness: e, getElement: t }) => {
6497
- debugger;
6498
- const n = t();
6499
- n.addEventListener("mouseover", () => {
6500
- console.log("inhere"), e({ isHovering: !0 });
6501
- }), n.addEventListener("mouseout", () => {
6502
- console.log("out"), e({ isHovering: !1 });
6503
- });
6504
- },
6505
- updateElement: () => {
6506
- },
6507
- updateElementAwareness: ({ element: e, awareness: t }) => {
6508
- console.log("updating"), e.classList.toggle(
6509
- "hovering",
6510
- t.some((n) => n.isHovering)
6511
- );
6512
- }
6513
- },
6514
- // [TagType.CanResize]: {},
6515
6490
  [
6516
6491
  "can-mirror"
6517
6492
  /* CanMirror */
6518
6493
  ]: {
6519
- defaultData: (e) => Pt(e),
6494
+ defaultData: (e) => Gt(e),
6520
6495
  onMount: ({ getElement: e, setData: t, getData: n }) => {
6521
6496
  const s = e();
6522
6497
  Gl(s, (r) => {
@@ -6525,12 +6500,12 @@ const Pl = {
6525
6500
  });
6526
6501
  },
6527
6502
  updateElement: ({ element: e, data: t }) => {
6528
- const n = Pt(e);
6529
- Ae(n, t) || Br(e, t);
6503
+ const n = Gt(e);
6504
+ Le(n, t) || Br(e, t);
6530
6505
  }
6531
6506
  }
6532
6507
  };
6533
- function Ae(e, t) {
6508
+ function Le(e, t) {
6534
6509
  if (e.tagName !== t.tagName || e.textContent !== t.textContent || Object.keys(e.attributes).length !== Object.keys(t.attributes).length)
6535
6510
  return !1;
6536
6511
  for (const [n, s] of Object.entries(e.attributes))
@@ -6539,7 +6514,7 @@ function Ae(e, t) {
6539
6514
  if (e.children.length !== t.children.length)
6540
6515
  return !1;
6541
6516
  for (let n = 0; n < e.children.length; n++)
6542
- if (!Ae(e.children[n], t.children[n]))
6517
+ if (!Le(e.children[n], t.children[n]))
6543
6518
  return !1;
6544
6519
  return !0;
6545
6520
  }
@@ -6589,13 +6564,13 @@ function ta(e, t) {
6589
6564
  t.addedNodes.length && t.addedNodes.forEach((n) => {
6590
6565
  if (!(n instanceof HTMLElement))
6591
6566
  return;
6592
- const s = Pt(n);
6593
- e.children.find((r) => Ae(r, s)) || e.children.push(s);
6567
+ const s = Gt(n);
6568
+ e.children.find((r) => Le(r, s)) || e.children.push(s);
6594
6569
  }), t.removedNodes.length && t.removedNodes.forEach((n) => {
6595
6570
  if (!(n instanceof HTMLElement))
6596
6571
  return;
6597
- const s = Pt(n), r = e.children.findIndex(
6598
- (i) => Ae(i, s)
6572
+ const s = Gt(n), r = e.children.findIndex(
6573
+ (i) => Le(i, s)
6599
6574
  );
6600
6575
  r !== -1 && e.children.splice(r, 1);
6601
6576
  });
@@ -6603,7 +6578,7 @@ function ta(e, t) {
6603
6578
  function ea(e, t) {
6604
6579
  t.target === e && (e.textContent = t.target.textContent);
6605
6580
  }
6606
- function Pt(e) {
6581
+ function Gt(e) {
6607
6582
  const t = {
6608
6583
  tagName: e.tagName.toLowerCase(),
6609
6584
  attributes: {},
@@ -6613,7 +6588,7 @@ function Pt(e) {
6613
6588
  for (const n of e.attributes)
6614
6589
  t.attributes[n.name] = n.value;
6615
6590
  return e.childNodes.forEach((n) => {
6616
- n instanceof HTMLElement && t.children.push(Pt(n));
6591
+ n instanceof HTMLElement && t.children.push(Gt(n));
6617
6592
  }), t;
6618
6593
  }
6619
6594
  function Br(e, t) {
@@ -6820,31 +6795,47 @@ async function ia(e, t) {
6820
6795
  return Array.from(new Uint8Array(s)).map((o) => o.toString(16).padStart(2, "0")).join("");
6821
6796
  }
6822
6797
  const oa = "playhtml.spencerc99.partykit.dev", dn = new wt();
6823
- function ca() {
6824
- return window.location.pathname + window.location.search;
6798
+ function ca(e) {
6799
+ const t = window.location.pathname.replace(/\.[^/.]+$/, "");
6800
+ return e ? t + window.location.search : t;
6825
6801
  }
6826
6802
  let N, W = dn.getMap("playhtml-global"), O = /* @__PURE__ */ new Map(), ft = /* @__PURE__ */ new Map();
6827
6803
  const ys = /* @__PURE__ */ new Map();
6828
- let la = 0, se = Pl;
6829
- function Hr() {
6830
- return [Oe.CanPlay, ...Object.keys(se)];
6804
+ let la = 0, re = Pl;
6805
+ function Vr() {
6806
+ return [Re.CanPlay, ...Object.keys(re)];
6831
6807
  }
6832
6808
  function aa(e) {
6833
6809
  N.ws && N.ws.send(JSON.stringify(e));
6834
6810
  }
6835
- let Re = !1, fn = !0;
6836
- function ha({
6811
+ function ha(e) {
6812
+ if (e.data instanceof Blob)
6813
+ return;
6814
+ let t;
6815
+ try {
6816
+ t = JSON.parse(e.data);
6817
+ } catch {
6818
+ return;
6819
+ }
6820
+ const { type: n, eventPayload: s } = t, r = ft.get(n);
6821
+ if (r)
6822
+ for (const i of r)
6823
+ i.onEvent(s);
6824
+ }
6825
+ let At = !1, fn = !0;
6826
+ async function ua({
6837
6827
  // TODO: if it is a localhost url, need to make some deterministic way to connect to the same room.
6838
- room: e = ca(),
6839
- host: t = oa,
6840
- extraCapabilities: n,
6841
- events: s
6828
+ host: e = oa,
6829
+ extraCapabilities: t,
6830
+ events: n,
6831
+ defaultRoomOptions: s = {},
6832
+ room: r = ca(s.includeSearch)
6842
6833
  } = {}) {
6843
6834
  if (!fn) {
6844
6835
  console.error("playhtml already set up!");
6845
6836
  return;
6846
6837
  }
6847
- const r = encodeURIComponent(window.location.hostname + "-" + e), i = t;
6838
+ const i = encodeURIComponent(window.location.hostname + "-" + r), o = e;
6848
6839
  if (console.log(
6849
6840
  `࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂
6850
6841
  ࿂࿂࿂࿂ ࿂ ࿂ ࿂ ࿂ ࿂ ࿂࿂࿂࿂
@@ -6852,38 +6843,27 @@ function ha({
6852
6843
  ࿂࿂࿂࿂ https://playhtml.fun ࿂࿂࿂࿂
6853
6844
  ࿂࿂࿂࿂ ࿂ ࿂ ࿂ ࿂ ࿂࿂࿂࿂
6854
6845
  ࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂`
6855
- ), N = new vl(i, r, dn), new zl(r, dn), n)
6856
- for (const [c, l] of Object.entries(n))
6857
- se[c] = l;
6858
- if (s)
6859
- for (const [c, l] of Object.entries(s))
6860
- Kr(c, l);
6861
- const o = document.createElement("link");
6862
- return o.rel = "stylesheet", o.href = "https://unpkg.com/playhtml@latest/dist/style.css", document.head.appendChild(o), N.on("sync", (c) => {
6863
- N.ws.addEventListener("message", (l) => {
6864
- if (l.data instanceof Blob)
6865
- return;
6866
- let a;
6867
- try {
6868
- a = JSON.parse(l.data);
6869
- } catch {
6870
- return;
6871
- }
6872
- const { type: h, eventPayload: d } = a, u = ft.get(h);
6873
- if (u)
6874
- for (const f of u)
6875
- f.onEvent(d);
6876
- }), c || console.error("Issue connecting to yjs..."), Re = !0, console.log("[PLAYHTML]: Setting up elements... Time to have some fun 🛝"), jr();
6846
+ ), N = new vl(o, i, dn), new zl(i, dn), t)
6847
+ for (const [l, a] of Object.entries(t))
6848
+ re[l] = a;
6849
+ if (n)
6850
+ for (const [l, a] of Object.entries(n))
6851
+ Kr(l, a);
6852
+ const c = document.createElement("link");
6853
+ return c.rel = "stylesheet", c.href = "https://unpkg.com/playhtml@latest/dist/style.css", document.head.appendChild(c), await new Promise((l) => {
6854
+ At && l(!0), N.on("sync", (a) => {
6855
+ a ? a && N.ws.addEventListener("message", ha) : console.error("Issue connecting to yjs..."), !At && (At = !0, console.log("[PLAYHTML]: Setting up elements... Time to have some fun 🛝"), jr(), l(!0));
6856
+ });
6877
6857
  }), N;
6878
6858
  }
6879
- function ua(e, t) {
6859
+ function da(e, t) {
6880
6860
  const n = N.awareness.getLocalState();
6881
6861
  return ((n == null ? void 0 : n[e]) ?? {})[t];
6882
6862
  }
6883
6863
  function Bn(e) {
6884
6864
  return e instanceof HTMLElement;
6885
6865
  }
6886
- function Vr(e, t) {
6866
+ function Fr(e, t) {
6887
6867
  if (e === t)
6888
6868
  return !0;
6889
6869
  if (e instanceof Object && t instanceof Object) {
@@ -6891,22 +6871,22 @@ function Vr(e, t) {
6891
6871
  if (n.length !== s.length)
6892
6872
  return !1;
6893
6873
  for (const r of n)
6894
- if (!Vr(e[r], t[r]))
6874
+ if (!Fr(e[r], t[r]))
6895
6875
  return !1;
6896
6876
  return !0;
6897
6877
  }
6898
6878
  return !1;
6899
6879
  }
6900
- function da(e, t, n, s) {
6880
+ function fa(e, t, n, s) {
6901
6881
  const r = W.get(t);
6902
6882
  return {
6903
6883
  ...n,
6904
6884
  // TODO: when adding save-state if no save state, then just use defaultData
6905
6885
  data: r.get(s) ?? (n.defaultData instanceof Function ? n.defaultData(e) : n.defaultData),
6906
- awareness: ua(t, s) ?? n.myDefaultAwareness !== void 0 ? [n.myDefaultAwareness] : void 0,
6886
+ awareness: da(t, s) ?? n.myDefaultAwareness !== void 0 ? [n.myDefaultAwareness] : void 0,
6907
6887
  element: e,
6908
6888
  onChange: (o) => {
6909
- Vr(r.get(s), o) || r.set(s, o);
6889
+ Fr(r.get(s), o) || r.set(s, o);
6910
6890
  },
6911
6891
  onAwarenessChange: (o) => {
6912
6892
  var l;
@@ -6914,15 +6894,15 @@ function da(e, t, n, s) {
6914
6894
  c[s] !== o && (c[s] = o, N.awareness.setLocalStateField(t, c));
6915
6895
  },
6916
6896
  triggerAwarenessUpdate: () => {
6917
- Fr();
6897
+ Hr();
6918
6898
  }
6919
6899
  };
6920
6900
  }
6921
- function fa(e) {
6901
+ function ga(e) {
6922
6902
  return e.defaultData !== void 0 && (typeof e.defaultData == "object" || typeof e.defaultData == "function") && e.updateElement !== void 0;
6923
6903
  }
6924
- function ga(e, t) {
6925
- if (e === Oe.CanPlay) {
6904
+ function pa(e, t) {
6905
+ if (e === Re.CanPlay) {
6926
6906
  const n = t;
6927
6907
  return {
6928
6908
  defaultData: n.defaultData,
@@ -6939,9 +6919,9 @@ function ga(e, t) {
6939
6919
  isValidElementForTag: n.isValidElementForTag
6940
6920
  };
6941
6921
  }
6942
- return se[e];
6922
+ return re[e];
6943
6923
  }
6944
- function Fr() {
6924
+ function Hr() {
6945
6925
  const e = /* @__PURE__ */ new Map();
6946
6926
  function t(n, s, r, i) {
6947
6927
  e.has(n) || e.set(n, /* @__PURE__ */ new Map());
@@ -6979,8 +6959,8 @@ function Fr() {
6979
6959
  });
6980
6960
  }
6981
6961
  function jr() {
6982
- if (Re) {
6983
- for (const e of Hr()) {
6962
+ if (At) {
6963
+ for (const e of Vr()) {
6984
6964
  const t = Array.from(
6985
6965
  document.querySelectorAll(`[${e}]`)
6986
6966
  ).filter(Bn);
@@ -6992,27 +6972,27 @@ function jr() {
6992
6972
  e.changes.keys.forEach((t, n) => {
6993
6973
  t.action === "add" && W.set(n, W.get(n));
6994
6974
  });
6995
- }), N.awareness.on("change", () => Fr()), fn = !1);
6975
+ }), N.awareness.on("change", () => Hr()), fn = !1);
6996
6976
  }
6997
6977
  }
6998
- const pa = {
6999
- init: ha,
6978
+ const wa = {
6979
+ init: ua,
7000
6980
  setupPlayElements: jr,
7001
- setupPlayElement: ya,
7002
- removePlayElement: ba,
6981
+ setupPlayElement: ba,
6982
+ removePlayElement: Sa,
7003
6983
  setupPlayElementForTag: $e,
7004
6984
  globalData: W,
7005
6985
  elementHandlers: O,
7006
6986
  eventHandlers: ft,
7007
- dispatchPlayEvent: Sa,
6987
+ dispatchPlayEvent: _a,
7008
6988
  registerPlayEventListener: Kr,
7009
- removePlayEventListener: _a
6989
+ removePlayEventListener: ka
7010
6990
  };
7011
- window.playhtml = pa;
7012
- function wa(e) {
7013
- if (O.has(e) || !Re)
6991
+ window.playhtml = wa;
6992
+ function ma(e) {
6993
+ if (O.has(e) || !At)
7014
6994
  return;
7015
- O.has(e) || O.set(e, /* @__PURE__ */ new Map()), e !== Oe.CanPlay && se[e], W.get(e) || W.set(e, new ht());
6995
+ O.has(e) || O.set(e, /* @__PURE__ */ new Map()), e !== Re.CanPlay && re[e], W.get(e) || W.set(e, new ht());
7016
6996
  const t = W.get(e);
7017
6997
  t.observe((n) => {
7018
6998
  n.changes.keys.forEach((s, r) => {
@@ -7032,13 +7012,13 @@ function wa(e) {
7032
7012
  });
7033
7013
  });
7034
7014
  }
7035
- function ma(e, t) {
7015
+ function ya(e, t) {
7036
7016
  var n, s;
7037
- return ((s = (n = se[t]) == null ? void 0 : n.isValidElementForTag) == null ? void 0 : s.call(n, e)) ?? !0;
7017
+ return ((s = (n = re[t]) == null ? void 0 : n.isValidElementForTag) == null ? void 0 : s.call(n, e)) ?? !0;
7038
7018
  }
7039
7019
  async function $e(e, t) {
7040
7020
  var c;
7041
- if (!ma(e, t) || !Re)
7021
+ if (!ya(e, t) || !At)
7042
7022
  return;
7043
7023
  if (!e.id) {
7044
7024
  const l = e.getAttribute("selector-id");
@@ -7055,18 +7035,18 @@ async function $e(e, t) {
7055
7035
  );
7056
7036
  return;
7057
7037
  }
7058
- wa(t);
7059
- const s = O.get(t), r = ga(
7038
+ ma(t);
7039
+ const s = O.get(t), r = pa(
7060
7040
  t,
7061
7041
  e
7062
7042
  );
7063
- if (!fa(r)) {
7043
+ if (!ga(r)) {
7064
7044
  console.error(
7065
7045
  `Element ${n} does not have proper info to initial a playhtml element. Please refer to https://github.com/spencerc99/playhtml#can-play for troubleshooting help.`
7066
7046
  );
7067
7047
  return;
7068
7048
  }
7069
- const i = W.get(t), o = da(
7049
+ const i = W.get(t), o = fa(
7070
7050
  e,
7071
7051
  t,
7072
7052
  r,
@@ -7082,7 +7062,7 @@ async function $e(e, t) {
7082
7062
  r.defaultData instanceof Function ? r.defaultData(e) : r.defaultData
7083
7063
  ), (c = o.triggerAwarenessUpdate) == null || c.call(o), e.classList.add("__playhtml-element"), e.classList.add(`__playhtml-${t}`), e.style.setProperty("--jiggle-delay", `${Math.random() * 1}s;}`);
7084
7064
  }
7085
- function ya(e, { ignoreIfAlreadySetup: t } = {}) {
7065
+ function ba(e, { ignoreIfAlreadySetup: t } = {}) {
7086
7066
  if (!(t && Object.keys(O || {}).some(
7087
7067
  (n) => {
7088
7068
  var s;
@@ -7094,18 +7074,18 @@ function ya(e, { ignoreIfAlreadySetup: t } = {}) {
7094
7074
  return;
7095
7075
  }
7096
7076
  Promise.all(
7097
- Hr().filter((n) => e.hasAttribute(n)).map((n) => $e(e, n))
7077
+ Vr().filter((n) => e.hasAttribute(n)).map((n) => $e(e, n))
7098
7078
  );
7099
7079
  }
7100
7080
  }
7101
- function ba(e) {
7081
+ function Sa(e) {
7102
7082
  if (!(!e || !e.id))
7103
7083
  for (const t of Object.keys(O)) {
7104
7084
  const n = O.get(t);
7105
7085
  n.has(e.id) && n.delete(e.id);
7106
7086
  }
7107
7087
  }
7108
- function Sa(e) {
7088
+ function _a(e) {
7109
7089
  const { type: t } = e;
7110
7090
  if (!ft.has(t)) {
7111
7091
  console.error(`[playhtml] event "${t}" not registered.`);
@@ -7120,7 +7100,7 @@ function Kr(e, t) {
7120
7100
  { type: e, ...t, id: n }
7121
7101
  ]), n;
7122
7102
  }
7123
- function _a(e, t) {
7103
+ function ka(e, t) {
7124
7104
  const n = ft.get(e);
7125
7105
  if (!n)
7126
7106
  return;
@@ -7128,5 +7108,5 @@ function _a(e, t) {
7128
7108
  s !== -1 && (n.splice(s, 1), n.length === 0 && ft.delete(e));
7129
7109
  }
7130
7110
  export {
7131
- pa as playhtml
7111
+ wa as playhtml
7132
7112
  };