@jackuait/blok 0.10.1 → 0.10.3

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,5 +1,5 @@
1
1
  import { t as e } from "./chunk-D6kmoKXy.mjs";
2
- import { $n as t, $t as n, An as r, Bn as i, C as a, Cn as o, Dn as s, E as c, Fn as l, Gn as u, Hn as d, Ht as f, In as p, Jn as m, Jt as h, Kn as g, Ln as _, Mn as ee, Nn as te, On as v, Pn as ne, Pt as re, Qn as ie, Qt as ae, Rn as oe, S as se, Sn as ce, T as le, Tn as ue, Un as de, Ut as fe, Vn as pe, Wn as me, Xn as y, Xt as he, Yn as ge, Yt as _e, Zn as b, Zt as ve, _ as ye, _n as be, _t as xe, an as Se, b as x, bn as Ce, bt as we, cn as Te, en as Ee, er as S, fn as De, g as Oe, gn as ke, h as Ae, hn as je, in as Me, j as Ne, jn as Pe, jt as Fe, kn as Ie, m as Le, mn as Re, nn as ze, nr as C, on as w, p as Be, pn as Ve, pt as He, qn as Ue, qt as We, rn as Ge, rr as T, sn as E, tn as Ke, tr as qe, u as Je, un as Ye, v as Xe, vn as Ze, w as Qe, wn as $e, x as et, xn as tt, y as nt, yn as rt, zn as it, zt as at } from "./constants-VDhCUk4c.mjs";
2
+ import { $n as t, $t as n, An as r, Bn as i, C as a, Cn as o, Dn as s, E as c, Fn as l, Gn as u, Hn as d, Ht as f, In as p, Jn as m, Jt as h, Kn as g, Ln as _, Mn as ee, Nn as te, On as v, Pn as ne, Pt as re, Qn as ie, Qt as ae, Rn as oe, S as se, Sn as ce, T as le, Tn as ue, Un as de, Ut as fe, Vn as pe, Wn as me, Xn as y, Xt as he, Yn as ge, Yt as _e, Zn as b, Zt as ve, _ as ye, _n as be, _t as xe, an as Se, b as x, bn as Ce, bt as we, cn as Te, en as Ee, er as S, fn as De, g as Oe, gn as ke, h as Ae, hn as je, in as Me, j as Ne, jn as Pe, jt as Fe, kn as Ie, m as Le, mn as Re, nn as ze, nr as C, on as w, p as Be, pn as Ve, pt as He, qn as Ue, qt as We, rn as Ge, rr as T, sn as E, tn as Ke, tr as qe, u as Je, un as Ye, v as Xe, vn as Ze, w as Qe, wn as $e, x as et, xn as tt, y as nt, yn as rt, zn as it, zt as at } from "./constants-Bp622jic.mjs";
3
3
  import { n as ot, t as D } from "./objectSpread2-CWwMYL_U.mjs";
4
4
  import { n as O, t as st } from "./tw-CqxBf-1Y.mjs";
5
5
  import { r as ct, t as lt } from "./lightweight-i18n-DZmo8dAI.mjs";
@@ -1274,160 +1274,160 @@ var Dt = class {
1274
1274
  destroy() {
1275
1275
  this._observers = M();
1276
1276
  }
1277
- }, dn = Math.floor, fn = Math.abs, pn = (e, t) => e < t ? e : t, mn = (e, t) => e > t ? e : t;
1277
+ }, N = Math.floor, dn = Math.abs, fn = (e, t) => e < t ? e : t, pn = (e, t) => e > t ? e : t;
1278
1278
  Number.isNaN;
1279
- var hn = (e) => e === 0 ? 1 / e < 0 : e < 0, gn = 2 ** 53 - 1, _n = -(2 ** 53 - 1), vn = Number.isInteger || ((e) => typeof e == "number" && isFinite(e) && dn(e) === e);
1279
+ var mn = (e) => e === 0 ? 1 / e < 0 : e < 0, hn = 2 ** 53 - 1, gn = -(2 ** 53 - 1), _n = Number.isInteger || ((e) => typeof e == "number" && isFinite(e) && N(e) === e);
1280
1280
  Number.isNaN, Number.parseInt;
1281
1281
  //#endregion
1282
1282
  //#region node_modules/lib0/string.js
1283
- var yn = String.fromCharCode;
1284
- String.fromCodePoint, yn(65535);
1285
- var bn = (e) => e.toLowerCase(), xn = /^\s*/g, Sn = (e) => e.replace(xn, ""), Cn = /([A-Z])/g, wn = (e, t) => Sn(e.replace(Cn, (e) => `${t}${bn(e)}`)), Tn = (e) => {
1283
+ var vn = String.fromCharCode;
1284
+ String.fromCodePoint, vn(65535);
1285
+ var yn = (e) => e.toLowerCase(), bn = /^\s*/g, xn = (e) => e.replace(bn, ""), Sn = /([A-Z])/g, Cn = (e, t) => xn(e.replace(Sn, (e) => `${t}${yn(e)}`)), wn = (e) => {
1286
1286
  let t = unescape(encodeURIComponent(e)), n = t.length, r = new Uint8Array(n);
1287
1287
  for (let e = 0; e < n; e++) r[e] = t.codePointAt(e);
1288
1288
  return r;
1289
- }, En = typeof TextEncoder < "u" ? new TextEncoder() : null, Dn = En ? (e) => En.encode(e) : Tn, On = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", {
1289
+ }, Tn = typeof TextEncoder < "u" ? new TextEncoder() : null, En = Tn ? (e) => Tn.encode(e) : wn, Dn = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", {
1290
1290
  fatal: !0,
1291
1291
  ignoreBOM: !0
1292
1292
  });
1293
1293
  /* c8 ignore start */
1294
- On && On.decode(new Uint8Array()).length === 1 && (On = null);
1295
- var kn = (e, t) => cn(t, () => e).join(""), An = class {
1294
+ Dn && Dn.decode(new Uint8Array()).length === 1 && (Dn = null);
1295
+ var On = (e, t) => cn(t, () => e).join(""), kn = class {
1296
1296
  constructor() {
1297
1297
  this.cpos = 0, this.cbuf = new Uint8Array(100), this.bufs = [];
1298
1298
  }
1299
- }, jn = () => new An(), Mn = (e) => {
1299
+ }, An = () => new kn(), jn = (e) => {
1300
1300
  let t = e.cpos;
1301
1301
  for (let n = 0; n < e.bufs.length; n++) t += e.bufs[n].length;
1302
1302
  return t;
1303
- }, Nn = (e) => {
1304
- let t = new Uint8Array(Mn(e)), n = 0;
1303
+ }, P = (e) => {
1304
+ let t = new Uint8Array(jn(e)), n = 0;
1305
1305
  for (let r = 0; r < e.bufs.length; r++) {
1306
1306
  let i = e.bufs[r];
1307
1307
  t.set(i, n), n += i.length;
1308
1308
  }
1309
1309
  return t.set(new Uint8Array(e.cbuf.buffer, 0, e.cpos), n), t;
1310
- }, Pn = (e, t) => {
1310
+ }, Mn = (e, t) => {
1311
1311
  let n = e.cbuf.length;
1312
- n - e.cpos < t && (e.bufs.push(new Uint8Array(e.cbuf.buffer, 0, e.cpos)), e.cbuf = new Uint8Array(mn(n, t) * 2), e.cpos = 0);
1313
- }, N = (e, t) => {
1312
+ n - e.cpos < t && (e.bufs.push(new Uint8Array(e.cbuf.buffer, 0, e.cpos)), e.cbuf = new Uint8Array(pn(n, t) * 2), e.cpos = 0);
1313
+ }, F = (e, t) => {
1314
1314
  let n = e.cbuf.length;
1315
1315
  e.cpos === n && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(n * 2), e.cpos = 0), e.cbuf[e.cpos++] = t;
1316
- }, Fn = N, P = (e, t) => {
1317
- for (; t > 127;) N(e, 128 | 127 & t), t = dn(t / 128);
1318
- N(e, 127 & t);
1319
- }, In = (e, t) => {
1320
- let n = hn(t);
1321
- for (n && (t = -t), N(e, (t > 63 ? 128 : 0) | (n ? 64 : 0) | 63 & t), t = dn(t / 64); t > 0;) N(e, (t > 127 ? 128 : 0) | 127 & t), t = dn(t / 128);
1322
- }, Ln = new Uint8Array(3e4), Rn = Ln.length / 3, zn = En && En.encodeInto ? (e, t) => {
1323
- if (t.length < Rn) {
1316
+ }, Nn = F, I = (e, t) => {
1317
+ for (; t > 127;) F(e, 128 | 127 & t), t = N(t / 128);
1318
+ F(e, 127 & t);
1319
+ }, Pn = (e, t) => {
1320
+ let n = mn(t);
1321
+ for (n && (t = -t), F(e, (t > 63 ? 128 : 0) | (n ? 64 : 0) | 63 & t), t = N(t / 64); t > 0;) F(e, (t > 127 ? 128 : 0) | 127 & t), t = N(t / 128);
1322
+ }, Fn = new Uint8Array(3e4), In = Fn.length / 3, Ln = Tn && Tn.encodeInto ? (e, t) => {
1323
+ if (t.length < In) {
1324
1324
  /* c8 ignore next */
1325
- let n = En.encodeInto(t, Ln).written || 0;
1326
- P(e, n);
1327
- for (let t = 0; t < n; t++) N(e, Ln[t]);
1328
- } else F(e, Dn(t));
1325
+ let n = Tn.encodeInto(t, Fn).written || 0;
1326
+ I(e, n);
1327
+ for (let t = 0; t < n; t++) F(e, Fn[t]);
1328
+ } else L(e, En(t));
1329
1329
  } : (e, t) => {
1330
1330
  let n = unescape(encodeURIComponent(t)), r = n.length;
1331
- P(e, r);
1332
- for (let t = 0; t < r; t++) N(e, n.codePointAt(t));
1333
- }, Bn = (e, t) => {
1334
- let n = e.cbuf.length, r = e.cpos, i = pn(n - r, t.length), a = t.length - i;
1335
- e.cbuf.set(t.subarray(0, i), r), e.cpos += i, a > 0 && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(mn(n * 2, a)), e.cbuf.set(t.subarray(i)), e.cpos = a);
1336
- }, F = (e, t) => {
1337
- P(e, t.byteLength), Bn(e, t);
1338
- }, Vn = (e, t) => {
1339
- Pn(e, t);
1331
+ I(e, r);
1332
+ for (let t = 0; t < r; t++) F(e, n.codePointAt(t));
1333
+ }, Rn = (e, t) => {
1334
+ let n = e.cbuf.length, r = e.cpos, i = fn(n - r, t.length), a = t.length - i;
1335
+ e.cbuf.set(t.subarray(0, i), r), e.cpos += i, a > 0 && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(pn(n * 2, a)), e.cbuf.set(t.subarray(i)), e.cpos = a);
1336
+ }, L = (e, t) => {
1337
+ I(e, t.byteLength), Rn(e, t);
1338
+ }, zn = (e, t) => {
1339
+ Mn(e, t);
1340
1340
  let n = new DataView(e.cbuf.buffer, e.cpos, t);
1341
1341
  return e.cpos += t, n;
1342
- }, Hn = (e, t) => Vn(e, 4).setFloat32(0, t, !1), Un = (e, t) => Vn(e, 8).setFloat64(0, t, !1), Wn = (e, t) => Vn(e, 8).setBigInt64(0, t, !1), Gn = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4)), Kn = (e) => (Gn.setFloat32(0, e), Gn.getFloat32(0) === e), qn = (e, t) => {
1342
+ }, Bn = (e, t) => zn(e, 4).setFloat32(0, t, !1), Vn = (e, t) => zn(e, 8).setFloat64(0, t, !1), Hn = (e, t) => zn(e, 8).setBigInt64(0, t, !1), Un = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4)), Wn = (e) => (Un.setFloat32(0, e), Un.getFloat32(0) === e), Gn = (e, t) => {
1343
1343
  switch (typeof t) {
1344
1344
  case "string":
1345
- N(e, 119), zn(e, t);
1345
+ F(e, 119), Ln(e, t);
1346
1346
  break;
1347
1347
  case "number":
1348
- vn(t) && fn(t) <= 2147483647 ? (N(e, 125), In(e, t)) : Kn(t) ? (N(e, 124), Hn(e, t)) : (N(e, 123), Un(e, t));
1348
+ _n(t) && dn(t) <= 2147483647 ? (F(e, 125), Pn(e, t)) : Wn(t) ? (F(e, 124), Bn(e, t)) : (F(e, 123), Vn(e, t));
1349
1349
  break;
1350
1350
  case "bigint":
1351
- N(e, 122), Wn(e, t);
1351
+ F(e, 122), Hn(e, t);
1352
1352
  break;
1353
1353
  case "object":
1354
- if (t === null) N(e, 126);
1354
+ if (t === null) F(e, 126);
1355
1355
  else if (ln(t)) {
1356
- N(e, 117), P(e, t.length);
1357
- for (let n = 0; n < t.length; n++) qn(e, t[n]);
1358
- } else if (t instanceof Uint8Array) N(e, 116), F(e, t);
1356
+ F(e, 117), I(e, t.length);
1357
+ for (let n = 0; n < t.length; n++) Gn(e, t[n]);
1358
+ } else if (t instanceof Uint8Array) F(e, 116), L(e, t);
1359
1359
  else {
1360
- N(e, 118);
1360
+ F(e, 118);
1361
1361
  let n = Object.keys(t);
1362
- P(e, n.length);
1362
+ I(e, n.length);
1363
1363
  for (let r = 0; r < n.length; r++) {
1364
1364
  let i = n[r];
1365
- zn(e, i), qn(e, t[i]);
1365
+ Ln(e, i), Gn(e, t[i]);
1366
1366
  }
1367
1367
  }
1368
1368
  break;
1369
1369
  case "boolean":
1370
- N(e, t ? 120 : 121);
1370
+ F(e, t ? 120 : 121);
1371
1371
  break;
1372
- default: N(e, 127);
1372
+ default: F(e, 127);
1373
1373
  }
1374
- }, Jn = class extends An {
1374
+ }, Kn = class extends kn {
1375
1375
  constructor(e) {
1376
1376
  super(), this.w = e, this.s = null, this.count = 0;
1377
1377
  }
1378
1378
  write(e) {
1379
- this.s === e ? this.count++ : (this.count > 0 && P(this, this.count - 1), this.count = 1, this.w(this, e), this.s = e);
1379
+ this.s === e ? this.count++ : (this.count > 0 && I(this, this.count - 1), this.count = 1, this.w(this, e), this.s = e);
1380
1380
  }
1381
- }, Yn = (e) => {
1382
- e.count > 0 && (In(e.encoder, e.count === 1 ? e.s : -e.s), e.count > 1 && P(e.encoder, e.count - 2));
1383
- }, Xn = class {
1381
+ }, qn = (e) => {
1382
+ e.count > 0 && (Pn(e.encoder, e.count === 1 ? e.s : -e.s), e.count > 1 && I(e.encoder, e.count - 2));
1383
+ }, Jn = class {
1384
1384
  constructor() {
1385
- this.encoder = new An(), this.s = 0, this.count = 0;
1385
+ this.encoder = new kn(), this.s = 0, this.count = 0;
1386
1386
  }
1387
1387
  write(e) {
1388
- this.s === e ? this.count++ : (Yn(this), this.count = 1, this.s = e);
1388
+ this.s === e ? this.count++ : (qn(this), this.count = 1, this.s = e);
1389
1389
  }
1390
1390
  toUint8Array() {
1391
- return Yn(this), Nn(this.encoder);
1391
+ return qn(this), P(this.encoder);
1392
1392
  }
1393
- }, Zn = (e) => {
1393
+ }, Yn = (e) => {
1394
1394
  if (e.count > 0) {
1395
1395
  let t = e.diff * 2 + (e.count === 1 ? 0 : 1);
1396
- In(e.encoder, t), e.count > 1 && P(e.encoder, e.count - 2);
1396
+ Pn(e.encoder, t), e.count > 1 && I(e.encoder, e.count - 2);
1397
1397
  }
1398
- }, Qn = class {
1398
+ }, Xn = class {
1399
1399
  constructor() {
1400
- this.encoder = new An(), this.s = 0, this.count = 0, this.diff = 0;
1400
+ this.encoder = new kn(), this.s = 0, this.count = 0, this.diff = 0;
1401
1401
  }
1402
1402
  write(e) {
1403
- this.diff === e - this.s ? (this.s = e, this.count++) : (Zn(this), this.count = 1, this.diff = e - this.s, this.s = e);
1403
+ this.diff === e - this.s ? (this.s = e, this.count++) : (Yn(this), this.count = 1, this.diff = e - this.s, this.s = e);
1404
1404
  }
1405
1405
  toUint8Array() {
1406
- return Zn(this), Nn(this.encoder);
1406
+ return Yn(this), P(this.encoder);
1407
1407
  }
1408
- }, $n = class {
1408
+ }, Zn = class {
1409
1409
  constructor() {
1410
- this.sarr = [], this.s = "", this.lensE = new Xn();
1410
+ this.sarr = [], this.s = "", this.lensE = new Jn();
1411
1411
  }
1412
1412
  write(e) {
1413
1413
  this.s += e, this.s.length > 19 && (this.sarr.push(this.s), this.s = ""), this.lensE.write(e.length);
1414
1414
  }
1415
1415
  toUint8Array() {
1416
- let e = new An();
1417
- return this.sarr.push(this.s), this.s = "", zn(e, this.sarr.join("")), Bn(e, this.lensE.toUint8Array()), Nn(e);
1416
+ let e = new kn();
1417
+ return this.sarr.push(this.s), this.s = "", Ln(e, this.sarr.join("")), Rn(e, this.lensE.toUint8Array()), P(e);
1418
1418
  }
1419
- }, er = (e) => Error(e), I = () => {
1420
- throw er("Method unimplemented");
1421
- }, L = () => {
1422
- throw er("Unexpected case");
1419
+ }, Qn = (e) => Error(e), R = () => {
1420
+ throw Qn("Method unimplemented");
1421
+ }, z = () => {
1422
+ throw Qn("Unexpected case");
1423
1423
  };
1424
1424
  crypto.subtle;
1425
- var tr = crypto.getRandomValues.bind(crypto), nr = () => tr(new Uint32Array(1))[0], rr = "10000000-1000-4000-8000-100000000000", ir = () => rr.replace(/[018]/g, (e) => (e ^ nr() & 15 >> e / 4).toString(16)), ar = Date.now, or = (e) => new Promise(e);
1425
+ var $n = crypto.getRandomValues.bind(crypto), er = () => $n(new Uint32Array(1))[0], tr = "10000000-1000-4000-8000-100000000000", nr = () => tr.replace(/[018]/g, (e) => (e ^ er() & 15 >> e / 4).toString(16)), rr = Date.now, ir = (e) => new Promise(e);
1426
1426
  Promise.all.bind(Promise);
1427
1427
  //#endregion
1428
1428
  //#region node_modules/lib0/conditions.js
1429
1429
  /* c8 ignore next */
