kordoc 4.21.12 → 4.21.13

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 (124) hide show
  1. package/README.md +19 -4
  2. package/dist/{-RX7XZ3YG.js → -4UPN43UD.js} +11 -11
  3. package/dist/{chunk-73GNY7ZX.js → chunk-3YD3SAQW.js} +3 -3
  4. package/dist/{chunk-JILWW4LO.cjs → chunk-57EOUEB4.cjs} +13 -13
  5. package/dist/{chunk-JILWW4LO.cjs.map → chunk-57EOUEB4.cjs.map} +1 -1
  6. package/dist/{chunk-GTNCTRNQ.js → chunk-6EB77P5L.js} +2 -2
  7. package/dist/{chunk-OOTAJZXG.js → chunk-B7CZZBKZ.js} +2 -2
  8. package/dist/{chunk-UB55GFHD.js → chunk-C7OK4MBX.js} +3 -3
  9. package/dist/{chunk-7BHPPEWK.js → chunk-DAR2TMBL.js} +10 -10
  10. package/dist/{chunk-4OQ3JGNI.js → chunk-DI7WHDXG.js} +2 -2
  11. package/dist/{chunk-ZUFZNZHO.cjs → chunk-DU2HC36X.cjs} +22 -22
  12. package/dist/{chunk-ZUFZNZHO.cjs.map → chunk-DU2HC36X.cjs.map} +1 -1
  13. package/dist/{chunk-UJARPT2G.js → chunk-FFBZG5MK.js} +2 -2
  14. package/dist/{chunk-2SOILEGV.js → chunk-FW7QWLBL.js} +3 -3
  15. package/dist/{chunk-FM33S6NN.js → chunk-HCCQTNDS.js} +2 -2
  16. package/dist/{chunk-D37FRGQT.js → chunk-HIUHLJQD.js} +2 -2
  17. package/dist/{chunk-XER4EWKZ.cjs → chunk-IS2EXA5D.cjs} +6 -6
  18. package/dist/{chunk-XER4EWKZ.cjs.map → chunk-IS2EXA5D.cjs.map} +1 -1
  19. package/dist/{chunk-SBHOOTMT.js → chunk-JGAY3BHY.js} +3 -3
  20. package/dist/{chunk-R6MRWKSL.js → chunk-JQBUWC6W.js} +2 -2
  21. package/dist/{chunk-YGQBX5D3.js → chunk-K23A2CP7.js} +2 -2
  22. package/dist/{chunk-IUHBMZT2.cjs → chunk-LOO3UV25.cjs} +3 -3
  23. package/dist/{chunk-IUHBMZT2.cjs.map → chunk-LOO3UV25.cjs.map} +1 -1
  24. package/dist/{chunk-4BGPR423.js → chunk-LXYM2EST.js} +2 -2
  25. package/dist/{chunk-AQBOKFSW.js → chunk-N4UL5NEO.js} +4 -4
  26. package/dist/{chunk-A6CQXV52.js → chunk-NX5A22B6.js} +2 -2
  27. package/dist/{chunk-QVMQ2NDS.js → chunk-QOIZF57S.js} +2 -2
  28. package/dist/{chunk-4QVMW26U.js → chunk-RMMMNE2V.js} +4 -4
  29. package/dist/{chunk-4PNWGIFX.js → chunk-UAEY6VPV.js} +6 -6
  30. package/dist/{chunk-5JNM2FTX.cjs → chunk-V7LTELVS.cjs} +3 -3
  31. package/dist/{chunk-5JNM2FTX.cjs.map → chunk-V7LTELVS.cjs.map} +1 -1
  32. package/dist/{chunk-OAU5DO2L.js → chunk-VC2SS3OH.js} +2 -2
  33. package/dist/{chunk-Y27V3EBB.js → chunk-VXNR2JYB.js} +2 -2
  34. package/dist/{chunk-W5EQNSO6.cjs → chunk-WPZOIIM2.cjs} +2 -2
  35. package/dist/{chunk-W5EQNSO6.cjs.map → chunk-WPZOIIM2.cjs.map} +1 -1
  36. package/dist/{chunk-W5MRFI5K.js → chunk-YJ4J6EG5.js} +2 -2
  37. package/dist/{chunk-PBNL6TOS.js → chunk-YM4AEOS4.js} +2 -2
  38. package/dist/chunks-A67IJS56.js +10 -0
  39. package/dist/cli.js +30 -30
  40. package/dist/{formula-E3BHMBU7.cjs → formula-BCWYXJPE.cjs} +9 -9
  41. package/dist/{formula-E3BHMBU7.cjs.map → formula-BCWYXJPE.cjs.map} +1 -1
  42. package/dist/{formula-AT252TKF.js → formula-N4TZPWWU.js} +4 -4
  43. package/dist/{formula-VUABWUUV.js → formula-ZFB6JGOW.js} +3 -3
  44. package/dist/{image-ocr-JYUWUJVP.js → image-ocr-4Y23NCW4.js} +9 -9
  45. package/dist/{image-ocr-RXNTLXZ4.js → image-ocr-7YHK7Q4C.js} +6 -6
  46. package/dist/{image-ocr-24253ZWW.cjs → image-ocr-RE7BFBGV.cjs} +15 -15
  47. package/dist/{image-ocr-24253ZWW.cjs.map → image-ocr-RE7BFBGV.cjs.map} +1 -1
  48. package/dist/index.cjs +276 -276
  49. package/dist/index.js +5 -5
  50. package/dist/mcp.js +22 -22
  51. package/dist/{model-bundle-KPTPEAK5.js → model-bundle-WISSN6YF.js} +5 -5
  52. package/dist/{models-34A4VIVW.js → models-SG4VHU65.js} +5 -5
  53. package/dist/{parse-worker-v2-HYLWPIVX.js → parse-worker-v2-VNLAK2VC.js} +33 -16
  54. package/dist/parse-worker-v2-VNLAK2VC.js.map +1 -0
  55. package/dist/{parser-JRVDYJJ6.cjs → parser-KYZD3NNB.cjs} +257 -234
  56. package/dist/parser-KYZD3NNB.cjs.map +1 -0
  57. package/dist/{parser-FQLPABMD.js → parser-V3R7TKU5.js} +37 -14
  58. package/dist/parser-V3R7TKU5.js.map +1 -0
  59. package/dist/{parser-OJAOIUTR.js → parser-VPVVJDB3.js} +34 -11
  60. package/dist/parser-VPVVJDB3.js.map +1 -0
  61. package/dist/pdf-ocr-G2SX5FKB.cjs +19 -0
  62. package/dist/{pdf-ocr-TLUFBJKD.cjs.map → pdf-ocr-G2SX5FKB.cjs.map} +1 -1
  63. package/dist/pdf-ocr-KNNBYXVO.js +22 -0
  64. package/dist/pdf-ocr-PP2GGLS3.js +18 -0
  65. package/dist/{profile-io-SFW2AOCN.js → profile-io-72YURUWT.js} +3 -3
  66. package/dist/{rasterize-S4X4E2CH.js → rasterize-UPE2IZLP.js} +3 -3
  67. package/dist/{redact-doc-ZYUGJ7BI.js → redact-doc-GW6ILR52.js} +11 -11
  68. package/dist/{render-I7CNQ2H7.js → render-2XLPO3ZA.js} +7 -7
  69. package/dist/seal-VLJCGOP7.js +10 -0
  70. package/dist/{setup-H6A2OJMU.js → setup-GE4JKPHY.js} +3 -3
  71. package/dist/visual-7NPMIPSC.js +20 -0
  72. package/dist/{watch-GFZYBGKG.js → watch-XBVNOG6B.js} +12 -12
  73. package/package.json +7 -2
  74. package/dist/chunks-DNAX75UI.js +0 -10
  75. package/dist/parse-worker-v2-HYLWPIVX.js.map +0 -1
  76. package/dist/parser-FQLPABMD.js.map +0 -1
  77. package/dist/parser-JRVDYJJ6.cjs.map +0 -1
  78. package/dist/parser-OJAOIUTR.js.map +0 -1
  79. package/dist/pdf-ocr-KIQBC3N7.js +0 -22
  80. package/dist/pdf-ocr-TLUFBJKD.cjs +0 -19
  81. package/dist/pdf-ocr-ZYCLPDS4.js +0 -18
  82. package/dist/seal-ZHGMRUHX.js +0 -10
  83. package/dist/visual-NOQSOXZ5.js +0 -20
  84. /package/dist/{-RX7XZ3YG.js.map → -4UPN43UD.js.map} +0 -0
  85. /package/dist/{chunk-73GNY7ZX.js.map → chunk-3YD3SAQW.js.map} +0 -0
  86. /package/dist/{chunk-GTNCTRNQ.js.map → chunk-6EB77P5L.js.map} +0 -0
  87. /package/dist/{chunk-OOTAJZXG.js.map → chunk-B7CZZBKZ.js.map} +0 -0
  88. /package/dist/{chunk-UB55GFHD.js.map → chunk-C7OK4MBX.js.map} +0 -0
  89. /package/dist/{chunk-7BHPPEWK.js.map → chunk-DAR2TMBL.js.map} +0 -0
  90. /package/dist/{chunk-4OQ3JGNI.js.map → chunk-DI7WHDXG.js.map} +0 -0
  91. /package/dist/{chunk-UJARPT2G.js.map → chunk-FFBZG5MK.js.map} +0 -0
  92. /package/dist/{chunk-2SOILEGV.js.map → chunk-FW7QWLBL.js.map} +0 -0
  93. /package/dist/{chunk-FM33S6NN.js.map → chunk-HCCQTNDS.js.map} +0 -0
  94. /package/dist/{chunk-D37FRGQT.js.map → chunk-HIUHLJQD.js.map} +0 -0
  95. /package/dist/{chunk-SBHOOTMT.js.map → chunk-JGAY3BHY.js.map} +0 -0
  96. /package/dist/{chunk-R6MRWKSL.js.map → chunk-JQBUWC6W.js.map} +0 -0
  97. /package/dist/{chunk-YGQBX5D3.js.map → chunk-K23A2CP7.js.map} +0 -0
  98. /package/dist/{chunk-4BGPR423.js.map → chunk-LXYM2EST.js.map} +0 -0
  99. /package/dist/{chunk-AQBOKFSW.js.map → chunk-N4UL5NEO.js.map} +0 -0
  100. /package/dist/{chunk-A6CQXV52.js.map → chunk-NX5A22B6.js.map} +0 -0
  101. /package/dist/{chunk-QVMQ2NDS.js.map → chunk-QOIZF57S.js.map} +0 -0
  102. /package/dist/{chunk-4QVMW26U.js.map → chunk-RMMMNE2V.js.map} +0 -0
  103. /package/dist/{chunk-4PNWGIFX.js.map → chunk-UAEY6VPV.js.map} +0 -0
  104. /package/dist/{chunk-OAU5DO2L.js.map → chunk-VC2SS3OH.js.map} +0 -0
  105. /package/dist/{chunk-Y27V3EBB.js.map → chunk-VXNR2JYB.js.map} +0 -0
  106. /package/dist/{chunk-W5MRFI5K.js.map → chunk-YJ4J6EG5.js.map} +0 -0
  107. /package/dist/{chunk-PBNL6TOS.js.map → chunk-YM4AEOS4.js.map} +0 -0
  108. /package/dist/{chunks-DNAX75UI.js.map → chunks-A67IJS56.js.map} +0 -0
  109. /package/dist/{formula-AT252TKF.js.map → formula-N4TZPWWU.js.map} +0 -0
  110. /package/dist/{formula-VUABWUUV.js.map → formula-ZFB6JGOW.js.map} +0 -0
  111. /package/dist/{image-ocr-JYUWUJVP.js.map → image-ocr-4Y23NCW4.js.map} +0 -0
  112. /package/dist/{image-ocr-RXNTLXZ4.js.map → image-ocr-7YHK7Q4C.js.map} +0 -0
  113. /package/dist/{model-bundle-KPTPEAK5.js.map → model-bundle-WISSN6YF.js.map} +0 -0
  114. /package/dist/{models-34A4VIVW.js.map → models-SG4VHU65.js.map} +0 -0
  115. /package/dist/{pdf-ocr-KIQBC3N7.js.map → pdf-ocr-KNNBYXVO.js.map} +0 -0
  116. /package/dist/{pdf-ocr-ZYCLPDS4.js.map → pdf-ocr-PP2GGLS3.js.map} +0 -0
  117. /package/dist/{profile-io-SFW2AOCN.js.map → profile-io-72YURUWT.js.map} +0 -0
  118. /package/dist/{rasterize-S4X4E2CH.js.map → rasterize-UPE2IZLP.js.map} +0 -0
  119. /package/dist/{redact-doc-ZYUGJ7BI.js.map → redact-doc-GW6ILR52.js.map} +0 -0
  120. /package/dist/{render-I7CNQ2H7.js.map → render-2XLPO3ZA.js.map} +0 -0
  121. /package/dist/{seal-ZHGMRUHX.js.map → seal-VLJCGOP7.js.map} +0 -0
  122. /package/dist/{setup-H6A2OJMU.js.map → setup-GE4JKPHY.js.map} +0 -0
  123. /package/dist/{visual-NOQSOXZ5.js.map → visual-7NPMIPSC.js.map} +0 -0
  124. /package/dist/{watch-GFZYBGKG.js.map → watch-XBVNOG6B.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  blocksToPages,
3
3
  encodePng
4
- } from "./chunk-YGQBX5D3.js";
4
+ } from "./chunk-K23A2CP7.js";
5
5
  import {
6
6
  hasRequestedPagesAfter,
7
7
  parsePageRange
@@ -57,7 +57,7 @@ import {
57
57
  startsNewItem,
58
58
  trimTrailingEmptyTableCols,
59
59
  wrapJoiner
60
- } from "./chunk-AQBOKFSW.js";
60
+ } from "./chunk-N4UL5NEO.js";
61
61
  import {
62
62
  CELL_BASELINES,
63
63
  CELL_EDGES,
@@ -70,12 +70,12 @@ import {
70
70
  escapeLiteralTags,
71
71
  stripScriptTags,
72
72
  unframeLayoutTables
73
- } from "./chunk-4OQ3JGNI.js";
74
- import "./chunk-OOTAJZXG.js";
73
+ } from "./chunk-DI7WHDXG.js";
74
+ import "./chunk-B7CZZBKZ.js";
75
75
  import {
76
76
  KordocError,
77
77
  sanitizeHref
78
- } from "./chunk-R6MRWKSL.js";
78
+ } from "./chunk-JQBUWC6W.js";
79
79
 
