kordoc 4.22.1 → 4.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/{-FYKHW5G6.js → -C437ZARA.js} +11 -11
- package/dist/{chunk-5SVJU22Z.js → chunk-2X64TI7I.js} +2 -2
- package/dist/{chunk-JHHXTNZQ.js → chunk-3LJ6QO53.js} +28 -6
- package/dist/chunk-3LJ6QO53.js.map +1 -0
- package/dist/{chunk-TSZQ4LMV.js → chunk-4BJZGXNM.js} +2 -2
- package/dist/{chunk-3H5QG6I2.js → chunk-4GCS7WJJ.js} +2 -2
- package/dist/{chunk-7FASIFQP.js → chunk-56GBOIOE.js} +2 -2
- package/dist/{chunk-M2CBEXHN.cjs → chunk-AUWO57ED.cjs} +2 -2
- package/dist/{chunk-M2CBEXHN.cjs.map → chunk-AUWO57ED.cjs.map} +1 -1
- package/dist/{chunk-5FD3LAKC.js → chunk-AXR7OKQY.js} +2 -2
- package/dist/{chunk-IB5TO2CO.js → chunk-CNMUT5YW.js} +2 -2
- package/dist/{chunk-ATODI25J.js → chunk-DQXP3ELP.js} +2 -2
- package/dist/{chunk-OSFB5SQS.cjs → chunk-EKKZNKJD.cjs} +3 -3
- package/dist/{chunk-OSFB5SQS.cjs.map → chunk-EKKZNKJD.cjs.map} +1 -1
- package/dist/{chunk-EXVTF6XE.cjs → chunk-ENV25MPM.cjs} +24 -24
- package/dist/{chunk-EXVTF6XE.cjs.map → chunk-ENV25MPM.cjs.map} +1 -1
- package/dist/{chunk-YE4IN3D7.js → chunk-FPUBEM3F.js} +11 -11
- package/dist/{chunk-5VBAHUGC.js → chunk-GFQIKYBV.js} +3 -3
- package/dist/{chunk-MDS3GH43.js → chunk-GVBQVXXB.js} +2 -2
- package/dist/{chunk-ZECSXHYP.cjs → chunk-I4BS4BXE.cjs} +188 -166
- package/dist/{chunk-ZECSXHYP.cjs.map → chunk-I4BS4BXE.cjs.map} +1 -1
- package/dist/{chunk-7RND4SNB.js → chunk-IRP6QS3K.js} +3 -3
- package/dist/{chunk-R37TFXMP.js → chunk-L6N4OMKR.js} +60 -28
- package/dist/chunk-L6N4OMKR.js.map +1 -0
- package/dist/{chunk-IK4W2M4P.js → chunk-L6PFPBTK.js} +2 -2
- package/dist/{chunk-RO7AORMO.cjs → chunk-MED2MR6O.cjs} +6 -6
- package/dist/{chunk-RO7AORMO.cjs.map → chunk-MED2MR6O.cjs.map} +1 -1
- package/dist/{chunk-MGJYVNDX.js → chunk-NGDMJICC.js} +29 -7
- package/dist/{chunk-JHHXTNZQ.js.map → chunk-NGDMJICC.js.map} +1 -1
- package/dist/{chunk-SMPK5TUQ.js → chunk-QFJCEHY7.js} +2 -2
- package/dist/{chunk-M4JC7TXG.js → chunk-S4KQUVBV.js} +4 -4
- package/dist/{chunk-AIAIBNIB.js → chunk-U3TZVR7A.js} +2 -2
- package/dist/{chunk-QH4B3PL7.js → chunk-UMNKY2EZ.js} +4 -4
- package/dist/{chunk-DOBJ7BW5.js → chunk-UV2G6XFA.js} +2 -2
- package/dist/{chunk-LHO7E3RW.js → chunk-VUC4JJUM.js} +2 -2
- package/dist/{chunk-3SPOIAST.js → chunk-YOFKJ7IM.js} +2 -2
- package/dist/{chunk-ME4NQSLE.js → chunk-YTEMFVZB.js} +2 -2
- package/dist/{chunk-B35C5HJK.cjs → chunk-ZLFUZM7H.cjs} +3 -3
- package/dist/{chunk-B35C5HJK.cjs.map → chunk-ZLFUZM7H.cjs.map} +1 -1
- package/dist/chunks-MPOOHZVO.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-PYDSQGLS.cjs → formula-3TVRNJ66.cjs} +9 -9
- package/dist/{formula-PYDSQGLS.cjs.map → formula-3TVRNJ66.cjs.map} +1 -1
- package/dist/{formula-JBTYYSKB.js → formula-43QBPAL5.js} +4 -4
- package/dist/{formula-RUS4SF3O.js → formula-HUENRCPJ.js} +3 -3
- package/dist/{image-ocr-VA6WV6E4.js → image-ocr-BAHDLDV5.js} +6 -6
- package/dist/{image-ocr-QJT4EIQU.js → image-ocr-HYAKWJGE.js} +9 -9
- package/dist/{image-ocr-PLNNCEOR.cjs → image-ocr-OC3TCXMV.cjs} +17 -17
- package/dist/{image-ocr-PLNNCEOR.cjs.map → image-ocr-OC3TCXMV.cjs.map} +1 -1
- package/dist/index.cjs +356 -324
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +60 -28
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-U2YY7ATC.js → model-bundle-23WBSECG.js} +5 -5
- package/dist/{models-BOJ2SFCR.js → models-NRZQY45P.js} +5 -5
- package/dist/{parse-worker-v2-ZHMFK3U3.js → parse-worker-v2-DPNXGJ73.js} +12 -12
- package/dist/{parser-HM6N7J4R.js → parser-FNUQW2F3.js} +73 -27
- package/dist/parser-FNUQW2F3.js.map +1 -0
- package/dist/{parser-6337Z4U2.cjs → parser-OKAQRZKM.cjs} +318 -272
- package/dist/parser-OKAQRZKM.cjs.map +1 -0
- package/dist/{parser-A2EWLK2J.js → parser-XNOLC3MZ.js} +70 -24
- package/dist/parser-XNOLC3MZ.js.map +1 -0
- package/dist/pdf-ocr-6UXBIQE6.cjs +31 -0
- package/dist/{pdf-ocr-PGXNUFU7.cjs.map → pdf-ocr-6UXBIQE6.cjs.map} +1 -1
- package/dist/{pdf-ocr-JDER5BHI.js → pdf-ocr-FAGA3O6B.js} +6 -6
- package/dist/{pdf-ocr-MEVC6HXG.js → pdf-ocr-N5LYC5LA.js} +9 -9
- package/dist/{profile-io-OJ23SPYO.js → profile-io-HC6FMYX4.js} +3 -3
- package/dist/{rasterize-76CWCLSU.js → rasterize-QLTROEV2.js} +3 -3
- package/dist/{redact-doc-EZQIHRVT.js → redact-doc-V4KMM2QV.js} +11 -11
- package/dist/{render-JZFJPFWK.js → render-V4S3QLTR.js} +7 -7
- package/dist/seal-MQ5TB5YZ.js +10 -0
- package/dist/{setup-RIVS74JN.js → setup-HU7ZOQNM.js} +3 -3
- package/dist/visual-RLIFC4XC.js +21 -0
- package/dist/{watch-WMH222E5.js → watch-NPIZ6DSJ.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-MGJYVNDX.js.map +0 -1
- package/dist/chunk-R37TFXMP.js.map +0 -1
- package/dist/chunks-4XIAEJEX.js +0 -10
- package/dist/parser-6337Z4U2.cjs.map +0 -1
- package/dist/parser-A2EWLK2J.js.map +0 -1
- package/dist/parser-HM6N7J4R.js.map +0 -1
- package/dist/pdf-ocr-PGXNUFU7.cjs +0 -31
- package/dist/seal-P2NOP4LC.js +0 -10
- package/dist/visual-R5GGZBTU.js +0 -21
- /package/dist/{-FYKHW5G6.js.map → -C437ZARA.js.map} +0 -0
- /package/dist/{chunk-5SVJU22Z.js.map → chunk-2X64TI7I.js.map} +0 -0
- /package/dist/{chunk-TSZQ4LMV.js.map → chunk-4BJZGXNM.js.map} +0 -0
- /package/dist/{chunk-3H5QG6I2.js.map → chunk-4GCS7WJJ.js.map} +0 -0
- /package/dist/{chunk-7FASIFQP.js.map → chunk-56GBOIOE.js.map} +0 -0
- /package/dist/{chunk-5FD3LAKC.js.map → chunk-AXR7OKQY.js.map} +0 -0
- /package/dist/{chunk-IB5TO2CO.js.map → chunk-CNMUT5YW.js.map} +0 -0
- /package/dist/{chunk-ATODI25J.js.map → chunk-DQXP3ELP.js.map} +0 -0
- /package/dist/{chunk-YE4IN3D7.js.map → chunk-FPUBEM3F.js.map} +0 -0
- /package/dist/{chunk-5VBAHUGC.js.map → chunk-GFQIKYBV.js.map} +0 -0
- /package/dist/{chunk-MDS3GH43.js.map → chunk-GVBQVXXB.js.map} +0 -0
- /package/dist/{chunk-7RND4SNB.js.map → chunk-IRP6QS3K.js.map} +0 -0
- /package/dist/{chunk-IK4W2M4P.js.map → chunk-L6PFPBTK.js.map} +0 -0
- /package/dist/{chunk-SMPK5TUQ.js.map → chunk-QFJCEHY7.js.map} +0 -0
- /package/dist/{chunk-M4JC7TXG.js.map → chunk-S4KQUVBV.js.map} +0 -0
- /package/dist/{chunk-AIAIBNIB.js.map → chunk-U3TZVR7A.js.map} +0 -0
- /package/dist/{chunk-QH4B3PL7.js.map → chunk-UMNKY2EZ.js.map} +0 -0
- /package/dist/{chunk-DOBJ7BW5.js.map → chunk-UV2G6XFA.js.map} +0 -0
- /package/dist/{chunk-LHO7E3RW.js.map → chunk-VUC4JJUM.js.map} +0 -0
- /package/dist/{chunk-3SPOIAST.js.map → chunk-YOFKJ7IM.js.map} +0 -0
- /package/dist/{chunk-ME4NQSLE.js.map → chunk-YTEMFVZB.js.map} +0 -0
- /package/dist/{chunks-4XIAEJEX.js.map → chunks-MPOOHZVO.js.map} +0 -0
- /package/dist/{formula-JBTYYSKB.js.map → formula-43QBPAL5.js.map} +0 -0
- /package/dist/{formula-RUS4SF3O.js.map → formula-HUENRCPJ.js.map} +0 -0
- /package/dist/{image-ocr-VA6WV6E4.js.map → image-ocr-BAHDLDV5.js.map} +0 -0
- /package/dist/{image-ocr-QJT4EIQU.js.map → image-ocr-HYAKWJGE.js.map} +0 -0
- /package/dist/{model-bundle-U2YY7ATC.js.map → model-bundle-23WBSECG.js.map} +0 -0
- /package/dist/{models-BOJ2SFCR.js.map → models-NRZQY45P.js.map} +0 -0
- /package/dist/{parse-worker-v2-ZHMFK3U3.js.map → parse-worker-v2-DPNXGJ73.js.map} +0 -0
- /package/dist/{pdf-ocr-JDER5BHI.js.map → pdf-ocr-FAGA3O6B.js.map} +0 -0
- /package/dist/{pdf-ocr-MEVC6HXG.js.map → pdf-ocr-N5LYC5LA.js.map} +0 -0
- /package/dist/{profile-io-OJ23SPYO.js.map → profile-io-HC6FMYX4.js.map} +0 -0
- /package/dist/{rasterize-76CWCLSU.js.map → rasterize-QLTROEV2.js.map} +0 -0
- /package/dist/{redact-doc-EZQIHRVT.js.map → redact-doc-V4KMM2QV.js.map} +0 -0
- /package/dist/{render-JZFJPFWK.js.map → render-V4S3QLTR.js.map} +0 -0
- /package/dist/{seal-P2NOP4LC.js.map → seal-MQ5TB5YZ.js.map} +0 -0
- /package/dist/{setup-RIVS74JN.js.map → setup-HU7ZOQNM.js.map} +0 -0
- /package/dist/{visual-R5GGZBTU.js.map → visual-RLIFC4XC.js.map} +0 -0
- /package/dist/{watch-WMH222E5.js.map → watch-NPIZ6DSJ.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkEKKZNKJDcjs = require('./chunk-EKKZNKJD.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
@@ -37,7 +37,7 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var _chunkMED2MR6Ocjs = require('./chunk-MED2MR6O.cjs');
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
@@ -55,14 +55,14 @@ var _chunkRO7AORMOcjs = require('./chunk-RO7AORMO.cjs');
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
var
|
|
58
|
+
var _chunkAUWO57EDcjs = require('./chunk-AUWO57ED.cjs');
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
62
62
|
|
|
63
63
|
// src/plain-markdown.ts
|
|
64
64
|
function toPlainMarkdown(md2) {
|
|
65
|
-
return
|
|
65
|
+
return _chunkMED2MR6Ocjs.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();
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
// src/html-tables.ts
|
|
@@ -596,9 +596,9 @@ function rawTextContent(node, depth = 0) {
|
|
|
596
596
|
}
|
|
597
597
|
|
|
598
598
|
// src/hwpx/parser-shared.ts
|
|
599
|
-
var MAX_DECOMPRESS_SIZE =
|
|
599
|
+
var MAX_DECOMPRESS_SIZE = _chunkAUWO57EDcjs.unzipLimitBytes.call(void 0, 256 * 1024 * 1024);
|
|
600
600
|
var MAX_ZIP_ENTRIES = 500;
|
|
601
|
-
var ZipBombError = class extends
|
|
601
|
+
var ZipBombError = class extends _chunkAUWO57EDcjs.KordocError {
|
|
602
602
|
constructor(message) {
|
|
603
603
|
super(message);
|
|
604
604
|
this.name = "ZipBombError";
|
|
@@ -648,7 +648,7 @@ function createSectionShared() {
|
|
|
648
648
|
function createXmlParser(warnings) {
|
|
649
649
|
return new (0, _xmldom.DOMParser)({
|
|
650
650
|
onError(level, msg2) {
|
|
651
|
-
if (level === "fatalError") throw new (0,
|
|
651
|
+
if (level === "fatalError") throw new (0, _chunkAUWO57EDcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
652
652
|
_optionalChain([warnings, 'optionalAccess', _5 => _5.push, 'call', _6 => _6({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
653
653
|
}
|
|
654
654
|
});
|
|
@@ -683,13 +683,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
683
683
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
684
684
|
const checksumType = attrOf(inner, "checksum-type");
|
|
685
685
|
if (algorithm !== AES256_CBC) {
|
|
686
|
-
throw new (0,
|
|
686
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
687
687
|
}
|
|
688
688
|
if (startKey !== START_KEY_SHA256) {
|
|
689
|
-
throw new (0,
|
|
689
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
690
690
|
}
|
|
691
691
|
if (!_optionalChain([checksumType, 'optionalAccess', _10 => _10.endsWith, 'call', _11 => _11(CHECKSUM_SHA256_1K)])) {
|
|
692
|
-
throw new (0,
|
|
692
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
693
693
|
}
|
|
694
694
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
695
695
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -697,10 +697,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
697
697
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
698
698
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
699
699
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
700
|
-
throw new (0,
|
|
700
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
701
701
|
}
|
|
702
702
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
703
|
-
throw new (0,
|
|
703
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
704
704
|
}
|
|
705
705
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
706
706
|
}
|
|
@@ -734,12 +734,12 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
734
734
|
for (const entry of entries) {
|
|
735
735
|
const file = zip.file(entry.path);
|
|
736
736
|
if (!file) {
|
|
737
|
-
throw new (0,
|
|
737
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
738
738
|
}
|
|
739
739
|
const raw = await readZipEntry(file, "uint8array", used);
|
|
740
740
|
const plain4 = decryptEntry(Buffer.from(raw.buffer, raw.byteOffset, raw.length), entry, startKey);
|
|
741
741
|
if (!plain4) {
|
|
742
|
-
throw new (0,
|
|
742
|
+
throw new (0, _chunkAUWO57EDcjs.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.");
|
|
743
743
|
}
|
|
744
744
|
used += plain4.length;
|
|
745
745
|
if (used > MAX_DECOMPRESS_SIZE) throw new ZipBombError("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
@@ -805,10 +805,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
805
805
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _12 => _12.total]));
|
|
806
806
|
if (decompressed) {
|
|
807
807
|
decompressed.total += xml.length * 2;
|
|
808
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
808
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkAUWO57EDcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
809
809
|
}
|
|
810
810
|
const parser = createXmlParser();
|
|
811
|
-
const doc = parser.parseFromString(
|
|
811
|
+
const doc = parser.parseFromString(_chunkAUWO57EDcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
812
812
|
if (!doc.documentElement) continue;
|
|
813
813
|
const domDoc = doc;
|
|
814
814
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -1021,9 +1021,9 @@ function detectHwpxHeadings(blocks, styleMap, tocTexts) {
|
|
|
1021
1021
|
let level = 0;
|
|
1022
1022
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _21 => _21.style, 'optionalAccess', _22 => _22.fontSize])) {
|
|
1023
1023
|
const ratio = block.style.fontSize / baseFontSize;
|
|
1024
|
-
if (ratio >=
|
|
1025
|
-
else if (ratio >=
|
|
1026
|
-
else if (ratio >=
|
|
1024
|
+
if (ratio >= _chunkMED2MR6Ocjs.HEADING_RATIO_H1) level = 1;
|
|
1025
|
+
else if (ratio >= _chunkMED2MR6Ocjs.HEADING_RATIO_H2) level = 2;
|
|
1026
|
+
else if (ratio >= _chunkMED2MR6Ocjs.HEADING_RATIO_H3) level = 3;
|
|
1027
1027
|
}
|
|
1028
1028
|
const compactText = text.replace(/\s+/g, "");
|
|
1029
1029
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1758,7 +1758,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1758
1758
|
|
|
1759
1759
|
// src/hwpx/table-build.ts
|
|
1760
1760
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1761
|
-
const table2 =
|
|
1761
|
+
const table2 = _chunkMED2MR6Ocjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1762
1762
|
if (state.caption) table2.caption = state.caption;
|
|
1763
1763
|
if (state.sourceId) table2.sourceId = state.sourceId;
|
|
1764
1764
|
if (_optionalChain([state, 'access', _32 => _32.captionBlocks, 'optionalAccess', _33 => _33.length])) table2.captionBlocks = state.captionBlocks;
|
|
@@ -1787,7 +1787,7 @@ function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraph
|
|
|
1787
1787
|
for (const src of row) {
|
|
1788
1788
|
if (!src.edges || src.rowAddr === void 0 || src.colAddr === void 0) continue;
|
|
1789
1789
|
const cand = _optionalChain([table2, 'access', _37 => _37.cells, 'access', _38 => _38[src.rowAddr], 'optionalAccess', _39 => _39[src.colAddr]]);
|
|
1790
|
-
if (cand && anchors2.includes(cand))
|
|
1790
|
+
if (cand && anchors2.includes(cand)) _chunkMED2MR6Ocjs.CELL_EDGES.set(cand, src.edges);
|
|
1791
1791
|
}
|
|
1792
1792
|
}
|
|
1793
1793
|
const claimed = /* @__PURE__ */ new Set();
|
|
@@ -1837,7 +1837,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1837
1837
|
const cell2 = parentTable.cell;
|
|
1838
1838
|
(cell2.blocks ??= []).push(block);
|
|
1839
1839
|
cell2.hasStructure = true;
|
|
1840
|
-
let flat =
|
|
1840
|
+
let flat = _chunkMED2MR6Ocjs.convertTableToText.call(void 0, newTable.rows);
|
|
1841
1841
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1842
1842
|
if (flat) {
|
|
1843
1843
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -2071,7 +2071,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2071
2071
|
const tkids = rc.childNodes;
|
|
2072
2072
|
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _47 => _47.length]), () => ( 0))); k++) {
|
|
2073
2073
|
const tk = tkids[k];
|
|
2074
|
-
if (tk.nodeType === 3 || tk.nodeType === 4) text +=
|
|
2074
|
+
if (tk.nodeType === 3 || tk.nodeType === 4) text += _chunkMED2MR6Ocjs.escapeLiteralTags.call(void 0, _chunkMED2MR6Ocjs.escapeLiteralDollar.call(void 0, tk.textContent || ""));
|
|
2075
2075
|
else if (tk.nodeType === 1) {
|
|
2076
2076
|
const ttag = (tk.tagName || tk.localName || "").replace(/^[^:]+:/, "");
|
|
2077
2077
|
if (ttag === "tab" || ttag === "fwSpace" || ttag === "hwSpace" || ttag === "nbSpace") text += " ";
|
|
@@ -2091,7 +2091,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2091
2091
|
const span2 = { text };
|
|
2092
2092
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span2.code = true;
|
|
2093
2093
|
else {
|
|
2094
|
-
if (_optionalChain([cp, 'optionalAccess', _48 => _48.script])) span2.text =
|
|
2094
|
+
if (_optionalChain([cp, 'optionalAccess', _48 => _48.script])) span2.text = _chunkMED2MR6Ocjs.wrapScript.call(void 0, text, cp.script);
|
|
2095
2095
|
if (_optionalChain([cp, 'optionalAccess', _49 => _49.bold])) span2.bold = true;
|
|
2096
2096
|
if (_optionalChain([cp, 'optionalAccess', _50 => _50.italic])) span2.italic = true;
|
|
2097
2097
|
if (_optionalChain([cp, 'optionalAccess', _51 => _51.strike])) span2.strike = true;
|
|
@@ -2111,7 +2111,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2111
2111
|
}
|
|
2112
2112
|
}
|
|
2113
2113
|
if (requireMixed && !merged.some((s) => s.strike || s.underline) && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
|
|
2114
|
-
for (const s of merged) s.text =
|
|
2114
|
+
for (const s of merged) s.text = _chunkMED2MR6Ocjs.tidyScriptTags.call(void 0, s.text);
|
|
2115
2115
|
return merged;
|
|
2116
2116
|
}
|
|
2117
2117
|
function gongmunDepthFromIndent(para2, left, ctx) {
|
|
@@ -2138,7 +2138,7 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2138
2138
|
// src/hwpx/section-walker.ts
|
|
2139
2139
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
2140
2140
|
const parser = createXmlParser(warnings);
|
|
2141
|
-
const doc = parser.parseFromString(
|
|
2141
|
+
const doc = parser.parseFromString(_chunkAUWO57EDcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
2142
2142
|
if (!doc.documentElement) return [];
|
|
2143
2143
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
2144
2144
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -2239,8 +2239,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2239
2239
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
2240
2240
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
2241
2241
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
2242
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
2243
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
2242
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunkMED2MR6Ocjs.MAX_COLS);
|
|
2243
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkMED2MR6Ocjs.MAX_ROWS);
|
|
2244
2244
|
}
|
|
2245
2245
|
break;
|
|
2246
2246
|
case "p": {
|
|
@@ -2563,7 +2563,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
2563
2563
|
const sink = [];
|
|
2564
2564
|
const st = { rows: [], currentRow: [], cell: null, sourceId: _nullishCoalesce(el.getAttribute("id"), () => ( void 0)) };
|
|
2565
2565
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2566
|
-
let flat =
|
|
2566
|
+
let flat = _chunkMED2MR6Ocjs.convertTableToText.call(void 0, st.rows);
|
|
2567
2567
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2568
2568
|
const built = [];
|
|
2569
2569
|
completeTable(st, [], built, ctx);
|
|
@@ -2727,7 +2727,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2727
2727
|
let url = (ch.textContent || "").trim();
|
|
2728
2728
|
if (!url) continue;
|
|
2729
2729
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2730
|
-
const safe =
|
|
2730
|
+
const safe = _chunkAUWO57EDcjs.sanitizeHref.call(void 0, url);
|
|
2731
2731
|
if (safe) return safe;
|
|
2732
2732
|
}
|
|
2733
2733
|
return void 0;
|
|
@@ -2883,7 +2883,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2883
2883
|
_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" })]);
|
|
2884
2884
|
}
|
|
2885
2885
|
} else {
|
|
2886
|
-
text +=
|
|
2886
|
+
text += _chunkMED2MR6Ocjs.escapeLiteralTags.call(void 0, _chunkMED2MR6Ocjs.escapeLiteralDollar.call(void 0, t.replace(/\x1E/g, "")));
|
|
2887
2887
|
}
|
|
2888
2888
|
continue;
|
|
2889
2889
|
}
|
|
@@ -2936,7 +2936,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2936
2936
|
case "hyperlink": {
|
|
2937
2937
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2938
2938
|
if (url) {
|
|
2939
|
-
const safe =
|
|
2939
|
+
const safe = _chunkAUWO57EDcjs.sanitizeHref.call(void 0, url);
|
|
2940
2940
|
if (safe) href = safe;
|
|
2941
2941
|
}
|
|
2942
2942
|
walk(child, depth + 1);
|
|
@@ -3030,7 +3030,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
3030
3030
|
walk(child, depth + 1);
|
|
3031
3031
|
if (script && linkRanges.length === nLinks && openFields.length === nOpen && runHasOnlyText(child)) {
|
|
3032
3032
|
const added = text.slice(start);
|
|
3033
|
-
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) +
|
|
3033
|
+
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) + _chunkMED2MR6Ocjs.wrapScript.call(void 0, added, script);
|
|
3034
3034
|
}
|
|
3035
3035
|
break;
|
|
3036
3036
|
}
|
|
@@ -3053,7 +3053,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
3053
3053
|
}
|
|
3054
3054
|
if (applied.length) href = void 0;
|
|
3055
3055
|
}
|
|
3056
|
-
text =
|
|
3056
|
+
text = _chunkMED2MR6Ocjs.tidyScriptTags.call(void 0, text);
|
|
3057
3057
|
const toc = takeTocLeaders(text);
|
|
3058
3058
|
text = toc.text;
|
|
3059
3059
|
const tocEntry = toc.tocEntry;
|
|
@@ -3167,7 +3167,7 @@ function decompressStream(data) {
|
|
|
3167
3167
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
3168
3168
|
}
|
|
3169
3169
|
function parseFileHeader(data) {
|
|
3170
|
-
if (data.length < 40) throw new (0,
|
|
3170
|
+
if (data.length < 40) throw new (0, _chunkAUWO57EDcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
3171
3171
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
3172
3172
|
return {
|
|
3173
3173
|
signature: sig,
|
|
@@ -3694,13 +3694,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3694
3694
|
}
|
|
3695
3695
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3696
3696
|
for (const path of allCandidates) {
|
|
3697
|
-
if (
|
|
3697
|
+
if (_chunkAUWO57EDcjs.isPathTraversal.call(void 0, path)) continue;
|
|
3698
3698
|
const file = zip.file(path);
|
|
3699
3699
|
if (!file) continue;
|
|
3700
3700
|
try {
|
|
3701
3701
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3702
3702
|
decompressed.total += data.length;
|
|
3703
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3703
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkAUWO57EDcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3704
3704
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3705
3705
|
const extMime = imageExtToMime(ext);
|
|
3706
3706
|
const mimeType = extMime === "image/svg+xml" && /<script|\son[a-z]+\s*=|javascript:|<foreignObject/i.test(Buffer.from(data).toString("utf8")) ? "application/octet-stream" : extMime;
|
|
@@ -3711,7 +3711,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3711
3711
|
usedPaths.add(path);
|
|
3712
3712
|
break;
|
|
3713
3713
|
} catch (err) {
|
|
3714
|
-
if (err instanceof
|
|
3714
|
+
if (err instanceof _chunkAUWO57EDcjs.KordocError) throw err;
|
|
3715
3715
|
}
|
|
3716
3716
|
}
|
|
3717
3717
|
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" })]);
|
|
@@ -3731,13 +3731,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3731
3731
|
if (sweepUnreferenced) {
|
|
3732
3732
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3733
3733
|
for (const file of binEntries) {
|
|
3734
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3734
|
+
if (file.dir || usedPaths.has(file.name) || _chunkAUWO57EDcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3735
3735
|
const basename = file.name.slice(file.name.lastIndexOf("/") + 1);
|
|
3736
3736
|
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;
|
|
3737
3737
|
try {
|
|
3738
3738
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3739
3739
|
decompressed.total += data.length;
|
|
3740
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3740
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkAUWO57EDcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3741
3741
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3742
3742
|
let mimeType = imageExtToMime(ext);
|
|
3743
3743
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3751,7 +3751,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3751
3751
|
images.push(img);
|
|
3752
3752
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3753
3753
|
} catch (err) {
|
|
3754
|
-
if (err instanceof
|
|
3754
|
+
if (err instanceof _chunkAUWO57EDcjs.KordocError) throw err;
|
|
3755
3755
|
_optionalChain([warnings, 'optionalAccess', _138 => _138.push, 'call', _139 => _139({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3756
3756
|
}
|
|
3757
3757
|
}
|
|
@@ -3802,7 +3802,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3802
3802
|
}
|
|
3803
3803
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3804
3804
|
const name = new TextDecoder().decode(nameBytes);
|
|
3805
|
-
if (
|
|
3805
|
+
if (_chunkAUWO57EDcjs.isPathTraversal.call(void 0, name)) {
|
|
3806
3806
|
pos = fileStart + compSize;
|
|
3807
3807
|
continue;
|
|
3808
3808
|
}
|
|
@@ -3820,7 +3820,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3820
3820
|
continue;
|
|
3821
3821
|
}
|
|
3822
3822
|
totalDecompressed += content.length * 2;
|
|
3823
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3823
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkAUWO57EDcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3824
3824
|
sectionNum++;
|
|
3825
3825
|
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3826
3826
|
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
@@ -3829,9 +3829,9 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3829
3829
|
continue;
|
|
3830
3830
|
}
|
|
3831
3831
|
}
|
|
3832
|
-
if (blocks.length === 0) throw new (0,
|
|
3832
|
+
if (blocks.length === 0) throw new (0, _chunkAUWO57EDcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3833
3833
|
applyPageText(blocks, shared);
|
|
3834
|
-
const markdown =
|
|
3834
|
+
const markdown = _chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _140 => _140.tableFormat]) });
|
|
3835
3835
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3836
3836
|
}
|
|
3837
3837
|
async function readKordocLayout(zip) {
|
|
@@ -3856,11 +3856,11 @@ async function resolveSectionPaths(zip) {
|
|
|
3856
3856
|
if (paths.length > 0) return paths;
|
|
3857
3857
|
}
|
|
3858
3858
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3859
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3859
|
+
return sectionFiles.map((f) => f.name).sort(_chunkAUWO57EDcjs.compareSectionPaths);
|
|
3860
3860
|
}
|
|
3861
3861
|
function parseSectionPathsFromManifest(xml) {
|
|
3862
3862
|
const parser = createXmlParser();
|
|
3863
|
-
const doc = parser.parseFromString(
|
|
3863
|
+
const doc = parser.parseFromString(_chunkAUWO57EDcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3864
3864
|
const opf = "http://www.idpf.org/2007/opf/";
|
|
3865
3865
|
const namespacedItems = doc.getElementsByTagNameNS(opf, "item");
|
|
3866
3866
|
const namespacedSpine = doc.getElementsByTagNameNS(opf, "itemref");
|
|
@@ -3870,7 +3870,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3870
3870
|
for (let i = 0; i < items.length; i++) {
|
|
3871
3871
|
const item = items[i];
|
|
3872
3872
|
const id = item.getAttribute("id") || "";
|
|
3873
|
-
const href =
|
|
3873
|
+
const href = _chunkAUWO57EDcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3874
3874
|
if (id && href) idToHref.set(id, href);
|
|
3875
3875
|
}
|
|
3876
3876
|
if (spine.length > 0) {
|
|
@@ -3881,7 +3881,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3881
3881
|
}
|
|
3882
3882
|
if (ordered.length > 0) return ordered;
|
|
3883
3883
|
}
|
|
3884
|
-
return Array.from(idToHref.values()).sort(
|
|
3884
|
+
return Array.from(idToHref.values()).sort(_chunkAUWO57EDcjs.compareSectionPaths);
|
|
3885
3885
|
}
|
|
3886
3886
|
|
|
3887
3887
|
// src/hwpx/metadata.ts
|
|
@@ -3893,7 +3893,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3893
3893
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _144 => _144.total]));
|
|
3894
3894
|
if (decompressed) {
|
|
3895
3895
|
decompressed.total += xml.length * 2;
|
|
3896
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3896
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkAUWO57EDcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3897
3897
|
}
|
|
3898
3898
|
return xml;
|
|
3899
3899
|
};
|
|
@@ -3915,7 +3915,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3915
3915
|
}
|
|
3916
3916
|
}
|
|
3917
3917
|
function parseOpfMetadata(xml, metadata) {
|
|
3918
|
-
const root = createXmlParser().parseFromString(
|
|
3918
|
+
const root = createXmlParser().parseFromString(_chunkAUWO57EDcjs.stripDtd.call(void 0, xml), "text/xml").documentElement;
|
|
3919
3919
|
const md2 = root ? findChildByLocalName(root, "metadata") : null;
|
|
3920
3920
|
if (!md2) return;
|
|
3921
3921
|
let title;
|
|
@@ -3948,7 +3948,7 @@ function isoDate(s) {
|
|
|
3948
3948
|
}
|
|
3949
3949
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3950
3950
|
const parser = createXmlParser();
|
|
3951
|
-
const doc = parser.parseFromString(
|
|
3951
|
+
const doc = parser.parseFromString(_chunkAUWO57EDcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3952
3952
|
if (!doc.documentElement) return;
|
|
3953
3953
|
const getText = (tagNames) => {
|
|
3954
3954
|
for (const tag of tagNames) {
|
|
@@ -3987,7 +3987,7 @@ function assignSectionPage(block, sectionNum) {
|
|
|
3987
3987
|
}
|
|
3988
3988
|
}
|
|
3989
3989
|
async function parseHwpxDocument(buffer, options) {
|
|
3990
|
-
|
|
3990
|
+
_chunkAUWO57EDcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3991
3991
|
let zip;
|
|
3992
3992
|
try {
|
|
3993
3993
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3996,7 +3996,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3996
3996
|
}
|
|
3997
3997
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3998
3998
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3999
|
-
throw new (0,
|
|
3999
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
4000
4000
|
}
|
|
4001
4001
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
4002
4002
|
if (manifestFile) {
|
|
@@ -4016,7 +4016,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4016
4016
|
}
|
|
4017
4017
|
const hpfFile = zip.file("Contents/content.hpf");
|
|
4018
4018
|
const hpf = hpfFile ? await readZipEntry(hpfFile, "text").catch(() => "") : "";
|
|
4019
|
-
throw new (0,
|
|
4019
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(
|
|
4020
4020
|
/\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."
|
|
4021
4021
|
);
|
|
4022
4022
|
}
|
|
@@ -4028,7 +4028,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4028
4028
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
4029
4029
|
const warnings = [];
|
|
4030
4030
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
4031
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
4031
|
+
if (sectionPaths.length === 0) throw new (0, _chunkAUWO57EDcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
4032
4032
|
let allBlocks = [];
|
|
4033
4033
|
const shared = createSectionShared();
|
|
4034
4034
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
@@ -4072,10 +4072,10 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4072
4072
|
const blocks = allBlocks;
|
|
4073
4073
|
applyPageText(blocks, shared);
|
|
4074
4074
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _173 => _173.pages]), shared.track.deletedImageRefs);
|
|
4075
|
-
const shown = _optionalChain([options, 'optionalAccess', _174 => _174.layoutTables]) === "keep" ? blocks :
|
|
4075
|
+
const shown = _optionalChain([options, 'optionalAccess', _174 => _174.layoutTables]) === "keep" ? blocks : _chunkMED2MR6Ocjs.unframeLayoutTables.call(void 0, blocks, !!_optionalChain([options, 'optionalAccess', _175 => _175.keepTrailingEmptyCols]));
|
|
4076
4076
|
detectHwpxHeadings(shown, styleMap, shared.tocTexts);
|
|
4077
4077
|
const outline = shown.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4078
|
-
const markdown =
|
|
4078
|
+
const markdown = _chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, shown, { tableFormat: _optionalChain([options, 'optionalAccess', _176 => _176.tableFormat]) });
|
|
4079
4079
|
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 };
|
|
4080
4080
|
}
|
|
4081
4081
|
|
|
@@ -4842,7 +4842,7 @@ function decryptPasswordStream(raw, password) {
|
|
|
4842
4842
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4843
4843
|
var TAG_ID_MAPPINGS2 = 17;
|
|
4844
4844
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4845
|
-
const wrong = () => new (0,
|
|
4845
|
+
const wrong = () => new (0, _chunkAUWO57EDcjs.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.");
|
|
4846
4846
|
let records;
|
|
4847
4847
|
try {
|
|
4848
4848
|
records = readRecords3(data);
|
|
@@ -4854,7 +4854,7 @@ function assertDecryptedDocInfo(data, readRecords3) {
|
|
|
4854
4854
|
}
|
|
4855
4855
|
function assertSupportedEncryptVersion(version) {
|
|
4856
4856
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4857
|
-
throw new (0,
|
|
4857
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(
|
|
4858
4858
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4859
4859
|
);
|
|
4860
4860
|
}
|
|
@@ -5297,7 +5297,7 @@ function emitParagraphBlocks(p) {
|
|
|
5297
5297
|
return blocks;
|
|
5298
5298
|
}
|
|
5299
5299
|
function tableFlatText(table2) {
|
|
5300
|
-
const flat =
|
|
5300
|
+
const flat = _chunkMED2MR6Ocjs.convertTableToText.call(void 0, table2.cells);
|
|
5301
5301
|
return table2.caption ? table2.caption + (flat ? "\n" + flat : "") : flat;
|
|
5302
5302
|
}
|
|
5303
5303
|
function blocksPlainText(blocks, sep) {
|
|
@@ -5378,8 +5378,8 @@ ${cell2.text}` : cell2.text;
|
|
|
5378
5378
|
}
|
|
5379
5379
|
function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
5380
5380
|
for (const c of cells) {
|
|
5381
|
-
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1,
|
|
5382
|
-
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1,
|
|
5381
|
+
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1, _chunkMED2MR6Ocjs.MAX_ROWS));
|
|
5382
|
+
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1, _chunkMED2MR6Ocjs.MAX_COLS));
|
|
5383
5383
|
}
|
|
5384
5384
|
const placed = resolveCellOverlaps(cells, rows, cols);
|
|
5385
5385
|
const byRow = Array.from({ length: rows }, () => []);
|
|
@@ -5387,12 +5387,12 @@ function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
|
5387
5387
|
const r = _nullishCoalesce(c.rowAddr, () => ( 0));
|
|
5388
5388
|
if (r < rows && (_nullishCoalesce(c.colAddr, () => ( 0))) < cols) byRow[r].push(c);
|
|
5389
5389
|
}
|
|
5390
|
-
const table2 =
|
|
5390
|
+
const table2 = _chunkMED2MR6Ocjs.buildTable.call(void 0, byRow, { keepAnchoredEmptyCols });
|
|
5391
5391
|
if (table2.rows === 0) return null;
|
|
5392
5392
|
for (const c of placed) {
|
|
5393
5393
|
if (c.edges) {
|
|
5394
5394
|
const at = _optionalChain([table2, 'access', _183 => _183.cells, 'access', _184 => _184[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _185 => _185[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
5395
|
-
if (at)
|
|
5395
|
+
if (at) _chunkMED2MR6Ocjs.CELL_EDGES.set(at, c.edges);
|
|
5396
5396
|
}
|
|
5397
5397
|
if (!_optionalChain([c, 'access', _186 => _186.blocks, 'optionalAccess', _187 => _187.length]) && !c.isHeader) continue;
|
|
5398
5398
|
const target = _optionalChain([table2, 'access', _188 => _188.cells, 'access', _189 => _189[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _190 => _190[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
@@ -5594,7 +5594,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5594
5594
|
continue;
|
|
5595
5595
|
}
|
|
5596
5596
|
if (!ctrl.href) continue;
|
|
5597
|
-
const href =
|
|
5597
|
+
const href = _chunkAUWO57EDcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5598
5598
|
if (!href) continue;
|
|
5599
5599
|
if (!anchor.trim() || anchor.includes(INLINE_TABLE_MARK)) continue;
|
|
5600
5600
|
text = text.slice(0, r.start) + `[${anchor}](${href})` + text.slice(r.end);
|
|
@@ -5603,7 +5603,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5603
5603
|
}
|
|
5604
5604
|
if (text.includes(LITERAL_DOLLAR_MARK)) text = text.replaceAll(LITERAL_DOLLAR_MARK, "\\$");
|
|
5605
5605
|
text = resolveLiteralLt(text);
|
|
5606
|
-
text =
|
|
5606
|
+
text = _chunkMED2MR6Ocjs.tidyScriptTags.call(void 0, text);
|
|
5607
5607
|
const toc = takeTocLeaders(text);
|
|
5608
5608
|
text = toc.text;
|
|
5609
5609
|
let headingLevel = 0;
|
|
@@ -5823,7 +5823,7 @@ function hyperlinkUrlFromCommand(command) {
|
|
|
5823
5823
|
}
|
|
5824
5824
|
var A4_HEIGHT = 84188;
|
|
5825
5825
|
function keepUnlessPageSpanning(table2, cells) {
|
|
5826
|
-
if (!cells.some((c) => c.pageSpanning))
|
|
5826
|
+
if (!cells.some((c) => c.pageSpanning)) _chunkMED2MR6Ocjs.markNonLayoutTable.call(void 0, table2);
|
|
5827
5827
|
}
|
|
5828
5828
|
function parseTableControl(ctrl, records, ctx) {
|
|
5829
5829
|
if (ctx.depth >= MAX_NEST_DEPTH) return null;
|
|
@@ -5835,8 +5835,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5835
5835
|
let tableIdx = -1;
|
|
5836
5836
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5837
5837
|
if (records[i2].tagId === TAG_TABLE && records[i2].level === directLevel && records[i2].data.length >= 8) {
|
|
5838
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5839
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5838
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkMED2MR6Ocjs.MAX_ROWS);
|
|
5839
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkMED2MR6Ocjs.MAX_COLS);
|
|
5840
5840
|
tableIdx = i2;
|
|
5841
5841
|
break;
|
|
5842
5842
|
}
|
|
@@ -5880,11 +5880,11 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5880
5880
|
return table3;
|
|
5881
5881
|
}
|
|
5882
5882
|
if (rows === 0 || cols === 0) {
|
|
5883
|
-
rows = Math.min(cells.length,
|
|
5883
|
+
rows = Math.min(cells.length, _chunkMED2MR6Ocjs.MAX_ROWS);
|
|
5884
5884
|
cols = 1;
|
|
5885
5885
|
}
|
|
5886
5886
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5887
|
-
const table2 =
|
|
5887
|
+
const table2 = _chunkMED2MR6Ocjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5888
5888
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5889
5889
|
if (sourceId && table2.rows > 0) table2.sourceId = sourceId;
|
|
5890
5890
|
keepUnlessPageSpanning(table2, cells);
|
|
@@ -5903,8 +5903,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5903
5903
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5904
5904
|
const cs = rec.data.readUInt16LE(12);
|
|
5905
5905
|
const rs = rec.data.readUInt16LE(14);
|
|
5906
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5907
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5906
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkMED2MR6Ocjs.MAX_COLS);
|
|
5907
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkMED2MR6Ocjs.MAX_ROWS);
|
|
5908
5908
|
}
|
|
5909
5909
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5910
5910
|
const { text, hasStructure } = cellTextFromBlocks(blocks);
|
|
@@ -6053,7 +6053,7 @@ function openHwp5Container(buffer, options) {
|
|
|
6053
6053
|
lenientCfb = parseLenientCfb(buffer);
|
|
6054
6054
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
6055
6055
|
} catch (e24) {
|
|
6056
|
-
throw new (0,
|
|
6056
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
6057
6057
|
}
|
|
6058
6058
|
}
|
|
6059
6059
|
const readRawStream = (path) => {
|
|
@@ -6064,14 +6064,14 @@ function openHwp5Container(buffer, options) {
|
|
|
6064
6064
|
return lenientCfb.findStream(path);
|
|
6065
6065
|
};
|
|
6066
6066
|
const headerData = readRawStream("/FileHeader");
|
|
6067
|
-
if (!headerData) throw new (0,
|
|
6067
|
+
if (!headerData) throw new (0, _chunkAUWO57EDcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6068
6068
|
const header = parseFileHeader(headerData);
|
|
6069
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
6070
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
6069
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkAUWO57EDcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
6070
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkAUWO57EDcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
6071
6071
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
6072
6072
|
if (encrypted) {
|
|
6073
6073
|
if (!_optionalChain([options, 'optionalAccess', _214 => _214.password])) {
|
|
6074
|
-
throw new (0,
|
|
6074
|
+
throw new (0, _chunkAUWO57EDcjs.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.");
|
|
6075
6075
|
}
|
|
6076
6076
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
6077
6077
|
}
|
|
@@ -6085,12 +6085,12 @@ function openHwp5Container(buffer, options) {
|
|
|
6085
6085
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
6086
6086
|
if (encrypted) {
|
|
6087
6087
|
const rawDocInfo = findStream("/DocInfo");
|
|
6088
|
-
if (!rawDocInfo) throw new (0,
|
|
6088
|
+
if (!rawDocInfo) throw new (0, _chunkAUWO57EDcjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6089
6089
|
let docInfoData;
|
|
6090
6090
|
try {
|
|
6091
6091
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
6092
6092
|
} catch (e25) {
|
|
6093
|
-
throw new (0,
|
|
6093
|
+
throw new (0, _chunkAUWO57EDcjs.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.");
|
|
6094
6094
|
}
|
|
6095
6095
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
6096
6096
|
}
|
|
@@ -6115,10 +6115,10 @@ function readHwp5SectionRecords(c, sections, warnings) {
|
|
|
6115
6115
|
try {
|
|
6116
6116
|
const data = !c.distribution && c.compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
6117
6117
|
totalDecompressed += data.length;
|
|
6118
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6118
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkAUWO57EDcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6119
6119
|
out.push(readRecords(data));
|
|
6120
6120
|
} catch (secErr) {
|
|
6121
|
-
if (secErr instanceof
|
|
6121
|
+
if (secErr instanceof _chunkAUWO57EDcjs.KordocError) throw secErr;
|
|
6122
6122
|
out.push(null);
|
|
6123
6123
|
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" });
|
|
6124
6124
|
}
|
|
@@ -6138,7 +6138,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6138
6138
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
6139
6139
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
6140
6140
|
const sections = readHwp5SectionStreams(c);
|
|
6141
|
-
if (sections.length === 0) throw new (0,
|
|
6141
|
+
if (sections.length === 0) throw new (0, _chunkAUWO57EDcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
6142
6142
|
const sectionRecords = readHwp5SectionRecords(c, sections, warnings);
|
|
6143
6143
|
const sectionDetects = sectionRecords.map((r) => r ? detectHwp5SectionPages(r) : null);
|
|
6144
6144
|
const sectionTableIds = [];
|
|
@@ -6182,7 +6182,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6182
6182
|
parsedSections++;
|
|
6183
6183
|
_optionalChain([options, 'optionalAccess', _219 => _219.onProgress, 'optionalCall', _220 => _220(parsedSections, sections.length)]);
|
|
6184
6184
|
} catch (secErr) {
|
|
6185
|
-
if (secErr instanceof
|
|
6185
|
+
if (secErr instanceof _chunkAUWO57EDcjs.KordocError) throw secErr;
|
|
6186
6186
|
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" });
|
|
6187
6187
|
} finally {
|
|
6188
6188
|
pageBase += detect2.pages;
|
|
@@ -6193,10 +6193,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6193
6193
|
}
|
|
6194
6194
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
6195
6195
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter, encrypted ? findStream : void 0) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter, encrypted ? findStream : void 0);
|
|
6196
|
-
let flatBlocks =
|
|
6197
|
-
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks =
|
|
6196
|
+
let flatBlocks = _chunkMED2MR6Ocjs.flattenLayoutTables.call(void 0, blocks);
|
|
6197
|
+
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks = _chunkMED2MR6Ocjs.unframeLayoutTables.call(void 0, flatBlocks, !!_optionalChain([options, 'optionalAccess', _222 => _222.keepTrailingEmptyCols]));
|
|
6198
6198
|
if (_optionalChain([options, 'optionalAccess', _223 => _223.dedupeRunningHeaders])) {
|
|
6199
|
-
const deduped =
|
|
6199
|
+
const deduped = _chunkMED2MR6Ocjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
6200
6200
|
const removed = flatBlocks.length - deduped.length;
|
|
6201
6201
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
6202
6202
|
flatBlocks = deduped;
|
|
@@ -6205,10 +6205,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6205
6205
|
detectHwp5Headings(flatBlocks, docInfo, doc.tocTexts);
|
|
6206
6206
|
}
|
|
6207
6207
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
6208
|
-
let markdown =
|
|
6208
|
+
let markdown = _chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, flatBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _224 => _224.tableFormat]) });
|
|
6209
6209
|
if (_optionalChain([options, 'optionalAccess', _225 => _225.inlineImages]) && options.images !== false && images.length > 0) {
|
|
6210
6210
|
try {
|
|
6211
|
-
markdown =
|
|
6211
|
+
markdown = _chunkEKKZNKJDcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
6212
6212
|
} catch (inlineErr) {
|
|
6213
6213
|
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" });
|
|
6214
6214
|
}
|
|
@@ -6272,9 +6272,9 @@ function detectHwp5Headings(blocks, docInfo, tocTexts) {
|
|
|
6272
6272
|
let level = 0;
|
|
6273
6273
|
if (_optionalChain([block, 'access', _232 => _232.style, 'optionalAccess', _233 => _233.fontSize]) && baseFontSize > 0) {
|
|
6274
6274
|
const ratio = block.style.fontSize / baseFontSize;
|
|
6275
|
-
if (ratio >=
|
|
6276
|
-
else if (ratio >=
|
|
6277
|
-
else if (ratio >=
|
|
6275
|
+
if (ratio >= _chunkMED2MR6Ocjs.HEADING_RATIO_H1) level = 1;
|
|
6276
|
+
else if (ratio >= _chunkMED2MR6Ocjs.HEADING_RATIO_H2) level = 2;
|
|
6277
|
+
else if (ratio >= _chunkMED2MR6Ocjs.HEADING_RATIO_H3) level = 3;
|
|
6278
6278
|
}
|
|
6279
6279
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
6280
6280
|
if (level === 0) level = 2;
|
|
@@ -6406,7 +6406,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6406
6406
|
const raw = _nullishCoalesce(lcfb.findStream(`/BodyText/Section${i}`), () => ( lcfb.findStream(`Section${i}`)));
|
|
6407
6407
|
if (!raw) break;
|
|
6408
6408
|
totalBytes += raw.length;
|
|
6409
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6409
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkAUWO57EDcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6410
6410
|
sections.push({ idx: i, content: raw });
|
|
6411
6411
|
}
|
|
6412
6412
|
if (sections.length === 0) {
|
|
@@ -6417,7 +6417,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6417
6417
|
const raw = lcfb.findStream(e.name);
|
|
6418
6418
|
if (raw) {
|
|
6419
6419
|
totalBytes += raw.length;
|
|
6420
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6420
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkAUWO57EDcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6421
6421
|
sections.push({ idx, content: raw });
|
|
6422
6422
|
}
|
|
6423
6423
|
}
|
|
@@ -6434,7 +6434,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
6434
6434
|
try {
|
|
6435
6435
|
const content = decryptViewText(raw, compressed);
|
|
6436
6436
|
totalDecompressed += content.length;
|
|
6437
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6437
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkAUWO57EDcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6438
6438
|
sections.push({ idx: i, content });
|
|
6439
6439
|
} catch (e32) {
|
|
6440
6440
|
break;
|
|
@@ -18934,25 +18934,25 @@ function desEcbDecrypt(data, key) {
|
|
|
18934
18934
|
}
|
|
18935
18935
|
function readLayout(data) {
|
|
18936
18936
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
18937
|
-
throw new (0,
|
|
18937
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
18938
18938
|
}
|
|
18939
18939
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
18940
18940
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
18941
18941
|
if (payloadOffset >= data.length) {
|
|
18942
|
-
throw new (0,
|
|
18942
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18943
18943
|
}
|
|
18944
18944
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
18945
18945
|
}
|
|
18946
18946
|
function decryptHwp3Document(input, password) {
|
|
18947
18947
|
const { payloadOffset, compressed } = readLayout(input);
|
|
18948
18948
|
if (!compressed) {
|
|
18949
|
-
throw new (0,
|
|
18949
|
+
throw new (0, _chunkAUWO57EDcjs.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)");
|
|
18950
18950
|
}
|
|
18951
18951
|
const source = Buffer.from(input);
|
|
18952
18952
|
const payload = source.subarray(payloadOffset);
|
|
18953
18953
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
18954
18954
|
if (aligned.length === 0) {
|
|
18955
|
-
throw new (0,
|
|
18955
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
18956
18956
|
}
|
|
18957
18957
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
18958
18958
|
let inflated;
|
|
@@ -18960,14 +18960,14 @@ function decryptHwp3Document(input, password) {
|
|
|
18960
18960
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
18961
18961
|
} catch (err) {
|
|
18962
18962
|
if (_optionalChain([err, 'optionalAccess', _248 => _248.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18963
|
-
throw new (0,
|
|
18963
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(
|
|
18964
18964
|
`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`
|
|
18965
18965
|
);
|
|
18966
18966
|
}
|
|
18967
|
-
throw new (0,
|
|
18967
|
+
throw new (0, _chunkAUWO57EDcjs.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.");
|
|
18968
18968
|
}
|
|
18969
18969
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
18970
|
-
throw new (0,
|
|
18970
|
+
throw new (0, _chunkAUWO57EDcjs.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.");
|
|
18971
18971
|
}
|
|
18972
18972
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
18973
18973
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -19024,9 +19024,9 @@ function hwp3CellGrid(info, count) {
|
|
|
19024
19024
|
const col = edgeAt(xs, g3.x), row = edgeAt(ys, g3.y);
|
|
19025
19025
|
const c2 = nextX[k] !== void 0 ? edgeAt(xs, nextX[k]) : xs.length - 1;
|
|
19026
19026
|
const r2 = nextY[k] !== void 0 ? edgeAt(ys, nextY[k]) : ys.length - 1;
|
|
19027
|
-
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row),
|
|
19027
|
+
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row), _chunkMED2MR6Ocjs.MAX_ROWS), colSpan: Math.min(Math.max(1, c2 - col), _chunkMED2MR6Ocjs.MAX_COLS) };
|
|
19028
19028
|
});
|
|
19029
|
-
return { rows: Math.min(Math.max(1, ys.length - 1),
|
|
19029
|
+
return { rows: Math.min(Math.max(1, ys.length - 1), _chunkMED2MR6Ocjs.MAX_ROWS), cols: Math.min(Math.max(1, xs.length - 1), _chunkMED2MR6Ocjs.MAX_COLS), cells };
|
|
19030
19030
|
}
|
|
19031
19031
|
|
|
19032
19032
|
// src/hwp3/parser.ts
|
|
@@ -19067,7 +19067,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19067
19067
|
let source = Buffer.from(buffer);
|
|
19068
19068
|
if (isEncryptedHwp3(source)) {
|
|
19069
19069
|
if (!_optionalChain([options, 'optionalAccess', _249 => _249.password])) {
|
|
19070
|
-
throw new (0,
|
|
19070
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(
|
|
19071
19071
|
"\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."
|
|
19072
19072
|
);
|
|
19073
19073
|
}
|
|
@@ -19084,10 +19084,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19084
19084
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
19085
19085
|
} catch (err) {
|
|
19086
19086
|
if (_optionalChain([err, 'optionalAccess', _250 => _250.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
19087
|
-
throw new (0,
|
|
19087
|
+
throw new (0, _chunkAUWO57EDcjs.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`);
|
|
19088
19088
|
}
|
|
19089
19089
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
19090
|
-
throw new (0,
|
|
19090
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
19091
19091
|
}
|
|
19092
19092
|
} else {
|
|
19093
19093
|
body = tail;
|
|
@@ -19110,7 +19110,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19110
19110
|
const names = new Map([...ctx.picIds].map(([name, id]) => [id, name]));
|
|
19111
19111
|
dropMissingPictures(allBlocks, binData, names, warnings);
|
|
19112
19112
|
const images = resolveImageBlocks(binData, allBlocks, warnings, true);
|
|
19113
|
-
const blocks =
|
|
19113
|
+
const blocks = _chunkMED2MR6Ocjs.flattenLayoutTables.call(void 0, allBlocks);
|
|
19114
19114
|
const metadata = {
|
|
19115
19115
|
title: header.title || void 0,
|
|
19116
19116
|
author: header.author || void 0,
|
|
@@ -19118,10 +19118,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19118
19118
|
createdAt: header.date || void 0,
|
|
19119
19119
|
version: "3.0"
|
|
19120
19120
|
};
|
|
19121
|
-
let markdown =
|
|
19121
|
+
let markdown = _chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _251 => _251.tableFormat]) });
|
|
19122
19122
|
if (_optionalChain([options, 'optionalAccess', _252 => _252.inlineImages]) && options.images !== false && images.length > 0) {
|
|
19123
19123
|
try {
|
|
19124
|
-
markdown =
|
|
19124
|
+
markdown = _chunkEKKZNKJDcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
19125
19125
|
} catch (inlineErr) {
|
|
19126
19126
|
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" });
|
|
19127
19127
|
}
|
|
@@ -19253,7 +19253,7 @@ function parseCharStream(reader, charCount, ctx, para2) {
|
|
|
19253
19253
|
continue;
|
|
19254
19254
|
}
|
|
19255
19255
|
if (ch >= 32) {
|
|
19256
|
-
para2.text +=
|
|
19256
|
+
para2.text += _chunkMED2MR6Ocjs.escapeLiteralTags.call(void 0, _chunkMED2MR6Ocjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(decodeJohabText(ch), () => ( ""))));
|
|
19257
19257
|
continue;
|
|
19258
19258
|
}
|
|
19259
19259
|
if (ch === 9) {
|
|
@@ -19488,7 +19488,7 @@ function isDistributionSentinel(markdown) {
|
|
|
19488
19488
|
// src/xlsx/sheet-blocks.ts
|
|
19489
19489
|
var MAX_SHEET_COLS = 16384;
|
|
19490
19490
|
function sheetRowCap(cols) {
|
|
19491
|
-
return Math.floor(
|
|
19491
|
+
return Math.floor(_chunkMED2MR6Ocjs.MAX_TABLE_CELLS / Math.max(1, cols));
|
|
19492
19492
|
}
|
|
19493
19493
|
function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols) {
|
|
19494
19494
|
const blocks = [];
|
|
@@ -19519,7 +19519,7 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19519
19519
|
if (keepRows.length > rowCap) {
|
|
19520
19520
|
warnings.push({
|
|
19521
19521
|
page: sheetIndex + 1,
|
|
19522
|
-
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 ${
|
|
19522
|
+
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 ${_chunkMED2MR6Ocjs.MAX_TABLE_CELLS})`,
|
|
19523
19523
|
code: "TRUNCATED_TABLE"
|
|
19524
19524
|
});
|
|
19525
19525
|
keepRows.length = rowCap;
|
|
@@ -19553,14 +19553,14 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19553
19553
|
}
|
|
19554
19554
|
cellRows.push(row);
|
|
19555
19555
|
}
|
|
19556
|
-
const table2 =
|
|
19556
|
+
const table2 = _chunkMED2MR6Ocjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols, maxRows: rowCap, maxCols: keepCols.length });
|
|
19557
19557
|
if (table2.rows > 0) blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
19558
19558
|
return blocks;
|
|
19559
19559
|
}
|
|
19560
19560
|
|
|
19561
19561
|
// src/xlsx/parser.ts
|
|
19562
19562
|
var MAX_SHEETS = 100;
|
|
19563
|
-
var MAX_DECOMPRESS_SIZE4 =
|
|
19563
|
+
var MAX_DECOMPRESS_SIZE4 = _chunkAUWO57EDcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
19564
19564
|
var MAX_SHEET_ROWS = 1048576;
|
|
19565
19565
|
function cleanNumericValue(raw) {
|
|
19566
19566
|
if (!/^-?\d+\.\d+$/.test(raw)) return raw;
|
|
@@ -19597,7 +19597,7 @@ function getTextContent(el) {
|
|
|
19597
19597
|
return _nullishCoalesce(_optionalChain([el, 'access', _268 => _268.textContent, 'optionalAccess', _269 => _269.trim, 'call', _270 => _270()]), () => ( ""));
|
|
19598
19598
|
}
|
|
19599
19599
|
function parseXml(text) {
|
|
19600
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19600
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkAUWO57EDcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19601
19601
|
}
|
|
19602
19602
|
function collectRichText(root) {
|
|
19603
19603
|
let out = "";
|
|
@@ -19608,7 +19608,7 @@ function collectRichText(root) {
|
|
|
19608
19608
|
const el = children[i];
|
|
19609
19609
|
const local = el.localName || _optionalChain([el, 'access', _271 => _271.tagName, 'optionalAccess', _272 => _272.replace, 'call', _273 => _273(/^[^:]+:/, "")]) || "";
|
|
19610
19610
|
if (local === "rPh") continue;
|
|
19611
|
-
if (local === "t") out +=
|
|
19611
|
+
if (local === "t") out += _chunkMED2MR6Ocjs.escapeLiteralTags.call(void 0, _chunkMED2MR6Ocjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
19612
19612
|
else walk(el);
|
|
19613
19613
|
}
|
|
19614
19614
|
};
|
|
@@ -19819,12 +19819,12 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19819
19819
|
return { rows, merges, maxCol };
|
|
19820
19820
|
}
|
|
19821
19821
|
async function parseXlsxDocument(buffer, options) {
|
|
19822
|
-
|
|
19822
|
+
_chunkAUWO57EDcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
19823
19823
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19824
19824
|
const warnings = [];
|
|
19825
19825
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
19826
19826
|
if (!workbookFile) {
|
|
19827
|
-
throw new (0,
|
|
19827
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19828
19828
|
}
|
|
19829
19829
|
let sharedStrings = [];
|
|
19830
19830
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -19833,7 +19833,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19833
19833
|
}
|
|
19834
19834
|
const { sheets, date1904 } = parseWorkbook(await readZipEntry(workbookFile, "text"));
|
|
19835
19835
|
if (sheets.length === 0) {
|
|
19836
|
-
throw new (0,
|
|
19836
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19837
19837
|
}
|
|
19838
19838
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
19839
19839
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -19917,7 +19917,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19917
19917
|
} catch (e35) {
|
|
19918
19918
|
}
|
|
19919
19919
|
}
|
|
19920
|
-
const markdown =
|
|
19920
|
+
const markdown = _chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _278 => _278.tableFormat]) });
|
|
19921
19921
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
19922
19922
|
}
|
|
19923
19923
|
|
|
@@ -20231,14 +20231,14 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20231
20231
|
const h = readCellHeader(rec.data);
|
|
20232
20232
|
if (h && rec.data.length >= 10) {
|
|
20233
20233
|
const isst = rec.data.readUInt32LE(6);
|
|
20234
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20234
|
+
cells.push({ row: h.row, col: h.col, value: _chunkMED2MR6Ocjs.escapeLiteralTags.call(void 0, _chunkMED2MR6Ocjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(sst[isst], () => ( "")))) });
|
|
20235
20235
|
}
|
|
20236
20236
|
break;
|
|
20237
20237
|
}
|
|
20238
20238
|
case OP_LABEL: {
|
|
20239
20239
|
const h = readCellHeader(rec.data);
|
|
20240
20240
|
if (h) {
|
|
20241
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20241
|
+
cells.push({ row: h.row, col: h.col, value: _chunkMED2MR6Ocjs.escapeLiteralTags.call(void 0, _chunkMED2MR6Ocjs.escapeLiteralDollar.call(void 0, decodeLabelString(rec.data))) });
|
|
20242
20242
|
}
|
|
20243
20243
|
break;
|
|
20244
20244
|
}
|
|
@@ -20254,7 +20254,7 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20254
20254
|
cells.push({
|
|
20255
20255
|
row: h.row,
|
|
20256
20256
|
col: h.col,
|
|
20257
|
-
value:
|
|
20257
|
+
value: _chunkMED2MR6Ocjs.escapeLiteralTags.call(void 0, _chunkMED2MR6Ocjs.escapeLiteralDollar.call(void 0, decodeFormulaStringRecord(next.data)))
|
|
20258
20258
|
});
|
|
20259
20259
|
i = j;
|
|
20260
20260
|
} else {
|
|
@@ -20366,11 +20366,11 @@ function processGlobals(records) {
|
|
|
20366
20366
|
const xfFmtIds = [];
|
|
20367
20367
|
const firstBof = records[0];
|
|
20368
20368
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
20369
|
-
throw new (0,
|
|
20369
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
20370
20370
|
}
|
|
20371
20371
|
const bof = decodeBof(firstBof.data);
|
|
20372
20372
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
20373
|
-
throw new (0,
|
|
20373
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
20374
20374
|
}
|
|
20375
20375
|
let i = 1;
|
|
20376
20376
|
while (i < records.length) {
|
|
@@ -20454,28 +20454,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20454
20454
|
try {
|
|
20455
20455
|
cfb = parseLenientCfb(buf);
|
|
20456
20456
|
} catch (e) {
|
|
20457
|
-
throw new (0,
|
|
20457
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(
|
|
20458
20458
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
20459
20459
|
);
|
|
20460
20460
|
}
|
|
20461
20461
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
20462
20462
|
if (!wb) {
|
|
20463
|
-
throw new (0,
|
|
20463
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
20464
20464
|
}
|
|
20465
20465
|
const records = readRecords2(wb);
|
|
20466
20466
|
if (records.length === 0) {
|
|
20467
|
-
throw new (0,
|
|
20467
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
20468
20468
|
}
|
|
20469
20469
|
const firstBof = decodeBof(records[0].data);
|
|
20470
20470
|
if (firstBof && firstBof.vers !== 1536) {
|
|
20471
|
-
throw new (0,
|
|
20471
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(
|
|
20472
20472
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
20473
20473
|
);
|
|
20474
20474
|
}
|
|
20475
20475
|
const globals = processGlobals(records);
|
|
20476
20476
|
const warnings = [];
|
|
20477
20477
|
if (globals.encrypted) {
|
|
20478
|
-
throw new (0,
|
|
20478
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20479
20479
|
}
|
|
20480
20480
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
20481
20481
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -20526,7 +20526,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20526
20526
|
pageCount: totalSheets
|
|
20527
20527
|
};
|
|
20528
20528
|
return {
|
|
20529
|
-
markdown:
|
|
20529
|
+
markdown: _chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, allBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _283 => _283.tableFormat]) }),
|
|
20530
20530
|
blocks: allBlocks,
|
|
20531
20531
|
metadata,
|
|
20532
20532
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -20965,7 +20965,7 @@ function isDisplayMath(el) {
|
|
|
20965
20965
|
}
|
|
20966
20966
|
|
|
20967
20967
|
// src/docx/parser.ts
|
|
20968
|
-
var MAX_DECOMPRESS_SIZE5 =
|
|
20968
|
+
var MAX_DECOMPRESS_SIZE5 = _chunkAUWO57EDcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
20969
20969
|
var MEDIA_PART_RE = /^word\/(?:media|embeddings)\//;
|
|
20970
20970
|
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;
|
|
20971
20971
|
function matchesLocal(el, localName3) {
|
|
@@ -21023,7 +21023,7 @@ function getAttr(el, localName3) {
|
|
|
21023
21023
|
return null;
|
|
21024
21024
|
}
|
|
21025
21025
|
function parseXml2(text) {
|
|
21026
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
21026
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkAUWO57EDcjs.stripDtd.call(void 0, text), "text/xml");
|
|
21027
21027
|
}
|
|
21028
21028
|
function parseStyles(xml) {
|
|
21029
21029
|
const doc = parseXml2(xml);
|
|
@@ -21159,7 +21159,7 @@ function parseFootnotes(xml) {
|
|
|
21159
21159
|
const runs = findElements(p, "r");
|
|
21160
21160
|
for (const r of runs) {
|
|
21161
21161
|
const tElements = getChildElements(r, "t");
|
|
21162
|
-
for (const t of tElements) texts.push(
|
|
21162
|
+
for (const t of tElements) texts.push(_chunkMED2MR6Ocjs.escapeLiteralTags.call(void 0, _chunkMED2MR6Ocjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(t.textContent, () => ( "")))));
|
|
21163
21163
|
}
|
|
21164
21164
|
}
|
|
21165
21165
|
notes.set(id, texts.join("").trim());
|
|
@@ -21190,7 +21190,7 @@ function collectOmmlRoots(p) {
|
|
|
21190
21190
|
function extractRun(r) {
|
|
21191
21191
|
let text = "";
|
|
21192
21192
|
for (const el of effectiveChildElements(r)) {
|
|
21193
|
-
if (matchesLocal(el, "t")) text +=
|
|
21193
|
+
if (matchesLocal(el, "t")) text += _chunkMED2MR6Ocjs.escapeLiteralTags.call(void 0, _chunkMED2MR6Ocjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
21194
21194
|
else if (matchesLocal(el, "br") || matchesLocal(el, "cr")) text += "\n";
|
|
21195
21195
|
else if (matchesLocal(el, "tab")) text += " ";
|
|
21196
21196
|
else if (matchesLocal(el, "sym")) text += symbolChar(getAttr(el, "font"), getAttr(el, "char"));
|
|
@@ -21203,7 +21203,7 @@ function extractRun(r) {
|
|
|
21203
21203
|
italic = getChildElements(rPrEls[0], "i").length > 0;
|
|
21204
21204
|
const va = getChildElements(rPrEls[0], "vertAlign")[0];
|
|
21205
21205
|
const v = va ? getAttr(va, "val") : null;
|
|
21206
|
-
if (v === "superscript" || v === "subscript") text =
|
|
21206
|
+
if (v === "superscript" || v === "subscript") text = _chunkMED2MR6Ocjs.wrapScript.call(void 0, text, v === "superscript" ? "sup" : "sub");
|
|
21207
21207
|
}
|
|
21208
21208
|
return { text, bold, italic };
|
|
21209
21209
|
}
|
|
@@ -21221,7 +21221,7 @@ var PAGE_FIELD_RE = /^\s*(?:PAGE|NUMPAGES|SECTIONPAGES)\b/i;
|
|
|
21221
21221
|
function makeLink(text, rawHref) {
|
|
21222
21222
|
if (!text) return "";
|
|
21223
21223
|
if (!rawHref) return text;
|
|
21224
|
-
const href =
|
|
21224
|
+
const href = _chunkAUWO57EDcjs.sanitizeHref.call(void 0, rawHref);
|
|
21225
21225
|
return href ? `[${text}](${href})` : text;
|
|
21226
21226
|
}
|
|
21227
21227
|
function collectInline(p, footnotes, rels) {
|
|
@@ -21312,7 +21312,7 @@ function collectInline(p, footnotes, rels) {
|
|
|
21312
21312
|
const m = mathText(om);
|
|
21313
21313
|
if (m) parts.push(isDisplayMath(om) ? m : " " + m + " ");
|
|
21314
21314
|
}
|
|
21315
|
-
const text =
|
|
21315
|
+
const text = _chunkMED2MR6Ocjs.tidyScriptTags.call(void 0, parts.join("")).replace(/[ \t]{2,}/g, " ").trim();
|
|
21316
21316
|
return { text, bold, italic, footnoteText };
|
|
21317
21317
|
}
|
|
21318
21318
|
var COUNTERS = /* @__PURE__ */ new WeakMap();
|
|
@@ -21437,7 +21437,7 @@ ${cell2.text}` : cell2.text;
|
|
|
21437
21437
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
21438
21438
|
})
|
|
21439
21439
|
);
|
|
21440
|
-
const table2 =
|
|
21440
|
+
const table2 = _chunkMED2MR6Ocjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21441
21441
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21442
21442
|
return { type: "table", table: table2 };
|
|
21443
21443
|
}
|
|
@@ -21486,7 +21486,7 @@ async function buildImageMap(zip, rels, doc, warnings, readBytes) {
|
|
|
21486
21486
|
let data = null;
|
|
21487
21487
|
if (readBytes) data = await readZipEntry(imgFile, "uint8array");
|
|
21488
21488
|
imgIdx++;
|
|
21489
|
-
const ext =
|
|
21489
|
+
const ext = _chunkAUWO57EDcjs.partExtension.call(void 0, imgPath);
|
|
21490
21490
|
const mimeMap = {
|
|
21491
21491
|
png: "image/png",
|
|
21492
21492
|
jpg: "image/jpeg",
|
|
@@ -21585,12 +21585,12 @@ async function parseHeaderFooterBlocks(zip, doc, rels, kind, styles, numbering,
|
|
|
21585
21585
|
}
|
|
21586
21586
|
async function parseDocxDocument(buffer, options) {
|
|
21587
21587
|
const readImages = _optionalChain([options, 'optionalAccess', _319 => _319.images]) !== false;
|
|
21588
|
-
|
|
21588
|
+
_chunkAUWO57EDcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5, void 0, { re: MEDIA_PART_RE, skip: !readImages, never: NEVER_READ_RE });
|
|
21589
21589
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21590
21590
|
const warnings = [];
|
|
21591
21591
|
const docFile = zip.file("word/document.xml");
|
|
21592
21592
|
if (!docFile) {
|
|
21593
|
-
throw new (0,
|
|
21593
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21594
21594
|
}
|
|
21595
21595
|
let rels = /* @__PURE__ */ new Map();
|
|
21596
21596
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -21637,7 +21637,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21637
21637
|
const doc = parseXml2(docXml);
|
|
21638
21638
|
const body = findElements(doc, "body");
|
|
21639
21639
|
if (body.length === 0) {
|
|
21640
|
-
throw new (0,
|
|
21640
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21641
21641
|
}
|
|
21642
21642
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings, readImages);
|
|
21643
21643
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -21690,7 +21690,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21690
21690
|
}
|
|
21691
21691
|
}
|
|
21692
21692
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
21693
|
-
const markdown =
|
|
21693
|
+
const markdown = _chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _326 => _326.tableFormat]) });
|
|
21694
21694
|
return {
|
|
21695
21695
|
markdown,
|
|
21696
21696
|
blocks,
|
|
@@ -21704,7 +21704,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21704
21704
|
// src/pptx/parser.ts
|
|
21705
21705
|
|
|
21706
21706
|
|
|
21707
|
-
var MAX_DECOMPRESS_SIZE6 =
|
|
21707
|
+
var MAX_DECOMPRESS_SIZE6 = _chunkAUWO57EDcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
21708
21708
|
var MEDIA_PART_RE2 = /^ppt\/(?:media|embeddings)\//;
|
|
21709
21709
|
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;
|
|
21710
21710
|
var MAX_ZIP_ENTRIES2 = 1e4;
|
|
@@ -21727,7 +21727,7 @@ var IMAGE_MIME = {
|
|
|
21727
21727
|
svg: "image/svg+xml"
|
|
21728
21728
|
};
|
|
21729
21729
|
function parseXml3(text) {
|
|
21730
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
21730
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkAUWO57EDcjs.stripDtd.call(void 0, text), "text/xml");
|
|
21731
21731
|
}
|
|
21732
21732
|
function getAttr2(el, name) {
|
|
21733
21733
|
const attrs = el.attributes;
|
|
@@ -21794,7 +21794,7 @@ async function slideParts(zip) {
|
|
|
21794
21794
|
names.sort((a, b) => Number(SLIDE_PART_RE.exec(a)[1]) - Number(SLIDE_PART_RE.exec(b)[1]));
|
|
21795
21795
|
ordered.push(...names);
|
|
21796
21796
|
}
|
|
21797
|
-
if (ordered.length > MAX_SLIDES) throw new (0,
|
|
21797
|
+
if (ordered.length > MAX_SLIDES) throw new (0, _chunkAUWO57EDcjs.KordocError)(`PPTX \uC2AC\uB77C\uC774\uB4DC \uC218 \uCD08\uACFC: ${ordered.length} (\uCD5C\uB300 ${MAX_SLIDES})`);
|
|
21798
21798
|
return ordered;
|
|
21799
21799
|
}
|
|
21800
21800
|
function paragraphText(p) {
|
|
@@ -21805,12 +21805,12 @@ function paragraphText(p) {
|
|
|
21805
21805
|
const t = findChildByLocalName(child, "t");
|
|
21806
21806
|
const rPr = findChildByLocalName(child, "rPr");
|
|
21807
21807
|
const baseline = Number(rPr ? _nullishCoalesce(getAttr2(rPr, "baseline"), () => ( 0)) : 0);
|
|
21808
|
-
if (t) text +=
|
|
21808
|
+
if (t) text += _chunkMED2MR6Ocjs.wrapScript.call(void 0, _chunkMED2MR6Ocjs.escapeLiteralTags.call(void 0, _chunkMED2MR6Ocjs.escapeLiteralDollar.call(void 0, rawTextContent(t))), baseline > 0 ? "sup" : baseline < 0 ? "sub" : null);
|
|
21809
21809
|
} else if (name === "br") {
|
|
21810
21810
|
text += " ";
|
|
21811
21811
|
}
|
|
21812
21812
|
}
|
|
21813
|
-
return
|
|
21813
|
+
return _chunkMED2MR6Ocjs.tidyScriptTags.call(void 0, text.replace(/\s+/g, " ").trim());
|
|
21814
21814
|
}
|
|
21815
21815
|
function bodyParagraphs(txBody) {
|
|
21816
21816
|
const out = [];
|
|
@@ -21871,7 +21871,7 @@ function parseTable2(tbl2, page, keepEmptyCols) {
|
|
|
21871
21871
|
});
|
|
21872
21872
|
return cells;
|
|
21873
21873
|
});
|
|
21874
|
-
const table2 =
|
|
21874
|
+
const table2 = _chunkMED2MR6Ocjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21875
21875
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21876
21876
|
return { type: "table", table: table2, pageNumber: page };
|
|
21877
21877
|
}
|
|
@@ -21884,7 +21884,7 @@ async function pictureBlock(pic, ctx) {
|
|
|
21884
21884
|
if (!filename) {
|
|
21885
21885
|
const file = ctx.zip.file(rel.target);
|
|
21886
21886
|
if (!file) return null;
|
|
21887
|
-
const ext =
|
|
21887
|
+
const ext = _chunkAUWO57EDcjs.partExtension.call(void 0, rel.target);
|
|
21888
21888
|
filename = `image_${String(ctx.imageNames.size + 1).padStart(3, "0")}.${ext}`;
|
|
21889
21889
|
try {
|
|
21890
21890
|
if (_optionalChain([ctx, 'access', _330 => _330.options, 'optionalAccess', _331 => _331.images]) !== false) {
|
|
@@ -21962,10 +21962,10 @@ async function notesText(zip, rels) {
|
|
|
21962
21962
|
return texts.join(" ");
|
|
21963
21963
|
}
|
|
21964
21964
|
async function parsePptxDocument(buffer, options) {
|
|
21965
|
-
|
|
21965
|
+
_chunkAUWO57EDcjs.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 });
|
|
21966
21966
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21967
21967
|
if (!zip.file("ppt/presentation.xml")) {
|
|
21968
|
-
throw new (0,
|
|
21968
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 PPTX \uD30C\uC77C: ppt/presentation.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21969
21969
|
}
|
|
21970
21970
|
const warnings = [];
|
|
21971
21971
|
const blocks = [];
|
|
@@ -22012,7 +22012,7 @@ async function parsePptxDocument(buffer, options) {
|
|
|
22012
22012
|
}
|
|
22013
22013
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")), pageNumber: b.pageNumber }));
|
|
22014
22014
|
return {
|
|
22015
|
-
markdown:
|
|
22015
|
+
markdown: _chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _336 => _336.tableFormat]) }),
|
|
22016
22016
|
blocks,
|
|
22017
22017
|
metadata,
|
|
22018
22018
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -22028,11 +22028,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
22028
22028
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
22029
22029
|
function parseHwpmlDocument(buffer, options) {
|
|
22030
22030
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
22031
|
-
throw new (0,
|
|
22031
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
22032
22032
|
}
|
|
22033
22033
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
22034
22034
|
const normalized = text.replace(/ /g, " ");
|
|
22035
|
-
const xml =
|
|
22035
|
+
const xml = _chunkAUWO57EDcjs.stripDtd.call(void 0, normalized);
|
|
22036
22036
|
const warnings = [];
|
|
22037
22037
|
const parser = new (0, _xmldom.DOMParser)({
|
|
22038
22038
|
onError: (_level, msg2) => {
|
|
@@ -22072,7 +22072,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
22072
22072
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _338 => _338.keepTrailingEmptyCols]), () => ( false)));
|
|
22073
22073
|
}
|
|
22074
22074
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
22075
|
-
const markdown =
|
|
22075
|
+
const markdown = _chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _339 => _339.tableFormat]) });
|
|
22076
22076
|
return {
|
|
22077
22077
|
markdown,
|
|
22078
22078
|
blocks,
|
|
@@ -22179,7 +22179,7 @@ function collectCharText(node, parts, depth = 0) {
|
|
|
22179
22179
|
if (tag === "CHAR") {
|
|
22180
22180
|
for (const c of Array.from(el.childNodes)) {
|
|
22181
22181
|
const t = c.nodeType === 1 ? localName(c) === "TAB" ? " " : rawTextContent(c) : c.nodeType === 3 || c.nodeType === 4 ? _nullishCoalesce(c.nodeValue, () => ( "")) : "";
|
|
22182
|
-
if (t) parts.push(
|
|
22182
|
+
if (t) parts.push(_chunkMED2MR6Ocjs.escapeLiteralTags.call(void 0, t));
|
|
22183
22183
|
}
|
|
22184
22184
|
} else if (tag === "TABLE" || tag === "PICTURE" || tag === "SHAPEOBJECT") {
|
|
22185
22185
|
} else if (tag === "AUTONUM") {
|
|
@@ -22239,7 +22239,7 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
22239
22239
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
22240
22240
|
cellRows[r].push(cell2);
|
|
22241
22241
|
}
|
|
22242
|
-
const table2 =
|
|
22242
|
+
const table2 = _chunkMED2MR6Ocjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
22243
22243
|
if (structured.length > 0) {
|
|
22244
22244
|
const claimed = /* @__PURE__ */ new Set();
|
|
22245
22245
|
for (const { ctx, cellBlocks } of structured) {
|
|
@@ -24002,7 +24002,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
24002
24002
|
};
|
|
24003
24003
|
}
|
|
24004
24004
|
async function extractClickHereFields(hwpxBuffer) {
|
|
24005
|
-
|
|
24005
|
+
_chunkAUWO57EDcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
24006
24006
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
24007
24007
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
24008
24008
|
const fields = [];
|
|
@@ -24038,7 +24038,7 @@ function readZipEntries(buf) {
|
|
|
24038
24038
|
}
|
|
24039
24039
|
function localDataStart(view, localOffset) {
|
|
24040
24040
|
if (view.getUint32(localOffset, true) !== LOCAL_SIG) {
|
|
24041
|
-
throw new (0,
|
|
24041
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
24042
24042
|
}
|
|
24043
24043
|
const nameLen = view.getUint16(localOffset + 26, true);
|
|
24044
24044
|
const extraLen = view.getUint16(localOffset + 28, true);
|
|
@@ -24068,19 +24068,19 @@ function parseCentralDirectory(buf) {
|
|
|
24068
24068
|
}
|
|
24069
24069
|
}
|
|
24070
24070
|
}
|
|
24071
|
-
if (eocdOffset < 0) throw new (0,
|
|
24071
|
+
if (eocdOffset < 0) throw new (0, _chunkAUWO57EDcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24072
24072
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
24073
24073
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
24074
24074
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
24075
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
24075
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkAUWO57EDcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24076
24076
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
24077
|
-
throw new (0,
|
|
24077
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24078
24078
|
}
|
|
24079
24079
|
const decoder = new TextDecoder("utf-8");
|
|
24080
24080
|
const entries = [];
|
|
24081
24081
|
let pos = cdOffset;
|
|
24082
24082
|
for (let i = 0; i < totalEntries; i++) {
|
|
24083
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
24083
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkAUWO57EDcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
24084
24084
|
const flags = view.getUint16(pos + 8, true);
|
|
24085
24085
|
const method = view.getUint16(pos + 10, true);
|
|
24086
24086
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -24091,7 +24091,7 @@ function parseCentralDirectory(buf) {
|
|
|
24091
24091
|
const commentLen = view.getUint16(pos + 32, true);
|
|
24092
24092
|
const localOffset = view.getUint32(pos + 42, true);
|
|
24093
24093
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
24094
|
-
throw new (0,
|
|
24094
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24095
24095
|
}
|
|
24096
24096
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
24097
24097
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -24120,11 +24120,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24120
24120
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
24121
24121
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
24122
24122
|
for (const name of replacements.keys()) {
|
|
24123
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
24123
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkAUWO57EDcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
24124
24124
|
}
|
|
24125
24125
|
if (additions) {
|
|
24126
24126
|
for (const name of additions.keys()) {
|
|
24127
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
24127
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkAUWO57EDcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
24128
24128
|
}
|
|
24129
24129
|
}
|
|
24130
24130
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -24143,7 +24143,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24143
24143
|
offset += seg.length;
|
|
24144
24144
|
continue;
|
|
24145
24145
|
}
|
|
24146
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
24146
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkAUWO57EDcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
24147
24147
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
24148
24148
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
24149
24149
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -24151,7 +24151,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24151
24151
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
24152
24152
|
const method = e.method;
|
|
24153
24153
|
if (method !== 0 && method !== 8) {
|
|
24154
|
-
throw new (0,
|
|
24154
|
+
throw new (0, _chunkAUWO57EDcjs.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`);
|
|
24155
24155
|
}
|
|
24156
24156
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
24157
24157
|
const crc = crc32(newData);
|
|
@@ -24249,11 +24249,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24249
24249
|
// src/form/filler-hwpx.ts
|
|
24250
24250
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
24251
24251
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
24252
|
-
|
|
24252
|
+
_chunkAUWO57EDcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
24253
24253
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
24254
24254
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
24255
24255
|
if (sectionPaths.length === 0) {
|
|
24256
|
-
throw new (0,
|
|
24256
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24257
24257
|
}
|
|
24258
24258
|
const warnings = [];
|
|
24259
24259
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -24645,7 +24645,7 @@ var MIN_SIDE = 24;
|
|
|
24645
24645
|
async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
24646
24646
|
const ocr = _optionalChain([options, 'optionalAccess', _485 => _485.ocr]);
|
|
24647
24647
|
if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
|
|
24648
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
24648
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-OC3TCXMV.cjs")));
|
|
24649
24649
|
let inserted = false, unreadable = 0;
|
|
24650
24650
|
let failed = null;
|
|
24651
24651
|
const walk = async (list, depth) => {
|
|
@@ -24686,7 +24686,7 @@ async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
|
24686
24686
|
function ocrBytes(img) {
|
|
24687
24687
|
const mime = img.mimeType.toLowerCase();
|
|
24688
24688
|
if (mime.includes("wmf") || mime.includes("emf")) return null;
|
|
24689
|
-
if (mime.includes("bmp")) return
|
|
24689
|
+
if (mime.includes("bmp")) return _chunkEKKZNKJDcjs.bmpToPng.call(void 0, img.data);
|
|
24690
24690
|
return img.data;
|
|
24691
24691
|
}
|
|
24692
24692
|
async function tooSmall(bytes) {
|
|
@@ -24855,7 +24855,7 @@ function classifyTableTree(blocks) {
|
|
|
24855
24855
|
return blocks;
|
|
24856
24856
|
}
|
|
24857
24857
|
function chooseTableRepresentation(table2, opts = {}) {
|
|
24858
|
-
const structured = hasMerged(table2) ||
|
|
24858
|
+
const structured = hasMerged(table2) || _chunkMED2MR6Ocjs.hasStructuredCellContent.call(void 0, table2);
|
|
24859
24859
|
if (opts.smartVisual && _optionalChain([table2, 'access', _501 => _501.classification, 'optionalAccess', _502 => _502.kind]) === "non-tabular-layout") return "visual";
|
|
24860
24860
|
return structured ? "html" : "gfm";
|
|
24861
24861
|
}
|
|
@@ -35434,21 +35434,22 @@ var FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;?]}\xA2\xB0\u2032\u2033\u
|
|
|
35434
35434
|
var FORBID_END = /* @__PURE__ */ new Set([..."$([{\xA3\xA5\u3008\u300A\u300C\u300E\u3010\u3014$([{\u20A9"]);
|
|
35435
35435
|
var HANCOM_FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;>?]^`}~\xB0\xB7\u3009\u300B\u300D\u300F\u3011\u3015\u3017\u3019\u301B\u30FB\uFF01\uFF05\uFF09\uFF0C\uFF0E\uFF1A\uFF1B\uFF1E\uFF1F\uFF3D\uFF3E\uFF40\uFF5D\uFF5E\uFF65\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087\u308E\u30A1\u30A3\u30A5\u30A7\u30A9\u30C3\u30E3\u30E5\u30E7\u30EE\u30F5\u30F6\u3001\u3002\u3003\u3005\u30FC\u309B\u309C\u309D\u309E\u30FD\u30FE\u2019\u201D\u2024\u2025\u2026\u2030\u2031\u2032\u2033\u2034\u2035\u2036\u2037\u2103\u2109"]);
|
|
35436
35436
|
var HANCOM_FORBID_END = /* @__PURE__ */ new Set([..."(<[\\{\xA7\u2018\u201C\u3008\u300A\u300C\u300E\u3010\u3014\u3016\u3018\u301A\uFF04\uFF08\uFF1C\uFF3B\uFF3C\uFF5B\uFFE0\uFFE1\uFFE5\uFFE6$\xA2\xA3\xA4\xA5\u09F2\u09F3\u0E3F", ...Array.from({ length: 13 }, (_, i) => String.fromCharCode(8352 + i))]);
|
|
35437
|
+
var isWrapSpace = (ch) => ch === " " || ch === "\u2005";
|
|
35437
35438
|
function prepareWrap(text, mode, opts) {
|
|
35438
35439
|
const widthEm = widthFnOf(_optionalChain([opts, 'optionalAccess', _508 => _508.faceClass])), spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _509 => _509.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
35439
35440
|
const advances = [], steps = [];
|
|
35440
35441
|
let i = 0;
|
|
35441
35442
|
for (const ch of text) {
|
|
35442
35443
|
const cp = ch.codePointAt(0);
|
|
35443
|
-
advances[i] = isSpaceCp(cp) ? spaceEm : widthEm(cp);
|
|
35444
|
+
advances[i] = cp === 8197 ? 250 : isSpaceCp(cp) ? spaceEm : widthEm(cp);
|
|
35444
35445
|
steps[i] = ch.length;
|
|
35445
35446
|
i += ch.length;
|
|
35446
35447
|
}
|
|
35447
35448
|
return { units: splitWrapUnits(text, mode), advances, steps };
|
|
35448
35449
|
}
|
|
35449
35450
|
function splitWrapUnits(text, mode, latinBreak = false) {
|
|
35450
|
-
if (latinBreak) return _nullishCoalesce(text.match(mode === "keep" ? / +|[\x21-\x7e]|[^ \x21-\x7e]+/gu : / +|[^ ](?:\u00a0[^ \u00a0]?)*/gu), () => ( []));
|
|
35451
|
-
return _nullishCoalesce(text.match(mode === "keep" ? / +|\ufdd0+(?=[^ \ufdd0])|[^ ]+/gu : / +|\u2060*(?:[\x21-\x7e\u00a1-\u024f\u2018-\u201f]+|[^ ])(?:\u00a0(?:[\x21-\x7e\u00a1-\u024f\u2018-\u201f]+|[^ \u00a0])?)*/gu), () => ( []));
|
|
35451
|
+
if (latinBreak) return _nullishCoalesce(text.match(mode === "keep" ? /[ \u2005]+|[\x21-\x7e]|[^ \u2005\x21-\x7e]+/gu : /[ \u2005]+|[^ \u2005](?:\u00a0[^ \u2005\u00a0]?)*/gu), () => ( []));
|
|
35452
|
+
return _nullishCoalesce(text.match(mode === "keep" ? /[ \u2005]+|\ufdd0+(?=[^ \u2005\ufdd0])|[^ \u2005]+/gu : /[ \u2005]+|\u2060*(?:[\x21-\x7e\u00a1-\u024f\u2018-\u201f]+|[^ \u2005])(?:\u00a0(?:[\x21-\x7e\u00a1-\u024f\u2018-\u201f]+|[^ \u2005\u00a0])?)*/gu), () => ( []));
|
|
35452
35453
|
}
|
|
35453
35454
|
function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "keep", opts) {
|
|
35454
35455
|
if (!_optionalChain([opts, 'optionalAccess', _510 => _510.prepared]) && text.includes("\n")) {
|
|
@@ -35495,7 +35496,7 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
|
|
|
35495
35496
|
if (unitW) return (_nullishCoalesce(unitW[i], () => ( 0))) + (ch.length === 2 ? _nullishCoalesce(unitW[i + 1], () => ( 0)) : 0);
|
|
35496
35497
|
if (prepared) return prepared.advances[i] * (1 + spacing / 100) * k;
|
|
35497
35498
|
const cp = ch.codePointAt(0);
|
|
35498
|
-
return (isSpaceCp(cp) ? spaceEm : widthEm(cp)) * (1 + spacing / 100) * k;
|
|
35499
|
+
return (cp === 8197 ? 250 : isSpaceCp(cp) ? spaceEm : widthEm(cp)) * (1 + spacing / 100) * k;
|
|
35499
35500
|
};
|
|
35500
35501
|
const rangeW = (from, to) => {
|
|
35501
35502
|
let w = 0;
|
|
@@ -35528,11 +35529,11 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
|
|
|
35528
35529
|
const u = text[unitPos];
|
|
35529
35530
|
const prevStart = (end) => end - (end >= 2 && /[\uDC00-\uDFFF]/.test(text[end - 1]) && /[\uD800-\uDBFF]/.test(text[end - 2]) ? 2 : 1);
|
|
35530
35531
|
const old = _optionalChain([opts, 'optionalAccess', _533 => _533.before2024]);
|
|
35531
|
-
const splitIn = _optionalChain([opts, 'optionalAccess', _534 => _534.kinsoku]) === "hancom" && split && u !== void 0 && u
|
|
35532
|
+
const splitIn = _optionalChain([opts, 'optionalAccess', _534 => _534.kinsoku]) === "hancom" && split && u !== void 0 && !isWrapSpace(u) && !isWrapSpace(text[bp - 1]);
|
|
35532
35533
|
const inWord = old && splitIn;
|
|
35533
|
-
if (!splitIn && u !== void 0 && forbidStart.has(u) && prevStart(bp) > lineStart() && text[bp - 1]
|
|
35534
|
+
if (!splitIn && u !== void 0 && forbidStart.has(u) && prevStart(bp) > lineStart() && !isWrapSpace(text[bp - 1])) {
|
|
35534
35535
|
bp = prevStart(bp);
|
|
35535
|
-
if (old && forbidStart.has(text[bp]) && prevStart(bp) > lineStart() && text[bp - 1]
|
|
35536
|
+
if (old && forbidStart.has(text[bp]) && prevStart(bp) > lineStart() && !isWrapSpace(text[bp - 1])) bp = prevStart(bp);
|
|
35536
35537
|
}
|
|
35537
35538
|
while (!inWord && bp - 1 >= lineStart() && forbidEnd.has(text[bp - 1])) bp--;
|
|
35538
35539
|
if (bp <= lineStart()) bp = unitPos;
|
|
@@ -35543,8 +35544,8 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
|
|
|
35543
35544
|
lineEnded = false;
|
|
35544
35545
|
placed = unitPos > bp ? 1 : 0;
|
|
35545
35546
|
for (let i = bp; i < unitPos; i++) {
|
|
35546
|
-
if (text[i]
|
|
35547
|
-
else if (condense > 0 && (realSeen || !hancom)) spaceW += rangeW(i, i + 1) - (_nullishCoalesce(_optionalChain([spAt, 'optionalAccess', _535 => _535[i]]), () => ( 0)));
|
|
35547
|
+
if (!isWrapSpace(text[i])) realSeen = true;
|
|
35548
|
+
else if (text[i] === " " && condense > 0 && (realSeen || !hancom)) spaceW += rangeW(i, i + 1) - (_nullishCoalesce(_optionalChain([spAt, 'optionalAccess', _535 => _535[i]]), () => ( 0)));
|
|
35548
35549
|
}
|
|
35549
35550
|
lineW = rangeW(bp, unitPos) + w;
|
|
35550
35551
|
};
|
|
@@ -35558,16 +35559,16 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
|
|
|
35558
35559
|
lineW = leadW;
|
|
35559
35560
|
};
|
|
35560
35561
|
for (const u of units) {
|
|
35561
|
-
if (u[0]
|
|
35562
|
+
if (isWrapSpace(u[0])) {
|
|
35562
35563
|
if (hancom) {
|
|
35563
35564
|
let k2 = 0;
|
|
35564
35565
|
for (; k2 < u.length; k2++) {
|
|
35565
35566
|
if (!lineEnded && lineW >= avail) lineEnded = true;
|
|
35566
|
-
if (lineEnded && k2 >= 2 && pos + k2 > lineStart()) break;
|
|
35567
|
+
if (lineEnded && (k2 >= 2 || u[k2] === "\u2005") && pos + k2 > lineStart()) break;
|
|
35567
35568
|
if (!lineEnded) {
|
|
35568
35569
|
const sw2 = rangeW(pos + k2, pos + k2 + 1);
|
|
35569
35570
|
lineW += sw2;
|
|
35570
|
-
if (realSeen) spaceW += sw2 - (_nullishCoalesce(_optionalChain([spAt, 'optionalAccess', _536 => _536[pos + k2]]), () => ( 0)));
|
|
35571
|
+
if (realSeen && u[k2] === " ") spaceW += sw2 - (_nullishCoalesce(_optionalChain([spAt, 'optionalAccess', _536 => _536[pos + k2]]), () => ( 0)));
|
|
35571
35572
|
}
|
|
35572
35573
|
}
|
|
35573
35574
|
if (k2 < u.length) breakAt(pos + k2, rangeW(pos + k2, pos + u.length));
|
|
@@ -35576,7 +35577,7 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
|
|
|
35576
35577
|
}
|
|
35577
35578
|
const sw = rangeW(pos, pos + u.length);
|
|
35578
35579
|
lineW += sw;
|
|
35579
|
-
spaceW +=
|
|
35580
|
+
for (let k2 = 0; k2 < u.length; k2++) if (u[k2] === " ") spaceW += rangeW(pos + k2, pos + k2 + 1);
|
|
35580
35581
|
pos += u.length;
|
|
35581
35582
|
continue;
|
|
35582
35583
|
}
|
|
@@ -35847,7 +35848,7 @@ function findAgency(name) {
|
|
|
35847
35848
|
}
|
|
35848
35849
|
function agencyStyle(name) {
|
|
35849
35850
|
const s = findAgency(name);
|
|
35850
|
-
if (!s) throw new (0,
|
|
35851
|
+
if (!s) throw new (0, _chunkAUWO57EDcjs.KordocError)(`agency: \uC2E4\uCE21 \uC11C\uC2DD\uC774 \uC5C6\uB294 \uAE30\uAD00\uC785\uB2C8\uB2E4 "${name}" \u2014 ${AGENCY_COMMON_NAME} \uB610\uB294 ${agencyNames().join("\xB7")}`);
|
|
35851
35852
|
return s;
|
|
35852
35853
|
}
|
|
35853
35854
|
function applyAgency(opts, preset) {
|
|
@@ -36911,7 +36912,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
36911
36912
|
}
|
|
36912
36913
|
function assertFiniteRange(name, value, min, max) {
|
|
36913
36914
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
36914
|
-
throw new (0,
|
|
36915
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
36915
36916
|
}
|
|
36916
36917
|
}
|
|
36917
36918
|
function validateGongmunOptions(opts) {
|
|
@@ -36929,10 +36930,10 @@ function validateGongmunOptions(opts) {
|
|
|
36929
36930
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
36930
36931
|
}
|
|
36931
36932
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
36932
|
-
throw new (0,
|
|
36933
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
36933
36934
|
}
|
|
36934
36935
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
36935
|
-
throw new (0,
|
|
36936
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
36936
36937
|
}
|
|
36937
36938
|
}
|
|
36938
36939
|
if (opts.sizes) {
|
|
@@ -36941,24 +36942,24 @@ function validateGongmunOptions(opts) {
|
|
|
36941
36942
|
}
|
|
36942
36943
|
}
|
|
36943
36944
|
if (opts.approval && opts.approval.length > 6) {
|
|
36944
|
-
throw new (0,
|
|
36945
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("approval must contain at most 6 labels");
|
|
36945
36946
|
}
|
|
36946
36947
|
if (opts.checklist && typeof opts.checklist === "object") {
|
|
36947
36948
|
const nums = [..._nullishCoalesce(opts.checklist.na, () => ( [])), ...Object.keys(_nullishCoalesce(opts.checklist.notes, () => ( {}))).map(Number)];
|
|
36948
36949
|
for (const n of nums) {
|
|
36949
|
-
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0,
|
|
36950
|
+
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0, _chunkAUWO57EDcjs.KordocError)(`checklist: item number must be an integer between 1 and ${CHECKLIST_ITEMS} (got ${n})`);
|
|
36950
36951
|
}
|
|
36951
36952
|
}
|
|
36952
36953
|
if (opts.levels) {
|
|
36953
36954
|
for (const [key, st] of Object.entries(opts.levels)) {
|
|
36954
36955
|
const depth = Number(key);
|
|
36955
36956
|
if (!Number.isInteger(depth) || depth < 0 || depth >= GONGMUN_LEVEL_COUNT) {
|
|
36956
|
-
throw new (0,
|
|
36957
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(`levels: depth must be an integer between 0 and ${GONGMUN_LEVEL_COUNT - 1} (got "${key}")`);
|
|
36957
36958
|
}
|
|
36958
|
-
if (!st || typeof st !== "object") throw new (0,
|
|
36959
|
+
if (!st || typeof st !== "object") throw new (0, _chunkAUWO57EDcjs.KordocError)(`levels.${key} must be an object {font, pt, bold}`);
|
|
36959
36960
|
if (st.pt !== void 0) assertFiniteRange(`levels.${key}.pt`, st.pt, 6, 60);
|
|
36960
36961
|
if (st.font !== void 0 && (typeof st.font !== "string" || !st.font.trim())) {
|
|
36961
|
-
throw new (0,
|
|
36962
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(`levels.${key}.font must be a non-empty string`);
|
|
36962
36963
|
}
|
|
36963
36964
|
}
|
|
36964
36965
|
}
|
|
@@ -37016,7 +37017,7 @@ function resolveChecklist(c, preset) {
|
|
|
37016
37017
|
function hexColorOption(name, value) {
|
|
37017
37018
|
if (value === void 0) return void 0;
|
|
37018
37019
|
const v = value.trim();
|
|
37019
|
-
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0,
|
|
37020
|
+
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0, _chunkAUWO57EDcjs.KordocError)(`${name} must be a #RRGGBB color (got "${value}")`);
|
|
37020
37021
|
return v.toUpperCase();
|
|
37021
37022
|
}
|
|
37022
37023
|
function resolveGongmun(input) {
|
|
@@ -37760,7 +37761,7 @@ function parseInlineMarkdown(text) {
|
|
|
37760
37761
|
else spans.push(...emphasisSpans(m[0]));
|
|
37761
37762
|
} else {
|
|
37762
37763
|
const anchor = m[2] || m[3];
|
|
37763
|
-
const href = _nullishCoalesce(
|
|
37764
|
+
const href = _nullishCoalesce(_chunkAUWO57EDcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
37764
37765
|
const sub = emphasisSpans(anchor);
|
|
37765
37766
|
if (href) for (const s of sub) s.href = href;
|
|
37766
37767
|
spans.push(...sub);
|
|
@@ -37981,7 +37982,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
37981
37982
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
37982
37983
|
const got = m ? Number(m[1]) : NaN;
|
|
37983
37984
|
if (got !== startId + i) {
|
|
37984
|
-
throw new (0,
|
|
37985
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(
|
|
37985
37986
|
`\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)`
|
|
37986
37987
|
);
|
|
37987
37988
|
}
|
|
@@ -38072,7 +38073,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
38072
38073
|
}
|
|
38073
38074
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
38074
38075
|
if (rows.length !== expectedBase) {
|
|
38075
|
-
throw new (0,
|
|
38076
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(
|
|
38076
38077
|
`\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`
|
|
38077
38078
|
);
|
|
38078
38079
|
}
|
|
@@ -39081,7 +39082,7 @@ function bestSimInRange(arr, from, to, target) {
|
|
|
39081
39082
|
return best;
|
|
39082
39083
|
}
|
|
39083
39084
|
function normForMatch(text) {
|
|
39084
|
-
return
|
|
39085
|
+
return _chunkMED2MR6Ocjs.sanitizeText.call(void 0, text.replace(/\\\$/g, "$").replace(/\\(?=<\/?(?:u|sup|sub)>)/g, "")).replace(/\s+/g, " ").trim();
|
|
39085
39086
|
}
|
|
39086
39087
|
function unescapeGfm(text) {
|
|
39087
39088
|
return text.replace(/\\([~*_`|#<$\\])/g, "$1");
|
|
@@ -39103,7 +39104,7 @@ function replicateGfmTable(table2) {
|
|
|
39103
39104
|
const cell2 = _optionalChain([cells, 'access', _632 => _632[r], 'optionalAccess', _633 => _633[c]]);
|
|
39104
39105
|
if (!cell2) continue;
|
|
39105
39106
|
display[r][c] = {
|
|
39106
|
-
text:
|
|
39107
|
+
text: _chunkMED2MR6Ocjs.escapeGfm.call(void 0, _chunkMED2MR6Ocjs.sanitizeText.call(void 0, cell2.text)).replace(/(?<!\\)\|/g, "\\|").replace(/\r\n|\r|\n/g, "<br>"),
|
|
39107
39108
|
gridR: r,
|
|
39108
39109
|
gridC: c
|
|
39109
39110
|
};
|
|
@@ -39143,16 +39144,16 @@ function replicateCellInnerHtml(cell2) {
|
|
|
39143
39144
|
if (_optionalChain([cell2, 'access', _634 => _634.blocks, 'optionalAccess', _635 => _635.length])) {
|
|
39144
39145
|
return cell2.blocks.map((b) => {
|
|
39145
39146
|
if (b.type === "table" && b.table) {
|
|
39146
|
-
const cap = b.table.caption ?
|
|
39147
|
-
return (cap ?
|
|
39147
|
+
const cap = b.table.caption ? _chunkMED2MR6Ocjs.sanitizeText.call(void 0, b.table.caption) : "";
|
|
39148
|
+
return (cap ? _chunkMED2MR6Ocjs.escapeHtmlCellText.call(void 0, cap) + "<br>" : "") + replicateTableToHtml(b.table);
|
|
39148
39149
|
}
|
|
39149
|
-
if (b.type === "image" && b.text) return `<img src="${
|
|
39150
|
-
const note =
|
|
39151
|
-
const t = (
|
|
39152
|
-
return ((t ?
|
|
39150
|
+
if (b.type === "image" && b.text) return `<img src="${_chunkAUWO57EDcjs.escapeHtml.call(void 0, b.text, true)}" alt="image">`;
|
|
39151
|
+
const note = _chunkMED2MR6Ocjs.noteTableHtml.call(void 0, b);
|
|
39152
|
+
const t = (_chunkMED2MR6Ocjs.sanitizeText.call(void 0, _chunkMED2MR6Ocjs.visibleText.call(void 0, b)) + (note ? "" : _chunkMED2MR6Ocjs.noteSuffix.call(void 0, b))).trim();
|
|
39153
|
+
return ((t ? _chunkMED2MR6Ocjs.escapeHtmlCellText.call(void 0, t).replace(/\n/g, "<br>") : "") + note).trim();
|
|
39153
39154
|
}).filter(Boolean).join("<br>");
|
|
39154
39155
|
}
|
|
39155
|
-
return
|
|
39156
|
+
return _chunkMED2MR6Ocjs.escapeHtmlCellText.call(void 0, _chunkMED2MR6Ocjs.sanitizeText.call(void 0, cell2.text)).replace(/\n/g, "<br>");
|
|
39156
39157
|
}
|
|
39157
39158
|
function replicateTableToHtml(table2) {
|
|
39158
39159
|
const rows = replicateHtmlTable(table2);
|
|
@@ -39229,7 +39230,7 @@ function parseHtmlTable(raw) {
|
|
|
39229
39230
|
const cs = parseInt(_optionalChain([attrs, 'access', _638 => _638.match, 'call', _639 => _639(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _640 => _640[1]]) || "1", 10);
|
|
39230
39231
|
const rs = parseInt(_optionalChain([attrs, 'access', _641 => _641.match, 'call', _642 => _642(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _643 => _643[1]]) || "1", 10);
|
|
39231
39232
|
cellStart = m.index + m[0].length;
|
|
39232
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
39233
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkMED2MR6Ocjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkMED2MR6Ocjs.MAX_ROWS) };
|
|
39233
39234
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
39234
39235
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
39235
39236
|
cellStart = -1;
|
|
@@ -39254,11 +39255,11 @@ function htmlCellInnerToLines(inner) {
|
|
|
39254
39255
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
39255
39256
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
39256
39257
|
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _644 => _644[1]]), () => ( _optionalChain([m, 'optionalAccess', _645 => _645[2]])));
|
|
39257
|
-
if (src) imgSrcs.push(
|
|
39258
|
+
if (src) imgSrcs.push(_chunkAUWO57EDcjs.unescapeHtml.call(void 0, src));
|
|
39258
39259
|
return "";
|
|
39259
39260
|
});
|
|
39260
39261
|
}
|
|
39261
|
-
const lines = work.split(/<br\s*\/?>/gi).map((s) =>
|
|
39262
|
+
const lines = work.split(/<br\s*\/?>/gi).map((s) => _chunkAUWO57EDcjs.unescapeHtml.call(void 0, s).trim()).filter((s) => s.length > 0);
|
|
39262
39263
|
return { lines, hadNonText, imgSrcs };
|
|
39263
39264
|
}
|
|
39264
39265
|
function splitCellByTopLevelTables(html) {
|
|
@@ -40074,8 +40075,8 @@ function layoutHtmlRows(rows) {
|
|
|
40074
40075
|
let c = 0;
|
|
40075
40076
|
for (const cell2 of rows[r].cells) {
|
|
40076
40077
|
while (occupied.has(`${r},${c}`)) c++;
|
|
40077
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
40078
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
40078
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkMED2MR6Ocjs.MAX_COLS);
|
|
40079
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkMED2MR6Ocjs.MAX_ROWS);
|
|
40079
40080
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
40080
40081
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
40081
40082
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -42410,7 +42411,7 @@ function builtinTemplateDir() {
|
|
|
42410
42411
|
for (const c of candidates) {
|
|
42411
42412
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
42412
42413
|
}
|
|
42413
|
-
throw new (0,
|
|
42414
|
+
throw new (0, _chunkAUWO57EDcjs.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)");
|
|
42414
42415
|
}
|
|
42415
42416
|
function readBuiltinTemplate(t) {
|
|
42416
42417
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -42886,12 +42887,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
42886
42887
|
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>`;
|
|
42887
42888
|
}
|
|
42888
42889
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
42889
|
-
if (ops.length === 0) throw new (0,
|
|
42890
|
+
if (ops.length === 0) throw new (0, _chunkAUWO57EDcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
42890
42891
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
42891
|
-
|
|
42892
|
+
_chunkAUWO57EDcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
42892
42893
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
42893
42894
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _856 => _856.match, 'call', _857 => _857(/(\d+)\.xml$/i), 'optionalAccess', _858 => _858[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _859 => _859.match, 'call', _860 => _860(/(\d+)\.xml$/i), 'optionalAccess', _861 => _861[1]]), () => ( 0))));
|
|
42894
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
42895
|
+
if (sectionPaths.length === 0) throw new (0, _chunkAUWO57EDcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
42895
42896
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
42896
42897
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
42897
42898
|
const styles = headerPath ? parseRenderStyles(await readZipEntry(zip.file(headerPath), "text")) : null;
|
|
@@ -42932,11 +42933,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
42932
42933
|
const manifestItems = [];
|
|
42933
42934
|
const placed = [];
|
|
42934
42935
|
for (const op of ops) {
|
|
42935
|
-
if (!op.anchor) throw new (0,
|
|
42936
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
42936
|
+
if (!op.anchor) throw new (0, _chunkAUWO57EDcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
42937
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkAUWO57EDcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
42937
42938
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
42938
|
-
if (!MIME[ext]) throw new (0,
|
|
42939
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
42939
|
+
if (!MIME[ext]) throw new (0, _chunkAUWO57EDcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
42940
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkAUWO57EDcjs.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)`);
|
|
42940
42941
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
42941
42942
|
let found = null;
|
|
42942
42943
|
let total = 0;
|
|
@@ -42969,7 +42970,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
42969
42970
|
}
|
|
42970
42971
|
}
|
|
42971
42972
|
}
|
|
42972
|
-
throw new (0,
|
|
42973
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(
|
|
42973
42974
|
`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)})`
|
|
42974
42975
|
);
|
|
42975
42976
|
}
|
|
@@ -42977,7 +42978,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
42977
42978
|
const xml = sectionXmls[si];
|
|
42978
42979
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
42979
42980
|
if (!run) {
|
|
42980
|
-
throw new (0,
|
|
42981
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
42981
42982
|
}
|
|
42982
42983
|
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _862 => _862.charPr, 'access', _863 => _863.get, 'call', _864 => _864(run.charPr), 'optionalAccess', _865 => _865.height]), () => ( 1e3));
|
|
42983
42984
|
const fontPt = charPrHeight / 100;
|
|
@@ -43255,7 +43256,7 @@ function pick(map, keys) {
|
|
|
43255
43256
|
return out;
|
|
43256
43257
|
}
|
|
43257
43258
|
async function hwpxToProfile(input) {
|
|
43258
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
43259
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkAUWO57EDcjs.toArrayBuffer.call(void 0, input);
|
|
43259
43260
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
43260
43261
|
const parser = createXmlParser();
|
|
43261
43262
|
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _890 => _890.file, 'call', _891 => _891(/[Hh]eader\.xml$/), 'optionalAccess', _892 => _892[0]])));
|
|
@@ -44228,7 +44229,7 @@ function patchTableRows(input) {
|
|
|
44228
44229
|
const cells = input.editedCells(ins.ei);
|
|
44229
44230
|
if (!cells) return skip("\uC0BD\uC785 \uD589\uC5D0 \uC774\uBBF8\uC9C0/\uC911\uCCA9\uD45C \uD3EC\uD568 \u2014 \uD589 \uCD94\uAC00 \uBBF8\uC9C0\uC6D0");
|
|
44230
44231
|
for (const cell2 of cells) {
|
|
44231
|
-
const unstable = cell2.lines.find((l) =>
|
|
44232
|
+
const unstable = cell2.lines.find((l) => _chunkMED2MR6Ocjs.sanitizeText.call(void 0, l) !== l);
|
|
44232
44233
|
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");
|
|
44233
44234
|
}
|
|
44234
44235
|
const tmplCells = scanTable.rows[template];
|
|
@@ -44423,14 +44424,14 @@ function buildEmbeddedLineSplices(para2, xml, newLines) {
|
|
|
44423
44424
|
}
|
|
44424
44425
|
if (text !== para2.text || !/[\r\n]/.test(text) || /<br\s*\/?\s*>/i.test(text)) return null;
|
|
44425
44426
|
const lines = text.split(/\r\n|\r|\n/);
|
|
44426
|
-
if (lines.length !== newLines.length || lines.some((line) => !line.trim() ||
|
|
44427
|
+
if (lines.length !== newLines.length || lines.some((line) => !line.trim() || _chunkMED2MR6Ocjs.sanitizeText.call(void 0, line) !== line.trim())) return null;
|
|
44427
44428
|
const splices = [];
|
|
44428
44429
|
let offset = 0;
|
|
44429
44430
|
for (let i = 0; i < lines.length; i++) {
|
|
44430
44431
|
const line = lines[i];
|
|
44431
44432
|
const orig = line.trim();
|
|
44432
44433
|
const next = newLines[i];
|
|
44433
|
-
if (
|
|
44434
|
+
if (_chunkMED2MR6Ocjs.sanitizeText.call(void 0, next) !== next || /[\r\n]/.test(next) || /[\uD800-\uDFFF]/u.test(next) || decodeXmlEntities(escapeXmlText(next)) !== next) return null;
|
|
44434
44435
|
let prefix = 0;
|
|
44435
44436
|
while (prefix < orig.length && prefix < next.length && orig[prefix] === next[prefix]) prefix++;
|
|
44436
44437
|
if (prefix > 0 && /[\uD800-\uDBFF]/.test(orig[prefix - 1]) && /[\uDC00-\uDFFF]/.test(_nullishCoalesce(orig[prefix], () => ( "")))) prefix--;
|
|
@@ -44830,12 +44831,12 @@ function stripCellTokens(text) {
|
|
|
44830
44831
|
}
|
|
44831
44832
|
function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
44832
44833
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
44833
|
-
const content =
|
|
44834
|
+
const content = _chunkMED2MR6Ocjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
44834
44835
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
44835
44836
|
const t = line.trim();
|
|
44836
44837
|
if (!t) return "";
|
|
44837
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
44838
|
-
return
|
|
44838
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkMED2MR6Ocjs.escapeGfm.call(void 0, t)}**`;
|
|
44839
|
+
return _chunkMED2MR6Ocjs.escapeGfm.call(void 0, t);
|
|
44839
44840
|
}).filter(Boolean);
|
|
44840
44841
|
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");
|
|
44841
44842
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -44849,7 +44850,7 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
44849
44850
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
44850
44851
|
const replica = [];
|
|
44851
44852
|
for (let r = 0; r < table2.rows; r++) {
|
|
44852
|
-
const line =
|
|
44853
|
+
const line = _chunkMED2MR6Ocjs.escapeGfm.call(void 0, _chunkMED2MR6Ocjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
44853
44854
|
if (line) replica.push({ line, gridR: r });
|
|
44854
44855
|
}
|
|
44855
44856
|
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");
|
|
@@ -44903,7 +44904,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
44903
44904
|
}
|
|
44904
44905
|
const splices = [];
|
|
44905
44906
|
let sectionIndex = -1;
|
|
44906
|
-
const unstable = newLines.find((l) =>
|
|
44907
|
+
const unstable = newLines.find((l) => _chunkMED2MR6Ocjs.sanitizeText.call(void 0, l) !== l);
|
|
44907
44908
|
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");
|
|
44908
44909
|
if (nonEmpty.length === 0) {
|
|
44909
44910
|
if (newLines.length === 0) return 0;
|
|
@@ -45027,7 +45028,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
45027
45028
|
const paths = parseSectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
45028
45029
|
if (paths.length > 0) return paths;
|
|
45029
45030
|
}
|
|
45030
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
45031
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkAUWO57EDcjs.compareSectionPaths);
|
|
45031
45032
|
}
|
|
45032
45033
|
|
|
45033
45034
|
// src/roundtrip/hwp5-patch.ts
|
|
@@ -45814,7 +45815,7 @@ function patchParagraph(block, orig, edited, ctx, skip) {
|
|
|
45814
45815
|
}
|
|
45815
45816
|
const origPlain = block.text != null ? block.text : restoreBr(textUnitToPlain(orig.raw, block));
|
|
45816
45817
|
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");
|
|
45817
|
-
if (
|
|
45818
|
+
if (_chunkMED2MR6Ocjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
45818
45819
|
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");
|
|
45819
45820
|
}
|
|
45820
45821
|
let origMd = restoreBr(textUnitToPlain(orig.raw, block));
|
|
@@ -45861,7 +45862,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
45861
45862
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
45862
45863
|
continue;
|
|
45863
45864
|
}
|
|
45864
|
-
if (afterEach.some((l) =>
|
|
45865
|
+
if (afterEach.some((l) => _chunkMED2MR6Ocjs.sanitizeText.call(void 0, l) !== l)) {
|
|
45865
45866
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
45866
45867
|
continue;
|
|
45867
45868
|
}
|
|
@@ -45889,7 +45890,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
45889
45890
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
45890
45891
|
break;
|
|
45891
45892
|
}
|
|
45892
|
-
if (
|
|
45893
|
+
if (_chunkMED2MR6Ocjs.sanitizeText.call(void 0, after2) !== after2) {
|
|
45893
45894
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
45894
45895
|
break;
|
|
45895
45896
|
}
|
|
@@ -45945,12 +45946,12 @@ function patchHtmlCells5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
45945
45946
|
}
|
|
45946
45947
|
function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
45947
45948
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
45948
|
-
const content =
|
|
45949
|
+
const content = _chunkMED2MR6Ocjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
45949
45950
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
45950
45951
|
const t = line.trim();
|
|
45951
45952
|
if (!t) return "";
|
|
45952
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
45953
|
-
return
|
|
45953
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkMED2MR6Ocjs.escapeGfm.call(void 0, t)}**`;
|
|
45954
|
+
return _chunkMED2MR6Ocjs.escapeGfm.call(void 0, t);
|
|
45954
45955
|
}).filter(Boolean);
|
|
45955
45956
|
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");
|
|
45956
45957
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -45964,7 +45965,7 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
45964
45965
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
45965
45966
|
const replica = [];
|
|
45966
45967
|
for (let r = 0; r < table2.rows; r++) {
|
|
45967
|
-
const line =
|
|
45968
|
+
const line = _chunkMED2MR6Ocjs.escapeGfm.call(void 0, _chunkMED2MR6Ocjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
45968
45969
|
if (line) replica.push({ line, gridR: r });
|
|
45969
45970
|
}
|
|
45970
45971
|
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");
|
|
@@ -46005,7 +46006,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
46005
46006
|
if (origLineCount !== void 0 && nonEmpty.length > 0 && origLineCount !== nonEmpty.length) {
|
|
46006
46007
|
return skip("\uC140 \uC904 \uACBD\uACC4 \uB9E4\uD551 \uBAA8\uD638 (\uBB38\uB2E8 \uB0B4 \uC904\uBC14\uAFC8) \u2014 \uBBF8\uC9C0\uC6D0");
|
|
46007
46008
|
}
|
|
46008
|
-
const unstable = newLines.find((l) =>
|
|
46009
|
+
const unstable = newLines.find((l) => _chunkMED2MR6Ocjs.sanitizeText.call(void 0, l) !== l);
|
|
46009
46010
|
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");
|
|
46010
46011
|
const targets = nonEmpty.length > 0 ? nonEmpty : cell2.paras;
|
|
46011
46012
|
if (targets.length === 0) return skip("\uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC74C \u2014 \uBBF8\uC9C0\uC6D0");
|
|
@@ -46407,12 +46408,12 @@ function buildOrigUnits(blocks) {
|
|
|
46407
46408
|
const block = blocks[i];
|
|
46408
46409
|
let consume = 1;
|
|
46409
46410
|
let chunk;
|
|
46410
|
-
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(
|
|
46411
|
+
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(_chunkMED2MR6Ocjs.sanitizeText.call(void 0, block.text))) {
|
|
46411
46412
|
const next = blocks[i + 1];
|
|
46412
46413
|
if (_optionalChain([next, 'optionalAccess', _967 => _967.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
46413
|
-
chunk =
|
|
46414
|
+
chunk = _chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
46414
46415
|
} else {
|
|
46415
|
-
chunk =
|
|
46416
|
+
chunk = _chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, [block]);
|
|
46416
46417
|
}
|
|
46417
46418
|
if (chunk) {
|
|
46418
46419
|
const subUnits = splitMarkdownUnits(chunk);
|
|
@@ -46696,7 +46697,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
46696
46697
|
}
|
|
46697
46698
|
}
|
|
46698
46699
|
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");
|
|
46699
|
-
if (
|
|
46700
|
+
if (_chunkMED2MR6Ocjs.sanitizeText.call(void 0, newPlain) !== newPlain && _chunkMED2MR6Ocjs.sanitizeText.call(void 0, origPlain) === origPlain) {
|
|
46700
46701
|
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");
|
|
46701
46702
|
}
|
|
46702
46703
|
const xml = _optionalChain([ctx, 'access', _979 => _979.scans, 'access', _980 => _980[mapping.para.sectionIndex], 'optionalAccess', _981 => _981.xml]);
|
|
@@ -46713,14 +46714,14 @@ function textUnitToPlain(raw, block) {
|
|
|
46713
46714
|
}
|
|
46714
46715
|
function textUnitInline(raw, block) {
|
|
46715
46716
|
let text = raw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
46716
|
-
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(
|
|
46717
|
+
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(_chunkMED2MR6Ocjs.sanitizeText.call(void 0, block.text))) {
|
|
46717
46718
|
text = text.replace(/^#{1,6}\s+/, "");
|
|
46718
46719
|
}
|
|
46719
46720
|
if (block.href) {
|
|
46720
46721
|
const linkMatch = text.match(/^\[([\s\S]*)\]\([^)]*\)$/);
|
|
46721
46722
|
if (linkMatch) text = linkMatch[1];
|
|
46722
46723
|
}
|
|
46723
|
-
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(
|
|
46724
|
+
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(_chunkMED2MR6Ocjs.sanitizeText.call(void 0, block.text))) {
|
|
46724
46725
|
text = text.slice(1, -1);
|
|
46725
46726
|
}
|
|
46726
46727
|
return text;
|
|
@@ -49268,7 +49269,7 @@ function blocksToChunks(blocks, options) {
|
|
|
49268
49269
|
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1012 => _1012.granularity]), () => ( "section"));
|
|
49269
49270
|
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1013 => _1013.includeTableCells]), () => ( false));
|
|
49270
49271
|
const mdOptions = { tableFormat: _optionalChain([options, 'optionalAccess', _1014 => _1014.tableFormat]) };
|
|
49271
|
-
if (_optionalChain([options, 'optionalAccess', _1015 => _1015.tableFormat]) === "gfm")
|
|
49272
|
+
if (_optionalChain([options, 'optionalAccess', _1015 => _1015.tableFormat]) === "gfm") _chunkMED2MR6Ocjs.assignTableIds.call(void 0, blocks);
|
|
49272
49273
|
const chunks = [];
|
|
49273
49274
|
const headingStack = [];
|
|
49274
49275
|
const listStack = [];
|
|
@@ -49282,12 +49283,12 @@ function blocksToChunks(blocks, options) {
|
|
|
49282
49283
|
let run = null;
|
|
49283
49284
|
const flushRun = () => {
|
|
49284
49285
|
if (!run) return;
|
|
49285
|
-
push("text", run.breadcrumb,
|
|
49286
|
+
push("text", run.breadcrumb, _chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, run.blocks, mdOptions), [run.start, run.end], run.page);
|
|
49286
49287
|
run = null;
|
|
49287
49288
|
};
|
|
49288
49289
|
for (let i = 0; i < blocks.length; i++) {
|
|
49289
49290
|
const block = blocks[i];
|
|
49290
|
-
const md2 =
|
|
49291
|
+
const md2 = _chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, [block], mdOptions);
|
|
49291
49292
|
if (!md2) continue;
|
|
49292
49293
|
if (block.type === "heading") {
|
|
49293
49294
|
flushRun();
|
|
@@ -49375,7 +49376,7 @@ function u8ToArrayBuffer2(u8) {
|
|
|
49375
49376
|
return u8.buffer.slice(u8.byteOffset, u8.byteOffset + u8.byteLength);
|
|
49376
49377
|
}
|
|
49377
49378
|
function irCellLines(text) {
|
|
49378
|
-
return stripCellTokens(
|
|
49379
|
+
return stripCellTokens(_chunkMED2MR6Ocjs.sanitizeText.call(void 0, text)).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
49379
49380
|
}
|
|
49380
49381
|
var HwpxSession = (_class10 = class _HwpxSession {
|
|
49381
49382
|
|
|
@@ -49635,7 +49636,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49635
49636
|
if (newPlain === "") {
|
|
49636
49637
|
return skip("\uBE14\uB85D \uBE44\uC6B0\uAE30/\uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 (v1) \u2014 \uC6D0\uBCF8 \uC720\uC9C0");
|
|
49637
49638
|
}
|
|
49638
|
-
if (
|
|
49639
|
+
if (_chunkMED2MR6Ocjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
49639
49640
|
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");
|
|
49640
49641
|
}
|
|
49641
49642
|
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _1035 => _1035.scans, 'access', _1036 => _1036[mapping.para.sectionIndex], 'optionalAccess', _1037 => _1037.xml]));
|
|
@@ -49730,7 +49731,7 @@ var md = new (0, _markdownit2.default)({
|
|
|
49730
49731
|
});
|
|
49731
49732
|
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;
|
|
49732
49733
|
function sanitizeRawHtml(raw) {
|
|
49733
|
-
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag :
|
|
49734
|
+
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag : _chunkAUWO57EDcjs.escapeHtml.call(void 0, tag));
|
|
49734
49735
|
}
|
|
49735
49736
|
md.renderer.rules.html_block = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
49736
49737
|
md.renderer.rules.html_inline = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
@@ -49738,7 +49739,7 @@ function renderHtml(markdown, options) {
|
|
|
49738
49739
|
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1041 => _1041.preset]), () => ( "default"));
|
|
49739
49740
|
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _1042 => _1042.extraCss]), () => ( "")));
|
|
49740
49741
|
const body = md.render(markdown);
|
|
49741
|
-
const watermark = _optionalChain([options, 'optionalAccess', _1043 => _1043.watermark]) ? `<div class="watermark">${
|
|
49742
|
+
const watermark = _optionalChain([options, 'optionalAccess', _1043 => _1043.watermark]) ? `<div class="watermark">${_chunkAUWO57EDcjs.escapeHtml.call(void 0, options.watermark)}</div>` : "";
|
|
49742
49743
|
const watermarkCss = _optionalChain([options, 'optionalAccess', _1044 => _1044.watermark]) ? `
|
|
49743
49744
|
.watermark {
|
|
49744
49745
|
position: fixed;
|
|
@@ -49792,13 +49793,13 @@ async function htmlToPdf(html, options) {
|
|
|
49792
49793
|
try {
|
|
49793
49794
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
49794
49795
|
} catch (e42) {
|
|
49795
|
-
throw new (0,
|
|
49796
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(
|
|
49796
49797
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
49797
49798
|
);
|
|
49798
49799
|
}
|
|
49799
49800
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
49800
49801
|
if (!executablePath) {
|
|
49801
|
-
throw new (0,
|
|
49802
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(
|
|
49802
49803
|
"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."
|
|
49803
49804
|
);
|
|
49804
49805
|
}
|
|
@@ -49853,7 +49854,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
49853
49854
|
return htmlToPdf(html, options);
|
|
49854
49855
|
}
|
|
49855
49856
|
async function blocksToPdf(blocks, options) {
|
|
49856
|
-
const markdown =
|
|
49857
|
+
const markdown = _chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, blocks);
|
|
49857
49858
|
return markdownToPdf(markdown, options);
|
|
49858
49859
|
}
|
|
49859
49860
|
|
|
@@ -50721,6 +50722,21 @@ function nextParaNumber(counters, geom) {
|
|
|
50721
50722
|
});
|
|
50722
50723
|
}
|
|
50723
50724
|
|
|
50725
|
+
// src/render/reflow-cache.ts
|
|
50726
|
+
function cachedParagraphBottom(lsa, bodyFlow) {
|
|
50727
|
+
let bottom = Number.NEGATIVE_INFINITY, previousV = Number.NEGATIVE_INFINITY;
|
|
50728
|
+
for (let i = 0; i < lsa.childNodes.length; i++) {
|
|
50729
|
+
const seg = lsa.childNodes[i];
|
|
50730
|
+
if (seg.nodeType !== 1 || seg.localName !== "lineseg") continue;
|
|
50731
|
+
const num4 = (name, fallback = 0) => toInt32(_nullishCoalesce(seg.getAttribute(name), () => ( void 0)), fallback);
|
|
50732
|
+
const v = num4("vertpos");
|
|
50733
|
+
if (bodyFlow && v < previousV) bottom = Number.NEGATIVE_INFINITY;
|
|
50734
|
+
bottom = Math.max(bottom, v + Math.max(num4("vertsize", 1e3), num4("textheight", 1e3)) + num4("spacing"));
|
|
50735
|
+
previousV = v;
|
|
50736
|
+
}
|
|
50737
|
+
return bottom;
|
|
50738
|
+
}
|
|
50739
|
+
|
|
50724
50740
|
// src/render/reflow.ts
|
|
50725
50741
|
var geomMemo = (styles) => ({ cell: /* @__PURE__ */ new WeakMap(), table: /* @__PURE__ */ new WeakMap(), paraGeom: styles.paraGeom });
|
|
50726
50742
|
var LINESEG_FLAGS = "393216";
|
|
@@ -51042,10 +51058,11 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51042
51058
|
}
|
|
51043
51059
|
const lineBox = [];
|
|
51044
51060
|
const lineParts = [];
|
|
51061
|
+
const collisionHeights = [];
|
|
51045
51062
|
const boxAt = (i) => {
|
|
51046
51063
|
if (!zones.length) return void 0;
|
|
51047
51064
|
if (i in lineBox) return lineBox[i];
|
|
51048
|
-
const y0 = textStartV + i * pitch, y1 = y0 + height;
|
|
51065
|
+
const y0 = textStartV + i * pitch, y1 = y0 + Math.max(height, _nullishCoalesce(collisionHeights[i], () => ( 0)));
|
|
51049
51066
|
let free = [[marginL, marginL + avail]], hit = false, flow = "BOTH_SIDES";
|
|
51050
51067
|
for (const z of zones) {
|
|
51051
51068
|
if (!(y1 > z.top && y0 < z.bottom)) continue;
|
|
@@ -51105,7 +51122,26 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51105
51122
|
lineParts.length = 0;
|
|
51106
51123
|
}
|
|
51107
51124
|
}
|
|
51108
|
-
const
|
|
51125
|
+
const wrapLines = () => text.length === 0 ? { lines: 1, starts: [0], lastLineWidth: 0 } : simulateWrap(text, firstWrapWidth, contWidth, height, 100, paraMode, { widths, spacings, condensePct: condenseUse, kinsoku: "hancom", before2024: styles.before2024, lineWidth, latinBreak: geom.latinBreak, rightTabs });
|
|
51126
|
+
let wrap = wrapLines();
|
|
51127
|
+
if (zones.length) for (let pass = 0; pass < text.length; pass++) {
|
|
51128
|
+
let changed = false;
|
|
51129
|
+
for (const o of m.objs) if (o.inline) {
|
|
51130
|
+
const k = realIdx.indexOf(o.index), om = findChildByLocalName(o.el, "outMargin");
|
|
51131
|
+
if (k < 0) continue;
|
|
51132
|
+
let li = 0;
|
|
51133
|
+
for (let j = 1; j < wrap.starts.length; j++) if (wrap.starts[j] <= k) li = j;
|
|
51134
|
+
const h = num3(om, "top") + effHOf(o) + num3(om, "bottom");
|
|
51135
|
+
if (h > Math.max(height, _nullishCoalesce(collisionHeights[li], () => ( 0)))) {
|
|
51136
|
+
collisionHeights[li] = h;
|
|
51137
|
+
changed = true;
|
|
51138
|
+
}
|
|
51139
|
+
}
|
|
51140
|
+
if (!changed) break;
|
|
51141
|
+
lineBox.length = 0;
|
|
51142
|
+
lineParts.length = 0;
|
|
51143
|
+
wrap = wrapLines();
|
|
51144
|
+
}
|
|
51109
51145
|
const lineObjH = new Array(wrap.starts.length).fill(0);
|
|
51110
51146
|
const lineObjAsc = new Array(wrap.starts.length).fill(0);
|
|
51111
51147
|
const lineObjLs = new Array(wrap.starts.length).fill(false);
|
|
@@ -51196,12 +51232,13 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51196
51232
|
}
|
|
51197
51233
|
}
|
|
51198
51234
|
const vertpos = v;
|
|
51235
|
+
const occupiedH = Math.max(lineH, _nullishCoalesce(collisionHeights[li], () => ( 0)));
|
|
51199
51236
|
v += lineH + spacing;
|
|
51200
51237
|
const isFirst = li === 0;
|
|
51201
51238
|
const seg = doc.createElement("hp:lineseg");
|
|
51202
51239
|
seg.setAttribute("textpos", String(textpos));
|
|
51203
51240
|
seg.setAttribute("vertpos", String(vertpos));
|
|
51204
|
-
seg.setAttribute("vertsize", String(
|
|
51241
|
+
seg.setAttribute("vertsize", String(occupiedH === textH && boxAll > textH0 ? Math.max(textH0, boxTop) : occupiedH));
|
|
51205
51242
|
seg.setAttribute("textheight", String(lineH));
|
|
51206
51243
|
seg.setAttribute("baseline", String(geom.vertAlign === "TOP" ? 0 : geom.vertAlign === "CENTER" ? Math.floor(lineH / 2) : geom.vertAlign === "BOTTOM" ? lineH : Math.max(fl ? fl[1] : Math.round(textH0 * BASELINE_RATIO), lineObjAsc[li])));
|
|
51207
51244
|
seg.setAttribute("spacing", String(spacing));
|
|
@@ -51384,12 +51421,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51384
51421
|
if (!res) {
|
|
51385
51422
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
51386
51423
|
if (lsa) {
|
|
51387
|
-
|
|
51388
|
-
for (const seg of elements2(lsa)) {
|
|
51389
|
-
if (ln2(seg) !== "lineseg") continue;
|
|
51390
|
-
const th = Math.max(num3(seg, "vertsize", 1e3), num3(seg, "textheight", 1e3));
|
|
51391
|
-
bottom = Math.max(bottom, num3(seg, "vertpos") + th + num3(seg, "spacing"));
|
|
51392
|
-
}
|
|
51424
|
+
const bottom = cachedParagraphBottom(lsa, bodyFlow);
|
|
51393
51425
|
if (Number.isFinite(bottom)) {
|
|
51394
51426
|
cursorV = bottom;
|
|
51395
51427
|
prevSpaceAfter = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1196 => _1196.spaceAfter]), () => ( 0));
|
|
@@ -52691,7 +52723,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52691
52723
|
if (st.italic) attrs.push(`font-style="italic"`);
|
|
52692
52724
|
if (st.underline) attrs.push(`text-decoration="underline"`);
|
|
52693
52725
|
if (st.color) attrs.push(`fill="${escapeXml7(st.color)}"`);
|
|
52694
|
-
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(
|
|
52726
|
+
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(_chunkMED2MR6Ocjs.mapPuaText.call(void 0, text))}</text>`);
|
|
52695
52727
|
ctx.stats.texts++;
|
|
52696
52728
|
}
|
|
52697
52729
|
return sw;
|
|
@@ -53624,22 +53656,22 @@ function renderSectionRoots(sections, input) {
|
|
|
53624
53656
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${index}` });
|
|
53625
53657
|
ctxBase.pageBase += pages.length;
|
|
53626
53658
|
}
|
|
53627
|
-
if (rendered.length === 0) throw new (0,
|
|
53659
|
+
if (rendered.length === 0) throw new (0, _chunkAUWO57EDcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
53628
53660
|
return { sections: rendered, defs: ctxBase.defs, warnings: input.warnings, stats: ctxBase.stats, regions: ctxBase.regions.regions };
|
|
53629
53661
|
}
|
|
53630
53662
|
var SVG_FONT_FAMILY = `'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif`;
|
|
53631
53663
|
async function renderHwpxInternal(input, options) {
|
|
53632
53664
|
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1341 => _1341.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
53633
53665
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
53634
|
-
|
|
53666
|
+
_chunkAUWO57EDcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
53635
53667
|
let zip;
|
|
53636
53668
|
try {
|
|
53637
53669
|
zip = await _jszip2.default.loadAsync(input);
|
|
53638
53670
|
} catch (e43) {
|
|
53639
|
-
throw new (0,
|
|
53671
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
53640
53672
|
}
|
|
53641
|
-
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) =>
|
|
53642
|
-
if (secFiles.length === 0) throw new (0,
|
|
53673
|
+
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => _chunkAUWO57EDcjs.compareSectionPaths.call(void 0, a.name, b.name));
|
|
53674
|
+
if (secFiles.length === 0) throw new (0, _chunkAUWO57EDcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
53643
53675
|
const warnings = [];
|
|
53644
53676
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
53645
53677
|
const verFile = zip.file("version.xml");
|
|
@@ -53650,14 +53682,14 @@ async function renderHwpxInternal(input, options) {
|
|
|
53650
53682
|
const secXmls = [];
|
|
53651
53683
|
for (const f of secFiles) {
|
|
53652
53684
|
const xml = await readZipEntry(f, "text");
|
|
53653
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
53685
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkAUWO57EDcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
53654
53686
|
secXmls.push(xml);
|
|
53655
53687
|
}
|
|
53656
53688
|
const masterPages = /* @__PURE__ */ new Map();
|
|
53657
53689
|
const masterXmls = [];
|
|
53658
53690
|
for (const file of zip.file(/Contents\/masterpage[^/]*\.xml$/i)) {
|
|
53659
53691
|
const xml = await readZipEntry(file, "text");
|
|
53660
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
53692
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkAUWO57EDcjs.KordocError)("\uBC14\uD0D5\uCABD XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
53661
53693
|
const root = createXmlParser().parseFromString(xml, "text/xml").documentElement;
|
|
53662
53694
|
if (root && ln(root) === "masterPage") {
|
|
53663
53695
|
masterPages.set(root.getAttribute("id") || file.name.replace(/^.*\/|\.xml$/g, ""), root);
|
|
@@ -53724,9 +53756,9 @@ async function renderHwpxInternal(input, options) {
|
|
|
53724
53756
|
}
|
|
53725
53757
|
if (roots.length === 0) {
|
|
53726
53758
|
if (noCacheSkipped) {
|
|
53727
|
-
throw new (0,
|
|
53759
|
+
throw new (0, _chunkAUWO57EDcjs.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)");
|
|
53728
53760
|
}
|
|
53729
|
-
throw new (0,
|
|
53761
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
53730
53762
|
}
|
|
53731
53763
|
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1344 => _1344.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1345 => _1345.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1346 => _1346.highlights]) });
|
|
53732
53764
|
}
|
|
@@ -53951,7 +53983,7 @@ var FOLD_END = 42124;
|
|
|
53951
53983
|
var FOLD_SHIFT = 983040 - 40960;
|
|
53952
53984
|
function textChar(ch) {
|
|
53953
53985
|
if (ch >= FOLD_START && ch <= FOLD_END) {
|
|
53954
|
-
const mapped =
|
|
53986
|
+
const mapped = _chunkMED2MR6Ocjs.mapPuaText.call(void 0, String.fromCodePoint(ch + FOLD_SHIFT));
|
|
53955
53987
|
return /[\u{F0000}-\u{FFFFF}]/u.test(mapped) ? "" : mapped;
|
|
53956
53988
|
}
|
|
53957
53989
|
if (ch === 65534 || ch === 65535 || ch >= 55296 && ch <= 57343) return "\uFFFD";
|
|
@@ -54336,7 +54368,7 @@ function renderHwp5Records(docInfo, styles, secRecords, binData, options, select
|
|
|
54336
54368
|
}
|
|
54337
54369
|
roots.push({ root, index: si });
|
|
54338
54370
|
}
|
|
54339
|
-
if (roots.length === 0) throw new (0,
|
|
54371
|
+
if (roots.length === 0) throw new (0, _chunkAUWO57EDcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP \uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
54340
54372
|
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1355 => _1355.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1356 => _1356.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1357 => _1357.highlights]) });
|
|
54341
54373
|
return assemblePageSvgs(r, "hwp", select);
|
|
54342
54374
|
}
|
|
@@ -54349,7 +54381,7 @@ function renderHwp5Pages(input, options, select) {
|
|
|
54349
54381
|
const styles = buildHwp5RenderStyles(_nullishCoalesce(docInfoRecords, () => ( [])));
|
|
54350
54382
|
const docInfo = docInfoRecords ? parseDocInfo(docInfoRecords) : null;
|
|
54351
54383
|
const sections = readHwp5SectionStreams(c);
|
|
54352
|
-
if (sections.length === 0) throw new (0,
|
|
54384
|
+
if (sections.length === 0) throw new (0, _chunkAUWO57EDcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
54353
54385
|
const parseWarnings = [];
|
|
54354
54386
|
const secRecords = readHwp5SectionRecords(c, sections, parseWarnings);
|
|
54355
54387
|
for (const w of parseWarnings) warnings.push(w.message);
|
|
@@ -54435,14 +54467,14 @@ async function loadSharp() {
|
|
|
54435
54467
|
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("sharp")));
|
|
54436
54468
|
return _nullishCoalesce(mod.default, () => ( mod));
|
|
54437
54469
|
} catch (e46) {
|
|
54438
|
-
throw new (0,
|
|
54439
|
-
'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.' +
|
|
54470
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(
|
|
54471
|
+
'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.' + _chunkAUWO57EDcjs.OPTIONAL_DEP_INSTALL_HINT
|
|
54440
54472
|
);
|
|
54441
54473
|
}
|
|
54442
54474
|
}
|
|
54443
54475
|
async function rasterizePageSvg(svg, widthPt, heightPt, options = {}) {
|
|
54444
54476
|
const sharp = await loadSharp();
|
|
54445
|
-
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0,
|
|
54477
|
+
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0, _chunkAUWO57EDcjs.KordocError)(`\uC798\uBABB\uB41C \uD398\uC774\uC9C0 \uD06C\uAE30: ${widthPt}x${heightPt}pt`);
|
|
54446
54478
|
const maxW = _nullishCoalesce(options.maxWidthPx, () => ( 1400));
|
|
54447
54479
|
const maxH = _nullishCoalesce(options.maxHeightPx, () => ( 4e3));
|
|
54448
54480
|
const scale2 = Math.min(maxW / widthPt, maxH / heightPt, 2);
|
|
@@ -54460,11 +54492,11 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
54460
54492
|
try {
|
|
54461
54493
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
54462
54494
|
} catch (e47) {
|
|
54463
|
-
throw new (0,
|
|
54495
|
+
throw new (0, _chunkAUWO57EDcjs.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");
|
|
54464
54496
|
}
|
|
54465
54497
|
const executablePath = _nullishCoalesce(_nullishCoalesce(options.browserExecutablePath, () => ( process.env.PUPPETEER_EXECUTABLE_PATH)), () => ( findChromiumPath()));
|
|
54466
54498
|
if (!executablePath) {
|
|
54467
|
-
throw new (0,
|
|
54499
|
+
throw new (0, _chunkAUWO57EDcjs.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");
|
|
54468
54500
|
}
|
|
54469
54501
|
const { browser, page } = await launchLockedPage(puppeteer, executablePath);
|
|
54470
54502
|
try {
|
|
@@ -54480,13 +54512,13 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
54480
54512
|
async function loadBuffer(input) {
|
|
54481
54513
|
if (typeof input === "string") {
|
|
54482
54514
|
try {
|
|
54483
|
-
return
|
|
54515
|
+
return _chunkAUWO57EDcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input));
|
|
54484
54516
|
} catch (err) {
|
|
54485
54517
|
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
54486
|
-
throw new (0,
|
|
54518
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`);
|
|
54487
54519
|
}
|
|
54488
54520
|
}
|
|
54489
|
-
if (Buffer.isBuffer(input)) return
|
|
54521
|
+
if (Buffer.isBuffer(input)) return _chunkAUWO57EDcjs.toArrayBuffer.call(void 0, input);
|
|
54490
54522
|
if (input instanceof Uint8Array) return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
|
|
54491
54523
|
return input;
|
|
54492
54524
|
}
|
|
@@ -54495,17 +54527,17 @@ async function sourceFormatOf(buffer) {
|
|
|
54495
54527
|
if (format2 === "hwpx") {
|
|
54496
54528
|
const zip = await detectZipFormat(buffer);
|
|
54497
54529
|
if (zip === "hwpx" || zip === "unknown") return "hwpx";
|
|
54498
|
-
throw new (0,
|
|
54530
|
+
throw new (0, _chunkAUWO57EDcjs.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`);
|
|
54499
54531
|
}
|
|
54500
54532
|
if (format2 === "hwp") return "hwp";
|
|
54501
|
-
throw new (0,
|
|
54533
|
+
throw new (0, _chunkAUWO57EDcjs.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`);
|
|
54502
54534
|
}
|
|
54503
54535
|
async function renderDocumentToScene(input, options = {}) {
|
|
54504
54536
|
const buffer = await loadBuffer(input);
|
|
54505
54537
|
const source = await sourceFormatOf(buffer);
|
|
54506
54538
|
const select = options.pages !== void 0 ? (pageCount) => {
|
|
54507
54539
|
const set = _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, pageCount);
|
|
54508
|
-
if (set.size === 0) throw new (0,
|
|
54540
|
+
if (set.size === 0) throw new (0, _chunkAUWO57EDcjs.KordocError)(`\uC120\uD0DD\uD55C \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uBB38\uC11C\uB294 ${pageCount}\uCABD (pages: ${JSON.stringify(options.pages)})`);
|
|
54509
54541
|
return set;
|
|
54510
54542
|
} : void 0;
|
|
54511
54543
|
const renderOptions = { reflow: _nullishCoalesce(options.reflow, () => ( true)), reflowMode: options.reflowMode, highlights: options.highlights, maxImageBytes: options.maxImageBytes };
|
|
@@ -54541,7 +54573,7 @@ async function renderDocument(input, options) {
|
|
|
54541
54573
|
break;
|
|
54542
54574
|
}
|
|
54543
54575
|
default:
|
|
54544
|
-
throw new (0,
|
|
54576
|
+
throw new (0, _chunkAUWO57EDcjs.KordocError)(`\uC54C \uC218 \uC5C6\uB294 \uB80C\uB354 \uD3EC\uB9F7: ${String(options.format)} (svg|html|png|jpeg|pdf)`);
|
|
54545
54577
|
}
|
|
54546
54578
|
return { scene, assets };
|
|
54547
54579
|
}
|
|
@@ -54571,7 +54603,7 @@ async function extractRenderedRegions(input, options = {}) {
|
|
|
54571
54603
|
const out = [];
|
|
54572
54604
|
for (const [page, items] of [...byPage.entries()].sort((a, b) => a[0] - b[0])) {
|
|
54573
54605
|
const meta = scene.pages.find((p) => p.page === page);
|
|
54574
|
-
if (!meta) throw new (0,
|
|
54606
|
+
if (!meta) throw new (0, _chunkAUWO57EDcjs.KordocError)(`\uD398\uC774\uC9C0 ${page} \uBA54\uD0C0 \uC5C6\uC74C`);
|
|
54575
54607
|
const raster = await rasterizePageSvg(pageSvgs.get(page), meta.width, meta.height, { format: format2, maxWidthPx: options.maxWidthPx, quality: options.quality });
|
|
54576
54608
|
for (const { region, bbox } of items) {
|
|
54577
54609
|
const rect = cropRect(bbox, raster.scale, raster.widthPx, raster.heightPx, _nullishCoalesce(options.paddingPt, () => ( 0)));
|
|
@@ -54595,9 +54627,9 @@ function wantsCrop(kind, policy) {
|
|
|
54595
54627
|
}
|
|
54596
54628
|
async function extractTables(input, options = {}) {
|
|
54597
54629
|
const policy = _nullishCoalesce(options.policy, () => ( "non-tabular-and-uncertain"));
|
|
54598
|
-
const buffer = typeof input === "string" ?
|
|
54630
|
+
const buffer = typeof input === "string" ? _chunkAUWO57EDcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input)) : Buffer.isBuffer(input) ? _chunkAUWO57EDcjs.toArrayBuffer.call(void 0, input) : input;
|
|
54599
54631
|
const parsed = await parse(buffer, { classifyTables: true, layoutTables: "keep" });
|
|
54600
|
-
if (!parsed.success) throw new (0,
|
|
54632
|
+
if (!parsed.success) throw new (0, _chunkAUWO57EDcjs.KordocError)(`\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
54601
54633
|
const blocks = collectTableBlocks(parsed.blocks);
|
|
54602
54634
|
const out = blocks.map((b, i) => ({
|
|
54603
54635
|
id: _nullishCoalesce(b.table.sourceId, () => ( `tbl-${i + 1}`)),
|
|
@@ -54659,18 +54691,18 @@ async function parse(input, options) {
|
|
|
54659
54691
|
if (_optionalChain([opts, 'optionalAccess', _1359 => _1359.htmlTables]) && opts.tableFormat) {
|
|
54660
54692
|
return { success: false, fileType: "unknown", error: "htmlTables \uC640 tableFormat \uC740 \uD568\uAED8 \uC4F8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4" };
|
|
54661
54693
|
}
|
|
54662
|
-
const ocrOptionError =
|
|
54694
|
+
const ocrOptionError = _chunkMED2MR6Ocjs.validateOcrOptions.call(void 0, opts);
|
|
54663
54695
|
if (ocrOptionError) return { success: false, fileType: "unknown", error: ocrOptionError };
|
|
54664
54696
|
if (typeof input === "string") {
|
|
54665
54697
|
try {
|
|
54666
54698
|
const buf = await _promises.readFile.call(void 0, input);
|
|
54667
|
-
buffer =
|
|
54699
|
+
buffer = _chunkAUWO57EDcjs.toArrayBuffer.call(void 0, buf);
|
|
54668
54700
|
} catch (err) {
|
|
54669
54701
|
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}`;
|
|
54670
|
-
return { success: false, fileType: "unknown", error: msg2, code:
|
|
54702
|
+
return { success: false, fileType: "unknown", error: msg2, code: _chunkAUWO57EDcjs.classifyError.call(void 0, err) };
|
|
54671
54703
|
}
|
|
54672
54704
|
} else if (Buffer.isBuffer(input)) {
|
|
54673
|
-
buffer =
|
|
54705
|
+
buffer = _chunkAUWO57EDcjs.toArrayBuffer.call(void 0, input);
|
|
54674
54706
|
} else {
|
|
54675
54707
|
buffer = input;
|
|
54676
54708
|
}
|
|
@@ -54689,7 +54721,7 @@ async function parse(input, options) {
|
|
|
54689
54721
|
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` }] };
|
|
54690
54722
|
}
|
|
54691
54723
|
if (out.success && !out.pages) {
|
|
54692
|
-
const pages =
|
|
54724
|
+
const pages = _chunkEKKZNKJDcjs.blocksToPages.call(void 0, out.blocks, (bs) => _chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([opts, 'optionalAccess', _1363 => _1363.tableFormat]) }));
|
|
54693
54725
|
if (pages) out = { ...out, pages };
|
|
54694
54726
|
}
|
|
54695
54727
|
if (out.success && _optionalChain([opts, 'optionalAccess', _1364 => _1364.plain])) {
|
|
@@ -54740,34 +54772,34 @@ async function dispatch(format2, buffer, opts) {
|
|
|
54740
54772
|
async function withEmbeddedImageOcr(blocks, markdown, warnings, images, options) {
|
|
54741
54773
|
const list = [..._nullishCoalesce(warnings, () => ( []))];
|
|
54742
54774
|
if (!await ocrEmbeddedImages(blocks, options, list)) return { markdown, warnings: list.length ? list : void 0 };
|
|
54743
|
-
let md2 =
|
|
54775
|
+
let md2 = _chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1366 => _1366.tableFormat]) });
|
|
54744
54776
|
if (_optionalChain([options, 'optionalAccess', _1367 => _1367.inlineImages]) && options.images !== false && _optionalChain([images, 'optionalAccess', _1368 => _1368.length])) {
|
|
54745
54777
|
try {
|
|
54746
|
-
md2 =
|
|
54778
|
+
md2 = _chunkEKKZNKJDcjs.inlineImagesIntoMarkdown.call(void 0, md2, images, { compress: true });
|
|
54747
54779
|
} catch (e48) {
|
|
54748
54780
|
}
|
|
54749
54781
|
}
|
|
54750
54782
|
return { markdown: md2, warnings: list.length ? list : void 0 };
|
|
54751
54783
|
}
|
|
54752
54784
|
function scriptsOff(r, off) {
|
|
54753
|
-
return off ?
|
|
54785
|
+
return off ? _chunkMED2MR6Ocjs.stripScriptTags.call(void 0, r) : r;
|
|
54754
54786
|
}
|
|
54755
54787
|
async function parseImage(buffer, options) {
|
|
54756
54788
|
try {
|
|
54757
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
54789
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-OC3TCXMV.cjs")));
|
|
54758
54790
|
const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
|
|
54759
|
-
|
|
54791
|
+
_chunkMED2MR6Ocjs.stripScriptTags.call(void 0, { blocks });
|
|
54760
54792
|
return {
|
|
54761
54793
|
success: true,
|
|
54762
54794
|
fileType: "image",
|
|
54763
|
-
markdown:
|
|
54795
|
+
markdown: _chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1369 => _1369.tableFormat]) }),
|
|
54764
54796
|
blocks,
|
|
54765
54797
|
warnings: warnings.length ? warnings : void 0,
|
|
54766
54798
|
pageCount: 1,
|
|
54767
54799
|
..._optionalChain([options, 'optionalAccess', _1370 => _1370.ocrLines]) ? { ocrLines: lines ? [lines] : [] } : {}
|
|
54768
54800
|
};
|
|
54769
54801
|
} catch (err) {
|
|
54770
|
-
return { success: false, fileType: "image", error:
|
|
54802
|
+
return { success: false, fileType: "image", error: _chunkAUWO57EDcjs.sanitizeError.call(void 0, err), code: _chunkAUWO57EDcjs.classifyError.call(void 0, err) };
|
|
54771
54803
|
}
|
|
54772
54804
|
}
|
|
54773
54805
|
async function parseHwp3(buffer, options) {
|
|
@@ -54775,7 +54807,7 @@ async function parseHwp3(buffer, options) {
|
|
|
54775
54807
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp3Document(buffer, options);
|
|
54776
54808
|
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess', _1371 => _1371.pageCount]) };
|
|
54777
54809
|
} catch (err) {
|
|
54778
|
-
return { success: false, fileType: "hwp3", error:
|
|
54810
|
+
return { success: false, fileType: "hwp3", error: _chunkAUWO57EDcjs.sanitizeError.call(void 0, err), code: _chunkAUWO57EDcjs.classifyError.call(void 0, err) };
|
|
54779
54811
|
}
|
|
54780
54812
|
}
|
|
54781
54813
|
async function parseHwpx(buffer, options) {
|
|
@@ -54785,7 +54817,7 @@ async function parseHwpx(buffer, options) {
|
|
|
54785
54817
|
const { markdown, warnings } = await withEmbeddedImageOcr(blocks, doc.markdown, doc.warnings, void 0, options);
|
|
54786
54818
|
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1372 => _1372.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1373 => _1373.pageCount]) }, _optionalChain([options, 'optionalAccess', _1374 => _1374.scriptTags]) === false);
|
|
54787
54819
|
} catch (err) {
|
|
54788
|
-
return { success: false, fileType: "hwpx", error:
|
|
54820
|
+
return { success: false, fileType: "hwpx", error: _chunkAUWO57EDcjs.sanitizeError.call(void 0, err), code: _chunkAUWO57EDcjs.classifyError.call(void 0, err) };
|
|
54789
54821
|
}
|
|
54790
54822
|
}
|
|
54791
54823
|
async function parseHwp(buffer, options) {
|
|
@@ -54812,13 +54844,13 @@ async function parseHwp(buffer, options) {
|
|
|
54812
54844
|
const ocred = await withEmbeddedImageOcr(blocks, markdown, warnings, images, options);
|
|
54813
54845
|
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess', _1376 => _1376.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1377 => _1377.pageCount]) }, _optionalChain([options, 'optionalAccess', _1378 => _1378.scriptTags]) === false);
|
|
54814
54846
|
} catch (err) {
|
|
54815
|
-
return { success: false, fileType: "hwp", error:
|
|
54847
|
+
return { success: false, fileType: "hwp", error: _chunkAUWO57EDcjs.sanitizeError.call(void 0, err), code: _chunkAUWO57EDcjs.classifyError.call(void 0, err) };
|
|
54816
54848
|
}
|
|
54817
54849
|
}
|
|
54818
54850
|
async function parsePdf(buffer, options) {
|
|
54819
54851
|
let parsePdfDocument;
|
|
54820
54852
|
try {
|
|
54821
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
54853
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-OKAQRZKM.cjs")));
|
|
54822
54854
|
parsePdfDocument = mod.parsePdfDocument;
|
|
54823
54855
|
} catch (e50) {
|
|
54824
54856
|
return {
|
|
@@ -54833,7 +54865,7 @@ async function parsePdf(buffer, options) {
|
|
|
54833
54865
|
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess', _1379 => _1379.pageCount]), ...ocrLines ? { ocrLines } : {} }, _optionalChain([options, 'optionalAccess', _1380 => _1380.scriptTags]) !== true);
|
|
54834
54866
|
} catch (err) {
|
|
54835
54867
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
54836
|
-
return { success: false, fileType: "pdf", error:
|
|
54868
|
+
return { success: false, fileType: "pdf", error: _chunkAUWO57EDcjs.sanitizeError.call(void 0, err), code: _chunkAUWO57EDcjs.classifyError.call(void 0, err), isImageBased };
|
|
54837
54869
|
}
|
|
54838
54870
|
}
|
|
54839
54871
|
async function parseXlsx(buffer, options) {
|
|
@@ -54841,7 +54873,7 @@ async function parseXlsx(buffer, options) {
|
|
|
54841
54873
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
54842
54874
|
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1381 => _1381.pageCount]) };
|
|
54843
54875
|
} catch (err) {
|
|
54844
|
-
return { success: false, fileType: "xlsx", error:
|
|
54876
|
+
return { success: false, fileType: "xlsx", error: _chunkAUWO57EDcjs.sanitizeError.call(void 0, err), code: _chunkAUWO57EDcjs.classifyError.call(void 0, err) };
|
|
54845
54877
|
}
|
|
54846
54878
|
}
|
|
54847
54879
|
async function parseXls(buffer, options) {
|
|
@@ -54849,7 +54881,7 @@ async function parseXls(buffer, options) {
|
|
|
54849
54881
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
54850
54882
|
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1382 => _1382.pageCount]) };
|
|
54851
54883
|
} catch (err) {
|
|
54852
|
-
return { success: false, fileType: "xls", error:
|
|
54884
|
+
return { success: false, fileType: "xls", error: _chunkAUWO57EDcjs.sanitizeError.call(void 0, err), code: _chunkAUWO57EDcjs.classifyError.call(void 0, err) };
|
|
54853
54885
|
}
|
|
54854
54886
|
}
|
|
54855
54887
|
async function parseDocx(buffer, options) {
|
|
@@ -54857,7 +54889,7 @@ async function parseDocx(buffer, options) {
|
|
|
54857
54889
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
54858
54890
|
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1383 => _1383.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1384 => _1384.pageCount]) }, _optionalChain([options, 'optionalAccess', _1385 => _1385.scriptTags]) === false);
|
|
54859
54891
|
} catch (err) {
|
|
54860
|
-
return { success: false, fileType: "docx", error:
|
|
54892
|
+
return { success: false, fileType: "docx", error: _chunkAUWO57EDcjs.sanitizeError.call(void 0, err), code: _chunkAUWO57EDcjs.classifyError.call(void 0, err) };
|
|
54861
54893
|
}
|
|
54862
54894
|
}
|
|
54863
54895
|
async function parsePptx(buffer, options) {
|
|
@@ -54865,7 +54897,7 @@ async function parsePptx(buffer, options) {
|
|
|
54865
54897
|
const { markdown, blocks, metadata, outline, warnings, images } = await parsePptxDocument(buffer, options);
|
|
54866
54898
|
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1386 => _1386.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1387 => _1387.pageCount]) }, _optionalChain([options, 'optionalAccess', _1388 => _1388.scriptTags]) === false);
|
|
54867
54899
|
} catch (err) {
|
|
54868
|
-
return { success: false, fileType: "pptx", error:
|
|
54900
|
+
return { success: false, fileType: "pptx", error: _chunkAUWO57EDcjs.sanitizeError.call(void 0, err), code: _chunkAUWO57EDcjs.classifyError.call(void 0, err) };
|
|
54869
54901
|
}
|
|
54870
54902
|
}
|
|
54871
54903
|
async function parseHwpml(buffer, options) {
|
|
@@ -54873,16 +54905,16 @@ async function parseHwpml(buffer, options) {
|
|
|
54873
54905
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
54874
54906
|
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1389 => _1389.pageCount]) };
|
|
54875
54907
|
} catch (err) {
|
|
54876
|
-
return { success: false, fileType: "hwpml", error:
|
|
54908
|
+
return { success: false, fileType: "hwpml", error: _chunkAUWO57EDcjs.sanitizeError.call(void 0, err), code: _chunkAUWO57EDcjs.classifyError.call(void 0, err) };
|
|
54877
54909
|
}
|
|
54878
54910
|
}
|
|
54879
54911
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
54880
54912
|
let buffer;
|
|
54881
54913
|
if (typeof input === "string") {
|
|
54882
54914
|
const buf = await _promises.readFile.call(void 0, input);
|
|
54883
|
-
buffer =
|
|
54915
|
+
buffer = _chunkAUWO57EDcjs.toArrayBuffer.call(void 0, buf);
|
|
54884
54916
|
} else if (Buffer.isBuffer(input)) {
|
|
54885
|
-
buffer =
|
|
54917
|
+
buffer = _chunkAUWO57EDcjs.toArrayBuffer.call(void 0, input);
|
|
54886
54918
|
} else {
|
|
54887
54919
|
buffer = input;
|
|
54888
54920
|
}
|
|
@@ -54908,7 +54940,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
54908
54940
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
54909
54941
|
}
|
|
54910
54942
|
const fill = fillFormFields(parsed.blocks, values);
|
|
54911
|
-
const markdown =
|
|
54943
|
+
const markdown = _chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
54912
54944
|
if (outputFormat === "hwpx") {
|
|
54913
54945
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
54914
54946
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -55007,5 +55039,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
55007
55039
|
|
|
55008
55040
|
|
|
55009
55041
|
|
|
55010
|
-
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 =
|
|
55042
|
+
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 = _chunkAUWO57EDcjs.VERSION; exports.ValueCursor = ValueCursor; exports.agencyNames = agencyNames; exports.agencyStyle = agencyStyle; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkMED2MR6Ocjs.blocksToMarkdown; exports.blocksToPages = _chunkEKKZNKJDcjs.blocksToPages; exports.blocksToPdf = blocksToPdf; 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 = _chunkMED2MR6Ocjs.flattenLayoutTables; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hasStructuredCellContent = _chunkMED2MR6Ocjs.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.lintGongmunText = lintGongmunText; exports.lintMuncheText = lintMuncheText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.muncheLintWarnings = muncheLintWarnings; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parsePptx = parsePptx; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.readBuiltinTemplate = readBuiltinTemplate; exports.readBuiltinTemplateSample = readBuiltinTemplateSample; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderDocument = renderDocument; exports.renderDocumentToScene = renderDocumentToScene; exports.renderHtml = renderHtml; exports.renderHwp5Pages = renderHwp5Pages; exports.renderHwpxToSvg = renderHwpxToSvg; exports.renderSceneToHtml = renderSceneToHtml; exports.resolveBuiltinTemplate = resolveBuiltinTemplate; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.usesGaejosikMunche = usesGaejosikMunche; exports.validateHwpx = validateHwpx;
|
|
55011
55043
|
//# sourceMappingURL=index.cjs.map
|