kordoc 4.24.0 → 4.24.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.
Files changed (126) hide show
  1. package/README.md +26 -54
  2. package/dist/{-VEOO4BOM.js → -SRNEV7LS.js} +11 -11
  3. package/dist/{chunk-P35SCAJN.js → chunk-3HN65YAL.js} +2 -2
  4. package/dist/{chunk-H5PDQ66I.js → chunk-4745MFQU.js} +3 -3
  5. package/dist/{chunk-ENCAYXDI.js → chunk-4XC4O7FJ.js} +4 -4
  6. package/dist/{chunk-EN3PK6OT.js → chunk-7NTMM6PO.js} +2 -2
  7. package/dist/{chunk-GEY6ZMXH.js → chunk-C6ZVB547.js} +43 -23
  8. package/dist/{chunk-GEY6ZMXH.js.map → chunk-C6ZVB547.js.map} +1 -1
  9. package/dist/{chunk-CKCJU42Y.js → chunk-DHMBPMKC.js} +74 -30
  10. package/dist/chunk-DHMBPMKC.js.map +1 -0
  11. package/dist/{chunk-ZGNHJCDR.js → chunk-E6VBLBOO.js} +2 -2
  12. package/dist/{chunk-O2SLKE4L.js → chunk-E7B5CXYI.js} +2 -2
  13. package/dist/{chunk-DKWEZWCF.cjs → chunk-HLTPMSYW.cjs} +3 -3
  14. package/dist/{chunk-DKWEZWCF.cjs.map → chunk-HLTPMSYW.cjs.map} +1 -1
  15. package/dist/{chunk-DZT3CHNZ.cjs → chunk-IGG63DFK.cjs} +3 -3
  16. package/dist/{chunk-DZT3CHNZ.cjs.map → chunk-IGG63DFK.cjs.map} +1 -1
  17. package/dist/{chunk-IHNIPVPJ.cjs → chunk-JFUUFJZW.cjs} +6 -6
  18. package/dist/{chunk-IHNIPVPJ.cjs.map → chunk-JFUUFJZW.cjs.map} +1 -1
  19. package/dist/{chunk-PX6X4YOR.js → chunk-JMOAMKAR.js} +4 -4
  20. package/dist/{chunk-P6FNIU5P.js → chunk-KUC5I5MB.js} +2 -2
  21. package/dist/{chunk-Z5G6QNVH.js → chunk-LMEF7FN5.js} +2 -2
  22. package/dist/{chunk-OJISMR2Z.js → chunk-M46PB75E.js} +2 -2
  23. package/dist/{chunk-G4HWEM6Q.js → chunk-MHNJOJQV.js} +4 -4
  24. package/dist/{chunk-Z62PHCSU.js → chunk-NJ5RUDCW.js} +3 -3
  25. package/dist/{chunk-DM5YPONO.js → chunk-NMFFIUI6.js} +2 -2
  26. package/dist/{chunk-HOXHBG4C.cjs → chunk-PNSALBXH.cjs} +2 -2
  27. package/dist/{chunk-HOXHBG4C.cjs.map → chunk-PNSALBXH.cjs.map} +1 -1
  28. package/dist/{chunk-FHFPQ6MX.cjs → chunk-PNX5FYHC.cjs} +24 -24
  29. package/dist/{chunk-FHFPQ6MX.cjs.map → chunk-PNX5FYHC.cjs.map} +1 -1
  30. package/dist/{chunk-IZYYKE5F.js → chunk-R2GIGE5H.js} +2 -2
  31. package/dist/{chunk-55DOBEGD.js → chunk-RIRPLFPN.js} +2 -2
  32. package/dist/{chunk-3M2BIQLZ.js → chunk-TDMBTG7U.js} +2 -2
  33. package/dist/{chunk-6YDPTTIY.js → chunk-TW3V6FSH.js} +2 -2
  34. package/dist/{chunk-OHDGEGDJ.cjs → chunk-UNICY546.cjs} +23 -23
  35. package/dist/{chunk-OHDGEGDJ.cjs.map → chunk-UNICY546.cjs.map} +1 -1
  36. package/dist/{chunk-SRUBDR3Z.js → chunk-VPSF5LEM.js} +3 -3
  37. package/dist/{chunk-4VPN5MHS.js → chunk-W24TJJNN.js} +2 -2
  38. package/dist/{chunk-DBPDAG7N.js → chunk-WDSTW3BD.js} +2 -2
  39. package/dist/{chunk-XLY5ZJRP.js → chunk-WJAFE3Z6.js} +2 -2
  40. package/dist/chunks-AL4P5TO5.js +10 -0
  41. package/dist/cli.js +41 -30
  42. package/dist/cli.js.map +1 -1
  43. package/dist/{formula-4GRNVWIQ.js → formula-DSB574H7.js} +4 -4
  44. package/dist/{formula-R3OWFGCZ.cjs → formula-HK2MNZ3Q.cjs} +9 -9
  45. package/dist/{formula-R3OWFGCZ.cjs.map → formula-HK2MNZ3Q.cjs.map} +1 -1
  46. package/dist/{formula-6Y467S4R.js → formula-U2LZ67KI.js} +3 -3
  47. package/dist/{image-ocr-CGJJCD4E.js → image-ocr-3QB2HLSI.js} +9 -9
  48. package/dist/{image-ocr-ZLL66KNO.js → image-ocr-J54Q3YWP.js} +6 -6
  49. package/dist/{image-ocr-EBKG45KF.cjs → image-ocr-QNIMVE5A.cjs} +17 -17
  50. package/dist/{image-ocr-EBKG45KF.cjs.map → image-ocr-QNIMVE5A.cjs.map} +1 -1
  51. package/dist/index.cjs +683 -619
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.d.cts +1 -1
  54. package/dist/index.d.ts +1 -1
  55. package/dist/index.js +106 -42
  56. package/dist/index.js.map +1 -1
  57. package/dist/mcp.js +36 -33
  58. package/dist/mcp.js.map +1 -1
  59. package/dist/{model-bundle-RD4KSNTB.js → model-bundle-CGWU4ALC.js} +5 -5
  60. package/dist/{models-OLGCZBXI.js → models-A3TF3BDV.js} +5 -5
  61. package/dist/{parse-worker-v2-YZY2GQY5.js → parse-worker-v2-MNUD4WAR.js} +20 -13
  62. package/dist/parse-worker-v2-MNUD4WAR.js.map +1 -0
  63. package/dist/{parser-IHCFHLHN.js → parser-C3ARF26I.js} +12 -12
  64. package/dist/{parser-J22QBXPP.js → parser-OBGWEWSU.js} +9 -9
  65. package/dist/{parser-DX4I3GT7.cjs → parser-RPAHN3OR.cjs} +157 -157
  66. package/dist/{parser-DX4I3GT7.cjs.map → parser-RPAHN3OR.cjs.map} +1 -1
  67. package/dist/{pdf-ocr-TYIH23RP.js → pdf-ocr-ENLVEEYL.js} +9 -9
  68. package/dist/pdf-ocr-GA5QJFNK.cjs +31 -0
  69. package/dist/{pdf-ocr-WU7SZHWM.cjs.map → pdf-ocr-GA5QJFNK.cjs.map} +1 -1
  70. package/dist/{pdf-ocr-H2247ZZH.js → pdf-ocr-K53REDNY.js} +6 -6
  71. package/dist/{profile-io-GH3TYTNJ.js → profile-io-ZGFEO7CB.js} +3 -3
  72. package/dist/{rasterize-7TFTVFMB.js → rasterize-QMC2SAUT.js} +3 -3
  73. package/dist/{redact-doc-DSSQOO3A.js → redact-doc-JH6RZZBE.js} +11 -11
  74. package/dist/{render-NKXZQINI.js → render-ZGKQLKPJ.js} +7 -7
  75. package/dist/seal-KMGYTJAV.js +10 -0
  76. package/dist/{setup-JVLMX2TH.js → setup-LAQGCYQ2.js} +3 -3
  77. package/dist/visual-4OYJFGXL.js +21 -0
  78. package/dist/{watch-5RZVHAKI.js → watch-7YPB4TKC.js} +12 -12
  79. package/package.json +1 -1
  80. package/dist/chunk-CKCJU42Y.js.map +0 -1
  81. package/dist/chunks-LV5EJBZ4.js +0 -10
  82. package/dist/parse-worker-v2-YZY2GQY5.js.map +0 -1
  83. package/dist/pdf-ocr-WU7SZHWM.cjs +0 -31
  84. package/dist/seal-JIVSSI3Z.js +0 -10
  85. package/dist/visual-BKVZN6HP.js +0 -21
  86. /package/dist/{-VEOO4BOM.js.map → -SRNEV7LS.js.map} +0 -0
  87. /package/dist/{chunk-P35SCAJN.js.map → chunk-3HN65YAL.js.map} +0 -0
  88. /package/dist/{chunk-H5PDQ66I.js.map → chunk-4745MFQU.js.map} +0 -0
  89. /package/dist/{chunk-ENCAYXDI.js.map → chunk-4XC4O7FJ.js.map} +0 -0
  90. /package/dist/{chunk-EN3PK6OT.js.map → chunk-7NTMM6PO.js.map} +0 -0
  91. /package/dist/{chunk-ZGNHJCDR.js.map → chunk-E6VBLBOO.js.map} +0 -0
  92. /package/dist/{chunk-O2SLKE4L.js.map → chunk-E7B5CXYI.js.map} +0 -0
  93. /package/dist/{chunk-PX6X4YOR.js.map → chunk-JMOAMKAR.js.map} +0 -0
  94. /package/dist/{chunk-P6FNIU5P.js.map → chunk-KUC5I5MB.js.map} +0 -0
  95. /package/dist/{chunk-Z5G6QNVH.js.map → chunk-LMEF7FN5.js.map} +0 -0
  96. /package/dist/{chunk-OJISMR2Z.js.map → chunk-M46PB75E.js.map} +0 -0
  97. /package/dist/{chunk-G4HWEM6Q.js.map → chunk-MHNJOJQV.js.map} +0 -0
  98. /package/dist/{chunk-Z62PHCSU.js.map → chunk-NJ5RUDCW.js.map} +0 -0
  99. /package/dist/{chunk-DM5YPONO.js.map → chunk-NMFFIUI6.js.map} +0 -0
  100. /package/dist/{chunk-IZYYKE5F.js.map → chunk-R2GIGE5H.js.map} +0 -0
  101. /package/dist/{chunk-55DOBEGD.js.map → chunk-RIRPLFPN.js.map} +0 -0
  102. /package/dist/{chunk-3M2BIQLZ.js.map → chunk-TDMBTG7U.js.map} +0 -0
  103. /package/dist/{chunk-6YDPTTIY.js.map → chunk-TW3V6FSH.js.map} +0 -0
  104. /package/dist/{chunk-SRUBDR3Z.js.map → chunk-VPSF5LEM.js.map} +0 -0
  105. /package/dist/{chunk-4VPN5MHS.js.map → chunk-W24TJJNN.js.map} +0 -0
  106. /package/dist/{chunk-DBPDAG7N.js.map → chunk-WDSTW3BD.js.map} +0 -0
  107. /package/dist/{chunk-XLY5ZJRP.js.map → chunk-WJAFE3Z6.js.map} +0 -0
  108. /package/dist/{chunks-LV5EJBZ4.js.map → chunks-AL4P5TO5.js.map} +0 -0
  109. /package/dist/{formula-4GRNVWIQ.js.map → formula-DSB574H7.js.map} +0 -0
  110. /package/dist/{formula-6Y467S4R.js.map → formula-U2LZ67KI.js.map} +0 -0
  111. /package/dist/{image-ocr-CGJJCD4E.js.map → image-ocr-3QB2HLSI.js.map} +0 -0
  112. /package/dist/{image-ocr-ZLL66KNO.js.map → image-ocr-J54Q3YWP.js.map} +0 -0
  113. /package/dist/{model-bundle-RD4KSNTB.js.map → model-bundle-CGWU4ALC.js.map} +0 -0
  114. /package/dist/{models-OLGCZBXI.js.map → models-A3TF3BDV.js.map} +0 -0
  115. /package/dist/{parser-IHCFHLHN.js.map → parser-C3ARF26I.js.map} +0 -0
  116. /package/dist/{parser-J22QBXPP.js.map → parser-OBGWEWSU.js.map} +0 -0
  117. /package/dist/{pdf-ocr-H2247ZZH.js.map → pdf-ocr-ENLVEEYL.js.map} +0 -0
  118. /package/dist/{pdf-ocr-TYIH23RP.js.map → pdf-ocr-K53REDNY.js.map} +0 -0
  119. /package/dist/{profile-io-GH3TYTNJ.js.map → profile-io-ZGFEO7CB.js.map} +0 -0
  120. /package/dist/{rasterize-7TFTVFMB.js.map → rasterize-QMC2SAUT.js.map} +0 -0
  121. /package/dist/{redact-doc-DSSQOO3A.js.map → redact-doc-JH6RZZBE.js.map} +0 -0
  122. /package/dist/{render-NKXZQINI.js.map → render-ZGKQLKPJ.js.map} +0 -0
  123. /package/dist/{seal-JIVSSI3Z.js.map → seal-KMGYTJAV.js.map} +0 -0
  124. /package/dist/{setup-JVLMX2TH.js.map → setup-LAQGCYQ2.js.map} +0 -0
  125. /package/dist/{visual-BKVZN6HP.js.map → visual-4OYJFGXL.js.map} +0 -0
  126. /package/dist/{watch-5RZVHAKI.js.map → watch-7YPB4TKC.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -1760,7 +1760,7 @@ interface BlockFinding {
1760
1760
  block: string | null;
1761
1761
  /** 블록 글 안 위치(0부터, UTF-16) — 블록 전체에 걸린 지적(문체 등)은 null */
1762
1762
  offset: number | null;
1763
- /** match 길이(UTF-16) */
1763
+ /** 블록 안에서 걸린 길이(UTF-16) — 지적 글이 칸 경계를 넘으면 블록 끝까지 */
1764
1764
  length: number;
1765
1765
  category: "notation" | "munche" | "slop" | "logic" | "budget";
1766
1766
  rule: string;
package/dist/index.d.ts CHANGED
@@ -1760,7 +1760,7 @@ interface BlockFinding {
1760
1760
  block: string | null;
1761
1761
  /** 블록 글 안 위치(0부터, UTF-16) — 블록 전체에 걸린 지적(문체 등)은 null */
1762
1762
  offset: number | null;
1763
- /** match 길이(UTF-16) */
1763
+ /** 블록 안에서 걸린 길이(UTF-16) — 지적 글이 칸 경계를 넘으면 블록 끝까지 */
1764
1764
  length: number;
1765
1765
  category: "notation" | "munche" | "slop" | "logic" | "budget";
1766
1766
  rule: string;
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  blocksToPages,
3
3
  bmpToPng,
4
4
  inlineImagesIntoMarkdown
5
- } from "./chunk-P35SCAJN.js";
5
+ } from "./chunk-3HN65YAL.js";
6
6
  import {
7
7
  parsePageRange
8
8
  } from "./chunk-V4BH5SRQ.js";
@@ -43,7 +43,7 @@ import {
43
43
  validateOcrOptions,
44
44
  visibleText,
45
45
  wrapScript
46
- } from "./chunk-6YDPTTIY.js";
46
+ } from "./chunk-TW3V6FSH.js";
47
47
  import {
48
48
  KordocError,
49
49
  OPTIONAL_DEP_INSTALL_HINT,
@@ -61,7 +61,7 @@ import {
61
61
  toArrayBuffer,
62
62
  unescapeHtml,
63
63
  unzipLimitBytes
64
- } from "./chunk-XLY5ZJRP.js";
64
+ } from "./chunk-WJAFE3Z6.js";
65
65
 
