kordoc 4.18.12 → 4.18.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 (119) hide show
  1. package/README.md +2 -2
  2. package/dist/{-WZOQMDES.js → -DC2OO5KO.js} +11 -11
  3. package/dist/{chunk-GZAYV2SV.js → chunk-32ZUIHSY.js} +3 -3
  4. package/dist/{chunk-OB3GPKKZ.cjs → chunk-3FGHQWJP.cjs} +38 -24
  5. package/dist/chunk-3FGHQWJP.cjs.map +1 -0
  6. package/dist/{chunk-PTWSL4FG.js → chunk-6AYTYTFY.js} +3 -3
  7. package/dist/{chunk-A7VXXIRT.cjs → chunk-6CQZMVXW.cjs} +3 -3
  8. package/dist/{chunk-A7VXXIRT.cjs.map → chunk-6CQZMVXW.cjs.map} +1 -1
  9. package/dist/{chunk-5WLN2JNN.cjs → chunk-6FW3AZWN.cjs} +6 -6
  10. package/dist/{chunk-5WLN2JNN.cjs.map → chunk-6FW3AZWN.cjs.map} +1 -1
  11. package/dist/{chunk-A72XCFET.js → chunk-7LOD4IGO.js} +4 -4
  12. package/dist/{chunk-PTLYGMNQ.js → chunk-DHEUQXXR.js} +2 -2
  13. package/dist/{chunk-APPUKIPQ.js → chunk-EBXJ45VZ.js} +2 -2
  14. package/dist/{chunk-XRVJ7UHC.js → chunk-EZSWBHHI.js} +2 -2
  15. package/dist/{chunk-GGX5AA2L.cjs → chunk-GGMIPTM5.cjs} +12 -12
  16. package/dist/{chunk-GGX5AA2L.cjs.map → chunk-GGMIPTM5.cjs.map} +1 -1
  17. package/dist/{chunk-XM2ZOOEW.js → chunk-GSW7W7AL.js} +2 -2
  18. package/dist/{chunk-T3AJHRWN.js → chunk-GUH6HYSZ.js} +10 -10
  19. package/dist/{chunk-G2PGKJUH.js → chunk-INESPVEV.js} +19 -5
  20. package/dist/chunk-INESPVEV.js.map +1 -0
  21. package/dist/{chunk-M7CCB6J3.js → chunk-IRN5SDY2.js} +2 -2
  22. package/dist/{chunk-CXNMHMPS.js → chunk-ISC2TH24.js} +2 -2
  23. package/dist/{chunk-MFA3TJWM.js → chunk-JKHU7HID.js} +2 -2
  24. package/dist/{chunk-FWLSXLDC.js → chunk-JPSLMPFI.js} +2 -2
  25. package/dist/{chunk-QYT3XW2J.js → chunk-JWTZ3OVZ.js} +2 -2
  26. package/dist/{chunk-2CMRR7SH.cjs → chunk-K6WSMTVU.cjs} +2 -2
  27. package/dist/{chunk-2CMRR7SH.cjs.map → chunk-K6WSMTVU.cjs.map} +1 -1
  28. package/dist/{chunk-MXCQIXGJ.js → chunk-LKA7Z2NH.js} +2 -2
  29. package/dist/{chunk-A2B5AYXD.js → chunk-PHMWSWHJ.js} +2 -2
  30. package/dist/{chunk-5V4XXKGX.js → chunk-PN5WWW56.js} +2 -2
  31. package/dist/{chunk-XRJRZCJA.cjs → chunk-RQEDNI4P.cjs} +3 -3
  32. package/dist/{chunk-XRJRZCJA.cjs.map → chunk-RQEDNI4P.cjs.map} +1 -1
  33. package/dist/{chunk-4SKWUNN7.js → chunk-SVIOP7PE.js} +6 -6
  34. package/dist/{chunk-4RVCC5YD.js → chunk-V7LKQNC4.js} +2 -2
  35. package/dist/{chunk-C7P6EZHR.js → chunk-VDEENOPW.js} +2 -2
  36. package/dist/{chunk-R2NGHNS3.js → chunk-XVB3PUPJ.js} +2 -2
  37. package/dist/{chunk-IRTDNELH.js → chunk-ZNY5BRV6.js} +20 -6
  38. package/dist/chunk-ZNY5BRV6.js.map +1 -0
  39. package/dist/chunks-JZW2TXIZ.js +10 -0
  40. package/dist/cli.js +26 -26
  41. package/dist/{formula-7FODYMWG.js → formula-DAMFHLQO.js} +3 -3
  42. package/dist/{formula-CAUZGR3C.cjs → formula-HJNQGPRC.cjs} +9 -9
  43. package/dist/{formula-CAUZGR3C.cjs.map → formula-HJNQGPRC.cjs.map} +1 -1
  44. package/dist/{formula-VWCF7AV5.js → formula-YCAO5IVW.js} +4 -4
  45. package/dist/{image-ocr-YLTHT7IE.cjs → image-ocr-AZ25IOC7.cjs} +15 -15
  46. package/dist/{image-ocr-YLTHT7IE.cjs.map → image-ocr-AZ25IOC7.cjs.map} +1 -1
  47. package/dist/{image-ocr-UOAHUR4Y.js → image-ocr-PAF76DAW.js} +9 -9
  48. package/dist/{image-ocr-LFMD7GFW.js → image-ocr-VH54SDZ7.js} +6 -6
  49. package/dist/index.cjs +277 -277
  50. package/dist/index.js +5 -5
  51. package/dist/mcp.js +22 -22
  52. package/dist/{model-bundle-IRGZNITZ.js → model-bundle-53CHDYCG.js} +5 -5
  53. package/dist/{models-QLW4GG62.js → models-UVLAKK3M.js} +5 -5
  54. package/dist/{parser-MOZDJZHH.cjs → parser-HWAOPQYK.cjs} +126 -126
  55. package/dist/{parser-MOZDJZHH.cjs.map → parser-HWAOPQYK.cjs.map} +1 -1
  56. package/dist/{parser-KPWQK4CU.js → parser-I4D3TRGU.js} +11 -11
  57. package/dist/{parser-VDZTRLXN.js → parser-Z6PHB54O.js} +8 -8
  58. package/dist/pdf-ocr-F4ICXO7W.js +20 -0
  59. package/dist/pdf-ocr-HR6CXGTX.cjs +17 -0
  60. package/dist/{pdf-ocr-IDZQ2KUS.cjs.map → pdf-ocr-HR6CXGTX.cjs.map} +1 -1
  61. package/dist/pdf-ocr-JI3K7JIN.js +16 -0
  62. package/dist/{profile-io-UJWTARCU.js → profile-io-WHCWCOPW.js} +3 -3
  63. package/dist/{rasterize-2FB766KD.js → rasterize-5DZ3DHGH.js} +3 -3
  64. package/dist/{redact-doc-J6U6WWKD.js → redact-doc-RNJVMFGQ.js} +11 -11
  65. package/dist/{render-CCIUMRLV.js → render-NZ6RA6SW.js} +7 -7
  66. package/dist/seal-WHJ6O5HT.js +10 -0
  67. package/dist/{setup-EEMGK6BR.js → setup-U3EQNK4Z.js} +3 -3
  68. package/dist/visual-JDAS4R43.js +20 -0
  69. package/dist/{watch-6I73YNFW.js → watch-GB2M7XU6.js} +12 -12
  70. package/package.json +1 -1
  71. package/dist/chunk-G2PGKJUH.js.map +0 -1
  72. package/dist/chunk-IRTDNELH.js.map +0 -1
  73. package/dist/chunk-OB3GPKKZ.cjs.map +0 -1
  74. package/dist/chunks-UQYMW7PG.js +0 -10
  75. package/dist/pdf-ocr-7MEF7NN4.js +0 -16
  76. package/dist/pdf-ocr-GO7BGPHA.js +0 -20
  77. package/dist/pdf-ocr-IDZQ2KUS.cjs +0 -17
  78. package/dist/seal-NKE6UTJL.js +0 -10
  79. package/dist/visual-6K3FOUEP.js +0 -20
  80. /package/dist/{-WZOQMDES.js.map → -DC2OO5KO.js.map} +0 -0
  81. /package/dist/{chunk-GZAYV2SV.js.map → chunk-32ZUIHSY.js.map} +0 -0
  82. /package/dist/{chunk-PTWSL4FG.js.map → chunk-6AYTYTFY.js.map} +0 -0
  83. /package/dist/{chunk-A72XCFET.js.map → chunk-7LOD4IGO.js.map} +0 -0
  84. /package/dist/{chunk-PTLYGMNQ.js.map → chunk-DHEUQXXR.js.map} +0 -0
  85. /package/dist/{chunk-APPUKIPQ.js.map → chunk-EBXJ45VZ.js.map} +0 -0
  86. /package/dist/{chunk-XRVJ7UHC.js.map → chunk-EZSWBHHI.js.map} +0 -0
  87. /package/dist/{chunk-XM2ZOOEW.js.map → chunk-GSW7W7AL.js.map} +0 -0
  88. /package/dist/{chunk-T3AJHRWN.js.map → chunk-GUH6HYSZ.js.map} +0 -0
  89. /package/dist/{chunk-M7CCB6J3.js.map → chunk-IRN5SDY2.js.map} +0 -0
  90. /package/dist/{chunk-CXNMHMPS.js.map → chunk-ISC2TH24.js.map} +0 -0
  91. /package/dist/{chunk-MFA3TJWM.js.map → chunk-JKHU7HID.js.map} +0 -0
  92. /package/dist/{chunk-FWLSXLDC.js.map → chunk-JPSLMPFI.js.map} +0 -0
  93. /package/dist/{chunk-QYT3XW2J.js.map → chunk-JWTZ3OVZ.js.map} +0 -0
  94. /package/dist/{chunk-MXCQIXGJ.js.map → chunk-LKA7Z2NH.js.map} +0 -0
  95. /package/dist/{chunk-A2B5AYXD.js.map → chunk-PHMWSWHJ.js.map} +0 -0
  96. /package/dist/{chunk-5V4XXKGX.js.map → chunk-PN5WWW56.js.map} +0 -0
  97. /package/dist/{chunk-4SKWUNN7.js.map → chunk-SVIOP7PE.js.map} +0 -0
  98. /package/dist/{chunk-4RVCC5YD.js.map → chunk-V7LKQNC4.js.map} +0 -0
  99. /package/dist/{chunk-C7P6EZHR.js.map → chunk-VDEENOPW.js.map} +0 -0
  100. /package/dist/{chunk-R2NGHNS3.js.map → chunk-XVB3PUPJ.js.map} +0 -0
  101. /package/dist/{chunks-UQYMW7PG.js.map → chunks-JZW2TXIZ.js.map} +0 -0
  102. /package/dist/{formula-7FODYMWG.js.map → formula-DAMFHLQO.js.map} +0 -0
  103. /package/dist/{formula-VWCF7AV5.js.map → formula-YCAO5IVW.js.map} +0 -0
  104. /package/dist/{image-ocr-UOAHUR4Y.js.map → image-ocr-PAF76DAW.js.map} +0 -0
  105. /package/dist/{image-ocr-LFMD7GFW.js.map → image-ocr-VH54SDZ7.js.map} +0 -0
  106. /package/dist/{model-bundle-IRGZNITZ.js.map → model-bundle-53CHDYCG.js.map} +0 -0
  107. /package/dist/{models-QLW4GG62.js.map → models-UVLAKK3M.js.map} +0 -0
  108. /package/dist/{parser-KPWQK4CU.js.map → parser-I4D3TRGU.js.map} +0 -0
  109. /package/dist/{parser-VDZTRLXN.js.map → parser-Z6PHB54O.js.map} +0 -0
  110. /package/dist/{pdf-ocr-7MEF7NN4.js.map → pdf-ocr-F4ICXO7W.js.map} +0 -0
  111. /package/dist/{pdf-ocr-GO7BGPHA.js.map → pdf-ocr-JI3K7JIN.js.map} +0 -0
  112. /package/dist/{profile-io-UJWTARCU.js.map → profile-io-WHCWCOPW.js.map} +0 -0
  113. /package/dist/{rasterize-2FB766KD.js.map → rasterize-5DZ3DHGH.js.map} +0 -0
  114. /package/dist/{redact-doc-J6U6WWKD.js.map → redact-doc-RNJVMFGQ.js.map} +0 -0
  115. /package/dist/{render-CCIUMRLV.js.map → render-NZ6RA6SW.js.map} +0 -0
  116. /package/dist/{seal-NKE6UTJL.js.map → seal-WHJ6O5HT.js.map} +0 -0
  117. /package/dist/{setup-EEMGK6BR.js.map → setup-U3EQNK4Z.js.map} +0 -0
  118. /package/dist/{visual-6K3FOUEP.js.map → visual-JDAS4R43.js.map} +0 -0
  119. /package/dist/{watch-6I73YNFW.js.map → watch-GB2M7XU6.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  blocksToMarkdown
4
- } from "./chunk-MFA3TJWM.js";
4
+ } from "./chunk-JKHU7HID.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-XM2ZOOEW.js.map
82
+ //# sourceMappingURL=chunk-GSW7W7AL.js.map
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  blocksToPages
4
- } from "./chunk-4RVCC5YD.js";
4
+ } from "./chunk-V7LKQNC4.js";
5
5
  import {
6
6
  allLinesegRemovalSplices,
7
7
  applySplices,
@@ -15,7 +15,7 @@ import {
15
15
  paraTextPureT,
16
16
  patchZipEntries,
17
17
  scanSectionXml
18
- } from "./chunk-PTWSL4FG.js";
18
+ } from "./chunk-6AYTYTFY.js";
19
19
  import {
20
20
  CONVERT_MAP,
21
21
  FLAG_COMPRESSED,
@@ -65,7 +65,7 @@ import {
65
65
  romanNumeral,
66
66
  simulateWrap,
67
67
  takeTocLeaders
68
- } from "./chunk-4SKWUNN7.js";
68
+ } from "./chunk-SVIOP7PE.js";
69
69
  import {
70
70
  CELL_EDGES,
71
71
  HEADING_RATIO_H1,
@@ -77,7 +77,7 @@ import {
77
77
  tidyScriptTags,
78
78
  unframeLayoutTables,
79
79
  wrapScript
80
- } from "./chunk-R2NGHNS3.js";
80
+ } from "./chunk-XVB3PUPJ.js";
81
81
  import {
82
82
  parsePageRange
83
83
  } from "./chunk-VQFA55IC.js";
