playhtml 2.1.4 → 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.
Files changed (2) hide show
  1. package/dist/playhtml.es.js +137 -137
  2. package/package.json +1 -1
@@ -45,7 +45,7 @@ var oe = 1e6, Xr = "y-pk-batch", jn = !1, $t = (e, t) => {
45
45
  function Kn(e) {
46
46
  return `${Xr}#${JSON.stringify(e)}`;
47
47
  }
48
- const kt = () => /* @__PURE__ */ new Map(), Ss = (e, t, n) => {
48
+ const _t = () => /* @__PURE__ */ new Map(), Ss = (e, t, n) => {
49
49
  let s = e.get(t);
50
50
  return s === void 0 && e.set(t, s = n()), s;
51
51
  }, _s = () => /* @__PURE__ */ new Set(), Jr = Array.from, Wr = String.fromCharCode, Pr = (e) => e.toLowerCase(), Gr = /^\s*/g, qr = (e) => e.replace(Gr, ""), Zr = /([A-Z])/g, zn = (e, t) => qr(e.replace(Zr, (n) => `${t}${Pr(n)}`)), Qr = (e) => {
@@ -101,7 +101,7 @@ let V;
101
101
  const ci = () => {
102
102
  if (V === void 0)
103
103
  if (Lt) {
104
- V = kt();
104
+ V = _t();
105
105
  const e = process.argv;
106
106
  let t = null;
107
107
  for (let n = 0; n < e.length; n++) {
@@ -110,12 +110,12 @@ const ci = () => {
110
110
  }
111
111
  t !== null && V.set(t, "");
112
112
  } else
113
- typeof location == "object" ? (V = kt(), (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
116
  V.set(`--${zn(t, "-")}`, n), V.set(`-${zn(t, "-")}`, n);
117
117
  }
118
- })) : V = kt();
118
+ })) : V = _t();
119
119
  return V;
120
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");
@@ -154,7 +154,7 @@ const R = () => new fi(), pn = (e) => {
154
154
  for (let s = 0; s < n; s++)
155
155
  we(e, Ze[s]);
156
156
  } else
157
- Dt(e, ei(t));
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);
@@ -170,7 +170,7 @@ 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);
173
- }, Dt = (e, t) => {
173
+ }, kt = (e, t) => {
174
174
  v(e, t.byteLength), mi(e, t);
175
175
  }, Ls = (e) => new Error(e), yi = Ls("Unexpected end of array"), bi = Ls("Integer out of Range");
176
176
  let Si = class {
@@ -235,13 +235,13 @@ const Oi = typeof BroadcastChannel > "u" ? Ti : BroadcastChannel, wn = (e) => Ss
235
235
  }), Ri = (e, t) => (wn(e).subs.add(t), t), $i = (e, t) => {
236
236
  const n = wn(e), s = n.subs.delete(t);
237
237
  return s && n.subs.size === 0 && (n.bc.close(), vs.delete(e)), s;
238
- }, St = (e, t, n = null) => {
238
+ }, bt = (e, t, n = null) => {
239
239
  const s = wn(e);
240
240
  s.bc.postMessage(t), s.subs.forEach((r) => r(t, n));
241
241
  };
242
242
  let Ni = class {
243
243
  constructor() {
244
- this._observers = kt();
244
+ this._observers = _t();
245
245
  }
246
246
  /**
247
247
  * @param {N} name
@@ -278,10 +278,10 @@ let Ni = class {
278
278
  * @param {Array<any>} args The arguments that are applied to the event listener.
279
279
  */
280
280
  emit(t, n) {
281
- return Jr((this._observers.get(t) || kt()).values()).forEach((s) => s(...n));
281
+ return Jr((this._observers.get(t) || _t()).values()).forEach((s) => s(...n));
282
282
  }
283
283
  destroy() {
284
- this._observers = kt();
284
+ this._observers = _t();
285
285
  }
286
286
  };
287
287
  const Qe = Date.now, Bi = (e) => ii(e, (t, n) => `${encodeURIComponent(n)}=${encodeURIComponent(t)}`).join("&"), B = () => /* @__PURE__ */ new Map(), tn = (e) => {
@@ -351,7 +351,7 @@ class mn {
351
351
  this._observers = B();
352
352
  }
353
353
  }
354
- const P = Math.floor, de = Math.abs, Ms = (e, t) => e < t ? e : t, pt = (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} */
@@ -481,7 +481,7 @@ const lo = () => {
481
481
  return F;
482
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 = 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, lt = 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 = () => {
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");
@@ -494,7 +494,7 @@ class ve {
494
494
  this.arr = t, this.pos = 0;
495
495
  }
496
496
  }
497
- const wt = (e) => new ve(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
500
  }, I = (e) => po(e, w(e)), vt = (e) => e.arr[e.pos++], w = (e) => {
@@ -502,7 +502,7 @@ const wt = (e) => new ve(e), go = (e) => e.pos !== e.arr.length, po = (e, t) =>
502
502
  const s = e.arr.length;
503
503
  for (; e.pos < s; ) {
504
504
  const r = e.arr[e.pos++];
505
- if (t = t + (r & lt) * n, n *= 128, r < M)
505
+ if (t = t + (r & ct) * n, n *= 128, r < M)
506
506
  return t;
507
507
  if (t > Os)
508
508
  throw $s;
@@ -515,7 +515,7 @@ const wt = (e) => new ve(e), go = (e) => e.pos !== e.arr.length, po = (e, t) =>
515
515
  return r * n;
516
516
  const i = e.arr.length;
517
517
  for (; e.pos < i; ) {
518
- if (t = e.arr[e.pos++], n = n + (t & lt) * s, s *= 128, t < M)
518
+ if (t = e.arr[e.pos++], n = n + (t & ct) * s, s *= 128, t < M)
519
519
  return r * n;
520
520
  if (n > Os)
521
521
  throw $s;
@@ -674,18 +674,18 @@ const Zt = () => new qt(), Co = (e) => {
674
674
  return t.set(_n(e.cbuf.buffer, 0, e.cpos), n), t;
675
675
  }, Ao = (e, t) => {
676
676
  const n = e.cbuf.length;
677
- n - e.cpos < t && (e.bufs.push(_n(e.cbuf.buffer, 0, e.cpos)), e.cbuf = new Uint8Array(pt(n, t) * 2), e.cpos = 0);
677
+ n - e.cpos < t && (e.bufs.push(_n(e.cbuf.buffer, 0, e.cpos)), e.cbuf = new Uint8Array(gt(n, t) * 2), e.cpos = 0);
678
678
  }, E = (e, t) => {
679
679
  const n = e.cbuf.length;
680
680
  e.cpos === n && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(n * 2), e.cpos = 0), e.cbuf[e.cpos++] = t;
681
681
  }, rn = E, m = (e, t) => {
682
- for (; t > lt; )
683
- E(e, M | lt & t), t = P(t / 128);
684
- E(e, lt & t);
682
+ for (; t > ct; )
683
+ E(e, M | ct & t), t = P(t / 128);
684
+ E(e, ct & t);
685
685
  }, kn = (e, t) => {
686
686
  const n = xs(t);
687
687
  for (n && (t = -t), E(e, (t > sn ? M : 0) | (n ? J : 0) | sn & t), t = P(t / 64); t > 0; )
688
- E(e, (t > lt ? M : 0) | lt & t), t = P(t / 128);
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
691
  const n = Ht.encodeInto(t, on).written || 0;
@@ -703,10 +703,10 @@ const Zt = () => new qt(), Co = (e) => {
703
703
  /** @type {number} */
704
704
  n.codePointAt(r)
705
705
  );
706
- }, at = Ht && /** @type {any} */
706
+ }, lt = Ht && /** @type {any} */
707
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
- e.cbuf.set(t.subarray(0, r), s), e.cpos += r, i > 0 && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(pt(n * 2, i)), e.cbuf.set(t.subarray(r)), e.cpos = i);
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
711
  m(e, t.byteLength), Me(e, t);
712
712
  }, Dn = (e, t) => {
@@ -719,7 +719,7 @@ Ht.encodeInto ? Io : vo, Me = (e, t) => {
719
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
- E(e, 119), at(e, t);
722
+ E(e, 119), lt(e, t);
723
723
  break;
724
724
  case "number":
725
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));
@@ -742,7 +742,7 @@ Ht.encodeInto ? Io : vo, Me = (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
- at(e, r), Yt(e, t[r]);
745
+ lt(e, r), Yt(e, t[r]);
746
746
  }
