kordoc 4.16.0 → 4.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/README.md +344 -1135
  2. package/dist/{-VQNLLLPE.js → -4G6MA4X6.js} +11 -11
  3. package/dist/chunk-3IB7LBHC.js +57 -0
  4. package/dist/chunk-3IB7LBHC.js.map +1 -0
  5. package/dist/{chunk-6LMKQM7I.js → chunk-4VODJKFL.js} +3 -3
  6. package/dist/{chunk-UDX7TSOC.js → chunk-5KS5PWJR.js} +2 -2
  7. package/dist/chunk-62W7QCEX.cjs +57 -0
  8. package/dist/chunk-62W7QCEX.cjs.map +1 -0
  9. package/dist/{chunk-NNYF2AGC.js → chunk-7KNGSQU7.js} +4 -4
  10. package/dist/chunk-7KNGSQU7.js.map +1 -0
  11. package/dist/{chunk-DYENR3PX.js → chunk-AUWGDP4G.js} +2 -2
  12. package/dist/{chunk-H6KMTYYZ.cjs → chunk-CEIATRDW.cjs} +3 -3
  13. package/dist/{chunk-H6KMTYYZ.cjs.map → chunk-CEIATRDW.cjs.map} +1 -1
  14. package/dist/{chunk-N6TPODYL.js → chunk-DES2LGFZ.js} +2 -2
  15. package/dist/{chunk-PQRP4NSF.js → chunk-F4NRLLY4.js} +2 -2
  16. package/dist/{chunk-B5NEGP65.cjs → chunk-FKUDAIJI.cjs} +692 -33
  17. package/dist/chunk-FKUDAIJI.cjs.map +1 -0
  18. package/dist/{chunk-XWA625AN.js → chunk-FSDJLAOW.js} +3 -1
  19. package/dist/chunk-FSDJLAOW.js.map +1 -0
  20. package/dist/{chunk-PIMB2YNO.js → chunk-GO5IFOUF.js} +2 -2
  21. package/dist/{chunk-476OYHGZ.js → chunk-IQGIT2VX.js} +37 -7
  22. package/dist/chunk-IQGIT2VX.js.map +1 -0
  23. package/dist/chunk-J3IF6KGW.js +59 -0
  24. package/dist/chunk-J3IF6KGW.js.map +1 -0
  25. package/dist/{chunk-C75WE52C.js → chunk-JELRWAZC.js} +2 -2
  26. package/dist/{chunk-46DZF3RK.js → chunk-JFLAM3MM.js} +2 -2
  27. package/dist/{chunk-A3QDRMVD.js → chunk-KIOQ4N37.js} +2 -2
  28. package/dist/{chunk-TGD7UFHD.js → chunk-LEIAEWZ7.js} +4 -4
  29. package/dist/chunk-LEIAEWZ7.js.map +1 -0
  30. package/dist/{chunk-GOQBON77.js → chunk-MLIS253L.js} +2 -2
  31. package/dist/{chunk-JB5X5NNL.js → chunk-OXLPVQYK.js} +680 -21
  32. package/dist/chunk-OXLPVQYK.js.map +1 -0
  33. package/dist/{chunk-RC4C7Q33.js → chunk-P6ZDXTV6.js} +2 -2
  34. package/dist/{chunk-CB5XDCSL.js → chunk-QOCS7W7R.js} +5034 -4569
  35. package/dist/chunk-QOCS7W7R.js.map +1 -0
  36. package/dist/{chunk-3JWMDL3S.js → chunk-S2PL227Q.js} +2 -2
  37. package/dist/{chunk-HIVK5V27.js → chunk-SFEQYKYJ.js} +133 -110
  38. package/dist/chunk-SFEQYKYJ.js.map +1 -0
  39. package/dist/{chunk-NWODPYBD.cjs → chunk-STM3ORY7.cjs} +2 -2
  40. package/dist/{chunk-NWODPYBD.cjs.map → chunk-STM3ORY7.cjs.map} +1 -1
  41. package/dist/{chunk-43FKGDDO.js → chunk-TXUKTOG2.js} +213 -30
  42. package/dist/chunk-TXUKTOG2.js.map +1 -0
  43. package/dist/{chunk-XHOZB2WP.js → chunk-UTP2WCHS.js} +681 -22
  44. package/dist/chunk-UTP2WCHS.js.map +1 -0
  45. package/dist/{chunk-MH6MAL64.cjs → chunk-WDQTFAXY.cjs} +217 -114
  46. package/dist/chunk-WDQTFAXY.cjs.map +1 -0
  47. package/dist/{chunk-DRY3L5KQ.cjs → chunk-XTFN5WKS.cjs} +7 -7
  48. package/dist/chunk-XTFN5WKS.cjs.map +1 -0
  49. package/dist/chunks-NUNIKS2J.js +10 -0
  50. package/dist/cli.js +33 -30
  51. package/dist/cli.js.map +1 -1
  52. package/dist/{formula-FNQYHMIY.js → formula-EPKLPDU7.js} +3 -3
  53. package/dist/{formula-5775PTP2.js → formula-NARUOXRX.js} +4 -4
  54. package/dist/{formula-VEFKYXPB.cjs → formula-WIMV5TUX.cjs} +9 -9
  55. package/dist/{formula-VEFKYXPB.cjs.map → formula-WIMV5TUX.cjs.map} +1 -1
  56. package/dist/{image-ocr-PYZU4TO7.js → image-ocr-3WJ4QH3T.js} +8 -8
  57. package/dist/{image-ocr-YA2MQBRP.js → image-ocr-5BUJQ4TK.js} +6 -6
  58. package/dist/{image-ocr-6JZR734G.cjs → image-ocr-AXWXR6JV.cjs} +15 -15
  59. package/dist/{image-ocr-6JZR734G.cjs.map → image-ocr-AXWXR6JV.cjs.map} +1 -1
  60. package/dist/index.cjs +1900 -1406
  61. package/dist/index.cjs.map +1 -1
  62. package/dist/index.d.cts +24 -6
  63. package/dist/index.d.ts +24 -6
  64. package/dist/index.js +1282 -788
  65. package/dist/index.js.map +1 -1
  66. package/dist/mcp.js +34 -28
  67. package/dist/mcp.js.map +1 -1
  68. package/dist/{model-bundle-O6J7ORVC.js → model-bundle-IMBW7D2Z.js} +5 -5
  69. package/dist/{models-YMOKZGCI.js → models-SY75IBOE.js} +5 -5
  70. package/dist/{parser-YAQV7FBO.cjs → parser-2LU4EVU3.cjs} +360 -219
  71. package/dist/parser-2LU4EVU3.cjs.map +1 -0
  72. package/dist/{parser-3B6I2XL7.js → parser-N6476XAC.js} +225 -84
  73. package/dist/parser-N6476XAC.js.map +1 -0
  74. package/dist/{parser-PXATL5DM.js → parser-ZQM3664Z.js} +222 -81
  75. package/dist/parser-ZQM3664Z.js.map +1 -0
  76. package/dist/pdf-ocr-6DEE23IP.js +15 -0
  77. package/dist/pdf-ocr-GHEJVPX2.cjs +16 -0
  78. package/dist/{pdf-ocr-T2JXQATA.cjs.map → pdf-ocr-GHEJVPX2.cjs.map} +1 -1
  79. package/dist/pdf-ocr-MQTWODVU.js +18 -0
  80. package/dist/{profile-io-ZTV2MKRT.js → profile-io-GJPKCYPT.js} +3 -3
  81. package/dist/{rasterize-MMUZ537K.js → rasterize-UOALJQDS.js} +3 -3
  82. package/dist/{redact-doc-S42XGV5D.js → redact-doc-22SYW3KH.js} +11 -11
  83. package/dist/{render-WCWPZKJ7.js → render-MJ4H3R23.js} +7 -7
  84. package/dist/seal-XWMRUTI4.js +10 -0
  85. package/dist/{setup-D35LKZCH.js → setup-2URYVUEO.js} +3 -3
  86. package/dist/visual-USPS4QRC.js +20 -0
  87. package/dist/{watch-AX64CIMN.js → watch-ALXZGTOB.js} +12 -12
  88. package/package.json +1 -1
  89. package/dist/chunk-43FKGDDO.js.map +0 -1
  90. package/dist/chunk-476OYHGZ.js.map +0 -1
  91. package/dist/chunk-B5NEGP65.cjs.map +0 -1
  92. package/dist/chunk-CB5XDCSL.js.map +0 -1
  93. package/dist/chunk-DRY3L5KQ.cjs.map +0 -1
  94. package/dist/chunk-HIVK5V27.js.map +0 -1
  95. package/dist/chunk-JB5X5NNL.js.map +0 -1
  96. package/dist/chunk-MH6MAL64.cjs.map +0 -1
  97. package/dist/chunk-NNYF2AGC.js.map +0 -1
  98. package/dist/chunk-QJERJZJ6.js +0 -11
  99. package/dist/chunk-QJERJZJ6.js.map +0 -1
  100. package/dist/chunk-TGD7UFHD.js.map +0 -1
  101. package/dist/chunk-UQ6TZDW6.js +0 -13
  102. package/dist/chunk-UQ6TZDW6.js.map +0 -1
  103. package/dist/chunk-XHOZB2WP.js.map +0 -1
  104. package/dist/chunk-XWA625AN.js.map +0 -1
  105. package/dist/chunk-ZY5K3LPM.cjs +0 -11
  106. package/dist/chunk-ZY5K3LPM.cjs.map +0 -1
  107. package/dist/chunks-JD25E5PM.js +0 -10
  108. package/dist/parser-3B6I2XL7.js.map +0 -1
  109. package/dist/parser-PXATL5DM.js.map +0 -1
  110. package/dist/parser-YAQV7FBO.cjs.map +0 -1
  111. package/dist/pdf-ocr-2TTO5PX2.js +0 -15
  112. package/dist/pdf-ocr-T2JXQATA.cjs +0 -16
  113. package/dist/pdf-ocr-WF2NQA6X.js +0 -18
  114. package/dist/seal-WHK4GOHR.js +0 -10
  115. package/dist/visual-WL4TDE5B.js +0 -20
  116. /package/dist/{-VQNLLLPE.js.map → -4G6MA4X6.js.map} +0 -0
  117. /package/dist/{chunk-6LMKQM7I.js.map → chunk-4VODJKFL.js.map} +0 -0
  118. /package/dist/{chunk-UDX7TSOC.js.map → chunk-5KS5PWJR.js.map} +0 -0
  119. /package/dist/{chunk-DYENR3PX.js.map → chunk-AUWGDP4G.js.map} +0 -0
  120. /package/dist/{chunk-N6TPODYL.js.map → chunk-DES2LGFZ.js.map} +0 -0
  121. /package/dist/{chunk-PQRP4NSF.js.map → chunk-F4NRLLY4.js.map} +0 -0
  122. /package/dist/{chunk-PIMB2YNO.js.map → chunk-GO5IFOUF.js.map} +0 -0
  123. /package/dist/{chunk-C75WE52C.js.map → chunk-JELRWAZC.js.map} +0 -0
  124. /package/dist/{chunk-46DZF3RK.js.map → chunk-JFLAM3MM.js.map} +0 -0
  125. /package/dist/{chunk-A3QDRMVD.js.map → chunk-KIOQ4N37.js.map} +0 -0
  126. /package/dist/{chunk-GOQBON77.js.map → chunk-MLIS253L.js.map} +0 -0
  127. /package/dist/{chunk-RC4C7Q33.js.map → chunk-P6ZDXTV6.js.map} +0 -0
  128. /package/dist/{chunk-3JWMDL3S.js.map → chunk-S2PL227Q.js.map} +0 -0
  129. /package/dist/{chunks-JD25E5PM.js.map → chunks-NUNIKS2J.js.map} +0 -0
  130. /package/dist/{formula-FNQYHMIY.js.map → formula-EPKLPDU7.js.map} +0 -0
  131. /package/dist/{formula-5775PTP2.js.map → formula-NARUOXRX.js.map} +0 -0
  132. /package/dist/{image-ocr-PYZU4TO7.js.map → image-ocr-3WJ4QH3T.js.map} +0 -0
  133. /package/dist/{image-ocr-YA2MQBRP.js.map → image-ocr-5BUJQ4TK.js.map} +0 -0
  134. /package/dist/{model-bundle-O6J7ORVC.js.map → model-bundle-IMBW7D2Z.js.map} +0 -0
  135. /package/dist/{models-YMOKZGCI.js.map → models-SY75IBOE.js.map} +0 -0
  136. /package/dist/{pdf-ocr-2TTO5PX2.js.map → pdf-ocr-6DEE23IP.js.map} +0 -0
  137. /package/dist/{pdf-ocr-WF2NQA6X.js.map → pdf-ocr-MQTWODVU.js.map} +0 -0
  138. /package/dist/{profile-io-ZTV2MKRT.js.map → profile-io-GJPKCYPT.js.map} +0 -0
  139. /package/dist/{rasterize-MMUZ537K.js.map → rasterize-UOALJQDS.js.map} +0 -0
  140. /package/dist/{redact-doc-S42XGV5D.js.map → redact-doc-22SYW3KH.js.map} +0 -0
  141. /package/dist/{render-WCWPZKJ7.js.map → render-MJ4H3R23.js.map} +0 -0
  142. /package/dist/{seal-WHK4GOHR.js.map → seal-XWMRUTI4.js.map} +0 -0
  143. /package/dist/{setup-D35LKZCH.js.map → setup-2URYVUEO.js.map} +0 -0
  144. /package/dist/{visual-WL4TDE5B.js.map → visual-USPS4QRC.js.map} +0 -0
  145. /package/dist/{watch-AX64CIMN.js.map → watch-ALXZGTOB.js.map} +0 -0
@@ -2,15 +2,16 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkZY5K3LPMcjs = require('./chunk-ZY5K3LPM.cjs');
6
5
 
6
+ var _chunk62W7QCEXcjs = require('./chunk-62W7QCEX.cjs');
7
7
 
8
8
 
9
- var _chunkH6KMTYYZcjs = require('./chunk-H6KMTYYZ.cjs');
10
9
 
10
+ var _chunkCEIATRDWcjs = require('./chunk-CEIATRDW.cjs');
11
11
 
12
12
 
13
- var _chunkNWODPYBDcjs = require('./chunk-NWODPYBD.cjs');
13
+
14
+ var _chunkSTM3ORY7cjs = require('./chunk-STM3ORY7.cjs');
14
15
 
15
16
  // src/ocr/models.ts
16
17
  var _path = require('path');
@@ -38,10 +39,10 @@ var OCR_REC_DICT = {
38
39
  };
39
40
  var ALL_OCR_MODELS = [OCR_DET_MODEL, OCR_REC_MODEL, OCR_REC_DICT];
40
41
  function getOcrModelsDir() {
41
- return _chunkH6KMTYYZcjs.getModelsDir.call(void 0, "ppocr");
42
+ return _chunkCEIATRDWcjs.getModelsDir.call(void 0, "ppocr");
42
43
  }
43
44
  async function ensureOcrModels(onProgress) {
44
- return _chunkH6KMTYYZcjs.ensureModelsIn.call(void 0, getOcrModelsDir(), ALL_OCR_MODELS, onProgress);
45
+ return _chunkCEIATRDWcjs.ensureModelsIn.call(void 0, getOcrModelsDir(), ALL_OCR_MODELS, onProgress);
45
46
  }
