@silurus/ooxml 0.88.0 → 0.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +118 -23
- package/THIRD_PARTY_NOTICES.md +7 -6
- package/dist/abort-VrnK7mdP.js +10 -0
- package/dist/assets/render-worker-CUOU6mL2.js +16 -0
- package/dist/assets/render-worker-DOqrFhSU.js +15 -0
- package/dist/assets/render-worker-DvWUdZUN.js +35 -0
- package/dist/bounded-raw-part-cache-B7JoC1CD.js +64586 -0
- package/dist/bundled-asset-url-E2nXURF9.js +15 -0
- package/dist/canvas-viewer-mechanics-DfQqRKkD.js +675 -0
- package/dist/cfb-guard-9QTRTg7f.js +528 -0
- package/dist/chart-ex.mjs +692 -688
- package/dist/comment-overlay-controller-B5_zGgG5.js +994 -0
- package/dist/comment-ui-runtime-B7ZvovcS.js +2 -0
- package/dist/{comment-ui-runtime-DcJOYlw-.js → comment-ui-runtime-D_sb2K6s.js} +5 -5
- package/dist/{comment-ui-runtime-CWGqn5Vr.js → comment-ui-runtime-Jy-3goA9.js} +5 -5
- package/dist/delimited-text-worker-host-CikWU6_m.js +27 -0
- package/dist/document-model-source-BKNrXjAL.js +249 -0
- package/dist/document-pull-client-CxONDGbk.js +37833 -0
- package/dist/document-pull-worker-AMyXYpPq.js +104 -0
- package/dist/docx-D91ER1_S.js +495 -0
- package/dist/docx-DhDnKEI6.js +3563 -0
- package/dist/docx-model-source-CdrSt3hF.js +98 -0
- package/dist/docx-source-worker.mjs +455 -0
- package/dist/docx.mjs +7 -7
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/drawingml-shape-ChcGZNd8.js +310 -0
- package/dist/duotone-ekYik4ix.js +126 -0
- package/dist/emf-UT6I8rVi.js +1790 -0
- package/dist/font-preload-demand-CdJZUMCT.js +2058 -0
- package/dist/grid-geometry-uQOgViJU.js +384 -0
- package/dist/host-layout-DVMw8hDY.js +56 -0
- package/dist/host-layout-measure-CCEgaC_v.js +7 -0
- package/dist/in-process-pull-transport-DuXcPZng.js +29 -0
- package/dist/index.mjs +4 -4
- package/dist/internal-companion.mjs +12 -0
- package/dist/line-distribute-CPOV6csk.js +2716 -0
- package/dist/math.mjs +2 -2
- package/dist/mathjax-stix2.js +10 -10
- package/dist/model-source-DJGzDtGb.js +61 -0
- package/dist/model-source-kz_NkZqT.js +179 -0
- package/dist/model-source-session-Bu9CHFHc.js +71 -0
- package/dist/model-source-session-CDuijwv1.js +85 -0
- package/dist/model-source-session-sKpNiIJI.js +58 -0
- package/dist/node.mjs +7 -1327
- package/dist/{pixel-budget-9P63Bsk5.js → pixel-budget-BpTYrepD.js} +13 -10
- package/dist/plot-area-frame-CaJFvZ7p.js +8502 -0
- package/dist/pptx-CDP9dZHe.js +2936 -0
- package/dist/pptx-C_uxLVKB.js +183 -0
- package/dist/pptx-model-source-O7LhpOjz.js +37 -0
- package/dist/pptx-source-worker.mjs +446 -0
- package/dist/pptx.mjs +8 -7
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/presentation-model-source-tmROzteR.js +77 -0
- package/dist/raster-target-YQ4G6rxo.js +42 -0
- package/dist/region-map.mjs +114 -150
- package/dist/{render-D3iqVKCo.js → render-CJVglUHl.js} +3 -3
- package/dist/{render-worker-host-B5wQfB7U.js → render-worker-host-BseIaVvm.js} +1 -1
- package/dist/{render-worker-host-D4123J27.js → render-worker-host-CyxPU4JU.js} +1 -1
- package/dist/{render-worker-host-Di3LxLc0.js → render-worker-host-aF6aWkC0.js} +1 -1
- package/dist/renderer-CkGLj0CC.js +5170 -0
- package/dist/renderer-Czw1cCC7.js +5823 -0
- package/dist/resource-measurement-mXw-WjMF.js +771 -0
- package/dist/session-Csv9maad.js +656 -0
- package/dist/slide-pull-client-DRZYwBTu.js +6515 -0
- package/dist/three-d-BK5siJgJ.js +878 -0
- package/dist/three-d.mjs +960 -945
- package/dist/{raster-target-ojDdQizC.js → tiff-contract-C6M3QcPp.js} +1 -42
- package/dist/tiff.mjs +401 -248
- package/dist/types/chart-ex.d.ts +149 -2
- package/dist/types/docx.d.ts +333 -96
- package/dist/types/index.d.ts +566 -301
- package/dist/types/internal-companion.d.ts +11 -0
- package/dist/types/math.d.ts +1 -1
- package/dist/types/node.d.ts +422 -9
- package/dist/types/pptx.d.ts +302 -95
- package/dist/types/region-map.d.ts +149 -2
- package/dist/types/three-d.d.ts +149 -2
- package/dist/types/tiff.d.ts +1 -1
- package/dist/types/xlsx.d.ts +343 -132
- package/dist/wasm-loader-rlgHmcSv.js +35 -0
- package/dist/wasm-runtime-generation-DX4y0Ecl.js +97 -0
- package/dist/workbook-model-source-BTC4ISTS.js +94 -0
- package/dist/worker-source-I1cIYBel.js +22 -0
- package/dist/worker-source-SbudzjYL.js +22 -0
- package/dist/worker-source-UAi3GNcM.js +22 -0
- package/dist/worksheet-pull-client-CkHgbtyM.js +579 -0
- package/dist/xlsx-CpSDPAEU.js +5809 -0
- package/dist/xlsx-D5569TPf.js +534 -0
- package/dist/xlsx-model-source-DPSkjFic.js +309 -0
- package/dist/xlsx-source-worker.mjs +525 -0
- package/dist/xlsx.mjs +8 -7
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +42 -16
- package/dist/assets/render-worker-1uPAxMZr.js +0 -31
- package/dist/assets/render-worker-BlvJybji.js +0 -10
- package/dist/assets/render-worker-CzmiJfFL.js +0 -11
- package/dist/bounded-raw-part-cache-Cg1BsSZQ.js +0 -119
- package/dist/canvas-viewer-mechanics-DbLz0rYW.js +0 -1384
- package/dist/cjk-fallback-bLI3z70h.js +0 -46
- package/dist/comment-occurrence-C8Y2uoVr.js +0 -6
- package/dist/comment-ui-runtime-BsK8pmUT.js +0 -2
- package/dist/comments-Diid5ujN.js +0 -246
- package/dist/delimited-text-worker-host-BVY-Ecni.js +0 -27
- package/dist/document-pull-client-B9PTM-pL.js +0 -27280
- package/dist/docx-BF9WXrYH.js +0 -3103
- package/dist/dom-interaction-boundary-Cnm8DSBN.js +0 -223
- package/dist/highlight-rect-C5hkRqUr.js +0 -13
- package/dist/hyperlink-Cxzhet30.js +0 -36446
- package/dist/line-distribute-D1WNHKz_.js +0 -1023
- package/dist/line-metrics-B60C86uh.js +0 -60
- package/dist/plot-area-frame-DLTYKHNP.js +0 -4354
- package/dist/pptx-DkyYBYoL.js +0 -3065
- package/dist/renderer-B4GZb5We.js +0 -6492
- package/dist/resource-measurement-SHQCbkh2.js +0 -150
- package/dist/session-BGq81gRQ.js +0 -743
- package/dist/slide-pull-client-DiPnm240.js +0 -6253
- package/dist/source-key-DIJG8BA0.js +0 -42
- package/dist/three-d-DJBl8g8M.js +0 -1162
- package/dist/transfer-p6iCC2R7.js +0 -6
- package/dist/units-BzZ0gAxs.js +0 -4
- package/dist/worksheet-pull-client-BM8ywvbu.js +0 -458
- package/dist/xlsx-C9NVjgaV.js +0 -8484
- /package/dist/{chunk-DmhlhrBa.js → chunk-Dy4uBu1J.js} +0 -0
- /package/dist/{mathjax-DoyWZbSp.js → mathjax-BhwN6ilc.js} +0 -0
- /package/dist/{read-only-comment-decoration-Dz7eTQ4d.js → read-only-comment-decoration-PidH0wnP.js} +0 -0
- /package/dist/{read-only-comment-margin-DkgzASAl.js → read-only-comment-margin-B52rDVKo.js} +0 -0
- /package/dist/{renderer-module-contract-D91rkYHH.js → renderer-module-contract-CWM7jv6d.js} +0 -0
- /package/dist/{visible-index-BgiHEc1z.js → visible-index-FeVA0mGE.js} +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { $a as e } from "./plot-area-frame-CaJFvZ7p.js";
|
|
2
|
+
import { A as t, En as n, H as r, Tn as i, Y as a, j as o, k as s, q as c } from "./bounded-raw-part-cache-B7JoC1CD.js";
|
|
3
|
+
import { S as l } from "./worksheet-pull-client-CkHgbtyM.js";
|
|
4
|
+
//#region packages/docx/src/internal/parser-errors.ts
|
|
5
|
+
var u = "OOXML_DOCX_ILVL:";
|
|
6
|
+
function d(t) {
|
|
7
|
+
let n = t instanceof Error ? t.message : String(t);
|
|
8
|
+
if (!n.startsWith(u)) return;
|
|
9
|
+
let r = n.slice(16);
|
|
10
|
+
if (r === "repair-required:level-definition") return new e("invalid-numbering", "The DOCX defines a numbering level outside Word’s supported 0–8 range and requires repair.");
|
|
11
|
+
if (r === "cannot-open:whitespace" || r === "cannot-open:non-decimal") return new e("invalid-numbering", `Word cannot open this DOCX numbering level (${r.slice(12)}).`);
|
|
12
|
+
}
|
|
13
|
+
function f(e) {
|
|
14
|
+
try {
|
|
15
|
+
return d(e) ?? e;
|
|
16
|
+
} catch {
|
|
17
|
+
return e;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function p(e) {
|
|
21
|
+
try {
|
|
22
|
+
return e();
|
|
23
|
+
} catch (e) {
|
|
24
|
+
throw f(e);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region packages/docx/src/document-pull-worker.ts
|
|
29
|
+
function m(e) {
|
|
30
|
+
let t = e((e) => e.document_cursor_resource_usage?.());
|
|
31
|
+
return t ? r(t) : void 0;
|
|
32
|
+
}
|
|
33
|
+
var h = Math.max(i, n), g = class {
|
|
34
|
+
archive;
|
|
35
|
+
coordinator = new o();
|
|
36
|
+
host = null;
|
|
37
|
+
identity = null;
|
|
38
|
+
executeArchive;
|
|
39
|
+
constructor(e, t = (e) => e(this.requireArchive())) {
|
|
40
|
+
this.archive = e, this.executeArchive = (e) => p(() => t(e));
|
|
41
|
+
}
|
|
42
|
+
open(e) {
|
|
43
|
+
if (this.host) throw Error("a DOCX document pull session is already active");
|
|
44
|
+
this.executeArchive((t) => {
|
|
45
|
+
t.open_document_cursor(e.operationId, e.generation);
|
|
46
|
+
});
|
|
47
|
+
let n = 0;
|
|
48
|
+
this.identity = e, this.host = new t({
|
|
49
|
+
...e,
|
|
50
|
+
maxByteCredit: h,
|
|
51
|
+
coordinator: this.coordinator,
|
|
52
|
+
driver: {
|
|
53
|
+
pull: (t) => {
|
|
54
|
+
let r;
|
|
55
|
+
try {
|
|
56
|
+
r = this.executeArchive((r) => r.pull_document_chunk(n, e.operationId, e.generation, t));
|
|
57
|
+
} catch (e) {
|
|
58
|
+
throw a(e, t, h) || e;
|
|
59
|
+
}
|
|
60
|
+
let i = l(r);
|
|
61
|
+
return {
|
|
62
|
+
payload: i,
|
|
63
|
+
byteLength: i.byteLength,
|
|
64
|
+
done: this.executeArchive((e) => e.document_chunk_done()),
|
|
65
|
+
transfer: [i]
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
measureChunk: ({ payload: e }) => e.byteLength,
|
|
69
|
+
acknowledge: (t) => {
|
|
70
|
+
if (t !== n) throw Error("DOCX document acknowledgement sequence mismatch");
|
|
71
|
+
this.executeArchive((t) => t.acknowledge_document_chunk(n, e.operationId, e.generation)), n += 1;
|
|
72
|
+
},
|
|
73
|
+
cancel: () => this.executeArchive((e) => e.cancel_document_cursor()),
|
|
74
|
+
close: () => this.executeArchive((e) => e.close_document_session()),
|
|
75
|
+
resourceUsage: () => m(this.executeArchive)
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
dispatch(e, t) {
|
|
80
|
+
return !this.host || !this.identity ? (t({
|
|
81
|
+
protocol: s,
|
|
82
|
+
kind: "error",
|
|
83
|
+
sessionId: e.sessionId,
|
|
84
|
+
operationId: e.operationId,
|
|
85
|
+
generation: e.generation,
|
|
86
|
+
requestId: e.requestId,
|
|
87
|
+
error: c(/* @__PURE__ */ Error("DOCX document pull session is not open"))
|
|
88
|
+
}), Promise.resolve()) : this.host.dispatch(e, t);
|
|
89
|
+
}
|
|
90
|
+
async reset() {
|
|
91
|
+
if (this.host) try {
|
|
92
|
+
this.archive() && this.executeArchive((e) => e.close_document_session());
|
|
93
|
+
} finally {
|
|
94
|
+
this.host = null, this.identity = null, this.coordinator = new o();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
requireArchive() {
|
|
98
|
+
let e = this.archive();
|
|
99
|
+
if (!e) throw Error("No docx loaded");
|
|
100
|
+
return e;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
//#endregion
|
|
104
|
+
export { m as n, f as r, g as t };
|
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
import { t as e } from "./chunk-Dy4uBu1J.js";
|
|
2
|
+
import { eo as t } from "./plot-area-frame-CaJFvZ7p.js";
|
|
3
|
+
import { F as n, G as r, H as i, L as a, N as o, W as s, cn as c, pt as l, ut as u } from "./bounded-raw-part-cache-B7JoC1CD.js";
|
|
4
|
+
import { a as d, c as f, g as p, i as m, l as h, r as g } from "./document-pull-client-CxONDGbk.js";
|
|
5
|
+
import { n as _, t as ee } from "./abort-VrnK7mdP.js";
|
|
6
|
+
import { n as v, r as te, t as y } from "./wasm-loader-rlgHmcSv.js";
|
|
7
|
+
import { t as b } from "./wasm-runtime-generation-DX4y0Ecl.js";
|
|
8
|
+
import { t as x } from "./in-process-pull-transport-DuXcPZng.js";
|
|
9
|
+
import { n as S, r as ne, t as re } from "./document-pull-worker-AMyXYpPq.js";
|
|
10
|
+
import { a as ie } from "./render-CJVglUHl.js";
|
|
11
|
+
//#region packages/docx/src/wasm/docx_parser.js
|
|
12
|
+
var C = /* @__PURE__ */ e({
|
|
13
|
+
DocxArchive: () => w,
|
|
14
|
+
default: () => q,
|
|
15
|
+
docx_to_markdown: () => T,
|
|
16
|
+
extract_image: () => ae,
|
|
17
|
+
initSync: () => se,
|
|
18
|
+
parse_docx: () => E,
|
|
19
|
+
reinit: () => ce
|
|
20
|
+
}), w = class {
|
|
21
|
+
__destroy_into_raw() {
|
|
22
|
+
let e = this.__wbg_ptr;
|
|
23
|
+
return this.__wbg_ptr = 0, O.unregister(this), e;
|
|
24
|
+
}
|
|
25
|
+
free() {
|
|
26
|
+
let e = this.__destroy_into_raw();
|
|
27
|
+
W.__wbg_docxarchive_free(e, 0);
|
|
28
|
+
}
|
|
29
|
+
acknowledge_document_chunk(e, t, n) {
|
|
30
|
+
let r = W.docxarchive_acknowledge_document_chunk(this.__wbg_ptr, e, t, n);
|
|
31
|
+
if (r[1]) throw R(r[0]);
|
|
32
|
+
}
|
|
33
|
+
assert_healthy() {
|
|
34
|
+
let e = W.docxarchive_assert_healthy(this.__wbg_ptr);
|
|
35
|
+
if (e[1]) throw R(e[0]);
|
|
36
|
+
}
|
|
37
|
+
cancel_document_cursor() {
|
|
38
|
+
W.docxarchive_cancel_document_cursor(this.__wbg_ptr);
|
|
39
|
+
}
|
|
40
|
+
close_document_session() {
|
|
41
|
+
W.docxarchive_close_document_session(this.__wbg_ptr);
|
|
42
|
+
}
|
|
43
|
+
document_chunk_done() {
|
|
44
|
+
let e = W.docxarchive_document_chunk_done(this.__wbg_ptr);
|
|
45
|
+
if (e[2]) throw R(e[1]);
|
|
46
|
+
return e[0] !== 0;
|
|
47
|
+
}
|
|
48
|
+
document_cursor_resource_usage() {
|
|
49
|
+
let e = W.docxarchive_document_cursor_resource_usage(this.__wbg_ptr);
|
|
50
|
+
if (e[3]) throw R(e[2]);
|
|
51
|
+
let t;
|
|
52
|
+
return e[0] !== 0 && (t = k(e[0], e[1]).slice(), W.__wbindgen_free(e[0], e[1] * 1, 1)), t;
|
|
53
|
+
}
|
|
54
|
+
extract_image(e) {
|
|
55
|
+
let t = L(e, W.__wbindgen_malloc, W.__wbindgen_realloc), n = U, r = W.docxarchive_extract_image(this.__wbg_ptr, t, n);
|
|
56
|
+
if (r[3]) throw R(r[2]);
|
|
57
|
+
var i = k(r[0], r[1]).slice();
|
|
58
|
+
return W.__wbindgen_free(r[0], r[1] * 1, 1), i;
|
|
59
|
+
}
|
|
60
|
+
constructor(e, t, n, r) {
|
|
61
|
+
let i = I(e, W.__wbindgen_malloc), a = U, o = W.docxarchive_new(i, a, !F(t), F(t) ? BigInt(0) : t, !F(n), F(n) ? BigInt(0) : n, !F(r), F(r) ? BigInt(0) : r);
|
|
62
|
+
if (o[2]) throw R(o[1]);
|
|
63
|
+
return this.__wbg_ptr = o[0] >>> 0, O.register(this, this.__wbg_ptr, this), this;
|
|
64
|
+
}
|
|
65
|
+
open_document_cursor(e, t) {
|
|
66
|
+
let n = W.docxarchive_open_document_cursor(this.__wbg_ptr, e, t);
|
|
67
|
+
if (n[1]) throw R(n[0]);
|
|
68
|
+
}
|
|
69
|
+
parse() {
|
|
70
|
+
let e = W.docxarchive_parse(this.__wbg_ptr);
|
|
71
|
+
if (e[3]) throw R(e[2]);
|
|
72
|
+
var t = k(e[0], e[1]).slice();
|
|
73
|
+
return W.__wbindgen_free(e[0], e[1] * 1, 1), t;
|
|
74
|
+
}
|
|
75
|
+
pull_document_chunk(e, t, n, r) {
|
|
76
|
+
let i = W.docxarchive_pull_document_chunk(this.__wbg_ptr, e, t, n, r);
|
|
77
|
+
if (i[3]) throw R(i[2]);
|
|
78
|
+
var a = k(i[0], i[1]).slice();
|
|
79
|
+
return W.__wbindgen_free(i[0], i[1] * 1, 1), a;
|
|
80
|
+
}
|
|
81
|
+
resource_usage() {
|
|
82
|
+
let e = W.docxarchive_resource_usage(this.__wbg_ptr);
|
|
83
|
+
if (e[3]) throw R(e[2]);
|
|
84
|
+
var t = k(e[0], e[1]).slice();
|
|
85
|
+
return W.__wbindgen_free(e[0], e[1] * 1, 1), t;
|
|
86
|
+
}
|
|
87
|
+
to_markdown() {
|
|
88
|
+
let e, t;
|
|
89
|
+
try {
|
|
90
|
+
let i = W.docxarchive_to_markdown(this.__wbg_ptr);
|
|
91
|
+
var n = i[0], r = i[1];
|
|
92
|
+
if (i[3]) throw n = 0, r = 0, R(i[2]);
|
|
93
|
+
return e = n, t = r, M(n, r);
|
|
94
|
+
} finally {
|
|
95
|
+
W.__wbindgen_free(e, t, 1);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
Symbol.dispose && (w.prototype[Symbol.dispose] = w.prototype.free);
|
|
100
|
+
function T(e, t, n) {
|
|
101
|
+
let r, i;
|
|
102
|
+
try {
|
|
103
|
+
let s = I(e, W.__wbindgen_malloc), c = U, l = W.docx_to_markdown(s, c, !F(t), F(t) ? BigInt(0) : t, !F(n), F(n) ? BigInt(0) : n);
|
|
104
|
+
var a = l[0], o = l[1];
|
|
105
|
+
if (l[3]) throw a = 0, o = 0, R(l[2]);
|
|
106
|
+
return r = a, i = o, M(a, o);
|
|
107
|
+
} finally {
|
|
108
|
+
W.__wbindgen_free(r, i, 1);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function ae(e, t, n, r) {
|
|
112
|
+
let i = I(e, W.__wbindgen_malloc), a = U, o = L(t, W.__wbindgen_malloc, W.__wbindgen_realloc), s = U, c = W.extract_image(i, a, o, s, !F(n), F(n) ? BigInt(0) : n, !F(r), F(r) ? BigInt(0) : r);
|
|
113
|
+
if (c[3]) throw R(c[2]);
|
|
114
|
+
var l = k(c[0], c[1]).slice();
|
|
115
|
+
return W.__wbindgen_free(c[0], c[1] * 1, 1), l;
|
|
116
|
+
}
|
|
117
|
+
function E(e, t, n) {
|
|
118
|
+
let r = I(e, W.__wbindgen_malloc), i = U, a = W.parse_docx(r, i, !F(t), F(t) ? BigInt(0) : t, !F(n), F(n) ? BigInt(0) : n);
|
|
119
|
+
if (a[3]) throw R(a[2]);
|
|
120
|
+
var o = k(a[0], a[1]).slice();
|
|
121
|
+
return W.__wbindgen_free(a[0], a[1] * 1, 1), o;
|
|
122
|
+
}
|
|
123
|
+
function D() {
|
|
124
|
+
return {
|
|
125
|
+
__proto__: null,
|
|
126
|
+
"./docx_parser_bg.js": {
|
|
127
|
+
__proto__: null,
|
|
128
|
+
__wbg___wbindgen_throw_6b64449b9b9ed33c: function(e, t) {
|
|
129
|
+
throw Error(M(e, t));
|
|
130
|
+
},
|
|
131
|
+
__wbg_error_a6fa202b58aa1cd3: function(e, t) {
|
|
132
|
+
let n, r;
|
|
133
|
+
try {
|
|
134
|
+
n = e, r = t, console.error(M(e, t));
|
|
135
|
+
} finally {
|
|
136
|
+
W.__wbindgen_free(n, r, 1);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
140
|
+
return /* @__PURE__ */ Error();
|
|
141
|
+
},
|
|
142
|
+
__wbg_stack_3b0d974bbf31e44f: function(e, t) {
|
|
143
|
+
let n = t.stack, r = L(n, W.__wbindgen_malloc, W.__wbindgen_realloc), i = U;
|
|
144
|
+
j().setInt32(e + 4, i, !0), j().setInt32(e + 0, r, !0);
|
|
145
|
+
},
|
|
146
|
+
__wbindgen_cast_0000000000000001: function(e, t) {
|
|
147
|
+
return M(e, t);
|
|
148
|
+
},
|
|
149
|
+
__wbindgen_init_externref_table: function() {
|
|
150
|
+
let e = W.__wbindgen_externrefs, t = e.grow(4);
|
|
151
|
+
e.set(0, void 0), e.set(t + 0, void 0), e.set(t + 1, null), e.set(t + 2, !0), e.set(t + 3, !1);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
var O = typeof FinalizationRegistry > "u" ? {
|
|
157
|
+
register: () => {},
|
|
158
|
+
unregister: () => {}
|
|
159
|
+
} : new FinalizationRegistry((e) => W.__wbg_docxarchive_free(e >>> 0, 1));
|
|
160
|
+
function k(e, t) {
|
|
161
|
+
return e >>>= 0, P().subarray(e / 1, e / 1 + t);
|
|
162
|
+
}
|
|
163
|
+
var A = null;
|
|
164
|
+
function j() {
|
|
165
|
+
return (A === null || A.buffer.detached === !0 || A.buffer.detached === void 0 && A.buffer !== W.memory.buffer) && (A = new DataView(W.memory.buffer)), A;
|
|
166
|
+
}
|
|
167
|
+
function M(e, t) {
|
|
168
|
+
return e >>>= 0, V(e, t);
|
|
169
|
+
}
|
|
170
|
+
var N = null;
|
|
171
|
+
function P() {
|
|
172
|
+
return (N === null || N.byteLength === 0) && (N = new Uint8Array(W.memory.buffer)), N;
|
|
173
|
+
}
|
|
174
|
+
function F(e) {
|
|
175
|
+
return e == null;
|
|
176
|
+
}
|
|
177
|
+
function I(e, t) {
|
|
178
|
+
let n = t(e.length * 1, 1) >>> 0;
|
|
179
|
+
return P().set(e, n / 1), U = e.length, n;
|
|
180
|
+
}
|
|
181
|
+
function L(e, t, n) {
|
|
182
|
+
if (n === void 0) {
|
|
183
|
+
let n = H.encode(e), r = t(n.length, 1) >>> 0;
|
|
184
|
+
return P().subarray(r, r + n.length).set(n), U = n.length, r;
|
|
185
|
+
}
|
|
186
|
+
let r = e.length, i = t(r, 1) >>> 0, a = P(), o = 0;
|
|
187
|
+
for (; o < r; o++) {
|
|
188
|
+
let t = e.charCodeAt(o);
|
|
189
|
+
if (t > 127) break;
|
|
190
|
+
a[i + o] = t;
|
|
191
|
+
}
|
|
192
|
+
if (o !== r) {
|
|
193
|
+
o !== 0 && (e = e.slice(o)), i = n(i, r, r = o + e.length * 3, 1) >>> 0;
|
|
194
|
+
let t = P().subarray(i + o, i + r), a = H.encodeInto(e, t);
|
|
195
|
+
o += a.written, i = n(i, r, o, 1) >>> 0;
|
|
196
|
+
}
|
|
197
|
+
return U = o, i;
|
|
198
|
+
}
|
|
199
|
+
function R(e) {
|
|
200
|
+
let t = W.__wbindgen_externrefs.get(e);
|
|
201
|
+
return W.__externref_table_dealloc(e), t;
|
|
202
|
+
}
|
|
203
|
+
var z = new TextDecoder("utf-8", {
|
|
204
|
+
ignoreBOM: !0,
|
|
205
|
+
fatal: !0
|
|
206
|
+
});
|
|
207
|
+
z.decode();
|
|
208
|
+
var oe = 2146435072, B = 0;
|
|
209
|
+
function V(e, t) {
|
|
210
|
+
return B += t, B >= oe && (z = new TextDecoder("utf-8", {
|
|
211
|
+
ignoreBOM: !0,
|
|
212
|
+
fatal: !0
|
|
213
|
+
}), z.decode(), B = t), z.decode(P().subarray(e, e + t));
|
|
214
|
+
}
|
|
215
|
+
var H = new TextEncoder();
|
|
216
|
+
"encodeInto" in H || (H.encodeInto = function(e, t) {
|
|
217
|
+
let n = H.encode(e);
|
|
218
|
+
return t.set(n), {
|
|
219
|
+
read: e.length,
|
|
220
|
+
written: n.length
|
|
221
|
+
};
|
|
222
|
+
});
|
|
223
|
+
var U = 0, W;
|
|
224
|
+
function G(e, t) {
|
|
225
|
+
return W = e.exports, A = null, N = null, W.__wbindgen_start(), W;
|
|
226
|
+
}
|
|
227
|
+
async function K(e, t) {
|
|
228
|
+
if (typeof Response == "function" && e instanceof Response) {
|
|
229
|
+
if (typeof WebAssembly.instantiateStreaming == "function") try {
|
|
230
|
+
return await WebAssembly.instantiateStreaming(e, t);
|
|
231
|
+
} catch (t) {
|
|
232
|
+
if (e.ok && n(e.type) && e.headers.get("Content-Type") !== "application/wasm") console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", t);
|
|
233
|
+
else throw t;
|
|
234
|
+
}
|
|
235
|
+
let r = await e.arrayBuffer();
|
|
236
|
+
return await WebAssembly.instantiate(r, t);
|
|
237
|
+
} else {
|
|
238
|
+
let n = await WebAssembly.instantiate(e, t);
|
|
239
|
+
return n instanceof WebAssembly.Instance ? {
|
|
240
|
+
instance: n,
|
|
241
|
+
module: e
|
|
242
|
+
} : n;
|
|
243
|
+
}
|
|
244
|
+
function n(e) {
|
|
245
|
+
switch (e) {
|
|
246
|
+
case "basic":
|
|
247
|
+
case "cors":
|
|
248
|
+
case "default": return !0;
|
|
249
|
+
}
|
|
250
|
+
return !1;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
function se(e) {
|
|
254
|
+
if (W !== void 0) return W;
|
|
255
|
+
e !== void 0 && (Object.getPrototypeOf(e) === Object.prototype ? {module: e} = e : console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));
|
|
256
|
+
let t = D();
|
|
257
|
+
return e instanceof WebAssembly.Module || (e = new WebAssembly.Module(e)), G(new WebAssembly.Instance(e, t), e);
|
|
258
|
+
}
|
|
259
|
+
async function q(e) {
|
|
260
|
+
if (W !== void 0) return W;
|
|
261
|
+
e !== void 0 && (Object.getPrototypeOf(e) === Object.prototype ? {module_or_path: e} = e : console.warn("using deprecated parameters for the initialization function; pass a single object instead"));
|
|
262
|
+
let t = D();
|
|
263
|
+
(typeof e == "string" || typeof Request == "function" && e instanceof Request || typeof URL == "function" && e instanceof URL) && (e = fetch(e));
|
|
264
|
+
let { instance: n, module: r } = await K(await e, t);
|
|
265
|
+
return G(n, r);
|
|
266
|
+
}
|
|
267
|
+
async function ce(e) {
|
|
268
|
+
return W = void 0, A = null, N = null, q(e);
|
|
269
|
+
}
|
|
270
|
+
//#endregion
|
|
271
|
+
//#region packages/docx/src/internal/node-acquisition.ts
|
|
272
|
+
var J = "DOCX document session was aborted", le = b(C, "DOCX");
|
|
273
|
+
async function Y(e, t, i, s) {
|
|
274
|
+
let c = n(i), l = new o({
|
|
275
|
+
enabled: c.debug || c.onResourceMetrics !== void 0,
|
|
276
|
+
format: "docx",
|
|
277
|
+
mode: "node",
|
|
278
|
+
scope: "session",
|
|
279
|
+
policy: c.policy,
|
|
280
|
+
onMetrics: c.onResourceMetrics,
|
|
281
|
+
emitToConsole: c.debug
|
|
282
|
+
});
|
|
283
|
+
l.setSourceBytes(e.byteLength);
|
|
284
|
+
let u, d, f;
|
|
285
|
+
try {
|
|
286
|
+
_(i.signal, J);
|
|
287
|
+
let [n, r, o] = a(c.policy), p = w;
|
|
288
|
+
u = await le(t).open(() => new p(e, n, r, o), {
|
|
289
|
+
signal: i.signal,
|
|
290
|
+
abortError: () => ee(J),
|
|
291
|
+
disposeOnAbort: (e) => e.free()
|
|
292
|
+
}), _(i.signal, J);
|
|
293
|
+
let m = u.proxy;
|
|
294
|
+
l.checkpoint("container ready"), d = new re(() => m);
|
|
295
|
+
let h = {
|
|
296
|
+
sessionId: 1,
|
|
297
|
+
operationId: 1,
|
|
298
|
+
generation: 1
|
|
299
|
+
};
|
|
300
|
+
d.open(h), f = new x((e, t) => d?.dispatch(e, t), () => void 0);
|
|
301
|
+
let g, v = await s(f, h, {
|
|
302
|
+
signal: i.signal,
|
|
303
|
+
onUsage: (e) => {
|
|
304
|
+
g = e, l.observeUsage(e);
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
return g ??= S((e) => e(m)), l.observeUsage(g), l.checkpoint("model streamed"), await d.reset(), f.terminate(), {
|
|
308
|
+
archive: m,
|
|
309
|
+
result: v,
|
|
310
|
+
usage: g,
|
|
311
|
+
metrics: l,
|
|
312
|
+
closeArchive: () => u?.close((e) => e.free())
|
|
313
|
+
};
|
|
314
|
+
} catch (e) {
|
|
315
|
+
await d?.reset().catch(() => void 0), f?.terminate();
|
|
316
|
+
try {
|
|
317
|
+
u?.close((e) => e.free());
|
|
318
|
+
} catch {}
|
|
319
|
+
let t = r(e) ?? ne(e);
|
|
320
|
+
throw l.fail(t), t;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
//#endregion
|
|
324
|
+
//#region packages/node/src/docx.ts
|
|
325
|
+
var X = "DOCX document session was aborted", Z = y(() => v(import.meta.url, "docx_parser_bg.wasm", "@silurus/ooxml-docx/wasm-binary"));
|
|
326
|
+
async function ue(e, t) {
|
|
327
|
+
if (!t?.factory) throw TypeError("openDocxDocument requires a canvas factory");
|
|
328
|
+
if (t.legacyDoc !== void 0) {
|
|
329
|
+
let { openDocxSource: n } = await import("./docx-model-source-CdrSt3hF.js");
|
|
330
|
+
return n(e, t, Z);
|
|
331
|
+
}
|
|
332
|
+
let n = c(t.cjkFallback), r = await Y($(e), Z(), t, (e, t, n) => g(e, t, n));
|
|
333
|
+
try {
|
|
334
|
+
_(t.signal, X);
|
|
335
|
+
let e = t.factory.createCanvas(1, 1), i = h(r.result, {
|
|
336
|
+
cjkFallback: n,
|
|
337
|
+
measureContext: e.getContext("2d"),
|
|
338
|
+
allowFootnoteContinuation: t.allowFootnoteContinuation !== !1
|
|
339
|
+
}), a = fe(t.currentDate), o = d(r.result, i, a).layoutVariants.defaultLayout, s = new Q(r.closeArchive, r.archive, r.result, i, o, t.factory, a, r.usage, r.metrics, t.signal);
|
|
340
|
+
return r.metrics.observeUsage(s.resourceUsage), r.metrics.checkpoint("pagination ready"), s;
|
|
341
|
+
} catch (e) {
|
|
342
|
+
try {
|
|
343
|
+
r.closeArchive();
|
|
344
|
+
} catch {}
|
|
345
|
+
let t = s(e) ?? e;
|
|
346
|
+
throw r.metrics.fail(t), t;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
async function de(e, t = {}) {
|
|
350
|
+
if (t.legacyDoc !== void 0) {
|
|
351
|
+
let { materializeDocxSource: n } = await import("./docx-model-source-CdrSt3hF.js");
|
|
352
|
+
return n(e, t, Z);
|
|
353
|
+
}
|
|
354
|
+
return te(async () => {
|
|
355
|
+
let n = await Y($(e), Z(), t, (e, t, n) => m(e, t, n)), r = !1;
|
|
356
|
+
return {
|
|
357
|
+
acquired: n,
|
|
358
|
+
markSucceeded: () => {
|
|
359
|
+
r = !0;
|
|
360
|
+
},
|
|
361
|
+
close: async () => {
|
|
362
|
+
try {
|
|
363
|
+
n.closeArchive(), r && n.metrics.succeed({ documents: 1 });
|
|
364
|
+
} catch (e) {
|
|
365
|
+
throw n.metrics.fail(e), e;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
}, async ({ acquired: e, markSucceeded: t }) => {
|
|
370
|
+
try {
|
|
371
|
+
let n = p(e.result);
|
|
372
|
+
return e.metrics.checkpoint("document materialized", e.usage), t(), n;
|
|
373
|
+
} catch (t) {
|
|
374
|
+
throw e.metrics.fail(t), t;
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
var Q = class {
|
|
379
|
+
closeArchive;
|
|
380
|
+
archive;
|
|
381
|
+
factory;
|
|
382
|
+
defaultCurrentDateMs;
|
|
383
|
+
metrics;
|
|
384
|
+
signal;
|
|
385
|
+
pageCount;
|
|
386
|
+
sizes;
|
|
387
|
+
lastResourceUsage;
|
|
388
|
+
state;
|
|
389
|
+
renderTail = Promise.resolve();
|
|
390
|
+
pagesStarted = !1;
|
|
391
|
+
closed = !1;
|
|
392
|
+
closePromise;
|
|
393
|
+
resourceFailure = null;
|
|
394
|
+
fetchImage = async (e, t) => {
|
|
395
|
+
let n = this.archive.extract_image(e);
|
|
396
|
+
return new Blob([n], { type: t });
|
|
397
|
+
};
|
|
398
|
+
constructor(e, t, n, r, i, a, o, s, c, l) {
|
|
399
|
+
this.closeArchive = e, this.archive = t, this.factory = a, this.defaultCurrentDateMs = o, this.metrics = c, this.signal = l, this.state = {
|
|
400
|
+
source: n,
|
|
401
|
+
services: r
|
|
402
|
+
}, this.pageCount = i.pages.length, this.lastResourceUsage = s, this.sizes = Object.freeze(i.pages.map((e) => Object.freeze({
|
|
403
|
+
widthPt: e.geometry.widthPt,
|
|
404
|
+
heightPt: e.geometry.heightPt
|
|
405
|
+
})));
|
|
406
|
+
}
|
|
407
|
+
get resourceUsage() {
|
|
408
|
+
return this.closed ? this.lastResourceUsage : this.refreshResourceUsage();
|
|
409
|
+
}
|
|
410
|
+
refreshResourceUsage() {
|
|
411
|
+
try {
|
|
412
|
+
this.lastResourceUsage = i(this.archive.resource_usage()), this.metrics.observeUsage(this.lastResourceUsage);
|
|
413
|
+
} catch {}
|
|
414
|
+
return this.lastResourceUsage;
|
|
415
|
+
}
|
|
416
|
+
pageSize(e) {
|
|
417
|
+
let t = this.sizes[e];
|
|
418
|
+
if (!t) throw RangeError(`DOCX page index ${e} out of range`);
|
|
419
|
+
return t;
|
|
420
|
+
}
|
|
421
|
+
[Symbol.asyncIterator]() {
|
|
422
|
+
return this.pages();
|
|
423
|
+
}
|
|
424
|
+
renderPage(e, n = {}) {
|
|
425
|
+
return this.closed ? Promise.reject(/* @__PURE__ */ Error("DOCX document session is closed")) : this.resourceFailure ? Promise.reject(this.resourceFailure) : (this.pageSize(e), this.enqueueRender(async () => {
|
|
426
|
+
_(this.signal, X);
|
|
427
|
+
let t = this.requireState(), r = this.factory.createCanvas(1, 1);
|
|
428
|
+
return await ie(this.factory, () => f(t.source, r, e, {
|
|
429
|
+
...n,
|
|
430
|
+
currentDate: this.defaultCurrentDateMs,
|
|
431
|
+
defaultCurrentDateMs: this.defaultCurrentDateMs,
|
|
432
|
+
layoutServices: t.services,
|
|
433
|
+
fetchImage: this.fetchImage
|
|
434
|
+
})), _(this.signal, X), r;
|
|
435
|
+
}).catch((e) => {
|
|
436
|
+
let n = s(e) ?? e;
|
|
437
|
+
throw n instanceof t && (this.resourceFailure ??= n), this.metrics.fail(n), n;
|
|
438
|
+
}));
|
|
439
|
+
}
|
|
440
|
+
async *pages(e = {}) {
|
|
441
|
+
if (this.closed) throw Error("DOCX document session is closed");
|
|
442
|
+
if (this.pagesStarted) throw Error("DOCX page stream is one-pass and was already consumed");
|
|
443
|
+
this.pagesStarted = !0;
|
|
444
|
+
let t;
|
|
445
|
+
try {
|
|
446
|
+
for (let t = 0; t < this.pageCount; t += 1) {
|
|
447
|
+
let n = await this.renderPage(t, e), r = this.pageSize(t);
|
|
448
|
+
yield {
|
|
449
|
+
pageIndex: t,
|
|
450
|
+
...r,
|
|
451
|
+
canvas: n
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
} catch (e) {
|
|
455
|
+
throw t = s(e) ?? e, t;
|
|
456
|
+
} finally {
|
|
457
|
+
try {
|
|
458
|
+
await this.close();
|
|
459
|
+
} catch (e) {
|
|
460
|
+
if (t === void 0) throw e;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
close() {
|
|
465
|
+
return this.closePromise ? this.closePromise : (this.refreshResourceUsage(), this.closed = !0, this.closePromise = this.release(), this.closePromise);
|
|
466
|
+
}
|
|
467
|
+
enqueueRender(e) {
|
|
468
|
+
let t = this.renderTail.then(e, e);
|
|
469
|
+
return this.renderTail = t.then(() => void 0, () => void 0), t;
|
|
470
|
+
}
|
|
471
|
+
async release() {
|
|
472
|
+
await this.renderTail, l(this.fetchImage), u(this.fetchImage), this.state = null;
|
|
473
|
+
try {
|
|
474
|
+
this.closeArchive();
|
|
475
|
+
} catch (e) {
|
|
476
|
+
let t = s(e) ?? e;
|
|
477
|
+
throw this.metrics.fail(t), t;
|
|
478
|
+
}
|
|
479
|
+
this.metrics.checkpoint("document session closed", this.lastResourceUsage), this.metrics.succeed({ pages: this.pageCount });
|
|
480
|
+
}
|
|
481
|
+
requireState() {
|
|
482
|
+
if (!this.state) throw Error("DOCX document session is closed");
|
|
483
|
+
return this.state;
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
function fe(e) {
|
|
487
|
+
let t = e instanceof Date ? e.getTime() : e ?? Date.now();
|
|
488
|
+
if (!Number.isFinite(t)) throw RangeError("currentDate must resolve to finite epoch milliseconds");
|
|
489
|
+
return t;
|
|
490
|
+
}
|
|
491
|
+
function $(e) {
|
|
492
|
+
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
493
|
+
}
|
|
494
|
+
//#endregion
|
|
495
|
+
export { Y as i, de as n, ue as r, Q as t };
|