80
80
  // src/pdf/image-extract.ts
81
81
  import { createHash } from "crypto";
@@ -996,6 +996,16 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs) {
996
996
  const a = table.cells[u.r][u.c], b = table.cells[first][d.c];
997
997
  if (hasContent(a) && hasContent(b) && continuesAcross(a, b, colXs[u.c], colXs[u.c + u.cs])) crossed.add(shape(u, d));
998
998
  }
999
+ let itemBreak = false;
1000
+ for (let c = 0; c < table.cols && !itemBreak; ) {
1001
+ const u = owner[last][c], d = owner[first][c];
1002
+ if (!u) {
1003
+ c++;
1004
+ continue;
1005
+ }
1006
+ c = u.c + u.cs;
1007
+ if (d && d !== u && d.r === first) itemBreak = nextItemHead(table.cells[u.r][u.c].text, table.cells[d.r][d.c].text);
1008
+ }
999
1009
  let merged = false;
1000
1010
  for (let c = 0; c < table.cols; ) {
1001
1011
  const u = owner[last][c], d = owner[first][c];
@@ -1006,7 +1016,8 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs) {
1006
1016
  c = u.c + u.cs;
1007
1017
  if (!d || d === u || u.r + u.rs - 1 !== last || d.r !== first || d.c !== u.c || d.cs !== u.cs) continue;
1008
1018
  const a = table.cells[u.r][u.c], b = table.cells[first][d.c];
1009
- if (!crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
1019
+ 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]);
1020
+ if (!flowsOn && !crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
1010
1021
  if (!straddles && !midWord) continue;
1011
1022
  if (u.r >= last && d.rs < 2) continue;
1012
1023
  const U = CELL_LINES.get(a);
@@ -1026,6 +1037,10 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs) {
1026
1037
  }