46
47
  async function ocrModelsCached() {
47
48
  const dir = getOcrModelsDir();
@@ -1085,6 +1086,12 @@ function dropInsetClipGrids(clipGrids, lineGrids) {
1085
1086
  const near = (a, b) => Math.abs(a - b) <= SHADE_CLIP_TOL;
1086
1087
  return clipGrids.filter((c) => c.clipParent || c.rowYs.length !== 2 || !lineGrids.some((l) => l.rowYs.length >= 3 && near(c.bbox.x1, l.bbox.x1) && near(c.bbox.x2, l.bbox.x2) && l.rowYs.some((top, r) => r + 1 < l.rowYs.length && top - c.bbox.y2 >= INSET_CLIP_MIN && c.bbox.y1 - l.rowYs[r + 1] >= INSET_CLIP_MIN)));
1087
1088
  }
1089
+ function dropHeadBandClipGrids(clipGrids, lineGrids) {
1090
+ if (clipGrids.length === 0 || lineGrids.length === 0) return clipGrids;
1091
+ const near = (a, b) => Math.abs(a - b) <= SHADE_CLIP_TOL;
1092
+ const overlaps = (a, b) => Math.min(a.x2, b.x2) > Math.max(a.x1, b.x1) && Math.min(a.y2, b.y2) > Math.max(a.y1, b.y1);
1093
+ return clipGrids.filter((c) => c.clipParent || !_optionalChain([c, 'access', _15 => _15.cells, 'optionalAccess', _16 => _16.length]) || !lineGrids.some((l) => l.rowYs.length > c.rowYs.length && l.colXs.length === c.colXs.length && c.colXs.every((x, k) => near(x, l.colXs[k])) && c.rowYs.every((y, k) => near(y, l.rowYs[k])) && !clipGrids.some((o) => o !== c && overlaps(o.bbox, l.bbox))));
1094
+ }
1088
1095
  function enforceMinWidth(colXs, minWidth) {
1089
1096
  if (colXs.length <= 2) return colXs;
1090
1097
  const result = [colXs[0]];
@@ -1427,7 +1434,7 @@ function buildClipCellGrids(rects, strokedH, strokedV, pageWidth, pageHeight, te
1427
1434
  for (let dx = -1; dx <= 1 && !duplicate; dx++) {
1428
1435
  const ys2 = buckets.get(bx + dx);
1429
1436
  for (let dy = -1; dy <= 1 && !duplicate; dy++) {
1430
- duplicate = _nullishCoalesce(_optionalChain([ys2, 'optionalAccess', _15 => _15.get, 'call', _16 => _16(by + dy), 'optionalAccess', _17 => _17.some, 'call', _18 => _18((c) => sameRect(c, r))]), () => ( false));
1437
+ duplicate = _nullishCoalesce(_optionalChain([ys2, 'optionalAccess', _17 => _17.get, 'call', _18 => _18(by + dy), 'optionalAccess', _19 => _19.some, 'call', _20 => _20((c) => sameRect(c, r))]), () => ( false));
1431
1438
  }
1432
1439
  }
1433
1440
  if (duplicate) continue;
@@ -1544,7 +1551,7 @@ function buildClipCellGrids(rects, strokedH, strokedV, pageWidth, pageHeight, te
1544
1551
  else groups.set(r, [i]);
1545
1552
  }
1546
1553
  const containers = cells.filter((_, i) => isContainer[i]);
1547
- const groupSize = (i) => _nullishCoalesce(_optionalChain([groups, 'access', _19 => _19.get, 'call', _20 => _20(find(i)), 'optionalAccess', _21 => _21.length]), () => ( 0));
1554
+ const groupSize = (i) => _nullishCoalesce(_optionalChain([groups, 'access', _21 => _21.get, 'call', _22 => _22(find(i)), 'optionalAccess', _23 => _23.length]), () => ( 0));
1548
1555
  const isGridMember = (i) => groupSize(i) >= CLIP_MIN_GROUP;
1549
1556
  const framed = (r) => edgeStroked(strokedH, "h", r.y1, r.x1, r.x2) && edgeStroked(strokedH, "h", r.y2, r.x1, r.x2) && edgeStroked(strokedV, "v", r.x1, r.y1, r.y2) && edgeStroked(strokedV, "v", r.x2, r.y1, r.y2);
1550
1557
  const titledFrame = (r) => r.y1 >= pageHeight * TITLED_FRAME_MIN_TOP && r.x2 - r.x1 >= pageWidth * TITLED_FRAME_MIN_WIDTH && textPoints.some((p) => p.y < r.y1 && p.y > pageHeight * HEADER_BAND && p.x >= r.x1 - CLIP_EDGE_TOL && p.x <= r.x2 + CLIP_EDGE_TOL) && textPoints.some((p) => p.x > r.x1 && p.x < r.x2 && p.y > r.y1 && p.y < r.y2);
@@ -1921,6 +1928,60 @@ function hasHorizontalLine(horizontals, y, leftX, rightX, vertexRadius) {
1921
1928
  return false;
1922
1929
  }
1923
1930
 
1931
+ // src/pdf/script-items.ts
1932
+ function scriptKindsOfLine(sorted) {
1933
+ const kinds = sorted.map(() => null);
1934
+ if (sorted.length < 2) return kinds;
1935
+ const weight = /* @__PURE__ */ new Map();
1936
+ for (const it of sorted) {
1937
+ const k = Math.round(it.fontSize * 2) / 2;
1938
+ weight.set(k, (_nullishCoalesce(weight.get(k), () => ( 0))) + it.text.trim().length);
1939
+ }
1940
+ let bodyFs = 0, best = -1;
1941
+ for (const [fs, n] of weight) if (n > best || n === best && fs > bodyFs) {
1942
+ best = n;
1943
+ bodyFs = fs;
1944
+ }
1945
+ if (bodyFs <= 0) return kinds;
1946
+ const ys = sorted.filter((it) => Math.abs(it.fontSize - bodyFs) <= bodyFs * 0.12).map((it) => it.y).sort((a, b) => a - b);
1947
+ const bodyY = ys[ys.length >> 1];
1948
+ const isBody = (it) => it.fontSize > bodyFs * 0.85;
1949
+ for (let i = 1; i < sorted.length; i++) {
1950
+ const it = sorted[i], prev = sorted[i - 1];
1951
+ const t = it.text.trim();
1952
+ if (!t || t.length > 16 || isBody(it)) continue;
1953
+ if (!isBody(prev) && !kinds[i - 1]) continue;
1954
+ const gap = it.x - (prev.x + prev.w);
1955
+ if (gap > bodyFs * 0.35 || gap < -bodyFs * 0.5) continue;
1956
+ const dy = it.y - bodyY;
1957
+ if (dy >= bodyFs * 0.15) kinds[i] = "sup";
1958
+ else if (dy <= -bodyFs * 0.08) kinds[i] = "sub";
1959
+ }
1960
+ return kinds;
1961
+ }
1962
+ function tagScripts(text, lines) {
1963
+ const marks = [];
1964
+ let cursor = 0;
1965
+ for (const line of lines) {
1966
+ const kinds = scriptKindsOfLine(line);
1967
+ for (let k = 0; k < line.length; k++) {
1968
+ const t = line[k].text;
1969
+ if (!t) continue;
1970
+ const at = text.indexOf(t, cursor);
1971
+ if (at < 0 || /\S/.test(text.slice(cursor, at))) return text;
1972
+ if (kinds[k]) marks.push([at, at + t.length, kinds[k]]);
1973
+ cursor = at + t.length;
1974
+ }
1975
+ }
1976
+ if (!marks.length) return text;
1977
+ let out = text;
1978
+ for (let m = marks.length - 1; m >= 0; m--) {
1979
+ const [s, e, kind] = marks[m];
1980
+ out = out.slice(0, s) + `<${kind}>` + out.slice(s, e) + `</${kind}>` + out.slice(e);
1981
+ }
1982
+ return _chunk62W7QCEXcjs.tidyScriptTags.call(void 0, out);
1983
+ }
1984
+
1924
1985
  // src/pdf/line-wrap.ts
1925
1986
  var MARKUP = /<\/?u>|~~/g;
1926
1987
  var bump = (m, k) => {
@@ -1970,12 +2031,19 @@ var WrapLexicon = (_class = class {constructor() { _class.prototype.__init.call(
1970
2031
  joinedWord(left, right) {
1971
2032
  return this.isWord(left + right) && !this.pairs.has(left + " " + right);
1972
2033
  }
2034
+ /** 두 글자+두 글자 증거만 — 한 글자 쌍으로 물러서지 않는다 (표 칸 조각처럼 줄 꺾임이 아닌 자리에 쓸 때) */
2035
+ evidence2(left, right) {
2036
+ const n = left.length;
2037
+ if (n < 2 || right.length < 2) return null;
2038
+ const k1 = pairKey(left.charCodeAt(n - 2), left.charCodeAt(n - 1)), k2 = pairKey(right.charCodeAt(0), right.charCodeAt(1));
2039
+ return decideCounts(_nullishCoalesce(_optionalChain([this, 'access', _24 => _24.joined2, 'access', _25 => _25.get, 'call', _26 => _26(k1), 'optionalAccess', _27 => _27.get, 'call', _28 => _28(k2)]), () => ( 0)), _nullishCoalesce(_optionalChain([this, 'access', _29 => _29.spaced2, 'access', _30 => _30.get, 'call', _31 => _31(k1), 'optionalAccess', _32 => _32.get, 'call', _33 => _33(k2)]), () => ( 0)));
2040
+ }
1973
2041
  /** 꺾인 자리 증거: "" 붙음 · " " 띄움 · null 모름 (두 글자 증거가 갈리거나 없으면 한 글자) */
1974
2042
  evidence(left, right) {
1975
2043
  const n = left.length;
1976
2044
  if (n >= 2 && right.length >= 2) {
1977
2045
  const k1 = pairKey(left.charCodeAt(n - 2), left.charCodeAt(n - 1)), k2 = pairKey(right.charCodeAt(0), right.charCodeAt(1));
1978
- const v = decideCounts(_nullishCoalesce(_optionalChain([this, 'access', _22 => _22.joined2, 'access', _23 => _23.get, 'call', _24 => _24(k1), 'optionalAccess', _25 => _25.get, 'call', _26 => _26(k2)]), () => ( 0)), _nullishCoalesce(_optionalChain([this, 'access', _27 => _27.spaced2, 'access', _28 => _28.get, 'call', _29 => _29(k1), 'optionalAccess', _30 => _30.get, 'call', _31 => _31(k2)]), () => ( 0)));
2046
+ const v = decideCounts(_nullishCoalesce(_optionalChain([this, 'access', _34 => _34.joined2, 'access', _35 => _35.get, 'call', _36 => _36(k1), 'optionalAccess', _37 => _37.get, 'call', _38 => _38(k2)]), () => ( 0)), _nullishCoalesce(_optionalChain([this, 'access', _39 => _39.spaced2, 'access', _40 => _40.get, 'call', _41 => _41(k1), 'optionalAccess', _42 => _42.get, 'call', _43 => _43(k2)]), () => ( 0)));
1979
2047
  if (v !== null) return v;
1980
2048
  }
1981
2049
  if (n && right.length) {
@@ -2047,11 +2115,11 @@ function wrapJoiner(prevText, nextText, lex) {
2047
2115
  if (particleContinues(left, right)) return "";
2048
2116
  if (endsAsWord(left)) return " ";
2049
2117
  if (/[A-Za-z]-$/.test(left) && /^[A-Za-z]/.test(right) && !/[가-힣]/.test(prev + next)) {
2050
- return _optionalChain([lex, 'optionalAccess', _32 => _32.joinedWord, 'call', _33 => _33(left, right.replace(/[.,;:!?)]*$/, ""))]) ? "" : " ";
2118
+ return _optionalChain([lex, 'optionalAccess', _44 => _44.joinedWord, 'call', _45 => _45(left, right.replace(/[.,;:!?)]*$/, ""))]) ? "" : " ";
2051
2119
  }
2052
2120
  if (/[·ㆍ‧-]/.test(a) && !/[·ㆍ‧…]{2}$/.test(prev) && /[가-힣A-Za-z0-9]/.test(b)) return "";
2053
2121
  if (/[A-Za-z]/.test(a) && /[A-Za-z]/.test(b) || /\d/.test(a) && /\d/.test(b)) return " ";
2054
- const ev = _optionalChain([lex, 'optionalAccess', _34 => _34.evidence, 'call', _35 => _35(left, right)]);
2122
+ const ev = _optionalChain([lex, 'optionalAccess', _46 => _46.evidence, 'call', _47 => _47(left, right)]);
2055
2123
  if (ev != null) return ev;
2056
2124
  if (lex && /[가-힣A-Za-z0-9]$/.test(left) && /^[가-힣A-Za-z0-9]/.test(right) && lex.joinedWord(left, right.replace(/[.,)」』’”;:]+$/, ""))) return "";
2057
2125
  if (/\d$/.test(left) && COUNTER.test(right)) return "";
@@ -2073,7 +2141,7 @@ function joinPageBreakWraps(blocks, lex) {
2073
2141
  if (a.type !== "paragraph" && a.type !== "list" || b.type !== "paragraph") continue;
2074
2142
  const last = a.bbox && PARA_LAST_LINE.get(a.bbox), fs = last ? last.fontSize : 0;
2075
2143
  if (!last || fs <= 0 || (_nullishCoalesce(pageRight.get(a.pageNumber), () => ( Infinity))) - last.right >= BODY_FULL_TOL * fs) continue;
2076
- if (last.width < BODY_MIN_WIDTH_EM * fs || Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _36 => _36.style, 'optionalAccess', _37 => _37.fontSize]), () => ( 0))) - fs) > 0.15 * fs) continue;
2144
+ if (last.width < BODY_MIN_WIDTH_EM * fs || Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _48 => _48.style, 'optionalAccess', _49 => _49.fontSize]), () => ( 0))) - fs) > 0.15 * fs) continue;
2077
2145
  if (startsNewItem(a.text, b.text)) continue;
2078
2146
  a.text += wrapJoiner(a.text, b.text, lex) + b.text;
2079
2147
  const bl = b.bbox && PARA_LAST_LINE.get(b.bbox);
@@ -2128,6 +2196,7 @@ function cellLineFills(box, contentLeft, cellRight, lineRight, fontSize) {
2128
2196
  }
2129
2197
 
2130
2198
  // src/pdf/cell-text.ts
2199
+ var REGION_LABELS = /* @__PURE__ */ new Set(["\uC11C\uC6B8", "\uBD80\uC0B0", "\uB300\uAD6C", "\uC778\uCC9C", "\uAD11\uC8FC", "\uB300\uC804", "\uC6B8\uC0B0", "\uC138\uC885", "\uACBD\uAE30", "\uAC15\uC6D0", "\uCDA9\uBD81", "\uCDA9\uB0A8", "\uC804\uBD81", "\uC804\uB0A8", "\uACBD\uBD81", "\uACBD\uB0A8", "\uC81C\uC8FC", "\uC804\uAD6D"]);
2131
2200
  var CELL_PADDING = 2;
2132
2201
  var SPACE_GAP_RATIO = 0.17;
