@silurus/ooxml 0.81.0 → 0.82.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.
Files changed (61) hide show
  1. package/README.md +4 -8
  2. package/dist/assets/render-worker-7-Zr7fSw.js +10 -0
  3. package/dist/assets/{render-worker-C2ACcLes.js → render-worker-B5gsW6b5.js} +4 -4
  4. package/dist/assets/{render-worker-DtU8oQZ7.js → render-worker-Dw_wQRIh.js} +1 -1
  5. package/dist/{canvas-viewer-mechanics-CqxKRGCp.js → canvas-viewer-mechanics-CS_qbr6T.js} +1 -1
  6. package/dist/chart-ex.mjs +4 -4
  7. package/dist/comment-occurrence-C34fWs_F.js +6 -0
  8. package/dist/comment-ui-runtime-BAe30Ct9.js +112 -0
  9. package/dist/comment-ui-runtime-BUCj4hWn.js +171 -0
  10. package/dist/comment-ui-runtime-F4a3te6p.js +2 -0
  11. package/dist/comments-Cf9W7r3M.js +241 -0
  12. package/dist/{document-pull-client-Ux4a_ax8.js → document-pull-client-BCgmytqI.js} +2205 -2192
  13. package/dist/{docx-SEyQ4gS-.js → docx-wokGKYfi.js} +674 -249
  14. package/dist/docx.mjs +6 -5
  15. package/dist/docx_parser_bg.wasm +0 -0
  16. package/dist/dom-interaction-boundary-C8F6HO5x.js +119 -0
  17. package/dist/highlight-rect-MaCt0om0.js +13 -0
  18. package/dist/index.mjs +3 -3
  19. package/dist/{line-distribute-BBGvvwLt.js → line-distribute-iXsUCIH-.js} +2 -2
  20. package/dist/{line-metrics-Baz31mML.js → line-metrics-B3syvDn2.js} +52 -52
  21. package/dist/math.mjs +2 -2
  22. package/dist/node.mjs +10 -10
  23. package/dist/{plot-area-frame-Dg1VIpUU.js → plot-area-frame-DHV02PJU.js} +591 -590
  24. package/dist/{pptx-5lQrMvMR.js → pptx-DU8L8I2T.js} +537 -243
  25. package/dist/pptx.mjs +6 -6
  26. package/dist/pptx_parser_bg.wasm +0 -0
  27. package/dist/read-only-comment-decoration-DcFevX_Q.js +96 -0
  28. package/dist/read-only-comment-margin-Dn2y55W6.js +189 -0
  29. package/dist/region-map.mjs +2 -2
  30. package/dist/{render-DEHjijQD.js → render-CenWM4g1.js} +1 -1
  31. package/dist/{render-worker-host-Dg_74V64.js → render-worker-host-BNENN3qP.js} +1 -1
  32. package/dist/{render-worker-host-B1nbV_k7.js → render-worker-host-BmH3kGSj.js} +1 -1
  33. package/dist/{render-worker-host-Bze5M6k5.js → render-worker-host-CmPBviYJ.js} +1 -1
  34. package/dist/{renderer-DuopJE1K.js → renderer-CYr9YTXM.js} +436 -435
  35. package/dist/{resource-measurement-DRLp4nFt.js → resource-measurement-CsW4_eYt.js} +2 -2
  36. package/dist/{session-CNVc3VJ4.js → session-Cky_swUj.js} +3 -3
  37. package/dist/{slide-pull-client-CzutXnGc.js → slide-pull-client-CqTVFb3W.js} +490 -383
  38. package/dist/source-key-BklvnEyQ.js +42 -0
  39. package/dist/{three-d-BYiWCNlz.js → three-d-7MaVzQuZ.js} +48 -47
  40. package/dist/three-d.mjs +324 -323
  41. package/dist/types/chart-ex.d.ts +2 -2
  42. package/dist/types/docx.d.ts +181 -19
  43. package/dist/types/index.d.ts +337 -26
  44. package/dist/types/math.d.ts +1 -1
  45. package/dist/types/node.d.ts +84 -10
  46. package/dist/types/pptx.d.ts +130 -11
  47. package/dist/types/region-map.d.ts +2 -2
  48. package/dist/types/three-d.d.ts +2 -2
  49. package/dist/types/xlsx.d.ts +76 -10
  50. package/dist/units-BzZ0gAxs.js +4 -0
  51. package/dist/{worksheet-pull-client-Cxj3Ej0s.js → worksheet-pull-client-CYtwXP5D.js} +3 -3
  52. package/dist/{xlsx-Bl3TIEVu.js → xlsx-DlV37-0j.js} +429 -218
  53. package/dist/xlsx.mjs +6 -6
  54. package/dist/xlsx_parser_bg.wasm +0 -0
  55. package/package.json +1 -1
  56. package/dist/assets/render-worker-Cx5uR77k.js +0 -10
  57. package/dist/highlight-rect-BqcZMHUE.js +0 -48
  58. /package/dist/{mathjax-DJa-Q93p.js → mathjax-DwIrafQ6.js} +0 -0
  59. /package/dist/{renderer-module-contract-0bO_5SC0.js → renderer-module-contract-DLbb7zY0.js} +0 -0
  60. /package/dist/{transfer-D0U6Uhn4.js → transfer-R6NjgBKD.js} +0 -0
  61. /package/dist/{visible-index-DbDuGMCE.js → visible-index-BFE3PWiY.js} +0 -0