1027
1038
  return merged;
1028
1039
  }
1040
+ function longLastLine(c) {
1041
+ const L = CELL_LINES.get(c), l = L?.[L.length - 1];
1042
+ return !!l && l.r - l.l >= 6 * (l.h || 10);
1043
+ }
1029
1044
  function filledToBottom(U, bottom) {
1030
1045
  if (U.length < 2) return false;
1031
1046
  const lu = U[U.length - 1];
@@ -1045,12 +1060,12 @@ var LABEL_ROOM = 1.5;
1045
1060
  var HANGING_MIN = 0.5;
1046
1061
  var HANGING_TOL = 1;
1047
1062
  var KO_ITEMS = "\uAC00\uB098\uB2E4\uB77C\uB9C8\uBC14\uC0AC\uC544\uC790\uCC28\uCE74\uD0C0\uD30C\uD558\uAC70\uB108\uB354\uB7EC\uBA38\uBC84\uC11C\uC5B4\uC800\uCC98\uCEE4\uD130\uD37C\uD5C8\uACE0\uB178\uB3C4\uB85C\uBAA8\uBCF4\uC18C\uC624\uC870\uCD08\uCF54\uD1A0\uD3EC\uD638\uAD6C\uB204\uB450\uB8E8\uBB34\uBD80\uC218\uC6B0\uC8FC\uCD94\uCFE0\uD22C\uD478\uD6C4";
1048
- var ITEM_MARK = /^\s*(?:([가-힣])\.|(\d{1,3})[.)]|\(([가-힣\d]{1,3})\))(?=\s)/;
1063
+ var ITEM_MARK = /^\s*(?:([가-힣])[.)]|(\d{1,3})[.)]|\(([가-힣\d]{1,3})\))(?=\s)/;
1049
1064
  function nextItemHead(prev, next) {
1050
1065
  const a = ITEM_MARK.exec(prev), b = ITEM_MARK.exec(next);
1051
1066
  if (!a || !b) return false;
1052
1067
  const succ = (x, y) => /^\d+$/.test(x) ? /^\d+$/.test(y) && Number(y) === Number(x) + 1 : KO_ITEMS.indexOf(x) >= 0 && KO_ITEMS.indexOf(y) === KO_ITEMS.indexOf(x) + 1;
1053
- if (a[1] && b[1]) return succ(a[1], b[1]);
1068
+ if (a[1] && b[1]) return succ(a[1], b[1]) && prev.trimStart()[1] === next.trimStart()[1];
1054
1069
  if (a[2] && b[2]) return succ(a[2], b[2]) && prev.trimStart()[a[2].length] === next.trimStart()[b[2].length];
1055
1070
  if (a[3] && b[3]) return succ(a[3], b[3]);
1056
1071
  return false;
@@ -1181,6 +1196,14 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
1181
1196
  }
