kordoc 4.2.7 → 4.2.9

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 (89) hide show
  1. package/dist/{-7TEU6IRU.js → -ECUCTQTR.js} +9 -9
  2. package/dist/{chunk-AES6PHIG.js → chunk-27Z4PUZZ.js} +3 -3
  3. package/dist/{chunk-62DHK6KT.js → chunk-3PLF5UIS.js} +2 -2
  4. package/dist/{chunk-G2AS6ICC.js → chunk-3TSTZGCJ.js} +2 -2
  5. package/dist/{chunk-RS5OID2J.cjs → chunk-4ZWKFDUC.cjs} +9 -9
  6. package/dist/{chunk-RS5OID2J.cjs.map → chunk-4ZWKFDUC.cjs.map} +1 -1
  7. package/dist/{chunk-VWXA47AW.cjs → chunk-6GM2QLM3.cjs} +4 -4
  8. package/dist/{chunk-VWXA47AW.cjs.map → chunk-6GM2QLM3.cjs.map} +1 -1
  9. package/dist/{chunk-IVX3YLQH.js → chunk-7ZARSBQ3.js} +2 -2
  10. package/dist/chunk-7ZARSBQ3.js.map +1 -0
  11. package/dist/{chunk-LPRNVK4G.js → chunk-G3DMDTZI.js} +64 -39
  12. package/dist/chunk-G3DMDTZI.js.map +1 -0
  13. package/dist/{chunk-HH4SD5RE.cjs → chunk-GZ7W64QU.cjs} +2 -2
  14. package/dist/{chunk-HH4SD5RE.cjs.map → chunk-GZ7W64QU.cjs.map} +1 -1
  15. package/dist/{chunk-PK5GLL5C.js → chunk-KTPZYXN2.js} +2 -2
  16. package/dist/{chunk-GJO3ORFW.js → chunk-LM7C6HI2.js} +1 -1
  17. package/dist/chunk-LM7C6HI2.js.map +1 -0
  18. package/dist/{chunk-5HFKMCAX.js → chunk-LXE7OR6N.js} +2 -2
  19. package/dist/{chunk-T6BTWUTC.js → chunk-MHMVFI2N.js} +2 -2
  20. package/dist/{chunk-NAWC6HTC.js → chunk-NIISBGSR.js} +2 -2
  21. package/dist/chunk-NIISBGSR.js.map +1 -0
  22. package/dist/{chunk-YTRJDQ4Q.cjs → chunk-PATPZTH7.cjs} +3 -3
  23. package/dist/{chunk-YTRJDQ4Q.cjs.map → chunk-PATPZTH7.cjs.map} +1 -1
  24. package/dist/{chunk-YAQRGQUJ.js → chunk-STYN45MS.js} +2 -2
  25. package/dist/{chunk-2CHFQQXM.js → chunk-VEHC4EJL.js} +2 -2
  26. package/dist/{chunk-FSUCQ6ZM.js → chunk-WTT2KJOM.js} +4 -4
  27. package/dist/chunk-WTT2KJOM.js.map +1 -0
  28. package/dist/{chunk-ESV4KOSE.js → chunk-XU4VWOKL.js} +3 -3
  29. package/dist/{chunk-NKERQ6GB.js → chunk-YR4PF56B.js} +2 -2
  30. package/dist/chunks-VFIMYK36.js +10 -0
  31. package/dist/cli.js +17 -17
  32. package/dist/{image-ocr-UX4QM35J.cjs → image-ocr-J5656BEE.cjs} +9 -9
  33. package/dist/{image-ocr-UX4QM35J.cjs.map → image-ocr-J5656BEE.cjs.map} +1 -1
  34. package/dist/{image-ocr-PGQ7JPDP.js → image-ocr-KZTNJ62U.js} +5 -5
  35. package/dist/{image-ocr-OS4ETBOL.js → image-ocr-PS7XCV6K.js} +4 -4
  36. package/dist/index.cjs +491 -466
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +6 -0
  39. package/dist/index.d.ts +6 -0
  40. package/dist/index.js +60 -35
  41. package/dist/index.js.map +1 -1
  42. package/dist/mcp.js +15 -15
  43. package/dist/{parser-2JAC5WMM.js → parser-A34NAYKA.js} +5 -5
  44. package/dist/{parser-GAZROLSA.cjs → parser-CSYU3CAW.cjs} +24 -24
  45. package/dist/{parser-GAZROLSA.cjs.map → parser-CSYU3CAW.cjs.map} +1 -1
  46. package/dist/{parser-T74C7Q57.js → parser-WNFWMBSL.js} +6 -6
  47. package/dist/pdf-ocr-KBMWPG2L.js +12 -0
  48. package/dist/{pdf-ocr-3A3QLPID.js → pdf-ocr-NPZG67FN.js} +5 -5
  49. package/dist/pdf-ocr-O44DAGTY.cjs +13 -0
  50. package/dist/{pdf-ocr-2SKGRXIR.cjs.map → pdf-ocr-O44DAGTY.cjs.map} +1 -1
  51. package/dist/{profile-io-6GX564CO.js → profile-io-43MF52H6.js} +3 -3
  52. package/dist/{rasterize-4V7PKE7A.js → rasterize-OG7KXBJS.js} +2 -2
  53. package/dist/render-336CJHAS.js +10 -0
  54. package/dist/seal-TM2XCE2R.js +10 -0
  55. package/dist/{watch-JVRAAJNA.js → watch-SOHQMZN2.js} +9 -9
  56. package/package.json +1 -1
  57. package/dist/chunk-FSUCQ6ZM.js.map +0 -1
  58. package/dist/chunk-GJO3ORFW.js.map +0 -1
  59. package/dist/chunk-IVX3YLQH.js.map +0 -1
  60. package/dist/chunk-LPRNVK4G.js.map +0 -1
  61. package/dist/chunk-NAWC6HTC.js.map +0 -1
  62. package/dist/chunks-TLAOHNPB.js +0 -10
  63. package/dist/pdf-ocr-2SKGRXIR.cjs +0 -13
  64. package/dist/pdf-ocr-WBOTDQ4D.js +0 -12
  65. package/dist/render-2AF7GZVN.js +0 -10
  66. package/dist/seal-2ES6UAN6.js +0 -10
  67. /package/dist/{-7TEU6IRU.js.map → -ECUCTQTR.js.map} +0 -0
  68. /package/dist/{chunk-AES6PHIG.js.map → chunk-27Z4PUZZ.js.map} +0 -0
  69. /package/dist/{chunk-62DHK6KT.js.map → chunk-3PLF5UIS.js.map} +0 -0
  70. /package/dist/{chunk-G2AS6ICC.js.map → chunk-3TSTZGCJ.js.map} +0 -0
  71. /package/dist/{chunk-PK5GLL5C.js.map → chunk-KTPZYXN2.js.map} +0 -0
  72. /package/dist/{chunk-5HFKMCAX.js.map → chunk-LXE7OR6N.js.map} +0 -0
  73. /package/dist/{chunk-T6BTWUTC.js.map → chunk-MHMVFI2N.js.map} +0 -0
  74. /package/dist/{chunk-YAQRGQUJ.js.map → chunk-STYN45MS.js.map} +0 -0
  75. /package/dist/{chunk-2CHFQQXM.js.map → chunk-VEHC4EJL.js.map} +0 -0
  76. /package/dist/{chunk-ESV4KOSE.js.map → chunk-XU4VWOKL.js.map} +0 -0
  77. /package/dist/{chunk-NKERQ6GB.js.map → chunk-YR4PF56B.js.map} +0 -0
  78. /package/dist/{chunks-TLAOHNPB.js.map → chunks-VFIMYK36.js.map} +0 -0
  79. /package/dist/{image-ocr-PGQ7JPDP.js.map → image-ocr-KZTNJ62U.js.map} +0 -0
  80. /package/dist/{image-ocr-OS4ETBOL.js.map → image-ocr-PS7XCV6K.js.map} +0 -0
  81. /package/dist/{parser-2JAC5WMM.js.map → parser-A34NAYKA.js.map} +0 -0
  82. /package/dist/{parser-T74C7Q57.js.map → parser-WNFWMBSL.js.map} +0 -0
  83. /package/dist/{pdf-ocr-3A3QLPID.js.map → pdf-ocr-KBMWPG2L.js.map} +0 -0
  84. /package/dist/{pdf-ocr-WBOTDQ4D.js.map → pdf-ocr-NPZG67FN.js.map} +0 -0
  85. /package/dist/{profile-io-6GX564CO.js.map → profile-io-43MF52H6.js.map} +0 -0
  86. /package/dist/{rasterize-4V7PKE7A.js.map → rasterize-OG7KXBJS.js.map} +0 -0
  87. /package/dist/{render-2AF7GZVN.js.map → render-336CJHAS.js.map} +0 -0
  88. /package/dist/{seal-2ES6UAN6.js.map → seal-TM2XCE2R.js.map} +0 -0
  89. /package/dist/{watch-JVRAAJNA.js.map → watch-SOHQMZN2.js.map} +0 -0
