kordoc 4.3.0 → 4.4.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 (169) hide show
  1. package/NOTICE +176 -0
  2. package/README.md +936 -922
  3. package/THIRD_PARTY/apache-2.0.LICENSE +201 -0
  4. package/THIRD_PARTY/claw-hwp.LICENSE +21 -0
  5. package/THIRD_PARTY/hml-equation-parser.LICENSE +201 -0
  6. package/THIRD_PARTY/hml-equation-parser.txt +35 -0
  7. package/THIRD_PARTY/opendataloader-pdf.txt +32 -0
  8. package/THIRD_PARTY/pix2text.txt +17 -0
  9. package/THIRD_PARTY/rhwp-forms.txt +35 -0
  10. package/dist/{-DYHT3HWH.js → -R6NUMPRV.js} +11 -11
  11. package/dist/{chunk-3FFPHTXD.js → chunk-3H5X63BQ.js} +1 -1
  12. package/dist/chunk-3H5X63BQ.js.map +1 -0
  13. package/dist/{chunk-EFVAY5VE.js → chunk-5KLE3U23.js} +7 -4
  14. package/dist/chunk-5KLE3U23.js.map +1 -0
  15. package/dist/{chunk-6GBLFQMA.js → chunk-5RPYBC2Q.js} +1 -1
  16. package/dist/chunk-5RPYBC2Q.js.map +1 -0
  17. package/dist/{chunk-VXMLENCV.js → chunk-65DYCXGC.js} +4 -4
  18. package/dist/chunk-65DYCXGC.js.map +1 -0
  19. package/dist/{chunk-W34QSJFF.js → chunk-7FCNOKOR.js} +1 -1
  20. package/dist/chunk-7FCNOKOR.js.map +1 -0
  21. package/dist/{chunk-ZSL6MQVE.js → chunk-A73RMJ6B.js} +1 -1
  22. package/dist/chunk-A73RMJ6B.js.map +1 -0
  23. package/dist/{chunk-AL34DGS5.cjs → chunk-AB322K3O.cjs} +6 -6
  24. package/dist/chunk-AB322K3O.cjs.map +1 -0
  25. package/dist/chunk-DCZVOIEO.cjs.map +1 -1
  26. package/dist/{chunk-O5EK52TG.js → chunk-DZIXKL7E.js} +1 -1
  27. package/dist/chunk-DZIXKL7E.js.map +1 -0
  28. package/dist/{chunk-EZHW3RNQ.js → chunk-GHGZU2LQ.js} +2 -2
  29. package/dist/chunk-GHGZU2LQ.js.map +1 -0
  30. package/dist/chunk-GS7T56RP.cjs.map +1 -1
  31. package/dist/{chunk-6XPXIG57.js → chunk-GZDOWYJM.js} +2 -2
  32. package/dist/chunk-GZDOWYJM.js.map +1 -0
  33. package/dist/{chunk-JFV7QT5T.cjs → chunk-H2KMJOB6.cjs} +2 -2
  34. package/dist/chunk-H2KMJOB6.cjs.map +1 -0
  35. package/dist/{chunk-6RAYTNQT.js → chunk-HFJF477F.js} +3 -3
  36. package/dist/chunk-HFJF477F.js.map +1 -0
  37. package/dist/{chunk-SPKBIFSK.js → chunk-HNRULYUH.js} +2 -2
  38. package/dist/chunk-HNRULYUH.js.map +1 -0
  39. package/dist/chunk-MOL7MDBG.js +0 -0
  40. package/dist/{chunk-7MFO4TKP.js → chunk-ONS7JKVA.js} +2 -2
  41. package/dist/chunk-ONS7JKVA.js.map +1 -0
  42. package/dist/{chunk-DRQUAYNT.js → chunk-P7YPCK7C.js} +2 -2
  43. package/dist/chunk-P7YPCK7C.js.map +1 -0
  44. package/dist/{chunk-GSMPTZC7.js → chunk-QXYB74QF.js} +24 -3
  45. package/dist/chunk-QXYB74QF.js.map +1 -0
  46. package/dist/{chunk-NMWXBJ5B.js → chunk-RZURSA4N.js} +6 -4
  47. package/dist/chunk-RZURSA4N.js.map +1 -0
  48. package/dist/{chunk-LPQWKQQQ.cjs → chunk-SKM6KZUH.cjs} +9 -9
  49. package/dist/chunk-SKM6KZUH.cjs.map +1 -0
  50. package/dist/{chunk-YNJDNP44.js → chunk-UAFSPWU7.js} +1 -1
  51. package/dist/chunk-UAFSPWU7.js.map +1 -0
  52. package/dist/{chunk-AUOEZKJE.cjs → chunk-UDGPM5R5.cjs} +26 -5
  53. package/dist/chunk-UDGPM5R5.cjs.map +1 -0
  54. package/dist/{chunk-WFOQFJI4.js → chunk-V35DRUJC.js} +2 -2
  55. package/dist/chunk-V35DRUJC.js.map +1 -0
  56. package/dist/{chunk-4DBCUF3C.js → chunk-W6CUD7V3.js} +3 -3
  57. package/dist/chunk-W6CUD7V3.js.map +1 -0
  58. package/dist/{chunk-US4WFSIQ.js → chunk-XCIC7U6Y.js} +24 -3
  59. package/dist/chunk-XCIC7U6Y.js.map +1 -0
  60. package/dist/{chunk-DRZUJ2RK.js → chunk-YOZ7ZRCD.js} +366 -51
  61. package/dist/chunk-YOZ7ZRCD.js.map +1 -0
  62. package/dist/{chunk-ARXNKC5D.js → chunk-YVYU267E.js} +3 -3
  63. package/dist/chunk-YVYU267E.js.map +1 -0
  64. package/dist/{chunk-MGGU3ZRK.cjs → chunk-ZV5OKQ3Z.cjs} +1 -1
  65. package/dist/chunk-ZV5OKQ3Z.cjs.map +1 -0
  66. package/dist/chunks-QMGCI5DG.js +10 -0
  67. package/dist/cli.js +28 -24
  68. package/dist/cli.js.map +1 -1
  69. package/dist/{formula-IWV5IJ3Y.cjs → formula-CG4S7TWO.cjs} +8 -8
  70. package/dist/formula-CG4S7TWO.cjs.map +1 -0
  71. package/dist/{formula-7ZPC54JO.js → formula-JLYS73QL.js} +2 -2
  72. package/dist/formula-JLYS73QL.js.map +1 -0
  73. package/dist/{formula-EQRHSMYW.js → formula-LIVQSCMM.js} +2 -2
  74. package/dist/formula-LIVQSCMM.js.map +1 -0
  75. package/dist/{image-ocr-XEJFXH6M.cjs → image-ocr-F2BQA26V.cjs} +11 -11
  76. package/dist/image-ocr-F2BQA26V.cjs.map +1 -0
  77. package/dist/{image-ocr-G2LYTEUH.js → image-ocr-U2DRRFL3.js} +5 -5
  78. package/dist/image-ocr-U2DRRFL3.js.map +1 -0
  79. package/dist/{image-ocr-R44RYDBU.js → image-ocr-XC52AQDV.js} +7 -7
  80. package/dist/image-ocr-XC52AQDV.js.map +1 -0
  81. package/dist/index.cjs +858 -537
  82. package/dist/index.cjs.map +1 -1
  83. package/dist/index.d.cts +7 -0
  84. package/dist/index.d.ts +7 -0
  85. package/dist/index.js +373 -52
  86. package/dist/index.js.map +1 -1
  87. package/dist/mcp.js +24 -22
  88. package/dist/mcp.js.map +1 -1
  89. package/dist/{models-6VMAVZR6.js → models-6SIKLKRH.js} +3 -3
  90. package/dist/page-range-737B4EZW.js +0 -0
  91. package/dist/page-range-P7SDW6LR.cjs.map +1 -1
  92. package/dist/{parser-W3POOYQQ.js → parser-ESGFWWCT.js} +8 -8
  93. package/dist/parser-ESGFWWCT.js.map +1 -0
  94. package/dist/{parser-W3ZGQUCQ.cjs → parser-FFQN67O6.cjs} +25 -25
  95. package/dist/parser-FFQN67O6.cjs.map +1 -0
  96. package/dist/{parser-2G245MMN.js → parser-TFPGQWCC.js} +6 -6
  97. package/dist/parser-TFPGQWCC.js.map +1 -0
  98. package/dist/pdf-ocr-4R646OO6.js +12 -0
  99. package/dist/pdf-ocr-UQBZH3HE.cjs +13 -0
  100. package/dist/pdf-ocr-UQBZH3HE.cjs.map +1 -0
  101. package/dist/pdf-ocr-WE5TMRFU.js +15 -0
  102. package/dist/{profile-io-72R3B7KO.js → profile-io-O6BDCUJN.js} +3 -3
  103. package/dist/{rasterize-GNJQVURE.js → rasterize-V22VCCE7.js} +2 -2
  104. package/dist/rasterize-V22VCCE7.js.map +1 -0
  105. package/dist/{redact-W5K3ILQH.js → redact-7ILEAUTS.js} +2 -2
  106. package/dist/render-3BSVTTZE.js +10 -0
  107. package/dist/seal-6ZSEJVOD.js +10 -0
  108. package/dist/{setup-I4I75QJU.js → setup-GUQT5ELJ.js} +1 -1
  109. package/dist/setup-GUQT5ELJ.js.map +1 -0
  110. package/dist/{watch-2ADAJLIJ.js → watch-HGKBICED.js} +11 -11
  111. package/dist/watch-HGKBICED.js.map +1 -0
  112. package/package.json +103 -101
  113. package/templates//352/260/204/354/235/264/352/270/260/354/225/210/353/254/270_/354/230/210/354/213/234/352/260/222.json +9 -9
  114. package/templates//354/235/274/353/260/230/352/270/260/354/225/210/353/254/270_/354/204/234/354/213/235.hwpx +0 -0
  115. package/templates//354/235/274/353/260/230/352/270/260/354/225/210/353/254/270_/354/230/210/354/213/234/352/260/222.json +24 -24
  116. package/dist/chunk-3FFPHTXD.js.map +0 -1
  117. package/dist/chunk-4DBCUF3C.js.map +0 -1
  118. package/dist/chunk-6GBLFQMA.js.map +0 -1
  119. package/dist/chunk-6RAYTNQT.js.map +0 -1
  120. package/dist/chunk-6XPXIG57.js.map +0 -1
  121. package/dist/chunk-7MFO4TKP.js.map +0 -1
  122. package/dist/chunk-AL34DGS5.cjs.map +0 -1
  123. package/dist/chunk-ARXNKC5D.js.map +0 -1
  124. package/dist/chunk-AUOEZKJE.cjs.map +0 -1
  125. package/dist/chunk-DRQUAYNT.js.map +0 -1
  126. package/dist/chunk-DRZUJ2RK.js.map +0 -1
  127. package/dist/chunk-EFVAY5VE.js.map +0 -1
  128. package/dist/chunk-EZHW3RNQ.js.map +0 -1
  129. package/dist/chunk-GSMPTZC7.js.map +0 -1
  130. package/dist/chunk-JFV7QT5T.cjs.map +0 -1
  131. package/dist/chunk-LPQWKQQQ.cjs.map +0 -1
  132. package/dist/chunk-MGGU3ZRK.cjs.map +0 -1
  133. package/dist/chunk-NMWXBJ5B.js.map +0 -1
  134. package/dist/chunk-O5EK52TG.js.map +0 -1
  135. package/dist/chunk-SPKBIFSK.js.map +0 -1
  136. package/dist/chunk-US4WFSIQ.js.map +0 -1
  137. package/dist/chunk-VXMLENCV.js.map +0 -1
  138. package/dist/chunk-W34QSJFF.js.map +0 -1
  139. package/dist/chunk-WFOQFJI4.js.map +0 -1
  140. package/dist/chunk-YNJDNP44.js.map +0 -1
  141. package/dist/chunk-ZSL6MQVE.js.map +0 -1
  142. package/dist/chunks-Q7T4SQGW.js +0 -10
  143. package/dist/formula-7ZPC54JO.js.map +0 -1
  144. package/dist/formula-EQRHSMYW.js.map +0 -1
  145. package/dist/formula-IWV5IJ3Y.cjs.map +0 -1
  146. package/dist/image-ocr-G2LYTEUH.js.map +0 -1
  147. package/dist/image-ocr-R44RYDBU.js.map +0 -1
  148. package/dist/image-ocr-XEJFXH6M.cjs.map +0 -1
  149. package/dist/parser-2G245MMN.js.map +0 -1
  150. package/dist/parser-W3POOYQQ.js.map +0 -1
  151. package/dist/parser-W3ZGQUCQ.cjs.map +0 -1
  152. package/dist/pdf-ocr-3GDTJSHF.js +0 -15
  153. package/dist/pdf-ocr-N7IU23UV.cjs +0 -13
  154. package/dist/pdf-ocr-N7IU23UV.cjs.map +0 -1
  155. package/dist/pdf-ocr-U7MEGNBZ.js +0 -12
  156. package/dist/rasterize-GNJQVURE.js.map +0 -1
  157. package/dist/render-6OW6U4L4.js +0 -10
  158. package/dist/seal-GTNLVBJX.js +0 -10
  159. package/dist/setup-I4I75QJU.js.map +0 -1
  160. package/dist/watch-2ADAJLIJ.js.map +0 -1
  161. /package/dist/{-DYHT3HWH.js.map → -R6NUMPRV.js.map} +0 -0
  162. /package/dist/{chunks-Q7T4SQGW.js.map → chunks-QMGCI5DG.js.map} +0 -0
  163. /package/dist/{models-6VMAVZR6.js.map → models-6SIKLKRH.js.map} +0 -0
  164. /package/dist/{pdf-ocr-3GDTJSHF.js.map → pdf-ocr-4R646OO6.js.map} +0 -0
  165. /package/dist/{pdf-ocr-U7MEGNBZ.js.map → pdf-ocr-WE5TMRFU.js.map} +0 -0
  166. /package/dist/{profile-io-72R3B7KO.js.map → profile-io-O6BDCUJN.js.map} +0 -0
  167. /package/dist/{redact-W5K3ILQH.js.map → redact-7ILEAUTS.js.map} +0 -0
  168. /package/dist/{render-6OW6U4L4.js.map → render-3BSVTTZE.js.map} +0 -0
  169. /package/dist/{seal-GTNLVBJX.js.map → seal-6ZSEJVOD.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
 
11
- var _chunkAUOEZKJEcjs = require('./chunk-AUOEZKJE.cjs');
11
+ var _chunkUDGPM5R5cjs = require('./chunk-UDGPM5R5.cjs');
12
12
 
13
13
 
14
14
  var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
@@ -27,7 +27,7 @@ var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
27
27
 
28
28
 
29
29
 
30
- var _chunkJFV7QT5Tcjs = require('./chunk-JFV7QT5T.cjs');
30
+ var _chunkH2KMJOB6cjs = require('./chunk-H2KMJOB6.cjs');
31
31
 
32
32
 
33
33
  var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
@@ -409,6 +409,10 @@ function comResultToParseResult(pages, pageCount, warnings) {
409
409
  };
410
410
  }
411
411
 
412
+ // src/hwpx/crypto.ts
413
+ var _crypto = require('crypto');
414
+ var _zlib = require('zlib');
415
+
412
416
  // src/hwpx/parser-shared.ts
413
417
  var _xmldom = require('@xmldom/xmldom');
414
418
 
@@ -447,6 +451,9 @@ function elementChildren(parent) {
447
451
  }
448
452
  return out;
449
453
  }
