kordoc 4.17.0 → 4.17.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 (143) hide show
  1. package/README.md +6 -3
  2. package/dist/{-PRAKO6M4.js → -2UA2JHVA.js} +11 -11
  3. package/dist/{chunk-I5DJOP62.js → chunk-2XHXABCX.js} +2 -2
  4. package/dist/{chunk-4XVNQAK5.js → chunk-3N272C5L.js} +244 -115
  5. package/dist/chunk-3N272C5L.js.map +1 -0
  6. package/dist/{chunk-6RGGYQQC.js → chunk-4HRJISJF.js} +3 -3
  7. package/dist/{chunk-WN6OD2CQ.js → chunk-4TSYMJDL.js} +243 -114
  8. package/dist/chunk-4TSYMJDL.js.map +1 -0
  9. package/dist/{chunk-EFO6JZY6.js → chunk-5JZEY5IL.js} +119 -77
  10. package/dist/chunk-5JZEY5IL.js.map +1 -0
  11. package/dist/{chunk-WYON5ANU.cjs → chunk-6DOCSYEM.cjs} +113 -71
  12. package/dist/chunk-6DOCSYEM.cjs.map +1 -0
  13. package/dist/{chunk-BZG7K44Z.js → chunk-6OCKAXIS.js} +2 -2
  14. package/dist/{chunk-ZF6KHPB7.js → chunk-A2W2JQ3S.js} +11 -5
  15. package/dist/chunk-A2W2JQ3S.js.map +1 -0
  16. package/dist/{chunk-N6V7LQBL.js → chunk-C4MVZXB5.js} +2 -2
  17. package/dist/{chunk-4GSF2R7T.js → chunk-FGL4IGOT.js} +4 -4
  18. package/dist/{chunk-R2BUANHQ.cjs → chunk-GPC72VSF.cjs} +6 -6
  19. package/dist/chunk-GPC72VSF.cjs.map +1 -0
  20. package/dist/chunk-GS7T56RP.cjs.map +1 -1
  21. package/dist/{chunk-TDQ6XDB3.js → chunk-GYTL6WT3.js} +3 -3
  22. package/dist/{chunk-O7OUX6NU.cjs → chunk-HAW2VL62.cjs} +12 -12
  23. package/dist/chunk-HAW2VL62.cjs.map +1 -0
  24. package/dist/chunk-J55UQC5H.cjs.map +1 -1
  25. package/dist/{chunk-QJWVMPB6.js → chunk-JY2NBFIG.js} +15 -13
  26. package/dist/chunk-JY2NBFIG.js.map +1 -0
  27. package/dist/{chunk-A55JGNKD.js → chunk-KQIYC2ZU.js} +2 -2
  28. package/dist/{chunk-QNJLLF4J.cjs → chunk-KZVQK5NS.cjs} +11 -5
  29. package/dist/chunk-KZVQK5NS.cjs.map +1 -0
  30. package/dist/{chunk-PHID6WNG.js → chunk-MDCTITUG.js} +2 -2
  31. package/dist/{chunk-2KF5WZCR.js → chunk-O4CB7D2Q.js} +2 -2
  32. package/dist/{chunk-YZ5HHS6A.js → chunk-SDRKHEVT.js} +2 -2
  33. package/dist/{chunk-MJBCXW5R.js → chunk-UX3HHAWH.js} +1 -1
  34. package/dist/{chunk-MJBCXW5R.js.map → chunk-UX3HHAWH.js.map} +1 -1
  35. package/dist/{chunk-K2VYABZ3.js → chunk-VU26WGE5.js} +102 -38
  36. package/dist/chunk-VU26WGE5.js.map +1 -0
  37. package/dist/{chunk-BFT5IM2R.js → chunk-WJLICIYV.js} +2 -2
  38. package/dist/{chunk-5CDUL6PH.js → chunk-WL3BWROT.js} +1 -1
  39. package/dist/{chunk-5CDUL6PH.js.map → chunk-WL3BWROT.js.map} +1 -1
  40. package/dist/{chunk-XEPKOC2O.cjs → chunk-WWMKIHF7.cjs} +344 -215
  41. package/dist/chunk-WWMKIHF7.cjs.map +1 -0
  42. package/dist/{chunk-BLPR4HRF.js → chunk-XZA6X34R.js} +121 -77
  43. package/dist/chunk-XZA6X34R.js.map +1 -0
  44. package/dist/{chunk-ML4NHUR7.js → chunk-YGKC6E6A.js} +11 -5
  45. package/dist/chunk-YGKC6E6A.js.map +1 -0
  46. package/dist/{chunk-AKB72TEH.cjs → chunk-YIANW5QX.cjs} +1 -1
  47. package/dist/chunk-YIANW5QX.cjs.map +1 -0
  48. package/dist/{chunk-WY5JAR4O.js → chunk-ZDX5PIWR.js} +2 -2
  49. package/dist/chunks-EBWJR55V.js +10 -0
  50. package/dist/cli.js +26 -26
  51. package/dist/{formula-ECNOZT36.cjs → formula-5RETDCIC.cjs} +9 -9
  52. package/dist/formula-5RETDCIC.cjs.map +1 -0
  53. package/dist/{formula-7MMFBRGJ.js → formula-MBLN2DG4.js} +4 -4
  54. package/dist/{formula-SHBXRXOJ.js → formula-QZZDW5GW.js} +3 -3
  55. package/dist/{image-ocr-P6ECJCT2.js → image-ocr-CJSO3QSR.js} +8 -8
  56. package/dist/{image-ocr-QCT3A7X5.js → image-ocr-EREKAS47.js} +6 -6
  57. package/dist/{image-ocr-VUDSP2B4.cjs → image-ocr-PSPVRLB5.cjs} +15 -15
  58. package/dist/image-ocr-PSPVRLB5.cjs.map +1 -0
  59. package/dist/index.cjs +688 -622
  60. package/dist/index.cjs.map +1 -1
  61. package/dist/index.d.cts +2 -1
  62. package/dist/index.d.ts +2 -1
  63. package/dist/index.js +106 -40
  64. package/dist/index.js.map +1 -1
  65. package/dist/mcp.js +22 -22
  66. package/dist/{model-bundle-OUHGCEZY.js → model-bundle-MA4MMCRJ.js} +5 -5
  67. package/dist/{models-6D6LMOTH.js → models-SEJ7LNSN.js} +5 -5
  68. package/dist/page-range-QHHFTL7X.cjs.map +1 -1
  69. package/dist/{parser-ZPRQ3SSU.js → parser-M5WHRX25.js} +41 -23
  70. package/dist/parser-M5WHRX25.js.map +1 -0
  71. package/dist/{parser-RQ4PJRTJ.cjs → parser-QILYPWSI.cjs} +215 -197
  72. package/dist/parser-QILYPWSI.cjs.map +1 -0
  73. package/dist/{parser-CTRB7PKD.js → parser-VH3F4EQU.js} +38 -20
  74. package/dist/parser-VH3F4EQU.js.map +1 -0
  75. package/dist/pdf-ocr-3SZUM3CN.cjs +16 -0
  76. package/dist/pdf-ocr-3SZUM3CN.cjs.map +1 -0
  77. package/dist/pdf-ocr-QB2TB5W5.js +18 -0
  78. package/dist/pdf-ocr-XC33L43D.js +15 -0
  79. package/dist/{profile-io-YZUW6MAN.js → profile-io-5YB627EO.js} +3 -3
  80. package/dist/{rasterize-OUR2QJXX.js → rasterize-V2XHHS2I.js} +3 -3
  81. package/dist/{redact-doc-4OQKG4SM.js → redact-doc-5MK5L5IQ.js} +11 -11
  82. package/dist/{render-XNO6PZJO.js → render-SYZMHYK6.js} +7 -7
  83. package/dist/seal-IPKIQHYB.js +10 -0
  84. package/dist/{setup-UU3EIHNI.js → setup-ZPLJENSK.js} +3 -3
  85. package/dist/visual-RTTGNOAE.js +20 -0
  86. package/dist/{watch-SR6Q5SQN.js → watch-FNWHVKK3.js} +12 -12
  87. package/package.json +1 -1
  88. package/dist/chunk-4XVNQAK5.js.map +0 -1
  89. package/dist/chunk-AKB72TEH.cjs.map +0 -1
  90. package/dist/chunk-BLPR4HRF.js.map +0 -1
  91. package/dist/chunk-EFO6JZY6.js.map +0 -1
  92. package/dist/chunk-K2VYABZ3.js.map +0 -1
  93. package/dist/chunk-ML4NHUR7.js.map +0 -1
  94. package/dist/chunk-O7OUX6NU.cjs.map +0 -1
  95. package/dist/chunk-QJWVMPB6.js.map +0 -1
  96. package/dist/chunk-QNJLLF4J.cjs.map +0 -1
  97. package/dist/chunk-R2BUANHQ.cjs.map +0 -1
  98. package/dist/chunk-WN6OD2CQ.js.map +0 -1
  99. package/dist/chunk-WYON5ANU.cjs.map +0 -1
  100. package/dist/chunk-XEPKOC2O.cjs.map +0 -1
  101. package/dist/chunk-ZF6KHPB7.js.map +0 -1
  102. package/dist/chunks-YBFBLJ4G.js +0 -10
  103. package/dist/formula-ECNOZT36.cjs.map +0 -1
  104. package/dist/image-ocr-VUDSP2B4.cjs.map +0 -1
  105. package/dist/parser-CTRB7PKD.js.map +0 -1
  106. package/dist/parser-RQ4PJRTJ.cjs.map +0 -1
  107. package/dist/parser-ZPRQ3SSU.js.map +0 -1
  108. package/dist/pdf-ocr-462ZFSHX.js +0 -15
  109. package/dist/pdf-ocr-L35FQYGP.js +0 -18
  110. package/dist/pdf-ocr-STK5EQFF.cjs +0 -16
  111. package/dist/pdf-ocr-STK5EQFF.cjs.map +0 -1
  112. package/dist/seal-CJ7C44JN.js +0 -10
  113. package/dist/visual-QRMRFPUK.js +0 -20
  114. /package/dist/{-PRAKO6M4.js.map → -2UA2JHVA.js.map} +0 -0
  115. /package/dist/{chunk-I5DJOP62.js.map → chunk-2XHXABCX.js.map} +0 -0
  116. /package/dist/{chunk-6RGGYQQC.js.map → chunk-4HRJISJF.js.map} +0 -0
  117. /package/dist/{chunk-BZG7K44Z.js.map → chunk-6OCKAXIS.js.map} +0 -0
  118. /package/dist/{chunk-N6V7LQBL.js.map → chunk-C4MVZXB5.js.map} +0 -0
  119. /package/dist/{chunk-4GSF2R7T.js.map → chunk-FGL4IGOT.js.map} +0 -0
  120. /package/dist/{chunk-TDQ6XDB3.js.map → chunk-GYTL6WT3.js.map} +0 -0
  121. /package/dist/{chunk-A55JGNKD.js.map → chunk-KQIYC2ZU.js.map} +0 -0
  122. /package/dist/{chunk-PHID6WNG.js.map → chunk-MDCTITUG.js.map} +0 -0
  123. /package/dist/{chunk-2KF5WZCR.js.map → chunk-O4CB7D2Q.js.map} +0 -0
  124. /package/dist/{chunk-YZ5HHS6A.js.map → chunk-SDRKHEVT.js.map} +0 -0
  125. /package/dist/{chunk-BFT5IM2R.js.map → chunk-WJLICIYV.js.map} +0 -0
  126. /package/dist/{chunk-WY5JAR4O.js.map → chunk-ZDX5PIWR.js.map} +0 -0
  127. /package/dist/{chunks-YBFBLJ4G.js.map → chunks-EBWJR55V.js.map} +0 -0
  128. /package/dist/{formula-7MMFBRGJ.js.map → formula-MBLN2DG4.js.map} +0 -0
  129. /package/dist/{formula-SHBXRXOJ.js.map → formula-QZZDW5GW.js.map} +0 -0
  130. /package/dist/{image-ocr-P6ECJCT2.js.map → image-ocr-CJSO3QSR.js.map} +0 -0
  131. /package/dist/{image-ocr-QCT3A7X5.js.map → image-ocr-EREKAS47.js.map} +0 -0
  132. /package/dist/{model-bundle-OUHGCEZY.js.map → model-bundle-MA4MMCRJ.js.map} +0 -0
  133. /package/dist/{models-6D6LMOTH.js.map → models-SEJ7LNSN.js.map} +0 -0
  134. /package/dist/{pdf-ocr-462ZFSHX.js.map → pdf-ocr-QB2TB5W5.js.map} +0 -0
  135. /package/dist/{pdf-ocr-L35FQYGP.js.map → pdf-ocr-XC33L43D.js.map} +0 -0
  136. /package/dist/{profile-io-YZUW6MAN.js.map → profile-io-5YB627EO.js.map} +0 -0
  137. /package/dist/{rasterize-OUR2QJXX.js.map → rasterize-V2XHHS2I.js.map} +0 -0
  138. /package/dist/{redact-doc-4OQKG4SM.js.map → redact-doc-5MK5L5IQ.js.map} +0 -0
  139. /package/dist/{render-XNO6PZJO.js.map → render-SYZMHYK6.js.map} +0 -0
  140. /package/dist/{seal-CJ7C44JN.js.map → seal-IPKIQHYB.js.map} +0 -0
  141. /package/dist/{setup-UU3EIHNI.js.map → setup-ZPLJENSK.js.map} +0 -0
  142. /package/dist/{visual-QRMRFPUK.js.map → visual-RTTGNOAE.js.map} +0 -0
  143. /package/dist/{watch-SR6Q5SQN.js.map → watch-FNWHVKK3.js.map} +0 -0
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkR2BUANHQcjs = require('./chunk-R2BUANHQ.cjs');
7
+ var _chunkGPC72VSFcjs = require('./chunk-GPC72VSF.cjs');
8
8
 
9
9
 
10
10
 
@@ -50,18 +50,18 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
50
50
 
51
51
 
52
52
 
53
- var _chunkXEPKOC2Ocjs = require('./chunk-XEPKOC2O.cjs');
53
+ var _chunkWWMKIHF7cjs = require('./chunk-WWMKIHF7.cjs');
54
54
 
55
55
 
56
56
 
57
57
 
58
58
 
59
- var _chunkAKB72TEHcjs = require('./chunk-AKB72TEH.cjs');
60
- require('./chunk-WYON5ANU.cjs');
59
+ var _chunkYIANW5QXcjs = require('./chunk-YIANW5QX.cjs');
60
+ require('./chunk-6DOCSYEM.cjs');
61
61
 
62
62
 
63
63
 
64
- var _chunkQNJLLF4Jcjs = require('./chunk-QNJLLF4J.cjs');
64
+ var _chunkKZVQK5NScjs = require('./chunk-KZVQK5NS.cjs');
65
65
 
66
66
 
67
67
  var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
@@ -255,7 +255,7 @@ async function extractPageImages(page, fnArray, argsArray, pageNumber, state, wa
255
255
  const filename = `image_${String(state.imageIndex).padStart(3, "0")}.png`;
256
256
  state.seen.set(hash, filename);
257
257
  if (withBytes) {
258
- const png = _chunkR2BUANHQcjs.encodePng.call(void 0, w, h, rgba);
258
+ const png = _chunkGPC72VSFcjs.encodePng.call(void 0, w, h, rgba);
259
259
  state.totalBytes += png.length;
260
260
  images.push({ filename, data: png, mimeType: "image/png" });
261
261
  }
@@ -684,6 +684,7 @@ function splitContactTables(blocks) {
684
684
  }
685
685
 
686
686
  // src/pdf/table-parts.ts
687
+ var flowText = (text) => text.replace(/<\/?u>|~~/g, "");
687
688
  var PART_COL_TOL = 1;
688
689
  var PART_COL_SNAP = 0.3;
689
690
  function anchorsOf(table) {
@@ -731,7 +732,7 @@ var indexOf = (coords, x) => {
731
732
  }
732
733
  return bestD <= PART_COL_TOL ? best : -1;
733
734
  };
734
- var rowText = (anchors, r) => anchors.filter((a) => a.r === r).map((a) => a.cell.text.replace(/\s+/g, "")).join("|");
735
+ var rowText = (anchors, r) => anchors.filter((a) => a.r === r).map((a) => flowText(a.cell.text).replace(/\s+/g, "")).join("|");
735
736
  var hasText = (t) => t.replace(/\|/g, "") !== "";
736
737
  function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
737
738
  if (pcx.length !== prev.cols + 1 || ccx.length !== curr.cols + 1) return null;
@@ -769,19 +770,19 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
769
770
  if (r + dr < rows) owner[r + dr][dc] = placed;
770
771
  }
