@jackuait/blok 0.10.8 → 0.10.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/blok.mjs +2 -2
  2. package/dist/chunks/{blok-ClCrnWuI.mjs → blok-5Ez9qE7T.mjs} +2454 -2057
  3. package/dist/chunks/{constants-BoE5frJm.mjs → constants-BYv7qYbw.mjs} +4 -3
  4. package/dist/chunks/{tools-HQPJLj5m.mjs → tools-CqBnZUYU.mjs} +534 -514
  5. package/dist/full.mjs +3 -3
  6. package/dist/react.mjs +2 -2
  7. package/dist/tools.mjs +2 -2
  8. package/package.json +3 -6
  9. package/src/components/block/index.ts +36 -0
  10. package/src/components/blocks.ts +191 -5
  11. package/src/components/modules/api/blocks.ts +6 -4
  12. package/src/components/modules/blockEvents/composers/keyboardNavigation.ts +17 -6
  13. package/src/components/modules/blockManager/blockManager.ts +364 -23
  14. package/src/components/modules/blockManager/hierarchy.ts +164 -8
  15. package/src/components/modules/blockManager/operations.ts +223 -26
  16. package/src/components/modules/blockManager/types.ts +13 -1
  17. package/src/components/modules/blockManager/yjs-sync.ts +48 -3
  18. package/src/components/modules/drag/DragController.ts +209 -8
  19. package/src/components/modules/drag/operations/DragOperations.ts +153 -20
  20. package/src/components/modules/paste/handlers/base.ts +48 -20
  21. package/src/components/modules/paste/handlers/blok-data-handler.ts +93 -45
  22. package/src/components/modules/paste/index.ts +20 -0
  23. package/src/components/modules/saver.ts +75 -5
  24. package/src/components/modules/toolbar/index.ts +41 -60
  25. package/src/components/modules/uiControllers/controllers/keyboard.ts +20 -0
  26. package/src/components/modules/yjs/block-observer.ts +87 -23
  27. package/src/components/modules/yjs/document-store.ts +37 -11
  28. package/src/components/modules/yjs/index.ts +83 -7
  29. package/src/components/modules/yjs/types.ts +35 -2
  30. package/src/components/modules/yjs/undo-history.ts +116 -5
  31. package/src/components/utils/data-model-transform.ts +81 -7
  32. package/src/components/utils/hierarchy-invariant.ts +137 -0
  33. package/src/styles/main.css +5 -0
  34. package/src/tools/callout/constants.ts +0 -1
  35. package/src/tools/callout/dom-builder.ts +1 -11
  36. package/src/tools/callout/index.ts +0 -6
  37. package/src/tools/header/index.ts +14 -1
  38. package/src/tools/table/index.ts +6 -3
  39. package/src/tools/table/table-cell-blocks.ts +18 -6
  40. package/src/tools/table/table-model.ts +34 -1
  41. package/src/tools/toggle/constants.ts +2 -1
  42. package/src/tools/toggle/dom-builder.ts +7 -0
  43. package/src/tools/toggle/index.ts +14 -1
  44. package/src/tools/toggle/toggle-lifecycle.ts +24 -0
@@ -1,4 +1,4 @@
1
- import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, Ct as o, D as s, Et as c, F as l, Ft as u, G as d, Gt as f, H as p, Ht as m, I as h, It as g, J as _, Jt as v, K as y, Kt as b, L as ee, Lt as x, M as te, Mt as S, Nn as ne, Nt as re, O as ie, Ot as C, P as ae, Pt as oe, Q as se, Qt as ce, R as le, Rn as w, Rt as ue, St as de, Tt as fe, U as pe, Ut as me, V as he, W as ge, Wt as _e, X as ve, Xt as ye, Y as be, Yt as xe, Z as Se, Zt as Ce, _n as we, _t as Te, a as Ee, at as De, bt as Oe, c as ke, cn as T, ct as Ae, d as je, dr as E, dt as Me, en as Ne, et as Pe, f as Fe, ft as Ie, g as Le, gt as Re, h as ze, ht as Be, i as Ve, ir as He, it as Ue, j as We, jt as Ge, k as Ke, kt as qe, l as Je, ln as Ye, lt as Xe, mn as Ze, mt as Qe, n as $e, nt as et, o as tt, ot as nt, p as rt, pn as D, pt as it, q as at, qt as ot, r as st, rn as ct, rt as lt, s as ut, sn as dt, st as ft, t as pt, tt as mt, u as O, un as ht, ur as k, ut as gt, v as _t, vn as vt, vt as yt, wt as bt, xt, z as St, zt as Ct } from "./constants-BoE5frJm.mjs";
1
+ import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, Ct as o, D as s, Et as c, F as l, Ft as u, G as d, Gt as f, H as p, Ht as m, I as h, It as g, J as _, Jt as v, K as y, Kt as b, L as ee, Lt as x, M as te, Mt as S, Nn as ne, Nt as re, O as ie, Ot as C, P as ae, Pt as oe, Q as se, Qt as ce, R as le, Rn as w, Rt as ue, St as de, Tt as fe, U as pe, Ut as me, V as he, W as ge, Wt as _e, X as ve, Xt as ye, Y as be, Yt as xe, Z as Se, Zt as Ce, _n as we, _t as Te, a as Ee, at as De, bt as Oe, c as ke, cn as T, ct as Ae, d as je, dr as E, dt as Me, en as Ne, et as Pe, f as Fe, ft as Ie, g as Le, gt as Re, h as ze, ht as Be, i as Ve, ir as He, it as Ue, j as We, jt as Ge, k as Ke, kt as qe, l as Je, ln as Ye, lt as Xe, mn as Ze, mt as Qe, n as $e, nt as et, o as tt, ot as nt, p as rt, pn as D, pt as it, q as at, qt as ot, r as st, rn as ct, rt as lt, s as ut, sn as dt, st as ft, t as pt, tt as mt, u as O, un as ht, ur as k, ut as gt, v as _t, vn as vt, vt as yt, wt as bt, xt, z as St, zt as Ct } from "./constants-BYv7qYbw.mjs";
2
2
  import { t as A } from "./objectSpread2-CWwMYL_U.mjs";
3
3
  import { n as j } from "./tw-CqxBf-1Y.mjs";
4
4
  //#region src/components/utils/html.ts
@@ -12,7 +12,7 @@ var wt = (e) => {
12
12
  t.removeChild(e);
13
13
  }
14
14
  }), t.innerHTML;
