@jackuait/blok 0.10.2 → 0.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -130,7 +130,7 @@ var a = {
130
130
  RIGHT: 2,
131
131
  BACKWARD: 3,
132
132
  FORWARD: 4
133
- }, l = () => "0.10.2", u = /* @__PURE__ */ function(e) {
133
+ }, l = () => "0.10.3", u = /* @__PURE__ */ function(e) {
134
134
  return e.VERBOSE = "VERBOSE", e.INFO = "INFO", e.WARN = "WARN", e.ERROR = "ERROR", e;
135
135
  }({}), d = (e, t, n = "log", r, i = "color: inherit") => {
136
136
  let a = typeof console > "u" ? void 0 : console;
@@ -172,9 +172,9 @@ var f = (e) => {
172
172
  return t === null || t === Object.prototype;
173
173
  }, _ = (e) => typeof e == "string", v = (e) => typeof e == "boolean", y = (e) => typeof e == "number", ee = function(e) {
174
174
  return e === void 0;
175
- }, b = (e) => e == null ? !0 : typeof e == "string" || Array.isArray(e) ? e.length === 0 : e instanceof Map || e instanceof Set ? e.size === 0 : typeof e == "object" ? Object.keys(e).length === 0 : !1, x = (e, t) => function(...n) {
175
+ }, b = (e) => e == null ? !0 : typeof e == "string" || Array.isArray(e) ? e.length === 0 : e instanceof Map || e instanceof Set ? e.size === 0 : typeof e == "object" ? Object.keys(e).length === 0 : !1, te = (e, t) => function(...n) {
176
176
  setTimeout(() => e.apply(this, n), t);
177
- }, te = (e, t, n) => {
177
+ }, ne = (e, t, n) => {
178
178
  let r = { timeoutId: null };
179
179
  return function(...i) {
180
180
  let a = () => {
@@ -182,7 +182,7 @@ var f = (e) => {
182
182
  }, o = n === !0 && r.timeoutId === null;
183
183
  r.timeoutId !== null && clearTimeout(r.timeoutId), r.timeoutId = setTimeout(a, t), o && e.apply(this, i);
184
184
  };
185
- }, ne = (e, t, n) => {
185
+ }, re = (e, t, n) => {
186
186
  let r = (n == null ? void 0 : n.leading) !== !1, i = (n == null ? void 0 : n.trailing) !== !1, a = {
187
187
  lastCallTime: void 0,
188
188
  lastInvokeTime: 0,
@@ -213,79 +213,79 @@ var f = (e) => {
213
213
  let n = Date.now(), i = c(n);
214
214
  if (a.lastArgs = e, a.lastThis = this, a.lastCallTime = n, i && a.timerId === void 0) return a.lastInvokeTime = n, a.timerId = setTimeout(l, t), r ? o(n) : void 0;
215
215
  };
216
- }, S = (() => {
216
+ }, x = (() => {
217
217
  try {
218
218
  return Function("return this")();
219
219
  } catch (e) {
220
220
  return;
221
221
  }
222
222
  })();
223
- S && S.window === void 0 && (S.window = S);
224
- var C = () => {
225
- if (S != null && S.window) return S.window;
226
- }, re = () => {
227
- if (S != null && S.navigator) return S.navigator;
228
- let e = C();
223
+ x && x.window === void 0 && (x.window = x);
224
+ var S = () => {
225
+ if (x != null && x.window) return x.window;
226
+ }, ie = () => {
227
+ if (x != null && x.navigator) return x.navigator;
228
+ let e = S();
229
229
  return e == null ? void 0 : e.navigator;
230
- }, ie = (e) => /^[-\w]+\/([-+\w]+|\*)$/.test(e), ae = () => {
230
+ }, ae = (e) => /^[-\w]+\/([-+\w]+|\*)$/.test(e), oe = () => {
231
231
  var e, t;
232
232
  let n = {
233
233
  win: !1,
234
234
  mac: !1,
235
235
  x11: !1,
236
236
  linux: !1
237
- }, r = re(), i = (e = r == null || (t = r.userAgent) == null ? void 0 : t.toLowerCase()) == null ? "" : e, a = i ? Object.keys(n).find((e) => i.indexOf(e) !== -1) : void 0;
237
+ }, r = ie(), i = (e = r == null || (t = r.userAgent) == null ? void 0 : t.toLowerCase()) == null ? "" : e, a = i ? Object.keys(n).find((e) => i.indexOf(e) !== -1) : void 0;
238
238
  return a === void 0 || (n[a] = !0), n;
239
- }, oe = () => {
240
- let e = C();
239
+ }, se = () => {
240
+ let e = S();
241
241
  return !e || typeof e.matchMedia != "function" ? !1 : e.matchMedia("(max-width: 650px)").matches;
242
- }, se = (() => {
242
+ }, ce = (() => {
243
243
  var e;
244
- let t = re();
244
+ let t = ie();
245
245
  if (!t) return !1;
246
246
  let n = t.userAgent || "", r = t.userAgentData, i = r == null ? void 0 : r.platform;
247
247
  if (/iP(ad|hone|od)/.test(n) || i !== void 0 && i !== "" && /iP(ad|hone|od)/.test(i)) return !0;
248
248
  let a = ((e = t.maxTouchPoints) == null ? 0 : e) > 1, o = () => t.platform, s = i !== void 0 && i !== "" ? i : void 0;
249
249
  return (a ? s == null ? o() : s : void 0) === "MacIntel";
250
- })(), ce = (e) => {
250
+ })(), le = (e) => {
251
251
  try {
252
252
  return new URL(e).href;
253
253
  } catch (e) {}
254
- let t = C();
254
+ let t = S();
255
255
  return e.substring(0, 2) === "//" ? t ? `${t.location.protocol}${e}` : e : t ? `${t.location.origin}${e}` : e;
256
- }, le = (e) => {
257
- let t = C();
256
+ }, ue = (e) => {
257
+ let t = S();
258
258
  t && t.open(e, "_blank");
259
- }, ue = (e) => e && e.slice(0, 1).toUpperCase() + e.slice(1), de = (e) => {
260
- let t = ae(), n = e.replace(/shift/gi, "⇧").replace(/backspace/gi, "⌫").replace(/enter/gi, "⏎").replace(/up/gi, "↑").replace(/left/gi, "→").replace(/down/gi, "↓").replace(/right/gi, "←").replace(/escape/gi, "⎋").replace(/insert/gi, "Ins").replace(/delete/gi, "␡").replace(/\+/gi, " + ");
259
+ }, de = (e) => e && e.slice(0, 1).toUpperCase() + e.slice(1), fe = (e) => {
260
+ let t = oe(), n = e.replace(/shift/gi, "⇧").replace(/backspace/gi, "⌫").replace(/enter/gi, "⏎").replace(/up/gi, "↑").replace(/left/gi, "→").replace(/down/gi, "↓").replace(/right/gi, "←").replace(/escape/gi, "⎋").replace(/insert/gi, "Ins").replace(/delete/gi, "␡").replace(/\+/gi, " + ");
261
261
  return t.mac ? n.replace(/ctrl|cmd/gi, "⌘").replace(/alt/gi, "⌥") : n.replace(/cmd/gi, "Ctrl").replace(/windows/gi, "WIN");
262
- }, fe = (e, t) => {
262
+ }, pe = (e, t) => {
263
263
  let r = n({}, e);
264
264
  return Object.keys(t).forEach((e) => {
265
265
  let n = r[e], i = t[e];
266
266
  if (i !== void 0) {
267
267
  if (g(i) && g(n) && !Array.isArray(i)) {
268
- r[e] = fe(n, i);
268
+ r[e] = pe(n, i);
269
269
  return;
270
270
  }
271
271
  r[e] = i;
272
272
  }
273
273
  }), r;
274
- }, w = (e, ...t) => {
274
+ }, C = (e, ...t) => {
275
275
  if (!g(e) || t.length === 0) return e;
276
- let n = t.reduce((e, t) => g(t) ? fe(e, t) : e, e);
276
+ let n = t.reduce((e, t) => g(t) ? pe(e, t) : e, e);
277
277
  return Object.assign(e, n), e;
278
- }, pe = (e, t) => e.length === t.length ? e.every((e, n) => T(e, t[n])) : !1, T = (e, t) => {
278
+ }, me = (e, t) => e.length === t.length ? e.every((e, n) => w(e, t[n])) : !1, w = (e, t) => {
279
279
  if (e === t) return !0;
280
280
  if (e === null || t === null || typeof e != "object" || typeof t != "object" || Array.isArray(e) !== Array.isArray(t)) return !1;
281
- if (Array.isArray(e) && Array.isArray(t)) return pe(e, t);
281
+ if (Array.isArray(e) && Array.isArray(t)) return me(e, t);
282
282
  let n = Object.keys(e), r = Object.keys(t);
283
- return n.length === r.length ? n.every((n) => Object.prototype.hasOwnProperty.call(t, n) && T(e[n], t[n])) : !1;
284
- }, me = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", he = (e = 21) => {
283
+ return n.length === r.length ? n.every((n) => Object.prototype.hasOwnProperty.call(t, n) && w(e[n], t[n])) : !1;
284
+ }, he = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", ge = (e = 21) => {
285
285
  let t = "", n = crypto.getRandomValues(new Uint8Array(e |= 0));
286
- for (; e--;) t += me[n[e] & 63];
286
+ for (; e--;) t += he[n[e] & 63];
287
287
  return t;
288
- }, ge = 1e8, _e = 16, ve = () => he(10), ye = (e = "") => `${e}${Math.floor(Math.random() * ge).toString(_e)}`, E = class e {
288
+ }, _e = 1e8, ve = 16, ye = () => ge(10), be = (e = "") => `${e}${Math.floor(Math.random() * _e).toString(ve)}`, T = class e {
289
289
  static isSingleTag(e) {
290
290
  return !!e.tagName && [
291
291
  "AREA",
@@ -511,32 +511,32 @@ var C = () => {
511
511
  offset: a
512
512
  };
513
513
  }
514
- }, be = (e) => !/[^\t\n\r \u200B]/.test(e), xe = (e) => {
515
- e.setAttribute("data-blok-empty", E.isEmpty(e) ? "true" : "false");
516
- }, Se = ["header", "table"], D = /* @__PURE__ */ new Map(), Ce = (e) => {
514
+ }, xe = (e) => !/[^\t\n\r \u200B]/.test(e), Se = (e) => {
515
+ e.setAttribute("data-blok-empty", T.isEmpty(e) ? "true" : "false");
516
+ }, Ce = ["header", "table"], E = /* @__PURE__ */ new Map(), we = (e) => {
517
517
  let t = [...new Set(e)];
518
518
  for (let e of t) {
519
519
  var n;
520
- let t = (n = D.get(e)) == null ? 0 : n;
521
- D.set(e, t + 1);
520
+ let t = (n = E.get(e)) == null ? 0 : n;
521
+ E.set(e, t + 1);
522
522
  }
523
523
  let r = { cleanedUp: !1 };
524
524
  return () => {
525
525
  if (!r.cleanedUp) {
526
526
  r.cleanedUp = !0;
527
527
  for (let e of t) {
528
- let t = D.get(e);
529
- t !== void 0 && (t <= 1 ? D.delete(e) : D.set(e, t - 1));
528
+ let t = E.get(e);
529
+ t !== void 0 && (t <= 1 ? E.delete(e) : E.set(e, t - 1));
530
530
  }
531
531
  }
532
532
  };
533
- }, we = () => [...Se, ...D.keys()], Te = (e) => e ? (e instanceof HTMLElement ? e : e.holder).closest("[data-blok-table-cell-blocks]") !== null : !1, Ee = (e) => Se.includes(e) || D.has(e), De = class {
533
+ }, Te = () => [...Ce, ...E.keys()], Ee = (e) => e ? (e instanceof HTMLElement ? e : e.holder).closest("[data-blok-table-cell-blocks]") !== null : !1, De = (e) => Ce.includes(e) || E.has(e), Oe = class {
534
534
  constructor() {
535
535
  this.allListeners = [];
536
536
  }
537
537
  on(e, t, n, r = !1) {
538
538
  if (this.findOne(e, t, n, r)) return;
539
- let i = ye("l"), a = {
539
+ let i = be("l"), a = {
540
540
  id: i,
541
541
  element: e,
542
542
  eventType: t,
@@ -611,60 +611,60 @@ var C = () => {
611
611
  let n = this.normalizeListenerOptions(e), r = this.normalizeListenerOptions(t);
612
612
  return n.capture === r.capture && n.once === r.once && n.passive === r.passive && n.signal === r.signal;
613
613
  }
614
- }, O = (e, t) => {
614
+ }, D = (e, t) => {
615
615
  if (!e.conversionConfig) return !1;
616
616
  let n = e.conversionConfig[t];
617
617
  return h(n) || _(n);
618
- }, k = (e, t) => {
618
+ }, O = (e, t) => {
619
619
  let n = t.includes(".") ? t : `toolNames.${t}`;
620
620
  return e.has(n) ? e.t(n) : void 0;
621
- }, Oe = (e, t, n = "") => {
622
- let r = t.titleKey ? k(e, t.titleKey) : void 0;
621
+ }, ke = (e, t, n = "") => {
622
+ let r = t.titleKey ? O(e, t.titleKey) : void 0;
623
623
  if (r !== void 0) return r;
624
- let i = t.title ? k(e, t.title) : void 0;
624
+ let i = t.title ? O(e, t.title) : void 0;
625
625
  if (i !== void 0) return i;
626
626
  if (t.title) return t.title;
627
- let a = n ? k(e, n) : void 0;
627
+ let a = n ? O(e, n) : void 0;
628
628
  return a == null ? n : a;
629
- }, ke = (e, t, n) => {
630
- let r = t ? k(e, t) : void 0;
629
+ }, Ae = (e, t, n) => {
630
+ let r = t ? O(e, t) : void 0;
631
631
  if (r !== void 0) return r;
632
- let i = k(e, n);
632
+ let i = O(e, n);
633
633
  return i == null ? n : i;
634
- }, Ae = (e, t) => O(e.tool, t), je = (e, t) => Object.entries(e).some((([e, n]) => t[e] && T(t[e], n))), Me = async (e, t) => {
634
+ }, je = (e, t) => D(e.tool, t), Me = (e, t) => Object.entries(e).some((([e, n]) => t[e] && w(t[e], n))), Ne = async (e, t) => {
635
635
  let r = (await e.save()).data, i = t.find((t) => t.name === e.name);
636
- return i !== void 0 && !O(i, "export") ? [] : t.reduce((t, i) => {
637
- if (!O(i, "import") || i.toolbox === void 0) return t;
636
+ return i !== void 0 && !D(i, "export") ? [] : t.reduce((t, i) => {
637
+ if (!D(i, "import") || i.toolbox === void 0) return t;
638
638
  let a = new Set(i.toolbox.map((e) => e.data).filter((e) => e !== void 0).flatMap((e) => Object.keys(e))), o = i.toolbox.filter((t) => {
639
639
  if (b(t) || t.icon === void 0) return !1;
640
640
  let n = t.data !== void 0;
641
641
  return !(n && t.data !== void 0 && [...a].every((e) => {
642
642
  let n = t.data === void 0 ? void 0 : t.data[e], i = r[e];
643
- return T(n, i);
643
+ return w(n, i);
644
644
  }) || !n && i.name === e.name);
645
645
  });
646
646
  return o.length > 0 && t.push(n(n({}, i), {}, { toolbox: o })), t;
647
647
  }, []);
648
- }, Ne = (e, t) => e.mergeable ? e.name === t.name ? !0 : Ae(t, "export") && Ae(e, "import") : !1, Pe = async (e, t) => {
648
+ }, Pe = (e, t) => e.mergeable ? e.name === t.name ? !0 : je(t, "export") && je(e, "import") : !1, Fe = async (e, t) => {
649
649
  if (e.length === 0) return [];
650
- if (e.length === 1) return Me(e[0], t);
650
+ if (e.length === 1) return Ne(e[0], t);
651
651
  for (let n of e) {
652
652
  let e = t.find((e) => e.name === n.name);
653
- if (e !== void 0 && !O(e, "export")) return [];
653
+ if (e !== void 0 && !D(e, "export")) return [];
654
654
  }
655
655
  let r = new Set(e.map((e) => e.name));
656
656
  return t.reduce((e, t) => {
657
- if (!O(t, "import") || t.toolbox === void 0) return e;
657
+ if (!D(t, "import") || t.toolbox === void 0) return e;
658
658
  let i = t.toolbox.filter((e) => !(b(e) || e.icon === void 0 || e.data === void 0 && r.size === 1 && r.has(t.name)));
659
659
  return i.length > 0 && e.push(n(n({}, t), {}, { toolbox: i })), e;
660
660
  }, []);
661
- }, Fe = (e, t) => {
661
+ }, Ie = (e, t) => {
662
662
  let n = t == null ? void 0 : t.export;
663
663
  return h(n) ? n(e) : _(n) ? e[n] : (n !== void 0 && p("Conversion «export» property must be a string or function. String means key of saved data object to export. Function should export processed string to export."), "");
664
- }, Ie = (e, t, n) => {
664
+ }, Le = (e, t, n) => {
665
665
  let r = t == null ? void 0 : t.import;
666
666
  return h(r) ? r(e, n) : _(r) ? { [r]: e } : (r !== void 0 && p("Conversion «import» property must be a string or function. String means key of tool data to import. Function accepts a imported string and return composed tool data."), {});
667
- }, Le = class {
667
+ }, k = class {
668
668
  constructor() {
669
669
  this.subscribers = {};
670
670
  }
@@ -706,7 +706,7 @@ var C = () => {
706
706
  let e = window.getSelection();
707
707
  if (!e) return null;
708
708
  let t = e.anchorNode;
709
- return t ? E.isElement(t) ? t : t.parentElement : null;
709
+ return t ? T.isElement(t) ? t : t.parentElement : null;
710
710
  }
711
711
  static getAnchorOffset() {
712
712
  let e = window.getSelection();
@@ -768,8 +768,14 @@ var C = () => {
768
768
  }
769
769
  }, Ue = class {
770
770
  static setCursor(e, t = 0) {
771
- let n = document.createRange(), r = window.getSelection(), i = E.isNativeInput(e);
772
- return i && !E.canSetCaret(e) ? e.getBoundingClientRect() : i ? (e.focus(), e.selectionStart = t, e.selectionEnd = t, e.getBoundingClientRect()) : (n.setStart(e, t), n.setEnd(e, t), r ? (r.removeAllRanges(), r.addRange(n), E.isContentEditable(e) && document.activeElement !== e && e.focus(), n.getBoundingClientRect()) : e.getBoundingClientRect());
771
+ var n, r;
772
+ let i = document.createRange(), a = window.getSelection(), o = T.isNativeInput(e);
773
+ if (o && !T.canSetCaret(e)) return e.getBoundingClientRect();
774
+ if (o) return e.focus(), e.selectionStart = t, e.selectionEnd = t, e.getBoundingClientRect();
775
+ if (i.setStart(e, t), i.setEnd(e, t), !a) return e.getBoundingClientRect();
776
+ a.removeAllRanges(), a.addRange(i);
777
+ let s = T.isContentEditable(e) ? e : (n = (r = e.parentElement) == null ? void 0 : r.closest("[contenteditable=\"true\"]")) == null ? null : n;
778
+ return s !== null && document.activeElement !== s && s.focus(), i.getBoundingClientRect();
773
779
  }
774
780
  static isRangeInsideContainer(e) {
775
781
  let t = A.getRange();
@@ -882,7 +888,7 @@ var Ge = class {
882
888
  }, M = class {
883
889
  static wrapRangeWithHighlight(e) {
884
890
  if (e.collapsed) return null;
885
- let t = E.make("span");
891
+ let t = T.make("span");
886
892
  t.setAttribute("data-blok-testid", "fake-background"), t.setAttribute("data-blok-fake-background", "true"), t.setAttribute("data-blok-mutation-free", "true"), t.style.color = "inherit", t.style.boxDecorationBreak = "clone", t.style["-webkit-box-decoration-break"] = "clone", t.style.whiteSpace = "pre-wrap";
887
893
  let n = e.extractContents();
888
894
  return n.childNodes.length === 0 ? null : (t.appendChild(n), e.insertNode(t), t);
@@ -906,7 +912,7 @@ var Ge = class {
906
912
  let s = Ge.splitTextAtPositions(n, o), c = document.createDocumentFragment();
907
913
  return s.forEach((e) => {
908
914
  if (e.length === 0) return;
909
- let t = E.make("span");
915
+ let t = T.make("span");
910
916
  t.setAttribute("data-blok-testid", "fake-background"), t.setAttribute("data-blok-fake-background", "true"), t.setAttribute("data-blok-mutation-free", "true"), t.style.color = "inherit", t.style.boxDecorationBreak = "clone", t.style["-webkit-box-decoration-break"] = "clone", t.style.whiteSpace = "pre-wrap", t.textContent = e, c.appendChild(t), i.push(t);
911
917
  }), r.replaceChild(c, e), i;
912
918
  }
@@ -972,14 +978,14 @@ var Ge = class {
972
978
  static addFakeCursor() {
973
979
  let e = A.getRange();
974
980
  if (e === null) return;
975
- let t = E.make("span");
981
+ let t = T.make("span");
976
982
  t.setAttribute(a.fakeCursor, ""), t.setAttribute("data-blok-mutation-free", "true"), e.collapse(), e.insertNode(t);
977
983
  }
978
984
  static isFakeCursorInsideContainer(e) {
979
- return E.find(e, o(a.fakeCursor)) !== null;
985
+ return T.find(e, o(a.fakeCursor)) !== null;
980
986
  }
981
987
  static removeFakeCursor(e = document.body) {
982
- let t = E.find(e, o(a.fakeCursor));
988
+ let t = T.find(e, o(a.fakeCursor));
983
989
  t && t.remove();
984
990
  }
985
991
  }, Je = class {
@@ -1238,7 +1244,7 @@ var Ge = class {
1238
1244
  return Array.from(e.attributes).forEach((e) => {
1239
1245
  ut(e.name) && (t[e.name] = !0);
1240
1246
  }), t;
1241
- }, F = (e) => e === !0 ? ct(dt) : e === !1 ? !1 : h(e) ? ct(e) : _(e) ? e : g(e) ? w({}, e) : e, ft = (e, t) => {
1247
+ }, F = (e) => e === !0 ? ct(dt) : e === !1 ? !1 : h(e) ? ct(e) : _(e) ? e : g(e) ? C({}, e) : e, ft = (e, t) => {
1242
1248
  if (b(e)) return st(t);
1243
1249
  let n = {};
1244
1250
  for (let r in e) {
@@ -1253,7 +1259,7 @@ var Ge = class {
1253
1259
  continue;
1254
1260
  }
1255
1261
  if (g(i) && g(a)) {
1256
- n[r] = w({}, a, i);
1262
+ n[r] = C({}, a, i);
1257
1263
  continue;
1258
1264
  }
1259
1265
  if (a !== void 0) {
@@ -1280,11 +1286,11 @@ var Ge = class {
1280
1286
  }
1281
1287
  if (!(r === !0 && h(i))) {
1282
1288
  if (r === !0) {
1283
- n[t] = g(i) && !h(i) ? w({}, i) : F(r);
1289
+ n[t] = g(i) && !h(i) ? C({}, i) : F(r);
1284
1290
  continue;
1285
1291
  }
1286
1292
  if (g(r) && g(i)) {
1287
- n[t] = w({}, i, r);
1293
+ n[t] = C({}, i, r);
1288
1294
  continue;
1289
1295
  }
1290
1296
  n[t] = F(r);
@@ -1492,21 +1498,21 @@ var I = () => Tt.getInstance(), Et = (e, t, n) => {
1492
1498
  if (c || l) return !1;
1493
1499
  o.style.position = "absolute", o.style.visibility = "hidden", o.style.height = "auto", o.style.width = "auto", o.style.whiteSpace = window.getComputedStyle(e).whiteSpace, document.body.appendChild(o);
1494
1500
  let u = o.getBoundingClientRect().width;
1495
- return document.body.removeChild(o), !(u > 0 || !be(s) || window.getComputedStyle(e).whiteSpace.startsWith("pre") && s.length > 0);
1501
+ return document.body.removeChild(o), !(u > 0 || !xe(s) || window.getComputedStyle(e).whiteSpace.startsWith("pre") && s.length > 0);
1496
1502
  }, Nt = (e) => {
1497
1503
  var t;
1498
- let n = E.getDeepestNode(e);
1499
- if (n === null || E.isEmpty(e)) return !0;
1500
- if (E.isNativeInput(n)) return n.selectionEnd === 0;
1501
- if (E.isEmpty(e)) return !0;
1504
+ let n = T.getDeepestNode(e);
1505
+ if (n === null || T.isEmpty(e)) return !0;
1506
+ if (T.isNativeInput(n)) return n.selectionEnd === 0;
1507
+ if (T.isEmpty(e)) return !0;
1502
1508
  let [r, i] = At();
1503
1509
  if (r === null) return !1;
1504
1510
  let a = window.getSelection(), o = (t = a == null ? void 0 : a.focusNode) == null ? null : t;
1505
1511
  return o !== null && o !== e && !(o.nodeType === Node.TEXT_NODE && o.parentNode === e) ? !1 : Mt(e, r, i, "left");
1506
1512
  }, Pt = (e) => {
1507
- let t = E.getDeepestNode(e, !0);
1513
+ let t = T.getDeepestNode(e, !0);
1508
1514
  if (t === null) return !0;
1509
- if (E.isNativeInput(t)) return t.selectionEnd === t.value.length;
1515
+ if (T.isNativeInput(t)) return t.selectionEnd === t.value.length;
1510
1516
  let [n, r] = At();
1511
1517
  return n === null ? !1 : Mt(e, n, r, "right");
1512
1518
  }, Ft, L = class e {
@@ -1539,7 +1545,7 @@ var I = () => Tt.getInstance(), Et = (e, t, n) => {
1539
1545
  let n = t === e.directions.RIGHT ? -1 : 0, r = this.cursor === -1 ? n : this.cursor;
1540
1546
  r !== -1 && (this.items[r].classList.remove(this.focusedCssClass), this.items[r].removeAttribute("data-blok-focused"));
1541
1547
  let i = t === e.directions.RIGHT ? (r + 1) % this.items.length : (this.items.length + r - 1) % this.items.length;
1542
- return E.canSetCaret(this.items[i]) && x(() => Ye.setCursor(this.items[i]), 50)(), this.items[i].classList.add(this.focusedCssClass), this.items[i].setAttribute("data-blok-focused", "true"), i;
1548
+ return T.canSetCaret(this.items[i]) && te(() => Ye.setCursor(this.items[i]), 50)(), this.items[i].classList.add(this.focusedCssClass), this.items[i].setAttribute("data-blok-focused", "true"), i;
1543
1549
  }
1544
1550
  };
1545
1551
  Ft = L, Ft.directions = {
@@ -2064,9 +2070,9 @@ var nn = "\n<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\"
2064
2070
  constructor(e) {
2065
2071
  let t = e.alignment === "center" ? "center" : "start";
2066
2072
  this.nodes = {
2067
- root: E.make("div", [U.root, t === "center" ? U.alignedCenter : U.alignedStart]),
2068
- title: E.make("div", U.title, { textContent: e.title })
2069
- }, this.nodes.root.setAttribute("data-alignment", t), this.nodes.root.appendChild(this.nodes.title), e.description !== void 0 && (this.nodes.description = E.make("div", U.description, { textContent: e.description }), this.nodes.root.appendChild(this.nodes.description));
2073
+ root: T.make("div", [U.root, t === "center" ? U.alignedCenter : U.alignedStart]),
2074
+ title: T.make("div", U.title, { textContent: e.title })
2075
+ }, this.nodes.root.setAttribute("data-alignment", t), this.nodes.root.appendChild(this.nodes.title), e.description !== void 0 && (this.nodes.description = T.make("div", U.description, { textContent: e.description }), this.nodes.root.appendChild(this.nodes.description));
2070
2076
  }
2071
2077
  getElement() {
2072
2078
  return this.nodes.root;
@@ -2381,7 +2387,7 @@ var nn = "\n<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\"
2381
2387
  }
2382
2388
  getControls() {
2383
2389
  if (!this.nodes.root) return [];
2384
- let e = this.nodes.root.querySelectorAll(`button, ${E.allInputsSelector}`);
2390
+ let e = this.nodes.root.querySelectorAll(`button, ${T.allInputsSelector}`);
2385
2391
  return Array.from(e);
2386
2392
  }
2387
2393
  updateRootClasses() {
@@ -2440,13 +2446,13 @@ var nn = "\n<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\"
2440
2446
  }, 0);
2441
2447
  }, wr = /* @__PURE__ */ function(e) {
2442
2448
  return e.Search = "search", e;
2443
- }({}), Tr = class extends Le {
2449
+ }({}), Tr = class extends k {
2444
2450
  constructor({ items: e, placeholder: t }) {
2445
2451
  super(), this.searchQuery = "", this.handleValueChange = () => {
2446
2452
  this.applySearch(this.input.value);
2447
- }, this.listeners = new De(), this.items = e, this.wrapper = E.make("div", yr.wrapper), this.wrapper.setAttribute("data-blok-testid", "popover-search-field");
2448
- let n = E.make("div", yr.icon, { innerHTML: vn });
2449
- this.input = E.make("input", yr.input, {
2453
+ }, this.listeners = new Oe(), this.items = e, this.wrapper = T.make("div", yr.wrapper), this.wrapper.setAttribute("data-blok-testid", "popover-search-field");
2454
+ let n = T.make("div", yr.icon, { innerHTML: vn });
2455
+ this.input = T.make("input", yr.input, {
2450
2456
  type: "search",
2451
2457
  placeholder: t,
2452
2458
  tabIndex: -1
@@ -2568,12 +2574,12 @@ var Z = {
2568
2574
  return e.NestingLevel = "--nesting-level", e.PopoverHeight = "--popover-height", e.InlinePopoverWidth = "--inline-popover-width", e.PopoverTop = "--popover-top", e.PopoverLeft = "--popover-left", e.TriggerItemLeft = "--trigger-item-left", e.TriggerItemTop = "--trigger-item-top", e;
2569
2575
  }({}), $ = /* @__PURE__ */ function(e) {
2570
2576
  return e.Closed = "closed", e.ClosedOnActivate = "closed-on-activate", e;
2571
- }({}), kr = class extends Le {
2577
+ }({}), kr = class extends k {
2572
2578
  get itemsDefault() {
2573
2579
  return this.items.filter((e) => e instanceof G);
2574
2580
  }
2575
2581
  constructor(e, t = {}) {
2576
- super(), this.params = e, this.itemsRenderParams = t, this.listeners = new De(), this.messages = {
2582
+ super(), this.params = e, this.itemsRenderParams = t, this.listeners = new Oe(), this.messages = {
2577
2583
  nothingFound: "Nothing found",
2578
2584
  search: "Search"
2579
2585
  }, this.permanentlyHiddenNames = /* @__PURE__ */ new Set(), this.items = this.buildItems(e.items), e.messages && (this.messages = n(n({}, this.messages), e.messages)), this.nodes = this.createPopoverDOM(), this.appendItemElements(), this.nodes.popoverContainer && this.listeners.on(this.nodes.popoverContainer, "click", (e) => this.handleClick(e));
@@ -2701,12 +2707,12 @@ function Ar(e, t, n) {
2701
2707
  }
2702
2708
  function jr(e) {
2703
2709
  var t;
2704
- let { anchor: n, popoverSize: r, scopeBounds: i, viewportSize: a, scrollOffset: o, offset: s = 8, leftAlignRect: c } = e, l = Math.min(a.height, i.bottom), u = Math.max(0, i.top), d = l - n.bottom - s, f = n.top - s - u, p = Ar(r.height, d, f), m = p ? n.top - s - r.height + o.y : n.bottom + s + o.y, h = m < u + o.y ? u + o.y : m, g = Math.min(a.width, i.right), _ = Math.max(0, i.left), v = ((t = c == null ? void 0 : c.left) == null ? n.left : t) + o.x, y = n.right + o.x, ee = g + o.x - v, b = y - _ - o.x, x = Ar(r.width, ee, b), te = x ? Math.max(_ + o.x, n.right - r.width + o.x) : v;
2710
+ let { anchor: n, popoverSize: r, scopeBounds: i, viewportSize: a, scrollOffset: o, offset: s = 8, leftAlignRect: c } = e, l = Math.min(a.height, i.bottom), u = Math.max(0, i.top), d = l - n.bottom - s, f = n.top - s - u, p = Ar(r.height, d, f), m = p ? n.top - s - r.height + o.y : n.bottom + s + o.y, h = i.top + o.y, g = m < h ? h : m, _ = Math.min(a.width, i.right), v = Math.max(0, i.left), y = ((t = c == null ? void 0 : c.left) == null ? n.left : t) + o.x, ee = n.right + o.x, b = _ + o.x - y, te = ee - v - o.x, ne = Ar(r.width, b, te), re = ne ? Math.max(v + o.x, n.right - r.width + o.x) : y;
2705
2711
  return {
2706
- top: h,
2707
- left: te + r.width > g + o.x ? Math.max(_ + o.x, g + o.x - r.width) : te,
2712
+ top: g,
2713
+ left: re + r.width > _ + o.x ? Math.max(v + o.x, _ + o.x - r.width) : re,
2708
2714
  openTop: p,
2709
- openLeft: x
2715
+ openLeft: ne
2710
2716
  };
2711
2717
  }
2712
2718
  //#endregion
@@ -3095,11 +3101,11 @@ var Mr = class e extends kr {
3095
3101
  }
3096
3102
  }
3097
3103
  }, Nr = function(e) {
3098
- let t = E.make("div");
3104
+ let t = T.make("div");
3099
3105
  return t.style.display = "flex", t.style.flexDirection = "column", t.style.gap = "4px", e.forEach((e) => {
3100
- let n = E.make("div"), r = e.indexOf(" ");
3106
+ let n = T.make("div"), r = e.indexOf(" ");
3101
3107
  if (r > 0) {
3102
- let t = e.substring(0, r), i = e.substring(r), a = E.make("span", null, { textContent: t });
3108
+ let t = e.substring(0, r), i = e.substring(r), a = T.make("span", null, { textContent: t });
3103
3109
  a.style.color = "white", n.appendChild(a), n.appendChild(document.createTextNode(i));
3104
3110
  } else n.appendChild(document.createTextNode(e));
3105
3111
  t.appendChild(n);
@@ -3117,7 +3123,7 @@ var Mr = class e extends kr {
3117
3123
  if (t === null) return [];
3118
3124
  let n = e.blocksAPI.getBlockByElement(t.anchorNode);
3119
3125
  if (n === void 0) return [];
3120
- let r = await Me(n, e.toolsAPI.getBlockTools());
3126
+ let r = await Ne(n, e.toolsAPI.getBlockTools());
3121
3127
  if (r.length === 0) return [];
3122
3128
  let i = r.reduce((t, r) => {
3123
3129
  var i;
@@ -3125,7 +3131,7 @@ var Mr = class e extends kr {
3125
3131
  var a;
3126
3132
  i.title !== void 0 && t.push({
3127
3133
  icon: i.icon,
3128
- title: Oe(e.i18nInstance, i, r.name),
3134
+ title: ke(e.i18nInstance, i, r.name),
3129
3135
  name: (a = i.name) == null ? r.name : a,
3130
3136
  closeOnActivate: !0,
3131
3137
  onActivate: async () => {
@@ -3134,7 +3140,7 @@ var Mr = class e extends kr {
3134
3140
  }
3135
3141
  });
3136
3142
  }), t;
3137
- }, []), a = await n.getActiveToolboxEntry(), o = a ? Oe(e.i18nInstance, a, n.name) : ke(e.i18nInstance, n.name, ue(n.name)), s = !oe();
3143
+ }, []), a = await n.getActiveToolboxEntry(), o = a ? ke(e.i18nInstance, a, n.name) : Ae(e.i18nInstance, n.name, de(n.name)), s = !se();
3138
3144
  return {
3139
3145
  name: "convert-to",
3140
3146
  title: o,
@@ -3163,4 +3169,4 @@ var Ir = "toggle", Lr = "tools.toggle.placeholder", Rr = "tools.toggle.bodyPlace
3163
3169
  toggleChildren: "data-blok-toggle-children"
3164
3170
  };
3165
3171
  //#endregion
3166
- export { Kn as $, l as $n, kt as $t, hn as A, ve as An, Dn as At, or as B, le as Bn, en as Bt, X as C, we as Cn, ur as Ct, on as D, E as Dn, Vn as Dt, W as E, Ce as En, Tn as Et, an as F, ae as Fn, Zt as Ft, nr as G, h as Gn, Lt as Gt, er as H, x as Hn, B as Ht, Xn as I, ce as In, Yt as It, bn as J, ee as Jn, It as Jt, Wn as K, g as Kn, Rt as Kt, rr as L, se as Ln, Xt as Lt, Zn as M, T as Mn, un as Mt, Qn as N, de as Nn, rn as Nt, Jn as O, be as On, Hn as Ot, zn as P, ue as Pn, En as Pt, wn as Q, f as Qn, jt as Qt, sr as R, oe as Rn, H as Rt, Or as S, De as Sn, lr as St, G as T, Ee as Tn, jn as Tt, tr as U, ne as Un, Ut, ar as V, te as Vn, Gt as Vt, $n as W, b as Wn, R as Wt, Sn as X, p as Xn, Nt as Xt, xn as Y, u as Yn, Pt as Yt, Cn as Z, m as Zn, At as Zt, kr as _, Pe as _n, mn as _t, Vr as a, $e as an, Rn as at, Z as b, ke as bn, fn as bt, Hr as c, Re as cn, On as ct, qr as d, He as dn, Gn as dt, Dt as en, s as er, Pn as et, Ur as f, Le as fn, ln as ft, Mr as g, Me as gn, dr as gt, Nr as h, Ie as hn, Yn as ht, Wr as i, mt as in, Ln as it, gn as j, w as jn, Bn as jt, nn as k, xe as kn, Un as kt, Lr as l, Ve as ln, An as lt, Fr as m, Fe as mn, cr as mt, Br as n, Et as nn, a as nr, Fn as nt, Rr as o, N as on, sn as ot, Ir as p, Ne as pn, pn as pt, yn as q, _ as qn, zt as qt, Gr as r, P as rn, o as rr, In as rt, Kr as s, Ye as sn, cn as st, zr as t, Ot as tn, c as tr, Mn as tt, Jr as u, ze as un, kn as ut, $ as v, Ae as vn, Nn as vt, J as w, Te as wn, dn as wt, Dr as x, Oe as xn, vn as xt, Q as y, je as yn, qn as yt, ir as z, ie as zn, tn as zt };
3172
+ export { Kn as $, l as $n, kt as $t, hn as A, ye as An, Dn as At, or as B, ue as Bn, en as Bt, X as C, Te as Cn, ur as Ct, on as D, T as Dn, Vn as Dt, W as E, we as En, Tn as Et, an as F, oe as Fn, Zt as Ft, nr as G, h as Gn, Lt as Gt, er as H, te as Hn, B as Ht, Xn as I, le as In, Yt as It, bn as J, ee as Jn, It as Jt, Wn as K, g as Kn, Rt as Kt, rr as L, ce as Ln, Xt as Lt, Zn as M, w as Mn, un as Mt, Qn as N, fe as Nn, rn as Nt, Jn as O, xe as On, Hn as Ot, zn as P, de as Pn, En as Pt, wn as Q, f as Qn, jt as Qt, sr as R, se as Rn, H as Rt, Or as S, Oe as Sn, lr as St, G as T, De as Tn, jn as Tt, tr as U, re as Un, Ut, ar as V, ne as Vn, Gt as Vt, $n as W, b as Wn, R as Wt, Sn as X, p as Xn, Nt as Xt, xn as Y, u as Yn, Pt as Yt, Cn as Z, m as Zn, At as Zt, kr as _, Fe as _n, mn as _t, Vr as a, $e as an, Rn as at, Z as b, Ae as bn, fn as bt, Hr as c, Re as cn, On as ct, qr as d, He as dn, Gn as dt, Dt as en, s as er, Pn as et, Ur as f, k as fn, ln as ft, Mr as g, Ne as gn, dr as gt, Nr as h, Le as hn, Yn as ht, Wr as i, mt as in, Ln as it, gn as j, C as jn, Bn as jt, nn as k, Se as kn, Un as kt, Lr as l, Ve as ln, An as lt, Fr as m, Ie as mn, cr as mt, Br as n, Et as nn, a as nr, Fn as nt, Rr as o, N as on, sn as ot, Ir as p, Pe as pn, pn as pt, yn as q, _ as qn, zt as qt, Gr as r, P as rn, o as rr, In as rt, Kr as s, Ye as sn, cn as st, zr as t, Ot as tn, c as tr, Mn as tt, Jr as u, ze as un, kn as ut, $ as v, je as vn, Nn as vt, J as w, Ee as wn, dn as wt, Dr as x, ke as xn, vn as xt, Q as y, Me as yn, qn as yt, ir as z, ae as zn, tn as zt };