kordoc 4.15.2 → 4.15.3

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 (132) hide show
  1. package/README.md +4 -0
  2. package/dist/{-5HJYDZKM.js → -V6UUFZDG.js} +10 -10
  3. package/dist/{chunk-JPJNZXCC.js → chunk-23RP6N2G.js} +2 -2
  4. package/dist/{chunk-TCMEK4LF.js → chunk-3YDASJV2.js} +5 -5
  5. package/dist/{chunk-B4LHTFLY.cjs → chunk-4U2UK5XN.cjs} +6 -6
  6. package/dist/chunk-4U2UK5XN.cjs.map +1 -0
  7. package/dist/{chunk-VSI5SRP2.cjs → chunk-5HHU64LY.cjs} +69 -28
  8. package/dist/chunk-5HHU64LY.cjs.map +1 -0
  9. package/dist/{chunk-MJHUOAAI.js → chunk-6ONRBCZM.js} +2 -2
  10. package/dist/{chunk-KKQBQY32.js → chunk-7J4PX2EZ.js} +2 -2
  11. package/dist/{chunk-MRPDMIMN.cjs → chunk-BP5BIALD.cjs} +3 -3
  12. package/dist/chunk-BP5BIALD.cjs.map +1 -0
  13. package/dist/{chunk-SX2KSBMO.js → chunk-D2DMHJWK.js} +2 -2
  14. package/dist/{chunk-VTUADXSS.js → chunk-DLXP2KTO.js} +2 -2
  15. package/dist/{chunk-GS7T56RP.cjs → chunk-EKYI3Z6M.cjs} +2 -2
  16. package/dist/chunk-EKYI3Z6M.cjs.map +1 -0
  17. package/dist/{chunk-CODOAMAV.js → chunk-GC5RACQO.js} +2 -2
  18. package/dist/{chunk-2WERADM4.js → chunk-HMNXCVFN.js} +9 -9
  19. package/dist/{chunk-GWTN34UT.js → chunk-I75K4WCK.js} +2 -2
  20. package/dist/{chunk-GFBLDBL2.js → chunk-IUUFAJAQ.js} +2 -2
  21. package/dist/chunk-J55UQC5H.cjs.map +1 -1
  22. package/dist/{chunk-NYNJP45T.js → chunk-JZUY3KFB.js} +45 -4
  23. package/dist/chunk-JZUY3KFB.js.map +1 -0
  24. package/dist/{chunk-3Y26ICMC.cjs → chunk-KANKOFGS.cjs} +6 -6
  25. package/dist/chunk-KANKOFGS.cjs.map +1 -0
  26. package/dist/{chunk-73K6BXEQ.js → chunk-LRZ4WVXO.js} +2 -2
  27. package/dist/{chunk-VGU4FLLD.cjs → chunk-NJGA67VC.cjs} +2 -2
  28. package/dist/chunk-NJGA67VC.cjs.map +1 -0
  29. package/dist/{chunk-WQWWVZ6Y.js → chunk-NKVLVONL.js} +3 -3
  30. package/dist/{chunk-ZVN2H7XL.js → chunk-NRDQPS77.js} +3 -3
  31. package/dist/{chunk-KY6HUZZR.js → chunk-PE73XWRU.js} +2 -2
  32. package/dist/chunk-PY2M7YVN.cjs.map +1 -1
  33. package/dist/{chunk-N4WZZ2PR.js → chunk-TT5SRAFO.js} +2 -2
  34. package/dist/{chunk-AS66S3HA.js → chunk-TVCW6NUJ.js} +3 -3
  35. package/dist/{chunk-PTN7YG24.js → chunk-XFTJLW36.js} +45 -4
  36. package/dist/chunk-XFTJLW36.js.map +1 -0
  37. package/dist/{chunk-GYZCXVJX.js → chunk-Y3TAEI7A.js} +2 -2
  38. package/dist/{chunk-VRZEPD4K.js → chunk-YNIK3EYN.js} +2 -2
  39. package/dist/chunks-EPNQ264U.js +10 -0
  40. package/dist/cli.js +25 -25
  41. package/dist/{formula-D4PUT5J3.js → formula-2YW2PQJE.js} +3 -3
  42. package/dist/{formula-DYVJSHWN.cjs → formula-5NGEGKVP.cjs} +10 -10
  43. package/dist/formula-5NGEGKVP.cjs.map +1 -0
  44. package/dist/{formula-QVHAUNK6.js → formula-72V7KDJN.js} +4 -4
  45. package/dist/{image-ocr-5BHKFZL6.js → image-ocr-25AQGYOM.js} +7 -7
  46. package/dist/{image-ocr-TNNFV5VQ.js → image-ocr-WUIUC3YR.js} +5 -5
  47. package/dist/{image-ocr-SGANCWQ5.cjs → image-ocr-Z4JMGF6G.cjs} +14 -14
  48. package/dist/image-ocr-Z4JMGF6G.cjs.map +1 -0
  49. package/dist/index.cjs +236 -236
  50. package/dist/index.cjs.map +1 -1
  51. package/dist/index.js +4 -4
  52. package/dist/mcp.js +21 -21
  53. package/dist/{model-bundle-ISGAMXQS.js → model-bundle-4QPUNHTB.js} +5 -5
  54. package/dist/{models-LI5INKZM.js → models-XRV2MHKI.js} +5 -5
  55. package/dist/{page-range-QHHFTL7X.cjs → page-range-XPJTQHZK.cjs} +2 -2
  56. package/dist/page-range-XPJTQHZK.cjs.map +1 -0
  57. package/dist/{parser-EYJID4YX.js → parser-DQOZBSD6.js} +24 -7
  58. package/dist/parser-DQOZBSD6.js.map +1 -0
  59. package/dist/{parser-GW3KRTXY.js → parser-IPYUQBOK.js} +25 -8
  60. package/dist/parser-IPYUQBOK.js.map +1 -0
  61. package/dist/{parser-XCXDSKQ3.cjs → parser-WRNYM56K.cjs} +103 -86
  62. package/dist/parser-WRNYM56K.cjs.map +1 -0
  63. package/dist/pdf-ocr-6IUPUV2V.js +18 -0
  64. package/dist/pdf-ocr-O67H6KNE.cjs +16 -0
  65. package/dist/pdf-ocr-O67H6KNE.cjs.map +1 -0
  66. package/dist/pdf-ocr-RY7BICID.js +15 -0
  67. package/dist/{profile-io-DBN56Y2Z.js → profile-io-CNM44RRV.js} +3 -3
  68. package/dist/{rasterize-BYRCKQIW.js → rasterize-XGRABZQD.js} +3 -3
  69. package/dist/{redact-doc-UP2J6RRP.js → redact-doc-DXJN6W4K.js} +10 -10
  70. package/dist/{render-WGD5DN4G.js → render-JYZCUX5R.js} +6 -6
  71. package/dist/seal-3SZWLZIQ.js +10 -0
  72. package/dist/{setup-E5JILUAN.js → setup-NCFO2A5K.js} +3 -3
  73. package/dist/visual-WGB7QAII.js +20 -0
  74. package/dist/{watch-LKWPCU42.js → watch-S4T6ZG32.js} +11 -11
  75. package/package.json +1 -1
  76. package/dist/chunk-3Y26ICMC.cjs.map +0 -1
  77. package/dist/chunk-B4LHTFLY.cjs.map +0 -1
  78. package/dist/chunk-GS7T56RP.cjs.map +0 -1
  79. package/dist/chunk-MRPDMIMN.cjs.map +0 -1
  80. package/dist/chunk-NYNJP45T.js.map +0 -1
  81. package/dist/chunk-PTN7YG24.js.map +0 -1
  82. package/dist/chunk-VGU4FLLD.cjs.map +0 -1
  83. package/dist/chunk-VSI5SRP2.cjs.map +0 -1
  84. package/dist/chunks-C3AW42QH.js +0 -10
  85. package/dist/formula-DYVJSHWN.cjs.map +0 -1
  86. package/dist/image-ocr-SGANCWQ5.cjs.map +0 -1
  87. package/dist/page-range-QHHFTL7X.cjs.map +0 -1
  88. package/dist/parser-EYJID4YX.js.map +0 -1
  89. package/dist/parser-GW3KRTXY.js.map +0 -1
  90. package/dist/parser-XCXDSKQ3.cjs.map +0 -1
  91. package/dist/pdf-ocr-JCJAME6Q.js +0 -15
  92. package/dist/pdf-ocr-K7MJFRBS.cjs +0 -16
  93. package/dist/pdf-ocr-K7MJFRBS.cjs.map +0 -1
  94. package/dist/pdf-ocr-TC3BN2MV.js +0 -18
  95. package/dist/seal-5GAFTYQO.js +0 -10
  96. package/dist/visual-FKV2TRYY.js +0 -20
  97. /package/dist/{-5HJYDZKM.js.map → -V6UUFZDG.js.map} +0 -0
  98. /package/dist/{chunk-JPJNZXCC.js.map → chunk-23RP6N2G.js.map} +0 -0
  99. /package/dist/{chunk-TCMEK4LF.js.map → chunk-3YDASJV2.js.map} +0 -0
  100. /package/dist/{chunk-MJHUOAAI.js.map → chunk-6ONRBCZM.js.map} +0 -0
  101. /package/dist/{chunk-KKQBQY32.js.map → chunk-7J4PX2EZ.js.map} +0 -0
  102. /package/dist/{chunk-SX2KSBMO.js.map → chunk-D2DMHJWK.js.map} +0 -0
  103. /package/dist/{chunk-VTUADXSS.js.map → chunk-DLXP2KTO.js.map} +0 -0
  104. /package/dist/{chunk-CODOAMAV.js.map → chunk-GC5RACQO.js.map} +0 -0
  105. /package/dist/{chunk-2WERADM4.js.map → chunk-HMNXCVFN.js.map} +0 -0
  106. /package/dist/{chunk-GWTN34UT.js.map → chunk-I75K4WCK.js.map} +0 -0
  107. /package/dist/{chunk-GFBLDBL2.js.map → chunk-IUUFAJAQ.js.map} +0 -0
  108. /package/dist/{chunk-73K6BXEQ.js.map → chunk-LRZ4WVXO.js.map} +0 -0
  109. /package/dist/{chunk-WQWWVZ6Y.js.map → chunk-NKVLVONL.js.map} +0 -0
  110. /package/dist/{chunk-ZVN2H7XL.js.map → chunk-NRDQPS77.js.map} +0 -0
  111. /package/dist/{chunk-KY6HUZZR.js.map → chunk-PE73XWRU.js.map} +0 -0
  112. /package/dist/{chunk-N4WZZ2PR.js.map → chunk-TT5SRAFO.js.map} +0 -0
  113. /package/dist/{chunk-AS66S3HA.js.map → chunk-TVCW6NUJ.js.map} +0 -0
  114. /package/dist/{chunk-GYZCXVJX.js.map → chunk-Y3TAEI7A.js.map} +0 -0
  115. /package/dist/{chunk-VRZEPD4K.js.map → chunk-YNIK3EYN.js.map} +0 -0
  116. /package/dist/{chunks-C3AW42QH.js.map → chunks-EPNQ264U.js.map} +0 -0
  117. /package/dist/{formula-D4PUT5J3.js.map → formula-2YW2PQJE.js.map} +0 -0
  118. /package/dist/{formula-QVHAUNK6.js.map → formula-72V7KDJN.js.map} +0 -0
  119. /package/dist/{image-ocr-5BHKFZL6.js.map → image-ocr-25AQGYOM.js.map} +0 -0
  120. /package/dist/{image-ocr-TNNFV5VQ.js.map → image-ocr-WUIUC3YR.js.map} +0 -0
  121. /package/dist/{model-bundle-ISGAMXQS.js.map → model-bundle-4QPUNHTB.js.map} +0 -0
  122. /package/dist/{models-LI5INKZM.js.map → models-XRV2MHKI.js.map} +0 -0
  123. /package/dist/{pdf-ocr-JCJAME6Q.js.map → pdf-ocr-6IUPUV2V.js.map} +0 -0
  124. /package/dist/{pdf-ocr-TC3BN2MV.js.map → pdf-ocr-RY7BICID.js.map} +0 -0
  125. /package/dist/{profile-io-DBN56Y2Z.js.map → profile-io-CNM44RRV.js.map} +0 -0
  126. /package/dist/{rasterize-BYRCKQIW.js.map → rasterize-XGRABZQD.js.map} +0 -0
  127. /package/dist/{redact-doc-UP2J6RRP.js.map → redact-doc-DXJN6W4K.js.map} +0 -0
  128. /package/dist/{render-WGD5DN4G.js.map → render-JYZCUX5R.js.map} +0 -0
  129. /package/dist/{seal-5GAFTYQO.js.map → seal-3SZWLZIQ.js.map} +0 -0
  130. /package/dist/{setup-E5JILUAN.js.map → setup-NCFO2A5K.js.map} +0 -0
  131. /package/dist/{visual-FKV2TRYY.js.map → visual-WGB7QAII.js.map} +0 -0
  132. /package/dist/{watch-LKWPCU42.js.map → watch-S4T6ZG32.js.map} +0 -0
