kordoc 4.22.4 → 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 +8 -7
  2. package/dist/{-HAK3YFWW.js → -WFRWBH7T.js} +11 -11
  3. package/dist/{chunk-F3AWNFMO.js → chunk-2L3Q7REU.js} +3 -3
  4. package/dist/{chunk-CWBH66IQ.js → chunk-35ZHXEJA.js} +3 -3
  5. package/dist/{chunk-Q6SVCBMK.js → chunk-3BR7VKWL.js} +2 -2
  6. package/dist/{chunk-G2325K2F.js → chunk-3G3TLZDK.js} +2 -2
  7. package/dist/{chunk-36DK6AOX.js → chunk-3YEL7P4L.js} +2 -2
  8. package/dist/{chunk-S45M7IQH.cjs → chunk-4SUB43EJ.cjs} +24 -24
  9. package/dist/{chunk-S45M7IQH.cjs.map → chunk-4SUB43EJ.cjs.map} +1 -1
  10. package/dist/{chunk-5ARHF54C.js → chunk-4TWN7PWJ.js} +2 -2
  11. package/dist/{chunk-WCTC3LSV.js → chunk-52HIK4C2.js} +4 -3
  12. package/dist/chunk-52HIK4C2.js.map +1 -0
  13. package/dist/{chunk-3TUJ34V7.js → chunk-63N6CEJE.js} +2 -2
  14. package/dist/{chunk-DEFT7Z3B.js → chunk-6MCC2XNB.js} +2 -2
  15. package/dist/{chunk-C5J5LDWM.js → chunk-6MQKNB6K.js} +4 -3
  16. package/dist/chunk-6MQKNB6K.js.map +1 -0
  17. package/dist/{chunk-MJSHXESK.cjs → chunk-AS25R4EU.cjs} +2 -2
  18. package/dist/{chunk-MJSHXESK.cjs.map → chunk-AS25R4EU.cjs.map} +1 -1
  19. package/dist/{chunk-AYV5VRHL.js → chunk-C3REGEQO.js} +2 -2
  20. package/dist/{chunk-4X7AR4EH.cjs → chunk-C6B5GWN7.cjs} +24 -23
  21. package/dist/chunk-C6B5GWN7.cjs.map +1 -0
  22. package/dist/{chunk-A3SKXHAN.js → chunk-CO7O3ZT6.js} +2 -2
  23. package/dist/{chunk-WNW77CAY.js → chunk-CRSTBATY.js} +2 -2
  24. package/dist/{chunk-MYTMZSQO.js → chunk-CW67DAAH.js} +2 -2
  25. package/dist/{chunk-RPSILMQY.js → chunk-DN55FTJP.js} +2 -2
  26. package/dist/{chunk-HN3QMHTT.js → chunk-HLPMC7L4.js} +5 -4
  27. package/dist/chunk-HLPMC7L4.js.map +1 -0
  28. package/dist/{chunk-LVVSMYG4.js → chunk-LE4VHWIT.js} +4 -4
  29. package/dist/{chunk-VXQWAPC6.cjs → chunk-N6KXGIIN.cjs} +3 -3
  30. package/dist/{chunk-VXQWAPC6.cjs.map → chunk-N6KXGIIN.cjs.map} +1 -1
  31. package/dist/{chunk-G4KNI7EO.js → chunk-PSORL4PA.js} +11 -11
  32. package/dist/{chunk-FAFSBCU2.js → chunk-RYKDIUHT.js} +4 -4
  33. package/dist/{chunk-SSL3TKJY.js → chunk-SETAYS6P.js} +2 -2
  34. package/dist/{chunk-Q65HT2BL.js → chunk-T7OZ7X6A.js} +2 -2
  35. package/dist/{chunk-UJVVL6BI.js → chunk-TOUJCO2P.js} +2 -2
  36. package/dist/{chunk-EVL6HZQL.js → chunk-U3GUZQ54.js} +1286 -1279
  37. package/dist/chunk-U3GUZQ54.js.map +1 -0
  38. package/dist/{chunk-EYQLJ57Y.cjs → chunk-UCK6WGHY.cjs} +3 -3
  39. package/dist/{chunk-EYQLJ57Y.cjs.map → chunk-UCK6WGHY.cjs.map} +1 -1
  40. package/dist/{chunk-K2NWHLCD.cjs → chunk-YG4GFQB7.cjs} +6 -6
  41. package/dist/{chunk-K2NWHLCD.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-PWAUR5PF.js → formula-FSVHUQ6Y.js} +4 -4
  45. package/dist/{formula-KSTY73DQ.js → formula-L625ULJP.js} +3 -3
  46. package/dist/{formula-JGFYGFYX.cjs → formula-QZGTF3DZ.cjs} +9 -9
  47. package/dist/{formula-JGFYGFYX.cjs.map → formula-QZGTF3DZ.cjs.map} +1 -1
  48. package/dist/{image-ocr-UULNAC5Y.cjs → image-ocr-AELVAU75.cjs} +17 -17
  49. package/dist/{image-ocr-UULNAC5Y.cjs.map → image-ocr-AELVAU75.cjs.map} +1 -1
  50. package/dist/{image-ocr-RASJHOAK.js → image-ocr-KE3RUS3R.js} +6 -6
  51. package/dist/{image-ocr-RPBPO3VT.js → image-ocr-QTZNBP5V.js} +9 -9
  52. package/dist/index.cjs +790 -782
  53. package/dist/index.cjs.map +1 -1
  54. package/dist/index.js +249 -241
  55. package/dist/index.js.map +1 -1
  56. package/dist/mcp.js +22 -22
  57. package/dist/{model-bundle-ZPQ4IFT7.js → model-bundle-F6TU6ZAV.js} +5 -5
  58. package/dist/{models-YJQ5VHOR.js → models-ZHNNVH2W.js} +5 -5
  59. package/dist/{parse-worker-v2-7PNZYASF.js → parse-worker-v2-KQRG3NQO.js} +12 -12
  60. package/dist/{parser-ER3VLB37.js → parser-RVMH4PUB.js} +133 -20
  61. package/dist/parser-RVMH4PUB.js.map +1 -0
  62. package/dist/{parser-DR6ZHYEB.js → parser-WBKVRDPV.js} +129 -16
  63. package/dist/parser-WBKVRDPV.js.map +1 -0
  64. package/dist/{parser-ZFXVZZKQ.cjs → parser-WNDH2X6N.cjs} +397 -284
  65. package/dist/parser-WNDH2X6N.cjs.map +1 -0
  66. package/dist/pdf-ocr-IOUZTPPH.cjs +31 -0
  67. package/dist/{pdf-ocr-QWTGWYQT.cjs.map → pdf-ocr-IOUZTPPH.cjs.map} +1 -1
  68. package/dist/{pdf-ocr-BYT7XVID.js → pdf-ocr-X5XLGL5J.js} +6 -6
  69. package/dist/{pdf-ocr-DRQN5BXA.js → pdf-ocr-ZP2CUWSO.js} +9 -9
  70. package/dist/{profile-io-3QYTSPNH.js → profile-io-B4VSI4LW.js} +3 -3
  71. package/dist/{rasterize-LPLWCBXV.js → rasterize-Y7NVUVXU.js} +3 -3
  72. package/dist/{redact-doc-HDA6ZG3N.js → redact-doc-GIBTFWCO.js} +11 -11
  73. package/dist/{render-MYZGD3SB.js → render-JVCGYRRO.js} +7 -7
  74. package/dist/seal-WNX2ZJTK.js +10 -0
  75. package/dist/{setup-EF5TQVAI.js → setup-7L7EQPMG.js} +3 -3
  76. package/dist/visual-VPWPXIHN.js +21 -0
  77. package/dist/{watch-PM5PRSFW.js → watch-VYMFGX72.js} +12 -12
  78. package/package.json +1 -1
  79. package/dist/chunk-4X7AR4EH.cjs.map +0 -1
  80. package/dist/chunk-C5J5LDWM.js.map +0 -1
  81. package/dist/chunk-EVL6HZQL.js.map +0 -1
  82. package/dist/chunk-HN3QMHTT.js.map +0 -1
  83. package/dist/chunk-WCTC3LSV.js.map +0 -1
  84. package/dist/chunks-3N7OFSA4.js +0 -10
  85. package/dist/parser-DR6ZHYEB.js.map +0 -1
  86. package/dist/parser-ER3VLB37.js.map +0 -1
  87. package/dist/parser-ZFXVZZKQ.cjs.map +0 -1
  88. package/dist/pdf-ocr-QWTGWYQT.cjs +0 -31
  89. package/dist/seal-XA5V6A6V.js +0 -10
  90. package/dist/visual-DB7NJOID.js +0 -21
  91. /package/dist/{-HAK3YFWW.js.map → -WFRWBH7T.js.map} +0 -0
  92. /package/dist/{chunk-F3AWNFMO.js.map → chunk-2L3Q7REU.js.map} +0 -0
  93. /package/dist/{chunk-CWBH66IQ.js.map → chunk-35ZHXEJA.js.map} +0 -0
  94. /package/dist/{chunk-Q6SVCBMK.js.map → chunk-3BR7VKWL.js.map} +0 -0
  95. /package/dist/{chunk-G2325K2F.js.map → chunk-3G3TLZDK.js.map} +0 -0
  96. /package/dist/{chunk-36DK6AOX.js.map → chunk-3YEL7P4L.js.map} +0 -0
  97. /package/dist/{chunk-5ARHF54C.js.map → chunk-4TWN7PWJ.js.map} +0 -0
  98. /package/dist/{chunk-3TUJ34V7.js.map → chunk-63N6CEJE.js.map} +0 -0
  99. /package/dist/{chunk-DEFT7Z3B.js.map → chunk-6MCC2XNB.js.map} +0 -0
  100. /package/dist/{chunk-AYV5VRHL.js.map → chunk-C3REGEQO.js.map} +0 -0
  101. /package/dist/{chunk-A3SKXHAN.js.map → chunk-CO7O3ZT6.js.map} +0 -0
  102. /package/dist/{chunk-WNW77CAY.js.map → chunk-CRSTBATY.js.map} +0 -0
  103. /package/dist/{chunk-MYTMZSQO.js.map → chunk-CW67DAAH.js.map} +0 -0
  104. /package/dist/{chunk-RPSILMQY.js.map → chunk-DN55FTJP.js.map} +0 -0
  105. /package/dist/{chunk-LVVSMYG4.js.map → chunk-LE4VHWIT.js.map} +0 -0
  106. /package/dist/{chunk-G4KNI7EO.js.map → chunk-PSORL4PA.js.map} +0 -0
  107. /package/dist/{chunk-FAFSBCU2.js.map → chunk-RYKDIUHT.js.map} +0 -0
  108. /package/dist/{chunk-SSL3TKJY.js.map → chunk-SETAYS6P.js.map} +0 -0
  109. /package/dist/{chunk-Q65HT2BL.js.map → chunk-T7OZ7X6A.js.map} +0 -0
  110. /package/dist/{chunk-UJVVL6BI.js.map → chunk-TOUJCO2P.js.map} +0 -0
  111. /package/dist/{chunks-3N7OFSA4.js.map → chunks-NXABWR6G.js.map} +0 -0
  112. /package/dist/{formula-PWAUR5PF.js.map → formula-FSVHUQ6Y.js.map} +0 -0
  113. /package/dist/{formula-KSTY73DQ.js.map → formula-L625ULJP.js.map} +0 -0
  114. /package/dist/{image-ocr-RASJHOAK.js.map → image-ocr-KE3RUS3R.js.map} +0 -0
  115. /package/dist/{image-ocr-RPBPO3VT.js.map → image-ocr-QTZNBP5V.js.map} +0 -0
  116. /package/dist/{model-bundle-ZPQ4IFT7.js.map → model-bundle-F6TU6ZAV.js.map} +0 -0
  117. /package/dist/{models-YJQ5VHOR.js.map → models-ZHNNVH2W.js.map} +0 -0
  118. /package/dist/{parse-worker-v2-7PNZYASF.js.map → parse-worker-v2-KQRG3NQO.js.map} +0 -0
  119. /package/dist/{pdf-ocr-BYT7XVID.js.map → pdf-ocr-X5XLGL5J.js.map} +0 -0
  120. /package/dist/{pdf-ocr-DRQN5BXA.js.map → pdf-ocr-ZP2CUWSO.js.map} +0 -0
  121. /package/dist/{profile-io-3QYTSPNH.js.map → profile-io-B4VSI4LW.js.map} +0 -0
  122. /package/dist/{rasterize-LPLWCBXV.js.map → rasterize-Y7NVUVXU.js.map} +0 -0
  123. /package/dist/{redact-doc-HDA6ZG3N.js.map → redact-doc-GIBTFWCO.js.map} +0 -0
  124. /package/dist/{render-MYZGD3SB.js.map → render-JVCGYRRO.js.map} +0 -0
  125. /package/dist/{seal-XA5V6A6V.js.map → seal-WNX2ZJTK.js.map} +0 -0
  126. /package/dist/{setup-EF5TQVAI.js.map → setup-7L7EQPMG.js.map} +0 -0
  127. /package/dist/{visual-DB7NJOID.js.map → visual-VPWPXIHN.js.map} +0 -0
  128. /package/dist/{watch-PM5PRSFW.js.map → watch-VYMFGX72.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  blocksToPages,
3
3
  encodePng
4
- } from "./chunk-WNW77CAY.js";
4
+ } from "./chunk-CRSTBATY.js";
5
5
  import {
6
6
  hasRequestedPagesAfter,
7
7
  parsePageRange
@@ -61,7 +61,7 @@ import {
61
61
  stripAbsorbedRunningLines,
62
62
  trimTrailingEmptyTableCols,
63
63
  wrapJoiner
64
- } from "./chunk-HN3QMHTT.js";
64
+ } from "./chunk-HLPMC7L4.js";
65
65
  import {
66
66
  CELL_BASELINES,
67
67
  CELL_EDGES,
@@ -72,15 +72,16 @@ import {
72
72
  blocksToMarkdown,
73
73
  escapeLiteralDollar,
74
74
  escapeLiteralTags,
75
+ mapPuaText,
75
76
  stripScriptTags,
76
77
  unframeLayoutTables,
77
78
  validateOcrOptions
78
- } from "./chunk-UJVVL6BI.js";
79
- import "./chunk-SSL3TKJY.js";
79
+ } from "./chunk-TOUJCO2P.js";
80
+ import "./chunk-SETAYS6P.js";
80
81
  import {
81
82
  KordocError,
82
83
  sanitizeHref
83
- } from "./chunk-Q65HT2BL.js";
84
+ } from "./chunk-T7OZ7X6A.js";
84
85
 
