kordoc 4.22.1 → 4.22.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 (125) hide show
  1. package/README.md +4 -1
  2. package/dist/{-FYKHW5G6.js → -C437ZARA.js} +11 -11
  3. package/dist/{chunk-5SVJU22Z.js → chunk-2X64TI7I.js} +2 -2
  4. package/dist/{chunk-JHHXTNZQ.js → chunk-3LJ6QO53.js} +28 -6
  5. package/dist/chunk-3LJ6QO53.js.map +1 -0
  6. package/dist/{chunk-TSZQ4LMV.js → chunk-4BJZGXNM.js} +2 -2
  7. package/dist/{chunk-3H5QG6I2.js → chunk-4GCS7WJJ.js} +2 -2
  8. package/dist/{chunk-7FASIFQP.js → chunk-56GBOIOE.js} +2 -2
  9. package/dist/{chunk-M2CBEXHN.cjs → chunk-AUWO57ED.cjs} +2 -2
  10. package/dist/{chunk-M2CBEXHN.cjs.map → chunk-AUWO57ED.cjs.map} +1 -1
  11. package/dist/{chunk-5FD3LAKC.js → chunk-AXR7OKQY.js} +2 -2
  12. package/dist/{chunk-IB5TO2CO.js → chunk-CNMUT5YW.js} +2 -2
  13. package/dist/{chunk-ATODI25J.js → chunk-DQXP3ELP.js} +2 -2
  14. package/dist/{chunk-OSFB5SQS.cjs → chunk-EKKZNKJD.cjs} +3 -3
  15. package/dist/{chunk-OSFB5SQS.cjs.map → chunk-EKKZNKJD.cjs.map} +1 -1
  16. package/dist/{chunk-EXVTF6XE.cjs → chunk-ENV25MPM.cjs} +24 -24
  17. package/dist/{chunk-EXVTF6XE.cjs.map → chunk-ENV25MPM.cjs.map} +1 -1
  18. package/dist/{chunk-YE4IN3D7.js → chunk-FPUBEM3F.js} +11 -11
  19. package/dist/{chunk-5VBAHUGC.js → chunk-GFQIKYBV.js} +3 -3
  20. package/dist/{chunk-MDS3GH43.js → chunk-GVBQVXXB.js} +2 -2
  21. package/dist/{chunk-ZECSXHYP.cjs → chunk-I4BS4BXE.cjs} +188 -166
  22. package/dist/{chunk-ZECSXHYP.cjs.map → chunk-I4BS4BXE.cjs.map} +1 -1
  23. package/dist/{chunk-7RND4SNB.js → chunk-IRP6QS3K.js} +3 -3
  24. package/dist/{chunk-R37TFXMP.js → chunk-L6N4OMKR.js} +60 -28
  25. package/dist/chunk-L6N4OMKR.js.map +1 -0
  26. package/dist/{chunk-IK4W2M4P.js → chunk-L6PFPBTK.js} +2 -2
  27. package/dist/{chunk-RO7AORMO.cjs → chunk-MED2MR6O.cjs} +6 -6
  28. package/dist/{chunk-RO7AORMO.cjs.map → chunk-MED2MR6O.cjs.map} +1 -1
  29. package/dist/{chunk-MGJYVNDX.js → chunk-NGDMJICC.js} +29 -7
  30. package/dist/{chunk-JHHXTNZQ.js.map → chunk-NGDMJICC.js.map} +1 -1
  31. package/dist/{chunk-SMPK5TUQ.js → chunk-QFJCEHY7.js} +2 -2
  32. package/dist/{chunk-M4JC7TXG.js → chunk-S4KQUVBV.js} +4 -4
  33. package/dist/{chunk-AIAIBNIB.js → chunk-U3TZVR7A.js} +2 -2
  34. package/dist/{chunk-QH4B3PL7.js → chunk-UMNKY2EZ.js} +4 -4
  35. package/dist/{chunk-DOBJ7BW5.js → chunk-UV2G6XFA.js} +2 -2
  36. package/dist/{chunk-LHO7E3RW.js → chunk-VUC4JJUM.js} +2 -2
  37. package/dist/{chunk-3SPOIAST.js → chunk-YOFKJ7IM.js} +2 -2
  38. package/dist/{chunk-ME4NQSLE.js → chunk-YTEMFVZB.js} +2 -2
  39. package/dist/{chunk-B35C5HJK.cjs → chunk-ZLFUZM7H.cjs} +3 -3
  40. package/dist/{chunk-B35C5HJK.cjs.map → chunk-ZLFUZM7H.cjs.map} +1 -1
  41. package/dist/chunks-MPOOHZVO.js +10 -0
  42. package/dist/cli.js +30 -30
  43. package/dist/{formula-PYDSQGLS.cjs → formula-3TVRNJ66.cjs} +9 -9
  44. package/dist/{formula-PYDSQGLS.cjs.map → formula-3TVRNJ66.cjs.map} +1 -1
  45. package/dist/{formula-JBTYYSKB.js → formula-43QBPAL5.js} +4 -4
  46. package/dist/{formula-RUS4SF3O.js → formula-HUENRCPJ.js} +3 -3
  47. package/dist/{image-ocr-VA6WV6E4.js → image-ocr-BAHDLDV5.js} +6 -6
  48. package/dist/{image-ocr-QJT4EIQU.js → image-ocr-HYAKWJGE.js} +9 -9
  49. package/dist/{image-ocr-PLNNCEOR.cjs → image-ocr-OC3TCXMV.cjs} +17 -17
  50. package/dist/{image-ocr-PLNNCEOR.cjs.map → image-ocr-OC3TCXMV.cjs.map} +1 -1
  51. package/dist/index.cjs +356 -324
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.js +60 -28
  54. package/dist/index.js.map +1 -1
  55. package/dist/mcp.js +22 -22
  56. package/dist/{model-bundle-U2YY7ATC.js → model-bundle-23WBSECG.js} +5 -5
  57. package/dist/{models-BOJ2SFCR.js → models-NRZQY45P.js} +5 -5
  58. package/dist/{parse-worker-v2-ZHMFK3U3.js → parse-worker-v2-DPNXGJ73.js} +12 -12
  59. package/dist/{parser-HM6N7J4R.js → parser-FNUQW2F3.js} +73 -27
  60. package/dist/parser-FNUQW2F3.js.map +1 -0
  61. package/dist/{parser-6337Z4U2.cjs → parser-OKAQRZKM.cjs} +318 -272
  62. package/dist/parser-OKAQRZKM.cjs.map +1 -0
  63. package/dist/{parser-A2EWLK2J.js → parser-XNOLC3MZ.js} +70 -24
  64. package/dist/parser-XNOLC3MZ.js.map +1 -0
  65. package/dist/pdf-ocr-6UXBIQE6.cjs +31 -0
  66. package/dist/{pdf-ocr-PGXNUFU7.cjs.map → pdf-ocr-6UXBIQE6.cjs.map} +1 -1
  67. package/dist/{pdf-ocr-JDER5BHI.js → pdf-ocr-FAGA3O6B.js} +6 -6
  68. package/dist/{pdf-ocr-MEVC6HXG.js → pdf-ocr-N5LYC5LA.js} +9 -9
  69. package/dist/{profile-io-OJ23SPYO.js → profile-io-HC6FMYX4.js} +3 -3
  70. package/dist/{rasterize-76CWCLSU.js → rasterize-QLTROEV2.js} +3 -3
  71. package/dist/{redact-doc-EZQIHRVT.js → redact-doc-V4KMM2QV.js} +11 -11
  72. package/dist/{render-JZFJPFWK.js → render-V4S3QLTR.js} +7 -7
  73. package/dist/seal-MQ5TB5YZ.js +10 -0
  74. package/dist/{setup-RIVS74JN.js → setup-HU7ZOQNM.js} +3 -3
  75. package/dist/visual-RLIFC4XC.js +21 -0
  76. package/dist/{watch-WMH222E5.js → watch-NPIZ6DSJ.js} +12 -12
  77. package/package.json +1 -1
  78. package/dist/chunk-MGJYVNDX.js.map +0 -1
  79. package/dist/chunk-R37TFXMP.js.map +0 -1
  80. package/dist/chunks-4XIAEJEX.js +0 -10
  81. package/dist/parser-6337Z4U2.cjs.map +0 -1
  82. package/dist/parser-A2EWLK2J.js.map +0 -1
  83. package/dist/parser-HM6N7J4R.js.map +0 -1
  84. package/dist/pdf-ocr-PGXNUFU7.cjs +0 -31
  85. package/dist/seal-P2NOP4LC.js +0 -10
  86. package/dist/visual-R5GGZBTU.js +0 -21
  87. /package/dist/{-FYKHW5G6.js.map → -C437ZARA.js.map} +0 -0
  88. /package/dist/{chunk-5SVJU22Z.js.map → chunk-2X64TI7I.js.map} +0 -0
  89. /package/dist/{chunk-TSZQ4LMV.js.map → chunk-4BJZGXNM.js.map} +0 -0
  90. /package/dist/{chunk-3H5QG6I2.js.map → chunk-4GCS7WJJ.js.map} +0 -0
  91. /package/dist/{chunk-7FASIFQP.js.map → chunk-56GBOIOE.js.map} +0 -0
  92. /package/dist/{chunk-5FD3LAKC.js.map → chunk-AXR7OKQY.js.map} +0 -0
  93. /package/dist/{chunk-IB5TO2CO.js.map → chunk-CNMUT5YW.js.map} +0 -0
  94. /package/dist/{chunk-ATODI25J.js.map → chunk-DQXP3ELP.js.map} +0 -0
  95. /package/dist/{chunk-YE4IN3D7.js.map → chunk-FPUBEM3F.js.map} +0 -0
  96. /package/dist/{chunk-5VBAHUGC.js.map → chunk-GFQIKYBV.js.map} +0 -0
  97. /package/dist/{chunk-MDS3GH43.js.map → chunk-GVBQVXXB.js.map} +0 -0
  98. /package/dist/{chunk-7RND4SNB.js.map → chunk-IRP6QS3K.js.map} +0 -0
  99. /package/dist/{chunk-IK4W2M4P.js.map → chunk-L6PFPBTK.js.map} +0 -0
  100. /package/dist/{chunk-SMPK5TUQ.js.map → chunk-QFJCEHY7.js.map} +0 -0
  101. /package/dist/{chunk-M4JC7TXG.js.map → chunk-S4KQUVBV.js.map} +0 -0
  102. /package/dist/{chunk-AIAIBNIB.js.map → chunk-U3TZVR7A.js.map} +0 -0
  103. /package/dist/{chunk-QH4B3PL7.js.map → chunk-UMNKY2EZ.js.map} +0 -0
  104. /package/dist/{chunk-DOBJ7BW5.js.map → chunk-UV2G6XFA.js.map} +0 -0
  105. /package/dist/{chunk-LHO7E3RW.js.map → chunk-VUC4JJUM.js.map} +0 -0
  106. /package/dist/{chunk-3SPOIAST.js.map → chunk-YOFKJ7IM.js.map} +0 -0
  107. /package/dist/{chunk-ME4NQSLE.js.map → chunk-YTEMFVZB.js.map} +0 -0
  108. /package/dist/{chunks-4XIAEJEX.js.map → chunks-MPOOHZVO.js.map} +0 -0
  109. /package/dist/{formula-JBTYYSKB.js.map → formula-43QBPAL5.js.map} +0 -0
  110. /package/dist/{formula-RUS4SF3O.js.map → formula-HUENRCPJ.js.map} +0 -0
  111. /package/dist/{image-ocr-VA6WV6E4.js.map → image-ocr-BAHDLDV5.js.map} +0 -0
  112. /package/dist/{image-ocr-QJT4EIQU.js.map → image-ocr-HYAKWJGE.js.map} +0 -0
  113. /package/dist/{model-bundle-U2YY7ATC.js.map → model-bundle-23WBSECG.js.map} +0 -0
  114. /package/dist/{models-BOJ2SFCR.js.map → models-NRZQY45P.js.map} +0 -0
  115. /package/dist/{parse-worker-v2-ZHMFK3U3.js.map → parse-worker-v2-DPNXGJ73.js.map} +0 -0
  116. /package/dist/{pdf-ocr-JDER5BHI.js.map → pdf-ocr-FAGA3O6B.js.map} +0 -0
  117. /package/dist/{pdf-ocr-MEVC6HXG.js.map → pdf-ocr-N5LYC5LA.js.map} +0 -0
  118. /package/dist/{profile-io-OJ23SPYO.js.map → profile-io-HC6FMYX4.js.map} +0 -0
  119. /package/dist/{rasterize-76CWCLSU.js.map → rasterize-QLTROEV2.js.map} +0 -0
  120. /package/dist/{redact-doc-EZQIHRVT.js.map → redact-doc-V4KMM2QV.js.map} +0 -0
  121. /package/dist/{render-JZFJPFWK.js.map → render-V4S3QLTR.js.map} +0 -0
  122. /package/dist/{seal-P2NOP4LC.js.map → seal-MQ5TB5YZ.js.map} +0 -0
  123. /package/dist/{setup-RIVS74JN.js.map → setup-HU7ZOQNM.js.map} +0 -0
  124. /package/dist/{visual-R5GGZBTU.js.map → visual-RLIFC4XC.js.map} +0 -0
  125. /package/dist/{watch-WMH222E5.js.map → watch-NPIZ6DSJ.js.map} +0 -0
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  blocksToPages,
3
3
  bmpToPng,
