kordoc 4.6.1 → 4.7.1

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 (97) hide show
  1. package/dist/{-6XJ6MCQG.js → -O42BMYNX.js} +9 -9
  2. package/dist/{chunk-B2OQOTRT.js → chunk-3UIT4PPQ.js} +121 -2
  3. package/dist/chunk-3UIT4PPQ.js.map +1 -0
  4. package/dist/{chunk-MVTX6ODZ.js → chunk-4VNUQYUE.js} +1 -1
  5. package/dist/chunk-4VNUQYUE.js.map +1 -0
  6. package/dist/{chunk-VO24F4BJ.js → chunk-5KPNXBNR.js} +26 -14
  7. package/dist/chunk-5KPNXBNR.js.map +1 -0
  8. package/dist/{chunk-EACTUWYE.js → chunk-6663UXPE.js} +2 -2
  9. package/dist/{chunk-AFPD74JJ.js → chunk-7ZIOZ6PU.js} +2 -2
  10. package/dist/{chunk-XZDJXYUC.js → chunk-AFX6ZXER.js} +2 -2
  11. package/dist/{chunk-BGSGUONP.js → chunk-BQENBAUC.js} +122 -3
  12. package/dist/chunk-BQENBAUC.js.map +1 -0
  13. package/dist/{chunk-TUU535RB.cjs → chunk-DJKLOLBT.cjs} +2 -2
  14. package/dist/chunk-DJKLOLBT.cjs.map +1 -0
  15. package/dist/{chunk-BCG2PKQU.js → chunk-IMEMTJ76.js} +11 -5
  16. package/dist/chunk-IMEMTJ76.js.map +1 -0
  17. package/dist/{chunk-YUVKU5CW.js → chunk-IZEUWEEY.js} +2 -2
  18. package/dist/chunk-IZEUWEEY.js.map +1 -0
  19. package/dist/{chunk-ZYVULRYF.js → chunk-J3W6Q3AX.js} +2 -2
  20. package/dist/{chunk-PV2EXXGI.js → chunk-JEX5P66D.js} +3 -3
  21. package/dist/{chunk-VCA4SZ2D.js → chunk-PLEGO474.js} +2 -2
  22. package/dist/{chunk-AC3K3FZJ.cjs → chunk-TZ3WCAJZ.cjs} +3 -3
  23. package/dist/{chunk-AC3K3FZJ.cjs.map → chunk-TZ3WCAJZ.cjs.map} +1 -1
  24. package/dist/{chunk-W5KRKBYR.cjs → chunk-USGC3ZKU.cjs} +13 -7
  25. package/dist/chunk-USGC3ZKU.cjs.map +1 -0
  26. package/dist/{chunk-YXXHH6WC.js → chunk-UZB3UGC5.js} +2 -2
  27. package/dist/{chunk-IDHBO6AG.js → chunk-VECVLIWE.js} +3 -3
  28. package/dist/{chunk-3VTMSSDW.js → chunk-YWDN5PQC.js} +11 -5
  29. package/dist/chunk-YWDN5PQC.js.map +1 -0
  30. package/dist/{chunk-SHYF2BB2.cjs → chunk-ZDWP3LLY.cjs} +129 -10
  31. package/dist/chunk-ZDWP3LLY.cjs.map +1 -0
  32. package/dist/chunks-C7DJL4RE.js +10 -0
  33. package/dist/cli.js +17 -17
  34. package/dist/{image-ocr-Y3WDYG4I.js → image-ocr-5QRZBNOF.js} +5 -5
  35. package/dist/{image-ocr-MLUPV4FM.cjs → image-ocr-MKD6MKWO.cjs} +10 -10
  36. package/dist/{image-ocr-MLUPV4FM.cjs.map → image-ocr-MKD6MKWO.cjs.map} +1 -1
  37. package/dist/{image-ocr-7VYYQH5F.js → image-ocr-TAJHRZ5T.js} +4 -4
  38. package/dist/index.cjs +479 -467
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.d.cts +4 -0
  41. package/dist/index.d.ts +4 -0
  42. package/dist/index.js +21 -9
  43. package/dist/index.js.map +1 -1
  44. package/dist/mcp.js +15 -15
  45. package/dist/{parser-ZDJ7QTLL.js → parser-RCEHB2EV.js} +50 -7
  46. package/dist/parser-RCEHB2EV.js.map +1 -0
  47. package/dist/{parser-QOFG3K3Y.cjs → parser-SWY4RKGD.cjs} +70 -27
  48. package/dist/parser-SWY4RKGD.cjs.map +1 -0
  49. package/dist/{parser-FMYUF4DT.js → parser-UMFBJG2D.js} +51 -8
  50. package/dist/parser-UMFBJG2D.js.map +1 -0
  51. package/dist/pdf-ocr-3NTV3MYP.js +12 -0
  52. package/dist/{pdf-ocr-BFWPYON4.js → pdf-ocr-7BOO4JA7.js} +5 -5
  53. package/dist/pdf-ocr-JDHELYBY.cjs +13 -0
  54. package/dist/{pdf-ocr-MYZNSEK4.cjs.map → pdf-ocr-JDHELYBY.cjs.map} +1 -1
  55. package/dist/{profile-io-L5EH4JAD.js → profile-io-HT62OAEU.js} +3 -3
  56. package/dist/{rasterize-7AR662AL.js → rasterize-GL67HQC7.js} +2 -2
  57. package/dist/render-IQ4IZLY4.js +10 -0
  58. package/dist/seal-AGSZ6MUR.js +10 -0
  59. package/dist/{watch-ZPKLNQTD.js → watch-5ST75Q7Q.js} +9 -9
  60. package/package.json +1 -1
  61. package/dist/chunk-3VTMSSDW.js.map +0 -1
  62. package/dist/chunk-B2OQOTRT.js.map +0 -1
  63. package/dist/chunk-BCG2PKQU.js.map +0 -1
  64. package/dist/chunk-BGSGUONP.js.map +0 -1
  65. package/dist/chunk-MVTX6ODZ.js.map +0 -1
  66. package/dist/chunk-SHYF2BB2.cjs.map +0 -1
  67. package/dist/chunk-TUU535RB.cjs.map +0 -1
  68. package/dist/chunk-VO24F4BJ.js.map +0 -1
  69. package/dist/chunk-W5KRKBYR.cjs.map +0 -1
  70. package/dist/chunk-YUVKU5CW.js.map +0 -1
  71. package/dist/chunks-4HEG6ZPG.js +0 -10
  72. package/dist/parser-FMYUF4DT.js.map +0 -1
  73. package/dist/parser-QOFG3K3Y.cjs.map +0 -1
  74. package/dist/parser-ZDJ7QTLL.js.map +0 -1
  75. package/dist/pdf-ocr-CBJAL5DC.js +0 -12
  76. package/dist/pdf-ocr-MYZNSEK4.cjs +0 -13
  77. package/dist/render-CAFQT7S4.js +0 -10
  78. package/dist/seal-ESAC3IZR.js +0 -10
  79. /package/dist/{-6XJ6MCQG.js.map → -O42BMYNX.js.map} +0 -0
  80. /package/dist/{chunk-EACTUWYE.js.map → chunk-6663UXPE.js.map} +0 -0
  81. /package/dist/{chunk-AFPD74JJ.js.map → chunk-7ZIOZ6PU.js.map} +0 -0
  82. /package/dist/{chunk-XZDJXYUC.js.map → chunk-AFX6ZXER.js.map} +0 -0
  83. /package/dist/{chunk-ZYVULRYF.js.map → chunk-J3W6Q3AX.js.map} +0 -0
  84. /package/dist/{chunk-PV2EXXGI.js.map → chunk-JEX5P66D.js.map} +0 -0
  85. /package/dist/{chunk-VCA4SZ2D.js.map → chunk-PLEGO474.js.map} +0 -0
  86. /package/dist/{chunk-YXXHH6WC.js.map → chunk-UZB3UGC5.js.map} +0 -0
  87. /package/dist/{chunk-IDHBO6AG.js.map → chunk-VECVLIWE.js.map} +0 -0
  88. /package/dist/{chunks-4HEG6ZPG.js.map → chunks-C7DJL4RE.js.map} +0 -0
  89. /package/dist/{image-ocr-Y3WDYG4I.js.map → image-ocr-5QRZBNOF.js.map} +0 -0
  90. /package/dist/{image-ocr-7VYYQH5F.js.map → image-ocr-TAJHRZ5T.js.map} +0 -0
  91. /package/dist/{pdf-ocr-BFWPYON4.js.map → pdf-ocr-3NTV3MYP.js.map} +0 -0
  92. /package/dist/{pdf-ocr-CBJAL5DC.js.map → pdf-ocr-7BOO4JA7.js.map} +0 -0
  93. /package/dist/{profile-io-L5EH4JAD.js.map → profile-io-HT62OAEU.js.map} +0 -0
  94. /package/dist/{rasterize-7AR662AL.js.map → rasterize-GL67HQC7.js.map} +0 -0
  95. /package/dist/{render-CAFQT7S4.js.map → render-IQ4IZLY4.js.map} +0 -0
  96. /package/dist/{seal-ESAC3IZR.js.map → seal-AGSZ6MUR.js.map} +0 -0
  97. /package/dist/{watch-ZPKLNQTD.js.map → watch-5ST75Q7Q.js.map} +0 -0
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-3H5X63BQ.js";
5
5
  import {
6
6
  extractPageBlocksWithLines
7
- } from "./chunk-B2OQOTRT.js";
7
+ } from "./chunk-3UIT4PPQ.js";
8
8
 
