kordoc 4.23.1 → 4.24.0

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 (126) hide show
  1. package/README.md +2 -1
  2. package/dist/{-6U2DXAP7.js → -VEOO4BOM.js} +13 -11
  3. package/dist/{chunk-Q6T5BIWZ.js → chunk-3M2BIQLZ.js} +2 -2
  4. package/dist/{chunk-FDRIJEES.js → chunk-4VPN5MHS.js} +2 -2
  5. package/dist/{chunk-K6CTZQZW.js → chunk-55DOBEGD.js} +2 -2
  6. package/dist/{chunk-QV367L5S.js → chunk-6YDPTTIY.js} +2 -2
  7. package/dist/{chunk-5BGQOKZS.js → chunk-CKCJU42Y.js} +6 -6
  8. package/dist/{chunk-B4WJQMSZ.js → chunk-DBPDAG7N.js} +2 -2
  9. package/dist/{chunk-4RQYUDGT.cjs → chunk-DKWEZWCF.cjs} +3 -3
  10. package/dist/{chunk-4RQYUDGT.cjs.map → chunk-DKWEZWCF.cjs.map} +1 -1
  11. package/dist/{chunk-KMHHSOSR.js → chunk-DM5YPONO.js} +2 -2
  12. package/dist/{chunk-Q2SOQOWP.cjs → chunk-DZT3CHNZ.cjs} +3 -3
  13. package/dist/{chunk-Q2SOQOWP.cjs.map → chunk-DZT3CHNZ.cjs.map} +1 -1
  14. package/dist/{chunk-SSKZ2KL2.js → chunk-EN3PK6OT.js} +2 -2
  15. package/dist/{chunk-RJZQLUGW.js → chunk-ENCAYXDI.js} +4 -4
  16. package/dist/{chunk-27HAGR4H.cjs → chunk-FHFPQ6MX.cjs} +24 -24
  17. package/dist/{chunk-27HAGR4H.cjs.map → chunk-FHFPQ6MX.cjs.map} +1 -1
  18. package/dist/{chunk-UZZGT6XI.js → chunk-G4HWEM6Q.js} +4 -4
  19. package/dist/{chunk-CU7WLAPQ.js → chunk-GEY6ZMXH.js} +110 -11
  20. package/dist/chunk-GEY6ZMXH.js.map +1 -0
  21. package/dist/{chunk-SQS4D55F.js → chunk-H5PDQ66I.js} +3 -3
  22. package/dist/{chunk-T63JP3GD.cjs → chunk-HOXHBG4C.cjs} +2 -2
  23. package/dist/{chunk-T63JP3GD.cjs.map → chunk-HOXHBG4C.cjs.map} +1 -1
  24. package/dist/{chunk-PWHYNFTN.cjs → chunk-IHNIPVPJ.cjs} +6 -6
  25. package/dist/{chunk-PWHYNFTN.cjs.map → chunk-IHNIPVPJ.cjs.map} +1 -1
  26. package/dist/{chunk-IMS56622.js → chunk-IZYYKE5F.js} +2 -2
  27. package/dist/{chunk-XBTFGKMR.js → chunk-O2SLKE4L.js} +2 -2
  28. package/dist/{chunk-TSKGMN46.cjs → chunk-OHDGEGDJ.cjs} +23 -23
  29. package/dist/{chunk-TSKGMN46.cjs.map → chunk-OHDGEGDJ.cjs.map} +1 -1
  30. package/dist/{chunk-KWBPDHFT.js → chunk-OJISMR2Z.js} +2 -2
  31. package/dist/{chunk-KPCGYMQK.js → chunk-P35SCAJN.js} +2 -2
  32. package/dist/{chunk-DE7ETARS.js → chunk-P6FNIU5P.js} +2 -2
  33. package/dist/{chunk-KRK65GHM.js → chunk-PX6X4YOR.js} +4 -4
  34. package/dist/{chunk-ZC3WNCZV.js → chunk-SRUBDR3Z.js} +3 -3
  35. package/dist/{chunk-YPTW52ZJ.js → chunk-XLY5ZJRP.js} +2 -2
  36. package/dist/{chunk-WG43OZYN.js → chunk-Z5G6QNVH.js} +2 -2
  37. package/dist/{chunk-H7K2FTV2.js → chunk-Z62PHCSU.js} +3 -3
  38. package/dist/{chunk-EEM4AJTY.js → chunk-ZGNHJCDR.js} +2 -2
  39. package/dist/chunks-LV5EJBZ4.js +10 -0
  40. package/dist/cli.js +57 -30
  41. package/dist/cli.js.map +1 -1
  42. package/dist/{formula-73LPYA6R.js → formula-4GRNVWIQ.js} +4 -4
  43. package/dist/{formula-L3RKXO2Z.js → formula-6Y467S4R.js} +3 -3
  44. package/dist/{formula-6FPGJ7PI.cjs → formula-R3OWFGCZ.cjs} +9 -9
  45. package/dist/{formula-6FPGJ7PI.cjs.map → formula-R3OWFGCZ.cjs.map} +1 -1
  46. package/dist/{image-ocr-37S4CHFI.js → image-ocr-CGJJCD4E.js} +9 -9
  47. package/dist/{image-ocr-4IW435IF.cjs → image-ocr-EBKG45KF.cjs} +17 -17
  48. package/dist/{image-ocr-4IW435IF.cjs.map → image-ocr-EBKG45KF.cjs.map} +1 -1
  49. package/dist/{image-ocr-R42ZVGCH.js → image-ocr-ZLL66KNO.js} +6 -6
  50. package/dist/index.cjs +436 -337
  51. package/dist/index.cjs.map +1 -1
  52. package/dist/index.d.cts +47 -1
  53. package/dist/index.d.ts +47 -1
  54. package/dist/index.js +105 -6
  55. package/dist/index.js.map +1 -1
  56. package/dist/mcp.js +40 -27
  57. package/dist/mcp.js.map +1 -1
  58. package/dist/{model-bundle-L3TZDQJF.js → model-bundle-RD4KSNTB.js} +5 -5
  59. package/dist/{models-2IDIYAGL.js → models-OLGCZBXI.js} +5 -5
  60. package/dist/{parse-worker-v2-NVI6YJN6.js → parse-worker-v2-YZY2GQY5.js} +51 -15
  61. package/dist/parse-worker-v2-YZY2GQY5.js.map +1 -0
  62. package/dist/{parser-M7HKGKEN.cjs → parser-DX4I3GT7.cjs} +157 -157
  63. package/dist/{parser-M7HKGKEN.cjs.map → parser-DX4I3GT7.cjs.map} +1 -1
  64. package/dist/{parser-KHVN5B3I.js → parser-IHCFHLHN.js} +12 -12
  65. package/dist/{parser-7BDTFYHE.js → parser-J22QBXPP.js} +9 -9
  66. package/dist/{pdf-ocr-XFMBTHEE.js → pdf-ocr-H2247ZZH.js} +6 -6
  67. package/dist/{pdf-ocr-EYDE264W.js → pdf-ocr-TYIH23RP.js} +9 -9
  68. package/dist/pdf-ocr-WU7SZHWM.cjs +31 -0
  69. package/dist/{pdf-ocr-HUL7G577.cjs.map → pdf-ocr-WU7SZHWM.cjs.map} +1 -1
  70. package/dist/{profile-io-FDA5PEW2.js → profile-io-GH3TYTNJ.js} +3 -3
  71. package/dist/{rasterize-NR6JJSJV.js → rasterize-7TFTVFMB.js} +3 -3
  72. package/dist/{redact-doc-K74LDR3O.js → redact-doc-DSSQOO3A.js} +11 -11
  73. package/dist/{render-RM5BAYGB.js → render-NKXZQINI.js} +7 -7
  74. package/dist/seal-JIVSSI3Z.js +10 -0
  75. package/dist/{setup-M4RKKK3P.js → setup-JVLMX2TH.js} +3 -3
  76. package/dist/visual-BKVZN6HP.js +21 -0
  77. package/dist/{watch-ZWD4LADV.js → watch-5RZVHAKI.js} +12 -12
  78. package/package.json +1 -1
  79. package/dist/chunk-CU7WLAPQ.js.map +0 -1
  80. package/dist/chunks-FPFZZPUE.js +0 -10
  81. package/dist/parse-worker-v2-NVI6YJN6.js.map +0 -1
  82. package/dist/pdf-ocr-HUL7G577.cjs +0 -31
  83. package/dist/seal-LRVVOPOD.js +0 -10
  84. package/dist/visual-WTFQPXO2.js +0 -21
  85. /package/dist/{-6U2DXAP7.js.map → -VEOO4BOM.js.map} +0 -0
  86. /package/dist/{chunk-Q6T5BIWZ.js.map → chunk-3M2BIQLZ.js.map} +0 -0
  87. /package/dist/{chunk-FDRIJEES.js.map → chunk-4VPN5MHS.js.map} +0 -0
  88. /package/dist/{chunk-K6CTZQZW.js.map → chunk-55DOBEGD.js.map} +0 -0
  89. /package/dist/{chunk-QV367L5S.js.map → chunk-6YDPTTIY.js.map} +0 -0
  90. /package/dist/{chunk-5BGQOKZS.js.map → chunk-CKCJU42Y.js.map} +0 -0
  91. /package/dist/{chunk-B4WJQMSZ.js.map → chunk-DBPDAG7N.js.map} +0 -0
  92. /package/dist/{chunk-KMHHSOSR.js.map → chunk-DM5YPONO.js.map} +0 -0
  93. /package/dist/{chunk-SSKZ2KL2.js.map → chunk-EN3PK6OT.js.map} +0 -0
  94. /package/dist/{chunk-RJZQLUGW.js.map → chunk-ENCAYXDI.js.map} +0 -0
  95. /package/dist/{chunk-UZZGT6XI.js.map → chunk-G4HWEM6Q.js.map} +0 -0
  96. /package/dist/{chunk-SQS4D55F.js.map → chunk-H5PDQ66I.js.map} +0 -0
  97. /package/dist/{chunk-IMS56622.js.map → chunk-IZYYKE5F.js.map} +0 -0
  98. /package/dist/{chunk-XBTFGKMR.js.map → chunk-O2SLKE4L.js.map} +0 -0
  99. /package/dist/{chunk-KWBPDHFT.js.map → chunk-OJISMR2Z.js.map} +0 -0
  100. /package/dist/{chunk-KPCGYMQK.js.map → chunk-P35SCAJN.js.map} +0 -0
  101. /package/dist/{chunk-DE7ETARS.js.map → chunk-P6FNIU5P.js.map} +0 -0
  102. /package/dist/{chunk-KRK65GHM.js.map → chunk-PX6X4YOR.js.map} +0 -0
  103. /package/dist/{chunk-ZC3WNCZV.js.map → chunk-SRUBDR3Z.js.map} +0 -0
  104. /package/dist/{chunk-YPTW52ZJ.js.map → chunk-XLY5ZJRP.js.map} +0 -0
  105. /package/dist/{chunk-WG43OZYN.js.map → chunk-Z5G6QNVH.js.map} +0 -0
  106. /package/dist/{chunk-H7K2FTV2.js.map → chunk-Z62PHCSU.js.map} +0 -0
  107. /package/dist/{chunk-EEM4AJTY.js.map → chunk-ZGNHJCDR.js.map} +0 -0
  108. /package/dist/{chunks-FPFZZPUE.js.map → chunks-LV5EJBZ4.js.map} +0 -0
  109. /package/dist/{formula-73LPYA6R.js.map → formula-4GRNVWIQ.js.map} +0 -0
  110. /package/dist/{formula-L3RKXO2Z.js.map → formula-6Y467S4R.js.map} +0 -0
  111. /package/dist/{image-ocr-37S4CHFI.js.map → image-ocr-CGJJCD4E.js.map} +0 -0
  112. /package/dist/{image-ocr-R42ZVGCH.js.map → image-ocr-ZLL66KNO.js.map} +0 -0
  113. /package/dist/{model-bundle-L3TZDQJF.js.map → model-bundle-RD4KSNTB.js.map} +0 -0
  114. /package/dist/{models-2IDIYAGL.js.map → models-OLGCZBXI.js.map} +0 -0
  115. /package/dist/{parser-KHVN5B3I.js.map → parser-IHCFHLHN.js.map} +0 -0
  116. /package/dist/{parser-7BDTFYHE.js.map → parser-J22QBXPP.js.map} +0 -0
  117. /package/dist/{pdf-ocr-EYDE264W.js.map → pdf-ocr-H2247ZZH.js.map} +0 -0
  118. /package/dist/{pdf-ocr-XFMBTHEE.js.map → pdf-ocr-TYIH23RP.js.map} +0 -0
  119. /package/dist/{profile-io-FDA5PEW2.js.map → profile-io-GH3TYTNJ.js.map} +0 -0
  120. /package/dist/{rasterize-NR6JJSJV.js.map → rasterize-7TFTVFMB.js.map} +0 -0
  121. /package/dist/{redact-doc-K74LDR3O.js.map → redact-doc-DSSQOO3A.js.map} +0 -0
  122. /package/dist/{render-RM5BAYGB.js.map → render-NKXZQINI.js.map} +0 -0
  123. /package/dist/{seal-LRVVOPOD.js.map → seal-JIVSSI3Z.js.map} +0 -0
  124. /package/dist/{setup-M4RKKK3P.js.map → setup-JVLMX2TH.js.map} +0 -0
  125. /package/dist/{visual-WTFQPXO2.js.map → visual-BKVZN6HP.js.map} +0 -0
  126. /package/dist/{watch-ZWD4LADV.js.map → watch-5RZVHAKI.js.map} +0 -0