1182
1197
  const newCell = pairs.some(([u, d]) => !hasContent(u.cell) && hasContent(d.cell));
1183
1198
  const cell = (a) => table.cells[a.r][a.c];
1199
+ const serial = (c) => {
1200
+ const t = flowText(c.text).trim();
1201
+ return /^\d{1,3}$/.test(t) ? +t : null;
1202
+ };
1203
+ if (pairs.some(([u, d]) => {
1204
+ const a = serial(cell(u)), b = serial(cell(d));
1205
+ return a !== null && b === a + 1;
1206
+ })) return false;
1184
1207
  const contentPairs = pairs.filter(([u, d]) => hasContent(u.cell) && hasContent(d.cell));
1185
1208
  const carriedSplit = !textOnly && carried && !newCell && (contentPairs.length <= 1 || contentPairs.every(([, d]) => d.rs > 1) || !cut.ruled && contentPairs.some(([u, d]) => wordOverflows(cell(u), cell(d), colXs[u.c], colXs[u.c + u.cs])));
1186
1209
  if (!carriedSplit) {
@@ -2956,7 +2979,7 @@ function mergeLinkRuns(markdown) {
2956
2979
 
2957
2980
  // src/pdf/formula-ocr.ts
2958
2981
  async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
2959
- const formulaMod = await import("./formula-VUABWUUV.js");
2982
+ const formulaMod = await import("./formula-ZFB6JGOW.js");
2960
2983
  const { FormulaPipeline, ensureFormulaModels } = formulaMod;
2961
2984
  await ensureFormulaModels((p) => {
2962
2985
  if (p.phase === "download" && p.total) {
@@ -3377,7 +3400,7 @@ async function parsePdfDocument(buffer, options) {
3377
3400
  }
3378
3401
  if (targets.size > 0) {
3379
3402
  try {
3380
- const { runPdfOcr } = await import("./pdf-ocr-ZYCLPDS4.js");
3403
+ const { runPdfOcr } = await import("./pdf-ocr-PP2GGLS3.js");
3381
3404
  const mode = typeof options?.ocr === "function" ? options.ocr : "builtin";
3382
3405
  const regionPages = new Map([...ocrRegions].filter(([p]) => options?.ocr !== "force" && !isImageBased && !pageQuality.find((q) => q.page === p)?.needsOcr));
3383
3406
  const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options?.onProgress, options?.tables !== false, vectorPageOps, regionPages);
@@ -3617,4 +3640,4 @@ export {
3617
3640
  parsePdfDocument,
3618
3641
  removeHeaderFooterBlocks
3619
3642
  };
3620
- //# sourceMappingURL=parser-OJAOIUTR.js.map
3643
+ //# sourceMappingURL=parser-VPVVJDB3.js.map