85
86
  // src/pdf/image-extract.ts
86
87
  import { createHash } from "crypto";
@@ -623,6 +624,68 @@ var alignedLabels = (label, value, count) => {
623
624
  return next++ < V.length;
624
625
  });
625
626
  };
627
+ function partialAlignedLabelCells(table, owner, first) {
628
+ const pageOf = (a) => CELL_PAGES.get(a.cell ?? table.cells[a.r][a.c]) ?? (a.r < first ? -1 : -2);
629
+ const pairs = [];
630
+ let carried = false;
631
+ for (let c = 0; c < table.cols; ) {
632
+ const u = owner[first - 1]?.[c], d = owner[first]?.[c];
633
+ if (u && u === d) {
634
+ carried = true;
635
+ c = u.c + u.cs;
636
+ continue;
637
+ }
638
+ const upper = u ? table.cells[u.r][u.c] : void 0, lower = d ? table.cells[d.r][d.c] : void 0;
639
+ if (!upper?.text.trim() && !lower?.text.trim()) {
640
+ c++;
641
+ continue;
642
+ }
643
+ 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;
644
+ pairs.push({ c, cs: u.cs, upper, lower });
645
+ c += u.cs;
646
+ }
647
+ if (!carried || pairs.length !== 3) return;
648
+ const keyed = pairs.filter((p) => labelsOf(p.upper) && labelsOf(p.lower));
649
+ if (keyed.length !== 1) return;
650
+ const label = keyed[0], value = pairs.find((p) => p.c === label.c + label.cs), context = pairs.find((p) => p.c + p.cs === label.c);
651
+ if (!value || !context || value === context || textOf(context.upper).replace(/\s+/g, "") === textOf(context.lower).replace(/\s+/g, "") || !CELL_EDGES.get(context.upper)?.b || !CELL_EDGES.get(context.lower)?.t) return;
652
+ const U = labelsOf(label.upper), D = labelsOf(label.lower), sequence = [...U, ...D];
653
+ if (D.length < 2 || sequence.length < 3 || new Set(sequence).size !== sequence.length || !alignedLabels(label.upper, value.upper, U.length)) return;
654
+ const L = CELL_LINES.get(label.lower), V = CELL_LINES.get(value.lower);
655
+ if (!L || !V || L.length !== D.length) return;
656
+ let next = V.findIndex((v) => Math.abs(v.y - L[0].y) <= 1);
657
+ if (next <= 0 || !V.slice(0, next).every((v) => v.y > L[0].y + 1) || !L.every((l) => {
658
+ while (next < V.length && Math.abs(l.y - V[next].y) > 1) next++;
659
+ return next++ < V.length;
660
+ })) return;
661
+ let peers = 0, shared = false;
662
+ for (let r = 0; r < table.rows; r++) {
663
+ if (r === first - 1 || r === first) continue;
664
+ const l = owner[r]?.[label.c], v = owner[r]?.[value.c];
665
+ 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;
666
+ const lc = table.cells[r][l.c], vc = table.cells[r][v.c];
667
+ const list = labelsOf(lc);
668
+ if (!plain(lc) || !plain(vc) || !textOf(vc) || !list || pageOf(l) !== pageOf(v)) continue;
669
+ if (l.rs === 1) {
670
+ if (list.join("|") === sequence.join("|") && alignedLabels(lc, vc, list.length)) peers++;
671
+ continue;
672
+ }
673
+ if (list.length < 3 || new Set(list).size !== list.length) continue;
674
+ const visible = CELL_LINES.get(lc)?.length ?? 0, values = CELL_LINES.get(vc);
675
+ if (visible < 3 || visible > list.length || !values || !alignedLabels(lc, vc, visible)) continue;
676
+ const top = Math.max(...values.map((v2) => v2.y)), bottom = Math.min(...values.map((v2) => v2.y));
677
+ const contexts = [];
678
+ for (let rr = r; rr < r + l.rs && rr < table.rows; rr++) {
679
+ const a = owner[rr]?.[context.c], cell = a ? table.cells[a.r][a.c] : void 0;
680
+ 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;
681
+ const lines = CELL_LINES.get(cell);
682
+ if (!lines?.length || lines.some((line) => line.y > top + 1 || line.y < bottom - 1)) break;
683
+ contexts.push(textOf(cell).replace(/\s+/g, ""));
684
+ }
685
+ if (new Set(contexts).size >= 2) shared = true;
686
+ }
687
+ return peers >= 2 && shared ? { context, label, value } : void 0;
688
+ }
626
689
  function matchesCompleteAlignedLabelListRow(table, owner, first) {
627
690
  const pairs = [];
628
691
  let carried = false;
@@ -952,6 +1015,17 @@ function markJoinedPages(table, prev, curr) {
952
1015
  }
953
1016
  });
