@jackuait/blok 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { i as e, t } from "./chunk-5O_1xk2F.mjs";
2
- import { $ as n, $n as r, $r as i, $t as a, An as o, At as s, B as c, Bn as l, Bt as u, C as d, Cn as f, Cr as p, Ct as m, Dn as h, Dr as g, Dt as _, En as v, Er as y, Et as b, F as x, Fi as S, Fn as C, Ft as w, G as T, Gn as E, Gt as D, H as ee, Hn as O, Ht as k, I as A, In as j, Ir as M, It as te, J as ne, Jn as N, Jt as re, Kn as ie, Kt as ae, L as oe, Ln as se, Lr as ce, Lt as P, Mn as le, Mr as F, Mt as ue, Nn as de, Nr as fe, Nt as pe, Oi as me, On as I, Or as he, Ot as ge, P as _e, Pi as L, Pn as ve, Pt as ye, Q as be, Qn as xe, Qt as Se, R as Ce, Rn as we, Rt as Te, S as Ee, Sn as De, St as Oe, T as ke, Tn as Ae, Tr as je, Tt as Me, U as R, Un as Ne, Ut as Pe, Vn as Fe, Vt as Ie, W as Le, Wn as Re, Wt as ze, X as Be, Xn as Ve, Xt as He, Y as Ue, Yn as We, Yt as Ge, Z as Ke, Zn as qe, Zt as Je, _ as Ye, _n as Xe, _t as Ze, a as Qe, ar as $e, at as et, b as tt, bn as nt, bt as rt, c as it, ci as at, cn as ot, cr as st, ct as z, d as ct, dn as lt, dt as ut, en as dt, et as ft, f as pt, fn as mt, fr as ht, ft as gt, g as _t, gn as vt, gr as yt, gt as bt, h as xt, hn as St, ht as Ct, i as wt, in as Tt, ir as Et, it as Dt, jn as Ot, jt as kt, kn as At, kr as B, kt as jt, l as Mt, ln as Nt, lr as Pt, lt as Ft, mn as It, mr as Lt, mt as Rt, n as zt, nn as Bt, nr as Vt, nt as Ht, o as V, oi as Ut, on as Wt, or as Gt, ot as Kt, p as qt, pn as Jt, pr as Yt, pt as Xt, q as Zt, qt as Qt, r as $t, rr as en, rt as tn, s as nn, sn as rn, sr as an, st as on, t as sn, tr as cn, u as H, un as ln, ur as un, ut as dn, v as fn, vn as pn, vt as mn, wn as hn, wr as U, wt as gn, x as _n, xn as vn, xt as yn, y as bn, yn as xn, yr as Sn, yt as Cn, z as wn, zn as Tn, zt as En } from "./constants-BO6zLfL2.mjs";
2
+ import { $ as n, $n as r, $r as i, $t as a, An as o, At as s, B as c, Bn as l, Bt as u, C as d, Cn as f, Cr as p, Ct as m, Dn as h, Dr as g, Dt as _, En as v, Er as y, Et as b, F as x, Fi as S, Fn as C, Ft as w, G as T, Gn as E, Gt as D, H as ee, Hn as O, Ht as k, I as A, In as j, Ir as M, It as te, J as ne, Jn as N, Jt as re, Kn as ie, Kt as ae, L as oe, Ln as se, Lr as ce, Lt as P, Mn as le, Mr as F, Mt as ue, Nn as de, Nr as fe, Nt as pe, Oi as me, On as I, Or as he, Ot as ge, P as _e, Pi as L, Pn as ve, Pt as ye, Q as be, Qn as xe, Qt as Se, R as Ce, Rn as we, Rt as Te, S as Ee, Sn as De, St as Oe, T as ke, Tn as Ae, Tr as je, Tt as Me, U as R, Un as Ne, Ut as Pe, Vn as Fe, Vt as Ie, W as Le, Wn as Re, Wt as ze, X as Be, Xn as Ve, Xt as He, Y as Ue, Yn as We, Yt as Ge, Z as Ke, Zn as qe, Zt as Je, _ as Ye, _n as Xe, _t as Ze, a as Qe, ar as $e, at as et, b as tt, bn as nt, bt as rt, c as it, ci as at, cn as ot, cr as st, ct as z, d as ct, dn as lt, dt as ut, en as dt, et as ft, f as pt, fn as mt, fr as ht, ft as gt, g as _t, gn as vt, gr as yt, gt as bt, h as xt, hn as St, ht as Ct, i as wt, in as Tt, ir as Et, it as Dt, jn as Ot, jt as kt, kn as At, kr as B, kt as jt, l as Mt, ln as Nt, lr as Pt, lt as Ft, mn as It, mr as Lt, mt as Rt, n as zt, nn as Bt, nr as Vt, nt as Ht, o as V, oi as Ut, on as Wt, or as Gt, ot as Kt, p as qt, pn as Jt, pr as Yt, pt as Xt, q as Zt, qt as Qt, r as $t, rr as en, rt as tn, s as nn, sn as rn, sr as an, st as on, t as sn, tr as cn, u as H, un as ln, ur as un, ut as dn, v as fn, vn as pn, vt as mn, wn as hn, wr as U, wt as gn, x as _n, xn as vn, xt as yn, y as bn, yn as xn, yr as Sn, yt as Cn, z as wn, zn as Tn, zt as En } from "./constants-BmCvHbkL.mjs";
3
3
  import { t as W } from "./objectSpread2-jlBcdYeb.mjs";
4
4
  import { n as G } from "./tw-DmW6-pCY.mjs";
5
5
  import { n as Dn } from "./lightweight-i18n-DJpMke7a.mjs";
@@ -14435,45 +14435,78 @@ function pm({ media: e, figure: t, data: n, storage: r, onLoopChange: i }) {
14435
14435
  }
14436
14436
  };
14437
14437
  }
14438
+ function mm(e, t = 4, n = 9) {
14439
+ let r = e < 0 ? n : t, i = Math.abs(e);
14440
+ if (i >= r) return 0;
14441
+ let a = 1 - i / r;
14442
+ return a * a;
14443
+ }
14444
+ function hm(e, t = 3) {
14445
+ let n = Math.abs(e);
14446
+ if (n >= t) return 0;
14447
+ let r = 1 - n / t;
14448
+ return r * r * r;
14449
+ }
14450
+ function gm(e, t) {
14451
+ let n = Math.sin(t * 8.5 + e * .7), r = Math.sin(t * 5.3 + e * 1.9);
14452
+ return n * .6 + r * .4;
14453
+ }
14454
+ function _m(e, t) {
14455
+ let n = Math.sin(t * 2.1 - e * .35), r = Math.sin(t * 1.3 + e * .21);
14456
+ return n * .6 + r * .4;
14457
+ }
14458
+ var vm = .035, ym = .06, bm = 26;
14459
+ function xm(e) {
14460
+ return 1 - (1 - Math.min(1, Math.max(0, e))) ** 3;
14461
+ }
14462
+ function Sm(e) {
14463
+ return hm(e.distance) * e.energy * e.entrance;
14464
+ }
14465
+ function Cm(e) {
14466
+ let { basePeak: t, index: n, playheadIndex: r, timeSeconds: i, reduced: a, energy: o = 1 } = e;
14467
+ if (a || o <= 0) return t;
14468
+ let s = n - r, c = mm(s), l = hm(s), u = c * .15 + l * .2 + c * .28 * gm(n, i), d = s <= 0 ? 1 : Math.max(0, 1 - s / bm), f = t + (u + _m(n, i) * (vm + ym * d)) * o;
14469
+ return Math.min(1, Math.max(0, f));
14470
+ }
14438
14471
  //#endregion
14439
14472
  //#region src/tools/audio/waveform.ts