66
66
  // src/plain-markdown.ts
67
67
  function toPlainMarkdown(md2) {
@@ -24620,7 +24620,7 @@ var MIN_SIDE = 24;
24620
24620
  async function ocrEmbeddedImages(blocks, options, warnings) {
24621
24621
  const ocr = options?.ocr;
24622
24622
  if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
24623
- const { parseImageDocument } = await import("./image-ocr-ZLL66KNO.js");
24623
+ const { parseImageDocument } = await import("./image-ocr-J54Q3YWP.js");
24624
24624
  let inserted = false, unreadable = 0;
24625
24625
  let failed = null;
24626
24626
  const walk = async (list, depth) => {
@@ -45290,6 +45290,11 @@ function scheduleLineYear(m) {
45290
45290
  const before2 = (m.input ?? "").slice(Math.max(0, at - 40), at);
45291
45291
  return SCHEDULE_LEADER.test(before2) ? null : "";
45292
45292
  }
45293
+ var calcLineCache;
45294
+ function isCalcLine(line) {
45295
+ if (calcLineCache?.line !== line) calcLineCache = { line, calc: /[×✕]|\s=\s/.test(line) };
45296
+ return calcLineCache.calc;
45297
+ }
45293
45298
  var WEEKDAYS = "\uC77C\uC6D4\uD654\uC218\uBAA9\uAE08\uD1A0";
45294
45299
  function weekdayCheck(m) {
45295
45300
  const [y, mo, d] = [Number(m[1]), Number(m[2]), Number(m[3])];
@@ -45400,7 +45405,7 @@ var RULES = [
45400
45405
  severity: "error",
45401
45406
  pattern: /(?<![\d,])\d+\s*천\s*원/g,
45402
45407
  skipTable: true,
45403
- check: (m) => /[×✕]|\s=\s/.test(m.input ?? "") ? null : "",
45408
+ check: (m) => isCalcLine(m.input ?? "") ? null : "",
45404
45409
  message: "\uAE08\uC561\uC740 '\uCC9C\uC6D0'\uC73C\uB85C \uC904\uC774\uC9C0 \uC54A\uACE0 \uC544\uB77C\uBE44\uC544 \uC22B\uC790\uB85C",
45405
45410
  suggest: "\uC608) 345,000\uC6D0"
45406
45411
  },
@@ -46333,7 +46338,7 @@ var NUM = String.raw`\d[\d,]*(?:\.\d+)?`;
46333
46338
  var MUL = String.raw`[×xX*✕]`;
46334
46339
  var FACTOR = String.raw`${NUM}\s{0,2}(?:%|[가-힣]{1,3})?`;
46335
46340
  var CALC_RE = new RegExp(
46336
- String.raw`(?<![\d,.])(?<![+\-−×xX*✕)]\s{0,3})(${FACTOR}(?:\s{0,3}${MUL}\s{0,3}${FACTOR}){1,8})\s{0,3}=\s{0,3}(${NUM})\s{0,2}(원|천원|만원|백만원|억원)`,
46341
+ String.raw`(?<![\d,.])(?<![+−×xX✕]\s{0,8})(?<!\S\s{0,8}[\-*]\s{0,8})(${FACTOR}(?:\s{0,3}${MUL}\s{0,3}${FACTOR}){1,8})\s{0,3}=\s{0,3}(${NUM})\s{0,2}(원|천원|만원|백만원|억원)`,
46337
46342
  "g"
46338
46343
  );
46339
46344
  var FACTOR_RE = new RegExp(String.raw`(${NUM})\s{0,2}(%|[가-힣]{1,3})?`, "g");
@@ -46380,8 +46385,9 @@ function checkCalc(line, no, out) {
46380
46385
  });
46381
46386
  }
46382
46387
  }
46383
- var SUBTOTAL_RE = /^소\s*계$/;
46388
+ var SUBTOTAL_RE = /^소\s*계\s*(?:\([^)]{1,10}\))?$/;
46384
46389
  var NON_ADDITIVE_HEAD = /률|율|비율|%|단가|평균/;