454
+ function isTextNode(node) {
455
+ return node.nodeType === 3 || node.nodeType === 4;
456
+ }
450
457
  function extractTextFromNode(node, depth = 0) {
451
458
  let result = "";
452
459
  if (depth > MAX_XML_DEPTH) return result;
@@ -454,7 +461,7 @@ function extractTextFromNode(node, depth = 0) {
454
461
  if (!children) return result;
455
462
  for (let i = 0; i < children.length; i++) {
456
463
  const child = children[i];
457
- if (child.nodeType === 3) result += child.textContent || "";
464
+ if (isTextNode(child)) result += child.textContent || "";
458
465
  else if (child.nodeType === 1) result += extractTextFromNode(child, depth + 1);
459
466
  }
460
467
  return result.trim();
@@ -466,7 +473,7 @@ function rawTextContent(node, depth = 0) {
466
473
  const parts = [];
467
474
  for (let i = 0; i < children.length; i++) {
468
475
  const child = children[i];
469
- if (child.nodeType === 3) parts.push(child.nodeValue || "");
476
+ if (isTextNode(child)) parts.push(child.nodeValue || "");
470
477
  else if (child.nodeType === 1) parts.push(rawTextContent(child, depth + 1));
471
478
  }
472
479
  return parts.join("");
@@ -475,7 +482,7 @@ function rawTextContent(node, depth = 0) {
475
482
  // src/hwpx/parser-shared.ts
476
483
  var MAX_DECOMPRESS_SIZE = 256 * 1024 * 1024;
477
484
  var MAX_ZIP_ENTRIES = 500;
478
- var ZipBombError = class extends _chunkJFV7QT5Tcjs.KordocError {
485
+ var ZipBombError = class extends _chunkH2KMJOB6cjs.KordocError {
479
486
  constructor(message) {
480
487
  super(message);
481
488
  this.name = "ZipBombError";
@@ -490,7 +497,7 @@ function createSectionShared() {
490
497
  function createXmlParser(warnings) {
491
498
  return new (0, _xmldom.DOMParser)({
492
499
  onError(level, msg2) {
493
- if (level === "fatalError") throw new (0, _chunkJFV7QT5Tcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
500
+ if (level === "fatalError") throw new (0, _chunkH2KMJOB6cjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
494
501
  _optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
495
502
  }
496
503
  });
@@ -505,6 +512,89 @@ function applyPageText(blocks, shared) {
505
512
  }
506
513
  }
507
514
 
515
+ // src/hwpx/crypto.ts
516
+ var MAX_ITERATION_COUNT = 1e6;
517
+ var AES256_CBC = "http://www.w3.org/2001/04/xmlenc#aes256-cbc";
518
+ var START_KEY_SHA256 = "http://www.w3.org/2000/09/xmldsig#sha256";
519
+ var CHECKSUM_SHA256_1K = "sha256-1k";
520
+ var CHECKSUM_PREFIX_BYTES = 1024;
521
+ var attrOf = (xml, name) => _optionalChain([xml, 'access', _5 => _5.match, 'call', _6 => _6(new RegExp(`${name}="([^"]*)"`)), 'optionalAccess', _7 => _7[1]]);
522
+ function parseEncryptionManifest(manifestXml) {
523
+ const entries = [];
524
+ const entryRe = /<[^:>\s]*:?file-entry\b([^>]*)>([\s\S]*?)<\/[^:>\s]*:?file-entry>/g;
525
+ let m;
526
+ while ((m = entryRe.exec(manifestXml)) !== null) {
527
+ const [, attrs, inner] = m;
528
+ if (!inner.includes("encryption-data")) continue;
529
+ const path = attrOf(attrs, "full-path");
530
+ if (!path) continue;
531
+ const algorithm = attrOf(inner, "algorithm-name");
532
+ const startKey = attrOf(inner, "start-key-generation-name");
533
+ const checksumType = attrOf(inner, "checksum-type");
534
+ if (algorithm !== AES256_CBC) {
535
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
536
+ }
537
+ if (startKey !== START_KEY_SHA256) {
538
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
539
+ }
540
+ if (!_optionalChain([checksumType, 'optionalAccess', _8 => _8.endsWith, 'call', _9 => _9(CHECKSUM_SHA256_1K)])) {
541
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
542
+ }
543
+ const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
544
+ const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
545
+ const iv = Buffer.from(_nullishCoalesce(attrOf(inner, "initialisation-vector"), () => ( "")), "base64");
546
+ const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
547
+ const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
548
+ if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
549
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
550
+ }
551
+ if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
552
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
553
+ }
554
+ entries.push({ path, checksum, iv, salt, iterations, keySize });
555
+ }
556
+ return entries;
557
+ }
558
+ function stripEncryptionData(manifestXml) {
559
+ return manifestXml.replace(/<([^:>\s]*:?)encryption-data\b[\s\S]*?<\/\1encryption-data>/g, "");
560
+ }
561
+ function decryptEntry(cipher, entry, startKey) {
562
+ if (cipher.length === 0 || cipher.length % 16 !== 0) return void 0;
563
+ for (const prf of ["sha1", "sha256"]) {
564
+ try {
565
+ const key = _crypto.pbkdf2Sync.call(void 0, startKey, entry.salt, entry.iterations, entry.keySize, prf);
566
+ const decipher = _crypto.createDecipheriv.call(void 0, "aes-256-cbc", key, entry.iv);
567
+ decipher.setAutoPadding(false);
568
+ const raw = Buffer.concat([decipher.update(cipher), decipher.final()]);
569
+ const plain = _zlib.inflateRawSync.call(void 0, raw, { maxOutputLength: MAX_DECOMPRESS_SIZE });
570
+ const sum = _crypto.createHash.call(void 0, "sha256").update(plain.subarray(0, Math.min(CHECKSUM_PREFIX_BYTES, plain.length))).digest();
571
+ if (sum.length === entry.checksum.length && _crypto.timingSafeEqual.call(void 0, sum, entry.checksum)) return plain;
572
+ } catch (e5) {
573
+ }
574
+ }
575
+ return void 0;
576
+ }
577
+ async function decryptHwpxInPlace(zip, manifestXml, password) {
578
+ const entries = parseEncryptionManifest(manifestXml);
579
+ if (entries.length === 0) return 0;
580
+ const startKey = _crypto.createHash.call(void 0, "sha256").update(Buffer.from(password, "utf8")).digest();
581
+ const decrypted = [];
582
+ for (const entry of entries) {
583
+ const file = zip.file(entry.path);
584
+ if (!file) {
585
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
586
+ }
587
+ const plain = decryptEntry(await file.async("nodebuffer"), entry, startKey);
588
+ if (!plain) {
589
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uAC70\uB098 \uC554\uD638\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
590
+ }
591
+ decrypted.push({ path: entry.path, plain });
592
+ }
593
+ for (const { path, plain } of decrypted) zip.file(path, plain);
594
+ zip.file("META-INF/manifest.xml", stripEncryptionData(manifestXml));
595
+ return decrypted.length;
596
+ }
597
+
508
598
  // src/hwpx/styles.ts
509
599
  function isRealStrikeShape(shape) {
510
600
  switch (shape) {
@@ -544,10 +634,10 @@ async function extractHwpxStyles(zip, decompressed) {
544
634
  const xml = await file.async("text");
545
635
  if (decompressed) {
546
636
  decompressed.total += xml.length * 2;
547
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
637
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkH2KMJOB6cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
548
638
  }
549
639
  const parser = createXmlParser();
550
- const doc = parser.parseFromString(_chunkJFV7QT5Tcjs.stripDtd.call(void 0, xml), "text/xml");
640
+ const doc = parser.parseFromString(_chunkH2KMJOB6cjs.stripDtd.call(void 0, xml), "text/xml");
551
641
  if (!doc.documentElement) continue;
552
642
  const domDoc = doc;
553
643
  parseCharProperties(domDoc, result.charProperties);
@@ -557,7 +647,7 @@ async function extractHwpxStyles(zip, decompressed) {
557
647
  parseParaHeadings(domDoc, result.paraHeadings);
558
648
  parseParaIndents(domDoc, result.paraIndents);
559
649
  break;
560
- } catch (e5) {
650
+ } catch (e6) {
561
651
  continue;
562
652
  }
563
653
  }
@@ -584,7 +674,7 @@ function parseCharProperties(doc, map) {
584
674
  const italic = el.getAttribute("italic");
585
675
  if (italic === "true" || italic === "1") prop.italic = true;
586
676
  const kids = el.childNodes;
587
- for (let j = 0; j < (_nullishCoalesce(_optionalChain([kids, 'optionalAccess', _5 => _5.length]), () => ( 0))); j++) {
677
+ for (let j = 0; j < (_nullishCoalesce(_optionalChain([kids, 'optionalAccess', _10 => _10.length]), () => ( 0))); j++) {
588
678
  const k = kids[j];
589
679
  if (k.nodeType !== 1) continue;
590
680
  const localTag = (k.tagName || "").replace(/^[^:]+:/, "");
@@ -679,7 +769,7 @@ function parseParaIndents(doc, map) {
679
769
  if (!margin) continue;
680
770
  const readHu = (name) => {
681
771
  const child = findChildByLocalName(margin, name);
682
- const v = parseInt(_optionalChain([child, 'optionalAccess', _6 => _6.getAttribute, 'call', _7 => _7("value")]) || _optionalChain([child, 'optionalAccess', _8 => _8.textContent]) || "", 10);
772
+ const v = parseInt(_optionalChain([child, 'optionalAccess', _11 => _11.getAttribute, 'call', _12 => _12("value")]) || _optionalChain([child, 'optionalAccess', _13 => _13.textContent]) || "", 10);
683
773
  return Number.isFinite(v) ? v : 0;
684
774
  };
685
775
  const left = readHu("left");
@@ -716,7 +806,7 @@ function detectHwpxHeadings(blocks, styleMap) {
716
806
  let baseFontSize = 0;
717
807
  const sizeFreq = /* @__PURE__ */ new Map();
718
808
  for (const b of blocks) {
719
- if (_optionalChain([b, 'access', _9 => _9.style, 'optionalAccess', _10 => _10.fontSize])) {
809
+ if (_optionalChain([b, 'access', _14 => _14.style, 'optionalAccess', _15 => _15.fontSize])) {
720
810
  sizeFreq.set(b.style.fontSize, (sizeFreq.get(b.style.fontSize) || 0) + 1);
721
811
  }
722
812
  }
@@ -732,11 +822,11 @@ function detectHwpxHeadings(blocks, styleMap) {
732
822
  const text = block.text.trim();
733
823
  if (text.length === 0 || text.length > 200 || /^\d+$/.test(text)) continue;
734
824
  let level = 0;
735
- if (baseFontSize > 0 && _optionalChain([block, 'access', _11 => _11.style, 'optionalAccess', _12 => _12.fontSize])) {
825
+ if (baseFontSize > 0 && _optionalChain([block, 'access', _16 => _16.style, 'optionalAccess', _17 => _17.fontSize])) {
736
826
  const ratio = block.style.fontSize / baseFontSize;
737
- if (ratio >= _chunkJFV7QT5Tcjs.HEADING_RATIO_H1) level = 1;
738
- else if (ratio >= _chunkJFV7QT5Tcjs.HEADING_RATIO_H2) level = 2;
739
- else if (ratio >= _chunkJFV7QT5Tcjs.HEADING_RATIO_H3) level = 3;
827
+ if (ratio >= _chunkH2KMJOB6cjs.HEADING_RATIO_H1) level = 1;
828
+ else if (ratio >= _chunkH2KMJOB6cjs.HEADING_RATIO_H2) level = 2;
829
+ else if (ratio >= _chunkH2KMJOB6cjs.HEADING_RATIO_H3) level = 3;
740
830
  }
741
831
  const compactText = text.replace(/\s+/g, "");
742
832
  if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
@@ -1034,7 +1124,7 @@ function findEnclosingBrackets(eqString, startIdx) {
1034
1124
  try {
1035
1125
  const [start, end] = findBrackets(eqString, idx, 1);
1036
1126
  if (start === idx && end > startIdx) return [start, end];
1037
- } catch (e6) {
1127
+ } catch (e7) {
1038
1128
  return null;
1039
1129
  }
1040
1130
  return null;
@@ -1076,7 +1166,7 @@ function replaceFrac(eqString) {
1076
1166
  const beforeFrac = eqString.slice(0, numStart);
1077
1167
  const afterFrac = eqString.slice(cursor + hmlFrac.length);
1078
1168
  eqString = beforeFrac + "\\frac" + wrapped + afterFrac;
1079
- } catch (e7) {
1169
+ } catch (e8) {
1080
1170
  return eqString;
1081
1171
  }
1082
1172
  }
@@ -1094,7 +1184,7 @@ function replaceRootOf(eqString) {
1094
1184
  const e1 = eqString.slice(elem1[0] + 1, elem1[1] - 1);
1095
1185
  const e2 = eqString.slice(elem2[0] + 1, elem2[1] - 1);
1096
1186
  eqString = eqString.slice(0, rootCursor) + "\\sqrt[" + e1 + "]{" + e2 + "}" + eqString.slice(elem2[1] + 1);
1097
- } catch (e8) {
1187
+ } catch (e9) {
1098
1188
  return eqString;
1099
1189
  }
1100
1190
  }
@@ -1126,7 +1216,7 @@ function replaceAllMatrix(eqString) {
1126
1216
  afterMat = input.slice(eEnd);
1127
1217
  }
1128
1218
  input = beforeMat + matElem.begin + elem + matElem.end + afterMat;
1129
- } catch (e9) {
1219
+ } catch (e10) {
1130
1220
  return input;
1131
1221
  }
1132
1222
  }
@@ -1150,7 +1240,7 @@ function replaceAllBar(eqString) {
1150
1240
  const beforeBar = input.slice(0, replaceStart);
1151
1241
  const afterBar = input.slice(replaceEnd);
1152
1242
  input = beforeBar + barElem + elem + afterBar;
1153
- } catch (e10) {
1243
+ } catch (e11) {
1154
1244
  return input;
1155
1245
  }
1156
1246
  }
@@ -1174,7 +1264,7 @@ function replaceAllBrace(eqString) {
1174
1264
  const beforeBrace = input.slice(0, cursor);
1175
1265
  const afterBrace = input.slice(eEnd2);
1176
1266
  input = beforeBrace + braceElem + elem1 + "^" + elem2 + afterBrace;
1177
- } catch (e11) {
1267
+ } catch (e12) {
1178
1268
  return input;
1179
1269
  }
1180
1270
  }
@@ -1199,8 +1289,8 @@ function hmlToLatex(hmlEqStr) {
1199
1289
  let tokens = s.split(" ");
1200
1290
  for (let i = 0; i < tokens.length; i++) {
1201
1291
  const t = tokens[i];
1202
- if (t in CONVERT_MAP) tokens[i] = CONVERT_MAP[t];
1203
- else if (t in MIDDLE_CONVERT_MAP) tokens[i] = MIDDLE_CONVERT_MAP[t];
1292
+ if (Object.hasOwn(CONVERT_MAP, t)) tokens[i] = CONVERT_MAP[t];
1293
+ else if (Object.hasOwn(MIDDLE_CONVERT_MAP, t)) tokens[i] = MIDDLE_CONVERT_MAP[t];
1204
1294
  else {
1205
1295
  const quoted = /^"(.+)"$/.exec(t);
1206
1296
  if (quoted) tokens[i] = `\\text{${quoted[1]}}`;
@@ -1315,30 +1405,30 @@ function resolveParaHeading(paraEl, ctx) {
1315
1405
  ctx.shared.numState.set(numId, counters);
1316
1406
  }
1317
1407
  const head = numDef.heads.get(level);
1318
- counters[level] = counters[level] < 0 ? _nullishCoalesce(_optionalChain([head, 'optionalAccess', _13 => _13.start]), () => ( 1)) : counters[level] + 1;
1408
+ counters[level] = counters[level] < 0 ? _nullishCoalesce(_optionalChain([head, 'optionalAccess', _18 => _18.start]), () => ( 1)) : counters[level] + 1;
1319
1409
  for (let l = level + 1; l <= 10; l++) counters[l] = -1;
1320
1410
  const fmtText = head ? head.text.trim() : `^${level}.`;
1321
1411
  const prefix = fmtText.replace(/\^(10|[1-9])/g, (_, d) => {
1322
1412
  const lv = parseInt(d, 10);
1323
1413
  const refHead = numDef.heads.get(lv);
1324
- const n = counters[lv] >= 0 ? counters[lv] : _nullishCoalesce(_optionalChain([refHead, 'optionalAccess', _14 => _14.start]), () => ( 1));
1325
- return formatHeadNumber(n, _optionalChain([refHead, 'optionalAccess', _15 => _15.numFormat]) || "DIGIT");
1414
+ const n = counters[lv] >= 0 ? counters[lv] : _nullishCoalesce(_optionalChain([refHead, 'optionalAccess', _19 => _19.start]), () => ( 1));
1415
+ return formatHeadNumber(n, _optionalChain([refHead, 'optionalAccess', _20 => _20.numFormat]) || "DIGIT");
1326
1416
  });
1327
1417
  return { prefix: prefix || void 0, headingLevel };
1328
1418
  }
1329
1419
 
1330
1420
  // src/hwpx/table-build.ts
1331
1421
  function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
1332
- const table2 = _chunkAUOEZKJEcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
1422
+ const table2 = _chunkUDGPM5R5cjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
1333
1423
  if (state.caption) table2.caption = state.caption;
1334
- if (_optionalChain([state, 'access', _16 => _16.captionBlocks, 'optionalAccess', _17 => _17.length])) table2.captionBlocks = state.captionBlocks;
1424
+ if (_optionalChain([state, 'access', _21 => _21.captionBlocks, 'optionalAccess', _22 => _22.length])) table2.captionBlocks = state.captionBlocks;
1335
1425
  const anchors = [];
1336
1426
  {
1337
1427
  const covered = /* @__PURE__ */ new Set();
1338
1428
  for (let r = 0; r < table2.rows; r++) {
1339
1429
  for (let c = 0; c < table2.cols; c++) {
1340
1430
  if (covered.has(`${r},${c}`)) continue;
1341
- const cell2 = _optionalChain([table2, 'access', _18 => _18.cells, 'access', _19 => _19[r], 'optionalAccess', _20 => _20[c]]);
1431
+ const cell2 = _optionalChain([table2, 'access', _23 => _23.cells, 'access', _24 => _24[r], 'optionalAccess', _25 => _25[c]]);
1342
1432
  if (!cell2) continue;
1343
1433
  for (let dr = 0; dr < cell2.rowSpan; dr++) {
1344
1434
  for (let dc = 0; dc < cell2.colSpan; dc++) {
@@ -1363,7 +1453,7 @@ function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraph
1363
1453
  let target;
1364
1454
  const trimmed = keepEmptyParagraphs ? src.text : src.text.trim();
1365
1455
  if (src.rowAddr !== void 0 && src.colAddr !== void 0) {
1366
- const cand = _optionalChain([table2, 'access', _21 => _21.cells, 'access', _22 => _22[src.rowAddr], 'optionalAccess', _23 => _23[src.colAddr]]);
1456
+ const cand = _optionalChain([table2, 'access', _26 => _26.cells, 'access', _27 => _27[src.rowAddr], 'optionalAccess', _28 => _28[src.colAddr]]);
1367
1457
  if (cand && cand.text === trimmed && !claimed.has(cand)) target = cand;
1368
1458
  }
1369
1459
  if (!target) {
@@ -1396,11 +1486,11 @@ function completeTable(newTable, tableStack, blocks, ctx) {
1396
1486
  }
1397
1487
  const ir = buildTableWithCellMeta(newTable, ctx.shared.keepTrailingEmptyCols, ctx.shared.keepEmptyParagraphs);
1398
1488
  const block = { type: "table", table: ir, pageNumber: ctx.sectionNum };
1399
- if (_optionalChain([parentTable, 'optionalAccess', _24 => _24.cell])) {
1489
+ if (_optionalChain([parentTable, 'optionalAccess', _29 => _29.cell])) {
1400
1490
  const cell2 = parentTable.cell;
1401
1491
  (cell2.blocks ??= []).push(block);
1402
1492
  cell2.hasStructure = true;
1403
- let flat = _chunkAUOEZKJEcjs.convertTableToText.call(void 0, newTable.rows);
1493
+ let flat = _chunkUDGPM5R5cjs.convertTableToText.call(void 0, newTable.rows);
1404
1494
  if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
1405
1495
  if (flat) {
1406
1496
  const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
@@ -1416,7 +1506,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
1416
1506
  // src/hwpx/section-walker.ts
1417
1507
  function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
1418
1508
  const parser = createXmlParser(warnings);
1419
- const doc = parser.parseFromString(_chunkJFV7QT5Tcjs.stripDtd.call(void 0, xml), "text/xml");
1509
+ const doc = parser.parseFromString(_chunkH2KMJOB6cjs.stripDtd.call(void 0, xml), "text/xml");
1420
1510
  if (!doc.documentElement) return [];
1421
1511
  const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
1422
1512
  ctx.shared.track.deleteDepth = 0;
@@ -1510,7 +1600,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1510
1600
  }
1511
1601
  break;
1512
1602
  case "cellAddr":
1513
- if (_optionalChain([tableCtx, 'optionalAccess', _25 => _25.cell])) {
1603
+ if (_optionalChain([tableCtx, 'optionalAccess', _30 => _30.cell])) {
1514
1604
  const ca = parseInt(el.getAttribute("colAddr") || "", 10);
1515
1605
  const ra = parseInt(el.getAttribute("rowAddr") || "", 10);
1516
1606
  if (!isNaN(ca)) tableCtx.cell.colAddr = ca;
@@ -1518,13 +1608,13 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1518
1608
  }
1519
1609
  break;
1520
1610
  case "cellSpan":
1521
- if (_optionalChain([tableCtx, 'optionalAccess', _26 => _26.cell])) {
1611
+ if (_optionalChain([tableCtx, 'optionalAccess', _31 => _31.cell])) {
1522
1612
  const rawCs = parseInt(el.getAttribute("colSpan") || "1", 10);
1523
1613
  const cs = isNaN(rawCs) ? 1 : rawCs;
1524
1614
  const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
1525
1615
  const rs = isNaN(rawRs) ? 1 : rawRs;
1526
- tableCtx.cell.colSpan = clampSpan(cs, _chunkAUOEZKJEcjs.MAX_COLS);
1527
- tableCtx.cell.rowSpan = clampSpan(rs, _chunkAUOEZKJEcjs.MAX_ROWS);
1616
+ tableCtx.cell.colSpan = clampSpan(cs, _chunkUDGPM5R5cjs.MAX_COLS);
1617
+ tableCtx.cell.rowSpan = clampSpan(rs, _chunkUDGPM5R5cjs.MAX_ROWS);
1528
1618
  }
1529
1619
  break;
1530
1620
  case "p": {
@@ -1533,14 +1623,14 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1533
1623
  let headingLevel;
1534
1624
  const ph = resolveParaHeading(el, ctx);
1535
1625
  if (text) {
1536
- if (_optionalChain([ph, 'optionalAccess', _27 => _27.prefix])) text = ph.prefix + " " + text;
1537
- headingLevel = _optionalChain([ph, 'optionalAccess', _28 => _28.headingLevel]);
1626
+ if (_optionalChain([ph, 'optionalAccess', _32 => _32.prefix])) text = ph.prefix + " " + text;
1627
+ headingLevel = _optionalChain([ph, 'optionalAccess', _33 => _33.headingLevel]);
1538
1628
  }
1539
1629
  if (segments) {
1540
- const cell2 = _nullishCoalesce(_optionalChain([tableCtx, 'optionalAccess', _29 => _29.cell]), () => ( null));
1630
+ const cell2 = _nullishCoalesce(_optionalChain([tableCtx, 'optionalAccess', _34 => _34.cell]), () => ( null));
1541
1631
  if (cell2) cell2.lineOpen = false;
1542
1632
  const segs = [...segments];
1543
- if (_optionalChain([ph, 'optionalAccess', _30 => _30.prefix])) {
1633
+ if (_optionalChain([ph, 'optionalAccess', _35 => _35.prefix])) {
1544
1634
  const fi = segs.findIndex((s) => s);
1545
1635
  if (fi >= 0) segs[fi] = ph.prefix + " " + segs[fi];
1546
1636
  }
@@ -1568,14 +1658,14 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1568
1658
  break;
1569
1659
  }
1570
1660
  if (text) {
1571
- if (_optionalChain([tableCtx, 'optionalAccess', _31 => _31.cell])) {
1661
+ if (_optionalChain([tableCtx, 'optionalAccess', _36 => _36.cell])) {
1572
1662
  const cell2 = tableCtx.cell;
1573
1663
  if (footnote) text += ` (\uC8FC: ${footnote})`;
1574
1664
  cell2.text += (cell2.text || cell2.paraSeen ? "\n" : "") + text;
1575
1665
  cell2.paraSeen = true;
1576
1666
  const cellBlock = { type: "paragraph", text, pageNumber: ctx.sectionNum };
1577
1667
  const cellSpanMode = spanModeOf(ctx.shared.kordocLayout);
1578
- if (cellSpanMode && !_optionalChain([ph, 'optionalAccess', _32 => _32.prefix])) {
1668
+ if (cellSpanMode && !_optionalChain([ph, 'optionalAccess', _37 => _37.prefix])) {
1579
1669
  const spans = extractRunSpans(el, ctx, cellSpanMode, cellSpanMode !== "kordoc");
1580
1670
  if (spans && spans.map((s) => s.text).join("").replace(/[ \t]+/g, " ").trim() === text) {
1581
1671
  cellBlock.spans = spans;
@@ -1594,7 +1684,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1594
1684
  if (style) block.style = style;
1595
1685
  if (href) block.href = href;
1596
1686
  if (footnote) block.footnoteText = footnote;
1597
- const ind = _optionalChain([ctx, 'access', _33 => _33.styleMap, 'optionalAccess', _34 => _34.paraIndents, 'access', _35 => _35.get, 'call', _36 => _36(_nullishCoalesce(el.getAttribute("paraPrIDRef"), () => ( "")))]);
1687
+ const ind = _optionalChain([ctx, 'access', _38 => _38.styleMap, 'optionalAccess', _39 => _39.paraIndents, 'access', _40 => _40.get, 'call', _41 => _41(_nullishCoalesce(el.getAttribute("paraPrIDRef"), () => ( "")))]);
1598
1688
  if (ind) {
1599
1689
  const eff = ind.left + Math.max(0, ind.intent);
1600
1690
  if (eff > 0) block.indent = eff;
@@ -1605,7 +1695,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1605
1695
  }
1606
1696
  const spanMode = spanModeOf(ctx.shared.kordocLayout);
1607
1697
  if (!headingLevel && spanMode) {
1608
- if (!_optionalChain([ph, 'optionalAccess', _37 => _37.prefix])) {
1698
+ if (!_optionalChain([ph, 'optionalAccess', _42 => _42.prefix])) {
1609
1699
  const spans = extractRunSpans(el, ctx, spanMode, spanMode === "gongmun");
1610
1700
  if (spans && spans.map((s) => s.text).join("").replace(/[ \t]+/g, " ").trim() === text) {
1611
1701
  block.spans = spans;
@@ -1618,7 +1708,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1618
1708
  blocks.push({ type: "paragraph", text, pageNumber: ctx.sectionNum });
1619
1709
  }
1620
1710
  } else if (ctx.shared.keepEmptyParagraphs && !hasObjectDescendant(el)) {
1621
- if (_optionalChain([tableCtx, 'optionalAccess', _38 => _38.cell])) {
1711
+ if (_optionalChain([tableCtx, 'optionalAccess', _43 => _43.cell])) {
1622
1712
  const cell2 = tableCtx.cell;
1623
1713
  if (cell2.text || cell2.paraSeen) cell2.text += "\n";
1624
1714
  cell2.paraSeen = true;
@@ -1635,7 +1725,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1635
1725
  case "pic":
1636
1726
  case "shape":
1637
1727
  case "drawingObject": {
1638
- if (_optionalChain([tableCtx, 'optionalAccess', _39 => _39.cell])) {
1728
+ if (_optionalChain([tableCtx, 'optionalAccess', _44 => _44.cell])) {
1639
1729
  const sink = [];
1640
1730
  handleShape(el, sink, ctx);
1641
1731
  mergeBlocksIntoCell(tableCtx.cell, sink);
@@ -1740,7 +1830,7 @@ function hasPageAutoNum(el, depth = 0) {
1740
1830
  const ch = children[i];
1741
1831
  if (ch.nodeType !== 1) continue;
1742
1832
  const tag = (ch.tagName || ch.localName || "").replace(/^[^:]+:/, "");
1743
- if (tag === "autoNum" && _optionalChain([ch, 'access', _40 => _40.getAttribute, 'optionalCall', _41 => _41("numType")]) === "PAGE") return true;
1833
+ if (tag === "autoNum" && _optionalChain([ch, 'access', _45 => _45.getAttribute, 'optionalCall', _46 => _46("numType")]) === "PAGE") return true;
1744
1834
  if (hasPageAutoNum(ch, depth + 1)) return true;
1745
1835
  }
1746
1836
  return false;
@@ -1795,7 +1885,7 @@ function buildSubListTable(el, ctx, depth) {
1795
1885
  const sink = [];
1796
1886
  const st = { rows: [], currentRow: [], cell: null };
1797
1887
  walkSection(el, sink, st, [], ctx, depth + 1);
1798
- let flat = _chunkAUOEZKJEcjs.convertTableToText.call(void 0, st.rows);
1888
+ let flat = _chunkUDGPM5R5cjs.convertTableToText.call(void 0, st.rows);
1799
1889
  if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
1800
1890
  const built = [];
1801
1891
  completeTable(st, [], built, ctx);
@@ -1847,14 +1937,14 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
1847
1937
  } else if (localTag === "caption" && !inShape) {
1848
1938
  const cap = collectSubListContent(el, ctx);
1849
1939
  if (cap.text) {
1850
- if (_optionalChain([tableCtx, 'optionalAccess', _42 => _42.cell])) mergeBlocksIntoCell(tableCtx.cell, [{ type: "paragraph", text: cap.text, pageNumber: ctx.sectionNum }]);
1940
+ if (_optionalChain([tableCtx, 'optionalAccess', _47 => _47.cell])) mergeBlocksIntoCell(tableCtx.cell, [{ type: "paragraph", text: cap.text, pageNumber: ctx.sectionNum }]);
1851
1941
  else if (tableCtx) {
1852
1942
  tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") + cap.text;
1853
1943
  if (cap.hasStructure) (tableCtx.captionBlocks ??= []).push(...cap.blocks);
1854
1944
  } else blocks.push({ type: "paragraph", text: cap.text, pageNumber: ctx.sectionNum });
1855
1945
  }
1856
1946
  } else if (localTag === "pic" || localTag === "shape" || localTag === "drawingObject") {
1857
- if (_optionalChain([tableCtx, 'optionalAccess', _43 => _43.cell])) {
1947
+ if (_optionalChain([tableCtx, 'optionalAccess', _48 => _48.cell])) {
1858
1948
  const sink = [];
1859
1949
  handleShape(el, sink, ctx);
1860
1950
  mergeBlocksIntoCell(tableCtx.cell, sink);
@@ -1862,7 +1952,7 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
1862
1952
  handleShape(el, blocks, ctx);
1863
1953
  }
1864
1954
  } else if (localTag === "drawText") {
1865
- if (_optionalChain([tableCtx, 'optionalAccess', _44 => _44.cell])) {
1955
+ if (_optionalChain([tableCtx, 'optionalAccess', _49 => _49.cell])) {
1866
1956
  const sink = [];
1867
1957
  extractDrawTextBlocks(el, sink, ctx);
1868
1958
  mergeBlocksIntoCell(tableCtx.cell, sink);
@@ -1894,7 +1984,7 @@ function hasObjectDescendant(node, depth = 0) {
1894
1984
  return false;
1895
1985
  }
1896
1986
  function isInlineTbl(tbl2) {
1897
- return _optionalChain([findChildByLocalName, 'call', _45 => _45(tbl2, "pos"), 'optionalAccess', _46 => _46.getAttribute, 'call', _47 => _47("treatAsChar")]) === "1";
1987
+ return _optionalChain([findChildByLocalName, 'call', _50 => _50(tbl2, "pos"), 'optionalAccess', _51 => _51.getAttribute, 'call', _52 => _52("treatAsChar")]) === "1";
1898
1988
  }
1899
1989
  function findDescendant(node, targetTag, depth = 0) {
1900
1990
  if (depth > 5) return null;
@@ -1925,7 +2015,7 @@ function extractDrawTextBlocks(drawTextNode, blocks, ctx) {
1925
2015
  let text = info.text.trim();
1926
2016
  const ph = resolveParaHeading(child, ctx);
1927
2017
  if (text) {
1928
- if (_optionalChain([ph, 'optionalAccess', _48 => _48.prefix])) text = ph.prefix + " " + text;
2018
+ if (_optionalChain([ph, 'optionalAccess', _53 => _53.prefix])) text = ph.prefix + " " + text;
1929
2019
  const block = { type: "paragraph", text, style: _nullishCoalesce(info.style, () => ( void 0)), pageNumber: ctx.sectionNum };
1930
2020
  if (info.href) block.href = info.href;
1931
2021
  if (info.footnote) block.footnoteText = info.footnote;
@@ -1950,13 +2040,13 @@ function extractHyperlinkHref(fieldBegin) {
1950
2040
  let url = (ch.textContent || "").trim();
1951
2041
  if (!url) continue;
1952
2042
  url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
1953
- const safe = _chunkJFV7QT5Tcjs.sanitizeHref.call(void 0, url);
2043
+ const safe = _chunkH2KMJOB6cjs.sanitizeHref.call(void 0, url);
1954
2044
  if (safe) return safe;
1955
2045
  }
1956
2046
  return void 0;
1957
2047
  }
1958
2048
  function isInDeletedRange(ctx) {
1959
- return (_nullishCoalesce(_optionalChain([ctx, 'optionalAccess', _49 => _49.shared, 'access', _50 => _50.track, 'access', _51 => _51.deleteDepth]), () => ( 0))) > 0;
2049
+ return (_nullishCoalesce(_optionalChain([ctx, 'optionalAccess', _54 => _54.shared, 'access', _55 => _55.track, 'access', _56 => _56.deleteDepth]), () => ( 0))) > 0;
1960
2050
  }
1961
2051
  function extractParagraphInfo(para2, styleMap, ctx) {
1962
2052
  let text = "";
@@ -1977,7 +2067,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
1977
2067
  };
1978
2068
  const onFieldEnd = () => {
1979
2069
  const open = openFields.pop();
1980
- if (_optionalChain([open, 'optionalAccess', _52 => _52.rangeIdx]) !== void 0) linkRanges[open.rangeIdx].end = text.length;
2070
+ if (_optionalChain([open, 'optionalAccess', _57 => _57.rangeIdx]) !== void 0) linkRanges[open.rangeIdx].end = text.length;
1981
2071
  };
1982
2072
  const handleCtrl = (ctrlEl) => {
1983
2073
  const kids = ctrlEl.childNodes;
@@ -2028,7 +2118,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2028
2118
  // 삽입분은 최종본에 포함
2029
2119
  // 숨은 설명 — 본문 혼입 차단
2030
2120
  case "hiddenComment": {
2031
- if (_optionalChain([ctx, 'optionalAccess', _53 => _53.warnings]) && extractTextFromNode(k)) {
2121
+ if (_optionalChain([ctx, 'optionalAccess', _58 => _58.warnings]) && extractTextFromNode(k)) {
2032
2122
  ctx.warnings.push({ page: ctx.sectionNum, message: "\uC228\uC740 \uC124\uBA85 \uD14D\uC2A4\uD2B8 \uC81C\uC678: hiddenComment", code: "HIDDEN_TEXT_FILTERED" });
2033
2123
  }
2034
2124
  break;
@@ -2048,7 +2138,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2048
2138
  break;
2049
2139
  // 미지원 요소 — 텍스트를 가졌으면 무음 손실 대신 경고
2050
2140
  default: {
2051
- if (_optionalChain([ctx, 'optionalAccess', _54 => _54.warnings]) && extractTextFromNode(k)) {
2141
+ if (_optionalChain([ctx, 'optionalAccess', _59 => _59.warnings]) && extractTextFromNode(k)) {
2052
2142
  ctx.warnings.push({ page: ctx.sectionNum, message: `\uBBF8\uC9C0\uC6D0 \uC81C\uC5B4 \uC694\uC18C\uC758 \uD14D\uC2A4\uD2B8 \uC190\uC2E4: ${ktag}`, code: "UNSUPPORTED_ELEMENT" });
2053
2143
  }
2054
2144
  }
@@ -2061,12 +2151,12 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2061
2151
  if (!children) return;
2062
2152
  for (let i = 0; i < children.length; i++) {
2063
2153
  const child = children[i];
2064
- if (child.nodeType === 3) {
2154
+ if (child.nodeType === 3 || child.nodeType === 4) {
2065
2155
  const t = child.textContent || "";
2066
2156
  if (isInDeletedRange(ctx)) {
2067
2157
  if (t && ctx && !ctx.shared.track.warned) {
2068
2158
  ctx.shared.track.warned = true;
2069
- _optionalChain([ctx, 'access', _55 => _55.warnings, 'optionalAccess', _56 => _56.push, 'call', _57 => _57({ page: ctx.sectionNum, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
2159
+ _optionalChain([ctx, 'access', _60 => _60.warnings, 'optionalAccess', _61 => _61.push, 'call', _62 => _62({ page: ctx.sectionNum, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
2070
2160
  }
2071
2161
  } else {
2072
2162
  text += t.replace(/\x1E/g, "");
@@ -2110,7 +2200,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2110
2200
  case "hyperlink": {
2111
2201
  const url = child.getAttribute("url") || child.getAttribute("href") || "";
2112
2202
  if (url) {
2113
- const safe = _chunkJFV7QT5Tcjs.sanitizeHref.call(void 0, url);
2203
+ const safe = _chunkH2KMJOB6cjs.sanitizeHref.call(void 0, url);
2114
2204
  if (safe) href = safe;
2115
2205
  }
2116
2206
  walk(child, depth + 1);
@@ -2175,8 +2265,8 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2175
2265
  try {
2176
2266
  const latex = hmlToLatex(raw).trim();
2177
2267
  if (latex) text += " $" + latex + "$ ";
2178
- } catch (e12) {
2179
- if (_optionalChain([ctx, 'optionalAccess', _58 => _58.warnings])) {
2268
+ } catch (e13) {
2269
+ if (_optionalChain([ctx, 'optionalAccess', _63 => _63.warnings])) {
2180
2270
  ctx.warnings.push({
2181
2271
  page: ctx.sectionNum,
2182
2272
  message: `\uC218\uC2DD LaTeX \uBCC0\uD658 \uC2E4\uD328 \u2014 \uC218\uC2DD \uD14D\uC2A4\uD2B8 \uC81C\uC678: ${raw.trim().slice(0, 40)}`,
@@ -2264,15 +2354,15 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
2264
2354
  if (tag !== "run" && tag !== "r") return null;
2265
2355
  let text = "";
2266
2356
  const rkids = child.childNodes;
2267
- for (let j = 0; j < (_nullishCoalesce(_optionalChain([rkids, 'optionalAccess', _59 => _59.length]), () => ( 0))); j++) {
2357
+ for (let j = 0; j < (_nullishCoalesce(_optionalChain([rkids, 'optionalAccess', _64 => _64.length]), () => ( 0))); j++) {
2268
2358
  const rc = rkids[j];
2269
2359
  if (rc.nodeType !== 1) continue;
2270
2360
  const rtag = (rc.tagName || rc.localName || "").replace(/^[^:]+:/, "");
2271
2361
  if (rtag === "t") {
2272
2362
  const tkids = rc.childNodes;
2273
- for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _60 => _60.length]), () => ( 0))); k++) {
2363
+ for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _65 => _65.length]), () => ( 0))); k++) {
2274
2364
  const tk = tkids[k];
2275
- if (tk.nodeType === 3) text += tk.textContent || "";
2365
+ if (tk.nodeType === 3 || tk.nodeType === 4) text += tk.textContent || "";
2276
2366
  else if (tk.nodeType === 1) return null;
2277
2367
  }
2278
2368
  } else if (rtag === "secPr" || rtag === "colPr") {
@@ -2288,9 +2378,9 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
2288
2378
  const span = { text };
2289
2379
  if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span.code = true;
2290
2380
  else {
2291
- if (_optionalChain([cp, 'optionalAccess', _61 => _61.bold])) span.bold = true;
2292
- if (_optionalChain([cp, 'optionalAccess', _62 => _62.italic])) span.italic = true;
2293
- if (_optionalChain([cp, 'optionalAccess', _63 => _63.strike])) span.strike = true;
2381
+ if (_optionalChain([cp, 'optionalAccess', _66 => _66.bold])) span.bold = true;
2382
+ if (_optionalChain([cp, 'optionalAccess', _67 => _67.italic])) span.italic = true;
2383
+ if (_optionalChain([cp, 'optionalAccess', _68 => _68.strike])) span.strike = true;
2294
2384
  }
2295
2385
  if (span.bold || span.italic || span.strike || span.code) styled = true;
2296
2386
  spans.push(span);
@@ -2313,12 +2403,12 @@ function gongmunDepthFromIndent(para2, left, ctx) {
2313
2403
  if (!styleMap) return null;
2314
2404
  let unit = 0;
2315
2405
  const kids = para2.childNodes;
2316
- for (let i = 0; i < (_nullishCoalesce(_optionalChain([kids, 'optionalAccess', _64 => _64.length]), () => ( 0))); i++) {
2406
+ for (let i = 0; i < (_nullishCoalesce(_optionalChain([kids, 'optionalAccess', _69 => _69.length]), () => ( 0))); i++) {
2317
2407
  const child = kids[i];
2318
2408
  if (child.nodeType !== 1) continue;
2319
2409
  const tag = (child.tagName || child.localName || "").replace(/^[^:]+:/, "");
2320
2410
  if (tag !== "run" && tag !== "r") continue;
2321
- const size = _optionalChain([styleMap, 'access', _65 => _65.charProperties, 'access', _66 => _66.get, 'call', _67 => _67(_nullishCoalesce(child.getAttribute("charPrIDRef"), () => ( ""))), 'optionalAccess', _68 => _68.fontSize]);
2411
+ const size = _optionalChain([styleMap, 'access', _70 => _70.charProperties, 'access', _71 => _71.get, 'call', _72 => _72(_nullishCoalesce(child.getAttribute("charPrIDRef"), () => ( ""))), 'optionalAccess', _73 => _73.fontSize]);
2322
2412
  if (size) unit = size * 100;
2323
2413
  break;
2324
2414
  }
@@ -2330,7 +2420,7 @@ function gongmunDepthFromIndent(para2, left, ctx) {
2330
2420
  }
2331
2421
 
2332
2422
  // src/hwp5/record.ts
2333
- var _zlib = require('zlib');
2423
+
2334
2424
  var TAG_PARA_HEADER = 66;
2335
2425
  var TAG_PARA_TEXT = 67;
2336
2426
  var TAG_CHAR_SHAPE = 68;
@@ -2385,13 +2475,13 @@ function decompressStream(data) {
2385
2475
  if (data.length >= 2 && data[0] === 120) {
2386
2476
  try {
2387
2477
  return _zlib.inflateSync.call(void 0, data, opts);
2388
- } catch (e13) {
2478
+ } catch (e14) {
2389
2479
  }
2390
2480
  }
2391
2481
  return _zlib.inflateRawSync.call(void 0, data, opts);
2392
2482
  }
2393
2483
  function parseFileHeader(data) {
2394
- if (data.length < 40) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
2484
+ if (data.length < 40) throw new (0, _chunkH2KMJOB6cjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
2395
2485
  const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
2396
2486
  return {
2397
2487
  signature: sig,
@@ -2505,7 +2595,7 @@ function parseDocInfo(records) {
2505
2595
  offset += 2;
2506
2596
  const charShapeId = offset + 2 <= rec.data.length ? rec.data.readUInt16LE(offset) : 0;
2507
2597
  styles.push({ name, nameKo, charShapeId, paraShapeId, type });
2508
- } catch (e14) {
2598
+ } catch (e15) {
2509
2599
  }
2510
2600
  }
2511
2601
  }
@@ -2524,7 +2614,7 @@ function appendParaText(state, data, resolveControl) {
2524
2614
  const resolveAt = (byteOffset, extended) => {
2525
2615
  const ctrlId = data.readUInt32LE(byteOffset);
2526
2616
  const idx = extended ? state.ctrlIdx : -1;
2527
- const replacement = _optionalChain([resolveControl, 'optionalCall', _69 => _69(idx, ctrlId)]);
2617
+ const replacement = _optionalChain([resolveControl, 'optionalCall', _74 => _74(idx, ctrlId)]);
2528
2618
  if (replacement) result += replacement;
2529
2619
  if (extended) state.ctrlIdx++;
2530
2620
  };
@@ -2623,7 +2713,7 @@ function normalizeBinPayload(data) {
2623
2713
  try {
2624
2714
  const inflated = decompressStream(data);
2625
2715
  if (inflated.length > 0) return inflated;
2626
- } catch (e15) {
2716
+ } catch (e16) {
2627
2717
  }
2628
2718
  return data;
2629
2719
  }
@@ -2728,7 +2818,7 @@ function extractHwp5Images(fileIndex, blocks, warnings, sweepUnreferenced) {
2728
2818
  const binDataMap = /* @__PURE__ */ new Map();
2729
2819
  if (fileIndex) {
2730
2820
  for (const entry of fileIndex) {
2731
- if (!_optionalChain([entry, 'optionalAccess', _70 => _70.name]) || !entry.content) continue;
2821
+ if (!_optionalChain([entry, 'optionalAccess', _75 => _75.name]) || !entry.content) continue;
2732
2822
  const match = entry.name.match(BIN_ENTRY_RE);
2733
2823
  if (!match) continue;
2734
2824
  const idx = parseInt(match[1], 16);
@@ -2804,11 +2894,11 @@ function collectImageBlocks2(blocks, out, ownerCell, depth = 0) {
2804
2894
  } else if (block.type === "table" && block.table) {
2805
2895
  for (const row of block.table.cells) {
2806
2896
  for (const cell2 of row) {
2807
- if (_optionalChain([cell2, 'access', _71 => _71.blocks, 'optionalAccess', _72 => _72.length])) collectImageBlocks2(cell2.blocks, out, cell2, depth + 1);
2897
+ if (_optionalChain([cell2, 'access', _76 => _76.blocks, 'optionalAccess', _77 => _77.length])) collectImageBlocks2(cell2.blocks, out, cell2, depth + 1);
2808
2898
  }
2809
2899
  }
2810
2900
  }
2811
- if (_optionalChain([block, 'access', _73 => _73.children, 'optionalAccess', _74 => _74.length])) collectImageBlocks2(block.children, out, ownerCell, depth + 1);
2901
+ if (_optionalChain([block, 'access', _78 => _78.children, 'optionalAccess', _79 => _79.length])) collectImageBlocks2(block.children, out, ownerCell, depth + 1);
2812
2902
  }
2813
2903
  }
2814
2904
  async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUnreferenced) {
@@ -2843,13 +2933,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
2843
2933
  }
2844
2934
  const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
2845
2935
  for (const path of allCandidates) {
2846
- if (_chunkJFV7QT5Tcjs.isPathTraversal.call(void 0, path)) continue;
2936
+ if (_chunkH2KMJOB6cjs.isPathTraversal.call(void 0, path)) continue;
2847
2937
  const file = zip.file(path);
2848
2938
  if (!file) continue;
2849
2939
  try {
2850
2940
  const data = await file.async("uint8array");
2851
2941
  decompressed.total += data.length;
2852
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2942
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkH2KMJOB6cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2853
2943
  const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
2854
2944
  const mimeType = imageExtToMime(ext);
2855
2945
  imageIndex++;
@@ -2859,10 +2949,10 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
2859
2949
  usedPaths.add(path);
2860
2950
  break;
2861
2951
  } catch (err) {
2862
- if (err instanceof _chunkJFV7QT5Tcjs.KordocError) throw err;
2952
+ if (err instanceof _chunkH2KMJOB6cjs.KordocError) throw err;
2863
2953
  }
2864
2954
  }
2865
- if (!img) _optionalChain([warnings, 'optionalAccess', _75 => _75.push, 'call', _76 => _76({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
2955
+ if (!img) _optionalChain([warnings, 'optionalAccess', _80 => _80.push, 'call', _81 => _81({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
2866
2956
  resolved.set(ref, img);
2867
2957
  }
2868
2958
  if (!img) {
@@ -2879,11 +2969,11 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
2879
2969
  if (sweepUnreferenced) {
2880
2970
  const binEntries = zip.file(/(?:^|\/)BinData\//i);
2881
2971
  for (const file of binEntries) {
2882
- if (file.dir || usedPaths.has(file.name) || _chunkJFV7QT5Tcjs.isPathTraversal.call(void 0, file.name)) continue;
2972
+ if (file.dir || usedPaths.has(file.name) || _chunkH2KMJOB6cjs.isPathTraversal.call(void 0, file.name)) continue;
2883
2973
  try {
2884
2974
  const data = await file.async("uint8array");
2885
2975
  decompressed.total += data.length;
2886
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2976
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkH2KMJOB6cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2887
2977
  const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
2888
2978
  let mimeType = imageExtToMime(ext);
2889
2979
  if (mimeType === "application/octet-stream") {
@@ -2897,8 +2987,8 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
2897
2987
  images.push(img);
2898
2988
  blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
2899
2989
  } catch (err) {
2900
- if (err instanceof _chunkJFV7QT5Tcjs.KordocError) throw err;
2901
- _optionalChain([warnings, 'optionalAccess', _77 => _77.push, 'call', _78 => _78({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
2990
+ if (err instanceof _chunkH2KMJOB6cjs.KordocError) throw err;
2991
+ _optionalChain([warnings, 'optionalAccess', _82 => _82.push, 'call', _83 => _83({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
2902
2992
  }
2903
2993
  }
2904
2994
  }
@@ -2948,7 +3038,7 @@ function extractFromBrokenZip(buffer) {
2948
3038
  }
2949
3039
  const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
2950
3040
  const name = new TextDecoder().decode(nameBytes);
2951
- if (_chunkJFV7QT5Tcjs.isPathTraversal.call(void 0, name)) {
3041
+ if (_chunkH2KMJOB6cjs.isPathTraversal.call(void 0, name)) {
2952
3042
  pos = fileStart + compSize;
2953
3043
  continue;
2954
3044
  }
@@ -2966,16 +3056,16 @@ function extractFromBrokenZip(buffer) {
2966
3056
  continue;
2967
3057
  }
2968
3058
  totalDecompressed += content.length * 2;
2969
- if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
3059
+ if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
2970
3060
  sectionNum++;
2971
3061
  blocks.push(...parseSectionXml(content, void 0, warnings, sectionNum, shared));
2972
- } catch (e16) {
3062
+ } catch (e17) {
2973
3063
  continue;
2974
3064
  }
2975
3065
  }
2976
- if (blocks.length === 0) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
3066
+ if (blocks.length === 0) throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
2977
3067
  applyPageText(blocks, shared);
2978
- const markdown = _chunkAUOEZKJEcjs.blocksToMarkdown.call(void 0, blocks);
3068
+ const markdown = _chunkUDGPM5R5cjs.blocksToMarkdown.call(void 0, blocks);
2979
3069
  return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
2980
3070
  }
2981
3071
  async function readKordocLayout(zip) {
@@ -2984,8 +3074,8 @@ async function readKordocLayout(zip) {
2984
3074
  try {
2985
3075
  const xml = await file.async("text");
2986
3076
  if (!/<opf:meta\b[^>]*name="generator"[^>]*content="kordoc"/.test(xml)) return null;
2987
- return _nullishCoalesce(_optionalChain([xml, 'access', _79 => _79.match, 'call', _80 => _80(/<opf:meta\b[^>]*name="kordoc-layout"[^>]*content="([^"]*)"/), 'optionalAccess', _81 => _81[1]]), () => ( null));
2988
- } catch (e17) {
3077
+ return _nullishCoalesce(_optionalChain([xml, 'access', _84 => _84.match, 'call', _85 => _85(/<opf:meta\b[^>]*name="kordoc-layout"[^>]*content="([^"]*)"/), 'optionalAccess', _86 => _86[1]]), () => ( null));
3078
+ } catch (e18) {
2989
3079
  return null;
2990
3080
  }
2991
3081
  }
@@ -3000,18 +3090,18 @@ async function resolveSectionPaths(zip) {
3000
3090
  if (paths.length > 0) return paths;
3001
3091
  }
3002
3092
  const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
3003
- return sectionFiles.map((f) => f.name).sort(_chunkJFV7QT5Tcjs.compareSectionPaths);
3093
+ return sectionFiles.map((f) => f.name).sort(_chunkH2KMJOB6cjs.compareSectionPaths);
3004
3094
  }
3005
3095
  function parseSectionPathsFromManifest(xml) {
3006
3096
  const parser = createXmlParser();
3007
- const doc = parser.parseFromString(_chunkJFV7QT5Tcjs.stripDtd.call(void 0, xml), "text/xml");
3097
+ const doc = parser.parseFromString(_chunkH2KMJOB6cjs.stripDtd.call(void 0, xml), "text/xml");
3008
3098
  const items = doc.getElementsByTagName("opf:item");
3009
3099
  const spine = doc.getElementsByTagName("opf:itemref");
3010
3100
  const idToHref = /* @__PURE__ */ new Map();
3011
3101
  for (let i = 0; i < items.length; i++) {
3012
3102
  const item = items[i];
3013
3103
  const id = item.getAttribute("id") || "";
3014
- const href = _chunkJFV7QT5Tcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
3104
+ const href = _chunkH2KMJOB6cjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
3015
3105
  if (id && href) idToHref.set(id, href);
3016
3106
  }
3017
3107
  if (spine.length > 0) {
@@ -3022,7 +3112,7 @@ function parseSectionPathsFromManifest(xml) {
3022
3112
  }
3023
3113
  if (ordered.length > 0) return ordered;
3024
3114
  }
3025
- return Array.from(idToHref.values()).sort(_chunkJFV7QT5Tcjs.compareSectionPaths);
3115
+ return Array.from(idToHref.values()).sort(_chunkH2KMJOB6cjs.compareSectionPaths);
3026
3116
  }
3027
3117
 
3028
3118
  // src/hwpx/metadata.ts
@@ -3035,23 +3125,23 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
3035
3125
  const xml = await file.async("text");
3036
3126
  if (decompressed) {
3037
3127
  decompressed.total += xml.length * 2;
3038
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
3128
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkH2KMJOB6cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
3039
3129
  }
3040
3130
  parseDublinCoreMetadata(xml, metadata);
3041
3131
  if (metadata.title || metadata.author) return;
3042
3132
  }
3043
- } catch (e18) {
3133
+ } catch (e19) {
3044
3134
  }
3045
3135
  }
3046
3136
  function parseDublinCoreMetadata(xml, metadata) {
3047
3137
  const parser = createXmlParser();
3048
- const doc = parser.parseFromString(_chunkJFV7QT5Tcjs.stripDtd.call(void 0, xml), "text/xml");
3138
+ const doc = parser.parseFromString(_chunkH2KMJOB6cjs.stripDtd.call(void 0, xml), "text/xml");
3049
3139
  if (!doc.documentElement) return;
3050
3140
  const getText = (tagNames) => {
3051
3141
  for (const tag of tagNames) {
3052
3142
  const els = doc.getElementsByTagName(tag);
3053
3143
  if (els.length > 0) {
3054
- const text = _optionalChain([els, 'access', _82 => _82[0], 'access', _83 => _83.textContent, 'optionalAccess', _84 => _84.trim, 'call', _85 => _85()]);
3144
+ const text = _optionalChain([els, 'access', _87 => _87[0], 'access', _88 => _88.textContent, 'optionalAccess', _89 => _89.trim, 'call', _90 => _90()]);
3055
3145
  if (text) return text;
3056
3146
  }
3057
3147
  }
@@ -3070,28 +3160,34 @@ function parseDublinCoreMetadata(xml, metadata) {
3070
3160
 
3071
3161
  // src/hwpx/parser.ts
3072
3162
  async function parseHwpxDocument(buffer, options) {
3073
- _chunkJFV7QT5Tcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
3163
+ _chunkH2KMJOB6cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
3074
3164
  let zip;
3075
3165
  try {
3076
3166
  zip = await _jszip2.default.loadAsync(buffer);
3077
- } catch (e19) {
3167
+ } catch (e20) {
3078
3168
  return extractFromBrokenZip(buffer);
3079
3169
  }
3080
3170
  const actualEntryCount = Object.keys(zip.files).length;
3081
3171
  if (actualEntryCount > MAX_ZIP_ENTRIES) {
3082
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
3172
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
3083
3173
  }
3084
3174
  const manifestFile = zip.file("META-INF/manifest.xml");
3085
3175
  if (manifestFile) {
3086
3176
  const manifestXml = await manifestFile.async("text");
3087
3177
  if (isEncryptedHwpx(manifestXml)) {
3088
- if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _86 => _86.filePath])) {
3089
- const { pages, pageCount, warnings: warnings2 } = extractTextViaCom(options.filePath);
3090
- if (pages.some((p) => p && p.trim().length > 0)) {
3091
- return comResultToParseResult(pages, pageCount, warnings2);
3178
+ if (_optionalChain([options, 'optionalAccess', _91 => _91.password])) {
3179
+ await decryptHwpxInPlace(zip, manifestXml, options.password);
3180
+ } else {
3181
+ if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _92 => _92.filePath])) {
3182
+ const { pages, pageCount, warnings: warnings2 } = extractTextViaCom(options.filePath);
3183
+ if (pages.some((p) => p && p.trim().length > 0)) {
3184
+ return comResultToParseResult(pages, pageCount, warnings2);
3185
+ }
3092
3186
  }
3187
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(
3188
+ "\uC554\uD638\uB85C \uBCF4\uD638\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4. password \uC635\uC158\uC5D0 \uC5F4\uAE30 \uC554\uD638\uB97C \uC9C0\uC815\uD558\uC138\uC694."
3189
+ );
3093
3190
  }
3094
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("DRM \uC554\uD638\uD654\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4. Windows + \uD55C\uCEF4 \uC624\uD53C\uC2A4 \uC124\uCE58 \uC2DC \uC790\uB3D9 \uCD94\uCD9C\uB429\uB2C8\uB2E4.");
3095
3191
  }
3096
3192
  }
3097
3193
  const decompressed = { total: 0 };
@@ -3100,15 +3196,15 @@ async function parseHwpxDocument(buffer, options) {
3100
3196
  const styleMap = await extractHwpxStyles(zip, decompressed);
3101
3197
  const warnings = [];
3102
3198
  const sectionPaths = await resolveSectionPaths(zip);
3103
- if (sectionPaths.length === 0) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
3199
+ if (sectionPaths.length === 0) throw new (0, _chunkH2KMJOB6cjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
3104
3200
  metadata.pageCount = sectionPaths.length;
3105
- const pageFilter = _optionalChain([options, 'optionalAccess', _87 => _87.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
3201
+ const pageFilter = _optionalChain([options, 'optionalAccess', _93 => _93.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
3106
3202
  const totalTarget = pageFilter ? pageFilter.size : sectionPaths.length;
3107
3203
  const blocks = [];
3108
3204
  const shared = createSectionShared();
3109
3205
  shared.kordocLayout = await readKordocLayout(zip);
3110
- shared.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _88 => _88.keepTrailingEmptyCols]);
3111
- shared.keepEmptyParagraphs = _optionalChain([options, 'optionalAccess', _89 => _89.keepEmptyParagraphs]);
3206
+ shared.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _94 => _94.keepTrailingEmptyCols]);
3207
+ shared.keepEmptyParagraphs = _optionalChain([options, 'optionalAccess', _95 => _95.keepEmptyParagraphs]);
3112
3208
  let parsedSections = 0;
3113
3209
  for (let si = 0; si < sectionPaths.length; si++) {
3114
3210
  if (pageFilter && !pageFilter.has(si + 1)) continue;
@@ -3120,7 +3216,7 @@ async function parseHwpxDocument(buffer, options) {
3120
3216
  if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new ZipBombError("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
3121
3217
  blocks.push(...parseSectionXml(xml, styleMap, warnings, si + 1, shared));
3122
3218
  parsedSections++;
3123
- _optionalChain([options, 'optionalAccess', _90 => _90.onProgress, 'optionalCall', _91 => _91(parsedSections, totalTarget)]);
3219
+ _optionalChain([options, 'optionalAccess', _96 => _96.onProgress, 'optionalCall', _97 => _97(parsedSections, totalTarget)]);
3124
3220
  } catch (secErr) {
3125
3221
  if (secErr instanceof ZipBombError) throw secErr;
3126
3222
  warnings.push({ page: si + 1, message: `\uC139\uC158 ${si + 1} \uD30C\uC2F1 \uC2E4\uD328: ${secErr instanceof Error ? secErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
@@ -3130,7 +3226,7 @@ async function parseHwpxDocument(buffer, options) {
3130
3226
  const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !pageFilter);
3131
3227
  detectHwpxHeadings(blocks, styleMap);
3132
3228
  const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
3133
- const markdown = _chunkAUOEZKJEcjs.blocksToMarkdown.call(void 0, blocks);
3229
+ const markdown = _chunkUDGPM5R5cjs.blocksToMarkdown.call(void 0, blocks);
3134
3230
  return { markdown, blocks, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
3135
3231
  }
3136
3232
 
@@ -3991,7 +4087,7 @@ function decryptViewText(viewTextRaw, compressed) {
3991
4087
  if (compressed) {
3992
4088
  try {
3993
4089
  return decompressStream(Buffer.from(decrypted));
3994
- } catch (e20) {
4090
+ } catch (e21) {
3995
4091
  return Buffer.from(decrypted);
3996
4092
  }
3997
4093
  }
@@ -4046,11 +4142,11 @@ var WORD_ALIASES = {
4046
4142
  var STRUCTURAL_FOLD = /* @__PURE__ */ new Set(["over", "root", "of"]);
4047
4143
  function normalizeWords(input) {
4048
4144
  return input.replace(/(?<![\\A-Za-z0-9])([A-Za-z][A-Za-z0-9]*)(?![A-Za-z0-9])/g, (word) => {
4049
- if (word in CONVERT_MAP || word in MIDDLE_CONVERT_MAP) return word;
4145
+ if (Object.hasOwn(CONVERT_MAP, word) || Object.hasOwn(MIDDLE_CONVERT_MAP, word)) return word;
4050
4146
  const lower = word.toLowerCase();
4051
4147
  if (STRUCTURAL_FOLD.has(lower)) return lower;
4052
- if (lower in WORD_ALIASES) return WORD_ALIASES[lower];
4053
- if (lower !== word && (lower in CONVERT_MAP || lower in MIDDLE_CONVERT_MAP)) return lower;
4148
+ if (Object.hasOwn(WORD_ALIASES, lower)) return WORD_ALIASES[lower];
4149
+ if (lower !== word && (Object.hasOwn(CONVERT_MAP, lower) || Object.hasOwn(MIDDLE_CONVERT_MAP, lower))) return lower;
4054
4150
  return word;
4055
4151
  });
4056
4152
  }
@@ -4070,6 +4166,84 @@ function hwpEquationToLatex(equation) {
4070
4166
  return hmlToLatex(s).replace(/\s+/g, " ").trim();
4071
4167
  }
4072
4168
 
4169
+ // src/hwp5/pw-crypto.ts
4170
+
4171
+ var ENCRYPT_VERSION_OFFSET = 44;
4172
+ var SUPPORTED_ENCRYPT_VERSION = 4;
4173
+ var KEY_SEED = 236;
4174
+ function readEncryptVersion(fileHeader) {
4175
+ if (fileHeader.length < ENCRYPT_VERSION_OFFSET + 4) return 0;
4176
+ return (fileHeader[ENCRYPT_VERSION_OFFSET] | fileHeader[ENCRYPT_VERSION_OFFSET + 1] << 8 | fileHeader[ENCRYPT_VERSION_OFFSET + 2] << 16 | fileHeader[ENCRYPT_VERSION_OFFSET + 3] << 24) >>> 0;
4177
+ }
4178
+ function derivePasswordKey(password) {
4179
+ const buf = Buffer.alloc(password.length * 2);
4180
+ for (let i = 0; i < password.length; i++) {
4181
+ const prev = i === 0 ? KEY_SEED : password[i - 1];
4182
+ buf[i * 2] = (prev << 1 | prev >> 7) & 255;
4183
+ buf[i * 2 + 1] = password[i];
4184
+ }
4185
+ return _crypto.createHash.call(void 0, "sha1").update(buf).digest().subarray(0, 16);
4186
+ }
4187
+ function padToBlock(data) {
4188
+ const rem = data.length % 16;
4189
+ if (rem === 0) return Buffer.from(data);
4190
+ const amount = 16 - rem;
4191
+ return Buffer.concat([Buffer.from(data), Buffer.alloc(amount, amount)]);
4192
+ }
4193
+ function shiftRegister(reg, feedbackBit) {
4194
+ for (let i = 0; i < 15; i++) {
4195
+ reg[i] = (reg[i] << 1 | reg[i + 1] >> 7) & 255;
4196
+ }
4197
+ reg[15] = (reg[15] << 1 | feedbackBit & 1) & 255;
4198
+ }
4199
+ function decryptAesCfb1(data, key) {
4200
+ const cipher = _crypto.createCipheriv.call(void 0, "aes-128-ecb", key, null);
4201
+ cipher.setAutoPadding(false);
4202
+ const register = new Uint8Array(16);
4203
+ const registerBuf = Buffer.alloc(16);
4204
+ const out = Buffer.alloc(data.length);
4205
+ for (let offset = 0; offset < data.length; offset += 16) {
4206
+ const len = Math.min(16, data.length - offset);
4207
+ const chunk = Buffer.alloc(16);
4208
+ data.copy(chunk, 0, offset, offset + len);
4209
+ for (let i = 0; i < 128; i++) {
4210
+ registerBuf.set(register);
4211
+ const keystreamMsb = cipher.update(registerBuf)[0];
4212
+ const byteIdx = i >> 3;
4213
+ const bitInByte = i & 7;
4214
+ const cipherBit = chunk[byteIdx] >> 7 - bitInByte & 1;
4215
+ shiftRegister(register, cipherBit);
4216
+ chunk[byteIdx] ^= (keystreamMsb & 128) >> bitInByte;
4217
+ }
4218
+ chunk.copy(out, offset, 0, len);
4219
+ }
4220
+ return out;
4221
+ }
4222
+ function decryptPasswordStream(raw, password) {
4223
+ const key = derivePasswordKey(Buffer.from(password, "utf8"));
4224
+ return decryptAesCfb1(padToBlock(raw), key).subarray(0, raw.length);
4225
+ }
4226
+ var TAG_DOCUMENT_PROPERTIES = 16;
4227
+ var TAG_ID_MAPPINGS = 17;
4228
+ function assertDecryptedDocInfo(data, readRecords3) {
4229
+ const wrong = () => new (0, _chunkH2KMJOB6cjs.KordocError)("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uAC70\uB098 \uC554\uD638\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
4230
+ let records;
4231
+ try {
4232
+ records = readRecords3(data);
4233
+ } catch (e22) {
4234
+ throw wrong();
4235
+ }
4236
+ if (_optionalChain([records, 'access', _98 => _98[0], 'optionalAccess', _99 => _99.tagId]) !== TAG_DOCUMENT_PROPERTIES) throw wrong();
4237
+ if (!records.some((r) => r.tagId === TAG_ID_MAPPINGS)) throw wrong();
4238
+ }
4239
+ function assertSupportedEncryptVersion(version) {
4240
+ if (version !== SUPPORTED_ENCRYPT_VERSION) {
4241
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(
4242
+ `\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
4243
+ );
4244
+ }
4245
+ }
4246
+
4073
4247
  // src/hwp5/parser.ts
4074
4248
  var _module = require('module');
4075
4249
  var require2 = _module.createRequire.call(void 0, _chunkGS7T56RPcjs.importMetaUrl);
@@ -4142,42 +4316,65 @@ function parseHwp5Document(buffer, options) {
4142
4316
  const warnings = [];
4143
4317
  try {
4144
4318
  cfb = CFB.parse(buffer);
4145
- } catch (e21) {
4319
+ } catch (e23) {
4146
4320
  try {
4147
4321
  lenientCfb = parseLenientCfb(buffer);
4148
4322
  warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
4149
- } catch (e22) {
4150
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
4323
+ } catch (e24) {
4324
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
4151
4325
  }
4152
4326
  }
4153
- const findStream = (path) => {
4327
+ const readRawStream = (path) => {
4154
4328
  if (cfb) {
4155
4329
  const entry = CFB.find(cfb, path);
4156
- return _optionalChain([entry, 'optionalAccess', _92 => _92.content]) ? Buffer.from(entry.content) : null;
4330
+ return _optionalChain([entry, 'optionalAccess', _100 => _100.content]) ? Buffer.from(entry.content) : null;
4157
4331
  }
4158
4332
  return lenientCfb.findStream(path);
4159
4333
  };
4160
- const headerData = findStream("/FileHeader");
4161
- if (!headerData) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
4334
+ const headerData = readRawStream("/FileHeader");
4335
+ if (!headerData) throw new (0, _chunkH2KMJOB6cjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
4162
4336
  const header = parseFileHeader(headerData);
4163
- if (header.signature !== "HWP Document File") throw new (0, _chunkJFV7QT5Tcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
4164
- if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
4165
- if (header.flags & FLAG_DRM) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
4337
+ if (header.signature !== "HWP Document File") throw new (0, _chunkH2KMJOB6cjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
4338
+ if (header.flags & FLAG_DRM) throw new (0, _chunkH2KMJOB6cjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
4339
+ const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
4340
+ if (encrypted) {
4341
+ if (!_optionalChain([options, 'optionalAccess', _101 => _101.password])) {
4342
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uC554\uD638\uB85C \uBCF4\uD638\uB41C HWP \uBB38\uC11C\uC785\uB2C8\uB2E4. password \uC635\uC158\uC5D0 \uC5F4\uAE30 \uC554\uD638\uB97C \uC9C0\uC815\uD558\uC138\uC694.");
4343
+ }
4344
+ assertSupportedEncryptVersion(readEncryptVersion(headerData));
4345
+ }
4346
+ const password = encrypted ? options.password : void 0;
4347
+ const findStream = (path) => {
4348
+ const raw = readRawStream(path);
4349
+ if (!raw || !password) return raw;
4350
+ return decryptPasswordStream(raw, password);
4351
+ };
4166
4352
  const compressed = (header.flags & FLAG_COMPRESSED) !== 0;
4167
4353
  const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
4168
4354
  const metadata = {
4169
4355
  version: `${header.versionMajor}.x`
4170
4356
  };
4171
4357
  if (cfb) extractHwp5Metadata(cfb, metadata);
4172
- const docInfo = cfb ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
4173
- const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
4174
- if (sections.length === 0) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
4358
+ if (encrypted) {
4359
+ const rawDocInfo = findStream("/DocInfo");
4360
+ if (!rawDocInfo) throw new (0, _chunkH2KMJOB6cjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
4361
+ let docInfoData;
4362
+ try {
4363
+ docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
4364
+ } catch (e25) {
4365
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uAC70\uB098 \uC554\uD638\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
4366
+ }
4367
+ assertDecryptedDocInfo(docInfoData, readRecords);
4368
+ }
4369
+ const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
4370
+ const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : encrypted ? findSectionsVia(findStream) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
4371
+ if (sections.length === 0) throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
4175
4372
  metadata.pageCount = sections.length;
4176
- const pageFilter = _optionalChain([options, 'optionalAccess', _93 => _93.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
4373
+ const pageFilter = _optionalChain([options, 'optionalAccess', _102 => _102.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
4177
4374
  const totalTarget = pageFilter ? pageFilter.size : sections.length;
4178
4375
  const bodyBlocks = [];
4179
4376
  const doc = createHwp5DocState();
4180
- doc.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _94 => _94.keepTrailingEmptyCols]);
4377
+ doc.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _103 => _103.keepTrailingEmptyCols]);
4181
4378
  let totalDecompressed = 0;
4182
4379
  let parsedSections = 0;
4183
4380
  for (let si = 0; si < sections.length; si++) {
@@ -4186,22 +4383,22 @@ function parseHwp5Document(buffer, options) {
4186
4383
  const sectionData = sections[si];
4187
4384
  const data = !distribution && compressed ? decompressStream(Buffer.from(sectionData)) : Buffer.from(sectionData);
4188
4385
  totalDecompressed += data.length;
4189
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4386
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4190
4387
  const records = readRecords(data);
4191
4388
  const sectionBlocks = parseSection(records, docInfo, warnings, si + 1, doc);
4192
4389
  bodyBlocks.push(...sectionBlocks);
4193
4390
  parsedSections++;
4194
- _optionalChain([options, 'optionalAccess', _95 => _95.onProgress, 'optionalCall', _96 => _96(parsedSections, totalTarget)]);
4391
+ _optionalChain([options, 'optionalAccess', _104 => _104.onProgress, 'optionalCall', _105 => _105(parsedSections, totalTarget)]);
4195
4392
  } catch (secErr) {
4196
- if (secErr instanceof _chunkJFV7QT5Tcjs.KordocError) throw secErr;
4393
+ if (secErr instanceof _chunkH2KMJOB6cjs.KordocError) throw secErr;
4197
4394
  warnings.push({ page: si + 1, message: `\uC139\uC158 ${si + 1} \uD30C\uC2F1 \uC2E4\uD328: ${secErr instanceof Error ? secErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
4198
4395
  }
4199
4396
  }
4200
4397
  const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
4201
4398
  const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter);
4202
- let flatBlocks = _chunkAUOEZKJEcjs.flattenLayoutTables.call(void 0, blocks);
4203
- if (_optionalChain([options, 'optionalAccess', _97 => _97.dedupeRunningHeaders])) {
4204
- const deduped = _chunkAUOEZKJEcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
4399
+ let flatBlocks = _chunkUDGPM5R5cjs.flattenLayoutTables.call(void 0, blocks);
4400
+ if (_optionalChain([options, 'optionalAccess', _106 => _106.dedupeRunningHeaders])) {
4401
+ const deduped = _chunkUDGPM5R5cjs.dedupeRunningHeaders.call(void 0, flatBlocks);
4205
4402
  const removed = flatBlocks.length - deduped.length;
4206
4403
  if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
4207
4404
  flatBlocks = deduped;
@@ -4210,10 +4407,10 @@ function parseHwp5Document(buffer, options) {
4210
4407
  detectHwp5Headings(flatBlocks, docInfo);
4211
4408
  }
4212
4409
  const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
4213
- let markdown = _chunkAUOEZKJEcjs.blocksToMarkdown.call(void 0, flatBlocks);
4214
- if (_optionalChain([options, 'optionalAccess', _98 => _98.inlineImages]) && images.length > 0) {
4410
+ let markdown = _chunkUDGPM5R5cjs.blocksToMarkdown.call(void 0, flatBlocks);
4411
+ if (_optionalChain([options, 'optionalAccess', _107 => _107.inlineImages]) && images.length > 0) {
4215
4412
  try {
4216
- markdown = _chunkAUOEZKJEcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
4413
+ markdown = _chunkUDGPM5R5cjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
4217
4414
  } catch (inlineErr) {
4218
4415
  warnings.push({ message: `\uC774\uBBF8\uC9C0 \uC778\uB77C\uC778 \uC2E4\uD328 \u2014 \uC6D0\uBCF8 \uD30C\uC77C \uCC38\uC870\uB85C \uD3F4\uBC31: ${inlineErr instanceof Error ? inlineErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "SKIPPED_IMAGE" });
4219
4416
  }
@@ -4223,11 +4420,11 @@ function parseHwp5Document(buffer, options) {
4223
4420
  function parseDocInfoStream(cfb, compressed) {
4224
4421
  try {
4225
4422
  const entry = CFB.find(cfb, "/DocInfo");
4226
- if (!_optionalChain([entry, 'optionalAccess', _99 => _99.content])) return null;
4423
+ if (!_optionalChain([entry, 'optionalAccess', _108 => _108.content])) return null;
4227
4424
  const data = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
4228
4425
  const records = readRecords(data);
4229
4426
  return parseDocInfo(records);
4230
- } catch (e23) {
4427
+ } catch (e26) {
4231
4428
  return null;
4232
4429
  }
4233
4430
  }
@@ -4236,7 +4433,7 @@ function parseDocInfoFromStream(raw, compressed) {
4236
4433
  try {
4237
4434
  const data = compressed ? decompressStream(raw) : raw;
4238
4435
  return parseDocInfo(readRecords(data));
4239
- } catch (e24) {
4436
+ } catch (e27) {
4240
4437
  return null;
4241
4438
  }
4242
4439
  }
@@ -4244,7 +4441,7 @@ function detectHwp5Headings(blocks, docInfo) {
4244
4441
  let baseFontSize = 0;
4245
4442
  const sizeFreq = /* @__PURE__ */ new Map();
4246
4443
  for (const b of blocks) {
4247
- if (_optionalChain([b, 'access', _100 => _100.style, 'optionalAccess', _101 => _101.fontSize]) && b.text) {
4444
+ if (_optionalChain([b, 'access', _109 => _109.style, 'optionalAccess', _110 => _110.fontSize]) && b.text) {
4248
4445
  sizeFreq.set(b.style.fontSize, (sizeFreq.get(b.style.fontSize) || 0) + b.text.length);
4249
4446
  }
4250
4447
  }
@@ -4260,7 +4457,7 @@ function detectHwp5Headings(blocks, docInfo) {
4260
4457
  const name = (style.nameKo || style.name).toLowerCase();
4261
4458
  if (name.includes("\uBC14\uD0D5") || name.includes("\uBCF8\uBB38") || name === "normal" || name === "body") {
4262
4459
  const cs = docInfo.charShapes[style.charShapeId];
4263
- if (_optionalChain([cs, 'optionalAccess', _102 => _102.fontSize]) > 0) {
4460
+ if (_optionalChain([cs, 'optionalAccess', _111 => _111.fontSize]) > 0) {
4264
4461
  baseFontSize = cs.fontSize / 10;
4265
4462
  break;
4266
4463
  }
@@ -4275,11 +4472,11 @@ function detectHwp5Headings(blocks, docInfo) {
4275
4472
  if (text.length === 0 || text.length > 200) continue;
4276
4473
  if (/^\d+$/.test(text)) continue;
4277
4474
  let level = 0;
4278
- if (_optionalChain([block, 'access', _103 => _103.style, 'optionalAccess', _104 => _104.fontSize]) && baseFontSize > 0) {
4475
+ if (_optionalChain([block, 'access', _112 => _112.style, 'optionalAccess', _113 => _113.fontSize]) && baseFontSize > 0) {
4279
4476
  const ratio = block.style.fontSize / baseFontSize;
4280
- if (ratio >= _chunkJFV7QT5Tcjs.HEADING_RATIO_H1) level = 1;
4281
- else if (ratio >= _chunkJFV7QT5Tcjs.HEADING_RATIO_H2) level = 2;
4282
- else if (ratio >= _chunkJFV7QT5Tcjs.HEADING_RATIO_H3) level = 3;
4477
+ if (ratio >= _chunkH2KMJOB6cjs.HEADING_RATIO_H1) level = 1;
4478
+ else if (ratio >= _chunkH2KMJOB6cjs.HEADING_RATIO_H2) level = 2;
4479
+ else if (ratio >= _chunkH2KMJOB6cjs.HEADING_RATIO_H3) level = 3;
4283
4480
  }
4284
4481
  if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
4285
4482
  if (level === 0) level = 2;
@@ -4295,7 +4492,7 @@ function detectHwp5Headings(blocks, docInfo) {
4295
4492
  function extractHwp5Metadata(cfb, metadata) {
4296
4493
  try {
4297
4494
  const summaryEntry = CFB.find(cfb, "/HwpSummaryInformation") || CFB.find(cfb, "/SummaryInformation");
4298
- if (!_optionalChain([summaryEntry, 'optionalAccess', _105 => _105.content])) return;
4495
+ if (!_optionalChain([summaryEntry, 'optionalAccess', _114 => _114.content])) return;
4299
4496
  const data = Buffer.from(summaryEntry.content);
4300
4497
  if (data.length < 48) return;
4301
4498
  const numSets = data.readUInt32LE(24);
@@ -4321,34 +4518,43 @@ function extractHwp5Metadata(cfb, metadata) {
4321
4518
  else if (propId === 4) metadata.author = str;
4322
4519
  else if (propId === 6) metadata.description = str;
4323
4520
  }
4324
- } catch (e25) {
4521
+ } catch (e28) {
4325
4522
  }
4326
4523
  }
4327
4524
  function findViewTextSections(cfb, compressed) {
4328
4525
  const sections = [];
4329
4526
  for (let i = 0; i < MAX_SECTIONS; i++) {
4330
4527
  const entry = CFB.find(cfb, `/ViewText/Section${i}`);
4331
- if (!_optionalChain([entry, 'optionalAccess', _106 => _106.content])) break;
4528
+ if (!_optionalChain([entry, 'optionalAccess', _115 => _115.content])) break;
4332
4529
  try {
4333
4530
  const decrypted = decryptViewText(Buffer.from(entry.content), compressed);
4334
4531
  sections.push({ idx: i, content: decrypted });
4335
- } catch (e26) {
4532
+ } catch (e29) {
4336
4533
  break;
4337
4534
  }
4338
4535
  }
4339
4536
  return sections.sort((a, b) => a.idx - b.idx).map((s) => s.content);
4340
4537
  }
4538
+ function findSectionsVia(read) {
4539
+ const sections = [];
4540
+ for (let i = 0; i < MAX_SECTIONS; i++) {
4541
+ const raw = read(`/BodyText/Section${i}`);
4542
+ if (!raw) break;
4543
+ sections.push(raw);
4544
+ }
4545
+ return sections;
4546
+ }
4341
4547
  function findSections(cfb) {
4342
4548
  const sections = [];
4343
4549
  for (let i = 0; i < MAX_SECTIONS; i++) {
4344
4550
  const entry = CFB.find(cfb, `/BodyText/Section${i}`);
4345
- if (!_optionalChain([entry, 'optionalAccess', _107 => _107.content])) break;
4551
+ if (!_optionalChain([entry, 'optionalAccess', _116 => _116.content])) break;
4346
4552
  sections.push({ idx: i, content: Buffer.from(entry.content) });
4347
4553
  }
4348
4554
  if (sections.length === 0 && cfb.FileIndex) {
4349
4555
  for (const entry of cfb.FileIndex) {
4350
4556
  if (sections.length >= MAX_SECTIONS) break;
4351
- if (_optionalChain([entry, 'access', _108 => _108.name, 'optionalAccess', _109 => _109.startsWith, 'call', _110 => _110("Section")]) && entry.content) {
4557
+ if (_optionalChain([entry, 'access', _117 => _117.name, 'optionalAccess', _118 => _118.startsWith, 'call', _119 => _119("Section")]) && entry.content) {
4352
4558
  const idx = parseInt(entry.name.replace("Section", ""), 10) || 0;
4353
4559
  sections.push({ idx, content: Buffer.from(entry.content) });
4354
4560
  }
@@ -4364,7 +4570,7 @@ function findSectionsLenient(lcfb, compressed) {
4364
4570
  if (!raw) break;
4365
4571
  const content = compressed ? decompressStream(raw) : raw;
4366
4572
  totalDecompressed += content.length;
4367
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4573
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4368
4574
  sections.push({ idx: i, content });
4369
4575
  }
4370
4576
  if (sections.length === 0) {
@@ -4376,7 +4582,7 @@ function findSectionsLenient(lcfb, compressed) {
4376
4582
  if (raw) {
4377
4583
  const content = compressed ? decompressStream(raw) : raw;
4378
4584
  totalDecompressed += content.length;
4379
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4585
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4380
4586
  sections.push({ idx, content });
4381
4587
  }
4382
4588
  }
@@ -4393,9 +4599,9 @@ function findViewTextSectionsLenient(lcfb, compressed) {
4393
4599
  try {
4394
4600
  const content = decryptViewText(raw, compressed);
4395
4601
  totalDecompressed += content.length;
4396
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4602
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4397
4603
  sections.push({ idx: i, content });
4398
- } catch (e27) {
4604
+ } catch (e30) {
4399
4605
  break;
4400
4606
  }
4401
4607
  }
@@ -4494,9 +4700,9 @@ function parseParagraph(records, start, end, ctx) {
4494
4700
  const applied = [];
4495
4701
  for (const r of ranges) {
4496
4702
  const ctrl = ctrls[r.ctrlIdx];
4497
- if (!_optionalChain([ctrl, 'optionalAccess', _111 => _111.href]) || r.end <= r.start) continue;
4703
+ if (!_optionalChain([ctrl, 'optionalAccess', _120 => _120.href]) || r.end <= r.start) continue;
4498
4704
  if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
4499
- const href = _chunkJFV7QT5Tcjs.sanitizeHref.call(void 0, ctrl.href);
4705
+ const href = _chunkH2KMJOB6cjs.sanitizeHref.call(void 0, ctrl.href);
4500
4706
  if (!href) continue;
4501
4707
  const anchor = text.slice(r.start, r.end);
4502
4708
  if (!anchor.trim()) continue;
@@ -4514,7 +4720,7 @@ function parseParagraph(records, start, end, ctx) {
4514
4720
  }
4515
4721
  if (ps.headType === 1 || ps.headType === 2) {
4516
4722
  const nid = ps.numberingId || (ps.headType === 1 ? ctx.doc.outlineNumberingId : 0);
4517
- const numbering = nid >= 1 ? _optionalChain([ctx, 'access', _112 => _112.docInfo, 'optionalAccess', _113 => _113.numberings, 'access', _114 => _114[nid - 1]]) : void 0;
4723
+ const numbering = nid >= 1 ? _optionalChain([ctx, 'access', _121 => _121.docInfo, 'optionalAccess', _122 => _122.numberings, 'access', _123 => _123[nid - 1]]) : void 0;
4518
4724
  if (numbering) {
4519
4725
  const counters = ctx.doc.numbering.advance(nid, ps.paraLevel);
4520
4726
  const fmt = numbering.levelFormats[Math.min(ps.paraLevel, 6)];
@@ -4524,7 +4730,7 @@ function parseParagraph(records, start, end, ctx) {
4524
4730
  }
4525
4731
  }
4526
4732
  } else if (ps.headType === 3) {
4527
- const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access', _115 => _115.docInfo, 'optionalAccess', _116 => _116.bullets, 'access', _117 => _117[ps.numberingId - 1]]) : void 0;
4733
+ const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access', _124 => _124.docInfo, 'optionalAccess', _125 => _125.bullets, 'access', _126 => _126[ps.numberingId - 1]]) : void 0;
4528
4734
  if (bullet && bullet.char !== "\uFFFF") headMarker = bullet.char;
4529
4735
  }
4530
4736
  }
@@ -4732,8 +4938,8 @@ function parseTableControl(ctrl, records, ctx) {
4732
4938
  let tableIdx = -1;
4733
4939
  for (let i2 = childStart; i2 < childEnd; i2++) {
4734
4940
  if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
4735
- rows = Math.min(records[i2].data.readUInt16LE(4), _chunkAUOEZKJEcjs.MAX_ROWS);
4736
- cols = Math.min(records[i2].data.readUInt16LE(6), _chunkAUOEZKJEcjs.MAX_COLS);
4941
+ rows = Math.min(records[i2].data.readUInt16LE(4), _chunkUDGPM5R5cjs.MAX_ROWS);
4942
+ cols = Math.min(records[i2].data.readUInt16LE(6), _chunkUDGPM5R5cjs.MAX_COLS);
4737
4943
  tableIdx = i2;
4738
4944
  break;
4739
4945
  }
@@ -4773,7 +4979,7 @@ function parseTableControl(ctrl, records, ctx) {
4773
4979
  const cellRows2 = arrangeCells(rows, cols, cells);
4774
4980
  const irCells = cellRows2.map((row) => row.map((c) => {
4775
4981
  const ir = { text: c.text.trim(), colSpan: c.colSpan, rowSpan: c.rowSpan };
4776
- if (_optionalChain([c, 'access', _118 => _118.blocks, 'optionalAccess', _119 => _119.length])) ir.blocks = c.blocks;
4982
+ if (_optionalChain([c, 'access', _127 => _127.blocks, 'optionalAccess', _128 => _128.length])) ir.blocks = c.blocks;
4777
4983
  if (c.isHeader) ir.isHeader = true;
4778
4984
  return ir;
4779
4985
  }));
@@ -4782,7 +4988,7 @@ function parseTableControl(ctrl, records, ctx) {
4782
4988
  return table3;
4783
4989
  }
4784
4990
  const cellRows = arrangeCells(rows, cols, cells);
4785
- const table2 = _chunkAUOEZKJEcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
4991
+ const table2 = _chunkUDGPM5R5cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
4786
4992
  if (caption && table2.rows > 0) table2.caption = caption;
4787
4993
  return table2.rows > 0 ? table2 : null;
4788
4994
  }
@@ -4799,8 +5005,8 @@ function parseCell(records, lhIdx, end, ctx) {
4799
5005
  rowAddr = rec.data.readUInt16LE(10);
4800
5006
  const cs = rec.data.readUInt16LE(12);
4801
5007
  const rs = rec.data.readUInt16LE(14);
4802
- if (cs > 0) colSpan = Math.min(cs, _chunkAUOEZKJEcjs.MAX_COLS);
4803
- if (rs > 0) rowSpan = Math.min(rs, _chunkAUOEZKJEcjs.MAX_ROWS);
5008
+ if (cs > 0) colSpan = Math.min(cs, _chunkUDGPM5R5cjs.MAX_COLS);
5009
+ if (rs > 0) rowSpan = Math.min(rs, _chunkUDGPM5R5cjs.MAX_ROWS);
4804
5010
  }
4805
5011
  const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
4806
5012
  const parts = [];
@@ -4810,7 +5016,7 @@ function parseCell(records, lhIdx, end, ctx) {
4810
5016
  parts.push(`![image](hwp5bin:${b.text})`);
4811
5017
  hasStructure = true;
4812
5018
  } else if (b.type === "table" && b.table) {
4813
- const flat = _chunkAUOEZKJEcjs.convertTableToText.call(void 0, b.table.cells);
5019
+ const flat = _chunkUDGPM5R5cjs.convertTableToText.call(void 0, b.table.cells);
4814
5020
  if (flat) parts.push(flat);
4815
5021
  hasStructure = true;
4816
5022
  } else if (b.text) {
@@ -4907,8 +5113,8 @@ function pictureToImageBlock(data, ctx) {
4907
5113
  if (data.length < 73) return null;
4908
5114
  const binDataId = data.readUInt16LE(71);
4909
5115
  if (binDataId === 0) return null;
4910
- const item = _optionalChain([ctx, 'access', _120 => _120.docInfo, 'optionalAccess', _121 => _121.binData, 'access', _122 => _122[binDataId - 1]]);
4911
- if (_optionalChain([item, 'optionalAccess', _123 => _123.kind]) === "link") {
5116
+ const item = _optionalChain([ctx, 'access', _129 => _129.docInfo, 'optionalAccess', _130 => _130.binData, 'access', _131 => _131[binDataId - 1]]);
5117
+ if (_optionalChain([item, 'optionalAccess', _132 => _132.kind]) === "link") {
4912
5118
  ctx.warnings.push({ page: ctx.sectionNum, message: `\uC678\uBD80 \uC5F0\uACB0 \uC774\uBBF8\uC9C0 (binDataId ${binDataId})`, code: "SKIPPED_IMAGE" });
4913
5119
  return null;
4914
5120
  }
@@ -16851,6 +17057,23 @@ function lookupSymbol(ch) {
16851
17057
  return null;
16852
17058
  }
16853
17059
  var JOHAB_UNMAPPED = -1;
17060
+ var JUNG_ARAEA = 30;
17061
+ var ARAEA_JAMO = 4510;
17062
+ function decodeAraeaSyllable(ch) {
17063
+ if (ch < 32768) return null;
17064
+ if ((ch >> 5 & 31) !== JUNG_ARAEA) return null;
17065
+ const cho = CHO_MAP[ch >> 10 & 31];
17066
+ const jong = JONG_MAP[ch & 31];
17067
+ if (cho === -1 || jong === -1) return null;
17068
+ const out = String.fromCodePoint(4352 + cho) + String.fromCodePoint(ARAEA_JAMO);
17069
+ return jong === 0 ? out : out + String.fromCodePoint(4519 + jong);
17070
+ }
17071
+ function decodeJohabText(ch) {
17072
+ const araea = decodeAraeaSyllable(ch);
17073
+ if (araea) return araea;
17074
+ const cp = decodeJohab(ch);
17075
+ return cp === JOHAB_UNMAPPED ? null : String.fromCodePoint(cp);
17076
+ }
16854
17077
  function decodeJohab(ch) {
16855
17078
  if (ch < 128) return ch;
16856
17079
  if (ch >= 32768) {
@@ -16872,6 +17095,7 @@ function decodeJohab(ch) {
16872
17095
  function decodeHwp3Extra(ch) {
16873
17096
  if (ch >= 13712 && ch <= 13721) return 8544 + (ch - 13712);
16874
17097
  if (ch >= 14055 && ch <= 14064) return 9312 + (ch - 14055);
17098
+ if (ch >= 14272 && ch <= 14277) return "\uD55C\uAE00\uACFC\uCEF4\uD4E8\uD130".codePointAt(ch - 14272);
16875
17099
  switch (ch) {
16876
17100
  case 129:
16877
17101
  return 8220;
@@ -16906,6 +17130,9 @@ function decodeHwp3Extra(ch) {
16906
17130
  case 13434:
16907
17131
  return 9654;
16908
17132
  // ▶
17133
+ case 12135:
17134
+ return 9656;
17135
+ // ▸ 표 셀 글머리표 (rhwp 16db8260 — HWP5 변환본·한컴 PDF 대조)
16909
17136
  default:
16910
17137
  return JOHAB_UNMAPPED;
16911
17138
  }
@@ -16916,8 +17143,7 @@ function decodeHcharString(bytes) {
16916
17143
  while (i + 1 < bytes.length) {
16917
17144
  const ch = bytes[i] | bytes[i + 1] << 8;
16918
17145
  if (ch === 0) break;
16919
- const cp = decodeJohab(ch);
16920
- if (cp !== JOHAB_UNMAPPED) out += String.fromCodePoint(cp);
17146
+ out += _nullishCoalesce(decodeJohabText(ch), () => ( ""));
16921
17147
  i += 2;
16922
17148
  }
16923
17149
  return out;
@@ -17022,6 +17248,87 @@ function readHeader(reader) {
17022
17248
  return { compressed, encrypted, infoBlockLength, title, subject, author, date };
17023
17249
  }
17024
17250
 
17251
+ // src/hwp3/crypto.ts
17252
+
17253
+
17254
+ var FIXED_HEADER_BYTES = SIGNATURE_LEN + DOC_INFO_SIZE + DOC_SUMMARY_SIZE;
17255
+ var PASSWORD_FLAG_OFFSET = SIGNATURE_LEN + 96;
17256
+ var COMPRESSION_FLAG_OFFSET = SIGNATURE_LEN + 124;
17257
+ var INFO_BLOCK_LENGTH_OFFSET = SIGNATURE_LEN + 126;
17258
+ var PASSWORD_PREFIX_BYTES = 256;
17259
+ var MAX_DECOMPRESSED_BYTES = 100 * 1024 * 1024;
17260
+ function isEncryptedHwp3(data) {
17261
+ if (data.length < FIXED_HEADER_BYTES) return false;
17262
+ return (data[PASSWORD_FLAG_OFFSET] | data[PASSWORD_FLAG_OFFSET + 1] << 8) !== 0;
17263
+ }
17264
+ function deriveDesKey(password) {
17265
+ const rolling = new Uint8Array(7);
17266
+ let index = 0;
17267
+ for (let i = 0; i < password.length; i++) {
17268
+ const unit = password.charCodeAt(i);
17269
+ for (const byte of [unit & 255, unit >> 8 & 255]) {
17270
+ const slot = index % rolling.length;
17271
+ const mixed = rolling[slot] ^ byte;
17272
+ rolling[slot] = (mixed << 1 | mixed >> 7) & 255;
17273
+ index++;
17274
+ }
17275
+ }
17276
+ const key = Buffer.alloc(8);
17277
+ for (let bit = 0; bit < 56; bit++) {
17278
+ const sourceBit = rolling[Math.floor(bit / 8)] >> 7 - bit % 8 & 1;
17279
+ key[Math.floor(bit / 7)] |= sourceBit << 7 - bit % 7;
17280
+ }
17281
+ return key;
17282
+ }
17283
+ function desEcbDecrypt(data, key) {
17284
+ const decipher = _crypto.createDecipheriv.call(void 0, "des-ede3-ecb", Buffer.concat([key, key, key]), null);
17285
+ decipher.setAutoPadding(false);
17286
+ return Buffer.concat([decipher.update(data), decipher.final()]);
17287
+ }
17288
+ function readLayout(data) {
17289
+ if (data.length < FIXED_HEADER_BYTES) {
17290
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
17291
+ }
17292
+ const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
17293
+ const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
17294
+ if (payloadOffset >= data.length) {
17295
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
17296
+ }
17297
+ return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
17298
+ }
17299
+ function decryptHwp3Document(input, password) {
17300
+ const { payloadOffset, compressed } = readLayout(input);
17301
+ if (!compressed) {
17302
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP3 \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4 (\uC555\uCD95\uB418\uC9C0 \uC54A\uC740 \uC554\uD638 \uBCF8\uBB38)");
17303
+ }
17304
+ const source = Buffer.from(input);
17305
+ const payload = source.subarray(payloadOffset);
17306
+ const aligned = payload.subarray(0, payload.length - payload.length % 8);
17307
+ if (aligned.length === 0) {
17308
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
17309
+ }
17310
+ const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
17311
+ let inflated;
17312
+ try {
17313
+ inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
17314
+ } catch (err) {
17315
+ if (_optionalChain([err, 'optionalAccess', _133 => _133.code]) === "ERR_BUFFER_TOO_LARGE") {
17316
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(
17317
+ `HWP3 \uC554\uD638 \uBCF8\uBB38\uC758 \uC555\uCD95 \uD574\uC81C \uACB0\uACFC\uAC00 \uCD5C\uB300 \uD5C8\uC6A9 \uD06C\uAE30(${MAX_DECOMPRESSED_BYTES / 1024 / 1024}MB)\uB97C \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4`
17318
+ );
17319
+ }
17320
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uAC70\uB098 \uC554\uD638\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
17321
+ }
17322
+ if (inflated.length <= PASSWORD_PREFIX_BYTES) {
17323
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uAC70\uB098 \uC554\uD638\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
17324
+ }
17325
+ const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
17326
+ const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
17327
+ out.writeUInt16LE(0, PASSWORD_FLAG_OFFSET);
17328
+ out[COMPRESSION_FLAG_OFFSET] = 0;
17329
+ return out;
17330
+ }
17331
+
17025
17332
  // src/hwp3/parser.ts
17026
17333
  var MAX_DECOMPRESS_SIZE3 = 100 * 1024 * 1024;
17027
17334
  var PARA_SHAPE_SIZE = 187;
@@ -17044,12 +17351,18 @@ var SIMPLE_CTRL = /* @__PURE__ */ new Map([
17044
17351
  [30, { extraBytes: 2, extraHchar: 1, emit: "\xA0" }],
17045
17352
  [31, { extraBytes: 2, extraHchar: 1, emit: " " }]
17046
17353
  ]);
17047
- function parseHwp3Document(buffer, _options) {
17048
- const headReader = new Reader(Buffer.from(buffer));
17049
- const header = readHeader(headReader);
17050
- if (header.encrypted !== 0) {
17051
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("\uC554\uD638\uD654\uB41C HWP3 \uBB38\uC11C \u2014 \uBCF8\uBB38\uC774 \uC554\uD638\uB85C \uBCF4\uD638\uB418\uC5B4 \uC788\uC5B4 \uCD94\uCD9C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");
17354
+ function parseHwp3Document(buffer, options) {
17355
+ let source = Buffer.from(buffer);
17356
+ if (isEncryptedHwp3(source)) {
17357
+ if (!_optionalChain([options, 'optionalAccess', _134 => _134.password])) {
17358
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(
17359
+ "\uC554\uD638\uB85C \uBCF4\uD638\uB41C HWP3 \uBB38\uC11C\uC785\uB2C8\uB2E4. password \uC635\uC158\uC5D0 \uC5F4\uAE30 \uC554\uD638\uB97C \uC9C0\uC815\uD558\uC138\uC694."
17360
+ );
17361
+ }
17362
+ source = decryptHwp3Document(source, options.password);
17052
17363
  }
17364
+ const headReader = new Reader(source);
17365
+ const header = readHeader(headReader);
17053
17366
  headReader.skip(header.infoBlockLength);
17054
17367
  const tail = headReader.readToEnd();
17055
17368
  let body;
@@ -17058,11 +17371,11 @@ function parseHwp3Document(buffer, _options) {
17058
17371
  try {
17059
17372
  body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
17060
17373
  } catch (err) {
17061
- if (_optionalChain([err, 'optionalAccess', _124 => _124.code]) === "ERR_BUFFER_TOO_LARGE") {
17062
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uACB0\uACFC\uAC00 \uCD5C\uB300 \uD5C8\uC6A9 \uD06C\uAE30(${MAX_DECOMPRESS_SIZE3 / 1024 / 1024}MB)\uB97C \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4`);
17374
+ if (_optionalChain([err, 'optionalAccess', _135 => _135.code]) === "ERR_BUFFER_TOO_LARGE") {
17375
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uACB0\uACFC\uAC00 \uCD5C\uB300 \uD5C8\uC6A9 \uD06C\uAE30(${MAX_DECOMPRESS_SIZE3 / 1024 / 1024}MB)\uB97C \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4`);
17063
17376
  }
17064
17377
  const msg2 = err instanceof Error ? err.message : String(err);
17065
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
17378
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
17066
17379
  }
17067
17380
  } else {
17068
17381
  body = tail;
@@ -17159,8 +17472,7 @@ function parseCharStream(reader, charCount, ctx) {
17159
17472
  continue;
17160
17473
  }
17161
17474
  if (ch >= 32) {
17162
- const cp = decodeJohab(ch);
17163
- if (cp !== JOHAB_UNMAPPED) out += String.fromCodePoint(cp);
17475
+ out += _nullishCoalesce(decodeJohabText(ch), () => ( ""));
17164
17476
  continue;
17165
17477
  }
17166
17478
  const simple = SIMPLE_CTRL.get(ch);
@@ -17228,7 +17540,7 @@ function parseCharStream(reader, charCount, ctx) {
17228
17540
  function parseTableLike(reader, ctx) {
17229
17541
  const info = reader.readBytes(84);
17230
17542
  const cellCount = info.readUInt16LE(80) || 1;
17231
- if (cellCount > 256) {
17543
+ if (27 * cellCount > reader.remaining()) {
17232
17544
  ctx.warnings.push({
17233
17545
  code: "PARTIAL_PARSE",
17234
17546
  message: `HWP3 \uD45C cell_count=${cellCount} \uBE44\uC815\uC0C1 \u2014 \uD45C \uBCF8\uBB38 \uCD94\uCD9C \uD3EC\uAE30`
@@ -17242,10 +17554,11 @@ function parseTableLike(reader, ctx) {
17242
17554
  parseParagraphList2(reader, ctx);
17243
17555
  return "";
17244
17556
  }
17245
- function parsePicture(reader, _ctx) {
17557
+ function parsePicture(reader, ctx) {
17246
17558
  const info = reader.readBytes(348);
17247
17559
  const nExt = info.readUInt32LE(0);
17248
17560
  if (nExt > 0 && nExt < 100 * 1024 * 1024) reader.skip(nExt);
17561
+ parseParagraphList2(reader, ctx);
17249
17562
  }
17250
17563
 
17251
17564
  // src/hwp5/sentinel.ts
@@ -17296,15 +17609,15 @@ function getElements(parent, tagName) {
17296
17609
  const result = [];
17297
17610
  for (let i = 0; i < nodes.length; i++) result.push(nodes[i]);
17298
17611
  if (result.length > 0) return result;
17299
- const nsNodes = _optionalChain([parent, 'access', _125 => _125.getElementsByTagNameNS, 'optionalCall', _126 => _126("*", tagName)]);
17612
+ const nsNodes = _optionalChain([parent, 'access', _136 => _136.getElementsByTagNameNS, 'optionalCall', _137 => _137("*", tagName)]);
17300
17613
  if (nsNodes) for (let i = 0; i < nsNodes.length; i++) result.push(nsNodes[i]);
17301
17614
  return result;
17302
17615
  }
17303
17616
  function getTextContent(el) {
17304
- return _nullishCoalesce(_optionalChain([el, 'access', _127 => _127.textContent, 'optionalAccess', _128 => _128.trim, 'call', _129 => _129()]), () => ( ""));
17617
+ return _nullishCoalesce(_optionalChain([el, 'access', _138 => _138.textContent, 'optionalAccess', _139 => _139.trim, 'call', _140 => _140()]), () => ( ""));
17305
17618
  }
17306
17619
  function parseXml(text) {
17307
- return new (0, _xmldom.DOMParser)().parseFromString(_chunkJFV7QT5Tcjs.stripDtd.call(void 0, text), "text/xml");
17620
+ return new (0, _xmldom.DOMParser)().parseFromString(_chunkH2KMJOB6cjs.stripDtd.call(void 0, text), "text/xml");
17308
17621
  }
17309
17622
  function collectRichText(root) {
17310
17623
  let out = "";
@@ -17313,7 +17626,7 @@ function collectRichText(root) {
17313
17626
  for (let i = 0; i < children.length; i++) {
17314
17627
  if (children[i].nodeType !== 1) continue;
17315
17628
  const el = children[i];
17316
- const local = el.localName || _optionalChain([el, 'access', _130 => _130.tagName, 'optionalAccess', _131 => _131.replace, 'call', _132 => _132(/^[^:]+:/, "")]) || "";
17629
+ const local = el.localName || _optionalChain([el, 'access', _141 => _141.tagName, 'optionalAccess', _142 => _142.replace, 'call', _143 => _143(/^[^:]+:/, "")]) || "";
17317
17630
  if (local === "rPh") continue;
17318
17631
  if (local === "t") out += _nullishCoalesce(el.textContent, () => ( ""));
17319
17632
  else walk(el);
@@ -17532,14 +17845,14 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
17532
17845
  const merge = mergeMap.get(key);
17533
17846
  row.push({
17534
17847
  text,
17535
- colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _133 => _133.colSpan]), () => ( 1)),
17536
- rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _134 => _134.rowSpan]), () => ( 1))
17848
+ colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _144 => _144.colSpan]), () => ( 1)),
17849
+ rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _145 => _145.rowSpan]), () => ( 1))
17537
17850
  });
17538
17851
  }
17539
17852
  cellRows.push(row);
17540
17853
  }
17541
17854
  if (cellRows.length > 0) {
17542
- const table2 = _chunkAUOEZKJEcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
17855
+ const table2 = _chunkUDGPM5R5cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
17543
17856
  if (table2.rows > 0) {
17544
17857
  blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
17545
17858
  }
@@ -17547,12 +17860,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
17547
17860
  return blocks;
17548
17861
  }
17549
17862
  async function parseXlsxDocument(buffer, options) {
17550
- _chunkJFV7QT5Tcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
17863
+ _chunkH2KMJOB6cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
17551
17864
  const zip = await _jszip2.default.loadAsync(buffer);
17552
17865
  const warnings = [];
17553
17866
  const workbookFile = zip.file("xl/workbook.xml");
17554
17867
  if (!workbookFile) {
17555
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
17868
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
17556
17869
  }
17557
17870
  let sharedStrings = [];
17558
17871
  const ssFile = zip.file("xl/sharedStrings.xml");
@@ -17561,14 +17874,14 @@ async function parseXlsxDocument(buffer, options) {
17561
17874
  }
17562
17875
  const { sheets, date1904 } = parseWorkbook(await workbookFile.async("text"));
17563
17876
  if (sheets.length === 0) {
17564
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
17877
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
17565
17878
  }
17566
17879
  let dateXfs = /* @__PURE__ */ new Map();
17567
17880
  const stylesFile = zip.file("xl/styles.xml");
17568
17881
  if (stylesFile) {
17569
17882
  try {
17570
17883
  dateXfs = parseStyleDateXfs(await stylesFile.async("text"));
17571
- } catch (e28) {
17884
+ } catch (e31) {
17572
17885
  warnings.push({
17573
17886
  code: "PARTIAL_PARSE",
17574
17887
  message: "xl/styles.xml \uB0A0\uC9DC \uC11C\uC2DD \uD310\uC815 \uC2E4\uD328 \u2014 \uB0A0\uC9DC \uC140\uC774 \uC2DC\uB9AC\uC5BC \uC22B\uC790\uB85C \uCD9C\uB825\uB420 \uC218 \uC788\uC2B5\uB2C8\uB2E4"
@@ -17581,7 +17894,7 @@ async function parseXlsxDocument(buffer, options) {
17581
17894
  relsMap = parseRels(await relsFile.async("text"));
17582
17895
  }
17583
17896
  let pageFilter = null;
17584
- if (_optionalChain([options, 'optionalAccess', _135 => _135.pages])) {
17897
+ if (_optionalChain([options, 'optionalAccess', _146 => _146.pages])) {
17585
17898
  const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
17586
17899
  pageFilter = parsePageRange2(options.pages, sheets.length);
17587
17900
  }
@@ -17590,7 +17903,7 @@ async function parseXlsxDocument(buffer, options) {
17590
17903
  for (let i = 0; i < processedSheets; i++) {
17591
17904
  if (pageFilter && !pageFilter.has(i + 1)) continue;
17592
17905
  const sheet = sheets[i];
17593
- _optionalChain([options, 'optionalAccess', _136 => _136.onProgress, 'optionalCall', _137 => _137(i + 1, processedSheets)]);
17906
+ _optionalChain([options, 'optionalAccess', _147 => _147.onProgress, 'optionalCall', _148 => _148(i + 1, processedSheets)]);
17594
17907
  let sheetPath = relsMap.get(sheet.rId);
17595
17908
  if (sheetPath) {
17596
17909
  if (!sheetPath.startsWith("xl/") && !sheetPath.startsWith("/")) {
@@ -17613,7 +17926,7 @@ async function parseXlsxDocument(buffer, options) {
17613
17926
  try {
17614
17927
  const sheetXml = await sheetFile.async("text");
17615
17928
  const { grid, merges, maxRow, maxCol } = parseWorksheet(sheetXml, sharedStrings, dateXfs, date1904);
17616
- const sheetBlocks = sheetToBlocks(sheet.name, grid, merges, maxRow, maxCol, i, _optionalChain([options, 'optionalAccess', _138 => _138.keepTrailingEmptyCols]));
17929
+ const sheetBlocks = sheetToBlocks(sheet.name, grid, merges, maxRow, maxCol, i, _optionalChain([options, 'optionalAccess', _149 => _149.keepTrailingEmptyCols]));
17617
17930
  blocks.push(...sheetBlocks);
17618
17931
  } catch (err) {
17619
17932
  warnings.push({
@@ -17642,10 +17955,10 @@ async function parseXlsxDocument(buffer, options) {
17642
17955
  if (created) metadata.createdAt = created;
17643
17956
  const modified = getFirst("dcterms:modified");
17644
17957
  if (modified) metadata.modifiedAt = modified;
17645
- } catch (e29) {
17958
+ } catch (e32) {
17646
17959
  }
17647
17960
  }
17648
- const markdown = _chunkAUOEZKJEcjs.blocksToMarkdown.call(void 0, blocks);
17961
+ const markdown = _chunkUDGPM5R5cjs.blocksToMarkdown.call(void 0, blocks);
17649
17962
  return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
17650
17963
  }
17651
17964
 
@@ -18096,11 +18409,11 @@ function processGlobals(records) {
18096
18409
  const xfFmtIds = [];
18097
18410
  const firstBof = records[0];
18098
18411
  if (!firstBof || firstBof.opcode !== OP_BOF) {
18099
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
18412
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
18100
18413
  }
18101
18414
  const bof = decodeBof(firstBof.data);
18102
18415
  if (!bof || bof.dt !== DT_GLOBALS) {
18103
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
18416
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
18104
18417
  }
18105
18418
  let i = 1;
18106
18419
  while (i < records.length) {
@@ -18228,14 +18541,14 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex, keepAnchoredEmptyCols) {
18228
18541
  const merge = mergeMap.get(key);
18229
18542
  row.push({
18230
18543
  text: grid[r][c],
18231
- colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _139 => _139.colSpan]), () => ( 1)),
18232
- rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _140 => _140.rowSpan]), () => ( 1))
18544
+ colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _150 => _150.colSpan]), () => ( 1)),
18545
+ rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _151 => _151.rowSpan]), () => ( 1))
18233
18546
  });
18234
18547
  }
18235
18548
  cellRows.push(row);
18236
18549
  }
18237
18550
  if (cellRows.length > 0) {
18238
- const table2 = _chunkAUOEZKJEcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
18551
+ const table2 = _chunkUDGPM5R5cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
18239
18552
  if (table2.rows > 0) {
18240
18553
  blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
18241
18554
  }
@@ -18248,28 +18561,28 @@ async function parseXlsDocument(buffer, options) {
18248
18561
  try {
18249
18562
  cfb = parseLenientCfb(buf);
18250
18563
  } catch (e) {
18251
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)(
18564
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(
18252
18565
  `XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
18253
18566
  );
18254
18567
  }
18255
18568
  const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
18256
18569
  if (!wb) {
18257
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
18570
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
18258
18571
  }
18259
18572
  const records = readRecords2(wb);
18260
18573
  if (records.length === 0) {
18261
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
18574
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
18262
18575
  }
18263
18576
  const firstBof = decodeBof(records[0].data);
18264
18577
  if (firstBof && firstBof.vers !== 1536) {
18265
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)(
18578
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(
18266
18579
  `XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
18267
18580
  );
18268
18581
  }
18269
18582
  const globals = processGlobals(records);
18270
18583
  const warnings = [];
18271
18584
  if (globals.encrypted) {
18272
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
18585
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
18273
18586
  }
18274
18587
  const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
18275
18588
  const kind = globals.dateXfs.get(ixfe);
@@ -18281,7 +18594,7 @@ async function parseXlsDocument(buffer, options) {
18281
18594
  } : void 0;
18282
18595
  const totalSheets = Math.min(globals.sheets.length, MAX_SHEETS2);
18283
18596
  let pageFilter = null;
18284
- if (_optionalChain([options, 'optionalAccess', _141 => _141.pages])) {
18597
+ if (_optionalChain([options, 'optionalAccess', _152 => _152.pages])) {
18285
18598
  const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
18286
18599
  pageFilter = parsePageRange2(options.pages, totalSheets);
18287
18600
  }
@@ -18290,7 +18603,7 @@ async function parseXlsDocument(buffer, options) {
18290
18603
  if (pageFilter && !pageFilter.has(i + 1)) continue;
18291
18604
  const meta = globals.sheets[i];
18292
18605
  if (meta.dt !== 0) continue;
18293
- _optionalChain([options, 'optionalAccess', _142 => _142.onProgress, 'optionalCall', _143 => _143(i + 1, totalSheets)]);
18606
+ _optionalChain([options, 'optionalAccess', _153 => _153.onProgress, 'optionalCall', _154 => _154(i + 1, totalSheets)]);
18294
18607
  const bofIdx = findSheetBofIndex(records, meta.lbPlyPos);
18295
18608
  if (bofIdx < 0) {
18296
18609
  warnings.push({
@@ -18306,7 +18619,7 @@ async function parseXlsDocument(buffer, options) {
18306
18619
  }
18307
18620
  try {
18308
18621
  const { sheet } = extractSheetCells(records, bofIdx, globals.sst, convertNum);
18309
- const blocks = sheetToBlocks2(meta.name, sheet, i, _optionalChain([options, 'optionalAccess', _144 => _144.keepTrailingEmptyCols]));
18622
+ const blocks = sheetToBlocks2(meta.name, sheet, i, _optionalChain([options, 'optionalAccess', _155 => _155.keepTrailingEmptyCols]));
18310
18623
  allBlocks.push(...blocks);
18311
18624
  } catch (e) {
18312
18625
  warnings.push({
@@ -18320,7 +18633,7 @@ async function parseXlsDocument(buffer, options) {
18320
18633
  pageCount: totalSheets
18321
18634
  };
18322
18635
  return {
18323
- markdown: _chunkAUOEZKJEcjs.blocksToMarkdown.call(void 0, allBlocks),
18636
+ markdown: _chunkUDGPM5R5cjs.blocksToMarkdown.call(void 0, allBlocks),
18324
18637
  blocks: allBlocks,
18325
18638
  metadata,
18326
18639
  warnings: warnings.length > 0 ? warnings : void 0
@@ -18694,7 +19007,7 @@ function isDisplayMath(el) {
18694
19007
  // src/docx/parser.ts
18695
19008
  var MAX_DECOMPRESS_SIZE5 = 100 * 1024 * 1024;
18696
19009
  function matchesLocal(el, localName2) {
18697
- return el.localName === localName2 || (_nullishCoalesce(_optionalChain([el, 'access', _145 => _145.tagName, 'optionalAccess', _146 => _146.endsWith, 'call', _147 => _147(`:${localName2}`)]), () => ( false)));
19010
+ return el.localName === localName2 || (_nullishCoalesce(_optionalChain([el, 'access', _156 => _156.tagName, 'optionalAccess', _157 => _157.endsWith, 'call', _158 => _158(`:${localName2}`)]), () => ( false)));
18698
19011
  }
18699
19012
  function effectiveChildElements(parent) {
18700
19013
  const result = [];
@@ -18729,7 +19042,7 @@ function findElements(parent, localName2) {
18729
19042
  const child = children[i];
18730
19043
  if (child.nodeType === 1) {
18731
19044
  const el = child;
18732
- if (el.localName === localName2 || _optionalChain([el, 'access', _148 => _148.tagName, 'optionalAccess', _149 => _149.endsWith, 'call', _150 => _150(`:${localName2}`)])) {
19045
+ if (el.localName === localName2 || _optionalChain([el, 'access', _159 => _159.tagName, 'optionalAccess', _160 => _160.endsWith, 'call', _161 => _161(`:${localName2}`)])) {
18733
19046
  result.push(el);
18734
19047
  }
18735
19048
  walk(el);
@@ -18748,7 +19061,7 @@ function getAttr(el, localName2) {
18748
19061
  return null;
18749
19062
  }
18750
19063
  function parseXml2(text) {
18751
- return new (0, _xmldom.DOMParser)().parseFromString(_chunkJFV7QT5Tcjs.stripDtd.call(void 0, text), "text/xml");
19064
+ return new (0, _xmldom.DOMParser)().parseFromString(_chunkH2KMJOB6cjs.stripDtd.call(void 0, text), "text/xml");
18752
19065
  }
18753
19066
  function parseStyles(xml) {
18754
19067
  const doc = parseXml2(xml);
@@ -18865,7 +19178,7 @@ function collectOmmlRoots(p) {
18865
19178
  const child = children[i];
18866
19179
  if (child.nodeType !== 1) continue;
18867
19180
  const el = child;
18868
- const tag = el.localName || _optionalChain([el, 'access', _151 => _151.tagName, 'optionalAccess', _152 => _152.replace, 'call', _153 => _153(/^[^:]+:/, "")]) || "";
19181
+ const tag = el.localName || _optionalChain([el, 'access', _162 => _162.tagName, 'optionalAccess', _163 => _163.replace, 'call', _164 => _164(/^[^:]+:/, "")]) || "";
18869
19182
  if (tag === "oMath" || tag === "oMathPara") {
18870
19183
  out.push(el);
18871
19184
  } else if (tag === "txbxContent" || tag === "Fallback") {
@@ -18906,7 +19219,7 @@ function fieldUrlFromInstr(instr) {
18906
19219
  function makeLink(text, rawHref) {
18907
19220
  if (!text) return "";
18908
19221
  if (!rawHref) return text;
18909
- const href = _chunkJFV7QT5Tcjs.sanitizeHref.call(void 0, rawHref);
19222
+ const href = _chunkH2KMJOB6cjs.sanitizeHref.call(void 0, rawHref);
18910
19223
  return href ? `[${text}](${href})` : text;
18911
19224
  }
18912
19225
  function collectInline(p, footnotes, rels) {
@@ -19008,7 +19321,7 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
19008
19321
  const { text, bold: hasBold, italic: hasItalic, footnoteText } = collectInline(p, footnotes, rels);
19009
19322
  if (!text) return null;
19010
19323
  const style = styles.get(styleId);
19011
- if (_optionalChain([style, 'optionalAccess', _154 => _154.outlineLevel]) !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
19324
+ if (_optionalChain([style, 'optionalAccess', _165 => _165.outlineLevel]) !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
19012
19325
  return {
19013
19326
  type: "heading",
19014
19327
  text,
@@ -19017,8 +19330,8 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
19017
19330
  }
19018
19331
  if (numId && numId !== "0") {
19019
19332
  const numDef = numbering.get(numId);
19020
- const levelInfo = _optionalChain([numDef, 'optionalAccess', _155 => _155.get, 'call', _156 => _156(ilvl)]);
19021
- const listType = _optionalChain([levelInfo, 'optionalAccess', _157 => _157.numFmt]) === "bullet" ? "unordered" : "ordered";
19333
+ const levelInfo = _optionalChain([numDef, 'optionalAccess', _166 => _166.get, 'call', _167 => _167(ilvl)]);
19334
+ const listType = _optionalChain([levelInfo, 'optionalAccess', _168 => _168.numFmt]) === "bullet" ? "unordered" : "ordered";
19022
19335
  return { type: "list", text, listType };
19023
19336
  }
19024
19337
  const block = { type: "paragraph", text };
@@ -19100,7 +19413,7 @@ ${cell2.text}` : cell2.text;
19100
19413
  return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
19101
19414
  })
19102
19415
  );
19103
- const table2 = _chunkAUOEZKJEcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
19416
+ const table2 = _chunkUDGPM5R5cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
19104
19417
  if (table2.rows === 0 || table2.cols === 0) return null;
19105
19418
  return { type: "table", table: table2 };
19106
19419
  }
@@ -19110,10 +19423,10 @@ function collectCellText(tc2, styles, numbering, footnotes, rels, depth) {
19110
19423
  for (const el of effectiveChildElements(tc2)) {
19111
19424
  if (matchesLocal(el, "p")) {
19112
19425
  const block = parseParagraph2(el, styles, numbering, footnotes, rels);
19113
- if (_optionalChain([block, 'optionalAccess', _158 => _158.text])) parts.push(block.text);
19426
+ if (_optionalChain([block, 'optionalAccess', _169 => _169.text])) parts.push(block.text);
19114
19427
  for (const tp of collectTextboxParagraphs(el)) {
19115
19428
  const tb = parseParagraph2(tp, styles, numbering, footnotes, rels);
19116
- if (_optionalChain([tb, 'optionalAccess', _159 => _159.text])) parts.push(tb.text);
19429
+ if (_optionalChain([tb, 'optionalAccess', _170 => _170.text])) parts.push(tb.text);
19117
19430
  }
19118
19431
  } else if (matchesLocal(el, "tbl")) {
19119
19432
  for (const tr of getChildElements(el, "tr")) {
@@ -19148,7 +19461,7 @@ async function buildImageMap(zip, rels, doc, warnings) {
19148
19461
  try {
19149
19462
  const data = await imgFile.async("uint8array");
19150
19463
  imgIdx++;
19151
- const ext = _nullishCoalesce(_optionalChain([imgPath, 'access', _160 => _160.split, 'call', _161 => _161("."), 'access', _162 => _162.pop, 'call', _163 => _163(), 'optionalAccess', _164 => _164.toLowerCase, 'call', _165 => _165()]), () => ( "png"));
19464
+ const ext = _nullishCoalesce(_optionalChain([imgPath, 'access', _171 => _171.split, 'call', _172 => _172("."), 'access', _173 => _173.pop, 'call', _174 => _174(), 'optionalAccess', _175 => _175.toLowerCase, 'call', _176 => _176()]), () => ( "png"));
19152
19465
  const mimeMap = {
19153
19466
  png: "image/png",
19154
19467
  jpg: "image/jpeg",
@@ -19202,12 +19515,12 @@ function emitParagraphImages(p, imageMap, linked, out) {
19202
19515
  }
19203
19516
  }
19204
19517
  async function parseDocxDocument(buffer, options) {
19205
- _chunkJFV7QT5Tcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5);
19518
+ _chunkH2KMJOB6cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5);
19206
19519
  const zip = await _jszip2.default.loadAsync(buffer);
19207
19520
  const warnings = [];
19208
19521
  const docFile = zip.file("word/document.xml");
19209
19522
  if (!docFile) {
19210
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
19523
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
19211
19524
  }
19212
19525
  let rels = /* @__PURE__ */ new Map();
19213
19526
  const relsFile = zip.file("word/_rels/document.xml.rels");
@@ -19254,7 +19567,7 @@ async function parseDocxDocument(buffer, options) {
19254
19567
  const doc = parseXml2(docXml);
19255
19568
  const body = findElements(doc, "body");
19256
19569
  if (body.length === 0) {
19257
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
19570
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
19258
19571
  }
19259
19572
  const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings);
19260
19573
  const linkedImages = /* @__PURE__ */ new Set();
@@ -19262,7 +19575,7 @@ async function parseDocxDocument(buffer, options) {
19262
19575
  const bodyEl = body[0];
19263
19576
  const topLevel = effectiveChildElements(bodyEl);
19264
19577
  for (const el of topLevel) {
19265
- const localName2 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access', _166 => _166.tagName, 'optionalAccess', _167 => _167.split, 'call', _168 => _168(":"), 'access', _169 => _169.pop, 'call', _170 => _170()])));
19578
+ const localName2 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access', _177 => _177.tagName, 'optionalAccess', _178 => _178.split, 'call', _179 => _179(":"), 'access', _180 => _180.pop, 'call', _181 => _181()])));
19266
19579
  if (localName2 === "p") {
19267
19580
  const block = parseParagraph2(el, styles, numbering, footnotes, rels);
19268
19581
  if (block) blocks.push(block);
@@ -19273,7 +19586,7 @@ async function parseDocxDocument(buffer, options) {
19273
19586
  if (imageMap.size > 0) emitParagraphImages(tp, imageMap, linkedImages, blocks);
19274
19587
  }
19275
19588
  } else if (localName2 === "tbl") {
19276
- const block = parseTable(el, styles, numbering, footnotes, rels, _optionalChain([options, 'optionalAccess', _171 => _171.keepTrailingEmptyCols]));
19589
+ const block = parseTable(el, styles, numbering, footnotes, rels, _optionalChain([options, 'optionalAccess', _182 => _182.keepTrailingEmptyCols]));
19277
19590
  if (block) blocks.push(block);
19278
19591
  }
19279
19592
  }
@@ -19305,7 +19618,7 @@ async function parseDocxDocument(buffer, options) {
19305
19618
  }
19306
19619
  }
19307
19620
  const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
19308
- const markdown = _chunkAUOEZKJEcjs.blocksToMarkdown.call(void 0, blocks);
19621
+ const markdown = _chunkUDGPM5R5cjs.blocksToMarkdown.call(void 0, blocks);
19309
19622
  return {
19310
19623
  markdown,
19311
19624
  blocks,
@@ -19323,11 +19636,11 @@ var MAX_TABLE_COLS = 500;
19323
19636
  var MAX_HWPML_BYTES = 50 * 1024 * 1024;
19324
19637
  function parseHwpmlDocument(buffer, options) {
19325
19638
  if (buffer.byteLength > MAX_HWPML_BYTES) {
19326
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
19639
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
19327
19640
  }
19328
19641
  const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
19329
19642
  const normalized = text.replace(/&nbsp;/g, "&#160;");
19330
- const xml = _chunkJFV7QT5Tcjs.stripDtd.call(void 0, normalized);
19643
+ const xml = _chunkH2KMJOB6cjs.stripDtd.call(void 0, normalized);
19331
19644
  const warnings = [];
19332
19645
  const parser = new (0, _xmldom.DOMParser)({
19333
19646
  onError: (_level, msg2) => {
@@ -19355,7 +19668,7 @@ function parseHwpmlDocument(buffer, options) {
19355
19668
  return { markdown: "", blocks: [], metadata, warnings };
19356
19669
  }
19357
19670
  const blocks = [];
19358
- const pageFilter = _optionalChain([options, 'optionalAccess', _172 => _172.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, countSections(body)) : null;
19671
+ const pageFilter = _optionalChain([options, 'optionalAccess', _183 => _183.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, countSections(body)) : null;
19359
19672
  let sectionIdx = 0;
19360
19673
  const children = body.childNodes;
19361
19674
  for (let i = 0; i < children.length; i++) {
@@ -19364,10 +19677,10 @@ function parseHwpmlDocument(buffer, options) {
19364
19677
  if (localName(el) !== "SECTION") continue;
19365
19678
  sectionIdx++;
19366
19679
  if (pageFilter && !pageFilter.has(sectionIdx)) continue;
19367
- parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _173 => _173.keepTrailingEmptyCols]), () => ( false)));
19680
+ parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _184 => _184.keepTrailingEmptyCols]), () => ( false)));
19368
19681
  }
19369
19682
  const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
19370
- const markdown = _chunkAUOEZKJEcjs.blocksToMarkdown.call(void 0, blocks);
19683
+ const markdown = _chunkUDGPM5R5cjs.blocksToMarkdown.call(void 0, blocks);
19371
19684
  return {
19372
19685
  markdown,
19373
19686
  blocks,
@@ -19453,7 +19766,7 @@ function parseParagraph3(el, blocks, paraShapeMap, sectionNum) {
19453
19766
  const shapeInfo = paraShapeMap.get(paraShapeId);
19454
19767
  const text = extractParagraphText(el);
19455
19768
  if (!text) return;
19456
- if (_optionalChain([shapeInfo, 'optionalAccess', _174 => _174.headingLevel]) != null) {
19769
+ if (_optionalChain([shapeInfo, 'optionalAccess', _185 => _185.headingLevel]) != null) {
19457
19770
  blocks.push({ type: "heading", text, level: shapeInfo.headingLevel, pageNumber: sectionNum });
19458
19771
  } else {
19459
19772
  blocks.push({ type: "paragraph", text, pageNumber: sectionNum });
@@ -19532,11 +19845,11 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
19532
19845
  const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
19533
19846
  cellRows[r].push(cell2);
19534
19847
  }
19535
- const table2 = _chunkAUOEZKJEcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
19848
+ const table2 = _chunkUDGPM5R5cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
19536
19849
  if (structured.length > 0) {
19537
19850
  const claimed = /* @__PURE__ */ new Set();
19538
19851
  for (const { ctx, cellBlocks } of structured) {
19539
- let target = _optionalChain([table2, 'access', _175 => _175.cells, 'access', _176 => _176[_nullishCoalesce(ctx.rowAddr, () => ( -1))], 'optionalAccess', _177 => _177[_nullishCoalesce(ctx.colAddr, () => ( -1))]]);
19852
+ let target = _optionalChain([table2, 'access', _186 => _186.cells, 'access', _187 => _187[_nullishCoalesce(ctx.rowAddr, () => ( -1))], 'optionalAccess', _188 => _188[_nullishCoalesce(ctx.colAddr, () => ( -1))]]);
19540
19853
  if (!target || claimed.has(target) || target.text !== ctx.text) {
19541
19854
  target = void 0;
19542
19855
  outer: for (const irRow of table2.cells) {
@@ -19840,7 +20153,7 @@ function fillInCellPatterns(cellText, values, matchedLabels, blockedLabels) {
19840
20153
  (match, prefix, suffix) => {
19841
20154
  const label = prefix + suffix;
19842
20155
  const normalizedLabel = normalizeLabel(label);
19843
- if (_optionalChain([blockedLabels, 'optionalAccess', _178 => _178.has, 'call', _179 => _179(normalizedLabel)])) return match;
20156
+ if (_optionalChain([blockedLabels, 'optionalAccess', _189 => _189.has, 'call', _190 => _190(normalizedLabel)])) return match;
19844
20157
  const matchKey = values.available(normalizedLabel) ? normalizedLabel : values.available(normalizeLabel(prefix)) ? normalizeLabel(prefix) : void 0;
19845
20158
  if (matchKey === void 0) return match;
19846
20159
  const newValue = values.consume(matchKey);
@@ -19919,17 +20232,17 @@ function matchInlineSegment(seg, values, blockedLabels) {
19919
20232
  const nlabel = normalizeLabel(seg.label);
19920
20233
  if (seg.extLabel !== void 0) {
19921
20234
  const nExt = normalizeLabel(seg.extLabel);
19922
- if (nExt !== nlabel && !_optionalChain([blockedLabels, 'optionalAccess', _180 => _180.has, 'call', _181 => _181(nExt)]) && values.has(nExt)) {
20235
+ if (nExt !== nlabel && !_optionalChain([blockedLabels, 'optionalAccess', _191 => _191.has, 'call', _192 => _192(nExt)]) && values.has(nExt)) {
19923
20236
  return { key: nExt, label: seg.extLabel, viaExt: true };
19924
20237
  }
19925
20238
  }
19926
- if (_optionalChain([blockedLabels, 'optionalAccess', _182 => _182.has, 'call', _183 => _183(nlabel)])) return void 0;
20239
+ if (_optionalChain([blockedLabels, 'optionalAccess', _193 => _193.has, 'call', _194 => _194(nlabel)])) return void 0;
19927
20240
  const key = findMatchingKey(nlabel, values);
19928
20241
  return key !== void 0 ? { key, label: seg.label, viaExt: false } : void 0;
19929
20242
  }
19930
20243
  function clampSegmentEnd(text, seg, next, nextViaExt) {
19931
20244
  let ve = seg.valueEnd;
19932
- if (nextViaExt && _optionalChain([next, 'optionalAccess', _184 => _184.extStart]) !== void 0 && next.extStart < ve) ve = next.extStart;
20245
+ if (nextViaExt && _optionalChain([next, 'optionalAccess', _195 => _195.extStart]) !== void 0 && next.extStart < ve) ve = next.extStart;
19933
20246
  while (ve > seg.valueStart && /\s/.test(text[ve - 1])) ve--;
19934
20247
  return ve;
19935
20248
  }
@@ -19944,7 +20257,7 @@ function normalizeValues(values, warnings) {
19944
20257
  const { value, format } = typeof raw === "object" && !Array.isArray(raw) ? raw : { value: raw, format: void 0 };
19945
20258
  const key = normalizeLabel(label);
19946
20259
  if (map.has(key)) {
19947
- _optionalChain([warnings, 'optionalAccess', _185 => _185.push, 'call', _186 => _186(`\uC785\uB825 \uB77C\uBCA8 "${label}"\uC774 \uC815\uADDC\uD654 \uD0A4 "${key}"\uC5D0\uC11C \uB2E4\uB978 \uB77C\uBCA8\uACFC \uCDA9\uB3CC \u2014 \uB4A4 \uAC12\uC73C\uB85C \uB36E\uC5B4\uC500`)]);
20260
+ _optionalChain([warnings, 'optionalAccess', _196 => _196.push, 'call', _197 => _197(`\uC785\uB825 \uB77C\uBCA8 "${label}"\uC774 \uC815\uADDC\uD654 \uD0A4 "${key}"\uC5D0\uC11C \uB2E4\uB978 \uB77C\uBCA8\uACFC \uCDA9\uB3CC \u2014 \uB4A4 \uAC12\uC73C\uB85C \uB36E\uC5B4\uC500`)]);
19948
20261
  }
19949
20262
  map.set(key, Array.isArray(value) ? value.map((v) => formatFillValue(v, format)) : formatFillValue(value, format));
19950
20263
  }
@@ -19954,7 +20267,9 @@ async function fillWithUniqueGuard(values, run) {
19954
20267
  const first = await run(values);
19955
20268
  const counts = /* @__PURE__ */ new Map();
19956
20269
  for (const f of first.filled) {
19957
- if (f.key) counts.set(f.key, (_nullishCoalesce(counts.get(f.key), () => ( 0))) + 1);
20270
+ if (f.key && f.source !== "clickhere") {
20271
+ counts.set(f.key, (_nullishCoalesce(counts.get(f.key), () => ( 0))) + 1);
20272
+ }
19958
20273
  }
19959
20274
  const isArrayValue = (normKey) => {
19960
20275
  for (const [label, raw] of Object.entries(values)) {
@@ -20119,8 +20434,8 @@ function extractFromTable(table2) {
20119
20434
  if (table2.cols >= 2) {
20120
20435
  for (let r = 0; r < table2.rows; r++) {
20121
20436
  for (let c = 0; c < table2.cols - 1; c++) {
20122
- const labelCell = _optionalChain([table2, 'access', _187 => _187.cells, 'access', _188 => _188[r], 'optionalAccess', _189 => _189[c]]);
20123
- const valueCell = _optionalChain([table2, 'access', _190 => _190.cells, 'access', _191 => _191[r], 'optionalAccess', _192 => _192[c + 1]]);
20437
+ const labelCell = _optionalChain([table2, 'access', _198 => _198.cells, 'access', _199 => _199[r], 'optionalAccess', _200 => _200[c]]);
20438
+ const valueCell = _optionalChain([table2, 'access', _201 => _201.cells, 'access', _202 => _202[r], 'optionalAccess', _203 => _203[c + 1]]);
20124
20439
  if (!labelCell || !valueCell) continue;
20125
20440
  if (isLabelCell(labelCell.text)) {
20126
20441
  fields.push({
@@ -20135,15 +20450,15 @@ function extractFromTable(table2) {
20135
20450
  }
20136
20451
  if (fields.length === 0 && table2.rows >= 2 && table2.cols >= 2) {
20137
20452
  const headerRow = table2.cells[0];
20138
- const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _193 => _193.every, 'call', _194 => _194((cell2) => {
20139
- const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _195 => _195.text, 'access', _196 => _196.trim, 'call', _197 => _197()]), () => ( ""));
20453
+ const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _204 => _204.every, 'call', _205 => _205((cell2) => {
20454
+ const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _206 => _206.text, 'access', _207 => _207.trim, 'call', _208 => _208()]), () => ( ""));
20140
20455
  return t.length > 0 && t.length <= 20;
20141
20456
  })]), () => ( false));
20142
20457
  if (allLabels) {
20143
20458
  for (let r = 1; r < table2.rows; r++) {
20144
20459
  for (let c = 0; c < table2.cols; c++) {
20145
- const label = _nullishCoalesce(_optionalChain([headerRow, 'access', _198 => _198[c], 'optionalAccess', _199 => _199.text, 'access', _200 => _200.trim, 'call', _201 => _201()]), () => ( ""));
20146
- const value = _nullishCoalesce(_optionalChain([table2, 'access', _202 => _202.cells, 'access', _203 => _203[r], 'optionalAccess', _204 => _204[c], 'optionalAccess', _205 => _205.text, 'access', _206 => _206.trim, 'call', _207 => _207()]), () => ( ""));
20460
+ const label = _nullishCoalesce(_optionalChain([headerRow, 'access', _209 => _209[c], 'optionalAccess', _210 => _210.text, 'access', _211 => _211.trim, 'call', _212 => _212()]), () => ( ""));
20461
+ const value = _nullishCoalesce(_optionalChain([table2, 'access', _213 => _213.cells, 'access', _214 => _214[r], 'optionalAccess', _215 => _215[c], 'optionalAccess', _216 => _216.text, 'access', _217 => _217.trim, 'call', _218 => _218()]), () => ( ""));
20147
20462
  if (label && value) {
20148
20463
  fields.push({ label, value, row: r, col: c });
20149
20464
  }
@@ -20237,7 +20552,7 @@ function fillFormFields(blocks, values, blockedLabels) {
20237
20552
  for (const table2 of allTables) {
20238
20553
  for (let r = 0; r < table2.rows; r++) {
20239
20554
  for (let c = 0; c < table2.cols; c++) {
20240
- const cell2 = _optionalChain([table2, 'access', _208 => _208.cells, 'access', _209 => _209[r], 'optionalAccess', _210 => _210[c]]);
20555
+ const cell2 = _optionalChain([table2, 'access', _219 => _219.cells, 'access', _220 => _220[r], 'optionalAccess', _221 => _221[c]]);
20241
20556
  if (!cell2) continue;
20242
20557
  const result = fillInCellPatterns(cell2.text, cursor, matchedLabels, blockedLabels);
20243
20558
  if (result) {
@@ -20269,7 +20584,7 @@ function collectIRTables(blocks, depth) {
20269
20584
  out.push(block.table);
20270
20585
  for (const row of block.table.cells) {
20271
20586
  for (const cell2 of row) {
20272
- if (_optionalChain([cell2, 'optionalAccess', _211 => _211.blocks, 'optionalAccess', _212 => _212.length])) out.push(...collectIRTables(cell2.blocks, depth + 1));
20587
+ if (_optionalChain([cell2, 'optionalAccess', _222 => _222.blocks, 'optionalAccess', _223 => _223.length])) out.push(...collectIRTables(cell2.blocks, depth + 1));
20273
20588
  }
20274
20589
  }
20275
20590
  }
@@ -20280,7 +20595,7 @@ function coveredPositions(table2) {
20280
20595
  for (let r = 0; r < table2.rows; r++) {
20281
20596
  for (let c = 0; c < table2.cols; c++) {
20282
20597
  if (covered.has(`${r},${c}`)) continue;
20283
- const cell2 = _optionalChain([table2, 'access', _213 => _213.cells, 'access', _214 => _214[r], 'optionalAccess', _215 => _215[c]]);
20598
+ const cell2 = _optionalChain([table2, 'access', _224 => _224.cells, 'access', _225 => _225[r], 'optionalAccess', _226 => _226[c]]);
20284
20599
  if (!cell2) continue;
20285
20600
  for (let dr = 0; dr < cell2.rowSpan; dr++) {
20286
20601
  for (let dc = 0; dc < cell2.colSpan; dc++) {
@@ -20296,15 +20611,15 @@ function coveredPositions(table2) {
20296
20611
  function isHeaderDataTable(table2, covered) {
20297
20612
  if (table2.rows < 2) return false;
20298
20613
  const headerRow = table2.cells[0];
20299
- if (!_optionalChain([headerRow, 'optionalAccess', _216 => _216.length])) return false;
20614
+ if (!_optionalChain([headerRow, 'optionalAccess', _227 => _227.length])) return false;
20300
20615
  const allLabels = headerRow.every((cell2) => {
20301
- const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _217 => _217.text, 'access', _218 => _218.trim, 'call', _219 => _219()]), () => ( ""));
20616
+ const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _228 => _228.text, 'access', _229 => _229.trim, 'call', _230 => _230()]), () => ( ""));
20302
20617
  return t.length > 0 && t.length <= 20 && isLabelCell(t);
20303
20618
  });
20304
20619
  if (!allLabels) return false;
20305
20620
  for (let c = 0; c < table2.cols; c++) {
20306
20621
  if (covered.has(`1,${c}`)) continue;
20307
- const cell2 = _optionalChain([table2, 'access', _220 => _220.cells, 'access', _221 => _221[1], 'optionalAccess', _222 => _222[c]]);
20622
+ const cell2 = _optionalChain([table2, 'access', _231 => _231.cells, 'access', _232 => _232[1], 'optionalAccess', _233 => _233[c]]);
20308
20623
  if (!cell2) break;
20309
20624
  return !isLabelCell(cell2.text);
20310
20625
  }
@@ -20317,7 +20632,7 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
20317
20632
  for (let r = skipHeaderRow ? 1 : 0; r < table2.rows; r++) {
20318
20633
  for (let c = 0; c < table2.cols; c++) {
20319
20634
  if (covered.has(`${r},${c}`)) continue;
20320
- const labelCell = _optionalChain([table2, 'access', _223 => _223.cells, 'access', _224 => _224[r], 'optionalAccess', _225 => _225[c]]);
20635
+ const labelCell = _optionalChain([table2, 'access', _234 => _234.cells, 'access', _235 => _235[r], 'optionalAccess', _236 => _236[c]]);
20321
20636
  if (!labelCell) continue;
20322
20637
  if (!isLabelCell(labelCell.text)) continue;
20323
20638
  let vc = c + labelCell.colSpan;
@@ -20328,12 +20643,12 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
20328
20643
  if (isKeywordLabel(valueCell.text)) continue;
20329
20644
  const normalizedCellLabel = normalizeLabel(labelCell.text);
20330
20645
  if (!normalizedCellLabel) continue;
20331
- if (_optionalChain([blockedLabels, 'optionalAccess', _226 => _226.has, 'call', _227 => _227(normalizedCellLabel)])) continue;
20646
+ if (_optionalChain([blockedLabels, 'optionalAccess', _237 => _237.has, 'call', _238 => _238(normalizedCellLabel)])) continue;
20332
20647
  const matchKey = findMatchingKey(normalizedCellLabel, values);
20333
20648
  if (matchKey === void 0) continue;
20334
20649
  const newValue = values.consume(matchKey);
20335
20650
  if (newValue === void 0) continue;
20336
- if (_optionalChain([patternFilledCells, 'optionalAccess', _228 => _228.has, 'call', _229 => _229(valueCell)])) {
20651
+ if (_optionalChain([patternFilledCells, 'optionalAccess', _239 => _239.has, 'call', _240 => _240(valueCell)])) {
20337
20652
  valueCell.text = newValue + " " + valueCell.text;
20338
20653
  } else {
20339
20654
  valueCell.text = newValue;
@@ -20350,8 +20665,8 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
20350
20665
  }
20351
20666
  if (table2.rows >= 2 && table2.cols >= 2) {
20352
20667
  const headerRow = table2.cells[0];
20353
- const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _230 => _230.every, 'call', _231 => _231((cell2) => {
20354
- const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _232 => _232.text, 'access', _233 => _233.trim, 'call', _234 => _234()]), () => ( ""));
20668
+ const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _241 => _241.every, 'call', _242 => _242((cell2) => {
20669
+ const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _243 => _243.text, 'access', _244 => _244.trim, 'call', _245 => _245()]), () => ( ""));
20355
20670
  return t.length > 0 && t.length <= 20 && isLabelCell(t);
20356
20671
  })]), () => ( false));
20357
20672
  if (!allLabels) return;
@@ -20359,16 +20674,16 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
20359
20674
  for (let c = 0; c < table2.cols; c++) {
20360
20675
  if (covered.has(`${r},${c}`)) continue;
20361
20676
  const headerCell = headerRow[c];
20362
- const valueCell = _optionalChain([table2, 'access', _235 => _235.cells, 'access', _236 => _236[r], 'optionalAccess', _237 => _237[c]]);
20677
+ const valueCell = _optionalChain([table2, 'access', _246 => _246.cells, 'access', _247 => _247[r], 'optionalAccess', _248 => _248[c]]);
20363
20678
  if (!headerCell || !valueCell) continue;
20364
20679
  const headerLabel = normalizeLabel(headerCell.text);
20365
- if (_optionalChain([blockedLabels, 'optionalAccess', _238 => _238.has, 'call', _239 => _239(headerLabel)])) continue;
20680
+ if (_optionalChain([blockedLabels, 'optionalAccess', _249 => _249.has, 'call', _250 => _250(headerLabel)])) continue;
20366
20681
  const matchKey = findMatchingKey(headerLabel, values);
20367
20682
  if (matchKey === void 0) continue;
20368
20683
  if (!values.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
20369
20684
  const newValue = values.consume(matchKey);
20370
20685
  if (newValue === void 0) continue;
20371
- if (_optionalChain([patternFilledCells, 'optionalAccess', _240 => _240.has, 'call', _241 => _241(valueCell)])) {
20686
+ if (_optionalChain([patternFilledCells, 'optionalAccess', _251 => _251.has, 'call', _252 => _252(valueCell)])) {
20372
20687
  valueCell.text = newValue + " " + valueCell.text;
20373
20688
  } else {
20374
20689
  valueCell.text = newValue;
@@ -20400,7 +20715,7 @@ function fillInlineFields(text, values, filled, matchedLabels, blockedLabels) {
20400
20715
  if (newValue === void 0) continue;
20401
20716
  matchedLabels.add(matchKey);
20402
20717
  filled.push({ label: matched.label.trim(), value: newValue, row: -1, col: -1, key: matchKey });
20403
- const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _242 => _242[i + 1], 'optionalAccess', _243 => _243.viaExt]), () => ( false)));
20718
+ const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _253 => _253[i + 1], 'optionalAccess', _254 => _254.viaExt]), () => ( false)));
20404
20719
  out += text.slice(pos, seg.valueStart);
20405
20720
  out += seg.valueStart === ve ? padInsertion(text, seg.valueStart, newValue) : newValue;
20406
20721
  pos = ve;
@@ -20436,7 +20751,7 @@ function decodeXmlEntities(text) {
20436
20751
  try {
20437
20752
  const code = ent[1] === "x" || ent[1] === "X" ? parseInt(ent.slice(2), 16) : parseInt(ent.slice(1), 10);
20438
20753
  if (!isNaN(code) && code >= 0 && code <= 1114111) return String.fromCodePoint(code);
20439
- } catch (e30) {
20754
+ } catch (e33) {
20440
20755
  }
20441
20756
  return m;
20442
20757
  });
@@ -20937,7 +21252,7 @@ function applySplices(xml, splices) {
20937
21252
 
20938
21253
  // src/form/click-here.ts
20939
21254
  var FIELD_BEGIN_RE = /<([A-Za-z0-9_]+:)?fieldBegin\b([^>]*?)(\/?)>/g;
20940
- function attrOf(attrs, name) {
21255
+ function attrOf2(attrs, name) {
20941
21256
  const m = attrs.match(new RegExp(`(?:^|\\s)${name}="([^"]*)"`));
20942
21257
  return m ? m[1] : void 0;
20943
21258
  }
@@ -20963,10 +21278,10 @@ function scanClickHereRegions(xml) {
20963
21278
  const prefix = _nullishCoalesce(m[1], () => ( ""));
20964
21279
  const attrs = m[2];
20965
21280
  const selfClosed = m[3] === "/";
20966
- if ((_nullishCoalesce(attrOf(attrs, "type"), () => ( ""))).toUpperCase() !== "CLICK_HERE") continue;
20967
- const name = attrOf(attrs, "name");
21281
+ if ((_nullishCoalesce(attrOf2(attrs, "type"), () => ( ""))).toUpperCase() !== "CLICK_HERE") continue;
21282
+ const name = attrOf2(attrs, "name");
20968
21283
  if (name === void 0) continue;
20969
- const id = attrOf(attrs, "id");
21284
+ const id = attrOf2(attrs, "id");
20970
21285
  let beginElemEnd;
20971
21286
  if (selfClosed) {
20972
21287
  beginElemEnd = FIELD_BEGIN_RE.lastIndex;
@@ -20989,7 +21304,7 @@ function scanClickHereRegions(xml) {
20989
21304
  let end = -1;
20990
21305
  let fe;
20991
21306
  while ((fe = feRe.exec(xml)) !== null) {
20992
- const ref = attrOf(fe[0], "beginIDRef");
21307
+ const ref = attrOf2(fe[0], "beginIDRef");
20993
21308
  if (id !== void 0 && ref !== void 0 && ref !== id) continue;
20994
21309
  end = fe.index;
20995
21310
  break;
@@ -21023,14 +21338,14 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
21023
21338
  const splices = [];
21024
21339
  for (const region of scanClickHereRegions(xml)) {
21025
21340
  const key = normalizeLabel(region.name);
21026
- if (!key || _optionalChain([blockedLabels, 'optionalAccess', _244 => _244.has, 'call', _245 => _245(key)])) continue;
21341
+ if (!key || _optionalChain([blockedLabels, 'optionalAccess', _255 => _255.has, 'call', _256 => _256(key)])) continue;
21027
21342
  if (!cursor.has(key)) continue;
21028
21343
  const value = cursor.consume(key);
21029
21344
  if (value === void 0) continue;
21030
21345
  const replacement = valueXml(value, region.prefix);
21031
21346
  const current = xml.slice(region.start, region.end);
21032
21347
  matchedKeys.add(key);
21033
- filled.push({ label: region.name, value, row: -1, col: -1, key });
21348
+ filled.push({ label: region.name, value, row: -1, col: -1, key, source: "clickhere" });
21034
21349
  if (current === replacement) continue;
21035
21350
  splices.push({ start: region.start, end: region.end, replacement });
21036
21351
  }
@@ -21041,6 +21356,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
21041
21356
  };
21042
21357
  }
21043
21358
  async function extractClickHereFields(hwpxBuffer) {
21359
+ _chunkH2KMJOB6cjs.precheckZipSize.call(void 0, hwpxBuffer);
21044
21360
  const zip = await _jszip2.default.loadAsync(hwpxBuffer);
21045
21361
  const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
21046
21362
  const fields = [];
@@ -21088,19 +21404,19 @@ function parseCentralDirectory(buf) {
21088
21404
  }
21089
21405
  }
21090
21406
  }
21091
- if (eocdOffset < 0) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
21407
+ if (eocdOffset < 0) throw new (0, _chunkH2KMJOB6cjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
21092
21408
  const totalEntries = view.getUint16(eocdOffset + 10, true);
21093
21409
  const cdSize = view.getUint32(eocdOffset + 12, true);
21094
21410
  const cdOffset = view.getUint32(eocdOffset + 16, true);
21095
- if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
21411
+ if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkH2KMJOB6cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
21096
21412
  if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
21097
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
21413
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
21098
21414
  }
21099
21415
  const decoder = new TextDecoder("utf-8");
21100
21416
  const entries = [];
21101
21417
  let pos = cdOffset;
21102
21418
  for (let i = 0; i < totalEntries; i++) {
21103
- if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
21419
+ if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkH2KMJOB6cjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
21104
21420
  const flags = view.getUint16(pos + 8, true);
21105
21421
  const method = view.getUint16(pos + 10, true);
21106
21422
  const crc = view.getUint32(pos + 16, true);
@@ -21111,7 +21427,7 @@ function parseCentralDirectory(buf) {
21111
21427
  const commentLen = view.getUint16(pos + 32, true);
21112
21428
  const localOffset = view.getUint32(pos + 42, true);
21113
21429
  if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
21114
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
21430
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
21115
21431
  }
21116
21432
  const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
21117
21433
  const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
@@ -21140,11 +21456,11 @@ function patchZipEntries(original, replacements, additions) {
21140
21456
  const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
21141
21457
  const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
21142
21458
  for (const name of replacements.keys()) {
21143
- if (!entries.some((e) => e.name === name)) throw new (0, _chunkJFV7QT5Tcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
21459
+ if (!entries.some((e) => e.name === name)) throw new (0, _chunkH2KMJOB6cjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
21144
21460
  }
21145
21461
  if (additions) {
21146
21462
  for (const name of additions.keys()) {
21147
- if (entries.some((e) => e.name === name)) throw new (0, _chunkJFV7QT5Tcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
21463
+ if (entries.some((e) => e.name === name)) throw new (0, _chunkH2KMJOB6cjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
21148
21464
  }
21149
21465
  }
21150
21466
  const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
@@ -21163,7 +21479,7 @@ function patchZipEntries(original, replacements, additions) {
21163
21479
  offset += seg.length;
21164
21480
  continue;
21165
21481
  }
21166
- if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
21482
+ if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkH2KMJOB6cjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
21167
21483
  const nameLen = view.getUint16(e.localOffset + 26, true);
21168
21484
  const extraLen = view.getUint16(e.localOffset + 28, true);
21169
21485
  const headerLen = 30 + nameLen + extraLen;
@@ -21171,7 +21487,7 @@ function patchZipEntries(original, replacements, additions) {
21171
21487
  const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
21172
21488
  const method = e.method;
21173
21489
  if (method !== 0 && method !== 8) {
21174
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 ZIP \uC555\uCD95 \uBC29\uC2DD(method=${method}): ${e.name} \u2014 STORE(0)/DEFLATE(8)\uB9CC \uAD50\uCCB4 \uAC00\uB2A5`);
21490
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 ZIP \uC555\uCD95 \uBC29\uC2DD(method=${method}): ${e.name} \u2014 STORE(0)/DEFLATE(8)\uB9CC \uAD50\uCCB4 \uAC00\uB2A5`);
21175
21491
  }
21176
21492
  const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
21177
21493
  const crc = crc32(newData);
@@ -21269,10 +21585,11 @@ function patchZipEntries(original, replacements, additions) {
21269
21585
  // src/form/filler-hwpx.ts
21270
21586
  async function fillHwpx(hwpxBuffer, values, blockedLabels) {
21271
21587
  const u8 = new Uint8Array(hwpxBuffer);
21588
+ _chunkH2KMJOB6cjs.precheckZipSize.call(void 0, hwpxBuffer);
21272
21589
  const zip = await _jszip2.default.loadAsync(hwpxBuffer);
21273
21590
  const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
21274
21591
  if (sectionPaths.length === 0) {
21275
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
21592
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
21276
21593
  }
21277
21594
  const warnings = [];
21278
21595
  const normalizedValues = normalizeValues(values, warnings);
@@ -21371,7 +21688,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
21371
21688
  if (isKeywordLabel(cellLabelText(valueCell))) continue;
21372
21689
  const normalizedCellLabel = normalizeLabel(labelText);
21373
21690
  if (!normalizedCellLabel) continue;
21374
- if (_optionalChain([blockedLabels, 'optionalAccess', _246 => _246.has, 'call', _247 => _247(normalizedCellLabel)])) continue;
21691
+ if (_optionalChain([blockedLabels, 'optionalAccess', _257 => _257.has, 'call', _258 => _258(normalizedCellLabel)])) continue;
21375
21692
  const matchKey = findMatchingKey(normalizedCellLabel, cursor);
21376
21693
  if (matchKey === void 0) continue;
21377
21694
  if (patternApplied.has(valueCell)) {
@@ -21429,7 +21746,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
21429
21746
  const dataCells = table2.rows[rowIdx];
21430
21747
  for (let colIdx = 0; colIdx < Math.min(headerCells.length, dataCells.length); colIdx++) {
21431
21748
  const headerLabel = normalizeLabel(cellLabelText(headerCells[colIdx]));
21432
- if (_optionalChain([blockedLabels, 'optionalAccess', _248 => _248.has, 'call', _249 => _249(headerLabel)])) continue;
21749
+ if (_optionalChain([blockedLabels, 'optionalAccess', _259 => _259.has, 'call', _260 => _260(headerLabel)])) continue;
21433
21750
  const matchKey = findMatchingKey(headerLabel, cursor);
21434
21751
  if (matchKey === void 0) continue;
21435
21752
  if (!cursor.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
@@ -21483,7 +21800,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
21483
21800
  }
21484
21801
  for (const para2 of [...scan.bodyParagraphs, ...scan.excludedParagraphs]) {
21485
21802
  const existing = ledger.get(para2);
21486
- if (_optionalChain([existing, 'optionalAccess', _250 => _250.fullText]) !== void 0) continue;
21803
+ if (_optionalChain([existing, 'optionalAccess', _261 => _261.fullText]) !== void 0) continue;
21487
21804
  const text = matchText(para2);
21488
21805
  const segments = scanInlineSegments(text);
21489
21806
  const matches = segments.map((seg) => matchInlineSegment(seg, cursor, blockedLabels));
@@ -21494,7 +21811,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
21494
21811
  const matchKey = matched.key;
21495
21812
  const newValue = cursor.consume(matchKey);
21496
21813
  if (newValue === void 0) continue;
21497
- const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _251 => _251[i + 1], 'optionalAccess', _252 => _252.viaExt]), () => ( false)));
21814
+ const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _262 => _262[i + 1], 'optionalAccess', _263 => _263.viaExt]), () => ( false)));
21498
21815
  const replacement = seg.valueStart === ve ? padInsertion(text, seg.valueStart, newValue) : newValue;
21499
21816
  const l = led(para2);
21500
21817
  l.ranges.push({ start: seg.valueStart, end: ve, replacement });
@@ -21735,9 +22052,9 @@ function fixedPitchWidthEm1000(cp) {
21735
22052
  return cp < 128 ? 500 : 1e3;
21736
22053
  }
21737
22054
  function measureTextWidth(text, height, ratioPct, opts) {
21738
- const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _253 => _253.spaceEm]), () => ( SPACE_EM_FIXED));
21739
- const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _254 => _254.spacingPct]), () => ( 0));
21740
- const widthEm = _optionalChain([opts, 'optionalAccess', _255 => _255.faceClass]) === "fixedPitch" ? fixedPitchWidthEm1000 : charWidthEm1000;
22055
+ const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _264 => _264.spaceEm]), () => ( SPACE_EM_FIXED));
22056
+ const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _265 => _265.spacingPct]), () => ( 0));
22057
+ const widthEm = _optionalChain([opts, 'optionalAccess', _266 => _266.faceClass]) === "fixedPitch" ? fixedPitchWidthEm1000 : charWidthEm1000;
21741
22058
  let em = 0;
21742
22059
  for (const ch of text) {
21743
22060
  const cp = ch.codePointAt(0);
@@ -21750,9 +22067,9 @@ var FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;?]}\xA2\xB0\u2032\u2033\u
21750
22067
  var FORBID_END = /* @__PURE__ */ new Set([..."$([{\xA3\xA5\u3008\u300A\u300C\u300E\u3010\u3014$([{\u20A9"]);
21751
22068
  function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "keep", opts) {
21752
22069
  const EPS = 0.5;
21753
- const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _256 => _256.spaceEm]), () => ( SPACE_EM_FIXED));
21754
- const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _257 => _257.spacingPct]), () => ( 0));
21755
- const widthEm = _optionalChain([opts, 'optionalAccess', _258 => _258.faceClass]) === "fixedPitch" ? fixedPitchWidthEm1000 : charWidthEm1000;
22070
+ const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _267 => _267.spaceEm]), () => ( SPACE_EM_FIXED));
22071
+ const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _268 => _268.spacingPct]), () => ( 0));
22072
+ const widthEm = _optionalChain([opts, 'optionalAccess', _269 => _269.faceClass]) === "fixedPitch" ? fixedPitchWidthEm1000 : charWidthEm1000;
21756
22073
  const k = height * ratioPct / 100 / 1e3;
21757
22074
  const cwCp = (cp) => (cp === 32 ? spaceEm : widthEm(cp)) * (1 + spacing / 100) * k;
21758
22075
  const charW2 = (ch) => cwCp(ch.codePointAt(0));
@@ -22014,7 +22331,7 @@ function needsGaejosikAssets(gongmun) {
22014
22331
  }
22015
22332
  function assertFiniteRange(name, value, min, max) {
22016
22333
  if (!Number.isFinite(value) || value < min || value > max) {
22017
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
22334
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
22018
22335
  }
22019
22336
  }
22020
22337
  function validateGongmunOptions(opts) {
@@ -22029,10 +22346,10 @@ function validateGongmunOptions(opts) {
22029
22346
  assertFiniteRange(`margins.${side}`, value, 0, 200);
22030
22347
  }
22031
22348
  if (opts.margins.left + opts.margins.right >= 210) {
22032
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("margins.left + margins.right must be less than 210");
22349
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("margins.left + margins.right must be less than 210");
22033
22350
  }
22034
22351
  if (opts.margins.top + opts.margins.bottom >= 297) {
22035
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("margins.top + margins.bottom must be less than 297");
22352
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("margins.top + margins.bottom must be less than 297");
22036
22353
  }
22037
22354
  }
22038
22355
  if (opts.sizes) {
@@ -22041,7 +22358,7 @@ function validateGongmunOptions(opts) {
22041
22358
  }
22042
22359
  }
22043
22360
  if (opts.approval && opts.approval.length > 6) {
22044
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("approval must contain at most 6 labels");
22361
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("approval must contain at most 6 labels");
22045
22362
  }
22046
22363
  }
22047
22364
  function incompatibleGongmunWarnings(opts) {
@@ -22105,7 +22422,7 @@ function resolveGongmun(opts) {
22105
22422
  suppressSingle: _nullishCoalesce(opts.suppressSingle, () => ( false)),
22106
22423
  docHead: preset === "official" && opts.docHead ? opts.docHead : null,
22107
22424
  docFoot: preset === "official" && opts.docFoot ? opts.docFoot : null,
22108
- reportInfo: _optionalChain([opts, 'access', _259 => _259.reportInfo, 'optionalAccess', _260 => _260.trim, 'call', _261 => _261()]) || null,
22425
+ reportInfo: _optionalChain([opts, 'access', _270 => _270.reportInfo, 'optionalAccess', _271 => _271.trim, 'call', _272 => _272()]) || null,
22109
22426
  noticeHead: preset === "notice" && opts.noticeHead ? opts.noticeHead : null,
22110
22427
  // 보도자료 머리박스는 프리셋 자체가 요구 — 옵션 미지정이어도 빈 객체
22111
22428
  press: preset === "press" ? _nullishCoalesce(opts.press, () => ( {})) : null
@@ -22214,16 +22531,16 @@ var PARA_LIST = 7;
22214
22531
  var DEFAULT_TEXT_COLOR = "#000000";
22215
22532
  function resolveTheme(theme) {
22216
22533
  return {
22217
- h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _262 => _262.headingColors, 'optionalAccess', _263 => _263[1]]), () => ( DEFAULT_TEXT_COLOR)),
22218
- h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _264 => _264.headingColors, 'optionalAccess', _265 => _265[2]]), () => ( DEFAULT_TEXT_COLOR)),
22219
- h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _266 => _266.headingColors, 'optionalAccess', _267 => _267[3]]), () => ( DEFAULT_TEXT_COLOR)),
22220
- h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _268 => _268.headingColors, 'optionalAccess', _269 => _269[4]]), () => ( _optionalChain([theme, 'optionalAccess', _270 => _270.headingColors, 'optionalAccess', _271 => _271[3]]))), () => ( DEFAULT_TEXT_COLOR)),
22221
- body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _272 => _272.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
22222
- quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _273 => _273.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
22534
+ h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _273 => _273.headingColors, 'optionalAccess', _274 => _274[1]]), () => ( DEFAULT_TEXT_COLOR)),
22535
+ h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _275 => _275.headingColors, 'optionalAccess', _276 => _276[2]]), () => ( DEFAULT_TEXT_COLOR)),
22536
+ h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _277 => _277.headingColors, 'optionalAccess', _278 => _278[3]]), () => ( DEFAULT_TEXT_COLOR)),
22537
+ h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _279 => _279.headingColors, 'optionalAccess', _280 => _280[4]]), () => ( _optionalChain([theme, 'optionalAccess', _281 => _281.headingColors, 'optionalAccess', _282 => _282[3]]))), () => ( DEFAULT_TEXT_COLOR)),
22538
+ body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _283 => _283.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
22539
+ quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _284 => _284.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
22223
22540
  /** quoteColor가 명시되었는지 — blockquote charPr 분기에 사용 (baseline 호환) */
22224
- hasQuoteOption: _optionalChain([theme, 'optionalAccess', _274 => _274.quoteColor]) !== void 0,
22225
- tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _275 => _275.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _276 => _276.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
22226
- tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _277 => _277.tableHeaderBold])
22541
+ hasQuoteOption: _optionalChain([theme, 'optionalAccess', _285 => _285.quoteColor]) !== void 0,
22542
+ tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _286 => _286.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _287 => _287.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
22543
+ tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _288 => _288.tableHeaderBold])
22227
22544
  };
22228
22545
  }
22229
22546
  function escapeXml(text) {
@@ -22638,7 +22955,7 @@ function assertSequentialIds(rows, label, startId) {
22638
22955
  const m = rows[i].match(/\bid="(\d+)"/);
22639
22956
  const got = m ? Number(m[1]) : NaN;
22640
22957
  if (got !== startId + i) {
22641
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)(
22958
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(
22642
22959
  `\uB0B4\uBD80 \uC624\uB958: ${label} id \uD30C\uD2F0\uC158 \uB4DC\uB9AC\uD504\uD2B8 \u2014 ${startId + i} \uC704\uCE58\uC5D0 id=${m ? m[1] : "?"} \uBC29\uCD9C. id \uC0C1\uC218(gen-ids)\uC640 \uC2E4\uC81C \uBC29\uCD9C \uC218\uAC00 \uC5B4\uAE0B\uB0AC\uB2E4 (GJ_CHAR_COUNT\uB958 \uCE74\uC6B4\uD2B8\xB7base \uC0B0\uC220 \uD655\uC778)`
22643
22960
  );
22644
22961
  }
@@ -22722,7 +23039,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
22722
23039
  }
22723
23040
  const expectedBase = charVariantBase(richAssets, !!gongmun);
22724
23041
  if (rows.length !== expectedBase) {
22725
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)(
23042
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(
22726
23043
  `\uB0B4\uBD80 \uC624\uB958: charPr \uAE30\uBCF8 \uBE14\uB85D \uBC29\uCD9C \uC218(${rows.length}) \u2260 charVariantBase(${expectedBase}) \u2014 gen-header \uBC29\uCD9C \uD589\uACFC gen-ids \uCE74\uC6B4\uD2B8 \uC0C1\uC218\uAC00 \uC5B4\uAE0B\uB0AC\uB2E4`
22727
23044
  );
22728
23045
  }
@@ -22950,7 +23267,7 @@ function buildStyles(gongmun) {
22950
23267
  </hh:styles>`;
22951
23268
  }
22952
23269
  function generateHeaderXml(theme, gongmun, ratioVariants = [], extraBorderFills = [], extraCharPrXmls = [], listIndentVariants = [], extraFonts = []) {
22953
- const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess', _278 => _278.fonts, 'access', _279 => _279.body]), () => ( (_optionalChain([gongmun, 'optionalAccess', _280 => _280.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5")));
23270
+ const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess', _289 => _289.fonts, 'access', _290 => _290.body]), () => ( (_optionalChain([gongmun, 'optionalAccess', _291 => _291.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5")));
22954
23271
  const charPropsXml = buildCharProperties(theme, gongmun, ratioVariants, extraCharPrXmls);
22955
23272
  const paraPropsXml = buildParaProperties(gongmun, gongmun ? listIndentVariants : []);
22956
23273
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
@@ -23079,8 +23396,8 @@ function parseChartFence(text) {
23079
23396
  const spec = chartSpec(type);
23080
23397
  let finalSeries = spec.pie ? [series[0]] : series;
23081
23398
  finalSeries = finalSeries.map((s) => ({ ...s }));
23082
- const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess', _281 => _281.length]), () => ( 0)), ...finalSeries.map((s) => s.values.length));
23083
- const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess', _282 => _282[i]]), () => ( `\uD56D\uBAA9 ${i + 1}`)));
23399
+ const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess', _292 => _292.length]), () => ( 0)), ...finalSeries.map((s) => s.values.length));
23400
+ const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess', _293 => _293[i]]), () => ( `\uD56D\uBAA9 ${i + 1}`)));
23084
23401
  if (!spec.scatter) {
23085
23402
  finalSeries = finalSeries.map((s) => ({ ...s, values: catFinal.map((_, i) => _nullishCoalesce(s.values[i], () => ( 0))) }));
23086
23403
  }
@@ -23122,7 +23439,7 @@ function serSpPr(color, stroke) {
23122
23439
  return stroke ? `<c:spPr><a:ln w="28575" cap="flat" cmpd="sng" algn="ctr">${f}<a:prstDash val="solid"/><a:round/></a:ln></c:spPr>` : `<c:spPr>${f}</c:spPr>`;
23123
23440
  }
23124
23441
  function dPtXml(pointColors, pie) {
23125
- if (!_optionalChain([pointColors, 'optionalAccess', _283 => _283.length])) return "";
23442
+ if (!_optionalChain([pointColors, 'optionalAccess', _294 => _294.length])) return "";
23126
23443
  return pointColors.map((col, i) => {
23127
23444
  const f = chartColorFill(col);
23128
23445
  if (!f) return "";
@@ -23361,8 +23678,8 @@ function buildGaejosikCover(title, gongmun, bodyWidth = GAEJOSIK_BASE_WIDTH) {
23361
23678
  const botRow = cell({ bf: GJ_BF_BAR_DARK, col: 0, row: 2, w: g.botDarkW, h: g.botBarH, paras: barEmpty }) + cell({ bf: GJ_BF_BAR_LIGHT, col: 1, colSpan: 2, row: 2, w: g.botLightW, h: g.botBarH, paras: barEmpty });
23362
23679
  const tbl2 = table([topRow, titleRow, botRow], g.totalW, g.barH + g.titleH + g.botBarH, 3, 1, bodyWidth);
23363
23680
  const host = `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${tbl2}</hp:run></hp:p>`;
23364
- const date = _nullishCoalesce(_optionalChain([gongmun, 'access', _284 => _284.cover, 'optionalAccess', _285 => _285.date]), () => ( formatGaejosikDate(/* @__PURE__ */ new Date())));
23365
- const org = _nullishCoalesce(_optionalChain([gongmun, 'access', _286 => _286.cover, 'optionalAccess', _287 => _287.org]), () => ( ""));
23681
+ const date = _nullishCoalesce(_optionalChain([gongmun, 'access', _295 => _295.cover, 'optionalAccess', _296 => _296.date]), () => ( formatGaejosikDate(/* @__PURE__ */ new Date())));
23682
+ const org = _nullishCoalesce(_optionalChain([gongmun, 'access', _297 => _297.cover, 'optionalAccess', _298 => _298.org]), () => ( ""));
23366
23683
  const sub = (t) => `<hp:p paraPrIDRef="${GJ_PARA_COVER}" styleIDRef="0"><hp:run charPrIDRef="${GJ_CHAR_COVER_SUB}"><hp:t>${escapeXml(t)}</hp:t></hp:run></hp:p>`;
23367
23684
  const subEmpty = emptyPara(GJ_PARA_COVER, false, GJ_CHAR_COVER_SUB);
23368
23685
  return [
@@ -23618,7 +23935,7 @@ function escapeGfm(text) {
23618
23935
  }
23619
23936
  var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
23620
23937
  function sanitizeText(text) {
23621
- let result = _chunkAUOEZKJEcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
23938
+ let result = _chunkUDGPM5R5cjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
23622
23939
  if (result.length <= 30 && result.includes(" ")) {
23623
23940
  const tokens = result.split(" ");
23624
23941
  const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-힯ㄱ-ㆎ]/.test(t)).length;
@@ -23648,7 +23965,7 @@ function replicateGfmTable(table2) {
23648
23965
  for (let r = 0; r < numRows; r++) {
23649
23966
  for (let c = 0; c < numCols; c++) {
23650
23967
  if (skip.has(`${r},${c}`)) continue;
23651
- const cell2 = _optionalChain([cells, 'access', _288 => _288[r], 'optionalAccess', _289 => _289[c]]);
23968
+ const cell2 = _optionalChain([cells, 'access', _299 => _299[r], 'optionalAccess', _300 => _300[c]]);
23652
23969
  if (!cell2) continue;
23653
23970
  display[r][c] = {
23654
23971
  text: escapeGfm(sanitizeText(cell2.text)).replace(/\|/g, "\\|").replace(/\n/g, "<br>"),
@@ -23702,7 +24019,7 @@ function unescapeGfmCell(text) {
23702
24019
  return text.replace(/<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(/\\([~*_`])/g, "$1");
23703
24020
  }
23704
24021
  function replicateCellInnerHtml(cell2) {
23705
- if (_optionalChain([cell2, 'access', _290 => _290.blocks, 'optionalAccess', _291 => _291.length])) {
24022
+ if (_optionalChain([cell2, 'access', _301 => _301.blocks, 'optionalAccess', _302 => _302.length])) {
23706
24023
  return cell2.blocks.map((b) => {
23707
24024
  if (b.type === "table" && b.table) {
23708
24025
  const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
@@ -23741,7 +24058,7 @@ function replicateHtmlTable(table2) {
23741
24058
  const rowCells = [];
23742
24059
  for (let c = 0; c < numCols; c++) {
23743
24060
  if (skip.has(`${r},${c}`)) continue;
23744
- const cell2 = _optionalChain([cells, 'access', _292 => _292[r], 'optionalAccess', _293 => _293[c]]);
24061
+ const cell2 = _optionalChain([cells, 'access', _303 => _303[r], 'optionalAccess', _304 => _304[c]]);
23745
24062
  if (!cell2) continue;
23746
24063
  for (let dr = 0; dr < cell2.rowSpan; dr++) {
23747
24064
  for (let dc = 0; dc < cell2.colSpan; dc++) {
@@ -23787,10 +24104,10 @@ function parseHtmlTable(raw) {
23787
24104
  }
23788
24105
  } else {
23789
24106
  if (!isClose) {
23790
- const cs = parseInt(_optionalChain([attrs, 'access', _294 => _294.match, 'call', _295 => _295(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _296 => _296[1]]) || "1", 10);
23791
- const rs = parseInt(_optionalChain([attrs, 'access', _297 => _297.match, 'call', _298 => _298(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _299 => _299[1]]) || "1", 10);
24107
+ const cs = parseInt(_optionalChain([attrs, 'access', _305 => _305.match, 'call', _306 => _306(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _307 => _307[1]]) || "1", 10);
24108
+ const rs = parseInt(_optionalChain([attrs, 'access', _308 => _308.match, 'call', _309 => _309(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _310 => _310[1]]) || "1", 10);
23792
24109
  cellStart = m.index + m[0].length;
23793
- cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkAUOEZKJEcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkAUOEZKJEcjs.MAX_ROWS) };
24110
+ cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkUDGPM5R5cjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkUDGPM5R5cjs.MAX_ROWS) };
23794
24111
  } else if (cellStart >= 0 && cellInfo && currentRow) {
23795
24112
  currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
23796
24113
  cellStart = -1;
@@ -23814,7 +24131,7 @@ function htmlCellInnerToLines(inner) {
23814
24131
  hadNonText = true;
23815
24132
  work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
23816
24133
  const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
23817
- const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _300 => _300[1]]), () => ( _optionalChain([m, 'optionalAccess', _301 => _301[2]])));
24134
+ const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _311 => _311[1]]), () => ( _optionalChain([m, 'optionalAccess', _312 => _312[2]])));
23818
24135
  if (src) imgSrcs.push(src);
23819
24136
  return "";
23820
24137
  });
@@ -23957,7 +24274,7 @@ function edgeXml(tag, d) {
23957
24274
  return d ? `<hh:${tag} type="${escapeXml(d.type)}" width="${escapeXml(d.width)}" color="${escapeXml(d.color)}"/>` : `<hh:${tag} type="NONE" width="0.1 mm" color="#000000"/>`;
23958
24275
  }
23959
24276
  function borderFillDefToXml(id, def) {
23960
- const fill = _optionalChain([def, 'access', _302 => _302.fill, 'optionalAccess', _303 => _303.faceColor]) ? `<hh:fillBrush><hh:winBrush faceColor="${escapeXml(def.fill.faceColor)}" hatchColor="#000000" alpha="0"/></hh:fillBrush>` : "";
24277
+ const fill = _optionalChain([def, 'access', _313 => _313.fill, 'optionalAccess', _314 => _314.faceColor]) ? `<hh:fillBrush><hh:winBrush faceColor="${escapeXml(def.fill.faceColor)}" hatchColor="#000000" alpha="0"/></hh:fillBrush>` : "";
23961
24278
  return ` <hh:borderFill id="${id}" threeD="0" shadow="0" centerLine="NONE" breakCellSeparateLine="0">
23962
24279
  <hh:slash type="NONE" Crooked="0" isCounter="0"/>
23963
24280
  <hh:backSlash type="NONE" Crooked="0" isCounter="0"/>
@@ -24362,11 +24679,11 @@ function estimateRowHeight(cells, widths, charHeight) {
24362
24679
  function generateTable(rows, theme, style = null, remap = null, seq = 0, images = null) {
24363
24680
  const rowCnt = rows.length;
24364
24681
  const colCnt = Math.max(...rows.map((r) => r.length), 1);
24365
- const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _304 => _304.bfRegistry]), () => ( null));
24682
+ const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _315 => _315.bfRegistry]), () => ( null));
24366
24683
  const totalW = style ? reg ? style.totalWidth - DATA_TABLE_INSET : style.totalWidth : 44e3;
24367
- const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _305 => _305.charHeight]), () => ( 1e3));
24684
+ const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _316 => _316.charHeight]), () => ( 1e3));
24368
24685
  const rowAnchor = normalizeRowAnchor((_nullishCoalesce(rows[0], () => ( []))).map((c) => c.replace(/!\[[^\]]*\]\([^)]*\)/g, "")));
24369
- const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access', _306 => _306[0], 'optionalAccess', _307 => _307[0]]), () => ( ""))), seq, rowAnchor);
24686
+ const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access', _317 => _317[0], 'optionalAccess', _318 => _318[0]]), () => ( ""))), seq, rowAnchor);
24370
24687
  const colMax = Array(colCnt).fill(0);
24371
24688
  const colMaxBody = Array(colCnt).fill(0);
24372
24689
  const colMinWord = Array(colCnt).fill(0);
@@ -24394,7 +24711,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
24394
24711
  const k = `${rowIdx},${colIdx}`;
24395
24712
  const isLabelCell2 = labelCol0 && colIdx === 0;
24396
24713
  const defaultCharPr = style ? reg && (isHeaderRow || isLabelCell2) ? style.boldCharPr : style.charPr : isHeaderRow ? headerCharPr : baseCharPr;
24397
- const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _308 => _308.cellChar, 'access', _309 => _309.get, 'call', _310 => _310(k)]), () => ( defaultCharPr));
24714
+ const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _319 => _319.cellChar, 'access', _320 => _320.get, 'call', _321 => _321(k)]), () => ( defaultCharPr));
24398
24715
  const centered = isHeaderRow || colCentered[colIdx];
24399
24716
  const paraPrId = style ? centered ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
24400
24717
  const p = cell2.split(/<br\s*\/?>/i).map((seg) => {
@@ -24412,11 +24729,11 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
24412
24729
  }
24413
24730
  }
24414
24731
  }
24415
- const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess', _311 => _311.cellChar, 'access', _312 => _312.has, 'call', _313 => _313(k)]) ? void 0 : mapId);
24732
+ const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess', _322 => _322.cellChar, 'access', _323 => _323.has, 'call', _324 => _324(k)]) ? void 0 : mapId);
24416
24733
  const body = (runs || (picRuns ? "" : `<hp:run charPrIDRef="${cellCharPr}"><hp:t></hp:t></hp:run>`)) + picRuns;
24417
24734
  return `<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0">${body}</hp:p>`;
24418
24735
  }).join("");
24419
- const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _314 => _314.cellBf, 'access', _315 => _315.get, 'call', _316 => _316(k)]), () => ( (reg ? reg.get(dataCellSpec({
24736
+ const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _325 => _325.cellBf, 'access', _326 => _326.get, 'call', _327 => _327(k)]), () => ( (reg ? reg.get(dataCellSpec({
24420
24737
  row: rowIdx,
24421
24738
  rowEnd: rowIdx,
24422
24739
  col: colIdx,
@@ -24426,7 +24743,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
24426
24743
  headerRows: 1,
24427
24744
  fill: isHeaderRow ? _nullishCoalesce(style.headerFill, () => ( "#E6E6E6")) : isLabelCell2 ? _nullishCoalesce(style.labelFill, () => ( "#E7E7E7")) : void 0
24428
24745
  })) : style && isHeaderRow ? style.headerBf : 2)));
24429
- const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _317 => _317.cellH, 'access', _318 => _318.get, 'call', _319 => _319(k)]), () => ( cellH));
24746
+ const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _328 => _328.cellH, 'access', _329 => _329.get, 'call', _330 => _330(k)]), () => ( cellH));
24430
24747
  return `<hp:tc name="" header="${isHeaderRow ? 1 : 0}" hasMargin="0" protect="0" editable="1" dirty="0" borderFillIDRef="${bf}"><hp:subList id="" textDirection="HORIZONTAL" lineWrap="BREAK" vertAlign="${style ? "CENTER" : "TOP"}" linkListIDRef="0" linkListNextIDRef="0" textWidth="0" textHeight="0" hasTextRef="0" hasNumRef="0">${p}</hp:subList><hp:cellAddr colAddr="${colIdx}" rowAddr="${rowIdx}"/><hp:cellSpan colSpan="1" rowSpan="1"/><hp:cellSz width="${colWidths[colIdx]}" height="${h}"/><hp:cellMargin left="141" right="141" top="141" bottom="141"/></hp:tc>`;
24431
24748
  }).join("");
24432
24749
  return `<hp:tr>${tdElements}</hp:tr>`;
@@ -24435,7 +24752,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
24435
24752
  const tblH = rowHeights.reduce((a, b) => a + b, 0);
24436
24753
  const tblInner = `<hp:sz width="${tblW}" widthRelTo="ABSOLUTE" height="${tblH}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="1" affectLSpacing="0" flowWithText="0" allowOverlap="0" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="PARA" vertAlign="TOP" horzAlign="LEFT" vertOffset="0" horzOffset="0"/><hp:outMargin left="0" right="0" top="0" bottom="0"/><hp:inMargin left="510" right="510" top="141" bottom="141"/>` + trElements;
24437
24754
  const tbl2 = `<hp:tbl id="${tblId}" zOrder="0" numberingType="TABLE" pageBreak="CELL" repeatHeader="${style ? 1 : 0}" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="2" noShading="0">${tblInner}</hp:tbl>`;
24438
- const hostPr = reg && _optionalChain([style, 'optionalAccess', _320 => _320.rightParaPr]) !== void 0 ? style.rightParaPr : 0;
24755
+ const hostPr = reg && _optionalChain([style, 'optionalAccess', _331 => _331.rightParaPr]) !== void 0 ? style.rightParaPr : 0;
24439
24756
  return `<hp:p paraPrIDRef="${hostPr}" styleIDRef="0"><hp:run charPrIDRef="0">${tbl2}</hp:run></hp:p>`;
24440
24757
  }
24441
24758
  function layoutHtmlRows(rows) {
@@ -24446,8 +24763,8 @@ function layoutHtmlRows(rows) {
24446
24763
  let c = 0;
24447
24764
  for (const cell2 of rows[r].cells) {
24448
24765
  while (occupied.has(`${r},${c}`)) c++;
24449
- const colSpan = clampSpan(cell2.colSpan, _chunkAUOEZKJEcjs.MAX_COLS);
24450
- const rowSpan = clampSpan(cell2.rowSpan, _chunkAUOEZKJEcjs.MAX_ROWS);
24766
+ const colSpan = clampSpan(cell2.colSpan, _chunkUDGPM5R5cjs.MAX_COLS);
24767
+ const rowSpan = clampSpan(cell2.rowSpan, _chunkUDGPM5R5cjs.MAX_ROWS);
24451
24768
  placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
24452
24769
  for (let dr = 0; dr < rowSpan; dr++) {
24453
24770
  for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
@@ -24475,7 +24792,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
24475
24792
  if (!rows || rows.length === 0) return null;
24476
24793
  const { placed, rowCnt, colCnt } = layoutHtmlRows(rows);
24477
24794
  if (rowCnt === 0 || colCnt === 0) return null;
24478
- const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _321 => _321.charHeight]), () => ( 1e3));
24795
+ const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _332 => _332.charHeight]), () => ( 1e3));
24479
24796
  const first = _nullishCoalesce(placed.find((p) => p.r === 0 && p.c === 0), () => ( placed[0]));
24480
24797
  const row0 = Array.from({ length: colCnt }, () => "");
24481
24798
  for (const cell2 of placed) {
@@ -24504,7 +24821,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
24504
24821
  const tblId = nextTableId();
24505
24822
  const useHeaderStyle = !style && (theme.tableHeader !== theme.body || theme.tableHeaderBold);
24506
24823
  const spanW = (cell2) => colWidths.slice(cell2.c, cell2.c + cell2.colSpan).reduce((a, b) => a + b, 0);
24507
- const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _322 => _322.bfRegistry]), () => ( null));
24824
+ const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _333 => _333.bfRegistry]), () => ( null));
24508
24825
  let htmlHeaderRows = 0;
24509
24826
  while (htmlHeaderRows < rows.length && rows[htmlHeaderRows].tag === "th") htmlHeaderRows++;
24510
24827
  const tableRowHeights = Array(rowCnt).fill(cellH);
@@ -24518,7 +24835,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
24518
24835
  const nestedW = Math.max(Math.min(Math.max(sw - 1020, 4e3), sw - 282), 500);
24519
24836
  const nestedXml = generateHtmlTableXml(nested, theme, nestedW, style ? { ...style, totalWidth: nestedW } : null);
24520
24837
  if (nestedXml) {
24521
- const szH = _optionalChain([nestedXml, 'access', _323 => _323.match, 'call', _324 => _324(/<hp:sz [^>]*height="(\d+)"/), 'optionalAccess', _325 => _325[1]]);
24838
+ const szH = _optionalChain([nestedXml, 'access', _334 => _334.match, 'call', _335 => _335(/<hp:sz [^>]*height="(\d+)"/), 'optionalAccess', _336 => _336[1]]);
24522
24839
  nestedH += (szH ? Number(szH) : (_nullishCoalesce(nested.match(/<tr[\s>]/gi), () => ( []))).length * cellH) + 300;
24523
24840
  }
24524
24841
  return nestedXml;
@@ -24529,7 +24846,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
24529
24846
  for (const line of lines) wrapLines += Math.max(1, Math.ceil(measureTextWidth(unescapeHtml(line).trim(), measureH, 100) / usable));
24530
24847
  const lineH = style ? Math.round(measureH * 1.6) : 800;
24531
24848
  const contentH = Math.max(cellH * rowSpan, Math.max(wrapLines, 1) * lineH + nestedH);
24532
- const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _326 => _326.cellH, 'access', _327 => _327.get, 'call', _328 => _328(`${cell2.r},${cell2.c}`)]), () => ( 0)), contentH);
24849
+ const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _337 => _337.cellH, 'access', _338 => _338.get, 'call', _339 => _339(`${cell2.r},${cell2.c}`)]), () => ( 0)), contentH);
24533
24850
  const perRow = Math.ceil(cellHeight / rowSpan);
24534
24851
  for (let r = cell2.r; r < cell2.r + rowSpan; r++) tableRowHeights[r] = Math.max(tableRowHeights[r], perRow);
24535
24852
  return { cell: cell2, rowSpan, lines, nestedXmls, segLines, imgSrcs: cellParsed[i].imgSrcs };
@@ -24540,7 +24857,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
24540
24857
  const baseCharPr = style ? style.charPr : CHAR_NORMAL;
24541
24858
  const headerCharPr = isHeader && useHeaderStyle ? CHAR_TABLE_HEADER : baseCharPr;
24542
24859
  const defaultCharPr = style && reg && isHeader ? style.boldCharPr : isHeader ? headerCharPr : baseCharPr;
24543
- const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _329 => _329.cellChar, 'access', _330 => _330.get, 'call', _331 => _331(k)]), () => ( defaultCharPr));
24860
+ const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _340 => _340.cellChar, 'access', _341 => _341.get, 'call', _342 => _342(k)]), () => ( defaultCharPr));
24544
24861
  const centered = isHeader || colCentered[cell2.c];
24545
24862
  const paraPrId = style ? centered ? reg ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : style.centerParaPr : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
24546
24863
  const picUrls = images ? [...imgSrcs] : [];
@@ -24580,7 +24897,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
24580
24897
  let cellHeight = 0;
24581
24898
  for (let r = cell2.r; r < cell2.r + rowSpan; r++) cellHeight += tableRowHeights[r];
24582
24899
  const rowEnd = cell2.r + rowSpan - 1;
24583
- const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _332 => _332.cellBf, 'access', _333 => _333.get, 'call', _334 => _334(k)]), () => ( (reg ? reg.get(dataCellSpec({
24900
+ const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _343 => _343.cellBf, 'access', _344 => _344.get, 'call', _345 => _345(k)]), () => ( (reg ? reg.get(dataCellSpec({
24584
24901
  row: cell2.r,
24585
24902
  rowEnd,
24586
24903
  col: cell2.c,
@@ -24750,7 +25067,7 @@ function buildPressHead(g, ids, bodyWidth, reg) {
24750
25067
  return [`<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`, blank()];
24751
25068
  }
24752
25069
  function buildPressContact(g, ids, bodyWidth, reg) {
24753
- const c = _optionalChain([g, 'access', _335 => _335.press, 'optionalAccess', _336 => _336.contact]);
25070
+ const c = _optionalChain([g, 'access', _346 => _346.press, 'optionalAccess', _347 => _347.contact]);
24754
25071
  if (!c || !c.dept && !c.manager && !c.phone) return [];
24755
25072
  const w = bodyWidth - 280;
24756
25073
  const cells = [["\uB2F4\uB2F9 \uBD80\uC11C", _nullishCoalesce(c.dept, () => ( ""))], ["\uB2F4\uB2F9\uC790", _nullishCoalesce(c.manager, () => ( ""))], ["\uC5F0\uB77D\uCC98", _nullishCoalesce(c.phone, () => ( ""))]];
@@ -25131,7 +25448,7 @@ function generateSecPr(gongmun) {
25131
25448
  }
25132
25449
  const secPr = `<hp:secPr textDirection="HORIZONTAL" spaceColumns="1134" tabStop="8000" outlineShapeIDRef="1" memoShapeIDRef="0" textVerticalWidthHead="0" masterPageCnt="0"><hp:grid lineGrid="0" charGrid="0" wonggojiFormat="0"/><hp:startNum pageStartsOn="BOTH" page="0" pic="0" tbl="0" equation="0"/><hp:visibility hideFirstHeader="0" hideFirstFooter="0" hideFirstMasterPage="0" border="SHOW_ALL" fill="SHOW_ALL" hideFirstPageNum="0" hideFirstEmptyLine="0" showLineNumber="0"/><hp:pagePr landscape="WIDELY" width="${A4_W_HU}" height="${A4_H_HU}" gutterType="LEFT_ONLY"><hp:margin header="${m.header}" footer="${m.footer}" gutter="0" left="${m.left}" right="${m.right}" top="${m.top}" bottom="${m.bottom}"/></hp:pagePr><hp:footNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="-1" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="283" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="EACH_COLUMN" beneathText="0"/></hp:footNotePr><hp:endNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="14692344" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="0" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="END_OF_DOCUMENT" beneathText="0"/></hp:endNotePr></hp:secPr>`;
25133
25450
  const colPr = `<hp:ctrl><hp:colPr id="" type="NEWSPAPER" layout="LEFT" colCount="1" sameSz="1" sameGap="0"/></hp:ctrl>`;
25134
- return secPr + colPr + (_optionalChain([gongmun, 'optionalAccess', _337 => _337.pageNumbers]) ? pageNumCtrl() : "");
25451
+ return secPr + colPr + (_optionalChain([gongmun, 'optionalAccess', _348 => _348.pageNumbers]) ? pageNumCtrl() : "");
25135
25452
  }
25136
25453
  var SectionOpener = (_class6 = class {
25137
25454
  constructor(gongmun) {;_class6.prototype.__init12.call(this);
@@ -25170,19 +25487,19 @@ function buildPreamble(blocks, ctx) {
25170
25487
  const { gongmun, dfIds, bfReg, tableStyle, richAssets, gjBodyW } = ctx;
25171
25488
  const preamble = [];
25172
25489
  let hasFrontPages = false;
25173
- if (_optionalChain([gongmun, 'optionalAccess', _338 => _338.reportInfo]) && dfIds) {
25490
+ if (_optionalChain([gongmun, 'optionalAccess', _349 => _349.reportInfo]) && dfIds) {
25174
25491
  preamble.push(buildReportInfo(gongmun, dfIds));
25175
25492
  }
25176
- if (_optionalChain([gongmun, 'optionalAccess', _339 => _339.approval]) && bfReg) {
25493
+ if (_optionalChain([gongmun, 'optionalAccess', _350 => _350.approval]) && bfReg) {
25177
25494
  preamble.push(buildApprovalTable(gongmun.approval, bfReg, richAssets ? GJ_CHAR_APPROVAL : GONGMUN_APPROVAL_CHAR));
25178
25495
  }
25179
- if (_optionalChain([gongmun, 'optionalAccess', _340 => _340.docHead]) && dfIds) {
25496
+ if (_optionalChain([gongmun, 'optionalAccess', _351 => _351.docHead]) && dfIds) {
25180
25497
  preamble.push(...buildDocHead(gongmun, dfIds));
25181
25498
  }
25182
- if (_optionalChain([gongmun, 'optionalAccess', _341 => _341.noticeHead]) && dfIds) {
25499
+ if (_optionalChain([gongmun, 'optionalAccess', _352 => _352.noticeHead]) && dfIds) {
25183
25500
  preamble.push(...buildNoticeHead(gongmun));
25184
25501
  }
25185
- if (_optionalChain([gongmun, 'optionalAccess', _342 => _342.press]) && dfIds && bfReg && tableStyle) {
25502
+ if (_optionalChain([gongmun, 'optionalAccess', _353 => _353.press]) && dfIds && bfReg && tableStyle) {
25186
25503
  preamble.push(...buildPressHead(gongmun, dfIds, tableStyle.totalWidth, bfReg));
25187
25504
  }
25188
25505
  if (gongmun && (gongmun.cover || gongmun.toc)) {
@@ -25211,7 +25528,7 @@ function buildPreamble(blocks, ctx) {
25211
25528
  }
25212
25529
  if (gongmun && !ctx.gaejosik && ctx.coverH1Idx < 0 && bfReg && (gongmun.preset === "report" || gongmun.preset === "plan" || gongmun.preset === "notice")) {
25213
25530
  ctx.titleBoxH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
25214
- } else if (_optionalChain([gongmun, 'optionalAccess', _343 => _343.press]) && ctx.coverH1Idx < 0 && dfIds) {
25531
+ } else if (_optionalChain([gongmun, 'optionalAccess', _354 => _354.press]) && ctx.coverH1Idx < 0 && dfIds) {
25215
25532
  ctx.pressH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
25216
25533
  }
25217
25534
  if (preamble.length > 0) {
@@ -25226,7 +25543,7 @@ function renderHeading(block, blockIdx, ctx) {
25226
25543
  if (gongmun && blockIdx === ctx.coverH1Idx) return "";
25227
25544
  if (gongmun && blockIdx === ctx.pressH1Idx && dfIds) {
25228
25545
  const parts = [generateParagraph((block.text || "").trim(), GONGMUN_CENTER, dfIds.pressTitle)];
25229
- for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access', _344 => _344.press, 'optionalAccess', _345 => _345.sub]), () => ( []))) {
25546
+ for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access', _355 => _355.press, 'optionalAccess', _356 => _356.sub]), () => ( []))) {
25230
25547
  parts.push(generateParagraph(`- ${s} -`, GONGMUN_CENTER, dfIds.pressSub));
25231
25548
  }
25232
25549
  return parts.join("\n ");
@@ -25320,8 +25637,8 @@ function renderListItem(block, blockIdx, ctx) {
25320
25637
  const { gongmun, gongmunList, measured, fit, vBase, dfIds } = ctx;
25321
25638
  if (gongmun && gongmunList) {
25322
25639
  const info = gongmunList.items.get(blockIdx);
25323
- const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _346 => _346.depth]), () => ( 0));
25324
- const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _347 => _347.marker]), () => ( ""));
25640
+ const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _357 => _357.depth]), () => ( 0));
25641
+ const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _358 => _358.marker]), () => ( ""));
25325
25642
  const content = block.text || "";
25326
25643
  if (measured && content.trimStart().startsWith("\u203B")) {
25327
25644
  return generateParagraph(content.trim(), GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
@@ -25330,7 +25647,7 @@ function renderListItem(block, blockIdx, ctx) {
25330
25647
  return generateParagraph(`* ${content.trim()}`, GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
25331
25648
  }
25332
25649
  const text = marker2 ? `${marker2} ${content}` : content;
25333
- const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess', _348 => _348.indentVariant]) !== void 0 ? GONGMUN_LIST_VARIANT_BASE + info.indentVariant : GONGMUN_LIST_BASE + depth : GONGMUN_LIST_PLAIN_BASE + depth;
25650
+ const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess', _359 => _359.indentVariant]) !== void 0 ? GONGMUN_LIST_VARIANT_BASE + info.indentVariant : GONGMUN_LIST_BASE + depth : GONGMUN_LIST_PLAIN_BASE + depth;
25334
25651
  let listCharPr = gongmun.numbering === "report" && depth === 0 ? CHAR_BOLD : CHAR_NORMAL;
25335
25652
  let mapId = fit ? variantMapper(fit, blockIdx, vBase) : void 0;
25336
25653
  if (measured && depth === 0 && gongmun.numbering !== "standard") {
@@ -25389,18 +25706,18 @@ function renderHtmlTable(block, ctx) {
25389
25706
  }
25390
25707
  function appendPostamble(blocks, ctx) {
25391
25708
  const { gongmun, dfIds, bfReg, tableStyle, paraXmls } = ctx;
25392
- if (_optionalChain([gongmun, 'optionalAccess', _349 => _349.noticeHead]) && dfIds) {
25709
+ if (_optionalChain([gongmun, 'optionalAccess', _360 => _360.noticeHead]) && dfIds) {
25393
25710
  paraXmls.push(...buildNoticeFoot(gongmun));
25394
25711
  }
25395
- if (_optionalChain([gongmun, 'optionalAccess', _350 => _350.endMark]) && paraXmls.length > 0) {
25396
- const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access', _351 => _351.rows, 'optionalAccess', _352 => _352.length]));
25712
+ if (_optionalChain([gongmun, 'optionalAccess', _361 => _361.endMark]) && paraXmls.length > 0) {
25713
+ const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access', _362 => _362.rows, 'optionalAccess', _363 => _363.length]));
25397
25714
  const lastText = lastBlock && (lastBlock.type === "paragraph" || lastBlock.type === "list_item") ? lastBlock.text || "" : "";
25398
25715
  if (!hasEndMark(lastText)) paraXmls.push(buildEndMark());
25399
25716
  }
25400
- if (_optionalChain([gongmun, 'optionalAccess', _353 => _353.docFoot]) && dfIds) {
25717
+ if (_optionalChain([gongmun, 'optionalAccess', _364 => _364.docFoot]) && dfIds) {
25401
25718
  paraXmls.push(...buildDocFoot(gongmun, dfIds));
25402
25719
  }
25403
- if (_optionalChain([gongmun, 'optionalAccess', _354 => _354.press]) && dfIds && bfReg && tableStyle) {
25720
+ if (_optionalChain([gongmun, 'optionalAccess', _365 => _365.press]) && dfIds && bfReg && tableStyle) {
25404
25721
  paraXmls.push(...buildPressContact(gongmun, dfIds, tableStyle.totalWidth, bfReg));
25405
25722
  }
25406
25723
  }
@@ -25420,7 +25737,7 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
25420
25737
  remap,
25421
25738
  dfIds,
25422
25739
  images,
25423
- gaejosik: _optionalChain([gongmun, 'optionalAccess', _355 => _355.preset]) === "gaejosik",
25740
+ gaejosik: _optionalChain([gongmun, 'optionalAccess', _366 => _366.preset]) === "gaejosik",
25424
25741
  measured,
25425
25742
  richAssets,
25426
25743
  vBase: charVariantBase(richAssets, !!gongmun),
@@ -25526,18 +25843,18 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
25526
25843
 
25527
25844
  // src/hwpx/generator.ts
25528
25845
  async function markdownToHwpx(markdown, options) {
25529
- const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _356 => _356.theme]));
25530
- const gongmun = _optionalChain([options, 'optionalAccess', _357 => _357.gongmun]) ? resolveGongmun(options.gongmun) : null;
25846
+ const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _367 => _367.theme]));
25847
+ const gongmun = _optionalChain([options, 'optionalAccess', _368 => _368.gongmun]) ? resolveGongmun(options.gongmun) : null;
25531
25848
  const measured = !!gongmun && usesReportFonts(gongmun.preset);
25532
25849
  const richAssets = !!gongmun && needsGaejosikAssets(gongmun);
25533
25850
  const blocks = parseMarkdownToBlocks(markdown);
25534
25851
  const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
25535
25852
  const fit = gongmun && gongmunList ? computeGongmunFitPlan(blocks, gongmun, gongmunList) : null;
25536
25853
  const staticBfEnd = staticBorderFillNext(gongmun);
25537
- const remap = _optionalChain([options, 'optionalAccess', _358 => _358.profile]) ? buildProfileRemap(options.profile, charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _359 => _359.variants, 'optionalAccess', _360 => _360.length]), () => ( 0))) * 4, staticBfEnd, staticFontNext(gongmun)) : null;
25538
- const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _361 => _361.borderFillXmls, 'access', _362 => _362.length]), () => ( 0)))) : null;
25854
+ const remap = _optionalChain([options, 'optionalAccess', _369 => _369.profile]) ? buildProfileRemap(options.profile, charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _370 => _370.variants, 'optionalAccess', _371 => _371.length]), () => ( 0))) * 4, staticBfEnd, staticFontNext(gongmun)) : null;
25855
+ const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _372 => _372.borderFillXmls, 'access', _373 => _373.length]), () => ( 0)))) : null;
25539
25856
  const dfActive = !!gongmun && docframeActive(gongmun);
25540
- const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _363 => _363.variants, 'optionalAccess', _364 => _364.length]), () => ( 0))) * 4 + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _365 => _365.charPrXmls, 'access', _366 => _366.length]), () => ( 0)));
25857
+ const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _374 => _374.variants, 'optionalAccess', _375 => _375.length]), () => ( 0))) * 4 + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _376 => _376.charPrXmls, 'access', _377 => _377.length]), () => ( 0)));
25541
25858
  const dfIds = dfActive ? docframeIds(dfBase) : null;
25542
25859
  const chartParts = [];
25543
25860
  const images = new ImageRegistry();
@@ -25548,7 +25865,7 @@ async function markdownToHwpx(markdown, options) {
25548
25865
  console.warn(`[kordoc] format profile: \uD504\uB85C\uD544 \uD45C ${unused}\uAC1C\uAC00 \uBB38\uC11C \uD45C\uC640 \uB9E4\uCE6D\uB418\uC9C0 \uC54A\uC544 \uBBF8\uC801\uC6A9 (\uD589\xB7\uC5F4/\uCCAB \uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)`);
25549
25866
  }
25550
25867
  }
25551
- const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _367 => _367.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _368 => _368.emit, 'call', _369 => _369()]), () => ( []))];
25868
+ const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _378 => _378.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _379 => _379.emit, 'call', _380 => _380()]), () => ( []))];
25552
25869
  const zip = new (0, _jszip2.default)();
25553
25870
  zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
25554
25871
  zip.file("META-INF/container.xml", generateContainerXml());
@@ -25557,11 +25874,11 @@ async function markdownToHwpx(markdown, options) {
25557
25874
  zip.file("Contents/header.xml", generateHeaderXml(
25558
25875
  theme,
25559
25876
  gongmun,
25560
- _nullishCoalesce(_optionalChain([fit, 'optionalAccess', _370 => _370.variants]), () => ( [])),
25877
+ _nullishCoalesce(_optionalChain([fit, 'optionalAccess', _381 => _381.variants]), () => ( [])),
25561
25878
  extraBorderFills,
25562
- [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _371 => _371.charPrXmls]), () => ( [])), ...dfActive ? docframeCharPrXmls(dfBase, richAssets) : []],
25563
- _nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess', _372 => _372.indentVariants]), () => ( [])),
25564
- _nullishCoalesce(_optionalChain([remap, 'optionalAccess', _373 => _373.fontFaces]), () => ( []))
25879
+ [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _382 => _382.charPrXmls]), () => ( [])), ...dfActive ? docframeCharPrXmls(dfBase, richAssets) : []],
25880
+ _nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess', _383 => _383.indentVariants]), () => ( [])),
25881
+ _nullishCoalesce(_optionalChain([remap, 'optionalAccess', _384 => _384.fontFaces]), () => ( []))
25565
25882
  ));
25566
25883
  zip.file("Contents/section0.xml", sectionXml);
25567
25884
  for (const part of chartParts) zip.file(part.name, part.xml);
@@ -25612,7 +25929,7 @@ function alignBlocks(a, b) {
25612
25929
  const m = a.length, n = b.length;
25613
25930
  if (m * n > 1e7) return fallbackAlign(a, b);
25614
25931
  const lenOf = (blk) => {
25615
- const t = blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _374 => _374.text]), () => ( ""))).join(" ") : "";
25932
+ const t = blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _385 => _385.text]), () => ( ""))).join(" ") : "";
25616
25933
  return t.replace(/\s+/g, " ").trim().length;
25617
25934
  };
25618
25935
  const aLen = a.map(lenOf);
@@ -25685,8 +26002,8 @@ function blockSimilarity(a, b) {
25685
26002
  }
25686
26003
  function tableSimilarity(a, b) {
25687
26004
  const dimSim = 1 - Math.abs(a.rows * a.cols - b.rows * b.cols) / Math.max(a.rows * a.cols, b.rows * b.cols, 1);
25688
- const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _375 => _375.text]), () => ( ""))).join(" ");
25689
- const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _376 => _376.text]), () => ( ""))).join(" ");
26005
+ const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _386 => _386.text]), () => ( ""))).join(" ");
26006
+ const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _387 => _387.text]), () => ( ""))).join(" ");
25690
26007
  const contentSim = normalizedSimilarity(textsA, textsB);
25691
26008
  return dimSim * 0.3 + contentSim * 0.7;
25692
26009
  }
@@ -25697,8 +26014,8 @@ function diffTableCells(a, b) {
25697
26014
  for (let r = 0; r < maxRows; r++) {
25698
26015
  const row = [];
25699
26016
  for (let c = 0; c < maxCols; c++) {
25700
- const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access', _377 => _377.cells, 'access', _378 => _378[r], 'optionalAccess', _379 => _379[c], 'optionalAccess', _380 => _380.text]) : void 0;
25701
- const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access', _381 => _381.cells, 'access', _382 => _382[r], 'optionalAccess', _383 => _383[c], 'optionalAccess', _384 => _384.text]) : void 0;
26017
+ const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access', _388 => _388.cells, 'access', _389 => _389[r], 'optionalAccess', _390 => _390[c], 'optionalAccess', _391 => _391.text]) : void 0;
26018
+ const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access', _392 => _392.cells, 'access', _393 => _393[r], 'optionalAccess', _394 => _394[c], 'optionalAccess', _395 => _395.text]) : void 0;
25702
26019
  let type;
25703
26020
  if (cellA === void 0) type = "added";
25704
26021
  else if (cellB === void 0) type = "removed";
@@ -25748,7 +26065,7 @@ function builtinTemplateDir() {
25748
26065
  for (const c of candidates) {
25749
26066
  if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
25750
26067
  }
25751
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("\uB0B4\uC7A5 templates \uB514\uB809\uD1A0\uB9AC\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4 (\uD328\uD0A4\uC9C0 \uC124\uCE58\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4)");
26068
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uB0B4\uC7A5 templates \uB514\uB809\uD1A0\uB9AC\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4 (\uD328\uD0A4\uC9C0 \uC124\uCE58\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4)");
25752
26069
  }
25753
26070
  function readBuiltinTemplate(t) {
25754
26071
  const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
@@ -25911,7 +26228,7 @@ function parseRenderStyles(headXml) {
25911
26228
  const underlineEl = findChildByLocalName(el, "underline");
25912
26229
  const textColor = el.getAttribute("textColor");
25913
26230
  const fontRef = findChildByLocalName(el, "fontRef");
25914
- const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _385 => _385.getAttribute, 'call', _386 => _386("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _387 => _387.getAttribute, 'call', _388 => _388("latin")])));
26231
+ const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _396 => _396.getAttribute, 'call', _397 => _397("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _398 => _398.getAttribute, 'call', _399 => _399("latin")])));
25915
26232
  const face = fontId != null ? hangulFonts.get(fontId) : void 0;
25916
26233
  styles.charPr.set(id, {
25917
26234
  height: Number(el.getAttribute("height")) || 1e3,
@@ -25919,8 +26236,8 @@ function parseRenderStyles(headXml) {
25919
26236
  italic: findChildByLocalName(el, "italic") != null,
25920
26237
  underline: underlineEl != null && (_nullishCoalesce(underlineEl.getAttribute("type"), () => ( "NONE"))) !== "NONE",
25921
26238
  color: textColor && textColor !== "#000000" && textColor.toLowerCase() !== "none" ? textColor : void 0,
25922
- ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _389 => _389.getAttribute, 'call', _390 => _390("hangul")])) || 100,
25923
- spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _391 => _391.getAttribute, 'call', _392 => _392("hangul")])) || 0,
26239
+ ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _400 => _400.getAttribute, 'call', _401 => _401("hangul")])) || 100,
26240
+ spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _402 => _402.getAttribute, 'call', _403 => _403("hangul")])) || 0,
25924
26241
  fontFamily: face ? hwpFaceToCssStack(face) : void 0,
25925
26242
  face
25926
26243
  });
