@jackuait/blok 0.18.0 → 0.19.1
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.
- package/dist/blok.cjs +1 -1
- package/dist/blok.iife.js +4 -4
- package/dist/blok.mjs +2 -2
- package/dist/blok.umd.js +3 -3
- package/dist/chunks/{blok-BoAuTqli.mjs → blok-C52qeiPg.mjs} +31 -8
- package/dist/chunks/{blok-B7IRrvgX.cjs → blok-gFn3FI95.cjs} +3 -3
- package/dist/chunks/{constants-BWoyU4yv.cjs → constants-DmKwEMyC.cjs} +1 -1
- package/dist/chunks/{constants-BO6zLfL2.mjs → constants-DzQOOvgv.mjs} +2 -1
- package/dist/chunks/{tools-DXagFf6I.cjs → tools-BcF1rHBg.cjs} +2 -2
- package/dist/chunks/{tools-DRwLS-6t.mjs → tools-CelSzJoA.mjs} +384 -285
- package/dist/full.cjs +1 -1
- package/dist/full.mjs +3 -3
- package/dist/react.cjs +1 -1
- package/dist/react.mjs +1 -1
- package/dist/tools.cjs +1 -1
- package/dist/tools.mjs +2 -2
- package/package.json +1 -1
- package/src/blok.ts +50 -4
- package/src/components/constants/data-attributes.ts +2 -0
- package/src/components/modules/ui.ts +30 -0
- package/src/styles/audio.css +26 -3
- package/src/styles/main.css +11 -0
- package/src/tools/audio/index.ts +76 -21
- package/src/tools/audio/liveliness.ts +136 -0
- package/src/tools/audio/ui.ts +6 -1
- package/src/tools/audio/waveform.ts +130 -24
- package/types/api/index.d.ts +1 -0
- package/types/api/width.d.ts +31 -0
- package/types/data-attributes.d.ts +1 -0
- package/types/index.d.ts +32 -1
|
@@ -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-
|
|
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-DzQOOvgv.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";
|
|
@@ -14268,8 +14268,10 @@ function lm(e, t) {
|
|
|
14268
14268
|
function um(e) {
|
|
14269
14269
|
let t = document.createElement("div");
|
|
14270
14270
|
t.className = "blok-audio-caption-row", t.setAttribute("data-role", "audio-caption-row");
|
|
14271
|
-
let n =
|
|
14272
|
-
|
|
14271
|
+
let n = document.createElement("div");
|
|
14272
|
+
n.className = "blok-audio-caption-row__inner";
|
|
14273
|
+
let r = cm("audio-caption", e.value, e.editable, e.placeholder);
|
|
14274
|
+
return r.className = "blok-audio-caption", n.appendChild(r), t.appendChild(n), t;
|
|
14273
14275
|
}
|
|
14274
14276
|
//#endregion
|
|
14275
14277
|
//#region src/tools/audio/controls.ts
|
|
@@ -14435,45 +14437,78 @@ function pm({ media: e, figure: t, data: n, storage: r, onLoopChange: i }) {
|
|
|
14435
14437
|
}
|
|
14436
14438
|
};
|
|
14437
14439
|
}
|
|
14440
|
+
function mm(e, t = 4, n = 9) {
|
|
14441
|
+
let r = e < 0 ? n : t, i = Math.abs(e);
|
|
14442
|
+
if (i >= r) return 0;
|
|
14443
|
+
let a = 1 - i / r;
|
|
14444
|
+
return a * a;
|
|
14445
|
+
}
|
|
14446
|
+
function hm(e, t = 3) {
|
|
14447
|
+
let n = Math.abs(e);
|
|
14448
|
+
if (n >= t) return 0;
|
|
14449
|
+
let r = 1 - n / t;
|
|
14450
|
+
return r * r * r;
|
|
14451
|
+
}
|
|
14452
|
+
function gm(e, t) {
|
|
14453
|
+
let n = Math.sin(t * 8.5 + e * .7), r = Math.sin(t * 5.3 + e * 1.9);
|
|
14454
|
+
return n * .6 + r * .4;
|
|
14455
|
+
}
|
|
14456
|
+
function _m(e, t) {
|
|
14457
|
+
let n = Math.sin(t * 2.1 - e * .35), r = Math.sin(t * 1.3 + e * .21);
|
|
14458
|
+
return n * .6 + r * .4;
|
|
14459
|
+
}
|
|
14460
|
+
var vm = .035, ym = .06, bm = 26;
|
|
14461
|
+
function xm(e) {
|
|
14462
|
+
return 1 - (1 - Math.min(1, Math.max(0, e))) ** 3;
|
|
14463
|
+
}
|
|
14464
|
+
function Sm(e) {
|
|
14465
|
+
return hm(e.distance) * e.energy * e.entrance;
|
|
14466
|
+
}
|
|
14467
|
+
function Cm(e) {
|
|
14468
|
+
let { basePeak: t, index: n, playheadIndex: r, timeSeconds: i, reduced: a, energy: o = 1 } = e;
|
|
14469
|
+
if (a || o <= 0) return t;
|
|
14470
|
+
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;
|
|
14471
|
+
return Math.min(1, Math.max(0, f));
|
|
14472
|
+
}
|
|
14438
14473
|
//#endregion
|
|
14439
14474
|
//#region src/tools/audio/waveform.ts
|
|
14440
|
-
function
|
|
14475
|
+
function wm(e, t, n) {
|
|
14441
14476
|
return e.slice(t, n).reduce((e, t) => Math.max(e, Math.abs(t)), 0);
|
|
14442
14477
|
}
|
|
14443
|
-
function
|
|
14478
|
+
function Tm(e, t = 300) {
|
|
14444
14479
|
if (e.length === 0) return Array(t).fill(0);
|
|
14445
|
-
let n = e.length / t, r = Array.from({ length: t }, (t, r) =>
|
|
14480
|
+
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
14481
|
return i <= 0 ? r : r.map((e) => e / i);
|
|
14447
14482
|
}
|
|
14448
|
-
function
|
|
14483
|
+
function Em(e, t = 300) {
|
|
14449
14484
|
let { numberOfChannels: n, length: r } = e;
|
|
14450
|
-
if (n <= 1) return
|
|
14485
|
+
if (n <= 1) return Tm(e.getChannelData(0), t);
|
|
14451
14486
|
let i = new Float32Array(r);
|
|
14452
14487
|
return Array.from({ length: n }, (t, n) => e.getChannelData(n)).forEach((e) => {
|
|
14453
14488
|
e.forEach((e, t) => {
|
|
14454
14489
|
i[t] += e / n;
|
|
14455
14490
|
});
|
|
14456
|
-
}),
|
|
14491
|
+
}), Tm(i, t);
|
|
14457
14492
|
}
|
|
14458
|
-
function
|
|
14493
|
+
function Dm(e, t) {
|
|
14459
14494
|
if (t.width <= 0) return 0;
|
|
14460
14495
|
let n = (e - t.left) / t.width;
|
|
14461
14496
|
return Math.min(1, Math.max(0, n));
|
|
14462
14497
|
}
|
|
14463
|
-
function
|
|
14498
|
+
function Om() {
|
|
14464
14499
|
var e, t;
|
|
14465
14500
|
let n = globalThis;
|
|
14466
14501
|
return (e = (t = n.AudioContext) == null ? n.webkitAudioContext : t) == null ? null : e;
|
|
14467
14502
|
}
|
|
14468
|
-
async function
|
|
14469
|
-
let t =
|
|
14503
|
+
async function km(e) {
|
|
14504
|
+
let t = Om();
|
|
14470
14505
|
if (!t) return null;
|
|
14471
14506
|
try {
|
|
14472
14507
|
let n = new t();
|
|
14473
14508
|
try {
|
|
14474
14509
|
let t = await n.decodeAudioData(await e.arrayBuffer());
|
|
14475
14510
|
return {
|
|
14476
|
-
peaks:
|
|
14511
|
+
peaks: Em(t),
|
|
14477
14512
|
duration: t.duration
|
|
14478
14513
|
};
|
|
14479
14514
|
} finally {
|
|
@@ -14483,42 +14518,77 @@ async function ym(e) {
|
|
|
14483
14518
|
return null;
|
|
14484
14519
|
}
|
|
14485
14520
|
}
|
|
14486
|
-
function
|
|
14521
|
+
function Am(e) {
|
|
14487
14522
|
let { mount: t, media: n, peaks: r } = e, i = document.createElement("canvas");
|
|
14488
14523
|
i.setAttribute("data-role", "audio-waveform-canvas"), i.className = "blok-audio-waveform__canvas", t.appendChild(i);
|
|
14489
14524
|
let a = () => {
|
|
14490
|
-
|
|
14491
|
-
|
|
14492
|
-
|
|
14493
|
-
|
|
14494
|
-
|
|
14495
|
-
|
|
14496
|
-
|
|
14497
|
-
|
|
14498
|
-
|
|
14499
|
-
|
|
14500
|
-
|
|
14525
|
+
var e, t, n;
|
|
14526
|
+
return (e = (t = (n = globalThis).matchMedia) == null ? void 0 : t.call(n, "(prefers-reduced-motion: reduce)").matches) == null ? !1 : e;
|
|
14527
|
+
}, o = {
|
|
14528
|
+
playing: !1,
|
|
14529
|
+
settling: !1,
|
|
14530
|
+
settleStart: 0,
|
|
14531
|
+
entranceStart: 0,
|
|
14532
|
+
rafId: 0
|
|
14533
|
+
}, 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) => {
|
|
14534
|
+
let t = i.getBoundingClientRect();
|
|
14535
|
+
if (t.width <= 0 || t.height <= 0) return;
|
|
14536
|
+
let o = globalThis.devicePixelRatio || 1, l = Math.round(t.width * o), u = Math.round(t.height * o);
|
|
14537
|
+
(i.width !== l || i.height !== u) && (i.width = l, i.height = u);
|
|
14538
|
+
let d = i.getContext("2d");
|
|
14539
|
+
if (!d) return;
|
|
14540
|
+
d.setTransform(o, 0, 0, o, 0, 0), d.clearRect(0, 0, t.width, t.height);
|
|
14541
|
+
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) => {
|
|
14542
|
+
typeof d.roundRect == "function" ? (d.beginPath(), d.roundRect(e, t, b, n, x), d.fill()) : d.fillRect(e, t, b, n);
|
|
14543
|
+
};
|
|
14544
|
+
r.forEach((e, n) => {
|
|
14545
|
+
let r = g ? Cm({
|
|
14546
|
+
basePeak: e,
|
|
14547
|
+
index: n,
|
|
14548
|
+
playheadIndex: f,
|
|
14549
|
+
timeSeconds: m,
|
|
14550
|
+
reduced: p,
|
|
14551
|
+
energy: h
|
|
14552
|
+
}) : e, i = Math.max(2, r * t.height * .92), a = n * v, o = (t.height - i) / 2;
|
|
14553
|
+
if (d.fillStyle = n < f ? C : w, E(a, o, i), g) {
|
|
14554
|
+
let e = Sm({
|
|
14555
|
+
distance: n - f,
|
|
14556
|
+
energy: h,
|
|
14557
|
+
entrance: _
|
|
14558
|
+
});
|
|
14559
|
+
e > .001 && (d.save(), d.globalAlpha = Math.min(1, e), d.fillStyle = T, E(a, o, i), d.restore());
|
|
14560
|
+
}
|
|
14501
14561
|
});
|
|
14502
|
-
},
|
|
14503
|
-
|
|
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);
|
|
14562
|
+
}, u = () => {
|
|
14563
|
+
t.style.setProperty("--blok-audio-seek-pct", String(n.duration ? n.currentTime / n.duration * 100 : 0));
|
|
14510
14564
|
}, d = (e) => {
|
|
14511
|
-
l.
|
|
14565
|
+
l(e), o.playing || o.settling && s(e) > 0 ? o.rafId = requestAnimationFrame(d) : (o.settling = !1, o.rafId = 0);
|
|
14512
14566
|
}, f = () => {
|
|
14513
|
-
|
|
14567
|
+
var e, t, n;
|
|
14568
|
+
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));
|
|
14569
|
+
}, p = () => {
|
|
14570
|
+
if (o.playing && !a()) {
|
|
14571
|
+
var e, t, n;
|
|
14572
|
+
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));
|
|
14573
|
+
} else o.playing = !1, o.settling = !1, o.rafId && (cancelAnimationFrame(o.rafId), o.rafId = 0), l(0);
|
|
14574
|
+
}, m = () => {
|
|
14575
|
+
u(), o.rafId || l(0);
|
|
14576
|
+
}, h = (e) => {
|
|
14577
|
+
n.duration && (n.currentTime = Dm(e, i.getBoundingClientRect()) * n.duration, u(), o.rafId || l(0));
|
|
14578
|
+
}, g = { active: !1 }, _ = (e) => {
|
|
14579
|
+
g.active = !0, h(e.clientX);
|
|
14580
|
+
}, v = (e) => {
|
|
14581
|
+
g.active && h(e.clientX);
|
|
14582
|
+
}, y = () => {
|
|
14583
|
+
g.active = !1;
|
|
14514
14584
|
};
|
|
14515
|
-
return i.addEventListener("pointerdown",
|
|
14516
|
-
o.
|
|
14585
|
+
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() {
|
|
14586
|
+
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
14587
|
} };
|
|
14518
14588
|
}
|
|
14519
14589
|
//#endregion
|
|
14520
14590
|
//#region src/tools/audio/metadata.ts
|
|
14521
|
-
function
|
|
14591
|
+
function jm(e) {
|
|
14522
14592
|
var t, n, r;
|
|
14523
14593
|
let i = (t = e.common) == null ? {} : t, a = {};
|
|
14524
14594
|
i.title && (a.title = i.title), i.artist && (a.artist = i.artist);
|
|
@@ -14528,39 +14598,39 @@ function xm(e) {
|
|
|
14528
14598
|
mimeType: (r = o.format) == null ? "image/jpeg" : r
|
|
14529
14599
|
}), a;
|
|
14530
14600
|
}
|
|
14531
|
-
function
|
|
14601
|
+
function Mm(e) {
|
|
14532
14602
|
return btoa(Array.from(e, (e) => String.fromCharCode(e)).join(""));
|
|
14533
14603
|
}
|
|
14534
|
-
async function
|
|
14604
|
+
async function Nm(e, t) {
|
|
14535
14605
|
if (t != null && t.uploadByFile) {
|
|
14536
14606
|
let n = new File([new Uint8Array(e.data)], "cover", { type: e.mimeType });
|
|
14537
14607
|
return (await t.uploadByFile(n)).url;
|
|
14538
14608
|
}
|
|
14539
|
-
if (e.data.byteLength <= 153600) return `data:${e.mimeType};base64,${
|
|
14609
|
+
if (e.data.byteLength <= 153600) return `data:${e.mimeType};base64,${Mm(e.data)}`;
|
|
14540
14610
|
}
|
|
14541
|
-
async function
|
|
14611
|
+
async function Pm(e) {
|
|
14542
14612
|
try {
|
|
14543
14613
|
let t = await import("./core-DdDpt2u7.mjs"), n = new Uint8Array(await e.arrayBuffer());
|
|
14544
|
-
return
|
|
14614
|
+
return jm(await t.parseBuffer(n, e.type));
|
|
14545
14615
|
} catch (e) {
|
|
14546
14616
|
return {};
|
|
14547
14617
|
}
|
|
14548
14618
|
}
|
|
14549
14619
|
//#endregion
|
|
14550
14620
|
//#region src/tools/audio/uploader.ts
|
|
14551
|
-
var
|
|
14621
|
+
var Fm = class extends Error {
|
|
14552
14622
|
constructor(e, t) {
|
|
14553
14623
|
super(t ? `${e}: ${t}` : e), this.code = e, this.name = "AudioUploadError", this.detail = t;
|
|
14554
14624
|
}
|
|
14555
14625
|
};
|
|
14556
|
-
function
|
|
14626
|
+
function Im(e) {
|
|
14557
14627
|
try {
|
|
14558
14628
|
return new URL(e);
|
|
14559
14629
|
} catch (e) {
|
|
14560
14630
|
return null;
|
|
14561
14631
|
}
|
|
14562
14632
|
}
|
|
14563
|
-
var
|
|
14633
|
+
var Lm = class {
|
|
14564
14634
|
constructor(e) {
|
|
14565
14635
|
this.config = e;
|
|
14566
14636
|
}
|
|
@@ -14576,20 +14646,20 @@ var Dm = class {
|
|
|
14576
14646
|
};
|
|
14577
14647
|
}
|
|
14578
14648
|
validateUrl(e) {
|
|
14579
|
-
let t =
|
|
14580
|
-
if (!t) throw new
|
|
14581
|
-
if (t.protocol !== "http:" && t.protocol !== "https:") throw new
|
|
14649
|
+
let t = Im(e);
|
|
14650
|
+
if (!t) throw new Fm("INVALID_URL", e);
|
|
14651
|
+
if (t.protocol !== "http:" && t.protocol !== "https:") throw new Fm("INVALID_URL", t.protocol);
|
|
14582
14652
|
}
|
|
14583
14653
|
validateFile(e) {
|
|
14584
14654
|
var t;
|
|
14585
14655
|
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
|
|
14587
|
-
if (e.size > r) throw new
|
|
14656
|
+
if (e.type && !Jl(e.type, n)) throw new Fm("UNSUPPORTED_TYPE", e.type);
|
|
14657
|
+
if (e.size > r) throw new Fm("FILE_TOO_LARGE", `${e.size} > ${r}`);
|
|
14588
14658
|
}
|
|
14589
|
-
},
|
|
14659
|
+
}, Rm = class {
|
|
14590
14660
|
constructor(e) {
|
|
14591
14661
|
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
|
|
14662
|
+
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.captionExitTimer = null, 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
14663
|
}
|
|
14594
14664
|
render() {
|
|
14595
14665
|
let e = document.createElement("div");
|
|
@@ -14714,7 +14784,7 @@ var Dm = class {
|
|
|
14714
14784
|
}
|
|
14715
14785
|
removed() {
|
|
14716
14786
|
var e, t;
|
|
14717
|
-
this.destroyed = !0, (e = this.controlsHandle) == null || e.destroy(), this.controlsHandle = null, (t = this.waveformHandle) == null || t.destroy(), this.waveformHandle = null, this.data.url.startsWith("blob:") && URL.revokeObjectURL(this.data.url);
|
|
14787
|
+
this.destroyed = !0, this.captionExitTimer && (clearTimeout(this.captionExitTimer), this.captionExitTimer = null), (e = this.controlsHandle) == null || e.destroy(), this.controlsHandle = null, (t = this.waveformHandle) == null || t.destroy(), this.waveformHandle = null, this.data.url.startsWith("blob:") && URL.revokeObjectURL(this.data.url);
|
|
14718
14788
|
}
|
|
14719
14789
|
startUpload(e) {
|
|
14720
14790
|
this.lastFileName = e.name, this.lastSource = {
|
|
@@ -14740,20 +14810,20 @@ var Dm = class {
|
|
|
14740
14810
|
url: e.url,
|
|
14741
14811
|
fileName: (r = (i = e.fileName) == null ? this.lastFileName : i) == null ? this.data.fileName : r,
|
|
14742
14812
|
mimeType: (t == null ? void 0 : t.type) || this.data.mimeType
|
|
14743
|
-
}), this.errorMessage = null, this.state = "RENDERED", this.renderState(), this.block.dispatchChange(), t && (
|
|
14813
|
+
}), this.errorMessage = null, this.state = "RENDERED", this.renderState(), this.block.dispatchChange(), t && (Pm(t).then(async (e) => {
|
|
14744
14814
|
if (n.destroyed) return;
|
|
14745
14815
|
let t = { value: !1 };
|
|
14746
14816
|
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
|
|
14817
|
+
let r = await Nm(e.cover, n.config.uploader).catch(() => void 0);
|
|
14748
14818
|
r && (n.data.coverUrl = r, t.value = !0);
|
|
14749
14819
|
}
|
|
14750
14820
|
n.destroyed || t.value && (n.renderState(), n.block.dispatchChange());
|
|
14751
|
-
}).catch(() => {}),
|
|
14821
|
+
}).catch(() => {}), km(t).then((e) => {
|
|
14752
14822
|
this.destroyed || e && e.peaks.length && (this.data.peaks = e.peaks, this.data.duration = e.duration, this.renderState(), this.block.dispatchChange());
|
|
14753
14823
|
}).catch(() => {}));
|
|
14754
14824
|
}
|
|
14755
14825
|
applyError(e) {
|
|
14756
|
-
this.errorMessage = e instanceof
|
|
14826
|
+
this.errorMessage = e instanceof Fm ? lu(e, (e) => this.api.i18n.t(e), {
|
|
14757
14827
|
tooLarge: "tools.audio.errorFileTooLarge",
|
|
14758
14828
|
generic: "tools.audio.errorUploadFailed"
|
|
14759
14829
|
}) : null, this.state = "ERROR", this.renderState();
|
|
@@ -14767,7 +14837,7 @@ var Dm = class {
|
|
|
14767
14837
|
renderState() {
|
|
14768
14838
|
var e, t;
|
|
14769
14839
|
if (this.root) {
|
|
14770
|
-
if ((e = this.controlsHandle) == null || e.destroy(), this.controlsHandle = null, (t = this.waveformHandle) == null || t.destroy(), this.waveformHandle = null, this.root.replaceChildren(), this.uploadingEl = null, this.syncRootAttributes(), this.state === "EMPTY") {
|
|
14840
|
+
if (this.captionExitTimer && (clearTimeout(this.captionExitTimer), this.captionExitTimer = null), (e = this.controlsHandle) == null || e.destroy(), this.controlsHandle = null, (t = this.waveformHandle) == null || t.destroy(), this.waveformHandle = null, this.root.replaceChildren(), this.uploadingEl = null, this.syncRootAttributes(), this.state === "EMPTY") {
|
|
14771
14841
|
this.renderEmpty();
|
|
14772
14842
|
return;
|
|
14773
14843
|
}
|
|
@@ -14812,55 +14882,84 @@ var Dm = class {
|
|
|
14812
14882
|
r.type = "button", r.className = "blok-audio-retry", r.setAttribute("data-action", "replace"), r.textContent = Z(this.api.i18n, "tools.audio.errorReplace", "Replace"), r.addEventListener("click", () => this.transitionToEmpty()), t.append(n, r), this.root.appendChild(t);
|
|
14813
14883
|
}
|
|
14814
14884
|
renderRendered() {
|
|
14815
|
-
var e
|
|
14885
|
+
var e;
|
|
14816
14886
|
if (!this.root) return;
|
|
14817
|
-
let
|
|
14887
|
+
let t = Z(this.api.i18n, "tools.audio.titlePlaceholder", "Track title"), n = Z(this.api.i18n, "tools.audio.artistPlaceholder", "Artist"), { figure: r, audio: i, waveformMount: a, title: o, artist: s, body: c } = lm(this.data, {
|
|
14818
14888
|
editable: !this.readOnly,
|
|
14819
|
-
titlePlaceholder:
|
|
14820
|
-
artistPlaceholder:
|
|
14889
|
+
titlePlaceholder: t,
|
|
14890
|
+
artistPlaceholder: n
|
|
14821
14891
|
});
|
|
14822
|
-
(e = this.data.peaks) != null && e.length && (this.waveformHandle =
|
|
14823
|
-
mount:
|
|
14824
|
-
media:
|
|
14892
|
+
(e = this.data.peaks) != null && e.length && (this.waveformHandle = Am({
|
|
14893
|
+
mount: a,
|
|
14894
|
+
media: i,
|
|
14825
14895
|
peaks: this.data.peaks
|
|
14826
14896
|
})), this.controlsHandle = pm({
|
|
14827
|
-
media:
|
|
14828
|
-
figure:
|
|
14897
|
+
media: i,
|
|
14898
|
+
figure: r,
|
|
14829
14899
|
data: this.data,
|
|
14830
14900
|
onLoopChange: (e) => {
|
|
14831
14901
|
this.data.loop = e || void 0, this.block.dispatchChange();
|
|
14832
14902
|
}
|
|
14833
|
-
}),
|
|
14834
|
-
let u = (t = this.config.captionPlaceholder) == null ? am : t;
|
|
14835
|
-
if (this.data.captionVisible !== !1 || !this.readOnly) {
|
|
14836
|
-
var d;
|
|
14837
|
-
i.appendChild(um({
|
|
14838
|
-
value: (d = this.data.caption) == null ? "" : d,
|
|
14839
|
-
placeholder: u,
|
|
14840
|
-
editable: !this.readOnly
|
|
14841
|
-
}));
|
|
14842
|
-
}
|
|
14843
|
-
s.addEventListener("blur", () => {
|
|
14903
|
+
}), c.appendChild(this.controlsHandle.element), this.data.captionVisible !== !1 && r.appendChild(this.createCaptionRow()), o.addEventListener("blur", () => {
|
|
14844
14904
|
var e;
|
|
14845
|
-
let t = (e =
|
|
14905
|
+
let t = (e = o.textContent) == null ? "" : e;
|
|
14846
14906
|
t !== this.data.title && (this.data.title = t || void 0, this.block.dispatchChange());
|
|
14847
|
-
}),
|
|
14907
|
+
}), s.addEventListener("blur", () => {
|
|
14848
14908
|
var e;
|
|
14849
|
-
let t = (e =
|
|
14909
|
+
let t = (e = s.textContent) == null ? "" : e;
|
|
14850
14910
|
t !== this.data.artist && (this.data.artist = t || void 0, this.block.dispatchChange());
|
|
14851
|
-
});
|
|
14852
|
-
|
|
14853
|
-
|
|
14911
|
+
}), this.root.appendChild(r);
|
|
14912
|
+
}
|
|
14913
|
+
createCaptionRow() {
|
|
14914
|
+
var e, t;
|
|
14915
|
+
let n = (e = this.config.captionPlaceholder) == null ? am : e, r = um({
|
|
14916
|
+
value: (t = this.data.caption) == null ? "" : t,
|
|
14917
|
+
placeholder: n,
|
|
14918
|
+
editable: !this.readOnly
|
|
14919
|
+
}), i = r.querySelector("[data-role=\"audio-caption\"]");
|
|
14920
|
+
return i == null || i.addEventListener("blur", () => {
|
|
14854
14921
|
var e;
|
|
14855
|
-
let t = (e =
|
|
14922
|
+
let t = (e = i.textContent) == null ? "" : e;
|
|
14856
14923
|
t !== this.data.caption && (this.data.caption = t || void 0, this.block.dispatchChange());
|
|
14857
|
-
}),
|
|
14924
|
+
}), r;
|
|
14925
|
+
}
|
|
14926
|
+
prefersReducedMotion() {
|
|
14927
|
+
var e, t, n;
|
|
14928
|
+
return (e = (t = (n = globalThis).matchMedia) == null ? void 0 : t.call(n, "(prefers-reduced-motion: reduce)").matches) == null ? !1 : e;
|
|
14858
14929
|
}
|
|
14859
14930
|
setAlignment(e) {
|
|
14860
14931
|
this.data.alignment !== e && (this.data.alignment = e, this.block.dispatchChange(), this.renderState());
|
|
14861
14932
|
}
|
|
14862
14933
|
toggleCaption() {
|
|
14863
|
-
|
|
14934
|
+
var e;
|
|
14935
|
+
let t = this.data.captionVisible === !1;
|
|
14936
|
+
this.data.captionVisible = t, t || (this.data.caption = void 0), this.block.dispatchChange();
|
|
14937
|
+
let n = (e = this.root) == null ? void 0 : e.querySelector("[data-role=\"audio-figure\"]");
|
|
14938
|
+
if (!n || this.prefersReducedMotion()) {
|
|
14939
|
+
this.renderState();
|
|
14940
|
+
return;
|
|
14941
|
+
}
|
|
14942
|
+
this.syncRootAttributes(), t ? this.animateCaptionIn(n) : this.animateCaptionOut(n);
|
|
14943
|
+
}
|
|
14944
|
+
animateCaptionIn(e) {
|
|
14945
|
+
let t = e.querySelector("[data-role=\"audio-caption-row\"]");
|
|
14946
|
+
if (t) {
|
|
14947
|
+
this.captionExitTimer && (clearTimeout(this.captionExitTimer), this.captionExitTimer = null), t.classList.remove("is-collapsed");
|
|
14948
|
+
return;
|
|
14949
|
+
}
|
|
14950
|
+
let n = this.createCaptionRow();
|
|
14951
|
+
n.classList.add("is-collapsed"), e.appendChild(n), n.offsetHeight, n.classList.remove("is-collapsed");
|
|
14952
|
+
}
|
|
14953
|
+
animateCaptionOut(e) {
|
|
14954
|
+
let t = e.querySelector("[data-role=\"audio-caption-row\"]");
|
|
14955
|
+
if (!t) return;
|
|
14956
|
+
t.classList.add("is-collapsed");
|
|
14957
|
+
let n = () => {
|
|
14958
|
+
this.captionExitTimer && (clearTimeout(this.captionExitTimer), this.captionExitTimer = null), t.remove();
|
|
14959
|
+
};
|
|
14960
|
+
t.addEventListener("transitionend", (e) => {
|
|
14961
|
+
e.propertyName === "grid-template-rows" && n();
|
|
14962
|
+
}, { once: !0 }), this.captionExitTimer = setTimeout(n, 360);
|
|
14864
14963
|
}
|
|
14865
14964
|
toggleLoop() {
|
|
14866
14965
|
this.data.loop = this.data.loop === !0 ? void 0 : !0, this.block.dispatchChange(), this.renderState();
|
|
@@ -14877,7 +14976,7 @@ var Dm = class {
|
|
|
14877
14976
|
let e = navigator.clipboard;
|
|
14878
14977
|
e && typeof e.writeText == "function" && e.writeText(this.data.url);
|
|
14879
14978
|
}
|
|
14880
|
-
},
|
|
14979
|
+
}, zm = ["video/*"], Bm = 100 * 1024 * 1024, Vm = "Write a caption…", Hm = /^https?:\/\/\S+\.(mp4|webm|ogg|mov|m4v)(\?\S*)?$/i;
|
|
14881
14980
|
//#endregion
|
|
14882
14981
|
//#region src/tools/video/i18n.ts
|
|
14883
14982
|
function Q(e, t, n) {
|
|
@@ -14885,11 +14984,11 @@ function Q(e, t, n) {
|
|
|
14885
14984
|
}
|
|
14886
14985
|
//#endregion
|
|
14887
14986
|
//#region src/tools/video/empty-state.ts
|
|
14888
|
-
function
|
|
14987
|
+
function Um(e) {
|
|
14889
14988
|
var t;
|
|
14890
14989
|
let n = e.i18n;
|
|
14891
14990
|
return ou({
|
|
14892
|
-
acceptTypes: (t = e.acceptTypes) == null ? [...
|
|
14991
|
+
acceptTypes: (t = e.acceptTypes) == null ? [...zm] : t,
|
|
14893
14992
|
maxSize: e.maxSize,
|
|
14894
14993
|
onFile: e.onFile,
|
|
14895
14994
|
onUrl: e.onUrl,
|
|
@@ -14910,21 +15009,21 @@ function Nm(e) {
|
|
|
14910
15009
|
}
|
|
14911
15010
|
//#endregion
|
|
14912
15011
|
//#region src/tools/video/ui.ts
|
|
14913
|
-
var
|
|
15012
|
+
var Wm = {
|
|
14914
15013
|
left: "left",
|
|
14915
15014
|
center: "center",
|
|
14916
15015
|
right: "right"
|
|
14917
15016
|
};
|
|
14918
|
-
function
|
|
15017
|
+
function Gm(e) {
|
|
14919
15018
|
var t, n;
|
|
14920
15019
|
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 =
|
|
15020
|
+
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
15021
|
let a = document.createElement("div");
|
|
14923
15022
|
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
15023
|
let o = document.createElement("video");
|
|
14925
15024
|
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
15025
|
}
|
|
14927
|
-
function
|
|
15026
|
+
function Km(e) {
|
|
14928
15027
|
let t = document.createElement("div");
|
|
14929
15028
|
t.className = "blok-video-caption-row", t.setAttribute("data-role", "video-caption-row");
|
|
14930
15029
|
let n = document.createElement("div");
|
|
@@ -14935,12 +15034,12 @@ function Im(e) {
|
|
|
14935
15034
|
}
|
|
14936
15035
|
//#endregion
|
|
14937
15036
|
//#region src/tools/video/controls.ts
|
|
14938
|
-
function
|
|
15037
|
+
function qm(e) {
|
|
14939
15038
|
if (!Number.isFinite(e) || e <= 0) return "0:00";
|
|
14940
15039
|
let t = Math.floor(e);
|
|
14941
15040
|
return `${Math.floor(t / 60)}:${(t % 60).toString().padStart(2, "0")}`;
|
|
14942
15041
|
}
|
|
14943
|
-
function
|
|
15042
|
+
function Jm(e, t, n) {
|
|
14944
15043
|
var r, i;
|
|
14945
15044
|
if (!e || e.length === 0 || !Number.isFinite(n) || n <= 0) return 0;
|
|
14946
15045
|
let a = Array.from({ length: e.length }, (t, n) => ({
|
|
@@ -14949,17 +15048,17 @@ function Rm(e, t, n) {
|
|
|
14949
15048
|
})), 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
15049
|
return Math.min(100, Math.max(0, c / n * 100));
|
|
14951
15050
|
}
|
|
14952
|
-
function
|
|
15051
|
+
function Ym(e, t) {
|
|
14953
15052
|
return !Number.isFinite(t) || t <= 0 ? 0 : Math.min(1, Math.max(0, e)) * t;
|
|
14954
15053
|
}
|
|
14955
|
-
function
|
|
15054
|
+
function Xm(e, t) {
|
|
14956
15055
|
return t.width ? Math.min(1, Math.max(0, (e - t.left) / t.width)) : 0;
|
|
14957
15056
|
}
|
|
14958
|
-
function
|
|
15057
|
+
function Zm(e, t, n, r = "") {
|
|
14959
15058
|
let i = document.createElement("button");
|
|
14960
15059
|
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
15060
|
}
|
|
14962
|
-
function
|
|
15061
|
+
function Qm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1 }) {
|
|
14963
15062
|
var a, o;
|
|
14964
15063
|
let s = document.createElement("div");
|
|
14965
15064
|
s.className = "blok-video-controls", s.setAttribute("data-role", "video-controls");
|
|
@@ -14975,7 +15074,7 @@ function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1
|
|
|
14975
15074
|
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
15075
|
let m = document.createElement("div");
|
|
14977
15076
|
m.className = "blok-video-controls__bar";
|
|
14978
|
-
let h =
|
|
15077
|
+
let h = Zm("play-toggle", "Play", xn), _ = document.createElement("input");
|
|
14979
15078
|
_.type = "range", _.min = "0", _.max = "0", _.step = "any", _.value = "0", _.className = "blok-video-controls__seek", _.setAttribute("data-role", "seek"), _.setAttribute("aria-label", "Seek");
|
|
14980
15079
|
let v = document.createElement("div");
|
|
14981
15080
|
v.className = "blok-video-controls__seek-wrap", v.setAttribute("data-role", "seek-wrap");
|
|
@@ -14989,11 +15088,11 @@ function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1
|
|
|
14989
15088
|
C.className = "blok-video-controls__seek-time", C.setAttribute("data-role", "seek-time"), x.append(S, C), v.append(b, _, x);
|
|
14990
15089
|
let w = document.createElement("span");
|
|
14991
15090
|
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 =
|
|
15091
|
+
let T = Zm("mute-toggle", "Mute", f);
|
|
14993
15092
|
T.setAttribute("aria-pressed", "false");
|
|
14994
15093
|
let E = document.createElement("input");
|
|
14995
15094
|
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 =
|
|
15095
|
+
let D = Zm("fullscreen", "Fullscreen", Cn), ee = document.createElement("div");
|
|
14997
15096
|
ee.className = "blok-video-controls__volume-wrap", ee.append(T, E), m.append(h, ee, w, v, D), s.appendChild(m);
|
|
14998
15097
|
let O = document.createElement("div");
|
|
14999
15098
|
O.className = "blok-video-controls__mini", O.setAttribute("data-role", "mini-progress"), O.setAttribute("aria-hidden", "true"), s.appendChild(O);
|
|
@@ -15013,8 +15112,8 @@ function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1
|
|
|
15013
15112
|
let te = () => {
|
|
15014
15113
|
if (j.timeMode === "remaining") {
|
|
15015
15114
|
let t = Number.isFinite(e.duration) ? e.duration : 0;
|
|
15016
|
-
w.textContent = `-${
|
|
15017
|
-
} else w.textContent = `${
|
|
15115
|
+
w.textContent = `-${qm(Math.max(0, t - e.currentTime))}`;
|
|
15116
|
+
} else w.textContent = `${qm(e.currentTime)} / ${qm(e.duration)}`;
|
|
15018
15117
|
}, ne = () => {
|
|
15019
15118
|
j.timeMode = j.timeMode === "elapsed" ? "remaining" : "elapsed", te();
|
|
15020
15119
|
}, N = () => {
|
|
@@ -15025,7 +15124,7 @@ function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1
|
|
|
15025
15124
|
let e = Number(_.max) || 0, t = e > 0 ? Number(_.value) / e * 100 : 0;
|
|
15026
15125
|
s.style.setProperty("--blok-seek-pct", `${t}%`);
|
|
15027
15126
|
}, se = () => {
|
|
15028
|
-
let t =
|
|
15127
|
+
let t = Jm(e.buffered, e.currentTime, e.duration);
|
|
15029
15128
|
b.style.setProperty("--blok-buffered-pct", `${t}%`);
|
|
15030
15129
|
}, ce = () => {
|
|
15031
15130
|
let t = Number.isFinite(e.duration) ? e.duration : 0;
|
|
@@ -15067,8 +15166,8 @@ function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1
|
|
|
15067
15166
|
I.ready = !0, I.pendingTime >= 0 && _e(I.pendingTime);
|
|
15068
15167
|
}), n.addEventListener("seeked", ge), I.el = n, s.appendChild(n);
|
|
15069
15168
|
}, ve = (t) => {
|
|
15070
|
-
let n = _.getBoundingClientRect(), r =
|
|
15071
|
-
C.textContent =
|
|
15169
|
+
let n = _.getBoundingClientRect(), r = Xm(t.clientX, n), i = Ym(r, e.duration);
|
|
15170
|
+
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
15171
|
}, ye = () => {
|
|
15073
15172
|
x.setAttribute("aria-hidden", "true"), I.pendingTime = -1;
|
|
15074
15173
|
}, be = () => M(!0), xe = () => M(!1), Se = () => e.muted || e.volume === 0, Ce = () => {
|
|
@@ -15221,7 +15320,7 @@ function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1
|
|
|
15221
15320
|
row: i,
|
|
15222
15321
|
value: s
|
|
15223
15322
|
};
|
|
15224
|
-
}, st =
|
|
15323
|
+
}, st = Zm("gear", "Settings", nt);
|
|
15225
15324
|
st.setAttribute("aria-haspopup", "menu"), st.setAttribute("aria-expanded", "false");
|
|
15226
15325
|
let z = document.createElement("div");
|
|
15227
15326
|
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 +15432,7 @@ function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1
|
|
|
15333
15432
|
it || r === "none" || (V.setAttribute("data-active", "true"), !Ut.raf && (Ut.raf = requestAnimationFrame(Gt)));
|
|
15334
15433
|
}, qt = () => {
|
|
15335
15434
|
V.setAttribute("data-active", "false"), Ut.raf && (cancelAnimationFrame(Ut.raf), Ut.raf = 0);
|
|
15336
|
-
}, Yt = he(), Xt =
|
|
15435
|
+
}, Yt = he(), Xt = Zm("theater", "Theater mode", De);
|
|
15337
15436
|
Xt.setAttribute("aria-pressed", "false");
|
|
15338
15437
|
let Zt = {
|
|
15339
15438
|
on: !1,
|
|
@@ -15403,7 +15502,7 @@ function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1
|
|
|
15403
15502
|
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
15503
|
};
|
|
15405
15504
|
Xt.addEventListener("click", () => cn(!Zt.on)), m.insertBefore(Xt, D);
|
|
15406
|
-
let H = document.pictureInPictureEnabled ?
|
|
15505
|
+
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
15506
|
H && (H.setAttribute("aria-pressed", "false"), H.addEventListener("click", () => {
|
|
15408
15507
|
var t, n, r;
|
|
15409
15508
|
document.pictureInPictureElement === e ? (t = (n = document).exitPictureInPicture) == null || t.call(n) : (r = e.requestPictureInPicture) == null || r.call(e);
|
|
@@ -15503,19 +15602,19 @@ function Hm({ video: e, figure: t, storage: n, glow: r = "minimal", loop: i = !1
|
|
|
15503
15602
|
}
|
|
15504
15603
|
//#endregion
|
|
15505
15604
|
//#region src/tools/video/uploader.ts
|
|
15506
|
-
var
|
|
15605
|
+
var $m = class extends Error {
|
|
15507
15606
|
constructor(e, t) {
|
|
15508
15607
|
super(t ? `${e}: ${t}` : e), this.code = e, this.name = "VideoUploadError", this.detail = t;
|
|
15509
15608
|
}
|
|
15510
15609
|
};
|
|
15511
|
-
function
|
|
15610
|
+
function eh(e) {
|
|
15512
15611
|
try {
|
|
15513
15612
|
return new URL(e);
|
|
15514
15613
|
} catch (e) {
|
|
15515
15614
|
return null;
|
|
15516
15615
|
}
|
|
15517
15616
|
}
|
|
15518
|
-
var
|
|
15617
|
+
var th = class {
|
|
15519
15618
|
constructor(e) {
|
|
15520
15619
|
this.config = e;
|
|
15521
15620
|
}
|
|
@@ -15531,20 +15630,20 @@ var Gm = class {
|
|
|
15531
15630
|
};
|
|
15532
15631
|
}
|
|
15533
15632
|
validateUrl(e) {
|
|
15534
|
-
let t =
|
|
15535
|
-
if (!t) throw new
|
|
15536
|
-
if (t.protocol !== "http:" && t.protocol !== "https:") throw new
|
|
15633
|
+
let t = eh(e);
|
|
15634
|
+
if (!t) throw new $m("INVALID_URL", e);
|
|
15635
|
+
if (t.protocol !== "http:" && t.protocol !== "https:") throw new $m("INVALID_URL", t.protocol);
|
|
15537
15636
|
}
|
|
15538
15637
|
validateFile(e) {
|
|
15539
15638
|
var t;
|
|
15540
|
-
let n = (t = this.config.types) == null ? [...
|
|
15541
|
-
if (e.type && !Jl(e.type, n)) throw new
|
|
15542
|
-
if (e.size > r) throw new
|
|
15639
|
+
let n = (t = this.config.types) == null ? [...zm] : t, r = uu(this.config.maxSize, e.type, Bm);
|
|
15640
|
+
if (e.type && !Jl(e.type, n)) throw new $m("UNSUPPORTED_TYPE", e.type);
|
|
15641
|
+
if (e.size > r) throw new $m("FILE_TOO_LARGE", `${e.size} > ${r}`);
|
|
15543
15642
|
}
|
|
15544
|
-
},
|
|
15643
|
+
}, nh = class {
|
|
15545
15644
|
constructor(e) {
|
|
15546
15645
|
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
|
|
15646
|
+
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
15647
|
}
|
|
15549
15648
|
render() {
|
|
15550
15649
|
let e = document.createElement("div");
|
|
@@ -15576,7 +15675,7 @@ var Gm = class {
|
|
|
15576
15675
|
}
|
|
15577
15676
|
static get pasteConfig() {
|
|
15578
15677
|
return {
|
|
15579
|
-
patterns: { video:
|
|
15678
|
+
patterns: { video: Hm },
|
|
15580
15679
|
files: { mimeTypes: ["video/*"] }
|
|
15581
15680
|
};
|
|
15582
15681
|
}
|
|
@@ -15719,7 +15818,7 @@ var Gm = class {
|
|
|
15719
15818
|
}), this.errorMessage = null, this.state = "RENDERED", this.renderState(), this.block.dispatchChange();
|
|
15720
15819
|
}
|
|
15721
15820
|
applyError(e) {
|
|
15722
|
-
this.errorMessage = e instanceof
|
|
15821
|
+
this.errorMessage = e instanceof $m ? lu(e, (e) => this.api.i18n.t(e), {
|
|
15723
15822
|
tooLarge: "tools.video.errorFileTooLarge",
|
|
15724
15823
|
generic: "tools.video.errorUploadFailed"
|
|
15725
15824
|
}) : null, this.state = "ERROR", this.renderState();
|
|
@@ -15756,7 +15855,7 @@ var Gm = class {
|
|
|
15756
15855
|
}
|
|
15757
15856
|
renderEmpty() {
|
|
15758
15857
|
if (!this.root) return;
|
|
15759
|
-
let e =
|
|
15858
|
+
let e = Um({
|
|
15760
15859
|
onFile: (e) => this.startUpload(e),
|
|
15761
15860
|
onUrl: (e) => this.startUrl(e),
|
|
15762
15861
|
acceptTypes: this.config.types,
|
|
@@ -15786,11 +15885,11 @@ var Gm = class {
|
|
|
15786
15885
|
renderRendered() {
|
|
15787
15886
|
var e, t, n;
|
|
15788
15887
|
if (!this.root) return;
|
|
15789
|
-
let r =
|
|
15888
|
+
let r = Gm(this.data), i = (e = r.querySelector("[data-role=\"video-media\"]")) == null ? r : e, a = i.querySelector("video");
|
|
15790
15889
|
if (a) {
|
|
15791
15890
|
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
15891
|
var o;
|
|
15793
|
-
this.controlsHandle =
|
|
15892
|
+
this.controlsHandle = Qm({
|
|
15794
15893
|
video: a,
|
|
15795
15894
|
figure: r,
|
|
15796
15895
|
glow: (o = this.config.glow) == null ? "minimal" : o,
|
|
@@ -15807,10 +15906,10 @@ var Gm = class {
|
|
|
15807
15906
|
r.addEventListener("blok-video-theater", (e) => {
|
|
15808
15907
|
this.theater = e.detail.on;
|
|
15809
15908
|
}), this.theater && ((t = this.controlsHandle) == null || t.setTheater(!0));
|
|
15810
|
-
let s = (n = this.config.captionPlaceholder) == null ?
|
|
15909
|
+
let s = (n = this.config.captionPlaceholder) == null ? Vm : n;
|
|
15811
15910
|
if (this.data.captionVisible !== !1 || !this.readOnly) {
|
|
15812
15911
|
var c;
|
|
15813
|
-
r.appendChild(
|
|
15912
|
+
r.appendChild(Km({
|
|
15814
15913
|
value: (c = this.data.caption) == null ? "" : c,
|
|
15815
15914
|
placeholder: s,
|
|
15816
15915
|
readOnly: this.readOnly,
|
|
@@ -15870,7 +15969,7 @@ var Gm = class {
|
|
|
15870
15969
|
let e = navigator.clipboard;
|
|
15871
15970
|
e && typeof e.writeText == "function" && e.writeText(this.data.url);
|
|
15872
15971
|
}
|
|
15873
|
-
},
|
|
15972
|
+
}, rh = class {
|
|
15874
15973
|
constructor({ data: e, api: t, block: n, readOnly: r }) {
|
|
15875
15974
|
this.container = null, this.api = t, this._data = W({}, e), this.blockId = n.id, this.readOnly = r;
|
|
15876
15975
|
}
|
|
@@ -15942,7 +16041,7 @@ var Gm = class {
|
|
|
15942
16041
|
static get isReadOnlySupported() {
|
|
15943
16042
|
return !0;
|
|
15944
16043
|
}
|
|
15945
|
-
},
|
|
16044
|
+
}, ih = class {
|
|
15946
16045
|
constructor({ data: e, api: t, block: n }) {
|
|
15947
16046
|
this.childContainer = null, this.populated = !1, this.api = t, this._data = W({}, e), this.blockId = n.id, this.block = n;
|
|
15948
16047
|
}
|
|
@@ -16002,71 +16101,71 @@ var Gm = class {
|
|
|
16002
16101
|
static get isReadOnlySupported() {
|
|
16003
16102
|
return !0;
|
|
16004
16103
|
}
|
|
16005
|
-
},
|
|
16104
|
+
}, ah = class {
|
|
16006
16105
|
static get provides() {
|
|
16007
16106
|
return {
|
|
16008
|
-
column_list:
|
|
16009
|
-
column:
|
|
16107
|
+
column_list: rh,
|
|
16108
|
+
column: ih
|
|
16010
16109
|
};
|
|
16011
16110
|
}
|
|
16012
|
-
},
|
|
16111
|
+
}, oh = {
|
|
16013
16112
|
left: En,
|
|
16014
16113
|
center: Te,
|
|
16015
16114
|
right: u
|
|
16016
|
-
},
|
|
16115
|
+
}, sh = {
|
|
16017
16116
|
left: "tools.image.alignmentLeftAria",
|
|
16018
16117
|
center: "tools.image.alignmentCenterAria",
|
|
16019
16118
|
right: "tools.image.alignmentRightAria"
|
|
16020
|
-
},
|
|
16119
|
+
}, ch = [
|
|
16021
16120
|
"left",
|
|
16022
16121
|
"center",
|
|
16023
16122
|
"right"
|
|
16024
16123
|
];
|
|
16025
|
-
function
|
|
16124
|
+
function lh(e) {
|
|
16026
16125
|
let t = document.createElement("div");
|
|
16027
|
-
return t.setAttribute("data-role", "embed-overlay"), t.className = "blok-embed-toolbar",
|
|
16126
|
+
return t.setAttribute("data-role", "embed-overlay"), t.className = "blok-embed-toolbar", uh(t, e), mh(t), ph(t, {
|
|
16028
16127
|
action: "caption-toggle",
|
|
16029
16128
|
label: e.i18n.t("tools.image.toggleCaption"),
|
|
16030
16129
|
icon: T,
|
|
16031
16130
|
pressed: e.captionVisible,
|
|
16032
16131
|
onClick: e.onToggleCaption
|
|
16033
|
-
}),
|
|
16132
|
+
}), dh(t, e), mh(t), fh(t, e), t;
|
|
16034
16133
|
}
|
|
16035
|
-
function
|
|
16134
|
+
function uh(e, t) {
|
|
16036
16135
|
let n = document.createElement("div");
|
|
16037
16136
|
n.className = "blok-embed-toolbar__align", n.style.position = "relative";
|
|
16038
16137
|
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 =
|
|
16138
|
+
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
16139
|
let a = document.createElement("div");
|
|
16041
16140
|
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 =
|
|
16043
|
-
for (let e of
|
|
16141
|
+
let o = hh(i, a);
|
|
16142
|
+
for (let e of ch) {
|
|
16044
16143
|
let n = document.createElement("button");
|
|
16045
|
-
n.type = "button", n.setAttribute("data-action", `align-${e}`), n.setAttribute("aria-label", t.i18n.t(
|
|
16144
|
+
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
16145
|
n.stopPropagation(), o(!1), t.onAlign(e);
|
|
16047
16146
|
}), a.appendChild(n);
|
|
16048
16147
|
}
|
|
16049
16148
|
n.appendChild(a), e.appendChild(n);
|
|
16050
16149
|
}
|
|
16051
|
-
function
|
|
16150
|
+
function dh(e, t) {
|
|
16052
16151
|
let n = document.createElement("a");
|
|
16053
16152
|
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
16153
|
}
|
|
16055
|
-
function
|
|
16154
|
+
function fh(e, t) {
|
|
16056
16155
|
let n = document.createElement("button");
|
|
16057
16156
|
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
16157
|
}
|
|
16059
|
-
function
|
|
16158
|
+
function ph(e, t) {
|
|
16060
16159
|
let n = document.createElement("button");
|
|
16061
16160
|
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
16161
|
e.stopPropagation(), t.onClick();
|
|
16063
16162
|
}), e.appendChild(n);
|
|
16064
16163
|
}
|
|
16065
|
-
function
|
|
16164
|
+
function mh(e) {
|
|
16066
16165
|
let t = document.createElement("div");
|
|
16067
16166
|
t.className = "blok-embed-toolbar__divider", t.setAttribute("aria-hidden", "true"), e.appendChild(t);
|
|
16068
16167
|
}
|
|
16069
|
-
function
|
|
16168
|
+
function hh(e, t) {
|
|
16070
16169
|
let n = (e) => {
|
|
16071
16170
|
e.key === "Escape" && !t.hidden && (e.stopPropagation(), i(!1));
|
|
16072
16171
|
}, r = (n) => {
|
|
@@ -16084,7 +16183,7 @@ function ah(e, t) {
|
|
|
16084
16183
|
}
|
|
16085
16184
|
//#endregion
|
|
16086
16185
|
//#region src/tools/link/embed/index.ts
|
|
16087
|
-
var
|
|
16186
|
+
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
16187
|
constructor(e) {
|
|
16089
16188
|
this.root = null, this.resizeDetach = [], this.api = e.api, this.block = e.block, this.readOnly = e.readOnly, this.data = W({}, e.data);
|
|
16090
16189
|
}
|
|
@@ -16120,8 +16219,8 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16120
16219
|
source: e,
|
|
16121
16220
|
embed: t.embedUrl,
|
|
16122
16221
|
kind: t.kind,
|
|
16123
|
-
width: (n = r.width) == null ?
|
|
16124
|
-
height: (i = r.height) == null ?
|
|
16222
|
+
width: (n = r.width) == null ? yh : n,
|
|
16223
|
+
height: (i = r.height) == null ? bh : i
|
|
16125
16224
|
}, this.renderState(), !0;
|
|
16126
16225
|
}
|
|
16127
16226
|
return this.isGenericAllowed() && xe(e) ? (this.data = {
|
|
@@ -16129,8 +16228,8 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16129
16228
|
source: e,
|
|
16130
16229
|
embed: e,
|
|
16131
16230
|
kind: "iframe",
|
|
16132
|
-
width:
|
|
16133
|
-
height:
|
|
16231
|
+
width: yh,
|
|
16232
|
+
height: bh
|
|
16134
16233
|
}, this.renderState(), !0) : !1;
|
|
16135
16234
|
}
|
|
16136
16235
|
isGenericAllowed() {
|
|
@@ -16148,8 +16247,8 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16148
16247
|
source: (t = this.data.source) == null ? "" : t,
|
|
16149
16248
|
embed: (n = this.data.embed) == null ? "" : n,
|
|
16150
16249
|
kind: (r = this.data.kind) == null ? "iframe" : r,
|
|
16151
|
-
width: (i = this.data.width) == null ?
|
|
16152
|
-
height: (a = this.data.height) == null ?
|
|
16250
|
+
width: (i = this.data.width) == null ? yh : i,
|
|
16251
|
+
height: (a = this.data.height) == null ? bh : a
|
|
16153
16252
|
}, 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
16253
|
}
|
|
16155
16254
|
validate(e) {
|
|
@@ -16215,7 +16314,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16215
16314
|
let a = this.data.source ? (e = (t = r(this.data.source)) == null ? void 0 : t.remoteId) == null ? "" : e : "";
|
|
16216
16315
|
if (this.data.service === "telegram") {
|
|
16217
16316
|
let e = document.createElement("script");
|
|
16218
|
-
return e.async = !0, e.src =
|
|
16317
|
+
return e.async = !0, e.src = gh, e.setAttribute("data-telegram-post", a), e.setAttribute("data-width", "100%"), i.appendChild(e), i;
|
|
16219
16318
|
}
|
|
16220
16319
|
if (this.data.service === "threads") {
|
|
16221
16320
|
var o, s;
|
|
@@ -16224,14 +16323,14 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16224
16323
|
let t = document.createElement("a");
|
|
16225
16324
|
t.href = (s = this.data.embed) == null ? "" : s, e.appendChild(t), i.appendChild(e);
|
|
16226
16325
|
let n = document.createElement("script");
|
|
16227
|
-
return n.async = !0, n.src =
|
|
16326
|
+
return n.async = !0, n.src = vh, i.appendChild(n), i;
|
|
16228
16327
|
}
|
|
16229
16328
|
let c = document.createElement("blockquote");
|
|
16230
16329
|
c.className = "twitter-tweet";
|
|
16231
16330
|
let l = document.createElement("a");
|
|
16232
16331
|
l.href = (n = this.data.source) == null ? "" : n, c.appendChild(l), i.appendChild(c);
|
|
16233
16332
|
let u = document.createElement("script");
|
|
16234
|
-
return u.async = !0, u.src =
|
|
16333
|
+
return u.async = !0, u.src = _h, i.appendChild(u), i;
|
|
16235
16334
|
}
|
|
16236
16335
|
buildEmpty() {
|
|
16237
16336
|
let e = document.createElement("div");
|
|
@@ -16273,8 +16372,8 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16273
16372
|
}
|
|
16274
16373
|
buildIframeFigure() {
|
|
16275
16374
|
var e, t, n;
|
|
16276
|
-
let r = document.createElement("figure"), i = this.data.width && this.data.width > 0 ? this.data.width :
|
|
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 ?
|
|
16375
|
+
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;
|
|
16376
|
+
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
16377
|
let s = (n = this.data.alignment) == null ? "center" : n;
|
|
16279
16378
|
r.style.marginLeft = s === "left" ? "0" : "auto", r.style.marginRight = s === "right" ? "0" : "auto";
|
|
16280
16379
|
let c = document.createElement("div");
|
|
@@ -16283,7 +16382,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16283
16382
|
buildIframe() {
|
|
16284
16383
|
var e;
|
|
16285
16384
|
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",
|
|
16385
|
+
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
16386
|
}
|
|
16288
16387
|
attachResizeHandles(e) {
|
|
16289
16388
|
var t;
|
|
@@ -16325,7 +16424,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16325
16424
|
}
|
|
16326
16425
|
buildOverlay() {
|
|
16327
16426
|
var e, t;
|
|
16328
|
-
let n =
|
|
16427
|
+
let n = lh({
|
|
16329
16428
|
alignment: (e = this.data.alignment) == null ? "center" : e,
|
|
16330
16429
|
captionVisible: this.isCaptionVisible(),
|
|
16331
16430
|
source: (t = this.data.source) == null ? "" : t,
|
|
@@ -16413,7 +16512,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16413
16512
|
let t = navigator.clipboard;
|
|
16414
16513
|
t == null || t.writeText((e = this.data.source) == null ? "" : e);
|
|
16415
16514
|
}
|
|
16416
|
-
},
|
|
16515
|
+
}, Th = class {
|
|
16417
16516
|
constructor(e) {
|
|
16418
16517
|
this.config = e;
|
|
16419
16518
|
}
|
|
@@ -16434,10 +16533,10 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16434
16533
|
domain: s.domain
|
|
16435
16534
|
};
|
|
16436
16535
|
}
|
|
16437
|
-
},
|
|
16536
|
+
}, Eh = /https?:\/\/\S+/, Dh = class {
|
|
16438
16537
|
constructor(e) {
|
|
16439
16538
|
var t, n, r;
|
|
16440
|
-
this.root = null, this.api = e.api, this.fetcher = new
|
|
16539
|
+
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
16540
|
}
|
|
16442
16541
|
static get toolbox() {
|
|
16443
16542
|
return {
|
|
@@ -16456,7 +16555,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16456
16555
|
return !0;
|
|
16457
16556
|
}
|
|
16458
16557
|
static get pasteConfig() {
|
|
16459
|
-
return { patterns: { bookmark:
|
|
16558
|
+
return { patterns: { bookmark: Eh } };
|
|
16460
16559
|
}
|
|
16461
16560
|
onPaste(e) {
|
|
16462
16561
|
if (e.type !== "pattern") return;
|
|
@@ -16539,36 +16638,36 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16539
16638
|
return this.data.url;
|
|
16540
16639
|
}
|
|
16541
16640
|
}
|
|
16542
|
-
},
|
|
16641
|
+
}, Oh = (e) => {
|
|
16543
16642
|
let t = e.tagName;
|
|
16544
16643
|
return t === "B" || t === "STRONG";
|
|
16545
|
-
},
|
|
16644
|
+
}, 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
16645
|
if (e.tagName === "STRONG") return e;
|
|
16547
16646
|
let t = document.createElement("strong");
|
|
16548
16647
|
for (e.hasAttributes() && Array.from(e.attributes).forEach((e) => {
|
|
16549
16648
|
t.setAttribute(e.name, e.value);
|
|
16550
16649
|
}); e.firstChild;) t.appendChild(e.firstChild);
|
|
16551
16650
|
return e.replaceWith(t), t;
|
|
16552
|
-
},
|
|
16651
|
+
}, Nh = (e) => {
|
|
16553
16652
|
let t = e.nextSibling;
|
|
16554
16653
|
if ((t == null ? void 0 : t.nodeType) === Node.TEXT_NODE) return t;
|
|
16555
16654
|
let n = e.parentNode;
|
|
16556
16655
|
if (!n) return null;
|
|
16557
16656
|
let r = e.ownerDocument.createTextNode("");
|
|
16558
16657
|
return n.insertBefore(r, t), r;
|
|
16559
|
-
},
|
|
16658
|
+
}, Ph = (e) => {
|
|
16560
16659
|
if (!e.boldElement.isConnected) return null;
|
|
16561
|
-
let t =
|
|
16660
|
+
let t = Mh(e.boldElement), n = e.boundary, r = n.isConnected && n.previousSibling === t ? n : Nh(t);
|
|
16562
16661
|
return r ? {
|
|
16563
16662
|
boundary: r,
|
|
16564
16663
|
boldElement: t
|
|
16565
16664
|
} : null;
|
|
16566
|
-
},
|
|
16665
|
+
}, Fh = (e, t) => e ? e === t || t.contains(e) : !1, Ih, $ = {
|
|
16567
16666
|
COLLAPSED_LENGTH: "data-blok-bold-collapsed-length",
|
|
16568
16667
|
COLLAPSED_ACTIVE: "data-blok-bold-collapsed-active",
|
|
16569
16668
|
PREV_LENGTH: "data-blok-bold-prev-length",
|
|
16570
16669
|
LEADING_WHITESPACE: "data-blok-bold-leading-ws"
|
|
16571
|
-
},
|
|
16670
|
+
}, Lh = class e {
|
|
16572
16671
|
constructor() {
|
|
16573
16672
|
this.records = /* @__PURE__ */ new Set();
|
|
16574
16673
|
}
|
|
@@ -16615,8 +16714,8 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16615
16714
|
e.insertBefore(t, i), t.setAttribute($.PREV_LENGTH, "0");
|
|
16616
16715
|
}
|
|
16617
16716
|
exit(e, t) {
|
|
16618
|
-
let n =
|
|
16619
|
-
if (r) return
|
|
16717
|
+
let n = Mh(t), r = n.parentNode;
|
|
16718
|
+
if (r) return Ah(n) ? this.removeEmptyBoldElement(e, n, r) : this.exitBoldWithContent(e, n, r);
|
|
16620
16719
|
}
|
|
16621
16720
|
removeEmptyBoldElement(e, t, n) {
|
|
16622
16721
|
let r = document.createRange();
|
|
@@ -16640,7 +16739,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16640
16739
|
}
|
|
16641
16740
|
maintain() {
|
|
16642
16741
|
if (!(typeof document > "u")) for (let e of Array.from(this.records)) {
|
|
16643
|
-
let t =
|
|
16742
|
+
let t = Ph(e);
|
|
16644
16743
|
if (!t) {
|
|
16645
16744
|
this.records.delete(e);
|
|
16646
16745
|
continue;
|
|
@@ -16690,7 +16789,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16690
16789
|
if (u && !t.hasAttribute($.LEADING_WHITESPACE) && t.setAttribute($.LEADING_WHITESPACE, u[0]), l.length === 0) return;
|
|
16691
16790
|
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
16791
|
for (; t.firstChild;) t.removeChild(t.firstChild);
|
|
16693
|
-
if (t.appendChild(h), !(e != null && e.isCollapsed) || !
|
|
16792
|
+
if (t.appendChild(h), !(e != null && e.isCollapsed) || !Fh(e.focusNode, o)) return;
|
|
16694
16793
|
let g = document.createRange(), _ = h.textContent.length;
|
|
16695
16794
|
g.setStart(h, _), g.collapse(!0), e.removeAllRanges(), e.addRange(g);
|
|
16696
16795
|
});
|
|
@@ -16714,7 +16813,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16714
16813
|
let r = document.createTextNode(n);
|
|
16715
16814
|
(m = t.parentNode) == null || m.insertBefore(r, t.nextSibling);
|
|
16716
16815
|
}
|
|
16717
|
-
if (p && t.removeAttribute($.PREV_LENGTH), e != null && e.isCollapsed && s &&
|
|
16816
|
+
if (p && t.removeAttribute($.PREV_LENGTH), e != null && e.isCollapsed && s && Fh(e.focusNode, t)) {
|
|
16718
16817
|
let t = document.createRange(), n = s.textContent.length;
|
|
16719
16818
|
t.setStart(s, n), t.collapse(!0), e.removeAllRanges(), e.addRange(t);
|
|
16720
16819
|
}
|
|
@@ -16750,7 +16849,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16750
16849
|
if (!e.rangeCount) return;
|
|
16751
16850
|
let t = e.getRangeAt(0);
|
|
16752
16851
|
if (!t.collapsed) return;
|
|
16753
|
-
let n =
|
|
16852
|
+
let n = jh(t.startContainer);
|
|
16754
16853
|
(n == null ? void 0 : n.getAttribute($.COLLAPSED_ACTIVE)) !== "true" && (this.moveCaretFromElementContainer(e, t) || this.moveCaretFromTextContainer(e, t));
|
|
16755
16854
|
}
|
|
16756
16855
|
moveCaretFromElementContainer(e, t) {
|
|
@@ -16781,7 +16880,7 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16781
16880
|
this.setCaret(e, n, i.length);
|
|
16782
16881
|
return;
|
|
16783
16882
|
}
|
|
16784
|
-
let o =
|
|
16883
|
+
let o = jh(n);
|
|
16785
16884
|
if (!o || t.startOffset !== n.textContent.length) return;
|
|
16786
16885
|
let s = this.ensureFollowingTextNode(o, o.nextSibling);
|
|
16787
16886
|
if (s) {
|
|
@@ -16808,18 +16907,18 @@ var oh = "https://telegram.org/js/telegram-widget.js?22", sh = "https://platform
|
|
|
16808
16907
|
return t.tagName === "STRONG" || t.tagName === "B";
|
|
16809
16908
|
}
|
|
16810
16909
|
};
|
|
16811
|
-
|
|
16910
|
+
Ih = Lh, Ih.instance = null;
|
|
16812
16911
|
//#endregion
|
|
16813
16912
|
//#region src/components/inline-tools/services/bold-normalization-pass.ts
|
|
16814
|
-
var
|
|
16913
|
+
var Rh = {
|
|
16815
16914
|
convertLegacyTags: !0,
|
|
16816
16915
|
normalizeWhitespace: !0,
|
|
16817
16916
|
removeEmpty: !0,
|
|
16818
16917
|
mergeAdjacent: !0,
|
|
16819
16918
|
preserveNode: null
|
|
16820
|
-
},
|
|
16919
|
+
}, zh = class e {
|
|
16821
16920
|
constructor(e) {
|
|
16822
|
-
this.options = W(W({},
|
|
16921
|
+
this.options = W(W({}, Rh), e);
|
|
16823
16922
|
}
|
|
16824
16923
|
run(e) {
|
|
16825
16924
|
if (typeof document > "u") return;
|
|
@@ -16854,7 +16953,7 @@ var Oh = {
|
|
|
16854
16953
|
processCollectedElements(e, t) {
|
|
16855
16954
|
this.options.convertLegacyTags && e.forEach((e) => {
|
|
16856
16955
|
if (e.isConnected) {
|
|
16857
|
-
let n =
|
|
16956
|
+
let n = Mh(e);
|
|
16858
16957
|
t.push(n);
|
|
16859
16958
|
}
|
|
16860
16959
|
}), t.forEach((e) => {
|
|
@@ -16872,19 +16971,19 @@ var Oh = {
|
|
|
16872
16971
|
t.includes("\xA0") && (e.textContent = t.replace(/\u00A0/g, " "));
|
|
16873
16972
|
}
|
|
16874
16973
|
isEmptyAndSafe(e) {
|
|
16875
|
-
return e.textContent.length !== 0 ||
|
|
16974
|
+
return e.textContent.length !== 0 || Lh.getInstance().isActivePlaceholder(e) ? !1 : !(this.options.preserveNode && Fh(this.options.preserveNode, e));
|
|
16876
16975
|
}
|
|
16877
16976
|
mergeWithAdjacent(e) {
|
|
16878
16977
|
let t = e.previousSibling;
|
|
16879
|
-
if (t &&
|
|
16978
|
+
if (t && kh(t)) {
|
|
16880
16979
|
this.mergeStrongNodes(t, e);
|
|
16881
16980
|
return;
|
|
16882
16981
|
}
|
|
16883
16982
|
let n = e.nextSibling;
|
|
16884
|
-
n &&
|
|
16983
|
+
n && kh(n) && this.mergeStrongNodes(e, n);
|
|
16885
16984
|
}
|
|
16886
16985
|
mergeStrongNodes(e, t) {
|
|
16887
|
-
let n =
|
|
16986
|
+
let n = Mh(e), r = Mh(t);
|
|
16888
16987
|
for (; r.firstChild;) n.appendChild(r.firstChild);
|
|
16889
16988
|
r.remove();
|
|
16890
16989
|
}
|
|
@@ -16895,7 +16994,7 @@ var Oh = {
|
|
|
16895
16994
|
let i = r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement;
|
|
16896
16995
|
return i ? ((n = i.closest("[data-blok-component=\"paragraph\"]")) == null ? i.closest(S(L.elementContent)) : n) || i.closest(S(L.editor)) : null;
|
|
16897
16996
|
}
|
|
16898
|
-
},
|
|
16997
|
+
}, Bh, Vh = class e {
|
|
16899
16998
|
constructor() {
|
|
16900
16999
|
this.handlers = /* @__PURE__ */ new Map(), this.listenersRegistered = !1, this.handleSelectionChange = () => {
|
|
16901
17000
|
let e = this.getSelection();
|
|
@@ -16952,10 +17051,10 @@ var Oh = {
|
|
|
16952
17051
|
return !(t.meta && !n || t.ctrl && !e.ctrlKey);
|
|
16953
17052
|
}
|
|
16954
17053
|
};
|
|
16955
|
-
|
|
17054
|
+
Bh = Vh, Bh.instance = null;
|
|
16956
17055
|
//#endregion
|
|
16957
17056
|
//#region src/components/inline-tools/utils/formatting-range-utils.ts
|
|
16958
|
-
var
|
|
17057
|
+
var Hh = (e, t) => {
|
|
16959
17058
|
try {
|
|
16960
17059
|
return e.intersectsNode(t);
|
|
16961
17060
|
} catch (n) {
|
|
@@ -16964,22 +17063,22 @@ var Mh = (e, t) => {
|
|
|
16964
17063
|
let i = e.compareBoundaryPoints(Range.END_TO_START, r) > 0, a = e.compareBoundaryPoints(Range.START_TO_END, r) < 0;
|
|
16965
17064
|
return i && a;
|
|
16966
17065
|
}
|
|
16967
|
-
},
|
|
17066
|
+
}, Uh = (e) => {
|
|
16968
17067
|
var t;
|
|
16969
17068
|
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) =>
|
|
16971
|
-
},
|
|
16972
|
-
if (e.collapsed) return
|
|
16973
|
-
let r =
|
|
17069
|
+
return document.createTreeWalker(r, NodeFilter.SHOW_TEXT, { acceptNode: (t) => Hh(e, t) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT });
|
|
17070
|
+
}, 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 = {}) => {
|
|
17071
|
+
if (e.collapsed) return Wh(e.startContainer, t) !== null;
|
|
17072
|
+
let r = Uh(e), i = [];
|
|
16974
17073
|
for (; r.nextNode();) {
|
|
16975
17074
|
let e = r.currentNode, t = e.textContent;
|
|
16976
17075
|
n.ignoreWhitespace && t.trim().length === 0 || t.length !== 0 && i.push(e);
|
|
16977
17076
|
}
|
|
16978
|
-
return i.length === 0 ?
|
|
16979
|
-
},
|
|
17077
|
+
return i.length === 0 ? Wh(e.startContainer, t) !== null : i.every((e) => Gh(e, t));
|
|
17078
|
+
}, qh = (e) => {
|
|
16980
17079
|
let t = e.lastChild;
|
|
16981
|
-
return t === null ? e.nodeType === Node.TEXT_NODE ? e : null :
|
|
16982
|
-
},
|
|
17080
|
+
return t === null ? e.nodeType === Node.TEXT_NODE ? e : null : qh(t);
|
|
17081
|
+
}, Jh = (e) => {
|
|
16983
17082
|
var t;
|
|
16984
17083
|
let n = e.endContainer;
|
|
16985
17084
|
if (n.nodeType === Node.TEXT_NODE) {
|
|
@@ -16990,18 +17089,18 @@ var Mh = (e, t) => {
|
|
|
16990
17089
|
a.length > 0 && a.trim().length === 0 && e.setEnd(n, t.length);
|
|
16991
17090
|
return;
|
|
16992
17091
|
}
|
|
16993
|
-
let i =
|
|
17092
|
+
let i = qh(n);
|
|
16994
17093
|
if (i === null) return;
|
|
16995
17094
|
let a = (t = i.textContent) == null ? "" : t;
|
|
16996
17095
|
a.length !== 0 && /\s+$/.test(a) && e.setEnd(i, a.length);
|
|
16997
|
-
},
|
|
16998
|
-
let n = /* @__PURE__ */ new Set(), r =
|
|
17096
|
+
}, Yh = (e, t) => {
|
|
17097
|
+
let n = /* @__PURE__ */ new Set(), r = Uh(e);
|
|
16999
17098
|
for (; r.nextNode();) {
|
|
17000
|
-
let e =
|
|
17099
|
+
let e = Wh(r.currentNode, t);
|
|
17001
17100
|
e && n.add(e);
|
|
17002
17101
|
}
|
|
17003
17102
|
return Array.from(n);
|
|
17004
|
-
},
|
|
17103
|
+
}, Xh, Zh = class e {
|
|
17005
17104
|
static get sanitize() {
|
|
17006
17105
|
return {
|
|
17007
17106
|
strong: {},
|
|
@@ -17013,7 +17112,7 @@ var Mh = (e, t) => {
|
|
|
17013
17112
|
}
|
|
17014
17113
|
static initializeGlobalListeners() {
|
|
17015
17114
|
if (typeof document > "u") return !1;
|
|
17016
|
-
let t =
|
|
17115
|
+
let t = Vh.getInstance();
|
|
17017
17116
|
return t.hasHandler("bold") ? !0 : (t.register("bold", {
|
|
17018
17117
|
shortcut: {
|
|
17019
17118
|
key: "b",
|
|
@@ -17029,14 +17128,14 @@ var Mh = (e, t) => {
|
|
|
17029
17128
|
onInput: (t, n) => {
|
|
17030
17129
|
e.refreshSelectionState("input");
|
|
17031
17130
|
},
|
|
17032
|
-
onBeforeInput: (e) => e.inputType === "formatBold" ? (
|
|
17131
|
+
onBeforeInput: (e) => e.inputType === "formatBold" ? (zh.normalizeAroundSelection(window.getSelection()), !0) : !1,
|
|
17033
17132
|
isRelevant: (t) => e.isSelectionInsideBlok(t)
|
|
17034
17133
|
}), e.guardKeydownListenerRegistered || (document.addEventListener("keydown", (e) => {
|
|
17035
|
-
|
|
17134
|
+
Lh.getInstance().guardBoundaryKeydown(e);
|
|
17036
17135
|
}, !0), e.guardKeydownListenerRegistered = !0), e.ensureMutationObserver(), !0);
|
|
17037
17136
|
}
|
|
17038
17137
|
static mergeStrongNodes(e, t) {
|
|
17039
|
-
let n =
|
|
17138
|
+
let n = Mh(e), r = Mh(t);
|
|
17040
17139
|
for (; r.firstChild;) n.appendChild(r.firstChild);
|
|
17041
17140
|
return r.remove(), n;
|
|
17042
17141
|
}
|
|
@@ -17069,16 +17168,16 @@ var Mh = (e, t) => {
|
|
|
17069
17168
|
return this.isRangeBold(t, { ignoreWhitespace: !0 });
|
|
17070
17169
|
}
|
|
17071
17170
|
wrapWithBold(e) {
|
|
17072
|
-
|
|
17171
|
+
Jh(e);
|
|
17073
17172
|
let t = this.getRangeHtmlWithoutBold(e), n = this.replaceRangeWithHtml(e, `<strong>${t}</strong>`), r = window.getSelection();
|
|
17074
17173
|
r && n && (r.removeAllRanges(), r.addRange(n));
|
|
17075
17174
|
let i = this.findBoldElementFromRangeOrSelection(n, r);
|
|
17076
17175
|
if (!i) {
|
|
17077
|
-
|
|
17176
|
+
zh.normalizeAroundSelection(r), this.notifySelectionChange();
|
|
17078
17177
|
return;
|
|
17079
17178
|
}
|
|
17080
17179
|
let a = this.mergeAdjacentBold(i);
|
|
17081
|
-
this.selectElementContents(a),
|
|
17180
|
+
this.selectElementContents(a), zh.normalizeAroundSelection(r), this.notifySelectionChange();
|
|
17082
17181
|
}
|
|
17083
17182
|
unwrapBoldTags(t) {
|
|
17084
17183
|
let n = this.collectBoldAncestors(t), r = window.getSelection();
|
|
@@ -17087,7 +17186,7 @@ var Mh = (e, t) => {
|
|
|
17087
17186
|
i.setAttribute("data-blok-bold-marker", `unwrap-${e.markerSequence++}`), i.appendChild(a), this.removeNestedBold(i), t.insertNode(i);
|
|
17088
17187
|
let o = document.createRange();
|
|
17089
17188
|
for (o.selectNodeContents(i), r.removeAllRanges(), r.addRange(o);;) {
|
|
17090
|
-
let e =
|
|
17189
|
+
let e = jh(i);
|
|
17091
17190
|
if (!e) break;
|
|
17092
17191
|
this.moveMarkerOutOfBold(i, e);
|
|
17093
17192
|
}
|
|
@@ -17095,8 +17194,8 @@ var Mh = (e, t) => {
|
|
|
17095
17194
|
this.unwrapElement(i), s && c && (() => {
|
|
17096
17195
|
let e = document.createRange();
|
|
17097
17196
|
return e.setStartBefore(s), e.setEndAfter(c), r.removeAllRanges(), r.addRange(e), e;
|
|
17098
|
-
})() || r.removeAllRanges(),
|
|
17099
|
-
e.isConnected && (
|
|
17197
|
+
})() || r.removeAllRanges(), zh.normalizeAroundSelection(r), n.forEach((e) => {
|
|
17198
|
+
e.isConnected && (Ah(e) ? e.remove() : e.textContent.trim().length === 0 && this.unwrapElement(e));
|
|
17100
17199
|
}), this.notifySelectionChange();
|
|
17101
17200
|
}
|
|
17102
17201
|
replaceRangeWithHtml(t, n) {
|
|
@@ -17136,7 +17235,7 @@ var Mh = (e, t) => {
|
|
|
17136
17235
|
n.selectNodeContents(e), t.removeAllRanges(), t.addRange(n);
|
|
17137
17236
|
}
|
|
17138
17237
|
isRangeBold(e, t) {
|
|
17139
|
-
return
|
|
17238
|
+
return Kh(e, Oh, t);
|
|
17140
17239
|
}
|
|
17141
17240
|
removeNestedBold(e) {
|
|
17142
17241
|
e.querySelectorAll("b,strong").forEach((e) => {
|
|
@@ -17153,28 +17252,28 @@ var Mh = (e, t) => {
|
|
|
17153
17252
|
t.removeChild(e);
|
|
17154
17253
|
}
|
|
17155
17254
|
findBoldElementFromRangeOrSelection(e, t) {
|
|
17156
|
-
return e ?
|
|
17255
|
+
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
17256
|
}
|
|
17158
17257
|
mergeAdjacentBold(t) {
|
|
17159
|
-
let n =
|
|
17160
|
-
return a && a.nodeType === Node.ELEMENT_NODE &&
|
|
17258
|
+
let n = Mh(t), r = n.previousSibling, i = r && r.nodeType === Node.ELEMENT_NODE && Oh(r) ? e.mergeStrongNodes(r, n) : n, a = i.nextSibling;
|
|
17259
|
+
return a && a.nodeType === Node.ELEMENT_NODE && Oh(a) ? e.mergeStrongNodes(i, a) : i;
|
|
17161
17260
|
}
|
|
17162
17261
|
toggleCollapsedSelection() {
|
|
17163
17262
|
let t = window.getSelection();
|
|
17164
17263
|
if (!t || t.rangeCount === 0) return;
|
|
17165
|
-
let n = t.getRangeAt(0), r =
|
|
17166
|
-
if (r && r.getAttribute(
|
|
17264
|
+
let n = t.getRangeAt(0), r = jh(n.startContainer), i = (() => {
|
|
17265
|
+
if (r && r.getAttribute(Lh.ATTR.COLLAPSED_ACTIVE) !== "true") return Lh.getInstance().exit(t, r);
|
|
17167
17266
|
let i = r == null ? e.getBoundaryBold(n) : r;
|
|
17168
|
-
return i ?
|
|
17267
|
+
return i ? Lh.getInstance().exit(t, i) : this.startCollapsedBold(n);
|
|
17169
17268
|
})();
|
|
17170
|
-
document.dispatchEvent(new Event("selectionchange")), i && (t.removeAllRanges(), t.addRange(i)),
|
|
17269
|
+
document.dispatchEvent(new Event("selectionchange")), i && (t.removeAllRanges(), t.addRange(i)), zh.normalizeAroundSelection(t), this.notifySelectionChange();
|
|
17171
17270
|
}
|
|
17172
17271
|
startCollapsedBold(e) {
|
|
17173
|
-
let t =
|
|
17174
|
-
return
|
|
17272
|
+
let t = Lh.getInstance().enter(e, (e) => this.mergeAdjacentBold(e)), n = window.getSelection();
|
|
17273
|
+
return zh.normalizeAroundSelection(n), n && t && (n.removeAllRanges(), n.addRange(t)), this.notifySelectionChange(), t;
|
|
17175
17274
|
}
|
|
17176
17275
|
notifySelectionChange() {
|
|
17177
|
-
|
|
17276
|
+
Lh.getInstance().enforceLengths(window.getSelection()), document.dispatchEvent(new Event("selectionchange")), this.updateToolbarButtonState();
|
|
17178
17277
|
}
|
|
17179
17278
|
updateToolbarButtonState() {
|
|
17180
17279
|
let e = window.getSelection();
|
|
@@ -17188,7 +17287,7 @@ var Mh = (e, t) => {
|
|
|
17188
17287
|
}
|
|
17189
17288
|
static refreshSelectionState(e) {
|
|
17190
17289
|
let t = window.getSelection();
|
|
17191
|
-
|
|
17290
|
+
Lh.getInstance().enforceLengths(t), Lh.getInstance().maintain(), Lh.getInstance().synchronize(t), zh.normalizeAroundSelection(t, { normalizeWhitespace: !1 }), e === "input" && t && Lh.getInstance().moveCaretAfterBoundaryBold(t);
|
|
17192
17291
|
}
|
|
17193
17292
|
static ensureMutationObserver() {
|
|
17194
17293
|
if (typeof MutationObserver > "u" || e.mutationObserver) return;
|
|
@@ -17197,7 +17296,7 @@ var Mh = (e, t) => {
|
|
|
17197
17296
|
e.isProcessingMutation = !0;
|
|
17198
17297
|
try {
|
|
17199
17298
|
let n = (e) => {
|
|
17200
|
-
e && new
|
|
17299
|
+
e && new zh({
|
|
17201
17300
|
mergeAdjacent: !1,
|
|
17202
17301
|
removeEmpty: !1,
|
|
17203
17302
|
normalizeWhitespace: !1
|
|
@@ -17229,15 +17328,15 @@ var Mh = (e, t) => {
|
|
|
17229
17328
|
}
|
|
17230
17329
|
static getBoundaryBoldForText(e, t) {
|
|
17231
17330
|
let n = t.textContent.length;
|
|
17232
|
-
if (e.startOffset === n) return
|
|
17331
|
+
if (e.startOffset === n) return jh(t);
|
|
17233
17332
|
if (e.startOffset !== 0) return null;
|
|
17234
17333
|
let r = t.previousSibling;
|
|
17235
|
-
return
|
|
17334
|
+
return kh(r) ? r : null;
|
|
17236
17335
|
}
|
|
17237
17336
|
static getBoundaryBoldForElement(e, t) {
|
|
17238
17337
|
if (e.startOffset <= 0) return null;
|
|
17239
17338
|
let n = t.childNodes[e.startOffset - 1];
|
|
17240
|
-
return
|
|
17339
|
+
return kh(n) ? n : null;
|
|
17241
17340
|
}
|
|
17242
17341
|
static isSelectionInsideBlok(e) {
|
|
17243
17342
|
let t = e.anchorNode;
|
|
@@ -17256,16 +17355,16 @@ var Mh = (e, t) => {
|
|
|
17256
17355
|
return t.innerHTML = e, t.content;
|
|
17257
17356
|
}
|
|
17258
17357
|
collectBoldAncestors(e) {
|
|
17259
|
-
return
|
|
17358
|
+
return Yh(e, Oh);
|
|
17260
17359
|
}
|
|
17261
17360
|
};
|
|
17262
|
-
|
|
17361
|
+
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
17362
|
//#endregion
|
|
17264
17363
|
//#region src/components/inline-tools/inline-tool-italic.ts
|
|
17265
|
-
var
|
|
17364
|
+
var Qh, $h = (e) => {
|
|
17266
17365
|
let t = e.tagName;
|
|
17267
17366
|
return t === "I" || t === "EM";
|
|
17268
|
-
},
|
|
17367
|
+
}, eg = class {
|
|
17269
17368
|
static get sanitize() {
|
|
17270
17369
|
return {
|
|
17271
17370
|
i: {},
|
|
@@ -17314,10 +17413,10 @@ var Hh, Uh = (e) => {
|
|
|
17314
17413
|
return this.isRangeItalic(t, { ignoreWhitespace: !0 });
|
|
17315
17414
|
}
|
|
17316
17415
|
isRangeItalic(e, t) {
|
|
17317
|
-
return
|
|
17416
|
+
return Kh(e, $h, t);
|
|
17318
17417
|
}
|
|
17319
17418
|
wrapWithItalic(e) {
|
|
17320
|
-
|
|
17419
|
+
Jh(e);
|
|
17321
17420
|
let t = this.getRangeHtmlWithoutItalic(e), n = this.replaceRangeWithHtml(e, `<i>${t}</i>`), r = window.getSelection();
|
|
17322
17421
|
if (r && n) {
|
|
17323
17422
|
let e = n.startContainer.childNodes[n.startOffset], t = document.createRange();
|
|
@@ -17353,13 +17452,13 @@ var Hh, Uh = (e) => {
|
|
|
17353
17452
|
});
|
|
17354
17453
|
}
|
|
17355
17454
|
hasItalicParent(e) {
|
|
17356
|
-
return
|
|
17455
|
+
return Gh(e, $h);
|
|
17357
17456
|
}
|
|
17358
17457
|
findItalicElement(e) {
|
|
17359
|
-
return
|
|
17458
|
+
return Wh(e, $h);
|
|
17360
17459
|
}
|
|
17361
17460
|
collectItalicAncestors(e) {
|
|
17362
|
-
return
|
|
17461
|
+
return Yh(e, $h);
|
|
17363
17462
|
}
|
|
17364
17463
|
getRangeHtmlWithoutItalic(e) {
|
|
17365
17464
|
let t = e.cloneContents();
|
|
@@ -17416,10 +17515,10 @@ var Hh, Uh = (e) => {
|
|
|
17416
17515
|
n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
|
|
17417
17516
|
}
|
|
17418
17517
|
};
|
|
17419
|
-
|
|
17518
|
+
Qh = eg, Qh.isInline = !0, Qh.title = "Italic", Qh.titleKey = "italic", Qh.shortcut = "CMD+I";
|
|
17420
17519
|
//#endregion
|
|
17421
17520
|
//#region src/components/inline-tools/inline-tool-link.ts
|
|
17422
|
-
var
|
|
17521
|
+
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
17522
|
static get sanitize() {
|
|
17424
17523
|
return { a: {
|
|
17425
17524
|
href: !0,
|
|
@@ -17479,7 +17578,7 @@ var Gh, Kh = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md tex
|
|
|
17479
17578
|
let t = document.createElement("div");
|
|
17480
17579
|
t.className = "mt-1 mb-0.5 h-px bg-link-input-border";
|
|
17481
17580
|
let n = document.createElement("button");
|
|
17482
|
-
n.type = "button", n.className =
|
|
17581
|
+
n.type = "button", n.className = ng, n.setAttribute("data-link-suggestion-row", "");
|
|
17483
17582
|
let r = document.createElement("span");
|
|
17484
17583
|
r.className = "text-gray-text shrink-0 flex [&>svg]:size-7", r.setAttribute("data-link-suggestion-icon", "");
|
|
17485
17584
|
let i = document.createElement("span");
|
|
@@ -17497,7 +17596,7 @@ var Gh, Kh = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md tex
|
|
|
17497
17596
|
return;
|
|
17498
17597
|
}
|
|
17499
17598
|
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 ?
|
|
17599
|
+
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
17600
|
}
|
|
17502
17601
|
isLinkComplete(e) {
|
|
17503
17602
|
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 +17725,13 @@ var Gh, Kh = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md tex
|
|
|
17626
17725
|
e && e.setAttribute(t, n ? "true" : "false");
|
|
17627
17726
|
}
|
|
17628
17727
|
};
|
|
17629
|
-
|
|
17728
|
+
tg = ig, tg.isInline = !0, tg.title = "Link", tg.titleKey = "link", tg.shortcut = "CMD+K";
|
|
17630
17729
|
//#endregion
|
|
17631
17730
|
//#region src/components/inline-tools/utils/marker-dom-utils.ts
|
|
17632
|
-
var
|
|
17731
|
+
var ag = (e) => e.tagName === "MARK", og = (e) => Wh(e, ag), sg, cg = {
|
|
17633
17732
|
color: "background-color",
|
|
17634
17733
|
"background-color": "color"
|
|
17635
|
-
},
|
|
17734
|
+
}, lg = class e {
|
|
17636
17735
|
static get sanitize() {
|
|
17637
17736
|
return { mark: (t) => {
|
|
17638
17737
|
let n = t.style, r = Array.from({ length: n.length }, (e, t) => n.item(t));
|
|
@@ -17666,7 +17765,7 @@ var Yh = (e) => e.tagName === "MARK", Xh = (e) => Ph(e, Yh), Zh, Qh = {
|
|
|
17666
17765
|
isActive: () => {
|
|
17667
17766
|
let e = window.getSelection();
|
|
17668
17767
|
if (!e || e.rangeCount === 0) return !1;
|
|
17669
|
-
let t = e.getRangeAt(0), n =
|
|
17768
|
+
let t = e.getRangeAt(0), n = Kh(t, ag, { ignoreWhitespace: !0 });
|
|
17670
17769
|
if (n) {
|
|
17671
17770
|
let e = this.detectBothSelectionColors(t);
|
|
17672
17771
|
this.updateToolbarColors(e.text, e.bg);
|
|
@@ -17717,10 +17816,10 @@ var Yh = (e) => e.tagName === "MARK", Xh = (e) => Ph(e, Yh), Zh, Qh = {
|
|
|
17717
17816
|
if (!r || r.rangeCount === 0) return;
|
|
17718
17817
|
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
17818
|
this.splitMarksAtBoundaries(i);
|
|
17720
|
-
let p =
|
|
17819
|
+
let p = Yh(i, ag);
|
|
17721
17820
|
for (let t of p) {
|
|
17722
17821
|
t.style.removeProperty(e);
|
|
17723
|
-
let n =
|
|
17822
|
+
let n = cg[e], r = t.style.getPropertyValue(n);
|
|
17724
17823
|
r !== "" && r !== "transparent" ? this.ensureTransparentBg(t) : this.unwrapElement(t);
|
|
17725
17824
|
}
|
|
17726
17825
|
let m = a.isConnected, h = s.isConnected;
|
|
@@ -17748,7 +17847,7 @@ var Yh = (e) => e.tagName === "MARK", Xh = (e) => Ph(e, Yh), Zh, Qh = {
|
|
|
17748
17847
|
this.selection.removeFakeBackground(), this.selection.savedSelectionRange && this.selection.restore(), this.selection.clearSaved();
|
|
17749
17848
|
}
|
|
17750
17849
|
detectBothSelectionColors(e) {
|
|
17751
|
-
let t =
|
|
17850
|
+
let t = og(e.startContainer);
|
|
17752
17851
|
if (!t) return {
|
|
17753
17852
|
text: null,
|
|
17754
17853
|
bg: null
|
|
@@ -17768,7 +17867,7 @@ var Yh = (e) => e.tagName === "MARK", Xh = (e) => Ph(e, Yh), Zh, Qh = {
|
|
|
17768
17867
|
text: null,
|
|
17769
17868
|
bg: null
|
|
17770
17869
|
};
|
|
17771
|
-
let t =
|
|
17870
|
+
let t = og(e.getRangeAt(0).startContainer);
|
|
17772
17871
|
if (!t) return {
|
|
17773
17872
|
text: null,
|
|
17774
17873
|
bg: null
|
|
@@ -17788,14 +17887,14 @@ var Yh = (e) => e.tagName === "MARK", Xh = (e) => Ph(e, Yh), Zh, Qh = {
|
|
|
17788
17887
|
this.selection.savedSelectionRange && (this.selection.removeFakeBackground(), this.selection.restore(), this.selection.clearSaved());
|
|
17789
17888
|
}
|
|
17790
17889
|
findContainingMark(e) {
|
|
17791
|
-
let t =
|
|
17890
|
+
let t = og(e.startContainer), n = og(e.endContainer);
|
|
17792
17891
|
return t && t === n ? t : null;
|
|
17793
17892
|
}
|
|
17794
17893
|
removeNestedMarkStyle(e, t) {
|
|
17795
|
-
let n =
|
|
17894
|
+
let n = Yh(e, ag);
|
|
17796
17895
|
for (let e of n) {
|
|
17797
17896
|
e.style.removeProperty(t);
|
|
17798
|
-
let n =
|
|
17897
|
+
let n = cg[t], r = e.style.getPropertyValue(n);
|
|
17799
17898
|
r !== "" && r !== "transparent" ? this.ensureTransparentBg(e) : this.unwrapElement(e);
|
|
17800
17899
|
}
|
|
17801
17900
|
}
|
|
@@ -17826,7 +17925,7 @@ var Yh = (e) => e.tagName === "MARK", Xh = (e) => Ph(e, Yh), Zh, Qh = {
|
|
|
17826
17925
|
}
|
|
17827
17926
|
}
|
|
17828
17927
|
splitMarksAtBoundaries(e) {
|
|
17829
|
-
let t =
|
|
17928
|
+
let t = Yh(e, ag);
|
|
17830
17929
|
for (let n of t) {
|
|
17831
17930
|
let t = document.createRange();
|
|
17832
17931
|
t.selectNodeContents(n);
|
|
@@ -17895,10 +17994,10 @@ var Yh = (e) => e.tagName === "MARK", Xh = (e) => Ph(e, Yh), Zh, Qh = {
|
|
|
17895
17994
|
return r === null ? e : st(r, n);
|
|
17896
17995
|
}
|
|
17897
17996
|
};
|
|
17898
|
-
|
|
17997
|
+
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
17998
|
//#endregion
|
|
17900
17999
|
//#region src/components/inline-tools/inline-tool-underline.ts
|
|
17901
|
-
var
|
|
18000
|
+
var ug, dg = (e) => e.tagName === "U", fg = class {
|
|
17902
18001
|
static get sanitize() {
|
|
17903
18002
|
return { u: {} };
|
|
17904
18003
|
}
|
|
@@ -17944,10 +18043,10 @@ var eg, tg = (e) => e.tagName === "U", ng = class {
|
|
|
17944
18043
|
return this.isRangeUnderline(t, { ignoreWhitespace: !0 });
|
|
17945
18044
|
}
|
|
17946
18045
|
isRangeUnderline(e, t) {
|
|
17947
|
-
return
|
|
18046
|
+
return Kh(e, dg, t);
|
|
17948
18047
|
}
|
|
17949
18048
|
wrapWithUnderline(e) {
|
|
17950
|
-
|
|
18049
|
+
Jh(e);
|
|
17951
18050
|
let t = this.getRangeHtmlWithoutUnderline(e), n = this.replaceRangeWithHtml(e, `<u>${t}</u>`), r = window.getSelection();
|
|
17952
18051
|
if (r && n) {
|
|
17953
18052
|
let e = n.startContainer.childNodes[n.startOffset], t = document.createRange();
|
|
@@ -17983,13 +18082,13 @@ var eg, tg = (e) => e.tagName === "U", ng = class {
|
|
|
17983
18082
|
});
|
|
17984
18083
|
}
|
|
17985
18084
|
hasUnderlineParent(e) {
|
|
17986
|
-
return
|
|
18085
|
+
return Gh(e, dg);
|
|
17987
18086
|
}
|
|
17988
18087
|
findUnderlineElement(e) {
|
|
17989
|
-
return
|
|
18088
|
+
return Wh(e, dg);
|
|
17990
18089
|
}
|
|
17991
18090
|
collectUnderlineAncestors(e) {
|
|
17992
|
-
return
|
|
18091
|
+
return Yh(e, dg);
|
|
17993
18092
|
}
|
|
17994
18093
|
getRangeHtmlWithoutUnderline(e) {
|
|
17995
18094
|
let t = e.cloneContents();
|
|
@@ -18046,10 +18145,10 @@ var eg, tg = (e) => e.tagName === "U", ng = class {
|
|
|
18046
18145
|
n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
|
|
18047
18146
|
}
|
|
18048
18147
|
};
|
|
18049
|
-
|
|
18148
|
+
ug = fg, ug.isInline = !0, ug.title = "Underline", ug.titleKey = "underline", ug.shortcut = "CMD+U";
|
|
18050
18149
|
//#endregion
|
|
18051
18150
|
//#region src/components/inline-tools/inline-tool-strikethrough.ts
|
|
18052
|
-
var
|
|
18151
|
+
var pg, mg = (e) => e.tagName === "S", hg = class {
|
|
18053
18152
|
static get sanitize() {
|
|
18054
18153
|
return { s: {} };
|
|
18055
18154
|
}
|
|
@@ -18095,10 +18194,10 @@ var rg, ig = (e) => e.tagName === "S", ag = class {
|
|
|
18095
18194
|
return this.isRangeStrikethrough(t, { ignoreWhitespace: !0 });
|
|
18096
18195
|
}
|
|
18097
18196
|
isRangeStrikethrough(e, t) {
|
|
18098
|
-
return
|
|
18197
|
+
return Kh(e, mg, t);
|
|
18099
18198
|
}
|
|
18100
18199
|
wrapWithStrikethrough(e) {
|
|
18101
|
-
|
|
18200
|
+
Jh(e);
|
|
18102
18201
|
let t = this.getRangeHtmlWithoutStrikethrough(e), n = this.replaceRangeWithHtml(e, `<s>${t}</s>`), r = window.getSelection();
|
|
18103
18202
|
if (r && n) {
|
|
18104
18203
|
let e = n.startContainer.childNodes[n.startOffset], t = document.createRange();
|
|
@@ -18134,13 +18233,13 @@ var rg, ig = (e) => e.tagName === "S", ag = class {
|
|
|
18134
18233
|
});
|
|
18135
18234
|
}
|
|
18136
18235
|
hasStrikethroughParent(e) {
|
|
18137
|
-
return
|
|
18236
|
+
return Gh(e, mg);
|
|
18138
18237
|
}
|
|
18139
18238
|
findStrikethroughElement(e) {
|
|
18140
|
-
return
|
|
18239
|
+
return Wh(e, mg);
|
|
18141
18240
|
}
|
|
18142
18241
|
collectStrikethroughAncestors(e) {
|
|
18143
|
-
return
|
|
18242
|
+
return Yh(e, mg);
|
|
18144
18243
|
}
|
|
18145
18244
|
getRangeHtmlWithoutStrikethrough(e) {
|
|
18146
18245
|
let t = e.cloneContents();
|
|
@@ -18197,10 +18296,10 @@ var rg, ig = (e) => e.tagName === "S", ag = class {
|
|
|
18197
18296
|
n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
|
|
18198
18297
|
}
|
|
18199
18298
|
};
|
|
18200
|
-
|
|
18299
|
+
pg = hg, pg.isInline = !0, pg.title = "Strikethrough", pg.titleKey = "strikethrough", pg.shortcut = "CMD+SHIFT+S";
|
|
18201
18300
|
//#endregion
|
|
18202
18301
|
//#region src/components/inline-tools/inline-tool-code.ts
|
|
18203
|
-
var
|
|
18302
|
+
var gg, _g = (e) => e.tagName === "CODE", vg = class {
|
|
18204
18303
|
static get sanitize() {
|
|
18205
18304
|
return { code: {} };
|
|
18206
18305
|
}
|
|
@@ -18246,10 +18345,10 @@ var og, sg = (e) => e.tagName === "CODE", cg = class {
|
|
|
18246
18345
|
return this.isRangeCode(t, { ignoreWhitespace: !0 });
|
|
18247
18346
|
}
|
|
18248
18347
|
isRangeCode(e, t) {
|
|
18249
|
-
return
|
|
18348
|
+
return Kh(e, _g, t);
|
|
18250
18349
|
}
|
|
18251
18350
|
wrapWithCode(e) {
|
|
18252
|
-
|
|
18351
|
+
Jh(e);
|
|
18253
18352
|
let t = this.getRangeHtmlWithoutCode(e), n = this.replaceRangeWithHtml(e, `<code>${t}</code>`), r = window.getSelection();
|
|
18254
18353
|
if (r && n) {
|
|
18255
18354
|
let e = n.startContainer.childNodes[n.startOffset], t = document.createRange();
|
|
@@ -18285,10 +18384,10 @@ var og, sg = (e) => e.tagName === "CODE", cg = class {
|
|
|
18285
18384
|
});
|
|
18286
18385
|
}
|
|
18287
18386
|
findCodeElement(e) {
|
|
18288
|
-
return
|
|
18387
|
+
return Wh(e, _g);
|
|
18289
18388
|
}
|
|
18290
18389
|
collectCodeAncestors(e) {
|
|
18291
|
-
return
|
|
18390
|
+
return Yh(e, _g);
|
|
18292
18391
|
}
|
|
18293
18392
|
getRangeHtmlWithoutCode(e) {
|
|
18294
18393
|
let t = e.cloneContents();
|
|
@@ -18345,10 +18444,10 @@ var og, sg = (e) => e.tagName === "CODE", cg = class {
|
|
|
18345
18444
|
n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
|
|
18346
18445
|
}
|
|
18347
18446
|
};
|
|
18348
|
-
|
|
18447
|
+
gg = vg, gg.isInline = !0, gg.title = "Code", gg.titleKey = "inlineCode", gg.shortcut = "CMD+E";
|
|
18349
18448
|
//#endregion
|
|
18350
18449
|
//#region src/tools/index.ts
|
|
18351
|
-
var
|
|
18450
|
+
var yg = {
|
|
18352
18451
|
paragraph: { preserveBlank: !0 },
|
|
18353
18452
|
header: {},
|
|
18354
18453
|
list: {},
|
|
@@ -18368,7 +18467,7 @@ var lg = {
|
|
|
18368
18467
|
column: {},
|
|
18369
18468
|
embed: {},
|
|
18370
18469
|
bookmark: {}
|
|
18371
|
-
},
|
|
18470
|
+
}, bg = {
|
|
18372
18471
|
bold: {},
|
|
18373
18472
|
italic: {},
|
|
18374
18473
|
link: {},
|
|
@@ -18378,4 +18477,4 @@ var lg = {
|
|
|
18378
18477
|
inlineCode: {}
|
|
18379
18478
|
};
|
|
18380
18479
|
//#endregion
|
|
18381
|
-
export { gc as C, Di as D, Ho as E, cr as O, _c as S, qo as T, nm as _,
|
|
18480
|
+
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 };
|