2133
2202
  function spaceGapThreshold(fontSize) {
@@ -2222,8 +2291,8 @@ function cellTextToString(items, wrap) {
2222
2291
  const textLines = merged.map((line) => {
2223
2292
  const s = sortLineByX(line);
2224
2293
  if (s.length === 1) return s[0].text;
2225
- if (s.length === 2 && /^[가-힣]$/.test(s[0].text) && /^[가-힣]$/.test(s[1].text) && !!_optionalChain([wrap, 'optionalAccess', _38 => _38.lex]) && (wrap.lex.isWord(s[0].text + s[1].text) || wrap.lex.evidence(s[0].text, s[1].text) === "") && s[1].x - (s[0].x + s[0].w) >= Math.max(s[0].fontSize, s[1].fontSize) * 1.5 && s[1].x + s[1].w - s[0].x >= wrap.box.x2 - wrap.box.x1 - Math.max(s[0].fontSize, s[1].fontSize) * 2) return s[0].text + s[1].text;
2226
- const evenSpaced = detectEvenSpacedItems(s);
2294
+ if (s.length === 2 && /^[가-힣]$/.test(s[0].text) && /^[가-힣]$/.test(s[1].text) && !!_optionalChain([wrap, 'optionalAccess', _50 => _50.lex]) && (wrap.lex.isWord(s[0].text + s[1].text) || wrap.lex.evidence(s[0].text, s[1].text) === "" || REGION_LABELS.has(s[0].text + s[1].text)) && s[1].x - (s[0].x + s[0].w) >= Math.max(s[0].fontSize, s[1].fontSize) * 1.5 && s[1].x + s[1].w - s[0].x >= wrap.box.x2 - wrap.box.x1 - Math.max(s[0].fontSize, s[1].fontSize) * 2) return s[0].text + s[1].text;
2295
+ const evenSpaced = detectEvenSpacedItems(s, true);
2227
2296
  let result = s[0].text;
2228
2297
  for (let j = 1; j < s.length; j++) {
2229
2298
  if (evenSpaced[j]) {
@@ -2244,7 +2313,8 @@ function cellTextToString(items, wrap) {
2244
2313
  }
2245
2314
  return result;
2246
2315
  });
2247
- if (!wrap) return mergeCellTextLines(textLines);
2316
+ const scripted = (s) => tagScripts(s, merged.map((l) => sortLineByX([...l])));
2317
+ if (!wrap) return scripted(mergeCellTextLines(textLines));
2248
2318
  let contentLeft = Infinity;
2249
2319
  for (const it of items) if (it.x < contentLeft) contentLeft = it.x;
2250
2320
  const lineEnds = merged.map((line) => {
@@ -2257,7 +2327,7 @@ function cellTextToString(items, wrap) {
2257
2327
  let cellRight = -Infinity;
2258
2328
  for (const e of lineEnds) if (e.right > cellRight) cellRight = e.right;
2259
2329
  const wraps = lineEnds.slice(0, -1).map((a, i) => cellLineWraps(wrap.box, contentLeft, a.right, a.fontSize, lineEnds[i + 1].firstCharW) || lineEnds.length >= 3 && !textLines[i + 1].startsWith("(") && cellLineFills(wrap.box, contentLeft, cellRight, a.right, a.fontSize));
2260
- return mergeCellTextLines(textLines, { wraps, lex: wrap.lex });
2330
+ return scripted(mergeCellTextLines(textLines, { wraps, lex: wrap.lex }));
2261
2331
  }
2262
2332
  function mergeSuperscriptRows(lines) {
2263
2333
  if (lines.length <= 1) return lines;
@@ -2293,9 +2363,13 @@ function mergeSuperscriptRows(lines) {
2293
2363
  }
2294
2364
  return result;
2295
2365
  }
2296
- function detectEvenSpacedItems(items) {
2366
+ function detectEvenSpacedItems(items, cellLine = false) {
2297
2367
  const result = new Array(items.length).fill(false);
2298
2368
  if (items.length < 3) return result;
2369
+ if (cellLine && items.every((it) => /^[가-힣]$/.test(it.text)) && items.slice(1).every((it) => !it.hasSpaceBefore || it.syntheticSpace) && items.slice(1).every((it, k) => it.x - (items[k].x + items[k].w) >= it.fontSize * 0.1)) {
2370
+ markEvenRun(items, result, 0, items.length);
2371
+ if (result.some(Boolean)) return result;
2372
+ }
2299
2373
  let runStart = -1;
2300
2374
  for (let i = 0; i < items.length; i++) {
2301
2375
  const isShortKorean = /^[가-힣]{1}$/.test(items[i].text) || /^[\d]{1}$/.test(items[i].text);
@@ -2364,7 +2438,7 @@ function mergeCellTextLines(textLines, wrap) {
2364
2438
  merged[merged.length - 1] = prev + curr.trim();
2365
2439
  } else if (!wrap && /[,(]$/.test(prev.trim()) && curr.trim().length <= 15) {
2366
2440
  merged[merged.length - 1] = prev + curr.trim();
2367
- } else if (/[\d,]$/.test(prev) && /^[\d,]+[)\]]?$/.test(curr.trim()) && curr.trim().length <= 10 && !(/\d,\d{3}$/.test(prev) && /^\d/.test(curr.trim())) && !(/(?:^|[^\d,])\d{1,3}$/.test(prev) && /^(\d{1,3}(,\d{3})+|\d{1,3})$/.test(curr.trim()) && !_optionalChain([wrap, 'optionalAccess', _39 => _39.wraps, 'access', _40 => _40[i - 1]])) && !(/(?:^|\s)\d{1,7}$/.test(prev) && /^\d{1,7}$/.test(curr.trim()) && !_optionalChain([wrap, 'optionalAccess', _41 => _41.wraps, 'access', _42 => _42[i - 1]]))) {
2441
+ } else if (/[\d,]$/.test(prev) && /^[\d,]+[)\]]?$/.test(curr.trim()) && curr.trim().length <= 10 && !(/\d,\d{3}$/.test(prev) && /^\d/.test(curr.trim())) && !(/(?:^|[^\d,])\d{1,3}$/.test(prev) && /^(\d{1,3}(,\d{3})+|\d{1,3})$/.test(curr.trim()) && !_optionalChain([wrap, 'optionalAccess', _51 => _51.wraps, 'access', _52 => _52[i - 1]])) && !(/(?:^|\s)\d{1,7}$/.test(prev) && /^\d{1,7}$/.test(curr.trim()) && !_optionalChain([wrap, 'optionalAccess', _53 => _53.wraps, 'access', _54 => _54[i - 1]]))) {
2368
2442
  merged[merged.length - 1] = prev + curr.trim();
2369
2443
  } else {
2370
2444
  merged.push(curr);
@@ -2434,7 +2508,7 @@ function normalizeUndersegmentedTable(originalCells, colXs, items, rowYs) {
2434
2508
  if (numRows > MAX_UNDERSEGMENTED_ROWS || numCols < MIN_UNDERSEGMENTED_COLUMNS) return null;
2435
2509
  if (items.length === 0) return null;
2436
2510
  if (numRows >= 3) {
2437
- if (_optionalChain([rowYs, 'optionalAccess', _43 => _43.length]) !== numRows + 1) return null;
2511
+ if (_optionalChain([rowYs, 'optionalAccess', _55 => _55.length]) !== numRows + 1) return null;
2438
2512
  const rebuilt2 = [];
2439
2513
  let expanded = 0;
2440
2514
  for (let r = 0; r < numRows; r++) {
@@ -2581,7 +2655,7 @@ function dominantStyle(items) {
2581
2655
  let maxCount = 0, dominantSize = 0;
2582
2656
  for (const i of items) {
2583
2657
  if (i.fontSize <= 0) continue;
2584
- const count = (freq.get(i.fontSize) || 0) + Math.max(1, _nullishCoalesce(_optionalChain([i, 'access', _44 => _44.text, 'access', _45 => _45.match, 'call', _46 => _46(/[\p{L}\p{N}]/gu), 'optionalAccess', _47 => _47.length]), () => ( 0)));
2658
+ const count = (freq.get(i.fontSize) || 0) + Math.max(1, _nullishCoalesce(_optionalChain([i, 'access', _56 => _56.text, 'access', _57 => _57.match, 'call', _58 => _58(/[\p{L}\p{N}]/gu), 'optionalAccess', _59 => _59.length]), () => ( 0)));
2585
2659
  freq.set(i.fontSize, count);
2586
2660
  if (count > maxCount) {
2587
2661
  maxCount = count;
@@ -2589,7 +2663,7 @@ function dominantStyle(items) {
2589
2663
  }
2590
2664
  }
2591
2665
  if (dominantSize === 0) return void 0;
2592
- const fontName = _optionalChain([items, 'access', _48 => _48.find, 'call', _49 => _49((i) => i.fontSize === dominantSize), 'optionalAccess', _50 => _50.fontName]) || void 0;
2666
+ const fontName = _optionalChain([items, 'access', _60 => _60.find, 'call', _61 => _61((i) => i.fontSize === dominantSize), 'optionalAccess', _62 => _62.fontName]) || void 0;
2593
2667
  return fontName ? { fontSize: dominantSize, fontName } : { fontSize: dominantSize };
2594
2668
  }
2595
2669
  function normalizeItems(rawItems) {
@@ -2602,7 +2676,7 @@ function normalizeItems(rawItems) {
2602
2676
  const x = Math.round(i.transform[4]);
2603
2677
  const y = Math.round(i.transform[5]);
2604
2678
  if (!i.str.trim()) {
2605
- spacePositions.push({ x, y });
2679
+ spacePositions.push({ x, y, synthetic: i.synthetic });
2606
2680
  continue;
2607
2681
  }
2608
2682
  const scaleX = Math.hypot(i.transform[0], i.transform[1]);
@@ -2658,7 +2732,10 @@ function normalizeItems(rawItems) {
2658
2732
  nearest = item;
2659
2733
  }
2660
2734
  }
2661
- if (nearest) nearest.hasSpaceBefore = true;
2735
+ if (nearest) {
2736
+ nearest.syntheticSpace = (nearest.hasSpaceBefore ? nearest.syntheticSpace === true : true) && sp.synthetic === true;
2737
+ nearest.hasSpaceBefore = true;
2738
+ }
2662
2739
  }
2663
2740
  }
2664
2741
  return deduped;
@@ -2706,7 +2783,7 @@ function splitAroundOverlays(c, overlays) {
2706
2783
  const ov = overlays.filter((o) => {
2707
2784
  for (let at = c.text.indexOf(o.text); at >= 0; at = c.text.indexOf(o.text, at + 1)) {
2708
2785
  const prefix = c.text.slice(0, at);
2709
- const est = c.x + glyphUnits(prefix.replace(/\s+/g, "")) * a0 + (_nullishCoalesce(_optionalChain([prefix, 'access', _51 => _51.match, 'call', _52 => _52(/\s+/g), 'optionalAccess', _53 => _53.length]), () => ( 0))) * ws;
2786
+ const est = c.x + glyphUnits(prefix.replace(/\s+/g, "")) * a0 + (_nullishCoalesce(_optionalChain([prefix, 'access', _63 => _63.match, 'call', _64 => _64(/\s+/g), 'optionalAccess', _65 => _65.length]), () => ( 0))) * ws;
2710
2787
  if (Math.abs(est - o.x) <= OVERLAY_DUP_EM * fs) return false;
2711
2788
  }
2712
2789
  return true;
@@ -2801,6 +2878,13 @@ function mergeSuperscriptLines(lines) {
2801
2878
  for (const i of line) total += i.text.trim().length;
2802
2879
  return total > 0 && total <= 10;
2803
2880
  };
2881
+ const isMarkers = (line, host) => line.length > 1 && line.length <= 16 && line.every((i) => {
2882
+ if (i.text.trim().length > 3 || !i.text.trim()) return false;
2883
+ return host.some((h) => {
2884
+ const g = i.x - (h.x + h.w);
2885
+ return g <= h.fontSize * 0.35 && g >= -h.fontSize * 0.1;
2886
+ });
2887
+ });
2804
2888
  const result = [lines[0]];
2805
2889
  for (let i = 1; i < lines.length; i++) {
2806
2890
  const prev = result[result.length - 1];
@@ -2808,8 +2892,8 @@ function mergeSuperscriptLines(lines) {
2808
2892
  const a = band(prev);
2809
2893
  const b = band(curr);
2810
2894
  const overlap2 = Math.min(a.top, b.top) - Math.max(a.bottom, b.bottom);
2811
- const prevIsFrag = isFrag(prev) && a.height <= b.height * 0.8 && overlap2 >= a.height * 0.5;
2812
- const currIsFrag = isFrag(curr) && b.height <= a.height * 0.8 && overlap2 >= b.height * 0.5;
2895
+ const prevIsFrag = (isFrag(prev) || isMarkers(prev, curr)) && a.height <= b.height * 0.8 && overlap2 >= a.height * 0.5;
2896
+ const currIsFrag = (isFrag(curr) || isMarkers(curr, prev)) && b.height <= a.height * 0.8 && overlap2 >= b.height * 0.5;
2813
2897
  if (prevIsFrag || currIsFrag) {
2814
2898
  result[result.length - 1] = [...prev, ...curr];
2815
2899
  } else {
@@ -2819,7 +2903,7 @@ function mergeSuperscriptLines(lines) {
2819
2903
  return result;
2820
2904
  }
2821
2905
  function mergeLineSimple(items) {
2822
- if (items.length <= 1) return _optionalChain([items, 'access', _54 => _54[0], 'optionalAccess', _55 => _55.text]) || "";
2906
+ if (items.length <= 1) return _optionalChain([items, 'access', _66 => _66[0], 'optionalAccess', _67 => _67.text]) || "";
2823
2907
  const sorted = sortLineByX([...items]);
2824
2908
  const isEvenSpaced = detectEvenSpacedItems(sorted);
2825
2909
  let result = sorted[0].text;
@@ -2964,7 +3048,7 @@ function splitTrailingColumnRegion(items) {
2964
3048
  }
2965
3049
  function panelBlocks(items, panel, pageNum) {
2966
3050
  const lines = groupByY([...items].sort((a, b) => b.y - a.y || a.x - b.x));
2967
- const faceOf = (line) => _nullishCoalesce(_optionalChain([dominantStyle, 'call', _56 => _56(line), 'optionalAccess', _57 => _57.fontName]), () => ( ""));
3051
+ const faceOf = (line) => _nullishCoalesce(_optionalChain([dominantStyle, 'call', _68 => _68(line), 'optionalAccess', _69 => _69.fontName]), () => ( ""));
2968
3052
  const runs = [];
2969
3053
  for (const line of lines) {
2970
3054
  const last = runs[runs.length - 1];
@@ -2994,7 +3078,7 @@ function pushLineParagraphs(out, yLines, pageNum, lex) {
2994
3078
  const lines = attachDropCaps(yLines).map((items) => ({ items, text: mergeLineSimple(items) })).filter((l) => l.text.trim());
2995
3079
  const geo = lines.map((l) => {
2996
3080
  const b = computeBBox(l.items, pageNum);
2997
- return { text: l.text, left: b.x, right: b.x + b.width, y: l.items.reduce((s, i) => s + i.y, 0) / l.items.length, fontSize: _nullishCoalesce(_optionalChain([dominantStyle, 'call', _58 => _58(l.items), 'optionalAccess', _59 => _59.fontSize]), () => ( 0)) };
3081
+ return { text: l.text, left: b.x, right: b.x + b.width, y: l.items.reduce((s, i) => s + i.y, 0) / l.items.length, fontSize: _nullishCoalesce(_optionalChain([dominantStyle, 'call', _70 => _70(l.items), 'optionalAccess', _71 => _71.fontSize]), () => ( 0)) };
2998
3082
  });
2999
3083
  const joins = bodyLineJoins(geo, lex);
3000
3084
  for (let i = 0; i + 1 < geo.length; i++) {
@@ -3007,10 +3091,13 @@ function pushLineParagraphs(out, yLines, pageNum, lex) {
3007
3091
  for (let i = 0; i < lines.length; ) {
3008
3092
  let text = lines[i].text;
3009
3093
  const items = [...lines[i].items];
3094
+ const srcLines = [lines[i].items];
3010
3095
  for (; i + 1 < lines.length && joins[i] !== "\n"; i++) {
3011
3096
  text += joins[i] + lines[i + 1].text;
3012
3097
  items.push(...lines[i + 1].items);
3098
+ srcLines.push(lines[i + 1].items);
3013
3099
  }
3100
+ text = tagScripts(text, srcLines.map((l) => sortLineByX([...l])));
3014
3101
  const block = { type: "paragraph", text, pageNumber: pageNum, bbox: computeBBox(items, pageNum), style: dominantStyle(items) };
3015
3102
  const faces = /* @__PURE__ */ new Map();
3016
3103
  for (const it of items) faces.set(it.fontName, (_nullishCoalesce(faces.get(it.fontName), () => ( 0))) + it.text.length);
@@ -3038,15 +3125,15 @@ function computeMedianFontSizeFromFreq(freq) {
3038
3125
  function detectHeadings(blocks, medianFontSize) {
3039
3126
  for (let bi = 0; bi < blocks.length; bi++) {
3040
3127
  const block = blocks[bi];
3041
- if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _60 => _60.style, 'optionalAccess', _61 => _61.fontSize])) continue;
3128
+ if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _72 => _72.style, 'optionalAccess', _73 => _73.fontSize])) continue;
3042
3129
  const text = block.text.trim();
3043
3130
  if (text.length === 0 || text.length > 200) continue;
3044
3131
  if (/^\d+$/.test(text) && !isChapterNumber(block, blocks[bi + 1], medianFontSize)) continue;
3045
3132
  const ratio = block.style.fontSize / medianFontSize;
3046
3133
  let level = 0;
3047
- if (ratio >= _chunkZY5K3LPMcjs.HEADING_RATIO_H1) level = 1;
3048
- else if (ratio >= _chunkZY5K3LPMcjs.HEADING_RATIO_H2) level = 2;
3049
- else if (ratio >= _chunkZY5K3LPMcjs.HEADING_RATIO_H3) level = 3;
3134
+ if (ratio >= _chunk62W7QCEXcjs.HEADING_RATIO_H1) level = 1;
3135
+ else if (ratio >= _chunk62W7QCEXcjs.HEADING_RATIO_H2) level = 2;
3136
+ else if (ratio >= _chunk62W7QCEXcjs.HEADING_RATIO_H3) level = 3;
3050
3137
  if (level > 0) {
3051
3138
  block.type = "heading";
3052
3139
  block.level = level;
@@ -3055,21 +3142,21 @@ function detectHeadings(blocks, medianFontSize) {
3055
3142
  }
3056
3143
  }
3057
3144
  function isChapterNumber(block, next, medianFontSize) {
3058
- const size = _nullishCoalesce(_optionalChain([block, 'access', _62 => _62.style, 'optionalAccess', _63 => _63.fontSize]), () => ( 0));
3059
- const nextSize = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _64 => _64.style, 'optionalAccess', _65 => _65.fontSize]), () => ( 0));
3060
- const text = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _66 => _66.text, 'optionalAccess', _67 => _67.trim, 'call', _68 => _68()]), () => ( ""));
3061
- const a = block.bbox, b = _optionalChain([next, 'optionalAccess', _69 => _69.bbox]);
3062
- return /^\d{1,2}$/.test(_nullishCoalesce(_optionalChain([block, 'access', _70 => _70.text, 'optionalAccess', _71 => _71.trim, 'call', _72 => _72()]), () => ( ""))) && size >= medianFontSize * 2.5 && !!next && (next.type === "paragraph" || next.type === "heading") && next.pageNumber === block.pageNumber && nextSize >= medianFontSize * _chunkZY5K3LPMcjs.HEADING_RATIO_H1 && text.length > 0 && text.length <= 80 && !/^[\d\s.]+$/.test(text) && !!a && !!b && a.y > b.y && a.y - (b.y + b.height) <= size * 2;
3145
+ const size = _nullishCoalesce(_optionalChain([block, 'access', _74 => _74.style, 'optionalAccess', _75 => _75.fontSize]), () => ( 0));
3146
+ const nextSize = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _76 => _76.style, 'optionalAccess', _77 => _77.fontSize]), () => ( 0));
3147
+ const text = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _78 => _78.text, 'optionalAccess', _79 => _79.trim, 'call', _80 => _80()]), () => ( ""));
3148
+ const a = block.bbox, b = _optionalChain([next, 'optionalAccess', _81 => _81.bbox]);
3149
+ return /^\d{1,2}$/.test(_nullishCoalesce(_optionalChain([block, 'access', _82 => _82.text, 'optionalAccess', _83 => _83.trim, 'call', _84 => _84()]), () => ( ""))) && size >= medianFontSize * 2.5 && !!next && (next.type === "paragraph" || next.type === "heading") && next.pageNumber === block.pageNumber && nextSize >= medianFontSize * _chunk62W7QCEXcjs.HEADING_RATIO_H1 && text.length > 0 && text.length <= 80 && !/^[\d\s.]+$/.test(text) && !!a && !!b && a.y > b.y && a.y - (b.y + b.height) <= size * 2;
3063
3150
  }
3064
3151
  function mergeStackedHeadingLines(blocks, medianFontSize) {
3065
3152
  for (let i = 0; i < blocks.length - 1; ) {
3066
3153
  const a = blocks[i], b = blocks[i + 1];
3067
3154
  const ab = a.bbox, bb = b.bbox;
3068
- const af = _nullishCoalesce(_optionalChain([a, 'access', _73 => _73.style, 'optionalAccess', _74 => _74.fontSize]), () => ( 0)), bf = _nullishCoalesce(_optionalChain([b, 'access', _75 => _75.style, 'optionalAccess', _76 => _76.fontSize]), () => ( 0));
3155
+ const af = _nullishCoalesce(_optionalChain([a, 'access', _85 => _85.style, 'optionalAccess', _86 => _86.fontSize]), () => ( 0)), bf = _nullishCoalesce(_optionalChain([b, 'access', _87 => _87.style, 'optionalAccess', _88 => _88.fontSize]), () => ( 0));
3069
3156
  const gap = ab && bb ? ab.y - (bb.y + bb.height) : Infinity;
3070
- const centered = ab && bb && _optionalChain([a, 'access', _77 => _77.style, 'optionalAccess', _78 => _78.fontName]) === _optionalChain([b, 'access', _79 => _79.style, 'optionalAccess', _80 => _80.fontName]) && Math.abs(ab.x + ab.width / 2 - (bb.x + bb.width / 2)) <= Math.max(5, af * 0.5);
3157
+ const centered = ab && bb && _optionalChain([a, 'access', _89 => _89.style, 'optionalAccess', _90 => _90.fontName]) === _optionalChain([b, 'access', _91 => _91.style, 'optionalAccess', _92 => _92.fontName]) && Math.abs(ab.x + ab.width / 2 - (bb.x + bb.width / 2)) <= Math.max(5, af * 0.5);
3071
3158
  const sameAnchor = ab && bb && Math.abs(ab.x - bb.x) <= 5;
3072
- const wrapped = sameAnchor && _optionalChain([a, 'access', _81 => _81.style, 'optionalAccess', _82 => _82.fontName]) === _optionalChain([b, 'access', _83 => _83.style, 'optionalAccess', _84 => _84.fontName]) && af === bf && ab.width >= bb.width * 0.95 && (_nullishCoalesce(_optionalChain([a, 'access', _85 => _85.text, 'optionalAccess', _86 => _86.trim, 'call', _87 => _87(), 'access', _88 => _88.split, 'call', _89 => _89(/\s+/), 'access', _90 => _90.length]), () => ( 0))) >= 3;
3159
+ const wrapped = sameAnchor && _optionalChain([a, 'access', _93 => _93.style, 'optionalAccess', _94 => _94.fontName]) === _optionalChain([b, 'access', _95 => _95.style, 'optionalAccess', _96 => _96.fontName]) && af === bf && ab.width >= bb.width * 0.95 && (_nullishCoalesce(_optionalChain([a, 'access', _97 => _97.text, 'optionalAccess', _98 => _98.trim, 'call', _99 => _99(), 'access', _100 => _100.split, 'call', _101 => _101(/\s+/), 'access', _102 => _102.length]), () => ( 0))) >= 3;
3073
3160
  const displayStack = centered && gap <= Math.min(af, bf) * 0.3 && Math.max(af, bf) <= Math.min(af, bf) * 1.45;
3074
3161
  if (a.type !== "heading" || b.type !== "heading" || !a.text || !b.text || /^\d+$/.test(a.text.trim()) || !ab || !bb || ab.page !== bb.page || !(sameAnchor && af >= medianFontSize * 2 && bf >= medianFontSize * 2) && !wrapped && !(centered && af >= medianFontSize * 1.25 && bf >= medianFontSize * 1.25) || Math.abs(af - bf) > Math.max(af, bf) * 0.15 && !displayStack || gap < -2 || gap > Math.max(af, bf) * 0.45 || a.text.length > (centered ? 120 : 50) || b.text.length > (centered ? 120 : 50)) {
3075
3162
  i++;
@@ -3098,22 +3185,22 @@ function detectTypographyHeadings(blocks) {
3098
3185
  if (page.some((block) => block.type === "heading")) continue;
3099
3186
  const faceWeight = /* @__PURE__ */ new Map();
3100
3187
  for (const block of page) {
3101
- if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _91 => _91.style, 'optionalAccess', _92 => _92.fontName])) continue;
3188
+ if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _103 => _103.style, 'optionalAccess', _104 => _104.fontName])) continue;
3102
3189
  const face = block.style.fontName;
3103
3190
  faceWeight.set(face, (_nullishCoalesce(faceWeight.get(face), () => ( 0))) + block.text.length);
3104
3191
  }
3105
- const bodyFace = _optionalChain([[...faceWeight], 'access', _93 => _93.sort, 'call', _94 => _94((a, b) => b[1] - a[1]), 'access', _95 => _95[0], 'optionalAccess', _96 => _96[0]]);
3192
+ const bodyFace = _optionalChain([[...faceWeight], 'access', _105 => _105.sort, 'call', _106 => _106((a, b) => b[1] - a[1]), 'access', _107 => _107[0], 'optionalAccess', _108 => _108[0]]);
3106
3193
  if (!bodyFace || (_nullishCoalesce(faceWeight.get(bodyFace), () => ( 0))) < 250) continue;
3107
3194
  const sizeWeight = /* @__PURE__ */ new Map();
3108
3195
  for (const block of page) {
3109
- if (block.type !== "paragraph" || _optionalChain([block, 'access', _97 => _97.style, 'optionalAccess', _98 => _98.fontName]) !== bodyFace || !block.style.fontSize) continue;
3196
+ if (block.type !== "paragraph" || _optionalChain([block, 'access', _109 => _109.style, 'optionalAccess', _110 => _110.fontName]) !== bodyFace || !block.style.fontSize) continue;
3110
3197
  sizeWeight.set(block.style.fontSize, (_nullishCoalesce(sizeWeight.get(block.style.fontSize), () => ( 0))) + block.text.length);
3111
3198
  }
3112
- const bodySize = _nullishCoalesce(_optionalChain([[...sizeWeight], 'access', _99 => _99.sort, 'call', _100 => _100((a, b) => b[1] - a[1]), 'access', _101 => _101[0], 'optionalAccess', _102 => _102[0]]), () => ( 0));
3199
+ const bodySize = _nullishCoalesce(_optionalChain([[...sizeWeight], 'access', _111 => _111.sort, 'call', _112 => _112((a, b) => b[1] - a[1]), 'access', _113 => _113[0], 'optionalAccess', _114 => _114[0]]), () => ( 0));
3113
3200
  for (let i = 0; i < page.length; i++) {
3114
3201
  const block = page[i];
3115
3202
  const { text, bbox, style } = block;
3116
- if (block.type !== "paragraph" || !text || !bbox || !_optionalChain([style, 'optionalAccess', _103 => _103.fontName]) || !style.fontSize) continue;
3203
+ if (block.type !== "paragraph" || !text || !bbox || !_optionalChain([style, 'optionalAccess', _115 => _115.fontName]) || !style.fontSize) continue;
3117
3204
  const title = text.trim();
3118
3205
  const numbered = /^\d+(?:\.\d+)*\.?\s+[A-Z가-힣]/.test(title);
3119
3206
  const faces = FACE_CHARS.get(block);
@@ -3143,16 +3230,16 @@ function detectDocumentStyleHeadings(blocks) {
3143
3230
  for (const page of byPage.values()) {
3144
3231
  const faceChars = /* @__PURE__ */ new Map();
3145
3232
  for (const block of page) {
3146
- if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _104 => _104.style, 'optionalAccess', _105 => _105.fontName])) continue;
3233
+ if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _116 => _116.style, 'optionalAccess', _117 => _117.fontName])) continue;
3147
3234
  faceChars.set(block.style.fontName, (_nullishCoalesce(faceChars.get(block.style.fontName), () => ( 0))) + block.text.length);
3148
3235
  }
3149
- const bodyFace = _optionalChain([[...faceChars], 'access', _106 => _106.sort, 'call', _107 => _107((a, b) => b[1] - a[1]), 'access', _108 => _108[0], 'optionalAccess', _109 => _109[0]]);
3236
+ const bodyFace = _optionalChain([[...faceChars], 'access', _118 => _118.sort, 'call', _119 => _119((a, b) => b[1] - a[1]), 'access', _120 => _120[0], 'optionalAccess', _121 => _121[0]]);
3150
3237
  if (!bodyFace || (_nullishCoalesce(faceChars.get(bodyFace), () => ( 0))) < 100) continue;
3151
- const labels = page.filter((b) => b.type === "paragraph" && b.text && b.bbox && _optionalChain([b, 'access', _110 => _110.style, 'optionalAccess', _111 => _111.fontName]) && b.style.fontName !== bodyFace && b.text.trim().length >= 3 && b.text.trim().length <= 40);
3238
+ const labels = page.filter((b) => b.type === "paragraph" && b.text && b.bbox && _optionalChain([b, 'access', _122 => _122.style, 'optionalAccess', _123 => _123.fontName]) && b.style.fontName !== bodyFace && b.text.trim().length >= 3 && b.text.trim().length <= 40);
3152
3239
  for (const label of labels) {
3153
- const peers = labels.filter((b) => _optionalChain([b, 'access', _112 => _112.style, 'optionalAccess', _113 => _113.fontName]) === _optionalChain([label, 'access', _114 => _114.style, 'optionalAccess', _115 => _115.fontName]) && Math.abs(b.bbox.y - label.bbox.y) <= 3 && Math.abs(b.bbox.x - label.bbox.x) >= 60);
3240
+ const peers = labels.filter((b) => _optionalChain([b, 'access', _124 => _124.style, 'optionalAccess', _125 => _125.fontName]) === _optionalChain([label, 'access', _126 => _126.style, 'optionalAccess', _127 => _127.fontName]) && Math.abs(b.bbox.y - label.bbox.y) <= 3 && Math.abs(b.bbox.x - label.bbox.x) >= 60);
3154
3241
  if (peers.length < 2) continue;
3155
- const value = page.find((b) => b.type === "paragraph" && b.bbox && _optionalChain([b, 'access', _116 => _116.style, 'optionalAccess', _117 => _117.fontName]) !== _optionalChain([label, 'access', _118 => _118.style, 'optionalAccess', _119 => _119.fontName]) && b.bbox.x >= label.bbox.x - 5 && b.bbox.x <= label.bbox.x + 20 && b.bbox.y < label.bbox.y && label.bbox.y - (b.bbox.y + b.bbox.height) <= 60);
3242
+ const value = page.find((b) => b.type === "paragraph" && b.bbox && _optionalChain([b, 'access', _128 => _128.style, 'optionalAccess', _129 => _129.fontName]) !== _optionalChain([label, 'access', _130 => _130.style, 'optionalAccess', _131 => _131.fontName]) && b.bbox.x >= label.bbox.x - 5 && b.bbox.x <= label.bbox.x + 20 && b.bbox.y < label.bbox.y && label.bbox.y - (b.bbox.y + b.bbox.height) <= 60);
3156
3243
  if (value) {
3157
3244
  label.type = "heading";
3158
3245
  label.level = 2;
@@ -3161,7 +3248,7 @@ function detectDocumentStyleHeadings(blocks) {
3161
3248
  const first = page.find((b) => b.type !== "image" && b.type !== "separator");
3162
3249
  const second = page[page.indexOf(first) + 1];
3163
3250
  const third = page[page.indexOf(first) + 2];
3164
- if (!first || !second || !third || first.type !== "list" && first.type !== "paragraph" || second.type !== "paragraph" || !first.text || !second.text || !first.bbox || !second.bbox || !_optionalChain([first, 'access', _120 => _120.style, 'optionalAccess', _121 => _121.fontName]) || !_optionalChain([second, 'access', _122 => _122.style, 'optionalAccess', _123 => _123.fontName]) || !/^\d+(?:\.\d+)*\.\s+/.test(first.text.trim()) || first.style.fontName === bodyFace || second.style.fontName === bodyFace || first.text.length + second.text.length > 140 || Math.abs(first.bbox.x - second.bbox.x) > 30 || first.bbox.y - (second.bbox.y + second.bbox.height) > (_nullishCoalesce(first.style.fontSize, () => ( 0))) * 1.5 || _optionalChain([third, 'access', _124 => _124.style, 'optionalAccess', _125 => _125.fontName]) !== bodyFace) continue;
3251
+ if (!first || !second || !third || first.type !== "list" && first.type !== "paragraph" || second.type !== "paragraph" || !first.text || !second.text || !first.bbox || !second.bbox || !_optionalChain([first, 'access', _132 => _132.style, 'optionalAccess', _133 => _133.fontName]) || !_optionalChain([second, 'access', _134 => _134.style, 'optionalAccess', _135 => _135.fontName]) || !/^\d+(?:\.\d+)*\.\s+/.test(first.text.trim()) || first.style.fontName === bodyFace || second.style.fontName === bodyFace || first.text.length + second.text.length > 140 || Math.abs(first.bbox.x - second.bbox.x) > 30 || first.bbox.y - (second.bbox.y + second.bbox.height) > (_nullishCoalesce(first.style.fontSize, () => ( 0))) * 1.5 || _optionalChain([third, 'access', _136 => _136.style, 'optionalAccess', _137 => _137.fontName]) !== bodyFace) continue;
3165
3252
  first.type = "heading";
3166
3253
  first.level = 1;
3167
3254
  first.text = `${first.text.trim()} ${second.text.trim()}`;
@@ -3185,18 +3272,18 @@ function detectSiblingStyleHeadings(blocks) {
3185
3272
  for (const page of byPage.values()) {
3186
3273
  const bodyChars = /* @__PURE__ */ new Map();
3187
3274
  for (const block of page) {
3188
- if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _126 => _126.style, 'optionalAccess', _127 => _127.fontName])) continue;
3275
+ if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _138 => _138.style, 'optionalAccess', _139 => _139.fontName])) continue;
3189
3276
  const face = block.style.fontName;
3190
3277
  bodyChars.set(face, (_nullishCoalesce(bodyChars.get(face), () => ( 0))) + block.text.length);
3191
3278
  }
3192
- const bodyFace = _optionalChain([[...bodyChars], 'access', _128 => _128.sort, 'call', _129 => _129((a, b) => b[1] - a[1]), 'access', _130 => _130[0], 'optionalAccess', _131 => _131[0]]);
3193
- const anchors = page.filter((b) => b.type === "heading" && b.text && _optionalChain([b, 'access', _132 => _132.style, 'optionalAccess', _133 => _133.fontName]) && b.style.fontName !== bodyFace);
3279
+ const bodyFace = _optionalChain([[...bodyChars], 'access', _140 => _140.sort, 'call', _141 => _141((a, b) => b[1] - a[1]), 'access', _142 => _142[0], 'optionalAccess', _143 => _143[0]]);
3280
+ const anchors = page.filter((b) => b.type === "heading" && b.text && _optionalChain([b, 'access', _144 => _144.style, 'optionalAccess', _145 => _145.fontName]) && b.style.fontName !== bodyFace);
3194
3281
  for (const anchor of anchors) {
3195
3282
  const numbered = /^([A-Z])\.\d+\s+/.exec(anchor.text.trim());
3196
3283
  const lettered = /^([A-Z])\s+/.exec(anchor.text.trim());
3197
- const peers = anchors.filter((b) => _optionalChain([b, 'access', _134 => _134.style, 'optionalAccess', _135 => _135.fontName]) === _optionalChain([anchor, 'access', _136 => _136.style, 'optionalAccess', _137 => _137.fontName]) && Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _138 => _138.style, 'optionalAccess', _139 => _139.fontSize]), () => ( 0))) - (_nullishCoalesce(_optionalChain([anchor, 'access', _140 => _140.style, 'optionalAccess', _141 => _141.fontSize]), () => ( 0)))) < 0.5);
3284
+ const peers = anchors.filter((b) => _optionalChain([b, 'access', _146 => _146.style, 'optionalAccess', _147 => _147.fontName]) === _optionalChain([anchor, 'access', _148 => _148.style, 'optionalAccess', _149 => _149.fontName]) && Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _150 => _150.style, 'optionalAccess', _151 => _151.fontSize]), () => ( 0))) - (_nullishCoalesce(_optionalChain([anchor, 'access', _152 => _152.style, 'optionalAccess', _153 => _153.fontSize]), () => ( 0)))) < 0.5);
3198
3285
  if (peers.length < 2 && !numbered && !lettered) continue;
