kindy-editor 3.2.6 → 3.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/assets/{worker-B7ALyZOw.js → worker-DjZBUOhB.js} +1009 -997
- package/dist-lib/assets/{worker-z-dyEi8F.js → worker-Du8hmveE.js} +2234 -2222
- package/dist-lib/builder.js +4 -4
- package/dist-lib/events.js +9 -120
- package/dist-lib/export.js +9 -11
- package/dist-lib/generate-toc.js +3 -3
- package/dist-lib/import.js +2 -2
- package/dist-lib/index-D5dkvB0x.js +490 -0
- package/dist-lib/{editorApp-Bu3dbUIU.js → kindy-editor-T1YCQdwF.js} +13483 -11185
- package/dist-lib/kindy-editor.js +4 -4
- package/dist-lib/measure.js +3 -4
- package/dist-lib/{measureHost-CpqJsipA.js → measureHost-BG9FPivu.js} +17 -18
- package/dist-lib/{paintStyle-Cb7IGKPW.js → metrics-D7Ma2xlj.js} +175 -148
- package/dist-lib/{parse-CKw-ZDr9.js → parse-BsUkqk-n.js} +3 -3
- package/dist-lib/{pipeline-BkC7G8gU.js → pipeline-CX_Hc5BD.js} +850 -837
- package/dist-lib/{qrcode-oNwKusWD.js → qrcode--5MhVNEZ.js} +1 -1
- package/dist-lib/{qrcode-efBlPzzh.js → qrcode-CR8i1-w0.js} +11 -11
- package/dist-lib/recalc-docx.js +1 -1
- package/dist-lib/{recalcToc-Bc8V9Ecn.js → recalcToc-zAFS4S6S.js} +755 -742
- package/dist-lib/{stylesheet-BT1DGhnx.js → stylesheet-BfxJTGA5.js} +1 -1
- package/dist-lib/{webmcp-ClHEa6Gq.js → webmcp-Ds469lXP.js} +2 -2
- package/docs/find-and-replace.md +224 -0
- package/docs/security-review.md +26 -0
- package/docs/table-editing.md +17 -2
- package/docs/table-form-integration.md +53 -1
- package/package.json +6 -6
- package/types/import.d.ts +7 -0
- package/types/kindy-editor.d.ts +30 -0
- package/dist-lib/changeAggregator-ZI959nPP.js +0 -376
- package/dist-lib/kindy-editor-CToKn_gP.js +0 -2171
- package/dist-lib/metrics-CdfHD-8y.js +0 -31
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as ne, D as oe,
|
|
2
|
-
import { h as je, e as f, b as h, n as y, v as nt, o as Z, c as dt, p as
|
|
3
|
-
import { u as ie, s as
|
|
4
|
-
function
|
|
1
|
+
import { t as ne, D as oe, n as Me, o as We, r as $e } from "./qrcode-CR8i1-w0.js";
|
|
2
|
+
import { h as je, e as f, b as h, n as y, v as nt, o as Z, c as dt, p as yt, r as wt, d as ot, t as It, I as kt, g as Et, f as Ge, W as Ue } from "./contentTypes-ChqPfcVI.js";
|
|
3
|
+
import { u as ie, s as Ve } from "./browser-ODPzT3Lm.js";
|
|
4
|
+
function Ae() {
|
|
5
5
|
return { type: "row", children: [] };
|
|
6
6
|
}
|
|
7
7
|
function se(t) {
|
|
@@ -47,7 +47,7 @@ function Ct(t) {
|
|
|
47
47
|
return se(t).map(Ct).join("");
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
const
|
|
50
|
+
const Xe = /* @__PURE__ */ new Set([
|
|
51
51
|
"TOC",
|
|
52
52
|
"PAGE",
|
|
53
53
|
"NUMPAGES",
|
|
@@ -108,43 +108,43 @@ const Ve = /* @__PURE__ */ new Set([
|
|
|
108
108
|
"LINK",
|
|
109
109
|
"NOTEREF"
|
|
110
110
|
]);
|
|
111
|
-
function Xe(t) {
|
|
112
|
-
return Ve.has(t.trim().toUpperCase());
|
|
113
|
-
}
|
|
114
111
|
function Ye(t) {
|
|
112
|
+
return Xe.has(t.trim().toUpperCase());
|
|
113
|
+
}
|
|
114
|
+
function qe(t) {
|
|
115
115
|
const e = [], n = /"([^"]*)"|(\S+)/g;
|
|
116
116
|
let o;
|
|
117
117
|
for (; (o = n.exec(t)) !== null; ) e.push(o[1] !== void 0 ? o[1] : o[2]);
|
|
118
118
|
return e;
|
|
119
119
|
}
|
|
120
120
|
function te(t) {
|
|
121
|
-
const e =
|
|
121
|
+
const e = qe(t);
|
|
122
122
|
return { name: e.length > 0 ? e[0].toUpperCase() : "", args: e.slice(1), raw: t };
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function Ke(t) {
|
|
125
125
|
const e = te(t).name;
|
|
126
|
-
return e.length > 0 && !
|
|
126
|
+
return e.length > 0 && !Ye(e);
|
|
127
127
|
}
|
|
128
|
-
const re = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], ae = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
|
128
|
+
const re = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], ae = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], Je = (t) => t.map((e) => ({ text: e.text, style: { ...e.style } })), Ze = (t) => t && t !== "arabic" ? `:${t}` : "", Qe = (t) => t === "roman" ? " \\* roman" : t === "Roman" ? " \\* ROMAN" : t === "alpha" ? " \\* alphabetic" : t === "Alpha" ? " \\* ALPHABETIC" : "";
|
|
129
129
|
function ce(t, e) {
|
|
130
130
|
const n = (a, r = 2) => String(a).padStart(r, "0"), o = (t.getHours() + 11) % 12 + 1;
|
|
131
131
|
let i = "", s = 0;
|
|
132
132
|
for (; s < e.length; ) {
|
|
133
133
|
if (e[s] === "'") {
|
|
134
|
-
const
|
|
135
|
-
if (
|
|
134
|
+
const d = e.indexOf("'", s + 1);
|
|
135
|
+
if (d < 0) {
|
|
136
136
|
i += e.slice(s + 1);
|
|
137
137
|
break;
|
|
138
138
|
}
|
|
139
|
-
i += e.slice(s + 1,
|
|
139
|
+
i += e.slice(s + 1, d), s = d + 1;
|
|
140
140
|
continue;
|
|
141
141
|
}
|
|
142
|
-
const a = e.slice(s), r = (
|
|
142
|
+
const a = e.slice(s), r = (d) => a.startsWith(d);
|
|
143
143
|
r("yyyy") ? (i += n(t.getFullYear(), 4), s += 4) : r("yy") ? (i += n(t.getFullYear() % 100), s += 2) : r("MMMM") ? (i += re[t.getMonth()], s += 4) : r("MMM") ? (i += re[t.getMonth()].slice(0, 3), s += 3) : r("MM") ? (i += n(t.getMonth() + 1), s += 2) : r("M") ? (i += String(t.getMonth() + 1), s += 1) : r("dddd") ? (i += ae[t.getDay()], s += 4) : r("ddd") ? (i += ae[t.getDay()].slice(0, 3), s += 3) : r("dd") ? (i += n(t.getDate()), s += 2) : r("d") ? (i += String(t.getDate()), s += 1) : r("HH") ? (i += n(t.getHours()), s += 2) : r("H") ? (i += String(t.getHours()), s += 1) : r("hh") ? (i += n(o), s += 2) : r("h") ? (i += String(o), s += 1) : r("mm") ? (i += n(t.getMinutes()), s += 2) : r("m") ? (i += String(t.getMinutes()), s += 1) : r("ss") ? (i += n(t.getSeconds()), s += 2) : r("s") ? (i += String(t.getSeconds()), s += 1) : r("AM/PM") ? (i += t.getHours() < 12 ? "AM" : "PM", s += 5) : r("am/pm") ? (i += t.getHours() < 12 ? "am" : "pm", s += 5) : (i += e[s], s += 1);
|
|
144
144
|
}
|
|
145
145
|
return i;
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function tn(t, e, n) {
|
|
148
148
|
const o = Number(t), i = Number(n), s = t.trim() !== "" && n.trim() !== "" && Number.isFinite(o) && Number.isFinite(i), [a, r] = s ? [o, i] : [t, n];
|
|
149
149
|
switch (e) {
|
|
150
150
|
case "=":
|
|
@@ -161,13 +161,13 @@ function Qe(t, e, n) {
|
|
|
161
161
|
return a >= r;
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
return
|
|
164
|
+
function en(t) {
|
|
165
|
+
return Je(tn(t.operandA, t.op, t.operandB) ? t.trueRuns : t.falseRuns);
|
|
166
166
|
}
|
|
167
|
-
function
|
|
167
|
+
function Vo(t, e, n) {
|
|
168
168
|
switch (t.type) {
|
|
169
169
|
case "PAGE":
|
|
170
|
-
return { kind: "token", token: `{page${
|
|
170
|
+
return { kind: "token", token: `{page${Ze(t.numFmt)}}` };
|
|
171
171
|
case "NUMPAGES":
|
|
172
172
|
return { kind: "token", token: "{pages}" };
|
|
173
173
|
case "DATE":
|
|
@@ -175,10 +175,10 @@ function jo(t, e, n) {
|
|
|
175
175
|
case "TIME":
|
|
176
176
|
return { kind: "runs", runs: [{ text: ce(n.now, t.format), style: { ...e } }] };
|
|
177
177
|
case "IF":
|
|
178
|
-
return { kind: "runs", runs:
|
|
178
|
+
return { kind: "runs", runs: en(t) };
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
const
|
|
181
|
+
const nn = /* @__PURE__ */ new Set(["=", "<>", "<", ">", "<=", ">="]);
|
|
182
182
|
function de(t) {
|
|
183
183
|
if (/\\\*\s*ROMAN\b/.test(t)) return "Roman";
|
|
184
184
|
if (/\\\*\s*roman\b/.test(t)) return "roman";
|
|
@@ -188,7 +188,7 @@ function de(t) {
|
|
|
188
188
|
function le(t) {
|
|
189
189
|
return t.match(/\\@\s*"([^"]*)"/)?.[1] ?? t.match(/\\@\s*(\S+)/)?.[1];
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function on(t, e) {
|
|
192
192
|
switch (t.name) {
|
|
193
193
|
case "PAGE": {
|
|
194
194
|
const n = de(t.raw);
|
|
@@ -204,7 +204,7 @@ function nn(t, e) {
|
|
|
204
204
|
return { type: "TIME", format: le(t.raw) ?? "h:mm AM/PM" };
|
|
205
205
|
case "IF": {
|
|
206
206
|
const [n, o, i, s, a] = t.args;
|
|
207
|
-
return n === void 0 || o === void 0 || i === void 0 || !
|
|
207
|
+
return n === void 0 || o === void 0 || i === void 0 || !nn.has(o) ? void 0 : {
|
|
208
208
|
type: "IF",
|
|
209
209
|
operandA: n,
|
|
210
210
|
op: o,
|
|
@@ -217,10 +217,10 @@ function nn(t, e) {
|
|
|
217
217
|
return;
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function Xo(t) {
|
|
221
221
|
switch (t.type) {
|
|
222
222
|
case "PAGE":
|
|
223
|
-
return ` PAGE${
|
|
223
|
+
return ` PAGE${Qe(t.numFmt)} \\* MERGEFORMAT `;
|
|
224
224
|
case "NUMPAGES":
|
|
225
225
|
return " NUMPAGES \\* MERGEFORMAT ";
|
|
226
226
|
case "DATE":
|
|
@@ -231,17 +231,17 @@ function Go(t) {
|
|
|
231
231
|
return ` IF ${t.operandA} ${t.op} ${t.operandB} "${ne(t.trueRuns)}" "${ne(t.falseRuns)}" `;
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
-
const
|
|
234
|
+
const St = (t) => {
|
|
235
235
|
const e = t.indexOf(":");
|
|
236
236
|
return e === -1 ? t : t.slice(e + 1);
|
|
237
|
-
}, lt = (t) => t.children.filter(je), gt = (t, e) => lt(t).find((n) =>
|
|
237
|
+
}, lt = (t) => t.children.filter(je), gt = (t, e) => lt(t).find((n) => St(n.tagName) === e), Yo = (t) => {
|
|
238
238
|
let e = "";
|
|
239
239
|
for (const n of t.children) typeof n == "string" && (e += n);
|
|
240
240
|
return e.trim();
|
|
241
241
|
}, Xt = (t, e) => {
|
|
242
242
|
const n = t.attributes[e];
|
|
243
243
|
return n === void 0 ? void 0 : n ?? "";
|
|
244
|
-
},
|
|
244
|
+
}, vt = (t, e) => {
|
|
245
245
|
const n = gt(t, e);
|
|
246
246
|
if (n)
|
|
247
247
|
return Xt(n, "m:val") ?? Xt(n, "w:val") ?? "";
|
|
@@ -250,12 +250,12 @@ const Tt = (t) => {
|
|
|
250
250
|
if (!n) return !1;
|
|
251
251
|
const o = Xt(n, "m:val") ?? Xt(n, "w:val");
|
|
252
252
|
return o === void 0 || !["0", "false", "off"].includes(o);
|
|
253
|
-
},
|
|
254
|
-
top: I(
|
|
255
|
-
right: I(
|
|
256
|
-
bottom: I(
|
|
257
|
-
left: I(
|
|
258
|
-
}),
|
|
253
|
+
}, D = (t) => t / 15, $t = (t) => t * 2 / 3, Lt = (t) => t / 9525, sn = (t) => t / 240, I = (t) => Math.round(t * 100) / 100, Ot = (t) => Math.round(t * 1e4) / 1e4, Dt = (t) => ({
|
|
254
|
+
top: I(D(t.top)),
|
|
255
|
+
right: I(D(t.right)),
|
|
256
|
+
bottom: I(D(t.bottom)),
|
|
257
|
+
left: I(D(t.left))
|
|
258
|
+
}), rn = [
|
|
259
259
|
["top", "w:top"],
|
|
260
260
|
["left", "w:left"],
|
|
261
261
|
["bottom", "w:bottom"],
|
|
@@ -266,7 +266,7 @@ const Tt = (t) => {
|
|
|
266
266
|
function Yt(t) {
|
|
267
267
|
if (!t) return;
|
|
268
268
|
const e = {};
|
|
269
|
-
for (const [n, o] of
|
|
269
|
+
for (const [n, o] of rn) {
|
|
270
270
|
const i = f(t, o);
|
|
271
271
|
if (!i) continue;
|
|
272
272
|
const s = { val: h(i, "w:val") ?? "single" }, a = y(i, "w:sz");
|
|
@@ -276,7 +276,7 @@ function Yt(t) {
|
|
|
276
276
|
}
|
|
277
277
|
return Object.keys(e).length > 0 ? e : void 0;
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function Ft(t) {
|
|
280
280
|
if (!t) return;
|
|
281
281
|
const e = h(t, "w:fill");
|
|
282
282
|
if (e && e !== "auto") return `#${e.toLowerCase()}`;
|
|
@@ -284,14 +284,14 @@ function Nt(t) {
|
|
|
284
284
|
if (n && n !== "clear" && n !== "nil" && o && o !== "auto")
|
|
285
285
|
return `#${o.toLowerCase()}`;
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function an(t, e) {
|
|
288
288
|
return t ? e ? { ...t, ...e } : t : e;
|
|
289
289
|
}
|
|
290
|
-
function
|
|
291
|
-
const n = (
|
|
290
|
+
function cn(t, e) {
|
|
291
|
+
const n = (d, u, p) => (
|
|
292
292
|
// Cell edges are named directly; the table/style layers use the named edge
|
|
293
293
|
// on the boundary and the inside edge between cells.
|
|
294
|
-
t.cell?.[
|
|
294
|
+
t.cell?.[d] ?? t.table?.[p ? d : u] ?? t.style?.[p ? d : u]
|
|
295
295
|
), o = {}, i = ct(n("top", "insideH", e.top));
|
|
296
296
|
i && (o.top = i);
|
|
297
297
|
const s = ct(n("bottom", "insideH", e.bottom));
|
|
@@ -301,7 +301,7 @@ function an(t, e) {
|
|
|
301
301
|
const r = ct(n("right", "insideV", e.right));
|
|
302
302
|
return r && (o.right = r), o;
|
|
303
303
|
}
|
|
304
|
-
function
|
|
304
|
+
function dn(t) {
|
|
305
305
|
if (!t) return;
|
|
306
306
|
const e = {}, n = ct(t.top);
|
|
307
307
|
n && (e.top = n);
|
|
@@ -312,7 +312,7 @@ function cn(t) {
|
|
|
312
312
|
const s = ct(t.left);
|
|
313
313
|
return s && (e.left = s), Object.keys(e).length > 0 ? e : void 0;
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function ln(t) {
|
|
316
316
|
if (!t) return;
|
|
317
317
|
const e = {}, n = ct(t.top);
|
|
318
318
|
n && (e.top = n);
|
|
@@ -327,7 +327,7 @@ function dn(t) {
|
|
|
327
327
|
const r = ct(t.insideV);
|
|
328
328
|
return r && (e.insideV = r), Object.keys(e).length > 0 ? e : void 0;
|
|
329
329
|
}
|
|
330
|
-
function
|
|
330
|
+
function xe(t) {
|
|
331
331
|
if (!t) return;
|
|
332
332
|
const e = {}, n = ct(t.top);
|
|
333
333
|
n && (e.top = n);
|
|
@@ -340,18 +340,18 @@ function Ae(t) {
|
|
|
340
340
|
const a = ct(t.between);
|
|
341
341
|
return a && (e.between = a), Object.keys(e).length > 0 ? e : void 0;
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function fn(t) {
|
|
344
344
|
return ct(t);
|
|
345
345
|
}
|
|
346
346
|
function ct(t) {
|
|
347
347
|
if (!t || t.val === "nil" || t.val === "none") return;
|
|
348
|
-
const e = I(Math.max(0.5, (t.sizeEighthPt ?? 4) / 6)), o = { color: !t.color || t.color === "auto" ? "#000000" : `#${t.color.toLowerCase()}`, widthPx: e }, i =
|
|
348
|
+
const e = I(Math.max(0.5, (t.sizeEighthPt ?? 4) / 6)), o = { color: !t.color || t.color === "auto" ? "#000000" : `#${t.color.toLowerCase()}`, widthPx: e }, i = un(t.val);
|
|
349
349
|
return i !== "single" && (o.style = i), o;
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function un(t) {
|
|
352
352
|
return t === "double" ? "double" : /dash/i.test(t) ? "dashed" : /dot/i.test(t) ? "dotted" : "single";
|
|
353
353
|
}
|
|
354
|
-
function
|
|
354
|
+
function Pt(t) {
|
|
355
355
|
const e = {}, n = nt(t, "w:rStyle");
|
|
356
356
|
n && (e.styleId = n);
|
|
357
357
|
const o = Z(f(t, "w:b"));
|
|
@@ -362,51 +362,51 @@ function St(t) {
|
|
|
362
362
|
s !== void 0 && (e.strikethrough = s);
|
|
363
363
|
const a = f(t, "w:u");
|
|
364
364
|
if (a) {
|
|
365
|
-
const
|
|
366
|
-
e.underline =
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
const
|
|
370
|
-
|
|
365
|
+
const B = h(a, "w:val");
|
|
366
|
+
e.underline = B !== "none", e.underline && B && B !== "single" && (e.underlineStyle = B);
|
|
367
|
+
const $ = h(a, "w:color");
|
|
368
|
+
$ && (e.underlineColor = $);
|
|
369
|
+
const j = h(a, "w:themeColor");
|
|
370
|
+
j && (e.underlineColorTheme = j);
|
|
371
371
|
}
|
|
372
372
|
const r = f(t, "w:color");
|
|
373
373
|
if (r) {
|
|
374
|
-
const
|
|
375
|
-
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
const
|
|
379
|
-
|
|
374
|
+
const B = h(r, "w:val");
|
|
375
|
+
B && (e.color = B);
|
|
376
|
+
const $ = h(r, "w:themeColor");
|
|
377
|
+
$ && (e.colorTheme = $);
|
|
378
|
+
const j = h(r, "w:themeTint");
|
|
379
|
+
j && (e.colorThemeTint = j);
|
|
380
380
|
const rt = h(r, "w:themeShade");
|
|
381
381
|
rt && (e.colorThemeShade = rt);
|
|
382
382
|
}
|
|
383
|
-
const
|
|
384
|
-
|
|
383
|
+
const d = y(f(t, "w:sz"), "w:val");
|
|
384
|
+
d !== void 0 && (e.sizeHalfPoints = d);
|
|
385
385
|
const u = y(f(t, "w:spacing"), "w:val");
|
|
386
386
|
u !== void 0 && (e.letterSpacingTwips = u);
|
|
387
|
-
const
|
|
388
|
-
if (
|
|
389
|
-
const
|
|
390
|
-
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
-
const rt = h(
|
|
387
|
+
const p = f(t, "w:rFonts");
|
|
388
|
+
if (p) {
|
|
389
|
+
const B = h(p, "w:ascii");
|
|
390
|
+
B && (e.fontAscii = B);
|
|
391
|
+
const $ = h(p, "w:asciiTheme");
|
|
392
|
+
$ && (e.fontThemeAscii = $);
|
|
393
|
+
const j = h(p, "w:hAnsi");
|
|
394
|
+
j && (e.fontHAnsi = j);
|
|
395
|
+
const rt = h(p, "w:hAnsiTheme");
|
|
396
396
|
rt && (e.fontThemeHAnsi = rt);
|
|
397
|
-
const ht = h(
|
|
397
|
+
const ht = h(p, "w:cs");
|
|
398
398
|
ht && (e.fontCs = ht);
|
|
399
|
-
const bt = h(
|
|
399
|
+
const bt = h(p, "w:cstheme");
|
|
400
400
|
bt && (e.fontThemeCs = bt);
|
|
401
|
-
const ut = h(
|
|
401
|
+
const ut = h(p, "w:eastAsia");
|
|
402
402
|
ut && (e.fontEastAsia = ut);
|
|
403
|
-
const it = h(
|
|
403
|
+
const it = h(p, "w:eastAsiaTheme");
|
|
404
404
|
it && (e.fontThemeEastAsia = it);
|
|
405
405
|
}
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
const
|
|
409
|
-
|
|
406
|
+
const l = nt(t, "w:highlight");
|
|
407
|
+
l && l !== "none" && (e.highlight = l);
|
|
408
|
+
const m = nt(t, "w:vertAlign");
|
|
409
|
+
m && (e.vertAlign = m);
|
|
410
410
|
const g = Z(f(t, "w:vanish"));
|
|
411
411
|
g !== void 0 && (e.vanish = g);
|
|
412
412
|
const v = Z(f(t, "w:caps"));
|
|
@@ -415,22 +415,22 @@ function St(t) {
|
|
|
415
415
|
P !== void 0 && (e.smallCaps = P);
|
|
416
416
|
const T = Z(f(t, "w:rtl"));
|
|
417
417
|
T !== void 0 && (e.rtl = T);
|
|
418
|
-
const
|
|
419
|
-
|
|
418
|
+
const F = Z(f(t, "w:dstrike"));
|
|
419
|
+
F !== void 0 && (e.doubleStrikethrough = F);
|
|
420
420
|
const L = y(f(t, "w:position"), "w:val");
|
|
421
421
|
L !== void 0 && (e.positionHalfPoints = L);
|
|
422
422
|
const x = y(f(t, "w:kern"), "w:val");
|
|
423
423
|
x !== void 0 && (e.kerningHalfPoints = x);
|
|
424
424
|
const tt = f(t, "w:w");
|
|
425
425
|
if (tt) {
|
|
426
|
-
const
|
|
427
|
-
if (
|
|
428
|
-
const
|
|
429
|
-
Number.isFinite(
|
|
426
|
+
const B = h(tt, "w:val");
|
|
427
|
+
if (B !== void 0) {
|
|
428
|
+
const $ = Number(B.replace("%", ""));
|
|
429
|
+
Number.isFinite($) && $ > 0 && (e.widthScalePct = $);
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
|
-
const
|
|
433
|
-
|
|
432
|
+
const W = nt(t, "w:em");
|
|
433
|
+
W && W !== "none" && (e.emphasisMark = W);
|
|
434
434
|
const ft = Z(f(t, "w:outline"));
|
|
435
435
|
ft !== void 0 && (e.outline = ft);
|
|
436
436
|
const J = Z(f(t, "w:shadow"));
|
|
@@ -441,15 +441,15 @@ function St(t) {
|
|
|
441
441
|
E !== void 0 && (e.imprint = E);
|
|
442
442
|
const q = f(t, "w:bdr");
|
|
443
443
|
if (q) {
|
|
444
|
-
const
|
|
445
|
-
|
|
446
|
-
const
|
|
447
|
-
|
|
444
|
+
const B = { val: h(q, "w:val") ?? "single" }, $ = y(q, "w:sz");
|
|
445
|
+
$ !== void 0 && (B.sizeEighthPt = $);
|
|
446
|
+
const j = h(q, "w:color");
|
|
447
|
+
j && (B.color = j), e.runBorder = B;
|
|
448
448
|
}
|
|
449
449
|
const Q = y(f(t, "w:fitText"), "w:val");
|
|
450
450
|
return Q !== void 0 && (e.fitTextTwips = Q), e;
|
|
451
451
|
}
|
|
452
|
-
const
|
|
452
|
+
const mn = {
|
|
453
453
|
left: "left",
|
|
454
454
|
start: "left",
|
|
455
455
|
center: "center",
|
|
@@ -458,10 +458,10 @@ const un = {
|
|
|
458
458
|
both: "justify",
|
|
459
459
|
distribute: "justify"
|
|
460
460
|
};
|
|
461
|
-
function
|
|
461
|
+
function jt(t, e) {
|
|
462
462
|
const n = {}, o = nt(t, "w:pStyle");
|
|
463
463
|
o && (n.styleId = o);
|
|
464
|
-
const i = nt(t, "w:jc"), s = i !== void 0 ?
|
|
464
|
+
const i = nt(t, "w:jc"), s = i !== void 0 ? mn[i] : void 0;
|
|
465
465
|
s && (n.align = s);
|
|
466
466
|
const a = f(t, "w:spacing");
|
|
467
467
|
if (a) {
|
|
@@ -469,8 +469,8 @@ function Gt(t, e) {
|
|
|
469
469
|
E !== void 0 && (n.spaceBeforeTwips = E);
|
|
470
470
|
const q = y(a, "w:after");
|
|
471
471
|
q !== void 0 && (n.spaceAfterTwips = q);
|
|
472
|
-
const Q = y(a, "w:line"),
|
|
473
|
-
Q !== void 0 && (
|
|
472
|
+
const Q = y(a, "w:line"), B = h(a, "w:lineRule") ?? "auto";
|
|
473
|
+
Q !== void 0 && (B === "exact" || B === "atLeast" && Q > 0 ? (n.lineRule = B, n.lineExactTwips = Q) : B === "auto" && (n.lineRule = "auto", n.lineHeight = sn(Q)));
|
|
474
474
|
}
|
|
475
475
|
const r = f(t, "w:ind");
|
|
476
476
|
if (r) {
|
|
@@ -478,27 +478,27 @@ function Gt(t, e) {
|
|
|
478
478
|
E !== void 0 && (n.indentLeftTwips = E);
|
|
479
479
|
const q = y(r, "w:right") ?? y(r, "w:end");
|
|
480
480
|
q !== void 0 && (n.indentRightTwips = q);
|
|
481
|
-
const Q = y(r, "w:firstLine"),
|
|
482
|
-
Q !== void 0 ? n.indentFirstLineTwips = Q :
|
|
481
|
+
const Q = y(r, "w:firstLine"), B = y(r, "w:hanging");
|
|
482
|
+
Q !== void 0 ? n.indentFirstLineTwips = Q : B !== void 0 && (n.indentFirstLineTwips = -B);
|
|
483
483
|
}
|
|
484
|
-
const
|
|
485
|
-
|
|
484
|
+
const d = Z(f(t, "w:keepNext"));
|
|
485
|
+
d !== void 0 && (n.keepWithNext = d);
|
|
486
486
|
const u = Z(f(t, "w:keepLines"));
|
|
487
487
|
u !== void 0 && (n.keepLinesTogether = u);
|
|
488
|
-
const
|
|
489
|
-
|
|
490
|
-
const
|
|
491
|
-
|
|
492
|
-
const
|
|
493
|
-
if (
|
|
488
|
+
const p = Z(f(t, "w:contextualSpacing"));
|
|
489
|
+
p !== void 0 && (n.contextualSpacing = p);
|
|
490
|
+
const l = Z(f(t, "w:bidi"));
|
|
491
|
+
l !== void 0 && (n.direction = l ? "rtl" : "ltr");
|
|
492
|
+
const m = f(t, "w:tabs");
|
|
493
|
+
if (m) {
|
|
494
494
|
const E = [];
|
|
495
|
-
for (const q of dt(
|
|
496
|
-
const Q = y(q, "w:pos"),
|
|
497
|
-
if (Q === void 0 ||
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
const
|
|
501
|
-
|
|
495
|
+
for (const q of dt(m, "w:tab")) {
|
|
496
|
+
const Q = y(q, "w:pos"), B = h(q, "w:val");
|
|
497
|
+
if (Q === void 0 || B === "clear" || B === "bar") continue;
|
|
498
|
+
const $ = { posTwips: Q };
|
|
499
|
+
B && ($.val = B);
|
|
500
|
+
const j = h(q, "w:leader");
|
|
501
|
+
j && ($.leader = j), E.push($);
|
|
502
502
|
}
|
|
503
503
|
E.length > 0 && (n.tabStops = E);
|
|
504
504
|
}
|
|
@@ -516,45 +516,45 @@ function Gt(t, e) {
|
|
|
516
516
|
}
|
|
517
517
|
const T = f(t, "w:pBdr");
|
|
518
518
|
if (T) {
|
|
519
|
-
const E = {}, q = (Q,
|
|
520
|
-
const
|
|
521
|
-
if (
|
|
522
|
-
const
|
|
523
|
-
rt !== void 0 && (
|
|
524
|
-
const ht = h(
|
|
525
|
-
ht && (
|
|
519
|
+
const E = {}, q = (Q, B) => {
|
|
520
|
+
const $ = f(T, B);
|
|
521
|
+
if (!$) return;
|
|
522
|
+
const j = { val: h($, "w:val") ?? "single" }, rt = y($, "w:sz");
|
|
523
|
+
rt !== void 0 && (j.sizeEighthPt = rt);
|
|
524
|
+
const ht = h($, "w:color");
|
|
525
|
+
ht && (j.color = ht), E[Q] = j;
|
|
526
526
|
};
|
|
527
527
|
q("top", "w:top"), q("left", "w:left"), q("bottom", "w:bottom"), q("right", "w:right"), q("between", "w:between"), (E.top || E.left || E.bottom || E.right || E.between) && (n.borders = E);
|
|
528
528
|
}
|
|
529
|
-
const
|
|
530
|
-
|
|
529
|
+
const F = Ft(f(t, "w:shd"));
|
|
530
|
+
F !== void 0 && (n.shd = F);
|
|
531
531
|
const L = Z(f(t, "w:widowControl"));
|
|
532
532
|
L !== void 0 && (n.widowControl = L);
|
|
533
533
|
const x = Z(f(t, "w:suppressLineNumbers"));
|
|
534
534
|
x !== void 0 && (n.suppressLineNumbers = x);
|
|
535
535
|
const tt = nt(t, "w:textAlignment");
|
|
536
536
|
(tt === "top" || tt === "center" || tt === "bottom" || tt === "baseline") && (n.textAlignment = tt);
|
|
537
|
-
const
|
|
538
|
-
|
|
537
|
+
const W = Z(f(t, "w:mirrorIndents"));
|
|
538
|
+
W !== void 0 && (n.mirrorIndents = W);
|
|
539
539
|
const ft = Z(f(t, "w:adjustRightInd"));
|
|
540
540
|
ft !== void 0 && (n.adjustRightInd = ft);
|
|
541
541
|
const J = f(t, "w:rPr");
|
|
542
|
-
J && (n.markRunProps =
|
|
542
|
+
J && (n.markRunProps = Pt(J));
|
|
543
543
|
const U = f(t, "w:sectPr");
|
|
544
544
|
if (U) {
|
|
545
545
|
const E = nt(U, "w:type");
|
|
546
546
|
n.sectionBreak = E === "continuous" ? "continuous" : "page", (E === "evenPage" || E === "oddPage") && (n.sectionBreakType = E);
|
|
547
|
-
const q =
|
|
547
|
+
const q = Ee(f(U, "w:lnNumType"));
|
|
548
548
|
q && (n.sectionLineNumbering = q);
|
|
549
|
-
const Q = f(U, "w:pgSz"),
|
|
550
|
-
|
|
551
|
-
const
|
|
552
|
-
if (
|
|
553
|
-
const ut = y(
|
|
554
|
-
ut !== void 0 && it !== void 0 &&
|
|
555
|
-
const V = y(
|
|
549
|
+
const Q = f(U, "w:pgSz"), B = y(Q, "w:w"), $ = y(Q, "w:h");
|
|
550
|
+
B !== void 0 && $ !== void 0 && (n.sectionPgSize = { w: B, h: $ });
|
|
551
|
+
const j = f(U, "w:pgMar");
|
|
552
|
+
if (j) {
|
|
553
|
+
const ut = y(j, "w:top"), it = y(j, "w:right"), mt = y(j, "w:bottom"), pt = y(j, "w:left");
|
|
554
|
+
ut !== void 0 && it !== void 0 && mt !== void 0 && pt !== void 0 && (n.sectionMarginTwips = { top: ut, right: it, bottom: mt, left: pt });
|
|
555
|
+
const V = y(j, "w:header");
|
|
556
556
|
V !== void 0 && (n.sectionHeaderDistTwips = V);
|
|
557
|
-
const c = y(
|
|
557
|
+
const c = y(j, "w:footer");
|
|
558
558
|
c !== void 0 && (n.sectionFooterDistTwips = c);
|
|
559
559
|
}
|
|
560
560
|
const rt = f(U, "w:cols");
|
|
@@ -562,37 +562,37 @@ function Gt(t, e) {
|
|
|
562
562
|
const ut = dt(rt, "w:col"), it = y(rt, "w:num") ?? (ut.length > 1 ? ut.length : 1);
|
|
563
563
|
if (it > 1) {
|
|
564
564
|
n.sectionColumns = { count: it };
|
|
565
|
-
const
|
|
566
|
-
if (
|
|
567
|
-
const
|
|
565
|
+
const mt = y(rt, "w:space");
|
|
566
|
+
if (mt !== void 0 && (n.sectionColumns.spaceTwips = mt), (h(rt, "w:sep") === "1" || h(rt, "w:sep") === "true") && (n.sectionColumns.sep = !0), ut.length === it) {
|
|
567
|
+
const pt = ut.map((V) => ({
|
|
568
568
|
wTwips: y(V, "w:w") ?? 0,
|
|
569
569
|
spaceTwips: y(V, "w:space") ?? 0
|
|
570
570
|
}));
|
|
571
|
-
|
|
571
|
+
pt.some((V) => V.wTwips > 0) && (n.sectionColumns.cols = pt);
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
575
|
const ht = f(U, "w:pgBorders");
|
|
576
576
|
if (ht) {
|
|
577
|
-
const it = { offsetFrom: h(ht, "w:offsetFrom") === "text" ? "text" : "page" },
|
|
578
|
-
const V = f(ht, "w:" +
|
|
577
|
+
const it = { offsetFrom: h(ht, "w:offsetFrom") === "text" ? "text" : "page" }, mt = (pt) => {
|
|
578
|
+
const V = f(ht, "w:" + pt);
|
|
579
579
|
if (!V) return;
|
|
580
580
|
const c = y(V, "w:sz"), b = y(V, "w:space"), C = h(V, "w:color");
|
|
581
|
-
it[
|
|
581
|
+
it[pt] = {
|
|
582
582
|
style: h(V, "w:val") ?? "single",
|
|
583
583
|
...c !== void 0 ? { sz: c } : {},
|
|
584
584
|
...b !== void 0 ? { space: b } : {},
|
|
585
585
|
...C !== void 0 ? { color: C } : {}
|
|
586
586
|
};
|
|
587
587
|
};
|
|
588
|
-
|
|
588
|
+
mt("top"), mt("right"), mt("bottom"), mt("left"), (it.top || it.right || it.bottom || it.left) && (n.sectionPgBorders = it);
|
|
589
589
|
}
|
|
590
590
|
const bt = y(f(U, "w:pgNumType"), "w:start");
|
|
591
591
|
bt !== void 0 && (n.sectionPageNumberStart = bt), (dt(U, "w:headerReference").length > 0 || dt(U, "w:footerReference").length > 0) && (n.sectionHasBands = !0);
|
|
592
592
|
}
|
|
593
593
|
return n;
|
|
594
594
|
}
|
|
595
|
-
function
|
|
595
|
+
function Ee(t) {
|
|
596
596
|
if (!t) return;
|
|
597
597
|
const e = {}, n = y(t, "w:countBy");
|
|
598
598
|
n !== void 0 && (e.countBy = n);
|
|
@@ -604,23 +604,23 @@ function xe(t) {
|
|
|
604
604
|
return (s === "continuous" || s === "newPage" || s === "newSection") && (e.restart = s), e;
|
|
605
605
|
}
|
|
606
606
|
function pn(t) {
|
|
607
|
-
const e = /* @__PURE__ */ new Map(), n =
|
|
607
|
+
const e = /* @__PURE__ */ new Map(), n = yt(t, "comments.xml"), o = wt(n, "w:comments");
|
|
608
608
|
if (!o) return e;
|
|
609
609
|
for (const i of ot(o)) {
|
|
610
610
|
if (i.tagName !== "w:comment") continue;
|
|
611
611
|
const s = h(i, "w:id");
|
|
612
612
|
if (s === void 0) continue;
|
|
613
|
-
const a = h(i, "w:author") || "Anonymous", r = h(i, "w:initials"),
|
|
614
|
-
let
|
|
615
|
-
for (const
|
|
616
|
-
if (
|
|
617
|
-
|
|
618
|
-
for (const
|
|
619
|
-
if (
|
|
620
|
-
const g = f(
|
|
613
|
+
const a = h(i, "w:author") || "Anonymous", r = h(i, "w:initials"), d = h(i, "w:date"), u = [];
|
|
614
|
+
let p;
|
|
615
|
+
for (const l of ot(i))
|
|
616
|
+
if (l.tagName === "w:p") {
|
|
617
|
+
p || (p = h(l, "w14:paraId"));
|
|
618
|
+
for (const m of ot(l)) {
|
|
619
|
+
if (m.tagName !== "w:r" || f(m, "w:annotationRef")) continue;
|
|
620
|
+
const g = f(m, "w:rPr"), v = g ? Pt(g) : {};
|
|
621
621
|
let P = "";
|
|
622
|
-
for (const T of ot(
|
|
623
|
-
T.tagName === "w:t" ? P +=
|
|
622
|
+
for (const T of ot(m))
|
|
623
|
+
T.tagName === "w:t" ? P += It(T) : T.tagName === "w:br" ? P += `
|
|
624
624
|
` : T.tagName === "w:tab" && (P += " ");
|
|
625
625
|
if (P.length > 0) {
|
|
626
626
|
const T = v.color && v.color !== "auto" ? v.color.startsWith("#") ? v.color : `#${v.color}` : void 0;
|
|
@@ -634,7 +634,7 @@ function pn(t) {
|
|
|
634
634
|
strikethrough: v.strikethrough ?? !1,
|
|
635
635
|
...T ? { color: T } : {},
|
|
636
636
|
...v.fontAscii ? { fontFamily: v.fontAscii } : {},
|
|
637
|
-
...v.sizeHalfPoints ? { fontSizePx:
|
|
637
|
+
...v.sizeHalfPoints ? { fontSizePx: $t(v.sizeHalfPoints) } : {}
|
|
638
638
|
}
|
|
639
639
|
});
|
|
640
640
|
}
|
|
@@ -645,29 +645,29 @@ function pn(t) {
|
|
|
645
645
|
author: a,
|
|
646
646
|
runs: u,
|
|
647
647
|
...r !== void 0 ? { initials: r } : {},
|
|
648
|
-
...
|
|
649
|
-
...
|
|
648
|
+
...d !== void 0 ? { date: d } : {},
|
|
649
|
+
...p !== void 0 ? { paraId: p } : {}
|
|
650
650
|
});
|
|
651
651
|
}
|
|
652
652
|
return e;
|
|
653
653
|
}
|
|
654
|
-
function
|
|
655
|
-
const e = /* @__PURE__ */ new Map(), n =
|
|
654
|
+
function hn(t) {
|
|
655
|
+
const e = /* @__PURE__ */ new Map(), n = yt(t, "commentsExtended.xml"), o = wt(n, "w15:commentsEx") ?? wt(n, "w:commentsEx");
|
|
656
656
|
if (!o) return e;
|
|
657
657
|
for (const i of ot(o)) {
|
|
658
658
|
if (i.tagName !== "w15:commentEx" && i.tagName !== "w:commentEx") continue;
|
|
659
659
|
const s = h(i, "w15:paraId") ?? h(i, "w:paraId");
|
|
660
660
|
if (!s) continue;
|
|
661
|
-
const a = h(i, "w15:paraIdParent") ?? h(i, "w:paraIdParent"), r = h(i, "w15:done") ?? h(i, "w:done"),
|
|
661
|
+
const a = h(i, "w15:paraIdParent") ?? h(i, "w:paraIdParent"), r = h(i, "w15:done") ?? h(i, "w:done"), d = r === "1" || r === "true";
|
|
662
662
|
e.set(s, {
|
|
663
663
|
paraId: s,
|
|
664
|
-
done:
|
|
664
|
+
done: d,
|
|
665
665
|
...a !== void 0 ? { paraIdParent: a } : {}
|
|
666
666
|
});
|
|
667
667
|
}
|
|
668
668
|
return e;
|
|
669
669
|
}
|
|
670
|
-
function
|
|
670
|
+
function gn(t, e, n, o) {
|
|
671
671
|
if (t.size === 0) return;
|
|
672
672
|
const i = /* @__PURE__ */ new Map();
|
|
673
673
|
for (const u of t.values())
|
|
@@ -675,46 +675,46 @@ function hn(t, e, n, o) {
|
|
|
675
675
|
const s = /* @__PURE__ */ new Map();
|
|
676
676
|
for (const u of t.values()) {
|
|
677
677
|
if (!u.paraId) continue;
|
|
678
|
-
const
|
|
679
|
-
if (
|
|
680
|
-
const
|
|
681
|
-
|
|
678
|
+
const p = e.get(u.paraId);
|
|
679
|
+
if (p?.paraIdParent) {
|
|
680
|
+
const l = i.get(p.paraIdParent);
|
|
681
|
+
l && l.id !== u.id && s.set(u.id, l.id);
|
|
682
682
|
}
|
|
683
683
|
}
|
|
684
684
|
const a = /* @__PURE__ */ new Map(), r = [];
|
|
685
|
-
for (const [u,
|
|
685
|
+
for (const [u, p] of t)
|
|
686
686
|
if (!s.get(u)) {
|
|
687
687
|
a.has(u) || (a.set(u, []), r.push(u));
|
|
688
|
-
const
|
|
689
|
-
a.get(u).push(
|
|
688
|
+
const m = fe(p);
|
|
689
|
+
a.get(u).push(m);
|
|
690
690
|
}
|
|
691
|
-
for (const [u,
|
|
692
|
-
const
|
|
693
|
-
if (
|
|
694
|
-
let
|
|
695
|
-
for (; s.has(
|
|
696
|
-
|
|
697
|
-
a.has(
|
|
691
|
+
for (const [u, p] of t) {
|
|
692
|
+
const l = s.get(u);
|
|
693
|
+
if (l) {
|
|
694
|
+
let m = l;
|
|
695
|
+
for (; s.has(m); )
|
|
696
|
+
m = s.get(m);
|
|
697
|
+
a.has(m) || (a.set(m, []), r.push(m)), a.get(m).push(fe(p));
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
|
-
const
|
|
700
|
+
const d = [];
|
|
701
701
|
for (const u of r) {
|
|
702
|
-
const
|
|
703
|
-
if (!
|
|
704
|
-
const
|
|
705
|
-
v &&
|
|
706
|
-
id:
|
|
702
|
+
const p = a.get(u);
|
|
703
|
+
if (!p || p.length === 0) continue;
|
|
704
|
+
const l = t.get(u), g = (l?.paraId ? e.get(l.paraId) : void 0)?.done ? "resolved" : "open", v = n.get(u) ?? o;
|
|
705
|
+
v && d.push({
|
|
706
|
+
id: Me(),
|
|
707
707
|
anchor: v,
|
|
708
708
|
status: g,
|
|
709
|
-
comments:
|
|
709
|
+
comments: p
|
|
710
710
|
});
|
|
711
711
|
}
|
|
712
|
-
if (
|
|
712
|
+
if (d.length !== 0)
|
|
713
713
|
return {
|
|
714
714
|
docId: "imported",
|
|
715
715
|
baseVersion: 0,
|
|
716
716
|
suggestions: [],
|
|
717
|
-
threads:
|
|
717
|
+
threads: d
|
|
718
718
|
};
|
|
719
719
|
}
|
|
720
720
|
function fe(t) {
|
|
@@ -729,28 +729,28 @@ function fe(t) {
|
|
|
729
729
|
lastName: i
|
|
730
730
|
};
|
|
731
731
|
return {
|
|
732
|
-
id:
|
|
732
|
+
id: Me(),
|
|
733
733
|
author: s,
|
|
734
734
|
body: t.runs,
|
|
735
735
|
createdAt: e
|
|
736
736
|
};
|
|
737
737
|
}
|
|
738
|
-
function
|
|
739
|
-
const e =
|
|
740
|
-
return
|
|
738
|
+
function Re(t) {
|
|
739
|
+
const e = St(t.tagName) === "oMathPara" ? gt(t, "oMath") ?? t : t;
|
|
740
|
+
return Tt(lt(e));
|
|
741
741
|
}
|
|
742
|
-
const
|
|
743
|
-
function
|
|
744
|
-
return { type: "row", children: t.filter((e) => !
|
|
742
|
+
const wn = /^[^\p{L}\p{N}\s]+$/u, bn = (t) => St(t.tagName).endsWith("Pr");
|
|
743
|
+
function Tt(t) {
|
|
744
|
+
return { type: "row", children: t.filter((e) => !bn(e)).map(Sn) };
|
|
745
745
|
}
|
|
746
746
|
function K(t, e) {
|
|
747
747
|
const n = gt(t, e);
|
|
748
|
-
return n ?
|
|
748
|
+
return n ? Tt(lt(n)) : Ae();
|
|
749
749
|
}
|
|
750
750
|
function ue(t) {
|
|
751
751
|
return t.type === "row" && t.children.length === 1 ? t.children[0] : void 0;
|
|
752
752
|
}
|
|
753
|
-
function
|
|
753
|
+
function kn(t, e) {
|
|
754
754
|
const n = e ?? ",";
|
|
755
755
|
if (n.length === 0) return t;
|
|
756
756
|
const o = [];
|
|
@@ -758,14 +758,14 @@ function bn(t, e) {
|
|
|
758
758
|
s > 0 && o.push({ type: "op", text: n[(s - 1) % n.length] }), o.push(i);
|
|
759
759
|
}), o;
|
|
760
760
|
}
|
|
761
|
-
function
|
|
761
|
+
function vn(t) {
|
|
762
762
|
let e = "";
|
|
763
763
|
for (const n of lt(t))
|
|
764
|
-
if (
|
|
764
|
+
if (St(n.tagName) === "t")
|
|
765
765
|
for (const o of n.children) typeof o == "string" && (e += o);
|
|
766
766
|
return e;
|
|
767
767
|
}
|
|
768
|
-
function
|
|
768
|
+
function yn(t) {
|
|
769
769
|
switch (t) {
|
|
770
770
|
case "b":
|
|
771
771
|
return "bold";
|
|
@@ -777,7 +777,7 @@ function vn(t) {
|
|
|
777
777
|
return;
|
|
778
778
|
}
|
|
779
779
|
}
|
|
780
|
-
function
|
|
780
|
+
function me(t, e) {
|
|
781
781
|
const n = t === "b" || t === "bi";
|
|
782
782
|
switch (e) {
|
|
783
783
|
case "double-struck":
|
|
@@ -791,25 +791,25 @@ function pe(t, e) {
|
|
|
791
791
|
case "monospace":
|
|
792
792
|
return "monospace";
|
|
793
793
|
default:
|
|
794
|
-
return
|
|
794
|
+
return yn(t);
|
|
795
795
|
}
|
|
796
796
|
}
|
|
797
|
-
function
|
|
798
|
-
const e =
|
|
797
|
+
function Tn(t) {
|
|
798
|
+
const e = vn(t), n = gt(t, "rPr"), o = n ? vt(n, "sty") : void 0, i = n ? vt(n, "scr") : void 0;
|
|
799
799
|
if (e.length > 0 && /^\s+$/.test(e)) return { type: "space", widthEm: e.length * 0.25 };
|
|
800
800
|
if (/^[0-9]+([.,][0-9]+)?$/.test(e)) {
|
|
801
|
-
const s =
|
|
801
|
+
const s = me(o, i) ?? (o === "i" ? "italic" : void 0);
|
|
802
802
|
return { type: "number", text: e, ...s && s !== "normal" ? { variant: s } : {} };
|
|
803
803
|
}
|
|
804
|
-
if (e.length > 0 &&
|
|
804
|
+
if (e.length > 0 && wn.test(e)) return { type: "op", text: e };
|
|
805
805
|
if (/\p{L}/u.test(e)) {
|
|
806
|
-
const s =
|
|
806
|
+
const s = me(o, i);
|
|
807
807
|
return { type: "ident", text: e, ...s ? { variant: s } : {} };
|
|
808
808
|
}
|
|
809
809
|
return { type: "text", text: e };
|
|
810
810
|
}
|
|
811
|
-
function
|
|
812
|
-
switch (
|
|
811
|
+
function Sn(t) {
|
|
812
|
+
switch (St(t.tagName)) {
|
|
813
813
|
case "oMath":
|
|
814
814
|
case "oMathPara":
|
|
815
815
|
case "e":
|
|
@@ -820,11 +820,11 @@ function Tn(t) {
|
|
|
820
820
|
case "lim":
|
|
821
821
|
case "deg":
|
|
822
822
|
case "fName":
|
|
823
|
-
return
|
|
823
|
+
return Tt(lt(t));
|
|
824
824
|
case "r":
|
|
825
|
-
return
|
|
825
|
+
return Tn(t);
|
|
826
826
|
case "f": {
|
|
827
|
-
const e = gt(t, "fPr"), n = e ?
|
|
827
|
+
const e = gt(t, "fPr"), n = e ? vt(e, "type") : void 0;
|
|
828
828
|
return {
|
|
829
829
|
type: "frac",
|
|
830
830
|
num: K(t, "num"),
|
|
@@ -850,7 +850,7 @@ function Tn(t) {
|
|
|
850
850
|
};
|
|
851
851
|
}
|
|
852
852
|
case "d": {
|
|
853
|
-
const e = gt(t, "dPr"), n = e ?
|
|
853
|
+
const e = gt(t, "dPr"), n = e ? vt(e, "begChr") : void 0, o = e ? vt(e, "endChr") : void 0, i = e ? vt(e, "sepChr") : void 0, s = lt(t).filter((r) => St(r.tagName) === "e").map((r) => Tt(lt(r))), a = s.length <= 1 ? s[0] ?? Ae() : { type: "row", children: kn(s, i) };
|
|
854
854
|
return {
|
|
855
855
|
type: "fenced",
|
|
856
856
|
open: n ?? "(",
|
|
@@ -859,12 +859,12 @@ function Tn(t) {
|
|
|
859
859
|
};
|
|
860
860
|
}
|
|
861
861
|
case "nary": {
|
|
862
|
-
const e = gt(t, "naryPr"), n = (e ?
|
|
862
|
+
const e = gt(t, "naryPr"), n = (e ? vt(e, "chr") : void 0) ?? "∫", o = e ? Kt(e, "subHide") : !1, i = e ? Kt(e, "supHide") : !1, s = gt(t, "sub"), a = gt(t, "sup"), r = !o && s && lt(s).length > 0 ? Tt(lt(s)) : void 0, d = !i && a && lt(a).length > 0 ? Tt(lt(a)) : void 0;
|
|
863
863
|
return {
|
|
864
864
|
type: "nary",
|
|
865
865
|
op: n,
|
|
866
866
|
...r ? { sub: r } : {},
|
|
867
|
-
...
|
|
867
|
+
...d ? { sup: d } : {},
|
|
868
868
|
body: K(t, "e")
|
|
869
869
|
};
|
|
870
870
|
}
|
|
@@ -877,15 +877,15 @@ function Tn(t) {
|
|
|
877
877
|
return o && o.type === "limit" && o.under && !o.over && !o.accent ? { type: "limit", base: o.base, under: o.under, over: n } : { type: "limit", base: e, over: n };
|
|
878
878
|
}
|
|
879
879
|
case "acc": {
|
|
880
|
-
const e = gt(t, "accPr"), n = (e ?
|
|
880
|
+
const e = gt(t, "accPr"), n = (e ? vt(e, "chr") : void 0) ?? "̂";
|
|
881
881
|
return { type: "limit", base: K(t, "e"), over: { type: "op", text: n }, accent: !0 };
|
|
882
882
|
}
|
|
883
883
|
case "bar": {
|
|
884
|
-
const e = gt(t, "barPr"), n = e ?
|
|
884
|
+
const e = gt(t, "barPr"), n = e ? vt(e, "pos") : "top", o = { type: "op", text: n === "bot" ? "_" : "‾", stretchy: !0 };
|
|
885
885
|
return n === "bot" ? { type: "limit", base: K(t, "e"), under: o } : { type: "limit", base: K(t, "e"), over: o };
|
|
886
886
|
}
|
|
887
887
|
case "groupChr": {
|
|
888
|
-
const e = gt(t, "groupChrPr"), n = (e ?
|
|
888
|
+
const e = gt(t, "groupChrPr"), n = (e ? vt(e, "chr") : void 0) ?? "⏟", o = e ? vt(e, "pos") : "bot", i = { type: "op", text: n, stretchy: !0 };
|
|
889
889
|
return o === "top" ? { type: "limit", base: K(t, "e"), over: i } : { type: "limit", base: K(t, "e"), under: i };
|
|
890
890
|
}
|
|
891
891
|
case "func":
|
|
@@ -896,85 +896,85 @@ function Tn(t) {
|
|
|
896
896
|
case "borderBox":
|
|
897
897
|
return K(t, "e");
|
|
898
898
|
case "eqArr":
|
|
899
|
-
return { type: "matrix", rows: lt(t).filter((n) =>
|
|
899
|
+
return { type: "matrix", rows: lt(t).filter((n) => St(n.tagName) === "e").map((n) => [Tt(lt(n))]) };
|
|
900
900
|
case "m":
|
|
901
|
-
return
|
|
901
|
+
return Pn(t);
|
|
902
902
|
default:
|
|
903
|
-
return lt(t).length ?
|
|
903
|
+
return lt(t).length ? Tt(lt(t)) : { type: "unknown" };
|
|
904
904
|
}
|
|
905
905
|
}
|
|
906
|
-
function
|
|
906
|
+
function Pn(t) {
|
|
907
907
|
const e = [];
|
|
908
908
|
for (const n of lt(t))
|
|
909
|
-
|
|
909
|
+
St(n.tagName) === "mr" && e.push(lt(n).filter((o) => St(o.tagName) === "e").map((o) => Tt(lt(o))));
|
|
910
910
|
return { type: "matrix", rows: e };
|
|
911
911
|
}
|
|
912
912
|
const qt = () => ({ depth: 0, topInstr: "", openId: null, markBlock: null, next: { n: 0 }, registry: {} });
|
|
913
|
-
function
|
|
913
|
+
function pe(t) {
|
|
914
914
|
const e = t.fieldTrack;
|
|
915
|
-
if (e.openId !== null || !
|
|
915
|
+
if (e.openId !== null || !Ke(e.topInstr)) return;
|
|
916
916
|
const n = `field${e.next.n++}`;
|
|
917
917
|
e.registry[n] = { id: n, instruction: e.topInstr, name: te(e.topInstr).name, kind: "custom" }, e.openId = n, e.markBlock = n;
|
|
918
918
|
}
|
|
919
|
-
function
|
|
919
|
+
function At(t) {
|
|
920
920
|
let e = 0;
|
|
921
921
|
for (const n of t)
|
|
922
922
|
n.kind === "run" ? e += n.text.length : n.kind === "break" && (e += 1);
|
|
923
923
|
return e;
|
|
924
924
|
}
|
|
925
|
-
function
|
|
926
|
-
const o = wt(
|
|
925
|
+
function In(t, e, n) {
|
|
926
|
+
const o = wt(yt(t, e), "w:document"), i = o && f(o, "w:body");
|
|
927
927
|
if (!i)
|
|
928
|
-
throw new
|
|
928
|
+
throw new kt("MALFORMED_XML", `${e} has no w:document/w:body root.`);
|
|
929
929
|
const s = {}, a = { warnings: n, fieldTokens: !1, sdts: s, nextSdt: { n: 0 }, blockSdtStack: [], inlineSdtStack: [], pendingBookmarks: [], currentBookmarks: null, pendingMarkers: [], currentMarkers: null, pendingCommentMarkers: [], currentCommentMarkers: null, trackFields: !0, fieldTrack: qt() }, r = [];
|
|
930
|
-
|
|
931
|
-
const
|
|
932
|
-
return
|
|
930
|
+
Mt(ot(i), r, a);
|
|
931
|
+
const d = f(i, "w:sectPr"), u = d ? Xn(d) : null, p = o ? f(o, "w:background") : void 0, l = p ? h(p, "w:color") : void 0, m = l && l !== "auto" ? l : void 0, g = a.fieldTrack.registry, v = Object.keys(g).length > 0 ? { blocks: r, section: u, sdts: s, fields: g } : { blocks: r, section: u, sdts: s };
|
|
932
|
+
return m && (v.pageColorHex = m), v;
|
|
933
933
|
}
|
|
934
|
-
function
|
|
935
|
-
const i =
|
|
934
|
+
function Mn(t, e, n, o = {}) {
|
|
935
|
+
const i = yt(t, e), s = wt(i, "w:hdr") ?? wt(i, "w:ftr");
|
|
936
936
|
if (!s)
|
|
937
|
-
throw new
|
|
937
|
+
throw new kt("MALFORMED_XML", `${e} has no w:hdr/w:ftr root.`);
|
|
938
938
|
const a = { warnings: n, fieldTokens: !0, sdts: o, nextSdt: { n: Object.keys(o).length }, blockSdtStack: [], inlineSdtStack: [], pendingBookmarks: [], currentBookmarks: null, pendingMarkers: [], currentMarkers: null, pendingCommentMarkers: [], currentCommentMarkers: null, trackFields: !1, fieldTrack: qt() }, r = [];
|
|
939
|
-
return
|
|
939
|
+
return Mt(ot(s), r, a), r;
|
|
940
940
|
}
|
|
941
|
-
const
|
|
942
|
-
function
|
|
941
|
+
const An = /* @__PURE__ */ new Set(["_GoBack", "_Toc_Placeholder"]);
|
|
942
|
+
function Ce(t) {
|
|
943
943
|
const e = h(t, "w:name");
|
|
944
|
-
return e && !
|
|
944
|
+
return e && !An.has(e) ? e : null;
|
|
945
945
|
}
|
|
946
|
-
function
|
|
946
|
+
function xn(t) {
|
|
947
947
|
const e = f(t, "m:oMathParaPr"), n = e ? f(e, "m:jc") : void 0, o = n ? h(n, "m:val") : void 0;
|
|
948
948
|
if (o === "left" || o === "right") return o;
|
|
949
949
|
if (o === "center" || o === "centerGroup") return "center";
|
|
950
950
|
}
|
|
951
|
-
function
|
|
951
|
+
function Mt(t, e, n) {
|
|
952
952
|
for (const o of t)
|
|
953
953
|
switch (n.trackFields && (n.fieldTrack.markBlock = n.fieldTrack.openId), o.tagName) {
|
|
954
954
|
case "w:p": {
|
|
955
|
-
const i =
|
|
955
|
+
const i = En(o, n);
|
|
956
956
|
n.trackFields && n.fieldTrack.markBlock && (i.fieldId = n.fieldTrack.markBlock), n.blockSdtStack.length && (i.sdtPath = [...n.blockSdtStack]), e.push(i);
|
|
957
957
|
break;
|
|
958
958
|
}
|
|
959
959
|
case "w:tbl": {
|
|
960
|
-
const i =
|
|
960
|
+
const i = Un(o, n);
|
|
961
961
|
n.trackFields && n.fieldTrack.markBlock && (i.fieldId = n.fieldTrack.markBlock), n.blockSdtStack.length && (i.sdtPath = [...n.blockSdtStack]), e.push(i);
|
|
962
962
|
break;
|
|
963
963
|
}
|
|
964
964
|
case "w:sdt": {
|
|
965
965
|
const i = f(o, "w:sdtContent");
|
|
966
966
|
if (!i) break;
|
|
967
|
-
const s =
|
|
967
|
+
const s = Ne(f(o, "w:sdtPr"));
|
|
968
968
|
if (!s) {
|
|
969
|
-
n.warnings.add("sdt-unwrapped", "Content controls were unwrapped to their content."),
|
|
969
|
+
n.warnings.add("sdt-unwrapped", "Content controls were unwrapped to their content."), Mt(ot(i), e, n);
|
|
970
970
|
break;
|
|
971
971
|
}
|
|
972
972
|
const a = `sdt${n.nextSdt.n++}`;
|
|
973
|
-
n.sdts[a] = s, n.blockSdtStack.push(a),
|
|
973
|
+
n.sdts[a] = s, n.blockSdtStack.push(a), Mt(ot(i), e, n), n.blockSdtStack.pop();
|
|
974
974
|
break;
|
|
975
975
|
}
|
|
976
976
|
case "w:bookmarkStart": {
|
|
977
|
-
const i =
|
|
977
|
+
const i = Ce(o), s = h(o, "w:id");
|
|
978
978
|
i && (n.pendingBookmarks.push(i), s && n.pendingMarkers.push({ id: s, name: i, kind: "start", offset: 0 }));
|
|
979
979
|
break;
|
|
980
980
|
}
|
|
@@ -994,126 +994,126 @@ function It(t, e, n) {
|
|
|
994
994
|
break;
|
|
995
995
|
}
|
|
996
996
|
case "m:oMathPara": {
|
|
997
|
-
const i =
|
|
997
|
+
const i = xn(o), s = { kind: "math", root: Re(o), display: !0 };
|
|
998
998
|
i && (s.align = i), n.trackFields && n.fieldTrack.markBlock && (s.fieldId = n.fieldTrack.markBlock), n.blockSdtStack.length && (s.sdtPath = [...n.blockSdtStack]), e.push(s);
|
|
999
999
|
break;
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
1002
|
}
|
|
1003
|
-
function
|
|
1004
|
-
const n = f(t, "w:pPr"), o = n ?
|
|
1003
|
+
function En(t, e) {
|
|
1004
|
+
const n = f(t, "w:pPr"), o = n ? jt(n, e.warnings) : {}, i = [], s = e.pendingBookmarks;
|
|
1005
1005
|
e.pendingBookmarks = [], e.currentBookmarks = s;
|
|
1006
1006
|
const a = e.pendingMarkers;
|
|
1007
1007
|
e.pendingMarkers = [], e.currentMarkers = a;
|
|
1008
1008
|
const r = e.pendingCommentMarkers;
|
|
1009
1009
|
e.pendingCommentMarkers = [], e.currentCommentMarkers = r;
|
|
1010
|
-
const
|
|
1011
|
-
|
|
1010
|
+
const d = { depth: 0, instr: "", suppressResult: !1 };
|
|
1011
|
+
xt(ot(t), i, e, d), e.currentBookmarks = null, e.currentMarkers = null, e.currentCommentMarkers = null;
|
|
1012
1012
|
const u = { kind: "paragraph", props: o, inlines: i };
|
|
1013
|
-
return s.length > 0 && (u.bookmarks = s), a.length > 0 && (u.bookmarkMarkers = a), r.length > 0 && (u.commentMarkers = r),
|
|
1013
|
+
return s.length > 0 && (u.bookmarks = s), a.length > 0 && (u.bookmarkMarkers = a), r.length > 0 && (u.commentMarkers = r), d.tocInstr !== void 0 && (u.tocField = d.tocInstr), u;
|
|
1014
1014
|
}
|
|
1015
|
-
const
|
|
1016
|
-
function
|
|
1015
|
+
const Rn = /* @__PURE__ */ new Set(["PAGE", "NUMPAGES", "DATE", "TIME", "IF"]), Cn = { fontFamily: "", fontSizePx: 16, bold: !1, italic: !1, underline: !1, strikethrough: !1, color: "#000000" };
|
|
1016
|
+
function Bn(t) {
|
|
1017
1017
|
return t.type === "NUMPAGES" ? "{pages}" : t.type === "PAGE" ? `{page${t.numFmt && t.numFmt !== "arabic" ? `:${t.numFmt}` : ""}}` : "";
|
|
1018
1018
|
}
|
|
1019
1019
|
function Qt(t) {
|
|
1020
1020
|
if (/\bNUMPAGES\b/.test(t)) return "{pages}";
|
|
1021
1021
|
if (/\bPAGE\b/.test(t)) return "{page}";
|
|
1022
1022
|
}
|
|
1023
|
-
function
|
|
1023
|
+
function Nn(t) {
|
|
1024
1024
|
const e = t.match(/\bPAGEREF\s+("[^"]+"|\S+)/) ?? t.match(/\bHYPERLINK\s+\\l\s+("[^"]+"|\S+)/);
|
|
1025
1025
|
return e ? e[1].replace(/^"|"$/g, "") : void 0;
|
|
1026
1026
|
}
|
|
1027
|
-
function
|
|
1027
|
+
function xt(t, e, n, o) {
|
|
1028
1028
|
for (const i of t)
|
|
1029
1029
|
switch (i.tagName) {
|
|
1030
1030
|
case "w:r":
|
|
1031
|
-
|
|
1031
|
+
Ln(i, e, n, o);
|
|
1032
1032
|
break;
|
|
1033
1033
|
case "w:hyperlink": {
|
|
1034
1034
|
const s = h(i, "r:id"), a = h(i, "w:anchor"), r = e.length;
|
|
1035
|
-
if (
|
|
1036
|
-
for (let
|
|
1037
|
-
const u = e[
|
|
1038
|
-
|
|
1035
|
+
if (xt(ot(i), e, n, o), s || a)
|
|
1036
|
+
for (let d = r; d < e.length; d++) {
|
|
1037
|
+
const u = e[d], p = u.kind === "run" ? u.props : u.kind === "mathInline" ? u.props ??= {} : void 0;
|
|
1038
|
+
p && (s ? p.linkRelId = s : a && (p.linkAnchor = a));
|
|
1039
1039
|
}
|
|
1040
1040
|
break;
|
|
1041
1041
|
}
|
|
1042
1042
|
case "w:sdt": {
|
|
1043
1043
|
const s = f(i, "w:sdtContent");
|
|
1044
1044
|
if (!s) break;
|
|
1045
|
-
const a =
|
|
1045
|
+
const a = Ne(f(i, "w:sdtPr"));
|
|
1046
1046
|
if (!a) {
|
|
1047
|
-
n.warnings.add("sdt-unwrapped", "Content controls were unwrapped to their content."),
|
|
1047
|
+
n.warnings.add("sdt-unwrapped", "Content controls were unwrapped to their content."), xt(ot(s), e, n, o);
|
|
1048
1048
|
break;
|
|
1049
1049
|
}
|
|
1050
1050
|
const r = `sdt${n.nextSdt.n++}`;
|
|
1051
|
-
n.sdts[r] = a, n.inlineSdtStack.push(r),
|
|
1051
|
+
n.sdts[r] = a, n.inlineSdtStack.push(r), xt(ot(s), e, n, o), n.inlineSdtStack.pop();
|
|
1052
1052
|
break;
|
|
1053
1053
|
}
|
|
1054
1054
|
case "w:fldSimple": {
|
|
1055
1055
|
const s = h(i, "w:instr") ?? "", a = n.fieldTokens ? Qt(s) : void 0;
|
|
1056
|
-
a ? e.push({ kind: "run", text: a, props:
|
|
1056
|
+
a ? e.push({ kind: "run", text: a, props: Fn(i) }) : xt(ot(i), e, n, o);
|
|
1057
1057
|
break;
|
|
1058
1058
|
}
|
|
1059
1059
|
case "w:smartTag":
|
|
1060
1060
|
case "w:ins":
|
|
1061
|
-
|
|
1061
|
+
xt(ot(i), e, n, o);
|
|
1062
1062
|
break;
|
|
1063
1063
|
case "w:del":
|
|
1064
1064
|
break;
|
|
1065
1065
|
case "w:bookmarkStart": {
|
|
1066
|
-
const s =
|
|
1067
|
-
s && n.currentBookmarks && n.currentBookmarks.push(s), s && a && n.currentMarkers && n.currentMarkers.push({ id: a, name: s, kind: "start", offset:
|
|
1066
|
+
const s = Ce(i), a = h(i, "w:id");
|
|
1067
|
+
s && n.currentBookmarks && n.currentBookmarks.push(s), s && a && n.currentMarkers && n.currentMarkers.push({ id: a, name: s, kind: "start", offset: At(e) });
|
|
1068
1068
|
break;
|
|
1069
1069
|
}
|
|
1070
1070
|
case "w:bookmarkEnd": {
|
|
1071
1071
|
const s = h(i, "w:id");
|
|
1072
|
-
s && n.currentMarkers && n.currentMarkers.push({ id: s, kind: "end", offset:
|
|
1072
|
+
s && n.currentMarkers && n.currentMarkers.push({ id: s, kind: "end", offset: At(e) });
|
|
1073
1073
|
break;
|
|
1074
1074
|
}
|
|
1075
1075
|
case "w:commentRangeStart": {
|
|
1076
1076
|
const s = h(i, "w:id");
|
|
1077
|
-
s && n.currentCommentMarkers && n.currentCommentMarkers.push({ id: s, kind: "start", offset:
|
|
1077
|
+
s && n.currentCommentMarkers && n.currentCommentMarkers.push({ id: s, kind: "start", offset: At(e) });
|
|
1078
1078
|
break;
|
|
1079
1079
|
}
|
|
1080
1080
|
case "w:commentRangeEnd": {
|
|
1081
1081
|
const s = h(i, "w:id");
|
|
1082
|
-
s && n.currentCommentMarkers && n.currentCommentMarkers.push({ id: s, kind: "end", offset:
|
|
1082
|
+
s && n.currentCommentMarkers && n.currentCommentMarkers.push({ id: s, kind: "end", offset: At(e) });
|
|
1083
1083
|
break;
|
|
1084
1084
|
}
|
|
1085
1085
|
case "w:commentReference": {
|
|
1086
1086
|
const s = h(i, "w:id");
|
|
1087
|
-
s && n.currentCommentMarkers && n.currentCommentMarkers.push({ id: s, kind: "ref", offset:
|
|
1087
|
+
s && n.currentCommentMarkers && n.currentCommentMarkers.push({ id: s, kind: "ref", offset: At(e) });
|
|
1088
1088
|
break;
|
|
1089
1089
|
}
|
|
1090
1090
|
case "m:oMath": {
|
|
1091
|
-
e.push({ kind: "mathInline", root:
|
|
1091
|
+
e.push({ kind: "mathInline", root: Re(i) });
|
|
1092
1092
|
break;
|
|
1093
1093
|
}
|
|
1094
1094
|
}
|
|
1095
1095
|
}
|
|
1096
|
-
function
|
|
1096
|
+
function Fn(t) {
|
|
1097
1097
|
const e = Et(t, "w:r"), n = e && f(e, "w:rPr");
|
|
1098
|
-
return n ?
|
|
1098
|
+
return n ? Pt(n) : {};
|
|
1099
1099
|
}
|
|
1100
|
-
function
|
|
1101
|
-
const i = f(t, "w:rPr"), s = i ?
|
|
1102
|
-
let
|
|
1100
|
+
function Ln(t, e, n, o) {
|
|
1101
|
+
const i = f(t, "w:rPr"), s = i ? Pt(i) : {}, a = e.length, r = n.inlineSdtStack.length ? [...n.inlineSdtStack] : void 0;
|
|
1102
|
+
let d = "";
|
|
1103
1103
|
const u = () => {
|
|
1104
|
-
|
|
1105
|
-
},
|
|
1106
|
-
for (const
|
|
1107
|
-
switch (
|
|
1104
|
+
d.length > 0 && (o.pagerefAnchor && s.linkAnchor === void 0 && s.linkRelId === void 0 && (s.linkAnchor = o.pagerefAnchor), e.push({ kind: "run", text: d, props: s, ...o.resultFieldId ? { fieldId: o.resultFieldId } : {} })), d = "";
|
|
1105
|
+
}, p = (l) => {
|
|
1106
|
+
for (const m of l)
|
|
1107
|
+
switch (m.tagName) {
|
|
1108
1108
|
case "w:t":
|
|
1109
|
-
o.suppressResult || (
|
|
1109
|
+
o.suppressResult || (d += It(m));
|
|
1110
1110
|
break;
|
|
1111
1111
|
case "w:tab":
|
|
1112
|
-
o.suppressResult || (
|
|
1112
|
+
o.suppressResult || (d += " ");
|
|
1113
1113
|
break;
|
|
1114
1114
|
case "w:br": {
|
|
1115
1115
|
u();
|
|
1116
|
-
const g = h(
|
|
1116
|
+
const g = h(m, "w:type");
|
|
1117
1117
|
g === "page" ? e.push({ kind: "break", page: !0 }) : g === "column" ? e.push({ kind: "break", column: !0 }) : e.push({ kind: "break" });
|
|
1118
1118
|
break;
|
|
1119
1119
|
}
|
|
@@ -1121,18 +1121,18 @@ function Nn(t, e, n, o) {
|
|
|
1121
1121
|
u(), e.push({ kind: "break" });
|
|
1122
1122
|
break;
|
|
1123
1123
|
case "w:noBreakHyphen":
|
|
1124
|
-
|
|
1124
|
+
d += "‑";
|
|
1125
1125
|
break;
|
|
1126
1126
|
case "w:commentReference": {
|
|
1127
|
-
const g = h(
|
|
1128
|
-
g && n.currentCommentMarkers && n.currentCommentMarkers.push({ id: g, kind: "ref", offset:
|
|
1127
|
+
const g = h(m, "w:id");
|
|
1128
|
+
g && n.currentCommentMarkers && n.currentCommentMarkers.push({ id: g, kind: "ref", offset: At(e) + d.length });
|
|
1129
1129
|
break;
|
|
1130
1130
|
}
|
|
1131
1131
|
case "w:sym": {
|
|
1132
|
-
const g = h(
|
|
1132
|
+
const g = h(m, "w:font"), v = h(m, "w:char");
|
|
1133
1133
|
g && v && (u(), e.push({
|
|
1134
1134
|
kind: "run",
|
|
1135
|
-
text:
|
|
1135
|
+
text: Dn(v),
|
|
1136
1136
|
props: { ...s, symbol: { font: g, char: v.toUpperCase() } },
|
|
1137
1137
|
...o.resultFieldId ? { fieldId: o.resultFieldId } : {}
|
|
1138
1138
|
}));
|
|
@@ -1140,13 +1140,13 @@ function Nn(t, e, n, o) {
|
|
|
1140
1140
|
}
|
|
1141
1141
|
case "w:drawing": {
|
|
1142
1142
|
u();
|
|
1143
|
-
const g = Hn(
|
|
1143
|
+
const g = Hn(m, n);
|
|
1144
1144
|
g && e.push(g);
|
|
1145
1145
|
break;
|
|
1146
1146
|
}
|
|
1147
1147
|
case "w:pict": {
|
|
1148
1148
|
u();
|
|
1149
|
-
const g = jn(
|
|
1149
|
+
const g = jn(m, n);
|
|
1150
1150
|
g && e.push(g);
|
|
1151
1151
|
break;
|
|
1152
1152
|
}
|
|
@@ -1155,55 +1155,55 @@ function Nn(t, e, n, o) {
|
|
|
1155
1155
|
break;
|
|
1156
1156
|
case "w:instrText":
|
|
1157
1157
|
if (o.depth > 0) {
|
|
1158
|
-
o.instr +=
|
|
1159
|
-
const g =
|
|
1158
|
+
o.instr += It(m);
|
|
1159
|
+
const g = Nn(o.instr);
|
|
1160
1160
|
g && (o.pagerefAnchor = g);
|
|
1161
|
-
const v =
|
|
1161
|
+
const v = It(m);
|
|
1162
1162
|
o.tocInstr === void 0 && /\bTOC\b/.test(v) && (o.tocInstr = v);
|
|
1163
1163
|
}
|
|
1164
|
-
n.trackFields && n.fieldTrack.depth === 1 && (n.fieldTrack.topInstr +=
|
|
1164
|
+
n.trackFields && n.fieldTrack.depth === 1 && (n.fieldTrack.topInstr += It(m));
|
|
1165
1165
|
break;
|
|
1166
1166
|
case "w:fldChar":
|
|
1167
|
-
|
|
1167
|
+
On(m, s, e, n, o);
|
|
1168
1168
|
break;
|
|
1169
1169
|
case "mc:AlternateContent": {
|
|
1170
|
-
const g = f(
|
|
1171
|
-
g &&
|
|
1170
|
+
const g = f(m, "mc:Choice") ?? f(m, "mc:Fallback");
|
|
1171
|
+
g && p(ot(g));
|
|
1172
1172
|
break;
|
|
1173
1173
|
}
|
|
1174
1174
|
case "w:footnoteReference": {
|
|
1175
|
-
const g = h(
|
|
1175
|
+
const g = h(m, "w:id");
|
|
1176
1176
|
g !== void 0 && (u(), e.push({ kind: "run", text: "", props: { ...s, footnoteId: g } }));
|
|
1177
1177
|
break;
|
|
1178
1178
|
}
|
|
1179
1179
|
case "w:endnoteReference": {
|
|
1180
|
-
const g = h(
|
|
1180
|
+
const g = h(m, "w:id");
|
|
1181
1181
|
g !== void 0 && (u(), e.push({ kind: "run", text: "", props: { ...s, endnoteId: g } }));
|
|
1182
1182
|
break;
|
|
1183
1183
|
}
|
|
1184
1184
|
}
|
|
1185
1185
|
};
|
|
1186
|
-
if (
|
|
1187
|
-
for (let
|
|
1188
|
-
const
|
|
1189
|
-
|
|
1186
|
+
if (p(ot(t)), u(), r)
|
|
1187
|
+
for (let l = a; l < e.length; l++) {
|
|
1188
|
+
const m = e[l];
|
|
1189
|
+
m.kind === "run" && (m.sdtPath = r);
|
|
1190
1190
|
}
|
|
1191
1191
|
}
|
|
1192
|
-
function
|
|
1192
|
+
function On(t, e, n, o, i) {
|
|
1193
1193
|
const s = o.fieldTrack;
|
|
1194
1194
|
switch (h(t, "w:fldCharType")) {
|
|
1195
1195
|
case "begin":
|
|
1196
1196
|
i.depth++, i.depth === 1 && (i.instr = "", i.suppressResult = !1, i.pagerefAnchor = void 0, i.resultFieldId = void 0), o.trackFields && (s.depth++, s.depth === 1 && (s.topInstr = "", s.openId = null));
|
|
1197
1197
|
break;
|
|
1198
1198
|
case "separate": {
|
|
1199
|
-
if (o.trackFields && s.depth === 1 &&
|
|
1199
|
+
if (o.trackFields && s.depth === 1 && pe(o), i.depth !== 1) break;
|
|
1200
1200
|
if (o.trackFields) {
|
|
1201
1201
|
const r = te(i.instr);
|
|
1202
|
-
if (
|
|
1203
|
-
const
|
|
1204
|
-
if (
|
|
1202
|
+
if (Rn.has(r.name)) {
|
|
1203
|
+
const d = on(r, Cn);
|
|
1204
|
+
if (d) {
|
|
1205
1205
|
const u = `field${s.next.n++}`;
|
|
1206
|
-
s.registry[u] = { id: u, instruction: i.instr, name: r.name, kind: "builtin", spec:
|
|
1206
|
+
s.registry[u] = { id: u, instruction: i.instr, name: r.name, kind: "builtin", spec: d }, d.type === "PAGE" || d.type === "NUMPAGES" ? (n.push({ kind: "run", text: Bn(d), props: e, fieldId: u }), i.suppressResult = !0) : i.resultFieldId = u;
|
|
1207
1207
|
break;
|
|
1208
1208
|
}
|
|
1209
1209
|
}
|
|
@@ -1213,7 +1213,7 @@ function Ln(t, e, n, o, i) {
|
|
|
1213
1213
|
break;
|
|
1214
1214
|
}
|
|
1215
1215
|
case "end":
|
|
1216
|
-
if (o.trackFields && s.depth > 0 && (s.depth === 1 && (
|
|
1216
|
+
if (o.trackFields && s.depth > 0 && (s.depth === 1 && (pe(o), s.openId = null, s.topInstr = ""), s.depth--), i.depth > 0 && i.depth--, i.depth === 0) {
|
|
1217
1217
|
if (!i.suppressResult) {
|
|
1218
1218
|
const a = o.fieldTokens ? Qt(i.instr) : void 0;
|
|
1219
1219
|
a && n.push({ kind: "run", text: a, props: e });
|
|
@@ -1223,7 +1223,7 @@ function Ln(t, e, n, o, i) {
|
|
|
1223
1223
|
break;
|
|
1224
1224
|
}
|
|
1225
1225
|
}
|
|
1226
|
-
function
|
|
1226
|
+
function Dn(t) {
|
|
1227
1227
|
const e = parseInt(t, 16);
|
|
1228
1228
|
return Number.isFinite(e) && e > 0 && e <= 1114111 ? String.fromCodePoint(e) : "�";
|
|
1229
1229
|
}
|
|
@@ -1235,34 +1235,34 @@ function Hn(t, e) {
|
|
|
1235
1235
|
e.warnings.add("images-skipped", "A drawing without an embedded image reference was skipped.");
|
|
1236
1236
|
return;
|
|
1237
1237
|
}
|
|
1238
|
-
const a = f(o, "wp:extent"), r = { kind: "image", relId: s, anchored: !!n },
|
|
1239
|
-
|
|
1238
|
+
const a = f(o, "wp:extent"), r = { kind: "image", relId: s, anchored: !!n }, d = y(a, "cx");
|
|
1239
|
+
d !== void 0 && (r.widthEmu = d);
|
|
1240
1240
|
const u = y(a, "cy");
|
|
1241
1241
|
u !== void 0 && (r.heightEmu = u);
|
|
1242
|
-
const
|
|
1243
|
-
if (
|
|
1244
|
-
const
|
|
1245
|
-
const v = y(
|
|
1242
|
+
const p = Et(o, "a:srcRect");
|
|
1243
|
+
if (p) {
|
|
1244
|
+
const l = (g) => {
|
|
1245
|
+
const v = y(p, g);
|
|
1246
1246
|
return v !== void 0 && Number.isFinite(v) ? v / 1e5 : 0;
|
|
1247
|
-
},
|
|
1248
|
-
(
|
|
1247
|
+
}, m = { left: l("l"), top: l("t"), right: l("r"), bottom: l("b") };
|
|
1248
|
+
(m.left || m.top || m.right || m.bottom) && m.left + m.right < 1 && m.top + m.bottom < 1 && (r.crop = m);
|
|
1249
1249
|
}
|
|
1250
1250
|
if (n) {
|
|
1251
|
-
const
|
|
1252
|
-
r.anchorWrap =
|
|
1253
|
-
const g = f(n, "wp:positionH"), v = f(n, "wp:positionV"), P = g && f(g, "wp:align"), T = P &&
|
|
1254
|
-
if ((T === "left" || T === "right" || T === "center") && (r.anchorAlign = T),
|
|
1255
|
-
const
|
|
1251
|
+
const l = f(n, "wp:wrapSquare") ?? f(n, "wp:wrapTight") ?? f(n, "wp:wrapThrough"), m = f(n, "wp:wrapNone");
|
|
1252
|
+
r.anchorWrap = l ? "square" : "block";
|
|
1253
|
+
const g = f(n, "wp:positionH"), v = f(n, "wp:positionV"), P = g && f(g, "wp:align"), T = P && It(P);
|
|
1254
|
+
if ((T === "left" || T === "right" || T === "center") && (r.anchorAlign = T), m) {
|
|
1255
|
+
const F = Et(n, "adec:decorative"), L = y(n, "relativeHeight");
|
|
1256
1256
|
r.anchorFloat = {
|
|
1257
1257
|
behind: h(n, "behindDoc") === "1",
|
|
1258
1258
|
offsetXEmu: he(g),
|
|
1259
1259
|
offsetYEmu: he(v),
|
|
1260
|
-
relFromH:
|
|
1260
|
+
relFromH: Wn(g),
|
|
1261
1261
|
relFromV: $n(v),
|
|
1262
|
-
decorative: !!
|
|
1262
|
+
decorative: !!F && h(F, "val") !== "0",
|
|
1263
1263
|
...L !== void 0 ? { z: L } : {}
|
|
1264
1264
|
};
|
|
1265
|
-
} else
|
|
1265
|
+
} else l || e.warnings.add(
|
|
1266
1266
|
"images-anchored",
|
|
1267
1267
|
"Some floating images (overlapping or top-and-bottom wrap) were placed in the text flow."
|
|
1268
1268
|
);
|
|
@@ -1270,17 +1270,17 @@ function Hn(t, e) {
|
|
|
1270
1270
|
return r;
|
|
1271
1271
|
}
|
|
1272
1272
|
function he(t) {
|
|
1273
|
-
const e = t && f(t, "wp:posOffset"), n = e ? Number(
|
|
1273
|
+
const e = t && f(t, "wp:posOffset"), n = e ? Number(It(e).trim()) : NaN;
|
|
1274
1274
|
return Number.isFinite(n) ? n : 0;
|
|
1275
1275
|
}
|
|
1276
|
-
const
|
|
1277
|
-
function
|
|
1276
|
+
const zn = /* @__PURE__ */ new Set(["page", "margin", "column", "leftMargin", "rightMargin", "character"]), _n = /* @__PURE__ */ new Set(["page", "margin", "paragraph", "line", "topMargin", "bottomMargin"]);
|
|
1277
|
+
function Wn(t) {
|
|
1278
1278
|
const e = t && h(t, "relativeFrom");
|
|
1279
|
-
return e &&
|
|
1279
|
+
return e && zn.has(e) ? e : "column";
|
|
1280
1280
|
}
|
|
1281
1281
|
function $n(t) {
|
|
1282
1282
|
const e = t && h(t, "relativeFrom");
|
|
1283
|
-
return e &&
|
|
1283
|
+
return e && _n.has(e) ? e : "paragraph";
|
|
1284
1284
|
}
|
|
1285
1285
|
function jn(t, e) {
|
|
1286
1286
|
const n = Et(t, "v:imagedata"), o = n && h(n, "r:id");
|
|
@@ -1288,15 +1288,15 @@ function jn(t, e) {
|
|
|
1288
1288
|
e.warnings.add("images-skipped", "A legacy picture without an image reference was skipped.");
|
|
1289
1289
|
return;
|
|
1290
1290
|
}
|
|
1291
|
-
const i = { kind: "image", relId: o, anchored: !1 }, s = Et(t, "v:shape"), a = (s && h(s, "style")) ?? "", r = (
|
|
1292
|
-
const
|
|
1293
|
-
return
|
|
1294
|
-
},
|
|
1295
|
-
|
|
1291
|
+
const i = { kind: "image", relId: o, anchored: !1 }, s = Et(t, "v:shape"), a = (s && h(s, "style")) ?? "", r = (p) => {
|
|
1292
|
+
const l = a.match(new RegExp(`(?:^|;)\\s*${p}:([\\d.]+)pt`));
|
|
1293
|
+
return l ? Number(l[1]) * 12700 : void 0;
|
|
1294
|
+
}, d = r("width");
|
|
1295
|
+
d !== void 0 && (i.widthEmu = d);
|
|
1296
1296
|
const u = r("height");
|
|
1297
1297
|
return u !== void 0 && (i.heightEmu = u), i;
|
|
1298
1298
|
}
|
|
1299
|
-
function
|
|
1299
|
+
function Be(t) {
|
|
1300
1300
|
if (!t) return;
|
|
1301
1301
|
const e = (r) => y(f(t, r), "w:w"), n = {}, o = e("w:top");
|
|
1302
1302
|
o !== void 0 && (n.top = o);
|
|
@@ -1316,14 +1316,14 @@ function Gn(t) {
|
|
|
1316
1316
|
}
|
|
1317
1317
|
return Z(f(t, "w:cantSplit")) && (e.cantSplit = !0), Z(f(t, "w:tblHeader")) && (e.tblHeader = !0), Object.keys(e).length > 0 ? e : void 0;
|
|
1318
1318
|
}
|
|
1319
|
-
function
|
|
1319
|
+
function Un(t, e) {
|
|
1320
1320
|
const n = [];
|
|
1321
1321
|
for (const a of dt(t, "w:tr")) {
|
|
1322
1322
|
const r = [];
|
|
1323
|
-
for (const
|
|
1324
|
-
r.push(
|
|
1325
|
-
const
|
|
1326
|
-
u && (
|
|
1323
|
+
for (const p of dt(a, "w:tc"))
|
|
1324
|
+
r.push(Vn(p, e));
|
|
1325
|
+
const d = { cells: r }, u = Gn(f(a, "w:trPr"));
|
|
1326
|
+
u && (d.props = u), n.push(d);
|
|
1327
1327
|
}
|
|
1328
1328
|
const o = { kind: "table", rows: n }, i = f(t, "w:tblGrid");
|
|
1329
1329
|
if (i) {
|
|
@@ -1350,15 +1350,15 @@ function _n(t, e) {
|
|
|
1350
1350
|
};
|
|
1351
1351
|
}
|
|
1352
1352
|
f(s, "w:tblBorders") && (o.bordersSpecified = !0);
|
|
1353
|
-
const
|
|
1354
|
-
|
|
1355
|
-
const u =
|
|
1353
|
+
const d = Yt(f(s, "w:tblBorders"));
|
|
1354
|
+
d && (o.borders = d);
|
|
1355
|
+
const u = Ft(f(s, "w:shd"));
|
|
1356
1356
|
u && (o.shd = u);
|
|
1357
|
-
const
|
|
1358
|
-
|
|
1359
|
-
const
|
|
1360
|
-
|
|
1361
|
-
const
|
|
1357
|
+
const p = Be(f(s, "w:tblCellMar"));
|
|
1358
|
+
p && (o.cellMarginTwips = p);
|
|
1359
|
+
const l = f(s, "w:tblLayout"), m = l ? h(l, "w:type") : void 0, g = f(s, "w:tblW"), v = g && h(g, "w:type"), P = g ? y(g, "w:w") : void 0, T = v === "pct" && (P ?? 0) > 0;
|
|
1360
|
+
m === "autofit" ? o.widthMode = T ? "autofitWindow" : "autofitContents" : m !== "fixed" && T && (o.widthMode = "autofitWindow"), o.widthMode || (v === "dxa" && P !== void 0 && P > 0 ? o.preferredWidthTwips = P : T && m === "fixed" && (o.preferredWidthPct = (P ?? 0) / 50));
|
|
1361
|
+
const F = f(s, "w:jc"), L = F ? h(F, "w:val") : void 0;
|
|
1362
1362
|
L === "center" ? o.align = "center" : (L === "right" || L === "end") && (o.align = "right");
|
|
1363
1363
|
const x = f(s, "w:tblInd");
|
|
1364
1364
|
if (x) {
|
|
@@ -1368,78 +1368,78 @@ function _n(t, e) {
|
|
|
1368
1368
|
Z(f(s, "w:bidiVisual")) && (o.bidiVisual = !0);
|
|
1369
1369
|
const tt = nt(s, "w:tblOverlap");
|
|
1370
1370
|
tt === "never" ? o.overlap = "never" : tt === "overlap" && (o.overlap = "overlap");
|
|
1371
|
-
const
|
|
1372
|
-
|
|
1371
|
+
const W = nt(s, "w:tblCaption");
|
|
1372
|
+
W && (o.caption = W);
|
|
1373
1373
|
const ft = nt(s, "w:tblDescription");
|
|
1374
1374
|
ft && (o.description = ft);
|
|
1375
1375
|
}
|
|
1376
1376
|
return o;
|
|
1377
1377
|
}
|
|
1378
|
-
function
|
|
1378
|
+
function Vn(t, e) {
|
|
1379
1379
|
const n = f(t, "w:tcPr"), o = (n && y(f(n, "w:gridSpan"), "w:val")) ?? 1, i = n && f(n, "w:vMerge"), s = !!i && (h(i, "w:val") ?? "continue") === "continue", a = [], r = e.blockSdtStack;
|
|
1380
|
-
e.blockSdtStack = [],
|
|
1381
|
-
const
|
|
1380
|
+
e.blockSdtStack = [], Mt(ot(t), a, e), e.blockSdtStack = r;
|
|
1381
|
+
const d = { blocks: a, gridSpan: o, vMergeContinue: s };
|
|
1382
1382
|
if (n) {
|
|
1383
|
-
f(n, "w:tcBorders") && (
|
|
1383
|
+
f(n, "w:tcBorders") && (d.bordersSpecified = !0);
|
|
1384
1384
|
const u = Yt(f(n, "w:tcBorders"));
|
|
1385
|
-
u && (
|
|
1386
|
-
const
|
|
1387
|
-
|
|
1388
|
-
const
|
|
1389
|
-
|
|
1390
|
-
const
|
|
1391
|
-
if (
|
|
1392
|
-
const
|
|
1393
|
-
|
|
1385
|
+
u && (d.borders = u);
|
|
1386
|
+
const p = Ft(f(n, "w:shd"));
|
|
1387
|
+
p && (d.shd = p);
|
|
1388
|
+
const l = Be(f(n, "w:tcMar"));
|
|
1389
|
+
l && (d.marginTwips = l);
|
|
1390
|
+
const m = f(n, "w:tcW"), g = m ? y(m, "w:w") : void 0;
|
|
1391
|
+
if (m && g !== void 0 && g > 0) {
|
|
1392
|
+
const F = h(m, "w:type");
|
|
1393
|
+
F === "pct" ? d.preferredWidth = { type: "pct", frac: g / 5e3 } : (F === "dxa" || F === void 0) && (d.preferredWidth = { type: "abs", twips: g });
|
|
1394
1394
|
}
|
|
1395
1395
|
const v = f(n, "w:vAlign"), P = v && h(v, "w:val");
|
|
1396
|
-
(P === "center" || P === "bottom") && (
|
|
1396
|
+
(P === "center" || P === "bottom") && (d.vAlign = P);
|
|
1397
1397
|
const T = nt(n, "w:textDirection");
|
|
1398
|
-
(T === "tbRl" || T === "btLr" || T === "lrTbV" || T === "tbRlV" || T === "tbLrV") && (
|
|
1398
|
+
(T === "tbRl" || T === "btLr" || T === "lrTbV" || T === "tbRlV" || T === "tbLrV") && (d.textDirection = T), Z(f(n, "w:noWrap")) && (d.noWrap = !0), Z(f(n, "w:tcFitText")) && (d.fitText = !0), Z(f(n, "w:hideMark")) && (d.hideMark = !0);
|
|
1399
1399
|
}
|
|
1400
|
-
return
|
|
1400
|
+
return d;
|
|
1401
1401
|
}
|
|
1402
|
-
function
|
|
1402
|
+
function Ne(t) {
|
|
1403
1403
|
if (!t) return null;
|
|
1404
1404
|
const e = { type: "richText" }, n = f(t, "w:alias"), o = n && h(n, "w:val");
|
|
1405
1405
|
o && (e.alias = o);
|
|
1406
1406
|
const i = f(t, "w:tag"), s = i && h(i, "w:val");
|
|
1407
1407
|
s && (e.tag = s), f(t, "w:text") && (e.type = "plainText");
|
|
1408
1408
|
const a = f(t, "w:dropDownList") ?? f(t, "w:comboBox");
|
|
1409
|
-
a && (e.type = a.tagName === "w:dropDownList" ? "dropDown" : "comboBox", e.listItems = dt(a, "w:listItem").map((
|
|
1410
|
-
display: h(
|
|
1411
|
-
value: h(
|
|
1409
|
+
a && (e.type = a.tagName === "w:dropDownList" ? "dropDown" : "comboBox", e.listItems = dt(a, "w:listItem").map((l) => ({
|
|
1410
|
+
display: h(l, "w:displayText") ?? h(l, "w:value") ?? "",
|
|
1411
|
+
value: h(l, "w:value") ?? h(l, "w:displayText") ?? ""
|
|
1412
1412
|
})));
|
|
1413
1413
|
const r = f(t, "w:date");
|
|
1414
1414
|
if (r) {
|
|
1415
1415
|
e.type = "date";
|
|
1416
|
-
const
|
|
1417
|
-
|
|
1416
|
+
const l = f(r, "w:dateFormat"), m = l && h(l, "w:val");
|
|
1417
|
+
m && (e.dateFormat = m);
|
|
1418
1418
|
}
|
|
1419
|
-
const
|
|
1420
|
-
if (
|
|
1419
|
+
const d = f(t, "w14:checkbox");
|
|
1420
|
+
if (d) {
|
|
1421
1421
|
e.type = "checkbox";
|
|
1422
|
-
const
|
|
1423
|
-
e.checked =
|
|
1422
|
+
const l = f(d, "w14:checked"), m = l && h(l, "w14:val");
|
|
1423
|
+
e.checked = m === "1" || m === "true";
|
|
1424
1424
|
}
|
|
1425
1425
|
if (e.type === "richText" && s && /^(wesign:signature|signature)(:|$)/i.test(s)) {
|
|
1426
1426
|
e.type = "signature";
|
|
1427
|
-
const
|
|
1428
|
-
|
|
1427
|
+
const l = s.split(":"), m = l.length > 2 ? l.slice(2).join(":") : void 0;
|
|
1428
|
+
m && (e.participantId = m), o && !e.signerName && (e.signerName = o);
|
|
1429
1429
|
}
|
|
1430
1430
|
f(t, "w:showingPlcHdr") && (e.placeholder = !0);
|
|
1431
|
-
const u = f(t, "w:lock"),
|
|
1432
|
-
return (
|
|
1431
|
+
const u = f(t, "w:lock"), p = u && h(u, "w:val");
|
|
1432
|
+
return (p === "contentLocked" || p === "sdtContentLocked") && (e.lockContent = !0), (p === "sdtLocked" || p === "sdtContentLocked") && (e.lockControl = !0), e;
|
|
1433
1433
|
}
|
|
1434
|
-
function
|
|
1434
|
+
function Xn(t, e) {
|
|
1435
1435
|
const n = {}, o = f(t, "w:pgSz"), i = y(o, "w:w");
|
|
1436
1436
|
i !== void 0 && (n.pageWidthTwips = i);
|
|
1437
1437
|
const s = y(o, "w:h");
|
|
1438
1438
|
s !== void 0 && (n.pageHeightTwips = s);
|
|
1439
1439
|
const a = f(t, "w:pgMar");
|
|
1440
1440
|
if (a) {
|
|
1441
|
-
const v = y(a, "w:top"), P = y(a, "w:right"), T = y(a, "w:bottom"),
|
|
1442
|
-
v !== void 0 && P !== void 0 && T !== void 0 &&
|
|
1441
|
+
const v = y(a, "w:top"), P = y(a, "w:right"), T = y(a, "w:bottom"), F = y(a, "w:left");
|
|
1442
|
+
v !== void 0 && P !== void 0 && T !== void 0 && F !== void 0 && (n.marginTwips = { top: v, right: P, bottom: T, left: F });
|
|
1443
1443
|
const L = y(a, "w:header");
|
|
1444
1444
|
L !== void 0 && (n.headerDistTwips = L);
|
|
1445
1445
|
const x = y(a, "w:footer");
|
|
@@ -1447,8 +1447,8 @@ function Vn(t, e) {
|
|
|
1447
1447
|
}
|
|
1448
1448
|
const r = ge(dt(t, "w:headerReference"));
|
|
1449
1449
|
r && (n.headerRefs = r);
|
|
1450
|
-
const
|
|
1451
|
-
|
|
1450
|
+
const d = ge(dt(t, "w:footerReference"));
|
|
1451
|
+
d && (n.footerRefs = d), f(t, "w:titlePg") && (n.titlePg = !0);
|
|
1452
1452
|
const u = f(t, "w:cols");
|
|
1453
1453
|
if (u) {
|
|
1454
1454
|
const v = dt(u, "w:col"), P = y(u, "w:num") ?? (v.length > 1 ? v.length : 1);
|
|
@@ -1456,35 +1456,35 @@ function Vn(t, e) {
|
|
|
1456
1456
|
n.columns = { count: P };
|
|
1457
1457
|
const T = y(u, "w:space");
|
|
1458
1458
|
if (T !== void 0 && (n.columns.spaceTwips = T), (h(u, "w:sep") === "1" || h(u, "w:sep") === "true") && (n.columns.sep = !0), v.length === P) {
|
|
1459
|
-
const
|
|
1459
|
+
const F = v.map((L) => ({
|
|
1460
1460
|
wTwips: y(L, "w:w") ?? 0,
|
|
1461
1461
|
spaceTwips: y(L, "w:space") ?? 0
|
|
1462
1462
|
}));
|
|
1463
|
-
|
|
1463
|
+
F.some((L) => L.wTwips > 0) && (n.columns.cols = F);
|
|
1464
1464
|
}
|
|
1465
1465
|
}
|
|
1466
1466
|
}
|
|
1467
|
-
const
|
|
1468
|
-
if (
|
|
1467
|
+
const p = f(t, "w:pgBorders");
|
|
1468
|
+
if (p) {
|
|
1469
1469
|
const P = {
|
|
1470
|
-
offsetFrom: h(
|
|
1471
|
-
}, T = (
|
|
1472
|
-
const L = f(
|
|
1470
|
+
offsetFrom: h(p, "w:offsetFrom") === "text" ? "text" : "page"
|
|
1471
|
+
}, T = (F) => {
|
|
1472
|
+
const L = f(p, "w:" + F);
|
|
1473
1473
|
if (!L) return;
|
|
1474
|
-
const x = y(L, "w:sz"), tt = y(L, "w:space"),
|
|
1475
|
-
P[
|
|
1474
|
+
const x = y(L, "w:sz"), tt = y(L, "w:space"), W = h(L, "w:color");
|
|
1475
|
+
P[F] = {
|
|
1476
1476
|
style: h(L, "w:val") ?? "single",
|
|
1477
1477
|
...x !== void 0 ? { sz: x } : {},
|
|
1478
1478
|
...tt !== void 0 ? { space: tt } : {},
|
|
1479
|
-
|
|
1479
|
+
...W !== void 0 ? { color: W } : {}
|
|
1480
1480
|
};
|
|
1481
1481
|
};
|
|
1482
1482
|
T("top"), T("right"), T("bottom"), T("left"), (P.top || P.right || P.bottom || P.left) && (n.pageBorders = P);
|
|
1483
1483
|
}
|
|
1484
|
-
const
|
|
1485
|
-
|
|
1486
|
-
const
|
|
1487
|
-
|
|
1484
|
+
const l = y(f(t, "w:pgNumType"), "w:start");
|
|
1485
|
+
l !== void 0 && (n.pageNumberStart = l);
|
|
1486
|
+
const m = Ee(f(t, "w:lnNumType"));
|
|
1487
|
+
m && (n.lineNumbering = m);
|
|
1488
1488
|
const g = nt(t, "w:type");
|
|
1489
1489
|
return (g === "evenPage" || g === "oddPage") && (n.breakType = g), n;
|
|
1490
1490
|
}
|
|
@@ -1499,8 +1499,8 @@ function ge(t) {
|
|
|
1499
1499
|
}
|
|
1500
1500
|
return Object.keys(e).length > 0 ? e : void 0;
|
|
1501
1501
|
}
|
|
1502
|
-
function
|
|
1503
|
-
const i = /* @__PURE__ */ new Map(), s = wt(
|
|
1502
|
+
function Yn(t, e, n, o = {}) {
|
|
1503
|
+
const i = /* @__PURE__ */ new Map(), s = wt(yt(t, e), "w:footnotes");
|
|
1504
1504
|
if (!s) return i;
|
|
1505
1505
|
const a = {
|
|
1506
1506
|
warnings: n,
|
|
@@ -1519,15 +1519,15 @@ function Xn(t, e, n, o = {}) {
|
|
|
1519
1519
|
fieldTrack: qt()
|
|
1520
1520
|
};
|
|
1521
1521
|
for (const r of dt(s, "w:footnote")) {
|
|
1522
|
-
const
|
|
1523
|
-
if (
|
|
1524
|
-
const
|
|
1525
|
-
|
|
1522
|
+
const d = h(r, "w:id");
|
|
1523
|
+
if (d === void 0 || h(r, "w:type")) continue;
|
|
1524
|
+
const p = [];
|
|
1525
|
+
Mt(ot(r), p, a), i.set(d, p);
|
|
1526
1526
|
}
|
|
1527
1527
|
return i;
|
|
1528
1528
|
}
|
|
1529
|
-
function
|
|
1530
|
-
const i = /* @__PURE__ */ new Map(), s = wt(
|
|
1529
|
+
function qn(t, e, n, o = {}) {
|
|
1530
|
+
const i = /* @__PURE__ */ new Map(), s = wt(yt(t, e), "w:endnotes");
|
|
1531
1531
|
if (!s) return i;
|
|
1532
1532
|
const a = {
|
|
1533
1533
|
warnings: n,
|
|
@@ -1546,26 +1546,26 @@ function Yn(t, e, n, o = {}) {
|
|
|
1546
1546
|
fieldTrack: qt()
|
|
1547
1547
|
};
|
|
1548
1548
|
for (const r of dt(s, "w:endnote")) {
|
|
1549
|
-
const
|
|
1550
|
-
if (
|
|
1551
|
-
const
|
|
1552
|
-
|
|
1549
|
+
const d = h(r, "w:id");
|
|
1550
|
+
if (d === void 0 || h(r, "w:type")) continue;
|
|
1551
|
+
const p = [];
|
|
1552
|
+
Mt(ot(r), p, a), i.set(d, p);
|
|
1553
1553
|
}
|
|
1554
1554
|
return i;
|
|
1555
1555
|
}
|
|
1556
|
-
const
|
|
1556
|
+
const Kn = /* @__PURE__ */ new Set(["single", "double", "dashed", "dotted", "thick", "none"]);
|
|
1557
1557
|
function we(t) {
|
|
1558
|
-
const e = { count: t.count, gapPx: I(
|
|
1558
|
+
const e = { count: t.count, gapPx: I(D(t.spaceTwips ?? 720)) };
|
|
1559
1559
|
return t.sep && (e.sep = !0), t.cols && t.cols.length === t.count && (e.cols = t.cols.map((n) => ({
|
|
1560
|
-
widthPx: I(
|
|
1561
|
-
spaceAfterPx: I(
|
|
1560
|
+
widthPx: I(D(n.wTwips)),
|
|
1561
|
+
spaceAfterPx: I(D(n.spaceTwips))
|
|
1562
1562
|
}))), e;
|
|
1563
1563
|
}
|
|
1564
1564
|
function be(t) {
|
|
1565
1565
|
const e = (r) => {
|
|
1566
1566
|
if (!r) return;
|
|
1567
1567
|
const u = {
|
|
1568
|
-
style:
|
|
1568
|
+
style: Kn.has(r.style) ? r.style : "single",
|
|
1569
1569
|
widthPx: r.sz !== void 0 ? I(r.sz / 6) : 1,
|
|
1570
1570
|
// w:sz is eighth-points
|
|
1571
1571
|
color: !r.color || r.color === "auto" ? "#000000" : `#${r.color}`
|
|
@@ -1582,10 +1582,10 @@ function be(t) {
|
|
|
1582
1582
|
}
|
|
1583
1583
|
function ke(t) {
|
|
1584
1584
|
const e = {};
|
|
1585
|
-
return t.countBy !== void 0 && (e.countBy = t.countBy), t.start !== void 0 && (e.start = t.start), t.restart !== void 0 && (e.restart = t.restart), t.distanceTwips !== void 0 && (e.distancePx = I(
|
|
1585
|
+
return t.countBy !== void 0 && (e.countBy = t.countBy), t.start !== void 0 && (e.start = t.start), t.restart !== void 0 && (e.restart = t.restart), t.distanceTwips !== void 0 && (e.distancePx = I(D(t.distanceTwips))), e;
|
|
1586
1586
|
}
|
|
1587
|
-
const
|
|
1588
|
-
},
|
|
1587
|
+
const Jn = () => {
|
|
1588
|
+
}, Fe = {
|
|
1589
1589
|
fontFamily: "Times New Roman, serif",
|
|
1590
1590
|
fontSizePx: 16,
|
|
1591
1591
|
// 12pt
|
|
@@ -1594,62 +1594,62 @@ const Kn = () => {
|
|
|
1594
1594
|
underline: !1,
|
|
1595
1595
|
strikethrough: !1,
|
|
1596
1596
|
color: "#000000"
|
|
1597
|
-
},
|
|
1597
|
+
}, Zn = {
|
|
1598
1598
|
align: "left",
|
|
1599
1599
|
lineHeight: 1,
|
|
1600
1600
|
spaceBeforePx: 0,
|
|
1601
1601
|
spaceAfterPx: 0,
|
|
1602
1602
|
indentFirstLinePx: 0,
|
|
1603
1603
|
indentLeftPx: 0
|
|
1604
|
-
},
|
|
1604
|
+
}, Bt = { top: 0, right: 108, bottom: 0, left: 108 }, Nt = {
|
|
1605
1605
|
pageWidthPx: 816,
|
|
1606
1606
|
pageHeightPx: 1056,
|
|
1607
1607
|
marginPx: { top: 96, right: 96, bottom: 96, left: 96 }
|
|
1608
1608
|
};
|
|
1609
|
-
function
|
|
1609
|
+
function Qn(t, e, n = {}, o = /* @__PURE__ */ new Map(), i = () => ({}), s, a) {
|
|
1610
1610
|
let r = 0;
|
|
1611
|
-
const
|
|
1611
|
+
const d = () => `i${r++}`, u = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map(), P = [], T = (c) => {
|
|
1612
1612
|
let b = v.get(c);
|
|
1613
1613
|
return b === void 0 && (b = String(v.size + 1), v.set(c, b), P.push(c)), b;
|
|
1614
|
-
},
|
|
1615
|
-
let b =
|
|
1616
|
-
return b === void 0 && (b = String(
|
|
1617
|
-
}, tt = /* @__PURE__ */ new Map(),
|
|
1614
|
+
}, F = /* @__PURE__ */ new Map(), L = [], x = (c) => {
|
|
1615
|
+
let b = F.get(c);
|
|
1616
|
+
return b === void 0 && (b = String(F.size + 1), F.set(c, b), L.push(c)), b;
|
|
1617
|
+
}, tt = /* @__PURE__ */ new Map(), W = (c) => {
|
|
1618
1618
|
const b = tt.get(c);
|
|
1619
1619
|
if (b) return b;
|
|
1620
1620
|
const C = o.get(c);
|
|
1621
1621
|
if (!C) return;
|
|
1622
|
-
const
|
|
1623
|
-
return tt.set(c,
|
|
1622
|
+
const z = no(C);
|
|
1623
|
+
return tt.set(c, z), z;
|
|
1624
1624
|
}, ft = Jt(e.run(void 0, {})), J = ve(e.para({})), U = () => ({
|
|
1625
1625
|
kind: "paragraph",
|
|
1626
|
-
id:
|
|
1626
|
+
id: d(),
|
|
1627
1627
|
revision: 0,
|
|
1628
1628
|
runs: [{ text: "", style: { ...ft } }],
|
|
1629
1629
|
style: { ...J }
|
|
1630
1630
|
}), E = (c, b) => {
|
|
1631
1631
|
if (!b) return 0;
|
|
1632
|
-
const C =
|
|
1632
|
+
const C = W(b.numId);
|
|
1633
1633
|
if (!C)
|
|
1634
1634
|
return t.add("list-missing", "A list reference had no matching definition — markers were dropped."), 0;
|
|
1635
1635
|
c.list = { listId: b.numId, level: b.level };
|
|
1636
|
-
const
|
|
1636
|
+
const z = C.levels[Math.min(b.level, C.levels.length - 1)], M = z ? z.indentLeftPx : 0;
|
|
1637
1637
|
return c.indentLeftPx = Math.max(0, I(c.indentLeftPx - M)), c.indentFirstLinePx = 0, M;
|
|
1638
1638
|
}, q = (c) => {
|
|
1639
1639
|
const b = c.sectionPgSize;
|
|
1640
1640
|
return !!b && !!s && (b.w !== s.w || b.h !== s.h);
|
|
1641
1641
|
}, Q = (c) => q(c) || !!c.sectionColumns || c.sectionPageNumberStart !== void 0 || !!c.sectionPgBorders || // An even/odd page-parity break or line numbering is a real, page-breaking
|
|
1642
1642
|
// section even when the geometry is identical to the document section.
|
|
1643
|
-
c.sectionBreakType === "evenPage" || c.sectionBreakType === "oddPage" || !!c.sectionLineNumbering,
|
|
1643
|
+
c.sectionBreakType === "evenPage" || c.sectionBreakType === "oddPage" || !!c.sectionLineNumbering, B = (c) => {
|
|
1644
1644
|
const b = {};
|
|
1645
|
-
return c.sectionPgSize && (b.pageWidthPx = I(
|
|
1646
|
-
},
|
|
1645
|
+
return c.sectionPgSize && (b.pageWidthPx = I(D(c.sectionPgSize.w)), b.pageHeightPx = I(D(c.sectionPgSize.h))), c.sectionMarginTwips && (b.marginPx = Dt(c.sectionMarginTwips)), c.sectionColumns && (b.columns = we(c.sectionColumns)), c.sectionPageNumberStart !== void 0 && (b.pageNumberStart = c.sectionPageNumberStart), c.sectionHeaderDistTwips !== void 0 && (b.headerDistancePx = I(D(c.sectionHeaderDistTwips))), c.sectionFooterDistTwips !== void 0 && (b.footerDistancePx = I(D(c.sectionFooterDistTwips))), c.sectionPgBorders && (b.pageBorders = be(c.sectionPgBorders)), c.sectionLineNumbering && (b.lineNumbering = ke(c.sectionLineNumbering)), b;
|
|
1646
|
+
}, $ = (c) => {
|
|
1647
1647
|
for (let b = c.length - 1; b >= 0; b--) if (c[b].kind === "paragraph") return c[b];
|
|
1648
1648
|
};
|
|
1649
|
-
let
|
|
1650
|
-
const rt = (c, b, C =
|
|
1651
|
-
const
|
|
1652
|
-
let M = !1,
|
|
1649
|
+
let j;
|
|
1650
|
+
const rt = (c, b, C = Jn) => {
|
|
1651
|
+
const z = [];
|
|
1652
|
+
let M = !1, N = !1, Y = !1, G = !1;
|
|
1653
1653
|
const st = (k) => k.some((w) => w.kind !== "paragraph" || w.runs.some((S) => S.text.trim().length > 0 && !S.style.hidden));
|
|
1654
1654
|
let O = 0, A = null;
|
|
1655
1655
|
const at = (k) => {
|
|
@@ -1665,7 +1665,7 @@ function Zn(t, e, n = {}, o = /* @__PURE__ */ new Map(), i = () => ({}), s, a) {
|
|
|
1665
1665
|
}, X = (k, w) => {
|
|
1666
1666
|
const S = R(w);
|
|
1667
1667
|
return JSON.stringify(k.sectionLineNumbering ?? null) !== JSON.stringify(S.lineNumbering ?? null) || (k.sectionPageNumberStart ?? null) !== (S.pageNumberStart ?? null);
|
|
1668
|
-
},
|
|
1668
|
+
}, H = (k) => {
|
|
1669
1669
|
for (let w = k + 1; w < c.length; w++) {
|
|
1670
1670
|
const S = c[w];
|
|
1671
1671
|
if (S.kind !== "paragraph") return !1;
|
|
@@ -1677,41 +1677,41 @@ function Zn(t, e, n = {}, o = /* @__PURE__ */ new Map(), i = () => ({}), s, a) {
|
|
|
1677
1677
|
return !1;
|
|
1678
1678
|
};
|
|
1679
1679
|
for (let k = 0; k < c.length; k++) {
|
|
1680
|
-
const w = c[k], S = w.kind === "paragraph" ? bt(w, b, C) : w.kind === "math" ? [{ kind: "equation", id:
|
|
1681
|
-
if (w.fieldId) for (const
|
|
1682
|
-
if (w.sdtPath) for (const
|
|
1683
|
-
if (w.kind === "paragraph" && w.tocField !== void 0 &&
|
|
1684
|
-
const
|
|
1685
|
-
|
|
1680
|
+
const w = c[k], S = w.kind === "paragraph" ? bt(w, b, C) : w.kind === "math" ? [{ kind: "equation", id: d(), revision: 0, equation: { root: w.root, display: w.display }, align: w.align ?? "center" }] : [pt(w, b, C)];
|
|
1681
|
+
if (w.fieldId) for (const _ of S) _.fieldId = w.fieldId;
|
|
1682
|
+
if (w.sdtPath) for (const _ of S) _.sdtPath = w.sdtPath;
|
|
1683
|
+
if (w.kind === "paragraph" && w.tocField !== void 0 && j === void 0) {
|
|
1684
|
+
const _ = S.find((et) => et.kind === "paragraph") ?? S[0];
|
|
1685
|
+
_ && (j = { blockId: _.id, instruction: w.tocField });
|
|
1686
1686
|
}
|
|
1687
1687
|
if (M && S.length > 0) {
|
|
1688
|
-
const
|
|
1689
|
-
|
|
1688
|
+
const _ = S[0];
|
|
1689
|
+
_.kind === "paragraph" && _.runs.every((Rt) => Rt.text.length === 0 || Rt.style.hidden) || ((w.kind === "paragraph" && e.isHeading(w.props.styleId) || N) && (_.kind === "paragraph" ? _.style.pageBreakBefore = !0 : S.unshift({ ...U(), style: { ...J, pageBreakBefore: !0 } })), M = !1, N = !1);
|
|
1690
1690
|
}
|
|
1691
1691
|
if (w.kind === "paragraph" && w.props.sectionBreak === "page") {
|
|
1692
|
-
const
|
|
1693
|
-
if (Q(
|
|
1694
|
-
let et =
|
|
1692
|
+
const _ = w.props;
|
|
1693
|
+
if (Q(_) || X(_, k)) {
|
|
1694
|
+
let et = $(S);
|
|
1695
1695
|
et || (et = U(), S.push(et));
|
|
1696
|
-
const Rt =
|
|
1697
|
-
et.style.sectionBreak = { type: Rt, props:
|
|
1696
|
+
const Rt = _.sectionBreakType ?? "nextPage";
|
|
1697
|
+
et.style.sectionBreak = { type: Rt, props: B(_) }, M = !1;
|
|
1698
1698
|
} else
|
|
1699
|
-
|
|
1699
|
+
_.sectionHasBands && t.add(
|
|
1700
1700
|
"section-bands-flattened",
|
|
1701
1701
|
"Per-section headers/footers on geometry-preserving section breaks were not applied (the document section's are used)."
|
|
1702
|
-
), M = !0,
|
|
1702
|
+
), M = !0, N = !Y && G || H(k), O > 0 && A && H(O - 1) && (A.style.pageBreakBefore = !0);
|
|
1703
1703
|
Y = !0;
|
|
1704
1704
|
}
|
|
1705
|
-
w.kind === "paragraph" && w.props.sectionBreak !== void 0 ? (O = k + 1, A = null) : A || (A = at(S) ?? null),
|
|
1705
|
+
w.kind === "paragraph" && w.props.sectionBreak !== void 0 ? (O = k + 1, A = null) : A || (A = at(S) ?? null), z.push(...S), Y || (G ||= st(S));
|
|
1706
1706
|
}
|
|
1707
|
-
return ht(
|
|
1707
|
+
return ht(z), z;
|
|
1708
1708
|
}, ht = (c) => {
|
|
1709
|
-
const b = (M) => M.kind === "image" || M.kind === "table", C = (M) => M.kind === "paragraph" && M.runs.every((
|
|
1709
|
+
const b = (M) => M.kind === "image" || M.kind === "table", C = (M) => M.kind === "paragraph" && M.runs.every((N) => N.text.trim().length === 0 || N.style.hidden), z = (M) => M.kind === "paragraph" ? M.runs.reduce((N, Y) => N + Y.text.length, 0) : 0;
|
|
1710
1710
|
for (let M = 0; M < c.length; M++) {
|
|
1711
|
-
const
|
|
1712
|
-
if (
|
|
1711
|
+
const N = c[M];
|
|
1712
|
+
if (N.kind !== "paragraph" || !N.style.namedStyle || !e.isHeading(N.style.namedStyle)) continue;
|
|
1713
1713
|
const Y = [];
|
|
1714
|
-
let
|
|
1714
|
+
let G = 0, st = -1;
|
|
1715
1715
|
for (let O = M + 1; O < c.length && O <= M + 6; O++) {
|
|
1716
1716
|
const A = c[O];
|
|
1717
1717
|
if (b(A)) {
|
|
@@ -1720,39 +1720,39 @@ function Zn(t, e, n = {}, o = /* @__PURE__ */ new Map(), i = () => ({}), s, a) {
|
|
|
1720
1720
|
}
|
|
1721
1721
|
if (A.kind !== "paragraph") break;
|
|
1722
1722
|
if (!C(A)) {
|
|
1723
|
-
if (
|
|
1724
|
-
|
|
1723
|
+
if (G >= 2 || z(A) > 300) break;
|
|
1724
|
+
G++, Y.push(A);
|
|
1725
1725
|
}
|
|
1726
1726
|
}
|
|
1727
1727
|
if (!(st < 0)) {
|
|
1728
|
-
|
|
1728
|
+
N.style.keepWithNext = !0;
|
|
1729
1729
|
for (const O of Y) O.style.keepWithNext = !0;
|
|
1730
1730
|
}
|
|
1731
1731
|
}
|
|
1732
1732
|
};
|
|
1733
1733
|
function bt(c, b, C) {
|
|
1734
|
-
const
|
|
1734
|
+
const z = e.para(c.props), M = ve(z), N = E(M, z.list), Y = Jt(e.run(c.props.styleId, c.props.markRunProps ?? {})), G = [];
|
|
1735
1735
|
let st = [], O = !1, A = !1, at = !1;
|
|
1736
1736
|
const R = (k) => {
|
|
1737
1737
|
const w = { ...M };
|
|
1738
1738
|
return A && (w.pageBreakBefore = !0, A = !1), at && (w.columnBreakBefore = !0, at = !1), {
|
|
1739
1739
|
kind: "paragraph",
|
|
1740
|
-
id:
|
|
1740
|
+
id: d(),
|
|
1741
1741
|
revision: 0,
|
|
1742
|
-
runs:
|
|
1742
|
+
runs: We(k, Y),
|
|
1743
1743
|
style: w
|
|
1744
1744
|
};
|
|
1745
1745
|
}, X = () => {
|
|
1746
|
-
st.length !== 0 && (
|
|
1746
|
+
st.length !== 0 && (G.push(R(st)), st = []);
|
|
1747
1747
|
};
|
|
1748
1748
|
for (const k of c.inlines)
|
|
1749
1749
|
switch (k.kind) {
|
|
1750
1750
|
case "break":
|
|
1751
|
-
!k.page && !k.column ? (t.add("soft-breaks", "Soft line breaks (Shift+Enter) became paragraph breaks."), st.length > 0 ? X() :
|
|
1751
|
+
!k.page && !k.column ? (t.add("soft-breaks", "Soft line breaks (Shift+Enter) became paragraph breaks."), st.length > 0 ? X() : G.push(R([]))) : (st.length > 0 && X(), k.page && (A = !0), k.column && (at = !0)), O = !0;
|
|
1752
1752
|
break;
|
|
1753
1753
|
case "image": {
|
|
1754
1754
|
const w = ut(k, b, M.align);
|
|
1755
|
-
w && (X(), (A || at) &&
|
|
1755
|
+
w && (X(), (A || at) && G.push(R([])), G.push(w), O = !1);
|
|
1756
1756
|
break;
|
|
1757
1757
|
}
|
|
1758
1758
|
case "run": {
|
|
@@ -1766,38 +1766,38 @@ function Zn(t, e, n = {}, o = /* @__PURE__ */ new Map(), i = () => ({}), s, a) {
|
|
|
1766
1766
|
break;
|
|
1767
1767
|
}
|
|
1768
1768
|
}
|
|
1769
|
-
X(), (O ||
|
|
1770
|
-
const
|
|
1771
|
-
if (
|
|
1772
|
-
w > 0 && (k.style.spaceBeforePx = 0), w <
|
|
1773
|
-
}), c.bookmarkMarkers && c.bookmarkMarkers.length > 0 &&
|
|
1774
|
-
const k =
|
|
1769
|
+
X(), (O || G.length === 0) && G.push(R([]));
|
|
1770
|
+
const H = G.filter((k) => k.kind === "paragraph");
|
|
1771
|
+
if (H.forEach((k, w) => {
|
|
1772
|
+
w > 0 && (k.style.spaceBeforePx = 0), w < H.length - 1 && (k.style.spaceAfterPx = 0), w > 0 && k.style.list && (delete k.style.list, k.style.indentLeftPx = I(k.style.indentLeftPx + N));
|
|
1773
|
+
}), c.bookmarkMarkers && c.bookmarkMarkers.length > 0 && G[0]) {
|
|
1774
|
+
const k = G[0], w = k.kind === "paragraph" ? k.runs.reduce((S, _) => S + _.text.length, 0) : 0;
|
|
1775
1775
|
for (const S of c.bookmarkMarkers) {
|
|
1776
|
-
const
|
|
1777
|
-
S.kind === "start" && S.name ? u.set(S.id, { name: S.name, pos:
|
|
1776
|
+
const _ = { blockId: k.id, offset: Math.min(S.offset, w) };
|
|
1777
|
+
S.kind === "start" && S.name ? u.set(S.id, { name: S.name, pos: _ }) : S.kind === "end" && p.set(S.id, _);
|
|
1778
1778
|
}
|
|
1779
1779
|
}
|
|
1780
|
-
if (c.commentMarkers && c.commentMarkers.length > 0 &&
|
|
1781
|
-
const k =
|
|
1780
|
+
if (c.commentMarkers && c.commentMarkers.length > 0 && G[0]) {
|
|
1781
|
+
const k = G[0], w = k.kind === "paragraph" ? k.runs.reduce((S, _) => S + _.text.length, 0) : 0;
|
|
1782
1782
|
for (const S of c.commentMarkers) {
|
|
1783
|
-
const
|
|
1784
|
-
S.kind === "start" ?
|
|
1783
|
+
const _ = { blockId: k.id, offset: Math.min(S.offset, w) };
|
|
1784
|
+
S.kind === "start" ? l.set(S.id, _) : S.kind === "end" ? m.set(S.id, _) : S.kind === "ref" && g.set(S.id, _);
|
|
1785
1785
|
}
|
|
1786
1786
|
}
|
|
1787
|
-
return
|
|
1787
|
+
return G;
|
|
1788
1788
|
}
|
|
1789
1789
|
function ut(c, b, C) {
|
|
1790
|
-
const
|
|
1791
|
-
if (!
|
|
1790
|
+
const z = b.resolve(c.relId);
|
|
1791
|
+
if (!z) return;
|
|
1792
1792
|
if (c.widthEmu === void 0 || c.heightEmu === void 0) {
|
|
1793
1793
|
t.add("images-unsized", "An image without explicit dimensions was skipped.");
|
|
1794
1794
|
return;
|
|
1795
1795
|
}
|
|
1796
1796
|
const M = {
|
|
1797
1797
|
kind: "image",
|
|
1798
|
-
id:
|
|
1798
|
+
id: d(),
|
|
1799
1799
|
revision: 0,
|
|
1800
|
-
src:
|
|
1800
|
+
src: z,
|
|
1801
1801
|
widthPx: I(Lt(c.widthEmu)),
|
|
1802
1802
|
heightPx: I(Lt(c.heightEmu)),
|
|
1803
1803
|
align: c.anchorAlign ?? (C === "justify" ? "left" : C)
|
|
@@ -1808,109 +1808,109 @@ function Zn(t, e, n = {}, o = /* @__PURE__ */ new Map(), i = () => ({}), s, a) {
|
|
|
1808
1808
|
right: Ot(c.crop.right),
|
|
1809
1809
|
bottom: Ot(c.crop.bottom)
|
|
1810
1810
|
}), c.anchored && c.anchorWrap === "square" && (M.wrap = "square"), c.anchorFloat) {
|
|
1811
|
-
const
|
|
1811
|
+
const N = c.anchorFloat;
|
|
1812
1812
|
M.anchor = {
|
|
1813
|
-
behind:
|
|
1814
|
-
offsetXPx: I(Lt(
|
|
1815
|
-
offsetYPx: I(Lt(
|
|
1816
|
-
relFromH:
|
|
1817
|
-
relFromV:
|
|
1818
|
-
...
|
|
1819
|
-
...
|
|
1813
|
+
behind: N.behind,
|
|
1814
|
+
offsetXPx: I(Lt(N.offsetXEmu)),
|
|
1815
|
+
offsetYPx: I(Lt(N.offsetYEmu)),
|
|
1816
|
+
relFromH: N.relFromH,
|
|
1817
|
+
relFromV: N.relFromV,
|
|
1818
|
+
...N.decorative ? { decorative: !0 } : {},
|
|
1819
|
+
...N.z !== void 0 ? { z: N.z } : {}
|
|
1820
1820
|
};
|
|
1821
1821
|
}
|
|
1822
1822
|
return M;
|
|
1823
1823
|
}
|
|
1824
|
-
function it(c, b, C,
|
|
1825
|
-
let
|
|
1824
|
+
function it(c, b, C, z, M) {
|
|
1825
|
+
let N = c;
|
|
1826
1826
|
const Y = Jt(b);
|
|
1827
1827
|
if (b.linkRelId) {
|
|
1828
|
-
const
|
|
1829
|
-
|
|
1828
|
+
const G = C(b.linkRelId);
|
|
1829
|
+
G ? Y.link = G : t.add("links-unresolved", "A hyperlink target could not be resolved and was dropped.");
|
|
1830
1830
|
} else b.linkAnchor && (Y.link = `#${b.linkAnchor}`);
|
|
1831
|
-
if (b.footnoteId !== void 0 && (
|
|
1832
|
-
Y.sdtPath =
|
|
1833
|
-
const
|
|
1834
|
-
|
|
1831
|
+
if (b.footnoteId !== void 0 && (N = T(b.footnoteId), Y.footnoteRef = `fn${b.footnoteId}`, Y.verticalAlign = "super"), b.endnoteId !== void 0 && (N = x(b.endnoteId), Y.endnoteRef = `en${b.endnoteId}`, Y.verticalAlign = "super"), z && z.length > 0) {
|
|
1832
|
+
Y.sdtPath = z;
|
|
1833
|
+
const G = n[z[z.length - 1]];
|
|
1834
|
+
G?.type === "checkbox" && N.length > 0 && (N = G.checked ? "☒" : "☐", Y.fontFamily = Fe.fontFamily);
|
|
1835
1835
|
}
|
|
1836
|
-
return M && (Y.fieldId = M), b.styleId && (Y.charStyleId = b.styleId), { text:
|
|
1836
|
+
return M && (Y.fieldId = M), b.styleId && (Y.charStyleId = b.styleId), { text: N, style: Y };
|
|
1837
1837
|
}
|
|
1838
|
-
function
|
|
1839
|
-
const Y = c.cell.rowSpan ?? 1,
|
|
1838
|
+
function mt(c, b, C, z, M, N) {
|
|
1839
|
+
const Y = c.cell.rowSpan ?? 1, G = {
|
|
1840
1840
|
top: c.startRow === 0,
|
|
1841
|
-
bottom: c.startRow + Y - 1 ===
|
|
1841
|
+
bottom: c.startRow + Y - 1 === N - 1,
|
|
1842
1842
|
left: c.startCol === 0,
|
|
1843
1843
|
right: c.startCol + c.colSpan - 1 === M - 1
|
|
1844
1844
|
}, st = c.ir?.shd ?? b.shd ?? C.shd;
|
|
1845
|
-
if (st && (c.cell.shading = st),
|
|
1845
|
+
if (st && (c.cell.shading = st), z) {
|
|
1846
1846
|
const O = { cell: c.ir?.borders, table: b.borders, style: C.borders };
|
|
1847
|
-
c.cell.borders =
|
|
1847
|
+
c.cell.borders = cn(O, G);
|
|
1848
1848
|
}
|
|
1849
1849
|
}
|
|
1850
|
-
function
|
|
1851
|
-
const
|
|
1850
|
+
function pt(c, b, C) {
|
|
1851
|
+
const z = (R) => {
|
|
1852
1852
|
const X = [];
|
|
1853
1853
|
for (const w of R.blocks) {
|
|
1854
|
-
const S = w.kind === "paragraph" ? bt(w, b, C) : w.kind === "math" ? [{ kind: "equation", id:
|
|
1855
|
-
if (w.sdtPath) for (const
|
|
1854
|
+
const S = w.kind === "paragraph" ? bt(w, b, C) : w.kind === "math" ? [{ kind: "equation", id: d(), revision: 0, equation: { root: w.root, display: w.display }, align: w.align ?? "center" }] : [pt(w, b, C)];
|
|
1855
|
+
if (w.sdtPath) for (const _ of S) _.sdtPath = w.sdtPath;
|
|
1856
1856
|
X.push(...S);
|
|
1857
1857
|
}
|
|
1858
|
-
const
|
|
1859
|
-
R.gridSpan > 1 && (
|
|
1860
|
-
const k = (w) => R.marginTwips?.[w] ?? c.cellMarginTwips?.[w] ??
|
|
1861
|
-
return
|
|
1862
|
-
}, M = Math.max(1, ...c.rows.map((R) => R.cells.reduce((X,
|
|
1863
|
-
const
|
|
1858
|
+
const H = { id: d(), blocks: X.length > 0 ? X : [U()] };
|
|
1859
|
+
R.gridSpan > 1 && (H.colSpan = R.gridSpan);
|
|
1860
|
+
const k = (w) => R.marginTwips?.[w] ?? c.cellMarginTwips?.[w] ?? Bt[w];
|
|
1861
|
+
return H.margin = Dt({ top: k("top"), right: k("right"), bottom: k("bottom"), left: k("left") }), R.preferredWidth && (H.preferredWidth = R.preferredWidth.type === "pct" ? { type: "pct", px: R.preferredWidth.frac } : { type: "abs", px: I(D(R.preferredWidth.twips)) }), R.vAlign && (H.vAlign = R.vAlign), R.textDirection && (H.textDirection = R.textDirection), R.noWrap && (H.noWrap = !0), R.fitText && (H.fitText = !0), R.hideMark && (H.hideMark = !0), H;
|
|
1862
|
+
}, M = Math.max(1, ...c.rows.map((R) => R.cells.reduce((X, H) => X + Math.max(1, H.gridSpan), 0))), N = new Array(M), Y = c.rows.map((R, X) => {
|
|
1863
|
+
const H = [];
|
|
1864
1864
|
let k = 0;
|
|
1865
1865
|
for (const w of R.cells) {
|
|
1866
1866
|
if (k >= M) break;
|
|
1867
1867
|
const S = Math.max(1, Math.min(w.gridSpan, M - k));
|
|
1868
1868
|
if (w.vMergeContinue) {
|
|
1869
|
-
const et =
|
|
1869
|
+
const et = N[k];
|
|
1870
1870
|
et ? et.rowSpan = (et.rowSpan ?? 1) + 1 : t.add("cell-vmerge-orphan", "A merged-cell continuation had no cell above to extend."), k += S;
|
|
1871
1871
|
continue;
|
|
1872
1872
|
}
|
|
1873
|
-
const
|
|
1874
|
-
|
|
1875
|
-
for (let et = 0; et < S && k + et < M; et++)
|
|
1873
|
+
const _ = z(w);
|
|
1874
|
+
H.push({ cell: _, ir: w, startRow: X, startCol: k, colSpan: S });
|
|
1875
|
+
for (let et = 0; et < S && k + et < M; et++) N[k + et] = _;
|
|
1876
1876
|
k += S;
|
|
1877
1877
|
}
|
|
1878
1878
|
for (; k < M; ) {
|
|
1879
|
-
const w = { id:
|
|
1880
|
-
|
|
1879
|
+
const w = { id: d(), blocks: [U()] };
|
|
1880
|
+
H.push({ cell: w, ir: null, startRow: X, startCol: k, colSpan: 1 }), N[k] = w, k += 1;
|
|
1881
1881
|
}
|
|
1882
|
-
return
|
|
1883
|
-
}),
|
|
1884
|
-
for (const R of Y) for (const X of R)
|
|
1882
|
+
return H;
|
|
1883
|
+
}), G = c.styleId ? i(c.styleId) : {}, st = !!G.borders || !!c.borders || !!c.bordersSpecified || c.rows.some((R) => R.cells.some((X) => X.borders || X.bordersSpecified));
|
|
1884
|
+
for (const R of Y) for (const X of R) mt(X, c, G, st, M, c.rows.length);
|
|
1885
1885
|
const O = Y.map((R, X) => {
|
|
1886
|
-
const
|
|
1886
|
+
const H = { cells: R.map((w) => w.cell) }, k = c.rows[X]?.props;
|
|
1887
1887
|
if (k) {
|
|
1888
1888
|
const w = {};
|
|
1889
|
-
k.heightTwips !== void 0 && k.heightRule && (w.height = { value: I(
|
|
1889
|
+
k.heightTwips !== void 0 && k.heightRule && (w.height = { value: I(D(k.heightTwips)), rule: k.heightRule }), k.cantSplit && (w.cantSplit = !0), k.tblHeader && (w.repeatHeader = !0), Object.keys(w).length > 0 && (H.props = w);
|
|
1890
1890
|
}
|
|
1891
|
-
return
|
|
1892
|
-
}), A = { kind: "table", id:
|
|
1893
|
-
c.styleId && (A.styleId = c.styleId), c.look && (A.condOverrides = { ...c.look }), A.colFractions =
|
|
1894
|
-
const at =
|
|
1891
|
+
return H;
|
|
1892
|
+
}), A = { kind: "table", id: d(), revision: 0, rows: O };
|
|
1893
|
+
c.styleId && (A.styleId = c.styleId), c.look && (A.condOverrides = { ...c.look }), A.colFractions = ro(c.colWidthsTwips, M), c.widthMode && c.widthMode !== "fixed" && (A.widthMode = c.widthMode), c.preferredWidthTwips ? A.preferredWidth = { type: "px", value: I(D(c.preferredWidthTwips)) } : c.preferredWidthPct && (A.preferredWidth = { type: "pct", value: c.preferredWidthPct }), c.align && c.align !== "left" && (A.align = c.align), c.indentTwips && (A.indentPx = I(D(c.indentTwips))), c.bidiVisual && (A.bidiVisual = !0), c.overlap && (A.overlap = c.overlap), c.caption && (A.caption = c.caption), c.description && (A.description = c.description);
|
|
1894
|
+
const at = ln(c.borders);
|
|
1895
1895
|
if (at ? A.defaultBorders = at : c.bordersSpecified && (A.defaultBorders = {}), c.shd && (A.defaultShading = c.shd), c.cellMarginTwips) {
|
|
1896
1896
|
const R = c.cellMarginTwips;
|
|
1897
|
-
A.defaultCellMargin =
|
|
1898
|
-
top: R.top ??
|
|
1899
|
-
right: R.right ??
|
|
1900
|
-
bottom: R.bottom ??
|
|
1901
|
-
left: R.left ??
|
|
1897
|
+
A.defaultCellMargin = Dt({
|
|
1898
|
+
top: R.top ?? Bt.top,
|
|
1899
|
+
right: R.right ?? Bt.right,
|
|
1900
|
+
bottom: R.bottom ?? Bt.bottom,
|
|
1901
|
+
left: R.left ?? Bt.left
|
|
1902
1902
|
});
|
|
1903
1903
|
}
|
|
1904
1904
|
return A;
|
|
1905
1905
|
}
|
|
1906
1906
|
function V(c) {
|
|
1907
|
-
if (!c) return { ...
|
|
1907
|
+
if (!c) return { ...Nt, marginPx: { ...Nt.marginPx } };
|
|
1908
1908
|
const b = {
|
|
1909
|
-
pageWidthPx: c.pageWidthTwips !== void 0 ? I(
|
|
1910
|
-
pageHeightPx: c.pageHeightTwips !== void 0 ? I(
|
|
1911
|
-
marginPx: c.marginTwips ?
|
|
1909
|
+
pageWidthPx: c.pageWidthTwips !== void 0 ? I(D(c.pageWidthTwips)) : Nt.pageWidthPx,
|
|
1910
|
+
pageHeightPx: c.pageHeightTwips !== void 0 ? I(D(c.pageHeightTwips)) : Nt.pageHeightPx,
|
|
1911
|
+
marginPx: c.marginTwips ? Dt(c.marginTwips) : { ...Nt.marginPx }
|
|
1912
1912
|
};
|
|
1913
|
-
return c.columns && (b.columns = we(c.columns)), c.pageNumberStart !== void 0 && (b.pageNumberStart = c.pageNumberStart), c.headerDistTwips !== void 0 && (b.headerDistancePx = I(
|
|
1913
|
+
return c.columns && (b.columns = we(c.columns)), c.pageNumberStart !== void 0 && (b.pageNumberStart = c.pageNumberStart), c.headerDistTwips !== void 0 && (b.headerDistancePx = I(D(c.headerDistTwips))), c.footerDistTwips !== void 0 && (b.footerDistancePx = I(D(c.footerDistTwips))), c.pageBorders && (b.pageBorders = be(c.pageBorders)), c.lineNumbering && (b.lineNumbering = ke(c.lineNumbering)), c.breakType && (b.breakType = c.breakType), b;
|
|
1914
1914
|
}
|
|
1915
1915
|
return {
|
|
1916
1916
|
mapBlocks: rt,
|
|
@@ -1919,29 +1919,29 @@ function Zn(t, e, n = {}, o = /* @__PURE__ */ new Map(), i = () => ({}), s, a) {
|
|
|
1919
1919
|
// Realize EVERY defined numbering definition (not just referenced ones) so a
|
|
1920
1920
|
// list style authored in the editor survives save→reopen before it's applied.
|
|
1921
1921
|
lists: () => {
|
|
1922
|
-
for (const c of o.keys())
|
|
1922
|
+
for (const c of o.keys()) W(c);
|
|
1923
1923
|
return Object.fromEntries(tt);
|
|
1924
1924
|
},
|
|
1925
1925
|
bookmarks: () => {
|
|
1926
1926
|
const c = {};
|
|
1927
1927
|
for (const [b, C] of u)
|
|
1928
|
-
c[C.name] = { start: C.pos, end:
|
|
1928
|
+
c[C.name] = { start: C.pos, end: p.get(b) ?? C.pos };
|
|
1929
1929
|
return c;
|
|
1930
1930
|
},
|
|
1931
1931
|
footnoteRefs: () => P.map((c) => ({ docxId: c, noteId: `fn${c}` })),
|
|
1932
1932
|
endnoteRefs: () => L.map((c) => ({ docxId: c, noteId: `en${c}` })),
|
|
1933
1933
|
commentAnchors: () => {
|
|
1934
|
-
const c = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Set([...
|
|
1934
|
+
const c = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Set([...l.keys(), ...m.keys(), ...g.keys()]);
|
|
1935
1935
|
for (const C of b) {
|
|
1936
|
-
const
|
|
1937
|
-
|
|
1936
|
+
const z = l.get(C) ?? g.get(C) ?? m.get(C), M = m.get(C) ?? g.get(C) ?? z;
|
|
1937
|
+
z && M && c.set(C, { start: z, end: M });
|
|
1938
1938
|
}
|
|
1939
1939
|
return c;
|
|
1940
1940
|
},
|
|
1941
|
-
tocField: () =>
|
|
1941
|
+
tocField: () => j
|
|
1942
1942
|
};
|
|
1943
1943
|
}
|
|
1944
|
-
const
|
|
1944
|
+
const to = {
|
|
1945
1945
|
decimal: "decimal",
|
|
1946
1946
|
decimalZero: "decimal",
|
|
1947
1947
|
lowerLetter: "lowerLetter",
|
|
@@ -1950,7 +1950,7 @@ const Qn = {
|
|
|
1950
1950
|
upperRoman: "upperRoman",
|
|
1951
1951
|
bullet: "bullet"
|
|
1952
1952
|
};
|
|
1953
|
-
function
|
|
1953
|
+
function eo(t) {
|
|
1954
1954
|
if (t.length !== 1) return t;
|
|
1955
1955
|
switch (t.charCodeAt(0)) {
|
|
1956
1956
|
case 61623:
|
|
@@ -1976,29 +1976,29 @@ function to(t) {
|
|
|
1976
1976
|
return t;
|
|
1977
1977
|
}
|
|
1978
1978
|
}
|
|
1979
|
-
function
|
|
1979
|
+
function no(t) {
|
|
1980
1980
|
const e = [];
|
|
1981
1981
|
for (let n = 0; n < 9; n++)
|
|
1982
|
-
e.push(
|
|
1982
|
+
e.push(oo(t.levels[n], n));
|
|
1983
1983
|
return { id: t.id, levels: e };
|
|
1984
1984
|
}
|
|
1985
|
-
function
|
|
1985
|
+
function oo(t, e) {
|
|
1986
1986
|
if (!t)
|
|
1987
1987
|
return { format: "decimal", text: `%${e + 1}.`, indentLeftPx: 24 + e * 24, hangingPx: 18, start: 1 };
|
|
1988
|
-
const n =
|
|
1988
|
+
const n = to[t.format] ?? (t.format === "none" ? "bullet" : "decimal"), o = {
|
|
1989
1989
|
format: n,
|
|
1990
1990
|
text: n === "bullet" ? "" : t.lvlText,
|
|
1991
|
-
indentLeftPx: t.indentLeftTwips !== void 0 ? I(
|
|
1992
|
-
hangingPx: t.hangingTwips !== void 0 ? I(
|
|
1991
|
+
indentLeftPx: t.indentLeftTwips !== void 0 ? I(D(t.indentLeftTwips)) : 24 + e * 24,
|
|
1992
|
+
hangingPx: t.hangingTwips !== void 0 ? I(D(t.hangingTwips)) : 18,
|
|
1993
1993
|
start: t.start
|
|
1994
1994
|
};
|
|
1995
|
-
if (n === "bullet" && (o.bulletChar = t.format === "none" ? "" :
|
|
1995
|
+
if (n === "bullet" && (o.bulletChar = t.format === "none" ? "" : eo(t.lvlText)), t.markerRunProps) {
|
|
1996
1996
|
const i = ee(t.markerRunProps);
|
|
1997
1997
|
Object.keys(i).length > 0 && (o.markerStyle = i);
|
|
1998
1998
|
}
|
|
1999
1999
|
return o;
|
|
2000
2000
|
}
|
|
2001
|
-
const
|
|
2001
|
+
const io = {
|
|
2002
2002
|
left: "left",
|
|
2003
2003
|
start: "left",
|
|
2004
2004
|
num: "left",
|
|
@@ -2006,26 +2006,26 @@ const oo = {
|
|
|
2006
2006
|
right: "right",
|
|
2007
2007
|
end: "right",
|
|
2008
2008
|
decimal: "decimal"
|
|
2009
|
-
},
|
|
2009
|
+
}, so = {
|
|
2010
2010
|
dot: "dot",
|
|
2011
2011
|
middleDot: "dot",
|
|
2012
2012
|
hyphen: "dash",
|
|
2013
2013
|
underscore: "underscore"
|
|
2014
2014
|
};
|
|
2015
|
-
function
|
|
2015
|
+
function Le(t) {
|
|
2016
2016
|
const e = t.map((n) => {
|
|
2017
|
-
const o = { posPx: I(
|
|
2017
|
+
const o = { posPx: I(D(n.posTwips)) }, i = n.val ? io[n.val] : void 0;
|
|
2018
2018
|
i && i !== "left" && (o.align = i);
|
|
2019
|
-
const s = n.leader ?
|
|
2019
|
+
const s = n.leader ? so[n.leader] : void 0;
|
|
2020
2020
|
return s && (o.leader = s), o;
|
|
2021
2021
|
});
|
|
2022
2022
|
return e.sort((n, o) => n.posPx - o.posPx), e;
|
|
2023
2023
|
}
|
|
2024
|
-
function
|
|
2024
|
+
function ro(t, e) {
|
|
2025
2025
|
const n = t && t.length === e && t.reduce((o, i) => o + i, 0) > 0 ? t.map((o) => Math.round(o / t.reduce((i, s) => i + s, 0) * 1e4) / 1e4) : Array.from({ length: e }, () => Math.round(1 / e * 1e4) / 1e4);
|
|
2026
2026
|
return n[n.length - 1] = Math.round((1 - n.slice(0, -1).reduce((o, i) => o + i, 0)) * 1e4) / 1e4, n;
|
|
2027
2027
|
}
|
|
2028
|
-
const
|
|
2028
|
+
const ao = {
|
|
2029
2029
|
yellow: "#ffff00",
|
|
2030
2030
|
green: "#00ff00",
|
|
2031
2031
|
cyan: "#00ffff",
|
|
@@ -2044,10 +2044,10 @@ const ro = {
|
|
|
2044
2044
|
white: "#ffffff"
|
|
2045
2045
|
};
|
|
2046
2046
|
function Jt(t) {
|
|
2047
|
-
const e = { ...
|
|
2048
|
-
return
|
|
2047
|
+
const e = { ...Fe };
|
|
2048
|
+
return Oe(e, t), e;
|
|
2049
2049
|
}
|
|
2050
|
-
const
|
|
2050
|
+
const co = {
|
|
2051
2051
|
double: "double",
|
|
2052
2052
|
thick: "thick",
|
|
2053
2053
|
dotted: "dotted",
|
|
@@ -2064,39 +2064,39 @@ const ao = {
|
|
|
2064
2064
|
wavyHeavy: "wave",
|
|
2065
2065
|
wavyDouble: "wave"
|
|
2066
2066
|
};
|
|
2067
|
-
function
|
|
2068
|
-
return
|
|
2067
|
+
function lo(t) {
|
|
2068
|
+
return co[t];
|
|
2069
2069
|
}
|
|
2070
|
-
function
|
|
2070
|
+
function Oe(t, e) {
|
|
2071
2071
|
const n = e.fontAscii ?? e.fontHAnsi;
|
|
2072
|
-
if (e.fontAscii ? t.fontFamily = `${e.fontAscii}, serif` : e.fontHAnsi && (t.fontFamily = `${e.fontHAnsi}, serif`), e.fontCs && e.fontCs !== n && (t.fontFamilyComplexScript = `${e.fontCs}, serif`), e.fontEastAsia && e.fontEastAsia !== n && (t.fontFamilyEastAsia = `${e.fontEastAsia}, serif`), e.letterSpacingTwips !== void 0 && (t.letterSpacingPx = I(
|
|
2073
|
-
const o = e.underlineStyle ?
|
|
2072
|
+
if (e.fontAscii ? t.fontFamily = `${e.fontAscii}, serif` : e.fontHAnsi && (t.fontFamily = `${e.fontHAnsi}, serif`), e.fontCs && e.fontCs !== n && (t.fontFamilyComplexScript = `${e.fontCs}, serif`), e.fontEastAsia && e.fontEastAsia !== n && (t.fontFamilyEastAsia = `${e.fontEastAsia}, serif`), e.letterSpacingTwips !== void 0 && (t.letterSpacingPx = I(D(e.letterSpacingTwips))), e.sizeHalfPoints !== void 0 && (t.fontSizePx = I($t(e.sizeHalfPoints))), e.bold !== void 0 && (t.bold = e.bold), e.italic !== void 0 && (t.italic = e.italic), e.underline !== void 0 && (t.underline = e.underline), e.underline) {
|
|
2073
|
+
const o = e.underlineStyle ? lo(e.underlineStyle) : void 0;
|
|
2074
2074
|
o && (t.underlineStyle = o), e.underlineColor && e.underlineColor !== "auto" && (t.underlineColor = `#${e.underlineColor.toLowerCase()}`);
|
|
2075
2075
|
}
|
|
2076
2076
|
if (e.strikethrough !== void 0 && (t.strikethrough = e.strikethrough), e.color && e.color !== "auto" && (t.color = `#${e.color.toLowerCase()}`), e.highlight) {
|
|
2077
|
-
const o =
|
|
2077
|
+
const o = ao[e.highlight];
|
|
2078
2078
|
o && (t.highlightColor = o);
|
|
2079
2079
|
}
|
|
2080
|
-
if (e.vertAlign === "superscript" ? t.verticalAlign = "super" : e.vertAlign === "subscript" && (t.verticalAlign = "sub"), e.vanish && (t.hidden = !0), e.caps !== void 0 && (t.caps = e.caps), e.smallCaps !== void 0 && (t.smallCaps = e.smallCaps), e.rtl !== void 0 && (t.rtl = e.rtl), e.doubleStrikethrough !== void 0 && (t.doubleStrikethrough = e.doubleStrikethrough), e.positionHalfPoints !== void 0 && (t.positionPx = I(
|
|
2081
|
-
const o =
|
|
2080
|
+
if (e.vertAlign === "superscript" ? t.verticalAlign = "super" : e.vertAlign === "subscript" && (t.verticalAlign = "sub"), e.vanish && (t.hidden = !0), e.caps !== void 0 && (t.caps = e.caps), e.smallCaps !== void 0 && (t.smallCaps = e.smallCaps), e.rtl !== void 0 && (t.rtl = e.rtl), e.doubleStrikethrough !== void 0 && (t.doubleStrikethrough = e.doubleStrikethrough), e.positionHalfPoints !== void 0 && (t.positionPx = I($t(e.positionHalfPoints))), e.kerningHalfPoints !== void 0 && (t.kerningMinPx = I($t(e.kerningHalfPoints))), e.widthScalePct !== void 0 && (t.widthScalePct = e.widthScalePct), e.emphasisMark) {
|
|
2081
|
+
const o = uo(e.emphasisMark);
|
|
2082
2082
|
o && (t.emphasisMark = o);
|
|
2083
2083
|
}
|
|
2084
2084
|
if (e.outline !== void 0 && (t.outline = e.outline), e.shadow !== void 0 && (t.shadow = e.shadow), e.emboss !== void 0 && (t.emboss = e.emboss), e.imprint !== void 0 && (t.imprint = e.imprint), e.runBorder) {
|
|
2085
|
-
const o =
|
|
2085
|
+
const o = fn(e.runBorder);
|
|
2086
2086
|
o && (t.runBorder = o);
|
|
2087
2087
|
}
|
|
2088
|
-
e.fitTextTwips !== void 0 && e.fitTextTwips > 0 && (t.fitTextPx = I(
|
|
2088
|
+
e.fitTextTwips !== void 0 && e.fitTextTwips > 0 && (t.fitTextPx = I(D(e.fitTextTwips))), e.symbol && (t.symbol = { font: e.symbol.font, char: e.symbol.char }, t.fontFamily = `${e.symbol.font}, sans-serif`);
|
|
2089
2089
|
}
|
|
2090
|
-
const
|
|
2090
|
+
const fo = {
|
|
2091
2091
|
dot: "dot",
|
|
2092
2092
|
comma: "comma",
|
|
2093
2093
|
circle: "circle",
|
|
2094
2094
|
underDot: "underDot"
|
|
2095
2095
|
};
|
|
2096
|
-
function fo(t) {
|
|
2097
|
-
return lo[t];
|
|
2098
|
-
}
|
|
2099
2096
|
function uo(t) {
|
|
2097
|
+
return fo[t];
|
|
2098
|
+
}
|
|
2099
|
+
function mo(t) {
|
|
2100
2100
|
const e = {};
|
|
2101
2101
|
for (const [n, o] of Object.entries(t)) {
|
|
2102
2102
|
const i = { type: o.type };
|
|
@@ -2106,12 +2106,12 @@ function uo(t) {
|
|
|
2106
2106
|
}
|
|
2107
2107
|
function ee(t) {
|
|
2108
2108
|
const e = {};
|
|
2109
|
-
return
|
|
2109
|
+
return Oe(e, t), e;
|
|
2110
2110
|
}
|
|
2111
|
-
function
|
|
2111
|
+
function De(t) {
|
|
2112
2112
|
const e = {};
|
|
2113
|
-
t.align && (e.align = t.align), t.direction && (e.direction = t.direction), t.lineHeight !== void 0 && (e.lineHeight = I(t.lineHeight)), (t.lineRule === "exact" || t.lineRule === "atLeast") && (e.lineRule = t.lineRule, t.lineExactTwips !== void 0 && (e.lineHeightPx = I(
|
|
2114
|
-
const n =
|
|
2113
|
+
t.align && (e.align = t.align), t.direction && (e.direction = t.direction), t.lineHeight !== void 0 && (e.lineHeight = I(t.lineHeight)), (t.lineRule === "exact" || t.lineRule === "atLeast") && (e.lineRule = t.lineRule, t.lineExactTwips !== void 0 && (e.lineHeightPx = I(D(t.lineExactTwips)))), t.spaceBeforeTwips !== void 0 && (e.spaceBeforePx = I(D(t.spaceBeforeTwips))), t.spaceAfterTwips !== void 0 && (e.spaceAfterPx = I(D(t.spaceAfterTwips))), t.indentLeftTwips !== void 0 && (e.indentLeftPx = I(D(t.indentLeftTwips))), t.indentRightTwips !== void 0 && (e.indentRightPx = I(D(t.indentRightTwips))), t.indentFirstLineTwips !== void 0 && (e.indentFirstLinePx = I(D(t.indentFirstLineTwips))), t.keepWithNext && (e.keepWithNext = !0), t.keepLinesTogether && (e.keepLinesTogether = !0), t.contextualSpacing !== void 0 && (e.contextualSpacing = t.contextualSpacing), t.tabStops && (e.tabStops = Le(t.tabStops));
|
|
2114
|
+
const n = xe(t.borders);
|
|
2115
2115
|
return n && (e.borders = n), t.shd !== void 0 && (e.shading = t.shd), He(t, e), e;
|
|
2116
2116
|
}
|
|
2117
2117
|
function He(t, e) {
|
|
@@ -2130,7 +2130,7 @@ function po(t) {
|
|
|
2130
2130
|
name: i.name ?? o,
|
|
2131
2131
|
type: s ? "character" : "paragraph",
|
|
2132
2132
|
char: ee(i.rPr),
|
|
2133
|
-
para: s ? {} :
|
|
2133
|
+
para: s ? {} : De(i.pPr)
|
|
2134
2134
|
};
|
|
2135
2135
|
i.basedOnId && e.has(i.basedOnId) && t.styles.get(i.basedOnId)?.type === i.type && (a.basedOn = i.basedOnId), n.push(a);
|
|
2136
2136
|
}
|
|
@@ -2138,36 +2138,36 @@ function po(t) {
|
|
|
2138
2138
|
(o, i) => o.id === t.defaultParaStyleId ? -1 : i.id === t.defaultParaStyleId ? 1 : o.name.localeCompare(i.name)
|
|
2139
2139
|
), { styles: n, defaultStyleId: t.defaultParaStyleId ?? n[0].id };
|
|
2140
2140
|
}
|
|
2141
|
-
function
|
|
2141
|
+
function ho(t) {
|
|
2142
2142
|
const e = /* @__PURE__ */ new Set();
|
|
2143
2143
|
for (const i of t.styles.values()) i.type === "table" && e.add(i.id);
|
|
2144
2144
|
if (e.size === 0) return;
|
|
2145
2145
|
const n = (i, s, a, r) => {
|
|
2146
|
-
const
|
|
2147
|
-
Object.keys(u).length > 0 && (
|
|
2148
|
-
const
|
|
2149
|
-
Object.keys(
|
|
2150
|
-
const
|
|
2151
|
-
return
|
|
2146
|
+
const d = {}, u = ee(i);
|
|
2147
|
+
Object.keys(u).length > 0 && (d.char = u);
|
|
2148
|
+
const p = De(s);
|
|
2149
|
+
Object.keys(p).length > 0 && (d.para = p);
|
|
2150
|
+
const l = dn(a);
|
|
2151
|
+
return l && (d.borders = l), r !== void 0 && (d.shading = r), d;
|
|
2152
2152
|
}, o = {};
|
|
2153
2153
|
for (const i of e) {
|
|
2154
2154
|
const s = t.styles.get(i), a = {
|
|
2155
2155
|
wholeTable: n(s.rPr, s.pPr, s.tblBorders, s.tblShd)
|
|
2156
2156
|
};
|
|
2157
|
-
for (const [
|
|
2158
|
-
a[
|
|
2157
|
+
for (const [d, u] of Object.entries(s.tblStylePr ?? {}))
|
|
2158
|
+
a[d] = n(u.rPr, u.pPr, u.borders, u.shd);
|
|
2159
2159
|
const r = { id: i, name: s.name ?? i, conds: a };
|
|
2160
2160
|
s.basedOnId && e.has(s.basedOnId) && (r.basedOn = s.basedOnId), s.rowBandSize !== void 0 && (r.rowBandSize = s.rowBandSize), s.colBandSize !== void 0 && (r.colBandSize = s.colBandSize), o[i] = r;
|
|
2161
2161
|
}
|
|
2162
2162
|
return o;
|
|
2163
2163
|
}
|
|
2164
2164
|
function ve(t) {
|
|
2165
|
-
const e = { ...
|
|
2166
|
-
t.align && (e.align = t.align), t.direction && (e.direction = t.direction), t.lineHeight !== void 0 && (e.lineHeight = I(t.lineHeight)), (t.lineRule === "exact" || t.lineRule === "atLeast") && (e.lineRule = t.lineRule, t.lineExactTwips !== void 0 && (e.lineHeightPx = I(
|
|
2167
|
-
const n =
|
|
2165
|
+
const e = { ...Zn };
|
|
2166
|
+
t.align && (e.align = t.align), t.direction && (e.direction = t.direction), t.lineHeight !== void 0 && (e.lineHeight = I(t.lineHeight)), (t.lineRule === "exact" || t.lineRule === "atLeast") && (e.lineRule = t.lineRule, t.lineExactTwips !== void 0 && (e.lineHeightPx = I(D(t.lineExactTwips)))), t.spaceBeforeTwips !== void 0 && (e.spaceBeforePx = I(D(t.spaceBeforeTwips))), t.spaceAfterTwips !== void 0 && (e.spaceAfterPx = I(D(t.spaceAfterTwips))), t.indentLeftTwips !== void 0 && (e.indentLeftPx = I(D(t.indentLeftTwips))), t.indentRightTwips !== void 0 && (e.indentRightPx = I(D(t.indentRightTwips))), t.indentFirstLineTwips !== void 0 && (e.indentFirstLinePx = I(D(t.indentFirstLineTwips))), t.keepWithNext && (e.keepWithNext = !0), t.keepLinesTogether && (e.keepLinesTogether = !0), t.contextualSpacing !== void 0 && (e.contextualSpacing = t.contextualSpacing), t.tabStops && (e.tabStops = Le(t.tabStops)), t.pageBreakBefore && (e.pageBreakBefore = !0), t.outlineLevel !== void 0 && (e.outlineLevel = t.outlineLevel);
|
|
2167
|
+
const n = xe(t.borders);
|
|
2168
2168
|
return n && (e.borders = n), t.shd !== void 0 && (e.shading = t.shd), He(t, e), t.styleId && (e.namedStyle = t.styleId), e;
|
|
2169
2169
|
}
|
|
2170
|
-
const
|
|
2170
|
+
const go = {
|
|
2171
2171
|
png: "image/png",
|
|
2172
2172
|
jpg: "image/jpeg",
|
|
2173
2173
|
jpeg: "image/jpeg",
|
|
@@ -2176,7 +2176,7 @@ const ho = {
|
|
|
2176
2176
|
webp: "image/webp",
|
|
2177
2177
|
svg: "image/svg+xml"
|
|
2178
2178
|
};
|
|
2179
|
-
function
|
|
2179
|
+
function wo(t, e, n, o) {
|
|
2180
2180
|
const i = /* @__PURE__ */ new Map(), s = [];
|
|
2181
2181
|
return {
|
|
2182
2182
|
resolve(a) {
|
|
@@ -2187,67 +2187,67 @@ function go(t, e, n, o) {
|
|
|
2187
2187
|
}
|
|
2188
2188
|
if (i.has(r.target)) return i.get(r.target);
|
|
2189
2189
|
if (r.external) {
|
|
2190
|
-
const
|
|
2191
|
-
|
|
2190
|
+
const l = /^https?:\/\//i.test(r.target);
|
|
2191
|
+
l ? n.add("media-external", "Linked (external) images load from their original URL.") : n.add(
|
|
2192
2192
|
"media-external-unreachable",
|
|
2193
2193
|
"Linked images pointing at local files can't be loaded in the browser — skipped."
|
|
2194
2194
|
);
|
|
2195
|
-
const
|
|
2196
|
-
return i.set(r.target,
|
|
2195
|
+
const m = l ? r.target : void 0;
|
|
2196
|
+
return i.set(r.target, m), m;
|
|
2197
2197
|
}
|
|
2198
|
-
let
|
|
2199
|
-
const u = r.target.slice(r.target.lastIndexOf(".") + 1).toLowerCase(),
|
|
2200
|
-
if (!
|
|
2198
|
+
let d;
|
|
2199
|
+
const u = r.target.slice(r.target.lastIndexOf(".") + 1).toLowerCase(), p = go[u];
|
|
2200
|
+
if (!p)
|
|
2201
2201
|
n.add(
|
|
2202
2202
|
"media-unsupported",
|
|
2203
2203
|
`Some images use formats browsers can't display (.${u}, typically metafiles) — skipped.`
|
|
2204
2204
|
);
|
|
2205
2205
|
else {
|
|
2206
|
-
const
|
|
2207
|
-
if (!
|
|
2206
|
+
const l = t.part(r.target);
|
|
2207
|
+
if (!l)
|
|
2208
2208
|
n.add("media-missing", "An image reference had no matching relationship — skipped.");
|
|
2209
2209
|
else {
|
|
2210
|
-
const
|
|
2211
|
-
o ?
|
|
2210
|
+
const m = new Uint8Array(l);
|
|
2211
|
+
o ? d = o.add(m, p) : (d = URL.createObjectURL(new Blob([m], { type: p })), s.push(d));
|
|
2212
2212
|
}
|
|
2213
2213
|
}
|
|
2214
|
-
return i.set(r.target,
|
|
2214
|
+
return i.set(r.target, d), d;
|
|
2215
2215
|
},
|
|
2216
2216
|
urls: () => [...s]
|
|
2217
2217
|
};
|
|
2218
2218
|
}
|
|
2219
|
-
const
|
|
2220
|
-
function
|
|
2221
|
-
const e = /* @__PURE__ */ new Map(), n = wt(
|
|
2219
|
+
const bo = /* @__PURE__ */ new Map();
|
|
2220
|
+
function ko(t) {
|
|
2221
|
+
const e = /* @__PURE__ */ new Map(), n = wt(yt(t, "numbering.xml"), "w:numbering");
|
|
2222
2222
|
if (!n) return e;
|
|
2223
2223
|
const o = /* @__PURE__ */ new Map();
|
|
2224
2224
|
for (const i of dt(n, "w:abstractNum")) {
|
|
2225
2225
|
const s = h(i, "w:abstractNumId");
|
|
2226
|
-
s !== void 0 && o.set(s,
|
|
2226
|
+
s !== void 0 && o.set(s, vo(i));
|
|
2227
2227
|
}
|
|
2228
2228
|
for (const i of dt(n, "w:num")) {
|
|
2229
2229
|
const s = h(i, "w:numId");
|
|
2230
2230
|
if (s === void 0) continue;
|
|
2231
2231
|
const a = nt(i, "w:abstractNumId"), r = a !== void 0 ? o.get(a) : void 0;
|
|
2232
2232
|
if (!r) continue;
|
|
2233
|
-
const
|
|
2233
|
+
const d = r.map((u) => ({ ...u }));
|
|
2234
2234
|
for (const u of dt(i, "w:lvlOverride")) {
|
|
2235
|
-
const
|
|
2236
|
-
|
|
2235
|
+
const p = y(u, "w:ilvl") ?? 0, l = y(f(u, "w:startOverride"), "w:val"), m = f(u, "w:lvl");
|
|
2236
|
+
m && d[p] && (d[p] = ze(m, p)), l !== void 0 && d[p] && (d[p].start = l);
|
|
2237
2237
|
}
|
|
2238
|
-
e.set(s, { id: s, levels:
|
|
2238
|
+
e.set(s, { id: s, levels: d });
|
|
2239
2239
|
}
|
|
2240
2240
|
return e;
|
|
2241
2241
|
}
|
|
2242
|
-
function
|
|
2242
|
+
function vo(t) {
|
|
2243
2243
|
const e = [];
|
|
2244
2244
|
for (const n of dt(t, "w:lvl")) {
|
|
2245
2245
|
const o = y(n, "w:ilvl") ?? e.length;
|
|
2246
|
-
e[o] =
|
|
2246
|
+
e[o] = ze(n, o);
|
|
2247
2247
|
}
|
|
2248
2248
|
return e;
|
|
2249
2249
|
}
|
|
2250
|
-
function
|
|
2250
|
+
function ze(t, e) {
|
|
2251
2251
|
const n = f(t, "w:lvlText"), o = {
|
|
2252
2252
|
format: nt(t, "w:numFmt") ?? "decimal",
|
|
2253
2253
|
lvlText: n ? h(n, "w:val") ?? "" : `%${e + 1}.`,
|
|
@@ -2256,40 +2256,40 @@ function De(t, e) {
|
|
|
2256
2256
|
if (s) {
|
|
2257
2257
|
const r = y(s, "w:left") ?? y(s, "w:start");
|
|
2258
2258
|
r !== void 0 && (o.indentLeftTwips = r);
|
|
2259
|
-
const
|
|
2260
|
-
|
|
2259
|
+
const d = y(s, "w:hanging");
|
|
2260
|
+
d !== void 0 && (o.hangingTwips = d);
|
|
2261
2261
|
}
|
|
2262
2262
|
const a = f(t, "w:rPr");
|
|
2263
|
-
return a && (o.markerRunProps =
|
|
2263
|
+
return a && (o.markerRunProps = Pt(a)), o;
|
|
2264
2264
|
}
|
|
2265
|
-
function
|
|
2266
|
-
const n = e.includes("/") ? e.slice(0, e.lastIndexOf("/")) : "", o = /* @__PURE__ */ new Map(), i = wt(
|
|
2265
|
+
function yo(t, e) {
|
|
2266
|
+
const n = e.includes("/") ? e.slice(0, e.lastIndexOf("/")) : "", o = /* @__PURE__ */ new Map(), i = wt(yt(t, `${e} rels`), "Relationships");
|
|
2267
2267
|
if (!i) return o;
|
|
2268
2268
|
for (const s of ot(i)) {
|
|
2269
2269
|
if (s.tagName !== "Relationship") continue;
|
|
2270
|
-
const a = h(s, "Id"), r = h(s, "Type"),
|
|
2271
|
-
if (!a || !r || !
|
|
2270
|
+
const a = h(s, "Id"), r = h(s, "Type"), d = h(s, "Target");
|
|
2271
|
+
if (!a || !r || !d) continue;
|
|
2272
2272
|
const u = h(s, "TargetMode") === "External";
|
|
2273
|
-
o.set(a, { id: a, type: r, target: u ?
|
|
2273
|
+
o.set(a, { id: a, type: r, target: u ? d : To(n, d), external: u });
|
|
2274
2274
|
}
|
|
2275
2275
|
return o;
|
|
2276
2276
|
}
|
|
2277
|
-
function
|
|
2277
|
+
function To(t, e) {
|
|
2278
2278
|
if (e.startsWith("/")) return e.slice(1);
|
|
2279
2279
|
const n = t === "" ? [] : t.split("/");
|
|
2280
2280
|
for (const o of e.split("/"))
|
|
2281
2281
|
o === ".." ? n.pop() : o !== "." && o !== "" && n.push(o);
|
|
2282
2282
|
return n.join("/");
|
|
2283
2283
|
}
|
|
2284
|
-
function
|
|
2284
|
+
function _e(t, e) {
|
|
2285
2285
|
for (const n of t.values())
|
|
2286
2286
|
if (n.type.endsWith(`/${e}`)) return n;
|
|
2287
2287
|
}
|
|
2288
|
-
function
|
|
2288
|
+
function So(t) {
|
|
2289
2289
|
const e = t.lastIndexOf("/"), n = e >= 0 ? t.slice(0, e + 1) : "", o = e >= 0 ? t.slice(e + 1) : t;
|
|
2290
2290
|
return `${n}_rels/${o}.rels`;
|
|
2291
2291
|
}
|
|
2292
|
-
const
|
|
2292
|
+
const Po = { colors: /* @__PURE__ */ new Map() }, Io = {
|
|
2293
2293
|
dark1: "dk1",
|
|
2294
2294
|
light1: "lt1",
|
|
2295
2295
|
dark2: "dk2",
|
|
@@ -2302,25 +2302,25 @@ const So = { colors: /* @__PURE__ */ new Map() }, Po = {
|
|
|
2302
2302
|
followedHyperlink: "folHlink"
|
|
2303
2303
|
};
|
|
2304
2304
|
function ye(t, e) {
|
|
2305
|
-
return t.colors.get(
|
|
2305
|
+
return t.colors.get(Io[e] ?? e);
|
|
2306
2306
|
}
|
|
2307
|
-
function
|
|
2307
|
+
function Ht(t, e) {
|
|
2308
2308
|
const n = e.startsWith("major");
|
|
2309
2309
|
if (!(!n && !e.startsWith("minor")))
|
|
2310
2310
|
return e.endsWith("EastAsia") ? n ? t.majorEastAsia : t.minorEastAsia : e.endsWith("Bidi") ? n ? t.majorComplexScript : t.minorComplexScript : n ? t.majorLatin : t.minorLatin;
|
|
2311
2311
|
}
|
|
2312
|
-
function
|
|
2313
|
-
const o =
|
|
2312
|
+
function Mo(t, e, n) {
|
|
2313
|
+
const o = Ao(t);
|
|
2314
2314
|
if (!o) return t;
|
|
2315
2315
|
let [i, s, a] = o;
|
|
2316
|
-
const r = Te(e),
|
|
2316
|
+
const r = Te(e), d = Te(n);
|
|
2317
2317
|
if (r !== void 0) {
|
|
2318
|
-
const u = (
|
|
2318
|
+
const u = (p) => Math.round(p * r + 255 * (1 - r));
|
|
2319
2319
|
[i, s, a] = [u(i), u(s), u(a)];
|
|
2320
|
-
} else
|
|
2320
|
+
} else d !== void 0 && ([i, s, a] = [Math.round(i * d), Math.round(s * d), Math.round(a * d)]);
|
|
2321
2321
|
return Zt(i) + Zt(s) + Zt(a);
|
|
2322
2322
|
}
|
|
2323
|
-
function
|
|
2323
|
+
function Ao(t) {
|
|
2324
2324
|
if (/^[0-9a-fA-F]{6}$/.test(t))
|
|
2325
2325
|
return [parseInt(t.slice(0, 2), 16), parseInt(t.slice(2, 4), 16), parseInt(t.slice(4, 6), 16)];
|
|
2326
2326
|
}
|
|
@@ -2329,295 +2329,307 @@ function Te(t) {
|
|
|
2329
2329
|
return parseInt(t, 16) / 255;
|
|
2330
2330
|
}
|
|
2331
2331
|
const Zt = (t) => Math.max(0, Math.min(255, t)).toString(16).padStart(2, "0");
|
|
2332
|
-
function
|
|
2333
|
-
const e = { colors: /* @__PURE__ */ new Map() }, n = wt(
|
|
2332
|
+
function xo(t) {
|
|
2333
|
+
const e = { colors: /* @__PURE__ */ new Map() }, n = wt(yt(t, "theme"), "a:theme"), o = n && f(n, "a:themeElements");
|
|
2334
2334
|
if (!o) return e;
|
|
2335
2335
|
const i = f(o, "a:fontScheme");
|
|
2336
2336
|
if (i) {
|
|
2337
|
-
const a = f(i, "a:majorFont"), r = f(i, "a:minorFont"),
|
|
2337
|
+
const a = f(i, "a:majorFont"), r = f(i, "a:minorFont"), d = (u, p, l, m) => {
|
|
2338
2338
|
if (!u) return;
|
|
2339
2339
|
const g = (v, P) => {
|
|
2340
|
-
const T =
|
|
2340
|
+
const T = Eo(f(u, v));
|
|
2341
2341
|
T && (e[P] = T);
|
|
2342
2342
|
};
|
|
2343
|
-
g("a:latin",
|
|
2343
|
+
g("a:latin", p), g("a:ea", l), g("a:cs", m);
|
|
2344
2344
|
};
|
|
2345
|
-
|
|
2345
|
+
d(a, "majorLatin", "majorEastAsia", "majorComplexScript"), d(r, "minorLatin", "minorEastAsia", "minorComplexScript");
|
|
2346
2346
|
}
|
|
2347
2347
|
const s = f(o, "a:clrScheme");
|
|
2348
2348
|
if (s)
|
|
2349
2349
|
for (const a of ot(s)) {
|
|
2350
|
-
const r = a.tagName.replace(/^a:/, ""),
|
|
2351
|
-
|
|
2350
|
+
const r = a.tagName.replace(/^a:/, ""), d = f(a, "a:srgbClr"), u = f(a, "a:sysClr"), p = (d && h(d, "val")) ?? (u && h(u, "lastClr"));
|
|
2351
|
+
p && e.colors.set(r, p);
|
|
2352
2352
|
}
|
|
2353
2353
|
return e;
|
|
2354
2354
|
}
|
|
2355
|
-
function
|
|
2355
|
+
function Eo(t) {
|
|
2356
2356
|
return t && h(t, "typeface") || void 0;
|
|
2357
2357
|
}
|
|
2358
|
-
const
|
|
2359
|
-
function
|
|
2360
|
-
const n = { docDefaultsRun: {}, docDefaultsPara: {}, styles: /* @__PURE__ */ new Map() }, o = wt(
|
|
2358
|
+
const Ro = { docDefaultsRun: {}, docDefaultsPara: {}, styles: /* @__PURE__ */ new Map() };
|
|
2359
|
+
function Co(t, e) {
|
|
2360
|
+
const n = { docDefaultsRun: {}, docDefaultsPara: {}, styles: /* @__PURE__ */ new Map() }, o = wt(yt(t, "styles.xml"), "w:styles");
|
|
2361
2361
|
if (!o) return n;
|
|
2362
2362
|
const i = f(o, "w:docDefaults");
|
|
2363
2363
|
if (i) {
|
|
2364
2364
|
const s = f(i, "w:rPrDefault"), a = s && f(s, "w:rPr");
|
|
2365
|
-
a && (n.docDefaultsRun =
|
|
2366
|
-
const r = f(i, "w:pPrDefault"),
|
|
2367
|
-
|
|
2365
|
+
a && (n.docDefaultsRun = Pt(a));
|
|
2366
|
+
const r = f(i, "w:pPrDefault"), d = r && f(r, "w:pPr");
|
|
2367
|
+
d && (n.docDefaultsPara = jt(d));
|
|
2368
2368
|
}
|
|
2369
2369
|
for (const s of dt(o, "w:style")) {
|
|
2370
2370
|
const a = h(s, "w:styleId"), r = h(s, "w:type");
|
|
2371
2371
|
if (!a || !r) continue;
|
|
2372
|
-
const
|
|
2372
|
+
const d = f(s, "w:rPr"), u = f(s, "w:pPr"), p = {
|
|
2373
2373
|
id: a,
|
|
2374
2374
|
type: r,
|
|
2375
|
-
rPr:
|
|
2376
|
-
pPr: u ?
|
|
2377
|
-
},
|
|
2378
|
-
|
|
2379
|
-
const
|
|
2380
|
-
if (
|
|
2375
|
+
rPr: d ? Pt(d) : {},
|
|
2376
|
+
pPr: u ? jt(u) : {}
|
|
2377
|
+
}, l = nt(s, "w:name");
|
|
2378
|
+
l && (p.name = l);
|
|
2379
|
+
const m = nt(s, "w:basedOn");
|
|
2380
|
+
if (m && (p.basedOnId = m), r === "table") {
|
|
2381
2381
|
const v = f(s, "w:tblPr");
|
|
2382
2382
|
if (v) {
|
|
2383
2383
|
const T = Yt(f(v, "w:tblBorders"));
|
|
2384
|
-
T && (
|
|
2385
|
-
const
|
|
2386
|
-
|
|
2384
|
+
T && (p.tblBorders = T);
|
|
2385
|
+
const F = Ft(f(v, "w:shd"));
|
|
2386
|
+
F && (p.tblShd = F);
|
|
2387
2387
|
const L = nt(v, "w:tblStyleRowBandSize");
|
|
2388
|
-
L && Number.isFinite(Number(L)) && (
|
|
2388
|
+
L && Number.isFinite(Number(L)) && (p.rowBandSize = Number(L));
|
|
2389
2389
|
const x = nt(v, "w:tblStyleColBandSize");
|
|
2390
|
-
x && Number.isFinite(Number(x)) && (
|
|
2390
|
+
x && Number.isFinite(Number(x)) && (p.colBandSize = Number(x));
|
|
2391
2391
|
}
|
|
2392
2392
|
const P = {};
|
|
2393
2393
|
for (const T of dt(s, "w:tblStylePr")) {
|
|
2394
|
-
const
|
|
2395
|
-
if (!
|
|
2396
|
-
const L = f(T, "w:rPr"), x = f(T, "w:pPr"), tt = f(T, "w:tcPr"),
|
|
2397
|
-
rPr: L ?
|
|
2398
|
-
pPr: x ?
|
|
2394
|
+
const F = h(T, "w:type");
|
|
2395
|
+
if (!F) continue;
|
|
2396
|
+
const L = f(T, "w:rPr"), x = f(T, "w:pPr"), tt = f(T, "w:tcPr"), W = {
|
|
2397
|
+
rPr: L ? Pt(L) : {},
|
|
2398
|
+
pPr: x ? jt(x) : {}
|
|
2399
2399
|
}, ft = tt && Yt(f(tt, "w:tcBorders"));
|
|
2400
|
-
ft && (
|
|
2401
|
-
const J = tt &&
|
|
2402
|
-
J && (
|
|
2400
|
+
ft && (W.borders = ft);
|
|
2401
|
+
const J = tt && Ft(f(tt, "w:shd"));
|
|
2402
|
+
J && (W.shd = J), P[F] = W;
|
|
2403
2403
|
}
|
|
2404
|
-
Object.keys(P).length > 0 && (
|
|
2404
|
+
Object.keys(P).length > 0 && (p.tblStylePr = P);
|
|
2405
2405
|
}
|
|
2406
|
-
n.styles.set(a,
|
|
2406
|
+
n.styles.set(a, p);
|
|
2407
2407
|
const g = h(s, "w:default");
|
|
2408
2408
|
r === "paragraph" && (g === "1" || g === "true") && (n.defaultParaStyleId = a);
|
|
2409
2409
|
}
|
|
2410
2410
|
return n;
|
|
2411
2411
|
}
|
|
2412
|
-
function
|
|
2412
|
+
function Bo(t, e) {
|
|
2413
2413
|
let n, o;
|
|
2414
2414
|
const i = /* @__PURE__ */ new Set(), s = [];
|
|
2415
2415
|
for (let r = t.styles.get(e); r && !i.has(r.id); r = r.basedOnId ? t.styles.get(r.basedOnId) : void 0)
|
|
2416
2416
|
i.add(r.id), s.unshift(r);
|
|
2417
2417
|
for (const r of s)
|
|
2418
|
-
n =
|
|
2418
|
+
n = an(n, r.tblBorders), r.tblShd !== void 0 && (o = r.tblShd);
|
|
2419
2419
|
const a = {};
|
|
2420
2420
|
return n && (a.borders = n), o !== void 0 && (a.shd = o), a;
|
|
2421
2421
|
}
|
|
2422
|
-
const
|
|
2423
|
-
function
|
|
2424
|
-
const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = (
|
|
2425
|
-
const
|
|
2426
|
-
for (let g = t.styles.get(
|
|
2427
|
-
|
|
2428
|
-
return
|
|
2429
|
-
}, s = (
|
|
2430
|
-
let
|
|
2431
|
-
return
|
|
2432
|
-
}, a = (
|
|
2433
|
-
let
|
|
2434
|
-
return
|
|
2435
|
-
}, r = /* @__PURE__ */ new Map(),
|
|
2436
|
-
const
|
|
2437
|
-
let g = r.get(
|
|
2422
|
+
const No = ["bold", "italic", "strikethrough", "vanish", "caps", "smallCaps"];
|
|
2423
|
+
function Fo(t, e) {
|
|
2424
|
+
const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = (p) => {
|
|
2425
|
+
const l = [], m = /* @__PURE__ */ new Set();
|
|
2426
|
+
for (let g = t.styles.get(p); g && !m.has(g.id); g = g.basedOnId ? t.styles.get(g.basedOnId) : void 0)
|
|
2427
|
+
m.add(g.id), l.unshift(g);
|
|
2428
|
+
return l;
|
|
2429
|
+
}, s = (p) => {
|
|
2430
|
+
let l = n.get(p);
|
|
2431
|
+
return l || (l = i(p).reduce((m, g) => zt(m, g.rPr), {}), n.set(p, l)), l;
|
|
2432
|
+
}, a = (p) => {
|
|
2433
|
+
let l = o.get(p);
|
|
2434
|
+
return l || (l = i(p).reduce((m, g) => Gt(m, g.pPr), {}), o.set(p, l)), l;
|
|
2435
|
+
}, r = /* @__PURE__ */ new Map(), d = (p, l) => {
|
|
2436
|
+
const m = `${p ?? ""}|${l ?? ""}`;
|
|
2437
|
+
let g = r.get(m);
|
|
2438
2438
|
if (g) return g;
|
|
2439
|
-
const v =
|
|
2440
|
-
g =
|
|
2441
|
-
for (const T of
|
|
2439
|
+
const v = p ? s(p) : {}, P = l ? s(l) : {};
|
|
2440
|
+
g = zt(zt(t.docDefaultsRun, v), P);
|
|
2441
|
+
for (const T of No) {
|
|
2442
2442
|
if (t.docDefaultsRun[T] === void 0 && v[T] === void 0 && P[T] === void 0) continue;
|
|
2443
|
-
const
|
|
2444
|
-
g[T] =
|
|
2443
|
+
const F = t.docDefaultsRun[T] ?? !1;
|
|
2444
|
+
g[T] = F !== (v[T] === !0) != (P[T] === !0);
|
|
2445
2445
|
}
|
|
2446
|
-
return r.set(
|
|
2446
|
+
return r.set(m, g), g;
|
|
2447
2447
|
};
|
|
2448
2448
|
return {
|
|
2449
|
-
run(
|
|
2450
|
-
const
|
|
2451
|
-
return u(
|
|
2449
|
+
run(p, l) {
|
|
2450
|
+
const m = p ?? t.defaultParaStyleId, g = d(m, l.styleId);
|
|
2451
|
+
return u(zt(g, l));
|
|
2452
2452
|
},
|
|
2453
|
-
para(
|
|
2454
|
-
const
|
|
2455
|
-
return
|
|
2453
|
+
para(p) {
|
|
2454
|
+
const l = p.styleId ?? t.defaultParaStyleId, m = l ? a(l) : {}, g = Gt(Gt(t.docDefaultsPara, m), p);
|
|
2455
|
+
return p.styleId ? g.styleId = p.styleId : delete g.styleId, g;
|
|
2456
2456
|
},
|
|
2457
|
-
isHeading(
|
|
2458
|
-
if (!
|
|
2459
|
-
const
|
|
2460
|
-
return i(
|
|
2457
|
+
isHeading(p) {
|
|
2458
|
+
if (!p) return !1;
|
|
2459
|
+
const l = (m) => m !== void 0 && /(^|\s)heading(\s|\d|$)/i.test(m);
|
|
2460
|
+
return i(p).some((m) => l(m.name) || l(m.id));
|
|
2461
2461
|
}
|
|
2462
2462
|
};
|
|
2463
|
-
function u(
|
|
2464
|
-
const
|
|
2465
|
-
if (!
|
|
2466
|
-
const
|
|
2467
|
-
|
|
2463
|
+
function u(p) {
|
|
2464
|
+
const l = { ...p };
|
|
2465
|
+
if (!l.fontAscii && l.fontThemeAscii) {
|
|
2466
|
+
const m = Ht(e, l.fontThemeAscii);
|
|
2467
|
+
m && (l.fontAscii = m);
|
|
2468
2468
|
}
|
|
2469
|
-
if (!
|
|
2470
|
-
const
|
|
2471
|
-
|
|
2469
|
+
if (!l.fontHAnsi && l.fontThemeHAnsi) {
|
|
2470
|
+
const m = Ht(e, l.fontThemeHAnsi);
|
|
2471
|
+
m && (l.fontHAnsi = m);
|
|
2472
2472
|
}
|
|
2473
|
-
if (!
|
|
2474
|
-
const
|
|
2475
|
-
|
|
2473
|
+
if (!l.fontCs && l.fontThemeCs) {
|
|
2474
|
+
const m = Ht(e, l.fontThemeCs);
|
|
2475
|
+
m && (l.fontCs = m);
|
|
2476
2476
|
}
|
|
2477
|
-
if (!
|
|
2478
|
-
const
|
|
2479
|
-
|
|
2477
|
+
if (!l.fontEastAsia && l.fontThemeEastAsia) {
|
|
2478
|
+
const m = Ht(e, l.fontThemeEastAsia);
|
|
2479
|
+
m && (l.fontEastAsia = m);
|
|
2480
2480
|
}
|
|
2481
|
-
if ((
|
|
2482
|
-
const
|
|
2483
|
-
|
|
2481
|
+
if ((l.color === void 0 || l.color === "auto") && l.colorTheme) {
|
|
2482
|
+
const m = ye(e, l.colorTheme);
|
|
2483
|
+
m && (l.color = Mo(m, l.colorThemeTint, l.colorThemeShade));
|
|
2484
2484
|
}
|
|
2485
|
-
if ((
|
|
2486
|
-
const
|
|
2487
|
-
|
|
2485
|
+
if ((l.underlineColor === void 0 || l.underlineColor === "auto") && l.underlineColorTheme) {
|
|
2486
|
+
const m = ye(e, l.underlineColorTheme);
|
|
2487
|
+
m && (l.underlineColor = m);
|
|
2488
2488
|
}
|
|
2489
|
-
return
|
|
2489
|
+
return l;
|
|
2490
2490
|
}
|
|
2491
2491
|
}
|
|
2492
|
-
function
|
|
2492
|
+
function zt(t, e) {
|
|
2493
2493
|
const n = { ...t };
|
|
2494
|
-
return (e.fontAscii !== void 0 || e.fontThemeAscii !== void 0) && (delete n.fontAscii, delete n.fontThemeAscii), (e.fontHAnsi !== void 0 || e.fontThemeHAnsi !== void 0) && (delete n.fontHAnsi, delete n.fontThemeHAnsi), (e.fontCs !== void 0 || e.fontThemeCs !== void 0) && (delete n.fontCs, delete n.fontThemeCs), (e.fontEastAsia !== void 0 || e.fontThemeEastAsia !== void 0) && (delete n.fontEastAsia, delete n.fontThemeEastAsia), (e.color !== void 0 || e.colorTheme !== void 0) && (delete n.color, delete n.colorTheme, delete n.colorThemeTint, delete n.colorThemeShade), (e.underline !== void 0 || e.underlineStyle !== void 0 || e.underlineColor !== void 0 || e.underlineColorTheme !== void 0) && (delete n.underlineStyle, delete n.underlineColor, delete n.underlineColorTheme),
|
|
2494
|
+
return (e.fontAscii !== void 0 || e.fontThemeAscii !== void 0) && (delete n.fontAscii, delete n.fontThemeAscii), (e.fontHAnsi !== void 0 || e.fontThemeHAnsi !== void 0) && (delete n.fontHAnsi, delete n.fontThemeHAnsi), (e.fontCs !== void 0 || e.fontThemeCs !== void 0) && (delete n.fontCs, delete n.fontThemeCs), (e.fontEastAsia !== void 0 || e.fontThemeEastAsia !== void 0) && (delete n.fontEastAsia, delete n.fontThemeEastAsia), (e.color !== void 0 || e.colorTheme !== void 0) && (delete n.color, delete n.colorTheme, delete n.colorThemeTint, delete n.colorThemeShade), (e.underline !== void 0 || e.underlineStyle !== void 0 || e.underlineColor !== void 0 || e.underlineColorTheme !== void 0) && (delete n.underlineStyle, delete n.underlineColor, delete n.underlineColorTheme), Gt(n, e);
|
|
2495
2495
|
}
|
|
2496
|
-
function
|
|
2496
|
+
function Gt(t, e) {
|
|
2497
2497
|
const n = { ...t };
|
|
2498
2498
|
for (const [o, i] of Object.entries(e))
|
|
2499
2499
|
i !== void 0 && (n[o] = i);
|
|
2500
2500
|
return n;
|
|
2501
2501
|
}
|
|
2502
|
-
const
|
|
2503
|
-
function
|
|
2504
|
-
if (
|
|
2505
|
-
throw new
|
|
2506
|
-
if (
|
|
2507
|
-
throw new
|
|
2508
|
-
|
|
2509
|
-
|
|
2502
|
+
const Lo = 64 * 1024 * 1024, Oo = 4096, Do = 128 * 1024 * 1024, Se = 32 * 1024 * 1024, Ho = [80, 75], zo = [208, 207, 17, 224], Pe = (t, e) => e.every((n, o) => t[o] === n);
|
|
2503
|
+
function _o(t) {
|
|
2504
|
+
if (t.byteLength > Lo)
|
|
2505
|
+
throw new kt("ARCHIVE_LIMIT", "Document exceeds the maximum supported compressed size.");
|
|
2506
|
+
if (Pe(t, zo))
|
|
2507
|
+
throw new kt("ENCRYPTED", "Password-protected documents are not supported.");
|
|
2508
|
+
if (!Pe(t, Ho))
|
|
2509
|
+
throw new kt("NOT_ZIP", "Not a .docx file (zip container signature missing).");
|
|
2510
|
+
const e = (d) => /^word\/media\//.test(d);
|
|
2511
|
+
let n, o, i = 0, s = 0;
|
|
2510
2512
|
try {
|
|
2511
2513
|
o = [], n = ie(t, {
|
|
2512
|
-
filter: (
|
|
2514
|
+
filter: (d) => {
|
|
2515
|
+
if (s++, s > Oo)
|
|
2516
|
+
throw new kt("ARCHIVE_LIMIT", "Document contains too many archive entries.");
|
|
2517
|
+
if (!Number.isSafeInteger(d.originalSize) || d.originalSize < 0 || d.originalSize > Se)
|
|
2518
|
+
throw new kt("ARCHIVE_LIMIT", "Document contains an oversized archive part.");
|
|
2519
|
+
if (i += d.originalSize, i > Do)
|
|
2520
|
+
throw new kt("ARCHIVE_LIMIT", "Document exceeds the maximum supported expanded size.");
|
|
2521
|
+
return e(d.name) ? (o.push(d.name), !1) : !0;
|
|
2522
|
+
}
|
|
2513
2523
|
});
|
|
2514
|
-
} catch (
|
|
2515
|
-
throw new
|
|
2516
|
-
}
|
|
2517
|
-
const
|
|
2518
|
-
const
|
|
2519
|
-
|
|
2524
|
+
} catch (d) {
|
|
2525
|
+
throw d instanceof kt ? d : new kt("NOT_ZIP", `Corrupt zip container: ${d instanceof Error ? d.message : String(d)}`);
|
|
2526
|
+
}
|
|
2527
|
+
const a = /* @__PURE__ */ new Map(), r = (d) => {
|
|
2528
|
+
const u = ie(t, { filter: (p) => p.name === d })[d];
|
|
2529
|
+
if (u && u.byteLength > Se)
|
|
2530
|
+
throw new kt("ARCHIVE_LIMIT", "Document contains an oversized media part.");
|
|
2531
|
+
return u && (n[d] = u), u;
|
|
2520
2532
|
};
|
|
2521
2533
|
return {
|
|
2522
|
-
part: (
|
|
2523
|
-
text(
|
|
2524
|
-
const
|
|
2525
|
-
if (
|
|
2526
|
-
const
|
|
2527
|
-
if (!
|
|
2528
|
-
const
|
|
2529
|
-
return
|
|
2534
|
+
part: (d) => n[d] ?? (e(d) ? r(d) : void 0),
|
|
2535
|
+
text(d) {
|
|
2536
|
+
const u = a.get(d);
|
|
2537
|
+
if (u !== void 0) return u;
|
|
2538
|
+
const p = n[d];
|
|
2539
|
+
if (!p) return;
|
|
2540
|
+
const l = Ve(p);
|
|
2541
|
+
return a.set(d, l), l;
|
|
2530
2542
|
},
|
|
2531
|
-
names: () => [...Object.keys(n), ...o.filter((
|
|
2543
|
+
names: () => [...Object.keys(n), ...o.filter((d) => !(d in n))]
|
|
2532
2544
|
};
|
|
2533
2545
|
}
|
|
2534
|
-
function
|
|
2535
|
-
const o = (O, A) => (n?.onProgress ?? e)?.(O, A), i = new
|
|
2546
|
+
function qo(t, e, n) {
|
|
2547
|
+
const o = (O, A) => (n?.onProgress ?? e)?.(O, A), i = new Ue(), s = [], a = n?.collectMediaBytes ? {
|
|
2536
2548
|
add(O, A) {
|
|
2537
2549
|
const at = `ked-media:${s.length}`;
|
|
2538
2550
|
return s.push({ src: at, bytes: O, mime: A }), at;
|
|
2539
2551
|
}
|
|
2540
2552
|
} : void 0;
|
|
2541
2553
|
o("unzip", 0);
|
|
2542
|
-
const r =
|
|
2554
|
+
const r = _o(t);
|
|
2543
2555
|
o("unzip", 1);
|
|
2544
|
-
const
|
|
2545
|
-
if (
|
|
2546
|
-
throw new
|
|
2547
|
-
const
|
|
2556
|
+
const d = r.text("[Content_Types].xml"), u = (d !== void 0 ? Ge(d) : void 0) ?? "word/document.xml", p = r.text(u);
|
|
2557
|
+
if (p === void 0)
|
|
2558
|
+
throw new kt("NO_DOCUMENT_PART", `Main document part "${u}" not found in the archive.`);
|
|
2559
|
+
const l = Ut(r, u);
|
|
2548
2560
|
o("styles", 0);
|
|
2549
|
-
const
|
|
2561
|
+
const m = _t(r, l, "styles") ?? r.text("word/styles.xml"), g = m !== void 0 ? Co(m) : Ro, v = _t(r, l, "theme") ?? r.text("word/theme/theme1.xml"), P = v !== void 0 ? xo(v) : Po, T = Fo(g, P), F = _t(r, l, "numbering") ?? r.text("word/numbering.xml"), L = F !== void 0 ? ko(F) : bo;
|
|
2550
2562
|
o("styles", 1), o("parse", 0);
|
|
2551
|
-
const x =
|
|
2563
|
+
const x = In(p, u, i);
|
|
2552
2564
|
o("parse", 1), o("map", 0);
|
|
2553
2565
|
const tt = {
|
|
2554
2566
|
w: x.section?.pageWidthTwips ?? 12240,
|
|
2555
2567
|
h: x.section?.pageHeightTwips ?? 15840
|
|
2556
|
-
},
|
|
2568
|
+
}, W = Qn(
|
|
2557
2569
|
i,
|
|
2558
2570
|
T,
|
|
2559
2571
|
x.sdts,
|
|
2560
2572
|
L,
|
|
2561
|
-
(O) =>
|
|
2573
|
+
(O) => Bo(g, O),
|
|
2562
2574
|
tt,
|
|
2563
2575
|
{ lineNumbering: x.section?.lineNumbering, pageNumberStart: x.section?.pageNumberStart }
|
|
2564
2576
|
), ft = [], J = (O) => {
|
|
2565
|
-
const A =
|
|
2577
|
+
const A = wo(r, O, i, a);
|
|
2566
2578
|
return ft.push(A), A;
|
|
2567
|
-
}, U =
|
|
2568
|
-
U.length === 0 && U.push(
|
|
2569
|
-
const E =
|
|
2579
|
+
}, U = W.mapBlocks(x.blocks, J(l), Vt(l));
|
|
2580
|
+
U.length === 0 && U.push(W.emptyParagraph());
|
|
2581
|
+
const E = W.mapSection(x.section);
|
|
2570
2582
|
x.pageColorHex && (E.pageColorHex = `#${x.pageColorHex}`);
|
|
2571
|
-
const q =
|
|
2572
|
-
|
|
2573
|
-
const
|
|
2583
|
+
const q = _t(r, l, "settings") ?? r.text("word/settings.xml"), Q = q !== void 0 ? $o(q) : { evenAndOdd: !1 }, B = Q.evenAndOdd;
|
|
2584
|
+
Ie(E, "header", x.section?.headerRefs, x.section?.titlePg ?? !1, B, r, l, W, J, i, x.sdts), Ie(E, "footer", x.section?.footerRefs, x.section?.titlePg ?? !1, B, r, l, W, J, i, x.sdts);
|
|
2585
|
+
const $ = Wt(l, "footnotes") ?? "word/footnotes.xml", j = r.text($), rt = j !== void 0 ? Yn(j, $, i, x.sdts) : /* @__PURE__ */ new Map(), ht = {};
|
|
2574
2586
|
if (rt.size > 0) {
|
|
2575
|
-
const O = Ut(r,
|
|
2576
|
-
for (const { docxId: R, noteId: X } of
|
|
2577
|
-
const
|
|
2578
|
-
if (!
|
|
2587
|
+
const O = Ut(r, $), A = J(O), at = Vt(O);
|
|
2588
|
+
for (const { docxId: R, noteId: X } of W.footnoteRefs()) {
|
|
2589
|
+
const H = rt.get(R);
|
|
2590
|
+
if (!H) {
|
|
2579
2591
|
i.add("footnote-missing", "A footnote reference had no matching note body.");
|
|
2580
2592
|
continue;
|
|
2581
2593
|
}
|
|
2582
|
-
const k =
|
|
2594
|
+
const k = W.mapBlocks(H, A, at), w = k.filter((S) => S.kind === "paragraph");
|
|
2583
2595
|
w.length < k.length && i.add("footnote-tables", "Tables inside footnotes were dropped (footnotes hold paragraphs only)."), w.length > 0 && (ht[X] = w);
|
|
2584
2596
|
}
|
|
2585
2597
|
}
|
|
2586
|
-
const bt =
|
|
2587
|
-
let
|
|
2588
|
-
for (const { docxId: O, noteId: A } of
|
|
2598
|
+
const bt = Wt(l, "endnotes") ?? "word/endnotes.xml", ut = r.text(bt), it = ut !== void 0 ? qn(ut, bt, i, x.sdts) : /* @__PURE__ */ new Map(), mt = {};
|
|
2599
|
+
let pt;
|
|
2600
|
+
for (const { docxId: O, noteId: A } of W.endnoteRefs()) {
|
|
2589
2601
|
const at = it.get(O);
|
|
2590
2602
|
if (!at) {
|
|
2591
2603
|
i.add("endnote-missing", "An endnote reference had no matching note body.");
|
|
2592
2604
|
continue;
|
|
2593
2605
|
}
|
|
2594
|
-
if (!
|
|
2595
|
-
const
|
|
2596
|
-
|
|
2606
|
+
if (!pt) {
|
|
2607
|
+
const H = Ut(r, bt);
|
|
2608
|
+
pt = { media: J(H), link: Vt(H) };
|
|
2597
2609
|
}
|
|
2598
|
-
const R =
|
|
2599
|
-
X.length < R.length && i.add("endnote-tables", "Tables inside endnotes were dropped (endnotes hold paragraphs only)."), X.length > 0 && (
|
|
2610
|
+
const R = W.mapBlocks(at, pt.media, pt.link), X = R.filter((H) => H.kind === "paragraph");
|
|
2611
|
+
X.length < R.length && i.add("endnote-tables", "Tables inside endnotes were dropped (endnotes hold paragraphs only)."), X.length > 0 && (mt[A] = X);
|
|
2600
2612
|
}
|
|
2601
2613
|
o("map", 1);
|
|
2602
2614
|
const V = { section: E, blocks: U };
|
|
2603
|
-
Object.keys(ht).length > 0 && (V.footnotes = ht), Object.keys(
|
|
2604
|
-
const c =
|
|
2615
|
+
Object.keys(ht).length > 0 && (V.footnotes = ht), Object.keys(mt).length > 0 && (V.endnotes = mt);
|
|
2616
|
+
const c = mo(x.sdts);
|
|
2605
2617
|
Object.keys(c).length > 0 && (V.sdts = c);
|
|
2606
|
-
const b =
|
|
2618
|
+
const b = W.lists();
|
|
2607
2619
|
Object.keys(b).length > 0 && (V.lists = b);
|
|
2608
|
-
const C =
|
|
2620
|
+
const C = W.bookmarks();
|
|
2609
2621
|
Object.keys(C).length > 0 && (V.bookmarks = C);
|
|
2610
|
-
const
|
|
2611
|
-
|
|
2612
|
-
const M =
|
|
2622
|
+
const z = po(g);
|
|
2623
|
+
z && (V.stylesheet = z);
|
|
2624
|
+
const M = ho(g);
|
|
2613
2625
|
M && (V.tableStyles = M);
|
|
2614
|
-
const
|
|
2615
|
-
|
|
2616
|
-
const Y =
|
|
2626
|
+
const N = W.tocField();
|
|
2627
|
+
N && (V.tocInstruction = N.instruction, $e(V) === 0 && (V.tocAnchorBlockId = N.blockId)), x.fields && (V.fields = x.fields), Q.defaultTabStopPx !== void 0 && (V.defaultTabStopPx = Q.defaultTabStopPx), Q.compatSettings && (V.compatSettings = Q.compatSettings);
|
|
2628
|
+
const Y = Wt(l, "comments") ?? "word/comments.xml", G = r.text(Y);
|
|
2617
2629
|
let st;
|
|
2618
|
-
if (
|
|
2619
|
-
const O = pn(
|
|
2620
|
-
st =
|
|
2630
|
+
if (G !== void 0) {
|
|
2631
|
+
const O = pn(G), A = Wt(l, "commentsExtended") ?? "word/commentsExtended.xml", at = r.text(A), R = at !== void 0 ? hn(at) : /* @__PURE__ */ new Map(), X = W.commentAnchors(), H = U[0]?.id;
|
|
2632
|
+
st = gn(O, R, X, H ? { start: { blockId: H, offset: 0 }, end: { blockId: H, offset: 0 } } : void 0);
|
|
2621
2633
|
}
|
|
2622
2634
|
return {
|
|
2623
2635
|
doc: V,
|
|
@@ -2627,29 +2639,29 @@ function Uo(t, e, n) {
|
|
|
2627
2639
|
media: s
|
|
2628
2640
|
};
|
|
2629
2641
|
}
|
|
2630
|
-
function
|
|
2642
|
+
function Wo(t, e, n, o, i, s, a) {
|
|
2631
2643
|
if (!n) return;
|
|
2632
|
-
const r = e.get(n),
|
|
2633
|
-
if (r === void 0 ||
|
|
2644
|
+
const r = e.get(n), d = r && !r.external ? t.text(r.target) : void 0;
|
|
2645
|
+
if (r === void 0 || d === void 0) {
|
|
2634
2646
|
s.add("header-missing", "A referenced header/footer part was missing from the archive.");
|
|
2635
2647
|
return;
|
|
2636
2648
|
}
|
|
2637
|
-
const u = Ut(t, r.target),
|
|
2638
|
-
return
|
|
2649
|
+
const u = Ut(t, r.target), p = Mn(d, r.target, s, a), l = o.mapBlocks(p, i(u), Vt(u));
|
|
2650
|
+
return l.length > 0 ? l : void 0;
|
|
2639
2651
|
}
|
|
2640
|
-
function
|
|
2652
|
+
function Ie(t, e, n, o, i, s, a, r, d, u, p) {
|
|
2641
2653
|
if (!n) return;
|
|
2642
|
-
const
|
|
2643
|
-
const P =
|
|
2654
|
+
const l = (g) => `${e}${g}`, m = (g, v) => {
|
|
2655
|
+
const P = Wo(s, a, v, r, d, u, p);
|
|
2644
2656
|
P && (t[g] = P);
|
|
2645
2657
|
};
|
|
2646
|
-
|
|
2658
|
+
m(l(""), n.default), o && m(l("First"), n.first), i && m(l("Even"), n.even);
|
|
2647
2659
|
}
|
|
2648
|
-
function
|
|
2649
|
-
const e = wt(
|
|
2660
|
+
function $o(t) {
|
|
2661
|
+
const e = wt(yt(t, "settings.xml"), "w:settings");
|
|
2650
2662
|
if (!e) return { evenAndOdd: !1 };
|
|
2651
2663
|
const n = { evenAndOdd: !!f(e, "w:evenAndOddHeadersAndFooters") }, o = y(f(e, "w:defaultTabStop"), "w:val");
|
|
2652
|
-
o !== void 0 && o > 0 && o !== 720 && (n.defaultTabStopPx = I(
|
|
2664
|
+
o !== void 0 && o > 0 && o !== 720 && (n.defaultTabStopPx = I(D(o)));
|
|
2653
2665
|
const i = f(e, "w:compat");
|
|
2654
2666
|
if (i) {
|
|
2655
2667
|
const s = dt(i, "w:compatSetting").map((a) => ({ name: h(a, "w:name") ?? "", uri: h(a, "w:uri") ?? "", val: h(a, "w:val") ?? "" })).filter((a) => a.name !== "");
|
|
@@ -2658,8 +2670,8 @@ function Do(t) {
|
|
|
2658
2670
|
return n;
|
|
2659
2671
|
}
|
|
2660
2672
|
function Ut(t, e) {
|
|
2661
|
-
const n = t.text(
|
|
2662
|
-
return n !== void 0 ?
|
|
2673
|
+
const n = t.text(So(e));
|
|
2674
|
+
return n !== void 0 ? yo(n, e) : /* @__PURE__ */ new Map();
|
|
2663
2675
|
}
|
|
2664
2676
|
function Vt(t) {
|
|
2665
2677
|
return (e) => {
|
|
@@ -2667,25 +2679,26 @@ function Vt(t) {
|
|
|
2667
2679
|
return n?.external ? n.target : void 0;
|
|
2668
2680
|
};
|
|
2669
2681
|
}
|
|
2670
|
-
function
|
|
2671
|
-
const o =
|
|
2682
|
+
function _t(t, e, n) {
|
|
2683
|
+
const o = _e(e, n);
|
|
2672
2684
|
return o && !o.external ? t.text(o.target) : void 0;
|
|
2673
2685
|
}
|
|
2674
|
-
function
|
|
2675
|
-
const n =
|
|
2686
|
+
function Wt(t, e) {
|
|
2687
|
+
const n = _e(t, e);
|
|
2676
2688
|
return n && !n.external ? n.target : void 0;
|
|
2677
2689
|
}
|
|
2678
2690
|
export {
|
|
2691
|
+
Lo as M,
|
|
2679
2692
|
Xt as a,
|
|
2680
|
-
|
|
2693
|
+
Xo as b,
|
|
2681
2694
|
lt as c,
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2695
|
+
Vo as d,
|
|
2696
|
+
Ae as e,
|
|
2697
|
+
en as f,
|
|
2685
2698
|
ce as g,
|
|
2686
2699
|
se as h,
|
|
2687
|
-
|
|
2700
|
+
St as l,
|
|
2688
2701
|
Ct as m,
|
|
2689
|
-
|
|
2690
|
-
|
|
2702
|
+
qo as r,
|
|
2703
|
+
Yo as t
|
|
2691
2704
|
};
|