771
772
  grid[r][c1] = { ...a.cell, colSpan: c2 - c1, rowSpan: a.rs };
772
- const lines = _chunkXEPKOC2Ocjs.CELL_LINES.get(a.cell);
773
- if (lines) _chunkXEPKOC2Ocjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
774
- if (_chunkXEPKOC2Ocjs.IMAGE_CELLS.has(a.cell)) _chunkXEPKOC2Ocjs.IMAGE_CELLS.add(grid[r][c1]);
775
- const edges = _chunkAKB72TEHcjs.CELL_EDGES.get(a.cell);
773
+ const lines = _chunkWWMKIHF7cjs.CELL_LINES.get(a.cell);
774
+ if (lines) _chunkWWMKIHF7cjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
775
+ if (_chunkWWMKIHF7cjs.IMAGE_CELLS.has(a.cell)) _chunkWWMKIHF7cjs.IMAGE_CELLS.add(grid[r][c1]);
776
+ const edges = _chunkYIANW5QXcjs.CELL_EDGES.get(a.cell);
776
777
  if (edges) {
777
- _chunkAKB72TEHcjs.CELL_EDGES.set(grid[r][c1], edges);
778
+ _chunkYIANW5QXcjs.CELL_EDGES.set(grid[r][c1], edges);
778
779
  edged = true;
779
780
  }
780
781
  return true;
781
782
  };
782
- for (const a of pa) if (!_chunkXEPKOC2Ocjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
783
+ for (const a of pa) if (!_chunkWWMKIHF7cjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
783
784
  for (const a of ca) {
784
- if (a.r < skip || _chunkXEPKOC2Ocjs.FILLER_CELLS.has(a.cell)) continue;
785
+ if (a.r < skip || _chunkWWMKIHF7cjs.FILLER_CELLS.has(a.cell)) continue;
785
786
  if (!place(a, cxU, prev.rows - skip, dx)) return null;
786
787
  }
787
788
  const first = prev.rows;
@@ -805,9 +806,9 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
805
806
  const grown = { ...above, rs: newRs };
806
807
  for (let rr = above.r; rr < above.r + newRs; rr++) for (let dc = above.c; dc < above.c + above.cs; dc++) owner[rr][dc] = grown;
807
808
  }
808
- for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkXEPKOC2Ocjs.FILLER_CELLS.add(grid[r][c]);
809
+ for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkWWMKIHF7cjs.FILLER_CELLS.add(grid[r][c]);
809
810
  if (edged) {
810
- for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkAKB72TEHcjs.CELL_EDGES.set(grid[r][c], _chunkXEPKOC2Ocjs.NO_EDGES);
811
+ for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkYIANW5QXcjs.CELL_EDGES.set(grid[r][c], _chunkWWMKIHF7cjs.NO_EDGES);
811
812
  }
812
813
  for (let c = 0; c < cols && U[c + 1] <= pcx[0] + PART_COL_TOL; c++) {
813
814
  let r = prev.rows;
@@ -816,7 +817,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
816
817
  for (let rr = 0; rr < r; rr++) owner[rr][c] = through;
817
818
  }
818
819
  const table = { rows, cols, cells: grid, hasHeader: prev.hasHeader, ...prev.caption ? { caption: prev.caption } : {} };
819
- const pr = _chunkXEPKOC2Ocjs.ROW_RULES.get(prev), cr = _chunkXEPKOC2Ocjs.ROW_RULES.get(curr);
820
+ const pr = _chunkWWMKIHF7cjs.ROW_RULES.get(prev), cr = _chunkWWMKIHF7cjs.ROW_RULES.get(curr);
820
821
  const shifted = dx !== 0;
821
822
  const cut = {
822
823
  open: !!pr && !!cr && !pr.bottom && !cr.top && pr.innerOpen + cr.innerOpen === 0 && pr.innerRuled + cr.innerRuled > 0,
@@ -827,7 +828,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
827
828
  if (rows > prev.rows && !split && prevBottom !== void 0 && mergeStraddlingCells(table, owner, prev.rows, prevBottom, lex, U)) split = mergeSplitRow(table, owner, prev.rows, U, true, { ...cut, open: false });
828
829
  if (pr && cr) {
829
830
  const cutRuled = pr.bottom || cr.top;
830
- _chunkXEPKOC2Ocjs.ROW_RULES.set(table, { top: pr.top, bottom: cr.bottom, innerRuled: pr.innerRuled + cr.innerRuled + (!split && cutRuled ? 1 : 0), innerOpen: pr.innerOpen + cr.innerOpen + (!split && !cutRuled ? 1 : 0) });
831
+ _chunkWWMKIHF7cjs.ROW_RULES.set(table, { top: pr.top, bottom: cr.bottom, innerRuled: pr.innerRuled + cr.innerRuled + (!split && cutRuled ? 1 : 0), innerOpen: pr.innerOpen + cr.innerOpen + (!split && !cutRuled ? 1 : 0) });
831
832
  }
832
833
  return { table, colXs: U, split, header: ca.filter((a) => a.r < skip && a.cell.text.trim()).length >= 2 };
833
834
  }
@@ -881,7 +882,7 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs) {
881
882
  if (!crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
882
883
  if (!straddles && !midWord) continue;
883
884
  if (u.r >= last && d.rs < 2) continue;
884
- const U = _chunkXEPKOC2Ocjs.CELL_LINES.get(a);
885
+ const U = _chunkWWMKIHF7cjs.CELL_LINES.get(a);
885
886
  if (!_optionalChain([U, 'optionalAccess', _33 => _33.length]) || !hasContent(b)) continue;
886
887
  if (!(straddles && filledToBottom(U, prevBottom) && clauseContinues(a, b))) {
887
888
  if (U.length > STRADDLE_MAX_LINES) continue;
@@ -917,7 +918,7 @@ var LABEL_ROOM = 1.5;
917
918
  var HANGING_MIN = 0.5;
918
919
  var HANGING_TOL = 1;
919
920
  function continuesAcross(u, d, x1, x2) {
920
- const U = _chunkXEPKOC2Ocjs.CELL_LINES.get(u), D = _chunkXEPKOC2Ocjs.CELL_LINES.get(d);
921
+ const U = _chunkWWMKIHF7cjs.CELL_LINES.get(u), D = _chunkWWMKIHF7cjs.CELL_LINES.get(d);
921
922
  if (!_optionalChain([U, 'optionalAccess', _34 => _34.length]) || !_optionalChain([D, 'optionalAccess', _35 => _35.length])) return false;
922
923
  const last = U[U.length - 1];
923
924
  const fs = last.h || 10;
@@ -935,7 +936,7 @@ function continuesAcross(u, d, x1, x2) {
935
936
  if (U.length === 1 && x2 - last.r > Math.max(FULL_LINE_EDGE_MIN, SINGLE_LINE_WORD_GAP * fs)) return false;
936
937
  const indented = last.l - minL >= HANGING_MIN * fs;
937
938
  if (last.r - last.l < FULL_LINE_MIN_FRAC * (indented ? x2 - last.l : x2 - x1)) return false;
938
- const newItem = _chunkXEPKOC2Ocjs.startsNewItem.call(void 0, u.text, d.text);
939
+ const newItem = _chunkWWMKIHF7cjs.startsNewItem.call(void 0, u.text, d.text);
939
940
  const all = D.length ? U.concat(D) : U;
940
941
  const leftAligned = (l) => maxR - l.r > SHORT_LINE_GAP * fs && (l.l - minL <= fs || !newItem && all.some((o) => o !== l && Math.abs(o.l - l.l) <= HANGING_TOL && Math.abs(o.r - l.r) >= HANGING_MIN * fs));
941
942
  const hanging = U.length >= 2 && U.every((l) => maxR - l.r <= FULL_LINE_TOL * fs) && indented && Math.abs(D[0].l - last.l) <= HANGING_TOL;
@@ -947,20 +948,20 @@ function continuesAcross(u, d, x1, x2) {
947
948
  var OUTLINE_HEAD = /^[□■]\s*\S/;
948
949
  var OUTLINE_ITEM = /^[ㅇ○◦\-‐–·․‧※*]\s*\S/;
949
950
  function outlineContinues(u, d) {
950
- const U = u.text.split("\n").map((l) => l.trim()).filter(Boolean);
951
- const D = d.text.split("\n").map((l) => l.trim()).filter(Boolean);
951
+ const U = flowText(u.text).split("\n").map((l) => l.trim()).filter(Boolean);
952
+ const D = flowText(d.text).split("\n").map((l) => l.trim()).filter(Boolean);
952
953
  return U.length >= 2 && D.length >= 1 && U.some((l) => OUTLINE_HEAD.test(l)) && OUTLINE_ITEM.test(D[0]);
953
954
  }
954
955
  function lineEnded(c, x1, x2, next) {
955
- const L = _chunkXEPKOC2Ocjs.CELL_LINES.get(c);
956
+ const L = _chunkWWMKIHF7cjs.CELL_LINES.get(c);
956
957
  if (!L || L.length !== 1) return false;
957
958
  const l = L[0], h = l.h || 10;
958
- const d0 = next ? _optionalChain([_chunkXEPKOC2Ocjs.CELL_LINES, 'access', _36 => _36.get, 'call', _37 => _37(next), 'optionalAccess', _38 => _38[0]]) : void 0;
959
+ const d0 = next ? _optionalChain([_chunkWWMKIHF7cjs.CELL_LINES, 'access', _36 => _36.get, 'call', _37 => _37(next), 'optionalAccess', _38 => _38[0]]) : void 0;
959
960
  if (d0 && d0.l - l.l >= HANGING_MIN * h) return false;
960
961
  return x2 - l.r - (l.l - x1) >= Math.max(LABEL_ROOM, firstWordUnits(_nullishCoalesce(_optionalChain([next, 'optionalAccess', _39 => _39.text]), () => ( "")))) * h;
961
962
  }
962
963
  function firstWordUnits(text) {
963
- const word = _nullishCoalesce(text.trim().replace(/^([(\[「『<〈])\s+/, "$1").split(/\s+/)[0], () => ( ""));
964
+ const word = _nullishCoalesce(flowText(text).trim().replace(/^([(\[「『<〈])\s+/, "$1").split(/\s+/)[0], () => ( ""));
964
965
  let units = 0;
965
966
  for (const ch of word) units += /[가-힣\u3400-\u9fff]/.test(ch) ? 1 : 0.55;
966
967
  return units;
@@ -971,28 +972,29 @@ function appendCell(a, b) {
971
972
  a.blocks = [...asBlocks(a), ...asBlocks(b)];
972
973
  }
973
974
  if (b.text.trim()) a.text = a.text.trim() ? a.text + "\n" + b.text : b.text;
974
- _chunkXEPKOC2Ocjs.joinCellEdges.call(void 0, a, b);
975
+ _chunkWWMKIHF7cjs.joinCellEdges.call(void 0, a, b);
975
976
  }
976
- var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _46 => _46.blocks, 'optionalAccess', _47 => _47.length]) || _chunkXEPKOC2Ocjs.IMAGE_CELLS.has(cell);
977
+ var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _46 => _46.blocks, 'optionalAccess', _47 => _47.length]) || _chunkWWMKIHF7cjs.IMAGE_CELLS.has(cell);
977
978
  var CLAUSE_OPEN_ENDING = /(?:하는|되는|하고|하며|하여|되어|되고|되며|이며|으며|어야|아야|여야)$/;
978
979
  var batchim = (ch) => {
979
980
  const k = ch.charCodeAt(0) - 44032;
980
981
  return k >= 0 && k < 11172 && k % 28 !== 0;
981
982
  };
982
983
  function clauseContinues(u, d) {
983
- const tail = _nullishCoalesce(u.text.trim().split(/\s+/).pop(), () => ( "")), head = d.text.trim();
984
- if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunkXEPKOC2Ocjs.startsNewItem.call(void 0, u.text, head)) return false;
984
+ const tail = _nullishCoalesce(flowText(u.text).trim().split(/\s+/).pop(), () => ( "")), head = flowText(d.text).trim();
985
+ if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunkWWMKIHF7cjs.startsNewItem.call(void 0, u.text, head)) return false;
985
986
  const last = tail[tail.length - 1], before = tail[tail.length - 2];
986
987
  return last === "\uC744" && batchim(before) || last === "\uB97C" && !batchim(before) || CLAUSE_OPEN_ENDING.test(tail);
987
988
  }
988
989
  function wordOverflows(u, d, x1, x2) {
989
- const U = _chunkXEPKOC2Ocjs.CELL_LINES.get(u);
990
- if (!_optionalChain([U, 'optionalAccess', _48 => _48.length]) || _chunkXEPKOC2Ocjs.startsNewItem.call(void 0, u.text, d.text)) return false;
990
+ const U = _chunkWWMKIHF7cjs.CELL_LINES.get(u);
991
+ if (!_optionalChain([U, 'optionalAccess', _48 => _48.length]) || _chunkWWMKIHF7cjs.startsNewItem.call(void 0, u.text, d.text)) return false;
991
992
  const last = U[U.length - 1], units = firstWordUnits(d.text);
992
993
  return units > 0 && last.r - last.l + units * (last.h || 10) > x2 - x1;
993
994
  }
994
995
  var KO_ORDER = "\uAC00\uB098\uB2E4\uB77C\uB9C8\uBC14\uC0AC\uC544\uC790\uCC28\uCE74\uD0C0\uD30C\uD558";
995
996
  function itemMark(line) {
997
+ line = flowText(line).trim();
996
998
  let m = /^(\d{1,2})([.)])(?!\d)/.exec(line);
997
999
  if (m) return { style: "1" + m[2], n: +m[1] };
998
1000
  if (m = /^\((\d{1,2})\)/.exec(line)) return { style: "(1)", n: +m[1] };
@@ -1044,7 +1046,7 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
1044
1046
  const contentPairs = pairs.filter(([u, d]) => hasContent(u.cell) && hasContent(d.cell));
1045
1047
  const carriedSplit = !textOnly && carried && !newCell && (contentPairs.length <= 1 || contentPairs.every(([, d]) => d.rs > 1) || !cut.ruled && contentPairs.some(([u, d]) => wordOverflows(cell(u), cell(d), colXs[u.c], colXs[u.c + u.cs])));
1046
1048
  if (!carriedSplit) {
1047
- const norm = (c) => c.text.replace(/\s+/g, "");
1049
+ const norm = (c) => flowText(c.text).replace(/\s+/g, "");
1048
1050
  if (pairs.some(([u, d]) => hasContent(d.cell) && norm(cell(d)) !== norm(cell(u)) && lineEnded(cell(u), colXs[u.c], colXs[u.c + u.cs], cell(d)))) return false;
1049
1051
  const flows = ([u, d]) => continuesAcross(cell(u), cell(d), colXs[u.c], colXs[u.c + u.cs]) || clauseContinues(cell(u), cell(d));
1050
1052
  if (!(cut.open && !newCell)) {
@@ -1119,19 +1121,19 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1119
1121
  placeJoined(blocks, i, j, joined);
1120
1122
  continue;
1121
1123
  }
1122
- if (_chunkXEPKOC2Ocjs.EMPTY_PARTS.has(curr.table)) {
1124
+ if (_chunkWWMKIHF7cjs.EMPTY_PARTS.has(curr.table)) {
1123
1125
  blocks.splice(j, 1);
1124
1126
  i++;
1125
1127
  continue;
1126
1128
  }
1127
1129
  if (joined === null) continue;
1128
- if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunkXEPKOC2Ocjs.EMPTY_PARTS.has(prev.table)) continue;
1130
+ if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunkWWMKIHF7cjs.EMPTY_PARTS.has(prev.table)) continue;
1129
1131
  const width = Math.max(prev.bbox.width, curr.bbox.width, 1);
1130
1132
  const leftDiff = Math.abs(prev.bbox.x - curr.bbox.x);
1131
1133
  const rightDiff = Math.abs(prev.bbox.x + prev.bbox.width - (curr.bbox.x + curr.bbox.width));
1132
1134
  if (leftDiff > width * NEIGHBOR_TABLE_EPSILON || rightDiff > width * NEIGHBOR_TABLE_EPSILON) continue;
1133
- const px = _chunkXEPKOC2Ocjs.TABLE_COLXS.get(prev.table), cx = _chunkXEPKOC2Ocjs.TABLE_COLXS.get(curr.table);
1134
- if (px && cx && !shiftedSame(px, cx, !_chunkXEPKOC2Ocjs.CLIP_TABLES.has(prev.table) && !_chunkXEPKOC2Ocjs.CLIP_TABLES.has(curr.table))) continue;
1135
+ const px = _chunkWWMKIHF7cjs.TABLE_COLXS.get(prev.table), cx = _chunkWWMKIHF7cjs.TABLE_COLXS.get(curr.table);
1136
+ if (px && cx && !shiftedSame(px, cx, !_chunkWWMKIHF7cjs.CLIP_TABLES.has(prev.table) && !_chunkWWMKIHF7cjs.CLIP_TABLES.has(curr.table))) continue;
1135
1137
  if (!rowTextsEqual(prev.table.cells[0], curr.table.cells[0]) && sameHeadShape(prev.table.cells[0], curr.table.cells[0])) continue;
1136
1138
  let currCells = curr.table.cells;
1137
1139
  if (currCells.length > 1 && prev.table.cells.length > 0 && rowTextsEqual(prev.table.cells[0], currCells[0])) {
@@ -1141,6 +1143,20 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1141
1143
  blocks.splice(j, 1);
1142
1144
  continue;
1143
1145
  }
1146
+ if (px && cx && !_chunkWWMKIHF7cjs.CLIP_TABLES.has(prev.table) && !_chunkWWMKIHF7cjs.CLIP_TABLES.has(curr.table) && currCells.length < curr.table.cells.length && curr.table.cells[0].filter((c) => c.text.trim()).length >= 2 && prev.table.cells.at(-1).concat(currCells[0]).every((c) => c.rowSpan === 1 && c.colSpan === 1 && _chunkWWMKIHF7cjs.CELL_LINES.has(c))) {
1147
+ const dx = px[0] - cx[0];
1148
+ const part = joinSplitParts(prev.table, px, curr.table, cx.map((x) => x + dx), dx, void 0, lex);
1149
+ if (_optionalChain([part, 'optionalAccess', _61 => _61.split]) && part.table.rows === prev.table.rows + currCells.length - 1) {
1150
+ const last = prev.table.rows - 1;
1151
+ for (let c = 0; c < part.table.cols; c++) {
1152
+ const U = _chunkWWMKIHF7cjs.CELL_LINES.get(prev.table.cells[last][c]), D = _chunkWWMKIHF7cjs.CELL_LINES.get(currCells[0][c]);
1153
+ _chunkWWMKIHF7cjs.CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
1154
+ }
1155
+ _chunkWWMKIHF7cjs.TABLE_COLXS.set(part.table, part.colXs);
1156
+ placeJoined(blocks, i, j, part.table);
1157
+ continue;
1158
+ }
1159
+ }
1144
1160
  const merged = {
1145
1161
  rows: prev.table.rows + currCells.length,
1146
1162
  cols: prev.table.cols,
@@ -1149,20 +1165,20 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1149
1165
  caption: prev.table.caption,
1150
1166
  ...prev.table.renderAsTable ? { renderAsTable: true } : {}
1151
1167
  };
1152
- if (_nullishCoalesce(px, () => ( cx))) _chunkXEPKOC2Ocjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
1153
- if (_chunkXEPKOC2Ocjs.CLIP_TABLES.has(prev.table) || _chunkXEPKOC2Ocjs.CLIP_TABLES.has(curr.table)) _chunkXEPKOC2Ocjs.CLIP_TABLES.add(merged);
1168
+ if (_nullishCoalesce(px, () => ( cx))) _chunkWWMKIHF7cjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
1169
+ if (_chunkWWMKIHF7cjs.CLIP_TABLES.has(prev.table) || _chunkWWMKIHF7cjs.CLIP_TABLES.has(curr.table)) _chunkWWMKIHF7cjs.CLIP_TABLES.add(merged);
1154
1170
  placeJoined(blocks, i, j, merged);
1155
1171
  }
1156
1172
  for (let i = blocks.length - 1; i >= 0; i--) {
1157
1173
  const t = blocks[i].table;
1158
- if (blocks[i].type === "table" && t && _chunkXEPKOC2Ocjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
1174
+ if (blocks[i].type === "table" && t && _chunkWWMKIHF7cjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
1159
1175
  }
1160
1176
  }
1161
1177
  function mergeColumnFlow(blocks, pageHeights, lex) {
1162
1178
  if (!pageHeights) return;
1163
1179
  for (let i = 0; i < blocks.length; i++) {
1164
1180
  const L = blocks[i];
1165
- if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkXEPKOC2Ocjs.CLIP_TABLES.has(L.table) || _chunkXEPKOC2Ocjs.EMPTY_PARTS.has(L.table)) continue;
1181
+ if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkWWMKIHF7cjs.CLIP_TABLES.has(L.table) || _chunkWWMKIHF7cjs.EMPTY_PARTS.has(L.table)) continue;
1166
1182
  const ph = pageHeights.get(L.pageNumber);
1167
1183
  if (!ph || L.bbox.y > ph * PAGE_EDGE_BAND) continue;
1168
1184
  let s0 = i, s1 = i;
@@ -1191,12 +1207,12 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
1191
1207
  }
1192
1208
  function joinClipParts(prev, curr, pageHeights, lex) {
1193
1209
  const pt = prev.table, ct = curr.table;
1194
- if (!_chunkXEPKOC2Ocjs.CLIP_TABLES.has(pt) || !_chunkXEPKOC2Ocjs.CLIP_TABLES.has(ct)) return null;
1195
- const px = _chunkXEPKOC2Ocjs.TABLE_COLXS.get(pt), cx = _chunkXEPKOC2Ocjs.TABLE_COLXS.get(ct);
1210
+ if (!_chunkWWMKIHF7cjs.CLIP_TABLES.has(pt) || !_chunkWWMKIHF7cjs.CLIP_TABLES.has(ct)) return null;
1211
+ const px = _chunkWWMKIHF7cjs.TABLE_COLXS.get(pt), cx = _chunkWWMKIHF7cjs.TABLE_COLXS.get(ct);
1196
1212
  if (!px || !cx) return null;
1197
1213
  let xs = cx, shifted = false, dx = 0, foreign = false, within = false;
1198
1214
  if (!shiftedSame(px, cx, false)) {
1199
- if (!_optionalChain([pageHeights, 'optionalAccess', _61 => _61.get, 'call', _62 => _62(prev.pageNumber)]) || !_optionalChain([pageHeights, 'optionalAccess', _63 => _63.get, 'call', _64 => _64(curr.pageNumber)])) return null;
1215
+ if (!_optionalChain([pageHeights, 'optionalAccess', _62 => _62.get, 'call', _63 => _63(prev.pageNumber)]) || !_optionalChain([pageHeights, 'optionalAccess', _64 => _64.get, 'call', _65 => _65(curr.pageNumber)])) return null;
1200
1216
  dx = px[px.length - 1] - cx[cx.length - 1];
1201
1217
  within = Math.abs(dx) > CONTINUATION_COL_TOL && cx.length >= 3 && cx.every((x) => px.some((p) => Math.abs(p - x) <= CONTINUATION_COL_TOL));
1202
1218
  if (Math.abs(dx) > CONTINUATION_COL_TOL && !within) {
@@ -1208,44 +1224,44 @@ function joinClipParts(prev, curr, pageHeights, lex) {
1208
1224
  const inner = b.slice(1, -1).map((x) => x + dx);
1209
1225
  return inner.length > 0 && !inner.some((x) => px.some((p) => Math.abs(p - x) <= CONTINUATION_COL_TOL));
1210
1226
  };
1211
- foreign = unrelated(cx) && unrelated(_nullishCoalesce(_chunkXEPKOC2Ocjs.PART_COLXS.get(ct), () => ( cx))) && (headingRow(_nullishCoalesce(ct.cells[0], () => ( []))) || px.length > FOREIGN_FIRST_ROW_CELLS && anchorsOf(ct).filter((a) => a.r === 0).length >= FOREIGN_FIRST_ROW_CELLS);
1227
+ foreign = unrelated(cx) && unrelated(_nullishCoalesce(_chunkWWMKIHF7cjs.PART_COLXS.get(ct), () => ( cx))) && (headingRow(_nullishCoalesce(ct.cells[0], () => ( []))) || px.length > FOREIGN_FIRST_ROW_CELLS && anchorsOf(ct).filter((a) => a.r === 0).length >= FOREIGN_FIRST_ROW_CELLS);
1212
1228
  }
1213
- const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _65 => _65.bbox, 'optionalAccess', _66 => _66.y]), lex);
1229
+ const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _66 => _66.bbox, 'optionalAccess', _67 => _67.y]), lex);
1214
1230
  if (!res || (shifted || foreign || within) && !res.split && !res.header) return null;
