kordoc 4.22.2 → 4.22.4

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 (128) hide show
  1. package/README.md +11 -6
  2. package/dist/{-C437ZARA.js → -HAK3YFWW.js} +11 -11
  3. package/dist/{chunk-UV2G6XFA.js → chunk-36DK6AOX.js} +2 -2
  4. package/dist/{chunk-CNMUT5YW.js → chunk-3TUJ34V7.js} +2 -2
  5. package/dist/{chunk-I4BS4BXE.cjs → chunk-4X7AR4EH.cjs} +34 -28
  6. package/dist/chunk-4X7AR4EH.cjs.map +1 -0
  7. package/dist/{chunk-4BJZGXNM.js → chunk-5ARHF54C.js} +2 -2
  8. package/dist/{chunk-56GBOIOE.js → chunk-A3SKXHAN.js} +2 -2
  9. package/dist/{chunk-GVBQVXXB.js → chunk-AYV5VRHL.js} +14 -4
  10. package/dist/chunk-AYV5VRHL.js.map +1 -0
  11. package/dist/{chunk-3LJ6QO53.js → chunk-C5J5LDWM.js} +14 -8
  12. package/dist/{chunk-3LJ6QO53.js.map → chunk-C5J5LDWM.js.map} +1 -1
  13. package/dist/{chunk-IRP6QS3K.js → chunk-CWBH66IQ.js} +3 -3
  14. package/dist/{chunk-YTEMFVZB.js → chunk-DEFT7Z3B.js} +2 -2
  15. package/dist/{chunk-L6N4OMKR.js → chunk-EVL6HZQL.js} +128 -70
  16. package/dist/chunk-EVL6HZQL.js.map +1 -0
  17. package/dist/{chunk-ZLFUZM7H.cjs → chunk-EYQLJ57Y.cjs} +3 -3
  18. package/dist/{chunk-ZLFUZM7H.cjs.map → chunk-EYQLJ57Y.cjs.map} +1 -1
  19. package/dist/{chunk-GFQIKYBV.js → chunk-F3AWNFMO.js} +3 -3
  20. package/dist/{chunk-S4KQUVBV.js → chunk-FAFSBCU2.js} +4 -4
  21. package/dist/{chunk-AXR7OKQY.js → chunk-G2325K2F.js} +2 -2
  22. package/dist/{chunk-FPUBEM3F.js → chunk-G4KNI7EO.js} +11 -11
  23. package/dist/{chunk-NGDMJICC.js → chunk-HN3QMHTT.js} +15 -9
  24. package/dist/{chunk-NGDMJICC.js.map → chunk-HN3QMHTT.js.map} +1 -1
  25. package/dist/{chunk-MED2MR6O.cjs → chunk-K2NWHLCD.cjs} +23 -13
  26. package/dist/chunk-K2NWHLCD.cjs.map +1 -0
  27. package/dist/{chunk-UMNKY2EZ.js → chunk-LVVSMYG4.js} +4 -4
  28. package/dist/{chunk-AUWO57ED.cjs → chunk-MJSHXESK.cjs} +2 -2
  29. package/dist/{chunk-AUWO57ED.cjs.map → chunk-MJSHXESK.cjs.map} +1 -1
  30. package/dist/{chunk-L6PFPBTK.js → chunk-MYTMZSQO.js} +2 -2
  31. package/dist/{chunk-DQXP3ELP.js → chunk-Q65HT2BL.js} +2 -2
  32. package/dist/{chunk-U3TZVR7A.js → chunk-Q6SVCBMK.js} +2 -2
  33. package/dist/{chunk-2X64TI7I.js → chunk-RPSILMQY.js} +2 -2
  34. package/dist/{chunk-ENV25MPM.cjs → chunk-S45M7IQH.cjs} +24 -24
  35. package/dist/{chunk-ENV25MPM.cjs.map → chunk-S45M7IQH.cjs.map} +1 -1
  36. package/dist/{chunk-4GCS7WJJ.js → chunk-SSL3TKJY.js} +2 -2
  37. package/dist/{chunk-QFJCEHY7.js → chunk-UJVVL6BI.js} +14 -4
  38. package/dist/chunk-UJVVL6BI.js.map +1 -0
  39. package/dist/{chunk-EKKZNKJD.cjs → chunk-VXQWAPC6.cjs} +3 -3
  40. package/dist/{chunk-EKKZNKJD.cjs.map → chunk-VXQWAPC6.cjs.map} +1 -1
  41. package/dist/{chunk-VUC4JJUM.js → chunk-WCTC3LSV.js} +2 -2
  42. package/dist/{chunk-YOFKJ7IM.js → chunk-WNW77CAY.js} +2 -2
  43. package/dist/chunks-3N7OFSA4.js +10 -0
  44. package/dist/cli.js +30 -30
  45. package/dist/{formula-3TVRNJ66.cjs → formula-JGFYGFYX.cjs} +9 -9
  46. package/dist/{formula-3TVRNJ66.cjs.map → formula-JGFYGFYX.cjs.map} +1 -1
  47. package/dist/{formula-HUENRCPJ.js → formula-KSTY73DQ.js} +3 -3
  48. package/dist/{formula-43QBPAL5.js → formula-PWAUR5PF.js} +4 -4
  49. package/dist/{image-ocr-BAHDLDV5.js → image-ocr-RASJHOAK.js} +6 -6
  50. package/dist/{image-ocr-HYAKWJGE.js → image-ocr-RPBPO3VT.js} +9 -9
  51. package/dist/{image-ocr-OC3TCXMV.cjs → image-ocr-UULNAC5Y.cjs} +17 -17
  52. package/dist/{image-ocr-OC3TCXMV.cjs.map → image-ocr-UULNAC5Y.cjs.map} +1 -1
  53. package/dist/index.cjs +536 -478
  54. package/dist/index.cjs.map +1 -1
  55. package/dist/index.js +128 -70
  56. package/dist/index.js.map +1 -1
  57. package/dist/mcp.js +22 -22
  58. package/dist/{model-bundle-23WBSECG.js → model-bundle-ZPQ4IFT7.js} +5 -5
  59. package/dist/{models-NRZQY45P.js → models-YJQ5VHOR.js} +5 -5
  60. package/dist/{parse-worker-v2-DPNXGJ73.js → parse-worker-v2-7PNZYASF.js} +12 -12
  61. package/dist/{parser-XNOLC3MZ.js → parser-DR6ZHYEB.js} +121 -12
  62. package/dist/parser-DR6ZHYEB.js.map +1 -0
  63. package/dist/{parser-FNUQW2F3.js → parser-ER3VLB37.js} +124 -15
  64. package/dist/parser-ER3VLB37.js.map +1 -0
  65. package/dist/{parser-OKAQRZKM.cjs → parser-ZFXVZZKQ.cjs} +376 -267
  66. package/dist/parser-ZFXVZZKQ.cjs.map +1 -0
  67. package/dist/{pdf-ocr-FAGA3O6B.js → pdf-ocr-BYT7XVID.js} +6 -6
  68. package/dist/{pdf-ocr-N5LYC5LA.js → pdf-ocr-DRQN5BXA.js} +9 -9
  69. package/dist/pdf-ocr-QWTGWYQT.cjs +31 -0
  70. package/dist/{pdf-ocr-6UXBIQE6.cjs.map → pdf-ocr-QWTGWYQT.cjs.map} +1 -1
  71. package/dist/{profile-io-HC6FMYX4.js → profile-io-3QYTSPNH.js} +3 -3
  72. package/dist/{rasterize-QLTROEV2.js → rasterize-LPLWCBXV.js} +3 -3
  73. package/dist/{redact-doc-V4KMM2QV.js → redact-doc-HDA6ZG3N.js} +11 -11
  74. package/dist/{render-V4S3QLTR.js → render-MYZGD3SB.js} +7 -7
  75. package/dist/seal-XA5V6A6V.js +10 -0
  76. package/dist/{setup-HU7ZOQNM.js → setup-EF5TQVAI.js} +3 -3
  77. package/dist/visual-DB7NJOID.js +21 -0
  78. package/dist/{watch-NPIZ6DSJ.js → watch-PM5PRSFW.js} +12 -12
  79. package/package.json +1 -1
  80. package/dist/chunk-GVBQVXXB.js.map +0 -1
  81. package/dist/chunk-I4BS4BXE.cjs.map +0 -1
  82. package/dist/chunk-L6N4OMKR.js.map +0 -1
  83. package/dist/chunk-MED2MR6O.cjs.map +0 -1
  84. package/dist/chunk-QFJCEHY7.js.map +0 -1
  85. package/dist/chunks-MPOOHZVO.js +0 -10
  86. package/dist/parser-FNUQW2F3.js.map +0 -1
  87. package/dist/parser-OKAQRZKM.cjs.map +0 -1
  88. package/dist/parser-XNOLC3MZ.js.map +0 -1
  89. package/dist/pdf-ocr-6UXBIQE6.cjs +0 -31
  90. package/dist/seal-MQ5TB5YZ.js +0 -10
  91. package/dist/visual-RLIFC4XC.js +0 -21
  92. /package/dist/{-C437ZARA.js.map → -HAK3YFWW.js.map} +0 -0
  93. /package/dist/{chunk-UV2G6XFA.js.map → chunk-36DK6AOX.js.map} +0 -0
  94. /package/dist/{chunk-CNMUT5YW.js.map → chunk-3TUJ34V7.js.map} +0 -0
  95. /package/dist/{chunk-4BJZGXNM.js.map → chunk-5ARHF54C.js.map} +0 -0
  96. /package/dist/{chunk-56GBOIOE.js.map → chunk-A3SKXHAN.js.map} +0 -0
  97. /package/dist/{chunk-IRP6QS3K.js.map → chunk-CWBH66IQ.js.map} +0 -0
  98. /package/dist/{chunk-YTEMFVZB.js.map → chunk-DEFT7Z3B.js.map} +0 -0
  99. /package/dist/{chunk-GFQIKYBV.js.map → chunk-F3AWNFMO.js.map} +0 -0
  100. /package/dist/{chunk-S4KQUVBV.js.map → chunk-FAFSBCU2.js.map} +0 -0
  101. /package/dist/{chunk-AXR7OKQY.js.map → chunk-G2325K2F.js.map} +0 -0
  102. /package/dist/{chunk-FPUBEM3F.js.map → chunk-G4KNI7EO.js.map} +0 -0
  103. /package/dist/{chunk-UMNKY2EZ.js.map → chunk-LVVSMYG4.js.map} +0 -0
  104. /package/dist/{chunk-L6PFPBTK.js.map → chunk-MYTMZSQO.js.map} +0 -0
  105. /package/dist/{chunk-DQXP3ELP.js.map → chunk-Q65HT2BL.js.map} +0 -0
  106. /package/dist/{chunk-U3TZVR7A.js.map → chunk-Q6SVCBMK.js.map} +0 -0
  107. /package/dist/{chunk-2X64TI7I.js.map → chunk-RPSILMQY.js.map} +0 -0
  108. /package/dist/{chunk-4GCS7WJJ.js.map → chunk-SSL3TKJY.js.map} +0 -0
  109. /package/dist/{chunk-VUC4JJUM.js.map → chunk-WCTC3LSV.js.map} +0 -0
  110. /package/dist/{chunk-YOFKJ7IM.js.map → chunk-WNW77CAY.js.map} +0 -0
  111. /package/dist/{chunks-MPOOHZVO.js.map → chunks-3N7OFSA4.js.map} +0 -0
  112. /package/dist/{formula-HUENRCPJ.js.map → formula-KSTY73DQ.js.map} +0 -0
  113. /package/dist/{formula-43QBPAL5.js.map → formula-PWAUR5PF.js.map} +0 -0
  114. /package/dist/{image-ocr-BAHDLDV5.js.map → image-ocr-RASJHOAK.js.map} +0 -0
  115. /package/dist/{image-ocr-HYAKWJGE.js.map → image-ocr-RPBPO3VT.js.map} +0 -0
  116. /package/dist/{model-bundle-23WBSECG.js.map → model-bundle-ZPQ4IFT7.js.map} +0 -0
  117. /package/dist/{models-NRZQY45P.js.map → models-YJQ5VHOR.js.map} +0 -0
  118. /package/dist/{parse-worker-v2-DPNXGJ73.js.map → parse-worker-v2-7PNZYASF.js.map} +0 -0
  119. /package/dist/{pdf-ocr-FAGA3O6B.js.map → pdf-ocr-BYT7XVID.js.map} +0 -0
  120. /package/dist/{pdf-ocr-N5LYC5LA.js.map → pdf-ocr-DRQN5BXA.js.map} +0 -0
  121. /package/dist/{profile-io-HC6FMYX4.js.map → profile-io-3QYTSPNH.js.map} +0 -0
  122. /package/dist/{rasterize-QLTROEV2.js.map → rasterize-LPLWCBXV.js.map} +0 -0
  123. /package/dist/{redact-doc-V4KMM2QV.js.map → redact-doc-HDA6ZG3N.js.map} +0 -0
  124. /package/dist/{render-V4S3QLTR.js.map → render-MYZGD3SB.js.map} +0 -0
  125. /package/dist/{seal-MQ5TB5YZ.js.map → seal-XA5V6A6V.js.map} +0 -0
  126. /package/dist/{setup-HU7ZOQNM.js.map → setup-EF5TQVAI.js.map} +0 -0
  127. /package/dist/{visual-RLIFC4XC.js.map → visual-DB7NJOID.js.map} +0 -0
  128. /package/dist/{watch-NPIZ6DSJ.js.map → watch-PM5PRSFW.js.map} +0 -0
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  parse
4
- } from "./chunk-FPUBEM3F.js";
4
+ } from "./chunk-G4KNI7EO.js";
5
5
  import {
6
6
  classifyError,
7
7
  sanitizeError,
8
8
  toArrayBuffer
9
- } from "./chunk-4BJZGXNM.js";
9
+ } from "./chunk-5ARHF54C.js";
10
10
 