@@ -10,14 +10,14 @@ import {
10
10
  ocrSourcePath,
11
11
  parseCharacterDict,
12
12
  resolveOcrModels
13
- } from "./chunk-KRK65GHM.js";
13
+ } from "./chunk-PX6X4YOR.js";
14
14
  import {
15
15
  validateOcrOptions
16
- } from "./chunk-QV367L5S.js";
16
+ } from "./chunk-6YDPTTIY.js";
17
17
  import {
18
18
  KordocError,
19
19
  OPTIONAL_DEP_INSTALL_HINT
20
- } from "./chunk-YPTW52ZJ.js";
20
+ } from "./chunk-XLY5ZJRP.js";
21
21
 
22
22
  // src/ocr/ruling-lines.ts
23
23
  var INK_LUMA_MAX = 205;
@@ -2212,4 +2212,4 @@ export {
2212
2212
  groupOcrLines,
2213
2213
  ocrItemsToBlocks
2214
2214
  };
2215
- //# sourceMappingURL=chunk-UZZGT6XI.js.map
2215
+ //# sourceMappingURL=chunk-G4HWEM6Q.js.map
@@ -51,10 +51,10 @@ import {
51
51
  resolveParaHeading,
52
52
  simulateWrap,
53
53
  takeTocLeaders
54
- } from "./chunk-5BGQOKZS.js";
54
+ } from "./chunk-CKCJU42Y.js";
55
55
  import {
56
56
  blocksToPages
57
- } from "./chunk-SSKZ2KL2.js";
57
+ } from "./chunk-EN3PK6OT.js";
58
58
  import {
59
59
  bmpToPng,
60
60
  inlineImagesIntoMarkdown
@@ -76,7 +76,7 @@ import {
76
76
  tidyScriptTags,
77
77
  unframeLayoutTables,
78
78
  wrapScript
79
- } from "./chunk-DE7ETARS.js";
79
+ } from "./chunk-P6FNIU5P.js";
80
80
  import {
81
81
  MAX_COLS,
82
82
  MAX_ROWS,
@@ -99,7 +99,7 @@ import {
99
99
  noteTableHtml,
100
100
  sanitizeText,
101
101
  visibleText
102
- } from "./chunk-B4WJQMSZ.js";
102
+ } from "./chunk-DBPDAG7N.js";
103
103
  import {
104
104
  ANNOTATION_BLANK_RE,
105
105
  ValueCursor,
@@ -132,7 +132,7 @@ import {
132
132
  resolveUnmatched,
133
133
  scanInlineSegments,
134
134
  scanSectionXml
135
- } from "./chunk-H7K2FTV2.js";
135
+ } from "./chunk-Z62PHCSU.js";
136
136
  import {
137
137
  MAX_DECOMPRESS_SIZE,
138
138
  MAX_XML_DEPTH,
@@ -149,7 +149,7 @@ import {
149
149
  localName,
150
150
  rawTextContent,
151
151
  readZipEntry
152
- } from "./chunk-K6CTZQZW.js";
152
+ } from "./chunk-55DOBEGD.js";
153
153
  import {
154
154
  KordocError,
155
155
  classifyError,
@@ -165,7 +165,7 @@ import {
165
165
  toArrayBuffer,
166
166
  unescapeHtml,
167
167
  unzipLimitBytes
168
- } from "./chunk-WG43OZYN.js";
168
+ } from "./chunk-Z5G6QNVH.js";
169
169
 
