@silurus/ooxml 0.89.0 → 0.89.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/assets/render-worker-Bye3wDV9.js +35 -0
- package/dist/assets/render-worker-CyUrUidp.js +16 -0
- package/dist/assets/render-worker-D_SMt5nl.js +15 -0
- package/dist/bounded-raw-part-cache-C3daknU-.js +33925 -0
- package/dist/{canvas-viewer-mechanics-DfQqRKkD.js → canvas-viewer-mechanics-SZWSnn6j.js} +2 -2
- package/dist/{cfb-guard-9QTRTg7f.js → cfb-guard-dNeUiANF.js} +1 -1
- package/dist/chart-ex.mjs +477 -477
- package/dist/{comment-overlay-controller-B5_zGgG5.js → comment-overlay-controller-CHDxT0e7.js} +16 -16
- package/dist/{comment-ui-runtime-Jy-3goA9.js → comment-ui-runtime-BcwaRnMR.js} +3 -3
- package/dist/{comment-ui-runtime-D_sb2K6s.js → comment-ui-runtime-Dk2qrPy_.js} +3 -3
- package/dist/{document-model-source-BKNrXjAL.js → document-model-source-BD2VSd2L.js} +44 -44
- package/dist/{document-pull-client-CxONDGbk.js → document-pull-client-DhSGspvi.js} +6102 -7994
- package/dist/{document-pull-worker-AMyXYpPq.js → document-pull-worker-D-E0Iz3P.js} +18 -18
- package/dist/{docx-DhDnKEI6.js → docx-CCZBO1WQ.js} +556 -556
- package/dist/{docx-D91ER1_S.js → docx-CXfILbzI.js} +24 -24
- package/dist/{docx-model-source-CdrSt3hF.js → docx-model-source-Ci6xb487.js} +12 -12
- package/dist/docx.mjs +4 -4
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/{drawingml-shape-ChcGZNd8.js → drawingml-shape-Bp0yEZHC.js} +55 -55
- package/dist/{duotone-ekYik4ix.js → duotone-DN8P4aXe.js} +1 -1
- package/dist/{emf-UT6I8rVi.js → emf-CGFQIz6c.js} +60 -60
- package/dist/{font-preload-demand-CdJZUMCT.js → font-preload-demand-CGOB-MoE.js} +2 -2
- package/dist/{grid-geometry-uQOgViJU.js → grid-geometry-C3IG20ut.js} +1 -1
- package/dist/{host-layout-measure-CCEgaC_v.js → host-layout-measure-BAysJILu.js} +1 -1
- package/dist/index.mjs +3 -3
- package/dist/internal-companion.mjs +2 -2
- package/dist/{line-distribute-CPOV6csk.js → line-distribute-DhQqysA2.js} +153 -70
- package/dist/{model-source-DJGzDtGb.js → model-source-BkmyX_r-.js} +4 -4
- package/dist/{model-source-session-Bu9CHFHc.js → model-source-session-CF4iXav8.js} +18 -18
- package/dist/{model-source-session-sKpNiIJI.js → model-source-session-CJmkItIK.js} +10 -10
- package/dist/{model-source-session-CDuijwv1.js → model-source-session-CnPCTRDD.js} +2 -2
- package/dist/node.mjs +5 -5
- package/dist/{bounded-raw-part-cache-B7JoC1CD.js → plot-area-frame-Bs_j4uu7.js} +15189 -37964
- package/dist/{pptx-C_uxLVKB.js → pptx-BhmLP_Ed.js} +9 -9
- package/dist/{pptx-CDP9dZHe.js → pptx-Bo9hCGQU.js} +58 -58
- package/dist/{pptx-model-source-O7LhpOjz.js → pptx-model-source-J0SrVkO6.js} +5 -5
- package/dist/pptx.mjs +5 -5
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/{presentation-model-source-tmROzteR.js → presentation-model-source-CebYmrOD.js} +5 -5
- package/dist/region-map.mjs +53 -53
- package/dist/{render-CJVglUHl.js → render-hT2OVZUi.js} +2 -2
- package/dist/{render-worker-host-CyxPU4JU.js → render-worker-host-BmAQ-sWT.js} +1 -1
- package/dist/{render-worker-host-aF6aWkC0.js → render-worker-host-Cz224I38.js} +1 -1
- package/dist/{render-worker-host-BseIaVvm.js → render-worker-host-Desevuoc.js} +1 -1
- package/dist/renderer-BFWqhLEt.js +5833 -0
- package/dist/{renderer-CkGLj0CC.js → renderer-CvZ4JmoL.js} +696 -696
- package/dist/{resource-measurement-mXw-WjMF.js → resource-measurement-DBiUwblM.js} +162 -161
- package/dist/{session-Csv9maad.js → session-CWDKFWCh.js} +176 -176
- package/dist/{slide-pull-client-DRZYwBTu.js → slide-pull-client-BuBvXMyc.js} +1454 -1484
- package/dist/{three-d-BK5siJgJ.js → three-d-BKwNPAP4.js} +107 -107
- package/dist/three-d.mjs +625 -625
- package/dist/{wasm-runtime-generation-DX4y0Ecl.js → wasm-runtime-generation-BWGfM44b.js} +4 -4
- package/dist/{workbook-model-source-BTC4ISTS.js → workbook-model-source-Che8Zbjw.js} +6 -6
- package/dist/worker-source-DrwhR9fw.js +22 -0
- package/dist/{worksheet-pull-client-CkHgbtyM.js → worksheet-pull-client-Cxzj6uuB.js} +74 -74
- package/dist/{xlsx-D5569TPf.js → xlsx-C5BSwMUd.js} +24 -24
- package/dist/{xlsx-CpSDPAEU.js → xlsx-CUVUep5I.js} +433 -421
- package/dist/{xlsx-model-source-DPSkjFic.js → xlsx-model-source-C3_PiPBo.js} +55 -55
- package/dist/xlsx.mjs +5 -5
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +2 -2
- package/dist/assets/render-worker-CUOU6mL2.js +0 -16
- package/dist/assets/render-worker-DOqrFhSU.js +0 -15
- package/dist/assets/render-worker-DvWUdZUN.js +0 -35
- package/dist/plot-area-frame-CaJFvZ7p.js +0 -8502
- package/dist/renderer-Czw1cCC7.js +0 -5823
- package/dist/worker-source-I1cIYBel.js +0 -22
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { t as e } from "./chunk-Dy4uBu1J.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { A as
|
|
6
|
-
import { A as
|
|
7
|
-
import { f as
|
|
8
|
-
import { i as
|
|
9
|
-
import { D as
|
|
10
|
-
import { n as
|
|
2
|
+
import { _o as t, ja as n, vo as r, yo as i } from "./plot-area-frame-Bs_j4uu7.js";
|
|
3
|
+
import { n as a, t as o } from "./cfb-guard-dNeUiANF.js";
|
|
4
|
+
import { Dn as s, En as c, H as l, M as u, N as d, On as f, V as p, Xt as m, Y as h, Yt as g, hn as _, ht as v, j as y, qt as b, st as x, t as S, u as C, ut as ee } from "./bounded-raw-part-cache-C3daknU-.js";
|
|
5
|
+
import { A as te, C as w, D as ne, E as T, M as re, N as ie, P as E, S as ae, T as D, _ as oe, a as se, b as ce, c as le, d as ue, f as de, g as fe, h as pe, i as me, j as he, k as ge, l as _e, m as ve, n as ye, o as be, p as xe, r as Se, t as Ce, u as we, v as Te, w as Ee, x as De, y as Oe } from "./comment-overlay-controller-CHDxT0e7.js";
|
|
6
|
+
import { A as ke, B as Ae, C as je, D as O, E as Me, F as Ne, I as Pe, L as k, M as Fe, N as A, O as Ie, P as Le, R as Re, S as ze, T as Be, V as j, _ as Ve, a as He, b as Ue, c as We, f as Ge, h as Ke, j as M, k as qe, l as Je, m as Ye, n as Xe, o as Ze, p as Qe, s as $e, t as et, u as tt, v as nt, w as rt, x as it, y as N, z as at } from "./document-pull-client-DhSGspvi.js";
|
|
7
|
+
import { f as ot, u as st } from "./pixel-budget-BpTYrepD.js";
|
|
8
|
+
import { i as ct, t as lt } from "./tiff-contract-C6M3QcPp.js";
|
|
9
|
+
import { D as ut, E as dt, T as ft, a as pt, b as mt, c as ht, d as gt, f as _t, i as vt, l as yt, n as bt, o as xt, p as St, r as Ct, s as wt, t as Tt, u as Et, v as Dt, w as Ot, x as kt, y as At } from "./canvas-viewer-mechanics-SZWSnn6j.js";
|
|
10
|
+
import { n as jt } from "./renderer-module-contract-CWM7jv6d.js";
|
|
11
11
|
//#region packages/core/src/fonts/open-type-metrics.ts
|
|
12
|
-
var
|
|
12
|
+
var P = (e) => (e.charCodeAt(0) << 24 >>> 0 | e.charCodeAt(1) << 16 | e.charCodeAt(2) << 8 | e.charCodeAt(3)) >>> 0, Mt = P("ttcf"), Nt = P("OTTO"), Pt = P("true"), Ft = P("typ1"), It = P("head"), Lt = P("hhea"), Rt = P("OS/2"), zt = P("cmap"), Bt = P("fvar"), F = [
|
|
13
13
|
[4352, 4607],
|
|
14
14
|
[11904, 12287],
|
|
15
15
|
[12352, 12543],
|
|
@@ -25,10 +25,10 @@ var M = (e) => (e.charCodeAt(0) << 24 >>> 0 | e.charCodeAt(1) << 16 | e.charCode
|
|
|
25
25
|
[63744, 64255],
|
|
26
26
|
[131072, 205743]
|
|
27
27
|
];
|
|
28
|
-
function
|
|
28
|
+
function I(e, t, n) {
|
|
29
29
|
return Number.isSafeInteger(t) && Number.isSafeInteger(n) && t >= 0 && n >= 0 && t <= e - n;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function Vt(e, t, n) {
|
|
32
32
|
if (n < 16) return !1;
|
|
33
33
|
let r = e.getUint16(t + 2);
|
|
34
34
|
if (r < 16 || r > n) return !1;
|
|
@@ -44,7 +44,7 @@ function Ut(e, t, n) {
|
|
|
44
44
|
}
|
|
45
45
|
for (let n = 0; n < a; n++) {
|
|
46
46
|
let i = e.getUint16(s + n * 2), a = e.getUint16(o + n * 2), u = e.getInt16(c + n * 2), d = l + n * 2, f = e.getUint16(d);
|
|
47
|
-
for (let [n, o] of
|
|
47
|
+
for (let [n, o] of F) {
|
|
48
48
|
let s = Math.max(i, n), c = Math.min(a, o);
|
|
49
49
|
if (!(s > c)) {
|
|
50
50
|
if (f === 0) {
|
|
@@ -62,7 +62,7 @@ function Ut(e, t, n) {
|
|
|
62
62
|
}
|
|
63
63
|
return !1;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function Ht(e, t, n, r) {
|
|
66
66
|
if (n < 16) return !1;
|
|
67
67
|
let i = e.getUint32(t + 4), a = e.getUint32(t + 12);
|
|
68
68
|
if (i < 16 || i > n || a > (i - 16) / 12) return !1;
|
|
@@ -70,8 +70,8 @@ function Wt(e, t, n, r) {
|
|
|
70
70
|
for (let n = 0; n < a; n++) {
|
|
71
71
|
let i = t + 16 + n * 12, a = e.getUint32(i), s = e.getUint32(i + 4), c = e.getUint32(i + 8);
|
|
72
72
|
if (a > s || s > 1114111 || a <= o) return !1;
|
|
73
|
-
if (o = s, a >
|
|
74
|
-
for (let [e, t] of
|
|
73
|
+
if (o = s, a > F[F.length - 1][1]) break;
|
|
74
|
+
for (let [e, t] of F) {
|
|
75
75
|
let n = Math.max(a, e), i = Math.min(s, t);
|
|
76
76
|
if (!(n > i)) {
|
|
77
77
|
if (r) {
|
|
@@ -82,7 +82,7 @@ function Wt(e, t, n, r) {
|
|
|
82
82
|
}
|
|
83
83
|
return !1;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function Ut(e, t) {
|
|
86
86
|
if (!t || t.length < 4) return !1;
|
|
87
87
|
let n = e.getUint16(t.offset + 2);
|
|
88
88
|
if (4 + n * 8 > t.length) return !1;
|
|
@@ -92,12 +92,12 @@ function Gt(e, t) {
|
|
|
92
92
|
let o = e.getUint32(n + 4);
|
|
93
93
|
if (o > t.length - 2) continue;
|
|
94
94
|
let s = t.offset + o, c = t.length - o, l = e.getUint16(s);
|
|
95
|
-
if (l === 4 &&
|
|
95
|
+
if (l === 4 && Vt(e, s, c) || l === 12 && Ht(e, s, c, !1) || l === 13 && Ht(e, s, c, !0)) return !0;
|
|
96
96
|
}
|
|
97
97
|
return !1;
|
|
98
98
|
}
|
|
99
|
-
var
|
|
100
|
-
function
|
|
99
|
+
var Wt = 32768, Gt = 4096, Kt = 8, qt = 262144;
|
|
100
|
+
function Jt(e, t, n, r) {
|
|
101
101
|
if (n < 16) return null;
|
|
102
102
|
let i = e.getUint16(t + 2);
|
|
103
103
|
if (i < 16 || i > n) return null;
|
|
@@ -118,14 +118,14 @@ function Xt(e, t, n, r) {
|
|
|
118
118
|
if (r + 2 > t + i) return 0;
|
|
119
119
|
let o = e.getUint16(r);
|
|
120
120
|
return o === 0 ? 0 : o + f & 65535;
|
|
121
|
-
})()) !== 0 && m(n), d.length >
|
|
121
|
+
})()) !== 0 && m(n), d.length > Wt)) return null;
|
|
122
122
|
}
|
|
123
123
|
return d;
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function Yt(e, t, n, r, i) {
|
|
126
126
|
if (n < 16) return null;
|
|
127
127
|
let a = e.getUint32(t + 4), o = e.getUint32(t + 12);
|
|
128
|
-
if (a < 16 || a > n || o > (a - 16) / 12 || o >
|
|
128
|
+
if (a < 16 || a > n || o > (a - 16) / 12 || o > Wt) return null;
|
|
129
129
|
let s = [], c = -1;
|
|
130
130
|
for (let n = 0; n < o; n++) {
|
|
131
131
|
if (--i.remaining < 0) return null;
|
|
@@ -139,10 +139,10 @@ function Zt(e, t, n, r, i) {
|
|
|
139
139
|
}
|
|
140
140
|
return s;
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function Xt(e, t) {
|
|
143
143
|
if (!t || t.length < 4) return [];
|
|
144
144
|
let n = e.getUint16(t.offset + 2);
|
|
145
|
-
if (n >
|
|
145
|
+
if (n > Gt || 4 + n * 8 > t.length) return [];
|
|
146
146
|
let r = /* @__PURE__ */ new Set(), i = [];
|
|
147
147
|
for (let a = 0; a < n; a++) {
|
|
148
148
|
let n = t.offset + 4 + a * 8, o = e.getUint16(n), s = e.getUint16(n + 2);
|
|
@@ -153,7 +153,7 @@ function Qt(e, t) {
|
|
|
153
153
|
if (!(o === 0 && s === 5 && d === 14)) {
|
|
154
154
|
if (d !== 4 && d !== 12 && d !== 13) return [];
|
|
155
155
|
if (!r.has(c)) {
|
|
156
|
-
if (r.add(c), r.size >
|
|
156
|
+
if (r.add(c), r.size > Kt) return [];
|
|
157
157
|
i.push({
|
|
158
158
|
subtable: l,
|
|
159
159
|
availableLength: u,
|
|
@@ -162,9 +162,9 @@ function Qt(e, t) {
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
let a = { remaining:
|
|
165
|
+
let a = { remaining: qt }, o = null;
|
|
166
166
|
for (let t of i) {
|
|
167
|
-
let n = t.format === 4 ?
|
|
167
|
+
let n = t.format === 4 ? Jt(e, t.subtable, t.availableLength, a) : Yt(e, t.subtable, t.availableLength, t.format === 13, a);
|
|
168
168
|
if (!n?.length) return [];
|
|
169
169
|
if (o === null) {
|
|
170
170
|
o = n;
|
|
@@ -178,7 +178,7 @@ function Qt(e, t) {
|
|
|
178
178
|
let e = r.at(-1);
|
|
179
179
|
if (e && e[1] + 1 === c) r[r.length - 1] = [e[0], l];
|
|
180
180
|
else {
|
|
181
|
-
if (r.length >=
|
|
181
|
+
if (r.length >= Wt) return [];
|
|
182
182
|
r.push([c, l]);
|
|
183
183
|
}
|
|
184
184
|
}
|
|
@@ -189,48 +189,48 @@ function Qt(e, t) {
|
|
|
189
189
|
}
|
|
190
190
|
return Object.freeze((o ?? []).map((e) => Object.freeze(e)));
|
|
191
191
|
}
|
|
192
|
-
function
|
|
192
|
+
function Zt(e) {
|
|
193
193
|
let t = 0, n = 0;
|
|
194
|
-
for (; t < e.length && n <
|
|
195
|
-
let [r, i] = e[t], [a, o] =
|
|
194
|
+
for (; t < e.length && n < F.length;) {
|
|
195
|
+
let [r, i] = e[t], [a, o] = F[n];
|
|
196
196
|
if (i < a) t++;
|
|
197
197
|
else if (o < r) n++;
|
|
198
198
|
else return !0;
|
|
199
199
|
}
|
|
200
200
|
return !1;
|
|
201
201
|
}
|
|
202
|
-
function
|
|
203
|
-
return
|
|
202
|
+
function Qt(e, t) {
|
|
203
|
+
return $t(e, t, !0);
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function $t(e, t, n) {
|
|
206
206
|
if (t !== void 0 && (!Number.isSafeInteger(t) || t < 0) || e.byteLength < 12) return null;
|
|
207
207
|
let r = new DataView(e.buffer, e.byteOffset, e.byteLength), i = 0;
|
|
208
|
-
if (r.getUint32(0) ===
|
|
208
|
+
if (r.getUint32(0) === Mt) {
|
|
209
209
|
if (t === void 0 || e.byteLength < 12) return null;
|
|
210
210
|
let n = r.getUint32(8);
|
|
211
|
-
if (t >= n || !
|
|
211
|
+
if (t >= n || !I(e.byteLength, 12, n * 4)) return null;
|
|
212
212
|
i = r.getUint32(12 + t * 4);
|
|
213
213
|
} else if (t !== void 0 && t !== 0) return null;
|
|
214
|
-
if (!
|
|
214
|
+
if (!I(e.byteLength, i, 12)) return null;
|
|
215
215
|
let a = r.getUint32(i);
|
|
216
|
-
if (a !== 65536 && a !==
|
|
216
|
+
if (a !== 65536 && a !== Nt && a !== Pt && a !== Ft) return null;
|
|
217
217
|
let o = r.getUint16(i + 4);
|
|
218
|
-
if (!
|
|
218
|
+
if (!I(e.byteLength, i + 12, o * 16)) return null;
|
|
219
219
|
let s = /* @__PURE__ */ new Map();
|
|
220
220
|
for (let t = 0; t < o; t++) {
|
|
221
221
|
let n = i + 12 + t * 16, a = r.getUint32(n), o = r.getUint32(n + 8), c = r.getUint32(n + 12);
|
|
222
|
-
if (s.has(a) || !
|
|
222
|
+
if (s.has(a) || !I(e.byteLength, o, c)) return null;
|
|
223
223
|
s.set(a, {
|
|
224
224
|
offset: o,
|
|
225
225
|
length: c
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
|
-
if (n && s.has(
|
|
229
|
-
let c = s.get(
|
|
228
|
+
if (n && s.has(Bt)) return null;
|
|
229
|
+
let c = s.get(It), l = s.get(Lt);
|
|
230
230
|
if (!c || c.length < 20 || !l || l.length < 10) return null;
|
|
231
231
|
let u = r.getUint16(c.offset + 18);
|
|
232
232
|
if (u < 16 || u > 16384) return null;
|
|
233
|
-
let d = s.get(
|
|
233
|
+
let d = s.get(Rt), f = d !== void 0 && d.length >= 4 ? r.getInt16(d.offset + 2) : 0, p = d !== void 0 && d.length >= 78, m = d !== void 0 && d.length >= 86 && r.getUint16(d.offset) >= 1, h = n ? Xt(r, s.get(zt)) : void 0;
|
|
234
234
|
return Object.freeze({
|
|
235
235
|
unitsPerEm: u,
|
|
236
236
|
...f > 0 ? { averageCharWidthRatio: f / u } : {},
|
|
@@ -238,7 +238,7 @@ function tn(e, t, n) {
|
|
|
238
238
|
hheaDescent: r.getInt16(l.offset + 6),
|
|
239
239
|
hheaLineGap: r.getInt16(l.offset + 8),
|
|
240
240
|
farEastCodePage: m ? (r.getUint32(d.offset + 78) & 1966080) != 0 : null,
|
|
241
|
-
hasEastAsianCmap: h ?
|
|
241
|
+
hasEastAsianCmap: h ? Zt(h) : Ut(r, s.get(zt)),
|
|
242
242
|
...h === void 0 ? {} : { unicodeRanges: h },
|
|
243
243
|
...p ? {
|
|
244
244
|
typoAscent: r.getInt16(d.offset + 68),
|
|
@@ -252,36 +252,36 @@ function tn(e, t, n) {
|
|
|
252
252
|
}
|
|
253
253
|
//#endregion
|
|
254
254
|
//#region packages/docx/src/host-font-line-metrics.ts
|
|
255
|
-
function
|
|
256
|
-
if (e.metric.lineHeightRatio != null || !
|
|
257
|
-
let
|
|
255
|
+
function en(e, n) {
|
|
256
|
+
if (e.metric.lineHeightRatio != null || !n) return e.metric;
|
|
257
|
+
let r = t(e.requestedFamily, {
|
|
258
258
|
weight: e.weight,
|
|
259
259
|
style: e.style
|
|
260
260
|
});
|
|
261
|
-
if (e.source !== "substitute" &&
|
|
262
|
-
let
|
|
263
|
-
return Number.isFinite(
|
|
261
|
+
if (e.source !== "substitute" && r.some((e) => e.farEastCodePage !== !1)) return e.metric;
|
|
262
|
+
let i = n.ascentRatio + n.lineGapRatio, a = n.descentRatio;
|
|
263
|
+
return Number.isFinite(i) && Number.isFinite(a) && i >= 0 && a >= 0 && i + a > 0 ? Object.freeze({
|
|
264
264
|
...e.metric,
|
|
265
265
|
requiresGlyphCoverage: !0,
|
|
266
|
-
lineHeightRatio:
|
|
267
|
-
designAscentRatio:
|
|
268
|
-
designDescentRatio:
|
|
269
|
-
lineGapRatio:
|
|
270
|
-
...
|
|
266
|
+
lineHeightRatio: i + a,
|
|
267
|
+
designAscentRatio: i,
|
|
268
|
+
designDescentRatio: a,
|
|
269
|
+
lineGapRatio: n.lineGapRatio,
|
|
270
|
+
...r.length > 0 && e.source === "local" ? { farEastCodePage: !1 } : {}
|
|
271
271
|
}) : e.metric;
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function tn(e) {
|
|
274
274
|
if (e.metric.lineHeightRatio != null) return;
|
|
275
|
-
let
|
|
275
|
+
let n = t(e.requestedFamily, {
|
|
276
276
|
weight: e.weight,
|
|
277
277
|
style: e.style
|
|
278
278
|
});
|
|
279
|
-
return e.source === "substitute" ||
|
|
279
|
+
return e.source === "substitute" || n.every((e) => e.farEastCodePage === !1) ? n[0]?.unitsPerEm : void 0;
|
|
280
280
|
}
|
|
281
|
-
async function
|
|
281
|
+
async function nn(e) {
|
|
282
282
|
let t = typeof document > "u" ? null : document;
|
|
283
283
|
return Promise.all(e.map(async (e) => {
|
|
284
|
-
let n =
|
|
284
|
+
let n = tn(e), r = an(e), i = t?.body && r && n ? await Ae(r, e.family, e.weight, e.style, n, t) : null;
|
|
285
285
|
return {
|
|
286
286
|
resourceIdentity: e.resourceIdentity,
|
|
287
287
|
weight: e.weight,
|
|
@@ -290,27 +290,27 @@ async function an(e) {
|
|
|
290
290
|
};
|
|
291
291
|
}));
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function rn(e) {
|
|
294
294
|
if (e.source !== "local" || e.weight !== 400 || e.style !== "normal") return !1;
|
|
295
|
-
let
|
|
296
|
-
return !
|
|
295
|
+
let n = t(e.requestedFamily);
|
|
296
|
+
return !n.some((e) => e.weight >= 600 && e.style === "normal") || !n.some((e) => e.style === "italic");
|
|
297
297
|
}
|
|
298
|
-
function
|
|
298
|
+
function an(e) {
|
|
299
299
|
return e.source === "local" && e.resourceIdentity.startsWith("office-local:local(") ? e.resourceIdentity.slice(13) : void 0;
|
|
300
300
|
}
|
|
301
|
-
async function
|
|
301
|
+
async function on(e, t, n) {
|
|
302
302
|
let r = typeof document > "u" ? null : document;
|
|
303
303
|
if (!t) return e;
|
|
304
304
|
let i = r?.body && r.fonts === t ? r.createElement("canvas").getContext("2d") : null, a = /* @__PURE__ */ new Map(), o = await Promise.all(Object.entries(e.routes).map(async ([o, s]) => {
|
|
305
|
-
let c = e.faces.find((e) => e.family === s.family), l =
|
|
306
|
-
if (c && f &&
|
|
305
|
+
let c = e.faces.find((e) => e.family === s.family), l = tn(s), u = n?.find((e) => e.resourceIdentity === s.resourceIdentity && e.weight === s.weight && e.style === s.style), d = en(s, c && l && i && r?.body ? at(c, t, i, l, r) : u?.measured ?? null), f = an(s), p = null, m;
|
|
306
|
+
if (c && f && rn(s)) {
|
|
307
307
|
let e = a.get(c);
|
|
308
|
-
e || (e =
|
|
308
|
+
e || (e = Re(c, f, t), a.set(c, e)), m = (await e)?.family;
|
|
309
309
|
}
|
|
310
310
|
if (d !== s.metric) {
|
|
311
311
|
if (c && f) {
|
|
312
312
|
let e = a.get(c);
|
|
313
|
-
e || (e =
|
|
313
|
+
e || (e = Re(c, f, t), a.set(c, e)), p = await e;
|
|
314
314
|
}
|
|
315
315
|
d = p ? Object.freeze({
|
|
316
316
|
...d,
|
|
@@ -337,27 +337,27 @@ async function cn(e, t, n) {
|
|
|
337
337
|
routes: s
|
|
338
338
|
};
|
|
339
339
|
}
|
|
340
|
-
async function
|
|
341
|
-
return
|
|
340
|
+
async function sn(...e) {
|
|
341
|
+
return on(await g(...e), e[1] === void 0 ? c() : e[1]);
|
|
342
342
|
}
|
|
343
343
|
//#endregion
|
|
344
344
|
//#region packages/docx/src/resource-diagnostics.ts
|
|
345
|
-
var
|
|
346
|
-
function
|
|
347
|
-
let n =
|
|
345
|
+
var cn = /* @__PURE__ */ new WeakMap();
|
|
346
|
+
function L(e, t = []) {
|
|
347
|
+
let n = cn.get(e) ?? [], r = new Map(n.map((e) => [JSON.stringify(e), e]));
|
|
348
348
|
for (let e of t) r.set(JSON.stringify(e), Object.freeze({ ...e }));
|
|
349
|
-
|
|
349
|
+
cn.set(e, Object.freeze([...r.values()]));
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
return
|
|
351
|
+
function ln(e) {
|
|
352
|
+
return cn.get(e) ?? [];
|
|
353
353
|
}
|
|
354
354
|
//#endregion
|
|
355
355
|
//#region packages/docx/src/worker.ts?worker&inline
|
|
356
|
-
var fn = "var e=(e,t)=>()=>(e&&(t=e(e=0)),t);function t(e){if(!e.startsWith(`data:`))return null;let t=e.indexOf(`,`);if(t===-1)return null;let n=atob(e.slice(t+1)),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r.buffer}var n,r,i=e((()=>{n=class e extends Error{code;details;constructor(t,n,r){super(n),this.name=`OoxmlError`,this.code=t,t===`unsupported-content`&&r&&(this.details=Object.freeze({format:r.format,reason:r.reason})),Object.setPrototypeOf(this,e.prototype)}},r=class e extends Error{code=`ooxml-resource-limit`;details;constructor(t,n){super(t),this.name=`OoxmlResourceLimitError`;let r=n.violation,i=Object.freeze({format:r.format,operation:r.operation,resource:r.resource,metric:r.metric,...r.part===void 0?{}:{part:r.part},limit:r.limit,observed:r.observed,configurable:r.configurable,usage:Object.freeze({archiveEntryCount:r.usage.archiveEntryCount,declaredInflatedBytes:r.usage.declaredInflatedBytes,...r.usage.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:r.usage.largestInflatedEntryBytes},distinctInflatedBytes:r.usage.distinctInflatedBytes,operationInflatedBytes:r.usage.operationInflatedBytes})});this.details=Object.freeze({stage:n.stage,violation:i}),Object.setPrototypeOf(this,e.prototype)}}}));function a(e){return e===`image-dimension`||e===`image-pixels`||e===`active-decoded-bytes`||e===`image-effect-count`||e===`image-effect-work`||e===`tiff-lzw-work`||e===`metafile-path-commands`||e===`metafile-record-points`||e===`metafile-record-polygons`||e===`metafile-record-rectangles`||e===`metafile-record-text-units`}function o(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function s(e){if(!(!e||typeof e!=`object`))try{let t=e,n=t.code,r=t.metric,i=t.limit,s=t.observed;return n!==`ooxml-decoded-image-limit`||!a(r)||!o(i)||!o(s)||s<=i?void 0:{metric:r,limit:i,observed:s}}catch{return}}var c,l,u,d,f,ee=e((()=>{c=1<<25,l=1<<27,c*4,l*4,u=Math.floor(c/4),d=l,d/u,f=class e extends RangeError{metric;limit;observed;code=`ooxml-decoded-image-limit`;constructor(t,n,r){super(`OOXML decoded image limit exceeded: ${t} ${r} > ${n}`),this.metric=t,this.limit=n,this.observed=r,this.name=`OoxmlDecodedImageLimitError`,Object.setPrototypeOf(this,e.prototype)}}}));function te(e){if(!(typeof e!=`object`||!e))try{let t=e,n=t.code,r=t.message;return n===`ooxml-tiff-decode`&&typeof r==`string`?{message:r}:void 0}catch{return}}var ne=e((()=>{}));function p(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function re(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return p(t.requiredBytes)&&p(t.offeredBytes)&&t.requiredBytes>t.offeredBytes}var m=class e extends RangeError{code=`ooxml-insufficient-credit`;requiredBytes;offeredBytes;constructor(t){super(`Pull unit requires ${t.requiredBytes} bytes but credit is ${t.offeredBytes}`),this.name=`PullSessionInsufficientCreditError`,this.requiredBytes=t.requiredBytes,this.offeredBytes=t.offeredBytes,Object.setPrototypeOf(this,e.prototype)}};function h(e){if(e instanceof m)return e;let t=e instanceof Error?e.message:String(e);if(!t.startsWith(`OOXML_INSUFFICIENT_CREDIT:`))return;let n;try{n=JSON.parse(t.slice(26))}catch{return}if(!n||typeof n!=`object`||Array.isArray(n))return;let r=n;if(!(r.code!==`ooxml-insufficient-credit`||!re(r)))return new m(r)}function ie(e,t,n){let r=h(e);if(!(!r||r.offeredBytes!==t||r.requiredBytes>n))return r}i(),ee(),ne();const g=`OOXML_RESOURCE_LIMIT:`;function _(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function v(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return _(t.archiveEntryCount)&&_(t.declaredInflatedBytes)&&(t.largestInflatedEntryBytes===void 0||_(t.largestInflatedEntryBytes))&&_(t.distinctInflatedBytes)&&_(t.operationInflatedBytes)}function y(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{throw TypeError(`OOXML resource usage checkpoint is not valid JSON`)}if(!v(t))throw TypeError(`OOXML resource usage checkpoint is invalid`);return t}function ae(e){return e===`docx`||e===`xlsx`||e===`pptx`}function oe(e){return e===`container`||e===`decompression`||e===`parsing`||e===`serialization`||e===`layout`||e===`rendering`||e===`worker`}function b(e,t){return typeof e==`string`&&e.length>0&&e.length<=t&&!/[\\u0000-\\u001f\\u007f]/u.test(e)}function x(e){return b(e,128)&&/^[a-z0-9][a-z0-9-]*$/u.test(e)}function se(e){return!b(e,4096)||e.startsWith(`/`)||e.startsWith(`\\\\`)||e.includes(`\\\\`)||e.includes(`?`)||e.includes(`#`)||e.includes(`://`)||/^[a-z]:/iu.test(e)?!1:e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`)}const S=new Map([[`archive-entry:declared-inflated-bytes`,{stage:`container`,part:`required`}],[`archive-entry:actual-inflated-bytes`,{stage:`decompression`,part:`required`}],[`archive:entry-count`,{stage:`container`,part:`forbidden`}],[`archive:central-directory-bytes`,{stage:`container`,part:`forbidden`,configurable:!1}],[`archive:distinct-inflated-bytes`,{stage:`decompression`,part:`required`}],[`xml-event:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`xml-context:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`image-effect:work`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:elements`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-cache:points`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`numbering-marker:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-style-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-custom-number-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-number-format-bytes:bytes`,{stage:`parsing`,part:`required`,configurable:!1}],[`xml-tree:depth`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-row:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-shell:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`theme-style-reparse:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`style-inheritance:depth`,{stage:`parsing`,part:`required`,configurable:!1}],[`complex-field:depth`,{stage:`parsing`,part:`forbidden`,configurable:!1}]]),ce=new Set([...S.keys()].map(e=>e.slice(0,e.indexOf(`:`)))),le=new Set([...S.keys()].map(e=>e.slice(e.indexOf(`:`)+1)));function ue(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return!ae(t.format)||!b(t.operation,256)||!x(t.resource)||!x(t.metric)||!_(t.limit)||!_(t.observed)||typeof t.configurable!=`boolean`||!v(t.usage)?!1:!(`part`in t)||se(t.part)}function C(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(!oe(t.stage)||!ue(t.violation))return!1;let n=t.violation,r=S.get(`${n.resource}:${n.metric}`);return r?t.stage!==r.stage||r.configurable===!1&&n.configurable!==!1?!1:r.part===`required`?n.part!==void 0:r.part===`forbidden`?n.part===void 0:!0:!(ce.has(n.resource)&&le.has(n.metric))}function de(e){return{archiveEntryCount:e.archiveEntryCount,declaredInflatedBytes:e.declaredInflatedBytes,...e.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:e.largestInflatedEntryBytes},distinctInflatedBytes:e.distinctInflatedBytes,operationInflatedBytes:e.operationInflatedBytes}}function fe(e){if(!C(e))return;let t=e.violation,n={stage:e.stage,violation:{format:t.format,operation:t.operation,resource:t.resource,metric:t.metric,...t.part===void 0?{}:{part:t.part},limit:t.limit,observed:t.observed,configurable:t.configurable,usage:de(t.usage)}};return C(n)?n:void 0}function pe(e){let t=e.violation;return`OOXML resource limit exceeded${t.part?` for ${t.part}`:``} (${t.resource}, ${e.stage}): ${t.metric} ${t.observed} > ${t.limit}`}function w(e){let t=e instanceof Error?e.message:String(e);if(!t.startsWith(g))return;let n;try{n=JSON.parse(t.slice(21))}catch{return}if(!n||typeof n!=`object`)return;let i=n;if(!(i.code!==`ooxml-resource-limit`||!C(i.details)))return new r(pe(i.details),i.details)}function me(e){try{return e()}catch(e){throw e instanceof r||typeof e!=`string`&&!(e instanceof Error)?e:w(e)??e}}function he(e){let t=e instanceof Error?e.message:String(e);if(t.startsWith(`OOXML_NOT_OOXML:`))return new n(`not-ooxml`,`This file is not an Office Open XML document: ${t.slice(16)}`)}function T(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=t.format,r=t.reason;if(!(!x(n)||r!==`source-subset`))return{format:n,reason:r}}function E(e){return new n(`unsupported-content`,`Input is outside the source’s supported subset.`,e)}function ge(e){let t=typeof e==`string`?e:e instanceof Error?e.message:``;if(!(!t.startsWith(`MODEL_SOURCE_UNSUPPORTED:`)||t.length>1024))try{let e=T(JSON.parse(t.slice(25)));return e?E(e):void 0}catch{return}}function _e(e){return e===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`||e instanceof Error&&e.message===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`?new n(`unsupported-encryption`,`The configured source cannot decrypt this input.`):ge(e)??w(e)??he(e)}function ve(e){let t=s(e);if(t){let e=new f(t.metric,t.limit,t.observed);return{message:e.message,errorName:e.name,code:e.code,decodedImage:t}}let i=te(e);if(i)return{message:i.message,errorName:`TiffDecodeError`,code:`ooxml-tiff-decode`};let a=h(e);if(a)return{message:a.message,errorName:a.name,code:a.code,insufficientCredit:{requiredBytes:a.requiredBytes,offeredBytes:a.offeredBytes}};let o=e instanceof n||e instanceof r?e:_e(e),c=o??e;if(o instanceof r||c&&typeof c==`object`&&c.code===`ooxml-resource-limit`){let e=c,t=fe(e.details);return t?{message:typeof e.message==`string`?e.message:pe(t),errorName:`OoxmlResourceLimitError`,code:`ooxml-resource-limit`,resourceLimit:t}:{message:`Invalid OOXML resource-limit error payload`,errorName:`Error`}}if(c&&typeof c==`object`&&c.code===`unsupported-content`){let e=T(c.details);return e?{message:E(e).message,code:`unsupported-content`,unsupportedContent:e}:{message:`Invalid unsupported-content error payload`,errorName:`Error`}}if(o instanceof n)return{message:typeof o.message==`string`?o.message:String(o.message),errorName:b(o.name,128)?o.name:`OoxmlError`,...x(o.code)?{code:o.code}:{}};let l=e instanceof Error?e.message:String(e);if(typeof l==`string`&&l.startsWith(g))return{message:`Invalid OOXML resource-limit payload`,errorName:`Error`};let u=e instanceof Error?e:Error(l),d=u;return{message:typeof u.message==`string`?u.message:String(u.message),errorName:b(u.name,128)?u.name:`Error`,...typeof d.code==`string`?{code:d.code}:{}}}function D(e){try{return ve(e)}catch{return{message:`Worker operation failed with an unreadable error`,errorName:`Error`}}}var ye=class{initialize;reinitialize;normalizeFailure;state=`uninitialized`;generationValue=0;readiness;poisonListeners=new Set;constructor(e,t,n){this.initialize=e,this.reinitialize=t,this.normalizeFailure=n}get generation(){return this.generationValue}get poisoned(){return this.state===`poisoned`}onPoison(e){return this.poisonListeners.add(e),()=>this.poisonListeners.delete(e)}async ensureReady(){if(this.state!==`ready`){if(!this.readiness){let e=this.state===`uninitialized`?this.initialize:this.reinitialize;this.readiness=Promise.resolve().then(e).then(()=>{this.generationValue+=1,this.state=`ready`,this.readiness=void 0},e=>{throw this.readiness=void 0,e})}await this.readiness}}run(e){try{return e()}catch(e){let t=this.normalizeFailure(e);throw t?(this.poison(t),t):e}}tryRunReady(e){if(this.state!==`ready`)return{current:!1};let t=this.generationValue,n=this.run(e);return this.state!==`ready`||t!==this.generationValue?{current:!1}:{current:!0,generation:t,value:n}}poison(e){this.state=`poisoned`,this.readiness=void 0;for(let t of this.poisonListeners)t(e)}assertCurrent(e){if(this.state!==`ready`||e!==this.generationValue)throw Error(`WASM archive session belongs to a discarded runtime generation`)}},O=class e extends Error{code=`parser-crashed`;constructor(t){super(t),this.name=`WasmTrapError`,Object.setPrototypeOf(this,e.prototype)}};function be(e){let t=globalThis.WebAssembly?.RuntimeError;return t&&e instanceof t||e instanceof RangeError?!0:e instanceof Error?e.name===`RuntimeError`||e.name===`CompileError`||e.name===`LinkError`||e.name===`InternalError`||e.name===`OOMError`:!1}function xe(e){try{if((typeof e!=`object`||!e)&&typeof e!=`function`)return;let t=Reflect.get(e,`__destroy_into_raw`);typeof t==`function`&&Reflect.apply(t,e,[])}catch{}}function Se(e,t){return e({module_or_path:t})}var Ce=class{init;options;runtime;wasmInput=null;currentArchive=null;constructor(e,t={}){this.init=e,this.options=t,this.runtime=new ye(()=>this.invokeConfigured(this.init),()=>this.invokeConfigured(this.options.reinit??this.init),we),this.runtime.onPoison(()=>this.dropPoisonedArchive())}setWasmInput(e){this.wasmInput=e,this.runtime.ensureReady().catch(()=>void 0)}setWasmUrl(e){this.setWasmInput(e)}get archive(){return this.currentArchive}setArchive(e){this.freeArchive(),this.currentArchive=e}disposeArchive(){this.freeArchive()}get poisoned(){return this.runtime.poisoned}async ensureReady(){await this.runtime.ensureReady()}run(e){return me(()=>this.runtime.run(e))}poison(){this.runtime.poison(new O(`WASM parser was recycled`))}invokeConfigured(e){return this.wasmInput===null?Promise.reject(Error(`WasmParserHost: setWasmInput was never called`)):Se(e,this.wasmInput)}freeArchive(){this.currentArchive!==null&&this.options.freeArchive&&this.options.freeArchive(this.currentArchive),this.currentArchive=null}dropPoisonedArchive(){let e=this.currentArchive;this.currentArchive=null,xe(e)}};function we(e){return be(e)?new O(`WASM parser trapped and was recycled: ${e instanceof Error?e.message:String(e)}`):null}function Te(e){return e.byteOffset===0&&e.byteLength===e.buffer.byteLength&&e.buffer instanceof ArrayBuffer?e.buffer:e.slice().buffer}Object.freeze({maxArchiveEntryBytes:134217728,maxTotalInflatedBytes:268435456,maxArchiveEntries:4096});function Ee(e){return[e.maxArchiveEntryBytes===null?0n:BigInt(e.maxArchiveEntryBytes),e.maxTotalInflatedBytes===null?0n:BigInt(e.maxTotalInflatedBytes),e.maxArchiveEntries===null?0n:BigInt(e.maxArchiveEntries)]}const k=`ooxml-pull-v1`;function A(e,t){if(!Number.isSafeInteger(e)||e<=0)throw RangeError(`${t} must be a positive safe integer`)}function De(e){if(!(typeof e==`string`&&e.length>0||typeof e==`number`&&Number.isSafeInteger(e)&&e>0))throw RangeError(`session id must be a non-empty string or positive safe integer`)}var j=class{owner;queue=Promise.resolve();leases=new Map;retainedBytes=0;retainedCount=0;maxRetainedBytes;maxRetainedCount;cleanups=new Set;pendingFatalCleanups=[];poisonRunning=!1;fatal;constructor(e){this.maxRetainedBytes=e?.maxRetainedBytes??64*1024*1024,this.maxRetainedCount=e?.maxRetainedCount??256,A(this.maxRetainedBytes,`max retained lease bytes`),A(this.maxRetainedCount,`max retained lease count`)}enqueue(e){let t=this.queue.then(e,e);return this.queue=t.then(()=>void 0,()=>void 0),t}acquire(e){return this.owner===void 0?(this.owner=e,!0):this.owner===e}release(e){this.owner===e&&(this.owner=void 0)}retainLease(e,t,n){if(!Number.isSafeInteger(n)||n<0)throw RangeError(`retained lease bytes are invalid`);let r=this.leases.get(e)??new Map;if(r.has(t))throw Error(`driver returned a duplicate lease id`);if(this.retainedCount+1>this.maxRetainedCount)throw RangeError(`retained lease count exceeds limit`);if(this.retainedBytes+n>this.maxRetainedBytes)throw RangeError(`retained lease bytes exceed limit`);r.set(t,n),this.leases.set(e,r),this.retainedCount++,this.retainedBytes+=n}releaseLease(e,t){let n=this.leases.get(e),r=n?.get(t);r!==void 0&&(n?.delete(t),n?.size===0&&this.leases.delete(e),this.retainedCount--,this.retainedBytes-=r)}registerCleanup(e){return this.fatal?(this.poisonRunning?this.pendingFatalCleanups.push(e):this.enqueue(e).catch(()=>void 0),()=>void 0):(this.cleanups.add(e),()=>this.cleanups.delete(e))}get fatalError(){return this.fatal}get registeredHostCount(){return this.cleanups.size}async poison(e){if(this.fatal??=e,this.poisonRunning)return this.fatal;this.poisonRunning=!0,this.pendingFatalCleanups.push(...this.cleanups);try{let e;for(;(e=this.pendingFatalCleanups.shift())!==void 0;)await e().catch(()=>void 0)}finally{this.poisonRunning=!1}return this.fatal}},Oe=class{options;coordinator;coordinatorOwner=Symbol(`pull-session-host`);unregisterCleanup;sequence=0;unacked;leases=new Map;activeDriverLeases=new Set;nextWireLeaseId;cancelRequested=!1;cancelComplete=!1;closeRequested=!1;closeComplete=!1;driverCancelComplete=!1;driverCloseComplete=!1;completed=!1;constructor(e){De(e.sessionId),A(e.operationId,`operation id`),A(e.generation,`generation`),A(e.maxByteCredit,`max byte credit`),e.wireLeaseIdStart!==void 0&&A(e.wireLeaseIdStart,`wire lease id start`),this.options=e,this.coordinator=e.coordinator,this.nextWireLeaseId=e.wireLeaseIdStart??1,this.unregisterCleanup=this.coordinator.registerCleanup(()=>this.forceFatalCleanup())}dispatch(e,t){return this.coordinator.enqueue(async()=>{let n=await this.execute(e);try{t(n.response,n.transfer)}catch(e){throw await this.rollbackFailedPost(n),e}})}async rollbackFailedPost(e){let t=e.response;if(t.kind===`chunk`){let n=t.leaseId===void 0?void 0:this.leases.get(t.leaseId);try{await this.options.driver.disposeInvalidChunk?.({payload:t.payload,byteLength:t.byteLength,done:t.done,leaseId:n?.driverLeaseId,retainedBytes:n?.retainedBytes,transfer:e.transfer})}catch{}}this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);for(let[e,t]of[...this.leases])try{await this.options.driver.releaseLease?.(t.driverLeaseId)}catch{}finally{this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e)}if(this.cancelRequested=!0,!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch{}this.unregisterCleanup()}async execute(e){try{if(this.isStaleLifecycle(e)){let t=e.kind===`cancel`?`cancel`:`close`;return this.sameOperationIdentity(e)?{response:this.accepted(e,t,!0)}:{response:this.errorResponse(e,{message:`stale lifecycle targets another session or operation`,errorName:`PullSessionProtocolError`,code:`ooxml-stale-lifecycle`})}}this.validateCommandIdentity(e);let t=this.coordinator.fatalError;if(t)return e.kind===`pull`?{response:this.errorResponse(e,t)}:(e.kind===`cancel`?await this.cancel():e.kind===`close`?await this.close():e.kind===`release`&&await this.release(e.leaseId),{response:this.accepted(e,e.kind)});switch(e.kind){case`pull`:return await this.pull(e);case`ack`:return await this.ack(e.sequence),{response:this.accepted(e,`ack`)};case`release`:return await this.release(e.leaseId),{response:this.accepted(e,`release`)};case`cancel`:return await this.cancel(),{response:this.accepted(e,`cancel`)};case`close`:return await this.close(),{response:this.accepted(e,`close`)}}}catch(t){let n=D(t);return n.code===`ooxml-resource-limit`&&(n=await this.coordinator.poison(n)),{response:this.errorResponse(e,n)}}}async pull(e){if(this.closeRequested||this.cancelRequested||this.completed)throw Error(`pull session is closed`);if(this.unacked)throw Error(`previous chunk is not acknowledged`);if(!Number.isSafeInteger(e.sequence)||e.sequence<0||e.sequence!==this.sequence)throw Error(`pull command sequence mismatch`);if(this.validateHostCredit(e.byteCredit),!this.coordinator.acquire(this.coordinatorOwner))throw Error(`another operation has an unacknowledged package chunk`);let t;try{t=await this.options.driver.pull(e.byteCredit)}catch(e){throw this.coordinator.release(this.coordinatorOwner),e}let n=!1,r=!1,i,a;try{let o=this.options.driver.measureChunk(t),s=this.arrayBufferTransferBytes(t.transfer);if(o<s)throw RangeError(`measured chunk bytes are below ArrayBuffer transfer bytes`);if(a=Math.max(o,s),t.leaseId!==void 0){if(A(t.leaseId,`lease id`),t.retainedBytes===void 0)throw Error(`retained lease bytes are required`);if(this.activeDriverLeases.has(t.leaseId))throw r=!0,Error(`driver returned an active duplicate lease id`);i=this.allocateWireLeaseId(),this.coordinator.retainLease(this.coordinatorOwner,i,t.retainedBytes),this.leases.set(i,{driverLeaseId:t.leaseId,retainedBytes:t.retainedBytes}),this.activeDriverLeases.add(t.leaseId),n=!0}else if(t.retainedBytes!==void 0)throw Error(`retained lease bytes require a lease id`);if(!Number.isSafeInteger(a)||a<0)throw RangeError(`host chunk byte length must be a non-negative safe integer`);if(a>e.byteCredit)throw RangeError(`host chunk exceeds byte credit`)}catch(e){let a;try{await this.options.driver.disposeInvalidChunk?.(t)}catch(e){a=e}if(n&&i!==void 0)try{await this.release(i)}catch(e){a??=e}else if(t.leaseId!==void 0&&!r)try{await this.options.driver.releaseLease?.(t.leaseId)}catch(e){a??=e}if(r)try{await this.cancel()}catch(e){a??=e}throw this.coordinator.release(this.coordinatorOwner),a||e}return this.unacked={sequence:this.sequence,done:t.done},{response:{kind:`chunk`,protocol:k,...this.identity(),requestId:e.requestId,sequence:this.sequence,byteLength:a,done:t.done,payload:t.payload,leaseId:i,usage:this.resourceUsage()},transfer:t.transfer}}async ack(e){if(!Number.isSafeInteger(e)||e<0)throw RangeError(`invalid ack sequence`);if(e<this.sequence)return;if(!this.unacked||e!==this.sequence)throw Error(`ack sequence mismatch`);let t=this.unacked.done;await this.options.driver.acknowledge?.(e),this.unacked=void 0,this.coordinator.release(this.coordinatorOwner),this.sequence++,t&&(this.completed=!0,this.maybeUnregisterCompleted())}async release(e){A(e,`wire lease id`);let t=this.leases.get(e);t&&(await this.options.driver.releaseLease?.(t.driverLeaseId),this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e),this.maybeUnregisterCompleted())}async cancel(){if(this.cancelComplete)return;this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.cancelComplete=!0,this.unregisterCleanup()}async close(){if(this.closeComplete)return;this.closeRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCloseComplete)try{await this.options.driver.close?.(),this.driverCloseComplete=!0}catch(t){e??=t}if(e)throw e;this.closeComplete=!0,this.unregisterCleanup()}async releaseAllLeases(){let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(e)throw e}validateCommandIdentity(e){if(e.protocol!==`ooxml-pull-v1`||e.sessionId!==this.options.sessionId||e.operationId!==this.options.operationId||e.generation!==this.options.generation||!Number.isSafeInteger(e.requestId)||e.requestId<=0)throw Error(`stale or mismatched pull session command`)}validateHostCredit(e){if(A(e,`byte credit`),e>this.options.maxByteCredit)throw RangeError(`byte credit exceeds host maximum`)}accepted(e,t,n=!1){return{kind:`accepted`,protocol:k,...n?{sessionId:e.sessionId,operationId:e.operationId,generation:e.generation}:this.identity(),requestId:e.requestId,command:t,usage:this.resourceUsage()}}identity(){return{sessionId:this.options.sessionId,operationId:this.options.operationId,generation:this.options.generation}}isStaleLifecycle(e){return(e.kind===`cancel`||e.kind===`close`)&&e.protocol===`ooxml-pull-v1`&&Number.isSafeInteger(e.requestId)&&e.requestId>0&&Number.isSafeInteger(e.generation)&&e.generation>0&&e.generation<this.options.generation}sameOperationIdentity(e){return e.sessionId===this.options.sessionId&&e.operationId===this.options.operationId}errorResponse(e,t){return{kind:`error`,protocol:k,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:t,usage:this.errorResourceUsage()}}async forceFatalCleanup(){this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.unregisterCleanup()}allocateWireLeaseId(){if(!Number.isSafeInteger(this.nextWireLeaseId)||this.nextWireLeaseId<=0)throw RangeError(`wire lease id space exhausted`);return this.nextWireLeaseId++}arrayBufferTransferBytes(e){let t=0;for(let n of e??[])if(n instanceof ArrayBuffer&&(t+=n.byteLength,!Number.isSafeInteger(t)))throw RangeError(`ArrayBuffer transfer bytes overflow`);return t}maybeUnregisterCompleted(){this.completed&&this.leases.size===0&&this.unregisterCleanup()}resourceUsage(){return this.options.driver.resourceUsage?.()}errorResourceUsage(){try{return this.resourceUsage()}catch{return}}};i();function ke(e){let t=e instanceof Error?e.message:String(e);if(!t.startsWith(`OOXML_DOCX_ILVL:`))return;let r=t.slice(16);if(r===`repair-required:level-definition`)return new n(`invalid-numbering`,`The DOCX defines a numbering level outside Word’s supported 0–8 range and requires repair.`);if(r===`cannot-open:whitespace`||r===`cannot-open:non-decimal`)return new n(`invalid-numbering`,`Word cannot open this DOCX numbering level (${r.slice(12)}).`)}function M(e){try{return ke(e)??e}catch{return e}}function Ae(e){try{return e()}catch(e){throw M(e)}}var N=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,P.unregister(this),e}free(){let e=this.__destroy_into_raw();J.__wbg_docxarchive_free(e,0)}acknowledge_document_chunk(e,t,n){let r=J.docxarchive_acknowledge_document_chunk(this.__wbg_ptr,e,t,n);if(r[1])throw U(r[0])}assert_healthy(){let e=J.docxarchive_assert_healthy(this.__wbg_ptr);if(e[1])throw U(e[0])}cancel_document_cursor(){J.docxarchive_cancel_document_cursor(this.__wbg_ptr)}close_document_session(){J.docxarchive_close_document_session(this.__wbg_ptr)}document_chunk_done(){let e=J.docxarchive_document_chunk_done(this.__wbg_ptr);if(e[2])throw U(e[1]);return e[0]!==0}document_cursor_resource_usage(){let e=J.docxarchive_document_cursor_resource_usage(this.__wbg_ptr);if(e[3])throw U(e[2]);let t;return e[0]!==0&&(t=F(e[0],e[1]).slice(),J.__wbindgen_free(e[0],e[1]*1,1)),t}extract_image(e){let t=H(e,J.__wbindgen_malloc,J.__wbindgen_realloc),n=q,r=J.docxarchive_extract_image(this.__wbg_ptr,t,n);if(r[3])throw U(r[2]);var i=F(r[0],r[1]).slice();return J.__wbindgen_free(r[0],r[1]*1,1),i}constructor(e,t,n,r){let i=Me(e,J.__wbindgen_malloc),a=q,o=J.docxarchive_new(i,a,!V(t),V(t)?BigInt(0):t,!V(n),V(n)?BigInt(0):n,!V(r),V(r)?BigInt(0):r);if(o[2])throw U(o[1]);return this.__wbg_ptr=o[0]>>>0,P.register(this,this.__wbg_ptr,this),this}open_document_cursor(e,t){let n=J.docxarchive_open_document_cursor(this.__wbg_ptr,e,t);if(n[1])throw U(n[0])}parse(){let e=J.docxarchive_parse(this.__wbg_ptr);if(e[3])throw U(e[2]);var t=F(e[0],e[1]).slice();return J.__wbindgen_free(e[0],e[1]*1,1),t}pull_document_chunk(e,t,n,r){let i=J.docxarchive_pull_document_chunk(this.__wbg_ptr,e,t,n,r);if(i[3])throw U(i[2]);var a=F(i[0],i[1]).slice();return J.__wbindgen_free(i[0],i[1]*1,1),a}resource_usage(){let e=J.docxarchive_resource_usage(this.__wbg_ptr);if(e[3])throw U(e[2]);var t=F(e[0],e[1]).slice();return J.__wbindgen_free(e[0],e[1]*1,1),t}to_markdown(){let e,t;try{let i=J.docxarchive_to_markdown(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,U(i[2]);return e=n,t=r,R(n,r)}finally{J.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(N.prototype[Symbol.dispose]=N.prototype.free);function je(){return{__proto__:null,\"./docx_parser_bg.js\":{__proto__:null,__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(R(e,t))},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(R(e,t))}finally{J.__wbindgen_free(n,r,1)}},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=H(n,J.__wbindgen_malloc,J.__wbindgen_realloc),i=q;L().setInt32(e+4,i,!0),L().setInt32(e+0,r,!0)},__wbindgen_cast_0000000000000001:function(e,t){return R(e,t)},__wbindgen_init_externref_table:function(){let e=J.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const P=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>J.__wbg_docxarchive_free(e>>>0,1));function F(e,t){return e>>>=0,B().subarray(e/1,e/1+t)}let I=null;function L(){return(I===null||I.buffer.detached===!0||I.buffer.detached===void 0&&I.buffer!==J.memory.buffer)&&(I=new DataView(J.memory.buffer)),I}function R(e,t){return e>>>=0,Ne(e,t)}let z=null;function B(){return(z===null||z.byteLength===0)&&(z=new Uint8Array(J.memory.buffer)),z}function V(e){return e==null}function Me(e,t){let n=t(e.length*1,1)>>>0;return B().set(e,n/1),q=e.length,n}function H(e,t,n){if(n===void 0){let n=K.encode(e),r=t(n.length,1)>>>0;return B().subarray(r,r+n.length).set(n),q=n.length,r}let r=e.length,i=t(r,1)>>>0,a=B(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=B().subarray(i+o,i+r),a=K.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return q=o,i}function U(e){let t=J.__wbindgen_externrefs.get(e);return J.__externref_table_dealloc(e),t}let W=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});W.decode();let G=0;function Ne(e,t){return G+=t,G>=2146435072&&(W=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),W.decode(),G=t),W.decode(B().subarray(e,e+t))}const K=new TextEncoder;`encodeInto`in K||(K.encodeInto=function(e,t){let n=K.encode(e);return t.set(n),{read:e.length,written:n.length}});let q=0,J;function Pe(e,t){return J=e.exports,I=null,z=null,J.__wbindgen_start(),J}async function Fe(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}async function Y(e){if(J!==void 0)return J;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`));let t=je();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await Fe(await e,t);return Pe(n,r)}async function Ie(e){return J=void 0,I=null,z=null,Y(e)}function Le(e){let t=e(e=>e.document_cursor_resource_usage?.());return t?y(t):void 0}const Re=67108864;var ze=class{archive;coordinator=new j;host=null;identity=null;executeArchive;constructor(e,t=e=>e(this.requireArchive())){this.archive=e,this.executeArchive=e=>Ae(()=>t(e))}open(e){if(this.host)throw Error(`a DOCX document pull session is already active`);this.executeArchive(t=>{t.open_document_cursor(e.operationId,e.generation)});let t=0;this.identity=e,this.host=new Oe({...e,maxByteCredit:Re,coordinator:this.coordinator,driver:{pull:n=>{let r;try{r=this.executeArchive(r=>r.pull_document_chunk(t,e.operationId,e.generation,n))}catch(e){throw ie(e,n,Re)||e}let i=Te(r);return{payload:i,byteLength:i.byteLength,done:this.executeArchive(e=>e.document_chunk_done()),transfer:[i]}},measureChunk:({payload:e})=>e.byteLength,acknowledge:n=>{if(n!==t)throw Error(`DOCX document acknowledgement sequence mismatch`);this.executeArchive(n=>n.acknowledge_document_chunk(t,e.operationId,e.generation)),t+=1},cancel:()=>this.executeArchive(e=>e.cancel_document_cursor()),close:()=>this.executeArchive(e=>e.close_document_session()),resourceUsage:()=>Le(this.executeArchive)}})}dispatch(e,t){return!this.host||!this.identity?(t({protocol:k,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:D(Error(`DOCX document pull session is not open`))}),Promise.resolve()):this.host.dispatch(e,t)}async reset(){if(this.host)try{this.archive()&&this.executeArchive(e=>e.close_document_session())}finally{this.host=null,this.identity=null,this.coordinator=new j}}requireArchive(){let e=this.archive();if(!e)throw Error(`No docx loaded`);return e}};function Be(e){return!!e&&typeof e==`object`&&e.protocol===`ooxml-pull-v1`}const X=new Ce(Y,{freeArchive:e=>e.free(),reinit:Ie}),Z=new ze(()=>X.archive,e=>X.run(()=>{let t=X.archive;if(!t)throw Error(`No docx loaded`);return e(t)}));let Q=0;const $=(e,t)=>self.postMessage(e,t);self.onmessage=async e=>{let n=e.data;if(Be(n)){try{await Z.dispatch(n,$)}catch(e){$({protocol:k,kind:`error`,sessionId:n.sessionId,operationId:n.operationId,generation:n.generation,requestId:n.requestId,error:D(M(e))})}return}if(n.type===`init`){X.setWasmInput(t(n.wasmUrl)??n.wasmUrl);return}let r=n.id;try{if(await X.ensureReady(),n.type!==`parse`&&X.archive){let e=X.archive;X.run(()=>e.assert_healthy())}if(n.type===`parse`){await Z.reset();let[e,t,i]=Ee(n.resourcePolicy),a=new Uint8Array(n.data);X.run(()=>{let n=new N(a,e,t,i);X.setArchive(n)}),Q+=1;let o={sessionId:Q,operationId:Q,generation:Q};Z.open(o),$({type:`documentSessionOpened`,id:r,...o});return}let e=X.archive;if(n.type===`extractImage`){if(!e)throw Error(`No docx loaded`);let t=X.run(()=>e.extract_image(n.path).buffer),i={type:`imageExtracted`,id:r,bytes:t};self.postMessage(i,[t]);return}if(n.type===`resourceUsage`){if(!e)throw Error(`No docx loaded`);$({type:`resourceUsage`,id:r,usage:y(X.run(()=>e.resource_usage()))});return}if(n.type===`toMarkdown`){if(!e)throw Error(`No docx loaded`);$({type:`markdownRendered`,id:r,markdown:X.run(()=>e.to_markdown())});return}}catch(e){$({type:`error`,id:r,...D(M(e))})}};", pn = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", fn], { type: "text/javascript;charset=utf-8" });
|
|
357
|
-
function
|
|
356
|
+
var un = "var e=(e,t)=>()=>(e&&(t=e(e=0)),t);function t(e){if(!e.startsWith(`data:`))return null;let t=e.indexOf(`,`);if(t===-1)return null;let n=atob(e.slice(t+1)),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r.buffer}var n,r,i=e((()=>{n=class e extends Error{code;details;constructor(t,n,r){super(n),this.name=`OoxmlError`,this.code=t,t===`unsupported-content`&&r&&(this.details=Object.freeze({format:r.format,reason:r.reason})),Object.setPrototypeOf(this,e.prototype)}},r=class e extends Error{code=`ooxml-resource-limit`;details;constructor(t,n){super(t),this.name=`OoxmlResourceLimitError`;let r=n.violation,i=Object.freeze({format:r.format,operation:r.operation,resource:r.resource,metric:r.metric,...r.part===void 0?{}:{part:r.part},limit:r.limit,observed:r.observed,configurable:r.configurable,usage:Object.freeze({archiveEntryCount:r.usage.archiveEntryCount,declaredInflatedBytes:r.usage.declaredInflatedBytes,...r.usage.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:r.usage.largestInflatedEntryBytes},distinctInflatedBytes:r.usage.distinctInflatedBytes,operationInflatedBytes:r.usage.operationInflatedBytes})});this.details=Object.freeze({stage:n.stage,violation:i}),Object.setPrototypeOf(this,e.prototype)}}}));function a(e){return e===`image-dimension`||e===`image-pixels`||e===`active-decoded-bytes`||e===`image-effect-count`||e===`image-effect-work`||e===`tiff-lzw-work`||e===`metafile-path-commands`||e===`metafile-record-points`||e===`metafile-record-polygons`||e===`metafile-record-rectangles`||e===`metafile-record-text-units`}function o(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function s(e){if(!(!e||typeof e!=`object`))try{let t=e,n=t.code,r=t.metric,i=t.limit,s=t.observed;return n!==`ooxml-decoded-image-limit`||!a(r)||!o(i)||!o(s)||s<=i?void 0:{metric:r,limit:i,observed:s}}catch{return}}var c,l,u,d,f,ee=e((()=>{c=1<<25,l=1<<27,c*4,l*4,u=Math.floor(c/4),d=l,d/u,f=class e extends RangeError{metric;limit;observed;code=`ooxml-decoded-image-limit`;constructor(t,n,r){super(`OOXML decoded image limit exceeded: ${t} ${r} > ${n}`),this.metric=t,this.limit=n,this.observed=r,this.name=`OoxmlDecodedImageLimitError`,Object.setPrototypeOf(this,e.prototype)}}}));function te(e){if(!(typeof e!=`object`||!e))try{let t=e,n=t.code,r=t.message;return n===`ooxml-tiff-decode`&&typeof r==`string`?{message:r}:void 0}catch{return}}var ne=e((()=>{}));function p(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function re(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return p(t.requiredBytes)&&p(t.offeredBytes)&&t.requiredBytes>t.offeredBytes}var m=class e extends RangeError{code=`ooxml-insufficient-credit`;requiredBytes;offeredBytes;constructor(t){super(`Pull unit requires ${t.requiredBytes} bytes but credit is ${t.offeredBytes}`),this.name=`PullSessionInsufficientCreditError`,this.requiredBytes=t.requiredBytes,this.offeredBytes=t.offeredBytes,Object.setPrototypeOf(this,e.prototype)}};function h(e){if(e instanceof m)return e;let t=e instanceof Error?e.message:String(e);if(!t.startsWith(`OOXML_INSUFFICIENT_CREDIT:`))return;let n;try{n=JSON.parse(t.slice(26))}catch{return}if(!n||typeof n!=`object`||Array.isArray(n))return;let r=n;if(!(r.code!==`ooxml-insufficient-credit`||!re(r)))return new m(r)}function ie(e,t,n){let r=h(e);if(!(!r||r.offeredBytes!==t||r.requiredBytes>n))return r}i(),ee(),ne();const g=`OOXML_RESOURCE_LIMIT:`;function _(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function v(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return _(t.archiveEntryCount)&&_(t.declaredInflatedBytes)&&(t.largestInflatedEntryBytes===void 0||_(t.largestInflatedEntryBytes))&&_(t.distinctInflatedBytes)&&_(t.operationInflatedBytes)}function y(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{throw TypeError(`OOXML resource usage checkpoint is not valid JSON`)}if(!v(t))throw TypeError(`OOXML resource usage checkpoint is invalid`);return t}function ae(e){return e===`docx`||e===`xlsx`||e===`pptx`}function oe(e){return e===`container`||e===`decompression`||e===`parsing`||e===`serialization`||e===`layout`||e===`rendering`||e===`worker`}function b(e,t){return typeof e==`string`&&e.length>0&&e.length<=t&&!/[\\u0000-\\u001f\\u007f]/u.test(e)}function x(e){return b(e,128)&&/^[a-z0-9][a-z0-9-]*$/u.test(e)}function se(e){return!b(e,4096)||e.startsWith(`/`)||e.startsWith(`\\\\`)||e.includes(`\\\\`)||e.includes(`?`)||e.includes(`#`)||e.includes(`://`)||/^[a-z]:/iu.test(e)?!1:e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`)}const S=new Map([[`archive-entry:declared-inflated-bytes`,{stage:`container`,part:`required`}],[`archive-entry:actual-inflated-bytes`,{stage:`decompression`,part:`required`}],[`archive:entry-count`,{stage:`container`,part:`forbidden`}],[`archive:central-directory-bytes`,{stage:`container`,part:`forbidden`,configurable:!1}],[`archive:distinct-inflated-bytes`,{stage:`decompression`,part:`required`}],[`xml-event:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`xml-context:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`image-effect:work`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:elements`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-cache:points`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`numbering-marker:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-style-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-custom-number-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-number-format-bytes:bytes`,{stage:`parsing`,part:`required`,configurable:!1}],[`xml-tree:depth`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-row:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-shell:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`theme-style-reparse:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`style-inheritance:depth`,{stage:`parsing`,part:`required`,configurable:!1}],[`complex-field:depth`,{stage:`parsing`,part:`forbidden`,configurable:!1}]]),ce=new Set([...S.keys()].map(e=>e.slice(0,e.indexOf(`:`)))),le=new Set([...S.keys()].map(e=>e.slice(e.indexOf(`:`)+1)));function ue(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return!ae(t.format)||!b(t.operation,256)||!x(t.resource)||!x(t.metric)||!_(t.limit)||!_(t.observed)||typeof t.configurable!=`boolean`||!v(t.usage)?!1:!(`part`in t)||se(t.part)}function C(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(!oe(t.stage)||!ue(t.violation))return!1;let n=t.violation,r=S.get(`${n.resource}:${n.metric}`);return r?t.stage!==r.stage||r.configurable===!1&&n.configurable!==!1?!1:r.part===`required`?n.part!==void 0:r.part===`forbidden`?n.part===void 0:!0:!(ce.has(n.resource)&&le.has(n.metric))}function de(e){return{archiveEntryCount:e.archiveEntryCount,declaredInflatedBytes:e.declaredInflatedBytes,...e.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:e.largestInflatedEntryBytes},distinctInflatedBytes:e.distinctInflatedBytes,operationInflatedBytes:e.operationInflatedBytes}}function fe(e){if(!C(e))return;let t=e.violation,n={stage:e.stage,violation:{format:t.format,operation:t.operation,resource:t.resource,metric:t.metric,...t.part===void 0?{}:{part:t.part},limit:t.limit,observed:t.observed,configurable:t.configurable,usage:de(t.usage)}};return C(n)?n:void 0}function pe(e){let t=e.violation;return`OOXML resource limit exceeded${t.part?` for ${t.part}`:``} (${t.resource}, ${e.stage}): ${t.metric} ${t.observed} > ${t.limit}`}function w(e){let t=e instanceof Error?e.message:String(e);if(!t.startsWith(g))return;let n;try{n=JSON.parse(t.slice(21))}catch{return}if(!n||typeof n!=`object`)return;let i=n;if(!(i.code!==`ooxml-resource-limit`||!C(i.details)))return new r(pe(i.details),i.details)}function me(e){try{return e()}catch(e){throw e instanceof r||typeof e!=`string`&&!(e instanceof Error)?e:w(e)??e}}function he(e){let t=e instanceof Error?e.message:String(e);if(t.startsWith(`OOXML_NOT_OOXML:`))return new n(`not-ooxml`,`This file is not an Office Open XML document: ${t.slice(16)}`)}function T(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=t.format,r=t.reason;if(!(!x(n)||r!==`source-subset`))return{format:n,reason:r}}function E(e){return new n(`unsupported-content`,`Input is outside the source’s supported subset.`,e)}function ge(e){let t=typeof e==`string`?e:e instanceof Error?e.message:``;if(!(!t.startsWith(`MODEL_SOURCE_UNSUPPORTED:`)||t.length>1024))try{let e=T(JSON.parse(t.slice(25)));return e?E(e):void 0}catch{return}}function _e(e){return e===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`||e instanceof Error&&e.message===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`?new n(`unsupported-encryption`,`The configured source cannot decrypt this input.`):ge(e)??w(e)??he(e)}function ve(e){let t=s(e);if(t){let e=new f(t.metric,t.limit,t.observed);return{message:e.message,errorName:e.name,code:e.code,decodedImage:t}}let i=te(e);if(i)return{message:i.message,errorName:`TiffDecodeError`,code:`ooxml-tiff-decode`};let a=h(e);if(a)return{message:a.message,errorName:a.name,code:a.code,insufficientCredit:{requiredBytes:a.requiredBytes,offeredBytes:a.offeredBytes}};let o=e instanceof n||e instanceof r?e:_e(e),c=o??e;if(o instanceof r||c&&typeof c==`object`&&c.code===`ooxml-resource-limit`){let e=c,t=fe(e.details);return t?{message:typeof e.message==`string`?e.message:pe(t),errorName:`OoxmlResourceLimitError`,code:`ooxml-resource-limit`,resourceLimit:t}:{message:`Invalid OOXML resource-limit error payload`,errorName:`Error`}}if(c&&typeof c==`object`&&c.code===`unsupported-content`){let e=T(c.details);return e?{message:E(e).message,code:`unsupported-content`,unsupportedContent:e}:{message:`Invalid unsupported-content error payload`,errorName:`Error`}}if(o instanceof n)return{message:typeof o.message==`string`?o.message:String(o.message),errorName:b(o.name,128)?o.name:`OoxmlError`,...x(o.code)?{code:o.code}:{}};let l=e instanceof Error?e.message:String(e);if(typeof l==`string`&&l.startsWith(g))return{message:`Invalid OOXML resource-limit payload`,errorName:`Error`};let u=e instanceof Error?e:Error(l),d=u;return{message:typeof u.message==`string`?u.message:String(u.message),errorName:b(u.name,128)?u.name:`Error`,...typeof d.code==`string`?{code:d.code}:{}}}function D(e){try{return ve(e)}catch{return{message:`Worker operation failed with an unreadable error`,errorName:`Error`}}}var ye=class{initialize;reinitialize;normalizeFailure;state=`uninitialized`;generationValue=0;readiness;poisonListeners=new Set;constructor(e,t,n){this.initialize=e,this.reinitialize=t,this.normalizeFailure=n}get generation(){return this.generationValue}get poisoned(){return this.state===`poisoned`}onPoison(e){return this.poisonListeners.add(e),()=>this.poisonListeners.delete(e)}async ensureReady(){if(this.state!==`ready`){if(!this.readiness){let e=this.state===`uninitialized`?this.initialize:this.reinitialize;this.readiness=Promise.resolve().then(e).then(()=>{this.generationValue+=1,this.state=`ready`,this.readiness=void 0},e=>{throw this.readiness=void 0,e})}await this.readiness}}run(e){try{return e()}catch(e){let t=this.normalizeFailure(e);throw t?(this.poison(t),t):e}}tryRunReady(e){if(this.state!==`ready`)return{current:!1};let t=this.generationValue,n=this.run(e);return this.state!==`ready`||t!==this.generationValue?{current:!1}:{current:!0,generation:t,value:n}}poison(e){this.state=`poisoned`,this.readiness=void 0;for(let t of this.poisonListeners)t(e)}assertCurrent(e){if(this.state!==`ready`||e!==this.generationValue)throw Error(`WASM archive session belongs to a discarded runtime generation`)}},O=class e extends Error{code=`parser-crashed`;constructor(t){super(t),this.name=`WasmTrapError`,Object.setPrototypeOf(this,e.prototype)}};function be(e){let t=globalThis.WebAssembly?.RuntimeError;return t&&e instanceof t||e instanceof RangeError?!0:e instanceof Error?e.name===`RuntimeError`||e.name===`CompileError`||e.name===`LinkError`||e.name===`InternalError`||e.name===`OOMError`:!1}function xe(e){try{if((typeof e!=`object`||!e)&&typeof e!=`function`)return;let t=Reflect.get(e,`__destroy_into_raw`);typeof t==`function`&&Reflect.apply(t,e,[])}catch{}}function Se(e,t){return e({module_or_path:t})}var Ce=class{init;options;runtime;wasmInput=null;currentArchive=null;constructor(e,t={}){this.init=e,this.options=t,this.runtime=new ye(()=>this.invokeConfigured(this.init),()=>this.invokeConfigured(this.options.reinit??this.init),we),this.runtime.onPoison(()=>this.dropPoisonedArchive())}setWasmInput(e){this.wasmInput=e,this.runtime.ensureReady().catch(()=>void 0)}setWasmUrl(e){this.setWasmInput(e)}get archive(){return this.currentArchive}setArchive(e){this.freeArchive(),this.currentArchive=e}disposeArchive(){this.freeArchive()}get poisoned(){return this.runtime.poisoned}async ensureReady(){await this.runtime.ensureReady()}run(e){return me(()=>this.runtime.run(e))}poison(){this.runtime.poison(new O(`WASM parser was recycled`))}invokeConfigured(e){return this.wasmInput===null?Promise.reject(Error(`WasmParserHost: setWasmInput was never called`)):Se(e,this.wasmInput)}freeArchive(){this.currentArchive!==null&&this.options.freeArchive&&this.options.freeArchive(this.currentArchive),this.currentArchive=null}dropPoisonedArchive(){let e=this.currentArchive;this.currentArchive=null,xe(e)}};function we(e){return be(e)?new O(`WASM parser trapped and was recycled: ${e instanceof Error?e.message:String(e)}`):null}function Te(e){return e.byteOffset===0&&e.byteLength===e.buffer.byteLength&&e.buffer instanceof ArrayBuffer?e.buffer:e.slice().buffer}Object.freeze({maxArchiveEntryBytes:134217728,maxTotalInflatedBytes:268435456,maxArchiveEntries:4096});function Ee(e){return[e.maxArchiveEntryBytes===null?0n:BigInt(e.maxArchiveEntryBytes),e.maxTotalInflatedBytes===null?0n:BigInt(e.maxTotalInflatedBytes),e.maxArchiveEntries===null?0n:BigInt(e.maxArchiveEntries)]}const k=`ooxml-pull-v1`;function A(e,t){if(!Number.isSafeInteger(e)||e<=0)throw RangeError(`${t} must be a positive safe integer`)}function De(e){if(!(typeof e==`string`&&e.length>0||typeof e==`number`&&Number.isSafeInteger(e)&&e>0))throw RangeError(`session id must be a non-empty string or positive safe integer`)}var j=class{owner;queue=Promise.resolve();leases=new Map;retainedBytes=0;retainedCount=0;maxRetainedBytes;maxRetainedCount;cleanups=new Set;pendingFatalCleanups=[];poisonRunning=!1;fatal;constructor(e){this.maxRetainedBytes=e?.maxRetainedBytes??64*1024*1024,this.maxRetainedCount=e?.maxRetainedCount??256,A(this.maxRetainedBytes,`max retained lease bytes`),A(this.maxRetainedCount,`max retained lease count`)}enqueue(e){let t=this.queue.then(e,e);return this.queue=t.then(()=>void 0,()=>void 0),t}acquire(e){return this.owner===void 0?(this.owner=e,!0):this.owner===e}release(e){this.owner===e&&(this.owner=void 0)}retainLease(e,t,n){if(!Number.isSafeInteger(n)||n<0)throw RangeError(`retained lease bytes are invalid`);let r=this.leases.get(e)??new Map;if(r.has(t))throw Error(`driver returned a duplicate lease id`);if(this.retainedCount+1>this.maxRetainedCount)throw RangeError(`retained lease count exceeds limit`);if(this.retainedBytes+n>this.maxRetainedBytes)throw RangeError(`retained lease bytes exceed limit`);r.set(t,n),this.leases.set(e,r),this.retainedCount++,this.retainedBytes+=n}releaseLease(e,t){let n=this.leases.get(e),r=n?.get(t);r!==void 0&&(n?.delete(t),n?.size===0&&this.leases.delete(e),this.retainedCount--,this.retainedBytes-=r)}registerCleanup(e){return this.fatal?(this.poisonRunning?this.pendingFatalCleanups.push(e):this.enqueue(e).catch(()=>void 0),()=>void 0):(this.cleanups.add(e),()=>this.cleanups.delete(e))}get fatalError(){return this.fatal}get registeredHostCount(){return this.cleanups.size}async poison(e){if(this.fatal??=e,this.poisonRunning)return this.fatal;this.poisonRunning=!0,this.pendingFatalCleanups.push(...this.cleanups);try{let e;for(;(e=this.pendingFatalCleanups.shift())!==void 0;)await e().catch(()=>void 0)}finally{this.poisonRunning=!1}return this.fatal}},Oe=class{options;coordinator;coordinatorOwner=Symbol(`pull-session-host`);unregisterCleanup;sequence=0;unacked;leases=new Map;activeDriverLeases=new Set;nextWireLeaseId;cancelRequested=!1;cancelComplete=!1;closeRequested=!1;closeComplete=!1;driverCancelComplete=!1;driverCloseComplete=!1;completed=!1;constructor(e){De(e.sessionId),A(e.operationId,`operation id`),A(e.generation,`generation`),A(e.maxByteCredit,`max byte credit`),e.wireLeaseIdStart!==void 0&&A(e.wireLeaseIdStart,`wire lease id start`),this.options=e,this.coordinator=e.coordinator,this.nextWireLeaseId=e.wireLeaseIdStart??1,this.unregisterCleanup=this.coordinator.registerCleanup(()=>this.forceFatalCleanup())}dispatch(e,t){return this.coordinator.enqueue(async()=>{let n=await this.execute(e);try{t(n.response,n.transfer)}catch(e){throw await this.rollbackFailedPost(n),e}})}async rollbackFailedPost(e){let t=e.response;if(t.kind===`chunk`){let n=t.leaseId===void 0?void 0:this.leases.get(t.leaseId);try{await this.options.driver.disposeInvalidChunk?.({payload:t.payload,byteLength:t.byteLength,done:t.done,leaseId:n?.driverLeaseId,retainedBytes:n?.retainedBytes,transfer:e.transfer})}catch{}}this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);for(let[e,t]of[...this.leases])try{await this.options.driver.releaseLease?.(t.driverLeaseId)}catch{}finally{this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e)}if(this.cancelRequested=!0,!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch{}this.unregisterCleanup()}async execute(e){try{if(this.isStaleLifecycle(e)){let t=e.kind===`cancel`?`cancel`:`close`;return this.sameOperationIdentity(e)?{response:this.accepted(e,t,!0)}:{response:this.errorResponse(e,{message:`stale lifecycle targets another session or operation`,errorName:`PullSessionProtocolError`,code:`ooxml-stale-lifecycle`})}}this.validateCommandIdentity(e);let t=this.coordinator.fatalError;if(t)return e.kind===`pull`?{response:this.errorResponse(e,t)}:(e.kind===`cancel`?await this.cancel():e.kind===`close`?await this.close():e.kind===`release`&&await this.release(e.leaseId),{response:this.accepted(e,e.kind)});switch(e.kind){case`pull`:return await this.pull(e);case`ack`:return await this.ack(e.sequence),{response:this.accepted(e,`ack`)};case`release`:return await this.release(e.leaseId),{response:this.accepted(e,`release`)};case`cancel`:return await this.cancel(),{response:this.accepted(e,`cancel`)};case`close`:return await this.close(),{response:this.accepted(e,`close`)}}}catch(t){let n=D(t);return n.code===`ooxml-resource-limit`&&(n=await this.coordinator.poison(n)),{response:this.errorResponse(e,n)}}}async pull(e){if(this.closeRequested||this.cancelRequested||this.completed)throw Error(`pull session is closed`);if(this.unacked)throw Error(`previous chunk is not acknowledged`);if(!Number.isSafeInteger(e.sequence)||e.sequence<0||e.sequence!==this.sequence)throw Error(`pull command sequence mismatch`);if(this.validateHostCredit(e.byteCredit),!this.coordinator.acquire(this.coordinatorOwner))throw Error(`another operation has an unacknowledged package chunk`);let t;try{t=await this.options.driver.pull(e.byteCredit)}catch(e){throw this.coordinator.release(this.coordinatorOwner),e}let n=!1,r=!1,i,a;try{let o=this.options.driver.measureChunk(t),s=this.arrayBufferTransferBytes(t.transfer);if(o<s)throw RangeError(`measured chunk bytes are below ArrayBuffer transfer bytes`);if(a=Math.max(o,s),t.leaseId!==void 0){if(A(t.leaseId,`lease id`),t.retainedBytes===void 0)throw Error(`retained lease bytes are required`);if(this.activeDriverLeases.has(t.leaseId))throw r=!0,Error(`driver returned an active duplicate lease id`);i=this.allocateWireLeaseId(),this.coordinator.retainLease(this.coordinatorOwner,i,t.retainedBytes),this.leases.set(i,{driverLeaseId:t.leaseId,retainedBytes:t.retainedBytes}),this.activeDriverLeases.add(t.leaseId),n=!0}else if(t.retainedBytes!==void 0)throw Error(`retained lease bytes require a lease id`);if(!Number.isSafeInteger(a)||a<0)throw RangeError(`host chunk byte length must be a non-negative safe integer`);if(a>e.byteCredit)throw RangeError(`host chunk exceeds byte credit`)}catch(e){let a;try{await this.options.driver.disposeInvalidChunk?.(t)}catch(e){a=e}if(n&&i!==void 0)try{await this.release(i)}catch(e){a??=e}else if(t.leaseId!==void 0&&!r)try{await this.options.driver.releaseLease?.(t.leaseId)}catch(e){a??=e}if(r)try{await this.cancel()}catch(e){a??=e}throw this.coordinator.release(this.coordinatorOwner),a||e}return this.unacked={sequence:this.sequence,done:t.done},{response:{kind:`chunk`,protocol:k,...this.identity(),requestId:e.requestId,sequence:this.sequence,byteLength:a,done:t.done,payload:t.payload,leaseId:i,usage:this.resourceUsage()},transfer:t.transfer}}async ack(e){if(!Number.isSafeInteger(e)||e<0)throw RangeError(`invalid ack sequence`);if(e<this.sequence)return;if(!this.unacked||e!==this.sequence)throw Error(`ack sequence mismatch`);let t=this.unacked.done;await this.options.driver.acknowledge?.(e),this.unacked=void 0,this.coordinator.release(this.coordinatorOwner),this.sequence++,t&&(this.completed=!0,this.maybeUnregisterCompleted())}async release(e){A(e,`wire lease id`);let t=this.leases.get(e);t&&(await this.options.driver.releaseLease?.(t.driverLeaseId),this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e),this.maybeUnregisterCompleted())}async cancel(){if(this.cancelComplete)return;this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.cancelComplete=!0,this.unregisterCleanup()}async close(){if(this.closeComplete)return;this.closeRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCloseComplete)try{await this.options.driver.close?.(),this.driverCloseComplete=!0}catch(t){e??=t}if(e)throw e;this.closeComplete=!0,this.unregisterCleanup()}async releaseAllLeases(){let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(e)throw e}validateCommandIdentity(e){if(e.protocol!==`ooxml-pull-v1`||e.sessionId!==this.options.sessionId||e.operationId!==this.options.operationId||e.generation!==this.options.generation||!Number.isSafeInteger(e.requestId)||e.requestId<=0)throw Error(`stale or mismatched pull session command`)}validateHostCredit(e){if(A(e,`byte credit`),e>this.options.maxByteCredit)throw RangeError(`byte credit exceeds host maximum`)}accepted(e,t,n=!1){return{kind:`accepted`,protocol:k,...n?{sessionId:e.sessionId,operationId:e.operationId,generation:e.generation}:this.identity(),requestId:e.requestId,command:t,usage:this.resourceUsage()}}identity(){return{sessionId:this.options.sessionId,operationId:this.options.operationId,generation:this.options.generation}}isStaleLifecycle(e){return(e.kind===`cancel`||e.kind===`close`)&&e.protocol===`ooxml-pull-v1`&&Number.isSafeInteger(e.requestId)&&e.requestId>0&&Number.isSafeInteger(e.generation)&&e.generation>0&&e.generation<this.options.generation}sameOperationIdentity(e){return e.sessionId===this.options.sessionId&&e.operationId===this.options.operationId}errorResponse(e,t){return{kind:`error`,protocol:k,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:t,usage:this.errorResourceUsage()}}async forceFatalCleanup(){this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.unregisterCleanup()}allocateWireLeaseId(){if(!Number.isSafeInteger(this.nextWireLeaseId)||this.nextWireLeaseId<=0)throw RangeError(`wire lease id space exhausted`);return this.nextWireLeaseId++}arrayBufferTransferBytes(e){let t=0;for(let n of e??[])if(n instanceof ArrayBuffer&&(t+=n.byteLength,!Number.isSafeInteger(t)))throw RangeError(`ArrayBuffer transfer bytes overflow`);return t}maybeUnregisterCompleted(){this.completed&&this.leases.size===0&&this.unregisterCleanup()}resourceUsage(){return this.options.driver.resourceUsage?.()}errorResourceUsage(){try{return this.resourceUsage()}catch{return}}};i();function ke(e){let t=e instanceof Error?e.message:String(e);if(!t.startsWith(`OOXML_DOCX_ILVL:`))return;let r=t.slice(16);if(r===`repair-required:level-definition`)return new n(`invalid-numbering`,`The DOCX defines a numbering level outside Word’s supported 0–8 range and requires repair.`);if(r===`cannot-open:whitespace`||r===`cannot-open:non-decimal`)return new n(`invalid-numbering`,`Word cannot open this DOCX numbering level (${r.slice(12)}).`)}function M(e){try{return ke(e)??e}catch{return e}}function Ae(e){try{return e()}catch(e){throw M(e)}}var N=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,P.unregister(this),e}free(){let e=this.__destroy_into_raw();J.__wbg_docxarchive_free(e,0)}acknowledge_document_chunk(e,t,n){let r=J.docxarchive_acknowledge_document_chunk(this.__wbg_ptr,e,t,n);if(r[1])throw U(r[0])}assert_healthy(){let e=J.docxarchive_assert_healthy(this.__wbg_ptr);if(e[1])throw U(e[0])}cancel_document_cursor(){J.docxarchive_cancel_document_cursor(this.__wbg_ptr)}close_document_session(){J.docxarchive_close_document_session(this.__wbg_ptr)}document_chunk_done(){let e=J.docxarchive_document_chunk_done(this.__wbg_ptr);if(e[2])throw U(e[1]);return e[0]!==0}document_cursor_resource_usage(){let e=J.docxarchive_document_cursor_resource_usage(this.__wbg_ptr);if(e[3])throw U(e[2]);let t;return e[0]!==0&&(t=F(e[0],e[1]).slice(),J.__wbindgen_free(e[0],e[1]*1,1)),t}extract_image(e){let t=H(e,J.__wbindgen_malloc,J.__wbindgen_realloc),n=q,r=J.docxarchive_extract_image(this.__wbg_ptr,t,n);if(r[3])throw U(r[2]);var i=F(r[0],r[1]).slice();return J.__wbindgen_free(r[0],r[1]*1,1),i}constructor(e,t,n,r){let i=Me(e,J.__wbindgen_malloc),a=q,o=J.docxarchive_new(i,a,!V(t),V(t)?BigInt(0):t,!V(n),V(n)?BigInt(0):n,!V(r),V(r)?BigInt(0):r);if(o[2])throw U(o[1]);return this.__wbg_ptr=o[0]>>>0,P.register(this,this.__wbg_ptr,this),this}open_document_cursor(e,t){let n=J.docxarchive_open_document_cursor(this.__wbg_ptr,e,t);if(n[1])throw U(n[0])}parse(){let e=J.docxarchive_parse(this.__wbg_ptr);if(e[3])throw U(e[2]);var t=F(e[0],e[1]).slice();return J.__wbindgen_free(e[0],e[1]*1,1),t}pull_document_chunk(e,t,n,r){let i=J.docxarchive_pull_document_chunk(this.__wbg_ptr,e,t,n,r);if(i[3])throw U(i[2]);var a=F(i[0],i[1]).slice();return J.__wbindgen_free(i[0],i[1]*1,1),a}resource_usage(){let e=J.docxarchive_resource_usage(this.__wbg_ptr);if(e[3])throw U(e[2]);var t=F(e[0],e[1]).slice();return J.__wbindgen_free(e[0],e[1]*1,1),t}to_markdown(){let e,t;try{let i=J.docxarchive_to_markdown(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,U(i[2]);return e=n,t=r,R(n,r)}finally{J.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(N.prototype[Symbol.dispose]=N.prototype.free);function je(){return{__proto__:null,\"./docx_parser_bg.js\":{__proto__:null,__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(R(e,t))},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(R(e,t))}finally{J.__wbindgen_free(n,r,1)}},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=H(n,J.__wbindgen_malloc,J.__wbindgen_realloc),i=q;L().setInt32(e+4,i,!0),L().setInt32(e+0,r,!0)},__wbindgen_cast_0000000000000001:function(e,t){return R(e,t)},__wbindgen_init_externref_table:function(){let e=J.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const P=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>J.__wbg_docxarchive_free(e>>>0,1));function F(e,t){return e>>>=0,B().subarray(e/1,e/1+t)}let I=null;function L(){return(I===null||I.buffer.detached===!0||I.buffer.detached===void 0&&I.buffer!==J.memory.buffer)&&(I=new DataView(J.memory.buffer)),I}function R(e,t){return e>>>=0,Ne(e,t)}let z=null;function B(){return(z===null||z.byteLength===0)&&(z=new Uint8Array(J.memory.buffer)),z}function V(e){return e==null}function Me(e,t){let n=t(e.length*1,1)>>>0;return B().set(e,n/1),q=e.length,n}function H(e,t,n){if(n===void 0){let n=K.encode(e),r=t(n.length,1)>>>0;return B().subarray(r,r+n.length).set(n),q=n.length,r}let r=e.length,i=t(r,1)>>>0,a=B(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=B().subarray(i+o,i+r),a=K.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return q=o,i}function U(e){let t=J.__wbindgen_externrefs.get(e);return J.__externref_table_dealloc(e),t}let W=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});W.decode();let G=0;function Ne(e,t){return G+=t,G>=2146435072&&(W=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),W.decode(),G=t),W.decode(B().subarray(e,e+t))}const K=new TextEncoder;`encodeInto`in K||(K.encodeInto=function(e,t){let n=K.encode(e);return t.set(n),{read:e.length,written:n.length}});let q=0,J;function Pe(e,t){return J=e.exports,I=null,z=null,J.__wbindgen_start(),J}async function Fe(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}async function Y(e){if(J!==void 0)return J;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`));let t=je();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await Fe(await e,t);return Pe(n,r)}async function Ie(e){return J=void 0,I=null,z=null,Y(e)}function Le(e){let t=e(e=>e.document_cursor_resource_usage?.());return t?y(t):void 0}const Re=67108864;var ze=class{archive;coordinator=new j;host=null;identity=null;executeArchive;constructor(e,t=e=>e(this.requireArchive())){this.archive=e,this.executeArchive=e=>Ae(()=>t(e))}open(e){if(this.host)throw Error(`a DOCX document pull session is already active`);this.executeArchive(t=>{t.open_document_cursor(e.operationId,e.generation)});let t=0;this.identity=e,this.host=new Oe({...e,maxByteCredit:Re,coordinator:this.coordinator,driver:{pull:n=>{let r;try{r=this.executeArchive(r=>r.pull_document_chunk(t,e.operationId,e.generation,n))}catch(e){throw ie(e,n,Re)||e}let i=Te(r);return{payload:i,byteLength:i.byteLength,done:this.executeArchive(e=>e.document_chunk_done()),transfer:[i]}},measureChunk:({payload:e})=>e.byteLength,acknowledge:n=>{if(n!==t)throw Error(`DOCX document acknowledgement sequence mismatch`);this.executeArchive(n=>n.acknowledge_document_chunk(t,e.operationId,e.generation)),t+=1},cancel:()=>this.executeArchive(e=>e.cancel_document_cursor()),close:()=>this.executeArchive(e=>e.close_document_session()),resourceUsage:()=>Le(this.executeArchive)}})}dispatch(e,t){return!this.host||!this.identity?(t({protocol:k,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:D(Error(`DOCX document pull session is not open`))}),Promise.resolve()):this.host.dispatch(e,t)}async reset(){if(this.host)try{this.archive()&&this.executeArchive(e=>e.close_document_session())}finally{this.host=null,this.identity=null,this.coordinator=new j}}requireArchive(){let e=this.archive();if(!e)throw Error(`No docx loaded`);return e}};function Be(e){return!!e&&typeof e==`object`&&e.protocol===`ooxml-pull-v1`}const X=new Ce(Y,{freeArchive:e=>e.free(),reinit:Ie}),Z=new ze(()=>X.archive,e=>X.run(()=>{let t=X.archive;if(!t)throw Error(`No docx loaded`);return e(t)}));let Q=0;const $=(e,t)=>self.postMessage(e,t);self.onmessage=async e=>{let n=e.data;if(Be(n)){try{await Z.dispatch(n,$)}catch(e){$({protocol:k,kind:`error`,sessionId:n.sessionId,operationId:n.operationId,generation:n.generation,requestId:n.requestId,error:D(M(e))})}return}if(n.type===`init`){X.setWasmInput(t(n.wasmUrl)??n.wasmUrl);return}let r=n.id;try{if(await X.ensureReady(),n.type!==`parse`&&X.archive){let e=X.archive;X.run(()=>e.assert_healthy())}if(n.type===`parse`){await Z.reset();let[e,t,i]=Ee(n.resourcePolicy),a=new Uint8Array(n.data);X.run(()=>{let n=new N(a,e,t,i);X.setArchive(n)}),Q+=1;let o={sessionId:Q,operationId:Q,generation:Q};Z.open(o),$({type:`documentSessionOpened`,id:r,...o});return}let e=X.archive;if(n.type===`extractImage`){if(!e)throw Error(`No docx loaded`);let t=X.run(()=>e.extract_image(n.path).buffer),i={type:`imageExtracted`,id:r,bytes:t};self.postMessage(i,[t]);return}if(n.type===`resourceUsage`){if(!e)throw Error(`No docx loaded`);$({type:`resourceUsage`,id:r,usage:y(X.run(()=>e.resource_usage()))});return}if(n.type===`toMarkdown`){if(!e)throw Error(`No docx loaded`);$({type:`markdownRendered`,id:r,markdown:X.run(()=>e.to_markdown())});return}}catch(e){$({type:`error`,id:r,...D(M(e))})}};", dn = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", un], { type: "text/javascript;charset=utf-8" });
|
|
357
|
+
function fn(e) {
|
|
358
358
|
let t;
|
|
359
359
|
try {
|
|
360
|
-
if (t =
|
|
360
|
+
if (t = dn && (self.URL || self.webkitURL).createObjectURL(dn), !t) throw "";
|
|
361
361
|
let n = new Worker(t, {
|
|
362
362
|
type: "module",
|
|
363
363
|
name: e?.name
|
|
@@ -366,7 +366,7 @@ function mn(e) {
|
|
|
366
366
|
(self.URL || self.webkitURL).revokeObjectURL(t);
|
|
367
367
|
}), n;
|
|
368
368
|
} catch {
|
|
369
|
-
return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
369
|
+
return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(un), {
|
|
370
370
|
type: "module",
|
|
371
371
|
name: e?.name
|
|
372
372
|
});
|
|
@@ -374,22 +374,22 @@ function mn(e) {
|
|
|
374
374
|
}
|
|
375
375
|
//#endregion
|
|
376
376
|
//#region packages/docx/src/wasm/docx_parser_bg.wasm?url
|
|
377
|
-
var
|
|
377
|
+
var pn = new URL("docx_parser_bg.wasm", import.meta.url).href;
|
|
378
378
|
//#endregion
|
|
379
379
|
//#region packages/docx/src/main-thread-fallback.ts
|
|
380
|
-
function
|
|
380
|
+
function mn(e) {
|
|
381
381
|
return e === "nativeRouteSentinels" ? "[ooxml] mode: 'worker' fell back to main-thread rendering because the worker cannot register the font probes that size absent-font lines." : "[ooxml] mode: 'worker' fell back to main-thread rendering because this document requires DOM OpenType vertical glyph selection.";
|
|
382
382
|
}
|
|
383
383
|
//#endregion
|
|
384
384
|
//#region packages/docx/src/bookmark-nav.ts
|
|
385
|
-
function
|
|
385
|
+
function hn(e) {
|
|
386
386
|
let t = /* @__PURE__ */ new Map();
|
|
387
387
|
for (let n of e.pages) for (let e of n.bookmarkStarts) e.name !== "" && !t.has(e.name) && t.set(e.name, n.pageIndex);
|
|
388
388
|
return t;
|
|
389
389
|
}
|
|
390
390
|
//#endregion
|
|
391
391
|
//#region packages/core/src/crypto/sha256.ts
|
|
392
|
-
var
|
|
392
|
+
var gn = new Uint32Array([
|
|
393
393
|
1116352408,
|
|
394
394
|
1899447441,
|
|
395
395
|
3049323471,
|
|
@@ -455,7 +455,7 @@ var vn = new Uint32Array([
|
|
|
455
455
|
3204031479,
|
|
456
456
|
3329325298
|
|
457
457
|
]);
|
|
458
|
-
function
|
|
458
|
+
function _n(e) {
|
|
459
459
|
let t = new Uint32Array([
|
|
460
460
|
1779033703,
|
|
461
461
|
3144134277,
|
|
@@ -477,7 +477,7 @@ function yn(e) {
|
|
|
477
477
|
}
|
|
478
478
|
let [r, i, s, c, l, u, d, f] = t;
|
|
479
479
|
for (let e = 0; e < 64; e++) {
|
|
480
|
-
let t = o(l, 6) ^ o(l, 11) ^ o(l, 25), a = l & u ^ ~l & d, p = f + t + a +
|
|
480
|
+
let t = o(l, 6) ^ o(l, 11) ^ o(l, 25), a = l & u ^ ~l & d, p = f + t + a + gn[e] + n[e] >>> 0, m = (o(r, 2) ^ o(r, 13) ^ o(r, 22)) + (r & i ^ r & s ^ i & s) >>> 0;
|
|
481
481
|
f = d, d = u, u = l, l = c + p >>> 0, c = s, s = i, i = r, r = p + m >>> 0;
|
|
482
482
|
}
|
|
483
483
|
t[0] = t[0] + r >>> 0, t[1] = t[1] + i >>> 0, t[2] = t[2] + s >>> 0, t[3] = t[3] + c >>> 0, t[4] = t[4] + l >>> 0, t[5] = t[5] + u >>> 0, t[6] = t[6] + d >>> 0, t[7] = t[7] + f >>> 0;
|
|
@@ -487,38 +487,38 @@ function yn(e) {
|
|
|
487
487
|
}
|
|
488
488
|
//#endregion
|
|
489
489
|
//#region packages/docx/src/embedded-fonts.ts
|
|
490
|
-
var
|
|
491
|
-
async function
|
|
490
|
+
var vn = _, yn = 64, R = 2;
|
|
491
|
+
async function bn(e, t) {
|
|
492
492
|
let n;
|
|
493
493
|
try {
|
|
494
|
-
n = globalThis.crypto?.subtle ? new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", e.slice().buffer)) :
|
|
494
|
+
n = globalThis.crypto?.subtle ? new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", e.slice().buffer)) : _n(e);
|
|
495
495
|
} catch {
|
|
496
|
-
n =
|
|
496
|
+
n = _n(e);
|
|
497
497
|
}
|
|
498
498
|
let r = Array.from(n, (e) => e.toString(16).padStart(2, "0")).join(""), i = 2166136261;
|
|
499
499
|
for (let e of t.trim().toLowerCase()) i ^= e.codePointAt(0), i = Math.imul(i, 16777619);
|
|
500
500
|
return `__ooxml_docx_embedded_${r}_${(i >>> 0).toString(16)}`;
|
|
501
501
|
}
|
|
502
|
-
async function
|
|
502
|
+
async function xn(e, t) {
|
|
503
503
|
let n = e.embeddedFonts;
|
|
504
504
|
if (!n || n.length === 0) return {
|
|
505
505
|
faces: [],
|
|
506
506
|
metrics: {},
|
|
507
507
|
routes: []
|
|
508
508
|
};
|
|
509
|
-
let
|
|
509
|
+
let r = [], a = /* @__PURE__ */ new Set();
|
|
510
510
|
for (let e of n) {
|
|
511
|
-
let t =
|
|
512
|
-
a.has(
|
|
511
|
+
let t = Sn(e.style) === "bold" ? 700 : 400, n = Cn(e.style), i = `${j(e.fontName)}:${t}:${n}`;
|
|
512
|
+
a.has(i) || (a.add(i), r.push(e));
|
|
513
513
|
}
|
|
514
|
-
let o = [], s = 0, c = Math.min(
|
|
515
|
-
for (let e = 0; e < c; e +=
|
|
516
|
-
let n =
|
|
514
|
+
let o = [], s = 0, c = Math.min(r.length, yn), u = r.length - c;
|
|
515
|
+
for (let e = 0; e < c; e += R) {
|
|
516
|
+
let n = r.slice(e, Math.min(e + R, c)), a = await Promise.all(n.map(async (e) => {
|
|
517
517
|
try {
|
|
518
518
|
return await t(e.partPath);
|
|
519
519
|
} catch (e) {
|
|
520
|
-
if (e instanceof
|
|
521
|
-
let t =
|
|
520
|
+
if (e instanceof i || ot(e)) throw e;
|
|
521
|
+
let t = l(e);
|
|
522
522
|
if (t) throw t;
|
|
523
523
|
return null;
|
|
524
524
|
}
|
|
@@ -526,21 +526,21 @@ async function Cn(e, t) {
|
|
|
526
526
|
for (let e = 0; e < n.length; e++) {
|
|
527
527
|
let t = n[e], r = a[e];
|
|
528
528
|
if (r) {
|
|
529
|
-
if (!
|
|
530
|
-
|
|
529
|
+
if (!re(r) || r.byteLength > vn - s) {
|
|
530
|
+
u++;
|
|
531
531
|
continue;
|
|
532
532
|
}
|
|
533
533
|
try {
|
|
534
|
-
let e = t.partPath.toLowerCase().endsWith(".odttf") ?
|
|
534
|
+
let e = t.partPath.toLowerCase().endsWith(".odttf") ? he(r, t.fontKey ?? "") : r, n = await bn(e, t.fontName), i = {
|
|
535
535
|
family: n,
|
|
536
536
|
bytes: e,
|
|
537
537
|
odttf: !1,
|
|
538
538
|
fontKey: "",
|
|
539
|
-
weight:
|
|
540
|
-
style:
|
|
539
|
+
weight: Sn(t.style),
|
|
540
|
+
style: Cn(t.style)
|
|
541
541
|
}, a = null;
|
|
542
542
|
try {
|
|
543
|
-
let r =
|
|
543
|
+
let r = Qt(e), o = r?.farEastCodePage == null ? null : ke({
|
|
544
544
|
...r,
|
|
545
545
|
farEastCodePage: r.farEastCodePage
|
|
546
546
|
});
|
|
@@ -578,53 +578,53 @@ async function Cn(e, t) {
|
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
|
-
let
|
|
581
|
+
let d = Object.freeze(u > 0 ? [Object.freeze({
|
|
582
582
|
code: "MISSING_RESOURCE",
|
|
583
583
|
severity: "warning",
|
|
584
|
-
message: `Skipped ${
|
|
584
|
+
message: `Skipped ${u} embedded font face(s) under the document font resource limits; fallback fonts are used`
|
|
585
585
|
})] : []), f = o;
|
|
586
586
|
if (f.length === 0) return {
|
|
587
587
|
faces: [],
|
|
588
588
|
metrics: {},
|
|
589
589
|
routes: [],
|
|
590
|
-
diagnostics:
|
|
590
|
+
diagnostics: d
|
|
591
591
|
};
|
|
592
592
|
let p = [], m = /* @__PURE__ */ new Set();
|
|
593
593
|
try {
|
|
594
|
-
for (let e = 0; e < f.length; e +=
|
|
595
|
-
let t = f.slice(e, e +
|
|
596
|
-
for (let e of await
|
|
594
|
+
for (let e = 0; e < f.length; e += R) {
|
|
595
|
+
let t = f.slice(e, e + R);
|
|
596
|
+
for (let e of await ie(t.map((e) => e.face))) m.has(e) ? E([e]) : (m.add(e), p.push(e));
|
|
597
597
|
}
|
|
598
598
|
} catch (e) {
|
|
599
|
-
throw
|
|
599
|
+
throw E(p), e;
|
|
600
600
|
}
|
|
601
601
|
let h = new Set(p.map((e) => {
|
|
602
602
|
let t = e.family.trim().replace(/^(['"])(.*)\1$/, "$2"), n = e.weight === "bold" ? 700 : Number(e.weight) || 400, r = e.style === "italic" ? "italic" : "normal";
|
|
603
|
-
return `${
|
|
603
|
+
return `${j(t)}:${n}:${r}`;
|
|
604
604
|
})), g = {}, _ = [];
|
|
605
605
|
for (let e of f) {
|
|
606
|
-
let t =
|
|
606
|
+
let t = j(e.face.family), n = e.face.weight === "bold" ? 700 : 400, r = e.face.style, i = `${t}:${n}:${r}`;
|
|
607
607
|
if (!h.has(i) || (_.push(Object.freeze(e.route)), !e.metric)) continue;
|
|
608
|
-
let a =
|
|
608
|
+
let a = j(e.route.requestedFamily);
|
|
609
609
|
g[n === 400 && r === "normal" ? a : `${a}:${n}:${r}`] = e.metric;
|
|
610
610
|
}
|
|
611
611
|
return {
|
|
612
612
|
faces: p,
|
|
613
613
|
metrics: Object.freeze(g),
|
|
614
614
|
routes: Object.freeze(_),
|
|
615
|
-
diagnostics:
|
|
615
|
+
diagnostics: d
|
|
616
616
|
};
|
|
617
617
|
}
|
|
618
|
-
function
|
|
618
|
+
function Sn(e) {
|
|
619
619
|
return e === "bold" || e === "boldItalic" ? "bold" : "normal";
|
|
620
620
|
}
|
|
621
|
-
function
|
|
621
|
+
function Cn(e) {
|
|
622
622
|
return e === "italic" || e === "boldItalic" ? "italic" : "normal";
|
|
623
623
|
}
|
|
624
624
|
//#endregion
|
|
625
625
|
//#region packages/docx/src/element-context.ts
|
|
626
|
-
var
|
|
627
|
-
function
|
|
626
|
+
var wn = gt, Tn = 16384;
|
|
627
|
+
function En(e, t) {
|
|
628
628
|
let n = [], r = 0, i = !1;
|
|
629
629
|
for (let a of e) {
|
|
630
630
|
if (a.length === 0) continue;
|
|
@@ -635,7 +635,7 @@ function On(e, t) {
|
|
|
635
635
|
}
|
|
636
636
|
n.push("\n"), r++;
|
|
637
637
|
}
|
|
638
|
-
let e =
|
|
638
|
+
let e = St(a, Math.max(0, t - r));
|
|
639
639
|
if (n.push(e), r += e.length, e.length < a.length) {
|
|
640
640
|
i = !0;
|
|
641
641
|
break;
|
|
@@ -647,7 +647,7 @@ function On(e, t) {
|
|
|
647
647
|
truncated: i
|
|
648
648
|
};
|
|
649
649
|
}
|
|
650
|
-
function*
|
|
650
|
+
function* z(e) {
|
|
651
651
|
if (e.kind === "paragraph") {
|
|
652
652
|
for (let t of e.lines) {
|
|
653
653
|
let e = t.placements.flatMap((e) => e.kind === "text" && !e.optionalHyphenGlyph ? [e.text] : []).join("");
|
|
@@ -656,46 +656,46 @@ function* L(e) {
|
|
|
656
656
|
return;
|
|
657
657
|
}
|
|
658
658
|
if (e.kind === "table") {
|
|
659
|
-
for (let t of e.rows) for (let e of t.cells) for (let t of e.blocks) yield*
|
|
659
|
+
for (let t of e.rows) for (let e of t.cells) for (let t of e.blocks) yield* z(t.layout);
|
|
660
660
|
return;
|
|
661
661
|
}
|
|
662
662
|
if (e.kind === "note") {
|
|
663
|
-
e.leading?.paragraph && (yield*
|
|
664
|
-
for (let t of e.story.blocks) yield*
|
|
665
|
-
e.trailing?.paragraph && (yield*
|
|
666
|
-
} else if (e.kind === "textbox") for (let t of e.story.blocks) yield*
|
|
663
|
+
e.leading?.paragraph && (yield* z(e.leading.paragraph));
|
|
664
|
+
for (let t of e.story.blocks) yield* z(t);
|
|
665
|
+
e.trailing?.paragraph && (yield* z(e.trailing.paragraph));
|
|
666
|
+
} else if (e.kind === "textbox") for (let t of e.story.blocks) yield* z(t);
|
|
667
667
|
}
|
|
668
|
-
function*
|
|
668
|
+
function* Dn(e) {
|
|
669
669
|
for (let t of e.drawing.commands) (t.kind === "text" || t.kind === "watermark-text") && (yield t.text);
|
|
670
|
-
for (let t of e.textBoxes) yield*
|
|
670
|
+
for (let t of e.textBoxes) yield* z(t);
|
|
671
671
|
}
|
|
672
|
-
function
|
|
673
|
-
let t = e ??
|
|
672
|
+
function On(e) {
|
|
673
|
+
let t = e ?? Tn;
|
|
674
674
|
if (!Number.isFinite(t) || t < 0) throw RangeError("maxTextCharacters must be a finite non-negative number.");
|
|
675
|
-
return Math.min(
|
|
675
|
+
return Math.min(wn, Math.floor(t));
|
|
676
676
|
}
|
|
677
|
-
function
|
|
677
|
+
function kn(e) {
|
|
678
678
|
return {
|
|
679
679
|
story: e.story,
|
|
680
680
|
storyInstance: e.storyInstance,
|
|
681
681
|
path: [...e.path]
|
|
682
682
|
};
|
|
683
683
|
}
|
|
684
|
-
function
|
|
684
|
+
function An(e) {
|
|
685
685
|
return "drawing" in e ? e.drawing.inkBounds : e.placement.bounds;
|
|
686
686
|
}
|
|
687
|
-
function
|
|
688
|
-
let t =
|
|
689
|
-
|
|
690
|
-
|
|
687
|
+
function jn(e) {
|
|
688
|
+
let t = An(e), n = [
|
|
689
|
+
O(e.pointToPage, t),
|
|
690
|
+
O(e.pointToPage, {
|
|
691
691
|
xPt: t.xPt + t.widthPt,
|
|
692
692
|
yPt: t.yPt
|
|
693
693
|
}),
|
|
694
|
-
|
|
694
|
+
O(e.pointToPage, {
|
|
695
695
|
xPt: t.xPt,
|
|
696
696
|
yPt: t.yPt + t.heightPt
|
|
697
697
|
}),
|
|
698
|
-
|
|
698
|
+
O(e.pointToPage, {
|
|
699
699
|
xPt: t.xPt + t.widthPt,
|
|
700
700
|
yPt: t.yPt + t.heightPt
|
|
701
701
|
})
|
|
@@ -707,10 +707,10 @@ function Nn(e) {
|
|
|
707
707
|
heightPt: o - i
|
|
708
708
|
};
|
|
709
709
|
}
|
|
710
|
-
function
|
|
710
|
+
function B(e, t) {
|
|
711
711
|
return t.xPt >= e.xPt && t.xPt <= e.xPt + e.widthPt && t.yPt >= e.yPt && t.yPt <= e.yPt + e.heightPt;
|
|
712
712
|
}
|
|
713
|
-
function
|
|
713
|
+
function Mn(e, t) {
|
|
714
714
|
let n = !1;
|
|
715
715
|
for (let r = 0, i = t.length - 1; r < t.length; i = r++) {
|
|
716
716
|
let a = t[r], o = t[i];
|
|
@@ -718,35 +718,35 @@ function Pn(e, t) {
|
|
|
718
718
|
}
|
|
719
719
|
return n;
|
|
720
720
|
}
|
|
721
|
-
function
|
|
722
|
-
return
|
|
721
|
+
function Nn(e, t) {
|
|
722
|
+
return B(e.inkBounds, t) ? e.clip ? e.clip.kind === "rect" ? B(e.clip.rect, t) : Mn(t, e.clip.points) : !0 : !1;
|
|
723
723
|
}
|
|
724
|
-
function
|
|
724
|
+
function Pn(e, t, n) {
|
|
725
725
|
for (let n of e.clips) {
|
|
726
|
-
let e =
|
|
727
|
-
if (!e || !
|
|
726
|
+
let e = Me(n.pointToPage, t);
|
|
727
|
+
if (!e || !B(n.bounds, e)) return !1;
|
|
728
728
|
}
|
|
729
|
-
return "drawing" in e ?
|
|
729
|
+
return "drawing" in e ? Nn(e.drawing, n) : B(e.placement.bounds, n);
|
|
730
730
|
}
|
|
731
|
-
function
|
|
731
|
+
function V(e, t) {
|
|
732
732
|
return e.commands.find((e) => e.kind === "resource" && e.resourceKind === t);
|
|
733
733
|
}
|
|
734
|
-
function
|
|
735
|
-
return
|
|
734
|
+
function Fn(e) {
|
|
735
|
+
return V(e, "chart") ? "chart" : e.commands.some((e) => e.kind === "drawingml-shape" || e.kind === "drawingml-image-fill" || e.kind === "fill-rect" || e.kind === "stroke-rect" || e.kind === "text" || e.kind === "watermark-text") ? "shape" : V(e, "image") ? "image" : null;
|
|
736
736
|
}
|
|
737
|
-
function
|
|
738
|
-
let o = "drawing" in e ?
|
|
737
|
+
function In(e, t, n, r, i, a) {
|
|
738
|
+
let o = "drawing" in e ? Fn(e.drawing) : e.placement.resourceKind;
|
|
739
739
|
if (!o) return null;
|
|
740
740
|
let s, c = !1, l, u;
|
|
741
741
|
if (o === "chart") {
|
|
742
|
-
let t = "drawing" in e ?
|
|
742
|
+
let t = "drawing" in e ? V(e.drawing, "chart").resourceKey : e.placement.resourceKey, n = i.resolve(t, "chart"), r = _t(n.model, a);
|
|
743
743
|
s = r.text, c = r.truncated, u = n.model.series.length;
|
|
744
744
|
} else if (o === "image") {
|
|
745
|
-
let t = "drawing" in e ?
|
|
745
|
+
let t = "drawing" in e ? V(e.drawing, "image").resourceKey : e.placement.resourceKey, n = i.descriptors.find((e) => e.resourceKey === t && e.kind === "image" && "mimeType" in e);
|
|
746
746
|
if (!n) throw Error(`Unknown image paint resource: ${t}`);
|
|
747
747
|
l = n.mimeType;
|
|
748
748
|
} else {
|
|
749
|
-
let t =
|
|
749
|
+
let t = En(Dn(e), a);
|
|
750
750
|
s = t.text, c = t.truncated;
|
|
751
751
|
}
|
|
752
752
|
return {
|
|
@@ -756,8 +756,8 @@ function Rn(e, t, n, r, i, a) {
|
|
|
756
756
|
elementIndex: n,
|
|
757
757
|
elementType: o,
|
|
758
758
|
point: { ...r },
|
|
759
|
-
bounds:
|
|
760
|
-
source:
|
|
759
|
+
bounds: jn(e),
|
|
760
|
+
source: kn("drawing" in e ? e.drawing.source : e.source),
|
|
761
761
|
...s === void 0 ? {} : { text: s },
|
|
762
762
|
...l === void 0 ? {} : { mimeType: l },
|
|
763
763
|
...u === void 0 ? {} : { seriesCount: u },
|
|
@@ -767,26 +767,26 @@ function Rn(e, t, n, r, i, a) {
|
|
|
767
767
|
maxTextCharacters: a
|
|
768
768
|
};
|
|
769
769
|
}
|
|
770
|
-
function
|
|
770
|
+
function Ln(e, t, n, r, i = {}) {
|
|
771
771
|
if (!Number.isFinite(n.xPt) || !Number.isFinite(n.yPt)) throw RangeError("DOCX hit-test point must contain finite page coordinates.");
|
|
772
|
-
let a =
|
|
772
|
+
let a = On(i.maxTextCharacters), o = rt(e, t);
|
|
773
773
|
for (let e = o.length - 1; e >= 0; e--) {
|
|
774
|
-
let i = o[e], s =
|
|
775
|
-
if (!s || !
|
|
776
|
-
let c =
|
|
774
|
+
let i = o[e], s = Me(i.pointToPage, n);
|
|
775
|
+
if (!s || !Pn(i, n, s)) continue;
|
|
776
|
+
let c = In(i, t, e, n, r, a);
|
|
777
777
|
if (c) return c;
|
|
778
778
|
}
|
|
779
779
|
return null;
|
|
780
780
|
}
|
|
781
|
-
function
|
|
782
|
-
return
|
|
781
|
+
function Rn(e, t, n, r) {
|
|
782
|
+
return Ln(Ie(e, {
|
|
783
783
|
currentDate: r.currentDate,
|
|
784
784
|
defaultCurrentDateMs: r.defaultCurrentDateMs,
|
|
785
785
|
showTrackedChanges: r.showTrackedChanges
|
|
786
|
-
}, t).layout, t, n,
|
|
786
|
+
}, t).layout, t, n, Ne(e), r);
|
|
787
787
|
}
|
|
788
|
-
function
|
|
789
|
-
let n =
|
|
788
|
+
function zn(e, t) {
|
|
789
|
+
let n = On(t), r = e.text === void 0 ? void 0 : St(e.text, n), i = e.truncated || e.text !== void 0 && r.length < e.text.length;
|
|
790
790
|
return {
|
|
791
791
|
...structuredClone(e),
|
|
792
792
|
...r === void 0 ? {} : { text: r },
|
|
@@ -798,7 +798,7 @@ function Vn(e, t) {
|
|
|
798
798
|
}
|
|
799
799
|
//#endregion
|
|
800
800
|
//#region packages/docx/src/review-id.ts
|
|
801
|
-
function
|
|
801
|
+
function Bn(e) {
|
|
802
802
|
if (e === void 0) return;
|
|
803
803
|
let t = e.replace(/^[\t\n\r ]+|[\t\n\r ]+$/g, "");
|
|
804
804
|
if (/^[+-]?\d+$/.test(t)) try {
|
|
@@ -809,41 +809,41 @@ function Hn(e) {
|
|
|
809
809
|
}
|
|
810
810
|
//#endregion
|
|
811
811
|
//#region packages/docx/src/comments.ts
|
|
812
|
-
function
|
|
812
|
+
function Vn(e) {
|
|
813
813
|
return Object.freeze({
|
|
814
814
|
...e,
|
|
815
815
|
path: Object.freeze([...e.path])
|
|
816
816
|
});
|
|
817
817
|
}
|
|
818
|
-
function
|
|
818
|
+
function Hn(e) {
|
|
819
819
|
return Object.freeze({
|
|
820
|
-
source:
|
|
820
|
+
source: Vn(e.source),
|
|
821
821
|
runIndex: e.boundary,
|
|
822
822
|
affinity: e.boundary < e.runCount ? "following" : "preceding"
|
|
823
823
|
});
|
|
824
824
|
}
|
|
825
|
-
function
|
|
825
|
+
function H(e, t) {
|
|
826
826
|
let n = e.runs, r = 0;
|
|
827
827
|
for (let e = 0; e < Math.min(t, n.length); e += 1) n[e]?.type !== "unavailableDrawing" && (r += 1);
|
|
828
828
|
return r;
|
|
829
829
|
}
|
|
830
|
-
function
|
|
830
|
+
function Un(e, t, n, r, i = t.boundary) {
|
|
831
831
|
return Object.freeze({
|
|
832
832
|
commentId: e,
|
|
833
|
-
source:
|
|
833
|
+
source: Vn(t.source),
|
|
834
834
|
startRunIndex: t.boundary,
|
|
835
835
|
endRunIndex: i,
|
|
836
|
-
reference:
|
|
836
|
+
reference: Hn(n),
|
|
837
837
|
...r === void 0 ? {} : { geometryFallback: Object.freeze({
|
|
838
|
-
source:
|
|
838
|
+
source: Vn(r.source),
|
|
839
839
|
sourceRunIndex: r.boundary
|
|
840
840
|
}) }
|
|
841
841
|
});
|
|
842
842
|
}
|
|
843
|
-
function
|
|
843
|
+
function Wn(e, t) {
|
|
844
844
|
let n = e.flatMap(({ paragraph: e, source: n }, r) => {
|
|
845
|
-
let i =
|
|
846
|
-
return [...t.get(
|
|
845
|
+
let i = H(e, e.runs.length);
|
|
846
|
+
return [...t.get(k(n)) ?? []].sort((e, t) => e - t).map((e) => ({
|
|
847
847
|
paragraphIndex: r,
|
|
848
848
|
source: n,
|
|
849
849
|
boundary: e,
|
|
@@ -855,31 +855,31 @@ function Kn(e, t) {
|
|
|
855
855
|
paragraphIndices: new Set(n.map(({ paragraphIndex: e }) => e))
|
|
856
856
|
};
|
|
857
857
|
}
|
|
858
|
-
function
|
|
858
|
+
function Gn(e, t) {
|
|
859
859
|
return e.paragraphIndex - t.paragraphIndex || e.boundary - t.boundary;
|
|
860
860
|
}
|
|
861
|
-
function
|
|
861
|
+
function Kn(e, t) {
|
|
862
862
|
let n = 0, r = e.length;
|
|
863
863
|
for (; n < r;) {
|
|
864
864
|
let i = n + Math.floor((r - n) / 2);
|
|
865
|
-
|
|
865
|
+
Gn(e[i], t) < 0 ? n = i + 1 : r = i;
|
|
866
866
|
}
|
|
867
867
|
return n;
|
|
868
868
|
}
|
|
869
|
-
function
|
|
869
|
+
function qn(e, t) {
|
|
870
870
|
if (t.paragraphIndices.has(e.paragraphIndex)) return;
|
|
871
|
-
let n =
|
|
872
|
-
return
|
|
871
|
+
let n = Kn(t.locations, e), r = t.locations[n], i = n > 0 ? t.locations[n - 1] : void 0;
|
|
872
|
+
return Hn(e).affinity === "following" ? r ?? i : i ?? r;
|
|
873
873
|
}
|
|
874
|
-
function
|
|
874
|
+
function Jn(e, t, n) {
|
|
875
875
|
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
|
|
876
876
|
for (let e of t) {
|
|
877
|
-
let t =
|
|
877
|
+
let t = Bn(e);
|
|
878
878
|
t === void 0 || i.has(t) || (r.has(t) ? (r.delete(t), i.add(t)) : r.set(t, e));
|
|
879
879
|
}
|
|
880
880
|
let a = /* @__PURE__ */ new Map();
|
|
881
881
|
for (let [t, { paragraph: n, source: r }] of e.entries()) for (let e of n.commentMarks ?? []) {
|
|
882
|
-
let i =
|
|
882
|
+
let i = Bn(e.id);
|
|
883
883
|
if (i === void 0) continue;
|
|
884
884
|
let o = a.get(i) ?? {
|
|
885
885
|
starts: [],
|
|
@@ -890,12 +890,12 @@ function Xn(e, t, n) {
|
|
|
890
890
|
let s = {
|
|
891
891
|
paragraphIndex: t,
|
|
892
892
|
source: r,
|
|
893
|
-
boundary:
|
|
894
|
-
runCount:
|
|
893
|
+
boundary: H(n, e.runIndex),
|
|
894
|
+
runCount: H(n, n.runs.length)
|
|
895
895
|
};
|
|
896
896
|
e.kind === "rangeStart" ? o.starts.push(s) : e.kind === "rangeEnd" ? o.ends.push(s) : e.kind === "reference" && o.references.push(s);
|
|
897
897
|
}
|
|
898
|
-
let o = [], s =
|
|
898
|
+
let o = [], s = Wn(e, n);
|
|
899
899
|
for (let [t, n] of a) {
|
|
900
900
|
let i = r.get(t);
|
|
901
901
|
if (i === void 0 || n.references.length !== 1) continue;
|
|
@@ -903,26 +903,26 @@ function Xn(e, t, n) {
|
|
|
903
903
|
if (n.starts.length > 1 || n.ends.length > 1) continue;
|
|
904
904
|
let c = n.starts.length === 1 ? n.starts[0] : void 0, l = n.ends.length === 1 ? n.ends[0] : void 0;
|
|
905
905
|
if (c && l && (c.paragraphIndex < l.paragraphIndex || c.paragraphIndex === l.paragraphIndex && c.boundary <= l.boundary)) {
|
|
906
|
-
let t =
|
|
906
|
+
let t = qn(c.paragraphIndex === l.paragraphIndex && c.boundary === l.boundary ? c : a, s);
|
|
907
907
|
for (let n = c.paragraphIndex; n <= l.paragraphIndex; n += 1) {
|
|
908
|
-
let r = e[n], s = n === c.paragraphIndex ? c.boundary : 0, u = n === l.paragraphIndex ? l.boundary :
|
|
909
|
-
o.push(
|
|
908
|
+
let r = e[n], s = n === c.paragraphIndex ? c.boundary : 0, u = n === l.paragraphIndex ? l.boundary : H(r.paragraph, r.paragraph.runs.length);
|
|
909
|
+
o.push(Un(i, {
|
|
910
910
|
paragraphIndex: n,
|
|
911
911
|
source: r.source,
|
|
912
912
|
boundary: s,
|
|
913
|
-
runCount:
|
|
913
|
+
runCount: H(r.paragraph, r.paragraph.runs.length)
|
|
914
914
|
}, a, t, Math.max(s, u)));
|
|
915
915
|
}
|
|
916
916
|
continue;
|
|
917
917
|
}
|
|
918
918
|
let u = c && n.ends.length === 0 ? c : l && n.starts.length === 0 ? l : void 0;
|
|
919
919
|
if (c && l) continue;
|
|
920
|
-
let d = u ?? a, f =
|
|
921
|
-
o.push(
|
|
920
|
+
let d = u ?? a, f = qn(d, s);
|
|
921
|
+
o.push(Un(i, d, a, f));
|
|
922
922
|
}
|
|
923
923
|
return o;
|
|
924
924
|
}
|
|
925
|
-
function
|
|
925
|
+
function Yn(e, t, n = /* @__PURE__ */ new Map()) {
|
|
926
926
|
let r = new Set(e.map(({ id: e }) => e)), i = /* @__PURE__ */ new Map();
|
|
927
927
|
for (let e of t.blocks.sources) {
|
|
928
928
|
let n = t.blocks.resolve(e);
|
|
@@ -933,21 +933,21 @@ function Zn(e, t, n = /* @__PURE__ */ new Map()) {
|
|
|
933
933
|
source: e
|
|
934
934
|
});
|
|
935
935
|
}
|
|
936
|
-
return [...i.values()].flatMap((e) =>
|
|
936
|
+
return [...i.values()].flatMap((e) => Jn(e, r, n));
|
|
937
937
|
}
|
|
938
|
-
function
|
|
938
|
+
function Xn(e, t, n = /* @__PURE__ */ new Map(), r = {}) {
|
|
939
939
|
if ((e?.length ?? 0) === 0) return [];
|
|
940
|
-
let i =
|
|
940
|
+
let i = Yn(e ?? [], t, n), a = r.completedSourceKeys;
|
|
941
941
|
return a === void 0 ? i : i.filter((e) => {
|
|
942
|
-
let t = n.get(
|
|
943
|
-
return r || i || a.has(
|
|
942
|
+
let t = n.get(k(e.source)) ?? /* @__PURE__ */ new Set(), r = e.startRunIndex < e.endRunIndex ? [...t].some((t) => t >= e.startRunIndex && t < e.endRunIndex) : t.has(e.reference.affinity === "following" ? e.startRunIndex : e.startRunIndex - 1), i = n.get(k(e.reference.source))?.has(e.reference.affinity === "following" ? e.reference.runIndex : e.reference.runIndex - 1) === !0;
|
|
943
|
+
return r || i || a.has(k(e.source)) || a.has(k(e.reference.source));
|
|
944
944
|
});
|
|
945
945
|
}
|
|
946
|
-
function
|
|
946
|
+
function U(e, t) {
|
|
947
947
|
return e !== void 0 && e.story === t.story && e.storyInstance === t.storyInstance && e.path.length === t.path.length && e.path.every((e, n) => e === t.path[n]);
|
|
948
948
|
}
|
|
949
|
-
function
|
|
950
|
-
let n = t.filter((t) => t.sourceRunIndex !== void 0 &&
|
|
949
|
+
function W(e, t) {
|
|
950
|
+
let n = t.filter((t) => t.sourceRunIndex !== void 0 && U(t.source, e.source)), r = n.filter((t) => t.sourceRunIndex >= e.startRunIndex && t.sourceRunIndex < e.endRunIndex);
|
|
951
951
|
if (r.length > 0) return r;
|
|
952
952
|
if (e.startRunIndex === e.endRunIndex && n.length > 0) {
|
|
953
953
|
let t = n.reduce((t, n) => {
|
|
@@ -959,7 +959,7 @@ function H(e, t) {
|
|
|
959
959
|
}, void 0), i = t ?? r;
|
|
960
960
|
if (i !== void 0) return n.filter((e) => e.sourceRunIndex === i);
|
|
961
961
|
}
|
|
962
|
-
let i = t.filter((t) => t.sourceRunIndex !== void 0 &&
|
|
962
|
+
let i = t.filter((t) => t.sourceRunIndex !== void 0 && U(t.source, e.reference.source)), a = i.reduce((t, n) => {
|
|
963
963
|
let r = n.sourceRunIndex;
|
|
964
964
|
return r < e.reference.runIndex ? t : t === void 0 || r < t ? r : t;
|
|
965
965
|
}, void 0), o = i.reduce((t, n) => {
|
|
@@ -968,12 +968,12 @@ function H(e, t) {
|
|
|
968
968
|
}, void 0), s = e.reference.affinity === "following" ? a ?? o : o ?? a;
|
|
969
969
|
if (s !== void 0) return i.filter((e) => e.sourceRunIndex === s);
|
|
970
970
|
let c = e.geometryFallback;
|
|
971
|
-
return c === void 0 ? [] : t.filter((e) => e.sourceRunIndex === c.sourceRunIndex &&
|
|
971
|
+
return c === void 0 ? [] : t.filter((e) => e.sourceRunIndex === c.sourceRunIndex && U(e.source, c.source));
|
|
972
972
|
}
|
|
973
|
-
function
|
|
974
|
-
return t.some((t) => t.sourceRunIndex !== void 0 &&
|
|
973
|
+
function Zn(e, t) {
|
|
974
|
+
return t.some((t) => t.sourceRunIndex !== void 0 && U(t.source, e.source) && t.sourceRunIndex >= e.startRunIndex && t.sourceRunIndex < e.endRunIndex) ? "range" : t.some((t) => U(t.source, e.source) || U(t.source, e.reference.source)) ? "point" : "fallback";
|
|
975
975
|
}
|
|
976
|
-
function
|
|
976
|
+
function Qn(e) {
|
|
977
977
|
let t = e.map((e) => {
|
|
978
978
|
let t = e.highlightBounds;
|
|
979
979
|
return {
|
|
@@ -997,7 +997,7 @@ function er(e) {
|
|
|
997
997
|
}
|
|
998
998
|
return Object.freeze(n);
|
|
999
999
|
}
|
|
1000
|
-
function
|
|
1000
|
+
function $n(e, t, n, r = {}) {
|
|
1001
1001
|
let i = new Map(e.map((e) => [e.id, e])), a = e.filter((e) => e.parentId === void 0), o = new Map(a.map((e) => [e.id, e])), s = /* @__PURE__ */ new Map(), c = new Map(a.map((e) => [e.id, e.id]));
|
|
1002
1002
|
for (let t of e) {
|
|
1003
1003
|
if (t.parentId === void 0) continue;
|
|
@@ -1016,18 +1016,18 @@ function tr(e, t, n, r = {}) {
|
|
|
1016
1016
|
s.has(n.id) || s.set(n.id, r), r.push(t);
|
|
1017
1017
|
}
|
|
1018
1018
|
let l = /* @__PURE__ */ new Set();
|
|
1019
|
-
for (let e of n) e.source && l.add(
|
|
1019
|
+
for (let e of n) e.source && l.add(k(e.source));
|
|
1020
1020
|
let u = /* @__PURE__ */ new Map();
|
|
1021
1021
|
for (let e of t) {
|
|
1022
1022
|
let t = c.get(e.commentId);
|
|
1023
|
-
if (t === void 0 || !(l.has(
|
|
1024
|
-
let r =
|
|
1023
|
+
if (t === void 0 || !(l.has(k(e.source)) || l.has(k(e.reference.source)) || e.geometryFallback !== void 0 && l.has(k(e.geometryFallback.source)))) continue;
|
|
1024
|
+
let r = W(e, n);
|
|
1025
1025
|
if (r.length === 0) continue;
|
|
1026
1026
|
let i = u.get(t) ?? [];
|
|
1027
1027
|
u.has(t) || u.set(t, i), i.push(Object.freeze({
|
|
1028
1028
|
anchor: e,
|
|
1029
|
-
kind:
|
|
1030
|
-
rects:
|
|
1029
|
+
kind: Zn(e, r),
|
|
1030
|
+
rects: Qn(r)
|
|
1031
1031
|
}));
|
|
1032
1032
|
}
|
|
1033
1033
|
return Object.freeze(a.flatMap((e) => {
|
|
@@ -1042,20 +1042,20 @@ function tr(e, t, n, r = {}) {
|
|
|
1042
1042
|
}
|
|
1043
1043
|
//#endregion
|
|
1044
1044
|
//#region packages/docx/src/revisions.ts
|
|
1045
|
-
function
|
|
1046
|
-
let t =
|
|
1045
|
+
function er(e) {
|
|
1046
|
+
let t = Bn(e.id);
|
|
1047
1047
|
return t === void 0 ? void 0 : `${e.kind}\u0000${t}`;
|
|
1048
1048
|
}
|
|
1049
|
-
function
|
|
1049
|
+
function G(e) {
|
|
1050
1050
|
return Object.freeze({
|
|
1051
1051
|
...e,
|
|
1052
1052
|
path: Object.freeze([...e.path])
|
|
1053
1053
|
});
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1055
|
+
function tr(e, t) {
|
|
1056
1056
|
return e !== void 0 && e.story === t.story && e.storyInstance === t.storyInstance && e.path.length === t.path.length && e.path.every((e, n) => e === t.path[n]);
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1058
|
+
function nr(e, t) {
|
|
1059
1059
|
let n = 0, r = e.length;
|
|
1060
1060
|
for (; n < r;) {
|
|
1061
1061
|
let i = n + Math.floor((r - n) / 2);
|
|
@@ -1063,22 +1063,22 @@ function ir(e, t) {
|
|
|
1063
1063
|
}
|
|
1064
1064
|
return n;
|
|
1065
1065
|
}
|
|
1066
|
-
function
|
|
1066
|
+
function rr(e, t) {
|
|
1067
1067
|
let n = Array(e.length), r;
|
|
1068
1068
|
for (let i = e.length - 1; i >= 0; --i) {
|
|
1069
1069
|
n[i] = r;
|
|
1070
|
-
let a = e[i], o = t.get(
|
|
1070
|
+
let a = e[i], o = t.get(k(a.source))?.[0];
|
|
1071
1071
|
o !== void 0 && (r = Object.freeze({
|
|
1072
|
-
source:
|
|
1072
|
+
source: G(a.source),
|
|
1073
1073
|
sourceRunIndex: o
|
|
1074
1074
|
}));
|
|
1075
1075
|
}
|
|
1076
1076
|
let i = Array(e.length), a;
|
|
1077
1077
|
for (let n = 0; n < e.length; n += 1) {
|
|
1078
1078
|
i[n] = a;
|
|
1079
|
-
let r = e[n], o = t.get(
|
|
1079
|
+
let r = e[n], o = t.get(k(r.source))?.at(-1);
|
|
1080
1080
|
o !== void 0 && (a = Object.freeze({
|
|
1081
|
-
source:
|
|
1081
|
+
source: G(r.source),
|
|
1082
1082
|
sourceRunIndex: o
|
|
1083
1083
|
}));
|
|
1084
1084
|
}
|
|
@@ -1087,17 +1087,17 @@ function ar(e, t) {
|
|
|
1087
1087
|
preceding: i
|
|
1088
1088
|
};
|
|
1089
1089
|
}
|
|
1090
|
-
function
|
|
1091
|
-
let o = r[e], s = i.get(
|
|
1090
|
+
function ir(e, t, n, r, i, a) {
|
|
1091
|
+
let o = r[e], s = i.get(k(o.source)) ?? [], c = s[nr(s, n)], l = s[nr(s, t) - 1], u = c ?? l;
|
|
1092
1092
|
return u === void 0 ? a.following[e] ?? a.preceding[e] : Object.freeze({
|
|
1093
|
-
source:
|
|
1093
|
+
source: G(o.source),
|
|
1094
1094
|
sourceRunIndex: u
|
|
1095
1095
|
});
|
|
1096
1096
|
}
|
|
1097
|
-
function
|
|
1097
|
+
function ar(e, t, n = /* @__PURE__ */ new Map()) {
|
|
1098
1098
|
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
|
|
1099
1099
|
e.forEach((e, t) => {
|
|
1100
|
-
let n =
|
|
1100
|
+
let n = er(e);
|
|
1101
1101
|
n === void 0 || i.has(n) || (r.has(n) ? (r.delete(n), i.add(n)) : r.set(n, t));
|
|
1102
1102
|
});
|
|
1103
1103
|
let a = t.blocks.sources.flatMap((e) => {
|
|
@@ -1107,11 +1107,11 @@ function sr(e, t, n = /* @__PURE__ */ new Map()) {
|
|
|
1107
1107
|
source: e,
|
|
1108
1108
|
runs: n.runs
|
|
1109
1109
|
}] : [];
|
|
1110
|
-
}), o = new Map([...n].map(([e, t]) => [e, Object.freeze([...t].sort((e, t) => e - t))])), s =
|
|
1110
|
+
}), o = new Map([...n].map(([e, t]) => [e, Object.freeze([...t].sort((e, t) => e - t))])), s = rr(a, o), c = [];
|
|
1111
1111
|
for (let [e, t] of a.entries()) {
|
|
1112
1112
|
let n = 0;
|
|
1113
1113
|
for (; n < t.runs.length;) {
|
|
1114
|
-
let i = t.runs[n], l = i.revision?.kind ?
|
|
1114
|
+
let i = t.runs[n], l = i.revision?.kind ? er({
|
|
1115
1115
|
kind: i.revision.kind,
|
|
1116
1116
|
id: i.revision.id
|
|
1117
1117
|
}) : void 0, u = l === void 0 ? void 0 : r.get(l);
|
|
@@ -1122,16 +1122,16 @@ function sr(e, t, n = /* @__PURE__ */ new Map()) {
|
|
|
1122
1122
|
let d = n;
|
|
1123
1123
|
for (n += 1; n < t.runs.length;) {
|
|
1124
1124
|
let e = t.runs[n].revision;
|
|
1125
|
-
if (!e?.kind ||
|
|
1125
|
+
if (!e?.kind || er({
|
|
1126
1126
|
kind: e.kind,
|
|
1127
1127
|
id: e.id
|
|
1128
1128
|
}) !== l) break;
|
|
1129
1129
|
n += 1;
|
|
1130
1130
|
}
|
|
1131
|
-
let f = n, p = o.get(
|
|
1131
|
+
let f = n, p = o.get(k(t.source)) ?? [], m = (p[nr(p, d)] ?? f) < f ? void 0 : ir(e, d, f, a, o, s);
|
|
1132
1132
|
c.push(Object.freeze({
|
|
1133
1133
|
revisionIndex: u,
|
|
1134
|
-
source:
|
|
1134
|
+
source: G(t.source),
|
|
1135
1135
|
startRunIndex: d,
|
|
1136
1136
|
endRunIndex: f,
|
|
1137
1137
|
...m === void 0 ? {} : { geometryFallback: m }
|
|
@@ -1140,26 +1140,26 @@ function sr(e, t, n = /* @__PURE__ */ new Map()) {
|
|
|
1140
1140
|
}
|
|
1141
1141
|
return c;
|
|
1142
1142
|
}
|
|
1143
|
-
function
|
|
1143
|
+
function or(e, t, n = /* @__PURE__ */ new Map(), r = {}) {
|
|
1144
1144
|
if ((e?.length ?? 0) === 0) return [];
|
|
1145
|
-
let i =
|
|
1145
|
+
let i = ar(e ?? [], t, n), a = r.completedSourceKeys;
|
|
1146
1146
|
return a === void 0 ? i : i.filter((e) => {
|
|
1147
|
-
let t = n.get(
|
|
1148
|
-
return t !== void 0 && [...t].some((t) => t >= e.startRunIndex && t < e.endRunIndex) || a.has(
|
|
1147
|
+
let t = n.get(k(e.source));
|
|
1148
|
+
return t !== void 0 && [...t].some((t) => t >= e.startRunIndex && t < e.endRunIndex) || a.has(k(e.source));
|
|
1149
1149
|
});
|
|
1150
1150
|
}
|
|
1151
|
-
function
|
|
1152
|
-
let n = t.filter((t) => t.sourceRunIndex !== void 0 &&
|
|
1151
|
+
function sr(e, t) {
|
|
1152
|
+
let n = t.filter((t) => t.sourceRunIndex !== void 0 && tr(t.source, e.source) && t.sourceRunIndex >= e.startRunIndex && t.sourceRunIndex < e.endRunIndex);
|
|
1153
1153
|
if (n.length > 0) return n;
|
|
1154
1154
|
let r = e.geometryFallback;
|
|
1155
|
-
return r === void 0 ? [] : t.filter((e) => e.sourceRunIndex === r.sourceRunIndex &&
|
|
1155
|
+
return r === void 0 ? [] : t.filter((e) => e.sourceRunIndex === r.sourceRunIndex && tr(e.source, r.source));
|
|
1156
1156
|
}
|
|
1157
1157
|
//#endregion
|
|
1158
1158
|
//#region packages/docx/src/layout/progressive.ts
|
|
1159
|
-
var
|
|
1160
|
-
async function
|
|
1159
|
+
var cr = 12;
|
|
1160
|
+
async function lr(e, t, n, r = {}) {
|
|
1161
1161
|
let { onPreview: i, scheduler: a } = r;
|
|
1162
|
-
return
|
|
1162
|
+
return Ue(it(e, t, n, i && e.sequence.length > cr ? { onPages: (e, t) => {
|
|
1163
1163
|
i(Object.freeze({
|
|
1164
1164
|
layout: e,
|
|
1165
1165
|
exact: !1,
|
|
@@ -1169,10 +1169,10 @@ async function dr(e, t, n, r = {}) {
|
|
|
1169
1169
|
}
|
|
1170
1170
|
//#endregion
|
|
1171
1171
|
//#region packages/docx/src/document-layout-events.ts
|
|
1172
|
-
var
|
|
1173
|
-
function
|
|
1172
|
+
var K = /* @__PURE__ */ new WeakMap();
|
|
1173
|
+
function q(e, t) {
|
|
1174
1174
|
let n = Object.freeze({ ...t });
|
|
1175
|
-
for (let t of [...
|
|
1175
|
+
for (let t of [...K.get(e) ?? []]) try {
|
|
1176
1176
|
t.notify(n);
|
|
1177
1177
|
} catch (e) {
|
|
1178
1178
|
try {
|
|
@@ -1180,9 +1180,9 @@ function G(e, t) {
|
|
|
1180
1180
|
} catch {}
|
|
1181
1181
|
}
|
|
1182
1182
|
}
|
|
1183
|
-
function
|
|
1184
|
-
let i =
|
|
1185
|
-
i || (i = /* @__PURE__ */ new Set(),
|
|
1183
|
+
function ur(e, t, n, r) {
|
|
1184
|
+
let i = K.get(e);
|
|
1185
|
+
i || (i = /* @__PURE__ */ new Set(), K.set(e, i));
|
|
1186
1186
|
let a = Object.freeze({
|
|
1187
1187
|
notify: n,
|
|
1188
1188
|
report: r
|
|
@@ -1196,65 +1196,65 @@ function fr(e, t, n, r) {
|
|
|
1196
1196
|
} catch {}
|
|
1197
1197
|
}
|
|
1198
1198
|
return () => {
|
|
1199
|
-
i?.delete(a), i?.size === 0 &&
|
|
1199
|
+
i?.delete(a), i?.size === 0 && K.delete(e);
|
|
1200
1200
|
};
|
|
1201
1201
|
}
|
|
1202
1202
|
//#endregion
|
|
1203
1203
|
//#region packages/docx/src/layout/unchanged-pages.ts
|
|
1204
|
-
function
|
|
1204
|
+
function dr(e, t) {
|
|
1205
1205
|
if (!e) return 0;
|
|
1206
1206
|
let n = Math.min(e.length, t.length), r = 0;
|
|
1207
|
-
for (; r < n &&
|
|
1207
|
+
for (; r < n && fr(e[r], t[r]);) r += 1;
|
|
1208
1208
|
return r;
|
|
1209
1209
|
}
|
|
1210
|
-
function
|
|
1210
|
+
function fr(e, t) {
|
|
1211
1211
|
if (e === t) return !0;
|
|
1212
1212
|
if (typeof e != "object" || typeof t != "object" || e === null || t === null) return !1;
|
|
1213
1213
|
if (Array.isArray(e)) {
|
|
1214
1214
|
if (!Array.isArray(t) || e.length !== t.length) return !1;
|
|
1215
|
-
for (let n = 0; n < e.length; n += 1) if (!
|
|
1215
|
+
for (let n = 0; n < e.length; n += 1) if (!fr(e[n], t[n])) return !1;
|
|
1216
1216
|
return !0;
|
|
1217
1217
|
}
|
|
1218
1218
|
if (Array.isArray(t)) return !1;
|
|
1219
1219
|
let n = Object.keys(e);
|
|
1220
1220
|
if (n.length !== Object.keys(t).length) return !1;
|
|
1221
|
-
for (let r of n) if (!Object.prototype.hasOwnProperty.call(t, r) || !
|
|
1221
|
+
for (let r of n) if (!Object.prototype.hasOwnProperty.call(t, r) || !fr(e[r], t[r])) return !1;
|
|
1222
1222
|
return !0;
|
|
1223
1223
|
}
|
|
1224
1224
|
//#endregion
|
|
1225
1225
|
//#region packages/docx/src/document-layout-view.ts
|
|
1226
|
-
var
|
|
1227
|
-
function
|
|
1228
|
-
let t =
|
|
1226
|
+
var J = /* @__PURE__ */ new WeakMap(), pr = /* @__PURE__ */ new WeakMap(), mr = Symbol("docxLayoutViewRequester");
|
|
1227
|
+
function Y(e) {
|
|
1228
|
+
let t = A(e), n = t.activeLayoutOptions;
|
|
1229
1229
|
return {
|
|
1230
1230
|
showTrackedChanges: n?.showTrackedChanges === !0,
|
|
1231
1231
|
currentDate: n?.currentDateMs ?? t.defaultCurrentDateMs
|
|
1232
1232
|
};
|
|
1233
1233
|
}
|
|
1234
|
-
async function
|
|
1235
|
-
let r =
|
|
1234
|
+
async function X(e, t, n) {
|
|
1235
|
+
let r = A(e), i = M(t.currentDate, r.defaultCurrentDateMs, t.showTrackedChanges === !0), a = Object.freeze({
|
|
1236
1236
|
showTrackedChanges: i.showTrackedChanges === !0,
|
|
1237
1237
|
currentDate: i.currentDateMs
|
|
1238
1238
|
}), o = {
|
|
1239
1239
|
showTrackedChanges: a.showTrackedChanges,
|
|
1240
1240
|
currentDate: a.currentDate,
|
|
1241
|
-
[
|
|
1241
|
+
[mr]: n
|
|
1242
1242
|
};
|
|
1243
1243
|
await e.setLayoutView(o);
|
|
1244
|
-
let s =
|
|
1244
|
+
let s = Y(e);
|
|
1245
1245
|
return s.currentDate === a.currentDate && s.showTrackedChanges === a.showTrackedChanges;
|
|
1246
1246
|
}
|
|
1247
|
-
async function
|
|
1247
|
+
async function hr(e, t, n, r, i) {
|
|
1248
1248
|
let a = !1, o = () => {
|
|
1249
1249
|
a || (a = !0, e.destroy());
|
|
1250
1250
|
};
|
|
1251
1251
|
try {
|
|
1252
1252
|
for (; !t.aborted;) {
|
|
1253
1253
|
let a = n();
|
|
1254
|
-
if (a === void 0 ||
|
|
1254
|
+
if (a === void 0 || Y(e).showTrackedChanges === a) break;
|
|
1255
1255
|
t.addEventListener("abort", o, { once: !0 });
|
|
1256
1256
|
try {
|
|
1257
|
-
await
|
|
1257
|
+
await X(e, {
|
|
1258
1258
|
showTrackedChanges: a,
|
|
1259
1259
|
currentDate: r()
|
|
1260
1260
|
}, i);
|
|
@@ -1266,15 +1266,15 @@ async function _r(e, t, n, r, i) {
|
|
|
1266
1266
|
throw o(), e;
|
|
1267
1267
|
}
|
|
1268
1268
|
}
|
|
1269
|
-
function
|
|
1270
|
-
let n = Object.freeze({ ...
|
|
1271
|
-
|
|
1269
|
+
function gr(e, t) {
|
|
1270
|
+
let n = Object.freeze({ ...Y(e) }), r = (pr.get(e) ?? 0) + 1;
|
|
1271
|
+
pr.set(e, r);
|
|
1272
1272
|
let i = Object.freeze({
|
|
1273
1273
|
view: n,
|
|
1274
1274
|
generation: r,
|
|
1275
1275
|
requester: t
|
|
1276
1276
|
});
|
|
1277
|
-
for (let t of [...
|
|
1277
|
+
for (let t of [...J.get(e) ?? []]) try {
|
|
1278
1278
|
t.notify(i);
|
|
1279
1279
|
} catch (e) {
|
|
1280
1280
|
try {
|
|
@@ -1282,39 +1282,39 @@ function vr(e, t) {
|
|
|
1282
1282
|
} catch {}
|
|
1283
1283
|
}
|
|
1284
1284
|
}
|
|
1285
|
-
function
|
|
1286
|
-
let r =
|
|
1287
|
-
r || (r = /* @__PURE__ */ new Set(),
|
|
1285
|
+
function _r(e, t, n) {
|
|
1286
|
+
let r = J.get(e);
|
|
1287
|
+
r || (r = /* @__PURE__ */ new Set(), J.set(e, r));
|
|
1288
1288
|
let i = Object.freeze({
|
|
1289
1289
|
notify: t,
|
|
1290
1290
|
report: n
|
|
1291
1291
|
});
|
|
1292
1292
|
return r.add(i), () => {
|
|
1293
|
-
r?.delete(i), r?.size === 0 &&
|
|
1293
|
+
r?.delete(i), r?.size === 0 && J.delete(e);
|
|
1294
1294
|
};
|
|
1295
1295
|
}
|
|
1296
1296
|
//#endregion
|
|
1297
1297
|
//#region packages/docx/src/document.ts
|
|
1298
|
-
var
|
|
1299
|
-
function
|
|
1298
|
+
var vr = Symbol("docxViewerLoadSignal");
|
|
1299
|
+
function yr(e, t) {
|
|
1300
1300
|
return e !== null && e.currentDateMs === t.currentDateMs && e.showTrackedChanges === !0 == (t.showTrackedChanges === !0);
|
|
1301
1301
|
}
|
|
1302
|
-
var
|
|
1302
|
+
var br = Object.freeze([]), xr = Object.freeze([]), Sr = Object.freeze({
|
|
1303
1303
|
comments: Object.freeze([]),
|
|
1304
1304
|
revisions: Object.freeze([])
|
|
1305
1305
|
});
|
|
1306
|
-
function
|
|
1307
|
-
return
|
|
1306
|
+
function Z(e, t) {
|
|
1307
|
+
return Pe({
|
|
1308
1308
|
comments: e,
|
|
1309
1309
|
revisions: t
|
|
1310
1310
|
}, "DOCX review metadata");
|
|
1311
1311
|
}
|
|
1312
|
-
var
|
|
1312
|
+
var Q = class e {
|
|
1313
1313
|
get diagnostics() {
|
|
1314
|
-
return
|
|
1314
|
+
return Pe([
|
|
1315
1315
|
...this._mode === "worker" ? this._meta?.diagnostics ?? [] : this._getLayout()?.diagnostics ?? [],
|
|
1316
1316
|
...this._meta?.resourceDiagnostics ?? [],
|
|
1317
|
-
...
|
|
1317
|
+
...ln(this)
|
|
1318
1318
|
], "DOCX diagnostics");
|
|
1319
1319
|
}
|
|
1320
1320
|
_metrics = null;
|
|
@@ -1323,9 +1323,9 @@ var X = class e {
|
|
|
1323
1323
|
_document = null;
|
|
1324
1324
|
_source = null;
|
|
1325
1325
|
_meta = null;
|
|
1326
|
-
_review =
|
|
1327
|
-
_layoutLifecycle = new
|
|
1328
|
-
_layoutObservers = new
|
|
1326
|
+
_review = Sr;
|
|
1327
|
+
_layoutLifecycle = new ae();
|
|
1328
|
+
_layoutObservers = new De();
|
|
1329
1329
|
_layoutCompletion = null;
|
|
1330
1330
|
_layoutAbort = null;
|
|
1331
1331
|
_bookmarkPages = null;
|
|
@@ -1344,9 +1344,9 @@ var X = class e {
|
|
|
1344
1344
|
_tiff;
|
|
1345
1345
|
_worker;
|
|
1346
1346
|
_bridge;
|
|
1347
|
-
_rawParts = new
|
|
1347
|
+
_rawParts = new S({
|
|
1348
1348
|
maxEntries: 64,
|
|
1349
|
-
maxBytes:
|
|
1349
|
+
maxBytes: _
|
|
1350
1350
|
});
|
|
1351
1351
|
_embeddedFontFaces = [];
|
|
1352
1352
|
_officeFontFaces = [];
|
|
@@ -1356,11 +1356,11 @@ var X = class e {
|
|
|
1356
1356
|
_googleFontFaces = [];
|
|
1357
1357
|
_fetchImage = (e, t) => this.getImage(e, t);
|
|
1358
1358
|
constructor(e, t, n, r) {
|
|
1359
|
-
this._worker = e, this._mode = t,
|
|
1359
|
+
this._worker = e, this._mode = t, Fe(this, n), this._bridge = new dt(this._worker, {
|
|
1360
1360
|
correlate: (e) => "protocol" in e && e.protocol === "ooxml-pull-v1" ? e.requestId : "id" in e ? e.id : void 0,
|
|
1361
1361
|
onUnsolicited: (e) => this._onWorkerLayoutPush(e),
|
|
1362
1362
|
toError: (e) => {
|
|
1363
|
-
if (!("protocol" in e || e.type !== "error")) return Object.assign(
|
|
1363
|
+
if (!("protocol" in e || e.type !== "error")) return Object.assign(p(e), {
|
|
1364
1364
|
...e.reason === void 0 ? {} : { reason: e.reason },
|
|
1365
1365
|
...e.outgoingColumnIndex === void 0 ? {} : { outgoingColumnIndex: e.outgoingColumnIndex },
|
|
1366
1366
|
...e.outgoingColumnCount === void 0 ? {} : { outgoingColumnCount: e.outgoingColumnCount },
|
|
@@ -1368,126 +1368,126 @@ var X = class e {
|
|
|
1368
1368
|
});
|
|
1369
1369
|
}
|
|
1370
1370
|
});
|
|
1371
|
-
let i = new URL(r ??
|
|
1371
|
+
let i = new URL(r ?? pn, location.href).href;
|
|
1372
1372
|
this._bridge.post({
|
|
1373
1373
|
type: "init",
|
|
1374
1374
|
wasmUrl: i
|
|
1375
1375
|
});
|
|
1376
1376
|
}
|
|
1377
1377
|
static async load(t, n = {}) {
|
|
1378
|
-
let r = n[
|
|
1379
|
-
if (
|
|
1378
|
+
let r = n[vr], i = r?.signal, l = () => {
|
|
1379
|
+
if (i?.aborted) throw new N();
|
|
1380
1380
|
};
|
|
1381
|
-
if (
|
|
1382
|
-
let { loadDocxModelSource: e } = await import("./document-model-source-
|
|
1383
|
-
if (
|
|
1384
|
-
return
|
|
1381
|
+
if (l(), n.legacyDoc !== void 0) {
|
|
1382
|
+
let { loadDocxModelSource: e } = await import("./document-model-source-BD2VSd2L.js"), a = await e(t, n, r);
|
|
1383
|
+
if (i?.aborted) throw a.destroy(), new N();
|
|
1384
|
+
return a;
|
|
1385
1385
|
}
|
|
1386
|
-
let
|
|
1386
|
+
let u = b(n.cjkFallback), p = d(n), h = Date.now(), g = n.mode ?? "main", _ = new y({
|
|
1387
1387
|
enabled: !0,
|
|
1388
1388
|
format: "docx",
|
|
1389
1389
|
mode: g,
|
|
1390
|
-
policy:
|
|
1391
|
-
onMetrics:
|
|
1392
|
-
emitToConsole:
|
|
1390
|
+
policy: p.policy,
|
|
1391
|
+
onMetrics: p.onResourceMetrics,
|
|
1392
|
+
emitToConsole: p.debug
|
|
1393
1393
|
});
|
|
1394
1394
|
try {
|
|
1395
1395
|
if (g === "worker" && (typeof Worker > "u" || typeof OffscreenCanvas > "u")) throw Error("mode: 'worker' requires Worker and OffscreenCanvas support");
|
|
1396
|
-
let
|
|
1396
|
+
let d;
|
|
1397
1397
|
if (typeof t == "string") {
|
|
1398
|
-
let e = await fetch(t, { signal:
|
|
1398
|
+
let e = await fetch(t, { signal: i });
|
|
1399
1399
|
if (!e.ok) throw Error(`Failed to fetch: ${e.status} ${e.statusText}`);
|
|
1400
|
-
|
|
1401
|
-
} else
|
|
1402
|
-
|
|
1403
|
-
let
|
|
1404
|
-
|
|
1400
|
+
d = await e.arrayBuffer();
|
|
1401
|
+
} else d = t;
|
|
1402
|
+
l(), d = a(await o(d, n.password)), l(), _.setSourceBytes(d.byteLength), _.checkpoint("container ready");
|
|
1403
|
+
let v = g === "worker" ? (await import("./render-worker-host-Cz224I38.js")).createRenderWorker() : new fn(), y = g === "worker" ? jt(n) : void 0, b = g === "worker" && !!n.progressiveLayout, x, S = !1, C = () => {
|
|
1404
|
+
S || !x || (S = !0, x.destroy());
|
|
1405
1405
|
};
|
|
1406
1406
|
try {
|
|
1407
|
-
|
|
1408
|
-
let t =
|
|
1409
|
-
t.activeLayoutOptions =
|
|
1407
|
+
x = new e(v, g, h, n.wasmUrl), i?.addEventListener("abort", C, { once: !0 }), l(), x._metrics = _, x._cjkFallback = u, x._allowFootnoteContinuation = n.allowFootnoteContinuation !== !1;
|
|
1408
|
+
let t = A(x), a = M(n.currentDate, t.defaultCurrentDateMs, n.showTrackedChanges === !0);
|
|
1409
|
+
t.activeLayoutOptions = a, await x._parse(d, p.policy, g === "worker" ? !!n.useGoogleFonts : !1, n.workerTimeoutMs, (e) => _.observeUsage(e), y, b ? {
|
|
1410
1410
|
onPartial: n.onLayoutPartial,
|
|
1411
1411
|
onComplete: n.onLayoutComplete,
|
|
1412
1412
|
onProgress: n.onLayoutProgress,
|
|
1413
|
-
layoutOptions:
|
|
1413
|
+
layoutOptions: a,
|
|
1414
1414
|
abort: new AbortController(),
|
|
1415
|
-
firstPublication:
|
|
1415
|
+
firstPublication: ce(),
|
|
1416
1416
|
published: !1,
|
|
1417
1417
|
settled: !1
|
|
1418
|
-
} : void 0),
|
|
1419
|
-
let
|
|
1418
|
+
} : void 0), l(), g === "worker" && x._mode === "main" && (_.setMode("main"), console.warn(mn(x._mainThreadFallbackReason))), n.math && x._mode === "worker" && !y?.math && console.warn("[ooxml] a custom math renderer cannot cross the worker boundary; equations will be skipped in mode: 'worker'. Use the math renderer from @silurus/ooxml/math."), n.threeD && x._mode === "worker" && !y?.threeD && console.warn("[ooxml] a custom 3-D chart renderer cannot cross the worker boundary; charts use their 2-D family fallback in mode: 'worker'. Use the renderer from @silurus/ooxml/three-d."), x._threeD = x._mode === "worker" ? void 0 : n.threeD, n.regionMap && x._mode === "worker" && !y?.regionMap && console.warn("[ooxml] a custom Region Map renderer cannot cross the worker boundary; geospatial charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/region-map."), x._regionMap = x._mode === "worker" ? void 0 : n.regionMap, n.chartEx && x._mode === "worker" && !y?.chartEx && console.warn("[ooxml] a custom ChartEx renderer cannot cross the worker boundary; ChartEx charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/chart-ex."), x._chartEx = x._mode === "worker" ? void 0 : n.chartEx, n.tiff && x._mode === "worker" && !y?.tiff && console.warn("[ooxml] a custom TIFF codec cannot cross the worker boundary; recognized TIFF images will use an unavailable-image placeholder in mode: 'worker'. Use the codec from @silurus/ooxml/tiff to display them."), x._tiff = x._mode === "worker" ? void 0 : n.tiff;
|
|
1419
|
+
let o, S, ee = x, te = x._mode === "main" && x._document && x._source ? Ke(tt(x._source, x._document, {
|
|
1420
1420
|
useGoogleFonts: !!n.useGoogleFonts,
|
|
1421
|
-
cjkFallback:
|
|
1422
|
-
}), !0).then((e) =>
|
|
1423
|
-
if (
|
|
1424
|
-
let e =
|
|
1425
|
-
if (
|
|
1426
|
-
|
|
1421
|
+
cjkFallback: u
|
|
1422
|
+
}), !0).then((e) => ee._nativeRouteFacesReleased ? (m(e.faces), null) : (ee._nativeRouteFaces.push(...e.faces), e), () => null) : null;
|
|
1423
|
+
if (x._mode === "main" && x._document?.embeddedFonts?.length) {
|
|
1424
|
+
let e = x, t = await xn(x._document, (t) => e.getFontBytes(t));
|
|
1425
|
+
if (i?.aborted) throw E(t.faces), new N();
|
|
1426
|
+
L(x, t.diagnostics), x._embeddedFontFaces = t.faces, o = t.metrics, S = t.routes;
|
|
1427
1427
|
}
|
|
1428
|
-
let
|
|
1428
|
+
let w = x._mode === "main" && x._document ? await sn(Qe(x._document, {
|
|
1429
1429
|
useGoogleFonts: n.useGoogleFonts,
|
|
1430
|
-
cjkFallback:
|
|
1431
|
-
}).filter((e) => e.presenceOnly || !
|
|
1430
|
+
cjkFallback: u
|
|
1431
|
+
}).filter((e) => e.presenceOnly || !S?.some((t) => t.requestedFamily.toLowerCase() === e.family.toLowerCase() && t.weight === (e.weight ?? 400) && t.style === (e.style ?? "normal")))) : {
|
|
1432
1432
|
faces: [],
|
|
1433
1433
|
routes: {}
|
|
1434
1434
|
};
|
|
1435
|
-
if (
|
|
1436
|
-
|
|
1437
|
-
let
|
|
1438
|
-
if (
|
|
1439
|
-
let e =
|
|
1440
|
-
|
|
1441
|
-
let t = await
|
|
1442
|
-
if (
|
|
1443
|
-
|
|
1435
|
+
if (i?.aborted) throw m(w.faces), new N();
|
|
1436
|
+
x._officeFontFaces = w.faces;
|
|
1437
|
+
let ne = [];
|
|
1438
|
+
if (x._mode === "main" && n.useGoogleFonts && x._document) {
|
|
1439
|
+
let e = Ge(x._document, u, w);
|
|
1440
|
+
ne = e.installedSubstituteFamilies;
|
|
1441
|
+
let t = await s(e.names, Ve);
|
|
1442
|
+
if (i?.aborted) throw f(t), new N();
|
|
1443
|
+
x._googleFontFaces = t;
|
|
1444
1444
|
}
|
|
1445
|
-
let
|
|
1446
|
-
if (
|
|
1447
|
-
let e =
|
|
1448
|
-
allowFootnoteContinuation:
|
|
1449
|
-
fontMetrics:
|
|
1445
|
+
let T;
|
|
1446
|
+
if (x._mode === "main" && n.math && x._document && Ze(x._document) && (T = await $e(x._document, n.math)), l(), x._mode === "main" && x._document && x._source) {
|
|
1447
|
+
let e = x, t = A(x), a = {
|
|
1448
|
+
allowFootnoteContinuation: x._allowFootnoteContinuation,
|
|
1449
|
+
fontMetrics: o,
|
|
1450
1450
|
useGoogleFonts: !!n.useGoogleFonts,
|
|
1451
|
-
cjkFallback:
|
|
1452
|
-
embeddedRoutes:
|
|
1453
|
-
officeRoutes: Object.values(
|
|
1454
|
-
googleFaces:
|
|
1455
|
-
installedSubstituteFamilies:
|
|
1456
|
-
installedFamilies: "installed" in
|
|
1457
|
-
mathResources:
|
|
1458
|
-
mathDrawables:
|
|
1459
|
-
},
|
|
1460
|
-
|
|
1461
|
-
...
|
|
1462
|
-
nativeRouteMetrics:
|
|
1451
|
+
cjkFallback: u,
|
|
1452
|
+
embeddedRoutes: S,
|
|
1453
|
+
officeRoutes: Object.values(w.routes),
|
|
1454
|
+
googleFaces: x._googleFontFaces,
|
|
1455
|
+
installedSubstituteFamilies: ne,
|
|
1456
|
+
installedFamilies: "installed" in w ? w.installed : void 0,
|
|
1457
|
+
mathResources: T?.records,
|
|
1458
|
+
mathDrawables: T?.drawables
|
|
1459
|
+
}, s = await te;
|
|
1460
|
+
l(), t.services = Je(x._source, {
|
|
1461
|
+
...a,
|
|
1462
|
+
nativeRouteMetrics: s && s.faces.length > 0 ? Ye(s.lines, c()) : void 0
|
|
1463
1463
|
});
|
|
1464
|
-
let
|
|
1465
|
-
if (!
|
|
1466
|
-
let
|
|
1467
|
-
if (
|
|
1468
|
-
let e =
|
|
1464
|
+
let d = t.services, f = He(x._source, d, t.defaultCurrentDateMs), p = x._source.fatalParse === null, m = t.activeLayoutOptions;
|
|
1465
|
+
if (!m) throw Error("Active layout view was not recorded at load");
|
|
1466
|
+
let h = { onProgress: n.onLayoutProgress ? (t) => e._layoutObservers.notify("onLayoutProgress", n.onLayoutProgress, { committedUnits: t }) : void 0 };
|
|
1467
|
+
if (p && n.progressiveLayout) {
|
|
1468
|
+
let e = f.layoutVariants, t = x, r = new AbortController();
|
|
1469
1469
|
t._layoutAbort = r;
|
|
1470
|
-
let i =
|
|
1471
|
-
t._layoutCompletion =
|
|
1470
|
+
let i = ce(), a = null, o = !0;
|
|
1471
|
+
t._layoutCompletion = lr(x._source.bodyLayoutInput, d, m, {
|
|
1472
1472
|
scheduler: {
|
|
1473
|
-
...
|
|
1473
|
+
...h,
|
|
1474
1474
|
signal: r.signal
|
|
1475
1475
|
},
|
|
1476
1476
|
onPreview: (r) => {
|
|
1477
1477
|
if (!o) return;
|
|
1478
|
-
let s = a === null, c =
|
|
1478
|
+
let s = a === null, c = dr(a?.pages, r.layout.pages), l = t._replaceMainLayoutPublication(e, m, a, r.layout);
|
|
1479
1479
|
if (l === null) {
|
|
1480
1480
|
o = !1;
|
|
1481
1481
|
return;
|
|
1482
1482
|
}
|
|
1483
|
-
if (a = l, s) t._layoutLifecycle.begin(),
|
|
1483
|
+
if (a = l, s) t._layoutLifecycle.begin(), q(t, {
|
|
1484
1484
|
pageCount: r.layout.pages.length,
|
|
1485
1485
|
exact: r.exact,
|
|
1486
1486
|
complete: !1
|
|
1487
1487
|
}), i.resolve();
|
|
1488
1488
|
else {
|
|
1489
|
-
if (!t._isLayoutViewActive(
|
|
1490
|
-
|
|
1489
|
+
if (!t._isLayoutViewActive(m)) return;
|
|
1490
|
+
q(t, {
|
|
1491
1491
|
pageCount: r.layout.pages.length,
|
|
1492
1492
|
exact: r.exact,
|
|
1493
1493
|
complete: !1,
|
|
@@ -1500,60 +1500,60 @@ var X = class e {
|
|
|
1500
1500
|
}
|
|
1501
1501
|
}).then((r) => {
|
|
1502
1502
|
let s;
|
|
1503
|
-
o && (s =
|
|
1503
|
+
o && (s = dr(a?.pages, r.pages), t._replaceMainLayoutPublication(e, m, a, r) === null && (o = !1)), t._layoutLifecycle.succeed(), q(t, {
|
|
1504
1504
|
pageCount: t.pageCount,
|
|
1505
1505
|
exact: !0,
|
|
1506
1506
|
complete: !0,
|
|
1507
|
-
...o && t._isLayoutViewActive(
|
|
1507
|
+
...o && t._isLayoutViewActive(m) && s !== void 0 ? { unchangedPages: s } : {}
|
|
1508
1508
|
}), t._layoutObservers.notify("onLayoutComplete", n.onLayoutComplete), i.resolve();
|
|
1509
1509
|
}).catch((e) => {
|
|
1510
1510
|
if (a === null) {
|
|
1511
1511
|
i.reject(e);
|
|
1512
1512
|
return;
|
|
1513
1513
|
}
|
|
1514
|
-
if (e instanceof
|
|
1514
|
+
if (e instanceof N) {
|
|
1515
1515
|
t._layoutLifecycle.succeed();
|
|
1516
1516
|
return;
|
|
1517
1517
|
}
|
|
1518
1518
|
let r = t._layoutLifecycle.fail(e);
|
|
1519
|
-
|
|
1519
|
+
q(t, {
|
|
1520
1520
|
pageCount: t.pageCount,
|
|
1521
1521
|
exact: !1,
|
|
1522
1522
|
complete: !1,
|
|
1523
1523
|
error: r
|
|
1524
1524
|
}), t._layoutObservers.notify("onLayoutComplete", n.onLayoutComplete, r);
|
|
1525
1525
|
}), await i.promise;
|
|
1526
|
-
} else if (
|
|
1527
|
-
|
|
1528
|
-
let e = r?.requestedView(),
|
|
1529
|
-
t.activeLayoutOptions =
|
|
1530
|
-
let
|
|
1526
|
+
} else if (p && (n.sliceLayout !== !1 || n.onLayoutProgress)) for (;;) {
|
|
1527
|
+
l();
|
|
1528
|
+
let e = r?.requestedView(), a = e === void 0 ? m : M(n.currentDate, t.defaultCurrentDateMs, e);
|
|
1529
|
+
t.activeLayoutOptions = a;
|
|
1530
|
+
let o = new AbortController(), s = !1, c = r?.subscribeViewChange(() => {
|
|
1531
1531
|
let e = r.requestedView();
|
|
1532
|
-
|
|
1532
|
+
s || e === void 0 || e === !0 == (a.showTrackedChanges === !0) || (s = !0, o.abort());
|
|
1533
1533
|
});
|
|
1534
|
-
|
|
1534
|
+
x._layoutAbort = o;
|
|
1535
1535
|
try {
|
|
1536
|
-
let e = await
|
|
1537
|
-
...
|
|
1538
|
-
signal:
|
|
1536
|
+
let e = await nt(x._source.bodyLayoutInput, d, a, {
|
|
1537
|
+
...h,
|
|
1538
|
+
signal: o.signal
|
|
1539
1539
|
});
|
|
1540
|
-
if (
|
|
1541
|
-
|
|
1540
|
+
if (l(), s) continue;
|
|
1541
|
+
f.layoutVariants.prime(a, e);
|
|
1542
1542
|
break;
|
|
1543
1543
|
} catch (e) {
|
|
1544
|
-
if (e instanceof
|
|
1544
|
+
if (e instanceof N && s && !i?.aborted) continue;
|
|
1545
1545
|
throw e;
|
|
1546
1546
|
} finally {
|
|
1547
|
-
|
|
1547
|
+
c?.(), x._layoutAbort = null;
|
|
1548
1548
|
}
|
|
1549
1549
|
}
|
|
1550
|
-
else
|
|
1550
|
+
else f.layoutVariants.layoutFor(m);
|
|
1551
1551
|
}
|
|
1552
|
-
return
|
|
1552
|
+
return l(), await x._resourceUsage(n.workerTimeoutMs ?? 1e3).then((e) => _.observeUsage(e), () => void 0), _.checkpoint("model and layout ready"), l(), _.succeed({ pages: x.pageCount }), x;
|
|
1553
1553
|
} catch (e) {
|
|
1554
|
-
throw
|
|
1554
|
+
throw ft(v, x ? C : void 0), e;
|
|
1555
1555
|
} finally {
|
|
1556
|
-
|
|
1556
|
+
i?.removeEventListener("abort", C);
|
|
1557
1557
|
}
|
|
1558
1558
|
} catch (e) {
|
|
1559
1559
|
throw _.fail(e), e;
|
|
@@ -1572,7 +1572,7 @@ var X = class e {
|
|
|
1572
1572
|
useGoogleFonts: n,
|
|
1573
1573
|
allowFootnoteContinuation: this._allowFootnoteContinuation,
|
|
1574
1574
|
cjkFallback: this._cjkFallback,
|
|
1575
|
-
defaultCurrentDateMs:
|
|
1575
|
+
defaultCurrentDateMs: A(this).defaultCurrentDateMs,
|
|
1576
1576
|
...this._parseViewFields(),
|
|
1577
1577
|
renderers: a
|
|
1578
1578
|
} : {
|
|
@@ -1583,25 +1583,25 @@ var X = class e {
|
|
|
1583
1583
|
}), [e], { timeoutMs: r });
|
|
1584
1584
|
if (this._parseRequestId = null, "protocol" in s) throw Error("DOCX parse open returned a pull-protocol response");
|
|
1585
1585
|
if (this._mode === "worker") if ("usage" in s && s.usage && i?.(s.usage), s.type === "mainThreadVerticalFallback") {
|
|
1586
|
-
let e = await
|
|
1586
|
+
let e = await Xe(this._bridge.transport(et), s, {
|
|
1587
1587
|
timeoutMs: r,
|
|
1588
1588
|
onUsage: i
|
|
1589
1589
|
});
|
|
1590
1590
|
this._source = e.source, this._document = e.document, this._meta = null, this._mode = "main", this._mainThreadFallbackReason = s.reason ?? "vertical";
|
|
1591
1591
|
} else this._meta = s.meta;
|
|
1592
1592
|
else {
|
|
1593
|
-
let e = s, t = await
|
|
1593
|
+
let e = s, t = await Xe(this._bridge.transport(et), e, {
|
|
1594
1594
|
timeoutMs: r,
|
|
1595
1595
|
onUsage: i
|
|
1596
1596
|
});
|
|
1597
1597
|
this._source = t.source, this._document = t.document;
|
|
1598
1598
|
}
|
|
1599
|
-
this._review =
|
|
1599
|
+
this._review = Z(this._meta?.comments ?? this._document?.comments ?? [], this._meta?.revisions ?? this._document?.revisions ?? []);
|
|
1600
1600
|
}
|
|
1601
1601
|
_onWorkerLayoutPush(e) {
|
|
1602
|
-
if (
|
|
1602
|
+
if (Ot((e, t) => this._worker.postMessage(e, t), e) || !("forId" in e) || e.forId !== this._parseRequestId) return;
|
|
1603
1603
|
if (this._rearmParseWatchdog(), e.type === "measureHostFontLines") {
|
|
1604
|
-
|
|
1604
|
+
nn(e.routes).catch(() => []).then((t) => {
|
|
1605
1605
|
e.forId === this._parseRequestId && this._worker.postMessage({
|
|
1606
1606
|
type: "hostFontLinesMeasured",
|
|
1607
1607
|
forId: e.forId,
|
|
@@ -1611,7 +1611,7 @@ var X = class e {
|
|
|
1611
1611
|
return;
|
|
1612
1612
|
}
|
|
1613
1613
|
if (e.type === "measureNativeRouteLines") {
|
|
1614
|
-
|
|
1614
|
+
Ke(e.requests, !1).then((e) => e.lines, () => e.requests.map(() => null)).then((t) => {
|
|
1615
1615
|
e.forId === this._parseRequestId && this._worker.postMessage({
|
|
1616
1616
|
type: "nativeRouteLinesMeasured",
|
|
1617
1617
|
forId: e.forId,
|
|
@@ -1630,7 +1630,7 @@ var X = class e {
|
|
|
1630
1630
|
let n = !t.published || this._isLayoutViewActive(t.layoutOptions);
|
|
1631
1631
|
if (n && this._applyLayoutPartial(e.partial), t.published) {
|
|
1632
1632
|
if (!n) return;
|
|
1633
|
-
|
|
1633
|
+
q(this, {
|
|
1634
1634
|
pageCount: e.partial.pageCount,
|
|
1635
1635
|
exact: e.partial.exact,
|
|
1636
1636
|
complete: !1,
|
|
@@ -1641,7 +1641,7 @@ var X = class e {
|
|
|
1641
1641
|
});
|
|
1642
1642
|
return;
|
|
1643
1643
|
}
|
|
1644
|
-
t.published = !0, this._layoutLifecycle.begin(),
|
|
1644
|
+
t.published = !0, this._layoutLifecycle.begin(), q(this, {
|
|
1645
1645
|
pageCount: e.partial.pageCount,
|
|
1646
1646
|
exact: e.partial.exact,
|
|
1647
1647
|
complete: !1
|
|
@@ -1661,7 +1661,7 @@ var X = class e {
|
|
|
1661
1661
|
resourceDiagnostics: e.review?.resourceDiagnostics ?? this._meta?.resourceDiagnostics,
|
|
1662
1662
|
commentAnchorRanges: e.commentAnchorRanges,
|
|
1663
1663
|
revisionAnchorRanges: e.revisionAnchorRanges
|
|
1664
|
-
}, e.review && (this._review =
|
|
1664
|
+
}, e.review && (this._review = Z(e.review.comments, e.review.revisions)), this._invalidateLayoutDerivedCaches();
|
|
1665
1665
|
}
|
|
1666
1666
|
_onAuthoritativeMeta(e, t) {
|
|
1667
1667
|
this._clearParseWatchdog();
|
|
@@ -1681,7 +1681,7 @@ var X = class e {
|
|
|
1681
1681
|
revisionAnchorRanges: t.revisionAnchorRanges
|
|
1682
1682
|
};
|
|
1683
1683
|
}
|
|
1684
|
-
this._invalidateLayoutDerivedCaches(), this._review =
|
|
1684
|
+
this._invalidateLayoutDerivedCaches(), this._review = Z(e.comments, e.revisions), n && (n.settled = !0, this._layoutLifecycle.succeed(), q(this, {
|
|
1685
1685
|
pageCount: this.pageCount,
|
|
1686
1686
|
exact: !0,
|
|
1687
1687
|
complete: !0,
|
|
@@ -1696,7 +1696,7 @@ var X = class e {
|
|
|
1696
1696
|
return i !== null && this._isLayoutViewActive(t) && this._invalidateLayoutDerivedCaches(), i;
|
|
1697
1697
|
}
|
|
1698
1698
|
_isLayoutViewActive(e) {
|
|
1699
|
-
return
|
|
1699
|
+
return yr(A(this).activeLayoutOptions, e);
|
|
1700
1700
|
}
|
|
1701
1701
|
_rearmParseWatchdog() {
|
|
1702
1702
|
this._parseWatchdogMs !== void 0 && (clearTimeout(this._parseWatchdog), this._parseWatchdog = setTimeout(() => this._onParseWentSilent(), this._parseWatchdogMs));
|
|
@@ -1717,7 +1717,7 @@ var X = class e {
|
|
|
1717
1717
|
return;
|
|
1718
1718
|
}
|
|
1719
1719
|
let n = this._layoutLifecycle.fail(t);
|
|
1720
|
-
|
|
1720
|
+
q(this, {
|
|
1721
1721
|
pageCount: this.pageCount,
|
|
1722
1722
|
exact: !1,
|
|
1723
1723
|
complete: !1,
|
|
@@ -1725,7 +1725,7 @@ var X = class e {
|
|
|
1725
1725
|
}), this._layoutObservers.notify("onLayoutComplete", e.onComplete, n);
|
|
1726
1726
|
}
|
|
1727
1727
|
_parseViewFields() {
|
|
1728
|
-
let e =
|
|
1728
|
+
let e = A(this), t = e.activeLayoutOptions;
|
|
1729
1729
|
return t ? {
|
|
1730
1730
|
...t.currentDateMs === e.defaultCurrentDateMs ? {} : { currentDateMs: t.currentDateMs },
|
|
1731
1731
|
...t.showTrackedChanges === !0 ? { showTrackedChanges: !0 } : {}
|
|
@@ -1741,7 +1741,7 @@ var X = class e {
|
|
|
1741
1741
|
useGoogleFonts: n,
|
|
1742
1742
|
allowFootnoteContinuation: this._allowFootnoteContinuation,
|
|
1743
1743
|
cjkFallback: this._cjkFallback,
|
|
1744
|
-
defaultCurrentDateMs:
|
|
1744
|
+
defaultCurrentDateMs: A(this).defaultCurrentDateMs,
|
|
1745
1745
|
...this._parseViewFields(),
|
|
1746
1746
|
renderers: a,
|
|
1747
1747
|
progressiveLayout: !0
|
|
@@ -1750,11 +1750,11 @@ var X = class e {
|
|
|
1750
1750
|
if (this._parseRequestId = null, "protocol" in e) throw Error("DOCX parse open returned a pull-protocol response");
|
|
1751
1751
|
if ("usage" in e && e.usage && i?.(e.usage), e.type === "mainThreadVerticalFallback") {
|
|
1752
1752
|
this._clearParseWatchdog(), o.settled = !0, this._progressive = null, this._layoutAbort = null;
|
|
1753
|
-
let t = await
|
|
1753
|
+
let t = await Xe(this._bridge.transport(et), e, {
|
|
1754
1754
|
timeoutMs: r,
|
|
1755
1755
|
onUsage: i
|
|
1756
1756
|
});
|
|
1757
|
-
this._source = t.source, this._document = t.document, this._meta = null, this._mode = "main", this._mainThreadFallbackReason = e.reason ?? "vertical", this._review =
|
|
1757
|
+
this._source = t.source, this._document = t.document, this._meta = null, this._mode = "main", this._mainThreadFallbackReason = e.reason ?? "vertical", this._review = Z(t.document.comments ?? [], t.document.revisions ?? []), o.firstPublication.resolve();
|
|
1758
1758
|
return;
|
|
1759
1759
|
}
|
|
1760
1760
|
let t = e;
|
|
@@ -1770,7 +1770,7 @@ var X = class e {
|
|
|
1770
1770
|
}), this._rearmParseWatchdog(), await o.firstPublication.promise;
|
|
1771
1771
|
}
|
|
1772
1772
|
destroy() {
|
|
1773
|
-
this._layoutAbort?.abort(), this._layoutAbort = null, this._clearParseWatchdog(), this._parseRequestId = null, this._progressive = null, this._layoutViewGeneration++, this._bridge.terminate(), this._document = null, this._source = null, this._meta = null, this._review =
|
|
1773
|
+
this._layoutAbort?.abort(), this._layoutAbort = null, this._clearParseWatchdog(), this._parseRequestId = null, this._progressive = null, this._layoutViewGeneration++, this._bridge.terminate(), this._document = null, this._source = null, this._meta = null, this._review = Sr, A(this).services = null, this._bookmarkPages = null, this._commentAnchorRanges = null, this._revisionAnchorRanges = null, this._reviewProjectionIndex = null, this._rawParts.clear(), this._embeddedFontFaces.length > 0 && (E(this._embeddedFontFaces), this._embeddedFontFaces = []), this._officeFontFaces.length > 0 && (m(this._officeFontFaces), this._officeFontFaces = []), this._nativeRouteFacesReleased = !0, this._nativeRouteFaces?.length > 0 && (m(this._nativeRouteFaces), this._nativeRouteFaces = []), this._googleFontFaces.length > 0 && (f(this._googleFontFaces), this._googleFontFaces = []), ee(this._fetchImage), x(this._fetchImage);
|
|
1774
1774
|
}
|
|
1775
1775
|
async getImage(e, t) {
|
|
1776
1776
|
return this._rawParts.get(e, t, () => this._bridge.request((t) => ({
|
|
@@ -1799,7 +1799,7 @@ var X = class e {
|
|
|
1799
1799
|
async getResourceMetrics() {
|
|
1800
1800
|
let e = this._metrics;
|
|
1801
1801
|
if (!e) throw Error("Document not loaded");
|
|
1802
|
-
return
|
|
1802
|
+
return u(e, (e) => this._resourceUsage(e));
|
|
1803
1803
|
}
|
|
1804
1804
|
async toMarkdown() {
|
|
1805
1805
|
return (await this._bridge.request((e) => ({
|
|
@@ -1831,35 +1831,35 @@ var X = class e {
|
|
|
1831
1831
|
return this._reviewSnapshot().revisions;
|
|
1832
1832
|
}
|
|
1833
1833
|
commentAnchorRanges() {
|
|
1834
|
-
if (this._meta) return this._meta.commentAnchorRanges ??
|
|
1834
|
+
if (this._meta) return this._meta.commentAnchorRanges ?? br;
|
|
1835
1835
|
if (!this._document || !this._source) return [];
|
|
1836
1836
|
let e = this._reviewSnapshot().comments;
|
|
1837
|
-
if (e.length === 0) return
|
|
1838
|
-
let t =
|
|
1837
|
+
if (e.length === 0) return br;
|
|
1838
|
+
let t = A(this), n = t.services;
|
|
1839
1839
|
if (!n) throw Error("Document layout services are not initialized");
|
|
1840
|
-
let r =
|
|
1840
|
+
let r = Le(n);
|
|
1841
1841
|
if (!r) throw Error("Document layout variant store is not initialized");
|
|
1842
1842
|
let i = t.activeLayoutOptions, a = i ? r.layoutFor(i) : r.defaultLayout;
|
|
1843
|
-
this._reviewProjectionIndex ??=
|
|
1843
|
+
this._reviewProjectionIndex ??= Be(a);
|
|
1844
1844
|
let o = this._layoutLifecycle?.complete ?? !0 ? void 0 : { completedSourceKeys: this._reviewProjectionIndex.completedSourceKeys };
|
|
1845
|
-
return this._commentAnchorRanges ??=
|
|
1845
|
+
return this._commentAnchorRanges ??= Xn(e, this._source, this._reviewProjectionIndex.renderedRunIndex, o), this._commentAnchorRanges;
|
|
1846
1846
|
}
|
|
1847
1847
|
revisionAnchorRanges() {
|
|
1848
|
-
if (this._meta) return this._meta.revisionAnchorRanges ??
|
|
1848
|
+
if (this._meta) return this._meta.revisionAnchorRanges ?? xr;
|
|
1849
1849
|
if (!this._document || !this._source) return [];
|
|
1850
1850
|
let e = this._reviewSnapshot().revisions;
|
|
1851
|
-
if (e.length === 0) return
|
|
1852
|
-
let t =
|
|
1851
|
+
if (e.length === 0) return xr;
|
|
1852
|
+
let t = A(this), n = t.services;
|
|
1853
1853
|
if (!n) throw Error("Document layout services are not initialized");
|
|
1854
|
-
let r =
|
|
1854
|
+
let r = Le(n);
|
|
1855
1855
|
if (!r) throw Error("Document layout variant store is not initialized");
|
|
1856
1856
|
let i = t.activeLayoutOptions, a = i ? r.layoutFor(i) : r.defaultLayout;
|
|
1857
|
-
this._reviewProjectionIndex ??=
|
|
1857
|
+
this._reviewProjectionIndex ??= Be(a);
|
|
1858
1858
|
let o = this._layoutLifecycle?.complete ?? !0 ? void 0 : { completedSourceKeys: this._reviewProjectionIndex.completedSourceKeys };
|
|
1859
|
-
return this._revisionAnchorRanges ??=
|
|
1859
|
+
return this._revisionAnchorRanges ??= or(e, this._source, this._reviewProjectionIndex.renderedRunIndex, o), this._revisionAnchorRanges;
|
|
1860
1860
|
}
|
|
1861
1861
|
_reviewSnapshot() {
|
|
1862
|
-
return this._review ||=
|
|
1862
|
+
return this._review ||= Z(this._meta?.comments ?? this._document?.comments ?? [], this._meta?.revisions ?? this._document?.revisions ?? []), this._review;
|
|
1863
1863
|
}
|
|
1864
1864
|
get footnotes() {
|
|
1865
1865
|
return this._meta?.footnotes ?? this._document?.footnotes ?? [];
|
|
@@ -1869,16 +1869,16 @@ var X = class e {
|
|
|
1869
1869
|
}
|
|
1870
1870
|
_getLayout() {
|
|
1871
1871
|
if (!this._document) return null;
|
|
1872
|
-
let e =
|
|
1872
|
+
let e = A(this), t = e.services;
|
|
1873
1873
|
if (!t) throw Error("Document layout services are not initialized");
|
|
1874
|
-
let n =
|
|
1874
|
+
let n = Le(t);
|
|
1875
1875
|
if (!n) throw Error("Document layout variant store is not initialized");
|
|
1876
1876
|
let r = e.activeLayoutOptions;
|
|
1877
1877
|
return r ? n.layoutFor(r) : n.defaultLayout;
|
|
1878
1878
|
}
|
|
1879
1879
|
async setLayoutView(e = {}) {
|
|
1880
|
-
let t = e[
|
|
1881
|
-
if (!
|
|
1880
|
+
let t = e[mr], n = A(this), r = M(e.currentDate, n.defaultCurrentDateMs, e.showTrackedChanges === !0), i = ++this._layoutViewGeneration, a = n.activeLayoutOptions;
|
|
1881
|
+
if (!yr(a, r)) {
|
|
1882
1882
|
if (this._mode === "worker" && this._meta) {
|
|
1883
1883
|
let e = await this._bridge.request((e) => ({
|
|
1884
1884
|
type: "selectLayoutView",
|
|
@@ -1891,17 +1891,17 @@ var X = class e {
|
|
|
1891
1891
|
n.activeLayoutOptions = r, this._meta = {
|
|
1892
1892
|
...this._meta,
|
|
1893
1893
|
...a.meta
|
|
1894
|
-
}, this._invalidateLayoutDerivedCaches(),
|
|
1894
|
+
}, this._invalidateLayoutDerivedCaches(), gr(this, t);
|
|
1895
1895
|
return;
|
|
1896
1896
|
}
|
|
1897
|
-
n.activeLayoutOptions = r, this._invalidateLayoutDerivedCaches(),
|
|
1897
|
+
n.activeLayoutOptions = r, this._invalidateLayoutDerivedCaches(), gr(this, t);
|
|
1898
1898
|
}
|
|
1899
1899
|
}
|
|
1900
1900
|
_getBookmarkPages() {
|
|
1901
1901
|
if (this._bookmarkPages) return this._bookmarkPages;
|
|
1902
1902
|
if (this._meta) return this._bookmarkPages = new Map(this._meta.bookmarkPages), this._bookmarkPages;
|
|
1903
1903
|
let e = this._getLayout();
|
|
1904
|
-
return e ? (this._bookmarkPages =
|
|
1904
|
+
return e ? (this._bookmarkPages = hn(e), this._bookmarkPages) : null;
|
|
1905
1905
|
}
|
|
1906
1906
|
getBookmarkPage(e) {
|
|
1907
1907
|
return this._getBookmarkPages()?.get(e);
|
|
@@ -1933,7 +1933,7 @@ var X = class e {
|
|
|
1933
1933
|
};
|
|
1934
1934
|
}
|
|
1935
1935
|
_withActiveView(e) {
|
|
1936
|
-
let t =
|
|
1936
|
+
let t = A(this).activeLayoutOptions;
|
|
1937
1937
|
if (!t) return e;
|
|
1938
1938
|
let n = { ...e };
|
|
1939
1939
|
return e.currentDate === void 0 && (n.currentDate = t.currentDateMs), e.showTrackedChanges === void 0 && t.showTrackedChanges === !0 && (n.showTrackedChanges = !0), n;
|
|
@@ -1944,13 +1944,13 @@ var X = class e {
|
|
|
1944
1944
|
_renderPageWithTargetOwnership(e, t, n, r) {
|
|
1945
1945
|
if (this._mode === "worker") throw Error("renderPage(canvas) is unavailable in mode: 'worker'; use renderPageToBitmap() and paint it via an ImageBitmapRenderingContext");
|
|
1946
1946
|
if (!this._source) throw Error("Document not loaded");
|
|
1947
|
-
return
|
|
1947
|
+
return We(this._source, e, t, {
|
|
1948
1948
|
...this._withActiveView(n),
|
|
1949
|
-
onDiagnostic: (e) =>
|
|
1949
|
+
onDiagnostic: (e) => L(this, [e]),
|
|
1950
1950
|
callerOwnedCanvasTarget: r,
|
|
1951
1951
|
fetchImage: this._fetchImage,
|
|
1952
|
-
layoutServices:
|
|
1953
|
-
defaultCurrentDateMs:
|
|
1952
|
+
layoutServices: A(this).services ?? void 0,
|
|
1953
|
+
defaultCurrentDateMs: A(this).defaultCurrentDateMs,
|
|
1954
1954
|
threeD: this._threeD,
|
|
1955
1955
|
regionMap: this._regionMap,
|
|
1956
1956
|
chartEx: this._chartEx,
|
|
@@ -1960,7 +1960,7 @@ var X = class e {
|
|
|
1960
1960
|
async renderPageToBitmap(e, t = {}) {
|
|
1961
1961
|
let { onTextRun: n, ...r } = t, i = {
|
|
1962
1962
|
...this._withActiveView(r),
|
|
1963
|
-
dpr: r.dpr ??
|
|
1963
|
+
dpr: r.dpr ?? h()
|
|
1964
1964
|
};
|
|
1965
1965
|
if (this._mode === "worker") {
|
|
1966
1966
|
let t = new OffscreenCanvas(1, 1), r = await this._bridge.request((n) => ({
|
|
@@ -1971,9 +1971,9 @@ var X = class e {
|
|
|
1971
1971
|
canvas: t
|
|
1972
1972
|
}), [t]);
|
|
1973
1973
|
try {
|
|
1974
|
-
if (
|
|
1974
|
+
if (L(this, r.diagnostics), n) for (let e of r.runs) n(e);
|
|
1975
1975
|
} catch (e) {
|
|
1976
|
-
throw
|
|
1976
|
+
throw v(r.bitmap), e;
|
|
1977
1977
|
}
|
|
1978
1978
|
return r.bitmap;
|
|
1979
1979
|
}
|
|
@@ -1991,9 +1991,9 @@ var X = class e {
|
|
|
1991
1991
|
pageIndex: e,
|
|
1992
1992
|
opts: n
|
|
1993
1993
|
}))).runs;
|
|
1994
|
-
let r =
|
|
1994
|
+
let r = A(this), i = r.services;
|
|
1995
1995
|
if (!i) throw Error("Document layout services are not initialized");
|
|
1996
|
-
return
|
|
1996
|
+
return je(i, e, {
|
|
1997
1997
|
currentDate: n.currentDate,
|
|
1998
1998
|
defaultCurrentDateMs: r.defaultCurrentDateMs,
|
|
1999
1999
|
width: n.width,
|
|
@@ -2002,7 +2002,7 @@ var X = class e {
|
|
|
2002
2002
|
}
|
|
2003
2003
|
async getCommentThreads(e, t = {}) {
|
|
2004
2004
|
let { includeResolved: n, ...r } = t, i = await this.collectPageRuns(e, r);
|
|
2005
|
-
return
|
|
2005
|
+
return $n(this.comments, this.commentAnchorRanges(), i, { includeResolved: n });
|
|
2006
2006
|
}
|
|
2007
2007
|
async getElementContextAt(e, t, n = {}) {
|
|
2008
2008
|
let r = this._withActiveView(n);
|
|
@@ -2013,9 +2013,9 @@ var X = class e {
|
|
|
2013
2013
|
point: t,
|
|
2014
2014
|
opts: r
|
|
2015
2015
|
}))).context;
|
|
2016
|
-
let i =
|
|
2016
|
+
let i = A(this), a = i.services;
|
|
2017
2017
|
if (!a) throw Error("Document layout services are not initialized");
|
|
2018
|
-
return
|
|
2018
|
+
return Rn(a, e, t, {
|
|
2019
2019
|
...r,
|
|
2020
2020
|
defaultCurrentDateMs: i.defaultCurrentDateMs
|
|
2021
2021
|
});
|
|
@@ -2023,31 +2023,31 @@ var X = class e {
|
|
|
2023
2023
|
};
|
|
2024
2024
|
//#endregion
|
|
2025
2025
|
//#region packages/docx/src/tate-chu-yoko-overlay.ts
|
|
2026
|
-
function
|
|
2026
|
+
function Cr(e, t) {
|
|
2027
2027
|
if (!e.eastAsianVert) return 1;
|
|
2028
2028
|
let n = t(e.text);
|
|
2029
2029
|
return !(n > 0) || e.w >= n ? 1 : e.w / n;
|
|
2030
2030
|
}
|
|
2031
2031
|
//#endregion
|
|
2032
2032
|
//#region packages/docx/src/text-layer.ts
|
|
2033
|
-
function
|
|
2034
|
-
e.innerHTML = "",
|
|
2033
|
+
function wr(e, t, n, r, i, a, o) {
|
|
2034
|
+
e.innerHTML = "", D(e, "ooxmlSelectionSurface", "docx"), D(e, "pageIndex", o === void 0 ? void 0 : String(o));
|
|
2035
2035
|
let s = e.ownerDocument ?? document;
|
|
2036
2036
|
for (let [o, c] of t.entries()) {
|
|
2037
2037
|
let t = s.createElement("span");
|
|
2038
|
-
|
|
2038
|
+
D(t, "ooxmlSelectionRun", "docx"), D(t, "runIndex", String(o)), c.paragraphId !== void 0 && D(t, "paragraphId", c.paragraphId), c.source !== void 0 && (D(t, "sourceStory", c.source.story), D(t, "sourceStoryInstance", c.source.storyInstance), D(t, "sourcePath", JSON.stringify(c.source.path))), t.textContent = c.text;
|
|
2039
2039
|
let l = c.transform ?? "";
|
|
2040
2040
|
if (a && c.eastAsianVert) {
|
|
2041
|
-
let e =
|
|
2041
|
+
let e = Cr(c, a(c.font));
|
|
2042
2042
|
e !== 1 && (l = `${l ? `${l} ` : ""}scaleX(${e})`);
|
|
2043
2043
|
}
|
|
2044
|
-
let u = l ? `transform:${l};transform-origin:top left;` : "", d = i ? c.hyperlink : void 0, f = d ? "pointer" : "text", p = c.letterSpacingPx === void 0 ? "0" : `${c.letterSpacingPx}px`, m = c.trailingSpaceCompressionPx === void 0 ? "" : `width:${
|
|
2045
|
-
t.style.cssText = `position:absolute;left:${
|
|
2044
|
+
let u = l ? `transform:${l};transform-origin:top left;` : "", d = i ? c.hyperlink : void 0, f = d ? "pointer" : "text", p = c.letterSpacingPx === void 0 ? "0" : `${c.letterSpacingPx}px`, m = c.trailingSpaceCompressionPx === void 0 ? "" : `width:${T(c.w, n)};overflow:hidden;`;
|
|
2045
|
+
t.style.cssText = `position:absolute;left:${T(c.x, n)};top:${T(c.y, r)};font:${c.font};line-height:${c.h}px;letter-spacing:${p};` + m + u + `white-space:pre;color:transparent;cursor:${f};pointer-events:all;`, d && i && (t.title = d.kind === "external" ? d.url : d.ref, t.addEventListener("click", (e) => {
|
|
2046
2046
|
e.preventDefault(), i(d);
|
|
2047
2047
|
})), e.appendChild(t);
|
|
2048
2048
|
}
|
|
2049
2049
|
}
|
|
2050
|
-
function
|
|
2050
|
+
function Tr(e, t, n, r, i, a, o = {}) {
|
|
2051
2051
|
e.innerHTML = "";
|
|
2052
2052
|
let s = o.match ?? "rgba(255, 214, 0, 0.42)", c = o.active ?? "rgba(255, 140, 0, 0.55)";
|
|
2053
2053
|
for (let o of n) {
|
|
@@ -2055,16 +2055,16 @@ function Er(e, t, n, r, i, a, o = {}) {
|
|
|
2055
2055
|
for (let s of o.slices) {
|
|
2056
2056
|
let o = t[s.runIndex];
|
|
2057
2057
|
if (!o) continue;
|
|
2058
|
-
let c = a(o.font), l =
|
|
2059
|
-
if (
|
|
2060
|
-
let
|
|
2061
|
-
|
|
2058
|
+
let c = a(o.font), l = ne(o.text, s.start, s.end, c), u = o.letterSpacingPx ?? 0, d = Math.max(0, Math.min(s.start, o.text.length)), f = Math.max(d, Math.min(s.end, o.text.length)), p = qe(o.text.slice(d, f)).pitchBearing, m = qe(o.text.slice(0, d)).pitchBearing, h = l.x + m * u, g = l.width + Math.max(0, p - 1) * u, _ = Cr(o, c), v = h * _, y = g * _;
|
|
2059
|
+
if (y <= 0) continue;
|
|
2060
|
+
let b = document.createElement("div"), x = o.transform ? `transform:${o.transform};transform-origin:top left;` : "";
|
|
2061
|
+
b.style.cssText = `position:absolute;left:${T(o.x + v, r)};top:${T(o.y, i)};width:${T(y, r)};height:${T(o.h, i)};` + x + `background:${n};pointer-events:none;`, e.appendChild(b);
|
|
2062
2062
|
}
|
|
2063
2063
|
}
|
|
2064
2064
|
}
|
|
2065
2065
|
//#endregion
|
|
2066
2066
|
//#region packages/docx/src/find.ts
|
|
2067
|
-
var
|
|
2067
|
+
var Er = class extends w {
|
|
2068
2068
|
constructor(e, t) {
|
|
2069
2069
|
super(e, t, (e) => ({ page: e }));
|
|
2070
2070
|
}
|
|
@@ -2083,7 +2083,7 @@ var Dr = class extends S {
|
|
|
2083
2083
|
};
|
|
2084
2084
|
//#endregion
|
|
2085
2085
|
//#region packages/docx/src/selection-context.ts
|
|
2086
|
-
function
|
|
2086
|
+
function Dr(e, t, n, r, i = {}) {
|
|
2087
2087
|
let a = e.find((e) => e.id === n && e.parentId === void 0);
|
|
2088
2088
|
if (!a) return null;
|
|
2089
2089
|
let o = new Map(e.map((e) => [e.id, e])), s = e.filter((e) => {
|
|
@@ -2097,7 +2097,7 @@ function Or(e, t, n, r, i = {}) {
|
|
|
2097
2097
|
t = e;
|
|
2098
2098
|
}
|
|
2099
2099
|
return !1;
|
|
2100
|
-
}), c =
|
|
2100
|
+
}), c = Oe({
|
|
2101
2101
|
id: a.id,
|
|
2102
2102
|
author: a.author,
|
|
2103
2103
|
date: a.date,
|
|
@@ -2126,14 +2126,14 @@ function Or(e, t, n, r, i = {}) {
|
|
|
2126
2126
|
maxTextCharacters: c.maxTextCharacters
|
|
2127
2127
|
});
|
|
2128
2128
|
}
|
|
2129
|
-
function
|
|
2129
|
+
function Or(e) {
|
|
2130
2130
|
for (let t = e; t; t = t.parentElement) {
|
|
2131
|
-
let e =
|
|
2131
|
+
let e = Ee(t.dataset.pageIndex);
|
|
2132
2132
|
if (e !== null) return e;
|
|
2133
2133
|
}
|
|
2134
2134
|
return null;
|
|
2135
2135
|
}
|
|
2136
|
-
var
|
|
2136
|
+
var kr = new Set([
|
|
2137
2137
|
"body",
|
|
2138
2138
|
"header",
|
|
2139
2139
|
"footer",
|
|
@@ -2141,9 +2141,9 @@ var Ar = new Set([
|
|
|
2141
2141
|
"endnote",
|
|
2142
2142
|
"textbox"
|
|
2143
2143
|
]);
|
|
2144
|
-
function
|
|
2144
|
+
function Ar(e) {
|
|
2145
2145
|
let t = e.dataset.sourceStory, n = e.dataset.sourceStoryInstance, r = e.dataset.sourcePath;
|
|
2146
|
-
if (!t || !
|
|
2146
|
+
if (!t || !kr.has(t) || !n || !r) return null;
|
|
2147
2147
|
try {
|
|
2148
2148
|
let e = JSON.parse(r);
|
|
2149
2149
|
return !Array.isArray(e) || e.length === 0 || e.length > 32 || !e.every((e) => Number.isSafeInteger(e) && e >= 0) ? null : {
|
|
@@ -2155,14 +2155,14 @@ function jr(e) {
|
|
|
2155
2155
|
return null;
|
|
2156
2156
|
}
|
|
2157
2157
|
}
|
|
2158
|
-
function
|
|
2159
|
-
let r =
|
|
2160
|
-
let t =
|
|
2158
|
+
function $(e, t, n = {}) {
|
|
2159
|
+
let r = ht(e, t, (e) => {
|
|
2160
|
+
let t = Or(e), n = Ee(e.dataset.runIndex);
|
|
2161
2161
|
return t === null || n === null ? null : {
|
|
2162
2162
|
pageIndex: t,
|
|
2163
2163
|
runIndex: n,
|
|
2164
2164
|
...e.dataset.paragraphId === void 0 ? {} : { paragraphId: e.dataset.paragraphId },
|
|
2165
|
-
...
|
|
2165
|
+
...Ar(e) === null ? {} : { source: Ar(e) }
|
|
2166
2166
|
};
|
|
2167
2167
|
}, {
|
|
2168
2168
|
maxChars: n.maxTextCharacters,
|
|
@@ -2186,7 +2186,7 @@ function Q(e, t, n = {}) {
|
|
|
2186
2186
|
}
|
|
2187
2187
|
//#endregion
|
|
2188
2188
|
//#region packages/docx/src/focused-view-runtime.ts
|
|
2189
|
-
function
|
|
2189
|
+
function jr(e, t, n, r, i) {
|
|
2190
2190
|
return r === "worker" ? e.renderPageToBitmap(n, i) : e.renderPage(t, n, i);
|
|
2191
2191
|
}
|
|
2192
2192
|
//#endregion
|
|
@@ -2233,7 +2233,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2233
2233
|
_elementClickListener = null;
|
|
2234
2234
|
_contextMenuListener = null;
|
|
2235
2235
|
static fromDocument(t, n, r = {}) {
|
|
2236
|
-
let i =
|
|
2236
|
+
let i = Y(n);
|
|
2237
2237
|
return new e(t, {
|
|
2238
2238
|
...r,
|
|
2239
2239
|
currentDate: i.currentDate,
|
|
@@ -2244,19 +2244,19 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2244
2244
|
constructor(e, t = {}) {
|
|
2245
2245
|
this._canvas = e, this._opts = t, this._showTrackedChangesExplicit = t.showTrackedChanges !== void 0;
|
|
2246
2246
|
let n = t[Mr];
|
|
2247
|
-
this._borrowed = n !== void 0, this._mode =
|
|
2247
|
+
this._borrowed = n !== void 0, this._mode = Et("DocxViewer", t.mode, n), this._documentOwner = new xt("DocxViewer", n ?? null, !1);
|
|
2248
2248
|
let r = e.ownerDocument?.defaultView ?? (typeof window < "u" ? window : null);
|
|
2249
2249
|
if (!r) throw Error("DocxViewer requires a canvas with an active Window");
|
|
2250
|
-
this._hostWindow = r, this._canvasMount = new
|
|
2250
|
+
this._hostWindow = r, this._canvasMount = new Tt(e, {
|
|
2251
2251
|
wrapperCssText: "position:relative;display:inline-block;vertical-align:top;",
|
|
2252
2252
|
forceDisplayBlock: !0
|
|
2253
|
-
}), this._wrapper = this._canvasMount.wrapper, this._renderDispatcher = new
|
|
2254
|
-
let i = new
|
|
2255
|
-
this._textLayer = i.textLayer, this._highlightLayer = i.highlightLayer, this._elementLayer = i.elementLayer, this._loadingIndicator = new
|
|
2253
|
+
}), this._wrapper = this._canvasMount.wrapper, this._renderDispatcher = new pt(e, this._mode === "worker"), this._errorRouter = new vt("DocxViewer", t.onError);
|
|
2254
|
+
let i = new Ct(this._wrapper, t.enableTextSelection === !0, t.enableElementSelection === !0);
|
|
2255
|
+
this._textLayer = i.textLayer, this._highlightLayer = i.highlightLayer, this._elementLayer = i.elementLayer, this._loadingIndicator = new bt(this._wrapper, "Loading page");
|
|
2256
2256
|
let a = this._wrapper.ownerDocument.createElement("progress");
|
|
2257
2257
|
a.setAttribute("aria-hidden", "true"), this._loadingIndicator.layer.appendChild(a), this._wrapper.insertBefore(this._loadingIndicator.layer, this._elementLayer), this._textLayer && (t.onSelectionContextChange || t.enableElementSelection) && (this._selectionChangeListener = () => this._emitSelectionContextChange(), this._wrapper.ownerDocument.addEventListener("selectionchange", this._selectionChangeListener)), t.enableElementSelection && (this._elementClickListener = (e) => {
|
|
2258
2258
|
this._onElementClick(e).catch((e) => this._reportRenderError(e));
|
|
2259
|
-
}, this._wrapper.addEventListener("click", this._elementClickListener)), t.onContextMenu && (this._contextMenuListener = (e) => this._onContextMenu(e), this._wrapper.addEventListener("contextmenu", this._contextMenuListener)), this._find = new
|
|
2259
|
+
}, this._wrapper.addEventListener("click", this._elementClickListener)), t.onContextMenu && (this._contextMenuListener = (e) => this._onContextMenu(e), this._wrapper.addEventListener("contextmenu", this._contextMenuListener)), this._find = new Er(() => this.pageCount, (e) => this._collectPageRuns(e)), n && this._bindLayoutDocument(n);
|
|
2260
2260
|
}
|
|
2261
2261
|
async load(e) {
|
|
2262
2262
|
if (this._destroyed) throw Error("DocxViewer is destroyed");
|
|
@@ -2267,7 +2267,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2267
2267
|
this._pendingLoadAbort = r, this._pendingRequestedView = n;
|
|
2268
2268
|
try {
|
|
2269
2269
|
let i = await this._documentOwner.replace(async () => {
|
|
2270
|
-
let t = await
|
|
2270
|
+
let t = await Q.load(e, {
|
|
2271
2271
|
password: this._opts.password,
|
|
2272
2272
|
useGoogleFonts: this._opts.useGoogleFonts,
|
|
2273
2273
|
allowFootnoteContinuation: this._opts.allowFootnoteContinuation,
|
|
@@ -2286,7 +2286,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2286
2286
|
mode: this._mode,
|
|
2287
2287
|
...this._opts.progressiveLayout ? { progressiveLayout: !0 } : {},
|
|
2288
2288
|
...this._opts.sliceLayout === void 0 ? {} : { sliceLayout: this._opts.sliceLayout },
|
|
2289
|
-
[
|
|
2289
|
+
[vr]: {
|
|
2290
2290
|
signal: r.signal,
|
|
2291
2291
|
requestedView: () => this._pendingRequestedView,
|
|
2292
2292
|
subscribeViewChange: (e) => (this._pendingViewChanged = e, () => {
|
|
@@ -2300,7 +2300,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2300
2300
|
...this._opts.legacyDoc === void 0 ? void 0 : { legacyDoc: this._opts.legacyDoc },
|
|
2301
2301
|
...this._opts.currentDate === void 0 ? {} : { currentDate: this._opts.currentDate }
|
|
2302
2302
|
});
|
|
2303
|
-
return await
|
|
2303
|
+
return await hr(t, r.signal, () => this._pendingRequestedView, () => this._opts.currentDate, this), t;
|
|
2304
2304
|
}, () => {
|
|
2305
2305
|
this._invalidateElementContext(!1), t = !0, this._renderDispatcher.begin(), this._findRequestGeneration++, this._find.invalidate(), this._unbindLayoutDocument();
|
|
2306
2306
|
});
|
|
@@ -2378,14 +2378,14 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2378
2378
|
return this._opts.zoomMax ?? 4;
|
|
2379
2379
|
}
|
|
2380
2380
|
async setScale(e) {
|
|
2381
|
-
let t =
|
|
2381
|
+
let t = Dt(e, this._zoomMin(), this._zoomMax()), n = t !== this.getScale();
|
|
2382
2382
|
this._scale = t, await this._render(), n && this._opts.onScaleChange?.(t);
|
|
2383
2383
|
}
|
|
2384
2384
|
async zoomIn() {
|
|
2385
|
-
await this.setScale(
|
|
2385
|
+
await this.setScale(mt(this.getScale()));
|
|
2386
2386
|
}
|
|
2387
2387
|
async zoomOut() {
|
|
2388
|
-
await this.setScale(
|
|
2388
|
+
await this.setScale(kt(this.getScale()));
|
|
2389
2389
|
}
|
|
2390
2390
|
async fitWidth() {
|
|
2391
2391
|
await this._fit("width");
|
|
@@ -2397,7 +2397,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2397
2397
|
if (!this._doc || this._doc.pageCount === 0) return;
|
|
2398
2398
|
let t = this._doc.pageSize(this._currentPage), r = this._fitContainer();
|
|
2399
2399
|
if (!r) return;
|
|
2400
|
-
let i =
|
|
2400
|
+
let i = At({
|
|
2401
2401
|
contentWidth: t.widthPt * n,
|
|
2402
2402
|
contentHeight: t.heightPt * n,
|
|
2403
2403
|
containerWidth: r.clientWidth,
|
|
@@ -2438,7 +2438,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2438
2438
|
}
|
|
2439
2439
|
getSelectionContext(e = {}) {
|
|
2440
2440
|
if (this._destroyed) throw Error("DocxViewer is destroyed");
|
|
2441
|
-
return (this._textLayer ?
|
|
2441
|
+
return (this._textLayer ? $(this._wrapper, this._wrapper.ownerDocument?.getSelection?.() ?? null, e) : null) ?? (this._elementContext ? zn(this._elementContext, e.maxTextCharacters) : null);
|
|
2442
2442
|
}
|
|
2443
2443
|
_emitSelectionContextChange() {
|
|
2444
2444
|
let e = this.getSelectionContext();
|
|
@@ -2455,11 +2455,11 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2455
2455
|
_redrawElementOutline() {
|
|
2456
2456
|
let e = this._elementContext, t = this._doc;
|
|
2457
2457
|
if (!e || !t || e.pageIndex !== this._currentPage) {
|
|
2458
|
-
|
|
2458
|
+
yt(this._elementLayer, null);
|
|
2459
2459
|
return;
|
|
2460
2460
|
}
|
|
2461
2461
|
let n = t.pageSize(e.pageIndex);
|
|
2462
|
-
|
|
2462
|
+
yt(this._elementLayer, {
|
|
2463
2463
|
x: e.bounds.xPt / n.widthPt,
|
|
2464
2464
|
y: e.bounds.yPt / n.heightPt,
|
|
2465
2465
|
width: e.bounds.widthPt / n.widthPt,
|
|
@@ -2479,7 +2479,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2479
2479
|
async _resolveContextAt(e) {
|
|
2480
2480
|
let t = this._doc;
|
|
2481
2481
|
if (this._destroyed || !t) return null;
|
|
2482
|
-
if (this._textLayer &&
|
|
2482
|
+
if (this._textLayer && $(this._wrapper, this._wrapper.ownerDocument?.getSelection?.() ?? null)) return this._emitSelectionContextChange(), this._destroyed ? null : this.getSelectionContext();
|
|
2483
2483
|
if (!this._opts.enableElementSelection) return this.getSelectionContext();
|
|
2484
2484
|
let n = this._canvas.getBoundingClientRect();
|
|
2485
2485
|
if (n.width <= 0 || n.height <= 0) return this._invalidateElementContext(), null;
|
|
@@ -2493,7 +2493,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2493
2493
|
}, {
|
|
2494
2494
|
currentDate: this._opts.currentDate,
|
|
2495
2495
|
showTrackedChanges: this._opts.showTrackedChanges,
|
|
2496
|
-
maxTextCharacters:
|
|
2496
|
+
maxTextCharacters: wn
|
|
2497
2497
|
});
|
|
2498
2498
|
} catch (e) {
|
|
2499
2499
|
if (this._destroyed || a !== this._elementHitGeneration || o !== this._currentPage || t !== this._doc) return null;
|
|
@@ -2502,7 +2502,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2502
2502
|
return this._destroyed || a !== this._elementHitGeneration || o !== this._currentPage || t !== this._doc ? null : (this._setElementContext(c), this._destroyed ? null : this.getSelectionContext());
|
|
2503
2503
|
}
|
|
2504
2504
|
destroy() {
|
|
2505
|
-
this._destroyed || (this._destroyed = !0, this._pendingLoadAbort?.abort(), this._pendingLoadAbort = null, this._pendingViewChanged = null, this._findRequestGeneration++, this._layoutViewGeneration++, this._unbindLayoutDocument(), this._errorRouter.close(), this._renderDispatcher.destroy(),
|
|
2505
|
+
this._destroyed || (this._destroyed = !0, this._pendingLoadAbort?.abort(), this._pendingLoadAbort = null, this._pendingViewChanged = null, this._findRequestGeneration++, this._layoutViewGeneration++, this._unbindLayoutDocument(), this._errorRouter.close(), this._renderDispatcher.destroy(), ze(this._canvas), this._documentOwner.close(), this._find.invalidate(), this._selectionChangeListener &&= (this._wrapper.ownerDocument.removeEventListener("selectionchange", this._selectionChangeListener), null), this._elementHitGeneration++, this._elementClickListener &&= (this._wrapper.removeEventListener("click", this._elementClickListener), null), this._contextMenuListener &&= (this._wrapper.removeEventListener("contextmenu", this._contextMenuListener), null), this._elementContext = null, this._canvasMount.restore());
|
|
2506
2506
|
}
|
|
2507
2507
|
async _render() {
|
|
2508
2508
|
let e = this._renderDispatcher.begin();
|
|
@@ -2518,7 +2518,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2518
2518
|
}
|
|
2519
2519
|
async _renderPage(e) {
|
|
2520
2520
|
if (!this._doc) return;
|
|
2521
|
-
let t = this._mode === "worker", n = this._renderWidth(), r = this._doc.pageSize(this._currentPage), i = n ?? r.widthPt * 1.3333333333333333, a = r.widthPt > 0 ? i * r.heightPt / r.widthPt : 0, o = [], s = (e) => o.push(e),
|
|
2521
|
+
let t = this._mode === "worker", n = this._renderWidth(), r = this._doc.pageSize(this._currentPage), i = n ?? r.widthPt * 1.3333333333333333, a = r.widthPt > 0 ? i * r.heightPt / r.widthPt : 0, o = [], s = (e) => o.push(e), c = this._opts.dpr ?? h(), l = {
|
|
2522
2522
|
width: n,
|
|
2523
2523
|
dpr: this._opts.dpr,
|
|
2524
2524
|
imageResources: this._opts.imageResources,
|
|
@@ -2528,20 +2528,20 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2528
2528
|
onTextRun: s
|
|
2529
2529
|
};
|
|
2530
2530
|
if (t) {
|
|
2531
|
-
let t = await
|
|
2531
|
+
let t = await jr(this._doc, this._canvas, this._currentPage, "worker", l);
|
|
2532
2532
|
if (!this._renderDispatcher.commitBitmap(e, t, {
|
|
2533
|
-
cssWidth: i > 0 ? i : Math.round(t.width /
|
|
2534
|
-
cssHeight: a > 0 ? a : Math.round(t.height /
|
|
2533
|
+
cssWidth: i > 0 ? i : Math.round(t.width / c),
|
|
2534
|
+
cssHeight: a > 0 ? a : Math.round(t.height / c)
|
|
2535
2535
|
})) return;
|
|
2536
|
-
} else if (await
|
|
2536
|
+
} else if (await jr(this._doc, this._canvas, this._currentPage, "main", l), !this._renderDispatcher.isCurrent(e)) return;
|
|
2537
2537
|
this._textLayer && this._buildTextLayer(this._textLayer, o), this._find.setPageRuns(this._currentPage, o), this._buildHighlightLayer(o), this._opts.onPageChange?.(this._currentPage, this.pageCount, this.layoutComplete);
|
|
2538
2538
|
}
|
|
2539
2539
|
_clearPresentedPage() {
|
|
2540
|
-
this._renderDispatcher.begin(),
|
|
2540
|
+
this._renderDispatcher.begin(), ze(this._canvas), this._canvas.width = 0, this._canvas.height = 0, this._textLayer?.replaceChildren(), this._find.invalidate();
|
|
2541
2541
|
}
|
|
2542
2542
|
_bindLayoutDocument(e) {
|
|
2543
2543
|
this._unbindLayoutDocument(), this._layoutFailed = !1, this._layoutViewPublicationGeneration = 0;
|
|
2544
|
-
let t =
|
|
2544
|
+
let t = _r(e, (t) => this._onLayoutViewPublication(e, t), (e) => this._reportRenderError(e)), n = !0, r = ur(e, () => ({
|
|
2545
2545
|
pageCount: e.pageCount,
|
|
2546
2546
|
exact: e.layoutComplete,
|
|
2547
2547
|
complete: e.layoutComplete
|
|
@@ -2600,12 +2600,12 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2600
2600
|
let t = this._pendingRequestedView !== e;
|
|
2601
2601
|
this._pendingRequestedView = e, t && this._pendingViewChanged?.();
|
|
2602
2602
|
}
|
|
2603
|
-
let n = this._doc, r = this._opts.legacyDoc === void 0 ? this._opts.showTrackedChanges === !0 : n ?
|
|
2603
|
+
let n = this._doc, r = this._opts.legacyDoc === void 0 ? this._opts.showTrackedChanges === !0 : n ? Y(n).showTrackedChanges : this._opts.showTrackedChanges === !0;
|
|
2604
2604
|
if ((!n || r === e) && (this._showTrackedChangesExplicit = !0, this._opts = {
|
|
2605
2605
|
...this._opts,
|
|
2606
2606
|
showTrackedChanges: e
|
|
2607
2607
|
}), r === e) {
|
|
2608
|
-
n && await
|
|
2608
|
+
n && await X(n, {
|
|
2609
2609
|
showTrackedChanges: e,
|
|
2610
2610
|
currentDate: this._opts.currentDate
|
|
2611
2611
|
}, this);
|
|
@@ -2615,7 +2615,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2615
2615
|
...this._opts,
|
|
2616
2616
|
showTrackedChanges: e
|
|
2617
2617
|
};
|
|
2618
|
-
(!n || await
|
|
2618
|
+
(!n || await X(n, {
|
|
2619
2619
|
showTrackedChanges: e,
|
|
2620
2620
|
currentDate: i.currentDate
|
|
2621
2621
|
}, this)) && (this._destroyed || t !== this._layoutViewGeneration || n !== this._doc || (this._showTrackedChangesExplicit = !0, this._opts = i, this._find.invalidate(), this._currentPage = Math.max(0, Math.min(this._currentPage, this.pageCount - 1)), await this._render()));
|
|
@@ -2624,7 +2624,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2624
2624
|
let t = this._highlightLayer;
|
|
2625
2625
|
if (!t) return;
|
|
2626
2626
|
let { width: n, height: r } = this._canvasCssPx();
|
|
2627
|
-
|
|
2627
|
+
Tr(t, e, this._find.pageHighlights(this._currentPage), n, r, (e) => this._measureForFont(e), this._opts.findHighlightColors);
|
|
2628
2628
|
}
|
|
2629
2629
|
_canvasCssPx() {
|
|
2630
2630
|
return {
|
|
@@ -2649,12 +2649,12 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2649
2649
|
}
|
|
2650
2650
|
_buildTextLayer(e, t) {
|
|
2651
2651
|
let { width: n, height: r } = this._canvasCssPx();
|
|
2652
|
-
|
|
2652
|
+
wr(e, t, n, r, this._hyperlinkHandler(), (e) => this._measureForFont(e), this._currentPage);
|
|
2653
2653
|
}
|
|
2654
2654
|
_hyperlinkHandler() {
|
|
2655
2655
|
return this._opts.enableHyperlinks === !1 ? void 0 : this._opts.onHyperlinkClick || ((e) => {
|
|
2656
2656
|
if (e.kind === "external") {
|
|
2657
|
-
|
|
2657
|
+
C(e.url, void 0, this._hostWindow);
|
|
2658
2658
|
return;
|
|
2659
2659
|
}
|
|
2660
2660
|
let t = this._doc;
|
|
@@ -2691,7 +2691,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2691
2691
|
}
|
|
2692
2692
|
indexPage(e, t, n) {
|
|
2693
2693
|
if (!this.indexedPages.has(e)) {
|
|
2694
|
-
for (let r of n) !this.pageById.has(r.commentId) &&
|
|
2694
|
+
for (let r of n) !this.pageById.has(r.commentId) && W(r, t).length > 0 && this.pageById.set(r.commentId, e);
|
|
2695
2695
|
for (this.indexedPages.add(e); this.indexedPages.has(this.frontier);) this.frontier++;
|
|
2696
2696
|
}
|
|
2697
2697
|
}
|
|
@@ -2741,7 +2741,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2741
2741
|
let l = await this.runsForPage(s, n);
|
|
2742
2742
|
if (this.hooks.destroyed()) throw Error("DocxScrollViewer is destroyed");
|
|
2743
2743
|
if (this.hooks.document() !== n || r !== this.generation || !l) return !1;
|
|
2744
|
-
let u = a.flatMap((e) =>
|
|
2744
|
+
let u = a.flatMap((e) => W(e, l))[0];
|
|
2745
2745
|
return u ? (this.hooks.select(e, s, u, t), !0) : !1;
|
|
2746
2746
|
}
|
|
2747
2747
|
destroy() {
|
|
@@ -2763,7 +2763,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2763
2763
|
}
|
|
2764
2764
|
bind(e) {
|
|
2765
2765
|
this.unbind(), this.viewGeneration = 0, this.prefix = e.pageCount;
|
|
2766
|
-
let t =
|
|
2766
|
+
let t = _r(e, (t) => this.onViewPublication(e, t), this.hooks.report), n = !0, r = ur(e, () => ({
|
|
2767
2767
|
pageCount: e.pageCount,
|
|
2768
2768
|
exact: e.layoutComplete,
|
|
2769
2769
|
complete: e.layoutComplete
|
|
@@ -2807,7 +2807,7 @@ var Mr = Symbol("DocxViewer.borrowedDocument"), Nr = class e {
|
|
|
2807
2807
|
}
|
|
2808
2808
|
}, Ir = 12, Lr = 13, Rr = Symbol("DocxScrollViewer.borrowedDocument"), zr;
|
|
2809
2809
|
function Br() {
|
|
2810
|
-
return zr ??= import("./comment-ui-runtime-
|
|
2810
|
+
return zr ??= import("./comment-ui-runtime-Dk2qrPy_.js");
|
|
2811
2811
|
}
|
|
2812
2812
|
var Vr = class e {
|
|
2813
2813
|
_pendingLoadAbort = null;
|
|
@@ -2832,12 +2832,12 @@ var Vr = class e {
|
|
|
2832
2832
|
return this._shell.spacer;
|
|
2833
2833
|
}
|
|
2834
2834
|
_mode;
|
|
2835
|
-
_viewport = new
|
|
2835
|
+
_viewport = new le({
|
|
2836
2836
|
options: () => this._opts,
|
|
2837
2837
|
container: () => this._container,
|
|
2838
2838
|
scrollHost: () => this._scrollHost
|
|
2839
2839
|
});
|
|
2840
|
-
_zoom = new
|
|
2840
|
+
_zoom = new Se({
|
|
2841
2841
|
scrollHost: () => this._scrollHost,
|
|
2842
2842
|
spacer: () => this._spacer,
|
|
2843
2843
|
count: () => this._doc?.pageCount ?? 0,
|
|
@@ -2876,7 +2876,7 @@ var Vr = class e {
|
|
|
2876
2876
|
get _scaleEstablished() {
|
|
2877
2877
|
return this._zoom.established;
|
|
2878
2878
|
}
|
|
2879
|
-
_scroller = new
|
|
2879
|
+
_scroller = new ue({
|
|
2880
2880
|
spacer: () => this._spacer,
|
|
2881
2881
|
count: () => this._doc?.pageCount ?? 0,
|
|
2882
2882
|
range: () => this._range(),
|
|
@@ -2926,14 +2926,14 @@ var Vr = class e {
|
|
|
2926
2926
|
wantRuns: (e) => !!(this._opts.enableTextSelection && e.textLayer) || this._findActive || !!e.commentTintLayer,
|
|
2927
2927
|
reportError: (e) => this._reportRenderError(e)
|
|
2928
2928
|
};
|
|
2929
|
-
_bitmap = new
|
|
2929
|
+
_bitmap = new fe({
|
|
2930
2930
|
...this._renderHooks,
|
|
2931
2931
|
inFlight: () => this._scroller.inFlight,
|
|
2932
2932
|
destroyed: () => this._destroyed,
|
|
2933
2933
|
width: (e) => this._pageWidthPx(e),
|
|
2934
2934
|
dpr: () => this._viewport.dpr(),
|
|
2935
2935
|
canRetry: () => !0,
|
|
2936
|
-
render: (e, t, n, r, i) =>
|
|
2936
|
+
render: (e, t, n, r, i) => jr(this._doc, t, e, "worker", {
|
|
2937
2937
|
width: n,
|
|
2938
2938
|
dpr: r,
|
|
2939
2939
|
imageResources: this._opts.imageResources,
|
|
@@ -2948,9 +2948,9 @@ var Vr = class e {
|
|
|
2948
2948
|
}),
|
|
2949
2949
|
commitRuns: (e, t, n, r, i) => this._commitRenderedRuns(e, t, n, t.canvas, i, !0)
|
|
2950
2950
|
});
|
|
2951
|
-
_main = new
|
|
2951
|
+
_main = new pe({
|
|
2952
2952
|
...this._renderHooks,
|
|
2953
|
-
render: (e, t, n, r, i) =>
|
|
2953
|
+
render: (e, t, n, r, i) => jr(this._doc, t, e, "main", {
|
|
2954
2954
|
width: n,
|
|
2955
2955
|
dpr: r,
|
|
2956
2956
|
imageResources: this._opts.imageResources,
|
|
@@ -2962,7 +2962,7 @@ var Vr = class e {
|
|
|
2962
2962
|
commitRuns: (e, t, n, r, i, a, o) => this._commitRenderedRuns(e, t, n, r, a, o),
|
|
2963
2963
|
shadow: () => this._pageShadow
|
|
2964
2964
|
});
|
|
2965
|
-
_navigation = new
|
|
2965
|
+
_navigation = new _e({
|
|
2966
2966
|
host: () => this._scrollHost,
|
|
2967
2967
|
spacer: () => this._spacer,
|
|
2968
2968
|
count: () => this.pageCount,
|
|
@@ -2976,7 +2976,7 @@ var Vr = class e {
|
|
|
2976
2976
|
marginOrigin: () => this._commentMargin.originPx,
|
|
2977
2977
|
mount: () => this._mountVisible()
|
|
2978
2978
|
});
|
|
2979
|
-
_selection = new
|
|
2979
|
+
_selection = new ye({
|
|
2980
2980
|
wrapper: () => this._wrapper,
|
|
2981
2981
|
scrollHost: () => this._scrollHost,
|
|
2982
2982
|
slots: () => this._slots,
|
|
@@ -2984,7 +2984,7 @@ var Vr = class e {
|
|
|
2984
2984
|
destroyed: () => this._destroyed,
|
|
2985
2985
|
textSelectionEnabled: () => this._opts.enableTextSelection === !0,
|
|
2986
2986
|
elementSelectionEnabled: () => this._opts.enableElementSelection === !0,
|
|
2987
|
-
textSelected: () =>
|
|
2987
|
+
textSelected: () => $(this._wrapper, this._wrapper.ownerDocument?.getSelection?.() ?? null) !== null,
|
|
2988
2988
|
getContext: () => this.getSelectionContext(),
|
|
2989
2989
|
hitTest: (e, t, n, r) => {
|
|
2990
2990
|
let i = e.pageSize(t);
|
|
@@ -2994,7 +2994,7 @@ var Vr = class e {
|
|
|
2994
2994
|
}, {
|
|
2995
2995
|
currentDate: this._currentDate,
|
|
2996
2996
|
...this._showTrackedChanges ? { showTrackedChanges: !0 } : {},
|
|
2997
|
-
maxTextCharacters:
|
|
2997
|
+
maxTextCharacters: wn
|
|
2998
2998
|
});
|
|
2999
2999
|
},
|
|
3000
3000
|
outline: (e, t, n) => {
|
|
@@ -3019,8 +3019,8 @@ var Vr = class e {
|
|
|
3019
3019
|
offsets: [],
|
|
3020
3020
|
totalHeight: 0
|
|
3021
3021
|
};
|
|
3022
|
-
_visibleEvents = new
|
|
3023
|
-
_loader = new
|
|
3022
|
+
_visibleEvents = new be((e, t, n) => this._opts.onVisiblePageChange?.(e, t, n));
|
|
3023
|
+
_loader = new se({
|
|
3024
3024
|
name: () => "DocxScrollViewer",
|
|
3025
3025
|
borrowed: () => this._borrowed,
|
|
3026
3026
|
borrowedMessage: () => "DocxScrollViewer.load() is unsupported on a Viewer created by fromDocument(); the borrowed document is already loaded.",
|
|
@@ -3037,7 +3037,7 @@ var Vr = class e {
|
|
|
3037
3037
|
this._pendingLoadAbort === e && (this._pendingLoadAbort = null, this._pendingRequestedView = void 0, this._pendingViewChanged = null);
|
|
3038
3038
|
},
|
|
3039
3039
|
acquire: async (e, t) => {
|
|
3040
|
-
let n = this._pendingRequestedView, r = await
|
|
3040
|
+
let n = this._pendingRequestedView, r = await Q.load(e, {
|
|
3041
3041
|
password: this._opts.password,
|
|
3042
3042
|
useGoogleFonts: this._opts.useGoogleFonts,
|
|
3043
3043
|
allowFootnoteContinuation: this._opts.allowFootnoteContinuation,
|
|
@@ -3059,7 +3059,7 @@ var Vr = class e {
|
|
|
3059
3059
|
...this._opts.legacyDoc === void 0 ? void 0 : { legacyDoc: this._opts.legacyDoc },
|
|
3060
3060
|
...this._opts.progressiveLayout ? { progressiveLayout: !0 } : {},
|
|
3061
3061
|
...this._opts.sliceLayout === void 0 ? {} : { sliceLayout: this._opts.sliceLayout },
|
|
3062
|
-
[
|
|
3062
|
+
[vr]: {
|
|
3063
3063
|
signal: t.signal,
|
|
3064
3064
|
requestedView: () => this._pendingRequestedView,
|
|
3065
3065
|
subscribeViewChange: (e) => (this._pendingViewChanged = e, () => {
|
|
@@ -3070,7 +3070,7 @@ var Vr = class e {
|
|
|
3070
3070
|
onLayoutPartial: this._opts.onLayoutPartial,
|
|
3071
3071
|
onLayoutComplete: this._opts.onLayoutComplete
|
|
3072
3072
|
});
|
|
3073
|
-
return await
|
|
3073
|
+
return await hr(r, t.signal, () => this._pendingRequestedView, () => this._currentDate, this), r;
|
|
3074
3074
|
},
|
|
3075
3075
|
beforeReplace: (e) => {
|
|
3076
3076
|
if (this._selection.invalidateElementContext(!1), this._findRequestGeneration++, this._find.invalidate(), this._findActive = !1, this._activeCommentId = null, this._activeCommentPage = null, this._commentNavigation.reset(), this._layout.unbind(), e) {
|
|
@@ -3079,7 +3079,7 @@ var Vr = class e {
|
|
|
3079
3079
|
}
|
|
3080
3080
|
},
|
|
3081
3081
|
afterReplace: (e) => {
|
|
3082
|
-
this._pendingRequestedView !== void 0 && (this._showTrackedChanges = this._pendingRequestedView, this._requestedShowTrackedChanges = this._pendingRequestedView), this._opts.legacyDoc !== void 0 && (this._showTrackedChanges =
|
|
3082
|
+
this._pendingRequestedView !== void 0 && (this._showTrackedChanges = this._pendingRequestedView, this._requestedShowTrackedChanges = this._pendingRequestedView), this._opts.legacyDoc !== void 0 && (this._showTrackedChanges = Y(e).showTrackedChanges), this._layout.bind(e), this._find.invalidate(), this._findActive = !1, this._activeCommentId = null, this._activeCommentPage = null, this._commentNavigation.reset();
|
|
3083
3083
|
},
|
|
3084
3084
|
mountOpeningWindow: async () => {
|
|
3085
3085
|
let e = [];
|
|
@@ -3093,7 +3093,7 @@ var Vr = class e {
|
|
|
3093
3093
|
_internalHyperlinkGeneration = 0;
|
|
3094
3094
|
_commentAnchorRangesForMargin = null;
|
|
3095
3095
|
_commentAnchorIds = /* @__PURE__ */ new Set();
|
|
3096
|
-
_commentMargin = new
|
|
3096
|
+
_commentMargin = new me({
|
|
3097
3097
|
container: () => this._container,
|
|
3098
3098
|
scrollHost: () => this._scrollHost,
|
|
3099
3099
|
spacer: () => this._spacer,
|
|
@@ -3106,7 +3106,7 @@ var Vr = class e {
|
|
|
3106
3106
|
widthPx: 280,
|
|
3107
3107
|
fontSizePx: Lr
|
|
3108
3108
|
});
|
|
3109
|
-
_layers = new
|
|
3109
|
+
_layers = new we({
|
|
3110
3110
|
markerLayer: (e) => e.commentTintLayer,
|
|
3111
3111
|
syncMargin: (e) => this._commentMargin.syncMargin(e),
|
|
3112
3112
|
marginSide: () => this._commentMargin.side(),
|
|
@@ -3138,7 +3138,7 @@ var Vr = class e {
|
|
|
3138
3138
|
this._selection.emitChange();
|
|
3139
3139
|
}
|
|
3140
3140
|
});
|
|
3141
|
-
_commentOverlay = new
|
|
3141
|
+
_commentOverlay = new Ce({
|
|
3142
3142
|
slots: () => this._slots,
|
|
3143
3143
|
scale: () => this._scale,
|
|
3144
3144
|
destroyed: () => this._destroyed,
|
|
@@ -3165,14 +3165,14 @@ var Vr = class e {
|
|
|
3165
3165
|
this._zoom.prevBase = e;
|
|
3166
3166
|
}
|
|
3167
3167
|
_pageShadow;
|
|
3168
|
-
_find = new
|
|
3168
|
+
_find = new Er(() => this.pageCount, (e) => this._collectPageRuns(e));
|
|
3169
3169
|
_findActive = !1;
|
|
3170
|
-
_highlights = new
|
|
3170
|
+
_highlights = new oe({
|
|
3171
3171
|
slots: () => this._slots,
|
|
3172
3172
|
active: () => this._findActive,
|
|
3173
3173
|
runs: (e) => this._find.pageRuns(e),
|
|
3174
3174
|
setRuns: (e, t) => this._find.setPageRuns(e, t),
|
|
3175
|
-
paint: (e, t, n, r) =>
|
|
3175
|
+
paint: (e, t, n, r) => Tr(t.highlightLayer, n, this._find.pageHighlights(e), this._pageWidthPx(e), this._pageHeightPx(e), r, this._opts.findHighlightColors),
|
|
3176
3176
|
reveal: (e) => this.scrollToPage(e),
|
|
3177
3177
|
unitOf: (e) => e.page
|
|
3178
3178
|
});
|
|
@@ -3181,7 +3181,7 @@ var Vr = class e {
|
|
|
3181
3181
|
_currentDate;
|
|
3182
3182
|
_layoutViewGeneration = 0;
|
|
3183
3183
|
static fromDocument(t, n, r = {}) {
|
|
3184
|
-
let i =
|
|
3184
|
+
let i = Y(n);
|
|
3185
3185
|
return new e(t, {
|
|
3186
3186
|
...r,
|
|
3187
3187
|
currentDate: i.currentDate,
|
|
@@ -3191,9 +3191,9 @@ var Vr = class e {
|
|
|
3191
3191
|
}
|
|
3192
3192
|
constructor(e, t = {}) {
|
|
3193
3193
|
if (e.tagName === "CANVAS") throw Error("DocxScrollViewer takes a container element (e.g. a <div>), not a <canvas> — the viewer creates and manages its own canvases. Pass a block container; for the single-page canvas API use DocxViewer.");
|
|
3194
|
-
this._container = e, this._opts = t, this._errorRouter = new
|
|
3194
|
+
this._container = e, this._opts = t, this._errorRouter = new vt("DocxScrollViewer", t.onError), this._showTrackedChanges = t.showTrackedChanges === !0, t.legacyDoc !== void 0 && (this._requestedShowTrackedChanges = t.showTrackedChanges), this._currentDate = t.currentDate, this._pageShadow = t.pageShadow ?? "0 1px 3px rgba(0,0,0,0.2)";
|
|
3195
3195
|
let n = t[Rr];
|
|
3196
|
-
this._borrowed = n !== void 0, n ? (this._documentOwner = new
|
|
3196
|
+
this._borrowed = n !== void 0, n ? (this._documentOwner = new xt("DocxScrollViewer", n, !1), this._mode = Et("DocxScrollViewer", t.mode, n)) : (this._documentOwner = new xt("DocxScrollViewer"), this._mode = Et("DocxScrollViewer", t.mode, void 0)), this._shell = new Te(e, {
|
|
3197
3197
|
background: t.background,
|
|
3198
3198
|
comments: !!t.comments,
|
|
3199
3199
|
onScroll: () => this._onScroll(),
|
|
@@ -3287,7 +3287,7 @@ var Vr = class e {
|
|
|
3287
3287
|
_recomputeHeights() {
|
|
3288
3288
|
let e = Math.min(this._layout.presentedPageCount, this._doc.pageCount), t = Array(e);
|
|
3289
3289
|
for (let n = 0; n < e; n++) t[n] = this._pageHeightPx(n);
|
|
3290
|
-
this._heights = t, this._scrollGeometry =
|
|
3290
|
+
this._heights = t, this._scrollGeometry = te(t, this._viewport.gap(), this._viewport.verticalPadding());
|
|
3291
3291
|
}
|
|
3292
3292
|
_pageIndexAtOffset(e, t) {
|
|
3293
3293
|
let { offsets: n } = e, r = 0, i = n.length - 1, a = 0;
|
|
@@ -3298,7 +3298,7 @@ var Vr = class e {
|
|
|
3298
3298
|
return a;
|
|
3299
3299
|
}
|
|
3300
3300
|
_range() {
|
|
3301
|
-
return
|
|
3301
|
+
return ge(this._scrollGeometry, this._scrollHost.scrollTop, this._scrollHost.clientHeight, this._viewport.overscan());
|
|
3302
3302
|
}
|
|
3303
3303
|
_syncSpacer() {
|
|
3304
3304
|
this._scroller.syncSpacer();
|
|
@@ -3321,7 +3321,7 @@ var Vr = class e {
|
|
|
3321
3321
|
this._doc && this._visibleEvents.publish(e, this._doc.pageCount, this.layoutComplete);
|
|
3322
3322
|
}
|
|
3323
3323
|
_createSlot() {
|
|
3324
|
-
let { wrapper: e, canvas: t, textLayer: n, highlightLayer: r } =
|
|
3324
|
+
let { wrapper: e, canvas: t, textLayer: n, highlightLayer: r } = ve(this._scrollHost, this._opts.enableTextSelection === !0, this._pageShadow), { markerLayer: i, margin: a, decorationLayer: o } = xe(e, this._commentsEnabled(), this._commentsOptions()?.cards !== !1, this._commentsOptions()?.connectors !== void 0, (e) => this._commentMargin.syncMargin(e)), s = wt(e, this._opts.enableElementSelection === !0);
|
|
3325
3325
|
return this._scrollHost.appendChild(e), {
|
|
3326
3326
|
wrapper: e,
|
|
3327
3327
|
canvas: t,
|
|
@@ -3335,14 +3335,14 @@ var Vr = class e {
|
|
|
3335
3335
|
commentGeometry: null,
|
|
3336
3336
|
renderedPage: -1,
|
|
3337
3337
|
renderedScale: -1,
|
|
3338
|
-
dispatcher: new
|
|
3338
|
+
dispatcher: new pt(t, this._mode === "worker")
|
|
3339
3339
|
};
|
|
3340
3340
|
}
|
|
3341
3341
|
_recycleSlot(e, t) {
|
|
3342
3342
|
this._scroller.recycleSlot(e, t);
|
|
3343
3343
|
}
|
|
3344
3344
|
_resetSlot(e, t) {
|
|
3345
|
-
t.dispatcher.destroy(), this._destroyed || (t.dispatcher = new
|
|
3345
|
+
t.dispatcher.destroy(), this._destroyed || (t.dispatcher = new pt(t.canvas, this._mode === "worker")), this._layers.reset(t), t.commentRuns = Object.freeze([]), t.commentGeometry = null, t.renderedPage = -1, t.renderedScale = -1, t.wrapper.remove();
|
|
3346
3346
|
}
|
|
3347
3347
|
_positionSlot(e, t, n) {
|
|
3348
3348
|
this._layers.position(t, e, n.offsets[t], this._pageWidthPx(t), this._pageHeightPx(t), this._scrollHost.clientWidth, this._viewport.horizontalPadding().left);
|
|
@@ -3356,7 +3356,7 @@ var Vr = class e {
|
|
|
3356
3356
|
_hyperlinkHandler() {
|
|
3357
3357
|
return this._opts.enableHyperlinks === !1 ? void 0 : this._opts.onHyperlinkClick || ((e) => {
|
|
3358
3358
|
if (e.kind === "external") {
|
|
3359
|
-
|
|
3359
|
+
C(e.url);
|
|
3360
3360
|
return;
|
|
3361
3361
|
}
|
|
3362
3362
|
let t = this._doc;
|
|
@@ -3379,7 +3379,7 @@ var Vr = class e {
|
|
|
3379
3379
|
_commitRenderedRuns(e, t, n, r, i, a) {
|
|
3380
3380
|
if (t.textLayer && (a && this._clearTextLayerPreview(t.textLayer), this._opts.enableTextSelection)) {
|
|
3381
3381
|
let { width: i, height: a } = this._canvasCssPx(r);
|
|
3382
|
-
|
|
3382
|
+
wr(t.textLayer, n, i, a, this._hyperlinkHandler(), (e) => this._highlights.measure(e), e);
|
|
3383
3383
|
}
|
|
3384
3384
|
i && this._highlights.refreshRuns(e, n), this._commitCommentRuns(e, t, n), this._highlights.redrawSlot(e, t);
|
|
3385
3385
|
}
|
|
@@ -3414,7 +3414,7 @@ var Vr = class e {
|
|
|
3414
3414
|
this._positionSlot(e, t, n), this._layers.preview(e, this._pageWidthPx(t), this._pageHeightPx(t), this._scale);
|
|
3415
3415
|
}
|
|
3416
3416
|
_clearTextLayerPreview(e) {
|
|
3417
|
-
|
|
3417
|
+
de(e);
|
|
3418
3418
|
}
|
|
3419
3419
|
_scheduleSettle() {
|
|
3420
3420
|
this._scroller.scheduleSettle(150);
|
|
@@ -3436,13 +3436,13 @@ var Vr = class e {
|
|
|
3436
3436
|
}
|
|
3437
3437
|
let n = this._doc;
|
|
3438
3438
|
if (this._opts.legacyDoc !== void 0 && (this._requestedShowTrackedChanges = e), this._showTrackedChanges === e) {
|
|
3439
|
-
n && await
|
|
3439
|
+
n && await X(n, {
|
|
3440
3440
|
showTrackedChanges: e,
|
|
3441
3441
|
currentDate: this._currentDate
|
|
3442
3442
|
}, this);
|
|
3443
3443
|
return;
|
|
3444
3444
|
}
|
|
3445
|
-
(!n || await
|
|
3445
|
+
(!n || await X(n, {
|
|
3446
3446
|
showTrackedChanges: e,
|
|
3447
3447
|
currentDate: this._currentDate
|
|
3448
3448
|
}, this)) && (this._destroyed || t !== this._layoutViewGeneration || n !== this._doc || (this._showTrackedChanges = e, this._opts.legacyDoc !== void 0 && (this._requestedShowTrackedChanges = e), this._find.invalidate(), this._layout.apply({
|
|
@@ -3519,7 +3519,7 @@ var Vr = class e {
|
|
|
3519
3519
|
}
|
|
3520
3520
|
getSelectionContext(e = {}) {
|
|
3521
3521
|
if (this._destroyed) throw Error("DocxScrollViewer is destroyed");
|
|
3522
|
-
return (this._doc && this._activeCommentId !== null && this._activeCommentPage !== null ?
|
|
3522
|
+
return (this._doc && this._activeCommentId !== null && this._activeCommentPage !== null ? Dr(this._doc.comments, this._doc.commentAnchorRanges(), this._activeCommentId, this._activeCommentPage, e) : null) || ((this._opts.enableTextSelection ? $(this._wrapper, this._wrapper.ownerDocument?.getSelection?.() ?? null, e) : null) ?? (this._selection.elementContext ? zn(this._selection.elementContext, e.maxTextCharacters) : null));
|
|
3523
3523
|
}
|
|
3524
3524
|
destroy() {
|
|
3525
3525
|
this._destroyed || (this._destroyed = !0, this._pendingLoadAbort?.abort(), this._pendingLoadAbort = null, this._pendingViewChanged = null, this._findRequestGeneration++, this._errorRouter.close(), this._layout.unbind(), this._layoutViewGeneration++, this._commentNavigation.reset(), this._find.invalidate(), this._findActive = !1, this._selection.destroy(), this._highlights.destroy(), this._commentOverlay.destroy(), this._selection.clearElementContext(), this._scroller.destroy(), this._zoom.destroy(), this._commentMargin.destroy(), this._documentOwner.close(), this._shell.destroy());
|
|
@@ -3540,24 +3540,24 @@ function Hr(e) {
|
|
|
3540
3540
|
//#endregion
|
|
3541
3541
|
//#region src/docx.ts
|
|
3542
3542
|
var Ur = /* @__PURE__ */ e({
|
|
3543
|
-
DocxDocument: () =>
|
|
3543
|
+
DocxDocument: () => Q,
|
|
3544
3544
|
DocxScrollViewer: () => Vr,
|
|
3545
3545
|
DocxViewer: () => Nr,
|
|
3546
|
-
OoxmlDecodedImageLimitError: () =>
|
|
3547
|
-
OoxmlError: () =>
|
|
3548
|
-
OoxmlResourceLimitError: () =>
|
|
3549
|
-
TiffDecodeError: () =>
|
|
3550
|
-
autoResize: () =>
|
|
3551
|
-
buildDocxHighlightLayer: () =>
|
|
3552
|
-
buildDocxTextLayer: () =>
|
|
3553
|
-
isOoxmlDecodedImageLimitError: () =>
|
|
3554
|
-
isTiffDecodeError: () =>
|
|
3546
|
+
OoxmlDecodedImageLimitError: () => st,
|
|
3547
|
+
OoxmlError: () => r,
|
|
3548
|
+
OoxmlResourceLimitError: () => i,
|
|
3549
|
+
TiffDecodeError: () => lt,
|
|
3550
|
+
autoResize: () => ut,
|
|
3551
|
+
buildDocxHighlightLayer: () => Tr,
|
|
3552
|
+
buildDocxTextLayer: () => wr,
|
|
3553
|
+
isOoxmlDecodedImageLimitError: () => ot,
|
|
3554
|
+
isTiffDecodeError: () => ct,
|
|
3555
3555
|
noteText: () => Hr,
|
|
3556
|
-
openExternalHyperlink: () =>
|
|
3557
|
-
readDocxTextSelectionContext: () =>
|
|
3558
|
-
resolveCommentAnchorRuns: () =>
|
|
3559
|
-
resolveDocxCommentThreads: () =>
|
|
3560
|
-
resolveRevisionAnchorRuns: () =>
|
|
3556
|
+
openExternalHyperlink: () => C,
|
|
3557
|
+
readDocxTextSelectionContext: () => $,
|
|
3558
|
+
resolveCommentAnchorRuns: () => W,
|
|
3559
|
+
resolveDocxCommentThreads: () => $n,
|
|
3560
|
+
resolveRevisionAnchorRuns: () => sr
|
|
3561
3561
|
});
|
|
3562
3562
|
//#endregion
|
|
3563
|
-
export {
|
|
3563
|
+
export { sn as _, $ as a, Q as c, sr as d, W as f, L as g, mn as h, Nr as i, q as l, xn as m, Hr as n, Tr as o, $n as p, Vr as r, wr as s, Ur as t, lr as u };
|