1430
- var sr = (e) => e === void 0 ? null : e, cr = new class {
1430
+ var ar = (e) => e === void 0 ? null : e, or = new class {
1431
1431
  constructor() {
1432
1432
  this.map = /* @__PURE__ */ new Map();
1433
1433
  }
@@ -1440,37 +1440,37 @@ var sr = (e) => e === void 0 ? null : e, cr = new class {
1440
1440
  }();
1441
1441
  /* c8 ignore start */
1442
1442
  try {
1443
- typeof localStorage < "u" && localStorage && (cr = localStorage);
1443
+ typeof localStorage < "u" && localStorage && (or = localStorage);
1444
1444
  } catch (e) {}
1445
1445
  /* c8 ignore stop */
1446
1446
  /* c8 ignore next */
1447
- var lr = cr, ur = Symbol("Equality"), dr = (e, t) => {
1447
+ var sr = or, cr = Symbol("Equality"), lr = (e, t) => {
1448
1448
  var n;
1449
- return e === t || !!(!(e == null || (n = e[ur]) == null) && n.call(e, t)) || !1;
1450
- }, fr = (e) => typeof e == "object", pr = Object.assign, mr = Object.keys, hr = (e, t) => {
1449
+ return e === t || !!(!(e == null || (n = e[cr]) == null) && n.call(e, t)) || !1;
1450
+ }, ur = (e) => typeof e == "object", dr = Object.assign, fr = Object.keys, pr = (e, t) => {
1451
1451
  for (let n in e) t(e[n], n);
1452
- }, gr = (e) => mr(e).length, _r = (e) => {
1452
+ }, mr = (e) => fr(e).length, hr = (e) => {
1453
1453
  for (let t in e) return !1;
1454
1454
  return !0;
1455
- }, vr = (e, t) => {
1455
+ }, gr = (e, t) => {
1456
1456
  for (let n in e) if (!t(e[n], n)) return !1;
1457
1457
  return !0;
1458
- }, yr = (e, t) => Object.prototype.hasOwnProperty.call(e, t), br = (e, t) => e === t || gr(e) === gr(t) && vr(e, (e, n) => (e !== void 0 || yr(t, n)) && dr(t[n], e)), xr = Object.freeze, Sr = (e) => {
1458
+ }, _r = (e, t) => Object.prototype.hasOwnProperty.call(e, t), vr = (e, t) => e === t || mr(e) === mr(t) && gr(e, (e, n) => (e !== void 0 || _r(t, n)) && lr(t[n], e)), yr = Object.freeze, br = (e) => {
1459
1459
  for (let t in e) {
1460
1460
  let n = e[t];
1461
- (typeof n == "object" || typeof n == "function") && Sr(e[t]);
1461
+ (typeof n == "object" || typeof n == "function") && br(e[t]);
1462
1462
  }
1463
- return xr(e);
1464
- }, Cr = (e, t, n = 0) => {
1463
+ return yr(e);
1464
+ }, xr = (e, t, n = 0) => {
1465
1465
  try {
1466
1466
  for (; n < e.length; n++) e[n](...t);
1467
1467
  } finally {
1468
- n < e.length && Cr(e, t, n + 1);
1468
+ n < e.length && xr(e, t, n + 1);
1469
1469
  }
1470
- }, wr = (e, t) => {
1470
+ }, Sr = (e, t) => {
1471
1471
  if (e === t) return !0;
1472
1472
  if (e == null || t == null || e.constructor !== t.constructor && (e.constructor || Object) !== (t.constructor || Object)) return !1;
1473
- if (e[ur] != null) return e[ur](t);
1473
+ if (e[cr] != null) return e[cr](t);
1474
1474
  switch (e.constructor) {
1475
1475
  case ArrayBuffer: e = new Uint8Array(e), t = new Uint8Array(t);
1476
1476
  case Uint8Array:
@@ -1483,51 +1483,51 @@ var lr = cr, ur = Symbol("Equality"), dr = (e, t) => {
1483
1483
  break;
1484
1484
  case Map:
1485
1485
  if (e.size !== t.size) return !1;
1486
- for (let n of e.keys()) if (!t.has(n) || !wr(e.get(n), t.get(n))) return !1;
1486
+ for (let n of e.keys()) if (!t.has(n) || !Sr(e.get(n), t.get(n))) return !1;
1487
1487
  break;
1488
1488
  case void 0:
1489
1489
  case Object:
1490
- if (gr(e) !== gr(t)) return !1;
1491
- for (let n in e) if (!yr(e, n) || !wr(e[n], t[n])) return !1;
1490
+ if (mr(e) !== mr(t)) return !1;
1491
+ for (let n in e) if (!_r(e, n) || !Sr(e[n], t[n])) return !1;
1492
1492
  break;
1493
1493
  case Array:
1494
1494
  if (e.length !== t.length) return !1;
1495
- for (let n = 0; n < e.length; n++) if (!wr(e[n], t[n])) return !1;
1495
+ for (let n = 0; n < e.length; n++) if (!Sr(e[n], t[n])) return !1;
1496
1496
  break;
1497
1497
  default: return !1;
1498
1498
  }
1499
1499
  return !0;
1500
- }, Tr = (e, t) => t.includes(e), Er = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]";
1500
+ }, Cr = (e, t) => t.includes(e), wr = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]";
1501
1501
  typeof navigator < "u" && /Mac/.test(navigator.platform);
1502
- var R, Dr = [], Or = () => {
1503
- if (R === void 0) if (Er) {
1504
- R = M();
1502
+ var B, Tr = [], Er = () => {
1503
+ if (B === void 0) if (wr) {
1504
+ B = M();
1505
1505
  let e = process.argv, t = null;
1506
1506
  for (let n = 0; n < e.length; n++) {
1507
1507
  let r = e[n];
1508
- r[0] === "-" ? (t !== null && R.set(t, ""), t = r) : t === null ? Dr.push(r) : (R.set(t, r), t = null);
1508
+ r[0] === "-" ? (t !== null && B.set(t, ""), t = r) : t === null ? Tr.push(r) : (B.set(t, r), t = null);
1509
1509
  }
1510
- t !== null && R.set(t, "");
1511
- } else typeof location == "object" ? (R = M(), (location.search || "?").slice(1).split("&").forEach((e) => {
1510
+ t !== null && B.set(t, "");
1511
+ } else typeof location == "object" ? (B = M(), (location.search || "?").slice(1).split("&").forEach((e) => {
1512
1512
  if (e.length !== 0) {
1513
1513
  let [t, n] = e.split("=");
1514
- R.set(`--${wn(t, "-")}`, n), R.set(`-${wn(t, "-")}`, n);
1514
+ B.set(`--${Cn(t, "-")}`, n), B.set(`-${Cn(t, "-")}`, n);
1515
1515
  }
1516
- })) : R = M();
1517
- return R;
1518
- }, kr = (e) => Or().has(e), Ar = (e) => sr(Er ? process.env[e.toUpperCase().replaceAll("-", "_")] : lr.getItem(e)), jr = (e) => kr("--" + e) || Ar(e) !== null, Mr = jr("production"), Nr = Er && Tr(process.env.FORCE_COLOR, [
1516
+ })) : B = M();
1517
+ return B;
1518
+ }, Dr = (e) => Er().has(e), Or = (e) => ar(wr ? process.env[e.toUpperCase().replaceAll("-", "_")] : sr.getItem(e)), kr = (e) => Dr("--" + e) || Or(e) !== null, Ar = kr("production"), jr = wr && Cr(process.env.FORCE_COLOR, [
1519
1519
  "true",
1520
1520
  "1",
1521
1521
  "2"
1522
- ]) || !kr("--no-colors") && !jr("no-color") && (!Er || process.stdout.isTTY) && (!Er || kr("--color") || Ar("COLORTERM") !== null || (Ar("TERM") || "").includes("color")), Pr = class {
1522
+ ]) || !Dr("--no-colors") && !kr("no-color") && (!wr || process.stdout.isTTY) && (!wr || Dr("--color") || Or("COLORTERM") !== null || (Or("TERM") || "").includes("color")), Mr = class {
1523
1523
  constructor(e, t) {
1524
1524
  this.left = e, this.right = t;
1525
1525
  }
1526
- }, z = (e, t) => new Pr(e, t), Fr = (e) => e.next() >= .5, Ir = (e, t, n) => dn(e.next() * (n + 1 - t) + t), Lr = (e, t, n) => dn(e.next() * (n + 1 - t) + t), Rr = (e, t, n) => Lr(e, t, n), zr = (e) => yn(Rr(e, 97, 122)), Br = (e, t = 0, n = 20) => {
1527
- let r = Rr(e, t, n), i = "";
1528
- for (let t = 0; t < r; t++) i += zr(e);
1526
+ }, Nr = (e, t) => new Mr(e, t), Pr = (e) => e.next() >= .5, Fr = (e, t, n) => N(e.next() * (n + 1 - t) + t), Ir = (e, t, n) => N(e.next() * (n + 1 - t) + t), Lr = (e, t, n) => Ir(e, t, n), Rr = (e) => vn(Lr(e, 97, 122)), zr = (e, t = 0, n = 20) => {
1527
+ let r = Lr(e, t, n), i = "";
1528
+ for (let t = 0; t < r; t++) i += Rr(e);
1529
1529
  return i;
1530
- }, Vr = (e, t) => t[Rr(e, 0, t.length - 1)], Hr, Ur = Symbol("0schema"), Wr = class {
1530
+ }, Br = (e, t) => t[Lr(e, 0, t.length - 1)], Vr, Hr = Symbol("0schema"), Ur = class {
1531
1531
  constructor() {
1532
1532
  this._rerrs = [];
1533
1533
  }
@@ -1544,24 +1544,24 @@ var R, Dr = [], Or = () => {
1544
1544
  for (let t = this._rerrs.length - 1; t > 0; t--) {
1545
1545
  let n = this._rerrs[t];
1546
1546
  /* c8 ignore next */
1547
- e.push(kn(" ", (this._rerrs.length - t) * 2) + `${n.path == null ? "" : `[${n.path}] `}${n.has} doesn't match ${n.expected}. ${n.message}`);
1547
+ e.push(On(" ", (this._rerrs.length - t) * 2) + `${n.path == null ? "" : `[${n.path}] `}${n.has} doesn't match ${n.expected}. ${n.message}`);
1548
1548
  }
1549
1549
  return e.join("\n");
1550
1550
  }
1551
- }, Gr = (e, t) => e === t ? !0 : e == null || t == null || e.constructor !== t.constructor ? !1 : e[ur] ? dr(e, t) : ln(e) ? on(e, (e) => sn(t, (t) => Gr(e, t))) : fr(e) ? vr(e, (e, n) => Gr(e, t[n])) : !1;
1552
- Hr = ur;
1553
- var B = class {
1551
+ }, Wr = (e, t) => e === t ? !0 : e == null || t == null || e.constructor !== t.constructor ? !1 : e[cr] ? lr(e, t) : ln(e) ? on(e, (e) => sn(t, (t) => Wr(e, t))) : ur(e) ? gr(e, (e, n) => Wr(e, t[n])) : !1;
1552
+ Vr = cr;
1553
+ var V = class {
1554
1554
  extends(e) {
1555
1555
  let [t, n] = [this.shape, e.shape];
1556
- return this.constructor._dilutes && ([n, t] = [t, n]), Gr(t, n);
1556
+ return this.constructor._dilutes && ([n, t] = [t, n]), Wr(t, n);
1557
1557
  }
1558
1558
  equals(e) {
1559
- return this.constructor === e.constructor && wr(this.shape, e.shape);
1559
+ return this.constructor === e.constructor && Sr(this.shape, e.shape);
1560
1560
  }
1561
- [Ur]() {
1561
+ [Hr]() {
1562
1562
  return !0;
1563
1563
  }
1564
- [Hr](e) {
1564
+ [Vr](e) {
1565
1565
  return this.equals(e);
1566
1566
  }
1567
1567
  validate(e) {
@@ -1569,24 +1569,24 @@ var B = class {
1569
1569
  }
1570
1570
  /* c8 ignore start */
1571
1571
  check(e, t) {
1572
- I();
1572
+ R();
1573
1573
  }
1574
1574
  /* c8 ignore stop */
1575
1575
  get nullable() {
1576
- return Si(this, Li);
1576
+ return xi(this, Ii);
1577
1577
  }
1578
1578
  get optional() {
1579
- return new ei(this);
1579
+ return new $r(this);
1580
1580
  }
1581
1581
  cast(e) {
1582
- return Vi(e, this), e;
1582
+ return Bi(e, this), e;
1583
1583
  }
1584
1584
  expect(e) {
1585
- return Vi(e, this), e;
1585
+ return Bi(e, this), e;
1586
1586
  }
1587
1587
  };
1588
- ot(B, "_dilutes", !1);
1589
- var Kr = class extends B {
1588
+ ot(V, "_dilutes", !1);
1589
+ var Gr = class extends V {
1590
1590
  constructor(e, t) {
1591
1591
  super(), this.shape = e, this._c = t;
1592
1592
  }
@@ -1594,9 +1594,9 @@ var Kr = class extends B {
1594
1594
  let n = (e == null ? void 0 : e.constructor) === this.shape && (this._c == null || this._c(e));
1595
1595
  return !n && (t == null || t.extend(null, this.shape.name, e == null ? void 0 : e.constructor.name, (e == null ? void 0 : e.constructor) === this.shape ? "Check failed" : "Constructor match failed")), n;
1596
1596
  }
1597
- }, V = (e, t = null) => new Kr(e, t);
1598
- V(Kr);
1599
- var qr = class extends B {
1597
+ }, H = (e, t = null) => new Gr(e, t);
1598
+ H(Gr);
1599
+ var Kr = class extends V {
1600
1600
  constructor(e) {
1601
1601
  super(), this.shape = e;
1602
1602
  }
@@ -1604,9 +1604,9 @@ var qr = class extends B {
1604
1604
  let n = this.shape(e);
1605
1605
  return !n && (t == null || t.extend(null, "custom prop", e == null ? void 0 : e.constructor.name, "failed to check custom prop")), n;
1606
1606
  }
1607
- }, H = (e) => new qr(e);
1608
- V(qr);
1609
- var Jr = class extends B {
1607
+ }, U = (e) => new Kr(e);
1608
+ H(Kr);
1609
+ var qr = class extends V {
1610
1610
  constructor(e) {
1611
1611
  super(), this.shape = e;
1612
1612
  }
@@ -1614,25 +1614,25 @@ var Jr = class extends B {
1614
1614
  let n = this.shape.some((t) => t === e);
1615
1615
  return !n && (t == null || t.extend(null, this.shape.join(" | "), e.toString())), n;
1616
1616
  }
1617
- }, Yr = (...e) => new Jr(e), Xr = V(Jr), Zr = RegExp.escape || ((e) => e.replace(/[().|&,$^[\]]/g, (e) => "\\" + e)), Qr = (e) => {
1618
- if (Mi.check(e)) return [Zr(e)];
1619
- if (Xr.check(e)) return e.shape.map((e) => e + "");
1620
- if (ji.check(e)) return ["[+-]?\\d+.?\\d*"];
1621
- if (Ni.check(e)) return [".*"];
1622
- if (Ci.check(e)) return e.shape.map(Qr).flat(1);
1617
+ }, Jr = (...e) => new qr(e), Yr = H(qr), Xr = RegExp.escape || ((e) => e.replace(/[().|&,$^[\]]/g, (e) => "\\" + e)), Zr = (e) => {
1618
+ if (ji.check(e)) return [Xr(e)];
1619
+ if (Yr.check(e)) return e.shape.map((e) => e + "");
1620
+ if (Ai.check(e)) return ["[+-]?\\d+.?\\d*"];
1621
+ if (Mi.check(e)) return [".*"];
1622
+ if (Si.check(e)) return e.shape.map(Zr).flat(1);
1623
1623
  /* c8 ignore next 2 */
1624
- L();
1624
+ z();
1625
1625
  };
1626
- V(class extends B {
1626
+ H(class extends V {
1627
1627
  constructor(e) {
1628
- super(), this.shape = e, this._r = RegExp("^" + e.map(Qr).map((e) => `(${e.join("|")})`).join("") + "$");
1628
+ super(), this.shape = e, this._r = RegExp("^" + e.map(Zr).map((e) => `(${e.join("|")})`).join("") + "$");
1629
1629
  }
1630
1630
  check(e, t) {
1631
1631
  let n = this._r.exec(e) != null;
1632
1632
  return !n && (t == null || t.extend(null, this._r.toString(), e.toString(), "String doesn't match string template.")), n;
1633
1633
  }
1634
1634
  });
1635
- var $r = Symbol("optional"), ei = class extends B {
1635
+ var Qr = Symbol("optional"), $r = class extends V {
1636
1636
  constructor(e) {
1637
1637
  super(), this.shape = e;
1638
1638
  }
@@ -1640,16 +1640,16 @@ var $r = Symbol("optional"), ei = class extends B {
1640
1640
  let n = e === void 0 || this.shape.check(e);
1641
1641
  return !n && (t == null || t.extend(null, "undefined (optional)", "()")), n;
1642
1642
  }
1643
- get [$r]() {
1643
+ get [Qr]() {
1644
1644
  return !0;
1645
1645
  }
1646
- }, ti = V(ei), ni = class extends B {
1646
+ }, ei = H($r), ti = class extends V {
1647
1647
  check(e, t) {
1648
1648
  return t == null || t.extend(null, "never", typeof e), !1;
1649
1649
  }
1650
1650
  };
1651
- new ni(), V(ni);
1652
- var ri = class e extends B {
1651
+ new ti(), H(ti);
1652
+ var ni = class e extends V {
1653
1653
  constructor(e, t = !1) {
1654
1654
  super(), this.shape = e, this._isPartial = t;
1655
1655
  }
@@ -1657,14 +1657,14 @@ var ri = class e extends B {
1657
1657
  return new e(this.shape, !0);
1658
1658
  }
1659
1659
  check(e, t) {
1660
- return e == null ? (t == null || t.extend(null, "object", "null"), !1) : vr(this.shape, (n, r) => {
1661
- let i = this._isPartial && !yr(e, r) || n.check(e[r], t);
1660
+ return e == null ? (t == null || t.extend(null, "object", "null"), !1) : gr(this.shape, (n, r) => {
1661
+ let i = this._isPartial && !_r(e, r) || n.check(e[r], t);
1662
1662
  return !i && (t == null || t.extend(r.toString(), n.toString(), typeof e[r], "Object property does not match")), i;
1663
1663
  });
1664
1664
  }
1665
1665
  };
1666
- ot(ri, "_dilutes", !0);
1667
- var ii = (e) => new ri(e), ai = V(ri), oi = H((e) => e != null && (e.constructor === Object || e.constructor == null)), si = class extends B {
1666
+ ot(ni, "_dilutes", !0);
1667
+ var ri = (e) => new ni(e), ii = H(ni), ai = U((e) => e != null && (e.constructor === Object || e.constructor == null)), oi = class extends V {
1668
1668
  constructor(e, t) {
1669
1669
  super(), this.shape = {
1670
1670
  keys: e,
@@ -1672,32 +1672,32 @@ var ii = (e) => new ri(e), ai = V(ri), oi = H((e) => e != null && (e.constructor
1672
1672
  };
1673
1673
  }
1674
1674
  check(e, t) {
1675
- return e != null && vr(e, (n, r) => {
1675
+ return e != null && gr(e, (n, r) => {
1676
1676
  let i = this.shape.keys.check(r, t);
1677
1677
  return !i && (t == null || t.extend(r + "", "Record", typeof e, i ? "Key doesn't match schema" : "Value doesn't match value")), i && this.shape.values.check(n, t);
1678
1678
  });
1679
1679
  }
1680
- }, ci = (e, t) => new si(e, t), li = V(si), ui = class extends B {
1680
+ }, si = (e, t) => new oi(e, t), ci = H(oi), li = class extends V {
1681
1681
  constructor(e) {
1682
1682
  super(), this.shape = e;
1683
1683
  }
1684
1684
  check(e, t) {
1685
- return e != null && vr(this.shape, (n, r) => {
1685
+ return e != null && gr(this.shape, (n, r) => {
1686
1686
  let i = n.check(e[r], t);
1687
1687
  return !i && (t == null || t.extend(r.toString(), "Tuple", typeof n)), i;
1688
1688
  });
1689
1689
  }
1690
- }, di = (...e) => new ui(e);
1691
- V(ui);
1692
- var fi = class extends B {
1690
+ }, ui = (...e) => new li(e);
1691
+ H(li);
1692
+ var di = class extends V {
1693
1693
  constructor(e) {
1694
- super(), this.shape = e.length === 1 ? e[0] : new xi(e);
1694
+ super(), this.shape = e.length === 1 ? e[0] : new bi(e);
1695
1695
  }
1696
1696
  check(e, t) {
1697
1697
  let n = ln(e) && on(e, (e) => this.shape.check(e));
1698
1698
  return !n && (t == null || t.extend(null, "Array", "")), n;
1699
1699
  }
1700
- }, pi = (...e) => new fi(e), mi = V(fi), hi = H((e) => ln(e)), gi = class extends B {
1700
+ }, fi = (...e) => new di(e), pi = H(di), mi = U((e) => ln(e)), hi = class extends V {
1701
1701
  constructor(e, t) {
1702
1702
  super(), this.shape = e, this._c = t;
1703
1703
  }
@@ -1705,18 +1705,18 @@ var fi = class extends B {
1705
1705
  let n = e instanceof this.shape && (this._c == null || this._c(e));
1706
1706
  return !n && (t == null || t.extend(null, this.shape.name, e == null ? void 0 : e.constructor.name)), n;
1707
1707
  }
1708
- }, _i = (e, t = null) => new gi(e, t);
1709
- V(gi);
1710
- var vi = _i(B), yi = V(class extends B {
1708
+ }, gi = (e, t = null) => new hi(e, t);
1709
+ H(hi);
1710
+ var _i = gi(V), vi = H(class extends V {
1711
1711
  constructor(e) {
1712
- super(), this.len = e.length - 1, this.args = di(...e.slice(-1)), this.res = e[this.len];
1712
+ super(), this.len = e.length - 1, this.args = ui(...e.slice(-1)), this.res = e[this.len];
1713
1713
  }
1714
1714
  check(e, t) {
1715
1715
  let n = e.constructor === Function && e.length <= this.len;
1716
1716
  return !n && (t == null || t.extend(null, "function", typeof e)), n;
1717
1717
  }
1718
- }), bi = H((e) => typeof e == "function");
1719
- V(class extends B {
1718
+ }), yi = U((e) => typeof e == "function");
1719
+ H(class extends V {
1720
1720
  constructor(e) {
1721
1721
  super(), this.shape = e;
1722
1722
  }
@@ -1725,7 +1725,7 @@ V(class extends B {
1725
1725
  return !n && (t == null || t.extend(null, "Intersectinon", typeof e)), n;
1726
1726
  }
1727
1727
  }, (e) => e.shape.length > 0);
1728
- var xi = class extends B {
1728
+ var bi = class extends V {
1729
1729
  constructor(e) {
1730
1730
  super(), this.shape = e;
1731
1731
  }
@@ -1734,44 +1734,44 @@ var xi = class extends B {
1734
1734
  return t == null || t.extend(null, "Union", typeof e), n;
1735
1735
  }
1736
1736
  };
1737
- ot(xi, "_dilutes", !0);
1738
- var Si = (...e) => e.findIndex((e) => Ci.check(e)) >= 0 ? Si(...e.map((e) => Bi(e)).map((e) => Ci.check(e) ? e.shape : [e]).flat(1)) : e.length === 1 ? e[0] : new xi(e), Ci = V(xi), wi = () => !0, Ti = H(wi), Ei = V(qr, (e) => e.shape === wi), Di = H((e) => typeof e == "bigint"), Oi = H((e) => e === Di), ki = H((e) => typeof e == "symbol");
1739
- H((e) => e === ki);
1740
- var Ai = H((e) => typeof e == "number"), ji = H((e) => e === Ai), Mi = H((e) => typeof e == "string"), Ni = H((e) => e === Mi), Pi = H((e) => typeof e == "boolean"), Fi = H((e) => e === Pi), Ii = Yr(void 0);
1741
- V(Jr, (e) => e.shape.length === 1 && e.shape[0] === void 0), Yr(void 0);
1742
- var Li = Yr(null), Ri = V(Jr, (e) => e.shape.length === 1 && e.shape[0] === null);
1743
- V(Uint8Array), V(Kr, (e) => e.shape === Uint8Array);
1744
- var zi = Si(Ai, Mi, Li, Ii, Di, Pi, ki);
1737
+ ot(bi, "_dilutes", !0);
1738
+ var xi = (...e) => e.findIndex((e) => Si.check(e)) >= 0 ? xi(...e.map((e) => zi(e)).map((e) => Si.check(e) ? e.shape : [e]).flat(1)) : e.length === 1 ? e[0] : new bi(e), Si = H(bi), Ci = () => !0, wi = U(Ci), Ti = H(Kr, (e) => e.shape === Ci), Ei = U((e) => typeof e == "bigint"), Di = U((e) => e === Ei), Oi = U((e) => typeof e == "symbol");
1739
+ U((e) => e === Oi);
1740
+ var ki = U((e) => typeof e == "number"), Ai = U((e) => e === ki), ji = U((e) => typeof e == "string"), Mi = U((e) => e === ji), Ni = U((e) => typeof e == "boolean"), Pi = U((e) => e === Ni), Fi = Jr(void 0);
1741
+ H(qr, (e) => e.shape.length === 1 && e.shape[0] === void 0), Jr(void 0);
1742
+ var Ii = Jr(null), Li = H(qr, (e) => e.shape.length === 1 && e.shape[0] === null);
1743
+ H(Uint8Array), H(Gr, (e) => e.shape === Uint8Array);
1744
+ var Ri = xi(ki, ji, Ii, Fi, Ei, Ni, Oi);
1745
1745
  (() => {
1746
- let e = pi(Ti), t = ci(Mi, Ti), n = Si(Ai, Mi, Li, Pi, e, t);
1746
+ let e = fi(wi), t = si(ji, wi), n = xi(ki, ji, Ii, Ni, e, t);
1747
1747
  return e.shape = n, t.shape.values = n, n;
1748
1748
  })();
1749
- var Bi = (e) => {
1750
- if (vi.check(e)) return e;
1751
- if (oi.check(e)) {
1749
+ var zi = (e) => {
1750
+ if (_i.check(e)) return e;
1751
+ if (ai.check(e)) {
1752
1752
  let t = {};
1753
- for (let n in e) t[n] = Bi(e[n]);
1754
- return ii(t);
1755
- } else if (hi.check(e)) return Si(...e.map(Bi));
1756
- else if (zi.check(e)) return Yr(e);
1757
- else if (bi.check(e)) return V(e);
1753
+ for (let n in e) t[n] = zi(e[n]);
1754
+ return ri(t);
1755
+ } else if (mi.check(e)) return xi(...e.map(zi));
1756
+ else if (Ri.check(e)) return Jr(e);
1757
+ else if (yi.check(e)) return H(e);
1758
1758
  /* c8 ignore next */
1759
- L();
1760
- }, Vi = Mr ? () => {} : (e, t) => {
1761
- let n = new Wr();
1762
- if (!t.check(e, n)) throw er(`Expected value to be of type ${t.constructor.name}.\n${n.toString()}`);
1763
- }, Hi = class {
1759
+ z();
1760
+ }, Bi = Ar ? () => {} : (e, t) => {
1761
+ let n = new Ur();
1762
+ if (!t.check(e, n)) throw Qn(`Expected value to be of type ${t.constructor.name}.\n${n.toString()}`);
1763
+ }, Vi = class {
1764
1764
  constructor(e) {
1765
1765
  this.patterns = [], this.$state = e;
1766
1766
  }
1767
1767
  if(e, t) {
1768
1768
  return this.patterns.push({
1769
- if: Bi(e),
1769
+ if: zi(e),
1770
1770
  h: t
1771
1771
  }), this;
1772
1772
  }
1773
1773
  else(e) {
1774
- return this.if(Ti, e);
1774
+ return this.if(wi, e);
1775
1775
  }
1776
1776
  done() {
1777
1777
  return (e, t) => {
@@ -1779,55 +1779,55 @@ var Bi = (e) => {
1779
1779
  let r = this.patterns[n];
1780
1780
  if (r.if.check(e)) return r.h(e, t);
1781
1781
  }
1782
- throw er("Unhandled pattern");
1782
+ throw Qn("Unhandled pattern");
1783
1783
  };
1784
1784
  }
1785
- }, Ui = ((e) => new Hi(e))(Ti).if(ji, (e, t) => Ir(t, _n, gn)).if(Ni, (e, t) => Br(t)).if(Fi, (e, t) => Fr(t)).if(Oi, (e, t) => BigInt(Ir(t, _n, gn))).if(Ci, (e, t) => Wi(t, Vr(t, e.shape))).if(ai, (e, t) => {
1785
+ }, Hi = ((e) => new Vi(e))(wi).if(Ai, (e, t) => Fr(t, gn, hn)).if(Mi, (e, t) => zr(t)).if(Pi, (e, t) => Pr(t)).if(Di, (e, t) => BigInt(Fr(t, gn, hn))).if(Si, (e, t) => Ui(t, Br(t, e.shape))).if(ii, (e, t) => {
1786
1786
  let n = {};
1787
1787
  for (let r in e.shape) {
1788
1788
  let i = e.shape[r];
1789
- if (ti.check(i)) {
1790
- if (Fr(t)) continue;
1789
+ if (ei.check(i)) {
1790
+ if (Pr(t)) continue;
1791
1791
  i = i.shape;
1792
1792
  }
1793
- n[r] = Ui(i, t);
1793
+ n[r] = Hi(i, t);
1794
1794
  }
1795
1795
  return n;
1796
- }).if(mi, (e, t) => {
1797
- let n = [], r = Lr(t, 0, 42);
1798
- for (let i = 0; i < r; i++) n.push(Wi(t, e.shape));
1796
+ }).if(pi, (e, t) => {
1797
+ let n = [], r = Ir(t, 0, 42);
1798
+ for (let i = 0; i < r; i++) n.push(Ui(t, e.shape));
1799
1799
  return n;
1800
- }).if(Xr, (e, t) => Vr(t, e.shape)).if(Ri, (e, t) => null).if(yi, (e, t) => {
1801
- let n = Wi(t, e.res);
1800
+ }).if(Yr, (e, t) => Br(t, e.shape)).if(Li, (e, t) => null).if(vi, (e, t) => {
1801
+ let n = Ui(t, e.res);
1802
1802
  return () => n;
1803
- }).if(Ei, (e, t) => Wi(t, Vr(t, [
1804
- Ai,
1805
- Mi,
1806
- Li,
1803
+ }).if(Ti, (e, t) => Ui(t, Br(t, [
1804
+ ki,
1805
+ ji,
1807
1806
  Ii,
1808
- Di,
1809
- Pi,
1810
- pi(Ai),
1811
- ci(Si("a", "b", "c"), Ai)
1812
- ]))).if(li, (e, t) => {
1813
- let n = {}, r = Ir(t, 0, 3);
1807
+ Fi,
1808
+ Ei,
1809
+ Ni,
1810
+ fi(ki),
1811
+ si(xi("a", "b", "c"), ki)
1812
+ ]))).if(ci, (e, t) => {
1813
+ let n = {}, r = Fr(t, 0, 3);
1814
1814
  for (let i = 0; i < r; i++) {
1815
- let r = Wi(t, e.shape.keys);
1816
- n[r] = Wi(t, e.shape.values);
1815
+ let r = Ui(t, e.shape.keys);
1816
+ n[r] = Ui(t, e.shape.values);
1817
1817
  }
1818
1818
  return n;
1819
- }).done(), Wi = (e, t) => Ui(Bi(t), e), Gi = typeof document < "u" ? document : {};
1820
- H((e) => e.nodeType === Xi), typeof DOMParser < "u" && new DOMParser(), H((e) => e.nodeType === qi), H((e) => e.nodeType === Ji);
1821
- var Ki = (e) => $t(e, (e, t) => `${t}:${e};`).join(""), qi = Gi.ELEMENT_NODE, Ji = Gi.TEXT_NODE;
1822
- Gi.CDATA_SECTION_NODE, Gi.COMMENT_NODE;
1823
- var Yi = Gi.DOCUMENT_NODE;
1824
- Gi.DOCUMENT_TYPE_NODE;
1825
- var Xi = Gi.DOCUMENT_FRAGMENT_NODE;
1826
- H((e) => e.nodeType === Yi);
1819
+ }).done(), Ui = (e, t) => Hi(zi(t), e), Wi = typeof document < "u" ? document : {};
1820
+ U((e) => e.nodeType === Yi), typeof DOMParser < "u" && new DOMParser(), U((e) => e.nodeType === Ki), U((e) => e.nodeType === qi);
1821
+ var Gi = (e) => $t(e, (e, t) => `${t}:${e};`).join(""), Ki = Wi.ELEMENT_NODE, qi = Wi.TEXT_NODE;
1822
+ Wi.CDATA_SECTION_NODE, Wi.COMMENT_NODE;
1823
+ var Ji = Wi.DOCUMENT_NODE;
1824
+ Wi.DOCUMENT_TYPE_NODE;
1825
+ var Yi = Wi.DOCUMENT_FRAGMENT_NODE;
1826
+ U((e) => e.nodeType === Ji);
1827
1827
  /* c8 ignore stop */
1828
1828
  //#endregion
1829
1829
  //#region node_modules/lib0/symbol.js
1830
- var Zi = Symbol, Qi = Zi(), $i = Zi(), ea = Zi(), ta = Zi(), na = Zi(), ra = Zi(), ia = Zi(), aa = Zi(), oa = Zi(), sa = (e) => {
1830
+ var Xi = Symbol, Zi = Xi(), Qi = Xi(), $i = Xi(), ea = Xi(), ta = Xi(), na = Xi(), ra = Xi(), ia = Xi(), aa = Xi(), oa = (e) => {
1831
1831
  var t;
1832
1832
  e.length === 1 && ((t = e[0]) == null ? void 0 : t.constructor) === Function && (e = e[0]());
1833
1833
  let n = [], r = [], i = 0;
@@ -1843,31 +1843,31 @@ var Zi = Symbol, Qi = Zi(), $i = Zi(), ea = Zi(), ta = Zi(), na = Zi(), ra = Zi(
1843
1843
  }
1844
1844
  return r;
1845
1845
  };
1846
- ar();
1846
+ rr();
1847
1847
  /* c8 ignore stop */
1848
1848
  //#endregion
1849
1849
  //#region node_modules/lib0/logging.js
1850
- var ca = {
1851
- [Qi]: z("font-weight", "bold"),
1852
- [$i]: z("font-weight", "normal"),
1853
- [ea]: z("color", "blue"),
1854
- [na]: z("color", "green"),
1855
- [ta]: z("color", "grey"),
1856
- [ra]: z("color", "red"),
1857
- [ia]: z("color", "purple"),
1858
- [aa]: z("color", "orange"),
1859
- [oa]: z("color", "black")
1860
- }, la = Nr ? (e) => {
1850
+ var sa = {
1851
+ [Zi]: Nr("font-weight", "bold"),
1852
+ [Qi]: Nr("font-weight", "normal"),
1853
+ [$i]: Nr("color", "blue"),
1854
+ [ta]: Nr("color", "green"),
1855
+ [ea]: Nr("color", "grey"),
1856
+ [na]: Nr("color", "red"),
1857
+ [ra]: Nr("color", "purple"),
1858
+ [ia]: Nr("color", "orange"),
1859
+ [aa]: Nr("color", "black")
1860
+ }, ca = jr ? (e) => {
1861
1861
  var t;
1862
1862
  e.length === 1 && ((t = e[0]) == null ? void 0 : t.constructor) === Function && (e = e[0]());
1863
1863
  let n = [], r = [], i = M(), a = [], o = 0;
1864
1864
  for (; o < e.length; o++) {
1865
- let t = e[o], a = ca[t];
1865
+ let t = e[o], a = sa[t];
1866
1866
  if (a !== void 0) i.set(a.left, a.right);
1867
1867
  else {
1868
1868
  if (t === void 0) break;
1869
1869
  if (t.constructor === String || t.constructor === Number) {
1870
- let e = Ki(i);
1870
+ let e = Gi(i);
1871
1871
  o > 0 || e.length > 0 ? (n.push("%c" + t), r.push(e)) : n.push(t);
1872
1872
  } else break;
1873
1873
  }
@@ -1877,67 +1877,67 @@ var ca = {
1877
1877
  t instanceof Symbol || a.push(t);
1878
1878
  }
1879
1879
  return a;
1880
- } : sa, ua = (...e) => {
1880
+ } : oa, la = (...e) => {
1881
1881
  /* c8 ignore next */
1882
- console.log(...la(e)), fa.forEach((t) => t.print(e));
1883
- }, da = (...e) => {
1884
- console.warn(...la(e)), e.unshift(aa), fa.forEach((t) => t.print(e));
1885
- }, fa = tn(), pa = (e) => ({
1882
+ console.log(...ca(e)), da.forEach((t) => t.print(e));
1883
+ }, ua = (...e) => {
1884
+ console.warn(...ca(e)), e.unshift(ia), da.forEach((t) => t.print(e));
1885
+ }, da = tn(), fa = (e) => ({
1886
1886
  [Symbol.iterator]() {
1887
1887
  return this;
1888
1888
  },
1889
1889
  next: e
1890
- }), ma = (e, t) => pa(() => {
1890
+ }), pa = (e, t) => fa(() => {
1891
1891
  let n;
1892
1892
  do
1893
1893
  n = e.next();
1894
1894
  while (!n.done && !t(n.value));
1895
1895
  return n;
1896
- }), ha = (e, t) => pa(() => {
1896
+ }), ma = (e, t) => fa(() => {
1897
1897
  let { done: n, value: r } = e.next();
1898
1898
  return {
1899
1899
  done: n,
1900
1900
  value: n ? void 0 : t(r)
1901
1901
  };
1902
- }), ga = class {
1902
+ }), ha = class {
1903
1903
  constructor(e, t) {
1904
1904
  this.clock = e, this.len = t;
1905
1905
  }
1906
- }, _a = class {
1906
+ }, ga = class {
1907
1907
  constructor() {
1908
1908
  this.clients = /* @__PURE__ */ new Map();
1909
1909
  }
1910
- }, va = (e, t, n) => t.clients.forEach((t, r) => {
1910
+ }, _a = (e, t, n) => t.clients.forEach((t, r) => {
1911
1911
  let i = e.doc.store.clients.get(r);
1912
1912
  if (i != null) {
1913
1913
  let r = i[i.length - 1], a = r.id.clock + r.length;
1914
1914
  for (let r = 0, o = t[r]; r < t.length && o.clock < a; o = t[++r]) eo(e, i, o.clock, o.len, n);
1915
1915
  }
1916
- }), ya = (e, t) => {
1916
+ }), va = (e, t) => {
1917
1917
  let n = 0, r = e.length - 1;
1918
1918
  for (; n <= r;) {
1919
- let i = dn((n + r) / 2), a = e[i], o = a.clock;
1919
+ let i = N((n + r) / 2), a = e[i], o = a.clock;
1920
1920
  if (o <= t) {
1921
1921
  if (t < o + a.len) return i;
1922
1922
  n = i + 1;
1923
1923
  } else r = i - 1;
1924
1924
  }
1925
1925
  return null;
1926
- }, ba = (e, t) => {
1926
+ }, ya = (e, t) => {
1927
1927
  let n = e.clients.get(t.client);
1928
- return n !== void 0 && ya(n, t.clock) !== null;
1929
- }, xa = (e) => {
1928
+ return n !== void 0 && va(n, t.clock) !== null;
1929
+ }, ba = (e) => {
1930
1930
  e.clients.forEach((e) => {
1931
1931
  e.sort((e, t) => e.clock - t.clock);
1932
1932
  let t, n;
1933
1933
  for (t = 1, n = 1; t < e.length; t++) {
1934
1934
  let r = e[n - 1], i = e[t];
1935
- r.clock + r.len >= i.clock ? e[n - 1] = new ga(r.clock, mn(r.len, i.clock + i.len - r.clock)) : (n < t && (e[n] = i), n++);
1935
+ r.clock + r.len >= i.clock ? e[n - 1] = new ha(r.clock, pn(r.len, i.clock + i.len - r.clock)) : (n < t && (e[n] = i), n++);
1936
1936
  }
1937
1937
  e.length = n;
1938
1938
  });
1939
- }, Sa = (e) => {
1940
- let t = new _a();
1939
+ }, xa = (e) => {
1940
+ let t = new ga();
1941
1941
  for (let n = 0; n < e.length; n++) e[n].clients.forEach((r, i) => {
1942
1942
  if (!t.clients.has(i)) {
1943
1943
  let a = r.slice();
@@ -1945,27 +1945,27 @@ var ca = {
1945
1945
  t.clients.set(i, a);
1946
1946
  }
1947
1947
  });
1948
- return xa(t), t;
1949
- }, Ca = (e, t, n, r) => {
1950
- Qt(e.clients, t, () => []).push(new ga(n, r));
1951
- }, wa = () => new _a(), Ta = (e, t) => {
1952
- P(e.restEncoder, t.clients.size), an(t.clients.entries()).sort((e, t) => t[0] - e[0]).forEach(([t, n]) => {
1953
- e.resetDsCurVal(), P(e.restEncoder, t);
1948
+ return ba(t), t;
1949
+ }, Sa = (e, t, n, r) => {
1950
+ Qt(e.clients, t, () => []).push(new ha(n, r));
1951
+ }, Ca = () => new ga(), wa = (e, t) => {
1952
+ I(e.restEncoder, t.clients.size), an(t.clients.entries()).sort((e, t) => t[0] - e[0]).forEach(([t, n]) => {
1953
+ e.resetDsCurVal(), I(e.restEncoder, t);
1954
1954
  let r = n.length;
1955
- P(e.restEncoder, r);
1955
+ I(e.restEncoder, r);
1956
1956
  for (let t = 0; t < r; t++) {
1957
1957
  let r = n[t];
1958
1958
  e.writeDsClock(r.clock), e.writeDsLen(r.len);
1959
1959
  }
1960
1960
  });
1961
- }, Ea = nr, Da = class e extends un {
1962
- constructor({ guid: e = ir(), collectionid: t = null, gc: n = !0, gcFilter: r = () => !0, meta: i = null, autoLoad: a = !1, shouldLoad: o = !0 } = {}) {
1963
- super(), this.gc = n, this.gcFilter = r, this.clientID = Ea(), this.guid = e, this.collectionid = t, this.share = /* @__PURE__ */ new Map(), this.store = new qa(), this._transaction = null, this._transactionCleanups = [], this.subdocs = /* @__PURE__ */ new Set(), this._item = null, this.shouldLoad = o, this.autoLoad = a, this.meta = i, this.isLoaded = !1, this.isSynced = !1, this.isDestroyed = !1, this.whenLoaded = or((e) => {
1961
+ }, Ta = er, Ea = class e extends un {
1962
+ constructor({ guid: e = nr(), collectionid: t = null, gc: n = !0, gcFilter: r = () => !0, meta: i = null, autoLoad: a = !1, shouldLoad: o = !0 } = {}) {
1963
+ super(), this.gc = n, this.gcFilter = r, this.clientID = Ta(), this.guid = e, this.collectionid = t, this.share = /* @__PURE__ */ new Map(), this.store = new Ka(), this._transaction = null, this._transactionCleanups = [], this.subdocs = /* @__PURE__ */ new Set(), this._item = null, this.shouldLoad = o, this.autoLoad = a, this.meta = i, this.isLoaded = !1, this.isSynced = !1, this.isDestroyed = !1, this.whenLoaded = ir((e) => {
1964
1964
  this.on("load", () => {
1965
1965
  this.isLoaded = !0, e(this);
1966
1966
  });
1967
1967
  });
1968
- let s = () => or((e) => {
1968
+ let s = () => ir((e) => {
1969
1969
  let t = (n) => {
1970
1970
  (n === void 0 || n === !0) && (this.off("sync", t), e());
1971
1971
  };
@@ -2039,81 +2039,81 @@ var ca = {
2039
2039
  }
2040
2040
  this.emit("destroyed", [!0]), this.emit("destroy", [this]), super.destroy();
2041
2041
  }
2042
- }, Oa = class {
2042
+ }, Da = class {
2043
2043
  constructor() {
2044
- this.restEncoder = jn();
2044
+ this.restEncoder = An();
2045
2045
  }
2046
2046
  toUint8Array() {
2047
- return Nn(this.restEncoder);
2047
+ return P(this.restEncoder);
2048
2048
  }
2049
2049
  resetDsCurVal() {}
2050
2050
  writeDsClock(e) {
2051
- P(this.restEncoder, e);
2051
+ I(this.restEncoder, e);
2052
2052
  }
2053
2053
  writeDsLen(e) {
2054
- P(this.restEncoder, e);
2054
+ I(this.restEncoder, e);
2055
2055
  }
2056
- }, ka = class extends Oa {
2056
+ }, Oa = class extends Da {
2057
2057
  writeLeftID(e) {
2058
- P(this.restEncoder, e.client), P(this.restEncoder, e.clock);
2058
+ I(this.restEncoder, e.client), I(this.restEncoder, e.clock);
2059
2059
  }
2060
2060
  writeRightID(e) {
2061
- P(this.restEncoder, e.client), P(this.restEncoder, e.clock);
2061
+ I(this.restEncoder, e.client), I(this.restEncoder, e.clock);
2062
2062
  }
2063
2063
  writeClient(e) {
2064
- P(this.restEncoder, e);
2064
+ I(this.restEncoder, e);
2065
2065
  }
2066
2066
  writeInfo(e) {
2067
- Fn(this.restEncoder, e);
2067
+ Nn(this.restEncoder, e);
2068
2068
  }
2069
2069
  writeString(e) {
2070
- zn(this.restEncoder, e);
2070
+ Ln(this.restEncoder, e);
2071
2071
  }
2072
2072
  writeParentInfo(e) {
2073
- P(this.restEncoder, e ? 1 : 0);
2073
+ I(this.restEncoder, e ? 1 : 0);
2074
2074
  }
2075
2075
  writeTypeRef(e) {
2076
- P(this.restEncoder, e);
2076
+ I(this.restEncoder, e);
2077
2077
  }
2078
2078
  writeLen(e) {
2079
- P(this.restEncoder, e);
2079
+ I(this.restEncoder, e);
2080
2080
  }
2081
2081
  writeAny(e) {
2082
- qn(this.restEncoder, e);
2082
+ Gn(this.restEncoder, e);
2083
2083
  }
2084
2084
  writeBuf(e) {
2085
- F(this.restEncoder, e);
2085
+ L(this.restEncoder, e);
2086
2086
  }
2087
2087
  writeJSON(e) {
2088
- zn(this.restEncoder, JSON.stringify(e));
2088
+ Ln(this.restEncoder, JSON.stringify(e));
2089
2089
  }
2090
2090
  writeKey(e) {
2091
- zn(this.restEncoder, e);
2091
+ Ln(this.restEncoder, e);
2092
2092
  }
2093
- }, Aa = class {
2093
+ }, ka = class {
2094
2094
  constructor() {
2095
- this.restEncoder = jn(), this.dsCurrVal = 0;
2095
+ this.restEncoder = An(), this.dsCurrVal = 0;
2096
2096
  }
2097
2097
  toUint8Array() {
2098
- return Nn(this.restEncoder);
2098
+ return P(this.restEncoder);
2099
2099
  }
2100
2100
  resetDsCurVal() {
2101
2101
  this.dsCurrVal = 0;
2102
2102
  }
2103
2103
  writeDsClock(e) {
2104
2104
  let t = e - this.dsCurrVal;
2105
- this.dsCurrVal = e, P(this.restEncoder, t);
2105
+ this.dsCurrVal = e, I(this.restEncoder, t);
2106
2106
  }
2107
2107
  writeDsLen(e) {
2108
- e === 0 && L(), P(this.restEncoder, e - 1), this.dsCurrVal += e;
2108
+ e === 0 && z(), I(this.restEncoder, e - 1), this.dsCurrVal += e;
2109
2109
  }
2110
- }, ja = class extends Aa {
2110
+ }, Aa = class extends ka {
2111
2111
  constructor() {
2112
- super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new Qn(), this.clientEncoder = new Xn(), this.leftClockEncoder = new Qn(), this.rightClockEncoder = new Qn(), this.infoEncoder = new Jn(Fn), this.stringEncoder = new $n(), this.parentInfoEncoder = new Jn(Fn), this.typeRefEncoder = new Xn(), this.lenEncoder = new Xn();
2112
+ super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new Xn(), this.clientEncoder = new Jn(), this.leftClockEncoder = new Xn(), this.rightClockEncoder = new Xn(), this.infoEncoder = new Kn(Nn), this.stringEncoder = new Zn(), this.parentInfoEncoder = new Kn(Nn), this.typeRefEncoder = new Jn(), this.lenEncoder = new Jn();
2113
2113
  }
2114
2114
  toUint8Array() {
2115
- let e = jn();
2116
- return P(e, 0), F(e, this.keyClockEncoder.toUint8Array()), F(e, this.clientEncoder.toUint8Array()), F(e, this.leftClockEncoder.toUint8Array()), F(e, this.rightClockEncoder.toUint8Array()), F(e, Nn(this.infoEncoder)), F(e, this.stringEncoder.toUint8Array()), F(e, Nn(this.parentInfoEncoder)), F(e, this.typeRefEncoder.toUint8Array()), F(e, this.lenEncoder.toUint8Array()), Bn(e, Nn(this.restEncoder)), Nn(e);
2115
+ let e = An();
2116
+ return I(e, 0), L(e, this.keyClockEncoder.toUint8Array()), L(e, this.clientEncoder.toUint8Array()), L(e, this.leftClockEncoder.toUint8Array()), L(e, this.rightClockEncoder.toUint8Array()), L(e, P(this.infoEncoder)), L(e, this.stringEncoder.toUint8Array()), L(e, P(this.parentInfoEncoder)), L(e, this.typeRefEncoder.toUint8Array()), L(e, this.lenEncoder.toUint8Array()), Rn(e, P(this.restEncoder)), P(e);
2117
2117
  }
2118
2118
  writeLeftID(e) {
2119
2119
  this.clientEncoder.write(e.client), this.leftClockEncoder.write(e.clock);
@@ -2140,115 +2140,115 @@ var ca = {
2140
2140
  this.lenEncoder.write(e);
2141
2141
  }
2142
2142
  writeAny(e) {
2143
- qn(this.restEncoder, e);
2143
+ Gn(this.restEncoder, e);
2144
2144
  }
2145
2145
  writeBuf(e) {
2146
- F(this.restEncoder, e);
2146
+ L(this.restEncoder, e);
2147
2147
  }
2148
2148
  writeJSON(e) {
2149
- qn(this.restEncoder, e);
2149
+ Gn(this.restEncoder, e);
2150
2150
  }
2151
2151
  writeKey(e) {
2152
2152
  let t = this.keyMap.get(e);
2153
2153
  t === void 0 ? (this.keyClockEncoder.write(this.keyClock++), this.stringEncoder.write(e)) : this.keyClockEncoder.write(t);
2154
2154
  }
2155
- }, Ma = (e, t, n, r) => {
2156
- r = mn(r, t[0].id.clock);
2157
- let i = G(t, r);
2158
- P(e.restEncoder, t.length - i), e.writeClient(n), P(e.restEncoder, r);
2155
+ }, ja = (e, t, n, r) => {
2156
+ r = pn(r, t[0].id.clock);
2157
+ let i = Ya(t, r);
2158
+ I(e.restEncoder, t.length - i), e.writeClient(n), I(e.restEncoder, r);
2159
2159
  let a = t[i];
2160
2160
  a.write(e, r - a.id.clock);
2161
2161
  for (let n = i + 1; n < t.length; n++) t[n].write(e, 0);
2162
- }, Na = (e, t, n) => {
2162
+ }, Ma = (e, t, n) => {
2163
2163
  let r = /* @__PURE__ */ new Map();
2164
2164
  n.forEach((e, n) => {
2165
- W(t, n) > e && r.set(n, e);
2166
- }), Ja(t).forEach((e, t) => {
2165
+ G(t, n) > e && r.set(n, e);
2166
+ }), qa(t).forEach((e, t) => {
2167
2167
  n.has(t) || r.set(t, 0);
2168
- }), P(e.restEncoder, r.size), an(r.entries()).sort((e, t) => t[0] - e[0]).forEach(([n, r]) => {
2169
- Ma(e, t.clients.get(n), n, r);
2168
+ }), I(e.restEncoder, r.size), an(r.entries()).sort((e, t) => t[0] - e[0]).forEach(([n, r]) => {
2169
+ ja(e, t.clients.get(n), n, r);
2170
2170
  });
2171
- }, Pa = (e, t) => Na(e, t.doc.store, t.beforeState), Fa = class {
2171
+ }, Na = (e, t) => Ma(e, t.doc.store, t.beforeState), Pa = class {
2172
2172
  constructor() {
2173
2173
  this.l = [];
2174
2174
  }
2175
- }, Ia = () => new Fa(), La = (e, t) => e.l.push(t), Ra = (e, t) => {
2175
+ }, Fa = () => new Pa(), Ia = (e, t) => e.l.push(t), La = (e, t) => {
2176
2176
  let n = e.l, r = n.length;
2177
2177
  e.l = n.filter((e) => t !== e), r === e.l.length && console.error("[yjs] Tried to remove event handler that doesn't exist.");
2178
- }, za = (e, t, n) => Cr(e.l, [t, n]), Ba = class {
2178
+ }, Ra = (e, t, n) => xr(e.l, [t, n]), za = class {
2179
2179
  constructor(e, t) {
2180
2180
  this.client = e, this.clock = t;
2181
2181
  }
2182
- }, Va = (e, t) => e === t || e !== null && t !== null && e.client === t.client && e.clock === t.clock, U = (e, t) => new Ba(e, t), Ha = (e) => {
2182
+ }, Ba = (e, t) => e === t || e !== null && t !== null && e.client === t.client && e.clock === t.clock, W = (e, t) => new za(e, t), Va = (e) => {
2183
2183
  for (let [t, n] of e.doc.share.entries()) if (n === e) return t;
2184
- throw L();
2185
- }, Ua = (e, t) => {
2184
+ throw z();
2185
+ }, Ha = (e, t) => {
2186
2186
  for (; t !== null;) {
2187
2187
  if (t.parent === e) return !0;
2188
2188
  t = t.parent._item;
2189
2189
  }
2190
2190
  return !1;
2191
- }, Wa = class {
2191
+ }, Ua = class {
2192
2192
  constructor(e, t) {
2193
2193
  this.ds = e, this.sv = t;
2194
2194
  }
2195
2195
  };
2196
- ((e, t) => new Wa(e, t))(wa(), /* @__PURE__ */ new Map());
2197
- var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.get(e.id.client) || 0) > e.id.clock && !ba(t.ds, e.id), Ka = (e, t) => {
2198
- let n = Qt(e.meta, Ka, tn), r = e.doc.store;
2196
+ ((e, t) => new Ua(e, t))(Ca(), /* @__PURE__ */ new Map());
2197
+ var Wa = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.get(e.id.client) || 0) > e.id.clock && !ya(t.ds, e.id), Ga = (e, t) => {
2198
+ let n = Qt(e.meta, Ga, tn), r = e.doc.store;
2199
2199
  n.has(t) || (t.sv.forEach((t, n) => {
2200
- t < W(r, n) && K(e, U(n, t));
2201
- }), va(e, t.ds, (e) => {}), n.add(t));
2202
- }, qa = class {
2200
+ t < G(r, n) && K(e, W(n, t));
2201
+ }), _a(e, t.ds, (e) => {}), n.add(t));
2202
+ }, Ka = class {
2203
2203
  constructor() {
2204
2204
  this.clients = /* @__PURE__ */ new Map(), this.pendingStructs = null, this.pendingDs = null;
2205
2205
  }
2206
- }, Ja = (e) => {
2206
+ }, qa = (e) => {
2207
2207
  let t = /* @__PURE__ */ new Map();
2208
2208
  return e.clients.forEach((e, n) => {
2209
2209
  let r = e[e.length - 1];
2210
2210
  t.set(n, r.id.clock + r.length);
2211
2211
  }), t;
2212
- }, W = (e, t) => {
2212
+ }, G = (e, t) => {
2213
2213
  let n = e.clients.get(t);
2214
2214
  if (n === void 0) return 0;
2215
2215
  let r = n[n.length - 1];
2216
2216
  return r.id.clock + r.length;
2217
- }, Ya = (e, t) => {
2217
+ }, Ja = (e, t) => {
2218
2218
  let n = e.clients.get(t.id.client);
2219
2219
  if (n === void 0) n = [], e.clients.set(t.id.client, n);
2220
2220
  else {
2221
2221
  let e = n[n.length - 1];
2222
- if (e.id.clock + e.length !== t.id.clock) throw L();
2222
+ if (e.id.clock + e.length !== t.id.clock) throw z();
2223
2223
  }
2224
2224
  n.push(t);
2225
- }, G = (e, t) => {
2225
+ }, Ya = (e, t) => {
2226
2226
  let n = 0, r = e.length - 1, i = e[r], a = i.id.clock;
2227
2227
  if (a === t) return r;
2228
- let o = dn(t / (a + i.length - 1) * r);
2228
+ let o = N(t / (a + i.length - 1) * r);
2229
2229
  for (; n <= r;) {
2230
2230
  if (i = e[o], a = i.id.clock, a <= t) {
2231
2231
  if (t < a + i.length) return o;
2232
2232
  n = o + 1;
2233
2233
  } else r = o - 1;
2234
- o = dn((n + r) / 2);
2234
+ o = N((n + r) / 2);
2235
2235
  }
2236
- throw L();
2236
+ throw z();
2237
2237
  }, Xa = (e, t) => {
2238
2238
  let n = e.clients.get(t.client);
2239
- return n[G(n, t.clock)];
2239
+ return n[Ya(n, t.clock)];
2240
2240
  }, Za = (e, t, n) => {
2241
- let r = G(t, n), i = t[r];
2241
+ let r = Ya(t, n), i = t[r];
2242
2242
  return i.id.clock < n && i instanceof Q ? (t.splice(r + 1, 0, Ms(e, i, n - i.id.clock)), r + 1) : r;
2243
2243
  }, K = (e, t) => {
2244
2244
  let n = e.doc.store.clients.get(t.client);
2245
2245
  return n[Za(e, n, t.clock)];
2246
2246
  }, Qa = (e, t, n) => {
2247
- let r = t.clients.get(n.client), i = G(r, n.clock), a = r[i];
2247
+ let r = t.clients.get(n.client), i = Ya(r, n.clock), a = r[i];
2248
2248
  return n.clock !== a.id.clock + a.length - 1 && a.constructor !== hs && r.splice(i + 1, 0, Ms(e, a, n.clock - a.id.clock + 1)), a;
2249
2249
  }, $a = (e, t, n) => {
2250
2250
  let r = e.clients.get(t.id.client);
2251
- r[G(r, t.id.clock)] = n;
2251
+ r[Ya(r, t.id.clock)] = n;
2252
2252
  }, eo = (e, t, n, r, i) => {
2253
2253
  if (r === 0) return;
2254
2254
  let a = n + r, o = Za(e, t, n), s;
@@ -2257,9 +2257,9 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2257
2257
  while (o < t.length && t[o].id.clock < a);
2258
2258
  }, to = class {
2259
2259
  constructor(e, t, n) {
2260
- this.doc = e, this.deleteSet = new _a(), this.beforeState = Ja(e.store), this.afterState = /* @__PURE__ */ new Map(), this.changed = /* @__PURE__ */ new Map(), this.changedParentTypes = /* @__PURE__ */ new Map(), this._mergeStructs = [], this.origin = t, this.meta = /* @__PURE__ */ new Map(), this.local = n, this.subdocsAdded = /* @__PURE__ */ new Set(), this.subdocsRemoved = /* @__PURE__ */ new Set(), this.subdocsLoaded = /* @__PURE__ */ new Set(), this._needFormattingCleanup = !1;
2260
+ this.doc = e, this.deleteSet = new ga(), this.beforeState = qa(e.store), this.afterState = /* @__PURE__ */ new Map(), this.changed = /* @__PURE__ */ new Map(), this.changedParentTypes = /* @__PURE__ */ new Map(), this._mergeStructs = [], this.origin = t, this.meta = /* @__PURE__ */ new Map(), this.local = n, this.subdocsAdded = /* @__PURE__ */ new Set(), this.subdocsRemoved = /* @__PURE__ */ new Set(), this.subdocsLoaded = /* @__PURE__ */ new Set(), this._needFormattingCleanup = !1;
2261
2261
  }
2262
- }, no = (e, t) => t.deleteSet.clients.size === 0 && !en(t.afterState, (e, n) => t.beforeState.get(n) !== e) ? !1 : (xa(t.deleteSet), Pa(e, t), Ta(e, t.deleteSet), !0), ro = (e, t, n) => {
2262
+ }, no = (e, t) => t.deleteSet.clients.size === 0 && !en(t.afterState, (e, n) => t.beforeState.get(n) !== e) ? !1 : (ba(t.deleteSet), Na(e, t), wa(e, t.deleteSet), !0), ro = (e, t, n) => {
2263
2263
  let r = t._item;
2264
2264
  (r === null || r.id.clock < (e.beforeState.get(r.id.client) || 0) && !r.deleted) && Qt(e.changed, t, tn).add(n);
2265
2265
  }, io = (e, t) => {
@@ -2278,7 +2278,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2278
2278
  let e = t.clients.get(r);
2279
2279
  for (let r = i.length - 1; r >= 0; r--) {
2280
2280
  let a = i[r], o = a.clock + a.len;
2281
- for (let r = G(e, a.clock), i = e[r]; r < e.length && i.id.clock < o; i = e[++r]) {
2281
+ for (let r = Ya(e, a.clock), i = e[r]; r < e.length && i.id.clock < o; i = e[++r]) {
2282
2282
  let i = e[r];
2283
2283
  if (a.clock + a.len <= i.id.clock) break;
2284
2284
  i instanceof Q && i.deleted && !i.keep && n(i) && i.gc(t, !1);
@@ -2289,7 +2289,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2289
2289
  e.clients.forEach((e, n) => {
2290
2290
  let r = t.clients.get(n);
2291
2291
  for (let t = e.length - 1; t >= 0; t--) {
2292
- let n = e[t], i = pn(r.length - 1, 1 + G(r, n.clock + n.len - 1));
2292
+ let n = e[t], i = fn(r.length - 1, 1 + Ya(r, n.clock + n.len - 1));
2293
2293
  for (let e = i, t = r[e]; e > 0 && t.id.clock >= n.clock; t = r[e]) e -= 1 + io(r, e);
2294
2294
  }
2295
2295
  });
@@ -2297,7 +2297,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2297
2297
  if (t < e.length) {
2298
2298
  let n = e[t], r = n.doc, i = r.store, a = n.deleteSet, o = n._mergeStructs;
2299
2299
  try {
2300
- xa(a), n.afterState = Ja(n.doc.store), r.emit("beforeObserverCalls", [n, r]);
2300
+ ba(a), n.afterState = qa(n.doc.store), r.emit("beforeObserverCalls", [n, r]);
2301
2301
  let e = [];
2302
2302
  n.changed.forEach((t, r) => e.push(() => {
2303
2303
  (r._item === null || !r._item.deleted) && r._callObserver(n, t);
@@ -2306,26 +2306,26 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2306
2306
  r._dEH.l.length > 0 && (r._item === null || !r._item.deleted) && (t = t.filter((e) => e.target._item === null || !e.target._item.deleted), t.forEach((e) => {
2307
2307
  e.currentTarget = r, e._path = null;
2308
2308
  }), t.sort((e, t) => e.path.length - t.path.length), e.push(() => {
2309
- za(r._dEH, t, n);
2309
+ Ra(r._dEH, t, n);
2310
2310
  }));
2311
2311
  }), e.push(() => r.emit("afterTransaction", [n, r])), e.push(() => {
2312
2312
  n._needFormattingCleanup && as(n);
2313
2313
  });
2314
- }), Cr(e, []);
2314
+ }), xr(e, []);
2315
2315
  } finally {
2316
2316
  r.gc && ao(a, i, r.gcFilter), oo(a, i), n.afterState.forEach((e, t) => {
2317
2317
  let r = n.beforeState.get(t) || 0;
2318
2318
  if (r !== e) {
2319
- let e = i.clients.get(t), n = mn(G(e, r), 1);
2319
+ let e = i.clients.get(t), n = pn(Ya(e, r), 1);
2320
2320
  for (let t = e.length - 1; t >= n;) t -= 1 + io(e, t);
2321
2321
  }
2322
2322
  });
2323
2323
  for (let e = o.length - 1; e >= 0; e--) {
2324
- let { client: t, clock: n } = o[e].id, r = i.clients.get(t), a = G(r, n);
2324
+ let { client: t, clock: n } = o[e].id, r = i.clients.get(t), a = Ya(r, n);
2325
2325
  a + 1 < r.length && io(r, a + 1) > 1 || a > 0 && io(r, a);
2326
2326
  }
2327
- if (!n.local && n.afterState.get(r.clientID) !== n.beforeState.get(r.clientID) && (ua(aa, Qi, "[yjs] ", $i, ra, "Changed the client-id because another client seems to be using it."), r.clientID = Ea()), r.emit("afterTransactionCleanup", [n, r]), r._observers.has("update")) {
2328
- let e = new ka();
2327
+ if (!n.local && n.afterState.get(r.clientID) !== n.beforeState.get(r.clientID) && (la(ia, Zi, "[yjs] ", Qi, na, "Changed the client-id because another client seems to be using it."), r.clientID = Ta()), r.emit("afterTransactionCleanup", [n, r]), r._observers.has("update")) {
2328
+ let e = new Oa();
2329
2329
  no(e, n) && r.emit("update", [
2330
2330
  e.toUint8Array(),
2331
2331
  n.origin,
@@ -2334,7 +2334,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2334
2334
  ]);
2335
2335
  }
2336
2336
  if (r._observers.has("updateV2")) {
2337
- let e = new ja();
2337
+ let e = new Aa();
2338
2338
  no(e, n) && r.emit("updateV2", [
2339
2339
  e.toUint8Array(),
2340
2340
  n.origin,
@@ -2373,24 +2373,24 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2373
2373
  this.insertions = t, this.deletions = e, this.meta = /* @__PURE__ */ new Map();
2374
2374
  }
2375
2375
  }, lo = (e, t, n) => {
2376
- va(e, n.deletions, (n) => {
2377
- n instanceof Q && t.scope.some((t) => t === e.doc || Ua(t, n)) && js(n, !1);
2376
+ _a(e, n.deletions, (n) => {
2377
+ n instanceof Q && t.scope.some((t) => t === e.doc || Ha(t, n)) && js(n, !1);
2378
2378
  });
2379
2379
  }, uo = (e, t, n) => {
2380
2380
  let r = null, i = e.doc, a = e.scope;
2381
2381
  q(i, (n) => {
2382
2382
  for (; t.length > 0 && e.currStackItem === null;) {
2383
2383
  let r = i.store, o = t.pop(), s = /* @__PURE__ */ new Set(), c = [], l = !1;
2384
- va(n, o.insertions, (e) => {
2384
+ _a(n, o.insertions, (e) => {
2385
2385
  if (e instanceof Q) {
2386
2386
  if (e.redone !== null) {
2387
2387
  let { item: t, diff: i } = As(r, e.id);
2388
- i > 0 && (t = K(n, U(t.id.client, t.id.clock + i))), e = t;
2388
+ i > 0 && (t = K(n, W(t.id.client, t.id.clock + i))), e = t;
2389
2389
  }
2390
- !e.deleted && a.some((t) => t === n.doc || Ua(t, e)) && c.push(e);
2390
+ !e.deleted && a.some((t) => t === n.doc || Ha(t, e)) && c.push(e);
2391
2391
  }
2392
- }), va(n, o.deletions, (e) => {
2393
- e instanceof Q && a.some((t) => t === n.doc || Ua(t, e)) && !ba(o.insertions, e.id) && s.add(e);
2392
+ }), _a(n, o.deletions, (e) => {
2393
+ e instanceof Q && a.some((t) => t === n.doc || Ha(t, e)) && !ya(o.insertions, e.id) && s.add(e);
2394
2394
  }), s.forEach((t) => {
2395
2395
  l = Ps(n, t, s, o.insertions, e.ignoreRemoteMapChanges, e) !== null || l;
2396
2396
  });
@@ -2416,23 +2416,23 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2416
2416
  }
2417
2417
  return o;
2418
2418
  }, fo = class extends un {
2419
- constructor(e, { captureTimeout: t = 500, captureTransaction: n = (e) => !0, deleteFilter: r = () => !0, trackedOrigins: i = new Set([null]), ignoreRemoteMapChanges: a = !1, doc: o = ln(e) ? e[0].doc : e instanceof Da ? e : e.doc } = {}) {
2419
+ constructor(e, { captureTimeout: t = 500, captureTransaction: n = (e) => !0, deleteFilter: r = () => !0, trackedOrigins: i = new Set([null]), ignoreRemoteMapChanges: a = !1, doc: o = ln(e) ? e[0].doc : e instanceof Ea ? e : e.doc } = {}) {
2420
2420
  super(), this.scope = [], this.doc = o, this.addToScope(e), this.deleteFilter = r, i.add(this), this.trackedOrigins = i, this.captureTransaction = n, this.undoStack = [], this.redoStack = [], this.undoing = !1, this.redoing = !1, this.currStackItem = null, this.lastChange = 0, this.ignoreRemoteMapChanges = a, this.captureTimeout = t, this.afterTransactionHandler = (e) => {
2421
2421
  if (!this.captureTransaction(e) || !this.scope.some((t) => e.changedParentTypes.has(t) || t === this.doc) || !this.trackedOrigins.has(e.origin) && (!e.origin || !this.trackedOrigins.has(e.origin.constructor))) return;
2422
2422
  let t = this.undoing, n = this.redoing, r = t ? this.redoStack : this.undoStack;
2423
2423
  t ? this.stopCapturing() : n || this.clear(!1, !0);
2424
- let i = new _a();
2424
+ let i = new ga();
2425
2425
  e.afterState.forEach((t, n) => {
2426
2426
  let r = e.beforeState.get(n) || 0, a = t - r;
2427
- a > 0 && Ca(i, n, r, a);
2427
+ a > 0 && Sa(i, n, r, a);
2428
2428
  });
2429
- let a = ar(), o = !1;
2429
+ let a = rr(), o = !1;
2430
2430
  if (this.lastChange > 0 && a - this.lastChange < this.captureTimeout && r.length > 0 && !t && !n) {
2431
2431
  let t = r[r.length - 1];
2432
- t.deletions = Sa([t.deletions, e.deleteSet]), t.insertions = Sa([t.insertions, i]);
2432
+ t.deletions = xa([t.deletions, e.deleteSet]), t.insertions = xa([t.insertions, i]);
2433
2433
  } else r.push(new co(e.deleteSet, i)), o = !0;
2434
- !t && !n && (this.lastChange = a), va(e, e.deleteSet, (t) => {
2435
- t instanceof Q && this.scope.some((n) => n === e.doc || Ua(n, t)) && js(t, !0);
2434
+ !t && !n && (this.lastChange = a), _a(e, e.deleteSet, (t) => {
2435
+ t instanceof Q && this.scope.some((n) => n === e.doc || Ha(n, t)) && js(t, !0);
2436
2436
  });
2437
2437
  let s = [{
2438
2438
  stackItem: r[r.length - 1],
@@ -2448,7 +2448,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2448
2448
  addToScope(e) {
2449
2449
  let t = new Set(this.scope);
2450
2450
  e = ln(e) ? e : [e], e.forEach((e) => {
2451
- t.has(e) || (t.add(e), (e instanceof Y ? e.doc !== this.doc : e !== this.doc) && da("[yjs#509] Not same Y.Doc"), this.scope.push(e));
2451
+ t.has(e) || (t.add(e), (e instanceof Y ? e.doc !== this.doc : e !== this.doc) && ua("[yjs#509] Not same Y.Doc"), this.scope.push(e));
2452
2452
  });
2453
2453
  }
2454
2454
  addTrackedOrigin(e) {
@@ -2505,11 +2505,11 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2505
2505
  return this._path || (this._path = ho(this.currentTarget, this.target));
2506
2506
  }
2507
2507
  deletes(e) {
2508
- return ba(this.transaction.deleteSet, e.id);
2508
+ return ya(this.transaction.deleteSet, e.id);
2509
2509
  }
2510
2510
  get keys() {
2511
2511
  if (this._keys === null) {
2512
- if (this.transaction.doc._transactionCleanups.length === 0) throw er(po);
2512
+ if (this.transaction.doc._transactionCleanups.length === 0) throw Qn(po);
2513
2513
  let e = /* @__PURE__ */ new Map(), t = this.target;
2514
2514
  this.transaction.changed.get(t).forEach((n) => {
2515
2515
  if (n !== null) {
@@ -2540,7 +2540,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2540
2540
  get changes() {
2541
2541
  let e = this._changes;
2542
2542
  if (e === null) {
2543
- if (this.transaction.doc._transactionCleanups.length === 0) throw er(po);
2543
+ if (this.transaction.doc._transactionCleanups.length === 0) throw Qn(po);
2544
2544
  let t = this.target, n = tn(), r = tn(), i = [];
2545
2545
  if (e = {
2546
2546
  added: n,
@@ -2571,7 +2571,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2571
2571
  }
2572
2572
  return n;
2573
2573
  }, J = () => {
2574
- da("Invalid access: Add Yjs type to a document before reading data.");
2574
+ ua("Invalid access: Add Yjs type to a document before reading data.");
2575
2575
  }, go = 80, _o = 0, vo = class {
2576
2576
  constructor(e, t) {
2577
2577
  e.marker = !0, this.p = e, this.index = t, this.timestamp = _o++;
@@ -2590,7 +2590,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2590
2590
  }
2591
2591
  }, So = (e, t) => {
2592
2592
  if (e._start === null || t === 0 || e._searchMarker === null) return null;
2593
- let n = e._searchMarker.length === 0 ? null : e._searchMarker.reduce((e, n) => fn(t - e.index) < fn(t - n.index) ? e : n), r = e._start, i = 0;
2593
+ let n = e._searchMarker.length === 0 ? null : e._searchMarker.reduce((e, n) => dn(t - e.index) < dn(t - n.index) ? e : n), r = e._start, i = 0;
2594
2594
  for (n !== null && (r = n.p, i = n.index, yo(n)); r.right !== null && i < t;) {
2595
2595
  if (!r.deleted && r.countable) {
2596
2596
  if (t < i + r.length) break;
@@ -2600,7 +2600,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2600
2600
  }
2601
2601
  for (; r.left !== null && i > t;) r = r.left, !r.deleted && r.countable && (i -= r.length);
2602
2602
  for (; r.left !== null && r.left.id.client === r.id.client && r.left.id.clock + r.left.length === r.id.clock;) r = r.left, !r.deleted && r.countable && (i -= r.length);
2603
- return n !== null && fn(n.index - i) < r.parent.length / go ? (bo(n, r, i), n) : xo(e._searchMarker, r, i);
2603
+ return n !== null && dn(n.index - i) < r.parent.length / go ? (bo(n, r, i), n) : xo(e._searchMarker, r, i);
2604
2604
  }, Co = (e, t, n) => {
2605
2605
  for (let r = e.length - 1; r >= 0; r--) {
2606
2606
  let i = e[r];
@@ -2613,15 +2613,15 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2613
2613
  }
2614
2614
  i.p = t, t.marker = !0;
2615
2615
  }
2616
- (t < i.index || n > 0 && t === i.index) && (i.index = mn(t, i.index + n));
2616
+ (t < i.index || n > 0 && t === i.index) && (i.index = pn(t, i.index + n));
2617
2617
  }
2618
2618
  }, wo = (e, t, n) => {
2619
2619
  let r = e, i = t.changedParentTypes;
2620
2620
  for (; Qt(i, e, () => []).push(n), e._item !== null;) e = e._item.parent;
2621
- za(r._eH, n, t);
2621
+ Ra(r._eH, n, t);
2622
2622
  }, Y = class {
2623
2623
  constructor() {
2624
- this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH = Ia(), this._dEH = Ia(), this._searchMarker = null;
2624
+ this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH = Fa(), this._dEH = Fa(), this._searchMarker = null;
2625
2625
  }
2626
2626
  get parent() {
2627
2627
  return this._item ? this._item.parent : null;
@@ -2630,10 +2630,10 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2630
2630
  this.doc = e, this._item = t;
2631
2631
  }
2632
2632
  _copy() {
2633
- throw I();
2633
+ throw R();
2634
2634
  }
2635
2635
  clone() {
2636
- throw I();
2636
+ throw R();
2637
2637
  }
2638
2638
  _write(e) {}
2639
2639
  get _first() {
@@ -2645,16 +2645,16 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2645
2645
  !e.local && this._searchMarker && (this._searchMarker.length = 0);
2646
2646
  }
2647
2647
  observe(e) {
2648
- La(this._eH, e);
2648
+ Ia(this._eH, e);
2649
2649
  }
2650
2650
  observeDeep(e) {
2651
- La(this._dEH, e);
2651
+ Ia(this._dEH, e);
2652
2652
  }
2653
2653
  unobserve(e) {
2654
- Ra(this._eH, e);
2654
+ La(this._eH, e);
2655
2655
  }
2656
2656
  unobserveDeep(e) {
2657
- Ra(this._dEH, e);
2657
+ La(this._dEH, e);
2658
2658
  }
2659
2659
  toJSON() {}
2660
2660
  }, To = (e, t, n) => {
@@ -2728,7 +2728,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2728
2728
  }
2729
2729
  }, jo = (e, t, n, r) => {
2730
2730
  let i = n, a = e.doc, o = a.clientID, s = a.store, c = n === null ? t._start : n.right, l = [], u = () => {
2731
- l.length > 0 && (i = new Q(U(o, W(s, o)), i, i && i.lastId, c, c && c.id, t, null, new Ss(l)), i.integrate(e, 0), l = []);
2731
+ l.length > 0 && (i = new Q(W(o, G(s, o)), i, i && i.lastId, c, c && c.id, t, null, new Ss(l)), i.integrate(e, 0), l = []);
2732
2732
  };
2733
2733
  r.forEach((n) => {
2734
2734
  if (n === null) l.push(n);
@@ -2743,23 +2743,23 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2743
2743
  default: switch (u(), n.constructor) {
2744
2744
  case Uint8Array:
2745
2745
  case ArrayBuffer:
2746
- i = new Q(U(o, W(s, o)), i, i && i.lastId, c, c && c.id, t, null, new gs(new Uint8Array(n))), i.integrate(e, 0);
2746
+ i = new Q(W(o, G(s, o)), i, i && i.lastId, c, c && c.id, t, null, new gs(new Uint8Array(n))), i.integrate(e, 0);
2747
2747
  break;
2748
- case Da:
2749
- i = new Q(U(o, W(s, o)), i, i && i.lastId, c, c && c.id, t, null, new ys(n)), i.integrate(e, 0);
2748
+ case Ea:
2749
+ i = new Q(W(o, G(s, o)), i, i && i.lastId, c, c && c.id, t, null, new ys(n)), i.integrate(e, 0);
2750
2750
  break;
2751
- default: if (n instanceof Y) i = new Q(U(o, W(s, o)), i, i && i.lastId, c, c && c.id, t, null, new ks(n)), i.integrate(e, 0);
2751
+ default: if (n instanceof Y) i = new Q(W(o, G(s, o)), i, i && i.lastId, c, c && c.id, t, null, new ks(n)), i.integrate(e, 0);
2752
2752
  else throw Error("Unexpected content type in insert operation");
2753
2753
  }
2754
2754
  }
2755
2755
  }), u();
2756
- }, Mo = () => er("Length exceeded!"), No = (e, t, n, r) => {
2756
+ }, Mo = () => Qn("Length exceeded!"), No = (e, t, n, r) => {
2757
2757
  if (n > t._length) throw Mo();
2758
2758
  if (n === 0) return t._searchMarker && Co(t._searchMarker, n, r.length), jo(e, t, null, r);
2759
2759
  let i = n, a = So(t, n), o = t._start;
2760
2760
  for (a !== null && (o = a.p, n -= a.index, n === 0 && (o = o.prev, n += o && o.countable && !o.deleted ? o.length : 0)); o !== null; o = o.right) if (!o.deleted && o.countable) {
2761
2761
  if (n <= o.length) {
2762
- n < o.length && K(e, U(o.id.client, o.id.clock + n));
2762
+ n < o.length && K(e, W(o.id.client, o.id.clock + n));
2763
2763
  break;
2764
2764
  }
2765
2765
  n -= o.length;
@@ -2775,8 +2775,8 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2775
2775
  }, Fo = (e, t, n, r) => {
2776
2776
  if (r === 0) return;
2777
2777
  let i = n, a = r, o = So(t, n), s = t._start;
2778
- for (o !== null && (s = o.p, n -= o.index); s !== null && n > 0; s = s.right) !s.deleted && s.countable && (n < s.length && K(e, U(s.id.client, s.id.clock + n)), n -= s.length);
2779
- for (; r > 0 && s !== null;) s.deleted || (r < s.length && K(e, U(s.id.client, s.id.clock + r)), s.delete(e), r -= s.length), s = s.right;
2778
+ for (o !== null && (s = o.p, n -= o.index); s !== null && n > 0; s = s.right) !s.deleted && s.countable && (n < s.length && K(e, W(s.id.client, s.id.clock + n)), n -= s.length);
2779
+ for (; r > 0 && s !== null;) s.deleted || (r < s.length && K(e, W(s.id.client, s.id.clock + r)), s.delete(e), r -= s.length), s = s.right;
2780
2780
  if (r > 0) throw Mo();
2781
2781
  t._searchMarker && Co(t._searchMarker, i, -a + r);
2782
2782
  }, Io = (e, t, n) => {
@@ -2798,13 +2798,13 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2798
2798
  case Uint8Array:
2799
2799
  s = new gs(r);
2800
2800
  break;
2801
- case Da:
2801
+ case Ea:
2802
2802
  s = new ys(r);
2803
2803
  break;
2804
2804
  default: if (r instanceof Y) s = new ks(r);
2805
2805
  else throw Error("Unexpected content type");
2806
2806
  }
2807
- new Q(U(o, W(a.store, o)), i, i && i.lastId, null, null, t, n, s).integrate(e, 0);
2807
+ new Q(W(o, G(a.store, o)), i, i && i.lastId, null, null, t, n, s).integrate(e, 0);
2808
2808
  }, Ro = (e, t) => {
2809
2809
  e.doc != null || J();
2810
2810
  let n = e._map.get(t);
@@ -2823,9 +2823,9 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2823
2823
  return e._map.forEach((e, r) => {
2824
2824
  let i = e;
2825
2825
  for (; i !== null && (!t.sv.has(i.id.client) || i.id.clock >= (t.sv.get(i.id.client) || 0));) i = i.left;
2826
- i !== null && Ga(i, t) && (n[r] = i.content.getContent()[i.length - 1]);
2826
+ i !== null && Wa(i, t) && (n[r] = i.content.getContent()[i.length - 1]);
2827
2827
  }), n;
2828
- }, Ho = (e) => (e.doc != null || J(), ma(e._map.entries(), (e) => !e[1].deleted)), Uo = class extends mo {}, Wo = class e extends Y {
2828
+ }, Ho = (e) => (e.doc != null || J(), pa(e._map.entries(), (e) => !e[1].deleted)), Uo = class extends mo {}, Wo = class e extends Y {
2829
2829
  constructor() {
2830
2830
  super(), this._prelimContent = [], this._searchMarker = [];
2831
2831
  }
@@ -2930,13 +2930,13 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2930
2930
  return [...Ho(this)].length;
2931
2931
  }
2932
2932
  keys() {
2933
- return ha(Ho(this), (e) => e[0]);
2933
+ return ma(Ho(this), (e) => e[0]);
2934
2934
  }
2935
2935
  values() {
2936
- return ha(Ho(this), (e) => e[1].content.getContent()[e[1].length - 1]);
2936
+ return ma(Ho(this), (e) => e[1].content.getContent()[e[1].length - 1]);
2937
2937
  }
2938
2938
  entries() {
2939
- return ha(Ho(this), (e) => [e[0], e[1].content.getContent()[e[1].length - 1]]);
2939
+ return ma(Ho(this), (e) => [e[0], e[1].content.getContent()[e[1].length - 1]]);
2940
2940
  }
2941
2941
  forEach(e) {
2942
2942
  this.doc != null || J(), this._map.forEach((t, n) => {
@@ -2972,12 +2972,12 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2972
2972
  _write(e) {
2973
2973
  e.writeTypeRef(Ts);
2974
2974
  }
2975
- }, Ko = (e, t) => e === t || typeof e == "object" && typeof t == "object" && e && t && br(e, t), qo = class {
2975
+ }, Ko = (e, t) => e === t || typeof e == "object" && typeof t == "object" && e && t && vr(e, t), qo = class {
2976
2976
  constructor(e, t, n, r) {
2977
2977
  this.left = e, this.right = t, this.index = n, this.currentAttributes = r;
2978
2978
  }
2979
2979
  forward() {
2980
- switch (this.right === null && L(), this.right.content.constructor) {
2980
+ switch (this.right === null && z(), this.right.content.constructor) {
2981
2981
  case Z:
2982
2982
  this.right.deleted || Zo(this.currentAttributes, this.right.content);
2983
2983
  break;
@@ -2994,7 +2994,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
2994
2994
  t.right.deleted || Zo(t.currentAttributes, t.right.content);
2995
2995
  break;
2996
2996
  default:
2997
- t.right.deleted || (n < t.right.length && K(e, U(t.right.id.client, t.right.id.clock + n)), t.index += t.right.length, n -= t.right.length);
2997
+ t.right.deleted || (n < t.right.length && K(e, W(t.right.id.client, t.right.id.clock + n)), t.index += t.right.length, n -= t.right.length);
2998
2998
  break;
2999
2999
  }
3000
3000
  t.left = t.right, t.right = t.right.right;
@@ -3007,7 +3007,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3007
3007
  for (; n.right !== null && (n.right.deleted === !0 || n.right.content.constructor === Z && Ko(r.get(n.right.content.key), n.right.content.value));) n.right.deleted || r.delete(n.right.content.key), n.forward();
3008
3008
  let i = e.doc, a = i.clientID;
3009
3009
  r.forEach((r, o) => {
3010
- let s = n.left, c = n.right, l = new Q(U(a, W(i.store, a)), s, s && s.lastId, c, c && c.id, t, null, new Z(o, r));
3010
+ let s = n.left, c = n.right, l = new Q(W(a, G(i.store, a)), s, s && s.lastId, c, c && c.id, t, null, new Z(o, r));
3011
3011
  l.integrate(e, 0), n.right = l, n.forward();
3012
3012
  });
3013
3013
  }, Zo = (e, t) => {
@@ -3027,7 +3027,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3027
3027
  if (!Ko(u, l)) {
3028
3028
  o.set(c, u);
3029
3029
  let { left: r, right: s } = n;
3030
- n.right = new Q(U(a, W(i.store, a)), r, r && r.lastId, s, s && s.id, t, null, new Z(c, l)), n.right.integrate(e, 0), n.forward();
3030
+ n.right = new Q(W(a, G(i.store, a)), r, r && r.lastId, s, s && s.id, t, null, new Z(c, l)), n.right.integrate(e, 0), n.forward();
3031
3031
  }
3032
3032
  }
3033
3033
  return o;
@@ -3038,7 +3038,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3038
3038
  let a = e.doc, o = a.clientID;
3039
3039
  Qo(n, i);
3040
3040
  let s = $o(e, t, n, i), c = r.constructor === String ? new Cs(r) : r instanceof Y ? new ks(r) : new bs(r), { left: l, right: u, index: d } = n;
3041
- t._searchMarker && Co(t._searchMarker, n.index, c.getLength()), u = new Q(U(o, W(a.store, o)), l, l && l.lastId, u, u && u.id, t, null, c), u.integrate(e, 0), n.right = u, n.index = d, n.forward(), Xo(e, t, n, s);
3041
+ t._searchMarker && Co(t._searchMarker, n.index, c.getLength()), u = new Q(W(o, G(a.store, o)), l, l && l.lastId, u, u && u.id, t, null, c), u.integrate(e, 0), n.right = u, n.index = d, n.forward(), Xo(e, t, n, s);
3042
3042
  }, ts = (e, t, n, r, i) => {
3043
3043
  let a = e.doc, o = a.clientID;
3044
3044
  Qo(n, i);
@@ -3058,7 +3058,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3058
3058
  break;
3059
3059
  }
3060
3060
  default:
3061
- r < n.right.length && K(e, U(n.right.id.client, n.right.id.clock + r)), r -= n.right.length;
3061
+ r < n.right.length && K(e, W(n.right.id.client, n.right.id.clock + r)), r -= n.right.length;
3062
3062
  break;
3063
3063
  }
3064
3064
  n.forward();
@@ -3066,7 +3066,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3066
3066
  if (r > 0) {
3067
3067
  let i = "";
3068
3068
  for (; r > 0; r--) i += "\n";
3069
- n.right = new Q(U(o, W(a.store, o)), n.left, n.left && n.left.lastId, n.right, n.right && n.right.id, t, null, new Cs(i)), n.right.integrate(e, 0), n.forward();
3069
+ n.right = new Q(W(o, G(a.store, o)), n.left, n.left && n.left.lastId, n.right, n.right && n.right.id, t, null, new Cs(i)), n.right.integrate(e, 0), n.forward();
3070
3070
  }
3071
3071
  Xo(e, t, n, s);
3072
3072
  }, ns = (e, t, n, r, i) => {
@@ -3133,7 +3133,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3133
3133
  });
3134
3134
  }
3135
3135
  q(n, (n) => {
3136
- va(e, e.deleteSet, (e) => {
3136
+ _a(e, e.deleteSet, (e) => {
3137
3137
  if (e instanceof hs || !e.parent._hasFormatting || t.has(e.parent)) return;
3138
3138
  let r = e.parent;
3139
3139
  e.content.constructor === Z ? t.add(r) : rs(n, e);
@@ -3147,7 +3147,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3147
3147
  case ks:
3148
3148
  case bs:
3149
3149
  case Cs:
3150
- n < t.right.length && K(e, U(t.right.id.client, t.right.id.clock + n)), n -= t.right.length, t.right.delete(e);
3150
+ n < t.right.length && K(e, W(t.right.id.client, t.right.id.clock + n)), n -= t.right.length, t.right.delete(e);
3151
3151
  break;
3152
3152
  }
3153
3153
  t.forward();
@@ -3186,7 +3186,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3186
3186
  }))), s = "";
3187
3187
  break;
3188
3188
  case "retain":
3189
- c > 0 && (e = { retain: c }, _r(o) || (e.attributes = pr({}, o))), c = 0;
3189
+ c > 0 && (e = { retain: c }, hr(o) || (e.attributes = dr({}, o))), c = 0;
3190
3190
  break;
3191
3191
  }
3192
3192
  e && t.push(e), a = null;
@@ -3301,10 +3301,10 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3301
3301
  }
3302
3302
  let l = () => {
3303
3303
  for (; s !== null;) {
3304
- if (Ga(s, e) || t !== void 0 && Ga(s, t)) switch (s.content.constructor) {
3304
+ if (Wa(s, e) || t !== void 0 && Wa(s, t)) switch (s.content.constructor) {
3305
3305
  case Cs: {
3306
3306
  let r = i.get("ychange");
3307
- e !== void 0 && !Ga(s, e) ? (r === void 0 || r.user !== s.id.client || r.type !== "removed") && (c(), i.set("ychange", n ? n("removed", s.id) : { type: "removed" })) : t !== void 0 && !Ga(s, t) ? (r === void 0 || r.user !== s.id.client || r.type !== "added") && (c(), i.set("ychange", n ? n("added", s.id) : { type: "added" })) : r !== void 0 && (c(), i.delete("ychange")), o += s.content.str;
3307
+ e !== void 0 && !Wa(s, e) ? (r === void 0 || r.user !== s.id.client || r.type !== "removed") && (c(), i.set("ychange", n ? n("removed", s.id) : { type: "removed" })) : t !== void 0 && !Wa(s, t) ? (r === void 0 || r.user !== s.id.client || r.type !== "added") && (c(), i.set("ychange", n ? n("added", s.id) : { type: "added" })) : r !== void 0 && (c(), i.delete("ychange")), o += s.content.str;
3308
3308
  break;
3309
3309
  }
3310
3310
  case ks:
@@ -3321,7 +3321,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3321
3321
  break;
3322
3322
  }
3323
3323
  case Z:
3324
- Ga(s, e) && (c(), Zo(i, s.content));
3324
+ Wa(s, e) && (c(), Zo(i, s.content));
3325
3325
  break;
3326
3326
  }
3327
3327
  s = s.right;
@@ -3329,7 +3329,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3329
3329
  c();
3330
3330
  };
3331
3331
  return e || t ? q(a, (n) => {
3332
- e && Ka(n, e), t && Ka(n, t), l();
3332
+ e && Ga(n, e), t && Ga(n, t), l();
3333
3333
  }, "cleanup") : l(), r;
3334
3334
  }
3335
3335
  insert(e, t, n) {
@@ -3469,7 +3469,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3469
3469
  });
3470
3470
  else {
3471
3471
  let n = this._prelimContent, r = e === null ? 0 : n.findIndex((t) => t === e) + 1;
3472
- if (r === 0 && e !== null) throw er("Reference item not found");
3472
+ if (r === 0 && e !== null) throw Qn("Reference item not found");
3473
3473
  n.splice(r, 0, ...t);
3474
3474
  }
3475
3475
  }
@@ -3521,7 +3521,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3521
3521
  }
3522
3522
  clone() {
3523
3523
  let t = new e(this.nodeName);
3524
- return hr(this.getAttributes(), (e, n) => {
3524
+ return pr(this.getAttributes(), (e, n) => {
3525
3525
  t.setAttribute(n, e);
3526
3526
  }), t.insert(0, this.toArray().map((e) => e instanceof Y ? e.clone() : e)), t;
3527
3527
  }
@@ -3580,16 +3580,16 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3580
3580
  this.id = e, this.length = t;
3581
3581
  }
3582
3582
  get deleted() {
3583
- throw I();
3583
+ throw R();
3584
3584
  }
3585
3585
  mergeWith(e) {
3586
3586
  return !1;
3587
3587
  }
3588
3588
  write(e, t, n) {
3589
- throw I();
3589
+ throw R();
3590
3590
  }
3591
3591
  integrate(e, t) {
3592
- throw I();
3592
+ throw R();
3593
3593
  }
3594
3594
  }, ms = 0, hs = class extends ps {
3595
3595
  get deleted() {
@@ -3600,7 +3600,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3600
3600
  return this.constructor === e.constructor ? (this.length += e.length, !0) : !1;
3601
3601
  }
3602
3602
  integrate(e, t) {
3603
- t > 0 && (this.id.clock += t, this.length -= t), Ya(e.doc.store, this);
3603
+ t > 0 && (this.id.clock += t, this.length -= t), Ja(e.doc.store, this);
3604
3604
  }
3605
3605
  write(e, t) {
3606
3606
  e.writeInfo(ms), e.writeLen(this.length - t);
@@ -3625,7 +3625,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3625
3625
  return new e(this.content);
3626
3626
  }
3627
3627
  splice(e) {
3628
- throw I();
3628
+ throw R();
3629
3629
  }
3630
3630
  mergeWith(e) {
3631
3631
  return !1;
@@ -3663,7 +3663,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3663
3663
  return this.len += e.len, !0;
3664
3664
  }
3665
3665
  integrate(e, t) {
3666
- Ca(e.deleteSet, t.id.client, t.id.clock, this.len), t.markDeleted();
3666
+ Sa(e.deleteSet, t.id.client, t.id.clock, this.len), t.markDeleted();
3667
3667
  }
3668
3668
  delete(e) {}
3669
3669
  gc(e) {}
@@ -3673,7 +3673,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3673
3673
  getRef() {
3674
3674
  return 1;
3675
3675
  }
3676
- }, vs = (e, t) => new Da(D(D({ guid: e }, t), {}, { shouldLoad: t.shouldLoad || t.autoLoad || !1 })), ys = class e {
3676
+ }, vs = (e, t) => new Ea(D(D({ guid: e }, t), {}, { shouldLoad: t.shouldLoad || t.autoLoad || !1 })), ys = class e {
3677
3677
  constructor(e) {
3678
3678
  e._item && console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."), this.doc = e;
3679
3679
  let t = {};
@@ -3692,7 +3692,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3692
3692
  return new e(vs(this.doc.guid, this.opts));
3693
3693
  }
3694
3694
  splice(e) {
3695
- throw I();
3695
+ throw R();
3696
3696
  }
3697
3697
  mergeWith(e) {
3698
3698
  return !1;
@@ -3727,7 +3727,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3727
3727
  return new e(this.embed);
3728
3728
  }
3729
3729
  splice(e) {
3730
- throw I();
3730
+ throw R();
3731
3731
  }
3732
3732
  mergeWith(e) {
3733
3733
  return !1;
@@ -3758,7 +3758,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3758
3758
  return new e(this.key, this.value);
3759
3759
  }
3760
3760
  splice(e) {
3761
- throw I();
3761
+ throw R();
3762
3762
  }
3763
3763
  mergeWith(e) {
3764
3764
  return !1;
@@ -3775,9 +3775,9 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3775
3775
  getRef() {
3776
3776
  return 6;
3777
3777
  }
3778
- }, xs = Ar("node_env") === "development", Ss = class e {
3778
+ }, xs = Or("node_env") === "development", Ss = class e {
3779
3779
  constructor(e) {
3780
- this.arr = e, xs && Sr(e);
3780
+ this.arr = e, xs && br(e);
3781
3781
  }
3782
3782
  getLength() {
3783
3783
  return this.arr.length;
@@ -3863,7 +3863,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3863
3863
  return new e(this.type._copy());
3864
3864
  }
3865
3865
  splice(e) {
3866
- throw I();
3866
+ throw R();
3867
3867
  }
3868
3868
  mergeWith(e) {
3869
3869
  return !1;
@@ -3894,7 +3894,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3894
3894
  }, As = (e, t) => {
3895
3895
  let n = t, r = 0, i;
3896
3896
  do
3897
- r > 0 && (n = U(n.client, n.clock + r)), i = Xa(e, n), r = n.clock - i.id.clock, n = i.redone;
3897
+ r > 0 && (n = W(n.client, n.clock + r)), i = Xa(e, n), r = n.clock - i.id.clock, n = i.redone;
3898
3898
  while (n !== null && i instanceof Q);
3899
3899
  return {
3900
3900
  item: i,
@@ -3903,9 +3903,9 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3903
3903
  }, js = (e, t) => {
3904
3904
  for (; e !== null && e.keep !== t;) e.keep = t, e = e.parent._item;
3905
3905
  }, Ms = (e, t, n) => {
3906
- let { client: r, clock: i } = t.id, a = new Q(U(r, i + n), t, U(r, i + n - 1), t.right, t.rightOrigin, t.parent, t.parentSub, t.content.splice(n));
3907
- return t.deleted && a.markDeleted(), t.keep && (a.keep = !0), t.redone !== null && (a.redone = U(t.redone.client, t.redone.clock + n)), t.right = a, a.right !== null && (a.right.left = a), e._mergeStructs.push(a), a.parentSub !== null && a.right === null && a.parent._map.set(a.parentSub, a), t.length = n, a;
3908
- }, Ns = (e, t) => sn(e, (e) => ba(e.deletions, t)), Ps = (e, t, n, r, i, a) => {
3906
+ let { client: r, clock: i } = t.id, a = new Q(W(r, i + n), t, W(r, i + n - 1), t.right, t.rightOrigin, t.parent, t.parentSub, t.content.splice(n));
3907
+ return t.deleted && a.markDeleted(), t.keep && (a.keep = !0), t.redone !== null && (a.redone = W(t.redone.client, t.redone.clock + n)), t.right = a, a.right !== null && (a.right.left = a), e._mergeStructs.push(a), a.parentSub !== null && a.right === null && a.parent._map.set(a.parentSub, a), t.length = n, a;
3908
+ }, Ns = (e, t) => sn(e, (e) => ya(e.deletions, t)), Ps = (e, t, n, r, i, a) => {
3909
3909
  let o = e.doc, s = o.store, c = o.clientID, l = t.redone;
3910
3910
  if (l !== null) return K(e, l);
3911
3911
  let u = t.parent._item, d = null, f;
@@ -3934,10 +3934,10 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3934
3934
  f = f.right;
3935
3935
  }
3936
3936
  } else if (f = null, t.right && !i) {
3937
- for (d = t; d !== null && d.right !== null && (d.right.redone || ba(r, d.right.id) || Ns(a.undoStack, d.right.id) || Ns(a.redoStack, d.right.id));) for (d = d.right; d.redone;) d = K(e, d.redone);
3937
+ for (d = t; d !== null && d.right !== null && (d.right.redone || ya(r, d.right.id) || Ns(a.undoStack, d.right.id) || Ns(a.redoStack, d.right.id));) for (d = d.right; d.redone;) d = K(e, d.redone);
3938
3938
  if (d && d.right !== null) return null;
3939
3939
  } else d = p._map.get(t.parentSub) || null;
3940
- let m = U(c, W(s, c)), h = new Q(m, d, d && d.lastId, f, f && f.id, p, t.parentSub, t.content.copy());
3940
+ let m = W(c, G(s, c)), h = new Q(m, d, d && d.lastId, f, f && f.id, p, t.parentSub, t.content.copy());
3941
3941
  return t.redone = m, js(h, !0), h.integrate(e, 0), h;
3942
3942
  }, Q = class e extends ps {
3943
3943
  constructor(e, t, n, r, i, a, o, s) {
@@ -3968,19 +3968,19 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3968
3968
  this.info |= 4;
3969
3969
  }
3970
3970
  getMissing(t, n) {
3971
- if (this.origin && this.origin.client !== this.id.client && this.origin.clock >= W(n, this.origin.client)) return this.origin.client;
3972
- if (this.rightOrigin && this.rightOrigin.client !== this.id.client && this.rightOrigin.clock >= W(n, this.rightOrigin.client)) return this.rightOrigin.client;
3973
- if (this.parent && this.parent.constructor === Ba && this.id.client !== this.parent.client && this.parent.clock >= W(n, this.parent.client)) return this.parent.client;
3971
+ if (this.origin && this.origin.client !== this.id.client && this.origin.clock >= G(n, this.origin.client)) return this.origin.client;
3972
+ if (this.rightOrigin && this.rightOrigin.client !== this.id.client && this.rightOrigin.clock >= G(n, this.rightOrigin.client)) return this.rightOrigin.client;
3973
+ if (this.parent && this.parent.constructor === za && this.id.client !== this.parent.client && this.parent.clock >= G(n, this.parent.client)) return this.parent.client;
3974
3974
  if (this.origin && (this.left = Qa(t, n, this.origin), this.origin = this.left.lastId), this.rightOrigin && (this.right = K(t, this.rightOrigin), this.rightOrigin = this.right.id), this.left && this.left.constructor === hs || this.right && this.right.constructor === hs) this.parent = null;
3975
3975
  else if (!this.parent) this.left && this.left.constructor === e ? (this.parent = this.left.parent, this.parentSub = this.left.parentSub) : this.right && this.right.constructor === e && (this.parent = this.right.parent, this.parentSub = this.right.parentSub);
3976
- else if (this.parent.constructor === Ba) {
3976
+ else if (this.parent.constructor === za) {
3977
3977
  let e = Xa(n, this.parent);
3978
3978
  e.constructor === hs ? this.parent = null : this.parent = e.content.type;
3979
3979
  }
3980
3980
  return null;
3981
3981
  }
3982
3982
  integrate(e, t) {
3983
- if (t > 0 && (this.id.clock += t, this.left = Qa(e, e.doc.store, U(this.id.client, this.id.clock - 1)), this.origin = this.left.lastId, this.content = this.content.splice(t), this.length -= t), this.parent) {
3983
+ if (t > 0 && (this.id.clock += t, this.left = Qa(e, e.doc.store, W(this.id.client, this.id.clock - 1)), this.origin = this.left.lastId, this.content = this.content.splice(t), this.length -= t), this.parent) {
3984
3984
  if (!this.left && (!this.right || this.right.left !== null) || this.left && this.left.right !== this.right) {
3985
3985
  let t = this.left, n;
3986
3986
  if (t !== null) n = t.right;
@@ -3988,9 +3988,9 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
3988
3988
  else n = this.parent._start;
3989
3989
  let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
3990
3990
  for (; n !== null && n !== this.right;) {
3991
- if (i.add(n), r.add(n), Va(this.origin, n.origin)) {
3991
+ if (i.add(n), r.add(n), Ba(this.origin, n.origin)) {
3992
3992
  if (n.id.client < this.id.client) t = n, r.clear();
3993
- else if (Va(this.rightOrigin, n.rightOrigin)) break;
3993
+ else if (Ba(this.rightOrigin, n.rightOrigin)) break;
3994
3994
  } else if (n.origin !== null && i.has(Xa(e.doc.store, n.origin))) r.has(Xa(e.doc.store, n.origin)) || (t = n, r.clear());
3995
3995
  else break;
3996
3996
  n = n.right;
@@ -4004,7 +4004,7 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
4004
4004
  else e = this.parent._start, this.parent._start = this;
4005
4005
  this.right = e;
4006
4006
  }
4007
- this.right === null ? this.parentSub !== null && (this.parent._map.set(this.parentSub, this), this.left !== null && this.left.delete(e)) : this.right.left = this, this.parentSub === null && this.countable && !this.deleted && (this.parent._length += this.length), Ya(e.doc.store, this), this.content.integrate(e, this), ro(e, this.parent, this.parentSub), (this.parent._item !== null && this.parent._item.deleted || this.parentSub !== null && this.right !== null) && this.delete(e);
4007
+ this.right === null ? this.parentSub !== null && (this.parent._map.set(this.parentSub, this), this.left !== null && this.left.delete(e)) : this.right.left = this, this.parentSub === null && this.countable && !this.deleted && (this.parent._length += this.length), Ja(e.doc.store, this), this.content.integrate(e, this), ro(e, this.parent, this.parentSub), (this.parent._item !== null && this.parent._item.deleted || this.parentSub !== null && this.right !== null) && this.delete(e);
4008
4008
  } else new hs(this.id, this.length).integrate(e, 0);
4009
4009
  }
4010
4010
  get next() {
@@ -4018,10 +4018,10 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
4018
4018
  return e;
4019
4019
  }
4020
4020
  get lastId() {
4021
- return this.length === 1 ? this.id : U(this.id.client, this.id.clock + this.length - 1);
4021
+ return this.length === 1 ? this.id : W(this.id.client, this.id.clock + this.length - 1);
4022
4022
  }
4023
4023
  mergeWith(e) {
4024
- if (this.constructor === e.constructor && Va(e.origin, this.lastId) && this.right === e && Va(this.rightOrigin, e.rightOrigin) && this.id.client === e.id.client && this.id.clock + this.length === e.id.clock && this.deleted === e.deleted && this.redone === null && e.redone === null && this.content.constructor === e.content.constructor && this.content.mergeWith(e.content)) {
4024
+ if (this.constructor === e.constructor && Ba(e.origin, this.lastId) && this.right === e && Ba(this.rightOrigin, e.rightOrigin) && this.id.client === e.id.client && this.id.clock + this.length === e.id.clock && this.deleted === e.deleted && this.redone === null && e.redone === null && this.content.constructor === e.content.constructor && this.content.mergeWith(e.content)) {
4025
4025
  let t = this.parent._searchMarker;
4026
4026
  return t && t.forEach((t) => {
4027
4027
  t.p === e && (t.p = this, !this.deleted && this.countable && (t.index -= this.length));
@@ -4032,24 +4032,24 @@ var Ga = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.ge
4032
4032
  delete(e) {
4033
4033
  if (!this.deleted) {
4034
4034
  let t = this.parent;
4035
- this.countable && this.parentSub === null && (t._length -= this.length), this.markDeleted(), Ca(e.deleteSet, this.id.client, this.id.clock, this.length), ro(e, t, this.parentSub), this.content.delete(e);
4035
+ this.countable && this.parentSub === null && (t._length -= this.length), this.markDeleted(), Sa(e.deleteSet, this.id.client, this.id.clock, this.length), ro(e, t, this.parentSub), this.content.delete(e);
4036
4036
  }
4037
4037
  }
4038
4038
  gc(e, t) {
4039
- if (!this.deleted) throw L();
4039
+ if (!this.deleted) throw z();
4040
4040
  this.content.gc(e), t ? $a(e, this, new hs(this.id, this.length)) : this.content = new _s(this.length);
4041
4041
  }
4042
4042
  write(e, t) {
4043
- let n = t > 0 ? U(this.id.client, this.id.clock + t - 1) : this.origin, r = this.rightOrigin, i = this.parentSub, a = this.content.getRef() & 31 | (n === null ? 0 : 128) | (r === null ? 0 : 64) | (i === null ? 0 : 32);
4043
+ let n = t > 0 ? W(this.id.client, this.id.clock + t - 1) : this.origin, r = this.rightOrigin, i = this.parentSub, a = this.content.getRef() & 31 | (n === null ? 0 : 128) | (r === null ? 0 : 64) | (i === null ? 0 : 32);
4044
4044
  if (e.writeInfo(a), n !== null && e.writeLeftID(n), r !== null && e.writeRightID(r), n === null && r === null) {
4045
4045
  let t = this.parent;
4046
4046
  if (t._item !== void 0) {
4047
4047
  let n = t._item;
4048
4048
  if (n === null) {
4049
- let n = Ha(t);
4049
+ let n = Va(t);
4050
4050
  e.writeParentInfo(!0), e.writeString(n);
4051
4051
  } else e.writeParentInfo(!1), e.writeLeftID(n.id);
4052
- } else t.constructor === String ? (e.writeParentInfo(!0), e.writeString(t)) : t.constructor === Ba ? (e.writeParentInfo(!1), e.writeLeftID(t)) : L();
4052
+ } else t.constructor === String ? (e.writeParentInfo(!0), e.writeString(t)) : t.constructor === za ? (e.writeParentInfo(!1), e.writeLeftID(t)) : z();
4053
4053
  i !== null && e.writeString(i);
4054
4054
  }
4055
4055
  this.content.write(e, t);
@@ -4152,7 +4152,7 @@ var Ls = class {
4152
4152
  }
4153
4153
  }, Rs = class {
4154
4154
  constructor(e) {
4155
- this.ydoc = new Da(), this.yblocks = this.ydoc.getArray("blocks"), this.serializer = e;
4155
+ this.ydoc = new Ea(), this.yblocks = this.ydoc.getArray("blocks"), this.serializer = e;
4156
4156
  }
4157
4157
  fromJSON(e) {
4158
4158
  this.ydoc.transact(() => {
@@ -10319,7 +10319,7 @@ var Dd = {
10319
10319
  super(), this.opened = !1, this.listeners = new ce(), this.popover = null, this.currentBlockForSearch = null, this.currentContentEditable = null, this.isInsideTableCell = !1, this.openedWithSlash = !0, this.handleMobileLayoutToggle = () => {
10320
10320
  this.destroyPopover(), this.initPopover();
10321
10321
  }, this.onPopoverClose = () => {
10322
- this.isInsideTableCell && (this.toggleRestrictedToolsHidden(!1), this.isInsideTableCell = !1), this.stopListeningToBlockInput(), this.opened = !1, this.emit(Nd.Closed);
10322
+ this.opened && (this.isInsideTableCell && (this.toggleRestrictedToolsHidden(!1), this.isInsideTableCell = !1), this.stopListeningToBlockInput(), this.opened = !1, this.emit(Nd.Closed));
10323
10323
  }, this.handleBlockInput = () => {
10324
10324
  var e;
10325
10325
  if (this.currentContentEditable === null) return;
@@ -10364,8 +10364,8 @@ var Dd = {
10364
10364
  this.api.blocks.stopBlockMutationWatching(r);
10365
10365
  let i = this.api.blocks.getBlockByIndex(r);
10366
10366
  this.isInsideTableCell = i !== void 0 && i.holder.closest("[data-blok-table-cell-blocks]") !== null, this.isInsideTableCell && this.toggleRestrictedToolsHidden(!0), (t = this.popover) == null || t.show();
10367
- let a = ((n = this.triggerElement) == null ? void 0 : n.getBoundingClientRect().height) === 0;
10368
- if ((this.isInsideTableCell || a) && this.popover instanceof Oe) {
10367
+ let a = (n = this.triggerElement) == null ? void 0 : n.getBoundingClientRect(), o = (a == null ? void 0 : a.height) === 0, s = a !== void 0 && a.bottom < 0, c = i !== void 0 && i.parentId !== null;
10368
+ if ((this.isInsideTableCell || o || s || c) && this.popover instanceof Oe) {
10369
10369
  let e = E.rect;
10370
10370
  this.popover.updatePosition(e);
10371
10371
  } else if (!e && this.popover instanceof Oe) {
@@ -10376,7 +10376,7 @@ var Dd = {
10376
10376
  }
10377
10377
  close() {
10378
10378
  var e;
10379
- this.isInsideTableCell && (this.toggleRestrictedToolsHidden(!1), this.isInsideTableCell = !1), this.stopListeningToBlockInput(), (e = this.popover) == null || e.hide(), this.opened = !1, this.emit(Nd.Closed);
10379
+ this.isInsideTableCell && (this.toggleRestrictedToolsHidden(!1), this.isInsideTableCell = !1), this.stopListeningToBlockInput(), (e = this.popover) == null || e.hide(), this.opened && (this.opened = !1, this.emit(Nd.Closed));
10380
10380
  }
10381
10381
  toggle() {
10382
10382
  this.opened ? this.close() : this.open();
@@ -10535,7 +10535,7 @@ var Dd = {
10535
10535
  }
10536
10536
  }, Id = class {
10537
10537
  constructor(e, t) {
10538
- this.hoveredBlockInternal = null, this.getBlok = e, this.getToolboxOpened = t.getToolboxOpened, this.openToolbox = t.openToolbox, this.openToolboxWithoutSlash = t.openToolboxWithoutSlash, this.closeToolbox = t.closeToolbox, this.moveAndOpenToolbar = t.moveAndOpenToolbar;
10538
+ this.hoveredBlockInternal = null, this.getBlok = e, this.getToolboxOpened = t.getToolboxOpened, this.openToolbox = t.openToolbox, this.openToolboxWithoutSlash = t.openToolboxWithoutSlash, this.closeToolbox = t.closeToolbox, this.moveAndOpenToolbar = t.moveAndOpenToolbar, this.onFocusBlockCaptured = t.onFocusBlockCaptured;
10539
10539
  }
10540
10540
  get hoveredBlock() {
10541
10541
  return this.hoveredBlockInternal;
@@ -10550,17 +10550,19 @@ var Dd = {
10550
10550
  return Ke(n, Ae([t.I18n.t("toolbox.addBelow"), i]), { delay: 500 }), n;
10551
10551
  }
10552
10552
  handleClick(e = !1) {
10553
- var t, n, r;
10554
- let { BlockManager: i, BlockSettings: a, BlockSelection: o, Caret: s } = this.getBlok();
10555
- if (a.opened && a.close(), o.anyBlockSelected && o.clearSelection(), (t = E.get()) == null || t.removeAllRanges(), this.getToolboxOpened()) {
10553
+ var t, n, r, i, a;
10554
+ let { BlockManager: o, BlockSettings: s, BlockSelection: c, Caret: l } = this.getBlok();
10555
+ if (s.opened && s.close(), c.anyBlockSelected && c.clearSelection(), (t = E.get()) == null || t.removeAllRanges(), this.getToolboxOpened()) {
10556
10556
  this.closeToolbox();
10557
10557
  return;
10558
10558
  }
10559
- let c = this.hoveredBlockInternal, l = (c == null ? void 0 : c.name) === "paragraph" && ((n = c.pluginsContent.textContent) == null ? void 0 : n.startsWith("/")), u = (r = i.currentBlock) == null ? null : r, d = c !== null && c.isEmpty, f = !d && u !== null && u !== c && u.isEmpty && c !== null && c.holder.contains(u.holder), p = d && c || f && u || null, m = c === null ? i.currentBlockIndex : i.getBlockIndex(c), h = e ? m : m + 1, g = i.blocks.slice(h), _ = (e) => {
10559
+ let u = this.hoveredBlockInternal, d = (u == null ? void 0 : u.name) === "paragraph" && ((n = u.pluginsContent.textContent) == null ? void 0 : n.startsWith("/")), f = (r = o.currentBlock) == null ? null : r, p = document.activeElement, m = p !== null && p !== document.body ? (i = o.getBlockByChildNode(p)) == null ? null : i : null, h = u !== null && u.isEmpty, g = !h && f !== null && f !== u && f.isEmpty && u !== null && u.holder.contains(f.holder), _ = h && u || g && f || null, ee = u === null ? o.currentBlockIndex : o.getBlockIndex(u), te = e ? ee : ee + 1, v = o.blocks.slice(te), ne = (e) => {
10560
10560
  var t;
10561
10561
  return ((t = e.holder.parentElement) == null ? void 0 : t.closest("[data-blok-testid=\"block-wrapper\"]")) !== null;
10562
- }, ee = !e && c && g.length > 0 ? g.findIndex((e) => !_(e)) : 0, te = h + (ee === -1 ? g.length : ee), v = l ? c : p == null ? i.insertDefaultBlockAtIndex(te, !0) : p;
10563
- v !== c && p === null && _(v) && (c == null || c.holder.after(v.holder)), l ? (s.setToBlock(v, s.positions.DEFAULT, 1), this.moveAndOpenToolbar(v), this.openToolbox()) : (s.setToBlock(v, s.positions.START), this.moveAndOpenToolbar(v), this.openToolboxWithoutSlash());
10562
+ }, re = !e && u && v.length > 0 ? v.findIndex((e) => !ne(e)) : 0, ie = te + (re === -1 ? v.length : re), ae = d ? u : _ == null ? o.insertDefaultBlockAtIndex(ie, !0) : _;
10563
+ ae !== u && _ === null && ne(ae) && (u == null || u.holder.after(ae.holder));
10564
+ let oe = !d && _ === null ? ae : null;
10565
+ (a = this.onFocusBlockCaptured) == null || a.call(this, m, oe), d ? (l.setToBlock(ae, l.positions.DEFAULT, 1), this.moveAndOpenToolbar(ae), this.openToolbox()) : (l.setToBlock(ae, l.positions.START), this.moveAndOpenToolbar(ae), this.openToolboxWithoutSlash());
10564
10566
  }
10565
10567
  }, Ld = class {
10566
10568
  constructor() {
@@ -10628,7 +10630,7 @@ var Dd = {
10628
10630
  }
10629
10631
  createMousedownHandler() {
10630
10632
  return (e) => {
10631
- Ee(), this.clickDragHandler.setup(e, () => {
10633
+ e.preventDefault(), Ee(), this.clickDragHandler.setup(e, () => {
10632
10634
  this.handleClick(), this.getToolboxOpened() && this.closeToolbox();
10633
10635
  }, { beforeCallback: () => this.ignoreNextSettingsMouseUp ? (this.ignoreNextSettingsMouseUp = !1, !1) : !0 });
10634
10636
  };
@@ -10660,7 +10662,7 @@ var Dd = {
10660
10662
  super({
10661
10663
  config: e,
10662
10664
  eventsDispatcher: t
10663
- }), this.hoveredBlock = null, this.explicitlyClosed = !1, this.hoveredBlockIsFromTableCell = !1, this.toolboxInstance = null, this.onBlockSettingsOpen = () => {
10665
+ }), this.hoveredBlock = null, this.explicitlyClosed = !1, this.hoveredBlockIsFromTableCell = !1, this.toolboxInstance = null, this.preToolboxBlock = null, this.plusInsertedBlock = null, this.onBlockSettingsOpen = () => {
10664
10666
  this.Blok.UI.nodes.wrapper.setAttribute(C.blockSettingsOpened, "true");
10665
10667
  }, this.onBlockSettingsClose = () => {
10666
10668
  this.Blok.UI.nodes.wrapper.removeAttribute(C.blockSettingsOpened);
@@ -10675,7 +10677,10 @@ var Dd = {
10675
10677
  openToolbox: () => this.toolbox.open(),
10676
10678
  openToolboxWithoutSlash: () => this.toolbox.openWithoutSlash(),
10677
10679
  closeToolbox: () => this.toolbox.close(),
10678
- moveAndOpenToolbar: (e, t) => this.moveAndOpen(e, t)
10680
+ moveAndOpenToolbar: (e, t) => this.moveAndOpen(e, t),
10681
+ onFocusBlockCaptured: (e, t) => {
10682
+ this.preToolboxBlock = e, this.plusInsertedBlock = t;
10683
+ }
10679
10684
  }), this.settingsTogglerHandler = new Rd(() => this.Blok, this.clickDragHandler, {
10680
10685
  setHoveredBlock: (e) => {
10681
10686
  this.hoveredBlock = e;
@@ -10802,9 +10807,9 @@ var Dd = {
10802
10807
  this.Blok.BlockManager.blocks.length === 1 && a.isEmpty && !ee ? this.blockTunesToggler.hide() : this.blockTunesToggler.show(), this.open();
10803
10808
  let te = a.name === "header" && a.holder.querySelector("[data-blok-toggle-arrow]") !== null;
10804
10809
  if ((a.name === "callout" || a.name === "toggle" || te) && this.nodes.actions && (this.nodes.actions.style.pointerEvents = "none", this.restoreSettingsTogglerForLeftEdgeBlock(a)), g && this.nodes.content) {
10805
- var v, ne;
10806
- let e = parseFloat(getComputedStyle(g).marginLeft) || 0, t = (v = (ne = this.nodes.actions) == null ? void 0 : ne.offsetWidth) == null ? 0 : v;
10807
- this.nodes.content.style.marginLeft = `${Math.max(e, t)}px`;
10810
+ var v, ne, re;
10811
+ let e = (v = this.nodes.wrapper) == null ? void 0 : v.getBoundingClientRect(), t = g.getBoundingClientRect(), n = e ? Math.max(0, t.left - e.left) : 0, r = (ne = (re = this.nodes.actions) == null ? void 0 : re.offsetWidth) == null ? 0 : ne, i = e ? Math.max(0, e.left) : 0, a = Math.max(0, r - i);
10812
+ this.nodes.content.style.marginLeft = `${Math.max(n, a)}px`, this.nodes.content.style.maxWidth = `${t.width}px`;
10808
10813
  }
10809
10814
  }
10810
10815
  moveAndOpenForMultipleBlocks(e) {
@@ -10830,14 +10835,14 @@ var Dd = {
10830
10835
  this.positioner.moveToY(this.nodes, s), o.appendChild(r), a && !this.Blok.ReadOnly.isEnabled && n.setupDraggable(a, this.Blok.DragManager);
10831
10836
  let c = o.querySelector(`[${C.elementContent}]`);
10832
10837
  if (c && this.toolboxInstance.updateLeftAlignElement(c), this.positioner.applyContentOffset(this.nodes, n), this.blockTunesToggler.show(), this.open(), c && this.nodes.content) {
10833
- var l, u;
10834
- let e = parseFloat(getComputedStyle(c).marginLeft) || 0, t = (l = (u = this.nodes.actions) == null ? void 0 : u.offsetWidth) == null ? 0 : l;
10835
- this.nodes.content.style.marginLeft = `${Math.max(e, t)}px`;
10838
+ var l, u, d;
10839
+ let e = (l = this.nodes.wrapper) == null ? void 0 : l.getBoundingClientRect(), t = c.getBoundingClientRect(), n = e ? Math.max(0, t.left - e.left) : 0, r = (u = (d = this.nodes.actions) == null ? void 0 : d.offsetWidth) == null ? 0 : u, i = e ? Math.max(0, e.left) : 0, a = Math.max(0, r - i);
10840
+ this.nodes.content.style.marginLeft = `${Math.max(n, a)}px`, this.nodes.content.style.maxWidth = `${t.width}px`;
10836
10841
  }
10837
10842
  }
10838
10843
  close(e) {
10839
10844
  var t, n, r, i;
10840
- this.Blok.ReadOnly.isEnabled || ((t = this.nodes.wrapper) == null || t.classList.remove(this.CSS.toolbarOpened), (n = this.nodes.wrapper) == null || n.classList.add(this.CSS.toolbarClosed), (r = this.nodes.wrapper) == null || r.removeAttribute("data-blok-opened"), this.blockActions.hide(), (i = this.toolboxInstance) == null || i.close(), this.Blok.BlockSettings.close(), this.hoveredBlock = null, this.hoveredBlockIsFromTableCell = !1, (e == null ? void 0 : e.setExplicitlyClosed) !== !1 && (this.explicitlyClosed = !0, this.Blok.UI.resetBlockHoverState()), this.nodes.plusButton && (this.nodes.plusButton.style.display = "", this.nodes.plusButton.style.color = ""), this.nodes.settingsToggler && (this.nodes.settingsToggler.style.display = "", this.nodes.settingsToggler.style.color = ""), this.nodes.actions && (this.nodes.actions.style.transform = ""), this.nodes.content && (this.nodes.content.style.marginLeft = ""), this.positioner.setHoveredTarget(null), this.reset());
10845
+ this.Blok.ReadOnly.isEnabled || ((t = this.nodes.wrapper) == null || t.classList.remove(this.CSS.toolbarOpened), (n = this.nodes.wrapper) == null || n.classList.add(this.CSS.toolbarClosed), (r = this.nodes.wrapper) == null || r.removeAttribute("data-blok-opened"), this.blockActions.hide(), (i = this.toolboxInstance) == null || i.close(), this.Blok.BlockSettings.close(), this.hoveredBlock = null, this.hoveredBlockIsFromTableCell = !1, (e == null ? void 0 : e.setExplicitlyClosed) !== !1 && (this.explicitlyClosed = !0, this.Blok.UI.resetBlockHoverState()), this.nodes.plusButton && (this.nodes.plusButton.style.display = "", this.nodes.plusButton.style.color = ""), this.nodes.settingsToggler && (this.nodes.settingsToggler.style.display = "", this.nodes.settingsToggler.style.color = ""), this.nodes.actions && (this.nodes.actions.style.transform = ""), this.nodes.content && (this.nodes.content.style.marginLeft = "", this.nodes.content.style.maxWidth = ""), this.positioner.setHoveredTarget(null), this.reset());
10841
10846
  }
10842
10847
  skipNextSettingsToggle() {
10843
10848
  this.settingsTogglerHandler.skipNextToggle();
@@ -10937,8 +10942,20 @@ var Dd = {
10937
10942
  let t = this.hoveredBlock === null ? null : this.getCalloutBackgroundColor(this.hoveredBlock);
10938
10943
  (e = this.toolboxInstance) == null || e.setCalloutBackground(t);
10939
10944
  }), this.toolboxInstance.on(Nd.Closed, () => {
10940
- this.Blok.UI.nodes.wrapper.classList.remove(this.CSS.openedToolboxHolderModifier), this.Blok.UI.nodes.wrapper.removeAttribute(C.toolboxOpened);
10945
+ if (this.Blok.UI.nodes.wrapper.classList.remove(this.CSS.openedToolboxHolderModifier), this.Blok.UI.nodes.wrapper.removeAttribute(C.toolboxOpened), this.preToolboxBlock !== null) {
10946
+ let e = this.preToolboxBlock;
10947
+ if (this.preToolboxBlock = null, this.plusInsertedBlock !== null) {
10948
+ let t = this.plusInsertedBlock;
10949
+ this.plusInsertedBlock = null, this.Blok.BlockManager.removeBlock(t, !1).then(() => {
10950
+ e.inputs.length > 0 && this.Blok.Caret.setToBlock(e, this.Blok.Caret.positions.END);
10951
+ });
10952
+ } else e.inputs.length > 0 && this.Blok.Caret.setToBlock(e, this.Blok.Caret.positions.END);
10953
+ return;
10954
+ }
10955
+ let e = this.Blok.BlockManager.currentBlock;
10956
+ e && e.inputs.length > 0 && this.Blok.Caret.setToBlock(e, this.Blok.Caret.positions.END);
10941
10957
  }), this.toolboxInstance.on(Nd.BlockAdded, ({ block: e }) => {
10958
+ this.preToolboxBlock = null, this.plusInsertedBlock = null;
10942
10959
  let { BlockManager: t, Caret: n } = this.Blok, r = t.getBlockById(e.id);
10943
10960
  if (!r || r.inputs.length !== 0) return;
10944
10961
  if (r === t.lastBlock) {
@@ -10955,7 +10972,7 @@ var Dd = {
10955
10972
  enableModuleBindings() {
10956
10973
  let e = this.nodes.plusButton;
10957
10974
  e && this.readOnlyMutableListeners.on(e, "mousedown", (e) => {
10958
- Ee(), this.clickDragHandler.setup(e, (e) => {
10975
+ e.preventDefault(), Ee(), this.clickDragHandler.setup(e, (e) => {
10959
10976
  let t = l().win ? e.ctrlKey : e.altKey;
10960
10977
  this.plusButtonHandler.handleClick(t);
10961
10978
  });
@@ -12035,19 +12052,19 @@ var Sf = new Set([
12035
12052
  "Tab"
12036
12053
  ]), Cf = class extends yf {
12037
12054
  constructor(e) {
12038
- super(e), this.lastUndoRedoTime = 0, this.redactorElement = null, this.someToolbarOpened = e.someToolbarOpened;
12055
+ super(e), this.lastUndoRedoTime = 0, this.redactorElement = null, this.documentKeydownHandler = (e) => {
12056
+ e instanceof KeyboardEvent && this.handleKeydown(e);
12057
+ }, this.redactorBeforeinputHandler = () => {
12058
+ this.Blok.YjsManager.markCaretBeforeChange();
12059
+ }, this.redactorKeydownHandler = (e) => {
12060
+ e instanceof KeyboardEvent && Sf.has(e.key) && this.Blok.YjsManager.markCaretBeforeChange();
12061
+ }, this.someToolbarOpened = e.someToolbarOpened;
12039
12062
  }
12040
12063
  setRedactorElement(e) {
12041
12064
  this.redactorElement = e;
12042
12065
  }
12043
12066
  enable() {
12044
- this.redactorElement && (this.readOnlyMutableListeners.on(document, "keydown", (e) => {
12045
- e instanceof KeyboardEvent && this.handleKeydown(e);
12046
- }, !0), this.readOnlyMutableListeners.on(this.redactorElement, "beforeinput", () => {
12047
- this.Blok.YjsManager.markCaretBeforeChange();
12048
- }, !0), this.readOnlyMutableListeners.on(this.redactorElement, "keydown", (e) => {
12049
- e instanceof KeyboardEvent && Sf.has(e.key) && this.Blok.YjsManager.markCaretBeforeChange();
12050
- }, !0));
12067
+ this.redactorElement && (this.readOnlyMutableListeners.on(document, "keydown", this.documentKeydownHandler, !0), this.readOnlyMutableListeners.on(this.redactorElement, "beforeinput", this.redactorBeforeinputHandler, !0), this.readOnlyMutableListeners.on(this.redactorElement, "keydown", this.redactorKeydownHandler, !0));
12051
12068
  }
12052
12069
  handleKeydown(e) {
12053
12070
  var t;
@@ -12105,7 +12122,7 @@ var Sf = new Set([
12105
12122
  return;
12106
12123
  }
12107
12124
  if (this.Blok.Toolbar.toolbox.opened) {
12108
- this.Blok.Toolbar.toolbox.close(), this.Blok.BlockManager.currentBlock && this.Blok.Caret.setToBlock(this.Blok.BlockManager.currentBlock, this.Blok.Caret.positions.END);
12125
+ e.stopPropagation(), this.Blok.Toolbar.toolbox.close();
12109
12126
  return;
12110
12127
  }
12111
12128
  if (a.instance.hasOpenPopovers()) {
@@ -12125,8 +12142,8 @@ var Sf = new Set([
12125
12142
  return;
12126
12143
  }
12127
12144
  let t = e.target, n = t instanceof HTMLElement, r = this.redactorElement && n && this.redactorElement.contains(t), i = this.Blok.BlockManager.currentBlock !== void 0;
12128
- if (r && i) {
12129
- e.preventDefault(), this.Blok.Toolbar.close(), this.Blok.BlockSelection.enableNavigationMode();
12145
+ if (r && i && !this.Blok.DragManager.isDragging) {
12146
+ e.preventDefault(), e.stopPropagation(), this.Blok.Toolbar.close(), this.Blok.BlockSelection.enableNavigationMode();
12130
12147
  return;
12131
12148
  }
12132
12149
  this.Blok.Toolbar.close();