954
1017
  const cr = pt.rows - 1 - off, page = cp[cr];
1018
+ if (cr === -1 && table.cols === pt.cols && pt.cols === ct.cols) {
1019
+ const tailPage = cp[0];
1020
+ if (tailPage === void 0 || tailPage === prev.pageNumber) return;
1021
+ for (let r = 0; r < pt.rows; r++) for (const { cell, c } of rows[r]) {
1022
+ const head = ptRows[r]?.find((s) => s.c === c)?.cell, tail = ctRows[0]?.find((s) => s.c === c)?.cell;
1023
+ if (!head?.text.trim() || !tail?.text.trim() || cell.blocks?.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;
1024
+ const from = head.text.trimEnd().length, at = cell.text.indexOf(tail.text.trim().slice(0, 20), from);
1025
+ if (at >= from) setSplits(cell, [...relocate(head, cell), { at, page: tailPage }, ...relocate(tail, cell, at)]);
1026
+ }
1027
+ return;
1028
+ }
955
1029
  if (cr < 0 || page === void 0 || page === prev.pageNumber) return;
956
1030
  const tails = ctRows[cr].filter((s) => s.cell.text.trim());
957
1031
  for (const { cell } of ctRows[cr]) for (const b of cell.blocks ?? []) b.pageNumber ??= page;
@@ -1002,6 +1076,17 @@ function splitCrossPageRows(t, pageNumber) {
1002
1076
  };
1003
1077
  const e = Math.max(...splits.map((s) => r + s.cell.rowSpan - 1));
1004
1078
  const cells = t.cells.map((row2) => row2.slice());
1079
+ const cut = pages.findIndex((p, rr) => rr > r && p !== pages[r]);
1080
+ if (cut > r && splits.every((s) => cut < r + s.cell.rowSpan && pages[cut] === s.split.page)) {
1081
+ for (const { cell, c, split } of splits) {
1082
+ cells[r][c] = clone(cell, { ...split.head, rowSpan: cut - r });
1083
+ const tail = { ...cell, ...split.tail, rowSpan: r + cell.rowSpan - cut };
1084
+ CELL_PAGES.set(tail, split.page);
1085
+ setSplits(tail, split.rest);
1086
+ cells[cut][c] = tail;
1087
+ }
1088
+ return splitCrossPageRows({ ...t, cells }, pageNumber);
1089
+ }
1005
1090
  const row = Array.from({ length: t.cols }, () => ({ text: "", colSpan: 1, rowSpan: 1 }));
1006
1091
  for (const { cell, c, split } of splits) {
1007
1092
  cells[r][c] = clone(cell, split.head);
@@ -1179,15 +1264,18 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
1179
1264
  ruled: !!pr && !!cr && pr.bottom && cr.top,
1180
1265
  list: !shifted ? "any" : skip > 0 && ca.filter((a) => a.r < skip && a.cell.text.trim()).length < 2 ? "none" : "multi"
1181
1266
  };
1182
- let split = rows > prev.rows && mergeSplitRow(table, owner, prev.rows, U, false, cut);
1183
- 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 });
1267
+ let partial = !skip && cols === prev.cols && cols === curr.cols && cut.ruled && prevBottom !== void 0 ? partialAlignedLabelCells(table, owner, first) : void 0;
1268
+ 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]) || startsNewItem(partial.value.upper.text, partial.value.lower.text))) partial = void 0;
1269
+ const selected = partial ? /* @__PURE__ */ new Set([partial.label.c, partial.value.c]) : void 0;
1270
+ let split = !selected && rows > prev.rows && mergeSplitRow(table, owner, prev.rows, U, false, cut);
1271
+ 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 });
1184
1272
  if (pr && cr) {
1185
1273
  const cutRuled = pr.bottom || cr.top;
1186
1274
  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) });