@@ -6,7 +6,7 @@ import {
6
6
  HEADING_RATIO_H1,
7
7
  HEADING_RATIO_H2,
8
8
  HEADING_RATIO_H3
9
- } from "./chunk-GJO3ORFW.js";
9
+ } from "./chunk-LM7C6HI2.js";
10
10
  import {
11
11
  detectFormat,
12
12
  detectOle2Format,
@@ -27,7 +27,7 @@ import {
27
27
  paraTextPureT,
28
28
  patchZipEntries,
29
29
  scanSectionXml
30
- } from "./chunk-ESV4KOSE.js";
30
+ } from "./chunk-XU4VWOKL.js";
31
31
  import {
32
32
  MAX_COLS,
33
33
  MAX_ROWS,
@@ -37,14 +37,14 @@ import {
37
37
  dedupeRunningHeaders,
38
38
  flattenLayoutTables,
39
39
  mapPuaText
40
- } from "./chunk-T6BTWUTC.js";
40
+ } from "./chunk-MHMVFI2N.js";
41
41
  import {
42
42
  SPACE_EM_FIXED,
43
43
  charWidthEm1000,
44
44
  fitRatioForFewerLines,
45
45
  measureTextWidth,
46
46
  simulateWrap
47
- } from "./chunk-FSUCQ6ZM.js";
47
+ } from "./chunk-WTT2KJOM.js";
48
48
  import {
49
49
  MAX_DECOMPRESS_SIZE,
50
50
  MAX_XML_DEPTH,
@@ -56,7 +56,7 @@ import {
56
56
  createXmlParser,
57
57
  extractTextFromNode,
58
58
  findChildByLocalName
59
- } from "./chunk-NAWC6HTC.js";
59
+ } from "./chunk-NIISBGSR.js";
60
60
  import {
61
61
  KordocError,
62
62
  classifyError,
@@ -68,7 +68,7 @@ import {
68
68
  sanitizeHref,
69
69
  stripDtd,
70
70
  toArrayBuffer
71
- } from "./chunk-G2AS6ICC.js";
71
+ } from "./chunk-3TSTZGCJ.js";
72
72
 
