kordoc 4.24.21 → 4.24.23

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 (127) hide show
  1. package/README.md +7 -7
  2. package/dist/{-IS4RXPEZ.js → -POV3PVKW.js} +11 -11
  3. package/dist/{chunk-3RVASM4C.js → chunk-2NINEUJ5.js} +4 -4
  4. package/dist/{chunk-MMZUWRH6.js → chunk-2Q4ZLQQJ.js} +11 -11
  5. package/dist/{chunk-BV2YG7M6.js → chunk-2S4WERRK.js} +2 -2
  6. package/dist/{chunk-PDOWSDNM.js → chunk-2UNY7AKC.js} +2 -2
  7. package/dist/{chunk-F4GZFIUJ.js → chunk-3QWZCQI6.js} +2 -2
  8. package/dist/{chunk-E6G4B457.js → chunk-5L32QFLQ.js} +2 -2
  9. package/dist/{chunk-MYDHNNPA.js → chunk-6OG6WPA3.js} +43 -8
  10. package/dist/chunk-6OG6WPA3.js.map +1 -0
  11. package/dist/{chunk-NRCG3ASU.js → chunk-7JFJPFME.js} +2 -2
  12. package/dist/{chunk-WVZSTMCZ.cjs → chunk-7OZLM5MR.cjs} +3 -3
  13. package/dist/{chunk-WVZSTMCZ.cjs.map → chunk-7OZLM5MR.cjs.map} +1 -1
  14. package/dist/{chunk-V7S36XCU.cjs → chunk-AABI2ELF.cjs} +3 -3
  15. package/dist/{chunk-V7S36XCU.cjs.map → chunk-AABI2ELF.cjs.map} +1 -1
  16. package/dist/{chunk-O5ZCJEZ4.js → chunk-AXBEO5NB.js} +2 -2
  17. package/dist/{chunk-L556KKBU.cjs → chunk-HJ5YI5E6.cjs} +79 -79
  18. package/dist/{chunk-L556KKBU.cjs.map → chunk-HJ5YI5E6.cjs.map} +1 -1
  19. package/dist/{chunk-B3POEH7X.js → chunk-JDDKQD7W.js} +2 -2
  20. package/dist/{chunk-IZN5BTCW.js → chunk-NBETHWJH.js} +2 -2
  21. package/dist/{chunk-4OF7DHIT.js → chunk-NRPLZ4NO.js} +4 -4
  22. package/dist/{chunk-F6OHQLN7.js → chunk-NWNL5YYK.js} +38 -7
  23. package/dist/chunk-NWNL5YYK.js.map +1 -0
  24. package/dist/{chunk-NE75RO62.js → chunk-PG7OI72B.js} +2 -2
  25. package/dist/{chunk-BNEKESI4.js → chunk-QMAWEM4N.js} +2 -2
  26. package/dist/{chunk-MGCIQ43Y.js → chunk-SLS65M44.js} +3 -3
  27. package/dist/{chunk-BTBFKDPH.js → chunk-SYJZYHBB.js} +2 -2
  28. package/dist/{chunk-B5M676H3.cjs → chunk-T7Z554HT.cjs} +6 -6
  29. package/dist/{chunk-B5M676H3.cjs.map → chunk-T7Z554HT.cjs.map} +1 -1
  30. package/dist/{chunk-BUFGW3UJ.cjs → chunk-TBGNGQ2O.cjs} +213 -182
  31. package/dist/chunk-TBGNGQ2O.cjs.map +1 -0
  32. package/dist/{chunk-CPVXUEKF.js → chunk-VK3ZZLT7.js} +2 -2
  33. package/dist/{chunk-N45RCYBL.js → chunk-VK6S3WGD.js} +3 -3
  34. package/dist/{chunk-Z6ONQ63K.js → chunk-VOLDBZDF.js} +2 -2
  35. package/dist/{chunk-WQC4XWVT.js → chunk-WTFXQGND.js} +2 -2
  36. package/dist/{chunk-BMXWY36E.js → chunk-XEYTPWCF.js} +39 -8
  37. package/dist/chunk-XEYTPWCF.js.map +1 -0
  38. package/dist/{chunk-UNYH6MTO.js → chunk-XLVQUVL4.js} +2 -2
  39. package/dist/{chunk-OMGCVZ4W.cjs → chunk-YOLFNCQQ.cjs} +2 -2
  40. package/dist/{chunk-OMGCVZ4W.cjs.map → chunk-YOLFNCQQ.cjs.map} +1 -1
  41. package/dist/chunks-SGEDTBKI.js +10 -0
  42. package/dist/cli.js +30 -30
  43. package/dist/{formula-DHBBWQLC.js → formula-7YKP7MFB.js} +3 -3
  44. package/dist/{formula-G3FQTUOY.cjs → formula-IIPZAHPY.cjs} +9 -9
  45. package/dist/{formula-G3FQTUOY.cjs.map → formula-IIPZAHPY.cjs.map} +1 -1
  46. package/dist/{formula-I4EA7ULD.js → formula-TI6JRF6D.js} +4 -4
  47. package/dist/{image-ocr-THUO6YRG.cjs → image-ocr-4FIFSQ5E.cjs} +17 -17
  48. package/dist/{image-ocr-THUO6YRG.cjs.map → image-ocr-4FIFSQ5E.cjs.map} +1 -1
  49. package/dist/{image-ocr-QUVBGNWD.js → image-ocr-JQ65V7NG.js} +9 -9
  50. package/dist/{image-ocr-5YWVBRY6.js → image-ocr-Q7ZPUDKM.js} +6 -6
  51. package/dist/index.cjs +463 -428
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.js +43 -8
  54. package/dist/index.js.map +1 -1
  55. package/dist/mcp.js +23 -23
  56. package/dist/{model-bundle-6RG5PO3R.js → model-bundle-RHZIWRK3.js} +5 -5
  57. package/dist/{models-CGYIGN6D.js → models-IX2U5E2X.js} +5 -5
  58. package/dist/{parse-worker-v2-F5NXYBU6.js → parse-worker-v2-WH2ZU73A.js} +12 -12
  59. package/dist/{parser-GJ4PKW7I.cjs → parser-HZI6SSX5.cjs} +172 -161
  60. package/dist/parser-HZI6SSX5.cjs.map +1 -0
  61. package/dist/{parser-G5QTRKII.js → parser-OSH4JPYU.js} +22 -11
  62. package/dist/parser-OSH4JPYU.js.map +1 -0
  63. package/dist/{parser-I2C5DUXC.js → parser-U2WRX53G.js} +25 -14
  64. package/dist/parser-U2WRX53G.js.map +1 -0
  65. package/dist/{pdf-ocr-U3I74Q4O.js → pdf-ocr-HUQ2RFMY.js} +9 -9
  66. package/dist/{pdf-ocr-TNW6YOPX.js → pdf-ocr-NPFRBGWJ.js} +6 -6
  67. package/dist/pdf-ocr-OA57HOVS.cjs +35 -0
  68. package/dist/{pdf-ocr-LJKCUXTE.cjs.map → pdf-ocr-OA57HOVS.cjs.map} +1 -1
  69. package/dist/{profile-io-5YZCFK7B.js → profile-io-MVJHVB5K.js} +3 -3
  70. package/dist/{rasterize-7VRHPOQX.js → rasterize-MBQRUDTT.js} +3 -3
  71. package/dist/{redact-doc-VK6VGBK3.js → redact-doc-Y6DPTTVM.js} +11 -11
  72. package/dist/{render-Y7J6DPRL.js → render-CSVVMX6Y.js} +7 -7
  73. package/dist/seal-Y7I5CXGZ.js +10 -0
  74. package/dist/{setup-4XTUDU4X.js → setup-BU2VPWG4.js} +3 -3
  75. package/dist/visual-OAJU373I.js +21 -0
  76. package/dist/{watch-SPZRLTKG.js → watch-RLLW3NTH.js} +12 -12
  77. package/package.json +1 -1
  78. package/dist/chunk-BMXWY36E.js.map +0 -1
  79. package/dist/chunk-BUFGW3UJ.cjs.map +0 -1
  80. package/dist/chunk-F6OHQLN7.js.map +0 -1
  81. package/dist/chunk-MYDHNNPA.js.map +0 -1
  82. package/dist/chunks-FYCQOIWO.js +0 -10
  83. package/dist/parser-G5QTRKII.js.map +0 -1
  84. package/dist/parser-GJ4PKW7I.cjs.map +0 -1
  85. package/dist/parser-I2C5DUXC.js.map +0 -1
  86. package/dist/pdf-ocr-LJKCUXTE.cjs +0 -35
  87. package/dist/seal-4QIZ3ZNI.js +0 -10
  88. package/dist/visual-VEMQJ52W.js +0 -21
  89. /package/dist/{-IS4RXPEZ.js.map → -POV3PVKW.js.map} +0 -0
  90. /package/dist/{chunk-3RVASM4C.js.map → chunk-2NINEUJ5.js.map} +0 -0
  91. /package/dist/{chunk-MMZUWRH6.js.map → chunk-2Q4ZLQQJ.js.map} +0 -0
  92. /package/dist/{chunk-BV2YG7M6.js.map → chunk-2S4WERRK.js.map} +0 -0
  93. /package/dist/{chunk-PDOWSDNM.js.map → chunk-2UNY7AKC.js.map} +0 -0
  94. /package/dist/{chunk-F4GZFIUJ.js.map → chunk-3QWZCQI6.js.map} +0 -0
  95. /package/dist/{chunk-E6G4B457.js.map → chunk-5L32QFLQ.js.map} +0 -0
  96. /package/dist/{chunk-NRCG3ASU.js.map → chunk-7JFJPFME.js.map} +0 -0
  97. /package/dist/{chunk-O5ZCJEZ4.js.map → chunk-AXBEO5NB.js.map} +0 -0
  98. /package/dist/{chunk-B3POEH7X.js.map → chunk-JDDKQD7W.js.map} +0 -0
  99. /package/dist/{chunk-IZN5BTCW.js.map → chunk-NBETHWJH.js.map} +0 -0
  100. /package/dist/{chunk-4OF7DHIT.js.map → chunk-NRPLZ4NO.js.map} +0 -0
  101. /package/dist/{chunk-NE75RO62.js.map → chunk-PG7OI72B.js.map} +0 -0
  102. /package/dist/{chunk-BNEKESI4.js.map → chunk-QMAWEM4N.js.map} +0 -0
  103. /package/dist/{chunk-MGCIQ43Y.js.map → chunk-SLS65M44.js.map} +0 -0
  104. /package/dist/{chunk-BTBFKDPH.js.map → chunk-SYJZYHBB.js.map} +0 -0
  105. /package/dist/{chunk-CPVXUEKF.js.map → chunk-VK3ZZLT7.js.map} +0 -0
  106. /package/dist/{chunk-N45RCYBL.js.map → chunk-VK6S3WGD.js.map} +0 -0
  107. /package/dist/{chunk-Z6ONQ63K.js.map → chunk-VOLDBZDF.js.map} +0 -0
  108. /package/dist/{chunk-WQC4XWVT.js.map → chunk-WTFXQGND.js.map} +0 -0
  109. /package/dist/{chunk-UNYH6MTO.js.map → chunk-XLVQUVL4.js.map} +0 -0
  110. /package/dist/{chunks-FYCQOIWO.js.map → chunks-SGEDTBKI.js.map} +0 -0
  111. /package/dist/{formula-DHBBWQLC.js.map → formula-7YKP7MFB.js.map} +0 -0
  112. /package/dist/{formula-I4EA7ULD.js.map → formula-TI6JRF6D.js.map} +0 -0
  113. /package/dist/{image-ocr-QUVBGNWD.js.map → image-ocr-JQ65V7NG.js.map} +0 -0
  114. /package/dist/{image-ocr-5YWVBRY6.js.map → image-ocr-Q7ZPUDKM.js.map} +0 -0
  115. /package/dist/{model-bundle-6RG5PO3R.js.map → model-bundle-RHZIWRK3.js.map} +0 -0
  116. /package/dist/{models-CGYIGN6D.js.map → models-IX2U5E2X.js.map} +0 -0
  117. /package/dist/{parse-worker-v2-F5NXYBU6.js.map → parse-worker-v2-WH2ZU73A.js.map} +0 -0
  118. /package/dist/{pdf-ocr-TNW6YOPX.js.map → pdf-ocr-HUQ2RFMY.js.map} +0 -0
  119. /package/dist/{pdf-ocr-U3I74Q4O.js.map → pdf-ocr-NPFRBGWJ.js.map} +0 -0
  120. /package/dist/{profile-io-5YZCFK7B.js.map → profile-io-MVJHVB5K.js.map} +0 -0
  121. /package/dist/{rasterize-7VRHPOQX.js.map → rasterize-MBQRUDTT.js.map} +0 -0
  122. /package/dist/{redact-doc-VK6VGBK3.js.map → redact-doc-Y6DPTTVM.js.map} +0 -0
  123. /package/dist/{render-Y7J6DPRL.js.map → render-CSVVMX6Y.js.map} +0 -0
  124. /package/dist/{seal-4QIZ3ZNI.js.map → seal-Y7I5CXGZ.js.map} +0 -0
  125. /package/dist/{setup-4XTUDU4X.js.map → setup-BU2VPWG4.js.map} +0 -0
  126. /package/dist/{visual-VEMQJ52W.js.map → visual-OAJU373I.js.map} +0 -0
  127. /package/dist/{watch-SPZRLTKG.js.map → watch-RLLW3NTH.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
2
2
 
3
3
 
4
- var _chunkWVZSTMCZcjs = require('./chunk-WVZSTMCZ.cjs');
4
+ var _chunk7OZLM5MRcjs = require('./chunk-7OZLM5MR.cjs');
5
5
 
6
6
 
7
7
 
@@ -61,7 +61,7 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
61
61
 
62
62
 
63
63
 
64
- var _chunkBUFGW3UJcjs = require('./chunk-BUFGW3UJ.cjs');
64
+ var _chunkTBGNGQ2Ocjs = require('./chunk-TBGNGQ2O.cjs');
65
65
 
66
66
 
67
67
 
@@ -79,12 +79,12 @@ var _chunkBUFGW3UJcjs = require('./chunk-BUFGW3UJ.cjs');
79
79
 
80
80
 
81
81
 
82
- var _chunkB5M676H3cjs = require('./chunk-B5M676H3.cjs');
83
- require('./chunk-V7S36XCU.cjs');
82
+ var _chunkT7Z554HTcjs = require('./chunk-T7Z554HT.cjs');
83
+ require('./chunk-AABI2ELF.cjs');
84
84
 
85
85
 
86
86
 
87
- var _chunkOMGCVZ4Wcjs = require('./chunk-OMGCVZ4W.cjs');
87
+ var _chunkYOLFNCQQcjs = require('./chunk-YOLFNCQQ.cjs');
88
88
 
89
89
 
90
90
  var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
@@ -221,7 +221,7 @@ async function extractPageImages(page, fnArray, argsArray, pageNumber, state, wa
221
221
  const filename = `image_${String(state.imageIndex).padStart(3, "0")}.png`;
222
222
  state.seen.set(hash, filename);
223
223
  if (withBytes) {
224
- const png = _chunkWVZSTMCZcjs.encodePng.call(void 0, w, h, rgba);
224
+ const png = _chunk7OZLM5MRcjs.encodePng.call(void 0, w, h, rgba);
225
225
  state.totalBytes += png.length;
226
226
  images.push({ filename, data: png, mimeType: "image/png" });
227
227
  }
@@ -617,13 +617,13 @@ function ocrVectorOps(opList, paths) {
617
617
 
618
618
  // src/pdf/split-row-pattern.ts
619
619
  var textOf = (cell) => cell.text.replace(/<\/?u>|~~/g, "").trim();
620
- var plain = (cell) => !_optionalChain([cell, 'access', _9 => _9.blocks, 'optionalAccess', _10 => _10.length]) && !_chunkBUFGW3UJcjs.IMAGE_CELLS.has(cell);
620
+ var plain = (cell) => !_optionalChain([cell, 'access', _9 => _9.blocks, 'optionalAccess', _10 => _10.length]) && !_chunkTBGNGQ2Ocjs.IMAGE_CELLS.has(cell);
621
621
  var labelsOf = (cell) => {
622
622
  const labels = textOf(cell).split("\n").map((s) => s.trim()).filter(Boolean);
623
623
  return labels.length && labels.every((s) => /^\p{L}[\p{L}\p{N} ]{0,15}[::]$/u.test(s)) ? labels.map((s) => s.replace(/\s+/g, "").replace(/:/g, ":")) : void 0;
624
624
  };
625
625
  var alignedLabels = (label, value, count) => {
626
- const L = _chunkBUFGW3UJcjs.CELL_LINES.get(label), V = _chunkBUFGW3UJcjs.CELL_LINES.get(value);
626
+ const L = _chunkTBGNGQ2Ocjs.CELL_LINES.get(label), V = _chunkTBGNGQ2Ocjs.CELL_LINES.get(value);
627
627
  let next = 0;
628
628
  return !!L && !!V && L.length === count && V.length >= count && Math.abs(L[0].y - V[0].y) <= 1 && L.every((l) => {
629
629
  while (next < V.length && Math.abs(l.y - V[next].y) > 1) next++;
@@ -631,7 +631,7 @@ var alignedLabels = (label, value, count) => {
631
631
  });
632
632
  };
633
633
  function partialAlignedLabelCells(table, owner, first) {
634
- const pageOf = (a) => _nullishCoalesce(_chunkB5M676H3cjs.CELL_PAGES.get(_nullishCoalesce(a.cell, () => ( table.cells[a.r][a.c]))), () => ( (a.r < first ? -1 : -2)));
634
+ const pageOf = (a) => _nullishCoalesce(_chunkT7Z554HTcjs.CELL_PAGES.get(_nullishCoalesce(a.cell, () => ( table.cells[a.r][a.c]))), () => ( (a.r < first ? -1 : -2)));
635
635
  const pairs = [];
636
636
  let carried = false;
637
637
  for (let c = 0; c < table.cols; ) {
@@ -654,10 +654,10 @@ function partialAlignedLabelCells(table, owner, first) {
654
654
  const keyed = pairs.filter((p) => labelsOf(p.upper) && labelsOf(p.lower));
655
655
  if (keyed.length !== 1) return;
656
656
  const label = keyed[0], value = pairs.find((p) => p.c === label.c + label.cs), context = pairs.find((p) => p.c + p.cs === label.c);
657
- if (!value || !context || value === context || textOf(context.upper).replace(/\s+/g, "") === textOf(context.lower).replace(/\s+/g, "") || !_optionalChain([_chunkB5M676H3cjs.CELL_EDGES, 'access', _21 => _21.get, 'call', _22 => _22(context.upper), 'optionalAccess', _23 => _23.b]) || !_optionalChain([_chunkB5M676H3cjs.CELL_EDGES, 'access', _24 => _24.get, 'call', _25 => _25(context.lower), 'optionalAccess', _26 => _26.t])) return;
657
+ if (!value || !context || value === context || textOf(context.upper).replace(/\s+/g, "") === textOf(context.lower).replace(/\s+/g, "") || !_optionalChain([_chunkT7Z554HTcjs.CELL_EDGES, 'access', _21 => _21.get, 'call', _22 => _22(context.upper), 'optionalAccess', _23 => _23.b]) || !_optionalChain([_chunkT7Z554HTcjs.CELL_EDGES, 'access', _24 => _24.get, 'call', _25 => _25(context.lower), 'optionalAccess', _26 => _26.t])) return;
658
658
  const U = labelsOf(label.upper), D = labelsOf(label.lower), sequence = [...U, ...D];
659
659
  if (D.length < 2 || sequence.length < 3 || new Set(sequence).size !== sequence.length || !alignedLabels(label.upper, value.upper, U.length)) return;
660
- const L = _chunkBUFGW3UJcjs.CELL_LINES.get(label.lower), V = _chunkBUFGW3UJcjs.CELL_LINES.get(value.lower);
660
+ const L = _chunkTBGNGQ2Ocjs.CELL_LINES.get(label.lower), V = _chunkTBGNGQ2Ocjs.CELL_LINES.get(value.lower);
661
661
  if (!L || !V || L.length !== D.length) return;
662
662
  let next = V.findIndex((v) => Math.abs(v.y - L[0].y) <= 1);
663
663
  if (next <= 0 || !V.slice(0, next).every((v) => v.y > L[0].y + 1) || !L.every((l) => {
@@ -677,14 +677,14 @@ function partialAlignedLabelCells(table, owner, first) {
677
677
  continue;
678
678
  }
679
679
  if (list.length < 3 || new Set(list).size !== list.length) continue;
680
- const visible = _nullishCoalesce(_optionalChain([_chunkBUFGW3UJcjs.CELL_LINES, 'access', _31 => _31.get, 'call', _32 => _32(lc), 'optionalAccess', _33 => _33.length]), () => ( 0)), values = _chunkBUFGW3UJcjs.CELL_LINES.get(vc);
680
+ const visible = _nullishCoalesce(_optionalChain([_chunkTBGNGQ2Ocjs.CELL_LINES, 'access', _31 => _31.get, 'call', _32 => _32(lc), 'optionalAccess', _33 => _33.length]), () => ( 0)), values = _chunkTBGNGQ2Ocjs.CELL_LINES.get(vc);
681
681
  if (visible < 3 || visible > list.length || !values || !alignedLabels(lc, vc, visible)) continue;
682
682
  const top = Math.max(...values.map((v2) => v2.y)), bottom = Math.min(...values.map((v2) => v2.y));
683
683
  const contexts = [];
684
684
  for (let rr = r; rr < r + l.rs && rr < table.rows; rr++) {
685
685
  const a = _optionalChain([owner, 'access', _34 => _34[rr], 'optionalAccess', _35 => _35[context.c]]), cell = a ? table.cells[a.r][a.c] : void 0;
686
686
  if (!a || a.r !== rr || a.c !== context.c || a.cs !== context.cs || a.rs !== 1 || !cell || !plain(cell) || !textOf(cell) || pageOf(a) !== pageOf(l)) break;
687
- const lines = _chunkBUFGW3UJcjs.CELL_LINES.get(cell);
687
+ const lines = _chunkTBGNGQ2Ocjs.CELL_LINES.get(cell);
688
688
  if (!_optionalChain([lines, 'optionalAccess', _36 => _36.length]) || lines.some((line) => line.y > top + 1 || line.y < bottom - 1)) break;
689
689
  contexts.push(textOf(cell).replace(/\s+/g, ""));
690
690
  }
@@ -986,7 +986,7 @@ function rowStarts(t) {
986
986
  }
987
987
  var covering = (t, r) => rowStarts(t).slice(0, r + 1).flatMap((starts, rr) => starts.filter((s) => rr + s.cell.rowSpan > r).map((s) => s.cell));
988
988
  function cellPage(cell) {
989
- const p = _chunkB5M676H3cjs.CELL_PAGES.get(cell);
989
+ const p = _chunkT7Z554HTcjs.CELL_PAGES.get(cell);
990
990
  if (p !== void 0 || !_optionalChain([cell, 'access', _103 => _103.blocks, 'optionalAccess', _104 => _104.length]) || cell.blocks.some((b) => b.pageNumber === void 0)) return p;
991
991
  return Math.min(...cell.blocks.map((b) => b.pageNumber));
992
992
  }
@@ -1015,7 +1015,7 @@ function markJoinedPages(table, prev, curr) {
1015
1015
  rows.forEach((starts, r) => {
1016
1016
  const page2 = r < pt.rows ? pp[r] : cp[r - off];
1017
1017
  for (const { cell } of starts) {
1018
- if (page2 !== void 0 && page2 !== prev.pageNumber) _chunkB5M676H3cjs.CELL_PAGES.set(cell, page2);
1018
+ if (page2 !== void 0 && page2 !== prev.pageNumber) _chunkT7Z554HTcjs.CELL_PAGES.set(cell, page2);
1019
1019
  const src = _optionalChain([(r < pt.rows ? ptRows[r] : ctRows[r - off]), 'optionalAccess', _107 => _107.find, 'call', _108 => _108((s) => s.cell !== cell && s.cell.text === cell.text && CELL_SPLITS.has(s.cell))]);
1020
1020
  if (src) setSplits(cell, relocate(src.cell, cell));
1021
1021
  }
@@ -1075,8 +1075,8 @@ function splitCrossPageRows(t, pageNumber) {
1075
1075
  if (!splits.length) continue;
1076
1076
  const clone = (cell, patch) => {
1077
1077
  const out = { ...cell, ...patch };
1078
- const p = _chunkB5M676H3cjs.CELL_PAGES.get(cell);
1079
- if (p !== void 0) _chunkB5M676H3cjs.CELL_PAGES.set(out, p);
1078
+ const p = _chunkT7Z554HTcjs.CELL_PAGES.get(cell);
1079
+ if (p !== void 0) _chunkT7Z554HTcjs.CELL_PAGES.set(out, p);
1080
1080
  if (!("text" in patch) && CELL_SPLITS.has(cell)) CELL_SPLITS.set(out, CELL_SPLITS.get(cell));
1081
1081
  return out;
1082
1082
  };
@@ -1087,7 +1087,7 @@ function splitCrossPageRows(t, pageNumber) {
1087
1087
  for (const { cell, c, split } of splits) {
1088
1088
  cells[r][c] = clone(cell, { ...split.head, rowSpan: cut - r });
1089
1089
  const tail = { ...cell, ...split.tail, rowSpan: r + cell.rowSpan - cut };
1090
- _chunkB5M676H3cjs.CELL_PAGES.set(tail, split.page);
1090
+ _chunkT7Z554HTcjs.CELL_PAGES.set(tail, split.page);
1091
1091
  setSplits(tail, split.rest);
1092
1092
  cells[cut][c] = tail;
1093
1093
  }
@@ -1097,7 +1097,7 @@ function splitCrossPageRows(t, pageNumber) {
1097
1097
  for (const { cell, c, split } of splits) {
1098
1098
  cells[r][c] = clone(cell, split.head);
1099
1099
  const tail = { ...cell, ...split.tail, rowSpan: 1 };
1100
- _chunkB5M676H3cjs.CELL_PAGES.set(tail, split.page);
1100
+ _chunkT7Z554HTcjs.CELL_PAGES.set(tail, split.page);
1101
1101
  setSplits(tail, split.rest);
1102
1102
  row[c] = tail;
1103
1103
  }
@@ -1188,7 +1188,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
1188
1188
  if (cols < 1) return null;
1189
1189
  const pa = anchorsOf(prev), ca = anchorsOf(curr);
1190
1190
  const cutOpen = (() => {
1191
- const u = _chunkBUFGW3UJcjs.ROW_RULES.get(prev), d = _chunkBUFGW3UJcjs.ROW_RULES.get(curr);
1191
+ const u = _chunkTBGNGQ2Ocjs.ROW_RULES.get(prev), d = _chunkTBGNGQ2Ocjs.ROW_RULES.get(curr);
1192
1192
  return !!u && !!d && !u.bottom && !d.top;
1193
1193
  })();
1194
1194
  let skip = 0, head = 0;
@@ -1220,19 +1220,19 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
1220
1220
  if (r + dr < rows) owner[r + dr][dc] = placed;
1221
1221
  }
1222
1222
  grid[r][c1] = { ...a.cell, colSpan: c2 - c1, rowSpan: a.rs };
1223
- const lines = _chunkBUFGW3UJcjs.CELL_LINES.get(a.cell);
1224
- if (lines) _chunkBUFGW3UJcjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
1225
- if (_chunkBUFGW3UJcjs.IMAGE_CELLS.has(a.cell)) _chunkBUFGW3UJcjs.IMAGE_CELLS.add(grid[r][c1]);
1226
- const edges = _chunkB5M676H3cjs.CELL_EDGES.get(a.cell);
1223
+ const lines = _chunkTBGNGQ2Ocjs.CELL_LINES.get(a.cell);
1224
+ if (lines) _chunkTBGNGQ2Ocjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
1225
+ if (_chunkTBGNGQ2Ocjs.IMAGE_CELLS.has(a.cell)) _chunkTBGNGQ2Ocjs.IMAGE_CELLS.add(grid[r][c1]);
1226
+ const edges = _chunkT7Z554HTcjs.CELL_EDGES.get(a.cell);
1227
1227
  if (edges) {
1228
- _chunkB5M676H3cjs.CELL_EDGES.set(grid[r][c1], edges);
1228
+ _chunkT7Z554HTcjs.CELL_EDGES.set(grid[r][c1], edges);
1229
1229
  edged = true;
1230
1230
  }
1231
1231
  return true;
1232
1232
  };
1233
- for (const a of pa) if (!_chunkBUFGW3UJcjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
1233
+ for (const a of pa) if (!_chunkTBGNGQ2Ocjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
1234
1234
  for (const a of ca) {
1235
- if (a.r < skip || _chunkBUFGW3UJcjs.FILLER_CELLS.has(a.cell)) continue;
1235
+ if (a.r < skip || _chunkTBGNGQ2Ocjs.FILLER_CELLS.has(a.cell)) continue;
1236
1236
  if (!place(a, cxU, prev.rows - skip, dx)) return null;
1237
1237
  }
1238
1238
  const first = prev.rows;
@@ -1256,9 +1256,9 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
1256
1256
  const grown = { ...above, rs: newRs };
1257
1257
  for (let rr = above.r; rr < above.r + newRs; rr++) for (let dc = above.c; dc < above.c + above.cs; dc++) owner[rr][dc] = grown;
1258
1258
  }
1259
- for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkBUFGW3UJcjs.FILLER_CELLS.add(grid[r][c]);
1259
+ for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkTBGNGQ2Ocjs.FILLER_CELLS.add(grid[r][c]);
1260
1260
  if (edged) {
1261
- for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkB5M676H3cjs.CELL_EDGES.set(grid[r][c], _chunkBUFGW3UJcjs.NO_EDGES);
1261
+ for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkT7Z554HTcjs.CELL_EDGES.set(grid[r][c], _chunkTBGNGQ2Ocjs.NO_EDGES);
1262
1262
  }
1263
1263
  for (let c = 0; c < cols && U[c + 1] <= pcx[0] + PART_COL_TOL; c++) {
1264
1264
  let r = prev.rows;
@@ -1267,7 +1267,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
1267
1267
  for (let rr = 0; rr < r; rr++) owner[rr][c] = through;
1268
1268
  }
1269
1269
  const table = { rows, cols, cells: grid, hasHeader: prev.hasHeader, ...prev.caption ? { caption: prev.caption } : {} };
1270
- const pr = _chunkBUFGW3UJcjs.ROW_RULES.get(prev), cr = _chunkBUFGW3UJcjs.ROW_RULES.get(curr);
1270
+ const pr = _chunkTBGNGQ2Ocjs.ROW_RULES.get(prev), cr = _chunkTBGNGQ2Ocjs.ROW_RULES.get(curr);
1271
1271
  const shifted = dx !== 0;
1272
1272
  const cut = {
1273
1273
  open: !!pr && !!cr && !pr.bottom && !cr.top && pr.innerOpen + cr.innerOpen === 0 && pr.innerRuled + cr.innerRuled > 0,
@@ -1275,13 +1275,13 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
1275
1275
  list: !shifted ? "any" : skip > 0 && ca.filter((a) => a.r < skip && a.cell.text.trim()).length < 2 ? "none" : "multi"
1276
1276
  };
1277
1277
  let partial = !skip && cols === prev.cols && cols === curr.cols && cut.ruled && prevBottom !== void 0 ? partialAlignedLabelCells(table, owner, first) : void 0;
1278
- if (partial && (continuesAcross(partial.context.upper, partial.context.lower, U[partial.context.c], U[partial.context.c + partial.context.cs]) || clauseContinues(partial.context.upper, partial.context.lower) || quantityContinues(partial.context.upper, partial.context.lower) || !continuesAcross(partial.value.upper, partial.value.lower, U[partial.value.c], U[partial.value.c + partial.value.cs]) || _chunkBUFGW3UJcjs.startsNewItem.call(void 0, partial.value.upper.text, partial.value.lower.text))) partial = void 0;
1278
+ if (partial && (continuesAcross(partial.context.upper, partial.context.lower, U[partial.context.c], U[partial.context.c + partial.context.cs]) || clauseContinues(partial.context.upper, partial.context.lower) || quantityContinues(partial.context.upper, partial.context.lower) || !continuesAcross(partial.value.upper, partial.value.lower, U[partial.value.c], U[partial.value.c + partial.value.cs]) || _chunkTBGNGQ2Ocjs.startsNewItem.call(void 0, partial.value.upper.text, partial.value.lower.text))) partial = void 0;
1279
1279
  const selected = partial ? /* @__PURE__ */ new Set([partial.label.c, partial.value.c]) : void 0;
1280
1280
  let split = !selected && rows > prev.rows && mergeSplitRow(table, owner, prev.rows, U, false, cut);
1281
1281
  if (rows > prev.rows && !split && prevBottom !== void 0 && mergeStraddlingCells(table, owner, prev.rows, prevBottom, lex, U, selected) && !selected) split = mergeSplitRow(table, owner, prev.rows, U, true, { ...cut, open: false });
1282
1282
  if (pr && cr) {
1283
1283
  const cutRuled = pr.bottom || cr.top;
1284
- _chunkBUFGW3UJcjs.ROW_RULES.set(table, { top: pr.top, bottom: cr.bottom, innerRuled: pr.innerRuled + cr.innerRuled + (!split && cutRuled ? 1 : 0), innerOpen: pr.innerOpen + cr.innerOpen + (!split && !cutRuled ? 1 : 0) });
1284
+ _chunkTBGNGQ2Ocjs.ROW_RULES.set(table, { top: pr.top, bottom: cr.bottom, innerRuled: pr.innerRuled + cr.innerRuled + (!split && cutRuled ? 1 : 0), innerOpen: pr.innerOpen + cr.innerOpen + (!split && !cutRuled ? 1 : 0) });
1285
1285
  }
1286
1286
  return { table, colXs: U, split, header: ca.filter((a) => a.r < skip && a.cell.text.trim()).length >= 2 };
1287
1287
  }
@@ -1343,18 +1343,18 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs, selec
1343
1343
  if (!d || d === u || u.r + u.rs - 1 !== last || d.r !== first || d.c !== u.c || d.cs !== u.cs) continue;
1344
1344
  const a = table.cells[u.r][u.c], b = table.cells[first][d.c];
1345
1345
  if (selected && !selected.has(u.c)) continue;
1346
- const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !_chunkBUFGW3UJcjs.startsNewItem.call(void 0, a.text, b.text) && continuesAcross(a, b, colXs[u.c], colXs[u.c + u.cs]);
1347
- const openSeam = hasContent(a) && hasContent(b) && _chunkBUFGW3UJcjs.hasOpenCellSeam.call(void 0, a, b) && !owner.some((row, r) => {
1346
+ const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !_chunkTBGNGQ2Ocjs.startsNewItem.call(void 0, a.text, b.text) && continuesAcross(a, b, colXs[u.c], colXs[u.c + u.cs]);
1347
+ const openSeam = hasContent(a) && hasContent(b) && _chunkTBGNGQ2Ocjs.hasOpenCellSeam.call(void 0, a, b) && !owner.some((row, r) => {
1348
1348
  if (!r || r === first) return false;
1349
1349
  const up = owner[r - 1][u.c], down = row[u.c];
1350
1350
  if (!up || !down || up === down || up.c !== u.c || down.c !== u.c || up.cs !== u.cs || down.cs !== u.cs) return false;
1351
- const ue = _chunkB5M676H3cjs.CELL_EDGES.get(table.cells[up.r][up.c]), de = _chunkB5M676H3cjs.CELL_EDGES.get(table.cells[down.r][down.c]);
1351
+ const ue = _chunkT7Z554HTcjs.CELL_EDGES.get(table.cells[up.r][up.c]), de = _chunkT7Z554HTcjs.CELL_EDGES.get(table.cells[down.r][down.c]);
1352
1352
  return !!ue && !!de && !ue.b && !de.t;
1353
1353
  });
1354
1354
  if (!selected && !openSeam && !flowsOn && !crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
1355
1355
  if (!straddles && !midWord) continue;
1356
1356
  if (u.r >= last && d.rs < 2) continue;
1357
- const U = _chunkBUFGW3UJcjs.CELL_LINES.get(a);
1357
+ const U = _chunkTBGNGQ2Ocjs.CELL_LINES.get(a);
1358
1358
  if (!_optionalChain([U, 'optionalAccess', _134 => _134.length]) || !hasContent(b)) continue;
1359
1359
  if (!(straddles && filledToBottom(U, prevBottom) && clauseContinues(a, b))) {
1360
1360
  if (U.length > STRADDLE_MAX_LINES) continue;
@@ -1372,7 +1372,7 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs, selec
1372
1372
  return merged;
1373
1373
  }
1374
1374
  function longLastLine(c) {
1375
- const L = _chunkBUFGW3UJcjs.CELL_LINES.get(c), l = _optionalChain([L, 'optionalAccess', _135 => _135[L.length - 1]]);
1375
+ const L = _chunkTBGNGQ2Ocjs.CELL_LINES.get(c), l = _optionalChain([L, 'optionalAccess', _135 => _135[L.length - 1]]);
1376
1376
  return !!l && l.r - l.l >= 6 * (l.h || 10);
1377
1377
  }
1378
1378
  function filledToBottom(U, bottom) {
@@ -1405,7 +1405,7 @@ function nextItemHead(prev, next) {
1405
1405
  return false;
1406
1406
  }
1407
1407
  function continuesAcross(u, d, x1, x2) {
1408
- const U = _chunkBUFGW3UJcjs.CELL_LINES.get(u), D = _chunkBUFGW3UJcjs.CELL_LINES.get(d);
1408
+ const U = _chunkTBGNGQ2Ocjs.CELL_LINES.get(u), D = _chunkTBGNGQ2Ocjs.CELL_LINES.get(d);
1409
1409
  if (!_optionalChain([U, 'optionalAccess', _136 => _136.length]) || !_optionalChain([D, 'optionalAccess', _137 => _137.length])) return false;
1410
1410
  const last = U[U.length - 1];
1411
1411
  const fs = last.h || 10;
@@ -1423,7 +1423,7 @@ function continuesAcross(u, d, x1, x2) {
1423
1423
  if (U.length === 1 && x2 - last.r > Math.max(FULL_LINE_EDGE_MIN, SINGLE_LINE_WORD_GAP * fs)) return false;
1424
1424
  const indented = last.l - minL >= HANGING_MIN * fs;
1425
1425
  if (last.r - last.l < FULL_LINE_MIN_FRAC * (indented ? x2 - last.l : x2 - x1)) return false;
1426
- const newItem = _chunkBUFGW3UJcjs.startsNewItem.call(void 0, u.text, d.text);
1426
+ const newItem = _chunkTBGNGQ2Ocjs.startsNewItem.call(void 0, u.text, d.text);
1427
1427
  const all = D.length ? U.concat(D) : U;
1428
1428
  const leftAligned = (l) => maxR - l.r > SHORT_LINE_GAP * fs && (l.l - minL <= fs || !newItem && all.some((o) => o !== l && Math.abs(o.l - l.l) <= HANGING_TOL && Math.abs(o.r - l.r) >= HANGING_MIN * fs));
1429
1429
  const hanging = U.length >= 2 && U.every((l) => maxR - l.r <= FULL_LINE_TOL * fs) && indented && Math.abs(D[0].l - last.l) <= HANGING_TOL;
@@ -1440,10 +1440,10 @@ function outlineContinues(u, d) {
1440
1440
  return U.length >= 2 && D.length >= 1 && U.some((l) => OUTLINE_HEAD.test(l)) && OUTLINE_ITEM.test(D[0]);
1441
1441
  }
1442
1442
  function lineEnded(c, x1, x2, next) {
1443
- const L = _chunkBUFGW3UJcjs.CELL_LINES.get(c);
1443
+ const L = _chunkTBGNGQ2Ocjs.CELL_LINES.get(c);
1444
1444
  if (!L || L.length !== 1) return false;
1445
1445
  const l = L[0], h = l.h || 10;
1446
- const d0 = next ? _optionalChain([_chunkBUFGW3UJcjs.CELL_LINES, 'access', _138 => _138.get, 'call', _139 => _139(next), 'optionalAccess', _140 => _140[0]]) : void 0;
1446
+ const d0 = next ? _optionalChain([_chunkTBGNGQ2Ocjs.CELL_LINES, 'access', _138 => _138.get, 'call', _139 => _139(next), 'optionalAccess', _140 => _140[0]]) : void 0;
1447
1447
  if (d0 && d0.l - l.l >= HANGING_MIN * h) return false;
1448
1448
  return x2 - l.r - (l.l - x1) >= Math.max(LABEL_ROOM, firstWordUnits(_nullishCoalesce(_optionalChain([next, 'optionalAccess', _141 => _141.text]), () => ( "")))) * h;
1449
1449
  }
@@ -1454,15 +1454,15 @@ function firstWordUnits(text) {
1454
1454
  return units;
1455
1455
  }
1456
1456
  function appendCell(a, b) {
1457
- if (_chunkBUFGW3UJcjs.IMAGE_CELLS.has(b)) _chunkBUFGW3UJcjs.IMAGE_CELLS.add(a);
1457
+ if (_chunkTBGNGQ2Ocjs.IMAGE_CELLS.has(b)) _chunkTBGNGQ2Ocjs.IMAGE_CELLS.add(a);
1458
1458
  if (_optionalChain([a, 'access', _142 => _142.blocks, 'optionalAccess', _143 => _143.length]) || _optionalChain([b, 'access', _144 => _144.blocks, 'optionalAccess', _145 => _145.length])) {
1459
1459
  const asBlocks = (c) => _optionalChain([c, 'access', _146 => _146.blocks, 'optionalAccess', _147 => _147.length]) ? c.blocks : c.text.split("\n").map((l) => l.trim()).filter(Boolean).map((text) => ({ type: "paragraph", text }));
1460
1460
  a.blocks = [...asBlocks(a), ...asBlocks(b)];
1461
1461
  }
1462
1462
  if (b.text.trim()) a.text = a.text.trim() ? a.text + "\n" + b.text : b.text;
1463
- _chunkBUFGW3UJcjs.joinCellEdges.call(void 0, a, b);
1463
+ _chunkTBGNGQ2Ocjs.joinCellEdges.call(void 0, a, b);
1464
1464
  }
1465
- var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _148 => _148.blocks, 'optionalAccess', _149 => _149.length]) || _chunkBUFGW3UJcjs.IMAGE_CELLS.has(cell);
1465
+ var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _148 => _148.blocks, 'optionalAccess', _149 => _149.length]) || _chunkTBGNGQ2Ocjs.IMAGE_CELLS.has(cell);
1466
1466
  var CLAUSE_OPEN_ENDING = /(?:하는|되는|하고|하며|하여|되어|되고|되며|이며|으며|어야|아야|여야)$/;
1467
1467
  var batchim = (ch) => {
1468
1468
  const k = ch.charCodeAt(0) - 44032;
@@ -1470,7 +1470,7 @@ var batchim = (ch) => {
1470
1470
  };
1471
1471
  function clauseContinues(u, d) {
1472
1472
  const tail = _nullishCoalesce(flowText(u.text).trim().split(/\s+/).pop(), () => ( "")), head = flowText(d.text).trim();
1473
- if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunkBUFGW3UJcjs.startsNewItem.call(void 0, u.text, head)) return false;
1473
+ if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunkTBGNGQ2Ocjs.startsNewItem.call(void 0, u.text, head)) return false;
1474
1474
  const last = tail[tail.length - 1], before = tail[tail.length - 2];
1475
1475
  return last === "\uC744" && batchim(before) || last === "\uB97C" && !batchim(before) || CLAUSE_OPEN_ENDING.test(tail);
1476
1476
  }
@@ -1478,8 +1478,8 @@ function quantityContinues(u, d) {
1478
1478
  return /\d[\d,.]*\s*(?:%|[가-힣]{1,2})?$/.test(flowText(u.text).trim()) && /^(?:미만|이상|이하|초과)(?![가-힣])/.test(flowText(d.text).trim());
1479
1479
  }
1480
1480
  function wordOverflows(u, d, x1, x2) {
1481
- const U = _chunkBUFGW3UJcjs.CELL_LINES.get(u);
1482
- if (!_optionalChain([U, 'optionalAccess', _150 => _150.length]) || _chunkBUFGW3UJcjs.startsNewItem.call(void 0, u.text, d.text)) return false;
1481
+ const U = _chunkTBGNGQ2Ocjs.CELL_LINES.get(u);
1482
+ if (!_optionalChain([U, 'optionalAccess', _150 => _150.length]) || _chunkTBGNGQ2Ocjs.startsNewItem.call(void 0, u.text, d.text)) return false;
1483
1483
  const last = U[U.length - 1], units = firstWordUnits(d.text);
1484
1484
  return units > 0 && last.r - last.l + units * (last.h || 10) > x2 - x1;
1485
1485
  }
@@ -1505,6 +1505,17 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
1505
1505
  const last = first - 1;
1506
1506
  const pairs = [];
1507
1507
  let carried = false;
1508
+ const starts = [];
1509
+ for (let c = 0; c < table.cols; ) {
1510
+ const b = owner[first][c];
1511
+ if (b && b.r === first) starts.push(b);
1512
+ c = b ? b.c + b.cs : c + 1;
1513
+ }
1514
+ const tall = starts.filter((b) => b.rs > 1 && hasContent(b.cell));
1515
+ const band = !textOnly && tall.length > 0 && starts.every((b) => b.rs > 1 || !hasContent(b.cell)) && tall.every((b) => {
1516
+ const a = owner[last][b.c];
1517
+ return !!a && a.rs > 1 && a.c === b.c && a.cs === b.cs && a.r + a.rs - 1 === last && hasContent(a.cell);
1518
+ });
1508
1519
  for (let c = 0; c < table.cols; ) {
1509
1520
  const a = owner[last][c], b = owner[first][c];
1510
1521
  if (!a && !b) {
@@ -1515,7 +1526,7 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
1515
1526
  if (!a || !b) return false;
1516
1527
  if (a !== b) {
1517
1528
  if (a.c !== b.c || a.cs !== b.cs || a.r + a.rs - 1 !== last || b.r !== first) return false;
1518
- if (b.rs > 1 && (a.rs > 1 || !hasContent(a.cell))) return false;
1529
+ if (b.rs > 1 && (a.rs > 1 || !hasContent(a.cell)) && !band) return false;
1519
1530
  pairs.push([a, b]);
1520
1531
  } else if (a.r === last && a.rs === 2) carried = true;
1521
1532
  c = a.c + a.cs;
@@ -1534,10 +1545,10 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
1534
1545
  if (cut.ruled && matchesIndependentRowPair(table, owner, first)) return false;
1535
1546
  const contentPairs = pairs.filter(([u, d]) => hasContent(u.cell) && hasContent(d.cell));
1536
1547
  const carriedSplit = !textOnly && carried && !newCell && (contentPairs.length <= 1 || contentPairs.every(([, d]) => d.rs > 1) || !cut.ruled && contentPairs.some(([u, d]) => wordOverflows(cell(u), cell(d), colXs[u.c], colXs[u.c + u.cs])));
1537
- if (!carriedSplit) {
1548
+ if (!carriedSplit && !band) {
1538
1549
  const norm = (c) => flowText(c.text).replace(/\s+/g, "");
1539
1550
  if (pairs.some(([u, d]) => hasContent(d.cell) && norm(cell(d)) !== norm(cell(u)) && lineEnded(cell(u), colXs[u.c], colXs[u.c + u.cs], cell(d)))) return false;
1540
- const oneLine = (c) => _optionalChain([_chunkBUFGW3UJcjs.CELL_LINES, 'access', _152 => _152.get, 'call', _153 => _153(c), 'optionalAccess', _154 => _154.length]) === 1;
1551
+ const oneLine = (c) => _optionalChain([_chunkTBGNGQ2Ocjs.CELL_LINES, 'access', _152 => _152.get, 'call', _153 => _153(c), 'optionalAccess', _154 => _154.length]) === 1;
1541
1552
  if (pairs.some(([u, d]) => nextItemHead(cell(u).text, cell(d).text)) && pairs.some(([u, d]) => hasContent(u.cell) && hasContent(d.cell) && oneLine(cell(u)) && oneLine(cell(d)) && norm(cell(u)) !== norm(cell(d)))) return false;
1542
1553
  if (cut.ruled && pairs.some(([u, d]) => u.rs >= 2 && hasContent(u.cell) && hasContent(d.cell) && oneLine(cell(u)) && oneLine(cell(d)) && norm(cell(u)) !== norm(cell(d)))) return false;
1543
1554
  const flows = ([u, d]) => continuesAcross(cell(u), cell(d), colXs[u.c], colXs[u.c + u.cs]) || clauseContinues(cell(u), cell(d)) || quantityContinues(cell(u), cell(d));
@@ -1630,19 +1641,19 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1630
1641
  placeJoined(blocks, i, j, joined);
1631
1642
  continue;
1632
1643
  }
1633
- if (_chunkBUFGW3UJcjs.EMPTY_PARTS.has(curr.table)) {
1644
+ if (_chunkTBGNGQ2Ocjs.EMPTY_PARTS.has(curr.table)) {
1634
1645
  blocks.splice(j, 1);
1635
1646
  i++;
1636
1647
  continue;
1637
1648
  }
1638
1649
  if (joined === null) continue;
1639
- if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunkBUFGW3UJcjs.EMPTY_PARTS.has(prev.table)) continue;
1650
+ if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunkTBGNGQ2Ocjs.EMPTY_PARTS.has(prev.table)) continue;
1640
1651
  const width = Math.max(prev.bbox.width, curr.bbox.width, 1);
1641
1652
  const leftDiff = Math.abs(prev.bbox.x - curr.bbox.x);
1642
1653
  const rightDiff = Math.abs(prev.bbox.x + prev.bbox.width - (curr.bbox.x + curr.bbox.width));
1643
1654
  if (leftDiff > width * NEIGHBOR_TABLE_EPSILON || rightDiff > width * NEIGHBOR_TABLE_EPSILON) continue;
1644
- const px = _chunkBUFGW3UJcjs.TABLE_COLXS.get(prev.table), cx = _chunkBUFGW3UJcjs.TABLE_COLXS.get(curr.table);
1645
- if (px && cx && !shiftedSame(px, cx, !_chunkBUFGW3UJcjs.CLIP_TABLES.has(prev.table) && !_chunkBUFGW3UJcjs.CLIP_TABLES.has(curr.table))) continue;
1655
+ const px = _chunkTBGNGQ2Ocjs.TABLE_COLXS.get(prev.table), cx = _chunkTBGNGQ2Ocjs.TABLE_COLXS.get(curr.table);
1656
+ if (px && cx && !shiftedSame(px, cx, !_chunkTBGNGQ2Ocjs.CLIP_TABLES.has(prev.table) && !_chunkTBGNGQ2Ocjs.CLIP_TABLES.has(curr.table))) continue;
1646
1657
  if (!px !== !cx) continue;
1647
1658
  if (!rowTextsEqual(prev.table.cells[0], curr.table.cells[0]) && sameHeadShape(prev.table.cells[0], curr.table.cells[0])) continue;
1648
1659
  let currCells = curr.table.cells;
@@ -1654,16 +1665,16 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1654
1665
  blocks.splice(j, 1);
1655
1666
  continue;
1656
1667
  }
1657
- if (px && cx && !_chunkBUFGW3UJcjs.CLIP_TABLES.has(prev.table) && !_chunkBUFGW3UJcjs.CLIP_TABLES.has(curr.table) && currCells.length < curr.table.cells.length && curr.table.cells[0].filter((c) => c.text.trim()).length >= 2 && prev.table.cells.at(-1).concat(currCells[0]).every((c) => c.rowSpan === 1 && c.colSpan === 1 && _chunkBUFGW3UJcjs.CELL_LINES.has(c))) {
1668
+ if (px && cx && !_chunkTBGNGQ2Ocjs.CLIP_TABLES.has(prev.table) && !_chunkTBGNGQ2Ocjs.CLIP_TABLES.has(curr.table) && currCells.length < curr.table.cells.length && curr.table.cells[0].filter((c) => c.text.trim()).length >= 2 && prev.table.cells.at(-1).concat(currCells[0]).every((c) => c.rowSpan === 1 && c.colSpan === 1 && _chunkTBGNGQ2Ocjs.CELL_LINES.has(c))) {
1658
1669
  const dx = px[0] - cx[0];
1659
1670
  const part = joinSplitParts(prev.table, px, curr.table, cx.map((x) => x + dx), dx, void 0, lex);
1660
1671
  if (_optionalChain([part, 'optionalAccess', _175 => _175.split]) && part.table.rows === prev.table.rows + currCells.length - 1) {
1661
1672
  const last = prev.table.rows - 1;
1662
1673
  for (let c = 0; c < part.table.cols; c++) {
1663
- const U = _chunkBUFGW3UJcjs.CELL_LINES.get(prev.table.cells[last][c]), D = _chunkBUFGW3UJcjs.CELL_LINES.get(currCells[0][c]);
1664
- _chunkBUFGW3UJcjs.CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
1674
+ const U = _chunkTBGNGQ2Ocjs.CELL_LINES.get(prev.table.cells[last][c]), D = _chunkTBGNGQ2Ocjs.CELL_LINES.get(currCells[0][c]);
1675
+ _chunkTBGNGQ2Ocjs.CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
1665
1676
  }
1666
- _chunkBUFGW3UJcjs.TABLE_COLXS.set(part.table, part.colXs);
1677
+ _chunkTBGNGQ2Ocjs.TABLE_COLXS.set(part.table, part.colXs);
1667
1678
  placeJoined(blocks, i, j, part.table);
1668
1679
  continue;
1669
1680
  }
@@ -1676,20 +1687,20 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1676
1687
  caption: prev.table.caption,
1677
1688
  ...prev.table.renderAsTable ? { renderAsTable: true } : {}
1678
1689
  };
1679
- if (_nullishCoalesce(px, () => ( cx))) _chunkBUFGW3UJcjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
1680
- if (_chunkBUFGW3UJcjs.CLIP_TABLES.has(prev.table) || _chunkBUFGW3UJcjs.CLIP_TABLES.has(curr.table)) _chunkBUFGW3UJcjs.CLIP_TABLES.add(merged);
1690
+ if (_nullishCoalesce(px, () => ( cx))) _chunkTBGNGQ2Ocjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
1691
+ if (_chunkTBGNGQ2Ocjs.CLIP_TABLES.has(prev.table) || _chunkTBGNGQ2Ocjs.CLIP_TABLES.has(curr.table)) _chunkTBGNGQ2Ocjs.CLIP_TABLES.add(merged);
1681
1692
  placeJoined(blocks, i, j, merged);
1682
1693
  }
1683
1694
  for (let i = blocks.length - 1; i >= 0; i--) {
1684
1695
  const t = blocks[i].table;
1685
- if (blocks[i].type === "table" && t && _chunkBUFGW3UJcjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
1696
+ if (blocks[i].type === "table" && t && _chunkTBGNGQ2Ocjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
1686
1697
  }
1687
1698
  }
1688
1699
  function mergeColumnFlow(blocks, pageHeights, lex) {
1689
1700
  if (!pageHeights) return;
1690
1701
  for (let i = 0; i < blocks.length; i++) {
1691
1702
  const L = blocks[i];
1692
- if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkBUFGW3UJcjs.CLIP_TABLES.has(L.table) || _chunkBUFGW3UJcjs.EMPTY_PARTS.has(L.table)) continue;
1703
+ if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkTBGNGQ2Ocjs.CLIP_TABLES.has(L.table) || _chunkTBGNGQ2Ocjs.EMPTY_PARTS.has(L.table)) continue;
1693
1704
  const ph = pageHeights.get(L.pageNumber);
1694
1705
  if (!ph || L.bbox.y > ph * PAGE_EDGE_BAND) continue;
1695
1706
  let s0 = i, s1 = i;
@@ -1718,8 +1729,8 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
1718
1729
  }
1719
1730
  function joinClipParts(prev, curr, pageHeights, lex) {
1720
1731
  const pt = prev.table, ct = curr.table;
1721
- if (!_chunkBUFGW3UJcjs.CLIP_TABLES.has(pt) || !_chunkBUFGW3UJcjs.CLIP_TABLES.has(ct)) return null;
1722
- const px = _chunkBUFGW3UJcjs.TABLE_COLXS.get(pt), cx = _chunkBUFGW3UJcjs.TABLE_COLXS.get(ct);
1732
+ if (!_chunkTBGNGQ2Ocjs.CLIP_TABLES.has(pt) || !_chunkTBGNGQ2Ocjs.CLIP_TABLES.has(ct)) return null;
1733
+ const px = _chunkTBGNGQ2Ocjs.TABLE_COLXS.get(pt), cx = _chunkTBGNGQ2Ocjs.TABLE_COLXS.get(ct);
1723
1734
  if (!px || !cx) return null;
1724
1735
  let xs = cx, shifted = false, dx = 0, foreign = false, within = false;
1725
1736
  if (!shiftedSame(px, cx, false)) {
@@ -1735,15 +1746,15 @@ function joinClipParts(prev, curr, pageHeights, lex) {
1735
1746
  const inner = b.slice(1, -1).map((x) => x + dx);
1736
1747
  return inner.length > 0 && !inner.some((x) => px.some((p) => Math.abs(p - x) <= CONTINUATION_COL_TOL));
1737
1748
  };
1738
- foreign = unrelated(cx) && unrelated(_nullishCoalesce(_chunkBUFGW3UJcjs.PART_COLXS.get(ct), () => ( cx))) && (headingRow(_nullishCoalesce(ct.cells[0], () => ( []))) || px.length > FOREIGN_FIRST_ROW_CELLS && anchorsOf(ct).filter((a) => a.r === 0).length >= FOREIGN_FIRST_ROW_CELLS);
1749
+ foreign = unrelated(cx) && unrelated(_nullishCoalesce(_chunkTBGNGQ2Ocjs.PART_COLXS.get(ct), () => ( cx))) && (headingRow(_nullishCoalesce(ct.cells[0], () => ( []))) || px.length > FOREIGN_FIRST_ROW_CELLS && anchorsOf(ct).filter((a) => a.r === 0).length >= FOREIGN_FIRST_ROW_CELLS);
1739
1750
  }
1740
1751
  const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _180 => _180.bbox, 'optionalAccess', _181 => _181.y]), lex);
1741
1752
  if (!res || (shifted || foreign || within) && !res.split && !res.header) return null;
1742
- _chunkBUFGW3UJcjs.TABLE_COLXS.set(res.table, res.colXs);
1743
- const ys = _chunkBUFGW3UJcjs.TABLE_ROWYS.get(pt);
1744
- if (ys) _chunkBUFGW3UJcjs.TABLE_ROWYS.set(res.table, ys);
1745
- _chunkBUFGW3UJcjs.PART_COLXS.set(res.table, _nullishCoalesce(_chunkBUFGW3UJcjs.PART_COLXS.get(pt), () => ( px)));
1746
- _chunkBUFGW3UJcjs.CLIP_TABLES.add(res.table);
1753
+ _chunkTBGNGQ2Ocjs.TABLE_COLXS.set(res.table, res.colXs);
1754
+ const ys = _chunkTBGNGQ2Ocjs.TABLE_ROWYS.get(pt);
1755
+ if (ys) _chunkTBGNGQ2Ocjs.TABLE_ROWYS.set(res.table, ys);
1756
+ _chunkTBGNGQ2Ocjs.PART_COLXS.set(res.table, _nullishCoalesce(_chunkTBGNGQ2Ocjs.PART_COLXS.get(pt), () => ( px)));
1757
+ _chunkTBGNGQ2Ocjs.CLIP_TABLES.add(res.table);
1747
1758
  return res.table;
1748
1759
  }
1749
1760
  function prevLacksLeftCols(prev, px, xs, pageHeights) {
@@ -1767,12 +1778,12 @@ function looksContinued(prev, curr, pageHeights) {
1767
1778
  return filled.length >= 2 && filled.every((t) => t === filled[0]);
1768
1779
  }
1769
1780
  function pushedLead(prev, curr) {
1770
- if (!_chunkBUFGW3UJcjs.CLIP_TABLES.has(prev.table) || !_chunkBUFGW3UJcjs.CLIP_TABLES.has(curr.table)) return false;
1781
+ if (!_chunkTBGNGQ2Ocjs.CLIP_TABLES.has(prev.table) || !_chunkTBGNGQ2Ocjs.CLIP_TABLES.has(curr.table)) return false;
1771
1782
  const lead = leadRows(curr.table);
1772
1783
  return lead.image && lead.height > prev.bbox.y;
1773
1784
  }
1774
1785
  function leadRows(t) {
1775
- const ys = _chunkBUFGW3UJcjs.TABLE_ROWYS.get(t);
1786
+ const ys = _chunkTBGNGQ2Ocjs.TABLE_ROWYS.get(t);
1776
1787
  if (!ys || ys.length < 2) return { height: 0, image: false };
1777
1788
  const anchors = anchorsOf(t);
1778
1789
  let end = 1, image = false;
@@ -1780,17 +1791,17 @@ function leadRows(t) {
1780
1791
  for (const a of anchors) {
1781
1792
  if (a.r !== r) continue;
1782
1793
  end = Math.max(end, r + a.rs);
1783
- if (_chunkBUFGW3UJcjs.IMAGE_CELLS.has(a.cell)) image = true;
1794
+ if (_chunkTBGNGQ2Ocjs.IMAGE_CELLS.has(a.cell)) image = true;
1784
1795
  }
1785
1796
  }
1786
1797
  return { height: ys[0] - ys[Math.min(end, ys.length - 1)], image };
1787
1798
  }
1788
1799
  function tailOf(b) {
1789
- const t = b.table && _chunkBUFGW3UJcjs.TABLE_TAIL.get(b.table);
1800
+ const t = b.table && _chunkTBGNGQ2Ocjs.TABLE_TAIL.get(b.table);
1790
1801
  return t && b.bbox ? { ...b, pageNumber: t.page, bbox: { ...b.bbox, page: t.page, y: t.y, height: t.height } } : b;
1791
1802
  }
1792
1803
  function firstRowSig(t) {
1793
- const x = _chunkBUFGW3UJcjs.TABLE_COLXS.get(t);
1804
+ const x = _chunkTBGNGQ2Ocjs.TABLE_COLXS.get(t);
1794
1805
  if (!x || x.length !== t.cols + 1) return null;
1795
1806
  return anchorsOf(t).filter((a) => a.r === 0).map((a) => ({ x1: x[a.c], x2: x[a.c + a.cs], t: flowText(a.cell.text).replace(/\s+/g, "") }));
1796
1807
  }
@@ -1843,7 +1854,7 @@ function chainHead(blocks, i, pageHeights) {
1843
1854
  if (pb.pageNumber !== (_nullishCoalesce(cur.pageNumber, () => ( 0))) - 1) break;
1844
1855
  if (!blocks.slice(p + 1, k).every((b) => besideOwn(b, pb, cur) || insideTable(b, pb) || pageNumberBetween(b, pb, cur, pageHeights))) break;
1845
1856
  if (!looksContinued(pb, cur, pageHeights)) break;
1846
- const px = _chunkBUFGW3UJcjs.TABLE_COLXS.get(pb.table), cx = _chunkBUFGW3UJcjs.TABLE_COLXS.get(cur.table);
1857
+ const px = _chunkTBGNGQ2Ocjs.TABLE_COLXS.get(pb.table), cx = _chunkTBGNGQ2Ocjs.TABLE_COLXS.get(cur.table);
1847
1858
  if (!px || !cx) break;
1848
1859
  const dx = px[px.length - 1] - cx[cx.length - 1];
1849
1860
  if (!shiftedSame(px, cx) && !px.some((x) => Math.abs(x - (cx[0] + dx)) <= CONTINUATION_COL_TOL) && !prevLacksLeftCols(pb, px, cx, pageHeights)) break;
@@ -1914,7 +1925,7 @@ var RESTART_LOOKBACK_PAGES = 5;
1914
1925
  var COL_MATCH_TOL = 0.5;
1915
1926
  var CONTINUED_TABLE_PAGE_BAND = 0.16;
1916
1927
  function lastRowCell(t, x1, x2) {
1917
- const xs = _chunkBUFGW3UJcjs.TABLE_COLXS.get(t);
1928
+ const xs = _chunkTBGNGQ2Ocjs.TABLE_COLXS.get(t);
1918
1929
  const covered = /* @__PURE__ */ new Set();
1919
1930
  for (let r = 0; r < t.rows; r++) {
1920
1931
  for (let c = 0; c < t.cols; c++) {
@@ -1932,7 +1943,7 @@ var cellBlocks = (cell, pageNumber) => _nullishCoalesce(cell.blocks, () => ( cel
1932
1943
  function mergeContinuedCells(blocks, pageHeights) {
1933
1944
  for (let j = blocks.length - 1; j > 0; j--) {
1934
1945
  const part = blocks[j];
1935
- const from = part.table ? _chunkBUFGW3UJcjs.CONT_PARTS.get(part.table) : void 0;
1946
+ const from = part.table ? _chunkTBGNGQ2Ocjs.CONT_PARTS.get(part.table) : void 0;
1936
1947
  if (!from || !part.table) {
1937
1948
  unwrapContinuedTable(blocks, j, pageHeights, true);
1938
1949
  continue;
@@ -1948,12 +1959,12 @@ function mergeContinuedCells(blocks, pageHeights) {
1948
1959
  if (cell.blocks || add.blocks) cell.blocks = [...cellBlocks(cell, prev.pageNumber), ...cellBlocks(add, part.pageNumber)];
1949
1960
  else if (part.pageNumber) markContinuedText(cell, add, part.pageNumber);
1950
1961
  cell.text = [cell.text, add.text].filter((s) => s.trim()).join("\n");
1951
- if (_chunkBUFGW3UJcjs.IMAGE_CELLS.has(add)) _chunkBUFGW3UJcjs.IMAGE_CELLS.add(cell);
1952
- _chunkBUFGW3UJcjs.joinCellEdges.call(void 0, cell, add);
1953
- const lines = _chunkBUFGW3UJcjs.CELL_LINES.get(add);
1954
- if (_optionalChain([lines, 'optionalAccess', _205 => _205.length])) _chunkBUFGW3UJcjs.CELL_LINES.set(cell, [..._nullishCoalesce(_chunkBUFGW3UJcjs.CELL_LINES.get(cell), () => ( [])), ...lines]);
1955
- if (part.pageNumber && part.bbox) _chunkBUFGW3UJcjs.TABLE_TAIL.set(prev.table, _nullishCoalesce(_chunkBUFGW3UJcjs.TABLE_TAIL.get(part.table), () => ( { page: part.pageNumber, y: part.bbox.y, height: part.bbox.height })));
1956
- if (cell.text.trim() || _optionalChain([cell, 'access', _206 => _206.blocks, 'optionalAccess', _207 => _207.length]) || _chunkBUFGW3UJcjs.IMAGE_CELLS.has(cell)) _chunkBUFGW3UJcjs.EMPTY_PARTS.delete(prev.table);
1962
+ if (_chunkTBGNGQ2Ocjs.IMAGE_CELLS.has(add)) _chunkTBGNGQ2Ocjs.IMAGE_CELLS.add(cell);
1963
+ _chunkTBGNGQ2Ocjs.joinCellEdges.call(void 0, cell, add);
1964
+ const lines = _chunkTBGNGQ2Ocjs.CELL_LINES.get(add);
1965
+ if (_optionalChain([lines, 'optionalAccess', _205 => _205.length])) _chunkTBGNGQ2Ocjs.CELL_LINES.set(cell, [..._nullishCoalesce(_chunkTBGNGQ2Ocjs.CELL_LINES.get(cell), () => ( [])), ...lines]);
1966
+ if (part.pageNumber && part.bbox) _chunkTBGNGQ2Ocjs.TABLE_TAIL.set(prev.table, _nullishCoalesce(_chunkTBGNGQ2Ocjs.TABLE_TAIL.get(part.table), () => ( { page: part.pageNumber, y: part.bbox.y, height: part.bbox.height })));
1967
+ if (cell.text.trim() || _optionalChain([cell, 'access', _206 => _206.blocks, 'optionalAccess', _207 => _207.length]) || _chunkTBGNGQ2Ocjs.IMAGE_CELLS.has(cell)) _chunkTBGNGQ2Ocjs.EMPTY_PARTS.delete(prev.table);
1957
1968
  blocks.splice(j, 1);
1958
1969
  if (cell.blocks && at > 0) {
1959
1970
  const nextAt = cell.blocks[at];
@@ -1965,11 +1976,11 @@ function mergeContinuedCells(blocks, pageHeights) {
1965
1976
  }
1966
1977
  function unwrapContinuedTable(blocks, at, pageHeights, splitOnly = false) {
1967
1978
  const prev = blocks[at - 1], frame = blocks[at];
1968
- if (!_optionalChain([prev, 'optionalAccess', _208 => _208.table]) || !_optionalChain([frame, 'optionalAccess', _209 => _209.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunkBUFGW3UJcjs.CLIP_TABLES.has(frame.table)) return;
1979
+ if (!_optionalChain([prev, 'optionalAccess', _208 => _208.table]) || !_optionalChain([frame, 'optionalAccess', _209 => _209.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunkTBGNGQ2Ocjs.CLIP_TABLES.has(frame.table)) return;
1969
1980
  const inner = _optionalChain([frame, 'access', _210 => _210.table, 'access', _211 => _211.cells, 'access', _212 => _212[0], 'optionalAccess', _213 => _213[0], 'optionalAccess', _214 => _214.blocks]);
1970
1981
  const next = _optionalChain([inner, 'optionalAccess', _215 => _215[0]]);
1971
- if (!inner || !_optionalChain([next, 'optionalAccess', _216 => _216.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunkBUFGW3UJcjs.CLIP_TABLES.has(prev.table) || !_chunkBUFGW3UJcjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
1972
- const px = _chunkBUFGW3UJcjs.TABLE_COLXS.get(prev.table), nx = _chunkBUFGW3UJcjs.TABLE_COLXS.get(next.table);
1982
+ if (!inner || !_optionalChain([next, 'optionalAccess', _216 => _216.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunkTBGNGQ2Ocjs.CLIP_TABLES.has(prev.table) || !_chunkTBGNGQ2Ocjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
1983
+ const px = _chunkTBGNGQ2Ocjs.TABLE_COLXS.get(prev.table), nx = _chunkTBGNGQ2Ocjs.TABLE_COLXS.get(next.table);
1973
1984
  if (!px || !nx || px.length !== nx.length || px.some((x, i) => Math.abs(x - nx[i]) > COL_MATCH_TOL)) return;
1974
1985
  const ph = _optionalChain([pageHeights, 'optionalAccess', _217 => _217.get, 'call', _218 => _218(prev.pageNumber)]), nh = _optionalChain([pageHeights, 'optionalAccess', _219 => _219.get, 'call', _220 => _220(next.pageNumber)]);
1975
1986
  if (!ph || !nh || prev.bbox.y > ph * CONTINUED_TABLE_PAGE_BAND || next.bbox.y + next.bbox.height < nh * (1 - CONTINUED_TABLE_PAGE_BAND)) return;
@@ -1979,15 +1990,15 @@ function unwrapContinuedTable(blocks, at, pageHeights, splitOnly = false) {
1979
1990
  function fillNestedContinuation(blocks, at) {
1980
1991
  const prev = blocks[at - 1], next = blocks[at];
1981
1992
  const t = _optionalChain([prev, 'optionalAccess', _223 => _223.table]), u = _optionalChain([next, 'optionalAccess', _224 => _224.table]);
1982
- if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunkBUFGW3UJcjs.CLIP_TABLES.has(t) || !_chunkBUFGW3UJcjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
1983
- const xs = _chunkBUFGW3UJcjs.TABLE_COLXS.get(u);
1993
+ if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunkTBGNGQ2Ocjs.CLIP_TABLES.has(t) || !_chunkTBGNGQ2Ocjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
1994
+ const xs = _chunkTBGNGQ2Ocjs.TABLE_COLXS.get(u);
1984
1995
  const cell = xs ? lastRowCell(t, xs[0], xs[xs.length - 1]) : void 0;
1985
1996
  const add = _optionalChain([u, 'access', _225 => _225.cells, 'access', _226 => _226[0], 'optionalAccess', _227 => _227[0]]);
1986
- if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _228 => _228.blocks, 'optionalAccess', _229 => _229.length]) || _chunkBUFGW3UJcjs.IMAGE_CELLS.has(cell)) return;
1997
+ if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _228 => _228.blocks, 'optionalAccess', _229 => _229.length]) || _chunkTBGNGQ2Ocjs.IMAGE_CELLS.has(cell)) return;
1987
1998
  cell.text = add.text;
1988
1999
  if (add.blocks) cell.blocks = add.blocks;
1989
- if (_chunkBUFGW3UJcjs.IMAGE_CELLS.has(add)) _chunkBUFGW3UJcjs.IMAGE_CELLS.add(cell);
1990
- _chunkBUFGW3UJcjs.joinCellEdges.call(void 0, cell, add);
2000
+ if (_chunkTBGNGQ2Ocjs.IMAGE_CELLS.has(add)) _chunkTBGNGQ2Ocjs.IMAGE_CELLS.add(cell);
2001
+ _chunkTBGNGQ2Ocjs.joinCellEdges.call(void 0, cell, add);
1991
2002
  blocks.splice(at, 1);
1992
2003
  }
1993
2004
 
@@ -2587,12 +2598,12 @@ function restoreUnmappedGlyphs(items, fnArray, argsArray, fontObj) {
2587
2598
  }
2588
2599
  }
2589
2600
  for (const q of queues.values()) for (let k = 0; k < q.length; k++) {
2590
- const pair = k + 1 < q.length ? _chunkB5M676H3cjs.pairedNumber.call(void 0, q[k], q[k + 1]) : void 0;
2601
+ const pair = k + 1 < q.length ? _chunkT7Z554HTcjs.pairedNumber.call(void 0, q[k], q[k + 1]) : void 0;
2591
2602
  if (pair !== void 0) {
2592
2603
  q[k] = pair;
2593
2604
  q[k + 1] = "";
2594
2605
  k++;
2595
- } else q[k] = _chunkB5M676H3cjs.mapPuaText.call(void 0, q[k]);
2606
+ } else q[k] = _chunkT7Z554HTcjs.mapPuaText.call(void 0, q[k]);
2596
2607
  }
2597
2608
  const byFont = /* @__PURE__ */ new Map();
2598
2609
  for (const it of items) {
@@ -2627,15 +2638,15 @@ function selectionContextPages(selected, pageCount) {
2627
2638
  function marginContextBlocks(raw, page, view) {
2628
2639
  const [x1, y1, x2, y2] = view;
2629
2640
  const width = x2 - x1, height = y2 - y1;
2630
- const items = _chunkBUFGW3UJcjs.filterHiddenText.call(void 0, _chunkBUFGW3UJcjs.normalizeItems.call(void 0, raw), width, height, x1, y1).visible;
2641
+ const items = _chunkTBGNGQ2Ocjs.filterHiddenText.call(void 0, _chunkTBGNGQ2Ocjs.normalizeItems.call(void 0, raw), width, height, x1, y1).visible;
2631
2642
  for (const item of items) {
2632
2643
  item.x -= x1;
2633
2644
  item.y -= y1;
2634
2645
  }
2635
- return _chunkBUFGW3UJcjs.groupByY.call(void 0, items).flatMap((line) => {
2636
- const bbox = _chunkBUFGW3UJcjs.computeBBox.call(void 0, line, page);
2646
+ return _chunkTBGNGQ2Ocjs.groupByY.call(void 0, items).flatMap((line) => {
2647
+ const bbox = _chunkTBGNGQ2Ocjs.computeBBox.call(void 0, line, page);
2637
2648
  if (bbox.y + bbox.height < height * 0.88 && bbox.y > height * 0.12) return [];
2638
- return [{ type: "paragraph", text: _chunkBUFGW3UJcjs.mergeLineSimple.call(void 0, line), pageNumber: page, bbox, style: _chunkBUFGW3UJcjs.dominantStyle.call(void 0, line) }];
2649
+ return [{ type: "paragraph", text: _chunkTBGNGQ2Ocjs.mergeLineSimple.call(void 0, line), pageNumber: page, bbox, style: _chunkTBGNGQ2Ocjs.dominantStyle.call(void 0, line) }];
2639
2650
  });
2640
2651
  }
2641
2652
 
@@ -2671,7 +2682,7 @@ var WINANSI_REVERSE = {
2671
2682
  };
2672
2683
  function symbolFontTable(fontName) {
2673
2684
  if (!fontName) return void 0;
2674
- if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunkB5M676H3cjs.WINGDINGS;
2685
+ if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunkT7Z554HTcjs.WINGDINGS;
2675
2686
  return void 0;
2676
2687
  }
2677
2688
  function remapSymbolText(text, table) {
@@ -2904,7 +2915,7 @@ function wrapEquationRuns(items, faceName) {
2904
2915
  for (const i of members) drop.add(i);
2905
2916
  const toks = cur.map((it) => {
2906
2917
  const bar2 = isBarItem(it);
2907
- const text = bar2 ? "" : plain2.has(items.indexOf(it)) ? _chunkB5M676H3cjs.toTex.call(void 0, it.text) : FUNC_RE.test(it.text.trim()) ? it.text.trim() : [...it.text].map(decodeEq).join("");
2918
+ const text = bar2 ? "" : plain2.has(items.indexOf(it)) ? _chunkT7Z554HTcjs.toTex.call(void 0, it.text) : FUNC_RE.test(it.text.trim()) ? it.text.trim() : [...it.text].map(decodeEq).join("");
2908
2919
  return { text, x: it.x, y: it.y, w: it.w, size: sizeOf(it), bar: bar2 };
2909
2920
  });
2910
2921
  const tex = layout(toks).replace(/\}\\text\{/g, "");
@@ -3701,7 +3712,7 @@ function mergeEnclosedDigits(items) {
3701
3712
  if (!/^\d\d?$/.test(digits)) continue;
3702
3713
  const mid = (inside2[0].x + inside2[inside2.length - 1].x + inside2[inside2.length - 1].w) / 2;
3703
3714
  if (Math.abs(mid - (s.x + s.w / 2)) > s.fontSize * 0.15) continue;
3704
- s.text = _chunkB5M676H3cjs.enclosedNumber.call(void 0, Number(digits));
3715
+ s.text = _chunkT7Z554HTcjs.enclosedNumber.call(void 0, Number(digits));
3705
3716
  for (const d of inside2) drop.add(d);
3706
3717
  }
3707
3718
  if (!drop.size) return;
@@ -3883,7 +3894,7 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
3883
3894
  if (block.type !== "heading" || !block.text) continue;
3884
3895
  const text = block.text.replace(/<[^>]+>/g, "").trim();
3885
3896
  const fsz = _nullishCoalesce(_optionalChain([block, 'access', _309 => _309.style, 'optionalAccess', _310 => _310.fontSize]), () => ( 0));
3886
- const tocEntry = i > 0 && _chunkBUFGW3UJcjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunkBUFGW3UJcjs.TOC_BLOCKS.has(blocks[i + 1]);
3897
+ const tocEntry = i > 0 && _chunkTBGNGQ2Ocjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunkTBGNGQ2Ocjs.TOC_BLOCKS.has(blocks[i + 1]);
3887
3898
  const page = _nullishCoalesce(byPage.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( []));
3888
3899
  const proseStyle = _optionalChain([block, 'access', _311 => _311.style, 'optionalAccess', _312 => _312.fontName]) && bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))) === `${block.style.fontName}:${block.style.fontSize}` && text.length > 60;
3889
3900
  const next = blocks[i + 1];
@@ -3981,7 +3992,7 @@ function splitSingleCellTables(blocks) {
3981
3992
  const out = [];
3982
3993
  for (const b of blocks) {
3983
3994
  const t = b.type === "table" ? b.table : void 0;
3984
- const title = t && _chunkBUFGW3UJcjs.FRAME_TITLE_BLOCKS.get(t);
3995
+ const title = t && _chunkTBGNGQ2Ocjs.FRAME_TITLE_BLOCKS.get(t);
3985
3996
  if (title) {
3986
3997
  out.push({ ...title, text: `${t.cells[0][0].text.trim()} ${t.cells[0][2].text.trim()}` });
3987
3998
  continue;
@@ -4017,7 +4028,7 @@ function joinLatinCellWraps(blocks) {
4017
4028
  const lines = cell.text.split("\n");
4018
4029
  const out = [lines[0]];
4019
4030
  for (const line of lines.slice(1)) {
4020
- if (_chunkBUFGW3UJcjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
4031
+ if (_chunkTBGNGQ2Ocjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
4021
4032
  else out.push(line);
4022
4033
  }
4023
4034
  cell.text = out.join("\n");
@@ -4037,10 +4048,10 @@ function cleanPdfText(text, opts) {
4037
4048
  ).replace(/^(?!\| ---).*$/gm, (line) => {
4038
4049
  if (/^\s*\${1,2}.+\${1,2}\s*$/.test(line)) return line;
4039
4050
  if (line.startsWith("|")) {
4040
- return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkBUFGW3UJcjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
4051
+ return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkTBGNGQ2Ocjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
4041
4052
  }
4042
4053
  const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _392 => _392.exec, 'call', _393 => _393(line), 'optionalAccess', _394 => _394[0]]), () => ( ""));
4043
- return mark + _chunkBUFGW3UJcjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
4054
+ return mark + _chunkTBGNGQ2Ocjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
4044
4055
  }).replace(/\\~\\~/g, "~~").replace(/~~~~/g, "").replace(/<u>\s*<\/u>/g, "").replace(/<(sup|sub)>\s*<\/\1>/g, "").replace(/\n{3,}/g, "\n\n").trim();
4045
4056
  }
4046
4057
  function startsWithMarker(line) {
@@ -4072,7 +4083,7 @@ function mergeKoreanLines(text) {
4072
4083
  continue;
4073
4084
  }
4074
4085
  if (/[가-힣·,\-]$/.test(prev) && /^[가-힣(]/.test(curr) && !startsWithMarker(curr) && !isStandaloneHeader(prev) && !startsWithMarker(prev)) {
4075
- result[result.length - 1] = prev + _chunkBUFGW3UJcjs.wrapJoiner.call(void 0, prev, curr) + curr;
4086
+ result[result.length - 1] = prev + _chunkTBGNGQ2Ocjs.wrapJoiner.call(void 0, prev, curr) + curr;
4076
4087
  } else {
4077
4088
  result.push(curr);
4078
4089
  }
@@ -4088,7 +4099,7 @@ function applyLinkAnnotations(items, annots) {
4088
4099
  const wrapped = /* @__PURE__ */ new Set();
4089
4100
  for (const a of annots) {
4090
4101
  if (a.subtype !== "Link" || !a.url || !a.rect || a.rect.length < 4) continue;
4091
- const url = _chunkOMGCVZ4Wcjs.sanitizeHref.call(void 0, a.url);
4102
+ const url = _chunkYOLFNCQQcjs.sanitizeHref.call(void 0, a.url);
4092
4103
  if (!url) continue;
4093
4104
  const x1 = Math.min(a.rect[0], a.rect[2]), x2 = Math.max(a.rect[0], a.rect[2]);
4094
4105
  const y1 = Math.min(a.rect[1], a.rect[3]), y2 = Math.max(a.rect[1], a.rect[3]);
@@ -4140,7 +4151,7 @@ function mergeLinkRuns(markdown) {
4140
4151
 
4141
4152
  // src/pdf/formula-ocr.ts
4142
4153
  async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
4143
- const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-G3FQTUOY.cjs")));
4154
+ const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-IIPZAHPY.cjs")));
4144
4155
  const { FormulaPipeline, ensureFormulaModels } = formulaMod;
4145
4156
  await ensureFormulaModels((p) => {
4146
4157
  if (p.phase === "download" && p.total) {
@@ -4331,13 +4342,13 @@ async function loadPdfWithTimeout(buffer) {
4331
4342
  try {
4332
4343
  return await Promise.race([
4333
4344
  loadingTask.promise.catch((e) => {
4334
- if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uC554\uD638\uB85C \uBCF4\uD638\uB41C PDF \uD30C\uC77C\uC785\uB2C8\uB2E4 (PDF \uC5F4\uAE30 \uC554\uD638\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4)");
4345
+ if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkYOLFNCQQcjs.KordocError)("\uC554\uD638\uB85C \uBCF4\uD638\uB41C PDF \uD30C\uC77C\uC785\uB2C8\uB2E4 (PDF \uC5F4\uAE30 \uC554\uD638\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4)");
4335
4346
  throw e;
4336
4347
  }),
4337
4348
  new Promise((_, reject) => {
4338
4349
  timer = setTimeout(() => {
4339
4350
  loadingTask.destroy();
4340
- reject(new (0, _chunkOMGCVZ4Wcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
4351
+ reject(new (0, _chunkYOLFNCQQcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
4341
4352
  }, PDF_LOAD_TIMEOUT_MS);
4342
4353
  })
4343
4354
  ]);
@@ -4347,14 +4358,14 @@ async function loadPdfWithTimeout(buffer) {
4347
4358
  }
4348
4359
  async function parsePdfDocument(buffer, options) {
4349
4360
  const formulaBuffer = _optionalChain([options, 'optionalAccess', _395 => _395.formulaOcr]) ? buffer : null;
4350
- const ocrOptionError = _chunkB5M676H3cjs.validateOcrOptions.call(void 0, options);
4351
- if (ocrOptionError) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(ocrOptionError);
4352
- const autoOcr = _optionalChain([options, 'optionalAccess', _396 => _396.ocr]) === void 0 && await _chunkBUFGW3UJcjs.ocrModelsCached.call(void 0, _chunkBUFGW3UJcjs.resolveOcrModels.call(void 0, options));
4361
+ const ocrOptionError = _chunkT7Z554HTcjs.validateOcrOptions.call(void 0, options);
4362
+ if (ocrOptionError) throw new (0, _chunkYOLFNCQQcjs.KordocError)(ocrOptionError);
4363
+ const autoOcr = _optionalChain([options, 'optionalAccess', _396 => _396.ocr]) === void 0 && await _chunkTBGNGQ2Ocjs.ocrModelsCached.call(void 0, _chunkTBGNGQ2Ocjs.resolveOcrModels.call(void 0, options));
4353
4364
  const ocrBuffer = _optionalChain([options, 'optionalAccess', _397 => _397.ocr]) || autoOcr ? buffer : null;
4354
4365
  const doc = await loadPdfWithTimeout(buffer);
4355
4366
  try {
4356
4367
  const pageCount = doc.numPages;
4357
- if (pageCount === 0) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
4368
+ if (pageCount === 0) throw new (0, _chunkYOLFNCQQcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
4358
4369
  const metadata = { pageCount, pageMode: "layout" };
4359
4370
  await extractPdfMetadata(doc, metadata);
4360
4371
  const blocks = [];
@@ -4383,7 +4394,7 @@ async function parsePdfDocument(buffer, options) {
4383
4394
  const pageImageBlocks = /* @__PURE__ */ new Map();
4384
4395
  const carry = {};
4385
4396
  const vectorPageOps = /* @__PURE__ */ new Map();
4386
- const wrapLexicon = new (0, _chunkBUFGW3UJcjs.WrapLexicon)();
4397
+ const wrapLexicon = new (0, _chunkTBGNGQ2Ocjs.WrapLexicon)();
4387
4398
  const noteMarks = /* @__PURE__ */ new Map();
4388
4399
  const headerContext = [];
4389
4400
  if (pageFilter && _optionalChain([options, 'optionalAccess', _400 => _400.removeHeaderFooter]) !== false && pageFilter.size < effectivePageCount) {
@@ -4433,8 +4444,8 @@ async function parsePdfDocument(buffer, options) {
4433
4444
  restoreTrackedSpacing(rawItems, rawOps.fnArray, rawOps.argsArray);
4434
4445
  markSyntheticSpaces(rawItems, rawOps.fnArray, rawOps.argsArray);
4435
4446
  restoreSoftHyphens();
4436
- const items = _chunkBUFGW3UJcjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
4437
- const filtered = _chunkBUFGW3UJcjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
4447
+ const items = _chunkTBGNGQ2Ocjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
4448
+ const filtered = _chunkTBGNGQ2Ocjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
4438
4449
  const joined = joinVerticalColumns(filtered.visible);
4439
4450
  const visible = dropTabLeaderDots(joined);
4440
4451
  const hiddenCount = filtered.hiddenCount + occluded.size;
@@ -4461,7 +4472,7 @@ async function parsePdfDocument(buffer, options) {
4461
4472
  } : rawOps;
4462
4473
  remapSymbolFontItems(visible, (loadedName) => _optionalChain([fontObj, 'call', _407 => _407(loadedName), 'optionalAccess', _408 => _408.name]));
4463
4474
  remapControlGlyphs(visible, differencesOf);
4464
- await _chunkBUFGW3UJcjs.restoreImageBullets.call(void 0, visible, page, opList.fnArray, opList.argsArray, imageBulletShapes);
4475
+ await _chunkTBGNGQ2Ocjs.restoreImageBullets.call(void 0, visible, page, opList.fnArray, opList.argsArray, imageBulletShapes);
4465
4476
  const faces = /* @__PURE__ */ new Map();
4466
4477
  for (const it of visible) {
4467
4478
  if (!it.fontName) continue;
@@ -4474,12 +4485,12 @@ async function parsePdfDocument(buffer, options) {
4474
4485
  it.fontName = face;
4475
4486
  if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _410 => _410(face), 'optionalAccess', _411 => _411.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
4476
4487
  }
4477
- for (const it of visible) if (it.text.includes("$")) it.text = _chunkB5M676H3cjs.escapeLiteralDollar.call(void 0, it.text);
4478
- for (const it of visible) if (it.text.includes("<")) it.text = _chunkB5M676H3cjs.escapeLiteralTags.call(void 0, it.text);
4488
+ for (const it of visible) if (it.text.includes("$")) it.text = _chunkT7Z554HTcjs.escapeLiteralDollar.call(void 0, it.text);
4489
+ for (const it of visible) if (it.text.includes("<")) it.text = _chunkT7Z554HTcjs.escapeLiteralTags.call(void 0, it.text);
4479
4490
  wrapEquationRuns(visible, (face) => faceNames.get(face));
4480
4491
  const pageArea = pageW * pageH;
4481
4492
  if (pageArea > 0) {
4482
- const imageRegions = _chunkBUFGW3UJcjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
4493
+ const imageRegions = _chunkTBGNGQ2Ocjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
4483
4494
  let uncovered = 0;
4484
4495
  for (const r of imageRegions) {
4485
4496
  const area = (r.x2 - r.x1) * (r.y2 - r.y1);
@@ -4505,11 +4516,11 @@ async function parsePdfDocument(buffer, options) {
4505
4516
  if (uncovered > 0) skippedImagePages.set(i, uncovered);
4506
4517
  }
4507
4518
  const marks = superscriptNoteMarks(visible);
4508
- if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunkBUFGW3UJcjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
4519
+ if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunkTBGNGQ2Ocjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
4509
4520
  const stamp = marginStamp(visible);
4510
4521
  const flow = stamp.length ? visible.filter((it) => !stamp.includes(it)) : visible;
4511
- const rightArrows = _optionalChain([options, 'optionalAccess', _412 => _412.tables]) !== false ? await _chunkBUFGW3UJcjs.detectRightArrowRegions.call(void 0, page, opList.fnArray, opList.argsArray, imageArrowDirections) : [];
4512
- const pageBlocks = orderTwoUpPage(_chunkBUFGW3UJcjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _413 => _413.tables]) !== false, carry, wrapLexicon, rightArrows), pageW, pageH);
4522
+ const rightArrows = _optionalChain([options, 'optionalAccess', _412 => _412.tables]) !== false ? await _chunkTBGNGQ2Ocjs.detectRightArrowRegions.call(void 0, page, opList.fnArray, opList.argsArray, imageArrowDirections) : [];
4523
+ const pageBlocks = orderTwoUpPage(_chunkTBGNGQ2Ocjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _413 => _413.tables]) !== false, carry, wrapLexicon, rightArrows), pageW, pageH);
4513
4524
  if (stamp.length) pageBlocks.unshift({ type: "paragraph", text: [...stamp].sort((a, b) => a.y - b.y).map((it) => it.text).join(" "), pageNumber: i });
4514
4525
  for (const b of pageBlocks) blocks.push(b);
4515
4526
  try {
@@ -4535,11 +4546,11 @@ async function parsePdfDocument(buffer, options) {
4535
4546
  if (_optionalChain([options, 'optionalAccess', _415 => _415.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
4536
4547
  vectorPageOps.set(i, ocrVectorOps(opList, vector.paths));
4537
4548
  }
4538
- if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
4549
+ if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkYOLFNCQQcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
4539
4550
  parsedPages++;
4540
4551
  _optionalChain([options, 'optionalAccess', _416 => _416.onProgress, 'optionalCall', _417 => _417(parsedPages, totalTarget)]);
4541
4552
  } catch (pageErr) {
4542
- if (pageErr instanceof _chunkOMGCVZ4Wcjs.KordocError) throw pageErr;
4553
+ if (pageErr instanceof _chunkYOLFNCQQcjs.KordocError) throw pageErr;
4543
4554
  warnings.push({ page: i, message: `\uD398\uC774\uC9C0 ${i} \uD30C\uC2F1 \uC2E4\uD328: ${pageErr instanceof Error ? pageErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
4544
4555
  } finally {
4545
4556
  _optionalChain([loadedPage, 'optionalAccess', _418 => _418.cleanup, 'call', _419 => _419()]);
@@ -4570,12 +4581,12 @@ async function parsePdfDocument(buffer, options) {
4570
4581
  }
4571
4582
  if (targets.size > 0) {
4572
4583
  try {
4573
- const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-LJKCUXTE.cjs")));
4584
+ const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-OA57HOVS.cjs")));
4574
4585
  const mode = typeof _optionalChain([options, 'optionalAccess', _424 => _424.ocr]) === "function" ? options.ocr : "builtin";
4575
4586
  const regionPages = new Map([...ocrRegions].filter(([p]) => _optionalChain([options, 'optionalAccess', _425 => _425.ocr]) !== "force" && !isImageBased && !_optionalChain([pageQuality, 'access', _426 => _426.find, 'call', _427 => _427((q) => q.page === p), 'optionalAccess', _428 => _428.needsOcr])));
4576
- const { builtinOcrConfig } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-LJKCUXTE.cjs")));
4587
+ const { builtinOcrConfig } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-OA57HOVS.cjs")));
4577
4588
  const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, _optionalChain([options, 'optionalAccess', _429 => _429.onProgress]), _optionalChain([options, 'optionalAccess', _430 => _430.tables]) !== false, vectorPageOps, regionPages, builtinOcrConfig(options), ocrLinesOut);
4578
- for (const obs of ocrPageBlocks.values()) _chunkB5M676H3cjs.stripScriptTags.call(void 0, { blocks: obs });
4589
+ for (const obs of ocrPageBlocks.values()) _chunkT7Z554HTcjs.stripScriptTags.call(void 0, { blocks: obs });
4579
4590
  if (ocrPageBlocks.size > 0) {
4580
4591
  const replacePages = /* @__PURE__ */ new Set();
4581
4592
  for (const [p, obs] of ocrPageBlocks) {
@@ -4586,7 +4597,7 @@ async function parsePdfDocument(buffer, options) {
4586
4597
  continue;
4587
4598
  }
4588
4599
  const regions = ocrRegions.get(p);
4589
- if (!regions || _chunkBUFGW3UJcjs.mergeOcrImageRegions.call(void 0, blocks, p, regions, obs) === 0) continue;
4600
+ if (!regions || _chunkTBGNGQ2Ocjs.mergeOcrImageRegions.call(void 0, blocks, p, regions, obs) === 0) continue;
4590
4601
  ocrDone.add(p);
4591
4602
  if (_optionalChain([pageImageBlocks, 'access', _435 => _435.get, 'call', _436 => _436(p), 'optionalAccess', _437 => _437.length]) === 1) pageImageBlocks.delete(p);
4592
4603
  }
@@ -4639,17 +4650,17 @@ async function parsePdfDocument(buffer, options) {
4639
4650
  }
4640
4651
  }
4641
4652
  if (_optionalChain([options, 'optionalAccess', _438 => _438.removeHeaderFooter]) !== false && (parsedPageCount >= 3 || headerContext.length)) {
4642
- const removed = _chunkBUFGW3UJcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, false, headerContext);
4643
- const running = _chunkBUFGW3UJcjs.runningLinePatterns.call(void 0, removed.map((ri) => blocks[ri]), pageHeights);
4653
+ const removed = _chunkTBGNGQ2Ocjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, false, headerContext);
4654
+ const running = _chunkTBGNGQ2Ocjs.runningLinePatterns.call(void 0, removed.map((ri) => blocks[ri]), pageHeights);
4644
4655
  for (let ri = removed.length - 1; ri >= 0; ri--) {
4645
4656
  blocks.splice(removed[ri], 1);
4646
4657
  }
4647
- const stripped = _chunkBUFGW3UJcjs.stripAbsorbedRunningLines.call(void 0, blocks, pageHeights, running);
4658
+ const stripped = _chunkTBGNGQ2Ocjs.stripAbsorbedRunningLines.call(void 0, blocks, pageHeights, running);
4648
4659
  if (stripped !== blocks) {
4649
4660
  blocks.length = 0;
4650
4661
  blocks.push(...stripped);
4651
4662
  }
4652
- const kept = _chunkBUFGW3UJcjs.removeSideTabs.call(void 0, blocks, pageWidths);
4663
+ const kept = _chunkTBGNGQ2Ocjs.removeSideTabs.call(void 0, blocks, pageWidths);
4653
4664
  if (kept !== blocks) {
4654
4665
  blocks.length = 0;
4655
4666
  blocks.push(...kept);
@@ -4658,12 +4669,12 @@ async function parsePdfDocument(buffer, options) {
4658
4669
  mergeContinuedCells(blocks, pageHeights);
4659
4670
  mergeCrossPageTables(blocks, pageHeights, wrapLexicon);
4660
4671
  if (_optionalChain([options, 'optionalAccess', _439 => _439.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
4661
- const boxes = _chunkBUFGW3UJcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
4672
+ const boxes = _chunkTBGNGQ2Ocjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
4662
4673
  for (let ri = boxes.length - 1; ri >= 0; ri--) blocks.splice(boxes[ri], 1);
4663
4674
  }
4664
4675
  splitContactTables(blocks);
4665
- if (!_optionalChain([options, 'optionalAccess', _440 => _440.keepTrailingEmptyCols])) _chunkBUFGW3UJcjs.trimTrailingEmptyTableCols.call(void 0, blocks);
4666
- _chunkBUFGW3UJcjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
4676
+ if (!_optionalChain([options, 'optionalAccess', _440 => _440.keepTrailingEmptyCols])) _chunkTBGNGQ2Ocjs.trimTrailingEmptyTableCols.call(void 0, blocks);
4677
+ _chunkTBGNGQ2Ocjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
4667
4678
  injectPageImageBlocks(blocks, pageImageBlocks);
4668
4679
  if (_optionalChain([options, 'optionalAccess', _441 => _441.formulaOcr]) && formulaBuffer) {
4669
4680
  try {
@@ -4675,21 +4686,21 @@ async function parsePdfDocument(buffer, options) {
4675
4686
  });
4676
4687
  }
4677
4688
  }
4678
- const medianFontSize = _chunkBUFGW3UJcjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
4689
+ const medianFontSize = _chunkTBGNGQ2Ocjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
4679
4690
  if (medianFontSize > 0) {
4680
- _chunkBUFGW3UJcjs.detectHeadings.call(void 0, blocks, medianFontSize);
4681
- }
4682
- _chunkBUFGW3UJcjs.detectDocumentStyleHeadings.call(void 0, blocks);
4683
- _chunkBUFGW3UJcjs.detectTypographyHeadings.call(void 0, blocks);
4684
- _chunkBUFGW3UJcjs.detectSiblingStyleHeadings.call(void 0, blocks);
4685
- _chunkBUFGW3UJcjs.detectRepeatedPageLabels.call(void 0, blocks);
4686
- _chunkBUFGW3UJcjs.detectPageLeadHeadings.call(void 0, blocks);
4687
- _chunkBUFGW3UJcjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
4688
- _chunkBUFGW3UJcjs.refineDocumentStyleHeadings.call(void 0, blocks);
4689
- _chunkBUFGW3UJcjs.detectMarkerHeadings.call(void 0, blocks);
4691
+ _chunkTBGNGQ2Ocjs.detectHeadings.call(void 0, blocks, medianFontSize);
4692
+ }
4693
+ _chunkTBGNGQ2Ocjs.detectDocumentStyleHeadings.call(void 0, blocks);
4694
+ _chunkTBGNGQ2Ocjs.detectTypographyHeadings.call(void 0, blocks);
4695
+ _chunkTBGNGQ2Ocjs.detectSiblingStyleHeadings.call(void 0, blocks);
4696
+ _chunkTBGNGQ2Ocjs.detectRepeatedPageLabels.call(void 0, blocks);
4697
+ _chunkTBGNGQ2Ocjs.detectPageLeadHeadings.call(void 0, blocks);
4698
+ _chunkTBGNGQ2Ocjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
4699
+ _chunkTBGNGQ2Ocjs.refineDocumentStyleHeadings.call(void 0, blocks);
4700
+ _chunkTBGNGQ2Ocjs.detectMarkerHeadings.call(void 0, blocks);
4690
4701
  demoteNonHeadingRoles(blocks, pageHeights, faceNames);
4691
- _chunkBUFGW3UJcjs.detectTableCaptions.call(void 0, blocks);
4692
- _chunkBUFGW3UJcjs.detectKoreanListBlocks.call(void 0, blocks);
4702
+ _chunkTBGNGQ2Ocjs.detectTableCaptions.call(void 0, blocks);
4703
+ _chunkTBGNGQ2Ocjs.detectKoreanListBlocks.call(void 0, blocks);
4693
4704
  sanitizeBlockControlChars(blocks);
4694
4705
  let outBlocks = splitSingleCellTables(blocks);
4695
4706
  if (_optionalChain([options, 'optionalAccess', _442 => _442.layoutTables]) !== "keep") {
@@ -4710,19 +4721,19 @@ async function parsePdfDocument(buffer, options) {
4710
4721
  const shown = /* @__PURE__ */ new Map();
4711
4722
  const markContent = (bs) => {
4712
4723
  for (const b of _nullishCoalesce(bs, () => ( []))) if (b.table) for (const row of b.table.cells) for (const c of row) {
4713
- if (_chunkBUFGW3UJcjs.IMAGE_CELLS.has(c)) _chunkB5M676H3cjs.CONTENT_CELLS.add(c);
4714
- const lines = _chunkBUFGW3UJcjs.CELL_LINES.get(c);
4715
- if (lines) _chunkB5M676H3cjs.CELL_BASELINES.set(c, lines.map((l) => l.y));
4724
+ if (_chunkTBGNGQ2Ocjs.IMAGE_CELLS.has(c)) _chunkT7Z554HTcjs.CONTENT_CELLS.add(c);
4725
+ const lines = _chunkTBGNGQ2Ocjs.CELL_LINES.get(c);
4726
+ if (lines) _chunkT7Z554HTcjs.CELL_BASELINES.set(c, lines.map((l) => l.y));
4716
4727
  markContent(c.blocks);
4717
4728
  }
4718
4729
  };
4719
4730
  const visual = (bs) => bs.flatMap((b) => {
4720
4731
  if (b.type !== "table") return [b];
4721
- if (!hancom && b.table && _chunkBUFGW3UJcjs.CLIP_TABLES.has(b.table)) return [b];
4732
+ if (!hancom && b.table && _chunkTBGNGQ2Ocjs.CLIP_TABLES.has(b.table)) return [b];
4722
4733
  let v = shown.get(b);
4723
4734
  if (!v) {
4724
4735
  markContent([b]);
4725
- shown.set(b, v = _chunkB5M676H3cjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _445 => _445.keepTrailingEmptyCols])));
4736
+ shown.set(b, v = _chunkT7Z554HTcjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _445 => _445.keepTrailingEmptyCols])));
4726
4737
  }
4727
4738
  return v;
4728
4739
  });
@@ -4731,13 +4742,13 @@ async function parsePdfDocument(buffer, options) {
4731
4742
  blocks.length = 0;
4732
4743
  for (const b of kept) blocks.push(b);
4733
4744
  }
4734
- const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunkB5M676H3cjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([options, 'optionalAccess', _446 => _446.tableFormat]) }), { keepLoneNumbers: true }));
4735
- if (_optionalChain([options, 'optionalAccess', _447 => _447.tableFormat]) === "gfm") _chunkB5M676H3cjs.assignTableIds.call(void 0, blocks);
4745
+ const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunkT7Z554HTcjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([options, 'optionalAccess', _446 => _446.tableFormat]) }), { keepLoneNumbers: true }));
4746
+ if (_optionalChain([options, 'optionalAccess', _447 => _447.tableFormat]) === "gfm") _chunkT7Z554HTcjs.assignTableIds.call(void 0, blocks);
4736
4747
  let markdown = finishMarkdown(outBlocks);
4737
4748
  const outline = collectPdfOutline(outBlocks);
4738
4749
  return {
4739
4750
  markdown,
4740
- pages: _chunkWVZSTMCZcjs.blocksToPages.call(void 0, splitPageTables(_chunkBUFGW3UJcjs.splitPageBreakWraps.call(void 0, outBlocks)), finishMarkdown),
4751
+ pages: _chunk7OZLM5MRcjs.blocksToPages.call(void 0, splitPageTables(_chunkTBGNGQ2Ocjs.splitPageBreakWraps.call(void 0, outBlocks)), finishMarkdown),
4741
4752
  blocks,
4742
4753
  metadata,
4743
4754
  outline: outline.length > 0 ? outline : void 0,
@@ -4817,5 +4828,5 @@ function marginStamp(items) {
4817
4828
 
4818
4829
 
4819
4830
 
4820
- exports.PDFJS_DOCUMENT_OPTIONS = PDFJS_DOCUMENT_OPTIONS; exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkBUFGW3UJcjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkBUFGW3UJcjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkBUFGW3UJcjs.removeHeaderFooterBlocks;
4821
- //# sourceMappingURL=parser-GJ4PKW7I.cjs.map
4831
+ exports.PDFJS_DOCUMENT_OPTIONS = PDFJS_DOCUMENT_OPTIONS; exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkTBGNGQ2Ocjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkTBGNGQ2Ocjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkTBGNGQ2Ocjs.removeHeaderFooterBlocks;
4832
+ //# sourceMappingURL=parser-HZI6SSX5.cjs.map