@@ -25929,7 +26246,7 @@ function parseRenderStyles(headXml) {
25929
26246
  const id = el.getAttribute("id");
25930
26247
  if (id != null) {
25931
26248
  const align = findChildByLocalName(el, "align");
25932
- styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _393 => _393.getAttribute, 'call', _394 => _394("horizontal")]) || "JUSTIFY");
26249
+ styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _404 => _404.getAttribute, 'call', _405 => _405("horizontal")]) || "JUSTIFY");
25933
26250
  styles.paraGeom.set(id, parseParaGeom(el));
25934
26251
  }
25935
26252
  } else if (tag === "borderFill") {
@@ -25943,7 +26260,7 @@ function parseRenderStyles(headXml) {
25943
26260
  };
25944
26261
  const fillBrush = findChildByLocalName(el, "fillBrush");
25945
26262
  const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
25946
- const face = _optionalChain([winBrush, 'optionalAccess', _395 => _395.getAttribute, 'call', _396 => _396("faceColor")]);
26263
+ const face = _optionalChain([winBrush, 'optionalAccess', _406 => _406.getAttribute, 'call', _407 => _407("faceColor")]);
25947
26264
  if (face && face.toLowerCase() !== "none") bf.fill = face;
25948
26265
  styles.borderFill.set(id, bf);
25949
26266
  }