9
9
  // src/ocr/ruling-lines.ts
10
10
  var INK_LUMA_MAX = 190;
@@ -568,4 +568,4 @@ export {
568
568
  runPdfOcr,
569
569
  ocrItemsToBlocks
570
570
  };
571
- //# sourceMappingURL=chunk-EACTUWYE.js.map
571
+ //# sourceMappingURL=chunk-6663UXPE.js.map
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  KordocError
4
- } from "./chunk-ZYVULRYF.js";
4
+ } from "./chunk-J3W6Q3AX.js";
5
5
 
6
6
  // src/hwpx/parser-shared.ts
7
7
  import { DOMParser } from "@xmldom/xmldom";
@@ -318,4 +318,4 @@ export {
318
318
  DEFAULT_CHAR,
319
319
  parseRenderStyles
320
320
  };
321
- //# sourceMappingURL=chunk-AFPD74JJ.js.map
321
+ //# sourceMappingURL=chunk-7ZIOZ6PU.js.map
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  blocksToMarkdown
4
- } from "./chunk-3VTMSSDW.js";
4
+ } from "./chunk-YWDN5PQC.js";
5
5
 
6
6
  // src/chunks.ts
7
7
  var LIST_MARKER_RE = /^(?:[□■◇◆○◎●◦ㅇ•▪▸▶※-]|\d{1,3}[.)]|[가나다라마바사아자차카타파하][.)]|\([가나다라마바사아자차카타파하0-9]{1,3}\)|[①-⑳㉮-㉻㈎-㈛])\s/;
