@silurus/ooxml 0.66.1 → 0.66.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1253,15 +1253,16 @@ function bt(e, t, n) {
1253
1253
  }
1254
1254
  return e;
1255
1255
  }
1256
- if (i.reduce((e, t) => e + t, 0) > 0) return o(i.map((e, t) => Math.max(e, a[t])));
1257
- let s = Array(r).fill(0), c = Array(r).fill(!1), l = (e) => e.widthPt == null ? e.widthPct == null ? null : e.widthPct / 5e3 * t : e.widthPt;
1256
+ let s = e.widthPt != null || e.widthPct != null;
1257
+ if (i.reduce((e, t) => e + t, 0) > 0 && s) return o(i.map((e, t) => Math.max(e, a[t])));
1258
+ let c = Array(r).fill(0), l = Array(r).fill(!1), u = (e) => e.widthPt == null ? e.widthPct == null ? null : e.widthPct / 5e3 * t : e.widthPt;
1258
1259
  for (let t of e.rows) {
1259
1260
  let e = 0;
1260
1261
  for (let n of t.cells) {
1261
1262
  let t = Math.min(Math.max(n.colSpan, 1), r - e);
1262
1263
  if (t === 1) {
1263
- let t = l(n);
1264
- t != null && (t > s[e] && (s[e] = t), c[e] = !0);
1264
+ let t = u(n);
1265
+ t != null && (t > c[e] && (c[e] = t), l[e] = !0);
1265
1266
  }
1266
1267
  e += t;
1267
1268
  }
@@ -1271,14 +1272,14 @@ function bt(e, t, n) {
1271
1272
  for (let n of t.cells) {
1272
1273
  let t = Math.min(Math.max(n.colSpan, 1), r - e);
1273
1274
  if (t > 1) {
1274
- let r = l(n);
1275
+ let r = u(n);
1275
1276
  if (r != null) {
1276
- let n = i.slice(e, e + t), a = n.reduce((e, t) => e + t, 0), o = n.reduce((t, n, r) => t + (c[e + r] ? s[e + r] : n), 0);
1277
+ let n = i.slice(e, e + t), a = n.reduce((e, t) => e + t, 0), o = n.reduce((t, n, r) => t + (l[e + r] ? c[e + r] : n), 0);
1277
1278
  if (r > o) {
1278
- let l = r - o;
1279
+ let s = r - o;
1279
1280
  for (let r = 0; r < t; r++) {
1280
- let o = a > 0 ? n[r] / a : 1 / t, u = c[e + r] ? s[e + r] : i[e + r];
1281
- s[e + r] = u + l * o, c[e + r] = !0;
1281
+ let o = a > 0 ? n[r] / a : 1 / t, u = l[e + r] ? c[e + r] : i[e + r];
1282
+ c[e + r] = u + s * o, l[e + r] = !0;
1282
1283
  }
1283
1284
  }
1284
1285
  }
@@ -1286,7 +1287,7 @@ function bt(e, t, n) {
1286
1287
  e += t;
1287
1288
  }
1288
1289
  }
1289
- return o(s.map((e, t) => Math.max(c[t] ? e : i[t], a[t])));
1290
+ return o(c.map((e, t) => Math.max(l[t] ? e : i[t], a[t])));
1290
1291
  }
1291
1292
  function xt(e, t) {
1292
1293
  return t <= 0 ? !0 : !e.rows[t].cells.some((e) => e.vMerge === !1);
@@ -1830,12 +1831,12 @@ function Gt(e) {
1830
1831
  }), t;
1831
1832
  }
1832
1833
  function Kt(e) {
1833
- let t = [], n = "", r = null;
1834
- for (let i of e) {
1835
- let e = i.charCodeAt(0), a = e >= 48 && e <= 57;
1836
- r === null || a === r ? n += i : (t.push(n), n = i), r = a;
1834
+ let t = (e) => e >= 48 && e <= 57, n = (e) => e === "." || e === "," || e === ":" || e === "/" || e === "\xA0", r = [], i = "", a = null;
1835
+ for (let o = 0; o < e.length; o++) {
1836
+ let s = e[o], c = t(s.charCodeAt(0));
1837
+ !c && a === !0 && n(s) && t(e.charCodeAt(o + 1)) && (c = !0), a === null || c === a ? i += s : (r.push(i), i = s), a = c;
1837
1838
  }
1838
- return n.length > 0 && t.push(n), t.length ? t : [e];
1839
+ return i.length > 0 && r.push(i), r.length ? r : [e];
1839
1840
  }
1840
1841
  function qt(e) {
1841
1842
  let t = [], n = 0;
@@ -2228,14 +2229,14 @@ function cn(e, t, n, r, i, a, o, s = {}, c = /* @__PURE__ */ new Map()) {
2228
2229
  let e = (e) => t.alignment === "distribute" ? "center" : _e(t.alignment, e);
2229
2230
  a.textAlign = "left";
2230
2231
  for (let t = 0; t < n.lines.length; t++) {
2231
- let r = n.lines[t], i = n.lineHeights[t], c = r.reduce((e, t) => e + t.width, 0), l = w(void 0, r.map((e) => e.text).join("")) === "rtl";
2232
- a.direction = l ? "rtl" : "ltr";
2233
- let u = e(l), d = m;
2232
+ let r = n.lines[t], i = n.lineHeights[t], c = r.reduce((e, t) => e + t.width, 0), l = w(void 0, r.map((e) => e.text).join("")) === "rtl", u = e(l), d = m;
2234
2233
  u === "center" ? d = m + Math.max(0, (h - c) / 2) : u === "right" && (d = m + Math.max(0, h - c));
2235
- let f = i / 1.2, p = S + f * .85;
2236
- for (let e of r) {
2237
- let t = e.run.fontSizePt * o;
2238
- a.font = X(e.run.bold ?? !1, e.run.italic ?? !1, t, nn(e.text, e.run), s), a.fillStyle = e.run.color ? `#${e.run.color}` : "#000000", a.fillText(e.text, d, p), d += e.width;
2234
+ let f = i / 1.2, p = S + f * .85, g = ge(r, l);
2235
+ for (let e = 0; e < r.length; e++) {
2236
+ let t = g.order[e], n = r[t];
2237
+ a.direction = g.rtl[t] ? "rtl" : "ltr";
2238
+ let i = n.run.fontSizePt * o;
2239
+ a.font = X(n.run.bold ?? !1, n.run.italic ?? !1, i, nn(n.text, n.run), s), a.fillStyle = n.run.color ? `#${n.run.color}` : "#000000", a.fillText(n.text, d, p), d += n.width;
2239
2240
  }
2240
2241
  S += i;
2241
2242
  }
@@ -2808,7 +2809,7 @@ var dr = class e {
2808
2809
  static async load(t, n = {}) {
2809
2810
  let r = n.mode ?? "main";
2810
2811
  if (r === "worker" && (typeof Worker > "u" || typeof OffscreenCanvas > "u")) throw Error("mode: 'worker' requires Worker and OffscreenCanvas support");
2811
- let i = new e(r === "worker" ? (await import("./render-worker-host-DQ6bkQ0n.js")).createRenderWorker() : new ie(), r), a;
2812
+ let i = new e(r === "worker" ? (await import("./render-worker-host-D0ovEZj9.js")).createRenderWorker() : new ie(), r), a;
2812
2813
  if (typeof t == "string") {
2813
2814
  let e = await fetch(t);
2814
2815
  if (!e.ok) throw Error(`Failed to fetch: ${e.status} ${e.statusText}`);
package/dist/docx.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  import { G as e } from "./src-LzMutzSd.js";
2
- import { i as t, n, r } from "./docx-BfmPyKWJ.js";
2
+ import { i as t, n, r } from "./docx-DW_bVXxg.js";
3
3
  export { t as DocxDocument, r as DocxViewer, e as autoResize, n as noteText };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  import { t as e } from "./pptx-GygKVlSS.js";
2
2
  import { t } from "./xlsx-CO8NBW79.js";
3
- import { t as n } from "./docx-BfmPyKWJ.js";
3
+ import { t as n } from "./docx-DW_bVXxg.js";
4
4
  export { n as docx, e as pptx, t as xlsx };