11
11
  // src/cli/worker-parse.ts
12
12
  import { readFileSync, statSync } from "fs";
@@ -26,4 +26,4 @@ async function parseWorkerFile(absPath, options) {
26
26
  export {
27
27
  parseWorkerFile
28
28
  };
29
- //# sourceMappingURL=chunk-IRP6QS3K.js.map
29
+ //# sourceMappingURL=chunk-CWBH66IQ.js.map
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  KordocError
4
- } from "./chunk-4BJZGXNM.js";
4
+ } from "./chunk-5ARHF54C.js";
5
5
 
6
6
  // src/hwpx/profile-io.ts
7
7
  import { z } from "zod";
@@ -89,4 +89,4 @@ export {
89
89
  formatProfileSchema,
90
90
  parseFormatProfileJson
91
91
  };
92
- //# sourceMappingURL=chunk-YTEMFVZB.js.map
92
+ //# sourceMappingURL=chunk-DEFT7Z3B.js.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  loadSharp,
4
4
  rasterizePageSvg
5
- } from "./chunk-2X64TI7I.js";
5
+ } from "./chunk-RPSILMQY.js";
6
6
  import {
7
7
  inlineImagesIntoMarkdown
8
8
  } from "./chunk-VKVDMH7X.js";
@@ -16,7 +16,7 @@ import {
16
16
  HEADING_RATIO_H3,
17
17
  tidyScriptTags,
18
18
  unframeLayoutTables
19
- } from "./chunk-GVBQVXXB.js";
19
+ } from "./chunk-AYV5VRHL.js";
20
20
  import {
21
21
  MAX_COLS,
22
22
  MAX_ROWS,
@@ -27,7 +27,7 @@ import {
27
27
  flattenLayoutTables,
28
28
  mapPuaText,
29
29
  markNonLayoutTable
30
- } from "./chunk-U3TZVR7A.js";
30
+ } from "./chunk-Q6SVCBMK.js";
31
31
  import {
32
32
  DEFAULT_CHAR,
33
33
  DEFAULT_PARA_GEOM,
@@ -41,7 +41,7 @@ import {
41
41
  hwpxAppMajor,
42
42
  parseRenderStyles,
43
43
  readZipEntry
44
- } from "./chunk-VUC4JJUM.js";
44
+ } from "./chunk-WCTC3LSV.js";
45
45
  import {
46
46
  KordocError,
47
47
  compareSectionPaths,
@@ -49,7 +49,7 @@ import {
49
49
  precheckZipSize,
50
50
  sanitizeHref,
51
51
  toArrayBuffer
52
- } from "./chunk-4BJZGXNM.js";
52
+ } from "./chunk-5ARHF54C.js";
53
53
 
