kordoc 4.18.7 → 4.18.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 (123) hide show
  1. package/README.md +74 -561
  2. package/dist/{-3AJPADNH.js → -OOORB3ZM.js} +11 -11
  3. package/dist/{chunk-6FGSSCXN.js → chunk-2ZATWIWX.js} +3 -3
  4. package/dist/{chunk-X6RQA2ZJ.js → chunk-44LAZYCW.js} +2 -2
  5. package/dist/{chunk-MKARDNWJ.js → chunk-5K7M5QCG.js} +2 -2
  6. package/dist/{chunk-32H2UKEZ.js → chunk-5XMZU77R.js} +2 -2
  7. package/dist/{chunk-HR7QNQOQ.cjs → chunk-5Z5VIVZ4.cjs} +3 -3
  8. package/dist/{chunk-HR7QNQOQ.cjs.map → chunk-5Z5VIVZ4.cjs.map} +1 -1
  9. package/dist/{chunk-M6UIEUUU.cjs → chunk-A66VFXSS.cjs} +12 -12
  10. package/dist/{chunk-M6UIEUUU.cjs.map → chunk-A66VFXSS.cjs.map} +1 -1
  11. package/dist/{chunk-T4TXPUOX.js → chunk-BBMS5Z7N.js} +2 -2
  12. package/dist/{chunk-MPUJQOCK.js → chunk-CGRLQJC2.js} +27 -4
  13. package/dist/chunk-CGRLQJC2.js.map +1 -0
  14. package/dist/{chunk-TQN4QRL7.cjs → chunk-FFUNCANU.cjs} +47 -24
  15. package/dist/chunk-FFUNCANU.cjs.map +1 -0
  16. package/dist/{chunk-2M7WLIUZ.js → chunk-H3MGECXS.js} +2 -2
  17. package/dist/{chunk-AOOQK3RX.js → chunk-IPJ5SVNH.js} +2 -2
  18. package/dist/{chunk-UHK47KXY.js → chunk-J6KBWT5D.js} +89 -10
  19. package/dist/chunk-J6KBWT5D.js.map +1 -0
  20. package/dist/{chunk-IM77QPKN.js → chunk-L3YW7ATL.js} +2 -2
  21. package/dist/{chunk-JXVVOSWW.js → chunk-L65DR4EY.js} +2 -2
  22. package/dist/{chunk-LUZF5ESP.js → chunk-LZJ4HHFE.js} +4 -4
  23. package/dist/{chunk-U4MI7XTO.js → chunk-MSGQ6DFT.js} +2 -2
  24. package/dist/{chunk-EB5T5SC6.js → chunk-MW2G24XL.js} +2 -2
  25. package/dist/{chunk-LFB3XTIK.js → chunk-NEQC7PV5.js} +2 -2
  26. package/dist/{chunk-AKQRKMY5.js → chunk-NMKCOSXN.js} +2 -2
  27. package/dist/{chunk-NCVMV4MR.js → chunk-O345LTOL.js} +3 -3
  28. package/dist/{chunk-5DKDP42Q.js → chunk-OJGHM3YD.js} +2 -2
  29. package/dist/{chunk-YROJFVJI.js → chunk-S7ED7QP2.js} +28 -5
  30. package/dist/chunk-S7ED7QP2.js.map +1 -0
  31. package/dist/{chunk-SD5DGUD4.js → chunk-SO66Q6ST.js} +2 -2
  32. package/dist/{chunk-ZCOZENWU.cjs → chunk-SOIGY5LM.cjs} +2 -2
  33. package/dist/{chunk-ZCOZENWU.cjs.map → chunk-SOIGY5LM.cjs.map} +1 -1
  34. package/dist/{chunk-5EXCACRC.cjs → chunk-VMGLV3P3.cjs} +3 -3
  35. package/dist/{chunk-5EXCACRC.cjs.map → chunk-VMGLV3P3.cjs.map} +1 -1
  36. package/dist/{chunk-7ELJ2VQW.js → chunk-XB6VRTM3.js} +2 -2
  37. package/dist/{chunk-T2VQWNMK.cjs → chunk-XMULZUPH.cjs} +6 -6
  38. package/dist/{chunk-T2VQWNMK.cjs.map → chunk-XMULZUPH.cjs.map} +1 -1
  39. package/dist/{chunk-KLOQU3SZ.js → chunk-ZMHMIXTU.js} +6 -6
  40. package/dist/chunks-2AMQTIMX.js +10 -0
  41. package/dist/cli.js +26 -26
  42. package/dist/{formula-WOW5NIIX.cjs → formula-5EGP7AVC.cjs} +9 -9
  43. package/dist/{formula-WOW5NIIX.cjs.map → formula-5EGP7AVC.cjs.map} +1 -1
  44. package/dist/{formula-BDPM3Q37.js → formula-CLVKOQCO.js} +4 -4
  45. package/dist/{formula-K2CIXI4G.js → formula-KOOZT2QS.js} +3 -3
  46. package/dist/{image-ocr-IGO6GXW4.js → image-ocr-AKSRUDIT.js} +9 -9
  47. package/dist/{image-ocr-PXFOI5HL.cjs → image-ocr-BHJFBQ2T.cjs} +15 -15
  48. package/dist/{image-ocr-PXFOI5HL.cjs.map → image-ocr-BHJFBQ2T.cjs.map} +1 -1
  49. package/dist/{image-ocr-SACGXUVC.js → image-ocr-LLMYXDAL.js} +6 -6
  50. package/dist/index.cjs +460 -381
  51. package/dist/index.cjs.map +1 -1
  52. package/dist/index.js +84 -5
  53. package/dist/index.js.map +1 -1
  54. package/dist/mcp.js +22 -22
  55. package/dist/{model-bundle-Y64X36ZK.js → model-bundle-NT6KCK6Y.js} +5 -5
  56. package/dist/{models-NMOGNW7R.js → models-SWD6AIAB.js} +5 -5
  57. package/dist/{parser-CH4MBHEZ.js → parser-ANGCUOPB.js} +10 -9
  58. package/dist/{parser-CZWBWP7H.js.map → parser-ANGCUOPB.js.map} +1 -1
  59. package/dist/{parser-NMWMCBWM.cjs → parser-N5MYD4XA.cjs} +127 -126
  60. package/dist/parser-N5MYD4XA.cjs.map +1 -0
  61. package/dist/{parser-CZWBWP7H.js → parser-RYDOM6KM.js} +13 -12
  62. package/dist/{parser-CH4MBHEZ.js.map → parser-RYDOM6KM.js.map} +1 -1
  63. package/dist/pdf-ocr-B23SDZDD.js +20 -0
  64. package/dist/pdf-ocr-RX3CQENG.cjs +17 -0
  65. package/dist/{pdf-ocr-RPBTK6XS.cjs.map → pdf-ocr-RX3CQENG.cjs.map} +1 -1
  66. package/dist/pdf-ocr-SMFPZJGJ.js +16 -0
  67. package/dist/{profile-io-UFU7APWM.js → profile-io-CZE4YTYD.js} +3 -3
  68. package/dist/{rasterize-NL6RCQWN.js → rasterize-KBBEPWJN.js} +3 -3
  69. package/dist/{redact-doc-FEM3AGUQ.js → redact-doc-K7HCORXE.js} +11 -11
  70. package/dist/{render-WDCKVMGY.js → render-TXGEQCW6.js} +7 -7
  71. package/dist/seal-QBDRMEQ3.js +10 -0
  72. package/dist/{setup-E3E4LDKQ.js → setup-EHCY4PGN.js} +3 -3
  73. package/dist/visual-66VQETYB.js +20 -0
  74. package/dist/{watch-6UYWJ6UG.js → watch-54O2O32S.js} +12 -12
  75. package/package.json +1 -1
  76. package/dist/chunk-MPUJQOCK.js.map +0 -1
  77. package/dist/chunk-TQN4QRL7.cjs.map +0 -1
  78. package/dist/chunk-UHK47KXY.js.map +0 -1
  79. package/dist/chunk-YROJFVJI.js.map +0 -1
  80. package/dist/chunks-JOLLBBQL.js +0 -10
  81. package/dist/parser-NMWMCBWM.cjs.map +0 -1
  82. package/dist/pdf-ocr-BLU34LTG.js +0 -16
  83. package/dist/pdf-ocr-L4LJUSZ3.js +0 -20
  84. package/dist/pdf-ocr-RPBTK6XS.cjs +0 -17
  85. package/dist/seal-XHUWDRIW.js +0 -10
  86. package/dist/visual-74WYDXEK.js +0 -20
  87. /package/dist/{-3AJPADNH.js.map → -OOORB3ZM.js.map} +0 -0
  88. /package/dist/{chunk-6FGSSCXN.js.map → chunk-2ZATWIWX.js.map} +0 -0
  89. /package/dist/{chunk-X6RQA2ZJ.js.map → chunk-44LAZYCW.js.map} +0 -0
  90. /package/dist/{chunk-MKARDNWJ.js.map → chunk-5K7M5QCG.js.map} +0 -0
  91. /package/dist/{chunk-32H2UKEZ.js.map → chunk-5XMZU77R.js.map} +0 -0
  92. /package/dist/{chunk-T4TXPUOX.js.map → chunk-BBMS5Z7N.js.map} +0 -0
  93. /package/dist/{chunk-2M7WLIUZ.js.map → chunk-H3MGECXS.js.map} +0 -0
  94. /package/dist/{chunk-AOOQK3RX.js.map → chunk-IPJ5SVNH.js.map} +0 -0
  95. /package/dist/{chunk-IM77QPKN.js.map → chunk-L3YW7ATL.js.map} +0 -0
  96. /package/dist/{chunk-JXVVOSWW.js.map → chunk-L65DR4EY.js.map} +0 -0
  97. /package/dist/{chunk-LUZF5ESP.js.map → chunk-LZJ4HHFE.js.map} +0 -0
  98. /package/dist/{chunk-U4MI7XTO.js.map → chunk-MSGQ6DFT.js.map} +0 -0
  99. /package/dist/{chunk-EB5T5SC6.js.map → chunk-MW2G24XL.js.map} +0 -0
  100. /package/dist/{chunk-LFB3XTIK.js.map → chunk-NEQC7PV5.js.map} +0 -0
  101. /package/dist/{chunk-AKQRKMY5.js.map → chunk-NMKCOSXN.js.map} +0 -0
  102. /package/dist/{chunk-NCVMV4MR.js.map → chunk-O345LTOL.js.map} +0 -0
  103. /package/dist/{chunk-5DKDP42Q.js.map → chunk-OJGHM3YD.js.map} +0 -0
  104. /package/dist/{chunk-SD5DGUD4.js.map → chunk-SO66Q6ST.js.map} +0 -0
  105. /package/dist/{chunk-7ELJ2VQW.js.map → chunk-XB6VRTM3.js.map} +0 -0
  106. /package/dist/{chunk-KLOQU3SZ.js.map → chunk-ZMHMIXTU.js.map} +0 -0
  107. /package/dist/{chunks-JOLLBBQL.js.map → chunks-2AMQTIMX.js.map} +0 -0
  108. /package/dist/{formula-BDPM3Q37.js.map → formula-CLVKOQCO.js.map} +0 -0
  109. /package/dist/{formula-K2CIXI4G.js.map → formula-KOOZT2QS.js.map} +0 -0
  110. /package/dist/{image-ocr-IGO6GXW4.js.map → image-ocr-AKSRUDIT.js.map} +0 -0
  111. /package/dist/{image-ocr-SACGXUVC.js.map → image-ocr-LLMYXDAL.js.map} +0 -0
  112. /package/dist/{model-bundle-Y64X36ZK.js.map → model-bundle-NT6KCK6Y.js.map} +0 -0
  113. /package/dist/{models-NMOGNW7R.js.map → models-SWD6AIAB.js.map} +0 -0
  114. /package/dist/{pdf-ocr-BLU34LTG.js.map → pdf-ocr-B23SDZDD.js.map} +0 -0
  115. /package/dist/{pdf-ocr-L4LJUSZ3.js.map → pdf-ocr-SMFPZJGJ.js.map} +0 -0
  116. /package/dist/{profile-io-UFU7APWM.js.map → profile-io-CZE4YTYD.js.map} +0 -0
  117. /package/dist/{rasterize-NL6RCQWN.js.map → rasterize-KBBEPWJN.js.map} +0 -0
  118. /package/dist/{redact-doc-FEM3AGUQ.js.map → redact-doc-K7HCORXE.js.map} +0 -0
  119. /package/dist/{render-WDCKVMGY.js.map → render-TXGEQCW6.js.map} +0 -0
  120. /package/dist/{seal-XHUWDRIW.js.map → seal-QBDRMEQ3.js.map} +0 -0
  121. /package/dist/{setup-E3E4LDKQ.js.map → setup-EHCY4PGN.js.map} +0 -0
  122. /package/dist/{visual-74WYDXEK.js.map → visual-66VQETYB.js.map} +0 -0
  123. /package/dist/{watch-6UYWJ6UG.js.map → watch-54O2O32S.js.map} +0 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/utils.ts