@@ -26013,9 +26330,9 @@ function collectSites(scan) {
26013
26330
  sites.sort((a, b) => a.para.start - b.para.start);
26014
26331
  return sites;
26015
26332
  }
26016
- function attrOf2(openTag, name) {
26333
+ function attrOf3(openTag, name) {
26017
26334
  const m = openTag.match(new RegExp(`\\b${name}="([^"]*)"`));
26018
- return _optionalChain([m, 'optionalAccess', _397 => _397[1]]);
26335
+ return _optionalChain([m, 'optionalAccess', _408 => _408[1]]);
26019
26336
  }
26020
26337
  function paraOpenTag(xml, para2) {
26021
26338
  const end = xml.indexOf(">", para2.start);
@@ -26030,8 +26347,8 @@ function anchorRunInfo(xml, para2, anchor) {
26030
26347
  if (!tr) return null;
26031
26348
  const before = xml.slice(Math.max(0, para2.start), tr.contentStart);
26032
26349
  const runOpen = [...before.matchAll(/<([A-Za-z0-9]+):run\b[^>]*>/g)].pop();
26033
- const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _398 => _398[1]]), () => ( tr.prefix)), () => ( "hp"));
26034
- const charPr2 = runOpen && attrOf2(runOpen[0], "charPrIDRef") || "0";
26350
+ const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _409 => _409[1]]), () => ( tr.prefix)), () => ( "hp"));
26351
+ const charPr2 = runOpen && attrOf3(runOpen[0], "charPrIDRef") || "0";
26035
26352
  const close = xml.indexOf(`</${prefix}:run>`, tr.contentEnd);