54
54
  // src/render/svg-render.ts
55
55
  import JSZip from "jszip";
@@ -3248,6 +3248,8 @@ var FACE_SPACE = {
3248
3248
  "KoPubWorld\uB3CB\uC6C0\uCCB4 Light": 290
3249
3249
  };
3250
3250
  var BEFORE_2024_WIDTH = {
3251
+ // TTF 신명조의 대체 큰따옴표 — 원본 PDF의 Haansoft Batang /W 370. 한양신명조 HFT와 별개다.
3252
+ "\uC2E0\uBA85\uC870": { 8220: 370, 8221: 370 },
3251
3253
  "\uD734\uBA3C\uBA85\uC870": {
3252
3254
  183: 1e3,
3253
3255
  8211: 430,
@@ -11133,7 +11135,7 @@ function findFirst(el, name, depth = 0) {
11133
11135
  }
11134
11136
  var FORM_TAGS = /* @__PURE__ */ new Set(["checkBtn", "radioBtn", "btn", "comboBox", "listBox", "edit", "scrollBar"]);
11135
11137
  var OBJ_TAGS = /* @__PURE__ */ new Set(["tbl", "pic", "container", "equation", "rect", "ellipse", "polygon", "curv", "curve", "line", "arc", "ole", "textart", ...FORM_TAGS]);
11136
- var CHAR_CTRL_1SLOT = /* @__PURE__ */ new Set(["lineBreak", "hyphen", "nbSpace", "fwSpace"]);
11138
+ var CHAR_CTRL_1SLOT = /* @__PURE__ */ new Set(["lineBreak", "hyphen", "hypen", "nbSpace", "fwSpace"]);
11137
11139
  var noteFmtCache = /* @__PURE__ */ new WeakMap();
11138
11140
  function sectionNoteFormats(p) {
11139
11141
  const root = p.ownerDocument?.documentElement;
@@ -11893,6 +11895,63 @@ function cachedParagraphBottom(lsa, bodyFlow) {
11893
11895
  return bottom;
11894
11896
  }
11895
11897
 
11898
+ // src/render/reflow-fragments.ts
11899
+ function appendNarrowLineFragments(parent, seg, free, box, flow) {
11900
+ if (!free || !box) return false;
11901
+ const parts = free.filter(([a, b]) => b - a >= 1440);
11902
+ if (parts.length < 2 || parts.at(-1)[0] !== box[0] || parts.at(-1)[1] - box[0] !== box[1]) return false;
11903
+ const { text, widths, spacings, slots, start, end } = flow;
11904
+ if (/[\t\n\u00a0\u2005\ufdd0\ufffc]/.test(text.slice(start, end))) return false;
11905
+ let ink = start;
11906
+ while (ink < end && (text[ink] === " " || text[ink] === "\u2060" && widths[ink] === 0)) ink++;
11907
+ if (text.slice(ink, end).includes("\u2060")) return false;
11908
+ if (ink === end || parts.slice(0, -1).some(([a, b]) => (widths[ink] ?? 0) - (spacings[ink] ?? 0) <= b - a)) return false;
11909
+ const fragments = [];
11910
+ let cursor = start;
11911
+ for (const [a, b] of parts.slice(0, -1)) {
11912
+ const offset = cursor;
11913
+ let w = 0;
11914
+ while (cursor < ink && w + widths[cursor] <= b - a) w += widths[cursor++];
11915
+ fragments.push({ offset, x: a, width: b - a });
11916
+ }
11917
+ let rest = 0;
11918
+ for (let i = cursor; i < end; i++) rest += widths[i];
11919
+ let last = end - 1;
11920
+ if (last > cursor && /[\uDC00-\uDFFF]/.test(text[last])) last--;
11921
+ rest -= spacings[last] ?? 0;
11922
+ if (rest > box[1] + 0.5) return false;
11923
+ let next = end;
11924
+ while (next < text.length && text[next] === " ") next++;
11925
+ if (next < text.length && rest + (widths[next] ?? 0) - (spacings[next] ?? 0) <= box[1] + 0.5) return false;
11926
+ fragments.push({ offset: cursor, x: box[0], width: box[1] });
11927
+ fragments.forEach((f, i) => {
11928
+ const part = seg.cloneNode(false);
11929
+ if (i > 0) part.setAttribute("textpos", String(slots[f.offset]));
11930
+ part.setAttribute("horzpos", String(f.x));
11931
+ part.setAttribute("horzsize", String(f.width));
11932
+ parent.appendChild(part);
11933
+ });
11934
+ return true;
11935
+ }
11936
+
11937
+ // src/render/reflow-borders.ts
11938
+ function lineBorderBox(model, styles, start, end) {
11939
+ const empty = model.chars.length === 0 && model.objs.length === 0;
11940
+ let top = 0, all = 0;
11941
+ const include = (prId) => {
11942
+ const st = prId != null ? styles.charPr.get(prId) : void 0;
11943
+ const f = st?.borderFill != null ? styles.borderFill.get(st.borderFill) : void 0;
11944
+ if (!f || !f.top && !f.bottom) return;
11945
+ const width = (pt3) => empty ? 2 * Math.trunc(pt3 * 50) : Math.trunc(pt3 * 100);
11946
+ const t = f.top ? width(f.top.widthPt) : 0, b = f.bottom ? width(f.bottom.widthPt) : 0;
11947
+ top = Math.max(top, st.height + t);
11948
+ all = Math.max(all, st.height + t + b);
11949
+ };
11950
+ if (empty) for (const run of model.runs) include(run.prId);
11951
+ else for (let i = start; i < end; i++) if (model.chars[i].ch) include(model.chars[i].prId);
11952
+ return [top, all, empty && all > 0];
11953
+ }
11954
+
11896
11955
  // src/render/reflow.ts
11897
11956
  var geomMemo = (styles) => ({ cell: /* @__PURE__ */ new WeakMap(), table: /* @__PURE__ */ new WeakMap(), paraGeom: styles.paraGeom });
11898
11957
  var LINESEG_FLAGS = "393216";
@@ -11957,7 +12016,7 @@ function glyphWidth(ch, st) {
11957
12016
  const face1 = L?.face ?? st.face;
11958
12017
  const face0 = face1 === "Batang" ? st.before2024 ? "\uBC14\uD0D5" : "\uD55C\uCEF4\uBC14\uD0D5" : face1;
11959
12018
  const boldFace = !space && st.bold && (L ? L.hft : st.hft) && face0 && fontHasGlyph(`${face0} Bold`, cp) ? `${face0} Bold` : void 0;
11960
- const oldEm = st.halfQuote && face0 === "\uD734\uBA3C\uBA85\uC870" && (cp === 8220 || cp === 8221) ? 500 : st.halfQuote && !st.before2024 && face0 === "\uD734\uBA3C\uBA85\uC870" && (cp === 8216 || cp === 8217) ? 312 : st.before2024 && face0 ? BEFORE_2024_WIDTH[face0]?.[cp] : !st.halfQuote && face0 === "\uD734\uBA3C\uBA85\uC870" && cp === 8231 ? BEFORE_2024_WIDTH[face0]?.[cp] : void 0;
12019
+ const oldEm = st.halfQuote && face0 === "\uD734\uBA3C\uBA85\uC870" && (cp === 8220 || cp === 8221) ? 500 : st.halfQuote && !st.before2024 && face0 === "\uD734\uBA3C\uBA85\uC870" && (cp === 8216 || cp === 8217) ? 312 : st.before2024 && face0 && !(face0 === "\uC2E0\uBA85\uC870" && (st.halfQuote || (L?.face ? L.hft : st.hft))) ? BEFORE_2024_WIDTH[face0]?.[cp] : !st.halfQuote && face0 === "\uD734\uBA3C\uBA85\uC870" && cp === 8231 ? BEFORE_2024_WIDTH[face0]?.[cp] : void 0;
11961
12020
  const fc = faceClassForReflow(boldFace ?? face0);
11962
12021
  const fsEm = space && st.fontSpace ? fontSpaceEm(st.face) : void 0;
11963
12022
  if (fsEm !== void 0) {
@@ -12177,7 +12236,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
12177
12236
  const hRel = pos?.getAttribute("horzRelTo") ?? "COLUMN", hAlign = pos?.getAttribute("horzAlign") ?? "LEFT";
12178
12237
  const ho = num2(pos, "horzOffset"), base = hRel === "PARA" ? marginL : 0, span = hRel === "PARA" ? avail : areaW;
12179
12238
  const x0 = base + (hAlign === "RIGHT" ? span - ho - o.width : hAlign === "CENTER" ? (span - o.width) / 2 + ho : ho);
12180
- const top = startV + vo;
12239
+ const top = startV - (bodyFlow && vertRel === "PARA" && wrapAttr === "SQUARE" ? geom.spaceBefore : 0) + vo;
12181
12240
  const omLx = num2(om, "left"), omRx = num2(om, "right");
12182
12241
  const xs = hAlign === "RIGHT" ? x0 - omRx : hAlign === "CENTER" ? x0 : x0 + omLx;
12183
12242
  const nextPage = pageH > 0 && top + effH + outB > pageH;
@@ -12311,12 +12370,15 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
12311
12370
  const om = findChildByLocalName(o.el, "outMargin");
12312
12371
  const li = lineOf(o.index);
12313
12372
  const h = num2(om, "top") + effHOf(o) + num2(om, "bottom");
12373
+ if (o.tag === "tbl" && li > 0 && o.omL + o.width + o.omR > (lineWidth?.(li - 1) ?? (li === 1 ? firstWrapWidth : contWidth)) && /^[\u2060\ufdd0]+$/.test(text.slice(wrap.starts[li - 1], wrap.starts[li]))) collisionHeights[li - 1] = Math.max(collisionHeights[li - 1] ?? 0, h);
12314
12374
  lineObjH[li] = Math.max(lineObjH[li], h);
12315
12375
  if (findChildByLocalName(o.el, "pos")?.getAttribute("affectLSpacing") === "1") lineObjLs[li] = true;
12316
12376
  const bl = o.tag === "equation" ? Number(o.el.getAttribute("baseLine")) : NaN;
12317
12377
  lineObjAsc[li] = Math.max(lineObjAsc[li], Math.round(h * (Number.isFinite(bl) ? bl / 100 : BASELINE_RATIO)));
12318
12378
  }
12319
12379
  const lsa = doc.createElement("hp:linesegarray");
12380
+ const subList = p.parentNode;
12381
+ const verticalCenter = subList?.getAttribute?.("vertAlign") === "CENTER" && ["VERTICAL", "VERTICALALL"].includes(subList.getAttribute("textDirection") ?? "");
12320
12382
  let v = textStartV;
12321
12383
  let firstAcc = 0;
12322
12384
  const textposOf = wrap.starts.map((startReal, li) => li === 0 ? 0 : startReal < realIdx.length ? realIdx[startReal] : realIdx.length ? m.chars.length : 0);
@@ -12332,40 +12394,26 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
12332
12394
  const fontLineOf = (li) => {
12333
12395
  if (!geom.fontLineHeight) return void 0;
12334
12396
  const s = textposOf[li], e = li === wrap.starts.length - 1 ? m.chars.length : textposOf[li + 1];
12397
+ if (!m.chars.slice(s, e).some((c) => c.ch && c.ch !== " ")) return void 0;
12335
12398
  let h = 0, b = 0, any = false;
12336
12399
  for (let k = s; k < e; k++) {
12337
12400
  const c = m.chars[k];
12338
- if (!c.ch || c.ch === " ") continue;
12401
+ if (!c.ch) continue;
12339
12402
  const st = c.prId != null ? styles.charPr.get(c.prId) : void 0;
12340
12403
  if (!st) continue;
12341
12404
  const cp = c.ch.codePointAt(0);
12342
- const fm = fontLineMetrics(st.latin && isLatinCp(cp) ? st.latin.face : st.face);
12405
+ const fm = fontLineMetrics(c.ch !== " " && st.latin && isLatinCp(cp) ? st.latin.face : st.face);
12343
12406
  any = true;
12344
12407
  h = Math.max(h, fm ? Math.round(st.height * fm[0]) + (fm[2] ? Math.round : Math.trunc)(st.height * fm[1]) : st.height);
12345
12408
  b = Math.max(b, fm ? Math.round(st.height * fm[0]) : Math.round(st.height * BASELINE_RATIO));
12346
12409
  }
12347
12410
  return any ? [h, b] : void 0;
12348
12411
  };
12349
- const lineBorderBox = (li) => {
12350
- const s0 = textposOf[li], e = li === wrap.starts.length - 1 ? m.chars.length : textposOf[li + 1];
12351
- let top = 0, all = 0;
12352
- for (let k = s0; k < e; k++) {
12353
- const c = m.chars[k];
12354
- if (!c.ch) continue;
12355
- const st = c.prId != null ? styles.charPr.get(c.prId) : void 0;
12356
- const f = st?.borderFill != null ? styles.borderFill.get(st.borderFill) : void 0;
12357
- if (!f || !f.top && !f.bottom) continue;
12358
- const t = f.top ? Math.trunc(f.top.widthPt * 100) : 0, b = f.bottom ? Math.trunc(f.bottom.widthPt * 100) : 0;
12359
- top = Math.max(top, st.height + t);
12360
- all = Math.max(all, st.height + t + b);
12361
- }
12362
- return [top, all];
12363
- };
12364
12412
  const natW = widths.reduce((a, w) => a + w, 0) + spacings.reduce((a, w) => a + w, 0);
12365
12413
  for (let li = 0; li < wrap.starts.length; li++) {
12366
12414
  const textpos = textposOf[li];
12367
12415
  const fl = fontLineOf(li);
12368
- const [boxTop, boxAll] = lineBorderBox(li);
12416
+ const [boxTop, boxAll, emptyBorder] = lineBorderBox(m, styles, textposOf[li], textposOf[li + 1] ?? m.chars.length);
12369
12417
  const textH0 = fl ? Math.max(fl[0], lineTextH(li)) : lineTextH(li);
12370
12418
  const textH = Math.max(textH0, boxAll);
12371
12419
  const objOnly = lineObjH[li] > 0 && lineObjH[li] < textH && (() => {
@@ -12394,9 +12442,9 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
12394
12442
  const seg = doc.createElement("hp:lineseg");
12395
12443
  seg.setAttribute("textpos", String(textpos));
12396
12444
  seg.setAttribute("vertpos", String(vertpos));
12397
- seg.setAttribute("vertsize", String(occupiedH === textH && boxAll > textH0 ? Math.max(textH0, boxTop) : occupiedH));
12445
+ seg.setAttribute("vertsize", String(emptyBorder ? textH0 : occupiedH === textH && boxAll > textH0 ? Math.max(textH0, boxTop) : occupiedH));
12398
12446
  seg.setAttribute("textheight", String(lineH));
12399
- seg.setAttribute("baseline", String(geom.vertAlign === "TOP" ? 0 : geom.vertAlign === "CENTER" ? Math.floor(lineH / 2) : geom.vertAlign === "BOTTOM" ? lineH : Math.max(fl ? fl[1] : Math.round(textH0 * BASELINE_RATIO), lineObjAsc[li])));
12447
+ seg.setAttribute("baseline", String(geom.vertAlign === "TOP" ? 0 : geom.vertAlign === "CENTER" || verticalCenter && (!geom.vertAlign || geom.vertAlign === "BASELINE") ? Math.floor(lineH / 2) : geom.vertAlign === "BOTTOM" ? lineH : Math.max(fl ? fl[1] : Math.round(textH0 * BASELINE_RATIO), boxTop > textH0 ? Math.round(boxTop * BASELINE_RATIO) : 0, lineObjAsc[li])));
12400
12448
  seg.setAttribute("spacing", String(spacing));
12401
12449
  let box = boxAt(li);
12402
12450
  const fit = wrap.starts.length === 1 && lineObjH[li] === 0 ? lineParts[li]?.filter(([a, b]) => b - a >= 1440) : void 0;
@@ -12405,6 +12453,13 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
12405
12453
  seg.setAttribute("horzpos", String(box ? box[0] : isFirst ? marginL : contHorz));
12406
12454
  seg.setAttribute("horzsize", String(box ? box[1] : isFirst ? firstWidth : contSegWidth));
12407
12455
  seg.setAttribute("flags", LINESEG_FLAGS);
12456
+ if (paraMode === "charAll" && !inlineAt.size && !geom.marginIntent && !bulletW && !condenseUse && appendNarrowLineFragments(
12457
+ lsa,
12458
+ seg,
12459
+ lineParts[li],
12460
+ box,
12461
+ { text, widths, spacings, slots: realIdx, start: wrap.starts[li], end: wrap.starts[li + 1] ?? text.length }
12462
+ )) continue;
12408
12463
  lsa.appendChild(seg);
12409
12464
  for (const [a, b] of parts?.slice(1) ?? []) {
12410
12465
  const more = seg.cloneNode(false);
@@ -14177,6 +14232,49 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local = false) {
14177
14232
  return { ...geometry, svg };
14178
14233
  }
14179
14234
 
14235
+ // src/render/object-anchor.ts
14236
+ function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, laterLineH) {
14237
+ const { PW, PH, ML, MT, BODY_W, BODY_H } = ctx.geom;
14238
+ const pos = findChildByLocalName(o.el, "pos");
14239
+ const om = findChildByLocalName(o.el, "outMargin");
14240
+ const omT = num(om, "top"), omB = num(om, "bottom");
14241
+ const w = o.width, h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, ctx.extentMemo)) : o.height;
14242
+ if (!pos) return { x: ox, y: oy + baseV };
14243
+ const voRaw = num(pos, "vertOffset"), voS = voRaw >= 2 ** 31 ? voRaw - 2 ** 32 : voRaw;
14244
+ const vo = (pos.getAttribute("vertRelTo") ?? "PARA") === "PARA" ? Math.max(0, voS) : voS;
14245
+ const ho = num(pos, "horzOffset");
14246
+ const vrel = pos.getAttribute("vertRelTo") ?? "PARA";
14247
+ const hrel = pos.getAttribute("horzRelTo") ?? "PARA";
14248
+ const va = pos.getAttribute("vertAlign") ?? "TOP";
14249
+ const ha = pos.getAttribute("horzAlign") ?? "LEFT";
14250
+ const wrap = o.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM";
14251
+ let y;
14252
+ if (vrel === "PAPER") {
14253
+ y = va === "BOTTOM" ? PH - h - vo - omB : va === "CENTER" ? (PH - h) / 2 + vo : vo + omT;
14254
+ } else if (vrel === "PAGE") {
14255
+ y = va === "BOTTOM" ? MT + BODY_H - h - vo : va === "CENTER" ? MT + (BODY_H - h) / 2 + vo : MT + vo;
14256
+ } else if (wrap === "TOP_AND_BOTTOM") {
14257
+ const lineV = anchorLineV ?? baseV;
14258
+ const pushed = lineV - (omT + h + omB);
14259
+ const below = laterLineH !== void 0 && vo + omT >= laterLineH;
14260
+ const anchor = below ? lineV : stayLine !== false ? lineV - stayLine : pushed >= -100 ? pushed : paraStartV !== void 0 ? paraStartV : lineV;
14261
+ y = oy + anchor + omT + vo;
14262
+ } else {
14263
+ const origin = vrel === "PARA" && wrap === "SQUARE" ? paraStartV ?? baseV : baseV;
14264
+ y = oy + Math.max(origin + vo, wrap === "SQUARE" && anchorLineV !== void 0 ? anchorLineV : -Infinity) + omT;
14265
+ }
14266
+ let x;
14267
+ const omL = num(om, "left"), omR = num(om, "right");
14268
+ if (hrel === "PAGE") {
14269
+ x = ha === "RIGHT" ? ML + BODY_W - w - ho - omR : ha === "CENTER" ? ML + (BODY_W - w) / 2 + ho : ML + ho + omL;
14270
+ } else if (hrel === "PAPER") {
14271
+ x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (ctx.bodyDx?.(ctx.page) ?? 0);
14272
+ } else {
14273
+ x = ha === "RIGHT" ? ox + areaW - w - ho - omR : ha === "CENTER" ? ox + (areaW - w) / 2 + ho : ox + ho + omL;
14274
+ }
14275
+ return { x, y };
14276
+ }
14277
+
14180
14278
  // src/render/svg-render.ts
14181
14279
  function escapeXml(s) {
14182
14280
  return s.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
@@ -14499,7 +14597,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
14499
14597
  const stay = tbFloats < 2 && !m.objs.some((q) => q.inline) && !m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
14500
14598
  const sbA = m.paraPrId != null ? ctx.styles.paraGeom.get(m.paraPrId)?.spaceBefore ?? 0 : 0;
14501
14599
  const firstLine = anchorLineV === void 0 || anchorLineV === baseV;
14502
- let { x, y } = anchorObject(o, ax, oy, objBaseV, aw, ctx, anchorLineV, stay ? sbA : false, firstLine && pTop !== void 0 && pTop < baseV ? pTop : void 0, firstLine ? void 0 : anchorLineH);
14600
+ let { x, y } = anchorObject(o, ax, oy, objBaseV, aw, ctx, anchorLineV, stay ? sbA : false, (firstLine || wrapA === "SQUARE") && pTop !== void 0 && pTop < baseV ? pTop : void 0, firstLine ? void 0 : anchorLineH);
14503
14601
  if (depth === 0 && tbFloats >= 2 && wrapA === "TOP_AND_BOTTOM") {
14504
14602
  if (!tbStack) {
14505
14603
  tbStack = /* @__PURE__ */ new Map();
@@ -14536,46 +14634,6 @@ function cellParaTop(p, geom) {
14536
14634
  const last = segs[segs.length - 1];
14537
14635
  return num(last, "vertpos") + num(last, "vertsize") + num(last, "spacing") + (geom.get(prev.getAttribute("paraPrIDRef") ?? "")?.spaceAfter ?? 0);
14538
14636
  }
14539
- function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, laterLineH) {
14540
- const { PW, PH, ML, MT, BODY_W, BODY_H } = ctx.geom;
14541
- const pos = findChildByLocalName(o.el, "pos");
14542
- const om = findChildByLocalName(o.el, "outMargin");
14543
- const omT = num(om, "top"), omB = num(om, "bottom");
14544
- const w = o.width, h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, ctx.extentMemo)) : o.height;
14545
- if (!pos) return { x: ox, y: oy + baseV };
14546
- const voRaw = num(pos, "vertOffset"), voS = voRaw >= 2 ** 31 ? voRaw - 2 ** 32 : voRaw;
14547
- const vo = (pos.getAttribute("vertRelTo") ?? "PARA") === "PARA" ? Math.max(0, voS) : voS;
14548
- const ho = num(pos, "horzOffset");
14549
- const vrel = pos.getAttribute("vertRelTo") ?? "PARA";
14550
- const hrel = pos.getAttribute("horzRelTo") ?? "PARA";
14551
- const va = pos.getAttribute("vertAlign") ?? "TOP";
14552
- const ha = pos.getAttribute("horzAlign") ?? "LEFT";
14553
- const wrap = o.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM";
14554
- let y;
14555
- if (vrel === "PAPER") {
14556
- y = va === "BOTTOM" ? PH - h - vo - omB : va === "CENTER" ? (PH - h) / 2 + vo : vo + omT;
14557
- } else if (vrel === "PAGE") {
14558
- y = va === "BOTTOM" ? MT + BODY_H - h - vo : va === "CENTER" ? MT + (BODY_H - h) / 2 + vo : MT + vo;
14559
- } else if (wrap === "TOP_AND_BOTTOM") {
14560
- const lineV = anchorLineV ?? baseV;
14561
- const pushed = lineV - (omT + h + omB);
14562
- const below = laterLineH !== void 0 && vo + omT >= laterLineH;
14563
- const anchor = below ? lineV : stayLine !== false ? lineV - stayLine : pushed >= -100 ? pushed : paraStartV !== void 0 ? paraStartV : lineV;
14564
- y = oy + anchor + omT + vo;
14565
- } else {
14566
- y = oy + Math.max(baseV + vo, wrap === "SQUARE" && anchorLineV !== void 0 ? anchorLineV : -Infinity) + omT;
14567
- }
14568
- let x;
14569
- const omL = num(om, "left"), omR = num(om, "right");
14570
- if (hrel === "PAGE") {
14571
- x = ha === "RIGHT" ? ML + BODY_W - w - ho - omR : ha === "CENTER" ? ML + (BODY_W - w) / 2 + ho : ML + ho + omL;
14572
- } else if (hrel === "PAPER") {
14573
- x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (ctx.bodyDx?.(ctx.page) ?? 0);
14574
- } else {
14575
- x = ha === "RIGHT" ? ox + areaW - w - ho - omR : ha === "CENTER" ? ox + (areaW - w) / 2 + ho : ox + ho + omL;
14576
- }
14577
- return { x, y };
14578
- }
14579
14637
  function drawObject(o, x, y, baseV, areaW, ctx, depth) {
14580
14638
  if (!o.inline && depth === 0 && ctx.paintJobs) {
14581
14639
  const wrap = o.el.getAttribute("textWrap");
@@ -19625,4 +19683,4 @@ export {
19625
19683
  cropRect,
19626
19684
  extractRenderedRegions
19627
19685
  };
19628
- //# sourceMappingURL=chunk-L6N4OMKR.js.map
19686
+ //# sourceMappingURL=chunk-EVL6HZQL.js.map