3199
- const candidates = page.filter((b) => b.type === "paragraph" && b.text && b.bbox && _optionalChain([b, 'access', _142 => _142.style, 'optionalAccess', _143 => _143.fontName]) === _optionalChain([anchor, 'access', _144 => _144.style, 'optionalAccess', _145 => _145.fontName]) && Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _146 => _146.style, 'optionalAccess', _147 => _147.fontSize]), () => ( 0))) - (_nullishCoalesce(_optionalChain([anchor, 'access', _148 => _148.style, 'optionalAccess', _149 => _149.fontSize]), () => ( 0)))) < 0.5 && b.text.trim().length >= 3 && b.text.trim().length <= 80 && b.bbox.height <= (_nullishCoalesce(_optionalChain([b, 'access', _150 => _150.style, 'optionalAccess', _151 => _151.fontSize]), () => ( 0))) * 1.6 && /^[A-Z]/.test(b.text.trim()) && !/[.!?:;,]$/.test(b.text.trim()) && !/^(?:Table|Figure|Fig\.?|Appendix)\s+\d/i.test(b.text.trim()));
3286
+ const candidates = page.filter((b) => b.type === "paragraph" && b.text && b.bbox && _optionalChain([b, 'access', _154 => _154.style, 'optionalAccess', _155 => _155.fontName]) === _optionalChain([anchor, 'access', _156 => _156.style, 'optionalAccess', _157 => _157.fontName]) && Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _158 => _158.style, 'optionalAccess', _159 => _159.fontSize]), () => ( 0))) - (_nullishCoalesce(_optionalChain([anchor, 'access', _160 => _160.style, 'optionalAccess', _161 => _161.fontSize]), () => ( 0)))) < 0.5 && b.text.trim().length >= 3 && b.text.trim().length <= 80 && b.bbox.height <= (_nullishCoalesce(_optionalChain([b, 'access', _162 => _162.style, 'optionalAccess', _163 => _163.fontSize]), () => ( 0))) * 1.6 && /^[A-Z]/.test(b.text.trim()) && !/[.!?:;,]$/.test(b.text.trim()) && !/^(?:Table|Figure|Fig\.?|Appendix)\s+\d/i.test(b.text.trim()));
3200
3287
  const siblings = candidates.filter((b) => numbered ? new RegExp(`^${numbered[1]}\\.\\d+\\s+`).test(b.text.trim()) : lettered ? /^[A-Z]\s+/.test(b.text.trim()) && Math.abs(anchor.bbox.x - b.bbox.x) < 8 : peers.some((h) => h.bbox && Math.abs(h.bbox.x - b.bbox.x) < 8));