@@ -6,7 +6,7 @@ var _chunkPY2M7YVNcjs = require('./chunk-PY2M7YVN.cjs');
6
6
 
7
7
 
8
8
 
9
- var _chunkVGU4FLLDcjs = require('./chunk-VGU4FLLD.cjs');
9
+ var _chunkNJGA67VCcjs = require('./chunk-NJGA67VC.cjs');
10
10
 
11
11
  // src/pdf/image-regions.ts
12
12
  var _pdfmjs = require('pdfjs-dist/legacy/build/pdf.mjs');
@@ -1148,10 +1148,28 @@ function buildClipCellGrids(rects, strokedH, strokedV, pageWidth, pageHeight, te
1148
1148
  const pageArea = pageWidth * pageHeight;
1149
1149
  const sameRect = (a, b) => Math.abs(a.x1 - b.x1) <= CLIP_EDGE_TOL && Math.abs(a.x2 - b.x2) <= CLIP_EDGE_TOL && Math.abs(a.y1 - b.y1) <= CLIP_EDGE_TOL && Math.abs(a.y2 - b.y2) <= CLIP_EDGE_TOL;
1150
1150
  const cells = [];
1151
+ const buckets = /* @__PURE__ */ new Map();
1151
1152
  for (const r of rects) {
1152
1153
  if (r.x2 - r.x1 < CLIP_MIN_W2 || r.y2 - r.y1 < CLIP_MIN_H2) continue;
1153
1154
  if (pageArea > 0 && (r.x2 - r.x1) * (r.y2 - r.y1) >= pageArea * CLIP_MAX_PAGE_FRAC) continue;
1154
- if (!cells.some((c) => sameRect(c, r))) cells.push(r);
1155
+ const bx = Math.floor(r.x1 / CLIP_EDGE_TOL), by = Math.floor(r.y1 / CLIP_EDGE_TOL);
1156
+ let duplicate = false;
1157
+ for (let dx = -1; dx <= 1 && !duplicate; dx++) {
1158
+ const ys2 = buckets.get(bx + dx);
1159
+ for (let dy = -1; dy <= 1 && !duplicate; dy++) {
1160
+ duplicate = _nullishCoalesce(_optionalChain([ys2, 'optionalAccess', _12 => _12.get, 'call', _13 => _13(by + dy), 'optionalAccess', _14 => _14.some, 'call', _15 => _15((c) => sameRect(c, r))]), () => ( false));
1161
+ }
1162
+ }
1163
+ if (duplicate) continue;
1164
+ cells.push(r);
1165
+ let ys = buckets.get(bx);
1166
+ if (!ys) {
1167
+ ys = /* @__PURE__ */ new Map();
1168
+ buckets.set(bx, ys);
1169
+ }
1170
+ const row = ys.get(by);
1171
+ if (row) row.push(r);
1172
+ else ys.set(by, [r]);
1155
1173
  }
1156
1174
  if (cells.length < 1) return { grids: [], containers: [], page: { lastCells: [], clips: [] } };
1157
1175
  const parent = new Array(cells.length).fill(-1);
@@ -1210,9 +1228,32 @@ function buildClipCellGrids(rects, strokedH, strokedV, pageWidth, pageHeight, te
1210
1228
  }
1211
1229
  return i;
1212
1230
  };
