kordoc 4.17.2 → 4.17.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/dist/{-2UA2JHVA.js → -SQRLFE4N.js} +11 -11
  2. package/dist/{chunk-4HRJISJF.js → chunk-4D52VUGA.js} +3 -3
  3. package/dist/{chunk-6OCKAXIS.js → chunk-6DXSRQ65.js} +2 -2
  4. package/dist/{chunk-XZA6X34R.js → chunk-7TE6TK52.js} +2 -2
  5. package/dist/{chunk-KQIYC2ZU.js → chunk-AAQR4RIX.js} +2 -2
  6. package/dist/{chunk-GPC72VSF.cjs → chunk-AFXX3YSP.cjs} +262 -171
  7. package/dist/chunk-AFXX3YSP.cjs.map +1 -0
  8. package/dist/{chunk-6DOCSYEM.cjs → chunk-AOONZC4S.cjs} +3 -3
  9. package/dist/chunk-AOONZC4S.cjs.map +1 -0
  10. package/dist/{chunk-A2W2JQ3S.js → chunk-DD6AY6EI.js} +2 -2
  11. package/dist/{chunk-KZVQK5NS.cjs → chunk-EXBZHI25.cjs} +2 -2
  12. package/dist/chunk-EXBZHI25.cjs.map +1 -0
  13. package/dist/{chunk-FGL4IGOT.js → chunk-FSCVZR4A.js} +4 -4
  14. package/dist/{chunk-HAW2VL62.cjs → chunk-GNORDND5.cjs} +12 -12
  15. package/dist/chunk-GNORDND5.cjs.map +1 -0
  16. package/dist/chunk-GS7T56RP.cjs.map +1 -1
  17. package/dist/{chunk-GYTL6WT3.js → chunk-HQ6TM2JE.js} +3 -3
  18. package/dist/{chunk-WJLICIYV.js → chunk-HY33WBAH.js} +24 -21
  19. package/dist/{chunk-WJLICIYV.js.map → chunk-HY33WBAH.js.map} +1 -1
  20. package/dist/{chunk-O4CB7D2Q.js → chunk-IERSVUW6.js} +2 -2
  21. package/dist/chunk-J55UQC5H.cjs.map +1 -1
  22. package/dist/chunk-KIYHQQVO.cjs +170 -0
  23. package/dist/chunk-KIYHQQVO.cjs.map +1 -0
  24. package/dist/{chunk-SDRKHEVT.js → chunk-NNNRN6BY.js} +255 -164
  25. package/dist/chunk-NNNRN6BY.js.map +1 -0
  26. package/dist/{chunk-MDCTITUG.js → chunk-O5T5OIJM.js} +2 -2
  27. package/dist/{chunk-WL3BWROT.js → chunk-ODVIUG6Q.js} +22 -12
  28. package/dist/chunk-ODVIUG6Q.js.map +1 -0
  29. package/dist/{chunk-C4MVZXB5.js → chunk-P2ZPPRM7.js} +2 -2
  30. package/dist/chunk-PNXJYEOR.js +170 -0
  31. package/dist/chunk-PNXJYEOR.js.map +1 -0
  32. package/dist/{chunk-YGKC6E6A.js → chunk-PTMYCK7R.js} +2 -2
  33. package/dist/{chunk-4TSYMJDL.js → chunk-PVJFCDND.js} +38 -13
  34. package/dist/chunk-PVJFCDND.js.map +1 -0
  35. package/dist/{chunk-ZDX5PIWR.js → chunk-RCS7WXOM.js} +2 -2
  36. package/dist/{chunk-VU26WGE5.js → chunk-SSY6FQLS.js} +200 -97
  37. package/dist/chunk-SSY6FQLS.js.map +1 -0
  38. package/dist/{chunk-JY2NBFIG.js → chunk-TMHMJUYU.js} +302 -75
  39. package/dist/chunk-TMHMJUYU.js.map +1 -0
  40. package/dist/{chunk-5JZEY5IL.js → chunk-VJP7O6BL.js} +2 -2
  41. package/dist/{chunk-2XHXABCX.js → chunk-W3OY3SLY.js} +3 -3
  42. package/dist/chunk-W3OY3SLY.js.map +1 -0
  43. package/dist/{chunk-WWMKIHF7.cjs → chunk-WNF3TSV3.cjs} +129 -104
  44. package/dist/chunk-WNF3TSV3.cjs.map +1 -0
  45. package/dist/{chunk-3N272C5L.js → chunk-YBIWPCUX.js} +39 -14
  46. package/dist/chunk-YBIWPCUX.js.map +1 -0
  47. package/dist/chunks-VNSLMJQD.js +10 -0
  48. package/dist/cli.js +26 -26
  49. package/dist/{formula-5RETDCIC.cjs → formula-U37MTMBD.cjs} +9 -9
  50. package/dist/formula-U37MTMBD.cjs.map +1 -0
  51. package/dist/{formula-MBLN2DG4.js → formula-U3MJXXIL.js} +4 -4
  52. package/dist/{formula-QZZDW5GW.js → formula-WZH5CMA3.js} +3 -3
  53. package/dist/{image-ocr-EREKAS47.js → image-ocr-HYWDBN72.js} +6 -6
  54. package/dist/{image-ocr-PSPVRLB5.cjs → image-ocr-OXU55EW3.cjs} +15 -15
  55. package/dist/image-ocr-OXU55EW3.cjs.map +1 -0
  56. package/dist/{image-ocr-CJSO3QSR.js → image-ocr-V6MICC6R.js} +9 -8
  57. package/dist/{image-ocr-CJSO3QSR.js.map → image-ocr-V6MICC6R.js.map} +1 -1
  58. package/dist/index.cjs +1194 -864
  59. package/dist/index.cjs.map +1 -1
  60. package/dist/index.js +531 -201
  61. package/dist/index.js.map +1 -1
  62. package/dist/mcp.js +22 -22
  63. package/dist/{model-bundle-MA4MMCRJ.js → model-bundle-AHBUQ6SD.js} +5 -5
  64. package/dist/{models-SEJ7LNSN.js → models-UF7B5LLG.js} +5 -5
  65. package/dist/page-range-QHHFTL7X.cjs.map +1 -1
  66. package/dist/{parser-M5WHRX25.js → parser-F6N6ID25.js} +22 -13
  67. package/dist/parser-F6N6ID25.js.map +1 -0
  68. package/dist/{parser-QILYPWSI.cjs → parser-IXRGUYZW.cjs} +207 -198
  69. package/dist/parser-IXRGUYZW.cjs.map +1 -0
  70. package/dist/{parser-VH3F4EQU.js → parser-T4FBG2FR.js} +23 -14
  71. package/dist/parser-T4FBG2FR.js.map +1 -0
  72. package/dist/pdf-ocr-2CITOAIG.cjs +16 -0
  73. package/dist/pdf-ocr-2CITOAIG.cjs.map +1 -0
  74. package/dist/pdf-ocr-RG2MFWBX.js +15 -0
  75. package/dist/pdf-ocr-U7Z4IUMA.js +19 -0
  76. package/dist/{profile-io-5YB627EO.js → profile-io-GM3NVLV3.js} +3 -3
  77. package/dist/{rasterize-V2XHHS2I.js → rasterize-4A3LJXTG.js} +3 -3
  78. package/dist/{redact-doc-5MK5L5IQ.js → redact-doc-SQ7C3LIG.js} +11 -11
  79. package/dist/{render-SYZMHYK6.js → render-6LTQZG4W.js} +7 -7
  80. package/dist/seal-ROSVLTRQ.js +10 -0
  81. package/dist/{setup-ZPLJENSK.js → setup-DGBJOROA.js} +3 -3
  82. package/dist/visual-6W34SFIW.js +20 -0
  83. package/dist/{watch-FNWHVKK3.js → watch-DJVJRSLE.js} +12 -12
  84. package/package.json +1 -1
  85. package/dist/chunk-2XHXABCX.js.map +0 -1
  86. package/dist/chunk-3N272C5L.js.map +0 -1
  87. package/dist/chunk-4TSYMJDL.js.map +0 -1
  88. package/dist/chunk-6DOCSYEM.cjs.map +0 -1
  89. package/dist/chunk-GPC72VSF.cjs.map +0 -1
  90. package/dist/chunk-HAW2VL62.cjs.map +0 -1
  91. package/dist/chunk-JY2NBFIG.js.map +0 -1
  92. package/dist/chunk-KZVQK5NS.cjs.map +0 -1
  93. package/dist/chunk-SDRKHEVT.js.map +0 -1
  94. package/dist/chunk-UX3HHAWH.js +0 -248
  95. package/dist/chunk-UX3HHAWH.js.map +0 -1
  96. package/dist/chunk-VU26WGE5.js.map +0 -1
  97. package/dist/chunk-WL3BWROT.js.map +0 -1
  98. package/dist/chunk-WWMKIHF7.cjs.map +0 -1
  99. package/dist/chunk-YIANW5QX.cjs +0 -248
  100. package/dist/chunk-YIANW5QX.cjs.map +0 -1
  101. package/dist/chunks-EBWJR55V.js +0 -10
  102. package/dist/formula-5RETDCIC.cjs.map +0 -1
  103. package/dist/image-ocr-PSPVRLB5.cjs.map +0 -1
  104. package/dist/parser-M5WHRX25.js.map +0 -1
  105. package/dist/parser-QILYPWSI.cjs.map +0 -1
  106. package/dist/parser-VH3F4EQU.js.map +0 -1
  107. package/dist/pdf-ocr-3SZUM3CN.cjs +0 -16
  108. package/dist/pdf-ocr-3SZUM3CN.cjs.map +0 -1
  109. package/dist/pdf-ocr-QB2TB5W5.js +0 -18
  110. package/dist/pdf-ocr-XC33L43D.js +0 -15
  111. package/dist/seal-IPKIQHYB.js +0 -10
  112. package/dist/visual-RTTGNOAE.js +0 -20
  113. /package/dist/{-2UA2JHVA.js.map → -SQRLFE4N.js.map} +0 -0
  114. /package/dist/{chunk-4HRJISJF.js.map → chunk-4D52VUGA.js.map} +0 -0
  115. /package/dist/{chunk-6OCKAXIS.js.map → chunk-6DXSRQ65.js.map} +0 -0
  116. /package/dist/{chunk-XZA6X34R.js.map → chunk-7TE6TK52.js.map} +0 -0
  117. /package/dist/{chunk-KQIYC2ZU.js.map → chunk-AAQR4RIX.js.map} +0 -0
  118. /package/dist/{chunk-A2W2JQ3S.js.map → chunk-DD6AY6EI.js.map} +0 -0
  119. /package/dist/{chunk-FGL4IGOT.js.map → chunk-FSCVZR4A.js.map} +0 -0
  120. /package/dist/{chunk-GYTL6WT3.js.map → chunk-HQ6TM2JE.js.map} +0 -0
  121. /package/dist/{chunk-O4CB7D2Q.js.map → chunk-IERSVUW6.js.map} +0 -0
  122. /package/dist/{chunk-MDCTITUG.js.map → chunk-O5T5OIJM.js.map} +0 -0
  123. /package/dist/{chunk-C4MVZXB5.js.map → chunk-P2ZPPRM7.js.map} +0 -0
  124. /package/dist/{chunk-YGKC6E6A.js.map → chunk-PTMYCK7R.js.map} +0 -0
  125. /package/dist/{chunk-ZDX5PIWR.js.map → chunk-RCS7WXOM.js.map} +0 -0
  126. /package/dist/{chunk-5JZEY5IL.js.map → chunk-VJP7O6BL.js.map} +0 -0
  127. /package/dist/{chunks-EBWJR55V.js.map → chunks-VNSLMJQD.js.map} +0 -0
  128. /package/dist/{formula-MBLN2DG4.js.map → formula-U3MJXXIL.js.map} +0 -0
  129. /package/dist/{formula-QZZDW5GW.js.map → formula-WZH5CMA3.js.map} +0 -0
  130. /package/dist/{image-ocr-EREKAS47.js.map → image-ocr-HYWDBN72.js.map} +0 -0
  131. /package/dist/{model-bundle-MA4MMCRJ.js.map → model-bundle-AHBUQ6SD.js.map} +0 -0
  132. /package/dist/{models-SEJ7LNSN.js.map → models-UF7B5LLG.js.map} +0 -0
  133. /package/dist/{pdf-ocr-QB2TB5W5.js.map → pdf-ocr-RG2MFWBX.js.map} +0 -0
  134. /package/dist/{pdf-ocr-XC33L43D.js.map → pdf-ocr-U7Z4IUMA.js.map} +0 -0
  135. /package/dist/{profile-io-5YB627EO.js.map → profile-io-GM3NVLV3.js.map} +0 -0
  136. /package/dist/{rasterize-V2XHHS2I.js.map → rasterize-4A3LJXTG.js.map} +0 -0
  137. /package/dist/{redact-doc-5MK5L5IQ.js.map → redact-doc-SQ7C3LIG.js.map} +0 -0
  138. /package/dist/{render-SYZMHYK6.js.map → render-6LTQZG4W.js.map} +0 -0
  139. /package/dist/{seal-IPKIQHYB.js.map → seal-ROSVLTRQ.js.map} +0 -0
  140. /package/dist/{setup-ZPLJENSK.js.map → setup-DGBJOROA.js.map} +0 -0
  141. /package/dist/{visual-RTTGNOAE.js.map → visual-6W34SFIW.js.map} +0 -0
  142. /package/dist/{watch-FNWHVKK3.js.map → watch-DJVJRSLE.js.map} +0 -0