14440
- function mm(e, t, n) {
14473
+ function wm(e, t, n) {
14441
14474
  return e.slice(t, n).reduce((e, t) => Math.max(e, Math.abs(t)), 0);
14442
14475
  }
14443
- function hm(e, t = 300) {
14476
+ function Tm(e, t = 300) {
14444
14477
  if (e.length === 0) return Array(t).fill(0);
14445
- let n = e.length / t, r = Array.from({ length: t }, (t, r) => mm(e, Math.floor(r * n), Math.min(e.length, Math.floor((r + 1) * n)))), i = Math.max(0, ...r);
14478
+ let n = e.length / t, r = Array.from({ length: t }, (t, r) => wm(e, Math.floor(r * n), Math.min(e.length, Math.floor((r + 1) * n)))), i = Math.max(0, ...r);
14446
14479
  return i <= 0 ? r : r.map((e) => e / i);
14447
14480
  }
14448
- function gm(e, t = 300) {
14481
+ function Em(e, t = 300) {
14449
14482
  let { numberOfChannels: n, length: r } = e;
14450
- if (n <= 1) return hm(e.getChannelData(0), t);
14483
+ if (n <= 1) return Tm(e.getChannelData(0), t);
14451
14484
  let i = new Float32Array(r);
14452
14485
  return Array.from({ length: n }, (t, n) => e.getChannelData(n)).forEach((e) => {
14453
14486
  e.forEach((e, t) => {
14454
14487
  i[t] += e / n;
14455
14488
  });
14456
- }), hm(i, t);
14489
+ }), Tm(i, t);
14457
14490
  }
14458
- function _m(e, t) {
14491
+ function Dm(e, t) {
14459
14492
  if (t.width <= 0) return 0;
14460
14493
  let n = (e - t.left) / t.width;
14461
14494
  return Math.min(1, Math.max(0, n));
14462
14495
  }
14463
- function vm() {
14496
+ function Om() {
14464
14497
  var e, t;
14465
14498
  let n = globalThis;
14466
14499
  return (e = (t = n.AudioContext) == null ? n.webkitAudioContext : t) == null ? null : e;
14467
14500
  }
14468
- async function ym(e) {
14469
- let t = vm();
14501
+ async function km(e) {
14502
+ let t = Om();
14470
14503
  if (!t) return null;
14471
14504
  try {
14472
14505
  let n = new t();
14473
14506
  try {
14474
14507
  let t = await n.decodeAudioData(await e.arrayBuffer());
14475
14508
  return {
14476
- peaks: gm(t),
14509
+ peaks: Em(t),
14477
14510
  duration: t.duration
14478
14511
  };
14479
14512
  } finally {
@@ -14483,42 +14516,77 @@ async function ym(e) {
14483
14516
  return null;
14484
14517
  }
14485
14518
  }
14486
- function bm(e) {
14519
+ function Am(e) {
14487
14520
  let { mount: t, media: n, peaks: r } = e, i = document.createElement("canvas");
14488
14521
  i.setAttribute("data-role", "audio-waveform-canvas"), i.className = "blok-audio-waveform__canvas", t.appendChild(i);
14489
14522
  let a = () => {
14490
- let e = i.getBoundingClientRect();
14491
- if (e.width <= 0 || e.height <= 0) return;
14492
- let t = globalThis.devicePixelRatio || 1;
14493
- i.width = Math.round(e.width * t), i.height = Math.round(e.height * t);
14494
- let a = i.getContext("2d");
14495
- if (!a) return;
14496
- a.scale(t, t);
14497
- let o = n.duration ? n.currentTime / n.duration : 0, s = e.width / r.length, c = Math.min(2, s * .34), l = Math.max(1, s - c), u = Math.min(l / 2, 2), d = getComputedStyle(i), f = d.getPropertyValue("--blok-audio-bar-played").trim() || "#222", p = d.getPropertyValue("--blok-audio-bar").trim() || "#ccc";
14498
- r.forEach((t, n) => {
14499
- let i = Math.max(2, t * e.height * .92), c = n * s, d = (e.height - i) / 2;
14500
- a.fillStyle = n / r.length < o ? f : p, typeof a.roundRect == "function" ? (a.beginPath(), a.roundRect(c, d, l, i, u), a.fill()) : a.fillRect(c, d, l, i);
14523
+ var e, t, n;
14524
+ return (e = (t = (n = globalThis).matchMedia) == null ? void 0 : t.call(n, "(prefers-reduced-motion: reduce)").matches) == null ? !1 : e;
14525
+ }, o = {
14526
+ playing: !1,
14527
+ settling: !1,
14528
+ settleStart: 0,
14529
+ entranceStart: 0,
14530
+ rafId: 0
14531
+ }, s = (e) => o.playing ? 1 : o.settling ? Math.min(1, Math.max(0, 1 - (e - o.settleStart) / 420)) : 0, c = (e) => xm((e - o.entranceStart) / 650), l = (e) => {
14532
+ let t = i.getBoundingClientRect();
14533
+ if (t.width <= 0 || t.height <= 0) return;
14534
+ let o = globalThis.devicePixelRatio || 1, l = Math.round(t.width * o), u = Math.round(t.height * o);
14535
+ (i.width !== l || i.height !== u) && (i.width = l, i.height = u);
14536
+ let d = i.getContext("2d");
14537
+ if (!d) return;
14538
+ d.setTransform(o, 0, 0, o, 0, 0), d.clearRect(0, 0, t.width, t.height);
14539
+ let f = (n.duration ? n.currentTime / n.duration : 0) * r.length, p = a(), m = e / 1e3, h = p ? 0 : s(e), g = h > 0, _ = g ? c(e) : 0, v = t.width / r.length, y = Math.min(2, v * .34), b = Math.max(1, v - y), x = Math.min(b / 2, 2), S = getComputedStyle(i), C = S.getPropertyValue("--blok-audio-bar-played").trim() || "#222", w = S.getPropertyValue("--blok-audio-bar").trim() || "#ccc", T = S.getPropertyValue("--blok-audio-bar-head").trim() || C, E = (e, t, n) => {
14540
+ typeof d.roundRect == "function" ? (d.beginPath(), d.roundRect(e, t, b, n, x), d.fill()) : d.fillRect(e, t, b, n);
14541
+ };
14542
+ r.forEach((e, n) => {
14543
+ let r = g ? Cm({
14544
+ basePeak: e,
14545
+ index: n,
14546
+ playheadIndex: f,
14547
+ timeSeconds: m,
14548
+ reduced: p,
14549
+ energy: h
14550
+ }) : e, i = Math.max(2, r * t.height * .92), a = n * v, o = (t.height - i) / 2;
14551
+ if (d.fillStyle = n < f ? C : w, E(a, o, i), g) {
14552
+ let e = Sm({
14553
+ distance: n - f,
14554
+ energy: h,
14555
+ entrance: _
14556
+ });
14557
+ e > .001 && (d.save(), d.globalAlpha = Math.min(1, e), d.fillStyle = T, E(a, o, i), d.restore());
14558
+ }
14501
14559
  });
14502
- }, o = { id: 0 }, s = () => {
14503
- o.id || (o.id = requestAnimationFrame(() => {
14504
- o.id = 0, t.style.setProperty("--blok-audio-seek-pct", String(n.duration ? n.currentTime / n.duration * 100 : 0)), a();
14505
- }));
14506
- }, c = (e) => {
14507
- n.duration && (n.currentTime = _m(e, i.getBoundingClientRect()) * n.duration, a());
14508
- }, l = { active: !1 }, u = (e) => {
14509
- l.active = !0, c(e.clientX);
14560
+ }, u = () => {
14561
+ t.style.setProperty("--blok-audio-seek-pct", String(n.duration ? n.currentTime / n.duration * 100 : 0));
14510
14562
  }, d = (e) => {
14511
- l.active && c(e.clientX);
14563
+ l(e), o.playing || o.settling && s(e) > 0 ? o.rafId = requestAnimationFrame(d) : (o.settling = !1, o.rafId = 0);
14512
14564
  }, f = () => {
14513
- l.active = !1;
14565
+ var e, t, n;
14566
+ u(), o.playing = !0, o.settling = !1, o.entranceStart = (e = (t = globalThis.performance) == null || (n = t.now) == null ? void 0 : n.call(t)) == null ? 0 : e, !o.rafId && !a() && (o.rafId = requestAnimationFrame(d));
14567
+ }, p = () => {
14568
+ if (o.playing && !a()) {
14569
+ var e, t, n;
14570
+ o.playing = !1, o.settling = !0, o.settleStart = (e = (t = globalThis.performance) == null || (n = t.now) == null ? void 0 : n.call(t)) == null ? 0 : e, o.rafId || (o.rafId = requestAnimationFrame(d));
14571
+ } else o.playing = !1, o.settling = !1, o.rafId && (cancelAnimationFrame(o.rafId), o.rafId = 0), l(0);
14572
+ }, m = () => {
14573
+ u(), o.rafId || l(0);
14574
+ }, h = (e) => {
14575
+ n.duration && (n.currentTime = Dm(e, i.getBoundingClientRect()) * n.duration, u(), o.rafId || l(0));
14576
+ }, g = { active: !1 }, _ = (e) => {
14577
+ g.active = !0, h(e.clientX);
14578
+ }, v = (e) => {
14579
+ g.active && h(e.clientX);
14580
+ }, y = () => {
14581
+ g.active = !1;
14514
14582
  };
14515
- return i.addEventListener("pointerdown", u), globalThis.addEventListener("pointermove", d), globalThis.addEventListener("pointerup", f), n.addEventListener("timeupdate", s), n.addEventListener("loadedmetadata", a), a(), { destroy() {
14516
- o.id && cancelAnimationFrame(o.id), i.removeEventListener("pointerdown", u), globalThis.removeEventListener("pointermove", d), globalThis.removeEventListener("pointerup", f), n.removeEventListener("timeupdate", s), n.removeEventListener("loadedmetadata", a), i.remove();
14583
+ return i.addEventListener("pointerdown", _), globalThis.addEventListener("pointermove", v), globalThis.addEventListener("pointerup", y), n.addEventListener("play", f), n.addEventListener("pause", p), n.addEventListener("ended", p), n.addEventListener("timeupdate", m), n.addEventListener("loadedmetadata", m), l(0), { destroy() {
14584
+ o.rafId && cancelAnimationFrame(o.rafId), o.playing = !1, i.removeEventListener("pointerdown", _), globalThis.removeEventListener("pointermove", v), globalThis.removeEventListener("pointerup", y), n.removeEventListener("play", f), n.removeEventListener("pause", p), n.removeEventListener("ended", p), n.removeEventListener("timeupdate", m), n.removeEventListener("loadedmetadata", m), i.remove();
14517
14585
  } };
14518
14586
  }
14519
14587
  //#endregion
14520
14588
  //#region src/tools/audio/metadata.ts
14521
- function xm(e) {
14589
+ function jm(e) {
14522
14590
  var t, n, r;
14523
14591
  let i = (t = e.common) == null ? {} : t, a = {};
14524
14592
  i.title && (a.title = i.title), i.artist && (a.artist = i.artist);
@@ -14528,39 +14596,39 @@ function xm(e) {
14528
14596
  mimeType: (r = o.format) == null ? "image/jpeg" : r
14529
14597
  }), a;
14530
14598
  }
14531
- function Sm(e) {
14599
+ function Mm(e) {
14532
14600
  return btoa(Array.from(e, (e) => String.fromCharCode(e)).join(""));
14533
14601
  }
14534
- async function Cm(e, t) {
14602
+ async function Nm(e, t) {
14535
14603
  if (t != null && t.uploadByFile) {
14536
14604
  let n = new File([new Uint8Array(e.data)], "cover", { type: e.mimeType });
14537
14605
  return (await t.uploadByFile(n)).url;
14538
14606
  }
14539
- if (e.data.byteLength <= 153600) return `data:${e.mimeType};base64,${Sm(e.data)}`;
14607
+ if (e.data.byteLength <= 153600) return `data:${e.mimeType};base64,${Mm(e.data)}`;
14540
14608
  }
14541
- async function wm(e) {
14609
+ async function Pm(e) {
14542
14610
  try {
14543
14611
  let t = await import("./core-DdDpt2u7.mjs"), n = new Uint8Array(await e.arrayBuffer());
14544
- return xm(await t.parseBuffer(n, e.type));
14612
+ return jm(await t.parseBuffer(n, e.type));
14545
14613
  } catch (e) {
14546
14614
  return {};
14547
14615
  }
14548
14616
  }
14549
14617
  //#endregion
14550
14618
  //#region src/tools/audio/uploader.ts
14551
- var Tm = class extends Error {
14619
+ var Fm = class extends Error {
14552
14620
  constructor(e, t) {
14553
14621
  super(t ? `${e}: ${t}` : e), this.code = e, this.name = "AudioUploadError", this.detail = t;
14554
14622
  }
14555
14623
  };
14556
- function Em(e) {
14624
+ function Im(e) {
14557
14625
  try {
14558
14626
  return new URL(e);
14559
14627
  } catch (e) {
14560
14628
  return null;
14561
14629
  }
14562
14630
  }
14563
- var Dm = class {
14631
+ var Lm = class {
14564
14632
  constructor(e) {
14565
14633
  this.config = e;
14566
14634
  }
@@ -14576,20 +14644,20 @@ var Dm = class {
14576
14644
  };
14577
14645
  }
14578
14646
  validateUrl(e) {
14579
- let t = Em(e);
14580
- if (!t) throw new Tm("INVALID_URL", e);
14581
- if (t.protocol !== "http:" && t.protocol !== "https:") throw new Tm("INVALID_URL", t.protocol);
14647
+ let t = Im(e);
14648
+ if (!t) throw new Fm("INVALID_URL", e);
14649
+ if (t.protocol !== "http:" && t.protocol !== "https:") throw new Fm("INVALID_URL", t.protocol);
14582
14650
  }
14583
14651
  validateFile(e) {
14584
14652
  var t;
14585
14653
  let n = (t = this.config.types) == null ? [...rm] : t, r = uu(this.config.maxSize, e.type, im);
14586
- if (e.type && !Jl(e.type, n)) throw new Tm("UNSUPPORTED_TYPE", e.type);
14587
- if (e.size > r) throw new Tm("FILE_TOO_LARGE", `${e.size} > ${r}`);
14654
+ if (e.type && !Jl(e.type, n)) throw new Fm("UNSUPPORTED_TYPE", e.type);
14655
+ if (e.size > r) throw new Fm("FILE_TOO_LARGE", `${e.size} > ${r}`);
14588
14656
  }
14589
- }, Om = class {
14657
+ }, Rm = class {
14590
14658
  constructor(e) {
14591
14659
  var t, n, r;
14592
- this.root = null, this.uploadingEl = null, this.lastFileName = null, this.errorMessage = null, this.lastSource = null, this.controlsHandle = null, this.waveformHandle = null, this.destroyed = !1, this.api = e.api, this.block = e.block, this.config = (t = e.config) == null ? {} : t, this.readOnly = e.readOnly, this.data = W(W({}, e.data), {}, { url: (n = (r = e.data) == null ? void 0 : r.url) == null ? "" : n }), this.state = this.data.url ? "RENDERED" : "EMPTY", this.uploader = new Dm(this.config);
14660
+ this.root = null, this.uploadingEl = null, this.lastFileName = null, this.errorMessage = null, this.lastSource = null, this.controlsHandle = null, this.waveformHandle = null, this.destroyed = !1, this.api = e.api, this.block = e.block, this.config = (t = e.config) == null ? {} : t, this.readOnly = e.readOnly, this.data = W(W({}, e.data), {}, { url: (n = (r = e.data) == null ? void 0 : r.url) == null ? "" : n }), this.state = this.data.url ? "RENDERED" : "EMPTY", this.uploader = new Lm(this.config);
14593
14661
  }
14594
14662
  render() {
14595
14663
  let e = document.createElement("div");
@@ -14740,20 +14808,20 @@ var Dm = class {
14740
14808
  url: e.url,
14741
14809
  fileName: (r = (i = e.fileName) == null ? this.lastFileName : i) == null ? this.data.fileName : r,
14742
14810
  mimeType: (t == null ? void 0 : t.type) || this.data.mimeType
14743
- }), this.errorMessage = null, this.state = "RENDERED", this.renderState(), this.block.dispatchChange(), t && (wm(t).then(async (e) => {
14811
+ }), this.errorMessage = null, this.state = "RENDERED", this.renderState(), this.block.dispatchChange(), t && (Pm(t).then(async (e) => {
14744
14812
  if (n.destroyed) return;
14745
14813
  let t = { value: !1 };
14746
14814
  if (e.title && (n.data.title = e.title, t.value = !0), e.artist && (n.data.artist = e.artist, t.value = !0), e.cover) {
14747
- let r = await Cm(e.cover, n.config.uploader).catch(() => void 0);
14815
+ let r = await Nm(e.cover, n.config.uploader).catch(() => void 0);
14748
14816
  r && (n.data.coverUrl = r, t.value = !0);
14749
14817
  }
14750
14818
  n.destroyed || t.value && (n.renderState(), n.block.dispatchChange());
14751
- }).catch(() => {}), ym(t).then((e) => {
14819
+ }).catch(() => {}), km(t).then((e) => {
14752
14820
  this.destroyed || e && e.peaks.length && (this.data.peaks = e.peaks, this.data.duration = e.duration, this.renderState(), this.block.dispatchChange());
14753
14821
  }).catch(() => {}));
14754
14822
  }
14755
14823
  applyError(e) {
14756
- this.errorMessage = e instanceof Tm ? lu(e, (e) => this.api.i18n.t(e), {
14824
+ this.errorMessage = e instanceof Fm ? lu(e, (e) => this.api.i18n.t(e), {
14757
14825
  tooLarge: "tools.audio.errorFileTooLarge",
14758
14826
  generic: "tools.audio.errorUploadFailed"
14759
14827
  }) : null, this.state = "ERROR", this.renderState();
@@ -14819,7 +14887,7 @@ var Dm = class {
14819
14887
  titlePlaceholder: n,
14820
14888
  artistPlaceholder: r
14821
14889
  });
14822
- (e = this.data.peaks) != null && e.length && (this.waveformHandle = bm({
14890
+ (e = this.data.peaks) != null && e.length && (this.waveformHandle = Am({
14823
14891
  mount: o,
14824
14892
  media: a,
14825
14893
  peaks: this.data.peaks
@@ -14877,7 +14945,7 @@ var Dm = class {
14877
14945
  let e = navigator.clipboard;
14878
14946
  e && typeof e.writeText == "function" && e.writeText(this.data.url);
14879
14947
  }
14880
- }, km = ["video/*"], Am = 100 * 1024 * 1024, jm = "Write a caption…", Mm = /^https?:\/\/\S+\.(mp4|webm|ogg|mov|m4v)(\?\S*)?$/i;
14948
+ }, zm = ["video/*"], Bm = 100 * 1024 * 1024, Vm = "Write a caption…", Hm = /^https?:\/\/\S+\.(mp4|webm|ogg|mov|m4v)(\?\S*)?$/i;
14881
14949
  //#endregion
14882
14950
  //#region src/tools/video/i18n.ts
14883
14951
  function Q(e, t, n) {
@@ -14885,11 +14953,11 @@ function Q(e, t, n) {
14885
14953
  }
14886
14954
  //#endregion
14887
14955
  //#region src/tools/video/empty-state.ts
14888
- function Nm(e) {
14956
+ function Um(e) {
14889
14957
  var t;
14890
14958
  let n = e.i18n;
14891
14959
  return ou({
14892
- acceptTypes: (t = e.acceptTypes) == null ? [...km] : t,
14960
+ acceptTypes: (t = e.acceptTypes) == null ? [...zm] : t,
14893
14961
  maxSize: e.maxSize,
14894
14962
  onFile: e.onFile,
14895
14963
  onUrl: e.onUrl,
@@ -14910,21 +14978,21 @@ function Nm(e) {
14910
14978
  }
14911
14979
  //#endregion
14912
14980
  //#region src/tools/video/ui.ts
14913
- var Pm = {
14981
+ var Wm = {
14914
14982
  left: "left",
14915
14983
  center: "center",
14916
14984
  right: "right"
14917
14985
  };
14918
- function Fm(e) {
14986
+ function Gm(e) {
14919
14987
  var t, n;
14920
14988
  let r = (t = e.alignment) == null ? "center" : t, i = document.createElement("figure");
14921
- i.className = "blok-video-inner", i.setAttribute("data-role", "video-figure"), i.style.margin = "0", i.style.textAlign = Pm[r], i.style.position = "relative", e.width !== void 0 && (i.style.width = `${e.width}%`);
14989
+ i.className = "blok-video-inner", i.setAttribute("data-role", "video-figure"), i.style.margin = "0", i.style.textAlign = Wm[r], i.style.position = "relative", e.width !== void 0 && (i.style.width = `${e.width}%`);
14922
14990
  let a = document.createElement("div");
14923
14991
  a.className = "blok-video-media", a.setAttribute("data-role", "video-media"), a.style.position = "relative", a.style.aspectRatio = (n = e.aspectRatio) == null ? "16 / 9" : n;
14924
14992
  let o = document.createElement("video");
14925
14993
  return o.setAttribute("data-blok-testid", "video-player"), o.setAttribute("playsinline", ""), o.setAttribute("preload", "metadata"), o.setAttribute("tabindex", "0"), o.setAttribute("aria-keyshortcuts", "Space k j l ArrowLeft ArrowRight ArrowUp ArrowDown m f Home End"), o.setAttribute("src", e.url), o.style.width = "100%", o.style.display = "block", a.appendChild(o), i.appendChild(a), i;
14926
14994
  }
14927
- function Im(e) {
14995
+ function Km(e) {
14928
14996
  let t = document.createElement("div");
14929
14997
  t.className = "blok-video-caption-row", t.setAttribute("data-role", "video-caption-row");
14930
14998
  let n = document.createElement("div");
@@ -14935,12 +15003,12 @@ function Im(e) {
14935
15003
  }
14936
15004
  //#endregion
14937
15005
  //#region src/tools/video/controls.ts
14938
- function Lm(e) {
15006
+ function qm(e) {
14939
15007
  if (!Number.isFinite(e) || e <= 0) return "0:00";
14940
15008
  let t = Math.floor(e);
14941
15009
  return `${Math.floor(t / 60)}:${(t % 60).toString().padStart(2, "0")}`;
14942
15010
  }
14943
- function Rm(e, t, n) {
15011
+ function Jm(e, t, n) {
14944
15012
  var r, i;
14945
15013
  if (!e || e.length === 0 || !Number.isFinite(n) || n <= 0) return 0;
14946
15014
  let a = Array.from({ length: e.length }, (t, n) => ({
@@ -14949,17 +15017,17 @@ function Rm(e, t, n) {
14949
15017
  })), o = a.find((e) => e.start <= t && t <= e.end), s = a.filter((e) => e.end <= t).at(-1), c = (r = (i = o == null ? void 0 : o.end) == null ? s == null ? void 0 : s.end : i) == null ? 0 : r;
14950
15018
  return Math.min(100, Math.max(0, c / n * 100));
14951
15019
  }
14952
- function zm(e, t) {
15020
+ function Ym(e, t) {
14953
15021
  return !Number.isFinite(t) || t <= 0 ? 0 : Math.min(1, Math.max(0, e)) * t;
14954
15022
  }
14955
- function Bm(e, t) {
15023
+ function Xm(e, t) {
14956
15024
  return t.width ? Math.min(1, Math.max(0, (e - t.left) / t.width)) : 0;
14957
15025
  }
14958
- function Vm(e, t, n, r = "") {
15026
+ function Zm(e, t, n, r = "") {
14959
15027
  let i = document.createElement("button");
14960
15028
  return i.type = "button", i.setAttribute("data-action", e), i.setAttribute("aria-label", t), i.className = `blok-video-controls__btn ${r}`.trim(), i.innerHTML = n, i;
14961
15029
  }
14962
- function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1 }) {
15030
+ function Qm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1 }) {
14963
15031
  var a, o;
14964
15032
  let s = document.createElement("div");
14965
15033
  s.className = "blok-video-controls", s.setAttribute("data-role", "video-controls");
@@ -14975,7 +15043,7 @@ function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1
14975
15043
  p.className = "blok-video-controls__spinner", p.setAttribute("data-role", "buffer-spinner"), p.setAttribute("data-active", "false"), p.setAttribute("aria-hidden", "true"), s.appendChild(p);
14976
15044
  let m = document.createElement("div");
14977
15045
  m.className = "blok-video-controls__bar";
14978
- let h = Vm("play-toggle", "Play", xn), _ = document.createElement("input");
15046
+ let h = Zm("play-toggle", "Play", xn), _ = document.createElement("input");
14979
15047
  _.type = "range", _.min = "0", _.max = "0", _.step = "any", _.value = "0", _.className = "blok-video-controls__seek", _.setAttribute("data-role", "seek"), _.setAttribute("aria-label", "Seek");
14980
15048
  let v = document.createElement("div");
14981
15049
  v.className = "blok-video-controls__seek-wrap", v.setAttribute("data-role", "seek-wrap");
@@ -14989,11 +15057,11 @@ function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1
14989
15057
  C.className = "blok-video-controls__seek-time", C.setAttribute("data-role", "seek-time"), x.append(S, C), v.append(b, _, x);
14990
15058
  let w = document.createElement("span");
14991
15059
  w.className = "blok-video-controls__time", w.setAttribute("data-role", "time"), w.setAttribute("role", "button"), w.setAttribute("tabindex", "0"), w.textContent = "0:00 / 0:00";
14992
- let T = Vm("mute-toggle", "Mute", f);
15060
+ let T = Zm("mute-toggle", "Mute", f);
14993
15061
  T.setAttribute("aria-pressed", "false");
14994
15062
  let E = document.createElement("input");
14995
15063
  E.type = "range", E.min = "0", E.max = "1", E.step = "0.05", E.value = "1", E.className = "blok-video-controls__volume", E.setAttribute("data-role", "volume"), E.setAttribute("aria-label", "Volume");
14996
- let D = Vm("fullscreen", "Fullscreen", Cn), ee = document.createElement("div");
15064
+ let D = Zm("fullscreen", "Fullscreen", Cn), ee = document.createElement("div");
14997
15065
  ee.className = "blok-video-controls__volume-wrap", ee.append(T, E), m.append(h, ee, w, v, D), s.appendChild(m);
14998
15066
  let O = document.createElement("div");
14999
15067
  O.className = "blok-video-controls__mini", O.setAttribute("data-role", "mini-progress"), O.setAttribute("aria-hidden", "true"), s.appendChild(O);
@@ -15013,8 +15081,8 @@ function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1
15013
15081
  let te = () => {
15014
15082
  if (j.timeMode === "remaining") {
15015
15083
  let t = Number.isFinite(e.duration) ? e.duration : 0;
15016
- w.textContent = `-${Lm(Math.max(0, t - e.currentTime))}`;
15017
- } else w.textContent = `${Lm(e.currentTime)} / ${Lm(e.duration)}`;
15084
+ w.textContent = `-${qm(Math.max(0, t - e.currentTime))}`;
15085
+ } else w.textContent = `${qm(e.currentTime)} / ${qm(e.duration)}`;
15018
15086
  }, ne = () => {
15019
15087
  j.timeMode = j.timeMode === "elapsed" ? "remaining" : "elapsed", te();
15020
15088
  }, N = () => {
@@ -15025,7 +15093,7 @@ function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1
15025
15093
  let e = Number(_.max) || 0, t = e > 0 ? Number(_.value) / e * 100 : 0;
15026
15094
  s.style.setProperty("--blok-seek-pct", `${t}%`);
15027
15095
  }, se = () => {
15028
- let t = Rm(e.buffered, e.currentTime, e.duration);
15096
+ let t = Jm(e.buffered, e.currentTime, e.duration);
15029
15097
  b.style.setProperty("--blok-buffered-pct", `${t}%`);
15030
15098
  }, ce = () => {
15031
15099
  let t = Number.isFinite(e.duration) ? e.duration : 0;
@@ -15067,8 +15135,8 @@ function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1
15067
15135
  I.ready = !0, I.pendingTime >= 0 && _e(I.pendingTime);
15068
15136
  }), n.addEventListener("seeked", ge), I.el = n, s.appendChild(n);
15069
15137
  }, ve = (t) => {
15070
- let n = _.getBoundingClientRect(), r = Bm(t.clientX, n), i = zm(r, e.duration);
15071
- C.textContent = Lm(i), x.style.setProperty("--blok-tooltip-x", `${r * 100}%`), x.setAttribute("aria-hidden", "false"), Number.isFinite(e.duration) && e.duration > 0 && (L(), _e(i));
15138
+ let n = _.getBoundingClientRect(), r = Xm(t.clientX, n), i = Ym(r, e.duration);
15139
+ C.textContent = qm(i), x.style.setProperty("--blok-tooltip-x", `${r * 100}%`), x.setAttribute("aria-hidden", "false"), Number.isFinite(e.duration) && e.duration > 0 && (L(), _e(i));
15072
15140
  }, ye = () => {
15073
15141
  x.setAttribute("aria-hidden", "true"), I.pendingTime = -1;
15074
15142
  }, be = () => M(!0), xe = () => M(!1), Se = () => e.muted || e.volume === 0, Ce = () => {
@@ -15221,7 +15289,7 @@ function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1
15221
15289
  row: i,
15222
15290
  value: s
15223
15291
  };
15224
- }, st = Vm("gear", "Settings", nt);
15292
+ }, st = Zm("gear", "Settings", nt);
15225
15293
  st.setAttribute("aria-haspopup", "menu"), st.setAttribute("aria-expanded", "false");
15226
15294
  let z = document.createElement("div");
15227
15295
  z.className = "blok-video-controls__menu", z.setAttribute("data-role", "playback-menu"), z.setAttribute("role", "menu"), z.setAttribute("data-view", "main"), z.hidden = !0, z.addEventListener("scroll", () => {
@@ -15333,7 +15401,7 @@ function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1
15333
15401
  it || r === "none" || (V.setAttribute("data-active", "true"), !Ut.raf && (Ut.raf = requestAnimationFrame(Gt)));
15334
15402
  }, qt = () => {
15335
15403
  V.setAttribute("data-active", "false"), Ut.raf && (cancelAnimationFrame(Ut.raf), Ut.raf = 0);
15336
- }, Yt = he(), Xt = Vm("theater", "Theater mode", De);
15404
+ }, Yt = he(), Xt = Zm("theater", "Theater mode", De);
15337
15405
  Xt.setAttribute("aria-pressed", "false");
15338
15406
  let Zt = {
15339
15407
  on: !1,
@@ -15403,7 +15471,7 @@ function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1
15403
15471
  e !== Zt.on && (Zt.on = e, Xt.setAttribute("aria-pressed", String(e)), Xt.setAttribute("aria-label", e ? "Exit theater mode" : "Theater mode"), e ? (on(), window.addEventListener("keydown", Qt, !0), document.addEventListener("pointerdown", $t)) : (window.removeEventListener("keydown", Qt, !0), document.removeEventListener("pointerdown", $t), sn()), t.dispatchEvent(new CustomEvent("blok-video-theater", { detail: { on: e } })));
15404
15472
  };
15405
15473
  Xt.addEventListener("click", () => cn(!Zt.on)), m.insertBefore(Xt, D);
15406
- let H = document.pictureInPictureEnabled ? Vm("picture-in-picture", "Picture-in-Picture", pn) : null, ln = () => H == null ? void 0 : H.setAttribute("aria-pressed", "true"), un = () => H == null ? void 0 : H.setAttribute("aria-pressed", "false");
15474
+ let H = document.pictureInPictureEnabled ? Zm("picture-in-picture", "Picture-in-Picture", pn) : null, ln = () => H == null ? void 0 : H.setAttribute("aria-pressed", "true"), un = () => H == null ? void 0 : H.setAttribute("aria-pressed", "false");
15407
15475
  H && (H.setAttribute("aria-pressed", "false"), H.addEventListener("click", () => {
15408
15476
  var t, n, r;
15409
15477
  document.pictureInPictureElement === e ? (t = (n = document).exitPictureInPicture) == null || t.call(n) : (r = e.requestPictureInPicture) == null || r.call(e);
@@ -15503,19 +15571,19 @@ function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1
15503
15571
  }
15504
15572
  //#endregion
15505
15573
  //#region src/tools/video/uploader.ts
15506
- var Um = class extends Error {
15574
+ var $m = class extends Error {
15507
15575
  constructor(e, t) {
15508
15576
  super(t ? `${e}: ${t}` : e), this.code = e, this.name = "VideoUploadError", this.detail = t;
15509
15577
  }
15510
15578
  };
15511
- function Wm(e) {
15579
+ function eh(e) {
15512
15580
  try {
15513
15581
  return new URL(e);
15514
15582
  } catch (e) {
15515
15583
  return null;
15516
15584
  }
15517
15585
  }
15518
- var Gm = class {
15586
+ var th = class {
15519
15587
  constructor(e) {
15520
15588
  this.config = e;
15521
15589
  }
@@ -15531,20 +15599,20 @@ var Gm = class {
15531
15599
  };
15532
15600
  }
15533
15601
  validateUrl(e) {
15534
- let t = Wm(e);
15535
- if (!t) throw new Um("INVALID_URL", e);
15536
- if (t.protocol !== "http:" && t.protocol !== "https:") throw new Um("INVALID_URL", t.protocol);
15602
+ let t = eh(e);
15603
+ if (!t) throw new $m("INVALID_URL", e);
15604
+ if (t.protocol !== "http:" && t.protocol !== "https:") throw new $m("INVALID_URL", t.protocol);
15537
15605
  }
15538
15606
  validateFile(e) {
15539
15607
  var t;
15540
- let n = (t = this.config.types) == null ? [...km] : t, r = uu(this.config.maxSize, e.type, Am);
15541
- if (e.type && !Jl(e.type, n)) throw new Um("UNSUPPORTED_TYPE", e.type);
15542
- if (e.size > r) throw new Um("FILE_TOO_LARGE", `${e.size} > ${r}`);
15608
+ let n = (t = this.config.types) == null ? [...zm] : t, r = uu(this.config.maxSize, e.type, Bm);
15609
+ if (e.type && !Jl(e.type, n)) throw new $m("UNSUPPORTED_TYPE", e.type);
15610
+ if (e.size > r) throw new $m("FILE_TOO_LARGE", `${e.size} > ${r}`);
15543
15611
  }
15544
- }, Km = class {
15612
+ }, nh = class {
15545
15613
  constructor(e) {
15546
15614
  var t, n, r;
15547
- this.root = null, this.uploadingEl = null, this.lastFileName = null, this.errorMessage = null, this.lastSource = null, this.resizeDetach = [], this.controlsHandle = null, this.theater = !1, this.api = e.api, this.block = e.block, this.config = (t = e.config) == null ? {} : t, this.readOnly = e.readOnly, this.data = W(W({}, e.data), {}, { url: (n = (r = e.data) == null ? void 0 : r.url) == null ? "" : n }), this.state = this.data.url ? "RENDERED" : "EMPTY", this.uploader = new Gm(this.config);
15615
+ this.root = null, this.uploadingEl = null, this.lastFileName = null, this.errorMessage = null, this.lastSource = null, this.resizeDetach = [], this.controlsHandle = null, this.theater = !1, this.api = e.api, this.block = e.block, this.config = (t = e.config) == null ? {} : t, this.readOnly = e.readOnly, this.data = W(W({}, e.data), {}, { url: (n = (r = e.data) == null ? void 0 : r.url) == null ? "" : n }), this.state = this.data.url ? "RENDERED" : "EMPTY", this.uploader = new th(this.config);
15548
15616
  }
15549
15617
  render() {
15550
15618
  let e = document.createElement("div");
@@ -15576,7 +15644,7 @@ var Gm = class {
15576
15644
  }
15577
15645
  static get pasteConfig() {
15578
15646
  return {
15579
- patterns: { video: Mm },
15647
+ patterns: { video: Hm },
15580
15648
  files: { mimeTypes: ["video/*"] }
15581
15649
  };
15582
15650
  }
@@ -15719,7 +15787,7 @@ var Gm = class {
15719
15787
  }), this.errorMessage = null, this.state = "RENDERED", this.renderState(), this.block.dispatchChange();
15720
15788
  }
15721
15789
  applyError(e) {
15722
- this.errorMessage = e instanceof Um ? lu(e, (e) => this.api.i18n.t(e), {
15790
+ this.errorMessage = e instanceof $m ? lu(e, (e) => this.api.i18n.t(e), {
15723
15791
  tooLarge: "tools.video.errorFileTooLarge",
15724
15792
  generic: "tools.video.errorUploadFailed"
15725
15793
  }) : null, this.state = "ERROR", this.renderState();
@@ -15756,7 +15824,7 @@ var Gm = class {
15756
15824
  }
15757
15825
  renderEmpty() {
15758
15826
  if (!this.root) return;
15759
- let e = Nm({
15827
+ let e = Um({
15760
15828
  onFile: (e) => this.startUpload(e),
15761
15829
  onUrl: (e) => this.startUrl(e),
15762
15830
  acceptTypes: this.config.types,
@@ -15786,11 +15854,11 @@ var Gm = class {
15786
15854
  renderRendered() {
15787
15855
  var e, t, n;
15788
15856
  if (!this.root) return;
15789
- let r = Fm(this.data), i = (e = r.querySelector("[data-role=\"video-media\"]")) == null ? r : e, a = i.querySelector("video");
15857
+ let r = Gm(this.data), i = (e = r.querySelector("[data-role=\"video-media\"]")) == null ? r : e, a = i.querySelector("video");
15790
15858
  if (a) {
15791
15859
  if (a.loop = this.data.loop === !0, this.readOnly && this.data.autoplay === !0 && (a.muted = !0, a.setAttribute("muted", ""), a.setAttribute("autoplay", "")), this.data.hideControls !== !0) {
15792
15860
  var o;
15793
- this.controlsHandle = Hm({
15861
+ this.controlsHandle = Qm({
15794
15862
  video: a,
15795
15863
  figure: r,
15796
15864
  glow: (o = this.config.glow) == null ? "minimal" : o,
@@ -15807,10 +15875,10 @@ var Gm = class {
15807
15875
  r.addEventListener("blok-video-theater", (e) => {
15808
15876
  this.theater = e.detail.on;
15809
15877
  }), this.theater && ((t = this.controlsHandle) == null || t.setTheater(!0));
15810
- let s = (n = this.config.captionPlaceholder) == null ? jm : n;
15878
+ let s = (n = this.config.captionPlaceholder) == null ? Vm : n;
15811
15879
  if (this.data.captionVisible !== !1 || !this.readOnly) {
15812
15880
  var c;
15813
- r.appendChild(Im({
15881
+ r.appendChild(Km({
15814
15882
  value: (c = this.data.caption) == null ? "" : c,
15815
15883
  placeholder: s,
15816
15884
  readOnly: this.readOnly,
@@ -15870,7 +15938,7 @@ var Gm = class {
15870
15938
  let e = navigator.clipboard;
15871
15939
  e && typeof e.writeText == "function" && e.writeText(this.data.url);
15872
15940
  }
15873
- }, qm = class {
15941
+ }, rh = class {
15874
15942
  constructor({ data: e, api: t, block: n, readOnly: r }) {
15875
15943
  this.container = null, this.api = t, this._data = W({}, e), this.blockId = n.id, this.readOnly = r;
15876
15944
  }
@@ -15942,7 +16010,7 @@ var Gm = class {
15942
16010
  static get isReadOnlySupported() {
15943
16011
  return !0;
15944
16012
  }
15945
- }, Jm = class {
16013
+ }, ih = class {
15946
16014
  constructor({ data: e, api: t, block: n }) {
15947
16015
  this.childContainer = null, this.populated = !1, this.api = t, this._data = W({}, e), this.blockId = n.id, this.block = n;
15948
16016
  }
@@ -16002,71 +16070,71 @@ var Gm = class {
16002
16070
  static get isReadOnlySupported() {
16003
16071
  return !0;
16004
16072
  }
16005
- }, Ym = class {
16073
+ }, ah = class {
16006
16074
  static get provides() {
16007
16075
  return {
16008
- column_list: qm,
16009
- column: Jm
16076
+ column_list: rh,
16077
+ column: ih
16010
16078
  };
16011
16079
  }
16012
- }, Xm = {
16080
+ }, oh = {
16013
16081
  left: En,
16014
16082
  center: Te,
16015
16083
  right: u
16016
- }, Zm = {
16084
+ }, sh = {
16017
16085
  left: "tools.image.alignmentLeftAria",
16018
16086
  center: "tools.image.alignmentCenterAria",
16019
16087
  right: "tools.image.alignmentRightAria"
16020
- }, Qm = [
16088
+ }, ch = [
16021
16089
  "left",
16022
16090
  "center",
16023
16091
  "right"
16024
16092
  ];
16025
- function $m(e) {
16093
+ function lh(e) {
16026
16094
  let t = document.createElement("div");
16027
- return t.setAttribute("data-role", "embed-overlay"), t.className = "blok-embed-toolbar", eh(t, e), ih(t), rh(t, {
16095
+ return t.setAttribute("data-role", "embed-overlay"), t.className = "blok-embed-toolbar", uh(t, e), mh(t), ph(t, {
16028
16096
  action: "caption-toggle",
16029
16097
  label: e.i18n.t("tools.image.toggleCaption"),
16030
16098
  icon: T,
16031
16099
  pressed: e.captionVisible,
16032
16100
  onClick: e.onToggleCaption
16033
- }), th(t, e), ih(t), nh(t, e), t;
16101
+ }), dh(t, e), mh(t), fh(t, e), t;
16034
16102
  }
16035
- function eh(e, t) {
16103
+ function uh(e, t) {
16036
16104
  let n = document.createElement("div");
16037
16105
  n.className = "blok-embed-toolbar__align", n.style.position = "relative";
16038
16106
  let r = t.i18n.t("tools.image.alignment"), i = document.createElement("button");
16039
- i.type = "button", i.setAttribute("data-action", "align-trigger"), i.setAttribute("data-current", t.alignment), i.setAttribute("aria-label", r), i.setAttribute("aria-haspopup", "true"), i.setAttribute("aria-expanded", "false"), i.innerHTML = Xm[t.alignment], n.appendChild(i);
16107
+ i.type = "button", i.setAttribute("data-action", "align-trigger"), i.setAttribute("data-current", t.alignment), i.setAttribute("aria-label", r), i.setAttribute("aria-haspopup", "true"), i.setAttribute("aria-expanded", "false"), i.innerHTML = oh[t.alignment], n.appendChild(i);
16040
16108
  let a = document.createElement("div");
16041
16109
  a.setAttribute("data-role", "align-popover"), a.setAttribute("role", "group"), a.setAttribute("aria-label", r), a.className = "blok-embed-toolbar__align-popover", a.hidden = !0;
16042
- let o = ah(i, a);
16043
- for (let e of Qm) {
16110
+ let o = hh(i, a);
16111
+ for (let e of ch) {
16044
16112
  let n = document.createElement("button");
16045
- n.type = "button", n.setAttribute("data-action", `align-${e}`), n.setAttribute("aria-label", t.i18n.t(Zm[e])), n.setAttribute("aria-pressed", t.alignment === e ? "true" : "false"), n.innerHTML = Xm[e], n.addEventListener("click", (n) => {
16113
+ n.type = "button", n.setAttribute("data-action", `align-${e}`), n.setAttribute("aria-label", t.i18n.t(sh[e])), n.setAttribute("aria-pressed", t.alignment === e ? "true" : "false"), n.innerHTML = oh[e], n.addEventListener("click", (n) => {
16046
16114
  n.stopPropagation(), o(!1), t.onAlign(e);
16047
16115
  }), a.appendChild(n);
16048
16116
  }
16049
16117
  n.appendChild(a), e.appendChild(n);
16050
16118
  }
16051
- function th(e, t) {
16119
+ function dh(e, t) {
16052
16120
  let n = document.createElement("a");
16053
16121
  n.setAttribute("data-action", "open-original"), n.className = "blok-embed-toolbar__btn", n.href = t.source, n.target = "_blank", n.rel = "noreferrer nofollow", n.setAttribute("aria-label", t.i18n.t("tools.embed.openOriginal")), n.innerHTML = Ge, n.addEventListener("click", (e) => e.stopPropagation()), e.appendChild(n);
16054
16122
  }
16055
- function nh(e, t) {
16123
+ function fh(e, t) {
16056
16124
  let n = document.createElement("button");
16057
16125
  n.type = "button", n.className = "blok-embed-toolbar__btn", n.setAttribute("data-action", "more"), n.setAttribute("aria-label", t.i18n.t("tools.image.moreOptions")), n.setAttribute("aria-haspopup", "menu"), n.setAttribute("aria-expanded", "false"), n.innerHTML = rn, e.appendChild(n);
16058
16126
  }
16059
- function rh(e, t) {
16127
+ function ph(e, t) {
16060
16128
  let n = document.createElement("button");
16061
16129
  n.type = "button", n.className = "blok-embed-toolbar__btn", n.setAttribute("data-action", t.action), n.setAttribute("aria-label", t.label), t.pressed !== void 0 && n.setAttribute("aria-pressed", t.pressed ? "true" : "false"), n.innerHTML = t.icon, n.addEventListener("click", (e) => {
16062
16130
  e.stopPropagation(), t.onClick();
16063
16131
  }), e.appendChild(n);
16064
16132
  }
16065
- function ih(e) {
16133
+ function mh(e) {
16066
16134
  let t = document.createElement("div");
16067
16135
  t.className = "blok-embed-toolbar__divider", t.setAttribute("aria-hidden", "true"), e.appendChild(t);
16068
16136
  }
16069
- function ah(e, t) {
16137
+ function hh(e, t) {
16070
16138
  let n = (e) => {
16071
16139
  e.key === "Escape" && !t.hidden && (e.stopPropagation(), i(!1));
16072
16140
  }, r = (n) => {
@@ -16084,7 +16152,7 @@ function ah(e, t) {
16084
16152
  }
16085
16153
  //#endregion
16086
16154
  //#region src/tools/link/embed/index.ts
16087
- var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform.twitter.com/widgets.js", ch = "https://www.threads.com/embed.js", lh = 580, uh = 320, dh = 100, fh = "allow-scripts allow-same-origin allow-popups allow-presentation", ph = "encrypted-media; fullscreen; picture-in-picture", mh = class {
16155
+ var gh = "https://telegram.org/js/telegram-widget.js?22", _h = "https://platform.twitter.com/widgets.js", vh = "https://www.threads.com/embed.js", yh = 580, bh = 320, xh = 100, Sh = "allow-scripts allow-same-origin allow-popups allow-presentation", Ch = "encrypted-media; fullscreen; picture-in-picture", wh = class {
16088
16156
  constructor(e) {
16089
16157
  this.root = null, this.resizeDetach = [], this.api = e.api, this.block = e.block, this.readOnly = e.readOnly, this.data = W({}, e.data);
16090
16158
  }
@@ -16120,8 +16188,8 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16120
16188
  source: e,
16121
16189
  embed: t.embedUrl,
16122
16190
  kind: t.kind,
16123
- width: (n = r.width) == null ? lh : n,
16124
- height: (i = r.height) == null ? uh : i
16191
+ width: (n = r.width) == null ? yh : n,
16192
+ height: (i = r.height) == null ? bh : i
16125
16193
  }, this.renderState(), !0;
16126
16194
  }
16127
16195
  return this.isGenericAllowed() && xe(e) ? (this.data = {
@@ -16129,8 +16197,8 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16129
16197
  source: e,
16130
16198
  embed: e,
16131
16199
  kind: "iframe",
16132
- width: lh,
16133
- height: uh
16200
+ width: yh,
16201
+ height: bh
16134
16202
  }, this.renderState(), !0) : !1;
16135
16203
  }
16136
16204
  isGenericAllowed() {
@@ -16148,8 +16216,8 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16148
16216
  source: (t = this.data.source) == null ? "" : t,
16149
16217
  embed: (n = this.data.embed) == null ? "" : n,
16150
16218
  kind: (r = this.data.kind) == null ? "iframe" : r,
16151
- width: (i = this.data.width) == null ? lh : i,
16152
- height: (a = this.data.height) == null ? uh : a
16219
+ width: (i = this.data.width) == null ? yh : i,
16220
+ height: (a = this.data.height) == null ? bh : a
16153
16221
  }, this.data.widthPercent === void 0 ? {} : { widthPercent: this.data.widthPercent }), this.data.alignment === void 0 ? {} : { alignment: this.data.alignment }), this.data.caption === void 0 ? {} : { caption: this.data.caption }), this.data.captionVisible === void 0 ? {} : { captionVisible: this.data.captionVisible });
16154
16222
  }
16155
16223
  validate(e) {
@@ -16215,7 +16283,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16215
16283
  let a = this.data.source ? (e = (t = r(this.data.source)) == null ? void 0 : t.remoteId) == null ? "" : e : "";
16216
16284
  if (this.data.service === "telegram") {
16217
16285
  let e = document.createElement("script");
16218
- return e.async = !0, e.src = oh, e.setAttribute("data-telegram-post", a), e.setAttribute("data-width", "100%"), i.appendChild(e), i;
16286
+ return e.async = !0, e.src = gh, e.setAttribute("data-telegram-post", a), e.setAttribute("data-width", "100%"), i.appendChild(e), i;
16219
16287
  }
16220
16288
  if (this.data.service === "threads") {
16221
16289
  var o, s;
@@ -16224,14 +16292,14 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16224
16292
  let t = document.createElement("a");
16225
16293
  t.href = (s = this.data.embed) == null ? "" : s, e.appendChild(t), i.appendChild(e);
16226
16294
  let n = document.createElement("script");
16227
- return n.async = !0, n.src = ch, i.appendChild(n), i;
16295
+ return n.async = !0, n.src = vh, i.appendChild(n), i;
16228
16296
  }
16229
16297
  let c = document.createElement("blockquote");
16230
16298
  c.className = "twitter-tweet";
16231
16299
  let l = document.createElement("a");
16232
16300
  l.href = (n = this.data.source) == null ? "" : n, c.appendChild(l), i.appendChild(c);
16233
16301
  let u = document.createElement("script");
16234
- return u.async = !0, u.src = sh, i.appendChild(u), i;
16302
+ return u.async = !0, u.src = _h, i.appendChild(u), i;
16235
16303
  }
16236
16304
  buildEmpty() {
16237
16305
  let e = document.createElement("div");
@@ -16273,8 +16341,8 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16273
16341
  }
16274
16342
  buildIframeFigure() {
16275
16343
  var e, t, n;
16276
- let r = document.createElement("figure"), i = this.data.width && this.data.width > 0 ? this.data.width : lh, a = this.data.height && this.data.height > 0 ? this.data.height : uh, o = this.data.service !== void 0 && ((e = qe[this.data.service]) == null ? void 0 : e.fixedWidth) === !0;
16277
- r.setAttribute("data-role", "embed-figure"), r.style.position = "relative", r.style.maxWidth = o ? `${i}px` : "100%", r.style.width = `${(t = this.data.widthPercent) == null ? dh : t}%`;
16344
+ let r = document.createElement("figure"), i = this.data.width && this.data.width > 0 ? this.data.width : yh, a = this.data.height && this.data.height > 0 ? this.data.height : bh, o = this.data.service !== void 0 && ((e = qe[this.data.service]) == null ? void 0 : e.fixedWidth) === !0;
16345
+ r.setAttribute("data-role", "embed-figure"), r.style.position = "relative", r.style.maxWidth = o ? `${i}px` : "100%", r.style.width = `${(t = this.data.widthPercent) == null ? xh : t}%`;
16278
16346
  let s = (n = this.data.alignment) == null ? "center" : n;
16279
16347
  r.style.marginLeft = s === "left" ? "0" : "auto", r.style.marginRight = s === "right" ? "0" : "auto";
16280
16348
  let c = document.createElement("div");
@@ -16283,7 +16351,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16283
16351
  buildIframe() {
16284
16352
  var e;
16285
16353
  let t = document.createElement("iframe");
16286
- return t.setAttribute("data-blok-testid", "embed-frame"), t.src = (e = this.data.embed) == null ? "" : e, t.style.width = "100%", t.style.height = "100%", t.style.border = "0", t.setAttribute("sandbox", fh), t.setAttribute("allow", ph), t.setAttribute("loading", "lazy"), t.setAttribute("frameborder", "0"), t;
16354
+ return t.setAttribute("data-blok-testid", "embed-frame"), t.src = (e = this.data.embed) == null ? "" : e, t.style.width = "100%", t.style.height = "100%", t.style.border = "0", t.setAttribute("sandbox", Sh), t.setAttribute("allow", Ch), t.setAttribute("loading", "lazy"), t.setAttribute("frameborder", "0"), t;
16287
16355
  }
16288
16356
  attachResizeHandles(e) {
16289
16357
  var t;
@@ -16325,7 +16393,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16325
16393
  }
16326
16394
  buildOverlay() {
16327
16395
  var e, t;
16328
- let n = $m({
16396
+ let n = lh({
16329
16397
  alignment: (e = this.data.alignment) == null ? "center" : e,
16330
16398
  captionVisible: this.isCaptionVisible(),
16331
16399
  source: (t = this.data.source) == null ? "" : t,
@@ -16413,7 +16481,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16413
16481
  let t = navigator.clipboard;
16414
16482
  t == null || t.writeText((e = this.data.source) == null ? "" : e);
16415
16483
  }
16416
- }, hh = class {
16484
+ }, Th = class {
16417
16485
  constructor(e) {
16418
16486
  this.config = e;
16419
16487
  }
@@ -16434,10 +16502,10 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16434
16502
  domain: s.domain
16435
16503
  };
16436
16504
  }
16437
- }, gh = /https?:\/\/\S+/, _h = class {
16505
+ }, Eh = /https?:\/\/\S+/, Dh = class {
16438
16506
  constructor(e) {
16439
16507
  var t, n, r;
16440
- this.root = null, this.api = e.api, this.fetcher = new hh((t = e.config) == null ? { endpoint: "" } : t), this.data = W(W({}, e.data), {}, { url: (n = (r = e.data) == null ? void 0 : r.url) == null ? "" : n }), this.state = this.data.url ? "RENDERED" : "EMPTY";
16508
+ this.root = null, this.api = e.api, this.fetcher = new Th((t = e.config) == null ? { endpoint: "" } : t), this.data = W(W({}, e.data), {}, { url: (n = (r = e.data) == null ? void 0 : r.url) == null ? "" : n }), this.state = this.data.url ? "RENDERED" : "EMPTY";
16441
16509
  }
16442
16510
  static get toolbox() {
16443
16511
  return {
@@ -16456,7 +16524,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16456
16524
  return !0;
16457
16525
  }
16458
16526
  static get pasteConfig() {
16459
- return { patterns: { bookmark: gh } };
16527
+ return { patterns: { bookmark: Eh } };
16460
16528
  }
16461
16529
  onPaste(e) {
16462
16530
  if (e.type !== "pattern") return;
@@ -16539,36 +16607,36 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16539
16607
  return this.data.url;
16540
16608
  }
16541
16609
  }
16542
- }, vh = (e) => {
16610
+ }, Oh = (e) => {
16543
16611
  let t = e.tagName;
16544
16612
  return t === "B" || t === "STRONG";
16545
- }, yh = (e) => !!(e && e.nodeType === Node.ELEMENT_NODE && vh(e)), bh = (e) => e.textContent.length === 0, xh = (e) => e ? e.nodeType === Node.ELEMENT_NODE && vh(e) ? Sh(e) : xh(e.parentNode) : null, Sh = (e) => {
16613
+ }, kh = (e) => !!(e && e.nodeType === Node.ELEMENT_NODE && Oh(e)), Ah = (e) => e.textContent.length === 0, jh = (e) => e ? e.nodeType === Node.ELEMENT_NODE && Oh(e) ? Mh(e) : jh(e.parentNode) : null, Mh = (e) => {
16546
16614
  if (e.tagName === "STRONG") return e;
16547
16615
  let t = document.createElement("strong");
16548
16616
  for (e.hasAttributes() && Array.from(e.attributes).forEach((e) => {
16549
16617
  t.setAttribute(e.name, e.value);
16550
16618
  }); e.firstChild;) t.appendChild(e.firstChild);
16551
16619
  return e.replaceWith(t), t;
16552
- }, Ch = (e) => {
16620
+ }, Nh = (e) => {
16553
16621
  let t = e.nextSibling;
16554
16622
  if ((t == null ? void 0 : t.nodeType) === Node.TEXT_NODE) return t;
16555
16623
  let n = e.parentNode;
16556
16624
  if (!n) return null;
16557
16625
  let r = e.ownerDocument.createTextNode("");
16558
16626
  return n.insertBefore(r, t), r;
16559
- }, wh = (e) => {
16627
+ }, Ph = (e) => {
16560
16628
  if (!e.boldElement.isConnected) return null;
16561
- let t = Sh(e.boldElement), n = e.boundary, r = n.isConnected && n.previousSibling === t ? n : Ch(t);
16629
+ let t = Mh(e.boldElement), n = e.boundary, r = n.isConnected && n.previousSibling === t ? n : Nh(t);
16562
16630
  return r ? {
16563
16631
  boundary: r,
16564
16632
  boldElement: t
16565
16633
  } : null;
16566
- }, Th = (e, t) => e ? e === t || t.contains(e) : !1, Eh, $ = {
16634
+ }, Fh = (e, t) => e ? e === t || t.contains(e) : !1, Ih, $ = {
16567
16635
  COLLAPSED_LENGTH: "data-blok-bold-collapsed-length",
16568
16636
  COLLAPSED_ACTIVE: "data-blok-bold-collapsed-active",
16569
16637
  PREV_LENGTH: "data-blok-bold-prev-length",
16570
16638
  LEADING_WHITESPACE: "data-blok-bold-leading-ws"
16571
- }, Dh = class e {
16639
+ }, Lh = class e {
16572
16640
  constructor() {
16573
16641
  this.records = /* @__PURE__ */ new Set();
16574
16642
  }
@@ -16615,8 +16683,8 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16615
16683
  e.insertBefore(t, i), t.setAttribute($.PREV_LENGTH, "0");
16616
16684
  }
16617
16685
  exit(e, t) {
16618
- let n = Sh(t), r = n.parentNode;
16619
- if (r) return bh(n) ? this.removeEmptyBoldElement(e, n, r) : this.exitBoldWithContent(e, n, r);
16686
+ let n = Mh(t), r = n.parentNode;
16687
+ if (r) return Ah(n) ? this.removeEmptyBoldElement(e, n, r) : this.exitBoldWithContent(e, n, r);
16620
16688
  }
16621
16689
  removeEmptyBoldElement(e, t, n) {
16622
16690
  let r = document.createRange();
@@ -16640,7 +16708,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16640
16708
  }
16641
16709
  maintain() {
16642
16710
  if (!(typeof document > "u")) for (let e of Array.from(this.records)) {
16643
- let t = wh(e);
16711
+ let t = Ph(e);
16644
16712
  if (!t) {
16645
16713
  this.records.delete(e);
16646
16714
  continue;
@@ -16690,7 +16758,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16690
16758
  if (u && !t.hasAttribute($.LEADING_WHITESPACE) && t.setAttribute($.LEADING_WHITESPACE, u[0]), l.length === 0) return;
16691
16759
  let d = t.textContent, f = d + l, p = (n = t.getAttribute($.LEADING_WHITESPACE)) == null ? "" : n, m = p.length > 0 && d.length === 0 && !f.startsWith(p) ? p + f : f, h = document.createTextNode(m);
16692
16760
  for (; t.firstChild;) t.removeChild(t.firstChild);
16693
- if (t.appendChild(h), !(e != null && e.isCollapsed) || !Th(e.focusNode, o)) return;
16761
+ if (t.appendChild(h), !(e != null && e.isCollapsed) || !Fh(e.focusNode, o)) return;
16694
16762
  let g = document.createRange(), _ = h.textContent.length;
16695
16763
  g.setStart(h, _), g.collapse(!0), e.removeAllRanges(), e.addRange(g);
16696
16764
  });
@@ -16714,7 +16782,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16714
16782
  let r = document.createTextNode(n);
16715
16783
  (m = t.parentNode) == null || m.insertBefore(r, t.nextSibling);
16716
16784
  }
16717
- if (p && t.removeAttribute($.PREV_LENGTH), e != null && e.isCollapsed && s && Th(e.focusNode, t)) {
16785
+ if (p && t.removeAttribute($.PREV_LENGTH), e != null && e.isCollapsed && s && Fh(e.focusNode, t)) {
16718
16786
  let t = document.createRange(), n = s.textContent.length;
16719
16787
  t.setStart(s, n), t.collapse(!0), e.removeAllRanges(), e.addRange(t);
16720
16788
  }
@@ -16750,7 +16818,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16750
16818
  if (!e.rangeCount) return;
16751
16819
  let t = e.getRangeAt(0);
16752
16820
  if (!t.collapsed) return;
16753
- let n = xh(t.startContainer);
16821
+ let n = jh(t.startContainer);
16754
16822
  (n == null ? void 0 : n.getAttribute($.COLLAPSED_ACTIVE)) !== "true" && (this.moveCaretFromElementContainer(e, t) || this.moveCaretFromTextContainer(e, t));
16755
16823
  }
16756
16824
  moveCaretFromElementContainer(e, t) {
@@ -16781,7 +16849,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16781
16849
  this.setCaret(e, n, i.length);
16782
16850
  return;
16783
16851
  }
16784
- let o = xh(n);
16852
+ let o = jh(n);
16785
16853
  if (!o || t.startOffset !== n.textContent.length) return;
16786
16854
  let s = this.ensureFollowingTextNode(o, o.nextSibling);
16787
16855
  if (s) {
@@ -16808,18 +16876,18 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
16808
16876
  return t.tagName === "STRONG" || t.tagName === "B";
16809
16877
  }
16810
16878
  };
16811
- Eh = Dh, Eh.instance = null;
16879
+ Ih = Lh, Ih.instance = null;
16812
16880
  //#endregion
16813
16881
  //#region src/components/inline-tools/services/bold-normalization-pass.ts
16814
- var Oh = {
16882
+ var Rh = {
16815
16883
  convertLegacyTags: !0,
16816
16884
  normalizeWhitespace: !0,
16817
16885
  removeEmpty: !0,
16818
16886
  mergeAdjacent: !0,
16819
16887
  preserveNode: null
16820
- }, kh = class e {
16888
+ }, zh = class e {
16821
16889
  constructor(e) {
16822
- this.options = W(W({}, Oh), e);
16890
+ this.options = W(W({}, Rh), e);
16823
16891
  }
16824
16892
  run(e) {
16825
16893
  if (typeof document > "u") return;
@@ -16854,7 +16922,7 @@ var Oh = {
16854
16922
  processCollectedElements(e, t) {
16855
16923
  this.options.convertLegacyTags && e.forEach((e) => {
16856
16924
  if (e.isConnected) {
16857
- let n = Sh(e);
16925
+ let n = Mh(e);
16858
16926
  t.push(n);
16859
16927
  }
16860
16928
  }), t.forEach((e) => {
@@ -16872,19 +16940,19 @@ var Oh = {
16872
16940
  t.includes("\xA0") && (e.textContent = t.replace(/\u00A0/g, " "));
16873
16941
  }
16874
16942
  isEmptyAndSafe(e) {
16875
- return e.textContent.length !== 0 || Dh.getInstance().isActivePlaceholder(e) ? !1 : !(this.options.preserveNode && Th(this.options.preserveNode, e));
16943
+ return e.textContent.length !== 0 || Lh.getInstance().isActivePlaceholder(e) ? !1 : !(this.options.preserveNode && Fh(this.options.preserveNode, e));
16876
16944
  }
16877
16945
  mergeWithAdjacent(e) {
16878
16946
  let t = e.previousSibling;
16879
- if (t && yh(t)) {
16947
+ if (t && kh(t)) {
16880
16948
  this.mergeStrongNodes(t, e);
16881
16949
  return;
16882
16950
  }
16883
16951
  let n = e.nextSibling;
16884
- n && yh(n) && this.mergeStrongNodes(e, n);
16952
+ n && kh(n) && this.mergeStrongNodes(e, n);
16885
16953
  }
16886
16954
  mergeStrongNodes(e, t) {
16887
- let n = Sh(e), r = Sh(t);
16955
+ let n = Mh(e), r = Mh(t);
16888
16956
  for (; r.firstChild;) n.appendChild(r.firstChild);
16889
16957
  r.remove();
16890
16958
  }
@@ -16895,7 +16963,7 @@ var Oh = {
16895
16963
  let i = r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement;
16896
16964
  return i ? ((n = i.closest("[data-blok-component=\"paragraph\"]")) == null ? i.closest(S(L.elementContent)) : n) || i.closest(S(L.editor)) : null;
16897
16965
  }
16898
- }, Ah, jh = class e {
16966
+ }, Bh, Vh = class e {
16899
16967
  constructor() {
16900
16968
  this.handlers = /* @__PURE__ */ new Map(), this.listenersRegistered = !1, this.handleSelectionChange = () => {
16901
16969
  let e = this.getSelection();
@@ -16952,10 +17020,10 @@ var Oh = {
16952
17020
  return !(t.meta && !n || t.ctrl && !e.ctrlKey);
16953
17021
  }
16954
17022
  };
16955
- Ah = jh, Ah.instance = null;
17023
+ Bh = Vh, Bh.instance = null;
16956
17024
  //#endregion
16957
17025
  //#region src/components/inline-tools/utils/formatting-range-utils.ts
16958
- var Mh = (e, t) => {
17026
+ var Hh = (e, t) => {
16959
17027
  try {
16960
17028
  return e.intersectsNode(t);
16961
17029
  } catch (n) {
@@ -16964,22 +17032,22 @@ var Mh = (e, t) => {
16964
17032
  let i = e.compareBoundaryPoints(Range.END_TO_START, r) > 0, a = e.compareBoundaryPoints(Range.START_TO_END, r) < 0;
16965
17033
  return i && a;
16966
17034
  }
16967
- }, Nh = (e) => {
17035
+ }, Uh = (e) => {
16968
17036
  var t;
16969
17037
  let n = e.commonAncestorContainer, r = n.nodeType === Node.TEXT_NODE ? (t = n.parentNode) == null ? n : t : n;
16970
- return document.createTreeWalker(r, NodeFilter.SHOW_TEXT, { acceptNode: (t) => Mh(e, t) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT });
16971
- }, Ph = (e, t, n) => !e || e === n ? null : e.nodeType === Node.ELEMENT_NODE && t(e) ? e : Ph(e.parentNode, t, n), Fh = (e, t) => Ph(e, t) !== null, Ih = (e, t, n = {}) => {
16972
- if (e.collapsed) return Ph(e.startContainer, t) !== null;
16973
- let r = Nh(e), i = [];
17038
+ return document.createTreeWalker(r, NodeFilter.SHOW_TEXT, { acceptNode: (t) => Hh(e, t) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT });
17039
+ }, Wh = (e, t, n) => !e || e === n ? null : e.nodeType === Node.ELEMENT_NODE && t(e) ? e : Wh(e.parentNode, t, n), Gh = (e, t) => Wh(e, t) !== null, Kh = (e, t, n = {}) => {
17040
+ if (e.collapsed) return Wh(e.startContainer, t) !== null;
17041
+ let r = Uh(e), i = [];
16974
17042
  for (; r.nextNode();) {
16975
17043
  let e = r.currentNode, t = e.textContent;
16976
17044
  n.ignoreWhitespace && t.trim().length === 0 || t.length !== 0 && i.push(e);
16977
17045
  }
16978
- return i.length === 0 ? Ph(e.startContainer, t) !== null : i.every((e) => Fh(e, t));
16979
- }, Lh = (e) => {
17046
+ return i.length === 0 ? Wh(e.startContainer, t) !== null : i.every((e) => Gh(e, t));
17047
+ }, qh = (e) => {
16980
17048
  let t = e.lastChild;
16981
- return t === null ? e.nodeType === Node.TEXT_NODE ? e : null : Lh(t);
16982
- }, Rh = (e) => {
17049
+ return t === null ? e.nodeType === Node.TEXT_NODE ? e : null : qh(t);
17050
+ }, Jh = (e) => {
16983
17051
  var t;
16984
17052
  let n = e.endContainer;
16985
17053
  if (n.nodeType === Node.TEXT_NODE) {
@@ -16990,18 +17058,18 @@ var Mh = (e, t) => {
16990
17058
  a.length > 0 && a.trim().length === 0 && e.setEnd(n, t.length);
16991
17059
  return;
16992
17060
  }
16993
- let i = Lh(n);
17061
+ let i = qh(n);
16994
17062
  if (i === null) return;
16995
17063
  let a = (t = i.textContent) == null ? "" : t;
16996
17064
  a.length !== 0 && /\s+$/.test(a) && e.setEnd(i, a.length);
16997
- }, zh = (e, t) => {
16998
- let n = /* @__PURE__ */ new Set(), r = Nh(e);
17065
+ }, Yh = (e, t) => {
17066
+ let n = /* @__PURE__ */ new Set(), r = Uh(e);
16999
17067
  for (; r.nextNode();) {
17000
- let e = Ph(r.currentNode, t);
17068
+ let e = Wh(r.currentNode, t);
17001
17069
  e && n.add(e);
17002
17070
  }
17003
17071
  return Array.from(n);
17004
- }, Bh, Vh = class e {
17072
+ }, Xh, Zh = class e {
17005
17073
  static get sanitize() {
17006
17074
  return {
17007
17075
  strong: {},
@@ -17013,7 +17081,7 @@ var Mh = (e, t) => {
17013
17081
  }
17014
17082
  static initializeGlobalListeners() {
17015
17083
  if (typeof document > "u") return !1;
17016
- let t = jh.getInstance();
17084
+ let t = Vh.getInstance();
17017
17085
  return t.hasHandler("bold") ? !0 : (t.register("bold", {
17018
17086
  shortcut: {
17019
17087
  key: "b",
@@ -17029,14 +17097,14 @@ var Mh = (e, t) => {
17029
17097
  onInput: (t, n) => {
17030
17098
  e.refreshSelectionState("input");
17031
17099
  },
17032
- onBeforeInput: (e) => e.inputType === "formatBold" ? (kh.normalizeAroundSelection(window.getSelection()), !0) : !1,
17100
+ onBeforeInput: (e) => e.inputType === "formatBold" ? (zh.normalizeAroundSelection(window.getSelection()), !0) : !1,
17033
17101
  isRelevant: (t) => e.isSelectionInsideBlok(t)
17034
17102
  }), e.guardKeydownListenerRegistered || (document.addEventListener("keydown", (e) => {
17035
- Dh.getInstance().guardBoundaryKeydown(e);
17103
+ Lh.getInstance().guardBoundaryKeydown(e);
17036
17104
  }, !0), e.guardKeydownListenerRegistered = !0), e.ensureMutationObserver(), !0);
17037
17105
  }
17038
17106
  static mergeStrongNodes(e, t) {
17039
- let n = Sh(e), r = Sh(t);
17107
+ let n = Mh(e), r = Mh(t);
17040
17108
  for (; r.firstChild;) n.appendChild(r.firstChild);
17041
17109
  return r.remove(), n;
17042
17110
  }
@@ -17069,16 +17137,16 @@ var Mh = (e, t) => {
17069
17137
  return this.isRangeBold(t, { ignoreWhitespace: !0 });
17070
17138
  }
17071
17139
  wrapWithBold(e) {
17072
- Rh(e);
17140
+ Jh(e);
17073
17141
  let t = this.getRangeHtmlWithoutBold(e), n = this.replaceRangeWithHtml(e, `<strong>${t}</strong>`), r = window.getSelection();
17074
17142
  r && n && (r.removeAllRanges(), r.addRange(n));
17075
17143
  let i = this.findBoldElementFromRangeOrSelection(n, r);
17076
17144
  if (!i) {
17077
- kh.normalizeAroundSelection(r), this.notifySelectionChange();
17145
+ zh.normalizeAroundSelection(r), this.notifySelectionChange();
17078
17146
  return;
17079
17147
  }
17080
17148
  let a = this.mergeAdjacentBold(i);
17081
- this.selectElementContents(a), kh.normalizeAroundSelection(r), this.notifySelectionChange();
17149
+ this.selectElementContents(a), zh.normalizeAroundSelection(r), this.notifySelectionChange();
17082
17150
  }
17083
17151
  unwrapBoldTags(t) {
17084
17152
  let n = this.collectBoldAncestors(t), r = window.getSelection();
@@ -17087,7 +17155,7 @@ var Mh = (e, t) => {
17087
17155
  i.setAttribute("data-blok-bold-marker", `unwrap-${e.markerSequence++}`), i.appendChild(a), this.removeNestedBold(i), t.insertNode(i);
17088
17156
  let o = document.createRange();
17089
17157
  for (o.selectNodeContents(i), r.removeAllRanges(), r.addRange(o);;) {
17090
- let e = xh(i);
17158
+ let e = jh(i);
17091
17159
  if (!e) break;
17092
17160
  this.moveMarkerOutOfBold(i, e);
17093
17161
  }
@@ -17095,8 +17163,8 @@ var Mh = (e, t) => {
17095
17163
  this.unwrapElement(i), s && c && (() => {
17096
17164
  let e = document.createRange();
17097
17165
  return e.setStartBefore(s), e.setEndAfter(c), r.removeAllRanges(), r.addRange(e), e;
17098
- })() || r.removeAllRanges(), kh.normalizeAroundSelection(r), n.forEach((e) => {
17099
- e.isConnected && (bh(e) ? e.remove() : e.textContent.trim().length === 0 && this.unwrapElement(e));
17166
+ })() || r.removeAllRanges(), zh.normalizeAroundSelection(r), n.forEach((e) => {
17167
+ e.isConnected && (Ah(e) ? e.remove() : e.textContent.trim().length === 0 && this.unwrapElement(e));
17100
17168
  }), this.notifySelectionChange();
17101
17169
  }
17102
17170
  replaceRangeWithHtml(t, n) {
@@ -17136,7 +17204,7 @@ var Mh = (e, t) => {
17136
17204
  n.selectNodeContents(e), t.removeAllRanges(), t.addRange(n);
17137
17205
  }
17138
17206
  isRangeBold(e, t) {
17139
- return Ih(e, vh, t);
17207
+ return Kh(e, Oh, t);
17140
17208
  }
17141
17209
  removeNestedBold(e) {
17142
17210
  e.querySelectorAll("b,strong").forEach((e) => {
@@ -17153,28 +17221,28 @@ var Mh = (e, t) => {
17153
17221
  t.removeChild(e);
17154
17222
  }
17155
17223
  findBoldElementFromRangeOrSelection(e, t) {
17156
- return e ? xh(e.startContainer) || xh(e.commonAncestorContainer) || (e.startContainer.nodeType === Node.ELEMENT_NODE && vh(e.startContainer) ? e.startContainer : null) : t ? xh(t.focusNode) : null;
17224
+ return e ? jh(e.startContainer) || jh(e.commonAncestorContainer) || (e.startContainer.nodeType === Node.ELEMENT_NODE && Oh(e.startContainer) ? e.startContainer : null) : t ? jh(t.focusNode) : null;
17157
17225
  }
17158
17226
  mergeAdjacentBold(t) {
17159
- let n = Sh(t), r = n.previousSibling, i = r && r.nodeType === Node.ELEMENT_NODE && vh(r) ? e.mergeStrongNodes(r, n) : n, a = i.nextSibling;
17160
- return a && a.nodeType === Node.ELEMENT_NODE && vh(a) ? e.mergeStrongNodes(i, a) : i;
17227
+ let n = Mh(t), r = n.previousSibling, i = r && r.nodeType === Node.ELEMENT_NODE && Oh(r) ? e.mergeStrongNodes(r, n) : n, a = i.nextSibling;
17228
+ return a && a.nodeType === Node.ELEMENT_NODE && Oh(a) ? e.mergeStrongNodes(i, a) : i;
17161
17229
  }
17162
17230
  toggleCollapsedSelection() {
17163
17231
  let t = window.getSelection();
17164
17232
  if (!t || t.rangeCount === 0) return;
17165
- let n = t.getRangeAt(0), r = xh(n.startContainer), i = (() => {
17166
- if (r && r.getAttribute(Dh.ATTR.COLLAPSED_ACTIVE) !== "true") return Dh.getInstance().exit(t, r);
17233
+ let n = t.getRangeAt(0), r = jh(n.startContainer), i = (() => {
17234
+ if (r && r.getAttribute(Lh.ATTR.COLLAPSED_ACTIVE) !== "true") return Lh.getInstance().exit(t, r);
17167
17235
  let i = r == null ? e.getBoundaryBold(n) : r;
17168
- return i ? Dh.getInstance().exit(t, i) : this.startCollapsedBold(n);
17236
+ return i ? Lh.getInstance().exit(t, i) : this.startCollapsedBold(n);
17169
17237
  })();
17170
- document.dispatchEvent(new Event("selectionchange")), i && (t.removeAllRanges(), t.addRange(i)), kh.normalizeAroundSelection(t), this.notifySelectionChange();
17238
+ document.dispatchEvent(new Event("selectionchange")), i && (t.removeAllRanges(), t.addRange(i)), zh.normalizeAroundSelection(t), this.notifySelectionChange();
17171
17239
  }
17172
17240
  startCollapsedBold(e) {
17173
- let t = Dh.getInstance().enter(e, (e) => this.mergeAdjacentBold(e)), n = window.getSelection();
17174
- return kh.normalizeAroundSelection(n), n && t && (n.removeAllRanges(), n.addRange(t)), this.notifySelectionChange(), t;
17241
+ let t = Lh.getInstance().enter(e, (e) => this.mergeAdjacentBold(e)), n = window.getSelection();
17242
+ return zh.normalizeAroundSelection(n), n && t && (n.removeAllRanges(), n.addRange(t)), this.notifySelectionChange(), t;
17175
17243
  }
17176
17244
  notifySelectionChange() {
17177
- Dh.getInstance().enforceLengths(window.getSelection()), document.dispatchEvent(new Event("selectionchange")), this.updateToolbarButtonState();
17245
+ Lh.getInstance().enforceLengths(window.getSelection()), document.dispatchEvent(new Event("selectionchange")), this.updateToolbarButtonState();
17178
17246
  }
17179
17247
  updateToolbarButtonState() {
17180
17248
  let e = window.getSelection();
@@ -17188,7 +17256,7 @@ var Mh = (e, t) => {
17188
17256
  }
17189
17257
  static refreshSelectionState(e) {
17190
17258
  let t = window.getSelection();
17191
- Dh.getInstance().enforceLengths(t), Dh.getInstance().maintain(), Dh.getInstance().synchronize(t), kh.normalizeAroundSelection(t, { normalizeWhitespace: !1 }), e === "input" && t && Dh.getInstance().moveCaretAfterBoundaryBold(t);
17259
+ Lh.getInstance().enforceLengths(t), Lh.getInstance().maintain(), Lh.getInstance().synchronize(t), zh.normalizeAroundSelection(t, { normalizeWhitespace: !1 }), e === "input" && t && Lh.getInstance().moveCaretAfterBoundaryBold(t);
17192
17260
  }
17193
17261
  static ensureMutationObserver() {
17194
17262
  if (typeof MutationObserver > "u" || e.mutationObserver) return;
@@ -17197,7 +17265,7 @@ var Mh = (e, t) => {
17197
17265
  e.isProcessingMutation = !0;
17198
17266
  try {
17199
17267
  let n = (e) => {
17200
- e && new kh({
17268
+ e && new zh({
17201
17269
  mergeAdjacent: !1,
17202
17270
  removeEmpty: !1,
17203
17271
  normalizeWhitespace: !1
@@ -17229,15 +17297,15 @@ var Mh = (e, t) => {
17229
17297
  }
17230
17298
  static getBoundaryBoldForText(e, t) {
17231
17299
  let n = t.textContent.length;
17232
- if (e.startOffset === n) return xh(t);
17300
+ if (e.startOffset === n) return jh(t);
17233
17301
  if (e.startOffset !== 0) return null;
17234
17302
  let r = t.previousSibling;
17235
- return yh(r) ? r : null;
17303
+ return kh(r) ? r : null;
17236
17304
  }
17237
17305
  static getBoundaryBoldForElement(e, t) {
17238
17306
  if (e.startOffset <= 0) return null;
17239
17307
  let n = t.childNodes[e.startOffset - 1];
17240
- return yh(n) ? n : null;
17308
+ return kh(n) ? n : null;
17241
17309
  }
17242
17310
  static isSelectionInsideBlok(e) {
17243
17311
  let t = e.anchorNode;
@@ -17256,16 +17324,16 @@ var Mh = (e, t) => {
17256
17324
  return t.innerHTML = e, t.content;
17257
17325
  }
17258
17326
  collectBoldAncestors(e) {
17259
- return zh(e, vh);
17327
+ return Yh(e, Oh);
17260
17328
  }
17261
17329
  };
17262
- Bh = Vh, Bh.isInline = !0, Bh.title = "Bold", Bh.titleKey = "bold", Bh.markerSequence = 0, Bh.isProcessingMutation = !1, Bh.instances = /* @__PURE__ */ new Set(), Bh.guardKeydownListenerRegistered = !1, Bh.shortcut = "CMD+B";
17330
+ Xh = Zh, Xh.isInline = !0, Xh.title = "Bold", Xh.titleKey = "bold", Xh.markerSequence = 0, Xh.isProcessingMutation = !1, Xh.instances = /* @__PURE__ */ new Set(), Xh.guardKeydownListenerRegistered = !1, Xh.shortcut = "CMD+B";
17263
17331
  //#endregion
17264
17332
  //#region src/components/inline-tools/inline-tool-italic.ts
17265
- var Hh, Uh = (e) => {
17333
+ var Qh, $h = (e) => {
17266
17334
  let t = e.tagName;
17267
17335
  return t === "I" || t === "EM";
17268
- }, Wh = class {
17336
+ }, eg = class {
17269
17337
  static get sanitize() {
17270
17338
  return {
17271
17339
  i: {},
@@ -17314,10 +17382,10 @@ var Hh, Uh = (e) => {
17314
17382
  return this.isRangeItalic(t, { ignoreWhitespace: !0 });
17315
17383
  }
17316
17384
  isRangeItalic(e, t) {
17317
- return Ih(e, Uh, t);
17385
+ return Kh(e, $h, t);
17318
17386
  }
17319
17387
  wrapWithItalic(e) {
17320
- Rh(e);
17388
+ Jh(e);
17321
17389
  let t = this.getRangeHtmlWithoutItalic(e), n = this.replaceRangeWithHtml(e, `<i>${t}</i>`), r = window.getSelection();
17322
17390
  if (r && n) {
17323
17391
  let e = n.startContainer.childNodes[n.startOffset], t = document.createRange();
@@ -17353,13 +17421,13 @@ var Hh, Uh = (e) => {
17353
17421
  });
17354
17422
  }
17355
17423
  hasItalicParent(e) {
17356
- return Fh(e, Uh);
17424
+ return Gh(e, $h);
17357
17425
  }
17358
17426
  findItalicElement(e) {
17359
- return Ph(e, Uh);
17427
+ return Wh(e, $h);
17360
17428
  }
17361
17429
  collectItalicAncestors(e) {
17362
- return zh(e, Uh);
17430
+ return Yh(e, $h);
17363
17431
  }
17364
17432
  getRangeHtmlWithoutItalic(e) {
17365
17433
  let t = e.cloneContents();
@@ -17416,10 +17484,10 @@ var Hh, Uh = (e) => {
17416
17484
  n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
17417
17485
  }
17418
17486
  };
17419
- Hh = Wh, Hh.isInline = !0, Hh.title = "Italic", Hh.titleKey = "italic", Hh.shortcut = "CMD+I";
17487
+ Qh = eg, Qh.isInline = !0, Qh.title = "Italic", Qh.titleKey = "italic", Qh.shortcut = "CMD+I";
17420
17488
  //#endregion
17421
17489
  //#region src/components/inline-tools/inline-tool-link.ts
17422
- var Gh, Kh = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text-left cursor-pointer can-hover:hover:bg-item-hover-bg transition-colors", qh = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text-left pointer-events-none", Jh = class {
17490
+ var tg, ng = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text-left cursor-pointer can-hover:hover:bg-item-hover-bg transition-colors", rg = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text-left pointer-events-none", ig = class {
17423
17491
  static get sanitize() {
17424
17492
  return { a: {
17425
17493
  href: !0,
@@ -17479,7 +17547,7 @@ var Gh, Kh = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md tex
17479
17547
  let t = document.createElement("div");
17480
17548
  t.className = "mt-1 mb-0.5 h-px bg-link-input-border";
17481
17549
  let n = document.createElement("button");
17482
- n.type = "button", n.className = Kh, n.setAttribute("data-link-suggestion-row", "");
17550
+ n.type = "button", n.className = ng, n.setAttribute("data-link-suggestion-row", "");
17483
17551
  let r = document.createElement("span");
17484
17552
  r.className = "text-gray-text shrink-0 flex [&>svg]:size-7", r.setAttribute("data-link-suggestion-icon", "");
17485
17553
  let i = document.createElement("span");
@@ -17497,7 +17565,7 @@ var Gh, Kh = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md tex
17497
17565
  return;
17498
17566
  }
17499
17567
  let n = this.isLinkComplete(t), { icon: r, label: i } = this.getLinkTypeInfo(t), a = this.nodes.suggestion.querySelector("[data-link-suggestion-icon]"), o = this.nodes.suggestion.querySelector("[data-link-suggestion-url]"), s = this.nodes.suggestion.querySelector("[data-link-suggestion-type]"), c = this.nodes.suggestion.querySelector("[data-link-suggestion-row]");
17500
- a && (a.innerHTML = r, a.className = `${n ? "text-gray-text" : "text-gray-text opacity-40"} shrink-0 flex [&>svg]:size-7`), o && (o.textContent = t, o.className = `block text-xs font-medium truncate ${n ? "text-text-primary" : "text-gray-text"}`), s && (s.textContent = n ? i : "Keep typing to add a link", s.className = "block text-[10.5px] text-gray-text leading-tight mt-px"), c && (c.className = n ? Kh : qh), this.nodes.suggestion.classList.remove("hidden");
17568
+ a && (a.innerHTML = r, a.className = `${n ? "text-gray-text" : "text-gray-text opacity-40"} shrink-0 flex [&>svg]:size-7`), o && (o.textContent = t, o.className = `block text-xs font-medium truncate ${n ? "text-text-primary" : "text-gray-text"}`), s && (s.textContent = n ? i : "Keep typing to add a link", s.className = "block text-[10.5px] text-gray-text leading-tight mt-px"), c && (c.className = n ? ng : rg), this.nodes.suggestion.classList.remove("hidden");
17501
17569
  }
17502
17570
  isLinkComplete(e) {
17503
17571
  return /^https?:\/\//i.test(e) ? e.replace(/^https?:\/\//i, "").length > 0 : /^\w+:\/\//.test(e) ? e.replace(/^\w+:\/\//, "").length > 0 : /^\w+:/.test(e) ? e.slice(e.indexOf(":") + 1).length > 0 : e.startsWith("//") ? e.slice(2).length > 0 : e.startsWith("#") ? e.length > 1 : e.startsWith("/") ? !0 : /\.[a-zA-Z]{2,}/.test(e) || /^\d{1,3}(\.\d{1,3}){3}/.test(e);
@@ -17626,13 +17694,13 @@ var Gh, Kh = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md tex
17626
17694
  e && e.setAttribute(t, n ? "true" : "false");
17627
17695
  }
17628
17696
  };
17629
- Gh = Jh, Gh.isInline = !0, Gh.title = "Link", Gh.titleKey = "link", Gh.shortcut = "CMD+K";
17697
+ tg = ig, tg.isInline = !0, tg.title = "Link", tg.titleKey = "link", tg.shortcut = "CMD+K";
17630
17698
  //#endregion
17631
17699
  //#region src/components/inline-tools/utils/marker-dom-utils.ts
17632
- var Yh = (e) => e.tagName === "MARK", Xh = (e) => Ph(e, Yh), Zh, Qh = {
17700
+ var ag = (e) => e.tagName === "MARK", og = (e) => Wh(e, ag), sg, cg = {
17633
17701
  color: "background-color",
17634
17702
  "background-color": "color"
17635
- }, $h = class e {
17703
+ }, lg = class e {
17636
17704
  static get sanitize() {
17637
17705
  return { mark: (t) => {
17638
17706
  let n = t.style, r = Array.from({ length: n.length }, (e, t) => n.item(t));
@@ -17666,7 +17734,7 @@ var Yh = (e) => e.tagName === "MARK", Xh = (e) => Ph(e, Yh), Zh, Qh = {
17666
17734
  isActive: () => {
17667
17735
  let e = window.getSelection();
17668
17736
  if (!e || e.rangeCount === 0) return !1;
17669
- let t = e.getRangeAt(0), n = Ih(t, Yh, { ignoreWhitespace: !0 });
17737
+ let t = e.getRangeAt(0), n = Kh(t, ag, { ignoreWhitespace: !0 });
17670
17738
  if (n) {
17671
17739
  let e = this.detectBothSelectionColors(t);
17672
17740
  this.updateToolbarColors(e.text, e.bg);
@@ -17717,10 +17785,10 @@ var Yh = (e) => e.tagName === "MARK", Xh = (e) => Ph(e, Yh), Zh, Qh = {
17717
17785
  if (!r || r.rangeCount === 0) return;
17718
17786
  let i = r.getRangeAt(0), a = i.startContainer, o = i.startOffset, s = i.endContainer, c = i.endOffset, l = i.toString(), u = i.commonAncestorContainer, d = u.nodeType === Node.ELEMENT_NODE ? u : u.parentElement, f = d != null && d.closest("mark") ? (t = (n = d.closest("mark")) == null ? void 0 : n.parentElement) == null ? d : t : d;
17719
17787
  this.splitMarksAtBoundaries(i);
17720
- let p = zh(i, Yh);
17788
+ let p = Yh(i, ag);
17721
17789
  for (let t of p) {
17722
17790
  t.style.removeProperty(e);
17723
- let n = Qh[e], r = t.style.getPropertyValue(n);
17791
+ let n = cg[e], r = t.style.getPropertyValue(n);
17724
17792
  r !== "" && r !== "transparent" ? this.ensureTransparentBg(t) : this.unwrapElement(t);
17725
17793
  }
17726
17794
  let m = a.isConnected, h = s.isConnected;
@@ -17748,7 +17816,7 @@ var Yh = (e) => e.tagName === "MARK", Xh = (e) => Ph(e, Yh), Zh, Qh = {
17748
17816
  this.selection.removeFakeBackground(), this.selection.savedSelectionRange && this.selection.restore(), this.selection.clearSaved();
17749
17817
  }
17750
17818
  detectBothSelectionColors(e) {
17751
- let t = Xh(e.startContainer);
17819
+ let t = og(e.startContainer);
17752
17820
  if (!t) return {
17753
17821
  text: null,
17754
17822
  bg: null
@@ -17768,7 +17836,7 @@ var Yh = (e) => e.tagName === "MARK", Xh = (e) => Ph(e, Yh), Zh, Qh = {
17768
17836
  text: null,
17769
17837
  bg: null
17770
17838
  };
17771
- let t = Xh(e.getRangeAt(0).startContainer);
17839
+ let t = og(e.getRangeAt(0).startContainer);
17772
17840
  if (!t) return {
17773
17841
  text: null,
17774
17842
  bg: null
@@ -17788,14 +17856,14 @@ var Yh = (e) => e.tagName === "MARK", Xh = (e) => Ph(e, Yh), Zh, Qh = {
17788
17856
  this.selection.savedSelectionRange && (this.selection.removeFakeBackground(), this.selection.restore(), this.selection.clearSaved());
17789
17857
  }
17790
17858
  findContainingMark(e) {
17791
- let t = Xh(e.startContainer), n = Xh(e.endContainer);
17859
+ let t = og(e.startContainer), n = og(e.endContainer);
17792
17860
  return t && t === n ? t : null;
17793
17861
  }
17794
17862
  removeNestedMarkStyle(e, t) {
17795
- let n = zh(e, Yh);
17863
+ let n = Yh(e, ag);
17796
17864
  for (let e of n) {
17797
17865
  e.style.removeProperty(t);
17798
- let n = Qh[t], r = e.style.getPropertyValue(n);
17866
+ let n = cg[t], r = e.style.getPropertyValue(n);
17799
17867
  r !== "" && r !== "transparent" ? this.ensureTransparentBg(e) : this.unwrapElement(e);
17800
17868
  }
17801
17869
  }
@@ -17826,7 +17894,7 @@ var Yh = (e) => e.tagName === "MARK", Xh = (e) => Ph(e, Yh), Zh, Qh = {
17826
17894
  }
17827
17895
  }
17828
17896
  splitMarksAtBoundaries(e) {
17829
- let t = zh(e, Yh);
17897
+ let t = Yh(e, ag);
17830
17898
  for (let n of t) {
17831
17899
  let t = document.createRange();
17832
17900
  t.selectNodeContents(n);
@@ -17895,10 +17963,10 @@ var Yh = (e) => e.tagName === "MARK", Xh = (e) => Ph(e, Yh), Zh, Qh = {
17895
17963
  return r === null ? e : st(r, n);
17896
17964
  }
17897
17965
  };
17898
- Zh = $h, Zh.isInline = !0, Zh.title = "Color", Zh.titleKey = "marker", Zh.shortcut = "CMD+SHIFT+H", Zh.ALLOWED_STYLE_PROPS = new Set(["color", "background-color"]);
17966
+ sg = lg, sg.isInline = !0, sg.title = "Color", sg.titleKey = "marker", sg.shortcut = "CMD+SHIFT+H", sg.ALLOWED_STYLE_PROPS = new Set(["color", "background-color"]);
17899
17967
  //#endregion
17900
17968
  //#region src/components/inline-tools/inline-tool-underline.ts
17901
- var eg, tg = (e) => e.tagName === "U", ng = class {
17969
+ var ug, dg = (e) => e.tagName === "U", fg = class {
17902
17970
  static get sanitize() {
17903
17971
  return { u: {} };
17904
17972
  }
@@ -17944,10 +18012,10 @@ var eg, tg = (e) => e.tagName === "U", ng = class {
17944
18012
  return this.isRangeUnderline(t, { ignoreWhitespace: !0 });
17945
18013
  }
17946
18014
  isRangeUnderline(e, t) {
17947
- return Ih(e, tg, t);
18015
+ return Kh(e, dg, t);
17948
18016
  }
17949
18017
  wrapWithUnderline(e) {
17950
- Rh(e);
18018
+ Jh(e);
17951
18019
  let t = this.getRangeHtmlWithoutUnderline(e), n = this.replaceRangeWithHtml(e, `<u>${t}</u>`), r = window.getSelection();
17952
18020
  if (r && n) {
17953
18021
  let e = n.startContainer.childNodes[n.startOffset], t = document.createRange();
@@ -17983,13 +18051,13 @@ var eg, tg = (e) => e.tagName === "U", ng = class {
17983
18051
  });
17984
18052
  }
17985
18053
  hasUnderlineParent(e) {
17986
- return Fh(e, tg);
18054
+ return Gh(e, dg);
17987
18055
  }
17988
18056
  findUnderlineElement(e) {
17989
- return Ph(e, tg);
18057
+ return Wh(e, dg);
17990
18058
  }
17991
18059
  collectUnderlineAncestors(e) {
17992
- return zh(e, tg);
18060
+ return Yh(e, dg);
17993
18061
  }
17994
18062
  getRangeHtmlWithoutUnderline(e) {
17995
18063
  let t = e.cloneContents();
@@ -18046,10 +18114,10 @@ var eg, tg = (e) => e.tagName === "U", ng = class {
18046
18114
  n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
18047
18115
  }
18048
18116
  };
18049
- eg = ng, eg.isInline = !0, eg.title = "Underline", eg.titleKey = "underline", eg.shortcut = "CMD+U";
18117
+ ug = fg, ug.isInline = !0, ug.title = "Underline", ug.titleKey = "underline", ug.shortcut = "CMD+U";
18050
18118
  //#endregion
18051
18119
  //#region src/components/inline-tools/inline-tool-strikethrough.ts
18052
- var rg, ig = (e) => e.tagName === "S", ag = class {
18120
+ var pg, mg = (e) => e.tagName === "S", hg = class {
18053
18121
  static get sanitize() {
18054
18122
  return { s: {} };
18055
18123
  }
@@ -18095,10 +18163,10 @@ var rg, ig = (e) => e.tagName === "S", ag = class {
18095
18163
  return this.isRangeStrikethrough(t, { ignoreWhitespace: !0 });
18096
18164
  }
18097
18165
  isRangeStrikethrough(e, t) {
18098
- return Ih(e, ig, t);
18166
+ return Kh(e, mg, t);
18099
18167
  }
18100
18168
  wrapWithStrikethrough(e) {
18101
- Rh(e);
18169
+ Jh(e);
18102
18170
  let t = this.getRangeHtmlWithoutStrikethrough(e), n = this.replaceRangeWithHtml(e, `<s>${t}</s>`), r = window.getSelection();
18103
18171
  if (r && n) {
18104
18172
  let e = n.startContainer.childNodes[n.startOffset], t = document.createRange();
@@ -18134,13 +18202,13 @@ var rg, ig = (e) => e.tagName === "S", ag = class {
18134
18202
  });
18135
18203
  }
18136
18204
  hasStrikethroughParent(e) {
18137
- return Fh(e, ig);
18205
+ return Gh(e, mg);
18138
18206
  }
18139
18207
  findStrikethroughElement(e) {
18140
- return Ph(e, ig);
18208
+ return Wh(e, mg);
18141
18209
  }
18142
18210
  collectStrikethroughAncestors(e) {
18143
- return zh(e, ig);
18211
+ return Yh(e, mg);
18144
18212
  }
18145
18213
  getRangeHtmlWithoutStrikethrough(e) {
18146
18214
  let t = e.cloneContents();
@@ -18197,10 +18265,10 @@ var rg, ig = (e) => e.tagName === "S", ag = class {
18197
18265
  n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
18198
18266
  }
18199
18267
  };
18200
- rg = ag, rg.isInline = !0, rg.title = "Strikethrough", rg.titleKey = "strikethrough", rg.shortcut = "CMD+SHIFT+S";
18268
+ pg = hg, pg.isInline = !0, pg.title = "Strikethrough", pg.titleKey = "strikethrough", pg.shortcut = "CMD+SHIFT+S";
18201
18269
  //#endregion
18202
18270
  //#region src/components/inline-tools/inline-tool-code.ts
18203
- var og, sg = (e) => e.tagName === "CODE", cg = class {
18271
+ var gg, _g = (e) => e.tagName === "CODE", vg = class {
18204
18272
  static get sanitize() {
18205
18273
  return { code: {} };
18206
18274
  }
@@ -18246,10 +18314,10 @@ var og, sg = (e) => e.tagName === "CODE", cg = class {
18246
18314
  return this.isRangeCode(t, { ignoreWhitespace: !0 });
18247
18315
  }
18248
18316
  isRangeCode(e, t) {
18249
- return Ih(e, sg, t);
18317
+ return Kh(e, _g, t);
18250
18318
  }
18251
18319
  wrapWithCode(e) {
18252
- Rh(e);
18320
+ Jh(e);
18253
18321
  let t = this.getRangeHtmlWithoutCode(e), n = this.replaceRangeWithHtml(e, `<code>${t}</code>`), r = window.getSelection();
18254
18322
  if (r && n) {
18255
18323
  let e = n.startContainer.childNodes[n.startOffset], t = document.createRange();
@@ -18285,10 +18353,10 @@ var og, sg = (e) => e.tagName === "CODE", cg = class {
18285
18353
  });
18286
18354
  }
18287
18355
  findCodeElement(e) {
18288
- return Ph(e, sg);
18356
+ return Wh(e, _g);
18289
18357
  }
18290
18358
  collectCodeAncestors(e) {
18291
- return zh(e, sg);
18359
+ return Yh(e, _g);
18292
18360
  }
18293
18361
  getRangeHtmlWithoutCode(e) {
18294
18362
  let t = e.cloneContents();
@@ -18345,10 +18413,10 @@ var og, sg = (e) => e.tagName === "CODE", cg = class {
18345
18413
  n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
18346
18414
  }
18347
18415
  };
18348
- og = cg, og.isInline = !0, og.title = "Code", og.titleKey = "inlineCode", og.shortcut = "CMD+E";
18416
+ gg = vg, gg.isInline = !0, gg.title = "Code", gg.titleKey = "inlineCode", gg.shortcut = "CMD+E";
18349
18417
  //#endregion
18350
18418
  //#region src/tools/index.ts
18351
- var lg = {
18419
+ var yg = {
18352
18420
  paragraph: { preserveBlank: !0 },
18353
18421
  header: {},
18354
18422
  list: {},
@@ -18368,7 +18436,7 @@ var lg = {
18368
18436
  column: {},
18369
18437
  embed: {},
18370
18438
  bookmark: {}
18371
- }, ug = {
18439
+ }, bg = {
18372
18440
  bold: {},
18373
18441
  italic: {},
18374
18442
  link: {},
@@ -18378,4 +18446,4 @@ var lg = {
18378
18446
  inlineCode: {}
18379
18447
  };
18380
18448
  //#endregion
18381
- export { gc as C, Di as D, Ho as E, cr as O, _c as S, qo as T, nm as _, ng as a, Sc as b, Wh as c, mh as d, Ym as f, Om as g, Km as h, ag as i, Wn as k, Vh as l, qm as m, ug as n, $h as o, Jm as p, cg as r, Jh as s, lg as t, _h as u, $d as v, Rs as w, vc as x, Hl as y };
18449
+ export { gc as C, Di as D, Ho as E, cr as O, _c as S, qo as T, nm as _, fg as a, Sc as b, eg as c, wh as d, ah as f, Rm as g, nh as h, hg as i, Wn as k, Zh as l, rh as m, bg as n, lg as o, ih as p, vg as r, ig as s, yg as t, Dh as u, $d as v, Rs as w, vc as x, Hl as y };