kordoc 4.2.1 → 4.2.2

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 (94) hide show
  1. package/README.md +5 -0
  2. package/dist/{-BSO3CDQQ.js → -NFHVGTVM.js} +9 -9
  3. package/dist/{chunk-Z6LPEWIX.js → chunk-2L7MIKOM.js} +3 -3
  4. package/dist/chunk-2L7MIKOM.js.map +1 -0
  5. package/dist/{chunk-35U3MVA2.cjs → chunk-DLFZAU4X.cjs} +3 -3
  6. package/dist/{chunk-35U3MVA2.cjs.map → chunk-DLFZAU4X.cjs.map} +1 -1
  7. package/dist/{chunk-QSB2RTX5.js → chunk-DSL6EVFJ.js} +6 -4
  8. package/dist/chunk-DSL6EVFJ.js.map +1 -0
  9. package/dist/{chunk-R22KDUKW.cjs → chunk-EFF2JPPA.cjs} +9 -9
  10. package/dist/{chunk-R22KDUKW.cjs.map → chunk-EFF2JPPA.cjs.map} +1 -1
  11. package/dist/{chunk-BHILWIE6.js → chunk-FHYLLKIP.js} +3 -3
  12. package/dist/chunk-FHYLLKIP.js.map +1 -0
  13. package/dist/{chunk-PLTG6ZRF.js → chunk-GHMVNMUN.js} +3 -3
  14. package/dist/{chunk-HTCKGSSW.js → chunk-GUYIXVV7.js} +3 -3
  15. package/dist/chunk-GUYIXVV7.js.map +1 -0
  16. package/dist/{chunk-7IMNZ2BL.js → chunk-IXHBRMDB.js} +6 -4
  17. package/dist/chunk-IXHBRMDB.js.map +1 -0
  18. package/dist/{chunk-RBUBZ2TA.cjs → chunk-KKZATKQW.cjs} +3 -3
  19. package/dist/chunk-KKZATKQW.cjs.map +1 -0
  20. package/dist/{chunk-QOC7S5VE.js → chunk-L5B7PQOP.js} +2 -2
  21. package/dist/{chunk-WJSGYVFD.js → chunk-LUJN3VFB.js} +3 -3
  22. package/dist/{chunk-KRAYUNFM.js → chunk-MOOVF6CT.js} +2 -2
  23. package/dist/{chunk-BKBYTPSL.js → chunk-MYD3QLBL.js} +2 -2
  24. package/dist/{chunk-L5JWKIOT.js → chunk-OLDIDBJ2.js} +3 -3
  25. package/dist/{chunk-F5ECB53I.js → chunk-T4AWY45Q.js} +2 -2
  26. package/dist/{chunk-WWYAYZ5U.js → chunk-TXYQJXOV.js} +48 -14
  27. package/dist/chunk-TXYQJXOV.js.map +1 -0
  28. package/dist/{chunk-LSXXGUWA.cjs → chunk-WMU2KJHF.cjs} +8 -6
  29. package/dist/chunk-WMU2KJHF.cjs.map +1 -0
  30. package/dist/{chunk-EZHWPKCH.js → chunk-X77U36TV.js} +2 -2
  31. package/dist/{chunk-54WVWWT4.js → chunk-ZF7QL4IY.js} +1 -1
  32. package/dist/chunk-ZF7QL4IY.js.map +1 -0
  33. package/dist/chunks-N4CWHTJI.js +10 -0
  34. package/dist/cli.js +17 -17
  35. package/dist/{image-ocr-N5Z32R4U.cjs → image-ocr-3AFBDDJI.cjs} +9 -9
  36. package/dist/{image-ocr-N5Z32R4U.cjs.map → image-ocr-3AFBDDJI.cjs.map} +1 -1
  37. package/dist/{image-ocr-SLUEM3FA.js → image-ocr-S4REURLR.js} +5 -5
  38. package/dist/{image-ocr-DALT7PFQ.js → image-ocr-TGHAMIQL.js} +4 -4
  39. package/dist/index.cjs +446 -412
  40. package/dist/index.cjs.map +1 -1
  41. package/dist/index.d.cts +3 -0
  42. package/dist/index.d.ts +3 -0
  43. package/dist/index.js +44 -10
  44. package/dist/index.js.map +1 -1
  45. package/dist/mcp.js +15 -15
  46. package/dist/{parser-F5KY3YSD.js → parser-C3APVZGT.js} +6 -6
  47. package/dist/{parser-33TK5SMH.js → parser-KMC4YOZH.js} +5 -5
  48. package/dist/{parser-R4CXIXRN.cjs → parser-MRM6WICO.cjs} +24 -24
  49. package/dist/{parser-R4CXIXRN.cjs.map → parser-MRM6WICO.cjs.map} +1 -1
  50. package/dist/pdf-ocr-5BRMIJAT.cjs +13 -0
  51. package/dist/{pdf-ocr-WGWZDHMV.cjs.map → pdf-ocr-5BRMIJAT.cjs.map} +1 -1
  52. package/dist/pdf-ocr-UDTEQEWA.js +12 -0
  53. package/dist/{pdf-ocr-BXQZKU3N.js → pdf-ocr-UURMV6FD.js} +5 -5
  54. package/dist/{profile-io-CBYHKLFU.js → profile-io-RLQ62KS5.js} +3 -3
  55. package/dist/{rasterize-AWMM2CSW.js → rasterize-LBABF2WI.js} +2 -2
  56. package/dist/render-CYXQEHS7.js +10 -0
  57. package/dist/seal-SV6PFFYU.js +10 -0
  58. package/dist/{watch-HKXCISVO.js → watch-XEUEGOXW.js} +9 -9
  59. package/package.json +1 -1
  60. package/dist/chunk-54WVWWT4.js.map +0 -1
  61. package/dist/chunk-7IMNZ2BL.js.map +0 -1
  62. package/dist/chunk-BHILWIE6.js.map +0 -1
  63. package/dist/chunk-HTCKGSSW.js.map +0 -1
  64. package/dist/chunk-LSXXGUWA.cjs.map +0 -1
  65. package/dist/chunk-QSB2RTX5.js.map +0 -1
  66. package/dist/chunk-RBUBZ2TA.cjs.map +0 -1
  67. package/dist/chunk-WWYAYZ5U.js.map +0 -1
  68. package/dist/chunk-Z6LPEWIX.js.map +0 -1
  69. package/dist/chunks-LRFS5NJE.js +0 -10
  70. package/dist/pdf-ocr-34F5AQKK.js +0 -12
  71. package/dist/pdf-ocr-WGWZDHMV.cjs +0 -13
  72. package/dist/render-Y3IE2FIK.js +0 -10
  73. package/dist/seal-7RXFCRMT.js +0 -10
  74. /package/dist/{-BSO3CDQQ.js.map → -NFHVGTVM.js.map} +0 -0
  75. /package/dist/{chunk-PLTG6ZRF.js.map → chunk-GHMVNMUN.js.map} +0 -0
  76. /package/dist/{chunk-QOC7S5VE.js.map → chunk-L5B7PQOP.js.map} +0 -0
  77. /package/dist/{chunk-WJSGYVFD.js.map → chunk-LUJN3VFB.js.map} +0 -0
  78. /package/dist/{chunk-KRAYUNFM.js.map → chunk-MOOVF6CT.js.map} +0 -0
  79. /package/dist/{chunk-BKBYTPSL.js.map → chunk-MYD3QLBL.js.map} +0 -0
  80. /package/dist/{chunk-L5JWKIOT.js.map → chunk-OLDIDBJ2.js.map} +0 -0
  81. /package/dist/{chunk-F5ECB53I.js.map → chunk-T4AWY45Q.js.map} +0 -0
  82. /package/dist/{chunk-EZHWPKCH.js.map → chunk-X77U36TV.js.map} +0 -0
  83. /package/dist/{chunks-LRFS5NJE.js.map → chunks-N4CWHTJI.js.map} +0 -0
  84. /package/dist/{image-ocr-SLUEM3FA.js.map → image-ocr-S4REURLR.js.map} +0 -0
  85. /package/dist/{image-ocr-DALT7PFQ.js.map → image-ocr-TGHAMIQL.js.map} +0 -0
  86. /package/dist/{parser-F5KY3YSD.js.map → parser-C3APVZGT.js.map} +0 -0
  87. /package/dist/{parser-33TK5SMH.js.map → parser-KMC4YOZH.js.map} +0 -0
  88. /package/dist/{pdf-ocr-34F5AQKK.js.map → pdf-ocr-UDTEQEWA.js.map} +0 -0
  89. /package/dist/{pdf-ocr-BXQZKU3N.js.map → pdf-ocr-UURMV6FD.js.map} +0 -0
  90. /package/dist/{profile-io-CBYHKLFU.js.map → profile-io-RLQ62KS5.js.map} +0 -0
  91. /package/dist/{rasterize-AWMM2CSW.js.map → rasterize-LBABF2WI.js.map} +0 -0
  92. /package/dist/{render-Y3IE2FIK.js.map → render-CYXQEHS7.js.map} +0 -0
  93. /package/dist/{seal-7RXFCRMT.js.map → seal-SV6PFFYU.js.map} +0 -0
  94. /package/dist/{watch-HKXCISVO.js.map → watch-XEUEGOXW.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-54WVWWT4.js";
9
+ } from "./chunk-ZF7QL4IY.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-WJSGYVFD.js";
30
+ } from "./chunk-LUJN3VFB.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-QSB2RTX5.js";
40
+ } from "./chunk-DSL6EVFJ.js";
41
41
  import {
42
42
  SPACE_EM_FIXED,
43
43
  charWidthEm1000,
44
44
  fitRatioForFewerLines,
45
45
  measureTextWidth,
46
46
  simulateWrap
47
- } from "./chunk-PLTG6ZRF.js";
47
+ } from "./chunk-GHMVNMUN.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-BHILWIE6.js";
59
+ } from "./chunk-FHYLLKIP.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-Z6LPEWIX.js";
71
+ } from "./chunk-2L7MIKOM.js";
72
72
 