@@ -1,14 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
2
2
 
3
3
 
4
+ var _chunkKIYHQQVOcjs = require('./chunk-KIYHQQVO.cjs');
4
5
 
5
6
 
6
7
 
7
- var _chunkGPC72VSFcjs = require('./chunk-GPC72VSF.cjs');
8
+ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
8
9
 
9
10
 
10
11
 
11
- var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
12
12
 
13
13
 
14
14
 
@@ -47,21 +47,21 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
47
47
 
48
48
 
49
49
 
50
+ var _chunkWNF3TSV3cjs = require('./chunk-WNF3TSV3.cjs');
50
51
 
51
52
 
52
53
 
53
- var _chunkWWMKIHF7cjs = require('./chunk-WWMKIHF7.cjs');
54
54
 
55
55
 
56
56
 
57
57
 
58
58
 
59
- var _chunkYIANW5QXcjs = require('./chunk-YIANW5QX.cjs');
60
- require('./chunk-6DOCSYEM.cjs');
59
+ var _chunkAFXX3YSPcjs = require('./chunk-AFXX3YSP.cjs');
60
+ require('./chunk-AOONZC4S.cjs');
61
61
 
62
62
 
63
63
 
64
- var _chunkKZVQK5NScjs = require('./chunk-KZVQK5NS.cjs');
64
+ var _chunkEXBZHI25cjs = require('./chunk-EXBZHI25.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 = _chunkGPC72VSFcjs.encodePng.call(void 0, w, h, rgba);
258
+ const png = _chunkKIYHQQVOcjs.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
  }
@@ -770,19 +770,19 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
770
770
  if (r + dr < rows) owner[r + dr][dc] = placed;
771
771
  }
772
772
  grid[r][c1] = { ...a.cell, colSpan: c2 - c1, rowSpan: a.rs };
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);
773
+ const lines = _chunkWNF3TSV3cjs.CELL_LINES.get(a.cell);
774
+ if (lines) _chunkWNF3TSV3cjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
775
+ if (_chunkWNF3TSV3cjs.IMAGE_CELLS.has(a.cell)) _chunkWNF3TSV3cjs.IMAGE_CELLS.add(grid[r][c1]);
776
+ const edges = _chunkAFXX3YSPcjs.CELL_EDGES.get(a.cell);
777
777
  if (edges) {
778
- _chunkYIANW5QXcjs.CELL_EDGES.set(grid[r][c1], edges);
778
+ _chunkAFXX3YSPcjs.CELL_EDGES.set(grid[r][c1], edges);
779
779
  edged = true;
780
780
  }
781
781
  return true;
782
782
  };
783
- for (const a of pa) if (!_chunkWWMKIHF7cjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
783
+ for (const a of pa) if (!_chunkWNF3TSV3cjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
784
784
  for (const a of ca) {
785
- if (a.r < skip || _chunkWWMKIHF7cjs.FILLER_CELLS.has(a.cell)) continue;
785
+ if (a.r < skip || _chunkWNF3TSV3cjs.FILLER_CELLS.has(a.cell)) continue;
786
786
  if (!place(a, cxU, prev.rows - skip, dx)) return null;
787
787
  }
788
788
  const first = prev.rows;
@@ -806,9 +806,9 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
806
806
  const grown = { ...above, rs: newRs };
807
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;
808
808
  }
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
+ for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkWNF3TSV3cjs.FILLER_CELLS.add(grid[r][c]);
810
810
  if (edged) {
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
+ for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkAFXX3YSPcjs.CELL_EDGES.set(grid[r][c], _chunkWNF3TSV3cjs.NO_EDGES);
812
812
  }
813
813
  for (let c = 0; c < cols && U[c + 1] <= pcx[0] + PART_COL_TOL; c++) {
814
814
  let r = prev.rows;
@@ -817,7 +817,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
817
817
  for (let rr = 0; rr < r; rr++) owner[rr][c] = through;
818
818
  }
819
819
  const table = { rows, cols, cells: grid, hasHeader: prev.hasHeader, ...prev.caption ? { caption: prev.caption } : {} };
820
- const pr = _chunkWWMKIHF7cjs.ROW_RULES.get(prev), cr = _chunkWWMKIHF7cjs.ROW_RULES.get(curr);
820
+ const pr = _chunkWNF3TSV3cjs.ROW_RULES.get(prev), cr = _chunkWNF3TSV3cjs.ROW_RULES.get(curr);
821
821
  const shifted = dx !== 0;
822
822
  const cut = {
823
823
  open: !!pr && !!cr && !pr.bottom && !cr.top && pr.innerOpen + cr.innerOpen === 0 && pr.innerRuled + cr.innerRuled > 0,
@@ -828,7 +828,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
828
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 });
829
829
  if (pr && cr) {
830
830
  const cutRuled = pr.bottom || cr.top;
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
+ _chunkWNF3TSV3cjs.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) });
832
832
  }
833
833
  return { table, colXs: U, split, header: ca.filter((a) => a.r < skip && a.cell.text.trim()).length >= 2 };
834
834
  }
@@ -882,7 +882,7 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs) {
882
882
  if (!crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
883
883
  if (!straddles && !midWord) continue;
884
884
  if (u.r >= last && d.rs < 2) continue;
885
- const U = _chunkWWMKIHF7cjs.CELL_LINES.get(a);
885
+ const U = _chunkWNF3TSV3cjs.CELL_LINES.get(a);
886
886
  if (!_optionalChain([U, 'optionalAccess', _33 => _33.length]) || !hasContent(b)) continue;
887
887
  if (!(straddles && filledToBottom(U, prevBottom) && clauseContinues(a, b))) {
888
888
  if (U.length > STRADDLE_MAX_LINES) continue;
@@ -918,7 +918,7 @@ var LABEL_ROOM = 1.5;
918
918
  var HANGING_MIN = 0.5;
919
919
  var HANGING_TOL = 1;
920
920
  function continuesAcross(u, d, x1, x2) {
921
- const U = _chunkWWMKIHF7cjs.CELL_LINES.get(u), D = _chunkWWMKIHF7cjs.CELL_LINES.get(d);
921
+ const U = _chunkWNF3TSV3cjs.CELL_LINES.get(u), D = _chunkWNF3TSV3cjs.CELL_LINES.get(d);
922
922
  if (!_optionalChain([U, 'optionalAccess', _34 => _34.length]) || !_optionalChain([D, 'optionalAccess', _35 => _35.length])) return false;
923
923
  const last = U[U.length - 1];
924
924
  const fs = last.h || 10;
@@ -936,7 +936,7 @@ function continuesAcross(u, d, x1, x2) {
936
936
  if (U.length === 1 && x2 - last.r > Math.max(FULL_LINE_EDGE_MIN, SINGLE_LINE_WORD_GAP * fs)) return false;
937
937
  const indented = last.l - minL >= HANGING_MIN * fs;
938
938
  if (last.r - last.l < FULL_LINE_MIN_FRAC * (indented ? x2 - last.l : x2 - x1)) return false;
939
- const newItem = _chunkWWMKIHF7cjs.startsNewItem.call(void 0, u.text, d.text);
939
+ const newItem = _chunkWNF3TSV3cjs.startsNewItem.call(void 0, u.text, d.text);
940
940
  const all = D.length ? U.concat(D) : U;
941
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));
942
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;
@@ -953,10 +953,10 @@ function outlineContinues(u, d) {
953
953
  return U.length >= 2 && D.length >= 1 && U.some((l) => OUTLINE_HEAD.test(l)) && OUTLINE_ITEM.test(D[0]);
954
954
  }
955
955
  function lineEnded(c, x1, x2, next) {
956
- const L = _chunkWWMKIHF7cjs.CELL_LINES.get(c);
956
+ const L = _chunkWNF3TSV3cjs.CELL_LINES.get(c);
957
957
  if (!L || L.length !== 1) return false;
958
958
  const l = L[0], h = l.h || 10;
959
- const d0 = next ? _optionalChain([_chunkWWMKIHF7cjs.CELL_LINES, 'access', _36 => _36.get, 'call', _37 => _37(next), 'optionalAccess', _38 => _38[0]]) : void 0;
959
+ const d0 = next ? _optionalChain([_chunkWNF3TSV3cjs.CELL_LINES, 'access', _36 => _36.get, 'call', _37 => _37(next), 'optionalAccess', _38 => _38[0]]) : void 0;
960
960
  if (d0 && d0.l - l.l >= HANGING_MIN * h) return false;
961
961
  return x2 - l.r - (l.l - x1) >= Math.max(LABEL_ROOM, firstWordUnits(_nullishCoalesce(_optionalChain([next, 'optionalAccess', _39 => _39.text]), () => ( "")))) * h;
962
962
  }
@@ -972,9 +972,9 @@ function appendCell(a, b) {
972
972
  a.blocks = [...asBlocks(a), ...asBlocks(b)];
973
973
  }
974
974
  if (b.text.trim()) a.text = a.text.trim() ? a.text + "\n" + b.text : b.text;
975
- _chunkWWMKIHF7cjs.joinCellEdges.call(void 0, a, b);
975
+ _chunkWNF3TSV3cjs.joinCellEdges.call(void 0, a, b);
976
976
  }
977
- var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _46 => _46.blocks, 'optionalAccess', _47 => _47.length]) || _chunkWWMKIHF7cjs.IMAGE_CELLS.has(cell);
977
+ var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _46 => _46.blocks, 'optionalAccess', _47 => _47.length]) || _chunkWNF3TSV3cjs.IMAGE_CELLS.has(cell);
978
978
  var CLAUSE_OPEN_ENDING = /(?:하는|되는|하고|하며|하여|되어|되고|되며|이며|으며|어야|아야|여야)$/;
979
979
  var batchim = (ch) => {
980
980
  const k = ch.charCodeAt(0) - 44032;
@@ -982,13 +982,13 @@ var batchim = (ch) => {
982
982
  };
983
983
  function clauseContinues(u, d) {
984
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
+ if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunkWNF3TSV3cjs.startsNewItem.call(void 0, u.text, head)) return false;
986
986
  const last = tail[tail.length - 1], before = tail[tail.length - 2];
987
987
  return last === "\uC744" && batchim(before) || last === "\uB97C" && !batchim(before) || CLAUSE_OPEN_ENDING.test(tail);
988
988
  }
989
989
  function wordOverflows(u, d, x1, x2) {
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;
990
+ const U = _chunkWNF3TSV3cjs.CELL_LINES.get(u);
991
+ if (!_optionalChain([U, 'optionalAccess', _48 => _48.length]) || _chunkWNF3TSV3cjs.startsNewItem.call(void 0, u.text, d.text)) return false;
992
992
  const last = U[U.length - 1], units = firstWordUnits(d.text);
993
993
  return units > 0 && last.r - last.l + units * (last.h || 10) > x2 - x1;
994
994
  }
@@ -1075,6 +1075,15 @@ function besideOwn(b, p, c) {
1075
1075
  const bx1 = b.bbox.x, bx2 = b.bbox.x + b.bbox.width;
1076
1076
  return bx2 <= t.x + 1 || bx1 >= t.x + t.width - 1;
1077
1077
  }
1078
+ var PAGE_NUMBER_TEXT = /^[-–—]?\s*\d{1,4}\s*[-–—]?$/;
1079
+ function pageNumberBetween(b, p, c, pageHeights) {
1080
+ if (b.type !== "paragraph" || !b.bbox || !PAGE_NUMBER_TEXT.test(_nullishCoalesce(_optionalChain([b, 'access', _50 => _50.text, 'optionalAccess', _51 => _51.trim, 'call', _52 => _52()]), () => ( "")))) return false;
1081
+ const h = b.pageNumber ? _optionalChain([pageHeights, 'optionalAccess', _53 => _53.get, 'call', _54 => _54(b.pageNumber)]) : void 0;
1082
+ if (!h) return false;
1083
+ if (b.pageNumber === p.pageNumber) return b.bbox.y + b.bbox.height <= Math.min(p.bbox.y, h * PAGE_EDGE_BAND) + 1;
1084
+ if (b.pageNumber === c.pageNumber) return b.bbox.y >= Math.max(c.bbox.y + c.bbox.height, h * (1 - PAGE_EDGE_BAND)) - 1;
1085
+ return false;
1086
+ }
1078
1087
  function leftColumnOf(b, t) {
1079
1088
  return !!b.bbox && b.pageNumber === t.pageNumber && b.bbox.x + b.bbox.width <= t.bbox.x + 1;
1080
1089
  }
@@ -1092,7 +1101,7 @@ function insideTable(b, t) {
1092
1101
  return b.bbox.x >= o.x - 1 && b.bbox.x + b.bbox.width <= o.x + o.width + 1 && b.bbox.y >= o.y - 1 && b.bbox.y + b.bbox.height <= o.y + o.height + 1;
1093
1102
  }