@@ -96,7 +96,7 @@ import {
96
96
  findChildByLocalName,
97
97
  localName,
98
98
  rawTextContent
99
- } from "./chunk-PTLYGMNQ.js";
99
+ } from "./chunk-DHEUQXXR.js";
100
100
  import {
101
101
  MAX_COLS,
102
102
  MAX_ROWS,
@@ -111,7 +111,7 @@ import {
111
111
  hasStructuredCellContent,
112
112
  mapPuaText,
113
113
  noteSuffix
114
- } from "./chunk-MFA3TJWM.js";
114
+ } from "./chunk-JKHU7HID.js";
115
115
  import {
116
116
  KordocError,
117
117
  classifyError,
@@ -127,7 +127,7 @@ import {
127
127
  toArrayBuffer,
128
128
  unescapeHtml,
129
129
  unzipLimitBytes
130
- } from "./chunk-5V4XXKGX.js";
130
+ } from "./chunk-PN5WWW56.js";
131
131
 
132
132
  // src/table/visual.ts
133
133
  import { readFile as readFile2 } from "fs/promises";
@@ -30157,7 +30157,7 @@ function scriptsOff(r, off) {
30157
30157
  }
30158
30158
  async function parseImage(buffer, options) {
30159
30159
  try {
30160
- const { parseImageDocument } = await import("./image-ocr-UOAHUR4Y.js");
30160
+ const { parseImageDocument } = await import("./image-ocr-PAF76DAW.js");
30161
30161
  const { blocks, warnings } = await parseImageDocument(buffer, options);
30162
30162
  stripScriptTags({ blocks });
30163
30163
  return {
@@ -30217,7 +30217,7 @@ async function parseHwp(buffer, options) {
30217
30217
  async function parsePdf(buffer, options) {
30218
30218
  let parsePdfDocument;
30219
30219
  try {
30220
- const mod = await import("./parser-KPWQK4CU.js");
30220
+ const mod = await import("./parser-I4D3TRGU.js");
30221
30221
  parsePdfDocument = mod.parsePdfDocument;
30222
30222
  } catch {
30223
30223
  return {
@@ -30440,4 +30440,4 @@ export {
30440
30440
  parseHwpml,
30441
30441
  fillForm
30442
30442
  };
30443
- //# sourceMappingURL=chunk-T3AJHRWN.js.map
30443
+ //# sourceMappingURL=chunk-GUH6HYSZ.js.map
@@ -5,11 +5,11 @@ import {
5
5
  HEADING_RATIO_H2,
6
6
  HEADING_RATIO_H3,
7
7
  tidyScriptTags
8
- } from "./chunk-R2NGHNS3.js";
8
+ } from "./chunk-XVB3PUPJ.js";
9
9
  import {
10
10
  safeMax,
11
11
  safeMin
12
- } from "./chunk-5V4XXKGX.js";
12
+ } from "./chunk-PN5WWW56.js";
13
13
 
14
14
  // src/pdf/line-extract.ts
15
15
  import { OPS } from "pdfjs-dist/legacy/build/pdf.mjs";
@@ -2169,8 +2169,10 @@ function wrapJoiner(prevText, nextText, lex) {
2169
2169
  return " ";
2170
2170
  }
2171
2171
  var PARA_LAST_LINE = /* @__PURE__ */ new WeakMap();
2172
+ var PARA_FIRST_LEFT = /* @__PURE__ */ new WeakMap();
2172
2173
  var PAGE_REF_TAIL = /(?:\t|…|·{2}|\.{3})\s*\d{1,4}(?:\s*\/\s*\d{1,4})?\s*$/;
2173
2174
  var PAGE_HEAD_MARK = /^(?:[\u0000-\u001f\ue000-\uf8ff\u25a0-\u25ff\u2750-\u275f<〈《〔\[]|ㅇ\s)/;
2175
+ var PAGE_ITEM_HEAD = /^(?:\S{1,4}\t|\.\d{1,3}\s)/;
2174
2176
  var SENTENCE_END = /[.?!。][”"’」』)]?$/;
2175
2177
  var titleLike = (text) => {
2176
2178
  const t = text.replace(MARKUP, "").trim();
@@ -2183,6 +2185,11 @@ function joinPageBreakWraps(blocks, lex) {
2183
2185
  if (b.type !== "paragraph" || !b.bbox || !b.pageNumber) continue;
2184
2186
  pageRight.set(b.pageNumber, Math.max(pageRight.get(b.pageNumber) ?? -Infinity, b.bbox.x + b.bbox.width));
2185
2187
  }
2188
+ const pageLeft = /* @__PURE__ */ new Map();
2189
+ for (const b of blocks) {
2190
+ if (b.type !== "paragraph" || !b.bbox || !b.pageNumber) continue;
2191
+ pageLeft.set(b.pageNumber, Math.min(pageLeft.get(b.pageNumber) ?? Infinity, b.bbox.x));
2192
+ }
2186
2193
  for (let i = blocks.length - 1; i > 0; i--) {
2187
2194
  const a = blocks[i - 1], b = blocks[i];
2188
2195
  if (!a.pageNumber || b.pageNumber !== a.pageNumber + 1 || !a.text || !b.text) continue;
@@ -2190,9 +2197,14 @@ function joinPageBreakWraps(blocks, lex) {
2190
2197
  const last = a.bbox && PARA_LAST_LINE.get(a.bbox), fs = last ? last.fontSize : 0;
2191
2198
  if (!last || fs <= 0 || (pageRight.get(a.pageNumber) ?? Infinity) - last.right >= BODY_FULL_TOL * fs) continue;
2192
2199
  if (last.width < BODY_MIN_WIDTH_EM * fs || Math.abs((b.style?.fontSize ?? 0) - fs) > 0.15 * fs) continue;
2193
- if (startsNewItem(a.text, b.text) || PAGE_REF_TAIL.test(a.text) || PAGE_HEAD_MARK.test(b.text.replace(MARKUP, ""))) continue;
2194
- if (SENTENCE_END.test(a.text.replace(MARKUP, "").trimEnd())) continue;
2200
+ const bt = b.text.replace(MARKUP, "");
2201
+ if (startsNewItem(a.text, b.text) || PAGE_REF_TAIL.test(a.text) || PAGE_ITEM_HEAD.test(bt)) continue;
2202
+ if (PAGE_HEAD_MARK.test(bt) && !(/^[\u25a0-\u25ff]/.test(bt) && a.text.includes(bt[0]))) continue;
2203
+ const firstLeft = b.bbox && PARA_FIRST_LEFT.get(b.bbox);
2204
+ const indented = firstLeft === void 0 || firstLeft - (pageLeft.get(b.pageNumber) ?? firstLeft) >= 0.3 * fs;
2205
+ if (indented && SENTENCE_END.test(a.text.replace(MARKUP, "").trimEnd())) continue;
2195
2206
  if (Math.round(b.style?.fontSize ?? 0) !== Math.round(fs) && titleLike(b.text)) continue;
2207
+ if (/\t/.test(a.text.slice(a.text.lastIndexOf("\n") + 1).replace(/^\S{1,8}\t/, "")) && titleLike(bt.trim().split("\n")[0])) continue;
2196
2208
  const head = a.text, joiner = wrapJoiner(a.text, b.text, lex);
2197
2209
  a.text += joiner + b.text;
2198
2210
  const later = b.bbox && PAGE_BREAK_JOINS.get(b.bbox) || [];
@@ -3560,6 +3572,7 @@ function pushLineParagraphs(out, yLines, pageNum, lex) {
3560
3572
  joins[1] = "\n";
3561
3573
  }
3562
3574
  for (let i = 0; i < lines.length; ) {
3575
+ const first2 = i;
3563
3576
  let text = lines[i].text;
3564
3577
  const items = [...lines[i].items];
3565
3578
  const srcLines = [lines[i].items];
@@ -3574,6 +3587,7 @@ function pushLineParagraphs(out, yLines, pageNum, lex) {
3574
3587
  for (const it of items) faces.set(it.fontName, (faces.get(it.fontName) ?? 0) + it.text.length);
3575
3588
  FACE_CHARS.set(block, faces);
3576
3589
  PARA_LAST_LINE.set(block.bbox, { right: geo[i].right, width: geo[i].right - geo[i].left, fontSize: geo[i].fontSize });
3590
+ PARA_FIRST_LEFT.set(block.bbox, geo[first2].left);
3577
3591
  out.push(block);
3578
3592
  i++;
3579
3593
  }
@@ -8284,4 +8298,4 @@ export {
8284
8298
  removeSideTabs,
8285
8299
  extractPageBlocksWithLines
8286
8300
  };
8287
- //# sourceMappingURL=chunk-G2PGKJUH.js.map
8301
+ //# sourceMappingURL=chunk-INESPVEV.js.map