kordoc 4.22.3 → 4.22.5

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 (128) hide show
  1. package/README.md +9 -7
  2. package/dist/{-AOWV7MNY.js → -WFRWBH7T.js} +11 -11
  3. package/dist/{chunk-3ANXRVI2.js → chunk-2L3Q7REU.js} +3 -3
  4. package/dist/{chunk-FDFXL7VJ.js → chunk-35ZHXEJA.js} +3 -3
  5. package/dist/{chunk-BS2XWGT5.js → chunk-3BR7VKWL.js} +2 -2
  6. package/dist/{chunk-KBGNPGVY.js → chunk-3G3TLZDK.js} +2 -2
  7. package/dist/{chunk-M2X766AY.js → chunk-3YEL7P4L.js} +2 -2
  8. package/dist/{chunk-NJEMRAIF.cjs → chunk-4SUB43EJ.cjs} +24 -24
  9. package/dist/{chunk-NJEMRAIF.cjs.map → chunk-4SUB43EJ.cjs.map} +1 -1
  10. package/dist/{chunk-DKJ2RNDG.js → chunk-4TWN7PWJ.js} +2 -2
  11. package/dist/{chunk-UCLDUUBX.js → chunk-52HIK4C2.js} +4 -3
  12. package/dist/chunk-52HIK4C2.js.map +1 -0
  13. package/dist/{chunk-3H2IEU4V.js → chunk-63N6CEJE.js} +2 -2
  14. package/dist/{chunk-MEIQ476H.js → chunk-6MCC2XNB.js} +2 -2
  15. package/dist/{chunk-SKRWKVVW.js → chunk-6MQKNB6K.js} +15 -8
  16. package/dist/chunk-6MQKNB6K.js.map +1 -0
  17. package/dist/{chunk-MI655NV5.cjs → chunk-AS25R4EU.cjs} +2 -2
  18. package/dist/{chunk-MI655NV5.cjs.map → chunk-AS25R4EU.cjs.map} +1 -1
  19. package/dist/{chunk-4NQ4EZEE.js → chunk-C3REGEQO.js} +2 -2
  20. package/dist/{chunk-NLGOMLGU.cjs → chunk-C6B5GWN7.cjs} +35 -28
  21. package/dist/chunk-C6B5GWN7.cjs.map +1 -0
  22. package/dist/{chunk-6LIBF2ZB.js → chunk-CO7O3ZT6.js} +2 -2
  23. package/dist/{chunk-IRNWAHHZ.js → chunk-CRSTBATY.js} +2 -2
  24. package/dist/{chunk-VJCQOSMT.js → chunk-CW67DAAH.js} +2 -2
  25. package/dist/{chunk-6QBBGZST.js → chunk-DN55FTJP.js} +2 -2
  26. package/dist/{chunk-OIF5HRVP.js → chunk-HLPMC7L4.js} +16 -9
  27. package/dist/chunk-HLPMC7L4.js.map +1 -0
  28. package/dist/{chunk-24YLYR6Q.js → chunk-LE4VHWIT.js} +4 -4
  29. package/dist/{chunk-2BCQVQO2.cjs → chunk-N6KXGIIN.cjs} +3 -3
  30. package/dist/{chunk-2BCQVQO2.cjs.map → chunk-N6KXGIIN.cjs.map} +1 -1
  31. package/dist/{chunk-7XITVUAK.js → chunk-PSORL4PA.js} +11 -11
  32. package/dist/{chunk-AXX5AQT4.js → chunk-RYKDIUHT.js} +4 -4
  33. package/dist/{chunk-O5E25RHU.js → chunk-SETAYS6P.js} +2 -2
  34. package/dist/{chunk-X45Q7EAC.js → chunk-T7OZ7X6A.js} +2 -2
  35. package/dist/{chunk-J5PYESLX.js → chunk-TOUJCO2P.js} +2 -2
  36. package/dist/{chunk-YOGMCRM7.js → chunk-U3GUZQ54.js} +1353 -1335
  37. package/dist/chunk-U3GUZQ54.js.map +1 -0
  38. package/dist/{chunk-O3OS6FAW.cjs → chunk-UCK6WGHY.cjs} +3 -3
  39. package/dist/{chunk-O3OS6FAW.cjs.map → chunk-UCK6WGHY.cjs.map} +1 -1
  40. package/dist/{chunk-SJ5OZXEL.cjs → chunk-YG4GFQB7.cjs} +6 -6
  41. package/dist/{chunk-SJ5OZXEL.cjs.map → chunk-YG4GFQB7.cjs.map} +1 -1
  42. package/dist/chunks-NXABWR6G.js +10 -0
  43. package/dist/cli.js +30 -30
  44. package/dist/{formula-W4OL33YQ.js → formula-FSVHUQ6Y.js} +4 -4
  45. package/dist/{formula-C26FMMGO.js → formula-L625ULJP.js} +3 -3
  46. package/dist/{formula-5V2WG4BH.cjs → formula-QZGTF3DZ.cjs} +9 -9
  47. package/dist/{formula-5V2WG4BH.cjs.map → formula-QZGTF3DZ.cjs.map} +1 -1
  48. package/dist/{image-ocr-BELHEWPX.cjs → image-ocr-AELVAU75.cjs} +17 -17
  49. package/dist/{image-ocr-BELHEWPX.cjs.map → image-ocr-AELVAU75.cjs.map} +1 -1
  50. package/dist/{image-ocr-T72HMX2W.js → image-ocr-KE3RUS3R.js} +6 -6
  51. package/dist/{image-ocr-NSQ34Y6T.js → image-ocr-QTZNBP5V.js} +9 -9
  52. package/dist/index.cjs +859 -840
  53. package/dist/index.cjs.map +1 -1
  54. package/dist/index.js +322 -303
  55. package/dist/index.js.map +1 -1
  56. package/dist/mcp.js +22 -22
  57. package/dist/{model-bundle-34T2LJB4.js → model-bundle-F6TU6ZAV.js} +5 -5
  58. package/dist/{models-TQH5EM6V.js → models-ZHNNVH2W.js} +5 -5
  59. package/dist/{parse-worker-v2-YEYLILGJ.js → parse-worker-v2-KQRG3NQO.js} +12 -12
  60. package/dist/{parser-SJHCBL7T.js → parser-RVMH4PUB.js} +183 -21
  61. package/dist/parser-RVMH4PUB.js.map +1 -0
  62. package/dist/{parser-E6BG3ECD.js → parser-WBKVRDPV.js} +179 -17
  63. package/dist/parser-WBKVRDPV.js.map +1 -0
  64. package/dist/{parser-OAXCXVQ4.cjs → parser-WNDH2X6N.cjs} +442 -280
  65. package/dist/parser-WNDH2X6N.cjs.map +1 -0
  66. package/dist/pdf-ocr-IOUZTPPH.cjs +31 -0
  67. package/dist/{pdf-ocr-RKXDY3ZA.cjs.map → pdf-ocr-IOUZTPPH.cjs.map} +1 -1
  68. package/dist/{pdf-ocr-LGPSJM22.js → pdf-ocr-X5XLGL5J.js} +6 -6
  69. package/dist/{pdf-ocr-T5ASSUKK.js → pdf-ocr-ZP2CUWSO.js} +9 -9
  70. package/dist/{profile-io-KMCAFTMG.js → profile-io-B4VSI4LW.js} +3 -3
  71. package/dist/{rasterize-M52AKY7R.js → rasterize-Y7NVUVXU.js} +3 -3
  72. package/dist/{redact-doc-SWJC27LL.js → redact-doc-GIBTFWCO.js} +11 -11
  73. package/dist/{render-45AB5YZR.js → render-JVCGYRRO.js} +7 -7
  74. package/dist/seal-WNX2ZJTK.js +10 -0
  75. package/dist/{setup-5PBMUI6M.js → setup-7L7EQPMG.js} +3 -3
  76. package/dist/visual-VPWPXIHN.js +21 -0
  77. package/dist/{watch-QOGKV52T.js → watch-VYMFGX72.js} +12 -12
  78. package/package.json +1 -1
  79. package/dist/chunk-NLGOMLGU.cjs.map +0 -1
  80. package/dist/chunk-OIF5HRVP.js.map +0 -1
  81. package/dist/chunk-SKRWKVVW.js.map +0 -1
  82. package/dist/chunk-UCLDUUBX.js.map +0 -1
  83. package/dist/chunk-YOGMCRM7.js.map +0 -1
  84. package/dist/chunks-7KXTS7IV.js +0 -10
  85. package/dist/parser-E6BG3ECD.js.map +0 -1
  86. package/dist/parser-OAXCXVQ4.cjs.map +0 -1
  87. package/dist/parser-SJHCBL7T.js.map +0 -1
  88. package/dist/pdf-ocr-RKXDY3ZA.cjs +0 -31
  89. package/dist/seal-7KWG6VHS.js +0 -10
  90. package/dist/visual-OMJNXLNZ.js +0 -21
  91. /package/dist/{-AOWV7MNY.js.map → -WFRWBH7T.js.map} +0 -0
  92. /package/dist/{chunk-3ANXRVI2.js.map → chunk-2L3Q7REU.js.map} +0 -0
  93. /package/dist/{chunk-FDFXL7VJ.js.map → chunk-35ZHXEJA.js.map} +0 -0
  94. /package/dist/{chunk-BS2XWGT5.js.map → chunk-3BR7VKWL.js.map} +0 -0
  95. /package/dist/{chunk-KBGNPGVY.js.map → chunk-3G3TLZDK.js.map} +0 -0
  96. /package/dist/{chunk-M2X766AY.js.map → chunk-3YEL7P4L.js.map} +0 -0
  97. /package/dist/{chunk-DKJ2RNDG.js.map → chunk-4TWN7PWJ.js.map} +0 -0
  98. /package/dist/{chunk-3H2IEU4V.js.map → chunk-63N6CEJE.js.map} +0 -0
  99. /package/dist/{chunk-MEIQ476H.js.map → chunk-6MCC2XNB.js.map} +0 -0
  100. /package/dist/{chunk-4NQ4EZEE.js.map → chunk-C3REGEQO.js.map} +0 -0
  101. /package/dist/{chunk-6LIBF2ZB.js.map → chunk-CO7O3ZT6.js.map} +0 -0
  102. /package/dist/{chunk-IRNWAHHZ.js.map → chunk-CRSTBATY.js.map} +0 -0
  103. /package/dist/{chunk-VJCQOSMT.js.map → chunk-CW67DAAH.js.map} +0 -0
  104. /package/dist/{chunk-6QBBGZST.js.map → chunk-DN55FTJP.js.map} +0 -0
  105. /package/dist/{chunk-24YLYR6Q.js.map → chunk-LE4VHWIT.js.map} +0 -0
  106. /package/dist/{chunk-7XITVUAK.js.map → chunk-PSORL4PA.js.map} +0 -0
  107. /package/dist/{chunk-AXX5AQT4.js.map → chunk-RYKDIUHT.js.map} +0 -0
  108. /package/dist/{chunk-O5E25RHU.js.map → chunk-SETAYS6P.js.map} +0 -0
  109. /package/dist/{chunk-X45Q7EAC.js.map → chunk-T7OZ7X6A.js.map} +0 -0
  110. /package/dist/{chunk-J5PYESLX.js.map → chunk-TOUJCO2P.js.map} +0 -0
  111. /package/dist/{chunks-7KXTS7IV.js.map → chunks-NXABWR6G.js.map} +0 -0
  112. /package/dist/{formula-W4OL33YQ.js.map → formula-FSVHUQ6Y.js.map} +0 -0
  113. /package/dist/{formula-C26FMMGO.js.map → formula-L625ULJP.js.map} +0 -0
  114. /package/dist/{image-ocr-T72HMX2W.js.map → image-ocr-KE3RUS3R.js.map} +0 -0
  115. /package/dist/{image-ocr-NSQ34Y6T.js.map → image-ocr-QTZNBP5V.js.map} +0 -0
  116. /package/dist/{model-bundle-34T2LJB4.js.map → model-bundle-F6TU6ZAV.js.map} +0 -0
  117. /package/dist/{models-TQH5EM6V.js.map → models-ZHNNVH2W.js.map} +0 -0
  118. /package/dist/{parse-worker-v2-YEYLILGJ.js.map → parse-worker-v2-KQRG3NQO.js.map} +0 -0
  119. /package/dist/{pdf-ocr-LGPSJM22.js.map → pdf-ocr-X5XLGL5J.js.map} +0 -0
  120. /package/dist/{pdf-ocr-T5ASSUKK.js.map → pdf-ocr-ZP2CUWSO.js.map} +0 -0
  121. /package/dist/{profile-io-KMCAFTMG.js.map → profile-io-B4VSI4LW.js.map} +0 -0
  122. /package/dist/{rasterize-M52AKY7R.js.map → rasterize-Y7NVUVXU.js.map} +0 -0
  123. /package/dist/{redact-doc-SWJC27LL.js.map → redact-doc-GIBTFWCO.js.map} +0 -0
  124. /package/dist/{render-45AB5YZR.js.map → render-JVCGYRRO.js.map} +0 -0
  125. /package/dist/{seal-7KWG6VHS.js.map → seal-WNX2ZJTK.js.map} +0 -0
  126. /package/dist/{setup-5PBMUI6M.js.map → setup-7L7EQPMG.js.map} +0 -0
  127. /package/dist/{visual-OMJNXLNZ.js.map → visual-VPWPXIHN.js.map} +0 -0
  128. /package/dist/{watch-QOGKV52T.js.map → watch-VYMFGX72.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 _chunk2BCQVQO2cjs = require('./chunk-2BCQVQO2.cjs');
4
+ var _chunkN6KXGIINcjs = require('./chunk-N6KXGIIN.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 _chunkNLGOMLGUcjs = require('./chunk-NLGOMLGU.cjs');
64
+ var _chunkC6B5GWN7cjs = require('./chunk-C6B5GWN7.cjs');
65
65
 
66
66
 
67
67
 
@@ -75,12 +75,13 @@ var _chunkNLGOMLGUcjs = require('./chunk-NLGOMLGU.cjs');
75
75
 
76
76
 
77
77
 
78
- var _chunkSJ5OZXELcjs = require('./chunk-SJ5OZXEL.cjs');
79
- require('./chunk-O3OS6FAW.cjs');
80
78
 
79
+ var _chunkYG4GFQB7cjs = require('./chunk-YG4GFQB7.cjs');
80
+ require('./chunk-UCK6WGHY.cjs');
81
81
 
82
82
 
83
- var _chunkMI655NV5cjs = require('./chunk-MI655NV5.cjs');
83
+
84
+ var _chunkAS25R4EUcjs = require('./chunk-AS25R4EU.cjs');
84
85
 
85
86
 
86
87
  var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
@@ -217,7 +218,7 @@ async function extractPageImages(page, fnArray, argsArray, pageNumber, state, wa
217
218
  const filename = `image_${String(state.imageIndex).padStart(3, "0")}.png`;
218
219
  state.seen.set(hash, filename);
219
220
  if (withBytes) {
220
- const png = _chunk2BCQVQO2cjs.encodePng.call(void 0, w, h, rgba);
221
+ const png = _chunkN6KXGIINcjs.encodePng.call(void 0, w, h, rgba);
221
222
  state.totalBytes += png.length;
222
223
  images.push({ filename, data: png, mimeType: "image/png" });
223
224
  }
@@ -613,13 +614,27 @@ function ocrVectorOps(opList, paths) {
613
614
 
614
615
  // src/pdf/split-row-pattern.ts
615
616
  var textOf = (cell) => cell.text.replace(/<\/?u>|~~/g, "").trim();
616
- var plain = (cell) => !_optionalChain([cell, 'access', _9 => _9.blocks, 'optionalAccess', _10 => _10.length]) && !_chunkNLGOMLGUcjs.IMAGE_CELLS.has(cell);
617
- function matchesIndependentRowPair(table, owner, first) {
618
- const norm = (cell) => textOf(cell).replace(/\s+/g, "");
617
+ var plain = (cell) => !_optionalChain([cell, 'access', _9 => _9.blocks, 'optionalAccess', _10 => _10.length]) && !_chunkC6B5GWN7cjs.IMAGE_CELLS.has(cell);
618
+ var labelsOf = (cell) => {
619
+ const labels = textOf(cell).split("\n").map((s) => s.trim()).filter(Boolean);
620
+ 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;
621
+ };
622
+ var alignedLabels = (label, value, count) => {
623
+ const L = _chunkC6B5GWN7cjs.CELL_LINES.get(label), V = _chunkC6B5GWN7cjs.CELL_LINES.get(value);
624
+ let next = 0;
625
+ return !!L && !!V && L.length === count && V.length >= count && Math.abs(L[0].y - V[0].y) <= 1 && L.every((l) => {
626
+ while (next < V.length && Math.abs(l.y - V[next].y) > 1) next++;
627
+ return next++ < V.length;
628
+ });
629
+ };
630
+ function partialAlignedLabelCells(table, owner, first) {
631
+ const pageOf = (a) => _nullishCoalesce(_chunkYG4GFQB7cjs.CELL_PAGES.get(_nullishCoalesce(a.cell, () => ( table.cells[a.r][a.c]))), () => ( (a.r < first ? -1 : -2)));
619
632
  const pairs = [];
633
+ let carried = false;
620
634
  for (let c = 0; c < table.cols; ) {
621
635
  const u = _optionalChain([owner, 'access', _11 => _11[first - 1], 'optionalAccess', _12 => _12[c]]), d = _optionalChain([owner, 'access', _13 => _13[first], 'optionalAccess', _14 => _14[c]]);
622
636
  if (u && u === d) {
637
+ carried = true;
623
638
  c = u.c + u.cs;
624
639
  continue;
625
640
  }
@@ -628,6 +643,103 @@ function matchesIndependentRowPair(table, owner, first) {
628
643
  c++;
629
644
  continue;
630
645
  }
646
+ if (!u || !d || !upper || !lower || u.r !== first - 1 || d.r !== first || u.c !== c || d.c !== c || u.rs !== 1 || d.rs !== 1 || u.cs !== d.cs || !plain(upper) || !plain(lower) || !textOf(upper) || !textOf(lower)) return;
647
+ pairs.push({ c, cs: u.cs, upper, lower });
648
+ c += u.cs;
649
+ }
650
+ if (!carried || pairs.length !== 3) return;
651
+ const keyed = pairs.filter((p) => labelsOf(p.upper) && labelsOf(p.lower));
652
+ if (keyed.length !== 1) return;
653
+ const label = keyed[0], value = pairs.find((p) => p.c === label.c + label.cs), context = pairs.find((p) => p.c + p.cs === label.c);
654
+ if (!value || !context || value === context || textOf(context.upper).replace(/\s+/g, "") === textOf(context.lower).replace(/\s+/g, "") || !_optionalChain([_chunkYG4GFQB7cjs.CELL_EDGES, 'access', _21 => _21.get, 'call', _22 => _22(context.upper), 'optionalAccess', _23 => _23.b]) || !_optionalChain([_chunkYG4GFQB7cjs.CELL_EDGES, 'access', _24 => _24.get, 'call', _25 => _25(context.lower), 'optionalAccess', _26 => _26.t])) return;
655
+ const U = labelsOf(label.upper), D = labelsOf(label.lower), sequence = [...U, ...D];
656
+ if (D.length < 2 || sequence.length < 3 || new Set(sequence).size !== sequence.length || !alignedLabels(label.upper, value.upper, U.length)) return;
657
+ const L = _chunkC6B5GWN7cjs.CELL_LINES.get(label.lower), V = _chunkC6B5GWN7cjs.CELL_LINES.get(value.lower);
658
+ if (!L || !V || L.length !== D.length) return;
659
+ let next = V.findIndex((v) => Math.abs(v.y - L[0].y) <= 1);
660
+ if (next <= 0 || !V.slice(0, next).every((v) => v.y > L[0].y + 1) || !L.every((l) => {
661
+ while (next < V.length && Math.abs(l.y - V[next].y) > 1) next++;
662
+ return next++ < V.length;
663
+ })) return;
664
+ let peers = 0, shared = false;
665
+ for (let r = 0; r < table.rows; r++) {
666
+ if (r === first - 1 || r === first) continue;
667
+ const l = _optionalChain([owner, 'access', _27 => _27[r], 'optionalAccess', _28 => _28[label.c]]), v = _optionalChain([owner, 'access', _29 => _29[r], 'optionalAccess', _30 => _30[value.c]]);
668
+ if (!l || !v || l.r !== r || v.r !== r || l.c !== label.c || v.c !== value.c || l.cs !== label.cs || v.cs !== value.cs || l.rs !== v.rs) continue;
669
+ const lc = table.cells[r][l.c], vc = table.cells[r][v.c];
670
+ const list = labelsOf(lc);
671
+ if (!plain(lc) || !plain(vc) || !textOf(vc) || !list || pageOf(l) !== pageOf(v)) continue;
672
+ if (l.rs === 1) {
673
+ if (list.join("|") === sequence.join("|") && alignedLabels(lc, vc, list.length)) peers++;
674
+ continue;
675
+ }
676
+ if (list.length < 3 || new Set(list).size !== list.length) continue;
677
+ const visible = _nullishCoalesce(_optionalChain([_chunkC6B5GWN7cjs.CELL_LINES, 'access', _31 => _31.get, 'call', _32 => _32(lc), 'optionalAccess', _33 => _33.length]), () => ( 0)), values = _chunkC6B5GWN7cjs.CELL_LINES.get(vc);
678
+ if (visible < 3 || visible > list.length || !values || !alignedLabels(lc, vc, visible)) continue;
679
+ const top = Math.max(...values.map((v2) => v2.y)), bottom = Math.min(...values.map((v2) => v2.y));
680
+ const contexts = [];
681
+ for (let rr = r; rr < r + l.rs && rr < table.rows; rr++) {
682
+ const a = _optionalChain([owner, 'access', _34 => _34[rr], 'optionalAccess', _35 => _35[context.c]]), cell = a ? table.cells[a.r][a.c] : void 0;
683
+ 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;
684
+ const lines = _chunkC6B5GWN7cjs.CELL_LINES.get(cell);
685
+ if (!_optionalChain([lines, 'optionalAccess', _36 => _36.length]) || lines.some((line) => line.y > top + 1 || line.y < bottom - 1)) break;
686
+ contexts.push(textOf(cell).replace(/\s+/g, ""));
687
+ }
688
+ if (new Set(contexts).size >= 2) shared = true;
689
+ }
690
+ return peers >= 2 && shared ? { context, label, value } : void 0;
691
+ }
692
+ function matchesCompleteAlignedLabelListRow(table, owner, first) {
693
+ const pairs = [];
694
+ let carried = false;
695
+ for (let c = 0; c < table.cols; ) {
696
+ const u = _optionalChain([owner, 'access', _37 => _37[first - 1], 'optionalAccess', _38 => _38[c]]), d = _optionalChain([owner, 'access', _39 => _39[first], 'optionalAccess', _40 => _40[c]]);
697
+ if (u && u === d) {
698
+ carried = true;
699
+ c = u.c + u.cs;
700
+ continue;
701
+ }
702
+ const upper = u ? table.cells[u.r][u.c] : void 0, lower = d ? table.cells[d.r][d.c] : void 0;
703
+ if (!_optionalChain([upper, 'optionalAccess', _41 => _41.text, 'access', _42 => _42.trim, 'call', _43 => _43()]) && !_optionalChain([lower, 'optionalAccess', _44 => _44.text, 'access', _45 => _45.trim, 'call', _46 => _46()])) {
704
+ c++;
705
+ continue;
706
+ }
707
+ if (!u || !d || !upper || !lower || u.r !== first - 1 || d.r !== first || u.c !== c || d.c !== c || u.rs !== 1 || d.rs !== 1 || u.cs !== d.cs || !plain(upper) || !plain(lower)) return false;
708
+ pairs.push({ c, cs: u.cs, upper, lower });
709
+ c += u.cs;
710
+ }
711
+ const filled = pairs.filter((p) => textOf(p.upper) && textOf(p.lower));
712
+ if (!carried || filled.length !== 2) return false;
713
+ const keyed = filled.filter((p) => labelsOf(p.upper) && labelsOf(p.lower));
714
+ if (keyed.length !== 1) return false;
715
+ const label = keyed[0], value = filled.find((p) => p !== label);
716
+ const U = labelsOf(label.upper), D = labelsOf(label.lower), sequence = [...U, ...D];
717
+ if (D.length < 2 || sequence.length < 3 || new Set(sequence).size !== sequence.length || value.c !== label.c + label.cs || pairs.some((p) => p !== label && p !== value && textOf(p.lower)) || !pairs.some((p) => p.c < label.c && textOf(p.upper) && !textOf(p.lower)) || !alignedLabels(label.upper, value.upper, U.length) || !alignedLabels(label.lower, value.lower, D.length)) return false;
718
+ let peers = 0;
719
+ for (let r = 0; r < table.rows; r++) {
720
+ if (r === first - 1 || r === first) continue;
721
+ const L = _optionalChain([owner, 'access', _47 => _47[r], 'optionalAccess', _48 => _48[label.c]]), V = _optionalChain([owner, 'access', _49 => _49[r], 'optionalAccess', _50 => _50[value.c]]);
722
+ if (_optionalChain([L, 'optionalAccess', _51 => _51.r]) !== r || _optionalChain([V, 'optionalAccess', _52 => _52.r]) !== r || L.c !== label.c || V.c !== value.c || L.rs !== 1 || V.rs !== 1 || L.cs !== label.cs || V.cs !== value.cs) continue;
723
+ const l = table.cells[r][label.c], v = table.cells[r][value.c];
724
+ if (!plain(l) || !plain(v) || !textOf(v) || _optionalChain([labelsOf, 'call', _53 => _53(l), 'optionalAccess', _54 => _54.join, 'call', _55 => _55("|")]) !== sequence.join("|") || !alignedLabels(l, v, sequence.length)) continue;
725
+ if (++peers >= 2) return true;
726
+ }
727
+ return false;
728
+ }
729
+ function matchesIndependentRowPair(table, owner, first) {
730
+ const norm = (cell) => textOf(cell).replace(/\s+/g, "");
731
+ const pairs = [];
732
+ for (let c = 0; c < table.cols; ) {
733
+ const u = _optionalChain([owner, 'access', _56 => _56[first - 1], 'optionalAccess', _57 => _57[c]]), d = _optionalChain([owner, 'access', _58 => _58[first], 'optionalAccess', _59 => _59[c]]);
734
+ if (u && u === d) {
735
+ c = u.c + u.cs;
736
+ continue;
737
+ }
738
+ const upper = u ? table.cells[u.r][u.c] : void 0, lower = d ? table.cells[d.r][d.c] : void 0;
739
+ if (!_optionalChain([upper, 'optionalAccess', _60 => _60.text, 'access', _61 => _61.trim, 'call', _62 => _62()]) && !_optionalChain([lower, 'optionalAccess', _63 => _63.text, 'access', _64 => _64.trim, 'call', _65 => _65()])) {
740
+ c++;
741
+ continue;
742
+ }
631
743
  if (!u || !d || !upper || !lower || u.r !== first - 1 || d.r !== first || u.c !== c || d.c !== c || u.rs !== 1 || d.rs !== 1 || u.cs !== d.cs || !plain(upper) || !plain(lower) || !norm(upper) || !norm(lower)) return false;
632
744
  pairs.push({ c, cs: u.cs, upper: norm(upper), lower: norm(lower) });
633
745
  c += u.cs;
@@ -636,8 +748,8 @@ function matchesIndependentRowPair(table, owner, first) {
636
748
  return table.cells.some((_, r) => {
637
749
  if (r + 1 >= table.rows || r + 1 >= first - 1 && r <= first) return false;
638
750
  return pairs.every((p) => [p.upper, p.lower].every((text, i) => {
639
- const a = _optionalChain([owner, 'access', _21 => _21[r + i], 'optionalAccess', _22 => _22[p.c]]), cell = _optionalChain([table, 'access', _23 => _23.cells, 'access', _24 => _24[r + i], 'optionalAccess', _25 => _25[p.c]]);
640
- return _optionalChain([a, 'optionalAccess', _26 => _26.r]) === r + i && a.c === p.c && a.rs === 1 && a.cs === p.cs && !!cell && plain(cell) && norm(cell) === text;
751
+ const a = _optionalChain([owner, 'access', _66 => _66[r + i], 'optionalAccess', _67 => _67[p.c]]), cell = _optionalChain([table, 'access', _68 => _68.cells, 'access', _69 => _69[r + i], 'optionalAccess', _70 => _70[p.c]]);
752
+ return _optionalChain([a, 'optionalAccess', _71 => _71.r]) === r + i && a.c === p.c && a.rs === 1 && a.cs === p.cs && !!cell && plain(cell) && norm(cell) === text;
641
753
  }));
642
754
  });
643
755
  }
@@ -646,7 +758,7 @@ function matchesCompleteContextRow(table, owner, first) {
646
758
  const context = [];
647
759
  let value;
648
760
  for (let c = 0; c < table.cols; ) {
649
- const u = _optionalChain([owner, 'access', _27 => _27[first - 1], 'optionalAccess', _28 => _28[c]]), d = _optionalChain([owner, 'access', _29 => _29[first], 'optionalAccess', _30 => _30[c]]);
761
+ const u = _optionalChain([owner, 'access', _72 => _72[first - 1], 'optionalAccess', _73 => _73[c]]), d = _optionalChain([owner, 'access', _74 => _74[first], 'optionalAccess', _75 => _75[c]]);
650
762
  if (u && u === d) {
651
763
  const cell = table.cells[u.r][u.c];
652
764
  if (u.r === first - 1 && u.rs === 2 && plain(cell) && textOf(cell)) context.push({ c, cs: u.cs, text: norm(textOf(cell)) });
@@ -654,7 +766,7 @@ function matchesCompleteContextRow(table, owner, first) {
654
766
  continue;
655
767
  }
656
768
  const upper = u ? table.cells[u.r][u.c] : void 0, lower = d ? table.cells[d.r][d.c] : void 0;
657
- if (!_optionalChain([upper, 'optionalAccess', _31 => _31.text, 'access', _32 => _32.trim, 'call', _33 => _33()]) && !_optionalChain([lower, 'optionalAccess', _34 => _34.text, 'access', _35 => _35.trim, 'call', _36 => _36()])) {
769
+ if (!_optionalChain([upper, 'optionalAccess', _76 => _76.text, 'access', _77 => _77.trim, 'call', _78 => _78()]) && !_optionalChain([lower, 'optionalAccess', _79 => _79.text, 'access', _80 => _80.trim, 'call', _81 => _81()])) {
658
770
  c++;
659
771
  continue;
660
772
  }
@@ -665,8 +777,8 @@ function matchesCompleteContextRow(table, owner, first) {
665
777
  if (!value || !context.length) return false;
666
778
  const proof = [...context, value];
667
779
  return table.cells.some((row, r) => r !== first - 1 && r !== first && proof.every((p) => {
668
- const a = _optionalChain([owner, 'access', _37 => _37[r], 'optionalAccess', _38 => _38[p.c]]), cell = row[p.c];
669
- return _optionalChain([a, 'optionalAccess', _39 => _39.r]) === r && a.c === p.c && a.rs === 1 && a.cs === p.cs && !!cell && plain(cell) && norm(textOf(cell)) === p.text;
780
+ const a = _optionalChain([owner, 'access', _82 => _82[r], 'optionalAccess', _83 => _83[p.c]]), cell = row[p.c];
781
+ return _optionalChain([a, 'optionalAccess', _84 => _84.r]) === r && a.c === p.c && a.rs === 1 && a.cs === p.cs && !!cell && plain(cell) && norm(textOf(cell)) === p.text;
670
782
  }));
671
783
  }
672
784
  function matchesCompleteSiblingRow(table, owner, first) {
@@ -694,7 +806,7 @@ function matchesCompleteSiblingRow(table, owner, first) {
694
806
  const norm = (s, title) => (title ? s.replace(/^[가-힣]\.\s*/, "") : s).replace(/\s+/g, "");
695
807
  return table.cells.some((row, r) => r !== first - 1 && r !== first && pairs.every((p) => {
696
808
  const anchor = owner[r][p.c], peer = row[p.c];
697
- return _optionalChain([anchor, 'optionalAccess', _40 => _40.r]) === r && anchor.c === p.c && anchor.rs === 1 && anchor.cs === p.cs && plain(peer) && norm(textOf(peer), p === main) === norm(textOf(p.upper) + "\n" + textOf(p.lower), p === main);
809
+ return _optionalChain([anchor, 'optionalAccess', _85 => _85.r]) === r && anchor.c === p.c && anchor.rs === 1 && anchor.cs === p.cs && plain(peer) && norm(textOf(peer), p === main) === norm(textOf(p.upper) + "\n" + textOf(p.lower), p === main);
698
810
  }));
699
811
  }
700
812
  function matchesCompleteRubricRow(table, owner, first) {
@@ -728,7 +840,7 @@ function matchesCompleteRubricRow(table, owner, first) {
728
840
  return table.cells.some((row, r) => {
729
841
  if (r === first - 1 || r === first || !pairs.every((p) => {
730
842
  const a = owner[r][p.c];
731
- return _optionalChain([a, 'optionalAccess', _41 => _41.r]) === r && a.c === p.c && a.rs === 1 && a.cs === p.cs && plain(row[p.c]);
843
+ return _optionalChain([a, 'optionalAccess', _86 => _86.r]) === r && a.c === p.c && a.rs === 1 && a.cs === p.cs && plain(row[p.c]);
732
844
  })) return false;
733
845
  const peer = textOf(row[main.c]), peerMarks = items(peer);
734
846
  return peerMarks.length === marks.length && peerMarks.every((m, i) => m.n === marks[i].n) && values(row[score.c]).join("|") === scores.join("|") && norm(peer.slice(peerMarks[peerMarks.length - 1].at)) === tail;
@@ -750,11 +862,11 @@ function hasNumberedRowSequence(table, owner, first) {
750
862
  if (first < 3) return false;
751
863
  const rows = [first - 3, first - 2, first - 1, first];
752
864
  const separate = (c, cs) => rows.every((r) => {
753
- const a = _optionalChain([owner, 'access', _42 => _42[r], 'optionalAccess', _43 => _43[c]]), cell = _optionalChain([table, 'access', _44 => _44.cells, 'access', _45 => _45[r], 'optionalAccess', _46 => _46[c]]);
754
- return _optionalChain([a, 'optionalAccess', _47 => _47.r]) === r && a.c === c && a.rs === 1 && a.cs === cs && !!cell && plain(cell) && !!textOf(cell);
865
+ const a = _optionalChain([owner, 'access', _87 => _87[r], 'optionalAccess', _88 => _88[c]]), cell = _optionalChain([table, 'access', _89 => _89.cells, 'access', _90 => _90[r], 'optionalAccess', _91 => _91[c]]);
866
+ return _optionalChain([a, 'optionalAccess', _92 => _92.r]) === r && a.c === c && a.rs === 1 && a.cs === cs && !!cell && plain(cell) && !!textOf(cell);
755
867
  });
756
868
  for (let c = 0; c < table.cols; c++) {
757
- const a = _optionalChain([owner, 'access', _48 => _48[first], 'optionalAccess', _49 => _49[c]]);
869
+ const a = _optionalChain([owner, 'access', _93 => _93[first], 'optionalAccess', _94 => _94[c]]);
758
870
  if (!a || !separate(c, a.cs)) continue;
759
871
  const marks = rows.map((r) => {
760
872
  const lines = textOf(table.cells[r][c]).split("\n"), firstMark = itemMark(lines[0]);
@@ -763,7 +875,7 @@ function hasNumberedRowSequence(table, owner, first) {
763
875
  const head = marks[0];
764
876
  if (!head || marks.some((m, i) => !m || m.style !== head.style || m.n !== head.n + i)) continue;
765
877
  for (let d = 0; d < table.cols; d++) {
766
- const side = _optionalChain([owner, 'access', _50 => _50[first], 'optionalAccess', _51 => _51[d]]);
878
+ const side = _optionalChain([owner, 'access', _95 => _95[first], 'optionalAccess', _96 => _96[d]]);
767
879
  if (side && (d + side.cs <= c || d >= c + a.cs) && separate(d, side.cs)) return true;
768
880
  }
769
881
  }
@@ -836,7 +948,7 @@ var CELL_SPLITS = /* @__PURE__ */ new WeakMap();
836
948
  function relocate(src, dst, from = 0) {
837
949
  const out = [];
838
950
  for (const s of _nullishCoalesce(CELL_SPLITS.get(src), () => ( []))) {
839
- const at = dst.text.indexOf(src.text.slice(s.at, s.at + 20).trimEnd(), Math.max(from, _nullishCoalesce(_optionalChain([out, 'access', _52 => _52.at, 'call', _53 => _53(-1), 'optionalAccess', _54 => _54.at]), () => ( 0))));
951
+ const at = dst.text.indexOf(src.text.slice(s.at, s.at + 20).trimEnd(), Math.max(from, _nullishCoalesce(_optionalChain([out, 'access', _97 => _97.at, 'call', _98 => _98(-1), 'optionalAccess', _99 => _99.at]), () => ( 0))));
840
952
  if (at >= 0) out.push({ at, page: s.page });
841
953
  }
842
954
  return out;
@@ -860,7 +972,7 @@ function rowStarts(t) {
860
972
  const starts = [];
861
973
  for (let c = 0; c < t.cols; c++) {
862
974
  if (covered.has(r * 1e5 + c)) continue;
863
- const cell = _optionalChain([t, 'access', _55 => _55.cells, 'access', _56 => _56[r], 'optionalAccess', _57 => _57[c]]);
975
+ const cell = _optionalChain([t, 'access', _100 => _100.cells, 'access', _101 => _101[r], 'optionalAccess', _102 => _102[c]]);
864
976
  if (!cell) continue;
865
977
  for (let dr = 0; dr < cell.rowSpan; dr++) for (let dc = 0; dc < cell.colSpan; dc++) if (dr || dc) covered.add((r + dr) * 1e5 + c + dc);
866
978
  starts.push({ cell, c });
@@ -871,8 +983,8 @@ function rowStarts(t) {
871
983
  }
872
984
  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));
873
985
  function cellPage(cell) {
874
- const p = _chunkSJ5OZXELcjs.CELL_PAGES.get(cell);
875
- if (p !== void 0 || !_optionalChain([cell, 'access', _58 => _58.blocks, 'optionalAccess', _59 => _59.length]) || cell.blocks.some((b) => b.pageNumber === void 0)) return p;
986
+ const p = _chunkYG4GFQB7cjs.CELL_PAGES.get(cell);
987
+ if (p !== void 0 || !_optionalChain([cell, 'access', _103 => _103.blocks, 'optionalAccess', _104 => _104.length]) || cell.blocks.some((b) => b.pageNumber === void 0)) return p;
876
988
  return Math.min(...cell.blocks.map((b) => b.pageNumber));
877
989
  }
878
990
  function tableRowPages(t, pageNumber) {
@@ -883,7 +995,7 @@ function tableRowPages(t, pageNumber) {
883
995
  for (const { cell } of starts) {
884
996
  const p = cellPage(cell);
885
997
  if (p !== void 0) mark = Math.max(_nullishCoalesce(mark, () => ( p)), p);
886
- else if (cell.text.trim() || _optionalChain([cell, 'access', _60 => _60.blocks, 'optionalAccess', _61 => _61.length])) text = true;
998
+ else if (cell.text.trim() || _optionalChain([cell, 'access', _105 => _105.blocks, 'optionalAccess', _106 => _106.length])) text = true;
887
999
  }
888
1000
  const page = _nullishCoalesce(mark, () => ( (text ? pageNumber : prev)));
889
1001
  prev = page !== void 0 && prev !== void 0 ? Math.max(prev, page) : _nullishCoalesce(page, () => ( prev));
@@ -900,18 +1012,29 @@ function markJoinedPages(table, prev, curr) {
900
1012
  rows.forEach((starts, r) => {
901
1013
  const page2 = r < pt.rows ? pp[r] : cp[r - off];
902
1014
  for (const { cell } of starts) {
903
- if (page2 !== void 0 && page2 !== prev.pageNumber) _chunkSJ5OZXELcjs.CELL_PAGES.set(cell, page2);
904
- const src = _optionalChain([(r < pt.rows ? ptRows[r] : ctRows[r - off]), 'optionalAccess', _62 => _62.find, 'call', _63 => _63((s) => s.cell !== cell && s.cell.text === cell.text && CELL_SPLITS.has(s.cell))]);
1015
+ if (page2 !== void 0 && page2 !== prev.pageNumber) _chunkYG4GFQB7cjs.CELL_PAGES.set(cell, page2);
1016
+ 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))]);
905
1017
  if (src) setSplits(cell, relocate(src.cell, cell));
906
1018
  }
907
1019
  });
908
1020
  const cr = pt.rows - 1 - off, page = cp[cr];
1021
+ if (cr === -1 && table.cols === pt.cols && pt.cols === ct.cols) {
1022
+ const tailPage = cp[0];
1023
+ if (tailPage === void 0 || tailPage === prev.pageNumber) return;
1024
+ for (let r = 0; r < pt.rows; r++) for (const { cell, c } of rows[r]) {
1025
+ const head = _optionalChain([ptRows, 'access', _109 => _109[r], 'optionalAccess', _110 => _110.find, 'call', _111 => _111((s) => s.c === c), 'optionalAccess', _112 => _112.cell]), tail = _optionalChain([ctRows, 'access', _113 => _113[0], 'optionalAccess', _114 => _114.find, 'call', _115 => _115((s) => s.c === c), 'optionalAccess', _116 => _116.cell]);
1026
+ if (!_optionalChain([head, 'optionalAccess', _117 => _117.text, 'access', _118 => _118.trim, 'call', _119 => _119()]) || !_optionalChain([tail, 'optionalAccess', _120 => _120.text, 'access', _121 => _121.trim, 'call', _122 => _122()]) || _optionalChain([cell, 'access', _123 => _123.blocks, 'optionalAccess', _124 => _124.length]) || cell.colSpan !== head.colSpan || cell.colSpan !== tail.colSpan || cell.rowSpan <= head.rowSpan || r + head.rowSpan !== pt.rows || r + cell.rowSpan <= pt.rows || !cell.text.startsWith(head.text.trimEnd()) || !cell.text.trimEnd().endsWith(tail.text.trimEnd())) continue;
1027
+ const from = head.text.trimEnd().length, at = cell.text.indexOf(tail.text.trim().slice(0, 20), from);
1028
+ if (at >= from) setSplits(cell, [...relocate(head, cell), { at, page: tailPage }, ...relocate(tail, cell, at)]);
1029
+ }
1030
+ return;
1031
+ }
909
1032
  if (cr < 0 || page === void 0 || page === prev.pageNumber) return;
910
1033
  const tails = ctRows[cr].filter((s) => s.cell.text.trim());
911
1034
  for (const { cell } of ctRows[cr]) for (const b of _nullishCoalesce(cell.blocks, () => ( []))) b.pageNumber ??= page;
912
1035
  const heads = covering(pt, pt.rows - 1);
913
1036
  for (const cell of covering(table, pt.rows - 1)) {
914
- if (_optionalChain([cell, 'access', _64 => _64.blocks, 'optionalAccess', _65 => _65.length])) continue;
1037
+ if (_optionalChain([cell, 'access', _125 => _125.blocks, 'optionalAccess', _126 => _126.length])) continue;
915
1038
  const head = heads.filter((h) => h.text.trim() && cell.text.startsWith(h.text.trimEnd()) && cell.text.trim().length > h.text.trim().length).sort((a, b) => b.text.length - a.text.length)[0];
916
1039
  if (!head) continue;
917
1040
  const from = head.text.trimEnd().length;
@@ -922,7 +1045,7 @@ function markJoinedPages(table, prev, curr) {
922
1045
  }
923
1046
  function splitCell(cell, page) {
924
1047
  if (page === void 0) return null;
925
- if (_optionalChain([cell, 'access', _66 => _66.blocks, 'optionalAccess', _67 => _67.length])) {
1048
+ if (_optionalChain([cell, 'access', _127 => _127.blocks, 'optionalAccess', _128 => _128.length])) {
926
1049
  const k2 = cell.blocks.findIndex((b) => (_nullishCoalesce(b.pageNumber, () => ( page))) > page);
927
1050
  if (k2 <= 0) return null;
928
1051
  const head = cell.blocks.slice(0, k2), tail = cell.blocks.slice(k2);
@@ -949,18 +1072,29 @@ function splitCrossPageRows(t, pageNumber) {
949
1072
  if (!splits.length) continue;
950
1073
  const clone = (cell, patch) => {
951
1074
  const out = { ...cell, ...patch };
952
- const p = _chunkSJ5OZXELcjs.CELL_PAGES.get(cell);
953
- if (p !== void 0) _chunkSJ5OZXELcjs.CELL_PAGES.set(out, p);
1075
+ const p = _chunkYG4GFQB7cjs.CELL_PAGES.get(cell);
1076
+ if (p !== void 0) _chunkYG4GFQB7cjs.CELL_PAGES.set(out, p);
954
1077
  if (!("text" in patch) && CELL_SPLITS.has(cell)) CELL_SPLITS.set(out, CELL_SPLITS.get(cell));
955
1078
  return out;
956
1079
  };
957
1080
  const e = Math.max(...splits.map((s) => r + s.cell.rowSpan - 1));
958
1081
  const cells = t.cells.map((row2) => row2.slice());
1082
+ const cut = pages.findIndex((p, rr) => rr > r && p !== pages[r]);
1083
+ if (cut > r && splits.every((s) => cut < r + s.cell.rowSpan && pages[cut] === s.split.page)) {
1084
+ for (const { cell, c, split } of splits) {
1085
+ cells[r][c] = clone(cell, { ...split.head, rowSpan: cut - r });
1086
+ const tail = { ...cell, ...split.tail, rowSpan: r + cell.rowSpan - cut };
1087
+ _chunkYG4GFQB7cjs.CELL_PAGES.set(tail, split.page);
1088
+ setSplits(tail, split.rest);
1089
+ cells[cut][c] = tail;
1090
+ }
1091
+ return splitCrossPageRows({ ...t, cells }, pageNumber);
1092
+ }
959
1093
  const row = Array.from({ length: t.cols }, () => ({ text: "", colSpan: 1, rowSpan: 1 }));
960
1094
  for (const { cell, c, split } of splits) {
961
1095
  cells[r][c] = clone(cell, split.head);
962
1096
  const tail = { ...cell, ...split.tail, rowSpan: 1 };
963
- _chunkSJ5OZXELcjs.CELL_PAGES.set(tail, split.page);
1097
+ _chunkYG4GFQB7cjs.CELL_PAGES.set(tail, split.page);
964
1098
  setSplits(tail, split.rest);
965
1099
  row[c] = tail;
966
1100
  }
@@ -1002,7 +1136,7 @@ function anchorsOf(table) {
1002
1136
  for (let r = 0; r < table.rows; r++) {
1003
1137
  for (let c = 0; c < table.cols; c++) {
1004
1138
  if (covered.has(r * 1e5 + c)) continue;
1005
- const cell = _optionalChain([table, 'access', _68 => _68.cells, 'access', _69 => _69[r], 'optionalAccess', _70 => _70[c]]);
1139
+ const cell = _optionalChain([table, 'access', _129 => _129.cells, 'access', _130 => _130[r], 'optionalAccess', _131 => _131[c]]);
1006
1140
  if (!cell) continue;
1007
1141
  out.push({ r, c, rs: cell.rowSpan, cs: cell.colSpan, cell });
1008
1142
  for (let dr = 0; dr < cell.rowSpan; dr++) {
@@ -1079,24 +1213,24 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
1079
1213
  if (r + dr < rows) owner[r + dr][dc] = placed;
1080
1214
  }
1081
1215
  grid[r][c1] = { ...a.cell, colSpan: c2 - c1, rowSpan: a.rs };
1082
- const lines = _chunkNLGOMLGUcjs.CELL_LINES.get(a.cell);
1083
- if (lines) _chunkNLGOMLGUcjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
1084
- if (_chunkNLGOMLGUcjs.IMAGE_CELLS.has(a.cell)) _chunkNLGOMLGUcjs.IMAGE_CELLS.add(grid[r][c1]);
1085
- const edges = _chunkSJ5OZXELcjs.CELL_EDGES.get(a.cell);
1216
+ const lines = _chunkC6B5GWN7cjs.CELL_LINES.get(a.cell);
1217
+ if (lines) _chunkC6B5GWN7cjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
1218
+ if (_chunkC6B5GWN7cjs.IMAGE_CELLS.has(a.cell)) _chunkC6B5GWN7cjs.IMAGE_CELLS.add(grid[r][c1]);
1219
+ const edges = _chunkYG4GFQB7cjs.CELL_EDGES.get(a.cell);
1086
1220
  if (edges) {
1087
- _chunkSJ5OZXELcjs.CELL_EDGES.set(grid[r][c1], edges);
1221
+ _chunkYG4GFQB7cjs.CELL_EDGES.set(grid[r][c1], edges);
1088
1222
  edged = true;
1089
1223
  }
1090
1224
  return true;
1091
1225
  };
1092
- for (const a of pa) if (!_chunkNLGOMLGUcjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
1226
+ for (const a of pa) if (!_chunkC6B5GWN7cjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
1093
1227
  for (const a of ca) {
1094
- if (a.r < skip || _chunkNLGOMLGUcjs.FILLER_CELLS.has(a.cell)) continue;
1228
+ if (a.r < skip || _chunkC6B5GWN7cjs.FILLER_CELLS.has(a.cell)) continue;
1095
1229
  if (!place(a, cxU, prev.rows - skip, dx)) return null;
1096
1230
  }
1097
1231
  const first = prev.rows;
1098
1232
  for (let c = 0; c < cols; c++) {
1099
- const above = _optionalChain([owner, 'access', _71 => _71[first - 1], 'optionalAccess', _72 => _72[c]]);
1233
+ const above = _optionalChain([owner, 'access', _132 => _132[first - 1], 'optionalAccess', _133 => _133[c]]);
1100
1234
  if (!above) continue;
1101
1235
  let r = first;
1102
1236
  while (r < rows && owner[r][c] === null) r++;
@@ -1115,9 +1249,9 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
1115
1249
  const grown = { ...above, rs: newRs };
1116
1250
  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;
1117
1251
  }
1118
- for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkNLGOMLGUcjs.FILLER_CELLS.add(grid[r][c]);
1252
+ for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkC6B5GWN7cjs.FILLER_CELLS.add(grid[r][c]);
1119
1253
  if (edged) {
1120
- for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkSJ5OZXELcjs.CELL_EDGES.set(grid[r][c], _chunkNLGOMLGUcjs.NO_EDGES);
1254
+ for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkYG4GFQB7cjs.CELL_EDGES.set(grid[r][c], _chunkC6B5GWN7cjs.NO_EDGES);
1121
1255
  }
1122
1256
  for (let c = 0; c < cols && U[c + 1] <= pcx[0] + PART_COL_TOL; c++) {
1123
1257
  let r = prev.rows;
@@ -1126,22 +1260,25 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
1126
1260
  for (let rr = 0; rr < r; rr++) owner[rr][c] = through;
1127
1261
  }
1128
1262
  const table = { rows, cols, cells: grid, hasHeader: prev.hasHeader, ...prev.caption ? { caption: prev.caption } : {} };
1129
- const pr = _chunkNLGOMLGUcjs.ROW_RULES.get(prev), cr = _chunkNLGOMLGUcjs.ROW_RULES.get(curr);
1263
+ const pr = _chunkC6B5GWN7cjs.ROW_RULES.get(prev), cr = _chunkC6B5GWN7cjs.ROW_RULES.get(curr);
1130
1264
  const shifted = dx !== 0;
1131
1265
  const cut = {
1132
1266
  open: !!pr && !!cr && !pr.bottom && !cr.top && pr.innerOpen + cr.innerOpen === 0 && pr.innerRuled + cr.innerRuled > 0,
1133
1267
  ruled: !!pr && !!cr && pr.bottom && cr.top,
1134
1268
  list: !shifted ? "any" : skip > 0 && ca.filter((a) => a.r < skip && a.cell.text.trim()).length < 2 ? "none" : "multi"
1135
1269
  };
1136
- let split = rows > prev.rows && mergeSplitRow(table, owner, prev.rows, U, false, cut);
1137
- if (rows > prev.rows && !split && prevBottom !== void 0 && mergeStraddlingCells(table, owner, prev.rows, prevBottom, lex, U)) split = mergeSplitRow(table, owner, prev.rows, U, true, { ...cut, open: false });
1270
+ let partial = !skip && cols === prev.cols && cols === curr.cols && cut.ruled && prevBottom !== void 0 ? partialAlignedLabelCells(table, owner, first) : void 0;
1271
+ 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]) || _chunkC6B5GWN7cjs.startsNewItem.call(void 0, partial.value.upper.text, partial.value.lower.text))) partial = void 0;
1272
+ const selected = partial ? /* @__PURE__ */ new Set([partial.label.c, partial.value.c]) : void 0;
1273
+ let split = !selected && rows > prev.rows && mergeSplitRow(table, owner, prev.rows, U, false, cut);
1274
+ 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 });
1138
1275
  if (pr && cr) {
1139
1276
  const cutRuled = pr.bottom || cr.top;
1140
- _chunkNLGOMLGUcjs.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) });
1277
+ _chunkC6B5GWN7cjs.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) });
1141
1278
  }
1142
1279
  return { table, colXs: U, split, header: ca.filter((a) => a.r < skip && a.cell.text.trim()).length >= 2 };
1143
1280
  }
1144
- function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs) {
1281
+ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs, selected) {
1145
1282
  const last = first - 1;
1146
1283
  const straddles = owner[first].some((o, c) => o !== null && o === owner[last][c]);
1147
1284
  let firstNew = table.cols;
@@ -1198,19 +1335,20 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs) {
1198
1335
  c = u.c + u.cs;
1199
1336
  if (!d || d === u || u.r + u.rs - 1 !== last || d.r !== first || d.c !== u.c || d.cs !== u.cs) continue;
1200
1337
  const a = table.cells[u.r][u.c], b = table.cells[first][d.c];
1201
- const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !_chunkNLGOMLGUcjs.startsNewItem.call(void 0, a.text, b.text) && continuesAcross(a, b, colXs[u.c], colXs[u.c + u.cs]);
1202
- const openSeam = hasContent(a) && hasContent(b) && _chunkNLGOMLGUcjs.hasOpenCellSeam.call(void 0, a, b) && !owner.some((row, r) => {
1338
+ if (selected && !selected.has(u.c)) continue;
1339
+ const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !_chunkC6B5GWN7cjs.startsNewItem.call(void 0, a.text, b.text) && continuesAcross(a, b, colXs[u.c], colXs[u.c + u.cs]);
1340
+ const openSeam = hasContent(a) && hasContent(b) && _chunkC6B5GWN7cjs.hasOpenCellSeam.call(void 0, a, b) && !owner.some((row, r) => {
1203
1341
  if (!r || r === first) return false;
1204
1342
  const up = owner[r - 1][u.c], down = row[u.c];
1205
1343
  if (!up || !down || up === down || up.c !== u.c || down.c !== u.c || up.cs !== u.cs || down.cs !== u.cs) return false;
1206
- const ue = _chunkSJ5OZXELcjs.CELL_EDGES.get(table.cells[up.r][up.c]), de = _chunkSJ5OZXELcjs.CELL_EDGES.get(table.cells[down.r][down.c]);
1344
+ const ue = _chunkYG4GFQB7cjs.CELL_EDGES.get(table.cells[up.r][up.c]), de = _chunkYG4GFQB7cjs.CELL_EDGES.get(table.cells[down.r][down.c]);
1207
1345
  return !!ue && !!de && !ue.b && !de.t;
1208
1346
  });
1209
- if (!openSeam && !flowsOn && !crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
1347
+ if (!selected && !openSeam && !flowsOn && !crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
1210
1348
  if (!straddles && !midWord) continue;
1211
1349
  if (u.r >= last && d.rs < 2) continue;
1212
- const U = _chunkNLGOMLGUcjs.CELL_LINES.get(a);
1213
- if (!_optionalChain([U, 'optionalAccess', _73 => _73.length]) || !hasContent(b)) continue;
1350
+ const U = _chunkC6B5GWN7cjs.CELL_LINES.get(a);
1351
+ if (!_optionalChain([U, 'optionalAccess', _134 => _134.length]) || !hasContent(b)) continue;
1214
1352
  if (!(straddles && filledToBottom(U, prevBottom) && clauseContinues(a, b))) {
1215
1353
  if (U.length > STRADDLE_MAX_LINES) continue;
1216
1354
  const lu = U[U.length - 1];
@@ -1227,7 +1365,7 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs) {
1227
1365
  return merged;
1228
1366
  }
1229
1367
  function longLastLine(c) {
1230
- const L = _chunkNLGOMLGUcjs.CELL_LINES.get(c), l = _optionalChain([L, 'optionalAccess', _74 => _74[L.length - 1]]);
1368
+ const L = _chunkC6B5GWN7cjs.CELL_LINES.get(c), l = _optionalChain([L, 'optionalAccess', _135 => _135[L.length - 1]]);
1231
1369
  return !!l && l.r - l.l >= 6 * (l.h || 10);
1232
1370
  }
1233
1371
  function filledToBottom(U, bottom) {
@@ -1260,8 +1398,8 @@ function nextItemHead(prev, next) {
1260
1398
  return false;
1261
1399
  }
1262
1400
  function continuesAcross(u, d, x1, x2) {
1263
- const U = _chunkNLGOMLGUcjs.CELL_LINES.get(u), D = _chunkNLGOMLGUcjs.CELL_LINES.get(d);
1264
- if (!_optionalChain([U, 'optionalAccess', _75 => _75.length]) || !_optionalChain([D, 'optionalAccess', _76 => _76.length])) return false;
1401
+ const U = _chunkC6B5GWN7cjs.CELL_LINES.get(u), D = _chunkC6B5GWN7cjs.CELL_LINES.get(d);
1402
+ if (!_optionalChain([U, 'optionalAccess', _136 => _136.length]) || !_optionalChain([D, 'optionalAccess', _137 => _137.length])) return false;
1265
1403
  const last = U[U.length - 1];
1266
1404
  const fs = last.h || 10;
1267
1405
  let minL = Infinity, maxR = -Infinity;
@@ -1278,7 +1416,7 @@ function continuesAcross(u, d, x1, x2) {
1278
1416
  if (U.length === 1 && x2 - last.r > Math.max(FULL_LINE_EDGE_MIN, SINGLE_LINE_WORD_GAP * fs)) return false;
1279
1417
  const indented = last.l - minL >= HANGING_MIN * fs;
1280
1418
  if (last.r - last.l < FULL_LINE_MIN_FRAC * (indented ? x2 - last.l : x2 - x1)) return false;
1281
- const newItem = _chunkNLGOMLGUcjs.startsNewItem.call(void 0, u.text, d.text);
1419
+ const newItem = _chunkC6B5GWN7cjs.startsNewItem.call(void 0, u.text, d.text);
1282
1420
  const all = D.length ? U.concat(D) : U;
1283
1421
  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));
1284
1422
  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;
@@ -1295,12 +1433,12 @@ function outlineContinues(u, d) {
1295
1433
  return U.length >= 2 && D.length >= 1 && U.some((l) => OUTLINE_HEAD.test(l)) && OUTLINE_ITEM.test(D[0]);
1296
1434
  }
1297
1435
  function lineEnded(c, x1, x2, next) {
1298
- const L = _chunkNLGOMLGUcjs.CELL_LINES.get(c);
1436
+ const L = _chunkC6B5GWN7cjs.CELL_LINES.get(c);
1299
1437
  if (!L || L.length !== 1) return false;
1300
1438
  const l = L[0], h = l.h || 10;
1301
- const d0 = next ? _optionalChain([_chunkNLGOMLGUcjs.CELL_LINES, 'access', _77 => _77.get, 'call', _78 => _78(next), 'optionalAccess', _79 => _79[0]]) : void 0;
1439
+ const d0 = next ? _optionalChain([_chunkC6B5GWN7cjs.CELL_LINES, 'access', _138 => _138.get, 'call', _139 => _139(next), 'optionalAccess', _140 => _140[0]]) : void 0;
1302
1440
  if (d0 && d0.l - l.l >= HANGING_MIN * h) return false;
1303
- return x2 - l.r - (l.l - x1) >= Math.max(LABEL_ROOM, firstWordUnits(_nullishCoalesce(_optionalChain([next, 'optionalAccess', _80 => _80.text]), () => ( "")))) * h;
1441
+ return x2 - l.r - (l.l - x1) >= Math.max(LABEL_ROOM, firstWordUnits(_nullishCoalesce(_optionalChain([next, 'optionalAccess', _141 => _141.text]), () => ( "")))) * h;
1304
1442
  }
1305
1443
  function firstWordUnits(text) {
1306
1444
  const word = _nullishCoalesce(flowText(text).trim().replace(/^([(\[「『<〈])\s+/, "$1").split(/\s+/)[0], () => ( ""));
@@ -1309,15 +1447,15 @@ function firstWordUnits(text) {
1309
1447
  return units;
1310
1448
  }
1311
1449
  function appendCell(a, b) {
1312
- if (_chunkNLGOMLGUcjs.IMAGE_CELLS.has(b)) _chunkNLGOMLGUcjs.IMAGE_CELLS.add(a);
1313
- if (_optionalChain([a, 'access', _81 => _81.blocks, 'optionalAccess', _82 => _82.length]) || _optionalChain([b, 'access', _83 => _83.blocks, 'optionalAccess', _84 => _84.length])) {
1314
- const asBlocks = (c) => _optionalChain([c, 'access', _85 => _85.blocks, 'optionalAccess', _86 => _86.length]) ? c.blocks : c.text.split("\n").map((l) => l.trim()).filter(Boolean).map((text) => ({ type: "paragraph", text }));
1450
+ if (_chunkC6B5GWN7cjs.IMAGE_CELLS.has(b)) _chunkC6B5GWN7cjs.IMAGE_CELLS.add(a);
1451
+ if (_optionalChain([a, 'access', _142 => _142.blocks, 'optionalAccess', _143 => _143.length]) || _optionalChain([b, 'access', _144 => _144.blocks, 'optionalAccess', _145 => _145.length])) {
1452
+ 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 }));
1315
1453
  a.blocks = [...asBlocks(a), ...asBlocks(b)];
1316
1454
  }
1317
1455
  if (b.text.trim()) a.text = a.text.trim() ? a.text + "\n" + b.text : b.text;
1318
- _chunkNLGOMLGUcjs.joinCellEdges.call(void 0, a, b);
1456
+ _chunkC6B5GWN7cjs.joinCellEdges.call(void 0, a, b);
1319
1457
  }
1320
- var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _87 => _87.blocks, 'optionalAccess', _88 => _88.length]) || _chunkNLGOMLGUcjs.IMAGE_CELLS.has(cell);
1458
+ var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _148 => _148.blocks, 'optionalAccess', _149 => _149.length]) || _chunkC6B5GWN7cjs.IMAGE_CELLS.has(cell);
1321
1459
  var CLAUSE_OPEN_ENDING = /(?:하는|되는|하고|하며|하여|되어|되고|되며|이며|으며|어야|아야|여야)$/;
1322
1460
  var batchim = (ch) => {
1323
1461
  const k = ch.charCodeAt(0) - 44032;
@@ -1325,7 +1463,7 @@ var batchim = (ch) => {
1325
1463
  };
1326
1464
  function clauseContinues(u, d) {
1327
1465
  const tail = _nullishCoalesce(flowText(u.text).trim().split(/\s+/).pop(), () => ( "")), head = flowText(d.text).trim();
1328
- if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunkNLGOMLGUcjs.startsNewItem.call(void 0, u.text, head)) return false;
1466
+ if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunkC6B5GWN7cjs.startsNewItem.call(void 0, u.text, head)) return false;
1329
1467
  const last = tail[tail.length - 1], before = tail[tail.length - 2];
1330
1468
  return last === "\uC744" && batchim(before) || last === "\uB97C" && !batchim(before) || CLAUSE_OPEN_ENDING.test(tail);
1331
1469
  }
@@ -1333,8 +1471,8 @@ function quantityContinues(u, d) {
1333
1471
  return /\d[\d,.]*\s*(?:%|[가-힣]{1,2})?$/.test(flowText(u.text).trim()) && /^(?:미만|이상|이하|초과)(?![가-힣])/.test(flowText(d.text).trim());
1334
1472
  }
1335
1473
  function wordOverflows(u, d, x1, x2) {
1336
- const U = _chunkNLGOMLGUcjs.CELL_LINES.get(u);
1337
- if (!_optionalChain([U, 'optionalAccess', _89 => _89.length]) || _chunkNLGOMLGUcjs.startsNewItem.call(void 0, u.text, d.text)) return false;
1474
+ const U = _chunkC6B5GWN7cjs.CELL_LINES.get(u);
1475
+ if (!_optionalChain([U, 'optionalAccess', _150 => _150.length]) || _chunkC6B5GWN7cjs.startsNewItem.call(void 0, u.text, d.text)) return false;
1338
1476
  const last = U[U.length - 1], units = firstWordUnits(d.text);
1339
1477
  return units > 0 && last.r - last.l + units * (last.h || 10) > x2 - x1;
1340
1478
  }
@@ -1344,7 +1482,7 @@ function listContinues(u, d, multi = false) {
1344
1482
  const marks = u.text.split("\n").map((l) => itemMark(l.trim()));
1345
1483
  let last = -1, count = 0;
1346
1484
  marks.forEach((m, i) => {
1347
- if (_optionalChain([m, 'optionalAccess', _90 => _90.style]) === head.style) {
1485
+ if (_optionalChain([m, 'optionalAccess', _151 => _151.style]) === head.style) {
1348
1486
  last = i;
1349
1487
  count++;
1350
1488
  }
@@ -1392,13 +1530,13 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
1392
1530
  if (!carriedSplit) {
1393
1531
  const norm = (c) => flowText(c.text).replace(/\s+/g, "");
1394
1532
  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;
1395
- const oneLine = (c) => _optionalChain([_chunkNLGOMLGUcjs.CELL_LINES, 'access', _91 => _91.get, 'call', _92 => _92(c), 'optionalAccess', _93 => _93.length]) === 1;
1533
+ const oneLine = (c) => _optionalChain([_chunkC6B5GWN7cjs.CELL_LINES, 'access', _152 => _152.get, 'call', _153 => _153(c), 'optionalAccess', _154 => _154.length]) === 1;
1396
1534
  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;
1397
1535
  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));
1398
1536
  if (!(cut.open && !newCell)) {
1399
1537
  if (pairs.some((p) => p[1].rs > 1 && !flows(p))) return false;
1400
1538
  const one = pairs.filter(([, d]) => d.rs === 1);
1401
- if (!matchesCompleteSiblingRow(table, owner, first) && !matchesCompleteRubricRow(table, owner, first) && !(cut.ruled && matchesCompleteContextRow(table, owner, first)) && !outlineOnly(pairs, cell) && !one.some(flows) && (cut.list === "none" || !one.some(([u, d]) => listContinues(cell(u), cell(d), cut.list === "multi")))) return false;
1539
+ if (!matchesCompleteSiblingRow(table, owner, first) && !matchesCompleteRubricRow(table, owner, first) && !(cut.ruled && (matchesCompleteContextRow(table, owner, first) || matchesCompleteAlignedLabelListRow(table, owner, first))) && !outlineOnly(pairs, cell) && !one.some(flows) && (cut.list === "none" || !one.some(([u, d]) => listContinues(cell(u), cell(d), cut.list === "multi")))) return false;
1402
1540
  }
1403
1541
  }
1404
1542
  for (const [u, d] of pairs) {
@@ -1423,8 +1561,8 @@ function besideOwn(b, p, c) {
1423
1561
  }
1424
1562
  var PAGE_NUMBER_TEXT = /^[-–—]?\s*\d{1,4}\s*[-–—]?$/;
1425
1563
  function pageNumberBetween(b, p, c, pageHeights) {
1426
- if (b.type !== "paragraph" || !b.bbox || !PAGE_NUMBER_TEXT.test(_nullishCoalesce(_optionalChain([b, 'access', _94 => _94.text, 'optionalAccess', _95 => _95.trim, 'call', _96 => _96()]), () => ( "")))) return false;
1427
- const h = b.pageNumber ? _optionalChain([pageHeights, 'optionalAccess', _97 => _97.get, 'call', _98 => _98(b.pageNumber)]) : void 0;
1564
+ if (b.type !== "paragraph" || !b.bbox || !PAGE_NUMBER_TEXT.test(_nullishCoalesce(_optionalChain([b, 'access', _155 => _155.text, 'optionalAccess', _156 => _156.trim, 'call', _157 => _157()]), () => ( "")))) return false;
1565
+ const h = b.pageNumber ? _optionalChain([pageHeights, 'optionalAccess', _158 => _158.get, 'call', _159 => _159(b.pageNumber)]) : void 0;
1428
1566
  if (!h) return false;
1429
1567
  if (b.pageNumber === p.pageNumber) return b.bbox.y + b.bbox.height <= Math.min(p.bbox.y, h * PAGE_EDGE_BAND) + 1;
1430
1568
  if (b.pageNumber === c.pageNumber) return b.bbox.y >= Math.max(c.bbox.y + c.bbox.height, h * (1 - PAGE_EDGE_BAND)) - 1;
@@ -1448,7 +1586,7 @@ function insideTable(b, t) {
1448
1586
  return b.bbox.x >= o.x - 1 && b.bbox.x + b.bbox.width <= o.x + o.width + 1 && b.bbox.y >= o.y - 1 && b.bbox.y + b.bbox.height <= o.y + o.height + 1;
1449
1587
  }
1450
1588
  function startsWithUnitRow(table) {
1451
- return /^\s*\(\s*단위\s*[::]/.test(_nullishCoalesce(_optionalChain([table, 'access', _99 => _99.cells, 'access', _100 => _100[0], 'optionalAccess', _101 => _101[0], 'optionalAccess', _102 => _102.text]), () => ( ""))) && _optionalChain([table, 'access', _103 => _103.cells, 'access', _104 => _104[0], 'optionalAccess', _105 => _105.slice, 'call', _106 => _106(1), 'access', _107 => _107.every, 'call', _108 => _108((c) => !c.text.trim())]);
1589
+ return /^\s*\(\s*단위\s*[::]/.test(_nullishCoalesce(_optionalChain([table, 'access', _160 => _160.cells, 'access', _161 => _161[0], 'optionalAccess', _162 => _162[0], 'optionalAccess', _163 => _163.text]), () => ( ""))) && _optionalChain([table, 'access', _164 => _164.cells, 'access', _165 => _165[0], 'optionalAccess', _166 => _166.slice, 'call', _167 => _167(1), 'access', _168 => _168.every, 'call', _169 => _169((c) => !c.text.trim())]);
1452
1590
  }
1453
1591
  function sameHeadShape(a, b) {
1454
1592
  if (!a || !b || a.length !== b.length) return false;
@@ -1460,7 +1598,7 @@ function sameHeadShape(a, b) {
1460
1598
  return tall;
1461
1599
  }
1462
1600
  function hasBoxTitle(t) {
1463
- const titles = _nullishCoalesce(_optionalChain([t, 'access', _109 => _109.cells, 'access', _110 => _110[0], 'optionalAccess', _111 => _111.filter, 'call', _112 => _112((c) => c.text.trim())]), () => ( []));
1601
+ const titles = _nullishCoalesce(_optionalChain([t, 'access', _170 => _170.cells, 'access', _171 => _171[0], 'optionalAccess', _172 => _172.filter, 'call', _173 => _173((c) => c.text.trim())]), () => ( []));
1464
1602
  if (titles.length !== 1 || titles[0].rowSpan < 2) return false;
1465
1603
  const body = t.cells[titles[0].rowSpan];
1466
1604
  return !!body && body[0].colSpan === t.cols && !!body[0].text.trim();
@@ -1474,7 +1612,7 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1474
1612
  const skip = (b) => b.type !== "table" || [blocks[i], tail].some((t) => insideTable(b, t) || leftColumnOf(b, t));
1475
1613
  while (j < blocks.length && skip(blocks[j]) && (_nullishCoalesce(blocks[j].pageNumber, () => ( 0))) <= tail.pageNumber + 1) j++;
1476
1614
  const curr = blocks[j];
1477
- const prev = tail !== blocks[i] && _optionalChain([curr, 'optionalAccess', _113 => _113.pageNumber]) === tail.pageNumber ? blocks[i] : tail;
1615
+ const prev = tail !== blocks[i] && _optionalChain([curr, 'optionalAccess', _174 => _174.pageNumber]) === tail.pageNumber ? blocks[i] : tail;
1478
1616
  if (!prev.table || !prev.bbox || !prev.pageNumber) continue;
1479
1617
  if (!curr || curr.type !== "table" || !curr.table || !curr.bbox || curr.pageNumber !== prev.pageNumber + 1) continue;
1480
1618
  if (startsWithUnitRow(prev.table) && startsWithUnitRow(curr.table)) continue;
@@ -1484,19 +1622,19 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1484
1622
  placeJoined(blocks, i, j, joined);
1485
1623
  continue;
1486
1624
  }
1487
- if (_chunkNLGOMLGUcjs.EMPTY_PARTS.has(curr.table)) {
1625
+ if (_chunkC6B5GWN7cjs.EMPTY_PARTS.has(curr.table)) {
1488
1626
  blocks.splice(j, 1);
1489
1627
  i++;
1490
1628
  continue;
1491
1629
  }
1492
1630
  if (joined === null) continue;
1493
- if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunkNLGOMLGUcjs.EMPTY_PARTS.has(prev.table)) continue;
1631
+ if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunkC6B5GWN7cjs.EMPTY_PARTS.has(prev.table)) continue;
1494
1632
  const width = Math.max(prev.bbox.width, curr.bbox.width, 1);
1495
1633
  const leftDiff = Math.abs(prev.bbox.x - curr.bbox.x);
1496
1634
  const rightDiff = Math.abs(prev.bbox.x + prev.bbox.width - (curr.bbox.x + curr.bbox.width));
1497
1635
  if (leftDiff > width * NEIGHBOR_TABLE_EPSILON || rightDiff > width * NEIGHBOR_TABLE_EPSILON) continue;
1498
- const px = _chunkNLGOMLGUcjs.TABLE_COLXS.get(prev.table), cx = _chunkNLGOMLGUcjs.TABLE_COLXS.get(curr.table);
1499
- if (px && cx && !shiftedSame(px, cx, !_chunkNLGOMLGUcjs.CLIP_TABLES.has(prev.table) && !_chunkNLGOMLGUcjs.CLIP_TABLES.has(curr.table))) continue;
1636
+ const px = _chunkC6B5GWN7cjs.TABLE_COLXS.get(prev.table), cx = _chunkC6B5GWN7cjs.TABLE_COLXS.get(curr.table);
1637
+ if (px && cx && !shiftedSame(px, cx, !_chunkC6B5GWN7cjs.CLIP_TABLES.has(prev.table) && !_chunkC6B5GWN7cjs.CLIP_TABLES.has(curr.table))) continue;
1500
1638
  if (!rowTextsEqual(prev.table.cells[0], curr.table.cells[0]) && sameHeadShape(prev.table.cells[0], curr.table.cells[0])) continue;
1501
1639
  let currCells = curr.table.cells;
1502
1640
  const headRows = repeatedHeaderRows(prev.table, curr.table);
@@ -1507,16 +1645,16 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1507
1645
  blocks.splice(j, 1);
1508
1646
  continue;
1509
1647
  }
1510
- if (px && cx && !_chunkNLGOMLGUcjs.CLIP_TABLES.has(prev.table) && !_chunkNLGOMLGUcjs.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 && _chunkNLGOMLGUcjs.CELL_LINES.has(c))) {
1648
+ if (px && cx && !_chunkC6B5GWN7cjs.CLIP_TABLES.has(prev.table) && !_chunkC6B5GWN7cjs.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 && _chunkC6B5GWN7cjs.CELL_LINES.has(c))) {
1511
1649
  const dx = px[0] - cx[0];
1512
1650
  const part = joinSplitParts(prev.table, px, curr.table, cx.map((x) => x + dx), dx, void 0, lex);
1513
- if (_optionalChain([part, 'optionalAccess', _114 => _114.split]) && part.table.rows === prev.table.rows + currCells.length - 1) {
1651
+ if (_optionalChain([part, 'optionalAccess', _175 => _175.split]) && part.table.rows === prev.table.rows + currCells.length - 1) {
1514
1652
  const last = prev.table.rows - 1;
1515
1653
  for (let c = 0; c < part.table.cols; c++) {
1516
- const U = _chunkNLGOMLGUcjs.CELL_LINES.get(prev.table.cells[last][c]), D = _chunkNLGOMLGUcjs.CELL_LINES.get(currCells[0][c]);
1517
- _chunkNLGOMLGUcjs.CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
1654
+ const U = _chunkC6B5GWN7cjs.CELL_LINES.get(prev.table.cells[last][c]), D = _chunkC6B5GWN7cjs.CELL_LINES.get(currCells[0][c]);
1655
+ _chunkC6B5GWN7cjs.CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
1518
1656
  }
1519
- _chunkNLGOMLGUcjs.TABLE_COLXS.set(part.table, part.colXs);
1657
+ _chunkC6B5GWN7cjs.TABLE_COLXS.set(part.table, part.colXs);
1520
1658
  placeJoined(blocks, i, j, part.table);
1521
1659
  continue;
1522
1660
  }
@@ -1529,20 +1667,20 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1529
1667
  caption: prev.table.caption,
1530
1668
  ...prev.table.renderAsTable ? { renderAsTable: true } : {}
1531
1669
  };
1532
- if (_nullishCoalesce(px, () => ( cx))) _chunkNLGOMLGUcjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
1533
- if (_chunkNLGOMLGUcjs.CLIP_TABLES.has(prev.table) || _chunkNLGOMLGUcjs.CLIP_TABLES.has(curr.table)) _chunkNLGOMLGUcjs.CLIP_TABLES.add(merged);
1670
+ if (_nullishCoalesce(px, () => ( cx))) _chunkC6B5GWN7cjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
1671
+ if (_chunkC6B5GWN7cjs.CLIP_TABLES.has(prev.table) || _chunkC6B5GWN7cjs.CLIP_TABLES.has(curr.table)) _chunkC6B5GWN7cjs.CLIP_TABLES.add(merged);
1534
1672
  placeJoined(blocks, i, j, merged);
1535
1673
  }
1536
1674
  for (let i = blocks.length - 1; i >= 0; i--) {
1537
1675
  const t = blocks[i].table;
1538
- if (blocks[i].type === "table" && t && _chunkNLGOMLGUcjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
1676
+ if (blocks[i].type === "table" && t && _chunkC6B5GWN7cjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
1539
1677
  }
1540
1678
  }
1541
1679
  function mergeColumnFlow(blocks, pageHeights, lex) {
1542
1680
  if (!pageHeights) return;
1543
1681
  for (let i = 0; i < blocks.length; i++) {
1544
1682
  const L = blocks[i];
1545
- if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkNLGOMLGUcjs.CLIP_TABLES.has(L.table) || _chunkNLGOMLGUcjs.EMPTY_PARTS.has(L.table)) continue;
1683
+ if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkC6B5GWN7cjs.CLIP_TABLES.has(L.table) || _chunkC6B5GWN7cjs.EMPTY_PARTS.has(L.table)) continue;
1546
1684
  const ph = pageHeights.get(L.pageNumber);
1547
1685
  if (!ph || L.bbox.y > ph * PAGE_EDGE_BAND) continue;
1548
1686
  let s0 = i, s1 = i;
@@ -1571,12 +1709,12 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
1571
1709
  }
1572
1710
  function joinClipParts(prev, curr, pageHeights, lex) {
1573
1711
  const pt = prev.table, ct = curr.table;
1574
- if (!_chunkNLGOMLGUcjs.CLIP_TABLES.has(pt) || !_chunkNLGOMLGUcjs.CLIP_TABLES.has(ct)) return null;
1575
- const px = _chunkNLGOMLGUcjs.TABLE_COLXS.get(pt), cx = _chunkNLGOMLGUcjs.TABLE_COLXS.get(ct);
1712
+ if (!_chunkC6B5GWN7cjs.CLIP_TABLES.has(pt) || !_chunkC6B5GWN7cjs.CLIP_TABLES.has(ct)) return null;
1713
+ const px = _chunkC6B5GWN7cjs.TABLE_COLXS.get(pt), cx = _chunkC6B5GWN7cjs.TABLE_COLXS.get(ct);
1576
1714
  if (!px || !cx) return null;
1577
1715
  let xs = cx, shifted = false, dx = 0, foreign = false, within = false;
1578
1716
  if (!shiftedSame(px, cx, false)) {
1579
- if (!_optionalChain([pageHeights, 'optionalAccess', _115 => _115.get, 'call', _116 => _116(prev.pageNumber)]) || !_optionalChain([pageHeights, 'optionalAccess', _117 => _117.get, 'call', _118 => _118(curr.pageNumber)])) return null;
1717
+ if (!_optionalChain([pageHeights, 'optionalAccess', _176 => _176.get, 'call', _177 => _177(prev.pageNumber)]) || !_optionalChain([pageHeights, 'optionalAccess', _178 => _178.get, 'call', _179 => _179(curr.pageNumber)])) return null;
1580
1718
  dx = px[px.length - 1] - cx[cx.length - 1];
1581
1719
  within = Math.abs(dx) > CONTINUATION_COL_TOL && cx.length >= 3 && cx.every((x) => px.some((p) => Math.abs(p - x) <= CONTINUATION_COL_TOL));
1582
1720
  if (Math.abs(dx) > CONTINUATION_COL_TOL && !within) {
@@ -1588,19 +1726,19 @@ function joinClipParts(prev, curr, pageHeights, lex) {
1588
1726
  const inner = b.slice(1, -1).map((x) => x + dx);
1589
1727
  return inner.length > 0 && !inner.some((x) => px.some((p) => Math.abs(p - x) <= CONTINUATION_COL_TOL));
1590
1728
  };
1591
- foreign = unrelated(cx) && unrelated(_nullishCoalesce(_chunkNLGOMLGUcjs.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);
1729
+ foreign = unrelated(cx) && unrelated(_nullishCoalesce(_chunkC6B5GWN7cjs.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);
1592
1730
  }
1593
- const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _119 => _119.bbox, 'optionalAccess', _120 => _120.y]), lex);
1731
+ const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _180 => _180.bbox, 'optionalAccess', _181 => _181.y]), lex);
1594
1732
  if (!res || (shifted || foreign || within) && !res.split && !res.header) return null;
1595
- _chunkNLGOMLGUcjs.TABLE_COLXS.set(res.table, res.colXs);
1596
- const ys = _chunkNLGOMLGUcjs.TABLE_ROWYS.get(pt);
1597
- if (ys) _chunkNLGOMLGUcjs.TABLE_ROWYS.set(res.table, ys);
1598
- _chunkNLGOMLGUcjs.PART_COLXS.set(res.table, _nullishCoalesce(_chunkNLGOMLGUcjs.PART_COLXS.get(pt), () => ( px)));
1599
- _chunkNLGOMLGUcjs.CLIP_TABLES.add(res.table);
1733
+ _chunkC6B5GWN7cjs.TABLE_COLXS.set(res.table, res.colXs);
1734
+ const ys = _chunkC6B5GWN7cjs.TABLE_ROWYS.get(pt);
1735
+ if (ys) _chunkC6B5GWN7cjs.TABLE_ROWYS.set(res.table, ys);
1736
+ _chunkC6B5GWN7cjs.PART_COLXS.set(res.table, _nullishCoalesce(_chunkC6B5GWN7cjs.PART_COLXS.get(pt), () => ( px)));
1737
+ _chunkC6B5GWN7cjs.CLIP_TABLES.add(res.table);
1600
1738
  return res.table;
1601
1739
  }
1602
1740
  function prevLacksLeftCols(prev, px, xs, pageHeights) {
1603
- const ph = _optionalChain([pageHeights, 'optionalAccess', _121 => _121.get, 'call', _122 => _122(prev.pageNumber)]);
1741
+ const ph = _optionalChain([pageHeights, 'optionalAccess', _182 => _182.get, 'call', _183 => _183(prev.pageNumber)]);
1604
1742
  if (!ph || prev.bbox.y + prev.bbox.height < ph * (1 - PAGE_EDGE_BAND)) return false;
1605
1743
  return xs[0] < px[0] && xs.slice(1, -1).some((x) => Math.abs(x - px[0]) <= CONTINUATION_COL_TOL);
1606
1744
  }
@@ -1611,21 +1749,21 @@ function headingRow(row) {
1611
1749
  }
1612
1750
  var ANNEX_HEAD_RE = /^\s*[<\[(【]?\s*(?:붙\s*임|참\s*고|별\s*첨|별\s*지|별\s*표|첨\s*부|부\s*록)(?:\s*\d|\s*$|\s*[>\])】])|^\s*■/;
1613
1751
  function looksContinued(prev, curr, pageHeights) {
1614
- const ph = _optionalChain([pageHeights, 'optionalAccess', _123 => _123.get, 'call', _124 => _124(prev.pageNumber)]), ch = _optionalChain([pageHeights, 'optionalAccess', _125 => _125.get, 'call', _126 => _126(curr.pageNumber)]);
1752
+ const ph = _optionalChain([pageHeights, 'optionalAccess', _184 => _184.get, 'call', _185 => _185(prev.pageNumber)]), ch = _optionalChain([pageHeights, 'optionalAccess', _186 => _186.get, 'call', _187 => _187(curr.pageNumber)]);
1615
1753
  if (ph && ch && (prev.bbox.y > ph * PAGE_EDGE_BAND && !pushedLead(prev, curr) || curr.bbox.y + curr.bbox.height < ch * (1 - PAGE_EDGE_BAND))) return false;
1616
1754
  const firstRow = _nullishCoalesce(curr.table.cells[0], () => ( []));
1617
- const firstText = _nullishCoalesce(_optionalChain([firstRow, 'access', _127 => _127.find, 'call', _128 => _128((c) => c.text.trim()), 'optionalAccess', _129 => _129.text]), () => ( ""));
1755
+ const firstText = _nullishCoalesce(_optionalChain([firstRow, 'access', _188 => _188.find, 'call', _189 => _189((c) => c.text.trim()), 'optionalAccess', _190 => _190.text]), () => ( ""));
1618
1756
  if (!ANNEX_HEAD_RE.test(firstText)) return true;
1619
1757
  const filled = firstRow.map((c) => flowText(c.text).replace(/\s+/g, "")).filter(Boolean);
1620
1758
  return filled.length >= 2 && filled.every((t) => t === filled[0]);
1621
1759
  }
1622
1760
  function pushedLead(prev, curr) {
1623
- if (!_chunkNLGOMLGUcjs.CLIP_TABLES.has(prev.table) || !_chunkNLGOMLGUcjs.CLIP_TABLES.has(curr.table)) return false;
1761
+ if (!_chunkC6B5GWN7cjs.CLIP_TABLES.has(prev.table) || !_chunkC6B5GWN7cjs.CLIP_TABLES.has(curr.table)) return false;
1624
1762
  const lead = leadRows(curr.table);
1625
1763
  return lead.image && lead.height > prev.bbox.y;
1626
1764
  }
1627
1765
  function leadRows(t) {
1628
- const ys = _chunkNLGOMLGUcjs.TABLE_ROWYS.get(t);
1766
+ const ys = _chunkC6B5GWN7cjs.TABLE_ROWYS.get(t);
1629
1767
  if (!ys || ys.length < 2) return { height: 0, image: false };
1630
1768
  const anchors = anchorsOf(t);
1631
1769
  let end = 1, image = false;
@@ -1633,17 +1771,17 @@ function leadRows(t) {
1633
1771
  for (const a of anchors) {
1634
1772
  if (a.r !== r) continue;
1635
1773
  end = Math.max(end, r + a.rs);
1636
- if (_chunkNLGOMLGUcjs.IMAGE_CELLS.has(a.cell)) image = true;
1774
+ if (_chunkC6B5GWN7cjs.IMAGE_CELLS.has(a.cell)) image = true;
1637
1775
  }
1638
1776
  }
1639
1777
  return { height: ys[0] - ys[Math.min(end, ys.length - 1)], image };
1640
1778
  }
1641
1779
  function tailOf(b) {
1642
- const t = b.table && _chunkNLGOMLGUcjs.TABLE_TAIL.get(b.table);
1780
+ const t = b.table && _chunkC6B5GWN7cjs.TABLE_TAIL.get(b.table);
1643
1781
  return t && b.bbox ? { ...b, pageNumber: t.page, bbox: { ...b.bbox, page: t.page, y: t.y, height: t.height } } : b;
1644
1782
  }
1645
1783
  function firstRowSig(t) {
1646
- const x = _chunkNLGOMLGUcjs.TABLE_COLXS.get(t);
1784
+ const x = _chunkC6B5GWN7cjs.TABLE_COLXS.get(t);
1647
1785
  if (!x || x.length !== t.cols + 1) return null;
1648
1786
  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, "") }));
1649
1787
  }
@@ -1668,9 +1806,9 @@ function restartsTable(blocks, i, curr, pageHeights) {
1668
1806
  }
1669
1807
  function restartsTitledForm(head, curr) {
1670
1808
  if (head.rows < 2 || curr.rows < 2 || head.cols !== curr.cols) return false;
1671
- const full = (t) => _optionalChain([t, 'access', _130 => _130.cells, 'access', _131 => _131[0], 'access', _132 => _132[0], 'optionalAccess', _133 => _133.colSpan]) === t.cols;
1809
+ const full = (t) => _optionalChain([t, 'access', _191 => _191.cells, 'access', _192 => _192[0], 'access', _193 => _193[0], 'optionalAccess', _194 => _194.colSpan]) === t.cols;
1672
1810
  if (!full(head) || !full(curr)) return false;
1673
- const norm = (c) => flowText(_nullishCoalesce(_optionalChain([c, 'optionalAccess', _134 => _134.text]), () => ( ""))).replace(/\s+/g, "");
1811
+ const norm = (c) => flowText(_nullishCoalesce(_optionalChain([c, 'optionalAccess', _195 => _195.text]), () => ( ""))).replace(/\s+/g, "");
1674
1812
  const ht = norm(head.cells[0][0]), ct = norm(curr.cells[0][0]);
1675
1813
  if (!ht || !ct || ht === ct) return false;
1676
1814
  const titleLike = (t) => t.length <= TITLE_ROW_MAX_CHARS && !/^[ㅇ○◦•·\-–※*□■▪☞]/.test(t);
@@ -1696,7 +1834,7 @@ function chainHead(blocks, i, pageHeights) {
1696
1834
  if (pb.pageNumber !== (_nullishCoalesce(cur.pageNumber, () => ( 0))) - 1) break;
1697
1835
  if (!blocks.slice(p + 1, k).every((b) => besideOwn(b, pb, cur) || insideTable(b, pb) || pageNumberBetween(b, pb, cur, pageHeights))) break;
1698
1836
  if (!looksContinued(pb, cur, pageHeights)) break;
1699
- const px = _chunkNLGOMLGUcjs.TABLE_COLXS.get(pb.table), cx = _chunkNLGOMLGUcjs.TABLE_COLXS.get(cur.table);
1837
+ const px = _chunkC6B5GWN7cjs.TABLE_COLXS.get(pb.table), cx = _chunkC6B5GWN7cjs.TABLE_COLXS.get(cur.table);
1700
1838
  if (!px || !cx) break;
1701
1839
  const dx = px[px.length - 1] - cx[cx.length - 1];
1702
1840
  if (!shiftedSame(px, cx) && !px.some((x) => Math.abs(x - (cx[0] + dx)) <= CONTINUATION_COL_TOL) && !prevLacksLeftCols(pb, px, cx, pageHeights)) break;
@@ -1713,7 +1851,7 @@ function continueRowSpans(prevCells, currCells) {
1713
1851
  if (hasContent(cell) || (cell.rowSpan || 1) < 2) continue;
1714
1852
  let anchor;
1715
1853
  for (let r = last - 1; r >= 0 && !anchor; r--) {
1716
- const a = _optionalChain([prevCells, 'access', _135 => _135[r], 'optionalAccess', _136 => _136[c]]);
1854
+ const a = _optionalChain([prevCells, 'access', _196 => _196[r], 'optionalAccess', _197 => _197[c]]);
1717
1855
  if (a && r + (a.rowSpan || 1) === last && (a.colSpan || 1) === (cell.colSpan || 1) && (hasContent(a) || a.rowSpan >= 2)) anchor = a;
1718
1856
  }
1719
1857
  if (!anchor) continue;
@@ -1767,12 +1905,12 @@ var RESTART_LOOKBACK_PAGES = 5;
1767
1905
  var COL_MATCH_TOL = 0.5;
1768
1906
  var CONTINUED_TABLE_PAGE_BAND = 0.16;
1769
1907
  function lastRowCell(t, x1, x2) {
1770
- const xs = _chunkNLGOMLGUcjs.TABLE_COLXS.get(t);
1908
+ const xs = _chunkC6B5GWN7cjs.TABLE_COLXS.get(t);
1771
1909
  const covered = /* @__PURE__ */ new Set();
1772
1910
  for (let r = 0; r < t.rows; r++) {
1773
1911
  for (let c = 0; c < t.cols; c++) {
1774
1912
  if (covered.has(r * 1e5 + c)) continue;
1775
- const cell = _optionalChain([t, 'access', _137 => _137.cells, 'access', _138 => _138[r], 'optionalAccess', _139 => _139[c]]);
1913
+ const cell = _optionalChain([t, 'access', _198 => _198.cells, 'access', _199 => _199[r], 'optionalAccess', _200 => _200[c]]);
1776
1914
  if (!cell) continue;
1777
1915
  for (let dr = 0; dr < cell.rowSpan; dr++) for (let dc = 0; dc < cell.colSpan; dc++) covered.add((r + dr) * 1e5 + c + dc);
1778
1916
  if (r + cell.rowSpan !== t.rows) continue;
@@ -1785,7 +1923,7 @@ var cellBlocks = (cell, pageNumber) => _nullishCoalesce(cell.blocks, () => ( cel
1785
1923
  function mergeContinuedCells(blocks, pageHeights) {
1786
1924
  for (let j = blocks.length - 1; j > 0; j--) {
1787
1925
  const part = blocks[j];
1788
- const from = part.table ? _chunkNLGOMLGUcjs.CONT_PARTS.get(part.table) : void 0;
1926
+ const from = part.table ? _chunkC6B5GWN7cjs.CONT_PARTS.get(part.table) : void 0;
1789
1927
  if (!from || !part.table) {
1790
1928
  unwrapContinuedTable(blocks, j, pageHeights, true);
1791
1929
  continue;
@@ -1795,18 +1933,18 @@ function mergeContinuedCells(blocks, pageHeights) {
1795
1933
  const prev = blocks[i];
1796
1934
  if (i < 0 || !prev.table || prev.pageNumber !== (_nullishCoalesce(part.pageNumber, () => ( 0))) - 1) continue;
1797
1935
  const cell = lastRowCell(prev.table, from.x1, from.x2);
1798
- const add = _optionalChain([part, 'access', _140 => _140.table, 'access', _141 => _141.cells, 'access', _142 => _142[0], 'optionalAccess', _143 => _143[0]]);
1936
+ const add = _optionalChain([part, 'access', _201 => _201.table, 'access', _202 => _202.cells, 'access', _203 => _203[0], 'optionalAccess', _204 => _204[0]]);
1799
1937
  if (!cell || !add) continue;
1800
1938
  const at = cell.blocks || add.blocks ? cellBlocks(cell, prev.pageNumber).length : -1;
1801
1939
  if (cell.blocks || add.blocks) cell.blocks = [...cellBlocks(cell, prev.pageNumber), ...cellBlocks(add, part.pageNumber)];
1802
1940
  else if (part.pageNumber) markContinuedText(cell, add, part.pageNumber);
1803
1941
  cell.text = [cell.text, add.text].filter((s) => s.trim()).join("\n");
1804
- if (_chunkNLGOMLGUcjs.IMAGE_CELLS.has(add)) _chunkNLGOMLGUcjs.IMAGE_CELLS.add(cell);
1805
- _chunkNLGOMLGUcjs.joinCellEdges.call(void 0, cell, add);
1806
- const lines = _chunkNLGOMLGUcjs.CELL_LINES.get(add);
1807
- if (_optionalChain([lines, 'optionalAccess', _144 => _144.length])) _chunkNLGOMLGUcjs.CELL_LINES.set(cell, [..._nullishCoalesce(_chunkNLGOMLGUcjs.CELL_LINES.get(cell), () => ( [])), ...lines]);
1808
- if (part.pageNumber && part.bbox) _chunkNLGOMLGUcjs.TABLE_TAIL.set(prev.table, _nullishCoalesce(_chunkNLGOMLGUcjs.TABLE_TAIL.get(part.table), () => ( { page: part.pageNumber, y: part.bbox.y, height: part.bbox.height })));
1809
- if (cell.text.trim() || _optionalChain([cell, 'access', _145 => _145.blocks, 'optionalAccess', _146 => _146.length]) || _chunkNLGOMLGUcjs.IMAGE_CELLS.has(cell)) _chunkNLGOMLGUcjs.EMPTY_PARTS.delete(prev.table);
1942
+ if (_chunkC6B5GWN7cjs.IMAGE_CELLS.has(add)) _chunkC6B5GWN7cjs.IMAGE_CELLS.add(cell);
1943
+ _chunkC6B5GWN7cjs.joinCellEdges.call(void 0, cell, add);
1944
+ const lines = _chunkC6B5GWN7cjs.CELL_LINES.get(add);
1945
+ if (_optionalChain([lines, 'optionalAccess', _205 => _205.length])) _chunkC6B5GWN7cjs.CELL_LINES.set(cell, [..._nullishCoalesce(_chunkC6B5GWN7cjs.CELL_LINES.get(cell), () => ( [])), ...lines]);
1946
+ if (part.pageNumber && part.bbox) _chunkC6B5GWN7cjs.TABLE_TAIL.set(prev.table, _nullishCoalesce(_chunkC6B5GWN7cjs.TABLE_TAIL.get(part.table), () => ( { page: part.pageNumber, y: part.bbox.y, height: part.bbox.height })));
1947
+ if (cell.text.trim() || _optionalChain([cell, 'access', _206 => _206.blocks, 'optionalAccess', _207 => _207.length]) || _chunkC6B5GWN7cjs.IMAGE_CELLS.has(cell)) _chunkC6B5GWN7cjs.EMPTY_PARTS.delete(prev.table);
1810
1948
  blocks.splice(j, 1);
1811
1949
  if (cell.blocks && at > 0) {
1812
1950
  const nextAt = cell.blocks[at];
@@ -1818,34 +1956,58 @@ function mergeContinuedCells(blocks, pageHeights) {
1818
1956
  }
1819
1957
  function unwrapContinuedTable(blocks, at, pageHeights, splitOnly = false) {
1820
1958
  const prev = blocks[at - 1], frame = blocks[at];
1821
- if (!_optionalChain([prev, 'optionalAccess', _147 => _147.table]) || !_optionalChain([frame, 'optionalAccess', _148 => _148.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunkNLGOMLGUcjs.CLIP_TABLES.has(frame.table)) return;
1822
- const inner = _optionalChain([frame, 'access', _149 => _149.table, 'access', _150 => _150.cells, 'access', _151 => _151[0], 'optionalAccess', _152 => _152[0], 'optionalAccess', _153 => _153.blocks]);
1823
- const next = _optionalChain([inner, 'optionalAccess', _154 => _154[0]]);
1824
- if (!inner || !_optionalChain([next, 'optionalAccess', _155 => _155.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunkNLGOMLGUcjs.CLIP_TABLES.has(prev.table) || !_chunkNLGOMLGUcjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
1825
- const px = _chunkNLGOMLGUcjs.TABLE_COLXS.get(prev.table), nx = _chunkNLGOMLGUcjs.TABLE_COLXS.get(next.table);
1959
+ if (!_optionalChain([prev, 'optionalAccess', _208 => _208.table]) || !_optionalChain([frame, 'optionalAccess', _209 => _209.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunkC6B5GWN7cjs.CLIP_TABLES.has(frame.table)) return;
1960
+ const inner = _optionalChain([frame, 'access', _210 => _210.table, 'access', _211 => _211.cells, 'access', _212 => _212[0], 'optionalAccess', _213 => _213[0], 'optionalAccess', _214 => _214.blocks]);
1961
+ const next = _optionalChain([inner, 'optionalAccess', _215 => _215[0]]);
1962
+ if (!inner || !_optionalChain([next, 'optionalAccess', _216 => _216.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunkC6B5GWN7cjs.CLIP_TABLES.has(prev.table) || !_chunkC6B5GWN7cjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
1963
+ const px = _chunkC6B5GWN7cjs.TABLE_COLXS.get(prev.table), nx = _chunkC6B5GWN7cjs.TABLE_COLXS.get(next.table);
1826
1964
  if (!px || !nx || px.length !== nx.length || px.some((x, i) => Math.abs(x - nx[i]) > COL_MATCH_TOL)) return;
1827
- const ph = _optionalChain([pageHeights, 'optionalAccess', _156 => _156.get, 'call', _157 => _157(prev.pageNumber)]), nh = _optionalChain([pageHeights, 'optionalAccess', _158 => _158.get, 'call', _159 => _159(next.pageNumber)]);
1965
+ 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)]);
1828
1966
  if (!ph || !nh || prev.bbox.y > ph * CONTINUED_TABLE_PAGE_BAND || next.bbox.y + next.bbox.height < nh * (1 - CONTINUED_TABLE_PAGE_BAND)) return;
1829
- if (splitOnly && (inner.length !== 1 || !_optionalChain([joinSplitParts, 'call', _160 => _160(prev.table, px, next.table, nx, 0, prev.bbox.y), 'optionalAccess', _161 => _161.split]))) return;
1967
+ if (splitOnly && (inner.length !== 1 || !_optionalChain([joinSplitParts, 'call', _221 => _221(prev.table, px, next.table, nx, 0, prev.bbox.y), 'optionalAccess', _222 => _222.split]))) return;
1830
1968
  blocks.splice(at, 1, ...inner);
1831
1969
  }
1832
1970
  function fillNestedContinuation(blocks, at) {
1833
1971
  const prev = blocks[at - 1], next = blocks[at];
1834
- const t = _optionalChain([prev, 'optionalAccess', _162 => _162.table]), u = _optionalChain([next, 'optionalAccess', _163 => _163.table]);
1835
- if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunkNLGOMLGUcjs.CLIP_TABLES.has(t) || !_chunkNLGOMLGUcjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
1836
- const xs = _chunkNLGOMLGUcjs.TABLE_COLXS.get(u);
1972
+ const t = _optionalChain([prev, 'optionalAccess', _223 => _223.table]), u = _optionalChain([next, 'optionalAccess', _224 => _224.table]);
1973
+ if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunkC6B5GWN7cjs.CLIP_TABLES.has(t) || !_chunkC6B5GWN7cjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
1974
+ const xs = _chunkC6B5GWN7cjs.TABLE_COLXS.get(u);
1837
1975
  const cell = xs ? lastRowCell(t, xs[0], xs[xs.length - 1]) : void 0;
1838
- const add = _optionalChain([u, 'access', _164 => _164.cells, 'access', _165 => _165[0], 'optionalAccess', _166 => _166[0]]);
1839
- if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _167 => _167.blocks, 'optionalAccess', _168 => _168.length]) || _chunkNLGOMLGUcjs.IMAGE_CELLS.has(cell)) return;
1976
+ const add = _optionalChain([u, 'access', _225 => _225.cells, 'access', _226 => _226[0], 'optionalAccess', _227 => _227[0]]);
1977
+ if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _228 => _228.blocks, 'optionalAccess', _229 => _229.length]) || _chunkC6B5GWN7cjs.IMAGE_CELLS.has(cell)) return;
1840
1978
  cell.text = add.text;
1841
1979
  if (add.blocks) cell.blocks = add.blocks;
1842
- if (_chunkNLGOMLGUcjs.IMAGE_CELLS.has(add)) _chunkNLGOMLGUcjs.IMAGE_CELLS.add(cell);
1843
- _chunkNLGOMLGUcjs.joinCellEdges.call(void 0, cell, add);
1980
+ if (_chunkC6B5GWN7cjs.IMAGE_CELLS.has(add)) _chunkC6B5GWN7cjs.IMAGE_CELLS.add(cell);
1981
+ _chunkC6B5GWN7cjs.joinCellEdges.call(void 0, cell, add);
1844
1982
  blocks.splice(at, 1);
1845
1983
  }
1846
1984
 
1847
1985
  // src/pdf/symbol-glyphs.ts
1848
1986
 
1987
+
1988
+ // src/pdf/known-font-glyphs.ts
1989
+
1990
+ var HCR_DOT = "bb7a2a3ab48d5bfdfd9582c0fb6525401c3a7f1851bb1c1bdb45048be95d1599";
1991
+ var BATANG_NUMBERS = [
1992
+ "8a4af2cf2dfe3238b4e2b35af976746216ade6e89cd3c55ec1e43bca532379b9",
1993
+ "7332dcab9d77002bdb92723a7fa4afa963ad01601f6328fbedd7289798fb77d0",
1994
+ "e7cc725807eae1ae0311898429629931f5924ade91a876c899b0c5bd109b325b",
1995
+ "3956a9db6baa74ef40ff93291ef5c42245cd4b36d613e5c956e307f347705adb",
1996
+ "8340732dc5f6a75a6808e87749ae9e9e7d54f4299f86eabbfaedd95da10ad447",
1997
+ "1412a79bd9ed7fdb34a8f04c29e341230a3bef649fb7b44a58ea6a56da0f3e44"
1998
+ ];
1999
+ function knownFontGlyph(name, outline, width) {
2000
+ const face = _optionalChain([name, 'optionalAccess', _230 => _230.replace, 'call', _231 => _231(/^[A-Z]{6}\+/, "")]);
2001
+ const dot = face === "HCRDotum" && width === 970 && outline.upm === 1e3;
2002
+ const number = (face === "Haansoft Batang" || face === "Haansoft-Batang") && width === 1e3 && outline.upm === 1024;
2003
+ if (!dot && !number) return null;
2004
+ const signature = _crypto.createHash.call(void 0, "sha256").update(JSON.stringify([outline.upm, width, outline.contours])).digest("hex");
2005
+ if (dot) return signature === HCR_DOT ? _chunkYG4GFQB7cjs.mapPuaText.call(void 0, String.fromCodePoint(983791)) : null;
2006
+ const index = BATANG_NUMBERS.indexOf(signature);
2007
+ return index < 0 ? null : _chunkYG4GFQB7cjs.mapPuaText.call(void 0, String.fromCodePoint(983729 + index));
2008
+ }
2009
+
2010
+ // src/pdf/symbol-glyphs.ts
1849
2011
  var NO_UNICODE = "\uF000";
1850
2012
  var u16 = (b, o) => b[o] << 8 | b[o + 1];
1851
2013
  var i16 = (b, o) => {
@@ -2009,14 +2171,14 @@ function restoreUnmappedGlyphs(items, fnArray, argsArray, fontObj) {
2009
2171
  for (const g2 of args[0]) {
2010
2172
  const glyph = g2;
2011
2173
  if (!glyph || glyph.unicode !== NO_UNICODE || typeof glyph.fontChar !== "string") continue;
2012
- const key = font + "\0" + glyph.fontChar;
2174
+ const key = font + "\0" + glyph.fontChar + "\0" + typeof glyph.width + ":" + String(glyph.width);
2013
2175
  if (!cache.has(key)) {
2014
2176
  let sym = null;
2015
2177
  try {
2016
- const data = _optionalChain([fontObj, 'call', _169 => _169(font), 'optionalAccess', _170 => _170.data]);
2178
+ const source = fontObj(font), data = _optionalChain([source, 'optionalAccess', _232 => _232.data]);
2017
2179
  const code = glyph.fontChar.codePointAt(0);
2018
2180
  const outline = data && code !== void 0 ? readOutline(data, code) : null;
2019
- if (outline) sym = classifyOutline(outline);
2181
+ if (outline) sym = _nullishCoalesce(knownFontGlyph(_optionalChain([source, 'optionalAccess', _233 => _233.name]), outline, glyph.width), () => ( classifyOutline(outline)));
2020
2182
  } catch (e3) {
2021
2183
  }
2022
2184
  cache.set(key, sym);
@@ -2037,7 +2199,7 @@ function restoreUnmappedGlyphs(items, fnArray, argsArray, fontObj) {
2037
2199
  }
2038
2200
  for (const [f, list] of byFont) {
2039
2201
  const q = queues.get(f);
2040
- const want = list.reduce((n, it) => n + (_nullishCoalesce(_optionalChain([it, 'access', _171 => _171.str, 'access', _172 => _172.match, 'call', _173 => _173(//g), 'optionalAccess', _174 => _174.length]), () => ( 0))), 0);
2202
+ const want = list.reduce((n, it) => n + (_nullishCoalesce(_optionalChain([it, 'access', _234 => _234.str, 'access', _235 => _235.match, 'call', _236 => _236(//g), 'optionalAccess', _237 => _237.length]), () => ( 0))), 0);
2041
2203
  if (!q || q.length !== want) continue;
2042
2204
  let k = 0;
2043
2205
  for (const it of list) it.str = it.str.replace(//g, () => q[k++]);
@@ -2060,15 +2222,15 @@ function selectionContextPages(selected, pageCount) {
2060
2222
  function marginContextBlocks(raw, page, view) {
2061
2223
  const [x1, y1, x2, y2] = view;
2062
2224
  const width = x2 - x1, height = y2 - y1;
2063
- const items = _chunkNLGOMLGUcjs.filterHiddenText.call(void 0, _chunkNLGOMLGUcjs.normalizeItems.call(void 0, raw), width, height, x1, y1).visible;
2225
+ const items = _chunkC6B5GWN7cjs.filterHiddenText.call(void 0, _chunkC6B5GWN7cjs.normalizeItems.call(void 0, raw), width, height, x1, y1).visible;
2064
2226
  for (const item of items) {
2065
2227
  item.x -= x1;
2066
2228
  item.y -= y1;
2067
2229
  }
2068
- return _chunkNLGOMLGUcjs.groupByY.call(void 0, items).flatMap((line) => {
2069
- const bbox = _chunkNLGOMLGUcjs.computeBBox.call(void 0, line, page);
2230
+ return _chunkC6B5GWN7cjs.groupByY.call(void 0, items).flatMap((line) => {
2231
+ const bbox = _chunkC6B5GWN7cjs.computeBBox.call(void 0, line, page);
2070
2232
  if (bbox.y + bbox.height < height * 0.88 && bbox.y > height * 0.12) return [];
2071
- return [{ type: "paragraph", text: _chunkNLGOMLGUcjs.mergeLineSimple.call(void 0, line), pageNumber: page, bbox, style: _chunkNLGOMLGUcjs.dominantStyle.call(void 0, line) }];
2233
+ return [{ type: "paragraph", text: _chunkC6B5GWN7cjs.mergeLineSimple.call(void 0, line), pageNumber: page, bbox, style: _chunkC6B5GWN7cjs.dominantStyle.call(void 0, line) }];
2072
2234
  });
2073
2235
  }
2074
2236
 
@@ -2104,7 +2266,7 @@ var WINANSI_REVERSE = {
2104
2266
  };
2105
2267
  function symbolFontTable(fontName) {
2106
2268
  if (!fontName) return void 0;
2107
- if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunkSJ5OZXELcjs.WINGDINGS;
2269
+ if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunkYG4GFQB7cjs.WINGDINGS;
2108
2270
  return void 0;
2109
2271
  }
2110
2272
  function remapSymbolText(text, table) {
@@ -2232,7 +2394,7 @@ function layout(toks) {
2232
2394
  const bar = rest.find((t) => t.bar && t.x >= rt.x && t.x <= rt.x + rt.w + 2 && Math.abs(t.y - rt.y) <= size * 1.5);
2233
2395
  if (!bar) continue;
2234
2396
  const inner = rest.filter((t) => !t.bar && t !== rt && t.x + t.w / 2 > bar.x && t.x + t.w / 2 < bar.x + bar.w && bar.y - t.y > 0 && bar.y - t.y <= size * 1.4);
2235
- const tok = { text: `\\sqrt{${linear(inner)}}`, x: rt.x, w: bar.x + bar.w - rt.x, y: _nullishCoalesce(_optionalChain([inner, 'access', _175 => _175[0], 'optionalAccess', _176 => _176.y]), () => ( rt.y)), size: Math.max(rt.size, ...inner.map((t) => t.size)), bar: false };
2397
+ const tok = { text: `\\sqrt{${linear(inner)}}`, x: rt.x, w: bar.x + bar.w - rt.x, y: _nullishCoalesce(_optionalChain([inner, 'access', _238 => _238[0], 'optionalAccess', _239 => _239.y]), () => ( rt.y)), size: Math.max(rt.size, ...inner.map((t) => t.size)), bar: false };
2236
2398
  rest = [...rest.filter((t) => t !== rt && t !== bar && !inner.includes(t)), tok];
2237
2399
  }
2238
2400
  const bars = rest.filter((t) => t.bar).sort((a, b) => a.w - b.w);
@@ -2334,7 +2496,7 @@ function wrapEquationRuns(items, faceName) {
2334
2496
  for (const i of mains) ys.set(i.y, (_nullishCoalesce(ys.get(i.y), () => ( 0))) + 1);
2335
2497
  const top = [...ys].sort((p, q) => q[1] - p[1]);
2336
2498
  const bar = cur.find(isBarItem);
2337
- const lineY = bar && top.length > 1 && top[0][1] === top[1][1] ? Math.round(bar.y + size * 0.3) : _nullishCoalesce(_optionalChain([top, 'access', _177 => _177[0], 'optionalAccess', _178 => _178[0]]), () => ( cur[0].y));
2499
+ const lineY = bar && top.length > 1 && top[0][1] === top[1][1] ? Math.round(bar.y + size * 0.3) : _nullishCoalesce(_optionalChain([top, 'access', _240 => _240[0], 'optionalAccess', _241 => _241[0]]), () => ( cur[0].y));
2338
2500
  const base = { ..._nullishCoalesce(mains[0], () => ( cur[0])), y: lineY, fontSize: size || cur[0].fontSize };
2339
2501
  const x1 = Math.min(...cur.map((i) => i.x)), x2 = Math.max(...cur.map((i) => i.x + i.w));
2340
2502
  added.push({ ...base, text: `$${tex}$`, x: x1, w: x2 - x1, hasSpaceBefore: true });
@@ -2691,7 +2853,7 @@ function joinVerticalColumns(items) {
2691
2853
  const groups = [];
2692
2854
  for (const col of columns) {
2693
2855
  const g2 = groups[groups.length - 1];
2694
- const last = _optionalChain([g2, 'optionalAccess', _179 => _179[g2.length - 1]]);
2856
+ const last = _optionalChain([g2, 'optionalAccess', _242 => _242[g2.length - 1]]);
2695
2857
  const fs = col.items[0].fontSize;
2696
2858
  if (last && last.x - col.x >= fs * 1.2 && last.x - col.x <= fs * 4 && Math.abs(last.items[0].y - col.items[0].y) <= fs * 1.2) g2.push(col);
2697
2859
  else groups.push([col]);
@@ -2907,7 +3069,7 @@ function relocateEndnotes(blocks) {
2907
3069
  }
2908
3070
  const shapes = /* @__PURE__ */ new Map();
2909
3071
  for (const h of heads) shapes.set(h.shape, (_nullishCoalesce(shapes.get(h.shape), () => ( 0))) + 1);
2910
- const main = _optionalChain([[...shapes], 'access', _180 => _180.sort, 'call', _181 => _181((a, b) => b[1] - a[1]), 'access', _182 => _182[0], 'optionalAccess', _183 => _183[0]]);
3072
+ const main = _optionalChain([[...shapes], 'access', _243 => _243.sort, 'call', _244 => _244((a, b) => b[1] - a[1]), 'access', _245 => _245[0], 'optionalAccess', _246 => _246[0]]);
2911
3073
  if (!main || !/#/.test(main)) return blocks;
2912
3074
  const lastRun = (hs) => {
2913
3075
  let run2 = [];
@@ -2970,7 +3132,7 @@ function dropTabLeaderDots(items) {
2970
3132
  let run = [];
2971
3133
  const flush = () => {
2972
3134
  const last = run[run.length - 1];
2973
- const tailPage = _optionalChain([DOTS_PAGE, 'access', _184 => _184.exec, 'call', _185 => _185(last.text.trim()), 'optionalAccess', _186 => _186[1]]);
3135
+ const tailPage = _optionalChain([DOTS_PAGE, 'access', _247 => _247.exec, 'call', _248 => _248(last.text.trim()), 'optionalAccess', _249 => _249[1]]);
2974
3136
  const dots = run.reduce((n, d) => n + d.text.trim().replace(/\d+$/, "").length, 0);
2975
3137
  if (dots >= MIN_DOTS && (tailPage ? run.length > 1 : pageNoAfter(last.x + last.w, last))) {
2976
3138
  const body = tailPage ? run.slice(0, -1) : run;
@@ -3058,7 +3220,7 @@ function inlineFootnotes(blocks, pages) {
3058
3220
  open = true;
3059
3221
  continue;
3060
3222
  }
3061
- const prev = pb[j - 1], line = (_nullishCoalesce(_nullishCoalesce(_optionalChain([b, 'access', _187 => _187.style, 'optionalAccess', _188 => _188.fontSize]), () => ( _optionalChain([b, 'access', _189 => _189.bbox, 'optionalAccess', _190 => _190.height]))), () => ( 10))) * 1.5;
3223
+ const prev = pb[j - 1], line = (_nullishCoalesce(_nullishCoalesce(_optionalChain([b, 'access', _250 => _250.style, 'optionalAccess', _251 => _251.fontSize]), () => ( _optionalChain([b, 'access', _252 => _252.bbox, 'optionalAccess', _253 => _253.height]))), () => ( 10))) * 1.5;
3062
3224
  if (open && b.bbox && prev.bbox && prev.bbox.y - top(b) <= line && !/^[-–—\s\d]+$/.test(b.text)) {
3063
3225
  notes[notes.length - 1].text += " " + b.text.trim();
3064
3226
  notes[notes.length - 1].blocks.push(b);
@@ -3081,7 +3243,7 @@ var CAPTION = /^(?:Table|Figure|Fig\.?)\s*\d+(?:\.\d+)*\s*[.:]/i;
3081
3243
  var EQUATION_NUMBER = /\t\(\d{1,3}[a-z]?\)\s*$/;
3082
3244
  var DISPLAY_MATH = /=|[√∑∏∫∂∇≤≥≈≠∈∀∃]/;
3083
3245
  function isRunningHead(block, page, pageHeight) {
3084
- const box = block.bbox, text = _optionalChain([block, 'access', _191 => _191.text, 'optionalAccess', _192 => _192.trim, 'call', _193 => _193()]);
3246
+ const box = block.bbox, text = _optionalChain([block, 'access', _254 => _254.text, 'optionalAccess', _255 => _255.trim, 'call', _256 => _256()]);
3085
3247
  if (!box || !text || !pageHeight) return false;
3086
3248
  const top = box.y + box.height >= pageHeight * 0.9;
3087
3249
  const bottom = box.y <= pageHeight * 0.1;
@@ -3089,7 +3251,7 @@ function isRunningHead(block, page, pageHeight) {
3089
3251
  const others = page.filter((o) => o !== block && o.bbox && o.type !== "image" && o.type !== "separator");
3090
3252
  if (top && others.some((o) => o.bbox.y + o.bbox.height > box.y + box.height)) return false;
3091
3253
  if (bottom && others.some((o) => o.bbox.y < box.y)) return false;
3092
- if (bottom && box.height <= (_nullishCoalesce(_optionalChain([block, 'access', _194 => _194.style, 'optionalAccess', _195 => _195.fontSize]), () => ( 0))) * 1.6) return true;
3254
+ if (bottom && box.height <= (_nullishCoalesce(_optionalChain([block, 'access', _257 => _257.style, 'optionalAccess', _258 => _258.fontSize]), () => ( 0))) * 1.6) return true;
3093
3255
  if (!text.includes(" ")) return false;
3094
3256
  const parts = text.split(/\t+/).map((part) => part.trim()).filter(Boolean);
3095
3257
  if (parts.length >= 2 && (PAGE_NUMBER.test(parts[0]) || PAGE_NUMBER.test(parts[parts.length - 1]))) return true;
@@ -3098,7 +3260,7 @@ function isRunningHead(block, page, pageHeight) {
3098
3260
  return right > left && box.width >= (right - left) * 0.6;
3099
3261
  }
3100
3262
  function unbalancedClose(text) {
3101
- return (_nullishCoalesce(_optionalChain([text, 'access', _196 => _196.match, 'call', _197 => _197(/\)/g), 'optionalAccess', _198 => _198.length]), () => ( 0))) > (_nullishCoalesce(_optionalChain([text, 'access', _199 => _199.match, 'call', _200 => _200(/\(/g), 'optionalAccess', _201 => _201.length]), () => ( 0)));
3263
+ return (_nullishCoalesce(_optionalChain([text, 'access', _259 => _259.match, 'call', _260 => _260(/\)/g), 'optionalAccess', _261 => _261.length]), () => ( 0))) > (_nullishCoalesce(_optionalChain([text, 'access', _262 => _262.match, 'call', _263 => _263(/\(/g), 'optionalAccess', _264 => _264.length]), () => ( 0)));
3102
3264
  }
3103
3265
  function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
3104
3266
  const byPage = /* @__PURE__ */ new Map();
@@ -3114,7 +3276,7 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
3114
3276
  const sizes = /* @__PURE__ */ new Map();
3115
3277
  let proseChars = 0;
3116
3278
  for (const b of page) {
3117
- if (b.type !== "paragraph" && b.type !== "heading" || !b.text || !_optionalChain([b, 'access', _202 => _202.style, 'optionalAccess', _203 => _203.fontName]) || !b.style.fontSize) continue;
3279
+ if (b.type !== "paragraph" && b.type !== "heading" || !b.text || !_optionalChain([b, 'access', _265 => _265.style, 'optionalAccess', _266 => _266.fontName]) || !b.style.fontSize) continue;
3118
3280
  const key2 = `${b.style.fontName}:${b.style.fontSize}`;
3119
3281
  chars.set(key2, (_nullishCoalesce(chars.get(key2), () => ( 0))) + b.text.length);
3120
3282
  if (b.type === "paragraph" && b.style.fontName === "ocr") {
@@ -3138,13 +3300,13 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
3138
3300
  const citedProse = /* @__PURE__ */ new Set();
3139
3301
  const numberedProse = /* @__PURE__ */ new Set();
3140
3302
  for (const page of byPage.values()) {
3141
- const numbered = page.filter((b) => (b.type === "heading" || b.type === "paragraph") && /^[①-⑮]\s*/.test(_nullishCoalesce(_optionalChain([b, 'access', _204 => _204.text, 'optionalAccess', _205 => _205.trim, 'call', _206 => _206()]), () => ( ""))) && b.bbox && _optionalChain([b, 'access', _207 => _207.style, 'optionalAccess', _208 => _208.fontName]) && b.style.fontSize && !/Bold|Black|Heavy|Semibold/i.test(_nullishCoalesce(_optionalChain([faceNames, 'optionalAccess', _209 => _209.get, 'call', _210 => _210(b.style.fontName)]), () => ( ""))));
3303
+ const numbered = page.filter((b) => (b.type === "heading" || b.type === "paragraph") && /^[①-⑮]\s*/.test(_nullishCoalesce(_optionalChain([b, 'access', _267 => _267.text, 'optionalAccess', _268 => _268.trim, 'call', _269 => _269()]), () => ( ""))) && b.bbox && _optionalChain([b, 'access', _270 => _270.style, 'optionalAccess', _271 => _271.fontName]) && b.style.fontSize && !/Bold|Black|Heavy|Semibold/i.test(_nullishCoalesce(_optionalChain([faceNames, 'optionalAccess', _272 => _272.get, 'call', _273 => _273(b.style.fontName)]), () => ( ""))));
3142
3304
  let chain = [];
3143
3305
  const finish = () => {
3144
- if (chain.length < 3 || !chain.some((b) => (_nullishCoalesce(_optionalChain([b, 'access', _211 => _211.text, 'optionalAccess', _212 => _212.length]), () => ( 0))) >= 40 && b.bbox.height >= b.style.fontSize * 2.4)) return;
3306
+ if (chain.length < 3 || !chain.some((b) => (_nullishCoalesce(_optionalChain([b, 'access', _274 => _274.text, 'optionalAccess', _275 => _275.length]), () => ( 0))) >= 40 && b.bbox.height >= b.style.fontSize * 2.4)) return;
3145
3307
  for (const b of chain) numberedProse.add(b);
3146
3308
  const first = chain[0], size = first.style.fontSize;
3147
- for (const b of page) if (/^[○●•◦]\s/.test(_nullishCoalesce(_optionalChain([b, 'access', _213 => _213.text, 'optionalAccess', _214 => _214.trim, 'call', _215 => _215()]), () => ( ""))) && _optionalChain([b, 'access', _216 => _216.style, 'optionalAccess', _217 => _217.fontName]) === _optionalChain([first, 'access', _218 => _218.style, 'optionalAccess', _219 => _219.fontName]) && _optionalChain([b, 'access', _220 => _220.style, 'optionalAccess', _221 => _221.fontSize]) === size && b.bbox && Math.abs(b.bbox.x - first.bbox.x) <= size * 0.5 && (_nullishCoalesce(_optionalChain([b, 'access', _222 => _222.text, 'optionalAccess', _223 => _223.length]), () => ( 0))) >= 15) numberedProse.add(b);
3309
+ for (const b of page) if (/^[○●•◦]\s/.test(_nullishCoalesce(_optionalChain([b, 'access', _276 => _276.text, 'optionalAccess', _277 => _277.trim, 'call', _278 => _278()]), () => ( ""))) && _optionalChain([b, 'access', _279 => _279.style, 'optionalAccess', _280 => _280.fontName]) === _optionalChain([first, 'access', _281 => _281.style, 'optionalAccess', _282 => _282.fontName]) && _optionalChain([b, 'access', _283 => _283.style, 'optionalAccess', _284 => _284.fontSize]) === size && b.bbox && Math.abs(b.bbox.x - first.bbox.x) <= size * 0.5 && (_nullishCoalesce(_optionalChain([b, 'access', _285 => _285.text, 'optionalAccess', _286 => _286.length]), () => ( 0))) >= 15) numberedProse.add(b);
3148
3310
  };
3149
3311
  for (const b of numbered) {
3150
3312
  const prev = chain.at(-1), size = b.style.fontSize;
@@ -3158,9 +3320,9 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
3158
3320
  }
3159
3321
  for (let i = 0; i + 1 < blocks.length; i++) {
3160
3322
  const prose = blocks[i], reference = blocks[i + 1];
3161
- const a = prose.bbox, b = reference.bbox, size = _nullishCoalesce(_optionalChain([prose, 'access', _224 => _224.style, 'optionalAccess', _225 => _225.fontSize]), () => ( 0));
3162
- const source = _nullishCoalesce(_optionalChain([reference, 'access', _226 => _226.text, 'optionalAccess', _227 => _227.replace, 'call', _228 => _228(/<[^>]+>/g, ""), 'access', _229 => _229.trim, 'call', _230 => _230()]), () => ( ""));
3163
- if (prose.type !== "heading" && prose.type !== "paragraph" && prose.type !== "list" || reference.type !== "heading" && reference.type !== "paragraph" || (_nullishCoalesce(_optionalChain([prose, 'access', _231 => _231.text, 'optionalAccess', _232 => _232.length]), () => ( 0))) < 40 || !a || !b || size <= 0 || a.height < size * 2.4 || prose.pageNumber !== reference.pageNumber || _optionalChain([prose, 'access', _233 => _233.style, 'optionalAccess', _234 => _234.fontName]) !== _optionalChain([reference, 'access', _235 => _235.style, 'optionalAccess', _236 => _236.fontName]) || _optionalChain([prose, 'access', _237 => _237.style, 'optionalAccess', _238 => _238.fontSize]) !== _optionalChain([reference, 'access', _239 => _239.style, 'optionalAccess', _240 => _240.fontSize]) || Math.abs(a.x - b.x) > size && !(/^[○●•◦]\s/.test(_nullishCoalesce(prose.text, () => ( ""))) && b.x >= a.x && b.x - a.x <= size * 2) || a.y - (b.y + b.height) < 0 || a.y - (b.y + b.height) > size || !/^[((].*(?:제\s*\d+\s*조|(?:Article|Section)\s+\d+).*[))]$/i.test(source)) continue;
3323
+ const a = prose.bbox, b = reference.bbox, size = _nullishCoalesce(_optionalChain([prose, 'access', _287 => _287.style, 'optionalAccess', _288 => _288.fontSize]), () => ( 0));
3324
+ const source = _nullishCoalesce(_optionalChain([reference, 'access', _289 => _289.text, 'optionalAccess', _290 => _290.replace, 'call', _291 => _291(/<[^>]+>/g, ""), 'access', _292 => _292.trim, 'call', _293 => _293()]), () => ( ""));
3325
+ if (prose.type !== "heading" && prose.type !== "paragraph" && prose.type !== "list" || reference.type !== "heading" && reference.type !== "paragraph" || (_nullishCoalesce(_optionalChain([prose, 'access', _294 => _294.text, 'optionalAccess', _295 => _295.length]), () => ( 0))) < 40 || !a || !b || size <= 0 || a.height < size * 2.4 || prose.pageNumber !== reference.pageNumber || _optionalChain([prose, 'access', _296 => _296.style, 'optionalAccess', _297 => _297.fontName]) !== _optionalChain([reference, 'access', _298 => _298.style, 'optionalAccess', _299 => _299.fontName]) || _optionalChain([prose, 'access', _300 => _300.style, 'optionalAccess', _301 => _301.fontSize]) !== _optionalChain([reference, 'access', _302 => _302.style, 'optionalAccess', _303 => _303.fontSize]) || Math.abs(a.x - b.x) > size && !(/^[○●•◦]\s/.test(_nullishCoalesce(prose.text, () => ( ""))) && b.x >= a.x && b.x - a.x <= size * 2) || a.y - (b.y + b.height) < 0 || a.y - (b.y + b.height) > size || !/^[((].*(?:제\s*\d+\s*조|(?:Article|Section)\s+\d+).*[))]$/i.test(source)) continue;
3164
3326
  citedProse.add(prose);
3165
3327
  citedProse.add(reference);
3166
3328
  }
@@ -3168,49 +3330,49 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
3168
3330
  const block = blocks[i];
3169
3331
  if (block.type !== "heading" || !block.text) continue;
3170
3332
  const text = block.text.replace(/<[^>]+>/g, "").trim();
3171
- const fsz = _nullishCoalesce(_optionalChain([block, 'access', _241 => _241.style, 'optionalAccess', _242 => _242.fontSize]), () => ( 0));
3172
- const tocEntry = i > 0 && _chunkNLGOMLGUcjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunkNLGOMLGUcjs.TOC_BLOCKS.has(blocks[i + 1]);
3333
+ const fsz = _nullishCoalesce(_optionalChain([block, 'access', _304 => _304.style, 'optionalAccess', _305 => _305.fontSize]), () => ( 0));
3334
+ const tocEntry = i > 0 && _chunkC6B5GWN7cjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunkC6B5GWN7cjs.TOC_BLOCKS.has(blocks[i + 1]);
3173
3335
  const page = _nullishCoalesce(byPage.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( []));
3174
- const proseStyle = _optionalChain([block, 'access', _243 => _243.style, 'optionalAccess', _244 => _244.fontName]) && bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))) === `${block.style.fontName}:${block.style.fontSize}` && text.length > 60;
3336
+ const proseStyle = _optionalChain([block, 'access', _306 => _306.style, 'optionalAccess', _307 => _307.fontName]) && bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))) === `${block.style.fontName}:${block.style.fontSize}` && text.length > 60;
3175
3337
  const next = blocks[i + 1];
3176
- const nb = _optionalChain([next, 'optionalAccess', _245 => _245.bbox]), bb = block.bbox;
3177
- const chapterNumber = !!nb && !!bb && fsz >= (_nullishCoalesce(_optionalChain([next, 'optionalAccess', _246 => _246.style, 'optionalAccess', _247 => _247.fontSize]), () => ( 0))) * 1.2 && Math.abs(bb.x - nb.x) > fsz && Math.abs(bb.x + bb.width / 2 - (nb.x + nb.width / 2)) < nb.width * 0.1;
3178
- if (/^\d+(?:\.\d+)*\.?$/.test(text) && _optionalChain([next, 'optionalAccess', _248 => _248.type]) === "heading" && next.text && next.pageNumber === block.pageNumber && !chapterNumber) {
3338
+ const nb = _optionalChain([next, 'optionalAccess', _308 => _308.bbox]), bb = block.bbox;
3339
+ const chapterNumber = !!nb && !!bb && fsz >= (_nullishCoalesce(_optionalChain([next, 'optionalAccess', _309 => _309.style, 'optionalAccess', _310 => _310.fontSize]), () => ( 0))) * 1.2 && Math.abs(bb.x - nb.x) > fsz && Math.abs(bb.x + bb.width / 2 - (nb.x + nb.width / 2)) < nb.width * 0.1;
3340
+ if (/^\d+(?:\.\d+)*\.?$/.test(text) && _optionalChain([next, 'optionalAccess', _311 => _311.type]) === "heading" && next.text && next.pageNumber === block.pageNumber && !chapterNumber) {
3179
3341
  next.text = `${block.text.trim()} ${next.text.trim()}`;
3180
3342
  blocks.splice(i--, 1);
3181
3343
  continue;
3182
3344
  }
3183
- if ((_optionalChain([next, 'optionalAccess', _249 => _249.type]) === "paragraph" || _optionalChain([next, 'optionalAccess', _250 => _250.type]) === "heading" && !CAPTION.test(text)) && next.pageNumber === block.pageNumber && next.text && next.bbox && block.bbox && _optionalChain([next, 'access', _251 => _251.style, 'optionalAccess', _252 => _252.fontName]) === _optionalChain([block, 'access', _253 => _253.style, 'optionalAccess', _254 => _254.fontName]) && _optionalChain([next, 'access', _255 => _255.style, 'optionalAccess', _256 => _256.fontSize]) === _optionalChain([block, 'access', _257 => _257.style, 'optionalAccess', _258 => _258.fontSize]) && fsz > 0 && /^[a-z]/.test(next.text.trim()) && next.text.trim().length <= 40 && !/[.:;!?]$/.test(next.text.trim()) && block.bbox.y - (next.bbox.y + next.bbox.height) < fsz * 1.2 && Math.abs(next.bbox.x - block.bbox.x) < fsz) {
3345
+ if ((_optionalChain([next, 'optionalAccess', _312 => _312.type]) === "paragraph" || _optionalChain([next, 'optionalAccess', _313 => _313.type]) === "heading" && !CAPTION.test(text)) && next.pageNumber === block.pageNumber && next.text && next.bbox && block.bbox && _optionalChain([next, 'access', _314 => _314.style, 'optionalAccess', _315 => _315.fontName]) === _optionalChain([block, 'access', _316 => _316.style, 'optionalAccess', _317 => _317.fontName]) && _optionalChain([next, 'access', _318 => _318.style, 'optionalAccess', _319 => _319.fontSize]) === _optionalChain([block, 'access', _320 => _320.style, 'optionalAccess', _321 => _321.fontSize]) && fsz > 0 && /^[a-z]/.test(next.text.trim()) && next.text.trim().length <= 40 && !/[.:;!?]$/.test(next.text.trim()) && block.bbox.y - (next.bbox.y + next.bbox.height) < fsz * 1.2 && Math.abs(next.bbox.x - block.bbox.x) < fsz) {
3184
3346
  block.text = `${block.text.trim()} ${next.text.trim()}`;
3185
3347
  block.bbox = { ...block.bbox, y: next.bbox.y, height: block.bbox.y + block.bbox.height - next.bbox.y };
3186
3348
  blocks.splice(i + 1, 1);
3187
3349
  }
3188
3350
  const after = blocks[i + 2];
3189
- if ((_optionalChain([next, 'optionalAccess', _259 => _259.type]) === "paragraph" || _optionalChain([next, 'optionalAccess', _260 => _260.type]) === "heading") && /^(?:&|\+|and|or)$/i.test(_nullishCoalesce(_optionalChain([next, 'access', _261 => _261.text, 'optionalAccess', _262 => _262.trim, 'call', _263 => _263()]), () => ( ""))) && _optionalChain([after, 'optionalAccess', _264 => _264.type]) === "heading" && after.text && after.pageNumber === block.pageNumber && next.pageNumber === block.pageNumber && _optionalChain([after, 'access', _265 => _265.style, 'optionalAccess', _266 => _266.fontSize]) === _optionalChain([block, 'access', _267 => _267.style, 'optionalAccess', _268 => _268.fontSize])) {
3351
+ if ((_optionalChain([next, 'optionalAccess', _322 => _322.type]) === "paragraph" || _optionalChain([next, 'optionalAccess', _323 => _323.type]) === "heading") && /^(?:&|\+|and|or)$/i.test(_nullishCoalesce(_optionalChain([next, 'access', _324 => _324.text, 'optionalAccess', _325 => _325.trim, 'call', _326 => _326()]), () => ( ""))) && _optionalChain([after, 'optionalAccess', _327 => _327.type]) === "heading" && after.text && after.pageNumber === block.pageNumber && next.pageNumber === block.pageNumber && _optionalChain([after, 'access', _328 => _328.style, 'optionalAccess', _329 => _329.fontSize]) === _optionalChain([block, 'access', _330 => _330.style, 'optionalAccess', _331 => _331.fontSize])) {
3190
3352
  block.text = `${block.text.trim()} ${next.text.trim()} ${after.text.trim()}`;
3191
3353
  blocks.splice(i + 1, 2);
3192
3354
  }
3193
3355
  const tiny = fsz > 0 && fsz < 7.5;
3194
3356
  const prev = blocks[i - 1];
3195
- if (_optionalChain([prev, 'optionalAccess', _269 => _269.type]) === "paragraph" && prev.pageNumber === block.pageNumber && /^[a-z]{1,3}[.)]$/.test(_nullishCoalesce(_optionalChain([prev, 'access', _270 => _270.text, 'optionalAccess', _271 => _271.trim, 'call', _272 => _272()]), () => ( ""))) && prev.bbox && block.bbox && Math.abs(prev.bbox.y - block.bbox.y) < 2 && prev.bbox.x + prev.bbox.width <= block.bbox.x) {
3357
+ if (_optionalChain([prev, 'optionalAccess', _332 => _332.type]) === "paragraph" && prev.pageNumber === block.pageNumber && /^[a-z]{1,3}[.)]$/.test(_nullishCoalesce(_optionalChain([prev, 'access', _333 => _333.text, 'optionalAccess', _334 => _334.trim, 'call', _335 => _335()]), () => ( ""))) && prev.bbox && block.bbox && Math.abs(prev.bbox.y - block.bbox.y) < 2 && prev.bbox.x + prev.bbox.width <= block.bbox.x) {
3196
3358
  prev.text = `${prev.text.trim()} ${block.text.trim()}`;
3197
3359
  prev.bbox = { ...prev.bbox, width: block.bbox.x + block.bbox.width - prev.bbox.x };
3198
3360
  blocks.splice(i--, 1);
3199
3361
  continue;
3200
3362
  }
3201
- if (_optionalChain([prev, 'optionalAccess', _273 => _273.type]) === "paragraph" && prev.pageNumber === block.pageNumber && /^\d{1,2}(?:\.\d{1,2})*\.?$/.test(_nullishCoalesce(_optionalChain([prev, 'access', _274 => _274.text, 'optionalAccess', _275 => _275.trim, 'call', _276 => _276()]), () => ( ""))) && prev.bbox && block.bbox && fsz > 0 && (Math.abs(prev.bbox.y - block.bbox.y) < 2 && prev.bbox.x + prev.bbox.width <= block.bbox.x && block.bbox.x - (prev.bbox.x + prev.bbox.width) < fsz * 3 || Math.abs(prev.bbox.x - block.bbox.x) < 2 && (_nullishCoalesce(_optionalChain([prev, 'access', _277 => _277.style, 'optionalAccess', _278 => _278.fontSize]), () => ( 0))) >= fsz && prev.bbox.y - (block.bbox.y + block.bbox.height) < fsz * 1.5)) {
3363
+ if (_optionalChain([prev, 'optionalAccess', _336 => _336.type]) === "paragraph" && prev.pageNumber === block.pageNumber && /^\d{1,2}(?:\.\d{1,2})*\.?$/.test(_nullishCoalesce(_optionalChain([prev, 'access', _337 => _337.text, 'optionalAccess', _338 => _338.trim, 'call', _339 => _339()]), () => ( ""))) && prev.bbox && block.bbox && fsz > 0 && (Math.abs(prev.bbox.y - block.bbox.y) < 2 && prev.bbox.x + prev.bbox.width <= block.bbox.x && block.bbox.x - (prev.bbox.x + prev.bbox.width) < fsz * 3 || Math.abs(prev.bbox.x - block.bbox.x) < 2 && (_nullishCoalesce(_optionalChain([prev, 'access', _340 => _340.style, 'optionalAccess', _341 => _341.fontSize]), () => ( 0))) >= fsz && prev.bbox.y - (block.bbox.y + block.bbox.height) < fsz * 1.5)) {
3202
3364
  block.text = `${prev.text.trim()} ${block.text.trim()}`;
3203
3365
  blocks.splice(i - 1, 1);
3204
3366
  i -= 2;
3205
3367
  continue;
3206
3368
  }
3207
- const box = block.bbox, size = _nullishCoalesce(_optionalChain([block, 'access', _279 => _279.style, 'optionalAccess', _280 => _280.fontSize]), () => ( 0));
3208
- const kicker = !!box && size > 0 && _optionalChain([next, 'optionalAccess', _281 => _281.type]) === "heading" && next.pageNumber === block.pageNumber && !!next.bbox && (_optionalChain([block, 'access', _282 => _282.style, 'optionalAccess', _283 => _283.fontName]) !== "ocr" || size < (_nullishCoalesce(bodySizes.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( Infinity))) * 2) && (_nullishCoalesce(_optionalChain([next, 'access', _284 => _284.style, 'optionalAccess', _285 => _285.fontSize]), () => ( 0))) >= size * 1.3 && box.y - (next.bbox.y + next.bbox.height) <= size * 3 && Math.min(box.x + box.width, next.bbox.x + next.bbox.width) - Math.max(box.x, next.bbox.x) >= Math.min(box.width, next.bbox.width) * 0.5 && !page.some((o) => o !== block && o.bbox && o.bbox.y > box.y + box.height && o.type !== "image");
3209
- const face = _nullishCoalesce(_optionalChain([faceNames, 'optionalAccess', _286 => _286.get, 'call', _287 => _287(_nullishCoalesce(_optionalChain([block, 'access', _288 => _288.style, 'optionalAccess', _289 => _289.fontName]), () => ( "")))]), () => ( ""));
3369
+ const box = block.bbox, size = _nullishCoalesce(_optionalChain([block, 'access', _342 => _342.style, 'optionalAccess', _343 => _343.fontSize]), () => ( 0));
3370
+ const kicker = !!box && size > 0 && _optionalChain([next, 'optionalAccess', _344 => _344.type]) === "heading" && next.pageNumber === block.pageNumber && !!next.bbox && (_optionalChain([block, 'access', _345 => _345.style, 'optionalAccess', _346 => _346.fontName]) !== "ocr" || size < (_nullishCoalesce(bodySizes.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( Infinity))) * 2) && (_nullishCoalesce(_optionalChain([next, 'access', _347 => _347.style, 'optionalAccess', _348 => _348.fontSize]), () => ( 0))) >= size * 1.3 && box.y - (next.bbox.y + next.bbox.height) <= size * 3 && Math.min(box.x + box.width, next.bbox.x + next.bbox.width) - Math.max(box.x, next.bbox.x) >= Math.min(box.width, next.bbox.width) * 0.5 && !page.some((o) => o !== block && o.bbox && o.bbox.y > box.y + box.height && o.type !== "image");
3371
+ const face = _nullishCoalesce(_optionalChain([faceNames, 'optionalAccess', _349 => _349.get, 'call', _350 => _350(_nullishCoalesce(_optionalChain([block, 'access', _351 => _351.style, 'optionalAccess', _352 => _352.fontName]), () => ( "")))]), () => ( ""));
3210
3372
  const [bodyFace, bodySize] = (_nullishCoalesce(bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( ""))).split(":");
3211
- const byline = /Italic|Oblique/i.test(face) && !/Bold|Black|Heavy|Semibold/i.test(face) && !!bodyFace && size <= Number(bodySize) + 0.5 && _optionalChain([blocks, 'access', _290 => _290[i - 1], 'optionalAccess', _291 => _291.type]) === "heading" && blocks[i - 1].pageNumber === block.pageNumber;
3212
- const ocrFragment = _optionalChain([block, 'access', _292 => _292.style, 'optionalAccess', _293 => _293.fontName]) === "ocr" && (/^[.,;:…·•-]/.test(text) || text.includes("\u2026") || (_nullishCoalesce(_optionalChain([text, 'access', _294 => _294.match, 'call', _295 => _295(/\p{L}/gu), 'optionalAccess', _296 => _296.length]), () => ( 0))) < 2 || text.split(/\s+/).length > 7);
3213
- const crowdedOcr = _optionalChain([block, 'access', _297 => _297.style, 'optionalAccess', _298 => _298.fontName]) === "ocr" && !!box && [prev, next].every((o) => _optionalChain([o, 'optionalAccess', _299 => _299.type]) === "paragraph" && o.pageNumber === block.pageNumber && _optionalChain([o, 'access', _300 => _300.style, 'optionalAccess', _301 => _301.fontName]) === "ocr" && !!o.bbox && (_nullishCoalesce(_optionalChain([o, 'access', _302 => _302.text, 'optionalAccess', _303 => _303.length]), () => ( 0))) >= 15 && Math.abs(o.bbox.x - box.x) <= size * 0.25 && Math.min(o.bbox.y + o.bbox.height, box.y + box.height) - Math.max(o.bbox.y, box.y) >= o.bbox.height * 0.2) && prev.bbox.y > box.y && next.bbox.y < box.y;
3373
+ const byline = /Italic|Oblique/i.test(face) && !/Bold|Black|Heavy|Semibold/i.test(face) && !!bodyFace && size <= Number(bodySize) + 0.5 && _optionalChain([blocks, 'access', _353 => _353[i - 1], 'optionalAccess', _354 => _354.type]) === "heading" && blocks[i - 1].pageNumber === block.pageNumber;
3374
+ const ocrFragment = _optionalChain([block, 'access', _355 => _355.style, 'optionalAccess', _356 => _356.fontName]) === "ocr" && (/^[.,;:…·•-]/.test(text) || text.includes("\u2026") || (_nullishCoalesce(_optionalChain([text, 'access', _357 => _357.match, 'call', _358 => _358(/\p{L}/gu), 'optionalAccess', _359 => _359.length]), () => ( 0))) < 2 || text.split(/\s+/).length > 7);
3375
+ const crowdedOcr = _optionalChain([block, 'access', _360 => _360.style, 'optionalAccess', _361 => _361.fontName]) === "ocr" && !!box && [prev, next].every((o) => _optionalChain([o, 'optionalAccess', _362 => _362.type]) === "paragraph" && o.pageNumber === block.pageNumber && _optionalChain([o, 'access', _363 => _363.style, 'optionalAccess', _364 => _364.fontName]) === "ocr" && !!o.bbox && (_nullishCoalesce(_optionalChain([o, 'access', _365 => _365.text, 'optionalAccess', _366 => _366.length]), () => ( 0))) >= 15 && Math.abs(o.bbox.x - box.x) <= size * 0.25 && Math.min(o.bbox.y + o.bbox.height, box.y + box.height) - Math.max(o.bbox.y, box.y) >= o.bbox.height * 0.2) && prev.bbox.y > box.y && next.bbox.y < box.y;
3214
3376
  if (numberedProse.has(block) || citedProse.has(block) || ocrFragment || crowdedOcr || tocEntry || proseStyle || kicker || byline || tiny || !/\p{L}/u.test(text) && !chapterNumber || /^[a-z]/.test(text) || CAPTION.test(text) || EQUATION_NUMBER.test(block.text) || DISPLAY_MATH.test(text) || // 닫는 괄호가 여는 괄호보다 많으면 앞 줄에서 이어진 문장 조각이다 ("Fact-checking) and is used …") — "1)"·"가)" 앞머리 번호는 빼고 센다
3215
3377
  unbalancedClose(text.replace(/^\s*[\dA-Za-z가-힣ⅰ-ⅹ]{1,3}\)\s*/, "")) || isRunningHead(block, page, pageHeights.get(_nullishCoalesce(block.pageNumber, () => ( 0))))) {
3216
3378
  block.type = "paragraph";
@@ -3260,34 +3422,34 @@ var CAPTION_LABEL = /^(?:figure|fig\.|diagram|table|chart|graph|exhibit|box)\s*[
3260
3422
  function captionTableText(t) {
3261
3423
  if (!t || t.rows !== 1 || t.cols !== 2) return null;
3262
3424
  const [label, body] = t.cells[0];
3263
- if (!label || !body || _optionalChain([label, 'access', _304 => _304.blocks, 'optionalAccess', _305 => _305.length]) || _optionalChain([body, 'access', _306 => _306.blocks, 'optionalAccess', _307 => _307.length]) || !CAPTION_LABEL.test(label.text.trim()) || !body.text.trim()) return null;
3425
+ if (!label || !body || _optionalChain([label, 'access', _367 => _367.blocks, 'optionalAccess', _368 => _368.length]) || _optionalChain([body, 'access', _369 => _369.blocks, 'optionalAccess', _370 => _370.length]) || !CAPTION_LABEL.test(label.text.trim()) || !body.text.trim()) return null;
3264
3426
  return `${label.text.trim()} ${body.text.replace(/\s*\n\s*/g, " ").trim()}`;
3265
3427
  }
3266
3428
  function splitSingleCellTables(blocks) {
3267
3429
  const out = [];
3268
3430
  for (const b of blocks) {
3269
3431
  const t = b.type === "table" ? b.table : void 0;
3270
- const title = t && _chunkNLGOMLGUcjs.FRAME_TITLE_BLOCKS.get(t);
3432
+ const title = t && _chunkC6B5GWN7cjs.FRAME_TITLE_BLOCKS.get(t);
3271
3433
  if (title) {
3272
3434
  out.push({ ...title, text: `${t.cells[0][0].text.trim()} ${t.cells[0][2].text.trim()}` });
3273
3435
  continue;
3274
3436
  }
3275
- const only = t && t.rows === 1 && t.cols === 1 && _optionalChain([t, 'access', _308 => _308.cells, 'access', _309 => _309[0], 'optionalAccess', _310 => _310[0], 'optionalAccess', _311 => _311.blocks, 'optionalAccess', _312 => _312.length]) === 1 ? t.cells[0][0].blocks[0] : void 0;
3437
+ const only = t && t.rows === 1 && t.cols === 1 && _optionalChain([t, 'access', _371 => _371.cells, 'access', _372 => _372[0], 'optionalAccess', _373 => _373[0], 'optionalAccess', _374 => _374.blocks, 'optionalAccess', _375 => _375.length]) === 1 ? t.cells[0][0].blocks[0] : void 0;
3276
3438
  const squash = (s) => s.replace(/\s/g, "");
3277
3439
  const inner = only && (!squash(t.cells[0][0].text) || only.type === "table" && squash(t.cells[0][0].text) === squash(only.table.cells.flat().map((c) => c.text).join(""))) ? only : void 0;
3278
- const caption = _nullishCoalesce(captionTableText(t), () => ( (_optionalChain([inner, 'optionalAccess', _313 => _313.type]) === "table" ? captionTableText(inner.table) : null)));
3440
+ const caption = _nullishCoalesce(captionTableText(t), () => ( (_optionalChain([inner, 'optionalAccess', _376 => _376.type]) === "table" ? captionTableText(inner.table) : null)));
3279
3441
  if (caption) {
3280
3442
  out.push({ type: "paragraph", text: caption, pageNumber: b.pageNumber, bbox: b.bbox });
3281
3443
  continue;
3282
3444
  }
3283
- const cell = t && t.rows === 1 && t.cols === 1 ? _optionalChain([t, 'access', _314 => _314.cells, 'access', _315 => _315[0], 'optionalAccess', _316 => _316[0]]) : void 0;
3445
+ const cell = t && t.rows === 1 && t.cols === 1 ? _optionalChain([t, 'access', _377 => _377.cells, 'access', _378 => _378[0], 'optionalAccess', _379 => _379[0]]) : void 0;
3284
3446
  if (!cell) {
3285
3447
  out.push(b);
3286
3448
  continue;
3287
3449
  }
3288
3450
  const lines = (_nullishCoalesce(cell.text, () => ( ""))).split(/\n/).map((l) => l.trim()).filter(Boolean);
3289
- if (_optionalChain([t, 'optionalAccess', _317 => _317.caption, 'optionalAccess', _318 => _318.trim, 'call', _319 => _319()])) out.push({ type: "paragraph", text: t.caption.trim(), pageNumber: b.pageNumber, bbox: b.bbox });
3290
- if (_optionalChain([cell, 'access', _320 => _320.blocks, 'optionalAccess', _321 => _321.length])) {
3451
+ if (_optionalChain([t, 'optionalAccess', _380 => _380.caption, 'optionalAccess', _381 => _381.trim, 'call', _382 => _382()])) out.push({ type: "paragraph", text: t.caption.trim(), pageNumber: b.pageNumber, bbox: b.bbox });
3452
+ if (_optionalChain([cell, 'access', _383 => _383.blocks, 'optionalAccess', _384 => _384.length])) {
3291
3453
  out.push(...splitSingleCellTables(cell.blocks));
3292
3454
  continue;
3293
3455
  }
@@ -3303,7 +3465,7 @@ function joinLatinCellWraps(blocks) {
3303
3465
  const lines = cell.text.split("\n");
3304
3466
  const out = [lines[0]];
3305
3467
  for (const line of lines.slice(1)) {
3306
- if (_chunkNLGOMLGUcjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
3468
+ if (_chunkC6B5GWN7cjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
3307
3469
  else out.push(line);
3308
3470
  }
3309
3471
  cell.text = out.join("\n");
@@ -3314,19 +3476,19 @@ function joinLatinCellWraps(blocks) {
3314
3476
  }
3315
3477
  function cleanPdfText(text, opts) {
3316
3478
  let clean = normalizeAraea(stripControlChars(text));
3317
- if (!_optionalChain([opts, 'optionalAccess', _322 => _322.keepLoneNumbers])) {
3479
+ if (!_optionalChain([opts, 'optionalAccess', _385 => _385.keepLoneNumbers])) {
3318
3480
  clean = clean.replace(/^\d{1,4}\n/, "").replace(/\n\d{1,4}\n/g, "\n").replace(/\n\d{1,4}$/, "");
3319
3481
  }
3320
- if (!_optionalChain([opts, 'optionalAccess', _323 => _323.keepLoneNumbers])) clean = clean.replace(/^#{1,6}\s*\d{1,4}\s*$/gm, "");
3482
+ if (!_optionalChain([opts, 'optionalAccess', _386 => _386.keepLoneNumbers])) clean = clean.replace(/^#{1,6}\s*\d{1,4}\s*$/gm, "");
3321
3483
  return mergeKoreanLines(
3322
3484
  clean.replace(/^[\s]*[-–—]\s*[-–—]?\d+[-–—]?[\s]*[-–—]?[\s]*$/gm, "").replace(/^\s*\d+\s*\/\s*\d+\s*$/gm, "").replace(/\.(?: \.){3,}/g, (m) => ".".repeat(m.length + 1 >> 1))
3323
3485
  ).replace(/^(?!\| ---).*$/gm, (line) => {
3324
3486
  if (/^\s*\${1,2}.+\${1,2}\s*$/.test(line)) return line;
3325
3487
  if (line.startsWith("|")) {
3326
- return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkNLGOMLGUcjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
3488
+ return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkC6B5GWN7cjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
3327
3489
  }
3328
- const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _324 => _324.exec, 'call', _325 => _325(line), 'optionalAccess', _326 => _326[0]]), () => ( ""));
3329
- return mark + _chunkNLGOMLGUcjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
3490
+ const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _387 => _387.exec, 'call', _388 => _388(line), 'optionalAccess', _389 => _389[0]]), () => ( ""));
3491
+ return mark + _chunkC6B5GWN7cjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
3330
3492
  }).replace(/\\~\\~/g, "~~").replace(/~~~~/g, "").replace(/<u>\s*<\/u>/g, "").replace(/<(sup|sub)>\s*<\/\1>/g, "").replace(/\n{3,}/g, "\n\n").trim();
3331
3493
  }
3332
3494
  function startsWithMarker(line) {
@@ -3358,7 +3520,7 @@ function mergeKoreanLines(text) {
3358
3520
  continue;
3359
3521
  }
3360
3522
  if (/[가-힣·,\-]$/.test(prev) && /^[가-힣(]/.test(curr) && !startsWithMarker(curr) && !isStandaloneHeader(prev) && !startsWithMarker(prev)) {
3361
- result[result.length - 1] = prev + _chunkNLGOMLGUcjs.wrapJoiner.call(void 0, prev, curr) + curr;
3523
+ result[result.length - 1] = prev + _chunkC6B5GWN7cjs.wrapJoiner.call(void 0, prev, curr) + curr;
3362
3524
  } else {
3363
3525
  result.push(curr);
3364
3526
  }
@@ -3374,7 +3536,7 @@ function applyLinkAnnotations(items, annots) {
3374
3536
  const wrapped = /* @__PURE__ */ new Set();
3375
3537
  for (const a of annots) {
3376
3538
  if (a.subtype !== "Link" || !a.url || !a.rect || a.rect.length < 4) continue;
3377
- const url = _chunkMI655NV5cjs.sanitizeHref.call(void 0, a.url);
3539
+ const url = _chunkAS25R4EUcjs.sanitizeHref.call(void 0, a.url);
3378
3540
  if (!url) continue;
3379
3541
  const x1 = Math.min(a.rect[0], a.rect[2]), x2 = Math.max(a.rect[0], a.rect[2]);
3380
3542
  const y1 = Math.min(a.rect[1], a.rect[3]), y2 = Math.max(a.rect[1], a.rect[3]);
@@ -3426,7 +3588,7 @@ function mergeLinkRuns(markdown) {
3426
3588
 
3427
3589
  // src/pdf/formula-ocr.ts
3428
3590
  async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
3429
- const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-5V2WG4BH.cjs")));
3591
+ const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-QZGTF3DZ.cjs")));
3430
3592
  const { FormulaPipeline, ensureFormulaModels } = formulaMod;
3431
3593
  await ensureFormulaModels((p) => {
3432
3594
  if (p.phase === "download" && p.total) {
@@ -3617,13 +3779,13 @@ async function loadPdfWithTimeout(buffer) {
3617
3779
  try {
3618
3780
  return await Promise.race([
3619
3781
  loadingTask.promise.catch((e) => {
3620
- if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkMI655NV5cjs.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)");
3782
+ if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkAS25R4EUcjs.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)");
3621
3783
  throw e;
3622
3784
  }),
3623
3785
  new Promise((_, reject) => {
3624
3786
  timer = setTimeout(() => {
3625
3787
  loadingTask.destroy();
3626
- reject(new (0, _chunkMI655NV5cjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
3788
+ reject(new (0, _chunkAS25R4EUcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
3627
3789
  }, PDF_LOAD_TIMEOUT_MS);
3628
3790
  })
3629
3791
  ]);
@@ -3632,15 +3794,15 @@ async function loadPdfWithTimeout(buffer) {
3632
3794
  }
3633
3795
  }
3634
3796
  async function parsePdfDocument(buffer, options) {
3635
- const formulaBuffer = _optionalChain([options, 'optionalAccess', _327 => _327.formulaOcr]) ? buffer : null;
3636
- const ocrOptionError = _chunkSJ5OZXELcjs.validateOcrOptions.call(void 0, options);
3637
- if (ocrOptionError) throw new (0, _chunkMI655NV5cjs.KordocError)(ocrOptionError);
3638
- const autoOcr = _optionalChain([options, 'optionalAccess', _328 => _328.ocr]) === void 0 && await _chunkNLGOMLGUcjs.ocrModelsCached.call(void 0, _chunkNLGOMLGUcjs.resolveOcrModels.call(void 0, options));
3639
- const ocrBuffer = _optionalChain([options, 'optionalAccess', _329 => _329.ocr]) || autoOcr ? buffer : null;
3797
+ const formulaBuffer = _optionalChain([options, 'optionalAccess', _390 => _390.formulaOcr]) ? buffer : null;
3798
+ const ocrOptionError = _chunkYG4GFQB7cjs.validateOcrOptions.call(void 0, options);
3799
+ if (ocrOptionError) throw new (0, _chunkAS25R4EUcjs.KordocError)(ocrOptionError);
3800
+ const autoOcr = _optionalChain([options, 'optionalAccess', _391 => _391.ocr]) === void 0 && await _chunkC6B5GWN7cjs.ocrModelsCached.call(void 0, _chunkC6B5GWN7cjs.resolveOcrModels.call(void 0, options));
3801
+ const ocrBuffer = _optionalChain([options, 'optionalAccess', _392 => _392.ocr]) || autoOcr ? buffer : null;
3640
3802
  const doc = await loadPdfWithTimeout(buffer);
3641
3803
  try {
3642
3804
  const pageCount = doc.numPages;
3643
- if (pageCount === 0) throw new (0, _chunkMI655NV5cjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
3805
+ if (pageCount === 0) throw new (0, _chunkAS25R4EUcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
3644
3806
  const metadata = { pageCount, pageMode: "layout" };
3645
3807
  await extractPdfMetadata(doc, metadata);
3646
3808
  const blocks = [];
@@ -3649,8 +3811,8 @@ async function parsePdfDocument(buffer, options) {
3649
3811
  let totalChars = 0;
3650
3812
  let totalTextBytes = 0;
3651
3813
  const effectivePageCount = Math.min(pageCount, MAX_PAGES);
3652
- const pageFilter = _optionalChain([options, 'optionalAccess', _330 => _330.pages]) ? _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, effectivePageCount) : null;
3653
- if (pageCount > MAX_PAGES && (!_optionalChain([options, 'optionalAccess', _331 => _331.pages]) || _chunkJ55UQC5Hcjs.hasRequestedPagesAfter.call(void 0, options.pages, MAX_PAGES, pageCount))) {
3814
+ const pageFilter = _optionalChain([options, 'optionalAccess', _393 => _393.pages]) ? _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, effectivePageCount) : null;
3815
+ if (pageCount > MAX_PAGES && (!_optionalChain([options, 'optionalAccess', _394 => _394.pages]) || _chunkJ55UQC5Hcjs.hasRequestedPagesAfter.call(void 0, options.pages, MAX_PAGES, pageCount))) {
3654
3816
  warnings.push({ message: `${pageCount}\uCABD \uC911 \uC55E ${MAX_PAGES}\uCABD\uB9CC \uD30C\uC2F1\uD588\uC2B5\uB2C8\uB2E4 (\uCABD \uC218 \uC0C1\uD55C)`, code: "PARTIAL_PARSE" });
3655
3817
  }
3656
3818
  const totalTarget = pageFilter ? pageFilter.size : effectivePageCount;
@@ -3669,10 +3831,10 @@ async function parsePdfDocument(buffer, options) {
3669
3831
  const pageImageBlocks = /* @__PURE__ */ new Map();
3670
3832
  const carry = {};
3671
3833
  const vectorPageOps = /* @__PURE__ */ new Map();
3672
- const wrapLexicon = new (0, _chunkNLGOMLGUcjs.WrapLexicon)();
3834
+ const wrapLexicon = new (0, _chunkC6B5GWN7cjs.WrapLexicon)();
3673
3835
  const noteMarks = /* @__PURE__ */ new Map();
3674
3836
  const headerContext = [];
3675
- if (pageFilter && _optionalChain([options, 'optionalAccess', _332 => _332.removeHeaderFooter]) !== false && pageFilter.size < effectivePageCount) {
3837
+ if (pageFilter && _optionalChain([options, 'optionalAccess', _395 => _395.removeHeaderFooter]) !== false && pageFilter.size < effectivePageCount) {
3676
3838
  for (const number of selectionContextPages(pageFilter, effectivePageCount)) {
3677
3839
  let contextPage;
3678
3840
  try {
@@ -3682,7 +3844,7 @@ async function parsePdfDocument(buffer, options) {
3682
3844
  headerContext.push(...marginContextBlocks(content.items, number, contextPage.view));
3683
3845
  } catch (e6) {
3684
3846
  } finally {
3685
- _optionalChain([contextPage, 'optionalAccess', _333 => _333.cleanup, 'call', _334 => _334()]);
3847
+ _optionalChain([contextPage, 'optionalAccess', _396 => _396.cleanup, 'call', _397 => _397()]);
3686
3848
  }
3687
3849
  }
3688
3850
  }
@@ -3709,15 +3871,15 @@ async function parsePdfDocument(buffer, options) {
3709
3871
  return void 0;
3710
3872
  }
3711
3873
  };
3712
- const differencesOf = (loadedName) => _optionalChain([fontObj, 'call', _335 => _335(loadedName), 'optionalAccess', _336 => _336.differences]);
3874
+ const differencesOf = (loadedName) => _optionalChain([fontObj, 'call', _398 => _398(loadedName), 'optionalAccess', _399 => _399.differences]);
3713
3875
  const occluded = occludedTextItems(rawItems, rawOps.fnArray, rawOps.argsArray);
3714
3876
  markTrailingSpaceGlyphs(rawItems, rawOps.fnArray, rawOps.argsArray);
3715
- restoreNamedGlyphs(rawItems, rawOps.fnArray, rawOps.argsArray, differencesOf, (n) => _optionalChain([fontObj, 'call', _337 => _337(n), 'optionalAccess', _338 => _338.name]));
3877
+ restoreNamedGlyphs(rawItems, rawOps.fnArray, rawOps.argsArray, differencesOf, (n) => _optionalChain([fontObj, 'call', _400 => _400(n), 'optionalAccess', _401 => _401.name]));
3716
3878
  restoreUnmappedGlyphs(rawItems, rawOps.fnArray, rawOps.argsArray, (n) => fontObj(n));
3717
3879
  restoreTrackedSpacing(rawItems, rawOps.fnArray, rawOps.argsArray);
3718
3880
  markSyntheticSpaces(rawItems, rawOps.fnArray, rawOps.argsArray);
3719
- const items = _chunkNLGOMLGUcjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
3720
- const filtered = _chunkNLGOMLGUcjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
3881
+ const items = _chunkC6B5GWN7cjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
3882
+ const filtered = _chunkC6B5GWN7cjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
3721
3883
  const joined = joinVerticalColumns(filtered.visible);
3722
3884
  const visible = dropTabLeaderDots(joined);
3723
3885
  const hiddenCount = filtered.hiddenCount + occluded.size;
@@ -3741,27 +3903,27 @@ async function parsePdfDocument(buffer, options) {
3741
3903
  fnArray: [_pdfmjs.OPS.transform, ...rawOps.fnArray],
3742
3904
  argsArray: [[1, 0, 0, 1, -viewX1, -viewY1], ...rawOps.argsArray]
3743
3905
  } : rawOps;
3744
- remapSymbolFontItems(visible, (loadedName) => _optionalChain([fontObj, 'call', _339 => _339(loadedName), 'optionalAccess', _340 => _340.name]));
3906
+ remapSymbolFontItems(visible, (loadedName) => _optionalChain([fontObj, 'call', _402 => _402(loadedName), 'optionalAccess', _403 => _403.name]));
3745
3907
  remapControlGlyphs(visible, differencesOf);
3746
- await _chunkNLGOMLGUcjs.restoreImageBullets.call(void 0, visible, page, opList.fnArray, opList.argsArray, imageBulletShapes);
3908
+ await _chunkC6B5GWN7cjs.restoreImageBullets.call(void 0, visible, page, opList.fnArray, opList.argsArray, imageBulletShapes);
3747
3909
  const faces = /* @__PURE__ */ new Map();
3748
3910
  for (const it of visible) {
3749
3911
  if (!it.fontName) continue;
3750
3912
  let face = faces.get(it.fontName);
3751
3913
  if (face === void 0) {
3752
3914
  const obj = fontObj(it.fontName);
3753
- face = _optionalChain([obj, 'optionalAccess', _341 => _341.isType3Font]) && /^[A-Z]{6}\+./.test(_nullishCoalesce(obj.name, () => ( ""))) && obj.name.slice(7) || it.fontName;
3915
+ face = _optionalChain([obj, 'optionalAccess', _404 => _404.isType3Font]) && /^[A-Z]{6}\+./.test(_nullishCoalesce(obj.name, () => ( ""))) && obj.name.slice(7) || it.fontName;
3754
3916
  faces.set(it.fontName, face);
3755
3917
  }
3756
3918
  it.fontName = face;
3757
- if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _342 => _342(face), 'optionalAccess', _343 => _343.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
3919
+ if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _405 => _405(face), 'optionalAccess', _406 => _406.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
3758
3920
  }
3759
- for (const it of visible) if (it.text.includes("$")) it.text = _chunkSJ5OZXELcjs.escapeLiteralDollar.call(void 0, it.text);
3760
- for (const it of visible) if (it.text.includes("<")) it.text = _chunkSJ5OZXELcjs.escapeLiteralTags.call(void 0, it.text);
3921
+ for (const it of visible) if (it.text.includes("$")) it.text = _chunkYG4GFQB7cjs.escapeLiteralDollar.call(void 0, it.text);
3922
+ for (const it of visible) if (it.text.includes("<")) it.text = _chunkYG4GFQB7cjs.escapeLiteralTags.call(void 0, it.text);
3761
3923
  wrapEquationRuns(visible, (face) => faceNames.get(face));
3762
3924
  const pageArea = pageW * pageH;
3763
3925
  if (pageArea > 0) {
3764
- const imageRegions = _chunkNLGOMLGUcjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
3926
+ const imageRegions = _chunkC6B5GWN7cjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
3765
3927
  let uncovered = 0;
3766
3928
  for (const r of imageRegions) {
3767
3929
  const area = (r.x2 - r.x1) * (r.y2 - r.y1);
@@ -3787,15 +3949,15 @@ async function parsePdfDocument(buffer, options) {
3787
3949
  if (uncovered > 0) skippedImagePages.set(i, uncovered);
3788
3950
  }
3789
3951
  const marks = superscriptNoteMarks(visible);
3790
- if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunkNLGOMLGUcjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
3952
+ if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunkC6B5GWN7cjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
3791
3953
  const stamp = marginStamp(visible);
3792
3954
  const flow = stamp.length ? visible.filter((it) => !stamp.includes(it)) : visible;
3793
- const rightArrows = _optionalChain([options, 'optionalAccess', _344 => _344.tables]) !== false ? await _chunkNLGOMLGUcjs.detectRightArrowRegions.call(void 0, page, opList.fnArray, opList.argsArray, imageArrowDirections) : [];
3794
- const pageBlocks = orderTwoUpPage(_chunkNLGOMLGUcjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _345 => _345.tables]) !== false, carry, wrapLexicon, rightArrows), pageW, pageH);
3955
+ const rightArrows = _optionalChain([options, 'optionalAccess', _407 => _407.tables]) !== false ? await _chunkC6B5GWN7cjs.detectRightArrowRegions.call(void 0, page, opList.fnArray, opList.argsArray, imageArrowDirections) : [];
3956
+ const pageBlocks = orderTwoUpPage(_chunkC6B5GWN7cjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _408 => _408.tables]) !== false, carry, wrapLexicon, rightArrows), pageW, pageH);
3795
3957
  if (stamp.length) pageBlocks.unshift({ type: "paragraph", text: [...stamp].sort((a, b) => a.y - b.y).map((it) => it.text).join(" "), pageNumber: i });
3796
3958
  for (const b of pageBlocks) blocks.push(b);
3797
3959
  try {
3798
- const { blocks: imgBlocks, images: pageImages } = await extractPageImages(page, opList.fnArray, opList.argsArray, i, imageState, warnings, _optionalChain([options, 'optionalAccess', _346 => _346.images]) !== false);
3960
+ const { blocks: imgBlocks, images: pageImages } = await extractPageImages(page, opList.fnArray, opList.argsArray, i, imageState, warnings, _optionalChain([options, 'optionalAccess', _409 => _409.images]) !== false);
3799
3961
  if (imgBlocks.length > 0) pageImageBlocks.set(i, imgBlocks);
3800
3962
  extractedImages.push(...pageImages);
3801
3963
  } catch (e9) {
@@ -3814,17 +3976,17 @@ async function parsePdfDocument(buffer, options) {
3814
3976
  const vector = scanVectorGlyphs(opList.fnArray, opList.argsArray, visible);
3815
3977
  const quality = computePageQuality(i, pageText, vector.glyphs);
3816
3978
  pageQuality.push(quality);
3817
- if (_optionalChain([options, 'optionalAccess', _347 => _347.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
3979
+ if (_optionalChain([options, 'optionalAccess', _410 => _410.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
3818
3980
  vectorPageOps.set(i, ocrVectorOps(opList, vector.paths));
3819
3981
  }
3820
- if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkMI655NV5cjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
3982
+ if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkAS25R4EUcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
3821
3983
  parsedPages++;
3822
- _optionalChain([options, 'optionalAccess', _348 => _348.onProgress, 'optionalCall', _349 => _349(parsedPages, totalTarget)]);
3984
+ _optionalChain([options, 'optionalAccess', _411 => _411.onProgress, 'optionalCall', _412 => _412(parsedPages, totalTarget)]);
3823
3985
  } catch (pageErr) {
3824
- if (pageErr instanceof _chunkMI655NV5cjs.KordocError) throw pageErr;
3986
+ if (pageErr instanceof _chunkAS25R4EUcjs.KordocError) throw pageErr;
3825
3987
  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" });
3826
3988
  } finally {
3827
- _optionalChain([loadedPage, 'optionalAccess', _350 => _350.cleanup, 'call', _351 => _351()]);
3989
+ _optionalChain([loadedPage, 'optionalAccess', _413 => _413.cleanup, 'call', _414 => _414()]);
3828
3990
  }
3829
3991
  if (loadedFonts.size > FONT_CACHE_LIMIT) {
3830
3992
  await doc.cleanup();
@@ -3832,14 +3994,14 @@ async function parsePdfDocument(buffer, options) {
3832
3994
  }
3833
3995
  }
3834
3996
  const parsedPageCount = parsedPages || (pageFilter ? pageFilter.size : effectivePageCount);
3835
- const isImageBased = _optionalChain([pageFilter, 'optionalAccess', _352 => _352.size]) !== 0 && totalChars / Math.max(parsedPageCount, 1) < 10;
3997
+ const isImageBased = _optionalChain([pageFilter, 'optionalAccess', _415 => _415.size]) !== 0 && totalChars / Math.max(parsedPageCount, 1) < 10;
3836
3998
  const ocrDone = /* @__PURE__ */ new Set();
3837
3999
  const ocrLinesOut = /* @__PURE__ */ new Map();
3838
- const ocrRegions = _optionalChain([options, 'optionalAccess', _353 => _353.ocr]) === true || autoOcr ? ocrImageRegions(uncoveredImageRegions, largeImageRegions, _optionalChain([options, 'optionalAccess', _354 => _354.ocr]) === true) : /* @__PURE__ */ new Map();
4000
+ const ocrRegions = _optionalChain([options, 'optionalAccess', _416 => _416.ocr]) === true || autoOcr ? ocrImageRegions(uncoveredImageRegions, largeImageRegions, _optionalChain([options, 'optionalAccess', _417 => _417.ocr]) === true) : /* @__PURE__ */ new Map();
3839
4001
  if (ocrBuffer) {
3840
4002
  const inScope = (p) => !pageFilter || pageFilter.has(p);
3841
4003
  const targets = /* @__PURE__ */ new Set();
3842
- if (_optionalChain([options, 'optionalAccess', _355 => _355.ocr]) === "force" || isImageBased) {
4004
+ if (_optionalChain([options, 'optionalAccess', _418 => _418.ocr]) === "force" || isImageBased) {
3843
4005
  for (let i = 1; i <= effectivePageCount; i++) if (inScope(i)) targets.add(i);
3844
4006
  } else {
3845
4007
  for (const pq of pageQuality) {
@@ -3852,25 +4014,25 @@ async function parsePdfDocument(buffer, options) {
3852
4014
  }
3853
4015
  if (targets.size > 0) {
3854
4016
  try {
3855
- const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-RKXDY3ZA.cjs")));
3856
- const mode = typeof _optionalChain([options, 'optionalAccess', _356 => _356.ocr]) === "function" ? options.ocr : "builtin";
3857
- const regionPages = new Map([...ocrRegions].filter(([p]) => _optionalChain([options, 'optionalAccess', _357 => _357.ocr]) !== "force" && !isImageBased && !_optionalChain([pageQuality, 'access', _358 => _358.find, 'call', _359 => _359((q) => q.page === p), 'optionalAccess', _360 => _360.needsOcr])));
3858
- const { builtinOcrConfig } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-RKXDY3ZA.cjs")));
3859
- const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, _optionalChain([options, 'optionalAccess', _361 => _361.onProgress]), _optionalChain([options, 'optionalAccess', _362 => _362.tables]) !== false, vectorPageOps, regionPages, builtinOcrConfig(options), ocrLinesOut);
3860
- for (const obs of ocrPageBlocks.values()) _chunkSJ5OZXELcjs.stripScriptTags.call(void 0, { blocks: obs });
4017
+ const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-IOUZTPPH.cjs")));
4018
+ const mode = typeof _optionalChain([options, 'optionalAccess', _419 => _419.ocr]) === "function" ? options.ocr : "builtin";
4019
+ const regionPages = new Map([...ocrRegions].filter(([p]) => _optionalChain([options, 'optionalAccess', _420 => _420.ocr]) !== "force" && !isImageBased && !_optionalChain([pageQuality, 'access', _421 => _421.find, 'call', _422 => _422((q) => q.page === p), 'optionalAccess', _423 => _423.needsOcr])));
4020
+ const { builtinOcrConfig } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-IOUZTPPH.cjs")));
4021
+ const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, _optionalChain([options, 'optionalAccess', _424 => _424.onProgress]), _optionalChain([options, 'optionalAccess', _425 => _425.tables]) !== false, vectorPageOps, regionPages, builtinOcrConfig(options), ocrLinesOut);
4022
+ for (const obs of ocrPageBlocks.values()) _chunkYG4GFQB7cjs.stripScriptTags.call(void 0, { blocks: obs });
3861
4023
  if (ocrPageBlocks.size > 0) {
3862
4024
  const replacePages = /* @__PURE__ */ new Set();
3863
4025
  for (const [p, obs] of ocrPageBlocks) {
3864
- const needsOcr = _optionalChain([pageQuality, 'access', _363 => _363.find, 'call', _364 => _364((q) => q.page === p), 'optionalAccess', _365 => _365.needsOcr]);
3865
- if (_optionalChain([options, 'optionalAccess', _366 => _366.ocr]) === "force" || isImageBased || needsOcr) {
4026
+ const needsOcr = _optionalChain([pageQuality, 'access', _426 => _426.find, 'call', _427 => _427((q) => q.page === p), 'optionalAccess', _428 => _428.needsOcr]);
4027
+ if (_optionalChain([options, 'optionalAccess', _429 => _429.ocr]) === "force" || isImageBased || needsOcr) {
3866
4028
  replacePages.add(p);
3867
4029
  ocrDone.add(p);
3868
4030
  continue;
3869
4031
  }
3870
4032
  const regions = ocrRegions.get(p);
3871
- if (!regions || _chunkNLGOMLGUcjs.mergeOcrImageRegions.call(void 0, blocks, p, regions, obs) === 0) continue;
4033
+ if (!regions || _chunkC6B5GWN7cjs.mergeOcrImageRegions.call(void 0, blocks, p, regions, obs) === 0) continue;
3872
4034
  ocrDone.add(p);
3873
- if (_optionalChain([pageImageBlocks, 'access', _367 => _367.get, 'call', _368 => _368(p), 'optionalAccess', _369 => _369.length]) === 1) pageImageBlocks.delete(p);
4035
+ if (_optionalChain([pageImageBlocks, 'access', _430 => _430.get, 'call', _431 => _431(p), 'optionalAccess', _432 => _432.length]) === 1) pageImageBlocks.delete(p);
3874
4036
  }
3875
4037
  if (replacePages.size) {
3876
4038
  const merged = blocks.filter((b) => !(b.pageNumber && replacePages.has(b.pageNumber)));
@@ -3920,18 +4082,18 @@ async function parsePdfDocument(buffer, options) {
3920
4082
  warnings.push({ page, message: `${count}\uAC1C \uC774\uBBF8\uC9C0 \uC601\uC5ED\uC5D0 \uCD94\uCD9C \uAC00\uB2A5\uD55C \uD14D\uC2A4\uD2B8 \uC5C6\uC74C (\uADF8\uB9BC/\uCC28\uD2B8/\uB3C4\uC7A5 \uB0B4\uC6A9 \uB204\uB77D \uAC00\uB2A5 \u2014 \uADF8\uB9BC \uC18D \uAE00\uC740 ocr: true / CLI --ocr \uB85C \uC77D\uC2B5\uB2C8\uB2E4)`, code: "SKIPPED_IMAGE" });
3921
4083
  }
3922
4084
  }
3923
- if (_optionalChain([options, 'optionalAccess', _370 => _370.removeHeaderFooter]) !== false && (parsedPageCount >= 3 || headerContext.length)) {
3924
- const removed = _chunkNLGOMLGUcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, false, headerContext);
3925
- const running = _chunkNLGOMLGUcjs.runningLinePatterns.call(void 0, removed.map((ri) => blocks[ri]), pageHeights);
4085
+ if (_optionalChain([options, 'optionalAccess', _433 => _433.removeHeaderFooter]) !== false && (parsedPageCount >= 3 || headerContext.length)) {
4086
+ const removed = _chunkC6B5GWN7cjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, false, headerContext);
4087
+ const running = _chunkC6B5GWN7cjs.runningLinePatterns.call(void 0, removed.map((ri) => blocks[ri]), pageHeights);
3926
4088
  for (let ri = removed.length - 1; ri >= 0; ri--) {
3927
4089
  blocks.splice(removed[ri], 1);
3928
4090
  }
3929
- const stripped = _chunkNLGOMLGUcjs.stripAbsorbedRunningLines.call(void 0, blocks, pageHeights, running);
4091
+ const stripped = _chunkC6B5GWN7cjs.stripAbsorbedRunningLines.call(void 0, blocks, pageHeights, running);
3930
4092
  if (stripped !== blocks) {
3931
4093
  blocks.length = 0;
3932
4094
  blocks.push(...stripped);
3933
4095
  }
3934
- const kept = _chunkNLGOMLGUcjs.removeSideTabs.call(void 0, blocks, pageWidths);
4096
+ const kept = _chunkC6B5GWN7cjs.removeSideTabs.call(void 0, blocks, pageWidths);
3935
4097
  if (kept !== blocks) {
3936
4098
  blocks.length = 0;
3937
4099
  blocks.push(...kept);
@@ -3939,15 +4101,15 @@ async function parsePdfDocument(buffer, options) {
3939
4101
  }
3940
4102
  mergeContinuedCells(blocks, pageHeights);
3941
4103
  mergeCrossPageTables(blocks, pageHeights, wrapLexicon);
3942
- if (_optionalChain([options, 'optionalAccess', _371 => _371.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
3943
- const boxes = _chunkNLGOMLGUcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
4104
+ if (_optionalChain([options, 'optionalAccess', _434 => _434.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
4105
+ const boxes = _chunkC6B5GWN7cjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
3944
4106
  for (let ri = boxes.length - 1; ri >= 0; ri--) blocks.splice(boxes[ri], 1);
3945
4107
  }
3946
4108
  splitContactTables(blocks);
3947
- if (!_optionalChain([options, 'optionalAccess', _372 => _372.keepTrailingEmptyCols])) _chunkNLGOMLGUcjs.trimTrailingEmptyTableCols.call(void 0, blocks);
3948
- _chunkNLGOMLGUcjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
4109
+ if (!_optionalChain([options, 'optionalAccess', _435 => _435.keepTrailingEmptyCols])) _chunkC6B5GWN7cjs.trimTrailingEmptyTableCols.call(void 0, blocks);
4110
+ _chunkC6B5GWN7cjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
3949
4111
  injectPageImageBlocks(blocks, pageImageBlocks);
3950
- if (_optionalChain([options, 'optionalAccess', _373 => _373.formulaOcr]) && formulaBuffer) {
4112
+ if (_optionalChain([options, 'optionalAccess', _436 => _436.formulaOcr]) && formulaBuffer) {
3951
4113
  try {
3952
4114
  await applyFormulaOcr(formulaBuffer, blocks, pageFilter, effectivePageCount, warnings, options.onProgress);
3953
4115
  } catch (e) {
@@ -3957,54 +4119,54 @@ async function parsePdfDocument(buffer, options) {
3957
4119
  });
3958
4120
  }
3959
4121
  }
3960
- const medianFontSize = _chunkNLGOMLGUcjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
4122
+ const medianFontSize = _chunkC6B5GWN7cjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
3961
4123
  if (medianFontSize > 0) {
3962
- _chunkNLGOMLGUcjs.detectHeadings.call(void 0, blocks, medianFontSize);
3963
- }
3964
- _chunkNLGOMLGUcjs.detectDocumentStyleHeadings.call(void 0, blocks);
3965
- _chunkNLGOMLGUcjs.detectTypographyHeadings.call(void 0, blocks);
3966
- _chunkNLGOMLGUcjs.detectSiblingStyleHeadings.call(void 0, blocks);
3967
- _chunkNLGOMLGUcjs.detectRepeatedPageLabels.call(void 0, blocks);
3968
- _chunkNLGOMLGUcjs.detectPageLeadHeadings.call(void 0, blocks);
3969
- _chunkNLGOMLGUcjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
3970
- _chunkNLGOMLGUcjs.refineDocumentStyleHeadings.call(void 0, blocks);
3971
- _chunkNLGOMLGUcjs.detectMarkerHeadings.call(void 0, blocks);
4124
+ _chunkC6B5GWN7cjs.detectHeadings.call(void 0, blocks, medianFontSize);
4125
+ }
4126
+ _chunkC6B5GWN7cjs.detectDocumentStyleHeadings.call(void 0, blocks);
4127
+ _chunkC6B5GWN7cjs.detectTypographyHeadings.call(void 0, blocks);
4128
+ _chunkC6B5GWN7cjs.detectSiblingStyleHeadings.call(void 0, blocks);
4129
+ _chunkC6B5GWN7cjs.detectRepeatedPageLabels.call(void 0, blocks);
4130
+ _chunkC6B5GWN7cjs.detectPageLeadHeadings.call(void 0, blocks);
4131
+ _chunkC6B5GWN7cjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
4132
+ _chunkC6B5GWN7cjs.refineDocumentStyleHeadings.call(void 0, blocks);
4133
+ _chunkC6B5GWN7cjs.detectMarkerHeadings.call(void 0, blocks);
3972
4134
  demoteNonHeadingRoles(blocks, pageHeights, faceNames);
3973
- _chunkNLGOMLGUcjs.detectTableCaptions.call(void 0, blocks);
3974
- _chunkNLGOMLGUcjs.detectKoreanListBlocks.call(void 0, blocks);
4135
+ _chunkC6B5GWN7cjs.detectTableCaptions.call(void 0, blocks);
4136
+ _chunkC6B5GWN7cjs.detectKoreanListBlocks.call(void 0, blocks);
3975
4137
  sanitizeBlockControlChars(blocks);
3976
4138
  let outBlocks = splitSingleCellTables(blocks);
3977
- if (_optionalChain([options, 'optionalAccess', _374 => _374.layoutTables]) !== "keep") {
4139
+ if (_optionalChain([options, 'optionalAccess', _437 => _437.layoutTables]) !== "keep") {
3978
4140
  blocks.length = 0;
3979
4141
  for (const block of outBlocks) blocks.push(block);
3980
4142
  }
3981
4143
  outBlocks = inlineFootnotes(outBlocks, noteMarks);
3982
4144
  outBlocks = relocateEndnotes(outBlocks);
3983
- if (_optionalChain([options, 'optionalAccess', _375 => _375.removeHeaderFooter]) !== false) outBlocks = outBlocks.filter((b) => {
4145
+ if (_optionalChain([options, 'optionalAccess', _438 => _438.removeHeaderFooter]) !== false) outBlocks = outBlocks.filter((b) => {
3984
4146
  if (b.type !== "paragraph" || !/^\s*\d{1,4}\s*$/.test(_nullishCoalesce(b.text, () => ( "")))) return true;
3985
4147
  const h = pageHeights.get(_nullishCoalesce(b.pageNumber, () => ( 0)));
3986
4148
  if (!b.bbox || !h) return false;
3987
4149
  return b.bbox.y > h * 0.1 && b.bbox.y + b.bbox.height < h * 0.9;
3988
4150
  });
3989
4151
  joinLatinCellWraps(outBlocks);
3990
- if (_optionalChain([options, 'optionalAccess', _376 => _376.layoutTables]) !== "keep") {
4152
+ if (_optionalChain([options, 'optionalAccess', _439 => _439.layoutTables]) !== "keep") {
3991
4153
  const hancom = await isHancomPdf(doc);
3992
4154
  const shown = /* @__PURE__ */ new Map();
3993
4155
  const markContent = (bs) => {
3994
4156
  for (const b of _nullishCoalesce(bs, () => ( []))) if (b.table) for (const row of b.table.cells) for (const c of row) {
3995
- if (_chunkNLGOMLGUcjs.IMAGE_CELLS.has(c)) _chunkSJ5OZXELcjs.CONTENT_CELLS.add(c);
3996
- const lines = _chunkNLGOMLGUcjs.CELL_LINES.get(c);
3997
- if (lines) _chunkSJ5OZXELcjs.CELL_BASELINES.set(c, lines.map((l) => l.y));
4157
+ if (_chunkC6B5GWN7cjs.IMAGE_CELLS.has(c)) _chunkYG4GFQB7cjs.CONTENT_CELLS.add(c);
4158
+ const lines = _chunkC6B5GWN7cjs.CELL_LINES.get(c);
4159
+ if (lines) _chunkYG4GFQB7cjs.CELL_BASELINES.set(c, lines.map((l) => l.y));
3998
4160
  markContent(c.blocks);
3999
4161
  }
4000
4162
  };
4001
4163
  const visual = (bs) => bs.flatMap((b) => {
4002
4164
  if (b.type !== "table") return [b];
4003
- if (!hancom && b.table && _chunkNLGOMLGUcjs.CLIP_TABLES.has(b.table)) return [b];
4165
+ if (!hancom && b.table && _chunkC6B5GWN7cjs.CLIP_TABLES.has(b.table)) return [b];
4004
4166
  let v = shown.get(b);
4005
4167
  if (!v) {
4006
4168
  markContent([b]);
4007
- shown.set(b, v = _chunkSJ5OZXELcjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _377 => _377.keepTrailingEmptyCols])));
4169
+ shown.set(b, v = _chunkYG4GFQB7cjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _440 => _440.keepTrailingEmptyCols])));
4008
4170
  }
4009
4171
  return v;
4010
4172
  });
@@ -4013,13 +4175,13 @@ async function parsePdfDocument(buffer, options) {
4013
4175
  blocks.length = 0;
4014
4176
  for (const b of kept) blocks.push(b);
4015
4177
  }
4016
- const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([options, 'optionalAccess', _378 => _378.tableFormat]) }), { keepLoneNumbers: true }));
4017
- if (_optionalChain([options, 'optionalAccess', _379 => _379.tableFormat]) === "gfm") _chunkSJ5OZXELcjs.assignTableIds.call(void 0, blocks);
4178
+ const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunkYG4GFQB7cjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([options, 'optionalAccess', _441 => _441.tableFormat]) }), { keepLoneNumbers: true }));
4179
+ if (_optionalChain([options, 'optionalAccess', _442 => _442.tableFormat]) === "gfm") _chunkYG4GFQB7cjs.assignTableIds.call(void 0, blocks);
4018
4180
  let markdown = finishMarkdown(outBlocks);
4019
4181
  const outline = collectPdfOutline(outBlocks);
4020
4182
  return {
4021
4183
  markdown,
4022
- pages: _chunk2BCQVQO2cjs.blocksToPages.call(void 0, splitPageTables(_chunkNLGOMLGUcjs.splitPageBreakWraps.call(void 0, outBlocks)), finishMarkdown),
4184
+ pages: _chunkN6KXGIINcjs.blocksToPages.call(void 0, splitPageTables(_chunkC6B5GWN7cjs.splitPageBreakWraps.call(void 0, outBlocks)), finishMarkdown),
4023
4185
  blocks,
4024
4186
  metadata,
4025
4187
  outline: outline.length > 0 ? outline : void 0,
@@ -4028,7 +4190,7 @@ async function parsePdfDocument(buffer, options) {
4028
4190
  pageQuality,
4029
4191
  qualitySummary: summarizeDocumentQuality(pageQuality),
4030
4192
  images: extractedImages.length > 0 ? extractedImages : void 0,
4031
- ..._optionalChain([options, 'optionalAccess', _380 => _380.ocrLines]) ? { ocrLines: [...ocrLinesOut.values()].sort((a, b) => a.pageNumber - b.pageNumber) } : {}
4193
+ ..._optionalChain([options, 'optionalAccess', _443 => _443.ocrLines]) ? { ocrLines: [...ocrLinesOut.values()].sort((a, b) => a.pageNumber - b.pageNumber) } : {}
4032
4194
  };
4033
4195
  } finally {
4034
4196
  await doc.destroy().catch(() => {
@@ -4038,7 +4200,7 @@ async function parsePdfDocument(buffer, options) {
4038
4200
  async function extractPdfMetadata(doc, metadata) {
4039
4201
  try {
4040
4202
  const result = await doc.getMetadata();
4041
- if (!_optionalChain([result, 'optionalAccess', _381 => _381.info])) return;
4203
+ if (!_optionalChain([result, 'optionalAccess', _444 => _444.info])) return;
4042
4204
  const info = result.info;
4043
4205
  if (typeof info.Title === "string" && info.Title.trim()) metadata.title = info.Title.trim();
4044
4206
  if (typeof info.Author === "string" && info.Author.trim()) metadata.author = info.Author.trim();
@@ -4054,8 +4216,8 @@ async function extractPdfMetadata(doc, metadata) {
4054
4216
  }
4055
4217
  async function isHancomPdf(doc) {
4056
4218
  try {
4057
- const info = await _asyncOptionalChain([(await doc.getMetadata()), 'optionalAccess', async _382 => _382.info]);
4058
- return [_optionalChain([info, 'optionalAccess', _383 => _383.Producer]), _optionalChain([info, 'optionalAccess', _384 => _384.Creator])].some((v) => typeof v === "string" && /^\s*(?:hancom\b|hwp\b)/i.test(v));
4219
+ const info = await _asyncOptionalChain([(await doc.getMetadata()), 'optionalAccess', async _445 => _445.info]);
4220
+ return [_optionalChain([info, 'optionalAccess', _446 => _446.Producer]), _optionalChain([info, 'optionalAccess', _447 => _447.Creator])].some((v) => typeof v === "string" && /^\s*(?:hancom\b|hwp\b)/i.test(v));
4059
4221
  } catch (e11) {
4060
4222
  return false;
4061
4223
  }
@@ -4099,5 +4261,5 @@ function marginStamp(items) {
4099
4261
 
4100
4262
 
4101
4263
 
4102
- exports.PDFJS_DOCUMENT_OPTIONS = PDFJS_DOCUMENT_OPTIONS; exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkNLGOMLGUcjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkNLGOMLGUcjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkNLGOMLGUcjs.removeHeaderFooterBlocks;
4103
- //# sourceMappingURL=parser-OAXCXVQ4.cjs.map
4264
+ exports.PDFJS_DOCUMENT_OPTIONS = PDFJS_DOCUMENT_OPTIONS; exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkC6B5GWN7cjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkC6B5GWN7cjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkC6B5GWN7cjs.removeHeaderFooterBlocks;
4265
+ //# sourceMappingURL=parser-WNDH2X6N.cjs.map