kordoc 4.24.21 → 4.24.23
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 +7 -7
- package/dist/{-IS4RXPEZ.js → -POV3PVKW.js} +11 -11
- package/dist/{chunk-3RVASM4C.js → chunk-2NINEUJ5.js} +4 -4
- package/dist/{chunk-MMZUWRH6.js → chunk-2Q4ZLQQJ.js} +11 -11
- package/dist/{chunk-BV2YG7M6.js → chunk-2S4WERRK.js} +2 -2
- package/dist/{chunk-PDOWSDNM.js → chunk-2UNY7AKC.js} +2 -2
- package/dist/{chunk-F4GZFIUJ.js → chunk-3QWZCQI6.js} +2 -2
- package/dist/{chunk-E6G4B457.js → chunk-5L32QFLQ.js} +2 -2
- package/dist/{chunk-MYDHNNPA.js → chunk-6OG6WPA3.js} +43 -8
- package/dist/chunk-6OG6WPA3.js.map +1 -0
- package/dist/{chunk-NRCG3ASU.js → chunk-7JFJPFME.js} +2 -2
- package/dist/{chunk-WVZSTMCZ.cjs → chunk-7OZLM5MR.cjs} +3 -3
- package/dist/{chunk-WVZSTMCZ.cjs.map → chunk-7OZLM5MR.cjs.map} +1 -1
- package/dist/{chunk-V7S36XCU.cjs → chunk-AABI2ELF.cjs} +3 -3
- package/dist/{chunk-V7S36XCU.cjs.map → chunk-AABI2ELF.cjs.map} +1 -1
- package/dist/{chunk-O5ZCJEZ4.js → chunk-AXBEO5NB.js} +2 -2
- package/dist/{chunk-L556KKBU.cjs → chunk-HJ5YI5E6.cjs} +79 -79
- package/dist/{chunk-L556KKBU.cjs.map → chunk-HJ5YI5E6.cjs.map} +1 -1
- package/dist/{chunk-B3POEH7X.js → chunk-JDDKQD7W.js} +2 -2
- package/dist/{chunk-IZN5BTCW.js → chunk-NBETHWJH.js} +2 -2
- package/dist/{chunk-4OF7DHIT.js → chunk-NRPLZ4NO.js} +4 -4
- package/dist/{chunk-F6OHQLN7.js → chunk-NWNL5YYK.js} +38 -7
- package/dist/chunk-NWNL5YYK.js.map +1 -0
- package/dist/{chunk-NE75RO62.js → chunk-PG7OI72B.js} +2 -2
- package/dist/{chunk-BNEKESI4.js → chunk-QMAWEM4N.js} +2 -2
- package/dist/{chunk-MGCIQ43Y.js → chunk-SLS65M44.js} +3 -3
- package/dist/{chunk-BTBFKDPH.js → chunk-SYJZYHBB.js} +2 -2
- package/dist/{chunk-B5M676H3.cjs → chunk-T7Z554HT.cjs} +6 -6
- package/dist/{chunk-B5M676H3.cjs.map → chunk-T7Z554HT.cjs.map} +1 -1
- package/dist/{chunk-BUFGW3UJ.cjs → chunk-TBGNGQ2O.cjs} +213 -182
- package/dist/chunk-TBGNGQ2O.cjs.map +1 -0
- package/dist/{chunk-CPVXUEKF.js → chunk-VK3ZZLT7.js} +2 -2
- package/dist/{chunk-N45RCYBL.js → chunk-VK6S3WGD.js} +3 -3
- package/dist/{chunk-Z6ONQ63K.js → chunk-VOLDBZDF.js} +2 -2
- package/dist/{chunk-WQC4XWVT.js → chunk-WTFXQGND.js} +2 -2
- package/dist/{chunk-BMXWY36E.js → chunk-XEYTPWCF.js} +39 -8
- package/dist/chunk-XEYTPWCF.js.map +1 -0
- package/dist/{chunk-UNYH6MTO.js → chunk-XLVQUVL4.js} +2 -2
- package/dist/{chunk-OMGCVZ4W.cjs → chunk-YOLFNCQQ.cjs} +2 -2
- package/dist/{chunk-OMGCVZ4W.cjs.map → chunk-YOLFNCQQ.cjs.map} +1 -1
- package/dist/chunks-SGEDTBKI.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-DHBBWQLC.js → formula-7YKP7MFB.js} +3 -3
- package/dist/{formula-G3FQTUOY.cjs → formula-IIPZAHPY.cjs} +9 -9
- package/dist/{formula-G3FQTUOY.cjs.map → formula-IIPZAHPY.cjs.map} +1 -1
- package/dist/{formula-I4EA7ULD.js → formula-TI6JRF6D.js} +4 -4
- package/dist/{image-ocr-THUO6YRG.cjs → image-ocr-4FIFSQ5E.cjs} +17 -17
- package/dist/{image-ocr-THUO6YRG.cjs.map → image-ocr-4FIFSQ5E.cjs.map} +1 -1
- package/dist/{image-ocr-QUVBGNWD.js → image-ocr-JQ65V7NG.js} +9 -9
- package/dist/{image-ocr-5YWVBRY6.js → image-ocr-Q7ZPUDKM.js} +6 -6
- package/dist/index.cjs +463 -428
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +43 -8
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +23 -23
- package/dist/{model-bundle-6RG5PO3R.js → model-bundle-RHZIWRK3.js} +5 -5
- package/dist/{models-CGYIGN6D.js → models-IX2U5E2X.js} +5 -5
- package/dist/{parse-worker-v2-F5NXYBU6.js → parse-worker-v2-WH2ZU73A.js} +12 -12
- package/dist/{parser-GJ4PKW7I.cjs → parser-HZI6SSX5.cjs} +172 -161
- package/dist/parser-HZI6SSX5.cjs.map +1 -0
- package/dist/{parser-G5QTRKII.js → parser-OSH4JPYU.js} +22 -11
- package/dist/parser-OSH4JPYU.js.map +1 -0
- package/dist/{parser-I2C5DUXC.js → parser-U2WRX53G.js} +25 -14
- package/dist/parser-U2WRX53G.js.map +1 -0
- package/dist/{pdf-ocr-U3I74Q4O.js → pdf-ocr-HUQ2RFMY.js} +9 -9
- package/dist/{pdf-ocr-TNW6YOPX.js → pdf-ocr-NPFRBGWJ.js} +6 -6
- package/dist/pdf-ocr-OA57HOVS.cjs +35 -0
- package/dist/{pdf-ocr-LJKCUXTE.cjs.map → pdf-ocr-OA57HOVS.cjs.map} +1 -1
- package/dist/{profile-io-5YZCFK7B.js → profile-io-MVJHVB5K.js} +3 -3
- package/dist/{rasterize-7VRHPOQX.js → rasterize-MBQRUDTT.js} +3 -3
- package/dist/{redact-doc-VK6VGBK3.js → redact-doc-Y6DPTTVM.js} +11 -11
- package/dist/{render-Y7J6DPRL.js → render-CSVVMX6Y.js} +7 -7
- package/dist/seal-Y7I5CXGZ.js +10 -0
- package/dist/{setup-4XTUDU4X.js → setup-BU2VPWG4.js} +3 -3
- package/dist/visual-OAJU373I.js +21 -0
- package/dist/{watch-SPZRLTKG.js → watch-RLLW3NTH.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-BMXWY36E.js.map +0 -1
- package/dist/chunk-BUFGW3UJ.cjs.map +0 -1
- package/dist/chunk-F6OHQLN7.js.map +0 -1
- package/dist/chunk-MYDHNNPA.js.map +0 -1
- package/dist/chunks-FYCQOIWO.js +0 -10
- package/dist/parser-G5QTRKII.js.map +0 -1
- package/dist/parser-GJ4PKW7I.cjs.map +0 -1
- package/dist/parser-I2C5DUXC.js.map +0 -1
- package/dist/pdf-ocr-LJKCUXTE.cjs +0 -35
- package/dist/seal-4QIZ3ZNI.js +0 -10
- package/dist/visual-VEMQJ52W.js +0 -21
- /package/dist/{-IS4RXPEZ.js.map → -POV3PVKW.js.map} +0 -0
- /package/dist/{chunk-3RVASM4C.js.map → chunk-2NINEUJ5.js.map} +0 -0
- /package/dist/{chunk-MMZUWRH6.js.map → chunk-2Q4ZLQQJ.js.map} +0 -0
- /package/dist/{chunk-BV2YG7M6.js.map → chunk-2S4WERRK.js.map} +0 -0
- /package/dist/{chunk-PDOWSDNM.js.map → chunk-2UNY7AKC.js.map} +0 -0
- /package/dist/{chunk-F4GZFIUJ.js.map → chunk-3QWZCQI6.js.map} +0 -0
- /package/dist/{chunk-E6G4B457.js.map → chunk-5L32QFLQ.js.map} +0 -0
- /package/dist/{chunk-NRCG3ASU.js.map → chunk-7JFJPFME.js.map} +0 -0
- /package/dist/{chunk-O5ZCJEZ4.js.map → chunk-AXBEO5NB.js.map} +0 -0
- /package/dist/{chunk-B3POEH7X.js.map → chunk-JDDKQD7W.js.map} +0 -0
- /package/dist/{chunk-IZN5BTCW.js.map → chunk-NBETHWJH.js.map} +0 -0
- /package/dist/{chunk-4OF7DHIT.js.map → chunk-NRPLZ4NO.js.map} +0 -0
- /package/dist/{chunk-NE75RO62.js.map → chunk-PG7OI72B.js.map} +0 -0
- /package/dist/{chunk-BNEKESI4.js.map → chunk-QMAWEM4N.js.map} +0 -0
- /package/dist/{chunk-MGCIQ43Y.js.map → chunk-SLS65M44.js.map} +0 -0
- /package/dist/{chunk-BTBFKDPH.js.map → chunk-SYJZYHBB.js.map} +0 -0
- /package/dist/{chunk-CPVXUEKF.js.map → chunk-VK3ZZLT7.js.map} +0 -0
- /package/dist/{chunk-N45RCYBL.js.map → chunk-VK6S3WGD.js.map} +0 -0
- /package/dist/{chunk-Z6ONQ63K.js.map → chunk-VOLDBZDF.js.map} +0 -0
- /package/dist/{chunk-WQC4XWVT.js.map → chunk-WTFXQGND.js.map} +0 -0
- /package/dist/{chunk-UNYH6MTO.js.map → chunk-XLVQUVL4.js.map} +0 -0
- /package/dist/{chunks-FYCQOIWO.js.map → chunks-SGEDTBKI.js.map} +0 -0
- /package/dist/{formula-DHBBWQLC.js.map → formula-7YKP7MFB.js.map} +0 -0
- /package/dist/{formula-I4EA7ULD.js.map → formula-TI6JRF6D.js.map} +0 -0
- /package/dist/{image-ocr-QUVBGNWD.js.map → image-ocr-JQ65V7NG.js.map} +0 -0
- /package/dist/{image-ocr-5YWVBRY6.js.map → image-ocr-Q7ZPUDKM.js.map} +0 -0
- /package/dist/{model-bundle-6RG5PO3R.js.map → model-bundle-RHZIWRK3.js.map} +0 -0
- /package/dist/{models-CGYIGN6D.js.map → models-IX2U5E2X.js.map} +0 -0
- /package/dist/{parse-worker-v2-F5NXYBU6.js.map → parse-worker-v2-WH2ZU73A.js.map} +0 -0
- /package/dist/{pdf-ocr-TNW6YOPX.js.map → pdf-ocr-HUQ2RFMY.js.map} +0 -0
- /package/dist/{pdf-ocr-U3I74Q4O.js.map → pdf-ocr-NPFRBGWJ.js.map} +0 -0
- /package/dist/{profile-io-5YZCFK7B.js.map → profile-io-MVJHVB5K.js.map} +0 -0
- /package/dist/{rasterize-7VRHPOQX.js.map → rasterize-MBQRUDTT.js.map} +0 -0
- /package/dist/{redact-doc-VK6VGBK3.js.map → redact-doc-Y6DPTTVM.js.map} +0 -0
- /package/dist/{render-Y7J6DPRL.js.map → render-CSVVMX6Y.js.map} +0 -0
- /package/dist/{seal-4QIZ3ZNI.js.map → seal-Y7I5CXGZ.js.map} +0 -0
- /package/dist/{setup-4XTUDU4X.js.map → setup-BU2VPWG4.js.map} +0 -0
- /package/dist/{visual-VEMQJ52W.js.map → visual-OAJU373I.js.map} +0 -0
- /package/dist/{watch-SPZRLTKG.js.map → watch-RLLW3NTH.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunk7OZLM5MRcjs = require('./chunk-7OZLM5MR.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 _chunkT7Z554HTcjs = require('./chunk-T7Z554HT.cjs');
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
@@ -62,14 +62,14 @@ var _chunkB5M676H3cjs = require('./chunk-B5M676H3.cjs');
|
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
var
|
|
65
|
+
var _chunkYOLFNCQQcjs = require('./chunk-YOLFNCQQ.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 _chunkT7Z554HTcjs.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 = _chunkYOLFNCQQcjs.unzipLimitBytes.call(void 0, 256 * 1024 * 1024);
|
|
607
607
|
var MAX_ZIP_ENTRIES = 500;
|
|
608
|
-
var ZipBombError = class extends
|
|
608
|
+
var ZipBombError = class extends _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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(_chunkYOLFNCQQcjs.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 >= _chunkT7Z554HTcjs.HEADING_RATIO_H1) level = 1;
|
|
1035
|
+
else if (ratio >= _chunkT7Z554HTcjs.HEADING_RATIO_H2) level = 2;
|
|
1036
|
+
else if (ratio >= _chunkT7Z554HTcjs.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 ? _chunkT7Z554HTcjs.circledNumber.call(void 0, n - 1) : `(${n})`;
|
|
1651
1651
|
case "HANGUL_SYLLABLE":
|
|
1652
|
-
return
|
|
1652
|
+
return _chunkT7Z554HTcjs.hangulOrdinal.call(void 0, n - 1);
|
|
1653
1653
|
case "CIRCLED_HANGUL_SYLLABLE":
|
|
1654
|
-
return n <= 14 ?
|
|
1654
|
+
return n <= 14 ? _chunkT7Z554HTcjs.circledHangul.call(void 0, n - 1) : _chunkT7Z554HTcjs.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 _chunkT7Z554HTcjs.romanNumeral.call(void 0, n, true);
|
|
1669
1669
|
case "ROMAN_SMALL":
|
|
1670
|
-
return
|
|
1670
|
+
return _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.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)) _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1799
|
+
if (newTable.caption) flat = _chunkT7Z554HTcjs.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 += _chunkT7Z554HTcjs.escapeLiteralTags.call(void 0, _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.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(_chunkYOLFNCQQcjs.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, _chunkT7Z554HTcjs.MAX_COLS);
|
|
2202
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.convertTableToText.call(void 0, st.rows);
|
|
2526
|
+
if (st.caption) flat = _chunkT7Z554HTcjs.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 = _chunkYOLFNCQQcjs.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 += _chunkT7Z554HTcjs.escapeLiteralTags.call(void 0, _chunkT7Z554HTcjs.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 += _chunkT7Z554HTcjs.escapeLiteralTags.call(void 0, _chunkT7Z554HTcjs.escapeLiteralDollar.call(void 0, _chunkT7Z554HTcjs.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 = _chunkYOLFNCQQcjs.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) + _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.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, _chunkYOLFNCQQcjs.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 (_chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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 _chunkYOLFNCQQcjs.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) || _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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 _chunkYOLFNCQQcjs.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 (_chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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 = _chunkT7Z554HTcjs.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(_chunkYOLFNCQQcjs.compareSectionPaths);
|
|
3826
3826
|
}
|
|
3827
3827
|
function parseSectionPathsFromManifest(xml) {
|
|
3828
3828
|
const parser = createXmlParser();
|
|
3829
|
-
const doc = parser.parseFromString(
|
|
3829
|
+
const doc = parser.parseFromString(_chunkYOLFNCQQcjs.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 = _chunkYOLFNCQQcjs.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(_chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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(_chunkYOLFNCQQcjs.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(_chunkYOLFNCQQcjs.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
|
+
_chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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 : _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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 ? _chunkT7Z554HTcjs.circledNumber.call(void 0, n - 1) : String(n);
|
|
5073
5073
|
case "romanUpper":
|
|
5074
|
-
return
|
|
5074
|
+
return _chunkT7Z554HTcjs.romanNumeral.call(void 0, n, true);
|
|
5075
5075
|
case "romanLower":
|
|
5076
|
-
return
|
|
5076
|
+
return _chunkT7Z554HTcjs.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 ? _chunkT7Z554HTcjs.hangulOrdinal.call(void 0, n - 1) : String(n);
|
|
5083
5083
|
case "circledGanada":
|
|
5084
|
-
return n >= 1 ?
|
|
5084
|
+
return n >= 1 ? _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.convertTableToText.call(void 0, table2.cells);
|
|
5267
|
+
return table2.caption ? _chunkT7Z554HTcjs.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, _chunkT7Z554HTcjs.MAX_ROWS));
|
|
5348
|
+
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1, _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.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) _chunkT7Z554HTcjs.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 = _chunkYOLFNCQQcjs.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 = _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.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)) _chunkT7Z554HTcjs.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), _chunkT7Z554HTcjs.MAX_ROWS);
|
|
5810
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkT7Z554HTcjs.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, _chunkT7Z554HTcjs.MAX_ROWS);
|
|
5858
5858
|
cols = 1;
|
|
5859
5859
|
}
|
|
5860
5860
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5861
|
-
const table2 =
|
|
5861
|
+
const table2 = _chunkT7Z554HTcjs.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, _chunkT7Z554HTcjs.MAX_COLS);
|
|
5882
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkT7Z554HTcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
6045
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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 _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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 _chunkYOLFNCQQcjs.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 = _chunkT7Z554HTcjs.flattenLayoutTables.call(void 0, blocks);
|
|
6172
|
+
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks = _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.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 = _chunk7OZLM5MRcjs.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 >= _chunkT7Z554HTcjs.HEADING_RATIO_H1) level = 1;
|
|
6251
|
+
else if (ratio >= _chunkT7Z554HTcjs.HEADING_RATIO_H2) level = 2;
|
|
6252
|
+
else if (ratio >= _chunkT7Z554HTcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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), _chunkT7Z554HTcjs.MAX_ROWS), colSpan: Math.min(Math.max(1, c2 - col), _chunkT7Z554HTcjs.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), _chunkT7Z554HTcjs.MAX_ROWS), cols: Math.min(Math.max(1, xs.length - 1), _chunkT7Z554HTcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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 = _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.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 = _chunk7OZLM5MRcjs.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 += _chunkT7Z554HTcjs.escapeLiteralTags.call(void 0, _chunkT7Z554HTcjs.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(_chunkT7Z554HTcjs.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 ${_chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.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 = _chunkYOLFNCQQcjs.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(_chunkYOLFNCQQcjs.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 += _chunkT7Z554HTcjs.escapeLiteralTags.call(void 0, _chunkT7Z554HTcjs.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
|
+
_chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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 = _chunkT7Z554HTcjs.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: _chunkT7Z554HTcjs.escapeLiteralTags.call(void 0, _chunkT7Z554HTcjs.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: _chunkT7Z554HTcjs.escapeLiteralTags.call(void 0, _chunkT7Z554HTcjs.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: _chunkT7Z554HTcjs.escapeLiteralTags.call(void 0, _chunkT7Z554HTcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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: _chunkT7Z554HTcjs.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 = _chunkYOLFNCQQcjs.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(_chunkYOLFNCQQcjs.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(_chunkT7Z554HTcjs.escapeLiteralTags.call(void 0, _chunkT7Z554HTcjs.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 += _chunkT7Z554HTcjs.escapeLiteralTags.call(void 0, _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.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 = _chunkYOLFNCQQcjs.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 = _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.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 = _chunkYOLFNCQQcjs.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
|
+
_chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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 = _chunkT7Z554HTcjs.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 = _chunkYOLFNCQQcjs.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(_chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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 += _chunkT7Z554HTcjs.wrapScript.call(void 0, _chunkT7Z554HTcjs.escapeLiteralTags.call(void 0, _chunkT7Z554HTcjs.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 _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.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 = _chunkYOLFNCQQcjs.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
|
+
_chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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: _chunkT7Z554HTcjs.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, _chunkYOLFNCQQcjs.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 = _chunkYOLFNCQQcjs.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 = _chunkT7Z554HTcjs.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(_chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.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
|
+
_chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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
|
+
_chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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-4FIFSQ5E.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 _chunk7OZLM5MRcjs.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) || _chunkT7Z554HTcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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 `${_chunkT7Z554HTcjs.hangulOrdinal.call(void 0, n)}.`;
|
|
37195
37195
|
case 2:
|
|
37196
37196
|
return `${n + 1})`;
|
|
37197
37197
|
case 3:
|
|
37198
|
-
return `${
|
|
37198
|
+
return `${_chunkT7Z554HTcjs.hangulOrdinal.call(void 0, n)})`;
|
|
37199
37199
|
case 4:
|
|
37200
37200
|
return `(${n + 1})`;
|
|
37201
37201
|
case 5:
|
|
37202
|
-
return `(${
|
|
37202
|
+
return `(${_chunkT7Z554HTcjs.hangulOrdinal.call(void 0, n)})`;
|
|
37203
37203
|
case 6:
|
|
37204
|
-
return
|
|
37204
|
+
return _chunkT7Z554HTcjs.circledNumber.call(void 0, n);
|
|
37205
37205
|
case 7:
|
|
37206
|
-
return
|
|
37206
|
+
return _chunkT7Z554HTcjs.circledHangul.call(void 0, n);
|
|
37207
37207
|
default:
|
|
37208
|
-
return
|
|
37208
|
+
return _chunkT7Z554HTcjs.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(_chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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) => _chunkT7Z554HTcjs.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 _chunkT7Z554HTcjs.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: _chunkT7Z554HTcjs.escapeGfm.call(void 0, _chunkT7Z554HTcjs.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 ? _chunkT7Z554HTcjs.sanitizeText.call(void 0, b.table.caption) : "";
|
|
39246
|
+
return (cap ? _chunkT7Z554HTcjs.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="${_chunkYOLFNCQQcjs.escapeHtml.call(void 0, b.text, true)}" alt="image">`;
|
|
39249
|
+
const note = _chunkT7Z554HTcjs.noteTableHtml.call(void 0, b);
|
|
39250
|
+
const t = (_chunkT7Z554HTcjs.sanitizeText.call(void 0, _chunkT7Z554HTcjs.visibleText.call(void 0, b)) + (note ? "" : _chunkT7Z554HTcjs.noteSuffix.call(void 0, b))).trim();
|
|
39251
|
+
return ((t ? _chunkT7Z554HTcjs.escapeHtmlCellText.call(void 0, t).replace(/\n/g, "<br>") : "") + note).trim();
|
|
39252
39252
|
}).filter(Boolean).join("<br>");
|
|
39253
39253
|
}
|
|
39254
|
-
return
|
|
39254
|
+
return _chunkT7Z554HTcjs.escapeHtmlCellText.call(void 0, _chunkT7Z554HTcjs.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, _chunkT7Z554HTcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkT7Z554HTcjs.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(_chunkYOLFNCQQcjs.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) => _chunkYOLFNCQQcjs.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, _chunkT7Z554HTcjs.MAX_COLS);
|
|
40192
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkT7Z554HTcjs.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(_chunkT7Z554HTcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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
|
+
_chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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 = _chunkT7Z554HTcjs.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(_chunkT7Z554HTcjs.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(_chunkT7Z554HTcjs.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(_chunkT7Z554HTcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
44953
44953
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
44954
|
-
|
|
44954
|
+
_chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
44999
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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(_chunkT7Z554HTcjs.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, _chunkYOLFNCQQcjs.KordocError)("pack: \uAE30\uAD00 \uC774\uB984(1~60\uC790)\uC774 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
45590
|
+
if (!samples.length) throw new (0, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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: _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.KordocError)("pack: \uD329 \uD30C\uC77C\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4");
|
|
45681
|
+
_chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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 : _chunkYOLFNCQQcjs.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${_chunkT7Z554HTcjs.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${_chunkT7Z554HTcjs.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) => _chunkT7Z554HTcjs.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() || _chunkT7Z554HTcjs.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 (_chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.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 `**${_chunkT7Z554HTcjs.escapeGfm.call(void 0, t)}**`;
|
|
48403
|
+
return _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.escapeGfm.call(void 0, _chunkT7Z554HTcjs.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) => _chunkT7Z554HTcjs.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(_chunkYOLFNCQQcjs.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 (_chunkT7Z554HTcjs.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) => _chunkT7Z554HTcjs.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 (_chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.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 `**${_chunkT7Z554HTcjs.escapeGfm.call(void 0, t)}**`;
|
|
49470
|
+
return _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.escapeGfm.call(void 0, _chunkT7Z554HTcjs.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) => _chunkT7Z554HTcjs.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(_chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
49948
49948
|
} else {
|
|
49949
|
-
chunk =
|
|
49949
|
+
chunk = _chunkT7Z554HTcjs.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 (_chunkT7Z554HTcjs.sanitizeText.call(void 0, newPlain) !== newPlain && _chunkT7Z554HTcjs.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(_chunkT7Z554HTcjs.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(_chunkT7Z554HTcjs.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") _chunkT7Z554HTcjs.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, _chunkT7Z554HTcjs.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 = _chunkT7Z554HTcjs.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(_chunkT7Z554HTcjs.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 (_chunkT7Z554HTcjs.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 : _chunkYOLFNCQQcjs.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">${_chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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, _chunkYOLFNCQQcjs.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 = _chunkT7Z554HTcjs.blocksToMarkdown.call(void 0, blocks);
|
|
53408
53408
|
return markdownToPdf(markdown, options);
|
|
53409
53409
|
}
|
|
53410
53410
|
|
|
@@ -53509,6 +53509,7 @@ function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY, s
|
|
|
53509
53509
|
return false;
|
|
53510
53510
|
}
|
|
53511
53511
|
if (evenOnly && missing.length !== 1) return false;
|
|
53512
|
+
if (evenOnly && c.height > maxTotal) return false;
|
|
53512
53513
|
done.add(k);
|
|
53513
53514
|
if (c.height <= known) return false;
|
|
53514
53515
|
const each = (c.height - known) / missing.length;
|
|
@@ -53518,7 +53519,7 @@ function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY, s
|
|
|
53518
53519
|
for (let r = 0; r < rowCount; r++) {
|
|
53519
53520
|
if (h[r] !== 0) continue;
|
|
53520
53521
|
let need = 0;
|
|
53521
|
-
for (const { c, rows } of spans) if (rows[rows.length - 1] === r && rows.slice(0, -1).every((q) => h[q] > 0)) need = Math.max(need, c.height - rows.slice(0, -1).reduce((t, q) => t + h[q], 0));
|
|
53522
|
+
for (const { c, rows } of spans) if (rows[rows.length - 1] === r && rows.slice(0, -1).every((q) => h[q] > 0) && c.height <= maxTotal) need = Math.max(need, c.height - rows.slice(0, -1).reduce((t, q) => t + h[q], 0));
|
|
53522
53523
|
if (need > 0) h[r] = need;
|
|
53523
53524
|
}
|
|
53524
53525
|
for (let again = true; again; ) {
|
|
@@ -53530,7 +53531,7 @@ function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY, s
|
|
|
53530
53531
|
const overSz = total > maxTotal;
|
|
53531
53532
|
for (const { c, rows } of [...spans].sort((a, b) => a.rows[a.rows.length - 1] - b.rows[b.rows.length - 1] || b.rows[0] - a.rows[0])) {
|
|
53532
53533
|
const known = rows.reduce((s, r) => s + h[r], 0);
|
|
53533
|
-
const add = Math.min(c.height - known, overSz && c.contentH != null && c.contentH >= c.height ? Number.POSITIVE_INFINITY : maxTotal - total);
|
|
53534
|
+
const add = Math.min(c.height - known, overSz && (c.contentH != null && c.contentH >= c.height || c.height <= maxTotal / 2) ? Number.POSITIVE_INFINITY : maxTotal - total);
|
|
53534
53535
|
if (rows.length && add > 0) {
|
|
53535
53536
|
h[rows[rows.length - 1]] += add;
|
|
53536
53537
|
total += add;
|
|
@@ -55171,6 +55172,11 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
55171
55172
|
if (Number.isFinite(bottom)) {
|
|
55172
55173
|
cursorV = bottom;
|
|
55173
55174
|
prevSpaceAfter = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1564 => _1564.spaceAfter]), () => ( 0));
|
|
55175
|
+
const segsL = elements2(lsa).filter((e) => ln2(e) === "lineseg"), lastL = segsL[segsL.length - 1];
|
|
55176
|
+
if (bodyFlow && lastL && num3(lastL, "vertpos") + num3(lastL, "vertsize") > bodyH) {
|
|
55177
|
+
cursorV = num3(lastL, "vertsize") + num3(lastL, "spacing");
|
|
55178
|
+
prevSpaceAfter = 0;
|
|
55179
|
+
}
|
|
55174
55180
|
}
|
|
55175
55181
|
}
|
|
55176
55182
|
continue;
|
|
@@ -55852,8 +55858,15 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
55852
55858
|
if (outT + rowY[nRows] + outB <= BODY_H) return rowH.map((h, r) => [{ page: 1, y: contMT + outT + rowY[r], h }]);
|
|
55853
55859
|
}
|
|
55854
55860
|
const spanStarts = cellSplit ? spanPartRows(cells, rowY, BODY_H) : /* @__PURE__ */ new Set();
|
|
55861
|
+
const declaredH = num2(findChildByLocalName(tbl2, "sz"), "height");
|
|
55862
|
+
const cutRow = declaredH > 0 && declaredH < rowY[nRows] - 1e3 ? rowY.findIndex((v, k) => k > hdrRows && k < nRows && Math.abs(v - declaredH) <= 20 && ty + v <= pageBottom) : -1;
|
|
55855
55863
|
for (let r = 0; r < nRows; r++) {
|
|
55856
55864
|
let h = rowH[r];
|
|
55865
|
+
if (r === cutRow && page === 0 && !first) {
|
|
55866
|
+
page++;
|
|
55867
|
+
y = contTop;
|
|
55868
|
+
first = true;
|
|
55869
|
+
}
|
|
55857
55870
|
const pieces = [];
|
|
55858
55871
|
if (!first && r >= hdrRows && spanStarts.has(r) && !cells.some((c) => c.rs > 1 && c.ra < r && c.ra + c.rs > r && (_nullishCoalesce(_optionalChain([out, 'access', _1610 => _1610[c.ra], 'optionalAccess', _1611 => _1611[0], 'optionalAccess', _1612 => _1612.page]), () => ( page))) < page)) {
|
|
55859
55872
|
page++;
|
|
@@ -55937,6 +55950,11 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
55937
55950
|
}
|
|
55938
55951
|
if (inK.length && next) toNext = Math.max(toNext, next.top - from + c.marginT + c.marginB);
|
|
55939
55952
|
}
|
|
55953
|
+
if (k > 0) for (const c of cells) {
|
|
55954
|
+
if (c.rs < 2 || c.ra + c.rs - 1 !== r) continue;
|
|
55955
|
+
const inK = cellLineBoxes(c, BODY_H).filter((b) => b.part === k);
|
|
55956
|
+
if (inK.length) ext = Math.max(ext, inK[inK.length - 1].bottom - inK[0].origin + c.marginT + c.marginB);
|
|
55957
|
+
}
|
|
55940
55958
|
const last = k === hParts;
|
|
55941
55959
|
const cellH = Math.max(0, ...rowCells.map((c) => num2(findChildByLocalName(c.el, "cellSz"), "height")));
|
|
55942
55960
|
const firstH = Math.min(declared > 0 && ty + declared - y >= ext ? Math.min(pageBottom - y, ty + declared - y) : pageBottom - y, Math.max(ext, cellH));
|
|
@@ -56802,7 +56820,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
56802
56820
|
if (st.italic) attrs.push(`font-style="italic"`);
|
|
56803
56821
|
if (st.underline) attrs.push(`text-decoration="underline"`);
|
|
56804
56822
|
if (st.color) attrs.push(`fill="${escapeXml7(st.color)}"`);
|
|
56805
|
-
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(
|
|
56823
|
+
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(_chunkT7Z554HTcjs.mapPuaText.call(void 0, text))}</text>`);
|
|
56806
56824
|
ctx.stats.texts++;
|
|
56807
56825
|
}
|
|
56808
56826
|
return sw;
|
|
@@ -56867,6 +56885,13 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
56867
56885
|
ax = ox + col * (ctx.cols.w + ctx.cols.gap);
|
|
56868
56886
|
aw = ctx.cols.w;
|
|
56869
56887
|
}
|
|
56888
|
+
if (_optionalChain([findChildByLocalName, 'call', _1654 => _1654(o.el, "pos"), 'optionalAccess', _1655 => _1655.getAttribute, 'call', _1656 => _1656("horzRelTo")]) === "PARA" && m.paraPrId != null) {
|
|
56889
|
+
const g3 = ctx.styles.paraGeom.get(m.paraPrId);
|
|
56890
|
+
if (g3) {
|
|
56891
|
+
ax += g3.marginLeft;
|
|
56892
|
+
aw -= g3.marginLeft + g3.marginRight;
|
|
56893
|
+
}
|
|
56894
|
+
}
|
|
56870
56895
|
let anchorLineV;
|
|
56871
56896
|
let anchorLineH = 0;
|
|
56872
56897
|
let anchorSeg;
|
|
@@ -56880,11 +56905,11 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
56880
56905
|
}
|
|
56881
56906
|
});
|
|
56882
56907
|
let objBaseV = baseV;
|
|
56883
|
-
const pTop = depth === 0 ? _optionalChain([ctx, 'access',
|
|
56908
|
+
const pTop = depth === 0 ? _optionalChain([ctx, 'access', _1657 => _1657.paraTops, 'optionalAccess', _1658 => _1658.get, 'call', _1659 => _1659(p)]) : void 0;
|
|
56884
56909
|
const wrapA = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
56885
56910
|
const top0 = _nullishCoalesce(pTop, () => ( (depth > 0 && wrapA !== "TOP_AND_BOTTOM" ? cellParaTop(p, ctx.styles.paraGeom) : void 0)));
|
|
56886
56911
|
if (top0 !== void 0 && wrapA !== "TOP_AND_BOTTOM") {
|
|
56887
|
-
const start = top0 + (m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
56912
|
+
const start = top0 + (m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access', _1660 => _1660.styles, 'access', _1661 => _1661.paraGeom, 'access', _1662 => _1662.get, 'call', _1663 => _1663(m.paraPrId), 'optionalAccess', _1664 => _1664.spaceBefore]), () => ( 0)) : 0);
|
|
56888
56913
|
if (baseV > start + 100) {
|
|
56889
56914
|
objBaseV = start;
|
|
56890
56915
|
if (anchorLineV === baseV) anchorLineV = start;
|
|
@@ -56893,12 +56918,12 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
56893
56918
|
if (anchorLineV === baseV) anchorLineV = top0;
|
|
56894
56919
|
}
|
|
56895
56920
|
}
|
|
56896
|
-
const tbFloats = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
56921
|
+
const tbFloats = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1665 => _1665(q.el, "pos"), 'optionalAccess', _1666 => _1666.getAttribute, 'call', _1667 => _1667("vertRelTo")]), () => ( "PARA"))) === "PARA").length;
|
|
56897
56922
|
let stay = tbFloats < 2 && !m.objs.some((q) => q.inline) && !m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
|
|
56898
|
-
const sbA = m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
56923
|
+
const sbA = m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access', _1668 => _1668.styles, 'access', _1669 => _1669.paraGeom, 'access', _1670 => _1670.get, 'call', _1671 => _1671(m.paraPrId), 'optionalAccess', _1672 => _1672.spaceBefore]), () => ( 0)) : 0;
|
|
56899
56924
|
if (stay && wrapA === "TOP_AND_BOTTOM" && linePushedBy(o, _nullishCoalesce(anchorLineV, () => ( baseV)), _nullishCoalesce(pTop, () => ( (depth > 0 ? cellParaTop(p, ctx.styles.paraGeom) : void 0))))) stay = false;
|
|
56900
56925
|
let carried;
|
|
56901
|
-
if (segPages && anchorK > 0 && segPages[anchorK] !== segPages[0] && segPages[anchorK - 1] === segPages[0] && wrapA === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
56926
|
+
if (segPages && anchorK > 0 && segPages[anchorK] !== segPages[0] && segPages[anchorK - 1] === segPages[0] && wrapA === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1673 => _1673(o.el, "pos"), 'optionalAccess', _1674 => _1674.getAttribute, 'call', _1675 => _1675("vertRelTo")]), () => ( "PARA"))) === "PARA") {
|
|
56902
56927
|
const s0 = plans[anchorK - 1].seg;
|
|
56903
56928
|
carried = s0.vertpos + s0.textheight + (_nullishCoalesce(s0.spacing, () => ( 0)));
|
|
56904
56929
|
}
|
|
@@ -56927,7 +56952,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
56927
56952
|
if (!tbStack) {
|
|
56928
56953
|
tbStack = /* @__PURE__ */ new Map();
|
|
56929
56954
|
const placed = [];
|
|
56930
|
-
const stackable = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
56955
|
+
const stackable = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1676 => _1676(q.el, "pos"), 'optionalAccess', _1677 => _1677.getAttribute, 'call', _1678 => _1678("vertRelTo")]), () => ( "PARA"))) === "PARA" && _optionalChain([findChildByLocalName, 'call', _1679 => _1679(q.el, "pos"), 'optionalAccess', _1680 => _1680.getAttribute, 'call', _1681 => _1681("allowOverlap")]) !== "1");
|
|
56931
56956
|
for (const q of stackable.length >= 2 ? stackable.sort((a, b) => a.index - b.index) : []) {
|
|
56932
56957
|
const posQ = findChildByLocalName(q.el, "pos"), omQ = findChildByLocalName(q.el, "outMargin"), raw = num2(posQ, "vertOffset");
|
|
56933
56958
|
const x0 = num2(posQ, "horzOffset"), x1 = x0 + num2(omQ, "left") + q.width + num2(omQ, "right");
|
|
@@ -56942,7 +56967,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
56942
56967
|
const st = tbStack.get(o.el);
|
|
56943
56968
|
if (st !== void 0) y = oy + stackTop + st;
|
|
56944
56969
|
}
|
|
56945
|
-
const moved = _optionalChain([ctx, 'access',
|
|
56970
|
+
const moved = _optionalChain([ctx, 'access', _1682 => _1682.objPlace, 'optionalAccess', _1683 => _1683.get, 'call', _1684 => _1684(o.el)]);
|
|
56946
56971
|
if (moved) {
|
|
56947
56972
|
const pg = ctx.page;
|
|
56948
56973
|
ctx.page = moved.page;
|
|
@@ -56961,7 +56986,7 @@ function cellParaTop(p, geom) {
|
|
|
56961
56986
|
const segs = lsa ? elements(lsa).filter((e) => ln(e) === "lineseg") : [];
|
|
56962
56987
|
if (!segs.length) return void 0;
|
|
56963
56988
|
const last = segs[segs.length - 1];
|
|
56964
|
-
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (_nullishCoalesce(_optionalChain([geom, 'access',
|
|
56989
|
+
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (_nullishCoalesce(_optionalChain([geom, 'access', _1685 => _1685.get, 'call', _1686 => _1686(_nullishCoalesce(prev.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1687 => _1687.spaceAfter]), () => ( 0)));
|
|
56965
56990
|
}
|
|
56966
56991
|
function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
56967
56992
|
if (!o.inline && depth === 0 && ctx.paintJobs) {
|
|
@@ -57002,7 +57027,7 @@ function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
|
57002
57027
|
drawObject(sub, x + num2(off, "x"), y + num2(off, "y"), baseV, areaW, ctx, depth + 1);
|
|
57003
57028
|
}
|
|
57004
57029
|
} else if (o.tag === "equation") {
|
|
57005
|
-
const script = _nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
57030
|
+
const script = _nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1688 => _1688(o.el, "script"), 'optionalAccess', _1689 => _1689.textContent]), () => ( ""));
|
|
57006
57031
|
const text = script ? latexToPlain(hwpEquationToLatex(script)) : "";
|
|
57007
57032
|
if (text && o.width > 0) {
|
|
57008
57033
|
const bl = Number(o.el.getAttribute("baseLine")), size = num2(o.el, "baseUnit", 1e3);
|
|
@@ -57107,7 +57132,7 @@ function tableContPages(tbl2, ty, MT, BODY_H, memo, slack = 0, floatSpan, nested
|
|
|
57107
57132
|
}
|
|
57108
57133
|
function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
57109
57134
|
return (seg, top, contMT) => {
|
|
57110
|
-
const lsa = seg.parentNode, p = _optionalChain([lsa, 'optionalAccess',
|
|
57135
|
+
const lsa = seg.parentNode, p = _optionalChain([lsa, 'optionalAccess', _1690 => _1690.parentNode]);
|
|
57111
57136
|
if (!p || ln(p) !== "p") return void 0;
|
|
57112
57137
|
const segs = elements(lsa).filter((e) => ln(e) === "lineseg"), k = segs.indexOf(seg);
|
|
57113
57138
|
const m = buildPara(p);
|
|
@@ -57115,12 +57140,12 @@ function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
|
57115
57140
|
for (const o of m.objs) {
|
|
57116
57141
|
if (o.tag !== "tbl" || o.inline) continue;
|
|
57117
57142
|
const pos = findChildByLocalName(o.el, "pos");
|
|
57118
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
57143
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1691 => _1691.getAttribute, 'call', _1692 => _1692("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
57119
57144
|
const segK = Math.max(0, m.segs.findIndex((sg, i) => sg.textpos <= o.index && (i === m.segs.length - 1 || m.segs[i + 1].textpos > o.index)));
|
|
57120
57145
|
if (segK !== k) continue;
|
|
57121
57146
|
const segV = num2(seg, "vertpos"), pTop = cellParaTop(p, _nullishCoalesce(memo.paraGeom, () => ( /* @__PURE__ */ new Map())));
|
|
57122
57147
|
const start = linePushedBy(o, segV, pTop) ? top - (segV - (_nullishCoalesce(pTop, () => ( segV)))) : top;
|
|
57123
|
-
const ty = start + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
57148
|
+
const ty = start + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1693 => _1693.getAttribute, 'call', _1694 => _1694("vertOffset")]), () => ( void 0)), 0));
|
|
57124
57149
|
const span2 = tableContPages(o.el, ty, MT, BODY_H, memo, slack, cellFloatSpan(MT, BODY_H, memo, slack), true, contMT);
|
|
57125
57150
|
if (span2.pages > 0 && (!best || span2.pages > best.pages)) best = { ...span2, el: o.el };
|
|
57126
57151
|
}
|
|
@@ -57162,7 +57187,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
57162
57187
|
let hdrRows = 0;
|
|
57163
57188
|
if (tbl2.getAttribute("repeatHeader") === "1") while (hdrRows < nRows && cells.some((c) => c.ra === hdrRows) && cells.filter((c) => c.ra === hdrRows).every((c) => c.el.getAttribute("header") === "1")) hdrRows++;
|
|
57164
57189
|
const slack = ctx.geom.PH - ctx.geom.MT - ctx.geom.BODY_H;
|
|
57165
|
-
const splitHere = depth === 1 || !!ctx.splitCell && _optionalChain([findChildByLocalName, 'call',
|
|
57190
|
+
const splitHere = depth === 1 || !!ctx.splitCell && _optionalChain([findChildByLocalName, 'call', _1695 => _1695(tbl2, "pos"), 'optionalAccess', _1696 => _1696.getAttribute, 'call', _1697 => _1697("treatAsChar")]) !== "1";
|
|
57166
57191
|
const plan = splitHere ? planTableRows(tbl2, cells, rowH, ty, ctx.geom.MT, ctx.geom.BODY_H, slack, cellFloatSpan(ctx.geom.MT, ctx.geom.BODY_H, ctx.extentMemo, slack), depth !== 1, depth !== 1 && ctx.splitContMT !== void 0 ? ctx.splitContMT : ctx.geom.MT) : rowH.map((h, r) => [{ page: 0, y: ty + rowY[r], h }]);
|
|
57167
57192
|
const splitSaved2 = ctx.splitCell;
|
|
57168
57193
|
ctx.splitCell = false;
|
|
@@ -57186,8 +57211,8 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
57186
57211
|
const groups = pages.map((pg, k) => {
|
|
57187
57212
|
const on = span2.filter((pc) => pc.page === pg);
|
|
57188
57213
|
const y0 = Math.min(...on.map((pc) => pc.y)), y1 = Math.max(...on.map((pc) => pc.y + pc.h));
|
|
57189
|
-
const from = k === 0 ? 0 : _nullishCoalesce(_optionalChain([partTop, 'call',
|
|
57190
|
-
const to = k === pages.length - 1 ? Number.POSITIVE_INFINITY : _nullishCoalesce(_optionalChain([partTop, 'call',
|
|
57214
|
+
const from = k === 0 ? 0 : _nullishCoalesce(_optionalChain([partTop, 'call', _1698 => _1698(k), 'optionalAccess', _1699 => _1699.origin]), () => ( Number.POSITIVE_INFINITY));
|
|
57215
|
+
const to = k === pages.length - 1 ? Number.POSITIVE_INFINITY : _nullishCoalesce(_optionalChain([partTop, 'call', _1700 => _1700(k + 1), 'optionalAccess', _1701 => _1701.top]), () => ( Number.POSITIVE_INFINITY));
|
|
57191
57216
|
return { page: pg, y: y0, h: y1 - y0, range: /* @__PURE__ */ new Map([[c.el, [from, to]]]) };
|
|
57192
57217
|
});
|
|
57193
57218
|
groups.forEach((pc, k) => geom.push({ c, page: startPage + pc.page, ...xw(c), y: pc.y, h: pc.h, pieces: k === 0 ? groups : [] }));
|
|
@@ -57206,7 +57231,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
57206
57231
|
for (const g3 of geom) {
|
|
57207
57232
|
ctx.page = g3.page;
|
|
57208
57233
|
const bf = g3.c.bfId != null ? ctx.styles.borderFill.get(g3.c.bfId) : void 0;
|
|
57209
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
57234
|
+
if (_optionalChain([bf, 'optionalAccess', _1702 => _1702.fill])) emit(ctx, `<rect x="${pt2(g3.x)}" y="${pt2(g3.y)}" width="${pt2(g3.w)}" height="${pt2(g3.h)}" fill="${escapeXml7(bf.fill)}"/>`);
|
|
57210
57235
|
}
|
|
57211
57236
|
for (const g3 of geom) {
|
|
57212
57237
|
const { c } = g3;
|
|
@@ -57217,14 +57242,14 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
57217
57242
|
const boxes = cellLineBoxes(c, ctx.geom.BODY_H);
|
|
57218
57243
|
const contV = new Map(boxes.map((b) => [b.seg, b.top]));
|
|
57219
57244
|
const pieceOf = (v) => Math.max(0, g3.pieces.findIndex((pc) => {
|
|
57220
|
-
const r = _optionalChain([pc, 'access',
|
|
57245
|
+
const r = _optionalChain([pc, 'access', _1703 => _1703.range, 'optionalAccess', _1704 => _1704.get, 'call', _1705 => _1705(c.el)]);
|
|
57221
57246
|
return !!r && v >= r[0] && v < r[1];
|
|
57222
57247
|
}));
|
|
57223
57248
|
const va2 = _nullishCoalesce(c.sub.getAttribute("vertAlign"), () => ( "TOP"));
|
|
57224
57249
|
const lastK = g3.pieces.length - 1;
|
|
57225
57250
|
const pieceOff = g3.pieces.map((pc, k) => {
|
|
57226
57251
|
if (va2 === "TOP" || k > 0 && k < lastK || pc.fill) return 0;
|
|
57227
|
-
const from = _nullishCoalesce(_optionalChain([pc, 'access',
|
|
57252
|
+
const from = _nullishCoalesce(_optionalChain([pc, 'access', _1706 => _1706.range, 'optionalAccess', _1707 => _1707.get, 'call', _1708 => _1708(c.el), 'optionalAccess', _1709 => _1709[0]]), () => ( 0));
|
|
57228
57253
|
const bottoms = boxes.filter((b) => pieceOf(b.top) === k).map((b) => b.bottom - from);
|
|
57229
57254
|
if (k > 0) for (const f of subFloatBottoms(c.sub)) {
|
|
57230
57255
|
const b = boxes.find((x) => x.seg === f.seg);
|
|
@@ -57241,7 +57266,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
57241
57266
|
const pages = segs.map((sg) => {
|
|
57242
57267
|
const v = _nullishCoalesce(contV.get(sg), () => ( num2(sg, "vertpos")));
|
|
57243
57268
|
const k = pieceOf(v);
|
|
57244
|
-
const pc = g3.pieces[k], from = _nullishCoalesce(_optionalChain([pc, 'access',
|
|
57269
|
+
const pc = g3.pieces[k], from = _nullishCoalesce(_optionalChain([pc, 'access', _1710 => _1710.range, 'optionalAccess', _1711 => _1711.get, 'call', _1712 => _1712(c.el), 'optionalAccess', _1713 => _1713[0]]), () => ( 0));
|
|
57245
57270
|
sg.setAttribute("vertpos", String(v - from + pc.y + c.marginT + pieceOff[k] - base));
|
|
57246
57271
|
return startPage + pc.page;
|
|
57247
57272
|
});
|
|
@@ -57336,7 +57361,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
57336
57361
|
}
|
|
57337
57362
|
function drawPicFrame(pic, x, y, w, h, transform, ctx) {
|
|
57338
57363
|
const img = findFirst(pic, "img");
|
|
57339
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
57364
|
+
const ref = _optionalChain([img, 'optionalAccess', _1714 => _1714.getAttribute, 'call', _1715 => _1715("binaryItemIDRef")]);
|
|
57340
57365
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
57341
57366
|
const imgId = ctx.regions.add("image", bboxOf(ctx, x, y, w, h), { sourceId: _nullishCoalesce(ref, () => ( void 0)), parentId: parentId(ctx) });
|
|
57342
57367
|
emit(ctx, regionOpenTag(imgId, "image", pageNo(ctx)));
|
|
@@ -57382,12 +57407,12 @@ function readSectionGeom(root) {
|
|
|
57382
57407
|
const pagePr = findFirst(root, "pagePr");
|
|
57383
57408
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
57384
57409
|
let PW = num2(pagePr, "width", 59528), PH = num2(pagePr, "height", 84188);
|
|
57385
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
57410
|
+
if (_optionalChain([pagePr, 'optionalAccess', _1716 => _1716.getAttribute, 'call', _1717 => _1717("landscape")]) === "NARROWLY" && PW < PH) {
|
|
57386
57411
|
const t = PW;
|
|
57387
57412
|
PW = PH;
|
|
57388
57413
|
PH = t;
|
|
57389
57414
|
}
|
|
57390
|
-
const gutterType = _nullishCoalesce(_optionalChain([pagePr, 'optionalAccess',
|
|
57415
|
+
const gutterType = _nullishCoalesce(_optionalChain([pagePr, 'optionalAccess', _1718 => _1718.getAttribute, 'call', _1719 => _1719("gutterType")]), () => ( "LEFT_ONLY")), gutter = num2(margin, "gutter", 0);
|
|
57391
57416
|
const gL = gutterType === "TOP_BOTTOM" ? 0 : gutter, gT = gutterType === "TOP_BOTTOM" ? gutter : 0;
|
|
57392
57417
|
const ML = num2(margin, "left", 8504) + gL;
|
|
57393
57418
|
const MT = num2(margin, "top", 5668) + num2(margin, "header", 0) + gT;
|
|
@@ -57467,10 +57492,20 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
57467
57492
|
const lsa = findChildByLocalName(q, "linesegarray");
|
|
57468
57493
|
if (lsa) q.removeChild(lsa);
|
|
57469
57494
|
}
|
|
57495
|
+
else if (paras.some((q) => {
|
|
57496
|
+
const runs = elements(q).filter((r) => ln(r) === "run");
|
|
57497
|
+
if (!runs.length || runs.some((r) => elements(r).some((c) => ln(c) !== "t"))) return false;
|
|
57498
|
+
const ch = Math.max(...runs.map((r) => (_nullishCoalesce(ctxBase.styles.charPr.get(_nullishCoalesce(r.getAttribute("charPrIDRef"), () => ( ""))), () => ( DEFAULT_CHAR))).height));
|
|
57499
|
+
const lsa = findChildByLocalName(q, "linesegarray");
|
|
57500
|
+
return (lsa ? elements(lsa) : []).some((sg) => ln(sg) === "lineseg" && num2(sg, "textheight") > ch * 1.5);
|
|
57501
|
+
})) for (const q of paras) {
|
|
57502
|
+
const lsa = findChildByLocalName(q, "linesegarray");
|
|
57503
|
+
if (lsa) q.removeChild(lsa);
|
|
57504
|
+
}
|
|
57470
57505
|
}
|
|
57471
57506
|
const absolute = !degenerate && absoluteTopCache(root, ML, BODY_W);
|
|
57472
57507
|
if (absolute) {
|
|
57473
|
-
for (const lsa of Array.from(root.getElementsByTagName("*")).filter((e) => ln(e) === "linesegarray")) _optionalChain([lsa, 'access',
|
|
57508
|
+
for (const lsa of Array.from(root.getElementsByTagName("*")).filter((e) => ln(e) === "linesegarray")) _optionalChain([lsa, 'access', _1720 => _1720.parentNode, 'optionalAccess', _1721 => _1721.removeChild, 'call', _1722 => _1722(lsa)]);
|
|
57474
57509
|
ctxBase.warnings.push("\uC870\uD310 \uCE90\uC2DC\uAC00 \uCABD \uAE30\uC900 \uC88C\uD45C\uB85C \uC801\uD600 \uC788\uC5B4 \uB2E4\uC2DC \uC870\uD310\uD574 \uB80C\uB354");
|
|
57475
57510
|
}
|
|
57476
57511
|
const mixed = !doReflow && !degenerate && !absolute && Array.from(root.getElementsByTagName("*")).some((p) => ln(p) === "p" && !findChildByLocalName(p, "linesegarray"));
|
|
@@ -57531,7 +57566,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
57531
57566
|
pendingEnd = 0;
|
|
57532
57567
|
} else {
|
|
57533
57568
|
const brk = v < prevV ? !multiCol || h <= prevH : v === prevV && h <= prevH && prevEnd > v && v < BODY_H / 2;
|
|
57534
|
-
const pbrk = !brk && paraFirst && prevV !== Number.NEGATIVE_INFINITY && p.getAttribute("pageBreak") === "1" && (v < BODY_H / 2 || buildPara(p).objs.some((o) => !o.inline && (_nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
57569
|
+
const pbrk = !brk && paraFirst && prevV !== Number.NEGATIVE_INFINITY && p.getAttribute("pageBreak") === "1" && (v < BODY_H / 2 || buildPara(p).objs.some((o) => !o.inline && (_nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1723 => _1723(o.el, "pos"), 'optionalAccess', _1724 => _1724.getAttribute, 'call', _1725 => _1725("vertRelTo")]), () => ( "PARA"))) === "PARA" && linePushedBy(o, v, 0)));
|
|
57535
57570
|
const obrk = !brk && !pbrk && !multiCol && paraFirst && v > prevV && v < prevEnd - 100 && prevEnd + num2(s, "vertsize") > BODY_H && v < BODY_H / 2;
|
|
57536
57571
|
if (brk || pbrk || obrk) cur++;
|
|
57537
57572
|
if (brk && prevSeg && prevV + prevSeg.vs > BODY_H && v === prevSeg.vs + prevSeg.sp && prevSeg.pages[prevSeg.idx] === cur - 1) {
|
|
@@ -57561,14 +57596,14 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
57561
57596
|
const ls = segEls[segEls.length - 1];
|
|
57562
57597
|
lastEnd = num2(ls, "vertpos") + num2(ls, "vertsize") + num2(ls, "spacing");
|
|
57563
57598
|
lastPage = pagesOf[pagesOf.length - 1];
|
|
57564
|
-
lastSA = _nullishCoalesce(_optionalChain([geom0, 'access',
|
|
57599
|
+
lastSA = _nullishCoalesce(_optionalChain([geom0, 'access', _1726 => _1726.get, 'call', _1727 => _1727(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1728 => _1728.spaceAfter]), () => ( 0));
|
|
57565
57600
|
}
|
|
57566
57601
|
if (!localCols && segEls.length) {
|
|
57567
57602
|
const m0 = buildPara(p);
|
|
57568
57603
|
for (const o of m0.objs) {
|
|
57569
57604
|
if (o.tag !== "tbl") continue;
|
|
57570
57605
|
const pos = findChildByLocalName(o.el, "pos"), om = findChildByLocalName(o.el, "outMargin");
|
|
57571
|
-
if (!o.inline && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
57606
|
+
if (!o.inline && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1729 => _1729.getAttribute, 'call', _1730 => _1730("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
57572
57607
|
const segK = Math.max(0, m0.segs.findIndex((sg, k) => sg.textpos <= o.index && (k === m0.segs.length - 1 || m0.segs[k + 1].textpos > o.index)));
|
|
57573
57608
|
const segV = num2(segEls[segK], "vertpos");
|
|
57574
57609
|
const h = Math.max(o.height, measureTableHeight(o.el, ctxBase.extentMemo)), omT = num2(om, "top"), omB = num2(om, "bottom");
|
|
@@ -57582,10 +57617,10 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
57582
57617
|
}
|
|
57583
57618
|
const nTb = m0.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM").length;
|
|
57584
57619
|
const wrapP = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
57585
|
-
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? _nullishCoalesce(_optionalChain([geom0, 'access',
|
|
57620
|
+
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? _nullishCoalesce(_optionalChain([geom0, 'access', _1731 => _1731.get, 'call', _1732 => _1732(m0.paraPrId), 'optionalAccess', _1733 => _1733.spaceBefore]), () => ( 0)) : 0;
|
|
57586
57621
|
const stay = nTb < 2 && !m0.objs.some((q) => q.inline) && !m0.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "") && !(!o.inline && wrapP === "TOP_AND_BOTTOM" && linePushedBy(o, segV, pTop));
|
|
57587
57622
|
const nonPush = wrapP !== "TOP_AND_BOTTOM" && pTop !== void 0 && segV > pTop + sbP + 100 ? pTop + sbP : void 0;
|
|
57588
|
-
const voP = Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
57623
|
+
const voP = Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1734 => _1734.getAttribute, 'call', _1735 => _1735("vertOffset")]), () => ( void 0)), 0));
|
|
57589
57624
|
const paraStart = segK === 0 && pTop !== void 0 && pTop < segV ? pTop : segV;
|
|
57590
57625
|
const below = !o.inline && wrapP === "TOP_AND_BOTTOM" && voP + omT >= num2(segEls[segK], "textheight") && !linePushedBy(o, segV, pTop);
|
|
57591
57626
|
const ty = o.inline ? MT + segV + omT : nonPush !== void 0 ? MT + nonPush + omT + voP : MT + (below ? segV - (segK === 0 ? sbP : 0) : stay ? segV - sbP : pushed - voP >= -100 ? pushed - voP : paraStart) + omT + voP;
|
|
@@ -57614,7 +57649,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
57614
57649
|
for (const p of elements(root)) {
|
|
57615
57650
|
if (ln(p) !== "p") continue;
|
|
57616
57651
|
const pg = paraSegPages.get(p);
|
|
57617
|
-
if (!_optionalChain([pg, 'optionalAccess',
|
|
57652
|
+
if (!_optionalChain([pg, 'optionalAccess', _1736 => _1736.length])) continue;
|
|
57618
57653
|
const pm = buildPara(p);
|
|
57619
57654
|
if (pm.objs.length || pm.chars.some((c) => c.ch.trim() !== "" || !!c.ctrlText)) lastContent = Math.max(lastContent, ...pg);
|
|
57620
57655
|
}
|
|
@@ -57631,7 +57666,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
57631
57666
|
for (const p of elements(root)) {
|
|
57632
57667
|
if (ln(p) !== "p") continue;
|
|
57633
57668
|
const pg = paraSegPages.get(p);
|
|
57634
|
-
if (!_optionalChain([pg, 'optionalAccess',
|
|
57669
|
+
if (!_optionalChain([pg, 'optionalAccess', _1737 => _1737.includes, 'call', _1738 => _1738(lastContent)])) continue;
|
|
57635
57670
|
const pm = buildPara(p);
|
|
57636
57671
|
pm.segs.forEach((sg, k) => {
|
|
57637
57672
|
if (pg[k] !== lastContent) return;
|
|
@@ -57651,7 +57686,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
57651
57686
|
const ens = endNoteLayout(root, paraSegPages, geom);
|
|
57652
57687
|
const ctx = {
|
|
57653
57688
|
...ctxBase,
|
|
57654
|
-
pages: Array.from({ length: Math.max(nPages, _nullishCoalesce(_optionalChain([ens, 'optionalAccess',
|
|
57689
|
+
pages: Array.from({ length: Math.max(nPages, _nullishCoalesce(_optionalChain([ens, 'optionalAccess', _1739 => _1739.pageCount]), () => ( 0))) }, () => []),
|
|
57655
57690
|
page: 0,
|
|
57656
57691
|
geom,
|
|
57657
57692
|
pageH,
|
|
@@ -57710,7 +57745,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
57710
57745
|
ctx.bodyDx = void 0;
|
|
57711
57746
|
wrapMirror(ctx.pages, (page) => _nullishCoalesce(bodyStart[page], () => ( 0)));
|
|
57712
57747
|
const allPages = new Map(paraSegPages);
|
|
57713
|
-
for (const e of _nullishCoalesce(_optionalChain([ens, 'optionalAccess',
|
|
57748
|
+
for (const e of _nullishCoalesce(_optionalChain([ens, 'optionalAccess', _1740 => _1740.paras]), () => ( []))) allPages.set(e.p, e.pages);
|
|
57714
57749
|
drawPageDecor(root, allPages, ctx, localCols ? nCol : 1, colW, colGap);
|
|
57715
57750
|
drawPageNumbers(root, paraSegPages, ctx);
|
|
57716
57751
|
ctx.page = 0;
|
|
@@ -57780,7 +57815,7 @@ function drawPageNumbers(root, paraPages, ctx) {
|
|
|
57780
57815
|
const hidden = /* @__PURE__ */ new Set();
|
|
57781
57816
|
const restarts = [];
|
|
57782
57817
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
57783
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
57818
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1741 => _1741.get, 'call', _1742 => _1742(p), 'optionalAccess', _1743 => _1743[0]]), () => ( 0));
|
|
57784
57819
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
57785
57820
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
57786
57821
|
const pn = findChildByLocalName(ctrl, "pageNum"), ph = findChildByLocalName(ctrl, "pageHiding"), nn = findChildByLocalName(ctrl, "newNum");
|
|
@@ -57836,7 +57871,7 @@ function renderSectionRoots(sections, input) {
|
|
|
57836
57871
|
return pm.objs.length > 0 || pm.chars.some((c) => c.ch.trim() !== "" || !!c.ctrlText);
|
|
57837
57872
|
});
|
|
57838
57873
|
let lastIdx = sections.length - 1;
|
|
57839
|
-
while (lastIdx > 0 && !hasContent(sections[lastIdx].root) && !_optionalChain([sections, 'access',
|
|
57874
|
+
while (lastIdx > 0 && !hasContent(sections[lastIdx].root) && !_optionalChain([sections, 'access', _1744 => _1744[lastIdx], 'access', _1745 => _1745.masterPages, 'optionalAccess', _1746 => _1746.length])) lastIdx--;
|
|
57840
57875
|
for (const [k, { root, index, masterPages, hasDeletionMarkers }] of sections.entries()) {
|
|
57841
57876
|
if (k > lastIdx) break;
|
|
57842
57877
|
const geom = readSectionGeom(root);
|
|
@@ -57844,34 +57879,34 @@ function renderSectionRoots(sections, input) {
|
|
|
57844
57879
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${index}` });
|
|
57845
57880
|
ctxBase.pageBase += pages.length;
|
|
57846
57881
|
}
|
|
57847
|
-
if (rendered.length === 0) throw new (0,
|
|
57882
|
+
if (rendered.length === 0) throw new (0, _chunkYOLFNCQQcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
57848
57883
|
return { sections: rendered, defs: ctxBase.defs, warnings: input.warnings, stats: ctxBase.stats, regions: ctxBase.regions.regions };
|
|
57849
57884
|
}
|
|
57850
57885
|
var SVG_FONT_FAMILY = `'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif`;
|
|
57851
57886
|
async function renderHwpxInternal(input, options) {
|
|
57852
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
57887
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1747 => _1747.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
57853
57888
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
57854
|
-
|
|
57889
|
+
_chunkYOLFNCQQcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
57855
57890
|
let zip;
|
|
57856
57891
|
try {
|
|
57857
57892
|
zip = await _jszip2.default.loadAsync(input);
|
|
57858
57893
|
} catch (e50) {
|
|
57859
|
-
throw new (0,
|
|
57894
|
+
throw new (0, _chunkYOLFNCQQcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
57860
57895
|
}
|
|
57861
|
-
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) =>
|
|
57862
|
-
if (secFiles.length === 0) throw new (0,
|
|
57896
|
+
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => _chunkYOLFNCQQcjs.compareSectionPaths.call(void 0, a.name, b.name));
|
|
57897
|
+
if (secFiles.length === 0) throw new (0, _chunkYOLFNCQQcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
57863
57898
|
const warnings = [];
|
|
57864
57899
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
57865
57900
|
const verFile = zip.file("version.xml");
|
|
57866
57901
|
const verXml = verFile ? await readZipEntry(verFile, "text") : void 0;
|
|
57867
57902
|
const appMajor = hwpxAppMajor(verXml), appBuild = hwpxAppBuild(verXml);
|
|
57868
|
-
const headXml = headFile ?
|
|
57903
|
+
const headXml = headFile ? _chunkYOLFNCQQcjs.stripDtd.call(void 0, await readZipEntry(headFile, "text")) : void 0;
|
|
57869
57904
|
let styles = headXml ? parseRenderStyles(headXml, { appMajor, appBuild }) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
57870
57905
|
if (!headFile) warnings.push("header.xml \uC5C6\uC74C \u2014 \uAE30\uBCF8 \uC2A4\uD0C0\uC77C\uB85C \uB80C\uB354");
|
|
57871
57906
|
const secXmls = [];
|
|
57872
57907
|
for (const f of secFiles) {
|
|
57873
|
-
const xml =
|
|
57874
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
57908
|
+
const xml = _chunkYOLFNCQQcjs.stripDtd.call(void 0, await readZipEntry(f, "text"));
|
|
57909
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkYOLFNCQQcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
57875
57910
|
secXmls.push(xml);
|
|
57876
57911
|
}
|
|
57877
57912
|
if (headXml && hasKoPubSubst(headXml)) {
|
|
@@ -57881,8 +57916,8 @@ async function renderHwpxInternal(input, options) {
|
|
|
57881
57916
|
const masterPages = /* @__PURE__ */ new Map();
|
|
57882
57917
|
const masterXmls = [];
|
|
57883
57918
|
for (const file of zip.file(/Contents\/masterpage[^/]*\.xml$/i)) {
|
|
57884
|
-
const xml =
|
|
57885
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
57919
|
+
const xml = _chunkYOLFNCQQcjs.stripDtd.call(void 0, await readZipEntry(file, "text"));
|
|
57920
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkYOLFNCQQcjs.KordocError)("\uBC14\uD0D5\uCABD XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
57886
57921
|
const root = createXmlParser().parseFromString(xml, "text/xml").documentElement;
|
|
57887
57922
|
if (root && ln(root) === "masterPage") {
|
|
57888
57923
|
masterPages.set(root.getAttribute("id") || file.name.replace(/^.*\/|\.xml$/g, ""), root);
|
|
@@ -57910,7 +57945,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
57910
57945
|
let href = binmap.get(ref);
|
|
57911
57946
|
if (!href) {
|
|
57912
57947
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
57913
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
57948
|
+
href = _optionalChain([cand, 'optionalAccess', _1748 => _1748.name]);
|
|
57914
57949
|
}
|
|
57915
57950
|
if (!href) continue;
|
|
57916
57951
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -57933,7 +57968,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
57933
57968
|
for (let si = 0; si < secXmls.length; si++) {
|
|
57934
57969
|
const secXml = secXmls[si];
|
|
57935
57970
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
57936
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
57971
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _1749 => _1749.reflow])) {
|
|
57937
57972
|
noCacheSkipped = true;
|
|
57938
57973
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
57939
57974
|
continue;
|
|
@@ -57958,11 +57993,11 @@ async function renderHwpxInternal(input, options) {
|
|
|
57958
57993
|
}
|
|
57959
57994
|
if (roots.length === 0) {
|
|
57960
57995
|
if (noCacheSkipped) {
|
|
57961
|
-
throw new (0,
|
|
57996
|
+
throw new (0, _chunkYOLFNCQQcjs.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)");
|
|
57962
57997
|
}
|
|
57963
|
-
throw new (0,
|
|
57998
|
+
throw new (0, _chunkYOLFNCQQcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
57964
57999
|
}
|
|
57965
|
-
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
58000
|
+
return 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]) });
|
|
57966
58001
|
}
|
|
57967
58002
|
async function renderHwpxToSvg(input, options) {
|
|
57968
58003
|
const r = await renderHwpxInternal(input, options);
|
|
@@ -58185,7 +58220,7 @@ var FOLD_END = 42124;
|
|
|
58185
58220
|
var FOLD_SHIFT = 983040 - 40960;
|
|
58186
58221
|
function textChar(ch) {
|
|
58187
58222
|
if (ch >= FOLD_START && ch <= FOLD_END) {
|
|
58188
|
-
const mapped =
|
|
58223
|
+
const mapped = _chunkT7Z554HTcjs.mapPuaText.call(void 0, String.fromCodePoint(ch + FOLD_SHIFT));
|
|
58189
58224
|
return /[\u{F0000}-\u{FFFFF}]/u.test(mapped) ? "" : mapped;
|
|
58190
58225
|
}
|
|
58191
58226
|
if (ch === 65534 || ch === 65535 || ch >= 55296 && ch <= 57343) return "\uFFFD";
|
|
@@ -58277,7 +58312,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
58277
58312
|
out += run.join("") + "</hp:run>";
|
|
58278
58313
|
run = [];
|
|
58279
58314
|
};
|
|
58280
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
58315
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _1753 => _1753[0], 'optionalAccess', _1754 => _1754[1]]), () => ( 0)));
|
|
58281
58316
|
let pos = 0, ctrlIdx = 0, o = 0;
|
|
58282
58317
|
const switchShape = () => {
|
|
58283
58318
|
while (shapeIdx + 1 < shapes.length && pos >= shapes[shapeIdx + 1][0]) {
|
|
@@ -58363,7 +58398,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
58363
58398
|
closeRun();
|
|
58364
58399
|
const rest = ctrls.filter((c) => !c.used && (c.id === CTRL_TBL3 || c.id === CTRL_GSO3 || c.id === CTRL_SECD2 || c.id === CTRL_COLD2));
|
|
58365
58400
|
if (rest.length > 0) {
|
|
58366
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
58401
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _1755 => _1755[0], 'optionalAccess', _1756 => _1756[1]]), () => ( 0)));
|
|
58367
58402
|
for (const c of rest) {
|
|
58368
58403
|
const el = ctrlElement(ctrls.indexOf(c), c.id);
|
|
58369
58404
|
run.push(el);
|
|
@@ -58529,14 +58564,14 @@ function hwp5SectionToXml(records, ctx) {
|
|
|
58529
58564
|
return `<hs:sec xmlns:hs="http://www.hancom.co.kr/hwpml/2011/section" xmlns:hp="http://www.hancom.co.kr/hwpml/2011/paragraph" xmlns:hc="http://www.hancom.co.kr/hwpml/2011/core">` + paragraphsXml(records, 0, records.length, 0, ctx, 0) + "</hs:sec>";
|
|
58530
58565
|
}
|
|
58531
58566
|
function renderHwp5Records(docInfo, styles, secRecords, binData, options, select, warnings = []) {
|
|
58532
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
58567
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1757 => _1757.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
58533
58568
|
const MAX_TOTAL_IMAGE_BYTES = 128 * 1024 * 1024;
|
|
58534
58569
|
const images = /* @__PURE__ */ new Map();
|
|
58535
58570
|
let totalImgBytes = 0;
|
|
58536
58571
|
const imageRef = (binDataId) => {
|
|
58537
58572
|
if (binDataId <= 0) return null;
|
|
58538
|
-
const item = _optionalChain([docInfo, 'optionalAccess',
|
|
58539
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
58573
|
+
const item = _optionalChain([docInfo, 'optionalAccess', _1758 => _1758.binData, 'access', _1759 => _1759[binDataId - 1]]);
|
|
58574
|
+
if (_optionalChain([item, 'optionalAccess', _1760 => _1760.kind]) === "link") return null;
|
|
58540
58575
|
const storageId = item && item.storageId > 0 ? item.storageId : binDataId;
|
|
58541
58576
|
const ref = `bin${storageId}`;
|
|
58542
58577
|
if (images.has(ref)) return ref;
|
|
@@ -58570,8 +58605,8 @@ function renderHwp5Records(docInfo, styles, secRecords, binData, options, select
|
|
|
58570
58605
|
}
|
|
58571
58606
|
roots.push({ root, index: si });
|
|
58572
58607
|
}
|
|
58573
|
-
if (roots.length === 0) throw new (0,
|
|
58574
|
-
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
58608
|
+
if (roots.length === 0) throw new (0, _chunkYOLFNCQQcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP \uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
58609
|
+
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1761 => _1761.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1762 => _1762.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1763 => _1763.highlights]) });
|
|
58575
58610
|
return assemblePageSvgs(r, "hwp", select);
|
|
58576
58611
|
}
|
|
58577
58612
|
function renderHwp5Pages(input, options, select) {
|
|
@@ -58583,7 +58618,7 @@ function renderHwp5Pages(input, options, select) {
|
|
|
58583
58618
|
const styles = buildHwp5RenderStyles(_nullishCoalesce(docInfoRecords, () => ( [])));
|
|
58584
58619
|
const docInfo = docInfoRecords ? parseDocInfo(docInfoRecords) : null;
|
|
58585
58620
|
const sections = readHwp5SectionStreams(c);
|
|
58586
|
-
if (sections.length === 0) throw new (0,
|
|
58621
|
+
if (sections.length === 0) throw new (0, _chunkYOLFNCQQcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
58587
58622
|
const parseWarnings = [];
|
|
58588
58623
|
const secRecords = readHwp5SectionRecords(c, sections, parseWarnings);
|
|
58589
58624
|
for (const w of parseWarnings) warnings.push(w.message);
|
|
@@ -58669,14 +58704,14 @@ async function loadSharp() {
|
|
|
58669
58704
|
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("sharp")));
|
|
58670
58705
|
return _nullishCoalesce(mod.default, () => ( mod));
|
|
58671
58706
|
} catch (e53) {
|
|
58672
|
-
throw new (0,
|
|
58673
|
-
'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.' +
|
|
58707
|
+
throw new (0, _chunkYOLFNCQQcjs.KordocError)(
|
|
58708
|
+
'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.' + _chunkYOLFNCQQcjs.OPTIONAL_DEP_INSTALL_HINT
|
|
58674
58709
|
);
|
|
58675
58710
|
}
|
|
58676
58711
|
}
|
|
58677
58712
|
async function rasterizePageSvg(svg, widthPt, heightPt, options = {}) {
|
|
58678
58713
|
const sharp = await loadSharp();
|
|
58679
|
-
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0,
|
|
58714
|
+
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0, _chunkYOLFNCQQcjs.KordocError)(`\uC798\uBABB\uB41C \uD398\uC774\uC9C0 \uD06C\uAE30: ${widthPt}x${heightPt}pt`);
|
|
58680
58715
|
const maxW = _nullishCoalesce(options.maxWidthPx, () => ( 1400));
|
|
58681
58716
|
const maxH = _nullishCoalesce(options.maxHeightPx, () => ( 4e3));
|
|
58682
58717
|
const scale2 = Math.min(maxW / widthPt, maxH / heightPt, 2);
|
|
@@ -58694,11 +58729,11 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
58694
58729
|
try {
|
|
58695
58730
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
58696
58731
|
} catch (e54) {
|
|
58697
|
-
throw new (0,
|
|
58732
|
+
throw new (0, _chunkYOLFNCQQcjs.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");
|
|
58698
58733
|
}
|
|
58699
58734
|
const executablePath = _nullishCoalesce(_nullishCoalesce(options.browserExecutablePath, () => ( process.env.PUPPETEER_EXECUTABLE_PATH)), () => ( findChromiumPath()));
|
|
58700
58735
|
if (!executablePath) {
|
|
58701
|
-
throw new (0,
|
|
58736
|
+
throw new (0, _chunkYOLFNCQQcjs.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");
|
|
58702
58737
|
}
|
|
58703
58738
|
const { browser, page } = await launchLockedPage(puppeteer, executablePath);
|
|
58704
58739
|
try {
|
|
@@ -58714,13 +58749,13 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
58714
58749
|
async function loadBuffer(input) {
|
|
58715
58750
|
if (typeof input === "string") {
|
|
58716
58751
|
try {
|
|
58717
|
-
return
|
|
58752
|
+
return _chunkYOLFNCQQcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input));
|
|
58718
58753
|
} catch (err) {
|
|
58719
58754
|
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
58720
|
-
throw new (0,
|
|
58755
|
+
throw new (0, _chunkYOLFNCQQcjs.KordocError)(code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`);
|
|
58721
58756
|
}
|
|
58722
58757
|
}
|
|
58723
|
-
if (Buffer.isBuffer(input)) return
|
|
58758
|
+
if (Buffer.isBuffer(input)) return _chunkYOLFNCQQcjs.toArrayBuffer.call(void 0, input);
|
|
58724
58759
|
if (input instanceof Uint8Array) return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
|
|
58725
58760
|
return input;
|
|
58726
58761
|
}
|
|
@@ -58729,17 +58764,17 @@ async function sourceFormatOf(buffer) {
|
|
|
58729
58764
|
if (format2 === "hwpx") {
|
|
58730
58765
|
const zip = await detectZipFormat(buffer);
|
|
58731
58766
|
if (zip === "hwpx" || zip === "unknown") return "hwpx";
|
|
58732
|
-
throw new (0,
|
|
58767
|
+
throw new (0, _chunkYOLFNCQQcjs.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`);
|
|
58733
58768
|
}
|
|
58734
58769
|
if (format2 === "hwp") return "hwp";
|
|
58735
|
-
throw new (0,
|
|
58770
|
+
throw new (0, _chunkYOLFNCQQcjs.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`);
|
|
58736
58771
|
}
|
|
58737
58772
|
async function renderDocumentToScene(input, options = {}) {
|
|
58738
58773
|
const buffer = await loadBuffer(input);
|
|
58739
58774
|
const source = await sourceFormatOf(buffer);
|
|
58740
58775
|
const select = options.pages !== void 0 ? (pageCount) => {
|
|
58741
58776
|
const set = _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, pageCount);
|
|
58742
|
-
if (set.size === 0) throw new (0,
|
|
58777
|
+
if (set.size === 0) throw new (0, _chunkYOLFNCQQcjs.KordocError)(`\uC120\uD0DD\uD55C \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uBB38\uC11C\uB294 ${pageCount}\uCABD (pages: ${JSON.stringify(options.pages)})`);
|
|
58743
58778
|
return set;
|
|
58744
58779
|
} : void 0;
|
|
58745
58780
|
const renderOptions = { reflow: _nullishCoalesce(options.reflow, () => ( true)), reflowMode: options.reflowMode, highlights: options.highlights, maxImageBytes: options.maxImageBytes };
|
|
@@ -58775,7 +58810,7 @@ async function renderDocument(input, options) {
|
|
|
58775
58810
|
break;
|
|
58776
58811
|
}
|
|
58777
58812
|
default:
|
|
58778
|
-
throw new (0,
|
|
58813
|
+
throw new (0, _chunkYOLFNCQQcjs.KordocError)(`\uC54C \uC218 \uC5C6\uB294 \uB80C\uB354 \uD3EC\uB9F7: ${String(options.format)} (svg|html|png|jpeg|pdf)`);
|
|
58779
58814
|
}
|
|
58780
58815
|
return { scene, assets };
|
|
58781
58816
|
}
|
|
@@ -58805,7 +58840,7 @@ async function extractRenderedRegions(input, options = {}) {
|
|
|
58805
58840
|
const out = [];
|
|
58806
58841
|
for (const [page, items] of [...byPage.entries()].sort((a, b) => a[0] - b[0])) {
|
|
58807
58842
|
const meta = scene.pages.find((p) => p.page === page);
|
|
58808
|
-
if (!meta) throw new (0,
|
|
58843
|
+
if (!meta) throw new (0, _chunkYOLFNCQQcjs.KordocError)(`\uD398\uC774\uC9C0 ${page} \uBA54\uD0C0 \uC5C6\uC74C`);
|
|
58809
58844
|
const raster = await rasterizePageSvg(pageSvgs.get(page), meta.width, meta.height, { format: format2, maxWidthPx: options.maxWidthPx, quality: options.quality });
|
|
58810
58845
|
for (const { region, bbox } of items) {
|
|
58811
58846
|
const rect = cropRect(bbox, raster.scale, raster.widthPx, raster.heightPx, _nullishCoalesce(options.paddingPt, () => ( 0)));
|
|
@@ -58829,9 +58864,9 @@ function wantsCrop(kind, policy) {
|
|
|
58829
58864
|
}
|
|
58830
58865
|
async function extractTables(input, options = {}) {
|
|
58831
58866
|
const policy = _nullishCoalesce(options.policy, () => ( "non-tabular-and-uncertain"));
|
|
58832
|
-
const buffer = typeof input === "string" ?
|
|
58867
|
+
const buffer = typeof input === "string" ? _chunkYOLFNCQQcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input)) : Buffer.isBuffer(input) ? _chunkYOLFNCQQcjs.toArrayBuffer.call(void 0, input) : input;
|
|
58833
58868
|
const parsed = await parse(buffer, { classifyTables: true, layoutTables: "keep" });
|
|
58834
|
-
if (!parsed.success) throw new (0,
|
|
58869
|
+
if (!parsed.success) throw new (0, _chunkYOLFNCQQcjs.KordocError)(`\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
58835
58870
|
const blocks = collectTableBlocks(parsed.blocks);
|
|
58836
58871
|
const out = blocks.map((b, i) => ({
|
|
58837
58872
|
id: _nullishCoalesce(b.table.sourceId, () => ( `tbl-${i + 1}`)),
|
|
@@ -58889,22 +58924,22 @@ async function extractTables(input, options = {}) {
|
|
|
58889
58924
|
// src/index.ts
|
|
58890
58925
|
async function parse(input, options) {
|
|
58891
58926
|
let buffer;
|
|
58892
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
58893
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
58927
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _1764 => _1764.filePath]) ? { ...options, filePath: input } : options;
|
|
58928
|
+
if (_optionalChain([opts, 'optionalAccess', _1765 => _1765.htmlTables]) && opts.tableFormat) {
|
|
58894
58929
|
return { success: false, fileType: "unknown", error: "htmlTables \uC640 tableFormat \uC740 \uD568\uAED8 \uC4F8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4" };
|
|
58895
58930
|
}
|
|
58896
|
-
const ocrOptionError =
|
|
58931
|
+
const ocrOptionError = _chunkT7Z554HTcjs.validateOcrOptions.call(void 0, opts);
|
|
58897
58932
|
if (ocrOptionError) return { success: false, fileType: "unknown", error: ocrOptionError };
|
|
58898
58933
|
if (typeof input === "string") {
|
|
58899
58934
|
try {
|
|
58900
58935
|
const buf = await _promises.readFile.call(void 0, input);
|
|
58901
|
-
buffer =
|
|
58936
|
+
buffer = _chunkYOLFNCQQcjs.toArrayBuffer.call(void 0, buf);
|
|
58902
58937
|
} catch (err) {
|
|
58903
58938
|
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}`;
|
|
58904
|
-
return { success: false, fileType: "unknown", error: msg2, code:
|
|
58939
|
+
return { success: false, fileType: "unknown", error: msg2, code: _chunkYOLFNCQQcjs.classifyError.call(void 0, err) };
|
|
58905
58940
|
}
|
|
58906
58941
|
} else if (Buffer.isBuffer(input)) {
|
|
58907
|
-
buffer =
|
|
58942
|
+
buffer = _chunkYOLFNCQQcjs.toArrayBuffer.call(void 0, input);
|
|
58908
58943
|
} else {
|
|
58909
58944
|
buffer = input;
|
|
58910
58945
|
}
|
|
@@ -58913,23 +58948,23 @@ async function parse(input, options) {
|
|
|
58913
58948
|
}
|
|
58914
58949
|
const format2 = detectFormat(buffer);
|
|
58915
58950
|
const result = await dispatch(format2, buffer, opts);
|
|
58916
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
58951
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1766 => _1766.images]) === false) {
|
|
58917
58952
|
delete result.images;
|
|
58918
58953
|
dropImageBytes(result.blocks);
|
|
58919
58954
|
}
|
|
58920
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
58955
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1767 => _1767.classifyTables])) classifyTableTree(result.blocks);
|
|
58921
58956
|
let out = result;
|
|
58922
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
58957
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1768 => _1768.pages]) && result.pageCount && _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, opts.pages, result.pageCount).size === 0) {
|
|
58923
58958
|
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` }] };
|
|
58924
58959
|
}
|
|
58925
58960
|
if (out.success && !out.pages) {
|
|
58926
|
-
const pages =
|
|
58961
|
+
const pages = _chunk7OZLM5MRcjs.blocksToPages.call(void 0, out.blocks, (bs) => _chunkT7Z554HTcjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([opts, 'optionalAccess', _1769 => _1769.tableFormat]) }));
|
|
58927
58962
|
if (pages) out = { ...out, pages };
|
|
58928
58963
|
}
|
|
58929
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
58964
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _1770 => _1770.plain])) {
|
|
58930
58965
|
out = { ...out, markdown: toPlainMarkdown(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toPlainMarkdown(p.markdown) })) } : {} };
|
|
58931
58966
|
}
|
|
58932
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
58967
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _1771 => _1771.htmlTables])) {
|
|
58933
58968
|
out = { ...out, markdown: toHtmlTables(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toHtmlTables(p.markdown) })) } : {} };
|
|
58934
58969
|
}
|
|
58935
58970
|
return out;
|
|
@@ -58974,42 +59009,42 @@ async function dispatch(format2, buffer, opts) {
|
|
|
58974
59009
|
async function withEmbeddedImageOcr(blocks, markdown, warnings, images, options) {
|
|
58975
59010
|
const list = [..._nullishCoalesce(warnings, () => ( []))];
|
|
58976
59011
|
if (!await ocrEmbeddedImages(blocks, options, list)) return { markdown, warnings: list.length ? list : void 0 };
|
|
58977
|
-
let md2 =
|
|
58978
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
59012
|
+
let md2 = _chunkT7Z554HTcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1772 => _1772.tableFormat]) });
|
|
59013
|
+
if (_optionalChain([options, 'optionalAccess', _1773 => _1773.inlineImages]) && options.images !== false && _optionalChain([images, 'optionalAccess', _1774 => _1774.length])) {
|
|
58979
59014
|
try {
|
|
58980
|
-
md2 =
|
|
59015
|
+
md2 = _chunk7OZLM5MRcjs.inlineImagesIntoMarkdown.call(void 0, md2, images, { compress: true });
|
|
58981
59016
|
} catch (e55) {
|
|
58982
59017
|
}
|
|
58983
59018
|
}
|
|
58984
59019
|
return { markdown: md2, warnings: list.length ? list : void 0 };
|
|
58985
59020
|
}
|
|
58986
59021
|
function scriptsOff(r, off) {
|
|
58987
|
-
return off ?
|
|
59022
|
+
return off ? _chunkT7Z554HTcjs.stripScriptTags.call(void 0, r) : r;
|
|
58988
59023
|
}
|
|
58989
59024
|
async function parseImage(buffer, options) {
|
|
58990
59025
|
try {
|
|
58991
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
59026
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-4FIFSQ5E.cjs")));
|
|
58992
59027
|
const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
|
|
58993
|
-
|
|
59028
|
+
_chunkT7Z554HTcjs.stripScriptTags.call(void 0, { blocks });
|
|
58994
59029
|
return {
|
|
58995
59030
|
success: true,
|
|
58996
59031
|
fileType: "image",
|
|
58997
|
-
markdown:
|
|
59032
|
+
markdown: _chunkT7Z554HTcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1775 => _1775.tableFormat]) }),
|
|
58998
59033
|
blocks,
|
|
58999
59034
|
warnings: warnings.length ? warnings : void 0,
|
|
59000
59035
|
pageCount: 1,
|
|
59001
|
-
..._optionalChain([options, 'optionalAccess',
|
|
59036
|
+
..._optionalChain([options, 'optionalAccess', _1776 => _1776.ocrLines]) ? { ocrLines: lines ? [lines] : [] } : {}
|
|
59002
59037
|
};
|
|
59003
59038
|
} catch (err) {
|
|
59004
|
-
return { success: false, fileType: "image", error:
|
|
59039
|
+
return { success: false, fileType: "image", error: _chunkYOLFNCQQcjs.sanitizeError.call(void 0, err), code: _chunkYOLFNCQQcjs.classifyError.call(void 0, err) };
|
|
59005
59040
|
}
|
|
59006
59041
|
}
|
|
59007
59042
|
async function parseHwp3(buffer, options) {
|
|
59008
59043
|
try {
|
|
59009
59044
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp3Document(buffer, options);
|
|
59010
|
-
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
59045
|
+
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess', _1777 => _1777.pageCount]) };
|
|
59011
59046
|
} catch (err) {
|
|
59012
|
-
return { success: false, fileType: "hwp3", error:
|
|
59047
|
+
return { success: false, fileType: "hwp3", error: _chunkYOLFNCQQcjs.sanitizeError.call(void 0, err), code: _chunkYOLFNCQQcjs.classifyError.call(void 0, err) };
|
|
59013
59048
|
}
|
|
59014
59049
|
}
|
|
59015
59050
|
async function parseHwpx(buffer, options) {
|
|
@@ -59017,15 +59052,15 @@ async function parseHwpx(buffer, options) {
|
|
|
59017
59052
|
const doc = await parseHwpxDocument(buffer, options);
|
|
59018
59053
|
const { blocks, metadata, outline, images } = doc;
|
|
59019
59054
|
const { markdown, warnings } = await withEmbeddedImageOcr(blocks, doc.markdown, doc.warnings, void 0, options);
|
|
59020
|
-
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
59055
|
+
return scriptsOff({ success: true, fileType: "hwpx", 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);
|
|
59021
59056
|
} catch (err) {
|
|
59022
|
-
return { success: false, fileType: "hwpx", error:
|
|
59057
|
+
return { success: false, fileType: "hwpx", error: _chunkYOLFNCQQcjs.sanitizeError.call(void 0, err), code: _chunkYOLFNCQQcjs.classifyError.call(void 0, err) };
|
|
59023
59058
|
}
|
|
59024
59059
|
}
|
|
59025
59060
|
async function parseHwp(buffer, options) {
|
|
59026
59061
|
try {
|
|
59027
59062
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
59028
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
59063
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _1781 => _1781.filePath])) {
|
|
59029
59064
|
try {
|
|
59030
59065
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
59031
59066
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -59044,15 +59079,15 @@ async function parseHwp(buffer, options) {
|
|
|
59044
59079
|
}
|
|
59045
59080
|
}
|
|
59046
59081
|
const ocred = await withEmbeddedImageOcr(blocks, markdown, warnings, images, options);
|
|
59047
|
-
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess',
|
|
59082
|
+
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess', _1782 => _1782.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1783 => _1783.pageCount]) }, _optionalChain([options, 'optionalAccess', _1784 => _1784.scriptTags]) === false);
|
|
59048
59083
|
} catch (err) {
|
|
59049
|
-
return { success: false, fileType: "hwp", error:
|
|
59084
|
+
return { success: false, fileType: "hwp", error: _chunkYOLFNCQQcjs.sanitizeError.call(void 0, err), code: _chunkYOLFNCQQcjs.classifyError.call(void 0, err) };
|
|
59050
59085
|
}
|
|
59051
59086
|
}
|
|
59052
59087
|
async function parsePdf(buffer, options) {
|
|
59053
59088
|
let parsePdfDocument;
|
|
59054
59089
|
try {
|
|
59055
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
59090
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-HZI6SSX5.cjs")));
|
|
59056
59091
|
parsePdfDocument = mod.parsePdfDocument;
|
|
59057
59092
|
} catch (e57) {
|
|
59058
59093
|
return {
|
|
@@ -59064,59 +59099,59 @@ async function parsePdf(buffer, options) {
|
|
|
59064
59099
|
}
|
|
59065
59100
|
try {
|
|
59066
59101
|
const { markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, ocrLines } = await parsePdfDocument(buffer, options);
|
|
59067
|
-
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
59102
|
+
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess', _1785 => _1785.pageCount]), ...ocrLines ? { ocrLines } : {} }, _optionalChain([options, 'optionalAccess', _1786 => _1786.scriptTags]) !== true);
|
|
59068
59103
|
} catch (err) {
|
|
59069
59104
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
59070
|
-
return { success: false, fileType: "pdf", error:
|
|
59105
|
+
return { success: false, fileType: "pdf", error: _chunkYOLFNCQQcjs.sanitizeError.call(void 0, err), code: _chunkYOLFNCQQcjs.classifyError.call(void 0, err), isImageBased };
|
|
59071
59106
|
}
|
|
59072
59107
|
}
|
|
59073
59108
|
async function parseXlsx(buffer, options) {
|
|
59074
59109
|
try {
|
|
59075
59110
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
59076
|
-
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
59111
|
+
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1787 => _1787.pageCount]) };
|
|
59077
59112
|
} catch (err) {
|
|
59078
|
-
return { success: false, fileType: "xlsx", error:
|
|
59113
|
+
return { success: false, fileType: "xlsx", error: _chunkYOLFNCQQcjs.sanitizeError.call(void 0, err), code: _chunkYOLFNCQQcjs.classifyError.call(void 0, err) };
|
|
59079
59114
|
}
|
|
59080
59115
|
}
|
|
59081
59116
|
async function parseXls(buffer, options) {
|
|
59082
59117
|
try {
|
|
59083
59118
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
59084
|
-
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
59119
|
+
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1788 => _1788.pageCount]) };
|
|
59085
59120
|
} catch (err) {
|
|
59086
|
-
return { success: false, fileType: "xls", error:
|
|
59121
|
+
return { success: false, fileType: "xls", error: _chunkYOLFNCQQcjs.sanitizeError.call(void 0, err), code: _chunkYOLFNCQQcjs.classifyError.call(void 0, err) };
|
|
59087
59122
|
}
|
|
59088
59123
|
}
|
|
59089
59124
|
async function parseDocx(buffer, options) {
|
|
59090
59125
|
try {
|
|
59091
59126
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
59092
|
-
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
59127
|
+
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1789 => _1789.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1790 => _1790.pageCount]) }, _optionalChain([options, 'optionalAccess', _1791 => _1791.scriptTags]) === false);
|
|
59093
59128
|
} catch (err) {
|
|
59094
|
-
return { success: false, fileType: "docx", error:
|
|
59129
|
+
return { success: false, fileType: "docx", error: _chunkYOLFNCQQcjs.sanitizeError.call(void 0, err), code: _chunkYOLFNCQQcjs.classifyError.call(void 0, err) };
|
|
59095
59130
|
}
|
|
59096
59131
|
}
|
|
59097
59132
|
async function parsePptx(buffer, options) {
|
|
59098
59133
|
try {
|
|
59099
59134
|
const { markdown, blocks, metadata, outline, warnings, images } = await parsePptxDocument(buffer, options);
|
|
59100
|
-
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
59135
|
+
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1792 => _1792.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1793 => _1793.pageCount]) }, _optionalChain([options, 'optionalAccess', _1794 => _1794.scriptTags]) === false);
|
|
59101
59136
|
} catch (err) {
|
|
59102
|
-
return { success: false, fileType: "pptx", error:
|
|
59137
|
+
return { success: false, fileType: "pptx", error: _chunkYOLFNCQQcjs.sanitizeError.call(void 0, err), code: _chunkYOLFNCQQcjs.classifyError.call(void 0, err) };
|
|
59103
59138
|
}
|
|
59104
59139
|
}
|
|
59105
59140
|
async function parseHwpml(buffer, options) {
|
|
59106
59141
|
try {
|
|
59107
59142
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
59108
|
-
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
59143
|
+
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1795 => _1795.pageCount]) };
|
|
59109
59144
|
} catch (err) {
|
|
59110
|
-
return { success: false, fileType: "hwpml", error:
|
|
59145
|
+
return { success: false, fileType: "hwpml", error: _chunkYOLFNCQQcjs.sanitizeError.call(void 0, err), code: _chunkYOLFNCQQcjs.classifyError.call(void 0, err) };
|
|
59111
59146
|
}
|
|
59112
59147
|
}
|
|
59113
59148
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
59114
59149
|
let buffer;
|
|
59115
59150
|
if (typeof input === "string") {
|
|
59116
59151
|
const buf = await _promises.readFile.call(void 0, input);
|
|
59117
|
-
buffer =
|
|
59152
|
+
buffer = _chunkYOLFNCQQcjs.toArrayBuffer.call(void 0, buf);
|
|
59118
59153
|
} else if (Buffer.isBuffer(input)) {
|
|
59119
|
-
buffer =
|
|
59154
|
+
buffer = _chunkYOLFNCQQcjs.toArrayBuffer.call(void 0, input);
|
|
59120
59155
|
} else {
|
|
59121
59156
|
buffer = input;
|
|
59122
59157
|
}
|
|
@@ -59142,7 +59177,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
59142
59177
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
59143
59178
|
}
|
|
59144
59179
|
const fill = fillFormFields(parsed.blocks, values);
|
|
59145
|
-
const markdown =
|
|
59180
|
+
const markdown = _chunkT7Z554HTcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
59146
59181
|
if (outputFormat === "hwpx") {
|
|
59147
59182
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
59148
59183
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -59258,5 +59293,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
59258
59293
|
|
|
59259
59294
|
|
|
59260
59295
|
|
|
59261
|
-
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 =
|
|
59296
|
+
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 = _chunkYOLFNCQQcjs.VERSION; exports.ValueCursor = ValueCursor; exports.agencyNames = agencyNames; exports.agencyStyle = agencyStyle; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkT7Z554HTcjs.blocksToMarkdown; exports.blocksToPages = _chunk7OZLM5MRcjs.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 = _chunkT7Z554HTcjs.flattenLayoutTables; exports.formatFillValue = formatFillValue; exports.formatGateFinding = formatGateFinding; exports.gongmunGate = gongmunGate; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hasStructuredCellContent = _chunkT7Z554HTcjs.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;
|
|
59262
59297
|
//# sourceMappingURL=index.cjs.map
|