1215
- _chunkXEPKOC2Ocjs.TABLE_COLXS.set(res.table, res.colXs);
1216
- const ys = _chunkXEPKOC2Ocjs.TABLE_ROWYS.get(pt);
1217
- if (ys) _chunkXEPKOC2Ocjs.TABLE_ROWYS.set(res.table, ys);
1218
- _chunkXEPKOC2Ocjs.PART_COLXS.set(res.table, _nullishCoalesce(_chunkXEPKOC2Ocjs.PART_COLXS.get(pt), () => ( px)));
1219
- _chunkXEPKOC2Ocjs.CLIP_TABLES.add(res.table);
1231
+ _chunkWWMKIHF7cjs.TABLE_COLXS.set(res.table, res.colXs);
1232
+ const ys = _chunkWWMKIHF7cjs.TABLE_ROWYS.get(pt);
1233
+ if (ys) _chunkWWMKIHF7cjs.TABLE_ROWYS.set(res.table, ys);
1234
+ _chunkWWMKIHF7cjs.PART_COLXS.set(res.table, _nullishCoalesce(_chunkWWMKIHF7cjs.PART_COLXS.get(pt), () => ( px)));
1235
+ _chunkWWMKIHF7cjs.CLIP_TABLES.add(res.table);
1220
1236
  return res.table;
1221
1237
  }
1222
1238
  function prevLacksLeftCols(prev, px, xs, pageHeights) {
1223
- const ph = _optionalChain([pageHeights, 'optionalAccess', _67 => _67.get, 'call', _68 => _68(prev.pageNumber)]);
1239
+ const ph = _optionalChain([pageHeights, 'optionalAccess', _68 => _68.get, 'call', _69 => _69(prev.pageNumber)]);
1224
1240
  if (!ph || prev.bbox.y + prev.bbox.height < ph * (1 - PAGE_EDGE_BAND)) return false;
1225
1241
  return xs[0] < px[0] && xs.slice(1, -1).some((x) => Math.abs(x - px[0]) <= CONTINUATION_COL_TOL);
1226
1242
  }
1227
1243
  function headingRow(row) {
1228
- const heads = row.map((c) => c.text.replace(/\s+/g, "")).filter(Boolean);
1244
+ const heads = row.map((c) => flowText(c.text).replace(/\s+/g, "")).filter(Boolean);
1229
1245
  if (heads.length === 1) return heads[0].length <= 8 || /^[①-⑳❶-❿]/.test(heads[0]);
1230
1246
  return heads.length === 2 && /^(?:\d{1,2}|[ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ]+|[①-⑳❶-❿])$/.test(heads[0]);
1231
1247
  }
1232
1248
  var ANNEX_HEAD_RE = /^\s*[<\[(【]?\s*(?:붙\s*임|참\s*고|별\s*첨|별\s*지|별\s*표|첨\s*부|부\s*록)(?:\s*\d|\s*$|\s*[>\])】])|^\s*■/;
1233
1249
  function looksContinued(prev, curr, pageHeights) {
1234
- const ph = _optionalChain([pageHeights, 'optionalAccess', _69 => _69.get, 'call', _70 => _70(prev.pageNumber)]), ch = _optionalChain([pageHeights, 'optionalAccess', _71 => _71.get, 'call', _72 => _72(curr.pageNumber)]);
1250
+ const ph = _optionalChain([pageHeights, 'optionalAccess', _70 => _70.get, 'call', _71 => _71(prev.pageNumber)]), ch = _optionalChain([pageHeights, 'optionalAccess', _72 => _72.get, 'call', _73 => _73(curr.pageNumber)]);
1235
1251
  if (ph && ch && (prev.bbox.y > ph * PAGE_EDGE_BAND && !pushedLead(prev, curr) || curr.bbox.y + curr.bbox.height < ch * (1 - PAGE_EDGE_BAND))) return false;
1236
1252
  const firstRow = _nullishCoalesce(curr.table.cells[0], () => ( []));
1237
- const firstText = _nullishCoalesce(_optionalChain([firstRow, 'access', _73 => _73.find, 'call', _74 => _74((c) => c.text.trim()), 'optionalAccess', _75 => _75.text]), () => ( ""));
1253
+ const firstText = _nullishCoalesce(_optionalChain([firstRow, 'access', _74 => _74.find, 'call', _75 => _75((c) => c.text.trim()), 'optionalAccess', _76 => _76.text]), () => ( ""));
1238
1254
  if (!ANNEX_HEAD_RE.test(firstText)) return true;
1239
- const filled = firstRow.map((c) => c.text.replace(/\s+/g, "")).filter(Boolean);
1255
+ const filled = firstRow.map((c) => flowText(c.text).replace(/\s+/g, "")).filter(Boolean);
1240
1256
  return filled.length >= 2 && filled.every((t) => t === filled[0]);
1241
1257
  }
1242
1258
  function pushedLead(prev, curr) {
1243
- if (!_chunkXEPKOC2Ocjs.CLIP_TABLES.has(prev.table) || !_chunkXEPKOC2Ocjs.CLIP_TABLES.has(curr.table)) return false;
1259
+ if (!_chunkWWMKIHF7cjs.CLIP_TABLES.has(prev.table) || !_chunkWWMKIHF7cjs.CLIP_TABLES.has(curr.table)) return false;
1244
1260
  const lead = leadRows(curr.table);
1245
1261
  return lead.image && lead.height > prev.bbox.y;
1246
1262
  }
1247
1263
  function leadRows(t) {
1248
- const ys = _chunkXEPKOC2Ocjs.TABLE_ROWYS.get(t);
1264
+ const ys = _chunkWWMKIHF7cjs.TABLE_ROWYS.get(t);
1249
1265
  if (!ys || ys.length < 2) return { height: 0, image: false };
1250
1266
  const anchors = anchorsOf(t);
1251
1267
  let end = 1, image = false;
@@ -1253,19 +1269,19 @@ function leadRows(t) {
1253
1269
  for (const a of anchors) {
1254
1270
  if (a.r !== r) continue;
1255
1271
  end = Math.max(end, r + a.rs);
1256
- if (_chunkXEPKOC2Ocjs.IMAGE_CELLS.has(a.cell)) image = true;
1272
+ if (_chunkWWMKIHF7cjs.IMAGE_CELLS.has(a.cell)) image = true;
1257
1273
  }
1258
1274
  }
1259
1275
  return { height: ys[0] - ys[Math.min(end, ys.length - 1)], image };
1260
1276
  }
1261
1277
  function tailOf(b) {
1262
- const t = b.table && _chunkXEPKOC2Ocjs.TABLE_TAIL.get(b.table);
1278
+ const t = b.table && _chunkWWMKIHF7cjs.TABLE_TAIL.get(b.table);
1263
1279
  return t && b.bbox ? { ...b, pageNumber: t.page, bbox: { ...b.bbox, page: t.page, y: t.y, height: t.height } } : b;
1264
1280
  }
1265
1281
  function firstRowSig(t) {
1266
- const x = _chunkXEPKOC2Ocjs.TABLE_COLXS.get(t);
1282
+ const x = _chunkWWMKIHF7cjs.TABLE_COLXS.get(t);
1267
1283
  if (!x || x.length !== t.cols + 1) return null;
1268
- return anchorsOf(t).filter((a) => a.r === 0).map((a) => ({ x1: x[a.c], x2: x[a.c + a.cs], t: a.cell.text.replace(/\s+/g, "") }));
1284
+ return anchorsOf(t).filter((a) => a.r === 0).map((a) => ({ x1: x[a.c], x2: x[a.c + a.cs], t: flowText(a.cell.text).replace(/\s+/g, "") }));
1269
1285
  }