73
73
  // src/index.ts
74
74
  import { readFile } from "fs/promises";
@@ -184,6 +184,26 @@ function comResultToParseResult(pages, pageCount, warnings) {
184
184
  }
185
185
 
186
186
  // src/hwpx/styles.ts
187
+ function isRealStrikeShape(shape) {
188
+ switch (shape) {
189
+ case "SOLID":
190
+ case "DASH":
191
+ case "DOT":
192
+ case "DASH_DOT":
193
+ case "DASH_DOT_DOT":
194
+ case "LONG_DASH":
195
+ case "CIRCLE":
196
+ case "DOUBLE_SLIM":
197
+ case "SLIM_THICK":
198
+ case "THICK_SLIM":
199
+ case "SLIM_THICK_SLIM":
200
+ case "WAVE":
201
+ case "DOUBLE_WAVE":
202
+ return true;
203
+ default:
204
+ return false;
205
+ }
206
+ }
187
207
  async function extractHwpxStyles(zip, decompressed) {
188
208
  const result = {
189
209
  charProperties: /* @__PURE__ */ new Map(),
@@ -248,6 +268,10 @@ function parseCharProperties(doc, map) {
248
268
  const localTag = (k.tagName || "").replace(/^[^:]+:/, "");
249
269
  if (localTag === "bold") prop.bold = true;
250
270
  else if (localTag === "italic") prop.italic = true;
271
+ else if (localTag === "strikeout") {
272
+ const shape = k.getAttribute("shape") || "";
273
+ if (isRealStrikeShape(shape)) prop.strike = true;
274
+ }
251
275
  }
252
276
  const fontFaces = el.getElementsByTagName("*");
253
277
  for (let j = 0; j < fontFaces.length; j++) {
@@ -2214,21 +2238,22 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
2214
2238
  else {
2215
2239
  if (cp?.bold) span.bold = true;
2216
2240
  if (cp?.italic) span.italic = true;
2241
+ if (cp?.strike) span.strike = true;
2217
2242
  }
2218
- if (span.bold || span.italic || span.code) styled = true;
2243
+ if (span.bold || span.italic || span.strike || span.code) styled = true;
2219
2244
  spans.push(span);
2220
2245
  }
2221
2246
  if (!styled || spans.length === 0) return null;
2222
2247
  const merged = [];
2223
2248
  for (const s of spans) {
2224
2249
  const last = merged[merged.length - 1];
2225
- if (last && !!last.bold === !!s.bold && !!last.italic === !!s.italic && !!last.code === !!s.code) {
2250
+ if (last && !!last.bold === !!s.bold && !!last.italic === !!s.italic && !!last.strike === !!s.strike && !!last.code === !!s.code) {
2226
2251
  last.text += s.text;
2227
2252
  } else {
2228
2253
  merged.push(s);
2229
2254
  }
2230
2255
  }
2231
- if (requireMixed && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
2256
+ if (requireMixed && !merged.some((s) => s.strike) && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
2232
2257
  return merged;
2233
2258
  }
2234
2259
  function gongmunDepthFromIndent(para2, left, ctx) {
@@ -4647,7 +4672,10 @@ function parseParagraph(records, start, end, ctx) {
4647
4672
  if (headingLevel > 0) block.level = headingLevel;
4648
4673
  if (ctx.docInfo && charShapeIds.length > 0) {
4649
4674
  const style = resolveCharStyle(charShapeIds, ctx.docInfo);
4650
- if (style) block.style = style;
4675
+ if (style) {
4676
+ block.style = style;
4677
+ if (style.strike) block.text = headMarker ? `${headMarker} ~~${trimmed}~~` : `~~${trimmed}~~`;
4678
+ }
4651
4679
  }
4652
4680
  if (footnotes.length > 0) block.footnoteText = footnotes.join("; ");
4653
4681
  blocks.push(block);
@@ -5038,7 +5066,13 @@ function resolveCharStyle(charShapeIds, docInfo) {
5038
5066
  if (cs.fontSize > 0) style.fontSize = cs.fontSize / 10;
5039
5067
  if (cs.attrFlags & 1) style.italic = true;
5040
5068
  if (cs.attrFlags & 2) style.bold = true;
5041
- return style.fontSize || style.bold || style.italic ? style : void 0;
5069
+ if (hasRealStrike(cs.attrFlags)) style.strike = true;
5070
+ return style.fontSize || style.bold || style.italic || style.strike ? style : void 0;
5071
+ }
5072
+ function hasRealStrike(attrFlags) {
5073
+ const strikeBits = attrFlags >> 18 & 7;
5074
+ const shapeId = attrFlags >> 26 & 15;
5075
+ return strikeBits !== 0 && shapeId <= 12;
5042
5076
  }
5043
5077
 
5044
5078
  // src/hwp3/parser.ts
@@ -27513,7 +27547,7 @@ async function parse(input, options) {
27513
27547
  }
27514
27548
  async function parseImage(buffer, options) {
27515
27549
  try {
27516
- const { parseImageDocument } = await import("./image-ocr-SLUEM3FA.js");
27550
+ const { parseImageDocument } = await import("./image-ocr-S4REURLR.js");
27517
27551
  const { blocks, warnings } = await parseImageDocument(buffer, options);
27518
27552
  return {
27519
27553
  success: true,
@@ -27571,7 +27605,7 @@ async function parseHwp(buffer, options) {
27571
27605
  async function parsePdf(buffer, options) {
27572
27606
  let parsePdfDocument;
27573
27607
  try {
27574
- const mod = await import("./parser-F5KY3YSD.js");
27608
+ const mod = await import("./parser-C3APVZGT.js");
27575
27609
  parsePdfDocument = mod.parsePdfDocument;
27576
27610
  } catch {
27577
27611
  return {
@@ -27705,4 +27739,4 @@ export {
27705
27739
  parseHwpml,
27706
27740
  fillForm
27707
27741
  };
27708
- //# sourceMappingURL=chunk-WWYAYZ5U.js.map
27742
+ //# sourceMappingURL=chunk-TXYQJXOV.js.map