3201
3288
  if (siblings.length < (numbered || lettered ? 1 : 2)) continue;
3202
3289
  for (const sibling of siblings) {
@@ -3215,11 +3302,11 @@ function detectRepeatedPageLabels(blocks) {
3215
3302
  }
3216
3303
  for (const page of byPage.values()) {
3217
3304
  const bodyChars = /* @__PURE__ */ new Map();
3218
- for (const b of page) if (b.type === "paragraph" && b.text && _optionalChain([b, 'access', _152 => _152.style, 'optionalAccess', _153 => _153.fontName])) {
3305
+ for (const b of page) if (b.type === "paragraph" && b.text && _optionalChain([b, 'access', _164 => _164.style, 'optionalAccess', _165 => _165.fontName])) {
3219
3306
  bodyChars.set(b.style.fontName, (_nullishCoalesce(bodyChars.get(b.style.fontName), () => ( 0))) + b.text.length);
3220
3307
  }
3221
- const bodyFace = _optionalChain([[...bodyChars], 'access', _154 => _154.sort, 'call', _155 => _155((a, b) => b[1] - a[1]), 'access', _156 => _156[0], 'optionalAccess', _157 => _157[0]]);
3222
- const candidates = page.filter((b) => b.type === "paragraph" && b.text && b.bbox && _optionalChain([b, 'access', _158 => _158.style, 'optionalAccess', _159 => _159.fontName]) && b.style.fontName !== bodyFace && b.bbox.height <= (_nullishCoalesce(b.style.fontSize, () => ( 0))) * 1.6 && b.text.trim().length >= 5 && b.text.trim().length <= 80);
3308
+ const bodyFace = _optionalChain([[...bodyChars], 'access', _166 => _166.sort, 'call', _167 => _167((a, b) => b[1] - a[1]), 'access', _168 => _168[0], 'optionalAccess', _169 => _169[0]]);
3309
+ const candidates = page.filter((b) => b.type === "paragraph" && b.text && b.bbox && _optionalChain([b, 'access', _170 => _170.style, 'optionalAccess', _171 => _171.fontName]) && b.style.fontName !== bodyFace && b.bbox.height <= (_nullishCoalesce(b.style.fontSize, () => ( 0))) * 1.6 && b.text.trim().length >= 5 && b.text.trim().length <= 80);
3223
3310
  const groups = /* @__PURE__ */ new Map();
3224
3311
  for (const b of candidates) {
3225
3312
  const key = `${b.style.fontName}:${b.style.fontSize}`;
@@ -3255,19 +3342,19 @@ function detectPageLeadHeadings(blocks) {
3255
3342
  for (const page of byPage.values()) {
3256
3343
  const content = page.filter((b) => b.type !== "image" && b.type !== "separator" && !(b.type === "paragraph" && !b.style));
3257
3344
  const [first, second, third] = content;
3258
- if (!_optionalChain([first, 'optionalAccess', _160 => _160.bbox]) || !first.text || !_optionalChain([first, 'access', _161 => _161.style, 'optionalAccess', _162 => _162.fontSize]) || !second) continue;
3345
+ if (!_optionalChain([first, 'optionalAccess', _172 => _172.bbox]) || !first.text || !_optionalChain([first, 'access', _173 => _173.style, 'optionalAccess', _174 => _174.fontSize]) || !second) continue;
3259
3346
  const firstText = first.text.trim();
3260
3347
  const captionLike = /^(?:Figure|Fig\.?|Table|표|그림)\s*\d/i;
3261
3348
  const hasImage = page.some((b) => b.type === "image");
3262
- const firstIsTitle = first.type === "paragraph" && firstText.length >= 5 && firstText.length <= 80 && first.bbox.height <= first.style.fontSize * 1.6 && (/^(?:CONTENTS|Table of Contents)$/i.test(firstText) || hasImage && /^[A-Z]/.test(firstText) && !captionLike.test(firstText) && second.type === "paragraph" && /^[A-Z]/.test(_nullishCoalesce(_optionalChain([second, 'access', _163 => _163.text, 'optionalAccess', _164 => _164.trim, 'call', _165 => _165()]), () => ( ""))) && (_nullishCoalesce(_optionalChain([second, 'access', _166 => _166.text, 'optionalAccess', _167 => _167.length]), () => ( 0))) >= 100 && second.bbox && first.bbox.y - (second.bbox.y + second.bbox.height) >= first.style.fontSize);
3349
+ const firstIsTitle = first.type === "paragraph" && firstText.length >= 5 && firstText.length <= 80 && first.bbox.height <= first.style.fontSize * 1.6 && (/^(?:CONTENTS|Table of Contents)$/i.test(firstText) || hasImage && /^[A-Z]/.test(firstText) && !captionLike.test(firstText) && second.type === "paragraph" && /^[A-Z]/.test(_nullishCoalesce(_optionalChain([second, 'access', _175 => _175.text, 'optionalAccess', _176 => _176.trim, 'call', _177 => _177()]), () => ( ""))) && (_nullishCoalesce(_optionalChain([second, 'access', _178 => _178.text, 'optionalAccess', _179 => _179.length]), () => ( 0))) >= 100 && second.bbox && first.bbox.y - (second.bbox.y + second.bbox.height) >= first.style.fontSize);
3263
3350
  const firstAboveProse = first.type === "paragraph" && firstText.length >= 5 && firstText.length <= 80 && first.bbox.height <= first.style.fontSize * 2 && second.type === "paragraph" && second.bbox && second.bbox.height >= first.style.fontSize * 4 && Math.abs(first.bbox.x - second.bbox.x) <= first.style.fontSize * 2 && first.bbox.y - (second.bbox.y + second.bbox.height) >= first.style.fontSize * 2 && !captionLike.test(firstText) && !/^(?:doi:|https?:|www\.)/i.test(firstText);
3264
- const firstIsSection = first.type === "list" && /^\d+\.\s+[A-Z][A-Z\s]{12,}$/.test(firstText) && second.type === "paragraph" && (_nullishCoalesce(_optionalChain([second, 'access', _168 => _168.text, 'optionalAccess', _169 => _169.length]), () => ( 0))) >= 100;
3351
+ const firstIsSection = first.type === "list" && /^\d+\.\s+[A-Z][A-Z\s]{12,}$/.test(firstText) && second.type === "paragraph" && (_nullishCoalesce(_optionalChain([second, 'access', _180 => _180.text, 'optionalAccess', _181 => _181.length]), () => ( 0))) >= 100;
3265
3352
  if (firstIsTitle || firstAboveProse || firstIsSection) {
3266
3353
  first.type = "heading";
3267
3354
  first.level = 1;
3268
3355
  }
3269
- if (first.type !== "heading" || captionLike.test(firstText) || second.type !== "paragraph" || !second.text || !second.bbox || !_optionalChain([second, 'access', _170 => _170.style, 'optionalAccess', _171 => _171.fontName]) || !second.style.fontSize || !_optionalChain([third, 'optionalAccess', _172 => _172.text]) || !third.bbox || second.text.trim().length < 5 || second.text.trim().length > 80 || captionLike.test(second.text.trim()) || /^(?:doi:|https?:)/i.test(second.text.trim()) || second.bbox.height > second.style.fontSize * 1.6 || Math.abs(second.bbox.x - third.bbox.x) > 30) continue;
3270
- const distinctFace = _optionalChain([third, 'access', _173 => _173.style, 'optionalAccess', _174 => _174.fontName]) !== second.style.fontName;
3356
+ if (first.type !== "heading" || captionLike.test(firstText) || second.type !== "paragraph" || !second.text || !second.bbox || !_optionalChain([second, 'access', _182 => _182.style, 'optionalAccess', _183 => _183.fontName]) || !second.style.fontSize || !_optionalChain([third, 'optionalAccess', _184 => _184.text]) || !third.bbox || second.text.trim().length < 5 || second.text.trim().length > 80 || captionLike.test(second.text.trim()) || /^(?:doi:|https?:)/i.test(second.text.trim()) || second.bbox.height > second.style.fontSize * 1.6 || Math.abs(second.bbox.x - third.bbox.x) > 30) continue;
3357
+ const distinctFace = _optionalChain([third, 'access', _185 => _185.style, 'optionalAccess', _186 => _186.fontName]) !== second.style.fontName;
3271
3358
  const namedContents = /^Table of Contents$/i.test(second.text.trim());
3272
3359
  if (distinctFace && third.text.length >= 60 || namedContents) {
3273
3360
  second.type = "heading";
@@ -3278,24 +3365,24 @@ function detectPageLeadHeadings(blocks) {
3278
3365
  function refineDocumentStyleHeadings(blocks) {
3279
3366
  const faceChars = /* @__PURE__ */ new Map();
3280
3367
  for (const block of blocks) {
3281
- if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _175 => _175.style, 'optionalAccess', _176 => _176.fontName])) continue;
3368
+ if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _187 => _187.style, 'optionalAccess', _188 => _188.fontName])) continue;
3282
3369
  faceChars.set(block.style.fontName, (_nullishCoalesce(faceChars.get(block.style.fontName), () => ( 0))) + block.text.length);
3283
3370
  }
3284
3371
  const [bodyFace, bodyChars] = _nullishCoalesce([...faceChars].sort((a, b) => b[1] - a[1])[0], () => ( []));
3285
3372
  if (!bodyFace || !bodyChars || bodyChars < 300) return;
3286
3373
  for (let i = 0; i < blocks.length; i++) {
3287
3374
  const block = blocks[i];
3288
- const text = _nullishCoalesce(_optionalChain([block, 'access', _177 => _177.text, 'optionalAccess', _178 => _178.trim, 'call', _179 => _179()]), () => ( ""));
3375
+ const text = _nullishCoalesce(_optionalChain([block, 'access', _189 => _189.text, 'optionalAccess', _190 => _190.trim, 'call', _191 => _191()]), () => ( ""));
3289
3376
  if (block.type === "heading" && /(?:https?:\/\/|www\.|^arxiv:|^doi:)/i.test(text)) {
3290
3377
  block.type = "paragraph";
3291
3378
  block.level = void 0;
3292
3379
  continue;
3293
3380
  }
3294
3381
  const box = block.bbox, style = block.style;
3295
- if (block.type !== "paragraph" || !box || !_optionalChain([style, 'optionalAccess', _180 => _180.fontName]) || !style.fontSize || style.fontName === bodyFace || (_nullishCoalesce(faceChars.get(style.fontName), () => ( 0))) > bodyChars * 0.25 || text.length < 3 || text.length > 70 || text.includes("\n") || box.height > style.fontSize * 1.6 || /^(?:table|figure|fig\.?|source|doi:|arxiv:|https?:|www\.|[•●○▪▫⮚*∗†])/i.test(text) || /(?:https?:\/\/|www\.|@|[=¼≪þ])/i.test(text) || /^definition\s+\d+[.:]?\s+.*\b(?:is|are|means)\b/i.test(text) || /^[\d\s.,:%+\-–]+$/.test(text)) continue;
3382
+ if (block.type !== "paragraph" || !box || !_optionalChain([style, 'optionalAccess', _192 => _192.fontName]) || !style.fontSize || style.fontName === bodyFace || (_nullishCoalesce(faceChars.get(style.fontName), () => ( 0))) > bodyChars * 0.25 || text.length < 3 || text.length > 70 || text.includes("\n") || box.height > style.fontSize * 1.6 || /^(?:table|figure|fig\.?|source|doi:|arxiv:|https?:|www\.|[•●○▪▫⮚*∗†])/i.test(text) || /(?:https?:\/\/|www\.|@|[=¼≪þ])/i.test(text) || /^definition\s+\d+[.:]?\s+.*\b(?:is|are|means)\b/i.test(text) || /^[\d\s.,:%+\-–]+$/.test(text)) continue;
3296
3383
  const previous = blocks[i - 1], next = blocks[i + 1];
3297
- const pb = _optionalChain([previous, 'optionalAccess', _181 => _181.bbox]), nb = _optionalChain([next, 'optionalAccess', _182 => _182.bbox]);
3298
- if (!pb || !nb || previous.pageNumber !== block.pageNumber || next.pageNumber !== block.pageNumber || previous.type !== "paragraph" && previous.type !== "heading" || next.type !== "paragraph" || _optionalChain([next, 'access', _183 => _183.style, 'optionalAccess', _184 => _184.fontName]) !== bodyFace || !next.text || next.text.length < 40 || style.fontSize < (_nullishCoalesce(next.style.fontSize, () => ( 0))) * 0.95 || pb.y - (box.y + box.height) < style.fontSize * 0.5 || box.y - (nb.y + nb.height) < 0 || box.y - (nb.y + nb.height) > style.fontSize * 2 || box.x + box.width / 2 < nb.x - 10 || box.x + box.width / 2 > nb.x + nb.width + 10) continue;
3384
+ const pb = _optionalChain([previous, 'optionalAccess', _193 => _193.bbox]), nb = _optionalChain([next, 'optionalAccess', _194 => _194.bbox]);
3385
+ if (!pb || !nb || previous.pageNumber !== block.pageNumber || next.pageNumber !== block.pageNumber || previous.type !== "paragraph" && previous.type !== "heading" || next.type !== "paragraph" || _optionalChain([next, 'access', _195 => _195.style, 'optionalAccess', _196 => _196.fontName]) !== bodyFace || !next.text || next.text.length < 40 || style.fontSize < (_nullishCoalesce(next.style.fontSize, () => ( 0))) * 0.95 || pb.y - (box.y + box.height) < style.fontSize * 0.5 || box.y - (nb.y + nb.height) < 0 || box.y - (nb.y + nb.height) > style.fontSize * 2 || box.x + box.width / 2 < nb.x - 10 || box.x + box.width / 2 > nb.x + nb.width + 10) continue;
3299
3386
  block.type = "heading";
3300
3387
  block.level = 2;
3301
3388
  }
@@ -3345,7 +3432,7 @@ function detectMarkerHeadings(blocks) {
3345
3432
  block.level = 4;
3346
3433
  continue;
3347
3434
  }
3348
- if (/^[가-힣]{2,6}$/.test(text) && _optionalChain([block, 'access', _185 => _185.style, 'optionalAccess', _186 => _186.fontSize])) {
3435
+ if (/^[가-힣]{2,6}$/.test(text) && _optionalChain([block, 'access', _197 => _197.style, 'optionalAccess', _198 => _198.fontSize])) {
3349
3436
  const prev = blocks[i - 1];
3350
3437
  const next = blocks[i + 1];
3351
3438
  const prevIsStructural = !prev || prev.type === "table" || prev.type === "heading" || prev.type === "separator";
@@ -3386,7 +3473,7 @@ function detectTableCaptions(blocks) {
3386
3473
  block.table.caption = blocks[i - 1].text.trim();
3387
3474
  blocks.splice(i - 1, 1);
3388
3475
  i--;
3389
- } else if (isCaptionCandidate(blocks[i + 1], block) && _optionalChain([blocks, 'access', _187 => _187[i + 2], 'optionalAccess', _188 => _188.type]) !== "table") {
3476
+ } else if (isCaptionCandidate(blocks[i + 1], block) && _optionalChain([blocks, 'access', _199 => _199[i + 2], 'optionalAccess', _200 => _200.type]) !== "table") {
3390
3477
  block.table.caption = blocks[i + 1].text.trim();
3391
3478
  blocks.splice(i + 1, 1);
3392
3479
  }
@@ -3593,21 +3680,23 @@ function detectSpecialKoreanTables(blocks) {
3593
3680
  flushKvTable();
3594
3681
  return result;
3595
3682
  }
3596
- function removeHeaderFooterBlocks(blocks, pageHeights, warnings) {
3683
+ function removeHeaderFooterBlocks(blocks, pageHeights, warnings, notes, tables = false) {
3597
3684
  const ZONE_RATIO = 0.12;
3598
3685
  const MIN_REPEAT = 3;
3599
3686
  const topEntries = [];
3600
3687
  const bottomEntries = [];
3601
3688
  for (let bi = 0; bi < blocks.length; bi++) {
3602
3689
  const b = blocks[bi];
3603
- if (!b.bbox || !b.pageNumber || !_optionalChain([b, 'access', _189 => _189.text, 'optionalAccess', _190 => _190.trim, 'call', _191 => _191()])) continue;
3690
+ const text = !tables ? _optionalChain([b, 'access', _201 => _201.text, 'optionalAccess', _202 => _202.trim, 'call', _203 => _203()]) : b.type === "table" && b.table ? b.table.cells.flat().map((c) => c.text.trim()).filter(Boolean).join(" | ") : void 0;
3691
+ if (!b.bbox || !b.pageNumber || !text) continue;
3604
3692
  const ph = pageHeights.get(b.bbox.page) || pageHeights.get(b.pageNumber);
3605
3693
  if (!ph) continue;
3606
3694
  const blockTop = ph - (b.bbox.y + b.bbox.height);
3607
3695
  const blockBottom = ph - b.bbox.y;
3608
- const entry = { blockIdx: bi, page: b.pageNumber, text: b.text.trim() };
3609
- if (blockBottom <= ph * ZONE_RATIO) topEntries.push(entry);
3610
- else if (blockTop >= ph * (1 - ZONE_RATIO)) bottomEntries.push(entry);
3696
+ const entry = { blockIdx: bi, page: b.pageNumber, text };
3697
+ const boxMid = b.type === "table" && b.bbox.height <= ph * 0.05 ? (blockTop + blockBottom) / 2 : void 0;
3698
+ if ((_nullishCoalesce(boxMid, () => ( blockBottom))) <= ph * ZONE_RATIO) topEntries.push(entry);
3699
+ else if ((_nullishCoalesce(boxMid, () => ( blockTop))) >= ph * (1 - ZONE_RATIO)) bottomEntries.push(entry);
3611
3700
  }
3612
3701
  const removeSet = /* @__PURE__ */ new Set();
3613
3702
  for (const entries of [topEntries, bottomEntries]) {
@@ -3629,7 +3718,7 @@ function removeHeaderFooterBlocks(blocks, pageHeights, warnings) {
3629
3718
  for (const [p, count] of patternCount) {
3630
3719
  const pages = [..._nullishCoalesce(patternPages.get(p), () => ( []))];
3631
3720
  const span = pages.length ? Math.max(...pages) - Math.min(...pages) + 1 : 0;
3632
- const pageNumbered = (_nullishCoalesce(_optionalChain([patternNumbers, 'access', _192 => _192.get, 'call', _193 => _193(p), 'optionalAccess', _194 => _194.size]), () => ( 0))) > 1;
3721
+ const pageNumbered = !tables && (_nullishCoalesce(_optionalChain([patternNumbers, 'access', _204 => _204.get, 'call', _205 => _205(p), 'optionalAccess', _206 => _206.size]), () => ( 0))) > 1;
3633
3722
  if (count >= MIN_REPEAT && pages.length >= MIN_REPEAT && (pages.length >= span * 0.4 || pageNumbered)) {
3634
3723
  repeatedPatterns.add(p);
3635
3724
  }
@@ -3637,9 +3726,11 @@ function removeHeaderFooterBlocks(blocks, pageHeights, warnings) {
3637
3726
  for (const e of entries) {
3638
3727
  const norm = e.text.replace(/\d+/g, "#");
3639
3728
  if (!repeatedPatterns.has(norm)) continue;
3729
+ const noteMark = _optionalChain([e, 'access', _207 => _207.text, 'access', _208 => _208.match, 'call', _209 => _209(/^\d{1,3}\)/), 'optionalAccess', _210 => _210[0]]);
3730
+ if (noteMark && _optionalChain([notes, 'optionalAccess', _211 => _211.get, 'call', _212 => _212(e.page), 'optionalAccess', _213 => _213.marks, 'access', _214 => _214.some, 'call', _215 => _215((m) => m.mark === noteMark)])) continue;
3640
3731
  const cand = blocks[e.blockIdx];
3641
3732
  const cb = cand.bbox;
3642
- const tableNote = /^(?:주\s*(?:\d+\s*[).:]|[::])|(?:자료|출처)\s*[::])/.test(e.text) && blocks.some((o) => {
3733
+ const tableNote = /^(?:주\s*(?:\d+\s*[).:]|[::])|(?:자료|출처)\s*[::])/.test(e.text.replace(/ \| /g, " ")) && blocks.some((o) => {
3643
3734
  if (o.type !== "table" || !o.bbox || o.bbox.page !== cb.page) return false;
3644
3735
  const gap = o.bbox.y - (cb.y + cb.height);
3645
3736
  return gap >= 0 && gap <= cb.height && cb.x >= o.bbox.x && cb.x + cb.width <= o.bbox.x + o.bbox.width;
@@ -3650,7 +3741,7 @@ function removeHeaderFooterBlocks(blocks, pageHeights, warnings) {
3650
3741
  if (bi === e.blockIdx) continue;
3651
3742
  const o = blocks[bi];
3652
3743
  if (!o.bbox || o.bbox.page !== cb.page) continue;
3653
- const oNorm = _optionalChain([o, 'access', _195 => _195.text, 'optionalAccess', _196 => _196.trim, 'call', _197 => _197(), 'access', _198 => _198.replace, 'call', _199 => _199(/\d+/g, "#")]);
3744
+ const oNorm = _optionalChain([o, 'access', _216 => _216.text, 'optionalAccess', _217 => _217.trim, 'call', _218 => _218(), 'access', _219 => _219.replace, 'call', _220 => _220(/\d+/g, "#")]);
3654
3745
  if (oNorm && repeatedPatterns.has(oNorm)) continue;
3655
3746
  const overlap2 = Math.min(cb.y + cb.height, o.bbox.y + o.bbox.height) - Math.max(cb.y, o.bbox.y);
3656
3747
  if (overlap2 >= cb.height * 0.5) {
@@ -3693,7 +3784,7 @@ function recordCellLines(cell, items) {
3693
3784
  function markImageCell(cell) {
3694
3785
  IMAGE_CELLS.add(cell);
3695
3786
  }
3696
- var emptyCell = (cell) => !cell || !_optionalChain([cell, 'access', _200 => _200.text, 'optionalAccess', _201 => _201.trim, 'call', _202 => _202()]) && !_optionalChain([cell, 'access', _203 => _203.blocks, 'optionalAccess', _204 => _204.length]) && !IMAGE_CELLS.has(cell);
3787
+ var emptyCell = (cell) => !cell || !_optionalChain([cell, 'access', _221 => _221.text, 'optionalAccess', _222 => _222.trim, 'call', _223 => _223()]) && !_optionalChain([cell, 'access', _224 => _224.blocks, 'optionalAccess', _225 => _225.length]) && !IMAGE_CELLS.has(cell);
3697
3788
  function trimTable(table) {
3698
3789
  let cols = table.cols;
3699
3790
  while (cols > 0 && table.cells.every((row) => emptyCell(row[cols - 1]))) cols--;
@@ -3709,7 +3800,7 @@ function trimTable(table) {
3709
3800
  function trimTrailingEmptyTableCols(blocks) {
3710
3801
  for (const b of blocks) {
3711
3802
  if (b.type !== "table" || !b.table) continue;
3712
- for (const row of b.table.cells) for (const cell of row) if (_optionalChain([cell, 'access', _205 => _205.blocks, 'optionalAccess', _206 => _206.length])) trimTrailingEmptyTableCols(cell.blocks);
3803
+ for (const row of b.table.cells) for (const cell of row) if (_optionalChain([cell, 'access', _226 => _226.blocks, 'optionalAccess', _227 => _227.length])) trimTrailingEmptyTableCols(cell.blocks);
3713
3804
  trimTable(b.table);
3714
3805
  }
3715
3806
  }
@@ -3729,7 +3820,7 @@ function mergeSliverColumns(grid, colXs, maxWidth) {
3729
3820
  }
3730
3821
  const ok = owner.every((row) => {
3731
3822
  const o = row[c];
3732
- return !!o && (o.colSpan > 1 || !o.text.trim() && !_optionalChain([o, 'access', _207 => _207.blocks, 'optionalAccess', _208 => _208.length]));
3823
+ return !!o && (o.colSpan > 1 || !o.text.trim() && !_optionalChain([o, 'access', _228 => _228.blocks, 'optionalAccess', _229 => _229.length]));
3733
3824
  });
3734
3825
  if (!ok) continue;
3735
3826
  const spanning = /* @__PURE__ */ new Set();
@@ -3795,7 +3886,7 @@ function isProseTable(table) {
3795
3886
  if (!(long > 0 && long >= total * 0.5 && longRows >= rows * 0.4)) return false;
3796
3887
  for (let c = 0; c < table.cols; c++) {
3797
3888
  const filled = table.cells.map((row) => row[c]).filter((cell) => cell && cell.colSpan < table.cols && cell.text.trim()).map((cell) => cell.text.trim());
3798
- if (filled.length >= 3 && filled.length >= rows * 0.6 && filled.every((text) => text.length <= 30 && (_nullishCoalesce(_optionalChain([text, 'access', _209 => _209.match, 'call', _210 => _210(/\p{L}/gu), 'optionalAccess', _211 => _211.length]), () => ( 0))) >= 2)) return false;
3889
+ if (filled.length >= 3 && filled.length >= rows * 0.6 && filled.every((text) => text.length <= 30 && (_nullishCoalesce(_optionalChain([text, 'access', _230 => _230.match, 'call', _231 => _231(/\p{L}/gu), 'optionalAccess', _232 => _232.length]), () => ( 0))) >= 2)) return false;
3799
3890
  }
3800
3891
  return true;
3801
3892
  }
@@ -3822,7 +3913,7 @@ function isChartTable(table) {
3822
3913
  const numeric = texts.filter((text) => NUMERIC_CELL.test(text)).length;
3823
3914
  if (numeric < texts.length * 0.5) return false;
3824
3915
  for (let c = 0; c < table.cols; c++) {
3825
- const ticks = table.cells.flatMap((row) => (_nullishCoalesce(_optionalChain([row, 'access', _212 => _212[c], 'optionalAccess', _213 => _213.text]), () => ( ""))).split(/\s+/)).filter((token) => /^-?[\d,]+(?:\.\d+)?%?$/.test(token)).map((token) => Number(token.replace(/[,%]/g, "")));
3916
+ const ticks = table.cells.flatMap((row) => (_nullishCoalesce(_optionalChain([row, 'access', _233 => _233[c], 'optionalAccess', _234 => _234.text]), () => ( ""))).split(/\s+/)).filter((token) => /^-?[\d,]+(?:\.\d+)?%?$/.test(token)).map((token) => Number(token.replace(/[,%]/g, "")));
3826
3917
  if (hasValueAxis(ticks)) return true;
3827
3918
  }
3828
3919
  const values = texts.filter((text) => text.split(/\s+/).every((token) => /^[-−–]?[\d,]*\.?\d+%?$/.test(token))).length;
@@ -3976,7 +4067,7 @@ function detectAlignedTwoColumnTables(rows, pageNum) {
3976
4067
  continue;
3977
4068
  }
3978
4069
  const top = rows[i - 1];
3979
- const title = _optionalChain([top, 'optionalAccess', _214 => _214.items, 'access', _215 => _215.length]) === 1 && Math.abs(top.items[0].x - first[0].x) <= 5 && top.items[0].text.length <= 65 && top.y - first[0].y <= Math.max(24, first[0].fontSize * 2.8) ? top : void 0;
4070
+ const title = _optionalChain([top, 'optionalAccess', _235 => _235.items, 'access', _236 => _236.length]) === 1 && Math.abs(top.items[0].x - first[0].x) <= 5 && top.items[0].text.length <= 65 && top.y - first[0].y <= Math.max(24, first[0].fontSize * 2.8) ? top : void 0;
3980
4071
  const tableRows = title ? [title, ...body] : body;
3981
4072
  const cells = tableRows.map((row, idx) => {
3982
4073
  if (title && idx === 0) return [{ text: row.items[0].text, colSpan: 2, rowSpan: 1 }, { text: "", colSpan: 1, rowSpan: 1 }];
@@ -4032,12 +4123,12 @@ function isTwoColumnProse(r) {
4032
4123
  if (t.rows < 8) return false;
4033
4124
  const dense = [];
4034
4125
  for (let c = 0; c < t.cols; c++) {
4035
- const filled = t.cells.filter((row) => _optionalChain([row, 'access', _216 => _216[c], 'optionalAccess', _217 => _217.text, 'access', _218 => _218.trim, 'call', _219 => _219()])).length;
4126
+ const filled = t.cells.filter((row) => _optionalChain([row, 'access', _237 => _237[c], 'optionalAccess', _238 => _238.text, 'access', _239 => _239.trim, 'call', _240 => _240()])).length;
4036
4127
  if (filled / t.rows >= 0.3) dense.push(c);
4037
4128
  }
4038
4129
  if (dense.length !== 2) return false;
4039
4130
  for (const c of dense) {
4040
- const lens = t.cells.map((row) => _nullishCoalesce(_optionalChain([row, 'access', _220 => _220[c], 'optionalAccess', _221 => _221.text, 'access', _222 => _222.replace, 'call', _223 => _223(/\s+/g, ""), 'access', _224 => _224.length]), () => ( 0))).filter((n) => n > 0);
4131
+ const lens = t.cells.map((row) => _nullishCoalesce(_optionalChain([row, 'access', _241 => _241[c], 'optionalAccess', _242 => _242.text, 'access', _243 => _243.replace, 'call', _244 => _244(/\s+/g, ""), 'access', _245 => _245.length]), () => ( 0))).filter((n) => n > 0);
4041
4132
  const avg = lens.reduce((s, v) => s + v, 0) / (lens.length || 1);
4042
4133
  if (avg < 12) return false;
4043
4134
  }
@@ -4433,7 +4524,7 @@ function assignRowItems(items, columns, numCols, headerFace) {
4433
4524
  const runs = [];
4434
4525
  for (const it of sorted) {
4435
4526
  const last = runs[runs.length - 1];
4436
- const prev = _optionalChain([last, 'optionalAccess', _225 => _225[last.length - 1]]);
4527
+ const prev = _optionalChain([last, 'optionalAccess', _246 => _246[last.length - 1]]);
4437
4528
  if (prev && it.x - (prev.x + prev.w) <= Math.max(0.5, it.fontSize * 0.05) && !it.hasSpaceBefore) last.push(it);
4438
4529
  else runs.push([it]);
4439
4530
  }
@@ -4507,7 +4598,7 @@ function buildClusterTable(rows, columns, pageNum) {
4507
4598
  () => Array.from({ length: numCols }, () => ({ text: "", colSpan: 1, rowSpan: 1 }))
4508
4599
  );
4509
4600
  const usedItems = /* @__PURE__ */ new Set();
4510
- const headFaces = new Set(_optionalChain([rows, 'access', _226 => _226[0], 'optionalAccess', _227 => _227.items, 'access', _228 => _228.map, 'call', _229 => _229((i) => i.fontName)]));
4601
+ const headFaces = new Set(_optionalChain([rows, 'access', _247 => _247[0], 'optionalAccess', _248 => _248.items, 'access', _249 => _249.map, 'call', _250 => _250((i) => i.fontName)]));
4511
4602
  const headerFace = headFaces.size === 1 && rows.slice(1).every((row) => row.items.every((i) => !headFaces.has(i.fontName))) ? [...headFaces][0] : void 0;
4512
4603
  for (let r = 0; r < numRows; r++) {
4513
4604
  const row = rows[r];
@@ -4537,7 +4628,7 @@ function buildClusterTable(rows, columns, pageNum) {
4537
4628
  const nonEmptyCols = cells[r].filter((c) => c.text.trim()).length;
4538
4629
  if (nonEmptyCols !== 1) continue;
4539
4630
  if (cells[r][0].text.trim() !== "") continue;
4540
- const contentText = _optionalChain([cells, 'access', _230 => _230[r], 'access', _231 => _231.find, 'call', _232 => _232((c) => c.text.trim()), 'optionalAccess', _233 => _233.text, 'access', _234 => _234.trim, 'call', _235 => _235()]) || "";
4631
+ const contentText = _optionalChain([cells, 'access', _251 => _251[r], 'access', _252 => _252.find, 'call', _253 => _253((c) => c.text.trim()), 'optionalAccess', _254 => _254.text, 'access', _255 => _255.trim, 'call', _256 => _256()]) || "";
4541
4632
  if (/^[○●▶\-·]/.test(contentText)) continue;
4542
4633
  for (let pr = r - 1; pr >= 0; pr--) {
4543
4634
  if (cells[pr].some((c) => c.text.trim())) {
@@ -5136,16 +5227,16 @@ function isProseSpread(items) {
5136
5227
  for (let i = 1; i < sorted.length; i++) {
5137
5228
  gaps.push(sorted[i].x - (sorted[i - 1].x + sorted[i - 1].w));
5138
5229
  }
5139
- const maxGap = _chunkNWODPYBDcjs.safeMax.call(void 0, gaps);
5230
+ const maxGap = _chunkSTM3ORY7cjs.safeMax.call(void 0, gaps);
5140
5231
  const avgLen = items.reduce((s, i) => s + i.text.length, 0) / items.length;
5141
5232
  if (items.length >= 4 && maxGap < 40 && avgLen < 5) return true;
5142
- const minGap = _chunkNWODPYBDcjs.safeMin.call(void 0, gaps);
5233
+ const minGap = _chunkSTM3ORY7cjs.safeMin.call(void 0, gaps);
5143
5234
  return minGap > 0 && maxGap - minGap <= Math.max(2, maxGap * 0.15) && items.filter((i) => /^\P{L}*\p{Ll}/u.test(i.text)).length * 2 >= items.length;
5144
5235
  }
5145
5236
  function detectColumns(yLines) {
5146
5237
  const allItems = yLines.flat();
5147
5238
  if (allItems.length === 0) return null;
5148
- const pageWidth = _chunkNWODPYBDcjs.safeMax.call(void 0, allItems.map((i) => i.x + i.w)) - _chunkNWODPYBDcjs.safeMin.call(void 0, allItems.map((i) => i.x));
5239
+ const pageWidth = _chunkSTM3ORY7cjs.safeMax.call(void 0, allItems.map((i) => i.x + i.w)) - _chunkSTM3ORY7cjs.safeMin.call(void 0, allItems.map((i) => i.x));
5149
5240
  if (pageWidth < 100) return null;
5150
5241
  let bigoLineIdx = -1;
5151
5242
  for (let i = 0; i < yLines.length; i++) {
@@ -5868,17 +5959,23 @@ function splitTwoColumnProse(items, cutX) {
5868
5959
  if (last && Math.abs(last[0].y - c.y) <= 3) last.push(c);
5869
5960
  else crossLines.push([c]);
5870
5961
  }
5871
- const bandItem = (arr) => arr.filter((i) => {
5962
+ const scriptOf = (i, cl) => {
5963
+ const fs = cl[0].fontSize, dy = i.y - cl[0].y;
5964
+ if (i.fontSize > fs * 0.85 || dy > fs * 0.6 || dy < -fs * 0.35) return false;
5965
+ return cl.some((c) => c !== i && c.fontSize > fs * 0.85 && i.x - (c.x + c.w) <= fs * 0.35 && i.x - (c.x + c.w) >= -fs * 0.1);
5966
+ };
5967
+ const bandItem = (arr, fits) => arr.filter((i) => {
5872
5968
  for (const cl of crossLines) {
5873
- if (Math.abs(cl[0].y - i.y) <= 3) {
5969
+ if (fits(i, cl)) {
5874
5970
  cl.push(i);
5875
5971
  return false;
5876
5972
  }
5877
5973
  }
5878
5974
  return true;
5879
5975
  });
5880
- const leftRest = bandItem(left);
5881
- const rightRest = bandItem(right);
5976
+ const sameY = (i, cl) => Math.abs(cl[0].y - i.y) <= 3;
5977
+ const leftRest = bandItem(bandItem(left, sameY), scriptOf);
5978
+ const rightRest = bandItem(bandItem(right, sameY), scriptOf);
5882
5979
  const boundYs = crossLines.map((cl) => cl[0].y);
5883
5980
  const bandOf = (y) => {
5884
5981
  let k = 0;
@@ -5890,7 +5987,7 @@ function splitTwoColumnProse(items, cutX) {
5890
5987
  const L = leftRest.filter((i) => bandOf(i.y) === k);
5891
5988
  const R = rightRest.filter((i) => bandOf(i.y) === k);
5892
5989
  groups.push(...columnPair(L, R));
5893
- if (k < crossLines.length) groups.push(crossLines[k]);
5990
+ if (k < crossLines.length) groups.push(crossLines[k].sort((a, b) => b.y - a.y || a.x - b.x));
5894
5991
  }
5895
5992
  return groups;
5896
5993
  }
@@ -5965,7 +6062,8 @@ function topTableBand(items) {
5965
6062
  h: i.h,
5966
6063
  fontSize: i.fontSize,
5967
6064
  fontName: i.fontName,
5968
- hasSpaceBefore: i.hasSpaceBefore
6065
+ hasSpaceBefore: i.hasSpaceBefore,
6066
+ syntheticSpace: i.syntheticSpace
5969
6067
  })), 1);
5970
6068
  if (!candidate.some((t) => t.table.cols >= 3 && t.table.rows >= 3 && t.usedItems.size >= top.length * 0.75)) continue;
5971
6069
  return { top, rest: lines.slice(n).flat() };
@@ -6019,7 +6117,7 @@ function stackedTableBands(items) {
6019
6117
  const caption = (start, end) => lines.slice(start, end).some((line) => /^Table\s+\d+\s*[:.]/i.test(mergeLineSimple(line).trim()));
6020
6118
  while (runs.length > 0 && !caption(runs[runs.length - 1].end, lines.length)) runs.pop();
6021
6119
  if (runs.length < 2) return null;
6022
- if (runs.some((run, i) => !caption(run.end, _nullishCoalesce(_optionalChain([runs, 'access', _236 => _236[i + 1], 'optionalAccess', _237 => _237.start]), () => ( lines.length))))) return null;
6120
+ if (runs.some((run, i) => !caption(run.end, _nullishCoalesce(_optionalChain([runs, 'access', _257 => _257[i + 1], 'optionalAccess', _258 => _258.start]), () => ( lines.length))))) return null;
6023
6121
  const tables = runs.map((run) => lines.slice(run.start, run.end).flat());
6024
6122
  const between = runs.slice(0, -1).map((run, i) => lines.slice(run.end, runs[i + 1].start).flat());
6025
6123
  const tail = lines.slice(runs[runs.length - 1].end);
@@ -6182,7 +6280,7 @@ function extractPageBlocksWithLines(items, pageNum, opList, pageWidth, pageHeigh
6182
6280
  const filled = fillBlanks(items, horizontals, verticals);
6183
6281
  items = filled.items;
6184
6282
  horizontals = filled.horizontals;
6185
- const prevPage = _optionalChain([carry, 'optionalAccess', _238 => _238.page]) === pageNum - 1 ? carry.clip : void 0;
6283
+ const prevPage = _optionalChain([carry, 'optionalAccess', _259 => _259.page]) === pageNum - 1 ? carry.clip : void 0;
6186
6284
  const clipResult = detectTables ? buildClipCellGrids(extracted.clipRects, horizontals, verticals, pageWidth, pageHeight, items.map((it) => ({ x: it.x + it.w / 2, y: it.y + it.h / 2 })), extracted.fillRects, prevPage) : { grids: [], containers: [], page: void 0 };
6187
6285
  if (carry) {
6188
6286
  carry.page = pageNum;
@@ -6211,7 +6309,7 @@ function extractPageBlocksWithLines(items, pageNum, opList, pageWidth, pageHeigh
6211
6309
  if (underlines.size) horizontals = horizontals.filter((l) => !underlines.has(l));
6212
6310
  wrapUnderlineRuns(items);
6213
6311
  const lineGrids = detectTables ? buildTableGrids(horizontals, verticals) : [];
6214
- const tableClipGrids = dropInsetClipGrids(dropShadingClipGrids(clipGrids, lineGrids, extracted.fillRects, verticals), lineGrids);
6312
+ const tableClipGrids = dropHeadBandClipGrids(dropInsetClipGrids(dropShadingClipGrids(clipGrids, lineGrids, extracted.fillRects, verticals), lineGrids), lineGrids);
6215
6313
  const grids = [...tableClipGrids, ...dropGridsInside(lineGrids, tableClipGrids, clipResult.containers)];
6216
6314
  if (grids.length === 1 && grids[0].rowYs.length === 2 && grids[0].colXs.length === 2 && grids[0].bbox.x2 - grids[0].bbox.x1 > pageWidth * 1.2 && grids[0].bbox.y2 - grids[0].bbox.y1 > pageHeight * 1.2) {
6217
6315
  return extractPageBlocksFallback(items, pageNum, true, detectTables, lex);
@@ -6415,6 +6513,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
6415
6513
  fontSize: i.fontSize,
6416
6514
  fontName: i.fontName,
6417
6515
  hasSpaceBefore: i.hasSpaceBefore,
6516
+ syntheticSpace: i.syntheticSpace,
6418
6517
  seq: i.seq
6419
6518
  }));
6420
6519
  const cellTextMap = mapTextToCells(textItems, cells);
@@ -6482,13 +6581,13 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
6482
6581
  if (!assignedItems.has(textItems[ti])) usedItems.delete(tableItems[ti]);
6483
6582
  }
6484
6583
  }
6485
- if (unitLine.length > 0 && rebuiltUsed && !/^\s*\(\s*단위\s*[::]/.test(_nullishCoalesce(_optionalChain([finalGrid, 'access', _239 => _239[0], 'optionalAccess', _240 => _240[0], 'optionalAccess', _241 => _241.text]), () => ( "")))) {
6584
+ if (unitLine.length > 0 && rebuiltUsed && !/^\s*\(\s*단위\s*[::]/.test(_nullishCoalesce(_optionalChain([finalGrid, 'access', _260 => _260[0], 'optionalAccess', _261 => _261[0], 'optionalAccess', _262 => _262.text]), () => ( "")))) {
6486
6585
  finalGrid.unshift(Array.from({ length: numCols }, (_, c) => ({ text: c === 0 ? cleanCellText(unitText) : "", colSpan: c === 0 ? numCols : 1, rowSpan: 1 })));
6487
6586
  finalRows++;
6488
6587
  for (const item of unitLine) usedItems.add(item);
6489
6588
  }
6490
6589
  const filledCells = finalGrid.flat().filter((c) => c.text.trim()).length;
6491
- if (!rebuiltUsed && filledCells * 2 >= finalGrid.flat().length && !/^\s*\(\s*단위\s*[::]/.test(_nullishCoalesce(_optionalChain([finalGrid, 'access', _242 => _242[0], 'optionalAccess', _243 => _243[0], 'optionalAccess', _244 => _244.text]), () => ( "")))) {
6590
+ if (!rebuiltUsed && filledCells * 2 >= finalGrid.flat().length && !/^\s*\(\s*단위\s*[::]/.test(_nullishCoalesce(_optionalChain([finalGrid, 'access', _263 => _263[0], 'optionalAccess', _264 => _264[0], 'optionalAccess', _265 => _265.text]), () => ( "")))) {
6492
6591
  const above = items.filter((it) => !usedItems.has(it) && it.y >= grid.bbox.y2 && it.y - grid.bbox.y2 <= 8 && it.x >= grid.bbox.x1 - 3 && it.x + it.w <= grid.bbox.x2 + 3);
6493
6592
  const line = above.filter((it) => Math.abs(it.y - Math.min(...above.map((a) => a.y))) <= 1).sort((a, b) => a.x - b.x);
6494
6593
  const text = line.map((it) => it.text).join("");
@@ -6501,7 +6600,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
6501
6600
  }
6502
6601
  let semanticOneColumn = false;
6503
6602
  if (!grid.cells && numCols === 1 && numGridRows >= 2) {
6504
- const populatedRows = finalGrid.filter((row) => _optionalChain([row, 'access', _245 => _245[0], 'optionalAccess', _246 => _246.text, 'access', _247 => _247.trim, 'call', _248 => _248()]));
6603
+ const populatedRows = finalGrid.filter((row) => _optionalChain([row, 'access', _266 => _266[0], 'optionalAccess', _267 => _267.text, 'access', _268 => _268.trim, 'call', _269 => _269()]));
6505
6604
  if (populatedRows.length >= 4) {
6506
6605
  const fontSizes = tableItems.map((item) => item.fontSize).filter((size) => size > 0).sort((a, b) => a - b);
6507
6606
  const medianFont = _nullishCoalesce(fontSizes[Math.floor(fontSizes.length / 2)], () => ( 0));
@@ -6527,6 +6626,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
6527
6626
  fontSize: i.fontSize,
6528
6627
  fontName: i.fontName,
6529
6628
  hasSpaceBefore: i.hasSpaceBefore,
6629
+ syntheticSpace: i.syntheticSpace,
6530
6630
  seq: i.seq
6531
6631
  })))), colSpan: 1, rowSpan: 1 })));
6532
6632
  finalRows++;
@@ -6575,7 +6675,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
6575
6675
  height: grid.bbox.y2 - grid.bbox.y1
6576
6676
  };
6577
6677
  if (numRows === 1 && numCols === 1 && gridW < pageWidth * 0.35) {
6578
- const prose = _nullishCoalesce(_optionalChain([finalGrid, 'access', _249 => _249[0], 'optionalAccess', _250 => _250[0], 'optionalAccess', _251 => _251.text]), () => ( ""));
6678
+ const prose = _nullishCoalesce(_optionalChain([finalGrid, 'access', _270 => _270[0], 'optionalAccess', _271 => _271[0], 'optionalAccess', _272 => _272.text]), () => ( ""));
6579
6679
  const besideLines = (side) => new Set(side.map((it) => Math.round(it.y / 3))).size;
6580
6680
  const rightLines = items.filter((it) => it.x >= grid.bbox.x2 + 3 && it.y >= grid.bbox.y1 && it.y <= grid.bbox.y2);
6581
6681
  const leftLines = items.filter((it) => it.x + it.w <= grid.bbox.x1 - 3 && it.y >= grid.bbox.y1 && it.y <= grid.bbox.y2);
@@ -6623,12 +6723,13 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
6623
6723
  h: i.h,
6624
6724
  fontSize: i.fontSize,
6625
6725
  fontName: i.fontName,
6626
- hasSpaceBefore: i.hasSpaceBefore
6726
+ hasSpaceBefore: i.hasSpaceBefore,
6727
+ syntheticSpace: i.syntheticSpace
6627
6728
  }));
6628
6729
  const proseColumns = findTwoColumnProseCutX(clusterItems) !== null || detectPersistentColumnGutter(remaining.map((i) => ({ x: i.x, y: i.y, w: i.w, h: i.h > 0 ? i.h : i.fontSize }))) !== null;
6629
6730
  const clusterResults = (proseColumns ? [] : detectClusterTables(clusterItems, pageNum)).filter((cr) => {
6630
6731
  const b = cr.bbox;
6631
- return !blocks.some((x) => x.type === "paragraph" && x.bbox && (_nullishCoalesce(_optionalChain([x, 'access', _252 => _252.text, 'optionalAccess', _253 => _253.match, 'call', _254 => _254(/\p{L}/gu), 'optionalAccess', _255 => _255.length]), () => ( 0))) >= 10 && Math.min(x.bbox.x + x.bbox.width, b.x + b.width) - Math.max(x.bbox.x, b.x) >= 0.8 * b.width && x.bbox.y >= b.y - 2 && x.bbox.y + x.bbox.height <= b.y + b.height + 2);
6732
+ return !blocks.some((x) => x.type === "paragraph" && x.bbox && (_nullishCoalesce(_optionalChain([x, 'access', _273 => _273.text, 'optionalAccess', _274 => _274.match, 'call', _275 => _275(/\p{L}/gu), 'optionalAccess', _276 => _276.length]), () => ( 0))) >= 10 && Math.min(x.bbox.x + x.bbox.width, b.x + b.width) - Math.max(x.bbox.x, b.x) >= 0.8 * b.width && x.bbox.y >= b.y - 2 && x.bbox.y + x.bbox.height <= b.y + b.height + 2);
6632
6733
  });
6633
6734
  if (clusterResults.length > 0) {
6634
6735
  const ciToIdx = /* @__PURE__ */ new Map();
@@ -6662,7 +6763,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
6662
6763
  if (gutterX !== null) {
6663
6764
  const gx = gutterX;
6664
6765
  const allY = remaining.map((i) => i.y);
6665
- const pageH = _chunkNWODPYBDcjs.safeMax.call(void 0, allY) - _chunkNWODPYBDcjs.safeMin.call(void 0, allY);
6766
+ const pageH = _chunkSTM3ORY7cjs.safeMax.call(void 0, allY) - _chunkSTM3ORY7cjs.safeMin.call(void 0, allY);
6666
6767
  const gapThreshold = Math.max(15, pageH * 0.03);
6667
6768
  const sides = [
6668
6769
  remaining.filter((i) => i.x + i.w <= gx),
@@ -6682,7 +6783,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
6682
6783
  finalTextBlocks = detectListBlocks(textBlocks);
6683
6784
  } else {
6684
6785
  const allY = remaining.map((i) => i.y);
6685
- const pageH = _chunkNWODPYBDcjs.safeMax.call(void 0, allY) - _chunkNWODPYBDcjs.safeMin.call(void 0, allY);
6786
+ const pageH = _chunkSTM3ORY7cjs.safeMax.call(void 0, allY) - _chunkSTM3ORY7cjs.safeMin.call(void 0, allY);
6686
6787
  const groups = xyCutOrder(remaining, Math.max(15, pageH * 0.03));
6687
6788
  const textBlocks = [];
6688
6789
  for (const group of groups) {
@@ -6937,7 +7038,8 @@ function extractPageBlocksFallback(items, pageNum, fullPage = false, detectTable
6937
7038
  h: i.h,
6938
7039
  fontSize: i.fontSize,
6939
7040
  fontName: i.fontName,
6940
- hasSpaceBefore: i.hasSpaceBefore
7041
+ hasSpaceBefore: i.hasSpaceBefore,
7042
+ syntheticSpace: i.syntheticSpace
6941
7043
  }));
6942
7044
  const textRects = items.map((i) => ({ x: i.x, y: i.y, w: i.w, h: i.h > 0 ? i.h : i.fontSize }));
6943
7045
  const earlyProseCut = fullPage && detectTables ? _nullishCoalesce(_nullishCoalesce(findTwoColumnProseCutX(clusterItems), () => ( persistentGutter(textRects))), () => ( (figures.length > 0 ? detectColumnGutter([...textRects, ...figures]) : null))) : null;
@@ -6995,7 +7097,7 @@ function extractPageBlocksFallback(items, pageNum, fullPage = false, detectTable
6995
7097
  blocks.push(...columnTextToBlocks(tableText, pageNum, bbox, dominantStyle(items)));
6996
7098
  } else {
6997
7099
  const allY = items.map((i) => i.y);
6998
- const pageHeight = _chunkNWODPYBDcjs.safeMax.call(void 0, allY) - _chunkNWODPYBDcjs.safeMin.call(void 0, allY);
7100
+ const pageHeight = _chunkSTM3ORY7cjs.safeMax.call(void 0, allY) - _chunkSTM3ORY7cjs.safeMin.call(void 0, allY);
6999
7101
  const gapThreshold = Math.max(15, pageHeight * 0.03);
7000
7102
  const orderedGroups = proseCutX !== null ? splitTwoColumnProse(items, proseCutX) : xyCutOrder(items, gapThreshold);
7001
7103
  for (const group of orderedGroups) {
@@ -7055,5 +7157,6 @@ function extractPageBlocksFallback(items, pageNum, fullPage = false, detectTable
7055
7157
 
7056
7158
 
7057
7159
 
7058
- exports.OCR_DET_MODEL = OCR_DET_MODEL; exports.OCR_REC_MODEL = OCR_REC_MODEL; exports.OCR_REC_DICT = OCR_REC_DICT; exports.getOcrModelsDir = getOcrModelsDir; exports.ensureOcrModels = ensureOcrModels; exports.ocrModelsCached = ocrModelsCached; exports.parseCharacterDict = parseCharacterDict; exports.extractLines = extractLines; exports.extractImageRegions = extractImageRegions; exports.filterHiddenText = filterHiddenText; exports.collapseEvenSpacing = collapseEvenSpacing; exports.normalizeItems = normalizeItems; exports.WrapLexicon = WrapLexicon; exports.wrapJoiner = wrapJoiner; exports.joinPageBreakWraps = joinPageBreakWraps; exports.latinSoftWrap = latinSoftWrap; exports.TOC_BLOCKS = TOC_BLOCKS; exports.computeMedianFontSizeFromFreq = computeMedianFontSizeFromFreq; exports.detectHeadings = detectHeadings; exports.mergeStackedHeadingLines = mergeStackedHeadingLines; exports.detectTypographyHeadings = detectTypographyHeadings; exports.detectDocumentStyleHeadings = detectDocumentStyleHeadings; exports.detectSiblingStyleHeadings = detectSiblingStyleHeadings; exports.detectRepeatedPageLabels = detectRepeatedPageLabels; exports.detectPageLeadHeadings = detectPageLeadHeadings; exports.refineDocumentStyleHeadings = refineDocumentStyleHeadings; exports.detectMarkerHeadings = detectMarkerHeadings; exports.detectTableCaptions = detectTableCaptions; exports.detectKoreanListBlocks = detectKoreanListBlocks; exports.removeHeaderFooterBlocks = removeHeaderFooterBlocks; exports.CLIP_TABLES = CLIP_TABLES; exports.TABLE_COLXS = TABLE_COLXS; exports.EMPTY_PARTS = EMPTY_PARTS; exports.IMAGE_CELLS = IMAGE_CELLS; exports.FILLER_CELLS = FILLER_CELLS; exports.CONT_PARTS = CONT_PARTS; exports.CELL_LINES = CELL_LINES; exports.trimTrailingEmptyTableCols = trimTrailingEmptyTableCols; exports.extractPageBlocksWithLines = extractPageBlocksWithLines;
7059
- //# sourceMappingURL=chunk-MH6MAL64.cjs.map
7160
+
7161
+ exports.OCR_DET_MODEL = OCR_DET_MODEL; exports.OCR_REC_MODEL = OCR_REC_MODEL; exports.OCR_REC_DICT = OCR_REC_DICT; exports.getOcrModelsDir = getOcrModelsDir; exports.ensureOcrModels = ensureOcrModels; exports.ocrModelsCached = ocrModelsCached; exports.parseCharacterDict = parseCharacterDict; exports.extractLines = extractLines; exports.extractImageRegions = extractImageRegions; exports.filterHiddenText = filterHiddenText; exports.collapseEvenSpacing = collapseEvenSpacing; exports.normalizeItems = normalizeItems; exports.WrapLexicon = WrapLexicon; exports.startsNewItem = startsNewItem; exports.wrapJoiner = wrapJoiner; exports.joinPageBreakWraps = joinPageBreakWraps; exports.latinSoftWrap = latinSoftWrap; exports.TOC_BLOCKS = TOC_BLOCKS; exports.computeMedianFontSizeFromFreq = computeMedianFontSizeFromFreq; exports.detectHeadings = detectHeadings; exports.mergeStackedHeadingLines = mergeStackedHeadingLines; exports.detectTypographyHeadings = detectTypographyHeadings; exports.detectDocumentStyleHeadings = detectDocumentStyleHeadings; exports.detectSiblingStyleHeadings = detectSiblingStyleHeadings; exports.detectRepeatedPageLabels = detectRepeatedPageLabels; exports.detectPageLeadHeadings = detectPageLeadHeadings; exports.refineDocumentStyleHeadings = refineDocumentStyleHeadings; exports.detectMarkerHeadings = detectMarkerHeadings; exports.detectTableCaptions = detectTableCaptions; exports.detectKoreanListBlocks = detectKoreanListBlocks; exports.removeHeaderFooterBlocks = removeHeaderFooterBlocks; exports.CLIP_TABLES = CLIP_TABLES; exports.TABLE_COLXS = TABLE_COLXS; exports.EMPTY_PARTS = EMPTY_PARTS; exports.IMAGE_CELLS = IMAGE_CELLS; exports.FILLER_CELLS = FILLER_CELLS; exports.CONT_PARTS = CONT_PARTS; exports.CELL_LINES = CELL_LINES; exports.trimTrailingEmptyTableCols = trimTrailingEmptyTableCols; exports.extractPageBlocksWithLines = extractPageBlocksWithLines;
7162
+ //# sourceMappingURL=chunk-WDQTFAXY.cjs.map