1270
1286
  function restartsTable(blocks, i, curr, pageHeights) {
1271
1287
  const cs = firstRowSig(curr);
@@ -1288,9 +1304,9 @@ function restartsTable(blocks, i, curr, pageHeights) {
1288
1304
  }
1289
1305
  function restartsTitledForm(head, curr) {
1290
1306
  if (head.rows < 2 || curr.rows < 2 || head.cols !== curr.cols) return false;
1291
- const full = (t) => _optionalChain([t, 'access', _76 => _76.cells, 'access', _77 => _77[0], 'access', _78 => _78[0], 'optionalAccess', _79 => _79.colSpan]) === t.cols;
1307
+ const full = (t) => _optionalChain([t, 'access', _77 => _77.cells, 'access', _78 => _78[0], 'access', _79 => _79[0], 'optionalAccess', _80 => _80.colSpan]) === t.cols;
1292
1308
  if (!full(head) || !full(curr)) return false;
1293
- const norm = (c) => (_nullishCoalesce(_optionalChain([c, 'optionalAccess', _80 => _80.text]), () => ( ""))).replace(/\s+/g, "");
1309
+ const norm = (c) => flowText(_nullishCoalesce(_optionalChain([c, 'optionalAccess', _81 => _81.text]), () => ( ""))).replace(/\s+/g, "");
1294
1310
  const ht = norm(head.cells[0][0]), ct = norm(curr.cells[0][0]);
1295
1311
  if (!ht || !ct || ht === ct) return false;
1296
1312
  const titleLike = (t) => t.length <= TITLE_ROW_MAX_CHARS && !/^[ㅇ○◦•·\-–※*□■▪☞]/.test(t);
@@ -1316,7 +1332,7 @@ function chainHead(blocks, i, pageHeights) {
1316
1332
  if (pb.pageNumber !== (_nullishCoalesce(cur.pageNumber, () => ( 0))) - 1) break;
1317
1333
  if (!blocks.slice(p + 1, k).every((b) => besideOwn(b, pb, cur) || insideTable(b, pb))) break;
1318
1334
  if (!looksContinued(pb, cur, pageHeights)) break;
1319
- const px = _chunkXEPKOC2Ocjs.TABLE_COLXS.get(pb.table), cx = _chunkXEPKOC2Ocjs.TABLE_COLXS.get(cur.table);
1335
+ const px = _chunkWWMKIHF7cjs.TABLE_COLXS.get(pb.table), cx = _chunkWWMKIHF7cjs.TABLE_COLXS.get(cur.table);
1320
1336
  if (!px || !cx) break;
1321
1337
  const dx = px[px.length - 1] - cx[cx.length - 1];
1322
1338
  if (!shiftedSame(px, cx) && !px.some((x) => Math.abs(x - (cx[0] + dx)) <= CONTINUATION_COL_TOL) && !prevLacksLeftCols(pb, px, cx, pageHeights)) break;
@@ -1326,7 +1342,7 @@ function chainHead(blocks, i, pageHeights) {
1326
1342
  }
1327
1343
  function rowTextsEqual(a, b) {
1328
1344
  if (a.length !== b.length) return false;
1329
- const norm = (t) => t.replace(/\s+/g, "");
1345
+ const norm = (t) => flowText(t).replace(/\s+/g, "");
1330
1346
  for (let i = 0; i < a.length; i++) {
1331
1347
  if (norm(a[i].text) !== norm(b[i].text)) return false;
1332
1348
  }
@@ -1348,12 +1364,12 @@ var RESTART_LOOKBACK_PAGES = 5;
1348
1364
  var COL_MATCH_TOL = 0.5;
1349
1365
  var CONTINUED_TABLE_PAGE_BAND = 0.16;
1350
1366
  function lastRowCell(t, x1, x2) {
1351
- const xs = _chunkXEPKOC2Ocjs.TABLE_COLXS.get(t);
1367
+ const xs = _chunkWWMKIHF7cjs.TABLE_COLXS.get(t);
1352
1368
  const covered = /* @__PURE__ */ new Set();
1353
1369
  for (let r = 0; r < t.rows; r++) {
1354
1370
  for (let c = 0; c < t.cols; c++) {
1355
1371
  if (covered.has(r * 1e5 + c)) continue;
1356
- const cell = _optionalChain([t, 'access', _81 => _81.cells, 'access', _82 => _82[r], 'optionalAccess', _83 => _83[c]]);
1372
+ const cell = _optionalChain([t, 'access', _82 => _82.cells, 'access', _83 => _83[r], 'optionalAccess', _84 => _84[c]]);
1357
1373
  if (!cell) continue;
1358
1374
  for (let dr = 0; dr < cell.rowSpan; dr++) for (let dc = 0; dc < cell.colSpan; dc++) covered.add((r + dr) * 1e5 + c + dc);
1359
1375
  if (r + cell.rowSpan !== t.rows) continue;
@@ -1366,23 +1382,23 @@ var cellBlocks = (cell, pageNumber) => _nullishCoalesce(cell.blocks, () => ( cel
1366
1382
  function mergeContinuedCells(blocks, pageHeights) {
1367
1383
  for (let j = blocks.length - 1; j > 0; j--) {
1368
1384
  const part = blocks[j];
1369
- const from = part.table ? _chunkXEPKOC2Ocjs.CONT_PARTS.get(part.table) : void 0;
1385
+ const from = part.table ? _chunkWWMKIHF7cjs.CONT_PARTS.get(part.table) : void 0;
1370
1386
  if (!from || !part.table) continue;
1371
1387
  let i = j - 1;
1372
1388
  while (i >= 0 && blocks[i].type !== "table") i--;
1373
1389
  const prev = blocks[i];
1374
1390
  if (i < 0 || !prev.table || prev.pageNumber !== (_nullishCoalesce(part.pageNumber, () => ( 0))) - 1) continue;
1375
1391
  const cell = lastRowCell(prev.table, from.x1, from.x2);
1376
- const add = _optionalChain([part, 'access', _84 => _84.table, 'access', _85 => _85.cells, 'access', _86 => _86[0], 'optionalAccess', _87 => _87[0]]);
1392
+ const add = _optionalChain([part, 'access', _85 => _85.table, 'access', _86 => _86.cells, 'access', _87 => _87[0], 'optionalAccess', _88 => _88[0]]);
1377
1393
  if (!cell || !add) continue;
1378
1394
  const at = cell.blocks || add.blocks ? cellBlocks(cell, prev.pageNumber).length : -1;
1379
1395
  if (cell.blocks || add.blocks) cell.blocks = [...cellBlocks(cell, prev.pageNumber), ...cellBlocks(add, part.pageNumber)];
1380
1396
  cell.text = [cell.text, add.text].filter((s) => s.trim()).join("\n");
1381
- _chunkXEPKOC2Ocjs.joinCellEdges.call(void 0, cell, add);
1382
- const lines = _chunkXEPKOC2Ocjs.CELL_LINES.get(add);
1383
- if (_optionalChain([lines, 'optionalAccess', _88 => _88.length])) _chunkXEPKOC2Ocjs.CELL_LINES.set(cell, [..._nullishCoalesce(_chunkXEPKOC2Ocjs.CELL_LINES.get(cell), () => ( [])), ...lines]);
1384
- if (part.pageNumber && part.bbox) _chunkXEPKOC2Ocjs.TABLE_TAIL.set(prev.table, _nullishCoalesce(_chunkXEPKOC2Ocjs.TABLE_TAIL.get(part.table), () => ( { page: part.pageNumber, y: part.bbox.y, height: part.bbox.height })));
1385
- if (cell.text.trim() || _optionalChain([cell, 'access', _89 => _89.blocks, 'optionalAccess', _90 => _90.length])) _chunkXEPKOC2Ocjs.EMPTY_PARTS.delete(prev.table);
1397
+ _chunkWWMKIHF7cjs.joinCellEdges.call(void 0, cell, add);
1398
+ const lines = _chunkWWMKIHF7cjs.CELL_LINES.get(add);
1399
+ if (_optionalChain([lines, 'optionalAccess', _89 => _89.length])) _chunkWWMKIHF7cjs.CELL_LINES.set(cell, [..._nullishCoalesce(_chunkWWMKIHF7cjs.CELL_LINES.get(cell), () => ( [])), ...lines]);
1400
+ if (part.pageNumber && part.bbox) _chunkWWMKIHF7cjs.TABLE_TAIL.set(prev.table, _nullishCoalesce(_chunkWWMKIHF7cjs.TABLE_TAIL.get(part.table), () => ( { page: part.pageNumber, y: part.bbox.y, height: part.bbox.height })));
1401
+ if (cell.text.trim() || _optionalChain([cell, 'access', _90 => _90.blocks, 'optionalAccess', _91 => _91.length])) _chunkWWMKIHF7cjs.EMPTY_PARTS.delete(prev.table);
1386
1402
  blocks.splice(j, 1);
1387
1403
  if (cell.blocks && at > 0) {
1388
1404
  const nextAt = cell.blocks[at];
@@ -1394,27 +1410,27 @@ function mergeContinuedCells(blocks, pageHeights) {
1394
1410
  }
1395
1411
  function unwrapContinuedTable(blocks, at, pageHeights) {
1396
1412
  const prev = blocks[at - 1], frame = blocks[at];
1397
- if (!_optionalChain([prev, 'optionalAccess', _91 => _91.table]) || !_optionalChain([frame, 'optionalAccess', _92 => _92.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunkXEPKOC2Ocjs.CLIP_TABLES.has(frame.table)) return;
1398
- const inner = _optionalChain([frame, 'access', _93 => _93.table, 'access', _94 => _94.cells, 'access', _95 => _95[0], 'optionalAccess', _96 => _96[0], 'optionalAccess', _97 => _97.blocks]);
1399
- const next = _optionalChain([inner, 'optionalAccess', _98 => _98[0]]);
1400
- if (!inner || !_optionalChain([next, 'optionalAccess', _99 => _99.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunkXEPKOC2Ocjs.CLIP_TABLES.has(prev.table) || !_chunkXEPKOC2Ocjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
1401
- const px = _chunkXEPKOC2Ocjs.TABLE_COLXS.get(prev.table), nx = _chunkXEPKOC2Ocjs.TABLE_COLXS.get(next.table);
1413
+ if (!_optionalChain([prev, 'optionalAccess', _92 => _92.table]) || !_optionalChain([frame, 'optionalAccess', _93 => _93.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunkWWMKIHF7cjs.CLIP_TABLES.has(frame.table)) return;
1414
+ const inner = _optionalChain([frame, 'access', _94 => _94.table, 'access', _95 => _95.cells, 'access', _96 => _96[0], 'optionalAccess', _97 => _97[0], 'optionalAccess', _98 => _98.blocks]);
1415
+ const next = _optionalChain([inner, 'optionalAccess', _99 => _99[0]]);
1416
+ if (!inner || !_optionalChain([next, 'optionalAccess', _100 => _100.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunkWWMKIHF7cjs.CLIP_TABLES.has(prev.table) || !_chunkWWMKIHF7cjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
1417
+ const px = _chunkWWMKIHF7cjs.TABLE_COLXS.get(prev.table), nx = _chunkWWMKIHF7cjs.TABLE_COLXS.get(next.table);
1402
1418
  if (!px || !nx || px.length !== nx.length || px.some((x, i) => Math.abs(x - nx[i]) > COL_MATCH_TOL)) return;
1403
- const ph = _optionalChain([pageHeights, 'optionalAccess', _100 => _100.get, 'call', _101 => _101(prev.pageNumber)]), nh = _optionalChain([pageHeights, 'optionalAccess', _102 => _102.get, 'call', _103 => _103(next.pageNumber)]);
1419
+ const ph = _optionalChain([pageHeights, 'optionalAccess', _101 => _101.get, 'call', _102 => _102(prev.pageNumber)]), nh = _optionalChain([pageHeights, 'optionalAccess', _103 => _103.get, 'call', _104 => _104(next.pageNumber)]);
1404
1420
  if (!ph || !nh || prev.bbox.y > ph * CONTINUED_TABLE_PAGE_BAND || next.bbox.y + next.bbox.height < nh * (1 - CONTINUED_TABLE_PAGE_BAND)) return;
1405
1421
  blocks.splice(at, 1, ...inner);
1406
1422
  }
1407
1423
  function fillNestedContinuation(blocks, at) {
1408
1424
  const prev = blocks[at - 1], next = blocks[at];
1409
- const t = _optionalChain([prev, 'optionalAccess', _104 => _104.table]), u = _optionalChain([next, 'optionalAccess', _105 => _105.table]);
1410
- if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunkXEPKOC2Ocjs.CLIP_TABLES.has(t) || !_chunkXEPKOC2Ocjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
1411
- const xs = _chunkXEPKOC2Ocjs.TABLE_COLXS.get(u);
1425
+ const t = _optionalChain([prev, 'optionalAccess', _105 => _105.table]), u = _optionalChain([next, 'optionalAccess', _106 => _106.table]);
1426
+ if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunkWWMKIHF7cjs.CLIP_TABLES.has(t) || !_chunkWWMKIHF7cjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
1427
+ const xs = _chunkWWMKIHF7cjs.TABLE_COLXS.get(u);
1412
1428
  const cell = xs ? lastRowCell(t, xs[0], xs[xs.length - 1]) : void 0;
1413
- const add = _optionalChain([u, 'access', _106 => _106.cells, 'access', _107 => _107[0], 'optionalAccess', _108 => _108[0]]);
1414
- if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _109 => _109.blocks, 'optionalAccess', _110 => _110.length])) return;
1429
+ const add = _optionalChain([u, 'access', _107 => _107.cells, 'access', _108 => _108[0], 'optionalAccess', _109 => _109[0]]);
1430
+ if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _110 => _110.blocks, 'optionalAccess', _111 => _111.length])) return;
1415
1431
  cell.text = add.text;
1416
1432
  if (add.blocks) cell.blocks = add.blocks;
1417
- _chunkXEPKOC2Ocjs.joinCellEdges.call(void 0, cell, add);
1433
+ _chunkWWMKIHF7cjs.joinCellEdges.call(void 0, cell, add);
1418
1434
  blocks.splice(at, 1);
1419
1435
  }
1420
1436
 
@@ -1450,7 +1466,7 @@ var WINANSI_REVERSE = {
1450
1466
  };
1451
1467
  function symbolFontTable(fontName) {
1452
1468
  if (!fontName) return void 0;
1453
- if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunkR2BUANHQcjs.WINGDINGS;
1469
+ if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunkGPC72VSFcjs.WINGDINGS;
1454
1470
  return void 0;
1455
1471
  }
1456
1472
  function remapSymbolText(text, table) {
@@ -1578,7 +1594,7 @@ function layout(toks) {
1578
1594
  const bar = rest.find((t) => t.bar && t.x >= rt.x && t.x <= rt.x + rt.w + 2 && Math.abs(t.y - rt.y) <= size * 1.5);
1579
1595
  if (!bar) continue;
1580
1596
  const inner = rest.filter((t) => !t.bar && t !== rt && t.x + t.w / 2 > bar.x && t.x + t.w / 2 < bar.x + bar.w && bar.y - t.y > 0 && bar.y - t.y <= size * 1.4);
1581
- const tok = { text: `\\sqrt{${linear(inner)}}`, x: rt.x, w: bar.x + bar.w - rt.x, y: _nullishCoalesce(_optionalChain([inner, 'access', _111 => _111[0], 'optionalAccess', _112 => _112.y]), () => ( rt.y)), size: Math.max(rt.size, ...inner.map((t) => t.size)), bar: false };
1597
+ const tok = { text: `\\sqrt{${linear(inner)}}`, x: rt.x, w: bar.x + bar.w - rt.x, y: _nullishCoalesce(_optionalChain([inner, 'access', _112 => _112[0], 'optionalAccess', _113 => _113.y]), () => ( rt.y)), size: Math.max(rt.size, ...inner.map((t) => t.size)), bar: false };
1582
1598
  rest = [...rest.filter((t) => t !== rt && t !== bar && !inner.includes(t)), tok];
1583
1599
  }
1584
1600
  const bars = rest.filter((t) => t.bar).sort((a, b) => a.w - b.w);
@@ -1680,7 +1696,7 @@ function wrapEquationRuns(items, faceName) {
1680
1696
  for (const i of mains) ys.set(i.y, (_nullishCoalesce(ys.get(i.y), () => ( 0))) + 1);
1681
1697
  const top = [...ys].sort((p, q) => q[1] - p[1]);
1682
1698
  const bar = cur.find(isBarItem);
1683
- const lineY = bar && top.length > 1 && top[0][1] === top[1][1] ? Math.round(bar.y + size * 0.3) : _nullishCoalesce(_optionalChain([top, 'access', _113 => _113[0], 'optionalAccess', _114 => _114[0]]), () => ( cur[0].y));
1699
+ const lineY = bar && top.length > 1 && top[0][1] === top[1][1] ? Math.round(bar.y + size * 0.3) : _nullishCoalesce(_optionalChain([top, 'access', _114 => _114[0], 'optionalAccess', _115 => _115[0]]), () => ( cur[0].y));
1684
1700
  const base = { ..._nullishCoalesce(mains[0], () => ( cur[0])), y: lineY, fontSize: size || cur[0].fontSize };
1685
1701
  const x1 = Math.min(...cur.map((i) => i.x)), x2 = Math.max(...cur.map((i) => i.x + i.w));
1686
1702
  added.push({ ...base, text: `$${tex}$`, x: x1, w: x2 - x1, hasSpaceBefore: true });
@@ -2026,7 +2042,7 @@ function joinVerticalColumns(items) {
2026
2042
  const groups = [];
2027
2043
  for (const col of columns) {
2028
2044
  const g2 = groups[groups.length - 1];
2029
- const last = _optionalChain([g2, 'optionalAccess', _115 => _115[g2.length - 1]]);
2045
+ const last = _optionalChain([g2, 'optionalAccess', _116 => _116[g2.length - 1]]);
2030
2046
  const fs = col.items[0].fontSize;
2031
2047
  if (last && last.x - col.x >= fs * 1.2 && last.x - col.x <= fs * 4 && Math.abs(last.items[0].y - col.items[0].y) <= fs * 1.2) g2.push(col);
2032
2048
  else groups.push([col]);
@@ -2212,7 +2228,7 @@ function relocateEndnotes(blocks) {
2212
2228
  }
2213
2229
  const shapes = /* @__PURE__ */ new Map();
2214
2230
  for (const h of heads) shapes.set(h.shape, (_nullishCoalesce(shapes.get(h.shape), () => ( 0))) + 1);
2215
- const main = _optionalChain([[...shapes], 'access', _116 => _116.sort, 'call', _117 => _117((a, b) => b[1] - a[1]), 'access', _118 => _118[0], 'optionalAccess', _119 => _119[0]]);
2231
+ const main = _optionalChain([[...shapes], 'access', _117 => _117.sort, 'call', _118 => _118((a, b) => b[1] - a[1]), 'access', _119 => _119[0], 'optionalAccess', _120 => _120[0]]);
2216
2232
  if (!main || !/#/.test(main)) return blocks;
2217
2233
  const lastRun = (hs) => {
2218
2234
  let run2 = [];
@@ -2313,7 +2329,7 @@ var RUN_GAP = 5;
2313
2329
  function removeSideTabs(blocks, pageWidths) {
2314
2330
  const edges = /* @__PURE__ */ new Map();
2315
2331
  for (const b of blocks) {
2316
- if (!b.bbox || b.pageNumber === void 0 || [..._nullishCoalesce(_optionalChain([b, 'access', _120 => _120.text, 'optionalAccess', _121 => _121.trim, 'call', _122 => _122()]), () => ( ""))].length <= MAX_CHARS) continue;
2332
+ if (!b.bbox || b.pageNumber === void 0 || [..._nullishCoalesce(_optionalChain([b, 'access', _121 => _121.text, 'optionalAccess', _122 => _122.trim, 'call', _123 => _123()]), () => ( ""))].length <= MAX_CHARS) continue;
2317
2333
  const e = _nullishCoalesce(edges.get(b.pageNumber), () => ( { lefts: [], rights: [] }));
2318
2334
  e.lefts.push(b.bbox.x);
2319
2335
  e.rights.push(b.bbox.x + b.bbox.width);
@@ -2329,7 +2345,7 @@ function removeSideTabs(blocks, pageWidths) {
2329
2345
  const fallback = all.length ? { left: q(all.map((e) => e.left), 0.5), right: q(all.map((e) => e.right), 0.5) } : void 0;
2330
2346
  const key = (b) => {
2331
2347
  const w = b.pageNumber !== void 0 ? pageWidths.get(b.pageNumber) : void 0;
2332
- const text = _optionalChain([b, 'access', _123 => _123.text, 'optionalAccess', _124 => _124.trim, 'call', _125 => _125()]);
2348
+ const text = _optionalChain([b, 'access', _124 => _124.text, 'optionalAccess', _125 => _125.trim, 'call', _126 => _126()]);
2333
2349
  const area = _nullishCoalesce((b.pageNumber !== void 0 ? body.get(b.pageNumber) : void 0), () => ( fallback));
2334
2350
  if (!w || !area || !b.bbox || !text || b.type === "table" || [...text].length > MAX_CHARS) return null;
2335
2351
  const side = b.bbox.x + b.bbox.width <= Math.min(w * BAND, area.left - 1) ? "L" : b.bbox.x >= Math.max(w * (1 - BAND), area.right + 1) ? "R" : null;
@@ -2405,7 +2421,7 @@ function inlineFootnotes(blocks, pages) {
2405
2421
  open = true;
2406
2422
  continue;
2407
2423
  }
2408
- const prev = pb[j - 1], line = (_nullishCoalesce(_nullishCoalesce(_optionalChain([b, 'access', _126 => _126.style, 'optionalAccess', _127 => _127.fontSize]), () => ( _optionalChain([b, 'access', _128 => _128.bbox, 'optionalAccess', _129 => _129.height]))), () => ( 10))) * 1.5;
2424
+ const prev = pb[j - 1], line = (_nullishCoalesce(_nullishCoalesce(_optionalChain([b, 'access', _127 => _127.style, 'optionalAccess', _128 => _128.fontSize]), () => ( _optionalChain([b, 'access', _129 => _129.bbox, 'optionalAccess', _130 => _130.height]))), () => ( 10))) * 1.5;
2409
2425
  if (open && b.bbox && prev.bbox && prev.bbox.y - top(b) <= line && !/^[-–—\s\d]+$/.test(b.text)) {
2410
2426
  notes[notes.length - 1].text += " " + b.text.trim();
2411
2427
  notes[notes.length - 1].blocks.push(b);
@@ -2428,7 +2444,7 @@ var CAPTION = /^(?:Table|Figure|Fig\.?)\s*\d+(?:\.\d+)*\s*[.:]/i;
2428
2444
  var EQUATION_NUMBER = /\t\(\d{1,3}[a-z]?\)\s*$/;
2429
2445
  var DISPLAY_MATH = /=|[√∑∏∫∂∇≤≥≈≠∈∀∃]/;
2430
2446
  function isRunningHead(block, page, pageHeight) {
2431
- const box = block.bbox, text = _optionalChain([block, 'access', _130 => _130.text, 'optionalAccess', _131 => _131.trim, 'call', _132 => _132()]);
2447
+ const box = block.bbox, text = _optionalChain([block, 'access', _131 => _131.text, 'optionalAccess', _132 => _132.trim, 'call', _133 => _133()]);
2432
2448
  if (!box || !text || !pageHeight) return false;
2433
2449
  const top = box.y + box.height >= pageHeight * 0.9;
2434
2450
  const bottom = box.y <= pageHeight * 0.1;
@@ -2436,7 +2452,7 @@ function isRunningHead(block, page, pageHeight) {
2436
2452
  const others = page.filter((o) => o !== block && o.bbox && o.type !== "image" && o.type !== "separator");
2437
2453
  if (top && others.some((o) => o.bbox.y + o.bbox.height > box.y + box.height)) return false;
2438
2454
  if (bottom && others.some((o) => o.bbox.y < box.y)) return false;
2439
- if (bottom && box.height <= (_nullishCoalesce(_optionalChain([block, 'access', _133 => _133.style, 'optionalAccess', _134 => _134.fontSize]), () => ( 0))) * 1.6) return true;
2455
+ if (bottom && box.height <= (_nullishCoalesce(_optionalChain([block, 'access', _134 => _134.style, 'optionalAccess', _135 => _135.fontSize]), () => ( 0))) * 1.6) return true;
2440
2456
  if (!text.includes(" ")) return false;
2441
2457
  const parts = text.split(/\t+/).map((part) => part.trim()).filter(Boolean);
2442
2458
  if (parts.length >= 2 && (PAGE_NUMBER.test(parts[0]) || PAGE_NUMBER.test(parts[parts.length - 1]))) return true;
@@ -2445,7 +2461,7 @@ function isRunningHead(block, page, pageHeight) {
2445
2461
  return right > left && box.width >= (right - left) * 0.6;
2446
2462
  }
2447
2463
  function unbalancedClose(text) {
2448
- return (_nullishCoalesce(_optionalChain([text, 'access', _135 => _135.match, 'call', _136 => _136(/\)/g), 'optionalAccess', _137 => _137.length]), () => ( 0))) > (_nullishCoalesce(_optionalChain([text, 'access', _138 => _138.match, 'call', _139 => _139(/\(/g), 'optionalAccess', _140 => _140.length]), () => ( 0)));
2464
+ return (_nullishCoalesce(_optionalChain([text, 'access', _136 => _136.match, 'call', _137 => _137(/\)/g), 'optionalAccess', _138 => _138.length]), () => ( 0))) > (_nullishCoalesce(_optionalChain([text, 'access', _139 => _139.match, 'call', _140 => _140(/\(/g), 'optionalAccess', _141 => _141.length]), () => ( 0)));
2449
2465
  }
2450
2466
  function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
2451
2467
  const byPage = /* @__PURE__ */ new Map();
@@ -2458,7 +2474,7 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
2458
2474
  for (const [pageNumber, page] of byPage) {
2459
2475
  const chars = /* @__PURE__ */ new Map();
2460
2476
  for (const b of page) {
2461
- if (b.type !== "paragraph" && b.type !== "heading" || !b.text || !_optionalChain([b, 'access', _141 => _141.style, 'optionalAccess', _142 => _142.fontName]) || !b.style.fontSize) continue;
2477
+ if (b.type !== "paragraph" && b.type !== "heading" || !b.text || !_optionalChain([b, 'access', _142 => _142.style, 'optionalAccess', _143 => _143.fontName]) || !b.style.fontSize) continue;
2462
2478
  const key2 = `${b.style.fontName}:${b.style.fontSize}`;
2463
2479
  chars.set(key2, (_nullishCoalesce(chars.get(key2), () => ( 0))) + b.text.length);
2464
2480
  }
@@ -2469,48 +2485,48 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
2469
2485
  const block = blocks[i];
2470
2486
  if (block.type !== "heading" || !block.text) continue;
2471
2487
  const text = block.text.replace(/<[^>]+>/g, "").trim();
2472
- const fsz = _nullishCoalesce(_optionalChain([block, 'access', _143 => _143.style, 'optionalAccess', _144 => _144.fontSize]), () => ( 0));
2473
- const tocEntry = i > 0 && _chunkXEPKOC2Ocjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunkXEPKOC2Ocjs.TOC_BLOCKS.has(blocks[i + 1]);
2488
+ const fsz = _nullishCoalesce(_optionalChain([block, 'access', _144 => _144.style, 'optionalAccess', _145 => _145.fontSize]), () => ( 0));
2489
+ const tocEntry = i > 0 && _chunkWWMKIHF7cjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunkWWMKIHF7cjs.TOC_BLOCKS.has(blocks[i + 1]);
2474
2490
  const page = _nullishCoalesce(byPage.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( []));
2475
- const proseStyle = _optionalChain([block, 'access', _145 => _145.style, 'optionalAccess', _146 => _146.fontName]) && bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))) === `${block.style.fontName}:${block.style.fontSize}` && text.length > 60;
2491
+ const proseStyle = _optionalChain([block, 'access', _146 => _146.style, 'optionalAccess', _147 => _147.fontName]) && bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))) === `${block.style.fontName}:${block.style.fontSize}` && text.length > 60;
2476
2492
  const next = blocks[i + 1];
2477
- const nb = _optionalChain([next, 'optionalAccess', _147 => _147.bbox]), bb = block.bbox;
2478
- const chapterNumber = !!nb && !!bb && fsz >= (_nullishCoalesce(_optionalChain([next, 'optionalAccess', _148 => _148.style, 'optionalAccess', _149 => _149.fontSize]), () => ( 0))) * 1.2 && Math.abs(bb.x - nb.x) > fsz && Math.abs(bb.x + bb.width / 2 - (nb.x + nb.width / 2)) < nb.width * 0.1;
2479
- if (/^\d+(?:\.\d+)*\.?$/.test(text) && _optionalChain([next, 'optionalAccess', _150 => _150.type]) === "heading" && next.text && next.pageNumber === block.pageNumber && !chapterNumber) {
2493
+ const nb = _optionalChain([next, 'optionalAccess', _148 => _148.bbox]), bb = block.bbox;
2494
+ const chapterNumber = !!nb && !!bb && fsz >= (_nullishCoalesce(_optionalChain([next, 'optionalAccess', _149 => _149.style, 'optionalAccess', _150 => _150.fontSize]), () => ( 0))) * 1.2 && Math.abs(bb.x - nb.x) > fsz && Math.abs(bb.x + bb.width / 2 - (nb.x + nb.width / 2)) < nb.width * 0.1;
2495
+ if (/^\d+(?:\.\d+)*\.?$/.test(text) && _optionalChain([next, 'optionalAccess', _151 => _151.type]) === "heading" && next.text && next.pageNumber === block.pageNumber && !chapterNumber) {
2480
2496
  next.text = `${block.text.trim()} ${next.text.trim()}`;
2481
2497
  blocks.splice(i--, 1);
2482
2498
  continue;
2483
2499
  }
2484
- if ((_optionalChain([next, 'optionalAccess', _151 => _151.type]) === "paragraph" || _optionalChain([next, 'optionalAccess', _152 => _152.type]) === "heading" && !CAPTION.test(text)) && next.pageNumber === block.pageNumber && next.text && next.bbox && block.bbox && _optionalChain([next, 'access', _153 => _153.style, 'optionalAccess', _154 => _154.fontName]) === _optionalChain([block, 'access', _155 => _155.style, 'optionalAccess', _156 => _156.fontName]) && _optionalChain([next, 'access', _157 => _157.style, 'optionalAccess', _158 => _158.fontSize]) === _optionalChain([block, 'access', _159 => _159.style, 'optionalAccess', _160 => _160.fontSize]) && fsz > 0 && /^[a-z]/.test(next.text.trim()) && next.text.trim().length <= 40 && !/[.:;!?]$/.test(next.text.trim()) && block.bbox.y - (next.bbox.y + next.bbox.height) < fsz * 1.2 && Math.abs(next.bbox.x - block.bbox.x) < fsz) {
2500
+ if ((_optionalChain([next, 'optionalAccess', _152 => _152.type]) === "paragraph" || _optionalChain([next, 'optionalAccess', _153 => _153.type]) === "heading" && !CAPTION.test(text)) && next.pageNumber === block.pageNumber && next.text && next.bbox && block.bbox && _optionalChain([next, 'access', _154 => _154.style, 'optionalAccess', _155 => _155.fontName]) === _optionalChain([block, 'access', _156 => _156.style, 'optionalAccess', _157 => _157.fontName]) && _optionalChain([next, 'access', _158 => _158.style, 'optionalAccess', _159 => _159.fontSize]) === _optionalChain([block, 'access', _160 => _160.style, 'optionalAccess', _161 => _161.fontSize]) && fsz > 0 && /^[a-z]/.test(next.text.trim()) && next.text.trim().length <= 40 && !/[.:;!?]$/.test(next.text.trim()) && block.bbox.y - (next.bbox.y + next.bbox.height) < fsz * 1.2 && Math.abs(next.bbox.x - block.bbox.x) < fsz) {
2485
2501
  block.text = `${block.text.trim()} ${next.text.trim()}`;
2486
2502
  block.bbox = { ...block.bbox, y: next.bbox.y, height: block.bbox.y + block.bbox.height - next.bbox.y };
2487
2503
  blocks.splice(i + 1, 1);
2488
2504
  }
2489
2505
  const after = blocks[i + 2];
2490
- if ((_optionalChain([next, 'optionalAccess', _161 => _161.type]) === "paragraph" || _optionalChain([next, 'optionalAccess', _162 => _162.type]) === "heading") && /^(?:&|\+|and|or)$/i.test(_nullishCoalesce(_optionalChain([next, 'access', _163 => _163.text, 'optionalAccess', _164 => _164.trim, 'call', _165 => _165()]), () => ( ""))) && _optionalChain([after, 'optionalAccess', _166 => _166.type]) === "heading" && after.text && after.pageNumber === block.pageNumber && next.pageNumber === block.pageNumber && _optionalChain([after, 'access', _167 => _167.style, 'optionalAccess', _168 => _168.fontSize]) === _optionalChain([block, 'access', _169 => _169.style, 'optionalAccess', _170 => _170.fontSize])) {
2506
+ if ((_optionalChain([next, 'optionalAccess', _162 => _162.type]) === "paragraph" || _optionalChain([next, 'optionalAccess', _163 => _163.type]) === "heading") && /^(?:&|\+|and|or)$/i.test(_nullishCoalesce(_optionalChain([next, 'access', _164 => _164.text, 'optionalAccess', _165 => _165.trim, 'call', _166 => _166()]), () => ( ""))) && _optionalChain([after, 'optionalAccess', _167 => _167.type]) === "heading" && after.text && after.pageNumber === block.pageNumber && next.pageNumber === block.pageNumber && _optionalChain([after, 'access', _168 => _168.style, 'optionalAccess', _169 => _169.fontSize]) === _optionalChain([block, 'access', _170 => _170.style, 'optionalAccess', _171 => _171.fontSize])) {
2491
2507
  block.text = `${block.text.trim()} ${next.text.trim()} ${after.text.trim()}`;
2492
2508
  blocks.splice(i + 1, 2);
2493
2509
  }
2494
2510
  const tiny = fsz > 0 && fsz < 7.5;
2495
2511
  const prev = blocks[i - 1];
2496
- if (_optionalChain([prev, 'optionalAccess', _171 => _171.type]) === "paragraph" && prev.pageNumber === block.pageNumber && /^[a-z]{1,3}[.)]$/.test(_nullishCoalesce(_optionalChain([prev, 'access', _172 => _172.text, 'optionalAccess', _173 => _173.trim, 'call', _174 => _174()]), () => ( ""))) && prev.bbox && block.bbox && Math.abs(prev.bbox.y - block.bbox.y) < 2 && prev.bbox.x + prev.bbox.width <= block.bbox.x) {
2512
+ if (_optionalChain([prev, 'optionalAccess', _172 => _172.type]) === "paragraph" && prev.pageNumber === block.pageNumber && /^[a-z]{1,3}[.)]$/.test(_nullishCoalesce(_optionalChain([prev, 'access', _173 => _173.text, 'optionalAccess', _174 => _174.trim, 'call', _175 => _175()]), () => ( ""))) && prev.bbox && block.bbox && Math.abs(prev.bbox.y - block.bbox.y) < 2 && prev.bbox.x + prev.bbox.width <= block.bbox.x) {
2497
2513
  prev.text = `${prev.text.trim()} ${block.text.trim()}`;
2498
2514
  prev.bbox = { ...prev.bbox, width: block.bbox.x + block.bbox.width - prev.bbox.x };
2499
2515
  blocks.splice(i--, 1);
2500
2516
  continue;
2501
2517
  }
2502
- if (_optionalChain([prev, 'optionalAccess', _175 => _175.type]) === "paragraph" && prev.pageNumber === block.pageNumber && /^\d{1,2}(?:\.\d{1,2})*\.?$/.test(_nullishCoalesce(_optionalChain([prev, 'access', _176 => _176.text, 'optionalAccess', _177 => _177.trim, 'call', _178 => _178()]), () => ( ""))) && prev.bbox && block.bbox && fsz > 0 && (Math.abs(prev.bbox.y - block.bbox.y) < 2 && prev.bbox.x + prev.bbox.width <= block.bbox.x && block.bbox.x - (prev.bbox.x + prev.bbox.width) < fsz * 3 || Math.abs(prev.bbox.x - block.bbox.x) < 2 && (_nullishCoalesce(_optionalChain([prev, 'access', _179 => _179.style, 'optionalAccess', _180 => _180.fontSize]), () => ( 0))) >= fsz && prev.bbox.y - (block.bbox.y + block.bbox.height) < fsz * 1.5)) {
2518
+ if (_optionalChain([prev, 'optionalAccess', _176 => _176.type]) === "paragraph" && prev.pageNumber === block.pageNumber && /^\d{1,2}(?:\.\d{1,2})*\.?$/.test(_nullishCoalesce(_optionalChain([prev, 'access', _177 => _177.text, 'optionalAccess', _178 => _178.trim, 'call', _179 => _179()]), () => ( ""))) && prev.bbox && block.bbox && fsz > 0 && (Math.abs(prev.bbox.y - block.bbox.y) < 2 && prev.bbox.x + prev.bbox.width <= block.bbox.x && block.bbox.x - (prev.bbox.x + prev.bbox.width) < fsz * 3 || Math.abs(prev.bbox.x - block.bbox.x) < 2 && (_nullishCoalesce(_optionalChain([prev, 'access', _180 => _180.style, 'optionalAccess', _181 => _181.fontSize]), () => ( 0))) >= fsz && prev.bbox.y - (block.bbox.y + block.bbox.height) < fsz * 1.5)) {
2503
2519
  block.text = `${prev.text.trim()} ${block.text.trim()}`;
2504
2520
  blocks.splice(i - 1, 1);
2505
2521
  i -= 2;
2506
2522
  continue;
2507
2523
  }
2508
- const box = block.bbox, size = _nullishCoalesce(_optionalChain([block, 'access', _181 => _181.style, 'optionalAccess', _182 => _182.fontSize]), () => ( 0));
2509
- const kicker = !!box && size > 0 && _optionalChain([next, 'optionalAccess', _183 => _183.type]) === "heading" && next.pageNumber === block.pageNumber && !!next.bbox && (_nullishCoalesce(_optionalChain([next, 'access', _184 => _184.style, 'optionalAccess', _185 => _185.fontSize]), () => ( 0))) >= size * 1.3 && box.y - (next.bbox.y + next.bbox.height) <= size * 3 && Math.min(box.x + box.width, next.bbox.x + next.bbox.width) - Math.max(box.x, next.bbox.x) >= Math.min(box.width, next.bbox.width) * 0.5 && !page.some((o) => o !== block && o.bbox && o.bbox.y > box.y + box.height && o.type !== "image");
2510
- const face = _nullishCoalesce(_optionalChain([faceNames, 'optionalAccess', _186 => _186.get, 'call', _187 => _187(_nullishCoalesce(_optionalChain([block, 'access', _188 => _188.style, 'optionalAccess', _189 => _189.fontName]), () => ( "")))]), () => ( ""));
2524
+ const box = block.bbox, size = _nullishCoalesce(_optionalChain([block, 'access', _182 => _182.style, 'optionalAccess', _183 => _183.fontSize]), () => ( 0));
2525
+ const kicker = !!box && size > 0 && _optionalChain([next, 'optionalAccess', _184 => _184.type]) === "heading" && next.pageNumber === block.pageNumber && !!next.bbox && (_nullishCoalesce(_optionalChain([next, 'access', _185 => _185.style, 'optionalAccess', _186 => _186.fontSize]), () => ( 0))) >= size * 1.3 && box.y - (next.bbox.y + next.bbox.height) <= size * 3 && Math.min(box.x + box.width, next.bbox.x + next.bbox.width) - Math.max(box.x, next.bbox.x) >= Math.min(box.width, next.bbox.width) * 0.5 && !page.some((o) => o !== block && o.bbox && o.bbox.y > box.y + box.height && o.type !== "image");
2526
+ const face = _nullishCoalesce(_optionalChain([faceNames, 'optionalAccess', _187 => _187.get, 'call', _188 => _188(_nullishCoalesce(_optionalChain([block, 'access', _189 => _189.style, 'optionalAccess', _190 => _190.fontName]), () => ( "")))]), () => ( ""));
2511
2527
  const [bodyFace, bodySize] = (_nullishCoalesce(bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( ""))).split(":");
2512
- const byline = /Italic|Oblique/i.test(face) && !/Bold|Black|Heavy|Semibold/i.test(face) && !!bodyFace && size <= Number(bodySize) + 0.5 && _optionalChain([blocks, 'access', _190 => _190[i - 1], 'optionalAccess', _191 => _191.type]) === "heading" && blocks[i - 1].pageNumber === block.pageNumber;
2513
- const ocrFragment = _optionalChain([block, 'access', _192 => _192.style, 'optionalAccess', _193 => _193.fontName]) === "ocr" && (/^[.,;:…·•-]/.test(text) || text.includes("\u2026") || (_nullishCoalesce(_optionalChain([text, 'access', _194 => _194.match, 'call', _195 => _195(/\p{L}/gu), 'optionalAccess', _196 => _196.length]), () => ( 0))) < 2 || text.split(/\s+/).length > 7);
2528
+ const byline = /Italic|Oblique/i.test(face) && !/Bold|Black|Heavy|Semibold/i.test(face) && !!bodyFace && size <= Number(bodySize) + 0.5 && _optionalChain([blocks, 'access', _191 => _191[i - 1], 'optionalAccess', _192 => _192.type]) === "heading" && blocks[i - 1].pageNumber === block.pageNumber;
2529
+ const ocrFragment = _optionalChain([block, 'access', _193 => _193.style, 'optionalAccess', _194 => _194.fontName]) === "ocr" && (/^[.,;:…·•-]/.test(text) || text.includes("\u2026") || (_nullishCoalesce(_optionalChain([text, 'access', _195 => _195.match, 'call', _196 => _196(/\p{L}/gu), 'optionalAccess', _197 => _197.length]), () => ( 0))) < 2 || text.split(/\s+/).length > 7);
2514
2530
  if (ocrFragment || tocEntry || proseStyle || kicker || byline || tiny || !/\p{L}/u.test(text) && !chapterNumber || /^[a-z]/.test(text) || CAPTION.test(text) || EQUATION_NUMBER.test(block.text) || DISPLAY_MATH.test(text) || // 닫는 괄호가 여는 괄호보다 많으면 앞 줄에서 이어진 문장 조각이다 ("Fact-checking) and is used …") — "1)"·"가)" 앞머리 번호는 빼고 센다
2515
2531
  unbalancedClose(text.replace(/^\s*[\dA-Za-z가-힣ⅰ-ⅹ]{1,3}\)\s*/, "")) || isRunningHead(block, page, pageHeights.get(_nullishCoalesce(block.pageNumber, () => ( 0))))) {
2516
2532
  block.type = "paragraph";
@@ -2545,28 +2561,28 @@ var CAPTION_LABEL = /^(?:figure|fig\.|diagram|table|chart|graph|exhibit|box)\s*[
2545
2561
  function captionTableText(t) {
2546
2562
  if (!t || t.rows !== 1 || t.cols !== 2) return null;
2547
2563
  const [label, body] = t.cells[0];
2548
- if (!label || !body || _optionalChain([label, 'access', _197 => _197.blocks, 'optionalAccess', _198 => _198.length]) || _optionalChain([body, 'access', _199 => _199.blocks, 'optionalAccess', _200 => _200.length]) || !CAPTION_LABEL.test(label.text.trim()) || !body.text.trim()) return null;
2564
+ if (!label || !body || _optionalChain([label, 'access', _198 => _198.blocks, 'optionalAccess', _199 => _199.length]) || _optionalChain([body, 'access', _200 => _200.blocks, 'optionalAccess', _201 => _201.length]) || !CAPTION_LABEL.test(label.text.trim()) || !body.text.trim()) return null;
2549
2565
  return `${label.text.trim()} ${body.text.replace(/\s*\n\s*/g, " ").trim()}`;
2550
2566
  }
2551
2567
  function splitSingleCellTables(blocks) {
2552
2568
  const out = [];
2553
2569
  for (const b of blocks) {
2554
2570
  const t = b.type === "table" ? b.table : void 0;
2555
- const only = t && t.rows === 1 && t.cols === 1 && _optionalChain([t, 'access', _201 => _201.cells, 'access', _202 => _202[0], 'optionalAccess', _203 => _203[0], 'optionalAccess', _204 => _204.blocks, 'optionalAccess', _205 => _205.length]) === 1 ? t.cells[0][0].blocks[0] : void 0;
2571
+ const only = t && t.rows === 1 && t.cols === 1 && _optionalChain([t, 'access', _202 => _202.cells, 'access', _203 => _203[0], 'optionalAccess', _204 => _204[0], 'optionalAccess', _205 => _205.blocks, 'optionalAccess', _206 => _206.length]) === 1 ? t.cells[0][0].blocks[0] : void 0;
2556
2572
  const squash = (s) => s.replace(/\s/g, "");
2557
2573
  const inner = only && (!squash(t.cells[0][0].text) || only.type === "table" && squash(t.cells[0][0].text) === squash(only.table.cells.flat().map((c) => c.text).join(""))) ? only : void 0;
2558
- const caption = _nullishCoalesce(captionTableText(t), () => ( (_optionalChain([inner, 'optionalAccess', _206 => _206.type]) === "table" ? captionTableText(inner.table) : null)));
2574
+ const caption = _nullishCoalesce(captionTableText(t), () => ( (_optionalChain([inner, 'optionalAccess', _207 => _207.type]) === "table" ? captionTableText(inner.table) : null)));
2559
2575
  if (caption) {
2560
2576
  out.push({ type: "paragraph", text: caption, pageNumber: b.pageNumber, bbox: b.bbox });
2561
2577
  continue;
2562
2578
  }
2563
- const cell = t && t.rows === 1 && t.cols === 1 ? _optionalChain([t, 'access', _207 => _207.cells, 'access', _208 => _208[0], 'optionalAccess', _209 => _209[0]]) : void 0;
2564
- if (!cell || _optionalChain([cell, 'access', _210 => _210.blocks, 'optionalAccess', _211 => _211.some, 'call', _212 => _212((x) => x.type === "table")])) {
2579
+ const cell = t && t.rows === 1 && t.cols === 1 ? _optionalChain([t, 'access', _208 => _208.cells, 'access', _209 => _209[0], 'optionalAccess', _210 => _210[0]]) : void 0;
2580
+ if (!cell || _optionalChain([cell, 'access', _211 => _211.blocks, 'optionalAccess', _212 => _212.some, 'call', _213 => _213((x) => x.type === "table")])) {
2565
2581
  out.push(b);
2566
2582
  continue;
2567
2583
  }
2568
2584
  const lines = (_nullishCoalesce(cell.text, () => ( ""))).split(/\n/).map((l) => l.trim()).filter(Boolean);
2569
- if (_optionalChain([t, 'optionalAccess', _213 => _213.caption, 'optionalAccess', _214 => _214.trim, 'call', _215 => _215()])) out.push({ type: "paragraph", text: t.caption.trim(), pageNumber: b.pageNumber, bbox: b.bbox });
2585
+ if (_optionalChain([t, 'optionalAccess', _214 => _214.caption, 'optionalAccess', _215 => _215.trim, 'call', _216 => _216()])) out.push({ type: "paragraph", text: t.caption.trim(), pageNumber: b.pageNumber, bbox: b.bbox });
2570
2586
  for (const text of lines) out.push({ type: "paragraph", text, pageNumber: b.pageNumber, bbox: b.bbox });
2571
2587
  }
2572
2588
  return out;
@@ -2579,7 +2595,7 @@ function joinLatinCellWraps(blocks) {
2579
2595
  const lines = cell.text.split("\n");
2580
2596
  const out = [lines[0]];
2581
2597
  for (const line of lines.slice(1)) {
2582
- if (_chunkXEPKOC2Ocjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
2598
+ if (_chunkWWMKIHF7cjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
2583
2599
  else out.push(line);
2584
2600
  }
2585
2601
  cell.text = out.join("\n");
@@ -2590,19 +2606,19 @@ function joinLatinCellWraps(blocks) {
2590
2606
  }
2591
2607
  function cleanPdfText(text, opts) {
2592
2608
  let clean = normalizeAraea(stripControlChars(text));
2593
- if (!_optionalChain([opts, 'optionalAccess', _216 => _216.keepLoneNumbers])) {
2609
+ if (!_optionalChain([opts, 'optionalAccess', _217 => _217.keepLoneNumbers])) {
2594
2610
  clean = clean.replace(/^\d{1,4}\n/, "").replace(/\n\d{1,4}\n/g, "\n").replace(/\n\d{1,4}$/, "");
2595
2611
  }
2596
- if (!_optionalChain([opts, 'optionalAccess', _217 => _217.keepLoneNumbers])) clean = clean.replace(/^#{1,6}\s*\d{1,4}\s*$/gm, "");
2612
+ if (!_optionalChain([opts, 'optionalAccess', _218 => _218.keepLoneNumbers])) clean = clean.replace(/^#{1,6}\s*\d{1,4}\s*$/gm, "");
2597
2613
  return mergeKoreanLines(
2598
2614
  clean.replace(/^[\s]*[-–—]\s*[-–—]?\d+[-–—]?[\s]*[-–—]?[\s]*$/gm, "").replace(/^\s*\d+\s*\/\s*\d+\s*$/gm, "").replace(/\.(?: \.){3,}/g, (m) => ".".repeat(m.length + 1 >> 1))
2599
2615
  ).replace(/^(?!\| ---).*$/gm, (line) => {
2600
2616
  if (/^\s*\${1,2}.+\${1,2}\s*$/.test(line)) return line;
2601
2617
  if (line.startsWith("|")) {
2602
- return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkXEPKOC2Ocjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
2618
+ return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkWWMKIHF7cjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
2603
2619
  }
2604
- const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _218 => _218.exec, 'call', _219 => _219(line), 'optionalAccess', _220 => _220[0]]), () => ( ""));
2605
- return mark + _chunkXEPKOC2Ocjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
2620
+ const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _219 => _219.exec, 'call', _220 => _220(line), 'optionalAccess', _221 => _221[0]]), () => ( ""));
2621
+ return mark + _chunkWWMKIHF7cjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
2606
2622
  }).replace(/\\~\\~/g, "~~").replace(/~~~~/g, "").replace(/<u>\s*<\/u>/g, "").replace(/<(sup|sub)>\s*<\/\1>/g, "").replace(/\n{3,}/g, "\n\n").trim();
2607
2623
  }
2608
2624
  function startsWithMarker(line) {
@@ -2634,7 +2650,7 @@ function mergeKoreanLines(text) {
2634
2650
  continue;
2635
2651
  }
2636
2652
  if (/[가-힣·,\-]$/.test(prev) && /^[가-힣(]/.test(curr) && !startsWithMarker(curr) && !isStandaloneHeader(prev) && !startsWithMarker(prev)) {
2637
- result[result.length - 1] = prev + _chunkXEPKOC2Ocjs.wrapJoiner.call(void 0, prev, curr) + curr;
2653
+ result[result.length - 1] = prev + _chunkWWMKIHF7cjs.wrapJoiner.call(void 0, prev, curr) + curr;
2638
2654
  } else {
2639
2655
  result.push(curr);
2640
2656
  }
@@ -2650,7 +2666,7 @@ function applyLinkAnnotations(items, annots) {
2650
2666
  const wrapped = /* @__PURE__ */ new Set();
2651
2667
  for (const a of annots) {
2652
2668
  if (a.subtype !== "Link" || !a.url || !a.rect || a.rect.length < 4) continue;
2653
- const url = _chunkQNJLLF4Jcjs.sanitizeHref.call(void 0, a.url);
2669
+ const url = _chunkKZVQK5NScjs.sanitizeHref.call(void 0, a.url);
2654
2670
  if (!url) continue;
2655
2671
  const x1 = Math.min(a.rect[0], a.rect[2]), x2 = Math.max(a.rect[0], a.rect[2]);
2656
2672
  const y1 = Math.min(a.rect[1], a.rect[3]), y2 = Math.max(a.rect[1], a.rect[3]);
@@ -2691,7 +2707,7 @@ function mergeLinkRuns(markdown) {
2691
2707
 
2692
2708
  // src/pdf/formula-ocr.ts
2693
2709
  async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
2694
- const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-ECNOZT36.cjs")));
2710
+ const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-5RETDCIC.cjs")));
2695
2711
  const { FormulaPipeline, ensureFormulaModels } = formulaMod;
2696
2712
  await ensureFormulaModels((p) => {
2697
2713
  if (p.phase === "download" && p.total) {
@@ -2870,13 +2886,13 @@ async function loadPdfWithTimeout(buffer) {
2870
2886
  try {
2871
2887
  return await Promise.race([
2872
2888
  loadingTask.promise.catch((e) => {
2873
- if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkQNJLLF4Jcjs.KordocError)("\uC554\uD638\uB85C \uBCF4\uD638\uB41C PDF \uD30C\uC77C\uC785\uB2C8\uB2E4 (PDF \uC5F4\uAE30 \uC554\uD638\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4)");
2889
+ if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkKZVQK5NScjs.KordocError)("\uC554\uD638\uB85C \uBCF4\uD638\uB41C PDF \uD30C\uC77C\uC785\uB2C8\uB2E4 (PDF \uC5F4\uAE30 \uC554\uD638\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4)");
2874
2890
  throw e;
2875
2891
  }),
2876
2892
  new Promise((_, reject) => {
2877
2893
  timer = setTimeout(() => {
2878
2894
  loadingTask.destroy();
2879
- reject(new (0, _chunkQNJLLF4Jcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
2895
+ reject(new (0, _chunkKZVQK5NScjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
2880
2896
  }, PDF_LOAD_TIMEOUT_MS);
2881
2897
  })
2882
2898
  ]);
@@ -2885,13 +2901,13 @@ async function loadPdfWithTimeout(buffer) {
2885
2901
  }
2886
2902
  }
2887
2903
  async function parsePdfDocument(buffer, options) {
2888
- const formulaBuffer = _optionalChain([options, 'optionalAccess', _221 => _221.formulaOcr]) ? buffer : null;
2889
- const autoOcr = _optionalChain([options, 'optionalAccess', _222 => _222.ocr]) === void 0 && await _chunkXEPKOC2Ocjs.ocrModelsCached.call(void 0, );
2890
- const ocrBuffer = _optionalChain([options, 'optionalAccess', _223 => _223.ocr]) || autoOcr ? buffer : null;
2904
+ const formulaBuffer = _optionalChain([options, 'optionalAccess', _222 => _222.formulaOcr]) ? buffer : null;
2905
+ const autoOcr = _optionalChain([options, 'optionalAccess', _223 => _223.ocr]) === void 0 && await _chunkWWMKIHF7cjs.ocrModelsCached.call(void 0, );
2906
+ const ocrBuffer = _optionalChain([options, 'optionalAccess', _224 => _224.ocr]) || autoOcr ? buffer : null;
2891
2907
  const doc = await loadPdfWithTimeout(buffer);
2892
2908
  try {
2893
2909
  const pageCount = doc.numPages;
2894
- if (pageCount === 0) throw new (0, _chunkQNJLLF4Jcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
2910
+ if (pageCount === 0) throw new (0, _chunkKZVQK5NScjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
2895
2911
  const metadata = { pageCount, pageMode: "layout" };
2896
2912
  await extractPdfMetadata(doc, metadata);
2897
2913
  const blocks = [];
@@ -2900,8 +2916,8 @@ async function parsePdfDocument(buffer, options) {
2900
2916
  let totalChars = 0;
2901
2917
  let totalTextBytes = 0;
2902
2918
  const effectivePageCount = Math.min(pageCount, MAX_PAGES);
2903
- const pageFilter = _optionalChain([options, 'optionalAccess', _224 => _224.pages]) ? _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, effectivePageCount) : null;
2904
- if (pageCount > MAX_PAGES && (!_optionalChain([options, 'optionalAccess', _225 => _225.pages]) || _chunkJ55UQC5Hcjs.hasRequestedPagesAfter.call(void 0, options.pages, MAX_PAGES, pageCount))) {
2919
+ const pageFilter = _optionalChain([options, 'optionalAccess', _225 => _225.pages]) ? _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, effectivePageCount) : null;
2920
+ if (pageCount > MAX_PAGES && (!_optionalChain([options, 'optionalAccess', _226 => _226.pages]) || _chunkJ55UQC5Hcjs.hasRequestedPagesAfter.call(void 0, options.pages, MAX_PAGES, pageCount))) {
2905
2921
  warnings.push({ message: `${pageCount}\uCABD \uC911 \uC55E ${MAX_PAGES}\uCABD\uB9CC \uD30C\uC2F1\uD588\uC2B5\uB2C8\uB2E4 (\uCABD \uC218 \uC0C1\uD55C)`, code: "PARTIAL_PARSE" });
2906
2922
  }
2907
2923
  const totalTarget = pageFilter ? pageFilter.size : effectivePageCount;
@@ -2918,7 +2934,7 @@ async function parsePdfDocument(buffer, options) {
2918
2934
  const pageImageBlocks = /* @__PURE__ */ new Map();
2919
2935
  const carry = {};
2920
2936
  const vectorPageOps = /* @__PURE__ */ new Map();
2921
- const wrapLexicon = new (0, _chunkXEPKOC2Ocjs.WrapLexicon)();
2937
+ const wrapLexicon = new (0, _chunkWWMKIHF7cjs.WrapLexicon)();
2922
2938
  const noteMarks = /* @__PURE__ */ new Map();
2923
2939
  let parsedPages = 0;
2924
2940
  for (let i = 1; i <= effectivePageCount; i++) {
@@ -2941,13 +2957,13 @@ async function parsePdfDocument(buffer, options) {
2941
2957
  return void 0;
2942
2958
  }
2943
2959
  };
2944
- const differencesOf = (loadedName) => _optionalChain([fontObj, 'call', _226 => _226(loadedName), 'optionalAccess', _227 => _227.differences]);
2945
- restoreNamedGlyphs(rawItems, rawOps.fnArray, rawOps.argsArray, differencesOf, (n) => _optionalChain([fontObj, 'call', _228 => _228(n), 'optionalAccess', _229 => _229.name]));
2960
+ const differencesOf = (loadedName) => _optionalChain([fontObj, 'call', _227 => _227(loadedName), 'optionalAccess', _228 => _228.differences]);
2961
+ restoreNamedGlyphs(rawItems, rawOps.fnArray, rawOps.argsArray, differencesOf, (n) => _optionalChain([fontObj, 'call', _229 => _229(n), 'optionalAccess', _230 => _230.name]));
2946
2962
  restoreTrackedSpacing(rawItems, rawOps.fnArray, rawOps.argsArray);
2947
2963
  markSyntheticSpaces(rawItems, rawOps.fnArray, rawOps.argsArray);
2948
2964
  const occluded = occludedTextItems(rawItems, rawOps.fnArray, rawOps.argsArray);
2949
- const items = _chunkXEPKOC2Ocjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
2950
- const filtered = _chunkXEPKOC2Ocjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
2965
+ const items = _chunkWWMKIHF7cjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
2966
+ const filtered = _chunkWWMKIHF7cjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
2951
2967
  const joined = joinVerticalColumns(filtered.visible);
2952
2968
  const visible = dropTabLeaderDots(joined);
2953
2969
  const hiddenCount = filtered.hiddenCount + occluded.size;
@@ -2971,7 +2987,7 @@ async function parsePdfDocument(buffer, options) {
2971
2987
  fnArray: [_pdfmjs.OPS.transform, ...rawOps.fnArray],
2972
2988
  argsArray: [[1, 0, 0, 1, -viewX1, -viewY1], ...rawOps.argsArray]
2973
2989
  } : rawOps;
2974
- remapSymbolFontItems(visible, (loadedName) => _optionalChain([fontObj, 'call', _230 => _230(loadedName), 'optionalAccess', _231 => _231.name]));
2990
+ remapSymbolFontItems(visible, (loadedName) => _optionalChain([fontObj, 'call', _231 => _231(loadedName), 'optionalAccess', _232 => _232.name]));
2975
2991
  remapControlGlyphs(visible, differencesOf);
2976
2992
  const faces = /* @__PURE__ */ new Map();
2977
2993
  for (const it of visible) {
@@ -2979,17 +2995,17 @@ async function parsePdfDocument(buffer, options) {
2979
2995
  let face = faces.get(it.fontName);
2980
2996
  if (face === void 0) {
2981
2997
  const obj = fontObj(it.fontName);
2982
- face = _optionalChain([obj, 'optionalAccess', _232 => _232.isType3Font]) && /^[A-Z]{6}\+./.test(_nullishCoalesce(obj.name, () => ( ""))) && obj.name.slice(7) || it.fontName;
2998
+ face = _optionalChain([obj, 'optionalAccess', _233 => _233.isType3Font]) && /^[A-Z]{6}\+./.test(_nullishCoalesce(obj.name, () => ( ""))) && obj.name.slice(7) || it.fontName;
2983
2999
  faces.set(it.fontName, face);
2984
3000
  }
2985
3001
  it.fontName = face;
2986
- if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _233 => _233(face), 'optionalAccess', _234 => _234.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
3002
+ if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _234 => _234(face), 'optionalAccess', _235 => _235.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
2987
3003
  }
2988
- for (const it of visible) if (it.text.includes("$")) it.text = _chunkR2BUANHQcjs.escapeLiteralDollar.call(void 0, it.text);
3004
+ for (const it of visible) if (it.text.includes("$")) it.text = _chunkGPC72VSFcjs.escapeLiteralDollar.call(void 0, it.text);
2989
3005
  wrapEquationRuns(visible, (face) => faceNames.get(face));
2990
3006
  const pageArea = pageW * pageH;
2991
3007
  if (pageArea > 0) {
2992
- const imageRegions = _chunkXEPKOC2Ocjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
3008
+ const imageRegions = _chunkWWMKIHF7cjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
2993
3009
  let uncovered = 0;
2994
3010
  for (const r of imageRegions) {
2995
3011
  const area = (r.x2 - r.x1) * (r.y2 - r.y1);
@@ -3015,14 +3031,14 @@ async function parsePdfDocument(buffer, options) {
3015
3031
  if (uncovered > 0) skippedImagePages.set(i, uncovered);
3016
3032
  }
3017
3033
  const marks = superscriptNoteMarks(visible);
3018
- if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunkXEPKOC2Ocjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
3034
+ if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunkWWMKIHF7cjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
3019
3035
  const stamp = marginStamp(visible);
3020
3036
  const flow = stamp.length ? visible.filter((it) => !stamp.includes(it)) : visible;
3021
- const pageBlocks = orderTwoUpPage(_chunkXEPKOC2Ocjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _235 => _235.tables]) !== false, carry, wrapLexicon), pageW, pageH);
3037
+ const pageBlocks = orderTwoUpPage(_chunkWWMKIHF7cjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _236 => _236.tables]) !== false, carry, wrapLexicon), pageW, pageH);
3022
3038
  if (stamp.length) pageBlocks.unshift({ type: "paragraph", text: [...stamp].sort((a, b) => a.y - b.y).map((it) => it.text).join(" "), pageNumber: i });
3023
3039
  for (const b of pageBlocks) blocks.push(b);
3024
3040
  try {
3025
- const { blocks: imgBlocks, images: pageImages } = await extractPageImages(page, opList.fnArray, opList.argsArray, i, imageState, warnings, _optionalChain([options, 'optionalAccess', _236 => _236.images]) !== false);
3041
+ const { blocks: imgBlocks, images: pageImages } = await extractPageImages(page, opList.fnArray, opList.argsArray, i, imageState, warnings, _optionalChain([options, 'optionalAccess', _237 => _237.images]) !== false);
3026
3042
  if (imgBlocks.length > 0) pageImageBlocks.set(i, imgBlocks);
3027
3043
  extractedImages.push(...pageImages);
3028
3044
  } catch (e6) {
@@ -3041,27 +3057,27 @@ async function parsePdfDocument(buffer, options) {
3041
3057
  const vector = scanVectorGlyphs(opList.fnArray, opList.argsArray, visible);
3042
3058
  const quality = computePageQuality(i, pageText, vector.glyphs);
3043
3059
  pageQuality.push(quality);
3044
- if (_optionalChain([options, 'optionalAccess', _237 => _237.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
3060
+ if (_optionalChain([options, 'optionalAccess', _238 => _238.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
3045
3061
  vectorPageOps.set(i, ocrVectorOps(opList, vector.paths));
3046
3062
  }
3047
- if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkQNJLLF4Jcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
3063
+ if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkKZVQK5NScjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
3048
3064
  parsedPages++;
3049
- _optionalChain([options, 'optionalAccess', _238 => _238.onProgress, 'optionalCall', _239 => _239(parsedPages, totalTarget)]);
3065
+ _optionalChain([options, 'optionalAccess', _239 => _239.onProgress, 'optionalCall', _240 => _240(parsedPages, totalTarget)]);
3050
3066
  } catch (pageErr) {
3051
- if (pageErr instanceof _chunkQNJLLF4Jcjs.KordocError) throw pageErr;
3067
+ if (pageErr instanceof _chunkKZVQK5NScjs.KordocError) throw pageErr;
3052
3068
  warnings.push({ page: i, message: `\uD398\uC774\uC9C0 ${i} \uD30C\uC2F1 \uC2E4\uD328: ${pageErr instanceof Error ? pageErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
3053
3069
  } finally {
3054
- _optionalChain([loadedPage, 'optionalAccess', _240 => _240.cleanup, 'call', _241 => _241()]);
3070
+ _optionalChain([loadedPage, 'optionalAccess', _241 => _241.cleanup, 'call', _242 => _242()]);
3055
3071
  }
3056
3072
  }
3057
3073
  const parsedPageCount = parsedPages || (pageFilter ? pageFilter.size : effectivePageCount);
3058
- const isImageBased = _optionalChain([pageFilter, 'optionalAccess', _242 => _242.size]) !== 0 && totalChars / Math.max(parsedPageCount, 1) < 10;
3074
+ const isImageBased = _optionalChain([pageFilter, 'optionalAccess', _243 => _243.size]) !== 0 && totalChars / Math.max(parsedPageCount, 1) < 10;
3059
3075
  const ocrDone = /* @__PURE__ */ new Set();
3060
- const ocrRegions = _optionalChain([options, 'optionalAccess', _243 => _243.ocr]) === true || autoOcr ? ocrImageRegions(uncoveredImageRegions, largeImageRegions, _optionalChain([options, 'optionalAccess', _244 => _244.ocr]) === true) : /* @__PURE__ */ new Map();
3076
+ const ocrRegions = _optionalChain([options, 'optionalAccess', _244 => _244.ocr]) === true || autoOcr ? ocrImageRegions(uncoveredImageRegions, largeImageRegions, _optionalChain([options, 'optionalAccess', _245 => _245.ocr]) === true) : /* @__PURE__ */ new Map();
3061
3077
  if (ocrBuffer) {
3062
3078
  const inScope = (p) => !pageFilter || pageFilter.has(p);
3063
3079
  const targets = /* @__PURE__ */ new Set();
3064
- if (_optionalChain([options, 'optionalAccess', _245 => _245.ocr]) === "force" || isImageBased) {
3080
+ if (_optionalChain([options, 'optionalAccess', _246 => _246.ocr]) === "force" || isImageBased) {
3065
3081
  for (let i = 1; i <= effectivePageCount; i++) if (inScope(i)) targets.add(i);
3066
3082
  } else {
3067
3083
  for (const pq of pageQuality) {
@@ -3074,16 +3090,16 @@ async function parsePdfDocument(buffer, options) {
3074
3090
  }
3075
3091
  if (targets.size > 0) {
3076
3092
  try {
3077
- const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-STK5EQFF.cjs")));
3078
- const mode = typeof _optionalChain([options, 'optionalAccess', _246 => _246.ocr]) === "function" ? options.ocr : "builtin";
3079
- const regionPages = new Map([...ocrRegions].filter(([p]) => _optionalChain([options, 'optionalAccess', _247 => _247.ocr]) !== "force" && !isImageBased && !_optionalChain([pageQuality, 'access', _248 => _248.find, 'call', _249 => _249((q) => q.page === p), 'optionalAccess', _250 => _250.needsOcr])));
3080
- const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, _optionalChain([options, 'optionalAccess', _251 => _251.onProgress]), _optionalChain([options, 'optionalAccess', _252 => _252.tables]) !== false, vectorPageOps, regionPages);
3081
- for (const obs of ocrPageBlocks.values()) _chunkAKB72TEHcjs.stripScriptTags.call(void 0, { blocks: obs });
3093
+ const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-3SZUM3CN.cjs")));
3094
+ const mode = typeof _optionalChain([options, 'optionalAccess', _247 => _247.ocr]) === "function" ? options.ocr : "builtin";
3095
+ const regionPages = new Map([...ocrRegions].filter(([p]) => _optionalChain([options, 'optionalAccess', _248 => _248.ocr]) !== "force" && !isImageBased && !_optionalChain([pageQuality, 'access', _249 => _249.find, 'call', _250 => _250((q) => q.page === p), 'optionalAccess', _251 => _251.needsOcr])));
3096
+ const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, _optionalChain([options, 'optionalAccess', _252 => _252.onProgress]), _optionalChain([options, 'optionalAccess', _253 => _253.tables]) !== false, vectorPageOps, regionPages);
3097
+ for (const obs of ocrPageBlocks.values()) _chunkYIANW5QXcjs.stripScriptTags.call(void 0, { blocks: obs });
3082
3098
  if (ocrPageBlocks.size > 0) {
3083
3099
  const replacePages = /* @__PURE__ */ new Set();
3084
3100
  for (const [p, obs] of ocrPageBlocks) {
3085
- const needsOcr = _optionalChain([pageQuality, 'access', _253 => _253.find, 'call', _254 => _254((q) => q.page === p), 'optionalAccess', _255 => _255.needsOcr]);
3086
- if (_optionalChain([options, 'optionalAccess', _256 => _256.ocr]) === "force" || isImageBased || needsOcr) {
3101
+ const needsOcr = _optionalChain([pageQuality, 'access', _254 => _254.find, 'call', _255 => _255((q) => q.page === p), 'optionalAccess', _256 => _256.needsOcr]);
3102
+ if (_optionalChain([options, 'optionalAccess', _257 => _257.ocr]) === "force" || isImageBased || needsOcr) {
3087
3103
  replacePages.add(p);
3088
3104
  ocrDone.add(p);
3089
3105
  continue;
@@ -3091,7 +3107,7 @@ async function parsePdfDocument(buffer, options) {
3091
3107
  const regions = ocrRegions.get(p);
3092
3108
  if (!regions || mergeOcrImageRegions(blocks, p, regions, obs) === 0) continue;
3093
3109
  ocrDone.add(p);
3094
- if (_optionalChain([pageImageBlocks, 'access', _257 => _257.get, 'call', _258 => _258(p), 'optionalAccess', _259 => _259.length]) === 1) pageImageBlocks.delete(p);
3110
+ if (_optionalChain([pageImageBlocks, 'access', _258 => _258.get, 'call', _259 => _259(p), 'optionalAccess', _260 => _260.length]) === 1) pageImageBlocks.delete(p);
3095
3111
  }
3096
3112
  if (replacePages.size) {
3097
3113
  const merged = blocks.filter((b) => !(b.pageNumber && replacePages.has(b.pageNumber)));
@@ -3141,8 +3157,8 @@ async function parsePdfDocument(buffer, options) {
3141
3157
  warnings.push({ page, message: `${count}\uAC1C \uC774\uBBF8\uC9C0 \uC601\uC5ED\uC5D0 \uCD94\uCD9C \uAC00\uB2A5\uD55C \uD14D\uC2A4\uD2B8 \uC5C6\uC74C (\uADF8\uB9BC/\uCC28\uD2B8/\uB3C4\uC7A5 \uB0B4\uC6A9 \uB204\uB77D \uAC00\uB2A5 \u2014 \uADF8\uB9BC \uC18D \uAE00\uC740 ocr: true / CLI --ocr \uB85C \uC77D\uC2B5\uB2C8\uB2E4)`, code: "SKIPPED_IMAGE" });
3142
3158
  }
3143
3159
  }
3144
- if (_optionalChain([options, 'optionalAccess', _260 => _260.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
3145
- const removed = _chunkXEPKOC2Ocjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks);
3160
+ if (_optionalChain([options, 'optionalAccess', _261 => _261.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
3161
+ const removed = _chunkWWMKIHF7cjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks);
3146
3162
  for (let ri = removed.length - 1; ri >= 0; ri--) {
3147
3163
  blocks.splice(removed[ri], 1);
3148
3164
  }
@@ -3154,15 +3170,15 @@ async function parsePdfDocument(buffer, options) {
3154
3170
  }
3155
3171
  mergeContinuedCells(blocks, pageHeights);
3156
3172
  mergeCrossPageTables(blocks, pageHeights, wrapLexicon);
3157
- if (_optionalChain([options, 'optionalAccess', _261 => _261.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
3158
- const boxes = _chunkXEPKOC2Ocjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
3173
+ if (_optionalChain([options, 'optionalAccess', _262 => _262.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
3174
+ const boxes = _chunkWWMKIHF7cjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
3159
3175
  for (let ri = boxes.length - 1; ri >= 0; ri--) blocks.splice(boxes[ri], 1);
3160
3176
  }
3161
3177
  splitContactTables(blocks);
3162
- if (!_optionalChain([options, 'optionalAccess', _262 => _262.keepTrailingEmptyCols])) _chunkXEPKOC2Ocjs.trimTrailingEmptyTableCols.call(void 0, blocks);
3163
- _chunkXEPKOC2Ocjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
3178
+ if (!_optionalChain([options, 'optionalAccess', _263 => _263.keepTrailingEmptyCols])) _chunkWWMKIHF7cjs.trimTrailingEmptyTableCols.call(void 0, blocks);
3179
+ _chunkWWMKIHF7cjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
3164
3180
  injectPageImageBlocks(blocks, pageImageBlocks);
3165
- if (_optionalChain([options, 'optionalAccess', _263 => _263.formulaOcr]) && formulaBuffer) {
3181
+ if (_optionalChain([options, 'optionalAccess', _264 => _264.formulaOcr]) && formulaBuffer) {
3166
3182
  try {
3167
3183
  await applyFormulaOcr(formulaBuffer, blocks, pageFilter, effectivePageCount, warnings, options.onProgress);
3168
3184
  } catch (e) {
@@ -3172,47 +3188,49 @@ async function parsePdfDocument(buffer, options) {
3172
3188
  });
3173
3189
  }
3174
3190
  }
3175
- const medianFontSize = _chunkXEPKOC2Ocjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
3191
+ const medianFontSize = _chunkWWMKIHF7cjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
3176
3192
  if (medianFontSize > 0) {
3177
- _chunkXEPKOC2Ocjs.detectHeadings.call(void 0, blocks, medianFontSize);
3178
- }
3179
- _chunkXEPKOC2Ocjs.detectDocumentStyleHeadings.call(void 0, blocks);
3180
- _chunkXEPKOC2Ocjs.detectTypographyHeadings.call(void 0, blocks);
3181
- _chunkXEPKOC2Ocjs.detectSiblingStyleHeadings.call(void 0, blocks);
3182
- _chunkXEPKOC2Ocjs.detectRepeatedPageLabels.call(void 0, blocks);
3183
- _chunkXEPKOC2Ocjs.detectPageLeadHeadings.call(void 0, blocks);
3184
- _chunkXEPKOC2Ocjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
3185
- _chunkXEPKOC2Ocjs.refineDocumentStyleHeadings.call(void 0, blocks);
3186
- _chunkXEPKOC2Ocjs.detectMarkerHeadings.call(void 0, blocks);
3193
+ _chunkWWMKIHF7cjs.detectHeadings.call(void 0, blocks, medianFontSize);
3194
+ }
3195
+ _chunkWWMKIHF7cjs.detectDocumentStyleHeadings.call(void 0, blocks);
3196
+ _chunkWWMKIHF7cjs.detectTypographyHeadings.call(void 0, blocks);
3197
+ _chunkWWMKIHF7cjs.detectSiblingStyleHeadings.call(void 0, blocks);
3198
+ _chunkWWMKIHF7cjs.detectRepeatedPageLabels.call(void 0, blocks);
3199
+ _chunkWWMKIHF7cjs.detectPageLeadHeadings.call(void 0, blocks);
3200
+ _chunkWWMKIHF7cjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
3201
+ _chunkWWMKIHF7cjs.refineDocumentStyleHeadings.call(void 0, blocks);
3202
+ _chunkWWMKIHF7cjs.detectMarkerHeadings.call(void 0, blocks);
3187
3203
  demoteNonHeadingRoles(blocks, pageHeights, faceNames);
3188
- _chunkXEPKOC2Ocjs.detectTableCaptions.call(void 0, blocks);
3189
- _chunkXEPKOC2Ocjs.detectKoreanListBlocks.call(void 0, blocks);
3204
+ _chunkWWMKIHF7cjs.detectTableCaptions.call(void 0, blocks);
3205
+ _chunkWWMKIHF7cjs.detectKoreanListBlocks.call(void 0, blocks);
3190
3206
  const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
3191
3207
  sanitizeBlockControlChars(blocks);
3192
3208
  let outBlocks = splitSingleCellTables(blocks);
3193
3209
  outBlocks = inlineFootnotes(outBlocks, noteMarks);
3194
3210
  outBlocks = relocateEndnotes(outBlocks);
3195
- if (_optionalChain([options, 'optionalAccess', _264 => _264.removeHeaderFooter]) !== false) outBlocks = outBlocks.filter((b) => {
3211
+ if (_optionalChain([options, 'optionalAccess', _265 => _265.removeHeaderFooter]) !== false) outBlocks = outBlocks.filter((b) => {
3196
3212
  if (b.type !== "paragraph" || !/^\s*\d{1,4}\s*$/.test(_nullishCoalesce(b.text, () => ( "")))) return true;
3197
3213
  const h = pageHeights.get(_nullishCoalesce(b.pageNumber, () => ( 0)));
3198
3214
  if (!b.bbox || !h) return false;
3199
3215
  return b.bbox.y > h * 0.1 && b.bbox.y + b.bbox.height < h * 0.9;
3200
3216
  });
3201
3217
  joinLatinCellWraps(outBlocks);
3202
- if (_optionalChain([options, 'optionalAccess', _265 => _265.layoutTables]) !== "keep" && await isHancomPdf(doc)) {
3218
+ if (_optionalChain([options, 'optionalAccess', _266 => _266.layoutTables]) !== "keep") {
3219
+ const hancom = await isHancomPdf(doc);
3203
3220
  const shown = /* @__PURE__ */ new Map();
3204
3221
  const markContent = (bs) => {
3205
3222
  for (const b of _nullishCoalesce(bs, () => ( []))) if (b.table) for (const row of b.table.cells) for (const c of row) {
3206
- if (_chunkXEPKOC2Ocjs.IMAGE_CELLS.has(c)) _chunkAKB72TEHcjs.CONTENT_CELLS.add(c);
3223
+ if (_chunkWWMKIHF7cjs.IMAGE_CELLS.has(c)) _chunkYIANW5QXcjs.CONTENT_CELLS.add(c);
3207
3224
  markContent(c.blocks);
3208
3225
  }
3209
3226
  };
3210
3227
  const visual = (bs) => bs.flatMap((b) => {
3211
3228
  if (b.type !== "table") return [b];
3229
+ if (!hancom && b.table && _chunkWWMKIHF7cjs.CLIP_TABLES.has(b.table)) return [b];
3212
3230
  let v = shown.get(b);
3213
3231
  if (!v) {
3214
3232
  markContent([b]);
3215
- shown.set(b, v = _chunkAKB72TEHcjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _266 => _266.keepTrailingEmptyCols])));
3233
+ shown.set(b, v = _chunkYIANW5QXcjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _267 => _267.keepTrailingEmptyCols])));
3216
3234
  }
3217
3235
  return v;
3218
3236
  });
@@ -3221,11 +3239,11 @@ async function parsePdfDocument(buffer, options) {
3221
3239
  blocks.length = 0;
3222
3240
  for (const b of kept) blocks.push(b);
3223
3241
  }
3224
- const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunkR2BUANHQcjs.blocksToMarkdown.call(void 0, bs), { keepLoneNumbers: true }));
3242
+ const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunkGPC72VSFcjs.blocksToMarkdown.call(void 0, bs), { keepLoneNumbers: true }));
3225
3243
  let markdown = finishMarkdown(outBlocks);
3226
3244
  return {
3227
3245
  markdown,
3228
- pages: _chunkR2BUANHQcjs.blocksToPages.call(void 0, outBlocks, finishMarkdown),
3246
+ pages: _chunkGPC72VSFcjs.blocksToPages.call(void 0, outBlocks, finishMarkdown),
3229
3247
  blocks,
3230
3248
  metadata,
3231
3249
  outline: outline.length > 0 ? outline : void 0,
@@ -3243,7 +3261,7 @@ async function parsePdfDocument(buffer, options) {
3243
3261
  async function extractPdfMetadata(doc, metadata) {
3244
3262
  try {
3245
3263
  const result = await doc.getMetadata();
3246
- if (!_optionalChain([result, 'optionalAccess', _267 => _267.info])) return;
3264
+ if (!_optionalChain([result, 'optionalAccess', _268 => _268.info])) return;
3247
3265
  const info = result.info;
3248
3266
  if (typeof info.Title === "string" && info.Title.trim()) metadata.title = info.Title.trim();
3249
3267
  if (typeof info.Author === "string" && info.Author.trim()) metadata.author = info.Author.trim();
@@ -3259,8 +3277,8 @@ async function extractPdfMetadata(doc, metadata) {
3259
3277
  }
3260
3278
  async function isHancomPdf(doc) {
3261
3279
  try {
3262
- const info = await _asyncOptionalChain([(await doc.getMetadata()), 'optionalAccess', async _268 => _268.info]);
3263
- return [_optionalChain([info, 'optionalAccess', _269 => _269.Producer]), _optionalChain([info, 'optionalAccess', _270 => _270.Creator])].some((v) => typeof v === "string" && /^\s*(?:hancom\b|hwp\b)/i.test(v));
3280
+ const info = await _asyncOptionalChain([(await doc.getMetadata()), 'optionalAccess', async _269 => _269.info]);
3281
+ return [_optionalChain([info, 'optionalAccess', _270 => _270.Producer]), _optionalChain([info, 'optionalAccess', _271 => _271.Creator])].some((v) => typeof v === "string" && /^\s*(?:hancom\b|hwp\b)/i.test(v));
3264
3282
  } catch (e8) {
3265
3283
  return false;
3266
3284
  }
@@ -3303,5 +3321,5 @@ function marginStamp(items) {
3303
3321
 
3304
3322
 
3305
3323
 
3306
- exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkXEPKOC2Ocjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkXEPKOC2Ocjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkXEPKOC2Ocjs.removeHeaderFooterBlocks;
3307
- //# sourceMappingURL=parser-RQ4PJRTJ.cjs.map
3324
+ exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkWWMKIHF7cjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkWWMKIHF7cjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkWWMKIHF7cjs.removeHeaderFooterBlocks;
3325
+ //# sourceMappingURL=parser-QILYPWSI.cjs.map