1231
+ const edgeBin = (v) => Math.floor(v / CLIP_ADJ_GAP);
1232
+ const startsX = /* @__PURE__ */ new Map(), endsX = /* @__PURE__ */ new Map();
1233
+ const startsY = /* @__PURE__ */ new Map(), endsY = /* @__PURE__ */ new Map();
1234
+ const addEdge = (map, v, i) => {
1235
+ const k = edgeBin(v), row = map.get(k);
1236
+ if (row) row.push(i);
1237
+ else map.set(k, [i]);
1238
+ };
1239
+ for (let i = 0; i < cells.length; i++) {
1240
+ addEdge(startsX, cells[i].x1, i);
1241
+ addEdge(endsX, cells[i].x2, i);
1242
+ addEdge(startsY, cells[i].y1, i);
1243
+ addEdge(endsY, cells[i].y2, i);
1244
+ }
1213
1245
  for (let i = 0; i < cells.length; i++) {
1214
1246
  if (tableClip[i]) continue;
1215
- for (let j = i + 1; j < cells.length; j++) {
1247
+ const candidates = /* @__PURE__ */ new Set();
1248
+ const near = (map, v) => {
1249
+ const k = edgeBin(v);
1250
+ for (let d = -1; d <= 1; d++) for (const j of _nullishCoalesce(map.get(k + d), () => ( []))) if (j > i) candidates.add(j);
1251
+ };
1252
+ near(startsX, cells[i].x2);
1253
+ near(endsX, cells[i].x1);
1254
+ near(startsY, cells[i].y2);
1255
+ near(endsY, cells[i].y1);
1256
+ for (const j of [...candidates].sort((a, b) => a - b)) {
1216
1257
  if (tableClip[j] || parent[i] !== parent[j]) continue;
1217
1258
  if (adjacent(cells[i], cells[j])) {
1218
1259
  const ra = find(i), rb = find(j);
@@ -1233,7 +1274,7 @@ function buildClipCellGrids(rects, strokedH, strokedV, pageWidth, pageHeight, te
1233
1274
  else groups.set(r, [i]);
1234
1275
  }
1235
1276
  const containers = cells.filter((_, i) => isContainer[i]);
1236
- const groupSize = (i) => _nullishCoalesce(_optionalChain([groups, 'access', _12 => _12.get, 'call', _13 => _13(find(i)), 'optionalAccess', _14 => _14.length]), () => ( 0));
1277
+ const groupSize = (i) => _nullishCoalesce(_optionalChain([groups, 'access', _16 => _16.get, 'call', _17 => _17(find(i)), 'optionalAccess', _18 => _18.length]), () => ( 0));
1237
1278
  const isGridMember = (i) => groupSize(i) >= CLIP_MIN_GROUP;
1238
1279
  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);
1239
1280
  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);
@@ -1664,7 +1705,7 @@ var WrapLexicon = (_class = class {constructor() { _class.prototype.__init.call(
1664
1705
  const n = left.length;
1665
1706
  if (n >= 2 && right.length >= 2) {
1666
1707
  const k1 = pairKey(left.charCodeAt(n - 2), left.charCodeAt(n - 1)), k2 = pairKey(right.charCodeAt(0), right.charCodeAt(1));
1667
- const v = decideCounts(_nullishCoalesce(_optionalChain([this, 'access', _15 => _15.joined2, 'access', _16 => _16.get, 'call', _17 => _17(k1), 'optionalAccess', _18 => _18.get, 'call', _19 => _19(k2)]), () => ( 0)), _nullishCoalesce(_optionalChain([this, 'access', _20 => _20.spaced2, 'access', _21 => _21.get, 'call', _22 => _22(k1), 'optionalAccess', _23 => _23.get, 'call', _24 => _24(k2)]), () => ( 0)));
1708
+ const v = decideCounts(_nullishCoalesce(_optionalChain([this, 'access', _19 => _19.joined2, 'access', _20 => _20.get, 'call', _21 => _21(k1), 'optionalAccess', _22 => _22.get, 'call', _23 => _23(k2)]), () => ( 0)), _nullishCoalesce(_optionalChain([this, 'access', _24 => _24.spaced2, 'access', _25 => _25.get, 'call', _26 => _26(k1), 'optionalAccess', _27 => _27.get, 'call', _28 => _28(k2)]), () => ( 0)));
1668
1709
  if (v !== null) return v;
1669
1710
  }
1670
1711
  if (n && right.length) {
@@ -1735,7 +1776,7 @@ function wrapJoiner(prevText, nextText, lex) {
1735
1776
  if (endsAsWord(left)) return " ";
1736
1777
  if (/[·ㆍ‧-]/.test(a) && !/[·ㆍ‧…]{2}$/.test(prev) && /[가-힣A-Za-z0-9]/.test(b)) return "";
1737
1778
  if (/[A-Za-z]/.test(a) && /[A-Za-z]/.test(b) || /\d/.test(a) && /\d/.test(b)) return " ";
1738
- const ev = _optionalChain([lex, 'optionalAccess', _25 => _25.evidence, 'call', _26 => _26(left, right)]);
1779
+ const ev = _optionalChain([lex, 'optionalAccess', _29 => _29.evidence, 'call', _30 => _30(left, right)]);
1739
1780
  if (ev != null) return ev;
1740
1781
  if (lex && /[가-힣A-Za-z0-9]$/.test(left) && /^[가-힣A-Za-z0-9]/.test(right) && lex.joinedWord(left, right.replace(/[.,)」』’”;:]+$/, ""))) return "";
1741
1782
  if (/\d$/.test(left) && COUNTER.test(right)) return "";
@@ -1757,7 +1798,7 @@ function joinPageBreakWraps(blocks, lex) {
1757
1798
  if (a.type !== "paragraph" && a.type !== "list" || b.type !== "paragraph") continue;
1758
1799
  const last = a.bbox && PARA_LAST_LINE.get(a.bbox), fs = last ? last.fontSize : 0;
1759
1800
  if (!last || fs <= 0 || (_nullishCoalesce(pageRight.get(a.pageNumber), () => ( Infinity))) - last.right >= BODY_FULL_TOL * fs) continue;
1760
- if (last.width < BODY_MIN_WIDTH_EM * fs || Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _27 => _27.style, 'optionalAccess', _28 => _28.fontSize]), () => ( 0))) - fs) > 0.15 * fs) continue;
1801
+ if (last.width < BODY_MIN_WIDTH_EM * fs || Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _31 => _31.style, 'optionalAccess', _32 => _32.fontSize]), () => ( 0))) - fs) > 0.15 * fs) continue;
1761
1802
  if (startsNewItem(a.text, b.text)) continue;
