filens-preview 0.1.4 → 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/README.md +99 -24
- package/dist/all-in-one/filens.js +24667 -22367
- package/dist/index.d.ts +4 -0
- package/dist/split/assets/iwork-worker-DiTOJG8f.js +27 -0
- package/dist/split/chunks/{archive-Drem4a-o.js → archive-_cUUL2-3.js} +2 -2
- package/dist/split/chunks/{cad-CsU3TiHK.js → cad-Cyh8aipO.js} +1 -1
- package/dist/split/chunks/{core-BvtuMqS1.js → core-gp02JQ3r.js} +1493 -1459
- package/dist/split/chunks/{diagram-BxRNHzmO.js → diagram-rxvArV-1.js} +2 -2
- package/dist/split/chunks/{docx-Ch1AvEUX.js → docx-ecvZsSWm.js} +2 -2
- package/dist/split/chunks/{ebook-P42eILp5.js → ebook-5FyKWZ8s.js} +2 -2
- package/dist/split/chunks/{iwork-HnghW_EB.js → iwork-DlaehzuR.js} +63 -63
- package/dist/split/chunks/{media-runtime-kbzoW8bd.js → media-runtime-DwW7eq4g.js} +2 -2
- package/dist/split/chunks/{mindmap-vFlOJSIq.js → mindmap-D9lNNDoa.js} +2 -2
- package/dist/split/chunks/{model3d-DoNu7iyY.js → model3d-BtFT01ZH.js} +3 -3
- package/dist/split/chunks/{panorama-Bw_8HQsv.js → panorama-Ci6DK6sa.js} +989 -985
- package/dist/split/chunks/{vendor-Cv2Fxtsf.js → vendor-DvWhw-zP.js} +6883 -7216
- package/dist/split/chunks/{xlsx-ypLtJxeq.js → xlsx-VJTu9XNS.js} +2 -2
- package/dist/split/converter-core.wasm +0 -0
- package/dist/split/converter-office.wasm +0 -0
- package/dist/split/filens.js +3814 -1213
- package/package.json +1 -1
- package/dist/split/assets/iwork-worker-D64s_rsm.js +0 -34
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _ = Object.defineProperty;
|
|
2
2
|
var R = (e, t, r) => t in e ? _(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var f = (e, t, r) => R(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
-
import { c as G } from "./core-
|
|
5
|
-
import { J as Y, i as W, a as H, s as j } from "./vendor-
|
|
4
|
+
import { c as G } from "./core-gp02JQ3r.js";
|
|
5
|
+
import { J as Y, i as W, a as H, s as j } from "./vendor-DvWhw-zP.js";
|
|
6
6
|
const q = [
|
|
7
7
|
{
|
|
8
8
|
extensions: ["drawio", "dio", "vdx", "vsdx"],
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var A = Object.defineProperty;
|
|
2
2
|
var H = (o, s, t) => s in o ? A(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
|
|
3
3
|
var v = (o, s, t) => H(o, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
-
import { ak as j, al as k } from "./vendor-
|
|
5
|
-
import { h as R, i as B, s as E, f as U, a as T, k as W, l as _, c as z, b as I } from "./core-
|
|
4
|
+
import { ak as j, al as k } from "./vendor-DvWhw-zP.js";
|
|
5
|
+
import { h as R, i as B, s as E, f as U, a as T, k as W, l as _, c as z, b as I } from "./core-gp02JQ3r.js";
|
|
6
6
|
const x = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
async function X(o, s) {
|
|
8
8
|
var r, c;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var q = Object.defineProperty;
|
|
2
2
|
var G = (t, e, r) => e in t ? q(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
3
|
var T = (t, e, r) => G(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
-
import { J as N } from "./vendor-
|
|
5
|
-
import { c as Z } from "./core-
|
|
4
|
+
import { J as N } from "./vendor-DvWhw-zP.js";
|
|
5
|
+
import { c as Z } from "./core-gp02JQ3r.js";
|
|
6
6
|
async function W(t, e) {
|
|
7
7
|
const r = [];
|
|
8
8
|
for (let i = 0; i < t.length; ) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var S = (e, t, n) =>
|
|
4
|
-
import { M as se, r as we, c as pe, b as be, a as
|
|
5
|
-
import { R as j, c as Se, a as ye } from "./xlsx-
|
|
1
|
+
var ge = Object.defineProperty;
|
|
2
|
+
var me = (e, t, n) => t in e ? ge(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var S = (e, t, n) => me(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { M as se, r as we, c as pe, b as be, a as Y, d as ve, e as K, f as Z, g as ke } from "./core-gp02JQ3r.js";
|
|
5
|
+
import { R as j, c as Se, a as ye } from "./xlsx-VJTu9XNS.js";
|
|
6
6
|
async function Ee(e, t = {}) {
|
|
7
7
|
if (q(t.signal), typeof e == "string") {
|
|
8
8
|
const n = await fetch(e, {
|
|
@@ -75,7 +75,7 @@ class Le {
|
|
|
75
75
|
if (this.destroyed) throw new Error("iWork parser worker has been destroyed.");
|
|
76
76
|
return this.worker ? this.worker : (this.worker = new Worker(new URL(
|
|
77
77
|
/* @vite-ignore */
|
|
78
|
-
"" + new URL("../assets/iwork-worker-
|
|
78
|
+
"" + new URL("../assets/iwork-worker-DiTOJG8f.js", import.meta.url).href,
|
|
79
79
|
import.meta.url
|
|
80
80
|
), {
|
|
81
81
|
type: "module"
|
|
@@ -84,8 +84,8 @@ class Le {
|
|
|
84
84
|
parse(t, n, s) {
|
|
85
85
|
this.pending.size && this.cancel();
|
|
86
86
|
const i = ++this.requestId, a = t.buffer instanceof ArrayBuffer && t.byteOffset === 0 && t.byteLength === t.buffer.byteLength ? t.buffer : t.slice().buffer;
|
|
87
|
-
return new Promise((u,
|
|
88
|
-
this.pending.set(i, { resolve: u, reject:
|
|
87
|
+
return new Promise((u, g) => {
|
|
88
|
+
this.pending.set(i, { resolve: u, reject: g }), this.postRequest(
|
|
89
89
|
i,
|
|
90
90
|
{
|
|
91
91
|
kind: "document",
|
|
@@ -146,10 +146,10 @@ function U(e) {
|
|
|
146
146
|
function Q(e, t, n, s) {
|
|
147
147
|
const i = Fe(t, n.slide), a = s ?? new se(i), u = e.createElement("div");
|
|
148
148
|
u.className = t.kind === "numbers" ? "iworkv-page-shell iworkv-sheet-shell" : "iworkv-page-shell";
|
|
149
|
-
const
|
|
149
|
+
const g = we(n.slide, i, {
|
|
150
150
|
mediaRegistry: a
|
|
151
151
|
});
|
|
152
|
-
return u.appendChild(
|
|
152
|
+
return u.appendChild(g), u;
|
|
153
153
|
}
|
|
154
154
|
function Fe(e, t) {
|
|
155
155
|
return e.kind === "key" ? {
|
|
@@ -179,9 +179,9 @@ function Pe(e) {
|
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
181
|
function Ae(e, t = {}) {
|
|
182
|
-
var
|
|
182
|
+
var J;
|
|
183
183
|
const n = /* @__PURE__ */ new Map(), s = new Le(), i = t.fit === void 0;
|
|
184
|
-
let a = null, u = null,
|
|
184
|
+
let a = null, u = null, g = null, R = 0, v = !1;
|
|
185
185
|
const r = {
|
|
186
186
|
loading: !1,
|
|
187
187
|
error: null,
|
|
@@ -208,9 +208,9 @@ function Ae(e, t = {}) {
|
|
|
208
208
|
}, E = () => ({
|
|
209
209
|
...r,
|
|
210
210
|
warnings: r.warnings.slice()
|
|
211
|
-
}),
|
|
211
|
+
}), z = () => {
|
|
212
212
|
const o = u;
|
|
213
|
-
u = null, o == null || o.abort(), s.cancel(),
|
|
213
|
+
u = null, o == null || o.abort(), s.cancel(), g == null || g.abort(), g = null, C == null || C.disconnect(), C = null, P && typeof cancelAnimationFrame < "u" && cancelAnimationFrame(P), P = 0, k.replaceChildren(), k.classList.remove("iworkv-numbers-stage"), F = [], D.clear(), L.clear(), B.clear(), a == null || a.destroy(), a = null, Object.assign(r, {
|
|
214
214
|
document: null,
|
|
215
215
|
kind: null,
|
|
216
216
|
loading: !1,
|
|
@@ -223,7 +223,7 @@ function Ae(e, t = {}) {
|
|
|
223
223
|
}), e.scrollTop = 0, e.scrollLeft = 0;
|
|
224
224
|
}, I = () => {
|
|
225
225
|
var h;
|
|
226
|
-
if (
|
|
226
|
+
if (g == null || g.abort(), g = new AbortController(), k.innerHTML = "", k.classList.toggle("iworkv-numbers-stage", ((h = r.document) == null ? void 0 : h.kind) === "numbers"), F = [], D.clear(), L.clear(), !r.document)
|
|
227
227
|
return;
|
|
228
228
|
const o = U(r.document);
|
|
229
229
|
if (o.length) {
|
|
@@ -235,9 +235,9 @@ function Ae(e, t = {}) {
|
|
|
235
235
|
const l = document.createElement("div");
|
|
236
236
|
l.className = "iworkv-pages";
|
|
237
237
|
const c = k.getBoundingClientRect();
|
|
238
|
-
o.forEach((d,
|
|
238
|
+
o.forEach((d, m) => {
|
|
239
239
|
const w = document.createElement("div");
|
|
240
|
-
w.className = "iworkv-page-shell",
|
|
240
|
+
w.className = "iworkv-page-shell", O(w, d.width, d.height, _(d.width, d.height, c)), w.dataset.pageIndex = String(m), l.appendChild(w), F.push(w);
|
|
241
241
|
}), k.appendChild(l), L.add(r.currentPage), V();
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
@@ -251,13 +251,13 @@ function Ae(e, t = {}) {
|
|
|
251
251
|
const h = document.createElement("div");
|
|
252
252
|
h.className = "xlsxv-sheet-tabs", r.document.sheets.forEach((f, M) => {
|
|
253
253
|
const b = document.createElement("button");
|
|
254
|
-
b.type = "button", b.className = "xlsxv-sheet-tab", b.classList.toggle("is-active", M === r.currentSheet), b.textContent = f.name, b.addEventListener("click", () =>
|
|
254
|
+
b.type = "button", b.className = "xlsxv-sheet-tab", b.classList.toggle("is-active", M === r.currentSheet), b.textContent = f.name, b.addEventListener("click", () => G(M), { signal: g.signal }), h.appendChild(b);
|
|
255
255
|
});
|
|
256
256
|
const l = document.createElement("div");
|
|
257
257
|
l.className = "xlsxv-grid";
|
|
258
258
|
const c = document.createElement("div");
|
|
259
259
|
c.className = "iworkv-numbers-tables";
|
|
260
|
-
const d = r.document.sheets[r.currentSheet],
|
|
260
|
+
const d = r.document.sheets[r.currentSheet], m = ((d == null ? void 0 : d.tables) ?? []).map(({ item: f }, M) => {
|
|
261
261
|
const b = Ie(f, M), x = document.createElement("section");
|
|
262
262
|
if (x.className = "iworkv-numbers-table", x.style.containIntrinsicBlockSize = `auto ${(Math.min(Math.max(b.rowCount, 1), j) + 1) * 26}px`, ((d == null ? void 0 : d.tables.length) ?? 0) > 1) {
|
|
263
263
|
const $ = document.createElement("h3");
|
|
@@ -276,15 +276,15 @@ function Ae(e, t = {}) {
|
|
|
276
276
|
items: w
|
|
277
277
|
}
|
|
278
278
|
}, x = Q(document, r.document, b, a ?? void 0), T = Math.max(k.getBoundingClientRect().width - 32, 1);
|
|
279
|
-
|
|
279
|
+
O(x, b.width, b.height, T / Math.max(b.width, 1)), f.className = "iworkv-numbers-objects", f.append(M, x), c.appendChild(f);
|
|
280
280
|
}
|
|
281
281
|
l.appendChild(c), l.addEventListener("scroll", () => {
|
|
282
282
|
if (!(l.scrollHeight - l.scrollTop - l.clientHeight > l.clientHeight * 2))
|
|
283
|
-
for (const { sheet: f, item: M, table: b, body: x } of
|
|
283
|
+
for (const { sheet: f, item: M, table: b, body: x } of m) {
|
|
284
284
|
const T = x.rows.length;
|
|
285
285
|
T < f.rowCount && (ye(x, f, T + 1, Math.min(T + j, f.rowCount)), ee(b, M, a));
|
|
286
286
|
}
|
|
287
|
-
}, { passive: !0, signal:
|
|
287
|
+
}, { passive: !0, signal: g.signal }), o.replaceChildren(h, l), k.appendChild(o);
|
|
288
288
|
}, V = () => {
|
|
289
289
|
if (!r.document || r.document.kind === "numbers")
|
|
290
290
|
return;
|
|
@@ -294,19 +294,19 @@ function Ae(e, t = {}) {
|
|
|
294
294
|
for (const c of l) {
|
|
295
295
|
if (D.has(c))
|
|
296
296
|
continue;
|
|
297
|
-
const d = F[c],
|
|
298
|
-
if (!d || !
|
|
297
|
+
const d = F[c], m = o[c];
|
|
298
|
+
if (!d || !m)
|
|
299
299
|
continue;
|
|
300
|
-
const w = Q(document, r.document,
|
|
301
|
-
w && (d.appendChild(w),
|
|
300
|
+
const w = Q(document, r.document, m, a ?? void 0).firstElementChild;
|
|
301
|
+
w && (d.appendChild(w), O(d, m.width, m.height, r.scale), D.set(c, w));
|
|
302
302
|
}
|
|
303
303
|
}, H = () => {
|
|
304
304
|
if (P = 0, !r.document || r.document.kind === "numbers" || !F.length)
|
|
305
305
|
return;
|
|
306
306
|
const o = Be(e), h = (o.top + o.bottom) / 2, l = Math.max(o.height, 1);
|
|
307
307
|
let c = r.currentPage, d = Number.POSITIVE_INFINITY;
|
|
308
|
-
L.clear(), F.forEach((
|
|
309
|
-
const p =
|
|
308
|
+
L.clear(), F.forEach((m, w) => {
|
|
309
|
+
const p = m.getBoundingClientRect();
|
|
310
310
|
p.bottom >= o.top - l && p.top <= o.bottom + l && L.add(w);
|
|
311
311
|
const f = Math.abs((p.top + p.bottom) / 2 - h);
|
|
312
312
|
f < d && (d = f, c = w);
|
|
@@ -318,7 +318,7 @@ function Ae(e, t = {}) {
|
|
|
318
318
|
}
|
|
319
319
|
P = requestAnimationFrame(H);
|
|
320
320
|
};
|
|
321
|
-
e.addEventListener("scroll", W, { passive: !0 }), e.ownerDocument.addEventListener("scroll", W, { capture: !0, passive: !0 }), (
|
|
321
|
+
e.addEventListener("scroll", W, { passive: !0 }), e.ownerDocument.addEventListener("scroll", W, { capture: !0, passive: !0 }), (J = e.ownerDocument.defaultView) == null || J.addEventListener("scroll", W, { passive: !0 });
|
|
322
322
|
const ae = (o) => {
|
|
323
323
|
if (!r.document || r.document.kind === "numbers")
|
|
324
324
|
return;
|
|
@@ -330,8 +330,8 @@ function Ae(e, t = {}) {
|
|
|
330
330
|
}, _ = (o, h, l) => {
|
|
331
331
|
if (r.fit === "none")
|
|
332
332
|
return r.scale;
|
|
333
|
-
const c = l ?? k.getBoundingClientRect(), d = Math.max(c.width - 32, 1),
|
|
334
|
-
return r.fit === "width" ? (r.scale = d / Math.max(o, 1), r.scale) : r.fit === "height" ? (r.scale =
|
|
333
|
+
const c = l ?? k.getBoundingClientRect(), d = Math.max(c.width - 32, 1), m = Math.max(c.height - 32, 1);
|
|
334
|
+
return r.fit === "width" ? (r.scale = d / Math.max(o, 1), r.scale) : r.fit === "height" ? (r.scale = m / Math.max(h, 1), r.scale) : (r.scale = Math.min(d / Math.max(o, 1), m / Math.max(h, 1)), r.scale);
|
|
335
335
|
}, le = () => {
|
|
336
336
|
C == null || C.disconnect(), C = null, !(typeof ResizeObserver > "u") && (C = new ResizeObserver(() => {
|
|
337
337
|
var h;
|
|
@@ -341,14 +341,14 @@ function Ae(e, t = {}) {
|
|
|
341
341
|
const l = (h = r.document.sheets[r.currentSheet]) == null ? void 0 : h.canvas, c = k.querySelector(".iworkv-numbers-objects .iworkv-page-shell");
|
|
342
342
|
if (l && c) {
|
|
343
343
|
const d = Math.max(k.getBoundingClientRect().width - 32, 1);
|
|
344
|
-
|
|
344
|
+
O(c, l.width, l.height, d / Math.max(l.width, 1));
|
|
345
345
|
}
|
|
346
346
|
return;
|
|
347
347
|
}
|
|
348
348
|
const o = k.getBoundingClientRect();
|
|
349
349
|
U(r.document).forEach((l, c) => {
|
|
350
350
|
const d = F[c];
|
|
351
|
-
d &&
|
|
351
|
+
d && O(d, l.width, l.height, _(l.width, l.height, o));
|
|
352
352
|
}), y("scalechange", E());
|
|
353
353
|
}), C.observe(k));
|
|
354
354
|
}, ce = (o) => {
|
|
@@ -356,28 +356,28 @@ function Ae(e, t = {}) {
|
|
|
356
356
|
const h = ((c = r.document) == null ? void 0 : c.kind) === "numbers" ? r.document : null;
|
|
357
357
|
if (!h || ((d = h.sheets[o]) == null ? void 0 : d.loaded) !== !1 || (r.currentSheet === o && (e.classList.add("is-loading"), e.dataset.status = "Loading sheet..."), B.has(o)))
|
|
358
358
|
return;
|
|
359
|
-
const l = s.parseSheet(o).then((
|
|
360
|
-
r.document === h && (h.sheets[o] =
|
|
361
|
-
}).catch((
|
|
359
|
+
const l = s.parseSheet(o).then((m) => {
|
|
360
|
+
r.document === h && (h.sheets[o] = m, r.currentSheet === o && (I(), A()), y("sheetchange", E()));
|
|
361
|
+
}).catch((m) => {
|
|
362
362
|
if (r.document !== h)
|
|
363
363
|
return;
|
|
364
|
-
const w =
|
|
364
|
+
const w = m instanceof Error ? m : new Error(String(m));
|
|
365
365
|
r.currentSheet === o && (r.error = w.message, A(), y("error", w));
|
|
366
366
|
}).finally(() => {
|
|
367
367
|
B.get(o) === l && B.delete(o);
|
|
368
368
|
});
|
|
369
369
|
B.set(o, l);
|
|
370
370
|
}, de = async (o, h = {}) => {
|
|
371
|
-
var
|
|
371
|
+
var m, w;
|
|
372
372
|
if (v) throw new Error("iWork viewer has been destroyed.");
|
|
373
373
|
const l = ++R;
|
|
374
|
-
|
|
374
|
+
z();
|
|
375
375
|
const c = new AbortController();
|
|
376
376
|
u = c;
|
|
377
377
|
const d = () => {
|
|
378
|
-
u === c && (
|
|
378
|
+
u === c && (z(), A(), y("loadingchange", E()));
|
|
379
379
|
};
|
|
380
|
-
if ((
|
|
380
|
+
if ((m = h.signal) == null || m.addEventListener("abort", d, { once: !0 }), c.signal.addEventListener("abort", () => {
|
|
381
381
|
var p;
|
|
382
382
|
return (p = h.signal) == null ? void 0 : p.removeEventListener("abort", d);
|
|
383
383
|
}, { once: !0 }), (w = h.signal) != null && w.aborted)
|
|
@@ -394,7 +394,7 @@ function Ae(e, t = {}) {
|
|
|
394
394
|
if (v || R !== l) return;
|
|
395
395
|
if (c.signal.aborted) throw new DOMException("The operation was aborted.", "AbortError");
|
|
396
396
|
const f = p instanceof Error ? p : new Error(String(p));
|
|
397
|
-
|
|
397
|
+
z(), r.error = f.message, A(), y("loadingchange", E()), !v && R === l && y("error", f);
|
|
398
398
|
}
|
|
399
399
|
}, ue = (o) => {
|
|
400
400
|
v || r.kind === "numbers" || (r.fit = "none", r.scale = Math.max(t.minScale ?? 0.25, Math.min(o, t.maxScale ?? 4)), I(), y("scalechange", E()));
|
|
@@ -407,7 +407,7 @@ function Ae(e, t = {}) {
|
|
|
407
407
|
return l.add(h), n.set(o, l), () => {
|
|
408
408
|
l.delete(h);
|
|
409
409
|
};
|
|
410
|
-
},
|
|
410
|
+
}, G = (o) => {
|
|
411
411
|
v || r.kind !== "numbers" || (r.currentSheet = Math.max(0, Math.min(o, Math.max(r.sheetCount - 1, 0))), r.error = null, I(), A(), ce(r.currentSheet), y("sheetchange", E()));
|
|
412
412
|
};
|
|
413
413
|
return {
|
|
@@ -425,19 +425,19 @@ function Ae(e, t = {}) {
|
|
|
425
425
|
N = void 0;
|
|
426
426
|
}
|
|
427
427
|
e.scrollTop = o, e.scrollLeft = h;
|
|
428
|
-
const
|
|
429
|
-
|
|
428
|
+
const m = k.querySelector(".xlsxv-grid");
|
|
429
|
+
m && (m.scrollTop = c, m.scrollLeft = d), y("rendered", E());
|
|
430
430
|
},
|
|
431
431
|
destroy() {
|
|
432
432
|
var o;
|
|
433
|
-
v || (v = !0, ++R, n.clear(),
|
|
433
|
+
v || (v = !0, ++R, n.clear(), z(), e.removeEventListener("scroll", W), e.ownerDocument.removeEventListener("scroll", W, !0), (o = e.ownerDocument.defaultView) == null || o.removeEventListener("scroll", W), s.destroy(), e.classList.remove("iworkv-root", "is-loading", "is-error"), e.removeAttribute("data-status"), e.innerHTML = "");
|
|
434
434
|
},
|
|
435
435
|
setScale: ue,
|
|
436
436
|
fit: he,
|
|
437
437
|
goToPage(o) {
|
|
438
438
|
v || (r.currentPage = Math.max(0, Math.min(o, Math.max(r.pageCount - 1, 0))), r.document && r.document.kind !== "numbers" ? (L.clear(), L.add(r.currentPage), V(), ae(r.currentPage)) : I(), y("pagechange", E()));
|
|
439
439
|
},
|
|
440
|
-
goToSheet:
|
|
440
|
+
goToSheet: G,
|
|
441
441
|
next() {
|
|
442
442
|
r.kind === "numbers" ? this.goToSheet(Math.min(r.currentSheet + 1, Math.max(r.sheetCount - 1, 0))) : this.goToPage(Math.min(r.currentPage + 1, Math.max(r.pageCount - 1, 0)));
|
|
443
443
|
},
|
|
@@ -464,7 +464,7 @@ function Ie(e, t) {
|
|
|
464
464
|
ref: `${i}:${s.column + 1}`,
|
|
465
465
|
row: i,
|
|
466
466
|
column: s.column + 1,
|
|
467
|
-
value: s.textFrame.paragraphs.map((u) => u.runs.map((
|
|
467
|
+
value: s.textFrame.paragraphs.map((u) => u.runs.map((g) => g.text).join("")).join(`
|
|
468
468
|
`)
|
|
469
469
|
}), n.set(i, a);
|
|
470
470
|
}
|
|
@@ -485,8 +485,8 @@ function ee(e, t, n) {
|
|
|
485
485
|
const u = (i = (s = e.tBodies[0]) == null ? void 0 : s.rows[a.row]) == null ? void 0 : i.cells[a.column + 1];
|
|
486
486
|
if (!u || u.querySelector(".iworkv-cell-image"))
|
|
487
487
|
continue;
|
|
488
|
-
const
|
|
489
|
-
|
|
488
|
+
const g = document.createElement("img");
|
|
489
|
+
g.className = "iworkv-cell-image", g.src = n.getUrl(a.fill.mediaId), g.alt = "", g.loading = "lazy", u.prepend(g);
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
492
|
function Re(e) {
|
|
@@ -512,8 +512,8 @@ function Be(e) {
|
|
|
512
512
|
const u = (t == null ? void 0 : t.getComputedStyle(a).overflowY) ?? "visible";
|
|
513
513
|
if (!/^(auto|scroll|hidden|clip)$/.test(u))
|
|
514
514
|
continue;
|
|
515
|
-
const
|
|
516
|
-
s = Math.max(s,
|
|
515
|
+
const g = a.getBoundingClientRect();
|
|
516
|
+
s = Math.max(s, g.top), i = Math.min(i, g.bottom);
|
|
517
517
|
}
|
|
518
518
|
if (i <= s) {
|
|
519
519
|
const a = t ? 0 : n.top, u = t ? t.innerHeight : n.bottom;
|
|
@@ -525,7 +525,7 @@ function Be(e) {
|
|
|
525
525
|
}
|
|
526
526
|
return { top: s, bottom: i, height: i - s };
|
|
527
527
|
}
|
|
528
|
-
function
|
|
528
|
+
function O(e, t, n, s) {
|
|
529
529
|
e.style.width = `${t * s}px`, e.style.height = `${n * s}px`, e.style.position = "relative";
|
|
530
530
|
const i = e.firstElementChild;
|
|
531
531
|
i && (i.style.transform = `scale(${s})`, i.style.transformOrigin = "top left");
|
|
@@ -565,7 +565,7 @@ class We {
|
|
|
565
565
|
S(this, "destroyed", !1);
|
|
566
566
|
S(this, "fontDocument", null);
|
|
567
567
|
S(this, "fontScenes", []);
|
|
568
|
-
S(this, "fontAnalysis",
|
|
568
|
+
S(this, "fontAnalysis", Y([]));
|
|
569
569
|
S(this, "fontUpdate", null);
|
|
570
570
|
S(this, "fontLoading");
|
|
571
571
|
this.host = t, this.viewer = Ae(t, {
|
|
@@ -675,14 +675,14 @@ class We {
|
|
|
675
675
|
!t && this.host.requestFullscreen && await this.host.requestFullscreen();
|
|
676
676
|
}
|
|
677
677
|
updateState(t) {
|
|
678
|
-
const n = t.document, s = n ? n.kind === "key" ? n.presentation.slides : n.kind === "pages" ? n.pages.map((u) => u.canvas.slide) : n.sheets.map((u) => u.canvas.slide) : [], i = (n == null ? void 0 : n.kind) === "numbers" ? n.sheets.flatMap((u) => u.tables.map((
|
|
679
|
-
if (n !== this.fontDocument || a.length !== this.fontScenes.length || a.some((u,
|
|
678
|
+
const n = t.document, s = n ? n.kind === "key" ? n.presentation.slides : n.kind === "pages" ? n.pages.map((u) => u.canvas.slide) : n.sheets.map((u) => u.canvas.slide) : [], i = (n == null ? void 0 : n.kind) === "numbers" ? n.sheets.flatMap((u) => u.tables.map((g) => g.item)) : [], a = [...s, ...i];
|
|
679
|
+
if (n !== this.fontDocument || a.length !== this.fontScenes.length || a.some((u, g) => u !== this.fontScenes[g])) {
|
|
680
680
|
this.fontDocument = n, this.fontScenes = a;
|
|
681
|
-
const u = i.length ? [{ items: i }] : [],
|
|
681
|
+
const u = i.length ? [{ items: i }] : [], g = ke([...s, ...u]);
|
|
682
682
|
if (this.fontUpdate) {
|
|
683
683
|
const R = new Map(this.fontUpdate.references.map((v) => [v.fontFamily, v]));
|
|
684
|
-
this.fontAnalysis = Z({ ...this.fontUpdate, references:
|
|
685
|
-
} else this.fontAnalysis =
|
|
684
|
+
this.fontAnalysis = Z({ ...this.fontUpdate, references: g.map((v) => R.get(v.fontFamily) ?? v) }, this.host.ownerDocument), K([...s, ...u], this.fontUpdate.references);
|
|
685
|
+
} else this.fontAnalysis = Y(g, this.host.ownerDocument);
|
|
686
686
|
}
|
|
687
687
|
this.lastState = {
|
|
688
688
|
...ne(t),
|
|
@@ -699,7 +699,7 @@ function Ve() {
|
|
|
699
699
|
return {
|
|
700
700
|
id: "iwork",
|
|
701
701
|
family: "paged",
|
|
702
|
-
supports: (e) =>
|
|
702
|
+
supports: (e) => ze(e) != null,
|
|
703
703
|
createSession: (e, t) => new We(e, t)
|
|
704
704
|
};
|
|
705
705
|
}
|
|
@@ -747,7 +747,7 @@ function ne(e) {
|
|
|
747
747
|
pageIndex: e.currentPage,
|
|
748
748
|
pageCount: e.pageCount,
|
|
749
749
|
scale: e.scale,
|
|
750
|
-
fit:
|
|
750
|
+
fit: Oe(e.fit)
|
|
751
751
|
};
|
|
752
752
|
}
|
|
753
753
|
function Ne(e) {
|
|
@@ -759,10 +759,10 @@ function Ne(e) {
|
|
|
759
759
|
function re(e) {
|
|
760
760
|
return e === "contain" || e === "width" || e === "none" ? e : e === "height" ? "height" : "contain";
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function Oe(e) {
|
|
763
763
|
return e === "contain" || e === "width" || e === "height" || e === "none" ? e : "contain";
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function ze(e) {
|
|
766
766
|
const t = String(e ?? "").trim().replace(/^\./, "").toLowerCase();
|
|
767
767
|
return t === "key" || t === "pages" || t === "numbers" ? t : null;
|
|
768
768
|
}
|