@@ -79,4 +79,4 @@ function blocksToChunks(blocks, options) {
79
79
  export {
80
80
  blocksToChunks
81
81
  };
82
- //# sourceMappingURL=chunk-XZDJXYUC.js.map
82
+ //# sourceMappingURL=chunk-AFX6ZXER.js.map
@@ -3,11 +3,11 @@ import {
3
3
  HEADING_RATIO_H1,
4
4
  HEADING_RATIO_H2,
5
5
  HEADING_RATIO_H3
6
- } from "./chunk-MVTX6ODZ.js";
6
+ } from "./chunk-4VNUQYUE.js";
7
7
  import {
8
8
  safeMax,
9
9
  safeMin
10
- } from "./chunk-ZYVULRYF.js";
10
+ } from "./chunk-J3W6Q3AX.js";
11
11
 
12
12
  // src/pdf/image-regions.ts
13
13
  import { OPS } from "pdfjs-dist/legacy/build/pdf.mjs";
@@ -3043,6 +3043,123 @@ function buildGridTable(lines, columns) {
3043
3043
  return md.join("\n");
3044
3044
  }
3045
3045
 
3046
+ // src/pdf/underline.ts
3047
+ var UNDER_MAX_THICKNESS = 2;
3048
+ var UNDER_BELOW_EM = 0.72;
3049
+ var UNDER_BELOW_MIN_PT = 3;
3050
+ var UNDER_ABOVE_PT = 1;
3051
+ var UNDER_MIN_OVERLAP_RATIO = 0.6;
3052
+ var UNDER_OWNER_PAD_EM = 0.75;
3053
+ var UNDER_OWNER_PAD_MIN_PT = 4;
3054
+ var UNDER_MIN_COVERAGE = 0.6;
3055
+ var UNDER_GRID_EPS = 2;
3056
+ var UNDER_COLUMN_GAP_EM = 2;
3057
+ var UNDER_REPEATED_SPAN_LEVELS = 3;
3058
+ var UNDER_SPAN_OVERLAP_RATIO = 0.8;
3059
+ var UNDER_BOX_PAIR_MIN_EM = 0.5;
3060
+ var UNDER_BOX_PAIR_MAX_EM = 2.2;
3061
+ var UNDER_BOX_PAIR_OVERLAP = 0.8;
3062
+ function markUnderlineItems(items, horizontals, verticals) {
3063
+ if (items.length === 0 || horizontals.length === 0) return;
3064
+ for (const line of horizontals) {
3065
+ if (line.lineWidth > UNDER_MAX_THICKNESS) continue;
3066
+ if (touchesVertical(line, verticals)) continue;
3067
+ if (isRepeatedSpanRule(line, horizontals)) continue;
3068
+ const matches = [];
3069
+ for (const item of items) {
3070
+ const h = item.h > 0 ? item.h : item.fontSize;
3071
+ if (h <= 0 || item.w <= 0 || !item.text.trim()) continue;
3072
+ const below = Math.max(h * UNDER_BELOW_EM, UNDER_BELOW_MIN_PT);
3073
+ if (line.y1 < item.y - below || line.y1 > item.y + UNDER_ABOVE_PT) continue;
3074
+ const overlap = Math.min(line.x2, item.x + item.w) - Math.max(line.x1, item.x);
3075
+ if (overlap / item.w < UNDER_MIN_OVERLAP_RATIO) continue;
3076
+ matches.push(item);
3077
+ }
3078
+ if (matches.length === 0) continue;
3079
+ let x1 = Infinity, x2 = -Infinity, maxH = 0, covered = 0;
3080
+ for (const m of matches) {
3081
+ x1 = Math.min(x1, m.x);
3082
+ x2 = Math.max(x2, m.x + m.w);
3083
+ maxH = Math.max(maxH, m.h > 0 ? m.h : m.fontSize);
3084
+ covered += m.w;
3085
+ }
3086
+ const pad = Math.max(maxH * UNDER_OWNER_PAD_EM, UNDER_OWNER_PAD_MIN_PT);
3087
+ if (line.x1 < x1 - pad || line.x2 > x2 + pad) continue;
3088
+ if (covered < (line.x2 - line.x1) * UNDER_MIN_COVERAGE) continue;
3089
+ if (hasBoxTopPair(line, maxH, horizontals)) continue;
3090
+ matches.sort((a, b) => a.x - b.x);
3091
+ let hole = false;
3092
+ for (let i = 1; i < matches.length; i++) {
3093
+ if (matches[i].x - (matches[i - 1].x + matches[i - 1].w) > maxH * UNDER_COLUMN_GAP_EM) {
3094
+ hole = true;
3095
+ break;
3096
+ }
3097
+ }
3098
+ if (hole) continue;
3099
+ for (const m of matches) m.underline = true;
3100
+ }
3101
+ }
3102
+ function touchesVertical(line, verticals) {
3103
+ for (const v of verticals) {
3104
+ if (v.x1 < line.x1 - UNDER_GRID_EPS || v.x1 > line.x2 + UNDER_GRID_EPS) continue;
3105
+ const lo = Math.min(v.y1, v.y2), hi = Math.max(v.y1, v.y2);
3106
+ if (lo <= line.y1 + UNDER_GRID_EPS && hi >= line.y1 - UNDER_GRID_EPS) return true;
3107
+ }
3108
+ return false;
3109
+ }
3110
+ function hasBoxTopPair(line, maxH, horizontals) {
3111
+ const w = line.x2 - line.x1;
3112
+ if (w <= 0) return false;
3113
+ for (const o of horizontals) {
3114
+ if (o === line) continue;
3115
+ const dy = o.y1 - line.y1;
3116
+ if (dy < maxH * UNDER_BOX_PAIR_MIN_EM || dy > maxH * UNDER_BOX_PAIR_MAX_EM) continue;
3117
+ const ow = o.x2 - o.x1;
3118
+ if (ow <= 0) continue;
3119
+ const overlap = Math.min(line.x2, o.x2) - Math.max(line.x1, o.x1);
3120
+ if (overlap / Math.max(w, ow) >= UNDER_BOX_PAIR_OVERLAP) return true;
3121
+ }
3122
+ return false;
3123
+ }
3124
+ function isRepeatedSpanRule(line, horizontals) {
3125
+ const w = line.x2 - line.x1;
3126
+ if (w <= 0) return false;
3127
+ const ys = [];
3128
+ for (const o of horizontals) {
3129
+ const ow = o.x2 - o.x1;
3130
+ if (ow <= 0) continue;
3131
+ const overlap = Math.min(line.x2, o.x2) - Math.max(line.x1, o.x1);
3132
+ if (overlap / Math.max(w, ow) < UNDER_SPAN_OVERLAP_RATIO) continue;
3133
+ if (!ys.some((y) => Math.abs(y - o.y1) < 2)) ys.push(o.y1);
3134
+ }
3135
+ return ys.length >= UNDER_REPEATED_SPAN_LEVELS;
3136
+ }
3137
+ function wrapUnderlineRuns(items) {
3138
+ const marked = items.filter((i) => i.underline);
3139
+ if (marked.length === 0) return;
3140
+ const lines = /* @__PURE__ */ new Map();
3141
+ for (const item of marked) {
3142
+ const key = Math.round(item.y / 3);
3143
+ const arr = lines.get(key) || [];
3144
+ arr.push(item);
3145
+ lines.set(key, arr);
3146
+ }
3147
+ for (const arr of lines.values()) {
3148
+ arr.sort((a, b) => a.x - b.x);
3149
+ let runStart = 0;
3150
+ for (let i = 1; i <= arr.length; i++) {
3151
+ const prev = arr[i - 1];
3152
+ const em = Math.max(prev.h > 0 ? prev.h : prev.fontSize, 1);
3153
+ const gap = i < arr.length ? arr[i].x - (prev.x + prev.w) : Infinity;
3154
+ if (gap > em) {
3155
+ arr[runStart].text = "<u>" + arr[runStart].text;
3156
+ prev.text = prev.text + "</u>";
3157
+ runStart = i;
3158
+ }
3159
+ }
3160
+ }
3161
+ }
3162
+
3046
3163
  // src/pdf/page-blocks.ts
3047
3164
  function extractPageBlocksWithLines(items, pageNum, opList, pageWidth, pageHeight, extraLines, detectTables = true) {
3048
3165
  if (items.length === 0) return [];
@@ -3058,6 +3175,8 @@ function extractPageBlocksWithLines(items, pageNum, opList, pageWidth, pageHeigh
3058
3175
  verticals = bridgeSplitColumnVerticals(horizontals, verticals);
3059
3176
  markStrikethroughItems(items, horizontals);
3060
3177
  wrapStrikethroughRuns(items);
3178
+ markUnderlineItems(items, horizontals, verticals);
3179
+ wrapUnderlineRuns(items);
3061
3180
  const grids = detectTables ? buildTableGrids(horizontals, verticals) : [];
3062
3181
  if (grids.length > 0) {
3063
3182
  return extractBlocksWithGrids(items, pageNum, grids, horizontals, verticals);
@@ -3568,4 +3687,4 @@ export {
3568
3687
  extractPageBlocksWithLines,
3569
3688
  mergeCrossPageTables
3570
3689
  };
3571
- //# sourceMappingURL=chunk-BGSGUONP.js.map
3690
+ //# sourceMappingURL=chunk-BQENBAUC.js.map