kordoc 4.24.13 → 4.24.14
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.
- package/README.md +5 -5
- package/dist/{-NBCZTPBD.js → -MG25ST6Y.js} +11 -11
- package/dist/{chunk-UVQOPGOA.js → chunk-3LFNTOL7.js} +14 -9
- package/dist/chunk-3LFNTOL7.js.map +1 -0
- package/dist/{chunk-BC4LVU4D.js → chunk-7VNYQHJV.js} +2 -2
- package/dist/{chunk-CKOCIQU6.js → chunk-AM6TECXD.js} +2 -2
- package/dist/{chunk-X2E5QCKO.js → chunk-AULD3QAB.js} +2 -2
- package/dist/{chunk-XGESPSWE.cjs → chunk-BUGXM2H5.cjs} +3 -3
- package/dist/{chunk-XGESPSWE.cjs.map → chunk-BUGXM2H5.cjs.map} +1 -1
- package/dist/{chunk-ZUMOEVMV.js → chunk-DIFJPJGN.js} +3 -3
- package/dist/{chunk-XWWQGSEP.js → chunk-ERYRF3EA.js} +2 -2
- package/dist/{chunk-QAGPSWGH.js → chunk-FGERVDQZ.js} +2 -2
- package/dist/{chunk-ZSCDH3NU.js → chunk-FUC3V2FR.js} +2 -2
- package/dist/{chunk-U2VAABMK.cjs → chunk-GV7ECKOK.cjs} +44 -27
- package/dist/chunk-GV7ECKOK.cjs.map +1 -0
- package/dist/{chunk-2H2VYPM2.cjs → chunk-HVILFVAT.cjs} +2 -2
- package/dist/{chunk-2H2VYPM2.cjs.map → chunk-HVILFVAT.cjs.map} +1 -1
- package/dist/{chunk-OVQWOOS3.js → chunk-J3OJWUON.js} +2 -2
- package/dist/{chunk-QVEAR6IR.js → chunk-LMQT2JFS.js} +22 -5
- package/dist/chunk-LMQT2JFS.js.map +1 -0
- package/dist/{chunk-37MTSMUF.js → chunk-LSFVBS2I.js} +2 -2
- package/dist/{chunk-IQGXY63Y.js → chunk-MACV3MZF.js} +23 -6
- package/dist/chunk-MACV3MZF.js.map +1 -0
- package/dist/{chunk-QW2H2HHS.js → chunk-MIJYCKJA.js} +115 -6
- package/dist/chunk-MIJYCKJA.js.map +1 -0
- package/dist/{chunk-DMPX4KLC.js → chunk-NIPFEMJJ.js} +2 -2
- package/dist/{chunk-WOVJRXIA.js → chunk-NVD24SLL.js} +2 -2
- package/dist/{chunk-A232MW5F.js → chunk-PVAJ4DBW.js} +2 -2
- package/dist/{chunk-BJBPBU5B.js → chunk-SSDHVKLM.js} +2 -2
- package/dist/{chunk-4I2CKMKU.js → chunk-TPZPICDM.js} +3 -3
- package/dist/{chunk-KTXDK5A6.js → chunk-UTLHDVC5.js} +2 -2
- package/dist/{chunk-PUHBCAXI.js → chunk-UUNCLJB7.js} +11 -11
- package/dist/{chunk-W52B6GOE.cjs → chunk-V26UPU2L.cjs} +3 -3
- package/dist/{chunk-W52B6GOE.cjs.map → chunk-V26UPU2L.cjs.map} +1 -1
- package/dist/{chunk-A4CYMI55.js → chunk-VBOFP27O.js} +2 -2
- package/dist/{chunk-FJ3IKKDV.js → chunk-WFOPOJHN.js} +115 -6
- package/dist/chunk-WFOPOJHN.js.map +1 -0
- package/dist/{chunk-VPKZB6Y7.cjs → chunk-ZBHS7KLW.cjs} +6 -6
- package/dist/{chunk-VPKZB6Y7.cjs.map → chunk-ZBHS7KLW.cjs.map} +1 -1
- package/dist/{chunk-WAWREGAC.js → chunk-ZIGWQ3IS.js} +2 -2
- package/dist/{chunk-QZ2H4ZTO.cjs → chunk-ZX66BXB5.cjs} +190 -81
- package/dist/chunk-ZX66BXB5.cjs.map +1 -0
- package/dist/chunks-JGSWNVLF.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-M4FM364X.js → formula-4KFXQSEG.js} +4 -4
- package/dist/{formula-ZKZGV6JV.cjs → formula-N6GWFPHK.cjs} +9 -9
- package/dist/{formula-ZKZGV6JV.cjs.map → formula-N6GWFPHK.cjs.map} +1 -1
- package/dist/{formula-WFL6JRCR.js → formula-WAYIKS54.js} +3 -3
- package/dist/{image-ocr-2V3M3ZEA.cjs → image-ocr-GY7SZAHN.cjs} +17 -17
- package/dist/{image-ocr-2V3M3ZEA.cjs.map → image-ocr-GY7SZAHN.cjs.map} +1 -1
- package/dist/{image-ocr-YJISJPKE.js → image-ocr-P5S2QDKW.js} +6 -6
- package/dist/{image-ocr-47CBNIS5.js → image-ocr-QBCR7ZD6.js} +9 -9
- package/dist/index.cjs +368 -363
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -9
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +23 -23
- package/dist/{model-bundle-7W344HDI.js → model-bundle-QAM24SYG.js} +5 -5
- package/dist/{models-TBHMNI7M.js → models-YHC236MP.js} +5 -5
- package/dist/{parse-worker-v2-JUYUEXCY.js → parse-worker-v2-LP7NKQBP.js} +12 -12
- package/dist/{parser-EKQCZLML.js → parser-26YUZU55.js} +12 -12
- package/dist/{parser-RNJ4KSDF.js → parser-DFJZ3CCE.js} +9 -9
- package/dist/{parser-R44KTBZX.cjs → parser-JWU6HYZZ.cjs} +159 -159
- package/dist/{parser-R44KTBZX.cjs.map → parser-JWU6HYZZ.cjs.map} +1 -1
- package/dist/{pdf-ocr-EE5KGFVX.js → pdf-ocr-BO6ACAGL.js} +9 -9
- package/dist/{pdf-ocr-ZAF4P74R.js → pdf-ocr-EEWQFS7P.js} +6 -6
- package/dist/pdf-ocr-Z4PBLB75.cjs +35 -0
- package/dist/{pdf-ocr-74BOCXAT.cjs.map → pdf-ocr-Z4PBLB75.cjs.map} +1 -1
- package/dist/{profile-io-RU3RVIYV.js → profile-io-PQXYWUBL.js} +3 -3
- package/dist/{rasterize-UNCPM26D.js → rasterize-CS7WZUGF.js} +3 -3
- package/dist/{redact-doc-BFE4UZCY.js → redact-doc-PI4JNHV6.js} +11 -11
- package/dist/{render-3DXTLKIA.js → render-M2CIEOF4.js} +7 -7
- package/dist/seal-4755WLFB.js +10 -0
- package/dist/{setup-7POQAKDG.js → setup-HGPUR27M.js} +3 -3
- package/dist/visual-JWWGGTKQ.js +21 -0
- package/dist/{watch-37YCXJWW.js → watch-B5ISBY3N.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-FJ3IKKDV.js.map +0 -1
- package/dist/chunk-IQGXY63Y.js.map +0 -1
- package/dist/chunk-QVEAR6IR.js.map +0 -1
- package/dist/chunk-QW2H2HHS.js.map +0 -1
- package/dist/chunk-QZ2H4ZTO.cjs.map +0 -1
- package/dist/chunk-U2VAABMK.cjs.map +0 -1
- package/dist/chunk-UVQOPGOA.js.map +0 -1
- package/dist/chunks-IXFBIZPW.js +0 -10
- package/dist/pdf-ocr-74BOCXAT.cjs +0 -35
- package/dist/seal-3LBTETDG.js +0 -10
- package/dist/visual-7SVIGIJC.js +0 -21
- /package/dist/{-NBCZTPBD.js.map → -MG25ST6Y.js.map} +0 -0
- /package/dist/{chunk-BC4LVU4D.js.map → chunk-7VNYQHJV.js.map} +0 -0
- /package/dist/{chunk-CKOCIQU6.js.map → chunk-AM6TECXD.js.map} +0 -0
- /package/dist/{chunk-X2E5QCKO.js.map → chunk-AULD3QAB.js.map} +0 -0
- /package/dist/{chunk-ZUMOEVMV.js.map → chunk-DIFJPJGN.js.map} +0 -0
- /package/dist/{chunk-XWWQGSEP.js.map → chunk-ERYRF3EA.js.map} +0 -0
- /package/dist/{chunk-QAGPSWGH.js.map → chunk-FGERVDQZ.js.map} +0 -0
- /package/dist/{chunk-ZSCDH3NU.js.map → chunk-FUC3V2FR.js.map} +0 -0
- /package/dist/{chunk-OVQWOOS3.js.map → chunk-J3OJWUON.js.map} +0 -0
- /package/dist/{chunk-37MTSMUF.js.map → chunk-LSFVBS2I.js.map} +0 -0
- /package/dist/{chunk-DMPX4KLC.js.map → chunk-NIPFEMJJ.js.map} +0 -0
- /package/dist/{chunk-WOVJRXIA.js.map → chunk-NVD24SLL.js.map} +0 -0
- /package/dist/{chunk-A232MW5F.js.map → chunk-PVAJ4DBW.js.map} +0 -0
- /package/dist/{chunk-BJBPBU5B.js.map → chunk-SSDHVKLM.js.map} +0 -0
- /package/dist/{chunk-4I2CKMKU.js.map → chunk-TPZPICDM.js.map} +0 -0
- /package/dist/{chunk-KTXDK5A6.js.map → chunk-UTLHDVC5.js.map} +0 -0
- /package/dist/{chunk-PUHBCAXI.js.map → chunk-UUNCLJB7.js.map} +0 -0
- /package/dist/{chunk-A4CYMI55.js.map → chunk-VBOFP27O.js.map} +0 -0
- /package/dist/{chunk-WAWREGAC.js.map → chunk-ZIGWQ3IS.js.map} +0 -0
- /package/dist/{chunks-IXFBIZPW.js.map → chunks-JGSWNVLF.js.map} +0 -0
- /package/dist/{formula-M4FM364X.js.map → formula-4KFXQSEG.js.map} +0 -0
- /package/dist/{formula-WFL6JRCR.js.map → formula-WAYIKS54.js.map} +0 -0
- /package/dist/{image-ocr-YJISJPKE.js.map → image-ocr-P5S2QDKW.js.map} +0 -0
- /package/dist/{image-ocr-47CBNIS5.js.map → image-ocr-QBCR7ZD6.js.map} +0 -0
- /package/dist/{model-bundle-7W344HDI.js.map → model-bundle-QAM24SYG.js.map} +0 -0
- /package/dist/{models-TBHMNI7M.js.map → models-YHC236MP.js.map} +0 -0
- /package/dist/{parse-worker-v2-JUYUEXCY.js.map → parse-worker-v2-LP7NKQBP.js.map} +0 -0
- /package/dist/{parser-EKQCZLML.js.map → parser-26YUZU55.js.map} +0 -0
- /package/dist/{parser-RNJ4KSDF.js.map → parser-DFJZ3CCE.js.map} +0 -0
- /package/dist/{pdf-ocr-EE5KGFVX.js.map → pdf-ocr-BO6ACAGL.js.map} +0 -0
- /package/dist/{pdf-ocr-ZAF4P74R.js.map → pdf-ocr-EEWQFS7P.js.map} +0 -0
- /package/dist/{profile-io-RU3RVIYV.js.map → profile-io-PQXYWUBL.js.map} +0 -0
- /package/dist/{rasterize-UNCPM26D.js.map → rasterize-CS7WZUGF.js.map} +0 -0
- /package/dist/{redact-doc-BFE4UZCY.js.map → redact-doc-PI4JNHV6.js.map} +0 -0
- /package/dist/{render-3DXTLKIA.js.map → render-M2CIEOF4.js.map} +0 -0
- /package/dist/{seal-3LBTETDG.js.map → seal-4755WLFB.js.map} +0 -0
- /package/dist/{setup-7POQAKDG.js.map → setup-HGPUR27M.js.map} +0 -0
- /package/dist/{visual-7SVIGIJC.js.map → visual-JWWGGTKQ.js.map} +0 -0
- /package/dist/{watch-37YCXJWW.js.map → watch-B5ISBY3N.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkV26UPU2Lcjs = require('./chunk-V26UPU2L.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
@@ -44,7 +44,7 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
var
|
|
47
|
+
var _chunkZBHS7KLWcjs = require('./chunk-ZBHS7KLW.cjs');
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
@@ -62,14 +62,14 @@ var _chunkVPKZB6Y7cjs = require('./chunk-VPKZB6Y7.cjs');
|
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
var
|
|
65
|
+
var _chunkHVILFVATcjs = require('./chunk-HVILFVAT.cjs');
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
69
69
|
|
|
70
70
|
// src/plain-markdown.ts
|
|
71
71
|
function toPlainMarkdown(md2) {
|
|
72
|
-
return
|
|
72
|
+
return _chunkZBHS7KLWcjs.plainScripts.call(void 0, md2).replace(/!\[[^\]\n]*\]\([^)\n]*\)/g, "").replace(/<img\b[^>]*>/gi, "").replace(/(?<!!)\[([^\]\n]*)\]\((?:https?|mailto|ftp):[^)\s]*\)/g, "$1").replace(/(?<!\\)<\/?u>/g, "").replace(/(?<!\\)\*\*(?=\S)([^\n]*?\S)(?<!\\)\*\*/g, "$1").replace(/(<br>)+(?=<\/t[dh]>)/g, "").replace(/[ \t]+$/gm, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
// src/html-tables.ts
|
|
@@ -603,9 +603,9 @@ function rawTextContent(node, depth = 0) {
|
|
|
603
603
|
}
|
|
604
604
|
|
|
605
605
|
// src/hwpx/parser-shared.ts
|
|
606
|
-
var MAX_DECOMPRESS_SIZE =
|
|
606
|
+
var MAX_DECOMPRESS_SIZE = _chunkHVILFVATcjs.unzipLimitBytes.call(void 0, 256 * 1024 * 1024);
|
|
607
607
|
var MAX_ZIP_ENTRIES = 500;
|
|
608
|
-
var ZipBombError = class extends
|
|
608
|
+
var ZipBombError = class extends _chunkHVILFVATcjs.KordocError {
|
|
609
609
|
constructor(message) {
|
|
610
610
|
super(message);
|
|
611
611
|
this.name = "ZipBombError";
|
|
@@ -655,7 +655,7 @@ function createSectionShared() {
|
|
|
655
655
|
function createXmlParser(warnings) {
|
|
656
656
|
return new (0, _xmldom.DOMParser)({
|
|
657
657
|
onError(level, msg2) {
|
|
658
|
-
if (level === "fatalError") throw new (0,
|
|
658
|
+
if (level === "fatalError") throw new (0, _chunkHVILFVATcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
659
659
|
_optionalChain([warnings, 'optionalAccess', _5 => _5.push, 'call', _6 => _6({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
660
660
|
}
|
|
661
661
|
});
|
|
@@ -690,13 +690,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
690
690
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
691
691
|
const checksumType = attrOf(inner, "checksum-type");
|
|
692
692
|
if (algorithm !== AES256_CBC) {
|
|
693
|
-
throw new (0,
|
|
693
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
694
694
|
}
|
|
695
695
|
if (startKey !== START_KEY_SHA256) {
|
|
696
|
-
throw new (0,
|
|
696
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
697
697
|
}
|
|
698
698
|
if (!_optionalChain([checksumType, 'optionalAccess', _10 => _10.endsWith, 'call', _11 => _11(CHECKSUM_SHA256_1K)])) {
|
|
699
|
-
throw new (0,
|
|
699
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
700
700
|
}
|
|
701
701
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
702
702
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -704,10 +704,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
704
704
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
705
705
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
706
706
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
707
|
-
throw new (0,
|
|
707
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
708
708
|
}
|
|
709
709
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
710
|
-
throw new (0,
|
|
710
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
711
711
|
}
|
|
712
712
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
713
713
|
}
|
|
@@ -741,12 +741,12 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
741
741
|
for (const entry of entries) {
|
|
742
742
|
const file = zip.file(entry.path);
|
|
743
743
|
if (!file) {
|
|
744
|
-
throw new (0,
|
|
744
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
745
745
|
}
|
|
746
746
|
const raw = await readZipEntry(file, "uint8array", used);
|
|
747
747
|
const plain4 = decryptEntry(Buffer.from(raw.buffer, raw.byteOffset, raw.length), entry, startKey);
|
|
748
748
|
if (!plain4) {
|
|
749
|
-
throw new (0,
|
|
749
|
+
throw new (0, _chunkHVILFVATcjs.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.");
|
|
750
750
|
}
|
|
751
751
|
used += plain4.length;
|
|
752
752
|
if (used > MAX_DECOMPRESS_SIZE) throw new ZipBombError("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
@@ -815,10 +815,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
815
815
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _12 => _12.total]));
|
|
816
816
|
if (decompressed) {
|
|
817
817
|
decompressed.total += xml.length * 2;
|
|
818
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
818
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkHVILFVATcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
819
819
|
}
|
|
820
820
|
const parser = createXmlParser();
|
|
821
|
-
const doc = parser.parseFromString(
|
|
821
|
+
const doc = parser.parseFromString(_chunkHVILFVATcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
822
822
|
if (!doc.documentElement) continue;
|
|
823
823
|
const domDoc = doc;
|
|
824
824
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -1031,9 +1031,9 @@ function detectHwpxHeadings(blocks, styleMap, tocTexts) {
|
|
|
1031
1031
|
let level = 0;
|
|
1032
1032
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _21 => _21.style, 'optionalAccess', _22 => _22.fontSize])) {
|
|
1033
1033
|
const ratio = block.style.fontSize / baseFontSize;
|
|
1034
|
-
if (ratio >=
|
|
1035
|
-
else if (ratio >=
|
|
1036
|
-
else if (ratio >=
|
|
1034
|
+
if (ratio >= _chunkZBHS7KLWcjs.HEADING_RATIO_H1) level = 1;
|
|
1035
|
+
else if (ratio >= _chunkZBHS7KLWcjs.HEADING_RATIO_H2) level = 2;
|
|
1036
|
+
else if (ratio >= _chunkZBHS7KLWcjs.HEADING_RATIO_H3) level = 3;
|
|
1037
1037
|
}
|
|
1038
1038
|
const compactText = text.replace(/\s+/g, "");
|
|
1039
1039
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1647,11 +1647,11 @@ function formatHeadNumber(n, numFormat) {
|
|
|
1647
1647
|
// 서수 시퀀스는 생성기(gongmun.ts)와 단일 소스 (v4.0.5) — 종전 mod-14 순환은
|
|
1648
1648
|
// 15번째 형제를 다시 '가'로 만들어 한글 실렌더(가→하→거→너 단모음 연속)와 어긋났다
|
|
1649
1649
|
case "CIRCLED_DIGIT":
|
|
1650
|
-
return n <= 50 ?
|
|
1650
|
+
return n <= 50 ? _chunkZBHS7KLWcjs.circledNumber.call(void 0, n - 1) : `(${n})`;
|
|
1651
1651
|
case "HANGUL_SYLLABLE":
|
|
1652
|
-
return
|
|
1652
|
+
return _chunkZBHS7KLWcjs.hangulOrdinal.call(void 0, n - 1);
|
|
1653
1653
|
case "CIRCLED_HANGUL_SYLLABLE":
|
|
1654
|
-
return n <= 14 ?
|
|
1654
|
+
return n <= 14 ? _chunkZBHS7KLWcjs.circledHangul.call(void 0, n - 1) : _chunkZBHS7KLWcjs.hangulOrdinal.call(void 0, n - 1);
|
|
1655
1655
|
case "HANGUL_JAMO":
|
|
1656
1656
|
return HANGUL_JAMO_SEQ[(n - 1) % HANGUL_JAMO_SEQ.length];
|
|
1657
1657
|
case "CIRCLED_HANGUL_JAMO":
|
|
@@ -1665,9 +1665,9 @@ function formatHeadNumber(n, numFormat) {
|
|
|
1665
1665
|
case "CIRCLED_LATIN_SMALL":
|
|
1666
1666
|
return n <= 26 ? String.fromCodePoint(9424 + n - 1) : String.fromCharCode(97 + (n - 1) % 26);
|
|
1667
1667
|
case "ROMAN_CAPITAL":
|
|
1668
|
-
return
|
|
1668
|
+
return _chunkZBHS7KLWcjs.romanNumeral.call(void 0, n, true);
|
|
1669
1669
|
case "ROMAN_SMALL":
|
|
1670
|
-
return
|
|
1670
|
+
return _chunkZBHS7KLWcjs.romanNumeral.call(void 0, n, false);
|
|
1671
1671
|
default:
|
|
1672
1672
|
return String(n);
|
|
1673
1673
|
}
|
|
@@ -1715,7 +1715,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1715
1715
|
|
|
1716
1716
|
// src/hwpx/table-build.ts
|
|
1717
1717
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1718
|
-
const table2 =
|
|
1718
|
+
const table2 = _chunkZBHS7KLWcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1719
1719
|
if (state.caption) table2.caption = state.caption;
|
|
1720
1720
|
if (state.caption && state.captionBelow) table2.captionBelow = true;
|
|
1721
1721
|
if (state.sourceId) table2.sourceId = state.sourceId;
|
|
@@ -1745,7 +1745,7 @@ function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraph
|
|
|
1745
1745
|
for (const src of row) {
|
|
1746
1746
|
if (!src.edges || src.rowAddr === void 0 || src.colAddr === void 0) continue;
|
|
1747
1747
|
const cand = _optionalChain([table2, 'access', _37 => _37.cells, 'access', _38 => _38[src.rowAddr], 'optionalAccess', _39 => _39[src.colAddr]]);
|
|
1748
|
-
if (cand && anchors2.includes(cand))
|
|
1748
|
+
if (cand && anchors2.includes(cand)) _chunkZBHS7KLWcjs.CELL_EDGES.set(cand, src.edges);
|
|
1749
1749
|
}
|
|
1750
1750
|
}
|
|
1751
1751
|
const claimed = /* @__PURE__ */ new Set();
|
|
@@ -1795,8 +1795,8 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1795
1795
|
const cell2 = parentTable.cell;
|
|
1796
1796
|
(cell2.blocks ??= []).push(block);
|
|
1797
1797
|
cell2.hasStructure = true;
|
|
1798
|
-
let flat =
|
|
1799
|
-
if (newTable.caption) flat =
|
|
1798
|
+
let flat = _chunkZBHS7KLWcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1799
|
+
if (newTable.caption) flat = _chunkZBHS7KLWcjs.captionedText.call(void 0, flat, newTable.caption, newTable.captionBelow);
|
|
1800
1800
|
if (flat) {
|
|
1801
1801
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
1802
1802
|
cell2.text += (cell2.text ? inlineJoin ? " " : "\n" : "") + flat;
|
|
@@ -2029,7 +2029,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2029
2029
|
const tkids = rc.childNodes;
|
|
2030
2030
|
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _47 => _47.length]), () => ( 0))); k++) {
|
|
2031
2031
|
const tk = tkids[k];
|
|
2032
|
-
if (tk.nodeType === 3 || tk.nodeType === 4) text +=
|
|
2032
|
+
if (tk.nodeType === 3 || tk.nodeType === 4) text += _chunkZBHS7KLWcjs.escapeLiteralTags.call(void 0, _chunkZBHS7KLWcjs.escapeLiteralDollar.call(void 0, tk.textContent || ""));
|
|
2033
2033
|
else if (tk.nodeType === 1) {
|
|
2034
2034
|
const ttag = (tk.tagName || tk.localName || "").replace(/^[^:]+:/, "");
|
|
2035
2035
|
if (ttag === "tab" || ttag === "fwSpace" || ttag === "hwSpace" || ttag === "nbSpace") text += " ";
|
|
@@ -2049,7 +2049,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2049
2049
|
const span2 = { text };
|
|
2050
2050
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span2.code = true;
|
|
2051
2051
|
else {
|
|
2052
|
-
if (_optionalChain([cp, 'optionalAccess', _48 => _48.script])) span2.text =
|
|
2052
|
+
if (_optionalChain([cp, 'optionalAccess', _48 => _48.script])) span2.text = _chunkZBHS7KLWcjs.wrapScript.call(void 0, text, cp.script);
|
|
2053
2053
|
if (_optionalChain([cp, 'optionalAccess', _49 => _49.bold])) span2.bold = true;
|
|
2054
2054
|
if (_optionalChain([cp, 'optionalAccess', _50 => _50.italic])) span2.italic = true;
|
|
2055
2055
|
if (_optionalChain([cp, 'optionalAccess', _51 => _51.strike])) span2.strike = true;
|
|
@@ -2069,7 +2069,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2069
2069
|
}
|
|
2070
2070
|
}
|
|
2071
2071
|
if (requireMixed && !merged.some((s) => s.strike || s.underline) && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
|
|
2072
|
-
for (const s of merged) s.text =
|
|
2072
|
+
for (const s of merged) s.text = _chunkZBHS7KLWcjs.tidyScriptTags.call(void 0, s.text);
|
|
2073
2073
|
return merged;
|
|
2074
2074
|
}
|
|
2075
2075
|
function gongmunDepthFromIndent(para2, left, ctx) {
|
|
@@ -2096,7 +2096,7 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2096
2096
|
// src/hwpx/section-walker.ts
|
|
2097
2097
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
2098
2098
|
const parser = createXmlParser(warnings);
|
|
2099
|
-
const doc = parser.parseFromString(
|
|
2099
|
+
const doc = parser.parseFromString(_chunkHVILFVATcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
2100
2100
|
if (!doc.documentElement) return [];
|
|
2101
2101
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
2102
2102
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -2198,8 +2198,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2198
2198
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
2199
2199
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
2200
2200
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
2201
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
2202
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
2201
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunkZBHS7KLWcjs.MAX_COLS);
|
|
2202
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkZBHS7KLWcjs.MAX_ROWS);
|
|
2203
2203
|
}
|
|
2204
2204
|
break;
|
|
2205
2205
|
case "p": {
|
|
@@ -2522,8 +2522,8 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
2522
2522
|
const sink = [];
|
|
2523
2523
|
const st = { rows: [], currentRow: [], cell: null, sourceId: _nullishCoalesce(el.getAttribute("id"), () => ( void 0)) };
|
|
2524
2524
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2525
|
-
let flat =
|
|
2526
|
-
if (st.caption) flat =
|
|
2525
|
+
let flat = _chunkZBHS7KLWcjs.convertTableToText.call(void 0, st.rows);
|
|
2526
|
+
if (st.caption) flat = _chunkZBHS7KLWcjs.captionedText.call(void 0, flat, st.caption, st.captionBelow);
|
|
2527
2527
|
const built = [];
|
|
2528
2528
|
completeTable(st, [], built, ctx);
|
|
2529
2529
|
return { text: flat, block: _nullishCoalesce(built.find((b) => b.type === "table"), () => ( null)) };
|
|
@@ -2687,7 +2687,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2687
2687
|
let url = (ch.textContent || "").trim();
|
|
2688
2688
|
if (!url) continue;
|
|
2689
2689
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2690
|
-
const safe =
|
|
2690
|
+
const safe = _chunkHVILFVATcjs.sanitizeHref.call(void 0, url);
|
|
2691
2691
|
if (safe) return safe;
|
|
2692
2692
|
}
|
|
2693
2693
|
return void 0;
|
|
@@ -2844,7 +2844,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2844
2844
|
_optionalChain([ctx, 'access', _112 => _112.warnings, 'optionalAccess', _113 => _113.push, 'call', _114 => _114({ page: ctx.page, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
|
|
2845
2845
|
}
|
|
2846
2846
|
} else {
|
|
2847
|
-
text +=
|
|
2847
|
+
text += _chunkZBHS7KLWcjs.escapeLiteralTags.call(void 0, _chunkZBHS7KLWcjs.escapeLiteralDollar.call(void 0, t.replace(/\x1E/g, "")));
|
|
2848
2848
|
}
|
|
2849
2849
|
continue;
|
|
2850
2850
|
}
|
|
@@ -2889,7 +2889,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2889
2889
|
break;
|
|
2890
2890
|
// 글자 겹치기 — 겹친 글은 composeText 속성에 있어 종전엔 통째로 빠졌다(법령 서식 원 번호 ⑯·⑰, 시험지 네모 번호 10)
|
|
2891
2891
|
case "compose":
|
|
2892
|
-
if (!isInDeletedRange(ctx)) text +=
|
|
2892
|
+
if (!isInDeletedRange(ctx)) text += _chunkZBHS7KLWcjs.escapeLiteralTags.call(void 0, _chunkZBHS7KLWcjs.escapeLiteralDollar.call(void 0, _chunkZBHS7KLWcjs.composeText.call(void 0, _nullishCoalesce(child.getAttribute("composeText"), () => ( "")), (_nullishCoalesce(child.getAttribute("circleType"), () => ( "CHAR"))) !== "CHAR")));
|
|
2893
2893
|
break;
|
|
2894
2894
|
// 양식 선택 상자·라디오 단추 — 한컴이 그리는 상자 기호와 캡션 글 (종전엔 통째로 빠졌다: form-002 "원천기술형"·서울 결재 "부분공개")
|
|
2895
2895
|
// 지운 구간의 양식 단추·수식은 글처럼 내지 않는다 (최종본)
|
|
@@ -2901,7 +2901,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2901
2901
|
case "hyperlink": {
|
|
2902
2902
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2903
2903
|
if (url) {
|
|
2904
|
-
const safe =
|
|
2904
|
+
const safe = _chunkHVILFVATcjs.sanitizeHref.call(void 0, url);
|
|
2905
2905
|
if (safe) href = safe;
|
|
2906
2906
|
}
|
|
2907
2907
|
walk(child, depth + 1);
|
|
@@ -2995,7 +2995,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2995
2995
|
walk(child, depth + 1);
|
|
2996
2996
|
if (script && linkRanges.length === nLinks && openFields.length === nOpen && runHasOnlyText(child)) {
|
|
2997
2997
|
const added = text.slice(start);
|
|
2998
|
-
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) +
|
|
2998
|
+
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) + _chunkZBHS7KLWcjs.wrapScript.call(void 0, added, script);
|
|
2999
2999
|
}
|
|
3000
3000
|
break;
|
|
3001
3001
|
}
|
|
@@ -3018,7 +3018,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
3018
3018
|
}
|
|
3019
3019
|
if (applied.length) href = void 0;
|
|
3020
3020
|
}
|
|
3021
|
-
text =
|
|
3021
|
+
text = _chunkZBHS7KLWcjs.tidyScriptTags.call(void 0, text);
|
|
3022
3022
|
const toc = takeTocLeaders(text);
|
|
3023
3023
|
text = toc.text;
|
|
3024
3024
|
const tocEntry = toc.tocEntry;
|
|
@@ -3133,7 +3133,7 @@ function decompressStream(data) {
|
|
|
3133
3133
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
3134
3134
|
}
|
|
3135
3135
|
function parseFileHeader(data) {
|
|
3136
|
-
if (data.length < 40) throw new (0,
|
|
3136
|
+
if (data.length < 40) throw new (0, _chunkHVILFVATcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
3137
3137
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
3138
3138
|
return {
|
|
3139
3139
|
signature: sig,
|
|
@@ -3660,13 +3660,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3660
3660
|
}
|
|
3661
3661
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3662
3662
|
for (const path of allCandidates) {
|
|
3663
|
-
if (
|
|
3663
|
+
if (_chunkHVILFVATcjs.isPathTraversal.call(void 0, path)) continue;
|
|
3664
3664
|
const file = zip.file(path);
|
|
3665
3665
|
if (!file) continue;
|
|
3666
3666
|
try {
|
|
3667
3667
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3668
3668
|
decompressed.total += data.length;
|
|
3669
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3669
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkHVILFVATcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3670
3670
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3671
3671
|
const extMime = imageExtToMime(ext);
|
|
3672
3672
|
const mimeType = extMime === "image/svg+xml" && /<script|\son[a-z]+\s*=|javascript:|<foreignObject/i.test(Buffer.from(data).toString("utf8")) ? "application/octet-stream" : extMime;
|
|
@@ -3677,7 +3677,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3677
3677
|
usedPaths.add(path);
|
|
3678
3678
|
break;
|
|
3679
3679
|
} catch (err) {
|
|
3680
|
-
if (err instanceof
|
|
3680
|
+
if (err instanceof _chunkHVILFVATcjs.KordocError) throw err;
|
|
3681
3681
|
}
|
|
3682
3682
|
}
|
|
3683
3683
|
if (!img) _optionalChain([warnings, 'optionalAccess', _128 => _128.push, 'call', _129 => _129({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
@@ -3697,13 +3697,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3697
3697
|
if (sweepUnreferenced) {
|
|
3698
3698
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3699
3699
|
for (const file of binEntries) {
|
|
3700
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3700
|
+
if (file.dir || usedPaths.has(file.name) || _chunkHVILFVATcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3701
3701
|
const basename = file.name.slice(file.name.lastIndexOf("/") + 1);
|
|
3702
3702
|
if (_optionalChain([deletedRefs, 'optionalAccess', _130 => _130.has, 'call', _131 => _131(file.name)]) || _optionalChain([deletedRefs, 'optionalAccess', _132 => _132.has, 'call', _133 => _133(basename)]) || _optionalChain([deletedRefs, 'optionalAccess', _134 => _134.has, 'call', _135 => _135(file.name.replace(/\.[^/.]+$/, ""))]) || _optionalChain([deletedRefs, 'optionalAccess', _136 => _136.has, 'call', _137 => _137(basename.replace(/\.[^.]+$/, ""))])) continue;
|
|
3703
3703
|
try {
|
|
3704
3704
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3705
3705
|
decompressed.total += data.length;
|
|
3706
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3706
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkHVILFVATcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3707
3707
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3708
3708
|
let mimeType = imageExtToMime(ext);
|
|
3709
3709
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3717,7 +3717,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3717
3717
|
images.push(img);
|
|
3718
3718
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3719
3719
|
} catch (err) {
|
|
3720
|
-
if (err instanceof
|
|
3720
|
+
if (err instanceof _chunkHVILFVATcjs.KordocError) throw err;
|
|
3721
3721
|
_optionalChain([warnings, 'optionalAccess', _138 => _138.push, 'call', _139 => _139({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3722
3722
|
}
|
|
3723
3723
|
}
|
|
@@ -3768,7 +3768,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3768
3768
|
}
|
|
3769
3769
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3770
3770
|
const name = new TextDecoder().decode(nameBytes);
|
|
3771
|
-
if (
|
|
3771
|
+
if (_chunkHVILFVATcjs.isPathTraversal.call(void 0, name)) {
|
|
3772
3772
|
pos = fileStart + compSize;
|
|
3773
3773
|
continue;
|
|
3774
3774
|
}
|
|
@@ -3786,7 +3786,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3786
3786
|
continue;
|
|
3787
3787
|
}
|
|
3788
3788
|
totalDecompressed += content.length * 2;
|
|
3789
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3789
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkHVILFVATcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3790
3790
|
sectionNum++;
|
|
3791
3791
|
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3792
3792
|
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
@@ -3795,9 +3795,9 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3795
3795
|
continue;
|
|
3796
3796
|
}
|
|
3797
3797
|
}
|
|
3798
|
-
if (blocks.length === 0) throw new (0,
|
|
3798
|
+
if (blocks.length === 0) throw new (0, _chunkHVILFVATcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3799
3799
|
applyPageText(blocks, shared);
|
|
3800
|
-
const markdown =
|
|
3800
|
+
const markdown = _chunkZBHS7KLWcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _140 => _140.tableFormat]) });
|
|
3801
3801
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3802
3802
|
}
|
|
3803
3803
|
async function readKordocLayout(zip) {
|
|
@@ -3822,11 +3822,11 @@ async function resolveSectionPaths(zip) {
|
|
|
3822
3822
|
if (paths.length > 0) return paths;
|
|
3823
3823
|
}
|
|
3824
3824
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3825
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3825
|
+
return sectionFiles.map((f) => f.name).sort(_chunkHVILFVATcjs.compareSectionPaths);
|
|
3826
3826
|
}
|
|
3827
3827
|
function parseSectionPathsFromManifest(xml) {
|
|
3828
3828
|
const parser = createXmlParser();
|
|
3829
|
-
const doc = parser.parseFromString(
|
|
3829
|
+
const doc = parser.parseFromString(_chunkHVILFVATcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3830
3830
|
const opf = "http://www.idpf.org/2007/opf/";
|
|
3831
3831
|
const namespacedItems = doc.getElementsByTagNameNS(opf, "item");
|
|
3832
3832
|
const namespacedSpine = doc.getElementsByTagNameNS(opf, "itemref");
|
|
@@ -3836,7 +3836,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3836
3836
|
for (let i = 0; i < items.length; i++) {
|
|
3837
3837
|
const item = items[i];
|
|
3838
3838
|
const id = item.getAttribute("id") || "";
|
|
3839
|
-
const href =
|
|
3839
|
+
const href = _chunkHVILFVATcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3840
3840
|
if (id && href) idToHref.set(id, href);
|
|
3841
3841
|
}
|
|
3842
3842
|
if (spine.length > 0) {
|
|
@@ -3847,7 +3847,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3847
3847
|
}
|
|
3848
3848
|
if (ordered.length > 0) return ordered;
|
|
3849
3849
|
}
|
|
3850
|
-
return Array.from(idToHref.values()).sort(
|
|
3850
|
+
return Array.from(idToHref.values()).sort(_chunkHVILFVATcjs.compareSectionPaths);
|
|
3851
3851
|
}
|
|
3852
3852
|
|
|
3853
3853
|
// src/hwpx/metadata.ts
|
|
@@ -3859,7 +3859,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3859
3859
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _144 => _144.total]));
|
|
3860
3860
|
if (decompressed) {
|
|
3861
3861
|
decompressed.total += xml.length * 2;
|
|
3862
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3862
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkHVILFVATcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3863
3863
|
}
|
|
3864
3864
|
return xml;
|
|
3865
3865
|
};
|
|
@@ -3881,7 +3881,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3881
3881
|
}
|
|
3882
3882
|
}
|
|
3883
3883
|
function parseOpfMetadata(xml, metadata) {
|
|
3884
|
-
const root = createXmlParser().parseFromString(
|
|
3884
|
+
const root = createXmlParser().parseFromString(_chunkHVILFVATcjs.stripDtd.call(void 0, xml), "text/xml").documentElement;
|
|
3885
3885
|
const md2 = root ? findChildByLocalName(root, "metadata") : null;
|
|
3886
3886
|
if (!md2) return;
|
|
3887
3887
|
let title;
|
|
@@ -3914,7 +3914,7 @@ function isoDate(s) {
|
|
|
3914
3914
|
}
|
|
3915
3915
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3916
3916
|
const parser = createXmlParser();
|
|
3917
|
-
const doc = parser.parseFromString(
|
|
3917
|
+
const doc = parser.parseFromString(_chunkHVILFVATcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3918
3918
|
if (!doc.documentElement) return;
|
|
3919
3919
|
const getText = (tagNames) => {
|
|
3920
3920
|
for (const tag of tagNames) {
|
|
@@ -3953,7 +3953,7 @@ function assignSectionPage(block, sectionNum) {
|
|
|
3953
3953
|
}
|
|
3954
3954
|
}
|
|
3955
3955
|
async function parseHwpxDocument(buffer, options) {
|
|
3956
|
-
|
|
3956
|
+
_chunkHVILFVATcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3957
3957
|
let zip;
|
|
3958
3958
|
try {
|
|
3959
3959
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3962,7 +3962,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3962
3962
|
}
|
|
3963
3963
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3964
3964
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3965
|
-
throw new (0,
|
|
3965
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3966
3966
|
}
|
|
3967
3967
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3968
3968
|
if (manifestFile) {
|
|
@@ -3982,7 +3982,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3982
3982
|
}
|
|
3983
3983
|
const hpfFile = zip.file("Contents/content.hpf");
|
|
3984
3984
|
const hpf = hpfFile ? await readZipEntry(hpfFile, "text").catch(() => "") : "";
|
|
3985
|
-
throw new (0,
|
|
3985
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(
|
|
3986
3986
|
/\bdistribution="1"/.test(_nullishCoalesce(hpf, () => ( ""))) ? "\uBC30\uD3EC\uC6A9\uC73C\uB85C \uC554\uD638\uD654\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4 (\uBC30\uD3EC\uC6A9 \uBCF5\uD638\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC74C). \uD55C\uCEF4\uC624\uD53C\uC2A4\uC5D0\uC11C \uC77C\uBC18 \uBB38\uC11C\uB85C \uC800\uC7A5\uD55C \uB4A4 \uC5EC\uC138\uC694." : "\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."
|
|
3987
3987
|
);
|
|
3988
3988
|
}
|
|
@@ -3994,7 +3994,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3994
3994
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3995
3995
|
const warnings = [];
|
|
3996
3996
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3997
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3997
|
+
if (sectionPaths.length === 0) throw new (0, _chunkHVILFVATcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3998
3998
|
let allBlocks = [];
|
|
3999
3999
|
const shared = createSectionShared();
|
|
4000
4000
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
@@ -4038,10 +4038,10 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4038
4038
|
const blocks = allBlocks;
|
|
4039
4039
|
applyPageText(blocks, shared);
|
|
4040
4040
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _173 => _173.pages]), shared.track.deletedImageRefs);
|
|
4041
|
-
const shown = _optionalChain([options, 'optionalAccess', _174 => _174.layoutTables]) === "keep" ? blocks :
|
|
4041
|
+
const shown = _optionalChain([options, 'optionalAccess', _174 => _174.layoutTables]) === "keep" ? blocks : _chunkZBHS7KLWcjs.unframeLayoutTables.call(void 0, blocks, !!_optionalChain([options, 'optionalAccess', _175 => _175.keepTrailingEmptyCols]));
|
|
4042
4042
|
detectHwpxHeadings(shown, styleMap, shared.tocTexts);
|
|
4043
4043
|
const outline = shown.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4044
|
-
const markdown =
|
|
4044
|
+
const markdown = _chunkZBHS7KLWcjs.blocksToMarkdown.call(void 0, shown, { tableFormat: _optionalChain([options, 'optionalAccess', _176 => _176.tableFormat]) });
|
|
4045
4045
|
return { markdown, blocks: shown, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
|
|
4046
4046
|
}
|
|
4047
4047
|
|
|
@@ -4808,7 +4808,7 @@ function decryptPasswordStream(raw, password) {
|
|
|
4808
4808
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4809
4809
|
var TAG_ID_MAPPINGS2 = 17;
|
|
4810
4810
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4811
|
-
const wrong = () => new (0,
|
|
4811
|
+
const wrong = () => new (0, _chunkHVILFVATcjs.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.");
|
|
4812
4812
|
let records;
|
|
4813
4813
|
try {
|
|
4814
4814
|
records = readRecords3(data);
|
|
@@ -4820,7 +4820,7 @@ function assertDecryptedDocInfo(data, readRecords3) {
|
|
|
4820
4820
|
}
|
|
4821
4821
|
function assertSupportedEncryptVersion(version) {
|
|
4822
4822
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4823
|
-
throw new (0,
|
|
4823
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(
|
|
4824
4824
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4825
4825
|
);
|
|
4826
4826
|
}
|
|
@@ -5069,19 +5069,19 @@ var HANJA_UNITS = ["", "\u5341", "\u767E", "\u5343", "\u842C"];
|
|
|
5069
5069
|
function formatNumber(n, fmt2) {
|
|
5070
5070
|
switch (fmt2) {
|
|
5071
5071
|
case "circled":
|
|
5072
|
-
return n >= 1 ?
|
|
5072
|
+
return n >= 1 ? _chunkZBHS7KLWcjs.circledNumber.call(void 0, n - 1) : String(n);
|
|
5073
5073
|
case "romanUpper":
|
|
5074
|
-
return
|
|
5074
|
+
return _chunkZBHS7KLWcjs.romanNumeral.call(void 0, n, true);
|
|
5075
5075
|
case "romanLower":
|
|
5076
|
-
return
|
|
5076
|
+
return _chunkZBHS7KLWcjs.romanNumeral.call(void 0, n, false);
|
|
5077
5077
|
case "latinUpper":
|
|
5078
5078
|
return formatLatin(n, true) || String(n);
|
|
5079
5079
|
case "latinLower":
|
|
5080
5080
|
return formatLatin(n, false) || String(n);
|
|
5081
5081
|
case "ganada":
|
|
5082
|
-
return n >= 1 ?
|
|
5082
|
+
return n >= 1 ? _chunkZBHS7KLWcjs.hangulOrdinal.call(void 0, n - 1) : String(n);
|
|
5083
5083
|
case "circledGanada":
|
|
5084
|
-
return n >= 1 ?
|
|
5084
|
+
return n >= 1 ? _chunkZBHS7KLWcjs.circledHangul.call(void 0, n - 1) : String(n);
|
|
5085
5085
|
case "jamo":
|
|
5086
5086
|
return fromTable(n, JAMO);
|
|
5087
5087
|
case "circledJamo":
|
|
@@ -5263,8 +5263,8 @@ function emitParagraphBlocks(p) {
|
|
|
5263
5263
|
return blocks;
|
|
5264
5264
|
}
|
|
5265
5265
|
function tableFlatText(table2) {
|
|
5266
|
-
const flat =
|
|
5267
|
-
return table2.caption ?
|
|
5266
|
+
const flat = _chunkZBHS7KLWcjs.convertTableToText.call(void 0, table2.cells);
|
|
5267
|
+
return table2.caption ? _chunkZBHS7KLWcjs.captionedText.call(void 0, flat, table2.caption, table2.captionBelow) : flat;
|
|
5268
5268
|
}
|
|
5269
5269
|
function blocksPlainText(blocks, sep) {
|
|
5270
5270
|
const parts = [];
|
|
@@ -5344,8 +5344,8 @@ ${cell2.text}` : cell2.text;
|
|
|
5344
5344
|
}
|
|
5345
5345
|
function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
5346
5346
|
for (const c of cells) {
|
|
5347
|
-
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1,
|
|
5348
|
-
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1,
|
|
5347
|
+
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1, _chunkZBHS7KLWcjs.MAX_ROWS));
|
|
5348
|
+
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1, _chunkZBHS7KLWcjs.MAX_COLS));
|
|
5349
5349
|
}
|
|
5350
5350
|
const placed = resolveCellOverlaps(cells, rows, cols);
|
|
5351
5351
|
const byRow = Array.from({ length: rows }, () => []);
|
|
@@ -5353,12 +5353,12 @@ function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
|
5353
5353
|
const r = _nullishCoalesce(c.rowAddr, () => ( 0));
|
|
5354
5354
|
if (r < rows && (_nullishCoalesce(c.colAddr, () => ( 0))) < cols) byRow[r].push(c);
|
|
5355
5355
|
}
|
|
5356
|
-
const table2 =
|
|
5356
|
+
const table2 = _chunkZBHS7KLWcjs.buildTable.call(void 0, byRow, { keepAnchoredEmptyCols });
|
|
5357
5357
|
if (table2.rows === 0) return null;
|
|
5358
5358
|
for (const c of placed) {
|
|
5359
5359
|
if (c.edges) {
|
|
5360
5360
|
const at = _optionalChain([table2, 'access', _183 => _183.cells, 'access', _184 => _184[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _185 => _185[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
5361
|
-
if (at)
|
|
5361
|
+
if (at) _chunkZBHS7KLWcjs.CELL_EDGES.set(at, c.edges);
|
|
5362
5362
|
}
|
|
5363
5363
|
if (!_optionalChain([c, 'access', _186 => _186.blocks, 'optionalAccess', _187 => _187.length]) && !c.isHeader) continue;
|
|
5364
5364
|
const target = _optionalChain([table2, 'access', _188 => _188.cells, 'access', _189 => _189[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _190 => _190[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
@@ -5560,7 +5560,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5560
5560
|
continue;
|
|
5561
5561
|
}
|
|
5562
5562
|
if (!ctrl.href) continue;
|
|
5563
|
-
const href =
|
|
5563
|
+
const href = _chunkHVILFVATcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5564
5564
|
if (!href) continue;
|
|
5565
5565
|
if (!anchor.trim() || anchor.includes(INLINE_TABLE_MARK)) continue;
|
|
5566
5566
|
text = text.slice(0, r.start) + `[${anchor}](${href})` + text.slice(r.end);
|
|
@@ -5569,7 +5569,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5569
5569
|
}
|
|
5570
5570
|
if (text.includes(LITERAL_DOLLAR_MARK)) text = text.replaceAll(LITERAL_DOLLAR_MARK, "\\$");
|
|
5571
5571
|
text = resolveLiteralLt(text);
|
|
5572
|
-
text =
|
|
5572
|
+
text = _chunkZBHS7KLWcjs.tidyScriptTags.call(void 0, text);
|
|
5573
5573
|
const toc = takeTocLeaders(text);
|
|
5574
5574
|
text = toc.text;
|
|
5575
5575
|
let headingLevel = 0;
|
|
@@ -5676,7 +5676,7 @@ function applyCtrlEffect(ctrl, records, ctx) {
|
|
|
5676
5676
|
// 글자 겹침 — ctrl id 뒤 글자 수(WORD)·겹친 글자(WCHAR[n])·테두리 종류(BYTE, 0 = 없음). 종전엔 건너뛰어 법령 서식 원 번호(⑯·⑰)가 빠졌다
|
|
5677
5677
|
case CTRL_TCPS: {
|
|
5678
5678
|
const d = ctrl.data, n = d.length >= 6 ? d.readUInt16LE(4) : 0;
|
|
5679
|
-
if (n > 0 && d.length >= 6 + 2 * n) ctrl.inlineText =
|
|
5679
|
+
if (n > 0 && d.length >= 6 + 2 * n) ctrl.inlineText = _chunkZBHS7KLWcjs.composeText.call(void 0, d.toString("utf16le", 6, 6 + 2 * n), (_nullishCoalesce(d[6 + 2 * n], () => ( 0))) !== 0);
|
|
5680
5680
|
return;
|
|
5681
5681
|
}
|
|
5682
5682
|
// 숨은 설명/단 정의/쪽번호 위치/감추기/찾아보기/책갈피/덧말 — 본문 텍스트 없음 또는 의도적 스킵
|
|
@@ -5794,7 +5794,7 @@ function hyperlinkUrlFromCommand(command) {
|
|
|
5794
5794
|
}
|
|
5795
5795
|
var A4_HEIGHT = 84188;
|
|
5796
5796
|
function keepUnlessPageSpanning(table2, cells) {
|
|
5797
|
-
if (!cells.some((c) => c.pageSpanning))
|
|
5797
|
+
if (!cells.some((c) => c.pageSpanning)) _chunkZBHS7KLWcjs.markNonLayoutTable.call(void 0, table2);
|
|
5798
5798
|
}
|
|
5799
5799
|
function parseTableControl(ctrl, records, ctx) {
|
|
5800
5800
|
if (ctx.depth >= MAX_NEST_DEPTH) return null;
|
|
@@ -5806,8 +5806,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5806
5806
|
let tableIdx = -1;
|
|
5807
5807
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5808
5808
|
if (records[i2].tagId === TAG_TABLE && records[i2].level === directLevel && records[i2].data.length >= 8) {
|
|
5809
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5810
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5809
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkZBHS7KLWcjs.MAX_ROWS);
|
|
5810
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkZBHS7KLWcjs.MAX_COLS);
|
|
5811
5811
|
tableIdx = i2;
|
|
5812
5812
|
break;
|
|
5813
5813
|
}
|
|
@@ -5854,11 +5854,11 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5854
5854
|
return table3;
|
|
5855
5855
|
}
|
|
5856
5856
|
if (rows === 0 || cols === 0) {
|
|
5857
|
-
rows = Math.min(cells.length,
|
|
5857
|
+
rows = Math.min(cells.length, _chunkZBHS7KLWcjs.MAX_ROWS);
|
|
5858
5858
|
cols = 1;
|
|
5859
5859
|
}
|
|
5860
5860
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5861
|
-
const table2 =
|
|
5861
|
+
const table2 = _chunkZBHS7KLWcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5862
5862
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5863
5863
|
if (caption && captionBelow && table2.rows > 0) table2.captionBelow = true;
|
|
5864
5864
|
if (sourceId && table2.rows > 0) table2.sourceId = sourceId;
|
|
@@ -5878,8 +5878,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5878
5878
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5879
5879
|
const cs = rec.data.readUInt16LE(12);
|
|
5880
5880
|
const rs = rec.data.readUInt16LE(14);
|
|
5881
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5882
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5881
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkZBHS7KLWcjs.MAX_COLS);
|
|
5882
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkZBHS7KLWcjs.MAX_ROWS);
|
|
5883
5883
|
}
|
|
5884
5884
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5885
5885
|
const { text, hasStructure } = cellTextFromBlocks(blocks);
|
|
@@ -6028,7 +6028,7 @@ function openHwp5Container(buffer, options) {
|
|
|
6028
6028
|
lenientCfb = parseLenientCfb(buffer);
|
|
6029
6029
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
6030
6030
|
} catch (e24) {
|
|
6031
|
-
throw new (0,
|
|
6031
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
6032
6032
|
}
|
|
6033
6033
|
}
|
|
6034
6034
|
const readRawStream = (path) => {
|
|
@@ -6039,14 +6039,14 @@ function openHwp5Container(buffer, options) {
|
|
|
6039
6039
|
return lenientCfb.findStream(path);
|
|
6040
6040
|
};
|
|
6041
6041
|
const headerData = readRawStream("/FileHeader");
|
|
6042
|
-
if (!headerData) throw new (0,
|
|
6042
|
+
if (!headerData) throw new (0, _chunkHVILFVATcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6043
6043
|
const header = parseFileHeader(headerData);
|
|
6044
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
6045
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
6044
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkHVILFVATcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
6045
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkHVILFVATcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
6046
6046
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
6047
6047
|
if (encrypted) {
|
|
6048
6048
|
if (!_optionalChain([options, 'optionalAccess', _214 => _214.password])) {
|
|
6049
|
-
throw new (0,
|
|
6049
|
+
throw new (0, _chunkHVILFVATcjs.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.");
|
|
6050
6050
|
}
|
|
6051
6051
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
6052
6052
|
}
|
|
@@ -6060,12 +6060,12 @@ function openHwp5Container(buffer, options) {
|
|
|
6060
6060
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
6061
6061
|
if (encrypted) {
|
|
6062
6062
|
const rawDocInfo = findStream("/DocInfo");
|
|
6063
|
-
if (!rawDocInfo) throw new (0,
|
|
6063
|
+
if (!rawDocInfo) throw new (0, _chunkHVILFVATcjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6064
6064
|
let docInfoData;
|
|
6065
6065
|
try {
|
|
6066
6066
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
6067
6067
|
} catch (e25) {
|
|
6068
|
-
throw new (0,
|
|
6068
|
+
throw new (0, _chunkHVILFVATcjs.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.");
|
|
6069
6069
|
}
|
|
6070
6070
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
6071
6071
|
}
|
|
@@ -6090,10 +6090,10 @@ function readHwp5SectionRecords(c, sections, warnings) {
|
|
|
6090
6090
|
try {
|
|
6091
6091
|
const data = !c.distribution && c.compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
6092
6092
|
totalDecompressed += data.length;
|
|
6093
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6093
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkHVILFVATcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6094
6094
|
out.push(readRecords(data));
|
|
6095
6095
|
} catch (secErr) {
|
|
6096
|
-
if (secErr instanceof
|
|
6096
|
+
if (secErr instanceof _chunkHVILFVATcjs.KordocError) throw secErr;
|
|
6097
6097
|
out.push(null);
|
|
6098
6098
|
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" });
|
|
6099
6099
|
}
|
|
@@ -6113,7 +6113,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6113
6113
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
6114
6114
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
6115
6115
|
const sections = readHwp5SectionStreams(c);
|
|
6116
|
-
if (sections.length === 0) throw new (0,
|
|
6116
|
+
if (sections.length === 0) throw new (0, _chunkHVILFVATcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
6117
6117
|
const sectionRecords = readHwp5SectionRecords(c, sections, warnings);
|
|
6118
6118
|
const sectionDetects = sectionRecords.map((r) => r ? detectHwp5SectionPages(r) : null);
|
|
6119
6119
|
const sectionTableIds = [];
|
|
@@ -6157,7 +6157,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6157
6157
|
parsedSections++;
|
|
6158
6158
|
_optionalChain([options, 'optionalAccess', _219 => _219.onProgress, 'optionalCall', _220 => _220(parsedSections, sections.length)]);
|
|
6159
6159
|
} catch (secErr) {
|
|
6160
|
-
if (secErr instanceof
|
|
6160
|
+
if (secErr instanceof _chunkHVILFVATcjs.KordocError) throw secErr;
|
|
6161
6161
|
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" });
|
|
6162
6162
|
} finally {
|
|
6163
6163
|
pageBase += detect2.pages;
|
|
@@ -6168,10 +6168,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6168
6168
|
}
|
|
6169
6169
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
6170
6170
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter, encrypted ? findStream : void 0) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter, encrypted ? findStream : void 0);
|
|
6171
|
-
let flatBlocks =
|
|
6172
|
-
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks =
|
|
6171
|
+
let flatBlocks = _chunkZBHS7KLWcjs.flattenLayoutTables.call(void 0, blocks);
|
|
6172
|
+
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks = _chunkZBHS7KLWcjs.unframeLayoutTables.call(void 0, flatBlocks, !!_optionalChain([options, 'optionalAccess', _222 => _222.keepTrailingEmptyCols]));
|
|
6173
6173
|
if (_optionalChain([options, 'optionalAccess', _223 => _223.dedupeRunningHeaders])) {
|
|
6174
|
-
const deduped =
|
|
6174
|
+
const deduped = _chunkZBHS7KLWcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
6175
6175
|
const removed = flatBlocks.length - deduped.length;
|
|
6176
6176
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
6177
6177
|
flatBlocks = deduped;
|
|
@@ -6180,10 +6180,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6180
6180
|
detectHwp5Headings(flatBlocks, docInfo, doc.tocTexts);
|
|
6181
6181
|
}
|
|
6182
6182
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
6183
|
-
let markdown =
|
|
6183
|
+
let markdown = _chunkZBHS7KLWcjs.blocksToMarkdown.call(void 0, flatBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _224 => _224.tableFormat]) });
|
|
6184
6184
|
if (_optionalChain([options, 'optionalAccess', _225 => _225.inlineImages]) && options.images !== false && images.length > 0) {
|
|
6185
6185
|
try {
|
|
6186
|
-
markdown =
|
|
6186
|
+
markdown = _chunkV26UPU2Lcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
6187
6187
|
} catch (inlineErr) {
|
|
6188
6188
|
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" });
|
|
6189
6189
|
}
|
|
@@ -6247,9 +6247,9 @@ function detectHwp5Headings(blocks, docInfo, tocTexts) {
|
|
|
6247
6247
|
let level = 0;
|
|
6248
6248
|
if (_optionalChain([block, 'access', _232 => _232.style, 'optionalAccess', _233 => _233.fontSize]) && baseFontSize > 0) {
|
|
6249
6249
|
const ratio = block.style.fontSize / baseFontSize;
|
|
6250
|
-
if (ratio >=
|
|
6251
|
-
else if (ratio >=
|
|
6252
|
-
else if (ratio >=
|
|
6250
|
+
if (ratio >= _chunkZBHS7KLWcjs.HEADING_RATIO_H1) level = 1;
|
|
6251
|
+
else if (ratio >= _chunkZBHS7KLWcjs.HEADING_RATIO_H2) level = 2;
|
|
6252
|
+
else if (ratio >= _chunkZBHS7KLWcjs.HEADING_RATIO_H3) level = 3;
|
|
6253
6253
|
}
|
|
6254
6254
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
6255
6255
|
if (level === 0) level = 2;
|
|
@@ -6381,7 +6381,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6381
6381
|
const raw = _nullishCoalesce(lcfb.findStream(`/BodyText/Section${i}`), () => ( lcfb.findStream(`Section${i}`)));
|
|
6382
6382
|
if (!raw) break;
|
|
6383
6383
|
totalBytes += raw.length;
|
|
6384
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6384
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkHVILFVATcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6385
6385
|
sections.push({ idx: i, content: raw });
|
|
6386
6386
|
}
|
|
6387
6387
|
if (sections.length === 0) {
|
|
@@ -6392,7 +6392,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6392
6392
|
const raw = lcfb.findStream(e.name);
|
|
6393
6393
|
if (raw) {
|
|
6394
6394
|
totalBytes += raw.length;
|
|
6395
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6395
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkHVILFVATcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6396
6396
|
sections.push({ idx, content: raw });
|
|
6397
6397
|
}
|
|
6398
6398
|
}
|
|
@@ -6409,7 +6409,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
6409
6409
|
try {
|
|
6410
6410
|
const content = decryptViewText(raw, compressed);
|
|
6411
6411
|
totalDecompressed += content.length;
|
|
6412
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6412
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkHVILFVATcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6413
6413
|
sections.push({ idx: i, content });
|
|
6414
6414
|
} catch (e32) {
|
|
6415
6415
|
break;
|
|
@@ -18909,25 +18909,25 @@ function desEcbDecrypt(data, key2) {
|
|
|
18909
18909
|
}
|
|
18910
18910
|
function readLayout(data) {
|
|
18911
18911
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
18912
|
-
throw new (0,
|
|
18912
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
18913
18913
|
}
|
|
18914
18914
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
18915
18915
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
18916
18916
|
if (payloadOffset >= data.length) {
|
|
18917
|
-
throw new (0,
|
|
18917
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18918
18918
|
}
|
|
18919
18919
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
18920
18920
|
}
|
|
18921
18921
|
function decryptHwp3Document(input, password) {
|
|
18922
18922
|
const { payloadOffset, compressed } = readLayout(input);
|
|
18923
18923
|
if (!compressed) {
|
|
18924
|
-
throw new (0,
|
|
18924
|
+
throw new (0, _chunkHVILFVATcjs.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)");
|
|
18925
18925
|
}
|
|
18926
18926
|
const source = Buffer.from(input);
|
|
18927
18927
|
const payload = source.subarray(payloadOffset);
|
|
18928
18928
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
18929
18929
|
if (aligned.length === 0) {
|
|
18930
|
-
throw new (0,
|
|
18930
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
18931
18931
|
}
|
|
18932
18932
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
18933
18933
|
let inflated;
|
|
@@ -18935,14 +18935,14 @@ function decryptHwp3Document(input, password) {
|
|
|
18935
18935
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
18936
18936
|
} catch (err) {
|
|
18937
18937
|
if (_optionalChain([err, 'optionalAccess', _248 => _248.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18938
|
-
throw new (0,
|
|
18938
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(
|
|
18939
18939
|
`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`
|
|
18940
18940
|
);
|
|
18941
18941
|
}
|
|
18942
|
-
throw new (0,
|
|
18942
|
+
throw new (0, _chunkHVILFVATcjs.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.");
|
|
18943
18943
|
}
|
|
18944
18944
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
18945
|
-
throw new (0,
|
|
18945
|
+
throw new (0, _chunkHVILFVATcjs.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.");
|
|
18946
18946
|
}
|
|
18947
18947
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
18948
18948
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -18999,9 +18999,9 @@ function hwp3CellGrid(info, count) {
|
|
|
18999
18999
|
const col = edgeAt(xs, g3.x), row = edgeAt(ys, g3.y);
|
|
19000
19000
|
const c2 = nextX[k] !== void 0 ? edgeAt(xs, nextX[k]) : xs.length - 1;
|
|
19001
19001
|
const r2 = nextY[k] !== void 0 ? edgeAt(ys, nextY[k]) : ys.length - 1;
|
|
19002
|
-
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row),
|
|
19002
|
+
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row), _chunkZBHS7KLWcjs.MAX_ROWS), colSpan: Math.min(Math.max(1, c2 - col), _chunkZBHS7KLWcjs.MAX_COLS) };
|
|
19003
19003
|
});
|
|
19004
|
-
return { rows: Math.min(Math.max(1, ys.length - 1),
|
|
19004
|
+
return { rows: Math.min(Math.max(1, ys.length - 1), _chunkZBHS7KLWcjs.MAX_ROWS), cols: Math.min(Math.max(1, xs.length - 1), _chunkZBHS7KLWcjs.MAX_COLS), cells };
|
|
19005
19005
|
}
|
|
19006
19006
|
|
|
19007
19007
|
// src/hwp3/parser.ts
|
|
@@ -19042,7 +19042,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19042
19042
|
let source = Buffer.from(buffer);
|
|
19043
19043
|
if (isEncryptedHwp3(source)) {
|
|
19044
19044
|
if (!_optionalChain([options, 'optionalAccess', _249 => _249.password])) {
|
|
19045
|
-
throw new (0,
|
|
19045
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(
|
|
19046
19046
|
"\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."
|
|
19047
19047
|
);
|
|
19048
19048
|
}
|
|
@@ -19059,10 +19059,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19059
19059
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
19060
19060
|
} catch (err) {
|
|
19061
19061
|
if (_optionalChain([err, 'optionalAccess', _250 => _250.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
19062
|
-
throw new (0,
|
|
19062
|
+
throw new (0, _chunkHVILFVATcjs.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`);
|
|
19063
19063
|
}
|
|
19064
19064
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
19065
|
-
throw new (0,
|
|
19065
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
19066
19066
|
}
|
|
19067
19067
|
} else {
|
|
19068
19068
|
body = tail;
|
|
@@ -19085,7 +19085,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19085
19085
|
const names = new Map([...ctx.picIds].map(([name, id]) => [id, name]));
|
|
19086
19086
|
dropMissingPictures(allBlocks, binData, names, warnings);
|
|
19087
19087
|
const images = resolveImageBlocks(binData, allBlocks, warnings, true);
|
|
19088
|
-
const blocks =
|
|
19088
|
+
const blocks = _chunkZBHS7KLWcjs.flattenLayoutTables.call(void 0, allBlocks);
|
|
19089
19089
|
const metadata = {
|
|
19090
19090
|
title: header.title || void 0,
|
|
19091
19091
|
author: header.author || void 0,
|
|
@@ -19093,10 +19093,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19093
19093
|
createdAt: header.date || void 0,
|
|
19094
19094
|
version: "3.0"
|
|
19095
19095
|
};
|
|
19096
|
-
let markdown =
|
|
19096
|
+
let markdown = _chunkZBHS7KLWcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _251 => _251.tableFormat]) });
|
|
19097
19097
|
if (_optionalChain([options, 'optionalAccess', _252 => _252.inlineImages]) && options.images !== false && images.length > 0) {
|
|
19098
19098
|
try {
|
|
19099
|
-
markdown =
|
|
19099
|
+
markdown = _chunkV26UPU2Lcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
19100
19100
|
} catch (inlineErr) {
|
|
19101
19101
|
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" });
|
|
19102
19102
|
}
|
|
@@ -19228,7 +19228,7 @@ function parseCharStream(reader, charCount, ctx, para2) {
|
|
|
19228
19228
|
continue;
|
|
19229
19229
|
}
|
|
19230
19230
|
if (ch >= 32) {
|
|
19231
|
-
para2.text +=
|
|
19231
|
+
para2.text += _chunkZBHS7KLWcjs.escapeLiteralTags.call(void 0, _chunkZBHS7KLWcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(decodeJohabText(ch), () => ( ""))));
|
|
19232
19232
|
continue;
|
|
19233
19233
|
}
|
|
19234
19234
|
if (ch === 9) {
|
|
@@ -19463,7 +19463,7 @@ function isDistributionSentinel(markdown) {
|
|
|
19463
19463
|
// src/xlsx/sheet-blocks.ts
|
|
19464
19464
|
var MAX_SHEET_COLS = 16384;
|
|
19465
19465
|
function sheetRowCap(cols) {
|
|
19466
|
-
return Math.floor(
|
|
19466
|
+
return Math.floor(_chunkZBHS7KLWcjs.MAX_TABLE_CELLS / Math.max(1, cols));
|
|
19467
19467
|
}
|
|
19468
19468
|
function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols) {
|
|
19469
19469
|
const blocks = [];
|
|
@@ -19494,7 +19494,7 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19494
19494
|
if (keepRows.length > rowCap) {
|
|
19495
19495
|
warnings.push({
|
|
19496
19496
|
page: sheetIndex + 1,
|
|
19497
|
-
message: `\uC2DC\uD2B8 "${sheetName}": ${keepRows.length}\uD589 \xD7 ${keepCols.length}\uC5F4 \uC911 \uC55E ${rowCap}\uD589\uB9CC \uD45C\uB85C \uB0C8\uC2B5\uB2C8\uB2E4 (\uD45C \uCE78 \uC0C1\uD55C ${
|
|
19497
|
+
message: `\uC2DC\uD2B8 "${sheetName}": ${keepRows.length}\uD589 \xD7 ${keepCols.length}\uC5F4 \uC911 \uC55E ${rowCap}\uD589\uB9CC \uD45C\uB85C \uB0C8\uC2B5\uB2C8\uB2E4 (\uD45C \uCE78 \uC0C1\uD55C ${_chunkZBHS7KLWcjs.MAX_TABLE_CELLS})`,
|
|
19498
19498
|
code: "TRUNCATED_TABLE"
|
|
19499
19499
|
});
|
|
19500
19500
|
keepRows.length = rowCap;
|
|
@@ -19528,14 +19528,14 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19528
19528
|
}
|
|
19529
19529
|
cellRows.push(row);
|
|
19530
19530
|
}
|
|
19531
|
-
const table2 =
|
|
19531
|
+
const table2 = _chunkZBHS7KLWcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols, maxRows: rowCap, maxCols: keepCols.length });
|
|
19532
19532
|
if (table2.rows > 0) blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
19533
19533
|
return blocks;
|
|
19534
19534
|
}
|
|
19535
19535
|
|
|
19536
19536
|
// src/xlsx/parser.ts
|
|
19537
19537
|
var MAX_SHEETS = 100;
|
|
19538
|
-
var MAX_DECOMPRESS_SIZE4 =
|
|
19538
|
+
var MAX_DECOMPRESS_SIZE4 = _chunkHVILFVATcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
19539
19539
|
var MAX_SHEET_ROWS = 1048576;
|
|
19540
19540
|
function cleanNumericValue(raw) {
|
|
19541
19541
|
if (!/^-?\d+\.\d+$/.test(raw)) return raw;
|
|
@@ -19572,7 +19572,7 @@ function getTextContent(el) {
|
|
|
19572
19572
|
return _nullishCoalesce(_optionalChain([el, 'access', _268 => _268.textContent, 'optionalAccess', _269 => _269.trim, 'call', _270 => _270()]), () => ( ""));
|
|
19573
19573
|
}
|
|
19574
19574
|
function parseXml(text) {
|
|
19575
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19575
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkHVILFVATcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19576
19576
|
}
|
|
19577
19577
|
function collectRichText(root) {
|
|
19578
19578
|
let out = "";
|
|
@@ -19583,7 +19583,7 @@ function collectRichText(root) {
|
|
|
19583
19583
|
const el = children[i];
|
|
19584
19584
|
const local2 = el.localName || _optionalChain([el, 'access', _271 => _271.tagName, 'optionalAccess', _272 => _272.replace, 'call', _273 => _273(/^[^:]+:/, "")]) || "";
|
|
19585
19585
|
if (local2 === "rPh") continue;
|
|
19586
|
-
if (local2 === "t") out +=
|
|
19586
|
+
if (local2 === "t") out += _chunkZBHS7KLWcjs.escapeLiteralTags.call(void 0, _chunkZBHS7KLWcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
19587
19587
|
else walk(el);
|
|
19588
19588
|
}
|
|
19589
19589
|
};
|
|
@@ -19794,12 +19794,12 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19794
19794
|
return { rows, merges, maxCol };
|
|
19795
19795
|
}
|
|
19796
19796
|
async function parseXlsxDocument(buffer, options) {
|
|
19797
|
-
|
|
19797
|
+
_chunkHVILFVATcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
19798
19798
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19799
19799
|
const warnings = [];
|
|
19800
19800
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
19801
19801
|
if (!workbookFile) {
|
|
19802
|
-
throw new (0,
|
|
19802
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19803
19803
|
}
|
|
19804
19804
|
let sharedStrings = [];
|
|
19805
19805
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -19808,7 +19808,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19808
19808
|
}
|
|
19809
19809
|
const { sheets, date1904 } = parseWorkbook(await readZipEntry(workbookFile, "text"));
|
|
19810
19810
|
if (sheets.length === 0) {
|
|
19811
|
-
throw new (0,
|
|
19811
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19812
19812
|
}
|
|
19813
19813
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
19814
19814
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -19892,7 +19892,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19892
19892
|
} catch (e35) {
|
|
19893
19893
|
}
|
|
19894
19894
|
}
|
|
19895
|
-
const markdown =
|
|
19895
|
+
const markdown = _chunkZBHS7KLWcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _278 => _278.tableFormat]) });
|
|
19896
19896
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
19897
19897
|
}
|
|
19898
19898
|
|
|
@@ -20206,14 +20206,14 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20206
20206
|
const h = readCellHeader(rec.data);
|
|
20207
20207
|
if (h && rec.data.length >= 10) {
|
|
20208
20208
|
const isst = rec.data.readUInt32LE(6);
|
|
20209
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20209
|
+
cells.push({ row: h.row, col: h.col, value: _chunkZBHS7KLWcjs.escapeLiteralTags.call(void 0, _chunkZBHS7KLWcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(sst[isst], () => ( "")))) });
|
|
20210
20210
|
}
|
|
20211
20211
|
break;
|
|
20212
20212
|
}
|
|
20213
20213
|
case OP_LABEL: {
|
|
20214
20214
|
const h = readCellHeader(rec.data);
|
|
20215
20215
|
if (h) {
|
|
20216
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20216
|
+
cells.push({ row: h.row, col: h.col, value: _chunkZBHS7KLWcjs.escapeLiteralTags.call(void 0, _chunkZBHS7KLWcjs.escapeLiteralDollar.call(void 0, decodeLabelString(rec.data))) });
|
|
20217
20217
|
}
|
|
20218
20218
|
break;
|
|
20219
20219
|
}
|
|
@@ -20229,7 +20229,7 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20229
20229
|
cells.push({
|
|
20230
20230
|
row: h.row,
|
|
20231
20231
|
col: h.col,
|
|
20232
|
-
value:
|
|
20232
|
+
value: _chunkZBHS7KLWcjs.escapeLiteralTags.call(void 0, _chunkZBHS7KLWcjs.escapeLiteralDollar.call(void 0, decodeFormulaStringRecord(next.data)))
|
|
20233
20233
|
});
|
|
20234
20234
|
i = j;
|
|
20235
20235
|
} else {
|
|
@@ -20341,11 +20341,11 @@ function processGlobals(records) {
|
|
|
20341
20341
|
const xfFmtIds = [];
|
|
20342
20342
|
const firstBof = records[0];
|
|
20343
20343
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
20344
|
-
throw new (0,
|
|
20344
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
20345
20345
|
}
|
|
20346
20346
|
const bof = decodeBof(firstBof.data);
|
|
20347
20347
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
20348
|
-
throw new (0,
|
|
20348
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
20349
20349
|
}
|
|
20350
20350
|
let i = 1;
|
|
20351
20351
|
while (i < records.length) {
|
|
@@ -20429,28 +20429,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20429
20429
|
try {
|
|
20430
20430
|
cfb = parseLenientCfb(buf);
|
|
20431
20431
|
} catch (e) {
|
|
20432
|
-
throw new (0,
|
|
20432
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(
|
|
20433
20433
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
20434
20434
|
);
|
|
20435
20435
|
}
|
|
20436
20436
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
20437
20437
|
if (!wb) {
|
|
20438
|
-
throw new (0,
|
|
20438
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
20439
20439
|
}
|
|
20440
20440
|
const records = readRecords2(wb);
|
|
20441
20441
|
if (records.length === 0) {
|
|
20442
|
-
throw new (0,
|
|
20442
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
20443
20443
|
}
|
|
20444
20444
|
const firstBof = decodeBof(records[0].data);
|
|
20445
20445
|
if (firstBof && firstBof.vers !== 1536) {
|
|
20446
|
-
throw new (0,
|
|
20446
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(
|
|
20447
20447
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
20448
20448
|
);
|
|
20449
20449
|
}
|
|
20450
20450
|
const globals = processGlobals(records);
|
|
20451
20451
|
const warnings = [];
|
|
20452
20452
|
if (globals.encrypted) {
|
|
20453
|
-
throw new (0,
|
|
20453
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20454
20454
|
}
|
|
20455
20455
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
20456
20456
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -20501,7 +20501,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20501
20501
|
pageCount: totalSheets
|
|
20502
20502
|
};
|
|
20503
20503
|
return {
|
|
20504
|
-
markdown:
|
|
20504
|
+
markdown: _chunkZBHS7KLWcjs.blocksToMarkdown.call(void 0, allBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _283 => _283.tableFormat]) }),
|
|
20505
20505
|
blocks: allBlocks,
|
|
20506
20506
|
metadata,
|
|
20507
20507
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -20940,7 +20940,7 @@ function isDisplayMath(el) {
|
|
|
20940
20940
|
}
|
|
20941
20941
|
|
|
20942
20942
|
// src/docx/parser.ts
|
|
20943
|
-
var MAX_DECOMPRESS_SIZE5 =
|
|
20943
|
+
var MAX_DECOMPRESS_SIZE5 = _chunkHVILFVATcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
20944
20944
|
var MEDIA_PART_RE = /^word\/(?:media|embeddings)\//;
|
|
20945
20945
|
var NEVER_READ_RE = /^word\/(?:embeddings\/.*|media\/.+\.(?:mp4|m4v|mov|avi|wmv|mpe?g|mkv|webm|mp3|wav|m4a|wma|aac|ogg|flac|mid|bin))$/i;
|
|
20946
20946
|
function matchesLocal(el, localName3) {
|
|
@@ -20998,7 +20998,7 @@ function getAttr(el, localName3) {
|
|
|
20998
20998
|
return null;
|
|
20999
20999
|
}
|
|
21000
21000
|
function parseXml2(text) {
|
|
21001
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
21001
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkHVILFVATcjs.stripDtd.call(void 0, text), "text/xml");
|
|
21002
21002
|
}
|
|
21003
21003
|
function parseStyles(xml) {
|
|
21004
21004
|
const doc = parseXml2(xml);
|
|
@@ -21134,7 +21134,7 @@ function parseFootnotes(xml) {
|
|
|
21134
21134
|
const runs = findElements(p, "r");
|
|
21135
21135
|
for (const r of runs) {
|
|
21136
21136
|
const tElements = getChildElements(r, "t");
|
|
21137
|
-
for (const t of tElements) texts.push(
|
|
21137
|
+
for (const t of tElements) texts.push(_chunkZBHS7KLWcjs.escapeLiteralTags.call(void 0, _chunkZBHS7KLWcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(t.textContent, () => ( "")))));
|
|
21138
21138
|
}
|
|
21139
21139
|
}
|
|
21140
21140
|
notes.set(id, texts.join("").trim());
|
|
@@ -21165,7 +21165,7 @@ function collectOmmlRoots(p) {
|
|
|
21165
21165
|
function extractRun(r) {
|
|
21166
21166
|
let text = "";
|
|
21167
21167
|
for (const el of effectiveChildElements(r)) {
|
|
21168
|
-
if (matchesLocal(el, "t")) text +=
|
|
21168
|
+
if (matchesLocal(el, "t")) text += _chunkZBHS7KLWcjs.escapeLiteralTags.call(void 0, _chunkZBHS7KLWcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
21169
21169
|
else if (matchesLocal(el, "br") || matchesLocal(el, "cr")) text += "\n";
|
|
21170
21170
|
else if (matchesLocal(el, "tab")) text += " ";
|
|
21171
21171
|
else if (matchesLocal(el, "sym")) text += symbolChar(getAttr(el, "font"), getAttr(el, "char"));
|
|
@@ -21178,7 +21178,7 @@ function extractRun(r) {
|
|
|
21178
21178
|
italic = getChildElements(rPrEls[0], "i").length > 0;
|
|
21179
21179
|
const va = getChildElements(rPrEls[0], "vertAlign")[0];
|
|
21180
21180
|
const v = va ? getAttr(va, "val") : null;
|
|
21181
|
-
if (v === "superscript" || v === "subscript") text =
|
|
21181
|
+
if (v === "superscript" || v === "subscript") text = _chunkZBHS7KLWcjs.wrapScript.call(void 0, text, v === "superscript" ? "sup" : "sub");
|
|
21182
21182
|
}
|
|
21183
21183
|
return { text, bold, italic };
|
|
21184
21184
|
}
|
|
@@ -21196,7 +21196,7 @@ var PAGE_FIELD_RE = /^\s*(?:PAGE|NUMPAGES|SECTIONPAGES)\b/i;
|
|
|
21196
21196
|
function makeLink(text, rawHref) {
|
|
21197
21197
|
if (!text) return "";
|
|
21198
21198
|
if (!rawHref) return text;
|
|
21199
|
-
const href =
|
|
21199
|
+
const href = _chunkHVILFVATcjs.sanitizeHref.call(void 0, rawHref);
|
|
21200
21200
|
return href ? `[${text}](${href})` : text;
|
|
21201
21201
|
}
|
|
21202
21202
|
function collectInline(p, footnotes, rels) {
|
|
@@ -21287,7 +21287,7 @@ function collectInline(p, footnotes, rels) {
|
|
|
21287
21287
|
const m = mathText(om);
|
|
21288
21288
|
if (m) parts.push(isDisplayMath(om) ? m : " " + m + " ");
|
|
21289
21289
|
}
|
|
21290
|
-
const text =
|
|
21290
|
+
const text = _chunkZBHS7KLWcjs.tidyScriptTags.call(void 0, parts.join("")).replace(/[ \t]{2,}/g, " ").trim();
|
|
21291
21291
|
return { text, bold, italic, footnoteText };
|
|
21292
21292
|
}
|
|
21293
21293
|
var COUNTERS = /* @__PURE__ */ new WeakMap();
|
|
@@ -21412,7 +21412,7 @@ ${cell2.text}` : cell2.text;
|
|
|
21412
21412
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
21413
21413
|
})
|
|
21414
21414
|
);
|
|
21415
|
-
const table2 =
|
|
21415
|
+
const table2 = _chunkZBHS7KLWcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21416
21416
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21417
21417
|
return { type: "table", table: table2 };
|
|
21418
21418
|
}
|
|
@@ -21461,7 +21461,7 @@ async function buildImageMap(zip, rels, doc, warnings, readBytes) {
|
|
|
21461
21461
|
let data = null;
|
|
21462
21462
|
if (readBytes) data = await readZipEntry(imgFile, "uint8array");
|
|
21463
21463
|
imgIdx++;
|
|
21464
|
-
const ext =
|
|
21464
|
+
const ext = _chunkHVILFVATcjs.partExtension.call(void 0, imgPath);
|
|
21465
21465
|
const mimeMap = {
|
|
21466
21466
|
png: "image/png",
|
|
21467
21467
|
jpg: "image/jpeg",
|
|
@@ -21560,12 +21560,12 @@ async function parseHeaderFooterBlocks(zip, doc, rels, kind, styles, numbering,
|
|
|
21560
21560
|
}
|
|
21561
21561
|
async function parseDocxDocument(buffer, options) {
|
|
21562
21562
|
const readImages = _optionalChain([options, 'optionalAccess', _319 => _319.images]) !== false;
|
|
21563
|
-
|
|
21563
|
+
_chunkHVILFVATcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5, void 0, { re: MEDIA_PART_RE, skip: !readImages, never: NEVER_READ_RE });
|
|
21564
21564
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21565
21565
|
const warnings = [];
|
|
21566
21566
|
const docFile = zip.file("word/document.xml");
|
|
21567
21567
|
if (!docFile) {
|
|
21568
|
-
throw new (0,
|
|
21568
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21569
21569
|
}
|
|
21570
21570
|
let rels = /* @__PURE__ */ new Map();
|
|
21571
21571
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -21612,7 +21612,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21612
21612
|
const doc = parseXml2(docXml);
|
|
21613
21613
|
const body = findElements(doc, "body");
|
|
21614
21614
|
if (body.length === 0) {
|
|
21615
|
-
throw new (0,
|
|
21615
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21616
21616
|
}
|
|
21617
21617
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings, readImages);
|
|
21618
21618
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -21665,7 +21665,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21665
21665
|
}
|
|
21666
21666
|
}
|
|
21667
21667
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
21668
|
-
const markdown =
|
|
21668
|
+
const markdown = _chunkZBHS7KLWcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _326 => _326.tableFormat]) });
|
|
21669
21669
|
return {
|
|
21670
21670
|
markdown,
|
|
21671
21671
|
blocks,
|
|
@@ -21679,7 +21679,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21679
21679
|
// src/pptx/parser.ts
|
|
21680
21680
|
|
|
21681
21681
|
|
|
21682
|
-
var MAX_DECOMPRESS_SIZE6 =
|
|
21682
|
+
var MAX_DECOMPRESS_SIZE6 = _chunkHVILFVATcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
21683
21683
|
var MEDIA_PART_RE2 = /^ppt\/(?:media|embeddings)\//;
|
|
21684
21684
|
var NEVER_READ_RE2 = /^ppt\/(?:embeddings\/.*|media\/.+\.(?:mp4|m4v|mov|avi|wmv|mpe?g|mkv|webm|mp3|wav|m4a|wma|aac|ogg|flac|mid|bin))$/i;
|
|
21685
21685
|
var MAX_ZIP_ENTRIES2 = 1e4;
|
|
@@ -21702,7 +21702,7 @@ var IMAGE_MIME = {
|
|
|
21702
21702
|
svg: "image/svg+xml"
|
|
21703
21703
|
};
|
|
21704
21704
|
function parseXml3(text) {
|
|
21705
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
21705
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkHVILFVATcjs.stripDtd.call(void 0, text), "text/xml");
|
|
21706
21706
|
}
|
|
21707
21707
|
function getAttr2(el, name) {
|
|
21708
21708
|
const attrs = el.attributes;
|
|
@@ -21769,7 +21769,7 @@ async function slideParts(zip) {
|
|
|
21769
21769
|
names.sort((a, b) => Number(SLIDE_PART_RE.exec(a)[1]) - Number(SLIDE_PART_RE.exec(b)[1]));
|
|
21770
21770
|
ordered.push(...names);
|
|
21771
21771
|
}
|
|
21772
|
-
if (ordered.length > MAX_SLIDES) throw new (0,
|
|
21772
|
+
if (ordered.length > MAX_SLIDES) throw new (0, _chunkHVILFVATcjs.KordocError)(`PPTX \uC2AC\uB77C\uC774\uB4DC \uC218 \uCD08\uACFC: ${ordered.length} (\uCD5C\uB300 ${MAX_SLIDES})`);
|
|
21773
21773
|
return ordered;
|
|
21774
21774
|
}
|
|
21775
21775
|
function paragraphText(p) {
|
|
@@ -21780,12 +21780,12 @@ function paragraphText(p) {
|
|
|
21780
21780
|
const t = findChildByLocalName(child, "t");
|
|
21781
21781
|
const rPr = findChildByLocalName(child, "rPr");
|
|
21782
21782
|
const baseline = Number(rPr ? _nullishCoalesce(getAttr2(rPr, "baseline"), () => ( 0)) : 0);
|
|
21783
|
-
if (t) text +=
|
|
21783
|
+
if (t) text += _chunkZBHS7KLWcjs.wrapScript.call(void 0, _chunkZBHS7KLWcjs.escapeLiteralTags.call(void 0, _chunkZBHS7KLWcjs.escapeLiteralDollar.call(void 0, rawTextContent(t))), baseline > 0 ? "sup" : baseline < 0 ? "sub" : null);
|
|
21784
21784
|
} else if (name === "br") {
|
|
21785
21785
|
text += " ";
|
|
21786
21786
|
}
|
|
21787
21787
|
}
|
|
21788
|
-
return
|
|
21788
|
+
return _chunkZBHS7KLWcjs.tidyScriptTags.call(void 0, text.replace(/\s+/g, " ").trim());
|
|
21789
21789
|
}
|
|
21790
21790
|
function bodyParagraphs(txBody) {
|
|
21791
21791
|
const out = [];
|
|
@@ -21846,7 +21846,7 @@ function parseTable2(tbl2, page, keepEmptyCols) {
|
|
|
21846
21846
|
});
|
|
21847
21847
|
return cells;
|
|
21848
21848
|
});
|
|
21849
|
-
const table2 =
|
|
21849
|
+
const table2 = _chunkZBHS7KLWcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21850
21850
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21851
21851
|
return { type: "table", table: table2, pageNumber: page };
|
|
21852
21852
|
}
|
|
@@ -21859,7 +21859,7 @@ async function pictureBlock(pic, ctx) {
|
|
|
21859
21859
|
if (!filename) {
|
|
21860
21860
|
const file = ctx.zip.file(rel.target);
|
|
21861
21861
|
if (!file) return null;
|
|
21862
|
-
const ext =
|
|
21862
|
+
const ext = _chunkHVILFVATcjs.partExtension.call(void 0, rel.target);
|
|
21863
21863
|
filename = `image_${String(ctx.imageNames.size + 1).padStart(3, "0")}.${ext}`;
|
|
21864
21864
|
try {
|
|
21865
21865
|
if (_optionalChain([ctx, 'access', _330 => _330.options, 'optionalAccess', _331 => _331.images]) !== false) {
|
|
@@ -21937,10 +21937,10 @@ async function notesText(zip, rels) {
|
|
|
21937
21937
|
return texts.join(" ");
|
|
21938
21938
|
}
|
|
21939
21939
|
async function parsePptxDocument(buffer, options) {
|
|
21940
|
-
|
|
21940
|
+
_chunkHVILFVATcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE6, MAX_ZIP_ENTRIES2, { re: MEDIA_PART_RE2, skip: _optionalChain([options, 'optionalAccess', _334 => _334.images]) === false, never: NEVER_READ_RE2 });
|
|
21941
21941
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21942
21942
|
if (!zip.file("ppt/presentation.xml")) {
|
|
21943
|
-
throw new (0,
|
|
21943
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 PPTX \uD30C\uC77C: ppt/presentation.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21944
21944
|
}
|
|
21945
21945
|
const warnings = [];
|
|
21946
21946
|
const blocks = [];
|
|
@@ -21987,7 +21987,7 @@ async function parsePptxDocument(buffer, options) {
|
|
|
21987
21987
|
}
|
|
21988
21988
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")), pageNumber: b.pageNumber }));
|
|
21989
21989
|
return {
|
|
21990
|
-
markdown:
|
|
21990
|
+
markdown: _chunkZBHS7KLWcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _336 => _336.tableFormat]) }),
|
|
21991
21991
|
blocks,
|
|
21992
21992
|
metadata,
|
|
21993
21993
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -22003,11 +22003,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
22003
22003
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
22004
22004
|
function parseHwpmlDocument(buffer, options) {
|
|
22005
22005
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
22006
|
-
throw new (0,
|
|
22006
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
22007
22007
|
}
|
|
22008
22008
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
22009
22009
|
const normalized = text.replace(/ /g, " ");
|
|
22010
|
-
const xml =
|
|
22010
|
+
const xml = _chunkHVILFVATcjs.stripDtd.call(void 0, normalized);
|
|
22011
22011
|
const warnings = [];
|
|
22012
22012
|
const parser = new (0, _xmldom.DOMParser)({
|
|
22013
22013
|
onError: (_level, msg2) => {
|
|
@@ -22047,7 +22047,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
22047
22047
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _338 => _338.keepTrailingEmptyCols]), () => ( false)));
|
|
22048
22048
|
}
|
|
22049
22049
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
22050
|
-
const markdown =
|
|
22050
|
+
const markdown = _chunkZBHS7KLWcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _339 => _339.tableFormat]) });
|
|
22051
22051
|
return {
|
|
22052
22052
|
markdown,
|
|
22053
22053
|
blocks,
|
|
@@ -22167,7 +22167,7 @@ function collectCharText(node, parts, depth = 0) {
|
|
|
22167
22167
|
if (tag === "CHAR") {
|
|
22168
22168
|
for (const c of Array.from(el.childNodes)) {
|
|
22169
22169
|
const t = c.nodeType === 1 ? charElementText(c) : c.nodeType === 3 || c.nodeType === 4 ? _nullishCoalesce(c.nodeValue, () => ( "")) : "";
|
|
22170
|
-
if (t) parts.push(
|
|
22170
|
+
if (t) parts.push(_chunkZBHS7KLWcjs.escapeLiteralTags.call(void 0, t));
|
|
22171
22171
|
}
|
|
22172
22172
|
} else if (tag === "TABLE" || tag === "PICTURE" || tag === "SHAPEOBJECT") {
|
|
22173
22173
|
} else if (tag === "AUTONUM") {
|
|
@@ -22227,7 +22227,7 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
22227
22227
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
22228
22228
|
cellRows[r].push(cell2);
|
|
22229
22229
|
}
|
|
22230
|
-
const table2 =
|
|
22230
|
+
const table2 = _chunkZBHS7KLWcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
22231
22231
|
if (structured.length > 0) {
|
|
22232
22232
|
const claimed = /* @__PURE__ */ new Set();
|
|
22233
22233
|
for (const { ctx, cellBlocks } of structured) {
|
|
@@ -24005,7 +24005,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
24005
24005
|
};
|
|
24006
24006
|
}
|
|
24007
24007
|
async function extractClickHereFields(hwpxBuffer) {
|
|
24008
|
-
|
|
24008
|
+
_chunkHVILFVATcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
24009
24009
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
24010
24010
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
24011
24011
|
const fields = [];
|
|
@@ -24041,7 +24041,7 @@ function readZipEntries(buf) {
|
|
|
24041
24041
|
}
|
|
24042
24042
|
function localDataStart(view, localOffset) {
|
|
24043
24043
|
if (view.getUint32(localOffset, true) !== LOCAL_SIG) {
|
|
24044
|
-
throw new (0,
|
|
24044
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
24045
24045
|
}
|
|
24046
24046
|
const nameLen = view.getUint16(localOffset + 26, true);
|
|
24047
24047
|
const extraLen = view.getUint16(localOffset + 28, true);
|
|
@@ -24071,19 +24071,19 @@ function parseCentralDirectory(buf) {
|
|
|
24071
24071
|
}
|
|
24072
24072
|
}
|
|
24073
24073
|
}
|
|
24074
|
-
if (eocdOffset < 0) throw new (0,
|
|
24074
|
+
if (eocdOffset < 0) throw new (0, _chunkHVILFVATcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24075
24075
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
24076
24076
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
24077
24077
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
24078
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
24078
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkHVILFVATcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24079
24079
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
24080
|
-
throw new (0,
|
|
24080
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24081
24081
|
}
|
|
24082
24082
|
const decoder = new TextDecoder("utf-8");
|
|
24083
24083
|
const entries = [];
|
|
24084
24084
|
let pos = cdOffset;
|
|
24085
24085
|
for (let i = 0; i < totalEntries; i++) {
|
|
24086
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
24086
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkHVILFVATcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
24087
24087
|
const flags = view.getUint16(pos + 8, true);
|
|
24088
24088
|
const method = view.getUint16(pos + 10, true);
|
|
24089
24089
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -24094,7 +24094,7 @@ function parseCentralDirectory(buf) {
|
|
|
24094
24094
|
const commentLen = view.getUint16(pos + 32, true);
|
|
24095
24095
|
const localOffset = view.getUint32(pos + 42, true);
|
|
24096
24096
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
24097
|
-
throw new (0,
|
|
24097
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24098
24098
|
}
|
|
24099
24099
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
24100
24100
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -24123,11 +24123,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24123
24123
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
24124
24124
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
24125
24125
|
for (const name of replacements.keys()) {
|
|
24126
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
24126
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkHVILFVATcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
24127
24127
|
}
|
|
24128
24128
|
if (additions) {
|
|
24129
24129
|
for (const name of additions.keys()) {
|
|
24130
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
24130
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkHVILFVATcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
24131
24131
|
}
|
|
24132
24132
|
}
|
|
24133
24133
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -24146,7 +24146,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24146
24146
|
offset += seg.length;
|
|
24147
24147
|
continue;
|
|
24148
24148
|
}
|
|
24149
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
24149
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkHVILFVATcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
24150
24150
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
24151
24151
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
24152
24152
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -24154,7 +24154,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24154
24154
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
24155
24155
|
const method = e.method;
|
|
24156
24156
|
if (method !== 0 && method !== 8) {
|
|
24157
|
-
throw new (0,
|
|
24157
|
+
throw new (0, _chunkHVILFVATcjs.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`);
|
|
24158
24158
|
}
|
|
24159
24159
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
24160
24160
|
const crc = crc32(newData);
|
|
@@ -24252,11 +24252,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24252
24252
|
// src/form/filler-hwpx.ts
|
|
24253
24253
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
24254
24254
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
24255
|
-
|
|
24255
|
+
_chunkHVILFVATcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
24256
24256
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
24257
24257
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
24258
24258
|
if (sectionPaths.length === 0) {
|
|
24259
|
-
throw new (0,
|
|
24259
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24260
24260
|
}
|
|
24261
24261
|
const warnings = [];
|
|
24262
24262
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -24648,7 +24648,7 @@ var MIN_SIDE = 24;
|
|
|
24648
24648
|
async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
24649
24649
|
const ocr = _optionalChain([options, 'optionalAccess', _491 => _491.ocr]);
|
|
24650
24650
|
if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
|
|
24651
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
24651
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-GY7SZAHN.cjs")));
|
|
24652
24652
|
let inserted = false, unreadable = 0;
|
|
24653
24653
|
let failed = null;
|
|
24654
24654
|
const walk = async (list, depth) => {
|
|
@@ -24689,7 +24689,7 @@ async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
|
24689
24689
|
function ocrBytes(img) {
|
|
24690
24690
|
const mime = img.mimeType.toLowerCase();
|
|
24691
24691
|
if (mime.includes("wmf") || mime.includes("emf")) return null;
|
|
24692
|
-
if (mime.includes("bmp")) return
|
|
24692
|
+
if (mime.includes("bmp")) return _chunkV26UPU2Lcjs.bmpToPng.call(void 0, img.data);
|
|
24693
24693
|
return img.data;
|
|
24694
24694
|
}
|
|
24695
24695
|
async function tooSmall(bytes) {
|
|
@@ -24858,7 +24858,7 @@ function classifyTableTree(blocks) {
|
|
|
24858
24858
|
return blocks;
|
|
24859
24859
|
}
|
|
24860
24860
|
function chooseTableRepresentation(table2, opts = {}) {
|
|
24861
|
-
const structured = hasMerged(table2) ||
|
|
24861
|
+
const structured = hasMerged(table2) || _chunkZBHS7KLWcjs.hasStructuredCellContent.call(void 0, table2);
|
|
24862
24862
|
if (opts.smartVisual && _optionalChain([table2, 'access', _507 => _507.classification, 'optionalAccess', _508 => _508.kind]) === "non-tabular-layout") return "visual";
|
|
24863
24863
|
return structured ? "html" : "gfm";
|
|
24864
24864
|
}
|
|
@@ -35944,7 +35944,7 @@ function findAgency(name) {
|
|
|
35944
35944
|
}
|
|
35945
35945
|
function agencyStyle(name) {
|
|
35946
35946
|
const s = findAgency(name);
|
|
35947
|
-
if (!s) throw new (0,
|
|
35947
|
+
if (!s) throw new (0, _chunkHVILFVATcjs.KordocError)(`agency: \uC2E4\uCE21 \uC11C\uC2DD\uC774 \uC5C6\uB294 \uAE30\uAD00\uC785\uB2C8\uB2E4 "${name}" \u2014 ${AGENCY_COMMON_NAME} \uB610\uB294 ${agencyNames().join("\xB7")}`);
|
|
35948
35948
|
return s;
|
|
35949
35949
|
}
|
|
35950
35950
|
function applyAgency(opts, preset) {
|
|
@@ -37008,7 +37008,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
37008
37008
|
}
|
|
37009
37009
|
function assertFiniteRange(name, value, min, max) {
|
|
37010
37010
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
37011
|
-
throw new (0,
|
|
37011
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
37012
37012
|
}
|
|
37013
37013
|
}
|
|
37014
37014
|
function validateGongmunOptions(opts) {
|
|
@@ -37026,10 +37026,10 @@ function validateGongmunOptions(opts) {
|
|
|
37026
37026
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
37027
37027
|
}
|
|
37028
37028
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
37029
|
-
throw new (0,
|
|
37029
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
37030
37030
|
}
|
|
37031
37031
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
37032
|
-
throw new (0,
|
|
37032
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
37033
37033
|
}
|
|
37034
37034
|
}
|
|
37035
37035
|
if (opts.sizes) {
|
|
@@ -37038,24 +37038,24 @@ function validateGongmunOptions(opts) {
|
|
|
37038
37038
|
}
|
|
37039
37039
|
}
|
|
37040
37040
|
if (opts.approval && opts.approval.length > 6) {
|
|
37041
|
-
throw new (0,
|
|
37041
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("approval must contain at most 6 labels");
|
|
37042
37042
|
}
|
|
37043
37043
|
if (opts.checklist && typeof opts.checklist === "object") {
|
|
37044
37044
|
const nums = [..._nullishCoalesce(opts.checklist.na, () => ( [])), ...Object.keys(_nullishCoalesce(opts.checklist.notes, () => ( {}))).map(Number)];
|
|
37045
37045
|
for (const n of nums) {
|
|
37046
|
-
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0,
|
|
37046
|
+
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0, _chunkHVILFVATcjs.KordocError)(`checklist: item number must be an integer between 1 and ${CHECKLIST_ITEMS} (got ${n})`);
|
|
37047
37047
|
}
|
|
37048
37048
|
}
|
|
37049
37049
|
if (opts.levels) {
|
|
37050
37050
|
for (const [key2, st] of Object.entries(opts.levels)) {
|
|
37051
37051
|
const depth = Number(key2);
|
|
37052
37052
|
if (!Number.isInteger(depth) || depth < 0 || depth >= GONGMUN_LEVEL_COUNT) {
|
|
37053
|
-
throw new (0,
|
|
37053
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(`levels: depth must be an integer between 0 and ${GONGMUN_LEVEL_COUNT - 1} (got "${key2}")`);
|
|
37054
37054
|
}
|
|
37055
|
-
if (!st || typeof st !== "object") throw new (0,
|
|
37055
|
+
if (!st || typeof st !== "object") throw new (0, _chunkHVILFVATcjs.KordocError)(`levels.${key2} must be an object {font, pt, bold}`);
|
|
37056
37056
|
if (st.pt !== void 0) assertFiniteRange(`levels.${key2}.pt`, st.pt, 6, 60);
|
|
37057
37057
|
if (st.font !== void 0 && (typeof st.font !== "string" || !st.font.trim())) {
|
|
37058
|
-
throw new (0,
|
|
37058
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(`levels.${key2}.font must be a non-empty string`);
|
|
37059
37059
|
}
|
|
37060
37060
|
}
|
|
37061
37061
|
}
|
|
@@ -37113,7 +37113,7 @@ function resolveChecklist(c, preset) {
|
|
|
37113
37113
|
function hexColorOption(name, value) {
|
|
37114
37114
|
if (value === void 0) return void 0;
|
|
37115
37115
|
const v = value.trim();
|
|
37116
|
-
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0,
|
|
37116
|
+
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0, _chunkHVILFVATcjs.KordocError)(`${name} must be a #RRGGBB color (got "${value}")`);
|
|
37117
37117
|
return v.toUpperCase();
|
|
37118
37118
|
}
|
|
37119
37119
|
function resolveGongmun(input) {
|
|
@@ -37191,21 +37191,21 @@ function standardMarker(depth, n) {
|
|
|
37191
37191
|
case 0:
|
|
37192
37192
|
return `${n + 1}.`;
|
|
37193
37193
|
case 1:
|
|
37194
|
-
return `${
|
|
37194
|
+
return `${_chunkZBHS7KLWcjs.hangulOrdinal.call(void 0, n)}.`;
|
|
37195
37195
|
case 2:
|
|
37196
37196
|
return `${n + 1})`;
|
|
37197
37197
|
case 3:
|
|
37198
|
-
return `${
|
|
37198
|
+
return `${_chunkZBHS7KLWcjs.hangulOrdinal.call(void 0, n)})`;
|
|
37199
37199
|
case 4:
|
|
37200
37200
|
return `(${n + 1})`;
|
|
37201
37201
|
case 5:
|
|
37202
|
-
return `(${
|
|
37202
|
+
return `(${_chunkZBHS7KLWcjs.hangulOrdinal.call(void 0, n)})`;
|
|
37203
37203
|
case 6:
|
|
37204
|
-
return
|
|
37204
|
+
return _chunkZBHS7KLWcjs.circledNumber.call(void 0, n);
|
|
37205
37205
|
case 7:
|
|
37206
|
-
return
|
|
37206
|
+
return _chunkZBHS7KLWcjs.circledHangul.call(void 0, n);
|
|
37207
37207
|
default:
|
|
37208
|
-
return
|
|
37208
|
+
return _chunkZBHS7KLWcjs.circledHangul.call(void 0, n);
|
|
37209
37209
|
}
|
|
37210
37210
|
}
|
|
37211
37211
|
function reportMarker(depth, bullet2 = "\u25CB", asteriskThird = false) {
|
|
@@ -37859,7 +37859,7 @@ function parseInlineMarkdown(text) {
|
|
|
37859
37859
|
else spans.push(...emphasisSpans(m[0]));
|
|
37860
37860
|
} else {
|
|
37861
37861
|
const anchor = m[2] || m[3];
|
|
37862
|
-
const href = _nullishCoalesce(
|
|
37862
|
+
const href = _nullishCoalesce(_chunkHVILFVATcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
37863
37863
|
const sub = emphasisSpans(anchor);
|
|
37864
37864
|
if (href) for (const s of sub) s.href = href;
|
|
37865
37865
|
spans.push(...sub);
|
|
@@ -38080,7 +38080,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
38080
38080
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
38081
38081
|
const got = m ? Number(m[1]) : NaN;
|
|
38082
38082
|
if (got !== startId + i) {
|
|
38083
|
-
throw new (0,
|
|
38083
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(
|
|
38084
38084
|
`\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)`
|
|
38085
38085
|
);
|
|
38086
38086
|
}
|
|
@@ -38171,7 +38171,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
38171
38171
|
}
|
|
38172
38172
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
38173
38173
|
if (rows.length !== expectedBase) {
|
|
38174
|
-
throw new (0,
|
|
38174
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(
|
|
38175
38175
|
`\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`
|
|
38176
38176
|
);
|
|
38177
38177
|
}
|
|
@@ -38679,7 +38679,7 @@ function variantMapper(fit, blockIdx, base = CHAR_VARIANT_BASE) {
|
|
|
38679
38679
|
const vi = fit.variants.indexOf(r);
|
|
38680
38680
|
return (id) => id >= 0 && id <= 3 ? base + vi * 4 + id : id;
|
|
38681
38681
|
}
|
|
38682
|
-
var ORDINAL_SYLLABLES = new Set(Array.from({ length: 84 }, (_, i) =>
|
|
38682
|
+
var ORDINAL_SYLLABLES = new Set(Array.from({ length: 84 }, (_, i) => _chunkZBHS7KLWcjs.hangulOrdinal.call(void 0, i)));
|
|
38683
38683
|
function literalMarkerDepth(text) {
|
|
38684
38684
|
const t = text.trimStart();
|
|
38685
38685
|
let m;
|
|
@@ -39180,7 +39180,7 @@ function bestSimInRange(arr, from, to, target) {
|
|
|
39180
39180
|
return best;
|
|
39181
39181
|
}
|
|
39182
39182
|
function normForMatch(text) {
|
|
39183
|
-
return
|
|
39183
|
+
return _chunkZBHS7KLWcjs.sanitizeText.call(void 0, text.replace(/\\\$/g, "$").replace(/\\(?=<\/?(?:u|sup|sub)>)/g, "")).replace(/\s+/g, " ").trim();
|
|
39184
39184
|
}
|
|
39185
39185
|
function unescapeGfm(text) {
|
|
39186
39186
|
return text.replace(/\\([~*_`|#<$\\])/g, "$1");
|
|
@@ -39202,7 +39202,7 @@ function replicateGfmTable(table2) {
|
|
|
39202
39202
|
const cell2 = _optionalChain([cells, 'access', _638 => _638[r], 'optionalAccess', _639 => _639[c]]);
|
|
39203
39203
|
if (!cell2) continue;
|
|
39204
39204
|
display[r][c] = {
|
|
39205
|
-
text:
|
|
39205
|
+
text: _chunkZBHS7KLWcjs.escapeGfm.call(void 0, _chunkZBHS7KLWcjs.sanitizeText.call(void 0, cell2.text)).replace(/(?<!\\)\|/g, "\\|").replace(/\r\n|\r|\n/g, "<br>"),
|
|
39206
39206
|
gridR: r,
|
|
39207
39207
|
gridC: c
|
|
39208
39208
|
};
|
|
@@ -39242,16 +39242,16 @@ function replicateCellInnerHtml(cell2) {
|
|
|
39242
39242
|
if (_optionalChain([cell2, 'access', _640 => _640.blocks, 'optionalAccess', _641 => _641.length])) {
|
|
39243
39243
|
return cell2.blocks.map((b) => {
|
|
39244
39244
|
if (b.type === "table" && b.table) {
|
|
39245
|
-
const cap = b.table.caption ?
|
|
39246
|
-
return (cap ?
|
|
39245
|
+
const cap = b.table.caption ? _chunkZBHS7KLWcjs.sanitizeText.call(void 0, b.table.caption) : "";
|
|
39246
|
+
return (cap ? _chunkZBHS7KLWcjs.escapeHtmlCellText.call(void 0, cap) + "<br>" : "") + replicateTableToHtml(b.table);
|
|
39247
39247
|
}
|
|
39248
|
-
if (b.type === "image" && b.text) return `<img src="${
|
|
39249
|
-
const note =
|
|
39250
|
-
const t = (
|
|
39251
|
-
return ((t ?
|
|
39248
|
+
if (b.type === "image" && b.text) return `<img src="${_chunkHVILFVATcjs.escapeHtml.call(void 0, b.text, true)}" alt="image">`;
|
|
39249
|
+
const note = _chunkZBHS7KLWcjs.noteTableHtml.call(void 0, b);
|
|
39250
|
+
const t = (_chunkZBHS7KLWcjs.sanitizeText.call(void 0, _chunkZBHS7KLWcjs.visibleText.call(void 0, b)) + (note ? "" : _chunkZBHS7KLWcjs.noteSuffix.call(void 0, b))).trim();
|
|
39251
|
+
return ((t ? _chunkZBHS7KLWcjs.escapeHtmlCellText.call(void 0, t).replace(/\n/g, "<br>") : "") + note).trim();
|
|
39252
39252
|
}).filter(Boolean).join("<br>");
|
|
39253
39253
|
}
|
|
39254
|
-
return
|
|
39254
|
+
return _chunkZBHS7KLWcjs.escapeHtmlCellText.call(void 0, _chunkZBHS7KLWcjs.sanitizeText.call(void 0, cell2.text)).replace(/\n/g, "<br>");
|
|
39255
39255
|
}
|
|
39256
39256
|
function replicateTableToHtml(table2) {
|
|
39257
39257
|
const rows = replicateHtmlTable(table2);
|
|
@@ -39328,7 +39328,7 @@ function parseHtmlTable(raw) {
|
|
|
39328
39328
|
const cs = parseInt(_optionalChain([attrs, 'access', _644 => _644.match, 'call', _645 => _645(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _646 => _646[1]]) || "1", 10);
|
|
39329
39329
|
const rs = parseInt(_optionalChain([attrs, 'access', _647 => _647.match, 'call', _648 => _648(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _649 => _649[1]]) || "1", 10);
|
|
39330
39330
|
cellStart = m.index + m[0].length;
|
|
39331
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
39331
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkZBHS7KLWcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkZBHS7KLWcjs.MAX_ROWS) };
|
|
39332
39332
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
39333
39333
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
39334
39334
|
cellStart = -1;
|
|
@@ -39353,11 +39353,11 @@ function htmlCellInnerToLines(inner) {
|
|
|
39353
39353
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
39354
39354
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
39355
39355
|
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _650 => _650[1]]), () => ( _optionalChain([m, 'optionalAccess', _651 => _651[2]])));
|
|
39356
|
-
if (src) imgSrcs.push(
|
|
39356
|
+
if (src) imgSrcs.push(_chunkHVILFVATcjs.unescapeHtml.call(void 0, src));
|
|
39357
39357
|
return "";
|
|
39358
39358
|
});
|
|
39359
39359
|
}
|
|
39360
|
-
const lines = work.split(/<br\s*\/?>/gi).map((s) =>
|
|
39360
|
+
const lines = work.split(/<br\s*\/?>/gi).map((s) => _chunkHVILFVATcjs.unescapeHtml.call(void 0, s).trim()).filter((s) => s.length > 0);
|
|
39361
39361
|
return { lines, hadNonText, imgSrcs };
|
|
39362
39362
|
}
|
|
39363
39363
|
function splitCellByTopLevelTables(html) {
|
|
@@ -40188,8 +40188,8 @@ function layoutHtmlRows(rows) {
|
|
|
40188
40188
|
let c = 0;
|
|
40189
40189
|
for (const cell2 of rows[r].cells) {
|
|
40190
40190
|
while (occupied.has(`${r},${c}`)) c++;
|
|
40191
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
40192
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
40191
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkZBHS7KLWcjs.MAX_COLS);
|
|
40192
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkZBHS7KLWcjs.MAX_ROWS);
|
|
40193
40193
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
40194
40194
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
40195
40195
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -41660,7 +41660,7 @@ function buildMinistryItemBand(n, text, ctx, before2) {
|
|
|
41660
41660
|
const base = { font: MINISTRY.bandFont, pt: s.pt, bold: false };
|
|
41661
41661
|
const f = fitOneLine(plain(text), MINISTRY.bandFont, s.pt, w - 1800, s.pt);
|
|
41662
41662
|
const styled = f.overflow || f.ratio === 100 && f.spacing === 0 ? base : { ...base, ratio: f.ratio, spacing: f.spacing };
|
|
41663
|
-
const runs = ministryRuns(
|
|
41663
|
+
const runs = ministryRuns(_chunkZBHS7KLWcjs.circledNumber.call(void 0, n - 1), text, ctx, styled, MINISTRY.blue, MINISTRY.blue);
|
|
41664
41664
|
const p = reg.para({ align: "LEFT", lineSp: 130, left: 300 });
|
|
41665
41665
|
const cell2 = tc({ bf: band, row: 0, col: 0, w, h: s.h, paras: `<hp:p paraPrIDRef="${p}" styleIDRef="0">${runs}</hp:p>`, name: "__kordoc_h5" });
|
|
41666
41666
|
return host(ftbl([cell2], w, s.h, 1, { bottomGap: 700 }), reg.para({ align: "LEFT", lineSp: 100, before: before2, keepWithNext: true }), reg.char(base));
|
|
@@ -42994,37 +42994,37 @@ async function readText(zip, name, budget) {
|
|
|
42994
42994
|
return s;
|
|
42995
42995
|
}
|
|
42996
42996
|
function assertWellFormed(xml, name) {
|
|
42997
|
-
if (xml.length > MAX_XML) throw new (0,
|
|
42998
|
-
if (/<!DOCTYPE/i.test(xml)) throw new (0,
|
|
42997
|
+
if (xml.length > MAX_XML) throw new (0, _chunkHVILFVATcjs.KordocError)(`\uACAC\uBCF8 ${name} \uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4 (${(xml.length / 1048576).toFixed(1)}MB)`);
|
|
42998
|
+
if (/<!DOCTYPE/i.test(xml)) throw new (0, _chunkHVILFVATcjs.KordocError)(`\uACAC\uBCF8 ${name} \uC5D0 DOCTYPE \uC774 \uC788\uC2B5\uB2C8\uB2E4 \u2014 \uD55C\uAE00 \uC800\uC7A5\uBCF8\uC774 \uC544\uB2D9\uB2C8\uB2E4`);
|
|
42999
42999
|
const issues = [];
|
|
43000
43000
|
createXmlParser(issues).parseFromString(xml, "text/xml");
|
|
43001
|
-
if (issues.some((w) => !/경고/.test(w.message))) throw new (0,
|
|
43001
|
+
if (issues.some((w) => !/경고/.test(w.message))) throw new (0, _chunkHVILFVATcjs.KordocError)(`\uACAC\uBCF8 ${name} XML \uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4: ${issues[0].message}`);
|
|
43002
43002
|
}
|
|
43003
43003
|
async function loadTemplateZip(template) {
|
|
43004
43004
|
const buf = template instanceof Uint8Array ? template.buffer.slice(template.byteOffset, template.byteOffset + template.byteLength) : template;
|
|
43005
|
-
|
|
43005
|
+
_chunkHVILFVATcjs.precheckZipSize.call(void 0, buf, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
43006
43006
|
let zip;
|
|
43007
43007
|
try {
|
|
43008
43008
|
zip = await _jszip2.default.loadAsync(buf);
|
|
43009
43009
|
} catch (e40) {
|
|
43010
|
-
throw new (0,
|
|
43010
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("\uACAC\uBCF8\uC774 HWPX(zip)\uAC00 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uD55C\uAE00\uC5D0\uC11C .hwpx \uB85C \uC800\uC7A5\uD55C \uD30C\uC77C\uC744 \uC4F0\uC138\uC694 (.hwp \uB294 kordoc \uC73C\uB85C \uBA3C\uC800 \uBCC0\uD658)");
|
|
43011
43011
|
}
|
|
43012
43012
|
const names = Object.keys(zip.files);
|
|
43013
|
-
if (names.length > MAX_ZIP_ENTRIES) throw new (0,
|
|
43013
|
+
if (names.length > MAX_ZIP_ENTRIES) throw new (0, _chunkHVILFVATcjs.KordocError)("\uACAC\uBCF8 ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
43014
43014
|
const bad = names.find((n) => n.split("/").includes("..") || n.startsWith("/") || n.includes("\\") || /^[A-Za-z]:/.test(n));
|
|
43015
|
-
if (bad) throw new (0,
|
|
43015
|
+
if (bad) throw new (0, _chunkHVILFVATcjs.KordocError)(`\uACAC\uBCF8 ZIP \uC5D0 \uD5C8\uC6A9\uD558\uC9C0 \uC54A\uB294 \uACBD\uB85C\uAC00 \uC788\uC2B5\uB2C8\uB2E4: ${bad.slice(0, 80)}`);
|
|
43016
43016
|
const budget = { used: 0 };
|
|
43017
43017
|
const manifest = zip.file("META-INF/manifest.xml");
|
|
43018
43018
|
if (manifest && isEncryptedHwpx(await readText(zip, "META-INF/manifest.xml", budget))) {
|
|
43019
|
-
throw new (0,
|
|
43019
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("\uC554\uD638\uAC00 \uAC78\uB9B0 \uACAC\uBCF8\uC785\uB2C8\uB2E4 \u2014 \uD55C\uAE00\uC5D0\uC11C \uC554\uD638\uB97C \uD480\uACE0 \uC800\uC7A5\uD55C \uD30C\uC77C\uC744 \uC4F0\uC138\uC694");
|
|
43020
43020
|
}
|
|
43021
43021
|
const sections = await resolveSectionPaths(zip);
|
|
43022
43022
|
if (!sections.length || !zip.file(sections[0]) || !zip.file("Contents/header.xml")) {
|
|
43023
|
-
throw new (0,
|
|
43023
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("\uACAC\uBCF8 HWPX \uC5D0 Contents/header.xml \uB610\uB294 section0.xml \uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
43024
43024
|
}
|
|
43025
43025
|
const sectionXmls = [];
|
|
43026
43026
|
for (const [i, name] of sections.entries()) {
|
|
43027
|
-
if (!zip.file(name)) throw new (0,
|
|
43027
|
+
if (!zip.file(name)) throw new (0, _chunkHVILFVATcjs.KordocError)(`\uACAC\uBCF8 HWPX \uC5D0 ${name} \uC774 \uC5C6\uC2B5\uB2C8\uB2E4`);
|
|
43028
43028
|
const xml = await readText(zip, name, budget);
|
|
43029
43029
|
if (i === 0) assertWellFormed(xml, name);
|
|
43030
43030
|
else try {
|
|
@@ -43195,7 +43195,7 @@ var FAMILY_ROLE = {
|
|
|
43195
43195
|
var SYM_EXTRA = /^(?:\p{S}|[【〔〈《])$/u;
|
|
43196
43196
|
var SUBTITLE_RE = /^-\s.*\s-$/u;
|
|
43197
43197
|
function lineRole(plain4) {
|
|
43198
|
-
const t =
|
|
43198
|
+
const t = _chunkZBHS7KLWcjs.mapPuaText.call(void 0, plain4.replace(/^[\s ]+/, ""));
|
|
43199
43199
|
if (!t || SUBTITLE_RE.test(t.trim())) return null;
|
|
43200
43200
|
const cls = markerClass(t);
|
|
43201
43201
|
if (FAMILY_ROLE[cls]) return FAMILY_ROLE[cls];
|
|
@@ -43230,7 +43230,7 @@ function fillParagraph(pXml, text, opts = {}) {
|
|
|
43230
43230
|
let prefixLen = ws, mStart = -1, mLen = 0;
|
|
43231
43231
|
if (opts.marker && ws < plain4.length) {
|
|
43232
43232
|
const cp = String.fromCodePoint(plain4.codePointAt(ws));
|
|
43233
|
-
if (isMarkerChar(
|
|
43233
|
+
if (isMarkerChar(_chunkZBHS7KLWcjs.mapPuaText.call(void 0, cp))) {
|
|
43234
43234
|
mStart = ws;
|
|
43235
43235
|
mLen = cp.length;
|
|
43236
43236
|
prefixLen = ws + mLen + /^[\s ]*/.exec(plain4.slice(ws + mLen))[0].length;
|
|
@@ -43402,7 +43402,7 @@ function styleKey(xml, m) {
|
|
|
43402
43402
|
const plain4 = paraPlain(m);
|
|
43403
43403
|
let prefix = /^[\s ]*/.exec(plain4)[0].length;
|
|
43404
43404
|
const cp = plain4.codePointAt(prefix);
|
|
43405
|
-
if (cp !== void 0 && isMarkerChar(
|
|
43405
|
+
if (cp !== void 0 && isMarkerChar(_chunkZBHS7KLWcjs.mapPuaText.call(void 0, String.fromCodePoint(cp)))) prefix += String.fromCodePoint(cp).length + /^[\s ]*/.exec(plain4.slice(prefix + String.fromCodePoint(cp).length))[0].length;
|
|
43406
43406
|
let best = "", bestN = 0, pos = 0;
|
|
43407
43407
|
for (const r of m.runs) {
|
|
43408
43408
|
let n = 0;
|
|
@@ -43499,7 +43499,7 @@ function scanTemplate(sectionXml, headerXml) {
|
|
|
43499
43499
|
contactInTitle = !!t && t.cells.some(isContactCell);
|
|
43500
43500
|
headBox = !!t && t.cells.some(isHeadBox);
|
|
43501
43501
|
}
|
|
43502
|
-
const subIdx = _nullishCoalesce(_optionalChain([head, 'access', _833 => _833.find, 'call', _834 => _834(({ x, i }) => i !== titleIdx && !x.tbl && x.objs === 0 && SUBTITLE_RE.test(
|
|
43502
|
+
const subIdx = _nullishCoalesce(_optionalChain([head, 'access', _833 => _833.find, 'call', _834 => _834(({ x, i }) => i !== titleIdx && !x.tbl && x.objs === 0 && SUBTITLE_RE.test(_chunkZBHS7KLWcjs.mapPuaText.call(void 0, x.plain.trim()))), 'optionalAccess', _835 => _835.i]), () => ( -1));
|
|
43503
43503
|
if (subIdx >= 0) set("subtitle", subIdx);
|
|
43504
43504
|
const summaryIdx = _nullishCoalesce(_optionalChain([head, 'access', _836 => _836.find, 'call', _837 => _837(({ x, i }) => i > titleIdx && _optionalChain([x, 'access', _838 => _838.tbl, 'optionalAccess', _839 => _839.rowCnt]) === 1 && x.tbl.colCnt === 1 && !CONTACT_RE.test(_nullishCoalesce(_optionalChain([x, 'access', _840 => _840.tbl, 'access', _841 => _841.cells, 'access', _842 => _842[0], 'optionalAccess', _843 => _843.text]), () => ( ""))) && !isTocBox(infos, i)), 'optionalAccess', _844 => _844.i]), () => ( -1));
|
|
43505
43505
|
if (summaryIdx >= 0) set("summary", summaryIdx);
|
|
@@ -44155,7 +44155,7 @@ async function markdownToHwpxFromTemplate(markdown, template, warnings = [], tot
|
|
|
44155
44155
|
let nextId = 1 + maxOf2(objIds);
|
|
44156
44156
|
let z = 1 + maxOf2([...scan.head.matchAll(OBJ_TAG_RE)].map((m) => Number(_nullishCoalesce(_optionalChain([/\bzOrder="(\d{1,10})"/, 'access', _951 => _951.exec, 'call', _952 => _952(m[0]), 'optionalAccess', _953 => _953[1]]), () => ( -1)))), -1);
|
|
44157
44157
|
const body = paras.join("").replace(OBJ_TAG_RE, (tag) => tag.replace(/\bid="\d*"/, () => `id="${nextId++}"`).replace(/\binstid="\d*"/, () => `instid="${nextId++}"`).replace(/\bzOrder="-?\d+"/, () => `zOrder="${z++}"`));
|
|
44158
|
-
if (body.length > MAX_OUTPUT) throw new (0,
|
|
44158
|
+
if (body.length > MAX_OUTPUT) throw new (0, _chunkHVILFVATcjs.KordocError)(`\uC0DD\uC131 \uBCF8\uBB38\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4 (${(body.length / 1048576).toFixed(1)}MB) \u2014 \uC6D0\uACE0\uB97C \uB098\uB220 \uB9CC\uB4DC\uC138\uC694`);
|
|
44159
44159
|
const tops = topLevelParagraphs(sectionXml);
|
|
44160
44160
|
const newSection = sectionXml.slice(0, _nullishCoalesce(_optionalChain([tops, 'access', _954 => _954[0], 'optionalAccess', _955 => _955.start]), () => ( sectionXml.lastIndexOf("</")))) + body + sectionXml.slice(_nullishCoalesce(_optionalChain([tops, 'access', _956 => _956.at, 'call', _957 => _957(-1), 'optionalAccess', _958 => _958.end]), () => ( sectionXml.lastIndexOf("</"))));
|
|
44161
44161
|
let newHeader = appendHeader(ctx);
|
|
@@ -44470,7 +44470,7 @@ function builtinTemplateDir() {
|
|
|
44470
44470
|
for (const c of candidates) {
|
|
44471
44471
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
44472
44472
|
}
|
|
44473
|
-
throw new (0,
|
|
44473
|
+
throw new (0, _chunkHVILFVATcjs.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)");
|
|
44474
44474
|
}
|
|
44475
44475
|
function readBuiltinTemplate(t) {
|
|
44476
44476
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -44949,12 +44949,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
44949
44949
|
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>`;
|
|
44950
44950
|
}
|
|
44951
44951
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
44952
|
-
if (ops.length === 0) throw new (0,
|
|
44952
|
+
if (ops.length === 0) throw new (0, _chunkHVILFVATcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
44953
44953
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
44954
|
-
|
|
44954
|
+
_chunkHVILFVATcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
44955
44955
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
44956
44956
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _1099 => _1099.match, 'call', _1100 => _1100(/(\d+)\.xml$/i), 'optionalAccess', _1101 => _1101[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _1102 => _1102.match, 'call', _1103 => _1103(/(\d+)\.xml$/i), 'optionalAccess', _1104 => _1104[1]]), () => ( 0))));
|
|
44957
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
44957
|
+
if (sectionPaths.length === 0) throw new (0, _chunkHVILFVATcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
44958
44958
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
44959
44959
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
44960
44960
|
const styles = headerPath ? parseRenderStyles(await readZipEntry(zip.file(headerPath), "text")) : null;
|
|
@@ -44995,11 +44995,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
44995
44995
|
const manifestItems = [];
|
|
44996
44996
|
const placed = [];
|
|
44997
44997
|
for (const op of ops) {
|
|
44998
|
-
if (!op.anchor) throw new (0,
|
|
44999
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
44998
|
+
if (!op.anchor) throw new (0, _chunkHVILFVATcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
44999
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkHVILFVATcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
45000
45000
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
45001
|
-
if (!MIME[ext]) throw new (0,
|
|
45002
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
45001
|
+
if (!MIME[ext]) throw new (0, _chunkHVILFVATcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
45002
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkHVILFVATcjs.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)`);
|
|
45003
45003
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
45004
45004
|
let found = null;
|
|
45005
45005
|
let total = 0;
|
|
@@ -45032,7 +45032,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
45032
45032
|
}
|
|
45033
45033
|
}
|
|
45034
45034
|
}
|
|
45035
|
-
throw new (0,
|
|
45035
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(
|
|
45036
45036
|
`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)})`
|
|
45037
45037
|
);
|
|
45038
45038
|
}
|
|
@@ -45040,7 +45040,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
45040
45040
|
const xml = sectionXmls[si];
|
|
45041
45041
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
45042
45042
|
if (!run) {
|
|
45043
|
-
throw new (0,
|
|
45043
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
45044
45044
|
}
|
|
45045
45045
|
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _1105 => _1105.charPr, 'access', _1106 => _1106.get, 'call', _1107 => _1107(run.charPr), 'optionalAccess', _1108 => _1108.height]), () => ( 1e3));
|
|
45046
45046
|
const fontPt = charPrHeight / 100;
|
|
@@ -45154,7 +45154,7 @@ function protoStyle(xml, ix) {
|
|
|
45154
45154
|
const plain4 = paraPlain(model);
|
|
45155
45155
|
let prefix = /^[\s ]*/.exec(plain4)[0].length;
|
|
45156
45156
|
const cp = plain4.codePointAt(prefix);
|
|
45157
|
-
if (cp !== void 0 && isMarkerChar(
|
|
45157
|
+
if (cp !== void 0 && isMarkerChar(_chunkZBHS7KLWcjs.mapPuaText.call(void 0, String.fromCodePoint(cp)))) {
|
|
45158
45158
|
prefix += String.fromCodePoint(cp).length;
|
|
45159
45159
|
prefix += /^[\s ]*/.exec(plain4.slice(prefix))[0].length;
|
|
45160
45160
|
}
|
|
@@ -45586,19 +45586,19 @@ function guideFor(name, manifest) {
|
|
|
45586
45586
|
}
|
|
45587
45587
|
async function buildAgencyPack(name, samples, into) {
|
|
45588
45588
|
const trimmed = name.trim();
|
|
45589
|
-
if (!trimmed || trimmed.length > 60) throw new (0,
|
|
45590
|
-
if (!samples.length) throw new (0,
|
|
45589
|
+
if (!trimmed || trimmed.length > 60) throw new (0, _chunkHVILFVATcjs.KordocError)("pack: \uAE30\uAD00 \uC774\uB984(1~60\uC790)\uC774 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
45590
|
+
if (!samples.length) throw new (0, _chunkHVILFVATcjs.KordocError)("pack: \uACAC\uBCF8 HWPX \uAC00 \uD55C \uAC74 \uC774\uC0C1 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
45591
45591
|
const byKind = /* @__PURE__ */ new Map();
|
|
45592
45592
|
for (const s of samples) {
|
|
45593
45593
|
const kind = _nullishCoalesce(s.kind, () => ( "report"));
|
|
45594
|
-
if (!KIND_RE.test(kind)) throw new (0,
|
|
45594
|
+
if (!KIND_RE.test(kind)) throw new (0, _chunkHVILFVATcjs.KordocError)(`pack: \uBB38\uC11C \uC885\uB958 \uC774\uB984 "${kind}" \u2014 \uC601\uBB38 \uC18C\uBB38\uC790\xB7\uC22B\uC790\xB7\uD55C\uAE00\xB7\uBD99\uC784\uD45C 1~20\uC790`);
|
|
45595
45595
|
byKind.set(kind, [..._nullishCoalesce(byKind.get(kind), () => ( [])), s.data]);
|
|
45596
45596
|
}
|
|
45597
45597
|
const manifest = {
|
|
45598
45598
|
kordocPack: PACK_FORMAT,
|
|
45599
45599
|
name: trimmed,
|
|
45600
45600
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
45601
|
-
kordocVersion:
|
|
45601
|
+
kordocVersion: _chunkHVILFVATcjs.VERSION,
|
|
45602
45602
|
kinds: { ..._nullishCoalesce(_optionalChain([into, 'optionalAccess', _1163 => _1163.manifest, 'access', _1164 => _1164.kinds]), () => ( {})) },
|
|
45603
45603
|
sources: (_nullishCoalesce(_optionalChain([into, 'optionalAccess', _1165 => _1165.manifest, 'access', _1166 => _1166.sources]), () => ( []))).filter((s) => !byKind.has(s.kind))
|
|
45604
45604
|
};
|
|
@@ -45609,7 +45609,7 @@ async function buildAgencyPack(name, samples, into) {
|
|
|
45609
45609
|
try {
|
|
45610
45610
|
sigs.push(await templateRoleStyles(data));
|
|
45611
45611
|
} catch (e) {
|
|
45612
|
-
throw new (0,
|
|
45612
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(`pack: ${kind} \uACAC\uBCF8 ${i + 1}\uBC88\uC9F8\uB97C \uC77D\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4 \u2014 ${e instanceof Error ? e.message : String(e)}`);
|
|
45613
45613
|
}
|
|
45614
45614
|
}
|
|
45615
45615
|
const pick2 = chooseRepresentative(sigs);
|
|
@@ -45667,7 +45667,7 @@ async function buildAgencyPack(name, samples, into) {
|
|
|
45667
45667
|
templates.set(kind, scrub.data);
|
|
45668
45668
|
for (const data of list) manifest.sources.push({ kind, sha256: _crypto.createHash.call(void 0, "sha256").update(data).digest("hex") });
|
|
45669
45669
|
}
|
|
45670
|
-
if (Object.keys(manifest.kinds).length > MAX_KINDS) throw new (0,
|
|
45670
|
+
if (Object.keys(manifest.kinds).length > MAX_KINDS) throw new (0, _chunkHVILFVATcjs.KordocError)(`pack: \uBB38\uC11C \uC885\uB958\uB294 ${MAX_KINDS}\uAC1C\uAE4C\uC9C0`);
|
|
45671
45671
|
const guide = guideFor(trimmed, manifest);
|
|
45672
45672
|
const zip = new (0, _jszip2.default)();
|
|
45673
45673
|
zip.file("pack.json", JSON.stringify(manifest, null, 2));
|
|
@@ -45677,19 +45677,19 @@ async function buildAgencyPack(name, samples, into) {
|
|
|
45677
45677
|
}
|
|
45678
45678
|
async function loadAgencyPack(data) {
|
|
45679
45679
|
const buf = data instanceof Uint8Array ? data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength) : data;
|
|
45680
|
-
if (buf.byteLength > MAX_PACK_BYTES) throw new (0,
|
|
45681
|
-
|
|
45680
|
+
if (buf.byteLength > MAX_PACK_BYTES) throw new (0, _chunkHVILFVATcjs.KordocError)("pack: \uD329 \uD30C\uC77C\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4");
|
|
45681
|
+
_chunkHVILFVATcjs.precheckZipSize.call(void 0, buf, MAX_DECOMPRESS_SIZE, 64);
|
|
45682
45682
|
let zip;
|
|
45683
45683
|
try {
|
|
45684
45684
|
zip = await _jszip2.default.loadAsync(buf);
|
|
45685
45685
|
} catch (e45) {
|
|
45686
|
-
throw new (0,
|
|
45686
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("pack: \uAE30\uAD00\uD329(.kpack, zip)\uC774 \uC544\uB2D9\uB2C8\uB2E4");
|
|
45687
45687
|
}
|
|
45688
45688
|
const names = Object.keys(zip.files).filter((n) => !zip.files[n].dir);
|
|
45689
45689
|
const allowed = (n) => n === "pack.json" || n === "guide.md" || /^kinds\/[a-z0-9\-가-힣]{1,20}\.hwpx$/u.test(n);
|
|
45690
45690
|
const bad = names.find((n) => !allowed(n));
|
|
45691
|
-
if (bad) throw new (0,
|
|
45692
|
-
if (!zip.file("pack.json")) throw new (0,
|
|
45691
|
+
if (bad) throw new (0, _chunkHVILFVATcjs.KordocError)(`pack: \uD329\uC5D0 \uD5C8\uC6A9\uD558\uC9C0 \uC54A\uB294 \uD30C\uC77C\uC774 \uC788\uC2B5\uB2C8\uB2E4: ${bad.slice(0, 80)} (pack.json\xB7guide.md\xB7kinds/*.hwpx \uB9CC)`);
|
|
45692
|
+
if (!zip.file("pack.json")) throw new (0, _chunkHVILFVATcjs.KordocError)("pack: pack.json \uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
45693
45693
|
let used = 0;
|
|
45694
45694
|
const text = async (n) => {
|
|
45695
45695
|
const s = await readZipEntry(zip.file(n), "text", used);
|
|
@@ -45700,24 +45700,24 @@ async function loadAgencyPack(data) {
|
|
|
45700
45700
|
try {
|
|
45701
45701
|
manifest = JSON.parse(await text("pack.json"));
|
|
45702
45702
|
} catch (e46) {
|
|
45703
|
-
throw new (0,
|
|
45703
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("pack: pack.json \uC774 \uC62C\uBC14\uB978 JSON \uC774 \uC544\uB2D9\uB2C8\uB2E4");
|
|
45704
45704
|
}
|
|
45705
|
-
if (_optionalChain([manifest, 'optionalAccess', _1168 => _1168.kordocPack]) !== PACK_FORMAT) throw new (0,
|
|
45706
|
-
if (typeof manifest.name !== "string" || !manifest.kinds || typeof manifest.kinds !== "object") throw new (0,
|
|
45705
|
+
if (_optionalChain([manifest, 'optionalAccess', _1168 => _1168.kordocPack]) !== PACK_FORMAT) throw new (0, _chunkHVILFVATcjs.KordocError)(`pack: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD329 \uD615\uC2DD \uD310 ${String(_optionalChain([manifest, 'optionalAccess', _1169 => _1169.kordocPack]))} \u2014 \uC774 kordoc \uC740 ${PACK_FORMAT}\uD310\uC744 \uC77D\uC2B5\uB2C8\uB2E4`);
|
|
45706
|
+
if (typeof manifest.name !== "string" || !manifest.kinds || typeof manifest.kinds !== "object") throw new (0, _chunkHVILFVATcjs.KordocError)("pack: pack.json \uC5D0 name\xB7kinds \uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
45707
45707
|
const templates = /* @__PURE__ */ new Map();
|
|
45708
45708
|
for (const [kind, info] of Object.entries(manifest.kinds)) {
|
|
45709
|
-
if (!KIND_RE.test(kind) || _optionalChain([info, 'optionalAccess', _1170 => _1170.template]) !== `kinds/${kind}.hwpx` || !zip.file(info.template)) throw new (0,
|
|
45709
|
+
if (!KIND_RE.test(kind) || _optionalChain([info, 'optionalAccess', _1170 => _1170.template]) !== `kinds/${kind}.hwpx` || !zip.file(info.template)) throw new (0, _chunkHVILFVATcjs.KordocError)(`pack: \uC885\uB958 ${kind.slice(0, 20)} \uC758 \uACAC\uBCF8\uC774 \uC5C6\uC2B5\uB2C8\uB2E4`);
|
|
45710
45710
|
const bytes = await readZipEntry(zip.file(info.template), "uint8array", used);
|
|
45711
45711
|
used += bytes.length;
|
|
45712
45712
|
templates.set(kind, bytes);
|
|
45713
45713
|
}
|
|
45714
|
-
if (!templates.size) throw new (0,
|
|
45714
|
+
if (!templates.size) throw new (0, _chunkHVILFVATcjs.KordocError)("pack: \uBB38\uC11C \uC885\uB958\uAC00 \uD558\uB098\uB3C4 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
45715
45715
|
return { manifest, templates, guide: zip.file("guide.md") ? await text("guide.md") : "" };
|
|
45716
45716
|
}
|
|
45717
45717
|
function resolvePackKind(pack, kind) {
|
|
45718
45718
|
const kinds = [...pack.templates.keys()];
|
|
45719
45719
|
const k = _nullishCoalesce(kind, () => ( (kinds.length === 1 ? kinds[0] : "report")));
|
|
45720
|
-
if (!pack.templates.has(k)) throw new (0,
|
|
45720
|
+
if (!pack.templates.has(k)) throw new (0, _chunkHVILFVATcjs.KordocError)(`pack: ${pack.manifest.name} \uD329\uC5D0 '${k}' \uC885\uB958\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 ${kinds.join("\xB7")} \uC911\uC5D0\uC11C \uACE0\uB974\uC138\uC694`);
|
|
45721
45721
|
return k;
|
|
45722
45722
|
}
|
|
45723
45723
|
function packTemplate(pack, kind) {
|
|
@@ -45943,7 +45943,7 @@ function pick(map, keys) {
|
|
|
45943
45943
|
return out;
|
|
45944
45944
|
}
|
|
45945
45945
|
async function hwpxToProfile(input) {
|
|
45946
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
45946
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkHVILFVATcjs.toArrayBuffer.call(void 0, input);
|
|
45947
45947
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
45948
45948
|
const parser = createXmlParser();
|
|
45949
45949
|
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _1194 => _1194.file, 'call', _1195 => _1195(/[Hh]eader\.xml$/), 'optionalAccess', _1196 => _1196[0]])));
|
|
@@ -46280,7 +46280,7 @@ function moneyHangulCheck(m) {
|
|
|
46280
46280
|
const n = Number(m[1].replace(/,/g, ""));
|
|
46281
46281
|
const h = hangulToNumber(m[2].replace(/\s/g, ""));
|
|
46282
46282
|
if (!Number.isFinite(n) || h === null || h === n) return null;
|
|
46283
|
-
return `\uAE08${m[1]}\uC6D0(\uAE08${
|
|
46283
|
+
return `\uAE08${m[1]}\uC6D0(\uAE08${_chunkZBHS7KLWcjs.hangulAmount.call(void 0, n)}\uC6D0)`;
|
|
46284
46284
|
}
|
|
46285
46285
|
var RULES = [
|
|
46286
46286
|
// 날짜 ─ 온점 뒤 한 칸, 0 패딩 금지, 연도 4자리, 끝 마침표
|
|
@@ -46584,7 +46584,7 @@ function lintGongmunText(text, opts) {
|
|
|
46584
46584
|
}
|
|
46585
46585
|
function dictSuggest(code, match) {
|
|
46586
46586
|
const m = match.trim();
|
|
46587
|
-
if (code === "MONEY_NO_HANGUL") return `${m} \u2192 ${m}(\uAE08${
|
|
46587
|
+
if (code === "MONEY_NO_HANGUL") return `${m} \u2192 ${m}(\uAE08${_chunkZBHS7KLWcjs.hangulAmount.call(void 0, m)}\uC6D0)`;
|
|
46588
46588
|
if (code === "DATE_HYPHEN") {
|
|
46589
46589
|
const d = m.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);
|
|
46590
46590
|
if (d) return `${m} \u2192 ${d[1]}. ${Number(d[2])}. ${Number(d[3])}.`;
|
|
@@ -47902,7 +47902,7 @@ function patchTableRows(input) {
|
|
|
47902
47902
|
const cells = input.editedCells(ins.ei);
|
|
47903
47903
|
if (!cells) return skip("\uC0BD\uC785 \uD589\uC5D0 \uC774\uBBF8\uC9C0/\uC911\uCCA9\uD45C \uD3EC\uD568 \u2014 \uD589 \uCD94\uAC00 \uBBF8\uC9C0\uC6D0");
|
|
47904
47904
|
for (const cell2 of cells) {
|
|
47905
|
-
const unstable = cell2.lines.find((l) =>
|
|
47905
|
+
const unstable = cell2.lines.find((l) => _chunkZBHS7KLWcjs.sanitizeText.call(void 0, l) !== l);
|
|
47906
47906
|
if (unstable !== void 0) return skip("\uC0BD\uC785 \uD589\uC5D0 \uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
47907
47907
|
}
|
|
47908
47908
|
const tmplCells = scanTable.rows[template];
|
|
@@ -48151,14 +48151,14 @@ function buildEmbeddedLineSplices(para2, xml, newLines) {
|
|
|
48151
48151
|
}
|
|
48152
48152
|
if (text !== para2.text || !/[\r\n]/.test(text) || /<br\s*\/?\s*>/i.test(text)) return null;
|
|
48153
48153
|
const lines = text.split(/\r\n|\r|\n/);
|
|
48154
|
-
if (lines.length !== newLines.length || lines.some((line) => !line.trim() ||
|
|
48154
|
+
if (lines.length !== newLines.length || lines.some((line) => !line.trim() || _chunkZBHS7KLWcjs.sanitizeText.call(void 0, line) !== line.trim())) return null;
|
|
48155
48155
|
const splices = [];
|
|
48156
48156
|
let offset = 0;
|
|
48157
48157
|
for (let i = 0; i < lines.length; i++) {
|
|
48158
48158
|
const line = lines[i];
|
|
48159
48159
|
const orig = line.trim();
|
|
48160
48160
|
const next = newLines[i];
|
|
48161
|
-
if (
|
|
48161
|
+
if (_chunkZBHS7KLWcjs.sanitizeText.call(void 0, next) !== next || /[\r\n]/.test(next) || /[\uD800-\uDFFF]/u.test(next) || decodeXmlEntities(escapeXmlText(next)) !== next) return null;
|
|
48162
48162
|
let prefix = 0;
|
|
48163
48163
|
while (prefix < orig.length && prefix < next.length && orig[prefix] === next[prefix]) prefix++;
|
|
48164
48164
|
if (prefix > 0 && /[\uD800-\uDBFF]/.test(orig[prefix - 1]) && /[\uDC00-\uDFFF]/.test(_nullishCoalesce(orig[prefix], () => ( "")))) prefix--;
|
|
@@ -48395,12 +48395,12 @@ function stripCellTokens(text) {
|
|
|
48395
48395
|
}
|
|
48396
48396
|
function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
48397
48397
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
48398
|
-
const content =
|
|
48398
|
+
const content = _chunkZBHS7KLWcjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
48399
48399
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
48400
48400
|
const t = line.trim();
|
|
48401
48401
|
if (!t) return "";
|
|
48402
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
48403
|
-
return
|
|
48402
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkZBHS7KLWcjs.escapeGfm.call(void 0, t)}**`;
|
|
48403
|
+
return _chunkZBHS7KLWcjs.escapeGfm.call(void 0, t);
|
|
48404
48404
|
}).filter(Boolean);
|
|
48405
48405
|
if (replicaLines.join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
48406
48406
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -48414,7 +48414,7 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
48414
48414
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
48415
48415
|
const replica = [];
|
|
48416
48416
|
for (let r = 0; r < table2.rows; r++) {
|
|
48417
|
-
const line =
|
|
48417
|
+
const line = _chunkZBHS7KLWcjs.escapeGfm.call(void 0, _chunkZBHS7KLWcjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
48418
48418
|
if (line) replica.push({ line, gridR: r });
|
|
48419
48419
|
}
|
|
48420
48420
|
if (replica.map((x) => x.line).join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
@@ -48468,7 +48468,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
48468
48468
|
}
|
|
48469
48469
|
const splices = [];
|
|
48470
48470
|
let sectionIndex = -1;
|
|
48471
|
-
const unstable = newLines.find((l) =>
|
|
48471
|
+
const unstable = newLines.find((l) => _chunkZBHS7KLWcjs.sanitizeText.call(void 0, l) !== l);
|
|
48472
48472
|
if (unstable !== void 0) 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");
|
|
48473
48473
|
if (ctx.structure && newLines.length > Math.max(nonEmpty.length, 1) || ctx.structure && nonEmpty.length > 1 && newLines.length < nonEmpty.length) {
|
|
48474
48474
|
const done = restructureCellLines(cell2.paragraphs, newLines, ctx.scans, ctx.sectionSplices, normForMatch);
|
|
@@ -48535,7 +48535,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
48535
48535
|
const paths = parseSectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
48536
48536
|
if (paths.length > 0) return paths;
|
|
48537
48537
|
}
|
|
48538
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
48538
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkHVILFVATcjs.compareSectionPaths);
|
|
48539
48539
|
}
|
|
48540
48540
|
|
|
48541
48541
|
// src/roundtrip/hwp5-patch.ts
|
|
@@ -49331,7 +49331,7 @@ function patchParagraph(block, orig, edited, ctx, skip) {
|
|
|
49331
49331
|
}
|
|
49332
49332
|
const origPlain = block.text != null ? block.text : restoreBr(textUnitToPlain(orig.raw, block));
|
|
49333
49333
|
if (newPlain === origPlain) return skip("\uD14D\uC2A4\uD2B8 \uC678 \uBCC0\uACBD(\uD5E4\uB529 \uB808\uBCA8/\uC11C\uC2DD)\uB9CC \uAC10\uC9C0 \u2014 \uC2A4\uD0C0\uC77C \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
49334
|
-
if (
|
|
49334
|
+
if (_chunkZBHS7KLWcjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
49335
49335
|
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");
|
|
49336
49336
|
}
|
|
49337
49337
|
let origMd = restoreBr(textUnitToPlain(orig.raw, block));
|
|
@@ -49378,7 +49378,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
49378
49378
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
49379
49379
|
continue;
|
|
49380
49380
|
}
|
|
49381
|
-
if (afterEach.some((l) =>
|
|
49381
|
+
if (afterEach.some((l) => _chunkZBHS7KLWcjs.sanitizeText.call(void 0, l) !== l)) {
|
|
49382
49382
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
49383
49383
|
continue;
|
|
49384
49384
|
}
|
|
@@ -49406,7 +49406,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
49406
49406
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
49407
49407
|
break;
|
|
49408
49408
|
}
|
|
49409
|
-
if (
|
|
49409
|
+
if (_chunkZBHS7KLWcjs.sanitizeText.call(void 0, after2) !== after2) {
|
|
49410
49410
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
49411
49411
|
break;
|
|
49412
49412
|
}
|
|
@@ -49462,12 +49462,12 @@ function patchHtmlCells5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
49462
49462
|
}
|
|
49463
49463
|
function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
49464
49464
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
49465
|
-
const content =
|
|
49465
|
+
const content = _chunkZBHS7KLWcjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
49466
49466
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
49467
49467
|
const t = line.trim();
|
|
49468
49468
|
if (!t) return "";
|
|
49469
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
49470
|
-
return
|
|
49469
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkZBHS7KLWcjs.escapeGfm.call(void 0, t)}**`;
|
|
49470
|
+
return _chunkZBHS7KLWcjs.escapeGfm.call(void 0, t);
|
|
49471
49471
|
}).filter(Boolean);
|
|
49472
49472
|
if (replicaLines.join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
49473
49473
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -49481,7 +49481,7 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
49481
49481
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
49482
49482
|
const replica = [];
|
|
49483
49483
|
for (let r = 0; r < table2.rows; r++) {
|
|
49484
|
-
const line =
|
|
49484
|
+
const line = _chunkZBHS7KLWcjs.escapeGfm.call(void 0, _chunkZBHS7KLWcjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
49485
49485
|
if (line) replica.push({ line, gridR: r });
|
|
49486
49486
|
}
|
|
49487
49487
|
if (replica.map((x) => x.line).join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
@@ -49522,7 +49522,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
49522
49522
|
if (origLineCount !== void 0 && nonEmpty.length > 0 && origLineCount !== nonEmpty.length) {
|
|
49523
49523
|
return skip("\uC140 \uC904 \uACBD\uACC4 \uB9E4\uD551 \uBAA8\uD638 (\uBB38\uB2E8 \uB0B4 \uC904\uBC14\uAFC8) \u2014 \uBBF8\uC9C0\uC6D0");
|
|
49524
49524
|
}
|
|
49525
|
-
const unstable = newLines.find((l) =>
|
|
49525
|
+
const unstable = newLines.find((l) => _chunkZBHS7KLWcjs.sanitizeText.call(void 0, l) !== l);
|
|
49526
49526
|
if (unstable !== void 0) 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");
|
|
49527
49527
|
const targets = nonEmpty.length > 0 ? nonEmpty : cell2.paras;
|
|
49528
49528
|
if (targets.length === 0) return skip("\uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC74C \u2014 \uBBF8\uC9C0\uC6D0");
|
|
@@ -49941,12 +49941,12 @@ function buildOrigUnits(blocks) {
|
|
|
49941
49941
|
const block = blocks[i];
|
|
49942
49942
|
let consume = 1;
|
|
49943
49943
|
let chunk;
|
|
49944
|
-
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(
|
|
49944
|
+
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(_chunkZBHS7KLWcjs.sanitizeText.call(void 0, block.text))) {
|
|
49945
49945
|
const next = blocks[i + 1];
|
|
49946
49946
|
if (_optionalChain([next, 'optionalAccess', _1315 => _1315.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
49947
|
-
chunk =
|
|
49947
|
+
chunk = _chunkZBHS7KLWcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
49948
49948
|
} else {
|
|
49949
|
-
chunk =
|
|
49949
|
+
chunk = _chunkZBHS7KLWcjs.blocksToMarkdown.call(void 0, [block]);
|
|
49950
49950
|
}
|
|
49951
49951
|
if (chunk) {
|
|
49952
49952
|
const subUnits = splitMarkdownUnits(chunk);
|
|
@@ -50244,7 +50244,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
50244
50244
|
}
|
|
50245
50245
|
}
|
|
50246
50246
|
if (newPlain === origPlain) return skip("\uD14D\uC2A4\uD2B8 \uC678 \uBCC0\uACBD(\uD5E4\uB529 \uB808\uBCA8/\uC11C\uC2DD)\uB9CC \uAC10\uC9C0 \u2014 \uC2A4\uD0C0\uC77C \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
50247
|
-
if (
|
|
50247
|
+
if (_chunkZBHS7KLWcjs.sanitizeText.call(void 0, newPlain) !== newPlain && _chunkZBHS7KLWcjs.sanitizeText.call(void 0, origPlain) === origPlain) {
|
|
50248
50248
|
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");
|
|
50249
50249
|
}
|
|
50250
50250
|
const xml = _optionalChain([ctx, 'access', _1329 => _1329.scans, 'access', _1330 => _1330[mapping.para.sectionIndex], 'optionalAccess', _1331 => _1331.xml]);
|
|
@@ -50261,14 +50261,14 @@ function textUnitToPlain(raw, block) {
|
|
|
50261
50261
|
}
|
|
50262
50262
|
function textUnitInline(raw, block) {
|
|
50263
50263
|
let text = raw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
50264
|
-
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(
|
|
50264
|
+
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(_chunkZBHS7KLWcjs.sanitizeText.call(void 0, block.text))) {
|
|
50265
50265
|
text = text.replace(/^#{1,6}\s+/, "");
|
|
50266
50266
|
}
|
|
50267
50267
|
if (block.href) {
|
|
50268
50268
|
const linkMatch = text.match(/^\[([\s\S]*)\]\([^)]*\)$/);
|
|
50269
50269
|
if (linkMatch) text = linkMatch[1];
|
|
50270
50270
|
}
|
|
50271
|
-
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(
|
|
50271
|
+
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(_chunkZBHS7KLWcjs.sanitizeText.call(void 0, block.text))) {
|
|
50272
50272
|
text = text.slice(1, -1);
|
|
50273
50273
|
}
|
|
50274
50274
|
return text;
|
|
@@ -52819,7 +52819,7 @@ function blocksToChunks(blocks, options) {
|
|
|
52819
52819
|
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1362 => _1362.granularity]), () => ( "section"));
|
|
52820
52820
|
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1363 => _1363.includeTableCells]), () => ( false));
|
|
52821
52821
|
const mdOptions = { tableFormat: _optionalChain([options, 'optionalAccess', _1364 => _1364.tableFormat]) };
|
|
52822
|
-
if (_optionalChain([options, 'optionalAccess', _1365 => _1365.tableFormat]) === "gfm")
|
|
52822
|
+
if (_optionalChain([options, 'optionalAccess', _1365 => _1365.tableFormat]) === "gfm") _chunkZBHS7KLWcjs.assignTableIds.call(void 0, blocks);
|
|
52823
52823
|
const chunks = [];
|
|
52824
52824
|
const headingStack = [];
|
|
52825
52825
|
const listStack = [];
|
|
@@ -52833,12 +52833,12 @@ function blocksToChunks(blocks, options) {
|
|
|
52833
52833
|
let run = null;
|
|
52834
52834
|
const flushRun = () => {
|
|
52835
52835
|
if (!run) return;
|
|
52836
|
-
push("text", run.breadcrumb,
|
|
52836
|
+
push("text", run.breadcrumb, _chunkZBHS7KLWcjs.blocksToMarkdown.call(void 0, run.blocks, mdOptions), [run.start, run.end], run.page);
|
|
52837
52837
|
run = null;
|
|
52838
52838
|
};
|
|
52839
52839
|
for (let i = 0; i < blocks.length; i++) {
|
|
52840
52840
|
const block = blocks[i];
|
|
52841
|
-
const md2 =
|
|
52841
|
+
const md2 = _chunkZBHS7KLWcjs.blocksToMarkdown.call(void 0, [block], mdOptions);
|
|
52842
52842
|
if (!md2) continue;
|
|
52843
52843
|
if (block.type === "heading") {
|
|
52844
52844
|
flushRun();
|
|
@@ -52926,7 +52926,7 @@ function u8ToArrayBuffer2(u8) {
|
|
|
52926
52926
|
return u8.buffer.slice(u8.byteOffset, u8.byteOffset + u8.byteLength);
|
|
52927
52927
|
}
|
|
52928
52928
|
function irCellLines(text) {
|
|
52929
|
-
return stripCellTokens(
|
|
52929
|
+
return stripCellTokens(_chunkZBHS7KLWcjs.sanitizeText.call(void 0, text)).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
52930
52930
|
}
|
|
52931
52931
|
var HwpxSession = (_class10 = class _HwpxSession {
|
|
52932
52932
|
|
|
@@ -53186,7 +53186,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
53186
53186
|
if (newPlain === "") {
|
|
53187
53187
|
return skip("\uBE14\uB85D \uBE44\uC6B0\uAE30/\uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 (v1) \u2014 \uC6D0\uBCF8 \uC720\uC9C0");
|
|
53188
53188
|
}
|
|
53189
|
-
if (
|
|
53189
|
+
if (_chunkZBHS7KLWcjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
53190
53190
|
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");
|
|
53191
53191
|
}
|
|
53192
53192
|
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _1385 => _1385.scans, 'access', _1386 => _1386[mapping.para.sectionIndex], 'optionalAccess', _1387 => _1387.xml]));
|
|
@@ -53281,7 +53281,7 @@ var md = new (0, _markdownit2.default)({
|
|
|
53281
53281
|
});
|
|
53282
53282
|
var SAFE_RAW_TAG = /^(?:<\/?(?:table|thead|tbody|tfoot|tr|th|td|u)>|<br\s*\/?>|<(?:th|td)(?: (?:colspan|rowspan)="[1-9]\d*"){1,2}>|<img src="(?:images\/(?:[^"'<>\/\s]+\/)?)?image_\d+\.(?:png|jpe?g|gif|webp|bmp)" alt="image">)$/i;
|
|
53283
53283
|
function sanitizeRawHtml(raw) {
|
|
53284
|
-
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag :
|
|
53284
|
+
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag : _chunkHVILFVATcjs.escapeHtml.call(void 0, tag));
|
|
53285
53285
|
}
|
|
53286
53286
|
md.renderer.rules.html_block = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
53287
53287
|
md.renderer.rules.html_inline = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
@@ -53289,7 +53289,7 @@ function renderHtml(markdown, options) {
|
|
|
53289
53289
|
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1391 => _1391.preset]), () => ( "default"));
|
|
53290
53290
|
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _1392 => _1392.extraCss]), () => ( "")));
|
|
53291
53291
|
const body = md.render(markdown);
|
|
53292
|
-
const watermark = _optionalChain([options, 'optionalAccess', _1393 => _1393.watermark]) ? `<div class="watermark">${
|
|
53292
|
+
const watermark = _optionalChain([options, 'optionalAccess', _1393 => _1393.watermark]) ? `<div class="watermark">${_chunkHVILFVATcjs.escapeHtml.call(void 0, options.watermark)}</div>` : "";
|
|
53293
53293
|
const watermarkCss = _optionalChain([options, 'optionalAccess', _1394 => _1394.watermark]) ? `
|
|
53294
53294
|
.watermark {
|
|
53295
53295
|
position: fixed;
|
|
@@ -53343,13 +53343,13 @@ async function htmlToPdf(html, options) {
|
|
|
53343
53343
|
try {
|
|
53344
53344
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
53345
53345
|
} catch (e49) {
|
|
53346
|
-
throw new (0,
|
|
53346
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(
|
|
53347
53347
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
53348
53348
|
);
|
|
53349
53349
|
}
|
|
53350
53350
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
53351
53351
|
if (!executablePath) {
|
|
53352
|
-
throw new (0,
|
|
53352
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(
|
|
53353
53353
|
"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."
|
|
53354
53354
|
);
|
|
53355
53355
|
}
|
|
@@ -53404,7 +53404,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
53404
53404
|
return htmlToPdf(html, options);
|
|
53405
53405
|
}
|
|
53406
53406
|
async function blocksToPdf(blocks, options) {
|
|
53407
|
-
const markdown =
|
|
53407
|
+
const markdown = _chunkZBHS7KLWcjs.blocksToMarkdown.call(void 0, blocks);
|
|
53408
53408
|
return markdownToPdf(markdown, options);
|
|
53409
53409
|
}
|
|
53410
53410
|
|
|
@@ -56705,7 +56705,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
56705
56705
|
if (st.italic) attrs.push(`font-style="italic"`);
|
|
56706
56706
|
if (st.underline) attrs.push(`text-decoration="underline"`);
|
|
56707
56707
|
if (st.color) attrs.push(`fill="${escapeXml7(st.color)}"`);
|
|
56708
|
-
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(
|
|
56708
|
+
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(_chunkZBHS7KLWcjs.mapPuaText.call(void 0, text))}</text>`);
|
|
56709
56709
|
ctx.stats.texts++;
|
|
56710
56710
|
}
|
|
56711
56711
|
return sw;
|
|
@@ -57050,13 +57050,14 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
57050
57050
|
rowSum.set(c.ra, r);
|
|
57051
57051
|
}
|
|
57052
57052
|
const noExactRow = ![...rowSum.values()].some((r) => r.cover === nCols && Math.abs(r.w - tblW) <= 2);
|
|
57053
|
-
const
|
|
57053
|
+
const sp = num2(tbl2, "cellSpacing");
|
|
57054
|
+
const colX = tableColumnBoundaries(colCons, nCols, (tblW && sp > 0 ? tblW - sp * (nCols + 1) : tblW) || void 0, noExactRow);
|
|
57054
57055
|
const rowH = measureTableRowHeights(tbl2, ctx.extentMemo);
|
|
57055
57056
|
const rowY = [0];
|
|
57056
57057
|
for (let r = 0; r < nRows; r++) rowY.push(rowY[r] + rowH[r]);
|
|
57057
57058
|
const tblH = rowY[nRows];
|
|
57058
57059
|
if (ty + tblH > ctx.pageH + 100) warnOnce(ctx, "table-split", "\uD398\uC774\uC9C0\uC5D0 \uAC78\uCE5C \uD45C \u2014 \uBD84\uD560 \uC9C0\uC624\uBA54\uD2B8\uB9AC\uAC00 \uC5C6\uC5B4 \uC2DC\uC791 \uD398\uC774\uC9C0 \uC601\uC5ED\uB9CC region \uC73C\uB85C \uAE30\uB85D");
|
|
57059
|
-
const tblId = ctx.regions.add("table", bboxOf(ctx, tx, ty, colX[nCols], tblH), { sourceId: _nullishCoalesce(tbl2.getAttribute("id"), () => ( void 0)), parentId: parentId(ctx) });
|
|
57060
|
+
const tblId = ctx.regions.add("table", bboxOf(ctx, tx, ty, colX[nCols] + (sp > 0 ? sp * (nCols + 1) : 0), tblH), { sourceId: _nullishCoalesce(tbl2.getAttribute("id"), () => ( void 0)), parentId: parentId(ctx) });
|
|
57060
57061
|
emit(ctx, regionOpenTag(tblId, "table", pageNo(ctx)));
|
|
57061
57062
|
ctx.parentStack.push(tblId);
|
|
57062
57063
|
const startPage = ctx.page;
|
|
@@ -57070,7 +57071,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
57070
57071
|
for (const pc of plan.flat()) for (const [el, py] of _nullishCoalesce(pc.place, () => ( []))) (ctx.objPlace ??= /* @__PURE__ */ new Map()).set(el, { page: startPage + pc.page, y: py });
|
|
57071
57072
|
const contPages = [...new Set(plan.flat().map((pc) => pc.page).filter((pg) => pg > 0))].map((pg) => startPage + pg);
|
|
57072
57073
|
while (ctx.pages.length <= Math.max(startPage, ...contPages)) ctx.pages.push([]);
|
|
57073
|
-
const xw = (c) => ({ x: tx + colX[c.ca], w: colX[Math.min(c.ca + c.cs, nCols)] - colX[c.ca] });
|
|
57074
|
+
const xw = (c) => ({ x: tx + colX[c.ca] + sp * c.ca, w: colX[Math.min(c.ca + c.cs, nCols)] - colX[c.ca] + sp * (c.cs - 1) });
|
|
57074
57075
|
const geom = [];
|
|
57075
57076
|
for (const c of cells) {
|
|
57076
57077
|
const pcs = plan[c.ra];
|
|
@@ -57100,6 +57101,10 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
57100
57101
|
}
|
|
57101
57102
|
const contBase = depth !== 1 && ctx.splitContMT !== void 0 ? ctx.splitContMT : ctx.geom.MT;
|
|
57102
57103
|
for (const page of contPages) for (const c of cells) if (c.ra < hdrRows) geom.push({ c, page, ...xw(c), y: contBase + num2(findChildByLocalName(tbl2, "outMargin"), "top") + rowY[c.ra], h: rowY[Math.min(c.ra + c.rs, nRows)] - rowY[c.ra] });
|
|
57104
|
+
if (sp > 0) for (const g3 of geom) {
|
|
57105
|
+
g3.y += sp;
|
|
57106
|
+
g3.h -= sp + (g3.c.ra + g3.c.rs >= nRows ? sp : 0);
|
|
57107
|
+
}
|
|
57103
57108
|
for (const g3 of geom) {
|
|
57104
57109
|
ctx.page = g3.page;
|
|
57105
57110
|
const bf = g3.c.bfId != null ? ctx.styles.borderFill.get(g3.c.bfId) : void 0;
|
|
@@ -57714,22 +57719,22 @@ function renderSectionRoots(sections, input) {
|
|
|
57714
57719
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${index}` });
|
|
57715
57720
|
ctxBase.pageBase += pages.length;
|
|
57716
57721
|
}
|
|
57717
|
-
if (rendered.length === 0) throw new (0,
|
|
57722
|
+
if (rendered.length === 0) throw new (0, _chunkHVILFVATcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
57718
57723
|
return { sections: rendered, defs: ctxBase.defs, warnings: input.warnings, stats: ctxBase.stats, regions: ctxBase.regions.regions };
|
|
57719
57724
|
}
|
|
57720
57725
|
var SVG_FONT_FAMILY = `'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif`;
|
|
57721
57726
|
async function renderHwpxInternal(input, options) {
|
|
57722
57727
|
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1736 => _1736.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
57723
57728
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
57724
|
-
|
|
57729
|
+
_chunkHVILFVATcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
57725
57730
|
let zip;
|
|
57726
57731
|
try {
|
|
57727
57732
|
zip = await _jszip2.default.loadAsync(input);
|
|
57728
57733
|
} catch (e50) {
|
|
57729
|
-
throw new (0,
|
|
57734
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
57730
57735
|
}
|
|
57731
|
-
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) =>
|
|
57732
|
-
if (secFiles.length === 0) throw new (0,
|
|
57736
|
+
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => _chunkHVILFVATcjs.compareSectionPaths.call(void 0, a.name, b.name));
|
|
57737
|
+
if (secFiles.length === 0) throw new (0, _chunkHVILFVATcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
57733
57738
|
const warnings = [];
|
|
57734
57739
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
57735
57740
|
const verFile = zip.file("version.xml");
|
|
@@ -57741,7 +57746,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
57741
57746
|
const secXmls = [];
|
|
57742
57747
|
for (const f of secFiles) {
|
|
57743
57748
|
const xml = await readZipEntry(f, "text");
|
|
57744
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
57749
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkHVILFVATcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
57745
57750
|
secXmls.push(xml);
|
|
57746
57751
|
}
|
|
57747
57752
|
if (headXml && hasKoPubSubst(headXml)) {
|
|
@@ -57752,7 +57757,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
57752
57757
|
const masterXmls = [];
|
|
57753
57758
|
for (const file of zip.file(/Contents\/masterpage[^/]*\.xml$/i)) {
|
|
57754
57759
|
const xml = await readZipEntry(file, "text");
|
|
57755
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
57760
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkHVILFVATcjs.KordocError)("\uBC14\uD0D5\uCABD XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
57756
57761
|
const root = createXmlParser().parseFromString(xml, "text/xml").documentElement;
|
|
57757
57762
|
if (root && ln(root) === "masterPage") {
|
|
57758
57763
|
masterPages.set(root.getAttribute("id") || file.name.replace(/^.*\/|\.xml$/g, ""), root);
|
|
@@ -57828,9 +57833,9 @@ async function renderHwpxInternal(input, options) {
|
|
|
57828
57833
|
}
|
|
57829
57834
|
if (roots.length === 0) {
|
|
57830
57835
|
if (noCacheSkipped) {
|
|
57831
|
-
throw new (0,
|
|
57836
|
+
throw new (0, _chunkHVILFVATcjs.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)");
|
|
57832
57837
|
}
|
|
57833
|
-
throw new (0,
|
|
57838
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
57834
57839
|
}
|
|
57835
57840
|
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1739 => _1739.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1740 => _1740.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1741 => _1741.highlights]) });
|
|
57836
57841
|
}
|
|
@@ -58055,7 +58060,7 @@ var FOLD_END = 42124;
|
|
|
58055
58060
|
var FOLD_SHIFT = 983040 - 40960;
|
|
58056
58061
|
function textChar(ch) {
|
|
58057
58062
|
if (ch >= FOLD_START && ch <= FOLD_END) {
|
|
58058
|
-
const mapped =
|
|
58063
|
+
const mapped = _chunkZBHS7KLWcjs.mapPuaText.call(void 0, String.fromCodePoint(ch + FOLD_SHIFT));
|
|
58059
58064
|
return /[\u{F0000}-\u{FFFFF}]/u.test(mapped) ? "" : mapped;
|
|
58060
58065
|
}
|
|
58061
58066
|
if (ch === 65534 || ch === 65535 || ch >= 55296 && ch <= 57343) return "\uFFFD";
|
|
@@ -58440,7 +58445,7 @@ function renderHwp5Records(docInfo, styles, secRecords, binData, options, select
|
|
|
58440
58445
|
}
|
|
58441
58446
|
roots.push({ root, index: si });
|
|
58442
58447
|
}
|
|
58443
|
-
if (roots.length === 0) throw new (0,
|
|
58448
|
+
if (roots.length === 0) throw new (0, _chunkHVILFVATcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP \uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
58444
58449
|
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1750 => _1750.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1751 => _1751.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1752 => _1752.highlights]) });
|
|
58445
58450
|
return assemblePageSvgs(r, "hwp", select);
|
|
58446
58451
|
}
|
|
@@ -58453,7 +58458,7 @@ function renderHwp5Pages(input, options, select) {
|
|
|
58453
58458
|
const styles = buildHwp5RenderStyles(_nullishCoalesce(docInfoRecords, () => ( [])));
|
|
58454
58459
|
const docInfo = docInfoRecords ? parseDocInfo(docInfoRecords) : null;
|
|
58455
58460
|
const sections = readHwp5SectionStreams(c);
|
|
58456
|
-
if (sections.length === 0) throw new (0,
|
|
58461
|
+
if (sections.length === 0) throw new (0, _chunkHVILFVATcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
58457
58462
|
const parseWarnings = [];
|
|
58458
58463
|
const secRecords = readHwp5SectionRecords(c, sections, parseWarnings);
|
|
58459
58464
|
for (const w of parseWarnings) warnings.push(w.message);
|
|
@@ -58539,14 +58544,14 @@ async function loadSharp() {
|
|
|
58539
58544
|
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("sharp")));
|
|
58540
58545
|
return _nullishCoalesce(mod.default, () => ( mod));
|
|
58541
58546
|
} catch (e53) {
|
|
58542
|
-
throw new (0,
|
|
58543
|
-
'PNG \uB798\uC2A4\uD130\uC5D0\uB294 sharp\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4 (npm install sharp). sharp \uC5C6\uC774 \uC4F0\uB824\uBA74 format: "svg" + output_path\uB85C SVG \uD30C\uC77C \uC800\uC7A5\uC744 \uC0AC\uC6A9\uD558\uC138\uC694.' +
|
|
58547
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(
|
|
58548
|
+
'PNG \uB798\uC2A4\uD130\uC5D0\uB294 sharp\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4 (npm install sharp). sharp \uC5C6\uC774 \uC4F0\uB824\uBA74 format: "svg" + output_path\uB85C SVG \uD30C\uC77C \uC800\uC7A5\uC744 \uC0AC\uC6A9\uD558\uC138\uC694.' + _chunkHVILFVATcjs.OPTIONAL_DEP_INSTALL_HINT
|
|
58544
58549
|
);
|
|
58545
58550
|
}
|
|
58546
58551
|
}
|
|
58547
58552
|
async function rasterizePageSvg(svg, widthPt, heightPt, options = {}) {
|
|
58548
58553
|
const sharp = await loadSharp();
|
|
58549
|
-
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0,
|
|
58554
|
+
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0, _chunkHVILFVATcjs.KordocError)(`\uC798\uBABB\uB41C \uD398\uC774\uC9C0 \uD06C\uAE30: ${widthPt}x${heightPt}pt`);
|
|
58550
58555
|
const maxW = _nullishCoalesce(options.maxWidthPx, () => ( 1400));
|
|
58551
58556
|
const maxH = _nullishCoalesce(options.maxHeightPx, () => ( 4e3));
|
|
58552
58557
|
const scale2 = Math.min(maxW / widthPt, maxH / heightPt, 2);
|
|
@@ -58564,11 +58569,11 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
58564
58569
|
try {
|
|
58565
58570
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
58566
58571
|
} catch (e54) {
|
|
58567
|
-
throw new (0,
|
|
58572
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("PDF \uB80C\uB354\uC5D0\uB294 puppeteer-core \uAC00 \uD544\uC694\uD569\uB2C8\uB2E4 (npm install puppeteer-core). SVG/HTML/PNG \uB294 Chromium \uC5C6\uC774 \uB429\uB2C8\uB2E4");
|
|
58568
58573
|
}
|
|
58569
58574
|
const executablePath = _nullishCoalesce(_nullishCoalesce(options.browserExecutablePath, () => ( process.env.PUPPETEER_EXECUTABLE_PATH)), () => ( findChromiumPath()));
|
|
58570
58575
|
if (!executablePath) {
|
|
58571
|
-
throw new (0,
|
|
58576
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)("Chromium \uC2E4\uD589 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 browserExecutablePath \uC635\uC158 \uB610\uB294 PUPPETEER_EXECUTABLE_PATH \uD658\uACBD\uBCC0\uC218\uB97C \uC9C0\uC815\uD558\uC138\uC694");
|
|
58572
58577
|
}
|
|
58573
58578
|
const { browser, page } = await launchLockedPage(puppeteer, executablePath);
|
|
58574
58579
|
try {
|
|
@@ -58584,13 +58589,13 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
58584
58589
|
async function loadBuffer(input) {
|
|
58585
58590
|
if (typeof input === "string") {
|
|
58586
58591
|
try {
|
|
58587
|
-
return
|
|
58592
|
+
return _chunkHVILFVATcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input));
|
|
58588
58593
|
} catch (err) {
|
|
58589
58594
|
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
58590
|
-
throw new (0,
|
|
58595
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`);
|
|
58591
58596
|
}
|
|
58592
58597
|
}
|
|
58593
|
-
if (Buffer.isBuffer(input)) return
|
|
58598
|
+
if (Buffer.isBuffer(input)) return _chunkHVILFVATcjs.toArrayBuffer.call(void 0, input);
|
|
58594
58599
|
if (input instanceof Uint8Array) return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
|
|
58595
58600
|
return input;
|
|
58596
58601
|
}
|
|
@@ -58599,17 +58604,17 @@ async function sourceFormatOf(buffer) {
|
|
|
58599
58604
|
if (format2 === "hwpx") {
|
|
58600
58605
|
const zip = await detectZipFormat(buffer);
|
|
58601
58606
|
if (zip === "hwpx" || zip === "unknown") return "hwpx";
|
|
58602
|
-
throw new (0,
|
|
58607
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(`\uB80C\uB354 \uBBF8\uC9C0\uC6D0 \uD615\uC2DD(${zip}) \u2014 \uB808\uC774\uC544\uC6C3 \uB80C\uB354\uB294 HWPX\xB7HWP \uB9CC \uC9C0\uC6D0\uD569\uB2C8\uB2E4`);
|
|
58603
58608
|
}
|
|
58604
58609
|
if (format2 === "hwp") return "hwp";
|
|
58605
|
-
throw new (0,
|
|
58610
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(`\uB80C\uB354 \uBBF8\uC9C0\uC6D0 \uD615\uC2DD(${format2}) \u2014 \uB808\uC774\uC544\uC6C3 \uB80C\uB354\uB294 HWPX\xB7HWP \uB9CC \uC9C0\uC6D0\uD569\uB2C8\uB2E4`);
|
|
58606
58611
|
}
|
|
58607
58612
|
async function renderDocumentToScene(input, options = {}) {
|
|
58608
58613
|
const buffer = await loadBuffer(input);
|
|
58609
58614
|
const source = await sourceFormatOf(buffer);
|
|
58610
58615
|
const select = options.pages !== void 0 ? (pageCount) => {
|
|
58611
58616
|
const set = _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, pageCount);
|
|
58612
|
-
if (set.size === 0) throw new (0,
|
|
58617
|
+
if (set.size === 0) throw new (0, _chunkHVILFVATcjs.KordocError)(`\uC120\uD0DD\uD55C \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uBB38\uC11C\uB294 ${pageCount}\uCABD (pages: ${JSON.stringify(options.pages)})`);
|
|
58613
58618
|
return set;
|
|
58614
58619
|
} : void 0;
|
|
58615
58620
|
const renderOptions = { reflow: _nullishCoalesce(options.reflow, () => ( true)), reflowMode: options.reflowMode, highlights: options.highlights, maxImageBytes: options.maxImageBytes };
|
|
@@ -58645,7 +58650,7 @@ async function renderDocument(input, options) {
|
|
|
58645
58650
|
break;
|
|
58646
58651
|
}
|
|
58647
58652
|
default:
|
|
58648
|
-
throw new (0,
|
|
58653
|
+
throw new (0, _chunkHVILFVATcjs.KordocError)(`\uC54C \uC218 \uC5C6\uB294 \uB80C\uB354 \uD3EC\uB9F7: ${String(options.format)} (svg|html|png|jpeg|pdf)`);
|
|
58649
58654
|
}
|
|
58650
58655
|
return { scene, assets };
|
|
58651
58656
|
}
|
|
@@ -58675,7 +58680,7 @@ async function extractRenderedRegions(input, options = {}) {
|
|
|
58675
58680
|
const out = [];
|
|
58676
58681
|
for (const [page, items] of [...byPage.entries()].sort((a, b) => a[0] - b[0])) {
|
|
58677
58682
|
const meta = scene.pages.find((p) => p.page === page);
|
|
58678
|
-
if (!meta) throw new (0,
|
|
58683
|
+
if (!meta) throw new (0, _chunkHVILFVATcjs.KordocError)(`\uD398\uC774\uC9C0 ${page} \uBA54\uD0C0 \uC5C6\uC74C`);
|
|
58679
58684
|
const raster = await rasterizePageSvg(pageSvgs.get(page), meta.width, meta.height, { format: format2, maxWidthPx: options.maxWidthPx, quality: options.quality });
|
|
58680
58685
|
for (const { region, bbox } of items) {
|
|
58681
58686
|
const rect = cropRect(bbox, raster.scale, raster.widthPx, raster.heightPx, _nullishCoalesce(options.paddingPt, () => ( 0)));
|
|
@@ -58699,9 +58704,9 @@ function wantsCrop(kind, policy) {
|
|
|
58699
58704
|
}
|
|
58700
58705
|
async function extractTables(input, options = {}) {
|
|
58701
58706
|
const policy = _nullishCoalesce(options.policy, () => ( "non-tabular-and-uncertain"));
|
|
58702
|
-
const buffer = typeof input === "string" ?
|
|
58707
|
+
const buffer = typeof input === "string" ? _chunkHVILFVATcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input)) : Buffer.isBuffer(input) ? _chunkHVILFVATcjs.toArrayBuffer.call(void 0, input) : input;
|
|
58703
58708
|
const parsed = await parse(buffer, { classifyTables: true, layoutTables: "keep" });
|
|
58704
|
-
if (!parsed.success) throw new (0,
|
|
58709
|
+
if (!parsed.success) throw new (0, _chunkHVILFVATcjs.KordocError)(`\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
58705
58710
|
const blocks = collectTableBlocks(parsed.blocks);
|
|
58706
58711
|
const out = blocks.map((b, i) => ({
|
|
58707
58712
|
id: _nullishCoalesce(b.table.sourceId, () => ( `tbl-${i + 1}`)),
|
|
@@ -58763,18 +58768,18 @@ async function parse(input, options) {
|
|
|
58763
58768
|
if (_optionalChain([opts, 'optionalAccess', _1754 => _1754.htmlTables]) && opts.tableFormat) {
|
|
58764
58769
|
return { success: false, fileType: "unknown", error: "htmlTables \uC640 tableFormat \uC740 \uD568\uAED8 \uC4F8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4" };
|
|
58765
58770
|
}
|
|
58766
|
-
const ocrOptionError =
|
|
58771
|
+
const ocrOptionError = _chunkZBHS7KLWcjs.validateOcrOptions.call(void 0, opts);
|
|
58767
58772
|
if (ocrOptionError) return { success: false, fileType: "unknown", error: ocrOptionError };
|
|
58768
58773
|
if (typeof input === "string") {
|
|
58769
58774
|
try {
|
|
58770
58775
|
const buf = await _promises.readFile.call(void 0, input);
|
|
58771
|
-
buffer =
|
|
58776
|
+
buffer = _chunkHVILFVATcjs.toArrayBuffer.call(void 0, buf);
|
|
58772
58777
|
} catch (err) {
|
|
58773
58778
|
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}`;
|
|
58774
|
-
return { success: false, fileType: "unknown", error: msg2, code:
|
|
58779
|
+
return { success: false, fileType: "unknown", error: msg2, code: _chunkHVILFVATcjs.classifyError.call(void 0, err) };
|
|
58775
58780
|
}
|
|
58776
58781
|
} else if (Buffer.isBuffer(input)) {
|
|
58777
|
-
buffer =
|
|
58782
|
+
buffer = _chunkHVILFVATcjs.toArrayBuffer.call(void 0, input);
|
|
58778
58783
|
} else {
|
|
58779
58784
|
buffer = input;
|
|
58780
58785
|
}
|
|
@@ -58793,7 +58798,7 @@ async function parse(input, options) {
|
|
|
58793
58798
|
out = { ...result, warnings: [..._nullishCoalesce(result.warnings, () => ( [])), { code: "PARTIAL_PARSE", message: `\uC694\uCCAD\uD55C \uCABD \uBC94\uC704(${opts.pages})\uAC00 \uBB38\uC11C \uCABD(1~${result.pageCount})\uACFC \uACB9\uCE58\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4` }] };
|
|
58794
58799
|
}
|
|
58795
58800
|
if (out.success && !out.pages) {
|
|
58796
|
-
const pages =
|
|
58801
|
+
const pages = _chunkV26UPU2Lcjs.blocksToPages.call(void 0, out.blocks, (bs) => _chunkZBHS7KLWcjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([opts, 'optionalAccess', _1758 => _1758.tableFormat]) }));
|
|
58797
58802
|
if (pages) out = { ...out, pages };
|
|
58798
58803
|
}
|
|
58799
58804
|
if (out.success && _optionalChain([opts, 'optionalAccess', _1759 => _1759.plain])) {
|
|
@@ -58844,34 +58849,34 @@ async function dispatch(format2, buffer, opts) {
|
|
|
58844
58849
|
async function withEmbeddedImageOcr(blocks, markdown, warnings, images, options) {
|
|
58845
58850
|
const list = [..._nullishCoalesce(warnings, () => ( []))];
|
|
58846
58851
|
if (!await ocrEmbeddedImages(blocks, options, list)) return { markdown, warnings: list.length ? list : void 0 };
|
|
58847
|
-
let md2 =
|
|
58852
|
+
let md2 = _chunkZBHS7KLWcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1761 => _1761.tableFormat]) });
|
|
58848
58853
|
if (_optionalChain([options, 'optionalAccess', _1762 => _1762.inlineImages]) && options.images !== false && _optionalChain([images, 'optionalAccess', _1763 => _1763.length])) {
|
|
58849
58854
|
try {
|
|
58850
|
-
md2 =
|
|
58855
|
+
md2 = _chunkV26UPU2Lcjs.inlineImagesIntoMarkdown.call(void 0, md2, images, { compress: true });
|
|
58851
58856
|
} catch (e55) {
|
|
58852
58857
|
}
|
|
58853
58858
|
}
|
|
58854
58859
|
return { markdown: md2, warnings: list.length ? list : void 0 };
|
|
58855
58860
|
}
|
|
58856
58861
|
function scriptsOff(r, off) {
|
|
58857
|
-
return off ?
|
|
58862
|
+
return off ? _chunkZBHS7KLWcjs.stripScriptTags.call(void 0, r) : r;
|
|
58858
58863
|
}
|
|
58859
58864
|
async function parseImage(buffer, options) {
|
|
58860
58865
|
try {
|
|
58861
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
58866
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-GY7SZAHN.cjs")));
|
|
58862
58867
|
const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
|
|
58863
|
-
|
|
58868
|
+
_chunkZBHS7KLWcjs.stripScriptTags.call(void 0, { blocks });
|
|
58864
58869
|
return {
|
|
58865
58870
|
success: true,
|
|
58866
58871
|
fileType: "image",
|
|
58867
|
-
markdown:
|
|
58872
|
+
markdown: _chunkZBHS7KLWcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1764 => _1764.tableFormat]) }),
|
|
58868
58873
|
blocks,
|
|
58869
58874
|
warnings: warnings.length ? warnings : void 0,
|
|
58870
58875
|
pageCount: 1,
|
|
58871
58876
|
..._optionalChain([options, 'optionalAccess', _1765 => _1765.ocrLines]) ? { ocrLines: lines ? [lines] : [] } : {}
|
|
58872
58877
|
};
|
|
58873
58878
|
} catch (err) {
|
|
58874
|
-
return { success: false, fileType: "image", error:
|
|
58879
|
+
return { success: false, fileType: "image", error: _chunkHVILFVATcjs.sanitizeError.call(void 0, err), code: _chunkHVILFVATcjs.classifyError.call(void 0, err) };
|
|
58875
58880
|
}
|
|
58876
58881
|
}
|
|
58877
58882
|
async function parseHwp3(buffer, options) {
|
|
@@ -58879,7 +58884,7 @@ async function parseHwp3(buffer, options) {
|
|
|
58879
58884
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp3Document(buffer, options);
|
|
58880
58885
|
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess', _1766 => _1766.pageCount]) };
|
|
58881
58886
|
} catch (err) {
|
|
58882
|
-
return { success: false, fileType: "hwp3", error:
|
|
58887
|
+
return { success: false, fileType: "hwp3", error: _chunkHVILFVATcjs.sanitizeError.call(void 0, err), code: _chunkHVILFVATcjs.classifyError.call(void 0, err) };
|
|
58883
58888
|
}
|
|
58884
58889
|
}
|
|
58885
58890
|
async function parseHwpx(buffer, options) {
|
|
@@ -58889,7 +58894,7 @@ async function parseHwpx(buffer, options) {
|
|
|
58889
58894
|
const { markdown, warnings } = await withEmbeddedImageOcr(blocks, doc.markdown, doc.warnings, void 0, options);
|
|
58890
58895
|
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1767 => _1767.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1768 => _1768.pageCount]) }, _optionalChain([options, 'optionalAccess', _1769 => _1769.scriptTags]) === false);
|
|
58891
58896
|
} catch (err) {
|
|
58892
|
-
return { success: false, fileType: "hwpx", error:
|
|
58897
|
+
return { success: false, fileType: "hwpx", error: _chunkHVILFVATcjs.sanitizeError.call(void 0, err), code: _chunkHVILFVATcjs.classifyError.call(void 0, err) };
|
|
58893
58898
|
}
|
|
58894
58899
|
}
|
|
58895
58900
|
async function parseHwp(buffer, options) {
|
|
@@ -58916,13 +58921,13 @@ async function parseHwp(buffer, options) {
|
|
|
58916
58921
|
const ocred = await withEmbeddedImageOcr(blocks, markdown, warnings, images, options);
|
|
58917
58922
|
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess', _1771 => _1771.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1772 => _1772.pageCount]) }, _optionalChain([options, 'optionalAccess', _1773 => _1773.scriptTags]) === false);
|
|
58918
58923
|
} catch (err) {
|
|
58919
|
-
return { success: false, fileType: "hwp", error:
|
|
58924
|
+
return { success: false, fileType: "hwp", error: _chunkHVILFVATcjs.sanitizeError.call(void 0, err), code: _chunkHVILFVATcjs.classifyError.call(void 0, err) };
|
|
58920
58925
|
}
|
|
58921
58926
|
}
|
|
58922
58927
|
async function parsePdf(buffer, options) {
|
|
58923
58928
|
let parsePdfDocument;
|
|
58924
58929
|
try {
|
|
58925
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
58930
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-JWU6HYZZ.cjs")));
|
|
58926
58931
|
parsePdfDocument = mod.parsePdfDocument;
|
|
58927
58932
|
} catch (e57) {
|
|
58928
58933
|
return {
|
|
@@ -58937,7 +58942,7 @@ async function parsePdf(buffer, options) {
|
|
|
58937
58942
|
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess', _1774 => _1774.pageCount]), ...ocrLines ? { ocrLines } : {} }, _optionalChain([options, 'optionalAccess', _1775 => _1775.scriptTags]) !== true);
|
|
58938
58943
|
} catch (err) {
|
|
58939
58944
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
58940
|
-
return { success: false, fileType: "pdf", error:
|
|
58945
|
+
return { success: false, fileType: "pdf", error: _chunkHVILFVATcjs.sanitizeError.call(void 0, err), code: _chunkHVILFVATcjs.classifyError.call(void 0, err), isImageBased };
|
|
58941
58946
|
}
|
|
58942
58947
|
}
|
|
58943
58948
|
async function parseXlsx(buffer, options) {
|
|
@@ -58945,7 +58950,7 @@ async function parseXlsx(buffer, options) {
|
|
|
58945
58950
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
58946
58951
|
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1776 => _1776.pageCount]) };
|
|
58947
58952
|
} catch (err) {
|
|
58948
|
-
return { success: false, fileType: "xlsx", error:
|
|
58953
|
+
return { success: false, fileType: "xlsx", error: _chunkHVILFVATcjs.sanitizeError.call(void 0, err), code: _chunkHVILFVATcjs.classifyError.call(void 0, err) };
|
|
58949
58954
|
}
|
|
58950
58955
|
}
|
|
58951
58956
|
async function parseXls(buffer, options) {
|
|
@@ -58953,7 +58958,7 @@ async function parseXls(buffer, options) {
|
|
|
58953
58958
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
58954
58959
|
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1777 => _1777.pageCount]) };
|
|
58955
58960
|
} catch (err) {
|
|
58956
|
-
return { success: false, fileType: "xls", error:
|
|
58961
|
+
return { success: false, fileType: "xls", error: _chunkHVILFVATcjs.sanitizeError.call(void 0, err), code: _chunkHVILFVATcjs.classifyError.call(void 0, err) };
|
|
58957
58962
|
}
|
|
58958
58963
|
}
|
|
58959
58964
|
async function parseDocx(buffer, options) {
|
|
@@ -58961,7 +58966,7 @@ async function parseDocx(buffer, options) {
|
|
|
58961
58966
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
58962
58967
|
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1778 => _1778.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1779 => _1779.pageCount]) }, _optionalChain([options, 'optionalAccess', _1780 => _1780.scriptTags]) === false);
|
|
58963
58968
|
} catch (err) {
|
|
58964
|
-
return { success: false, fileType: "docx", error:
|
|
58969
|
+
return { success: false, fileType: "docx", error: _chunkHVILFVATcjs.sanitizeError.call(void 0, err), code: _chunkHVILFVATcjs.classifyError.call(void 0, err) };
|
|
58965
58970
|
}
|
|
58966
58971
|
}
|
|
58967
58972
|
async function parsePptx(buffer, options) {
|
|
@@ -58969,7 +58974,7 @@ async function parsePptx(buffer, options) {
|
|
|
58969
58974
|
const { markdown, blocks, metadata, outline, warnings, images } = await parsePptxDocument(buffer, options);
|
|
58970
58975
|
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1781 => _1781.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1782 => _1782.pageCount]) }, _optionalChain([options, 'optionalAccess', _1783 => _1783.scriptTags]) === false);
|
|
58971
58976
|
} catch (err) {
|
|
58972
|
-
return { success: false, fileType: "pptx", error:
|
|
58977
|
+
return { success: false, fileType: "pptx", error: _chunkHVILFVATcjs.sanitizeError.call(void 0, err), code: _chunkHVILFVATcjs.classifyError.call(void 0, err) };
|
|
58973
58978
|
}
|
|
58974
58979
|
}
|
|
58975
58980
|
async function parseHwpml(buffer, options) {
|
|
@@ -58977,16 +58982,16 @@ async function parseHwpml(buffer, options) {
|
|
|
58977
58982
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
58978
58983
|
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1784 => _1784.pageCount]) };
|
|
58979
58984
|
} catch (err) {
|
|
58980
|
-
return { success: false, fileType: "hwpml", error:
|
|
58985
|
+
return { success: false, fileType: "hwpml", error: _chunkHVILFVATcjs.sanitizeError.call(void 0, err), code: _chunkHVILFVATcjs.classifyError.call(void 0, err) };
|
|
58981
58986
|
}
|
|
58982
58987
|
}
|
|
58983
58988
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
58984
58989
|
let buffer;
|
|
58985
58990
|
if (typeof input === "string") {
|
|
58986
58991
|
const buf = await _promises.readFile.call(void 0, input);
|
|
58987
|
-
buffer =
|
|
58992
|
+
buffer = _chunkHVILFVATcjs.toArrayBuffer.call(void 0, buf);
|
|
58988
58993
|
} else if (Buffer.isBuffer(input)) {
|
|
58989
|
-
buffer =
|
|
58994
|
+
buffer = _chunkHVILFVATcjs.toArrayBuffer.call(void 0, input);
|
|
58990
58995
|
} else {
|
|
58991
58996
|
buffer = input;
|
|
58992
58997
|
}
|
|
@@ -59012,7 +59017,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
59012
59017
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
59013
59018
|
}
|
|
59014
59019
|
const fill = fillFormFields(parsed.blocks, values);
|
|
59015
|
-
const markdown =
|
|
59020
|
+
const markdown = _chunkZBHS7KLWcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
59016
59021
|
if (outputFormat === "hwpx") {
|
|
59017
59022
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
59018
59023
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -59128,5 +59133,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
59128
59133
|
|
|
59129
59134
|
|
|
59130
59135
|
|
|
59131
|
-
exports.AGENCY_COMMON_NAME = AGENCY_COMMON_NAME; 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 =
|
|
59136
|
+
exports.AGENCY_COMMON_NAME = AGENCY_COMMON_NAME; 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 = _chunkHVILFVATcjs.VERSION; exports.ValueCursor = ValueCursor; exports.agencyNames = agencyNames; exports.agencyStyle = agencyStyle; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkZBHS7KLWcjs.blocksToMarkdown; exports.blocksToPages = _chunkV26UPU2Lcjs.blocksToPages; exports.blocksToPdf = blocksToPdf; exports.buildAgencyPack = buildAgencyPack; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; exports.chooseTableRepresentation = chooseTableRepresentation; exports.classifyTable = classifyTable; exports.classifyTableTree = classifyTableTree; exports.collectTableBlocks = collectTableBlocks; 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.extractRenderedRegions = extractRenderedRegions; exports.extractTables = extractTables; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.flattenLayoutTables = _chunkZBHS7KLWcjs.flattenLayoutTables; exports.formatFillValue = formatFillValue; exports.formatGateFinding = formatGateFinding; exports.gongmunGate = gongmunGate; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hasStructuredCellContent = _chunkZBHS7KLWcjs.hasStructuredCellContent; 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.lintBlocks = lintBlocks; exports.lintBudgetText = lintBudgetText; exports.lintGongmunText = lintGongmunText; exports.lintLogicText = lintLogicText; exports.lintMuncheText = lintMuncheText; exports.lintSlopText = lintSlopText; exports.loadAgencyPack = loadAgencyPack; exports.logicLintWarnings = logicLintWarnings; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.muncheLintWarnings = muncheLintWarnings; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.packRoleWarnings = packRoleWarnings; exports.packSummary = packSummary; exports.packTemplate = packTemplate; 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.parsePptx = parsePptx; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.placeTotalRow = placeTotalRow; exports.readBuiltinTemplate = readBuiltinTemplate; exports.readBuiltinTemplateSample = readBuiltinTemplateSample; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderDocument = renderDocument; exports.renderDocumentToScene = renderDocumentToScene; exports.renderHtml = renderHtml; exports.renderHwp5Pages = renderHwp5Pages; exports.renderHwpxToSvg = renderHwpxToSvg; exports.renderSceneToHtml = renderSceneToHtml; exports.resolveBuiltinTemplate = resolveBuiltinTemplate; exports.resolvePackKind = resolvePackKind; exports.runLintSuite = runLintSuite; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.slopLintWarnings = slopLintWarnings; exports.unknownFontWarnings = unknownFontWarnings; exports.usesGaejosikMunche = usesGaejosikMunche; exports.usesLogicStructure = usesLogicStructure; exports.validateHwpx = validateHwpx;
|
|
59132
59137
|
//# sourceMappingURL=index.cjs.map
|