@@ -0,0 +1,241 @@
1
+ import { o as e } from "./source-key-BklvnEyQ.js";
2
+ //#region packages/docx/src/review-id.ts
3
+ function t(e) {
4
+ if (e === void 0) return;
5
+ let t = e.replace(/^[\t\n\r ]+|[\t\n\r ]+$/g, "");
6
+ if (/^[+-]?\d+$/.test(t)) try {
7
+ return BigInt(t).toString();
8
+ } catch {
9
+ return;
10
+ }
11
+ }
12
+ //#endregion
13
+ //#region packages/docx/src/comments.ts
14
+ function n(e) {
15
+ return Object.freeze({
16
+ ...e,
17
+ path: Object.freeze([...e.path])
18
+ });
19
+ }
20
+ function r(e) {
21
+ return Object.freeze({
22
+ source: n(e.source),
23
+ runIndex: e.boundary,
24
+ affinity: e.boundary < e.runCount ? "following" : "preceding"
25
+ });
26
+ }
27
+ function i(e, t) {
28
+ let n = e.runs, r = 0;
29
+ for (let e = 0; e < Math.min(t, n.length); e += 1) n[e]?.type !== "unavailableDrawing" && (r += 1);
30
+ return r;
31
+ }
32
+ function a(e, t, i, a, o = t.boundary) {
33
+ return Object.freeze({
34
+ commentId: e,
35
+ source: n(t.source),
36
+ startRunIndex: t.boundary,
37
+ endRunIndex: o,
38
+ reference: r(i),
39
+ ...a === void 0 ? {} : { geometryFallback: Object.freeze({
40
+ source: n(a.source),
41
+ sourceRunIndex: a.boundary
42
+ }) }
43
+ });
44
+ }
45
+ function o(t, n) {
46
+ let r = t.flatMap(({ paragraph: t, source: r }, a) => {
47
+ let o = i(t, t.runs.length);
48
+ return [...n.get(e(r)) ?? []].sort((e, t) => e - t).map((e) => ({
49
+ paragraphIndex: a,
50
+ source: r,
51
+ boundary: e,
52
+ runCount: o
53
+ }));
54
+ });
55
+ return {
56
+ locations: r,
57
+ paragraphIndices: new Set(r.map(({ paragraphIndex: e }) => e))
58
+ };
59
+ }
60
+ function s(e, t) {
61
+ return e.paragraphIndex - t.paragraphIndex || e.boundary - t.boundary;
62
+ }
63
+ function c(e, t) {
64
+ let n = 0, r = e.length;
65
+ for (; n < r;) {
66
+ let i = n + Math.floor((r - n) / 2);
67
+ s(e[i], t) < 0 ? n = i + 1 : r = i;
68
+ }
69
+ return n;
70
+ }
71
+ function l(e, t) {
72
+ if (t.paragraphIndices.has(e.paragraphIndex)) return;
73
+ let n = c(t.locations, e), i = t.locations[n], a = n > 0 ? t.locations[n - 1] : void 0;
74
+ return r(e).affinity === "following" ? i ?? a : a ?? i;
75
+ }
76
+ function u(e, n, r) {
77
+ let s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set();
78
+ for (let e of n) {
79
+ let n = t(e);
80
+ n === void 0 || c.has(n) || (s.has(n) ? (s.delete(n), c.add(n)) : s.set(n, e));
81
+ }
82
+ let u = /* @__PURE__ */ new Map();
83
+ for (let [n, { paragraph: r, source: a }] of e.entries()) for (let e of r.commentMarks ?? []) {
84
+ let o = t(e.id);
85
+ if (o === void 0) continue;
86
+ let s = u.get(o) ?? {
87
+ starts: [],
88
+ ends: [],
89
+ references: []
90
+ };
91
+ u.set(o, s);
92
+ let c = {
93
+ paragraphIndex: n,
94
+ source: a,
95
+ boundary: i(r, e.runIndex),
96
+ runCount: i(r, r.runs.length)
97
+ };
98
+ e.kind === "rangeStart" ? s.starts.push(c) : e.kind === "rangeEnd" ? s.ends.push(c) : e.kind === "reference" && s.references.push(c);
99
+ }
100
+ let d = [], f = o(e, r);
101
+ for (let [t, n] of u) {
102
+ let r = s.get(t);
103
+ if (r === void 0 || n.references.length !== 1) continue;
104
+ let o = n.references[0];
105
+ if (n.starts.length > 1 || n.ends.length > 1) continue;
106
+ let c = n.starts.length === 1 ? n.starts[0] : void 0, u = n.ends.length === 1 ? n.ends[0] : void 0;
107
+ if (c && u && (c.paragraphIndex < u.paragraphIndex || c.paragraphIndex === u.paragraphIndex && c.boundary <= u.boundary)) {
108
+ let t = l(c.paragraphIndex === u.paragraphIndex && c.boundary === u.boundary ? c : o, f);
109
+ for (let n = c.paragraphIndex; n <= u.paragraphIndex; n += 1) {
110
+ let s = e[n], l = n === c.paragraphIndex ? c.boundary : 0, f = n === u.paragraphIndex ? u.boundary : i(s.paragraph, s.paragraph.runs.length);
111
+ d.push(a(r, {
112
+ paragraphIndex: n,
113
+ source: s.source,
114
+ boundary: l,
115
+ runCount: i(s.paragraph, s.paragraph.runs.length)
116
+ }, o, t, Math.max(l, f)));
117
+ }
118
+ continue;
119
+ }
120
+ let p = c && n.ends.length === 0 ? c : u && n.starts.length === 0 ? u : void 0;
121
+ if (c && u) continue;
122
+ let m = p ?? o, h = l(m, f);
123
+ d.push(a(r, m, o, h));
124
+ }
125
+ return d;
126
+ }
127
+ function d(e, t, n = /* @__PURE__ */ new Map()) {
128
+ let r = new Set(e.map(({ id: e }) => e)), i = /* @__PURE__ */ new Map();
129
+ for (let e of t.blocks.sources) {
130
+ let n = t.blocks.resolve(e);
131
+ if (n.type !== "paragraph") continue;
132
+ let r = `${e.story}\u0000${e.storyInstance}`, a = i.get(r) ?? [];
133
+ i.has(r) || i.set(r, a), a.push({
134
+ paragraph: n,
135
+ source: e
136
+ });
137
+ }
138
+ return [...i.values()].flatMap((e) => u(e, r, n));
139
+ }
140
+ function f(e, t, n = /* @__PURE__ */ new Map()) {
141
+ return (e?.length ?? 0) === 0 ? [] : d(e ?? [], t, n);
142
+ }
143
+ function p(e, t) {
144
+ return e !== void 0 && e.story === t.story && e.storyInstance === t.storyInstance && e.path.length === t.path.length && e.path.every((e, n) => e === t.path[n]);
145
+ }
146
+ function m(e, t) {
147
+ let n = t.filter((t) => t.sourceRunIndex !== void 0 && p(t.source, e.source)), r = n.filter((t) => t.sourceRunIndex >= e.startRunIndex && t.sourceRunIndex < e.endRunIndex);
148
+ if (r.length > 0) return r;
149
+ if (e.startRunIndex === e.endRunIndex && n.length > 0) {
150
+ let t = n.reduce((t, n) => {
151
+ let r = n.sourceRunIndex;
152
+ return r < e.startRunIndex ? t : t === void 0 || r < t ? r : t;
153
+ }, void 0), r = n.reduce((t, n) => {
154
+ let r = n.sourceRunIndex;
155
+ return r >= e.startRunIndex ? t : t === void 0 || r > t ? r : t;
156
+ }, void 0), i = t ?? r;
157
+ if (i !== void 0) return n.filter((e) => e.sourceRunIndex === i);
158
+ }
159
+ let i = t.filter((t) => t.sourceRunIndex !== void 0 && p(t.source, e.reference.source)), a = i.reduce((t, n) => {
160
+ let r = n.sourceRunIndex;
161
+ return r < e.reference.runIndex ? t : t === void 0 || r < t ? r : t;
162
+ }, void 0), o = i.reduce((t, n) => {
163
+ let r = n.sourceRunIndex;
164
+ return r >= e.reference.runIndex ? t : t === void 0 || r > t ? r : t;
165
+ }, void 0), s = e.reference.affinity === "following" ? a ?? o : o ?? a;
166
+ if (s !== void 0) return i.filter((e) => e.sourceRunIndex === s);
167
+ let c = e.geometryFallback;
168
+ return c === void 0 ? [] : t.filter((e) => e.sourceRunIndex === c.sourceRunIndex && p(e.source, c.source));
169
+ }
170
+ function h(e, t) {
171
+ return t.some((t) => t.sourceRunIndex !== void 0 && p(t.source, e.source) && t.sourceRunIndex >= e.startRunIndex && t.sourceRunIndex < e.endRunIndex) ? "range" : t.some((t) => p(t.source, e.source) || p(t.source, e.reference.source)) ? "point" : "fallback";
172
+ }
173
+ function g(e) {
174
+ let t = e.map((e) => {
175
+ let t = e.highlightBounds;
176
+ return {
177
+ x: t?.x ?? e.x,
178
+ y: t?.y ?? e.y,
179
+ width: t?.width ?? e.w,
180
+ height: t?.height ?? e.h,
181
+ ...e.transform ? { transform: e.transform } : {}
182
+ };
183
+ }).filter(({ width: e, height: t }) => e > 0 && t > 0).sort((e, t) => e.y - t.y || e.x - t.x), n = [];
184
+ for (let e of t) {
185
+ let t = n.at(-1);
186
+ if (t && t.y === e.y && t.height === e.height && t.transform === e.transform) {
187
+ let r = Math.min(t.x, e.x), i = Math.max(t.x + t.width, e.x + e.width);
188
+ n[n.length - 1] = Object.freeze({
189
+ ...t,
190
+ x: r,
191
+ width: i - r
192
+ });
193
+ } else n.push(Object.freeze({ ...e }));
194
+ }
195
+ return Object.freeze(n);
196
+ }
197
+ function _(t, n, r, i = {}) {
198
+ let a = new Map(t.map((e) => [e.id, e])), o = t.filter((e) => e.parentId === void 0), s = new Map(o.map((e) => [e.id, e])), c = /* @__PURE__ */ new Map(), l = new Map(o.map((e) => [e.id, e.id]));
199
+ for (let e of t) {
200
+ if (e.parentId === void 0) continue;
201
+ let t = new Set([e.id]), n = e;
202
+ for (; n.parentId !== void 0;) {
203
+ let r = a.get(n.parentId);
204
+ if (!r || t.has(r.id)) {
205
+ n = e;
206
+ break;
207
+ }
208
+ t.add(r.id), n = r;
209
+ }
210
+ if (!s.has(n.id) || n === e) continue;
211
+ l.set(e.id, n.id);
212
+ let r = c.get(n.id) ?? [];
213
+ c.has(n.id) || c.set(n.id, r), r.push(e);
214
+ }
215
+ let u = /* @__PURE__ */ new Set();
216
+ for (let t of r) t.source && u.add(e(t.source));
217
+ let d = /* @__PURE__ */ new Map();
218
+ for (let t of n) {
219
+ let n = l.get(t.commentId);
220
+ if (n === void 0 || !(u.has(e(t.source)) || u.has(e(t.reference.source)) || t.geometryFallback !== void 0 && u.has(e(t.geometryFallback.source)))) continue;
221
+ let i = m(t, r);
222
+ if (i.length === 0) continue;
223
+ let a = d.get(n) ?? [];
224
+ d.has(n) || d.set(n, a), a.push(Object.freeze({
225
+ anchor: t,
226
+ kind: h(t, i),
227
+ rects: g(i)
228
+ }));
229
+ }
230
+ return Object.freeze(o.flatMap((e) => {
231
+ if (i.includeResolved === !1 && e.resolved === !0) return [];
232
+ let t = d.get(e.id);
233
+ return t?.length ? [Object.freeze({
234
+ root: e,
235
+ replies: Object.freeze([...c.get(e.id) ?? []]),
236
+ anchors: Object.freeze([...t])
237
+ })] : [];
238
+ }));
239
+ }
240
+ //#endregion
241
+ export { t as i, m as n, _ as r, f as t };