747
747
  }
748
748
  break;
@@ -816,7 +816,7 @@ class Oo {
816
816
  }
817
817
  toUint8Array() {
818
818
  const t = new qt();
819
- return this.sarr.push(this.s), this.s = "", at(t, this.sarr.join("")), Me(t, this.lensE.toUint8Array()), $(t);
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(
@@ -941,7 +941,7 @@ const Ks = (e, t, n) => t.clients.forEach((s, r) => {
941
941
  let n, s;
942
942
  for (n = 1, s = 1; n < t.length; n++) {
943
943
  const r = t[s - 1], i = t[n];
944
- r.clock + r.len >= i.clock ? r.len = pt(r.len, i.clock + i.len - r.clock) : (s < n && (t[s] = i), s++);
944
+ r.clock + r.len >= i.clock ? r.len = gt(r.len, i.clock + i.len - r.clock) : (s < n && (t[s] = i), s++);
945
945
  }
946
946
  t.length = s;
947
947
  });
@@ -1021,12 +1021,12 @@ const Ks = (e, t, n) => t.clients.forEach((s, r) => {
1021
1021
  }
1022
1022
  }
1023
1023
  if (s.clients.size > 0) {
1024
- const i = new ht();
1024
+ const i = new at();
1025
1025
  return m(i.restEncoder, 0), Tt(i, s), i.toUint8Array();
1026
1026
  }
1027
1027
  return null;
1028
1028
  }, Ys = Ns;
1029
- class mt extends mn {
1029
+ class wt extends mn {
1030
1030
  /**
1031
1031
  * @param {DocOpts} opts configuration
1032
1032
  */
@@ -1143,7 +1143,7 @@ class mt extends mn {
1143
1143
  * @public
1144
1144
  */
1145
1145
  getArray(t = "") {
1146
- return this.get(t, Ct);
1146
+ return this.get(t, Et);
1147
1147
  }
1148
1148
  /**
1149
1149
  * @param {string} [name]
@@ -1162,7 +1162,7 @@ class mt extends mn {
1162
1162
  * @public
1163
1163
  */
1164
1164
  getMap(t = "") {
1165
- return this.get(t, ut);
1165
+ return this.get(t, ht);
1166
1166
  }
1167
1167
  /**
1168
1168
  * @param {string} [name]
@@ -1171,7 +1171,7 @@ class mt extends mn {
1171
1171
  * @public
1172
1172
  */
1173
1173
  getXmlFragment(t = "") {
1174
- return this.get(t, dt);
1174
+ return this.get(t, ut);
1175
1175
  }
1176
1176
  /**
1177
1177
  * Converts the entire document into a js object, recursively traversing each yjs type
@@ -1199,7 +1199,7 @@ class mt extends mn {
1199
1199
  /** @type {ContentDoc} */
1200
1200
  t.content
1201
1201
  );
1202
- n.doc = new mt({ guid: this.guid, ...n.opts, shouldLoad: !1 }), n.doc._item = t, S(
1202
+ n.doc = new wt({ guid: this.guid, ...n.opts, shouldLoad: !1 }), n.doc._item = t, S(
1203
1203
  /** @type {any} */
1204
1204
  t.parent.doc,
1205
1205
  (s) => {
@@ -1363,13 +1363,13 @@ class xt extends nc {
1363
1363
  * @return {ID}
1364
1364
  */
1365
1365
  readLeftID() {
1366
- return new Et(this.clientDecoder.read(), this.leftClockDecoder.read());
1366
+ return new Dt(this.clientDecoder.read(), this.leftClockDecoder.read());
1367
1367
  }
1368
1368
  /**
1369
1369
  * @return {ID}
1370
1370
  */
1371
1371
  readRightID() {
1372
- return new Et(this.clientDecoder.read(), this.rightClockDecoder.read());
1372
+ return new Dt(this.clientDecoder.read(), this.rightClockDecoder.read());
1373
1373
  }
1374
1374
  /**
1375
1375
  * Read the next client id.
@@ -1500,7 +1500,7 @@ class te extends Ws {
1500
1500
  * @param {string} s
1501
1501
  */
1502
1502
  writeString(t) {
1503
- at(this.restEncoder, t);
1503
+ lt(this.restEncoder, t);
1504
1504
  }
1505
1505
  /**
1506
1506
  * @param {boolean} isYKey
@@ -1538,13 +1538,13 @@ class te extends Ws {
1538
1538
  * @param {any} embed
1539
1539
  */
1540
1540
  writeJSON(t) {
1541
- at(this.restEncoder, JSON.stringify(t));
1541
+ lt(this.restEncoder, JSON.stringify(t));
1542
1542
  }
1543
1543
  /**
1544
1544
  * @param {string} key
1545
1545
  */
1546
1546
  writeKey(t) {
1547
- at(this.restEncoder, t);
1547
+ lt(this.restEncoder, t);
1548
1548
  }
1549
1549
  }
1550
1550
  class Ps {
@@ -1571,7 +1571,7 @@ class Ps {
1571
1571
  t === 0 && j(), m(this.restEncoder, t - 1), this.dsCurrVal += t;
1572
1572
  }
1573
1573
  }
1574
- class ht extends Ps {
1574
+ class at extends Ps {
1575
1575
  constructor() {
1576
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
  }
@@ -1665,7 +1665,7 @@ class ht extends Ps {
1665
1665
  }
1666
1666
  }
1667
1667
  const sc = (e, t, n, s) => {
1668
- s = pt(s, t[0].id.clock);
1668
+ s = gt(s, t[0].id.clock);
1669
1669
  const r = K(t, s);
1670
1670
  m(e.restEncoder, t.length - r), e.writeClient(n), m(e.restEncoder, s);
1671
1671
  const i = t[r];
@@ -1812,7 +1812,7 @@ const sc = (e, t, n, s) => {
1812
1812
  }
1813
1813
  }
1814
1814
  if (c.clients.size > 0) {
1815
- const f = new ht();
1815
+ const f = new at();
1816
1816
  return Ln(f, c, /* @__PURE__ */ new Map()), m(f.restEncoder, 0), { missing: l, update: f.toUint8Array() };
1817
1817
  }
1818
1818
  return null;
@@ -1837,7 +1837,7 @@ const sc = (e, t, n, s) => {
1837
1837
  c.pendingStructs = a;
1838
1838
  const d = ss(s, r, c);
1839
1839
  if (c.pendingDs) {
1840
- const u = new xt(wt(c.pendingDs));
1840
+ const u = new xt(pt(c.pendingDs));
1841
1841
  w(u.restDecoder);
1842
1842
  const f = ss(u, r, c);
1843
1843
  d && f ? c.pendingDs = Se([d, f]) : c.pendingDs = d || f;
@@ -1851,18 +1851,18 @@ const sc = (e, t, n, s) => {
1851
1851
  c.pendingStructs = null, Gs(r.doc, u);
1852
1852
  }
1853
1853
  }, n, !1), Gs = (e, t, n, s = xt) => {
1854
- const r = wt(t);
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
1857
  Ln(e, t.store, n), Tt(e, ec(t.store));
1858
- }, ac = (e, t = new Uint8Array([0]), n = new ht()) => {
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
1863
  if (n.constructor === te)
1864
1864
  return kc(r.map((i, o) => o === 0 ? i : Ac(i)));
1865
- if (n.constructor === ht)
1865
+ if (n.constructor === at)
1866
1866
  return Se(r);
1867
1867
  }
1868
1868
  return r[0];
@@ -1873,7 +1873,7 @@ const sc = (e, t, n, s) => {
1873
1873
  t.set(r, i);
1874
1874
  }
1875
1875
  return t;
1876
- }, Zs = (e) => hc(new Xs(wt(e))), Qs = (e, t) => (m(e.restEncoder, t.size), nt(t.entries()).sort((n, s) => s[0] - n[0]).forEach(([n, s]) => {
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
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 {
@@ -1885,7 +1885,7 @@ const rs = () => new gc(), is = (e, t) => e.l.push(t), os = (e, t) => {
1885
1885
  const n = e.l, s = n.length;
1886
1886
  e.l = n.filter((r) => t !== r), s === e.l.length && console.error("[yjs] Tried to remove event handler that doesn't exist.");
1887
1887
  }, tr = (e, t, n) => yn(e.l, [t, n]);
1888
- class Et {
1888
+ class Dt {
1889
1889
  /**
1890
1890
  * @param {number} client client id
1891
1891
  * @param {number} clock unique per client id, continuous number
@@ -1894,12 +1894,12 @@ class Et {
1894
1894
  this.client = t, this.clock = n;
1895
1895
  }
1896
1896
  }
1897
- const ce = (e, t) => e === t || e !== null && t !== null && e.client === t.client && e.clock === t.clock, b = (e, t) => new Et(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
- }, _t = (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) => {
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
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));
@@ -2064,7 +2064,7 @@ const ls = (e, t) => t.deleteSet.clients.size === 0 && !Fi(t.afterState, (n, s)
2064
2064
  const f = (
2065
2065
  /** @type {Array<GC|Item>} */
2066
2066
  r.clients.get(d)
2067
- ), g = pt(K(f, u), 1);
2067
+ ), g = gt(K(f, u), 1);
2068
2068
  for (let p = f.length - 1; p >= g; )
2069
2069
  p -= 1 + pe(f, p);
2070
2070
  }
@@ -2081,7 +2081,7 @@ const ls = (e, t) => t.deleteSet.clients.size === 0 && !Fi(t.afterState, (n, s)
2081
2081
  ls(h, n) && s.emit("update", [h.toUint8Array(), n.origin, s, n]);
2082
2082
  }
2083
2083
  if (s._observers.has("updateV2")) {
2084
- const h = new ht();
2084
+ const h = new at();
2085
2085
  ls(h, n) && s.emit("updateV2", [h.toUint8Array(), n.origin, s, n]);
2086
2086
  }
2087
2087
  const { subdocsAdded: c, subdocsLoaded: l, subdocsRemoved: a } = n;
@@ -2190,10 +2190,10 @@ const kc = (e) => Se(e, Js, te), Dc = (e, t) => {
2190
2190
  n.content.splice(t)
2191
2191
  );
2192
2192
  }
2193
- }, Se = (e, t = xt, n = ht) => {
2193
+ }, Se = (e, t = xt, n = at) => {
2194
2194
  if (e.length === 1)
2195
2195
  return e[0];
2196
- const s = e.map((h) => new t(wt(h)));
2196
+ const s = e.map((h) => new t(pt(h)));
2197
2197
  let r = s.map((h) => new vn(h, !0)), i = null;
2198
2198
  const o = new n(), c = new Mn(o);
2199
2199
  for (; r = r.filter((u) => u.curr !== null), r.sort(
@@ -2249,8 +2249,8 @@ const kc = (e) => Se(e, Js, te), Dc = (e, t) => {
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
2251
  return Tt(o, a), o.toUint8Array();
2252
- }, Ec = (e, t, n = xt, s = ht) => {
2253
- const r = Zs(t), i = new s(), o = new Mn(i), c = new n(wt(e)), l = new vn(c, !1);
2252
+ }, Ec = (e, t, n = xt, s = at) => {
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;
2256
2256
  if (l.curr.constructor === T) {
@@ -2258,7 +2258,7 @@ const kc = (e) => Se(e, Js, te), Dc = (e, t) => {
2258
2258
  continue;
2259
2259
  }
2260
2260
  if (h.id.clock + h.length > u)
2261
- for (Q(o, h, pt(u - h.id.clock, 0)), l.next(); l.curr && l.curr.id.client === d; )
2261
+ for (Q(o, h, gt(u - h.id.clock, 0)), l.next(); l.curr && l.curr.id.client === d; )
2262
2262
  Q(o, l.curr, 0), l.next();
2263
2263
  else
2264
2264
  for (; l.curr && l.curr.id.client === d && l.curr.id.clock + l.curr.length <= u; )
@@ -2280,7 +2280,7 @@ const kc = (e) => Se(e, Js, te), Dc = (e, t) => {
2280
2280
  m(t, s.written), Me(t, s.restEncoder);
2281
2281
  }
2282
2282
  }, Cc = (e, t, n, s) => {
2283
- const r = new n(wt(e)), i = new vn(r, !1), o = new s(), c = new Mn(o);
2283
+ const r = new n(pt(e)), i = new vn(r, !1), o = new s(), c = new Mn(o);
2284
2284
  for (let a = i.curr; a !== null; a = i.next())
2285
2285
  Q(c, t(a), 0);
2286
2286
  xn(c);
@@ -2494,7 +2494,7 @@ const vc = (e) => {
2494
2494
  }
2495
2495
  r.p = i, i.marker = !0;
2496
2496
  }
2497
- (t < r.index || n > 0 && t === r.index) && (r.index = pt(t, r.index + n));
2497
+ (t < r.index || n > 0 && t === r.index) && (r.index = gt(t, r.index + n));
2498
2498
  }
2499
2499
  }, Oe = (e, t, n) => {
2500
2500
  const s = e, r = t.changedParentTypes;
@@ -2688,7 +2688,7 @@ const lr = (e, t, n) => {
2688
2688
  const i = e.doc, o = i.clientID, c = i.store, l = n === null ? t._start : n.right;
2689
2689
  let a = [];
2690
2690
  const h = () => {
2691
- a.length > 0 && (r = new k(b(o, C(c, o)), r, r && r.lastId, l, l && l.id, t, null, new ft(a)), r.integrate(e, 0), a = []);
2691
+ a.length > 0 && (r = new k(b(o, C(c, o)), r, r && r.lastId, l, l && l.id, t, null, new dt(a)), r.integrate(e, 0), a = []);
2692
2692
  };
2693
2693
  s.forEach((d) => {
2694
2694
  if (d === null)
@@ -2711,7 +2711,7 @@ const lr = (e, t, n) => {
2711
2711
  d
2712
2712
  ))), r.integrate(e, 0);
2713
2713
  break;
2714
- case mt:
2714
+ case wt:
2715
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
@@ -2771,7 +2771,7 @@ const lr = (e, t, n) => {
2771
2771
  const r = t._map.get(n) || null, i = e.doc, o = i.clientID;
2772
2772
  let c;
2773
2773
  if (s == null)
2774
- c = new ft([s]);
2774
+ c = new dt([s]);
2775
2775
  else
2776
2776
  switch (s.constructor) {
2777
2777
  case Number:
@@ -2779,7 +2779,7 @@ const lr = (e, t, n) => {
2779
2779
  case Boolean:
2780
2780
  case Array:
2781
2781
  case String:
2782
- c = new ft([s]);
2782
+ c = new dt([s]);
2783
2783
  break;
2784
2784
  case Uint8Array:
2785
2785
  c = new ee(
@@ -2787,7 +2787,7 @@ const lr = (e, t, n) => {
2787
2787
  s
2788
2788
  );
2789
2789
  break;
2790
- case mt:
2790
+ case wt:
2791
2791
  c = new ne(
2792
2792
  /** @type {Doc} */
2793
2793
  s
@@ -2817,7 +2817,7 @@ const lr = (e, t, n) => {
2817
2817
  let i = s;
2818
2818
  for (; i !== null && (!t.sv.has(i.id.client) || i.id.clock >= (t.sv.get(i.id.client) || 0)); )
2819
2819
  i = i.left;
2820
- i !== null && _t(i, t) && (n[r] = i.content.getContent()[i.length - 1]);
2820
+ i !== null && St(i, t) && (n[r] = i.content.getContent()[i.length - 1]);
2821
2821
  }), n;
2822
2822
  }, le = (e) => qo(
2823
2823
  e.entries(),
@@ -2833,7 +2833,7 @@ class Oc extends Ue {
2833
2833
  super(t, n), this._transaction = n;
2834
2834
  }
2835
2835
  }
2836
- class Ct extends A {
2836
+ class Et extends A {
2837
2837
  constructor() {
2838
2838
  super(), this._prelimContent = [], this._searchMarker = [];
2839
2839
  }
@@ -2844,7 +2844,7 @@ class Ct extends A {
2844
2844
  * @return {YArray<T>}
2845
2845
  */
2846
2846
  static from(t) {
2847
- const n = new Ct();
2847
+ const n = new Et();
2848
2848
  return n.push(t), n;
2849
2849
  }
2850
2850
  /**
@@ -2868,13 +2868,13 @@ class Ct extends A {
2868
2868
  * @return {YArray<T>}
2869
2869
  */
2870
2870
  _copy() {
2871
- return new Ct();
2871
+ return new Et();
2872
2872
  }
2873
2873
  /**
2874
2874
  * @return {YArray<T>}
2875
2875
  */
2876
2876
  clone() {
2877
- const t = new Ct();
2877
+ const t = new Et();
2878
2878
  return t.insert(0, this.toArray().map(
2879
2879
  (n) => n instanceof A ? (
2880
2880
  /** @type {typeof el} */
@@ -3029,7 +3029,7 @@ class Ct extends A {
3029
3029
  t.writeTypeRef(rl);
3030
3030
  }
3031
3031
  }
3032
- const Rc = (e) => new Ct();
3032
+ const Rc = (e) => new Et();
3033
3033
  class $c extends Ue {
3034
3034
  /**
3035
3035
  * @param {YMap<T>} ymap The YArray that changed.
@@ -3040,7 +3040,7 @@ class $c extends Ue {
3040
3040
  super(t, n), this.keysChanged = s;
3041
3041
  }
3042
3042
  }
3043
- class ut extends A {
3043
+ class ht extends A {
3044
3044
  /**
3045
3045
  *
3046
3046
  * @param {Iterable<readonly [string, any]>=} entries - an optional iterable to initialize the YMap
@@ -3067,13 +3067,13 @@ class ut extends A {
3067
3067
  * @return {YMap<MapType>}
3068
3068
  */
3069
3069
  _copy() {
3070
- return new ut();
3070
+ return new ht();
3071
3071
  }
3072
3072
  /**
3073
3073
  * @return {YMap<MapType>}
3074
3074
  */
3075
3075
  clone() {
3076
- const t = new ut();
3076
+ const t = new ht();
3077
3077
  return this.forEach((n, s) => {
3078
3078
  t.set(s, n instanceof A ? (
3079
3079
  /** @type {typeof value} */
@@ -3236,7 +3236,7 @@ class ut extends A {
3236
3236
  t.writeTypeRef(il);
3237
3237
  }
3238
3238
  }
3239
- const Nc = (e) => new ut(), tt = (e, t) => e === t || typeof e == "object" && typeof t == "object" && e && t && ro(e, t);
3239
+ const Nc = (e) => new ht(), tt = (e, t) => e === t || typeof e == "object" && typeof t == "object" && e && t && ro(e, t);
3240
3240
  class an {
3241
3241
  /**
3242
3242
  * @param {Item|null} left
@@ -3346,7 +3346,7 @@ const us = (e, t, n) => {
3346
3346
  const c = br(e, t, n, r), l = s.constructor === String ? new z(
3347
3347
  /** @type {string} */
3348
3348
  s
3349
- ) : s instanceof A ? new Z(s) : new yt(s);
3349
+ ) : s instanceof A ? new Z(s) : new mt(s);
3350
3350
  let { left: a, right: h, index: d } = n;
3351
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) => {
@@ -3510,7 +3510,7 @@ const us = (e, t, n) => {
3510
3510
  if (t.right.deleted === !1)
3511
3511
  switch (t.right.content.constructor) {
3512
3512
  case Z:
3513
- case yt:
3513
+ case mt:
3514
3514
  case z:
3515
3515
  n < t.right.length && st(e, b(t.right.id.client, t.right.id.clock + n)), n -= t.right.length, t.right.delete(e);
3516
3516
  break;
@@ -3595,7 +3595,7 @@ class Hc extends Ue {
3595
3595
  for (; o !== null; ) {
3596
3596
  switch (o.content.constructor) {
3597
3597
  case Z:
3598
- case yt:
3598
+ case mt:
3599
3599
  this.adds(o) ? this.deletes(o) || (u(), c = "insert", a = o.content.getContent()[0], u()) : this.deletes(o) ? (c !== "delete" && (u(), c = "delete"), d += 1) : o.deleted || (c !== "retain" && (u(), c = "retain"), h += 1);
3600
3600
  break;
3601
3601
  case z:
@@ -3769,16 +3769,16 @@ class Ut extends A {
3769
3769
  }
3770
3770
  const h = () => {
3771
3771
  for (; l !== null; ) {
3772
- if (_t(l, t) || n !== void 0 && _t(l, n))
3772
+ if (St(l, t) || n !== void 0 && St(l, n))
3773
3773
  switch (l.content.constructor) {
3774
3774
  case z: {
3775
3775
  const d = i.get("ychange");
3776
- t !== void 0 && !_t(l, t) ? (d === void 0 || d.user !== l.id.client || d.type !== "removed") && (a(), i.set("ychange", s ? s("removed", l.id) : { type: "removed" })) : n !== void 0 && !_t(l, n) ? (d === void 0 || d.user !== l.id.client || d.type !== "added") && (a(), i.set("ychange", s ? s("added", l.id) : { type: "added" })) : d !== void 0 && (a(), i.delete("ychange")), c += /** @type {ContentString} */
3776
+ t !== void 0 && !St(l, t) ? (d === void 0 || d.user !== l.id.client || d.type !== "removed") && (a(), i.set("ychange", s ? s("removed", l.id) : { type: "removed" })) : n !== void 0 && !St(l, n) ? (d === void 0 || d.user !== l.id.client || d.type !== "added") && (a(), i.set("ychange", s ? s("added", l.id) : { type: "added" })) : d !== void 0 && (a(), i.delete("ychange")), c += /** @type {ContentString} */
3777
3777
  l.content.str;
3778
3778
  break;
3779
3779
  }
3780
3780
  case Z:
3781
- case yt: {
3781
+ case mt: {
3782
3782
  a();
3783
3783
  const d = {
3784
3784
  insert: l.content.getContent()[0]
@@ -3796,7 +3796,7 @@ class Ut extends A {
3796
3796
  break;
3797
3797
  }
3798
3798
  case D:
3799
- _t(l, t) && (a(), Ot(
3799
+ St(l, t) && (a(), Ot(
3800
3800
  i,
3801
3801
  /** @type {ContentFormat} */
3802
3802
  l.content
@@ -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 === Wt || n.constructor === dt) && 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; )
@@ -3995,7 +3995,7 @@ class Xe {
3995
3995
  ), done: !1 });
3996
3996
  }
3997
3997
  }
3998
- class dt extends A {
3998
+ class ut extends A {
3999
3999
  constructor() {
4000
4000
  super(), this._prelimContent = [];
4001
4001
  }
@@ -4024,13 +4024,13 @@ class dt extends A {
4024
4024
  ), this._prelimContent = null;
4025
4025
  }
4026
4026
  _copy() {
4027
- return new dt();
4027
+ return new ut();
4028
4028
  }
4029
4029
  /**
4030
4030
  * @return {YXmlFragment}
4031
4031
  */
4032
4032
  clone() {
4033
- const t = new dt();
4033
+ const t = new ut();
4034
4034
  return t.insert(0, this.toArray().map((n) => n instanceof A ? n.clone() : n)), t;
4035
4035
  }
4036
4036
  get length() {
@@ -4249,8 +4249,8 @@ class dt extends A {
4249
4249
  t.writeTypeRef(ll);
4250
4250
  }
4251
4251
  }
4252
- const Kc = (e) => new dt();
4253
- class Wt extends dt {
4252
+ const Kc = (e) => new ut();
4253
+ class Wt extends ut {
4254
4254
  constructor(t = "UNDEFINED") {
4255
4255
  super(), this.nodeName = t, this._prelimAttrs = /* @__PURE__ */ new Map();
4256
4256
  }
@@ -4455,7 +4455,7 @@ class Yc extends Ue {
4455
4455
  });
4456
4456
  }
4457
4457
  }
4458
- class De extends ut {
4458
+ class De extends ht {
4459
4459
  /**
4460
4460
  * @param {string} hookName nodeName of the Dom Node.
4461
4461
  */
@@ -4832,7 +4832,7 @@ class Pt {
4832
4832
  return 1;
4833
4833
  }
4834
4834
  }
4835
- const Gc = (e) => new Pt(e.readLen()), _r = (e, t) => new mt({ guid: e, ...t, shouldLoad: t.shouldLoad || t.autoLoad || !1 });
4835
+ const Gc = (e) => new Pt(e.readLen()), _r = (e, t) => new wt({ guid: e, ...t, shouldLoad: t.shouldLoad || t.autoLoad || !1 });
4836
4836
  class ne {
4837
4837
  /**
4838
4838
  * @param {Doc} doc
@@ -4913,7 +4913,7 @@ class ne {
4913
4913
  }
4914
4914
  }
4915
4915
  const qc = (e) => new ne(_r(e.readString(), e.readAny()));
4916
- class yt {
4916
+ class mt {
4917
4917
  /**
4918
4918
  * @param {Object} embed
4919
4919
  */
@@ -4942,7 +4942,7 @@ class yt {
4942
4942
  * @return {ContentEmbed}
4943
4943
  */
4944
4944
  copy() {
4945
- return new yt(this.embed);
4945
+ return new mt(this.embed);
4946
4946
  }
4947
4947
  /**
4948
4948
  * @param {number} offset
@@ -4988,7 +4988,7 @@ class yt {
4988
4988
  return 5;
4989
4989
  }
4990
4990
  }
4991
- const Zc = (e) => new yt(e.readJSON());
4991
+ const Zc = (e) => new mt(e.readJSON());
4992
4992
  class D {
4993
4993
  /**
4994
4994
  * @param {string} key
@@ -5160,7 +5160,7 @@ const tl = (e) => {
5160
5160
  }
5161
5161
  return new Ce(n);
5162
5162
  };
5163
- class ft {
5163
+ class dt {
5164
5164
  /**
5165
5165
  * @param {Array<any>} arr
5166
5166
  */
@@ -5189,14 +5189,14 @@ class ft {
5189
5189
  * @return {ContentAny}
5190
5190
  */
5191
5191
  copy() {
5192
- return new ft(this.arr);
5192
+ return new dt(this.arr);
5193
5193
  }
5194
5194
  /**
5195
5195
  * @param {number} offset
5196
5196
  * @return {ContentAny}
5197
5197
  */
5198
5198
  splice(t) {
5199
- const n = new ft(this.arr.slice(t));
5199
+ const n = new dt(this.arr.slice(t));
5200
5200
  return this.arr = this.arr.slice(0, t), n;
5201
5201
  }
5202
5202
  /**
@@ -5245,7 +5245,7 @@ const el = (e) => {
5245
5245
  const t = e.readLen(), n = [];
5246
5246
  for (let s = 0; s < t; s++)
5247
5247
  n.push(e.readAny());
5248
- return new ft(n);
5248
+ return new dt(n);
5249
5249
  };
5250
5250
  class z {
5251
5251
  /**
@@ -5501,13 +5501,13 @@ class k extends Rn {
5501
5501
  return this.origin.client;
5502
5502
  if (this.rightOrigin && this.rightOrigin.client !== this.id.client && this.rightOrigin.clock >= C(n, this.rightOrigin.client))
5503
5503
  return this.rightOrigin.client;
5504
- if (this.parent && this.parent.constructor === Et && this.id.client !== this.parent.client && this.parent.clock >= C(n, this.parent.client))
5504
+ if (this.parent && this.parent.constructor === Dt && this.id.client !== this.parent.client && this.parent.clock >= C(n, this.parent.client))
5505
5505
  return this.parent.client;
5506
5506
  if (this.origin && (this.left = cs(t, n, this.origin), this.origin = this.left.lastId), this.rightOrigin && (this.right = st(t, this.rightOrigin), this.rightOrigin = this.right.id), this.left && this.left.constructor === U || this.right && this.right.constructor === U)
5507
5507
  this.parent = null;
5508
5508
  else if (!this.parent)
5509
5509
  this.left && this.left.constructor === k && (this.parent = this.left.parent, this.parentSub = this.left.parentSub), this.right && this.right.constructor === k && (this.parent = this.right.parent, this.parentSub = this.right.parentSub);
5510
- else if (this.parent.constructor === Et) {
5510
+ else if (this.parent.constructor === Dt) {
5511
5511
  const s = ze(n, this.parent);
5512
5512
  s.constructor === U ? this.parent = null : this.parent = /** @type {ContentType} */
5513
5513
  s.content.type;
@@ -5662,7 +5662,7 @@ class k extends Rn {
5662
5662
  } else
5663
5663
  t.writeParentInfo(!1), t.writeLeftID(l.id);
5664
5664
  } else
5665
- c.constructor === String ? (t.writeParentInfo(!0), t.writeString(c)) : c.constructor === Et ? (t.writeParentInfo(!1), t.writeLeftID(c)) : j();
5665
+ c.constructor === String ? (t.writeParentInfo(!0), t.writeString(c)) : c.constructor === Dt ? (t.writeParentInfo(!1), t.writeLeftID(c)) : j();
5666
5666
  i !== null && t.writeString(i);
5667
5667
  }
5668
5668
  this.content.write(t, n);
@@ -5828,11 +5828,11 @@ const $n = (e, t, n) => {
5828
5828
  /** @type {MetaClientState} */
5829
5829
  e.meta.get(o).clock
5830
5830
  );
5831
- m(r, o), m(r, l), at(r, JSON.stringify(c));
5831
+ m(r, o), m(r, l), lt(r, JSON.stringify(c));
5832
5832
  }
5833
5833
  return $(r);
5834
5834
  }, ml = (e, t, n) => {
5835
- const s = wt(t), r = ye(), 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);
@@ -5882,7 +5882,7 @@ const $n = (e, t, n) => {
5882
5882
  }
5883
5883
  return r;
5884
5884
  };
5885
- var it = 0, vr = 3, At = 1, kl = 2, Dl = typeof window > "u";
5885
+ var it = 0, vr = 3, Ct = 1, kl = 2, Dl = typeof window > "u";
5886
5886
  function El(e, t) {
5887
5887
  if (!e)
5888
5888
  throw new Error(t);
@@ -5899,7 +5899,7 @@ se[it] = (e, t, n, s, r) => {
5899
5899
  s && i === Nn && !n.synced && (n.synced = !0);
5900
5900
  };
5901
5901
  se[vr] = (e, t, n, s, r) => {
5902
- v(e, At), Dt(
5902
+ v(e, Ct), kt(
5903
5903
  e,
5904
5904
  Vt(
5905
5905
  n.awareness,
@@ -5907,7 +5907,7 @@ se[vr] = (e, t, n, s, r) => {
5907
5907
  )
5908
5908
  );
5909
5909
  };
5910
- se[At] = (e, t, n, s, r) => {
5910
+ se[Ct] = (e, t, n, s, r) => {
5911
5911
  ml(
5912
5912
  n.awareness,
5913
5913
  Di(t),
@@ -5973,7 +5973,7 @@ function xr(e) {
5973
5973
  const n = R();
5974
5974
  if (v(n, it), hn(n, e.doc), $t(x(n), t), e.awareness.getLocalState() !== null) {
5975
5975
  const s = R();
5976
- v(s, At), Dt(
5976
+ v(s, Ct), kt(
5977
5977
  s,
5978
5978
  Vt(e.awareness, [
5979
5979
  e.doc.clientID
@@ -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 && $t(t, n), e.bcconnected && St(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, {
@@ -6042,7 +6042,7 @@ var Al = typeof WebSocket > "u" ? null : WebSocket, Ll = class extends Ni {
6042
6042
  }, l)), this._bcSubscriber = (u, f) => {
6043
6043
  if (f !== this) {
6044
6044
  const g = Mr(this, new Uint8Array(u), !1);
6045
- pn(g) > 1 && St(this.bcChannel, x(g), this);
6045
+ pn(g) > 1 && bt(this.bcChannel, x(g), this);
6046
6046
  }
6047
6047
  }, this._updateHandler = (u, f) => {
6048
6048
  if (f !== this) {
@@ -6051,7 +6051,7 @@ var Al = typeof WebSocket > "u" ? null : WebSocket, Ll = class extends Ni {
6051
6051
  }
6052
6052
  }, this.doc.on("update", this._updateHandler), this._awarenessUpdateHandler = ({ added: u, updated: f, removed: g }, p) => {
6053
6053
  const _ = u.concat(f).concat(g), Y = R();
6054
- v(Y, At), Dt(
6054
+ v(Y, Ct), kt(
6055
6055
  Y,
6056
6056
  Vt(i, _)
6057
6057
  ), We(this, x(Y));
@@ -6083,22 +6083,22 @@ var Al = typeof WebSocket > "u" ? null : WebSocket, Ll = class extends Ni {
6083
6083
  return;
6084
6084
  this.bcconnected || (Ri(this.bcChannel, this._bcSubscriber), this.bcconnected = !0);
6085
6085
  const t = R();
6086
- v(t, it), hn(t, this.doc), St(this.bcChannel, x(t), this);
6086
+ v(t, it), hn(t, this.doc), bt(this.bcChannel, x(t), this);
6087
6087
  const n = R();
6088
- v(n, it), Lr(n, this.doc), St(this.bcChannel, x(n), this);
6088
+ v(n, it), Lr(n, this.doc), bt(this.bcChannel, x(n), this);
6089
6089
  const s = R();
6090
- v(s, vr), St(
6090
+ v(s, vr), bt(
6091
6091
  this.bcChannel,
6092
6092
  x(s),
6093
6093
  this
6094
6094
  );
6095
6095
  const r = R();
6096
- v(r, At), Dt(
6096
+ v(r, Ct), kt(
6097
6097
  r,
6098
6098
  Vt(this.awareness, [
6099
6099
  this.doc.clientID
6100
6100
  ])
6101
- ), St(
6101
+ ), bt(
6102
6102
  this.bcChannel,
6103
6103
  x(r),
6104
6104
  this
@@ -6106,7 +6106,7 @@ var Al = typeof WebSocket > "u" ? null : WebSocket, Ll = class extends Ni {
6106
6106
  }
6107
6107
  disconnectBc() {
6108
6108
  const t = R();
6109
- v(t, At), Dt(
6109
+ v(t, Ct), kt(
6110
6110
  t,
6111
6111
  Vt(
6112
6112
  this.awareness,
@@ -6137,21 +6137,21 @@ function ps(e, t, n) {
6137
6137
  `Invalid "${t}" parameter provided to YPartyKitProvider. Expected: ${n}, received: ${e}`
6138
6138
  );
6139
6139
  }
6140
- var ct, bs, vl = (bs = class extends Ll {
6140
+ var ot, bs, vl = (bs = class extends Ll {
6141
6141
  constructor(t, n, s, r = {}) {
6142
6142
  ps(t, "host", "string"), ps(n, "room", "string"), t = t.replace(/^(http|https|ws|wss):\/\//, ""), t.endsWith("/") && t.slice(0, -1);
6143
6143
  const i = `${t.startsWith("localhost:") || t.startsWith("127.0.0.1:") || t.startsWith("192.168.") || t.startsWith("10.") || t.startsWith("172.") && t.split(".")[1] >= "16" && t.split(".")[1] <= "31" ? "ws" : "wss"}://${t}${r.party ? `/parties/${r.party}` : "/party"}`, o = r.connectionId ?? Il(), { params: c, connect: l = !0, ...a } = r, h = {
6144
6144
  ...a,
6145
6145
  connect: !1
6146
6146
  };
6147
- super(i, n, s ?? new mt(), h);
6147
+ super(i, n, s ?? new wt(), h);
6148
6148
  y(this, "id");
6149
- Fn(this, ct, void 0);
6150
- this.id = o, Hn(this, ct, 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 ie(this, ct) == "function" ? ie(this, ct).call(this) : ie(this, ct)
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)
@@ -6163,8 +6163,8 @@ var ct, bs, vl = (bs = class extends Ll {
6163
6163
  throw console.error("Failed to open connecton to PartyKit", t), new Error(t);
6164
6164
  });
6165
6165
  }
6166
- }, ct = new WeakMap(), bs);
6167
- const bt = (e) => Mt((t, n) => {
6166
+ }, ot = new WeakMap(), bs);
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
6169
  }), Ml = (e, t) => Mt((n, s) => {
6170
6170
  const r = indexedDB.open(e);
@@ -6174,7 +6174,7 @@ const bt = (e) => Mt((t, n) => {
6174
6174
  o.close();
6175
6175
  }, typeof addEventListener < "u" && addEventListener("unload", () => o.close()), n(o);
6176
6176
  };
6177
- }), xl = (e) => bt(indexedDB.deleteDatabase(e)), Ul = (e, t) => t.forEach(
6177
+ }), xl = (e) => yt(indexedDB.deleteDatabase(e)), Ul = (e, t) => t.forEach(
6178
6178
  (n) => (
6179
6179
  // @ts-ignore
6180
6180
  e.createObjectStore.apply(e, n)
@@ -6182,7 +6182,7 @@ const bt = (e) => Mt((t, n) => {
6182
6182
  ), Rt = (e, t, n = "readwrite") => {
6183
6183
  const s = e.transaction(t, n);
6184
6184
  return t.map((r) => Fl(s, r));
6185
- }, Ur = (e, t) => bt(e.count(t)), Tl = (e, t) => bt(e.get(t)), Tr = (e, t) => bt(e.delete(t)), Ol = (e, t, n) => bt(e.put(t, n)), un = (e, t) => bt(e.add(t)), Rl = (e, t, n) => bt(e.getAll(t, n)), $l = (e, t, n) => {
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
6187
  return Vl(e, t, (r) => (s = r, !1), n).then(() => s);
6188
6188
  }, Nl = (e, t = null) => $l(e, t, "prev"), Bl = (e, t) => Mt((n, s) => {
@@ -6794,12 +6794,12 @@ async function ia(e, t) {
6794
6794
  const n = new TextEncoder().encode(`${e}-${t.outerHTML}}`), s = await crypto.subtle.digest("SHA-1", n);
6795
6795
  return Array.from(new Uint8Array(s)).map((o) => o.toString(16).padStart(2, "0")).join("");
6796
6796
  }
6797
- const oa = "playhtml.spencerc99.partykit.dev", dn = new mt();
6797
+ const oa = "playhtml.spencerc99.partykit.dev", dn = new wt();
6798
6798
  function ca(e) {
6799
6799
  const t = window.location.pathname.replace(/\.[^/.]+$/, "");
6800
6800
  return e ? t + window.location.search : t;
6801
6801
  }
6802
- let N, W = dn.getMap("playhtml-global"), O = /* @__PURE__ */ new Map(), gt = /* @__PURE__ */ new Map();
6802
+ let N, W = dn.getMap("playhtml-global"), O = /* @__PURE__ */ new Map(), ft = /* @__PURE__ */ new Map();
6803
6803
  const ys = /* @__PURE__ */ new Map();
6804
6804
  let la = 0, re = Pl;
6805
6805
  function Vr() {
@@ -6817,12 +6817,12 @@ function ha(e) {
6817
6817
  } catch {
6818
6818
  return;
6819
6819
  }
6820
- const { type: n, eventPayload: s } = t, r = gt.get(n);
6820
+ const { type: n, eventPayload: s } = t, r = ft.get(n);
6821
6821
  if (r)
6822
6822
  for (const i of r)
6823
6823
  i.onEvent(s);
6824
6824
  }
6825
- let ot = !1, fn = !0;
6825
+ let At = !1, fn = !0;
6826
6826
  async function ua({
6827
6827
  // TODO: if it is a localhost url, need to make some deterministic way to connect to the same room.
6828
6828
  host: e = oa,
@@ -6851,8 +6851,8 @@ async function ua({
6851
6851
  Kr(l, a);
6852
6852
  const c = document.createElement("link");
6853
6853
  return c.rel = "stylesheet", c.href = "https://unpkg.com/playhtml@latest/dist/style.css", document.head.appendChild(c), await new Promise((l) => {
6854
- console.log("awaiting...", ot), ot && l(!0), N.on("sync", (a) => {
6855
- a ? a && N.ws.addEventListener("message", ha) : console.error("Issue connecting to yjs..."), !ot && (ot = !0, console.log("[PLAYHTML]: Setting up elements... Time to have some fun 🛝"), jr(), l(!0));
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
6856
  });
6857
6857
  }), N;
6858
6858
  }
@@ -6959,7 +6959,7 @@ function Hr() {
6959
6959
  });
6960
6960
  }
6961
6961
  function jr() {
6962
- if (ot) {
6962
+ if (At) {
6963
6963
  for (const e of Vr()) {
6964
6964
  const t = Array.from(
6965
6965
  document.querySelectorAll(`[${e}]`)
@@ -6983,16 +6983,16 @@ const wa = {
6983
6983
  setupPlayElementForTag: $e,
6984
6984
  globalData: W,
6985
6985
  elementHandlers: O,
6986
- eventHandlers: gt,
6986
+ eventHandlers: ft,
6987
6987
  dispatchPlayEvent: _a,
6988
6988
  registerPlayEventListener: Kr,
6989
6989
  removePlayEventListener: ka
6990
6990
  };
6991
6991
  window.playhtml = wa;
6992
6992
  function ma(e) {
6993
- if (O.has(e) || !ot)
6993
+ if (O.has(e) || !At)
6994
6994
  return;
6995
- O.has(e) || O.set(e, /* @__PURE__ */ new Map()), e !== Re.CanPlay && re[e], W.get(e) || W.set(e, new ut());
6995
+ O.has(e) || O.set(e, /* @__PURE__ */ new Map()), e !== Re.CanPlay && re[e], W.get(e) || W.set(e, new ht());
6996
6996
  const t = W.get(e);
6997
6997
  t.observe((n) => {
6998
6998
  n.changes.keys.forEach((s, r) => {
@@ -7018,7 +7018,7 @@ function ya(e, t) {
7018
7018
  }
7019
7019
  async function $e(e, t) {
7020
7020
  var c;
7021
- if (!ya(e, t) || !ot)
7021
+ if (!ya(e, t) || !At)
7022
7022
  return;
7023
7023
  if (!e.id) {
7024
7024
  const l = e.getAttribute("selector-id");
@@ -7087,7 +7087,7 @@ function Sa(e) {
7087
7087
  }
7088
7088
  function _a(e) {
7089
7089
  const { type: t } = e;
7090
- if (!gt.has(t)) {
7090
+ if (!ft.has(t)) {
7091
7091
  console.error(`[playhtml] event "${t}" not registered.`);
7092
7092
  return;
7093
7093
  }
@@ -7095,17 +7095,17 @@ function _a(e) {
7095
7095
  }
7096
7096
  function Kr(e, t) {
7097
7097
  const n = String(la++);
7098
- return gt.set(e, [
7099
- ...gt.get(e) ?? [],
7098
+ return ft.set(e, [
7099
+ ...ft.get(e) ?? [],
7100
7100
  { type: e, ...t, id: n }
7101
7101
  ]), n;
7102
7102
  }
7103
7103
  function ka(e, t) {
7104
- const n = gt.get(e);
7104
+ const n = ft.get(e);
7105
7105
  if (!n)
7106
7106
  return;
7107
7107
  const s = n.findIndex((r) => r.id === t);
7108
- s !== -1 && (n.splice(s, 1), n.length === 0 && gt.delete(e));
7108
+ s !== -1 && (n.splice(s, 1), n.length === 0 && ft.delete(e));
7109
7109
  }
7110
7110
  export {
7111
7111
  wa as playhtml
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "playhtml",
3
3
  "title": "playhtml",
4
4
  "description": "Create interactive, collaborative html elements with a single attribute",
5
- "version": "2.1.4",
5
+ "version": "2.1.5",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "keywords": [