4
4
  import { format } from "util";
5
- var VERSION = true ? "4.18.7" : "0.0.0-dev";
5
+ var VERSION = true ? "4.18.9" : "0.0.0-dev";
6
6
  function toArrayBuffer(buf) {
7
7
  if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
8
8
  return buf.buffer;
@@ -170,4 +170,4 @@ export {
170
170
  classifyError,
171
171
  partExtension
172
172
  };
173
- //# sourceMappingURL=chunk-2M7WLIUZ.js.map
173
+ //# sourceMappingURL=chunk-H3MGECXS.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  escapeHtml,
3
3
  sanitizeHref
4
- } from "./chunk-AKQRKMY5.js";
4
+ } from "./chunk-NMKCOSXN.js";
5
5
 
6
6
  // src/script-tags.ts
7
7
  var LITERAL_TAG = /<(?=\/?(?:u|sup|sub)>)/g;
@@ -1242,4 +1242,4 @@ export {
1242
1242
  HEADING_RATIO_H2,
1243
1243
  HEADING_RATIO_H3
1244
1244
  };
1245
- //# sourceMappingURL=chunk-AOOQK3RX.js.map
1245
+ //# sourceMappingURL=chunk-IPJ5SVNH.js.map
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  blocksToPages
4
- } from "./chunk-32H2UKEZ.js";
4
+ } from "./chunk-5XMZU77R.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-NCVMV4MR.js";
18
+ } from "./chunk-O345LTOL.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-KLOQU3SZ.js";
68
+ } from "./chunk-ZMHMIXTU.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-U4MI7XTO.js";
80
+ } from "./chunk-MSGQ6DFT.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-5DKDP42Q.js";
99
+ } from "./chunk-OJGHM3YD.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-EB5T5SC6.js";
114
+ } from "./chunk-MW2G24XL.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-2M7WLIUZ.js";
130
+ } from "./chunk-H3MGECXS.js";
131
131
 
