@sobree/core 0.1.35 → 0.1.36
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/editor/view/docRenderer/sectionFlow.d.ts +24 -1
- package/dist/index.js +487 -474
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1405,7 +1405,7 @@ function Bc(e, t = [], n = {}) {
|
|
|
1405
1405
|
const r = Math.max(1, Math.min(6, e));
|
|
1406
1406
|
return wt(t, { ...n, styleId: `Heading${r}` });
|
|
1407
1407
|
}
|
|
1408
|
-
function
|
|
1408
|
+
function ob(e) {
|
|
1409
1409
|
return { kind: "section_break", toSectionIndex: e };
|
|
1410
1410
|
}
|
|
1411
1411
|
const Lc = 11906, Mc = 16838, Bt = 1440, ir = Bt / 2, Oc = 240, sr = 11;
|
|
@@ -1492,40 +1492,40 @@ function xn() {
|
|
|
1492
1492
|
function je(e, t) {
|
|
1493
1493
|
return e.body.push(t), e;
|
|
1494
1494
|
}
|
|
1495
|
-
function
|
|
1495
|
+
function ib(e, t) {
|
|
1496
1496
|
return { type: e, partId: t };
|
|
1497
1497
|
}
|
|
1498
|
-
function
|
|
1498
|
+
function sb(e) {
|
|
1499
1499
|
return e.kind === "paragraph";
|
|
1500
1500
|
}
|
|
1501
|
-
function
|
|
1501
|
+
function ab(e) {
|
|
1502
1502
|
return e.kind === "table";
|
|
1503
1503
|
}
|
|
1504
1504
|
function ve(e, t = {}) {
|
|
1505
1505
|
return { kind: "text", text: e, properties: t };
|
|
1506
1506
|
}
|
|
1507
|
-
function
|
|
1507
|
+
function cb(e, t = {}) {
|
|
1508
1508
|
return { kind: "text", text: e, properties: { ...t, italic: !0 } };
|
|
1509
1509
|
}
|
|
1510
|
-
function
|
|
1510
|
+
function lb(e, t = {}) {
|
|
1511
1511
|
return { kind: "text", text: e, properties: { ...t, bold: !0 } };
|
|
1512
1512
|
}
|
|
1513
|
-
function
|
|
1513
|
+
function ub() {
|
|
1514
1514
|
return { kind: "break", type: "line" };
|
|
1515
1515
|
}
|
|
1516
|
-
function
|
|
1516
|
+
function fb() {
|
|
1517
1517
|
return { kind: "break", type: "page" };
|
|
1518
1518
|
}
|
|
1519
|
-
function
|
|
1519
|
+
function db() {
|
|
1520
1520
|
return { kind: "break", type: "column" };
|
|
1521
1521
|
}
|
|
1522
|
-
function
|
|
1522
|
+
function hb(e = {}) {
|
|
1523
1523
|
return { kind: "tab", properties: e };
|
|
1524
1524
|
}
|
|
1525
|
-
function
|
|
1525
|
+
function pb(e, t, n = {}) {
|
|
1526
1526
|
return { kind: "hyperlink", href: e, children: t, properties: n };
|
|
1527
1527
|
}
|
|
1528
|
-
function
|
|
1528
|
+
function gb(e, t, n = {}) {
|
|
1529
1529
|
return {
|
|
1530
1530
|
kind: "field",
|
|
1531
1531
|
instruction: e,
|
|
@@ -1533,7 +1533,7 @@ function hb(e, t, n = {}) {
|
|
|
1533
1533
|
properties: n
|
|
1534
1534
|
};
|
|
1535
1535
|
}
|
|
1536
|
-
function
|
|
1536
|
+
function mb(e, t) {
|
|
1537
1537
|
return {
|
|
1538
1538
|
kind: "drawing",
|
|
1539
1539
|
partPath: e,
|
|
@@ -1544,20 +1544,20 @@ function pb(e, t) {
|
|
|
1544
1544
|
...t.verticalAlign !== void 0 ? { verticalAlign: t.verticalAlign } : {}
|
|
1545
1545
|
};
|
|
1546
1546
|
}
|
|
1547
|
-
function
|
|
1547
|
+
function bb(e, t = {}) {
|
|
1548
1548
|
return { kind: "footnoteRef", id: e, properties: t };
|
|
1549
1549
|
}
|
|
1550
|
-
function
|
|
1550
|
+
function yb(e, t = {}) {
|
|
1551
1551
|
return { kind: "commentRef", id: e, properties: t };
|
|
1552
1552
|
}
|
|
1553
1553
|
const _c = 9360;
|
|
1554
|
-
function
|
|
1554
|
+
function wb(e = [wt()], t = {}) {
|
|
1555
1555
|
return { ...t, content: e };
|
|
1556
1556
|
}
|
|
1557
|
-
function
|
|
1557
|
+
function kb(e, t = {}) {
|
|
1558
1558
|
return { cells: e, ...t.isHeader ? { isHeader: !0 } : {} };
|
|
1559
1559
|
}
|
|
1560
|
-
function
|
|
1560
|
+
function vb(e, t = {}) {
|
|
1561
1561
|
return { kind: "table", grid: t.grid ?? jc(zc(e)), rows: e, properties: t.properties ?? {} };
|
|
1562
1562
|
}
|
|
1563
1563
|
function zc(e) {
|
|
@@ -1573,7 +1573,7 @@ function jc(e) {
|
|
|
1573
1573
|
const t = Math.floor(_c / e);
|
|
1574
1574
|
return Array.from({ length: e }, () => t);
|
|
1575
1575
|
}
|
|
1576
|
-
function
|
|
1576
|
+
function xb(e, t = {}) {
|
|
1577
1577
|
return {
|
|
1578
1578
|
id: e,
|
|
1579
1579
|
type: t.type ?? "paragraph",
|
|
@@ -1603,7 +1603,7 @@ function Po(e, t) {
|
|
|
1603
1603
|
function Io(e) {
|
|
1604
1604
|
return { leftTwips: (e + 1) * Uc, hangingTwips: Wc };
|
|
1605
1605
|
}
|
|
1606
|
-
function
|
|
1606
|
+
function Sb(e, t = 3) {
|
|
1607
1607
|
const n = ["•", "◦", "▪"];
|
|
1608
1608
|
return Po(
|
|
1609
1609
|
e,
|
|
@@ -1615,7 +1615,7 @@ function vb(e, t = 3) {
|
|
|
1615
1615
|
)
|
|
1616
1616
|
);
|
|
1617
1617
|
}
|
|
1618
|
-
function
|
|
1618
|
+
function Eb(e, t = 3) {
|
|
1619
1619
|
return Po(
|
|
1620
1620
|
e,
|
|
1621
1621
|
Array.from(
|
|
@@ -4556,7 +4556,7 @@ const sf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4556
4556
|
isBlobHash: ci,
|
|
4557
4557
|
sha256Hex: Nn
|
|
4558
4558
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4559
|
-
function
|
|
4559
|
+
function Tb() {
|
|
4560
4560
|
const e = /* @__PURE__ */ new Map();
|
|
4561
4561
|
return {
|
|
4562
4562
|
async put(t) {
|
|
@@ -4575,7 +4575,7 @@ function Sb() {
|
|
|
4575
4575
|
}
|
|
4576
4576
|
};
|
|
4577
4577
|
}
|
|
4578
|
-
function
|
|
4578
|
+
function Ab(e) {
|
|
4579
4579
|
const t = e.baseUrl.replace(/\/+$/, ""), n = e.fetch ?? globalThis.fetch;
|
|
4580
4580
|
if (!n)
|
|
4581
4581
|
throw new Error("fetchBlobStore: no global `fetch` available. Pass one via opts.fetch.");
|
|
@@ -6696,32 +6696,39 @@ function qd(e, t) {
|
|
|
6696
6696
|
}
|
|
6697
6697
|
r !== void 0 && !e.style.fontSize && (e.style.fontSize = `${r}pt`);
|
|
6698
6698
|
}
|
|
6699
|
-
function Dr(e, t, n = 0) {
|
|
6700
|
-
const
|
|
6701
|
-
if (!
|
|
6702
|
-
const
|
|
6703
|
-
return
|
|
6699
|
+
function Dr(e, t, n = 0, r) {
|
|
6700
|
+
const o = t == null ? void 0 : t.columns;
|
|
6701
|
+
if (!o || o.count <= 1) return e;
|
|
6702
|
+
const i = document.createElement("div");
|
|
6703
|
+
return i.dataset.colCount = String(o.count), i.dataset.pagCid = `cols-${n}`, Kd(r) && (i.dataset.colFill = "1"), Jd(t) && (i.dataset.colPageStart = "1"), o.equalWidth === !1 && o.columns && o.columns.length === o.count ? (i.className = "sobree-cols sobree-cols-unequal", i.dataset.colWidthsMm = o.columns.map((s) => O(s.widthTwips)).join(","), i.dataset.colGapsMm = o.columns.slice(0, -1).map((s) => O(s.spaceTwips ?? o.spaceTwips ?? 0)).join(",")) : (i.className = "sobree-cols sobree-section-cols", i.dataset.colGapMm = String(O(o.spaceTwips ?? 0))), e.appendChild(i), i;
|
|
6704
|
+
}
|
|
6705
|
+
function Kd(e) {
|
|
6706
|
+
return e !== void 0 && e.type !== "continuous";
|
|
6707
|
+
}
|
|
6708
|
+
function Jd(e) {
|
|
6709
|
+
const t = e == null ? void 0 : e.type;
|
|
6710
|
+
return t === "nextPage" || t === "evenPage" || t === "oddPage";
|
|
6704
6711
|
}
|
|
6705
6712
|
function $r(e, t) {
|
|
6706
6713
|
if (!e.classList.contains("sobree-section-cols")) return;
|
|
6707
6714
|
const n = [];
|
|
6708
6715
|
for (; e.lastElementChild; ) {
|
|
6709
6716
|
const r = e.lastElementChild;
|
|
6710
|
-
if (!
|
|
6717
|
+
if (!Qd(r)) break;
|
|
6711
6718
|
e.removeChild(r), n.unshift(r);
|
|
6712
6719
|
}
|
|
6713
6720
|
for (const r of n) t.appendChild(r);
|
|
6714
6721
|
}
|
|
6715
|
-
function
|
|
6722
|
+
function Zd(e) {
|
|
6716
6723
|
const t = e.lastElementChild;
|
|
6717
6724
|
if (!t || !t.classList.contains("sobree-section-break")) return;
|
|
6718
6725
|
const n = t.previousElementSibling;
|
|
6719
6726
|
n && (n.tagName !== "P" && n.tagName !== "LI" || (n.textContent ?? "").trim().length > 0 || n.querySelector("img, svg, table") || (n.classList.add("sobree-section-trailer-empty"), n.style.marginTop = "0", n.style.marginBottom = "0"));
|
|
6720
6727
|
}
|
|
6721
|
-
function
|
|
6728
|
+
function Qd(e) {
|
|
6722
6729
|
return !(e.tagName !== "P" && e.tagName !== "LI" || (e.textContent ?? "").trim().length > 0 || e.querySelector("img, svg, table") !== null);
|
|
6723
6730
|
}
|
|
6724
|
-
function
|
|
6731
|
+
function th(e, t) {
|
|
6725
6732
|
if (!t) return null;
|
|
6726
6733
|
const n = [], r = /* @__PURE__ */ new Set();
|
|
6727
6734
|
let o = t;
|
|
@@ -6745,7 +6752,7 @@ function Zd(e, t) {
|
|
|
6745
6752
|
}
|
|
6746
6753
|
return i;
|
|
6747
6754
|
}
|
|
6748
|
-
function
|
|
6755
|
+
function eh(e, t, n) {
|
|
6749
6756
|
const r = e.conditional ?? {}, o = [];
|
|
6750
6757
|
e.shading && o.push({ shading: e.shading });
|
|
6751
6758
|
const i = n.rowCount - 1, s = n.colCount - 1, a = t.firstRow === !0 && n.rowIndex === 0, c = t.lastRow === !0 && n.rowIndex === i, l = t.firstColumn === !0 && n.colIndex === 0, u = t.lastColumn === !0 && n.colIndex === s;
|
|
@@ -6769,17 +6776,17 @@ function Hr(e, t, n, r) {
|
|
|
6769
6776
|
const o = r > 0 ? r : 1;
|
|
6770
6777
|
return Math.floor((e - t) / o) % 2 === 0 ? 1 : 2;
|
|
6771
6778
|
}
|
|
6772
|
-
function
|
|
6773
|
-
const i = document.createElement("table"), s =
|
|
6774
|
-
|
|
6779
|
+
function nh(e, t, n = [], r = [], o = {}) {
|
|
6780
|
+
const i = document.createElement("table"), s = th(r, e.properties.styleId), a = ih(e, s);
|
|
6781
|
+
ah(i, a), ch(i, e.properties);
|
|
6775
6782
|
const c = {
|
|
6776
6783
|
def: s,
|
|
6777
6784
|
look: e.properties.look ?? {},
|
|
6778
6785
|
rowCount: e.rows.length,
|
|
6779
|
-
colCount:
|
|
6786
|
+
colCount: dh(e),
|
|
6780
6787
|
borders: a,
|
|
6781
|
-
margins:
|
|
6782
|
-
}, l =
|
|
6788
|
+
margins: sh(e, s)
|
|
6789
|
+
}, l = hh(e), u = e.rows.map((d, h) => ({ r: d, i: h })).filter((d) => d.r.isHeader), f = e.rows.map((d, h) => ({ r: d, i: h })).filter((d) => !d.r.isHeader);
|
|
6783
6790
|
if (u.length > 0) {
|
|
6784
6791
|
const d = document.createElement("thead");
|
|
6785
6792
|
for (const { r: h, i: p } of u)
|
|
@@ -6812,7 +6819,7 @@ function _r(e, t, n, r, o, i, s, a, c) {
|
|
|
6812
6819
|
colIndex: u,
|
|
6813
6820
|
rowCount: o.rowCount,
|
|
6814
6821
|
colCount: o.colCount
|
|
6815
|
-
}, p = r.get(`${t}:${u}`) ?? 1, y =
|
|
6822
|
+
}, p = r.get(`${t}:${u}`) ?? 1, y = rh(
|
|
6816
6823
|
f,
|
|
6817
6824
|
n,
|
|
6818
6825
|
o,
|
|
@@ -6827,18 +6834,18 @@ function _r(e, t, n, r, o, i, s, a, c) {
|
|
|
6827
6834
|
}
|
|
6828
6835
|
return l;
|
|
6829
6836
|
}
|
|
6830
|
-
function
|
|
6837
|
+
function rh(e, t, n, r, o, i, s, a, c) {
|
|
6831
6838
|
var d, h;
|
|
6832
|
-
const l = document.createElement(t), u = n.def ?
|
|
6833
|
-
return f && (l.style.backgroundColor = f),
|
|
6839
|
+
const l = document.createElement(t), u = n.def ? eh(n.def, n.look, r) : {}, f = (d = e.shading) != null && d.fill && e.shading.fill !== "#auto" ? e.shading.fill : (h = u.shading) != null && h.fill && u.shading.fill !== "#auto" ? u.shading.fill : void 0;
|
|
6840
|
+
return f && (l.style.backgroundColor = f), lh(l, {
|
|
6834
6841
|
table: n.borders,
|
|
6835
6842
|
pos: r,
|
|
6836
6843
|
span: o,
|
|
6837
6844
|
region: u.borders,
|
|
6838
6845
|
direct: e.borders
|
|
6839
|
-
}),
|
|
6846
|
+
}), uh(l, n.margins), e.verticalAlign && (l.style.verticalAlign = e.verticalAlign === "center" ? "middle" : e.verticalAlign), e.content.length > 0 ? (c(e.content, l, i, s, a), oh(l)) : l.appendChild(document.createElement("br")), l;
|
|
6840
6847
|
}
|
|
6841
|
-
function
|
|
6848
|
+
function oh(e) {
|
|
6842
6849
|
for (const t of e.querySelectorAll("p")) {
|
|
6843
6850
|
if (!(t instanceof HTMLElement)) continue;
|
|
6844
6851
|
t.style.marginBottom === "4mm" && (t.style.marginBottom = "0px");
|
|
@@ -6847,7 +6854,7 @@ function nh(e) {
|
|
|
6847
6854
|
}
|
|
6848
6855
|
}
|
|
6849
6856
|
const ft = { style: "single", sizeEighthsOfPt: 4, color: "auto" };
|
|
6850
|
-
function
|
|
6857
|
+
function ih(e, t) {
|
|
6851
6858
|
const n = e.properties.borders, r = n !== void 0 ? n : t == null ? void 0 : t.borders;
|
|
6852
6859
|
return r && (r.top || r.right || r.bottom || r.left || r.insideH || r.insideV) ? r ?? null : n !== void 0 ? null : e.properties.styleId === "TableGrid" ? {
|
|
6853
6860
|
top: ft,
|
|
@@ -6858,18 +6865,18 @@ function rh(e, t) {
|
|
|
6858
6865
|
insideV: ft
|
|
6859
6866
|
} : null;
|
|
6860
6867
|
}
|
|
6861
|
-
function
|
|
6868
|
+
function sh(e, t) {
|
|
6862
6869
|
const n = e.properties.cellMargins, r = t == null ? void 0 : t.cellMargins;
|
|
6863
6870
|
if (!(!n && !r))
|
|
6864
6871
|
return { ...r, ...n };
|
|
6865
6872
|
}
|
|
6866
|
-
function
|
|
6873
|
+
function ah(e, t) {
|
|
6867
6874
|
t && (e.style.borderCollapse = "collapse", e.classList.add("sobree-table-bordered"));
|
|
6868
6875
|
}
|
|
6869
|
-
function
|
|
6876
|
+
function ch(e, t) {
|
|
6870
6877
|
t.widthTwips !== void 0 && (e.style.width = `${fs(t.widthTwips).toFixed(2)}mm`), t.alignment === "center" ? (e.style.marginLeft = "auto", e.style.marginRight = "auto") : t.alignment === "right" && (e.style.marginLeft = "auto");
|
|
6871
6878
|
}
|
|
6872
|
-
function
|
|
6879
|
+
function lh(e, { table: t, pos: n, span: r, region: o, direct: i }) {
|
|
6873
6880
|
const s = n.rowIndex === 0, a = n.colIndex === 0, c = n.rowIndex + r.row >= n.rowCount, l = n.colIndex + r.col >= n.colCount, u = {
|
|
6874
6881
|
// Inside-H is drawn once per shared edge as the lower row's top; the
|
|
6875
6882
|
// upper row's bottom stays empty unless it's the table's bottom edge.
|
|
@@ -6880,19 +6887,19 @@ function ah(e, { table: t, pos: n, span: r, region: o, direct: i }) {
|
|
|
6880
6887
|
};
|
|
6881
6888
|
for (const f of ["top", "right", "bottom", "left"]) {
|
|
6882
6889
|
const d = (i == null ? void 0 : i[f]) ?? (o == null ? void 0 : o[f]) ?? u[f];
|
|
6883
|
-
d && e.style.setProperty(`border-${f}`,
|
|
6890
|
+
d && e.style.setProperty(`border-${f}`, fh(d));
|
|
6884
6891
|
}
|
|
6885
6892
|
}
|
|
6886
|
-
function
|
|
6893
|
+
function uh(e, t) {
|
|
6887
6894
|
if (!t) return;
|
|
6888
6895
|
const n = t.topTwips ?? 0, r = t.rightTwips ?? 108, o = t.bottomTwips ?? 0, i = t.leftTwips ?? 108, s = (a) => `${fs(a).toFixed(2)}mm`;
|
|
6889
6896
|
e.style.padding = `${s(n)} ${s(r)} ${s(o)} ${s(i)}`;
|
|
6890
6897
|
}
|
|
6891
|
-
function
|
|
6898
|
+
function fh(e) {
|
|
6892
6899
|
const t = Math.max(1, Math.round(e.sizeEighthsOfPt / 8 * 1.3333333333333333)), n = e.style === "double" ? "double" : e.style === "dashed" ? "dashed" : e.style === "dotted" ? "dotted" : e.style === "none" ? "none" : "solid", r = e.color === "auto" ? "#888" : e.color;
|
|
6893
6900
|
return `${t}px ${n} ${r}`;
|
|
6894
6901
|
}
|
|
6895
|
-
function
|
|
6902
|
+
function dh(e) {
|
|
6896
6903
|
return e.rows.reduce(
|
|
6897
6904
|
(t, n) => Math.max(
|
|
6898
6905
|
t,
|
|
@@ -6901,7 +6908,7 @@ function uh(e) {
|
|
|
6901
6908
|
0
|
|
6902
6909
|
);
|
|
6903
6910
|
}
|
|
6904
|
-
function
|
|
6911
|
+
function hh(e) {
|
|
6905
6912
|
var o;
|
|
6906
6913
|
const t = /* @__PURE__ */ new Map(), n = [], r = e.rows.reduce(
|
|
6907
6914
|
(i, s) => Math.max(
|
|
@@ -6939,7 +6946,7 @@ function fh(e) {
|
|
|
6939
6946
|
}
|
|
6940
6947
|
function vt(e, t, n, r = [], o = {}, i, s = [], a = /* @__PURE__ */ new Set()) {
|
|
6941
6948
|
const c = _d(e, r, n);
|
|
6942
|
-
let l = null, u = 0, f = Dr(t, s[0], 0), d = !1;
|
|
6949
|
+
let l = null, u = 0, f = Dr(t, s[0], 0, s[1]), d = !1;
|
|
6943
6950
|
const h = (m) => {
|
|
6944
6951
|
if (m.kind === "section_break" || m.kind === "table" || m.kind !== "paragraph") return !1;
|
|
6945
6952
|
for (const v of m.runs)
|
|
@@ -6969,7 +6976,7 @@ function vt(e, t, n, r = [], o = {}, i, s = [], a = /* @__PURE__ */ new Set()) {
|
|
|
6969
6976
|
continue;
|
|
6970
6977
|
}
|
|
6971
6978
|
y();
|
|
6972
|
-
const P = v.kind === "section_break" ? s[v.toSectionIndex] : void 0, I =
|
|
6979
|
+
const P = v.kind === "section_break" ? s[v.toSectionIndex] : void 0, I = ph(v, n, r, o, P);
|
|
6973
6980
|
if (I) {
|
|
6974
6981
|
if (x && I.setAttribute(st, x), I.dataset.sectionIndex = String(u), I.dataset.blockIndex = String(m), v.kind === "paragraph") {
|
|
6975
6982
|
zr(I, v.properties);
|
|
@@ -6978,14 +6985,19 @@ function vt(e, t, n, r = [], o = {}, i, s = [], a = /* @__PURE__ */ new Set()) {
|
|
|
6978
6985
|
}
|
|
6979
6986
|
v.kind === "section_break" ? ($r(f, t), t.appendChild(I)) : f.appendChild(I);
|
|
6980
6987
|
}
|
|
6981
|
-
v.kind === "section_break" && (
|
|
6988
|
+
v.kind === "section_break" && (Zd(t), u += 1, f = Dr(
|
|
6989
|
+
t,
|
|
6990
|
+
s[u],
|
|
6991
|
+
u,
|
|
6992
|
+
s[u + 1]
|
|
6993
|
+
));
|
|
6982
6994
|
}
|
|
6983
6995
|
$r(f, t);
|
|
6984
6996
|
}
|
|
6985
|
-
function
|
|
6986
|
-
return e.kind === "paragraph" ? Yd(e, n, r) : e.kind === "table" ?
|
|
6997
|
+
function ph(e, t, n, r, o) {
|
|
6998
|
+
return e.kind === "paragraph" ? Yd(e, n, r) : e.kind === "table" ? nh(e, vt, t, n, r) : e.kind === "section_break" ? gh(o) : e.kind === "inline_frame" ? Rd(e, t, n, r, vt) : null;
|
|
6987
6999
|
}
|
|
6988
|
-
function
|
|
7000
|
+
function gh(e) {
|
|
6989
7001
|
const t = document.createElement("div");
|
|
6990
7002
|
t.className = "sobree-section-break";
|
|
6991
7003
|
const n = (e == null ? void 0 : e.type) === "continuous";
|
|
@@ -7001,7 +7013,7 @@ function zr(e, t) {
|
|
|
7001
7013
|
}
|
|
7002
7014
|
function Dt(e, t, n) {
|
|
7003
7015
|
var o;
|
|
7004
|
-
t.replaceChildren(),
|
|
7016
|
+
t.replaceChildren(), mh(t, ((o = e.settings) == null ? void 0 : o.defaultTabStopTwips) ?? 720);
|
|
7005
7017
|
const r = /* @__PURE__ */ new Set();
|
|
7006
7018
|
for (const i of e.anchoredFrames ?? [])
|
|
7007
7019
|
i.anchor.paragraphIndex !== void 0 && r.add(i.anchor.paragraphIndex);
|
|
@@ -7014,9 +7026,9 @@ function Dt(e, t, n) {
|
|
|
7014
7026
|
n,
|
|
7015
7027
|
e.sections,
|
|
7016
7028
|
r
|
|
7017
|
-
), e.footnotes && Object.keys(e.footnotes).length > 0 &&
|
|
7029
|
+
), e.footnotes && Object.keys(e.footnotes).length > 0 && bh(e, t);
|
|
7018
7030
|
}
|
|
7019
|
-
function
|
|
7031
|
+
function mh(e, t) {
|
|
7020
7032
|
const n = t / 1440 * 25.4;
|
|
7021
7033
|
let r = e;
|
|
7022
7034
|
for (; r && !r.classList.contains("sobree-editor") && !r.classList.contains("paper-stack"); )
|
|
@@ -7024,7 +7036,7 @@ function ph(e, t) {
|
|
|
7024
7036
|
const o = r ?? e;
|
|
7025
7037
|
o.style.setProperty("tab-size", `${n}mm`), o.style.setProperty("-moz-tab-size", `${n}mm`);
|
|
7026
7038
|
}
|
|
7027
|
-
function
|
|
7039
|
+
function bh(e, t) {
|
|
7028
7040
|
const n = document.createElement("aside");
|
|
7029
7041
|
n.className = "sobree-footnotes", n.setAttribute("role", "doc-endnotes");
|
|
7030
7042
|
const r = document.createElement("ol");
|
|
@@ -7155,13 +7167,13 @@ function hn(e, t) {
|
|
|
7155
7167
|
}
|
|
7156
7168
|
return n;
|
|
7157
7169
|
}
|
|
7158
|
-
function
|
|
7170
|
+
function yh(e) {
|
|
7159
7171
|
const t = Array.from(
|
|
7160
7172
|
e.querySelectorAll(":scope > thead > tr, :scope > tbody > tr")
|
|
7161
7173
|
), n = /* @__PURE__ */ new Map(), r = [];
|
|
7162
7174
|
for (const i of t)
|
|
7163
|
-
r.push(
|
|
7164
|
-
const o = r.reduce((i, s) => Math.max(i,
|
|
7175
|
+
r.push(wh(i, n));
|
|
7176
|
+
const o = r.reduce((i, s) => Math.max(i, Sh(s.cells)), 0);
|
|
7165
7177
|
return {
|
|
7166
7178
|
kind: "table",
|
|
7167
7179
|
grid: Array.from({ length: o }, () => 2400),
|
|
@@ -7169,19 +7181,19 @@ function mh(e) {
|
|
|
7169
7181
|
properties: {}
|
|
7170
7182
|
};
|
|
7171
7183
|
}
|
|
7172
|
-
function
|
|
7184
|
+
function wh(e, t) {
|
|
7173
7185
|
var c;
|
|
7174
7186
|
const n = Array.from(e.querySelectorAll(":scope > th, :scope > td")), r = ((c = e.parentElement) == null ? void 0 : c.tagName.toLowerCase()) === "thead", o = [];
|
|
7175
7187
|
let i = 0, s = 0;
|
|
7176
7188
|
for (; s < n.length || t.get(i); ) {
|
|
7177
7189
|
const l = t.get(i) ?? 0;
|
|
7178
7190
|
if (l > 0) {
|
|
7179
|
-
o.push(
|
|
7191
|
+
o.push(xh()), t.set(i, l - 1), i += 1;
|
|
7180
7192
|
continue;
|
|
7181
7193
|
}
|
|
7182
7194
|
const u = n[s++];
|
|
7183
7195
|
if (!u) break;
|
|
7184
|
-
const f = Ur(u.getAttribute("colspan")), d = Ur(u.getAttribute("rowspan")), h =
|
|
7196
|
+
const f = Ur(u.getAttribute("colspan")), d = Ur(u.getAttribute("rowspan")), h = kh(u);
|
|
7185
7197
|
if (f > 1 && (h.gridSpan = f), d > 1) {
|
|
7186
7198
|
h.vMerge = "restart";
|
|
7187
7199
|
for (let p = 0; p < f; p++) t.set(i + p, d - 1);
|
|
@@ -7191,7 +7203,7 @@ function bh(e, t) {
|
|
|
7191
7203
|
const a = { cells: o };
|
|
7192
7204
|
return r && (a.isHeader = !0), a;
|
|
7193
7205
|
}
|
|
7194
|
-
function
|
|
7206
|
+
function kh(e) {
|
|
7195
7207
|
const t = Wr(e.style.textAlign), n = t ? { alignment: t } : {}, r = Array.from(e.children).some((i) => {
|
|
7196
7208
|
const s = i.tagName;
|
|
7197
7209
|
return s === "P" || s === "OL" || s === "UL" || s === "TABLE";
|
|
@@ -7215,7 +7227,7 @@ function yh(e) {
|
|
|
7215
7227
|
});
|
|
7216
7228
|
}
|
|
7217
7229
|
else {
|
|
7218
|
-
const i =
|
|
7230
|
+
const i = vh(e);
|
|
7219
7231
|
for (const s of i) {
|
|
7220
7232
|
const a = document.createElement("span");
|
|
7221
7233
|
for (const c of s) a.appendChild(c.cloneNode(!0));
|
|
@@ -7228,7 +7240,7 @@ function yh(e) {
|
|
|
7228
7240
|
}
|
|
7229
7241
|
return o.length === 0 && o.push({ kind: "paragraph", properties: { ...n }, runs: [] }), { content: o };
|
|
7230
7242
|
}
|
|
7231
|
-
function
|
|
7243
|
+
function vh(e) {
|
|
7232
7244
|
var n;
|
|
7233
7245
|
const t = [[]];
|
|
7234
7246
|
for (const r of Array.from(e.childNodes)) {
|
|
@@ -7240,13 +7252,13 @@ function wh(e) {
|
|
|
7240
7252
|
}
|
|
7241
7253
|
return ((n = t[t.length - 1]) == null ? void 0 : n.length) === 0 && t.length > 1 && t.pop(), t;
|
|
7242
7254
|
}
|
|
7243
|
-
function
|
|
7255
|
+
function xh() {
|
|
7244
7256
|
return {
|
|
7245
7257
|
vMerge: "continue",
|
|
7246
7258
|
content: [{ kind: "paragraph", properties: {}, runs: [] }]
|
|
7247
7259
|
};
|
|
7248
7260
|
}
|
|
7249
|
-
function
|
|
7261
|
+
function Sh(e) {
|
|
7250
7262
|
let t = 0;
|
|
7251
7263
|
for (const n of e) t += n.gridSpan ?? 1;
|
|
7252
7264
|
return t;
|
|
@@ -7312,7 +7324,7 @@ function ds(e, t) {
|
|
|
7312
7324
|
continue;
|
|
7313
7325
|
}
|
|
7314
7326
|
if (t.currentList = null, i === "table") {
|
|
7315
|
-
r(
|
|
7327
|
+
r(yh(o), o);
|
|
7316
7328
|
continue;
|
|
7317
7329
|
}
|
|
7318
7330
|
if (i === "hr" || o.hasAttribute("data-page-break")) {
|
|
@@ -7369,7 +7381,7 @@ function Ze(e, t) {
|
|
|
7369
7381
|
const n = hn({}, t.getAttribute("style"));
|
|
7370
7382
|
Object.keys(n).length > 0 && (e.runDefaults = n);
|
|
7371
7383
|
}
|
|
7372
|
-
function
|
|
7384
|
+
function Eh(e, t = {}) {
|
|
7373
7385
|
return hs(e, t).document;
|
|
7374
7386
|
}
|
|
7375
7387
|
function hs(e, t = {}) {
|
|
@@ -7395,7 +7407,7 @@ function hs(e, t = {}) {
|
|
|
7395
7407
|
sources: n
|
|
7396
7408
|
};
|
|
7397
7409
|
}
|
|
7398
|
-
const
|
|
7410
|
+
const Th = /* @__PURE__ */ new Set([
|
|
7399
7411
|
"span",
|
|
7400
7412
|
"strong",
|
|
7401
7413
|
"b",
|
|
@@ -7411,7 +7423,7 @@ const Sh = /* @__PURE__ */ new Set([
|
|
|
7411
7423
|
"mark",
|
|
7412
7424
|
"code",
|
|
7413
7425
|
"a"
|
|
7414
|
-
]),
|
|
7426
|
+
]), Ah = /* @__PURE__ */ new Set(["br", "img", "hr"]);
|
|
7415
7427
|
function Vr(e, t, n, r) {
|
|
7416
7428
|
const o = pn(e, n, r);
|
|
7417
7429
|
if (!o) return null;
|
|
@@ -7420,10 +7432,10 @@ function Vr(e, t, n, r) {
|
|
|
7420
7432
|
}
|
|
7421
7433
|
function pn(e, t, n) {
|
|
7422
7434
|
if (!e.some((i) => i.contains(t) || i === t)) return null;
|
|
7423
|
-
const { blockEl: r, blockId: o } =
|
|
7435
|
+
const { blockEl: r, blockId: o } = Bh(t, e);
|
|
7424
7436
|
if (!r || !o) return null;
|
|
7425
|
-
if (
|
|
7426
|
-
const { offset: i, cell: s } =
|
|
7437
|
+
if (Lh(r)) {
|
|
7438
|
+
const { offset: i, cell: s } = Mh(r, t, n);
|
|
7427
7439
|
return { blockId: o, offset: i, cell: s };
|
|
7428
7440
|
}
|
|
7429
7441
|
return { blockId: o, offset: bs(r, t, n) };
|
|
@@ -7435,21 +7447,21 @@ function Xr(e, t) {
|
|
|
7435
7447
|
...t.cell ? { cell: t.cell } : {}
|
|
7436
7448
|
});
|
|
7437
7449
|
}
|
|
7438
|
-
function
|
|
7450
|
+
function Ch(e, t, n) {
|
|
7439
7451
|
const r = Vr(e, t, n.startContainer, n.startOffset), o = Vr(e, t, n.endContainer, n.endOffset);
|
|
7440
7452
|
return !r || !o ? null : { from: r, to: o };
|
|
7441
7453
|
}
|
|
7442
|
-
function
|
|
7454
|
+
function Nh(e, t) {
|
|
7443
7455
|
const n = window.getSelection();
|
|
7444
7456
|
if (!n || n.rangeCount === 0) return null;
|
|
7445
|
-
const r = n.getRangeAt(0), o =
|
|
7457
|
+
const r = n.getRangeAt(0), o = Ch(e, t, r);
|
|
7446
7458
|
return o ? n.isCollapsed ? { kind: "caret", at: o.from } : { kind: "range", range: o } : null;
|
|
7447
7459
|
}
|
|
7448
7460
|
function ye(e, t) {
|
|
7449
|
-
const n =
|
|
7461
|
+
const n = Rh(e, t.block.id);
|
|
7450
7462
|
if (!n) return null;
|
|
7451
7463
|
if (t.cell) {
|
|
7452
|
-
const r =
|
|
7464
|
+
const r = Oh(n, t.cell);
|
|
7453
7465
|
return r ? Gr(r, t.offset) : null;
|
|
7454
7466
|
}
|
|
7455
7467
|
return Gr(n, t.offset);
|
|
@@ -7470,7 +7482,7 @@ function Ce(e, t) {
|
|
|
7470
7482
|
const i = document.createRange();
|
|
7471
7483
|
return i.setStart(r.node, r.offset), i.setEnd(o.node, o.offset), n.removeAllRanges(), n.addRange(i), !0;
|
|
7472
7484
|
}
|
|
7473
|
-
function
|
|
7485
|
+
function Ph(e) {
|
|
7474
7486
|
const t = window.getSelection();
|
|
7475
7487
|
if (!t || t.rangeCount === 0) return null;
|
|
7476
7488
|
const n = t.getRangeAt(0), r = pn(e, n.startContainer, n.startOffset);
|
|
@@ -7478,7 +7490,7 @@ function Ch(e) {
|
|
|
7478
7490
|
const o = t.isCollapsed ? r : pn(e, n.endContainer, n.endOffset) ?? r;
|
|
7479
7491
|
return { start: r, end: o, collapsed: t.isCollapsed };
|
|
7480
7492
|
}
|
|
7481
|
-
function
|
|
7493
|
+
function Ih(e, t) {
|
|
7482
7494
|
if (!t) return !1;
|
|
7483
7495
|
const n = Xr(e, t.start), r = t.collapsed ? n : Xr(e, t.end);
|
|
7484
7496
|
if (!n || !r) return !1;
|
|
@@ -7487,7 +7499,7 @@ function Nh(e, t) {
|
|
|
7487
7499
|
const i = document.createRange();
|
|
7488
7500
|
return i.setStart(n.node, n.offset), i.setEnd(r.node, r.offset), o.removeAllRanges(), o.addRange(i), !0;
|
|
7489
7501
|
}
|
|
7490
|
-
function
|
|
7502
|
+
function Rh(e, t) {
|
|
7491
7503
|
const n = ss(t);
|
|
7492
7504
|
for (const r of e) {
|
|
7493
7505
|
const o = r.querySelector(n);
|
|
@@ -7495,7 +7507,7 @@ function Ph(e, t) {
|
|
|
7495
7507
|
}
|
|
7496
7508
|
return null;
|
|
7497
7509
|
}
|
|
7498
|
-
function
|
|
7510
|
+
function Fh(e, t) {
|
|
7499
7511
|
const n = `[${st}][data-block-index="${t}"]`;
|
|
7500
7512
|
for (const r of e) {
|
|
7501
7513
|
const o = r.querySelector(n);
|
|
@@ -7503,7 +7515,7 @@ function Ih(e, t) {
|
|
|
7503
7515
|
}
|
|
7504
7516
|
return null;
|
|
7505
7517
|
}
|
|
7506
|
-
function
|
|
7518
|
+
function Bh(e, t) {
|
|
7507
7519
|
let n = e;
|
|
7508
7520
|
for (; n; ) {
|
|
7509
7521
|
if (n instanceof HTMLElement && n.hasAttribute(st) && t.some((r) => r.contains(n)))
|
|
@@ -7512,7 +7524,7 @@ function Rh(e, t) {
|
|
|
7512
7524
|
}
|
|
7513
7525
|
return { blockEl: null, blockId: null };
|
|
7514
7526
|
}
|
|
7515
|
-
function
|
|
7527
|
+
function Lh(e) {
|
|
7516
7528
|
return e.tagName.toLowerCase() === "table";
|
|
7517
7529
|
}
|
|
7518
7530
|
function ps(e) {
|
|
@@ -7524,7 +7536,7 @@ function gs(e) {
|
|
|
7524
7536
|
(t) => t.closest("table") === e
|
|
7525
7537
|
);
|
|
7526
7538
|
}
|
|
7527
|
-
function
|
|
7539
|
+
function Mh(e, t, n) {
|
|
7528
7540
|
const r = t instanceof Element ? t : t.parentElement, o = r == null ? void 0 : r.closest("td,th");
|
|
7529
7541
|
if (!o || !e.contains(o))
|
|
7530
7542
|
return { offset: 0, cell: { row: 0, col: 0, blockIndex: 0 } };
|
|
@@ -7537,17 +7549,17 @@ function Bh(e, t, n) {
|
|
|
7537
7549
|
cell: { row: Math.max(0, s), col: Math.max(0, c), blockIndex: u }
|
|
7538
7550
|
};
|
|
7539
7551
|
}
|
|
7540
|
-
function
|
|
7552
|
+
function Oh(e, t) {
|
|
7541
7553
|
const n = gs(e)[t.row];
|
|
7542
7554
|
if (!n) return null;
|
|
7543
7555
|
const r = Array.from(n.children).filter(ps)[t.col];
|
|
7544
7556
|
return r ? Array.from(r.children)[t.blockIndex] ?? r : null;
|
|
7545
7557
|
}
|
|
7546
7558
|
function ms(e) {
|
|
7547
|
-
return
|
|
7559
|
+
return Ah.has(e.tagName.toLowerCase());
|
|
7548
7560
|
}
|
|
7549
|
-
function
|
|
7550
|
-
return
|
|
7561
|
+
function Dh(e) {
|
|
7562
|
+
return Th.has(e.tagName.toLowerCase());
|
|
7551
7563
|
}
|
|
7552
7564
|
function bs(e, t, n) {
|
|
7553
7565
|
let r = 0, o = !1;
|
|
@@ -7576,7 +7588,7 @@ function bs(e, t, n) {
|
|
|
7576
7588
|
r += 1;
|
|
7577
7589
|
return;
|
|
7578
7590
|
}
|
|
7579
|
-
if (
|
|
7591
|
+
if (Dh(s) || s.tagName.toLowerCase() === "div") {
|
|
7580
7592
|
for (const a of Array.from(s.childNodes))
|
|
7581
7593
|
if (i(a), o) return;
|
|
7582
7594
|
} else
|
|
@@ -7641,7 +7653,7 @@ function gn(e) {
|
|
|
7641
7653
|
n.kind === "text" ? t += n.text : n.kind === "hyperlink" ? t += gn(n.children) : t += `\0${n.kind}`;
|
|
7642
7654
|
return t;
|
|
7643
7655
|
}
|
|
7644
|
-
function
|
|
7656
|
+
function $h(e, t) {
|
|
7645
7657
|
return e.map((n, r) => ys(t(r), n));
|
|
7646
7658
|
}
|
|
7647
7659
|
function ys(e, t) {
|
|
@@ -7652,12 +7664,12 @@ function ys(e, t) {
|
|
|
7652
7664
|
return { ...n, runs: gn(n.runs) === gn(r.runs) ? n.runs : r.runs };
|
|
7653
7665
|
}
|
|
7654
7666
|
case "table":
|
|
7655
|
-
return
|
|
7667
|
+
return Hh(e, t);
|
|
7656
7668
|
default:
|
|
7657
7669
|
return e;
|
|
7658
7670
|
}
|
|
7659
7671
|
}
|
|
7660
|
-
function
|
|
7672
|
+
function Hh(e, t) {
|
|
7661
7673
|
if (e.rows.length !== t.rows.length) return t;
|
|
7662
7674
|
const n = t.rows.map((r, o) => {
|
|
7663
7675
|
const i = e.rows[o];
|
|
@@ -7670,7 +7682,7 @@ function Dh(e, t) {
|
|
|
7670
7682
|
});
|
|
7671
7683
|
return { ...e, rows: n };
|
|
7672
7684
|
}
|
|
7673
|
-
class
|
|
7685
|
+
class _h {
|
|
7674
7686
|
constructor(t, n, r, o) {
|
|
7675
7687
|
w(this, "revision", 0);
|
|
7676
7688
|
w(this, "debounceHandle", null);
|
|
@@ -7751,7 +7763,7 @@ class $h {
|
|
|
7751
7763
|
const d = c[f];
|
|
7752
7764
|
d && a.set(d, u);
|
|
7753
7765
|
});
|
|
7754
|
-
const l =
|
|
7766
|
+
const l = $h(r.body, (u) => {
|
|
7755
7767
|
var d;
|
|
7756
7768
|
const f = (d = o[u]) == null ? void 0 : d.dataset.blockId;
|
|
7757
7769
|
return f ? a.get(f) : void 0;
|
|
@@ -7797,7 +7809,7 @@ class $h {
|
|
|
7797
7809
|
this.revision += 1;
|
|
7798
7810
|
const t = this.pendingLiveFrameEdit;
|
|
7799
7811
|
if (this.pendingLiveFrameEdit = !1, !this.events.hasChangeListeners()) return;
|
|
7800
|
-
const n =
|
|
7812
|
+
const n = zh(this.ctx.doc);
|
|
7801
7813
|
this.events.emitChange({
|
|
7802
7814
|
doc: n,
|
|
7803
7815
|
// Alias for backwards compat — same reference, no clone cost.
|
|
@@ -7900,16 +7912,16 @@ class $h {
|
|
|
7900
7912
|
this.ctx.fontFaces.sync(this.ctx.doc.fonts, this.ctx.doc.rawParts), Dt(this.ctx.doc, i, this.blockIdsArray()), t && Ce(this.ctx._hosts(), t), this.domDirty = !1, this.emitChangeNow();
|
|
7901
7913
|
}
|
|
7902
7914
|
}
|
|
7903
|
-
function
|
|
7915
|
+
function zh(e) {
|
|
7904
7916
|
return { ...e, rawParts: {} };
|
|
7905
7917
|
}
|
|
7906
|
-
function
|
|
7918
|
+
function jh(e, t) {
|
|
7907
7919
|
const n = t.getSelection();
|
|
7908
7920
|
if (!n || n.anchorNode == null || !e.contains(n.anchorNode)) return null;
|
|
7909
7921
|
const r = qr(e, n.anchorNode, n.anchorOffset, t), o = n.focusNode === n.anchorNode && n.focusOffset === n.anchorOffset ? r : n.focusNode && e.contains(n.focusNode) ? qr(e, n.focusNode, n.focusOffset, t) : r;
|
|
7910
7922
|
return { start: Math.min(r, o), end: Math.max(r, o) };
|
|
7911
7923
|
}
|
|
7912
|
-
function
|
|
7924
|
+
function Uh(e, t, n) {
|
|
7913
7925
|
const r = n.getSelection();
|
|
7914
7926
|
if (!r) return;
|
|
7915
7927
|
const o = Kr(e, t.start, n), i = t.end === t.start ? o : Kr(e, t.end, n), s = n.createRange();
|
|
@@ -7922,13 +7934,13 @@ function qr(e, t, n, r) {
|
|
|
7922
7934
|
for (; s; ) {
|
|
7923
7935
|
if (t.nodeType === Node.TEXT_NODE && s === t)
|
|
7924
7936
|
return o + n;
|
|
7925
|
-
if (t.nodeType === Node.ELEMENT_NODE &&
|
|
7937
|
+
if (t.nodeType === Node.ELEMENT_NODE && Wh(s, t, n))
|
|
7926
7938
|
return o;
|
|
7927
7939
|
o += s.data.length, s = i.nextNode();
|
|
7928
7940
|
}
|
|
7929
7941
|
return o;
|
|
7930
7942
|
}
|
|
7931
|
-
function
|
|
7943
|
+
function Wh(e, t, n) {
|
|
7932
7944
|
const r = t.childNodes[n] ?? null;
|
|
7933
7945
|
return r ? r === e || r.compareDocumentPosition(e) === Node.DOCUMENT_POSITION_CONTAINED_BY : !1;
|
|
7934
7946
|
}
|
|
@@ -7950,7 +7962,7 @@ const Jr = {
|
|
|
7950
7962
|
sup: "superscript",
|
|
7951
7963
|
sub: "subscript"
|
|
7952
7964
|
};
|
|
7953
|
-
class
|
|
7965
|
+
class Yh {
|
|
7954
7966
|
constructor(t) {
|
|
7955
7967
|
/**
|
|
7956
7968
|
* Ids of editable textbox frames whose DOM the user has edited since
|
|
@@ -8011,7 +8023,7 @@ class Uh {
|
|
|
8011
8023
|
if (!this.dirtyFrameIds.has(i.id) || i.content.kind !== "textbox") return i;
|
|
8012
8024
|
const s = n.get(i.id);
|
|
8013
8025
|
if (!s) return i;
|
|
8014
|
-
const a =
|
|
8026
|
+
const a = Eh([s], { captureRunDefaults: !0 }).body;
|
|
8015
8027
|
return r = !0, { ...i, content: { ...i.content, body: a } };
|
|
8016
8028
|
});
|
|
8017
8029
|
this.dirtyFrameIds.clear(), r && this.ctx.setDoc({ ...this.ctx.doc, anchoredFrames: o });
|
|
@@ -8050,7 +8062,7 @@ class Uh {
|
|
|
8050
8062
|
captureSelectionForHistory() {
|
|
8051
8063
|
const t = this.focusedFrameEl();
|
|
8052
8064
|
if (t != null && t.dataset.anchorId) {
|
|
8053
|
-
const n =
|
|
8065
|
+
const n = jh(t, this.ctx.host.ownerDocument) ?? {
|
|
8054
8066
|
start: 0,
|
|
8055
8067
|
end: 0
|
|
8056
8068
|
};
|
|
@@ -8099,7 +8111,7 @@ class Uh {
|
|
|
8099
8111
|
if (t && t.kind === "frame-selection") {
|
|
8100
8112
|
const n = this.frameElById(t.frameId);
|
|
8101
8113
|
if (!n) return;
|
|
8102
|
-
n.focus({ preventScroll: !0 }),
|
|
8114
|
+
n.focus({ preventScroll: !0 }), Uh(n, { start: t.start, end: t.end }, this.ctx.host.ownerDocument);
|
|
8103
8115
|
return;
|
|
8104
8116
|
}
|
|
8105
8117
|
t && Ce(this.ctx._hosts(), t);
|
|
@@ -8134,7 +8146,7 @@ function U(e, t) {
|
|
|
8134
8146
|
const { update: n, mutations: r, value: o } = t.value;
|
|
8135
8147
|
return e.commit(n, r, o);
|
|
8136
8148
|
}
|
|
8137
|
-
class
|
|
8149
|
+
class Vh {
|
|
8138
8150
|
constructor(t) {
|
|
8139
8151
|
this.ctx = t;
|
|
8140
8152
|
}
|
|
@@ -8152,10 +8164,10 @@ class Wh {
|
|
|
8152
8164
|
return this.ctx.ensureCurrent(), U(this.ctx, wi(j(this.ctx), t));
|
|
8153
8165
|
}
|
|
8154
8166
|
}
|
|
8155
|
-
function
|
|
8167
|
+
function Xh(e, t, n) {
|
|
8156
8168
|
return e.ensureCurrent(), U(e, hi(j(e), t, n));
|
|
8157
8169
|
}
|
|
8158
|
-
function
|
|
8170
|
+
function Gh(e, t, n) {
|
|
8159
8171
|
e.ensureCurrent();
|
|
8160
8172
|
const r = vs(e, n);
|
|
8161
8173
|
return U(e, pi(j(e), t, r));
|
|
@@ -8188,13 +8200,13 @@ function vs(e, t) {
|
|
|
8188
8200
|
const n = e.trackChanges.author === void 0 ? { type: "ins" } : { type: "ins", author: e.trackChanges.author };
|
|
8189
8201
|
return { ...t, properties: { ...t.properties, revision: n } };
|
|
8190
8202
|
}
|
|
8191
|
-
function
|
|
8203
|
+
function qh(e, t, n) {
|
|
8192
8204
|
return e.ensureCurrent(), U(e, ki(j(e), t, n));
|
|
8193
8205
|
}
|
|
8194
|
-
function
|
|
8206
|
+
function Kh(e, t) {
|
|
8195
8207
|
return xs(e, t, !0);
|
|
8196
8208
|
}
|
|
8197
|
-
function
|
|
8209
|
+
function Jh(e, t) {
|
|
8198
8210
|
return xs(e, t, !1);
|
|
8199
8211
|
}
|
|
8200
8212
|
function xs(e, t, n) {
|
|
@@ -8205,12 +8217,12 @@ function xs(e, t, n) {
|
|
|
8205
8217
|
const i = { ...r, [t]: { ...o, done: n } };
|
|
8206
8218
|
return e.commit({ comments: i }, []);
|
|
8207
8219
|
}
|
|
8208
|
-
function
|
|
8220
|
+
function Zh(e) {
|
|
8209
8221
|
const t = document.createElement("div");
|
|
8210
8222
|
return Dt(e.syncFromDom(), t), t.innerHTML;
|
|
8211
8223
|
}
|
|
8212
8224
|
function Ss(e) {
|
|
8213
|
-
return e.ensureCurrent().body.map((n, r) =>
|
|
8225
|
+
return e.ensureCurrent().body.map((n, r) => tp(e, n, r));
|
|
8214
8226
|
}
|
|
8215
8227
|
function Ne(e, t) {
|
|
8216
8228
|
const r = Ss(e)[t];
|
|
@@ -8221,7 +8233,7 @@ function Ut(e, t) {
|
|
|
8221
8233
|
const n = e.registry.indexOf(t);
|
|
8222
8234
|
return n < 0 ? null : Ne(e, n);
|
|
8223
8235
|
}
|
|
8224
|
-
function
|
|
8236
|
+
function Qh(e) {
|
|
8225
8237
|
const t = e.ensureCurrent(), n = [];
|
|
8226
8238
|
return t.body.forEach((r, o) => {
|
|
8227
8239
|
if (r.kind !== "paragraph") return;
|
|
@@ -8234,7 +8246,7 @@ function Jh(e) {
|
|
|
8234
8246
|
});
|
|
8235
8247
|
}), n;
|
|
8236
8248
|
}
|
|
8237
|
-
function
|
|
8249
|
+
function tp(e, t, n) {
|
|
8238
8250
|
var i;
|
|
8239
8251
|
const r = e.registry.refAt(n), o = {
|
|
8240
8252
|
index: n,
|
|
@@ -8282,7 +8294,7 @@ function $e(e, t) {
|
|
|
8282
8294
|
const { revision: o, ...i } = e.properties;
|
|
8283
8295
|
return [{ ...e, properties: i }];
|
|
8284
8296
|
}
|
|
8285
|
-
function
|
|
8297
|
+
function ep(e, t) {
|
|
8286
8298
|
if (e.kind !== "text" || e.properties.revision) return e;
|
|
8287
8299
|
const n = t === void 0 ? { type: "ins" } : { type: "ins", author: t };
|
|
8288
8300
|
return { ...e, properties: { ...e.properties, revision: n } };
|
|
@@ -8297,7 +8309,7 @@ function He(e, t) {
|
|
|
8297
8309
|
}
|
|
8298
8310
|
return { ...e, properties: n.before };
|
|
8299
8311
|
}
|
|
8300
|
-
function
|
|
8312
|
+
function np(e, t) {
|
|
8301
8313
|
if (e.kind !== "text" || e.properties.revisionFormat) return e;
|
|
8302
8314
|
const { revisionFormat: n, ...r } = e.properties, o = t === void 0 ? { before: r } : { before: r, author: t };
|
|
8303
8315
|
return { ...e, properties: { ...e.properties, revisionFormat: o } };
|
|
@@ -8311,7 +8323,7 @@ function we(e, t) {
|
|
|
8311
8323
|
}
|
|
8312
8324
|
return n.type === "ins" && n.author === t ? [] : [e];
|
|
8313
8325
|
}
|
|
8314
|
-
const
|
|
8326
|
+
const rp = /* @__PURE__ */ new Set([
|
|
8315
8327
|
"h1",
|
|
8316
8328
|
"h2",
|
|
8317
8329
|
"h3",
|
|
@@ -8328,19 +8340,19 @@ const ep = /* @__PURE__ */ new Set([
|
|
|
8328
8340
|
"div",
|
|
8329
8341
|
"dl"
|
|
8330
8342
|
]);
|
|
8331
|
-
function
|
|
8343
|
+
function op(e, t) {
|
|
8332
8344
|
let n = e;
|
|
8333
8345
|
for (; n; ) {
|
|
8334
8346
|
if (n instanceof HTMLElement) {
|
|
8335
8347
|
const r = n.parentElement;
|
|
8336
|
-
if (r && t.includes(r) ||
|
|
8348
|
+
if (r && t.includes(r) || rp.has(n.tagName.toLowerCase()) && r && t.includes(r))
|
|
8337
8349
|
return n;
|
|
8338
8350
|
}
|
|
8339
8351
|
n = n.parentNode;
|
|
8340
8352
|
}
|
|
8341
8353
|
return null;
|
|
8342
8354
|
}
|
|
8343
|
-
function
|
|
8355
|
+
function ip(e) {
|
|
8344
8356
|
const t = window.getSelection();
|
|
8345
8357
|
if (!t || t.rangeCount === 0) return null;
|
|
8346
8358
|
const n = t.getRangeAt(0);
|
|
@@ -8356,7 +8368,7 @@ function Es(e) {
|
|
|
8356
8368
|
if (t.kind === "file" && t.type.startsWith("image/")) return !0;
|
|
8357
8369
|
return !1;
|
|
8358
8370
|
}
|
|
8359
|
-
function
|
|
8371
|
+
function sp(e, t) {
|
|
8360
8372
|
var i;
|
|
8361
8373
|
const n = document;
|
|
8362
8374
|
if (n.caretRangeFromPoint) return n.caretRangeFromPoint(e, t);
|
|
@@ -8365,7 +8377,7 @@ function op(e, t) {
|
|
|
8365
8377
|
const o = document.createRange();
|
|
8366
8378
|
return o.setStart(r.offsetNode, r.offset), o.collapse(!0), o;
|
|
8367
8379
|
}
|
|
8368
|
-
function
|
|
8380
|
+
function ap(e) {
|
|
8369
8381
|
return new Promise((t) => {
|
|
8370
8382
|
const n = URL.createObjectURL(e), r = new Image();
|
|
8371
8383
|
r.onload = () => {
|
|
@@ -8376,14 +8388,14 @@ function ip(e) {
|
|
|
8376
8388
|
}, r.src = n;
|
|
8377
8389
|
});
|
|
8378
8390
|
}
|
|
8379
|
-
function
|
|
8391
|
+
function cp(e) {
|
|
8380
8392
|
const t = e.parentNode;
|
|
8381
8393
|
if (t) {
|
|
8382
8394
|
for (; e.firstChild; ) t.insertBefore(e.firstChild, e);
|
|
8383
8395
|
t.removeChild(e);
|
|
8384
8396
|
}
|
|
8385
8397
|
}
|
|
8386
|
-
function
|
|
8398
|
+
function lp(e) {
|
|
8387
8399
|
switch (e) {
|
|
8388
8400
|
case "strong":
|
|
8389
8401
|
return { bold: !0 };
|
|
@@ -8401,11 +8413,11 @@ function ap(e) {
|
|
|
8401
8413
|
return { highlight: "yellow" };
|
|
8402
8414
|
}
|
|
8403
8415
|
}
|
|
8404
|
-
function
|
|
8416
|
+
function up(e) {
|
|
8405
8417
|
const t = e.toLowerCase();
|
|
8406
8418
|
return t === "image/png" ? "png" : t === "image/jpeg" || t === "image/jpg" ? "jpg" : t === "image/gif" ? "gif" : t === "image/webp" ? "webp" : t === "image/svg+xml" ? "svg" : t === "image/bmp" ? "bmp" : "bin";
|
|
8407
8419
|
}
|
|
8408
|
-
function
|
|
8420
|
+
function fp(e, t) {
|
|
8409
8421
|
let n = 1;
|
|
8410
8422
|
for (; e.rawParts[`word/media/image${n}.${t}`]; ) n += 1;
|
|
8411
8423
|
return `word/media/image${n}.${t}`;
|
|
@@ -8420,14 +8432,14 @@ function Ts(e, t, n, r = {}) {
|
|
|
8420
8432
|
if (e.trackChanges.enabled) {
|
|
8421
8433
|
const i = e.trackChanges.author;
|
|
8422
8434
|
return at(e, t, (s) => {
|
|
8423
|
-
const a = s.map((c) =>
|
|
8435
|
+
const a = s.map((c) => np(c, i));
|
|
8424
8436
|
return fn(a, n);
|
|
8425
8437
|
});
|
|
8426
8438
|
}
|
|
8427
8439
|
return at(e, t, (i) => fn(i, n));
|
|
8428
8440
|
}
|
|
8429
|
-
function
|
|
8430
|
-
return Ts(e, t,
|
|
8441
|
+
function dp(e, t, n, r = {}) {
|
|
8442
|
+
return Ts(e, t, lp(n), r);
|
|
8431
8443
|
}
|
|
8432
8444
|
function gt(e, t, n) {
|
|
8433
8445
|
e.ensureCurrent();
|
|
@@ -8436,7 +8448,7 @@ function gt(e, t, n) {
|
|
|
8436
8448
|
const o = e.registry.indexOf(t.block.id), i = e.doc.body[o];
|
|
8437
8449
|
if (!i || i.kind !== "paragraph")
|
|
8438
8450
|
return E({ code: "invalid-position", details: "target is not a paragraph" });
|
|
8439
|
-
const s = e.trackChanges.enabled ?
|
|
8451
|
+
const s = e.trackChanges.enabled ? ep(n, e.trackChanges.author) : n, { before: a, after: c } = _(i.runs, t.offset), l = D([...a, s, ...c]), u = e.doc.body.slice();
|
|
8440
8452
|
return u[o] = { ...i, runs: l }, e.commit({ body: u }, [{ type: "bump", index: o }]);
|
|
8441
8453
|
}
|
|
8442
8454
|
function mn(e, t) {
|
|
@@ -8463,7 +8475,7 @@ function mn(e, t) {
|
|
|
8463
8475
|
}
|
|
8464
8476
|
function As(e, t, n, r) {
|
|
8465
8477
|
e.ensureCurrent();
|
|
8466
|
-
const o =
|
|
8478
|
+
const o = up(r.mime), i = fp(e.doc, o);
|
|
8467
8479
|
e.doc.rawParts[i] = n, e.blobStore && e.blobCache && (e.pendingPartRefMigrations.add(i), qi(e, i, n));
|
|
8468
8480
|
const s = r.widthPx ?? 200, a = r.heightPx ?? 150, c = {
|
|
8469
8481
|
kind: "drawing",
|
|
@@ -8479,7 +8491,7 @@ function Lt(e, t, n = {}) {
|
|
|
8479
8491
|
const r = e.checkRange(t, n.expect);
|
|
8480
8492
|
if (r) return r;
|
|
8481
8493
|
if (t.from.block.id !== t.to.block.id)
|
|
8482
|
-
return e.trackChanges.enabled ?
|
|
8494
|
+
return e.trackChanges.enabled ? hp(e, t) : pp(e, t);
|
|
8483
8495
|
if (e.trackChanges.enabled) {
|
|
8484
8496
|
const o = e.trackChanges.author;
|
|
8485
8497
|
return at(
|
|
@@ -8490,7 +8502,7 @@ function Lt(e, t, n = {}) {
|
|
|
8490
8502
|
}
|
|
8491
8503
|
return at(e, t, () => []);
|
|
8492
8504
|
}
|
|
8493
|
-
function
|
|
8505
|
+
function hp(e, t) {
|
|
8494
8506
|
const n = e.registry.indexOf(t.from.block.id), r = e.registry.indexOf(t.to.block.id);
|
|
8495
8507
|
if (n < 0 || r < 0 || n > r)
|
|
8496
8508
|
return E({ code: "range-out-of-order", details: "range endpoints" });
|
|
@@ -8519,7 +8531,7 @@ function fp(e, t) {
|
|
|
8519
8531
|
}
|
|
8520
8532
|
return e.commit({ body: i }, s);
|
|
8521
8533
|
}
|
|
8522
|
-
function
|
|
8534
|
+
function pp(e, t) {
|
|
8523
8535
|
const n = e.registry.indexOf(t.from.block.id), r = e.registry.indexOf(t.to.block.id);
|
|
8524
8536
|
if (n < 0 || r < 0 || n > r)
|
|
8525
8537
|
return E({ code: "range-out-of-order", details: "range endpoints" });
|
|
@@ -8569,16 +8581,16 @@ function at(e, t, n) {
|
|
|
8569
8581
|
}
|
|
8570
8582
|
return e.commit({ body: i }, s);
|
|
8571
8583
|
}
|
|
8572
|
-
function
|
|
8573
|
-
const t =
|
|
8584
|
+
function gp(e) {
|
|
8585
|
+
const t = ip(e.getContentHosts());
|
|
8574
8586
|
if (!t) return;
|
|
8575
|
-
const n =
|
|
8587
|
+
const n = op(t.startContainer, e.getContentHosts());
|
|
8576
8588
|
if (!n) return;
|
|
8577
8589
|
const r = [], o = document.createTreeWalker(n, NodeFilter.SHOW_ELEMENT, {
|
|
8578
8590
|
acceptNode: (i) => i instanceof HTMLSpanElement && t.intersectsNode(i) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
|
|
8579
8591
|
});
|
|
8580
8592
|
for (let i = o.nextNode(); i; i = o.nextNode()) r.push(i);
|
|
8581
|
-
for (const i of r)
|
|
8593
|
+
for (const i of r) cp(i);
|
|
8582
8594
|
e.scheduleChange();
|
|
8583
8595
|
}
|
|
8584
8596
|
function Cs(e, t, n) {
|
|
@@ -8586,7 +8598,7 @@ function Cs(e, t, n) {
|
|
|
8586
8598
|
return r ? As(e, r, t, n) : E({ code: "invalid-position", details: "no selection" });
|
|
8587
8599
|
}
|
|
8588
8600
|
async function Ns(e, t) {
|
|
8589
|
-
const n = new Uint8Array(await t.arrayBuffer()), r = await
|
|
8601
|
+
const n = new Uint8Array(await t.arrayBuffer()), r = await ap(t);
|
|
8590
8602
|
Cs(e, n, {
|
|
8591
8603
|
mime: t.type || "image/png",
|
|
8592
8604
|
widthPx: r.width,
|
|
@@ -8594,14 +8606,14 @@ async function Ns(e, t) {
|
|
|
8594
8606
|
altText: t.name
|
|
8595
8607
|
});
|
|
8596
8608
|
}
|
|
8597
|
-
function
|
|
8609
|
+
function mp(e, t) {
|
|
8598
8610
|
Es(t.dataTransfer) && (t.preventDefault(), t.dataTransfer && (t.dataTransfer.dropEffect = "copy"));
|
|
8599
8611
|
}
|
|
8600
|
-
async function
|
|
8612
|
+
async function bp(e, t) {
|
|
8601
8613
|
var o;
|
|
8602
8614
|
if (!Es(t.dataTransfer)) return;
|
|
8603
8615
|
t.preventDefault();
|
|
8604
|
-
const n =
|
|
8616
|
+
const n = sp(t.clientX, t.clientY);
|
|
8605
8617
|
if (n) {
|
|
8606
8618
|
const i = window.getSelection();
|
|
8607
8619
|
i && (i.removeAllRanges(), i.addRange(n));
|
|
@@ -8609,7 +8621,7 @@ async function gp(e, t) {
|
|
|
8609
8621
|
const r = Array.from(((o = t.dataTransfer) == null ? void 0 : o.files) ?? []).filter((i) => i.type.startsWith("image/"));
|
|
8610
8622
|
for (const i of r) await Ns(e, i);
|
|
8611
8623
|
}
|
|
8612
|
-
function
|
|
8624
|
+
function yp(e, t, n = {}) {
|
|
8613
8625
|
e.ensureCurrent();
|
|
8614
8626
|
const r = e.checkRange(t, n.expect);
|
|
8615
8627
|
return r || at(
|
|
@@ -8618,7 +8630,7 @@ function mp(e, t, n = {}) {
|
|
|
8618
8630
|
(o) => o.flatMap((i) => $e(i, "accept"))
|
|
8619
8631
|
);
|
|
8620
8632
|
}
|
|
8621
|
-
function
|
|
8633
|
+
function wp(e, t, n = {}) {
|
|
8622
8634
|
e.ensureCurrent();
|
|
8623
8635
|
const r = e.checkRange(t, n.expect);
|
|
8624
8636
|
return r || at(
|
|
@@ -8627,17 +8639,17 @@ function bp(e, t, n = {}) {
|
|
|
8627
8639
|
(o) => o.flatMap((i) => $e(i, "reject"))
|
|
8628
8640
|
);
|
|
8629
8641
|
}
|
|
8630
|
-
function
|
|
8642
|
+
function kp(e, t, n = {}) {
|
|
8631
8643
|
e.ensureCurrent();
|
|
8632
8644
|
const r = e.checkRange(t, n.expect);
|
|
8633
8645
|
return r || at(e, t, (o) => o.map((i) => He(i, "accept")));
|
|
8634
8646
|
}
|
|
8635
|
-
function
|
|
8647
|
+
function vp(e, t, n = {}) {
|
|
8636
8648
|
e.ensureCurrent();
|
|
8637
8649
|
const r = e.checkRange(t, n.expect);
|
|
8638
8650
|
return r || at(e, t, (o) => o.map((i) => He(i, "reject")));
|
|
8639
8651
|
}
|
|
8640
|
-
function
|
|
8652
|
+
function xp(e, t) {
|
|
8641
8653
|
e.ensureCurrent();
|
|
8642
8654
|
const n = e.checkRefs([t]);
|
|
8643
8655
|
if (n) return n;
|
|
@@ -8653,7 +8665,7 @@ function kp(e, t) {
|
|
|
8653
8665
|
}
|
|
8654
8666
|
return Wn(e, r);
|
|
8655
8667
|
}
|
|
8656
|
-
function
|
|
8668
|
+
function Sp(e, t) {
|
|
8657
8669
|
e.ensureCurrent();
|
|
8658
8670
|
const n = e.checkRefs([t]);
|
|
8659
8671
|
if (n) return n;
|
|
@@ -8671,7 +8683,7 @@ function vp(e, t) {
|
|
|
8671
8683
|
}
|
|
8672
8684
|
function Wn(e, t) {
|
|
8673
8685
|
if (t <= 0)
|
|
8674
|
-
return
|
|
8686
|
+
return Ep(e, t);
|
|
8675
8687
|
const n = e.doc.body[t - 1], r = e.doc.body[t];
|
|
8676
8688
|
if (!n || !r || r.kind !== "paragraph")
|
|
8677
8689
|
return E({ code: "invalid-state", details: "current block is not a paragraph" });
|
|
@@ -8689,7 +8701,7 @@ function Wn(e, t) {
|
|
|
8689
8701
|
{ type: "remove", index: t }
|
|
8690
8702
|
]);
|
|
8691
8703
|
}
|
|
8692
|
-
function
|
|
8704
|
+
function Ep(e, t) {
|
|
8693
8705
|
const n = e.doc.body[t];
|
|
8694
8706
|
if (!n || n.kind !== "paragraph")
|
|
8695
8707
|
return E({ code: "invalid-position", details: "target is not a paragraph" });
|
|
@@ -8697,7 +8709,7 @@ function xp(e, t) {
|
|
|
8697
8709
|
const { revision: r, ...o } = n.properties, i = e.doc.body.slice();
|
|
8698
8710
|
return i[t] = { ...n, properties: o }, e.commit({ body: i }, [{ type: "bump", index: t }]);
|
|
8699
8711
|
}
|
|
8700
|
-
function
|
|
8712
|
+
function Tp(e, t) {
|
|
8701
8713
|
const n = e.doc.body[t];
|
|
8702
8714
|
if (!n || n.kind !== "paragraph")
|
|
8703
8715
|
return E({ code: "invalid-position", details: "target is not a paragraph" });
|
|
@@ -8712,7 +8724,7 @@ function Sp(e, t) {
|
|
|
8712
8724
|
properties: { ...n.properties, revision: i }
|
|
8713
8725
|
}, e.commit({ body: s }, [{ type: "bump", index: t }]);
|
|
8714
8726
|
}
|
|
8715
|
-
function
|
|
8727
|
+
function Ap(e) {
|
|
8716
8728
|
e.ensureCurrent();
|
|
8717
8729
|
const t = [];
|
|
8718
8730
|
for (let n = 0; n < e.doc.body.length; n++) {
|
|
@@ -8782,10 +8794,10 @@ function Qr(e, t, n) {
|
|
|
8782
8794
|
}
|
|
8783
8795
|
c(), l();
|
|
8784
8796
|
}
|
|
8785
|
-
function
|
|
8797
|
+
function Cp(e, t = {}) {
|
|
8786
8798
|
return Ps(e, "accept", t.author);
|
|
8787
8799
|
}
|
|
8788
|
-
function
|
|
8800
|
+
function Np(e, t = {}) {
|
|
8789
8801
|
return Ps(e, "reject", t.author);
|
|
8790
8802
|
}
|
|
8791
8803
|
function Ps(e, t, n) {
|
|
@@ -8795,7 +8807,7 @@ function Ps(e, t, n) {
|
|
|
8795
8807
|
const a = r[s];
|
|
8796
8808
|
if (!a) continue;
|
|
8797
8809
|
if (a.kind === "table") {
|
|
8798
|
-
const d =
|
|
8810
|
+
const d = Pp(a, t, n);
|
|
8799
8811
|
d.changed && (r[s] = d.next, o.push({ type: "bump", index: s }));
|
|
8800
8812
|
continue;
|
|
8801
8813
|
}
|
|
@@ -8847,7 +8859,7 @@ function Ps(e, t, n) {
|
|
|
8847
8859
|
}
|
|
8848
8860
|
return o.length === 0 ? Et(void 0, []) : e.commit({ body: r }, o);
|
|
8849
8861
|
}
|
|
8850
|
-
function
|
|
8862
|
+
function Pp(e, t, n) {
|
|
8851
8863
|
let r = !1;
|
|
8852
8864
|
const o = e.rows.map(
|
|
8853
8865
|
(i) => ({
|
|
@@ -8882,7 +8894,7 @@ function Cp(e, t, n) {
|
|
|
8882
8894
|
);
|
|
8883
8895
|
return { next: r ? { ...e, rows: o } : e, changed: r };
|
|
8884
8896
|
}
|
|
8885
|
-
function
|
|
8897
|
+
function Ip(e) {
|
|
8886
8898
|
let t = null;
|
|
8887
8899
|
const n = /* @__PURE__ */ new Set();
|
|
8888
8900
|
function r(d) {
|
|
@@ -8919,7 +8931,7 @@ function Np(e) {
|
|
|
8919
8931
|
if (e.trackChanges.enabled && h.kind === "caret" && h.at.offset === 0) {
|
|
8920
8932
|
const m = e.registry.indexOf(h.at.block.id);
|
|
8921
8933
|
if (m > 0)
|
|
8922
|
-
return
|
|
8934
|
+
return Tp(e, m).ok && Z(e, h.at.block.id, 0), !0;
|
|
8923
8935
|
}
|
|
8924
8936
|
const p = o(h);
|
|
8925
8937
|
return p ? (Lt(e, p).ok && Z(e, p.from.block.id, p.from.offset), !0) : !1;
|
|
@@ -9070,23 +9082,23 @@ function Rs(e, t) {
|
|
|
9070
9082
|
}
|
|
9071
9083
|
return null;
|
|
9072
9084
|
}
|
|
9073
|
-
function
|
|
9085
|
+
function Rp(e, t) {
|
|
9074
9086
|
return Rs(e.id, t);
|
|
9075
9087
|
}
|
|
9076
|
-
function
|
|
9088
|
+
function Fp(e) {
|
|
9077
9089
|
return e ? e.split(",").map((t) => t.trim()).filter((t) => t.length > 0) : [];
|
|
9078
9090
|
}
|
|
9079
9091
|
function Fs(e, t) {
|
|
9080
|
-
const n =
|
|
9092
|
+
const n = Fp(e.getAttribute(ns)), r = Yn(e, t) ?? void 0, o = { element: e, commentIds: n };
|
|
9081
9093
|
return r !== void 0 && (o.blockRef = r), o;
|
|
9082
9094
|
}
|
|
9083
|
-
function
|
|
9095
|
+
function Bp(e, t) {
|
|
9084
9096
|
const n = [];
|
|
9085
9097
|
for (const r of e.querySelectorAll(is))
|
|
9086
9098
|
n.push(Fs(r, t));
|
|
9087
9099
|
return n;
|
|
9088
9100
|
}
|
|
9089
|
-
function
|
|
9101
|
+
function Lp(e, t) {
|
|
9090
9102
|
const n = e.closest(is);
|
|
9091
9103
|
return n ? Fs(n, t) : null;
|
|
9092
9104
|
}
|
|
@@ -9119,7 +9131,7 @@ function Vn(e, t, n, r, o) {
|
|
|
9119
9131
|
const i = Yn(t, o) ?? void 0, s = { kind: e, element: t };
|
|
9120
9132
|
return n !== void 0 && (s.author = n), r !== void 0 && (s.date = r), i !== void 0 && (s.blockRef = i), s;
|
|
9121
9133
|
}
|
|
9122
|
-
function
|
|
9134
|
+
function Mp(e, t) {
|
|
9123
9135
|
const n = [];
|
|
9124
9136
|
for (const r of e.querySelectorAll(ld))
|
|
9125
9137
|
n.push(Bs(r, t));
|
|
@@ -9129,7 +9141,7 @@ function Bp(e, t) {
|
|
|
9129
9141
|
n.push(Ls(r, t));
|
|
9130
9142
|
return n;
|
|
9131
9143
|
}
|
|
9132
|
-
function
|
|
9144
|
+
function Op(e, t) {
|
|
9133
9145
|
const n = e.closest(`.${dn}`);
|
|
9134
9146
|
if (n) return Bs(n, t);
|
|
9135
9147
|
const r = e.closest(`.${zn}`);
|
|
@@ -9137,13 +9149,13 @@ function Lp(e, t) {
|
|
|
9137
9149
|
const o = e.closest(os);
|
|
9138
9150
|
return o ? Ms(o, t) : null;
|
|
9139
9151
|
}
|
|
9140
|
-
class
|
|
9152
|
+
class Dp {
|
|
9141
9153
|
constructor(t) {
|
|
9142
9154
|
this.host = t;
|
|
9143
9155
|
}
|
|
9144
9156
|
// --- blocks ---
|
|
9145
9157
|
elementForBlock(t) {
|
|
9146
|
-
return
|
|
9158
|
+
return Rp(t, this.host.roots());
|
|
9147
9159
|
}
|
|
9148
9160
|
elementForBlockId(t) {
|
|
9149
9161
|
return Rs(t, this.host.roots());
|
|
@@ -9157,21 +9169,21 @@ class Mp {
|
|
|
9157
9169
|
// --- revisions ---
|
|
9158
9170
|
revisionMarks(t) {
|
|
9159
9171
|
const n = this.host.registry();
|
|
9160
|
-
return (t ? [t] : this.host.roots()).flatMap((o) =>
|
|
9172
|
+
return (t ? [t] : this.host.roots()).flatMap((o) => Mp(o, n));
|
|
9161
9173
|
}
|
|
9162
9174
|
nearestRevisionMark(t) {
|
|
9163
|
-
return
|
|
9175
|
+
return Op(t, this.host.registry());
|
|
9164
9176
|
}
|
|
9165
9177
|
// --- comments ---
|
|
9166
9178
|
commentRanges(t) {
|
|
9167
9179
|
const n = this.host.registry();
|
|
9168
|
-
return (t ? [t] : this.host.roots()).flatMap((o) =>
|
|
9180
|
+
return (t ? [t] : this.host.roots()).flatMap((o) => Bp(o, n));
|
|
9169
9181
|
}
|
|
9170
9182
|
nearestCommentRange(t) {
|
|
9171
|
-
return
|
|
9183
|
+
return Lp(t, this.host.registry());
|
|
9172
9184
|
}
|
|
9173
9185
|
}
|
|
9174
|
-
class
|
|
9186
|
+
class $p {
|
|
9175
9187
|
constructor(t) {
|
|
9176
9188
|
this.ctx = t;
|
|
9177
9189
|
}
|
|
@@ -9189,13 +9201,13 @@ class Op {
|
|
|
9189
9201
|
);
|
|
9190
9202
|
}
|
|
9191
9203
|
}
|
|
9192
|
-
class
|
|
9204
|
+
class Hp {
|
|
9193
9205
|
constructor(t) {
|
|
9194
9206
|
this.editor = t;
|
|
9195
9207
|
}
|
|
9196
9208
|
/** Current selection as a model `Selection`. Returns `null` when focus is outside. */
|
|
9197
9209
|
get() {
|
|
9198
|
-
return
|
|
9210
|
+
return Nh(this.editor._hosts(), this.editor._registry());
|
|
9199
9211
|
}
|
|
9200
9212
|
/** Apply a model selection to the DOM. */
|
|
9201
9213
|
set(t) {
|
|
@@ -9222,7 +9234,7 @@ class Dp {
|
|
|
9222
9234
|
return t ? this.editor._registry().indexOf(t.id) : null;
|
|
9223
9235
|
}
|
|
9224
9236
|
}
|
|
9225
|
-
class
|
|
9237
|
+
class _p {
|
|
9226
9238
|
constructor(t) {
|
|
9227
9239
|
this.ctx = t;
|
|
9228
9240
|
}
|
|
@@ -9241,7 +9253,7 @@ class $p {
|
|
|
9241
9253
|
return this.ctx.ensureCurrent(), U(this.ctx, Si(j(this.ctx), t));
|
|
9242
9254
|
}
|
|
9243
9255
|
}
|
|
9244
|
-
const
|
|
9256
|
+
const zp = 2400;
|
|
9245
9257
|
class Os {
|
|
9246
9258
|
constructor(t) {
|
|
9247
9259
|
this.host = t;
|
|
@@ -9256,11 +9268,11 @@ class Os {
|
|
|
9256
9268
|
code: "invalid-state",
|
|
9257
9269
|
details: `supplied ${i.length} cells but table has ${o} columns`
|
|
9258
9270
|
});
|
|
9259
|
-
const s =
|
|
9271
|
+
const s = Wp(r, n);
|
|
9260
9272
|
if (s === null)
|
|
9261
9273
|
return E({ code: "invalid-position", details: "row index out of range" });
|
|
9262
|
-
const a = { cells:
|
|
9263
|
-
return c.splice(s, 0, a),
|
|
9274
|
+
const a = { cells: jp(i, o) }, c = r.rows.slice();
|
|
9275
|
+
return c.splice(s, 0, a), Vp(c, s), this.host.replaceBlock(t, { ...r, rows: c });
|
|
9264
9276
|
}
|
|
9265
9277
|
deleteRow(t, n) {
|
|
9266
9278
|
const r = this.getTable(t);
|
|
@@ -9268,18 +9280,18 @@ class Os {
|
|
|
9268
9280
|
if (n < 0 || n >= r.rows.length)
|
|
9269
9281
|
return E({ code: "invalid-position", details: `row ${n} out of range` });
|
|
9270
9282
|
const o = r.rows.slice(), i = o[n];
|
|
9271
|
-
return o.splice(n, 1), i &&
|
|
9283
|
+
return o.splice(n, 1), i && Gp(o, n, i), o.length === 0 && o.push({ cells: to(It(r)) }), this.host.replaceBlock(t, { ...r, rows: o });
|
|
9272
9284
|
}
|
|
9273
9285
|
// === column operations ===
|
|
9274
9286
|
insertColumn(t, n) {
|
|
9275
9287
|
const r = this.getTable(t);
|
|
9276
9288
|
if (!r) return E({ code: "invalid-state", details: "target is not a table" });
|
|
9277
|
-
const o = It(r), i =
|
|
9289
|
+
const o = It(r), i = Yp(o, n);
|
|
9278
9290
|
if (i === null)
|
|
9279
9291
|
return E({ code: "invalid-position", details: "column index out of range" });
|
|
9280
|
-
const s = n.widthTwips ??
|
|
9292
|
+
const s = n.widthTwips ?? Up(r) ?? zp, a = r.grid.slice();
|
|
9281
9293
|
a.splice(i, 0, s);
|
|
9282
|
-
const c = r.rows.map((l) =>
|
|
9294
|
+
const c = r.rows.map((l) => qp(l, i, !!n.split));
|
|
9283
9295
|
return this.host.replaceBlock(t, { ...r, grid: a, rows: c });
|
|
9284
9296
|
}
|
|
9285
9297
|
deleteColumn(t, n) {
|
|
@@ -9295,7 +9307,7 @@ class Os {
|
|
|
9295
9307
|
});
|
|
9296
9308
|
const i = r.grid.slice();
|
|
9297
9309
|
i.splice(n, 1);
|
|
9298
|
-
const s = r.rows.map((a) =>
|
|
9310
|
+
const s = r.rows.map((a) => Kp(a, n));
|
|
9299
9311
|
return this.host.replaceBlock(t, { ...r, grid: i, rows: s });
|
|
9300
9312
|
}
|
|
9301
9313
|
// === merge operations ===
|
|
@@ -9321,7 +9333,7 @@ class Os {
|
|
|
9321
9333
|
details: "merge region overlaps an existing merge — unmerge it first"
|
|
9322
9334
|
});
|
|
9323
9335
|
}
|
|
9324
|
-
const a = r.rows.map((c, l) => l < n.row || l >= n.row + o ? c :
|
|
9336
|
+
const a = r.rows.map((c, l) => l < n.row || l >= n.row + o ? c : Jp(c, l === n.row, n.col, i, o));
|
|
9325
9337
|
return this.host.replaceBlock(t, { ...r, rows: a });
|
|
9326
9338
|
}
|
|
9327
9339
|
unmergeCell(t) {
|
|
@@ -9332,7 +9344,7 @@ class Os {
|
|
|
9332
9344
|
const o = r.cell.gridSpan ?? 1, i = r.cell.vMerge === "restart";
|
|
9333
9345
|
if (o === 1 && !i)
|
|
9334
9346
|
return E({ code: "invalid-state", details: "cell is not merged" });
|
|
9335
|
-
const s = n.rows.map((a, c) => c < t.row ? a : c === t.row ?
|
|
9347
|
+
const s = n.rows.map((a, c) => c < t.row ? a : c === t.row ? Zp(a, t.col, o) : i ? Qp(a, t.col, o) : a);
|
|
9336
9348
|
return this.host.replaceBlock(t.table, { ...n, rows: s });
|
|
9337
9349
|
}
|
|
9338
9350
|
// === cell ops ===
|
|
@@ -9340,7 +9352,7 @@ class Os {
|
|
|
9340
9352
|
return this.updateCell(t, (r) => ({ ...r, content: n }));
|
|
9341
9353
|
}
|
|
9342
9354
|
setCellProperties(t, n) {
|
|
9343
|
-
return this.updateCell(t, (r) =>
|
|
9355
|
+
return this.updateCell(t, (r) => tg(r, n));
|
|
9344
9356
|
}
|
|
9345
9357
|
// === column / row / table ops ===
|
|
9346
9358
|
setColumnWidth(t, n, r) {
|
|
@@ -9398,21 +9410,21 @@ function ot() {
|
|
|
9398
9410
|
function to(e) {
|
|
9399
9411
|
return Array.from({ length: e }, () => ot());
|
|
9400
9412
|
}
|
|
9401
|
-
function
|
|
9413
|
+
function jp(e, t) {
|
|
9402
9414
|
const n = e.reduce((o, i) => o + (i.gridSpan ?? 1), 0);
|
|
9403
9415
|
if (n >= t) return e;
|
|
9404
9416
|
const r = t - n;
|
|
9405
9417
|
return [...e, ...Array.from({ length: r }, () => ot())];
|
|
9406
9418
|
}
|
|
9407
|
-
function
|
|
9419
|
+
function Up(e) {
|
|
9408
9420
|
if (e.grid.length === 0) return null;
|
|
9409
9421
|
const t = e.grid.reduce((n, r) => n + r, 0);
|
|
9410
9422
|
return Math.round(t / e.grid.length);
|
|
9411
9423
|
}
|
|
9412
|
-
function
|
|
9424
|
+
function Wp(e, t) {
|
|
9413
9425
|
return t.at === "start" ? 0 : t.at === "end" ? e.rows.length : t.index === void 0 || t.index < 0 || t.index >= e.rows.length ? null : t.at === "before" ? t.index : t.index + 1;
|
|
9414
9426
|
}
|
|
9415
|
-
function
|
|
9427
|
+
function Yp(e, t) {
|
|
9416
9428
|
return t.at === "start" ? 0 : t.at === "end" ? e : t.index === void 0 || t.index < 0 || t.index >= e ? null : t.at === "before" ? t.index : t.index + 1;
|
|
9417
9429
|
}
|
|
9418
9430
|
function bt(e, t, n) {
|
|
@@ -9429,17 +9441,17 @@ function bt(e, t, n) {
|
|
|
9429
9441
|
}
|
|
9430
9442
|
return null;
|
|
9431
9443
|
}
|
|
9432
|
-
function
|
|
9444
|
+
function Vp(e, t) {
|
|
9433
9445
|
if (t === 0 || t === e.length - 0) return;
|
|
9434
9446
|
const n = e[t], r = e[t - 1], o = e[t + 1];
|
|
9435
9447
|
if (!n || !r || !o) return;
|
|
9436
9448
|
let i = 0;
|
|
9437
9449
|
for (const s of r.cells) {
|
|
9438
9450
|
const a = s.gridSpan ?? 1, c = s.vMerge === "restart" || s.vMerge === "continue", l = bt({ rows: e }, 1, i), u = (l == null ? void 0 : l.cell.vMerge) === "continue";
|
|
9439
|
-
c && u &&
|
|
9451
|
+
c && u && Xp(n, i, a), i += a;
|
|
9440
9452
|
}
|
|
9441
9453
|
}
|
|
9442
|
-
function
|
|
9454
|
+
function Xp(e, t, n) {
|
|
9443
9455
|
var s;
|
|
9444
9456
|
let r = 0, o = e.cells.length;
|
|
9445
9457
|
for (let a = 0; a < e.cells.length; a++) {
|
|
@@ -9455,7 +9467,7 @@ function Yp(e, t, n) {
|
|
|
9455
9467
|
};
|
|
9456
9468
|
n > 1 && (i.gridSpan = n), e.cells.splice(o, 0, i);
|
|
9457
9469
|
}
|
|
9458
|
-
function
|
|
9470
|
+
function Gp(e, t, n) {
|
|
9459
9471
|
let r = 0;
|
|
9460
9472
|
for (const o of n.cells) {
|
|
9461
9473
|
const i = o.gridSpan ?? 1;
|
|
@@ -9480,7 +9492,7 @@ function Vp(e, t, n) {
|
|
|
9480
9492
|
r += i;
|
|
9481
9493
|
}
|
|
9482
9494
|
}
|
|
9483
|
-
function
|
|
9495
|
+
function qp(e, t, n) {
|
|
9484
9496
|
let r = 0;
|
|
9485
9497
|
const o = [];
|
|
9486
9498
|
let i = !1;
|
|
@@ -9505,7 +9517,7 @@ function Xp(e, t, n) {
|
|
|
9505
9517
|
}
|
|
9506
9518
|
return i || o.push(ot()), { ...e, cells: o };
|
|
9507
9519
|
}
|
|
9508
|
-
function
|
|
9520
|
+
function Kp(e, t) {
|
|
9509
9521
|
let n = 0;
|
|
9510
9522
|
const r = [];
|
|
9511
9523
|
for (let o = 0; o < e.cells.length; o++) {
|
|
@@ -9523,7 +9535,7 @@ function Gp(e, t) {
|
|
|
9523
9535
|
}
|
|
9524
9536
|
return { ...e, cells: r };
|
|
9525
9537
|
}
|
|
9526
|
-
function
|
|
9538
|
+
function Jp(e, t, n, r, o) {
|
|
9527
9539
|
let i = 0;
|
|
9528
9540
|
const s = [];
|
|
9529
9541
|
for (let a = 0; a < e.cells.length; a++) {
|
|
@@ -9549,7 +9561,7 @@ function qp(e, t, n, r, o) {
|
|
|
9549
9561
|
}
|
|
9550
9562
|
return { ...e, cells: s };
|
|
9551
9563
|
}
|
|
9552
|
-
function
|
|
9564
|
+
function Zp(e, t, n) {
|
|
9553
9565
|
let r = 0;
|
|
9554
9566
|
const o = [];
|
|
9555
9567
|
for (let i = 0; i < e.cells.length; i++) {
|
|
@@ -9566,7 +9578,7 @@ function Kp(e, t, n) {
|
|
|
9566
9578
|
}
|
|
9567
9579
|
return { ...e, cells: o };
|
|
9568
9580
|
}
|
|
9569
|
-
function
|
|
9581
|
+
function Qp(e, t, n) {
|
|
9570
9582
|
let r = 0;
|
|
9571
9583
|
const o = [];
|
|
9572
9584
|
for (let i = 0; i < e.cells.length; i++) {
|
|
@@ -9581,7 +9593,7 @@ function Jp(e, t, n) {
|
|
|
9581
9593
|
}
|
|
9582
9594
|
return { ...e, cells: o };
|
|
9583
9595
|
}
|
|
9584
|
-
function
|
|
9596
|
+
function tg(e, t) {
|
|
9585
9597
|
const n = { ...e }, r = [
|
|
9586
9598
|
"gridSpan",
|
|
9587
9599
|
"vMerge",
|
|
@@ -9592,18 +9604,18 @@ function Zp(e, t) {
|
|
|
9592
9604
|
for (const o of r)
|
|
9593
9605
|
if (o in t) {
|
|
9594
9606
|
const i = t[o];
|
|
9595
|
-
i === void 0 ? delete n[o] :
|
|
9607
|
+
i === void 0 ? delete n[o] : eg(n, o, i);
|
|
9596
9608
|
}
|
|
9597
9609
|
return n;
|
|
9598
9610
|
}
|
|
9599
|
-
function
|
|
9611
|
+
function eg(e, t, n) {
|
|
9600
9612
|
t === "gridSpan" && typeof n == "number" ? e.gridSpan = n : t === "vMerge" && (n === "restart" || n === "continue") ? e.vMerge = n : t === "verticalAlign" && typeof n == "string" ? e.verticalAlign = n : t === "shading" ? e.shading = n : t === "borders" && (e.borders = n);
|
|
9601
9613
|
}
|
|
9602
9614
|
const Ds = "application/x-sobree-blocks+json";
|
|
9603
|
-
function
|
|
9615
|
+
function ng(e) {
|
|
9604
9616
|
return JSON.stringify({ v: 1, blocks: e });
|
|
9605
9617
|
}
|
|
9606
|
-
function
|
|
9618
|
+
function rg(e) {
|
|
9607
9619
|
if (!e) return null;
|
|
9608
9620
|
let t;
|
|
9609
9621
|
try {
|
|
@@ -9622,10 +9634,10 @@ function $s(e) {
|
|
|
9622
9634
|
function Hs(e) {
|
|
9623
9635
|
return e.kind === "text" ? e.text : e.kind === "hyperlink" ? e.children.map(Hs).join("") : "";
|
|
9624
9636
|
}
|
|
9625
|
-
function
|
|
9637
|
+
function og(e) {
|
|
9626
9638
|
return e.kind !== "paragraph" ? -1 : e.runs.reduce((t, n) => t + (n.kind === "text" ? n.text.length : 1), 0);
|
|
9627
9639
|
}
|
|
9628
|
-
function
|
|
9640
|
+
function ig(e) {
|
|
9629
9641
|
const t = _s(e);
|
|
9630
9642
|
return t ? e.doc.body.slice(t.lo, t.hi + 1).map(Xn) : null;
|
|
9631
9643
|
}
|
|
@@ -9638,18 +9650,18 @@ function _s(e) {
|
|
|
9638
9650
|
if (o !== i) return { lo: o, hi: i };
|
|
9639
9651
|
const s = e.doc.body[o];
|
|
9640
9652
|
if (!s) return null;
|
|
9641
|
-
const a =
|
|
9653
|
+
const a = og(s), c = Math.min(t.range.from.offset, t.range.to.offset), l = Math.max(t.range.from.offset, t.range.to.offset);
|
|
9642
9654
|
return a >= 0 && c === 0 && l >= a ? { lo: o, hi: i } : null;
|
|
9643
9655
|
}
|
|
9644
9656
|
function zs(e, t) {
|
|
9645
|
-
e.clipboardData && (e.preventDefault(), e.clipboardData.setData(Ds,
|
|
9657
|
+
e.clipboardData && (e.preventDefault(), e.clipboardData.setData(Ds, ng(t)), e.clipboardData.setData("text/plain", t.map($s).join(`
|
|
9646
9658
|
`)));
|
|
9647
9659
|
}
|
|
9648
|
-
function
|
|
9649
|
-
const n =
|
|
9660
|
+
function sg(e, t) {
|
|
9661
|
+
const n = ig(e);
|
|
9650
9662
|
n && zs(t, n);
|
|
9651
9663
|
}
|
|
9652
|
-
function
|
|
9664
|
+
function ag(e, t) {
|
|
9653
9665
|
const n = _s(e);
|
|
9654
9666
|
if (!n || !t.clipboardData) return;
|
|
9655
9667
|
zs(t, e.doc.body.slice(n.lo, n.hi + 1).map(Xn));
|
|
@@ -9660,14 +9672,14 @@ function ig(e, t) {
|
|
|
9660
9672
|
const o = Math.min(n.lo, e.doc.body.length - 1);
|
|
9661
9673
|
o >= 0 && e.selection.set({ kind: "caret", at: { block: e.registry.refAt(o), offset: 0 } });
|
|
9662
9674
|
}
|
|
9663
|
-
function
|
|
9675
|
+
function cg(e, t) {
|
|
9664
9676
|
var r;
|
|
9665
|
-
const n =
|
|
9666
|
-
return n ? (t.preventDefault(),
|
|
9677
|
+
const n = rg((r = t.clipboardData) == null ? void 0 : r.getData(Ds));
|
|
9678
|
+
return n ? (t.preventDefault(), lg(e, n), !0) : !1;
|
|
9667
9679
|
}
|
|
9668
|
-
function
|
|
9680
|
+
function lg(e, t) {
|
|
9669
9681
|
e.ensureCurrent();
|
|
9670
|
-
const n =
|
|
9682
|
+
const n = ug(e);
|
|
9671
9683
|
if (!n) return;
|
|
9672
9684
|
let r = e.registry.refById(n);
|
|
9673
9685
|
if (r) {
|
|
@@ -9679,7 +9691,7 @@ function ag(e, t) {
|
|
|
9679
9691
|
e.selection.set({ kind: "caret", at: { block: r, offset: 0 } });
|
|
9680
9692
|
}
|
|
9681
9693
|
}
|
|
9682
|
-
function
|
|
9694
|
+
function ug(e) {
|
|
9683
9695
|
const t = e.selection.get();
|
|
9684
9696
|
if ((t == null ? void 0 : t.kind) === "caret") return t.at.block.id;
|
|
9685
9697
|
if ((t == null ? void 0 : t.kind) === "range") return t.range.to.block.id;
|
|
@@ -9689,7 +9701,7 @@ function cg(e) {
|
|
|
9689
9701
|
function Xn(e) {
|
|
9690
9702
|
return JSON.parse(JSON.stringify(e));
|
|
9691
9703
|
}
|
|
9692
|
-
function
|
|
9704
|
+
function fg(e) {
|
|
9693
9705
|
let t = null, n = null;
|
|
9694
9706
|
const r = (u) => {
|
|
9695
9707
|
const f = u.target;
|
|
@@ -9703,7 +9715,7 @@ function lg(e) {
|
|
|
9703
9715
|
c();
|
|
9704
9716
|
return;
|
|
9705
9717
|
}
|
|
9706
|
-
a(), t = u, u.classList.add("is-selected"), n =
|
|
9718
|
+
a(), t = u, u.classList.add("is-selected"), n = dg(), e.appendChild(n), n.addEventListener("mousedown", l), c();
|
|
9707
9719
|
}, a = () => {
|
|
9708
9720
|
t && t.classList.remove("is-selected"), t = null, n && (n.removeEventListener("mousedown", l), n.remove(), n = null);
|
|
9709
9721
|
}, c = () => {
|
|
@@ -9729,11 +9741,11 @@ function lg(e) {
|
|
|
9729
9741
|
a(), e.removeEventListener("click", r), window.removeEventListener("scroll", o, { capture: !0 }), window.removeEventListener("resize", i);
|
|
9730
9742
|
};
|
|
9731
9743
|
}
|
|
9732
|
-
function
|
|
9744
|
+
function dg() {
|
|
9733
9745
|
const e = document.createElement("div");
|
|
9734
9746
|
return e.className = "sobree-image-resize-handle", e.setAttribute("contenteditable", "false"), e;
|
|
9735
9747
|
}
|
|
9736
|
-
function
|
|
9748
|
+
function hg(e) {
|
|
9737
9749
|
const { host: t } = e, n = [], r = (s, a, c) => {
|
|
9738
9750
|
s.addEventListener(a, c), n.push(() => s.removeEventListener(a, c));
|
|
9739
9751
|
};
|
|
@@ -9758,10 +9770,10 @@ function fg(e) {
|
|
|
9758
9770
|
t,
|
|
9759
9771
|
"compositionend",
|
|
9760
9772
|
(s) => e.trackedInput.handleCompositionEnd(s)
|
|
9761
|
-
), r(document, "selectionchange", () => e.fireSelection()), r(t, "keydown", (s) => e.fireKeyDown(s)), r(t, "copy", (s) =>
|
|
9762
|
-
|
|
9763
|
-
}), r(t, "dragover", (s) =>
|
|
9764
|
-
const o =
|
|
9773
|
+
), r(document, "selectionchange", () => e.fireSelection()), r(t, "keydown", (s) => e.fireKeyDown(s)), r(t, "copy", (s) => sg(e.ctx, s)), r(t, "cut", (s) => ag(e.ctx, s)), r(t, "paste", (s) => {
|
|
9774
|
+
cg(e.ctx, s) || e.trackedInput.onPaste(s);
|
|
9775
|
+
}), r(t, "dragover", (s) => mp(e.ctx, s)), r(t, "drop", (s) => void bp(e.ctx, s));
|
|
9776
|
+
const o = fg(t);
|
|
9765
9777
|
n.push(o);
|
|
9766
9778
|
const i = (s) => {
|
|
9767
9779
|
s.origin === "local" || s.origin === "seed" || e.adoptYDocState();
|
|
@@ -9771,10 +9783,10 @@ function fg(e) {
|
|
|
9771
9783
|
e.trackedInput.reset();
|
|
9772
9784
|
};
|
|
9773
9785
|
}
|
|
9774
|
-
function
|
|
9786
|
+
function pg(e) {
|
|
9775
9787
|
return e ? { ...e } : { enabled: !1 };
|
|
9776
9788
|
}
|
|
9777
|
-
class
|
|
9789
|
+
class gg {
|
|
9778
9790
|
constructor(t, n = {}) {
|
|
9779
9791
|
w(this, "host");
|
|
9780
9792
|
w(this, "selection");
|
|
@@ -9918,12 +9930,12 @@ class hg {
|
|
|
9918
9930
|
* `./context.ts`.
|
|
9919
9931
|
*/
|
|
9920
9932
|
w(this, "ctx");
|
|
9921
|
-
this.host = t, this.debounceMs = n.changeDebounceMs ?? 200, this.getContentHosts = n.contentHosts ?? (() => [t]), this.trackChanges =
|
|
9933
|
+
this.host = t, this.debounceMs = n.changeDebounceMs ?? 200, this.getContentHosts = n.contentHosts ?? (() => [t]), this.trackChanges = pg(n.trackChanges), this.ydoc = n.ydoc ?? new L.Doc();
|
|
9922
9934
|
const o = `${this.ydoc.clientID.toString(36)}_`;
|
|
9923
|
-
this.registry = new Gi({ idPrefix: o }), this.blobStore = n.blobStore ?? null, this.blobCache = this.createBlobCache(), this.selection = new
|
|
9935
|
+
this.registry = new Gi({ idPrefix: o }), this.blobStore = n.blobStore ?? null, this.blobCache = this.createBlobCache(), this.selection = new Hp(this), this.renderedDocument = new Dp({
|
|
9924
9936
|
roots: () => this.getContentHosts(),
|
|
9925
9937
|
registry: () => this.registry
|
|
9926
|
-
}), this.table = new Os(this), this.commands = new Wi(), this.history = this.createHistory(), this.ctx = this.buildContext(), this.frames = new
|
|
9938
|
+
}), this.table = new Os(this), this.commands = new Wi(), this.history = this.createHistory(), this.ctx = this.buildContext(), this.frames = new Yh(this.ctx), this.pipeline = new _h(this.ctx, this.events, this.frames, this.debounceMs), this.sections = new $p(this.ctx), this.styles = new _p(this.ctx), this.numbering = new Vh(this.ctx), this.trackedInput = Ip(this.ctx), this.initDocumentState(n), ed(this.commands, this, this.history), this.mountHost(n), this.domTeardown = hg(this.buildDomHooks());
|
|
9927
9939
|
}
|
|
9928
9940
|
/**
|
|
9929
9941
|
* Optional content-hashed blob layer. The cache's `onResolved` callback
|
|
@@ -10133,7 +10145,7 @@ class hg {
|
|
|
10133
10145
|
}
|
|
10134
10146
|
/** Render current document to an HTML string. */
|
|
10135
10147
|
toHtml() {
|
|
10136
|
-
return
|
|
10148
|
+
return Zh(this.ctx);
|
|
10137
10149
|
}
|
|
10138
10150
|
// === block-level queries ===
|
|
10139
10151
|
getBlocks() {
|
|
@@ -10147,12 +10159,12 @@ class hg {
|
|
|
10147
10159
|
return Ut(this.ctx, t);
|
|
10148
10160
|
}
|
|
10149
10161
|
getOutline() {
|
|
10150
|
-
return
|
|
10162
|
+
return Qh(this.ctx);
|
|
10151
10163
|
}
|
|
10152
10164
|
// === core mutations (BlockRef / Position / Range in; EditResult out) ===
|
|
10153
10165
|
/** Replace the block at `target`'s index with `block`. */
|
|
10154
10166
|
replaceBlock(t, n) {
|
|
10155
|
-
return
|
|
10167
|
+
return Xh(this.ctx, t, n);
|
|
10156
10168
|
}
|
|
10157
10169
|
/**
|
|
10158
10170
|
* Insert `block` before the target block. Returns the new ref. In
|
|
@@ -10160,7 +10172,7 @@ class hg {
|
|
|
10160
10172
|
* non-paragraph blocks insert plain.
|
|
10161
10173
|
*/
|
|
10162
10174
|
insertBlockBefore(t, n) {
|
|
10163
|
-
return
|
|
10175
|
+
return Gh(this.ctx, t, n);
|
|
10164
10176
|
}
|
|
10165
10177
|
/** Insert `block` after the target block. Returns the new ref. */
|
|
10166
10178
|
insertBlockAfter(t, n) {
|
|
@@ -10176,7 +10188,7 @@ class hg {
|
|
|
10176
10188
|
}
|
|
10177
10189
|
/** Merge a patch into each target paragraph's properties. */
|
|
10178
10190
|
applyBlockProperties(t, n) {
|
|
10179
|
-
return
|
|
10191
|
+
return qh(this.ctx, t, n);
|
|
10180
10192
|
}
|
|
10181
10193
|
/**
|
|
10182
10194
|
* Apply run-level properties across `range`.
|
|
@@ -10194,7 +10206,7 @@ class hg {
|
|
|
10194
10206
|
}
|
|
10195
10207
|
/** Wrap the runs in `range` with semantic formatting. */
|
|
10196
10208
|
wrapRange(t, n, r = {}) {
|
|
10197
|
-
return
|
|
10209
|
+
return dp(this.ctx, t, n, r);
|
|
10198
10210
|
}
|
|
10199
10211
|
/**
|
|
10200
10212
|
* Insert a run at `at`. In track-changes mode the run is stamped
|
|
@@ -10277,19 +10289,19 @@ class hg {
|
|
|
10277
10289
|
* range slightly wider than the change.
|
|
10278
10290
|
*/
|
|
10279
10291
|
acceptRevision(t, n = {}) {
|
|
10280
|
-
return
|
|
10292
|
+
return yp(this.ctx, t, n);
|
|
10281
10293
|
}
|
|
10282
10294
|
/** Reject the tracked changes inside `range`. Inverse of `acceptRevision`. */
|
|
10283
10295
|
rejectRevision(t, n = {}) {
|
|
10284
|
-
return
|
|
10296
|
+
return wp(this.ctx, t, n);
|
|
10285
10297
|
}
|
|
10286
10298
|
/** Accept tracked format changes inside `range` (drop the snapshot). */
|
|
10287
10299
|
acceptFormatRevision(t, n = {}) {
|
|
10288
|
-
return
|
|
10300
|
+
return kp(this.ctx, t, n);
|
|
10289
10301
|
}
|
|
10290
10302
|
/** Reject tracked format changes inside `range` (revert to `before`). */
|
|
10291
10303
|
rejectFormatRevision(t, n = {}) {
|
|
10292
|
-
return
|
|
10304
|
+
return vp(this.ctx, t, n);
|
|
10293
10305
|
}
|
|
10294
10306
|
/**
|
|
10295
10307
|
* Accept the paragraph-mark revision on `target`. `ins` strips the
|
|
@@ -10297,14 +10309,14 @@ class hg {
|
|
|
10297
10309
|
* previous one.
|
|
10298
10310
|
*/
|
|
10299
10311
|
acceptParagraphRevision(t) {
|
|
10300
|
-
return
|
|
10312
|
+
return xp(this.ctx, t);
|
|
10301
10313
|
}
|
|
10302
10314
|
/**
|
|
10303
10315
|
* Reject the paragraph-mark revision on `target`. `ins` undoes the
|
|
10304
10316
|
* split (merge into previous); `del` strips the marker.
|
|
10305
10317
|
*/
|
|
10306
10318
|
rejectParagraphRevision(t) {
|
|
10307
|
-
return
|
|
10319
|
+
return Sp(this.ctx, t);
|
|
10308
10320
|
}
|
|
10309
10321
|
/**
|
|
10310
10322
|
* Enumerate every logical tracked change. Consecutive same-author
|
|
@@ -10312,26 +10324,26 @@ class hg {
|
|
|
10312
10324
|
* refs. Re-query after each `change`.
|
|
10313
10325
|
*/
|
|
10314
10326
|
getRevisions() {
|
|
10315
|
-
return
|
|
10327
|
+
return Ap(this.ctx);
|
|
10316
10328
|
}
|
|
10317
10329
|
/**
|
|
10318
10330
|
* Accept every tracked change in the document (optionally filtered by
|
|
10319
10331
|
* `opts.author`). One commit for the whole sweep.
|
|
10320
10332
|
*/
|
|
10321
10333
|
acceptAllRevisions(t = {}) {
|
|
10322
|
-
return
|
|
10334
|
+
return Cp(this.ctx, t);
|
|
10323
10335
|
}
|
|
10324
10336
|
/** Reject every tracked change (optionally filtered by author). */
|
|
10325
10337
|
rejectAllRevisions(t = {}) {
|
|
10326
|
-
return
|
|
10338
|
+
return Np(this.ctx, t);
|
|
10327
10339
|
}
|
|
10328
10340
|
/** Mark comment `id` resolved (`Comment.done = true`). */
|
|
10329
10341
|
resolveComment(t) {
|
|
10330
|
-
return
|
|
10342
|
+
return Kh(this.ctx, t);
|
|
10331
10343
|
}
|
|
10332
10344
|
/** Re-open a resolved comment `id` (`Comment.done = false`). */
|
|
10333
10345
|
reopenComment(t) {
|
|
10334
|
-
return
|
|
10346
|
+
return Jh(this.ctx, t);
|
|
10335
10347
|
}
|
|
10336
10348
|
// === AtSelection sugar — DOM-aware convenience wrappers ===
|
|
10337
10349
|
setBlockPropertiesAtSelection(t) {
|
|
@@ -10355,7 +10367,7 @@ class hg {
|
|
|
10355
10367
|
* re-render.
|
|
10356
10368
|
*/
|
|
10357
10369
|
clearInlineFormattingAtSelection() {
|
|
10358
|
-
|
|
10370
|
+
gp(this.ctx);
|
|
10359
10371
|
}
|
|
10360
10372
|
// === events + lifecycle ===
|
|
10361
10373
|
on(t, n) {
|
|
@@ -10378,7 +10390,7 @@ class hg {
|
|
|
10378
10390
|
}
|
|
10379
10391
|
/** @internal */
|
|
10380
10392
|
_blockElementAt(t) {
|
|
10381
|
-
return
|
|
10393
|
+
return Fh(this._hosts(), t);
|
|
10382
10394
|
}
|
|
10383
10395
|
// === internals ===
|
|
10384
10396
|
checkRefs(t) {
|
|
@@ -10434,7 +10446,7 @@ function Qe(e) {
|
|
|
10434
10446
|
const n = Number(t[1]);
|
|
10435
10447
|
return Number.isFinite(n) ? n : null;
|
|
10436
10448
|
}
|
|
10437
|
-
function
|
|
10449
|
+
function mg(e) {
|
|
10438
10450
|
const t = /* @__PURE__ */ new Map();
|
|
10439
10451
|
for (const n of e) {
|
|
10440
10452
|
for (const r of Array.from(n.footnotes.querySelectorAll("li[id^='sobree-footnote-']"))) {
|
|
@@ -10471,7 +10483,7 @@ function pg(e) {
|
|
|
10471
10483
|
i.children.length > 0 && (n.footnotes.appendChild(i), n.footnotes.classList.remove("is-empty"));
|
|
10472
10484
|
}
|
|
10473
10485
|
}
|
|
10474
|
-
function
|
|
10486
|
+
function bg(e, t) {
|
|
10475
10487
|
const n = [];
|
|
10476
10488
|
for (const r of e) {
|
|
10477
10489
|
const o = r.footnotes.classList.contains("is-empty") ? 0 : r.footnotes.offsetHeight;
|
|
@@ -10483,19 +10495,19 @@ function gg(e, t) {
|
|
|
10483
10495
|
}
|
|
10484
10496
|
function tn(e, t, n, r) {
|
|
10485
10497
|
const o = r.pageHeight - n.heightAt;
|
|
10486
|
-
return r.underfullWeight * o * o + n.ownCost + bn(e, t, n, r) +
|
|
10498
|
+
return r.underfullWeight * o * o + n.ownCost + bn(e, t, n, r) + yg(e, n) + wg(e, n, r);
|
|
10487
10499
|
}
|
|
10488
10500
|
function bn(e, t, n, r) {
|
|
10489
10501
|
const o = Zt(e, n.pageEnd), i = Ct(e, n.nextStart);
|
|
10490
10502
|
if (!o || !i || !o.paragraphId || o.paragraphId !== i.paragraphId) return 0;
|
|
10491
|
-
const s = o.paragraphId, a =
|
|
10503
|
+
const s = o.paragraphId, a = kg(e, t, n.pageEnd, s), c = vg(e, n.nextStart, s);
|
|
10492
10504
|
return a < r.orphans || c < r.widows ? r.widowOrphanPenalty : 0;
|
|
10493
10505
|
}
|
|
10494
|
-
function
|
|
10506
|
+
function yg(e, t) {
|
|
10495
10507
|
const n = Zt(e, t.pageEnd), r = Ct(e, t.nextStart);
|
|
10496
10508
|
return !n || !r || !n.keepWithNext || n.paragraphId && n.paragraphId === r.paragraphId ? 0 : Number.POSITIVE_INFINITY;
|
|
10497
10509
|
}
|
|
10498
|
-
function
|
|
10510
|
+
function wg(e, t, n) {
|
|
10499
10511
|
const r = Zt(e, t.pageEnd), o = Ct(e, t.nextStart);
|
|
10500
10512
|
return !r || !o ? 0 : r.paragraphId && r.paragraphId === o.paragraphId && r.keepTogether ? n.keepPenalty : 0;
|
|
10501
10513
|
}
|
|
@@ -10513,7 +10525,7 @@ function Ct(e, t) {
|
|
|
10513
10525
|
}
|
|
10514
10526
|
return null;
|
|
10515
10527
|
}
|
|
10516
|
-
function
|
|
10528
|
+
function kg(e, t, n, r) {
|
|
10517
10529
|
let o = 0;
|
|
10518
10530
|
for (let i = n - 1; i >= t; i--) {
|
|
10519
10531
|
const s = e[i];
|
|
@@ -10523,7 +10535,7 @@ function yg(e, t, n, r) {
|
|
|
10523
10535
|
}
|
|
10524
10536
|
return o;
|
|
10525
10537
|
}
|
|
10526
|
-
function
|
|
10538
|
+
function vg(e, t, n) {
|
|
10527
10539
|
let r = 0;
|
|
10528
10540
|
for (let o = t; o < e.length; o++) {
|
|
10529
10541
|
const i = e[o];
|
|
@@ -10533,7 +10545,7 @@ function wg(e, t, n) {
|
|
|
10533
10545
|
}
|
|
10534
10546
|
return r;
|
|
10535
10547
|
}
|
|
10536
|
-
function
|
|
10548
|
+
function xg(e, t) {
|
|
10537
10549
|
const n = e[t];
|
|
10538
10550
|
if (!n || n.type !== "box" || !n.paragraphId)
|
|
10539
10551
|
return n && "height" in n ? n.height : 0;
|
|
@@ -10556,15 +10568,15 @@ function kg(e, t) {
|
|
|
10556
10568
|
}
|
|
10557
10569
|
return o;
|
|
10558
10570
|
}
|
|
10559
|
-
function
|
|
10571
|
+
function Sg(e, t) {
|
|
10560
10572
|
const n = Zt(e, t), r = Ct(e, t + 1);
|
|
10561
10573
|
return !!(n && r);
|
|
10562
10574
|
}
|
|
10563
|
-
function
|
|
10575
|
+
function Eg(e, t) {
|
|
10564
10576
|
const n = Zt(e, t), r = Ct(e, t + 1);
|
|
10565
10577
|
return !n || !r || !n.paragraphId || n.paragraphId !== r.paragraphId ? !1 : !!n.keepTogether;
|
|
10566
10578
|
}
|
|
10567
|
-
function
|
|
10579
|
+
function Tg(e, t, n, r, o) {
|
|
10568
10580
|
if (bn(e, t, n, o) === 0) return n;
|
|
10569
10581
|
const i = r.indexOf(n);
|
|
10570
10582
|
for (let s = i - 1; s >= 0; s--) {
|
|
@@ -10589,7 +10601,7 @@ const Rt = {
|
|
|
10589
10601
|
widowOrphanPenalty: 1e4,
|
|
10590
10602
|
keepPenalty: 1e4
|
|
10591
10603
|
};
|
|
10592
|
-
function
|
|
10604
|
+
function Ag(e) {
|
|
10593
10605
|
return {
|
|
10594
10606
|
pageHeight: e.pageHeight,
|
|
10595
10607
|
...e.pageHeights ? { pageHeights: e.pageHeights } : {},
|
|
@@ -10600,21 +10612,21 @@ function Eg(e) {
|
|
|
10600
10612
|
keepPenalty: e.keepPenalty ?? Rt.keepPenalty
|
|
10601
10613
|
};
|
|
10602
10614
|
}
|
|
10603
|
-
function
|
|
10615
|
+
function Cg(e, t) {
|
|
10604
10616
|
var n;
|
|
10605
10617
|
return ((n = e.pageHeights) == null ? void 0 : n[t]) ?? e.pageHeight;
|
|
10606
10618
|
}
|
|
10607
|
-
function
|
|
10608
|
-
const n =
|
|
10619
|
+
function Ng(e, t) {
|
|
10620
|
+
const n = Ag(t), r = [];
|
|
10609
10621
|
let o = 0;
|
|
10610
10622
|
for (; o < e.length; ) {
|
|
10611
|
-
const i = { ...n, pageHeight:
|
|
10623
|
+
const i = { ...n, pageHeight: Cg(n, r.length) }, s = Pg(e, o, i);
|
|
10612
10624
|
if (r.push(s.page), s.next <= o) break;
|
|
10613
10625
|
o = s.next;
|
|
10614
10626
|
}
|
|
10615
10627
|
return r;
|
|
10616
10628
|
}
|
|
10617
|
-
function
|
|
10629
|
+
function Pg(e, t, n) {
|
|
10618
10630
|
let r = 0;
|
|
10619
10631
|
const o = [];
|
|
10620
10632
|
let i = t;
|
|
@@ -10628,7 +10640,7 @@ function Cg(e, t, n) {
|
|
|
10628
10640
|
continue;
|
|
10629
10641
|
}
|
|
10630
10642
|
if (s.type === "glue") {
|
|
10631
|
-
if (
|
|
10643
|
+
if (Sg(e, i) && !Eg(e, i) && o.push({
|
|
10632
10644
|
pageEnd: i + 1,
|
|
10633
10645
|
nextStart: i + 1,
|
|
10634
10646
|
heightAt: r,
|
|
@@ -10649,7 +10661,7 @@ function Cg(e, t, n) {
|
|
|
10649
10661
|
next: i + 1
|
|
10650
10662
|
};
|
|
10651
10663
|
if (a.isFirstLineOfParagraph && a.keepTogether) {
|
|
10652
|
-
const c =
|
|
10664
|
+
const c = xg(e, i);
|
|
10653
10665
|
if (c > n.pageHeight)
|
|
10654
10666
|
console.warn(
|
|
10655
10667
|
`paginate: keepTogether paragraph (height ${c}) exceeds pageHeight (${n.pageHeight}). Falling back to normal breaking.`
|
|
@@ -10673,7 +10685,7 @@ function he(e, t, n, r, o) {
|
|
|
10673
10685
|
const f = tn(e, t, u, o);
|
|
10674
10686
|
f < s && (i = u, s = f);
|
|
10675
10687
|
}
|
|
10676
|
-
const a =
|
|
10688
|
+
const a = Tg(e, t, i, r, o), c = a === i ? s : tn(e, t, a, o);
|
|
10677
10689
|
return Pe(e, t, a.pageEnd, c, a.nextStart);
|
|
10678
10690
|
}
|
|
10679
10691
|
function Pe(e, t, n, r, o) {
|
|
@@ -10681,13 +10693,13 @@ function Pe(e, t, n, r, o) {
|
|
|
10681
10693
|
return {
|
|
10682
10694
|
page: {
|
|
10683
10695
|
items: i,
|
|
10684
|
-
usedHeight:
|
|
10696
|
+
usedHeight: Ig(i),
|
|
10685
10697
|
cost: r
|
|
10686
10698
|
},
|
|
10687
10699
|
next: o
|
|
10688
10700
|
};
|
|
10689
10701
|
}
|
|
10690
|
-
function
|
|
10702
|
+
function Ig(e) {
|
|
10691
10703
|
var r;
|
|
10692
10704
|
let t = -1;
|
|
10693
10705
|
for (let o = e.length - 1; o >= 0; o--)
|
|
@@ -10704,7 +10716,7 @@ function Ng(e) {
|
|
|
10704
10716
|
return n;
|
|
10705
10717
|
}
|
|
10706
10718
|
function js(e) {
|
|
10707
|
-
const t =
|
|
10719
|
+
const t = Bg(e);
|
|
10708
10720
|
if (t === 0)
|
|
10709
10721
|
return [
|
|
10710
10722
|
{
|
|
@@ -10736,7 +10748,7 @@ function js(e) {
|
|
|
10736
10748
|
];
|
|
10737
10749
|
const s = [0];
|
|
10738
10750
|
for (let c = 1; c < o.length; c++)
|
|
10739
|
-
s.push(
|
|
10751
|
+
s.push(Rg(e, c, t));
|
|
10740
10752
|
const a = i / o.length;
|
|
10741
10753
|
return o.map((c, l) => ({
|
|
10742
10754
|
lineIndex: l,
|
|
@@ -10745,16 +10757,16 @@ function js(e) {
|
|
|
10745
10757
|
endCharOffset: s[l + 1] ?? t
|
|
10746
10758
|
}));
|
|
10747
10759
|
}
|
|
10748
|
-
function
|
|
10760
|
+
function Rg(e, t, n) {
|
|
10749
10761
|
const r = document.createRange();
|
|
10750
10762
|
let o = 1, i = n;
|
|
10751
10763
|
for (; o < i; ) {
|
|
10752
10764
|
const s = o + i >>> 1;
|
|
10753
|
-
|
|
10765
|
+
Fg(e, s, r) > t ? i = s : o = s + 1;
|
|
10754
10766
|
}
|
|
10755
10767
|
return Math.max(0, o - 1);
|
|
10756
10768
|
}
|
|
10757
|
-
function
|
|
10769
|
+
function Fg(e, t, n) {
|
|
10758
10770
|
const r = Us(e, t);
|
|
10759
10771
|
return r ? (n.setStart(e, 0), n.setEnd(r.node, r.offset), Ws(Array.from(n.getClientRects())).length) : 1;
|
|
10760
10772
|
}
|
|
@@ -10773,7 +10785,7 @@ function Us(e, t) {
|
|
|
10773
10785
|
}
|
|
10774
10786
|
return null;
|
|
10775
10787
|
}
|
|
10776
|
-
function
|
|
10788
|
+
function Bg(e) {
|
|
10777
10789
|
const t = document.createTreeWalker(e, NodeFilter.SHOW_TEXT);
|
|
10778
10790
|
let n = 0, r = t.nextNode();
|
|
10779
10791
|
for (; r; )
|
|
@@ -10784,20 +10796,20 @@ function Ws(e) {
|
|
|
10784
10796
|
const t = [];
|
|
10785
10797
|
for (const n of e) {
|
|
10786
10798
|
if (n.width === 0 && n.height === 0) continue;
|
|
10787
|
-
const r = Math.round(n.top), o = t.find((i) => Math.abs(i.top - r) <=
|
|
10799
|
+
const r = Math.round(n.top), o = t.find((i) => Math.abs(i.top - r) <= Lg);
|
|
10788
10800
|
o ? o.bottom = Math.max(o.bottom, n.bottom) : t.push({ top: r, bottom: n.bottom });
|
|
10789
10801
|
}
|
|
10790
10802
|
return t.sort((n, r) => n.top - r.top);
|
|
10791
10803
|
}
|
|
10792
|
-
const
|
|
10793
|
-
function
|
|
10804
|
+
const Lg = 5;
|
|
10805
|
+
function Mg(e) {
|
|
10794
10806
|
const t = [];
|
|
10795
10807
|
let n = 0;
|
|
10796
10808
|
for (let r = 0; r < e.length; r++) {
|
|
10797
10809
|
const o = e[r];
|
|
10798
10810
|
if (!o) continue;
|
|
10799
10811
|
const i = getComputedStyle(o), s = i.position === "absolute" || i.position === "fixed", a = s ? 0 : Math.max(0, o.offsetTop - n);
|
|
10800
|
-
(r > 0 || a > 0) && t.push({ type: "glue", height: a }),
|
|
10812
|
+
(r > 0 || a > 0) && t.push({ type: "glue", height: a }), jg(o) ? (t.push({ type: "penalty", cost: Number.NEGATIVE_INFINITY }), t.push({ type: "box", height: 0, el: o, monolithic: !0 })) : Ug(o) ? (Ft(o) && t.push({ type: "penalty", cost: Number.NEGATIVE_INFINITY }), t.push(ct(o, { monolithic: !0 }))) : o.tagName === "P" ? (Ft(o) && t.push({ type: "penalty", cost: Number.NEGATIVE_INFINITY }), t.push(...Xs(o, Ys(o)))) : o.tagName === "OL" || o.tagName === "UL" ? (Ft(o) && t.push({ type: "penalty", cost: Number.NEGATIVE_INFINITY }), t.push(..._g(o, Og(o)))) : o.tagName === "TABLE" ? (Ft(o) && t.push({ type: "penalty", cost: Number.NEGATIVE_INFINITY }), t.push(...$g(o, Dg(o)))) : (Ft(o) && t.push({ type: "penalty", cost: Number.NEGATIVE_INFINITY }), t.push(ct(o, zg(o)))), s || (n = o.offsetTop + o.offsetHeight);
|
|
10801
10813
|
}
|
|
10802
10814
|
return t;
|
|
10803
10815
|
}
|
|
@@ -10807,19 +10819,19 @@ function Ys(e) {
|
|
|
10807
10819
|
const n = `p${Math.random().toString(36).slice(2, 10)}`;
|
|
10808
10820
|
return e.dataset.pagPid = n, n;
|
|
10809
10821
|
}
|
|
10810
|
-
function
|
|
10822
|
+
function Og(e) {
|
|
10811
10823
|
const t = e.dataset.pagLid;
|
|
10812
10824
|
if (t) return t;
|
|
10813
10825
|
const n = `l${Math.random().toString(36).slice(2, 10)}`;
|
|
10814
10826
|
return e.dataset.pagLid = n, n;
|
|
10815
10827
|
}
|
|
10816
|
-
function
|
|
10828
|
+
function Dg(e) {
|
|
10817
10829
|
const t = e.dataset.pagTid;
|
|
10818
10830
|
if (t) return t;
|
|
10819
10831
|
const n = `t${Math.random().toString(36).slice(2, 10)}`;
|
|
10820
10832
|
return e.dataset.pagTid = n, n;
|
|
10821
10833
|
}
|
|
10822
|
-
function
|
|
10834
|
+
function $g(e, t) {
|
|
10823
10835
|
const n = [];
|
|
10824
10836
|
for (const i of ["thead", "tbody"])
|
|
10825
10837
|
for (const s of e.querySelectorAll(`:scope > ${i}`))
|
|
@@ -10833,11 +10845,11 @@ function Og(e, t) {
|
|
|
10833
10845
|
const r = 360, o = [];
|
|
10834
10846
|
for (let i = 0; i < n.length; i++) {
|
|
10835
10847
|
const s = n[i];
|
|
10836
|
-
s.offsetHeight > r ? o.push(...
|
|
10848
|
+
s.offsetHeight > r ? o.push(...Hg(s)) : o.push(ct(s, { monolithic: !0 })), i < n.length - 1 && o.push({ type: "glue", height: 0 });
|
|
10837
10849
|
}
|
|
10838
10850
|
return o;
|
|
10839
10851
|
}
|
|
10840
|
-
function
|
|
10852
|
+
function Hg(e) {
|
|
10841
10853
|
const t = Array.from(e.children).filter(
|
|
10842
10854
|
(c) => c.tagName === "TD" || c.tagName === "TH"
|
|
10843
10855
|
);
|
|
@@ -10874,7 +10886,7 @@ function Vs(e) {
|
|
|
10874
10886
|
n instanceof HTMLElement && (n.tagName === "P" || n.tagName === "OL" || n.tagName === "UL") && t.push(n);
|
|
10875
10887
|
return t;
|
|
10876
10888
|
}
|
|
10877
|
-
function
|
|
10889
|
+
function _g(e, t) {
|
|
10878
10890
|
const n = Array.from(e.children).filter((o) => o.tagName === "LI");
|
|
10879
10891
|
if (n.length === 0)
|
|
10880
10892
|
return [ct(e, {})];
|
|
@@ -10926,7 +10938,7 @@ function ct(e, t) {
|
|
|
10926
10938
|
...t
|
|
10927
10939
|
};
|
|
10928
10940
|
}
|
|
10929
|
-
function
|
|
10941
|
+
function zg(e) {
|
|
10930
10942
|
const t = e.tagName.toLowerCase(), n = {};
|
|
10931
10943
|
return /^h[1-6]$/.test(t) && (n.keepWithNext = !0), e.hasAttribute("data-keep-next") && (n.keepWithNext = !0), t === "pre" && (n.monolithic = !0), n;
|
|
10932
10944
|
}
|
|
@@ -10936,16 +10948,16 @@ function Gn(e) {
|
|
|
10936
10948
|
const n = Number.parseFloat(t.marginTop) || 0;
|
|
10937
10949
|
return e.offsetHeight + n;
|
|
10938
10950
|
}
|
|
10939
|
-
function
|
|
10951
|
+
function jg(e) {
|
|
10940
10952
|
return e.classList.contains("page-break") || e.hasAttribute("data-page-break");
|
|
10941
10953
|
}
|
|
10942
10954
|
function Ft(e) {
|
|
10943
10955
|
return e.hasAttribute("data-page-break-before");
|
|
10944
10956
|
}
|
|
10945
|
-
function
|
|
10957
|
+
function Ug(e) {
|
|
10946
10958
|
return !!(e.tagName === "FIGURE" || e.classList.contains("keep-together") || e.hasAttribute("data-keep-together"));
|
|
10947
10959
|
}
|
|
10948
|
-
function
|
|
10960
|
+
function Wg(e, t) {
|
|
10949
10961
|
var s;
|
|
10950
10962
|
const n = Us(e, t);
|
|
10951
10963
|
if (!n) return e;
|
|
@@ -10956,13 +10968,13 @@ function jg(e, t) {
|
|
|
10956
10968
|
i.setAttribute(a.name, a.value);
|
|
10957
10969
|
return i.appendChild(o), i.dataset.pagContinuation = "1", (s = e.parentNode) == null || s.insertBefore(i, e.nextSibling), i;
|
|
10958
10970
|
}
|
|
10959
|
-
function
|
|
10971
|
+
function Yg(e, t) {
|
|
10960
10972
|
const n = e.textContent ?? "";
|
|
10961
10973
|
for (let r = Math.min(t, n.length) - 1; r >= 0; r--)
|
|
10962
10974
|
if (/\s/.test(n[r] ?? "")) return r + 1;
|
|
10963
10975
|
return 0;
|
|
10964
10976
|
}
|
|
10965
|
-
function
|
|
10977
|
+
function Vg(e) {
|
|
10966
10978
|
var c;
|
|
10967
10979
|
const t = /* @__PURE__ */ new Map();
|
|
10968
10980
|
for (let l = 0; l < e.length; l++)
|
|
@@ -10975,13 +10987,13 @@ function Wg(e) {
|
|
|
10975
10987
|
}
|
|
10976
10988
|
const n = /* @__PURE__ */ new Map();
|
|
10977
10989
|
for (const [l, u] of t)
|
|
10978
|
-
n.set(l,
|
|
10979
|
-
|
|
10990
|
+
n.set(l, Jg(l, u));
|
|
10991
|
+
Xg(n);
|
|
10980
10992
|
const r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set();
|
|
10981
10993
|
for (const [l] of n) {
|
|
10982
10994
|
if (l.tagName !== "LI") continue;
|
|
10983
10995
|
const u = l.parentElement;
|
|
10984
|
-
!u || !no(u) || o.has(u) || (o.add(u),
|
|
10996
|
+
!u || !no(u) || o.has(u) || (o.add(u), qg(u, r));
|
|
10985
10997
|
}
|
|
10986
10998
|
const i = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), a = [];
|
|
10987
10999
|
for (let l = 0; l < e.length; l++) {
|
|
@@ -10998,7 +11010,7 @@ function Wg(e) {
|
|
|
10998
11010
|
f.push(x), d = null, h = null, p = null, y = null;
|
|
10999
11011
|
continue;
|
|
11000
11012
|
}
|
|
11001
|
-
A !== d && (h = ro(A), f.push(h), d = A, i.add(A), p = null, y = null), S !== p && (y =
|
|
11013
|
+
A !== d && (h = ro(A), f.push(h), d = A, i.add(A), p = null, y = null), S !== p && (y = Gg(S), h.querySelector(":scope > tbody").appendChild(y), p = S, s.add(S));
|
|
11002
11014
|
const I = x.closest("td, th");
|
|
11003
11015
|
if (!I) {
|
|
11004
11016
|
f.push(x);
|
|
@@ -11026,7 +11038,7 @@ function Wg(e) {
|
|
|
11026
11038
|
}
|
|
11027
11039
|
if (S !== d) {
|
|
11028
11040
|
const A = r.get(x) ?? Gs(S);
|
|
11029
|
-
h =
|
|
11041
|
+
h = Kg(S, A), f.push(h), d = S, i.add(S);
|
|
11030
11042
|
}
|
|
11031
11043
|
x.dataset.pagContinuation === "1" ? x.classList.add("sobree-li-continuation") : x.classList.remove("sobree-li-continuation"), h.appendChild(x);
|
|
11032
11044
|
} else if (x.tagName === "TR" && !v.cellTr) {
|
|
@@ -11063,7 +11075,7 @@ function Wg(e) {
|
|
|
11063
11075
|
} else l.children.length === 0 && l.parentElement && l.parentElement.removeChild(l);
|
|
11064
11076
|
return a;
|
|
11065
11077
|
}
|
|
11066
|
-
function
|
|
11078
|
+
function Xg(e) {
|
|
11067
11079
|
for (const [, t] of e) {
|
|
11068
11080
|
const n = Array.from(t.keys()).sort((r, o) => r - o);
|
|
11069
11081
|
for (let r = 0; r < n.length - 1; r++) {
|
|
@@ -11075,7 +11087,7 @@ function Yg(e) {
|
|
|
11075
11087
|
function no(e) {
|
|
11076
11088
|
return e.tagName === "OL" || e.tagName === "UL";
|
|
11077
11089
|
}
|
|
11078
|
-
function
|
|
11090
|
+
function Gg(e) {
|
|
11079
11091
|
const t = document.createElement("tr");
|
|
11080
11092
|
for (const n of Array.from(e.attributes))
|
|
11081
11093
|
t.setAttribute(n.name, n.value);
|
|
@@ -11108,7 +11120,7 @@ function Gs(e) {
|
|
|
11108
11120
|
const n = Number.parseInt(t, 10);
|
|
11109
11121
|
return Number.isFinite(n) ? n : 1;
|
|
11110
11122
|
}
|
|
11111
|
-
function
|
|
11123
|
+
function qg(e, t) {
|
|
11112
11124
|
let n = Gs(e), r, o = !1;
|
|
11113
11125
|
for (const i of Array.from(e.children)) {
|
|
11114
11126
|
if (i.tagName !== "LI") continue;
|
|
@@ -11116,13 +11128,13 @@ function Xg(e, t) {
|
|
|
11116
11128
|
o ? (!a || a !== r) && (n += 1) : o = !0, t.set(s, n), r = a;
|
|
11117
11129
|
}
|
|
11118
11130
|
}
|
|
11119
|
-
function
|
|
11131
|
+
function Kg(e, t) {
|
|
11120
11132
|
const n = document.createElement(e.tagName.toLowerCase());
|
|
11121
11133
|
for (const r of Array.from(e.attributes))
|
|
11122
11134
|
r.name !== "start" && n.setAttribute(r.name, r.value);
|
|
11123
11135
|
return e.tagName === "OL" && n.setAttribute("start", String(t)), n;
|
|
11124
11136
|
}
|
|
11125
|
-
function
|
|
11137
|
+
function Jg(e, t) {
|
|
11126
11138
|
var c;
|
|
11127
11139
|
const n = Array.from(t.keys()).sort((l, u) => l - u), r = /* @__PURE__ */ new Map(), o = [];
|
|
11128
11140
|
let i = t.get(n[0]);
|
|
@@ -11135,26 +11147,26 @@ function qg(e, t) {
|
|
|
11135
11147
|
for (const l of o) {
|
|
11136
11148
|
const u = l - a, d = (c = js(s)[u]) == null ? void 0 : c.startCharOffset;
|
|
11137
11149
|
if (d === void 0 || d === 0) continue;
|
|
11138
|
-
const h =
|
|
11150
|
+
const h = Yg(s, d);
|
|
11139
11151
|
if (h === 0) continue;
|
|
11140
|
-
const p =
|
|
11152
|
+
const p = Wg(s, h);
|
|
11141
11153
|
r.set(t.get(l), p), s = p, a = l;
|
|
11142
11154
|
}
|
|
11143
11155
|
return r;
|
|
11144
11156
|
}
|
|
11145
|
-
function
|
|
11157
|
+
function Zg(e, t, n) {
|
|
11146
11158
|
if (e.length === 0) return [];
|
|
11147
|
-
const r =
|
|
11159
|
+
const r = Mg(e), o = Ng(r, {
|
|
11148
11160
|
pageHeight: t,
|
|
11149
11161
|
...n ? { pageHeights: n } : {}
|
|
11150
11162
|
});
|
|
11151
|
-
return
|
|
11163
|
+
return Vg(o);
|
|
11152
11164
|
}
|
|
11153
|
-
const
|
|
11165
|
+
const Qg = 48;
|
|
11154
11166
|
function oo(e) {
|
|
11155
11167
|
return e ? e.split(",").map((t) => Number.parseFloat(t)).filter((t) => Number.isFinite(t)) : [];
|
|
11156
11168
|
}
|
|
11157
|
-
function
|
|
11169
|
+
function tm(e) {
|
|
11158
11170
|
const t = oo(e.dataset.colWidthsMm);
|
|
11159
11171
|
if (t.length >= 2)
|
|
11160
11172
|
return { kind: "explicit", widthsMm: t, gapsMm: oo(e.dataset.colGapsMm) };
|
|
@@ -11165,11 +11177,11 @@ function Zg(e) {
|
|
|
11165
11177
|
}
|
|
11166
11178
|
return null;
|
|
11167
11179
|
}
|
|
11168
|
-
function
|
|
11180
|
+
function em(e) {
|
|
11169
11181
|
return e.kind === "explicit" ? e.widthsMm.length : e.count;
|
|
11170
11182
|
}
|
|
11171
|
-
function
|
|
11172
|
-
const t =
|
|
11183
|
+
function nm(e) {
|
|
11184
|
+
const t = em(e), n = [];
|
|
11173
11185
|
for (let r = 0; r < t; r++) {
|
|
11174
11186
|
const o = document.createElement("div");
|
|
11175
11187
|
if (o.className = "sobree-col", e.kind === "explicit") {
|
|
@@ -11192,7 +11204,7 @@ function Ie(e) {
|
|
|
11192
11204
|
o instanceof HTMLElement && n.push(o);
|
|
11193
11205
|
return n;
|
|
11194
11206
|
}
|
|
11195
|
-
function
|
|
11207
|
+
function rm(e) {
|
|
11196
11208
|
const t = [];
|
|
11197
11209
|
let n = 0;
|
|
11198
11210
|
for (; n < e.length; ) {
|
|
@@ -11208,7 +11220,7 @@ function em(e) {
|
|
|
11208
11220
|
}
|
|
11209
11221
|
return t;
|
|
11210
11222
|
}
|
|
11211
|
-
function
|
|
11223
|
+
function om(e, t, n, r) {
|
|
11212
11224
|
for (; t.length > 0; ) {
|
|
11213
11225
|
const o = t[0];
|
|
11214
11226
|
if (e.appendChild(o), e.offsetHeight > n && e.childElementCount > (r ? 1 : 0)) {
|
|
@@ -11218,7 +11230,7 @@ function nm(e, t, n, r) {
|
|
|
11218
11230
|
t.shift();
|
|
11219
11231
|
}
|
|
11220
11232
|
}
|
|
11221
|
-
function
|
|
11233
|
+
function im(e, t, n) {
|
|
11222
11234
|
for (; e.childElementCount > 1; ) {
|
|
11223
11235
|
const r = e.offsetHeight, o = r > n;
|
|
11224
11236
|
if (!o && r <= t.offsetHeight) break;
|
|
@@ -11229,49 +11241,50 @@ function rm(e, t, n) {
|
|
|
11229
11241
|
}
|
|
11230
11242
|
}
|
|
11231
11243
|
}
|
|
11232
|
-
function
|
|
11244
|
+
function sm(e, t) {
|
|
11233
11245
|
const n = Array.from(e.querySelectorAll(":scope > .sobree-col"));
|
|
11234
11246
|
if (n.length < 2) return;
|
|
11235
11247
|
const r = Ie(e);
|
|
11236
11248
|
n[0].replaceChildren(...r);
|
|
11237
11249
|
for (let o = 1; o < n.length; o++) n[o].replaceChildren();
|
|
11238
11250
|
for (let o = 0; o < n.length - 1; o++)
|
|
11239
|
-
|
|
11251
|
+
im(n[o], n[o + 1], t);
|
|
11240
11252
|
}
|
|
11241
|
-
function
|
|
11253
|
+
function am(e, t, n) {
|
|
11254
|
+
if (e.dataset.colPageStart === "1") return 0;
|
|
11242
11255
|
const r = e.getBoundingClientRect().top - t.getBoundingClientRect().top;
|
|
11243
11256
|
return r > 0 ? r % n : 0;
|
|
11244
11257
|
}
|
|
11245
|
-
function
|
|
11246
|
-
const r =
|
|
11258
|
+
function cm(e, t, n) {
|
|
11259
|
+
const r = tm(e);
|
|
11247
11260
|
if (!r) return;
|
|
11248
11261
|
const o = Ie(e);
|
|
11249
11262
|
if (o.length === 0) return;
|
|
11250
|
-
const i =
|
|
11263
|
+
const i = am(e, t, n), s = n - i < Qg ? n : n - i, a = [];
|
|
11251
11264
|
let c = e, l = s;
|
|
11252
11265
|
for (; ; ) {
|
|
11253
|
-
const u =
|
|
11266
|
+
const u = nm(r);
|
|
11254
11267
|
c.replaceChildren(...u);
|
|
11255
11268
|
for (let d = 0; d < u.length && o.length > 0; d++)
|
|
11256
|
-
|
|
11269
|
+
om(u[d], o, l, d === 0);
|
|
11257
11270
|
if (a.push(c), o.length === 0) break;
|
|
11258
11271
|
const f = e.cloneNode(!1);
|
|
11259
11272
|
c.after(f), c = f, l = n;
|
|
11260
11273
|
}
|
|
11261
|
-
|
|
11274
|
+
e.dataset.colFill !== "1" && sm(a[a.length - 1], n);
|
|
11262
11275
|
}
|
|
11263
|
-
function
|
|
11276
|
+
function lm(e, t) {
|
|
11264
11277
|
const n = Array.from(e.querySelectorAll(".sobree-cols"));
|
|
11265
|
-
for (const r of
|
|
11266
|
-
|
|
11278
|
+
for (const r of rm(n))
|
|
11279
|
+
cm(r, e, t);
|
|
11267
11280
|
}
|
|
11268
|
-
function
|
|
11281
|
+
function um(e, t) {
|
|
11269
11282
|
return {
|
|
11270
|
-
xEmu:
|
|
11271
|
-
yEmu:
|
|
11283
|
+
xEmu: dm(e, t) + e.offsetXEmu,
|
|
11284
|
+
yEmu: fm(e, t) + e.offsetYEmu
|
|
11272
11285
|
};
|
|
11273
11286
|
}
|
|
11274
|
-
function
|
|
11287
|
+
function fm(e, t) {
|
|
11275
11288
|
switch (e.anchor.verticalFrom) {
|
|
11276
11289
|
case "page":
|
|
11277
11290
|
return 0;
|
|
@@ -11281,7 +11294,7 @@ function lm(e, t) {
|
|
|
11281
11294
|
return t.anchorParaTopEmu ?? t.marginTopEmu;
|
|
11282
11295
|
}
|
|
11283
11296
|
}
|
|
11284
|
-
function
|
|
11297
|
+
function dm(e, t) {
|
|
11285
11298
|
switch (e.anchor.horizontalFrom) {
|
|
11286
11299
|
case "page":
|
|
11287
11300
|
return 0;
|
|
@@ -11293,7 +11306,7 @@ function um(e, t) {
|
|
|
11293
11306
|
return t.marginLeftEmu;
|
|
11294
11307
|
}
|
|
11295
11308
|
}
|
|
11296
|
-
function
|
|
11309
|
+
function hm(e, t) {
|
|
11297
11310
|
const n = document.createElement("div");
|
|
11298
11311
|
n.className = "paper-anchors", n.style.position = "absolute", n.style.inset = "0", n.style.isolation = "isolate", n.style.pointerEvents = "none";
|
|
11299
11312
|
for (const r of e)
|
|
@@ -11302,35 +11315,35 @@ function fm(e, t) {
|
|
|
11302
11315
|
}
|
|
11303
11316
|
function qs(e, t) {
|
|
11304
11317
|
const n = document.createElement("div");
|
|
11305
|
-
return n.className = "paper-anchor", n.dataset.anchorId = e.id, n.style.position = "absolute", n.style.left = `${H(e.offsetXEmu)}mm`, n.style.top = `${H(e.offsetYEmu)}mm`, n.style.width = `${H(e.widthEmu)}mm`, n.style.height = `${H(e.heightEmu)}mm`, n.style.overflow = "hidden", n.style.boxSizing = "border-box", e.zIndex !== void 0 && (n.style.zIndex = String(e.zIndex)), n.style.pointerEvents = "none",
|
|
11318
|
+
return n.className = "paper-anchor", n.dataset.anchorId = e.id, n.style.position = "absolute", n.style.left = `${H(e.offsetXEmu)}mm`, n.style.top = `${H(e.offsetYEmu)}mm`, n.style.width = `${H(e.widthEmu)}mm`, n.style.height = `${H(e.heightEmu)}mm`, n.style.overflow = "hidden", n.style.boxSizing = "border-box", e.zIndex !== void 0 && (n.style.zIndex = String(e.zIndex)), n.style.pointerEvents = "none", pm(n, e, t), n;
|
|
11306
11319
|
}
|
|
11307
|
-
function
|
|
11320
|
+
function pm(e, t, n) {
|
|
11308
11321
|
const r = t.content;
|
|
11309
11322
|
switch (r.kind) {
|
|
11310
11323
|
case "picture":
|
|
11311
|
-
|
|
11324
|
+
gm(e, r, n);
|
|
11312
11325
|
break;
|
|
11313
11326
|
case "shape":
|
|
11314
|
-
|
|
11327
|
+
mm(e, r);
|
|
11315
11328
|
break;
|
|
11316
11329
|
case "textbox":
|
|
11317
|
-
|
|
11330
|
+
ym(e, r, n);
|
|
11318
11331
|
break;
|
|
11319
11332
|
case "group":
|
|
11320
|
-
|
|
11333
|
+
wm(e, r, t.widthEmu, t.heightEmu, n);
|
|
11321
11334
|
break;
|
|
11322
11335
|
}
|
|
11323
11336
|
}
|
|
11324
|
-
function
|
|
11325
|
-
const r =
|
|
11337
|
+
function gm(e, t, n) {
|
|
11338
|
+
const r = km(t.partPath, n);
|
|
11326
11339
|
if (!r) return;
|
|
11327
11340
|
const o = document.createElement("img");
|
|
11328
11341
|
o.src = r, o.alt = t.altText ?? "", o.style.width = "100%", o.style.height = "100%", o.style.display = "block", o.style.objectFit = "fill", e.appendChild(o);
|
|
11329
11342
|
}
|
|
11330
11343
|
const io = "http://www.w3.org/2000/svg";
|
|
11331
|
-
function
|
|
11344
|
+
function mm(e, t) {
|
|
11332
11345
|
if (t.geometry === "custom" && t.path) {
|
|
11333
|
-
|
|
11346
|
+
bm(e, t.path, t.fill);
|
|
11334
11347
|
return;
|
|
11335
11348
|
}
|
|
11336
11349
|
switch (t.fill && (e.style.background = t.fill), t.border && Ks(e, t.border), t.geometry) {
|
|
@@ -11342,13 +11355,13 @@ function pm(e, t) {
|
|
|
11342
11355
|
break;
|
|
11343
11356
|
}
|
|
11344
11357
|
}
|
|
11345
|
-
function
|
|
11358
|
+
function bm(e, t, n) {
|
|
11346
11359
|
const r = document.createElementNS(io, "svg");
|
|
11347
11360
|
r.setAttribute("viewBox", `0 0 ${t.widthEmu} ${t.heightEmu}`), r.setAttribute("preserveAspectRatio", "none"), r.style.width = "100%", r.style.height = "100%", r.style.display = "block";
|
|
11348
11361
|
const o = document.createElementNS(io, "path");
|
|
11349
11362
|
o.setAttribute("d", t.d), o.setAttribute("fill", n ?? "currentColor"), o.setAttribute("fill-rule", "evenodd"), r.appendChild(o), e.appendChild(r);
|
|
11350
11363
|
}
|
|
11351
|
-
function
|
|
11364
|
+
function ym(e, t, n) {
|
|
11352
11365
|
if (n.editable && (e.contentEditable = "true", e.dataset.anchorTextbox = "", e.style.pointerEvents = "auto", e.style.cursor = "text", e.style.outline = "none"), t.fill && (e.style.background = t.fill), t.border && Ks(e, t.border), t.padding) {
|
|
11353
11366
|
const r = t.padding;
|
|
11354
11367
|
e.style.padding = `${H(r.topEmu)}mm ${H(r.rightEmu)}mm ${H(r.bottomEmu)}mm ${H(r.leftEmu)}mm`;
|
|
@@ -11362,7 +11375,7 @@ function mm(e, t, n) {
|
|
|
11362
11375
|
o.style.margin = "0", o.textContent = r.runs.map((i) => i.kind === "text" ? i.text : "").join(""), e.appendChild(o);
|
|
11363
11376
|
}
|
|
11364
11377
|
}
|
|
11365
|
-
function
|
|
11378
|
+
function wm(e, t, n, r, o) {
|
|
11366
11379
|
const i = t.childCoordOffsetX ?? 0, s = t.childCoordOffsetY ?? 0, a = t.childCoordSystemCx > 0 ? n / t.childCoordSystemCx : 1, c = t.childCoordSystemCy > 0 ? r / t.childCoordSystemCy : 1;
|
|
11367
11380
|
for (const l of t.children) {
|
|
11368
11381
|
const u = qs(
|
|
@@ -11382,15 +11395,15 @@ function Ks(e, t) {
|
|
|
11382
11395
|
const n = Math.max(1, Math.round(us(t.widthEmu)));
|
|
11383
11396
|
e.style.border = `${n}px ${t.style} ${t.color}`;
|
|
11384
11397
|
}
|
|
11385
|
-
function
|
|
11398
|
+
function km(e, t) {
|
|
11386
11399
|
const n = t.pictureUrlCache.get(e);
|
|
11387
11400
|
if (n) return n;
|
|
11388
11401
|
const r = t.rawParts[e];
|
|
11389
11402
|
if (!r) return null;
|
|
11390
|
-
const o =
|
|
11403
|
+
const o = vm(e), i = new Blob([new Uint8Array(r)], { type: o }), s = URL.createObjectURL(i);
|
|
11391
11404
|
return t.pictureUrlCache.set(e, s), s;
|
|
11392
11405
|
}
|
|
11393
|
-
function
|
|
11406
|
+
function vm(e) {
|
|
11394
11407
|
switch (e.toLowerCase().split(".").pop()) {
|
|
11395
11408
|
case "png":
|
|
11396
11409
|
return "image/png";
|
|
@@ -11412,25 +11425,25 @@ function so(e, t) {
|
|
|
11412
11425
|
e.classList.add("is-empty");
|
|
11413
11426
|
return;
|
|
11414
11427
|
}
|
|
11415
|
-
vt(t.blocks, e, t.numbering, t.styles, t.rawParts),
|
|
11428
|
+
vt(t.blocks, e, t.numbering, t.styles, t.rawParts), xm(e, t.pageNumber, t.totalPages);
|
|
11416
11429
|
const n = (e.textContent ?? "").trim().length > 0 || e.querySelector("img, svg, table, .sobree-field") !== null;
|
|
11417
11430
|
e.classList.toggle("is-empty", !n);
|
|
11418
11431
|
}
|
|
11419
11432
|
function ht(e, t, n) {
|
|
11420
|
-
const r =
|
|
11433
|
+
const r = hm(t, n);
|
|
11421
11434
|
e.replaceChildren(...Array.from(r.children)), e.classList.toggle("is-empty", t.length === 0);
|
|
11422
11435
|
}
|
|
11423
11436
|
function ao(e, t) {
|
|
11424
11437
|
e.textContent = t, e.classList.toggle("is-empty", t.trim() === "");
|
|
11425
11438
|
}
|
|
11426
|
-
function
|
|
11439
|
+
function xm(e, t, n) {
|
|
11427
11440
|
const r = e.querySelectorAll("span.sobree-field");
|
|
11428
11441
|
for (const o of Array.from(r)) {
|
|
11429
11442
|
const i = Lo(o.dataset.field ?? "");
|
|
11430
11443
|
i === "PAGE" ? o.textContent = String(t) : i === "NUMPAGES" && (o.textContent = String(n));
|
|
11431
11444
|
}
|
|
11432
11445
|
}
|
|
11433
|
-
class
|
|
11446
|
+
class Sm {
|
|
11434
11447
|
constructor(t, n) {
|
|
11435
11448
|
/**
|
|
11436
11449
|
* Outer row container — holds the paper card + the right-side
|
|
@@ -11593,7 +11606,7 @@ class vm {
|
|
|
11593
11606
|
);
|
|
11594
11607
|
l && (s = co(l, this.root) * me);
|
|
11595
11608
|
}
|
|
11596
|
-
const { xEmu: a, yEmu: c } =
|
|
11609
|
+
const { xEmu: a, yEmu: c } = um(i, {
|
|
11597
11610
|
marginTopEmu: r,
|
|
11598
11611
|
marginLeftEmu: o,
|
|
11599
11612
|
anchorParaTopEmu: s
|
|
@@ -11664,13 +11677,13 @@ function co(e, t) {
|
|
|
11664
11677
|
n += r.offsetTop, r = r.offsetParent;
|
|
11665
11678
|
return n;
|
|
11666
11679
|
}
|
|
11667
|
-
const
|
|
11680
|
+
const Em = 96 / 25.4;
|
|
11668
11681
|
function pe(e) {
|
|
11669
11682
|
const t = e.trim();
|
|
11670
11683
|
if (!t) return 0;
|
|
11671
11684
|
if (t.endsWith("mm")) {
|
|
11672
11685
|
const n = Number(t.slice(0, -2));
|
|
11673
|
-
return Number.isFinite(n) ? n *
|
|
11686
|
+
return Number.isFinite(n) ? n * Em : 0;
|
|
11674
11687
|
}
|
|
11675
11688
|
if (t.endsWith("px")) {
|
|
11676
11689
|
const n = Number(t.slice(0, -2));
|
|
@@ -11679,9 +11692,9 @@ function pe(e) {
|
|
|
11679
11692
|
return 0;
|
|
11680
11693
|
}
|
|
11681
11694
|
function lo(e, t) {
|
|
11682
|
-
t === "center" || t === "bottom" || t === "both" ? (e.style.display = "flex", e.style.flexDirection = "column", e.style.justifyContent =
|
|
11695
|
+
t === "center" || t === "bottom" || t === "both" ? (e.style.display = "flex", e.style.flexDirection = "column", e.style.justifyContent = Tm(t)) : (e.style.display = "", e.style.flexDirection = "", e.style.justifyContent = "");
|
|
11683
11696
|
}
|
|
11684
|
-
function
|
|
11697
|
+
function Tm(e) {
|
|
11685
11698
|
switch (e) {
|
|
11686
11699
|
case "center":
|
|
11687
11700
|
return "center";
|
|
@@ -11693,31 +11706,31 @@ function Sm(e) {
|
|
|
11693
11706
|
return "flex-start";
|
|
11694
11707
|
}
|
|
11695
11708
|
}
|
|
11696
|
-
const
|
|
11697
|
-
function
|
|
11709
|
+
const Am = 3, Cm = 28;
|
|
11710
|
+
function Nm(e) {
|
|
11698
11711
|
if (e.collectAllBlocks().length === 0) {
|
|
11699
11712
|
e.ensurePaperCount(1), e.renderAllZones(), e.emitPaginate();
|
|
11700
11713
|
return;
|
|
11701
11714
|
}
|
|
11702
11715
|
const n = e.captureSelection(), r = e.pageContentHeightPx();
|
|
11703
11716
|
let o = [];
|
|
11704
|
-
for (let i = 0; i <=
|
|
11717
|
+
for (let i = 0; i <= Am; i++) {
|
|
11705
11718
|
e.runPaginationOnce(r, o), e.distributeFootnotes();
|
|
11706
|
-
const s = e.footnotePageHeights(r), a =
|
|
11719
|
+
const s = e.footnotePageHeights(r), a = Pm(s, o);
|
|
11707
11720
|
o = s;
|
|
11708
11721
|
const c = e.maxPaperOverflowPx();
|
|
11709
|
-
if (a && c <=
|
|
11722
|
+
if (a && c <= Cm) break;
|
|
11710
11723
|
}
|
|
11711
11724
|
e.restoreSelection(n), e.renderAllZones(), e.applyPerSectionSettings(), e.emitPaginate();
|
|
11712
11725
|
}
|
|
11713
|
-
function
|
|
11726
|
+
function Pm(e, t) {
|
|
11714
11727
|
if (e.length !== t.length) return !1;
|
|
11715
11728
|
for (let n = 0; n < e.length; n++)
|
|
11716
11729
|
if (e[n] !== t[n]) return !1;
|
|
11717
11730
|
return !0;
|
|
11718
11731
|
}
|
|
11719
|
-
const
|
|
11720
|
-
class
|
|
11732
|
+
const Im = 96 / 25.4;
|
|
11733
|
+
class Rm {
|
|
11721
11734
|
constructor(t, n) {
|
|
11722
11735
|
w(this, "root");
|
|
11723
11736
|
w(this, "papers", []);
|
|
@@ -11858,7 +11871,7 @@ class Pm {
|
|
|
11858
11871
|
* flow instead of accumulating inter-fragment margins.
|
|
11859
11872
|
*/
|
|
11860
11873
|
repaginate() {
|
|
11861
|
-
|
|
11874
|
+
Nm(this.repaginationHost);
|
|
11862
11875
|
}
|
|
11863
11876
|
/** Adapter exposing the DOM-owning steps the repagination orchestrator
|
|
11864
11877
|
* needs, without making PaperStack's internals public. Caret save/restore
|
|
@@ -11870,12 +11883,12 @@ class Pm {
|
|
|
11870
11883
|
ensurePaperCount: (t) => this.ensurePaperCount(t),
|
|
11871
11884
|
pageContentHeightPx: () => this.pageContentHeightPx(),
|
|
11872
11885
|
runPaginationOnce: (t, n) => this.runPaginationOnce(t, n),
|
|
11873
|
-
distributeFootnotes: () =>
|
|
11874
|
-
footnotePageHeights: (t) =>
|
|
11886
|
+
distributeFootnotes: () => mg(this.papers),
|
|
11887
|
+
footnotePageHeights: (t) => bg(this.papers, t),
|
|
11875
11888
|
maxPaperOverflowPx: () => this.maxPaperOverflowPx(),
|
|
11876
|
-
captureSelection: () =>
|
|
11889
|
+
captureSelection: () => Ph(this.contentHosts),
|
|
11877
11890
|
restoreSelection: (t) => {
|
|
11878
|
-
|
|
11891
|
+
Ih(this.contentHosts, t);
|
|
11879
11892
|
},
|
|
11880
11893
|
renderAllZones: () => this.renderAllZones(),
|
|
11881
11894
|
applyPerSectionSettings: () => this.applyPerSectionSettings(),
|
|
@@ -11892,14 +11905,14 @@ class Pm {
|
|
|
11892
11905
|
const r = this.collectAllBlocks(), o = this.papers[0].content;
|
|
11893
11906
|
for (const l of r)
|
|
11894
11907
|
l.parentElement !== o && o.appendChild(l);
|
|
11895
|
-
|
|
11908
|
+
Fm(o), lm(o, t);
|
|
11896
11909
|
const i = Array.from(o.children).filter(
|
|
11897
11910
|
(l) => l instanceof HTMLElement
|
|
11898
|
-
), s =
|
|
11911
|
+
), s = Zg(
|
|
11899
11912
|
i,
|
|
11900
11913
|
t,
|
|
11901
11914
|
n.length > 0 ? n : void 0
|
|
11902
|
-
), a =
|
|
11915
|
+
), a = Om(s, this.anchoredBlockIndices()), c = Math.max(1, a.length);
|
|
11903
11916
|
this.ensurePaperCount(c);
|
|
11904
11917
|
for (let l = 0; l < c; l++) {
|
|
11905
11918
|
const u = this.papers[l], f = a[l];
|
|
@@ -11971,7 +11984,7 @@ class Pm {
|
|
|
11971
11984
|
if (i > 0) return i;
|
|
11972
11985
|
}
|
|
11973
11986
|
const { heightMM: n } = Bo(this.setup), { top: r, bottom: o } = this.setup.margins;
|
|
11974
|
-
return (n - r - o) *
|
|
11987
|
+
return (n - r - o) * Im;
|
|
11975
11988
|
}
|
|
11976
11989
|
collectAllBlocks() {
|
|
11977
11990
|
const t = [];
|
|
@@ -11982,7 +11995,7 @@ class Pm {
|
|
|
11982
11995
|
}
|
|
11983
11996
|
ensurePaperCount(t) {
|
|
11984
11997
|
for (; this.papers.length < t; )
|
|
11985
|
-
this.papers.push(new
|
|
11998
|
+
this.papers.push(new Sm(this.root, this.setup));
|
|
11986
11999
|
for (; this.papers.length > t; ) {
|
|
11987
12000
|
const n = this.papers.pop();
|
|
11988
12001
|
n == null || n.destroy();
|
|
@@ -12147,25 +12160,25 @@ class Pm {
|
|
|
12147
12160
|
return c === void 0 ? null : { partId: a.partId, body: c };
|
|
12148
12161
|
}
|
|
12149
12162
|
}
|
|
12150
|
-
function
|
|
12163
|
+
function Fm(e) {
|
|
12151
12164
|
let t = e.firstElementChild;
|
|
12152
12165
|
for (; t; ) {
|
|
12153
12166
|
const n = t.nextElementSibling;
|
|
12154
|
-
if (n &&
|
|
12167
|
+
if (n && Bm(t, n)) {
|
|
12155
12168
|
Js(t, n), n.remove();
|
|
12156
12169
|
continue;
|
|
12157
12170
|
}
|
|
12158
12171
|
t = n;
|
|
12159
12172
|
}
|
|
12160
12173
|
for (const n of Array.from(e.children))
|
|
12161
|
-
n.tagName !== "OL" && n.tagName !== "UL" ||
|
|
12174
|
+
n.tagName !== "OL" && n.tagName !== "UL" || Mm(n);
|
|
12162
12175
|
for (const n of Array.from(e.children))
|
|
12163
|
-
n.tagName === "TABLE" &&
|
|
12176
|
+
n.tagName === "TABLE" && Lm(n);
|
|
12164
12177
|
}
|
|
12165
|
-
function
|
|
12178
|
+
function Bm(e, t) {
|
|
12166
12179
|
return e.tagName !== t.tagName ? !1 : e.tagName === "P" ? !!e.dataset.pagPid && e.dataset.pagPid === t.dataset.pagPid : e.tagName === "OL" || e.tagName === "UL" ? !!e.dataset.pagLid && e.dataset.pagLid === t.dataset.pagLid : e.tagName === "TABLE" ? !!e.dataset.pagTid && e.dataset.pagTid === t.dataset.pagTid : !1;
|
|
12167
12180
|
}
|
|
12168
|
-
function
|
|
12181
|
+
function Lm(e) {
|
|
12169
12182
|
const t = Array.from(e.children).filter((r) => r.tagName === "TBODY");
|
|
12170
12183
|
if (t.length <= 1) return;
|
|
12171
12184
|
const n = t[0];
|
|
@@ -12175,7 +12188,7 @@ function Fm(e) {
|
|
|
12175
12188
|
o.remove();
|
|
12176
12189
|
}
|
|
12177
12190
|
}
|
|
12178
|
-
function
|
|
12191
|
+
function Mm(e) {
|
|
12179
12192
|
let t = e.firstElementChild;
|
|
12180
12193
|
for (; t; ) {
|
|
12181
12194
|
const n = t.nextElementSibling;
|
|
@@ -12190,7 +12203,7 @@ function Js(e, t) {
|
|
|
12190
12203
|
for (; t.firstChild; ) e.appendChild(t.firstChild);
|
|
12191
12204
|
delete e.dataset.pagContinuation, e.classList.remove("sobree-li-continuation");
|
|
12192
12205
|
}
|
|
12193
|
-
function
|
|
12206
|
+
function Om(e, t = /* @__PURE__ */ new Set()) {
|
|
12194
12207
|
const n = e.map((o) => o.slice()), r = (o) => o.some((i) => {
|
|
12195
12208
|
const s = i.getAttribute("data-block-index");
|
|
12196
12209
|
return s !== null && t.has(Number(s));
|
|
@@ -12214,15 +12227,15 @@ function uo(e) {
|
|
|
12214
12227
|
"img, svg, table, canvas, iframe, video, [class*='sobree-section-frame'], [data-sobree-drawing]"
|
|
12215
12228
|
) !== null);
|
|
12216
12229
|
}
|
|
12217
|
-
function
|
|
12230
|
+
function Dm(e) {
|
|
12218
12231
|
return e.commands.register({
|
|
12219
12232
|
name: "section.insertBreakAfter",
|
|
12220
12233
|
title: "Insert section break",
|
|
12221
12234
|
isAvailable: () => e.selection.currentCaret() !== null,
|
|
12222
|
-
run: () =>
|
|
12235
|
+
run: () => $m(e)
|
|
12223
12236
|
});
|
|
12224
12237
|
}
|
|
12225
|
-
function
|
|
12238
|
+
function $m(e) {
|
|
12226
12239
|
const t = e.selection.currentCaret();
|
|
12227
12240
|
if (!t) return;
|
|
12228
12241
|
const n = {
|
|
@@ -12240,10 +12253,10 @@ function Om(e) {
|
|
|
12240
12253
|
const o = e.getDocument(), i = o.sections.slice(), s = i.length - 1, a = i[s];
|
|
12241
12254
|
a && (i.push(structuredClone(a)), e.setDocument({ ...o, sections: i }));
|
|
12242
12255
|
}
|
|
12243
|
-
const
|
|
12244
|
-
function
|
|
12256
|
+
const Hm = "0.1.36", _m = Hm;
|
|
12257
|
+
function zm(e = document) {
|
|
12245
12258
|
const t = e.createElement("div");
|
|
12246
|
-
return t.className = "sobree-version-badge", t.textContent = `@sobree/core v${
|
|
12259
|
+
return t.className = "sobree-version-badge", t.textContent = `@sobree/core v${_m}`, t.setAttribute("aria-hidden", "true"), Object.assign(t.style, {
|
|
12247
12260
|
position: "fixed",
|
|
12248
12261
|
bottom: "8px",
|
|
12249
12262
|
left: "50%",
|
|
@@ -12259,7 +12272,7 @@ function Hm(e = document) {
|
|
|
12259
12272
|
boxShadow: "0 1px 3px rgba(0, 0, 0, 0.2)"
|
|
12260
12273
|
}), e.body.appendChild(t), () => t.remove();
|
|
12261
12274
|
}
|
|
12262
|
-
class
|
|
12275
|
+
class jm {
|
|
12263
12276
|
constructor(t, n = {}) {
|
|
12264
12277
|
w(this, "editor");
|
|
12265
12278
|
w(this, "stack");
|
|
@@ -12285,11 +12298,11 @@ class _m {
|
|
|
12285
12298
|
/** Detachers for default + user-provided plugins, run in reverse on
|
|
12286
12299
|
* `destroy` so attach order is mirrored on teardown. */
|
|
12287
12300
|
w(this, "pluginDetachers", []);
|
|
12288
|
-
this.setup = n.pageSetup ??
|
|
12301
|
+
this.setup = n.pageSetup ?? Um(n.initialDocument), this.stack = new Rm(t, this.setup);
|
|
12289
12302
|
const r = {
|
|
12290
12303
|
contentHosts: () => this.stack.contentHosts
|
|
12291
12304
|
};
|
|
12292
|
-
n.initialDocument && (r.initialDocument = n.initialDocument), n.changeDebounceMs !== void 0 && (r.changeDebounceMs = n.changeDebounceMs), n.ydoc && (r.ydoc = n.ydoc), n.blobStore && (r.blobStore = n.blobStore), n.showHiddenText && (r.showHiddenText = !0), n.trackChanges && (r.trackChanges = n.trackChanges), this.editor = new
|
|
12305
|
+
n.initialDocument && (r.initialDocument = n.initialDocument), n.changeDebounceMs !== void 0 && (r.changeDebounceMs = n.changeDebounceMs), n.ydoc && (r.ydoc = n.ydoc), n.blobStore && (r.blobStore = n.blobStore), n.showHiddenText && (r.showHiddenText = !0), n.trackChanges && (r.trackChanges = n.trackChanges), this.editor = new gg(this.stack.root, r), this.pluginDetachers.push(Dm(this.editor)), n.versionBadge && (this.versionBadgeTeardown = zm()), this.syncStackSections(), this.syncSetupFromDocument(), typeof requestAnimationFrame < "u" && requestAnimationFrame(() => this.paginateUnlessZoneEditing()), this.detachChange = this.editor.on("change", (o) => {
|
|
12293
12306
|
o.liveFrameEdit || (this.syncSetupFromDocument(), this.syncStackSections(), this.paginateUnlessZoneEditing());
|
|
12294
12307
|
for (const i of this.listeners.change)
|
|
12295
12308
|
try {
|
|
@@ -12401,7 +12414,7 @@ class _m {
|
|
|
12401
12414
|
/** Project the current `setup` into `doc.sections[0]` and commit. */
|
|
12402
12415
|
writeSetupToSection0() {
|
|
12403
12416
|
const t = this.editor.getDocument(), { section: n, headerFooterBodies: r } = te(this.setup), o = t.sections[0];
|
|
12404
|
-
if (o &&
|
|
12417
|
+
if (o && Wm(o, n)) return;
|
|
12405
12418
|
const i = t.sections.slice();
|
|
12406
12419
|
i[0] = n, this.editor.setDocument({
|
|
12407
12420
|
...t,
|
|
@@ -12595,7 +12608,7 @@ class _m {
|
|
|
12595
12608
|
const t = this.editor.getDocument(), n = t.sections[0];
|
|
12596
12609
|
if (!n) return;
|
|
12597
12610
|
const r = rn(n, t.headerFooterBodies), o = { ...this.setup, ...r };
|
|
12598
|
-
if (n.headerRefs.length === 0 && (o.header = Re()), n.footerRefs.length === 0 && (o.footer = Re()), !
|
|
12611
|
+
if (n.headerRefs.length === 0 && (o.header = Re()), n.footerRefs.length === 0 && (o.footer = Re()), !Ym(this.setup, o)) {
|
|
12599
12612
|
this.setup = o, this.stack.updateSetup(this.setup);
|
|
12600
12613
|
for (const i of this.listeners.setup)
|
|
12601
12614
|
try {
|
|
@@ -12623,7 +12636,7 @@ function fo(e) {
|
|
|
12623
12636
|
styles: e.styles ?? []
|
|
12624
12637
|
};
|
|
12625
12638
|
}
|
|
12626
|
-
function
|
|
12639
|
+
function Um(e) {
|
|
12627
12640
|
const t = structuredClone(Fo);
|
|
12628
12641
|
if (!e) return t;
|
|
12629
12642
|
const n = e.sections[0];
|
|
@@ -12640,14 +12653,14 @@ function Re() {
|
|
|
12640
12653
|
differentLast: !1
|
|
12641
12654
|
};
|
|
12642
12655
|
}
|
|
12643
|
-
function
|
|
12656
|
+
function Wm(e, t) {
|
|
12644
12657
|
return JSON.stringify(e) === JSON.stringify(t);
|
|
12645
12658
|
}
|
|
12646
|
-
function
|
|
12659
|
+
function Ym(e, t) {
|
|
12647
12660
|
return JSON.stringify(e) === JSON.stringify(t);
|
|
12648
12661
|
}
|
|
12649
|
-
function
|
|
12650
|
-
const n =
|
|
12662
|
+
function Cb(e, t = {}) {
|
|
12663
|
+
const n = Vm(e), { initialDocument: r, deferredDocx: o } = Xm(t.content), i = new Cc(n), s = {
|
|
12651
12664
|
...r && { initialDocument: r },
|
|
12652
12665
|
...t.pageSetup && { pageSetup: t.pageSetup },
|
|
12653
12666
|
...t.changeDebounceMs !== void 0 && {
|
|
@@ -12657,7 +12670,7 @@ function Tb(e, t = {}) {
|
|
|
12657
12670
|
...t.blobStore && { blobStore: t.blobStore },
|
|
12658
12671
|
...t.versionBadge && { versionBadge: !0 },
|
|
12659
12672
|
...t.showHiddenText && { showHiddenText: !0 }
|
|
12660
|
-
}, a = new
|
|
12673
|
+
}, a = new jm(i.slot, s), c = {
|
|
12661
12674
|
editor: a.editor,
|
|
12662
12675
|
sobree: a,
|
|
12663
12676
|
viewport: i,
|
|
@@ -12728,7 +12741,7 @@ function Tb(e, t = {}) {
|
|
|
12728
12741
|
}
|
|
12729
12742
|
};
|
|
12730
12743
|
}
|
|
12731
|
-
function
|
|
12744
|
+
function Vm(e) {
|
|
12732
12745
|
if (typeof e == "string") {
|
|
12733
12746
|
const t = document.querySelector(e);
|
|
12734
12747
|
if (!(t instanceof HTMLElement))
|
|
@@ -12737,10 +12750,10 @@ function Wm(e) {
|
|
|
12737
12750
|
}
|
|
12738
12751
|
return e;
|
|
12739
12752
|
}
|
|
12740
|
-
function
|
|
12741
|
-
return e === void 0 ? { initialDocument: void 0, deferredDocx: void 0 } : typeof e == "string" ? { initialDocument: Ro(e), deferredDocx: void 0 } :
|
|
12753
|
+
function Xm(e) {
|
|
12754
|
+
return e === void 0 ? { initialDocument: void 0, deferredDocx: void 0 } : typeof e == "string" ? { initialDocument: Ro(e), deferredDocx: void 0 } : Gm(e) ? { initialDocument: void 0, deferredDocx: e } : { initialDocument: e, deferredDocx: void 0 };
|
|
12742
12755
|
}
|
|
12743
|
-
function
|
|
12756
|
+
function Gm(e) {
|
|
12744
12757
|
return typeof Blob < "u" && e instanceof Blob || e instanceof ArrayBuffer || e instanceof Uint8Array;
|
|
12745
12758
|
}
|
|
12746
12759
|
function ho(e) {
|
|
@@ -12749,8 +12762,8 @@ function ho(e) {
|
|
|
12749
12762
|
});
|
|
12750
12763
|
return t;
|
|
12751
12764
|
}
|
|
12752
|
-
const ge = 12,
|
|
12753
|
-
function
|
|
12765
|
+
const ge = 12, qm = 8;
|
|
12766
|
+
function Nb(e, t) {
|
|
12754
12767
|
const n = `:scope > .sobree-floating-corner[data-placement="${t}"]`, r = e.querySelector(n);
|
|
12755
12768
|
if (r) return r;
|
|
12756
12769
|
const o = document.createElement("div");
|
|
@@ -12759,7 +12772,7 @@ function Ab(e, t) {
|
|
|
12759
12772
|
display: "flex",
|
|
12760
12773
|
flexDirection: t.startsWith("bottom-") ? "column-reverse" : "column",
|
|
12761
12774
|
alignItems: t.endsWith("-right") ? "flex-end" : "flex-start",
|
|
12762
|
-
gap: `${
|
|
12775
|
+
gap: `${qm}px`,
|
|
12763
12776
|
// Don't intercept clicks on the underlying paper — only the
|
|
12764
12777
|
// children should be interactive.
|
|
12765
12778
|
pointerEvents: "none",
|
|
@@ -12771,13 +12784,13 @@ function Ab(e, t) {
|
|
|
12771
12784
|
s.style.pointerEvents = "auto";
|
|
12772
12785
|
}).observe(o, { childList: !0 }), e.appendChild(o), o;
|
|
12773
12786
|
}
|
|
12774
|
-
function
|
|
12775
|
-
const { zone: t, kind: n, stackRoot: r, getSetup: o, setSetup: i, onExit: s } = e, a =
|
|
12787
|
+
function Pb(e) {
|
|
12788
|
+
const { zone: t, kind: n, stackRoot: r, getSetup: o, setSetup: i, onExit: s } = e, a = Km(t, n, r, o()), l = o()[n][a];
|
|
12776
12789
|
t.replaceChildren();
|
|
12777
12790
|
const u = document.createTextNode(l);
|
|
12778
12791
|
t.appendChild(u), t.classList.remove("is-empty"), r.classList.add("is-zone-editing");
|
|
12779
12792
|
const f = r.contentEditable;
|
|
12780
|
-
r.contentEditable = "false", t.contentEditable = "true", t.focus(),
|
|
12793
|
+
r.contentEditable = "false", t.contentEditable = "true", t.focus(), Jm(u);
|
|
12781
12794
|
let d = !1;
|
|
12782
12795
|
const h = () => {
|
|
12783
12796
|
if (d) return;
|
|
@@ -12794,19 +12807,19 @@ function Cb(e) {
|
|
|
12794
12807
|
};
|
|
12795
12808
|
return t.addEventListener("blur", p), t.addEventListener("keydown", y), document.addEventListener("mousedown", m, !0), h;
|
|
12796
12809
|
}
|
|
12797
|
-
function
|
|
12810
|
+
function Km(e, t, n, r) {
|
|
12798
12811
|
const o = Array.from(n.querySelectorAll(".paper")), i = e.closest(".paper");
|
|
12799
12812
|
if (!i) return "default";
|
|
12800
12813
|
const s = o.indexOf(i) + 1, a = o.length, c = r[t];
|
|
12801
12814
|
return s === 1 && c.differentFirst ? "first" : s === a && c.differentLast && a > 1 ? "last" : "default";
|
|
12802
12815
|
}
|
|
12803
|
-
function
|
|
12816
|
+
function Jm(e) {
|
|
12804
12817
|
const t = document.createRange();
|
|
12805
12818
|
t.setStart(e, e.length), t.collapse(!0);
|
|
12806
12819
|
const n = window.getSelection();
|
|
12807
12820
|
n == null || n.removeAllRanges(), n == null || n.addRange(t);
|
|
12808
12821
|
}
|
|
12809
|
-
class
|
|
12822
|
+
class Ib {
|
|
12810
12823
|
constructor(t, n = {}) {
|
|
12811
12824
|
w(this, "ydoc");
|
|
12812
12825
|
w(this, "commands");
|
|
@@ -13093,7 +13106,7 @@ function po(e) {
|
|
|
13093
13106
|
focus: e.range.to.offset
|
|
13094
13107
|
};
|
|
13095
13108
|
}
|
|
13096
|
-
function
|
|
13109
|
+
function Zm(e) {
|
|
13097
13110
|
if (!e || typeof e != "object") return !1;
|
|
13098
13111
|
const t = e;
|
|
13099
13112
|
if (!t.user || typeof t.user != "object") return !1;
|
|
@@ -13107,7 +13120,7 @@ function Km(e) {
|
|
|
13107
13120
|
}
|
|
13108
13121
|
return !0;
|
|
13109
13122
|
}
|
|
13110
|
-
function
|
|
13123
|
+
function Qm(e, t, n) {
|
|
13111
13124
|
const r = n.publishOwnSelection ?? !0, o = {
|
|
13112
13125
|
user: n.user,
|
|
13113
13126
|
selection: r ? po(e.selection.get()) : null
|
|
@@ -13124,7 +13137,7 @@ function Jm(e, t, n) {
|
|
|
13124
13137
|
const s = () => {
|
|
13125
13138
|
const c = /* @__PURE__ */ new Map();
|
|
13126
13139
|
for (const [l, u] of t.getStates())
|
|
13127
|
-
|
|
13140
|
+
Zm(u) && c.set(l, u);
|
|
13128
13141
|
return c;
|
|
13129
13142
|
}, a = (c) => {
|
|
13130
13143
|
n.onChange && n.onChange(s());
|
|
@@ -13142,19 +13155,19 @@ function Jm(e, t, n) {
|
|
|
13142
13155
|
}
|
|
13143
13156
|
};
|
|
13144
13157
|
}
|
|
13145
|
-
const
|
|
13146
|
-
function
|
|
13158
|
+
const tb = "sobree-presence-overlay";
|
|
13159
|
+
function Rb(e, t, n) {
|
|
13147
13160
|
const r = n.container, o = n.blockHost ?? r;
|
|
13148
13161
|
getComputedStyle(r).position === "static" && (r.style.position = "relative");
|
|
13149
13162
|
const s = document.createElement("div");
|
|
13150
|
-
s.className =
|
|
13163
|
+
s.className = tb, s.style.cssText = "position:absolute; inset:0; pointer-events:none; z-index:2;", r.appendChild(s);
|
|
13151
13164
|
let a = /* @__PURE__ */ new Map();
|
|
13152
13165
|
const c = (f) => {
|
|
13153
13166
|
a = f, s.replaceChildren();
|
|
13154
13167
|
for (const [d, h] of f) {
|
|
13155
13168
|
if (d === t.clientID || !h.selection) continue;
|
|
13156
13169
|
const p = o.querySelector(
|
|
13157
|
-
`[data-block-id="${
|
|
13170
|
+
`[data-block-id="${eb(h.selection.blockId)}"]`
|
|
13158
13171
|
);
|
|
13159
13172
|
if (!p) continue;
|
|
13160
13173
|
const y = p.getBoundingClientRect(), m = r.getBoundingClientRect(), v = document.createElement("div");
|
|
@@ -13162,7 +13175,7 @@ function Pb(e, t, n) {
|
|
|
13162
13175
|
const x = document.createElement("span");
|
|
13163
13176
|
x.className = "sobree-caret-label", x.textContent = h.user.name, x.style.cssText = `position:absolute; top:-1.4em; left:0; padding:0 4px; background:${h.user.color}; color:#fff; font:11px/1.4 system-ui, sans-serif; border-radius:3px 3px 3px 0; white-space:nowrap;`, v.appendChild(x), s.appendChild(v);
|
|
13164
13177
|
}
|
|
13165
|
-
}, l =
|
|
13178
|
+
}, l = Qm(e, t, {
|
|
13166
13179
|
...n,
|
|
13167
13180
|
onChange(f) {
|
|
13168
13181
|
c(f), n.onChange && n.onChange(f);
|
|
@@ -13178,7 +13191,7 @@ function Pb(e, t, n) {
|
|
|
13178
13191
|
}
|
|
13179
13192
|
};
|
|
13180
13193
|
}
|
|
13181
|
-
function
|
|
13194
|
+
function eb(e) {
|
|
13182
13195
|
return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/(["\\])/g, "\\$1");
|
|
13183
13196
|
}
|
|
13184
13197
|
export {
|
|
@@ -13186,61 +13199,61 @@ export {
|
|
|
13186
13199
|
Pt as BlobStoreError,
|
|
13187
13200
|
ff as DEFAULT_HISTORY_CONFIG,
|
|
13188
13201
|
Fo as DEFAULT_PAGE_SETUP,
|
|
13189
|
-
|
|
13202
|
+
gg as Editor,
|
|
13190
13203
|
Ia as FontFaceRegistry,
|
|
13191
|
-
|
|
13204
|
+
Ib as HeadlessSobree,
|
|
13192
13205
|
Ei as History,
|
|
13193
13206
|
Qf as MARK_COMMAND_DEFS,
|
|
13194
13207
|
Zf as MARK_ON,
|
|
13195
13208
|
Yi as MARK_PROP,
|
|
13196
13209
|
Sn as PAGE_SIZES,
|
|
13197
|
-
|
|
13198
|
-
|
|
13199
|
-
|
|
13200
|
-
|
|
13201
|
-
|
|
13210
|
+
Sm as Paper,
|
|
13211
|
+
Rm as PaperStack,
|
|
13212
|
+
Dp as RenderedDocument,
|
|
13213
|
+
jm as Sobree,
|
|
13214
|
+
_m as VERSION,
|
|
13202
13215
|
Cc as Viewport,
|
|
13203
13216
|
je as appendBlock,
|
|
13204
13217
|
Ui as applyDocumentToYDoc,
|
|
13205
|
-
|
|
13206
|
-
|
|
13207
|
-
|
|
13218
|
+
Qm as attachPresence,
|
|
13219
|
+
Rb as attachPresenceOverlay,
|
|
13220
|
+
Dm as attachSections,
|
|
13208
13221
|
el as blocksToTemplate,
|
|
13209
|
-
|
|
13222
|
+
Sb as bulletDefinition,
|
|
13210
13223
|
da as canEmbed,
|
|
13211
|
-
|
|
13212
|
-
|
|
13213
|
-
|
|
13224
|
+
db as columnBreak,
|
|
13225
|
+
yb as commentRef,
|
|
13226
|
+
Cb as createSobree,
|
|
13214
13227
|
Hc as defaultMargins,
|
|
13215
13228
|
$c as defaultPageSize,
|
|
13216
13229
|
Dc as defaultSection,
|
|
13217
13230
|
xn as defaultStyles,
|
|
13218
13231
|
sa as deobfuscate,
|
|
13219
13232
|
Ca as embedFontIntoDoc,
|
|
13220
|
-
|
|
13233
|
+
cb as emphasis,
|
|
13221
13234
|
vn as emptyDocument,
|
|
13222
|
-
|
|
13223
|
-
|
|
13224
|
-
|
|
13225
|
-
|
|
13235
|
+
Pb as enterZoneEdit,
|
|
13236
|
+
Ab as fetchBlobStore,
|
|
13237
|
+
gb as field,
|
|
13238
|
+
bb as footnoteRef,
|
|
13226
13239
|
ca as generateFontKey,
|
|
13227
|
-
|
|
13240
|
+
Nb as getFloatingCorner,
|
|
13228
13241
|
Bc as heading,
|
|
13229
|
-
|
|
13230
|
-
|
|
13231
|
-
|
|
13242
|
+
pb as hyperlink,
|
|
13243
|
+
mb as image,
|
|
13244
|
+
Tb as inMemoryBlobStore,
|
|
13232
13245
|
ci as isBlobHash,
|
|
13233
13246
|
Vi as isMarkActive,
|
|
13234
|
-
|
|
13235
|
-
|
|
13236
|
-
|
|
13237
|
-
|
|
13238
|
-
|
|
13247
|
+
sb as isParagraph,
|
|
13248
|
+
Zm as isPresenceState,
|
|
13249
|
+
ab as isTable,
|
|
13250
|
+
ib as makeHeaderFooterRef,
|
|
13251
|
+
xb as namedStyle,
|
|
13239
13252
|
Po as numberingDefinition,
|
|
13240
13253
|
No as numberingLevel,
|
|
13241
13254
|
aa as obfuscate,
|
|
13242
|
-
|
|
13243
|
-
|
|
13255
|
+
Eb as orderedDefinition,
|
|
13256
|
+
fb as pageBreak,
|
|
13244
13257
|
wt as paragraph,
|
|
13245
13258
|
Ro as parseMarkdown,
|
|
13246
13259
|
po as presenceSelectionFromEditor,
|
|
@@ -13249,15 +13262,15 @@ export {
|
|
|
13249
13262
|
fa as readFsType,
|
|
13250
13263
|
Na as removeFontFromDoc,
|
|
13251
13264
|
ii as resolveStyleCascade,
|
|
13252
|
-
|
|
13265
|
+
ob as sectionBreak,
|
|
13253
13266
|
ji as seedYDoc,
|
|
13254
13267
|
Nn as sha256Hex,
|
|
13255
|
-
|
|
13256
|
-
|
|
13257
|
-
|
|
13258
|
-
|
|
13259
|
-
|
|
13260
|
-
|
|
13268
|
+
ub as softBreak,
|
|
13269
|
+
lb as strong,
|
|
13270
|
+
hb as tab,
|
|
13271
|
+
vb as table,
|
|
13272
|
+
wb as tableCell,
|
|
13273
|
+
kb as tableRow,
|
|
13261
13274
|
Qc as templateToBlocks,
|
|
13262
13275
|
ve as text,
|
|
13263
13276
|
td as toggleMark
|