@p10node/office-engine 0.1.1 → 0.2.2
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/README.md +28 -21
- package/dist/{DocViewer-kfAVEXOO.js → DocViewer-Co7q5D2H.js} +661 -624
- package/dist/DocViewer-Co7q5D2H.js.map +1 -0
- package/dist/assets/worker-BEwT3OhG.js.map +1 -0
- package/dist/{collab-BzN1ZI-z.js → collab-BvjXvfJ9.js} +529 -232
- package/dist/collab-BvjXvfJ9.js.map +1 -0
- package/dist/collab.js +1 -1
- package/dist/core.js +1 -1
- package/dist/{default-worker-f546VALp.js → default-worker-BDj6MNRA.js} +28 -8
- package/dist/default-worker-BDj6MNRA.js.map +1 -0
- package/dist/embed.js +5 -3
- package/dist/embed.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/office-engine.embed.js +15 -11
- package/dist/office-engine.worker.js +26 -6
- package/dist/types/collab/compact.d.ts +23 -0
- package/dist/types/collab/hub.d.ts +35 -4
- package/dist/types/collab/index.d.ts +9 -2
- package/dist/types/collab/protocol.d.ts +29 -2
- package/dist/types/collab/session.d.ts +5 -1
- package/dist/types/collab/store.d.ts +94 -0
- package/dist/types/core/xlsx/workbook.d.ts +2 -1
- package/dist/types/embed.d.ts +1 -1
- package/dist/types/react/common/hooks.d.ts +1 -1
- package/dist/types/react/xlsx/fit.d.ts +4 -0
- package/package.json +1 -1
- package/dist/DocViewer-kfAVEXOO.js.map +0 -1
- package/dist/assets/worker-DbLPJnSo.js.map +0 -1
- package/dist/collab-BzN1ZI-z.js.map +0 -1
- package/dist/default-worker-f546VALp.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { C as e, E as t, N as n, P as r, S as i, d as a, f as o, h as s, j as c, m as l, o as u, p as d, t as f, u as p, w as m } from "./default-worker-
|
|
3
|
-
import { C as h,
|
|
2
|
+
import { C as e, E as t, N as n, P as r, S as i, d as a, f as o, h as s, j as c, m as l, o as u, p as d, t as f, u as p, w as m } from "./default-worker-BDj6MNRA.js";
|
|
3
|
+
import { C as h, D as g, E as _, O as v, S as y, T as b, _ as ee, b as x, d as S, f as C, g as w, h as te, k as ne, m as re, p as ie, t as ae, v as T, w as E, x as oe, y as se } from "./collab-BvjXvfJ9.js";
|
|
4
4
|
import { Children as D, Fragment as ce, createContext as le, isValidElement as O, memo as ue, useCallback as de, useContext as fe, useEffect as k, useId as pe, useInsertionEffect as me, useLayoutEffect as A, useMemo as he, useReducer as ge, useRef as j, useState as M, useSyncExternalStore as _e } from "react";
|
|
5
5
|
import { createPortal as N } from "react-dom";
|
|
6
6
|
import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
@@ -304,22 +304,23 @@ function ke(e) {
|
|
|
304
304
|
let [t, n] = M({
|
|
305
305
|
x: 0,
|
|
306
306
|
y: 0
|
|
307
|
-
});
|
|
308
|
-
return
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
307
|
+
}), [r, i] = M(null);
|
|
308
|
+
return Ee(() => {
|
|
309
|
+
e.current !== r && i(e.current);
|
|
310
|
+
}), k(() => {
|
|
311
|
+
if (!r) return;
|
|
312
|
+
let e = 0, t = () => n((e) => e.x === r.scrollLeft && e.y === r.scrollTop ? e : {
|
|
313
|
+
x: r.scrollLeft,
|
|
314
|
+
y: r.scrollTop
|
|
315
|
+
}), i = () => {
|
|
316
|
+
e ||= requestAnimationFrame(() => {
|
|
317
|
+
e = 0, t();
|
|
317
318
|
});
|
|
318
319
|
};
|
|
319
|
-
return t.addEventListener("scroll", i, { passive: !0 }), () => {
|
|
320
|
-
|
|
320
|
+
return t(), r.addEventListener("scroll", i, { passive: !0 }), () => {
|
|
321
|
+
r.removeEventListener("scroll", i), cancelAnimationFrame(e);
|
|
321
322
|
};
|
|
322
|
-
}, [
|
|
323
|
+
}, [r]), t;
|
|
323
324
|
}
|
|
324
325
|
function U(e, n, r = !0) {
|
|
325
326
|
let [i, a] = M(null);
|
|
@@ -1785,7 +1786,7 @@ var Pt = class {
|
|
|
1785
1786
|
onPainter;
|
|
1786
1787
|
onCommit;
|
|
1787
1788
|
constructor(e, t, n) {
|
|
1788
|
-
this.client = e, this.st = t, this.changed = n, this.input = new
|
|
1789
|
+
this.client = e, this.st = t, this.changed = n, this.input = new S(this);
|
|
1789
1790
|
}
|
|
1790
1791
|
container(e) {
|
|
1791
1792
|
let t = Mt(e);
|
|
@@ -1815,18 +1816,18 @@ var Pt = class {
|
|
|
1815
1816
|
if (n.length !== r.length || n.slice(0, -1).join(".") !== r.slice(0, -1).join(".")) return null;
|
|
1816
1817
|
let i = [];
|
|
1817
1818
|
for (let t = n[n.length - 1]; t <= r[r.length - 1]; t++) {
|
|
1818
|
-
let r =
|
|
1819
|
+
let r = E(e, t - n[n.length - 1]);
|
|
1819
1820
|
if (!this.para(r)) return null;
|
|
1820
1821
|
i.push(r);
|
|
1821
1822
|
}
|
|
1822
1823
|
return i;
|
|
1823
1824
|
}
|
|
1824
1825
|
prev(e) {
|
|
1825
|
-
let t = Mt(e).pop(), n =
|
|
1826
|
+
let t = Mt(e).pop(), n = E(e, -1);
|
|
1826
1827
|
return t > 0 && this.para(n) ? n : void 0;
|
|
1827
1828
|
}
|
|
1828
1829
|
next(e) {
|
|
1829
|
-
let t =
|
|
1830
|
+
let t = E(e, 1);
|
|
1830
1831
|
return this.para(t) ? t : void 0;
|
|
1831
1832
|
}
|
|
1832
1833
|
cmp(e, t) {
|
|
@@ -1877,7 +1878,7 @@ var Pt = class {
|
|
|
1877
1878
|
keepSect: i,
|
|
1878
1879
|
pb: !1,
|
|
1879
1880
|
ver: 0,
|
|
1880
|
-
caret: n.length ? void 0 :
|
|
1881
|
+
caret: n.length ? void 0 : y(t, oe(t)) ?? e.caret
|
|
1881
1882
|
};
|
|
1882
1883
|
if (r) {
|
|
1883
1884
|
let t = this.styles.find((t) => t.id === e.sid)?.next;
|
|
@@ -2072,7 +2073,7 @@ var Pt = class {
|
|
|
2072
2073
|
}
|
|
2073
2074
|
let t = this.whereNow(e.after, e.pas[0]);
|
|
2074
2075
|
if (t === void 0) return;
|
|
2075
|
-
let n = e.after.map((e, n) =>
|
|
2076
|
+
let n = e.after.map((e, n) => E(t, n));
|
|
2076
2077
|
n.some((t, n) => this.para(t)?.pid !== e.after[n].pid) || (this.replace(n.length ? n : [t], e.before, Nt(e.selBefore, e.pas[0], t), {
|
|
2077
2078
|
history: !1,
|
|
2078
2079
|
label: "undo",
|
|
@@ -2090,7 +2091,7 @@ var Pt = class {
|
|
|
2090
2091
|
}
|
|
2091
2092
|
let t = this.whereNow(e.before, e.pas[0]);
|
|
2092
2093
|
if (t === void 0) return;
|
|
2093
|
-
let n = e.before.map((e, n) =>
|
|
2094
|
+
let n = e.before.map((e, n) => E(t, n));
|
|
2094
2095
|
n.some((t, n) => this.para(t)?.pid !== e.before[n].pid) || (this.replace(n, e.after, Nt(e.selAfter, e.pas[0], t), {
|
|
2095
2096
|
history: !1,
|
|
2096
2097
|
label: "redo",
|
|
@@ -2113,7 +2114,7 @@ var Pt = class {
|
|
|
2113
2114
|
this.pend = null;
|
|
2114
2115
|
}
|
|
2115
2116
|
selectedParas(e) {
|
|
2116
|
-
let [t, n] =
|
|
2117
|
+
let [t, n] = w(this, e), r = t.pa === n.pa ? this.para(t.pa) ? [t.pa] : null : this.span(t.pa, n.pa);
|
|
2117
2118
|
return r ? {
|
|
2118
2119
|
pas: r,
|
|
2119
2120
|
s: t,
|
|
@@ -2140,8 +2141,8 @@ var Pt = class {
|
|
|
2140
2141
|
let i = this.selectedParas(r);
|
|
2141
2142
|
if (!i) return;
|
|
2142
2143
|
let a = i.pas.map((n, r) => {
|
|
2143
|
-
let a = this.para(n), o = r === 0 ? i.s.o : 0, s = r === i.pas.length - 1 ? i.e.o :
|
|
2144
|
-
return this.withRuns(a,
|
|
2144
|
+
let a = this.para(n), o = r === 0 ? i.s.o : 0, s = r === i.pas.length - 1 ? i.e.o : oe(a.runs);
|
|
2145
|
+
return this.withRuns(a, se(a.runs, o, s, e, t));
|
|
2145
2146
|
});
|
|
2146
2147
|
this.replace(i.pas, a, r, {
|
|
2147
2148
|
label: "format",
|
|
@@ -2253,7 +2254,7 @@ var Pt = class {
|
|
|
2253
2254
|
},
|
|
2254
2255
|
f: {
|
|
2255
2256
|
pa: l,
|
|
2256
|
-
o: u ?
|
|
2257
|
+
o: u ? oe(u.runs) : 0
|
|
2257
2258
|
}
|
|
2258
2259
|
}), !0;
|
|
2259
2260
|
}
|
|
@@ -2477,7 +2478,7 @@ var Pt = class {
|
|
|
2477
2478
|
rid: n
|
|
2478
2479
|
});
|
|
2479
2480
|
}
|
|
2480
|
-
|
|
2481
|
+
te(this, n, [r], { label: "image" });
|
|
2481
2482
|
}
|
|
2482
2483
|
async setLink(e) {
|
|
2483
2484
|
let t = this.input.sel();
|
|
@@ -2494,13 +2495,13 @@ var Pt = class {
|
|
|
2494
2495
|
color: "#0563c1",
|
|
2495
2496
|
u: "single"
|
|
2496
2497
|
};
|
|
2497
|
-
T(t) ?
|
|
2498
|
+
T(t) ? te(this, t, [[{
|
|
2498
2499
|
t: "text",
|
|
2499
2500
|
text: e,
|
|
2500
2501
|
href: n,
|
|
2501
2502
|
lk: r,
|
|
2502
2503
|
s: {
|
|
2503
|
-
...
|
|
2504
|
+
...y(this.para(t.a.pa)?.runs ?? [], t.a.o)?.s ?? {},
|
|
2504
2505
|
...i
|
|
2505
2506
|
},
|
|
2506
2507
|
d: i
|
|
@@ -2522,7 +2523,7 @@ var Pt = class {
|
|
|
2522
2523
|
let n = this.selectedParas(e);
|
|
2523
2524
|
if (!n) return;
|
|
2524
2525
|
let r = n.pas.map((e, r) => {
|
|
2525
|
-
let i = this.para(e), a = r === 0 ? n.s.o : 0, o = r === n.pas.length - 1 ? n.e.o :
|
|
2526
|
+
let i = this.para(e), a = r === 0 ? n.s.o : 0, o = r === n.pas.length - 1 ? n.e.o : oe(i.runs), [s, c] = b(i.runs, a), [l, u] = b(c, o - a);
|
|
2526
2527
|
return this.withRuns(i, [
|
|
2527
2528
|
...s,
|
|
2528
2529
|
...l.map((e) => e.t === "text" ? t(e) : e),
|
|
@@ -2536,7 +2537,7 @@ var Pt = class {
|
|
|
2536
2537
|
if (!e) return;
|
|
2537
2538
|
let t = this.para(e.f.pa);
|
|
2538
2539
|
if (!t || e.f.pa.includes(".")) return;
|
|
2539
|
-
let [n, r] =
|
|
2540
|
+
let [n, r] = b(t.runs, e.f.o), [i, a] = this.split(t, n, r, !1), o = {
|
|
2540
2541
|
...a,
|
|
2541
2542
|
pb: !0,
|
|
2542
2543
|
pd: {
|
|
@@ -2546,11 +2547,11 @@ var Pt = class {
|
|
|
2546
2547
|
};
|
|
2547
2548
|
this.replace([e.f.pa], [i, o], {
|
|
2548
2549
|
a: {
|
|
2549
|
-
pa:
|
|
2550
|
+
pa: E(e.f.pa, 1),
|
|
2550
2551
|
o: 0
|
|
2551
2552
|
},
|
|
2552
2553
|
f: {
|
|
2553
|
-
pa:
|
|
2554
|
+
pa: E(e.f.pa, 1),
|
|
2554
2555
|
o: 0
|
|
2555
2556
|
}
|
|
2556
2557
|
}, {
|
|
@@ -2561,7 +2562,7 @@ var Pt = class {
|
|
|
2561
2562
|
resizeImage(e) {
|
|
2562
2563
|
let t = this.input.sel();
|
|
2563
2564
|
if (!t) return;
|
|
2564
|
-
let [n] =
|
|
2565
|
+
let [n] = w(this, t);
|
|
2565
2566
|
this.patchObjects(t, (t) => {
|
|
2566
2567
|
if (t.t !== "img") return t;
|
|
2567
2568
|
let n = e === "fit" ? this.contentW / t.w : e;
|
|
@@ -2580,9 +2581,9 @@ var Pt = class {
|
|
|
2580
2581
|
};
|
|
2581
2582
|
}
|
|
2582
2583
|
patchObjects(e, t) {
|
|
2583
|
-
let [n, r] =
|
|
2584
|
+
let [n, r] = w(this, e), i = this.para(n.pa);
|
|
2584
2585
|
if (!i || n.pa !== r.pa) return;
|
|
2585
|
-
let [a, o] =
|
|
2586
|
+
let [a, o] = b(i.runs, n.o), [s, c] = b(o, r.o - n.o);
|
|
2586
2587
|
this.replace([n.pa], [this.withRuns(i, [
|
|
2587
2588
|
...a,
|
|
2588
2589
|
...s.map(t),
|
|
@@ -2612,7 +2613,7 @@ var Pt = class {
|
|
|
2612
2613
|
};
|
|
2613
2614
|
};
|
|
2614
2615
|
});
|
|
2615
|
-
|
|
2616
|
+
te(this, e, n, { label: "paste" }, a);
|
|
2616
2617
|
})(), !0) : !1;
|
|
2617
2618
|
}
|
|
2618
2619
|
async applyCanon(e) {
|
|
@@ -2692,11 +2693,11 @@ var Pt = class {
|
|
|
2692
2693
|
}
|
|
2693
2694
|
deleteSelection() {
|
|
2694
2695
|
let e = this.input.sel();
|
|
2695
|
-
e && !T(e) &&
|
|
2696
|
+
e && !T(e) && re(this, e, "");
|
|
2696
2697
|
}
|
|
2697
2698
|
insertText(e) {
|
|
2698
2699
|
let t = this.input.sel();
|
|
2699
|
-
t &&
|
|
2700
|
+
t && re(this, t, e);
|
|
2700
2701
|
}
|
|
2701
2702
|
copyFormat() {
|
|
2702
2703
|
if (this.painter) {
|
|
@@ -2726,14 +2727,14 @@ var Pt = class {
|
|
|
2726
2727
|
}
|
|
2727
2728
|
state(e = this.input.sel()) {
|
|
2728
2729
|
if (!e) return null;
|
|
2729
|
-
let [t] =
|
|
2730
|
+
let [t] = w(this, e), n = this.para(t.pa);
|
|
2730
2731
|
if (!n) return null;
|
|
2731
|
-
let r =
|
|
2732
|
+
let r = y(n.runs, T(e) ? t.o : t.o + +(oe(n.runs) > t.o)), i = {
|
|
2732
2733
|
...r?.s ?? {},
|
|
2733
2734
|
...T(e) ? this.pend?.s ?? {} : {}
|
|
2734
|
-
}, [, a] =
|
|
2735
|
+
}, [, a] = w(this, e), o;
|
|
2735
2736
|
if (t.pa === a.pa && a.o === t.o + 1) {
|
|
2736
|
-
let [, e] =
|
|
2737
|
+
let [, e] = b(n.runs, t.o), r = e[0];
|
|
2737
2738
|
r?.t === "img" && (o = {
|
|
2738
2739
|
w: r.w,
|
|
2739
2740
|
h: r.h,
|
|
@@ -3701,7 +3702,7 @@ function vn(e, t) {
|
|
|
3701
3702
|
if (e.t !== "p" || e.pid === void 0) return;
|
|
3702
3703
|
let i = !!t && e.sid === t, a = i ? 0 : e.ps.outline;
|
|
3703
3704
|
if (a === void 0 || a > 5) return;
|
|
3704
|
-
let o =
|
|
3705
|
+
let o = h(e.runs).trim();
|
|
3705
3706
|
o && n.push({
|
|
3706
3707
|
bi: r,
|
|
3707
3708
|
lvl: i ? 0 : a + +!!t,
|
|
@@ -3716,26 +3717,26 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
3716
3717
|
heights: /* @__PURE__ */ new WeakMap(),
|
|
3717
3718
|
dirty: /* @__PURE__ */ new Set(),
|
|
3718
3719
|
frontier: 0
|
|
3719
|
-
}).current, [o, s] = De(), [c, l] = M(null), [u, d] = M(null), [f, p] = M(n), [m,
|
|
3720
|
+
}).current, [o, s] = De(), [c, l] = M(null), [u, d] = M(null), [f, p] = M(n), [m, g] = Oe(), _ = ke(m), y = j(null), b = he(() => new Pt(e, a, s), [
|
|
3720
3721
|
e,
|
|
3721
3722
|
a,
|
|
3722
3723
|
s
|
|
3723
|
-
]), x = r.editable && !!u && !u.error, [
|
|
3724
|
+
]), x = r.editable && !!u && !u.error, [S, w] = M({
|
|
3724
3725
|
open: !1,
|
|
3725
3726
|
q: "",
|
|
3726
3727
|
idx: 0
|
|
3727
|
-
}), [
|
|
3728
|
-
k(() => (
|
|
3728
|
+
}), [te, ne] = M(null), [ae, T] = M(null), [E, oe] = M(null), [se, D] = M(!1), [ce, le] = M(!1), [O, ue] = M(null), [de, fe] = M(null), pe = j(!1), me = j(null);
|
|
3729
|
+
k(() => (b.onImage = (e) => ue((t) => t?.pa === e?.pa && t?.o === e?.o && t?.w === e?.w && t?.h === e?.h && t?.target === e?.target && t?.alt === e?.alt ? t : e), b.onStyles = (e) => l((t) => t && {
|
|
3729
3730
|
...t,
|
|
3730
3731
|
styles: e
|
|
3731
|
-
}),
|
|
3732
|
-
|
|
3733
|
-
}), [
|
|
3734
|
-
editor:
|
|
3732
|
+
}), b.onPainter = le, () => {
|
|
3733
|
+
b.onImage = b.onStyles = b.onPainter = void 0;
|
|
3734
|
+
}), [b]), k(() => u && !u.error ? v(e, "docx", {
|
|
3735
|
+
editor: b,
|
|
3735
3736
|
st: a
|
|
3736
3737
|
}) : void 0, [
|
|
3737
3738
|
e,
|
|
3738
|
-
|
|
3739
|
+
b,
|
|
3739
3740
|
a,
|
|
3740
3741
|
u
|
|
3741
3742
|
]), k(() => {
|
|
@@ -3745,7 +3746,7 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
3745
3746
|
s();
|
|
3746
3747
|
}),
|
|
3747
3748
|
e.on("docx:meta", (e) => {
|
|
3748
|
-
l(e), e.styles && (
|
|
3749
|
+
l(e), e.styles && (b.styles = e.styles);
|
|
3749
3750
|
}),
|
|
3750
3751
|
e.on("docx:done", d)
|
|
3751
3752
|
];
|
|
@@ -3754,7 +3755,7 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
3754
3755
|
e,
|
|
3755
3756
|
s,
|
|
3756
3757
|
a,
|
|
3757
|
-
|
|
3758
|
+
b
|
|
3758
3759
|
]);
|
|
3759
3760
|
let A = c?.page ?? i, ge = A.w - A.ml - A.mr, _e = (A.h - A.mt - A.mb) * dn, [N, P] = M(40), L = j(null), ve = `${ge}|${c?.font}|${c?.sz}`, ye = j(ve);
|
|
3760
3761
|
ye.current !== ve && (ye.current = ve, a.heights = /* @__PURE__ */ new WeakMap(), a.dirty.clear(), a.frontier = 0);
|
|
@@ -3793,16 +3794,16 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
3793
3794
|
o,
|
|
3794
3795
|
_e,
|
|
3795
3796
|
R
|
|
3796
|
-
]), V = A.w * dn, H = A.h * dn, Ce =
|
|
3797
|
+
]), V = A.w * dn, H = A.h * dn, Ce = g.w ? Math.max(.2, Math.min(2, (g.w - 48) / V)) : 1, we = f === "fit" ? Math.min(Ce, 1.25) : f, Te = !!u && a.frontier >= R, U = B.map((e) => Math.max(H, (A.mt + A.mb) * dn + e.used) * we), W = [], G = pn;
|
|
3797
3798
|
for (let e of U) W.push(G), G += e + fn;
|
|
3798
|
-
let K = +!Te, je = G + K * (H * we + fn) + pn - fn, Me = Math.max(
|
|
3799
|
-
|
|
3800
|
-
let Ie = W.length ? Ae(W,
|
|
3799
|
+
let K = +!Te, je = G + K * (H * we + fn) + pn - fn, Me = Math.max(g.w, V * we + 48), Ne = Math.max(pn, (Me - V * we) / 2), q = W.length ? Ae(W, _.y - H * we) : 0, J = W.length ? Ae(W, _.y + g.h + 200) : -1, Y = Te ? B.length : 0, Pe = x && b.input.lastSel ? Number(b.input.lastSel.f.pa.split(".")[0]) : -1, Fe = Pe >= 0 ? B.findIndex((e) => Pe >= e.start && Pe < e.end) : -1;
|
|
3800
|
+
b.contentW = ge, b.defaultFont = c?.font, b.defaultSz = c?.sz;
|
|
3801
|
+
let Ie = W.length ? Ae(W, _.y + g.h / 3) + 1 : 0, [Le, Re] = M(0);
|
|
3801
3802
|
k(() => {
|
|
3802
3803
|
if (!u) return;
|
|
3803
3804
|
let e = setTimeout(() => {
|
|
3804
3805
|
let e = 0, t = (n) => {
|
|
3805
|
-
if (n.t === "p") e +=
|
|
3806
|
+
if (n.t === "p") e += h(n.runs).split(/\s+/).filter((e) => /[\p{L}\p{N}]/u.test(e)).length;
|
|
3806
3807
|
else if (n.t === "tbl") for (let e of n.rows) for (let n of e.cells) n.blocks.forEach(t);
|
|
3807
3808
|
};
|
|
3808
3809
|
a.blocks.forEach(t), Re(e);
|
|
@@ -3815,48 +3816,48 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
3815
3816
|
]);
|
|
3816
3817
|
let ze = u?.error ? `Error: ${u.error}` : Te ? `Page ${Ie} of ${B.length} · ${Le.toLocaleString()} words` : `Page ${Ie} of ${B.length}+ · loading…`;
|
|
3817
3818
|
k(() => {
|
|
3818
|
-
let e =
|
|
3819
|
-
if (x && e) return
|
|
3819
|
+
let e = y.current;
|
|
3820
|
+
if (x && e) return b.input.attach(e), b.onDirty = () => r.setDirty(!0), () => b.input.detach();
|
|
3820
3821
|
}, [
|
|
3821
3822
|
x,
|
|
3822
|
-
|
|
3823
|
+
b,
|
|
3823
3824
|
r
|
|
3824
3825
|
]), k(() => {
|
|
3825
|
-
|
|
3826
|
+
b.shortcut = (e) => {
|
|
3826
3827
|
let t = e.metaKey || e.ctrlKey;
|
|
3827
3828
|
if (t && e.key.toLowerCase() === "s") return r.save(), !0;
|
|
3828
3829
|
if (t && e.key.toLowerCase() === "f") return w((e) => ({
|
|
3829
3830
|
...e,
|
|
3830
3831
|
open: !0
|
|
3831
3832
|
})), !0;
|
|
3832
|
-
if (t && e.key === "Enter") return
|
|
3833
|
+
if (t && e.key === "Enter") return b.insertPageBreak(), !0;
|
|
3833
3834
|
if (t && e.key.toLowerCase() === "k") return X(), !0;
|
|
3834
3835
|
if (t && e.altKey && /^Digit[0-6]$/.test(e.code)) {
|
|
3835
3836
|
let t = Number(e.code.slice(5));
|
|
3836
|
-
return
|
|
3837
|
+
return b.applyCanon(t ? `h${t}` : "normal"), !0;
|
|
3837
3838
|
}
|
|
3838
|
-
return t && e.key === "\\" ? (
|
|
3839
|
+
return t && e.key === "\\" ? (b.clearFormat(), !0) : e.key === "Escape" && b.painter ? (b.copyFormat(), !0) : !1;
|
|
3839
3840
|
};
|
|
3840
|
-
}, [
|
|
3841
|
-
let e =
|
|
3842
|
-
if (!e || !
|
|
3843
|
-
if (!
|
|
3841
|
+
}, [b, r]), Ee(() => {
|
|
3842
|
+
let e = b.pendingSel;
|
|
3843
|
+
if (!e || !y.current) return;
|
|
3844
|
+
if (!b.input.restore(e)) {
|
|
3844
3845
|
let t = Number(e.f.pa.split(".")[0]), n = B.findIndex((e) => t >= e.start && t < e.end);
|
|
3845
|
-
n >= 0 && m.current && (m.current.scrollTop = Math.max(0, W[n] - 16)), (n < 0 || n >= q && n <= J) && (
|
|
3846
|
+
n >= 0 && m.current && (m.current.scrollTop = Math.max(0, W[n] - 16)), (n < 0 || n >= q && n <= J) && (b.pendingSel = null);
|
|
3846
3847
|
return;
|
|
3847
3848
|
}
|
|
3848
|
-
|
|
3849
|
-
let t =
|
|
3849
|
+
b.pendingSel = null;
|
|
3850
|
+
let t = ie(y.current), n = t?.rangeCount ? t.getRangeAt(0) : null, r = m.current;
|
|
3850
3851
|
if (n && r) {
|
|
3851
3852
|
let e = n.getBoundingClientRect(), t = r.getBoundingClientRect();
|
|
3852
3853
|
e.height && e.bottom > t.bottom - 24 ? r.scrollTop += e.bottom - t.bottom + 48 : e.height && e.top < t.top + 8 && (r.scrollTop -= t.top - e.top + 48);
|
|
3853
3854
|
}
|
|
3854
3855
|
});
|
|
3855
3856
|
let Be = he(() => {
|
|
3856
|
-
let e =
|
|
3857
|
-
if (!
|
|
3857
|
+
let e = S.q.toLowerCase();
|
|
3858
|
+
if (!S.open || !e) return [];
|
|
3858
3859
|
let t = [], n = (n, r, i) => {
|
|
3859
|
-
let a =
|
|
3860
|
+
let a = h(n.runs).toLowerCase();
|
|
3860
3861
|
for (let n = a.indexOf(e); n >= 0 && t.length < 5e3; n = a.indexOf(e, n + e.length)) t.push({
|
|
3861
3862
|
pa: r,
|
|
3862
3863
|
a: n,
|
|
@@ -3868,8 +3869,8 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
3868
3869
|
yn(e) ? n(e, String(t), t) : e.t === "tbl" && e.rows.forEach((e, r) => e.cells.forEach((e, i) => e.blocks.forEach((e, a) => yn(e) && n(e, `${t}.${r}.${i}.${a}`, t))));
|
|
3869
3870
|
}), t;
|
|
3870
3871
|
}, [
|
|
3871
|
-
|
|
3872
|
-
|
|
3872
|
+
S.q,
|
|
3873
|
+
S.open,
|
|
3873
3874
|
o
|
|
3874
3875
|
]), Ve = (e) => {
|
|
3875
3876
|
let t = Be[e], n = m.current;
|
|
@@ -3879,12 +3880,12 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
3879
3880
|
...t,
|
|
3880
3881
|
idx: e
|
|
3881
3882
|
})), requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
3882
|
-
let e =
|
|
3883
|
+
let e = y.current;
|
|
3883
3884
|
if (!e) return;
|
|
3884
|
-
let r =
|
|
3885
|
+
let r = C(e, {
|
|
3885
3886
|
pa: t.pa,
|
|
3886
3887
|
o: t.a
|
|
3887
|
-
}), i =
|
|
3888
|
+
}), i = C(e, {
|
|
3888
3889
|
pa: t.pa,
|
|
3889
3890
|
o: t.b
|
|
3890
3891
|
});
|
|
@@ -3892,7 +3893,7 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
3892
3893
|
let a = document.createRange();
|
|
3893
3894
|
a.setStart(r[0], r[1]), a.setEnd(i[0], i[1]);
|
|
3894
3895
|
let o = a.getBoundingClientRect(), s = n.getBoundingClientRect();
|
|
3895
|
-
n.scrollTop += o.top - s.top - s.height / 3, x &&
|
|
3896
|
+
n.scrollTop += o.top - s.top - s.height / 3, x && b.input.restore({
|
|
3896
3897
|
a: {
|
|
3897
3898
|
pa: t.pa,
|
|
3898
3899
|
o: t.a
|
|
@@ -3907,7 +3908,7 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
3907
3908
|
Ee(() => {
|
|
3908
3909
|
let e = globalThis.Highlight, t = CSS.highlights;
|
|
3909
3910
|
if (!e || !t) return;
|
|
3910
|
-
let n =
|
|
3911
|
+
let n = y.current;
|
|
3911
3912
|
if (!n || !Be.length) {
|
|
3912
3913
|
t.delete("de-find"), t.delete("de-find-cur");
|
|
3913
3914
|
return;
|
|
@@ -3915,19 +3916,19 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
3915
3916
|
let r = [], i;
|
|
3916
3917
|
Be.forEach((e, t) => {
|
|
3917
3918
|
if (e.bi < (B[q]?.start ?? 0) || e.bi >= (B[J]?.end ?? 0)) return;
|
|
3918
|
-
let a =
|
|
3919
|
+
let a = C(n, {
|
|
3919
3920
|
pa: e.pa,
|
|
3920
3921
|
o: e.a
|
|
3921
|
-
}), o =
|
|
3922
|
+
}), o = C(n, {
|
|
3922
3923
|
pa: e.pa,
|
|
3923
3924
|
o: e.b
|
|
3924
3925
|
});
|
|
3925
3926
|
if (!a || !o) return;
|
|
3926
3927
|
let s = document.createRange();
|
|
3927
|
-
s.setStart(a[0], a[1]), s.setEnd(o[0], o[1]), t ===
|
|
3928
|
+
s.setStart(a[0], a[1]), s.setEnd(o[0], o[1]), t === S.idx ? i = s : r.push(s);
|
|
3928
3929
|
}), t.set("de-find", new e(...r)), i ? t.set("de-find-cur", new e(i)) : t.delete("de-find-cur");
|
|
3929
3930
|
});
|
|
3930
|
-
let He = (e, t) =>
|
|
3931
|
+
let He = (e, t) => re(b, {
|
|
3931
3932
|
a: {
|
|
3932
3933
|
pa: e.pa,
|
|
3933
3934
|
o: e.a
|
|
@@ -3977,7 +3978,7 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
3977
3978
|
stats: () => {
|
|
3978
3979
|
let e = 0, t = 0, n = (r) => {
|
|
3979
3980
|
if (r.t === "p") {
|
|
3980
|
-
let n =
|
|
3981
|
+
let n = h(r.runs);
|
|
3981
3982
|
e += n.length, n.trim() && t++;
|
|
3982
3983
|
} else if (r.t === "tbl") for (let e of r.rows) for (let t of e.cells) t.blocks.forEach(n);
|
|
3983
3984
|
};
|
|
@@ -3993,55 +3994,55 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
3993
3994
|
}
|
|
3994
3995
|
});
|
|
3995
3996
|
let X = () => {
|
|
3996
|
-
let e =
|
|
3997
|
-
|
|
3997
|
+
let e = b.state()?.link;
|
|
3998
|
+
T({
|
|
3998
3999
|
title: e ? "Edit link" : "Insert link",
|
|
3999
4000
|
placeholder: "https://…",
|
|
4000
4001
|
initial: e,
|
|
4001
4002
|
ok: "Apply",
|
|
4002
|
-
onOk: (e) => void
|
|
4003
|
+
onOk: (e) => void b.setLink(e.trim() || null),
|
|
4003
4004
|
extra: e ? {
|
|
4004
4005
|
label: "Remove",
|
|
4005
|
-
run: () => void
|
|
4006
|
+
run: () => void b.setLink(null)
|
|
4006
4007
|
} : void 0
|
|
4007
4008
|
});
|
|
4008
4009
|
}, We = () => {
|
|
4009
|
-
let e =
|
|
4010
|
-
e &&
|
|
4010
|
+
let e = b.state()?.img;
|
|
4011
|
+
e && T({
|
|
4011
4012
|
title: "Alt text",
|
|
4012
4013
|
label: "Describe the picture for screen readers",
|
|
4013
4014
|
initial: e.alt ?? "",
|
|
4014
4015
|
area: !0,
|
|
4015
4016
|
ok: "Save",
|
|
4016
|
-
onOk: (e) =>
|
|
4017
|
+
onOk: (e) => b.setAltText(e.trim())
|
|
4017
4018
|
});
|
|
4018
4019
|
}, Ge = async (e) => {
|
|
4019
|
-
let t =
|
|
4020
|
+
let t = b.input.sel();
|
|
4020
4021
|
if (t) try {
|
|
4021
4022
|
if (!e && navigator.clipboard?.read) for (let e of await navigator.clipboard.read()) {
|
|
4022
4023
|
let n = e.types.find((e) => e.startsWith("image/"));
|
|
4023
|
-
if (n) return void
|
|
4024
|
+
if (n) return void b.insertImages([await e.getType(n)], t);
|
|
4024
4025
|
if (e.types.includes("text/html")) {
|
|
4025
4026
|
let n = await (await e.getType("text/html")).text();
|
|
4026
|
-
if (
|
|
4027
|
+
if (b.pasteRich(t, {
|
|
4027
4028
|
files: [],
|
|
4028
4029
|
getData: (e) => e === "text/html" ? n : ""
|
|
4029
4030
|
})) return;
|
|
4030
4031
|
}
|
|
4031
4032
|
}
|
|
4032
4033
|
let n = await navigator.clipboard.readText();
|
|
4033
|
-
n &&
|
|
4034
|
+
n && re(b, t, n);
|
|
4034
4035
|
} catch {
|
|
4035
4036
|
oe(`The browser blocked clipboard access — use ${Z}V to paste`);
|
|
4036
4037
|
}
|
|
4037
4038
|
}, Ke = (e) => {
|
|
4038
4039
|
document.execCommand(e) || oe(`Use ${Z}${e === "copy" ? "C" : "X"}`);
|
|
4039
|
-
}, qe = () => void nt().then((e) => void (e.length &&
|
|
4040
|
+
}, qe = () => void nt().then((e) => void (e.length && b.insertImages(e))), Je = () => O && y.current ? gn(y.current, O.pa, O.o) : null, Ye = {
|
|
4040
4041
|
original: () => {
|
|
4041
4042
|
let e = Je();
|
|
4042
|
-
e?.naturalWidth &&
|
|
4043
|
+
e?.naturalWidth && b.imageOriginal(e.naturalWidth, e.naturalHeight);
|
|
4043
4044
|
},
|
|
4044
|
-
replace: () => void nt("image/*", !1).then((e) => e[0] &&
|
|
4045
|
+
replace: () => void nt("image/*", !1).then((e) => e[0] && b.replaceImage(e[0])),
|
|
4045
4046
|
alt: We,
|
|
4046
4047
|
download: r.canDownload ? () => {
|
|
4047
4048
|
let e = Je();
|
|
@@ -4050,7 +4051,7 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
4050
4051
|
};
|
|
4051
4052
|
Ee(() => {
|
|
4052
4053
|
if (pe.current) return;
|
|
4053
|
-
let e =
|
|
4054
|
+
let e = y.current, t = m.current, n = null;
|
|
4054
4055
|
if (x && O && e && t) {
|
|
4055
4056
|
let r = gn(e, O.pa, O.o);
|
|
4056
4057
|
if (r) {
|
|
@@ -4085,11 +4086,11 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
4085
4086
|
h: d
|
|
4086
4087
|
});
|
|
4087
4088
|
}, p = () => {
|
|
4088
|
-
window.removeEventListener("mousemove", f), window.removeEventListener("mouseup", p), pe.current = !1, me.current = null, u !== r || d !== i ?
|
|
4089
|
+
window.removeEventListener("mousemove", f), window.removeEventListener("mouseup", p), pe.current = !1, me.current = null, u !== r || d !== i ? b.setImageSize(u * s, d * s) : fe(null);
|
|
4089
4090
|
};
|
|
4090
4091
|
window.addEventListener("mousemove", f), window.addEventListener("mouseup", p);
|
|
4091
4092
|
}, Ze = () => {
|
|
4092
|
-
let e =
|
|
4093
|
+
let e = b.state(), t = b.input.sel(), n = !!t && (t.a.pa !== t.f.pa || t.a.o !== t.f.o), r = [];
|
|
4093
4094
|
if (e?.img && r.push({
|
|
4094
4095
|
head: "Image",
|
|
4095
4096
|
label: "Original size",
|
|
@@ -4098,7 +4099,7 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
4098
4099
|
}, {
|
|
4099
4100
|
label: "Fit to page width",
|
|
4100
4101
|
icon: "fit",
|
|
4101
|
-
run: () =>
|
|
4102
|
+
run: () => b.resizeImage("fit")
|
|
4102
4103
|
}, {
|
|
4103
4104
|
label: "Replace image…",
|
|
4104
4105
|
icon: "imgReplace",
|
|
@@ -4114,7 +4115,7 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
4114
4115
|
}] : [], {
|
|
4115
4116
|
label: "Delete image",
|
|
4116
4117
|
icon: "trash",
|
|
4117
|
-
run: () =>
|
|
4118
|
+
run: () => b.deleteSelection()
|
|
4118
4119
|
}), r.push({
|
|
4119
4120
|
label: "Cut",
|
|
4120
4121
|
icon: "cut",
|
|
@@ -4142,7 +4143,7 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
4142
4143
|
label: "Delete",
|
|
4143
4144
|
icon: "trash",
|
|
4144
4145
|
disabled: !n || !!e?.img,
|
|
4145
|
-
run: () =>
|
|
4146
|
+
run: () => b.deleteSelection()
|
|
4146
4147
|
}), e?.link ? r.push({
|
|
4147
4148
|
label: "Open link",
|
|
4148
4149
|
icon: "external",
|
|
@@ -4156,7 +4157,7 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
4156
4157
|
}, {
|
|
4157
4158
|
label: "Remove link",
|
|
4158
4159
|
icon: "unlink",
|
|
4159
|
-
run: () => void
|
|
4160
|
+
run: () => void b.setLink(null)
|
|
4160
4161
|
}) : r.push({
|
|
4161
4162
|
label: "Insert link…",
|
|
4162
4163
|
icon: "link",
|
|
@@ -4165,7 +4166,7 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
4165
4166
|
run: X,
|
|
4166
4167
|
disabled: !e
|
|
4167
4168
|
}), e?.inTable) {
|
|
4168
|
-
let e = (e) => () =>
|
|
4169
|
+
let e = (e) => () => b.tableOp(e);
|
|
4169
4170
|
r.push({
|
|
4170
4171
|
head: "Table",
|
|
4171
4172
|
label: "Insert row above",
|
|
@@ -4206,13 +4207,13 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
4206
4207
|
}, {
|
|
4207
4208
|
label: "Insert table",
|
|
4208
4209
|
icon: "table",
|
|
4209
|
-
run: () =>
|
|
4210
|
+
run: () => b.insertTable(3, 3),
|
|
4210
4211
|
disabled: !e
|
|
4211
4212
|
}, {
|
|
4212
4213
|
label: "Page break",
|
|
4213
4214
|
icon: "pagebreak",
|
|
4214
4215
|
hint: `${Z}↵`,
|
|
4215
|
-
run: () =>
|
|
4216
|
+
run: () => b.insertPageBreak(),
|
|
4216
4217
|
disabled: !e
|
|
4217
4218
|
});
|
|
4218
4219
|
return r.push({
|
|
@@ -4220,7 +4221,7 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
4220
4221
|
icon: "clear",
|
|
4221
4222
|
hint: `${Z}\\`,
|
|
4222
4223
|
sep: !0,
|
|
4223
|
-
run: () =>
|
|
4224
|
+
run: () => b.clearFormat(),
|
|
4224
4225
|
disabled: !e
|
|
4225
4226
|
}, {
|
|
4226
4227
|
label: "Select all",
|
|
@@ -4235,8 +4236,8 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
4235
4236
|
]), tt = B[Math.max(0, Ie - 1)]?.start ?? 0, rt = et.reduce((e, t, n) => t.bi <= Math.max(tt, Pe) ? n : e, -1), ot = (e) => {
|
|
4236
4237
|
let t = m.current, n = B.findIndex((t) => e >= t.start && e < t.end);
|
|
4237
4238
|
!t || n < 0 || (t.scrollTop = Math.max(0, W[n] - 16), requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
4238
|
-
let n =
|
|
4239
|
-
n && (t.scrollTop += n.getBoundingClientRect().top - t.getBoundingClientRect().top - 24), x &&
|
|
4239
|
+
let n = y.current?.querySelector(`[data-pa="${e}"]`);
|
|
4240
|
+
n && (t.scrollTop += n.getBoundingClientRect().top - t.getBoundingClientRect().top - 24), x && b.input.restore({
|
|
4240
4241
|
a: {
|
|
4241
4242
|
pa: String(e),
|
|
4242
4243
|
o: 0
|
|
@@ -4281,7 +4282,7 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
4281
4282
|
}, t))
|
|
4282
4283
|
}),
|
|
4283
4284
|
/* @__PURE__ */ I("div", {
|
|
4284
|
-
ref:
|
|
4285
|
+
ref: y,
|
|
4285
4286
|
className: x ? "de-pages de-editing" : "de-pages",
|
|
4286
4287
|
style: {
|
|
4287
4288
|
height: je,
|
|
@@ -4292,14 +4293,14 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
4292
4293
|
spellCheck: !1,
|
|
4293
4294
|
onMouseDown: (e) => {
|
|
4294
4295
|
if (!x) return;
|
|
4295
|
-
let t = e.target, n = t.tagName === "IMG" ? t.closest("[data-obj]") : null, r = n &&
|
|
4296
|
-
r && (e.preventDefault(),
|
|
4296
|
+
let t = e.target, n = t.tagName === "IMG" ? t.closest("[data-obj]") : null, r = n && y.current ? ee(y.current, n, 0) : null;
|
|
4297
|
+
r && (e.preventDefault(), b.selectObject(r.pa, r.o));
|
|
4297
4298
|
},
|
|
4298
4299
|
onMouseUp: () => {
|
|
4299
|
-
|
|
4300
|
+
b.painter && setTimeout(() => b.applyPainter(), 0);
|
|
4300
4301
|
},
|
|
4301
4302
|
onContextMenu: (e) => {
|
|
4302
|
-
x && (e.preventDefault(),
|
|
4303
|
+
x && (e.preventDefault(), ne({
|
|
4303
4304
|
x: e.clientX,
|
|
4304
4305
|
y: e.clientY
|
|
4305
4306
|
}));
|
|
@@ -4376,9 +4377,9 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
4376
4377
|
children: "Headings you add to the document will appear here."
|
|
4377
4378
|
})]
|
|
4378
4379
|
}),
|
|
4379
|
-
|
|
4380
|
-
query:
|
|
4381
|
-
index:
|
|
4380
|
+
S.open && /* @__PURE__ */ F(Ht, {
|
|
4381
|
+
query: S.q,
|
|
4382
|
+
index: S.idx,
|
|
4382
4383
|
count: Be.length,
|
|
4383
4384
|
editable: x,
|
|
4384
4385
|
onQuery: (e) => w({
|
|
@@ -4386,18 +4387,18 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
4386
4387
|
q: e,
|
|
4387
4388
|
idx: 0
|
|
4388
4389
|
}),
|
|
4389
|
-
onNav: (e) => Be.length && Ve((
|
|
4390
|
+
onNav: (e) => Be.length && Ve((S.idx + e + Be.length) % Be.length),
|
|
4390
4391
|
onClose: () => w({
|
|
4391
4392
|
open: !1,
|
|
4392
|
-
q:
|
|
4393
|
+
q: S.q,
|
|
4393
4394
|
idx: 0
|
|
4394
4395
|
}),
|
|
4395
4396
|
onReplace: (e, t) => {
|
|
4396
|
-
Be.length && (t ? [...Be].reverse().forEach((t) => He(t, e)) : He(Be[Math.min(
|
|
4397
|
+
Be.length && (t ? [...Be].reverse().forEach((t) => He(t, e)) : He(Be[Math.min(S.idx, Be.length - 1)], e));
|
|
4397
4398
|
}
|
|
4398
4399
|
}),
|
|
4399
4400
|
x && /* @__PURE__ */ F(Vt, {
|
|
4400
|
-
editor:
|
|
4401
|
+
editor: b,
|
|
4401
4402
|
styles: c?.styles ?? [],
|
|
4402
4403
|
onFind: () => w((e) => ({
|
|
4403
4404
|
...e,
|
|
@@ -4416,18 +4417,18 @@ function bn({ client: e, onStatus: t, initialZoom: n = "fit" }) {
|
|
|
4416
4417
|
onClick: () => D((e) => !e),
|
|
4417
4418
|
children: "☰"
|
|
4418
4419
|
}),
|
|
4419
|
-
|
|
4420
|
-
x:
|
|
4421
|
-
y:
|
|
4420
|
+
te && /* @__PURE__ */ F(dt, {
|
|
4421
|
+
x: te.x,
|
|
4422
|
+
y: te.y,
|
|
4422
4423
|
items: Ze(),
|
|
4423
|
-
onClose: () =>
|
|
4424
|
+
onClose: () => ne(null)
|
|
4424
4425
|
}),
|
|
4425
|
-
|
|
4426
|
-
spec:
|
|
4427
|
-
onClose: () =>
|
|
4426
|
+
ae && /* @__PURE__ */ F(ft, {
|
|
4427
|
+
spec: ae,
|
|
4428
|
+
onClose: () => T(null)
|
|
4428
4429
|
}),
|
|
4429
|
-
|
|
4430
|
-
text:
|
|
4430
|
+
E && /* @__PURE__ */ F(mt, {
|
|
4431
|
+
text: E,
|
|
4431
4432
|
onDone: () => oe(null)
|
|
4432
4433
|
}),
|
|
4433
4434
|
/* @__PURE__ */ F(ut, {
|
|
@@ -4892,7 +4893,7 @@ function dr(e = typeof document < "u" ? document : void 0) {
|
|
|
4892
4893
|
n.id = ur, n.textContent = lr, t.appendChild(n);
|
|
4893
4894
|
}
|
|
4894
4895
|
// src/react/file/print.tsx
|
|
4895
|
-
var fr = "\nhtml, body { margin: 0; padding: 0; background: #fff; }\n.de-print {\n color: #000;\n font: 13px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n -webkit-print-color-adjust: exact;\n print-color-adjust: exact;\n}\n.de-print *, .de-print *::before, .de-print *::after { box-sizing: border-box; }\n.de-print img { max-width: none; }\n.de-print-page { position: relative; overflow: hidden; background: #fff; break-after: page; }\n.de-print-page:last-child { break-after: auto; }\n.de-print-page > .de-page { left: 0; top: 0; box-shadow: none; }\n.de-print-table { border-collapse: collapse; table-layout: fixed; }\n.de-print-table td { padding: 0 3px 1px;
|
|
4896
|
+
var fr = "\nhtml, body { margin: 0; padding: 0; background: #fff; }\n.de-print {\n color: #000;\n font: 13px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n -webkit-print-color-adjust: exact;\n print-color-adjust: exact;\n}\n.de-print *, .de-print *::before, .de-print *::after { box-sizing: border-box; }\n.de-print img { max-width: none; }\n.de-print-page { position: relative; overflow: hidden; background: #fff; break-after: page; }\n.de-print-page:last-child { break-after: auto; }\n.de-print-page > .de-page { left: 0; top: 0; box-shadow: none; }\n/* position: own paint layer, so clipping cells after layout (fitText) stays cheap */\n.de-print-table { position: relative; border-collapse: collapse; table-layout: fixed; }\n.de-print-table td { padding: 0 3px 1px; vertical-align: bottom; white-space: pre; }\n.de-print-table.de-print-grid td { border: 1px solid #e2e4e7; }\n.de-print-grid + .de-print-grid { margin-top: -1px; }\n@media screen {\n body { background: #e9ebee; }\n .de-print { padding: 24px 16px; }\n .de-print-page { margin: 0 auto 24px; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18); }\n .de-print-sheet { width: max-content; max-width: none; margin: 0 auto; padding: 16px; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18); }\n}\n@media print {\n .de-print-fit { zoom: var(--de-fit, 1); }\n}\n", pr = (e) => `${lr}\n${fr}\n@page { size: ${e.size}; margin: ${e.margin}; }\n`, mr = (e) => new Promise((t) => setTimeout(t, e));
|
|
4896
4897
|
async function hr(e, t) {
|
|
4897
4898
|
await mr(0), await new Promise((e) => {
|
|
4898
4899
|
let n, r = setTimeout(a, 8e3), i = new MutationObserver(() => {
|
|
@@ -4916,7 +4917,41 @@ async function hr(e, t) {
|
|
|
4916
4917
|
}));
|
|
4917
4918
|
await Promise.race([Promise.all(r), mr(1e4)]), await Promise.race([e.fonts?.ready, mr(3e3)]);
|
|
4918
4919
|
}
|
|
4919
|
-
|
|
4920
|
+
var gr = /[\u0590-\u08ff\ufb1d-\ufdff\ufe70-\ufefc]/;
|
|
4921
|
+
function _r(e, t, n) {
|
|
4922
|
+
for (; e < t;) {
|
|
4923
|
+
let r = e + t >> 1;
|
|
4924
|
+
n(r) ? t = r : e = r + 1;
|
|
4925
|
+
}
|
|
4926
|
+
return e;
|
|
4927
|
+
}
|
|
4928
|
+
function vr(e) {
|
|
4929
|
+
let t = e.ownerDocument.defaultView, n = e.ownerDocument.createRange(), r = (e, t) => (n.setStart(e, t), n.setEnd(e, t + 1), n.getBoundingClientRect()), i = [], a = [];
|
|
4930
|
+
for (let o of e.querySelectorAll("[data-de-fit]")) {
|
|
4931
|
+
let e = o.firstChild;
|
|
4932
|
+
if (e?.nodeType !== Node.TEXT_NODE || e.nextSibling) continue;
|
|
4933
|
+
let s = e, c = s.data;
|
|
4934
|
+
n.selectNodeContents(s);
|
|
4935
|
+
let l = n.getBoundingClientRect(), u = o.getBoundingClientRect(), d = u.left + o.clientLeft - .5, f = u.left + o.clientLeft + o.clientWidth + .5;
|
|
4936
|
+
if (l.left >= d && l.right <= f) continue;
|
|
4937
|
+
let p = t.getComputedStyle(o);
|
|
4938
|
+
if (o.dataset.deFit === "#") {
|
|
4939
|
+
let e = o.clientWidth - parseFloat(p.paddingLeft) - parseFloat(p.paddingRight);
|
|
4940
|
+
i.push([s, "#".repeat(Math.max(1, Math.floor(e / (l.width / c.length))))]);
|
|
4941
|
+
} else if (gr.test(c) || p.whiteSpace !== "pre" && p.whiteSpace !== "nowrap") a.push(o);
|
|
4942
|
+
else {
|
|
4943
|
+
let e = [], t = 0;
|
|
4944
|
+
for (let n of c.split("\n")) {
|
|
4945
|
+
let i = t + n.length, a = _r(t, i, (e) => r(s, e).left >= d), o = _r(a, i, (e) => r(s, e).right > f);
|
|
4946
|
+
/[\udc00-\udfff]/.test(c[a] ?? "") && a++, /[\ud800-\udbff]/.test(c[o - 1] ?? "") && o--, e.push(c.slice(a, Math.max(a, o))), t = i + 1;
|
|
4947
|
+
}
|
|
4948
|
+
i.push([s, e.join("\n")]);
|
|
4949
|
+
}
|
|
4950
|
+
}
|
|
4951
|
+
for (let [e, t] of i) e.data = t;
|
|
4952
|
+
for (let e of a) e.style.overflow = "hidden";
|
|
4953
|
+
}
|
|
4954
|
+
async function yr(e, t) {
|
|
4920
4955
|
let n = document.createElement("iframe");
|
|
4921
4956
|
n.setAttribute("aria-hidden", "true"), n.tabIndex = -1, n.style.cssText = "position:fixed;left:-20000px;top:0;width:1100px;height:800px;border:0;visibility:hidden", document.body.appendChild(n);
|
|
4922
4957
|
let r = n.contentDocument;
|
|
@@ -4931,7 +4966,7 @@ async function gr(e, t) {
|
|
|
4931
4966
|
s || (s = !0, o.unmount(), n.remove());
|
|
4932
4967
|
};
|
|
4933
4968
|
try {
|
|
4934
|
-
await hr(r, a);
|
|
4969
|
+
await hr(r, a), vr(a);
|
|
4935
4970
|
} catch (e) {
|
|
4936
4971
|
throw c(), e;
|
|
4937
4972
|
}
|
|
@@ -4942,13 +4977,13 @@ async function gr(e, t) {
|
|
|
4942
4977
|
dispose: c
|
|
4943
4978
|
};
|
|
4944
4979
|
}
|
|
4945
|
-
var
|
|
4946
|
-
async function
|
|
4947
|
-
|
|
4948
|
-
let n = await
|
|
4949
|
-
|
|
4980
|
+
var br = null;
|
|
4981
|
+
async function xr(e, t) {
|
|
4982
|
+
br?.dispose();
|
|
4983
|
+
let n = await yr(e, t);
|
|
4984
|
+
br = n;
|
|
4950
4985
|
let r = n.frame.contentWindow, i = () => {
|
|
4951
|
-
|
|
4986
|
+
br === n && (br = null), setTimeout(() => n.dispose(), 1e3);
|
|
4952
4987
|
};
|
|
4953
4988
|
r.addEventListener("afterprint", i, { once: !0 }), setTimeout(i, 6e5);
|
|
4954
4989
|
let a = document.title;
|
|
@@ -4966,37 +5001,37 @@ async function vr(e, t) {
|
|
|
4966
5001
|
document.title = a;
|
|
4967
5002
|
}
|
|
4968
5003
|
}
|
|
4969
|
-
var
|
|
4970
|
-
function
|
|
5004
|
+
var Sr = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
5005
|
+
function Cr(e) {
|
|
4971
5006
|
return new Promise((t, n) => {
|
|
4972
5007
|
let r = new FileReader();
|
|
4973
5008
|
r.onload = () => t(r.result), r.onerror = () => n(r.error), r.readAsDataURL(e);
|
|
4974
5009
|
});
|
|
4975
5010
|
}
|
|
4976
|
-
async function
|
|
4977
|
-
let n = await
|
|
5011
|
+
async function wr(e, t) {
|
|
5012
|
+
let n = await yr(e, t);
|
|
4978
5013
|
try {
|
|
4979
|
-
let r = n.host.outerHTML.replace(/ contenteditable="(?:true|false)"/g, ""), i = new Set(r.match(/blob:[^"'()\s&]+/g) ?? []);
|
|
5014
|
+
let r = n.host.outerHTML.replace(/ contenteditable="(?:true|false)"| data-de-fit="#?"/g, ""), i = new Set(r.match(/blob:[^"'()\s&]+/g) ?? []);
|
|
4980
5015
|
for (let e of i) try {
|
|
4981
|
-
let t = await
|
|
5016
|
+
let t = await Cr(await (await fetch(e)).blob());
|
|
4982
5017
|
r = r.split(e).join(t);
|
|
4983
5018
|
} catch {}
|
|
4984
|
-
let a = `<!doctype html>\n<html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>${
|
|
5019
|
+
let a = `<!doctype html>\n<html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>${Sr(t)}</title><style>${pr(e)}</style></head><body>${r}</body></html>\n`;
|
|
4985
5020
|
return new Blob([a], { type: "text/html;charset=utf-8" });
|
|
4986
5021
|
} finally {
|
|
4987
5022
|
n.dispose();
|
|
4988
5023
|
}
|
|
4989
5024
|
}
|
|
4990
5025
|
// src/react/file/FileMenu.tsx
|
|
4991
|
-
var
|
|
5026
|
+
var Tr = {
|
|
4992
5027
|
docx: "Word document",
|
|
4993
5028
|
xlsx: "Excel workbook",
|
|
4994
5029
|
pptx: "PowerPoint presentation"
|
|
4995
|
-
},
|
|
5030
|
+
}, Er = {
|
|
4996
5031
|
docx: ".docx",
|
|
4997
5032
|
xlsx: ".xlsx",
|
|
4998
5033
|
pptx: ".pptx"
|
|
4999
|
-
},
|
|
5034
|
+
}, Dr = {
|
|
5000
5035
|
docx: [{
|
|
5001
5036
|
id: "txt",
|
|
5002
5037
|
label: "Plain text",
|
|
@@ -5025,8 +5060,8 @@ var Sr = {
|
|
|
5025
5060
|
ext: ".txt",
|
|
5026
5061
|
mime: "text/plain"
|
|
5027
5062
|
}]
|
|
5028
|
-
},
|
|
5029
|
-
function
|
|
5063
|
+
}, Or = /^(new:|open$|import$|rename$|details$|close$|extra:)/;
|
|
5064
|
+
function kr(e) {
|
|
5030
5065
|
let [t, n] = M(!1), r = j(!1), i = j(e);
|
|
5031
5066
|
i.current = e;
|
|
5032
5067
|
let a = e.kind, o = [], s = (e) => {
|
|
@@ -5078,9 +5113,9 @@ function Er(e) {
|
|
|
5078
5113
|
}), s(c), e.canDownload && a && s([
|
|
5079
5114
|
{
|
|
5080
5115
|
value: "original",
|
|
5081
|
-
label:
|
|
5116
|
+
label: Tr[a],
|
|
5082
5117
|
icon: "save",
|
|
5083
|
-
hint:
|
|
5118
|
+
hint: Er[a],
|
|
5084
5119
|
head: "Download as"
|
|
5085
5120
|
},
|
|
5086
5121
|
{
|
|
@@ -5095,7 +5130,7 @@ function Er(e) {
|
|
|
5095
5130
|
icon: "html",
|
|
5096
5131
|
hint: ".html"
|
|
5097
5132
|
},
|
|
5098
|
-
...
|
|
5133
|
+
...Dr[a].map((e) => ({
|
|
5099
5134
|
value: "text:" + e.id,
|
|
5100
5135
|
label: e.label,
|
|
5101
5136
|
icon: "doc",
|
|
@@ -5149,13 +5184,13 @@ function Er(e) {
|
|
|
5149
5184
|
if (e === "original") return t.downloadOriginal();
|
|
5150
5185
|
if (!n) throw Error("The document is still loading — try again in a moment");
|
|
5151
5186
|
if (e.startsWith("text:")) {
|
|
5152
|
-
let r =
|
|
5187
|
+
let r = Dr[t.kind].find((t) => "text:" + t.id === e);
|
|
5153
5188
|
if (!r) return;
|
|
5154
5189
|
Qe(new Blob([await n.text(r.id)], { type: `${r.mime};charset=utf-8` }), t.base + r.ext);
|
|
5155
5190
|
} else if (e === "pdf" || e === "print" || e === "html") {
|
|
5156
5191
|
t.notify(e === "pdf" ? "Preparing PDF… choose “Save as PDF” in the print dialog" : "Preparing…");
|
|
5157
5192
|
let r = await n.printable();
|
|
5158
|
-
r.notice && t.notify(r.notice), e === "html" ? Qe(await
|
|
5193
|
+
r.notice && t.notify(r.notice), e === "html" ? Qe(await wr(r, t.base), t.base + ".html") : await xr(r, t.base);
|
|
5159
5194
|
}
|
|
5160
5195
|
}
|
|
5161
5196
|
};
|
|
@@ -5163,14 +5198,14 @@ function Er(e) {
|
|
|
5163
5198
|
options: o,
|
|
5164
5199
|
busy: t,
|
|
5165
5200
|
run: (e) => {
|
|
5166
|
-
let t =
|
|
5201
|
+
let t = Or.test(e);
|
|
5167
5202
|
(!r.current || t) && (t || (r.current = !0, n(!0)), Promise.resolve().then(() => u(e)).catch((e) => i.current.notify(e.message || String(e))).finally(() => {
|
|
5168
5203
|
t || (r.current = !1, n(!1));
|
|
5169
5204
|
}));
|
|
5170
5205
|
}
|
|
5171
5206
|
};
|
|
5172
5207
|
}
|
|
5173
|
-
function
|
|
5208
|
+
function Ar({ actions: e }) {
|
|
5174
5209
|
return e.options.length ? /* @__PURE__ */ F(Y, {
|
|
5175
5210
|
title: "File",
|
|
5176
5211
|
label: "File",
|
|
@@ -5182,7 +5217,7 @@ function Dr({ actions: e }) {
|
|
|
5182
5217
|
}) : null;
|
|
5183
5218
|
}
|
|
5184
5219
|
// src/react/pptx/PptxEditor.ts
|
|
5185
|
-
var
|
|
5220
|
+
var jr = (e) => ({
|
|
5186
5221
|
sz: e.sz,
|
|
5187
5222
|
b: e.b,
|
|
5188
5223
|
i: e.i,
|
|
@@ -5194,28 +5229,28 @@ var Or = (e) => ({
|
|
|
5194
5229
|
caps: e.caps,
|
|
5195
5230
|
hl: e.hl
|
|
5196
5231
|
});
|
|
5197
|
-
function
|
|
5232
|
+
function Mr(e) {
|
|
5198
5233
|
let t = e.runs.map((e) => e.fld ? {
|
|
5199
5234
|
t: "fld",
|
|
5200
5235
|
text: e.text,
|
|
5201
|
-
s:
|
|
5236
|
+
s: jr(e),
|
|
5202
5237
|
src: e.src
|
|
5203
5238
|
} : {
|
|
5204
5239
|
t: "text",
|
|
5205
5240
|
text: e.br ? "\n" : e.text,
|
|
5206
|
-
s:
|
|
5241
|
+
s: jr(e),
|
|
5207
5242
|
src: e.src
|
|
5208
5243
|
});
|
|
5209
5244
|
return {
|
|
5210
|
-
runs:
|
|
5245
|
+
runs: x(t),
|
|
5211
5246
|
base: e,
|
|
5212
5247
|
algn: e.algn,
|
|
5213
5248
|
k: e.k
|
|
5214
5249
|
};
|
|
5215
5250
|
}
|
|
5216
|
-
var
|
|
5217
|
-
function
|
|
5218
|
-
let n =
|
|
5251
|
+
var Nr = (e) => e.pp?.bullet ?? e.base.buKind ?? "none", Pr = (e) => e.pp?.lvl ?? e.base.lvl ?? 0;
|
|
5252
|
+
function Fr(e, t = 0) {
|
|
5253
|
+
let n = Nr(e), r = Pr(e), i = e.runs.find((e) => e.t === "text")?.s?.sz ?? e.base.endSz, a = e.pp?.bullet ? n === "none" ? void 0 : {
|
|
5219
5254
|
text: n === "bullet" ? "•" : `${t}.`,
|
|
5220
5255
|
sz: i,
|
|
5221
5256
|
color: e.base.bullet?.color
|
|
@@ -5237,7 +5272,7 @@ function Mr(e, t = 0) {
|
|
|
5237
5272
|
})
|
|
5238
5273
|
};
|
|
5239
5274
|
}
|
|
5240
|
-
var
|
|
5275
|
+
var Ir = class {
|
|
5241
5276
|
client;
|
|
5242
5277
|
input;
|
|
5243
5278
|
paras = [];
|
|
@@ -5255,7 +5290,7 @@ var Nr = class {
|
|
|
5255
5290
|
onDirty;
|
|
5256
5291
|
onState;
|
|
5257
5292
|
constructor(e) {
|
|
5258
|
-
this.client = e, this.input = new
|
|
5293
|
+
this.client = e, this.input = new S(this);
|
|
5259
5294
|
}
|
|
5260
5295
|
get active() {
|
|
5261
5296
|
return this.sid >= 0;
|
|
@@ -5269,7 +5304,7 @@ var Nr = class {
|
|
|
5269
5304
|
spcAft: 0,
|
|
5270
5305
|
runs: [],
|
|
5271
5306
|
endSz: 18
|
|
5272
|
-
}]).map(
|
|
5307
|
+
}]).map(Mr), this.history = [], this.future = [], this.pend = null;
|
|
5273
5308
|
}
|
|
5274
5309
|
end() {
|
|
5275
5310
|
this.sid >= 0 && this.changedSinceCommit && this.commit(), this.input.detach(), this.sid = -1, this.slide = -1, this.body = void 0, this.onState?.(null);
|
|
@@ -5277,8 +5312,8 @@ var Nr = class {
|
|
|
5277
5312
|
text() {
|
|
5278
5313
|
if (!this.body) return;
|
|
5279
5314
|
let e = [], t = this.paras.map((t) => {
|
|
5280
|
-
let n =
|
|
5281
|
-
return
|
|
5315
|
+
let n = Pr(t);
|
|
5316
|
+
return Nr(t) === "number" ? e[n] = (e[n] ?? 0) + 1 : e[n] = 0, e.length = n + 1, Fr(t, e[n]);
|
|
5282
5317
|
});
|
|
5283
5318
|
return {
|
|
5284
5319
|
...this.body,
|
|
@@ -5316,7 +5351,7 @@ var Nr = class {
|
|
|
5316
5351
|
}, {
|
|
5317
5352
|
...e,
|
|
5318
5353
|
runs: n,
|
|
5319
|
-
caret: n.length ? void 0 :
|
|
5354
|
+
caret: n.length ? void 0 : y(t, oe(t)) ?? e.caret
|
|
5320
5355
|
}];
|
|
5321
5356
|
}
|
|
5322
5357
|
join(e, t, n) {
|
|
@@ -5414,9 +5449,9 @@ var Nr = class {
|
|
|
5414
5449
|
}, this.input.restore(n), this.onState?.(this.state(n));
|
|
5415
5450
|
return;
|
|
5416
5451
|
}
|
|
5417
|
-
let [r, i] =
|
|
5418
|
-
let s = this.para(n), c = o === 0 ? r.o : 0, l = o === a.length - 1 ? i.o :
|
|
5419
|
-
return this.withRuns(s,
|
|
5452
|
+
let [r, i] = w(this, n), a = this.span(r.pa, i.pa), o = a.map((n, o) => {
|
|
5453
|
+
let s = this.para(n), c = o === 0 ? r.o : 0, l = o === a.length - 1 ? i.o : oe(s.runs);
|
|
5454
|
+
return this.withRuns(s, se(s.runs, c, l, e, t));
|
|
5420
5455
|
});
|
|
5421
5456
|
this.replace(a, o, n, { label: "format" });
|
|
5422
5457
|
}
|
|
@@ -5436,7 +5471,7 @@ var Nr = class {
|
|
|
5436
5471
|
setAlign(e) {
|
|
5437
5472
|
let t = this.input.sel();
|
|
5438
5473
|
if (!t) return;
|
|
5439
|
-
let [n, r] =
|
|
5474
|
+
let [n, r] = w(this, t), i = this.span(n.pa, r.pa);
|
|
5440
5475
|
this.replace(i, i.map((t) => ({
|
|
5441
5476
|
...this.para(t),
|
|
5442
5477
|
algn: e,
|
|
@@ -5446,7 +5481,7 @@ var Nr = class {
|
|
|
5446
5481
|
paraOp(e, t) {
|
|
5447
5482
|
let n = this.input.sel();
|
|
5448
5483
|
if (!n) return;
|
|
5449
|
-
let [r, i] =
|
|
5484
|
+
let [r, i] = w(this, n), a = this.span(r.pa, i.pa);
|
|
5450
5485
|
this.replace(a, a.map((t) => e(this.para(t))), n, { label: t });
|
|
5451
5486
|
}
|
|
5452
5487
|
toggleBullet(e) {
|
|
@@ -5464,7 +5499,7 @@ var Nr = class {
|
|
|
5464
5499
|
...t,
|
|
5465
5500
|
pp: {
|
|
5466
5501
|
...t.pp,
|
|
5467
|
-
lvl: Math.max(0, Math.min(8,
|
|
5502
|
+
lvl: Math.max(0, Math.min(8, Pr(t) + e))
|
|
5468
5503
|
}
|
|
5469
5504
|
}), "indent");
|
|
5470
5505
|
}
|
|
@@ -5503,10 +5538,10 @@ var Nr = class {
|
|
|
5503
5538
|
}
|
|
5504
5539
|
state(e = this.input.sel()) {
|
|
5505
5540
|
if (!e || this.sid < 0) return null;
|
|
5506
|
-
let [t] =
|
|
5541
|
+
let [t] = w(this, e), n = this.para(t.pa);
|
|
5507
5542
|
if (!n) return null;
|
|
5508
5543
|
let r = {
|
|
5509
|
-
...
|
|
5544
|
+
...y(n.runs, T(e) ? t.o : t.o + 1)?.s ?? {},
|
|
5510
5545
|
...T(e) ? this.pend?.s ?? {} : {}
|
|
5511
5546
|
};
|
|
5512
5547
|
return {
|
|
@@ -5520,8 +5555,8 @@ var Nr = class {
|
|
|
5520
5555
|
algn: n.algn,
|
|
5521
5556
|
hl: r.hl,
|
|
5522
5557
|
baseline: r.baseline,
|
|
5523
|
-
bullet:
|
|
5524
|
-
lvl:
|
|
5558
|
+
bullet: Nr(n),
|
|
5559
|
+
lvl: Pr(n),
|
|
5525
5560
|
lnPct: n.pp?.lnPct ?? n.base.lnPct
|
|
5526
5561
|
};
|
|
5527
5562
|
}
|
|
@@ -5529,7 +5564,7 @@ var Nr = class {
|
|
|
5529
5564
|
e && this.pend && (e.a.pa !== this.pend.at.pa || e.a.o !== this.pend.at.o) && (this.pend = null), this.onState?.(e ? this.state(e) : null);
|
|
5530
5565
|
}
|
|
5531
5566
|
shortcut;
|
|
5532
|
-
},
|
|
5567
|
+
}, Lr = [
|
|
5533
5568
|
"#ffff00",
|
|
5534
5569
|
"#00ff00",
|
|
5535
5570
|
"#00ffff",
|
|
@@ -5540,7 +5575,7 @@ var Nr = class {
|
|
|
5540
5575
|
"#92d050",
|
|
5541
5576
|
"#c0c0c0",
|
|
5542
5577
|
"#000000"
|
|
5543
|
-
],
|
|
5578
|
+
], Rr = [
|
|
5544
5579
|
{
|
|
5545
5580
|
value: "text",
|
|
5546
5581
|
label: "Text box",
|
|
@@ -5674,7 +5709,7 @@ var Nr = class {
|
|
|
5674
5709
|
value: "wedgeRoundRectCallout",
|
|
5675
5710
|
label: "Rounded callout"
|
|
5676
5711
|
}
|
|
5677
|
-
],
|
|
5712
|
+
], zr = [
|
|
5678
5713
|
.75,
|
|
5679
5714
|
1,
|
|
5680
5715
|
1.5,
|
|
@@ -5685,7 +5720,7 @@ var Nr = class {
|
|
|
5685
5720
|
].map((e) => ({
|
|
5686
5721
|
value: e,
|
|
5687
5722
|
label: `${e} pt`
|
|
5688
|
-
})),
|
|
5723
|
+
})), Br = [
|
|
5689
5724
|
{
|
|
5690
5725
|
value: "solid",
|
|
5691
5726
|
label: "Solid",
|
|
@@ -5711,7 +5746,7 @@ var Nr = class {
|
|
|
5711
5746
|
label: "Dash dot",
|
|
5712
5747
|
hint: "-·-·-·"
|
|
5713
5748
|
}
|
|
5714
|
-
],
|
|
5749
|
+
], Vr = [
|
|
5715
5750
|
1,
|
|
5716
5751
|
1.15,
|
|
5717
5752
|
1.5,
|
|
@@ -5719,7 +5754,7 @@ var Nr = class {
|
|
|
5719
5754
|
].map((e) => ({
|
|
5720
5755
|
value: e,
|
|
5721
5756
|
label: e === 1 ? "Single" : e === 2 ? "Double" : String(e)
|
|
5722
|
-
})),
|
|
5757
|
+
})), Hr = [
|
|
5723
5758
|
{
|
|
5724
5759
|
value: "t",
|
|
5725
5760
|
label: "Top",
|
|
@@ -5736,7 +5771,7 @@ var Nr = class {
|
|
|
5736
5771
|
icon: "vBottom"
|
|
5737
5772
|
}
|
|
5738
5773
|
];
|
|
5739
|
-
function
|
|
5774
|
+
function Ur(e) {
|
|
5740
5775
|
let { editor: t } = e, [n, r] = M(null);
|
|
5741
5776
|
k(() => (t.onState = r, () => {
|
|
5742
5777
|
t.onState = void 0;
|
|
@@ -5759,7 +5794,7 @@ function Br(e) {
|
|
|
5759
5794
|
title: "Insert",
|
|
5760
5795
|
label: "Insert",
|
|
5761
5796
|
icon: "plus",
|
|
5762
|
-
items:
|
|
5797
|
+
items: Rr,
|
|
5763
5798
|
onPick: (t) => e.onInsert(t)
|
|
5764
5799
|
}),
|
|
5765
5800
|
/* @__PURE__ */ F($e, {
|
|
@@ -5855,7 +5890,7 @@ function Br(e) {
|
|
|
5855
5890
|
icon: "highlight",
|
|
5856
5891
|
title: "Highlight color",
|
|
5857
5892
|
value: n?.hl,
|
|
5858
|
-
palette:
|
|
5893
|
+
palette: Lr,
|
|
5859
5894
|
onPick: (e) => t.setHighlight(e)
|
|
5860
5895
|
}),
|
|
5861
5896
|
/* @__PURE__ */ F(q, {
|
|
@@ -5897,11 +5932,11 @@ function Br(e) {
|
|
|
5897
5932
|
}),
|
|
5898
5933
|
/* @__PURE__ */ F(Y, {
|
|
5899
5934
|
title: "Vertical align",
|
|
5900
|
-
icon:
|
|
5935
|
+
icon: Hr.find((e) => e.value === s)?.icon ?? "vTop",
|
|
5901
5936
|
label: null,
|
|
5902
5937
|
menuWidth: 140,
|
|
5903
5938
|
value: s ?? "t",
|
|
5904
|
-
options:
|
|
5939
|
+
options: Hr.map((e) => ({ ...e })),
|
|
5905
5940
|
onChange: e.onAnchor
|
|
5906
5941
|
}),
|
|
5907
5942
|
/* @__PURE__ */ F(Y, {
|
|
@@ -5910,7 +5945,7 @@ function Br(e) {
|
|
|
5910
5945
|
label: null,
|
|
5911
5946
|
menuWidth: 140,
|
|
5912
5947
|
value: n?.lnPct ? Math.round(n.lnPct * 100) / 100 : "",
|
|
5913
|
-
options:
|
|
5948
|
+
options: Vr,
|
|
5914
5949
|
onChange: (e) => t.setLineSpacing(e)
|
|
5915
5950
|
}),
|
|
5916
5951
|
/* @__PURE__ */ F(J, {}),
|
|
@@ -5960,7 +5995,7 @@ function Br(e) {
|
|
|
5960
5995
|
icon: "lineWeight",
|
|
5961
5996
|
label: null,
|
|
5962
5997
|
menuWidth: 120,
|
|
5963
|
-
options:
|
|
5998
|
+
options: zr,
|
|
5964
5999
|
onChange: (t) => e.onLine({ w: t })
|
|
5965
6000
|
}),
|
|
5966
6001
|
/* @__PURE__ */ F(Y, {
|
|
@@ -5968,7 +6003,7 @@ function Br(e) {
|
|
|
5968
6003
|
icon: "lineStyle",
|
|
5969
6004
|
label: null,
|
|
5970
6005
|
menuWidth: 170,
|
|
5971
|
-
options:
|
|
6006
|
+
options: Br,
|
|
5972
6007
|
onChange: (t) => e.onLine({ dash: t })
|
|
5973
6008
|
}),
|
|
5974
6009
|
/* @__PURE__ */ F(J, {}),
|
|
@@ -6074,11 +6109,11 @@ function Br(e) {
|
|
|
6074
6109
|
}),
|
|
6075
6110
|
e.shape.canText && /* @__PURE__ */ F(Y, {
|
|
6076
6111
|
title: "Vertical text align",
|
|
6077
|
-
icon:
|
|
6112
|
+
icon: Hr.find((e) => e.value === s)?.icon ?? "vTop",
|
|
6078
6113
|
label: null,
|
|
6079
6114
|
menuWidth: 140,
|
|
6080
6115
|
value: s ?? "t",
|
|
6081
|
-
options:
|
|
6116
|
+
options: Hr.map((e) => ({ ...e })),
|
|
6082
6117
|
onChange: e.onAnchor
|
|
6083
6118
|
}),
|
|
6084
6119
|
/* @__PURE__ */ F(J, {}),
|
|
@@ -6121,7 +6156,7 @@ function Br(e) {
|
|
|
6121
6156
|
] });
|
|
6122
6157
|
}
|
|
6123
6158
|
// src/react/pptx/Presenter.tsx
|
|
6124
|
-
function
|
|
6159
|
+
function Wr({ client: e, meta: t, start: n, onClose: r }) {
|
|
6125
6160
|
let i = j(null), a = t.slides.filter((e) => !e.hidden).map((e) => e.index), o = a.length ? a : t.slides.map((e) => e.index), [s, c] = M(Math.max(0, o.findIndex((e) => e >= n))), [l, u] = M({
|
|
6126
6161
|
w: window.innerWidth,
|
|
6127
6162
|
h: window.innerHeight
|
|
@@ -6173,7 +6208,7 @@ function Vr({ client: e, meta: t, start: n, onClose: r }) {
|
|
|
6173
6208
|
width: t.w * f,
|
|
6174
6209
|
height: t.h * f
|
|
6175
6210
|
},
|
|
6176
|
-
children: /* @__PURE__ */ F(
|
|
6211
|
+
children: /* @__PURE__ */ F(hi, {
|
|
6177
6212
|
client: e,
|
|
6178
6213
|
index: o[s],
|
|
6179
6214
|
meta: t,
|
|
@@ -6191,31 +6226,31 @@ function Vr({ client: e, meta: t, start: n, onClose: r }) {
|
|
|
6191
6226
|
});
|
|
6192
6227
|
}
|
|
6193
6228
|
// src/react/pptx/geometry.ts
|
|
6194
|
-
var Q = (e) => +e.toFixed(2),
|
|
6195
|
-
function
|
|
6229
|
+
var Q = (e) => +e.toFixed(2), Gr = (e) => "M" + e.map(([e, t]) => `${Q(e)} ${Q(t)}`).join(" L") + " Z", $ = (e, t, n) => (e?.[t] ?? n) / 1e5;
|
|
6230
|
+
function Kr(e, t) {
|
|
6196
6231
|
let n = e / 2, r = t / 2;
|
|
6197
6232
|
return `M0 ${Q(r)} A${Q(n)} ${Q(r)} 0 1 0 ${Q(e)} ${Q(r)} A${Q(n)} ${Q(r)} 0 1 0 0 ${Q(r)} Z`;
|
|
6198
6233
|
}
|
|
6199
|
-
function
|
|
6234
|
+
function qr(e, t, n) {
|
|
6200
6235
|
return n = Math.min(n, e / 2, t / 2), `M${Q(n)} 0 H${Q(e - n)} A${Q(n)} ${Q(n)} 0 0 1 ${Q(e)} ${Q(n)} V${Q(t - n)} A${Q(n)} ${Q(n)} 0 0 1 ${Q(e - n)} ${Q(t)} H${Q(n)} A${Q(n)} ${Q(n)} 0 0 1 0 ${Q(t - n)} V${Q(n)} A${Q(n)} ${Q(n)} 0 0 1 ${Q(n)} 0 Z`;
|
|
6201
6236
|
}
|
|
6202
|
-
function
|
|
6237
|
+
function Jr(e, t, n, r = -Math.PI / 2) {
|
|
6203
6238
|
let i = [];
|
|
6204
6239
|
for (let a = 0; a < n; a++) {
|
|
6205
6240
|
let o = r + a * 2 * Math.PI / n;
|
|
6206
6241
|
i.push([e / 2 + e / 2 * Math.cos(o), t / 2 + t / 2 * Math.sin(o)]);
|
|
6207
6242
|
}
|
|
6208
|
-
return
|
|
6243
|
+
return Gr(i);
|
|
6209
6244
|
}
|
|
6210
|
-
function
|
|
6245
|
+
function Yr(e, t, n, r) {
|
|
6211
6246
|
let i = [];
|
|
6212
6247
|
for (let a = 0; a < n * 2; a++) {
|
|
6213
6248
|
let o = -Math.PI / 2 + a * Math.PI / n, s = a % 2 ? r : 1;
|
|
6214
6249
|
i.push([e / 2 + e / 2 * s * Math.cos(o), t / 2 + t / 2 * s * Math.sin(o)]);
|
|
6215
6250
|
}
|
|
6216
|
-
return
|
|
6251
|
+
return Gr(i);
|
|
6217
6252
|
}
|
|
6218
|
-
var
|
|
6253
|
+
var Xr = /* @__PURE__ */ new Set([
|
|
6219
6254
|
"line",
|
|
6220
6255
|
"straightConnector1",
|
|
6221
6256
|
"bentConnector2",
|
|
@@ -6225,27 +6260,27 @@ var qr = /* @__PURE__ */ new Set([
|
|
|
6225
6260
|
"curvedConnector2",
|
|
6226
6261
|
"curvedConnector4"
|
|
6227
6262
|
]);
|
|
6228
|
-
function
|
|
6263
|
+
function Zr(e, t, n, r) {
|
|
6229
6264
|
let i = Math.min(t, n);
|
|
6230
6265
|
switch (e) {
|
|
6231
6266
|
case "ellipse":
|
|
6232
6267
|
case "flowChartConnector":
|
|
6233
|
-
case "cloud": return
|
|
6268
|
+
case "cloud": return Kr(t, n);
|
|
6234
6269
|
case "roundRect":
|
|
6235
|
-
case "flowChartAlternateProcess": return
|
|
6236
|
-
case "flowChartTerminator": return
|
|
6237
|
-
case "triangle": return
|
|
6270
|
+
case "flowChartAlternateProcess": return qr(t, n, i * $(r, "adj", 16667));
|
|
6271
|
+
case "flowChartTerminator": return qr(t, n, n / 2);
|
|
6272
|
+
case "triangle": return Gr([
|
|
6238
6273
|
[t * $(r, "adj", 5e4), 0],
|
|
6239
6274
|
[t, n],
|
|
6240
6275
|
[0, n]
|
|
6241
6276
|
]);
|
|
6242
|
-
case "rtTriangle": return
|
|
6277
|
+
case "rtTriangle": return Gr([
|
|
6243
6278
|
[0, 0],
|
|
6244
6279
|
[t, n],
|
|
6245
6280
|
[0, n]
|
|
6246
6281
|
]);
|
|
6247
6282
|
case "diamond":
|
|
6248
|
-
case "flowChartDecision": return
|
|
6283
|
+
case "flowChartDecision": return Gr([
|
|
6249
6284
|
[t / 2, 0],
|
|
6250
6285
|
[t, n / 2],
|
|
6251
6286
|
[t / 2, n],
|
|
@@ -6254,7 +6289,7 @@ function Jr(e, t, n, r) {
|
|
|
6254
6289
|
case "parallelogram":
|
|
6255
6290
|
case "flowChartInputOutput": {
|
|
6256
6291
|
let e = i * $(r, "adj", 25e3);
|
|
6257
|
-
return
|
|
6292
|
+
return Gr([
|
|
6258
6293
|
[e, 0],
|
|
6259
6294
|
[t, 0],
|
|
6260
6295
|
[t - e, n],
|
|
@@ -6263,17 +6298,17 @@ function Jr(e, t, n, r) {
|
|
|
6263
6298
|
}
|
|
6264
6299
|
case "trapezoid": {
|
|
6265
6300
|
let e = i * $(r, "adj", 25e3);
|
|
6266
|
-
return
|
|
6301
|
+
return Gr([
|
|
6267
6302
|
[e, 0],
|
|
6268
6303
|
[t - e, 0],
|
|
6269
6304
|
[t, n],
|
|
6270
6305
|
[0, n]
|
|
6271
6306
|
]);
|
|
6272
6307
|
}
|
|
6273
|
-
case "pentagon": return
|
|
6308
|
+
case "pentagon": return Jr(t, n, 5);
|
|
6274
6309
|
case "hexagon": {
|
|
6275
6310
|
let e = i * $(r, "adj", 25e3);
|
|
6276
|
-
return
|
|
6311
|
+
return Gr([
|
|
6277
6312
|
[e, 0],
|
|
6278
6313
|
[t - e, 0],
|
|
6279
6314
|
[t, n / 2],
|
|
@@ -6282,10 +6317,10 @@ function Jr(e, t, n, r) {
|
|
|
6282
6317
|
[0, n / 2]
|
|
6283
6318
|
]);
|
|
6284
6319
|
}
|
|
6285
|
-
case "heptagon": return
|
|
6320
|
+
case "heptagon": return Jr(t, n, 7);
|
|
6286
6321
|
case "octagon": {
|
|
6287
6322
|
let e = i * $(r, "adj", 29289);
|
|
6288
|
-
return
|
|
6323
|
+
return Gr([
|
|
6289
6324
|
[e, 0],
|
|
6290
6325
|
[t - e, 0],
|
|
6291
6326
|
[t, e],
|
|
@@ -6296,19 +6331,19 @@ function Jr(e, t, n, r) {
|
|
|
6296
6331
|
[0, e]
|
|
6297
6332
|
]);
|
|
6298
6333
|
}
|
|
6299
|
-
case "decagon": return
|
|
6300
|
-
case "dodecagon": return
|
|
6301
|
-
case "star4": return
|
|
6302
|
-
case "star5": return
|
|
6303
|
-
case "star6": return
|
|
6304
|
-
case "star8": return
|
|
6334
|
+
case "decagon": return Jr(t, n, 10);
|
|
6335
|
+
case "dodecagon": return Jr(t, n, 12);
|
|
6336
|
+
case "star4": return Yr(t, n, 4, .38);
|
|
6337
|
+
case "star5": return Yr(t, n, 5, .38);
|
|
6338
|
+
case "star6": return Yr(t, n, 6, .5);
|
|
6339
|
+
case "star8": return Yr(t, n, 8, .6);
|
|
6305
6340
|
case "star10":
|
|
6306
6341
|
case "star12":
|
|
6307
6342
|
case "star16":
|
|
6308
|
-
case "star24": return
|
|
6343
|
+
case "star24": return Yr(t, n, Number(e.slice(4)), .7);
|
|
6309
6344
|
case "homePlate": {
|
|
6310
6345
|
let e = i * $(r, "adj", 5e4);
|
|
6311
|
-
return
|
|
6346
|
+
return Gr([
|
|
6312
6347
|
[0, 0],
|
|
6313
6348
|
[t - e, 0],
|
|
6314
6349
|
[t, n / 2],
|
|
@@ -6318,7 +6353,7 @@ function Jr(e, t, n, r) {
|
|
|
6318
6353
|
}
|
|
6319
6354
|
case "chevron": {
|
|
6320
6355
|
let e = i * $(r, "adj", 5e4);
|
|
6321
|
-
return
|
|
6356
|
+
return Gr([
|
|
6322
6357
|
[0, 0],
|
|
6323
6358
|
[t - e, 0],
|
|
6324
6359
|
[t, n / 2],
|
|
@@ -6338,7 +6373,7 @@ function Jr(e, t, n, r) {
|
|
|
6338
6373
|
[t - o, s + a],
|
|
6339
6374
|
[0, s + a]
|
|
6340
6375
|
];
|
|
6341
|
-
return
|
|
6376
|
+
return Gr(e === "leftArrow" ? c.map(([e, n]) => [t - e, n]) : c);
|
|
6342
6377
|
}
|
|
6343
6378
|
case "upArrow":
|
|
6344
6379
|
case "downArrow": {
|
|
@@ -6351,11 +6386,11 @@ function Jr(e, t, n, r) {
|
|
|
6351
6386
|
[s + a, o],
|
|
6352
6387
|
[s + a, n]
|
|
6353
6388
|
];
|
|
6354
|
-
return
|
|
6389
|
+
return Gr(e === "downArrow" ? c.map(([e, t]) => [e, n - t]) : c);
|
|
6355
6390
|
}
|
|
6356
6391
|
case "leftRightArrow": {
|
|
6357
6392
|
let e = n * $(r, "adj1", 5e4), a = i * $(r, "adj2", 5e4), o = (n - e) / 2;
|
|
6358
|
-
return
|
|
6393
|
+
return Gr([
|
|
6359
6394
|
[0, n / 2],
|
|
6360
6395
|
[a, 0],
|
|
6361
6396
|
[a, o],
|
|
@@ -6371,7 +6406,7 @@ function Jr(e, t, n, r) {
|
|
|
6371
6406
|
case "plus":
|
|
6372
6407
|
case "mathPlus": {
|
|
6373
6408
|
let e = i * $(r, "adj", 25e3);
|
|
6374
|
-
return
|
|
6409
|
+
return Gr([
|
|
6375
6410
|
[e, 0],
|
|
6376
6411
|
[t - e, 0],
|
|
6377
6412
|
[t - e, e],
|
|
@@ -6388,7 +6423,7 @@ function Jr(e, t, n, r) {
|
|
|
6388
6423
|
}
|
|
6389
6424
|
case "snip1Rect": {
|
|
6390
6425
|
let e = i * $(r, "adj", 16667);
|
|
6391
|
-
return
|
|
6426
|
+
return Gr([
|
|
6392
6427
|
[0, 0],
|
|
6393
6428
|
[t - e, 0],
|
|
6394
6429
|
[t, e],
|
|
@@ -6398,7 +6433,7 @@ function Jr(e, t, n, r) {
|
|
|
6398
6433
|
}
|
|
6399
6434
|
case "snip2SameRect": {
|
|
6400
6435
|
let e = i * $(r, "adj1", 16667);
|
|
6401
|
-
return
|
|
6436
|
+
return Gr([
|
|
6402
6437
|
[e, 0],
|
|
6403
6438
|
[t - e, 0],
|
|
6404
6439
|
[t, e],
|
|
@@ -6419,13 +6454,13 @@ function Jr(e, t, n, r) {
|
|
|
6419
6454
|
}
|
|
6420
6455
|
case "donut": {
|
|
6421
6456
|
let e = i * $(r, "adj", 25e3);
|
|
6422
|
-
return
|
|
6457
|
+
return Kr(t, n) + ` M${Q(e)} ${Q(n / 2)} A${Q(t / 2 - e)} ${Q(n / 2 - e)} 0 1 1 ${Q(t - e)} ${Q(n / 2)} A${Q(t / 2 - e)} ${Q(n / 2 - e)} 0 1 1 ${Q(e)} ${Q(n / 2)} Z`;
|
|
6423
6458
|
}
|
|
6424
6459
|
case "heart": return `M${Q(t / 2)} ${Q(n * .25)} C${Q(t / 2)} 0 0 0 0 ${Q(n * .3)} C0 ${Q(n * .6)} ${Q(t / 2)} ${Q(n * .8)} ${Q(t / 2)} ${Q(n)} C${Q(t / 2)} ${Q(n * .8)} ${Q(t)} ${Q(n * .6)} ${Q(t)} ${Q(n * .3)} C${Q(t)} 0 ${Q(t / 2)} 0 ${Q(t / 2)} ${Q(n * .25)} Z`;
|
|
6425
6460
|
case "wedgeRectCallout":
|
|
6426
6461
|
case "wedgeRoundRectCallout": {
|
|
6427
6462
|
let e = t / 2 + t * $(r, "adj1", -20833), i = n / 2 + n * $(r, "adj2", 62500);
|
|
6428
|
-
return
|
|
6463
|
+
return Gr([
|
|
6429
6464
|
[0, 0],
|
|
6430
6465
|
[t, 0],
|
|
6431
6466
|
[t, n],
|
|
@@ -6447,7 +6482,7 @@ function Jr(e, t, n, r) {
|
|
|
6447
6482
|
}
|
|
6448
6483
|
}
|
|
6449
6484
|
// src/react/pptx/Slide.tsx
|
|
6450
|
-
function
|
|
6485
|
+
function Qr(e) {
|
|
6451
6486
|
let t = [];
|
|
6452
6487
|
return e.rot && t.push(`rotate(${e.rot}deg)`), {
|
|
6453
6488
|
left: e.x,
|
|
@@ -6457,7 +6492,7 @@ function Yr(e) {
|
|
|
6457
6492
|
transform: t.length ? t.join(" ") : void 0
|
|
6458
6493
|
};
|
|
6459
6494
|
}
|
|
6460
|
-
function
|
|
6495
|
+
function $r(e, t, n) {
|
|
6461
6496
|
let r = U(e, t?.t === "img" ? t.target : void 0, n);
|
|
6462
6497
|
if (t) switch (t.t) {
|
|
6463
6498
|
case "solid": return { background: t.c };
|
|
@@ -6470,13 +6505,13 @@ function Xr(e, t, n) {
|
|
|
6470
6505
|
default: return;
|
|
6471
6506
|
}
|
|
6472
6507
|
}
|
|
6473
|
-
function
|
|
6508
|
+
function ei(e) {
|
|
6474
6509
|
let t = { fontSize: `${e.baseline ? e.sz * .65 : e.sz}pt` };
|
|
6475
6510
|
e.b && (t.fontWeight = 700), e.i && (t.fontStyle = "italic");
|
|
6476
6511
|
let n = [e.u ? "underline" : "", e.strike ? "line-through" : ""].filter(Boolean).join(" ");
|
|
6477
6512
|
return n && (t.textDecoration = n), e.color && (t.color = e.color), e.font && (t.fontFamily = e.font), e.baseline && (t.verticalAlign = e.baseline > 0 ? "super" : "sub"), e.caps && (t.textTransform = "uppercase"), e.hl && (t.background = e.hl), t;
|
|
6478
6513
|
}
|
|
6479
|
-
function
|
|
6514
|
+
function ti({ text: e, flow: t, edit: n }) {
|
|
6480
6515
|
let [r, i, a, o] = e.ins, s = {
|
|
6481
6516
|
...t ? {
|
|
6482
6517
|
position: "relative",
|
|
@@ -6512,11 +6547,11 @@ function Qr({ text: e, flow: t, edit: n }) {
|
|
|
6512
6547
|
"data-o": r,
|
|
6513
6548
|
"data-obj": "",
|
|
6514
6549
|
contentEditable: !1,
|
|
6515
|
-
style:
|
|
6550
|
+
style: ei(e),
|
|
6516
6551
|
children: e.text
|
|
6517
6552
|
}, t) : /* @__PURE__ */ F("span", {
|
|
6518
6553
|
"data-o": r,
|
|
6519
|
-
style:
|
|
6554
|
+
style: ei(e),
|
|
6520
6555
|
children: e.br ? "\n" : e.text
|
|
6521
6556
|
}, t) : e.br ? /* @__PURE__ */ F("br", {}, t) : e.href ? /* @__PURE__ */ F("a", {
|
|
6522
6557
|
href: e.href,
|
|
@@ -6524,11 +6559,11 @@ function Qr({ text: e, flow: t, edit: n }) {
|
|
|
6524
6559
|
rel: "noreferrer noopener",
|
|
6525
6560
|
style: { color: "inherit" },
|
|
6526
6561
|
children: /* @__PURE__ */ F("span", {
|
|
6527
|
-
style:
|
|
6562
|
+
style: ei(e),
|
|
6528
6563
|
children: e.text
|
|
6529
6564
|
})
|
|
6530
6565
|
}, t) : /* @__PURE__ */ F("span", {
|
|
6531
|
-
style:
|
|
6566
|
+
style: ei(e),
|
|
6532
6567
|
children: e.text
|
|
6533
6568
|
}, t);
|
|
6534
6569
|
}), s = a === 0;
|
|
@@ -6559,7 +6594,7 @@ function Qr({ text: e, flow: t, edit: n }) {
|
|
|
6559
6594
|
})
|
|
6560
6595
|
});
|
|
6561
6596
|
}
|
|
6562
|
-
function
|
|
6597
|
+
function ni({ id: e, s: t }) {
|
|
6563
6598
|
return /* @__PURE__ */ F("marker", {
|
|
6564
6599
|
id: e,
|
|
6565
6600
|
viewBox: "0 0 10 10",
|
|
@@ -6574,11 +6609,11 @@ function $r({ id: e, s: t }) {
|
|
|
6574
6609
|
})
|
|
6575
6610
|
});
|
|
6576
6611
|
}
|
|
6577
|
-
function
|
|
6578
|
-
let i = pe().replace(/:/g, ""), { box: a } = e, o =
|
|
6612
|
+
function ri({ el: e, client: t, live: n, editing: r }) {
|
|
6613
|
+
let i = pe().replace(/:/g, ""), { box: a } = e, o = Xr.has(e.geom), s = $r(t, e.fill, n), c = e.path ?? Zr(e.geom, a.w, a.h, e.adj), l = a.flipH || a.flipV, u = l ? `translate(${a.flipH ? a.w : 0} ${a.flipV ? a.h : 0}) scale(${a.flipH ? -1 : 1} ${a.flipV ? -1 : 1})` : void 0, d = !o && !e.path && (e.geom === "rect" || e.geom === "flowChartProcess"), f = !o && e.fill?.t === "solid" ? e.fill.c : void 0, p = !o && s && e.fill?.t !== "solid" ? s : void 0, m = e.stroke, h = Math.max(a.w, 1), g = Math.max(a.h, 1);
|
|
6579
6614
|
return /* @__PURE__ */ I("div", {
|
|
6580
6615
|
className: "de-el",
|
|
6581
|
-
style:
|
|
6616
|
+
style: Qr(a),
|
|
6582
6617
|
"data-sid": e.sid !== void 0 && e.text ? e.sid : void 0,
|
|
6583
6618
|
"data-top": e.top,
|
|
6584
6619
|
children: [d && !m && (f || p) ? /* @__PURE__ */ F("div", { style: {
|
|
@@ -6601,10 +6636,10 @@ function ei({ el: e, client: t, live: n, editing: r }) {
|
|
|
6601
6636
|
top: 0,
|
|
6602
6637
|
overflow: "visible"
|
|
6603
6638
|
},
|
|
6604
|
-
children: [m && (m.head || m.tail) && /* @__PURE__ */ I("defs", { children: [m.head && /* @__PURE__ */ F(
|
|
6639
|
+
children: [m && (m.head || m.tail) && /* @__PURE__ */ I("defs", { children: [m.head && /* @__PURE__ */ F(ni, {
|
|
6605
6640
|
id: `h${i}`,
|
|
6606
6641
|
s: m
|
|
6607
|
-
}), m.tail && /* @__PURE__ */ F(
|
|
6642
|
+
}), m.tail && /* @__PURE__ */ F(ni, {
|
|
6608
6643
|
id: `t${i}`,
|
|
6609
6644
|
s: m
|
|
6610
6645
|
})] }), /* @__PURE__ */ F("path", {
|
|
@@ -6619,15 +6654,15 @@ function ei({ el: e, client: t, live: n, editing: r }) {
|
|
|
6619
6654
|
markerStart: m?.head ? `url(#h${i})` : void 0,
|
|
6620
6655
|
markerEnd: m?.tail ? `url(#t${i})` : void 0
|
|
6621
6656
|
})]
|
|
6622
|
-
})] }), r && r.sid === e.sid ? /* @__PURE__ */ F(
|
|
6657
|
+
})] }), r && r.sid === e.sid ? /* @__PURE__ */ F(ti, {
|
|
6623
6658
|
text: r.text,
|
|
6624
6659
|
edit: r.edit
|
|
6625
|
-
}) : e.text && /* @__PURE__ */ F(
|
|
6660
|
+
}) : e.text && /* @__PURE__ */ F(ti, { text: e.text })]
|
|
6626
6661
|
});
|
|
6627
6662
|
}
|
|
6628
|
-
function
|
|
6663
|
+
function ii({ el: e, client: t, live: n }) {
|
|
6629
6664
|
let r = U(t, e.target, n), { box: i } = e, a = {
|
|
6630
|
-
...
|
|
6665
|
+
...Qr(i),
|
|
6631
6666
|
overflow: "hidden"
|
|
6632
6667
|
}, o = e.top;
|
|
6633
6668
|
e.geom === "ellipse" ? a.borderRadius = "50%" : e.geom === "roundRect" && (a.borderRadius = Math.min(i.w, i.h) * .1667), e.stroke && (a.outline = `${e.stroke.w}px solid ${e.stroke.c}`);
|
|
@@ -6680,37 +6715,37 @@ function ti({ el: e, client: t, live: n }) {
|
|
|
6680
6715
|
})]
|
|
6681
6716
|
});
|
|
6682
6717
|
}
|
|
6683
|
-
var
|
|
6684
|
-
function
|
|
6685
|
-
let i =
|
|
6718
|
+
var ai = (e) => e ? `${Math.max(1, e.w)}px solid ${e.c}` : void 0;
|
|
6719
|
+
function oi({ cell: e, client: t, live: n, h: r }) {
|
|
6720
|
+
let i = $r(t, e.fill, n);
|
|
6686
6721
|
return /* @__PURE__ */ F("td", {
|
|
6687
6722
|
colSpan: e.colSpan > 1 ? e.colSpan : void 0,
|
|
6688
6723
|
rowSpan: e.rowSpan > 1 ? e.rowSpan : void 0,
|
|
6689
6724
|
style: {
|
|
6690
6725
|
...i ?? {},
|
|
6691
|
-
borderLeft:
|
|
6692
|
-
borderRight:
|
|
6693
|
-
borderTop:
|
|
6694
|
-
borderBottom:
|
|
6726
|
+
borderLeft: ai(e.bl),
|
|
6727
|
+
borderRight: ai(e.br),
|
|
6728
|
+
borderTop: ai(e.bt),
|
|
6729
|
+
borderBottom: ai(e.bb),
|
|
6695
6730
|
height: r
|
|
6696
6731
|
},
|
|
6697
|
-
children: e.text && /* @__PURE__ */ F(
|
|
6732
|
+
children: e.text && /* @__PURE__ */ F(ti, {
|
|
6698
6733
|
text: e.text,
|
|
6699
6734
|
flow: !0
|
|
6700
6735
|
})
|
|
6701
6736
|
});
|
|
6702
6737
|
}
|
|
6703
|
-
function
|
|
6738
|
+
function si({ el: e, client: t, live: n }) {
|
|
6704
6739
|
return /* @__PURE__ */ F("div", {
|
|
6705
6740
|
className: "de-el",
|
|
6706
6741
|
style: {
|
|
6707
|
-
...
|
|
6742
|
+
...Qr(e.box),
|
|
6708
6743
|
height: "auto"
|
|
6709
6744
|
},
|
|
6710
6745
|
"data-top": e.top,
|
|
6711
6746
|
children: /* @__PURE__ */ I("table", {
|
|
6712
6747
|
className: "de-stbl",
|
|
6713
|
-
children: [/* @__PURE__ */ F("colgroup", { children: e.cols.map((e, t) => /* @__PURE__ */ F("col", { style: { width: e } }, t)) }), /* @__PURE__ */ F("tbody", { children: e.rows.map((e, r) => /* @__PURE__ */ F("tr", { children: e.cells.map((r, i) => r.hidden ? null : /* @__PURE__ */ F(
|
|
6748
|
+
children: [/* @__PURE__ */ F("colgroup", { children: e.cols.map((e, t) => /* @__PURE__ */ F("col", { style: { width: e } }, t)) }), /* @__PURE__ */ F("tbody", { children: e.rows.map((e, r) => /* @__PURE__ */ F("tr", { children: e.cells.map((r, i) => r.hidden ? null : /* @__PURE__ */ F(oi, {
|
|
6714
6749
|
cell: r,
|
|
6715
6750
|
client: t,
|
|
6716
6751
|
live: n,
|
|
@@ -6719,20 +6754,20 @@ function ii({ el: e, client: t, live: n }) {
|
|
|
6719
6754
|
})
|
|
6720
6755
|
});
|
|
6721
6756
|
}
|
|
6722
|
-
function
|
|
6757
|
+
function ci({ el: e, client: t, live: n, editing: r }) {
|
|
6723
6758
|
switch (e.t) {
|
|
6724
|
-
case "shape": return /* @__PURE__ */ F(
|
|
6759
|
+
case "shape": return /* @__PURE__ */ F(ri, {
|
|
6725
6760
|
el: e,
|
|
6726
6761
|
client: t,
|
|
6727
6762
|
live: n,
|
|
6728
6763
|
editing: r
|
|
6729
6764
|
});
|
|
6730
|
-
case "pic": return /* @__PURE__ */ F(
|
|
6765
|
+
case "pic": return /* @__PURE__ */ F(ii, {
|
|
6731
6766
|
el: e,
|
|
6732
6767
|
client: t,
|
|
6733
6768
|
live: n
|
|
6734
6769
|
});
|
|
6735
|
-
case "table": return /* @__PURE__ */ F(
|
|
6770
|
+
case "table": return /* @__PURE__ */ F(si, {
|
|
6736
6771
|
el: e,
|
|
6737
6772
|
client: t,
|
|
6738
6773
|
live: n
|
|
@@ -6740,7 +6775,7 @@ function ai({ el: e, client: t, live: n, editing: r }) {
|
|
|
6740
6775
|
case "placeholder": return /* @__PURE__ */ F("div", {
|
|
6741
6776
|
className: "de-el de-ph",
|
|
6742
6777
|
style: {
|
|
6743
|
-
...
|
|
6778
|
+
...Qr(e.box),
|
|
6744
6779
|
display: "flex"
|
|
6745
6780
|
},
|
|
6746
6781
|
"data-top": e.top,
|
|
@@ -6748,8 +6783,8 @@ function ai({ el: e, client: t, live: n, editing: r }) {
|
|
|
6748
6783
|
});
|
|
6749
6784
|
}
|
|
6750
6785
|
}
|
|
6751
|
-
var
|
|
6752
|
-
let o =
|
|
6786
|
+
var li = ue(function({ model: e, client: t, scale: n, live: r = !0, editing: i, overlay: a }) {
|
|
6787
|
+
let o = $r(t, e.bg, r);
|
|
6753
6788
|
return /* @__PURE__ */ F("div", {
|
|
6754
6789
|
className: e.hidden ? "de-slide de-hidden-slide" : "de-slide",
|
|
6755
6790
|
style: {
|
|
@@ -6765,7 +6800,7 @@ var oi = ue(function({ model: e, client: t, scale: n, live: r = !0, editing: i,
|
|
|
6765
6800
|
background: "#fff",
|
|
6766
6801
|
...o ?? {}
|
|
6767
6802
|
},
|
|
6768
|
-
children: [e.els.map((e, n) => /* @__PURE__ */ F(
|
|
6803
|
+
children: [e.els.map((e, n) => /* @__PURE__ */ F(ci, {
|
|
6769
6804
|
el: e,
|
|
6770
6805
|
client: t,
|
|
6771
6806
|
live: r,
|
|
@@ -6773,26 +6808,26 @@ var oi = ue(function({ model: e, client: t, scale: n, live: r = !0, editing: i,
|
|
|
6773
6808
|
}, n)), a]
|
|
6774
6809
|
})
|
|
6775
6810
|
});
|
|
6776
|
-
}),
|
|
6777
|
-
function
|
|
6778
|
-
let t =
|
|
6779
|
-
return t ||
|
|
6811
|
+
}), ui = /* @__PURE__ */ new WeakMap();
|
|
6812
|
+
function di(e) {
|
|
6813
|
+
let t = ui.get(e);
|
|
6814
|
+
return t || ui.set(e, t = {
|
|
6780
6815
|
models: /* @__PURE__ */ new Map(),
|
|
6781
6816
|
pending: /* @__PURE__ */ new Map(),
|
|
6782
6817
|
listeners: /* @__PURE__ */ new Map()
|
|
6783
6818
|
}), t;
|
|
6784
6819
|
}
|
|
6785
|
-
function
|
|
6786
|
-
let r =
|
|
6820
|
+
function fi(e, t, n) {
|
|
6821
|
+
let r = di(e);
|
|
6787
6822
|
r.models.set(t, n);
|
|
6788
6823
|
for (let e of r.listeners.get(t) ?? []) e(n);
|
|
6789
6824
|
}
|
|
6790
|
-
function
|
|
6791
|
-
let t =
|
|
6825
|
+
function pi(e) {
|
|
6826
|
+
let t = di(e);
|
|
6792
6827
|
t.models.clear(), t.pending.clear();
|
|
6793
6828
|
}
|
|
6794
|
-
function
|
|
6795
|
-
let n =
|
|
6829
|
+
function mi(e, t) {
|
|
6830
|
+
let n = di(e), [r, i] = M(() => n.models.get(t));
|
|
6796
6831
|
return k(() => {
|
|
6797
6832
|
let e = n.listeners.get(t);
|
|
6798
6833
|
e || n.listeners.set(t, e = /* @__PURE__ */ new Set());
|
|
@@ -6815,8 +6850,8 @@ function di(e, t) {
|
|
|
6815
6850
|
t
|
|
6816
6851
|
]), r;
|
|
6817
6852
|
}
|
|
6818
|
-
function
|
|
6819
|
-
let { client: t, index: n, meta: r, scale: i, live: a, editing: o, overlay: s } = e, c =
|
|
6853
|
+
function hi(e) {
|
|
6854
|
+
let { client: t, index: n, meta: r, scale: i, live: a, editing: o, overlay: s } = e, c = mi(t, n);
|
|
6820
6855
|
return c ? "error" in c ? /* @__PURE__ */ F("div", {
|
|
6821
6856
|
className: "de-slide de-ph",
|
|
6822
6857
|
style: {
|
|
@@ -6825,7 +6860,7 @@ function fi(e) {
|
|
|
6825
6860
|
display: "flex"
|
|
6826
6861
|
},
|
|
6827
6862
|
children: c.error
|
|
6828
|
-
}) : /* @__PURE__ */ F(
|
|
6863
|
+
}) : /* @__PURE__ */ F(li, {
|
|
6829
6864
|
model: c,
|
|
6830
6865
|
client: t,
|
|
6831
6866
|
scale: i,
|
|
@@ -6841,7 +6876,7 @@ function fi(e) {
|
|
|
6841
6876
|
}
|
|
6842
6877
|
});
|
|
6843
6878
|
}
|
|
6844
|
-
var
|
|
6879
|
+
var gi = [
|
|
6845
6880
|
"nw",
|
|
6846
6881
|
"n",
|
|
6847
6882
|
"ne",
|
|
@@ -6851,7 +6886,7 @@ var pi = [
|
|
|
6851
6886
|
"sw",
|
|
6852
6887
|
"w"
|
|
6853
6888
|
];
|
|
6854
|
-
function
|
|
6889
|
+
function _i(e, t) {
|
|
6855
6890
|
let n = e?.els.filter((e) => e.top === t) ?? [];
|
|
6856
6891
|
if (!n.length) return;
|
|
6857
6892
|
let r = Math.min(...n.map((e) => e.box.x)), i = Math.min(...n.map((e) => e.box.y)), a = Math.max(...n.map((e) => e.box.x + e.box.w)), o = Math.max(...n.map((e) => e.box.y + e.box.h));
|
|
@@ -6863,7 +6898,7 @@ function mi(e, t) {
|
|
|
6863
6898
|
rot: n.length === 1 ? n[0].box.rot : void 0
|
|
6864
6899
|
};
|
|
6865
6900
|
}
|
|
6866
|
-
function
|
|
6901
|
+
function vi(e, t, n, r, i) {
|
|
6867
6902
|
if (t === "move") return {
|
|
6868
6903
|
...e,
|
|
6869
6904
|
x: e.x + n,
|
|
@@ -6882,7 +6917,7 @@ function hi(e, t, n, r, i) {
|
|
|
6882
6917
|
h: Math.max(4, c)
|
|
6883
6918
|
};
|
|
6884
6919
|
}
|
|
6885
|
-
function
|
|
6920
|
+
function yi({ box: e, scale: t, onHandle: n }) {
|
|
6886
6921
|
let r = 9 / t, i = {
|
|
6887
6922
|
nw: [0, 0],
|
|
6888
6923
|
n: [.5, 0],
|
|
@@ -6904,7 +6939,7 @@ function gi({ box: e, scale: t, onHandle: n }) {
|
|
|
6904
6939
|
borderWidth: 1.5 / t,
|
|
6905
6940
|
transform: e.rot ? `rotate(${e.rot}deg)` : void 0
|
|
6906
6941
|
},
|
|
6907
|
-
children:
|
|
6942
|
+
children: gi.map((a) => /* @__PURE__ */ F("div", {
|
|
6908
6943
|
className: `de-handle de-h-${a}`,
|
|
6909
6944
|
style: {
|
|
6910
6945
|
width: r,
|
|
@@ -6919,8 +6954,8 @@ function gi({ box: e, scale: t, onHandle: n }) {
|
|
|
6919
6954
|
}, a))
|
|
6920
6955
|
});
|
|
6921
6956
|
}
|
|
6922
|
-
var
|
|
6923
|
-
function
|
|
6957
|
+
var bi = 24, xi = 24;
|
|
6958
|
+
function Si({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0 }) {
|
|
6924
6959
|
let i = it(), a = e.info.pptx;
|
|
6925
6960
|
at({
|
|
6926
6961
|
printable: async () => {
|
|
@@ -6934,7 +6969,7 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
6934
6969
|
width: t.w,
|
|
6935
6970
|
height: t.h
|
|
6936
6971
|
},
|
|
6937
|
-
children: /* @__PURE__ */ F(
|
|
6972
|
+
children: /* @__PURE__ */ F(li, {
|
|
6938
6973
|
model: {
|
|
6939
6974
|
...n,
|
|
6940
6975
|
hidden: !1
|
|
@@ -6954,7 +6989,7 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
6954
6989
|
return [["Slides", t.count.toLocaleString()], ["Slide size", `${+(t.w / 96).toFixed(2)} × ${+(t.h / 96).toFixed(2)} in`]];
|
|
6955
6990
|
}
|
|
6956
6991
|
});
|
|
6957
|
-
let [o, s] = Oe(), [c, l] = Oe(), u = ke(c), d = j(null), f = ke(d), [p, m] = M(n), h = r && s.w >= 720 && a.count > 1, [,
|
|
6992
|
+
let [o, s] = Oe(), [c, l] = Oe(), u = ke(c), d = j(null), f = ke(d), [p, m] = M(n), h = r && s.w >= 720 && a.count > 1, [, _] = De(), y = he(() => new Ir(e), [e]), b = j(null), ee = j(null), [x, S] = M(null), [C, w] = M(null), [te, ne] = M(0), [re, ae] = M(null), [T, E] = M(null), [oe, se] = M(0), D = l.w ? (l.w - 48) / a.w : 1, ce = l.h ? (l.h - 48) / a.h : 1, le = Math.max(.1, Math.min(D, Math.max(ce, D * .6), 2)), O = p === "fit" ? le : p, ue = a.h * O, de = a.w * O, fe = ue + xi, pe = 48 + a.count * fe - xi, me = Math.max(l.w, de + 48), A = Math.max(bi, (me - de) / 2), ge = Math.max(0, Math.floor((u.y - bi) / fe) - 1), _e = Math.min(a.count - 1, Math.floor((u.y + l.h) / fe) + 1), N = Math.min(a.count - 1, Math.max(0, Math.floor((u.y + l.h / 3 - bi) / fe))), P = 142 / a.w, L = a.h * P, ve = L + 14, ye = Math.max(0, Math.floor(f.y / ve) - 1), R = Math.min(a.count - 1, Math.floor((f.y + l.h) / ve) + 1);
|
|
6958
6993
|
k(() => {
|
|
6959
6994
|
let e = d.current;
|
|
6960
6995
|
if (!e) return;
|
|
@@ -6965,14 +7000,14 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
6965
7000
|
ve,
|
|
6966
7001
|
L
|
|
6967
7002
|
]), k(() => {
|
|
6968
|
-
|
|
6969
|
-
}), k(() => (i.editable || z(), () =>
|
|
7003
|
+
y.onChange = _, y.onDirty = () => i.setDirty(!0), y.onCommitted = (t, n) => fi(e, t, n), y.shortcut = (e) => (e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "s" ? (i.save(), !0) : e.key === "Escape" && (z(), !0);
|
|
7004
|
+
}), k(() => (i.editable || z(), () => y.end()), [i.editable]);
|
|
6970
7005
|
let z = () => {
|
|
6971
|
-
|
|
7006
|
+
y.active && (y.end(), ee.current && ie(ee.current)?.removeAllRanges(), c.current?.focus({ preventScroll: !0 }), _());
|
|
6972
7007
|
}, be = j(z);
|
|
6973
7008
|
be.current = z, k(() => v(e, "pptx", { endEditing: () => be.current() }), [e]), k(() => e.on("collab:pptx", (t) => {
|
|
6974
|
-
t.meta ? (
|
|
6975
|
-
}), [e]), k(() =>
|
|
7009
|
+
t.meta ? (pi(e), S(null), ne((e) => e + 1)) : t.slide !== void 0 && t.model && fi(e, t.slide, t.model);
|
|
7010
|
+
}), [e]), k(() => g(e, {
|
|
6976
7011
|
slide: x?.slide ?? N,
|
|
6977
7012
|
top: x?.top
|
|
6978
7013
|
}), [
|
|
@@ -6981,43 +7016,43 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
6981
7016
|
x?.top,
|
|
6982
7017
|
N
|
|
6983
7018
|
]);
|
|
6984
|
-
let xe =
|
|
6985
|
-
sid:
|
|
6986
|
-
text:
|
|
7019
|
+
let xe = y.active && y.text() ? {
|
|
7020
|
+
sid: y.sid,
|
|
7021
|
+
text: y.text(),
|
|
6987
7022
|
edit: { root: (e) => {
|
|
6988
|
-
|
|
7023
|
+
ee.current = e, e && y.input.attach(e);
|
|
6989
7024
|
} }
|
|
6990
7025
|
} : void 0;
|
|
6991
7026
|
Ee(() => {
|
|
6992
|
-
let e =
|
|
6993
|
-
if (!
|
|
6994
|
-
if (
|
|
6995
|
-
let { x: t, y: n } =
|
|
6996
|
-
|
|
6997
|
-
let r = e.ownerDocument, i = r.caretPositionFromPoint?.(t, n), a = i ? null : r.caretRangeFromPoint?.(t, n), o = i?.offsetNode ?? a?.startContainer, s = i?.offset ?? a?.startOffset ?? 0, c =
|
|
6998
|
-
o && e.contains(o) ? c?.collapse(o, s) : (c?.selectAllChildren(e), c?.collapseToEnd()),
|
|
7027
|
+
let e = ee.current;
|
|
7028
|
+
if (!y.active || !e) return;
|
|
7029
|
+
if (b.current) {
|
|
7030
|
+
let { x: t, y: n } = b.current;
|
|
7031
|
+
b.current = null, e.focus({ preventScroll: !0 });
|
|
7032
|
+
let r = e.ownerDocument, i = r.caretPositionFromPoint?.(t, n), a = i ? null : r.caretRangeFromPoint?.(t, n), o = i?.offsetNode ?? a?.startContainer, s = i?.offset ?? a?.startOffset ?? 0, c = ie(e);
|
|
7033
|
+
o && e.contains(o) ? c?.collapse(o, s) : (c?.selectAllChildren(e), c?.collapseToEnd()), y.input.lastSel = y.input.readSel();
|
|
6999
7034
|
return;
|
|
7000
7035
|
}
|
|
7001
|
-
let t =
|
|
7002
|
-
t && (
|
|
7036
|
+
let t = y.pendingSel;
|
|
7037
|
+
t && (y.pendingSel = null, y.input.restore(t));
|
|
7003
7038
|
});
|
|
7004
|
-
let Se = (t) =>
|
|
7039
|
+
let Se = (t) => di(e).models.get(t), B = (e, t, n, r) => {
|
|
7005
7040
|
let i = Se(e)?.els.find((e) => e.t === "shape" && e.sid === t);
|
|
7006
|
-
i && i.t === "shape" && i.text && (
|
|
7041
|
+
i && i.t === "shape" && i.text && (y.begin(e, t, i.text), b.current = {
|
|
7007
7042
|
x: n,
|
|
7008
7043
|
y: r
|
|
7009
|
-
},
|
|
7044
|
+
}, _());
|
|
7010
7045
|
}, V = (e, t) => {
|
|
7011
7046
|
if (!i.editable || t.button !== 0) return;
|
|
7012
7047
|
let n = t.target;
|
|
7013
|
-
if (
|
|
7048
|
+
if (y.active && ee.current?.contains(n)) return;
|
|
7014
7049
|
let r = n.closest("[data-top]"), a = r ? Number(r.dataset.top) : NaN;
|
|
7015
7050
|
if (z(), !r || Number.isNaN(a)) {
|
|
7016
7051
|
S(null);
|
|
7017
7052
|
return;
|
|
7018
7053
|
}
|
|
7019
7054
|
t.preventDefault(), c.current?.focus({ preventScroll: !0 });
|
|
7020
|
-
let o =
|
|
7055
|
+
let o = _i(Se(e), a);
|
|
7021
7056
|
if (S({
|
|
7022
7057
|
slide: e,
|
|
7023
7058
|
top: a
|
|
@@ -7039,7 +7074,7 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
7039
7074
|
}, H = async (t, n, r = !1) => {
|
|
7040
7075
|
try {
|
|
7041
7076
|
let a = await e.call("pptx.shapes", t, n);
|
|
7042
|
-
if (
|
|
7077
|
+
if (fi(e, t, a), i.setDirty(!0), se((e) => e + 1), r) {
|
|
7043
7078
|
let e = a.els.map((e) => e.top ?? -1);
|
|
7044
7079
|
S({
|
|
7045
7080
|
slide: t,
|
|
@@ -7058,7 +7093,7 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
7058
7093
|
w({
|
|
7059
7094
|
...C,
|
|
7060
7095
|
moved: r,
|
|
7061
|
-
cur: r ?
|
|
7096
|
+
cur: r ? vi(C.box, C.mode, t, n, e.shiftKey) : C.box
|
|
7062
7097
|
});
|
|
7063
7098
|
}, t = () => {
|
|
7064
7099
|
let e = C;
|
|
@@ -7109,15 +7144,15 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
7109
7144
|
}], !0);
|
|
7110
7145
|
if (c.current?.focus({ preventScroll: !0 }), u && t === "text") {
|
|
7111
7146
|
let e = u.els[u.els.length - 1];
|
|
7112
|
-
e?.t === "shape" && e.sid !== void 0 && e.text && (
|
|
7147
|
+
e?.t === "shape" && e.sid !== void 0 && e.text && (y.begin(r, e.sid, e.text), _());
|
|
7113
7148
|
}
|
|
7114
7149
|
}, we = async (t, n) => {
|
|
7115
7150
|
z(), S(null);
|
|
7116
7151
|
let r = await e.call("pptx.slides", t);
|
|
7117
|
-
Object.assign(a, r),
|
|
7152
|
+
Object.assign(a, r), pi(e), i.setDirty(!0), ne((e) => e + 1), n !== void 0 && requestAnimationFrame(() => Ne(n));
|
|
7118
7153
|
}, Te = async (t) => {
|
|
7119
7154
|
let n = await e.call("pptx.undo", t);
|
|
7120
|
-
n && (
|
|
7155
|
+
n && (fi(e, n.index, n.model), se((e) => Math.max(0, e + (t ? 1 : -1))), S(null), Ne(n.index));
|
|
7121
7156
|
}, U = (e, t = N) => {
|
|
7122
7157
|
e === "add" ? we({
|
|
7123
7158
|
op: "add",
|
|
@@ -7167,7 +7202,7 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
7167
7202
|
}]), S(null);
|
|
7168
7203
|
},
|
|
7169
7204
|
rotate: (e) => {
|
|
7170
|
-
let t = W.current, n = Ae(t), r = t &&
|
|
7205
|
+
let t = W.current, n = Ae(t), r = t && _i(Se(t.slide), t.top);
|
|
7171
7206
|
if (!t || !r) return;
|
|
7172
7207
|
let i = {
|
|
7173
7208
|
...r,
|
|
@@ -7181,7 +7216,7 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
7181
7216
|
}]);
|
|
7182
7217
|
},
|
|
7183
7218
|
align: (e) => {
|
|
7184
|
-
let t = W.current, n = t &&
|
|
7219
|
+
let t = W.current, n = t && _i(Se(t.slide), t.top);
|
|
7185
7220
|
if (!t || !n) return;
|
|
7186
7221
|
let r = { ...n }, i = (n.rot ?? 0) * Math.PI / 180, o = Math.abs(n.w * Math.cos(i)) + Math.abs(n.h * Math.sin(i)), s = Math.abs(n.w * Math.sin(i)) + Math.abs(n.h * Math.cos(i)), c = (o - n.w) / 2, l = (s - n.h) / 2;
|
|
7187
7222
|
e === "left" ? r.x = c : e === "center" || e === "both" ? r.x = (a.w - r.w) / 2 : e === "right" ? r.x = a.w - r.w - c : e === "top" ? r.y = l : e === "middle" ? r.y = (a.h - r.h) / 2 : e === "bottom" && (r.y = a.h - r.h - l), e === "both" && (r.y = (a.h - r.h) / 2), H(t.slide, [{
|
|
@@ -7191,15 +7226,15 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
7191
7226
|
}]);
|
|
7192
7227
|
},
|
|
7193
7228
|
anchor: (e) => {
|
|
7194
|
-
if (
|
|
7195
|
-
|
|
7196
|
-
...
|
|
7229
|
+
if (y.active && y.body) {
|
|
7230
|
+
y.body = {
|
|
7231
|
+
...y.body,
|
|
7197
7232
|
anchor: e
|
|
7198
|
-
}, H(
|
|
7233
|
+
}, H(y.slide, [{
|
|
7199
7234
|
op: "anchor",
|
|
7200
|
-
sid:
|
|
7235
|
+
sid: y.sid,
|
|
7201
7236
|
anchor: e
|
|
7202
|
-
}]),
|
|
7237
|
+
}]), _();
|
|
7203
7238
|
return;
|
|
7204
7239
|
}
|
|
7205
7240
|
let t = W.current, n = Ae(t);
|
|
@@ -7323,11 +7358,11 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
7323
7358
|
label: "Present from this slide",
|
|
7324
7359
|
icon: "play",
|
|
7325
7360
|
sep: !0,
|
|
7326
|
-
run: () =>
|
|
7361
|
+
run: () => ae(e)
|
|
7327
7362
|
}
|
|
7328
7363
|
], Me = (e) => {
|
|
7329
|
-
if (!x ||
|
|
7330
|
-
let t =
|
|
7364
|
+
if (!x || y.active || !i.editable) return !1;
|
|
7365
|
+
let t = _i(Se(x.slide), x.top), n = e.shiftKey ? 10 : 1, r = {
|
|
7331
7366
|
ArrowUp: [0, -n],
|
|
7332
7367
|
ArrowDown: [0, n],
|
|
7333
7368
|
ArrowLeft: [-n, 0],
|
|
@@ -7353,15 +7388,15 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
7353
7388
|
return e.preventDefault(), !0;
|
|
7354
7389
|
}, Ne = (e) => {
|
|
7355
7390
|
let t = c.current;
|
|
7356
|
-
t && (t.scrollTop =
|
|
7391
|
+
t && (t.scrollTop = bi + Math.max(0, Math.min(a.count - 1, e)) * fe - Math.max(0, (l.h - ue) / 2));
|
|
7357
7392
|
}, q = (e) => {
|
|
7358
|
-
if (
|
|
7393
|
+
if (y.active || e.defaultPrevented || Me(e)) return;
|
|
7359
7394
|
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "s") {
|
|
7360
7395
|
e.preventDefault(), i.save();
|
|
7361
7396
|
return;
|
|
7362
7397
|
}
|
|
7363
7398
|
if (e.key === "F5") {
|
|
7364
|
-
e.preventDefault(),
|
|
7399
|
+
e.preventDefault(), ae(e.shiftKey ? 0 : N);
|
|
7365
7400
|
return;
|
|
7366
7401
|
}
|
|
7367
7402
|
let t = e.metaKey || e.ctrlKey;
|
|
@@ -7376,12 +7411,12 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
7376
7411
|
e.preventDefault();
|
|
7377
7412
|
}
|
|
7378
7413
|
}, J = (e) => {
|
|
7379
|
-
let t = C && C.slide === e && C.moved ? C.cur : x ?
|
|
7380
|
-
if (t && x) return /* @__PURE__ */ F(
|
|
7414
|
+
let t = C && C.slide === e && C.moved ? C.cur : x ? _i(Se(e), x.top) : void 0;
|
|
7415
|
+
if (t && x) return /* @__PURE__ */ F(yi, {
|
|
7381
7416
|
box: t,
|
|
7382
7417
|
scale: O,
|
|
7383
7418
|
onHandle: (t, n) => {
|
|
7384
|
-
let r =
|
|
7419
|
+
let r = _i(Se(e), x.top);
|
|
7385
7420
|
r && w({
|
|
7386
7421
|
slide: e,
|
|
7387
7422
|
top: x.top,
|
|
@@ -7400,7 +7435,7 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
7400
7435
|
for (let t = ge; t <= _e; t++) Y.push(/* @__PURE__ */ F("div", {
|
|
7401
7436
|
className: i.editable ? "de-slide-frame de-slide-editable" : "de-slide-frame",
|
|
7402
7437
|
style: {
|
|
7403
|
-
top:
|
|
7438
|
+
top: bi + t * fe,
|
|
7404
7439
|
left: A
|
|
7405
7440
|
},
|
|
7406
7441
|
"data-slide": t + 1,
|
|
@@ -7408,7 +7443,7 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
7408
7443
|
onContextMenu: (e) => {
|
|
7409
7444
|
if (!i.editable) return;
|
|
7410
7445
|
let n = e.target;
|
|
7411
|
-
if (
|
|
7446
|
+
if (y.active && ee.current?.contains(n)) return;
|
|
7412
7447
|
e.preventDefault();
|
|
7413
7448
|
let r = n.closest("[data-top]");
|
|
7414
7449
|
if (r) {
|
|
@@ -7417,28 +7452,28 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
7417
7452
|
slide: t,
|
|
7418
7453
|
top: Number(r.dataset.top)
|
|
7419
7454
|
};
|
|
7420
|
-
W.current = n, S(n),
|
|
7455
|
+
W.current = n, S(n), E({
|
|
7421
7456
|
x: e.clientX,
|
|
7422
7457
|
y: e.clientY,
|
|
7423
7458
|
items: K()
|
|
7424
7459
|
});
|
|
7425
|
-
} else
|
|
7460
|
+
} else E({
|
|
7426
7461
|
x: e.clientX,
|
|
7427
7462
|
y: e.clientY,
|
|
7428
7463
|
items: je(t)
|
|
7429
7464
|
});
|
|
7430
7465
|
},
|
|
7431
|
-
children: /* @__PURE__ */ F(
|
|
7466
|
+
children: /* @__PURE__ */ F(hi, {
|
|
7432
7467
|
client: e,
|
|
7433
7468
|
index: t,
|
|
7434
7469
|
meta: a,
|
|
7435
7470
|
scale: O,
|
|
7436
7471
|
live: !0,
|
|
7437
|
-
editing:
|
|
7472
|
+
editing: y.slide === t ? xe : void 0,
|
|
7438
7473
|
overlay: i.editable && x?.slide === t ? J(t) : void 0
|
|
7439
7474
|
})
|
|
7440
|
-
}, `${
|
|
7441
|
-
|
|
7475
|
+
}, `${te}:${t}`));
|
|
7476
|
+
y.active && (y.slide < ge || y.slide > _e) && z();
|
|
7442
7477
|
let Pe = [];
|
|
7443
7478
|
if (h) for (let t = ye; t <= R; t++) Pe.push(/* @__PURE__ */ I("div", {
|
|
7444
7479
|
className: "de-thumb",
|
|
@@ -7446,7 +7481,7 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
7446
7481
|
"aria-current": t === N,
|
|
7447
7482
|
onClick: () => Ne(t),
|
|
7448
7483
|
onContextMenu: (e) => {
|
|
7449
|
-
i.editable && (e.preventDefault(), Ne(t),
|
|
7484
|
+
i.editable && (e.preventDefault(), Ne(t), E({
|
|
7450
7485
|
x: e.clientX,
|
|
7451
7486
|
y: e.clientY,
|
|
7452
7487
|
items: je(t)
|
|
@@ -7455,14 +7490,14 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
7455
7490
|
children: [/* @__PURE__ */ F("span", {
|
|
7456
7491
|
className: "de-thumb-n",
|
|
7457
7492
|
children: t + 1
|
|
7458
|
-
}), /* @__PURE__ */ F(
|
|
7493
|
+
}), /* @__PURE__ */ F(hi, {
|
|
7459
7494
|
client: e,
|
|
7460
7495
|
index: t,
|
|
7461
7496
|
meta: a,
|
|
7462
7497
|
scale: P,
|
|
7463
7498
|
live: !0
|
|
7464
7499
|
})]
|
|
7465
|
-
}, `${
|
|
7500
|
+
}, `${te}:${t}`));
|
|
7466
7501
|
return /* @__PURE__ */ I("div", {
|
|
7467
7502
|
ref: o,
|
|
7468
7503
|
style: {
|
|
@@ -7514,23 +7549,23 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
7514
7549
|
type: "button",
|
|
7515
7550
|
className: "de-mode de-present-btn",
|
|
7516
7551
|
title: "Present (F5)",
|
|
7517
|
-
onClick: () =>
|
|
7552
|
+
onClick: () => ae(N),
|
|
7518
7553
|
children: "▶ Present"
|
|
7519
7554
|
}),
|
|
7520
7555
|
/* @__PURE__ */ F(ct, {
|
|
7521
7556
|
text: `Slide ${N + 1} of ${a.count}`,
|
|
7522
7557
|
onStatus: t
|
|
7523
7558
|
}),
|
|
7524
|
-
i.editable && /* @__PURE__ */ F(
|
|
7525
|
-
editor:
|
|
7526
|
-
shape: x && !
|
|
7559
|
+
i.editable && /* @__PURE__ */ F(Ur, {
|
|
7560
|
+
editor: y,
|
|
7561
|
+
shape: x && !y.active ? (() => {
|
|
7527
7562
|
let e = Ae(x), t = e?.t === "shape" ? e : void 0;
|
|
7528
7563
|
return {
|
|
7529
7564
|
canText: t?.sid !== void 0,
|
|
7530
7565
|
anchor: t?.text?.anchor
|
|
7531
7566
|
};
|
|
7532
7567
|
})() : null,
|
|
7533
|
-
textAnchor:
|
|
7568
|
+
textAnchor: y.body?.anchor,
|
|
7534
7569
|
canUndo: oe > 0,
|
|
7535
7570
|
onUndo: (e) => void Te(e),
|
|
7536
7571
|
onInsert: (e) => void Ce(e),
|
|
@@ -7555,26 +7590,26 @@ function yi({ client: e, onStatus: t, initialZoom: n = "fit", thumbnails: r = !0
|
|
|
7555
7590
|
color: e
|
|
7556
7591
|
}]),
|
|
7557
7592
|
onSlide: (e) => U(e),
|
|
7558
|
-
onPresent: (e) =>
|
|
7593
|
+
onPresent: (e) => ae(e ? 0 : N)
|
|
7559
7594
|
}),
|
|
7560
|
-
|
|
7561
|
-
x:
|
|
7562
|
-
y:
|
|
7563
|
-
items:
|
|
7564
|
-
onClose: () =>
|
|
7595
|
+
T && /* @__PURE__ */ F(dt, {
|
|
7596
|
+
x: T.x,
|
|
7597
|
+
y: T.y,
|
|
7598
|
+
items: T.items,
|
|
7599
|
+
onClose: () => E(null)
|
|
7565
7600
|
}),
|
|
7566
|
-
|
|
7601
|
+
re !== null && /* @__PURE__ */ F(Wr, {
|
|
7567
7602
|
client: e,
|
|
7568
7603
|
meta: a,
|
|
7569
|
-
start:
|
|
7570
|
-
onClose: () =>
|
|
7604
|
+
start: re,
|
|
7605
|
+
onClose: () => ae(null)
|
|
7571
7606
|
})
|
|
7572
7607
|
]
|
|
7573
7608
|
})]
|
|
7574
7609
|
});
|
|
7575
7610
|
}
|
|
7576
7611
|
// src/react/useDocument.ts
|
|
7577
|
-
function
|
|
7612
|
+
function Ci(e, t = {}) {
|
|
7578
7613
|
let [n, r] = M({
|
|
7579
7614
|
client: null,
|
|
7580
7615
|
error: null,
|
|
@@ -7633,7 +7668,7 @@ function bi(e, t = {}) {
|
|
|
7633
7668
|
]), n;
|
|
7634
7669
|
}
|
|
7635
7670
|
// src/react/xlsx/XlsxToolbar.tsx
|
|
7636
|
-
var
|
|
7671
|
+
var wi = [
|
|
7637
7672
|
{
|
|
7638
7673
|
value: "General",
|
|
7639
7674
|
label: "Automatic",
|
|
@@ -7743,7 +7778,7 @@ var xi = [
|
|
|
7743
7778
|
label: "Duration",
|
|
7744
7779
|
hint: "24:01:00"
|
|
7745
7780
|
}
|
|
7746
|
-
],
|
|
7781
|
+
], Ti = [
|
|
7747
7782
|
6,
|
|
7748
7783
|
7,
|
|
7749
7784
|
8,
|
|
@@ -7759,7 +7794,7 @@ var xi = [
|
|
|
7759
7794
|
28,
|
|
7760
7795
|
36,
|
|
7761
7796
|
48
|
|
7762
|
-
],
|
|
7797
|
+
], Ei = [
|
|
7763
7798
|
{
|
|
7764
7799
|
k: "all",
|
|
7765
7800
|
icon: "bAll",
|
|
@@ -7800,7 +7835,7 @@ var xi = [
|
|
|
7800
7835
|
icon: "bRight",
|
|
7801
7836
|
title: "Right border"
|
|
7802
7837
|
}
|
|
7803
|
-
],
|
|
7838
|
+
], Di = [
|
|
7804
7839
|
{
|
|
7805
7840
|
value: "thin",
|
|
7806
7841
|
label: "Thin",
|
|
@@ -7831,7 +7866,7 @@ var xi = [
|
|
|
7831
7866
|
label: "Double",
|
|
7832
7867
|
hint: "═══"
|
|
7833
7868
|
}
|
|
7834
|
-
],
|
|
7869
|
+
], Oi = [
|
|
7835
7870
|
{
|
|
7836
7871
|
value: "left",
|
|
7837
7872
|
label: "Left",
|
|
@@ -7847,7 +7882,7 @@ var xi = [
|
|
|
7847
7882
|
label: "Right",
|
|
7848
7883
|
icon: "alignRight"
|
|
7849
7884
|
}
|
|
7850
|
-
],
|
|
7885
|
+
], ki = [
|
|
7851
7886
|
{
|
|
7852
7887
|
value: "top",
|
|
7853
7888
|
label: "Top",
|
|
@@ -7863,7 +7898,7 @@ var xi = [
|
|
|
7863
7898
|
label: "Bottom",
|
|
7864
7899
|
icon: "vBottom"
|
|
7865
7900
|
}
|
|
7866
|
-
],
|
|
7901
|
+
], Ai = [
|
|
7867
7902
|
{
|
|
7868
7903
|
value: 0,
|
|
7869
7904
|
label: "None",
|
|
@@ -7894,25 +7929,25 @@ var xi = [
|
|
|
7894
7929
|
label: "Rotate down",
|
|
7895
7930
|
icon: "rotDown90"
|
|
7896
7931
|
}
|
|
7897
|
-
],
|
|
7932
|
+
], ji = [
|
|
7898
7933
|
"SUM",
|
|
7899
7934
|
"AVERAGE",
|
|
7900
7935
|
"COUNT",
|
|
7901
7936
|
"MAX",
|
|
7902
7937
|
"MIN"
|
|
7903
7938
|
];
|
|
7904
|
-
function
|
|
7939
|
+
function Mi(e, t) {
|
|
7905
7940
|
let n = e === "General" || e === "@" ? "0" : e, r = /0(\.0*)?/.exec(n);
|
|
7906
7941
|
if (!r) return t > 0 ? "0.0" : "0";
|
|
7907
7942
|
let i = Math.max(0, (r[1] ? r[1].length - 1 : 0) + t);
|
|
7908
7943
|
return n.slice(0, r.index) + "0" + (i ? "." + "0".repeat(i) : "") + n.slice(r.index + r[0].length);
|
|
7909
7944
|
}
|
|
7910
|
-
function
|
|
7911
|
-
let { css: t, onFormat: n } = e, [r, i] = M("#000000"), [a, o] = M("thin"), s = String(t.textDecoration ?? ""), c = t.textAlign ?? "", l = t.alignItems === "flex-start" ? "top" : t.alignItems === "center" ? "center" : "bottom", u = Number(t.textRotate ?? 0), d = (e) => typeof e == "string" && e.endsWith("pt") ? parseFloat(e) : typeof e == "number" ? Math.round(e * .75 * 2) / 2 : void 0, f = d(t.fontSize) ?? d(e.base.fontSize), p = Ze(t.fontFamily ?? e.base.fontFamily), m =
|
|
7945
|
+
function Ni(e) {
|
|
7946
|
+
let { css: t, onFormat: n } = e, [r, i] = M("#000000"), [a, o] = M("thin"), s = String(t.textDecoration ?? ""), c = t.textAlign ?? "", l = t.alignItems === "flex-start" ? "top" : t.alignItems === "center" ? "center" : "bottom", u = Number(t.textRotate ?? 0), d = (e) => typeof e == "string" && e.endsWith("pt") ? parseFloat(e) : typeof e == "number" ? Math.round(e * .75 * 2) / 2 : void 0, f = d(t.fontSize) ?? d(e.base.fontSize), p = Ze(t.fontFamily ?? e.base.fontFamily), m = wi.find((t) => t.value === e.format), h = m ? wi : [{
|
|
7912
7947
|
value: e.format,
|
|
7913
7948
|
label: "Custom",
|
|
7914
7949
|
hint: e.format
|
|
7915
|
-
}, ...
|
|
7950
|
+
}, ...wi];
|
|
7916
7951
|
return /* @__PURE__ */ I(ot, { children: [
|
|
7917
7952
|
/* @__PURE__ */ F(q, {
|
|
7918
7953
|
icon: "undo",
|
|
@@ -7944,12 +7979,12 @@ function Ai(e) {
|
|
|
7944
7979
|
/* @__PURE__ */ F(q, {
|
|
7945
7980
|
icon: "decLess",
|
|
7946
7981
|
title: "Decrease decimal places",
|
|
7947
|
-
onClick: () => n({ numFmt:
|
|
7982
|
+
onClick: () => n({ numFmt: Mi(e.format, -1) })
|
|
7948
7983
|
}),
|
|
7949
7984
|
/* @__PURE__ */ F(q, {
|
|
7950
7985
|
icon: "decMore",
|
|
7951
7986
|
title: "Increase decimal places",
|
|
7952
|
-
onClick: () => n({ numFmt:
|
|
7987
|
+
onClick: () => n({ numFmt: Mi(e.format, 1) })
|
|
7953
7988
|
}),
|
|
7954
7989
|
/* @__PURE__ */ F(Pe, {
|
|
7955
7990
|
title: `Number format: ${m?.label ?? "Custom"}`,
|
|
@@ -7972,7 +8007,7 @@ function Ai(e) {
|
|
|
7972
8007
|
/* @__PURE__ */ F(J, {}),
|
|
7973
8008
|
/* @__PURE__ */ F(Fe, {
|
|
7974
8009
|
value: f,
|
|
7975
|
-
sizes:
|
|
8010
|
+
sizes: Ti,
|
|
7976
8011
|
onChange: (e) => n({ sz: e })
|
|
7977
8012
|
}),
|
|
7978
8013
|
/* @__PURE__ */ F(J, {}),
|
|
@@ -8025,7 +8060,7 @@ function Ai(e) {
|
|
|
8025
8060
|
className: "de-borders",
|
|
8026
8061
|
role: "group",
|
|
8027
8062
|
"aria-label": "Borders",
|
|
8028
|
-
children:
|
|
8063
|
+
children: Ei.map((t) => /* @__PURE__ */ F("button", {
|
|
8029
8064
|
type: "button",
|
|
8030
8065
|
className: "de-tb",
|
|
8031
8066
|
title: t.title,
|
|
@@ -8053,7 +8088,7 @@ function Ai(e) {
|
|
|
8053
8088
|
label: null,
|
|
8054
8089
|
menuWidth: 150,
|
|
8055
8090
|
value: a,
|
|
8056
|
-
options: [...
|
|
8091
|
+
options: [...Di],
|
|
8057
8092
|
onChange: (e) => o(e)
|
|
8058
8093
|
})]
|
|
8059
8094
|
})]
|
|
@@ -8089,20 +8124,20 @@ function Ai(e) {
|
|
|
8089
8124
|
/* @__PURE__ */ F(J, {}),
|
|
8090
8125
|
/* @__PURE__ */ F(Y, {
|
|
8091
8126
|
title: "Horizontal align",
|
|
8092
|
-
icon:
|
|
8127
|
+
icon: Oi.find((e) => e.value === c)?.icon ?? "alignLeft",
|
|
8093
8128
|
label: null,
|
|
8094
8129
|
menuWidth: 140,
|
|
8095
8130
|
value: c,
|
|
8096
|
-
options:
|
|
8131
|
+
options: Oi.map((e) => ({ ...e })),
|
|
8097
8132
|
onChange: (e) => n({ align: e === c ? null : e })
|
|
8098
8133
|
}),
|
|
8099
8134
|
/* @__PURE__ */ F(Y, {
|
|
8100
8135
|
title: "Vertical align",
|
|
8101
|
-
icon:
|
|
8136
|
+
icon: ki.find((e) => e.value === l).icon,
|
|
8102
8137
|
label: null,
|
|
8103
8138
|
menuWidth: 140,
|
|
8104
8139
|
value: l,
|
|
8105
|
-
options:
|
|
8140
|
+
options: ki.map((e) => ({ ...e })),
|
|
8106
8141
|
onChange: (e) => n({ valign: e })
|
|
8107
8142
|
}),
|
|
8108
8143
|
/* @__PURE__ */ F(q, {
|
|
@@ -8113,11 +8148,11 @@ function Ai(e) {
|
|
|
8113
8148
|
}),
|
|
8114
8149
|
/* @__PURE__ */ F(Y, {
|
|
8115
8150
|
title: "Text rotation",
|
|
8116
|
-
icon:
|
|
8151
|
+
icon: Ai.find((e) => e.value === u)?.icon ?? "rotNone",
|
|
8117
8152
|
label: null,
|
|
8118
8153
|
menuWidth: 180,
|
|
8119
8154
|
value: u,
|
|
8120
|
-
options:
|
|
8155
|
+
options: Ai,
|
|
8121
8156
|
onChange: (e) => n({ rotate: e || null })
|
|
8122
8157
|
}),
|
|
8123
8158
|
/* @__PURE__ */ F(J, {}),
|
|
@@ -8186,7 +8221,7 @@ function Ai(e) {
|
|
|
8186
8221
|
icon: "sum",
|
|
8187
8222
|
label: null,
|
|
8188
8223
|
menuWidth: 170,
|
|
8189
|
-
options: [...
|
|
8224
|
+
options: [...ji.map((e) => ({
|
|
8190
8225
|
value: e,
|
|
8191
8226
|
label: e
|
|
8192
8227
|
})), {
|
|
@@ -8257,7 +8292,7 @@ function Ai(e) {
|
|
|
8257
8292
|
] });
|
|
8258
8293
|
}
|
|
8259
8294
|
// src/react/xlsx/axis.ts
|
|
8260
|
-
var
|
|
8295
|
+
var Pi = class {
|
|
8261
8296
|
def;
|
|
8262
8297
|
count = 0;
|
|
8263
8298
|
custom = /* @__PURE__ */ new Map();
|
|
@@ -8304,19 +8339,31 @@ var ji = class {
|
|
|
8304
8339
|
}
|
|
8305
8340
|
return t;
|
|
8306
8341
|
}
|
|
8307
|
-
},
|
|
8308
|
-
|
|
8342
|
+
}, Fi = (e, t) => typeof e == "string" && e.endsWith("pt") ? parseFloat(e) * 4 / 3 : typeof e == "number" ? e : t;
|
|
8343
|
+
function Ii(e, t, n) {
|
|
8344
|
+
let r = n * .56;
|
|
8345
|
+
if (e.length * r <= t) return e;
|
|
8346
|
+
let i = /^(-?\d+)\.(\d+)$/.exec(e);
|
|
8347
|
+
if (i && (i[1].length + (e.startsWith("-"), 0)) * r <= t) {
|
|
8348
|
+
let n = Math.max(0, Math.floor(t / r) - i[1].length - 1), a = Number(e).toFixed(n);
|
|
8349
|
+
if (a.length * r <= t) return a;
|
|
8350
|
+
}
|
|
8351
|
+
return "#".repeat(Math.max(1, Math.floor(t / r)));
|
|
8352
|
+
}
|
|
8353
|
+
// src/react/xlsx/print.tsx
|
|
8354
|
+
var Li = 2e3, Ri = 2e4, zi = 100, Bi = 700, Vi = 960;
|
|
8355
|
+
async function Hi(e, t, n) {
|
|
8309
8356
|
let r = /* @__PURE__ */ new Map();
|
|
8310
|
-
for (let i = 0; i < n; i +=
|
|
8311
|
-
let a = await e.call("xlsx.block", t, i, Math.min(n, i +
|
|
8357
|
+
for (let i = 0; i < n; i += Li) {
|
|
8358
|
+
let a = await e.call("xlsx.block", t, i, Math.min(n, i + Li));
|
|
8312
8359
|
for (let e of a.rows) r.set(e.r, e.cells);
|
|
8313
8360
|
}
|
|
8314
8361
|
return r;
|
|
8315
8362
|
}
|
|
8316
|
-
var
|
|
8317
|
-
async function
|
|
8318
|
-
if (!n.done) throw
|
|
8319
|
-
let i = await
|
|
8363
|
+
var Ui = () => /* @__PURE__ */ Error("The sheet is still loading — try again in a moment");
|
|
8364
|
+
async function Wi(e, t, n, r) {
|
|
8365
|
+
if (!n.done) throw Ui();
|
|
8366
|
+
let i = await Hi(e, t, n.rows), a = -1, o = -1;
|
|
8320
8367
|
for (let [e, t] of i) for (let n of t) n[1] !== "" && (a = Math.max(a, e), o = Math.max(o, n[0]));
|
|
8321
8368
|
let s = [];
|
|
8322
8369
|
for (let e = 0; e <= a; e++) {
|
|
@@ -8326,81 +8373,82 @@ async function Ri(e, t, n, r) {
|
|
|
8326
8373
|
}
|
|
8327
8374
|
return (r === "," ? "" : "") + Qt(s, r);
|
|
8328
8375
|
}
|
|
8329
|
-
var
|
|
8376
|
+
var Gi = {
|
|
8330
8377
|
"flex-start": "top",
|
|
8331
8378
|
center: "middle",
|
|
8332
8379
|
"flex-end": "bottom"
|
|
8333
8380
|
};
|
|
8334
|
-
async function
|
|
8335
|
-
if (!n.done) throw
|
|
8336
|
-
let i = await
|
|
8381
|
+
async function Ki(e, t, n, r) {
|
|
8382
|
+
if (!n.done) throw Ui();
|
|
8383
|
+
let i = await Hi(e, t, Math.min(n.rows, Ri)), a = -1, o = -1;
|
|
8337
8384
|
for (let [e, t] of i) for (let n of t) (n[1] !== "" || n[2]) && (a = Math.max(a, e), o = Math.max(o, n[0]));
|
|
8338
8385
|
let s = n.merges.filter((e) => e.r0 <= a && e.c0 <= o);
|
|
8339
8386
|
for (let e of s) a = Math.max(a, Math.min(e.r1, 19999)), o = Math.max(o, e.c1);
|
|
8340
8387
|
let c = [];
|
|
8341
8388
|
for (let e = 0; e <= o; e++) n.colAxis.size(e) > 0 && c.push(e);
|
|
8342
|
-
let l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Set(), d = (e, t) => e * 16384 + t;
|
|
8389
|
+
let l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Set(), d = (e, t) => e * 16384 + t, f = new Int32Array(a + 2);
|
|
8343
8390
|
for (let e of s) {
|
|
8344
8391
|
l.set(d(e.r0, e.c0), e);
|
|
8345
|
-
|
|
8392
|
+
let t = Math.min(e.r1, a);
|
|
8393
|
+
for (let n = e.r0; n <= t; n++) for (let t = e.c0; t <= e.c1; t++) (n !== e.r0 || t !== e.c0) && u.add(d(n, t));
|
|
8394
|
+
t > e.r0 && (f[e.r0 + 1]++, f[t + 1]--);
|
|
8346
8395
|
}
|
|
8347
|
-
let
|
|
8396
|
+
let p = (e, t, n) => {
|
|
8348
8397
|
let r = 0;
|
|
8349
8398
|
for (let i = t; i <= n; i++) e.size(i) > 0 && r++;
|
|
8350
8399
|
return Math.max(1, r);
|
|
8351
|
-
},
|
|
8400
|
+
}, m = Fi(r.baseFont.fontSize, 14.67), h = [], g = [], _ = 0;
|
|
8352
8401
|
for (let e = 0; e <= a; e++) {
|
|
8402
|
+
_ += f[e], !_ && g.length >= zi && (h.push(g), g = []);
|
|
8353
8403
|
let t = n.rowAxis.size(e);
|
|
8354
8404
|
if (!t) continue;
|
|
8355
|
-
let s = new Map((i.get(e) ?? []).map((e) => [e[0], e])),
|
|
8405
|
+
let s = new Map((i.get(e) ?? []).map((e) => [e[0], e])), v = [];
|
|
8356
8406
|
c.forEach((t, i) => {
|
|
8357
8407
|
if (u.has(d(e, t))) return;
|
|
8358
|
-
let
|
|
8359
|
-
|
|
8360
|
-
|
|
8361
|
-
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
colSpan: h ? f(n.colAxis, h.c0, Math.min(h.c1, o)) : void 0,
|
|
8368
|
-
rowSpan: h ? f(n.rowAxis, h.r0, Math.min(h.r1, a)) : void 0,
|
|
8369
|
-
children: g
|
|
8408
|
+
let f = s.get(t), h = l.get(d(e, t)), [, g = "", _ = 0, y = 0, b] = f ?? [], { textAlign: ee, textRotate: x, alignItems: S, whiteSpace: C, ...w } = r.styles[_] ?? {}, te = h ? n.colAxis.pos(Math.min(h.c1, o) + 1) - n.colAxis.pos(h.c0) : n.colAxis.size(t), ne = y === 1 && g ? Ii(g, te - 6, Fi(w.fontSize, m)) : g, re = ee ?? (y === 1 ? "right" : y === 2 ? "center" : "left"), ie = c[i + 1], ae = !!ne && !h && re === "left" && !C && (ie === void 0 || !s.get(ie)?.[1] && !u.has(d(e, ie))), T = { ...w };
|
|
8409
|
+
re !== "left" && (T.textAlign = re);
|
|
8410
|
+
let E = Gi[S];
|
|
8411
|
+
E && E !== "bottom" && (T.verticalAlign = E), C && (T.whiteSpace = C), b && (T.color = b), v.push(/* @__PURE__ */ F("td", {
|
|
8412
|
+
style: T,
|
|
8413
|
+
"data-de-fit": ne && !ae ? y === 1 ? "#" : "" : void 0,
|
|
8414
|
+
colSpan: h ? p(n.colAxis, h.c0, Math.min(h.c1, o)) : void 0,
|
|
8415
|
+
rowSpan: h ? p(n.rowAxis, h.r0, Math.min(h.r1, a)) : void 0,
|
|
8416
|
+
children: ne
|
|
8370
8417
|
}, t));
|
|
8371
|
-
}),
|
|
8418
|
+
}), g.push(/* @__PURE__ */ F("tr", {
|
|
8372
8419
|
style: { height: t },
|
|
8373
|
-
children:
|
|
8420
|
+
children: v
|
|
8374
8421
|
}, e));
|
|
8375
8422
|
}
|
|
8376
|
-
|
|
8423
|
+
(g.length || !h.length) && h.push(g);
|
|
8424
|
+
let v = c.reduce((e, t) => e + n.colAxis.size(t), 0), y = v > Bi, b = Math.max(.35, Math.min(1, (y ? Vi : Bi) / Math.max(1, v))), ee = n.gridLines ? "de-print-table de-print-grid" : "de-print-table", x = {
|
|
8425
|
+
width: v,
|
|
8426
|
+
...r.baseFont
|
|
8427
|
+
}, S = /* @__PURE__ */ F("colgroup", { children: c.map((e) => /* @__PURE__ */ F("col", { style: { width: n.colAxis.size(e) } }, e)) });
|
|
8377
8428
|
return {
|
|
8378
8429
|
node: /* @__PURE__ */ F("div", {
|
|
8379
8430
|
className: "de-print-sheet de-print-fit",
|
|
8380
|
-
style: { "--de-fit":
|
|
8381
|
-
children: /* @__PURE__ */ I("table", {
|
|
8382
|
-
className:
|
|
8383
|
-
style:
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
},
|
|
8387
|
-
children: [/* @__PURE__ */ F("colgroup", { children: c.map((e) => /* @__PURE__ */ F("col", { style: { width: n.colAxis.size(e) } }, e)) }), /* @__PURE__ */ F("tbody", { children: p })]
|
|
8388
|
-
})
|
|
8431
|
+
style: { "--de-fit": b },
|
|
8432
|
+
children: h.map((e, t) => /* @__PURE__ */ I("table", {
|
|
8433
|
+
className: ee,
|
|
8434
|
+
style: x,
|
|
8435
|
+
children: [S, /* @__PURE__ */ F("tbody", { children: e })]
|
|
8436
|
+
}, t))
|
|
8389
8437
|
}),
|
|
8390
|
-
size:
|
|
8438
|
+
size: y ? "landscape" : "auto",
|
|
8391
8439
|
margin: "12mm",
|
|
8392
|
-
notice: n.rows >
|
|
8440
|
+
notice: n.rows > Ri ? `Only the first ${Ri.toLocaleString()} rows are included` : void 0
|
|
8393
8441
|
};
|
|
8394
8442
|
}
|
|
8395
8443
|
// src/react/xlsx/XlsxView.tsx
|
|
8396
|
-
var
|
|
8444
|
+
var qi = 128, Ji = 22, Yi = 12e6, Xi = class {
|
|
8397
8445
|
rows = 0;
|
|
8398
8446
|
cols = 0;
|
|
8399
8447
|
done = !1;
|
|
8400
8448
|
error;
|
|
8401
8449
|
header = !1;
|
|
8402
|
-
rowAxis = new
|
|
8403
|
-
colAxis = new
|
|
8450
|
+
rowAxis = new Pi(20);
|
|
8451
|
+
colAxis = new Pi(64);
|
|
8404
8452
|
merges = [];
|
|
8405
8453
|
frozen = {
|
|
8406
8454
|
rows: 0,
|
|
@@ -8411,7 +8459,7 @@ var Vi = 128, Hi = 22, Ui = 12e6, Wi = class {
|
|
|
8411
8459
|
inflight = /* @__PURE__ */ new Set();
|
|
8412
8460
|
sel;
|
|
8413
8461
|
scrollPos;
|
|
8414
|
-
},
|
|
8462
|
+
}, Zi = class {
|
|
8415
8463
|
client;
|
|
8416
8464
|
sheets = /* @__PURE__ */ new Map();
|
|
8417
8465
|
focusGrid = !1;
|
|
@@ -8432,7 +8480,7 @@ var Vi = 128, Hi = 22, Ui = 12e6, Wi = class {
|
|
|
8432
8480
|
}
|
|
8433
8481
|
sheet(e) {
|
|
8434
8482
|
let t = this.sheets.get(e);
|
|
8435
|
-
return t || (t = new
|
|
8483
|
+
return t || (t = new Xi(), this.sheets.set(e, t), this.client.call("xlsx.load", e).catch((e) => {
|
|
8436
8484
|
t.error = e.message, t.done = !0, this.emit();
|
|
8437
8485
|
})), t;
|
|
8438
8486
|
}
|
|
@@ -8448,12 +8496,12 @@ var Vi = 128, Hi = 22, Ui = 12e6, Wi = class {
|
|
|
8448
8496
|
}
|
|
8449
8497
|
ensure(e, t, n) {
|
|
8450
8498
|
let r = this.sheet(e);
|
|
8451
|
-
if (r.header || r.done) for (let i = Math.floor(t /
|
|
8499
|
+
if (r.header || r.done) for (let i = Math.floor(t / qi); i <= Math.floor(n / qi); i++) {
|
|
8452
8500
|
let t = r.blocks.get(i);
|
|
8453
|
-
if (r.inflight.has(i) || t && (t.complete || t.rowsAt === r.rows && !r.done) || i *
|
|
8501
|
+
if (r.inflight.has(i) || t && (t.complete || t.rowsAt === r.rows && !r.done) || i * qi > r.rows && !r.done && t) continue;
|
|
8454
8502
|
r.inflight.add(i);
|
|
8455
8503
|
let n = r.rows;
|
|
8456
|
-
this.client.call("xlsx.block", e, i *
|
|
8504
|
+
this.client.call("xlsx.block", e, i * qi, (i + 1) * qi).then((e) => {
|
|
8457
8505
|
let t = /* @__PURE__ */ new Map();
|
|
8458
8506
|
for (let n of e.rows) t.set(n.r, n.cells);
|
|
8459
8507
|
if (r.blocks.set(i, {
|
|
@@ -8471,7 +8519,7 @@ var Vi = 128, Hi = 22, Ui = 12e6, Wi = class {
|
|
|
8471
8519
|
}
|
|
8472
8520
|
invalidate(e, t, n) {
|
|
8473
8521
|
let r = this.sheet(e);
|
|
8474
|
-
for (let e = Math.floor(t /
|
|
8522
|
+
for (let e = Math.floor(t / qi); e <= Math.floor(n / qi); e++) r.blocks.delete(e);
|
|
8475
8523
|
r.rows = Math.max(r.rows, n + 1), this.emit();
|
|
8476
8524
|
}
|
|
8477
8525
|
applied(e, t) {
|
|
@@ -8485,30 +8533,30 @@ var Vi = 128, Hi = 22, Ui = 12e6, Wi = class {
|
|
|
8485
8533
|
let n = this.sheet(e.sheet);
|
|
8486
8534
|
if (e.layout) {
|
|
8487
8535
|
let t = e.layout;
|
|
8488
|
-
n.rowAxis = new
|
|
8536
|
+
n.rowAxis = new Pi(t.defaultRowH || n.rowAxis.def), n.colAxis = new Pi(t.defaultColW || n.colAxis.def);
|
|
8489
8537
|
for (let e of t.colInfo ?? []) n.colAxis.setRange(e.min, e.max, e.w);
|
|
8490
8538
|
for (let [e, r] of t.rowSizes) n.rowAxis.set(e, r);
|
|
8491
8539
|
n.merges = t.merges ?? [], n.frozen = t.frozen ?? n.frozen, t.gridLines !== void 0 && (n.gridLines = t.gridLines), n.rows = t.rows, n.cols = t.cols, n.blocks.clear(), this.emit();
|
|
8492
8540
|
} else n.cols = Math.max(n.cols, e.range.c1 + 1), this.invalidate(e.sheet, e.range.r0, e.range.r1);
|
|
8493
8541
|
}
|
|
8494
8542
|
row(e, t) {
|
|
8495
|
-
return this.sheets.get(e)?.blocks.get(Math.floor(t /
|
|
8543
|
+
return this.sheets.get(e)?.blocks.get(Math.floor(t / qi))?.rows.get(t);
|
|
8496
8544
|
}
|
|
8497
8545
|
dispose() {
|
|
8498
8546
|
this.off(), this.listeners.clear();
|
|
8499
8547
|
}
|
|
8500
|
-
},
|
|
8501
|
-
function
|
|
8502
|
-
let t =
|
|
8503
|
-
return t ||
|
|
8548
|
+
}, Qi = /* @__PURE__ */ new WeakMap();
|
|
8549
|
+
function $i(e) {
|
|
8550
|
+
let t = Qi.get(e);
|
|
8551
|
+
return t || Qi.set(e, t = new Zi(e)), t;
|
|
8504
8552
|
}
|
|
8505
|
-
function
|
|
8506
|
-
let r = e.info.xlsx, i = r.sheets.filter((e) => !e.hidden), [a, o] = M(n ?? i[0]?.index ?? 0), s = he(() =>
|
|
8553
|
+
function ea({ client: e, onStatus: t, initialSheet: n }) {
|
|
8554
|
+
let r = e.info.xlsx, i = r.sheets.filter((e) => !e.hidden), [a, o] = M(n ?? i[0]?.index ?? 0), s = he(() => $i(e), [e]), [, c] = De();
|
|
8507
8555
|
k(() => s.subscribe(c), [s, c]);
|
|
8508
8556
|
let l = s.sheet(a), u = l.error ? `Error: ${l.error}` : `${l.rows.toLocaleString()} rows × ${l.cols.toLocaleString()} cols${l.done ? "" : " · loading…"}`, d = it();
|
|
8509
8557
|
at({
|
|
8510
|
-
printable: () =>
|
|
8511
|
-
text: (t) =>
|
|
8558
|
+
printable: () => Ki(e, _, s.sheet(_), r),
|
|
8559
|
+
text: (t) => Wi(e, _, s.sheet(_), t === "tsv" ? " " : ","),
|
|
8512
8560
|
stats: () => {
|
|
8513
8561
|
let e = s.sheet(_);
|
|
8514
8562
|
return [
|
|
@@ -8548,9 +8596,9 @@ function Ji({ client: e, onStatus: t, initialSheet: n }) {
|
|
|
8548
8596
|
let i = await e.call("xlsx.bookOp", t);
|
|
8549
8597
|
s.applied(i, r), d.setDirty(!0), n !== void 0 && o(Math.max(0, Math.min(n, r.sheets.length - 1))), c();
|
|
8550
8598
|
} catch (e) {
|
|
8551
|
-
|
|
8599
|
+
ta(e);
|
|
8552
8600
|
}
|
|
8553
|
-
}, _ = Math.min(a, r.sheets.length - 1), [v, y] = M(null), b = j(!1),
|
|
8601
|
+
}, _ = Math.min(a, r.sheets.length - 1), [v, y] = M(null), b = j(!1), ee = !!v && ye(v.value) && ia(v, be(v.value, v.caret));
|
|
8554
8602
|
return /* @__PURE__ */ I("div", {
|
|
8555
8603
|
className: "de-xlsx",
|
|
8556
8604
|
children: [
|
|
@@ -8558,7 +8606,7 @@ function Ji({ client: e, onStatus: t, initialSheet: n }) {
|
|
|
8558
8606
|
text: u,
|
|
8559
8607
|
onStatus: t
|
|
8560
8608
|
}),
|
|
8561
|
-
/* @__PURE__ */ F(
|
|
8609
|
+
/* @__PURE__ */ F(ua, {
|
|
8562
8610
|
store: s,
|
|
8563
8611
|
sheet: _,
|
|
8564
8612
|
meta: r,
|
|
@@ -8600,7 +8648,7 @@ function Ji({ client: e, onStatus: t, initialSheet: n }) {
|
|
|
8600
8648
|
className: "de-tab",
|
|
8601
8649
|
"aria-selected": e.index === _,
|
|
8602
8650
|
onMouseDown: (t) => {
|
|
8603
|
-
|
|
8651
|
+
ee && (t.preventDefault(), e.index !== _ && (b.current = !0));
|
|
8604
8652
|
},
|
|
8605
8653
|
onClick: () => o(e.index),
|
|
8606
8654
|
onDoubleClick: () => d.editable && p(e.index),
|
|
@@ -8662,21 +8710,10 @@ function Ji({ client: e, onStatus: t, initialSheet: n }) {
|
|
|
8662
8710
|
]
|
|
8663
8711
|
});
|
|
8664
8712
|
}
|
|
8665
|
-
function
|
|
8713
|
+
function ta(e) {
|
|
8666
8714
|
console.error("[office-engine]", e);
|
|
8667
8715
|
}
|
|
8668
|
-
|
|
8669
|
-
function Zi(e, t, n) {
|
|
8670
|
-
let r = n * .56;
|
|
8671
|
-
if (e.length * r <= t) return e;
|
|
8672
|
-
let i = /^(-?\d+)\.(\d+)$/.exec(e);
|
|
8673
|
-
if (i && (i[1].length + (e.startsWith("-"), 0)) * r <= t) {
|
|
8674
|
-
let n = Math.max(0, Math.floor(t / r) - i[1].length - 1), a = Number(e).toFixed(n);
|
|
8675
|
-
if (a.length * r <= t) return a;
|
|
8676
|
-
}
|
|
8677
|
-
return "#".repeat(Math.max(1, Math.floor(t / r)));
|
|
8678
|
-
}
|
|
8679
|
-
function Qi(e) {
|
|
8716
|
+
function na(e) {
|
|
8680
8717
|
return e === 255 ? {
|
|
8681
8718
|
writingMode: "vertical-rl",
|
|
8682
8719
|
textOrientation: "upright",
|
|
@@ -8694,16 +8731,16 @@ function Qi(e) {
|
|
|
8694
8731
|
whiteSpace: "nowrap"
|
|
8695
8732
|
};
|
|
8696
8733
|
}
|
|
8697
|
-
var
|
|
8734
|
+
var ra = {
|
|
8698
8735
|
center: "center",
|
|
8699
8736
|
right: "flex-end",
|
|
8700
8737
|
left: "flex-start",
|
|
8701
8738
|
justify: "flex-start"
|
|
8702
8739
|
};
|
|
8703
|
-
function
|
|
8740
|
+
function ia(e, t) {
|
|
8704
8741
|
return t ? e.point && e.point.e === e.caret && e.caret === e.caretEnd ? !0 : e.caret === e.caretEnd ? t.pointable : t.refs.some((t) => t.s === e.caret && t.e === e.caretEnd) : !1;
|
|
8705
8742
|
}
|
|
8706
|
-
var
|
|
8743
|
+
var aa = [
|
|
8707
8744
|
"#1a73e8",
|
|
8708
8745
|
"#e8710a",
|
|
8709
8746
|
"#9334e6",
|
|
@@ -8712,18 +8749,18 @@ var ta = [
|
|
|
8712
8749
|
"#12a4b8",
|
|
8713
8750
|
"#e52592",
|
|
8714
8751
|
"#b08800"
|
|
8715
|
-
],
|
|
8752
|
+
], oa = (e) => e.replace(/\$/g, "").toUpperCase(), sa = {
|
|
8716
8753
|
ArrowUp: [-1, 0],
|
|
8717
8754
|
ArrowDown: [1, 0],
|
|
8718
8755
|
ArrowLeft: [0, -1],
|
|
8719
8756
|
ArrowRight: [0, 1]
|
|
8720
|
-
},
|
|
8757
|
+
}, ca = (e) => ({
|
|
8721
8758
|
r0: Math.min(e.ar, e.fr),
|
|
8722
8759
|
c0: Math.min(e.ac, e.fc),
|
|
8723
8760
|
r1: Math.max(e.ar, e.fr),
|
|
8724
8761
|
c1: Math.max(e.ac, e.fc)
|
|
8725
8762
|
});
|
|
8726
|
-
function
|
|
8763
|
+
function la(e, t) {
|
|
8727
8764
|
let n = e;
|
|
8728
8765
|
for (let e = !0; e;) {
|
|
8729
8766
|
e = !1;
|
|
@@ -8736,23 +8773,23 @@ function aa(e, t) {
|
|
|
8736
8773
|
}
|
|
8737
8774
|
return n;
|
|
8738
8775
|
}
|
|
8739
|
-
function
|
|
8740
|
-
let d = it(), f = d.editable, p = e.sheet(t), [m,
|
|
8776
|
+
function ua({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold: o, onSheet: c }) {
|
|
8777
|
+
let d = it(), f = d.editable, p = e.sheet(t), [m, h] = Oe(), v = ke(m), [y, b] = M(() => p.sel ?? {
|
|
8741
8778
|
ar: 0,
|
|
8742
8779
|
ac: 0,
|
|
8743
8780
|
fr: 0,
|
|
8744
8781
|
fc: 0
|
|
8745
8782
|
});
|
|
8746
8783
|
p.sel = y;
|
|
8747
|
-
let [
|
|
8784
|
+
let [ee, x] = M(null), S = ee && ee.r === y.ar && ee.c === y.ac ? ee.d : void 0, [C, w] = M(0), te = j(!1), re = j(null), ie = j(null), ae = j(null), [T, E] = M(0), [oe, se] = M(null), [D, ce] = M(null), le = j(null), [O, ue] = M({
|
|
8748
8785
|
open: !1,
|
|
8749
8786
|
q: "",
|
|
8750
8787
|
idx: 0,
|
|
8751
8788
|
replace: !1,
|
|
8752
8789
|
tick: 0
|
|
8753
|
-
}), [de, fe] = M({}), [pe, me] = M([]), [ge, N] = M(null), [L, ve] = M(null), { rowAxis: R, colAxis: z, frozen: B } = p, V = Math.max(40, 12 + 7 * String(Math.max(p.rows, 1e3)).length), H = Math.max(0,
|
|
8790
|
+
}), [de, fe] = M({}), [pe, me] = M([]), [ge, N] = M(null), [L, ve] = M(null), { rowAxis: R, colAxis: z, frozen: B } = p, V = Math.max(40, 12 + 7 * String(Math.max(p.rows, 1e3)).length), H = Math.max(0, h.w - V), Ee = Math.max(0, h.h - Ji);
|
|
8754
8791
|
R.count = Math.max(p.rows + (p.done ? 20 : 1), Math.ceil(Ee / R.def) + 1, B.rows + 1, y.fr + 2), z.count = Math.max(p.cols + 3, 26, Math.ceil(H / Math.max(1, z.def)) + 1, B.cols + 1, y.fc + 2);
|
|
8755
|
-
let De = z.pos(B.cols), U = R.pos(B.rows), Ae = z.total(), W = R.total(), G = V + Ae, K = Math.min(
|
|
8792
|
+
let De = z.pos(B.cols), U = R.pos(B.rows), Ae = z.total(), W = R.total(), G = V + Ae, K = Math.min(Ji + W, Yi), je = Math.max(0, Ji + W - h.h), Me = Math.max(0, K - h.h), Ne = Me > 0 ? Math.min(je, v.y / Me * je) : 0, q = v.x, J = De + q, Y = U + Ne, Pe = Math.max(0, H - De), Fe = Math.max(0, Ee - U), Ie = R.index(Y), Le = Math.min(R.count - 1, R.index(Y + Fe)), Re = z.index(J), ze = Math.min(z.count - 1, z.index(J + Pe)), Be = he(() => p.merges.filter((e) => e.r1 >= Ie && e.r0 <= Le || e.r0 < B.rows ? e.c1 >= Re && e.c0 <= ze || e.c0 < B.cols : !1), [
|
|
8756
8793
|
p.merges,
|
|
8757
8794
|
Ie,
|
|
8758
8795
|
Le,
|
|
@@ -8766,7 +8803,7 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
8766
8803
|
for (let n of Be) n.r0 < Ie && e.ensure(t, n.r0, n.r0);
|
|
8767
8804
|
}), k(() => {
|
|
8768
8805
|
let e = !0, { ar: n, ac: i } = y;
|
|
8769
|
-
return r.call("xlsx.cell", t, n, i).then((t) => e &&
|
|
8806
|
+
return r.call("xlsx.cell", t, n, i).then((t) => e && x({
|
|
8770
8807
|
r: n,
|
|
8771
8808
|
c: i,
|
|
8772
8809
|
d: t
|
|
@@ -8779,10 +8816,10 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
8779
8816
|
y.ar,
|
|
8780
8817
|
y.ac,
|
|
8781
8818
|
p.done,
|
|
8782
|
-
|
|
8819
|
+
C
|
|
8783
8820
|
]);
|
|
8784
|
-
let Ve = n.styles, He =
|
|
8785
|
-
Ge.current = X, k(() =>
|
|
8821
|
+
let Ve = n.styles, He = Fi(n.baseFont.fontSize, 14.67), Ue = (e, t) => p.merges.find((n) => e >= n.r0 && e <= n.r1 && t >= n.c0 && t <= n.c1), X = la(ca(y), p.merges), We = X.r0 === X.r1 && X.c0 === X.c1 || p.merges.some((e) => e.r0 === X.r0 && e.c0 === X.c0 && e.r1 === X.r1 && e.c1 === X.c1), Ge = j(X);
|
|
8822
|
+
Ge.current = X, k(() => g(r, {
|
|
8786
8823
|
sheet: t,
|
|
8787
8824
|
range: X,
|
|
8788
8825
|
ar: y.ar,
|
|
@@ -8797,7 +8834,7 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
8797
8834
|
y.ar,
|
|
8798
8835
|
y.ac
|
|
8799
8836
|
]);
|
|
8800
|
-
let Ke = _e((e) =>
|
|
8837
|
+
let Ke = _e((e) => ne(r, e), () => _(r)), qe = n.sheets[t]?.path, Je = Ke.flatMap((e) => {
|
|
8801
8838
|
let t = e.presence;
|
|
8802
8839
|
return t?.k === "xlsx" && t.sheet === qe && t.range ? [{
|
|
8803
8840
|
...e,
|
|
@@ -8846,31 +8883,31 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
8846
8883
|
let [l, u, d, f, p] = t, m = n ?? z.size(l), g = r ?? R.size(e);
|
|
8847
8884
|
if (!m || !g) return null;
|
|
8848
8885
|
let _ = Ve[d] ?? {}, v = u;
|
|
8849
|
-
f === 1 && u && (v =
|
|
8850
|
-
let { textAlign: y, textRotate: b, alignItems:
|
|
8851
|
-
if (v && !
|
|
8886
|
+
f === 1 && u && (v = Ii(u, m - 6, Fi(_.fontSize, He)));
|
|
8887
|
+
let { textAlign: y, textRotate: b, alignItems: ee, whiteSpace: x, ...S } = _, C = Number(b ?? 0), w = y && ra[y] || (f === 1 ? "flex-end" : f === 2 ? "center" : "flex-start"), te = 0;
|
|
8888
|
+
if (v && !C && !x && w === "flex-start" && !a && i) {
|
|
8852
8889
|
let t = l + 1;
|
|
8853
8890
|
for (; t <= o + 8 && !i.has(t) && !h.has(e * 16384 + t);) t++;
|
|
8854
|
-
|
|
8891
|
+
te = z.pos(t) - z.pos(l);
|
|
8855
8892
|
}
|
|
8856
|
-
let
|
|
8857
|
-
...
|
|
8893
|
+
let ne = {
|
|
8894
|
+
...S,
|
|
8858
8895
|
left: z.pos(l) - s,
|
|
8859
8896
|
top: R.pos(e) - c,
|
|
8860
8897
|
width: m,
|
|
8861
8898
|
height: g,
|
|
8862
|
-
justifyContent:
|
|
8863
|
-
alignItems:
|
|
8899
|
+
justifyContent: w,
|
|
8900
|
+
alignItems: ee ?? "flex-end",
|
|
8864
8901
|
textAlign: y ?? void 0
|
|
8865
8902
|
};
|
|
8866
|
-
p && (
|
|
8867
|
-
let
|
|
8903
|
+
p && (ne.color = p), x && (ne.whiteSpace = x), a && !S.background && (ne.background = "linear-gradient(#fff, #fff) 0 0 / calc(100% - 1px) calc(100% - 1px) no-repeat");
|
|
8904
|
+
let re = te > m;
|
|
8868
8905
|
return /* @__PURE__ */ F("div", {
|
|
8869
|
-
className:
|
|
8870
|
-
style:
|
|
8906
|
+
className: re ? "de-cell de-ov" : "de-cell",
|
|
8907
|
+
style: ne,
|
|
8871
8908
|
children: v && /* @__PURE__ */ F("span", {
|
|
8872
|
-
style:
|
|
8873
|
-
maxWidth:
|
|
8909
|
+
style: C ? na(C) : re ? {
|
|
8910
|
+
maxWidth: te - 6,
|
|
8874
8911
|
overflow: "hidden",
|
|
8875
8912
|
flex: "none"
|
|
8876
8913
|
} : void 0,
|
|
@@ -8984,7 +9021,7 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
8984
9021
|
left: z.pos(e) - r,
|
|
8985
9022
|
top: 0,
|
|
8986
9023
|
width: t,
|
|
8987
|
-
height:
|
|
9024
|
+
height: Ji
|
|
8988
9025
|
},
|
|
8989
9026
|
children: u(e)
|
|
8990
9027
|
}, e)), f && o.push(/* @__PURE__ */ F("div", {
|
|
@@ -8992,7 +9029,7 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
8992
9029
|
className: "de-grip-c",
|
|
8993
9030
|
style: {
|
|
8994
9031
|
left: z.pos(e + 1) - r - 3,
|
|
8995
|
-
height:
|
|
9032
|
+
height: Ji
|
|
8996
9033
|
}
|
|
8997
9034
|
}, "g" + e)));
|
|
8998
9035
|
}
|
|
@@ -9002,7 +9039,7 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9002
9039
|
left: i,
|
|
9003
9040
|
top: 0,
|
|
9004
9041
|
width: a,
|
|
9005
|
-
height:
|
|
9042
|
+
height: Ji
|
|
9006
9043
|
},
|
|
9007
9044
|
children: o
|
|
9008
9045
|
}, e);
|
|
@@ -9046,7 +9083,7 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9046
9083
|
let n = Ue(e, t);
|
|
9047
9084
|
return {
|
|
9048
9085
|
x: V + z.pos(t) - (t >= et ? q : 0),
|
|
9049
|
-
y:
|
|
9086
|
+
y: Ji + R.pos(e) - (e >= $e ? Ne : 0),
|
|
9050
9087
|
w: n ? z.pos(n.c1 + 1) - z.pos(n.c0) : z.size(t),
|
|
9051
9088
|
h: n ? R.pos(n.r1 + 1) - R.pos(n.r0) : R.size(e)
|
|
9052
9089
|
};
|
|
@@ -9059,7 +9096,7 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9059
9096
|
i - U < Ne ? t = i - U : i + R.size(e) > Y + Fe && (t = i + R.size(e) - U - Fe), t !== Ne && (n.scrollTop = t / je * Me);
|
|
9060
9097
|
}
|
|
9061
9098
|
}, ot = (e, t, n) => {
|
|
9062
|
-
let r = n.getBoundingClientRect(), i = e - r.left - V, a = t - r.top -
|
|
9099
|
+
let r = n.getBoundingClientRect(), i = e - r.left - V, a = t - r.top - Ji, o = i < De ? i : i + q, s = a < U ? a : a + Ne;
|
|
9063
9100
|
return {
|
|
9064
9101
|
r: a < 0 ? -1 : R.index(Math.max(0, s)),
|
|
9065
9102
|
c: i < 0 ? -1 : z.index(Math.max(0, o))
|
|
@@ -9067,7 +9104,7 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9067
9104
|
}, st = () => m.current?.focus({ preventScroll: !0 }), ct = (n, r) => e.row(t, n)?.find((e) => e[0] === r)?.[2] ?? 0, lt = async (t) => {
|
|
9068
9105
|
try {
|
|
9069
9106
|
let r = await t;
|
|
9070
|
-
e.applied(r, n), r && d.setDirty(!0),
|
|
9107
|
+
e.applied(r, n), r && d.setDirty(!0), w((e) => e + 1);
|
|
9071
9108
|
} catch (e) {
|
|
9072
9109
|
console.error("[office-engine]", e);
|
|
9073
9110
|
}
|
|
@@ -9086,7 +9123,7 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9086
9123
|
sync: +!n
|
|
9087
9124
|
});
|
|
9088
9125
|
if (e !== void 0) return c(e, "\0", "enter");
|
|
9089
|
-
let l =
|
|
9126
|
+
let l = ee && ee.r === o && ee.c === s ? ee.d : await r.call("xlsx.cell", t, o, s).catch(() => void 0), u = ut(l, o, s);
|
|
9090
9127
|
c(u, u, "edit");
|
|
9091
9128
|
}, pt = j(null), ht = (e) => {
|
|
9092
9129
|
let n = i;
|
|
@@ -9111,12 +9148,12 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9111
9148
|
fr: r,
|
|
9112
9149
|
fc: i
|
|
9113
9150
|
}, e.focusGrid = !0, c(t.sheet);
|
|
9114
|
-
}, vt = !!i && i.sheet === t, yt = vt && !i?.bar, bt = i && ye(i.value) ? be(i.value, i.caret) : null, xt = !!i &&
|
|
9151
|
+
}, vt = !!i && i.sheet === t, yt = vt && !i?.bar, bt = i && ye(i.value) ? be(i.value, i.caret) : null, xt = !!i && ia(i, bt), St = !!i?.point && i.point.e === i.caret && i.caret === i.caretEnd, Ct = [], wt = [];
|
|
9115
9152
|
if (bt && i) {
|
|
9116
9153
|
let e = /* @__PURE__ */ new Map();
|
|
9117
9154
|
for (let r of bt.refs) {
|
|
9118
|
-
let a =
|
|
9119
|
-
o || e.set(a, o =
|
|
9155
|
+
let a = oa(r.text), o = e.get(a);
|
|
9156
|
+
o || e.set(a, o = aa[e.size % aa.length]), Ct.push({
|
|
9120
9157
|
s: r.s,
|
|
9121
9158
|
e: r.e,
|
|
9122
9159
|
color: o
|
|
@@ -9133,8 +9170,8 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9133
9170
|
}
|
|
9134
9171
|
}
|
|
9135
9172
|
let Tt = bt?.word && i?.noSuggest !== bt.word.s && i?.caret === i?.caretEnd ? bt.word : void 0, Et = Tt ? we(Tt.text, 8) : [], Dt = !Et.length && bt?.call ? Ce(bt.call.name) : void 0, Ot = Tt ? `${Tt.s}:${Tt.text}` : "";
|
|
9136
|
-
k(() =>
|
|
9137
|
-
let kt = () => yt ?
|
|
9173
|
+
k(() => E(0), [Ot]);
|
|
9174
|
+
let kt = () => yt ? re.current : ae.current;
|
|
9138
9175
|
A(() => {
|
|
9139
9176
|
if (!i) return;
|
|
9140
9177
|
let e = kt();
|
|
@@ -9377,7 +9414,7 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9377
9414
|
ac: o,
|
|
9378
9415
|
fr: a,
|
|
9379
9416
|
fc: o
|
|
9380
|
-
}), a >= 0 && o >= 0 && (
|
|
9417
|
+
}), a >= 0 && o >= 0 && (te.current = !0));
|
|
9381
9418
|
}
|
|
9382
9419
|
}, Jt = (e, t, n, r, i) => {
|
|
9383
9420
|
if (i === "col") Mt(0, t, s, Math.max(0, r));
|
|
@@ -9389,7 +9426,7 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9389
9426
|
};
|
|
9390
9427
|
k(() => {
|
|
9391
9428
|
let e = () => {
|
|
9392
|
-
|
|
9429
|
+
te.current = !1, Nt.current = null;
|
|
9393
9430
|
let e = le.current;
|
|
9394
9431
|
le.current = null, e && setTimeout(e, 0);
|
|
9395
9432
|
};
|
|
@@ -9398,7 +9435,7 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9398
9435
|
if (!L) return;
|
|
9399
9436
|
let e = L.axis === "col" ? z : R, t = (t) => {
|
|
9400
9437
|
let n = (L.axis === "col" ? t.clientX : t.clientY) - L.start;
|
|
9401
|
-
e.set(L.i, Math.max(L.axis === "col" ? 8 : 6, Math.round(L.size + n))),
|
|
9438
|
+
e.set(L.i, Math.max(L.axis === "col" ? 8 : 6, Math.round(L.size + n))), w((e) => e + 1);
|
|
9402
9439
|
}, n = () => {
|
|
9403
9440
|
let t = e.size(L.i);
|
|
9404
9441
|
ve(null);
|
|
@@ -9693,7 +9730,7 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9693
9730
|
O.q,
|
|
9694
9731
|
O.tick,
|
|
9695
9732
|
de,
|
|
9696
|
-
|
|
9733
|
+
C
|
|
9697
9734
|
]);
|
|
9698
9735
|
let on = (e) => {
|
|
9699
9736
|
let t = pe[e];
|
|
@@ -9713,25 +9750,25 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9713
9750
|
Jt(t.ar, t.ac, n, r, t.axis);
|
|
9714
9751
|
return;
|
|
9715
9752
|
}
|
|
9716
|
-
if (!
|
|
9753
|
+
if (!te.current) return;
|
|
9717
9754
|
let { r: n, c: r } = ot(e.clientX, e.clientY, e.currentTarget);
|
|
9718
9755
|
n >= 0 && r >= 0 && (n !== y.fr || r !== y.fc) && b((e) => ({
|
|
9719
9756
|
...e,
|
|
9720
9757
|
fr: n,
|
|
9721
9758
|
fc: r
|
|
9722
9759
|
}));
|
|
9723
|
-
}, ln = i && vt ? rt(i.r, i.c) : null, un = i ? i.value : ut(
|
|
9760
|
+
}, ln = i && vt ? rt(i.r, i.c) : null, un = i ? i.value : ut(S, y.ar, y.ac), dn = (e) => {
|
|
9724
9761
|
if (!i || e.nativeEvent.isComposing) return;
|
|
9725
9762
|
let t = e.metaKey || e.ctrlKey;
|
|
9726
9763
|
if (Et.length) {
|
|
9727
9764
|
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
9728
9765
|
e.preventDefault();
|
|
9729
9766
|
let t = Et.length;
|
|
9730
|
-
|
|
9767
|
+
E((n) => (Math.min(n, t - 1) + (e.key === "ArrowDown" ? 1 : t - 1)) % t);
|
|
9731
9768
|
return;
|
|
9732
9769
|
}
|
|
9733
9770
|
if (e.key === "Tab" || e.key === "Enter" && !e.altKey && !e.shiftKey) {
|
|
9734
|
-
e.preventDefault(), Ft(Et[Math.min(
|
|
9771
|
+
e.preventDefault(), Ft(Et[Math.min(T, Et.length - 1)]);
|
|
9735
9772
|
return;
|
|
9736
9773
|
}
|
|
9737
9774
|
if (e.key === "Escape") {
|
|
@@ -9744,7 +9781,7 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9744
9781
|
return;
|
|
9745
9782
|
}
|
|
9746
9783
|
}
|
|
9747
|
-
let n =
|
|
9784
|
+
let n = sa[e.key];
|
|
9748
9785
|
if (n && !t && !e.altKey && i.mode === "enter") {
|
|
9749
9786
|
if (xt) {
|
|
9750
9787
|
e.preventDefault(), Pt(n[0], n[1], e.shiftKey);
|
|
@@ -9771,12 +9808,12 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9771
9808
|
role: "listbox",
|
|
9772
9809
|
onMouseDown: (e) => e.preventDefault(),
|
|
9773
9810
|
children: Et.map((e, t) => {
|
|
9774
|
-
let n = t === Math.min(
|
|
9811
|
+
let n = t === Math.min(T, Et.length - 1);
|
|
9775
9812
|
return /* @__PURE__ */ I("div", {
|
|
9776
9813
|
role: "option",
|
|
9777
9814
|
"aria-selected": n,
|
|
9778
9815
|
className: n ? "de-fsug on" : "de-fsug",
|
|
9779
|
-
onMouseEnter: () =>
|
|
9816
|
+
onMouseEnter: () => E(t),
|
|
9780
9817
|
onClick: () => Ft(e),
|
|
9781
9818
|
children: [
|
|
9782
9819
|
/* @__PURE__ */ F("span", {
|
|
@@ -9831,9 +9868,9 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9831
9868
|
let hn = (() => {
|
|
9832
9869
|
if (!pn || !fn) return;
|
|
9833
9870
|
let e = pn.top + pn.height + 2;
|
|
9834
|
-
return e + 200 >
|
|
9871
|
+
return e + 200 > h.h && pn.top > 200 ? {
|
|
9835
9872
|
left: pn.left,
|
|
9836
|
-
bottom:
|
|
9873
|
+
bottom: h.h - pn.top + 2
|
|
9837
9874
|
} : {
|
|
9838
9875
|
left: pn.left,
|
|
9839
9876
|
top: e
|
|
@@ -9852,7 +9889,7 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9852
9889
|
]
|
|
9853
9890
|
}),
|
|
9854
9891
|
f ? /* @__PURE__ */ F("input", {
|
|
9855
|
-
ref:
|
|
9892
|
+
ref: ae,
|
|
9856
9893
|
className: "de-fx-val de-fx-input",
|
|
9857
9894
|
value: un,
|
|
9858
9895
|
spellCheck: !1,
|
|
@@ -9896,14 +9933,14 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9896
9933
|
children: /* @__PURE__ */ F("div", {
|
|
9897
9934
|
style: {
|
|
9898
9935
|
position: "relative",
|
|
9899
|
-
width: Math.max(G,
|
|
9900
|
-
height: Math.max(K,
|
|
9936
|
+
width: Math.max(G, h.w),
|
|
9937
|
+
height: Math.max(K, h.h)
|
|
9901
9938
|
},
|
|
9902
9939
|
children: /* @__PURE__ */ I("div", {
|
|
9903
9940
|
className: "de-grid-view",
|
|
9904
9941
|
style: {
|
|
9905
|
-
width:
|
|
9906
|
-
height:
|
|
9942
|
+
width: h.w,
|
|
9943
|
+
height: h.h,
|
|
9907
9944
|
...n.baseFont
|
|
9908
9945
|
},
|
|
9909
9946
|
onMouseDown: qt,
|
|
@@ -9924,20 +9961,20 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9924
9961
|
},
|
|
9925
9962
|
onDoubleClick: () => !i && void ft(),
|
|
9926
9963
|
children: [
|
|
9927
|
-
Xe("main", Ie, Le, Re, ze, J, Y, V + tt,
|
|
9928
|
-
$e > 0 && Xe("top", 0, $e - 1, Re, ze, J, 0, V + tt,
|
|
9929
|
-
et > 0 && Xe("left", Ie, Le, 0, et - 1, 0, Y, V,
|
|
9930
|
-
$e > 0 && et > 0 && Xe("tl", 0, $e - 1, 0, et - 1, 0, 0, V,
|
|
9964
|
+
Xe("main", Ie, Le, Re, ze, J, Y, V + tt, Ji + nt, Pe, Fe),
|
|
9965
|
+
$e > 0 && Xe("top", 0, $e - 1, Re, ze, J, 0, V + tt, Ji, Pe, nt),
|
|
9966
|
+
et > 0 && Xe("left", Ie, Le, 0, et - 1, 0, Y, V, Ji + nt, tt, Fe),
|
|
9967
|
+
$e > 0 && et > 0 && Xe("tl", 0, $e - 1, 0, et - 1, 0, 0, V, Ji, tt, nt),
|
|
9931
9968
|
Ze("ch", Re, ze, J, V + tt, Pe),
|
|
9932
9969
|
et > 0 && Ze("chf", 0, et - 1, 0, V, tt),
|
|
9933
|
-
Qe("rh", Ie, Le, Y,
|
|
9934
|
-
$e > 0 && Qe("rhf", 0, $e - 1, 0,
|
|
9970
|
+
Qe("rh", Ie, Le, Y, Ji + nt, Fe),
|
|
9971
|
+
$e > 0 && Qe("rhf", 0, $e - 1, 0, Ji, nt),
|
|
9935
9972
|
$e > 0 && /* @__PURE__ */ F("div", {
|
|
9936
9973
|
className: "de-freeze-h",
|
|
9937
9974
|
style: {
|
|
9938
9975
|
left: 0,
|
|
9939
|
-
top:
|
|
9940
|
-
width:
|
|
9976
|
+
top: Ji + nt - 1,
|
|
9977
|
+
width: h.w,
|
|
9941
9978
|
height: 2
|
|
9942
9979
|
}
|
|
9943
9980
|
}),
|
|
@@ -9947,26 +9984,26 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9947
9984
|
left: V + tt - 1,
|
|
9948
9985
|
top: 0,
|
|
9949
9986
|
width: 2,
|
|
9950
|
-
height:
|
|
9987
|
+
height: h.h
|
|
9951
9988
|
}
|
|
9952
9989
|
}),
|
|
9953
9990
|
/* @__PURE__ */ F("div", {
|
|
9954
9991
|
className: "de-corner",
|
|
9955
9992
|
style: {
|
|
9956
9993
|
width: V,
|
|
9957
|
-
height:
|
|
9994
|
+
height: Ji
|
|
9958
9995
|
}
|
|
9959
9996
|
}),
|
|
9960
9997
|
i && yt && pn && /* @__PURE__ */ I(P, { children: [
|
|
9961
9998
|
mn.length > 0 && /* @__PURE__ */ F("div", {
|
|
9962
|
-
ref:
|
|
9999
|
+
ref: ie,
|
|
9963
10000
|
className: "de-cell-edit de-cell-hl",
|
|
9964
10001
|
style: pn,
|
|
9965
10002
|
"aria-hidden": !0,
|
|
9966
10003
|
children: mn
|
|
9967
10004
|
}),
|
|
9968
10005
|
/* @__PURE__ */ F("textarea", {
|
|
9969
|
-
ref:
|
|
10006
|
+
ref: re,
|
|
9970
10007
|
className: mn.length ? "de-cell-edit de-cell-edit-fx" : "de-cell-edit",
|
|
9971
10008
|
spellCheck: !1,
|
|
9972
10009
|
value: i.value,
|
|
@@ -9975,12 +10012,12 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9975
10012
|
onChange: (e) => jt(e.target),
|
|
9976
10013
|
onSelect: (e) => At(e.currentTarget),
|
|
9977
10014
|
onScroll: (e) => {
|
|
9978
|
-
|
|
10015
|
+
ie.current && (ie.current.scrollTop = e.currentTarget.scrollTop);
|
|
9979
10016
|
},
|
|
9980
10017
|
onKeyDown: dn,
|
|
9981
10018
|
onBlur: (e) => {
|
|
9982
10019
|
if (!o.current) {
|
|
9983
|
-
if (e.relatedTarget && e.relatedTarget ===
|
|
10020
|
+
if (e.relatedTarget && e.relatedTarget === ae.current) return a((e) => e && {
|
|
9984
10021
|
...e,
|
|
9985
10022
|
bar: !0,
|
|
9986
10023
|
sync: 0
|
|
@@ -9999,7 +10036,7 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
9999
10036
|
})
|
|
10000
10037
|
})
|
|
10001
10038
|
}),
|
|
10002
|
-
f && /* @__PURE__ */ F(
|
|
10039
|
+
f && /* @__PURE__ */ F(Ni, {
|
|
10003
10040
|
css: Rt,
|
|
10004
10041
|
base: n.baseFont,
|
|
10005
10042
|
format: n.formats[ct(y.ar, y.ac)] ?? "General",
|
|
@@ -10084,22 +10121,22 @@ function oa({ store: e, sheet: t, meta: n, client: r, edit: i, setEdit: a, hold:
|
|
|
10084
10121
|
] });
|
|
10085
10122
|
}
|
|
10086
10123
|
// src/collab/react.tsx
|
|
10087
|
-
var
|
|
10088
|
-
function
|
|
10124
|
+
var da = /* @__PURE__ */ new WeakMap(), fa = 0;
|
|
10125
|
+
function pa(e) {
|
|
10089
10126
|
if (!e) return "";
|
|
10090
10127
|
let t;
|
|
10091
10128
|
if (typeof e.transport == "string") t = e.transport;
|
|
10092
10129
|
else {
|
|
10093
|
-
let n =
|
|
10094
|
-
n === void 0 &&
|
|
10130
|
+
let n = da.get(e.transport);
|
|
10131
|
+
n === void 0 && da.set(e.transport, n = ++fa), t = `#${n}`;
|
|
10095
10132
|
}
|
|
10096
|
-
return `${t}|${e.room}|${e.user.id ?? ""}|${e.user.name}|${e.user.color ?? ""}`;
|
|
10133
|
+
return `${t}|${e.room}|${e.base ?? 0}|${e.user.id ?? ""}|${e.user.name}|${e.user.color ?? ""}`;
|
|
10097
10134
|
}
|
|
10098
|
-
function
|
|
10135
|
+
function ma(e, t) {
|
|
10099
10136
|
let [n, r] = M({
|
|
10100
10137
|
collab: null,
|
|
10101
10138
|
status: null
|
|
10102
|
-
}), i =
|
|
10139
|
+
}), i = pa(t), a = j(t);
|
|
10103
10140
|
return a.current = t, k(() => {
|
|
10104
10141
|
let t = a.current;
|
|
10105
10142
|
if (!e || !t) {
|
|
@@ -10111,7 +10148,7 @@ function ua(e, t) {
|
|
|
10111
10148
|
}
|
|
10112
10149
|
let n;
|
|
10113
10150
|
try {
|
|
10114
|
-
n =
|
|
10151
|
+
n = ae(e, t);
|
|
10115
10152
|
} catch (e) {
|
|
10116
10153
|
r({
|
|
10117
10154
|
collab: null,
|
|
@@ -10132,22 +10169,22 @@ function ua(e, t) {
|
|
|
10132
10169
|
};
|
|
10133
10170
|
}, [e, i]), n;
|
|
10134
10171
|
}
|
|
10135
|
-
var
|
|
10172
|
+
var ha = (e) => e.split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0].toUpperCase()).join("") || "?", ga = {
|
|
10136
10173
|
connecting: "Connecting…",
|
|
10137
10174
|
syncing: "Syncing…",
|
|
10138
10175
|
live: "Live",
|
|
10139
10176
|
offline: "Offline · changes will sync",
|
|
10140
10177
|
error: "Not synced"
|
|
10141
10178
|
};
|
|
10142
|
-
function
|
|
10143
|
-
let n = _e((t) =>
|
|
10179
|
+
function _a({ client: e, state: t }) {
|
|
10180
|
+
let n = _e((t) => ne(e, t), () => _(e)), [r, i] = M(0);
|
|
10144
10181
|
if (k(() => {
|
|
10145
10182
|
let e = t.collab?.session;
|
|
10146
10183
|
if (!e) return;
|
|
10147
10184
|
let n = setInterval(() => i(e.pending), 500);
|
|
10148
10185
|
return () => clearInterval(n);
|
|
10149
10186
|
}, [t.collab]), !t.status) return null;
|
|
10150
|
-
let a = t.status === "error" ? t.error ?? "Collaboration stopped" : t.status === "live" && r ? `Saving ${r} change${r > 1 ? "s" : ""}…` :
|
|
10187
|
+
let a = t.status === "error" ? t.error ?? "Collaboration stopped" : t.status === "live" && r ? `Saving ${r} change${r > 1 ? "s" : ""}…` : ga[t.status];
|
|
10151
10188
|
return /* @__PURE__ */ I("span", {
|
|
10152
10189
|
className: "de-collab",
|
|
10153
10190
|
children: [/* @__PURE__ */ I("span", {
|
|
@@ -10155,7 +10192,7 @@ function pa({ client: e, state: t }) {
|
|
|
10155
10192
|
title: a,
|
|
10156
10193
|
children: [/* @__PURE__ */ F("span", { className: "de-collab-dot" }), /* @__PURE__ */ F("span", {
|
|
10157
10194
|
className: "de-collab-label",
|
|
10158
|
-
children: t.status === "live" ? n.length ? `${n.length + 1} editing` : "Live" :
|
|
10195
|
+
children: t.status === "live" ? n.length ? `${n.length + 1} editing` : "Live" : ga[t.status]
|
|
10159
10196
|
})]
|
|
10160
10197
|
}), n.length > 0 && /* @__PURE__ */ I("span", {
|
|
10161
10198
|
className: "de-peers",
|
|
@@ -10163,7 +10200,7 @@ function pa({ client: e, state: t }) {
|
|
|
10163
10200
|
className: "de-peer",
|
|
10164
10201
|
style: { background: e.color },
|
|
10165
10202
|
title: e.name,
|
|
10166
|
-
children:
|
|
10203
|
+
children: ha(e.name)
|
|
10167
10204
|
}, e.site)), n.length > 5 && /* @__PURE__ */ I("span", {
|
|
10168
10205
|
className: "de-peer de-peer-more",
|
|
10169
10206
|
title: n.slice(5).map((e) => e.name).join(", "),
|
|
@@ -10172,8 +10209,8 @@ function pa({ client: e, state: t }) {
|
|
|
10172
10209
|
})]
|
|
10173
10210
|
});
|
|
10174
10211
|
}
|
|
10175
|
-
function
|
|
10176
|
-
let n = j(null), r = _e((t) =>
|
|
10212
|
+
function va({ client: e, collab: t }) {
|
|
10213
|
+
let n = j(null), r = _e((t) => ne(e, t), () => _(e)), [i, a] = M([]), o = he(() => r.filter((e) => e.presence && e.presence.k !== "xlsx"), [r]);
|
|
10177
10214
|
return k(() => {
|
|
10178
10215
|
let r = n.current, i = r?.parentElement;
|
|
10179
10216
|
if (!r || !i || !o.length) {
|
|
@@ -10189,7 +10226,7 @@ function ma({ client: e, collab: t }) {
|
|
|
10189
10226
|
h: e.height
|
|
10190
10227
|
}), l = [];
|
|
10191
10228
|
for (let r of o) {
|
|
10192
|
-
let a =
|
|
10229
|
+
let a = ya(r, i, t, e);
|
|
10193
10230
|
a && l.push({
|
|
10194
10231
|
key: String(r.site),
|
|
10195
10232
|
color: r.color,
|
|
@@ -10261,7 +10298,7 @@ function ma({ client: e, collab: t }) {
|
|
|
10261
10298
|
}, e.key))
|
|
10262
10299
|
});
|
|
10263
10300
|
}
|
|
10264
|
-
function
|
|
10301
|
+
function ya(e, t, n, r) {
|
|
10265
10302
|
let i = e.presence;
|
|
10266
10303
|
if (i.k === "docx") {
|
|
10267
10304
|
let r = n?.rects(t, e);
|
|
@@ -10280,35 +10317,35 @@ function ha(e, t, n, r) {
|
|
|
10280
10317
|
return null;
|
|
10281
10318
|
}
|
|
10282
10319
|
// src/react/DocViewer.tsx
|
|
10283
|
-
var
|
|
10320
|
+
var ba = {
|
|
10284
10321
|
docx: ".docx",
|
|
10285
10322
|
xlsx: ".xlsx",
|
|
10286
10323
|
pptx: ".pptx"
|
|
10287
|
-
},
|
|
10324
|
+
}, xa = {
|
|
10288
10325
|
docx: "Untitled document",
|
|
10289
10326
|
xlsx: "Untitled spreadsheet",
|
|
10290
10327
|
pptx: "Untitled presentation"
|
|
10291
10328
|
};
|
|
10292
|
-
function
|
|
10329
|
+
function Sa(e) {
|
|
10293
10330
|
return e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(0)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
|
|
10294
10331
|
}
|
|
10295
|
-
function
|
|
10296
|
-
let { src: t, name: n, className: r, style: i, toolbar: a = !0, toolbarExtra: o, zoom: s, thumbnails: c, headers: l, credentials: u, worker: d, styleTarget: f, onLoad: p, onError: m } = e, { allowEdit: h = !0, allowSave: g = !0, allowDownload: _ = !0, fileMenu: v = !0, allowOpen: y = !0, onSave: b, onDirtyChange:
|
|
10332
|
+
function Ca(e) {
|
|
10333
|
+
let { src: t, name: n, className: r, style: i, toolbar: a = !0, toolbarExtra: o, zoom: s, thumbnails: c, headers: l, credentials: u, worker: d, styleTarget: f, onLoad: p, onError: m } = e, { allowEdit: h = !0, allowSave: g = !0, allowDownload: _ = !0, fileMenu: v = !0, allowOpen: y = !0, onSave: b, onDirtyChange: ee } = e, [x, S] = M(!!e.editable);
|
|
10297
10334
|
k(() => {
|
|
10298
|
-
e.editable !== void 0 &&
|
|
10335
|
+
e.editable !== void 0 && S(!!e.editable);
|
|
10299
10336
|
}, [e.editable]);
|
|
10300
|
-
let [
|
|
10337
|
+
let [C, w] = M(!1), [te, ne] = M(!1), [re, ie] = M(null);
|
|
10301
10338
|
me(() => dr(f), [f]);
|
|
10302
|
-
let [
|
|
10339
|
+
let [ae, T] = M(null), [E, oe] = M(null);
|
|
10303
10340
|
k(() => {
|
|
10304
|
-
|
|
10341
|
+
T(null), oe(null);
|
|
10305
10342
|
}, [t]);
|
|
10306
|
-
let se =
|
|
10343
|
+
let se = ae ? ae.name : n, { client: D, error: ce, loading: le, progress: O } = Ci(ae ? ae.src : t, {
|
|
10307
10344
|
name: se,
|
|
10308
10345
|
headers: l,
|
|
10309
10346
|
credentials: u,
|
|
10310
10347
|
worker: d
|
|
10311
|
-
}), ue =
|
|
10348
|
+
}), ue = E ?? se, fe = ma(D, e.collab), pe = !e.collab || fe.status === "live" || fe.status === "offline", [A, ge] = M(null);
|
|
10312
10349
|
k(() => {
|
|
10313
10350
|
D && p?.(D);
|
|
10314
10351
|
}, [D, p]), k(() => {
|
|
@@ -10316,50 +10353,50 @@ function ya(e) {
|
|
|
10316
10353
|
}, [ce, m]);
|
|
10317
10354
|
let _e = j(!1);
|
|
10318
10355
|
k(() => {
|
|
10319
|
-
|
|
10356
|
+
w(!!D && _e.current), D && (_e.current = !1);
|
|
10320
10357
|
}, [D]);
|
|
10321
|
-
let N = de((e) =>
|
|
10322
|
-
if (D && !
|
|
10323
|
-
|
|
10358
|
+
let N = de((e) => w((t) => (t !== e && ee?.(e), e)), [ee]), P = (E ?? (D?.name || ue || "document")).replace(/\.[^.]+$/, ""), L = P + (D ? ba[D.kind] : ""), ve = g && (!!b || _), ye = de(async () => {
|
|
10359
|
+
if (D && !te && ve) {
|
|
10360
|
+
ne(!0);
|
|
10324
10361
|
try {
|
|
10325
10362
|
let e = await D.call("save");
|
|
10326
10363
|
b ? await b(e, L) : Qe(e, L), N(!1);
|
|
10327
10364
|
} catch (e) {
|
|
10328
10365
|
m?.(e), console.error("[office-engine] save failed", e);
|
|
10329
10366
|
} finally {
|
|
10330
|
-
|
|
10367
|
+
ne(!1);
|
|
10331
10368
|
}
|
|
10332
10369
|
}
|
|
10333
10370
|
}, [
|
|
10334
10371
|
D,
|
|
10335
|
-
|
|
10372
|
+
te,
|
|
10336
10373
|
ve,
|
|
10337
10374
|
b,
|
|
10338
10375
|
L,
|
|
10339
10376
|
N,
|
|
10340
10377
|
m
|
|
10341
10378
|
]), R = j(null), z = he(() => ({
|
|
10342
|
-
bar:
|
|
10343
|
-
editable:
|
|
10379
|
+
bar: re,
|
|
10380
|
+
editable: x && pe,
|
|
10344
10381
|
setDirty: N,
|
|
10345
10382
|
save: ye,
|
|
10346
10383
|
canDownload: _,
|
|
10347
10384
|
client: D,
|
|
10348
10385
|
fileOps: R
|
|
10349
10386
|
}), [
|
|
10350
|
-
|
|
10351
|
-
|
|
10387
|
+
re,
|
|
10388
|
+
x,
|
|
10352
10389
|
pe,
|
|
10353
10390
|
N,
|
|
10354
10391
|
ye,
|
|
10355
10392
|
_,
|
|
10356
10393
|
D
|
|
10357
|
-
]), [be, xe] = M(null), Se = de(() => xe(null), []), [B, V] = M(null), [H, Ce] = M(!1), [we, Te] = M(!1), Ee = (e, t) =>
|
|
10394
|
+
]), [be, xe] = M(null), Se = de(() => xe(null), []), [B, V] = M(null), [H, Ce] = M(!1), [we, Te] = M(!1), Ee = (e, t) => C ? V({
|
|
10358
10395
|
message: e,
|
|
10359
10396
|
run: t
|
|
10360
10397
|
}) : t(), De = de((e, t = !1) => {
|
|
10361
|
-
_e.current = e.converted, oe(null),
|
|
10362
|
-
}, []), Oe = v && y && !e.collab, ke =
|
|
10398
|
+
_e.current = e.converted, oe(null), T(e), t && S(!0);
|
|
10399
|
+
}, []), Oe = v && y && !e.collab, ke = kr({
|
|
10363
10400
|
kind: D?.kind,
|
|
10364
10401
|
base: P,
|
|
10365
10402
|
canOpen: Oe,
|
|
@@ -10367,10 +10404,10 @@ function ya(e) {
|
|
|
10367
10404
|
canSave: v && ve,
|
|
10368
10405
|
canDownload: v && _ && !!D,
|
|
10369
10406
|
ops: R,
|
|
10370
|
-
create: (e) => Ee(`A new ${
|
|
10407
|
+
create: (e) => Ee(`A new ${xa[e].split(" ")[1]} replaces the current document. Your changes are not saved.`, () => {
|
|
10371
10408
|
(e === "docx" ? qn([]) : e === "xlsx" ? Ln([], "Sheet1") : er()).then((t) => De({
|
|
10372
10409
|
src: t,
|
|
10373
|
-
name:
|
|
10410
|
+
name: xa[e] + ba[e],
|
|
10374
10411
|
converted: !1
|
|
10375
10412
|
}, h), (e) => xe(e.message));
|
|
10376
10413
|
}),
|
|
@@ -10390,7 +10427,7 @@ function ya(e) {
|
|
|
10390
10427
|
if (!v || e.defaultPrevented || !(e.metaKey || e.ctrlKey) || e.altKey || e.shiftKey) return;
|
|
10391
10428
|
let t = e.key.toLowerCase();
|
|
10392
10429
|
t === "p" ? (e.preventDefault(), _ && ke.run("print")) : t === "o" && Oe && (e.preventDefault(), ke.run("open"));
|
|
10393
|
-
}, Ae = O && O.total > 0 ? Math.min(100, O.loaded / O.total * 100) : 0, W = le || !!O && Ae < 100, G =
|
|
10430
|
+
}, Ae = O && O.total > 0 ? Math.min(100, O.loaded / O.total * 100) : 0, W = le || !!O && Ae < 100, G = E ?? D?.name ?? ue ?? (typeof t == "string" ? decodeURIComponent(t.split(/[?#]/)[0].split("/").pop() ?? "") : t?.name) ?? "", je;
|
|
10394
10431
|
return je = ce ? /* @__PURE__ */ F("div", {
|
|
10395
10432
|
className: "de-center",
|
|
10396
10433
|
children: /* @__PURE__ */ I("div", {
|
|
@@ -10401,13 +10438,13 @@ function ya(e) {
|
|
|
10401
10438
|
}) : D ? D.kind === "docx" ? /* @__PURE__ */ F(bn, {
|
|
10402
10439
|
client: D,
|
|
10403
10440
|
initialZoom: s
|
|
10404
|
-
}, String(D.name) + D.size) : D.kind === "xlsx" ? /* @__PURE__ */ F(
|
|
10441
|
+
}, String(D.name) + D.size) : D.kind === "xlsx" ? /* @__PURE__ */ F(ea, { client: D }) : /* @__PURE__ */ F(Si, {
|
|
10405
10442
|
client: D,
|
|
10406
10443
|
initialZoom: s,
|
|
10407
10444
|
thumbnails: c
|
|
10408
|
-
}) : t ||
|
|
10445
|
+
}) : t || ae ? /* @__PURE__ */ I("div", {
|
|
10409
10446
|
className: "de-center",
|
|
10410
|
-
children: [/* @__PURE__ */ F("div", { className: "de-spinner" }), /* @__PURE__ */ F("div", { children: O?.phase === "download" && O.total ? `Downloading… ${
|
|
10447
|
+
children: [/* @__PURE__ */ F("div", { className: "de-spinner" }), /* @__PURE__ */ F("div", { children: O?.phase === "download" && O.total ? `Downloading… ${Sa(O.loaded)} / ${Sa(O.total)}` : "Opening…" })]
|
|
10411
10448
|
}) : /* @__PURE__ */ F("div", {
|
|
10412
10449
|
className: "de-center",
|
|
10413
10450
|
children: "No document"
|
|
@@ -10423,7 +10460,7 @@ function ya(e) {
|
|
|
10423
10460
|
className: `de-badge de-badge-${D.kind}`,
|
|
10424
10461
|
children: D.kind
|
|
10425
10462
|
}),
|
|
10426
|
-
v && /* @__PURE__ */ F(
|
|
10463
|
+
v && /* @__PURE__ */ F(Ar, { actions: ke }),
|
|
10427
10464
|
/* @__PURE__ */ F("span", {
|
|
10428
10465
|
className: "de-title",
|
|
10429
10466
|
title: G,
|
|
@@ -10436,33 +10473,33 @@ function ya(e) {
|
|
|
10436
10473
|
}),
|
|
10437
10474
|
D && D.size > 0 && /* @__PURE__ */ F("span", {
|
|
10438
10475
|
className: "de-status",
|
|
10439
|
-
children:
|
|
10476
|
+
children: Sa(D.size)
|
|
10440
10477
|
}),
|
|
10441
|
-
D && e.collab && /* @__PURE__ */ F(
|
|
10478
|
+
D && e.collab && /* @__PURE__ */ F(_a, {
|
|
10442
10479
|
client: D,
|
|
10443
10480
|
state: fe
|
|
10444
10481
|
}),
|
|
10445
10482
|
o,
|
|
10446
10483
|
D && h && /* @__PURE__ */ I("button", {
|
|
10447
10484
|
type: "button",
|
|
10448
|
-
className:
|
|
10449
|
-
onClick: () =>
|
|
10450
|
-
title:
|
|
10485
|
+
className: x ? "de-mode de-mode-on" : "de-mode",
|
|
10486
|
+
onClick: () => S((e) => !e),
|
|
10487
|
+
title: x ? "Switch to viewing" : "Edit document",
|
|
10451
10488
|
children: [/* @__PURE__ */ F(K, {
|
|
10452
|
-
name:
|
|
10489
|
+
name: x ? "view" : "edit",
|
|
10453
10490
|
size: 16
|
|
10454
|
-
}),
|
|
10491
|
+
}), x ? "View" : "Edit"]
|
|
10455
10492
|
}),
|
|
10456
|
-
D && ve && (
|
|
10493
|
+
D && ve && (x || C) && /* @__PURE__ */ I("button", {
|
|
10457
10494
|
type: "button",
|
|
10458
|
-
className:
|
|
10459
|
-
disabled:
|
|
10495
|
+
className: C ? "de-mode de-save-dirty" : "de-mode",
|
|
10496
|
+
disabled: te,
|
|
10460
10497
|
onClick: () => void ye(),
|
|
10461
10498
|
title: "Save a copy (Ctrl+S)",
|
|
10462
10499
|
children: [/* @__PURE__ */ F(K, {
|
|
10463
10500
|
name: "save",
|
|
10464
10501
|
size: 16
|
|
10465
|
-
}),
|
|
10502
|
+
}), te ? "Saving…" : C || b ? "Save" : "Download"]
|
|
10466
10503
|
}),
|
|
10467
10504
|
/* @__PURE__ */ F("div", {
|
|
10468
10505
|
className: "de-progress",
|
|
@@ -10473,9 +10510,9 @@ function ya(e) {
|
|
|
10473
10510
|
})
|
|
10474
10511
|
]
|
|
10475
10512
|
}),
|
|
10476
|
-
a && D &&
|
|
10513
|
+
a && D && x && pe && /* @__PURE__ */ F("div", {
|
|
10477
10514
|
className: "de-ebar-host",
|
|
10478
|
-
ref:
|
|
10515
|
+
ref: ie
|
|
10479
10516
|
}),
|
|
10480
10517
|
/* @__PURE__ */ I("div", {
|
|
10481
10518
|
className: "de-body",
|
|
@@ -10485,7 +10522,7 @@ function ya(e) {
|
|
|
10485
10522
|
value: A,
|
|
10486
10523
|
children: je
|
|
10487
10524
|
})
|
|
10488
|
-
}), D && fe.collab && /* @__PURE__ */ F(
|
|
10525
|
+
}), D && fe.collab && /* @__PURE__ */ F(va, {
|
|
10489
10526
|
client: D,
|
|
10490
10527
|
collab: fe.collab
|
|
10491
10528
|
})]
|
|
@@ -10508,8 +10545,8 @@ function ya(e) {
|
|
|
10508
10545
|
initial: P,
|
|
10509
10546
|
ok: "Rename",
|
|
10510
10547
|
onOk: (t) => {
|
|
10511
|
-
let n = t.trim().replace(/[\\/:*?"<>|]+/g, " ").replace(RegExp(`\\${
|
|
10512
|
-
n && (oe(n +
|
|
10548
|
+
let n = t.trim().replace(/[\\/:*?"<>|]+/g, " ").replace(RegExp(`\\${ba[D.kind]}$`, "i"), "");
|
|
10549
|
+
n && (oe(n + ba[D.kind]), e.onRename?.(n + ba[D.kind]));
|
|
10513
10550
|
}
|
|
10514
10551
|
},
|
|
10515
10552
|
onClose: () => Ce(!1)
|
|
@@ -10518,9 +10555,9 @@ function ya(e) {
|
|
|
10518
10555
|
client: D,
|
|
10519
10556
|
file: [
|
|
10520
10557
|
["Name", L],
|
|
10521
|
-
["Type",
|
|
10522
|
-
...D.size > 0 ? [["File size",
|
|
10523
|
-
...
|
|
10558
|
+
["Type", Tr[D.kind]],
|
|
10559
|
+
...D.size > 0 ? [["File size", Sa(D.size)]] : [],
|
|
10560
|
+
...C ? [["Status", "Unsaved changes"]] : []
|
|
10524
10561
|
],
|
|
10525
10562
|
stats: R.current?.stats() ?? [],
|
|
10526
10563
|
onClose: () => Te(!1)
|
|
@@ -10528,6 +10565,6 @@ function ya(e) {
|
|
|
10528
10565
|
]
|
|
10529
10566
|
});
|
|
10530
10567
|
}
|
|
10531
|
-
export {
|
|
10568
|
+
export { ea as a, li as c, bn as d, ma as i, dr as l, _a as n, Ci as o, va as r, Si as s, Ca as t, lr as u };
|
|
10532
10569
|
|
|
10533
|
-
//# sourceMappingURL=DocViewer-
|
|
10570
|
+
//# sourceMappingURL=DocViewer-Co7q5D2H.js.map
|