132
132
  // src/table/visual.ts
133
133
  import { readFile as readFile2 } from "fs/promises";
@@ -27483,6 +27483,74 @@ function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
27483
27483
  return { start: valStart, end: valStart + hM[1].length, replacement: String(newH) };
27484
27484
  }
27485
27485
 
27486
+ // src/roundtrip/embedded-line-patch.ts
27487
+ function buildEmbeddedLineSplices(para2, xml, newLines) {
27488
+ const tokens = [];
27489
+ let text = "";
27490
+ for (const range of para2.tRanges) {
27491
+ if (range.selfClosing) continue;
27492
+ const raw = xml.slice(range.contentStart, range.contentEnd);
27493
+ if (raw.includes("<")) return null;
27494
+ const base = text.length;
27495
+ let cursor = 0;
27496
+ for (const match of raw.matchAll(/&(?:lt|gt|amp|quot|apos|#(?:[0-9]+|x[0-9a-fA-F]+));|[^&]/gu)) {
27497
+ const decoded = decodeXmlEntities(match[0]);
27498
+ if (match.index !== cursor || decoded === match[0] && match[0].startsWith("&")) return null;
27499
+ cursor += match[0].length;
27500
+ tokens.push({
27501
+ from: text.length,
27502
+ to: text.length + decoded.length,
27503
+ start: range.contentStart + match.index,
27504
+ end: range.contentStart + match.index + match[0].length
27505
+ });
27506
+ text += decoded;
27507
+ }
27508
+ if (cursor !== raw.length || decodeXmlEntities(raw) !== text.slice(base)) return null;
27509
+ }
27510
+ if (text !== para2.text || !/[\r\n]/.test(text) || /<br\s*\/?\s*>/i.test(text)) return null;
27511
+ const lines = text.split(/\r\n|\r|\n/);
27512
+ if (lines.length !== newLines.length || lines.some((line) => !line.trim() || sanitizeText(line) !== line.trim())) return null;
27513
+ const splices = [];
27514
+ let offset = 0;
27515
+ for (let i = 0; i < lines.length; i++) {
27516
+ const line = lines[i];
27517
+ const orig = line.trim();
27518
+ const next = newLines[i];
27519
+ if (sanitizeText(next) !== next || /[\r\n]/.test(next) || /[\uD800-\uDFFF]/u.test(next) || decodeXmlEntities(escapeXmlText(next)) !== next) return null;
27520
+ let prefix = 0;
27521
+ while (prefix < orig.length && prefix < next.length && orig[prefix] === next[prefix]) prefix++;
27522
+ if (prefix > 0 && /[\uD800-\uDBFF]/.test(orig[prefix - 1]) && /[\uDC00-\uDFFF]/.test(orig[prefix] ?? "")) prefix--;
27523
+ let suffix = 0;
27524
+ while (suffix < orig.length - prefix && suffix < next.length - prefix && orig[orig.length - 1 - suffix] === next[next.length - 1 - suffix]) suffix++;
27525
+ if (suffix > 0 && /[\uDC00-\uDFFF]/.test(orig[orig.length - suffix]) && /[\uD800-\uDBFF]/.test(orig[orig.length - suffix - 1] ?? "")) suffix--;
27526
+ if (orig !== next) {
27527
+ const start = offset + line.length - line.trimStart().length + prefix;
27528
+ const end = offset + line.length - line.trimStart().length + orig.length - suffix;
27529
+ const replacement = escapeXmlText(next.slice(prefix, next.length - suffix));
27530
+ if (tokens.some((t) => t.from < start && start < t.to || t.from < end && end < t.to)) return null;
27531
+ if (start === end) {
27532
+ const token = tokens.find((t) => t.from === start) ?? tokens.find((t) => t.to === start);
27533
+ if (!token) return null;
27534
+ const at = token.from === start ? token.start : token.end;
27535
+ splices.push({ start: at, end: at, replacement });
27536
+ } else {
27537
+ let placed = false;
27538
+ for (const token of tokens) {
27539
+ if (token.to <= start || token.from >= end) continue;
27540
+ const previous = splices[splices.length - 1];
27541
+ if (placed && previous.end === token.start) previous.end = token.end;
27542
+ else splices.push({ start: token.start, end: token.end, replacement: placed ? "" : replacement });
27543
+ placed = true;
27544
+ }
27545
+ if (!placed) return null;
27546
+ }
27547
+ }
27548
+ offset += line.length;
27549
+ offset += text.slice(offset).match(/^(?:\r\n|\r|\n)/)?.[0].length ?? 0;
27550
+ }
27551
+ return splices;
27552
+ }
27553
+
27486
27554
  // src/roundtrip/table-patch.ts
27487
27555
  function patchGfmTable(table2, scanTable, orig, edited, ctx, skip) {
27488
27556
  const replica = replicateGfmTable(table2);
@@ -27743,6 +27811,17 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
27743
27811
  }
27744
27812
  const nonEmpty = cell2.paragraphs.filter((p) => normForMatch(p.text) !== "");
27745
27813
  if (origLineCount !== void 0 && nonEmpty.length > 0 && origLineCount !== nonEmpty.length) {
27814
+ const target = nonEmpty.length === 1 ? nonEmpty[0] : void 0;
27815
+ const sourceLines = target?.text.split(/\r\n|\r|\n/).map((line) => line.trim());
27816
+ const renderedLines = unescapeGfmCell(stripCellTokens(before)).split("\n").map((line) => line.trim());
27817
+ if (target && sourceLines?.length === origLineCount && sourceLines.every((line, i) => line === renderedLines[i]) && !extractCellTokens(before)) {
27818
+ const xml = ctx.scans[target.sectionIndex]?.xml;
27819
+ const precise = xml === void 0 ? null : buildEmbeddedLineSplices(target, xml, newLines);
27820
+ if (precise?.length) {
27821
+ ctx.sectionSplices[target.sectionIndex].push(...precise);
27822
+ return 1;
27823
+ }
27824
+ }
27746
27825
  return skip("\uC140 \uC904 \uACBD\uACC4 \uB9E4\uD551 \uBAA8\uD638 (\uB9AC\uD130\uB7F4 <br>/\uBB38\uB2E8 \uB0B4 \uC904\uBC14\uAFC8) \u2014 \uBBF8\uC9C0\uC6D0");
27747
27826
  }
27748
27827
  const splices = [];
@@ -30078,7 +30157,7 @@ function scriptsOff(r, off) {
30078
30157
  }
30079
30158
  async function parseImage(buffer, options) {
30080
30159
  try {
30081
- const { parseImageDocument } = await import("./image-ocr-IGO6GXW4.js");
30160
+ const { parseImageDocument } = await import("./image-ocr-AKSRUDIT.js");
30082
30161
  const { blocks, warnings } = await parseImageDocument(buffer, options);
30083
30162
  stripScriptTags({ blocks });
30084
30163
  return {
@@ -30138,7 +30217,7 @@ async function parseHwp(buffer, options) {
30138
30217
  async function parsePdf(buffer, options) {
30139
30218
  let parsePdfDocument;
30140
30219
  try {
30141
- const mod = await import("./parser-CZWBWP7H.js");
30220
+ const mod = await import("./parser-RYDOM6KM.js");
30142
30221
  parsePdfDocument = mod.parsePdfDocument;
30143
30222
  } catch {
30144
30223
  return {
@@ -30361,4 +30440,4 @@ export {
30361
30440
  parseHwpml,
30362
30441
  fillForm
30363
30442
  };
30364
- //# sourceMappingURL=chunk-UHK47KXY.js.map
30443
+ //# sourceMappingURL=chunk-J6KBWT5D.js.map