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