26036
26353
  if (close === -1) return null;
26037
26354
  return { charPr: charPr2, prefix, insertAt: close + `</${prefix}:run>`.length };
@@ -26057,9 +26374,9 @@ function cellContentWidthMm(xml, cell2) {
26057
26374
  if (width === null) return null;
26058
26375
  let content = width;
26059
26376
  const win = cellAddrWindow(xml, cell2);
26060
- const mg = _optionalChain([win, 'optionalAccess', _399 => _399.match, 'call', _400 => _400(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
26377
+ const mg = _optionalChain([win, 'optionalAccess', _410 => _410.match, 'call', _411 => _411(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
26061
26378
  if (mg) {
26062
- content -= Number(_nullishCoalesce(attrOf2(mg[0], "left"), () => ( 0))) + Number(_nullishCoalesce(attrOf2(mg[0], "right"), () => ( 0)));
26379
+ content -= Number(_nullishCoalesce(attrOf3(mg[0], "left"), () => ( 0))) + Number(_nullishCoalesce(attrOf3(mg[0], "right"), () => ( 0)));
26063
26380
  }
26064
26381
  return content > 0 ? content / HU_PER_MM2 : null;
26065
26382
  }
@@ -26091,11 +26408,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
26091
26408
  return `<hp:pic xmlns:hc="http://www.hancom.co.kr/hwpml/2011/core" id="${ids.id}" zOrder="0" numberingType="PICTURE" textWrap="IN_FRONT_OF_TEXT" textFlow="BOTH_SIDES" lock="0" dropcapstyle="None" href="" groupLevel="0" instid="${ids.instid}" reverse="0"><hp:offset x="0" y="0"/><hp:orgSz width="${w}" height="${h}"/><hp:curSz width="${w}" height="${h}"/><hp:flip horizontal="0" vertical="0"/><hp:rotationInfo angle="0" centerX="${Math.round(w / 2)}" centerY="${Math.round(h / 2)}" rotateimage="1"/><hp:renderingInfo><hc:transMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/><hc:scaMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/><hc:rotMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/></hp:renderingInfo><hp:imgRect><hc:pt0 x="0" y="0"/><hc:pt1 x="${w}" y="0"/><hc:pt2 x="${w}" y="${h}"/><hc:pt3 x="0" y="${h}"/></hp:imgRect><hp:imgClip left="0" right="${w}" top="0" bottom="${h}"/><hp:inMargin left="0" right="0" top="0" bottom="0"/><hp:imgDim dimwidth="${w}" dimheight="${h}"/><hc:img binaryItemIDRef="${itemId}" bright="0" contrast="0" effect="REAL_PIC" alpha="0"/><hp:effects/><hp:sz width="${w}" widthRelTo="ABSOLUTE" height="${h}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="0" affectLSpacing="0" flowWithText="0" allowOverlap="1" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="COLUMN" vertAlign="TOP" horzAlign="LEFT" vertOffset="${posYHu}" horzOffset="${posXHu}"/><hp:outMargin left="0" right="0" top="0" bottom="0"/><hp:shapeComment>kordoc seal</hp:shapeComment></hp:pic>`;
26092
26409
  }
26093
26410
  async function placeSealHwpx(hwpxBuffer, ops) {
26094
- if (ops.length === 0) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
26411
+ if (ops.length === 0) throw new (0, _chunkH2KMJOB6cjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
26095
26412
  const u8 = new Uint8Array(hwpxBuffer);
26413
+ _chunkH2KMJOB6cjs.precheckZipSize.call(void 0, hwpxBuffer);
26096
26414
  const zip = await _jszip2.default.loadAsync(hwpxBuffer);
26097
- const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _401 => _401.match, 'call', _402 => _402(/(\d+)\.xml$/i), 'optionalAccess', _403 => _403[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _404 => _404.match, 'call', _405 => _405(/(\d+)\.xml$/i), 'optionalAccess', _406 => _406[1]]), () => ( 0))));
26098
- if (sectionPaths.length === 0) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
26415
+ const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _412 => _412.match, 'call', _413 => _413(/(\d+)\.xml$/i), 'optionalAccess', _414 => _414[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _415 => _415.match, 'call', _416 => _416(/(\d+)\.xml$/i), 'optionalAccess', _417 => _417[1]]), () => ( 0))));
26416
+ if (sectionPaths.length === 0) throw new (0, _chunkH2KMJOB6cjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
26099
26417
  const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
26100
26418
  const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
26101
26419
  const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
@@ -26136,11 +26454,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
26136
26454
  const manifestItems = [];
26137
26455
  const placed = [];
26138
26456
  for (const op of ops) {
26139
- if (!op.anchor) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
26140
- if (!op.image || op.image.length === 0) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
26457
+ if (!op.anchor) throw new (0, _chunkH2KMJOB6cjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
26458
+ if (!op.image || op.image.length === 0) throw new (0, _chunkH2KMJOB6cjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
26141
26459
  const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
26142
- if (!MIME[ext]) throw new (0, _chunkJFV7QT5Tcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
26143
- if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkJFV7QT5Tcjs.KordocError)(`place_seal: \uC774\uBBF8\uC9C0 \uB0B4\uC6A9\uC774 .${ext} \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 (\uB9E4\uC9C1\uBC14\uC774\uD2B8 \uBD88\uC77C\uCE58)`);
26460
+ if (!MIME[ext]) throw new (0, _chunkH2KMJOB6cjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
26461
+ if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkH2KMJOB6cjs.KordocError)(`place_seal: \uC774\uBBF8\uC9C0 \uB0B4\uC6A9\uC774 .${ext} \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 (\uB9E4\uC9C1\uBC14\uC774\uD2B8 \uBD88\uC77C\uCE58)`);
26144
26462
  const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
26145
26463
  let found = null;
26146
26464
  let total = 0;
@@ -26173,7 +26491,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
26173
26491
  }
26174
26492
  }
26175
26493
  }
26176
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)(
26494
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(
26177
26495
  `place_seal: \uC575\uCEE4 "${op.anchor}" ${wantOcc}\uBC88\uC9F8 \uB4F1\uC7A5\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4 (\uBCF8\uBB38 \uB0B4 ${total}\uD68C \uB4F1\uC7A5 \u2014 occurrence 0..${Math.max(0, total - 1)})`
26178
26496
  );
26179
26497
  }