1094
1103
  function startsWithUnitRow(table) {
1095
- return /^\s*\(\s*단위\s*[::]/.test(_nullishCoalesce(_optionalChain([table, 'access', _50 => _50.cells, 'access', _51 => _51[0], 'optionalAccess', _52 => _52[0], 'optionalAccess', _53 => _53.text]), () => ( ""))) && _optionalChain([table, 'access', _54 => _54.cells, 'access', _55 => _55[0], 'optionalAccess', _56 => _56.slice, 'call', _57 => _57(1), 'access', _58 => _58.every, 'call', _59 => _59((c) => !c.text.trim())]);
1104
+ return /^\s*\(\s*단위\s*[::]/.test(_nullishCoalesce(_optionalChain([table, 'access', _55 => _55.cells, 'access', _56 => _56[0], 'optionalAccess', _57 => _57[0], 'optionalAccess', _58 => _58.text]), () => ( ""))) && _optionalChain([table, 'access', _59 => _59.cells, 'access', _60 => _60[0], 'optionalAccess', _61 => _61.slice, 'call', _62 => _62(1), 'access', _63 => _63.every, 'call', _64 => _64((c) => !c.text.trim())]);
1096
1105
  }
1097
1106
  function sameHeadShape(a, b) {
1098
1107
  if (!a || !b || a.length !== b.length) return false;
@@ -1112,28 +1121,28 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1112
1121
  const skip = (b) => b.type !== "table" || [blocks[i], tail].some((t) => insideTable(b, t) || leftColumnOf(b, t));
1113
1122
  while (j < blocks.length && skip(blocks[j]) && (_nullishCoalesce(blocks[j].pageNumber, () => ( 0))) <= tail.pageNumber + 1) j++;
1114
1123
  const curr = blocks[j];
1115
- const prev = tail !== blocks[i] && _optionalChain([curr, 'optionalAccess', _60 => _60.pageNumber]) === tail.pageNumber ? blocks[i] : tail;
1124
+ const prev = tail !== blocks[i] && _optionalChain([curr, 'optionalAccess', _65 => _65.pageNumber]) === tail.pageNumber ? blocks[i] : tail;
1116
1125
  if (!prev.table || !prev.bbox || !prev.pageNumber) continue;
1117
1126
  if (!curr || curr.type !== "table" || !curr.table || !curr.bbox || curr.pageNumber !== prev.pageNumber + 1) continue;
1118
1127
  if (startsWithUnitRow(prev.table) && startsWithUnitRow(curr.table)) continue;
1119
- const joined = j === i + 1 || blocks.slice(i + 1, j).every((b) => besideOwn(b, prev, curr) || insideTable(b, prev)) ? looksContinued(prev, curr, pageHeights) && !restartsTable(blocks, i, curr.table, pageHeights) ? _nullishCoalesce(joinClipParts(prev, curr, pageHeights, lex), () => ( false)) : null : null;
1128
+ const joined = j === i + 1 || blocks.slice(i + 1, j).every((b) => besideOwn(b, prev, curr) || insideTable(b, prev) || pageNumberBetween(b, prev, curr, pageHeights)) ? looksContinued(prev, curr, pageHeights) && !restartsTable(blocks, i, curr.table, pageHeights) ? _nullishCoalesce(joinClipParts(prev, curr, pageHeights, lex), () => ( false)) : null : null;
1120
1129
  if (joined) {
1121
1130
  placeJoined(blocks, i, j, joined);
1122
1131
  continue;
1123
1132
  }
1124
- if (_chunkWWMKIHF7cjs.EMPTY_PARTS.has(curr.table)) {
1133
+ if (_chunkWNF3TSV3cjs.EMPTY_PARTS.has(curr.table)) {
1125
1134
  blocks.splice(j, 1);
1126
1135
  i++;
1127
1136
  continue;
1128
1137
  }
1129
1138
  if (joined === null) continue;
1130
- if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunkWWMKIHF7cjs.EMPTY_PARTS.has(prev.table)) continue;
1139
+ if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunkWNF3TSV3cjs.EMPTY_PARTS.has(prev.table)) continue;
1131
1140
  const width = Math.max(prev.bbox.width, curr.bbox.width, 1);
1132
1141
  const leftDiff = Math.abs(prev.bbox.x - curr.bbox.x);
1133
1142
  const rightDiff = Math.abs(prev.bbox.x + prev.bbox.width - (curr.bbox.x + curr.bbox.width));
1134
1143
  if (leftDiff > width * NEIGHBOR_TABLE_EPSILON || rightDiff > width * NEIGHBOR_TABLE_EPSILON) 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;
1144
+ const px = _chunkWNF3TSV3cjs.TABLE_COLXS.get(prev.table), cx = _chunkWNF3TSV3cjs.TABLE_COLXS.get(curr.table);
1145
+ if (px && cx && !shiftedSame(px, cx, !_chunkWNF3TSV3cjs.CLIP_TABLES.has(prev.table) && !_chunkWNF3TSV3cjs.CLIP_TABLES.has(curr.table))) continue;
1137
1146
  if (!rowTextsEqual(prev.table.cells[0], curr.table.cells[0]) && sameHeadShape(prev.table.cells[0], curr.table.cells[0])) continue;
1138
1147
  let currCells = curr.table.cells;
1139
1148
  if (currCells.length > 1 && prev.table.cells.length > 0 && rowTextsEqual(prev.table.cells[0], currCells[0])) {
@@ -1143,16 +1152,16 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1143
1152
  blocks.splice(j, 1);
1144
1153
  continue;
1145
1154
  }
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))) {
1155
+ if (px && cx && !_chunkWNF3TSV3cjs.CLIP_TABLES.has(prev.table) && !_chunkWNF3TSV3cjs.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 && _chunkWNF3TSV3cjs.CELL_LINES.has(c))) {
1147
1156
  const dx = px[0] - cx[0];
1148
1157
  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) {
1158
+ if (_optionalChain([part, 'optionalAccess', _66 => _66.split]) && part.table.rows === prev.table.rows + currCells.length - 1) {
1150
1159
  const last = prev.table.rows - 1;
1151
1160
  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 }))));
1161
+ const U = _chunkWNF3TSV3cjs.CELL_LINES.get(prev.table.cells[last][c]), D = _chunkWNF3TSV3cjs.CELL_LINES.get(currCells[0][c]);
1162
+ _chunkWNF3TSV3cjs.CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
1154
1163
  }
1155
- _chunkWWMKIHF7cjs.TABLE_COLXS.set(part.table, part.colXs);
1164
+ _chunkWNF3TSV3cjs.TABLE_COLXS.set(part.table, part.colXs);
1156
1165
  placeJoined(blocks, i, j, part.table);
1157
1166
  continue;
1158
1167
  }
@@ -1165,20 +1174,20 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1165
1174
  caption: prev.table.caption,
1166
1175
  ...prev.table.renderAsTable ? { renderAsTable: true } : {}
1167
1176
  };
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);
1177
+ if (_nullishCoalesce(px, () => ( cx))) _chunkWNF3TSV3cjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
1178
+ if (_chunkWNF3TSV3cjs.CLIP_TABLES.has(prev.table) || _chunkWNF3TSV3cjs.CLIP_TABLES.has(curr.table)) _chunkWNF3TSV3cjs.CLIP_TABLES.add(merged);
1170
1179
  placeJoined(blocks, i, j, merged);
1171
1180
  }
1172
1181
  for (let i = blocks.length - 1; i >= 0; i--) {
1173
1182
  const t = blocks[i].table;
1174
- if (blocks[i].type === "table" && t && _chunkWWMKIHF7cjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
1183
+ if (blocks[i].type === "table" && t && _chunkWNF3TSV3cjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
1175
1184
  }
1176
1185
  }
1177
1186
  function mergeColumnFlow(blocks, pageHeights, lex) {
1178
1187
  if (!pageHeights) return;
1179
1188
  for (let i = 0; i < blocks.length; i++) {
1180
1189
  const L = blocks[i];
1181
- if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkWWMKIHF7cjs.CLIP_TABLES.has(L.table) || _chunkWWMKIHF7cjs.EMPTY_PARTS.has(L.table)) continue;
1190
+ if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkWNF3TSV3cjs.CLIP_TABLES.has(L.table) || _chunkWNF3TSV3cjs.EMPTY_PARTS.has(L.table)) continue;
1182
1191
  const ph = pageHeights.get(L.pageNumber);
1183
1192
  if (!ph || L.bbox.y > ph * PAGE_EDGE_BAND) continue;
1184
1193
  let s0 = i, s1 = i;
@@ -1207,12 +1216,12 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
1207
1216
  }
1208
1217
  function joinClipParts(prev, curr, pageHeights, lex) {
1209
1218
  const pt = prev.table, ct = curr.table;
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);
1219
+ if (!_chunkWNF3TSV3cjs.CLIP_TABLES.has(pt) || !_chunkWNF3TSV3cjs.CLIP_TABLES.has(ct)) return null;
1220
+ const px = _chunkWNF3TSV3cjs.TABLE_COLXS.get(pt), cx = _chunkWNF3TSV3cjs.TABLE_COLXS.get(ct);
1212
1221
  if (!px || !cx) return null;
1213
1222
  let xs = cx, shifted = false, dx = 0, foreign = false, within = false;
1214
1223
  if (!shiftedSame(px, cx, false)) {
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;
1224
+ if (!_optionalChain([pageHeights, 'optionalAccess', _67 => _67.get, 'call', _68 => _68(prev.pageNumber)]) || !_optionalChain([pageHeights, 'optionalAccess', _69 => _69.get, 'call', _70 => _70(curr.pageNumber)])) return null;
1216
1225
  dx = px[px.length - 1] - cx[cx.length - 1];
1217
1226
  within = Math.abs(dx) > CONTINUATION_COL_TOL && cx.length >= 3 && cx.every((x) => px.some((p) => Math.abs(p - x) <= CONTINUATION_COL_TOL));
1218
1227
  if (Math.abs(dx) > CONTINUATION_COL_TOL && !within) {
@@ -1224,19 +1233,19 @@ function joinClipParts(prev, curr, pageHeights, lex) {
1224
1233
  const inner = b.slice(1, -1).map((x) => x + dx);
1225
1234
  return inner.length > 0 && !inner.some((x) => px.some((p) => Math.abs(p - x) <= CONTINUATION_COL_TOL));
1226
1235
  };
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);
1236
+ foreign = unrelated(cx) && unrelated(_nullishCoalesce(_chunkWNF3TSV3cjs.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);
1228
1237
  }
1229
- const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _66 => _66.bbox, 'optionalAccess', _67 => _67.y]), lex);
1238
+ const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _71 => _71.bbox, 'optionalAccess', _72 => _72.y]), lex);
1230
1239
  if (!res || (shifted || foreign || within) && !res.split && !res.header) return null;
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);
1240
+ _chunkWNF3TSV3cjs.TABLE_COLXS.set(res.table, res.colXs);
1241
+ const ys = _chunkWNF3TSV3cjs.TABLE_ROWYS.get(pt);
1242
+ if (ys) _chunkWNF3TSV3cjs.TABLE_ROWYS.set(res.table, ys);
1243
+ _chunkWNF3TSV3cjs.PART_COLXS.set(res.table, _nullishCoalesce(_chunkWNF3TSV3cjs.PART_COLXS.get(pt), () => ( px)));
1244
+ _chunkWNF3TSV3cjs.CLIP_TABLES.add(res.table);
1236
1245
  return res.table;
1237
1246
  }
1238
1247
  function prevLacksLeftCols(prev, px, xs, pageHeights) {
1239
- const ph = _optionalChain([pageHeights, 'optionalAccess', _68 => _68.get, 'call', _69 => _69(prev.pageNumber)]);
1248
+ const ph = _optionalChain([pageHeights, 'optionalAccess', _73 => _73.get, 'call', _74 => _74(prev.pageNumber)]);
1240
1249
  if (!ph || prev.bbox.y + prev.bbox.height < ph * (1 - PAGE_EDGE_BAND)) return false;
1241
1250
  return xs[0] < px[0] && xs.slice(1, -1).some((x) => Math.abs(x - px[0]) <= CONTINUATION_COL_TOL);
1242
1251
  }
@@ -1247,21 +1256,21 @@ function headingRow(row) {
1247
1256
  }
1248
1257
  var ANNEX_HEAD_RE = /^\s*[<\[(【]?\s*(?:붙\s*임|참\s*고|별\s*첨|별\s*지|별\s*표|첨\s*부|부\s*록)(?:\s*\d|\s*$|\s*[>\])】])|^\s*■/;
1249
1258
  function looksContinued(prev, curr, pageHeights) {
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)]);
1259
+ const ph = _optionalChain([pageHeights, 'optionalAccess', _75 => _75.get, 'call', _76 => _76(prev.pageNumber)]), ch = _optionalChain([pageHeights, 'optionalAccess', _77 => _77.get, 'call', _78 => _78(curr.pageNumber)]);
1251
1260
  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;
1252
1261
  const firstRow = _nullishCoalesce(curr.table.cells[0], () => ( []));