15
- }, Tt = [
15
+ }, M = [
16
16
  "empty:before:pointer-events-none",
17
17
  "empty:before:text-gray-text",
18
18
  "empty:before:cursor-text",
@@ -21,7 +21,7 @@ var wt = (e) => {
21
21
  "data-[blok-empty=true]:before:text-gray-text",
22
22
  "data-[blok-empty=true]:before:cursor-text",
23
23
  "data-[blok-empty=true]:before:content-[attr(data-placeholder)]"
24
- ], Et = [
24
+ ], Tt = [
25
25
  "empty:before:pointer-events-none",
26
26
  "empty:before:text-gray-text",
27
27
  "empty:before:cursor-text",
@@ -30,7 +30,7 @@ var wt = (e) => {
30
30
  "data-[empty=true]:before:text-gray-text",
31
31
  "data-[empty=true]:before:cursor-text",
32
32
  "data-[empty=true]:before:content-[attr(data-blok-placeholder-active)]"
33
- ], Dt = [
33
+ ], Et = [
34
34
  "empty:focus:before:pointer-events-none",
35
35
  "empty:focus:before:text-gray-text",
36
36
  "empty:focus:before:cursor-text",
@@ -39,7 +39,7 @@ var wt = (e) => {
39
39
  "[&[data-empty=true]:focus]:before:text-gray-text",
40
40
  "[&[data-empty=true]:focus]:before:cursor-text",
41
41
  "[&[data-empty=true]:focus]:before:content-[attr(data-blok-placeholder-active)]"
42
- ], Ot = [
42
+ ], Dt = [
43
43
  "empty:in-data-[blok-empty=true]:before:pointer-events-none",
44
44
  "empty:in-data-[blok-empty=true]:before:text-gray-text",
45
45
  "empty:in-data-[blok-empty=true]:before:cursor-text",
@@ -48,29 +48,29 @@ var wt = (e) => {
48
48
  "[[data-blok-empty=true]_&[data-empty=true]]:before:text-gray-text",
49
49
  "[[data-blok-empty=true]_&[data-empty=true]]:before:cursor-text",
50
50
  "[[data-blok-empty=true]_&[data-empty=true]]:before:content-[attr(data-blok-placeholder-active)]"
51
- ], kt = (e) => {
51
+ ], Ot = (e) => {
52
52
  let t = e.innerHTML.trim();
53
53
  return t === "" || t === "<br>";
54
- }, At = (e) => {
54
+ }, kt = (e) => {
55
55
  e.innerHTML === "<br>" && (e.innerHTML = "");
56
56
  let t = window.getSelection();
57
57
  if (!t) return;
58
58
  let n = document.createRange();
59
59
  n.selectNodeContents(e), n.collapse(!0), t.removeAllRanges(), t.addRange(n);
60
- }, jt = (e) => {
61
- kt(e) && At(e);
62
- }, M = (e, t, n = "data-placeholder") => {
60
+ }, At = (e) => {
61
+ Ot(e) && kt(e);
62
+ }, N = (e, t, n = "data-placeholder") => {
63
63
  e.setAttribute(n, t == null ? "" : t);
64
- let r = () => jt(e);
64
+ let r = () => At(e);
65
65
  return e.addEventListener("focus", r), () => {
66
66
  e.removeEventListener("focus", r), e.removeAttribute(n);
67
67
  };
68
- }, Mt, Nt = (e) => {
68
+ }, jt, Mt = (e) => {
69
69
  let t = document.createElement("div");
70
70
  t.innerHTML = e.trim();
71
71
  let n = document.createDocumentFragment();
72
72
  return n.append(...Array.from(t.childNodes)), n;
73
- }, Pt = class e {
73
+ }, Nt = class e {
74
74
  static get DEFAULT_PLACEHOLDER() {
75
75
  return "tools.paragraph.placeholder";
76
76
  }
@@ -89,20 +89,20 @@ var wt = (e) => {
89
89
  }
90
90
  drawView() {
91
91
  let t = document.createElement("DIV");
92
- t.className = j(this.api.styles.block, e.WRAPPER_CLASSES, Dt, Ot), t.setAttribute(k.tool, "paragraph"), t.contentEditable = "false";
92
+ t.className = j(this.api.styles.block, e.WRAPPER_CLASSES, Et, Dt), t.setAttribute(k.tool, "paragraph"), t.contentEditable = "false";
93
93
  let n = this.buildInlineStyles();
94
- return Object.keys(n).length > 0 && Object.assign(t.style, n), this._data.text ? t.innerHTML = this._data.text : this.readOnly && (t.innerHTML = "<br>"), this.readOnly || (t.contentEditable = "true", t.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = M(t, this.api.i18n.t(this._placeholder), "data-blok-placeholder-active")), t;
94
+ return Object.keys(n).length > 0 && Object.assign(t.style, n), this._data.text ? t.innerHTML = this._data.text : this.readOnly && (t.innerHTML = "<br>"), this.readOnly || (t.contentEditable = "true", t.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = N(t, this.api.i18n.t(this._placeholder), "data-blok-placeholder-active")), t;
95
95
  }
96
96
  render() {
97
97
  return this._element || (this._element = this.drawView()), this._element;
98
98
  }
99
99
  setReadOnly(e) {
100
- this._element && (this.readOnly = e, e ? (this._element.contentEditable = "false", this._element.removeEventListener("keyup", this.onKeyUp), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null), kt(this._element) && (this._element.innerHTML = "<br>")) : (this._element.contentEditable = "true", this._element.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = M(this._element, this.api.i18n.t(this._placeholder), "data-blok-placeholder-active"), this._element.innerHTML === "<br>" && (this._element.innerHTML = "")));
100
+ this._element && (this.readOnly = e, e ? (this._element.contentEditable = "false", this._element.removeEventListener("keyup", this.onKeyUp), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null), Ot(this._element) && (this._element.innerHTML = "<br>")) : (this._element.contentEditable = "true", this._element.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = N(this._element, this.api.i18n.t(this._placeholder), "data-blok-placeholder-active"), this._element.innerHTML === "<br>" && (this._element.innerHTML = "")));
101
101
  }
102
102
  merge(e) {
103
103
  if (!this._element) return;
104
104
  this._data.text += e.text;
105
- let t = Nt(e.text);
105
+ let t = Mt(e.text);
106
106
  this._element.appendChild(t), this._element.normalize();
107
107
  }
108
108
  validate(e) {
@@ -153,7 +153,7 @@ var wt = (e) => {
153
153
  };
154
154
  }
155
155
  };
156
- Mt = Pt, Mt.WRAPPER_CLASSES = [
156
+ jt = Nt, jt.WRAPPER_CLASSES = [
157
157
  "leading-[1.5]",
158
158
  "outline-hidden",
159
159
  "mt-px",
@@ -163,14 +163,14 @@ Mt = Pt, Mt.WRAPPER_CLASSES = [
163
163
  ];
164
164
  //#endregion
165
165
  //#region src/tools/toggle/dom-builder.ts
166
- var Ft = (e) => {
166
+ var Pt = (e) => {
167
167
  let { data: t, readOnly: n, isOpen: r, keydownHandler: i, onArrowClick: a, onBodyPlaceholderClick: o } = e, s = document.createElement("div");
168
- s.className = Ee, s.setAttribute(k.tool, rt), s.setAttribute(O.toggleOpen, String(r));
168
+ s.className = Ee, s.setAttribute(k.tool, rt), s.setAttribute(O.toggleOpen, String(r)), s.setAttribute(O.toggleEmpty, "true");
169
169
  let c = document.createElement("div");
170
170
  c.className = Fe;
171
- let l = It(r, a, {}, e.ariaLabels), u = Rt(t, n, i);
171
+ let l = Ft(r, a, {}, e.ariaLabels), u = Lt(t, n, i);
172
172
  c.appendChild(l), c.appendChild(u);
173
- let d = Lt(o, e.bodyPlaceholderText), f = document.createElement("div");
173
+ let d = It(o, e.bodyPlaceholderText), f = document.createElement("div");
174
174
  return f.className = je, f.setAttribute(O.toggleChildren, ""), f.setAttribute(k.nestedBlocks, ""), f.setAttribute("data-blok-mutation-free", "true"), f.id = `toggle-children-${Date.now()}-${Math.random().toString(36).slice(2)}`, l.setAttribute("aria-controls", f.id), s.appendChild(c), s.appendChild(d), s.appendChild(f), {
175
175
  wrapper: s,
176
176
  arrowElement: l,
@@ -178,7 +178,7 @@ var Ft = (e) => {
178
178
  bodyPlaceholderElement: d,
179
179
  childContainerElement: f
180
180
  };
181
- }, It = (e, t, n = {}, r = {
181
+ }, Ft = (e, t, n = {}, r = {
182
182
  collapse: "Collapse",
183
183
  expand: "Expand"
184
184
  }) => {
@@ -190,17 +190,22 @@ var Ft = (e) => {
190
190
  }), i.addEventListener("keydown", (e) => {
191
191
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), t());
192
192
  })), i;
193
- }, Lt = (e, t) => {
193
+ }, It = (e, t) => {
194
194
  let n = document.createElement("div");
195
195
  return n.className = ut, n.setAttribute(O.toggleBodyPlaceholder, ""), n.setAttribute("data-blok-mutation-free", "true"), n.textContent = t, e && n.addEventListener("click", e), n;
196
- }, Rt = (e, t, n) => {
196
+ }, Lt = (e, t, n) => {
197
197
  let r = document.createElement("div");
198
- return r.className = j(ke, Et, Ot), r.setAttribute(O.toggleContent, ""), r.contentEditable = t ? "false" : "true", r.innerHTML = e.text, n && r.addEventListener("keydown", n), r;
199
- }, zt = (e, t) => {
198
+ return r.className = j(ke, Tt, Dt), r.setAttribute(O.toggleContent, ""), r.contentEditable = t ? "false" : "true", r.innerHTML = e.text, n && r.addEventListener("keydown", n), r;
199
+ }, Rt = (e, t) => {
200
200
  for (let n of t) n.holder.parentElement !== e && (n.holder.closest(`[${k.nestedBlocks}]`) || e.appendChild(n.holder));
201
+ }, zt = (e, t) => {
202
+ var n;
203
+ if (e === null) return;
204
+ let r = ((n = t == null ? void 0 : t.textContent) == null ? "" : n).trim() === "";
205
+ e.setAttribute(O.toggleEmpty, String(r));
201
206
  }, Bt = (e) => {
202
- let t = Ft(e);
203
- return t.contentElement && M(t.contentElement, e.placeholder, "data-blok-placeholder-active"), t;
207
+ let t = Pt(e);
208
+ return t.contentElement && N(t.contentElement, e.placeholder, "data-blok-placeholder-active"), t;
204
209
  }, Vt = (e, t, n, r = {
205
210
  collapse: "Collapse",
206
211
  expand: "Expand"
@@ -209,7 +214,7 @@ var Ft = (e) => {
209
214
  i && (i.style.transform = n ? "rotate(90deg)" : ""), e.setAttribute("aria-label", n ? r.collapse : r.expand), e.setAttribute("aria-expanded", String(n)), t.setAttribute(O.toggleOpen, String(n));
210
215
  }, Ht = (e, t, n, r, i) => {
211
216
  let a = e.blocks.getChildren(t);
212
- !n && r && i && r.contains(document.activeElement) && i.focus(), r && zt(r, a);
217
+ !n && r && i && r.contains(document.activeElement) && i.focus(), r && Rt(r, a);
213
218
  for (let e of a) n ? e.holder.classList.remove("hidden") : e.holder.classList.add("hidden");
214
219
  r && (n ? r.removeAttribute("aria-hidden") : r.setAttribute("aria-hidden", "true"));
215
220
  }, Ut = (e, t, n, r, i) => {
@@ -296,7 +301,9 @@ var Ft = (e) => {
296
301
  }, Xt, Zt = class e {
297
302
  constructor({ data: e, config: t, api: n, readOnly: r, block: i }) {
298
303
  var a;
299
- this.placeholderCleanup = null, this._arrowElement = null, this._wrapper = null, this._headerRow = null, this._childContainerElement = null, this._bodyPlaceholderElement = null, this.handleKeyDown = (e) => {
304
+ this.placeholderCleanup = null, this._arrowElement = null, this._wrapper = null, this._headerRow = null, this._childContainerElement = null, this._bodyPlaceholderElement = null, this.handleChildContainerInput = () => {
305
+ zt(this._wrapper, this._childContainerElement);
306
+ }, this.handleKeyDown = (e) => {
300
307
  if (e.key === "Enter" && !e.shiftKey) {
301
308
  e.preventDefault(), this.handleEnter();
302
309
  return;
@@ -346,7 +353,7 @@ var Ft = (e) => {
346
353
  else {
347
354
  this._element.contentEditable = "true", this._data.isToggleable && this._element.addEventListener("keydown", this.handleKeyDown);
348
355
  let e = this.api.i18n.t(this.currentLevel.nameKey), t = this.resolvePlaceholderText(e);
349
- this.placeholderCleanup = M(this._element, t);
356
+ this.placeholderCleanup = N(this._element, t);
350
357
  }
351
358
  }
352
359
  expand() {
@@ -430,13 +437,13 @@ var Ft = (e) => {
430
437
  e.innerHTML = this._element.innerHTML, this._element.parentNode.replaceChild(e, this._element), this._element = e;
431
438
  }
432
439
  if (t.text !== void 0 && (this._element.innerHTML = this._data.text || ""), this._data.isToggleable) {
433
- if (this._element.setAttribute(O.toggleOpen, String(this._isOpen)), this._element.className = j(e.BASE_STYLES, this.currentLevel.styles, Tt, "pl-8"), !this._wrapper) this.createToggleWrapper();
440
+ if (this._element.setAttribute(O.toggleOpen, String(this._isOpen)), this._element.className = j(e.BASE_STYLES, this.currentLevel.styles, M, "pl-8"), !this._wrapper) this.createToggleWrapper();
434
441
  else if (!this._wrapper.querySelector(`[${O.toggleArrow}]`)) {
435
442
  var n;
436
443
  let e = this.buildArrow();
437
444
  this._arrowElement = e, ((n = this._headerRow) == null ? this._wrapper : n).prepend(e);
438
445
  }
439
- } else if (this._element.removeAttribute(O.toggleOpen), this._element.className = j(e.BASE_STYLES, this.currentLevel.styles, Tt), this._arrowElement = null, this._wrapper) {
446
+ } else if (this._element.removeAttribute(O.toggleOpen), this._element.className = j(e.BASE_STYLES, this.currentLevel.styles, M), this._arrowElement = null, this._wrapper) {
440
447
  let e = this._wrapper.parentNode;
441
448
  e && e.replaceChild(this._element, this._wrapper), this._wrapper = null, this._headerRow = null;
442
449
  }
@@ -446,32 +453,34 @@ var Ft = (e) => {
446
453
  }
447
454
  getTag() {
448
455
  let t = document.createElement(this.currentLevel.tag);
449
- t.innerHTML = this._data.text || "", t.className = j(e.BASE_STYLES, this.currentLevel.styles, Tt, this._data.isToggleable ? "pl-8" : "");
456
+ t.innerHTML = this._data.text || "", t.className = j(e.BASE_STYLES, this.currentLevel.styles, M, this._data.isToggleable ? "pl-8" : "");
450
457
  let { inlineStyles: n } = this.currentLevel;
451
458
  n && Object.assign(t.style, n), t.setAttribute(k.tool, "header"), t.contentEditable = this.readOnly ? "false" : "true", this._data.isToggleable && t.setAttribute(O.toggleOpen, String(this._isOpen));
452
459
  let r = this.api.i18n.t(this.currentLevel.nameKey), i = this.resolvePlaceholderText(r);
453
- return this.readOnly ? t.setAttribute("data-placeholder", i) : this.placeholderCleanup = M(t, i), !this.readOnly && this._data.isToggleable && t.addEventListener("keydown", this.handleKeyDown), t;
460
+ return this.readOnly ? t.setAttribute("data-placeholder", i) : this.placeholderCleanup = N(t, i), !this.readOnly && this._data.isToggleable && t.addEventListener("keydown", this.handleKeyDown), t;
454
461
  }
455
462
  buildArrow() {
456
- let e = It(this._isOpen, () => this.toggleOpen(), {}, {
463
+ let e = Ft(this._isOpen, () => this.toggleOpen(), {}, {
457
464
  collapse: this.api.i18n.t("tools.toggle.ariaLabelCollapse"),
458
465
  expand: this.api.i18n.t("tools.toggle.ariaLabelExpand")
459
466
  });
460
467
  return e.classList.add("absolute", "left-0", "top-1/2", "-translate-y-1/2"), e;
461
468
  }
462
469
  buildWrapper() {
463
- let e = document.createElement("div"), t = document.createElement("div");
470
+ let e = document.createElement("div");
471
+ e.setAttribute(O.toggleEmpty, "true");
472
+ let t = document.createElement("div");
464
473
  t.className = "relative", this._headerRow = t;
465
474
  let n = this.buildArrow();
466
475
  this._arrowElement = n, t.appendChild(n), t.appendChild(this._element), e.appendChild(t);
467
476
  let r = document.createElement("div");
468
477
  r.className = j(ut, "pl-8"), r.setAttribute(O.toggleBodyPlaceholder, ""), r.setAttribute("data-blok-mutation-free", "true"), r.textContent = this.api.i18n.t("tools.toggle.bodyPlaceholder"), this.readOnly || r.addEventListener("click", () => this.handleBodyPlaceholderClick()), this._bodyPlaceholderElement = r, e.appendChild(r);
469
478
  let i = document.createElement("div");
470
- return i.className = "pl-8", i.setAttribute(O.toggleChildren, ""), i.setAttribute(k.nestedBlocks, ""), i.setAttribute("data-blok-mutation-free", "true"), this._childContainerElement = i, e.appendChild(i), e;
479
+ return i.className = "pl-8", i.setAttribute(O.toggleChildren, ""), i.setAttribute(k.nestedBlocks, ""), i.setAttribute("data-blok-mutation-free", "true"), i.addEventListener("input", this.handleChildContainerInput), this._childContainerElement = i, e.appendChild(i), e;
471
480
  }
472
481
  createToggleWrapper() {
473
482
  let e = this._element.parentNode;
474
- this._wrapper = document.createElement("div");
483
+ this._wrapper = document.createElement("div"), this._wrapper.setAttribute(O.toggleEmpty, "true");
475
484
  let t = document.createElement("div");
476
485
  t.className = "relative", this._headerRow = t;
477
486
  let n = this.buildArrow();
@@ -504,7 +513,7 @@ var Ft = (e) => {
504
513
  this.blockId !== void 0 && Ht(this.api, this.blockId, this._isOpen, this._childContainerElement, this._arrowElement);
505
514
  }
506
515
  updateBodyPlaceholderVisibility() {
507
- this.blockId !== void 0 && Ut(this._bodyPlaceholderElement, this.api, this.blockId, this._isOpen, this.readOnly);
516
+ this.blockId !== void 0 && (Ut(this._bodyPlaceholderElement, this.api, this.blockId, this._isOpen, this.readOnly), zt(this._wrapper, this._childContainerElement));
508
517
  }
509
518
  handleBodyPlaceholderClick() {
510
519
  var e;
@@ -695,7 +704,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
695
704
  }, ln = (e) => {
696
705
  var t;
697
706
  let { data: n, itemColor: r, itemSize: i, placeholder: a, markerDepth: o } = e, s = document.createElement("div");
698
- s.setAttribute("role", "listitem"), s.className = j($t, "flex", ...Tt), r && (s.style.color = r), i && (s.style.fontSize = i);
707
+ s.setAttribute("role", "listitem"), s.className = j($t, "flex", ...M), r && (s.style.color = r), i && (s.style.fontSize = i);
699
708
  let c = (t = n.depth) == null ? 0 : t;
700
709
  if (c > 0) {
701
710
  let e = n.style === "ordered" ? 26 : 27;
@@ -704,7 +713,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
704
713
  let l = dn(n.style, o == null ? c : o);
705
714
  l.setAttribute("data-list-marker", "true"), l.setAttribute("data-blok-mutation-free", "true"), s.appendChild(l);
706
715
  let u = document.createElement("div");
707
- return u.className = j("flex-1 min-w-0 outline-hidden", ...Tt), u.setAttribute("data-blok-testid", an.contentContainer), u.contentEditable = e.readOnly ? "false" : "true", u.innerHTML = n.text, on(u, a), s.appendChild(u), s;
716
+ return u.className = j("flex-1 min-w-0 outline-hidden", ...M), u.setAttribute("data-blok-testid", an.contentContainer), u.contentEditable = e.readOnly ? "false" : "true", u.innerHTML = n.text, on(u, a), s.appendChild(u), s;
708
717
  }, un = (e) => {
709
718
  var t;
710
719
  let { data: n, itemColor: r, itemSize: i, placeholder: a, readOnly: o } = e, s = document.createElement("div");
@@ -714,7 +723,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
714
723
  let l = document.createElement("input");
715
724
  l.type = "checkbox", l.className = tn, l.checked = !!n.checked, l.disabled = o;
716
725
  let u = document.createElement("div");
717
- return u.className = j("flex-1 outline-hidden leading-[1.5]", n.checked ? "line-through opacity-60" : "", ...Tt), u.setAttribute("data-blok-testid", an.checklistContent), u.setAttribute("data-checked", String(n.checked)), u.contentEditable = o ? "false" : "true", u.innerHTML = n.text, on(u, a), s.appendChild(l), s.appendChild(u), s;
726
+ return u.className = j("flex-1 outline-hidden leading-[1.5]", n.checked ? "line-through opacity-60" : "", ...M), u.setAttribute("data-blok-testid", an.checklistContent), u.setAttribute("data-checked", String(n.checked)), u.contentEditable = o ? "false" : "true", u.innerHTML = n.text, on(u, a), s.appendChild(l), s.appendChild(u), s;
718
727
  }, dn = (e, t) => {
719
728
  let n = document.createElement("span");
720
729
  return n.className = "shrink-0 select-none", n.setAttribute("aria-hidden", "true"), n.contentEditable = "false", e === "ordered" ? (n.textContent = "1.", n.className = j(n.className, "text-right"), n.style.paddingRight = "11px", n.style.minWidth = "fit-content") : (n.textContent = fn(t), n.className = j(n.className, "w-6 text-center flex justify-center"), n.style.paddingLeft = "1px", n.style.paddingRight = "13px", n.style.fontSize = "24px", n.style.fontFamily = "Arial", n.style.lineHeight = "1.5rem"), n;
@@ -1421,7 +1430,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
1421
1430
  return this.api.i18n.t(nn);
1422
1431
  }
1423
1432
  setupItemPlaceholder(e) {
1424
- this.readOnly || (this.placeholderCleanup = M(e, this.placeholder));
1433
+ this.readOnly || (this.placeholderCleanup = N(e, this.placeholder));
1425
1434
  }
1426
1435
  render() {
1427
1436
  var e, t;
@@ -1447,7 +1456,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
1447
1456
  let t = this.getContentElement();
1448
1457
  t && (t.contentEditable = e ? "false" : "true");
1449
1458
  let n = this._element.querySelector("input[type=\"checkbox\"]");
1450
- n && (n.disabled = e), e ? (this.boundHandleKeyDown && this._element.removeEventListener("keydown", this.boundHandleKeyDown), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null)) : (this.boundHandleKeyDown && this._element.addEventListener("keydown", this.boundHandleKeyDown), t && (this.placeholderCleanup = M(t, this.placeholder)));
1459
+ n && (n.disabled = e), e ? (this.boundHandleKeyDown && this._element.removeEventListener("keydown", this.boundHandleKeyDown), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null)) : (this.boundHandleKeyDown && this._element.addEventListener("keydown", this.boundHandleKeyDown), t && (this.placeholderCleanup = N(t, this.placeholder)));
1451
1460
  }
1452
1461
  rendered() {
1453
1462
  this.updateMarkersAfterPositionChange();
@@ -1845,7 +1854,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
1845
1854
  let t = e.querySelector("svg");
1846
1855
  t && (t.setAttribute("width", Tr), t.setAttribute("height", Tr), t.setAttribute("viewBox", "0 0 24 24"), t.classList.add("text-gray-500", "pointer-events-none"));
1847
1856
  }
1848
- }, N = "data-blok-table-row", P = "data-blok-table-cell", F = "data-blok-table-cell-row", I = "data-blok-table-cell-col", Dr = "1px solid var(--blok-table-border)", Or = [
1857
+ }, P = "data-blok-table-row", F = "data-blok-table-cell", I = "data-blok-table-cell-row", L = "data-blok-table-cell-col", Dr = "1px solid var(--blok-table-border)", Or = [
1849
1858
  "py-1",
1850
1859
  "px-2",
1851
1860
  "min-h-[2em]",
@@ -1882,7 +1891,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
1882
1891
  let i = document.createElement("tbody");
1883
1892
  return Array.from({ length: e.rows }).forEach((t, n) => {
1884
1893
  let r = document.createElement("tr");
1885
- r.setAttribute(N, ""), Array.from({ length: e.cols }).forEach((t, i) => {
1894
+ r.setAttribute(P, ""), Array.from({ length: e.cols }).forEach((t, i) => {
1886
1895
  if (e.isSpannedCell(n, i)) return;
1887
1896
  let a = this.createCell(n, i), o = e.getCellSpan(n, i);
1888
1897
  o.colspan > 1 && (a.colSpan = o.colspan), o.rowspan > 1 && (a.rowSpan = o.rowspan), r.appendChild(a);
@@ -1891,11 +1900,11 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
1891
1900
  }
1892
1901
  addRow(e, t) {
1893
1902
  var n;
1894
- let r = this.getColumnCount(e), i = this.createRow(r), a = (n = e.querySelector("tbody")) == null ? e : n, o = a.querySelectorAll(`[${N}]`);
1903
+ let r = this.getColumnCount(e), i = this.createRow(r), a = (n = e.querySelector("tbody")) == null ? e : n, o = a.querySelectorAll(`[${P}]`);
1895
1904
  return t !== void 0 && t < o.length ? a.insertBefore(i, o[t]) : a.appendChild(i), this.reindexCoordinates(e), i;
1896
1905
  }
1897
1906
  deleteRow(e, t) {
1898
- let n = e.querySelectorAll(`[${N}]`);
1907
+ let n = e.querySelectorAll(`[${P}]`);
1899
1908
  t < n.length && n[t].remove(), this.reindexCoordinates(e);
1900
1909
  }
1901
1910
  addColumn(e, t, n, r) {
@@ -1933,8 +1942,8 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
1933
1942
  let i = r.querySelectorAll("col");
1934
1943
  t === void 0 || t >= i.length ? r.appendChild(e) : r.insertBefore(e, i[t]);
1935
1944
  }
1936
- e.querySelectorAll(`[${N}]`).forEach((e) => {
1937
- let n = e.querySelectorAll(`[${P}]`), r = t === void 0 || t >= n.length, i = this.createCell();
1945
+ e.querySelectorAll(`[${P}]`).forEach((e) => {
1946
+ let n = e.querySelectorAll(`[${F}]`), r = t === void 0 || t >= n.length, i = this.createCell();
1938
1947
  r ? e.appendChild(i) : e.insertBefore(i, n[t]);
1939
1948
  });
1940
1949
  }
@@ -1944,39 +1953,39 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
1944
1953
  let e = n.querySelectorAll("col");
1945
1954
  t < e.length && e[t].remove();
1946
1955
  }
1947
- e.querySelectorAll(`[${N}]`).forEach((e) => {
1948
- let n = e.querySelectorAll(`[${P}]`);
1956
+ e.querySelectorAll(`[${P}]`).forEach((e) => {
1957
+ let n = e.querySelectorAll(`[${F}]`);
1949
1958
  t >= n.length || n[t].remove();
1950
1959
  }), this.reindexCoordinates(e);
1951
1960
  }
1952
1961
  moveRow(e, t, n) {
1953
1962
  var r;
1954
1963
  if (t === n) return;
1955
- let i = (r = e.querySelector("tbody")) == null ? e : r, a = Array.from(i.querySelectorAll(`[${N}]`));
1964
+ let i = (r = e.querySelector("tbody")) == null ? e : r, a = Array.from(i.querySelectorAll(`[${P}]`));
1956
1965
  if (t >= a.length || n >= a.length) return;
1957
1966
  let o = a[t];
1958
1967
  o.remove();
1959
- let s = Array.from(i.querySelectorAll(`[${N}]`));
1968
+ let s = Array.from(i.querySelectorAll(`[${P}]`));
1960
1969
  n >= s.length ? i.appendChild(o) : i.insertBefore(o, s[n]), this.reindexCoordinates(e);
1961
1970
  }
1962
1971
  moveColumn(e, t, n) {
1963
- t !== n && (this.reorderColElement(e, t, n), e.querySelectorAll(`[${N}]`).forEach((e) => {
1964
- let r = Array.from(e.querySelectorAll(`[${P}]`));
1972
+ t !== n && (this.reorderColElement(e, t, n), e.querySelectorAll(`[${P}]`).forEach((e) => {
1973
+ let r = Array.from(e.querySelectorAll(`[${F}]`));
1965
1974
  if (t >= r.length || n >= r.length) return;
1966
1975
  let i = r[t];
1967
1976
  i.remove();
1968
- let a = Array.from(e.querySelectorAll(`[${P}]`));
1977
+ let a = Array.from(e.querySelectorAll(`[${F}]`));
1969
1978
  n >= a.length ? e.appendChild(i) : e.insertBefore(i, a[n]);
1970
1979
  }), this.reindexCoordinates(e));
1971
1980
  }
1972
1981
  reindexCoordinates(e) {
1973
- let t = Array.from(e.querySelectorAll(`[${N}]`)), n = /* @__PURE__ */ new Map();
1982
+ let t = Array.from(e.querySelectorAll(`[${P}]`)), n = /* @__PURE__ */ new Map();
1974
1983
  t.forEach((e, t) => {
1975
1984
  var r;
1976
- let i = Array.from(e.querySelectorAll(`[${P}]`)), a = (r = n.get(t)) == null ? /* @__PURE__ */ new Set() : r;
1985
+ let i = Array.from(e.querySelectorAll(`[${F}]`)), a = (r = n.get(t)) == null ? /* @__PURE__ */ new Set() : r;
1977
1986
  i.reduce((e, r) => {
1978
1987
  let i = r, o = (e) => a.has(e) ? o(e + 1) : e, s = o(e);
1979
- r.setAttribute(F, String(t)), r.setAttribute(I, String(s));
1988
+ r.setAttribute(I, String(t)), r.setAttribute(L, String(s));
1980
1989
  let c = i.colSpan || 1, l = i.rowSpan || 1;
1981
1990
  return l > 1 && this.blockRowspanCols(n, t, s, l, c), s + c;
1982
1991
  }, 0), n.delete(t);
@@ -1993,20 +2002,20 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
1993
2002
  });
1994
2003
  }
1995
2004
  getRowCount(e) {
1996
- return e.querySelectorAll(`[${N}]`).length;
2005
+ return e.querySelectorAll(`[${P}]`).length;
1997
2006
  }
1998
2007
  getColumnCount(e) {
1999
2008
  let t = e.querySelector("colgroup");
2000
2009
  if (t) return t.querySelectorAll("col").length;
2001
- let n = e.querySelector(`[${N}]`);
2002
- return n ? n.querySelectorAll(`[${P}]`).length : 0;
2010
+ let n = e.querySelector(`[${P}]`);
2011
+ return n ? n.querySelectorAll(`[${F}]`).length : 0;
2003
2012
  }
2004
2013
  getCell(e, t, n) {
2005
- let r = e.querySelector(`[${F}="${t}"][${I}="${n}"]`);
2014
+ let r = e.querySelector(`[${I}="${t}"][${L}="${n}"]`);
2006
2015
  if (r) return r;
2007
- let i = e.querySelectorAll(`[${N}]`);
2016
+ let i = e.querySelectorAll(`[${P}]`);
2008
2017
  if (t >= i.length) return null;
2009
- let a = i[t].querySelectorAll(`[${P}]`);
2018
+ let a = i[t].querySelectorAll(`[${F}]`);
2010
2019
  return n >= a.length ? null : a[n];
2011
2020
  }
2012
2021
  getColWidths(e) {
@@ -2051,17 +2060,17 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2051
2060
  }
2052
2061
  createRow(e, t) {
2053
2062
  let n = document.createElement("tr");
2054
- return n.setAttribute(N, ""), Array.from({ length: e }).forEach((e, r) => {
2063
+ return n.setAttribute(P, ""), Array.from({ length: e }).forEach((e, r) => {
2055
2064
  n.appendChild(this.createCell(t, t === void 0 ? void 0 : r));
2056
2065
  }), n;
2057
2066
  }
2058
2067
  createCell(e, t) {
2059
2068
  let n = document.createElement("td");
2060
- n.className = j(Or), n.style.borderRight = Dr, n.style.borderBottom = Dr, n.style.overflow = "hidden", n.style.overflowWrap = "break-word", n.style.height = "0", n.setAttribute(P, ""), e !== void 0 && t !== void 0 && (n.setAttribute(F, String(e)), n.setAttribute(I, String(t)));
2069
+ n.className = j(Or), n.style.borderRight = Dr, n.style.borderBottom = Dr, n.style.overflow = "hidden", n.style.overflowWrap = "break-word", n.style.height = "0", n.setAttribute(F, ""), e !== void 0 && t !== void 0 && (n.setAttribute(I, String(e)), n.setAttribute(L, String(t)));
2061
2070
  let r = document.createElement("div");
2062
- return r.setAttribute(R, ""), r.setAttribute(k.nestedBlocks, ""), r.style.display = "flex", r.style.flexDirection = "column", r.style.minHeight = "100%", n.appendChild(r), n;
2071
+ return r.setAttribute(z, ""), r.setAttribute(k.nestedBlocks, ""), r.style.display = "flex", r.style.flexDirection = "column", r.style.minHeight = "100%", n.appendChild(r), n;
2063
2072
  }
2064
- }, L = (e) => typeof e == "object" && !!e && "blocks" in e, R = "data-blok-table-cell-blocks", jr = class {
2073
+ }, R = (e) => typeof e == "object" && !!e && "blocks" in e, z = "data-blok-table-cell-blocks", jr = class {
2065
2074
  constructor(e) {
2066
2075
  var t;
2067
2076
  this._activeCellWithBlocks = null, this.cellsPendingCheck = /* @__PURE__ */ new Set(), this.pendingCheckScheduled = !1, this.removedBlockCells = /* @__PURE__ */ new Map(), this.deferredEvents = [], this.isExitingTable = !1, this.handleBlockMutation = (e) => {
@@ -2087,9 +2096,9 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2087
2096
  this.claimBlockForCell(i.cell, n.target.id), this.syncBlockToModel(i.cell, n.target.id), this.cellsPendingCheck.delete(i.cell);
2088
2097
  return;
2089
2098
  }
2090
- let a = n.target.holder, o = a.closest(`[${R}]`);
2099
+ let a = n.target.holder, o = a.closest(`[${z}]`);
2091
2100
  o && this.stripPlaceholders(o);
2092
- let s = o && !this.model.findCellForBlock(n.target.id) ? o.closest(`[${P}]`) : null;
2101
+ let s = o && !this.model.findCellForBlock(n.target.id) ? o.closest(`[${F}]`) : null;
2093
2102
  if (s && this.syncBlockToModel(s, n.target.id), o) return;
2094
2103
  if (!this.gridElement.contains(a)) {
2095
2104
  let e = this.api.blocks.getBlockIndex(this.tableBlockId), t = e === void 0 ? null : this.api.blocks.getBlockByIndex(e);
@@ -2105,11 +2114,11 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2105
2114
  }, this.handleCellBlankSpaceClick = (e) => {
2106
2115
  let t = e.target;
2107
2116
  if (!t) return;
2108
- let n = t.hasAttribute(P), r = t.hasAttribute(R);
2117
+ let n = t.hasAttribute(F), r = t.hasAttribute(z);
2109
2118
  if (!n && !r) return;
2110
- let i = n ? t : t.closest(`[${P}]`);
2119
+ let i = n ? t : t.closest(`[${F}]`);
2111
2120
  if (!i) return;
2112
- let a = n ? i.querySelector(`[${R}]`) : t;
2121
+ let a = n ? i.querySelector(`[${z}]`) : t;
2113
2122
  if (!a) return;
2114
2123
  let o = a.querySelectorAll("[data-blok-id]"), s = o[o.length - 1];
2115
2124
  if (!s) return;
@@ -2207,7 +2216,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2207
2216
  this.clearActiveCellWithBlocks();
2208
2217
  let r = this.getCell(e.row, e.col);
2209
2218
  if (!r) return;
2210
- let i = r.querySelector(`[${R}]`);
2219
+ let i = r.querySelector(`[${z}]`);
2211
2220
  if (!i) return;
2212
2221
  let a = i.querySelectorAll("[contenteditable=\"true\"]");
2213
2222
  a.length !== 0 && ((t ? a[a.length - 1] : a[0]).focus(), (n = this.onNavigateToCell) == null || n.call(this, e));
@@ -2228,21 +2237,21 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2228
2237
  return r ? (n = r.querySelector(`[data-blok-table-cell-col="${t}"]`)) == null ? null : n : null;
2229
2238
  }
2230
2239
  initializeCells(e) {
2231
- let t = this.gridElement.querySelectorAll(`[${N}]`), n = [];
2240
+ let t = this.gridElement.querySelectorAll(`[${P}]`), n = [];
2232
2241
  return e.forEach((e, r) => {
2233
2242
  let i = t[r];
2234
2243
  if (!i) return;
2235
2244
  let a = [];
2236
2245
  e.forEach((e, t) => {
2237
- let n = i.querySelector(`[${I}="${t}"]`);
2246
+ let n = i.querySelector(`[${L}="${t}"]`);
2238
2247
  if (!n) return;
2239
- let r = n.querySelector(`[${R}]`);
2248
+ let r = n.querySelector(`[${z}]`);
2240
2249
  if (!r) return;
2241
- let o = L(e) && e.blocks.length > 0 ? [...e.blocks] : null, { mountedIds: s, replacements: c } = o ? this.mountBlocksInCell(r, o) : {
2250
+ let o = R(e) && e.blocks.length > 0 ? [...e.blocks] : null, { mountedIds: s, replacements: c } = o ? this.mountBlocksInCell(r, o) : {
2242
2251
  mountedIds: [],
2243
2252
  replacements: /* @__PURE__ */ new Map()
2244
2253
  }, l = {};
2245
- if (L(e) && (e.color !== void 0 && (l.color = e.color), e.textColor !== void 0 && (l.textColor = e.textColor)), s.length > 0) {
2254
+ if (R(e) && (e.color !== void 0 && (l.color = e.color), e.textColor !== void 0 && (l.textColor = e.textColor)), s.length > 0) {
2246
2255
  let e = o == null ? s : o, t = c.size > 0 ? e.map((e) => {
2247
2256
  var t;
2248
2257
  return (t = c.get(e)) == null ? e : t;
@@ -2274,14 +2283,14 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2274
2283
  let t = this.api.blocks.getBlockIndex(i);
2275
2284
  if (t === void 0) continue;
2276
2285
  let a = this.api.blocks.getBlockByIndex(t);
2277
- if (a) {
2278
- if (a.holder.closest(`[${k.nestedBlocks}]`)) {
2279
- let t = this.api.blocks.insert(a.name, a.preservedData, {}, this.api.blocks.getBlocksCount(), !1);
2280
- e.appendChild(t.holder), this.api.blocks.setBlockParent(t.id, this.tableBlockId), n.push(t.id), r.set(i, t.id);
2281
- continue;
2282
- }
2283
- e.appendChild(a.holder), this.api.blocks.setBlockParent(i, this.tableBlockId), n.push(i);
2286
+ if (!a) continue;
2287
+ let o = a.parentId != null && a.parentId !== "" && a.parentId !== this.tableBlockId;
2288
+ if (a.holder.closest(`[${k.nestedBlocks}]`) || o) {
2289
+ let t = this.api.blocks.insert(a.name, a.preservedData, {}, this.api.blocks.getBlocksCount(), !1);
2290
+ e.appendChild(t.holder), this.api.blocks.setBlockParent(t.id, this.tableBlockId), n.push(t.id), r.set(i, t.id);
2291
+ continue;
2284
2292
  }
2293
+ e.appendChild(a.holder), this.api.blocks.setBlockParent(i, this.tableBlockId), n.push(i);
2285
2294
  }
2286
2295
  return {
2287
2296
  mountedIds: n,
@@ -2290,26 +2299,28 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2290
2299
  }
2291
2300
  claimBlockForCell(e, t) {
2292
2301
  var n, r;
2293
- let i = e.querySelector(`[${R}]`);
2302
+ let i = e.querySelector(`[${z}]`);
2294
2303
  if (!i) return;
2295
2304
  let a = this.api.blocks.getBlockIndex(t);
2296
2305
  if (a === void 0) return;
2297
2306
  let o = this.api.blocks.getBlockByIndex(a);
2298
- if (!o || o.holder.contains(i) || o.holder.closest(`[${k.nestedBlocks}]`)) return;
2299
- let s = this.api.blocks.getBlocksCount(), c = (n = (r = Array.from({ length: s - a - 1 }, (e, t) => this.api.blocks.getBlockByIndex(a + 1 + t)).find((e) => (e == null ? void 0 : e.holder.parentElement) === i)) == null ? void 0 : r.holder) == null ? null : n;
2300
- i.insertBefore(o.holder, c), this.api.blocks.setBlockParent(t, this.tableBlockId), this.stripPlaceholders(i);
2307
+ if (!o || o.holder.contains(i)) return;
2308
+ let s = o.parentId != null && o.parentId !== "" && o.parentId !== this.tableBlockId;
2309
+ if (o.holder.closest(`[${k.nestedBlocks}]`) || s) return;
2310
+ let c = this.api.blocks.getBlocksCount(), l = (n = (r = Array.from({ length: c - a - 1 }, (e, t) => this.api.blocks.getBlockByIndex(a + 1 + t)).find((e) => (e == null ? void 0 : e.holder.parentElement) === i)) == null ? void 0 : r.holder) == null ? null : n;
2311
+ i.insertBefore(o.holder, l), this.api.blocks.setBlockParent(t, this.tableBlockId), this.stripPlaceholders(i);
2301
2312
  }
2302
2313
  findCellForNewBlock(e) {
2303
2314
  return this.findCellForAdjacentBlock(e - 1) || this.findCellForAdjacentBlock(e + 1);
2304
2315
  }
2305
2316
  findCellForAdjacentBlock(e) {
2306
2317
  if (e < 0 || e >= this.api.blocks.getBlocksCount()) return null;
2307
- let t = this.api.blocks.getBlockByIndex(e), n = t == null ? void 0 : t.holder.closest(`[${P}]`);
2318
+ let t = this.api.blocks.getBlockByIndex(e), n = t == null ? void 0 : t.holder.closest(`[${F}]`);
2308
2319
  return n && this.gridElement.contains(n) ? n : null;
2309
2320
  }
2310
2321
  ensureCellHasBlock(e) {
2311
2322
  var t, n;
2312
- let r = e.querySelector(`[${R}]`);
2323
+ let r = e.querySelector(`[${z}]`);
2313
2324
  r && r.querySelector("[data-blok-id]") === null && ((t = (n = this.api.blocks).transactWithoutCapture) == null || t.call(n, () => {
2314
2325
  let t = this.api.blocks.insert("paragraph", { text: "" }, {}, this.api.blocks.getBlocksCount(), !0);
2315
2326
  r.appendChild(t.holder), this.api.blocks.setBlockParent(t.id, this.tableBlockId), this.syncBlockToModel(e, t.id), this.stripPlaceholders(r);
@@ -2335,11 +2346,11 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2335
2346
  n && this.model.addBlockToCell(n.row, n.col, t);
2336
2347
  }
2337
2348
  getCellPosition(e) {
2338
- let t = e.closest(`[${N}]`);
2349
+ let t = e.closest(`[${P}]`);
2339
2350
  if (!t) return null;
2340
- let n = Array.from(this.gridElement.querySelectorAll(`[${N}]`)).indexOf(t);
2351
+ let n = Array.from(this.gridElement.querySelectorAll(`[${P}]`)).indexOf(t);
2341
2352
  if (n < 0) return null;
2342
- let r = Array.from(t.querySelectorAll(`[${P}]`)).indexOf(e);
2353
+ let r = Array.from(t.querySelectorAll(`[${F}]`)).indexOf(e);
2343
2354
  return r < 0 ? null : {
2344
2355
  row: n,
2345
2356
  col: r
@@ -2347,7 +2358,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2347
2358
  }
2348
2359
  recordRemovedBlockCell(e) {
2349
2360
  if (e.index === void 0) return;
2350
- let t = e.target.holder.closest(`[${P}]`);
2361
+ let t = e.target.holder.closest(`[${F}]`);
2351
2362
  t && this.gridElement.contains(t) && this.removedBlockCells.set(e.target.id, {
2352
2363
  cell: t,
2353
2364
  index: e.index
@@ -2395,7 +2406,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2395
2406
  getBlockIdsFromCells(e) {
2396
2407
  let t = [];
2397
2408
  return Array.from(e).forEach((e) => {
2398
- let n = e.querySelector(`[${R}]`);
2409
+ let n = e.querySelector(`[${z}]`);
2399
2410
  n && n.querySelectorAll("[data-blok-id]").forEach((e) => {
2400
2411
  let n = e.getAttribute("data-blok-id");
2401
2412
  n && t.push(n);
@@ -2409,7 +2420,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2409
2420
  });
2410
2421
  }
2411
2422
  deleteAllBlocks() {
2412
- let e = this.gridElement.querySelectorAll(`[${P}]`), t = this.getBlockIdsFromCells(e);
2423
+ let e = this.gridElement.querySelectorAll(`[${F}]`), t = this.getBlockIdsFromCells(e);
2413
2424
  this.deleteBlocks(t);
2414
2425
  }
2415
2426
  destroy() {
@@ -2613,7 +2624,7 @@ var Ir = (e) => {
2613
2624
  t !== 0 && this.showProgrammaticSelection(e, 0, e, t - 1);
2614
2625
  }
2615
2626
  selectColumn(e) {
2616
- let t = this.grid.querySelectorAll(`[${N}]`).length;
2627
+ let t = this.grid.querySelectorAll(`[${P}]`).length;
2617
2628
  t !== 0 && this.showProgrammaticSelection(0, e, t - 1, e);
2618
2629
  }
2619
2630
  clearActiveSelection() {
@@ -2747,7 +2758,7 @@ var Ir = (e) => {
2747
2758
  minCol: n,
2748
2759
  maxCol: r
2749
2760
  });
2750
- let { minRow: i, maxRow: a, minCol: o, maxCol: s } = this.lastPaintedRange, c = this.grid.querySelectorAll(`[${N}]`);
2761
+ let { minRow: i, maxRow: a, minCol: o, maxCol: s } = this.lastPaintedRange, c = this.grid.querySelectorAll(`[${P}]`);
2751
2762
  this.selectedCells = this.collectCellsInRange(c, i, a, o, s), this.selectedCells.forEach((e) => {
2752
2763
  e.setAttribute(Jr, "");
2753
2764
  });
@@ -2759,7 +2770,7 @@ var Ir = (e) => {
2759
2770
  repositionOverlay() {
2760
2771
  let e = this.lastPaintedRange;
2761
2772
  if (!e || !this.overlay) return;
2762
- let t = this.grid.querySelectorAll(`[${N}]`), n = this.findCellByCoordOrIndex(t, e.minRow, e.minCol), r = this.findCellByCoordOrIndex(t, e.maxRow, e.maxCol);
2773
+ let t = this.grid.querySelectorAll(`[${P}]`), n = this.findCellByCoordOrIndex(t, e.minRow, e.minCol), r = this.findCellByCoordOrIndex(t, e.maxRow, e.maxCol);
2763
2774
  if (!n || !r) return;
2764
2775
  let i = this.grid.getBoundingClientRect(), a = n.getBoundingClientRect(), o = r.getBoundingClientRect(), s = getComputedStyle(this.grid), c = parseFloat(s.borderTopWidth) || 0, l = parseFloat(s.borderLeftWidth) || 0, u = o.right - a.left + 1, d = o.bottom - a.top + 1, f = a.top - i.top - c - 1, p = a.left - i.left - l - 1;
2765
2776
  this.overlay.style.top = `${f}px`, this.overlay.style.left = `${p}px`, this.overlay.style.width = `${u}px`, this.overlay.style.height = `${d}px`, this.pill && (this.pill.style.left = `${p + u - 1}px`, this.pill.style.top = `${f + d / 2}px`);
@@ -2913,11 +2924,11 @@ var Ir = (e) => {
2913
2924
  }
2914
2925
  }
2915
2926
  resolveCellCoord(e) {
2916
- let t = e.closest(`[${P}]`);
2927
+ let t = e.closest(`[${F}]`);
2917
2928
  if (!t) return null;
2918
- let n = t.closest(`[${N}]`);
2929
+ let n = t.closest(`[${P}]`);
2919
2930
  if (!n || !this.grid.contains(n)) return null;
2920
- let r = t.getAttribute(F), i = t.getAttribute(I);
2931
+ let r = t.getAttribute(I), i = t.getAttribute(L);
2921
2932
  if (r !== null && i !== null) {
2922
2933
  let e = parseInt(r, 10), t = parseInt(i, 10);
2923
2934
  if (!isNaN(e) && !isNaN(t)) return {
@@ -2925,9 +2936,9 @@ var Ir = (e) => {
2925
2936
  col: t
2926
2937
  };
2927
2938
  }
2928
- let a = Array.from(this.grid.querySelectorAll(`[${N}]`)).indexOf(n);
2939
+ let a = Array.from(this.grid.querySelectorAll(`[${P}]`)).indexOf(n);
2929
2940
  if (a < 0) return null;
2930
- let o = Array.from(n.querySelectorAll(`[${P}]`)).indexOf(t);
2941
+ let o = Array.from(n.querySelectorAll(`[${F}]`)).indexOf(t);
2931
2942
  return o < 0 ? null : {
2932
2943
  row: a,
2933
2944
  col: o
@@ -2936,7 +2947,7 @@ var Ir = (e) => {
2936
2947
  clampExtentToEdge(e) {
2937
2948
  var t, n, r, i;
2938
2949
  if (!this.anchorCell || !this.isSelecting) return;
2939
- let a = this.grid.getBoundingClientRect(), o = this.grid.querySelectorAll(`[${N}]`).length, s = this.getLogicalColumnCount();
2950
+ let a = this.grid.getBoundingClientRect(), o = this.grid.querySelectorAll(`[${P}]`).length, s = this.getLogicalColumnCount();
2940
2951
  if (o === 0 || s === 0) return;
2941
2952
  let c = {
2942
2953
  row: this.clampAxis(e.clientY, a.top, a.bottom, o, (t = (n = this.extentCell) == null ? void 0 : n.row) == null ? this.anchorCell.row : t),
@@ -2946,12 +2957,12 @@ var Ir = (e) => {
2946
2957
  }
2947
2958
  collectCellsInRange(e, t, n, r, i) {
2948
2959
  if (this.grid.querySelector("[data-blok-table-cell-row]") === null) return Array.from(e).slice(t, n + 1).flatMap((e) => {
2949
- let t = e.querySelectorAll(`[${P}]`);
2960
+ let t = e.querySelectorAll(`[${F}]`);
2950
2961
  return Array.from(t).slice(r, i + 1).filter((e) => e instanceof HTMLElement);
2951
2962
  });
2952
- let a = this.grid.querySelectorAll(`[${P}]`);
2963
+ let a = this.grid.querySelectorAll(`[${F}]`);
2953
2964
  return Array.from(a).filter((e) => {
2954
- let a = e.getAttribute(F), o = e.getAttribute(I);
2965
+ let a = e.getAttribute(I), o = e.getAttribute(L);
2955
2966
  if (a === null || o === null) return !1;
2956
2967
  let s = Number(a), c = Number(o), l = e, u = s + (l.rowSpan || 1) - 1, d = c + (l.colSpan || 1) - 1;
2957
2968
  return s <= n && u >= t && c <= i && d >= r;
@@ -2959,8 +2970,8 @@ var Ir = (e) => {
2959
2970
  }
2960
2971
  findCellByCoordOrIndex(e, t, n) {
2961
2972
  var r, i, a;
2962
- return this.grid.querySelector(`[${F}="${t}"][${I}="${n}"]`) || ((r = e[t]) == null ? void 0 : r.querySelectorAll(`[${P}]`)[n]) || Array.from((i = (a = e[t]) == null ? void 0 : a.querySelectorAll("[data-blok-table-cell]")) == null ? [] : i).find((e) => {
2963
- let t = Number(e.getAttribute(I)), r = e.colSpan || 1;
2973
+ return this.grid.querySelector(`[${I}="${t}"][${L}="${n}"]`) || ((r = e[t]) == null ? void 0 : r.querySelectorAll(`[${F}]`)[n]) || Array.from((i = (a = e[t]) == null ? void 0 : a.querySelectorAll("[data-blok-table-cell]")) == null ? [] : i).find((e) => {
2974
+ let t = Number(e.getAttribute(L)), r = e.colSpan || 1;
2964
2975
  return t <= n && t + r - 1 >= n;
2965
2976
  });
2966
2977
  }
@@ -2968,22 +2979,22 @@ var Ir = (e) => {
2968
2979
  var e, t;
2969
2980
  let n = (e = this.grid.querySelector("colgroup")) == null ? void 0 : e.querySelectorAll("col").length;
2970
2981
  if (n !== void 0 && n > 0) return n;
2971
- let r = this.grid.querySelector(`[${N}]`);
2982
+ let r = this.grid.querySelector(`[${P}]`);
2972
2983
  return (t = r == null ? void 0 : r.querySelectorAll("[data-blok-table-cell]").length) == null ? 0 : t;
2973
2984
  }
2974
2985
  clampAxis(e, t, n, r, i) {
2975
2986
  return e < t ? 0 : e > n ? r - 1 : i;
2976
2987
  }
2977
- }, z = (e) => {
2988
+ }, B = (e) => {
2978
2989
  let t = e.querySelector("colgroup");
2979
2990
  if (!t) return [];
2980
2991
  let n = t.querySelectorAll("col"), r = n[0];
2981
2992
  if (r && r.style.width.endsWith("%")) {
2982
- let t = e.querySelector(`[${N}]`);
2983
- if (t) return Array.from(t.querySelectorAll(`[${P}]`)).map((e) => Math.round(e.getBoundingClientRect().width));
2993
+ let t = e.querySelector(`[${P}]`);
2994
+ if (t) return Array.from(t.querySelectorAll(`[${F}]`)).map((e) => Math.round(e.getBoundingClientRect().width));
2984
2995
  }
2985
2996
  return Array.from(n).map((e) => parseFloat(e.style.width) || 0);
2986
- }, B = (e, t) => {
2997
+ }, V = (e, t) => {
2987
2998
  let n = t.reduce((e, t) => e + t, 0), r = e;
2988
2999
  r.style.width = `${n + 1}px`;
2989
3000
  let i = e.querySelector("colgroup");
@@ -2993,24 +3004,24 @@ var Ir = (e) => {
2993
3004
  t < a.length && (a[t].style.width = `${e}px`);
2994
3005
  });
2995
3006
  }, ri = (e, t) => {
2996
- let n = Array.from(e.querySelectorAll(`[${N}]`)), r = n.findIndex((e) => Array.from(e.querySelectorAll(`[${P}]`)).includes(t));
3007
+ let n = Array.from(e.querySelectorAll(`[${P}]`)), r = n.findIndex((e) => Array.from(e.querySelectorAll(`[${F}]`)).includes(t));
2997
3008
  return r === -1 ? null : {
2998
3009
  row: r,
2999
- col: Array.from(n[r].querySelectorAll(`[${P}]`)).indexOf(t)
3010
+ col: Array.from(n[r].querySelectorAll(`[${F}]`)).indexOf(t)
3000
3011
  };
3001
3012
  }, ii = (e) => {
3002
3013
  var t;
3003
- let n = e.querySelector(`[${R}]`);
3014
+ let n = e.querySelector(`[${z}]`);
3004
3015
  return n ? ((t = n.textContent) == null ? "" : t).trim().length === 0 : !0;
3005
3016
  }, ai = (e, t) => {
3006
- let n = e.querySelectorAll(`[${N}]`)[t];
3017
+ let n = e.querySelectorAll(`[${P}]`)[t];
3007
3018
  if (!n) return !0;
3008
- let r = n.querySelectorAll(`[${P}]`);
3019
+ let r = n.querySelectorAll(`[${F}]`);
3009
3020
  return Array.from(r).every((e) => ii(e));
3010
3021
  }, oi = (e, t) => {
3011
- let n = e.querySelectorAll(`[${N}]`);
3022
+ let n = e.querySelectorAll(`[${P}]`);
3012
3023
  return Array.from(n).every((e) => {
3013
- let n = e.querySelector(`[${I}="${t}"]`);
3024
+ let n = e.querySelector(`[${L}="${t}"]`);
3014
3025
  return !n || ii(n);
3015
3026
  });
3016
3027
  }, si = (e) => {
@@ -3032,40 +3043,40 @@ var Ir = (e) => {
3032
3043
  let n = [...e];
3033
3044
  return n.splice(t, 1), n.length > 0 ? n : void 0;
3034
3045
  }, ui = (e, t, n, r, i) => {
3035
- let a = n == null ? z(e) : n, o = r === void 0 ? V(a) : Math.round(r / 2 * 100) / 100;
3046
+ let a = n == null ? B(e) : n, o = r === void 0 ? H(a) : Math.round(r / 2 * 100) / 100;
3036
3047
  i.addColumn(e, t, a, o);
3037
3048
  let s = [...a];
3038
3049
  return s.splice(t, 0, o), s;
3039
- }, V = (e) => Math.round(e.reduce((e, t) => e + t, 0) / e.length / 2 * 100) / 100, di = (e) => e.length === 0 ? 0 : Math.round(e.reduce((e, t) => e + t, 0) / e.length * 100) / 100, fi = (e, t, n) => {
3050
+ }, H = (e) => Math.round(e.reduce((e, t) => e + t, 0) / e.length / 2 * 100) / 100, di = (e) => e.length === 0 ? 0 : Math.round(e.reduce((e, t) => e + t, 0) / e.length * 100) / 100, fi = (e, t, n) => {
3040
3051
  var r;
3041
3052
  if (!e) return [];
3042
- let i = e.querySelectorAll(`[${N}]`)[n];
3053
+ let i = e.querySelectorAll(`[${P}]`)[n];
3043
3054
  return i ? (r = t == null ? void 0 : t.getBlockIdsFromCells(i.querySelectorAll("[data-blok-table-cell]"))) == null ? [] : r : [];
3044
3055
  }, pi = (e, t, n) => {
3045
3056
  var r;
3046
3057
  if (!e) return [];
3047
- let i = e.querySelectorAll(`[${N}]`), a = [];
3058
+ let i = e.querySelectorAll(`[${P}]`), a = [];
3048
3059
  return i.forEach((e) => {
3049
- let t = e.querySelector(`[${I}="${n}"]`);
3060
+ let t = e.querySelector(`[${L}="${n}"]`);
3050
3061
  t && a.push(t);
3051
3062
  }), (r = t == null ? void 0 : t.getBlockIdsFromCells(a)) == null ? [] : r;
3052
- }, H = (e, t) => {
3053
- e.querySelectorAll(`[${P}]`).forEach((e) => {
3063
+ }, U = (e, t) => {
3064
+ e.querySelectorAll(`[${F}]`).forEach((e) => {
3054
3065
  t == null || t.ensureCellHasBlock(e);
3055
3066
  });
3056
3067
  }, mi = (e, t, n, r) => {
3057
- let i = e.querySelectorAll(`[${N}]`);
3068
+ let i = e.querySelectorAll(`[${P}]`);
3058
3069
  t.forEach((e, t) => {
3059
3070
  let a = i[t];
3060
3071
  a && e.forEach((e, t) => {
3061
3072
  var i;
3062
- let o = a.querySelector(`[${I}="${t}"]`);
3073
+ let o = a.querySelector(`[${L}="${t}"]`);
3063
3074
  if (!o) return;
3064
- let s = o.querySelector(`[${R}]`);
3075
+ let s = o.querySelector(`[${z}]`);
3065
3076
  if (!s) return;
3066
3077
  let c = s.querySelectorAll("[data-blok-id]").length > 0;
3067
- if (!(!L(e) && c)) {
3068
- if (!L(e)) {
3078
+ if (!(!R(e) && c)) {
3079
+ if (!R(e)) {
3069
3080
  let t = document.createElement("div");
3070
3081
  t.className = "leading-[1.5]", t.innerHTML = e, s.replaceChildren(t);
3071
3082
  return;
@@ -3113,7 +3124,7 @@ var Ir = (e) => {
3113
3124
  };
3114
3125
  }, gi = (e, t) => {
3115
3126
  let n = (n) => {
3116
- let r = n.target.closest(`[${P}]`);
3127
+ let r = n.target.closest(`[${F}]`);
3117
3128
  if (!r) return;
3118
3129
  let i = ri(e, r);
3119
3130
  i && (t == null || t.handleKeyDown(n, i));
@@ -3123,35 +3134,35 @@ var Ir = (e) => {
3123
3134
  };
3124
3135
  }, _i = ["overflow-x-auto", "overflow-y-hidden"], vi = (e) => {
3125
3136
  e == null || e.classList.add(..._i);
3126
- }, U = (e, t) => {
3137
+ }, W = (e, t) => {
3127
3138
  if (!e) return;
3128
- let n = e.querySelectorAll(`[${N}]`);
3139
+ let n = e.querySelectorAll(`[${P}]`);
3129
3140
  n.forEach((e) => {
3130
3141
  e.removeAttribute("data-blok-table-heading");
3131
3142
  }), t && n.length > 0 && n[0].setAttribute("data-blok-table-heading", "");
3132
3143
  }, yi = (e, t) => {
3133
- let n = e.querySelectorAll(`[${N}]`);
3144
+ let n = e.querySelectorAll(`[${P}]`);
3134
3145
  t.forEach((e, t) => {
3135
3146
  t >= n.length || e.forEach((e, r) => {
3136
- let i = n[t].querySelector(`[${I}="${r}"]`);
3137
- i && (L(e) && e.color ? i.style.backgroundColor = e.color : i.style.backgroundColor = "", L(e) && e.textColor ? i.style.color = e.textColor : i.style.color = "");
3147
+ let i = n[t].querySelector(`[${L}="${r}"]`);
3148
+ i && (R(e) && e.color ? i.style.backgroundColor = e.color : i.style.backgroundColor = "", R(e) && e.textColor ? i.style.color = e.textColor : i.style.color = "");
3138
3149
  });
3139
3150
  });
3140
3151
  }, bi = (e, t) => {
3141
- let n = e.querySelectorAll(`[${N}]`);
3152
+ let n = e.querySelectorAll(`[${P}]`);
3142
3153
  t.forEach((e, t) => {
3143
3154
  t >= n.length || e.forEach((e, r) => {
3144
- let i = n[t].querySelector(`[${I}="${r}"]`);
3155
+ let i = n[t].querySelector(`[${L}="${r}"]`);
3145
3156
  if (!i) return;
3146
- let a = i.querySelector(`[${R}]`);
3147
- a && (L(e) && e.placement && e.placement !== "top-left" ? a.setAttribute("data-blok-cell-placement", e.placement) : a.removeAttribute("data-blok-cell-placement"));
3157
+ let a = i.querySelector(`[${z}]`);
3158
+ a && (R(e) && e.placement && e.placement !== "top-left" ? a.setAttribute("data-blok-cell-placement", e.placement) : a.removeAttribute("data-blok-cell-placement"));
3148
3159
  });
3149
3160
  });
3150
- }, W = (e, t) => {
3151
- e && (e.querySelectorAll(`[${P}]`).forEach((e) => {
3161
+ }, G = (e, t) => {
3162
+ e && (e.querySelectorAll(`[${F}]`).forEach((e) => {
3152
3163
  e.removeAttribute("data-blok-table-heading-col");
3153
- }), t && e.querySelectorAll(`[${N}]`).forEach((e) => {
3154
- let t = e.querySelector(`[${P}]`);
3164
+ }), t && e.querySelectorAll(`[${P}]`).forEach((e) => {
3165
+ let t = e.querySelector(`[${F}]`);
3155
3166
  t && t.setAttribute("data-blok-table-heading-col", "");
3156
3167
  }));
3157
3168
  }, xi = (e) => !!(/^#[0-9a-f]{3,4}$/i.test(e) || /^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(e) || /^rgba?\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+\s*(,\s*[\d.]+\s*)?\)$/i.test(e) || /^hsla?\(\s*[\d.]+\s*,\s*[\d.]+%\s*,\s*[\d.]+%\s*(,\s*[\d.]+\s*)?\)$/i.test(e) || e === "transparent"), Si = class {
@@ -3216,6 +3227,13 @@ var Ir = (e) => {
3216
3227
  setCellBlocks(e, t, n) {
3217
3228
  if (this.isInBounds(e, t) && !this.isSpannedCell(e, t)) {
3218
3229
  for (let n of this.contentGrid[e][t].blocks) this.blockCellMap.delete(n);
3230
+ for (let r of n) {
3231
+ let n = this.blockCellMap.get(r);
3232
+ if (n !== void 0 && (n.row !== e || n.col !== t)) {
3233
+ let e = this.contentGrid[n.row][n.col];
3234
+ e.blocks = e.blocks.filter((e) => e !== r);
3235
+ }
3236
+ }
3219
3237
  this.contentGrid[e][t].blocks = [...n];
3220
3238
  for (let r of n) this.blockCellMap.set(r, {
3221
3239
  row: e,
@@ -3678,10 +3696,15 @@ var Ir = (e) => {
3678
3696
  });
3679
3697
  }
3680
3698
  normalizeContent(e) {
3681
- return !e || !Array.isArray(e) ? [] : e.map((e) => (e == null ? [] : e).map((e) => this.normalizeCell(e)));
3699
+ if (!e || !Array.isArray(e)) return [];
3700
+ let t = /* @__PURE__ */ new Set();
3701
+ return e.map((e) => (e == null ? [] : e).map((e) => {
3702
+ let n = this.normalizeCell(e);
3703
+ return n.blocks = n.blocks.filter((e) => t.has(e) ? !1 : (t.add(e), !0)), n;
3704
+ }));
3682
3705
  }
3683
3706
  normalizeCell(e) {
3684
- if (L(e)) {
3707
+ if (R(e)) {
3685
3708
  let t = { blocks: [...e.blocks] };
3686
3709
  return e.color !== void 0 && xi(e.color) && (t.color = e.color), e.textColor !== void 0 && xi(e.textColor) && (t.textColor = e.textColor), e.placement !== void 0 && (t.placement = e.placement), e.colspan !== void 0 && e.colspan > 1 && (t.colspan = e.colspan), e.rowspan !== void 0 && e.rowspan > 1 && (t.rowspan = e.rowspan), e.mergedInto !== void 0 && (t.mergedInto = [...e.mergedInto]), t;
3687
3710
  }
@@ -3792,7 +3815,7 @@ var Ir = (e) => {
3792
3815
  }
3793
3816
  });
3794
3817
  }
3795
- }, Di = (e, t, n) => (n.grid.addRow(e, t), H(e, n.cellBlocks), {
3818
+ }, Di = (e, t, n) => (n.grid.addRow(e, t), U(e, n.cellBlocks), {
3796
3819
  pendingHighlight: {
3797
3820
  type: "row",
3798
3821
  index: t
@@ -3803,7 +3826,7 @@ var Ir = (e) => {
3803
3826
  withHeadingColumn: n.data.withHeadingColumn
3804
3827
  }), Oi = (e, t, n) => {
3805
3828
  let r = ui(e, t, n.data.colWidths, n.data.initialColWidth, n.grid);
3806
- return H(e, n.cellBlocks), {
3829
+ return U(e, n.cellBlocks), {
3807
3830
  pendingHighlight: {
3808
3831
  type: "col",
3809
3832
  index: t
@@ -3847,7 +3870,7 @@ var Ir = (e) => {
3847
3870
  var r, i;
3848
3871
  (r = n.cellBlocks) == null || r.deleteBlocks((i = n.blocksToDelete) == null ? [] : i), n.grid.deleteColumn(e, t);
3849
3872
  let a = li(n.data.colWidths, t);
3850
- return a ? B(e, a) : si(e), {
3873
+ return a ? V(e, a) : si(e), {
3851
3874
  pendingHighlight: {
3852
3875
  type: "col",
3853
3876
  index: t < n.grid.getColumnCount(e) ? t : t - 1
@@ -3894,8 +3917,8 @@ var Ir = (e) => {
3894
3917
  let n = e[e.length - 1], r = t.offsetWidth || parseFloat(t.style.width) || 0;
3895
3918
  return [...e, n + r];
3896
3919
  }, [0]);
3897
- let n = e.querySelector(`[${N}]`);
3898
- return n ? Array.from(n.querySelectorAll(`[${P}]`)).reduce((e, t) => {
3920
+ let n = e.querySelector(`[${P}]`);
3921
+ return n ? Array.from(n.querySelectorAll(`[${F}]`)).reduce((e, t) => {
3899
3922
  let n = e[e.length - 1];
3900
3923
  return [...e, n + t.offsetWidth];
3901
3924
  }, [0]) : [0];
@@ -3939,7 +3962,7 @@ var Ir = (e) => {
3939
3962
  this.grid.style.userSelect = "none", document.body.style.cursor = "grabbing", (e = this.onDragStateChange) == null || e.call(this, !0, this.dragType), this.highlightSourceCells(), this.createDropIndicator(), this.createGhost();
3940
3963
  }
3941
3964
  highlightSourceCells() {
3942
- let e = this.grid.querySelectorAll(`[${N}]`);
3965
+ let e = this.grid.querySelectorAll(`[${P}]`);
3943
3966
  if (this.dragType === "row") {
3944
3967
  this.highlightRowCells(e);
3945
3968
  return;
@@ -3950,7 +3973,7 @@ var Ir = (e) => {
3950
3973
  let t = e[this.dragFromIndex];
3951
3974
  if (!t) return;
3952
3975
  let n = this.getDragSourceBg();
3953
- t.querySelectorAll(`[${P}]`).forEach((e) => {
3976
+ t.querySelectorAll(`[${F}]`).forEach((e) => {
3954
3977
  let t = e;
3955
3978
  t.style.backgroundColor = n, t.style.opacity = "0.7", this.dragOverlayCells.push(t);
3956
3979
  });
@@ -3958,7 +3981,7 @@ var Ir = (e) => {
3958
3981
  highlightColumnCells(e) {
3959
3982
  let t = this.getDragSourceBg();
3960
3983
  e.forEach((e) => {
3961
- let n = e.querySelector(`[${I}="${this.dragFromIndex}"]`);
3984
+ let n = e.querySelector(`[${L}="${this.dragFromIndex}"]`);
3962
3985
  n && (n.style.backgroundColor = t, n.style.opacity = "0.7", this.dragOverlayCells.push(n));
3963
3986
  });
3964
3987
  }
@@ -3975,7 +3998,7 @@ var Ir = (e) => {
3975
3998
  let e = this.dropIndicator.style;
3976
3999
  if (e.position = "absolute", e.backgroundColor = "#3b82f6", e.borderRadius = "1.5px", e.zIndex = "5", e.pointerEvents = "none", this.dropIndicator.setAttribute("contenteditable", "false"), this.dragType === "row") e.height = "3px", e.left = "-1px", e.right = "0", e.transition = "top 100ms ease";
3977
4000
  else {
3978
- let t = this.grid.querySelectorAll(`[${N}]`), n = t[t.length - 1], r = n ? n.offsetTop + n.offsetHeight : 0;
4001
+ let t = this.grid.querySelectorAll(`[${P}]`), n = t[t.length - 1], r = n ? n.offsetTop + n.offsetHeight : 0;
3979
4002
  e.width = "3px", e.top = "-1px", e.height = `${r + 1}px`, e.transition = "left 100ms ease";
3980
4003
  }
3981
4004
  this.grid.appendChild(this.dropIndicator);
@@ -4037,22 +4060,22 @@ var Ir = (e) => {
4037
4060
  }
4038
4061
  getRowSourceRect() {
4039
4062
  var e;
4040
- let t = this.grid.querySelectorAll(`[${N}]`)[this.dragFromIndex];
4063
+ let t = this.grid.querySelectorAll(`[${P}]`)[this.dragFromIndex];
4041
4064
  return (e = t == null ? void 0 : t.getBoundingClientRect()) == null ? null : e;
4042
4065
  }
4043
4066
  getColSourceRect() {
4044
- let e = this.grid.querySelectorAll(`[${N}]`), t = e[0], n = e[e.length - 1];
4067
+ let e = this.grid.querySelectorAll(`[${P}]`), t = e[0], n = e[e.length - 1];
4045
4068
  if (!t || !n) return null;
4046
- let r = t.querySelector(`[${I}="${this.dragFromIndex}"]`), i = n.querySelector(`[${I}="${this.dragFromIndex}"]`);
4069
+ let r = t.querySelector(`[${L}="${this.dragFromIndex}"]`), i = n.querySelector(`[${L}="${this.dragFromIndex}"]`);
4047
4070
  if (!r || !i) return null;
4048
4071
  let a = r.getBoundingClientRect(), o = i.getBoundingClientRect();
4049
4072
  return new DOMRect(a.left, a.top, a.width, o.bottom - a.top);
4050
4073
  }
4051
4074
  buildRowGhost() {
4052
- let e = this.grid.querySelectorAll(`[${N}]`)[this.dragFromIndex];
4075
+ let e = this.grid.querySelectorAll(`[${P}]`)[this.dragFromIndex];
4053
4076
  if (!e || !this.ghostEl) return;
4054
4077
  let t = this.ghostEl.style;
4055
- t.display = "flex", t.height = `${e.offsetHeight}px`, e.querySelectorAll(`[${P}]`).forEach((e) => {
4078
+ t.display = "flex", t.height = `${e.offsetHeight}px`, e.querySelectorAll(`[${F}]`).forEach((e) => {
4056
4079
  var t;
4057
4080
  let n = e, r = n.cloneNode(!0);
4058
4081
  r.style.width = `${n.offsetWidth}px`, r.style.flexShrink = "0", r.removeAttribute("contenteditable"), (t = this.ghostEl) == null || t.appendChild(r);
@@ -4060,10 +4083,10 @@ var Ir = (e) => {
4060
4083
  }
4061
4084
  buildColumnGhost() {
4062
4085
  if (!this.ghostEl) return;
4063
- let e = this.grid.querySelectorAll(`[${N}]`), t = this.ghostEl.style;
4086
+ let e = this.grid.querySelectorAll(`[${P}]`), t = this.ghostEl.style;
4064
4087
  t.display = "flex", t.flexDirection = "column", e.forEach((e) => {
4065
4088
  var t;
4066
- let n = e.querySelector(`[${I}="${this.dragFromIndex}"]`);
4089
+ let n = e.querySelector(`[${L}="${this.dragFromIndex}"]`);
4067
4090
  if (!n) return;
4068
4091
  let r = n.cloneNode(!0);
4069
4092
  r.style.width = `${n.offsetWidth}px`, r.style.height = `${n.offsetHeight}px`, r.removeAttribute("contenteditable"), (t = this.ghostEl) == null || t.appendChild(r);
@@ -4075,7 +4098,7 @@ var Ir = (e) => {
4075
4098
  this.dragType === "row" && (t.top = `${e.clientY - this.ghostOffsetY}px`), this.dragType === "col" && (t.left = `${e.clientX - this.ghostOffsetX}px`);
4076
4099
  }
4077
4100
  getRowDropIndex(e) {
4078
- let t = Array.from(this.grid.querySelectorAll(`[${N}]`)), n = t.map((e) => e.offsetTop);
4101
+ let t = Array.from(this.grid.querySelectorAll(`[${P}]`)), n = t.map((e) => e.offsetTop);
4079
4102
  if (t.length > 0) {
4080
4103
  let e = t[t.length - 1];
4081
4104
  n.push(e.offsetTop + e.offsetHeight);
@@ -4084,7 +4107,7 @@ var Ir = (e) => {
4084
4107
  return r.indexOf(i);
4085
4108
  }
4086
4109
  getRowDropTopPx(e) {
4087
- let t = this.grid.querySelectorAll(`[${N}]`);
4110
+ let t = this.grid.querySelectorAll(`[${P}]`);
4088
4111
  if (e < t.length) return t[e].offsetTop;
4089
4112
  if (t.length > 0) {
4090
4113
  let e = t[t.length - 1];
@@ -4329,7 +4352,7 @@ var Ir = (e) => {
4329
4352
  }
4330
4353
  handleUnlockGrip(e) {
4331
4354
  document.removeEventListener("pointerdown", this.boundUnlockGrip), this.lockedGrip && (this.applyIdleClasses(this.lockedGrip), this.lockedGrip = null);
4332
- let t = e.target instanceof HTMLElement ? e.target : null, n = t == null ? void 0 : t.closest(`[${P}]`);
4355
+ let t = e.target instanceof HTMLElement ? e.target : null, n = t == null ? void 0 : t.closest(`[${F}]`);
4333
4356
  if (n) {
4334
4357
  let e = this.getCellPosition(n);
4335
4358
  e && (this.clearHideTimeout(), this.showColGrip(e.col), this.showRowGrip(e.row), this.isInsideTable = !0);
@@ -4385,7 +4408,7 @@ var Ir = (e) => {
4385
4408
  }), n;
4386
4409
  }
4387
4410
  positionGrips() {
4388
- let e = this.grid.querySelectorAll(`[${N}]`);
4411
+ let e = this.grid.querySelectorAll(`[${P}]`);
4389
4412
  if (!e[0]) return;
4390
4413
  let t = Ii(this.grid), n = this.overlay && this.scrollContainer ? this.scrollContainer.scrollLeft : 0, r = this.overlay && this.scrollContainer ? this.scrollContainer.clientWidth : Infinity;
4391
4414
  this.colGrips.forEach((e, i) => {
@@ -4394,7 +4417,7 @@ var Ir = (e) => {
4394
4417
  o.top = `${-1 / 2}px`, o.left = `${a}px`, this.overlay && (o.visibility = a < 0 || a > r ? "hidden" : "");
4395
4418
  }), this.rowGrips.forEach((t, n) => {
4396
4419
  if (n >= e.length) return;
4397
- let r = e[n], i = this.grid.querySelectorAll(`[${F}="${n}"]`), a = Array.from(i).reduce((e, t) => {
4420
+ let r = e[n], i = this.grid.querySelectorAll(`[${I}="${n}"]`), a = Array.from(i).reduce((e, t) => {
4398
4421
  let n = t, r = e === null ? 0 : e.rowSpan || 1;
4399
4422
  return (n.rowSpan || 1) > r ? n : e;
4400
4423
  }, null);
@@ -4412,7 +4435,7 @@ var Ir = (e) => {
4412
4435
  var e;
4413
4436
  (e = this.rowResizeObserver) == null || e.disconnect(), this.rowResizeObserver = new ResizeObserver(() => {
4414
4437
  this.positionGrips();
4415
- }), this.grid.querySelectorAll(`[${N}]`).forEach((e) => {
4438
+ }), this.grid.querySelectorAll(`[${P}]`).forEach((e) => {
4416
4439
  var t;
4417
4440
  (t = this.rowResizeObserver) == null || t.observe(e);
4418
4441
  });
@@ -4422,7 +4445,7 @@ var Ir = (e) => {
4422
4445
  }
4423
4446
  handleMouseOver(e) {
4424
4447
  if (this.isGripInteractionLocked()) return;
4425
- let t = e.target.closest(`[${P}]`);
4448
+ let t = e.target.closest(`[${F}]`);
4426
4449
  if (!t) return;
4427
4450
  this.clearHideTimeout();
4428
4451
  let n = this.getCellPosition(t);
@@ -4432,7 +4455,7 @@ var Ir = (e) => {
4432
4455
  this.isGripInteractionLocked() || this.scheduleHideAll();
4433
4456
  }
4434
4457
  getCellPosition(e) {
4435
- let t = e.getAttribute(F), n = e.getAttribute(I);
4458
+ let t = e.getAttribute(I), n = e.getAttribute(L);
4436
4459
  if (t === null || n === null) return null;
4437
4460
  let r = parseInt(t, 10), i = parseInt(n, 10);
4438
4461
  return isNaN(r) || isNaN(i) ? null : {
@@ -4736,9 +4759,9 @@ var Ir = (e) => {
4736
4759
  e.forEach((e, i) => {
4737
4760
  e.forEach((e, a) => {
4738
4761
  if (typeof e == "string" || e.mergedInto) return;
4739
- let o = t.querySelector(`[${F}="${i}"][${I}="${a}"]`);
4762
+ let o = t.querySelector(`[${I}="${i}"][${L}="${a}"]`);
4740
4763
  if (!o) return;
4741
- let s = o.querySelector(`[${R}]`);
4764
+ let s = o.querySelector(`[${z}]`);
4742
4765
  s && e.blocks.forEach((e) => {
4743
4766
  let t = n.get(e);
4744
4767
  t && !r.has(e) && (s.appendChild(t), r.add(e));
@@ -4834,7 +4857,7 @@ var Ir = (e) => {
4834
4857
  var c;
4835
4858
  this.grid.fillGrid(s, (c = this.initialContent) == null ? [] : c);
4836
4859
  }
4837
- if (this.model.colWidths && B(s, this.model.colWidths), this.gridElement = s, this.model.colWidths || !this.readOnly) {
4860
+ if (this.model.colWidths && V(s, this.model.colWidths), this.gridElement = s, this.model.colWidths || !this.readOnly) {
4838
4861
  let e = document.createElement("div");
4839
4862
  e.setAttribute("data-blok-table-scroll", "");
4840
4863
  let t = this.model.colWidths ? _i : [];
@@ -4844,7 +4867,7 @@ var Ir = (e) => {
4844
4867
  let e = document.createElement("div");
4845
4868
  e.setAttribute("data-blok-table-grip-overlay", ""), e.style.position = "absolute", e.style.inset = "0", e.style.pointerEvents = "none", e.style.zIndex = "3", i.appendChild(e), this.gripOverlay = e;
4846
4869
  }
4847
- return this.element = i, this.model.withHeadings && U(this.gridElement, this.model.withHeadings), this.model.withHeadingColumn && W(this.gridElement, this.model.withHeadingColumn), this.readOnly || (this.initCellBlocks(s), this.keyboardNavCleanup = gi(s, this.cellBlocks)), i;
4870
+ return this.element = i, this.model.withHeadings && W(this.gridElement, this.model.withHeadings), this.model.withHeadingColumn && G(this.gridElement, this.model.withHeadingColumn), this.readOnly || (this.initCellBlocks(s), this.keyboardNavCleanup = gi(s, this.cellBlocks)), i;
4848
4871
  }
4849
4872
  rendered() {
4850
4873
  if (!this.element || this.initialContent === null) return;
@@ -4860,14 +4883,14 @@ var Ir = (e) => {
4860
4883
  }
4861
4884
  if (this.runTransactedStructuralOp(() => {
4862
4885
  var n, r;
4863
- let i = (n = (r = this.cellBlocks) == null ? void 0 : r.initializeCells(t)) == null ? t : n, a = this.isNewTable && i.length === 0 ? Array.from(e.querySelectorAll(`[${N}]`), (e) => {
4864
- let t = e.querySelectorAll(`[${P}]`).length;
4886
+ let i = (n = (r = this.cellBlocks) == null ? void 0 : r.initializeCells(t)) == null ? t : n, a = this.isNewTable && i.length === 0 ? Array.from(e.querySelectorAll(`[${P}]`), (e) => {
4887
+ let t = e.querySelectorAll(`[${F}]`).length;
4865
4888
  return Array.from({ length: t }, () => ({ blocks: [] }));
4866
4889
  }) : i;
4867
- this.model.replaceAll(A(A({}, this.model.snapshot()), {}, { content: a })), this.isNewTable && H(e, this.cellBlocks), this.removeGhostChildren();
4890
+ this.model.replaceAll(A(A({}, this.model.snapshot()), {}, { content: a })), this.isNewTable && U(e, this.cellBlocks), this.removeGhostChildren();
4868
4891
  }, !0), this.model.initialColWidth === void 0) {
4869
4892
  var r;
4870
- let t = (r = this.model.colWidths) == null ? z(e) : r;
4893
+ let t = (r = this.model.colWidths) == null ? B(e) : r;
4871
4894
  this.model.setInitialColWidth(t.length > 0 ? di(t) : void 0);
4872
4895
  }
4873
4896
  this.initSubsystems(e);
@@ -4903,16 +4926,17 @@ var Ir = (e) => {
4903
4926
  for (let { index: e } of t) this.api.blocks.delete(e);
4904
4927
  }
4905
4928
  save(e) {
4906
- let t = this.model.snapshot();
4907
- return t.content = t.content.map((e) => e.map((e) => {
4908
- if (!L(e)) return e;
4929
+ var t;
4930
+ let n = this.model.snapshot(), r = (t = this.blockId) == null ? "" : t;
4931
+ return n.content = n.content.map((e) => e.map((e) => {
4932
+ if (!R(e)) return e;
4909
4933
  let t = e.blocks.filter((e) => {
4910
- var t, n;
4911
- let r = (t = (n = this.api.blocks).getById) == null ? void 0 : t.call(n, e);
4912
- return !r || r.parentId === this.blockId;
4934
+ var t, n, i;
4935
+ let a = (t = (n = this.api.blocks).getById) == null ? void 0 : t.call(n, e);
4936
+ return a != null && ((i = a.parentId) == null ? "" : i) === r;
4913
4937
  });
4914
4938
  return A(A({}, e), {}, { blocks: t });
4915
- })), t;
4939
+ })), n;
4916
4940
  }
4917
4941
  validate(e) {
4918
4942
  return e.content.length > 0;
@@ -4943,11 +4967,11 @@ var Ir = (e) => {
4943
4967
  let i = (e = (t = (n = this.cellBlocks) == null ? void 0 : n.initializeCells((r = this.initialContent) == null ? [] : r)) == null ? this.initialContent : t) == null ? [] : e;
4944
4968
  if (o === this.setDataGeneration) {
4945
4969
  if (this.api.blocks.isSyncingFromYjs && i.length === 0 && f) {
4946
- let e = Array.from(f.querySelectorAll(`[${N}]`), (e) => {
4947
- let t = e.querySelectorAll(`[${P}]`).length;
4970
+ let e = Array.from(f.querySelectorAll(`[${P}]`), (e) => {
4971
+ let t = e.querySelectorAll(`[${F}]`).length;
4948
4972
  return Array.from({ length: t }, () => ({ blocks: [] }));
4949
4973
  });
4950
- this.model.replaceAll(A(A({}, this.model.snapshot()), {}, { content: e })), H(f, this.cellBlocks);
4974
+ this.model.replaceAll(A(A({}, this.model.snapshot()), {}, { content: e })), U(f, this.cellBlocks);
4951
4975
  } else this.model.replaceAll(A(A({}, this.model.snapshot()), {}, { content: i }));
4952
4976
  this.initialContent = null;
4953
4977
  }
@@ -5038,20 +5062,20 @@ var Ir = (e) => {
5038
5062
  }),
5039
5063
  getNewColumnWidth: () => {
5040
5064
  var t;
5041
- let n = (t = this.model.colWidths) == null ? z(e) : t;
5042
- return this.model.initialColWidth === void 0 ? V(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
5065
+ let n = (t = this.model.colWidths) == null ? B(e) : t;
5066
+ return this.model.initialColWidth === void 0 ? H(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
5043
5067
  },
5044
5068
  onAddRow: () => {
5045
5069
  this.runTransactedStructuralOp(() => {
5046
5070
  var t, n;
5047
- this.grid.addRow(e), this.model.addRow(), H(e, this.cellBlocks), U(this.gridElement, this.model.withHeadings), W(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (t = this.addControls) == null || t.syncRowButtonWidth(), (n = this.rowColControls) == null || n.refresh();
5071
+ this.grid.addRow(e), this.model.addRow(), U(e, this.cellBlocks), W(this.gridElement, this.model.withHeadings), G(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (t = this.addControls) == null || t.syncRowButtonWidth(), (n = this.rowColControls) == null || n.refresh();
5048
5072
  });
5049
5073
  },
5050
5074
  onAddColumn: () => {
5051
5075
  this.runTransactedStructuralOp(() => {
5052
5076
  var t, n, r;
5053
- let i = (t = this.model.colWidths) == null ? z(e) : t, a = this.model.initialColWidth === void 0 ? V(i) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
5054
- this.grid.addColumn(e, void 0, i, a), this.model.addColumn(void 0, a), this.model.setColWidths([...i, a]), H(e, this.cellBlocks), W(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (n = this.rowColControls) == null || n.refresh(), this.scrollContainer && (this.scrollContainer.scrollLeft = this.scrollContainer.scrollWidth), (r = this.addControls) == null || r.syncRowButtonWidth();
5077
+ let i = (t = this.model.colWidths) == null ? B(e) : t, a = this.model.initialColWidth === void 0 ? H(i) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
5078
+ this.grid.addColumn(e, void 0, i, a), this.model.addColumn(void 0, a), this.model.setColWidths([...i, a]), U(e, this.cellBlocks), G(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (n = this.rowColControls) == null || n.refresh(), this.scrollContainer && (this.scrollContainer.scrollLeft = this.scrollContainer.scrollWidth), (r = this.addControls) == null || r.syncRowButtonWidth();
5055
5079
  });
5056
5080
  },
5057
5081
  onDragStart: () => {
@@ -5060,7 +5084,7 @@ var Ir = (e) => {
5060
5084
  },
5061
5085
  onDragAddRow: () => {
5062
5086
  this.runTransactedStructuralOp(() => {
5063
- this.grid.addRow(e), this.model.addRow(), H(e, this.cellBlocks), U(this.gridElement, this.model.withHeadings), W(this.gridElement, this.model.withHeadingColumn);
5087
+ this.grid.addRow(e), this.model.addRow(), U(e, this.cellBlocks), W(this.gridElement, this.model.withHeadings), G(this.gridElement, this.model.withHeadingColumn);
5064
5088
  });
5065
5089
  },
5066
5090
  onDragRemoveRow: () => {
@@ -5076,8 +5100,8 @@ var Ir = (e) => {
5076
5100
  onDragAddCol: () => {
5077
5101
  this.runTransactedStructuralOp(() => {
5078
5102
  var t;
5079
- let r = (t = this.model.colWidths) == null ? z(e) : t, i = this.model.initialColWidth === void 0 ? V(r) : Math.round(this.model.initialColWidth / 2 * 100) / 100, a = [...r, i];
5080
- this.grid.addColumn(e, void 0, r, i), this.model.addColumn(void 0, i), this.model.setColWidths(a), B(e, a), H(e, this.cellBlocks), W(this.gridElement, this.model.withHeadingColumn), this.initResize(e), n.addedCols++, this.scrollContainer && (this.scrollContainer.scrollLeft = this.scrollContainer.scrollWidth);
5103
+ let r = (t = this.model.colWidths) == null ? B(e) : t, i = this.model.initialColWidth === void 0 ? H(r) : Math.round(this.model.initialColWidth / 2 * 100) / 100, a = [...r, i];
5104
+ this.grid.addColumn(e, void 0, r, i), this.model.addColumn(void 0, i), this.model.setColWidths(a), V(e, a), U(e, this.cellBlocks), G(this.gridElement, this.model.withHeadingColumn), this.initResize(e), n.addedCols++, this.scrollContainer && (this.scrollContainer.scrollLeft = this.scrollContainer.scrollWidth);
5081
5105
  });
5082
5106
  },
5083
5107
  onDragRemoveCol: () => {
@@ -5088,7 +5112,7 @@ var Ir = (e) => {
5088
5112
  let { blocksToDelete: i } = this.model.deleteColumn(r - 1);
5089
5113
  (t = this.cellBlocks) == null || t.deleteBlocks(i), this.grid.deleteColumn(e, r - 1);
5090
5114
  let a = this.model.colWidths;
5091
- a && B(e, a), this.initResize(e), n.addedCols--;
5115
+ a && V(e, a), this.initResize(e), n.addedCols--;
5092
5116
  });
5093
5117
  },
5094
5118
  onDragEnd: () => {
@@ -5104,14 +5128,14 @@ var Ir = (e) => {
5104
5128
  gridEl: e,
5105
5129
  onAddRow: () => {
5106
5130
  this.runStructuralOp(() => {
5107
- this.grid.addRow(e), this.model.addRow(), H(e, this.cellBlocks), U(this.gridElement, this.model.withHeadings), W(this.gridElement, this.model.withHeadingColumn);
5131
+ this.grid.addRow(e), this.model.addRow(), U(e, this.cellBlocks), W(this.gridElement, this.model.withHeadings), G(this.gridElement, this.model.withHeadingColumn);
5108
5132
  });
5109
5133
  },
5110
5134
  onAddColumn: () => {
5111
5135
  this.runStructuralOp(() => {
5112
5136
  var t;
5113
- let n = (t = this.model.colWidths) == null ? z(e) : t, r = this.model.initialColWidth === void 0 ? V(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100, i = [...n, r];
5114
- this.grid.addColumn(e, void 0, n, r), this.model.addColumn(void 0, r), this.model.setColWidths(i), B(e, i), vi(this.ensureScrollContainer()), H(e, this.cellBlocks), W(this.gridElement, this.model.withHeadingColumn);
5137
+ let n = (t = this.model.colWidths) == null ? B(e) : t, r = this.model.initialColWidth === void 0 ? H(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100, i = [...n, r];
5138
+ this.grid.addColumn(e, void 0, n, r), this.model.addColumn(void 0, r), this.model.setColWidths(i), V(e, i), vi(this.ensureScrollContainer()), U(e, this.cellBlocks), G(this.gridElement, this.model.withHeadingColumn);
5115
5139
  });
5116
5140
  },
5117
5141
  onRemoveLastRow: () => {
@@ -5131,7 +5155,7 @@ var Ir = (e) => {
5131
5155
  let { blocksToDelete: r } = this.model.deleteColumn(n - 1);
5132
5156
  (t = this.cellBlocks) == null || t.deleteBlocks(r), this.grid.deleteColumn(e, n - 1);
5133
5157
  let i = this.model.colWidths;
5134
- i && B(e, i);
5158
+ i && V(e, i);
5135
5159
  });
5136
5160
  },
5137
5161
  onDragStart: () => {
@@ -5151,9 +5175,9 @@ var Ir = (e) => {
5151
5175
  onClickAdd: () => {
5152
5176
  this.runTransactedStructuralOp(() => {
5153
5177
  var t, n, r;
5154
- this.grid.addRow(e), this.model.addRow(), H(e, this.cellBlocks), U(this.gridElement, this.model.withHeadings), W(this.gridElement, this.model.withHeadingColumn);
5155
- let i = (t = this.model.colWidths) == null ? z(e) : t, a = this.model.initialColWidth === void 0 ? V(i) : Math.round(this.model.initialColWidth / 2 * 100) / 100, o = [...i, a];
5156
- this.grid.addColumn(e, void 0, i, a), this.model.addColumn(void 0, a), this.model.setColWidths(o), B(e, o), H(e, this.cellBlocks), W(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (n = this.rowColControls) == null || n.refresh(), (r = this.addControls) == null || r.syncRowButtonWidth();
5178
+ this.grid.addRow(e), this.model.addRow(), U(e, this.cellBlocks), W(this.gridElement, this.model.withHeadings), G(this.gridElement, this.model.withHeadingColumn);
5179
+ let i = (t = this.model.colWidths) == null ? B(e) : t, a = this.model.initialColWidth === void 0 ? H(i) : Math.round(this.model.initialColWidth / 2 * 100) / 100, o = [...i, a];
5180
+ this.grid.addColumn(e, void 0, i, a), this.model.addColumn(void 0, a), this.model.setColWidths(o), V(e, o), U(e, this.cellBlocks), G(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (n = this.rowColControls) == null || n.refresh(), (r = this.addControls) == null || r.syncRowButtonWidth();
5157
5181
  });
5158
5182
  }
5159
5183
  }));
@@ -5220,7 +5244,7 @@ var Ir = (e) => {
5220
5244
  blocksToDelete: o
5221
5245
  });
5222
5246
  if (n !== this.setDataGeneration || this.gridElement !== e) return;
5223
- if (this.model.setColWidths(s.colWidths), this.model.setWithHeadings(s.withHeadings), this.model.setWithHeadingColumn(s.withHeadingColumn), this.pendingHighlight = s.pendingHighlight, U(this.gridElement, this.model.withHeadings), W(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (r = this.addControls) == null || r.syncRowButtonWidth(), !(t.type === "toggle-heading" || t.type === "toggle-heading-column")) {
5247
+ if (this.model.setColWidths(s.colWidths), this.model.setWithHeadings(s.withHeadings), this.model.setWithHeadingColumn(s.withHeadingColumn), this.pendingHighlight = s.pendingHighlight, W(this.gridElement, this.model.withHeadings), G(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (r = this.addControls) == null || r.syncRowButtonWidth(), !(t.type === "toggle-heading" || t.type === "toggle-heading-column")) {
5224
5248
  var c;
5225
5249
  (c = this.rowColControls) == null || c.refresh();
5226
5250
  }
@@ -5266,7 +5290,7 @@ var Ir = (e) => {
5266
5290
  initResize(e) {
5267
5291
  var t, n;
5268
5292
  (t = this.resize) == null || t.destroy();
5269
- let r = this.model.colWidths === void 0, i = (n = this.model.colWidths) == null ? z(e) : n;
5293
+ let r = this.model.colWidths === void 0, i = (n = this.model.colWidths) == null ? B(e) : n;
5270
5294
  r || vi(this.ensureScrollContainer()), this.resize = new Ei(e, i, (e) => {
5271
5295
  var t, n, r;
5272
5296
  this.model.setColWidths(e), vi(this.ensureScrollContainer()), (t = this.rowColControls) == null || t.positionGrips(), (n = this.addControls) == null || n.syncRowButtonWidth(), (r = this.scrollHaze) == null || r.update();
@@ -5319,7 +5343,7 @@ var Ir = (e) => {
5319
5343
  let e = ri(n, r);
5320
5344
  if (!e) continue;
5321
5345
  this.model.setCellPlacement(e.row, e.col, t === "top-left" ? void 0 : t);
5322
- let i = r.querySelector(`[${R}]`);
5346
+ let i = r.querySelector(`[${z}]`);
5323
5347
  i && (t === "top-left" ? i.removeAttribute("data-blok-cell-placement") : i.setAttribute("data-blok-cell-placement", t));
5324
5348
  }
5325
5349
  });
@@ -5327,7 +5351,7 @@ var Ir = (e) => {
5327
5351
  collectCellBlockData(e) {
5328
5352
  return this.gridElement ? e.map((e) => {
5329
5353
  var t, n, r;
5330
- let i = parseInt((t = e.getAttribute("data-blok-table-cell-row")) == null ? "0" : t, 10), a = parseInt((n = e.getAttribute("data-blok-table-cell-col")) == null ? "0" : n, 10), o = e.querySelector(`[${R}]`), s = [];
5354
+ let i = parseInt((t = e.getAttribute("data-blok-table-cell-row")) == null ? "0" : t, 10), a = parseInt((n = e.getAttribute("data-blok-table-cell-col")) == null ? "0" : n, 10), o = e.querySelector(`[${z}]`), s = [];
5331
5355
  if (!o) return {
5332
5356
  row: i,
5333
5357
  col: a,
@@ -5443,7 +5467,7 @@ var Ir = (e) => {
5443
5467
  if (!s || o !== null && new DOMParser().parseFromString(i, "text/html").querySelectorAll("table").length > 1) return;
5444
5468
  let c = document.activeElement;
5445
5469
  if (!c) return;
5446
- let l = c.closest(`[${P}]`);
5470
+ let l = c.closest(`[${F}]`);
5447
5471
  if (!l || !t.contains(l) || !l.closest("[data-blok-table-row]")) return;
5448
5472
  if (s.rows === 1 && s.cols === 1) {
5449
5473
  e.preventDefault(), e.stopPropagation(), this.insertSingleCellPayloadInline(s.cells[0][0]);
@@ -5471,11 +5495,11 @@ var Ir = (e) => {
5471
5495
  this.runTransactedStructuralOp(() => {
5472
5496
  var i, a;
5473
5497
  this.expandGridForPaste(e, n + t.rows, r + t.cols);
5474
- let o = e.querySelectorAll(`[${N}]`);
5498
+ let o = e.querySelectorAll(`[${P}]`);
5475
5499
  Array.from({ length: t.rows }, (e, t) => t).forEach((e) => {
5476
5500
  let i = o[n + e];
5477
5501
  if (!i) return;
5478
- let a = i.querySelectorAll(`[${P}]`);
5502
+ let a = i.querySelectorAll(`[${F}]`);
5479
5503
  Array.from({ length: t.cols }, (e, t) => t).forEach((i) => {
5480
5504
  let o = a[r + i];
5481
5505
  if (o) {
@@ -5490,7 +5514,7 @@ var Ir = (e) => {
5490
5514
  });
5491
5515
  }), this.initResize(e), (i = this.addControls) == null || i.syncRowButtonWidth(), (a = this.rowColControls) == null || a.refresh();
5492
5516
  });
5493
- let i = e.querySelectorAll(`[${N}]`)[n + t.rows - 1], a = i == null ? void 0 : i.querySelectorAll(`[${P}]`)[r + t.cols - 1];
5517
+ let i = e.querySelectorAll(`[${P}]`)[n + t.rows - 1], a = i == null ? void 0 : i.querySelectorAll(`[${F}]`)[r + t.cols - 1];
5494
5518
  if (!a || !this.cellBlocks || !this.api.caret) return;
5495
5519
  let o = this.cellBlocks.getBlockIdsFromCells([a]), s = o[o.length - 1];
5496
5520
  s !== void 0 && this.api.caret.setToBlock(s, "end");
@@ -5498,11 +5522,11 @@ var Ir = (e) => {
5498
5522
  expandGridForPaste(e, t, n) {
5499
5523
  let r = this.grid.getRowCount(e), i = this.grid.getColumnCount(e);
5500
5524
  Array.from({ length: Math.max(0, t - r) }).forEach(() => {
5501
- this.grid.addRow(e), this.model.addRow(), H(e, this.cellBlocks), U(this.gridElement, this.model.withHeadings), W(this.gridElement, this.model.withHeadingColumn);
5525
+ this.grid.addRow(e), this.model.addRow(), U(e, this.cellBlocks), W(this.gridElement, this.model.withHeadings), G(this.gridElement, this.model.withHeadingColumn);
5502
5526
  }), Array.from({ length: Math.max(0, n - i) }).forEach(() => {
5503
5527
  var t;
5504
- let n = (t = this.model.colWidths) == null ? z(e) : t, r = this.model.initialColWidth === void 0 ? V(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
5505
- this.grid.addColumn(e, void 0, n, r), this.model.addColumn(void 0, r), this.model.setColWidths([...n, r]), H(e, this.cellBlocks), W(this.gridElement, this.model.withHeadingColumn);
5528
+ let n = (t = this.model.colWidths) == null ? B(e) : t, r = this.model.initialColWidth === void 0 ? H(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
5529
+ this.grid.addColumn(e, void 0, n, r), this.model.addColumn(void 0, r), this.model.setColWidths([...n, r]), U(e, this.cellBlocks), G(this.gridElement, this.model.withHeadingColumn);
5506
5530
  });
5507
5531
  }
5508
5532
  pasteCellPayload(e, t) {
@@ -5510,7 +5534,7 @@ var Ir = (e) => {
5510
5534
  let t = this.cellBlocks.getBlockIdsFromCells([e]);
5511
5535
  this.cellBlocks.deleteBlocks(t);
5512
5536
  }
5513
- let n = e.querySelector(`[${R}]`);
5537
+ let n = e.querySelector(`[${z}]`);
5514
5538
  if (n) {
5515
5539
  if (t.blocks.length === 0) {
5516
5540
  var r;
@@ -5558,7 +5582,9 @@ var Ir = (e) => {
5558
5582
  }, Ta = class e {
5559
5583
  constructor({ data: e, config: t, api: n, readOnly: r, block: i }) {
5560
5584
  var a;
5561
- this._element = null, this._contentElement = null, this._arrowElement = null, this._bodyPlaceholderElement = null, this._childContainerElement = null, this.handleBlockChanged = (e) => {
5585
+ this._element = null, this._contentElement = null, this._arrowElement = null, this._bodyPlaceholderElement = null, this._childContainerElement = null, this.handleChildContainerInput = () => {
5586
+ zt(this._element, this._childContainerElement);
5587
+ }, this.handleBlockChanged = (e) => {
5562
5588
  this.isBlockChangedPayload(e) && (e.event.type === "block-removed" || e.event.type === "block-added") && this.updateBodyPlaceholderVisibility();
5563
5589
  }, this.api = n, this.readOnly = r, this._settings = t || {}, this._data = this.normalizeData(e), this._isOpen = (a = this._data.isOpen) == null ? !0 : a, i && (this.blockId = i.id), r || this.api.events.on("block changed", this.handleBlockChanged);
5564
5590
  }
@@ -5593,7 +5619,7 @@ var Ir = (e) => {
5593
5619
  expand: this.api.i18n.t($e)
5594
5620
  }
5595
5621
  });
5596
- return this._element = e.wrapper, this._contentElement = e.contentElement, this._arrowElement = e.arrowElement, this._bodyPlaceholderElement = e.bodyPlaceholderElement, this._childContainerElement = e.childContainerElement, this._element;
5622
+ return this._element = e.wrapper, this._contentElement = e.contentElement, this._arrowElement = e.arrowElement, this._bodyPlaceholderElement = e.bodyPlaceholderElement, this._childContainerElement = e.childContainerElement, this._childContainerElement.addEventListener("input", this.handleChildContainerInput), this._element;
5597
5623
  }
5598
5624
  rendered() {
5599
5625
  this.updateChildrenVisibility(), this.updateBodyPlaceholderVisibility();
@@ -5662,7 +5688,7 @@ var Ir = (e) => {
5662
5688
  this.blockId !== void 0 && Ht(this.api, this.blockId, this._isOpen, this._childContainerElement, this._arrowElement);
5663
5689
  }
5664
5690
  updateBodyPlaceholderVisibility() {
5665
- this.blockId !== void 0 && Ut(this._bodyPlaceholderElement, this.api, this.blockId, this._isOpen, this.readOnly);
5691
+ this.blockId !== void 0 && (Ut(this._bodyPlaceholderElement, this.api, this.blockId, this._isOpen, this.readOnly), zt(this._element, this._childContainerElement));
5666
5692
  }
5667
5693
  handleBodyPlaceholderClick() {
5668
5694
  var e;
@@ -5757,27 +5783,24 @@ var Ir = (e) => {
5757
5783
  static get isReadOnlySupported() {
5758
5784
  return !0;
5759
5785
  }
5760
- }, Ea = "callout", Da = "tools.callout.color", Oa = "tools.callout.editIcon", ka = "tools.callout.addEmoji", Aa = "tools.callout.removeEmoji", ja = "tools.callout.filterEmojis", Ma = "tools.callout.calloutEmojiCategory", Na = "tools.callout.noEmojisFound", Pa = "tools.callout.pickRandom", Fa = "tools.callout.skinTone", Ia = "tools.callout.emojiCategoryPeople", La = "tools.callout.emojiCategoryNature", Ra = "tools.callout.emojiCategoryFood", za = "tools.callout.emojiCategoryActivity", Ba = "tools.callout.emojiCategoryTravel", Va = "tools.callout.emojiCategoryObjects", Ha = "tools.callout.emojiCategorySymbols", Ua = "tools.callout.emojiCategoryFlags", Wa = "💡", Ga = "rounded-xl pl-8 pr-4 py-[5px] my-1 flex items-start gap-2 relative", Ka = "text-[1.5rem] leading-[1] cursor-pointer bg-transparent border-0 px-0 py-[7px] h-[38px] flex-shrink-0 select-none", qa = "flex-1 min-w-0", Ja = "absolute left-0 top-0 h-full cursor-grab select-none";
5786
+ }, Ea = "callout", Da = "tools.callout.color", Oa = "tools.callout.editIcon", ka = "tools.callout.addEmoji", Aa = "tools.callout.removeEmoji", ja = "tools.callout.filterEmojis", Ma = "tools.callout.calloutEmojiCategory", Na = "tools.callout.noEmojisFound", Pa = "tools.callout.pickRandom", Fa = "tools.callout.skinTone", Ia = "tools.callout.emojiCategoryPeople", La = "tools.callout.emojiCategoryNature", Ra = "tools.callout.emojiCategoryFood", za = "tools.callout.emojiCategoryActivity", Ba = "tools.callout.emojiCategoryTravel", Va = "tools.callout.emojiCategoryObjects", Ha = "tools.callout.emojiCategorySymbols", Ua = "tools.callout.emojiCategoryFlags", Wa = "💡", Ga = "rounded-xl pl-8 pr-4 py-[5px] my-1 flex items-start gap-2 relative", Ka = "text-[1.5rem] leading-[1] cursor-pointer bg-transparent border-0 px-0 py-[7px] h-[38px] flex-shrink-0 select-none", qa = "flex-1 min-w-0";
5761
5787
  //#endregion
5762
5788
  //#region src/tools/callout/dom-builder.ts
5763
- function Ya(e) {
5789
+ function Ja(e) {
5764
5790
  let { emoji: t, readOnly: n, addEmojiLabel: r } = e, i = document.createElement("div");
5765
5791
  i.className = Ga;
5766
5792
  let a = document.createElement("button");
5767
5793
  a.type = "button", a.className = Ka, a.textContent = t || "", a.setAttribute("aria-label", t === "" ? r : t), a.setAttribute("tabindex", "0"), a.setAttribute("data-blok-testid", "callout-emoji-btn"), n && (a.disabled = !0);
5768
5794
  let o = document.createElement("div");
5769
- o.className = qa, o.setAttribute(O.toggleChildren, ""), o.setAttribute(k.nestedBlocks, ""), o.setAttribute("data-blok-child-toolbar", ""), o.setAttribute("data-blok-mutation-free", "true"), i.appendChild(a), i.appendChild(o);
5770
- let s = document.createElement("span");
5771
- return s.className = Ja, s.style.width = "32px", s.setAttribute("data-callout-drag-zone", ""), i.prepend(s), {
5795
+ return o.className = qa, o.setAttribute(O.toggleChildren, ""), o.setAttribute(k.nestedBlocks, ""), o.setAttribute("data-blok-child-toolbar", ""), o.setAttribute("data-blok-mutation-free", "true"), i.appendChild(a), i.appendChild(o), {
5772
5796
  wrapper: i,
5773
5797
  emojiButton: a,
5774
- childContainer: o,
5775
- dragZone: s
5798
+ childContainer: o
5776
5799
  };
5777
5800
  }
5778
5801
  //#endregion
5779
5802
  //#region src/tools/callout/block-operations.ts
5780
- function Xa(e) {
5803
+ function Ya(e) {
5781
5804
  return {
5782
5805
  emoji: e.emoji,
5783
5806
  textColor: e.textColor,
@@ -5786,7 +5809,7 @@ function Xa(e) {
5786
5809
  }
5787
5810
  //#endregion
5788
5811
  //#region src/tools/callout/callout-keyboard.ts
5789
- async function Za(e) {
5812
+ async function Xa(e) {
5790
5813
  if (e.calloutBlockId === void 0) return;
5791
5814
  let t = e.api.blocks.getChildren(e.calloutBlockId);
5792
5815
  if (e.event.preventDefault(), t.length <= 1) {
@@ -5800,7 +5823,7 @@ async function Za(e) {
5800
5823
  }
5801
5824
  //#endregion
5802
5825
  //#region src/tools/callout/emoji-picker/emoji-data.ts
5803
- var Qa = [
5826
+ var Za = [
5804
5827
  "💡",
5805
5828
  "👉",
5806
5829
  "☝️",
@@ -5821,8 +5844,8 @@ var Qa = [
5821
5844
  "📢",
5822
5845
  "🛠️",
5823
5846
  "⚙️"
5824
- ], $a = { data: null };
5825
- function eo(e, t) {
5847
+ ], Qa = { data: null };
5848
+ function $a(e, t) {
5826
5849
  let n = [];
5827
5850
  for (let r of e.emojis) {
5828
5851
  let i = t[r];
@@ -5839,12 +5862,12 @@ function eo(e, t) {
5839
5862
  }
5840
5863
  return n;
5841
5864
  }
5842
- async function to() {
5843
- if ($a.data !== null) return $a.data;
5844
- let e = await import("./native-D0cfLXsM.mjs"), t = "default" in e && e.default !== void 0 ? e.default : e, n = t.categories.flatMap((e) => eo(e, t.emojis));
5845
- return $a.data = n, n;
5865
+ async function eo() {
5866
+ if (Qa.data !== null) return Qa.data;
5867
+ let e = await import("./native-D0cfLXsM.mjs"), t = "default" in e && e.default !== void 0 ? e.default : e, n = t.categories.flatMap((e) => $a(e, t.emojis));
5868
+ return Qa.data = n, n;
5846
5869
  }
5847
- function no(e, t, n) {
5870
+ function to(e, t, n) {
5848
5871
  let r = t.toLowerCase();
5849
5872
  return e.filter((e) => {
5850
5873
  if (e.name.toLowerCase().includes(r) || e.keywords.some((e) => e.includes(r))) return !0;
@@ -5852,7 +5875,7 @@ function no(e, t, n) {
5852
5875
  return t === void 0 ? !1 : t.n.toLowerCase().includes(r) || t.k !== void 0 && t.k.some((e) => e.toLowerCase().includes(r));
5853
5876
  });
5854
5877
  }
5855
- function ro(e) {
5878
+ function no(e) {
5856
5879
  let t = /* @__PURE__ */ new Map();
5857
5880
  for (let r of e) {
5858
5881
  var n;
@@ -5863,7 +5886,7 @@ function ro(e) {
5863
5886
  }
5864
5887
  //#endregion
5865
5888
  //#region src/tools/callout/emoji-picker/emoji-locale.ts
5866
- var io = /* @__PURE__ */ new Map(), ao = {
5889
+ var ro = /* @__PURE__ */ new Map(), io = {
5867
5890
  am: () => import("./am-Bbd7cTHS.mjs"),
5868
5891
  ar: () => import("./ar-Bo71sCQE.mjs"),
5869
5892
  az: () => import("./az-BnNrO_xK.mjs"),
@@ -5930,22 +5953,22 @@ var io = /* @__PURE__ */ new Map(), ao = {
5930
5953
  vi: () => import("./vi--gW42cZG.mjs"),
5931
5954
  zh: () => import("./zh-DgQ6P8Lu.mjs")
5932
5955
  };
5933
- async function oo(e) {
5956
+ async function ao(e) {
5934
5957
  if (e === "en") return null;
5935
- let t = io.get(e);
5958
+ let t = ro.get(e);
5936
5959
  if (t !== void 0) return t;
5937
- let n = ao[e];
5960
+ let n = io[e];
5938
5961
  if (n === void 0) return null;
5939
5962
  try {
5940
5963
  let t = (await n()).default;
5941
- return io.set(e, t), t;
5964
+ return ro.set(e, t), t;
5942
5965
  } catch (e) {
5943
5966
  return null;
5944
5967
  }
5945
5968
  }
5946
5969
  //#endregion
5947
5970
  //#region src/tools/callout/emoji-picker/index.ts
5948
- var so = {
5971
+ var oo = {
5949
5972
  callout: Ma,
5950
5973
  people: Ia,
5951
5974
  nature: La,
@@ -5955,7 +5978,7 @@ var so = {
5955
5978
  objects: Va,
5956
5979
  symbols: Ha,
5957
5980
  flags: Ua
5958
- }, co = [
5981
+ }, so = [
5959
5982
  ["callout", be],
5960
5983
  ["people", at],
5961
5984
  ["nature", _],
@@ -5965,17 +5988,17 @@ var so = {
5965
5988
  ["objects", y],
5966
5989
  ["symbols", d],
5967
5990
  ["flags", pe]
5968
- ], lo = [
5991
+ ], co = [
5969
5992
  "✋",
5970
5993
  "✋🏻",
5971
5994
  "✋🏼",
5972
5995
  "✋🏽",
5973
5996
  "✋🏾",
5974
5997
  "✋🏿"
5975
- ], uo = "blok-emoji-skin-tone";
5976
- function fo() {
5998
+ ], lo = "blok-emoji-skin-tone";
5999
+ function uo() {
5977
6000
  try {
5978
- let e = localStorage.getItem(uo);
6001
+ let e = localStorage.getItem(lo);
5979
6002
  if (e === null) return 0;
5980
6003
  let t = parseInt(e, 10);
5981
6004
  return t >= 0 && t <= 5 ? t : 0;
@@ -5983,12 +6006,12 @@ function fo() {
5983
6006
  return 0;
5984
6007
  }
5985
6008
  }
5986
- function po(e) {
6009
+ function fo(e) {
5987
6010
  try {
5988
- localStorage.setItem(uo, String(e));
6011
+ localStorage.setItem(lo, String(e));
5989
6012
  } catch (e) {}
5990
6013
  }
5991
- var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><rect x=\"1.5\" y=\"1.5\" width=\"11\" height=\"11\" rx=\"2\" stroke=\"currentColor\" stroke-width=\"1.2\"/><circle cx=\"4.5\" cy=\"4.5\" r=\".9\" fill=\"currentColor\"/><circle cx=\"7\" cy=\"7\" r=\".9\" fill=\"currentColor\"/><circle cx=\"9.5\" cy=\"9.5\" r=\".9\" fill=\"currentColor\"/></svg>", ho = class {
6014
+ var po = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><rect x=\"1.5\" y=\"1.5\" width=\"11\" height=\"11\" rx=\"2\" stroke=\"currentColor\" stroke-width=\"1.2\"/><circle cx=\"4.5\" cy=\"4.5\" r=\".9\" fill=\"currentColor\"/><circle cx=\"7\" cy=\"7\" r=\".9\" fill=\"currentColor\"/><circle cx=\"9.5\" cy=\"9.5\" r=\".9\" fill=\"currentColor\"/></svg>", mo = class {
5992
6015
  constructor(e) {
5993
6016
  this._localeData = null, this._open = !1, this._allEmojis = [], this._skinTone = 0, this._showingEmptyState = !1, this._anchorEl = null, this._backdrop = null, this._savedOverflow = "", this._navButtons = /* @__PURE__ */ new Map(), this._sectionEls = /* @__PURE__ */ new Map(), this._activeNavId = "", this._navRafId = 0, this._skinToneButtons = [], this.onSelect = e.onSelect, this.onRemove = e.onRemove, this.i18n = e.i18n, this._locale = e.locale, this._element = this.buildElement();
5994
6017
  let t = this._element.querySelector("[data-emoji-picker-body]"), n = this._element.querySelector("[data-emoji-picker-nav]"), r = this._element.querySelector("input[type=\"text\"]");
@@ -6006,13 +6029,13 @@ var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
6006
6029
  async open(e) {
6007
6030
  var t = this;
6008
6031
  t._anchorEl = e, t._open = !0, t._filterInput.value = "", t._element.setAttribute("data-theme", t.resolveTheme());
6009
- let n = fo();
6032
+ let n = uo();
6010
6033
  if (n !== t._skinTone) {
6011
- t._skinTone = n, t._skinToneToggle.textContent = lo[n];
6034
+ t._skinTone = n, t._skinToneToggle.textContent = co[n];
6012
6035
  for (let [e, r] of t._skinToneButtons.entries()) t.applySkinToneActiveStyle(r, e === n);
6013
6036
  }
6014
- if (t._allEmojis.length === 0 && (t._allEmojis = await to()), t._locale !== "en" && t._localeData === null) {
6015
- let e = await oo(t._locale);
6037
+ if (t._allEmojis.length === 0 && (t._allEmojis = await eo()), t._locale !== "en" && t._localeData === null) {
6038
+ let e = await ao(t._locale);
6016
6039
  e !== null && (t._localeData = e);
6017
6040
  }
6018
6041
  t.renderEmojiGrid(t._allEmojis), t.showBackdrop(), t._element.style.animation = "none", t._element.hidden = !1, t.position(e), t._element.offsetHeight, t._element.style.animation = "", t._filterInput.focus();
@@ -6050,14 +6073,14 @@ var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
6050
6073
  "text-[14px] leading-none cursor-pointer select-none",
6051
6074
  "hover:bg-neutral-100 theme-dark:hover:bg-neutral-800",
6052
6075
  "active:scale-90 transition-all duration-100"
6053
- ].join(" "), o.textContent = lo[this._skinTone], o.addEventListener("click", () => this.toggleSkinTonePopover()), this._skinToneToggle = o, a.appendChild(o), this._skinTonePopover = this.buildSkinTonePopover(), a.appendChild(this._skinTonePopover);
6076
+ ].join(" "), o.textContent = co[this._skinTone], o.addEventListener("click", () => this.toggleSkinTonePopover()), this._skinToneToggle = o, a.appendChild(o), this._skinTonePopover = this.buildSkinTonePopover(), a.appendChild(this._skinTonePopover);
6054
6077
  let s = document.createElement("button");
6055
6078
  s.type = "button", s.setAttribute("data-emoji-picker-random", ""), s.setAttribute("aria-label", this.i18n.t(Pa)), s.className = [
6056
6079
  "flex-shrink-0 w-[34px] h-[34px] flex items-center justify-center rounded-lg",
6057
6080
  "text-neutral-400 hover:bg-neutral-100 hover:text-neutral-600",
6058
6081
  "theme-dark:hover:bg-neutral-800 theme-dark:hover:text-neutral-300",
6059
6082
  "transition-colors duration-100 cursor-pointer"
6060
- ].join(" "), s.innerHTML = mo, s.addEventListener("click", () => this.pickRandom()), T(s, this.i18n.t(Pa), { placement: "bottom" });
6083
+ ].join(" "), s.innerHTML = po, s.addEventListener("click", () => this.pickRandom()), T(s, this.i18n.t(Pa), { placement: "bottom" });
6061
6084
  let c = document.createElement("button");
6062
6085
  c.type = "button", c.setAttribute("data-emoji-picker-remove", ""), c.setAttribute("aria-label", this.i18n.t(Aa)), c.className = [
6063
6086
  "flex-shrink-0 w-[34px] h-[34px] flex items-center justify-center rounded-lg",
@@ -6093,7 +6116,7 @@ var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
6093
6116
  "bg-white border border-neutral-200/70 shadow-lg",
6094
6117
  "theme-dark:bg-neutral-800 theme-dark:border-neutral-700/50"
6095
6118
  ].join(" "), e.hidden = !0, this._skinToneButtons = [];
6096
- for (let [t, n] of lo.entries()) {
6119
+ for (let [t, n] of co.entries()) {
6097
6120
  let r = document.createElement("button");
6098
6121
  r.type = "button", r.textContent = n, r.setAttribute("aria-label", `${this.i18n.t(Fa)} ${t + 1}`), r.className = [
6099
6122
  "w-[32px] h-[32px] flex items-center justify-center rounded-lg",
@@ -6127,7 +6150,7 @@ var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
6127
6150
  e ? this._skinToneToggle.classList.add(...t) : this._skinToneToggle.classList.remove(...t);
6128
6151
  }
6129
6152
  setSkinTone(e) {
6130
- this._skinTone = e, po(e), this._skinToneToggle.textContent = lo[e];
6153
+ this._skinTone = e, fo(e), this._skinToneToggle.textContent = co[e];
6131
6154
  for (let [t, n] of this._skinToneButtons.entries()) this.applySkinToneActiveStyle(n, t === e);
6132
6155
  let t = Array.from(this._body.querySelectorAll("[data-emoji-native]"));
6133
6156
  for (let e of t) {
@@ -6144,7 +6167,7 @@ var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
6144
6167
  }
6145
6168
  buildCategoryNav(e) {
6146
6169
  this._nav.innerHTML = "", this._navButtons.clear(), this._activeNavId = "";
6147
- for (let [t, n] of co) {
6170
+ for (let [t, n] of so) {
6148
6171
  if (!e.has(t)) continue;
6149
6172
  let r = this.translateCategory(t), i = document.createElement("button");
6150
6173
  i.type = "button", i.innerHTML = n, i.title = r, i.setAttribute("aria-label", r), i.setAttribute("data-emoji-nav", t), i.className = [
@@ -6184,11 +6207,11 @@ var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
6184
6207
  return;
6185
6208
  }
6186
6209
  this._nav.hidden = !0;
6187
- let t = no(this._allEmojis, e, this._localeData);
6210
+ let t = to(this._allEmojis, e, this._localeData);
6188
6211
  if (t.length === 0) this._showingEmptyState || this.renderEmptyState();
6189
6212
  else {
6190
6213
  this._body.innerHTML = "", this._sectionEls.clear(), this._showingEmptyState = !1;
6191
- let e = ro(t);
6214
+ let e = no(t);
6192
6215
  for (let [t, n] of e) {
6193
6216
  let e = this.buildSection(this.translateCategory(t), n);
6194
6217
  e.setAttribute("data-emoji-section", t), this._sectionEls.set(t, e), this._body.appendChild(e);
@@ -6197,13 +6220,13 @@ var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
6197
6220
  }
6198
6221
  renderEmojiGrid(e) {
6199
6222
  this._body.innerHTML = "", this._sectionEls.clear(), this._showingEmptyState = !1;
6200
- let t = /* @__PURE__ */ new Set(), n = Qa.map((t) => e.find((e) => e.native === t)).filter((e) => e !== void 0);
6223
+ let t = /* @__PURE__ */ new Set(), n = Za.map((t) => e.find((e) => e.native === t)).filter((e) => e !== void 0);
6201
6224
  if (n.length > 0) {
6202
6225
  t.add("callout");
6203
6226
  let e = this.buildSection(this.translateCategory("callout"), n);
6204
6227
  e.setAttribute("data-emoji-section", "callout"), this._sectionEls.set("callout", e), this._body.appendChild(e);
6205
6228
  }
6206
- let r = new Set(Qa), i = ro(e.filter((e) => !r.has(e.native)));
6229
+ let r = new Set(Za), i = no(e.filter((e) => !r.has(e.native)));
6207
6230
  for (let [e, n] of i) {
6208
6231
  t.add(e);
6209
6232
  let r = this.buildSection(this.translateCategory(e), n);
@@ -6225,7 +6248,7 @@ var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
6225
6248
  n.className = "text-[13px] font-medium", n.textContent = this.i18n.t(Na), e.appendChild(t), e.appendChild(n), this._body.appendChild(e);
6226
6249
  }
6227
6250
  translateCategory(e) {
6228
- let t = so[e];
6251
+ let t = oo[e];
6229
6252
  return t === void 0 ? e : this.i18n.t(t);
6230
6253
  }
6231
6254
  buildSection(e, t) {
@@ -6280,10 +6303,10 @@ var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
6280
6303
  };
6281
6304
  //#endregion
6282
6305
  //#region src/tools/callout/index.ts
6283
- function go(e) {
6306
+ function ho(e) {
6284
6307
  return e.isEmojiVisible === !1 ? "" : typeof e.emoji == "string" && e.emoji.length > 0 ? e.emoji : Wa;
6285
6308
  }
6286
- var _o = {
6309
+ var go = {
6287
6310
  general: null,
6288
6311
  note: "blue",
6289
6312
  important: "purple",
@@ -6291,9 +6314,9 @@ var _o = {
6291
6314
  additional: "yellow",
6292
6315
  recommendation: "green",
6293
6316
  caution: "red"
6294
- }, vo = class {
6317
+ }, _o = class {
6295
6318
  constructor({ data: e, api: t, readOnly: n, block: r }) {
6296
- this._dom = null, this._emojiPicker = null, this._colorPicker = null, this._dragZone = null, this.api = t, this.readOnly = n, this._data = this.normalizeData(e), r && (this.blockId = r.id);
6319
+ this._dom = null, this._emojiPicker = null, this._colorPicker = null, this.api = t, this.readOnly = n, this._data = this.normalizeData(e), r && (this.blockId = r.id);
6297
6320
  }
6298
6321
  normalizeData(e) {
6299
6322
  let t = e;
@@ -6304,21 +6327,21 @@ var _o = {
6304
6327
  };
6305
6328
  }
6306
6329
  normalizeLegacyData(e) {
6307
- let t = typeof e.variant == "string" ? e.variant : "general", n = t in _o ? _o[t] : null;
6330
+ let t = typeof e.variant == "string" ? e.variant : "general", n = t in go ? go[t] : null;
6308
6331
  return {
6309
- emoji: go(e),
6332
+ emoji: ho(e),
6310
6333
  textColor: null,
6311
6334
  backgroundColor: n == null ? null : n
6312
6335
  };
6313
6336
  }
6314
6337
  render() {
6315
6338
  if (this._dom) return this._dom.wrapper;
6316
- let e = Ya({
6339
+ let e = Ja({
6317
6340
  emoji: this._data.emoji,
6318
6341
  readOnly: this.readOnly,
6319
6342
  addEmojiLabel: this.api.i18n.t(ka)
6320
6343
  });
6321
- return this._dom = e, this._dragZone = e.dragZone, this.applyColors(), this.readOnly || (e.emojiButton.addEventListener("click", () => this.openEmojiPicker()), e.emojiButton.addEventListener("keydown", (e) => {
6344
+ return this._dom = e, this.applyColors(), this.readOnly || (e.emojiButton.addEventListener("click", () => this.openEmojiPicker()), e.emojiButton.addEventListener("keydown", (e) => {
6322
6345
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.openEmojiPicker());
6323
6346
  }), e.childContainer.addEventListener("keydown", (e) => {
6324
6347
  e.key === "Backspace" && this.handleChildBackspace(e);
@@ -6327,7 +6350,7 @@ var _o = {
6327
6350
  rendered() {
6328
6351
  if (this.blockId === void 0 || this._dom === null) return;
6329
6352
  let e = this.api.blocks.getChildren(this.blockId);
6330
- if (zt(this._dom.childContainer, e), e.length === 0) {
6353
+ if (Rt(this._dom.childContainer, e), e.length === 0) {
6331
6354
  let e = this.api.blocks.getBlockIndex(this.blockId);
6332
6355
  if (e !== void 0) {
6333
6356
  let t = this.api.blocks.insertInsideParent(this.blockId, e + 1);
@@ -6336,7 +6359,7 @@ var _o = {
6336
6359
  }
6337
6360
  }
6338
6361
  save() {
6339
- return Xa({
6362
+ return Ya({
6340
6363
  emoji: this._data.emoji,
6341
6364
  textColor: this._data.textColor,
6342
6365
  backgroundColor: this._data.backgroundColor
@@ -6395,9 +6418,6 @@ var _o = {
6395
6418
  setReadOnly(e) {
6396
6419
  this.readOnly = e, this._dom && (this._dom.emojiButton.disabled = e);
6397
6420
  }
6398
- get dragZone() {
6399
- return this._dragZone;
6400
- }
6401
6421
  syncPickerActiveColors() {
6402
6422
  if (this._colorPicker === null) return;
6403
6423
  let e = this._data.textColor, t = this._data.backgroundColor;
@@ -6418,7 +6438,7 @@ var _o = {
6418
6438
  let n = t[0], r = e.target;
6419
6439
  if (!n.holder.contains(r)) return;
6420
6440
  let i = window.getSelection(), a = i !== null && i.rangeCount > 0 && i.getRangeAt(0).startOffset === 0 && i.getRangeAt(0).collapsed;
6421
- n.holder.textContent !== "" || !a || Za({
6441
+ n.holder.textContent !== "" || !a || Xa({
6422
6442
  api: this.api,
6423
6443
  calloutBlockId: this.blockId,
6424
6444
  firstChildBlockId: n.id,
@@ -6426,7 +6446,7 @@ var _o = {
6426
6446
  });
6427
6447
  }
6428
6448
  openEmojiPicker() {
6429
- this._dom !== null && (this._emojiPicker === null && (this._emojiPicker = new ho({
6449
+ this._dom !== null && (this._emojiPicker === null && (this._emojiPicker = new mo({
6430
6450
  onSelect: (e) => this.setEmoji(e),
6431
6451
  onRemove: () => this.setEmoji(""),
6432
6452
  i18n: this.api.i18n,
@@ -6480,39 +6500,39 @@ var _o = {
6480
6500
  static get isReadOnlySupported() {
6481
6501
  return !0;
6482
6502
  }
6483
- }, yo = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
6484
- function bo(e, t, n) {
6503
+ }, vo = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
6504
+ function yo(e, t, n) {
6485
6505
  let r = n[0];
6486
6506
  if (t != null && e >= t) throw Error(e + " >= " + t);
6487
6507
  if (e.slice(-1) === r || t && t.slice(-1) === r) throw Error("trailing zero");
6488
6508
  if (t) {
6489
6509
  let i = 0;
6490
6510
  for (; (e[i] || r) === t[i];) i++;
6491
- if (i > 0) return t.slice(0, i) + bo(e.slice(i), t.slice(i), n);
6511
+ if (i > 0) return t.slice(0, i) + yo(e.slice(i), t.slice(i), n);
6492
6512
  }
6493
6513
  let i = e ? n.indexOf(e[0]) : 0, a = t == null ? n.length : n.indexOf(t[0]);
6494
- return a - i > 1 ? n[Math.round(.5 * (i + a))] : t && t.length > 1 ? t.slice(0, 1) : n[i] + bo(e.slice(1), null, n);
6514
+ return a - i > 1 ? n[Math.round(.5 * (i + a))] : t && t.length > 1 ? t.slice(0, 1) : n[i] + yo(e.slice(1), null, n);
6495
6515
  }
6496
- function xo(e) {
6497
- if (e.length !== So(e[0])) throw Error("invalid integer part of order key: " + e);
6516
+ function bo(e) {
6517
+ if (e.length !== xo(e[0])) throw Error("invalid integer part of order key: " + e);
6498
6518
  }
6499
- function So(e) {
6519
+ function xo(e) {
6500
6520
  if (e >= "a" && e <= "z") return e.charCodeAt(0) - 97 + 2;
6501
6521
  if (e >= "A" && e <= "Z") return 90 - e.charCodeAt(0) + 2;
6502
6522
  throw Error("invalid order key head: " + e);
6503
6523
  }
6504
- function Co(e) {
6505
- let t = So(e[0]);
6524
+ function So(e) {
6525
+ let t = xo(e[0]);
6506
6526
  if (t > e.length) throw Error("invalid order key: " + e);
6507
6527
  return e.slice(0, t);
6508
6528
  }
6509
- function wo(e, t) {
6529
+ function Co(e, t) {
6510
6530
  if (e === "A" + t[0].repeat(26)) throw Error("invalid order key: " + e);
6511
- let n = Co(e);
6531
+ let n = So(e);
6512
6532
  if (e.slice(n.length).slice(-1) === t[0]) throw Error("invalid order key: " + e);
6513
6533
  }
6514
- function To(e, t) {
6515
- xo(e);
6534
+ function wo(e, t) {
6535
+ bo(e);
6516
6536
  let [n, ...r] = e.split(""), i = !0;
6517
6537
  for (let e = r.length - 1; i && e >= 0; e--) {
6518
6538
  let n = t.indexOf(r[e]) + 1;
@@ -6525,8 +6545,8 @@ function To(e, t) {
6525
6545
  return e > "a" ? r.push(t[0]) : r.pop(), e + r.join("");
6526
6546
  } else return n + r.join("");
6527
6547
  }
6528
- function Eo(e, t) {
6529
- xo(e);
6548
+ function To(e, t) {
6549
+ bo(e);
6530
6550
  let [n, ...r] = e.split(""), i = !0;
6531
6551
  for (let e = r.length - 1; i && e >= 0; e--) {
6532
6552
  let n = t.indexOf(r[e]) - 1;
@@ -6539,30 +6559,30 @@ function Eo(e, t) {
6539
6559
  return e < "Z" ? r.push(t.slice(-1)) : r.pop(), e + r.join("");
6540
6560
  } else return n + r.join("");
6541
6561
  }
6542
- function Do(e, t, n = yo) {
6543
- if (e != null && wo(e, n), t != null && wo(t, n), e != null && t != null && e >= t) throw Error(e + " >= " + t);
6562
+ function Eo(e, t, n = vo) {
6563
+ if (e != null && Co(e, n), t != null && Co(t, n), e != null && t != null && e >= t) throw Error(e + " >= " + t);
6544
6564
  if (e == null) {
6545
6565
  if (t == null) return "a" + n[0];
6546
- let e = Co(t), r = t.slice(e.length);
6547
- if (e === "A" + n[0].repeat(26)) return e + bo("", r, n);
6566
+ let e = So(t), r = t.slice(e.length);
6567
+ if (e === "A" + n[0].repeat(26)) return e + yo("", r, n);
6548
6568
  if (e < t) return e;
6549
- let i = Eo(e, n);
6569
+ let i = To(e, n);
6550
6570
  if (i == null) throw Error("cannot decrement any more");
6551
6571
  return i;
6552
6572
  }
6553
6573
  if (t == null) {
6554
- let t = Co(e), r = e.slice(t.length), i = To(t, n);
6555
- return i == null ? t + bo(r, null, n) : i;
6574
+ let t = So(e), r = e.slice(t.length), i = wo(t, n);
6575
+ return i == null ? t + yo(r, null, n) : i;
6556
6576
  }
6557
- let r = Co(e), i = e.slice(r.length), a = Co(t), o = t.slice(a.length);
6558
- if (r === a) return r + bo(i, o, n);
6559
- let s = To(r, n);
6577
+ let r = So(e), i = e.slice(r.length), a = So(t), o = t.slice(a.length);
6578
+ if (r === a) return r + yo(i, o, n);
6579
+ let s = wo(r, n);
6560
6580
  if (s == null) throw Error("cannot increment any more");
6561
- return s < t ? s : r + bo(i, null, n);
6581
+ return s < t ? s : r + yo(i, null, n);
6562
6582
  }
6563
6583
  //#endregion
6564
6584
  //#region src/tools/database/database-model.ts
6565
- var Oo = class e {
6585
+ var Do = class e {
6566
6586
  constructor(t) {
6567
6587
  if (this.rows = [], (t == null ? void 0 : t.schema) !== void 0 && t.schema.length > 0 ? this.schema = t.schema.map((e) => A({}, e)) : this.schema = e.createDefaultSchema(), (t == null ? void 0 : t.views) !== void 0 && t.views.length > 0) this.views = t.views.map((e) => A(A({}, e), {}, {
6568
6588
  sorts: [...e.sorts],
@@ -6586,7 +6606,7 @@ var Oo = class e {
6586
6606
  id: w(),
6587
6607
  name: e,
6588
6608
  type: t,
6589
- position: Do(r, null)
6609
+ position: Eo(r, null)
6590
6610
  }, n === void 0 ? {} : { config: n });
6591
6611
  return this.schema.push(i), i;
6592
6612
  }
@@ -6610,7 +6630,7 @@ var Oo = class e {
6610
6630
  let t = this.getOrderedRows(), n = t.length > 0 ? t[t.length - 1].position : null;
6611
6631
  return {
6612
6632
  id: w(),
6613
- position: Do(n, null),
6633
+ position: Eo(n, null),
6614
6634
  properties: e == null ? {} : e
6615
6635
  };
6616
6636
  }
@@ -6639,7 +6659,7 @@ var Oo = class e {
6639
6659
  id: w(),
6640
6660
  name: e,
6641
6661
  type: t,
6642
- position: Do(s, null),
6662
+ position: Eo(s, null),
6643
6663
  groupBy: n.groupBy,
6644
6664
  sorts: (r = n.sorts) == null ? [] : r,
6645
6665
  filters: (i = n.filters) == null ? [] : i,
@@ -6668,7 +6688,7 @@ var Oo = class e {
6668
6688
  return e == null ? "" : typeof e == "string" ? e : typeof e == "boolean" || typeof e == "number" ? String(e) : "";
6669
6689
  }
6670
6690
  static positionBetween(e, t) {
6671
- return Do(e, t);
6691
+ return Eo(e, t);
6672
6692
  }
6673
6693
  static createDefaultSchema() {
6674
6694
  return [{
@@ -6715,7 +6735,7 @@ var Oo = class e {
6715
6735
  visibleProperties: []
6716
6736
  };
6717
6737
  }
6718
- }, ko = class {
6738
+ }, Oo = class {
6719
6739
  constructor({ readOnly: e, i18n: t, options: n, getRows: r, titlePropertyId: i, onTitleEdit: a }) {
6720
6740
  this.readOnly = e, this.i18n = t, this.options = n, this.getRows = r, this.titlePropertyId = i, this.onTitleEdit = a;
6721
6741
  }
@@ -6836,7 +6856,7 @@ var Oo = class e {
6836
6856
  n.textContent = String(t);
6837
6857
  }
6838
6858
  }
6839
- }, Ao = class {
6859
+ }, ko = class {
6840
6860
  constructor({ readOnly: e, i18n: t, rows: n, titlePropertyId: r, schema: i, visiblePropertyIds: a, options: o, getRows: s }) {
6841
6861
  this.readOnly = e, this.i18n = t, this.rows = n, this.titlePropertyId = r, this.schema = i, this.visiblePropertyIds = a, this.groupOptions = o, this.getGroupRows = s;
6842
6862
  }
@@ -6940,7 +6960,7 @@ var Oo = class e {
6940
6960
  let t = document.createElement("button");
6941
6961
  return t.setAttribute("data-blok-database-add-row", ""), t.setAttribute("aria-label", this.i18n.t("tools.database.addRow")), t.textContent = "+ " + this.i18n.t("tools.database.newRow"), e !== void 0 && t.setAttribute("data-option-id", e), t;
6942
6962
  }
6943
- }, jo = 500, Mo = class {
6963
+ }, Ao = 500, jo = class {
6944
6964
  constructor(e, t) {
6945
6965
  this.pendingTimers = /* @__PURE__ */ new Map(), this.pendingUpdates = /* @__PURE__ */ new Map(), this.pendingPropertyTimers = /* @__PURE__ */ new Map(), this.pendingPropertyUpdates = /* @__PURE__ */ new Map(), this.adapter = e, this.onError = t;
6946
6966
  }
@@ -6967,7 +6987,7 @@ var Oo = class e {
6967
6987
  let r = this.pendingUpdates.get(t);
6968
6988
  this.pendingUpdates.set(t, r === void 0 ? e : A(A(A({}, r), e), {}, { properties: A(A({}, r.properties), e.properties) })), this.pendingTimers.set(t, setTimeout(() => {
6969
6989
  this.flushRow(t);
6970
- }, jo));
6990
+ }, Ao));
6971
6991
  }
6972
6992
  async syncMoveRow(e) {
6973
6993
  var t = this;
@@ -6987,7 +7007,7 @@ var Oo = class e {
6987
7007
  let { propertyId: t } = e, n = this.pendingPropertyTimers.get(t);
6988
7008
  n !== void 0 && clearTimeout(n), this.pendingPropertyUpdates.set(t, e), this.pendingPropertyTimers.set(t, setTimeout(() => {
6989
7009
  this.flushProperty(t);
6990
- }, jo));
7010
+ }, Ao));
6991
7011
  }
6992
7012
  async syncDeleteProperty(e) {
6993
7013
  await this.safeCall((t) => t.deleteProperty(e));
@@ -7025,7 +7045,7 @@ var Oo = class e {
7025
7045
  let n = this.pendingPropertyUpdates.get(e);
7026
7046
  this.pendingPropertyUpdates.delete(e), n !== void 0 && this.safeCall((e) => e.updateProperty(n));
7027
7047
  }
7028
- }, No = 10, Po = class {
7048
+ }, Mo = 10, No = class {
7029
7049
  constructor(e) {
7030
7050
  this.isDragging = !1, this.rowId = "", this.startX = 0, this.startY = 0, this.ghostEl = null, this.sourceCard = null, this.sourceCardHeight = 0, this.ghostOffsetX = 0, this.ghostOffsetY = 0, this.gapTarget = null, this.gapContainer = null, this.wrapper = e.wrapper, this.onDrop = e.onDrop, this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundPointerCancel = this.handlePointerCancel.bind(this), this.boundKeyDown = this.handleKeyDown.bind(this);
7031
7051
  }
@@ -7041,7 +7061,7 @@ var Oo = class e {
7041
7061
  }
7042
7062
  handlePointerMove(e) {
7043
7063
  let t = Math.abs(e.clientX - this.startX), n = Math.abs(e.clientY - this.startY);
7044
- !this.isDragging && (t > No || n > No) && (this.isDragging = !0, this.startActiveDrag(e)), this.isDragging && (this.updateGhostPosition(e), this.updateDropIndicator(e));
7064
+ !this.isDragging && (t > Mo || n > Mo) && (this.isDragging = !0, this.startActiveDrag(e)), this.isDragging && (this.updateGhostPosition(e), this.updateDropIndicator(e));
7045
7065
  }
7046
7066
  handlePointerUp(e) {
7047
7067
  this.isDragging && this.commitDrop(e), this.cleanup();
@@ -7128,7 +7148,7 @@ var Oo = class e {
7128
7148
  afterRowId: c
7129
7149
  });
7130
7150
  }
7131
- }, Fo = 10, Io = class {
7151
+ }, Po = 10, Fo = class {
7132
7152
  constructor(e) {
7133
7153
  this.isDragging = !1, this.optionId = "", this.startX = 0, this.startY = 0, this.ghostEl = null, this.sourceColumn = null, this.sourceColumnWidth = 0, this.ghostOffsetX = 0, this.gapTarget = null, this.gapContainer = null, this.wrapper = e.wrapper, this.onDrop = e.onDrop, this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundPointerCancel = this.handlePointerCancel.bind(this), this.boundKeyDown = this.handleKeyDown.bind(this);
7134
7154
  }
@@ -7144,7 +7164,7 @@ var Oo = class e {
7144
7164
  }
7145
7165
  handlePointerMove(e) {
7146
7166
  let t = Math.abs(e.clientX - this.startX);
7147
- !this.isDragging && t > Fo && (this.isDragging = !0, this.startActiveDrag(e)), this.isDragging && (this.updateGhostPosition(e), this.updateDropIndicator(e.clientX));
7167
+ !this.isDragging && t > Po && (this.isDragging = !0, this.startActiveDrag(e)), this.isDragging && (this.updateGhostPosition(e), this.updateDropIndicator(e.clientX));
7148
7168
  }
7149
7169
  handlePointerUp(e) {
7150
7170
  this.isDragging && this.commitDrop(e), this.cleanup();
@@ -7216,7 +7236,7 @@ var Oo = class e {
7216
7236
  afterOptionId: r
7217
7237
  });
7218
7238
  }
7219
- }, Lo = class {
7239
+ }, Io = class {
7220
7240
  constructor(e) {
7221
7241
  this.options = e, this.i18n = e.i18n;
7222
7242
  }
@@ -7278,7 +7298,7 @@ var Oo = class e {
7278
7298
  }));
7279
7299
  }
7280
7300
  destroy() {}
7281
- }, Ro = 10, zo = class {
7301
+ }, Lo = 10, Ro = class {
7282
7302
  constructor(e) {
7283
7303
  this.isDragging = !1, this.rowId = "", this.startY = 0, this.ghostEl = null, this.sourceRow = null, this.sourceRowHeight = 0, this.ghostOffsetY = 0, this.gapTarget = null, this.wrapper = e.wrapper, this.onDrop = e.onDrop, this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundPointerCancel = this.handlePointerCancel.bind(this), this.boundKeyDown = this.handleKeyDown.bind(this);
7284
7304
  }
@@ -7294,7 +7314,7 @@ var Oo = class e {
7294
7314
  }
7295
7315
  handlePointerMove(e) {
7296
7316
  let t = Math.abs(e.clientY - this.startY);
7297
- !this.isDragging && t > Ro && (this.isDragging = !0, this.startActiveDrag(e)), this.isDragging && (this.updateGhostPosition(e), this.updateDropIndicator(e));
7317
+ !this.isDragging && t > Lo && (this.isDragging = !0, this.startActiveDrag(e)), this.isDragging && (this.updateGhostPosition(e), this.updateDropIndicator(e));
7298
7318
  }
7299
7319
  handlePointerUp(e) {
7300
7320
  this.isDragging && this.commitDrop(e), this.cleanup();
@@ -7356,7 +7376,7 @@ var Oo = class e {
7356
7376
  resolveAfterRowId(e, t, n) {
7357
7377
  return e ? n > 0 ? t[n - 1].getAttribute("data-row-id") : null : t.length > 0 ? t[t.length - 1].getAttribute("data-row-id") : null;
7358
7378
  }
7359
- }, Bo = [
7379
+ }, zo = [
7360
7380
  {
7361
7381
  type: "text",
7362
7382
  icon: re,
@@ -7392,7 +7412,7 @@ var Oo = class e {
7392
7412
  icon: Se,
7393
7413
  label: "URL"
7394
7414
  }
7395
- ], Vo = class {
7415
+ ], Bo = class {
7396
7416
  constructor(e) {
7397
7417
  this.popoverEl = null, this.boundOutsideClick = null, this.onSelect = e.onSelect;
7398
7418
  }
@@ -7404,7 +7424,7 @@ var Oo = class e {
7404
7424
  t.style.top = `${n.bottom + 4}px`, t.style.left = `${n.left}px`;
7405
7425
  let r = document.createElement("div");
7406
7426
  r.setAttribute("data-blok-database-property-type-heading", ""), r.textContent = "Property type", t.appendChild(r);
7407
- for (let e of Bo) {
7427
+ for (let e of zo) {
7408
7428
  let n = document.createElement("div");
7409
7429
  n.setAttribute("data-blok-database-property-type-option", e.type);
7410
7430
  let r = document.createElement("div");
@@ -7425,7 +7445,7 @@ var Oo = class e {
7425
7445
  destroy() {
7426
7446
  this.close();
7427
7447
  }
7428
- }, Ho = class {
7448
+ }, Vo = class {
7429
7449
  constructor(e) {
7430
7450
  this.drawer = null, this.currentRowId = null, this.currentRow = null, this.blokInstance = null, this.escapeHandler = null, this.outsideClickHandler = null, this.propertyTypePopover = null, this.wrapper = e.wrapper, this.readOnly = e.readOnly, this.i18n = e.i18n, this.toolsConfig = e.toolsConfig, this.titlePropertyId = e.titlePropertyId, this.descriptionPropertyId = e.descriptionPropertyId, this.schema = e.schema, this.onTitleChange = e.onTitleChange, this.onDescriptionChange = e.onDescriptionChange, this.onClose = e.onClose, this.onAddProperty = e.onAddProperty;
7431
7451
  }
@@ -7519,7 +7539,7 @@ var Oo = class e {
7519
7539
  if (!this.readOnly) {
7520
7540
  let e = document.createElement("button");
7521
7541
  e.setAttribute("data-blok-database-drawer-add-prop", ""), e.textContent = "+ Add a property", e.addEventListener("click", () => {
7522
- this.propertyTypePopover === null && (this.propertyTypePopover = new Vo({ onSelect: (e) => {
7542
+ this.propertyTypePopover === null && (this.propertyTypePopover = new Bo({ onSelect: (e) => {
7523
7543
  var t, n;
7524
7544
  (t = this.onAddProperty) == null || t.call(this, e), (n = this.propertyTypePopover) == null || n.close();
7525
7545
  } })), this.propertyTypePopover.open(e);
@@ -7600,7 +7620,7 @@ var Oo = class e {
7600
7620
  }));
7601
7621
  }).catch(() => {});
7602
7622
  }
7603
- }, Uo = class {
7623
+ }, Ho = class {
7604
7624
  constructor(e) {
7605
7625
  this.boundKeydown = null, this.wrapper = e.wrapper, this.onEscape = e.onEscape;
7606
7626
  }
@@ -7612,7 +7632,7 @@ var Oo = class e {
7612
7632
  destroy() {
7613
7633
  this.boundKeydown && (this.wrapper.removeEventListener("keydown", this.boundKeydown), this.boundKeydown = null);
7614
7634
  }
7615
- }, Wo = [{
7635
+ }, Uo = [{
7616
7636
  type: "board",
7617
7637
  icon: s,
7618
7638
  label: "Board",
@@ -7622,7 +7642,7 @@ var Oo = class e {
7622
7642
  icon: it,
7623
7643
  label: "List",
7624
7644
  description: "A simple linear view"
7625
- }], Go = class {
7645
+ }], Wo = class {
7626
7646
  constructor(e) {
7627
7647
  this.popover = null, this.onSelect = e.onSelect, this.onClose = e.onClose;
7628
7648
  }
@@ -7633,7 +7653,7 @@ var Oo = class e {
7633
7653
  items: [{
7634
7654
  type: D.Html,
7635
7655
  element: t
7636
- }, ...Wo.map((e) => {
7656
+ }, ...Uo.map((e) => {
7637
7657
  let t = this.createViewItem(e);
7638
7658
  return {
7639
7659
  type: D.Html,
@@ -7678,10 +7698,10 @@ var Oo = class e {
7678
7698
  destroy() {
7679
7699
  this.close();
7680
7700
  }
7681
- }, Ko = 10, qo = {
7701
+ }, Go = 10, Ko = {
7682
7702
  board: s,
7683
7703
  list: it
7684
- }, Jo = class {
7704
+ }, qo = class {
7685
7705
  constructor(e) {
7686
7706
  var t;
7687
7707
  this.element = null, this.barEl = null, this.addBtnEl = null, this.viewPopover = null, this.contextPopover = null, this.overflowDropdownEl = null, this.boundOverflowClose = null, this.moreBtnEl = null, this.isDragging = !1, this.dragViewId = "", this.dragStartX = 0, this.ghostEl = null, this.options = e, this.views = e.views, this.onReorder = e.onReorder, this.readOnly = (t = e.readOnly) == null ? !1 : t, this.boundDragMove = this.handleDragMove.bind(this), this.boundDragUp = this.handleDragUp.bind(this), this.boundDragCancel = this.cleanupDrag.bind(this), this.boundDragKeyDown = (e) => {
@@ -7732,7 +7752,7 @@ var Oo = class e {
7732
7752
  let n = document.createElement("div");
7733
7753
  n.setAttribute("data-blok-database-tab", ""), n.setAttribute("data-view-id", e.id), e.id === this.options.activeViewId && n.setAttribute("data-active", "");
7734
7754
  let r = document.createElement("span");
7735
- r.innerHTML = (t = qo[e.type]) == null ? "" : t, n.appendChild(r);
7755
+ r.innerHTML = (t = Ko[e.type]) == null ? "" : t, n.appendChild(r);
7736
7756
  let i = document.createElement("span");
7737
7757
  return i.setAttribute("data-blok-database-tab-name", ""), i.textContent = e.name, n.appendChild(i), n;
7738
7758
  }
@@ -7801,7 +7821,7 @@ var Oo = class e {
7801
7821
  }
7802
7822
  openViewPopover(e) {
7803
7823
  var t;
7804
- this.viewPopover !== null && this.viewPopover.destroy(), e.setAttribute("data-popover-open", ""), (t = this.barEl) == null || t.setAttribute("data-popover-open", ""), this.viewPopover = new Go({
7824
+ this.viewPopover !== null && this.viewPopover.destroy(), e.setAttribute("data-popover-open", ""), (t = this.barEl) == null || t.setAttribute("data-popover-open", ""), this.viewPopover = new Wo({
7805
7825
  onSelect: (e) => {
7806
7826
  this.options.onAddView(e);
7807
7827
  },
@@ -7839,7 +7859,7 @@ var Oo = class e {
7839
7859
  let t = document.createElement("div");
7840
7860
  t.setAttribute("data-blok-database-tab-overflow-item", ""), t.setAttribute("data-view-id", e.id), e.id === this.options.activeViewId && t.setAttribute("data-active", "");
7841
7861
  let r = document.createElement("span");
7842
- r.innerHTML = (a = qo[e.type]) == null ? "" : a, t.appendChild(r);
7862
+ r.innerHTML = (a = Ko[e.type]) == null ? "" : a, t.appendChild(r);
7843
7863
  let i = document.createElement("span");
7844
7864
  i.textContent = e.name, t.appendChild(i), t.addEventListener("click", () => {
7845
7865
  e.id !== this.options.activeViewId && this.options.onTabClick(e.id), this.closeOverflowDropdown();
@@ -7860,7 +7880,7 @@ var Oo = class e {
7860
7880
  }
7861
7881
  handleDragMove(e) {
7862
7882
  let t = Math.abs(e.clientX - this.dragStartX);
7863
- if (!(!this.isDragging && t < Ko)) {
7883
+ if (!(!this.isDragging && t < Go)) {
7864
7884
  if (!this.isDragging) {
7865
7885
  var n, r;
7866
7886
  this.isDragging = !0, (n = this.element) == null || n.setAttribute("data-dragging", "");
@@ -7883,7 +7903,7 @@ var Oo = class e {
7883
7903
  let a = Array.from((t = (n = this.element) == null ? void 0 : n.querySelectorAll("[data-blok-database-tab]")) == null ? [] : t).filter((e) => e.getAttribute("data-view-id") !== this.dragViewId), o = a.findIndex((t) => {
7884
7904
  let n = t.getBoundingClientRect();
7885
7905
  return e.clientX < (n.left + n.right) / 2;
7886
- }), s = o >= 0 ? a[o].getAttribute("data-view-id") : null, c = o > 0 ? a[o - 1].getAttribute("data-view-id") : o === -1 && a.length > 0 ? a[a.length - 1].getAttribute("data-view-id") : null, l = [...this.views].sort((e, t) => e.position < t.position ? -1 : 1), u = s === null ? null : l.find((e) => e.id === s), d = c === null ? null : l.find((e) => e.id === c), f = Do((r = d == null ? void 0 : d.position) == null ? null : r, (i = u == null ? void 0 : u.position) == null ? null : i);
7906
+ }), s = o >= 0 ? a[o].getAttribute("data-view-id") : null, c = o > 0 ? a[o - 1].getAttribute("data-view-id") : o === -1 && a.length > 0 ? a[a.length - 1].getAttribute("data-view-id") : null, l = [...this.views].sort((e, t) => e.position < t.position ? -1 : 1), u = s === null ? null : l.find((e) => e.id === s), d = c === null ? null : l.find((e) => e.id === c), f = Eo((r = d == null ? void 0 : d.position) == null ? null : r, (i = u == null ? void 0 : u.position) == null ? null : i);
7887
7907
  this.cleanupDrag(), this.onReorder(this.dragViewId, f);
7888
7908
  }
7889
7909
  cleanupDrag() {
@@ -7904,10 +7924,10 @@ var Oo = class e {
7904
7924
  getAddBtnEl() {
7905
7925
  return this.addBtnEl;
7906
7926
  }
7907
- }, Yo = class {
7927
+ }, Jo = class {
7908
7928
  constructor({ data: e, config: t, api: n, block: r, readOnly: i }) {
7909
7929
  var a, o;
7910
- this.element = null, this.titleElement = null, this.titleRowElement = null, this.boardContainer = null, this.tabBar = null, this.cardDrag = null, this.columnDrag = null, this.columnControls = null, this.listRowDrag = null, this.cardDrawer = null, this.keyboard = null, this.cardMenuPopover = null, this.api = n, this.block = r, this.readOnly = i, this.config = t == null ? {} : t, this.title = (a = e == null ? void 0 : e.title) == null ? "" : a, this.model = new Oo(e);
7930
+ this.element = null, this.titleElement = null, this.titleRowElement = null, this.boardContainer = null, this.tabBar = null, this.cardDrag = null, this.columnDrag = null, this.columnControls = null, this.listRowDrag = null, this.cardDrawer = null, this.keyboard = null, this.cardMenuPopover = null, this.api = n, this.block = r, this.readOnly = i, this.config = t == null ? {} : t, this.title = (a = e == null ? void 0 : e.title) == null ? "" : a, this.model = new Do(e);
7911
7931
  let s = this.model.getViews();
7912
7932
  this.activeViewId = (o = e == null ? void 0 : e.activeViewId) == null ? s.length > 0 ? s[0].id : "" : o, this.activateView(this.activeViewId);
7913
7933
  }
@@ -7955,7 +7975,7 @@ var Oo = class e {
7955
7975
  }
7956
7976
  createTitleElement() {
7957
7977
  let e = document.createElement("div");
7958
- return e.setAttribute("data-blok-database-title", ""), e.textContent = this.title, e.style.fontSize = "1.5rem", e.style.fontWeight = "600", e.style.lineHeight = "1.3", e.style.color = "var(--blok-text-primary)", e.style.outline = "none", e.style.cursor = "text", e.style.wordBreak = "break-word", e.className = Tt.join(" "), M(e, "New database"), this.readOnly || (e.setAttribute("contenteditable", "true"), e.addEventListener("keydown", (t) => {
7978
+ return e.setAttribute("data-blok-database-title", ""), e.textContent = this.title, e.style.fontSize = "1.5rem", e.style.fontWeight = "600", e.style.lineHeight = "1.3", e.style.color = "var(--blok-text-primary)", e.style.outline = "none", e.style.cursor = "text", e.style.wordBreak = "break-word", e.className = M.join(" "), N(e, "New database"), this.readOnly || (e.setAttribute("contenteditable", "true"), e.addEventListener("keydown", (t) => {
7959
7979
  (t.key === "Enter" || t.key === "Tab") && (t.preventDefault(), e.blur());
7960
7980
  })), e;
7961
7981
  }
@@ -8021,7 +8041,7 @@ var Oo = class e {
8021
8041
  n !== void 0 && (n.call("updatePosition", { position: t }), n.dispatchChange()), this.syncRowsFromBlocks();
8022
8042
  }
8023
8043
  activateView(e) {
8024
- this.model.getView(e) !== void 0 && (this.activeViewId = e, this.sync = new Mo(this.config.adapter, (e) => {
8044
+ this.model.getView(e) !== void 0 && (this.activeViewId = e, this.sync = new jo(this.config.adapter, (e) => {
8025
8045
  this.api.notifier.show({
8026
8046
  message: String(e),
8027
8047
  style: "error"
@@ -8100,7 +8120,7 @@ var Oo = class e {
8100
8120
  }), !this.readOnly && n !== null && e !== null && !e.contains(n) && e.appendChild(n), e instanceof HTMLElement && (e.style.display = t.length >= 2 ? "" : "none"));
8101
8121
  }
8102
8122
  createTabBar() {
8103
- return new Jo({
8123
+ return new qo({
8104
8124
  views: this.model.getViews(),
8105
8125
  activeViewId: this.activeViewId,
8106
8126
  onTabClick: (e) => this.switchView(e),
@@ -8119,7 +8139,7 @@ var Oo = class e {
8119
8139
  }
8120
8140
  renderBoardView(e, t) {
8121
8141
  let n = t === void 0 ? [] : this.model.getSelectOptions(t), r = t === void 0 ? /* @__PURE__ */ new Map() : this.model.getRowsGroupedBy(t);
8122
- return this.view = new ko({
8142
+ return this.view = new Oo({
8123
8143
  readOnly: this.readOnly,
8124
8144
  i18n: this.api.i18n,
8125
8145
  options: n,
@@ -8142,7 +8162,7 @@ var Oo = class e {
8142
8162
  let r = this.model.getSchema();
8143
8163
  if (t !== void 0) {
8144
8164
  let i = this.model.getSelectOptions(t), a = this.model.getRowsGroupedBy(t);
8145
- this.view = new Ao({
8165
+ this.view = new ko({
8146
8166
  readOnly: this.readOnly,
8147
8167
  i18n: this.api.i18n,
8148
8168
  rows: [],
@@ -8155,7 +8175,7 @@ var Oo = class e {
8155
8175
  return (t = a.get(e)) == null ? [] : t;
8156
8176
  }
8157
8177
  });
8158
- } else this.view = new Ao({
8178
+ } else this.view = new ko({
8159
8179
  readOnly: this.readOnly,
8160
8180
  i18n: this.api.i18n,
8161
8181
  rows: this.model.getOrderedRows(),
@@ -8273,7 +8293,7 @@ var Oo = class e {
8273
8293
  let o = a.config.options, s = o.length > 0 ? o[o.length - 1].position : null, c = {
8274
8294
  id: w(),
8275
8295
  label: this.api.i18n.t("tools.database.columnTitlePlaceholder"),
8276
- position: Oo.positionBetween(s, null)
8296
+ position: Do.positionBetween(s, null)
8277
8297
  };
8278
8298
  this.model.updateProperty(i, { config: { options: [...o, c] } }), (t = (n = this.view).appendGroup) == null || t.call(n, e, c), this.sync.syncUpdateProperty({
8279
8299
  propertyId: i,
@@ -8284,16 +8304,16 @@ var Oo = class e {
8284
8304
  var t;
8285
8305
  if (this.element === null) return;
8286
8306
  let n = this.model.getView(this.activeViewId), r = (n == null ? void 0 : n.type) === "list", i = this.model.getSchema().find((e) => e.type === "title"), a = (t = i == null ? void 0 : i.id) == null ? "" : t, o = this.model.getSchema().find((e) => e.type === "richText"), s = o == null ? void 0 : o.id;
8287
- r ? this.listRowDrag = new zo({
8307
+ r ? this.listRowDrag = new Ro({
8288
8308
  wrapper: e,
8289
8309
  onDrop: (e) => this.handleListRowDrop(e)
8290
- }) : (this.cardDrag = new Po({
8310
+ }) : (this.cardDrag = new No({
8291
8311
  wrapper: e,
8292
8312
  onDrop: (e) => this.handleRowDrop(e)
8293
- }), this.columnDrag = new Io({
8313
+ }), this.columnDrag = new Fo({
8294
8314
  wrapper: e,
8295
8315
  onDrop: (e) => this.handleGroupDrop(e)
8296
- }), this.columnControls = new Lo({
8316
+ }), this.columnControls = new Io({
8297
8317
  i18n: this.api.i18n,
8298
8318
  onRename: (e, t) => this.handleOptionRename(e, t),
8299
8319
  onDelete: (t) => this.handleOptionDelete(t, e),
@@ -8311,7 +8331,7 @@ var Oo = class e {
8311
8331
  changes: { config: { options: a } }
8312
8332
  });
8313
8333
  }
8314
- }), this.makeColumnHeadersEditable(e)), this.cardDrawer === null && (this.cardDrawer = new Ho({
8334
+ }), this.makeColumnHeadersEditable(e)), this.cardDrawer === null && (this.cardDrawer = new Vo({
8315
8335
  wrapper: this.element,
8316
8336
  readOnly: this.readOnly,
8317
8337
  i18n: this.api.i18n,
@@ -8345,7 +8365,7 @@ var Oo = class e {
8345
8365
  position: n.position
8346
8366
  }), (t = this.cardDrawer) == null || t.refreshSchema(this.model.getSchema());
8347
8367
  }
8348
- })), this.keyboard = new Uo({
8368
+ })), this.keyboard = new Ho({
8349
8369
  wrapper: e,
8350
8370
  onEscape: () => {
8351
8371
  var e;
@@ -8392,7 +8412,7 @@ var Oo = class e {
8392
8412
  }
8393
8413
  handleListRowDrop(e) {
8394
8414
  var t, n;
8395
- let { rowId: r, beforeRowId: i, afterRowId: a } = e, o = i === null ? void 0 : this.model.getRow(i), s = a === null ? void 0 : this.model.getRow(a), c = Oo.positionBetween((t = s == null ? void 0 : s.position) == null ? null : t, (n = o == null ? void 0 : o.position) == null ? null : n);
8415
+ let { rowId: r, beforeRowId: i, afterRowId: a } = e, o = i === null ? void 0 : this.model.getRow(i), s = a === null ? void 0 : this.model.getRow(a), c = Do.positionBetween((t = s == null ? void 0 : s.position) == null ? null : t, (n = o == null ? void 0 : o.position) == null ? null : n);
8396
8416
  this.moveRowBlock(r, c), this.rerenderView(), this.sync.syncMoveRow({
8397
8417
  rowId: r,
8398
8418
  position: c
@@ -8402,7 +8422,7 @@ var Oo = class e {
8402
8422
  var t, n;
8403
8423
  let { rowId: r, toOptionId: i, beforeRowId: a, afterRowId: o } = e, s = this.model.getView(this.activeViewId), c = s == null ? void 0 : s.groupBy;
8404
8424
  if (c === void 0) return;
8405
- let l = a === null ? void 0 : this.model.getRow(a), u = o === null ? void 0 : this.model.getRow(o), d = Oo.positionBetween((t = u == null ? void 0 : u.position) == null ? null : t, (n = l == null ? void 0 : l.position) == null ? null : n);
8425
+ let l = a === null ? void 0 : this.model.getRow(a), u = o === null ? void 0 : this.model.getRow(o), d = Do.positionBetween((t = u == null ? void 0 : u.position) == null ? null : t, (n = l == null ? void 0 : l.position) == null ? null : n);
8406
8426
  this.updateRowBlock(r, { [c]: i }), this.moveRowBlock(r, d), this.rerenderView(), this.sync.syncUpdateRow({
8407
8427
  rowId: r,
8408
8428
  properties: { [c]: i }
@@ -8419,7 +8439,7 @@ var Oo = class e {
8419
8439
  if ((c == null ? void 0 : c.config) === void 0) return;
8420
8440
  let l = [...c.config.options], u = l.findIndex((e) => e.id === r);
8421
8441
  if (u === -1) return;
8422
- let d = i === null ? void 0 : l.find((e) => e.id === i), f = a === null ? void 0 : l.find((e) => e.id === a), p = Oo.positionBetween((t = f == null ? void 0 : f.position) == null ? null : t, (n = d == null ? void 0 : d.position) == null ? null : n);
8442
+ let d = i === null ? void 0 : l.find((e) => e.id === i), f = a === null ? void 0 : l.find((e) => e.id === a), p = Do.positionBetween((t = f == null ? void 0 : f.position) == null ? null : t, (n = d == null ? void 0 : d.position) == null ? null : n);
8423
8443
  l[u] = A(A({}, l[u]), {}, { position: p }), this.model.updateProperty(s, { config: { options: l } }), this.moveColumnInDom(r, i), this.sync.syncUpdateProperty({
8424
8444
  propertyId: s,
8425
8445
  changes: { config: { options: l } }
@@ -8478,7 +8498,7 @@ var Oo = class e {
8478
8498
  let m = p.querySelector("[data-blok-database-board]");
8479
8499
  m !== null && (m.scrollLeft = f), this.attachViewListeners(p), this.initSubsystems(p);
8480
8500
  }
8481
- }, Xo = class {
8501
+ }, Yo = class {
8482
8502
  constructor({ data: e }) {
8483
8503
  var t, n;
8484
8504
  this._data = {
@@ -8515,7 +8535,7 @@ var Oo = class e {
8515
8535
  return !0;
8516
8536
  }
8517
8537
  setReadOnly(e) {}
8518
- }, Zo = class {
8538
+ }, Xo = class {
8519
8539
  constructor(e) {
8520
8540
  this.element = null;
8521
8541
  }
@@ -8568,7 +8588,7 @@ var Oo = class e {
8568
8588
  static get sanitize() {
8569
8589
  return {};
8570
8590
  }
8571
- }, Qo = "tools.quote.placeholder", $o = [
8591
+ }, Zo = "tools.quote.placeholder", Qo = [
8572
8592
  "border-l-[3px]",
8573
8593
  "border-current",
8574
8594
  "pl-[0.9em]",
@@ -8578,7 +8598,7 @@ var Oo = class e {
8578
8598
  "outline-hidden",
8579
8599
  "mt-[0.3em]",
8580
8600
  "mb-[0.3em]"
8581
- ], es = "text-[1.2em]", ts = class {
8601
+ ], $o = "text-[1.2em]", es = class {
8582
8602
  constructor({ data: e, api: t, readOnly: n }) {
8583
8603
  var r, i;
8584
8604
  this.placeholderCleanup = null, this._element = null, this.api = t, this.readOnly = n, this._data = {
@@ -8591,13 +8611,13 @@ var Oo = class e {
8591
8611
  }
8592
8612
  drawView() {
8593
8613
  let e = document.createElement("blockquote");
8594
- return e.className = j(this.api.styles.block, $o, Dt, this._data.size === "large" ? es : ""), e.setAttribute(k.tool, "quote"), e.contentEditable = "false", this._data.text ? e.innerHTML = this._data.text : this.readOnly && (e.innerHTML = "<br>"), this.readOnly || (e.contentEditable = "true", e.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = M(e, this.api.i18n.t(Qo), "data-blok-placeholder-active")), e;
8614
+ return e.className = j(this.api.styles.block, Qo, Et, this._data.size === "large" ? $o : ""), e.setAttribute(k.tool, "quote"), e.contentEditable = "false", this._data.text ? e.innerHTML = this._data.text : this.readOnly && (e.innerHTML = "<br>"), this.readOnly || (e.contentEditable = "true", e.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = N(e, this.api.i18n.t(Zo), "data-blok-placeholder-active")), e;
8595
8615
  }
8596
8616
  render() {
8597
8617
  return this._element || (this._element = this.drawView()), this._element;
8598
8618
  }
8599
8619
  setReadOnly(e) {
8600
- this._element && (this.readOnly = e, e ? (this._element.contentEditable = "false", this._element.removeEventListener("keyup", this.onKeyUp), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null), kt(this._element) && (this._element.innerHTML = "<br>")) : (this._element.contentEditable = "true", this._element.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = M(this._element, this.api.i18n.t(Qo), "data-blok-placeholder-active"), this._element.innerHTML === "<br>" && (this._element.innerHTML = "")));
8620
+ this._element && (this.readOnly = e, e ? (this._element.contentEditable = "false", this._element.removeEventListener("keyup", this.onKeyUp), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null), Ot(this._element) && (this._element.innerHTML = "<br>")) : (this._element.contentEditable = "true", this._element.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = N(this._element, this.api.i18n.t(Zo), "data-blok-placeholder-active"), this._element.innerHTML === "<br>" && (this._element.innerHTML = "")));
8601
8621
  }
8602
8622
  save(e) {
8603
8623
  return {
@@ -8637,7 +8657,7 @@ var Oo = class e {
8637
8657
  }];
8638
8658
  }
8639
8659
  setSize(e) {
8640
- this._data.size = e, this._element && (this._element.className = j(this.api.styles.block, $o, Dt, e === "large" ? es : ""));
8660
+ this._data.size = e, this._element && (this._element.className = j(this.api.styles.block, Qo, Et, e === "large" ? $o : ""));
8641
8661
  }
8642
8662
  onPaste(e) {
8643
8663
  let t = e.detail;
@@ -8685,7 +8705,7 @@ var Oo = class e {
8685
8705
  static get pasteConfig() {
8686
8706
  return { tags: ["BLOCKQUOTE"] };
8687
8707
  }
8688
- }, ns = "tools.code.language", rs = "tools.code.copied", is = "tools.code.copyCode", as = "tools.code.searchLanguage", os = "plain text", ss = [
8708
+ }, ts = "tools.code.language", ns = "tools.code.copied", rs = "tools.code.copyCode", is = "tools.code.searchLanguage", as = "plain text", os = [
8689
8709
  {
8690
8710
  id: "plain text",
8691
8711
  name: "Plain Text"
@@ -8810,12 +8830,12 @@ var Oo = class e {
8810
8830
  id: "lua",
8811
8831
  name: "Lua"
8812
8832
  }
8813
- ], cs = "group/code flex flex-col rounded-xl border border-border-secondary bg-bg-secondary overflow-hidden my-2", ls = "flex items-center gap-1 px-3 py-1.5 text-xs text-gray-text", us = "inline-flex items-center px-1.5 py-0.5 rounded cursor-pointer bg-transparent border-0 text-xs text-gray-text font-medium transition-colors can-hover:hover:bg-item-hover-bg select-none", ds = "flex items-center gap-1 opacity-0 group-hover/code:opacity-100 transition-opacity", fs = "p-1 rounded cursor-pointer bg-transparent border-0 text-gray-text transition-colors can-hover:hover:bg-item-hover-bg flex items-center justify-center", ps = "p-1.5 rounded-lg cursor-pointer bg-transparent border-0 text-gray-text transition-colors can-hover:hover:bg-item-hover-bg flex items-center justify-center", ms = "block px-4 py-3 font-mono text-sm leading-relaxed outline-hidden whitespace-pre-wrap overflow-x-auto min-h-[1.5em]", hs = "text-xs text-gray-text font-medium select-none", gs = new Set(["latex", "mermaid"]), _s = "tools.code.codeTab", vs = "tools.code.previewTab", ys = "px-4 py-3 overflow-x-auto min-h-[1.5em] flex justify-center", bs = "tools.code.sideBySide", xs = "flex items-center rounded-lg border border-border-secondary p-0.5 gap-0.5", Ss = "p-1 rounded cursor-pointer bg-transparent border-0 text-gray-text transition-colors flex items-center justify-center", Cs = "p-1 rounded cursor-pointer bg-item-hover-bg border-0 text-primary transition-colors flex items-center justify-center", ws = "p-[6px] rounded cursor-pointer bg-transparent border-0 text-gray-text transition-colors flex items-center justify-center", Ts = "p-[6px] rounded cursor-pointer bg-item-hover-bg border-0 text-primary transition-colors flex items-center justify-center", Es = "flex flex-col overflow-hidden", Ds = "flex flex-row overflow-hidden", Os = "flex-1 min-w-0 overflow-hidden", ks = "one-light", As = "vitesse-dark", js = ".dark", Ms = new Set(ss.map((e) => e.id).filter((e) => e !== os)), Ns = "flex overflow-hidden", Ps = "select-none text-right pl-4 pr-3 py-3 font-mono text-sm leading-relaxed text-gray-text/40 shrink-0", Fs = "leading-relaxed";
8833
+ ], ss = "group/code flex flex-col rounded-xl border border-border-secondary bg-bg-secondary overflow-hidden my-2", cs = "flex items-center gap-1 px-3 py-1.5 text-xs text-gray-text", ls = "inline-flex items-center px-1.5 py-0.5 rounded cursor-pointer bg-transparent border-0 text-xs text-gray-text font-medium transition-colors can-hover:hover:bg-item-hover-bg select-none", us = "flex items-center gap-1 opacity-0 group-hover/code:opacity-100 transition-opacity", ds = "p-1 rounded cursor-pointer bg-transparent border-0 text-gray-text transition-colors can-hover:hover:bg-item-hover-bg flex items-center justify-center", fs = "p-1.5 rounded-lg cursor-pointer bg-transparent border-0 text-gray-text transition-colors can-hover:hover:bg-item-hover-bg flex items-center justify-center", ps = "block px-4 py-3 font-mono text-sm leading-relaxed outline-hidden whitespace-pre-wrap overflow-x-auto min-h-[1.5em]", ms = "text-xs text-gray-text font-medium select-none", hs = new Set(["latex", "mermaid"]), gs = "tools.code.codeTab", _s = "tools.code.previewTab", vs = "px-4 py-3 overflow-x-auto min-h-[1.5em] flex justify-center", ys = "tools.code.sideBySide", bs = "flex items-center rounded-lg border border-border-secondary p-0.5 gap-0.5", xs = "p-1 rounded cursor-pointer bg-transparent border-0 text-gray-text transition-colors flex items-center justify-center", Ss = "p-1 rounded cursor-pointer bg-item-hover-bg border-0 text-primary transition-colors flex items-center justify-center", Cs = "p-[6px] rounded cursor-pointer bg-transparent border-0 text-gray-text transition-colors flex items-center justify-center", ws = "p-[6px] rounded cursor-pointer bg-item-hover-bg border-0 text-primary transition-colors flex items-center justify-center", Ts = "flex flex-col overflow-hidden", Es = "flex flex-row overflow-hidden", Ds = "flex-1 min-w-0 overflow-hidden", Os = "one-light", ks = "vitesse-dark", As = ".dark", js = new Set(os.map((e) => e.id).filter((e) => e !== as)), Ms = "flex overflow-hidden", Ns = "select-none text-right pl-4 pr-3 py-3 font-mono text-sm leading-relaxed text-gray-text/40 shrink-0", Ps = "leading-relaxed";
8814
8834
  //#endregion
8815
8835
  //#region src/tools/code/dom-builder.ts
8816
- function Is(e) {
8836
+ function Fs(e) {
8817
8837
  let t = document.createElement("div");
8818
- t.className = xs, t.setAttribute("role", "group"), t.setAttribute("data-blok-testid", "code-view-mode");
8838
+ t.className = bs, t.setAttribute("role", "group"), t.setAttribute("data-blok-testid", "code-view-mode");
8819
8839
  let n = [
8820
8840
  {
8821
8841
  mode: "code",
@@ -8835,61 +8855,61 @@ function Is(e) {
8835
8855
  ];
8836
8856
  for (let { mode: e, icon: r, label: i } of n) {
8837
8857
  let n = document.createElement("button"), a = e === "preview";
8838
- n.type = "button", n.className = a ? ws : Ss, n.innerHTML = r, n.setAttribute("aria-label", i), n.setAttribute("aria-pressed", "false"), n.setAttribute("data-blok-testid", `code-mode-${e}`), n.setAttribute("data-mode", e), t.appendChild(n);
8858
+ n.type = "button", n.className = a ? Cs : xs, n.innerHTML = r, n.setAttribute("aria-label", i), n.setAttribute("aria-pressed", "false"), n.setAttribute("data-blok-testid", `code-mode-${e}`), n.setAttribute("data-mode", e), t.appendChild(n);
8839
8859
  }
8840
8860
  let i = document.createElement("div");
8841
- i.className = ys, i.setAttribute("data-blok-testid", "code-preview");
8861
+ i.className = vs, i.setAttribute("data-blok-testid", "code-preview");
8842
8862
  let a = document.createElement("div");
8843
- return a.className = Es, a.setAttribute("data-blok-testid", "code-split-container"), {
8863
+ return a.className = Ts, a.setAttribute("data-blok-testid", "code-split-container"), {
8844
8864
  viewModeContainer: t,
8845
8865
  previewElement: i,
8846
8866
  splitContainer: a
8847
8867
  };
8848
8868
  }
8849
- function Ls(e, t) {
8869
+ function Is(e, t) {
8850
8870
  let n = Array.from(e.querySelectorAll("[data-mode]"));
8851
8871
  for (let e of n) {
8852
8872
  let n = e.getAttribute("data-mode") === t, r = e.getAttribute("data-mode") === "preview";
8853
- e.setAttribute("aria-pressed", String(n)), r ? e.className = n ? Ts : ws : e.className = n ? Cs : Ss;
8873
+ e.setAttribute("aria-pressed", String(n)), r ? e.className = n ? ws : Cs : e.className = n ? Ss : xs;
8854
8874
  }
8855
8875
  }
8856
- function Rs(e) {
8876
+ function Ls(e) {
8857
8877
  var t, n, r;
8858
8878
  let { code: i, languageName: a, readOnly: o, copyLabel: s, previewable: c, viewModeLabels: l } = e, u = document.createElement("div");
8859
- u.className = cs;
8879
+ u.className = ss;
8860
8880
  let d = document.createElement("div");
8861
- d.className = ls;
8881
+ d.className = cs;
8862
8882
  let f = document.createElement("button");
8863
- f.type = "button", f.className = us, f.setAttribute("aria-haspopup", "listbox"), f.setAttribute("data-blok-testid", "code-language-btn");
8883
+ f.type = "button", f.className = ls, f.setAttribute("aria-haspopup", "listbox"), f.setAttribute("data-blok-testid", "code-language-btn");
8864
8884
  let p = document.createElement("span");
8865
8885
  p.textContent = a, f.appendChild(p);
8866
8886
  let m = document.createElement("span");
8867
8887
  m.className = "inline-flex items-center ml-0.5 -mr-0.5", m.innerHTML = te, f.appendChild(m);
8868
8888
  let h = document.createElement("div");
8869
8889
  h.className = "flex-1";
8870
- let g = !o && l ? Is(l) : null, _ = (t = g == null ? void 0 : g.viewModeContainer) == null ? null : t, v = (n = g == null ? void 0 : g.previewElement) == null ? null : n, y = (r = g == null ? void 0 : g.splitContainer) == null ? null : r;
8890
+ let g = !o && l ? Fs(l) : null, _ = (t = g == null ? void 0 : g.viewModeContainer) == null ? null : t, v = (n = g == null ? void 0 : g.previewElement) == null ? null : n, y = (r = g == null ? void 0 : g.splitContainer) == null ? null : r;
8871
8891
  _ && (_.hidden = !c);
8872
8892
  let b = document.createElement("button");
8873
- b.type = "button", b.className = c ? ps : fs, b.innerHTML = ee, b.setAttribute("aria-label", s), b.setAttribute("data-blok-testid", "code-copy-btn");
8893
+ b.type = "button", b.className = c ? fs : ds, b.innerHTML = ee, b.setAttribute("aria-label", s), b.setAttribute("data-blok-testid", "code-copy-btn");
8874
8894
  let x = document.createElement("code");
8875
- x.className = ms, x.setAttribute("data-blok-testid", "code-content"), i && (x.textContent = i), o || (x.setAttribute("contenteditable", "plaintext-only"), x.setAttribute("spellcheck", "false"));
8895
+ x.className = ps, x.setAttribute("data-blok-testid", "code-content"), i && (x.textContent = i), o || (x.setAttribute("contenteditable", "plaintext-only"), x.setAttribute("spellcheck", "false"));
8876
8896
  let S = document.createElement("div");
8877
- S.className = Ps, S.setAttribute("aria-hidden", "true"), S.setAttribute("data-blok-testid", "code-gutter");
8897
+ S.className = Ns, S.setAttribute("aria-hidden", "true"), S.setAttribute("data-blok-testid", "code-gutter");
8878
8898
  let ne = i ? i.split("\n").length : 1;
8879
8899
  Array.from({ length: ne }, (e, t) => {
8880
8900
  let n = document.createElement("div");
8881
- n.className = Fs, n.textContent = String(t + 1), S.appendChild(n);
8901
+ n.className = Ps, n.textContent = String(t + 1), S.appendChild(n);
8882
8902
  }), d.appendChild(f), d.appendChild(h);
8883
8903
  let re = document.createElement("div");
8884
- re.className = ds, _ && re.appendChild(_), re.appendChild(b), d.appendChild(re);
8904
+ re.className = us, _ && re.appendChild(_), re.appendChild(b), d.appendChild(re);
8885
8905
  let ie = document.createElement("pre");
8886
8906
  ie.appendChild(x);
8887
8907
  let C = document.createElement("div");
8888
- if (C.className = Ns, C.appendChild(S), C.appendChild(ie), u.appendChild(d), y && v) {
8908
+ if (C.className = Ms, C.appendChild(S), C.appendChild(ie), u.appendChild(d), y && v) {
8889
8909
  let e = document.createElement("div");
8890
- e.className = Os, e.appendChild(C);
8910
+ e.className = Ds, e.appendChild(C);
8891
8911
  let t = document.createElement("div");
8892
- t.className = Os, t.appendChild(v), y.appendChild(e), y.appendChild(t), u.appendChild(y);
8912
+ t.className = Ds, t.appendChild(v), y.appendChild(e), y.appendChild(t), u.appendChild(y);
8893
8913
  } else u.appendChild(C);
8894
8914
  return {
8895
8915
  wrapper: u,
@@ -8905,10 +8925,10 @@ function Rs(e) {
8905
8925
  }
8906
8926
  //#endregion
8907
8927
  //#region src/tools/code/code-keyboard.ts
8908
- function zs(e, t, n) {
8909
- return e.key === "Enter" && e.shiftKey ? (n(), !0) : e.key === "Enter" ? (Bs(t), !0) : e.key === "Tab" && !e.shiftKey ? (Vs(), !0) : e.key === "Tab" && e.shiftKey ? (Us(t), !0) : !1;
8928
+ function Rs(e, t, n) {
8929
+ return e.key === "Enter" && e.shiftKey ? (n(), !0) : e.key === "Enter" ? (zs(t), !0) : e.key === "Tab" && !e.shiftKey ? (Bs(), !0) : e.key === "Tab" && e.shiftKey ? (Hs(t), !0) : !1;
8910
8930
  }
8911
- function Bs(e) {
8931
+ function zs(e) {
8912
8932
  var t;
8913
8933
  let n = window.getSelection();
8914
8934
  if (!n || n.rangeCount === 0) return;
@@ -8916,9 +8936,9 @@ function Bs(e) {
8916
8936
  i.selectNodeContents(e), i.setEnd(r.startContainer, r.startOffset);
8917
8937
  let a = i.toString().length, o = (t = e.textContent) == null ? "" : t, s = o.substring(0, a), c = o.substring(a);
8918
8938
  for (; e.firstChild;) e.removeChild(e.firstChild);
8919
- e.appendChild(document.createTextNode(s + "\n" + c)), Ws(e, a + 1);
8939
+ e.appendChild(document.createTextNode(s + "\n" + c)), Us(e, a + 1);
8920
8940
  }
8921
- function Vs() {
8941
+ function Bs() {
8922
8942
  let e = window.getSelection();
8923
8943
  if (!e || e.rangeCount === 0) return;
8924
8944
  let t = e.getRangeAt(0);
@@ -8926,23 +8946,23 @@ function Vs() {
8926
8946
  let n = document.createTextNode(" ");
8927
8947
  t.insertNode(n), t.setStartAfter(n), t.collapse(!0), e.removeAllRanges(), e.addRange(t);
8928
8948
  }
8929
- function Hs(e) {
8949
+ function Vs(e) {
8930
8950
  let t = Math.min(2, e.length), n = e.substring(0, t).match(/^ */);
8931
8951
  return n ? n[0].length : 0;
8932
8952
  }
8933
- function Us(e) {
8953
+ function Hs(e) {
8934
8954
  var t;
8935
8955
  let n = window.getSelection();
8936
8956
  if (!n || n.rangeCount === 0) return;
8937
8957
  let r = n.getRangeAt(0), i = (t = e.textContent) == null ? "" : t, a = r.cloneRange();
8938
8958
  a.selectNodeContents(e), a.setEnd(r.startContainer, r.startOffset);
8939
- let o = a.toString().length, s = i.lastIndexOf("\n", o - 1) + 1, c = Hs(i.substring(s));
8959
+ let o = a.toString().length, s = i.lastIndexOf("\n", o - 1) + 1, c = Vs(i.substring(s));
8940
8960
  if (c === 0) return;
8941
8961
  let l = i.substring(0, s) + i.substring(s + c);
8942
8962
  for (; e.firstChild;) e.removeChild(e.firstChild);
8943
- e.appendChild(document.createTextNode(l)), Ws(e, Math.max(s, o - c));
8963
+ e.appendChild(document.createTextNode(l)), Us(e, Math.max(s, o - c));
8944
8964
  }
8945
- function Ws(e, t) {
8965
+ function Us(e, t) {
8946
8966
  let n = window.getSelection();
8947
8967
  if (!n) return;
8948
8968
  let r = document.createTreeWalker(e, NodeFilter.SHOW_TEXT), i = (e) => {
@@ -8961,23 +8981,23 @@ function Ws(e, t) {
8961
8981
  }
8962
8982
  //#endregion
8963
8983
  //#region src/tools/code/katex-loader.ts
8964
- var Gs = {
8984
+ var Ws = {
8965
8985
  katexPromise: null,
8966
8986
  cssInjected: !1
8967
8987
  };
8968
- function Ks() {
8969
- if (Gs.cssInjected) return;
8970
- Gs.cssInjected = !0;
8988
+ function Gs() {
8989
+ if (Ws.cssInjected) return;
8990
+ Ws.cssInjected = !0;
8971
8991
  let e = document.createElement("link");
8972
8992
  e.rel = "stylesheet", e.setAttribute("data-katex-css", ""), e.href = "https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css", document.head.appendChild(e);
8973
8993
  }
8974
- async function qs() {
8975
- return Gs.katexPromise || (Gs.katexPromise = import("./katex-B8jUB5Cv.mjs").then((e) => e.n).then((e) => e.default)), Gs.katexPromise;
8994
+ async function Ks() {
8995
+ return Ws.katexPromise || (Ws.katexPromise = import("./katex-B8jUB5Cv.mjs").then((e) => e.n).then((e) => e.default)), Ws.katexPromise;
8976
8996
  }
8977
- async function Js(e) {
8978
- Ks();
8997
+ async function qs(e) {
8998
+ Gs();
8979
8999
  try {
8980
- return (await qs()).renderToString(e, {
9000
+ return (await Ks()).renderToString(e, {
8981
9001
  throwOnError: !1,
8982
9002
  displayMode: !0
8983
9003
  });
@@ -8987,21 +9007,21 @@ async function Js(e) {
8987
9007
  }
8988
9008
  //#endregion
8989
9009
  //#region src/tools/code/mermaid-loader.ts
8990
- var Ys = {
9010
+ var Js = {
8991
9011
  mermaidPromise: null,
8992
9012
  initialized: !1
8993
9013
  };
8994
- async function Xs() {
8995
- Ys.mermaidPromise || (Ys.mermaidPromise = import("./mermaid.core-C40gcVfv.mjs").then((e) => e.default));
8996
- let e = await Ys.mermaidPromise;
8997
- return Ys.initialized || (Ys.initialized = !0, e.initialize({
9014
+ async function Ys() {
9015
+ Js.mermaidPromise || (Js.mermaidPromise = import("./mermaid.core-C40gcVfv.mjs").then((e) => e.default));
9016
+ let e = await Js.mermaidPromise;
9017
+ return Js.initialized || (Js.initialized = !0, e.initialize({
8998
9018
  startOnLoad: !1,
8999
9019
  securityLevel: "strict"
9000
9020
  })), e;
9001
9021
  }
9002
- async function Zs(e) {
9022
+ async function Xs(e) {
9003
9023
  try {
9004
- let t = await Xs();
9024
+ let t = await Ys();
9005
9025
  if (await t.parse(e, { suppressErrors: !0 }) === !1) return "<span class=\"text-red-500 text-sm\">Invalid Mermaid syntax</span>";
9006
9026
  let n = `mermaid-${crypto.randomUUID()}`;
9007
9027
  return (await t.render(n, e)).svg;
@@ -9011,7 +9031,7 @@ async function Zs(e) {
9011
9031
  }
9012
9032
  //#endregion
9013
9033
  //#region src/tools/code/shiki-loader.ts
9014
- var Qs = {
9034
+ var Zs = {
9015
9035
  javascript: () => import("./javascript-DilE9EuZ.mjs"),
9016
9036
  typescript: () => import("./typescript-DhtGMhWX.mjs").then((e) => e.n),
9017
9037
  python: () => import("./python-DYiHKGPV.mjs"),
@@ -9042,29 +9062,29 @@ var Qs = {
9042
9062
  lua: () => import("./lua-COOfzihE.mjs"),
9043
9063
  latex: () => import("./latex-DY1HNB4U.mjs"),
9044
9064
  mermaid: () => import("./mermaid-BKA834jS.mjs")
9045
- }, $s = {
9065
+ }, Qs = {
9046
9066
  highlighterPromise: null,
9047
9067
  highlighter: null
9048
9068
  };
9049
- function ec(e) {
9050
- return Ms.has(e);
9069
+ function $s(e) {
9070
+ return js.has(e);
9051
9071
  }
9052
- async function tc() {
9053
- return $s.highlighterPromise || ($s.highlighterPromise = (async () => {
9072
+ async function ec() {
9073
+ return Qs.highlighterPromise || (Qs.highlighterPromise = (async () => {
9054
9074
  let { createHighlighterCore: e } = await import("./core-B7mxBIHA.mjs"), { createJavaScriptRegexEngine: t } = await import("./engine-javascript-Bmmg8uL9.mjs"), n = await e({
9055
9075
  themes: [import("./one-light-Di_o5Kb7.mjs"), import("./vitesse-dark-B5oAIYZ5.mjs")],
9056
9076
  langs: [],
9057
9077
  engine: t()
9058
9078
  });
9059
- return $s.highlighter = n, n;
9060
- })()), $s.highlighterPromise;
9079
+ return Qs.highlighter = n, n;
9080
+ })()), Qs.highlighterPromise;
9061
9081
  }
9062
- async function nc(e, t) {
9082
+ async function tc(e, t) {
9063
9083
  if (e.getLoadedLanguages().includes(t)) return;
9064
- let n = Qs[t];
9084
+ let n = Zs[t];
9065
9085
  n && await e.loadLanguage(await n());
9066
9086
  }
9067
- function rc(e) {
9087
+ function nc(e) {
9068
9088
  return {
9069
9089
  tokens: e.tokens.map((t) => t.map((t) => {
9070
9090
  var n;
@@ -9077,52 +9097,52 @@ function rc(e) {
9077
9097
  fg: e.fg
9078
9098
  };
9079
9099
  }
9080
- async function ic(e, t) {
9081
- if (!ec(t)) return null;
9100
+ async function rc(e, t) {
9101
+ if (!$s(t)) return null;
9082
9102
  try {
9083
- let n = await tc();
9084
- await nc(n, t);
9103
+ let n = await ec();
9104
+ await tc(n, t);
9085
9105
  let r = n.codeToTokens(e, {
9086
9106
  lang: t,
9087
- theme: ks
9107
+ theme: Os
9088
9108
  }), i = n.codeToTokens(e, {
9089
9109
  lang: t,
9090
- theme: As
9110
+ theme: ks
9091
9111
  });
9092
9112
  return {
9093
- light: rc(r),
9094
- dark: rc(i)
9113
+ light: nc(r),
9114
+ dark: nc(i)
9095
9115
  };
9096
9116
  } catch (e) {
9097
- return $s.highlighterPromise = null, $s.highlighter = null, null;
9117
+ return Qs.highlighterPromise = null, Qs.highlighter = null, null;
9098
9118
  }
9099
9119
  }
9100
9120
  //#endregion
9101
9121
  //#region src/tools/code/highlight-applier.ts
9102
- var ac = {
9122
+ var ic = {
9103
9123
  stylesheet: null,
9104
9124
  knownRules: /* @__PURE__ */ new Set()
9105
9125
  };
9106
- function oc() {
9126
+ function ac() {
9107
9127
  return typeof CSS < "u" && "highlights" in CSS;
9108
9128
  }
9109
- function sc() {
9129
+ function oc() {
9110
9130
  return CSS.highlights;
9111
9131
  }
9112
- function cc() {
9113
- return ac.stylesheet || (ac.stylesheet = new CSSStyleSheet(), document.adoptedStyleSheets = [...document.adoptedStyleSheets, ac.stylesheet]), ac.stylesheet;
9132
+ function sc() {
9133
+ return ic.stylesheet || (ic.stylesheet = new CSSStyleSheet(), document.adoptedStyleSheets = [...document.adoptedStyleSheets, ic.stylesheet]), ic.stylesheet;
9114
9134
  }
9115
- function lc(e) {
9135
+ function cc(e) {
9116
9136
  let t = e.replace("#", "").toLowerCase();
9117
9137
  return t.length > 6 ? t.substring(0, 6) : t;
9118
9138
  }
9119
- function uc(e, t, n, r) {
9139
+ function lc(e, t, n, r) {
9120
9140
  let i = `${r == null ? "" : r}::${t}`;
9121
- if (ac.knownRules.has(i)) return;
9141
+ if (ic.knownRules.has(i)) return;
9122
9142
  let a = r ? `${r} ::highlight(${t}) { color: ${n}; }` : `::highlight(${t}) { color: ${n}; }`;
9123
- e.insertRule(a, e.cssRules.length), ac.knownRules.add(i);
9143
+ e.insertRule(a, e.cssRules.length), ic.knownRules.add(i);
9124
9144
  }
9125
- function dc(e, t) {
9145
+ function uc(e, t) {
9126
9146
  let n = document.createTreeWalker(e, NodeFilter.SHOW_TEXT), r = (i, a) => {
9127
9147
  var o, s;
9128
9148
  if (!i) {
@@ -9143,7 +9163,7 @@ function dc(e, t) {
9143
9163
  };
9144
9164
  return r(n.nextNode(), 0);
9145
9165
  }
9146
- function fc(e) {
9166
+ function dc(e) {
9147
9167
  return e.split("\n").reduce((e, t) => ({
9148
9168
  offsets: [...e.offsets, e.pos],
9149
9169
  pos: e.pos + t.length + 1
@@ -9152,30 +9172,30 @@ function fc(e) {
9152
9172
  pos: 0
9153
9173
  }).offsets;
9154
9174
  }
9155
- function pc(e, t, n, r, i, a, o, s, c) {
9175
+ function fc(e, t, n, r, i, a, o, s, c) {
9156
9176
  if (!r.content.trim()) return;
9157
9177
  let l = n + r.offset, u = l + r.content.length;
9158
9178
  if (u > t.length) return;
9159
- let d = dc(e, l), f = dc(e, u);
9179
+ let d = uc(e, l), f = uc(e, u);
9160
9180
  if (!(!d || !f)) try {
9161
9181
  let e = new Range();
9162
9182
  e.setStart(d.node, d.offset), e.setEnd(f.node, f.offset);
9163
- let t = `blok-${i}-${lc(r.color)}`, n = sc();
9164
- uc(s, t, r.color, a);
9183
+ let t = `blok-${i}-${cc(r.color)}`, n = oc();
9184
+ lc(s, t, r.color, a);
9165
9185
  let l = n.get(t), u = l == null ? new Highlight() : l;
9166
9186
  l || (u.priority = o, n.set(t, u)), u.add(e), c.push([t, e]);
9167
9187
  } catch (e) {}
9168
9188
  }
9169
- function mc(e, t, n, r, i, a, o, s, c) {
9189
+ function pc(e, t, n, r, i, a, o, s, c) {
9170
9190
  for (let [l, u] of r.tokens.entries()) {
9171
9191
  let r = n[l];
9172
- if (r !== void 0) for (let n of u) pc(e, t, r, n, i, a, o, s, c);
9192
+ if (r !== void 0) for (let n of u) fc(e, t, r, n, i, a, o, s, c);
9173
9193
  }
9174
9194
  }
9175
- function hc(e, t) {
9195
+ function mc(e, t) {
9176
9196
  var n;
9177
- if (!oc()) return () => {};
9178
- let r = cc(), i = [], a = (n = e.textContent) == null ? "" : n, o = fc(a), s = [[
9197
+ if (!ac()) return () => {};
9198
+ let r = sc(), i = [], a = (n = e.textContent) == null ? "" : n, o = dc(a), s = [[
9179
9199
  "l",
9180
9200
  t.light,
9181
9201
  void 0,
@@ -9183,13 +9203,13 @@ function hc(e, t) {
9183
9203
  ], [
9184
9204
  "d",
9185
9205
  t.dark,
9186
- js,
9206
+ As,
9187
9207
  1
9188
9208
  ]];
9189
- for (let [t, n, c, l] of s) mc(e, a, o, n, t, c, l, r, i);
9190
- return () => gc(i, sc());
9209
+ for (let [t, n, c, l] of s) pc(e, a, o, n, t, c, l, r, i);
9210
+ return () => hc(i, oc());
9191
9211
  }
9192
- function gc(e, t) {
9212
+ function hc(e, t) {
9193
9213
  for (let [n, r] of e) {
9194
9214
  let e = t.get(n);
9195
9215
  e && (e.delete(r), e.size === 0 && t.delete(n));
@@ -9197,7 +9217,7 @@ function gc(e, t) {
9197
9217
  }
9198
9218
  //#endregion
9199
9219
  //#region src/tools/code/language-detector.ts
9200
- var _c = [
9220
+ var gc = [
9201
9221
  "javascript",
9202
9222
  "typescript",
9203
9223
  "python",
@@ -9213,8 +9233,8 @@ var _c = [
9213
9233
  "yaml",
9214
9234
  "markdown",
9215
9235
  "php"
9216
- ], vc = 20, yc = .75, bc = 2;
9217
- function xc(e, t) {
9236
+ ], _c = 20, vc = .75, yc = 2;
9237
+ function bc(e, t) {
9218
9238
  let n = e.flat(), r = n.reduce((e, t) => e + t.content.length, 0);
9219
9239
  if (r === 0) return 1;
9220
9240
  let { fgChars: i, nonFgColors: a } = n.reduce((e, n) => ({
@@ -9224,16 +9244,16 @@ function xc(e, t) {
9224
9244
  fgChars: 0,
9225
9245
  nonFgColors: /* @__PURE__ */ new Set()
9226
9246
  });
9227
- return a.size < bc ? 1 : i / r;
9247
+ return a.size < yc ? 1 : i / r;
9228
9248
  }
9229
- async function Sc(e) {
9230
- if (e.length < vc) return null;
9231
- let t = (await Promise.all(_c.map(async (t) => ({
9249
+ async function xc(e) {
9250
+ if (e.length < _c) return null;
9251
+ let t = (await Promise.all(gc.map(async (t) => ({
9232
9252
  lang: t,
9233
- tokens: await ic(e, t)
9253
+ tokens: await rc(e, t)
9234
9254
  })))).reduce((e, { lang: t, tokens: n }) => {
9235
9255
  if (!n) return e;
9236
- let r = xc(n.light.tokens, n.light.fg);
9256
+ let r = bc(n.light.tokens, n.light.fg);
9237
9257
  return r < e.score ? {
9238
9258
  lang: t,
9239
9259
  score: r
@@ -9242,35 +9262,35 @@ async function Sc(e) {
9242
9262
  lang: null,
9243
9263
  score: Infinity
9244
9264
  });
9245
- return t.lang === null || t.score >= yc ? null : t.lang;
9265
+ return t.lang === null || t.score >= vc ? null : t.lang;
9246
9266
  }
9247
9267
  //#endregion
9248
9268
  //#region src/tools/code/index.ts
9249
- var Cc = 1500, wc = class {
9269
+ var Sc = 1500, Cc = class {
9250
9270
  constructor({ data: e, api: t, readOnly: n }) {
9251
9271
  var r, i, a;
9252
9272
  this._dom = null, this._lineNumbers = !0, this._picker = null, this._viewMode = "preview", this._previewContainer = null, this._disposeHighlights = null, this._highlightRafId = null, this._detectedLanguage = null, this._detectionTimeoutId = null, this.api = t, this.readOnly = n, this._data = {
9253
9273
  code: (r = e == null ? void 0 : e.code) == null ? "" : r,
9254
- language: (i = e == null ? void 0 : e.language) == null ? os : i,
9274
+ language: (i = e == null ? void 0 : e.language) == null ? as : i,
9255
9275
  lineNumbers: e == null ? void 0 : e.lineNumbers
9256
9276
  }, this._lineNumbers = (a = e == null ? void 0 : e.lineNumbers) == null ? !0 : a;
9257
9277
  }
9258
9278
  render() {
9259
- let e = gs.has(this._data.language), t = Rs({
9279
+ let e = hs.has(this._data.language), t = Ls({
9260
9280
  code: this._data.code,
9261
9281
  languageName: this.getLanguageName(this._data.language),
9262
9282
  readOnly: this.readOnly,
9263
- copyLabel: this.api.i18n.t(is),
9283
+ copyLabel: this.api.i18n.t(rs),
9264
9284
  previewable: this.readOnly ? !1 : e,
9265
9285
  viewModeLabels: this.readOnly ? void 0 : {
9266
- code: this.api.i18n.t(_s),
9267
- preview: this.api.i18n.t(vs),
9268
- split: this.api.i18n.t(bs)
9286
+ code: this.api.i18n.t(gs),
9287
+ preview: this.api.i18n.t(_s),
9288
+ split: this.api.i18n.t(ys)
9269
9289
  }
9270
9290
  });
9271
9291
  if (this._dom = t, t.gutterElement.hidden = !this._lineNumbers, this.readOnly && e) {
9272
9292
  let e = document.createElement("div");
9273
- e.className = ys, e.setAttribute("data-blok-testid", "code-preview"), t.wrapper.appendChild(e), t.preElement.hidden = !0, t.gutterElement.hidden = !0, this._previewContainer = e, this.renderPreview();
9293
+ e.className = vs, e.setAttribute("data-blok-testid", "code-preview"), t.wrapper.appendChild(e), t.preElement.hidden = !0, t.gutterElement.hidden = !0, this._previewContainer = e, this.renderPreview();
9274
9294
  }
9275
9295
  if (!this.readOnly && e && t.previewElement && (this._viewMode = "preview", this._previewContainer = t.previewElement, this.applyViewMode(), this.renderPreview()), !this.readOnly && t.viewModeContainer) {
9276
9296
  let e = Array.from(t.viewModeContainer.querySelectorAll("[data-mode]"));
@@ -9283,10 +9303,10 @@ var Cc = 1500, wc = class {
9283
9303
  }
9284
9304
  }
9285
9305
  return this.readOnly || (t.codeElement.addEventListener("keydown", (e) => {
9286
- zs(e, t.codeElement, () => this.exitBlock()) && (e.preventDefault(), this.syncTrailingBr(), this.updateGutter(), this.scheduleHighlight(), this.scheduleDetection());
9306
+ Rs(e, t.codeElement, () => this.exitBlock()) && (e.preventDefault(), this.syncTrailingBr(), this.updateGutter(), this.scheduleHighlight(), this.scheduleDetection());
9287
9307
  }), t.codeElement.addEventListener("input", () => {
9288
9308
  this.syncTrailingBr(), this.updateGutter(), this.scheduleHighlight(), this.scheduleDetection();
9289
- })), t.copyButton.addEventListener("click", () => this.copyCode()), T(t.copyButton, this.api.i18n.t(is), { placement: "bottom" }), this.readOnly || (this._picker = this.buildLanguagePicker(t.languageButton, t.wrapper), t.languageButton.addEventListener("click", () => {
9309
+ })), t.copyButton.addEventListener("click", () => this.copyCode()), T(t.copyButton, this.api.i18n.t(rs), { placement: "bottom" }), this.readOnly || (this._picker = this.buildLanguagePicker(t.languageButton, t.wrapper), t.languageButton.addEventListener("click", () => {
9290
9310
  var e;
9291
9311
  if ((e = this._picker) != null && e.isShown) this._picker.hide();
9292
9312
  else {
@@ -9308,17 +9328,17 @@ var Cc = 1500, wc = class {
9308
9328
  applyViewMode() {
9309
9329
  var e, t;
9310
9330
  if (!((e = this._dom) != null && e.previewElement) || !this._dom.viewModeContainer || !this._dom.splitContainer) return;
9311
- Ls(this._dom.viewModeContainer, this._viewMode);
9331
+ Is(this._dom.viewModeContainer, this._viewMode);
9312
9332
  let n = (t = this._dom.preElement.parentElement) == null ? void 0 : t.parentElement;
9313
9333
  switch (this._viewMode) {
9314
9334
  case "code":
9315
- this._dom.preElement.hidden = !1, this._dom.gutterElement.hidden = !this._lineNumbers, this._dom.previewElement.hidden = !0, n && (n.hidden = !1), this._dom.splitContainer.className = Es;
9335
+ this._dom.preElement.hidden = !1, this._dom.gutterElement.hidden = !this._lineNumbers, this._dom.previewElement.hidden = !0, n && (n.hidden = !1), this._dom.splitContainer.className = Ts;
9316
9336
  break;
9317
9337
  case "preview":
9318
- this._dom.preElement.hidden = !0, this._dom.gutterElement.hidden = !0, this._dom.previewElement.hidden = !1, n && (n.hidden = !0), this._dom.splitContainer.className = Es;
9338
+ this._dom.preElement.hidden = !0, this._dom.gutterElement.hidden = !0, this._dom.previewElement.hidden = !1, n && (n.hidden = !0), this._dom.splitContainer.className = Ts;
9319
9339
  break;
9320
9340
  case "split":
9321
- this._dom.preElement.hidden = !1, this._dom.gutterElement.hidden = !this._lineNumbers, this._dom.previewElement.hidden = !1, n && (n.hidden = !1), this._dom.splitContainer.className = Ds;
9341
+ this._dom.preElement.hidden = !1, this._dom.gutterElement.hidden = !this._lineNumbers, this._dom.previewElement.hidden = !1, n && (n.hidden = !1), this._dom.splitContainer.className = Es;
9322
9342
  break;
9323
9343
  }
9324
9344
  }
@@ -9327,7 +9347,7 @@ var Cc = 1500, wc = class {
9327
9347
  let r = e._previewContainer;
9328
9348
  if (!r) return;
9329
9349
  let i = (t = (n = e._dom) == null ? void 0 : n.codeElement.textContent) == null ? e._data.code : t;
9330
- r.innerHTML = e._data.language === "mermaid" ? await Zs(i) : await Js(i);
9350
+ r.innerHTML = e._data.language === "mermaid" ? await Xs(i) : await qs(i);
9331
9351
  }
9332
9352
  setReadOnly(e) {
9333
9353
  this.readOnly = e, this._dom && (e ? (this._dom.codeElement.setAttribute("contenteditable", "false"), this._dom.codeElement.removeAttribute("spellcheck")) : (this._dom.codeElement.setAttribute("contenteditable", "plaintext-only"), this._dom.codeElement.setAttribute("spellcheck", "false")));
@@ -9349,7 +9369,7 @@ var Cc = 1500, wc = class {
9349
9369
  renderSettings() {
9350
9370
  let e = this._data.language, t = this._detectedLanguage, n = t !== null && t !== e, r = [];
9351
9371
  if (n) {
9352
- let e = ss.find((e) => e.id === t);
9372
+ let e = os.find((e) => e.id === t);
9353
9373
  e && (r.push({
9354
9374
  title: e.name,
9355
9375
  secondaryLabel: "auto",
@@ -9359,14 +9379,14 @@ var Cc = 1500, wc = class {
9359
9379
  isActive: () => this._data.language === e.id
9360
9380
  }), r.push({ type: D.Separator }));
9361
9381
  }
9362
- return r.push(...ss.map((t) => ({
9382
+ return r.push(...os.map((t) => ({
9363
9383
  title: t.name,
9364
9384
  trailingIcon: t.id === e ? We : void 0,
9365
9385
  onActivate: () => this.setLanguage(t.id),
9366
9386
  closeOnActivate: !0
9367
9387
  }))), [{
9368
9388
  icon: h,
9369
- title: this.api.i18n.t(ns),
9389
+ title: this.api.i18n.t(ts),
9370
9390
  name: "code-language",
9371
9391
  children: { items: r }
9372
9392
  }];
@@ -9387,7 +9407,7 @@ var Cc = 1500, wc = class {
9387
9407
  }
9388
9408
  setLanguage(e) {
9389
9409
  this._data.language = e;
9390
- let t = gs.has(e);
9410
+ let t = hs.has(e);
9391
9411
  if (this._dom) {
9392
9412
  let n = this._dom.languageButton.querySelector("span");
9393
9413
  n && (n.textContent = this.getLanguageName(e)), this._dom.viewModeContainer && (this._dom.viewModeContainer.hidden = !t), t && this._dom.previewElement && (this._previewContainer = this._dom.previewElement, this._viewMode = "preview", this.applyViewMode(), this.renderPreview()), t || (this._previewContainer = null, this._viewMode = "code", this.applyViewMode()), this._picker && this._picker.destroy(), this._picker = this.buildLanguagePicker(this._dom.languageButton, this._dom.wrapper);
@@ -9397,7 +9417,7 @@ var Cc = 1500, wc = class {
9397
9417
  buildLanguagePickerItems() {
9398
9418
  let e = this._data.language, t = this._detectedLanguage, n = t !== null && t !== e, r = [];
9399
9419
  if (n) {
9400
- let e = ss.find((e) => e.id === t);
9420
+ let e = os.find((e) => e.id === t);
9401
9421
  e && (r.push({
9402
9422
  title: e.name,
9403
9423
  name: e.id,
@@ -9408,7 +9428,7 @@ var Cc = 1500, wc = class {
9408
9428
  onActivate: () => this.setLanguage(e.id)
9409
9429
  }), r.push({ type: D.Separator }));
9410
9430
  }
9411
- return r.push(...ss.map((t) => ({
9431
+ return r.push(...os.map((t) => ({
9412
9432
  title: t.name,
9413
9433
  name: t.id,
9414
9434
  trailingIcon: t.id === e ? We : void 0,
@@ -9424,11 +9444,11 @@ var Cc = 1500, wc = class {
9424
9444
  leftAlignElement: t,
9425
9445
  searchable: !0,
9426
9446
  width: "200px",
9427
- messages: { search: this.api.i18n.t(as) }
9447
+ messages: { search: this.api.i18n.t(is) }
9428
9448
  });
9429
9449
  }
9430
9450
  getLanguageName(e) {
9431
- let t = ss.find((t) => t.id === e);
9451
+ let t = os.find((t) => t.id === e);
9432
9452
  return t ? t.name : e;
9433
9453
  }
9434
9454
  copyCode() {
@@ -9437,9 +9457,9 @@ var Cc = 1500, wc = class {
9437
9457
  navigator.clipboard.writeText(n).then(() => {
9438
9458
  if (!this._dom) return;
9439
9459
  let e = this._dom.copyButton, t = e.innerHTML;
9440
- e.innerHTML = `<span class="${hs}">${this.api.i18n.t(rs)}</span>`, setTimeout(() => {
9460
+ e.innerHTML = `<span class="${ms}">${this.api.i18n.t(ns)}</span>`, setTimeout(() => {
9441
9461
  e.innerHTML = t;
9442
- }, Cc);
9462
+ }, Sc);
9443
9463
  }).catch(() => {});
9444
9464
  }
9445
9465
  updateGutter() {
@@ -9448,7 +9468,7 @@ var Cc = 1500, wc = class {
9448
9468
  let t = (e = this._dom.codeElement.textContent) == null ? "" : e, n = t ? t.split("\n").length : 1, r = this._dom.gutterElement;
9449
9469
  r.children.length !== n && (r.innerHTML = "", Array.from({ length: n }, (e, t) => {
9450
9470
  let n = document.createElement("div");
9451
- n.className = Fs, n.textContent = String(t + 1), r.appendChild(n);
9471
+ n.className = Ps, n.textContent = String(t + 1), r.appendChild(n);
9452
9472
  }));
9453
9473
  }
9454
9474
  syncTrailingBr() {
@@ -9465,14 +9485,14 @@ var Cc = 1500, wc = class {
9465
9485
  scheduleDetection() {
9466
9486
  this._detectionTimeoutId !== null && clearTimeout(this._detectionTimeoutId), this._detectionTimeoutId = setTimeout(() => {
9467
9487
  var e, t;
9468
- this._detectionTimeoutId = null, Sc((e = (t = this._dom) == null ? void 0 : t.codeElement.textContent) == null ? "" : e).then((e) => {
9488
+ this._detectionTimeoutId = null, xc((e = (t = this._dom) == null ? void 0 : t.codeElement.textContent) == null ? "" : e).then((e) => {
9469
9489
  e !== this._detectedLanguage && (this._detectedLanguage = e, this._dom && (this._picker && this._picker.destroy(), this._picker = this.buildLanguagePicker(this._dom.languageButton, this._dom.wrapper)));
9470
9490
  });
9471
9491
  }, 600);
9472
9492
  }
9473
9493
  async highlightCode() {
9474
9494
  var e = this, t, n, r;
9475
- if (!oc() || !ec(e._data.language)) {
9495
+ if (!ac() || !$s(e._data.language)) {
9476
9496
  var i;
9477
9497
  (i = e._disposeHighlights) == null || i.call(e), e._disposeHighlights = null;
9478
9498
  return;
@@ -9483,8 +9503,8 @@ var Cc = 1500, wc = class {
9483
9503
  (o = e._disposeHighlights) == null || o.call(e), e._disposeHighlights = null;
9484
9504
  return;
9485
9505
  }
9486
- let s = await ic(a, e._data.language);
9487
- !s || !e._dom || ((r = e._disposeHighlights) == null || r.call(e), e._disposeHighlights = hc(e._dom.codeElement, s));
9506
+ let s = await rc(a, e._data.language);
9507
+ !s || !e._dom || ((r = e._disposeHighlights) == null || r.call(e), e._disposeHighlights = mc(e._dom.codeElement, s));
9488
9508
  }
9489
9509
  exitBlock() {
9490
9510
  let e = this.api.blocks.getCurrentBlockIndex();
@@ -9532,10 +9552,10 @@ var Cc = 1500, wc = class {
9532
9552
  patterns: { code: /^```/ }
9533
9553
  };
9534
9554
  }
9535
- }, G = (e) => {
9555
+ }, wc = (e) => {
9536
9556
  let t = e.tagName;
9537
9557
  return t === "B" || t === "STRONG";
9538
- }, Tc = (e) => !!(e && e.nodeType === Node.ELEMENT_NODE && G(e)), Ec = (e) => e.textContent.length === 0, K = (e) => e ? e.nodeType === Node.ELEMENT_NODE && G(e) ? q(e) : K(e.parentNode) : null, q = (e) => {
9558
+ }, Tc = (e) => !!(e && e.nodeType === Node.ELEMENT_NODE && wc(e)), Ec = (e) => e.textContent.length === 0, K = (e) => e ? e.nodeType === Node.ELEMENT_NODE && wc(e) ? q(e) : K(e.parentNode) : null, q = (e) => {
9539
9559
  if (e.tagName === "STRONG") return e;
9540
9560
  let t = document.createElement("strong");
9541
9561
  for (e.hasAttributes() && Array.from(e.attributes).forEach((e) => {
@@ -10129,7 +10149,7 @@ var Pc = (e, t) => {
10129
10149
  n.selectNodeContents(e), t.removeAllRanges(), t.addRange(n);
10130
10150
  }
10131
10151
  isRangeBold(e, t) {
10132
- return Lc(e, G, t);
10152
+ return Lc(e, wc, t);
10133
10153
  }
10134
10154
  removeNestedBold(e) {
10135
10155
  e.querySelectorAll("b,strong").forEach((e) => {
@@ -10146,11 +10166,11 @@ var Pc = (e, t) => {
10146
10166
  t.removeChild(e);
10147
10167
  }
10148
10168
  findBoldElementFromRangeOrSelection(e, t) {
10149
- return e ? K(e.startContainer) || K(e.commonAncestorContainer) || (e.startContainer.nodeType === Node.ELEMENT_NODE && G(e.startContainer) ? e.startContainer : null) : t ? K(t.focusNode) : null;
10169
+ return e ? K(e.startContainer) || K(e.commonAncestorContainer) || (e.startContainer.nodeType === Node.ELEMENT_NODE && wc(e.startContainer) ? e.startContainer : null) : t ? K(t.focusNode) : null;
10150
10170
  }
10151
10171
  mergeAdjacentBold(t) {
10152
- let n = q(t), r = n.previousSibling, i = r && r.nodeType === Node.ELEMENT_NODE && G(r) ? e.mergeStrongNodes(r, n) : n, a = i.nextSibling;
10153
- return a && a.nodeType === Node.ELEMENT_NODE && G(a) ? e.mergeStrongNodes(i, a) : i;
10172
+ let n = q(t), r = n.previousSibling, i = r && r.nodeType === Node.ELEMENT_NODE && wc(r) ? e.mergeStrongNodes(r, n) : n, a = i.nextSibling;
10173
+ return a && a.nodeType === Node.ELEMENT_NODE && wc(a) ? e.mergeStrongNodes(i, a) : i;
10154
10174
  }
10155
10175
  toggleCollapsedSelection() {
10156
10176
  let t = window.getSelection();
@@ -10249,7 +10269,7 @@ var Pc = (e, t) => {
10249
10269
  return t.innerHTML = e, t.content;
10250
10270
  }
10251
10271
  collectBoldAncestors(e) {
10252
- return Q(e, G);
10272
+ return Q(e, wc);
10253
10273
  }
10254
10274
  };
10255
10275
  $ = Bc, $.isInline = !0, $.title = "Bold", $.titleKey = "bold", $.markerSequence = 0, $.isProcessingMutation = !1, $.instances = /* @__PURE__ */ new Set(), $.guardKeydownListenerRegistered = !1, $.shortcut = "CMD+B";
@@ -11362,4 +11382,4 @@ var cl = {
11362
11382
  inlineCode: {}
11363
11383
  };
11364
11384
  //#endregion
11365
- export { ba as _, tl as a, Pt as b, Uc as c, ts as d, Zo as f, Ta as g, vo as h, il as i, Bc as l, Yo as m, ll as n, Qc as o, Xo as p, sl as r, qc as s, cl as t, wc as u, _r as v, Zt as y };
11385
+ export { ba as _, tl as a, Nt as b, Uc as c, es as d, Xo as f, Ta as g, _o as h, il as i, Bc as l, Jo as m, ll as n, Qc as o, Yo as p, sl as r, qc as s, cl as t, Cc as u, _r as v, Zt as y };