kordoc 4.24.1 → 4.24.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 +2 -2
- package/dist/{-TSN4SWFV.js → -SRNEV7LS.js} +11 -11
- package/dist/{chunk-B77K6J3U.js → chunk-3HN65YAL.js} +2 -2
- package/dist/{chunk-SWCO5NP6.js → chunk-4745MFQU.js} +3 -3
- package/dist/{chunk-2SMANR76.js → chunk-4XC4O7FJ.js} +4 -4
- package/dist/{chunk-RS2Q64N5.js → chunk-7NTMM6PO.js} +2 -2
- package/dist/{chunk-4BCQ3FQS.js → chunk-C6ZVB547.js} +11 -11
- package/dist/{chunk-LBPUPT6S.js → chunk-DHMBPMKC.js} +74 -30
- package/dist/chunk-DHMBPMKC.js.map +1 -0
- package/dist/{chunk-LEL5UBGR.js → chunk-E6VBLBOO.js} +2 -2
- package/dist/{chunk-LEUS275C.js → chunk-E7B5CXYI.js} +2 -2
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/{chunk-RIQVVWVF.cjs → chunk-HLTPMSYW.cjs} +3 -3
- package/dist/chunk-HLTPMSYW.cjs.map +1 -0
- package/dist/{chunk-KGOVG47P.cjs → chunk-IGG63DFK.cjs} +3 -3
- package/dist/chunk-IGG63DFK.cjs.map +1 -0
- package/dist/chunk-J55UQC5H.cjs.map +1 -1
- package/dist/{chunk-5QBTJ4LA.cjs → chunk-JFUUFJZW.cjs} +6 -6
- package/dist/chunk-JFUUFJZW.cjs.map +1 -0
- package/dist/{chunk-HP24FYLJ.js → chunk-JMOAMKAR.js} +4 -4
- package/dist/{chunk-W4P3QPSB.js → chunk-KUC5I5MB.js} +2 -2
- package/dist/{chunk-YE4T2P6F.js → chunk-LMEF7FN5.js} +2 -2
- package/dist/{chunk-NAPPGU3W.js → chunk-M46PB75E.js} +2 -2
- package/dist/{chunk-AJ3DJSO6.js → chunk-MHNJOJQV.js} +4 -4
- package/dist/{chunk-5EP6VFP5.js → chunk-NJ5RUDCW.js} +3 -3
- package/dist/{chunk-MI25BZSU.js → chunk-NMFFIUI6.js} +2 -2
- package/dist/{chunk-TYXXTWPH.cjs → chunk-PNSALBXH.cjs} +2 -2
- package/dist/chunk-PNSALBXH.cjs.map +1 -0
- package/dist/{chunk-JSI5T77E.cjs → chunk-PNX5FYHC.cjs} +24 -24
- package/dist/chunk-PNX5FYHC.cjs.map +1 -0
- package/dist/{chunk-V2GW3M2F.js → chunk-R2GIGE5H.js} +2 -2
- package/dist/{chunk-L2OJUIII.js → chunk-RIRPLFPN.js} +2 -2
- package/dist/{chunk-WYYUWBTS.js → chunk-TDMBTG7U.js} +2 -2
- package/dist/chunk-TK3FDAEE.cjs.map +1 -1
- package/dist/{chunk-G7SKCXQG.js → chunk-TW3V6FSH.js} +2 -2
- package/dist/{chunk-4VNIEHWM.cjs → chunk-UNICY546.cjs} +23 -23
- package/dist/chunk-UNICY546.cjs.map +1 -0
- package/dist/{chunk-ZR3BPESP.js → chunk-VPSF5LEM.js} +3 -3
- package/dist/{chunk-6H7D4QTM.js → chunk-W24TJJNN.js} +2 -2
- package/dist/{chunk-BIVO2GMU.js → chunk-WDSTW3BD.js} +2 -2
- package/dist/{chunk-RVKOFZAT.js → chunk-WJAFE3Z6.js} +2 -2
- package/dist/chunks-AL4P5TO5.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-6J26PNHL.js → formula-DSB574H7.js} +4 -4
- package/dist/{formula-5DGAZK6N.cjs → formula-HK2MNZ3Q.cjs} +9 -9
- package/dist/formula-HK2MNZ3Q.cjs.map +1 -0
- package/dist/{formula-PNZX2ZAZ.js → formula-U2LZ67KI.js} +3 -3
- package/dist/{image-ocr-UNTKJLQL.js → image-ocr-3QB2HLSI.js} +9 -9
- package/dist/{image-ocr-RPHNFU7I.js → image-ocr-J54Q3YWP.js} +6 -6
- package/dist/{image-ocr-I4PGBAJ7.cjs → image-ocr-QNIMVE5A.cjs} +17 -17
- package/dist/image-ocr-QNIMVE5A.cjs.map +1 -0
- package/dist/index.cjs +472 -428
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +74 -30
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +23 -23
- package/dist/{model-bundle-ZSDEJFA7.js → model-bundle-CGWU4ALC.js} +5 -5
- package/dist/{models-JS66XYKO.js → models-A3TF3BDV.js} +5 -5
- package/dist/page-range-QHHFTL7X.cjs.map +1 -1
- package/dist/{parse-worker-v2-JHPEY3MI.js → parse-worker-v2-MNUD4WAR.js} +12 -12
- package/dist/{parser-YKATDDQV.js → parser-C3ARF26I.js} +12 -12
- package/dist/{parser-N64TUIWU.js → parser-OBGWEWSU.js} +9 -9
- package/dist/{parser-NMV5GTKC.cjs → parser-RPAHN3OR.cjs} +157 -157
- package/dist/parser-RPAHN3OR.cjs.map +1 -0
- package/dist/{pdf-ocr-KTKR2JQH.js → pdf-ocr-ENLVEEYL.js} +9 -9
- package/dist/pdf-ocr-GA5QJFNK.cjs +31 -0
- package/dist/pdf-ocr-GA5QJFNK.cjs.map +1 -0
- package/dist/{pdf-ocr-W3LDJYCA.js → pdf-ocr-K53REDNY.js} +6 -6
- package/dist/{profile-io-JRODOL7A.js → profile-io-ZGFEO7CB.js} +3 -3
- package/dist/{rasterize-2DMR7RGP.js → rasterize-QMC2SAUT.js} +3 -3
- package/dist/{redact-doc-TC6QSTPM.js → redact-doc-JH6RZZBE.js} +11 -11
- package/dist/{render-WEUU5EDS.js → render-ZGKQLKPJ.js} +7 -7
- package/dist/seal-KMGYTJAV.js +10 -0
- package/dist/{setup-LKJKGMKJ.js → setup-LAQGCYQ2.js} +3 -3
- package/dist/visual-4OYJFGXL.js +21 -0
- package/dist/{watch-HHFVXB3G.js → watch-7YPB4TKC.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-4VNIEHWM.cjs.map +0 -1
- package/dist/chunk-5QBTJ4LA.cjs.map +0 -1
- package/dist/chunk-JSI5T77E.cjs.map +0 -1
- package/dist/chunk-KGOVG47P.cjs.map +0 -1
- package/dist/chunk-LBPUPT6S.js.map +0 -1
- package/dist/chunk-RIQVVWVF.cjs.map +0 -1
- package/dist/chunk-TYXXTWPH.cjs.map +0 -1
- package/dist/chunks-HPPVNSBT.js +0 -10
- package/dist/formula-5DGAZK6N.cjs.map +0 -1
- package/dist/image-ocr-I4PGBAJ7.cjs.map +0 -1
- package/dist/parser-NMV5GTKC.cjs.map +0 -1
- package/dist/pdf-ocr-JXK752RC.cjs +0 -31
- package/dist/pdf-ocr-JXK752RC.cjs.map +0 -1
- package/dist/seal-LSALFURW.js +0 -10
- package/dist/visual-PHZHJRY5.js +0 -21
- /package/dist/{-TSN4SWFV.js.map → -SRNEV7LS.js.map} +0 -0
- /package/dist/{chunk-B77K6J3U.js.map → chunk-3HN65YAL.js.map} +0 -0
- /package/dist/{chunk-SWCO5NP6.js.map → chunk-4745MFQU.js.map} +0 -0
- /package/dist/{chunk-2SMANR76.js.map → chunk-4XC4O7FJ.js.map} +0 -0
- /package/dist/{chunk-RS2Q64N5.js.map → chunk-7NTMM6PO.js.map} +0 -0
- /package/dist/{chunk-4BCQ3FQS.js.map → chunk-C6ZVB547.js.map} +0 -0
- /package/dist/{chunk-LEL5UBGR.js.map → chunk-E6VBLBOO.js.map} +0 -0
- /package/dist/{chunk-LEUS275C.js.map → chunk-E7B5CXYI.js.map} +0 -0
- /package/dist/{chunk-HP24FYLJ.js.map → chunk-JMOAMKAR.js.map} +0 -0
- /package/dist/{chunk-W4P3QPSB.js.map → chunk-KUC5I5MB.js.map} +0 -0
- /package/dist/{chunk-YE4T2P6F.js.map → chunk-LMEF7FN5.js.map} +0 -0
- /package/dist/{chunk-NAPPGU3W.js.map → chunk-M46PB75E.js.map} +0 -0
- /package/dist/{chunk-AJ3DJSO6.js.map → chunk-MHNJOJQV.js.map} +0 -0
- /package/dist/{chunk-5EP6VFP5.js.map → chunk-NJ5RUDCW.js.map} +0 -0
- /package/dist/{chunk-MI25BZSU.js.map → chunk-NMFFIUI6.js.map} +0 -0
- /package/dist/{chunk-V2GW3M2F.js.map → chunk-R2GIGE5H.js.map} +0 -0
- /package/dist/{chunk-L2OJUIII.js.map → chunk-RIRPLFPN.js.map} +0 -0
- /package/dist/{chunk-WYYUWBTS.js.map → chunk-TDMBTG7U.js.map} +0 -0
- /package/dist/{chunk-G7SKCXQG.js.map → chunk-TW3V6FSH.js.map} +0 -0
- /package/dist/{chunk-ZR3BPESP.js.map → chunk-VPSF5LEM.js.map} +0 -0
- /package/dist/{chunk-6H7D4QTM.js.map → chunk-W24TJJNN.js.map} +0 -0
- /package/dist/{chunk-BIVO2GMU.js.map → chunk-WDSTW3BD.js.map} +0 -0
- /package/dist/{chunk-RVKOFZAT.js.map → chunk-WJAFE3Z6.js.map} +0 -0
- /package/dist/{chunks-HPPVNSBT.js.map → chunks-AL4P5TO5.js.map} +0 -0
- /package/dist/{formula-6J26PNHL.js.map → formula-DSB574H7.js.map} +0 -0
- /package/dist/{formula-PNZX2ZAZ.js.map → formula-U2LZ67KI.js.map} +0 -0
- /package/dist/{image-ocr-UNTKJLQL.js.map → image-ocr-3QB2HLSI.js.map} +0 -0
- /package/dist/{image-ocr-RPHNFU7I.js.map → image-ocr-J54Q3YWP.js.map} +0 -0
- /package/dist/{model-bundle-ZSDEJFA7.js.map → model-bundle-CGWU4ALC.js.map} +0 -0
- /package/dist/{models-JS66XYKO.js.map → models-A3TF3BDV.js.map} +0 -0
- /package/dist/{parse-worker-v2-JHPEY3MI.js.map → parse-worker-v2-MNUD4WAR.js.map} +0 -0
- /package/dist/{parser-YKATDDQV.js.map → parser-C3ARF26I.js.map} +0 -0
- /package/dist/{parser-N64TUIWU.js.map → parser-OBGWEWSU.js.map} +0 -0
- /package/dist/{pdf-ocr-KTKR2JQH.js.map → pdf-ocr-ENLVEEYL.js.map} +0 -0
- /package/dist/{pdf-ocr-W3LDJYCA.js.map → pdf-ocr-K53REDNY.js.map} +0 -0
- /package/dist/{profile-io-JRODOL7A.js.map → profile-io-ZGFEO7CB.js.map} +0 -0
- /package/dist/{rasterize-2DMR7RGP.js.map → rasterize-QMC2SAUT.js.map} +0 -0
- /package/dist/{redact-doc-TC6QSTPM.js.map → redact-doc-JH6RZZBE.js.map} +0 -0
- /package/dist/{render-WEUU5EDS.js.map → render-ZGKQLKPJ.js.map} +0 -0
- /package/dist/{seal-LSALFURW.js.map → seal-KMGYTJAV.js.map} +0 -0
- /package/dist/{setup-LKJKGMKJ.js.map → setup-LAQGCYQ2.js.map} +0 -0
- /package/dist/{visual-PHZHJRY5.js.map → visual-4OYJFGXL.js.map} +0 -0
- /package/dist/{watch-HHFVXB3G.js.map → watch-7YPB4TKC.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkIGG63DFKcjs = require('./chunk-IGG63DFK.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
@@ -43,7 +43,7 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
var
|
|
46
|
+
var _chunkJFUUFJZWcjs = require('./chunk-JFUUFJZW.cjs');
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
@@ -61,14 +61,14 @@ var _chunk5QBTJ4LAcjs = require('./chunk-5QBTJ4LA.cjs');
|
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
var
|
|
64
|
+
var _chunkPNSALBXHcjs = require('./chunk-PNSALBXH.cjs');
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
68
68
|
|
|
69
69
|
// src/plain-markdown.ts
|
|
70
70
|
function toPlainMarkdown(md2) {
|
|
71
|
-
return
|
|
71
|
+
return _chunkJFUUFJZWcjs.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();
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// src/html-tables.ts
|
|
@@ -602,9 +602,9 @@ function rawTextContent(node, depth = 0) {
|
|
|
602
602
|
}
|
|
603
603
|
|
|
604
604
|
// src/hwpx/parser-shared.ts
|
|
605
|
-
var MAX_DECOMPRESS_SIZE =
|
|
605
|
+
var MAX_DECOMPRESS_SIZE = _chunkPNSALBXHcjs.unzipLimitBytes.call(void 0, 256 * 1024 * 1024);
|
|
606
606
|
var MAX_ZIP_ENTRIES = 500;
|
|
607
|
-
var ZipBombError = class extends
|
|
607
|
+
var ZipBombError = class extends _chunkPNSALBXHcjs.KordocError {
|
|
608
608
|
constructor(message) {
|
|
609
609
|
super(message);
|
|
610
610
|
this.name = "ZipBombError";
|
|
@@ -654,7 +654,7 @@ function createSectionShared() {
|
|
|
654
654
|
function createXmlParser(warnings) {
|
|
655
655
|
return new (0, _xmldom.DOMParser)({
|
|
656
656
|
onError(level, msg2) {
|
|
657
|
-
if (level === "fatalError") throw new (0,
|
|
657
|
+
if (level === "fatalError") throw new (0, _chunkPNSALBXHcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
658
658
|
_optionalChain([warnings, 'optionalAccess', _5 => _5.push, 'call', _6 => _6({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
659
659
|
}
|
|
660
660
|
});
|
|
@@ -689,13 +689,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
689
689
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
690
690
|
const checksumType = attrOf(inner, "checksum-type");
|
|
691
691
|
if (algorithm !== AES256_CBC) {
|
|
692
|
-
throw new (0,
|
|
692
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
693
693
|
}
|
|
694
694
|
if (startKey !== START_KEY_SHA256) {
|
|
695
|
-
throw new (0,
|
|
695
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
696
696
|
}
|
|
697
697
|
if (!_optionalChain([checksumType, 'optionalAccess', _10 => _10.endsWith, 'call', _11 => _11(CHECKSUM_SHA256_1K)])) {
|
|
698
|
-
throw new (0,
|
|
698
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
699
699
|
}
|
|
700
700
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
701
701
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -703,10 +703,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
703
703
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
704
704
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
705
705
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
706
|
-
throw new (0,
|
|
706
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
707
707
|
}
|
|
708
708
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
709
|
-
throw new (0,
|
|
709
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
710
710
|
}
|
|
711
711
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
712
712
|
}
|
|
@@ -740,12 +740,12 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
740
740
|
for (const entry of entries) {
|
|
741
741
|
const file = zip.file(entry.path);
|
|
742
742
|
if (!file) {
|
|
743
|
-
throw new (0,
|
|
743
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
744
744
|
}
|
|
745
745
|
const raw = await readZipEntry(file, "uint8array", used);
|
|
746
746
|
const plain4 = decryptEntry(Buffer.from(raw.buffer, raw.byteOffset, raw.length), entry, startKey);
|
|
747
747
|
if (!plain4) {
|
|
748
|
-
throw new (0,
|
|
748
|
+
throw new (0, _chunkPNSALBXHcjs.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.");
|
|
749
749
|
}
|
|
750
750
|
used += plain4.length;
|
|
751
751
|
if (used > MAX_DECOMPRESS_SIZE) throw new ZipBombError("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
@@ -811,10 +811,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
811
811
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _12 => _12.total]));
|
|
812
812
|
if (decompressed) {
|
|
813
813
|
decompressed.total += xml.length * 2;
|
|
814
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
814
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkPNSALBXHcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
815
815
|
}
|
|
816
816
|
const parser = createXmlParser();
|
|
817
|
-
const doc = parser.parseFromString(
|
|
817
|
+
const doc = parser.parseFromString(_chunkPNSALBXHcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
818
818
|
if (!doc.documentElement) continue;
|
|
819
819
|
const domDoc = doc;
|
|
820
820
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -1027,9 +1027,9 @@ function detectHwpxHeadings(blocks, styleMap, tocTexts) {
|
|
|
1027
1027
|
let level = 0;
|
|
1028
1028
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _21 => _21.style, 'optionalAccess', _22 => _22.fontSize])) {
|
|
1029
1029
|
const ratio = block.style.fontSize / baseFontSize;
|
|
1030
|
-
if (ratio >=
|
|
1031
|
-
else if (ratio >=
|
|
1032
|
-
else if (ratio >=
|
|
1030
|
+
if (ratio >= _chunkJFUUFJZWcjs.HEADING_RATIO_H1) level = 1;
|
|
1031
|
+
else if (ratio >= _chunkJFUUFJZWcjs.HEADING_RATIO_H2) level = 2;
|
|
1032
|
+
else if (ratio >= _chunkJFUUFJZWcjs.HEADING_RATIO_H3) level = 3;
|
|
1033
1033
|
}
|
|
1034
1034
|
const compactText = text.replace(/\s+/g, "");
|
|
1035
1035
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1643,11 +1643,11 @@ function formatHeadNumber(n, numFormat) {
|
|
|
1643
1643
|
// 서수 시퀀스는 생성기(gongmun.ts)와 단일 소스 (v4.0.5) — 종전 mod-14 순환은
|
|
1644
1644
|
// 15번째 형제를 다시 '가'로 만들어 한글 실렌더(가→하→거→너 단모음 연속)와 어긋났다
|
|
1645
1645
|
case "CIRCLED_DIGIT":
|
|
1646
|
-
return n <= 50 ?
|
|
1646
|
+
return n <= 50 ? _chunkJFUUFJZWcjs.circledNumber.call(void 0, n - 1) : `(${n})`;
|
|
1647
1647
|
case "HANGUL_SYLLABLE":
|
|
1648
|
-
return
|
|
1648
|
+
return _chunkJFUUFJZWcjs.hangulOrdinal.call(void 0, n - 1);
|
|
1649
1649
|
case "CIRCLED_HANGUL_SYLLABLE":
|
|
1650
|
-
return n <= 14 ?
|
|
1650
|
+
return n <= 14 ? _chunkJFUUFJZWcjs.circledHangul.call(void 0, n - 1) : _chunkJFUUFJZWcjs.hangulOrdinal.call(void 0, n - 1);
|
|
1651
1651
|
case "HANGUL_JAMO":
|
|
1652
1652
|
return HANGUL_JAMO_SEQ[(n - 1) % HANGUL_JAMO_SEQ.length];
|
|
1653
1653
|
case "CIRCLED_HANGUL_JAMO":
|
|
@@ -1661,9 +1661,9 @@ function formatHeadNumber(n, numFormat) {
|
|
|
1661
1661
|
case "CIRCLED_LATIN_SMALL":
|
|
1662
1662
|
return n <= 26 ? String.fromCodePoint(9424 + n - 1) : String.fromCharCode(97 + (n - 1) % 26);
|
|
1663
1663
|
case "ROMAN_CAPITAL":
|
|
1664
|
-
return
|
|
1664
|
+
return _chunkJFUUFJZWcjs.romanNumeral.call(void 0, n, true);
|
|
1665
1665
|
case "ROMAN_SMALL":
|
|
1666
|
-
return
|
|
1666
|
+
return _chunkJFUUFJZWcjs.romanNumeral.call(void 0, n, false);
|
|
1667
1667
|
default:
|
|
1668
1668
|
return String(n);
|
|
1669
1669
|
}
|
|
@@ -1711,7 +1711,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1711
1711
|
|
|
1712
1712
|
// src/hwpx/table-build.ts
|
|
1713
1713
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1714
|
-
const table2 =
|
|
1714
|
+
const table2 = _chunkJFUUFJZWcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1715
1715
|
if (state.caption) table2.caption = state.caption;
|
|
1716
1716
|
if (state.sourceId) table2.sourceId = state.sourceId;
|
|
1717
1717
|
if (_optionalChain([state, 'access', _32 => _32.captionBlocks, 'optionalAccess', _33 => _33.length])) table2.captionBlocks = state.captionBlocks;
|
|
@@ -1740,7 +1740,7 @@ function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraph
|
|
|
1740
1740
|
for (const src of row) {
|
|
1741
1741
|
if (!src.edges || src.rowAddr === void 0 || src.colAddr === void 0) continue;
|
|
1742
1742
|
const cand = _optionalChain([table2, 'access', _37 => _37.cells, 'access', _38 => _38[src.rowAddr], 'optionalAccess', _39 => _39[src.colAddr]]);
|
|
1743
|
-
if (cand && anchors2.includes(cand))
|
|
1743
|
+
if (cand && anchors2.includes(cand)) _chunkJFUUFJZWcjs.CELL_EDGES.set(cand, src.edges);
|
|
1744
1744
|
}
|
|
1745
1745
|
}
|
|
1746
1746
|
const claimed = /* @__PURE__ */ new Set();
|
|
@@ -1790,7 +1790,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1790
1790
|
const cell2 = parentTable.cell;
|
|
1791
1791
|
(cell2.blocks ??= []).push(block);
|
|
1792
1792
|
cell2.hasStructure = true;
|
|
1793
|
-
let flat =
|
|
1793
|
+
let flat = _chunkJFUUFJZWcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1794
1794
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1795
1795
|
if (flat) {
|
|
1796
1796
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -2024,7 +2024,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2024
2024
|
const tkids = rc.childNodes;
|
|
2025
2025
|
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _47 => _47.length]), () => ( 0))); k++) {
|
|
2026
2026
|
const tk = tkids[k];
|
|
2027
|
-
if (tk.nodeType === 3 || tk.nodeType === 4) text +=
|
|
2027
|
+
if (tk.nodeType === 3 || tk.nodeType === 4) text += _chunkJFUUFJZWcjs.escapeLiteralTags.call(void 0, _chunkJFUUFJZWcjs.escapeLiteralDollar.call(void 0, tk.textContent || ""));
|
|
2028
2028
|
else if (tk.nodeType === 1) {
|
|
2029
2029
|
const ttag = (tk.tagName || tk.localName || "").replace(/^[^:]+:/, "");
|
|
2030
2030
|
if (ttag === "tab" || ttag === "fwSpace" || ttag === "hwSpace" || ttag === "nbSpace") text += " ";
|
|
@@ -2044,7 +2044,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2044
2044
|
const span2 = { text };
|
|
2045
2045
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span2.code = true;
|
|
2046
2046
|
else {
|
|
2047
|
-
if (_optionalChain([cp, 'optionalAccess', _48 => _48.script])) span2.text =
|
|
2047
|
+
if (_optionalChain([cp, 'optionalAccess', _48 => _48.script])) span2.text = _chunkJFUUFJZWcjs.wrapScript.call(void 0, text, cp.script);
|
|
2048
2048
|
if (_optionalChain([cp, 'optionalAccess', _49 => _49.bold])) span2.bold = true;
|
|
2049
2049
|
if (_optionalChain([cp, 'optionalAccess', _50 => _50.italic])) span2.italic = true;
|
|
2050
2050
|
if (_optionalChain([cp, 'optionalAccess', _51 => _51.strike])) span2.strike = true;
|
|
@@ -2064,7 +2064,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2064
2064
|
}
|
|
2065
2065
|
}
|
|
2066
2066
|
if (requireMixed && !merged.some((s) => s.strike || s.underline) && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
|
|
2067
|
-
for (const s of merged) s.text =
|
|
2067
|
+
for (const s of merged) s.text = _chunkJFUUFJZWcjs.tidyScriptTags.call(void 0, s.text);
|
|
2068
2068
|
return merged;
|
|
2069
2069
|
}
|
|
2070
2070
|
function gongmunDepthFromIndent(para2, left, ctx) {
|
|
@@ -2091,7 +2091,7 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2091
2091
|
// src/hwpx/section-walker.ts
|
|
2092
2092
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
2093
2093
|
const parser = createXmlParser(warnings);
|
|
2094
|
-
const doc = parser.parseFromString(
|
|
2094
|
+
const doc = parser.parseFromString(_chunkPNSALBXHcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
2095
2095
|
if (!doc.documentElement) return [];
|
|
2096
2096
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
2097
2097
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -2192,8 +2192,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2192
2192
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
2193
2193
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
2194
2194
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
2195
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
2196
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
2195
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunkJFUUFJZWcjs.MAX_COLS);
|
|
2196
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkJFUUFJZWcjs.MAX_ROWS);
|
|
2197
2197
|
}
|
|
2198
2198
|
break;
|
|
2199
2199
|
case "p": {
|
|
@@ -2516,7 +2516,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
2516
2516
|
const sink = [];
|
|
2517
2517
|
const st = { rows: [], currentRow: [], cell: null, sourceId: _nullishCoalesce(el.getAttribute("id"), () => ( void 0)) };
|
|
2518
2518
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2519
|
-
let flat =
|
|
2519
|
+
let flat = _chunkJFUUFJZWcjs.convertTableToText.call(void 0, st.rows);
|
|
2520
2520
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2521
2521
|
const built = [];
|
|
2522
2522
|
completeTable(st, [], built, ctx);
|
|
@@ -2680,7 +2680,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2680
2680
|
let url = (ch.textContent || "").trim();
|
|
2681
2681
|
if (!url) continue;
|
|
2682
2682
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2683
|
-
const safe =
|
|
2683
|
+
const safe = _chunkPNSALBXHcjs.sanitizeHref.call(void 0, url);
|
|
2684
2684
|
if (safe) return safe;
|
|
2685
2685
|
}
|
|
2686
2686
|
return void 0;
|
|
@@ -2836,7 +2836,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2836
2836
|
_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" })]);
|
|
2837
2837
|
}
|
|
2838
2838
|
} else {
|
|
2839
|
-
text +=
|
|
2839
|
+
text += _chunkJFUUFJZWcjs.escapeLiteralTags.call(void 0, _chunkJFUUFJZWcjs.escapeLiteralDollar.call(void 0, t.replace(/\x1E/g, "")));
|
|
2840
2840
|
}
|
|
2841
2841
|
continue;
|
|
2842
2842
|
}
|
|
@@ -2881,7 +2881,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2881
2881
|
break;
|
|
2882
2882
|
// 글자 겹치기 — 겹친 글은 composeText 속성에 있어 종전엔 통째로 빠졌다(법령 서식 원 번호 ⑯·⑰, 시험지 네모 번호 10)
|
|
2883
2883
|
case "compose":
|
|
2884
|
-
if (!isInDeletedRange(ctx)) text +=
|
|
2884
|
+
if (!isInDeletedRange(ctx)) text += _chunkJFUUFJZWcjs.escapeLiteralTags.call(void 0, _chunkJFUUFJZWcjs.escapeLiteralDollar.call(void 0, _chunkJFUUFJZWcjs.composeText.call(void 0, _nullishCoalesce(child.getAttribute("composeText"), () => ( "")), (_nullishCoalesce(child.getAttribute("circleType"), () => ( "CHAR"))) !== "CHAR")));
|
|
2885
2885
|
break;
|
|
2886
2886
|
// 양식 선택 상자·라디오 단추 — 한컴이 그리는 상자 기호와 캡션 글 (종전엔 통째로 빠졌다: form-002 "원천기술형"·서울 결재 "부분공개")
|
|
2887
2887
|
// 지운 구간의 양식 단추·수식은 글처럼 내지 않는다 (최종본)
|
|
@@ -2893,7 +2893,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2893
2893
|
case "hyperlink": {
|
|
2894
2894
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2895
2895
|
if (url) {
|
|
2896
|
-
const safe =
|
|
2896
|
+
const safe = _chunkPNSALBXHcjs.sanitizeHref.call(void 0, url);
|
|
2897
2897
|
if (safe) href = safe;
|
|
2898
2898
|
}
|
|
2899
2899
|
walk(child, depth + 1);
|
|
@@ -2987,7 +2987,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2987
2987
|
walk(child, depth + 1);
|
|
2988
2988
|
if (script && linkRanges.length === nLinks && openFields.length === nOpen && runHasOnlyText(child)) {
|
|
2989
2989
|
const added = text.slice(start);
|
|
2990
|
-
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) +
|
|
2990
|
+
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) + _chunkJFUUFJZWcjs.wrapScript.call(void 0, added, script);
|
|
2991
2991
|
}
|
|
2992
2992
|
break;
|
|
2993
2993
|
}
|
|
@@ -3010,7 +3010,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
3010
3010
|
}
|
|
3011
3011
|
if (applied.length) href = void 0;
|
|
3012
3012
|
}
|
|
3013
|
-
text =
|
|
3013
|
+
text = _chunkJFUUFJZWcjs.tidyScriptTags.call(void 0, text);
|
|
3014
3014
|
const toc = takeTocLeaders(text);
|
|
3015
3015
|
text = toc.text;
|
|
3016
3016
|
const tocEntry = toc.tocEntry;
|
|
@@ -3125,7 +3125,7 @@ function decompressStream(data) {
|
|
|
3125
3125
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
3126
3126
|
}
|
|
3127
3127
|
function parseFileHeader(data) {
|
|
3128
|
-
if (data.length < 40) throw new (0,
|
|
3128
|
+
if (data.length < 40) throw new (0, _chunkPNSALBXHcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
3129
3129
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
3130
3130
|
return {
|
|
3131
3131
|
signature: sig,
|
|
@@ -3652,13 +3652,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3652
3652
|
}
|
|
3653
3653
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3654
3654
|
for (const path of allCandidates) {
|
|
3655
|
-
if (
|
|
3655
|
+
if (_chunkPNSALBXHcjs.isPathTraversal.call(void 0, path)) continue;
|
|
3656
3656
|
const file = zip.file(path);
|
|
3657
3657
|
if (!file) continue;
|
|
3658
3658
|
try {
|
|
3659
3659
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3660
3660
|
decompressed.total += data.length;
|
|
3661
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3661
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkPNSALBXHcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3662
3662
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3663
3663
|
const extMime = imageExtToMime(ext);
|
|
3664
3664
|
const mimeType = extMime === "image/svg+xml" && /<script|\son[a-z]+\s*=|javascript:|<foreignObject/i.test(Buffer.from(data).toString("utf8")) ? "application/octet-stream" : extMime;
|
|
@@ -3669,7 +3669,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3669
3669
|
usedPaths.add(path);
|
|
3670
3670
|
break;
|
|
3671
3671
|
} catch (err) {
|
|
3672
|
-
if (err instanceof
|
|
3672
|
+
if (err instanceof _chunkPNSALBXHcjs.KordocError) throw err;
|
|
3673
3673
|
}
|
|
3674
3674
|
}
|
|
3675
3675
|
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" })]);
|
|
@@ -3689,13 +3689,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3689
3689
|
if (sweepUnreferenced) {
|
|
3690
3690
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3691
3691
|
for (const file of binEntries) {
|
|
3692
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3692
|
+
if (file.dir || usedPaths.has(file.name) || _chunkPNSALBXHcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3693
3693
|
const basename = file.name.slice(file.name.lastIndexOf("/") + 1);
|
|
3694
3694
|
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;
|
|
3695
3695
|
try {
|
|
3696
3696
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3697
3697
|
decompressed.total += data.length;
|
|
3698
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3698
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkPNSALBXHcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3699
3699
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3700
3700
|
let mimeType = imageExtToMime(ext);
|
|
3701
3701
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3709,7 +3709,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3709
3709
|
images.push(img);
|
|
3710
3710
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3711
3711
|
} catch (err) {
|
|
3712
|
-
if (err instanceof
|
|
3712
|
+
if (err instanceof _chunkPNSALBXHcjs.KordocError) throw err;
|
|
3713
3713
|
_optionalChain([warnings, 'optionalAccess', _138 => _138.push, 'call', _139 => _139({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3714
3714
|
}
|
|
3715
3715
|
}
|
|
@@ -3760,7 +3760,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3760
3760
|
}
|
|
3761
3761
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3762
3762
|
const name = new TextDecoder().decode(nameBytes);
|
|
3763
|
-
if (
|
|
3763
|
+
if (_chunkPNSALBXHcjs.isPathTraversal.call(void 0, name)) {
|
|
3764
3764
|
pos = fileStart + compSize;
|
|
3765
3765
|
continue;
|
|
3766
3766
|
}
|
|
@@ -3778,7 +3778,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3778
3778
|
continue;
|
|
3779
3779
|
}
|
|
3780
3780
|
totalDecompressed += content.length * 2;
|
|
3781
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3781
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkPNSALBXHcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3782
3782
|
sectionNum++;
|
|
3783
3783
|
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3784
3784
|
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
@@ -3787,9 +3787,9 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3787
3787
|
continue;
|
|
3788
3788
|
}
|
|
3789
3789
|
}
|
|
3790
|
-
if (blocks.length === 0) throw new (0,
|
|
3790
|
+
if (blocks.length === 0) throw new (0, _chunkPNSALBXHcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3791
3791
|
applyPageText(blocks, shared);
|
|
3792
|
-
const markdown =
|
|
3792
|
+
const markdown = _chunkJFUUFJZWcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _140 => _140.tableFormat]) });
|
|
3793
3793
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3794
3794
|
}
|
|
3795
3795
|
async function readKordocLayout(zip) {
|
|
@@ -3814,11 +3814,11 @@ async function resolveSectionPaths(zip) {
|
|
|
3814
3814
|
if (paths.length > 0) return paths;
|
|
3815
3815
|
}
|
|
3816
3816
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3817
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3817
|
+
return sectionFiles.map((f) => f.name).sort(_chunkPNSALBXHcjs.compareSectionPaths);
|
|
3818
3818
|
}
|
|
3819
3819
|
function parseSectionPathsFromManifest(xml) {
|
|
3820
3820
|
const parser = createXmlParser();
|
|
3821
|
-
const doc = parser.parseFromString(
|
|
3821
|
+
const doc = parser.parseFromString(_chunkPNSALBXHcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3822
3822
|
const opf = "http://www.idpf.org/2007/opf/";
|
|
3823
3823
|
const namespacedItems = doc.getElementsByTagNameNS(opf, "item");
|
|
3824
3824
|
const namespacedSpine = doc.getElementsByTagNameNS(opf, "itemref");
|
|
@@ -3828,7 +3828,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3828
3828
|
for (let i = 0; i < items.length; i++) {
|
|
3829
3829
|
const item = items[i];
|
|
3830
3830
|
const id = item.getAttribute("id") || "";
|
|
3831
|
-
const href =
|
|
3831
|
+
const href = _chunkPNSALBXHcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3832
3832
|
if (id && href) idToHref.set(id, href);
|
|
3833
3833
|
}
|
|
3834
3834
|
if (spine.length > 0) {
|
|
@@ -3839,7 +3839,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3839
3839
|
}
|
|
3840
3840
|
if (ordered.length > 0) return ordered;
|
|
3841
3841
|
}
|
|
3842
|
-
return Array.from(idToHref.values()).sort(
|
|
3842
|
+
return Array.from(idToHref.values()).sort(_chunkPNSALBXHcjs.compareSectionPaths);
|
|
3843
3843
|
}
|
|
3844
3844
|
|
|
3845
3845
|
// src/hwpx/metadata.ts
|
|
@@ -3851,7 +3851,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3851
3851
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _144 => _144.total]));
|
|
3852
3852
|
if (decompressed) {
|
|
3853
3853
|
decompressed.total += xml.length * 2;
|
|
3854
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3854
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkPNSALBXHcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3855
3855
|
}
|
|
3856
3856
|
return xml;
|
|
3857
3857
|
};
|
|
@@ -3873,7 +3873,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3873
3873
|
}
|
|
3874
3874
|
}
|
|
3875
3875
|
function parseOpfMetadata(xml, metadata) {
|
|
3876
|
-
const root = createXmlParser().parseFromString(
|
|
3876
|
+
const root = createXmlParser().parseFromString(_chunkPNSALBXHcjs.stripDtd.call(void 0, xml), "text/xml").documentElement;
|
|
3877
3877
|
const md2 = root ? findChildByLocalName(root, "metadata") : null;
|
|
3878
3878
|
if (!md2) return;
|
|
3879
3879
|
let title;
|
|
@@ -3906,7 +3906,7 @@ function isoDate(s) {
|
|
|
3906
3906
|
}
|
|
3907
3907
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3908
3908
|
const parser = createXmlParser();
|
|
3909
|
-
const doc = parser.parseFromString(
|
|
3909
|
+
const doc = parser.parseFromString(_chunkPNSALBXHcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3910
3910
|
if (!doc.documentElement) return;
|
|
3911
3911
|
const getText = (tagNames) => {
|
|
3912
3912
|
for (const tag of tagNames) {
|
|
@@ -3945,7 +3945,7 @@ function assignSectionPage(block, sectionNum) {
|
|
|
3945
3945
|
}
|
|
3946
3946
|
}
|
|
3947
3947
|
async function parseHwpxDocument(buffer, options) {
|
|
3948
|
-
|
|
3948
|
+
_chunkPNSALBXHcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3949
3949
|
let zip;
|
|
3950
3950
|
try {
|
|
3951
3951
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3954,7 +3954,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3954
3954
|
}
|
|
3955
3955
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3956
3956
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3957
|
-
throw new (0,
|
|
3957
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3958
3958
|
}
|
|
3959
3959
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3960
3960
|
if (manifestFile) {
|
|
@@ -3974,7 +3974,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3974
3974
|
}
|
|
3975
3975
|
const hpfFile = zip.file("Contents/content.hpf");
|
|
3976
3976
|
const hpf = hpfFile ? await readZipEntry(hpfFile, "text").catch(() => "") : "";
|
|
3977
|
-
throw new (0,
|
|
3977
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(
|
|
3978
3978
|
/\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."
|
|
3979
3979
|
);
|
|
3980
3980
|
}
|
|
@@ -3986,7 +3986,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3986
3986
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3987
3987
|
const warnings = [];
|
|
3988
3988
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3989
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3989
|
+
if (sectionPaths.length === 0) throw new (0, _chunkPNSALBXHcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3990
3990
|
let allBlocks = [];
|
|
3991
3991
|
const shared = createSectionShared();
|
|
3992
3992
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
@@ -4030,10 +4030,10 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4030
4030
|
const blocks = allBlocks;
|
|
4031
4031
|
applyPageText(blocks, shared);
|
|
4032
4032
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _173 => _173.pages]), shared.track.deletedImageRefs);
|
|
4033
|
-
const shown = _optionalChain([options, 'optionalAccess', _174 => _174.layoutTables]) === "keep" ? blocks :
|
|
4033
|
+
const shown = _optionalChain([options, 'optionalAccess', _174 => _174.layoutTables]) === "keep" ? blocks : _chunkJFUUFJZWcjs.unframeLayoutTables.call(void 0, blocks, !!_optionalChain([options, 'optionalAccess', _175 => _175.keepTrailingEmptyCols]));
|
|
4034
4034
|
detectHwpxHeadings(shown, styleMap, shared.tocTexts);
|
|
4035
4035
|
const outline = shown.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4036
|
-
const markdown =
|
|
4036
|
+
const markdown = _chunkJFUUFJZWcjs.blocksToMarkdown.call(void 0, shown, { tableFormat: _optionalChain([options, 'optionalAccess', _176 => _176.tableFormat]) });
|
|
4037
4037
|
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 };
|
|
4038
4038
|
}
|
|
4039
4039
|
|
|
@@ -4800,7 +4800,7 @@ function decryptPasswordStream(raw, password) {
|
|
|
4800
4800
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4801
4801
|
var TAG_ID_MAPPINGS2 = 17;
|
|
4802
4802
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4803
|
-
const wrong = () => new (0,
|
|
4803
|
+
const wrong = () => new (0, _chunkPNSALBXHcjs.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.");
|
|
4804
4804
|
let records;
|
|
4805
4805
|
try {
|
|
4806
4806
|
records = readRecords3(data);
|
|
@@ -4812,7 +4812,7 @@ function assertDecryptedDocInfo(data, readRecords3) {
|
|
|
4812
4812
|
}
|
|
4813
4813
|
function assertSupportedEncryptVersion(version) {
|
|
4814
4814
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4815
|
-
throw new (0,
|
|
4815
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(
|
|
4816
4816
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4817
4817
|
);
|
|
4818
4818
|
}
|
|
@@ -5061,19 +5061,19 @@ var HANJA_UNITS = ["", "\u5341", "\u767E", "\u5343", "\u842C"];
|
|
|
5061
5061
|
function formatNumber(n, fmt2) {
|
|
5062
5062
|
switch (fmt2) {
|
|
5063
5063
|
case "circled":
|
|
5064
|
-
return n >= 1 ?
|
|
5064
|
+
return n >= 1 ? _chunkJFUUFJZWcjs.circledNumber.call(void 0, n - 1) : String(n);
|
|
5065
5065
|
case "romanUpper":
|
|
5066
|
-
return
|
|
5066
|
+
return _chunkJFUUFJZWcjs.romanNumeral.call(void 0, n, true);
|
|
5067
5067
|
case "romanLower":
|
|
5068
|
-
return
|
|
5068
|
+
return _chunkJFUUFJZWcjs.romanNumeral.call(void 0, n, false);
|
|
5069
5069
|
case "latinUpper":
|
|
5070
5070
|
return formatLatin(n, true) || String(n);
|
|
5071
5071
|
case "latinLower":
|
|
5072
5072
|
return formatLatin(n, false) || String(n);
|
|
5073
5073
|
case "ganada":
|
|
5074
|
-
return n >= 1 ?
|
|
5074
|
+
return n >= 1 ? _chunkJFUUFJZWcjs.hangulOrdinal.call(void 0, n - 1) : String(n);
|
|
5075
5075
|
case "circledGanada":
|
|
5076
|
-
return n >= 1 ?
|
|
5076
|
+
return n >= 1 ? _chunkJFUUFJZWcjs.circledHangul.call(void 0, n - 1) : String(n);
|
|
5077
5077
|
case "jamo":
|
|
5078
5078
|
return fromTable(n, JAMO);
|
|
5079
5079
|
case "circledJamo":
|
|
@@ -5255,7 +5255,7 @@ function emitParagraphBlocks(p) {
|
|
|
5255
5255
|
return blocks;
|
|
5256
5256
|
}
|
|
5257
5257
|
function tableFlatText(table2) {
|
|
5258
|
-
const flat =
|
|
5258
|
+
const flat = _chunkJFUUFJZWcjs.convertTableToText.call(void 0, table2.cells);
|
|
5259
5259
|
return table2.caption ? table2.caption + (flat ? "\n" + flat : "") : flat;
|
|
5260
5260
|
}
|
|
5261
5261
|
function blocksPlainText(blocks, sep) {
|
|
@@ -5336,8 +5336,8 @@ ${cell2.text}` : cell2.text;
|
|
|
5336
5336
|
}
|
|
5337
5337
|
function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
5338
5338
|
for (const c of cells) {
|
|
5339
|
-
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1,
|
|
5340
|
-
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1,
|
|
5339
|
+
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1, _chunkJFUUFJZWcjs.MAX_ROWS));
|
|
5340
|
+
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1, _chunkJFUUFJZWcjs.MAX_COLS));
|
|
5341
5341
|
}
|
|
5342
5342
|
const placed = resolveCellOverlaps(cells, rows, cols);
|
|
5343
5343
|
const byRow = Array.from({ length: rows }, () => []);
|
|
@@ -5345,12 +5345,12 @@ function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
|
5345
5345
|
const r = _nullishCoalesce(c.rowAddr, () => ( 0));
|
|
5346
5346
|
if (r < rows && (_nullishCoalesce(c.colAddr, () => ( 0))) < cols) byRow[r].push(c);
|
|
5347
5347
|
}
|
|
5348
|
-
const table2 =
|
|
5348
|
+
const table2 = _chunkJFUUFJZWcjs.buildTable.call(void 0, byRow, { keepAnchoredEmptyCols });
|
|
5349
5349
|
if (table2.rows === 0) return null;
|
|
5350
5350
|
for (const c of placed) {
|
|
5351
5351
|
if (c.edges) {
|
|
5352
5352
|
const at = _optionalChain([table2, 'access', _183 => _183.cells, 'access', _184 => _184[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _185 => _185[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
5353
|
-
if (at)
|
|
5353
|
+
if (at) _chunkJFUUFJZWcjs.CELL_EDGES.set(at, c.edges);
|
|
5354
5354
|
}
|
|
5355
5355
|
if (!_optionalChain([c, 'access', _186 => _186.blocks, 'optionalAccess', _187 => _187.length]) && !c.isHeader) continue;
|
|
5356
5356
|
const target = _optionalChain([table2, 'access', _188 => _188.cells, 'access', _189 => _189[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _190 => _190[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
@@ -5552,7 +5552,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5552
5552
|
continue;
|
|
5553
5553
|
}
|
|
5554
5554
|
if (!ctrl.href) continue;
|
|
5555
|
-
const href =
|
|
5555
|
+
const href = _chunkPNSALBXHcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5556
5556
|
if (!href) continue;
|
|
5557
5557
|
if (!anchor.trim() || anchor.includes(INLINE_TABLE_MARK)) continue;
|
|
5558
5558
|
text = text.slice(0, r.start) + `[${anchor}](${href})` + text.slice(r.end);
|
|
@@ -5561,7 +5561,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5561
5561
|
}
|
|
5562
5562
|
if (text.includes(LITERAL_DOLLAR_MARK)) text = text.replaceAll(LITERAL_DOLLAR_MARK, "\\$");
|
|
5563
5563
|
text = resolveLiteralLt(text);
|
|
5564
|
-
text =
|
|
5564
|
+
text = _chunkJFUUFJZWcjs.tidyScriptTags.call(void 0, text);
|
|
5565
5565
|
const toc = takeTocLeaders(text);
|
|
5566
5566
|
text = toc.text;
|
|
5567
5567
|
let headingLevel = 0;
|
|
@@ -5668,7 +5668,7 @@ function applyCtrlEffect(ctrl, records, ctx) {
|
|
|
5668
5668
|
// 글자 겹침 — ctrl id 뒤 글자 수(WORD)·겹친 글자(WCHAR[n])·테두리 종류(BYTE, 0 = 없음). 종전엔 건너뛰어 법령 서식 원 번호(⑯·⑰)가 빠졌다
|
|
5669
5669
|
case CTRL_TCPS: {
|
|
5670
5670
|
const d = ctrl.data, n = d.length >= 6 ? d.readUInt16LE(4) : 0;
|
|
5671
|
-
if (n > 0 && d.length >= 6 + 2 * n) ctrl.inlineText =
|
|
5671
|
+
if (n > 0 && d.length >= 6 + 2 * n) ctrl.inlineText = _chunkJFUUFJZWcjs.composeText.call(void 0, d.toString("utf16le", 6, 6 + 2 * n), (_nullishCoalesce(d[6 + 2 * n], () => ( 0))) !== 0);
|
|
5672
5672
|
return;
|
|
5673
5673
|
}
|
|
5674
5674
|
// 숨은 설명/단 정의/쪽번호 위치/감추기/찾아보기/책갈피/덧말 — 본문 텍스트 없음 또는 의도적 스킵
|
|
@@ -5786,7 +5786,7 @@ function hyperlinkUrlFromCommand(command) {
|
|
|
5786
5786
|
}
|
|
5787
5787
|
var A4_HEIGHT = 84188;
|
|
5788
5788
|
function keepUnlessPageSpanning(table2, cells) {
|
|
5789
|
-
if (!cells.some((c) => c.pageSpanning))
|
|
5789
|
+
if (!cells.some((c) => c.pageSpanning)) _chunkJFUUFJZWcjs.markNonLayoutTable.call(void 0, table2);
|
|
5790
5790
|
}
|
|
5791
5791
|
function parseTableControl(ctrl, records, ctx) {
|
|
5792
5792
|
if (ctx.depth >= MAX_NEST_DEPTH) return null;
|
|
@@ -5798,8 +5798,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5798
5798
|
let tableIdx = -1;
|
|
5799
5799
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5800
5800
|
if (records[i2].tagId === TAG_TABLE && records[i2].level === directLevel && records[i2].data.length >= 8) {
|
|
5801
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5802
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5801
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkJFUUFJZWcjs.MAX_ROWS);
|
|
5802
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkJFUUFJZWcjs.MAX_COLS);
|
|
5803
5803
|
tableIdx = i2;
|
|
5804
5804
|
break;
|
|
5805
5805
|
}
|
|
@@ -5843,11 +5843,11 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5843
5843
|
return table3;
|
|
5844
5844
|
}
|
|
5845
5845
|
if (rows === 0 || cols === 0) {
|
|
5846
|
-
rows = Math.min(cells.length,
|
|
5846
|
+
rows = Math.min(cells.length, _chunkJFUUFJZWcjs.MAX_ROWS);
|
|
5847
5847
|
cols = 1;
|
|
5848
5848
|
}
|
|
5849
5849
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5850
|
-
const table2 =
|
|
5850
|
+
const table2 = _chunkJFUUFJZWcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5851
5851
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5852
5852
|
if (sourceId && table2.rows > 0) table2.sourceId = sourceId;
|
|
5853
5853
|
keepUnlessPageSpanning(table2, cells);
|
|
@@ -5866,8 +5866,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5866
5866
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5867
5867
|
const cs = rec.data.readUInt16LE(12);
|
|
5868
5868
|
const rs = rec.data.readUInt16LE(14);
|
|
5869
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5870
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5869
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkJFUUFJZWcjs.MAX_COLS);
|
|
5870
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkJFUUFJZWcjs.MAX_ROWS);
|
|
5871
5871
|
}
|
|
5872
5872
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5873
5873
|
const { text, hasStructure } = cellTextFromBlocks(blocks);
|
|
@@ -6016,7 +6016,7 @@ function openHwp5Container(buffer, options) {
|
|
|
6016
6016
|
lenientCfb = parseLenientCfb(buffer);
|
|
6017
6017
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
6018
6018
|
} catch (e24) {
|
|
6019
|
-
throw new (0,
|
|
6019
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
6020
6020
|
}
|
|
6021
6021
|
}
|
|
6022
6022
|
const readRawStream = (path) => {
|
|
@@ -6027,14 +6027,14 @@ function openHwp5Container(buffer, options) {
|
|
|
6027
6027
|
return lenientCfb.findStream(path);
|
|
6028
6028
|
};
|
|
6029
6029
|
const headerData = readRawStream("/FileHeader");
|
|
6030
|
-
if (!headerData) throw new (0,
|
|
6030
|
+
if (!headerData) throw new (0, _chunkPNSALBXHcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6031
6031
|
const header = parseFileHeader(headerData);
|
|
6032
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
6033
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
6032
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkPNSALBXHcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
6033
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkPNSALBXHcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
6034
6034
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
6035
6035
|
if (encrypted) {
|
|
6036
6036
|
if (!_optionalChain([options, 'optionalAccess', _214 => _214.password])) {
|
|
6037
|
-
throw new (0,
|
|
6037
|
+
throw new (0, _chunkPNSALBXHcjs.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.");
|
|
6038
6038
|
}
|
|
6039
6039
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
6040
6040
|
}
|
|
@@ -6048,12 +6048,12 @@ function openHwp5Container(buffer, options) {
|
|
|
6048
6048
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
6049
6049
|
if (encrypted) {
|
|
6050
6050
|
const rawDocInfo = findStream("/DocInfo");
|
|
6051
|
-
if (!rawDocInfo) throw new (0,
|
|
6051
|
+
if (!rawDocInfo) throw new (0, _chunkPNSALBXHcjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6052
6052
|
let docInfoData;
|
|
6053
6053
|
try {
|
|
6054
6054
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
6055
6055
|
} catch (e25) {
|
|
6056
|
-
throw new (0,
|
|
6056
|
+
throw new (0, _chunkPNSALBXHcjs.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.");
|
|
6057
6057
|
}
|
|
6058
6058
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
6059
6059
|
}
|
|
@@ -6078,10 +6078,10 @@ function readHwp5SectionRecords(c, sections, warnings) {
|
|
|
6078
6078
|
try {
|
|
6079
6079
|
const data = !c.distribution && c.compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
6080
6080
|
totalDecompressed += data.length;
|
|
6081
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6081
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkPNSALBXHcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6082
6082
|
out.push(readRecords(data));
|
|
6083
6083
|
} catch (secErr) {
|
|
6084
|
-
if (secErr instanceof
|
|
6084
|
+
if (secErr instanceof _chunkPNSALBXHcjs.KordocError) throw secErr;
|
|
6085
6085
|
out.push(null);
|
|
6086
6086
|
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" });
|
|
6087
6087
|
}
|
|
@@ -6101,7 +6101,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6101
6101
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
6102
6102
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
6103
6103
|
const sections = readHwp5SectionStreams(c);
|
|
6104
|
-
if (sections.length === 0) throw new (0,
|
|
6104
|
+
if (sections.length === 0) throw new (0, _chunkPNSALBXHcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
6105
6105
|
const sectionRecords = readHwp5SectionRecords(c, sections, warnings);
|
|
6106
6106
|
const sectionDetects = sectionRecords.map((r) => r ? detectHwp5SectionPages(r) : null);
|
|
6107
6107
|
const sectionTableIds = [];
|
|
@@ -6145,7 +6145,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6145
6145
|
parsedSections++;
|
|
6146
6146
|
_optionalChain([options, 'optionalAccess', _219 => _219.onProgress, 'optionalCall', _220 => _220(parsedSections, sections.length)]);
|
|
6147
6147
|
} catch (secErr) {
|
|
6148
|
-
if (secErr instanceof
|
|
6148
|
+
if (secErr instanceof _chunkPNSALBXHcjs.KordocError) throw secErr;
|
|
6149
6149
|
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" });
|
|
6150
6150
|
} finally {
|
|
6151
6151
|
pageBase += detect2.pages;
|
|
@@ -6156,10 +6156,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6156
6156
|
}
|
|
6157
6157
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
6158
6158
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter, encrypted ? findStream : void 0) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter, encrypted ? findStream : void 0);
|
|
6159
|
-
let flatBlocks =
|
|
6160
|
-
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks =
|
|
6159
|
+
let flatBlocks = _chunkJFUUFJZWcjs.flattenLayoutTables.call(void 0, blocks);
|
|
6160
|
+
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks = _chunkJFUUFJZWcjs.unframeLayoutTables.call(void 0, flatBlocks, !!_optionalChain([options, 'optionalAccess', _222 => _222.keepTrailingEmptyCols]));
|
|
6161
6161
|
if (_optionalChain([options, 'optionalAccess', _223 => _223.dedupeRunningHeaders])) {
|
|
6162
|
-
const deduped =
|
|
6162
|
+
const deduped = _chunkJFUUFJZWcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
6163
6163
|
const removed = flatBlocks.length - deduped.length;
|
|
6164
6164
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
6165
6165
|
flatBlocks = deduped;
|
|
@@ -6168,10 +6168,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6168
6168
|
detectHwp5Headings(flatBlocks, docInfo, doc.tocTexts);
|
|
6169
6169
|
}
|
|
6170
6170
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
6171
|
-
let markdown =
|
|
6171
|
+
let markdown = _chunkJFUUFJZWcjs.blocksToMarkdown.call(void 0, flatBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _224 => _224.tableFormat]) });
|
|
6172
6172
|
if (_optionalChain([options, 'optionalAccess', _225 => _225.inlineImages]) && options.images !== false && images.length > 0) {
|
|
6173
6173
|
try {
|
|
6174
|
-
markdown =
|
|
6174
|
+
markdown = _chunkIGG63DFKcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
6175
6175
|
} catch (inlineErr) {
|
|
6176
6176
|
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" });
|
|
6177
6177
|
}
|
|
@@ -6235,9 +6235,9 @@ function detectHwp5Headings(blocks, docInfo, tocTexts) {
|
|
|
6235
6235
|
let level = 0;
|
|
6236
6236
|
if (_optionalChain([block, 'access', _232 => _232.style, 'optionalAccess', _233 => _233.fontSize]) && baseFontSize > 0) {
|
|
6237
6237
|
const ratio = block.style.fontSize / baseFontSize;
|
|
6238
|
-
if (ratio >=
|
|
6239
|
-
else if (ratio >=
|
|
6240
|
-
else if (ratio >=
|
|
6238
|
+
if (ratio >= _chunkJFUUFJZWcjs.HEADING_RATIO_H1) level = 1;
|
|
6239
|
+
else if (ratio >= _chunkJFUUFJZWcjs.HEADING_RATIO_H2) level = 2;
|
|
6240
|
+
else if (ratio >= _chunkJFUUFJZWcjs.HEADING_RATIO_H3) level = 3;
|
|
6241
6241
|
}
|
|
6242
6242
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
6243
6243
|
if (level === 0) level = 2;
|
|
@@ -6369,7 +6369,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6369
6369
|
const raw = _nullishCoalesce(lcfb.findStream(`/BodyText/Section${i}`), () => ( lcfb.findStream(`Section${i}`)));
|
|
6370
6370
|
if (!raw) break;
|
|
6371
6371
|
totalBytes += raw.length;
|
|
6372
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6372
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkPNSALBXHcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6373
6373
|
sections.push({ idx: i, content: raw });
|
|
6374
6374
|
}
|
|
6375
6375
|
if (sections.length === 0) {
|
|
@@ -6380,7 +6380,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6380
6380
|
const raw = lcfb.findStream(e.name);
|
|
6381
6381
|
if (raw) {
|
|
6382
6382
|
totalBytes += raw.length;
|
|
6383
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6383
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkPNSALBXHcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6384
6384
|
sections.push({ idx, content: raw });
|
|
6385
6385
|
}
|
|
6386
6386
|
}
|
|
@@ -6397,7 +6397,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
6397
6397
|
try {
|
|
6398
6398
|
const content = decryptViewText(raw, compressed);
|
|
6399
6399
|
totalDecompressed += content.length;
|
|
6400
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6400
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkPNSALBXHcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6401
6401
|
sections.push({ idx: i, content });
|
|
6402
6402
|
} catch (e32) {
|
|
6403
6403
|
break;
|
|
@@ -18897,25 +18897,25 @@ function desEcbDecrypt(data, key) {
|
|
|
18897
18897
|
}
|
|
18898
18898
|
function readLayout(data) {
|
|
18899
18899
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
18900
|
-
throw new (0,
|
|
18900
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
18901
18901
|
}
|
|
18902
18902
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
18903
18903
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
18904
18904
|
if (payloadOffset >= data.length) {
|
|
18905
|
-
throw new (0,
|
|
18905
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18906
18906
|
}
|
|
18907
18907
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
18908
18908
|
}
|
|
18909
18909
|
function decryptHwp3Document(input, password) {
|
|
18910
18910
|
const { payloadOffset, compressed } = readLayout(input);
|
|
18911
18911
|
if (!compressed) {
|
|
18912
|
-
throw new (0,
|
|
18912
|
+
throw new (0, _chunkPNSALBXHcjs.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)");
|
|
18913
18913
|
}
|
|
18914
18914
|
const source = Buffer.from(input);
|
|
18915
18915
|
const payload = source.subarray(payloadOffset);
|
|
18916
18916
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
18917
18917
|
if (aligned.length === 0) {
|
|
18918
|
-
throw new (0,
|
|
18918
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
18919
18919
|
}
|
|
18920
18920
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
18921
18921
|
let inflated;
|
|
@@ -18923,14 +18923,14 @@ function decryptHwp3Document(input, password) {
|
|
|
18923
18923
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
18924
18924
|
} catch (err) {
|
|
18925
18925
|
if (_optionalChain([err, 'optionalAccess', _248 => _248.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18926
|
-
throw new (0,
|
|
18926
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(
|
|
18927
18927
|
`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`
|
|
18928
18928
|
);
|
|
18929
18929
|
}
|
|
18930
|
-
throw new (0,
|
|
18930
|
+
throw new (0, _chunkPNSALBXHcjs.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.");
|
|
18931
18931
|
}
|
|
18932
18932
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
18933
|
-
throw new (0,
|
|
18933
|
+
throw new (0, _chunkPNSALBXHcjs.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.");
|
|
18934
18934
|
}
|
|
18935
18935
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
18936
18936
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -18987,9 +18987,9 @@ function hwp3CellGrid(info, count) {
|
|
|
18987
18987
|
const col = edgeAt(xs, g3.x), row = edgeAt(ys, g3.y);
|
|
18988
18988
|
const c2 = nextX[k] !== void 0 ? edgeAt(xs, nextX[k]) : xs.length - 1;
|
|
18989
18989
|
const r2 = nextY[k] !== void 0 ? edgeAt(ys, nextY[k]) : ys.length - 1;
|
|
18990
|
-
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row),
|
|
18990
|
+
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row), _chunkJFUUFJZWcjs.MAX_ROWS), colSpan: Math.min(Math.max(1, c2 - col), _chunkJFUUFJZWcjs.MAX_COLS) };
|
|
18991
18991
|
});
|
|
18992
|
-
return { rows: Math.min(Math.max(1, ys.length - 1),
|
|
18992
|
+
return { rows: Math.min(Math.max(1, ys.length - 1), _chunkJFUUFJZWcjs.MAX_ROWS), cols: Math.min(Math.max(1, xs.length - 1), _chunkJFUUFJZWcjs.MAX_COLS), cells };
|
|
18993
18993
|
}
|
|
18994
18994
|
|
|
18995
18995
|
// src/hwp3/parser.ts
|
|
@@ -19030,7 +19030,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19030
19030
|
let source = Buffer.from(buffer);
|
|
19031
19031
|
if (isEncryptedHwp3(source)) {
|
|
19032
19032
|
if (!_optionalChain([options, 'optionalAccess', _249 => _249.password])) {
|
|
19033
|
-
throw new (0,
|
|
19033
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(
|
|
19034
19034
|
"\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."
|
|
19035
19035
|
);
|
|
19036
19036
|
}
|
|
@@ -19047,10 +19047,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19047
19047
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
19048
19048
|
} catch (err) {
|
|
19049
19049
|
if (_optionalChain([err, 'optionalAccess', _250 => _250.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
19050
|
-
throw new (0,
|
|
19050
|
+
throw new (0, _chunkPNSALBXHcjs.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`);
|
|
19051
19051
|
}
|
|
19052
19052
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
19053
|
-
throw new (0,
|
|
19053
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
19054
19054
|
}
|
|
19055
19055
|
} else {
|
|
19056
19056
|
body = tail;
|
|
@@ -19073,7 +19073,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19073
19073
|
const names = new Map([...ctx.picIds].map(([name, id]) => [id, name]));
|
|
19074
19074
|
dropMissingPictures(allBlocks, binData, names, warnings);
|
|
19075
19075
|
const images = resolveImageBlocks(binData, allBlocks, warnings, true);
|
|
19076
|
-
const blocks =
|
|
19076
|
+
const blocks = _chunkJFUUFJZWcjs.flattenLayoutTables.call(void 0, allBlocks);
|
|
19077
19077
|
const metadata = {
|
|
19078
19078
|
title: header.title || void 0,
|
|
19079
19079
|
author: header.author || void 0,
|
|
@@ -19081,10 +19081,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19081
19081
|
createdAt: header.date || void 0,
|
|
19082
19082
|
version: "3.0"
|
|
19083
19083
|
};
|
|
19084
|
-
let markdown =
|
|
19084
|
+
let markdown = _chunkJFUUFJZWcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _251 => _251.tableFormat]) });
|
|
19085
19085
|
if (_optionalChain([options, 'optionalAccess', _252 => _252.inlineImages]) && options.images !== false && images.length > 0) {
|
|
19086
19086
|
try {
|
|
19087
|
-
markdown =
|
|
19087
|
+
markdown = _chunkIGG63DFKcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
19088
19088
|
} catch (inlineErr) {
|
|
19089
19089
|
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" });
|
|
19090
19090
|
}
|
|
@@ -19216,7 +19216,7 @@ function parseCharStream(reader, charCount, ctx, para2) {
|
|
|
19216
19216
|
continue;
|
|
19217
19217
|
}
|
|
19218
19218
|
if (ch >= 32) {
|
|
19219
|
-
para2.text +=
|
|
19219
|
+
para2.text += _chunkJFUUFJZWcjs.escapeLiteralTags.call(void 0, _chunkJFUUFJZWcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(decodeJohabText(ch), () => ( ""))));
|
|
19220
19220
|
continue;
|
|
19221
19221
|
}
|
|
19222
19222
|
if (ch === 9) {
|
|
@@ -19451,7 +19451,7 @@ function isDistributionSentinel(markdown) {
|
|
|
19451
19451
|
// src/xlsx/sheet-blocks.ts
|
|
19452
19452
|
var MAX_SHEET_COLS = 16384;
|
|
19453
19453
|
function sheetRowCap(cols) {
|
|
19454
|
-
return Math.floor(
|
|
19454
|
+
return Math.floor(_chunkJFUUFJZWcjs.MAX_TABLE_CELLS / Math.max(1, cols));
|
|
19455
19455
|
}
|
|
19456
19456
|
function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols) {
|
|
19457
19457
|
const blocks = [];
|
|
@@ -19482,7 +19482,7 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19482
19482
|
if (keepRows.length > rowCap) {
|
|
19483
19483
|
warnings.push({
|
|
19484
19484
|
page: sheetIndex + 1,
|
|
19485
|
-
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 ${
|
|
19485
|
+
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 ${_chunkJFUUFJZWcjs.MAX_TABLE_CELLS})`,
|
|
19486
19486
|
code: "TRUNCATED_TABLE"
|
|
19487
19487
|
});
|
|
19488
19488
|
keepRows.length = rowCap;
|
|
@@ -19516,14 +19516,14 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19516
19516
|
}
|
|
19517
19517
|
cellRows.push(row);
|
|
19518
19518
|
}
|
|
19519
|
-
const table2 =
|
|
19519
|
+
const table2 = _chunkJFUUFJZWcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols, maxRows: rowCap, maxCols: keepCols.length });
|
|
19520
19520
|
if (table2.rows > 0) blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
19521
19521
|
return blocks;
|
|
19522
19522
|
}
|
|
19523
19523
|
|
|
19524
19524
|
// src/xlsx/parser.ts
|
|
19525
19525
|
var MAX_SHEETS = 100;
|
|
19526
|
-
var MAX_DECOMPRESS_SIZE4 =
|
|
19526
|
+
var MAX_DECOMPRESS_SIZE4 = _chunkPNSALBXHcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
19527
19527
|
var MAX_SHEET_ROWS = 1048576;
|
|
19528
19528
|
function cleanNumericValue(raw) {
|
|
19529
19529
|
if (!/^-?\d+\.\d+$/.test(raw)) return raw;
|
|
@@ -19560,7 +19560,7 @@ function getTextContent(el) {
|
|
|
19560
19560
|
return _nullishCoalesce(_optionalChain([el, 'access', _268 => _268.textContent, 'optionalAccess', _269 => _269.trim, 'call', _270 => _270()]), () => ( ""));
|
|
19561
19561
|
}
|
|
19562
19562
|
function parseXml(text) {
|
|
19563
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19563
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkPNSALBXHcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19564
19564
|
}
|
|
19565
19565
|
function collectRichText(root) {
|
|
19566
19566
|
let out = "";
|
|
@@ -19571,7 +19571,7 @@ function collectRichText(root) {
|
|
|
19571
19571
|
const el = children[i];
|
|
19572
19572
|
const local2 = el.localName || _optionalChain([el, 'access', _271 => _271.tagName, 'optionalAccess', _272 => _272.replace, 'call', _273 => _273(/^[^:]+:/, "")]) || "";
|
|
19573
19573
|
if (local2 === "rPh") continue;
|
|
19574
|
-
if (local2 === "t") out +=
|
|
19574
|
+
if (local2 === "t") out += _chunkJFUUFJZWcjs.escapeLiteralTags.call(void 0, _chunkJFUUFJZWcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
19575
19575
|
else walk(el);
|
|
19576
19576
|
}
|
|
19577
19577
|
};
|
|
@@ -19782,12 +19782,12 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19782
19782
|
return { rows, merges, maxCol };
|
|
19783
19783
|
}
|
|
19784
19784
|
async function parseXlsxDocument(buffer, options) {
|
|
19785
|
-
|
|
19785
|
+
_chunkPNSALBXHcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
19786
19786
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19787
19787
|
const warnings = [];
|
|
19788
19788
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
19789
19789
|
if (!workbookFile) {
|
|
19790
|
-
throw new (0,
|
|
19790
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19791
19791
|
}
|
|
19792
19792
|
let sharedStrings = [];
|
|
19793
19793
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -19796,7 +19796,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19796
19796
|
}
|
|
19797
19797
|
const { sheets, date1904 } = parseWorkbook(await readZipEntry(workbookFile, "text"));
|
|
19798
19798
|
if (sheets.length === 0) {
|
|
19799
|
-
throw new (0,
|
|
19799
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19800
19800
|
}
|
|
19801
19801
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
19802
19802
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -19880,7 +19880,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19880
19880
|
} catch (e35) {
|
|
19881
19881
|
}
|
|
19882
19882
|
}
|
|
19883
|
-
const markdown =
|
|
19883
|
+
const markdown = _chunkJFUUFJZWcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _278 => _278.tableFormat]) });
|
|
19884
19884
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
19885
19885
|
}
|
|
19886
19886
|
|
|
@@ -20194,14 +20194,14 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20194
20194
|
const h = readCellHeader(rec.data);
|
|
20195
20195
|
if (h && rec.data.length >= 10) {
|
|
20196
20196
|
const isst = rec.data.readUInt32LE(6);
|
|
20197
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20197
|
+
cells.push({ row: h.row, col: h.col, value: _chunkJFUUFJZWcjs.escapeLiteralTags.call(void 0, _chunkJFUUFJZWcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(sst[isst], () => ( "")))) });
|
|
20198
20198
|
}
|
|
20199
20199
|
break;
|
|
20200
20200
|
}
|
|
20201
20201
|
case OP_LABEL: {
|
|
20202
20202
|
const h = readCellHeader(rec.data);
|
|
20203
20203
|
if (h) {
|
|
20204
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20204
|
+
cells.push({ row: h.row, col: h.col, value: _chunkJFUUFJZWcjs.escapeLiteralTags.call(void 0, _chunkJFUUFJZWcjs.escapeLiteralDollar.call(void 0, decodeLabelString(rec.data))) });
|
|
20205
20205
|
}
|
|
20206
20206
|
break;
|
|
20207
20207
|
}
|
|
@@ -20217,7 +20217,7 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20217
20217
|
cells.push({
|
|
20218
20218
|
row: h.row,
|
|
20219
20219
|
col: h.col,
|
|
20220
|
-
value:
|
|
20220
|
+
value: _chunkJFUUFJZWcjs.escapeLiteralTags.call(void 0, _chunkJFUUFJZWcjs.escapeLiteralDollar.call(void 0, decodeFormulaStringRecord(next.data)))
|
|
20221
20221
|
});
|
|
20222
20222
|
i = j;
|
|
20223
20223
|
} else {
|
|
@@ -20329,11 +20329,11 @@ function processGlobals(records) {
|
|
|
20329
20329
|
const xfFmtIds = [];
|
|
20330
20330
|
const firstBof = records[0];
|
|
20331
20331
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
20332
|
-
throw new (0,
|
|
20332
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
20333
20333
|
}
|
|
20334
20334
|
const bof = decodeBof(firstBof.data);
|
|
20335
20335
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
20336
|
-
throw new (0,
|
|
20336
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
20337
20337
|
}
|
|
20338
20338
|
let i = 1;
|
|
20339
20339
|
while (i < records.length) {
|
|
@@ -20417,28 +20417,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20417
20417
|
try {
|
|
20418
20418
|
cfb = parseLenientCfb(buf);
|
|
20419
20419
|
} catch (e) {
|
|
20420
|
-
throw new (0,
|
|
20420
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(
|
|
20421
20421
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
20422
20422
|
);
|
|
20423
20423
|
}
|
|
20424
20424
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
20425
20425
|
if (!wb) {
|
|
20426
|
-
throw new (0,
|
|
20426
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
20427
20427
|
}
|
|
20428
20428
|
const records = readRecords2(wb);
|
|
20429
20429
|
if (records.length === 0) {
|
|
20430
|
-
throw new (0,
|
|
20430
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
20431
20431
|
}
|
|
20432
20432
|
const firstBof = decodeBof(records[0].data);
|
|
20433
20433
|
if (firstBof && firstBof.vers !== 1536) {
|
|
20434
|
-
throw new (0,
|
|
20434
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(
|
|
20435
20435
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
20436
20436
|
);
|
|
20437
20437
|
}
|
|
20438
20438
|
const globals = processGlobals(records);
|
|
20439
20439
|
const warnings = [];
|
|
20440
20440
|
if (globals.encrypted) {
|
|
20441
|
-
throw new (0,
|
|
20441
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20442
20442
|
}
|
|
20443
20443
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
20444
20444
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -20489,7 +20489,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20489
20489
|
pageCount: totalSheets
|
|
20490
20490
|
};
|
|
20491
20491
|
return {
|
|
20492
|
-
markdown:
|
|
20492
|
+
markdown: _chunkJFUUFJZWcjs.blocksToMarkdown.call(void 0, allBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _283 => _283.tableFormat]) }),
|
|
20493
20493
|
blocks: allBlocks,
|
|
20494
20494
|
metadata,
|
|
20495
20495
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -20928,7 +20928,7 @@ function isDisplayMath(el) {
|
|
|
20928
20928
|
}
|
|
20929
20929
|
|
|
20930
20930
|
// src/docx/parser.ts
|
|
20931
|
-
var MAX_DECOMPRESS_SIZE5 =
|
|
20931
|
+
var MAX_DECOMPRESS_SIZE5 = _chunkPNSALBXHcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
20932
20932
|
var MEDIA_PART_RE = /^word\/(?:media|embeddings)\//;
|
|
20933
20933
|
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;
|
|
20934
20934
|
function matchesLocal(el, localName3) {
|
|
@@ -20986,7 +20986,7 @@ function getAttr(el, localName3) {
|
|
|
20986
20986
|
return null;
|
|
20987
20987
|
}
|
|
20988
20988
|
function parseXml2(text) {
|
|
20989
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
20989
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkPNSALBXHcjs.stripDtd.call(void 0, text), "text/xml");
|
|
20990
20990
|
}
|
|
20991
20991
|
function parseStyles(xml) {
|
|
20992
20992
|
const doc = parseXml2(xml);
|
|
@@ -21122,7 +21122,7 @@ function parseFootnotes(xml) {
|
|
|
21122
21122
|
const runs = findElements(p, "r");
|
|
21123
21123
|
for (const r of runs) {
|
|
21124
21124
|
const tElements = getChildElements(r, "t");
|
|
21125
|
-
for (const t of tElements) texts.push(
|
|
21125
|
+
for (const t of tElements) texts.push(_chunkJFUUFJZWcjs.escapeLiteralTags.call(void 0, _chunkJFUUFJZWcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(t.textContent, () => ( "")))));
|
|
21126
21126
|
}
|
|
21127
21127
|
}
|
|
21128
21128
|
notes.set(id, texts.join("").trim());
|
|
@@ -21153,7 +21153,7 @@ function collectOmmlRoots(p) {
|
|
|
21153
21153
|
function extractRun(r) {
|
|
21154
21154
|
let text = "";
|
|
21155
21155
|
for (const el of effectiveChildElements(r)) {
|
|
21156
|
-
if (matchesLocal(el, "t")) text +=
|
|
21156
|
+
if (matchesLocal(el, "t")) text += _chunkJFUUFJZWcjs.escapeLiteralTags.call(void 0, _chunkJFUUFJZWcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
21157
21157
|
else if (matchesLocal(el, "br") || matchesLocal(el, "cr")) text += "\n";
|
|
21158
21158
|
else if (matchesLocal(el, "tab")) text += " ";
|
|
21159
21159
|
else if (matchesLocal(el, "sym")) text += symbolChar(getAttr(el, "font"), getAttr(el, "char"));
|
|
@@ -21166,7 +21166,7 @@ function extractRun(r) {
|
|
|
21166
21166
|
italic = getChildElements(rPrEls[0], "i").length > 0;
|
|
21167
21167
|
const va = getChildElements(rPrEls[0], "vertAlign")[0];
|
|
21168
21168
|
const v = va ? getAttr(va, "val") : null;
|
|
21169
|
-
if (v === "superscript" || v === "subscript") text =
|
|
21169
|
+
if (v === "superscript" || v === "subscript") text = _chunkJFUUFJZWcjs.wrapScript.call(void 0, text, v === "superscript" ? "sup" : "sub");
|
|
21170
21170
|
}
|
|
21171
21171
|
return { text, bold, italic };
|
|
21172
21172
|
}
|
|
@@ -21184,7 +21184,7 @@ var PAGE_FIELD_RE = /^\s*(?:PAGE|NUMPAGES|SECTIONPAGES)\b/i;
|
|
|
21184
21184
|
function makeLink(text, rawHref) {
|
|
21185
21185
|
if (!text) return "";
|
|
21186
21186
|
if (!rawHref) return text;
|
|
21187
|
-
const href =
|
|
21187
|
+
const href = _chunkPNSALBXHcjs.sanitizeHref.call(void 0, rawHref);
|
|
21188
21188
|
return href ? `[${text}](${href})` : text;
|
|
21189
21189
|
}
|
|
21190
21190
|
function collectInline(p, footnotes, rels) {
|
|
@@ -21275,7 +21275,7 @@ function collectInline(p, footnotes, rels) {
|
|
|
21275
21275
|
const m = mathText(om);
|
|
21276
21276
|
if (m) parts.push(isDisplayMath(om) ? m : " " + m + " ");
|
|
21277
21277
|
}
|
|
21278
|
-
const text =
|
|
21278
|
+
const text = _chunkJFUUFJZWcjs.tidyScriptTags.call(void 0, parts.join("")).replace(/[ \t]{2,}/g, " ").trim();
|
|
21279
21279
|
return { text, bold, italic, footnoteText };
|
|
21280
21280
|
}
|
|
21281
21281
|
var COUNTERS = /* @__PURE__ */ new WeakMap();
|
|
@@ -21400,7 +21400,7 @@ ${cell2.text}` : cell2.text;
|
|
|
21400
21400
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
21401
21401
|
})
|
|
21402
21402
|
);
|
|
21403
|
-
const table2 =
|
|
21403
|
+
const table2 = _chunkJFUUFJZWcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21404
21404
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21405
21405
|
return { type: "table", table: table2 };
|
|
21406
21406
|
}
|
|
@@ -21449,7 +21449,7 @@ async function buildImageMap(zip, rels, doc, warnings, readBytes) {
|
|
|
21449
21449
|
let data = null;
|
|
21450
21450
|
if (readBytes) data = await readZipEntry(imgFile, "uint8array");
|
|
21451
21451
|
imgIdx++;
|
|
21452
|
-
const ext =
|
|
21452
|
+
const ext = _chunkPNSALBXHcjs.partExtension.call(void 0, imgPath);
|
|
21453
21453
|
const mimeMap = {
|
|
21454
21454
|
png: "image/png",
|
|
21455
21455
|
jpg: "image/jpeg",
|
|
@@ -21548,12 +21548,12 @@ async function parseHeaderFooterBlocks(zip, doc, rels, kind, styles, numbering,
|
|
|
21548
21548
|
}
|
|
21549
21549
|
async function parseDocxDocument(buffer, options) {
|
|
21550
21550
|
const readImages = _optionalChain([options, 'optionalAccess', _319 => _319.images]) !== false;
|
|
21551
|
-
|
|
21551
|
+
_chunkPNSALBXHcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5, void 0, { re: MEDIA_PART_RE, skip: !readImages, never: NEVER_READ_RE });
|
|
21552
21552
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21553
21553
|
const warnings = [];
|
|
21554
21554
|
const docFile = zip.file("word/document.xml");
|
|
21555
21555
|
if (!docFile) {
|
|
21556
|
-
throw new (0,
|
|
21556
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21557
21557
|
}
|
|
21558
21558
|
let rels = /* @__PURE__ */ new Map();
|
|
21559
21559
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -21600,7 +21600,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21600
21600
|
const doc = parseXml2(docXml);
|
|
21601
21601
|
const body = findElements(doc, "body");
|
|
21602
21602
|
if (body.length === 0) {
|
|
21603
|
-
throw new (0,
|
|
21603
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21604
21604
|
}
|
|
21605
21605
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings, readImages);
|
|
21606
21606
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -21653,7 +21653,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21653
21653
|
}
|
|
21654
21654
|
}
|
|
21655
21655
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
21656
|
-
const markdown =
|
|
21656
|
+
const markdown = _chunkJFUUFJZWcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _326 => _326.tableFormat]) });
|
|
21657
21657
|
return {
|
|
21658
21658
|
markdown,
|
|
21659
21659
|
blocks,
|
|
@@ -21667,7 +21667,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21667
21667
|
// src/pptx/parser.ts
|
|
21668
21668
|
|
|
21669
21669
|
|
|
21670
|
-
var MAX_DECOMPRESS_SIZE6 =
|
|
21670
|
+
var MAX_DECOMPRESS_SIZE6 = _chunkPNSALBXHcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
21671
21671
|
var MEDIA_PART_RE2 = /^ppt\/(?:media|embeddings)\//;
|
|
21672
21672
|
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;
|
|
21673
21673
|
var MAX_ZIP_ENTRIES2 = 1e4;
|
|
@@ -21690,7 +21690,7 @@ var IMAGE_MIME = {
|
|
|
21690
21690
|
svg: "image/svg+xml"
|
|
21691
21691
|
};
|
|
21692
21692
|
function parseXml3(text) {
|
|
21693
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
21693
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkPNSALBXHcjs.stripDtd.call(void 0, text), "text/xml");
|
|
21694
21694
|
}
|
|
21695
21695
|
function getAttr2(el, name) {
|
|
21696
21696
|
const attrs = el.attributes;
|
|
@@ -21757,7 +21757,7 @@ async function slideParts(zip) {
|
|
|
21757
21757
|
names.sort((a, b) => Number(SLIDE_PART_RE.exec(a)[1]) - Number(SLIDE_PART_RE.exec(b)[1]));
|
|
21758
21758
|
ordered.push(...names);
|
|
21759
21759
|
}
|
|
21760
|
-
if (ordered.length > MAX_SLIDES) throw new (0,
|
|
21760
|
+
if (ordered.length > MAX_SLIDES) throw new (0, _chunkPNSALBXHcjs.KordocError)(`PPTX \uC2AC\uB77C\uC774\uB4DC \uC218 \uCD08\uACFC: ${ordered.length} (\uCD5C\uB300 ${MAX_SLIDES})`);
|
|
21761
21761
|
return ordered;
|
|
21762
21762
|
}
|
|
21763
21763
|
function paragraphText(p) {
|
|
@@ -21768,12 +21768,12 @@ function paragraphText(p) {
|
|
|
21768
21768
|
const t = findChildByLocalName(child, "t");
|
|
21769
21769
|
const rPr = findChildByLocalName(child, "rPr");
|
|
21770
21770
|
const baseline = Number(rPr ? _nullishCoalesce(getAttr2(rPr, "baseline"), () => ( 0)) : 0);
|
|
21771
|
-
if (t) text +=
|
|
21771
|
+
if (t) text += _chunkJFUUFJZWcjs.wrapScript.call(void 0, _chunkJFUUFJZWcjs.escapeLiteralTags.call(void 0, _chunkJFUUFJZWcjs.escapeLiteralDollar.call(void 0, rawTextContent(t))), baseline > 0 ? "sup" : baseline < 0 ? "sub" : null);
|
|
21772
21772
|
} else if (name === "br") {
|
|
21773
21773
|
text += " ";
|
|
21774
21774
|
}
|
|
21775
21775
|
}
|
|
21776
|
-
return
|
|
21776
|
+
return _chunkJFUUFJZWcjs.tidyScriptTags.call(void 0, text.replace(/\s+/g, " ").trim());
|
|
21777
21777
|
}
|
|
21778
21778
|
function bodyParagraphs(txBody) {
|
|
21779
21779
|
const out = [];
|
|
@@ -21834,7 +21834,7 @@ function parseTable2(tbl2, page, keepEmptyCols) {
|
|
|
21834
21834
|
});
|
|
21835
21835
|
return cells;
|
|
21836
21836
|
});
|
|
21837
|
-
const table2 =
|
|
21837
|
+
const table2 = _chunkJFUUFJZWcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21838
21838
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21839
21839
|
return { type: "table", table: table2, pageNumber: page };
|
|
21840
21840
|
}
|
|
@@ -21847,7 +21847,7 @@ async function pictureBlock(pic, ctx) {
|
|
|
21847
21847
|
if (!filename) {
|
|
21848
21848
|
const file = ctx.zip.file(rel.target);
|
|
21849
21849
|
if (!file) return null;
|
|
21850
|
-
const ext =
|
|
21850
|
+
const ext = _chunkPNSALBXHcjs.partExtension.call(void 0, rel.target);
|
|
21851
21851
|
filename = `image_${String(ctx.imageNames.size + 1).padStart(3, "0")}.${ext}`;
|
|
21852
21852
|
try {
|
|
21853
21853
|
if (_optionalChain([ctx, 'access', _330 => _330.options, 'optionalAccess', _331 => _331.images]) !== false) {
|
|
@@ -21925,10 +21925,10 @@ async function notesText(zip, rels) {
|
|
|
21925
21925
|
return texts.join(" ");
|
|
21926
21926
|
}
|
|
21927
21927
|
async function parsePptxDocument(buffer, options) {
|
|
21928
|
-
|
|
21928
|
+
_chunkPNSALBXHcjs.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 });
|
|
21929
21929
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21930
21930
|
if (!zip.file("ppt/presentation.xml")) {
|
|
21931
|
-
throw new (0,
|
|
21931
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 PPTX \uD30C\uC77C: ppt/presentation.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21932
21932
|
}
|
|
21933
21933
|
const warnings = [];
|
|
21934
21934
|
const blocks = [];
|
|
@@ -21975,7 +21975,7 @@ async function parsePptxDocument(buffer, options) {
|
|
|
21975
21975
|
}
|
|
21976
21976
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")), pageNumber: b.pageNumber }));
|
|
21977
21977
|
return {
|
|
21978
|
-
markdown:
|
|
21978
|
+
markdown: _chunkJFUUFJZWcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _336 => _336.tableFormat]) }),
|
|
21979
21979
|
blocks,
|
|
21980
21980
|
metadata,
|
|
21981
21981
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -21991,11 +21991,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
21991
21991
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
21992
21992
|
function parseHwpmlDocument(buffer, options) {
|
|
21993
21993
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
21994
|
-
throw new (0,
|
|
21994
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
21995
21995
|
}
|
|
21996
21996
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
21997
21997
|
const normalized = text.replace(/ /g, " ");
|
|
21998
|
-
const xml =
|
|
21998
|
+
const xml = _chunkPNSALBXHcjs.stripDtd.call(void 0, normalized);
|
|
21999
21999
|
const warnings = [];
|
|
22000
22000
|
const parser = new (0, _xmldom.DOMParser)({
|
|
22001
22001
|
onError: (_level, msg2) => {
|
|
@@ -22035,7 +22035,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
22035
22035
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _338 => _338.keepTrailingEmptyCols]), () => ( false)));
|
|
22036
22036
|
}
|
|
22037
22037
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
22038
|
-
const markdown =
|
|
22038
|
+
const markdown = _chunkJFUUFJZWcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _339 => _339.tableFormat]) });
|
|
22039
22039
|
return {
|
|
22040
22040
|
markdown,
|
|
22041
22041
|
blocks,
|
|
@@ -22142,7 +22142,7 @@ function collectCharText(node, parts, depth = 0) {
|
|
|
22142
22142
|
if (tag === "CHAR") {
|
|
22143
22143
|
for (const c of Array.from(el.childNodes)) {
|
|
22144
22144
|
const t = c.nodeType === 1 ? localName(c) === "TAB" ? " " : rawTextContent(c) : c.nodeType === 3 || c.nodeType === 4 ? _nullishCoalesce(c.nodeValue, () => ( "")) : "";
|
|
22145
|
-
if (t) parts.push(
|
|
22145
|
+
if (t) parts.push(_chunkJFUUFJZWcjs.escapeLiteralTags.call(void 0, t));
|
|
22146
22146
|
}
|
|
22147
22147
|
} else if (tag === "TABLE" || tag === "PICTURE" || tag === "SHAPEOBJECT") {
|
|
22148
22148
|
} else if (tag === "AUTONUM") {
|
|
@@ -22202,7 +22202,7 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
22202
22202
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
22203
22203
|
cellRows[r].push(cell2);
|
|
22204
22204
|
}
|
|
22205
|
-
const table2 =
|
|
22205
|
+
const table2 = _chunkJFUUFJZWcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
22206
22206
|
if (structured.length > 0) {
|
|
22207
22207
|
const claimed = /* @__PURE__ */ new Set();
|
|
22208
22208
|
for (const { ctx, cellBlocks } of structured) {
|
|
@@ -23980,7 +23980,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
23980
23980
|
};
|
|
23981
23981
|
}
|
|
23982
23982
|
async function extractClickHereFields(hwpxBuffer) {
|
|
23983
|
-
|
|
23983
|
+
_chunkPNSALBXHcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
23984
23984
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
23985
23985
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
23986
23986
|
const fields = [];
|
|
@@ -24016,7 +24016,7 @@ function readZipEntries(buf) {
|
|
|
24016
24016
|
}
|
|
24017
24017
|
function localDataStart(view, localOffset) {
|
|
24018
24018
|
if (view.getUint32(localOffset, true) !== LOCAL_SIG) {
|
|
24019
|
-
throw new (0,
|
|
24019
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
24020
24020
|
}
|
|
24021
24021
|
const nameLen = view.getUint16(localOffset + 26, true);
|
|
24022
24022
|
const extraLen = view.getUint16(localOffset + 28, true);
|
|
@@ -24046,19 +24046,19 @@ function parseCentralDirectory(buf) {
|
|
|
24046
24046
|
}
|
|
24047
24047
|
}
|
|
24048
24048
|
}
|
|
24049
|
-
if (eocdOffset < 0) throw new (0,
|
|
24049
|
+
if (eocdOffset < 0) throw new (0, _chunkPNSALBXHcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24050
24050
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
24051
24051
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
24052
24052
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
24053
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
24053
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkPNSALBXHcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24054
24054
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
24055
|
-
throw new (0,
|
|
24055
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24056
24056
|
}
|
|
24057
24057
|
const decoder = new TextDecoder("utf-8");
|
|
24058
24058
|
const entries = [];
|
|
24059
24059
|
let pos = cdOffset;
|
|
24060
24060
|
for (let i = 0; i < totalEntries; i++) {
|
|
24061
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
24061
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkPNSALBXHcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
24062
24062
|
const flags = view.getUint16(pos + 8, true);
|
|
24063
24063
|
const method = view.getUint16(pos + 10, true);
|
|
24064
24064
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -24069,7 +24069,7 @@ function parseCentralDirectory(buf) {
|
|
|
24069
24069
|
const commentLen = view.getUint16(pos + 32, true);
|
|
24070
24070
|
const localOffset = view.getUint32(pos + 42, true);
|
|
24071
24071
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
24072
|
-
throw new (0,
|
|
24072
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24073
24073
|
}
|
|
24074
24074
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
24075
24075
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -24098,11 +24098,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24098
24098
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
24099
24099
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
24100
24100
|
for (const name of replacements.keys()) {
|
|
24101
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
24101
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkPNSALBXHcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
24102
24102
|
}
|
|
24103
24103
|
if (additions) {
|
|
24104
24104
|
for (const name of additions.keys()) {
|
|
24105
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
24105
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkPNSALBXHcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
24106
24106
|
}
|
|
24107
24107
|
}
|
|
24108
24108
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -24121,7 +24121,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24121
24121
|
offset += seg.length;
|
|
24122
24122
|
continue;
|
|
24123
24123
|
}
|
|
24124
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
24124
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkPNSALBXHcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
24125
24125
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
24126
24126
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
24127
24127
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -24129,7 +24129,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24129
24129
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
24130
24130
|
const method = e.method;
|
|
24131
24131
|
if (method !== 0 && method !== 8) {
|
|
24132
|
-
throw new (0,
|
|
24132
|
+
throw new (0, _chunkPNSALBXHcjs.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`);
|
|
24133
24133
|
}
|
|
24134
24134
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
24135
24135
|
const crc = crc32(newData);
|
|
@@ -24227,11 +24227,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24227
24227
|
// src/form/filler-hwpx.ts
|
|
24228
24228
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
24229
24229
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
24230
|
-
|
|
24230
|
+
_chunkPNSALBXHcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
24231
24231
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
24232
24232
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
24233
24233
|
if (sectionPaths.length === 0) {
|
|
24234
|
-
throw new (0,
|
|
24234
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24235
24235
|
}
|
|
24236
24236
|
const warnings = [];
|
|
24237
24237
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -24623,7 +24623,7 @@ var MIN_SIDE = 24;
|
|
|
24623
24623
|
async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
24624
24624
|
const ocr = _optionalChain([options, 'optionalAccess', _491 => _491.ocr]);
|
|
24625
24625
|
if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
|
|
24626
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
24626
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-QNIMVE5A.cjs")));
|
|
24627
24627
|
let inserted = false, unreadable = 0;
|
|
24628
24628
|
let failed = null;
|
|
24629
24629
|
const walk = async (list, depth) => {
|
|
@@ -24664,7 +24664,7 @@ async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
|
24664
24664
|
function ocrBytes(img) {
|
|
24665
24665
|
const mime = img.mimeType.toLowerCase();
|
|
24666
24666
|
if (mime.includes("wmf") || mime.includes("emf")) return null;
|
|
24667
|
-
if (mime.includes("bmp")) return
|
|
24667
|
+
if (mime.includes("bmp")) return _chunkIGG63DFKcjs.bmpToPng.call(void 0, img.data);
|
|
24668
24668
|
return img.data;
|
|
24669
24669
|
}
|
|
24670
24670
|
async function tooSmall(bytes) {
|
|
@@ -24833,7 +24833,7 @@ function classifyTableTree(blocks) {
|
|
|
24833
24833
|
return blocks;
|
|
24834
24834
|
}
|
|
24835
24835
|
function chooseTableRepresentation(table2, opts = {}) {
|
|
24836
|
-
const structured = hasMerged(table2) ||
|
|
24836
|
+
const structured = hasMerged(table2) || _chunkJFUUFJZWcjs.hasStructuredCellContent.call(void 0, table2);
|
|
24837
24837
|
if (opts.smartVisual && _optionalChain([table2, 'access', _507 => _507.classification, 'optionalAccess', _508 => _508.kind]) === "non-tabular-layout") return "visual";
|
|
24838
24838
|
return structured ? "html" : "gfm";
|
|
24839
24839
|
}
|
|
@@ -35919,7 +35919,7 @@ function findAgency(name) {
|
|
|
35919
35919
|
}
|
|
35920
35920
|
function agencyStyle(name) {
|
|
35921
35921
|
const s = findAgency(name);
|
|
35922
|
-
if (!s) throw new (0,
|
|
35922
|
+
if (!s) throw new (0, _chunkPNSALBXHcjs.KordocError)(`agency: \uC2E4\uCE21 \uC11C\uC2DD\uC774 \uC5C6\uB294 \uAE30\uAD00\uC785\uB2C8\uB2E4 "${name}" \u2014 ${AGENCY_COMMON_NAME} \uB610\uB294 ${agencyNames().join("\xB7")}`);
|
|
35923
35923
|
return s;
|
|
35924
35924
|
}
|
|
35925
35925
|
function applyAgency(opts, preset) {
|
|
@@ -36983,7 +36983,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
36983
36983
|
}
|
|
36984
36984
|
function assertFiniteRange(name, value, min, max) {
|
|
36985
36985
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
36986
|
-
throw new (0,
|
|
36986
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
36987
36987
|
}
|
|
36988
36988
|
}
|
|
36989
36989
|
function validateGongmunOptions(opts) {
|
|
@@ -37001,10 +37001,10 @@ function validateGongmunOptions(opts) {
|
|
|
37001
37001
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
37002
37002
|
}
|
|
37003
37003
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
37004
|
-
throw new (0,
|
|
37004
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
37005
37005
|
}
|
|
37006
37006
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
37007
|
-
throw new (0,
|
|
37007
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
37008
37008
|
}
|
|
37009
37009
|
}
|
|
37010
37010
|
if (opts.sizes) {
|
|
@@ -37013,24 +37013,24 @@ function validateGongmunOptions(opts) {
|
|
|
37013
37013
|
}
|
|
37014
37014
|
}
|
|
37015
37015
|
if (opts.approval && opts.approval.length > 6) {
|
|
37016
|
-
throw new (0,
|
|
37016
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("approval must contain at most 6 labels");
|
|
37017
37017
|
}
|
|
37018
37018
|
if (opts.checklist && typeof opts.checklist === "object") {
|
|
37019
37019
|
const nums = [..._nullishCoalesce(opts.checklist.na, () => ( [])), ...Object.keys(_nullishCoalesce(opts.checklist.notes, () => ( {}))).map(Number)];
|
|
37020
37020
|
for (const n of nums) {
|
|
37021
|
-
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0,
|
|
37021
|
+
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0, _chunkPNSALBXHcjs.KordocError)(`checklist: item number must be an integer between 1 and ${CHECKLIST_ITEMS} (got ${n})`);
|
|
37022
37022
|
}
|
|
37023
37023
|
}
|
|
37024
37024
|
if (opts.levels) {
|
|
37025
37025
|
for (const [key, st] of Object.entries(opts.levels)) {
|
|
37026
37026
|
const depth = Number(key);
|
|
37027
37027
|
if (!Number.isInteger(depth) || depth < 0 || depth >= GONGMUN_LEVEL_COUNT) {
|
|
37028
|
-
throw new (0,
|
|
37028
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(`levels: depth must be an integer between 0 and ${GONGMUN_LEVEL_COUNT - 1} (got "${key}")`);
|
|
37029
37029
|
}
|
|
37030
|
-
if (!st || typeof st !== "object") throw new (0,
|
|
37030
|
+
if (!st || typeof st !== "object") throw new (0, _chunkPNSALBXHcjs.KordocError)(`levels.${key} must be an object {font, pt, bold}`);
|
|
37031
37031
|
if (st.pt !== void 0) assertFiniteRange(`levels.${key}.pt`, st.pt, 6, 60);
|
|
37032
37032
|
if (st.font !== void 0 && (typeof st.font !== "string" || !st.font.trim())) {
|
|
37033
|
-
throw new (0,
|
|
37033
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(`levels.${key}.font must be a non-empty string`);
|
|
37034
37034
|
}
|
|
37035
37035
|
}
|
|
37036
37036
|
}
|
|
@@ -37088,7 +37088,7 @@ function resolveChecklist(c, preset) {
|
|
|
37088
37088
|
function hexColorOption(name, value) {
|
|
37089
37089
|
if (value === void 0) return void 0;
|
|
37090
37090
|
const v = value.trim();
|
|
37091
|
-
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0,
|
|
37091
|
+
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0, _chunkPNSALBXHcjs.KordocError)(`${name} must be a #RRGGBB color (got "${value}")`);
|
|
37092
37092
|
return v.toUpperCase();
|
|
37093
37093
|
}
|
|
37094
37094
|
function resolveGongmun(input) {
|
|
@@ -37166,21 +37166,21 @@ function standardMarker(depth, n) {
|
|
|
37166
37166
|
case 0:
|
|
37167
37167
|
return `${n + 1}.`;
|
|
37168
37168
|
case 1:
|
|
37169
|
-
return `${
|
|
37169
|
+
return `${_chunkJFUUFJZWcjs.hangulOrdinal.call(void 0, n)}.`;
|
|
37170
37170
|
case 2:
|
|
37171
37171
|
return `${n + 1})`;
|
|
37172
37172
|
case 3:
|
|
37173
|
-
return `${
|
|
37173
|
+
return `${_chunkJFUUFJZWcjs.hangulOrdinal.call(void 0, n)})`;
|
|
37174
37174
|
case 4:
|
|
37175
37175
|
return `(${n + 1})`;
|
|
37176
37176
|
case 5:
|
|
37177
|
-
return `(${
|
|
37177
|
+
return `(${_chunkJFUUFJZWcjs.hangulOrdinal.call(void 0, n)})`;
|
|
37178
37178
|
case 6:
|
|
37179
|
-
return
|
|
37179
|
+
return _chunkJFUUFJZWcjs.circledNumber.call(void 0, n);
|
|
37180
37180
|
case 7:
|
|
37181
|
-
return
|
|
37181
|
+
return _chunkJFUUFJZWcjs.circledHangul.call(void 0, n);
|
|
37182
37182
|
default:
|
|
37183
|
-
return
|
|
37183
|
+
return _chunkJFUUFJZWcjs.circledHangul.call(void 0, n);
|
|
37184
37184
|
}
|
|
37185
37185
|
}
|
|
37186
37186
|
function reportMarker(depth, bullet2 = "\u25CB", asteriskThird = false) {
|
|
@@ -37834,7 +37834,7 @@ function parseInlineMarkdown(text) {
|
|
|
37834
37834
|
else spans.push(...emphasisSpans(m[0]));
|
|
37835
37835
|
} else {
|
|
37836
37836
|
const anchor = m[2] || m[3];
|
|
37837
|
-
const href = _nullishCoalesce(
|
|
37837
|
+
const href = _nullishCoalesce(_chunkPNSALBXHcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
37838
37838
|
const sub = emphasisSpans(anchor);
|
|
37839
37839
|
if (href) for (const s of sub) s.href = href;
|
|
37840
37840
|
spans.push(...sub);
|
|
@@ -38055,7 +38055,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
38055
38055
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
38056
38056
|
const got = m ? Number(m[1]) : NaN;
|
|
38057
38057
|
if (got !== startId + i) {
|
|
38058
|
-
throw new (0,
|
|
38058
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(
|
|
38059
38059
|
`\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)`
|
|
38060
38060
|
);
|
|
38061
38061
|
}
|
|
@@ -38146,7 +38146,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
38146
38146
|
}
|
|
38147
38147
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
38148
38148
|
if (rows.length !== expectedBase) {
|
|
38149
|
-
throw new (0,
|
|
38149
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(
|
|
38150
38150
|
`\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`
|
|
38151
38151
|
);
|
|
38152
38152
|
}
|
|
@@ -38654,7 +38654,7 @@ function variantMapper(fit, blockIdx, base = CHAR_VARIANT_BASE) {
|
|
|
38654
38654
|
const vi = fit.variants.indexOf(r);
|
|
38655
38655
|
return (id) => id >= 0 && id <= 3 ? base + vi * 4 + id : id;
|
|
38656
38656
|
}
|
|
38657
|
-
var ORDINAL_SYLLABLES = new Set(Array.from({ length: 84 }, (_, i) =>
|
|
38657
|
+
var ORDINAL_SYLLABLES = new Set(Array.from({ length: 84 }, (_, i) => _chunkJFUUFJZWcjs.hangulOrdinal.call(void 0, i)));
|
|
38658
38658
|
function literalMarkerDepth(text) {
|
|
38659
38659
|
const t = text.trimStart();
|
|
38660
38660
|
let m;
|
|
@@ -39155,7 +39155,7 @@ function bestSimInRange(arr, from, to, target) {
|
|
|
39155
39155
|
return best;
|
|
39156
39156
|
}
|
|
39157
39157
|
function normForMatch(text) {
|
|
39158
|
-
return
|
|
39158
|
+
return _chunkJFUUFJZWcjs.sanitizeText.call(void 0, text.replace(/\\\$/g, "$").replace(/\\(?=<\/?(?:u|sup|sub)>)/g, "")).replace(/\s+/g, " ").trim();
|
|
39159
39159
|
}
|
|
39160
39160
|
function unescapeGfm(text) {
|
|
39161
39161
|
return text.replace(/\\([~*_`|#<$\\])/g, "$1");
|
|
@@ -39177,7 +39177,7 @@ function replicateGfmTable(table2) {
|
|
|
39177
39177
|
const cell2 = _optionalChain([cells, 'access', _638 => _638[r], 'optionalAccess', _639 => _639[c]]);
|
|
39178
39178
|
if (!cell2) continue;
|
|
39179
39179
|
display[r][c] = {
|
|
39180
|
-
text:
|
|
39180
|
+
text: _chunkJFUUFJZWcjs.escapeGfm.call(void 0, _chunkJFUUFJZWcjs.sanitizeText.call(void 0, cell2.text)).replace(/(?<!\\)\|/g, "\\|").replace(/\r\n|\r|\n/g, "<br>"),
|
|
39181
39181
|
gridR: r,
|
|
39182
39182
|
gridC: c
|
|
39183
39183
|
};
|
|
@@ -39217,16 +39217,16 @@ function replicateCellInnerHtml(cell2) {
|
|
|
39217
39217
|
if (_optionalChain([cell2, 'access', _640 => _640.blocks, 'optionalAccess', _641 => _641.length])) {
|
|
39218
39218
|
return cell2.blocks.map((b) => {
|
|
39219
39219
|
if (b.type === "table" && b.table) {
|
|
39220
|
-
const cap = b.table.caption ?
|
|
39221
|
-
return (cap ?
|
|
39220
|
+
const cap = b.table.caption ? _chunkJFUUFJZWcjs.sanitizeText.call(void 0, b.table.caption) : "";
|
|
39221
|
+
return (cap ? _chunkJFUUFJZWcjs.escapeHtmlCellText.call(void 0, cap) + "<br>" : "") + replicateTableToHtml(b.table);
|
|
39222
39222
|
}
|
|
39223
|
-
if (b.type === "image" && b.text) return `<img src="${
|
|
39224
|
-
const note =
|
|
39225
|
-
const t = (
|
|
39226
|
-
return ((t ?
|
|
39223
|
+
if (b.type === "image" && b.text) return `<img src="${_chunkPNSALBXHcjs.escapeHtml.call(void 0, b.text, true)}" alt="image">`;
|
|
39224
|
+
const note = _chunkJFUUFJZWcjs.noteTableHtml.call(void 0, b);
|
|
39225
|
+
const t = (_chunkJFUUFJZWcjs.sanitizeText.call(void 0, _chunkJFUUFJZWcjs.visibleText.call(void 0, b)) + (note ? "" : _chunkJFUUFJZWcjs.noteSuffix.call(void 0, b))).trim();
|
|
39226
|
+
return ((t ? _chunkJFUUFJZWcjs.escapeHtmlCellText.call(void 0, t).replace(/\n/g, "<br>") : "") + note).trim();
|
|
39227
39227
|
}).filter(Boolean).join("<br>");
|
|
39228
39228
|
}
|
|
39229
|
-
return
|
|
39229
|
+
return _chunkJFUUFJZWcjs.escapeHtmlCellText.call(void 0, _chunkJFUUFJZWcjs.sanitizeText.call(void 0, cell2.text)).replace(/\n/g, "<br>");
|
|
39230
39230
|
}
|
|
39231
39231
|
function replicateTableToHtml(table2) {
|
|
39232
39232
|
const rows = replicateHtmlTable(table2);
|
|
@@ -39303,7 +39303,7 @@ function parseHtmlTable(raw) {
|
|
|
39303
39303
|
const cs = parseInt(_optionalChain([attrs, 'access', _644 => _644.match, 'call', _645 => _645(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _646 => _646[1]]) || "1", 10);
|
|
39304
39304
|
const rs = parseInt(_optionalChain([attrs, 'access', _647 => _647.match, 'call', _648 => _648(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _649 => _649[1]]) || "1", 10);
|
|
39305
39305
|
cellStart = m.index + m[0].length;
|
|
39306
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
39306
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkJFUUFJZWcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkJFUUFJZWcjs.MAX_ROWS) };
|
|
39307
39307
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
39308
39308
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
39309
39309
|
cellStart = -1;
|
|
@@ -39328,11 +39328,11 @@ function htmlCellInnerToLines(inner) {
|
|
|
39328
39328
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
39329
39329
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
39330
39330
|
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _650 => _650[1]]), () => ( _optionalChain([m, 'optionalAccess', _651 => _651[2]])));
|
|
39331
|
-
if (src) imgSrcs.push(
|
|
39331
|
+
if (src) imgSrcs.push(_chunkPNSALBXHcjs.unescapeHtml.call(void 0, src));
|
|
39332
39332
|
return "";
|
|
39333
39333
|
});
|
|
39334
39334
|
}
|
|
39335
|
-
const lines = work.split(/<br\s*\/?>/gi).map((s) =>
|
|
39335
|
+
const lines = work.split(/<br\s*\/?>/gi).map((s) => _chunkPNSALBXHcjs.unescapeHtml.call(void 0, s).trim()).filter((s) => s.length > 0);
|
|
39336
39336
|
return { lines, hadNonText, imgSrcs };
|
|
39337
39337
|
}
|
|
39338
39338
|
function splitCellByTopLevelTables(html) {
|
|
@@ -40163,8 +40163,8 @@ function layoutHtmlRows(rows) {
|
|
|
40163
40163
|
let c = 0;
|
|
40164
40164
|
for (const cell2 of rows[r].cells) {
|
|
40165
40165
|
while (occupied.has(`${r},${c}`)) c++;
|
|
40166
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
40167
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
40166
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkJFUUFJZWcjs.MAX_COLS);
|
|
40167
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkJFUUFJZWcjs.MAX_ROWS);
|
|
40168
40168
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
40169
40169
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
40170
40170
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -41629,7 +41629,7 @@ function buildMinistryItemBand(n, text, ctx, before2) {
|
|
|
41629
41629
|
const base = { font: MINISTRY.bandFont, pt: s.pt, bold: false };
|
|
41630
41630
|
const f = fitOneLine(plain(text), MINISTRY.bandFont, s.pt, w - 1800, s.pt);
|
|
41631
41631
|
const styled = f.overflow || f.ratio === 100 && f.spacing === 0 ? base : { ...base, ratio: f.ratio, spacing: f.spacing };
|
|
41632
|
-
const runs = ministryRuns(
|
|
41632
|
+
const runs = ministryRuns(_chunkJFUUFJZWcjs.circledNumber.call(void 0, n - 1), text, ctx, styled, MINISTRY.blue, MINISTRY.blue);
|
|
41633
41633
|
const p = reg.para({ align: "LEFT", lineSp: 130, left: 300 });
|
|
41634
41634
|
const cell2 = tc({ bf: band, row: 0, col: 0, w, h: s.h, paras: `<hp:p paraPrIDRef="${p}" styleIDRef="0">${runs}</hp:p>`, name: "__kordoc_h5" });
|
|
41635
41635
|
return host(ftbl([cell2], w, s.h, 1, { bottomGap: 700 }), reg.para({ align: "LEFT", lineSp: 100, before: before2, keepWithNext: true }), reg.char(base));
|
|
@@ -42832,33 +42832,33 @@ async function readText(zip, name, budget) {
|
|
|
42832
42832
|
return s;
|
|
42833
42833
|
}
|
|
42834
42834
|
function assertWellFormed(xml, name) {
|
|
42835
|
-
if (xml.length > MAX_XML) throw new (0,
|
|
42836
|
-
if (/<!DOCTYPE/i.test(xml)) throw new (0,
|
|
42835
|
+
if (xml.length > MAX_XML) throw new (0, _chunkPNSALBXHcjs.KordocError)(`\uACAC\uBCF8 ${name} \uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4 (${(xml.length / 1048576).toFixed(1)}MB)`);
|
|
42836
|
+
if (/<!DOCTYPE/i.test(xml)) throw new (0, _chunkPNSALBXHcjs.KordocError)(`\uACAC\uBCF8 ${name} \uC5D0 DOCTYPE \uC774 \uC788\uC2B5\uB2C8\uB2E4 \u2014 \uD55C\uAE00 \uC800\uC7A5\uBCF8\uC774 \uC544\uB2D9\uB2C8\uB2E4`);
|
|
42837
42837
|
const issues = [];
|
|
42838
42838
|
createXmlParser(issues).parseFromString(xml, "text/xml");
|
|
42839
|
-
if (issues.some((w) => !/경고/.test(w.message))) throw new (0,
|
|
42839
|
+
if (issues.some((w) => !/경고/.test(w.message))) throw new (0, _chunkPNSALBXHcjs.KordocError)(`\uACAC\uBCF8 ${name} XML \uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4: ${issues[0].message}`);
|
|
42840
42840
|
}
|
|
42841
42841
|
async function loadTemplateZip(template) {
|
|
42842
42842
|
const buf = template instanceof Uint8Array ? template.buffer.slice(template.byteOffset, template.byteOffset + template.byteLength) : template;
|
|
42843
|
-
|
|
42843
|
+
_chunkPNSALBXHcjs.precheckZipSize.call(void 0, buf, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
42844
42844
|
let zip;
|
|
42845
42845
|
try {
|
|
42846
42846
|
zip = await _jszip2.default.loadAsync(buf);
|
|
42847
42847
|
} catch (e40) {
|
|
42848
|
-
throw new (0,
|
|
42848
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("\uACAC\uBCF8\uC774 HWPX(zip)\uAC00 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uD55C\uAE00\uC5D0\uC11C .hwpx \uB85C \uC800\uC7A5\uD55C \uD30C\uC77C\uC744 \uC4F0\uC138\uC694 (.hwp \uB294 kordoc \uC73C\uB85C \uBA3C\uC800 \uBCC0\uD658)");
|
|
42849
42849
|
}
|
|
42850
42850
|
const names = Object.keys(zip.files);
|
|
42851
|
-
if (names.length > MAX_ZIP_ENTRIES) throw new (0,
|
|
42851
|
+
if (names.length > MAX_ZIP_ENTRIES) throw new (0, _chunkPNSALBXHcjs.KordocError)("\uACAC\uBCF8 ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
42852
42852
|
const bad = names.find((n) => n.split("/").includes("..") || n.startsWith("/") || n.includes("\\") || /^[A-Za-z]:/.test(n));
|
|
42853
|
-
if (bad) throw new (0,
|
|
42853
|
+
if (bad) throw new (0, _chunkPNSALBXHcjs.KordocError)(`\uACAC\uBCF8 ZIP \uC5D0 \uD5C8\uC6A9\uD558\uC9C0 \uC54A\uB294 \uACBD\uB85C\uAC00 \uC788\uC2B5\uB2C8\uB2E4: ${bad.slice(0, 80)}`);
|
|
42854
42854
|
const budget = { used: 0 };
|
|
42855
42855
|
const manifest = zip.file("META-INF/manifest.xml");
|
|
42856
42856
|
if (manifest && isEncryptedHwpx(await readText(zip, "META-INF/manifest.xml", budget))) {
|
|
42857
|
-
throw new (0,
|
|
42857
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("\uC554\uD638\uAC00 \uAC78\uB9B0 \uACAC\uBCF8\uC785\uB2C8\uB2E4 \u2014 \uD55C\uAE00\uC5D0\uC11C \uC554\uD638\uB97C \uD480\uACE0 \uC800\uC7A5\uD55C \uD30C\uC77C\uC744 \uC4F0\uC138\uC694");
|
|
42858
42858
|
}
|
|
42859
42859
|
const sections = await resolveSectionPaths(zip);
|
|
42860
42860
|
if (!sections.length || !zip.file(sections[0]) || !zip.file("Contents/header.xml")) {
|
|
42861
|
-
throw new (0,
|
|
42861
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("\uACAC\uBCF8 HWPX \uC5D0 Contents/header.xml \uB610\uB294 section0.xml \uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
42862
42862
|
}
|
|
42863
42863
|
const sectionXml = await readText(zip, sections[0], budget);
|
|
42864
42864
|
const headerXml = await readText(zip, "Contents/header.xml", budget);
|
|
@@ -43022,7 +43022,7 @@ var FAMILY_ROLE = {
|
|
|
43022
43022
|
var SYM_EXTRA = /^(?:\p{S}|[【〔〈《])$/u;
|
|
43023
43023
|
var SUBTITLE_RE = /^-\s.*\s-$/u;
|
|
43024
43024
|
function lineRole(plain4) {
|
|
43025
|
-
const t =
|
|
43025
|
+
const t = _chunkJFUUFJZWcjs.mapPuaText.call(void 0, plain4.replace(/^[\s ]+/, ""));
|
|
43026
43026
|
if (!t || SUBTITLE_RE.test(t.trim())) return null;
|
|
43027
43027
|
const cls = markerClass(t);
|
|
43028
43028
|
if (FAMILY_ROLE[cls]) return FAMILY_ROLE[cls];
|
|
@@ -43057,7 +43057,7 @@ function fillParagraph(pXml, text, opts = {}) {
|
|
|
43057
43057
|
let prefixLen = ws, mStart = -1, mLen = 0;
|
|
43058
43058
|
if (opts.marker && ws < plain4.length) {
|
|
43059
43059
|
const cp = String.fromCodePoint(plain4.codePointAt(ws));
|
|
43060
|
-
if (isMarkerChar(
|
|
43060
|
+
if (isMarkerChar(_chunkJFUUFJZWcjs.mapPuaText.call(void 0, cp))) {
|
|
43061
43061
|
mStart = ws;
|
|
43062
43062
|
mLen = cp.length;
|
|
43063
43063
|
prefixLen = ws + mLen + /^[\s ]*/.exec(plain4.slice(ws + mLen))[0].length;
|
|
@@ -43286,7 +43286,7 @@ function scanTemplate(sectionXml, headerXml) {
|
|
|
43286
43286
|
const t = infos[titleIdx].tbl;
|
|
43287
43287
|
contactInTitle = !!t && t.cells.some((c) => CONTACT_RE.test(c.text));
|
|
43288
43288
|
}
|
|
43289
|
-
const subIdx = _nullishCoalesce(_optionalChain([head, 'access', _809 => _809.find, 'call', _810 => _810(({ x, i }) => i !== titleIdx && !x.tbl && x.objs === 0 && SUBTITLE_RE.test(
|
|
43289
|
+
const subIdx = _nullishCoalesce(_optionalChain([head, 'access', _809 => _809.find, 'call', _810 => _810(({ x, i }) => i !== titleIdx && !x.tbl && x.objs === 0 && SUBTITLE_RE.test(_chunkJFUUFJZWcjs.mapPuaText.call(void 0, x.plain.trim()))), 'optionalAccess', _811 => _811.i]), () => ( -1));
|
|
43290
43290
|
if (subIdx >= 0) set("subtitle", subIdx);
|
|
43291
43291
|
const summaryIdx = _nullishCoalesce(_optionalChain([head, 'access', _812 => _812.find, 'call', _813 => _813(({ x, i }) => i > titleIdx && _optionalChain([x, 'access', _814 => _814.tbl, 'optionalAccess', _815 => _815.rowCnt]) === 1 && x.tbl.colCnt === 1 && !CONTACT_RE.test(_nullishCoalesce(_optionalChain([x, 'access', _816 => _816.tbl, 'access', _817 => _817.cells, 'access', _818 => _818[0], 'optionalAccess', _819 => _819.text]), () => ( "")))), 'optionalAccess', _820 => _820.i]), () => ( -1));
|
|
43292
43292
|
if (summaryIdx >= 0) set("summary", summaryIdx);
|
|
@@ -43838,7 +43838,7 @@ async function markdownToHwpxFromTemplate(markdown, template, warnings = [], tot
|
|
|
43838
43838
|
let nextId = 1 + maxOf2(objIds);
|
|
43839
43839
|
let z = 1 + maxOf2([...scan.head.matchAll(OBJ_TAG_RE)].map((m) => Number(_nullishCoalesce(_optionalChain([/\bzOrder="(\d{1,10})"/, 'access', _885 => _885.exec, 'call', _886 => _886(m[0]), 'optionalAccess', _887 => _887[1]]), () => ( -1)))), -1);
|
|
43840
43840
|
const body = paras.join("").replace(OBJ_TAG_RE, (tag) => tag.replace(/\bid="\d*"/, () => `id="${nextId++}"`).replace(/\binstid="\d*"/, () => `instid="${nextId++}"`).replace(/\bzOrder="-?\d+"/, () => `zOrder="${z++}"`));
|
|
43841
|
-
if (body.length > MAX_OUTPUT) throw new (0,
|
|
43841
|
+
if (body.length > MAX_OUTPUT) throw new (0, _chunkPNSALBXHcjs.KordocError)(`\uC0DD\uC131 \uBCF8\uBB38\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4 (${(body.length / 1048576).toFixed(1)}MB) \u2014 \uC6D0\uACE0\uB97C \uB098\uB220 \uB9CC\uB4DC\uC138\uC694`);
|
|
43842
43842
|
const tops = topLevelParagraphs(sectionXml);
|
|
43843
43843
|
const newSection = sectionXml.slice(0, _nullishCoalesce(_optionalChain([tops, 'access', _888 => _888[0], 'optionalAccess', _889 => _889.start]), () => ( sectionXml.lastIndexOf("</")))) + body + sectionXml.slice(_nullishCoalesce(_optionalChain([tops, 'access', _890 => _890.at, 'call', _891 => _891(-1), 'optionalAccess', _892 => _892.end]), () => ( sectionXml.lastIndexOf("</"))));
|
|
43844
43844
|
let newHeader = appendHeader(ctx);
|
|
@@ -44153,7 +44153,7 @@ function builtinTemplateDir() {
|
|
|
44153
44153
|
for (const c of candidates) {
|
|
44154
44154
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
44155
44155
|
}
|
|
44156
|
-
throw new (0,
|
|
44156
|
+
throw new (0, _chunkPNSALBXHcjs.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)");
|
|
44157
44157
|
}
|
|
44158
44158
|
function readBuiltinTemplate(t) {
|
|
44159
44159
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -44631,12 +44631,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
44631
44631
|
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>`;
|
|
44632
44632
|
}
|
|
44633
44633
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
44634
|
-
if (ops.length === 0) throw new (0,
|
|
44634
|
+
if (ops.length === 0) throw new (0, _chunkPNSALBXHcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
44635
44635
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
44636
|
-
|
|
44636
|
+
_chunkPNSALBXHcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
44637
44637
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
44638
44638
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _1032 => _1032.match, 'call', _1033 => _1033(/(\d+)\.xml$/i), 'optionalAccess', _1034 => _1034[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _1035 => _1035.match, 'call', _1036 => _1036(/(\d+)\.xml$/i), 'optionalAccess', _1037 => _1037[1]]), () => ( 0))));
|
|
44639
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
44639
|
+
if (sectionPaths.length === 0) throw new (0, _chunkPNSALBXHcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
44640
44640
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
44641
44641
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
44642
44642
|
const styles = headerPath ? parseRenderStyles(await readZipEntry(zip.file(headerPath), "text")) : null;
|
|
@@ -44677,11 +44677,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
44677
44677
|
const manifestItems = [];
|
|
44678
44678
|
const placed = [];
|
|
44679
44679
|
for (const op of ops) {
|
|
44680
|
-
if (!op.anchor) throw new (0,
|
|
44681
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
44680
|
+
if (!op.anchor) throw new (0, _chunkPNSALBXHcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
44681
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkPNSALBXHcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
44682
44682
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
44683
|
-
if (!MIME[ext]) throw new (0,
|
|
44684
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
44683
|
+
if (!MIME[ext]) throw new (0, _chunkPNSALBXHcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
44684
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkPNSALBXHcjs.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)`);
|
|
44685
44685
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
44686
44686
|
let found = null;
|
|
44687
44687
|
let total = 0;
|
|
@@ -44714,7 +44714,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
44714
44714
|
}
|
|
44715
44715
|
}
|
|
44716
44716
|
}
|
|
44717
|
-
throw new (0,
|
|
44717
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(
|
|
44718
44718
|
`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)})`
|
|
44719
44719
|
);
|
|
44720
44720
|
}
|
|
@@ -44722,7 +44722,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
44722
44722
|
const xml = sectionXmls[si];
|
|
44723
44723
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
44724
44724
|
if (!run) {
|
|
44725
|
-
throw new (0,
|
|
44725
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
44726
44726
|
}
|
|
44727
44727
|
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _1038 => _1038.charPr, 'access', _1039 => _1039.get, 'call', _1040 => _1040(run.charPr), 'optionalAccess', _1041 => _1041.height]), () => ( 1e3));
|
|
44728
44728
|
const fontPt = charPrHeight / 100;
|
|
@@ -45000,7 +45000,7 @@ function pick(map, keys) {
|
|
|
45000
45000
|
return out;
|
|
45001
45001
|
}
|
|
45002
45002
|
async function hwpxToProfile(input) {
|
|
45003
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
45003
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkPNSALBXHcjs.toArrayBuffer.call(void 0, input);
|
|
45004
45004
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
45005
45005
|
const parser = createXmlParser();
|
|
45006
45006
|
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _1066 => _1066.file, 'call', _1067 => _1067(/[Hh]eader\.xml$/), 'optionalAccess', _1068 => _1068[0]])));
|
|
@@ -45328,7 +45328,7 @@ function moneyHangulCheck(m) {
|
|
|
45328
45328
|
const n = Number(m[1].replace(/,/g, ""));
|
|
45329
45329
|
const h = hangulToNumber(m[2].replace(/\s/g, ""));
|
|
45330
45330
|
if (!Number.isFinite(n) || h === null || h === n) return null;
|
|
45331
|
-
return `\uAE08${m[1]}\uC6D0(\uAE08${
|
|
45331
|
+
return `\uAE08${m[1]}\uC6D0(\uAE08${_chunkJFUUFJZWcjs.hangulAmount.call(void 0, n)}\uC6D0)`;
|
|
45332
45332
|
}
|
|
45333
45333
|
var RULES = [
|
|
45334
45334
|
// 날짜 ─ 온점 뒤 한 칸, 0 패딩 금지, 연도 4자리, 끝 마침표
|
|
@@ -45625,7 +45625,7 @@ function lintGongmunText(text, opts) {
|
|
|
45625
45625
|
}
|
|
45626
45626
|
function dictSuggest(code, match) {
|
|
45627
45627
|
const m = match.trim();
|
|
45628
|
-
if (code === "MONEY_NO_HANGUL") return `${m} \u2192 ${m}(\uAE08${
|
|
45628
|
+
if (code === "MONEY_NO_HANGUL") return `${m} \u2192 ${m}(\uAE08${_chunkJFUUFJZWcjs.hangulAmount.call(void 0, m)}\uC6D0)`;
|
|
45629
45629
|
if (code === "DATE_HYPHEN") {
|
|
45630
45630
|
const d = m.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);
|
|
45631
45631
|
if (d) return `${m} \u2192 ${d[1]}. ${Number(d[2])}. ${Number(d[3])}.`;
|
|
@@ -46943,7 +46943,7 @@ function patchTableRows(input) {
|
|
|
46943
46943
|
const cells = input.editedCells(ins.ei);
|
|
46944
46944
|
if (!cells) return skip("\uC0BD\uC785 \uD589\uC5D0 \uC774\uBBF8\uC9C0/\uC911\uCCA9\uD45C \uD3EC\uD568 \u2014 \uD589 \uCD94\uAC00 \uBBF8\uC9C0\uC6D0");
|
|
46945
46945
|
for (const cell2 of cells) {
|
|
46946
|
-
const unstable = cell2.lines.find((l) =>
|
|
46946
|
+
const unstable = cell2.lines.find((l) => _chunkJFUUFJZWcjs.sanitizeText.call(void 0, l) !== l);
|
|
46947
46947
|
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");
|
|
46948
46948
|
}
|
|
46949
46949
|
const tmplCells = scanTable.rows[template];
|
|
@@ -47138,14 +47138,14 @@ function buildEmbeddedLineSplices(para2, xml, newLines) {
|
|
|
47138
47138
|
}
|
|
47139
47139
|
if (text !== para2.text || !/[\r\n]/.test(text) || /<br\s*\/?\s*>/i.test(text)) return null;
|
|
47140
47140
|
const lines = text.split(/\r\n|\r|\n/);
|
|
47141
|
-
if (lines.length !== newLines.length || lines.some((line) => !line.trim() ||
|
|
47141
|
+
if (lines.length !== newLines.length || lines.some((line) => !line.trim() || _chunkJFUUFJZWcjs.sanitizeText.call(void 0, line) !== line.trim())) return null;
|
|
47142
47142
|
const splices = [];
|
|
47143
47143
|
let offset = 0;
|
|
47144
47144
|
for (let i = 0; i < lines.length; i++) {
|
|
47145
47145
|
const line = lines[i];
|
|
47146
47146
|
const orig = line.trim();
|
|
47147
47147
|
const next = newLines[i];
|
|
47148
|
-
if (
|
|
47148
|
+
if (_chunkJFUUFJZWcjs.sanitizeText.call(void 0, next) !== next || /[\r\n]/.test(next) || /[\uD800-\uDFFF]/u.test(next) || decodeXmlEntities(escapeXmlText(next)) !== next) return null;
|
|
47149
47149
|
let prefix = 0;
|
|
47150
47150
|
while (prefix < orig.length && prefix < next.length && orig[prefix] === next[prefix]) prefix++;
|
|
47151
47151
|
if (prefix > 0 && /[\uD800-\uDBFF]/.test(orig[prefix - 1]) && /[\uDC00-\uDFFF]/.test(_nullishCoalesce(orig[prefix], () => ( "")))) prefix--;
|
|
@@ -47382,12 +47382,12 @@ function stripCellTokens(text) {
|
|
|
47382
47382
|
}
|
|
47383
47383
|
function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
47384
47384
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
47385
|
-
const content =
|
|
47385
|
+
const content = _chunkJFUUFJZWcjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
47386
47386
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
47387
47387
|
const t = line.trim();
|
|
47388
47388
|
if (!t) return "";
|
|
47389
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
47390
|
-
return
|
|
47389
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkJFUUFJZWcjs.escapeGfm.call(void 0, t)}**`;
|
|
47390
|
+
return _chunkJFUUFJZWcjs.escapeGfm.call(void 0, t);
|
|
47391
47391
|
}).filter(Boolean);
|
|
47392
47392
|
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");
|
|
47393
47393
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -47401,7 +47401,7 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
47401
47401
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
47402
47402
|
const replica = [];
|
|
47403
47403
|
for (let r = 0; r < table2.rows; r++) {
|
|
47404
|
-
const line =
|
|
47404
|
+
const line = _chunkJFUUFJZWcjs.escapeGfm.call(void 0, _chunkJFUUFJZWcjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
47405
47405
|
if (line) replica.push({ line, gridR: r });
|
|
47406
47406
|
}
|
|
47407
47407
|
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");
|
|
@@ -47455,7 +47455,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
47455
47455
|
}
|
|
47456
47456
|
const splices = [];
|
|
47457
47457
|
let sectionIndex = -1;
|
|
47458
|
-
const unstable = newLines.find((l) =>
|
|
47458
|
+
const unstable = newLines.find((l) => _chunkJFUUFJZWcjs.sanitizeText.call(void 0, l) !== l);
|
|
47459
47459
|
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");
|
|
47460
47460
|
if (ctx.structure && newLines.length > Math.max(nonEmpty.length, 1) || ctx.structure && nonEmpty.length > 1 && newLines.length < nonEmpty.length) {
|
|
47461
47461
|
const done = restructureCellLines(cell2.paragraphs, newLines, ctx.scans, ctx.sectionSplices, normForMatch);
|
|
@@ -47522,7 +47522,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
47522
47522
|
const paths = parseSectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
47523
47523
|
if (paths.length > 0) return paths;
|
|
47524
47524
|
}
|
|
47525
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
47525
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkPNSALBXHcjs.compareSectionPaths);
|
|
47526
47526
|
}
|
|
47527
47527
|
|
|
47528
47528
|
// src/roundtrip/hwp5-patch.ts
|
|
@@ -48318,7 +48318,7 @@ function patchParagraph(block, orig, edited, ctx, skip) {
|
|
|
48318
48318
|
}
|
|
48319
48319
|
const origPlain = block.text != null ? block.text : restoreBr(textUnitToPlain(orig.raw, block));
|
|
48320
48320
|
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");
|
|
48321
|
-
if (
|
|
48321
|
+
if (_chunkJFUUFJZWcjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
48322
48322
|
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");
|
|
48323
48323
|
}
|
|
48324
48324
|
let origMd = restoreBr(textUnitToPlain(orig.raw, block));
|
|
@@ -48365,7 +48365,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
48365
48365
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
48366
48366
|
continue;
|
|
48367
48367
|
}
|
|
48368
|
-
if (afterEach.some((l) =>
|
|
48368
|
+
if (afterEach.some((l) => _chunkJFUUFJZWcjs.sanitizeText.call(void 0, l) !== l)) {
|
|
48369
48369
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
48370
48370
|
continue;
|
|
48371
48371
|
}
|
|
@@ -48393,7 +48393,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
48393
48393
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
48394
48394
|
break;
|
|
48395
48395
|
}
|
|
48396
|
-
if (
|
|
48396
|
+
if (_chunkJFUUFJZWcjs.sanitizeText.call(void 0, after2) !== after2) {
|
|
48397
48397
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
48398
48398
|
break;
|
|
48399
48399
|
}
|
|
@@ -48449,12 +48449,12 @@ function patchHtmlCells5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
48449
48449
|
}
|
|
48450
48450
|
function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
48451
48451
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
48452
|
-
const content =
|
|
48452
|
+
const content = _chunkJFUUFJZWcjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
48453
48453
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
48454
48454
|
const t = line.trim();
|
|
48455
48455
|
if (!t) return "";
|
|
48456
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
48457
|
-
return
|
|
48456
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkJFUUFJZWcjs.escapeGfm.call(void 0, t)}**`;
|
|
48457
|
+
return _chunkJFUUFJZWcjs.escapeGfm.call(void 0, t);
|
|
48458
48458
|
}).filter(Boolean);
|
|
48459
48459
|
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");
|
|
48460
48460
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -48468,7 +48468,7 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
48468
48468
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
48469
48469
|
const replica = [];
|
|
48470
48470
|
for (let r = 0; r < table2.rows; r++) {
|
|
48471
|
-
const line =
|
|
48471
|
+
const line = _chunkJFUUFJZWcjs.escapeGfm.call(void 0, _chunkJFUUFJZWcjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
48472
48472
|
if (line) replica.push({ line, gridR: r });
|
|
48473
48473
|
}
|
|
48474
48474
|
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");
|
|
@@ -48509,7 +48509,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
48509
48509
|
if (origLineCount !== void 0 && nonEmpty.length > 0 && origLineCount !== nonEmpty.length) {
|
|
48510
48510
|
return skip("\uC140 \uC904 \uACBD\uACC4 \uB9E4\uD551 \uBAA8\uD638 (\uBB38\uB2E8 \uB0B4 \uC904\uBC14\uAFC8) \u2014 \uBBF8\uC9C0\uC6D0");
|
|
48511
48511
|
}
|
|
48512
|
-
const unstable = newLines.find((l) =>
|
|
48512
|
+
const unstable = newLines.find((l) => _chunkJFUUFJZWcjs.sanitizeText.call(void 0, l) !== l);
|
|
48513
48513
|
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");
|
|
48514
48514
|
const targets = nonEmpty.length > 0 ? nonEmpty : cell2.paras;
|
|
48515
48515
|
if (targets.length === 0) return skip("\uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC74C \u2014 \uBBF8\uC9C0\uC6D0");
|
|
@@ -48924,12 +48924,12 @@ function buildOrigUnits(blocks) {
|
|
|
48924
48924
|
const block = blocks[i];
|
|
48925
48925
|
let consume = 1;
|
|
48926
48926
|
let chunk;
|
|
48927
|
-
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(
|
|
48927
|
+
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(_chunkJFUUFJZWcjs.sanitizeText.call(void 0, block.text))) {
|
|
48928
48928
|
const next = blocks[i + 1];
|
|
48929
48929
|
if (_optionalChain([next, 'optionalAccess', _1170 => _1170.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
48930
|
-
chunk =
|
|
48930
|
+
chunk = _chunkJFUUFJZWcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
48931
48931
|
} else {
|
|
48932
|
-
chunk =
|
|
48932
|
+
chunk = _chunkJFUUFJZWcjs.blocksToMarkdown.call(void 0, [block]);
|
|
48933
48933
|
}
|
|
48934
48934
|
if (chunk) {
|
|
48935
48935
|
const subUnits = splitMarkdownUnits(chunk);
|
|
@@ -49227,7 +49227,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
49227
49227
|
}
|
|
49228
49228
|
}
|
|
49229
49229
|
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");
|
|
49230
|
-
if (
|
|
49230
|
+
if (_chunkJFUUFJZWcjs.sanitizeText.call(void 0, newPlain) !== newPlain && _chunkJFUUFJZWcjs.sanitizeText.call(void 0, origPlain) === origPlain) {
|
|
49231
49231
|
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");
|
|
49232
49232
|
}
|
|
49233
49233
|
const xml = _optionalChain([ctx, 'access', _1184 => _1184.scans, 'access', _1185 => _1185[mapping.para.sectionIndex], 'optionalAccess', _1186 => _1186.xml]);
|
|
@@ -49244,14 +49244,14 @@ function textUnitToPlain(raw, block) {
|
|
|
49244
49244
|
}
|
|
49245
49245
|
function textUnitInline(raw, block) {
|
|
49246
49246
|
let text = raw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
49247
|
-
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(
|
|
49247
|
+
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(_chunkJFUUFJZWcjs.sanitizeText.call(void 0, block.text))) {
|
|
49248
49248
|
text = text.replace(/^#{1,6}\s+/, "");
|
|
49249
49249
|
}
|
|
49250
49250
|
if (block.href) {
|
|
49251
49251
|
const linkMatch = text.match(/^\[([\s\S]*)\]\([^)]*\)$/);
|
|
49252
49252
|
if (linkMatch) text = linkMatch[1];
|
|
49253
49253
|
}
|
|
49254
|
-
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(
|
|
49254
|
+
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(_chunkJFUUFJZWcjs.sanitizeText.call(void 0, block.text))) {
|
|
49255
49255
|
text = text.slice(1, -1);
|
|
49256
49256
|
}
|
|
49257
49257
|
return text;
|
|
@@ -51802,7 +51802,7 @@ function blocksToChunks(blocks, options) {
|
|
|
51802
51802
|
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1217 => _1217.granularity]), () => ( "section"));
|
|
51803
51803
|
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1218 => _1218.includeTableCells]), () => ( false));
|
|
51804
51804
|
const mdOptions = { tableFormat: _optionalChain([options, 'optionalAccess', _1219 => _1219.tableFormat]) };
|
|
51805
|
-
if (_optionalChain([options, 'optionalAccess', _1220 => _1220.tableFormat]) === "gfm")
|
|
51805
|
+
if (_optionalChain([options, 'optionalAccess', _1220 => _1220.tableFormat]) === "gfm") _chunkJFUUFJZWcjs.assignTableIds.call(void 0, blocks);
|
|
51806
51806
|
const chunks = [];
|
|
51807
51807
|
const headingStack = [];
|
|
51808
51808
|
const listStack = [];
|
|
@@ -51816,12 +51816,12 @@ function blocksToChunks(blocks, options) {
|
|
|
51816
51816
|
let run = null;
|
|
51817
51817
|
const flushRun = () => {
|
|
51818
51818
|
if (!run) return;
|
|
51819
|
-
push("text", run.breadcrumb,
|
|
51819
|
+
push("text", run.breadcrumb, _chunkJFUUFJZWcjs.blocksToMarkdown.call(void 0, run.blocks, mdOptions), [run.start, run.end], run.page);
|
|
51820
51820
|
run = null;
|
|
51821
51821
|
};
|
|
51822
51822
|
for (let i = 0; i < blocks.length; i++) {
|
|
51823
51823
|
const block = blocks[i];
|
|
51824
|
-
const md2 =
|
|
51824
|
+
const md2 = _chunkJFUUFJZWcjs.blocksToMarkdown.call(void 0, [block], mdOptions);
|
|
51825
51825
|
if (!md2) continue;
|
|
51826
51826
|
if (block.type === "heading") {
|
|
51827
51827
|
flushRun();
|
|
@@ -51909,7 +51909,7 @@ function u8ToArrayBuffer2(u8) {
|
|
|
51909
51909
|
return u8.buffer.slice(u8.byteOffset, u8.byteOffset + u8.byteLength);
|
|
51910
51910
|
}
|
|
51911
51911
|
function irCellLines(text) {
|
|
51912
|
-
return stripCellTokens(
|
|
51912
|
+
return stripCellTokens(_chunkJFUUFJZWcjs.sanitizeText.call(void 0, text)).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
51913
51913
|
}
|
|
51914
51914
|
var HwpxSession = (_class10 = class _HwpxSession {
|
|
51915
51915
|
|
|
@@ -52169,7 +52169,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
52169
52169
|
if (newPlain === "") {
|
|
52170
52170
|
return skip("\uBE14\uB85D \uBE44\uC6B0\uAE30/\uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 (v1) \u2014 \uC6D0\uBCF8 \uC720\uC9C0");
|
|
52171
52171
|
}
|
|
52172
|
-
if (
|
|
52172
|
+
if (_chunkJFUUFJZWcjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
52173
52173
|
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");
|
|
52174
52174
|
}
|
|
52175
52175
|
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _1240 => _1240.scans, 'access', _1241 => _1241[mapping.para.sectionIndex], 'optionalAccess', _1242 => _1242.xml]));
|
|
@@ -52264,7 +52264,7 @@ var md = new (0, _markdownit2.default)({
|
|
|
52264
52264
|
});
|
|
52265
52265
|
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;
|
|
52266
52266
|
function sanitizeRawHtml(raw) {
|
|
52267
|
-
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag :
|
|
52267
|
+
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag : _chunkPNSALBXHcjs.escapeHtml.call(void 0, tag));
|
|
52268
52268
|
}
|
|
52269
52269
|
md.renderer.rules.html_block = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
52270
52270
|
md.renderer.rules.html_inline = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
@@ -52272,7 +52272,7 @@ function renderHtml(markdown, options) {
|
|
|
52272
52272
|
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1246 => _1246.preset]), () => ( "default"));
|
|
52273
52273
|
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _1247 => _1247.extraCss]), () => ( "")));
|
|
52274
52274
|
const body = md.render(markdown);
|
|
52275
|
-
const watermark = _optionalChain([options, 'optionalAccess', _1248 => _1248.watermark]) ? `<div class="watermark">${
|
|
52275
|
+
const watermark = _optionalChain([options, 'optionalAccess', _1248 => _1248.watermark]) ? `<div class="watermark">${_chunkPNSALBXHcjs.escapeHtml.call(void 0, options.watermark)}</div>` : "";
|
|
52276
52276
|
const watermarkCss = _optionalChain([options, 'optionalAccess', _1249 => _1249.watermark]) ? `
|
|
52277
52277
|
.watermark {
|
|
52278
52278
|
position: fixed;
|
|
@@ -52326,13 +52326,13 @@ async function htmlToPdf(html, options) {
|
|
|
52326
52326
|
try {
|
|
52327
52327
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
52328
52328
|
} catch (e43) {
|
|
52329
|
-
throw new (0,
|
|
52329
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(
|
|
52330
52330
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
52331
52331
|
);
|
|
52332
52332
|
}
|
|
52333
52333
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
52334
52334
|
if (!executablePath) {
|
|
52335
|
-
throw new (0,
|
|
52335
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(
|
|
52336
52336
|
"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."
|
|
52337
52337
|
);
|
|
52338
52338
|
}
|
|
@@ -52387,7 +52387,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
52387
52387
|
return htmlToPdf(html, options);
|
|
52388
52388
|
}
|
|
52389
52389
|
async function blocksToPdf(blocks, options) {
|
|
52390
|
-
const markdown =
|
|
52390
|
+
const markdown = _chunkJFUUFJZWcjs.blocksToMarkdown.call(void 0, blocks);
|
|
52391
52391
|
return markdownToPdf(markdown, options);
|
|
52392
52392
|
}
|
|
52393
52393
|
|
|
@@ -52465,7 +52465,7 @@ function tableColumnBoundaries(constraints, count, total, noExactRow = false) {
|
|
|
52465
52465
|
const lp = longestPathBoundaries(constraints, count);
|
|
52466
52466
|
return lp && Math.abs(lp.x[count] - total) <= 2 && (noExactRow || lp.x.every((v, k) => Math.abs(v - prop[k]) <= 2 || lp.tight[k])) ? lp.x : prop;
|
|
52467
52467
|
}
|
|
52468
|
-
function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY) {
|
|
52468
|
+
function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY, shrinkLast = false) {
|
|
52469
52469
|
const h = new Array(rowCount).fill(0);
|
|
52470
52470
|
for (const c of cells) {
|
|
52471
52471
|
if (c.rowSpan === 1 && c.rowAddr >= 0 && c.rowAddr < rowCount) {
|
|
@@ -52512,6 +52512,9 @@ function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY) {
|
|
|
52512
52512
|
total += add;
|
|
52513
52513
|
}
|
|
52514
52514
|
}
|
|
52515
|
+
const last = rowCount - 1, over = total - maxTotal;
|
|
52516
|
+
const lastCells = cells.filter((c) => c.rowAddr + c.rowSpan - 1 === last);
|
|
52517
|
+
if (shrinkLast && over > 0 && last >= 0 && lastCells.length && lastCells.every((c) => c.rowSpan === 1 && c.contentH != null && c.contentH <= h[last] - over)) h[last] -= over;
|
|
52515
52518
|
return h;
|
|
52516
52519
|
}
|
|
52517
52520
|
|
|
@@ -52775,9 +52778,9 @@ function cellContentExtent(cell2, memo) {
|
|
|
52775
52778
|
const pos = findChildByLocalName(o.el, "pos");
|
|
52776
52779
|
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1270 => _1270.getAttribute, 'call', _1271 => _1271("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
52777
52780
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
52778
|
-
const pushed = baseV - (num2(om, "top") + o.height + num2(om, "bottom"));
|
|
52779
|
-
const anchor = pushed >= (paraStart > 0 ? paraStart - 100 : -100) ? pushed : baseV - (_nullishCoalesce(_optionalChain([memo, 'optionalAccess', _1272 => _1272.paraGeom, 'optionalAccess', _1273 => _1273.get, 'call', _1274 => _1274(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1275 => _1275.spaceBefore]), () => ( 0)));
|
|
52780
52781
|
const vo = num2(pos, "vertOffset");
|
|
52782
|
+
const pushed = baseV - (Math.max(0, vo) + num2(om, "top") + o.height + num2(om, "bottom"));
|
|
52783
|
+
const anchor = pushed >= (paraStart > 0 ? paraStart - 100 : -100) ? pushed : baseV - (_nullishCoalesce(_optionalChain([memo, 'optionalAccess', _1272 => _1272.paraGeom, 'optionalAccess', _1273 => _1273.get, 'call', _1274 => _1274(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1275 => _1275.spaceBefore]), () => ( 0)));
|
|
52781
52784
|
const oh = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
|
|
52782
52785
|
ext = Math.max(ext, anchor + num2(om, "top") + Math.max(0, vo) + oh);
|
|
52783
52786
|
}
|
|
@@ -52823,6 +52826,21 @@ function collectCells(tbl2) {
|
|
|
52823
52826
|
}
|
|
52824
52827
|
return cells;
|
|
52825
52828
|
}
|
|
52829
|
+
function inCell(el) {
|
|
52830
|
+
for (let n = el.parentNode; n; n = n.parentNode) if (ln(n) === "tc") return true;
|
|
52831
|
+
return false;
|
|
52832
|
+
}
|
|
52833
|
+
function splitSaved(c) {
|
|
52834
|
+
let prev = Number.NEGATIVE_INFINITY;
|
|
52835
|
+
for (const p of c.sub ? elements(c.sub) : []) {
|
|
52836
|
+
if (ln(p) !== "p") continue;
|
|
52837
|
+
for (const s of buildPara(p).segs) {
|
|
52838
|
+
if (s.vertpos < prev) return true;
|
|
52839
|
+
prev = s.vertpos;
|
|
52840
|
+
}
|
|
52841
|
+
}
|
|
52842
|
+
return false;
|
|
52843
|
+
}
|
|
52826
52844
|
function measureTableRowHeights(tbl2, memo) {
|
|
52827
52845
|
const cells = collectCells(tbl2);
|
|
52828
52846
|
if (cells.length === 0 || cells.length > 4096) return [];
|
|
@@ -52833,7 +52851,8 @@ function measureTableRowHeights(tbl2, memo) {
|
|
|
52833
52851
|
// (같은 판 PDF: 두 줄 든 2행 병합 칸 내용 2882 > 저장 2564 → 둘째 행이 318 자라고 첫 행은 그대로)
|
|
52834
52852
|
cells.map((c) => ({ rowAddr: c.ra, rowSpan: c.rs, height: (c.rs > 1 ? Math.max(c.h, cellContentExtent(c, memo) + c.marginT + c.marginB) : c.h) - sp * (c.rs - 1), contentH: c.rs === 1 ? cellContentExtent(c, memo) + c.marginT + c.marginB : void 0 })),
|
|
52835
52853
|
nRows,
|
|
52836
|
-
num2(findChildByLocalName(tbl2, "sz"), "height") - (sp > 0 ? sp * (nRows + 1) : 0) || Number.POSITIVE_INFINITY
|
|
52854
|
+
num2(findChildByLocalName(tbl2, "sz"), "height") - (sp > 0 ? sp * (nRows + 1) : 0) || Number.POSITIVE_INFINITY,
|
|
52855
|
+
!inCell(tbl2) && !cells.some((c) => c.ra + c.rs === nRows && splitSaved(c))
|
|
52837
52856
|
);
|
|
52838
52857
|
if (sp > 0) {
|
|
52839
52858
|
for (let r = 0; r < rows.length; r++) rows[r] += sp;
|
|
@@ -54793,7 +54812,8 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
54793
54812
|
rem = Math.max(rem, end - ls[k][0] + c.marginT + c.marginB);
|
|
54794
54813
|
}
|
|
54795
54814
|
if (allFit) {
|
|
54796
|
-
|
|
54815
|
+
const spanCells = cells.filter((c) => c.ra === r && c.rs > 1);
|
|
54816
|
+
if (!first && h <= pageBottom - contTop && [...rowCells, ...spanCells].some((c) => cellContentExtent(c) + c.marginT + c.marginB > avail)) {
|
|
54797
54817
|
page++;
|
|
54798
54818
|
y = contTop;
|
|
54799
54819
|
first = true;
|
|
@@ -54991,9 +55011,11 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local2 = false) {
|
|
|
54991
55011
|
function linePushedBy(o, lineV, paraTop) {
|
|
54992
55012
|
if (paraTop === void 0) return false;
|
|
54993
55013
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
54994
|
-
|
|
55014
|
+
const pos = findChildByLocalName(o.el, "pos");
|
|
55015
|
+
const raw = num2(pos, "vertOffset"), vo = (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1479 => _1479.getAttribute, 'call', _1480 => _1480("vertRelTo")]), () => ( "PARA"))) === "PARA" ? Math.max(0, raw >= 2 ** 31 ? raw - 2 ** 32 : raw) : 0;
|
|
55016
|
+
return Math.abs(lineV - (vo + num2(om, "top") + o.height + num2(om, "bottom")) - paraTop) <= 10;
|
|
54995
55017
|
}
|
|
54996
|
-
function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV,
|
|
55018
|
+
function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, lineH, lineSB = 0) {
|
|
54997
55019
|
const { PW, PH, ML, MT, BODY_W, BODY_H } = ctx.geom;
|
|
54998
55020
|
const pos = findChildByLocalName(o.el, "pos");
|
|
54999
55021
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
@@ -55015,20 +55037,21 @@ function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = fals
|
|
|
55015
55037
|
y = va === "BOTTOM" ? MT + BODY_H - h - vo : va === "CENTER" ? MT + (BODY_H - h) / 2 + vo : MT + vo;
|
|
55016
55038
|
} else if (wrap === "TOP_AND_BOTTOM") {
|
|
55017
55039
|
const lineV = _nullishCoalesce(anchorLineV, () => ( baseV));
|
|
55018
|
-
const pushed = lineV - (omT + h + omB);
|
|
55019
|
-
const below =
|
|
55020
|
-
const anchor = below ? lineV : stayLine !== false ? lineV - stayLine : pushed >= -100 ? pushed : paraStartV !== void 0 ? paraStartV : lineV;
|
|
55040
|
+
const pushed = lineV - (vo + omT + h + omB);
|
|
55041
|
+
const below = lineH !== void 0 && vo + omT >= lineH && !(paraStartV !== void 0 && Math.abs(pushed - paraStartV) <= 10);
|
|
55042
|
+
const anchor = below ? lineV - lineSB : stayLine !== false ? lineV - stayLine : pushed >= -100 ? pushed : paraStartV !== void 0 ? paraStartV : lineV;
|
|
55021
55043
|
y = oy + anchor + omT + vo;
|
|
55022
55044
|
} else {
|
|
55023
55045
|
const origin = vrel === "PARA" && wrap === "SQUARE" ? _nullishCoalesce(paraStartV, () => ( baseV)) : baseV;
|
|
55024
|
-
|
|
55046
|
+
const later = vrel === "PARA" && wrap === "SQUARE" && anchorLineV !== void 0 && anchorLineV > baseV;
|
|
55047
|
+
y = later ? oy + anchorLineV + vo + omT : oy + Math.max(origin + vo, wrap === "SQUARE" && anchorLineV !== void 0 ? anchorLineV : -Infinity) + omT;
|
|
55025
55048
|
}
|
|
55026
55049
|
let x;
|
|
55027
55050
|
const omL = num2(om, "left"), omR = num2(om, "right");
|
|
55028
55051
|
if (hrel === "PAGE") {
|
|
55029
55052
|
x = ha === "RIGHT" ? ML + BODY_W - w - ho - omR : ha === "CENTER" ? ML + (BODY_W - w) / 2 + ho : ML + ho + omL;
|
|
55030
55053
|
} else if (hrel === "PAPER") {
|
|
55031
|
-
x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (_nullishCoalesce(_optionalChain([ctx, 'access',
|
|
55054
|
+
x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (_nullishCoalesce(_optionalChain([ctx, 'access', _1481 => _1481.bodyDx, 'optionalCall', _1482 => _1482(ctx.page)]), () => ( 0)));
|
|
55032
55055
|
} else {
|
|
55033
55056
|
x = ha === "RIGHT" ? ox + areaW - w - ho - omR : ha === "CENTER" ? ox + (areaW - w) / 2 + ho : ox + ho + omL;
|
|
55034
55057
|
}
|
|
@@ -55266,7 +55289,7 @@ function warnOnce(ctx, key, msg2) {
|
|
|
55266
55289
|
function charW(c, styles, prev) {
|
|
55267
55290
|
const st = _nullishCoalesce((c.prId != null ? styles.charPr.get(c.prId) : void 0), () => ( DEFAULT_CHAR));
|
|
55268
55291
|
if (c.ch === "" && c.ctrlText) return measureTextWidth(c.ctrlText, c.ctrlSup ? Math.round(st.height * 3 / 4) : st.height, st.ratio, { spacingPct: st.spacing, faceClass: faceClassOf(st.face) });
|
|
55269
|
-
let w = 0, last = _optionalChain([prev, 'optionalAccess',
|
|
55292
|
+
let w = 0, last = _optionalChain([prev, 'optionalAccess', _1483 => _1483.ch]) ? _nullishCoalesce(prev.ch.codePointAt(prev.ch.length - 1), () => ( 0)) : 0;
|
|
55270
55293
|
for (const ch of c.ch) {
|
|
55271
55294
|
const cp = ch.codePointAt(0);
|
|
55272
55295
|
if (!joinsJamo(last, cp)) w += glyphWidth(ch, st).w;
|
|
@@ -55285,10 +55308,10 @@ function planLines(m, styles, numText = "") {
|
|
|
55285
55308
|
const align = _nullishCoalesce((m.paraPrId != null ? styles.paraAlign.get(m.paraPrId) : void 0), () => ( "JUSTIFY"));
|
|
55286
55309
|
const geom = m.paraPrId != null ? styles.paraGeom.get(m.paraPrId) : void 0;
|
|
55287
55310
|
const hang = geom && geom.marginIntent < 0 ? -geom.marginIntent : 0;
|
|
55288
|
-
const bu = _nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
55289
|
-
const firstPr = _nullishCoalesce(_optionalChain([m, 'access',
|
|
55290
|
-
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess',
|
|
55291
|
-
const headW = _optionalChain([bu, 'optionalAccess',
|
|
55311
|
+
const bu = _nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1484 => _1484.bullet]), () => ( (numText && _optionalChain([geom, 'optionalAccess', _1485 => _1485.number]) ? { ch: numText, ...geom.number } : void 0)));
|
|
55312
|
+
const firstPr = _nullishCoalesce(_optionalChain([m, 'access', _1486 => _1486.chars, 'access', _1487 => _1487.find, 'call', _1488 => _1488((c) => c.ch !== ""), 'optionalAccess', _1489 => _1489.prId]), () => ( null));
|
|
55313
|
+
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess', _1490 => _1490.charPrId]) != null ? styles.charPr.get(bu.charPrId) : firstPr != null ? styles.charPr.get(firstPr) : void 0), () => ( DEFAULT_CHAR));
|
|
55314
|
+
const headW = _optionalChain([bu, 'optionalAccess', _1491 => _1491.useInstWidth]) === false ? [...bu.ch].reduce((w, ch) => w + glyphWidth(ch, bst, false).w, 0) : bu ? measureTextWidth(bu.ch, bst.height, bst.ratio, { spacingPct: bst.spacing, faceClass: faceClassOf(bst.face) }) : 0;
|
|
55292
55315
|
const bulletW = bu ? paraHeadAdvance(bu, bst.height, headW) : 0;
|
|
55293
55316
|
const plans = [];
|
|
55294
55317
|
const inlineW = /* @__PURE__ */ new Map();
|
|
@@ -55298,8 +55321,8 @@ function planLines(m, styles, numText = "") {
|
|
|
55298
55321
|
const start = seg.textpos;
|
|
55299
55322
|
const end = i + 1 < m.segs.length ? m.segs[i + 1].textpos : Math.max(m.chars.length, start);
|
|
55300
55323
|
const tabs = /* @__PURE__ */ new Map();
|
|
55301
|
-
const lead = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
55302
|
-
let x = (i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
55324
|
+
const lead = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1492 => _1492.marginIntent]), () => ( 0)), 0) + bulletW : hang + (_optionalChain([bu, 'optionalAccess', _1493 => _1493.autoIndent]) ? bulletW : 0);
|
|
55325
|
+
let x = (i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1494 => _1494.marginIntent]), () => ( 0)), 0) : hang) + (i === 0 || _optionalChain([bu, 'optionalAccess', _1495 => _1495.autoIndent]) ? bulletW : 0);
|
|
55303
55326
|
let fixedTo = start;
|
|
55304
55327
|
let fixedW = 0;
|
|
55305
55328
|
for (let k = start; k < end && k < m.chars.length; k++) {
|
|
@@ -55320,6 +55343,7 @@ function planLines(m, styles, numText = "") {
|
|
|
55320
55343
|
}
|
|
55321
55344
|
if (fixedTo > start) fixedW = lineNaturalWidth(m, styles, start, fixedTo).text + [...tabs.values()].reduce((a, b) => a + b, 0);
|
|
55322
55345
|
let textEnd = Math.min(end, m.chars.length);
|
|
55346
|
+
while (textEnd > fixedTo && m.chars[textEnd - 1].br) textEnd--;
|
|
55323
55347
|
while (textEnd > fixedTo && m.chars[textEnd - 1].ch === " ") textEnd--;
|
|
55324
55348
|
const nat = lineNaturalWidth(m, styles, fixedTo, textEnd);
|
|
55325
55349
|
for (const o of m.objs) if (o.inline && o.index >= textEnd && o.index < end) nat.obj += o.omL + o.width + o.omR;
|
|
@@ -55410,7 +55434,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
55410
55434
|
let i = plan.start;
|
|
55411
55435
|
let cursor = ox + seg.horzpos + plan.xoff;
|
|
55412
55436
|
const y = oy + seg.vertpos + seg.baseline;
|
|
55413
|
-
const pva = m.paraPrId != null ? _optionalChain([ctx, 'access',
|
|
55437
|
+
const pva = m.paraPrId != null ? _optionalChain([ctx, 'access', _1496 => _1496.styles, 'access', _1497 => _1497.paraGeom, 'access', _1498 => _1498.get, 'call', _1499 => _1499(m.paraPrId), 'optionalAccess', _1500 => _1500.vertAlign]) : void 0;
|
|
55414
55438
|
const glyphY = (h) => y + (pva === "CENTER" ? Math.round(h * 0.35) : pva === "BOTTOM" ? -Math.round(h * 0.15) : 0);
|
|
55415
55439
|
if (plan.bullet) {
|
|
55416
55440
|
const bs = _nullishCoalesce((plan.bullet.prId != null ? ctx.styles.charPr.get(plan.bullet.prId) : void 0), () => ( DEFAULT_CHAR));
|
|
@@ -55499,7 +55523,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
55499
55523
|
if (st.italic) attrs.push(`font-style="italic"`);
|
|
55500
55524
|
if (st.underline) attrs.push(`text-decoration="underline"`);
|
|
55501
55525
|
if (st.color) attrs.push(`fill="${escapeXml7(st.color)}"`);
|
|
55502
|
-
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(
|
|
55526
|
+
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(_chunkJFUUFJZWcjs.mapPuaText.call(void 0, text))}</text>`);
|
|
55503
55527
|
ctx.stats.texts++;
|
|
55504
55528
|
}
|
|
55505
55529
|
return sw;
|
|
@@ -55539,6 +55563,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
55539
55563
|
if (gOpenOn >= 0) ctx.pages[gOpenOn].push("</g>");
|
|
55540
55564
|
if (paraRegionId) ctx.parentStack.push(paraRegionId);
|
|
55541
55565
|
let tbStack;
|
|
55566
|
+
let tbStackTop;
|
|
55542
55567
|
for (const o of m.objs) {
|
|
55543
55568
|
if (o.inline) {
|
|
55544
55569
|
let planIdx = 0;
|
|
@@ -55568,38 +55593,43 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
55568
55593
|
anchorLineH = pl.seg.textheight;
|
|
55569
55594
|
}
|
|
55570
55595
|
let objBaseV = baseV;
|
|
55571
|
-
const pTop = depth === 0 ? _optionalChain([ctx, 'access',
|
|
55596
|
+
const pTop = depth === 0 ? _optionalChain([ctx, 'access', _1501 => _1501.paraTops, 'optionalAccess', _1502 => _1502.get, 'call', _1503 => _1503(p)]) : void 0;
|
|
55572
55597
|
const wrapA = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
55573
55598
|
const top0 = _nullishCoalesce(pTop, () => ( (depth > 0 && wrapA !== "TOP_AND_BOTTOM" ? cellParaTop(p, ctx.styles.paraGeom) : void 0)));
|
|
55574
55599
|
if (top0 !== void 0 && wrapA !== "TOP_AND_BOTTOM") {
|
|
55575
|
-
const start = top0 + (m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
55600
|
+
const start = top0 + (m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access', _1504 => _1504.styles, 'access', _1505 => _1505.paraGeom, 'access', _1506 => _1506.get, 'call', _1507 => _1507(m.paraPrId), 'optionalAccess', _1508 => _1508.spaceBefore]), () => ( 0)) : 0);
|
|
55576
55601
|
if (baseV > start + 100) {
|
|
55577
55602
|
objBaseV = start;
|
|
55578
55603
|
if (anchorLineV === baseV) anchorLineV = start;
|
|
55579
55604
|
}
|
|
55580
55605
|
}
|
|
55581
|
-
const tbFloats = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
55606
|
+
const tbFloats = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1509 => _1509(q.el, "pos"), 'optionalAccess', _1510 => _1510.getAttribute, 'call', _1511 => _1511("vertRelTo")]), () => ( "PARA"))) === "PARA").length;
|
|
55582
55607
|
let stay = tbFloats < 2 && !m.objs.some((q) => q.inline) && !m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
|
|
55583
|
-
const sbA = m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
55608
|
+
const sbA = m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access', _1512 => _1512.styles, 'access', _1513 => _1513.paraGeom, 'access', _1514 => _1514.get, 'call', _1515 => _1515(m.paraPrId), 'optionalAccess', _1516 => _1516.spaceBefore]), () => ( 0)) : 0;
|
|
55584
55609
|
if (stay && wrapA === "TOP_AND_BOTTOM" && linePushedBy(o, _nullishCoalesce(anchorLineV, () => ( baseV)), _nullishCoalesce(pTop, () => ( (depth > 0 ? cellParaTop(p, ctx.styles.paraGeom) : void 0))))) stay = false;
|
|
55585
55610
|
const firstLine = anchorLineV === void 0 || anchorLineV === baseV;
|
|
55586
|
-
let { x, y } = anchorObject(o, ax, oy, objBaseV, aw, ctx, anchorLineV, stay ? sbA : false, (firstLine || wrapA === "SQUARE") && pTop !== void 0 && pTop < baseV ? pTop : void 0, firstLine ?
|
|
55587
|
-
|
|
55611
|
+
let { x, y } = anchorObject(o, ax, oy, objBaseV, aw, ctx, anchorLineV, stay ? sbA : false, (firstLine || wrapA === "SQUARE") && pTop !== void 0 && pTop < baseV ? pTop : void 0, anchorLineH, firstLine ? sbA : 0);
|
|
55612
|
+
let stackTop = depth === 0 ? _nullishCoalesce(pTop, () => ( 0)) : cellParaTop(p, ctx.styles.paraGeom);
|
|
55613
|
+
if (tbFloats >= 2 && wrapA === "TOP_AND_BOTTOM" && stackTop !== void 0) {
|
|
55588
55614
|
if (!tbStack) {
|
|
55589
55615
|
tbStack = /* @__PURE__ */ new Map();
|
|
55590
|
-
|
|
55591
|
-
const stackable = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
55616
|
+
const placed = [];
|
|
55617
|
+
const stackable = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1517 => _1517(q.el, "pos"), 'optionalAccess', _1518 => _1518.getAttribute, 'call', _1519 => _1519("vertRelTo")]), () => ( "PARA"))) === "PARA" && _optionalChain([findChildByLocalName, 'call', _1520 => _1520(q.el, "pos"), 'optionalAccess', _1521 => _1521.getAttribute, 'call', _1522 => _1522("allowOverlap")]) !== "1");
|
|
55592
55618
|
for (const q of stackable.length >= 2 ? stackable.sort((a, b) => a.index - b.index) : []) {
|
|
55593
|
-
const
|
|
55594
|
-
const
|
|
55619
|
+
const posQ = findChildByLocalName(q.el, "pos"), omQ = findChildByLocalName(q.el, "outMargin"), raw = num2(posQ, "vertOffset");
|
|
55620
|
+
const x0 = num2(posQ, "horzOffset"), x1 = x0 + num2(omQ, "left") + q.width + num2(omQ, "right");
|
|
55621
|
+
const below = Math.max(0, ...placed.filter((r) => r.x0 < x1 && x0 < r.x1).map((r) => r.bottom));
|
|
55622
|
+
const top = Math.max(below, depth > 0 ? Math.max(0, raw) : raw);
|
|
55595
55623
|
tbStack.set(q.el, top + num2(omQ, "top"));
|
|
55596
|
-
|
|
55624
|
+
placed.push({ x0, x1, bottom: top + num2(omQ, "top") + (q.tag === "tbl" ? Math.max(q.height, measureTableHeight(q.el, ctx.extentMemo)) : q.height) + num2(omQ, "bottom") });
|
|
55597
55625
|
}
|
|
55626
|
+
if (depth > 0 && placed.length) tbStackTop = Math.max(stackTop, baseV - Math.max(...placed.map((r) => r.bottom)));
|
|
55598
55627
|
}
|
|
55628
|
+
if (depth > 0 && tbStackTop !== void 0) stackTop = tbStackTop;
|
|
55599
55629
|
const st = tbStack.get(o.el);
|
|
55600
|
-
if (st !== void 0) y = oy +
|
|
55630
|
+
if (st !== void 0) y = oy + stackTop + st;
|
|
55601
55631
|
}
|
|
55602
|
-
const moved = _optionalChain([ctx, 'access',
|
|
55632
|
+
const moved = _optionalChain([ctx, 'access', _1523 => _1523.objPlace, 'optionalAccess', _1524 => _1524.get, 'call', _1525 => _1525(o.el)]);
|
|
55603
55633
|
if (moved) {
|
|
55604
55634
|
const pg = ctx.page;
|
|
55605
55635
|
ctx.page = moved.page;
|
|
@@ -55618,7 +55648,7 @@ function cellParaTop(p, geom) {
|
|
|
55618
55648
|
const segs = lsa ? elements(lsa).filter((e) => ln(e) === "lineseg") : [];
|
|
55619
55649
|
if (!segs.length) return void 0;
|
|
55620
55650
|
const last = segs[segs.length - 1];
|
|
55621
|
-
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (_nullishCoalesce(_optionalChain([geom, 'access',
|
|
55651
|
+
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (_nullishCoalesce(_optionalChain([geom, 'access', _1526 => _1526.get, 'call', _1527 => _1527(_nullishCoalesce(prev.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1528 => _1528.spaceAfter]), () => ( 0)));
|
|
55622
55652
|
}
|
|
55623
55653
|
function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
55624
55654
|
if (!o.inline && depth === 0 && ctx.paintJobs) {
|
|
@@ -55659,7 +55689,7 @@ function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
|
55659
55689
|
drawObject(sub, x + num2(off, "x"), y + num2(off, "y"), baseV, areaW, ctx, depth + 1);
|
|
55660
55690
|
}
|
|
55661
55691
|
} else if (o.tag === "equation") {
|
|
55662
|
-
const script = _nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
55692
|
+
const script = _nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1529 => _1529(o.el, "script"), 'optionalAccess', _1530 => _1530.textContent]), () => ( ""));
|
|
55663
55693
|
const text = script ? latexToPlain(hwpEquationToLatex(script)) : "";
|
|
55664
55694
|
if (text && o.width > 0) {
|
|
55665
55695
|
const bl = Number(o.el.getAttribute("baseLine")), size = num2(o.el, "baseUnit", 1e3);
|
|
@@ -55764,7 +55794,7 @@ function tableContPages(tbl2, ty, MT, BODY_H, memo, slack = 0, floatSpan, nested
|
|
|
55764
55794
|
}
|
|
55765
55795
|
function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
55766
55796
|
return (seg, top, contMT) => {
|
|
55767
|
-
const lsa = seg.parentNode, p = _optionalChain([lsa, 'optionalAccess',
|
|
55797
|
+
const lsa = seg.parentNode, p = _optionalChain([lsa, 'optionalAccess', _1531 => _1531.parentNode]);
|
|
55768
55798
|
if (!p || ln(p) !== "p") return void 0;
|
|
55769
55799
|
const segs = elements(lsa).filter((e) => ln(e) === "lineseg"), k = segs.indexOf(seg);
|
|
55770
55800
|
const m = buildPara(p);
|
|
@@ -55772,12 +55802,12 @@ function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
|
55772
55802
|
for (const o of m.objs) {
|
|
55773
55803
|
if (o.tag !== "tbl" || o.inline) continue;
|
|
55774
55804
|
const pos = findChildByLocalName(o.el, "pos");
|
|
55775
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
55805
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1532 => _1532.getAttribute, 'call', _1533 => _1533("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
55776
55806
|
const segK = Math.max(0, m.segs.findIndex((sg, i) => sg.textpos <= o.index && (i === m.segs.length - 1 || m.segs[i + 1].textpos > o.index)));
|
|
55777
55807
|
if (segK !== k) continue;
|
|
55778
55808
|
const segV = num2(seg, "vertpos"), pTop = cellParaTop(p, _nullishCoalesce(memo.paraGeom, () => ( /* @__PURE__ */ new Map())));
|
|
55779
55809
|
const start = linePushedBy(o, segV, pTop) ? top - (segV - (_nullishCoalesce(pTop, () => ( segV)))) : top;
|
|
55780
|
-
const ty = start + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
55810
|
+
const ty = start + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1534 => _1534.getAttribute, 'call', _1535 => _1535("vertOffset")]), () => ( void 0)), 0));
|
|
55781
55811
|
const span2 = tableContPages(o.el, ty, MT, BODY_H, memo, slack, cellFloatSpan(MT, BODY_H, memo, slack), true, contMT);
|
|
55782
55812
|
if (span2.pages > 0 && (!best || span2.pages > best.pages)) best = { ...span2, el: o.el };
|
|
55783
55813
|
}
|
|
@@ -55818,9 +55848,9 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
55818
55848
|
let hdrRows = 0;
|
|
55819
55849
|
if (tbl2.getAttribute("repeatHeader") === "1") while (hdrRows < nRows && cells.some((c) => c.ra === hdrRows) && cells.filter((c) => c.ra === hdrRows).every((c) => c.el.getAttribute("header") === "1")) hdrRows++;
|
|
55820
55850
|
const slack = ctx.geom.PH - ctx.geom.MT - ctx.geom.BODY_H;
|
|
55821
|
-
const splitHere = depth === 1 || !!ctx.splitCell && _optionalChain([findChildByLocalName, 'call',
|
|
55851
|
+
const splitHere = depth === 1 || !!ctx.splitCell && _optionalChain([findChildByLocalName, 'call', _1536 => _1536(tbl2, "pos"), 'optionalAccess', _1537 => _1537.getAttribute, 'call', _1538 => _1538("treatAsChar")]) !== "1";
|
|
55822
55852
|
const plan = splitHere ? planTableRows(tbl2, cells, rowH, ty, ctx.geom.MT, ctx.geom.BODY_H, slack, cellFloatSpan(ctx.geom.MT, ctx.geom.BODY_H, ctx.extentMemo, slack), depth !== 1, depth !== 1 && ctx.splitContMT !== void 0 ? ctx.splitContMT : ctx.geom.MT) : rowH.map((h, r) => [{ page: 0, y: ty + rowY[r], h }]);
|
|
55823
|
-
const
|
|
55853
|
+
const splitSaved2 = ctx.splitCell;
|
|
55824
55854
|
ctx.splitCell = false;
|
|
55825
55855
|
for (const pc of plan.flat()) for (const [el, py] of _nullishCoalesce(pc.place, () => ( []))) (ctx.objPlace ??= /* @__PURE__ */ new Map()).set(el, { page: startPage + pc.page, y: py });
|
|
55826
55856
|
const contPages = [...new Set(plan.flat().map((pc) => pc.page).filter((pg) => pg > 0))].map((pg) => startPage + pg);
|
|
@@ -55840,7 +55870,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
55840
55870
|
for (const g3 of geom) {
|
|
55841
55871
|
ctx.page = g3.page;
|
|
55842
55872
|
const bf = g3.c.bfId != null ? ctx.styles.borderFill.get(g3.c.bfId) : void 0;
|
|
55843
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
55873
|
+
if (_optionalChain([bf, 'optionalAccess', _1539 => _1539.fill])) emit(ctx, `<rect x="${pt2(g3.x)}" y="${pt2(g3.y)}" width="${pt2(g3.w)}" height="${pt2(g3.h)}" fill="${escapeXml7(bf.fill)}"/>`);
|
|
55844
55874
|
}
|
|
55845
55875
|
for (const g3 of geom) {
|
|
55846
55876
|
const { c } = g3;
|
|
@@ -55851,14 +55881,14 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
55851
55881
|
const boxes = cellLineBoxes(c);
|
|
55852
55882
|
const contV = new Map(boxes.map((b) => [b.seg, b.top]));
|
|
55853
55883
|
const pieceOf = (v) => Math.max(0, g3.pieces.findIndex((pc) => {
|
|
55854
|
-
const r = _optionalChain([pc, 'access',
|
|
55884
|
+
const r = _optionalChain([pc, 'access', _1540 => _1540.range, 'optionalAccess', _1541 => _1541.get, 'call', _1542 => _1542(c.el)]);
|
|
55855
55885
|
return !!r && v >= r[0] && v < r[1];
|
|
55856
55886
|
}));
|
|
55857
55887
|
const va2 = _nullishCoalesce(c.sub.getAttribute("vertAlign"), () => ( "TOP"));
|
|
55858
55888
|
const lastK = g3.pieces.length - 1;
|
|
55859
55889
|
const pieceOff = g3.pieces.map((pc, k) => {
|
|
55860
55890
|
if (va2 === "TOP" || k > 0 && k < lastK || pc.fill) return 0;
|
|
55861
|
-
const from = _nullishCoalesce(_optionalChain([pc, 'access',
|
|
55891
|
+
const from = _nullishCoalesce(_optionalChain([pc, 'access', _1543 => _1543.range, 'optionalAccess', _1544 => _1544.get, 'call', _1545 => _1545(c.el), 'optionalAccess', _1546 => _1546[0]]), () => ( 0));
|
|
55862
55892
|
const bottoms = boxes.filter((b) => pieceOf(b.top) === k).map((b) => b.bottom - from);
|
|
55863
55893
|
if (k > 0) for (const f of subFloatBottoms(c.sub)) {
|
|
55864
55894
|
const b = boxes.find((x) => x.seg === f.seg);
|
|
@@ -55875,7 +55905,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
55875
55905
|
const pages = segs.map((sg) => {
|
|
55876
55906
|
const v = _nullishCoalesce(contV.get(sg), () => ( num2(sg, "vertpos")));
|
|
55877
55907
|
const k = pieceOf(v);
|
|
55878
|
-
const pc = g3.pieces[k], from = _nullishCoalesce(_optionalChain([pc, 'access',
|
|
55908
|
+
const pc = g3.pieces[k], from = _nullishCoalesce(_optionalChain([pc, 'access', _1547 => _1547.range, 'optionalAccess', _1548 => _1548.get, 'call', _1549 => _1549(c.el), 'optionalAccess', _1550 => _1550[0]]), () => ( 0));
|
|
55879
55909
|
sg.setAttribute("vertpos", String(v - from + pc.y + c.marginT + pieceOff[k] - base));
|
|
55880
55910
|
return startPage + pc.page;
|
|
55881
55911
|
});
|
|
@@ -55940,7 +55970,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
55940
55970
|
if (bf.right) emit(ctx, edgeLine(g3.x + g3.w, g3.y, g3.x + g3.w, g3.y + g3.h, bf.right));
|
|
55941
55971
|
}
|
|
55942
55972
|
ctx.page = startPage;
|
|
55943
|
-
ctx.splitCell =
|
|
55973
|
+
ctx.splitCell = splitSaved2;
|
|
55944
55974
|
ctx.parentStack.pop();
|
|
55945
55975
|
emit(ctx, "</g>");
|
|
55946
55976
|
}
|
|
@@ -55970,7 +56000,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
55970
56000
|
}
|
|
55971
56001
|
function drawPicFrame(pic, x, y, w, h, transform, ctx) {
|
|
55972
56002
|
const img = findFirst(pic, "img");
|
|
55973
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
56003
|
+
const ref = _optionalChain([img, 'optionalAccess', _1551 => _1551.getAttribute, 'call', _1552 => _1552("binaryItemIDRef")]);
|
|
55974
56004
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
55975
56005
|
const imgId = ctx.regions.add("image", bboxOf(ctx, x, y, w, h), { sourceId: _nullishCoalesce(ref, () => ( void 0)), parentId: parentId(ctx) });
|
|
55976
56006
|
emit(ctx, regionOpenTag(imgId, "image", pageNo(ctx)));
|
|
@@ -56016,12 +56046,12 @@ function readSectionGeom(root) {
|
|
|
56016
56046
|
const pagePr = findFirst(root, "pagePr");
|
|
56017
56047
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
56018
56048
|
let PW = num2(pagePr, "width", 59528), PH = num2(pagePr, "height", 84188);
|
|
56019
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
56049
|
+
if (_optionalChain([pagePr, 'optionalAccess', _1553 => _1553.getAttribute, 'call', _1554 => _1554("landscape")]) === "NARROWLY" && PW < PH) {
|
|
56020
56050
|
const t = PW;
|
|
56021
56051
|
PW = PH;
|
|
56022
56052
|
PH = t;
|
|
56023
56053
|
}
|
|
56024
|
-
const gutterType = _nullishCoalesce(_optionalChain([pagePr, 'optionalAccess',
|
|
56054
|
+
const gutterType = _nullishCoalesce(_optionalChain([pagePr, 'optionalAccess', _1555 => _1555.getAttribute, 'call', _1556 => _1556("gutterType")]), () => ( "LEFT_ONLY")), gutter = num2(margin, "gutter", 0);
|
|
56025
56055
|
const gL = gutterType === "TOP_BOTTOM" ? 0 : gutter, gT = gutterType === "TOP_BOTTOM" ? gutter : 0;
|
|
56026
56056
|
const ML = num2(margin, "left", 8504) + gL;
|
|
56027
56057
|
const MT = num2(margin, "top", 5668) + num2(margin, "header", 0) + gT;
|
|
@@ -56078,7 +56108,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
56078
56108
|
}
|
|
56079
56109
|
const absolute = !degenerate && absoluteTopCache(root, ML, BODY_W);
|
|
56080
56110
|
if (absolute) {
|
|
56081
|
-
for (const lsa of Array.from(root.getElementsByTagName("*")).filter((e) => ln(e) === "linesegarray")) _optionalChain([lsa, 'access',
|
|
56111
|
+
for (const lsa of Array.from(root.getElementsByTagName("*")).filter((e) => ln(e) === "linesegarray")) _optionalChain([lsa, 'access', _1557 => _1557.parentNode, 'optionalAccess', _1558 => _1558.removeChild, 'call', _1559 => _1559(lsa)]);
|
|
56082
56112
|
ctxBase.warnings.push("\uC870\uD310 \uCE90\uC2DC\uAC00 \uCABD \uAE30\uC900 \uC88C\uD45C\uB85C \uC801\uD600 \uC788\uC5B4 \uB2E4\uC2DC \uC870\uD310\uD574 \uB80C\uB354");
|
|
56083
56113
|
}
|
|
56084
56114
|
const mixed = !doReflow && !degenerate && !absolute && Array.from(root.getElementsByTagName("*")).some((p) => ln(p) === "p" && !findChildByLocalName(p, "linesegarray"));
|
|
@@ -56099,6 +56129,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
56099
56129
|
}
|
|
56100
56130
|
const paraSegPages = /* @__PURE__ */ new Map();
|
|
56101
56131
|
const paraTops = /* @__PURE__ */ new Map();
|
|
56132
|
+
const backPlace = /* @__PURE__ */ new Map();
|
|
56102
56133
|
const geom0 = ctxBase.styles.paraGeom;
|
|
56103
56134
|
let tableEndPage = -1;
|
|
56104
56135
|
let nPages = 1;
|
|
@@ -56110,6 +56141,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
56110
56141
|
let cur = 0, col = 0;
|
|
56111
56142
|
let pendingEnd = 0, pendingEndY = 0;
|
|
56112
56143
|
let lastEnd = 0, lastPage = -1;
|
|
56144
|
+
let lastSA = 0;
|
|
56113
56145
|
let prevSeg;
|
|
56114
56146
|
for (const p of elements(root)) {
|
|
56115
56147
|
if (ln(p) !== "p") continue;
|
|
@@ -56137,7 +56169,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
56137
56169
|
pendingEnd = 0;
|
|
56138
56170
|
} else {
|
|
56139
56171
|
const brk = v < prevV ? !multiCol || h <= prevH : v === prevV && h <= prevH && prevEnd > v && v < BODY_H / 2;
|
|
56140
|
-
const pbrk = !brk && paraFirst && prevV !== Number.NEGATIVE_INFINITY && p.getAttribute("pageBreak") === "1" && (v < BODY_H / 2 || buildPara(p).objs.some((o) => !o.inline && (_nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
56172
|
+
const pbrk = !brk && paraFirst && prevV !== Number.NEGATIVE_INFINITY && p.getAttribute("pageBreak") === "1" && (v < BODY_H / 2 || buildPara(p).objs.some((o) => !o.inline && (_nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1560 => _1560(o.el, "pos"), 'optionalAccess', _1561 => _1561.getAttribute, 'call', _1562 => _1562("vertRelTo")]), () => ( "PARA"))) === "PARA" && linePushedBy(o, v, 0)));
|
|
56141
56173
|
const obrk = !brk && !pbrk && !multiCol && paraFirst && v > prevV && v < prevEnd - 100 && prevEnd + num2(s, "vertsize") > BODY_H && v < BODY_H / 2;
|
|
56142
56174
|
if (brk || pbrk || obrk) cur++;
|
|
56143
56175
|
if (brk && prevSeg && prevV + prevSeg.vs > BODY_H && v === prevSeg.vs + prevSeg.sp && prevSeg.pages[prevSeg.idx] === cur - 1) {
|
|
@@ -56147,6 +56179,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
56147
56179
|
if (prevSeg.p !== p) {
|
|
56148
56180
|
lastPage = cur;
|
|
56149
56181
|
lastEnd = v;
|
|
56182
|
+
lastSA = 0;
|
|
56150
56183
|
}
|
|
56151
56184
|
}
|
|
56152
56185
|
}
|
|
@@ -56160,30 +56193,40 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
56160
56193
|
prevEnd = v + num2(s, "vertsize") + num2(s, "spacing");
|
|
56161
56194
|
}
|
|
56162
56195
|
paraSegPages.set(p, pagesOf);
|
|
56163
|
-
|
|
56196
|
+
const prevEnd0 = lastEnd, prevPage0 = lastPage;
|
|
56197
|
+
if (segEls.length) paraTops.set(p, pagesOf[0] === lastPage ? lastEnd + lastSA : 0);
|
|
56164
56198
|
if (segEls.length) {
|
|
56165
56199
|
const ls = segEls[segEls.length - 1];
|
|
56166
56200
|
lastEnd = num2(ls, "vertpos") + num2(ls, "vertsize") + num2(ls, "spacing");
|
|
56167
56201
|
lastPage = pagesOf[pagesOf.length - 1];
|
|
56202
|
+
lastSA = _nullishCoalesce(_optionalChain([geom0, 'access', _1563 => _1563.get, 'call', _1564 => _1564(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1565 => _1565.spaceAfter]), () => ( 0));
|
|
56168
56203
|
}
|
|
56169
56204
|
if (!localCols && segEls.length) {
|
|
56170
56205
|
const m0 = buildPara(p);
|
|
56171
56206
|
for (const o of m0.objs) {
|
|
56172
56207
|
if (o.tag !== "tbl") continue;
|
|
56173
56208
|
const pos = findChildByLocalName(o.el, "pos"), om = findChildByLocalName(o.el, "outMargin");
|
|
56174
|
-
if (!o.inline && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
56209
|
+
if (!o.inline && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1566 => _1566.getAttribute, 'call', _1567 => _1567("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
56175
56210
|
const segK = Math.max(0, m0.segs.findIndex((sg, k) => sg.textpos <= o.index && (k === m0.segs.length - 1 || m0.segs[k + 1].textpos > o.index)));
|
|
56176
56211
|
const segV = num2(segEls[segK], "vertpos");
|
|
56177
56212
|
const h = Math.max(o.height, measureTableHeight(o.el, ctxBase.extentMemo)), omT = num2(om, "top"), omB = num2(om, "bottom");
|
|
56178
56213
|
const pushed = segV - (omT + h + omB);
|
|
56214
|
+
if (!o.inline && segK === 0 && pushed < -100 && prevPage0 >= 0 && pagesOf[0] === prevPage0 + 1 && (_nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM") {
|
|
56215
|
+
const back = tableContPages(o.el, MT + prevEnd0 + omT, MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H, cellFloatSpan(MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H));
|
|
56216
|
+
if (back.pages === 1 && Math.abs(back.endY - MT + omB - segV) <= 300) {
|
|
56217
|
+
backPlace.set(o.el, { page: prevPage0, y: MT + prevEnd0 + omT });
|
|
56218
|
+
continue;
|
|
56219
|
+
}
|
|
56220
|
+
}
|
|
56179
56221
|
const nTb = m0.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM").length;
|
|
56180
56222
|
const wrapP = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
56181
|
-
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? _nullishCoalesce(_optionalChain([geom0, 'access',
|
|
56223
|
+
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? _nullishCoalesce(_optionalChain([geom0, 'access', _1568 => _1568.get, 'call', _1569 => _1569(m0.paraPrId), 'optionalAccess', _1570 => _1570.spaceBefore]), () => ( 0)) : 0;
|
|
56182
56224
|
const stay = nTb < 2 && !m0.objs.some((q) => q.inline) && !m0.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "") && !(!o.inline && wrapP === "TOP_AND_BOTTOM" && linePushedBy(o, segV, pTop));
|
|
56183
56225
|
const nonPush = wrapP !== "TOP_AND_BOTTOM" && pTop !== void 0 && segV > pTop + sbP + 100 ? pTop + sbP : void 0;
|
|
56184
|
-
const voP = Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
56226
|
+
const voP = Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1571 => _1571.getAttribute, 'call', _1572 => _1572("vertOffset")]), () => ( void 0)), 0));
|
|
56185
56227
|
const paraStart = segK === 0 && pTop !== void 0 && pTop < segV ? pTop : segV;
|
|
56186
|
-
const
|
|
56228
|
+
const below = !o.inline && wrapP === "TOP_AND_BOTTOM" && voP + omT >= num2(segEls[segK], "textheight") && !linePushedBy(o, segV, pTop);
|
|
56229
|
+
const ty = o.inline ? MT + segV + omT : nonPush !== void 0 ? MT + nonPush + omT + voP : MT + (below ? segV - (segK === 0 ? sbP : 0) : stay ? segV - sbP : pushed - voP >= -100 ? pushed - voP : paraStart) + omT + voP;
|
|
56187
56230
|
const span2 = tableContPages(o.el, ty, MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H, cellFloatSpan(MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H));
|
|
56188
56231
|
const anchorPage = pagesOf[segK];
|
|
56189
56232
|
const sp = !o.inline && !stay && nonPush === void 0 && segV - (omT + o.height + omB) >= -100 && pagesOf.some((pg, j) => j > segK && pg > anchorPage) ? tableContPages(o.el, MT + segV - o.height - omB, MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H, cellFloatSpan(MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H)) : void 0;
|
|
@@ -56208,7 +56251,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
56208
56251
|
for (const p of elements(root)) {
|
|
56209
56252
|
if (ln(p) !== "p") continue;
|
|
56210
56253
|
const pg = paraSegPages.get(p);
|
|
56211
|
-
if (!_optionalChain([pg, 'optionalAccess',
|
|
56254
|
+
if (!_optionalChain([pg, 'optionalAccess', _1573 => _1573.length])) continue;
|
|
56212
56255
|
const pm = buildPara(p);
|
|
56213
56256
|
if (pm.objs.length || pm.chars.some((c) => c.ch.trim() !== "" || !!c.ctrlText)) lastContent = Math.max(lastContent, ...pg);
|
|
56214
56257
|
}
|
|
@@ -56225,7 +56268,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
56225
56268
|
for (const p of elements(root)) {
|
|
56226
56269
|
if (ln(p) !== "p") continue;
|
|
56227
56270
|
const pg = paraSegPages.get(p);
|
|
56228
|
-
if (!_optionalChain([pg, 'optionalAccess',
|
|
56271
|
+
if (!_optionalChain([pg, 'optionalAccess', _1574 => _1574.includes, 'call', _1575 => _1575(lastContent)])) continue;
|
|
56229
56272
|
const pm = buildPara(p);
|
|
56230
56273
|
pm.segs.forEach((sg, k) => {
|
|
56231
56274
|
if (pg[k] !== lastContent) return;
|
|
@@ -56245,7 +56288,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
56245
56288
|
const ens = endNoteLayout(root, paraSegPages, geom);
|
|
56246
56289
|
const ctx = {
|
|
56247
56290
|
...ctxBase,
|
|
56248
|
-
pages: Array.from({ length: Math.max(nPages, _nullishCoalesce(_optionalChain([ens, 'optionalAccess',
|
|
56291
|
+
pages: Array.from({ length: Math.max(nPages, _nullishCoalesce(_optionalChain([ens, 'optionalAccess', _1576 => _1576.pageCount]), () => ( 0))) }, () => []),
|
|
56249
56292
|
page: 0,
|
|
56250
56293
|
geom,
|
|
56251
56294
|
pageH,
|
|
@@ -56268,6 +56311,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
56268
56311
|
if (geom.mirrorDx) ctx.bodyDx = mirrorDx;
|
|
56269
56312
|
ctx.cols = multiCol ? { w: colW, gap: colGap } : void 0;
|
|
56270
56313
|
ctx.paraTops = paraTops;
|
|
56314
|
+
if (backPlace.size) ctx.objPlace = new Map([..._nullishCoalesce(ctx.objPlace, () => ( [])), ...backPlace]);
|
|
56271
56315
|
for (const p of elements(root)) {
|
|
56272
56316
|
if (ln(p) !== "p") continue;
|
|
56273
56317
|
drawPara(p, ML, MT, BODY_W, ctx, 0, paraSegPages.get(p));
|
|
@@ -56303,7 +56347,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
56303
56347
|
ctx.bodyDx = void 0;
|
|
56304
56348
|
wrapMirror(ctx.pages, (page) => _nullishCoalesce(bodyStart[page], () => ( 0)));
|
|
56305
56349
|
const allPages = new Map(paraSegPages);
|
|
56306
|
-
for (const e of _nullishCoalesce(_optionalChain([ens, 'optionalAccess',
|
|
56350
|
+
for (const e of _nullishCoalesce(_optionalChain([ens, 'optionalAccess', _1577 => _1577.paras]), () => ( []))) allPages.set(e.p, e.pages);
|
|
56307
56351
|
drawPageDecor(root, allPages, ctx, localCols ? nCol : 1, colW, colGap);
|
|
56308
56352
|
drawPageNumbers(root, paraSegPages, ctx);
|
|
56309
56353
|
ctx.page = 0;
|
|
@@ -56372,7 +56416,7 @@ function drawPageNumbers(root, paraPages, ctx) {
|
|
|
56372
56416
|
let decl;
|
|
56373
56417
|
const hidden = /* @__PURE__ */ new Set();
|
|
56374
56418
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
56375
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
56419
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1578 => _1578.get, 'call', _1579 => _1579(p), 'optionalAccess', _1580 => _1580[0]]), () => ( 0));
|
|
56376
56420
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
56377
56421
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
56378
56422
|
const pn = findChildByLocalName(ctrl, "pageNum"), ph = findChildByLocalName(ctrl, "pageHiding");
|
|
@@ -56387,7 +56431,7 @@ function drawPageNumbers(root, paraPages, ctx) {
|
|
|
56387
56431
|
const side = _nullishCoalesce(decl.el.getAttribute("sideChar"), () => ( ""));
|
|
56388
56432
|
const pnId = _nullishCoalesce(ctx.styles.pageNumCharPr, () => ( decl.prId));
|
|
56389
56433
|
const st = _nullishCoalesce((pnId != null ? ctx.styles.charPr.get(pnId) : void 0), () => ( DEFAULT_CHAR));
|
|
56390
|
-
const {
|
|
56434
|
+
const { PH, ML, BODY_W } = ctx.geom;
|
|
56391
56435
|
const pagePr = findFirst(root, "pagePr"), margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
56392
56436
|
const h = 1e3;
|
|
56393
56437
|
for (let page = decl.page; page < ctx.pages.length; page++) {
|
|
@@ -56395,7 +56439,7 @@ function drawPageNumbers(root, paraPages, ctx) {
|
|
|
56395
56439
|
const n = ctx.pageBase + page + 1;
|
|
56396
56440
|
const text = side ? `${side} ${formatHeadNumber2(n, _nullishCoalesce(decl.el.getAttribute("formatType"), () => ( "DIGIT")))} ${side}` : formatHeadNumber2(n, _nullishCoalesce(decl.el.getAttribute("formatType"), () => ( "DIGIT")));
|
|
56397
56441
|
const w = measureTextWidth(text, h, 100, { faceClass: faceClassOf(st.face) });
|
|
56398
|
-
const x = /LEFT/.test(pos) ? ML : /RIGHT/.test(pos) ? ML + BODY_W - w : (
|
|
56442
|
+
const x = /LEFT/.test(pos) ? ML : /RIGHT/.test(pos) ? ML + BODY_W - w : ML + (BODY_W - w) / 2;
|
|
56399
56443
|
const y = /^TOP/.test(pos) ? num2(margin, "top", 5668) - 225 : num2(margin, "footer", 0) > 0 ? PH - num2(margin, "bottom", 4252) - 225 : PH - Math.round(num2(margin, "bottom", 4252) / 2) - 243;
|
|
56400
56444
|
const attrs = [`x="${pt2(x)}"`, `y="${pt2(y)}"`, `font-size="${pt2(h)}"`];
|
|
56401
56445
|
if (st.fontFamily) attrs.push(`font-family="${escapeXml7(st.fontFamily)}"`);
|
|
@@ -56434,22 +56478,22 @@ function renderSectionRoots(sections, input) {
|
|
|
56434
56478
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${index}` });
|
|
56435
56479
|
ctxBase.pageBase += pages.length;
|
|
56436
56480
|
}
|
|
56437
|
-
if (rendered.length === 0) throw new (0,
|
|
56481
|
+
if (rendered.length === 0) throw new (0, _chunkPNSALBXHcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
56438
56482
|
return { sections: rendered, defs: ctxBase.defs, warnings: input.warnings, stats: ctxBase.stats, regions: ctxBase.regions.regions };
|
|
56439
56483
|
}
|
|
56440
56484
|
var SVG_FONT_FAMILY = `'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif`;
|
|
56441
56485
|
async function renderHwpxInternal(input, options) {
|
|
56442
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
56486
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1581 => _1581.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
56443
56487
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
56444
|
-
|
|
56488
|
+
_chunkPNSALBXHcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
56445
56489
|
let zip;
|
|
56446
56490
|
try {
|
|
56447
56491
|
zip = await _jszip2.default.loadAsync(input);
|
|
56448
56492
|
} catch (e44) {
|
|
56449
|
-
throw new (0,
|
|
56493
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
56450
56494
|
}
|
|
56451
|
-
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) =>
|
|
56452
|
-
if (secFiles.length === 0) throw new (0,
|
|
56495
|
+
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => _chunkPNSALBXHcjs.compareSectionPaths.call(void 0, a.name, b.name));
|
|
56496
|
+
if (secFiles.length === 0) throw new (0, _chunkPNSALBXHcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
56453
56497
|
const warnings = [];
|
|
56454
56498
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
56455
56499
|
const verFile = zip.file("version.xml");
|
|
@@ -56460,14 +56504,14 @@ async function renderHwpxInternal(input, options) {
|
|
|
56460
56504
|
const secXmls = [];
|
|
56461
56505
|
for (const f of secFiles) {
|
|
56462
56506
|
const xml = await readZipEntry(f, "text");
|
|
56463
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
56507
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkPNSALBXHcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
56464
56508
|
secXmls.push(xml);
|
|
56465
56509
|
}
|
|
56466
56510
|
const masterPages = /* @__PURE__ */ new Map();
|
|
56467
56511
|
const masterXmls = [];
|
|
56468
56512
|
for (const file of zip.file(/Contents\/masterpage[^/]*\.xml$/i)) {
|
|
56469
56513
|
const xml = await readZipEntry(file, "text");
|
|
56470
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
56514
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkPNSALBXHcjs.KordocError)("\uBC14\uD0D5\uCABD XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
56471
56515
|
const root = createXmlParser().parseFromString(xml, "text/xml").documentElement;
|
|
56472
56516
|
if (root && ln(root) === "masterPage") {
|
|
56473
56517
|
masterPages.set(root.getAttribute("id") || file.name.replace(/^.*\/|\.xml$/g, ""), root);
|
|
@@ -56495,7 +56539,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
56495
56539
|
let href = binmap.get(ref);
|
|
56496
56540
|
if (!href) {
|
|
56497
56541
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
56498
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
56542
|
+
href = _optionalChain([cand, 'optionalAccess', _1582 => _1582.name]);
|
|
56499
56543
|
}
|
|
56500
56544
|
if (!href) continue;
|
|
56501
56545
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -56517,7 +56561,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
56517
56561
|
for (let si = 0; si < secXmls.length; si++) {
|
|
56518
56562
|
const secXml = secXmls[si];
|
|
56519
56563
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
56520
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
56564
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _1583 => _1583.reflow])) {
|
|
56521
56565
|
noCacheSkipped = true;
|
|
56522
56566
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
56523
56567
|
continue;
|
|
@@ -56534,11 +56578,11 @@ async function renderHwpxInternal(input, options) {
|
|
|
56534
56578
|
}
|
|
56535
56579
|
if (roots.length === 0) {
|
|
56536
56580
|
if (noCacheSkipped) {
|
|
56537
|
-
throw new (0,
|
|
56581
|
+
throw new (0, _chunkPNSALBXHcjs.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)");
|
|
56538
56582
|
}
|
|
56539
|
-
throw new (0,
|
|
56583
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
56540
56584
|
}
|
|
56541
|
-
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
56585
|
+
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1584 => _1584.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1585 => _1585.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1586 => _1586.highlights]) });
|
|
56542
56586
|
}
|
|
56543
56587
|
async function renderHwpxToSvg(input, options) {
|
|
56544
56588
|
const r = await renderHwpxInternal(input, options);
|
|
@@ -56761,7 +56805,7 @@ var FOLD_END = 42124;
|
|
|
56761
56805
|
var FOLD_SHIFT = 983040 - 40960;
|
|
56762
56806
|
function textChar(ch) {
|
|
56763
56807
|
if (ch >= FOLD_START && ch <= FOLD_END) {
|
|
56764
|
-
const mapped =
|
|
56808
|
+
const mapped = _chunkJFUUFJZWcjs.mapPuaText.call(void 0, String.fromCodePoint(ch + FOLD_SHIFT));
|
|
56765
56809
|
return /[\u{F0000}-\u{FFFFF}]/u.test(mapped) ? "" : mapped;
|
|
56766
56810
|
}
|
|
56767
56811
|
if (ch === 65534 || ch === 65535 || ch >= 55296 && ch <= 57343) return "\uFFFD";
|
|
@@ -56853,7 +56897,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
56853
56897
|
out += run.join("") + "</hp:run>";
|
|
56854
56898
|
run = [];
|
|
56855
56899
|
};
|
|
56856
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
56900
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _1587 => _1587[0], 'optionalAccess', _1588 => _1588[1]]), () => ( 0)));
|
|
56857
56901
|
let pos = 0, ctrlIdx = 0, o = 0;
|
|
56858
56902
|
const switchShape = () => {
|
|
56859
56903
|
while (shapeIdx + 1 < shapes.length && pos >= shapes[shapeIdx + 1][0]) {
|
|
@@ -56939,7 +56983,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
56939
56983
|
closeRun();
|
|
56940
56984
|
const rest = ctrls.filter((c) => !c.used && (c.id === CTRL_TBL3 || c.id === CTRL_GSO3 || c.id === CTRL_SECD2 || c.id === CTRL_COLD2));
|
|
56941
56985
|
if (rest.length > 0) {
|
|
56942
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
56986
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _1589 => _1589[0], 'optionalAccess', _1590 => _1590[1]]), () => ( 0)));
|
|
56943
56987
|
for (const c of rest) {
|
|
56944
56988
|
const el = ctrlElement(ctrls.indexOf(c), c.id);
|
|
56945
56989
|
run.push(el);
|
|
@@ -57105,14 +57149,14 @@ function hwp5SectionToXml(records, ctx) {
|
|
|
57105
57149
|
return `<hs:sec xmlns:hs="http://www.hancom.co.kr/hwpml/2011/section" xmlns:hp="http://www.hancom.co.kr/hwpml/2011/paragraph" xmlns:hc="http://www.hancom.co.kr/hwpml/2011/core">` + paragraphsXml(records, 0, records.length, 0, ctx, 0) + "</hs:sec>";
|
|
57106
57150
|
}
|
|
57107
57151
|
function renderHwp5Records(docInfo, styles, secRecords, binData, options, select, warnings = []) {
|
|
57108
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
57152
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1591 => _1591.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
57109
57153
|
const MAX_TOTAL_IMAGE_BYTES = 128 * 1024 * 1024;
|
|
57110
57154
|
const images = /* @__PURE__ */ new Map();
|
|
57111
57155
|
let totalImgBytes = 0;
|
|
57112
57156
|
const imageRef = (binDataId) => {
|
|
57113
57157
|
if (binDataId <= 0) return null;
|
|
57114
|
-
const item = _optionalChain([docInfo, 'optionalAccess',
|
|
57115
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
57158
|
+
const item = _optionalChain([docInfo, 'optionalAccess', _1592 => _1592.binData, 'access', _1593 => _1593[binDataId - 1]]);
|
|
57159
|
+
if (_optionalChain([item, 'optionalAccess', _1594 => _1594.kind]) === "link") return null;
|
|
57116
57160
|
const storageId = item && item.storageId > 0 ? item.storageId : binDataId;
|
|
57117
57161
|
const ref = `bin${storageId}`;
|
|
57118
57162
|
if (images.has(ref)) return ref;
|
|
@@ -57146,8 +57190,8 @@ function renderHwp5Records(docInfo, styles, secRecords, binData, options, select
|
|
|
57146
57190
|
}
|
|
57147
57191
|
roots.push({ root, index: si });
|
|
57148
57192
|
}
|
|
57149
|
-
if (roots.length === 0) throw new (0,
|
|
57150
|
-
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
57193
|
+
if (roots.length === 0) throw new (0, _chunkPNSALBXHcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP \uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
57194
|
+
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1595 => _1595.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1596 => _1596.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1597 => _1597.highlights]) });
|
|
57151
57195
|
return assemblePageSvgs(r, "hwp", select);
|
|
57152
57196
|
}
|
|
57153
57197
|
function renderHwp5Pages(input, options, select) {
|
|
@@ -57159,7 +57203,7 @@ function renderHwp5Pages(input, options, select) {
|
|
|
57159
57203
|
const styles = buildHwp5RenderStyles(_nullishCoalesce(docInfoRecords, () => ( [])));
|
|
57160
57204
|
const docInfo = docInfoRecords ? parseDocInfo(docInfoRecords) : null;
|
|
57161
57205
|
const sections = readHwp5SectionStreams(c);
|
|
57162
|
-
if (sections.length === 0) throw new (0,
|
|
57206
|
+
if (sections.length === 0) throw new (0, _chunkPNSALBXHcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
57163
57207
|
const parseWarnings = [];
|
|
57164
57208
|
const secRecords = readHwp5SectionRecords(c, sections, parseWarnings);
|
|
57165
57209
|
for (const w of parseWarnings) warnings.push(w.message);
|
|
@@ -57245,14 +57289,14 @@ async function loadSharp() {
|
|
|
57245
57289
|
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("sharp")));
|
|
57246
57290
|
return _nullishCoalesce(mod.default, () => ( mod));
|
|
57247
57291
|
} catch (e47) {
|
|
57248
|
-
throw new (0,
|
|
57249
|
-
'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.' +
|
|
57292
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(
|
|
57293
|
+
'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.' + _chunkPNSALBXHcjs.OPTIONAL_DEP_INSTALL_HINT
|
|
57250
57294
|
);
|
|
57251
57295
|
}
|
|
57252
57296
|
}
|
|
57253
57297
|
async function rasterizePageSvg(svg, widthPt, heightPt, options = {}) {
|
|
57254
57298
|
const sharp = await loadSharp();
|
|
57255
|
-
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0,
|
|
57299
|
+
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0, _chunkPNSALBXHcjs.KordocError)(`\uC798\uBABB\uB41C \uD398\uC774\uC9C0 \uD06C\uAE30: ${widthPt}x${heightPt}pt`);
|
|
57256
57300
|
const maxW = _nullishCoalesce(options.maxWidthPx, () => ( 1400));
|
|
57257
57301
|
const maxH = _nullishCoalesce(options.maxHeightPx, () => ( 4e3));
|
|
57258
57302
|
const scale2 = Math.min(maxW / widthPt, maxH / heightPt, 2);
|
|
@@ -57270,11 +57314,11 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
57270
57314
|
try {
|
|
57271
57315
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
57272
57316
|
} catch (e48) {
|
|
57273
|
-
throw new (0,
|
|
57317
|
+
throw new (0, _chunkPNSALBXHcjs.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");
|
|
57274
57318
|
}
|
|
57275
57319
|
const executablePath = _nullishCoalesce(_nullishCoalesce(options.browserExecutablePath, () => ( process.env.PUPPETEER_EXECUTABLE_PATH)), () => ( findChromiumPath()));
|
|
57276
57320
|
if (!executablePath) {
|
|
57277
|
-
throw new (0,
|
|
57321
|
+
throw new (0, _chunkPNSALBXHcjs.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");
|
|
57278
57322
|
}
|
|
57279
57323
|
const { browser, page } = await launchLockedPage(puppeteer, executablePath);
|
|
57280
57324
|
try {
|
|
@@ -57290,13 +57334,13 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
57290
57334
|
async function loadBuffer(input) {
|
|
57291
57335
|
if (typeof input === "string") {
|
|
57292
57336
|
try {
|
|
57293
|
-
return
|
|
57337
|
+
return _chunkPNSALBXHcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input));
|
|
57294
57338
|
} catch (err) {
|
|
57295
57339
|
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
57296
|
-
throw new (0,
|
|
57340
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`);
|
|
57297
57341
|
}
|
|
57298
57342
|
}
|
|
57299
|
-
if (Buffer.isBuffer(input)) return
|
|
57343
|
+
if (Buffer.isBuffer(input)) return _chunkPNSALBXHcjs.toArrayBuffer.call(void 0, input);
|
|
57300
57344
|
if (input instanceof Uint8Array) return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
|
|
57301
57345
|
return input;
|
|
57302
57346
|
}
|
|
@@ -57305,17 +57349,17 @@ async function sourceFormatOf(buffer) {
|
|
|
57305
57349
|
if (format2 === "hwpx") {
|
|
57306
57350
|
const zip = await detectZipFormat(buffer);
|
|
57307
57351
|
if (zip === "hwpx" || zip === "unknown") return "hwpx";
|
|
57308
|
-
throw new (0,
|
|
57352
|
+
throw new (0, _chunkPNSALBXHcjs.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`);
|
|
57309
57353
|
}
|
|
57310
57354
|
if (format2 === "hwp") return "hwp";
|
|
57311
|
-
throw new (0,
|
|
57355
|
+
throw new (0, _chunkPNSALBXHcjs.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`);
|
|
57312
57356
|
}
|
|
57313
57357
|
async function renderDocumentToScene(input, options = {}) {
|
|
57314
57358
|
const buffer = await loadBuffer(input);
|
|
57315
57359
|
const source = await sourceFormatOf(buffer);
|
|
57316
57360
|
const select = options.pages !== void 0 ? (pageCount) => {
|
|
57317
57361
|
const set = _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, pageCount);
|
|
57318
|
-
if (set.size === 0) throw new (0,
|
|
57362
|
+
if (set.size === 0) throw new (0, _chunkPNSALBXHcjs.KordocError)(`\uC120\uD0DD\uD55C \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uBB38\uC11C\uB294 ${pageCount}\uCABD (pages: ${JSON.stringify(options.pages)})`);
|
|
57319
57363
|
return set;
|
|
57320
57364
|
} : void 0;
|
|
57321
57365
|
const renderOptions = { reflow: _nullishCoalesce(options.reflow, () => ( true)), reflowMode: options.reflowMode, highlights: options.highlights, maxImageBytes: options.maxImageBytes };
|
|
@@ -57351,7 +57395,7 @@ async function renderDocument(input, options) {
|
|
|
57351
57395
|
break;
|
|
57352
57396
|
}
|
|
57353
57397
|
default:
|
|
57354
|
-
throw new (0,
|
|
57398
|
+
throw new (0, _chunkPNSALBXHcjs.KordocError)(`\uC54C \uC218 \uC5C6\uB294 \uB80C\uB354 \uD3EC\uB9F7: ${String(options.format)} (svg|html|png|jpeg|pdf)`);
|
|
57355
57399
|
}
|
|
57356
57400
|
return { scene, assets };
|
|
57357
57401
|
}
|
|
@@ -57381,7 +57425,7 @@ async function extractRenderedRegions(input, options = {}) {
|
|
|
57381
57425
|
const out = [];
|
|
57382
57426
|
for (const [page, items] of [...byPage.entries()].sort((a, b) => a[0] - b[0])) {
|
|
57383
57427
|
const meta = scene.pages.find((p) => p.page === page);
|
|
57384
|
-
if (!meta) throw new (0,
|
|
57428
|
+
if (!meta) throw new (0, _chunkPNSALBXHcjs.KordocError)(`\uD398\uC774\uC9C0 ${page} \uBA54\uD0C0 \uC5C6\uC74C`);
|
|
57385
57429
|
const raster = await rasterizePageSvg(pageSvgs.get(page), meta.width, meta.height, { format: format2, maxWidthPx: options.maxWidthPx, quality: options.quality });
|
|
57386
57430
|
for (const { region, bbox } of items) {
|
|
57387
57431
|
const rect = cropRect(bbox, raster.scale, raster.widthPx, raster.heightPx, _nullishCoalesce(options.paddingPt, () => ( 0)));
|
|
@@ -57405,9 +57449,9 @@ function wantsCrop(kind, policy) {
|
|
|
57405
57449
|
}
|
|
57406
57450
|
async function extractTables(input, options = {}) {
|
|
57407
57451
|
const policy = _nullishCoalesce(options.policy, () => ( "non-tabular-and-uncertain"));
|
|
57408
|
-
const buffer = typeof input === "string" ?
|
|
57452
|
+
const buffer = typeof input === "string" ? _chunkPNSALBXHcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input)) : Buffer.isBuffer(input) ? _chunkPNSALBXHcjs.toArrayBuffer.call(void 0, input) : input;
|
|
57409
57453
|
const parsed = await parse(buffer, { classifyTables: true, layoutTables: "keep" });
|
|
57410
|
-
if (!parsed.success) throw new (0,
|
|
57454
|
+
if (!parsed.success) throw new (0, _chunkPNSALBXHcjs.KordocError)(`\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
57411
57455
|
const blocks = collectTableBlocks(parsed.blocks);
|
|
57412
57456
|
const out = blocks.map((b, i) => ({
|
|
57413
57457
|
id: _nullishCoalesce(b.table.sourceId, () => ( `tbl-${i + 1}`)),
|
|
@@ -57465,22 +57509,22 @@ async function extractTables(input, options = {}) {
|
|
|
57465
57509
|
// src/index.ts
|
|
57466
57510
|
async function parse(input, options) {
|
|
57467
57511
|
let buffer;
|
|
57468
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
57469
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
57512
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _1598 => _1598.filePath]) ? { ...options, filePath: input } : options;
|
|
57513
|
+
if (_optionalChain([opts, 'optionalAccess', _1599 => _1599.htmlTables]) && opts.tableFormat) {
|
|
57470
57514
|
return { success: false, fileType: "unknown", error: "htmlTables \uC640 tableFormat \uC740 \uD568\uAED8 \uC4F8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4" };
|
|
57471
57515
|
}
|
|
57472
|
-
const ocrOptionError =
|
|
57516
|
+
const ocrOptionError = _chunkJFUUFJZWcjs.validateOcrOptions.call(void 0, opts);
|
|
57473
57517
|
if (ocrOptionError) return { success: false, fileType: "unknown", error: ocrOptionError };
|
|
57474
57518
|
if (typeof input === "string") {
|
|
57475
57519
|
try {
|
|
57476
57520
|
const buf = await _promises.readFile.call(void 0, input);
|
|
57477
|
-
buffer =
|
|
57521
|
+
buffer = _chunkPNSALBXHcjs.toArrayBuffer.call(void 0, buf);
|
|
57478
57522
|
} catch (err) {
|
|
57479
57523
|
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}`;
|
|
57480
|
-
return { success: false, fileType: "unknown", error: msg2, code:
|
|
57524
|
+
return { success: false, fileType: "unknown", error: msg2, code: _chunkPNSALBXHcjs.classifyError.call(void 0, err) };
|
|
57481
57525
|
}
|
|
57482
57526
|
} else if (Buffer.isBuffer(input)) {
|
|
57483
|
-
buffer =
|
|
57527
|
+
buffer = _chunkPNSALBXHcjs.toArrayBuffer.call(void 0, input);
|
|
57484
57528
|
} else {
|
|
57485
57529
|
buffer = input;
|
|
57486
57530
|
}
|
|
@@ -57489,23 +57533,23 @@ async function parse(input, options) {
|
|
|
57489
57533
|
}
|
|
57490
57534
|
const format2 = detectFormat(buffer);
|
|
57491
57535
|
const result = await dispatch(format2, buffer, opts);
|
|
57492
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
57536
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1600 => _1600.images]) === false) {
|
|
57493
57537
|
delete result.images;
|
|
57494
57538
|
dropImageBytes(result.blocks);
|
|
57495
57539
|
}
|
|
57496
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
57540
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1601 => _1601.classifyTables])) classifyTableTree(result.blocks);
|
|
57497
57541
|
let out = result;
|
|
57498
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
57542
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1602 => _1602.pages]) && result.pageCount && _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, opts.pages, result.pageCount).size === 0) {
|
|
57499
57543
|
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` }] };
|
|
57500
57544
|
}
|
|
57501
57545
|
if (out.success && !out.pages) {
|
|
57502
|
-
const pages =
|
|
57546
|
+
const pages = _chunkIGG63DFKcjs.blocksToPages.call(void 0, out.blocks, (bs) => _chunkJFUUFJZWcjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([opts, 'optionalAccess', _1603 => _1603.tableFormat]) }));
|
|
57503
57547
|
if (pages) out = { ...out, pages };
|
|
57504
57548
|
}
|
|
57505
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
57549
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _1604 => _1604.plain])) {
|
|
57506
57550
|
out = { ...out, markdown: toPlainMarkdown(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toPlainMarkdown(p.markdown) })) } : {} };
|
|
57507
57551
|
}
|
|
57508
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
57552
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _1605 => _1605.htmlTables])) {
|
|
57509
57553
|
out = { ...out, markdown: toHtmlTables(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toHtmlTables(p.markdown) })) } : {} };
|
|
57510
57554
|
}
|
|
57511
57555
|
return out;
|
|
@@ -57550,42 +57594,42 @@ async function dispatch(format2, buffer, opts) {
|
|
|
57550
57594
|
async function withEmbeddedImageOcr(blocks, markdown, warnings, images, options) {
|
|
57551
57595
|
const list = [..._nullishCoalesce(warnings, () => ( []))];
|
|
57552
57596
|
if (!await ocrEmbeddedImages(blocks, options, list)) return { markdown, warnings: list.length ? list : void 0 };
|
|
57553
|
-
let md2 =
|
|
57554
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
57597
|
+
let md2 = _chunkJFUUFJZWcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1606 => _1606.tableFormat]) });
|
|
57598
|
+
if (_optionalChain([options, 'optionalAccess', _1607 => _1607.inlineImages]) && options.images !== false && _optionalChain([images, 'optionalAccess', _1608 => _1608.length])) {
|
|
57555
57599
|
try {
|
|
57556
|
-
md2 =
|
|
57600
|
+
md2 = _chunkIGG63DFKcjs.inlineImagesIntoMarkdown.call(void 0, md2, images, { compress: true });
|
|
57557
57601
|
} catch (e49) {
|
|
57558
57602
|
}
|
|
57559
57603
|
}
|
|
57560
57604
|
return { markdown: md2, warnings: list.length ? list : void 0 };
|
|
57561
57605
|
}
|
|
57562
57606
|
function scriptsOff(r, off) {
|
|
57563
|
-
return off ?
|
|
57607
|
+
return off ? _chunkJFUUFJZWcjs.stripScriptTags.call(void 0, r) : r;
|
|
57564
57608
|
}
|
|
57565
57609
|
async function parseImage(buffer, options) {
|
|
57566
57610
|
try {
|
|
57567
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
57611
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-QNIMVE5A.cjs")));
|
|
57568
57612
|
const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
|
|
57569
|
-
|
|
57613
|
+
_chunkJFUUFJZWcjs.stripScriptTags.call(void 0, { blocks });
|
|
57570
57614
|
return {
|
|
57571
57615
|
success: true,
|
|
57572
57616
|
fileType: "image",
|
|
57573
|
-
markdown:
|
|
57617
|
+
markdown: _chunkJFUUFJZWcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1609 => _1609.tableFormat]) }),
|
|
57574
57618
|
blocks,
|
|
57575
57619
|
warnings: warnings.length ? warnings : void 0,
|
|
57576
57620
|
pageCount: 1,
|
|
57577
|
-
..._optionalChain([options, 'optionalAccess',
|
|
57621
|
+
..._optionalChain([options, 'optionalAccess', _1610 => _1610.ocrLines]) ? { ocrLines: lines ? [lines] : [] } : {}
|
|
57578
57622
|
};
|
|
57579
57623
|
} catch (err) {
|
|
57580
|
-
return { success: false, fileType: "image", error:
|
|
57624
|
+
return { success: false, fileType: "image", error: _chunkPNSALBXHcjs.sanitizeError.call(void 0, err), code: _chunkPNSALBXHcjs.classifyError.call(void 0, err) };
|
|
57581
57625
|
}
|
|
57582
57626
|
}
|
|
57583
57627
|
async function parseHwp3(buffer, options) {
|
|
57584
57628
|
try {
|
|
57585
57629
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp3Document(buffer, options);
|
|
57586
|
-
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
57630
|
+
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess', _1611 => _1611.pageCount]) };
|
|
57587
57631
|
} catch (err) {
|
|
57588
|
-
return { success: false, fileType: "hwp3", error:
|
|
57632
|
+
return { success: false, fileType: "hwp3", error: _chunkPNSALBXHcjs.sanitizeError.call(void 0, err), code: _chunkPNSALBXHcjs.classifyError.call(void 0, err) };
|
|
57589
57633
|
}
|
|
57590
57634
|
}
|
|
57591
57635
|
async function parseHwpx(buffer, options) {
|
|
@@ -57593,15 +57637,15 @@ async function parseHwpx(buffer, options) {
|
|
|
57593
57637
|
const doc = await parseHwpxDocument(buffer, options);
|
|
57594
57638
|
const { blocks, metadata, outline, images } = doc;
|
|
57595
57639
|
const { markdown, warnings } = await withEmbeddedImageOcr(blocks, doc.markdown, doc.warnings, void 0, options);
|
|
57596
|
-
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
57640
|
+
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1612 => _1612.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1613 => _1613.pageCount]) }, _optionalChain([options, 'optionalAccess', _1614 => _1614.scriptTags]) === false);
|
|
57597
57641
|
} catch (err) {
|
|
57598
|
-
return { success: false, fileType: "hwpx", error:
|
|
57642
|
+
return { success: false, fileType: "hwpx", error: _chunkPNSALBXHcjs.sanitizeError.call(void 0, err), code: _chunkPNSALBXHcjs.classifyError.call(void 0, err) };
|
|
57599
57643
|
}
|
|
57600
57644
|
}
|
|
57601
57645
|
async function parseHwp(buffer, options) {
|
|
57602
57646
|
try {
|
|
57603
57647
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
57604
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
57648
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _1615 => _1615.filePath])) {
|
|
57605
57649
|
try {
|
|
57606
57650
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
57607
57651
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -57620,15 +57664,15 @@ async function parseHwp(buffer, options) {
|
|
|
57620
57664
|
}
|
|
57621
57665
|
}
|
|
57622
57666
|
const ocred = await withEmbeddedImageOcr(blocks, markdown, warnings, images, options);
|
|
57623
|
-
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess',
|
|
57667
|
+
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess', _1616 => _1616.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1617 => _1617.pageCount]) }, _optionalChain([options, 'optionalAccess', _1618 => _1618.scriptTags]) === false);
|
|
57624
57668
|
} catch (err) {
|
|
57625
|
-
return { success: false, fileType: "hwp", error:
|
|
57669
|
+
return { success: false, fileType: "hwp", error: _chunkPNSALBXHcjs.sanitizeError.call(void 0, err), code: _chunkPNSALBXHcjs.classifyError.call(void 0, err) };
|
|
57626
57670
|
}
|
|
57627
57671
|
}
|
|
57628
57672
|
async function parsePdf(buffer, options) {
|
|
57629
57673
|
let parsePdfDocument;
|
|
57630
57674
|
try {
|
|
57631
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
57675
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-RPAHN3OR.cjs")));
|
|
57632
57676
|
parsePdfDocument = mod.parsePdfDocument;
|
|
57633
57677
|
} catch (e51) {
|
|
57634
57678
|
return {
|
|
@@ -57640,59 +57684,59 @@ async function parsePdf(buffer, options) {
|
|
|
57640
57684
|
}
|
|
57641
57685
|
try {
|
|
57642
57686
|
const { markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, ocrLines } = await parsePdfDocument(buffer, options);
|
|
57643
|
-
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
57687
|
+
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess', _1619 => _1619.pageCount]), ...ocrLines ? { ocrLines } : {} }, _optionalChain([options, 'optionalAccess', _1620 => _1620.scriptTags]) !== true);
|
|
57644
57688
|
} catch (err) {
|
|
57645
57689
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
57646
|
-
return { success: false, fileType: "pdf", error:
|
|
57690
|
+
return { success: false, fileType: "pdf", error: _chunkPNSALBXHcjs.sanitizeError.call(void 0, err), code: _chunkPNSALBXHcjs.classifyError.call(void 0, err), isImageBased };
|
|
57647
57691
|
}
|
|
57648
57692
|
}
|
|
57649
57693
|
async function parseXlsx(buffer, options) {
|
|
57650
57694
|
try {
|
|
57651
57695
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
57652
|
-
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
57696
|
+
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1621 => _1621.pageCount]) };
|
|
57653
57697
|
} catch (err) {
|
|
57654
|
-
return { success: false, fileType: "xlsx", error:
|
|
57698
|
+
return { success: false, fileType: "xlsx", error: _chunkPNSALBXHcjs.sanitizeError.call(void 0, err), code: _chunkPNSALBXHcjs.classifyError.call(void 0, err) };
|
|
57655
57699
|
}
|
|
57656
57700
|
}
|
|
57657
57701
|
async function parseXls(buffer, options) {
|
|
57658
57702
|
try {
|
|
57659
57703
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
57660
|
-
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
57704
|
+
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1622 => _1622.pageCount]) };
|
|
57661
57705
|
} catch (err) {
|
|
57662
|
-
return { success: false, fileType: "xls", error:
|
|
57706
|
+
return { success: false, fileType: "xls", error: _chunkPNSALBXHcjs.sanitizeError.call(void 0, err), code: _chunkPNSALBXHcjs.classifyError.call(void 0, err) };
|
|
57663
57707
|
}
|
|
57664
57708
|
}
|
|
57665
57709
|
async function parseDocx(buffer, options) {
|
|
57666
57710
|
try {
|
|
57667
57711
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
57668
|
-
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
57712
|
+
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1623 => _1623.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1624 => _1624.pageCount]) }, _optionalChain([options, 'optionalAccess', _1625 => _1625.scriptTags]) === false);
|
|
57669
57713
|
} catch (err) {
|
|
57670
|
-
return { success: false, fileType: "docx", error:
|
|
57714
|
+
return { success: false, fileType: "docx", error: _chunkPNSALBXHcjs.sanitizeError.call(void 0, err), code: _chunkPNSALBXHcjs.classifyError.call(void 0, err) };
|
|
57671
57715
|
}
|
|
57672
57716
|
}
|
|
57673
57717
|
async function parsePptx(buffer, options) {
|
|
57674
57718
|
try {
|
|
57675
57719
|
const { markdown, blocks, metadata, outline, warnings, images } = await parsePptxDocument(buffer, options);
|
|
57676
|
-
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
57720
|
+
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1626 => _1626.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1627 => _1627.pageCount]) }, _optionalChain([options, 'optionalAccess', _1628 => _1628.scriptTags]) === false);
|
|
57677
57721
|
} catch (err) {
|
|
57678
|
-
return { success: false, fileType: "pptx", error:
|
|
57722
|
+
return { success: false, fileType: "pptx", error: _chunkPNSALBXHcjs.sanitizeError.call(void 0, err), code: _chunkPNSALBXHcjs.classifyError.call(void 0, err) };
|
|
57679
57723
|
}
|
|
57680
57724
|
}
|
|
57681
57725
|
async function parseHwpml(buffer, options) {
|
|
57682
57726
|
try {
|
|
57683
57727
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
57684
|
-
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
57728
|
+
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1629 => _1629.pageCount]) };
|
|
57685
57729
|
} catch (err) {
|
|
57686
|
-
return { success: false, fileType: "hwpml", error:
|
|
57730
|
+
return { success: false, fileType: "hwpml", error: _chunkPNSALBXHcjs.sanitizeError.call(void 0, err), code: _chunkPNSALBXHcjs.classifyError.call(void 0, err) };
|
|
57687
57731
|
}
|
|
57688
57732
|
}
|
|
57689
57733
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
57690
57734
|
let buffer;
|
|
57691
57735
|
if (typeof input === "string") {
|
|
57692
57736
|
const buf = await _promises.readFile.call(void 0, input);
|
|
57693
|
-
buffer =
|
|
57737
|
+
buffer = _chunkPNSALBXHcjs.toArrayBuffer.call(void 0, buf);
|
|
57694
57738
|
} else if (Buffer.isBuffer(input)) {
|
|
57695
|
-
buffer =
|
|
57739
|
+
buffer = _chunkPNSALBXHcjs.toArrayBuffer.call(void 0, input);
|
|
57696
57740
|
} else {
|
|
57697
57741
|
buffer = input;
|
|
57698
57742
|
}
|
|
@@ -57718,7 +57762,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
57718
57762
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
57719
57763
|
}
|
|
57720
57764
|
const fill = fillFormFields(parsed.blocks, values);
|
|
57721
|
-
const markdown =
|
|
57765
|
+
const markdown = _chunkJFUUFJZWcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
57722
57766
|
if (outputFormat === "hwpx") {
|
|
57723
57767
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
57724
57768
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -57828,5 +57872,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
57828
57872
|
|
|
57829
57873
|
|
|
57830
57874
|
|
|
57831
|
-
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 =
|
|
57875
|
+
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 = _chunkPNSALBXHcjs.VERSION; exports.ValueCursor = ValueCursor; exports.agencyNames = agencyNames; exports.agencyStyle = agencyStyle; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkJFUUFJZWcjs.blocksToMarkdown; exports.blocksToPages = _chunkIGG63DFKcjs.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 = _chunkJFUUFJZWcjs.flattenLayoutTables; exports.formatFillValue = formatFillValue; exports.formatGateFinding = formatGateFinding; exports.gongmunGate = gongmunGate; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hasStructuredCellContent = _chunkJFUUFJZWcjs.hasStructuredCellContent; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintBlocks = lintBlocks; exports.lintBudgetText = lintBudgetText; exports.lintGongmunText = lintGongmunText; exports.lintLogicText = lintLogicText; exports.lintMuncheText = lintMuncheText; exports.lintSlopText = lintSlopText; exports.logicLintWarnings = logicLintWarnings; 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.placeTotalRow = placeTotalRow; exports.readBuiltinTemplate = readBuiltinTemplate; exports.readBuiltinTemplateSample = readBuiltinTemplateSample; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderDocument = renderDocument; exports.renderDocumentToScene = renderDocumentToScene; exports.renderHtml = renderHtml; exports.renderHwp5Pages = renderHwp5Pages; exports.renderHwpxToSvg = renderHwpxToSvg; exports.renderSceneToHtml = renderSceneToHtml; exports.resolveBuiltinTemplate = resolveBuiltinTemplate; exports.runLintSuite = runLintSuite; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.slopLintWarnings = slopLintWarnings; exports.unknownFontWarnings = unknownFontWarnings; exports.usesGaejosikMunche = usesGaejosikMunche; exports.usesLogicStructure = usesLogicStructure; exports.validateHwpx = validateHwpx;
|
|
57832
57876
|
//# sourceMappingURL=index.cjs.map
|