@silurus/ooxml 0.86.0 → 0.87.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 (67) hide show
  1. package/README.md +42 -2
  2. package/dist/assets/render-worker-CeK_iqK3.js +10 -0
  3. package/dist/assets/render-worker-DusrDhPk.js +11 -0
  4. package/dist/assets/render-worker-n2ZG0lrQ.js +31 -0
  5. package/dist/bounded-raw-part-cache-Cg1BsSZQ.js +119 -0
  6. package/dist/{canvas-viewer-mechanics-B3A7KLLi.js → canvas-viewer-mechanics-Cpk0YFvM.js} +301 -155
  7. package/dist/chart-ex.mjs +1 -1
  8. package/dist/cjk-fallback-bLI3z70h.js +46 -0
  9. package/dist/{comment-ui-runtime-ssI6IE39.js → comment-ui-runtime-BfE7MJZn.js} +4 -4
  10. package/dist/comment-ui-runtime-BsK8pmUT.js +2 -0
  11. package/dist/{comment-ui-runtime-DEtgcmj7.js → comment-ui-runtime-DcJOYlw-.js} +5 -5
  12. package/dist/{comments-CAn2A_Xh.js → comments-Diid5ujN.js} +1 -1
  13. package/dist/{document-pull-client-xZrA2IjM.js → document-pull-client-yKxI8aDH.js} +4326 -4238
  14. package/dist/{docx-DzDiGvqe.js → docx-BkSRiy07.js} +541 -349
  15. package/dist/docx.mjs +7 -7
  16. package/dist/docx_parser_bg.wasm +0 -0
  17. package/dist/{dom-interaction-boundary-DK1JLkrz.js → dom-interaction-boundary-CBUQJsIM.js} +63 -57
  18. package/dist/{hyperlink-enyPbflR.js → hyperlink-ArrU3ArU.js} +1014 -951
  19. package/dist/index.mjs +4 -4
  20. package/dist/line-distribute-Dtudnqhs.js +1023 -0
  21. package/dist/math.mjs +2 -2
  22. package/dist/node.mjs +380 -376
  23. package/dist/{pptx-D_U62nl-.js → pptx-62MmVbYB.js} +462 -447
  24. package/dist/pptx.mjs +7 -7
  25. package/dist/pptx_parser_bg.wasm +0 -0
  26. package/dist/region-map.mjs +1 -1
  27. package/dist/{render-DSn0d35X.js → render-8Zo7dnds.js} +31 -29
  28. package/dist/{render-worker-host-CbYDBg7U.js → render-worker-host-BfbnEChF.js} +1 -1
  29. package/dist/{render-worker-host-CO0UYoQh.js → render-worker-host-DNL9dWRh.js} +1 -1
  30. package/dist/{render-worker-host-BHz9vjxB.js → render-worker-host-IkHrYOci.js} +1 -1
  31. package/dist/{resource-measurement-Do07ZRcR.js → resource-measurement-CJsgolre.js} +9 -9
  32. package/dist/{session-C1GYhr6n.js → session-CrU8f8DI.js} +91 -91
  33. package/dist/{slide-pull-client-DuEaUxPw.js → slide-pull-client-B9KA8bU6.js} +1069 -966
  34. package/dist/three-d.mjs +1 -1
  35. package/dist/tiff.mjs +1 -1
  36. package/dist/types/chart-ex.d.ts +2 -2
  37. package/dist/types/docx.d.ts +15 -12
  38. package/dist/types/index.d.ts +23 -18
  39. package/dist/types/math.d.ts +1 -1
  40. package/dist/types/node.d.ts +12 -6
  41. package/dist/types/pptx.d.ts +15 -11
  42. package/dist/types/region-map.d.ts +2 -2
  43. package/dist/types/three-d.d.ts +2 -2
  44. package/dist/types/tiff.d.ts +1 -1
  45. package/dist/types/xlsx.d.ts +15 -11
  46. package/dist/{worksheet-pull-client-eDiHHEG2.js → worksheet-pull-client-eIcQ-xlD.js} +65 -65
  47. package/dist/{xlsx-CMHmYTHP.js → xlsx-CRcSzZNq.js} +1656 -1630
  48. package/dist/xlsx.mjs +4 -4
  49. package/dist/xlsx_parser_bg.wasm +0 -0
  50. package/package.json +1 -1
  51. package/dist/assets/render-worker-BCGnuBLj.js +0 -10
  52. package/dist/assets/render-worker-CB4DxjXg.js +0 -31
  53. package/dist/assets/render-worker-CHW0F0n6.js +0 -11
  54. package/dist/bounded-raw-part-cache-DVx3Camo.js +0 -256
  55. package/dist/comment-ui-runtime-TLHustXJ.js +0 -2
  56. package/dist/line-distribute-BFB575d6.js +0 -1023
  57. /package/dist/{comment-occurrence-Dhdplprg.js → comment-occurrence-C8Y2uoVr.js} +0 -0
  58. /package/dist/{delimited-text-worker-host-DcHj_JZt.js → delimited-text-worker-host-BVY-Ecni.js} +0 -0
  59. /package/dist/{highlight-rect-FuUSmL3a.js → highlight-rect-C5hkRqUr.js} +0 -0
  60. /package/dist/{line-metrics-CBbw80Ko.js → line-metrics-B60C86uh.js} +0 -0
  61. /package/dist/{mathjax-DS69BmJd.js → mathjax-DoyWZbSp.js} +0 -0
  62. /package/dist/{read-only-comment-decoration-BTnWEeo5.js → read-only-comment-decoration-Dz7eTQ4d.js} +0 -0
  63. /package/dist/{read-only-comment-margin-plStyGfE.js → read-only-comment-margin-DkgzASAl.js} +0 -0
  64. /package/dist/{renderer-module-contract-Cu-GKuPd.js → renderer-module-contract-D91rkYHH.js} +0 -0
  65. /package/dist/{source-key-Ktb1GRE5.js → source-key-DIJG8BA0.js} +0 -0
  66. /package/dist/{transfer-mIj7E7NB.js → transfer-p6iCC2R7.js} +0 -0
  67. /package/dist/{visible-index-DPoQYSDt.js → visible-index-BgiHEc1z.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { Tt as e, on as t } from "./hyperlink-enyPbflR.js";
1
+ import { Et as e, ln as t } from "./hyperlink-ArrU3ArU.js";
2
2
  import { i as n, r, s as i } from "./pixel-budget-Dgjw269h.js";
3
3
  //#region packages/core/src/errors/cfb-sniff.ts
4
4
  var a = [
@@ -98,7 +98,7 @@ function C(e, t) {
98
98
  let a = se(n, e.length, r, i, t);
99
99
  if (a === null || a.target === null) return null;
100
100
  let { target: o, root: s } = a;
101
- return o.size === 0 ? new Uint8Array() : o.size < r.miniStreamCutoff ? s === null ? null : le(n, e.length, r, i, s, o) : D(n, e.length, r, i, o.startSector, o.size);
101
+ return o.size === 0 ? new Uint8Array() : o.size < r.miniStreamCutoff ? s === null ? null : ue(n, e.length, r, i, s, o) : le(n, e.length, r, i, o.startSector, o.size);
102
102
  }
103
103
  function ae(e) {
104
104
  let t = e.getUint16(30, !0);
@@ -199,7 +199,7 @@ function ce(e, t) {
199
199
  }
200
200
  return i;
201
201
  }
202
- function D(e, t, n, r, i, a) {
202
+ function le(e, t, n, r, i, a) {
203
203
  let { sectorSize: o } = n, s = new Uint8Array(a), c = 0, l = i, u = /* @__PURE__ */ new Set(), d = 0;
204
204
  for (; T(l) && c < a;) {
205
205
  if (d++ > S || u.has(l)) return null;
@@ -214,8 +214,8 @@ function D(e, t, n, r, i, a) {
214
214
  }
215
215
  return c === a ? s : null;
216
216
  }
217
- function le(e, t, n, r, i, a) {
218
- let { sectorSize: o, miniSectorSize: s } = n, c = D(e, t, n, r, i.startSector, i.size);
217
+ function ue(e, t, n, r, i, a) {
218
+ let { sectorSize: o, miniSectorSize: s } = n, c = le(e, t, n, r, i.startSector, i.size);
219
219
  if (c === null) return null;
220
220
  let l = new Uint8Array(a.size), u = 0, d = a.startSector, f = /* @__PURE__ */ new Set(), p = 0, m = o / 4;
221
221
  for (; T(d) && u < a.size;) {
@@ -225,13 +225,13 @@ function le(e, t, n, r, i, a) {
225
225
  if (i < 0 || i + s > c.length) return null;
226
226
  let o = Math.min(s, a.size - u);
227
227
  l.set(c.subarray(i, i + o), u), u += o;
228
- let h = ue(e, t, n, r, m, d);
228
+ let h = de(e, t, n, r, m, d);
229
229
  if (h === null) return null;
230
230
  d = h;
231
231
  }
232
232
  return u === a.size ? l : null;
233
233
  }
234
- function ue(e, t, n, r, i, a) {
234
+ function de(e, t, n, r, i, a) {
235
235
  let { sectorSize: o } = n, s = Math.floor(a / i), c = a % i, l = n.firstMiniFatSector, u = /* @__PURE__ */ new Set();
236
236
  for (let n = 0; n < s; n++) {
237
237
  if (!T(l) || u.has(l)) return null;
@@ -248,7 +248,7 @@ function ue(e, t, n, r, i, a) {
248
248
  }
249
249
  //#endregion
250
250
  //#region packages/core/src/crypto/encryption-info.ts
251
- function O(e) {
251
+ function D(e) {
252
252
  if (typeof atob == "function") {
253
253
  let t = atob(e), n = new Uint8Array(t.length);
254
254
  for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
@@ -258,19 +258,19 @@ function O(e) {
258
258
  if (t) return new Uint8Array(t.from(e, "base64"));
259
259
  throw Error("no base64 decoder available");
260
260
  }
261
- function k(e, t, n) {
261
+ function O(e, t, n) {
262
262
  let r = RegExp(`<(?:[\\w]+:)?${t}\\b[^>]*>`).exec(e);
263
263
  if (!r) return null;
264
264
  let i = r[0], a = RegExp(`\\b${n}\\s*=\\s*"([^"]*)"`).exec(i);
265
265
  return a ? a[1] : null;
266
266
  }
267
- function A(e) {
267
+ function k(e) {
268
268
  if (e === null) return null;
269
269
  let t = Number(e);
270
270
  return Number.isFinite(t) ? t : null;
271
271
  }
272
- function j(e, t) {
273
- let n = A(k(e, t, "saltSize")), r = A(k(e, t, "blockSize")), i = A(k(e, t, "keyBits")), a = A(k(e, t, "hashSize")), o = k(e, t, "cipherAlgorithm"), s = k(e, t, "cipherChaining"), c = k(e, t, "hashAlgorithm"), l = k(e, t, "saltValue");
272
+ function A(e, t) {
273
+ let n = k(O(e, t, "saltSize")), r = k(O(e, t, "blockSize")), i = k(O(e, t, "keyBits")), a = k(O(e, t, "hashSize")), o = O(e, t, "cipherAlgorithm"), s = O(e, t, "cipherChaining"), c = O(e, t, "hashAlgorithm"), l = O(e, t, "saltValue");
274
274
  return n === null || r === null || i === null || a === null || !o || !s || !c || l === null ? null : {
275
275
  saltSize: n,
276
276
  blockSize: r,
@@ -279,14 +279,14 @@ function j(e, t) {
279
279
  cipherAlgorithm: o,
280
280
  cipherChaining: s,
281
281
  hashAlgorithm: c,
282
- saltValue: O(l)
282
+ saltValue: D(l)
283
283
  };
284
284
  }
285
- function de(e) {
285
+ function fe(e) {
286
286
  if (e.length < 8) return { kind: "unknown" };
287
287
  let t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = t.getUint16(0, !0), r = t.getUint16(2, !0);
288
288
  if (n === 4 && r === 4) {
289
- let t = fe(e.subarray(8));
289
+ let t = pe(e.subarray(8));
290
290
  return t ? {
291
291
  kind: "agile",
292
292
  descriptor: t
@@ -294,21 +294,21 @@ function de(e) {
294
294
  }
295
295
  return r === 16 && (n === 3 || n === 4) ? { kind: "extensible" } : r === 2 && (n === 2 || n === 3 || n === 4) ? { kind: "standard" } : { kind: "unknown" };
296
296
  }
297
- function fe(e) {
298
- let t = new TextDecoder("utf-8").decode(e), n = j(t, "keyData"), r = j(t, "encryptedKey");
297
+ function pe(e) {
298
+ let t = new TextDecoder("utf-8").decode(e), n = A(t, "keyData"), r = A(t, "encryptedKey");
299
299
  if (!n || !r) return null;
300
- let i = A(k(t, "encryptedKey", "spinCount")), a = k(t, "encryptedKey", "encryptedVerifierHashInput"), o = k(t, "encryptedKey", "encryptedVerifierHashValue"), s = k(t, "encryptedKey", "encryptedKeyValue");
300
+ let i = k(O(t, "encryptedKey", "spinCount")), a = O(t, "encryptedKey", "encryptedVerifierHashInput"), o = O(t, "encryptedKey", "encryptedVerifierHashValue"), s = O(t, "encryptedKey", "encryptedKeyValue");
301
301
  if (i === null || a === null || o === null || s === null) return null;
302
302
  let c = {
303
303
  ...r,
304
304
  spinCount: i,
305
- encryptedVerifierHashInput: O(a),
306
- encryptedVerifierHashValue: O(o),
307
- encryptedKeyValue: O(s)
308
- }, l = null, u = k(t, "dataIntegrity", "encryptedHmacKey"), d = k(t, "dataIntegrity", "encryptedHmacValue");
305
+ encryptedVerifierHashInput: D(a),
306
+ encryptedVerifierHashValue: D(o),
307
+ encryptedKeyValue: D(s)
308
+ }, l = null, u = O(t, "dataIntegrity", "encryptedHmacKey"), d = O(t, "dataIntegrity", "encryptedHmacValue");
309
309
  return u !== null && d !== null && (l = {
310
- encryptedHmacKey: O(u),
311
- encryptedHmacValue: O(d)
310
+ encryptedHmacKey: D(u),
311
+ encryptedHmacValue: D(d)
312
312
  }), {
313
313
  keyData: n,
314
314
  passwordKeyEncryptor: c,
@@ -317,7 +317,7 @@ function fe(e) {
317
317
  }
318
318
  //#endregion
319
319
  //#region packages/core/src/crypto/agile.ts
320
- var M = {
320
+ var j = {
321
321
  verifierHashInput: new Uint8Array([
322
322
  254,
323
323
  167,
@@ -368,120 +368,120 @@ var M = {
368
368
  132,
369
369
  51
370
370
  ])
371
- }, pe = 54, N = 4096, P = class extends Error {
371
+ }, me = 54, M = 4096, N = class extends Error {
372
372
  reason;
373
373
  constructor(e, t) {
374
374
  super(t), this.name = "AgileDecryptError", this.reason = e;
375
375
  }
376
376
  };
377
- function F() {
377
+ function P() {
378
378
  let e = globalThis.crypto;
379
- if (!e || !e.subtle) throw new P("unsupported-encryption", "WebCrypto (globalThis.crypto.subtle) is unavailable; cannot decrypt.");
379
+ if (!e || !e.subtle) throw new N("unsupported-encryption", "WebCrypto (globalThis.crypto.subtle) is unavailable; cannot decrypt.");
380
380
  return e.subtle;
381
381
  }
382
- function I(e) {
382
+ function F(e) {
383
383
  switch (e.toUpperCase().replace(/[-_]/g, "")) {
384
384
  case "SHA512": return "SHA-512";
385
385
  case "SHA384": return "SHA-384";
386
386
  case "SHA256": return "SHA-256";
387
387
  case "SHA1": return "SHA-1";
388
- default: throw new P("unsupported-encryption", `Unsupported hashAlgorithm "${e}" (only SHA-1/256/384/512).`);
388
+ default: throw new N("unsupported-encryption", `Unsupported hashAlgorithm "${e}" (only SHA-1/256/384/512).`);
389
389
  }
390
390
  }
391
- function L(e) {
392
- if (e.cipherAlgorithm.toUpperCase() !== "AES") throw new P("unsupported-encryption", `Unsupported cipherAlgorithm "${e.cipherAlgorithm}" (only AES).`);
393
- if (e.cipherChaining.toLowerCase() !== "chainingmodecbc") throw new P("unsupported-encryption", `Unsupported cipherChaining "${e.cipherChaining}" (only ChainingModeCBC).`);
394
- if (e.keyBits !== 128 && e.keyBits !== 192 && e.keyBits !== 256) throw new P("unsupported-encryption", `Unsupported keyBits ${e.keyBits} (only 128/192/256).`);
391
+ function I(e) {
392
+ if (e.cipherAlgorithm.toUpperCase() !== "AES") throw new N("unsupported-encryption", `Unsupported cipherAlgorithm "${e.cipherAlgorithm}" (only AES).`);
393
+ if (e.cipherChaining.toLowerCase() !== "chainingmodecbc") throw new N("unsupported-encryption", `Unsupported cipherChaining "${e.cipherChaining}" (only ChainingModeCBC).`);
394
+ if (e.keyBits !== 128 && e.keyBits !== 192 && e.keyBits !== 256) throw new N("unsupported-encryption", `Unsupported keyBits ${e.keyBits} (only 128/192/256).`);
395
395
  }
396
- function R(...e) {
396
+ function L(...e) {
397
397
  let t = e.reduce((e, t) => e + t.length, 0), n = new Uint8Array(t), r = 0;
398
398
  for (let t of e) n.set(t, r), r += t.length;
399
399
  return n;
400
400
  }
401
- function z(e) {
401
+ function R(e) {
402
402
  let t = new Uint8Array(4);
403
403
  return new DataView(t.buffer).setUint32(0, e >>> 0, !0), t;
404
404
  }
405
- function me(e) {
405
+ function he(e) {
406
406
  let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
407
407
  for (let t = 0; t < e.length; t++) n.setUint16(t * 2, e.charCodeAt(t), !0);
408
408
  return t;
409
409
  }
410
- async function B(e, t) {
411
- return new Uint8Array(await F().digest(e, t));
410
+ async function z(e, t) {
411
+ return new Uint8Array(await P().digest(e, t));
412
412
  }
413
- function V(e, t) {
413
+ function ge(e, t) {
414
414
  if (e.length > t) return e.slice(0, t);
415
415
  let n = new Uint8Array(t);
416
- return n.set(e), e.length < t && n.fill(pe, e.length), n;
416
+ return n.set(e), e.length < t && n.fill(me, e.length), n;
417
417
  }
418
- async function H(e, t, n, r) {
419
- let i = I(t.hashAlgorithm), a = await B(i, R(t.saltValue, me(e)));
420
- for (let e = 0; e < n; e++) a = await B(i, R(z(e), a));
421
- return V(await B(i, R(a, r)), t.keyBits / 8);
418
+ async function B(e, t, n, r) {
419
+ let i = F(t.hashAlgorithm), a = await z(i, L(t.saltValue, he(e)));
420
+ for (let e = 0; e < n; e++) a = await z(i, L(R(e), a));
421
+ return ge(await z(i, L(a, r)), t.keyBits / 8);
422
422
  }
423
- async function U(e, t, n) {
424
- return V(n ? await B(I(e.hashAlgorithm), R(t, n)) : t, e.blockSize);
423
+ async function V(e, t, n) {
424
+ return ge(n ? await z(F(e.hashAlgorithm), L(t, n)) : t, e.blockSize);
425
425
  }
426
- async function W(e, t, n) {
426
+ async function H(e, t, n) {
427
427
  let r = t.length;
428
428
  if (n.length === 0) return new Uint8Array();
429
- if (n.length % r !== 0) throw new P("corrupt", "ciphertext length is not a multiple of the block size");
430
- let i = await F().importKey("raw", e, { name: "AES-CBC" }, !1, ["decrypt"]), a = await F().importKey("raw", e, { name: "AES-CBC" }, !1, ["encrypt"]), o = n.subarray(n.length - r), s = he(new Uint8Array(r).fill(r), o), c = R(n, new Uint8Array(await F().encrypt({
429
+ if (n.length % r !== 0) throw new N("corrupt", "ciphertext length is not a multiple of the block size");
430
+ let i = await P().importKey("raw", e, { name: "AES-CBC" }, !1, ["decrypt"]), a = await P().importKey("raw", e, { name: "AES-CBC" }, !1, ["encrypt"]), o = n.subarray(n.length - r), s = _e(new Uint8Array(r).fill(r), o), c = L(n, new Uint8Array(await P().encrypt({
431
431
  name: "AES-CBC",
432
432
  iv: new Uint8Array(r)
433
- }, a, s)).subarray(0, r)), l = new Uint8Array(await F().decrypt({
433
+ }, a, s)).subarray(0, r)), l = new Uint8Array(await P().decrypt({
434
434
  name: "AES-CBC",
435
435
  iv: t
436
436
  }, i, c));
437
437
  return l.length >= n.length ? l.subarray(0, n.length) : l;
438
438
  }
439
- function he(e, t) {
439
+ function _e(e, t) {
440
440
  let n = new Uint8Array(e.length);
441
441
  for (let r = 0; r < e.length; r++) n[r] = e[r] ^ t[r];
442
442
  return n;
443
443
  }
444
- async function ge(e, t) {
445
- L(t);
446
- let n = I(t.hashAlgorithm), r = await W(await H(e, t, t.spinCount, M.verifierHashInput), await U(t, t.saltValue, null), t.encryptedVerifierHashInput), i = await W(await H(e, t, t.spinCount, M.verifierHashValue), await U(t, t.saltValue, null), t.encryptedVerifierHashValue);
447
- return _e((await B(n, r)).subarray(0, t.hashSize), i.subarray(0, t.hashSize));
444
+ async function ve(e, t) {
445
+ I(t);
446
+ let n = F(t.hashAlgorithm), r = await H(await B(e, t, t.spinCount, j.verifierHashInput), await V(t, t.saltValue, null), t.encryptedVerifierHashInput), i = await H(await B(e, t, t.spinCount, j.verifierHashValue), await V(t, t.saltValue, null), t.encryptedVerifierHashValue);
447
+ return ye((await z(n, r)).subarray(0, t.hashSize), i.subarray(0, t.hashSize));
448
448
  }
449
- function _e(e, t) {
449
+ function ye(e, t) {
450
450
  if (e.length !== t.length) return !1;
451
451
  let n = 0;
452
452
  for (let r = 0; r < e.length; r++) n |= e[r] ^ t[r];
453
453
  return n === 0;
454
454
  }
455
- async function ve(e, t) {
456
- return await W(await H(e, t, t.spinCount, M.keyValue), await U(t, t.saltValue, null), t.encryptedKeyValue);
455
+ async function be(e, t) {
456
+ return await H(await B(e, t, t.spinCount, j.keyValue), await V(t, t.saltValue, null), t.encryptedKeyValue);
457
457
  }
458
- async function ye(e, t, n) {
459
- if (L(t), e.length < 8) throw new P("corrupt", "EncryptedPackage is shorter than its size prefix");
458
+ async function xe(e, t, n) {
459
+ if (I(t), e.length < 8) throw new N("corrupt", "EncryptedPackage is shorter than its size prefix");
460
460
  let r = new DataView(e.buffer, e.byteOffset, e.byteLength), i = Number(r.getBigUint64(0, !0)), a = e.subarray(8);
461
- if (i > a.length) throw new P("corrupt", "EncryptedPackage size prefix exceeds the ciphertext");
461
+ if (i > a.length) throw new N("corrupt", "EncryptedPackage size prefix exceeds the ciphertext");
462
462
  let o = n.slice(0, t.keyBits / 8), s = new Uint8Array(i), c = 0, l = 0;
463
- for (let e = 0; e < a.length; e += N) {
464
- let n = a.subarray(e, e + N), r = await W(o, await U(t, t.saltValue, z(l)), n), u = Math.min(r.length, i - c);
463
+ for (let e = 0; e < a.length; e += M) {
464
+ let n = a.subarray(e, e + M), r = await H(o, await V(t, t.saltValue, R(l)), n), u = Math.min(r.length, i - c);
465
465
  if (s.set(r.subarray(0, u), c), c += u, l++, c >= i) break;
466
466
  }
467
- if (c !== i) throw new P("corrupt", "decrypted output is shorter than the declared size");
467
+ if (c !== i) throw new N("corrupt", "decrypted output is shorter than the declared size");
468
468
  return s;
469
469
  }
470
- async function be(e, t, n) {
470
+ async function Se(e, t, n) {
471
471
  let { keyData: r, passwordKeyEncryptor: i } = e;
472
- if (L(r), L(i), !await ge(n, i)) throw new P("invalid-password", "The supplied password is incorrect.");
473
- return ye(t, r, await ve(n, i));
472
+ if (I(r), I(i), !await ve(n, i)) throw new N("invalid-password", "The supplied password is incorrect.");
473
+ return xe(t, r, await be(n, i));
474
474
  }
475
475
  //#endregion
476
476
  //#region packages/core/src/crypto/decrypt-ooxml.ts
477
- var xe = "EncryptionInfo", Se = "EncryptedPackage";
478
- async function Ce(e, t) {
479
- let n = C(e, xe), r = C(e, Se);
477
+ var Ce = "EncryptionInfo", we = "EncryptedPackage";
478
+ async function Te(e, t) {
479
+ let n = C(e, Ce), r = C(e, we);
480
480
  if (n === null || r === null) return {
481
481
  ok: !1,
482
482
  reason: "corrupt"
483
483
  };
484
- let i = de(n);
484
+ let i = fe(n);
485
485
  if (i.kind !== "agile") return {
486
486
  ok: !1,
487
487
  reason: "unsupported-encryption"
@@ -489,10 +489,10 @@ async function Ce(e, t) {
489
489
  try {
490
490
  return {
491
491
  ok: !0,
492
- data: await be(i.descriptor, r, t)
492
+ data: await Se(i.descriptor, r, t)
493
493
  };
494
494
  } catch (e) {
495
- return e instanceof P ? {
495
+ return e instanceof N ? {
496
496
  ok: !1,
497
497
  reason: e.reason
498
498
  } : {
@@ -503,7 +503,7 @@ async function Ce(e, t) {
503
503
  }
504
504
  //#endregion
505
505
  //#region packages/core/src/errors/cfb-guard.ts
506
- function we(e) {
506
+ function Ee(e) {
507
507
  let n = p(e instanceof Uint8Array ? e : new Uint8Array(e));
508
508
  if (n !== null) switch (n) {
509
509
  case "encrypted": throw new t("encrypted", "This file is password-protected (MS-OFFCRYPTO). Pass LoadOptions.password to decrypt it.");
@@ -512,12 +512,12 @@ function we(e) {
512
512
  default: throw new t("not-ooxml", "This file is an OLE2/Compound File container of an unrecognised kind, not an OOXML (ZIP) document.");
513
513
  }
514
514
  }
515
- async function Te(e, n) {
515
+ async function De(e, n) {
516
516
  let r = e instanceof Uint8Array ? e : new Uint8Array(e), i = p(r);
517
517
  if (i === null) return r;
518
518
  if (i === "encrypted") {
519
519
  if (n === void 0) throw new t("encrypted", "This file is password-protected (MS-OFFCRYPTO). Pass LoadOptions.password to decrypt it.");
520
- let e = await Ce(r, n);
520
+ let e = await Te(r, n);
521
521
  if (e.ok) return e.data;
522
522
  switch (e.reason) {
523
523
  case "invalid-password": throw new t("invalid-password", "The supplied password is incorrect.");
@@ -526,14 +526,160 @@ async function Te(e, n) {
526
526
  default: throw e.reason, new t("not-ooxml", "This encrypted file could not be decrypted.");
527
527
  }
528
528
  }
529
- return we(r), r;
529
+ return Ee(r), r;
530
530
  }
531
- function Ee(e) {
531
+ function Oe(e) {
532
532
  return e.byteOffset === 0 && e.byteLength === e.buffer.byteLength && e.buffer instanceof ArrayBuffer ? e.buffer : e.slice().buffer;
533
533
  }
534
534
  //#endregion
535
+ //#region packages/core/src/fonts/font-registry.ts
536
+ var U = /* @__PURE__ */ new Map();
537
+ function W(e, t, n) {
538
+ let r = U.get(e), i = r?.get(t);
539
+ if (i) return i.refs++, {
540
+ face: i.face,
541
+ isNew: !1
542
+ };
543
+ let a = n(), o = r ?? /* @__PURE__ */ new Map();
544
+ return o.set(t, {
545
+ face: a,
546
+ set: t,
547
+ refs: 1
548
+ }), U.set(e, o), {
549
+ face: a,
550
+ isNew: !0
551
+ };
552
+ }
553
+ function G(e) {
554
+ let t = /* @__PURE__ */ new Set();
555
+ for (let n of e) if (!t.has(n)) {
556
+ t.add(n);
557
+ for (let [e, t] of U) {
558
+ let r = !1;
559
+ for (let [i, a] of t) if (a.face === n) {
560
+ if (r = !0, a.refs--, a.refs <= 0) {
561
+ try {
562
+ a.set.delete(n);
563
+ } catch {}
564
+ t.delete(i), t.size === 0 && U.delete(e);
565
+ }
566
+ break;
567
+ }
568
+ if (r) break;
569
+ }
570
+ }
571
+ }
572
+ //#endregion
573
+ //#region packages/core/src/fonts/preload.ts
574
+ var ke = 15e3;
575
+ function K(e) {
576
+ return Promise.race([e, new Promise((e) => setTimeout(e, ke))]);
577
+ }
578
+ var q = /* @__PURE__ */ new Map();
579
+ function Ae(e, t) {
580
+ let n = [], r = /@font-face\s*\{([^}]*)\}/g, i;
581
+ for (; i = r.exec(e);) {
582
+ let e = i[1], r = (t) => e.match(RegExp(`(?:^|;|\\n)\\s*${t}\\s*:\\s*([^;]+)`, "i"))?.[1].trim(), a = r("font-family"), o = r("src");
583
+ if (!a || !o) continue;
584
+ let s = t ? o.replace(/url\(\s*(?:(['"])(.*?)\1|([^)]*?))\s*\)/gi, (e, n, r, i) => {
585
+ let a = (r ?? i ?? "").trim();
586
+ if (!a) return e;
587
+ try {
588
+ return `url("${new URL(a, t).href}")`;
589
+ } catch {
590
+ return e;
591
+ }
592
+ }) : o, c = {}, l = r("font-style");
593
+ l && (c.style = l);
594
+ let u = r("font-weight");
595
+ u && (c.weight = u);
596
+ let d = r("font-stretch");
597
+ d && (c.stretch = d);
598
+ let f = r("unicode-range");
599
+ f && (c.unicodeRange = f), n.push({
600
+ family: a.replace(/^['"]|['"]$/g, ""),
601
+ src: s,
602
+ descriptors: c
603
+ });
604
+ }
605
+ return n;
606
+ }
607
+ function J() {
608
+ return typeof document < "u" && document && document.fonts ? document.fonts : typeof self < "u" && self && "fonts" in self ? self.fonts : null;
609
+ }
610
+ function je(e, t) {
611
+ let n = t.descriptors;
612
+ return [
613
+ "gfonts",
614
+ e,
615
+ t.family.toLowerCase(),
616
+ n.style ?? "",
617
+ n.weight ?? "",
618
+ n.stretch ?? "",
619
+ n.unicodeRange ?? "",
620
+ t.src
621
+ ].join("|");
622
+ }
623
+ async function Me(e, t, n = J()) {
624
+ let r = n;
625
+ if (!r || typeof FontFace > "u" || typeof fetch > "u") return [];
626
+ let i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set();
627
+ for (let n of e) {
628
+ if (!n) continue;
629
+ let e = n.trim();
630
+ if (!e) continue;
631
+ let r = e.toLowerCase();
632
+ if (i.has(r)) continue;
633
+ i.add(r);
634
+ let c = t[r];
635
+ if (!c) continue;
636
+ let l = c.url;
637
+ o.add(l);
638
+ let u = (c.loadFamily ?? e).toLowerCase();
639
+ a.add(u);
640
+ let d = s.get(l);
641
+ d || (d = /* @__PURE__ */ new Set(), s.set(l, d)), d.add(u);
642
+ }
643
+ if (a.size === 0) return [];
644
+ let l = await K(Promise.all([...o].map(async (e) => {
645
+ let t = q.get(e);
646
+ if (t) return {
647
+ url: e,
648
+ rules: await t
649
+ };
650
+ let n = (async () => {
651
+ try {
652
+ let t = await fetch(e);
653
+ if (!t.ok) throw Error(`HTTP ${t.status}`);
654
+ return Ae(await t.text(), t.url || e);
655
+ } catch {
656
+ q.delete(e);
657
+ for (let t of s.get(e) ?? []) c.add(t);
658
+ return [];
659
+ }
660
+ })();
661
+ return q.set(e, n), {
662
+ url: e,
663
+ rules: await n
664
+ };
665
+ }))), u = [], d = [];
666
+ for (let e of Array.isArray(l) ? l : []) for (let t of e.rules) {
667
+ let { face: n, isNew: i } = W(je(e.url, t), r, () => {
668
+ let e = new FontFace(t.family, t.src, t.descriptors);
669
+ return r.add(e), e;
670
+ });
671
+ u.push(n), i && d.push(n);
672
+ }
673
+ return d.length > 0 && await K(Promise.allSettled(d.map((e) => e.load())).then((e) => (e.forEach((e, t) => {
674
+ e.status === "rejected" && c.add(d[t].family.replace(/['"]/g, "").toLowerCase());
675
+ }), r.ready))), c.size > 0 && console.warn(`[ooxml] failed to preload web font(s): ${[...c].join(", ")}; falling back to system fonts (text may shift or differ).`), u;
676
+ }
677
+ function Ne(e) {
678
+ G(e);
679
+ }
680
+ //#endregion
535
681
  //#region packages/core/src/autoResize.ts
536
- function De(e, t, n = {}) {
682
+ function Pe(e, t, n = {}) {
537
683
  let r = n.pauseWhenHidden ?? !0, i = null, a = 0, o = 0, s = null, c = !1, l = !1, u = () => {
538
684
  if (!l && !(r && typeof document < "u" && document.hidden)) {
539
685
  if (s) {
@@ -570,11 +716,11 @@ function De(e, t, n = {}) {
570
716
  }
571
717
  //#endregion
572
718
  //#region packages/core/src/worker/bridge.ts
573
- function G() {
719
+ function Y() {
574
720
  let e = /* @__PURE__ */ Error("worker request aborted");
575
721
  return e.name = "AbortError", e;
576
722
  }
577
- var Oe = class {
723
+ var Fe = class {
578
724
  _worker;
579
725
  _opts;
580
726
  _pending = /* @__PURE__ */ new Map();
@@ -631,7 +777,7 @@ var Oe = class {
631
777
  return;
632
778
  }
633
779
  if (a?.aborted) {
634
- o("abort"), c(G());
780
+ o("abort"), c(Y());
635
781
  return;
636
782
  }
637
783
  let l, u;
@@ -647,7 +793,7 @@ var Oe = class {
647
793
  e && (this._pending.delete(r), e.onOrphanedResponse && this._orphaned.set(r, e.onOrphanedResponse), e.cleanup(), o("timeout"), e.reject(/* @__PURE__ */ Error(`worker request timed out after ${i}ms`)));
648
794
  }, i)), a && (u = () => {
649
795
  let e = this._pending.get(r);
650
- e && (this._pending.delete(r), e.onOrphanedResponse && this._orphaned.set(r, e.onOrphanedResponse), e.cleanup(), o("abort"), e.reject(G()));
796
+ e && (this._pending.delete(r), e.onOrphanedResponse && this._orphaned.set(r, e.onOrphanedResponse), e.cleanup(), o("abort"), e.reject(Y()));
651
797
  }, a.addEventListener("abort", u));
652
798
  try {
653
799
  this._worker.postMessage(e(r), t);
@@ -688,7 +834,7 @@ var Oe = class {
688
834
  };
689
835
  //#endregion
690
836
  //#region packages/core/src/worker/rejected-load.ts
691
- function ke(e, t) {
837
+ function Ie(e, t) {
692
838
  if (t) try {
693
839
  t();
694
840
  return;
@@ -699,10 +845,10 @@ function ke(e, t) {
699
845
  }
700
846
  //#endregion
701
847
  //#region packages/core/src/worker/svg-decode-bridge.ts
702
- function K(e) {
848
+ function X(e) {
703
849
  return typeof e == "number" && Number.isFinite(e) && e > 0 ? Math.ceil(e) : void 0;
704
850
  }
705
- function q(e, t) {
851
+ function Z(e, t) {
706
852
  if (!Number.isFinite(e) || !Number.isFinite(t) || !(e > 0) || !(t > 0)) throw Error(`invalid SVG raster size: ${e}x${t}`);
707
853
  let i = Math.sqrt(n) / Math.sqrt(e) / Math.sqrt(t), a = Math.min(1, r / e, r / t, i);
708
854
  return {
@@ -710,22 +856,22 @@ function q(e, t) {
710
856
  height: Math.min(r, Math.max(1, Math.floor(t * a)))
711
857
  };
712
858
  }
713
- function Ae(e, t, i, a) {
859
+ function Le(e, t, i, a) {
714
860
  let o = i === void 0 ? 0 : i / e, s = a === void 0 ? 0 : a / t, c = i === void 0 && a === void 0 ? 1 : Math.max(o, s), l = Math.min(r / e, r / t, Math.sqrt(n) / Math.sqrt(e) / Math.sqrt(t));
715
861
  if (!Number.isFinite(c) || !(c > 0) || !Number.isFinite(l) || !(l > 0)) throw Error(`invalid SVG raster scale: ${Math.min(c, l)}`);
716
- return l < c ? q(Math.max(1, Math.floor(e * l)), Math.max(1, Math.floor(t * l))) : i !== void 0 && o >= s ? q(i, Math.max(1, Math.ceil(t * i / e))) : a === void 0 ? q(Math.ceil(e), Math.ceil(t)) : q(Math.max(1, Math.ceil(e * a / t)), a);
862
+ return l < c ? Z(Math.max(1, Math.floor(e * l)), Math.max(1, Math.floor(t * l))) : i !== void 0 && o >= s ? Z(i, Math.max(1, Math.ceil(t * i / e))) : a === void 0 ? Z(Math.ceil(e), Math.ceil(t)) : Z(Math.max(1, Math.ceil(e * a / t)), a);
717
863
  }
718
- async function je(t, r = {}) {
864
+ async function Re(t, r = {}) {
719
865
  if (typeof Image > "u") throw Error("SVG host decode requires HTMLImageElement");
720
866
  let a = URL.createObjectURL(t);
721
867
  try {
722
- let t = new Image(), o = K(r.targetWidthPx), s = K(r.targetHeightPx);
868
+ let t = new Image(), o = X(r.targetWidthPx), s = X(r.targetHeightPx);
723
869
  await new Promise((e, n) => {
724
870
  t.onload = () => {
725
871
  typeof t.decode == "function" ? t.decode().then(e).catch(e) : e();
726
872
  }, t.onerror = () => n(/* @__PURE__ */ Error("SVG host decode failed")), t.src = a;
727
873
  });
728
- let c = Number.isFinite(t.naturalWidth) && t.naturalWidth > 0 && Number.isFinite(t.naturalHeight) && t.naturalHeight > 0, l = Ae(c ? t.naturalWidth : 300, c ? t.naturalHeight : 150, o, s);
874
+ let c = Number.isFinite(t.naturalWidth) && t.naturalWidth > 0 && Number.isFinite(t.naturalHeight) && t.naturalHeight > 0, l = Le(c ? t.naturalWidth : 300, c ? t.naturalHeight : 150, o, s);
729
875
  t.width = l.width, t.height = l.height;
730
876
  let u;
731
877
  if (typeof OffscreenCanvas < "u") {
@@ -746,11 +892,11 @@ async function je(t, r = {}) {
746
892
  URL.revokeObjectURL(a);
747
893
  }
748
894
  }
749
- function Me(e) {
895
+ function ze(e) {
750
896
  return !!e && typeof e == "object" && e.kind === "ooxmlDecodeSvg";
751
897
  }
752
- function Ne(t, n) {
753
- return Me(n) ? (je(new Blob([n.bytes], { type: "image/svg+xml" }), n).then((r) => {
898
+ function Be(t, n) {
899
+ return ze(n) ? (Re(new Blob([n.bytes], { type: "image/svg+xml" }), n).then((r) => {
754
900
  try {
755
901
  t({
756
902
  kind: "ooxmlSvgDecoded",
@@ -772,32 +918,32 @@ function Ne(t, n) {
772
918
  }
773
919
  //#endregion
774
920
  //#region packages/core/src/interaction/zoom.ts
775
- var Pe = 1.1, Fe = 10, Ie = 3, Le = 1;
776
- function Re(e, t) {
921
+ var Ve = 1.1, He = 10, Ue = 3, We = 1;
922
+ function Ge(e, t) {
777
923
  let n;
778
924
  switch (t) {
779
925
  case 1:
780
- n = e / Ie;
926
+ n = e / Ue;
781
927
  break;
782
928
  case 2:
783
- n = e / Le;
929
+ n = e / We;
784
930
  break;
785
931
  default:
786
- n = e / Fe;
932
+ n = e / He;
787
933
  break;
788
934
  }
789
935
  return Math.max(-1, Math.min(1, n));
790
936
  }
791
- function ze(e, t, n = 0) {
792
- return e * Pe ** +-Re(t, n);
937
+ function Ke(e, t, n = 0) {
938
+ return e * Ve ** +-Ge(t, n);
793
939
  }
794
- function Be(e, t, n, r, i) {
940
+ function qe(e, t, n, r, i) {
795
941
  let a = n > 0 ? r / n : 1, o = (e + t) * a - t, s = i.maxScroll > 0 ? i.maxScroll : 0;
796
942
  return o < 0 ? 0 : o > s ? s : o;
797
943
  }
798
944
  //#endregion
799
945
  //#region packages/core/src/interaction/zoomable.ts
800
- var J = Object.freeze([
946
+ var Q = Object.freeze([
801
947
  .25,
802
948
  .33,
803
949
  .5,
@@ -813,22 +959,22 @@ var J = Object.freeze([
813
959
  2.5,
814
960
  3,
815
961
  4
816
- ]), Y = .005;
817
- function Ve(e) {
818
- for (let t of J) if (t > e + Y) return t;
819
- return J[J.length - 1];
962
+ ]), Je = .005;
963
+ function Ye(e) {
964
+ for (let t of Q) if (t > e + Je) return t;
965
+ return Q[Q.length - 1];
820
966
  }
821
- function He(e, t = J[0]) {
822
- for (let t = J.length - 1; t >= 0; t--) {
823
- let n = J[t];
824
- if (n < e - Y) return n;
967
+ function Xe(e, t = Q[0]) {
968
+ for (let t = Q.length - 1; t >= 0; t--) {
969
+ let n = Q[t];
970
+ if (n < e - Je) return n;
825
971
  }
826
- return Math.min(t, J[0]);
972
+ return Math.min(t, Q[0]);
827
973
  }
828
- function Ue(e, t, n) {
974
+ function Ze(e, t, n) {
829
975
  return e < t ? t : e > n ? n : e;
830
976
  }
831
- function We(e, t) {
977
+ function Qe(e, t) {
832
978
  let { contentWidth: n, contentHeight: r, containerWidth: i, containerHeight: a } = e;
833
979
  if (n <= 0 || i <= 0) return 0;
834
980
  let o = i / n;
@@ -839,7 +985,7 @@ function We(e, t) {
839
985
  }
840
986
  //#endregion
841
987
  //#region packages/core/src/search/text-index.ts
842
- function X(e) {
988
+ function $(e) {
843
989
  let t = e.toLowerCase();
844
990
  if (t.length === e.length) return t;
845
991
  let n = "";
@@ -849,17 +995,17 @@ function X(e) {
849
995
  }
850
996
  return n;
851
997
  }
852
- function Ge(e) {
998
+ function $e(e) {
853
999
  let t = Array(e.length), n = 0, r = "";
854
1000
  for (let i = 0; i < e.length; i++) t[i] = n, r += e[i].text, n += e[i].text.length;
855
1001
  return {
856
1002
  text: r,
857
- folded: X(r),
1003
+ folded: $(r),
858
1004
  runStart: t,
859
1005
  runCount: e.length
860
1006
  };
861
1007
  }
862
- function Ke(e, t) {
1008
+ function et(e, t) {
863
1009
  let { runStart: n } = e, r = 0, i = n.length - 1;
864
1010
  for (; r < i;) {
865
1011
  let e = r + i + 1 >> 1;
@@ -867,8 +1013,8 @@ function Ke(e, t) {
867
1013
  }
868
1014
  return r;
869
1015
  }
870
- function qe(e, t, n) {
871
- let { runStart: r, runCount: i, text: a } = e, o = [], s = Ke(e, t), c = t;
1016
+ function tt(e, t, n) {
1017
+ let { runStart: r, runCount: i, text: a } = e, o = [], s = et(e, t), c = t;
872
1018
  for (; c < n && s < i;) {
873
1019
  let e = s + 1 < i ? r[s + 1] : a.length, t = Math.min(n, e), l = c - r[s], u = t - r[s];
874
1020
  u > l && o.push({
@@ -879,31 +1025,31 @@ function qe(e, t, n) {
879
1025
  }
880
1026
  return o;
881
1027
  }
882
- function Je(e, t, n = {}) {
1028
+ function nt(e, t, n = {}) {
883
1029
  if (t.length === 0) return [];
884
- let r = n.caseSensitive ?? !1, i = r ? e.text : e.folded, a = r ? t : X(t), o = [], s = 0, c = 0;
1030
+ let r = n.caseSensitive ?? !1, i = r ? e.text : e.folded, a = r ? t : $(t), o = [], s = 0, c = 0;
885
1031
  for (;;) {
886
1032
  let t = i.indexOf(a, s);
887
1033
  if (t === -1) break;
888
1034
  o.push({
889
1035
  matchIndex: c,
890
- slices: qe(e, t, t + a.length)
1036
+ slices: tt(e, t, t + a.length)
891
1037
  }), c++, s = t + a.length;
892
1038
  }
893
1039
  return o;
894
1040
  }
895
1041
  //#endregion
896
1042
  //#region packages/core/src/search/find-cursor.ts
897
- function Ye(e, t) {
1043
+ function rt(e, t) {
898
1044
  return t <= 0 ? -1 : e < 0 ? 0 : (e + 1) % t;
899
1045
  }
900
- function Xe(e, t) {
1046
+ function it(e, t) {
901
1047
  return t <= 0 ? -1 : e < 0 ? t - 1 : (e - 1 + t) % t;
902
1048
  }
903
1049
  //#endregion
904
1050
  //#region packages/core/src/internal/chart-context.ts
905
- var Z = 65536;
906
- function Ze(e, t) {
1051
+ var at = 65536;
1052
+ function ot(e, t) {
907
1053
  let n = Math.min(e.length, t);
908
1054
  if (n > 0 && n < e.length) {
909
1055
  let t = e.charCodeAt(n - 1), r = e.charCodeAt(n);
@@ -911,19 +1057,19 @@ function Ze(e, t) {
911
1057
  }
912
1058
  return e.slice(0, n);
913
1059
  }
914
- function Qe(e) {
1060
+ function st(e) {
915
1061
  let t = e ?? 16384;
916
1062
  if (!Number.isFinite(t) || t < 0) throw RangeError("maxTextCharacters must be a finite non-negative number.");
917
- return Math.min(Z, Math.floor(t));
1063
+ return Math.min(at, Math.floor(t));
918
1064
  }
919
- function $e(e, t) {
920
- let n = Qe(t), r = [], i = 0, a = !1, o = !1, s = (e, t) => {
1065
+ function ct(e, t) {
1066
+ let n = st(t), r = [], i = 0, a = !1, o = !1, s = (e, t) => {
921
1067
  if (t && o) {
922
1068
  if (i >= n) return a = !0, !1;
923
1069
  r.push("\n"), i++;
924
1070
  }
925
1071
  o = !0;
926
- let s = Ze(e, Math.max(0, n - i));
1072
+ let s = ot(e, Math.max(0, n - i));
927
1073
  return r.push(s), i += s.length, s.length < e.length ? (a = !0, !1) : !0;
928
1074
  };
929
1075
  if (!s(`Chart type: ${e.chartType}`, !0) || e.title !== null && !s(`Title: ${e.title}`, !0)) return {
@@ -965,13 +1111,13 @@ function $e(e, t) {
965
1111
  }
966
1112
  //#endregion
967
1113
  //#region packages/core/src/internal/canvas-viewer-mechanics.ts
968
- var et = 65536, tt = 1024;
969
- function Q(e, t, n) {
1114
+ var lt = 65536, ut = 1024;
1115
+ function dt(e, t, n) {
970
1116
  let r = e ?? t;
971
1117
  if (!Number.isFinite(r) || r < 0) throw RangeError(`${n} must be a finite non-negative number.`);
972
1118
  return Math.min(t, Math.floor(r));
973
1119
  }
974
- function nt(e, t) {
1120
+ function ft(e, t) {
975
1121
  let n = Math.min(e.length, t);
976
1122
  if (n > 0 && n < e.length) {
977
1123
  let t = e.charCodeAt(n - 1), r = e.charCodeAt(n);
@@ -979,7 +1125,7 @@ function nt(e, t) {
979
1125
  }
980
1126
  return e.slice(0, n);
981
1127
  }
982
- function* rt(e) {
1128
+ function* pt(e) {
983
1129
  let t = e.firstChild ?? e.childNodes[0] ?? null;
984
1130
  for (; t;) {
985
1131
  if (t.nodeType === 3 && (yield t), t.firstChild) {
@@ -991,13 +1137,13 @@ function* rt(e) {
991
1137
  t = t.nextSibling;
992
1138
  }
993
1139
  }
994
- function it(e, t, n, r, i) {
1140
+ function mt(e, t, n, r, i) {
995
1141
  for (let a of r) {
996
1142
  let r = !1;
997
1143
  try {
998
1144
  r = a.intersectsNode(n);
999
1145
  } catch {}
1000
- if (r) for (let r of rt(n)) {
1146
+ if (r) for (let r of pt(n)) {
1001
1147
  let n = r.data, o, s;
1002
1148
  if (a.startContainer === r) o = a.startOffset;
1003
1149
  else try {
@@ -1020,7 +1166,7 @@ function it(e, t, n, r, i) {
1020
1166
  }
1021
1167
  return t;
1022
1168
  }
1023
- function at(e, t, n, r = {}) {
1169
+ function ht(e, t, n, r = {}) {
1024
1170
  if (!t || t.isCollapsed || t.rangeCount === 0) return null;
1025
1171
  let i = [...e.matches?.("[data-ooxml-selection-surface]") ? [e] : [], ...e.querySelectorAll("[data-ooxml-selection-surface]")];
1026
1172
  if (i.length === 0) return null;
@@ -1030,7 +1176,7 @@ function at(e, t, n, r = {}) {
1030
1176
  if (!e.contains(r.startContainer) || !e.contains(r.endContainer) || !a(r.startContainer) || !a(r.endContainer)) return null;
1031
1177
  o.push(r);
1032
1178
  }
1033
- let s = Q(r.maxChars, et, "maxTextCharacters"), c = Q(r.maxLocators, tt, "maxRunLocators"), l = [], u = !1, d = s + 2, f = [], p = 0;
1179
+ let s = dt(r.maxChars, lt, "maxTextCharacters"), c = dt(r.maxLocators, ut, "maxRunLocators"), l = [], u = !1, d = s + 2, f = [], p = 0;
1034
1180
  for (let t of e.querySelectorAll("[data-ooxml-selection-run]")) {
1035
1181
  if (!o.some((e) => {
1036
1182
  try {
@@ -1040,12 +1186,12 @@ function at(e, t, n, r = {}) {
1040
1186
  }
1041
1187
  })) continue;
1042
1188
  let e = n(t);
1043
- if (e !== null && (l.length >= c ? u = !0 : l.push(structuredClone(e)), p < d && (p = it(f, p, t, o, d)), u && p >= d)) break;
1189
+ if (e !== null && (l.length >= c ? u = !0 : l.push(structuredClone(e)), p < d && (p = mt(f, p, t, o, d)), u && p >= d)) break;
1044
1190
  }
1045
1191
  if (l.length === 0 && !u) return null;
1046
1192
  let m = f.join("");
1047
1193
  if (m.length === 0) return null;
1048
- let h = nt(m, s), g = m.length > s;
1194
+ let h = ft(m, s), g = m.length > s;
1049
1195
  return {
1050
1196
  text: h,
1051
1197
  locators: l,
@@ -1056,7 +1202,7 @@ function at(e, t, n, r = {}) {
1056
1202
  maxLocators: c
1057
1203
  };
1058
1204
  }
1059
- var ot = class {
1205
+ var gt = class {
1060
1206
  wrapper;
1061
1207
  originalParent;
1062
1208
  originalNextSibling;
@@ -1077,31 +1223,31 @@ var ot = class {
1077
1223
  (this.options.restoreMode ?? "display") === "style-and-bitmap" ? (this.originalStyle === null ? this.canvas.removeAttribute("style") : this.canvas.setAttribute("style", this.originalStyle), this.canvas.width = this.originalWidth, this.canvas.height = this.originalHeight) : this.canvas.style.display = this.originalDisplay, this.wrapper.remove();
1078
1224
  }
1079
1225
  }
1080
- }, st = "position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;user-select:text;-webkit-user-select:text;", ct = "position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;", lt = "position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;";
1081
- function $(e, t) {
1226
+ }, _t = "position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;user-select:text;-webkit-user-select:text;", vt = "position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;", yt = "position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;";
1227
+ function bt(e, t) {
1082
1228
  if (!t) return null;
1083
1229
  let n = (e.ownerDocument ?? document).createElement("div");
1084
- return n.style.cssText = lt, e.appendChild(n), n;
1230
+ return n.style.cssText = yt, e.appendChild(n), n;
1085
1231
  }
1086
- function ut(e, t) {
1232
+ function xt(e, t) {
1087
1233
  if (!e || (e.innerHTML = "", !t || !Number.isFinite(t.x) || !Number.isFinite(t.y) || !Number.isFinite(t.width) || !Number.isFinite(t.height) || t.width <= 0 || t.height <= 0)) return;
1088
1234
  let n = (e.ownerDocument ?? document).createElement("div"), r = Number.isFinite(t.rotation) ? t.rotation ?? 0 : 0;
1089
1235
  n.style.cssText = `position:absolute;left:${t.x * 100}%;top:${t.y * 100}%;width:${t.width * 100}%;height:${t.height * 100}%;box-sizing:border-box;border:2px solid #1a73e8;background:color-mix(in srgb, #1a73e8 6%, transparent);transform:rotate(${r}deg);transform-origin:center;pointer-events:none;`, e.appendChild(n);
1090
1236
  }
1091
- var dt = class {
1237
+ var St = class {
1092
1238
  textLayer;
1093
1239
  highlightLayer;
1094
1240
  elementLayer;
1095
1241
  constructor(e, t, n = !1) {
1096
1242
  let r = e.ownerDocument ?? document;
1097
- this.textLayer = t ? r.createElement("div") : null, this.textLayer && (this.textLayer.style.cssText = st, e.appendChild(this.textLayer)), this.highlightLayer = r.createElement("div"), this.highlightLayer.style.cssText = ct, e.appendChild(this.highlightLayer), this.elementLayer = $(e, n);
1243
+ this.textLayer = t ? r.createElement("div") : null, this.textLayer && (this.textLayer.style.cssText = _t, e.appendChild(this.textLayer)), this.highlightLayer = r.createElement("div"), this.highlightLayer.style.cssText = vt, e.appendChild(this.highlightLayer), this.elementLayer = bt(e, n);
1098
1244
  }
1099
1245
  };
1100
- function ft(e, t, n) {
1246
+ function Ct(e, t, n) {
1101
1247
  if (n && t !== void 0 && t !== n.mode) throw Error(`${e}: opts.mode='${t}' conflicts with the borrowed engine's mode='${n.mode}'. Omit opts.mode when borrowing an engine — the engine owns its render mode.`);
1102
1248
  return n?.mode ?? t ?? "main";
1103
1249
  }
1104
- var pt = class {
1250
+ var wt = class {
1105
1251
  generation = 0;
1106
1252
  resource;
1107
1253
  ownsResource;
@@ -1153,7 +1299,7 @@ var pt = class {
1153
1299
  e.destroy();
1154
1300
  } catch {}
1155
1301
  }
1156
- }, mt = class {
1302
+ }, Tt = class {
1157
1303
  generation = 0;
1158
1304
  destroyed = !1;
1159
1305
  bitmapContext;
@@ -1192,7 +1338,7 @@ var pt = class {
1192
1338
  destroy() {
1193
1339
  this.destroyed || (this.destroyed = !0, this.generation++);
1194
1340
  }
1195
- }, ht = class {
1341
+ }, Et = class {
1196
1342
  closed = !1;
1197
1343
  handled = /* @__PURE__ */ new WeakSet();
1198
1344
  backgroundLifecycleOwners = 0;
@@ -1235,4 +1381,4 @@ var pt = class {
1235
1381
  }
1236
1382
  };
1237
1383
  //#endregion
1238
- export { ke as C, Ee as D, Te as E, Ne as S, De as T, We as _, pt as a, Be as b, ut as c, $e as d, Ye as f, Ue as g, Je as h, mt as i, ft as l, Ge as m, dt as n, $ as o, Xe as p, ht as r, at as s, ot as t, Z as u, Ve as v, Oe as w, ze as x, He as y };
1384
+ export { G as A, Ie as C, Me as D, J as E, De as M, Oe as N, Ne as O, Be as S, Pe as T, Qe as _, wt as a, qe as b, xt as c, ct as d, rt as f, Ze as g, nt as h, Tt as i, W as j, K as k, Ct as l, $e as m, St as n, bt as o, it as p, Et as r, ht as s, gt as t, at as u, Ye as v, Fe as w, Ke as x, Xe as y };