170
170
  // src/table/visual.ts
171
171
  import { readFile as readFile2 } from "fs/promises";
@@ -19329,7 +19329,7 @@ var MIN_SIDE = 24;
19329
19329
  async function ocrEmbeddedImages(blocks, options, warnings) {
19330
19330
  const ocr = options?.ocr;
19331
19331
  if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
19332
- const { parseImageDocument } = await import("./image-ocr-37S4CHFI.js");
19332
+ const { parseImageDocument } = await import("./image-ocr-CGJJCD4E.js");
19333
19333
  let inserted = false, unreadable = 0;
19334
19334
  let failed = null;
19335
19335
  const walk = async (list, depth) => {
@@ -29897,6 +29897,104 @@ function runLintSuite(text, opts = {}) {
29897
29897
  };
29898
29898
  }
29899
29899
 
29900
+ // src/hwpx/lint-blocks.ts
29901
+ var MARKDOWN_STRUCTURE = /^\s*(?:```|~~~|#|\||>)/;
29902
+ var safeLine = (text) => text.replace(/[\r\n]/g, " ");
29903
+ var safeCell = (text) => safeLine(text).replace(/\|/g, "\uFF5C");
29904
+ function blocksToLines(blocks) {
29905
+ const lines = [];
29906
+ const paragraph = (block) => {
29907
+ const text = safeLine(block.text);
29908
+ const prefix = MARKDOWN_STRUCTURE.test(text) ? "\\" : "";
29909
+ lines.push({ text: prefix + text, segments: [{ start: prefix.length, length: text.length, block: block.id }] });
29910
+ };
29911
+ const tables = /* @__PURE__ */ new Map();
29912
+ for (const b of blocks) if (b.table) (tables.get(b.table.id) ?? tables.set(b.table.id, []).get(b.table.id)).push(b);
29913
+ const emitted = /* @__PURE__ */ new Set();
29914
+ for (const b of blocks) {
29915
+ if (!b.table) {
29916
+ paragraph(b);
29917
+ continue;
29918
+ }
29919
+ if (emitted.has(b.table.id)) continue;
29920
+ emitted.add(b.table.id);
29921
+ const cells = tables.get(b.table.id);
29922
+ if (cells.length === 1) {
29923
+ paragraph(cells[0]);
29924
+ continue;
29925
+ }
29926
+ const rows = cells.reduce((n, c) => Math.max(n, c.table.row + 1), 0);
29927
+ const cols = cells.reduce((n, c) => Math.max(n, c.table.col + 1), 0);
29928
+ const at = new Map(cells.map((c) => [`${c.table.row},${c.table.col}`, c]));
29929
+ lines.push({ text: "", segments: [] });
29930
+ for (let r = 0; r < rows; r++) {
29931
+ let text = "|";
29932
+ const segments = [];
29933
+ for (let c = 0; c < cols; c++) {
29934
+ text += " ";
29935
+ const cell2 = at.get(`${r},${c}`);
29936
+ if (cell2) {
29937
+ const t = safeCell(cell2.text);
29938
+ segments.push({ start: text.length, length: t.length, block: cell2.id });
29939
+ text += t;
29940
+ }
29941
+ text += " |";
29942
+ }
29943
+ lines.push({ text, segments });
29944
+ if (r === 0) lines.push({ text: "|" + " --- |".repeat(cols), segments: [] });
29945
+ }
29946
+ lines.push({ text: "", segments: [] });
29947
+ }
29948
+ return lines;
29949
+ }
29950
+ function locate(lines, f) {
29951
+ const line = lines[f.line - 1];
29952
+ if (!line) return { block: null, offset: null };
29953
+ if (f.column !== void 0) {
29954
+ const at = f.column - 1;
29955
+ const seg2 = line.segments.find((s) => at >= s.start && at < s.start + Math.max(1, s.length)) ?? line.segments.find((s) => line.text.indexOf(f.match, s.start) >= s.start && line.text.indexOf(f.match, s.start) < s.start + s.length);
29956
+ if (seg2) {
29957
+ const found = line.text.indexOf(f.match, Math.max(seg2.start, at));
29958
+ const start = found >= seg2.start && found < seg2.start + seg2.length ? found : at;
29959
+ return { block: seg2.block, offset: Math.min(Math.max(0, start - seg2.start), seg2.length) };
29960
+ }
29961
+ return { block: null, offset: null };
29962
+ }
29963
+ if (line.segments.length !== 1) return { block: null, offset: null };
29964
+ const seg = line.segments[0];
29965
+ const body = line.text.slice(seg.start, seg.start + seg.length);
29966
+ const first = f.match ? body.indexOf(f.match) : -1;
29967
+ const unique = first >= 0 && body.indexOf(f.match, first + 1) < 0;
29968
+ return { block: seg.block, offset: unique ? first : null };
29969
+ }
29970
+ function lintBlocks(blocks, opts = {}) {
29971
+ const lines = blocksToLines(blocks);
29972
+ const suite = runLintSuite(lines.map((l) => l.text).join("\n") + "\n", opts);
29973
+ const findings = [];
29974
+ const take = (category, list) => {
29975
+ for (const f of list ?? []) {
29976
+ const { block, offset } = locate(lines, f);
29977
+ findings.push({
29978
+ block,
29979
+ offset,
29980
+ length: f.match.length,
29981
+ category,
29982
+ rule: f.rule,
29983
+ severity: f.severity,
29984
+ match: f.match,
29985
+ message: f.message,
29986
+ ...f.suggest ? { suggest: f.suggest } : {}
29987
+ });
29988
+ }
29989
+ };
29990
+ take("notation", suite.findings);
29991
+ take("munche", suite.munche);
29992
+ take("slop", suite.slop);
29993
+ take("logic", suite.logic);
29994
+ take("budget", suite.budget);
29995
+ return { findings, ...suite.numbers ? { numbers: suite.numbers } : {}, summary: suite.summary };
29996
+ }
29997
+
29900
29998
  // src/roundtrip/patcher.ts
29901
29999
  import JSZip11 from "jszip";
29902
30000
 
@@ -32941,7 +33039,7 @@ function scriptsOff(r, off) {
32941
33039
  }
32942
33040
  async function parseImage(buffer, options) {
32943
33041
  try {
32944
- const { parseImageDocument } = await import("./image-ocr-37S4CHFI.js");
33042
+ const { parseImageDocument } = await import("./image-ocr-CGJJCD4E.js");
32945
33043
  const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
32946
33044
  stripScriptTags({ blocks });
32947
33045
  return {
@@ -33005,7 +33103,7 @@ async function parseHwp(buffer, options) {
33005
33103
  async function parsePdf(buffer, options) {
33006
33104
  let parsePdfDocument;
33007
33105
  try {
33008
- const mod = await import("./parser-KHVN5B3I.js");
33106
+ const mod = await import("./parser-IHCFHLHN.js");
33009
33107
  parsePdfDocument = mod.parsePdfDocument;
33010
33108
  } catch {
33011
33109
  return {
@@ -33214,6 +33312,7 @@ export {
33214
33312
  formatGateFinding,
33215
33313
  lintBudgetText,
33216
33314
  runLintSuite,
33315
+ lintBlocks,
33217
33316
  replaceOleStream,
33218
33317
  wipeFreeSectors,
33219
33318
  patchHwp,
@@ -33237,4 +33336,4 @@ export {
33237
33336
  parseHwpml,
33238
33337
  fillForm
33239
33338
  };
33240
- //# sourceMappingURL=chunk-CU7WLAPQ.js.map
33339
+ //# sourceMappingURL=chunk-GEY6ZMXH.js.map