4
4
  inlineImagesIntoMarkdown
5
- } from "./chunk-3SPOIAST.js";
5
+ } from "./chunk-YOFKJ7IM.js";
6
6
  import {
7
7
  parsePageRange
8
8
  } from "./chunk-V4BH5SRQ.js";
@@ -37,7 +37,7 @@ import {
37
37
  validateOcrOptions,
38
38
  visibleText,
39
39
  wrapScript
40
- } from "./chunk-SMPK5TUQ.js";
40
+ } from "./chunk-QFJCEHY7.js";
41
41
  import {
42
42
  KordocError,
43
43
  OPTIONAL_DEP_INSTALL_HINT,
@@ -55,7 +55,7 @@ import {
55
55
  toArrayBuffer,
56
56
  unescapeHtml,
57
57
  unzipLimitBytes
58
- } from "./chunk-ATODI25J.js";
58
+ } from "./chunk-DQXP3ELP.js";
59
59
 
60
60
  // src/plain-markdown.ts
61
61
  function toPlainMarkdown(md2) {
@@ -24642,7 +24642,7 @@ var MIN_SIDE = 24;
24642
24642
  async function ocrEmbeddedImages(blocks, options, warnings) {
24643
24643
  const ocr = options?.ocr;
24644
24644
  if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
24645
- const { parseImageDocument } = await import("./image-ocr-VA6WV6E4.js");
24645
+ const { parseImageDocument } = await import("./image-ocr-BAHDLDV5.js");
24646
24646
  let inserted = false, unreadable = 0;
24647
24647
  let failed = null;
24648
24648
  const walk = async (list, depth) => {
@@ -35431,21 +35431,22 @@ var FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;?]}\xA2\xB0\u2032\u2033\u
35431
35431
  var FORBID_END = /* @__PURE__ */ new Set([..."$([{\xA3\xA5\u3008\u300A\u300C\u300E\u3010\u3014$([{\u20A9"]);
35432
35432
  var HANCOM_FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;>?]^`}~\xB0\xB7\u3009\u300B\u300D\u300F\u3011\u3015\u3017\u3019\u301B\u30FB\uFF01\uFF05\uFF09\uFF0C\uFF0E\uFF1A\uFF1B\uFF1E\uFF1F\uFF3D\uFF3E\uFF40\uFF5D\uFF5E\uFF65\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087\u308E\u30A1\u30A3\u30A5\u30A7\u30A9\u30C3\u30E3\u30E5\u30E7\u30EE\u30F5\u30F6\u3001\u3002\u3003\u3005\u30FC\u309B\u309C\u309D\u309E\u30FD\u30FE\u2019\u201D\u2024\u2025\u2026\u2030\u2031\u2032\u2033\u2034\u2035\u2036\u2037\u2103\u2109"]);
35433
35433
  var HANCOM_FORBID_END = /* @__PURE__ */ new Set([..."(<[\\{\xA7\u2018\u201C\u3008\u300A\u300C\u300E\u3010\u3014\u3016\u3018\u301A\uFF04\uFF08\uFF1C\uFF3B\uFF3C\uFF5B\uFFE0\uFFE1\uFFE5\uFFE6$\xA2\xA3\xA4\xA5\u09F2\u09F3\u0E3F", ...Array.from({ length: 13 }, (_, i) => String.fromCharCode(8352 + i))]);
35434
+ var isWrapSpace = (ch) => ch === " " || ch === "\u2005";
35434
35435
  function prepareWrap(text, mode, opts) {
35435
35436
  const widthEm = widthFnOf(opts?.faceClass), spaceEm = opts?.spaceEm ?? SPACE_EM_FIXED;
35436
35437
  const advances = [], steps = [];
35437
35438
  let i = 0;
35438
35439
  for (const ch of text) {
35439
35440
  const cp = ch.codePointAt(0);
35440
- advances[i] = isSpaceCp(cp) ? spaceEm : widthEm(cp);
35441
+ advances[i] = cp === 8197 ? 250 : isSpaceCp(cp) ? spaceEm : widthEm(cp);
35441
35442
  steps[i] = ch.length;
35442
35443
  i += ch.length;
35443
35444
  }
35444
35445
  return { units: splitWrapUnits(text, mode), advances, steps };
35445
35446
  }
35446
35447
  function splitWrapUnits(text, mode, latinBreak = false) {
35447
- if (latinBreak) return text.match(mode === "keep" ? / +|[\x21-\x7e]|[^ \x21-\x7e]+/gu : / +|[^ ](?:\u00a0[^ \u00a0]?)*/gu) ?? [];
35448
- return text.match(mode === "keep" ? / +|\ufdd0+(?=[^ \ufdd0])|[^ ]+/gu : / +|\u2060*(?:[\x21-\x7e\u00a1-\u024f\u2018-\u201f]+|[^ ])(?:\u00a0(?:[\x21-\x7e\u00a1-\u024f\u2018-\u201f]+|[^ \u00a0])?)*/gu) ?? [];
35448
+ if (latinBreak) return text.match(mode === "keep" ? /[ \u2005]+|[\x21-\x7e]|[^ \u2005\x21-\x7e]+/gu : /[ \u2005]+|[^ \u2005](?:\u00a0[^ \u2005\u00a0]?)*/gu) ?? [];
35449
+ return text.match(mode === "keep" ? /[ \u2005]+|\ufdd0+(?=[^ \u2005\ufdd0])|[^ \u2005]+/gu : /[ \u2005]+|\u2060*(?:[\x21-\x7e\u00a1-\u024f\u2018-\u201f]+|[^ \u2005])(?:\u00a0(?:[\x21-\x7e\u00a1-\u024f\u2018-\u201f]+|[^ \u2005\u00a0])?)*/gu) ?? [];
35449
35450
  }
35450
35451
  function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "keep", opts) {
35451
35452
  if (!opts?.prepared && text.includes("\n")) {
@@ -35492,7 +35493,7 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
35492
35493
  if (unitW) return (unitW[i] ?? 0) + (ch.length === 2 ? unitW[i + 1] ?? 0 : 0);
35493
35494
  if (prepared) return prepared.advances[i] * (1 + spacing / 100) * k;
35494
35495
  const cp = ch.codePointAt(0);
35495
- return (isSpaceCp(cp) ? spaceEm : widthEm(cp)) * (1 + spacing / 100) * k;
35496
+ return (cp === 8197 ? 250 : isSpaceCp(cp) ? spaceEm : widthEm(cp)) * (1 + spacing / 100) * k;
35496
35497
  };
35497
35498
  const rangeW = (from, to) => {
35498
35499
  let w = 0;
@@ -35525,11 +35526,11 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
35525
35526
  const u = text[unitPos];
35526
35527
  const prevStart = (end) => end - (end >= 2 && /[\uDC00-\uDFFF]/.test(text[end - 1]) && /[\uD800-\uDBFF]/.test(text[end - 2]) ? 2 : 1);
35527
35528
  const old = opts?.before2024;
35528
- const splitIn = opts?.kinsoku === "hancom" && split && u !== void 0 && u !== " " && text[bp - 1] !== " ";
35529
+ const splitIn = opts?.kinsoku === "hancom" && split && u !== void 0 && !isWrapSpace(u) && !isWrapSpace(text[bp - 1]);
35529
35530
  const inWord = old && splitIn;
35530
- if (!splitIn && u !== void 0 && forbidStart.has(u) && prevStart(bp) > lineStart() && text[bp - 1] !== " ") {
35531
+ if (!splitIn && u !== void 0 && forbidStart.has(u) && prevStart(bp) > lineStart() && !isWrapSpace(text[bp - 1])) {
35531
35532
  bp = prevStart(bp);
35532
- if (old && forbidStart.has(text[bp]) && prevStart(bp) > lineStart() && text[bp - 1] !== " ") bp = prevStart(bp);
35533
+ if (old && forbidStart.has(text[bp]) && prevStart(bp) > lineStart() && !isWrapSpace(text[bp - 1])) bp = prevStart(bp);
35533
35534
  }
35534
35535
  while (!inWord && bp - 1 >= lineStart() && forbidEnd.has(text[bp - 1])) bp--;
35535
35536
  if (bp <= lineStart()) bp = unitPos;
@@ -35540,8 +35541,8 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
35540
35541
  lineEnded = false;
35541
35542
  placed = unitPos > bp ? 1 : 0;
35542
35543
  for (let i = bp; i < unitPos; i++) {
35543
- if (text[i] !== " ") realSeen = true;
35544
- else if (condense > 0 && (realSeen || !hancom)) spaceW += rangeW(i, i + 1) - (spAt?.[i] ?? 0);
35544
+ if (!isWrapSpace(text[i])) realSeen = true;
35545
+ else if (text[i] === " " && condense > 0 && (realSeen || !hancom)) spaceW += rangeW(i, i + 1) - (spAt?.[i] ?? 0);
35545
35546
  }
35546
35547
  lineW = rangeW(bp, unitPos) + w;
35547
35548
  };
@@ -35555,16 +35556,16 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
35555
35556
  lineW = leadW;
35556
35557
  };
35557
35558
  for (const u of units) {
35558
- if (u[0] === " ") {
35559
+ if (isWrapSpace(u[0])) {
35559
35560
  if (hancom) {
35560
35561
  let k2 = 0;
35561
35562
  for (; k2 < u.length; k2++) {
35562
35563
  if (!lineEnded && lineW >= avail) lineEnded = true;
35563
- if (lineEnded && k2 >= 2 && pos + k2 > lineStart()) break;
35564
+ if (lineEnded && (k2 >= 2 || u[k2] === "\u2005") && pos + k2 > lineStart()) break;
35564
35565
  if (!lineEnded) {
35565
35566
  const sw2 = rangeW(pos + k2, pos + k2 + 1);
35566
35567
  lineW += sw2;
35567
- if (realSeen) spaceW += sw2 - (spAt?.[pos + k2] ?? 0);
35568
+ if (realSeen && u[k2] === " ") spaceW += sw2 - (spAt?.[pos + k2] ?? 0);
35568
35569
  }
35569
35570
  }
35570
35571
  if (k2 < u.length) breakAt(pos + k2, rangeW(pos + k2, pos + u.length));
@@ -35573,7 +35574,7 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
35573
35574
  }
35574
35575
  const sw = rangeW(pos, pos + u.length);
35575
35576
  lineW += sw;
35576
- spaceW += sw;
35577
+ for (let k2 = 0; k2 < u.length; k2++) if (u[k2] === " ") spaceW += rangeW(pos + k2, pos + k2 + 1);
35577
35578
  pos += u.length;
35578
35579
  continue;
35579
35580
  }
@@ -50718,6 +50719,21 @@ function nextParaNumber(counters, geom) {
50718
50719
  });
50719
50720
  }
50720
50721
 
50722
+ // src/render/reflow-cache.ts
50723
+ function cachedParagraphBottom(lsa, bodyFlow) {
50724
+ let bottom = Number.NEGATIVE_INFINITY, previousV = Number.NEGATIVE_INFINITY;
50725
+ for (let i = 0; i < lsa.childNodes.length; i++) {
50726
+ const seg = lsa.childNodes[i];
50727
+ if (seg.nodeType !== 1 || seg.localName !== "lineseg") continue;
50728
+ const num4 = (name, fallback = 0) => toInt32(seg.getAttribute(name) ?? void 0, fallback);
50729
+ const v = num4("vertpos");
50730
+ if (bodyFlow && v < previousV) bottom = Number.NEGATIVE_INFINITY;
50731
+ bottom = Math.max(bottom, v + Math.max(num4("vertsize", 1e3), num4("textheight", 1e3)) + num4("spacing"));
50732
+ previousV = v;
50733
+ }
50734
+ return bottom;
50735
+ }
50736
+
50721
50737
  // src/render/reflow.ts
50722
50738
  var geomMemo = (styles) => ({ cell: /* @__PURE__ */ new WeakMap(), table: /* @__PURE__ */ new WeakMap(), paraGeom: styles.paraGeom });
50723
50739
  var LINESEG_FLAGS = "393216";
@@ -51039,10 +51055,11 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
51039
51055
  }
51040
51056
  const lineBox = [];
51041
51057
  const lineParts = [];
51058
+ const collisionHeights = [];
51042
51059
  const boxAt = (i) => {
51043
51060
  if (!zones.length) return void 0;
51044
51061
  if (i in lineBox) return lineBox[i];
51045
- const y0 = textStartV + i * pitch, y1 = y0 + height;
51062
+ const y0 = textStartV + i * pitch, y1 = y0 + Math.max(height, collisionHeights[i] ?? 0);
51046
51063
  let free = [[marginL, marginL + avail]], hit = false, flow = "BOTH_SIDES";
51047
51064
  for (const z of zones) {
51048
51065
  if (!(y1 > z.top && y0 < z.bottom)) continue;
@@ -51102,7 +51119,26 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
51102
51119
  lineParts.length = 0;
51103
51120
  }
51104
51121
  }
51105
- const wrap = text.length === 0 ? { lines: 1, starts: [0], lastLineWidth: 0 } : simulateWrap(text, firstWrapWidth, contWidth, height, 100, paraMode, { widths, spacings, condensePct: condenseUse, kinsoku: "hancom", before2024: styles.before2024, lineWidth, latinBreak: geom.latinBreak, rightTabs });
51122
+ const wrapLines = () => text.length === 0 ? { lines: 1, starts: [0], lastLineWidth: 0 } : simulateWrap(text, firstWrapWidth, contWidth, height, 100, paraMode, { widths, spacings, condensePct: condenseUse, kinsoku: "hancom", before2024: styles.before2024, lineWidth, latinBreak: geom.latinBreak, rightTabs });
51123
+ let wrap = wrapLines();
51124
+ if (zones.length) for (let pass = 0; pass < text.length; pass++) {
51125
+ let changed = false;
51126
+ for (const o of m.objs) if (o.inline) {
51127
+ const k = realIdx.indexOf(o.index), om = findChildByLocalName(o.el, "outMargin");
51128
+ if (k < 0) continue;
51129
+ let li = 0;
51130
+ for (let j = 1; j < wrap.starts.length; j++) if (wrap.starts[j] <= k) li = j;
51131
+ const h = num3(om, "top") + effHOf(o) + num3(om, "bottom");
51132
+ if (h > Math.max(height, collisionHeights[li] ?? 0)) {
51133
+ collisionHeights[li] = h;
51134
+ changed = true;
51135
+ }
51136
+ }
51137
+ if (!changed) break;
51138
+ lineBox.length = 0;
51139
+ lineParts.length = 0;
51140
+ wrap = wrapLines();
51141
+ }
51106
51142
  const lineObjH = new Array(wrap.starts.length).fill(0);
51107
51143
  const lineObjAsc = new Array(wrap.starts.length).fill(0);
51108
51144
  const lineObjLs = new Array(wrap.starts.length).fill(false);
@@ -51193,12 +51229,13 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
51193
51229
  }
51194
51230
  }
51195
51231
  const vertpos = v;
51232
+ const occupiedH = Math.max(lineH, collisionHeights[li] ?? 0);
51196
51233
  v += lineH + spacing;
51197
51234
  const isFirst = li === 0;
51198
51235
  const seg = doc.createElement("hp:lineseg");
51199
51236
  seg.setAttribute("textpos", String(textpos));
51200
51237
  seg.setAttribute("vertpos", String(vertpos));
51201
- seg.setAttribute("vertsize", String(lineH === textH && boxAll > textH0 ? Math.max(textH0, boxTop) : lineH));
51238
+ seg.setAttribute("vertsize", String(occupiedH === textH && boxAll > textH0 ? Math.max(textH0, boxTop) : occupiedH));
51202
51239
  seg.setAttribute("textheight", String(lineH));
51203
51240
  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])));
51204
51241
  seg.setAttribute("spacing", String(spacing));
@@ -51381,12 +51418,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
51381
51418
  if (!res) {
51382
51419
  const lsa = findChildByLocalName(p, "linesegarray");
51383
51420
  if (lsa) {
51384
- let bottom = Number.NEGATIVE_INFINITY;
51385
- for (const seg of elements2(lsa)) {
51386
- if (ln2(seg) !== "lineseg") continue;
51387
- const th = Math.max(num3(seg, "vertsize", 1e3), num3(seg, "textheight", 1e3));
51388
- bottom = Math.max(bottom, num3(seg, "vertpos") + th + num3(seg, "spacing"));
51389
- }
51421
+ const bottom = cachedParagraphBottom(lsa, bodyFlow);
51390
51422
  if (Number.isFinite(bottom)) {
51391
51423
  cursorV = bottom;
51392
51424
  prevSpaceAfter = g3?.spaceAfter ?? 0;
@@ -54751,7 +54783,7 @@ function scriptsOff(r, off) {
54751
54783
  }
54752
54784
  async function parseImage(buffer, options) {
54753
54785
  try {
54754
- const { parseImageDocument } = await import("./image-ocr-VA6WV6E4.js");
54786
+ const { parseImageDocument } = await import("./image-ocr-BAHDLDV5.js");
54755
54787
  const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
54756
54788
  stripScriptTags({ blocks });
54757
54789
  return {
@@ -54815,7 +54847,7 @@ async function parseHwp(buffer, options) {
54815
54847
  async function parsePdf(buffer, options) {
54816
54848
  let parsePdfDocument;
54817
54849
  try {
54818
- const mod = await import("./parser-A2EWLK2J.js");
54850
+ const mod = await import("./parser-XNOLC3MZ.js");
54819
54851
  parsePdfDocument = mod.parsePdfDocument;
54820
54852
  } catch {
54821
54853
  return {