1253
- const firstText = _nullishCoalesce(_optionalChain([firstRow, 'access', _74 => _74.find, 'call', _75 => _75((c) => c.text.trim()), 'optionalAccess', _76 => _76.text]), () => ( ""));
1262
+ const firstText = _nullishCoalesce(_optionalChain([firstRow, 'access', _79 => _79.find, 'call', _80 => _80((c) => c.text.trim()), 'optionalAccess', _81 => _81.text]), () => ( ""));
1254
1263
  if (!ANNEX_HEAD_RE.test(firstText)) return true;
1255
1264
  const filled = firstRow.map((c) => flowText(c.text).replace(/\s+/g, "")).filter(Boolean);
1256
1265
  return filled.length >= 2 && filled.every((t) => t === filled[0]);
1257
1266
  }
1258
1267
  function pushedLead(prev, curr) {
1259
- if (!_chunkWWMKIHF7cjs.CLIP_TABLES.has(prev.table) || !_chunkWWMKIHF7cjs.CLIP_TABLES.has(curr.table)) return false;
1268
+ if (!_chunkWNF3TSV3cjs.CLIP_TABLES.has(prev.table) || !_chunkWNF3TSV3cjs.CLIP_TABLES.has(curr.table)) return false;
1260
1269
  const lead = leadRows(curr.table);
1261
1270
  return lead.image && lead.height > prev.bbox.y;
1262
1271
  }
1263
1272
  function leadRows(t) {
1264
- const ys = _chunkWWMKIHF7cjs.TABLE_ROWYS.get(t);
1273
+ const ys = _chunkWNF3TSV3cjs.TABLE_ROWYS.get(t);
1265
1274
  if (!ys || ys.length < 2) return { height: 0, image: false };
1266
1275
  const anchors = anchorsOf(t);
1267
1276
  let end = 1, image = false;
@@ -1269,17 +1278,17 @@ function leadRows(t) {
1269
1278
  for (const a of anchors) {
1270
1279
  if (a.r !== r) continue;
1271
1280
  end = Math.max(end, r + a.rs);
1272
- if (_chunkWWMKIHF7cjs.IMAGE_CELLS.has(a.cell)) image = true;
1281
+ if (_chunkWNF3TSV3cjs.IMAGE_CELLS.has(a.cell)) image = true;
1273
1282
  }
1274
1283
  }
1275
1284
  return { height: ys[0] - ys[Math.min(end, ys.length - 1)], image };
1276
1285
  }
1277
1286
  function tailOf(b) {
1278
- const t = b.table && _chunkWWMKIHF7cjs.TABLE_TAIL.get(b.table);
1287
+ const t = b.table && _chunkWNF3TSV3cjs.TABLE_TAIL.get(b.table);
1279
1288
  return t && b.bbox ? { ...b, pageNumber: t.page, bbox: { ...b.bbox, page: t.page, y: t.y, height: t.height } } : b;
1280
1289
  }
1281
1290
  function firstRowSig(t) {
1282
- const x = _chunkWWMKIHF7cjs.TABLE_COLXS.get(t);
1291
+ const x = _chunkWNF3TSV3cjs.TABLE_COLXS.get(t);
1283
1292
  if (!x || x.length !== t.cols + 1) return null;
1284
1293
  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, "") }));
1285
1294
  }
@@ -1304,9 +1313,9 @@ function restartsTable(blocks, i, curr, pageHeights) {
1304
1313
  }