1762
1803
  a.text += wrapJoiner(a.text, b.text, lex) + b.text;
1763
1804
  const bl = b.bbox && PARA_LAST_LINE.get(b.bbox);
@@ -2235,7 +2276,7 @@ function dominantStyle(items) {
2235
2276
  }
2236
2277
  }
2237
2278
  if (dominantSize === 0) return void 0;
2238
- const fontName = _optionalChain([items, 'access', _29 => _29.find, 'call', _30 => _30((i) => i.fontSize === dominantSize), 'optionalAccess', _31 => _31.fontName]) || void 0;
2279
+ const fontName = _optionalChain([items, 'access', _33 => _33.find, 'call', _34 => _34((i) => i.fontSize === dominantSize), 'optionalAccess', _35 => _35.fontName]) || void 0;
2239
2280
  return fontName ? { fontSize: dominantSize, fontName } : { fontSize: dominantSize };
2240
2281
  }
2241
2282
  function normalizeItems(rawItems) {
@@ -2344,7 +2385,7 @@ function splitAroundOverlays(c, overlays) {
2344
2385
  const ov = overlays.filter((o) => {
2345
2386
  for (let at = c.text.indexOf(o.text); at >= 0; at = c.text.indexOf(o.text, at + 1)) {
2346
2387
  const prefix = c.text.slice(0, at);
2347
- const est = c.x + glyphUnits(prefix.replace(/\s+/g, "")) * a0 + (_nullishCoalesce(_optionalChain([prefix, 'access', _32 => _32.match, 'call', _33 => _33(/\s+/g), 'optionalAccess', _34 => _34.length]), () => ( 0))) * ws;
2388
+ const est = c.x + glyphUnits(prefix.replace(/\s+/g, "")) * a0 + (_nullishCoalesce(_optionalChain([prefix, 'access', _36 => _36.match, 'call', _37 => _37(/\s+/g), 'optionalAccess', _38 => _38.length]), () => ( 0))) * ws;
2348
2389
  if (Math.abs(est - o.x) <= OVERLAY_DUP_EM * fs) return false;
2349
2390
  }
2350
2391
  return true;
@@ -2457,7 +2498,7 @@ function mergeSuperscriptLines(lines) {
2457
2498
  return result;
2458
2499
  }
2459
2500
  function mergeLineSimple(items) {
2460
- if (items.length <= 1) return _optionalChain([items, 'access', _35 => _35[0], 'optionalAccess', _36 => _36.text]) || "";
2501
+ if (items.length <= 1) return _optionalChain([items, 'access', _39 => _39[0], 'optionalAccess', _40 => _40.text]) || "";
2461
2502
  const sorted = sortLineByX([...items]);
2462
2503
  const isEvenSpaced = detectEvenSpacedItems(sorted);
2463
2504
  let result = sorted[0].text;
@@ -2506,7 +2547,7 @@ function computeMedianFontSizeFromFreq(freq) {
2506
2547
  }
2507
2548
  function detectHeadings(blocks, medianFontSize) {
2508
2549
  for (const block of blocks) {
2509
- if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _37 => _37.style, 'optionalAccess', _38 => _38.fontSize])) continue;
2550
+ if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _41 => _41.style, 'optionalAccess', _42 => _42.fontSize])) continue;
2510
2551
  const text = block.text.trim();
2511
2552
  if (text.length === 0 || text.length > 200) continue;
2512
2553
  if (/^\d+$/.test(text)) continue;
@@ -2567,7 +2608,7 @@ function detectMarkerHeadings(blocks) {
2567
2608
  block.level = 4;
2568
2609
  continue;
2569
2610
  }
2570
- if (/^[가-힣]{2,6}$/.test(text) && _optionalChain([block, 'access', _39 => _39.style, 'optionalAccess', _40 => _40.fontSize])) {
2611
+ if (/^[가-힣]{2,6}$/.test(text) && _optionalChain([block, 'access', _43 => _43.style, 'optionalAccess', _44 => _44.fontSize])) {
2571
2612
  const prev = blocks[i - 1];
2572
2613
  const next = blocks[i + 1];
2573
2614
  const prevIsStructural = !prev || prev.type === "table" || prev.type === "heading" || prev.type === "separator";
@@ -2822,7 +2863,7 @@ function removeHeaderFooterBlocks(blocks, pageHeights, warnings) {
2822
2863
  const bottomEntries = [];
2823
2864
  for (let bi = 0; bi < blocks.length; bi++) {
2824
2865
  const b = blocks[bi];
2825
- if (!b.bbox || !b.pageNumber || !_optionalChain([b, 'access', _41 => _41.text, 'optionalAccess', _42 => _42.trim, 'call', _43 => _43()])) continue;
2866
+ if (!b.bbox || !b.pageNumber || !_optionalChain([b, 'access', _45 => _45.text, 'optionalAccess', _46 => _46.trim, 'call', _47 => _47()])) continue;
2826
2867
  const ph = pageHeights.get(b.bbox.page) || pageHeights.get(b.pageNumber);
2827
2868
  if (!ph) continue;
2828
2869
  const blockTop = ph - (b.bbox.y + b.bbox.height);
@@ -2845,7 +2886,7 @@ function removeHeaderFooterBlocks(blocks, pageHeights, warnings) {
2845
2886
  }
2846
2887
  const repeatedPatterns = /* @__PURE__ */ new Set();
2847
2888
  for (const [p, count] of patternCount) {
2848
- if (count >= MIN_REPEAT && (_nullishCoalesce(_optionalChain([patternPages, 'access', _44 => _44.get, 'call', _45 => _45(p), 'optionalAccess', _46 => _46.size]), () => ( 0))) >= MIN_REPEAT) {
2889
+ if (count >= MIN_REPEAT && (_nullishCoalesce(_optionalChain([patternPages, 'access', _48 => _48.get, 'call', _49 => _49(p), 'optionalAccess', _50 => _50.size]), () => ( 0))) >= MIN_REPEAT) {
2849
2890
  repeatedPatterns.add(p);
2850
2891
  }
2851
2892
  }
@@ -2865,7 +2906,7 @@ function removeHeaderFooterBlocks(blocks, pageHeights, warnings) {
2865
2906
  if (bi === e.blockIdx) continue;
2866
2907
  const o = blocks[bi];
2867
2908
  if (!o.bbox || o.bbox.page !== cb.page) continue;
2868
- const oNorm = _optionalChain([o, 'access', _47 => _47.text, 'optionalAccess', _48 => _48.trim, 'call', _49 => _49(), 'access', _50 => _50.replace, 'call', _51 => _51(/\d+/g, "#")]);
2909
+ const oNorm = _optionalChain([o, 'access', _51 => _51.text, 'optionalAccess', _52 => _52.trim, 'call', _53 => _53(), 'access', _54 => _54.replace, 'call', _55 => _55(/\d+/g, "#")]);
2869
2910
  if (oNorm && repeatedPatterns.has(oNorm)) continue;
2870
2911
  const overlap2 = Math.min(cb.y + cb.height, o.bbox.y + o.bbox.height) - Math.max(cb.y, o.bbox.y);
2871
2912
  if (overlap2 >= cb.height * 0.5) {
@@ -2908,7 +2949,7 @@ function recordCellLines(cell, items) {
2908
2949
  function markImageCell(cell) {
2909
2950
  IMAGE_CELLS.add(cell);
2910
2951
  }
2911
- var emptyCell = (cell) => !cell || !_optionalChain([cell, 'access', _52 => _52.text, 'optionalAccess', _53 => _53.trim, 'call', _54 => _54()]) && !_optionalChain([cell, 'access', _55 => _55.blocks, 'optionalAccess', _56 => _56.length]) && !IMAGE_CELLS.has(cell);
2952
+ var emptyCell = (cell) => !cell || !_optionalChain([cell, 'access', _56 => _56.text, 'optionalAccess', _57 => _57.trim, 'call', _58 => _58()]) && !_optionalChain([cell, 'access', _59 => _59.blocks, 'optionalAccess', _60 => _60.length]) && !IMAGE_CELLS.has(cell);
2912
2953
  function trimTable(table) {
2913
2954
  let cols = table.cols;
2914
2955
  while (cols > 0 && table.cells.every((row) => emptyCell(row[cols - 1]))) cols--;
@@ -2924,7 +2965,7 @@ function trimTable(table) {
2924
2965
  function trimTrailingEmptyTableCols(blocks) {
2925
2966
  for (const b of blocks) {
2926
2967
  if (b.type !== "table" || !b.table) continue;
2927
- for (const row of b.table.cells) for (const cell of row) if (_optionalChain([cell, 'access', _57 => _57.blocks, 'optionalAccess', _58 => _58.length])) trimTrailingEmptyTableCols(cell.blocks);
2968
+ for (const row of b.table.cells) for (const cell of row) if (_optionalChain([cell, 'access', _61 => _61.blocks, 'optionalAccess', _62 => _62.length])) trimTrailingEmptyTableCols(cell.blocks);
2928
2969
  trimTable(b.table);
2929
2970
  }
2930
2971
  }
@@ -2983,12 +3024,12 @@ function isTwoColumnProse(r) {
2983
3024
  if (t.rows < 8) return false;
2984
3025
  const dense = [];
2985
3026
  for (let c = 0; c < t.cols; c++) {
2986
- const filled = t.cells.filter((row) => _optionalChain([row, 'access', _59 => _59[c], 'optionalAccess', _60 => _60.text, 'access', _61 => _61.trim, 'call', _62 => _62()])).length;
3027
+ const filled = t.cells.filter((row) => _optionalChain([row, 'access', _63 => _63[c], 'optionalAccess', _64 => _64.text, 'access', _65 => _65.trim, 'call', _66 => _66()])).length;
2987
3028
  if (filled / t.rows >= 0.3) dense.push(c);
2988
3029
  }
2989
3030
  if (dense.length !== 2) return false;
2990
3031
  for (const c of dense) {
2991
- const lens = t.cells.map((row) => _nullishCoalesce(_optionalChain([row, 'access', _63 => _63[c], 'optionalAccess', _64 => _64.text, 'access', _65 => _65.replace, 'call', _66 => _66(/\s+/g, ""), 'access', _67 => _67.length]), () => ( 0))).filter((n) => n > 0);
3032
+ const lens = t.cells.map((row) => _nullishCoalesce(_optionalChain([row, 'access', _67 => _67[c], 'optionalAccess', _68 => _68.text, 'access', _69 => _69.replace, 'call', _70 => _70(/\s+/g, ""), 'access', _71 => _71.length]), () => ( 0))).filter((n) => n > 0);
2992
3033
  const avg = lens.reduce((s, v) => s + v, 0) / (lens.length || 1);
2993
3034
  if (avg < 12) return false;
2994
3035
  }
@@ -3463,7 +3504,7 @@ function buildClusterTable(rows, columns, pageNum) {
3463
3504
  const nonEmptyCols = cells[r].filter((c) => c.text.trim()).length;
3464
3505
  if (nonEmptyCols !== 1) continue;
3465
3506
  if (cells[r][0].text.trim() !== "") continue;
3466
- const contentText = _optionalChain([cells, 'access', _68 => _68[r], 'access', _69 => _69.find, 'call', _70 => _70((c) => c.text.trim()), 'optionalAccess', _71 => _71.text, 'access', _72 => _72.trim, 'call', _73 => _73()]) || "";
3507
+ const contentText = _optionalChain([cells, 'access', _72 => _72[r], 'access', _73 => _73.find, 'call', _74 => _74((c) => c.text.trim()), 'optionalAccess', _75 => _75.text, 'access', _76 => _76.trim, 'call', _77 => _77()]) || "";
3467
3508
  if (/^[○●▶\-·]/.test(contentText)) continue;
3468
3509
  for (let pr = r - 1; pr >= 0; pr--) {
3469
3510
  if (cells[pr].some((c) => c.text.trim())) {
@@ -3852,14 +3893,14 @@ function isProseSpread(items) {
3852
3893
  for (let i = 1; i < sorted.length; i++) {
3853
3894
  gaps.push(sorted[i].x - (sorted[i - 1].x + sorted[i - 1].w));
3854
3895
  }
3855
- const maxGap = _chunkVGU4FLLDcjs.safeMax.call(void 0, gaps);
3896
+ const maxGap = _chunkNJGA67VCcjs.safeMax.call(void 0, gaps);
3856
3897
  const avgLen = items.reduce((s, i) => s + i.text.length, 0) / items.length;
3857
3898
  return maxGap < 40 && avgLen < 5;
3858
3899
  }
3859
3900
  function detectColumns(yLines) {
3860
3901
  const allItems = yLines.flat();
3861
3902
  if (allItems.length === 0) return null;
3862
- const pageWidth = _chunkVGU4FLLDcjs.safeMax.call(void 0, allItems.map((i) => i.x + i.w)) - _chunkVGU4FLLDcjs.safeMin.call(void 0, allItems.map((i) => i.x));
3903
+ const pageWidth = _chunkNJGA67VCcjs.safeMax.call(void 0, allItems.map((i) => i.x + i.w)) - _chunkNJGA67VCcjs.safeMin.call(void 0, allItems.map((i) => i.x));
3863
3904
  if (pageWidth < 100) return null;
3864
3905
  let bigoLineIdx = -1;
3865
3906
  for (let i = 0; i < yLines.length; i++) {
@@ -4187,7 +4228,7 @@ function extractPageBlocksWithLines(items, pageNum, opList, pageWidth, pageHeigh
4187
4228
  for (const line of streamLines(items)) lex.addLine(mergeLineSimple(line));
4188
4229
  const extracted = extractLines(opList.fnArray, opList.argsArray);
4189
4230
  let { horizontals, verticals } = extracted;
4190
- const prevPage = _optionalChain([carry, 'optionalAccess', _74 => _74.page]) === pageNum - 1 ? carry.clip : void 0;
4231
+ const prevPage = _optionalChain([carry, 'optionalAccess', _78 => _78.page]) === pageNum - 1 ? carry.clip : void 0;
4191
4232
  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 };
4192
4233
  if (carry) {
4193
4234
  carry.page = pageNum;
@@ -4517,7 +4558,7 @@ function extractBlocksWithGrids(items, pageNum, grids, horizontals, verticals, i
4517
4558
  if (gutterX !== null) {
4518
4559
  const gx = gutterX;
4519
4560
  const allY = remaining.map((i) => i.y);
4520
- const pageH = _chunkVGU4FLLDcjs.safeMax.call(void 0, allY) - _chunkVGU4FLLDcjs.safeMin.call(void 0, allY);
4561
+ const pageH = _chunkNJGA67VCcjs.safeMax.call(void 0, allY) - _chunkNJGA67VCcjs.safeMin.call(void 0, allY);
4521
4562
  const gapThreshold = Math.max(15, pageH * 0.03);
4522
4563
  const sides = [
4523
4564
  remaining.filter((i) => i.x + i.w <= gx),
@@ -4537,7 +4578,7 @@ function extractBlocksWithGrids(items, pageNum, grids, horizontals, verticals, i
4537
4578
  finalTextBlocks = detectListBlocks(textBlocks);
4538
4579
  } else {
4539
4580
  const allY = remaining.map((i) => i.y);
4540
- const pageH = _chunkVGU4FLLDcjs.safeMax.call(void 0, allY) - _chunkVGU4FLLDcjs.safeMin.call(void 0, allY);
4581
+ const pageH = _chunkNJGA67VCcjs.safeMax.call(void 0, allY) - _chunkNJGA67VCcjs.safeMin.call(void 0, allY);
4541
4582
  const groups = xyCutOrder(remaining, Math.max(15, pageH * 0.03));
4542
4583
  const textBlocks = [];
4543
4584
  for (const group of groups) {
@@ -4671,7 +4712,7 @@ function pushLineParagraphs(out, yLines, pageNum, lex) {
4671
4712
  const lines = yLines.map((items) => ({ items, text: mergeLineSimple(items) })).filter((l) => l.text.trim());
4672
4713
  const geo = lines.map((l) => {
4673
4714
  const b = computeBBox(l.items, pageNum);
4674
- 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', _75 => _75(l.items), 'optionalAccess', _76 => _76.fontSize]), () => ( 0)) };
4715
+ 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', _79 => _79(l.items), 'optionalAccess', _80 => _80.fontSize]), () => ( 0)) };
4675
4716
  });
4676
4717
  const joins = bodyLineJoins(geo, lex);
4677
4718
  for (let i = 0; i < lines.length; ) {
@@ -4732,7 +4773,7 @@ function extractPageBlocksFallback(items, pageNum, fullPage = false, detectTable
4732
4773
  blocks.push({ type: "paragraph", text: tableText, pageNumber: pageNum, bbox, style: dominantStyle(items) });
4733
4774
  } else {
4734
4775
  const allY = items.map((i) => i.y);
4735
- const pageHeight = _chunkVGU4FLLDcjs.safeMax.call(void 0, allY) - _chunkVGU4FLLDcjs.safeMin.call(void 0, allY);
4776
+ const pageHeight = _chunkNJGA67VCcjs.safeMax.call(void 0, allY) - _chunkNJGA67VCcjs.safeMin.call(void 0, allY);
4736
4777
  const gapThreshold = Math.max(15, pageHeight * 0.03);
4737
4778
  const orderedGroups = proseCutX !== null ? splitTwoColumnProse(items, proseCutX) : xyCutOrder(items, gapThreshold);
4738
4779
  for (const group of orderedGroups) {
@@ -4776,4 +4817,4 @@ function extractPageBlocksFallback(items, pageNum, fullPage = false, detectTable
4776
4817
 
4777
4818
 
4778
4819
  exports.extractImageRegions = extractImageRegions; exports.filterHiddenText = filterHiddenText; exports.collapseEvenSpacing = collapseEvenSpacing; exports.normalizeItems = normalizeItems; exports.WrapLexicon = WrapLexicon; exports.wrapJoiner = wrapJoiner; exports.joinPageBreakWraps = joinPageBreakWraps; exports.computeMedianFontSizeFromFreq = computeMedianFontSizeFromFreq; exports.detectHeadings = detectHeadings; 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;
4779
- //# sourceMappingURL=chunk-VSI5SRP2.cjs.map
4820
+ //# sourceMappingURL=chunk-5HHU64LY.cjs.map