@@ -26181,9 +26499,9 @@ async function placeSealHwpx(hwpxBuffer, ops) {
26181
26499
  const xml = sectionXmls[si];
26182
26500
  const run = anchorRunInfo(xml, site.para, op.anchor);
26183
26501
  if (!run) {
26184
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
26502
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
26185
26503
  }
26186
- const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _407 => _407.charPr, 'access', _408 => _408.get, 'call', _409 => _409(run.charPr), 'optionalAccess', _410 => _410.height]), () => ( 1e3));
26504
+ const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _418 => _418.charPr, 'access', _419 => _419.get, 'call', _420 => _420(run.charPr), 'optionalAccess', _421 => _421.height]), () => ( 1e3));
26187
26505
  const fontPt = charPrHeight / 100;
26188
26506
  const emMm = fontPt * 25.4 / 72;
26189
26507
  const lineHMm = emMm;
@@ -26191,8 +26509,8 @@ async function placeSealHwpx(hwpxBuffer, ops) {
26191
26509
  const anchorWMm = measureMm(op.anchor, emMm);
26192
26510
  const sizeMm = op.sizeMm != null && Number.isFinite(op.sizeMm) && op.sizeMm > 0 ? op.sizeMm : Math.max(7, Math.min(18, lineHMm * 1.6));
26193
26511
  const availMm = _nullishCoalesce((site.cell ? cellContentWidthMm(xml, site.cell) : null), () => ( bodyColumnWidthMm(xml)));
26194
- const paraPrId = _nullishCoalesce(attrOf2(paraOpenTag(xml, site.para), "paraPrIDRef"), () => ( "0"));
26195
- const align = _optionalChain([styles, 'optionalAccess', _411 => _411.paraAlign, 'access', _412 => _412.get, 'call', _413 => _413(paraPrId)]);
26512
+ const paraPrId = _nullishCoalesce(attrOf3(paraOpenTag(xml, site.para), "paraPrIDRef"), () => ( "0"));
26513
+ const align = _optionalChain([styles, 'optionalAccess', _422 => _422.paraAlign, 'access', _423 => _423.get, 'call', _424 => _424(paraPrId)]);
26196
26514
  let alignShiftMm = 0;
26197
26515
  if (align === "CENTER" || align === "RIGHT") {
26198
26516
  const paraWMm = measureMm(site.para.text, emMm);
@@ -26288,7 +26606,7 @@ function parseBorderFills(headerDoc) {
26288
26606
  };
26289
26607
  const fillBrush = findChildByLocalName(bf, "fillBrush");
26290
26608
  const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
26291
- const face = _optionalChain([winBrush, 'optionalAccess', _414 => _414.getAttribute, 'call', _415 => _415("faceColor")]);
26609
+ const face = _optionalChain([winBrush, 'optionalAccess', _425 => _425.getAttribute, 'call', _426 => _426("faceColor")]);
26292
26610
  if (face && face !== "none") def.fill = { faceColor: face };
26293
26611
  map.set(id, def);
26294
26612
  }
@@ -26320,7 +26638,7 @@ function parseCharPrs(headerDoc, hangulFonts) {
26320
26638
  if (cp.getAttribute("italic") === "1") def.italic = true;
26321
26639
  if (findChildByLocalName(cp, "underline")) def.underline = true;
26322
26640
  const fontRef = findChildByLocalName(cp, "fontRef");
26323
- const hangul = _optionalChain([fontRef, 'optionalAccess', _416 => _416.getAttribute, 'call', _417 => _417("hangul")]);
26641
+ const hangul = _optionalChain([fontRef, 'optionalAccess', _427 => _427.getAttribute, 'call', _428 => _428("hangul")]);
26324
26642
  if (hangul) {
26325
26643
  def.fontRef_hangul = hangul;
26326
26644
  const face = hangulFonts.get(hangul);
@@ -26348,7 +26666,7 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
26348
26666
  const rows = _nullishCoalesce(num(tbl2.getAttribute("rowCnt")), () => ( 0));
26349
26667
  const cols = _nullishCoalesce(num(tbl2.getAttribute("colCnt")), () => ( 0));
26350
26668
  const sz = findChildByLocalName(tbl2, "sz");
26351
- const width = _optionalChain([sz, 'optionalAccess', _418 => _418.getAttribute, 'call', _419 => _419("width")]) || void 0;
26669
+ const width = _optionalChain([sz, 'optionalAccess', _429 => _429.getAttribute, 'call', _430 => _430("width")]) || void 0;
26352
26670
  const cells = [];
26353
26671
  const usedBf = /* @__PURE__ */ new Set();
26354
26672
  const usedCp = /* @__PURE__ */ new Set();
@@ -26361,17 +26679,17 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
26361
26679
  const addr = findChildByLocalName(tc2, "cellAddr");
26362
26680
  const span = findChildByLocalName(tc2, "cellSpan");
26363
26681
  const csz = findChildByLocalName(tc2, "cellSz");
26364
- const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _420 => _420.getAttribute, 'call', _421 => _421("rowAddr")])), () => ( 0));
26365
- const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _422 => _422.getAttribute, 'call', _423 => _423("colAddr")])), () => ( 0));
26682
+ const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _431 => _431.getAttribute, 'call', _432 => _432("rowAddr")])), () => ( 0));
26683
+ const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _433 => _433.getAttribute, 'call', _434 => _434("colAddr")])), () => ( 0));
26366
26684
  if (row === 0 && col === 0 && !anchorText) anchorText = directCellText(tc2);