46390
+ var NON_ADDITIVE_ROW = /^(?:구성비|비중|평균|단가|환율|[가-힣]{0,4}(?:비율|증감률|증감율|집행률|집행율|달성률|달성율))(?:\(%\))?$/;
46385
46391
  var plainCell = (c) => c.replace(/[*_`]/g, "").trim();
46386
46392
  function cellNum(c) {
46387
46393
  const t = plainCell(c);
@@ -46421,7 +46427,7 @@ function checkTable(rows, out) {
46421
46427
  });
46422
46428
  }
46423
46429
  const subs = body.filter((r) => SUBTOTAL_RE.test(label(r)));
46424
- const parts = subs.length ? subs : body.filter((r) => r !== total);
46430
+ const parts = subs.length ? subs : body.filter((r) => r !== total && !NON_ADDITIVE_ROW.test(label(r).replace(/\s+/g, "")));
46425
46431
  for (let c = 0; c < cols; c++) {
46426
46432
  const cell2 = plainCell(total.cells[c] ?? "");
46427
46433
  if (cell2 === "" || cell2 === "-" || cell2 === "\u2013" || NON_ADDITIVE_HEAD.test(plainCell(rows[0].cells[c] ?? ""))) continue;
@@ -46690,6 +46696,7 @@ function runLintSuite(text, opts = {}) {
46690
46696
  var MARKDOWN_STRUCTURE = /^\s*(?:```|~~~|#|\||>)/;
46691
46697
  var safeLine = (text) => text.replace(/[\r\n]/g, " ");
46692
46698
  var safeCell = (text) => safeLine(text).replace(/\|/g, "\uFF5C");
46699
+ var MAX_DENSE_CELLS = 1e5;
46693
46700
  function blocksToLines(blocks) {
46694
46701
  const lines = [];
46695
46702
  const paragraph = (block) => {
@@ -46714,12 +46721,23 @@ function blocksToLines(blocks) {
46714
46721
  }
46715
46722
  const rows = cells.reduce((n, c) => Math.max(n, c.table.row + 1), 0);
46716
46723
  const cols = cells.reduce((n, c) => Math.max(n, c.table.col + 1), 0);
46717
- const at = new Map(cells.map((c) => [`${c.table.row},${c.table.col}`, c]));
46724
+ const range = (n) => Array.from({ length: n }, (_, i) => i);
46725
+ const used = (k) => [...new Set(cells.map((c) => c.table[k]))].sort((a, b2) => a - b2);
46726
+ const dense = rows * cols <= Math.max(MAX_DENSE_CELLS, cells.length * 4);
46727
+ const rowNos = dense ? range(rows) : used("row");
46728
+ const colNos = dense ? range(cols) : used("col");
46729
+ const at = /* @__PURE__ */ new Map();
46730
+ for (const c of cells) {
46731
+ const key = `${c.table.row},${c.table.col}`;
46732
+ const before2 = at.get(key);
46733
+ if (before2) paragraph(before2);
46734
+ at.set(key, c);
46735
+ }
46718
46736
  lines.push({ text: "", segments: [] });
46719
- for (let r = 0; r < rows; r++) {
46737
+ for (const [ri, r] of rowNos.entries()) {
46720
46738
  let text = "|";
46721
46739
  const segments = [];
46722
- for (let c = 0; c < cols; c++) {
46740
+ for (const c of colNos) {
46723
46741
  text += " ";
46724
46742
  const cell2 = at.get(`${r},${c}`);
46725
46743
  if (cell2) {
@@ -46730,7 +46748,7 @@ function blocksToLines(blocks) {
46730
46748
  text += " |";
46731
46749
  }
46732
46750
  lines.push({ text, segments });
46733
- if (r === 0) lines.push({ text: "|" + " --- |".repeat(cols), segments: [] });
46751
+ if (ri === 0) lines.push({ text: "|" + " --- |".repeat(colNos.length), segments: [] });
46734
46752
  }
46735
46753
  lines.push({ text: "", segments: [] });
46736
46754
  }
@@ -46745,7 +46763,8 @@ function locate(lines, f) {
46745
46763
  if (seg2) {
46746
46764
  const found = line.text.indexOf(f.match, Math.max(seg2.start, at));
46747
46765
  const start = found >= seg2.start && found < seg2.start + seg2.length ? found : at;
46748
- return { block: seg2.block, offset: Math.min(Math.max(0, start - seg2.start), seg2.length) };
46766
+ const offset = Math.min(Math.max(0, start - seg2.start), seg2.length);
46767
+ return { block: seg2.block, offset, room: seg2.length - offset };
46749
46768
  }
46750
46769
  return { block: null, offset: null };
46751
46770
  }
@@ -46754,7 +46773,7 @@ function locate(lines, f) {
46754
46773
  const body = line.text.slice(seg.start, seg.start + seg.length);
46755
46774
  const first = f.match ? body.indexOf(f.match) : -1;
46756
46775
  const unique = first >= 0 && body.indexOf(f.match, first + 1) < 0;
46757
- return { block: seg.block, offset: unique ? first : null };
46776
+ return { block: seg.block, offset: unique ? first : null, ...unique ? { room: seg.length - first } : {} };
46758
46777
  }
46759
46778
  function lintBlocks(blocks, opts = {}) {
46760
46779
  const lines = blocksToLines(blocks);
@@ -46762,11 +46781,12 @@ function lintBlocks(blocks, opts = {}) {
46762
46781
  const findings = [];
46763
46782
  const take = (category, list) => {
46764
46783
  for (const f of list ?? []) {
46765
- const { block, offset } = locate(lines, f);
46784
+ const { block, offset, room } = locate(lines, f);
46785
+ const length = room === void 0 ? f.match.length : Math.min(f.match.length, room);
46766
46786
  findings.push({
46767
46787
  block,
46768
46788
  offset,
46769
- length: f.match.length,
46789
+ length,
46770
46790
  category,
46771
46791
  rule: f.rule,
46772
46792
  severity: f.severity,
@@ -52442,7 +52462,7 @@ function tableColumnBoundaries(constraints, count, total, noExactRow = false) {
52442
52462
  const lp = longestPathBoundaries(constraints, count);
52443
52463
  return lp && Math.abs(lp.x[count] - total) <= 2 && (noExactRow || lp.x.every((v, k) => Math.abs(v - prop[k]) <= 2 || lp.tight[k])) ? lp.x : prop;
52444
52464
  }
52445
- function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY) {
52465
+ function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY, shrinkLast = false) {
52446
52466
  const h = new Array(rowCount).fill(0);
52447
52467
  for (const c of cells) {
52448
52468
  if (c.rowSpan === 1 && c.rowAddr >= 0 && c.rowAddr < rowCount) {
@@ -52489,6 +52509,9 @@ function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY) {
52489
52509
  total += add;
52490
52510
  }
52491
52511
  }
52512
+ const last = rowCount - 1, over = total - maxTotal;
52513
+ const lastCells = cells.filter((c) => c.rowAddr + c.rowSpan - 1 === last);
52514
+ if (shrinkLast && over > 0 && last >= 0 && lastCells.length && lastCells.every((c) => c.rowSpan === 1 && c.contentH != null && c.contentH <= h[last] - over)) h[last] -= over;
52492
52515
  return h;
52493
52516
  }
52494
52517
 
@@ -52752,9 +52775,9 @@ function cellContentExtent(cell2, memo) {
52752
52775
  const pos = findChildByLocalName(o.el, "pos");
52753
52776
  if ((pos?.getAttribute("vertRelTo") ?? "PARA") !== "PARA") continue;
52754
52777
  const om = findChildByLocalName(o.el, "outMargin");
52755
- const pushed = baseV - (num2(om, "top") + o.height + num2(om, "bottom"));
52756
- const anchor = pushed >= (paraStart > 0 ? paraStart - 100 : -100) ? pushed : baseV - (memo?.paraGeom?.get(p.getAttribute("paraPrIDRef") ?? "")?.spaceBefore ?? 0);
52757
52778
  const vo = num2(pos, "vertOffset");
52779
+ const pushed = baseV - (Math.max(0, vo) + num2(om, "top") + o.height + num2(om, "bottom"));
52780
+ const anchor = pushed >= (paraStart > 0 ? paraStart - 100 : -100) ? pushed : baseV - (memo?.paraGeom?.get(p.getAttribute("paraPrIDRef") ?? "")?.spaceBefore ?? 0);
52758
52781
  const oh = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
52759
52782
  ext = Math.max(ext, anchor + num2(om, "top") + Math.max(0, vo) + oh);
52760
52783
  }
@@ -52800,6 +52823,21 @@ function collectCells(tbl2) {
52800
52823
  }
52801
52824
  return cells;
52802
52825
  }
52826
+ function inCell(el) {
52827
+ for (let n = el.parentNode; n; n = n.parentNode) if (ln(n) === "tc") return true;
52828
+ return false;
52829
+ }
52830
+ function splitSaved(c) {
52831
+ let prev = Number.NEGATIVE_INFINITY;
52832
+ for (const p of c.sub ? elements(c.sub) : []) {
52833
+ if (ln(p) !== "p") continue;
52834
+ for (const s of buildPara(p).segs) {
52835
+ if (s.vertpos < prev) return true;
52836
+ prev = s.vertpos;
52837
+ }
52838
+ }
52839
+ return false;
52840
+ }
52803
52841
  function measureTableRowHeights(tbl2, memo) {
52804
52842
  const cells = collectCells(tbl2);
52805
52843
  if (cells.length === 0 || cells.length > 4096) return [];
@@ -52810,7 +52848,8 @@ function measureTableRowHeights(tbl2, memo) {
52810
52848
  // (같은 판 PDF: 두 줄 든 2행 병합 칸 내용 2882 > 저장 2564 → 둘째 행이 318 자라고 첫 행은 그대로)
52811
52849
  cells.map((c) => ({ rowAddr: c.ra, rowSpan: c.rs, height: (c.rs > 1 ? Math.max(c.h, cellContentExtent(c, memo) + c.marginT + c.marginB) : c.h) - sp * (c.rs - 1), contentH: c.rs === 1 ? cellContentExtent(c, memo) + c.marginT + c.marginB : void 0 })),
52812
52850
  nRows,
52813
- num2(findChildByLocalName(tbl2, "sz"), "height") - (sp > 0 ? sp * (nRows + 1) : 0) || Number.POSITIVE_INFINITY
52851
+ num2(findChildByLocalName(tbl2, "sz"), "height") - (sp > 0 ? sp * (nRows + 1) : 0) || Number.POSITIVE_INFINITY,
52852
+ !inCell(tbl2) && !cells.some((c) => c.ra + c.rs === nRows && splitSaved(c))
52814
52853
  );
52815
52854
  if (sp > 0) {
52816
52855
  for (let r = 0; r < rows.length; r++) rows[r] += sp;
@@ -54770,7 +54809,8 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
54770
54809
  rem = Math.max(rem, end - ls[k][0] + c.marginT + c.marginB);
54771
54810
  }
54772
54811
  if (allFit) {
54773
- if (!first && h <= pageBottom - contTop && rowCells.some((c) => cellContentExtent(c) + c.marginT + c.marginB > avail)) {
54812
+ const spanCells = cells.filter((c) => c.ra === r && c.rs > 1);
54813
+ if (!first && h <= pageBottom - contTop && [...rowCells, ...spanCells].some((c) => cellContentExtent(c) + c.marginT + c.marginB > avail)) {
54774
54814
  page++;
54775
54815
  y = contTop;
54776
54816
  first = true;
@@ -54968,9 +55008,11 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local2 = false) {
54968
55008
  function linePushedBy(o, lineV, paraTop) {
54969
55009
  if (paraTop === void 0) return false;
54970
55010
  const om = findChildByLocalName(o.el, "outMargin");
54971
- return Math.abs(lineV - (num2(om, "top") + o.height + num2(om, "bottom")) - paraTop) <= 10;
55011
+ const pos = findChildByLocalName(o.el, "pos");
55012
+ const raw = num2(pos, "vertOffset"), vo = (pos?.getAttribute("vertRelTo") ?? "PARA") === "PARA" ? Math.max(0, raw >= 2 ** 31 ? raw - 2 ** 32 : raw) : 0;
55013
+ return Math.abs(lineV - (vo + num2(om, "top") + o.height + num2(om, "bottom")) - paraTop) <= 10;
54972
55014
  }
54973
- function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, laterLineH) {
55015
+ function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, lineH, lineSB = 0) {
54974
55016
  const { PW, PH, ML, MT, BODY_W, BODY_H } = ctx.geom;
54975
55017
  const pos = findChildByLocalName(o.el, "pos");
54976
55018
  const om = findChildByLocalName(o.el, "outMargin");
@@ -54992,13 +55034,14 @@ function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = fals
54992
55034
  y = va === "BOTTOM" ? MT + BODY_H - h - vo : va === "CENTER" ? MT + (BODY_H - h) / 2 + vo : MT + vo;
54993
55035
  } else if (wrap === "TOP_AND_BOTTOM") {
54994
55036
  const lineV = anchorLineV ?? baseV;
54995
- const pushed = lineV - (omT + h + omB);
54996
- const below = laterLineH !== void 0 && vo + omT >= laterLineH;
54997
- const anchor = below ? lineV : stayLine !== false ? lineV - stayLine : pushed >= -100 ? pushed : paraStartV !== void 0 ? paraStartV : lineV;
55037
+ const pushed = lineV - (vo + omT + h + omB);
55038
+ const below = lineH !== void 0 && vo + omT >= lineH && !(paraStartV !== void 0 && Math.abs(pushed - paraStartV) <= 10);
55039
+ const anchor = below ? lineV - lineSB : stayLine !== false ? lineV - stayLine : pushed >= -100 ? pushed : paraStartV !== void 0 ? paraStartV : lineV;
54998
55040
  y = oy + anchor + omT + vo;
54999
55041
  } else {
55000
55042
  const origin = vrel === "PARA" && wrap === "SQUARE" ? paraStartV ?? baseV : baseV;
55001
- y = oy + Math.max(origin + vo, wrap === "SQUARE" && anchorLineV !== void 0 ? anchorLineV : -Infinity) + omT;
55043
+ const later = vrel === "PARA" && wrap === "SQUARE" && anchorLineV !== void 0 && anchorLineV > baseV;
55044
+ y = later ? oy + anchorLineV + vo + omT : oy + Math.max(origin + vo, wrap === "SQUARE" && anchorLineV !== void 0 ? anchorLineV : -Infinity) + omT;
55002
55045
  }
55003
55046
  let x;
55004
55047
  const omL = num2(om, "left"), omR = num2(om, "right");
@@ -55297,6 +55340,7 @@ function planLines(m, styles, numText = "") {
55297
55340
  }
55298
55341
  if (fixedTo > start) fixedW = lineNaturalWidth(m, styles, start, fixedTo).text + [...tabs.values()].reduce((a, b) => a + b, 0);
55299
55342
  let textEnd = Math.min(end, m.chars.length);
55343
+ while (textEnd > fixedTo && m.chars[textEnd - 1].br) textEnd--;
55300
55344
  while (textEnd > fixedTo && m.chars[textEnd - 1].ch === " ") textEnd--;
55301
55345
  const nat = lineNaturalWidth(m, styles, fixedTo, textEnd);
55302
55346
  for (const o of m.objs) if (o.inline && o.index >= textEnd && o.index < end) nat.obj += o.omL + o.width + o.omR;
@@ -55516,6 +55560,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
55516
55560
  if (gOpenOn >= 0) ctx.pages[gOpenOn].push("</g>");
55517
55561
  if (paraRegionId) ctx.parentStack.push(paraRegionId);
55518
55562
  let tbStack;
55563
+ let tbStackTop;
55519
55564
  for (const o of m.objs) {
55520
55565
  if (o.inline) {
55521
55566
  let planIdx = 0;
@@ -55560,21 +55605,26 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
55560
55605
  const sbA = m.paraPrId != null ? ctx.styles.paraGeom.get(m.paraPrId)?.spaceBefore ?? 0 : 0;
55561
55606
  if (stay && wrapA === "TOP_AND_BOTTOM" && linePushedBy(o, anchorLineV ?? baseV, pTop ?? (depth > 0 ? cellParaTop(p, ctx.styles.paraGeom) : void 0))) stay = false;
55562
55607
  const firstLine = anchorLineV === void 0 || anchorLineV === baseV;
55563
- 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);
55564
- if (depth === 0 && tbFloats >= 2 && wrapA === "TOP_AND_BOTTOM") {
55608
+ 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, anchorLineH, firstLine ? sbA : 0);
55609
+ let stackTop = depth === 0 ? pTop ?? 0 : cellParaTop(p, ctx.styles.paraGeom);
55610
+ if (tbFloats >= 2 && wrapA === "TOP_AND_BOTTOM" && stackTop !== void 0) {
55565
55611
  if (!tbStack) {
55566
55612
  tbStack = /* @__PURE__ */ new Map();
55567
- let below = 0;
55613
+ const placed = [];
55568
55614
  const stackable = m.objs.filter((q) => !q.inline && (q.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM") === "TOP_AND_BOTTOM" && (findChildByLocalName(q.el, "pos")?.getAttribute("vertRelTo") ?? "PARA") === "PARA" && findChildByLocalName(q.el, "pos")?.getAttribute("allowOverlap") !== "1");
55569
55615
  for (const q of stackable.length >= 2 ? stackable.sort((a, b) => a.index - b.index) : []) {
55570
- const omQ = findChildByLocalName(q.el, "outMargin"), raw = num2(findChildByLocalName(q.el, "pos"), "vertOffset");
55571
- const top = Math.max(below, raw >= 2 ** 31 ? raw - 2 ** 32 : raw);
55616
+ const posQ = findChildByLocalName(q.el, "pos"), omQ = findChildByLocalName(q.el, "outMargin"), raw = num2(posQ, "vertOffset");
55617
+ const x0 = num2(posQ, "horzOffset"), x1 = x0 + num2(omQ, "left") + q.width + num2(omQ, "right");
55618
+ const below = Math.max(0, ...placed.filter((r) => r.x0 < x1 && x0 < r.x1).map((r) => r.bottom));
55619
+ const top = Math.max(below, depth > 0 ? Math.max(0, raw) : raw);
55572
55620
  tbStack.set(q.el, top + num2(omQ, "top"));
55573
- below = top + num2(omQ, "top") + (q.tag === "tbl" ? Math.max(q.height, measureTableHeight(q.el, ctx.extentMemo)) : q.height) + num2(omQ, "bottom");
55621
+ placed.push({ x0, x1, bottom: top + num2(omQ, "top") + (q.tag === "tbl" ? Math.max(q.height, measureTableHeight(q.el, ctx.extentMemo)) : q.height) + num2(omQ, "bottom") });
55574
55622
  }
55623
+ if (depth > 0 && placed.length) tbStackTop = Math.max(stackTop, baseV - Math.max(...placed.map((r) => r.bottom)));
55575
55624
  }
55625
+ if (depth > 0 && tbStackTop !== void 0) stackTop = tbStackTop;
55576
55626
  const st = tbStack.get(o.el);
55577
- if (st !== void 0) y = oy + (pTop ?? 0) + st;
55627
+ if (st !== void 0) y = oy + stackTop + st;
55578
55628
  }
55579
55629
  const moved = ctx.objPlace?.get(o.el);
55580
55630
  if (moved) {
@@ -55797,7 +55847,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
55797
55847
  const slack = ctx.geom.PH - ctx.geom.MT - ctx.geom.BODY_H;
55798
55848
  const splitHere = depth === 1 || !!ctx.splitCell && findChildByLocalName(tbl2, "pos")?.getAttribute("treatAsChar") !== "1";
55799
55849
  const plan = splitHere ? planTableRows(tbl2, cells, rowH, ty, ctx.geom.MT, ctx.geom.BODY_H, slack, cellFloatSpan(ctx.geom.MT, ctx.geom.BODY_H, ctx.extentMemo, slack), depth !== 1, depth !== 1 && ctx.splitContMT !== void 0 ? ctx.splitContMT : ctx.geom.MT) : rowH.map((h, r) => [{ page: 0, y: ty + rowY[r], h }]);
55800
- const splitSaved = ctx.splitCell;
55850
+ const splitSaved2 = ctx.splitCell;
55801
55851
  ctx.splitCell = false;
55802
55852
  for (const pc of plan.flat()) for (const [el, py] of pc.place ?? []) (ctx.objPlace ??= /* @__PURE__ */ new Map()).set(el, { page: startPage + pc.page, y: py });
55803
55853
  const contPages = [...new Set(plan.flat().map((pc) => pc.page).filter((pg) => pg > 0))].map((pg) => startPage + pg);
@@ -55917,7 +55967,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
55917
55967
  if (bf.right) emit(ctx, edgeLine(g3.x + g3.w, g3.y, g3.x + g3.w, g3.y + g3.h, bf.right));
55918
55968
  }
55919
55969
  ctx.page = startPage;
55920
- ctx.splitCell = splitSaved;
55970
+ ctx.splitCell = splitSaved2;
55921
55971
  ctx.parentStack.pop();
55922
55972
  emit(ctx, "</g>");
55923
55973
  }
@@ -56076,6 +56126,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
56076
56126
  }
56077
56127
  const paraSegPages = /* @__PURE__ */ new Map();
56078
56128
  const paraTops = /* @__PURE__ */ new Map();
56129
+ const backPlace = /* @__PURE__ */ new Map();
56079
56130
  const geom0 = ctxBase.styles.paraGeom;
56080
56131
  let tableEndPage = -1;
56081
56132
  let nPages = 1;
@@ -56087,6 +56138,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
56087
56138
  let cur = 0, col = 0;
56088
56139
  let pendingEnd = 0, pendingEndY = 0;
56089
56140
  let lastEnd = 0, lastPage = -1;
56141
+ let lastSA = 0;
56090
56142
  let prevSeg;
56091
56143
  for (const p of elements(root)) {
56092
56144
  if (ln(p) !== "p") continue;
@@ -56124,6 +56176,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
56124
56176
  if (prevSeg.p !== p) {
56125
56177
  lastPage = cur;
56126
56178
  lastEnd = v;
56179
+ lastSA = 0;
56127
56180
  }
56128
56181
  }
56129
56182
  }
@@ -56137,11 +56190,13 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
56137
56190
  prevEnd = v + num2(s, "vertsize") + num2(s, "spacing");
56138
56191
  }
56139
56192
  paraSegPages.set(p, pagesOf);
56140
- if (segEls.length) paraTops.set(p, pagesOf[0] === lastPage ? lastEnd : 0);
56193
+ const prevEnd0 = lastEnd, prevPage0 = lastPage;
56194
+ if (segEls.length) paraTops.set(p, pagesOf[0] === lastPage ? lastEnd + lastSA : 0);
56141
56195
  if (segEls.length) {
56142
56196
  const ls = segEls[segEls.length - 1];
56143
56197
  lastEnd = num2(ls, "vertpos") + num2(ls, "vertsize") + num2(ls, "spacing");
56144
56198
  lastPage = pagesOf[pagesOf.length - 1];
56199
+ lastSA = geom0.get(p.getAttribute("paraPrIDRef") ?? "")?.spaceAfter ?? 0;
56145
56200
  }
56146
56201
  if (!localCols && segEls.length) {
56147
56202
  const m0 = buildPara(p);
@@ -56153,6 +56208,13 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
56153
56208
  const segV = num2(segEls[segK], "vertpos");
56154
56209
  const h = Math.max(o.height, measureTableHeight(o.el, ctxBase.extentMemo)), omT = num2(om, "top"), omB = num2(om, "bottom");
56155
56210
  const pushed = segV - (omT + h + omB);
56211
+ if (!o.inline && segK === 0 && pushed < -100 && prevPage0 >= 0 && pagesOf[0] === prevPage0 + 1 && (o.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM") === "TOP_AND_BOTTOM") {
56212
+ const back = tableContPages(o.el, MT + prevEnd0 + omT, MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H, cellFloatSpan(MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H));
56213
+ if (back.pages === 1 && Math.abs(back.endY - MT + omB - segV) <= 300) {
56214
+ backPlace.set(o.el, { page: prevPage0, y: MT + prevEnd0 + omT });
56215
+ continue;
56216
+ }
56217
+ }
56156
56218
  const nTb = m0.objs.filter((q) => !q.inline && (q.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM") === "TOP_AND_BOTTOM").length;
56157
56219
  const wrapP = o.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM";
56158
56220
  const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? geom0.get(m0.paraPrId)?.spaceBefore ?? 0 : 0;
@@ -56160,7 +56222,8 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
56160
56222
  const nonPush = wrapP !== "TOP_AND_BOTTOM" && pTop !== void 0 && segV > pTop + sbP + 100 ? pTop + sbP : void 0;
56161
56223
  const voP = Math.max(0, toInt32(pos?.getAttribute("vertOffset") ?? void 0, 0));
56162
56224
  const paraStart = segK === 0 && pTop !== void 0 && pTop < segV ? pTop : segV;
56163
- const ty = o.inline ? MT + segV + omT : nonPush !== void 0 ? MT + nonPush + omT + voP : MT + (stay ? segV - sbP : pushed >= -100 ? pushed : paraStart) + omT + voP;
56225
+ const below = !o.inline && wrapP === "TOP_AND_BOTTOM" && voP + omT >= num2(segEls[segK], "textheight") && !linePushedBy(o, segV, pTop);
56226
+ const ty = o.inline ? MT + segV + omT : nonPush !== void 0 ? MT + nonPush + omT + voP : MT + (below ? segV - (segK === 0 ? sbP : 0) : stay ? segV - sbP : pushed - voP >= -100 ? pushed - voP : paraStart) + omT + voP;
56164
56227
  const span2 = tableContPages(o.el, ty, MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H, cellFloatSpan(MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H));
56165
56228
  const anchorPage = pagesOf[segK];
56166
56229
  const sp = !o.inline && !stay && nonPush === void 0 && segV - (omT + o.height + omB) >= -100 && pagesOf.some((pg, j) => j > segK && pg > anchorPage) ? tableContPages(o.el, MT + segV - o.height - omB, MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H, cellFloatSpan(MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H)) : void 0;
@@ -56245,6 +56308,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
56245
56308
  if (geom.mirrorDx) ctx.bodyDx = mirrorDx;
56246
56309
  ctx.cols = multiCol ? { w: colW, gap: colGap } : void 0;
56247
56310
  ctx.paraTops = paraTops;
56311
+ if (backPlace.size) ctx.objPlace = new Map([...ctx.objPlace ?? [], ...backPlace]);
56248
56312
  for (const p of elements(root)) {
56249
56313
  if (ln(p) !== "p") continue;
56250
56314
  drawPara(p, ML, MT, BODY_W, ctx, 0, paraSegPages.get(p));
@@ -56364,7 +56428,7 @@ function drawPageNumbers(root, paraPages, ctx) {
56364
56428
  const side = decl.el.getAttribute("sideChar") ?? "";
56365
56429
  const pnId = ctx.styles.pageNumCharPr ?? decl.prId;
56366
56430
  const st = (pnId != null ? ctx.styles.charPr.get(pnId) : void 0) ?? DEFAULT_CHAR;
56367
- const { PW, PH, ML, BODY_W } = ctx.geom;
56431
+ const { PH, ML, BODY_W } = ctx.geom;
56368
56432
  const pagePr = findFirst(root, "pagePr"), margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
56369
56433
  const h = 1e3;
56370
56434
  for (let page = decl.page; page < ctx.pages.length; page++) {
@@ -56372,7 +56436,7 @@ function drawPageNumbers(root, paraPages, ctx) {
56372
56436
  const n = ctx.pageBase + page + 1;
56373
56437
  const text = side ? `${side} ${formatHeadNumber2(n, decl.el.getAttribute("formatType") ?? "DIGIT")} ${side}` : formatHeadNumber2(n, decl.el.getAttribute("formatType") ?? "DIGIT");
56374
56438
  const w = measureTextWidth(text, h, 100, { faceClass: faceClassOf(st.face) });
56375
- const x = /LEFT/.test(pos) ? ML : /RIGHT/.test(pos) ? ML + BODY_W - w : (PW - w) / 2;
56439
+ const x = /LEFT/.test(pos) ? ML : /RIGHT/.test(pos) ? ML + BODY_W - w : ML + (BODY_W - w) / 2;
56376
56440
  const y = /^TOP/.test(pos) ? num2(margin, "top", 5668) - 225 : num2(margin, "footer", 0) > 0 ? PH - num2(margin, "bottom", 4252) - 225 : PH - Math.round(num2(margin, "bottom", 4252) / 2) - 243;
56377
56441
  const attrs = [`x="${pt2(x)}"`, `y="${pt2(y)}"`, `font-size="${pt2(h)}"`];
56378
56442
  if (st.fontFamily) attrs.push(`font-family="${escapeXml7(st.fontFamily)}"`);
@@ -57541,7 +57605,7 @@ function scriptsOff(r, off) {
57541
57605
  }
57542
57606
  async function parseImage(buffer, options) {
57543
57607
  try {
57544
- const { parseImageDocument } = await import("./image-ocr-ZLL66KNO.js");
57608
+ const { parseImageDocument } = await import("./image-ocr-J54Q3YWP.js");
57545
57609
  const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
57546
57610
  stripScriptTags({ blocks });
57547
57611
  return {
@@ -57605,7 +57669,7 @@ async function parseHwp(buffer, options) {
57605
57669
  async function parsePdf(buffer, options) {
57606
57670
  let parsePdfDocument;
57607
57671
  try {
57608
- const mod = await import("./parser-J22QBXPP.js");
57672
+ const mod = await import("./parser-OBGWEWSU.js");
57609
57673
  parsePdfDocument = mod.parsePdfDocument;
57610
57674
  } catch {
57611
57675
  return {