73
73
  // src/index.ts
74
74
  import { readFile } from "fs/promises";
@@ -1385,6 +1385,7 @@ function resolveParaHeading(paraEl, ctx) {
1385
1385
  function buildTableWithCellMeta(state, keepAnchoredEmptyCols) {
1386
1386
  const table2 = buildTable(state.rows, { keepAnchoredEmptyCols });
1387
1387
  if (state.caption) table2.caption = state.caption;
1388
+ if (state.captionBlocks?.length) table2.captionBlocks = state.captionBlocks;
1388
1389
  const anchors = [];
1389
1390
  {
1390
1391
  const covered = /* @__PURE__ */ new Set();
@@ -1532,12 +1533,13 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1532
1533
  }
1533
1534
  // 표/도표 캡션 — IRTable.caption으로 보존 (v3.0, 기존 무음 드롭 수정)
1534
1535
  case "caption": {
1535
- const capText = collectSubListText(el, ctx);
1536
- if (capText) {
1536
+ const cap = collectSubListContent(el, ctx);
1537
+ if (cap.text) {
1537
1538
  if (tableCtx) {
1538
- tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") + capText;
1539
+ tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") + cap.text;
1540
+ if (cap.hasStructure) (tableCtx.captionBlocks ??= []).push(...cap.blocks);
1539
1541
  } else {
1540
- blocks.push({ type: "paragraph", text: capText, pageNumber: ctx.sectionNum });
1542
+ blocks.push({ type: "paragraph", text: cap.text, pageNumber: ctx.sectionNum });
1541
1543
  }
1542
1544
  }
1543
1545
  break;
@@ -1787,40 +1789,60 @@ function hasPageAutoNum(el, depth = 0) {
1787
1789
  return false;
1788
1790
  }
1789
1791
  function collectSubListText(el, ctx, depth = 0) {
1790
- if (depth > 10) return "";
1792
+ return collectSubListContent(el, ctx, depth).text;
1793
+ }
1794
+ function collectSubListContent(el, ctx, depth = 0) {
1795
+ const out = { text: "", blocks: [], hasStructure: false };
1796
+ if (depth > 10) return out;
1791
1797
  const parts = [];
1792
1798
  const children = el.childNodes;
1793
- if (!children) return "";
1799
+ if (!children) return out;
1794
1800
  for (let i = 0; i < children.length; i++) {
1795
1801
  const ch = children[i];
1796
1802
  if (ch.nodeType !== 1) continue;
1797
1803
  const tag = (ch.tagName || ch.localName || "").replace(/^[^:]+:/, "");
1798
1804
  if (tag === "p" || tag === "para") {
1799
1805
  const t = extractParagraphInfo(ch, ctx.styleMap, ctx).text;
1800
- if (t) parts.push(t);
1806
+ if (t) {
1807
+ parts.push(t);
1808
+ out.blocks.push({ type: "paragraph", text: t, pageNumber: ctx.sectionNum });
1809
+ }
1801
1810
  const tbls = [];
1802
1811
  findTopLevelTbls(ch, tbls);
1803
1812
  for (const tbl2 of tbls) {
1804
- const flat = flattenSubListTable(tbl2, ctx, depth);
1805
- if (flat) parts.push(flat);
1813
+ const built = buildSubListTable(tbl2, ctx, depth);
1814
+ if (built.text) parts.push(built.text);
1815
+ if (built.block) {
1816
+ out.blocks.push(built.block);
1817
+ out.hasStructure = true;
1818
+ }
1806
1819
  }
1807
1820
  } else if (tag === "tbl") {
1808
- const flat = flattenSubListTable(ch, ctx, depth);
1809
- if (flat) parts.push(flat);
1821
+ const built = buildSubListTable(ch, ctx, depth);
1822
+ if (built.text) parts.push(built.text);
1823
+ if (built.block) {
1824
+ out.blocks.push(built.block);
1825
+ out.hasStructure = true;
1826
+ }
1810
1827
  } else {
1811
- const t = collectSubListText(ch, ctx, depth + 1);
1812
- if (t) parts.push(t);
1828
+ const sub = collectSubListContent(ch, ctx, depth + 1);
1829
+ if (sub.text) parts.push(sub.text);
1830
+ out.blocks.push(...sub.blocks);
1831
+ if (sub.hasStructure) out.hasStructure = true;
1813
1832
  }
1814
1833
  }
1815
- return parts.join("\n").trim();
1834
+ out.text = parts.join("\n").trim();
1835
+ return out;
1816
1836
  }
1817
- function flattenSubListTable(el, ctx, depth) {
1837
+ function buildSubListTable(el, ctx, depth) {
1818
1838
  const sink = [];
1819
1839
  const st = { rows: [], currentRow: [], cell: null };
1820
1840
  walkSection(el, sink, st, [], ctx, depth + 1);
1821
1841
  let flat = convertTableToText(st.rows);
1822
1842
  if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
1823
- return flat;
1843
+ const built = [];
1844
+ completeTable(st, [], built, ctx);
1845
+ return { text: flat, block: built.find((b) => b.type === "table") ?? null };
1824
1846
  }
1825
1847
  function findTopLevelTbls(el, out, depth = 0) {
1826
1848
  if (depth > MAX_XML_DEPTH) return;
@@ -1866,11 +1888,13 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
1866
1888
  walkSection(el, blocks, newTable, tableStack, ctx, d + 1);
1867
1889
  tableCtx = completeTable(newTable, tableStack, blocks, ctx);
1868
1890
  } else if (localTag === "caption" && !inShape) {
1869
- const capText = collectSubListText(el, ctx);
1870
- if (capText) {
1871
- if (tableCtx?.cell) mergeBlocksIntoCell(tableCtx.cell, [{ type: "paragraph", text: capText, pageNumber: ctx.sectionNum }]);
1872
- else if (tableCtx) tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") + capText;
1873
- else blocks.push({ type: "paragraph", text: capText, pageNumber: ctx.sectionNum });
1891
+ const cap = collectSubListContent(el, ctx);
1892
+ if (cap.text) {
1893
+ if (tableCtx?.cell) mergeBlocksIntoCell(tableCtx.cell, [{ type: "paragraph", text: cap.text, pageNumber: ctx.sectionNum }]);
1894
+ else if (tableCtx) {
1895
+ tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") + cap.text;
1896
+ if (cap.hasStructure) (tableCtx.captionBlocks ??= []).push(...cap.blocks);
1897
+ } else blocks.push({ type: "paragraph", text: cap.text, pageNumber: ctx.sectionNum });
1874
1898
  }
1875
1899
  } else if (localTag === "pic" || localTag === "shape" || localTag === "drawingObject") {
1876
1900
  if (tableCtx?.cell) {
@@ -17042,9 +17066,8 @@ function decodeJohab(ch) {
17042
17066
  const jongIdx = ch & 31;
17043
17067
  const cho = CHO_MAP[choIdx];
17044
17068
  const jung = JUNG_MAP[jungIdx];
17045
- let jong = JONG_MAP[jongIdx];
17046
- if (cho !== -1 && jung !== -1) {
17047
- if (jong === -1) jong = 0;
17069
+ const jong = JONG_MAP[jongIdx];
17070
+ if (cho !== -1 && jung !== -1 && jong !== -1) {
17048
17071
  return 44032 + cho * 588 + jung * 28 + jong;
17049
17072
  }
17050
17073
  const hit = lookupSymbol(ch);
@@ -17213,8 +17236,6 @@ var LINE_INFO_SIZE = 14;
17213
17236
  var INLINE_CHAR_SHAPE_SIZE = 31;
17214
17237
  var SIMPLE_CTRL = /* @__PURE__ */ new Map([
17215
17238
  [9, { extraBytes: 6, extraHchar: 3, emit: " " }],
17216
- [7, { extraBytes: 6, extraHchar: 3, emit: "\uFFFC" }],
17217
- [8, { extraBytes: 6, extraHchar: 3, emit: "\uFFFC" }],
17218
17239
  [18, { extraBytes: 6, extraHchar: 3, emit: " " }],
17219
17240
  // AutoNumber → 공백 (HWP5 패턴)
17220
17241
  [19, { extraBytes: 6, extraHchar: 3, emit: "\uFFFC" }],
@@ -17223,7 +17244,8 @@ var SIMPLE_CTRL = /* @__PURE__ */ new Map([
17223
17244
  [22, { extraBytes: 22, extraHchar: 11, emit: "\uFFFC" }],
17224
17245
  [23, { extraBytes: 8, extraHchar: 4, emit: "\uFFFC" }],
17225
17246
  [24, { extraBytes: 4, extraHchar: 2, emit: "-" }],
17226
- [25, { extraBytes: 4, extraHchar: 2, emit: "-" }],
17247
+ [25, { extraBytes: 4, extraHchar: 2, emit: null }],
17248
+ // 차례 표식 — 비가시 (rhwp #2765)
17227
17249
  [26, { extraBytes: 244, extraHchar: 122, emit: "\uFFFC" }],
17228
17250
  [28, { extraBytes: 62, extraHchar: 31, emit: "\uFFFC" }],
17229
17251
  [30, { extraBytes: 2, extraHchar: 1, emit: "\xA0" }],
@@ -17367,9 +17389,6 @@ function parseCharStream(reader, charCount, ctx) {
17367
17389
  case 11:
17368
17390
  parsePicture(reader, ctx);
17369
17391
  break;
17370
- case 12:
17371
- reader.skip(84);
17372
- break;
17373
17392
  case 14:
17374
17393
  reader.skip(84);
17375
17394
  break;
@@ -17394,6 +17413,12 @@ function parseCharStream(reader, charCount, ctx) {
17394
17413
  case 6:
17395
17414
  reader.skip(34);
17396
17415
  break;
17416
+ case 7:
17417
+ reader.skip(76);
17418
+ break;
17419
+ case 8:
17420
+ reader.skip(88);
17421
+ break;
17397
17422
  case 29:
17398
17423
  if (headerVal1 < 1e6) reader.skip(headerVal1);
17399
17424
  break;
@@ -27624,7 +27649,7 @@ async function parse(input, options) {
27624
27649
  }
27625
27650
  async function parseImage(buffer, options) {
27626
27651
  try {
27627
- const { parseImageDocument } = await import("./image-ocr-PGQ7JPDP.js");
27652
+ const { parseImageDocument } = await import("./image-ocr-KZTNJ62U.js");
27628
27653
  const { blocks, warnings } = await parseImageDocument(buffer, options);
27629
27654
  return {
27630
27655
  success: true,
@@ -27682,7 +27707,7 @@ async function parseHwp(buffer, options) {
27682
27707
  async function parsePdf(buffer, options) {
27683
27708
  let parsePdfDocument;
27684
27709
  try {
27685
- const mod = await import("./parser-T74C7Q57.js");
27710
+ const mod = await import("./parser-WNFWMBSL.js");
27686
27711
  parsePdfDocument = mod.parsePdfDocument;
27687
27712
  } catch {
27688
27713
  return {
@@ -27816,4 +27841,4 @@ export {
27816
27841
  parseHwpml,
27817
27842
  fillForm
27818
27843
  };
27819
- //# sourceMappingURL=chunk-LPRNVK4G.js.map
27844
+ //# sourceMappingURL=chunk-G3DMDTZI.js.map