1187
1275
  }
1188
1276
  return { table, colXs: U, split, header: ca.filter((a) => a.r < skip && a.cell.text.trim()).length >= 2 };
1189
1277
  }
1190
- function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs) {
1278
+ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs, selected) {
1191
1279
  const last = first - 1;
1192
1280
  const straddles = owner[first].some((o, c) => o !== null && o === owner[last][c]);
1193
1281
  let firstNew = table.cols;
@@ -1244,6 +1332,7 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs) {
1244
1332
  c = u.c + u.cs;
1245
1333
  if (!d || d === u || u.r + u.rs - 1 !== last || d.r !== first || d.c !== u.c || d.cs !== u.cs) continue;
1246
1334
  const a = table.cells[u.r][u.c], b = table.cells[first][d.c];
1335
+ if (selected && !selected.has(u.c)) continue;
1247
1336
  const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !startsNewItem(a.text, b.text) && continuesAcross(a, b, colXs[u.c], colXs[u.c + u.cs]);
1248
1337
  const openSeam = hasContent(a) && hasContent(b) && hasOpenCellSeam(a, b) && !owner.some((row, r) => {
1249
1338
  if (!r || r === first) return false;
@@ -1252,7 +1341,7 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs) {
1252
1341
  const ue = CELL_EDGES.get(table.cells[up.r][up.c]), de = CELL_EDGES.get(table.cells[down.r][down.c]);
1253
1342
  return !!ue && !!de && !ue.b && !de.t;
1254
1343
  });
1255
- if (!openSeam && !flowsOn && !crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
1344
+ if (!selected && !openSeam && !flowsOn && !crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
1256
1345
  if (!straddles && !midWord) continue;
1257
1346
  if (u.r >= last && d.rs < 2) continue;
1258
1347
  const U = CELL_LINES.get(a);
@@ -1892,6 +1981,30 @@ function fillNestedContinuation(blocks, at) {
1892
1981
 
1893
1982
  // src/pdf/symbol-glyphs.ts
1894
1983
  import { OPS as OPS3 } from "pdfjs-dist/legacy/build/pdf.mjs";
1984
+
1985
+ // src/pdf/known-font-glyphs.ts
1986
+ import { createHash as createHash2 } from "crypto";
1987
+ var HCR_DOT = "bb7a2a3ab48d5bfdfd9582c0fb6525401c3a7f1851bb1c1bdb45048be95d1599";
1988
+ var BATANG_NUMBERS = [
1989
+ "8a4af2cf2dfe3238b4e2b35af976746216ade6e89cd3c55ec1e43bca532379b9",
1990
+ "7332dcab9d77002bdb92723a7fa4afa963ad01601f6328fbedd7289798fb77d0",
1991
+ "e7cc725807eae1ae0311898429629931f5924ade91a876c899b0c5bd109b325b",
1992
+ "3956a9db6baa74ef40ff93291ef5c42245cd4b36d613e5c956e307f347705adb",
1993
+ "8340732dc5f6a75a6808e87749ae9e9e7d54f4299f86eabbfaedd95da10ad447",
1994
+ "1412a79bd9ed7fdb34a8f04c29e341230a3bef649fb7b44a58ea6a56da0f3e44"
1995
+ ];
1996
+ function knownFontGlyph(name, outline, width) {
1997
+ const face = name?.replace(/^[A-Z]{6}\+/, "");
1998
+ const dot = face === "HCRDotum" && width === 970 && outline.upm === 1e3;
1999
+ const number = (face === "Haansoft Batang" || face === "Haansoft-Batang") && width === 1e3 && outline.upm === 1024;
2000
+ if (!dot && !number) return null;
2001
+ const signature = createHash2("sha256").update(JSON.stringify([outline.upm, width, outline.contours])).digest("hex");
2002
+ if (dot) return signature === HCR_DOT ? mapPuaText(String.fromCodePoint(983791)) : null;
2003
+ const index = BATANG_NUMBERS.indexOf(signature);
2004
+ return index < 0 ? null : mapPuaText(String.fromCodePoint(983729 + index));
2005
+ }
2006
+
2007
+ // src/pdf/symbol-glyphs.ts
1895
2008
  var NO_UNICODE = "\uF000";
1896
2009
  var u16 = (b, o) => b[o] << 8 | b[o + 1];
1897
2010
  var i16 = (b, o) => {
@@ -2055,14 +2168,14 @@ function restoreUnmappedGlyphs(items, fnArray, argsArray, fontObj) {
2055
2168
  for (const g2 of args[0]) {
2056
2169
  const glyph = g2;
2057
2170
  if (!glyph || glyph.unicode !== NO_UNICODE || typeof glyph.fontChar !== "string") continue;
2058
- const key = font + "\0" + glyph.fontChar;
2171
+ const key = font + "\0" + glyph.fontChar + "\0" + typeof glyph.width + ":" + String(glyph.width);
2059
2172
  if (!cache.has(key)) {
2060
2173
  let sym = null;
2061
2174
  try {
2062
- const data = fontObj(font)?.data;
2175
+ const source = fontObj(font), data = source?.data;
2063
2176
  const code = glyph.fontChar.codePointAt(0);
2064
2177
  const outline = data && code !== void 0 ? readOutline(data, code) : null;
2065
- if (outline) sym = classifyOutline(outline);
2178
+ if (outline) sym = knownFontGlyph(source?.name, outline, glyph.width) ?? classifyOutline(outline);
2066
2179
  } catch {
2067
2180
  }
2068
2181
  cache.set(key, sym);
@@ -3472,7 +3585,7 @@ function mergeLinkRuns(markdown) {
3472
3585
 
3473
3586
  // src/pdf/formula-ocr.ts
3474
3587
  async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
3475
- const formulaMod = await import("./formula-KSTY73DQ.js");
3588
+ const formulaMod = await import("./formula-L625ULJP.js");
3476
3589
  const { FormulaPipeline, ensureFormulaModels } = formulaMod;
3477
3590
  await ensureFormulaModels((p) => {
3478
3591
  if (p.phase === "download" && p.total) {
@@ -3898,10 +4011,10 @@ async function parsePdfDocument(buffer, options) {
3898
4011
  }
3899
4012
  if (targets.size > 0) {
3900
4013
  try {
3901
- const { runPdfOcr } = await import("./pdf-ocr-BYT7XVID.js");
4014
+ const { runPdfOcr } = await import("./pdf-ocr-X5XLGL5J.js");
3902
4015
  const mode = typeof options?.ocr === "function" ? options.ocr : "builtin";
3903
4016
  const regionPages = new Map([...ocrRegions].filter(([p]) => options?.ocr !== "force" && !isImageBased && !pageQuality.find((q) => q.page === p)?.needsOcr));
3904
- const { builtinOcrConfig } = await import("./pdf-ocr-BYT7XVID.js");
4017
+ const { builtinOcrConfig } = await import("./pdf-ocr-X5XLGL5J.js");
3905
4018
  const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options?.onProgress, options?.tables !== false, vectorPageOps, regionPages, builtinOcrConfig(options), ocrLinesOut);
3906
4019
  for (const obs of ocrPageBlocks.values()) stripScriptTags({ blocks: obs });
3907
4020
  if (ocrPageBlocks.size > 0) {
@@ -4146,4 +4259,4 @@ export {
4146
4259
  parsePdfDocument,
4147
4260
  removeHeaderFooterBlocks
4148
4261
  };
4149
- //# sourceMappingURL=parser-DR6ZHYEB.js.map
4262
+ //# sourceMappingURL=parser-WBKVRDPV.js.map