26367
26685
  if (row === 0) row0Texts.set(col, directCellText(tc2));
26368
- const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _424 => _424.getAttribute, 'call', _425 => _425("colSpan")])), () => ( 1));
26369
- const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _426 => _426.getAttribute, 'call', _427 => _427("rowSpan")])), () => ( 1));
26686
+ const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _435 => _435.getAttribute, 'call', _436 => _436("colSpan")])), () => ( 1));
26687
+ const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _437 => _437.getAttribute, 'call', _438 => _438("rowSpan")])), () => ( 1));
26370
26688
  const bfId = tc2.getAttribute("borderFillIDRef") || void 0;
26371
26689
  const cpId = firstRunCharPr(tc2);
26372
26690
  const cell2 = { row, col, rowSpan, colSpan };
26373
- const w = _optionalChain([csz, 'optionalAccess', _428 => _428.getAttribute, 'call', _429 => _429("width")]);
26374
- const hh = _optionalChain([csz, 'optionalAccess', _430 => _430.getAttribute, 'call', _431 => _431("height")]);
26691
+ const w = _optionalChain([csz, 'optionalAccess', _439 => _439.getAttribute, 'call', _440 => _440("width")]);
26692
+ const hh = _optionalChain([csz, 'optionalAccess', _441 => _441.getAttribute, 'call', _442 => _442("height")]);
26375
26693
  if (w) cell2.width_hwpunit = w;
26376
26694
  if (hh) cell2.height_hwpunit = hh;
26377
26695
  if (bfId) {
@@ -26459,16 +26777,16 @@ function pick(map, keys) {
26459
26777
  return out;
26460
26778
  }
26461
26779
  async function hwpxToProfile(input) {
26462
- const buf = input instanceof ArrayBuffer ? input : _chunkJFV7QT5Tcjs.toArrayBuffer.call(void 0, input);
26780
+ const buf = input instanceof ArrayBuffer ? input : _chunkH2KMJOB6cjs.toArrayBuffer.call(void 0, input);
26463
26781
  const zip = await _jszip2.default.loadAsync(buf);
26464
26782
  const parser = createXmlParser();
26465
- const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _432 => _432.file, 'call', _433 => _433(/[Hh]eader\.xml$/), 'optionalAccess', _434 => _434[0]])));
26783
+ const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _443 => _443.file, 'call', _444 => _444(/[Hh]eader\.xml$/), 'optionalAccess', _445 => _445[0]])));
26466
26784
  let headerXml = "<root/>";
26467
26785
  if (headerFile) headerXml = await headerFile.async("text");
26468
26786
  const headerDoc = parser.parseFromString(headerXml, "text/xml");
26469
26787
  const borderFills = parseBorderFills(headerDoc);
26470
26788
  const charPrs = parseCharPrs(headerDoc, parseHangulFonts(headerDoc));
26471
- const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _435 => _435.name, 'access', _436 => _436.match, 'call', _437 => _437(/(\d+)\.xml$/), 'optionalAccess', _438 => _438[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _439 => _439.name, 'access', _440 => _440.match, 'call', _441 => _441(/(\d+)\.xml$/), 'optionalAccess', _442 => _442[1]]), () => ( null))), () => ( 0))));
26789
+ const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _446 => _446.name, 'access', _447 => _447.match, 'call', _448 => _448(/(\d+)\.xml$/), 'optionalAccess', _449 => _449[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _450 => _450.name, 'access', _451 => _451.match, 'call', _452 => _452(/(\d+)\.xml$/), 'optionalAccess', _453 => _453[1]]), () => ( null))), () => ( 0))));
26472
26790
  const tables = [];
26473
26791
  let tableIndex = 0;
26474
26792
  for (const f of sectionFiles) {
@@ -26782,7 +27100,7 @@ var ROW_OBJECT_RE = /<(?:[A-Za-z0-9_]+:)?(?:tbl|pic|equation|ole|container|shape
26782
27100
  var TAG_AT_RE = /<[A-Za-z0-9_:]+(?:"[^"]*"|'[^']*'|[^>"'])*>/y;
26783
27101
  function patchTableRows(input) {
26784
27102
  const { table: table2, scanTable, ctx, skip, origKeys, editedKeys } = input;
26785
- const xml = _optionalChain([ctx, 'access', _443 => _443.scans, 'access', _444 => _444[scanTable.sectionIndex], 'optionalAccess', _445 => _445.xml]);
27103
+ const xml = _optionalChain([ctx, 'access', _454 => _454.scans, 'access', _455 => _455[scanTable.sectionIndex], 'optionalAccess', _456 => _456.xml]);
26786
27104
  if (!xml) return skip("\uC139\uC158 XML \uB9E4\uD551 \uC2E4\uD328");
26787
27105
  const numRows = table2.rows;
26788
27106
  if (origKeys.length !== numRows) return skip("\uD45C \uD589 \uC88C\uD45C \uBD88\uC77C\uCE58 \u2014 \uD589 \uCD94\uAC00/\uC0AD\uC81C \uBBF8\uC9C0\uC6D0");
@@ -26949,7 +27267,7 @@ function buildRowFragment(xml, scanTable, template, cells, finalRow, hasExplicit
26949
27267
  const rr = scanTable.rowRanges[template];
26950
27268
  const wrapped = FRAG_OPEN + xml.slice(rr.start, rr.end) + FRAG_CLOSE;
26951
27269
  const scan = scanSectionXml(wrapped, 0);
26952
- const row = _optionalChain([scan, 'access', _446 => _446.tables, 'access', _447 => _447[0], 'optionalAccess', _448 => _448.rows, 'access', _449 => _449[0]]);
27270
+ const row = _optionalChain([scan, 'access', _457 => _457.tables, 'access', _458 => _458[0], 'optionalAccess', _459 => _459.rows, 'access', _460 => _460[0]]);
26953
27271
  if (!row || row.length !== cells.length) return null;
26954
27272
  const splices = allLinesegRemovalSplices(wrapped);
26955
27273
  for (let i = 0; i < cells.length; i++) {
@@ -26992,7 +27310,7 @@ function rowHeightOf(fragment) {
26992
27310
  }
26993
27311
  function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
26994
27312
  const from = scanTable.start + tblOpenLen;
26995
- const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _450 => _450.rowRanges, 'access', _451 => _451[0], 'optionalAccess', _452 => _452.start]), () => ( from));
27313
+ const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _461 => _461.rowRanges, 'access', _462 => _462[0], 'optionalAccess', _463 => _463.start]), () => ( from));
26996
27314
  const slice = xml.slice(from, to);
26997
27315
  const szM = slice.match(/<(?:[A-Za-z0-9_]+:)?sz\b(?:"[^"]*"|'[^']*'|[^>"'])*>/);
26998
27316
  if (!szM || szM.index === void 0) return null;
@@ -27181,9 +27499,9 @@ function patchHtmlTableRows(table2, scanTable, replica, editedRows, ctx, skip, d
27181
27499
  });
27182
27500
  }
27183
27501
  function patchNestedTables(table2, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
27184
- const irCell = _optionalChain([table2, 'access', _453 => _453.cells, 'access', _454 => _454[oc.gridR], 'optionalAccess', _455 => _455[oc.gridC]]);
27502
+ const irCell = _optionalChain([table2, 'access', _464 => _464.cells, 'access', _465 => _465[oc.gridR], 'optionalAccess', _466 => _466[oc.gridC]]);
27185
27503
  const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
27186
- const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _456 => _456.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
27504
+ const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _467 => _467.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
27187
27505
  if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
27188
27506
  return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
27189
27507
  }
@@ -27251,7 +27569,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
27251
27569
  };
27252
27570
  const cell2 = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
27253
27571
  if (!cell2) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
27254
- const irCell = _optionalChain([table2, 'access', _457 => _457.cells, 'access', _458 => _458[gridR], 'optionalAccess', _459 => _459[gridC]]);
27572
+ const irCell = _optionalChain([table2, 'access', _468 => _468.cells, 'access', _469 => _469[gridR], 'optionalAccess', _470 => _470[gridC]]);
27255
27573
  const scanJoined = cell2.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
27256
27574
  if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
27257
27575
  if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
@@ -27275,9 +27593,12 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
27275
27593
  const target = cell2.paragraphs[0];
27276
27594
  if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
27277
27595
  const value = newLines.join(" ");
27278
- const xml = _optionalChain([ctx, 'access', _460 => _460.scans, 'access', _461 => _461[target.sectionIndex], 'optionalAccess', _462 => _462.xml]);
27596
+ const xml = _optionalChain([ctx, 'access', _471 => _471.scans, 'access', _472 => _472[target.sectionIndex], 'optionalAccess', _473 => _473.xml]);
27279
27597
  const rawT = xml ? paraTText(target, xml) : null;
27280
27598
  let sp;
27599
+ if (xml && rawT === null) {
27600
+ return skip("\uBE48 \uC140 \uBB38\uB2E8\uC5D0 \uC5D4\uD2F0\uD2F0\xB7\uD0DC\uADF8\uAC00 \uC788\uC5B4 \uC0BD\uC785 \uACBD\uACC4\uB97C \uD2B9\uC815\uD560 \uC218 \uC5C6\uC74C \u2014 \uC6D0\uBB38 \uC190\uC2E4 \uBC29\uC9C0\uB85C \uBBF8\uC801\uC6A9");
27601
+ }
27281
27602
  if (xml && rawT !== null && rawT.length > 0 && rawT.trim() === "") {
27282
27603
  sp = buildRangeSplices(target, xml, 0, 0, value);
27283
27604
  if (sp === null) return skip("\uBE48 \uC140 \uACF5\uBC31 \uBCF4\uC874 \uC0BD\uC785 \uACBD\uACC4 \uBAA8\uD638 \u2014 \uC6D0\uBB38 \uC190\uC2E4 \uBC29\uC9C0\uB85C \uBBF8\uC801\uC6A9");
@@ -27306,7 +27627,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
27306
27627
  }
27307
27628
  for (let i = 0; i < nonEmpty.length; i++) {
27308
27629
  if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
27309
- const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _463 => _463.scans, 'access', _464 => _464[nonEmpty[i].sectionIndex], 'optionalAccess', _465 => _465.xml]));
27630
+ const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _474 => _474.scans, 'access', _475 => _475[nonEmpty[i].sectionIndex], 'optionalAccess', _476 => _476.xml]));
27310
27631
  if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
27311
27632
  splices.push(...sp);
27312
27633
  sectionIndex = nonEmpty[i].sectionIndex;
@@ -27387,7 +27708,7 @@ async function resolveSectionEntryNames(zip) {
27387
27708
  const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
27388
27709
  if (paths.length > 0) return paths;
27389
27710
  }
27390
- return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkJFV7QT5Tcjs.compareSectionPaths);
27711
+ return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkH2KMJOB6cjs.compareSectionPaths);
27391
27712
  }