1305
1314
  function restartsTitledForm(head, curr) {
1306
1315
  if (head.rows < 2 || curr.rows < 2 || head.cols !== curr.cols) return false;
1307
- const full = (t) => _optionalChain([t, 'access', _77 => _77.cells, 'access', _78 => _78[0], 'access', _79 => _79[0], 'optionalAccess', _80 => _80.colSpan]) === t.cols;
1316
+ const full = (t) => _optionalChain([t, 'access', _82 => _82.cells, 'access', _83 => _83[0], 'access', _84 => _84[0], 'optionalAccess', _85 => _85.colSpan]) === t.cols;
1308
1317
  if (!full(head) || !full(curr)) return false;
1309
- const norm = (c) => flowText(_nullishCoalesce(_optionalChain([c, 'optionalAccess', _81 => _81.text]), () => ( ""))).replace(/\s+/g, "");
1318
+ const norm = (c) => flowText(_nullishCoalesce(_optionalChain([c, 'optionalAccess', _86 => _86.text]), () => ( ""))).replace(/\s+/g, "");
1310
1319
  const ht = norm(head.cells[0][0]), ct = norm(curr.cells[0][0]);
1311
1320
  if (!ht || !ct || ht === ct) return false;
1312
1321
  const titleLike = (t) => t.length <= TITLE_ROW_MAX_CHARS && !/^[ㅇ○◦•·\-–※*□■▪☞]/.test(t);
@@ -1330,9 +1339,9 @@ function chainHead(blocks, i, pageHeights) {
1330
1339
  }
1331
1340
  const pb = tailOf(blocks[p]);
1332
1341
  if (pb.pageNumber !== (_nullishCoalesce(cur.pageNumber, () => ( 0))) - 1) break;
1333
- if (!blocks.slice(p + 1, k).every((b) => besideOwn(b, pb, cur) || insideTable(b, pb))) break;
1342
+ if (!blocks.slice(p + 1, k).every((b) => besideOwn(b, pb, cur) || insideTable(b, pb) || pageNumberBetween(b, pb, cur, pageHeights))) break;
1334
1343
  if (!looksContinued(pb, cur, pageHeights)) break;
1335
- const px = _chunkWWMKIHF7cjs.TABLE_COLXS.get(pb.table), cx = _chunkWWMKIHF7cjs.TABLE_COLXS.get(cur.table);
1344
+ const px = _chunkWNF3TSV3cjs.TABLE_COLXS.get(pb.table), cx = _chunkWNF3TSV3cjs.TABLE_COLXS.get(cur.table);
1336
1345
  if (!px || !cx) break;
1337
1346
  const dx = px[px.length - 1] - cx[cx.length - 1];
1338
1347
  if (!shiftedSame(px, cx) && !px.some((x) => Math.abs(x - (cx[0] + dx)) <= CONTINUATION_COL_TOL) && !prevLacksLeftCols(pb, px, cx, pageHeights)) break;
@@ -1364,12 +1373,12 @@ var RESTART_LOOKBACK_PAGES = 5;
1364
1373
  var COL_MATCH_TOL = 0.5;
1365
1374
  var CONTINUED_TABLE_PAGE_BAND = 0.16;
1366
1375
  function lastRowCell(t, x1, x2) {
1367
- const xs = _chunkWWMKIHF7cjs.TABLE_COLXS.get(t);
1376
+ const xs = _chunkWNF3TSV3cjs.TABLE_COLXS.get(t);
1368
1377
  const covered = /* @__PURE__ */ new Set();
1369
1378
  for (let r = 0; r < t.rows; r++) {
1370
1379
  for (let c = 0; c < t.cols; c++) {
1371
1380
  if (covered.has(r * 1e5 + c)) continue;
1372
- const cell = _optionalChain([t, 'access', _82 => _82.cells, 'access', _83 => _83[r], 'optionalAccess', _84 => _84[c]]);
1381
+ const cell = _optionalChain([t, 'access', _87 => _87.cells, 'access', _88 => _88[r], 'optionalAccess', _89 => _89[c]]);
1373
1382
  if (!cell) continue;
1374
1383
  for (let dr = 0; dr < cell.rowSpan; dr++) for (let dc = 0; dc < cell.colSpan; dc++) covered.add((r + dr) * 1e5 + c + dc);
1375
1384
  if (r + cell.rowSpan !== t.rows) continue;
@@ -1382,23 +1391,23 @@ var cellBlocks = (cell, pageNumber) => _nullishCoalesce(cell.blocks, () => ( cel
1382
1391
  function mergeContinuedCells(blocks, pageHeights) {
1383
1392
  for (let j = blocks.length - 1; j > 0; j--) {
1384
1393
  const part = blocks[j];
1385
- const from = part.table ? _chunkWWMKIHF7cjs.CONT_PARTS.get(part.table) : void 0;
1394
+ const from = part.table ? _chunkWNF3TSV3cjs.CONT_PARTS.get(part.table) : void 0;
1386
1395
  if (!from || !part.table) continue;
1387
1396
  let i = j - 1;
1388
1397
  while (i >= 0 && blocks[i].type !== "table") i--;
1389
1398
  const prev = blocks[i];
1390
1399
  if (i < 0 || !prev.table || prev.pageNumber !== (_nullishCoalesce(part.pageNumber, () => ( 0))) - 1) continue;
1391
1400
  const cell = lastRowCell(prev.table, from.x1, from.x2);
1392
- const add = _optionalChain([part, 'access', _85 => _85.table, 'access', _86 => _86.cells, 'access', _87 => _87[0], 'optionalAccess', _88 => _88[0]]);
1401
+ const add = _optionalChain([part, 'access', _90 => _90.table, 'access', _91 => _91.cells, 'access', _92 => _92[0], 'optionalAccess', _93 => _93[0]]);
1393
1402
  if (!cell || !add) continue;
1394
1403
  const at = cell.blocks || add.blocks ? cellBlocks(cell, prev.pageNumber).length : -1;
1395
1404
  if (cell.blocks || add.blocks) cell.blocks = [...cellBlocks(cell, prev.pageNumber), ...cellBlocks(add, part.pageNumber)];
1396
1405
  cell.text = [cell.text, add.text].filter((s) => s.trim()).join("\n");
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);
1406
+ _chunkWNF3TSV3cjs.joinCellEdges.call(void 0, cell, add);
1407
+ const lines = _chunkWNF3TSV3cjs.CELL_LINES.get(add);
1408
+ if (_optionalChain([lines, 'optionalAccess', _94 => _94.length])) _chunkWNF3TSV3cjs.CELL_LINES.set(cell, [..._nullishCoalesce(_chunkWNF3TSV3cjs.CELL_LINES.get(cell), () => ( [])), ...lines]);
1409
+ if (part.pageNumber && part.bbox) _chunkWNF3TSV3cjs.TABLE_TAIL.set(prev.table, _nullishCoalesce(_chunkWNF3TSV3cjs.TABLE_TAIL.get(part.table), () => ( { page: part.pageNumber, y: part.bbox.y, height: part.bbox.height })));
1410
+ if (cell.text.trim() || _optionalChain([cell, 'access', _95 => _95.blocks, 'optionalAccess', _96 => _96.length])) _chunkWNF3TSV3cjs.EMPTY_PARTS.delete(prev.table);
1402
1411
  blocks.splice(j, 1);
1403
1412
  if (cell.blocks && at > 0) {
1404
1413
  const nextAt = cell.blocks[at];
@@ -1410,27 +1419,27 @@ function mergeContinuedCells(blocks, pageHeights) {
1410
1419
  }
1411
1420
  function unwrapContinuedTable(blocks, at, pageHeights) {
1412
1421
  const prev = blocks[at - 1], frame = blocks[at];
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);
1422
+ if (!_optionalChain([prev, 'optionalAccess', _97 => _97.table]) || !_optionalChain([frame, 'optionalAccess', _98 => _98.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunkWNF3TSV3cjs.CLIP_TABLES.has(frame.table)) return;
1423
+ const inner = _optionalChain([frame, 'access', _99 => _99.table, 'access', _100 => _100.cells, 'access', _101 => _101[0], 'optionalAccess', _102 => _102[0], 'optionalAccess', _103 => _103.blocks]);
1424
+ const next = _optionalChain([inner, 'optionalAccess', _104 => _104[0]]);
1425
+ if (!inner || !_optionalChain([next, 'optionalAccess', _105 => _105.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunkWNF3TSV3cjs.CLIP_TABLES.has(prev.table) || !_chunkWNF3TSV3cjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
1426
+ const px = _chunkWNF3TSV3cjs.TABLE_COLXS.get(prev.table), nx = _chunkWNF3TSV3cjs.TABLE_COLXS.get(next.table);
1418
1427
  if (!px || !nx || px.length !== nx.length || px.some((x, i) => Math.abs(x - nx[i]) > COL_MATCH_TOL)) return;
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)]);
1428
+ const ph = _optionalChain([pageHeights, 'optionalAccess', _106 => _106.get, 'call', _107 => _107(prev.pageNumber)]), nh = _optionalChain([pageHeights, 'optionalAccess', _108 => _108.get, 'call', _109 => _109(next.pageNumber)]);
1420
1429
  if (!ph || !nh || prev.bbox.y > ph * CONTINUED_TABLE_PAGE_BAND || next.bbox.y + next.bbox.height < nh * (1 - CONTINUED_TABLE_PAGE_BAND)) return;
1421
1430
  blocks.splice(at, 1, ...inner);
1422
1431
  }
1423
1432
  function fillNestedContinuation(blocks, at) {
1424
1433
  const prev = blocks[at - 1], next = blocks[at];
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);
1434
+ const t = _optionalChain([prev, 'optionalAccess', _110 => _110.table]), u = _optionalChain([next, 'optionalAccess', _111 => _111.table]);
1435
+ if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunkWNF3TSV3cjs.CLIP_TABLES.has(t) || !_chunkWNF3TSV3cjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
1436
+ const xs = _chunkWNF3TSV3cjs.TABLE_COLXS.get(u);
1428
1437
  const cell = xs ? lastRowCell(t, xs[0], xs[xs.length - 1]) : void 0;
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;
1438
+ const add = _optionalChain([u, 'access', _112 => _112.cells, 'access', _113 => _113[0], 'optionalAccess', _114 => _114[0]]);
1439
+ if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _115 => _115.blocks, 'optionalAccess', _116 => _116.length])) return;
1431
1440
  cell.text = add.text;
1432
1441
  if (add.blocks) cell.blocks = add.blocks;
1433
- _chunkWWMKIHF7cjs.joinCellEdges.call(void 0, cell, add);
1442
+ _chunkWNF3TSV3cjs.joinCellEdges.call(void 0, cell, add);
1434
1443
  blocks.splice(at, 1);
1435
1444
  }
1436
1445
 
@@ -1466,7 +1475,7 @@ var WINANSI_REVERSE = {
1466
1475
  };
1467
1476
  function symbolFontTable(fontName) {
1468
1477
  if (!fontName) return void 0;
1469
- if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunkGPC72VSFcjs.WINGDINGS;
1478
+ if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunkAFXX3YSPcjs.WINGDINGS;
1470
1479
  return void 0;
1471
1480
  }
1472
1481
  function remapSymbolText(text, table) {
@@ -1594,7 +1603,7 @@ function layout(toks) {
1594
1603
  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);
1595
1604
  if (!bar) continue;
1596
1605
  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);
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 };
1606
+ const tok = { text: `\\sqrt{${linear(inner)}}`, x: rt.x, w: bar.x + bar.w - rt.x, y: _nullishCoalesce(_optionalChain([inner, 'access', _117 => _117[0], 'optionalAccess', _118 => _118.y]), () => ( rt.y)), size: Math.max(rt.size, ...inner.map((t) => t.size)), bar: false };
1598
1607
  rest = [...rest.filter((t) => t !== rt && t !== bar && !inner.includes(t)), tok];
1599
1608
  }
1600
1609
  const bars = rest.filter((t) => t.bar).sort((a, b) => a.w - b.w);
@@ -1696,7 +1705,7 @@ function wrapEquationRuns(items, faceName) {
1696
1705
  for (const i of mains) ys.set(i.y, (_nullishCoalesce(ys.get(i.y), () => ( 0))) + 1);
1697
1706
  const top = [...ys].sort((p, q) => q[1] - p[1]);
1698
1707
  const bar = cur.find(isBarItem);
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));
1708
+ const lineY = bar && top.length > 1 && top[0][1] === top[1][1] ? Math.round(bar.y + size * 0.3) : _nullishCoalesce(_optionalChain([top, 'access', _119 => _119[0], 'optionalAccess', _120 => _120[0]]), () => ( cur[0].y));
1700
1709
  const base = { ..._nullishCoalesce(mains[0], () => ( cur[0])), y: lineY, fontSize: size || cur[0].fontSize };
1701
1710
  const x1 = Math.min(...cur.map((i) => i.x)), x2 = Math.max(...cur.map((i) => i.x + i.w));
1702
1711
  added.push({ ...base, text: `$${tex}$`, x: x1, w: x2 - x1, hasSpaceBefore: true });
@@ -2042,7 +2051,7 @@ function joinVerticalColumns(items) {
2042
2051
  const groups = [];
2043
2052
  for (const col of columns) {
2044
2053
  const g2 = groups[groups.length - 1];
2045
- const last = _optionalChain([g2, 'optionalAccess', _116 => _116[g2.length - 1]]);
2054
+ const last = _optionalChain([g2, 'optionalAccess', _121 => _121[g2.length - 1]]);
2046
2055
  const fs = col.items[0].fontSize;
2047
2056
  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);
2048
2057
  else groups.push([col]);
@@ -2228,7 +2237,7 @@ function relocateEndnotes(blocks) {
2228
2237
  }
2229
2238
  const shapes = /* @__PURE__ */ new Map();
2230
2239
  for (const h of heads) shapes.set(h.shape, (_nullishCoalesce(shapes.get(h.shape), () => ( 0))) + 1);
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]]);
2240
+ const main = _optionalChain([[...shapes], 'access', _122 => _122.sort, 'call', _123 => _123((a, b) => b[1] - a[1]), 'access', _124 => _124[0], 'optionalAccess', _125 => _125[0]]);
2232
2241
  if (!main || !/#/.test(main)) return blocks;
2233
2242
  const lastRun = (hs) => {
2234
2243
  let run2 = [];
@@ -2329,7 +2338,7 @@ var RUN_GAP = 5;
2329
2338
  function removeSideTabs(blocks, pageWidths) {
2330
2339
  const edges = /* @__PURE__ */ new Map();
2331
2340
  for (const b of blocks) {
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;
2341
+ if (!b.bbox || b.pageNumber === void 0 || [..._nullishCoalesce(_optionalChain([b, 'access', _126 => _126.text, 'optionalAccess', _127 => _127.trim, 'call', _128 => _128()]), () => ( ""))].length <= MAX_CHARS) continue;
2333
2342
  const e = _nullishCoalesce(edges.get(b.pageNumber), () => ( { lefts: [], rights: [] }));
2334
2343
  e.lefts.push(b.bbox.x);
2335
2344
  e.rights.push(b.bbox.x + b.bbox.width);
@@ -2345,7 +2354,7 @@ function removeSideTabs(blocks, pageWidths) {
2345
2354
  const fallback = all.length ? { left: q(all.map((e) => e.left), 0.5), right: q(all.map((e) => e.right), 0.5) } : void 0;
2346
2355
  const key = (b) => {
2347
2356
  const w = b.pageNumber !== void 0 ? pageWidths.get(b.pageNumber) : void 0;
2348
- const text = _optionalChain([b, 'access', _124 => _124.text, 'optionalAccess', _125 => _125.trim, 'call', _126 => _126()]);
2357
+ const text = _optionalChain([b, 'access', _129 => _129.text, 'optionalAccess', _130 => _130.trim, 'call', _131 => _131()]);
2349
2358
  const area = _nullishCoalesce((b.pageNumber !== void 0 ? body.get(b.pageNumber) : void 0), () => ( fallback));
2350
2359
  if (!w || !area || !b.bbox || !text || b.type === "table" || [...text].length > MAX_CHARS) return null;
2351
2360
  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;
@@ -2421,7 +2430,7 @@ function inlineFootnotes(blocks, pages) {
2421
2430
  open = true;
2422
2431
  continue;
2423
2432
  }
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;
2433
+ const prev = pb[j - 1], line = (_nullishCoalesce(_nullishCoalesce(_optionalChain([b, 'access', _132 => _132.style, 'optionalAccess', _133 => _133.fontSize]), () => ( _optionalChain([b, 'access', _134 => _134.bbox, 'optionalAccess', _135 => _135.height]))), () => ( 10))) * 1.5;
2425
2434
  if (open && b.bbox && prev.bbox && prev.bbox.y - top(b) <= line && !/^[-–—\s\d]+$/.test(b.text)) {
2426
2435
  notes[notes.length - 1].text += " " + b.text.trim();
2427
2436
  notes[notes.length - 1].blocks.push(b);
@@ -2444,7 +2453,7 @@ var CAPTION = /^(?:Table|Figure|Fig\.?)\s*\d+(?:\.\d+)*\s*[.:]/i;
2444
2453
  var EQUATION_NUMBER = /\t\(\d{1,3}[a-z]?\)\s*$/;
2445
2454
  var DISPLAY_MATH = /=|[√∑∏∫∂∇≤≥≈≠∈∀∃]/;
2446
2455
  function isRunningHead(block, page, pageHeight) {
2447
- const box = block.bbox, text = _optionalChain([block, 'access', _131 => _131.text, 'optionalAccess', _132 => _132.trim, 'call', _133 => _133()]);
2456
+ const box = block.bbox, text = _optionalChain([block, 'access', _136 => _136.text, 'optionalAccess', _137 => _137.trim, 'call', _138 => _138()]);
2448
2457
  if (!box || !text || !pageHeight) return false;
2449
2458
  const top = box.y + box.height >= pageHeight * 0.9;
2450
2459
  const bottom = box.y <= pageHeight * 0.1;
@@ -2452,7 +2461,7 @@ function isRunningHead(block, page, pageHeight) {
2452
2461
  const others = page.filter((o) => o !== block && o.bbox && o.type !== "image" && o.type !== "separator");
2453
2462
  if (top && others.some((o) => o.bbox.y + o.bbox.height > box.y + box.height)) return false;
2454
2463
  if (bottom && others.some((o) => o.bbox.y < box.y)) return false;
2455
- if (bottom && box.height <= (_nullishCoalesce(_optionalChain([block, 'access', _134 => _134.style, 'optionalAccess', _135 => _135.fontSize]), () => ( 0))) * 1.6) return true;
2464
+ if (bottom && box.height <= (_nullishCoalesce(_optionalChain([block, 'access', _139 => _139.style, 'optionalAccess', _140 => _140.fontSize]), () => ( 0))) * 1.6) return true;
2456
2465
  if (!text.includes(" ")) return false;
2457
2466
  const parts = text.split(/\t+/).map((part) => part.trim()).filter(Boolean);
2458
2467
  if (parts.length >= 2 && (PAGE_NUMBER.test(parts[0]) || PAGE_NUMBER.test(parts[parts.length - 1]))) return true;
@@ -2461,7 +2470,7 @@ function isRunningHead(block, page, pageHeight) {
2461
2470
  return right > left && box.width >= (right - left) * 0.6;
2462
2471
  }
2463
2472
  function unbalancedClose(text) {
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)));
2473
+ return (_nullishCoalesce(_optionalChain([text, 'access', _141 => _141.match, 'call', _142 => _142(/\)/g), 'optionalAccess', _143 => _143.length]), () => ( 0))) > (_nullishCoalesce(_optionalChain([text, 'access', _144 => _144.match, 'call', _145 => _145(/\(/g), 'optionalAccess', _146 => _146.length]), () => ( 0)));
2465
2474
  }
2466
2475
  function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
2467
2476
  const byPage = /* @__PURE__ */ new Map();
@@ -2474,7 +2483,7 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
2474
2483
  for (const [pageNumber, page] of byPage) {
2475
2484
  const chars = /* @__PURE__ */ new Map();
2476
2485
  for (const b of page) {
2477
- if (b.type !== "paragraph" && b.type !== "heading" || !b.text || !_optionalChain([b, 'access', _142 => _142.style, 'optionalAccess', _143 => _143.fontName]) || !b.style.fontSize) continue;
2486
+ if (b.type !== "paragraph" && b.type !== "heading" || !b.text || !_optionalChain([b, 'access', _147 => _147.style, 'optionalAccess', _148 => _148.fontName]) || !b.style.fontSize) continue;
2478
2487
  const key2 = `${b.style.fontName}:${b.style.fontSize}`;
2479
2488
  chars.set(key2, (_nullishCoalesce(chars.get(key2), () => ( 0))) + b.text.length);
2480
2489
  }
@@ -2485,48 +2494,48 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
2485
2494
  const block = blocks[i];
2486
2495
  if (block.type !== "heading" || !block.text) continue;
2487
2496
  const text = block.text.replace(/<[^>]+>/g, "").trim();
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]);
2497
+ const fsz = _nullishCoalesce(_optionalChain([block, 'access', _149 => _149.style, 'optionalAccess', _150 => _150.fontSize]), () => ( 0));
2498
+ const tocEntry = i > 0 && _chunkWNF3TSV3cjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunkWNF3TSV3cjs.TOC_BLOCKS.has(blocks[i + 1]);
2490
2499
  const page = _nullishCoalesce(byPage.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( []));
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;
2500
+ const proseStyle = _optionalChain([block, 'access', _151 => _151.style, 'optionalAccess', _152 => _152.fontName]) && bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))) === `${block.style.fontName}:${block.style.fontSize}` && text.length > 60;
2492
2501
  const next = blocks[i + 1];
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) {
2502
+ const nb = _optionalChain([next, 'optionalAccess', _153 => _153.bbox]), bb = block.bbox;
2503
+ const chapterNumber = !!nb && !!bb && fsz >= (_nullishCoalesce(_optionalChain([next, 'optionalAccess', _154 => _154.style, 'optionalAccess', _155 => _155.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;
2504
+ if (/^\d+(?:\.\d+)*\.?$/.test(text) && _optionalChain([next, 'optionalAccess', _156 => _156.type]) === "heading" && next.text && next.pageNumber === block.pageNumber && !chapterNumber) {
2496
2505
  next.text = `${block.text.trim()} ${next.text.trim()}`;
2497
2506
  blocks.splice(i--, 1);
2498
2507
  continue;
2499
2508
  }
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) {
2509
+ if ((_optionalChain([next, 'optionalAccess', _157 => _157.type]) === "paragraph" || _optionalChain([next, 'optionalAccess', _158 => _158.type]) === "heading" && !CAPTION.test(text)) && next.pageNumber === block.pageNumber && next.text && next.bbox && block.bbox && _optionalChain([next, 'access', _159 => _159.style, 'optionalAccess', _160 => _160.fontName]) === _optionalChain([block, 'access', _161 => _161.style, 'optionalAccess', _162 => _162.fontName]) && _optionalChain([next, 'access', _163 => _163.style, 'optionalAccess', _164 => _164.fontSize]) === _optionalChain([block, 'access', _165 => _165.style, 'optionalAccess', _166 => _166.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) {
2501
2510
  block.text = `${block.text.trim()} ${next.text.trim()}`;
2502
2511
  block.bbox = { ...block.bbox, y: next.bbox.y, height: block.bbox.y + block.bbox.height - next.bbox.y };
2503
2512
  blocks.splice(i + 1, 1);
2504
2513
  }
2505
2514
  const after = blocks[i + 2];
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])) {
2515
+ if ((_optionalChain([next, 'optionalAccess', _167 => _167.type]) === "paragraph" || _optionalChain([next, 'optionalAccess', _168 => _168.type]) === "heading") && /^(?:&|\+|and|or)$/i.test(_nullishCoalesce(_optionalChain([next, 'access', _169 => _169.text, 'optionalAccess', _170 => _170.trim, 'call', _171 => _171()]), () => ( ""))) && _optionalChain([after, 'optionalAccess', _172 => _172.type]) === "heading" && after.text && after.pageNumber === block.pageNumber && next.pageNumber === block.pageNumber && _optionalChain([after, 'access', _173 => _173.style, 'optionalAccess', _174 => _174.fontSize]) === _optionalChain([block, 'access', _175 => _175.style, 'optionalAccess', _176 => _176.fontSize])) {
2507
2516
  block.text = `${block.text.trim()} ${next.text.trim()} ${after.text.trim()}`;
2508
2517
  blocks.splice(i + 1, 2);
2509
2518
  }
2510
2519
  const tiny = fsz > 0 && fsz < 7.5;
2511
2520
  const prev = blocks[i - 1];
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) {
2521
+ if (_optionalChain([prev, 'optionalAccess', _177 => _177.type]) === "paragraph" && prev.pageNumber === block.pageNumber && /^[a-z]{1,3}[.)]$/.test(_nullishCoalesce(_optionalChain([prev, 'access', _178 => _178.text, 'optionalAccess', _179 => _179.trim, 'call', _180 => _180()]), () => ( ""))) && prev.bbox && block.bbox && Math.abs(prev.bbox.y - block.bbox.y) < 2 && prev.bbox.x + prev.bbox.width <= block.bbox.x) {
2513
2522
  prev.text = `${prev.text.trim()} ${block.text.trim()}`;
2514
2523
  prev.bbox = { ...prev.bbox, width: block.bbox.x + block.bbox.width - prev.bbox.x };
2515
2524
  blocks.splice(i--, 1);
2516
2525
  continue;
2517
2526
  }
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)) {
2527
+ if (_optionalChain([prev, 'optionalAccess', _181 => _181.type]) === "paragraph" && prev.pageNumber === block.pageNumber && /^\d{1,2}(?:\.\d{1,2})*\.?$/.test(_nullishCoalesce(_optionalChain([prev, 'access', _182 => _182.text, 'optionalAccess', _183 => _183.trim, 'call', _184 => _184()]), () => ( ""))) && 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', _185 => _185.style, 'optionalAccess', _186 => _186.fontSize]), () => ( 0))) >= fsz && prev.bbox.y - (block.bbox.y + block.bbox.height) < fsz * 1.5)) {
2519
2528
  block.text = `${prev.text.trim()} ${block.text.trim()}`;
2520
2529
  blocks.splice(i - 1, 1);
2521
2530
  i -= 2;
2522
2531
  continue;
2523
2532
  }
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]), () => ( "")))]), () => ( ""));
2533
+ const box = block.bbox, size = _nullishCoalesce(_optionalChain([block, 'access', _187 => _187.style, 'optionalAccess', _188 => _188.fontSize]), () => ( 0));
2534
+ const kicker = !!box && size > 0 && _optionalChain([next, 'optionalAccess', _189 => _189.type]) === "heading" && next.pageNumber === block.pageNumber && !!next.bbox && (_nullishCoalesce(_optionalChain([next, 'access', _190 => _190.style, 'optionalAccess', _191 => _191.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");
2535
+ const face = _nullishCoalesce(_optionalChain([faceNames, 'optionalAccess', _192 => _192.get, 'call', _193 => _193(_nullishCoalesce(_optionalChain([block, 'access', _194 => _194.style, 'optionalAccess', _195 => _195.fontName]), () => ( "")))]), () => ( ""));
2527
2536
  const [bodyFace, bodySize] = (_nullishCoalesce(bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( ""))).split(":");
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);
2537
+ const byline = /Italic|Oblique/i.test(face) && !/Bold|Black|Heavy|Semibold/i.test(face) && !!bodyFace && size <= Number(bodySize) + 0.5 && _optionalChain([blocks, 'access', _196 => _196[i - 1], 'optionalAccess', _197 => _197.type]) === "heading" && blocks[i - 1].pageNumber === block.pageNumber;
2538
+ const ocrFragment = _optionalChain([block, 'access', _198 => _198.style, 'optionalAccess', _199 => _199.fontName]) === "ocr" && (/^[.,;:…·•-]/.test(text) || text.includes("\u2026") || (_nullishCoalesce(_optionalChain([text, 'access', _200 => _200.match, 'call', _201 => _201(/\p{L}/gu), 'optionalAccess', _202 => _202.length]), () => ( 0))) < 2 || text.split(/\s+/).length > 7);
2530
2539
  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)"·"가)" 앞머리 번호는 빼고 센다
2531
2540
  unbalancedClose(text.replace(/^\s*[\dA-Za-z가-힣ⅰ-ⅹ]{1,3}\)\s*/, "")) || isRunningHead(block, page, pageHeights.get(_nullishCoalesce(block.pageNumber, () => ( 0))))) {
2532
2541
  block.type = "paragraph";
@@ -2561,28 +2570,28 @@ var CAPTION_LABEL = /^(?:figure|fig\.|diagram|table|chart|graph|exhibit|box)\s*[
2561
2570
  function captionTableText(t) {
2562
2571
  if (!t || t.rows !== 1 || t.cols !== 2) return null;
2563
2572
  const [label, body] = t.cells[0];
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;
2573
+ if (!label || !body || _optionalChain([label, 'access', _203 => _203.blocks, 'optionalAccess', _204 => _204.length]) || _optionalChain([body, 'access', _205 => _205.blocks, 'optionalAccess', _206 => _206.length]) || !CAPTION_LABEL.test(label.text.trim()) || !body.text.trim()) return null;
2565
2574
  return `${label.text.trim()} ${body.text.replace(/\s*\n\s*/g, " ").trim()}`;
2566
2575
  }
2567
2576
  function splitSingleCellTables(blocks) {
2568
2577
  const out = [];
2569
2578
  for (const b of blocks) {
2570
2579
  const t = b.type === "table" ? b.table : 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;
2580
+ const only = t && t.rows === 1 && t.cols === 1 && _optionalChain([t, 'access', _207 => _207.cells, 'access', _208 => _208[0], 'optionalAccess', _209 => _209[0], 'optionalAccess', _210 => _210.blocks, 'optionalAccess', _211 => _211.length]) === 1 ? t.cells[0][0].blocks[0] : void 0;
2572
2581
  const squash = (s) => s.replace(/\s/g, "");
2573
2582
  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;
2574
- const caption = _nullishCoalesce(captionTableText(t), () => ( (_optionalChain([inner, 'optionalAccess', _207 => _207.type]) === "table" ? captionTableText(inner.table) : null)));
2583
+ const caption = _nullishCoalesce(captionTableText(t), () => ( (_optionalChain([inner, 'optionalAccess', _212 => _212.type]) === "table" ? captionTableText(inner.table) : null)));
2575
2584
  if (caption) {
2576
2585
  out.push({ type: "paragraph", text: caption, pageNumber: b.pageNumber, bbox: b.bbox });
2577
2586
  continue;
2578
2587
  }
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")])) {
2588
+ const cell = t && t.rows === 1 && t.cols === 1 ? _optionalChain([t, 'access', _213 => _213.cells, 'access', _214 => _214[0], 'optionalAccess', _215 => _215[0]]) : void 0;
2589
+ if (!cell || _optionalChain([cell, 'access', _216 => _216.blocks, 'optionalAccess', _217 => _217.some, 'call', _218 => _218((x) => x.type === "table")])) {
2581
2590
  out.push(b);
2582
2591
  continue;
2583
2592
  }
2584
2593
  const lines = (_nullishCoalesce(cell.text, () => ( ""))).split(/\n/).map((l) => l.trim()).filter(Boolean);
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 });
2594
+ if (_optionalChain([t, 'optionalAccess', _219 => _219.caption, 'optionalAccess', _220 => _220.trim, 'call', _221 => _221()])) out.push({ type: "paragraph", text: t.caption.trim(), pageNumber: b.pageNumber, bbox: b.bbox });
2586
2595
  for (const text of lines) out.push({ type: "paragraph", text, pageNumber: b.pageNumber, bbox: b.bbox });
2587
2596
  }
2588
2597
  return out;
@@ -2595,7 +2604,7 @@ function joinLatinCellWraps(blocks) {
2595
2604
  const lines = cell.text.split("\n");
2596
2605
  const out = [lines[0]];
2597
2606
  for (const line of lines.slice(1)) {
2598
- if (_chunkWWMKIHF7cjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
2607
+ if (_chunkWNF3TSV3cjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
2599
2608
  else out.push(line);
2600
2609
  }
2601
2610
  cell.text = out.join("\n");
@@ -2606,19 +2615,19 @@ function joinLatinCellWraps(blocks) {
2606
2615
  }
2607
2616
  function cleanPdfText(text, opts) {
2608
2617
  let clean = normalizeAraea(stripControlChars(text));
2609
- if (!_optionalChain([opts, 'optionalAccess', _217 => _217.keepLoneNumbers])) {
2618
+ if (!_optionalChain([opts, 'optionalAccess', _222 => _222.keepLoneNumbers])) {
2610
2619
  clean = clean.replace(/^\d{1,4}\n/, "").replace(/\n\d{1,4}\n/g, "\n").replace(/\n\d{1,4}$/, "");
2611
2620
  }
2612
- if (!_optionalChain([opts, 'optionalAccess', _218 => _218.keepLoneNumbers])) clean = clean.replace(/^#{1,6}\s*\d{1,4}\s*$/gm, "");
2621
+ if (!_optionalChain([opts, 'optionalAccess', _223 => _223.keepLoneNumbers])) clean = clean.replace(/^#{1,6}\s*\d{1,4}\s*$/gm, "");
2613
2622
  return mergeKoreanLines(
2614
2623
  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))
2615
2624
  ).replace(/^(?!\| ---).*$/gm, (line) => {
2616
2625
  if (/^\s*\${1,2}.+\${1,2}\s*$/.test(line)) return line;
2617
2626
  if (line.startsWith("|")) {
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>"));
2627
+ return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkWNF3TSV3cjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
2619
2628
  }
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);
2629
+ const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _224 => _224.exec, 'call', _225 => _225(line), 'optionalAccess', _226 => _226[0]]), () => ( ""));
2630
+ return mark + _chunkWNF3TSV3cjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
2622
2631
  }).replace(/\\~\\~/g, "~~").replace(/~~~~/g, "").replace(/<u>\s*<\/u>/g, "").replace(/<(sup|sub)>\s*<\/\1>/g, "").replace(/\n{3,}/g, "\n\n").trim();
2623
2632
  }
2624
2633
  function startsWithMarker(line) {
@@ -2650,7 +2659,7 @@ function mergeKoreanLines(text) {
2650
2659
  continue;
2651
2660
  }
2652
2661
  if (/[가-힣·,\-]$/.test(prev) && /^[가-힣(]/.test(curr) && !startsWithMarker(curr) && !isStandaloneHeader(prev) && !startsWithMarker(prev)) {
2653
- result[result.length - 1] = prev + _chunkWWMKIHF7cjs.wrapJoiner.call(void 0, prev, curr) + curr;
2662
+ result[result.length - 1] = prev + _chunkWNF3TSV3cjs.wrapJoiner.call(void 0, prev, curr) + curr;
2654
2663
  } else {
2655
2664
  result.push(curr);
2656
2665
  }
@@ -2666,7 +2675,7 @@ function applyLinkAnnotations(items, annots) {
2666
2675
  const wrapped = /* @__PURE__ */ new Set();
2667
2676
  for (const a of annots) {
2668
2677
  if (a.subtype !== "Link" || !a.url || !a.rect || a.rect.length < 4) continue;
2669
- const url = _chunkKZVQK5NScjs.sanitizeHref.call(void 0, a.url);
2678
+ const url = _chunkEXBZHI25cjs.sanitizeHref.call(void 0, a.url);
2670
2679
  if (!url) continue;
2671
2680
  const x1 = Math.min(a.rect[0], a.rect[2]), x2 = Math.max(a.rect[0], a.rect[2]);
2672
2681
  const y1 = Math.min(a.rect[1], a.rect[3]), y2 = Math.max(a.rect[1], a.rect[3]);
@@ -2707,7 +2716,7 @@ function mergeLinkRuns(markdown) {
2707
2716
 
2708
2717
  // src/pdf/formula-ocr.ts
2709
2718
  async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
2710
- const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-5RETDCIC.cjs")));
2719
+ const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-U37MTMBD.cjs")));
2711
2720
  const { FormulaPipeline, ensureFormulaModels } = formulaMod;
2712
2721
  await ensureFormulaModels((p) => {
2713
2722
  if (p.phase === "download" && p.total) {
@@ -2886,13 +2895,13 @@ async function loadPdfWithTimeout(buffer) {
2886
2895
  try {
2887
2896
  return await Promise.race([
2888
2897
  loadingTask.promise.catch((e) => {
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)");
2898
+ if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkEXBZHI25cjs.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)");
2890
2899
  throw e;
2891
2900
  }),
2892
2901
  new Promise((_, reject) => {
2893
2902
  timer = setTimeout(() => {
2894
2903
  loadingTask.destroy();
2895
- reject(new (0, _chunkKZVQK5NScjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
2904
+ reject(new (0, _chunkEXBZHI25cjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
2896
2905
  }, PDF_LOAD_TIMEOUT_MS);
2897
2906
  })
2898
2907
  ]);
@@ -2901,13 +2910,13 @@ async function loadPdfWithTimeout(buffer) {
2901
2910
  }
2902
2911
  }
2903
2912
  async function parsePdfDocument(buffer, options) {
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;
2913
+ const formulaBuffer = _optionalChain([options, 'optionalAccess', _227 => _227.formulaOcr]) ? buffer : null;
2914
+ const autoOcr = _optionalChain([options, 'optionalAccess', _228 => _228.ocr]) === void 0 && await _chunkWNF3TSV3cjs.ocrModelsCached.call(void 0, );
2915
+ const ocrBuffer = _optionalChain([options, 'optionalAccess', _229 => _229.ocr]) || autoOcr ? buffer : null;
2907
2916
  const doc = await loadPdfWithTimeout(buffer);
2908
2917
  try {
2909
2918
  const pageCount = doc.numPages;
2910
- if (pageCount === 0) throw new (0, _chunkKZVQK5NScjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
2919
+ if (pageCount === 0) throw new (0, _chunkEXBZHI25cjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
2911
2920
  const metadata = { pageCount, pageMode: "layout" };
2912
2921
  await extractPdfMetadata(doc, metadata);
2913
2922
  const blocks = [];
@@ -2916,8 +2925,8 @@ async function parsePdfDocument(buffer, options) {
2916
2925
  let totalChars = 0;
2917
2926
  let totalTextBytes = 0;
2918
2927
  const effectivePageCount = Math.min(pageCount, MAX_PAGES);
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))) {
2928
+ const pageFilter = _optionalChain([options, 'optionalAccess', _230 => _230.pages]) ? _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, effectivePageCount) : null;
2929
+ if (pageCount > MAX_PAGES && (!_optionalChain([options, 'optionalAccess', _231 => _231.pages]) || _chunkJ55UQC5Hcjs.hasRequestedPagesAfter.call(void 0, options.pages, MAX_PAGES, pageCount))) {
2921
2930
  warnings.push({ message: `${pageCount}\uCABD \uC911 \uC55E ${MAX_PAGES}\uCABD\uB9CC \uD30C\uC2F1\uD588\uC2B5\uB2C8\uB2E4 (\uCABD \uC218 \uC0C1\uD55C)`, code: "PARTIAL_PARSE" });
2922
2931
  }
2923
2932
  const totalTarget = pageFilter ? pageFilter.size : effectivePageCount;
@@ -2934,7 +2943,7 @@ async function parsePdfDocument(buffer, options) {
2934
2943
  const pageImageBlocks = /* @__PURE__ */ new Map();
2935
2944
  const carry = {};
2936
2945
  const vectorPageOps = /* @__PURE__ */ new Map();
2937
- const wrapLexicon = new (0, _chunkWWMKIHF7cjs.WrapLexicon)();
2946
+ const wrapLexicon = new (0, _chunkWNF3TSV3cjs.WrapLexicon)();
2938
2947
  const noteMarks = /* @__PURE__ */ new Map();
2939
2948
  let parsedPages = 0;
2940
2949
  for (let i = 1; i <= effectivePageCount; i++) {
@@ -2957,13 +2966,13 @@ async function parsePdfDocument(buffer, options) {
2957
2966
  return void 0;
2958
2967
  }
2959
2968
  };
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]));
2969
+ const differencesOf = (loadedName) => _optionalChain([fontObj, 'call', _232 => _232(loadedName), 'optionalAccess', _233 => _233.differences]);
2970
+ restoreNamedGlyphs(rawItems, rawOps.fnArray, rawOps.argsArray, differencesOf, (n) => _optionalChain([fontObj, 'call', _234 => _234(n), 'optionalAccess', _235 => _235.name]));
2962
2971
  restoreTrackedSpacing(rawItems, rawOps.fnArray, rawOps.argsArray);
2963
2972
  markSyntheticSpaces(rawItems, rawOps.fnArray, rawOps.argsArray);
2964
2973
  const occluded = occludedTextItems(rawItems, rawOps.fnArray, rawOps.argsArray);
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);
2974
+ const items = _chunkWNF3TSV3cjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
2975
+ const filtered = _chunkWNF3TSV3cjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
2967
2976
  const joined = joinVerticalColumns(filtered.visible);
2968
2977
  const visible = dropTabLeaderDots(joined);
2969
2978
  const hiddenCount = filtered.hiddenCount + occluded.size;
@@ -2987,7 +2996,7 @@ async function parsePdfDocument(buffer, options) {
2987
2996
  fnArray: [_pdfmjs.OPS.transform, ...rawOps.fnArray],
2988
2997
  argsArray: [[1, 0, 0, 1, -viewX1, -viewY1], ...rawOps.argsArray]
2989
2998
  } : rawOps;
2990
- remapSymbolFontItems(visible, (loadedName) => _optionalChain([fontObj, 'call', _231 => _231(loadedName), 'optionalAccess', _232 => _232.name]));
2999
+ remapSymbolFontItems(visible, (loadedName) => _optionalChain([fontObj, 'call', _236 => _236(loadedName), 'optionalAccess', _237 => _237.name]));
2991
3000
  remapControlGlyphs(visible, differencesOf);
2992
3001
  const faces = /* @__PURE__ */ new Map();
2993
3002
  for (const it of visible) {
@@ -2995,17 +3004,17 @@ async function parsePdfDocument(buffer, options) {
2995
3004
  let face = faces.get(it.fontName);
2996
3005
  if (face === void 0) {
2997
3006
  const obj = fontObj(it.fontName);
2998
- face = _optionalChain([obj, 'optionalAccess', _233 => _233.isType3Font]) && /^[A-Z]{6}\+./.test(_nullishCoalesce(obj.name, () => ( ""))) && obj.name.slice(7) || it.fontName;
3007
+ face = _optionalChain([obj, 'optionalAccess', _238 => _238.isType3Font]) && /^[A-Z]{6}\+./.test(_nullishCoalesce(obj.name, () => ( ""))) && obj.name.slice(7) || it.fontName;
2999
3008
  faces.set(it.fontName, face);
3000
3009
  }
3001
3010
  it.fontName = face;
3002
- if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _234 => _234(face), 'optionalAccess', _235 => _235.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
3011
+ if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _239 => _239(face), 'optionalAccess', _240 => _240.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
3003
3012
  }
3004
- for (const it of visible) if (it.text.includes("$")) it.text = _chunkGPC72VSFcjs.escapeLiteralDollar.call(void 0, it.text);
3013
+ for (const it of visible) if (it.text.includes("$")) it.text = _chunkAFXX3YSPcjs.escapeLiteralDollar.call(void 0, it.text);
3005
3014
  wrapEquationRuns(visible, (face) => faceNames.get(face));
3006
3015
  const pageArea = pageW * pageH;
3007
3016
  if (pageArea > 0) {
3008
- const imageRegions = _chunkWWMKIHF7cjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
3017
+ const imageRegions = _chunkWNF3TSV3cjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
3009
3018
  let uncovered = 0;
3010
3019
  for (const r of imageRegions) {
3011
3020
  const area = (r.x2 - r.x1) * (r.y2 - r.y1);
@@ -3031,14 +3040,14 @@ async function parsePdfDocument(buffer, options) {
3031
3040
  if (uncovered > 0) skippedImagePages.set(i, uncovered);
3032
3041
  }
3033
3042
  const marks = superscriptNoteMarks(visible);
3034
- if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunkWWMKIHF7cjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
3043
+ if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunkWNF3TSV3cjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
3035
3044
  const stamp = marginStamp(visible);
3036
3045
  const flow = stamp.length ? visible.filter((it) => !stamp.includes(it)) : visible;
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);
3046
+ const pageBlocks = orderTwoUpPage(_chunkWNF3TSV3cjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _241 => _241.tables]) !== false, carry, wrapLexicon), pageW, pageH);
3038
3047
  if (stamp.length) pageBlocks.unshift({ type: "paragraph", text: [...stamp].sort((a, b) => a.y - b.y).map((it) => it.text).join(" "), pageNumber: i });
3039
3048
  for (const b of pageBlocks) blocks.push(b);
3040
3049
  try {
3041
- const { blocks: imgBlocks, images: pageImages } = await extractPageImages(page, opList.fnArray, opList.argsArray, i, imageState, warnings, _optionalChain([options, 'optionalAccess', _237 => _237.images]) !== false);
3050
+ const { blocks: imgBlocks, images: pageImages } = await extractPageImages(page, opList.fnArray, opList.argsArray, i, imageState, warnings, _optionalChain([options, 'optionalAccess', _242 => _242.images]) !== false);
3042
3051
  if (imgBlocks.length > 0) pageImageBlocks.set(i, imgBlocks);
3043
3052
  extractedImages.push(...pageImages);
3044
3053
  } catch (e6) {
@@ -3057,27 +3066,27 @@ async function parsePdfDocument(buffer, options) {
3057
3066
  const vector = scanVectorGlyphs(opList.fnArray, opList.argsArray, visible);
3058
3067
  const quality = computePageQuality(i, pageText, vector.glyphs);
3059
3068
  pageQuality.push(quality);
3060
- if (_optionalChain([options, 'optionalAccess', _238 => _238.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
3069
+ if (_optionalChain([options, 'optionalAccess', _243 => _243.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
3061
3070
  vectorPageOps.set(i, ocrVectorOps(opList, vector.paths));
3062
3071
  }
3063
- if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkKZVQK5NScjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
3072
+ if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkEXBZHI25cjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
3064
3073
  parsedPages++;
3065
- _optionalChain([options, 'optionalAccess', _239 => _239.onProgress, 'optionalCall', _240 => _240(parsedPages, totalTarget)]);
3074
+ _optionalChain([options, 'optionalAccess', _244 => _244.onProgress, 'optionalCall', _245 => _245(parsedPages, totalTarget)]);
3066
3075
  } catch (pageErr) {
3067
- if (pageErr instanceof _chunkKZVQK5NScjs.KordocError) throw pageErr;
3076
+ if (pageErr instanceof _chunkEXBZHI25cjs.KordocError) throw pageErr;
3068
3077
  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" });
3069
3078
  } finally {
3070
- _optionalChain([loadedPage, 'optionalAccess', _241 => _241.cleanup, 'call', _242 => _242()]);
3079
+ _optionalChain([loadedPage, 'optionalAccess', _246 => _246.cleanup, 'call', _247 => _247()]);
3071
3080
  }
3072
3081
  }
3073
3082
  const parsedPageCount = parsedPages || (pageFilter ? pageFilter.size : effectivePageCount);
3074
- const isImageBased = _optionalChain([pageFilter, 'optionalAccess', _243 => _243.size]) !== 0 && totalChars / Math.max(parsedPageCount, 1) < 10;
3083
+ const isImageBased = _optionalChain([pageFilter, 'optionalAccess', _248 => _248.size]) !== 0 && totalChars / Math.max(parsedPageCount, 1) < 10;
3075
3084
  const ocrDone = /* @__PURE__ */ new Set();
3076
- const ocrRegions = _optionalChain([options, 'optionalAccess', _244 => _244.ocr]) === true || autoOcr ? ocrImageRegions(uncoveredImageRegions, largeImageRegions, _optionalChain([options, 'optionalAccess', _245 => _245.ocr]) === true) : /* @__PURE__ */ new Map();
3085
+ const ocrRegions = _optionalChain([options, 'optionalAccess', _249 => _249.ocr]) === true || autoOcr ? ocrImageRegions(uncoveredImageRegions, largeImageRegions, _optionalChain([options, 'optionalAccess', _250 => _250.ocr]) === true) : /* @__PURE__ */ new Map();
3077
3086
  if (ocrBuffer) {
3078
3087
  const inScope = (p) => !pageFilter || pageFilter.has(p);
3079
3088
  const targets = /* @__PURE__ */ new Set();
3080
- if (_optionalChain([options, 'optionalAccess', _246 => _246.ocr]) === "force" || isImageBased) {
3089
+ if (_optionalChain([options, 'optionalAccess', _251 => _251.ocr]) === "force" || isImageBased) {
3081
3090
  for (let i = 1; i <= effectivePageCount; i++) if (inScope(i)) targets.add(i);
3082
3091
  } else {
3083
3092
  for (const pq of pageQuality) {
@@ -3090,16 +3099,16 @@ async function parsePdfDocument(buffer, options) {
3090
3099
  }
3091
3100
  if (targets.size > 0) {
3092
3101
  try {
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 });
3102
+ const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-2CITOAIG.cjs")));
3103
+ const mode = typeof _optionalChain([options, 'optionalAccess', _252 => _252.ocr]) === "function" ? options.ocr : "builtin";
3104
+ const regionPages = new Map([...ocrRegions].filter(([p]) => _optionalChain([options, 'optionalAccess', _253 => _253.ocr]) !== "force" && !isImageBased && !_optionalChain([pageQuality, 'access', _254 => _254.find, 'call', _255 => _255((q) => q.page === p), 'optionalAccess', _256 => _256.needsOcr])));
3105
+ const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, _optionalChain([options, 'optionalAccess', _257 => _257.onProgress]), _optionalChain([options, 'optionalAccess', _258 => _258.tables]) !== false, vectorPageOps, regionPages);
3106
+ for (const obs of ocrPageBlocks.values()) _chunkAFXX3YSPcjs.stripScriptTags.call(void 0, { blocks: obs });
3098
3107
  if (ocrPageBlocks.size > 0) {
3099
3108
  const replacePages = /* @__PURE__ */ new Set();
3100
3109
  for (const [p, obs] of ocrPageBlocks) {
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) {
3110
+ const needsOcr = _optionalChain([pageQuality, 'access', _259 => _259.find, 'call', _260 => _260((q) => q.page === p), 'optionalAccess', _261 => _261.needsOcr]);
3111
+ if (_optionalChain([options, 'optionalAccess', _262 => _262.ocr]) === "force" || isImageBased || needsOcr) {
3103
3112
  replacePages.add(p);
3104
3113
  ocrDone.add(p);
3105
3114
  continue;
@@ -3107,7 +3116,7 @@ async function parsePdfDocument(buffer, options) {
3107
3116
  const regions = ocrRegions.get(p);
3108
3117
  if (!regions || mergeOcrImageRegions(blocks, p, regions, obs) === 0) continue;
3109
3118
  ocrDone.add(p);
3110
- if (_optionalChain([pageImageBlocks, 'access', _258 => _258.get, 'call', _259 => _259(p), 'optionalAccess', _260 => _260.length]) === 1) pageImageBlocks.delete(p);
3119
+ if (_optionalChain([pageImageBlocks, 'access', _263 => _263.get, 'call', _264 => _264(p), 'optionalAccess', _265 => _265.length]) === 1) pageImageBlocks.delete(p);
3111
3120
  }
3112
3121
  if (replacePages.size) {
3113
3122
  const merged = blocks.filter((b) => !(b.pageNumber && replacePages.has(b.pageNumber)));
@@ -3157,8 +3166,8 @@ async function parsePdfDocument(buffer, options) {
3157
3166
  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" });
3158
3167
  }
3159
3168
  }
3160
- if (_optionalChain([options, 'optionalAccess', _261 => _261.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
3161
- const removed = _chunkWWMKIHF7cjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks);
3169
+ if (_optionalChain([options, 'optionalAccess', _266 => _266.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
3170
+ const removed = _chunkWNF3TSV3cjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks);
3162
3171
  for (let ri = removed.length - 1; ri >= 0; ri--) {
3163
3172
  blocks.splice(removed[ri], 1);
3164
3173
  }
@@ -3170,15 +3179,15 @@ async function parsePdfDocument(buffer, options) {
3170
3179
  }
3171
3180
  mergeContinuedCells(blocks, pageHeights);
3172
3181
  mergeCrossPageTables(blocks, pageHeights, wrapLexicon);
3173
- if (_optionalChain([options, 'optionalAccess', _262 => _262.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
3174
- const boxes = _chunkWWMKIHF7cjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
3182
+ if (_optionalChain([options, 'optionalAccess', _267 => _267.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
3183
+ const boxes = _chunkWNF3TSV3cjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
3175
3184
  for (let ri = boxes.length - 1; ri >= 0; ri--) blocks.splice(boxes[ri], 1);
3176
3185
  }
3177
3186
  splitContactTables(blocks);
3178
- if (!_optionalChain([options, 'optionalAccess', _263 => _263.keepTrailingEmptyCols])) _chunkWWMKIHF7cjs.trimTrailingEmptyTableCols.call(void 0, blocks);
3179
- _chunkWWMKIHF7cjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
3187
+ if (!_optionalChain([options, 'optionalAccess', _268 => _268.keepTrailingEmptyCols])) _chunkWNF3TSV3cjs.trimTrailingEmptyTableCols.call(void 0, blocks);
3188
+ _chunkWNF3TSV3cjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
3180
3189
  injectPageImageBlocks(blocks, pageImageBlocks);
3181
- if (_optionalChain([options, 'optionalAccess', _264 => _264.formulaOcr]) && formulaBuffer) {
3190
+ if (_optionalChain([options, 'optionalAccess', _269 => _269.formulaOcr]) && formulaBuffer) {
3182
3191
  try {
3183
3192
  await applyFormulaOcr(formulaBuffer, blocks, pageFilter, effectivePageCount, warnings, options.onProgress);
3184
3193
  } catch (e) {
@@ -3188,49 +3197,49 @@ async function parsePdfDocument(buffer, options) {
3188
3197
  });
3189
3198
  }
3190
3199
  }
3191
- const medianFontSize = _chunkWWMKIHF7cjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
3200
+ const medianFontSize = _chunkWNF3TSV3cjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
3192
3201
  if (medianFontSize > 0) {
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);
3202
+ _chunkWNF3TSV3cjs.detectHeadings.call(void 0, blocks, medianFontSize);
3203
+ }
3204
+ _chunkWNF3TSV3cjs.detectDocumentStyleHeadings.call(void 0, blocks);
3205
+ _chunkWNF3TSV3cjs.detectTypographyHeadings.call(void 0, blocks);
3206
+ _chunkWNF3TSV3cjs.detectSiblingStyleHeadings.call(void 0, blocks);
3207
+ _chunkWNF3TSV3cjs.detectRepeatedPageLabels.call(void 0, blocks);
3208
+ _chunkWNF3TSV3cjs.detectPageLeadHeadings.call(void 0, blocks);
3209
+ _chunkWNF3TSV3cjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
3210
+ _chunkWNF3TSV3cjs.refineDocumentStyleHeadings.call(void 0, blocks);
3211
+ _chunkWNF3TSV3cjs.detectMarkerHeadings.call(void 0, blocks);
3203
3212
  demoteNonHeadingRoles(blocks, pageHeights, faceNames);
3204
- _chunkWWMKIHF7cjs.detectTableCaptions.call(void 0, blocks);
3205
- _chunkWWMKIHF7cjs.detectKoreanListBlocks.call(void 0, blocks);
3213
+ _chunkWNF3TSV3cjs.detectTableCaptions.call(void 0, blocks);
3214
+ _chunkWNF3TSV3cjs.detectKoreanListBlocks.call(void 0, blocks);
3206
3215
  const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
3207
3216
  sanitizeBlockControlChars(blocks);
3208
3217
  let outBlocks = splitSingleCellTables(blocks);
3209
3218
  outBlocks = inlineFootnotes(outBlocks, noteMarks);
3210
3219
  outBlocks = relocateEndnotes(outBlocks);
3211
- if (_optionalChain([options, 'optionalAccess', _265 => _265.removeHeaderFooter]) !== false) outBlocks = outBlocks.filter((b) => {
3220
+ if (_optionalChain([options, 'optionalAccess', _270 => _270.removeHeaderFooter]) !== false) outBlocks = outBlocks.filter((b) => {
3212
3221
  if (b.type !== "paragraph" || !/^\s*\d{1,4}\s*$/.test(_nullishCoalesce(b.text, () => ( "")))) return true;
3213
3222
  const h = pageHeights.get(_nullishCoalesce(b.pageNumber, () => ( 0)));
3214
3223
  if (!b.bbox || !h) return false;
3215
3224
  return b.bbox.y > h * 0.1 && b.bbox.y + b.bbox.height < h * 0.9;
3216
3225
  });
3217
3226
  joinLatinCellWraps(outBlocks);
3218
- if (_optionalChain([options, 'optionalAccess', _266 => _266.layoutTables]) !== "keep") {
3227
+ if (_optionalChain([options, 'optionalAccess', _271 => _271.layoutTables]) !== "keep") {
3219
3228
  const hancom = await isHancomPdf(doc);
3220
3229
  const shown = /* @__PURE__ */ new Map();
3221
3230
  const markContent = (bs) => {
3222
3231
  for (const b of _nullishCoalesce(bs, () => ( []))) if (b.table) for (const row of b.table.cells) for (const c of row) {
3223
- if (_chunkWWMKIHF7cjs.IMAGE_CELLS.has(c)) _chunkYIANW5QXcjs.CONTENT_CELLS.add(c);
3232
+ if (_chunkWNF3TSV3cjs.IMAGE_CELLS.has(c)) _chunkAFXX3YSPcjs.CONTENT_CELLS.add(c);
3224
3233
  markContent(c.blocks);
3225
3234
  }
3226
3235
  };
3227
3236
  const visual = (bs) => bs.flatMap((b) => {
3228
3237
  if (b.type !== "table") return [b];
3229
- if (!hancom && b.table && _chunkWWMKIHF7cjs.CLIP_TABLES.has(b.table)) return [b];
3238
+ if (!hancom && b.table && _chunkWNF3TSV3cjs.CLIP_TABLES.has(b.table)) return [b];
3230
3239
  let v = shown.get(b);
3231
3240
  if (!v) {
3232
3241
  markContent([b]);
3233
- shown.set(b, v = _chunkYIANW5QXcjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _267 => _267.keepTrailingEmptyCols])));
3242
+ shown.set(b, v = _chunkAFXX3YSPcjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _272 => _272.keepTrailingEmptyCols])));
3234
3243
  }
3235
3244
  return v;
3236
3245
  });
@@ -3239,11 +3248,11 @@ async function parsePdfDocument(buffer, options) {
3239
3248
  blocks.length = 0;
3240
3249
  for (const b of kept) blocks.push(b);
3241
3250
  }
3242
- const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunkGPC72VSFcjs.blocksToMarkdown.call(void 0, bs), { keepLoneNumbers: true }));
3251
+ const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunkAFXX3YSPcjs.blocksToMarkdown.call(void 0, bs), { keepLoneNumbers: true }));
3243
3252
  let markdown = finishMarkdown(outBlocks);
3244
3253
  return {
3245
3254
  markdown,
3246
- pages: _chunkGPC72VSFcjs.blocksToPages.call(void 0, outBlocks, finishMarkdown),
3255
+ pages: _chunkKIYHQQVOcjs.blocksToPages.call(void 0, outBlocks, finishMarkdown),
3247
3256
  blocks,
3248
3257
  metadata,
3249
3258
  outline: outline.length > 0 ? outline : void 0,
@@ -3261,7 +3270,7 @@ async function parsePdfDocument(buffer, options) {
3261
3270
  async function extractPdfMetadata(doc, metadata) {
3262
3271
  try {
3263
3272
  const result = await doc.getMetadata();
3264
- if (!_optionalChain([result, 'optionalAccess', _268 => _268.info])) return;
3273
+ if (!_optionalChain([result, 'optionalAccess', _273 => _273.info])) return;
3265
3274
  const info = result.info;
3266
3275
  if (typeof info.Title === "string" && info.Title.trim()) metadata.title = info.Title.trim();
3267
3276
  if (typeof info.Author === "string" && info.Author.trim()) metadata.author = info.Author.trim();
@@ -3277,8 +3286,8 @@ async function extractPdfMetadata(doc, metadata) {
3277
3286
  }
3278
3287
  async function isHancomPdf(doc) {
3279
3288
  try {
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));
3289
+ const info = await _asyncOptionalChain([(await doc.getMetadata()), 'optionalAccess', async _274 => _274.info]);
3290
+ return [_optionalChain([info, 'optionalAccess', _275 => _275.Producer]), _optionalChain([info, 'optionalAccess', _276 => _276.Creator])].some((v) => typeof v === "string" && /^\s*(?:hancom\b|hwp\b)/i.test(v));
3282
3291
  } catch (e8) {
3283
3292
  return false;
3284
3293
  }
@@ -3321,5 +3330,5 @@ function marginStamp(items) {
3321
3330
 
3322
3331
 
3323
3332
 
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
3333
+ exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkWNF3TSV3cjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkWNF3TSV3cjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkWNF3TSV3cjs.removeHeaderFooterBlocks;
3334
+ //# sourceMappingURL=parser-IXRGUYZW.cjs.map