27392
27713
  function sectionPathsFromManifest(xml) {
27393
27714
  const attr = (tag, name) => {
@@ -27397,7 +27718,7 @@ function sectionPathsFromManifest(xml) {
27397
27718
  const idToHref = /* @__PURE__ */ new Map();
27398
27719
  for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
27399
27720
  const id = attr(m[1], "id");
27400
- const href = _chunkJFV7QT5Tcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
27721
+ const href = _chunkH2KMJOB6cjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
27401
27722
  if (id && href) idToHref.set(id, href);
27402
27723
  }
27403
27724
  const ordered = [];
@@ -27406,7 +27727,7 @@ function sectionPathsFromManifest(xml) {
27406
27727
  if (href) ordered.push(href);
27407
27728
  }
27408
27729
  if (ordered.length > 0) return ordered;
27409
- return Array.from(idToHref.values()).sort(_chunkJFV7QT5Tcjs.compareSectionPaths);
27730
+ return Array.from(idToHref.values()).sort(_chunkH2KMJOB6cjs.compareSectionPaths);
27410
27731
  }
27411
27732
 
27412
27733
  // src/roundtrip/patcher.ts
@@ -27423,7 +27744,7 @@ async function patchHwpx(original, editedMarkdown, options) {
27423
27744
  let zip;
27424
27745
  try {
27425
27746
  zip = await _jszip2.default.loadAsync(original);
27426
- } catch (e31) {
27747
+ } catch (e34) {
27427
27748
  return { success: false, applied: 0, skipped, error: "ZIP \uB85C\uB4DC \uC2E4\uD328" };
27428
27749
  }
27429
27750
  const sectionPaths = await resolveSectionEntryNames(zip);
@@ -27498,7 +27819,7 @@ async function patchHwpx(original, editedMarkdown, options) {
27498
27819
  }
27499
27820
  }
27500
27821
  let verification;
27501
- if (_optionalChain([options, 'optionalAccess', _466 => _466.verify]) !== false) {
27822
+ if (_optionalChain([options, 'optionalAccess', _477 => _477.verify]) !== false) {
27502
27823
  try {
27503
27824
  const reparsed = await parseHwpxDocument(u8ToArrayBuffer(data));
27504
27825
  verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
@@ -27516,17 +27837,17 @@ function buildOrigUnits(blocks) {
27516
27837
  let chunk;
27517
27838
  if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
27518
27839
  const next = blocks[i + 1];
27519
- if (_optionalChain([next, 'optionalAccess', _467 => _467.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
27520
- chunk = _chunkAUOEZKJEcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
27840
+ if (_optionalChain([next, 'optionalAccess', _478 => _478.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
27841
+ chunk = _chunkUDGPM5R5cjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
27521
27842
  } else {
27522
- chunk = _chunkAUOEZKJEcjs.blocksToMarkdown.call(void 0, [block]);
27843
+ chunk = _chunkUDGPM5R5cjs.blocksToMarkdown.call(void 0, [block]);
27523
27844
  }
27524
27845
  if (chunk) {
27525
27846
  const subUnits = splitMarkdownUnits(chunk);
27526
27847
  const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
27527
27848
  for (let s = 0; s < subUnits.length; s++) {
27528
27849
  const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
27529
- if (block.type === "table" && _optionalChain([block, 'access', _468 => _468.table, 'optionalAccess', _469 => _469.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
27850
+ if (block.type === "table" && _optionalChain([block, 'access', _479 => _479.table, 'optionalAccess', _480 => _480.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
27530
27851
  u.role = "caption";
27531
27852
  }
27532
27853
  units.push(u);
@@ -27637,7 +27958,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
27637
27958
  const ti = ctx.tableInsert;
27638
27959
  if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
27639
27960
  const mapping = ctx.paraMap.get(orig.blockIdx);
27640
- if (!_optionalChain([mapping, 'optionalAccess', _470 => _470.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED) \u2014 \uD45C \uBCC0\uD658 \uBD88\uAC00");
27961
+ if (!_optionalChain([mapping, 'optionalAccess', _481 => _481.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED) \u2014 \uD45C \uBCC0\uD658 \uBD88\uAC00");
27641
27962
  const para2 = mapping.para;
27642
27963
  if (para2.kind !== "body") return skip("\uBCF8\uBB38 \uC678 \uC601\uC5ED(\uD45C \uC140/\uAE00\uC0C1\uC790) \uBB38\uB2E8\uC758 \uD45C \uBCC0\uD658\uC740 \uBBF8\uC9C0\uC6D0");
27643
27964
  const scan = ctx.scans[para2.sectionIndex];
@@ -27665,7 +27986,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
27665
27986
  }
27666
27987
  function patchParagraphUnit(block, orig, edited, ctx, skip) {
27667
27988
  const mapping = ctx.paraMap.get(orig.blockIdx);
27668
- if (!_optionalChain([mapping, 'optionalAccess', _471 => _471.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
27989
+ if (!_optionalChain([mapping, 'optionalAccess', _482 => _482.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
27669
27990
  if (block.text && block.text.includes("\n")) {
27670
27991
  return skip("\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)");
27671
27992
  }
@@ -27696,7 +28017,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
27696
28017
  if (sanitizeText(newPlain) !== newPlain) {
27697
28018
  return skip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uD328\uCE58 \uC2DC \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
27698
28019
  }
27699
- const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _472 => _472.scans, 'access', _473 => _473[mapping.para.sectionIndex], 'optionalAccess', _474 => _474.xml]));
28020
+ const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _483 => _483.scans, 'access', _484 => _484[mapping.para.sectionIndex], 'optionalAccess', _485 => _485.xml]));
27700
28021
  if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
27701
28022
  ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
27702
28023
  return 1;
@@ -27888,7 +28209,7 @@ var Surgeon = (_class7 = class {
27888
28209
  /** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
27889
28210
  findEntry(path) {
27890
28211
  const parts = path.replace(/^\//, "").split("/");
27891
- let scope = _nullishCoalesce(_optionalChain([this, 'access', _475 => _475.entries, 'access', _476 => _476[0], 'optionalAccess', _477 => _477.child]), () => ( -1));
28212
+ let scope = _nullishCoalesce(_optionalChain([this, 'access', _486 => _486.entries, 'access', _487 => _487[0], 'optionalAccess', _488 => _488.child]), () => ( -1));
27892
28213
  let current;
27893
28214
  for (const part of parts) {
27894
28215
  const search = (idx) => {
@@ -28141,8 +28462,8 @@ function serializeRecords(recs, repl, inserts) {
28141
28462
  parts.push(header, data);
28142
28463
  };
28143
28464
  for (let i = 0; i < recs.length; i++) {
28144
- for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _478 => _478.get, 'call', _479 => _479(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
28145
- push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _480 => _480.get, 'call', _481 => _481(i)]), () => ( recs[i].data)));
28465
+ for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _489 => _489.get, 'call', _490 => _490(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
28466
+ push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _491 => _491.get, 'call', _492 => _492(i)]), () => ( recs[i].data)));
28146
28467
  }
28147
28468
  return Buffer.concat(parts);
28148
28469
  }
@@ -28260,7 +28581,7 @@ async function patchHwp(original, editedMarkdown, options) {
28260
28581
  return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
28261
28582
  }
28262
28583
  const fhEntry = CFB2.find(cfb, "/FileHeader");
28263
- if (!_optionalChain([fhEntry, 'optionalAccess', _482 => _482.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
28584
+ if (!_optionalChain([fhEntry, 'optionalAccess', _493 => _493.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
28264
28585
  let flags;
28265
28586
  try {
28266
28587
  flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
@@ -28282,7 +28603,7 @@ async function patchHwp(original, editedMarkdown, options) {
28282
28603
  const scans = [];
28283
28604
  for (let i = 0; i < sectionPaths.length; i++) {
28284
28605
  const entry = CFB2.find(cfb, sectionPaths[i]);
28285
- if (!_optionalChain([entry, 'optionalAccess', _483 => _483.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
28606
+ if (!_optionalChain([entry, 'optionalAccess', _494 => _494.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
28286
28607
  let stream;
28287
28608
  try {
28288
28609
  stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
@@ -28333,7 +28654,7 @@ async function patchHwp(original, editedMarkdown, options) {
28333
28654
  }
28334
28655
  }
28335
28656
  let verification;
28336
- if (_optionalChain([options, 'optionalAccess', _484 => _484.verify]) !== false) {
28657
+ if (_optionalChain([options, 'optionalAccess', _495 => _495.verify]) !== false) {
28337
28658
  try {
28338
28659
  const reparsed = parseHwp5Document(Buffer.from(data));
28339
28660
  const normBr = (u) => ({ ...u, raw: u.raw.replace(/<br\s*\/?\s*>/gi, "\n") });
@@ -28423,7 +28744,7 @@ function tableContentScore(irTable, scanTable) {
28423
28744
  for (const [key, scanCell] of scanTable.cells) {
28424
28745
  const comma = key.indexOf(",");
28425
28746
  const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
28426
- const irCell = _optionalChain([irTable, 'access', _485 => _485.cells, 'access', _486 => _486[r], 'optionalAccess', _487 => _487[c]]);
28747
+ const irCell = _optionalChain([irTable, 'access', _496 => _496.cells, 'access', _497 => _497[r], 'optionalAccess', _498 => _498[c]]);
28427
28748
  if (!irCell) continue;
28428
28749
  const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
28429
28750
  const b = normForMatch(stripCellTokens(irCell.text));
@@ -28459,7 +28780,7 @@ function handleModified(orig, edited, ctx) {
28459
28780
  }
28460
28781
  function patchParagraph(block, orig, edited, ctx, skip) {
28461
28782
  const mapping = ctx.paraMap.get(orig.blockIdx);
28462
- if (!_optionalChain([mapping, 'optionalAccess', _488 => _488.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
28783
+ if (!_optionalChain([mapping, 'optionalAccess', _499 => _499.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
28463
28784
  const restoreBr = (s) => s.replace(/(?:\s*<br\s*\/?\s*>\s*)+/gi, "\n");
28464
28785
  let newPlain = restoreBr(textUnitToPlain(edited.raw, block));
28465
28786
  if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
@@ -28658,7 +28979,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before,
28658
28979
  };
28659
28980
  const cell2 = scanTable.cells.get(`${gridR},${gridC}`);
28660
28981
  if (!cell2) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
28661
- const irCell = _optionalChain([table2, 'access', _489 => _489.cells, 'access', _490 => _490[gridR], 'optionalAccess', _491 => _491[gridC]]);
28982
+ const irCell = _optionalChain([table2, 'access', _500 => _500.cells, 'access', _501 => _501[gridR], 'optionalAccess', _502 => _502[gridC]]);
28662
28983
  const scanJoined = cell2.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
28663
28984
  if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
28664
28985
  if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
@@ -29065,11 +29386,11 @@ var RULES2 = {
29065
29386
  }
29066
29387
  };
29067
29388
  function redactText(text, options) {
29068
- const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _492 => _492.maskChar]), () => ( "\u25CF"));
29389
+ const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _503 => _503.maskChar]), () => ( "\u25CF"));
29069
29390
  if (maskChar.length !== 1 || /[0-9A-Za-z]/.test(maskChar)) {
29070
29391
  throw new Error(`maskChar\uB294 \uC601\uC22B\uC790\uAC00 \uC544\uB2CC 1\uAE00\uC790\uC5EC\uC57C \uD568: ${JSON.stringify(maskChar)}`);
29071
29392
  }
29072
- const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _493 => _493.rules]), () => ( DEFAULT_REDACT_RULES));
29393
+ const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _504 => _504.rules]), () => ( DEFAULT_REDACT_RULES));
29073
29394
  const hits = [];
29074
29395
  if (text === "" || enabled.length === 0) return { text, hits };
29075
29396
  const occupied = [];
@@ -29124,8 +29445,8 @@ function sameBreadcrumb(a, b) {
29124
29445
  return a.length === b.length && a.every((v, i) => v === b[i]);
29125
29446
  }
29126
29447
  function blocksToChunks(blocks, options) {
29127
- const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _494 => _494.granularity]), () => ( "section"));
29128
- const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _495 => _495.includeTableCells]), () => ( false));
29448
+ const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _505 => _505.granularity]), () => ( "section"));
29449
+ const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _506 => _506.includeTableCells]), () => ( false));
29129
29450
  const chunks = [];
29130
29451
  const headingStack = [];
29131
29452
  const listStack = [];
@@ -29139,12 +29460,12 @@ function blocksToChunks(blocks, options) {
29139
29460
  let run = null;
29140
29461
  const flushRun = () => {
29141
29462
  if (!run) return;
29142
- push("text", run.breadcrumb, _chunkAUOEZKJEcjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
29463
+ push("text", run.breadcrumb, _chunkUDGPM5R5cjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
29143
29464
  run = null;
29144
29465
  };
29145
29466
  for (let i = 0; i < blocks.length; i++) {
29146
29467
  const block = blocks[i];
29147
- const md2 = _chunkAUOEZKJEcjs.blocksToMarkdown.call(void 0, [block]);
29468
+ const md2 = _chunkUDGPM5R5cjs.blocksToMarkdown.call(void 0, [block]);
29148
29469
  if (!md2) continue;
29149
29470
  if (block.type === "heading") {
29150
29471
  flushRun();
@@ -29260,7 +29581,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
29260
29581
  const block = st.blocks[blockIndex];
29261
29582
  if (!block) return void 0;
29262
29583
  if (block.type === "paragraph" || block.type === "heading") {
29263
- const para2 = _optionalChain([st, 'access', _496 => _496.paraMap, 'access', _497 => _497.get, 'call', _498 => _498(blockIndex), 'optionalAccess', _499 => _499.para]);
29584
+ const para2 = _optionalChain([st, 'access', _507 => _507.paraMap, 'access', _508 => _508.get, 'call', _509 => _509(blockIndex), 'optionalAccess', _510 => _510.para]);
29264
29585
  if (!para2) return void 0;
29265
29586
  return { kind: "paragraph", sectionIndex: para2.sectionIndex, xmlStart: para2.start };
29266
29587
  }
@@ -29285,7 +29606,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
29285
29606
  if (block.text && block.text.includes("\n")) {
29286
29607
  return { capability: "locked", reason: "\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)" };
29287
29608
  }
29288
- if (!_optionalChain([st, 'access', _500 => _500.paraMap, 'access', _501 => _501.get, 'call', _502 => _502(blockIndex), 'optionalAccess', _503 => _503.para])) {
29609
+ if (!_optionalChain([st, 'access', _511 => _511.paraMap, 'access', _512 => _512.get, 'call', _513 => _513(blockIndex), 'optionalAccess', _514 => _514.para])) {
29289
29610
  return { capability: "locked", reason: "\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)" };
29290
29611
  }
29291
29612
  return { capability: "text" };
@@ -29351,7 +29672,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
29351
29672
  continue;
29352
29673
  }
29353
29674
  if (block.type === "table" && block.table) {
29354
- if (!_optionalChain([edit, 'access', _504 => _504.cells, 'optionalAccess', _505 => _505.length])) {
29675
+ if (!_optionalChain([edit, 'access', _515 => _515.cells, 'optionalAccess', _516 => _516.length])) {
29355
29676
  skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
29356
29677
  continue;
29357
29678
  }
@@ -29371,7 +29692,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
29371
29692
  skipped.push({ reason: "\uAC19\uC740 \uC140\uC5D0 \uC911\uBCF5 \uD3B8\uC9D1 \u2014 \uBA3C\uC800 \uC801\uC6A9\uB41C \uD3B8\uC9D1 \uC720\uC9C0", after: summarize(cellEdit.text) });
29372
29693
  continue;
29373
29694
  }
29374
- const irCell = _optionalChain([block, 'access', _506 => _506.table, 'access', _507 => _507.cells, 'access', _508 => _508[cellEdit.row], 'optionalAccess', _509 => _509[cellEdit.col]]);
29695
+ const irCell = _optionalChain([block, 'access', _517 => _517.table, 'access', _518 => _518.cells, 'access', _519 => _519[cellEdit.row], 'optionalAccess', _520 => _520[cellEdit.col]]);
29375
29696
  if (!irCell) {
29376
29697
  skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
29377
29698
  continue;
@@ -29427,7 +29748,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
29427
29748
  }
29428
29749
  if (replacements.size === 0) {
29429
29750
  let changes2;
29430
- if (_optionalChain([options, 'optionalAccess', _510 => _510.verify]) !== false) {
29751
+ if (_optionalChain([options, 'optionalAccess', _521 => _521.verify]) !== false) {
29431
29752
  const units = splitMarkdownUnits(st.markdown);
29432
29753
  changes2 = diffUnitLists(units, units);
29433
29754
  }
@@ -29448,7 +29769,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
29448
29769
  }
29449
29770
  this.state = newState;
29450
29771
  let changes;
29451
- if (_optionalChain([options, 'optionalAccess', _511 => _511.verify]) !== false) {
29772
+ if (_optionalChain([options, 'optionalAccess', _522 => _522.verify]) !== false) {
29452
29773
  changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
29453
29774
  }
29454
29775
  return { success: true, data: new Uint8Array(data), applied, skipped, changes };
@@ -29468,7 +29789,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
29468
29789
  return skip("\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)");
29469
29790
  }
29470
29791
  const mapping = st.paraMap.get(blockIndex);
29471
- if (!_optionalChain([mapping, 'optionalAccess', _512 => _512.para])) {
29792
+ if (!_optionalChain([mapping, 'optionalAccess', _523 => _523.para])) {
29472
29793
  return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
29473
29794
  }
29474
29795
  let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
@@ -29488,14 +29809,14 @@ var HwpxSession = (_class8 = class _HwpxSession {
29488
29809
  if (sanitizeText(newPlain) !== newPlain) {
29489
29810
  return skip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uD328\uCE58 \uC2DC \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
29490
29811
  }
29491
- const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _513 => _513.scans, 'access', _514 => _514[mapping.para.sectionIndex], 'optionalAccess', _515 => _515.xml]));
29812
+ const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _524 => _524.scans, 'access', _525 => _525[mapping.para.sectionIndex], 'optionalAccess', _526 => _526.xml]));
29492
29813
  if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
29493
29814
  sectionSplices[mapping.para.sectionIndex].push(...splices);
29494
29815
  return 1;
29495
29816
  }
29496
29817
  }, _class8);
29497
29818
  function cellStaticCheck(table2, scanTable, r, c) {
29498
- const irCell = _optionalChain([table2, 'access', _516 => _516.cells, 'access', _517 => _517[r], 'optionalAccess', _518 => _518[c]]);
29819
+ const irCell = _optionalChain([table2, 'access', _527 => _527.cells, 'access', _528 => _528[r], 'optionalAccess', _529 => _529[c]]);
29499
29820
  if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
29500
29821
  const cell2 = scanTable.cellByAnchor.get(`${r},${c}`);
29501
29822
  if (!cell2) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
@@ -29579,11 +29900,11 @@ var md = new (0, _markdownit2.default)({
29579
29900
  breaks: false
29580
29901
  });
29581
29902
  function renderHtml(markdown, options) {
29582
- const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _519 => _519.preset]), () => ( "default"));
29583
- const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _520 => _520.extraCss]), () => ( "")));
29903
+ const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _530 => _530.preset]), () => ( "default"));
29904
+ const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _531 => _531.extraCss]), () => ( "")));
29584
29905
  const body = md.render(markdown);
29585
- const watermark = _optionalChain([options, 'optionalAccess', _521 => _521.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
29586
- const watermarkCss = _optionalChain([options, 'optionalAccess', _522 => _522.watermark]) ? `
29906
+ const watermark = _optionalChain([options, 'optionalAccess', _532 => _532.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
29907
+ const watermarkCss = _optionalChain([options, 'optionalAccess', _533 => _533.watermark]) ? `
29587
29908
  .watermark {
29588
29909
  position: fixed;
29589
29910
  top: 50%; left: 50%;
@@ -29613,14 +29934,14 @@ async function htmlToPdf(html, options) {
29613
29934
  let puppeteer;
29614
29935
  try {
29615
29936
  puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
29616
- } catch (e32) {
29617
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)(
29937
+ } catch (e35) {
29938
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(
29618
29939
  "PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
29619
29940
  );
29620
29941
  }
29621
29942
  const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
29622
29943
  if (!executablePath) {
29623
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)(
29944
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)(
29624
29945
  "Chromium \uC2E4\uD589 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. PUPPETEER_EXECUTABLE_PATH \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694."
29625
29946
  );
29626
29947
  }
@@ -29632,10 +29953,10 @@ async function htmlToPdf(html, options) {
29632
29953
  try {
29633
29954
  const page = await browser.newPage();
29634
29955
  await page.setContent(html, { waitUntil: "networkidle0" });
29635
- const margin = _optionalChain([options, 'optionalAccess', _523 => _523.margin]);
29956
+ const margin = _optionalChain([options, 'optionalAccess', _534 => _534.margin]);
29636
29957
  const pdf = await page.pdf({
29637
- format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _524 => _524.pageSize]), () => ( "A4")),
29638
- landscape: _optionalChain([options, 'optionalAccess', _525 => _525.orientation]) === "landscape",
29958
+ format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _535 => _535.pageSize]), () => ( "A4")),
29959
+ landscape: _optionalChain([options, 'optionalAccess', _536 => _536.orientation]) === "landscape",
29639
29960
  printBackground: true,
29640
29961
  margin: margin ? {
29641
29962
  top: toCss(margin.top),
@@ -29643,9 +29964,9 @@ async function htmlToPdf(html, options) {
29643
29964
  bottom: toCss(margin.bottom),
29644
29965
  left: toCss(margin.left)
29645
29966
  } : void 0,
29646
- displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _526 => _526.header]) || _optionalChain([options, 'optionalAccess', _527 => _527.footer])),
29647
- headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _528 => _528.header]), () => ( "<div></div>")),
29648
- footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _529 => _529.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
29967
+ displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _537 => _537.header]) || _optionalChain([options, 'optionalAccess', _538 => _538.footer])),
29968
+ headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _539 => _539.header]), () => ( "<div></div>")),
29969
+ footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _540 => _540.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
29649
29970
  });
29650
29971
  return Buffer.from(pdf);
29651
29972
  } finally {
@@ -29679,7 +30000,7 @@ async function markdownToPdf(markdown, options) {
29679
30000
  return htmlToPdf(html, options);
29680
30001
  }
29681
30002
  async function blocksToPdf(blocks, options) {
29682
- const markdown = _chunkAUOEZKJEcjs.blocksToMarkdown.call(void 0, blocks);
30003
+ const markdown = _chunkUDGPM5R5cjs.blocksToMarkdown.call(void 0, blocks);
29683
30004
  return markdownToPdf(markdown, options);
29684
30005
  }
29685
30006
 
@@ -29858,7 +30179,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode) {
29858
30179
  }
29859
30180
  const wrapAttr = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( ""));
29860
30181
  if (wrapAttr === "BEHIND_TEXT" || wrapAttr === "IN_FRONT_OF_TEXT") continue;
29861
- const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _530 => _530.getAttribute, 'call', _531 => _531("vertRelTo")]), () => ( "PARA"));
30182
+ const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _541 => _541.getAttribute, 'call', _542 => _542("vertRelTo")]), () => ( "PARA"));
29862
30183
  if (vertRel === "PAGE" || vertRel === "PAPER") continue;
29863
30184
  const vo = Math.max(0, num2(pos, "vertOffset"));
29864
30185
  if (wrapAttr === "TOP_AND_BOTTOM") {
@@ -29919,7 +30240,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
29919
30240
  if (ln(p) !== "p") continue;
29920
30241
  reflowTablesIn(p, doc, styles, mode, counter);
29921
30242
  const g = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
29922
- const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _532 => _532.spaceBefore]), () => ( 0)));
30243
+ const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _543 => _543.spaceBefore]), () => ( 0)));
29923
30244
  const res = reflowPara(p, doc, styles, areaW, startV, mode);
29924
30245
  if (!res) {
29925
30246
  const lsa = findChildByLocalName(p, "linesegarray");
@@ -29932,7 +30253,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
29932
30253
  }
29933
30254
  if (Number.isFinite(bottom)) {
29934
30255
  cursorV = bottom;
29935
- prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess', _533 => _533.spaceAfter]), () => ( 0));
30256
+ prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess', _544 => _544.spaceAfter]), () => ( 0));
29936
30257
  }
29937
30258
  }
29938
30259
  continue;
@@ -30003,7 +30324,7 @@ function pushTextSlots(t, chars, prId, depth) {
30003
30324
  if (!kids) return;
30004
30325
  for (let i = 0; i < kids.length; i++) {
30005
30326
  const c = kids[i];
30006
- if (c.nodeType === 3) {
30327
+ if (c.nodeType === 3 || c.nodeType === 4) {
30007
30328
  for (const cp of _nullishCoalesce(c.textContent, () => ( ""))) {
30008
30329
  chars.push({ ch: cp, prId });
30009
30330
  if (cp.length === 2) chars.push({ ch: "", prId });
@@ -30038,7 +30359,7 @@ function buildPara(p) {
30038
30359
  const pos = findChildByLocalName(ch, "pos");
30039
30360
  const w = num3(sz, "width") || num3(findChildByLocalName(ch, "curSz"), "width") || num3(findChildByLocalName(ch, "orgSz"), "width");
30040
30361
  const h = num3(sz, "height") || num3(findChildByLocalName(ch, "curSz"), "height") || num3(findChildByLocalName(ch, "orgSz"), "height");
30041
- const inline = _optionalChain([pos, 'optionalAccess', _534 => _534.getAttribute, 'call', _535 => _535("treatAsChar")]) === "1";
30362
+ const inline = _optionalChain([pos, 'optionalAccess', _545 => _545.getAttribute, 'call', _546 => _546("treatAsChar")]) === "1";
30042
30363
  const om = inline && cn === "tbl" ? findChildByLocalName(ch, "outMargin") : null;
30043
30364
  objs.push({
30044
30365
  el: ch,
@@ -30298,15 +30619,15 @@ function drawShape(o, x, y, ctx, depth) {
30298
30619
  const sx = ow > 0 ? w / ow : 1;
30299
30620
  const sy = oh > 0 ? h / oh : 1;
30300
30621
  const lineShape = findChildByLocalName(el, "lineShape");
30301
- const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _536 => _536.getAttribute, 'call', _537 => _537("style")]), () => ( "SOLID"));
30302
- const strokeCol = _optionalChain([lineShape, 'optionalAccess', _538 => _538.getAttribute, 'call', _539 => _539("color")]) || "#000000";
30622
+ const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _547 => _547.getAttribute, 'call', _548 => _548("style")]), () => ( "SOLID"));
30623
+ const strokeCol = _optionalChain([lineShape, 'optionalAccess', _549 => _549.getAttribute, 'call', _550 => _550("color")]) || "#000000";
30303
30624
  const hasStroke = lstyle !== "NONE";
30304
30625
  const strokeW = hasStroke ? shapeStrokePt(lineShape ? num3(lineShape, "width") : 33) : 0;
30305
30626
  const dash = /DASH|DOT/.test(lstyle) ? ` stroke-dasharray="${lstyle.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
30306
30627
  const strokeAttr = hasStroke ? ` stroke="${escapeXml3(strokeCol)}" stroke-width="${strokeW.toFixed(2)}"${dash}` : "";
30307
30628
  const fillBrush = findChildByLocalName(el, "fillBrush");
30308
30629
  const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
30309
- const face = _optionalChain([winBrush, 'optionalAccess', _540 => _540.getAttribute, 'call', _541 => _541("faceColor")]);
30630
+ const face = _optionalChain([winBrush, 'optionalAccess', _551 => _551.getAttribute, 'call', _552 => _552("faceColor")]);
30310
30631
  const fill = face && face.toLowerCase() !== "none" ? face : "none";
30311
30632
  const fillAttr = ` fill="${fill === "none" ? "none" : escapeXml3(fill)}"`;
30312
30633
  if (o.tag === "rect") {
@@ -30333,14 +30654,14 @@ function drawShape(o, x, y, ctx, depth) {
30333
30654
  }
30334
30655
  function cellContentExtent(cell2, memo) {
30335
30656
  if (!cell2.sub) return 0;
30336
- const hit = _optionalChain([memo, 'optionalAccess', _542 => _542.cell, 'access', _543 => _543.get, 'call', _544 => _544(cell2.el)]);
30657
+ const hit = _optionalChain([memo, 'optionalAccess', _553 => _553.cell, 'access', _554 => _554.get, 'call', _555 => _555(cell2.el)]);
30337
30658
  if (hit !== void 0) return hit;
30338
30659
  let ext = 0;
30339
30660
  for (const p of elements2(cell2.sub)) {
30340
30661
  if (ln2(p) !== "p") continue;
30341
30662
  const m = buildPara(p);
30342
30663
  for (const s of m.segs) ext = Math.max(ext, s.vertpos + s.textheight);
30343
- const baseV = _nullishCoalesce(_optionalChain([m, 'access', _545 => _545.segs, 'access', _546 => _546[0], 'optionalAccess', _547 => _547.vertpos]), () => ( 0));
30664
+ const baseV = _nullishCoalesce(_optionalChain([m, 'access', _556 => _556.segs, 'access', _557 => _557[0], 'optionalAccess', _558 => _558.vertpos]), () => ( 0));
30344
30665
  for (const o of m.objs) {
30345
30666
  if (o.inline) {
30346
30667
  const h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
@@ -30348,14 +30669,14 @@ function cellContentExtent(cell2, memo) {
30348
30669
  continue;
30349
30670
  }
30350
30671
  const pos = findChildByLocalName(o.el, "pos");
30351
- if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _548 => _548.getAttribute, 'call', _549 => _549("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
30672
+ if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _559 => _559.getAttribute, 'call', _560 => _560("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
30352
30673
  const om = findChildByLocalName(o.el, "outMargin");
30353
30674
  const pushed = baseV - (num3(om, "top") + o.height + num3(om, "bottom"));
30354
30675
  const anchor = pushed >= -100 ? pushed : baseV;
30355
30676
  ext = Math.max(ext, anchor + num3(om, "top") + num3(pos, "vertOffset") + o.height);
30356
30677
  }
30357
30678
  }
30358
- _optionalChain([memo, 'optionalAccess', _550 => _550.cell, 'access', _551 => _551.set, 'call', _552 => _552(cell2.el, ext)]);
30679
+ _optionalChain([memo, 'optionalAccess', _561 => _561.cell, 'access', _562 => _562.set, 'call', _563 => _563(cell2.el, ext)]);
30359
30680
  return ext;
30360
30681
  }
30361
30682
  function edgeLine(x1, y1, x2, y2, e) {
@@ -30397,7 +30718,7 @@ function collectCells(tbl2) {
30397
30718
  return cells;
30398
30719
  }
30399
30720
  function measureTableHeight(tbl2, memo) {
30400
- const hit = _optionalChain([memo, 'optionalAccess', _553 => _553.table, 'access', _554 => _554.get, 'call', _555 => _555(tbl2)]);
30721
+ const hit = _optionalChain([memo, 'optionalAccess', _564 => _564.table, 'access', _565 => _565.get, 'call', _566 => _566(tbl2)]);
30401
30722
  if (hit !== void 0) return hit;
30402
30723
  const cells = collectCells(tbl2);
30403
30724
  if (cells.length === 0 || cells.length > 4096) return 0;
@@ -30408,7 +30729,7 @@ function measureTableHeight(tbl2, memo) {
30408
30729
  );
30409
30730
  let sum = 0;
30410
30731
  for (const h of rowH) sum += h;
30411
- _optionalChain([memo, 'optionalAccess', _556 => _556.table, 'access', _557 => _557.set, 'call', _558 => _558(tbl2, sum)]);
30732
+ _optionalChain([memo, 'optionalAccess', _567 => _567.table, 'access', _568 => _568.set, 'call', _569 => _569(tbl2, sum)]);
30412
30733
  return sum;
30413
30734
  }
30414
30735
  function drawTable(tbl2, tx, ty, ctx, depth) {
@@ -30439,7 +30760,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
30439
30760
  }));
30440
30761
  for (const g of geom) {
30441
30762
  const bf = g.c.bfId != null ? ctx.styles.borderFill.get(g.c.bfId) : void 0;
30442
- if (_optionalChain([bf, 'optionalAccess', _559 => _559.fill])) emit(ctx, `<rect x="${pt(g.x)}" y="${pt(g.y)}" width="${pt(g.w)}" height="${pt(g.h)}" fill="${escapeXml3(bf.fill)}"/>`);
30763
+ if (_optionalChain([bf, 'optionalAccess', _570 => _570.fill])) emit(ctx, `<rect x="${pt(g.x)}" y="${pt(g.y)}" width="${pt(g.w)}" height="${pt(g.h)}" fill="${escapeXml3(bf.fill)}"/>`);
30443
30764
  }
30444
30765
  for (const g of geom) {
30445
30766
  const { c } = g;
@@ -30477,7 +30798,7 @@ function drawPic(pic, x, y, ctx) {
30477
30798
  const sz = findChildByLocalName(pic, "sz");
30478
30799
  const w = num3(sz, "width", 5669), h = num3(sz, "height", 5669);
30479
30800
  const img = findFirst(pic, "img");
30480
- const ref = _optionalChain([img, 'optionalAccess', _560 => _560.getAttribute, 'call', _561 => _561("binaryItemIDRef")]);
30801
+ const ref = _optionalChain([img, 'optionalAccess', _571 => _571.getAttribute, 'call', _572 => _572("binaryItemIDRef")]);
30481
30802
  const loaded = ref != null ? ctx.images.get(ref) : void 0;
30482
30803
  if (!loaded) {
30483
30804
  emit(ctx, `<rect x="${pt(x)}" y="${pt(y)}" width="${pt(w)}" height="${pt(h)}" fill="#eee" stroke="#c00" stroke-width="0.5"/>`);
@@ -30517,7 +30838,7 @@ function readSectionGeom(root) {
30517
30838
  const pagePr = findFirst(root, "pagePr");
30518
30839
  const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
30519
30840
  let PW = num3(pagePr, "width", 59528), PH = num3(pagePr, "height", 84188);
30520
- if (_optionalChain([pagePr, 'optionalAccess', _562 => _562.getAttribute, 'call', _563 => _563("landscape")]) === "NARROWLY" && PW < PH) {
30841
+ if (_optionalChain([pagePr, 'optionalAccess', _573 => _573.getAttribute, 'call', _574 => _574("landscape")]) === "NARROWLY" && PW < PH) {
30521
30842
  const t = PW;
30522
30843
  PW = PH;
30523
30844
  PH = t;
@@ -30575,17 +30896,17 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode) {
30575
30896
  return { pages: ctx.pages, pageH };
30576
30897
  }
30577
30898
  async function renderHwpxToSvg(input, options) {
30578
- const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _564 => _564.maxImageBytes]), () => ( 40 * 1024 * 1024));
30899
+ const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _575 => _575.maxImageBytes]), () => ( 40 * 1024 * 1024));
30579
30900
  const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
30580
- _chunkJFV7QT5Tcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
30901
+ _chunkH2KMJOB6cjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
30581
30902
  let zip;
30582
30903
  try {
30583
30904
  zip = await _jszip2.default.loadAsync(input);
30584
- } catch (e33) {
30585
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
30905
+ } catch (e36) {
30906
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
30586
30907
  }
30587
30908
  const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
30588
- if (secFiles.length === 0) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
30909
+ if (secFiles.length === 0) throw new (0, _chunkH2KMJOB6cjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
30589
30910
  const warnings = [];
30590
30911
  const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
30591
30912
  const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
@@ -30593,7 +30914,7 @@ async function renderHwpxToSvg(input, options) {
30593
30914
  const secXmls = [];
30594
30915
  for (const f of secFiles) {
30595
30916
  const xml = await f.async("string");
30596
- if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkJFV7QT5Tcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
30917
+ if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
30597
30918
  secXmls.push(xml);
30598
30919
  }
30599
30920
  const binmap = /* @__PURE__ */ new Map();
@@ -30617,7 +30938,7 @@ async function renderHwpxToSvg(input, options) {
30617
30938
  let href = binmap.get(ref);
30618
30939
  if (!href) {
30619
30940
  const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
30620
- href = _optionalChain([cand, 'optionalAccess', _565 => _565.name]);
30941
+ href = _optionalChain([cand, 'optionalAccess', _576 => _576.name]);
30621
30942
  }
30622
30943
  if (!href) continue;
30623
30944
  const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
@@ -30638,7 +30959,7 @@ async function renderHwpxToSvg(input, options) {
30638
30959
  styles,
30639
30960
  images,
30640
30961
  defs: [],
30641
- highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _566 => _566.highlights]), () => ( []))).map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0),
30962
+ highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _577 => _577.highlights]), () => ( []))).map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0),
30642
30963
  warnings,
30643
30964
  warned: /* @__PURE__ */ new Set(),
30644
30965
  stats: { texts: 0, images: 0, tables: 0 },
@@ -30649,7 +30970,7 @@ async function renderHwpxToSvg(input, options) {
30649
30970
  for (let si = 0; si < secXmls.length; si++) {
30650
30971
  const secXml = secXmls[si];
30651
30972
  const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
30652
- if (!hasCache && !_optionalChain([options, 'optionalAccess', _567 => _567.reflow])) {
30973
+ if (!hasCache && !_optionalChain([options, 'optionalAccess', _578 => _578.reflow])) {
30653
30974
  noCacheSkipped = true;
30654
30975
  warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
30655
30976
  continue;
@@ -30661,14 +30982,14 @@ async function renderHwpxToSvg(input, options) {
30661
30982
  continue;
30662
30983
  }
30663
30984
  const geom = readSectionGeom(root);
30664
- const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess', _568 => _568.reflow]), _nullishCoalesce(_optionalChain([options, 'optionalAccess', _569 => _569.reflowMode]), () => ( "keep")));
30985
+ const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess', _579 => _579.reflow]), _nullishCoalesce(_optionalChain([options, 'optionalAccess', _580 => _580.reflowMode]), () => ( "keep")));
30665
30986
  rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${si}` });
30666
30987
  }
30667
30988
  if (rendered.length === 0) {
30668
30989
  if (noCacheSkipped) {
30669
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("\uC870\uD310 \uCE90\uC2DC(linesegarray) \uC5C6\uC74C \u2014 \uD55C\uCEF4\uC5D0\uC11C \uC800\uC7A5\uD55C HWPX\uB9CC \uB80C\uB354 \uAC00\uB2A5 (reflow \uC635\uC158\uC73C\uB85C \uD569\uC131 \uB80C\uB354 \uAC00\uB2A5)");
30990
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uC870\uD310 \uCE90\uC2DC(linesegarray) \uC5C6\uC74C \u2014 \uD55C\uCEF4\uC5D0\uC11C \uC800\uC7A5\uD55C HWPX\uB9CC \uB80C\uB354 \uAC00\uB2A5 (reflow \uC635\uC158\uC73C\uB85C \uD569\uC131 \uB80C\uB354 \uAC00\uB2A5)");
30670
30991
  }
30671
- throw new (0, _chunkJFV7QT5Tcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
30992
+ throw new (0, _chunkH2KMJOB6cjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
30672
30993
  }
30673
30994
  const GAP = 2400;
30674
30995
  const clipDefs = [];
@@ -30700,17 +31021,17 @@ ${groups.join("\n")}
30700
31021
  // src/index.ts
30701
31022
  async function parse(input, options) {
30702
31023
  let buffer;
30703
- const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _570 => _570.filePath]) ? { ...options, filePath: input } : options;
31024
+ const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _581 => _581.filePath]) ? { ...options, filePath: input } : options;
30704
31025
  if (typeof input === "string") {
30705
31026
  try {
30706
31027
  const buf = await _promises.readFile.call(void 0, input);
30707
- buffer = _chunkJFV7QT5Tcjs.toArrayBuffer.call(void 0, buf);
31028
+ buffer = _chunkH2KMJOB6cjs.toArrayBuffer.call(void 0, buf);
30708
31029
  } catch (err) {
30709
31030
  const msg2 = err instanceof Error && "code" in err && err.code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`;
30710
31031
  return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
30711
31032
  }
30712
31033
  } else if (Buffer.isBuffer(input)) {
30713
- buffer = _chunkJFV7QT5Tcjs.toArrayBuffer.call(void 0, input);
31034
+ buffer = _chunkH2KMJOB6cjs.toArrayBuffer.call(void 0, input);
30714
31035
  } else {
30715
31036
  buffer = input;
30716
31037
  }
@@ -30744,40 +31065,40 @@ async function parse(input, options) {
30744
31065
  }
30745
31066
  async function parseImage(buffer, options) {
30746
31067
  try {
30747
- const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-XEJFXH6M.cjs")));
31068
+ const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-F2BQA26V.cjs")));
30748
31069
  const { blocks, warnings } = await parseImageDocument(buffer, options);
30749
31070
  return {
30750
31071
  success: true,
30751
31072
  fileType: "image",
30752
- markdown: _chunkAUOEZKJEcjs.blocksToMarkdown.call(void 0, blocks),
31073
+ markdown: _chunkUDGPM5R5cjs.blocksToMarkdown.call(void 0, blocks),
30753
31074
  blocks,
30754
31075
  warnings: warnings.length ? warnings : void 0,
30755
31076
  pageCount: 1
30756
31077
  };
30757
31078
  } catch (err) {
30758
- return { success: false, fileType: "image", error: _chunkJFV7QT5Tcjs.sanitizeError.call(void 0, err), code: _chunkJFV7QT5Tcjs.classifyError.call(void 0, err) };
31079
+ return { success: false, fileType: "image", error: _chunkH2KMJOB6cjs.sanitizeError.call(void 0, err), code: _chunkH2KMJOB6cjs.classifyError.call(void 0, err) };
30759
31080
  }
30760
31081
  }
30761
31082
  async function parseHwp3(buffer, options) {
30762
31083
  try {
30763
31084
  const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
30764
- return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _571 => _571.pageCount]) };
31085
+ return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _582 => _582.pageCount]) };
30765
31086
  } catch (err) {
30766
- return { success: false, fileType: "hwp3", error: _chunkJFV7QT5Tcjs.sanitizeError.call(void 0, err), code: _chunkJFV7QT5Tcjs.classifyError.call(void 0, err) };
31087
+ return { success: false, fileType: "hwp3", error: _chunkH2KMJOB6cjs.sanitizeError.call(void 0, err), code: _chunkH2KMJOB6cjs.classifyError.call(void 0, err) };
30767
31088
  }
30768
31089
  }
30769
31090
  async function parseHwpx(buffer, options) {
30770
31091
  try {
30771
31092
  const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
30772
- return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _572 => _572.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _573 => _573.pageCount]) };
31093
+ return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _583 => _583.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _584 => _584.pageCount]) };
30773
31094
  } catch (err) {
30774
- return { success: false, fileType: "hwpx", error: _chunkJFV7QT5Tcjs.sanitizeError.call(void 0, err), code: _chunkJFV7QT5Tcjs.classifyError.call(void 0, err) };
31095
+ return { success: false, fileType: "hwpx", error: _chunkH2KMJOB6cjs.sanitizeError.call(void 0, err), code: _chunkH2KMJOB6cjs.classifyError.call(void 0, err) };
30775
31096
  }
30776
31097
  }
30777
31098
  async function parseHwp(buffer, options) {
30778
31099
  try {
30779
31100
  const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
30780
- if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _574 => _574.filePath])) {
31101
+ if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _585 => _585.filePath])) {
30781
31102
  try {
30782
31103
  const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
30783
31104
  if (pages.some((p) => p && p.trim().length > 0)) {
@@ -30792,20 +31113,20 @@ async function parseHwp(buffer, options) {
30792
31113
  pageCount
30793
31114
  };
30794
31115
  }
30795
- } catch (e34) {
31116
+ } catch (e37) {
30796
31117
  }
30797
31118
  }
30798
- return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _575 => _575.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _576 => _576.pageCount]) };
31119
+ return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _586 => _586.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _587 => _587.pageCount]) };
30799
31120
  } catch (err) {
30800
- return { success: false, fileType: "hwp", error: _chunkJFV7QT5Tcjs.sanitizeError.call(void 0, err), code: _chunkJFV7QT5Tcjs.classifyError.call(void 0, err) };
31121
+ return { success: false, fileType: "hwp", error: _chunkH2KMJOB6cjs.sanitizeError.call(void 0, err), code: _chunkH2KMJOB6cjs.classifyError.call(void 0, err) };
30801
31122
  }
30802
31123
  }
30803
31124
  async function parsePdf(buffer, options) {
30804
31125
  let parsePdfDocument;
30805
31126
  try {
30806
- const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-W3ZGQUCQ.cjs")));
31127
+ const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-FFQN67O6.cjs")));
30807
31128
  parsePdfDocument = mod.parsePdfDocument;
30808
- } catch (e35) {
31129
+ } catch (e38) {
30809
31130
  return {
30810
31131
  success: false,
30811
31132
  fileType: "pdf",
@@ -30815,51 +31136,51 @@ async function parsePdf(buffer, options) {
30815
31136
  }
30816
31137
  try {
30817
31138
  const { markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images } = await parsePdfDocument(buffer, options);
30818
- return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pageCount: _optionalChain([metadata, 'optionalAccess', _577 => _577.pageCount]) };
31139
+ return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pageCount: _optionalChain([metadata, 'optionalAccess', _588 => _588.pageCount]) };
30819
31140
  } catch (err) {
30820
31141
  const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
30821
- return { success: false, fileType: "pdf", error: _chunkJFV7QT5Tcjs.sanitizeError.call(void 0, err), code: _chunkJFV7QT5Tcjs.classifyError.call(void 0, err), isImageBased };
31142
+ return { success: false, fileType: "pdf", error: _chunkH2KMJOB6cjs.sanitizeError.call(void 0, err), code: _chunkH2KMJOB6cjs.classifyError.call(void 0, err), isImageBased };
30822
31143
  }
30823
31144
  }
30824
31145
  async function parseXlsx(buffer, options) {
30825
31146
  try {
30826
31147
  const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
30827
- return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _578 => _578.pageCount]) };
31148
+ return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _589 => _589.pageCount]) };
30828
31149
  } catch (err) {
30829
- return { success: false, fileType: "xlsx", error: _chunkJFV7QT5Tcjs.sanitizeError.call(void 0, err), code: _chunkJFV7QT5Tcjs.classifyError.call(void 0, err) };
31150
+ return { success: false, fileType: "xlsx", error: _chunkH2KMJOB6cjs.sanitizeError.call(void 0, err), code: _chunkH2KMJOB6cjs.classifyError.call(void 0, err) };
30830
31151
  }
30831
31152
  }
30832
31153
  async function parseXls(buffer, options) {
30833
31154
  try {
30834
31155
  const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
30835
- return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _579 => _579.pageCount]) };
31156
+ return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _590 => _590.pageCount]) };
30836
31157
  } catch (err) {
30837
- return { success: false, fileType: "xls", error: _chunkJFV7QT5Tcjs.sanitizeError.call(void 0, err), code: _chunkJFV7QT5Tcjs.classifyError.call(void 0, err) };
31158
+ return { success: false, fileType: "xls", error: _chunkH2KMJOB6cjs.sanitizeError.call(void 0, err), code: _chunkH2KMJOB6cjs.classifyError.call(void 0, err) };
30838
31159
  }
30839
31160
  }
30840
31161
  async function parseDocx(buffer, options) {
30841
31162
  try {
30842
31163
  const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
30843
- return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _580 => _580.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _581 => _581.pageCount]) };
31164
+ return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _591 => _591.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _592 => _592.pageCount]) };
30844
31165
  } catch (err) {
30845
- return { success: false, fileType: "docx", error: _chunkJFV7QT5Tcjs.sanitizeError.call(void 0, err), code: _chunkJFV7QT5Tcjs.classifyError.call(void 0, err) };
31166
+ return { success: false, fileType: "docx", error: _chunkH2KMJOB6cjs.sanitizeError.call(void 0, err), code: _chunkH2KMJOB6cjs.classifyError.call(void 0, err) };
30846
31167
  }
30847
31168
  }
30848
31169
  async function parseHwpml(buffer, options) {
30849
31170
  try {
30850
31171
  const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
30851
- return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _582 => _582.pageCount]) };
31172
+ return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _593 => _593.pageCount]) };
30852
31173
  } catch (err) {
30853
- return { success: false, fileType: "hwpml", error: _chunkJFV7QT5Tcjs.sanitizeError.call(void 0, err), code: _chunkJFV7QT5Tcjs.classifyError.call(void 0, err) };
31174
+ return { success: false, fileType: "hwpml", error: _chunkH2KMJOB6cjs.sanitizeError.call(void 0, err), code: _chunkH2KMJOB6cjs.classifyError.call(void 0, err) };
30854
31175
  }
30855
31176
  }
30856
31177
  async function fillForm(input, values, outputFormat = "markdown") {
30857
31178
  let buffer;
30858
31179
  if (typeof input === "string") {
30859
31180
  const buf = await _promises.readFile.call(void 0, input);
30860
- buffer = _chunkJFV7QT5Tcjs.toArrayBuffer.call(void 0, buf);
31181
+ buffer = _chunkH2KMJOB6cjs.toArrayBuffer.call(void 0, buf);
30861
31182
  } else if (Buffer.isBuffer(input)) {
30862
- buffer = _chunkJFV7QT5Tcjs.toArrayBuffer.call(void 0, input);
31183
+ buffer = _chunkH2KMJOB6cjs.toArrayBuffer.call(void 0, input);
30863
31184
  } else {
30864
31185
  buffer = input;
30865
31186
  }
@@ -30885,7 +31206,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
30885
31206
  throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
30886
31207
  }
30887
31208
  const fill = fillFormFields(parsed.blocks, values);
30888
- const markdown = _chunkAUOEZKJEcjs.blocksToMarkdown.call(void 0, fill.blocks);
31209
+ const markdown = _chunkUDGPM5R5cjs.blocksToMarkdown.call(void 0, fill.blocks);
30889
31210
  if (outputFormat === "hwpx") {
30890
31211
  const hwpxBuffer = await markdownToHwpx(markdown);
30891
31212
  return { output: hwpxBuffer, format: "hwpx", fill };
@@ -30964,5 +31285,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
30964
31285
 
30965
31286
 
30966
31287
 
30967
- exports.BUILTIN_TEMPLATES = BUILTIN_TEMPLATES; exports.DEFAULT_REDACT_RULES = DEFAULT_REDACT_RULES; exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION = _chunkJFV7QT5Tcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkAUOEZKJEcjs.blocksToMarkdown; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; exports.compare = compare; exports.detectFormat = detectFormat; exports.detectOle2Format = detectOle2Format; exports.detectZipFormat = detectZipFormat; exports.diffBlocks = diffBlocks; exports.extractClickHereFields = extractClickHereFields; exports.extractFormFields = extractFormFields; exports.extractFormSchema = extractFormSchema; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintGongmunText = lintGongmunText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.readBuiltinTemplate = readBuiltinTemplate; exports.readBuiltinTemplateSample = readBuiltinTemplateSample; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.resolveBuiltinTemplate = resolveBuiltinTemplate; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.validateHwpx = validateHwpx;
31288
+ exports.BUILTIN_TEMPLATES = BUILTIN_TEMPLATES; exports.DEFAULT_REDACT_RULES = DEFAULT_REDACT_RULES; exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION = _chunkH2KMJOB6cjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkUDGPM5R5cjs.blocksToMarkdown; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; exports.compare = compare; exports.detectFormat = detectFormat; exports.detectOle2Format = detectOle2Format; exports.detectZipFormat = detectZipFormat; exports.diffBlocks = diffBlocks; exports.extractClickHereFields = extractClickHereFields; exports.extractFormFields = extractFormFields; exports.extractFormSchema = extractFormSchema; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintGongmunText = lintGongmunText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.readBuiltinTemplate = readBuiltinTemplate; exports.readBuiltinTemplateSample = readBuiltinTemplateSample; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.resolveBuiltinTemplate = resolveBuiltinTemplate; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.validateHwpx = validateHwpx;
30968
31289
  //# sourceMappingURL=index.cjs.map