kordoc 4.17.2 → 4.17.3
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/dist/{-2UA2JHVA.js → -WP4ZCXHV.js} +11 -11
- package/dist/{chunk-HAW2VL62.cjs → chunk-2VMTMIGD.cjs} +12 -12
- package/dist/{chunk-HAW2VL62.cjs.map → chunk-2VMTMIGD.cjs.map} +1 -1
- package/dist/{chunk-5JZEY5IL.js → chunk-4PY2V33D.js} +2 -2
- package/dist/{chunk-A2W2JQ3S.js → chunk-5BDNDGUI.js} +2 -2
- package/dist/{chunk-O4CB7D2Q.js → chunk-5HIJXVED.js} +2 -2
- package/dist/chunk-BAEABKCB.js +170 -0
- package/dist/chunk-BAEABKCB.js.map +1 -0
- package/dist/{chunk-WJLICIYV.js → chunk-C3MC7HOB.js} +24 -21
- package/dist/{chunk-WJLICIYV.js.map → chunk-C3MC7HOB.js.map} +1 -1
- package/dist/{chunk-JY2NBFIG.js → chunk-CKF5HTM6.js} +6 -6
- package/dist/{chunk-YGKC6E6A.js → chunk-DPMDJYHX.js} +2 -2
- package/dist/chunk-DUHHMIPS.cjs +170 -0
- package/dist/chunk-DUHHMIPS.cjs.map +1 -0
- package/dist/{chunk-6OCKAXIS.js → chunk-EM2J3MAE.js} +2 -2
- package/dist/{chunk-GPC72VSF.cjs → chunk-HNPRQKLZ.cjs} +262 -171
- package/dist/chunk-HNPRQKLZ.cjs.map +1 -0
- package/dist/{chunk-MDCTITUG.js → chunk-JNCWHGJG.js} +2 -2
- package/dist/{chunk-C4MVZXB5.js → chunk-JORDNRVS.js} +2 -2
- package/dist/{chunk-ZDX5PIWR.js → chunk-JPQNRW7C.js} +2 -2
- package/dist/{chunk-WWMKIHF7.cjs → chunk-K2GXTJPK.cjs} +21 -21
- package/dist/{chunk-WWMKIHF7.cjs.map → chunk-K2GXTJPK.cjs.map} +1 -1
- package/dist/{chunk-4TSYMJDL.js → chunk-K7W5L4GI.js} +3 -3
- package/dist/{chunk-FGL4IGOT.js → chunk-OOUW3ROZ.js} +4 -4
- package/dist/{chunk-2XHXABCX.js → chunk-Q7SPGAAA.js} +2 -2
- package/dist/{chunk-XZA6X34R.js → chunk-TOPQ7T4N.js} +2 -2
- package/dist/{chunk-4HRJISJF.js → chunk-TTSXZO2A.js} +3 -3
- package/dist/{chunk-SDRKHEVT.js → chunk-UHGWEWZI.js} +255 -164
- package/dist/chunk-UHGWEWZI.js.map +1 -0
- package/dist/{chunk-VU26WGE5.js → chunk-UJZABAVA.js} +10 -10
- package/dist/{chunk-WL3BWROT.js → chunk-UTKVDI22.js} +22 -12
- package/dist/chunk-UTKVDI22.js.map +1 -0
- package/dist/{chunk-3N272C5L.js → chunk-VNDVI3MJ.js} +4 -4
- package/dist/{chunk-KQIYC2ZU.js → chunk-WFXZRYFS.js} +2 -2
- package/dist/{chunk-GYTL6WT3.js → chunk-YDWHS7FP.js} +3 -3
- package/dist/{chunk-6DOCSYEM.cjs → chunk-YKL7GP7E.cjs} +3 -3
- package/dist/{chunk-6DOCSYEM.cjs.map → chunk-YKL7GP7E.cjs.map} +1 -1
- package/dist/{chunk-KZVQK5NS.cjs → chunk-ZWPINXUX.cjs} +2 -2
- package/dist/{chunk-KZVQK5NS.cjs.map → chunk-ZWPINXUX.cjs.map} +1 -1
- package/dist/chunks-S7XODMX4.js +10 -0
- package/dist/cli.js +26 -26
- package/dist/{formula-MBLN2DG4.js → formula-H2NAOQHD.js} +4 -4
- package/dist/{formula-QZZDW5GW.js → formula-NZ7G4AXC.js} +3 -3
- package/dist/{formula-5RETDCIC.cjs → formula-Y3L3RPPI.cjs} +9 -9
- package/dist/{formula-5RETDCIC.cjs.map → formula-Y3L3RPPI.cjs.map} +1 -1
- package/dist/{image-ocr-EREKAS47.js → image-ocr-BGMQPELF.js} +6 -6
- package/dist/{image-ocr-PSPVRLB5.cjs → image-ocr-QYLWWB7R.cjs} +15 -15
- package/dist/{image-ocr-PSPVRLB5.cjs.map → image-ocr-QYLWWB7R.cjs.map} +1 -1
- package/dist/{image-ocr-CJSO3QSR.js → image-ocr-UTSJ2Q4Q.js} +9 -8
- package/dist/{image-ocr-CJSO3QSR.js.map → image-ocr-UTSJ2Q4Q.js.map} +1 -1
- package/dist/index.cjs +259 -259
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -16
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-MA4MMCRJ.js → model-bundle-QHZYIAUP.js} +5 -5
- package/dist/{models-SEJ7LNSN.js → models-MCBWWGBX.js} +5 -5
- package/dist/{parser-M5WHRX25.js → parser-72NGANOD.js} +11 -11
- package/dist/{parser-QILYPWSI.cjs → parser-BEPVGAMI.cjs} +114 -114
- package/dist/{parser-QILYPWSI.cjs.map → parser-BEPVGAMI.cjs.map} +1 -1
- package/dist/{parser-VH3F4EQU.js → parser-IGTNLJ6E.js} +12 -12
- package/dist/pdf-ocr-BW6RUT4H.cjs +16 -0
- package/dist/{pdf-ocr-3SZUM3CN.cjs.map → pdf-ocr-BW6RUT4H.cjs.map} +1 -1
- package/dist/pdf-ocr-EWG24RNY.js +15 -0
- package/dist/pdf-ocr-TCDSJFQT.js +19 -0
- package/dist/{profile-io-5YB627EO.js → profile-io-H2BCBNRL.js} +3 -3
- package/dist/{rasterize-V2XHHS2I.js → rasterize-HIEA3MGV.js} +3 -3
- package/dist/{redact-doc-5MK5L5IQ.js → redact-doc-MHIY4AWT.js} +11 -11
- package/dist/{render-SYZMHYK6.js → render-NIX6VP3C.js} +7 -7
- package/dist/seal-QTCJFT7G.js +10 -0
- package/dist/{setup-ZPLJENSK.js → setup-DU5WIHAX.js} +3 -3
- package/dist/visual-TU2BS63P.js +20 -0
- package/dist/{watch-FNWHVKK3.js → watch-XW6CSLL7.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-GPC72VSF.cjs.map +0 -1
- package/dist/chunk-SDRKHEVT.js.map +0 -1
- package/dist/chunk-UX3HHAWH.js +0 -248
- package/dist/chunk-UX3HHAWH.js.map +0 -1
- package/dist/chunk-WL3BWROT.js.map +0 -1
- package/dist/chunk-YIANW5QX.cjs +0 -248
- package/dist/chunk-YIANW5QX.cjs.map +0 -1
- package/dist/chunks-EBWJR55V.js +0 -10
- package/dist/pdf-ocr-3SZUM3CN.cjs +0 -16
- package/dist/pdf-ocr-QB2TB5W5.js +0 -18
- package/dist/pdf-ocr-XC33L43D.js +0 -15
- package/dist/seal-IPKIQHYB.js +0 -10
- package/dist/visual-RTTGNOAE.js +0 -20
- /package/dist/{-2UA2JHVA.js.map → -WP4ZCXHV.js.map} +0 -0
- /package/dist/{chunk-5JZEY5IL.js.map → chunk-4PY2V33D.js.map} +0 -0
- /package/dist/{chunk-A2W2JQ3S.js.map → chunk-5BDNDGUI.js.map} +0 -0
- /package/dist/{chunk-O4CB7D2Q.js.map → chunk-5HIJXVED.js.map} +0 -0
- /package/dist/{chunk-JY2NBFIG.js.map → chunk-CKF5HTM6.js.map} +0 -0
- /package/dist/{chunk-YGKC6E6A.js.map → chunk-DPMDJYHX.js.map} +0 -0
- /package/dist/{chunk-6OCKAXIS.js.map → chunk-EM2J3MAE.js.map} +0 -0
- /package/dist/{chunk-MDCTITUG.js.map → chunk-JNCWHGJG.js.map} +0 -0
- /package/dist/{chunk-C4MVZXB5.js.map → chunk-JORDNRVS.js.map} +0 -0
- /package/dist/{chunk-ZDX5PIWR.js.map → chunk-JPQNRW7C.js.map} +0 -0
- /package/dist/{chunk-4TSYMJDL.js.map → chunk-K7W5L4GI.js.map} +0 -0
- /package/dist/{chunk-FGL4IGOT.js.map → chunk-OOUW3ROZ.js.map} +0 -0
- /package/dist/{chunk-2XHXABCX.js.map → chunk-Q7SPGAAA.js.map} +0 -0
- /package/dist/{chunk-XZA6X34R.js.map → chunk-TOPQ7T4N.js.map} +0 -0
- /package/dist/{chunk-4HRJISJF.js.map → chunk-TTSXZO2A.js.map} +0 -0
- /package/dist/{chunk-VU26WGE5.js.map → chunk-UJZABAVA.js.map} +0 -0
- /package/dist/{chunk-3N272C5L.js.map → chunk-VNDVI3MJ.js.map} +0 -0
- /package/dist/{chunk-KQIYC2ZU.js.map → chunk-WFXZRYFS.js.map} +0 -0
- /package/dist/{chunk-GYTL6WT3.js.map → chunk-YDWHS7FP.js.map} +0 -0
- /package/dist/{chunks-EBWJR55V.js.map → chunks-S7XODMX4.js.map} +0 -0
- /package/dist/{formula-MBLN2DG4.js.map → formula-H2NAOQHD.js.map} +0 -0
- /package/dist/{formula-QZZDW5GW.js.map → formula-NZ7G4AXC.js.map} +0 -0
- /package/dist/{image-ocr-EREKAS47.js.map → image-ocr-BGMQPELF.js.map} +0 -0
- /package/dist/{model-bundle-MA4MMCRJ.js.map → model-bundle-QHZYIAUP.js.map} +0 -0
- /package/dist/{models-SEJ7LNSN.js.map → models-MCBWWGBX.js.map} +0 -0
- /package/dist/{parser-M5WHRX25.js.map → parser-72NGANOD.js.map} +0 -0
- /package/dist/{parser-VH3F4EQU.js.map → parser-IGTNLJ6E.js.map} +0 -0
- /package/dist/{pdf-ocr-QB2TB5W5.js.map → pdf-ocr-EWG24RNY.js.map} +0 -0
- /package/dist/{pdf-ocr-XC33L43D.js.map → pdf-ocr-TCDSJFQT.js.map} +0 -0
- /package/dist/{profile-io-5YB627EO.js.map → profile-io-H2BCBNRL.js.map} +0 -0
- /package/dist/{rasterize-V2XHHS2I.js.map → rasterize-HIEA3MGV.js.map} +0 -0
- /package/dist/{redact-doc-5MK5L5IQ.js.map → redact-doc-MHIY4AWT.js.map} +0 -0
- /package/dist/{render-SYZMHYK6.js.map → render-NIX6VP3C.js.map} +0 -0
- /package/dist/{seal-IPKIQHYB.js.map → seal-QTCJFT7G.js.map} +0 -0
- /package/dist/{setup-ZPLJENSK.js.map → setup-DU5WIHAX.js.map} +0 -0
- /package/dist/{visual-RTTGNOAE.js.map → visual-TU2BS63P.js.map} +0 -0
- /package/dist/{watch-FNWHVKK3.js.map → watch-XW6CSLL7.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
var _chunkDUHHMIPScjs = require('./chunk-DUHHMIPS.cjs');
|
|
4
5
|
|
|
5
6
|
|
|
7
|
+
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
|
|
@@ -16,10 +18,8 @@
|
|
|
16
18
|
|
|
17
19
|
|
|
18
20
|
|
|
19
|
-
var _chunkGPC72VSFcjs = require('./chunk-GPC72VSF.cjs');
|
|
20
21
|
|
|
21
22
|
|
|
22
|
-
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
@@ -30,7 +30,7 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
var
|
|
33
|
+
var _chunkHNPRQKLZcjs = require('./chunk-HNPRQKLZ.cjs');
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
@@ -47,14 +47,14 @@ var _chunkYIANW5QXcjs = require('./chunk-YIANW5QX.cjs');
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
var
|
|
50
|
+
var _chunkZWPINXUXcjs = require('./chunk-ZWPINXUX.cjs');
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
54
54
|
|
|
55
55
|
// src/plain-markdown.ts
|
|
56
56
|
function toPlainMarkdown(md2) {
|
|
57
|
-
return
|
|
57
|
+
return _chunkHNPRQKLZcjs.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();
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
// src/html-tables.ts
|
|
@@ -571,9 +571,9 @@ function rawTextContent(node, depth = 0) {
|
|
|
571
571
|
}
|
|
572
572
|
|
|
573
573
|
// src/hwpx/parser-shared.ts
|
|
574
|
-
var MAX_DECOMPRESS_SIZE =
|
|
574
|
+
var MAX_DECOMPRESS_SIZE = _chunkZWPINXUXcjs.unzipLimitBytes.call(void 0, 256 * 1024 * 1024);
|
|
575
575
|
var MAX_ZIP_ENTRIES = 500;
|
|
576
|
-
var ZipBombError = class extends
|
|
576
|
+
var ZipBombError = class extends _chunkZWPINXUXcjs.KordocError {
|
|
577
577
|
constructor(message) {
|
|
578
578
|
super(message);
|
|
579
579
|
this.name = "ZipBombError";
|
|
@@ -593,7 +593,7 @@ function createSectionShared() {
|
|
|
593
593
|
function createXmlParser(warnings) {
|
|
594
594
|
return new (0, _xmldom.DOMParser)({
|
|
595
595
|
onError(level, msg2) {
|
|
596
|
-
if (level === "fatalError") throw new (0,
|
|
596
|
+
if (level === "fatalError") throw new (0, _chunkZWPINXUXcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
597
597
|
_optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
598
598
|
}
|
|
599
599
|
});
|
|
@@ -628,13 +628,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
628
628
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
629
629
|
const checksumType = attrOf(inner, "checksum-type");
|
|
630
630
|
if (algorithm !== AES256_CBC) {
|
|
631
|
-
throw new (0,
|
|
631
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
632
632
|
}
|
|
633
633
|
if (startKey !== START_KEY_SHA256) {
|
|
634
|
-
throw new (0,
|
|
634
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
635
635
|
}
|
|
636
636
|
if (!_optionalChain([checksumType, 'optionalAccess', _8 => _8.endsWith, 'call', _9 => _9(CHECKSUM_SHA256_1K)])) {
|
|
637
|
-
throw new (0,
|
|
637
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
638
638
|
}
|
|
639
639
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
640
640
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -642,10 +642,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
642
642
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
643
643
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
644
644
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
645
|
-
throw new (0,
|
|
645
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
646
646
|
}
|
|
647
647
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
648
|
-
throw new (0,
|
|
648
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
649
649
|
}
|
|
650
650
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
651
651
|
}
|
|
@@ -678,11 +678,11 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
678
678
|
for (const entry of entries) {
|
|
679
679
|
const file = zip.file(entry.path);
|
|
680
680
|
if (!file) {
|
|
681
|
-
throw new (0,
|
|
681
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
682
682
|
}
|
|
683
683
|
const plain4 = decryptEntry(await file.async("nodebuffer"), entry, startKey);
|
|
684
684
|
if (!plain4) {
|
|
685
|
-
throw new (0,
|
|
685
|
+
throw new (0, _chunkZWPINXUXcjs.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.");
|
|
686
686
|
}
|
|
687
687
|
decrypted.push({ path: entry.path, plain: plain4 });
|
|
688
688
|
}
|
|
@@ -731,10 +731,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
731
731
|
const xml = await file.async("text");
|
|
732
732
|
if (decompressed) {
|
|
733
733
|
decompressed.total += xml.length * 2;
|
|
734
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
734
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkZWPINXUXcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
735
735
|
}
|
|
736
736
|
const parser = createXmlParser();
|
|
737
|
-
const doc = parser.parseFromString(
|
|
737
|
+
const doc = parser.parseFromString(_chunkZWPINXUXcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
738
738
|
if (!doc.documentElement) continue;
|
|
739
739
|
const domDoc = doc;
|
|
740
740
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -947,9 +947,9 @@ function detectHwpxHeadings(blocks, styleMap) {
|
|
|
947
947
|
let level = 0;
|
|
948
948
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _16 => _16.style, 'optionalAccess', _17 => _17.fontSize])) {
|
|
949
949
|
const ratio = block.style.fontSize / baseFontSize;
|
|
950
|
-
if (ratio >=
|
|
951
|
-
else if (ratio >=
|
|
952
|
-
else if (ratio >=
|
|
950
|
+
if (ratio >= _chunkHNPRQKLZcjs.HEADING_RATIO_H1) level = 1;
|
|
951
|
+
else if (ratio >= _chunkHNPRQKLZcjs.HEADING_RATIO_H2) level = 2;
|
|
952
|
+
else if (ratio >= _chunkHNPRQKLZcjs.HEADING_RATIO_H3) level = 3;
|
|
953
953
|
}
|
|
954
954
|
const compactText = text.replace(/\s+/g, "");
|
|
955
955
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1556,7 +1556,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1556
1556
|
|
|
1557
1557
|
// src/hwpx/table-build.ts
|
|
1558
1558
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1559
|
-
const table2 =
|
|
1559
|
+
const table2 = _chunkHNPRQKLZcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1560
1560
|
if (state.caption) table2.caption = state.caption;
|
|
1561
1561
|
if (state.sourceId) table2.sourceId = state.sourceId;
|
|
1562
1562
|
if (_optionalChain([state, 'access', _21 => _21.captionBlocks, 'optionalAccess', _22 => _22.length])) table2.captionBlocks = state.captionBlocks;
|
|
@@ -1585,7 +1585,7 @@ function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraph
|
|
|
1585
1585
|
for (const src of row) {
|
|
1586
1586
|
if (!src.edges || src.rowAddr === void 0 || src.colAddr === void 0) continue;
|
|
1587
1587
|
const cand = _optionalChain([table2, 'access', _26 => _26.cells, 'access', _27 => _27[src.rowAddr], 'optionalAccess', _28 => _28[src.colAddr]]);
|
|
1588
|
-
if (cand && anchors2.includes(cand))
|
|
1588
|
+
if (cand && anchors2.includes(cand)) _chunkHNPRQKLZcjs.CELL_EDGES.set(cand, src.edges);
|
|
1589
1589
|
}
|
|
1590
1590
|
}
|
|
1591
1591
|
const claimed = /* @__PURE__ */ new Set();
|
|
@@ -1635,7 +1635,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1635
1635
|
const cell2 = parentTable.cell;
|
|
1636
1636
|
(cell2.blocks ??= []).push(block);
|
|
1637
1637
|
cell2.hasStructure = true;
|
|
1638
|
-
let flat =
|
|
1638
|
+
let flat = _chunkHNPRQKLZcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1639
1639
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1640
1640
|
if (flat) {
|
|
1641
1641
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -1869,7 +1869,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
1869
1869
|
const tkids = rc.childNodes;
|
|
1870
1870
|
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _36 => _36.length]), () => ( 0))); k++) {
|
|
1871
1871
|
const tk = tkids[k];
|
|
1872
|
-
if (tk.nodeType === 3 || tk.nodeType === 4) text +=
|
|
1872
|
+
if (tk.nodeType === 3 || tk.nodeType === 4) text += _chunkHNPRQKLZcjs.escapeLiteralDollar.call(void 0, tk.textContent || "");
|
|
1873
1873
|
else if (tk.nodeType === 1) {
|
|
1874
1874
|
const ttag = (tk.tagName || tk.localName || "").replace(/^[^:]+:/, "");
|
|
1875
1875
|
if (ttag === "tab" || ttag === "fwSpace" || ttag === "hwSpace" || ttag === "nbSpace") text += " ";
|
|
@@ -1889,7 +1889,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
1889
1889
|
const span2 = { text };
|
|
1890
1890
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span2.code = true;
|
|
1891
1891
|
else {
|
|
1892
|
-
if (_optionalChain([cp, 'optionalAccess', _37 => _37.script])) span2.text =
|
|
1892
|
+
if (_optionalChain([cp, 'optionalAccess', _37 => _37.script])) span2.text = _chunkHNPRQKLZcjs.wrapScript.call(void 0, text, cp.script);
|
|
1893
1893
|
if (_optionalChain([cp, 'optionalAccess', _38 => _38.bold])) span2.bold = true;
|
|
1894
1894
|
if (_optionalChain([cp, 'optionalAccess', _39 => _39.italic])) span2.italic = true;
|
|
1895
1895
|
if (_optionalChain([cp, 'optionalAccess', _40 => _40.strike])) span2.strike = true;
|
|
@@ -1909,7 +1909,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
1909
1909
|
}
|
|
1910
1910
|
}
|
|
1911
1911
|
if (requireMixed && !merged.some((s) => s.strike || s.underline) && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
|
|
1912
|
-
for (const s of merged) s.text =
|
|
1912
|
+
for (const s of merged) s.text = _chunkHNPRQKLZcjs.tidyScriptTags.call(void 0, s.text);
|
|
1913
1913
|
return merged;
|
|
1914
1914
|
}
|
|
1915
1915
|
function gongmunDepthFromIndent(para2, left, ctx) {
|
|
@@ -1936,7 +1936,7 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
1936
1936
|
// src/hwpx/section-walker.ts
|
|
1937
1937
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
1938
1938
|
const parser = createXmlParser(warnings);
|
|
1939
|
-
const doc = parser.parseFromString(
|
|
1939
|
+
const doc = parser.parseFromString(_chunkZWPINXUXcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
1940
1940
|
if (!doc.documentElement) return [];
|
|
1941
1941
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
1942
1942
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -2053,8 +2053,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2053
2053
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
2054
2054
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
2055
2055
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
2056
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
2057
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
2056
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunkHNPRQKLZcjs.MAX_COLS);
|
|
2057
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkHNPRQKLZcjs.MAX_ROWS);
|
|
2058
2058
|
}
|
|
2059
2059
|
break;
|
|
2060
2060
|
case "p": {
|
|
@@ -2367,7 +2367,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
2367
2367
|
const sink = [];
|
|
2368
2368
|
const st = { rows: [], currentRow: [], cell: null, sourceId: _nullishCoalesce(el.getAttribute("id"), () => ( void 0)) };
|
|
2369
2369
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2370
|
-
let flat =
|
|
2370
|
+
let flat = _chunkHNPRQKLZcjs.convertTableToText.call(void 0, st.rows);
|
|
2371
2371
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2372
2372
|
const built = [];
|
|
2373
2373
|
completeTable(st, [], built, ctx);
|
|
@@ -2553,7 +2553,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2553
2553
|
let url = (ch.textContent || "").trim();
|
|
2554
2554
|
if (!url) continue;
|
|
2555
2555
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2556
|
-
const safe =
|
|
2556
|
+
const safe = _chunkZWPINXUXcjs.sanitizeHref.call(void 0, url);
|
|
2557
2557
|
if (safe) return safe;
|
|
2558
2558
|
}
|
|
2559
2559
|
return void 0;
|
|
@@ -2697,7 +2697,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2697
2697
|
_optionalChain([ctx, 'access', _99 => _99.warnings, 'optionalAccess', _100 => _100.push, 'call', _101 => _101({ page: ctx.page, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
|
|
2698
2698
|
}
|
|
2699
2699
|
} else {
|
|
2700
|
-
text +=
|
|
2700
|
+
text += _chunkHNPRQKLZcjs.escapeLiteralDollar.call(void 0, t.replace(/\x1E/g, ""));
|
|
2701
2701
|
}
|
|
2702
2702
|
continue;
|
|
2703
2703
|
}
|
|
@@ -2743,7 +2743,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2743
2743
|
case "hyperlink": {
|
|
2744
2744
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2745
2745
|
if (url) {
|
|
2746
|
-
const safe =
|
|
2746
|
+
const safe = _chunkZWPINXUXcjs.sanitizeHref.call(void 0, url);
|
|
2747
2747
|
if (safe) href = safe;
|
|
2748
2748
|
}
|
|
2749
2749
|
walk(child, depth + 1);
|
|
@@ -2836,7 +2836,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2836
2836
|
walk(child, depth + 1);
|
|
2837
2837
|
if (script && linkRanges.length === nLinks && openFields.length === nOpen && runHasOnlyText(child)) {
|
|
2838
2838
|
const added = text.slice(start);
|
|
2839
|
-
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) +
|
|
2839
|
+
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) + _chunkHNPRQKLZcjs.wrapScript.call(void 0, added, script);
|
|
2840
2840
|
}
|
|
2841
2841
|
break;
|
|
2842
2842
|
}
|
|
@@ -2859,7 +2859,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2859
2859
|
}
|
|
2860
2860
|
if (applied.length) href = void 0;
|
|
2861
2861
|
}
|
|
2862
|
-
text =
|
|
2862
|
+
text = _chunkHNPRQKLZcjs.tidyScriptTags.call(void 0, text);
|
|
2863
2863
|
const cleanParaText = (raw) => {
|
|
2864
2864
|
let t = raw.replace(/[ \t]+/g, " ").trim();
|
|
2865
2865
|
if (/^그림입니다\.?\s*원본\s*그림의\s*(이름|크기)/.test(t)) t = "";
|
|
@@ -2970,7 +2970,7 @@ function decompressStream(data) {
|
|
|
2970
2970
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
2971
2971
|
}
|
|
2972
2972
|
function parseFileHeader(data) {
|
|
2973
|
-
if (data.length < 40) throw new (0,
|
|
2973
|
+
if (data.length < 40) throw new (0, _chunkZWPINXUXcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
2974
2974
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
2975
2975
|
return {
|
|
2976
2976
|
signature: sig,
|
|
@@ -3472,13 +3472,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3472
3472
|
}
|
|
3473
3473
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3474
3474
|
for (const path of allCandidates) {
|
|
3475
|
-
if (
|
|
3475
|
+
if (_chunkZWPINXUXcjs.isPathTraversal.call(void 0, path)) continue;
|
|
3476
3476
|
const file = zip.file(path);
|
|
3477
3477
|
if (!file) continue;
|
|
3478
3478
|
try {
|
|
3479
3479
|
const data = await file.async("uint8array");
|
|
3480
3480
|
decompressed.total += data.length;
|
|
3481
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3481
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkZWPINXUXcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3482
3482
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3483
3483
|
const mimeType = imageExtToMime(ext);
|
|
3484
3484
|
imageIndex++;
|
|
@@ -3488,7 +3488,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3488
3488
|
usedPaths.add(path);
|
|
3489
3489
|
break;
|
|
3490
3490
|
} catch (err) {
|
|
3491
|
-
if (err instanceof
|
|
3491
|
+
if (err instanceof _chunkZWPINXUXcjs.KordocError) throw err;
|
|
3492
3492
|
}
|
|
3493
3493
|
}
|
|
3494
3494
|
if (!img) _optionalChain([warnings, 'optionalAccess', _115 => _115.push, 'call', _116 => _116({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
@@ -3508,11 +3508,11 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3508
3508
|
if (sweepUnreferenced) {
|
|
3509
3509
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3510
3510
|
for (const file of binEntries) {
|
|
3511
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3511
|
+
if (file.dir || usedPaths.has(file.name) || _chunkZWPINXUXcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3512
3512
|
try {
|
|
3513
3513
|
const data = await file.async("uint8array");
|
|
3514
3514
|
decompressed.total += data.length;
|
|
3515
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3515
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkZWPINXUXcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3516
3516
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3517
3517
|
let mimeType = imageExtToMime(ext);
|
|
3518
3518
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3526,7 +3526,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3526
3526
|
images.push(img);
|
|
3527
3527
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3528
3528
|
} catch (err) {
|
|
3529
|
-
if (err instanceof
|
|
3529
|
+
if (err instanceof _chunkZWPINXUXcjs.KordocError) throw err;
|
|
3530
3530
|
_optionalChain([warnings, 'optionalAccess', _117 => _117.push, 'call', _118 => _118({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3531
3531
|
}
|
|
3532
3532
|
}
|
|
@@ -3577,7 +3577,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3577
3577
|
}
|
|
3578
3578
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3579
3579
|
const name = new TextDecoder().decode(nameBytes);
|
|
3580
|
-
if (
|
|
3580
|
+
if (_chunkZWPINXUXcjs.isPathTraversal.call(void 0, name)) {
|
|
3581
3581
|
pos = fileStart + compSize;
|
|
3582
3582
|
continue;
|
|
3583
3583
|
}
|
|
@@ -3595,7 +3595,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3595
3595
|
continue;
|
|
3596
3596
|
}
|
|
3597
3597
|
totalDecompressed += content.length * 2;
|
|
3598
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3598
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkZWPINXUXcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3599
3599
|
sectionNum++;
|
|
3600
3600
|
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3601
3601
|
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
@@ -3604,9 +3604,9 @@ function extractFromBrokenZip(buffer) {
|
|
|
3604
3604
|
continue;
|
|
3605
3605
|
}
|
|
3606
3606
|
}
|
|
3607
|
-
if (blocks.length === 0) throw new (0,
|
|
3607
|
+
if (blocks.length === 0) throw new (0, _chunkZWPINXUXcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3608
3608
|
applyPageText(blocks, shared);
|
|
3609
|
-
const markdown =
|
|
3609
|
+
const markdown = _chunkHNPRQKLZcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3610
3610
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3611
3611
|
}
|
|
3612
3612
|
async function readKordocLayout(zip) {
|
|
@@ -3631,18 +3631,18 @@ async function resolveSectionPaths(zip) {
|
|
|
3631
3631
|
if (paths.length > 0) return paths;
|
|
3632
3632
|
}
|
|
3633
3633
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3634
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3634
|
+
return sectionFiles.map((f) => f.name).sort(_chunkZWPINXUXcjs.compareSectionPaths);
|
|
3635
3635
|
}
|
|
3636
3636
|
function parseSectionPathsFromManifest(xml) {
|
|
3637
3637
|
const parser = createXmlParser();
|
|
3638
|
-
const doc = parser.parseFromString(
|
|
3638
|
+
const doc = parser.parseFromString(_chunkZWPINXUXcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3639
3639
|
const items = doc.getElementsByTagName("opf:item");
|
|
3640
3640
|
const spine = doc.getElementsByTagName("opf:itemref");
|
|
3641
3641
|
const idToHref = /* @__PURE__ */ new Map();
|
|
3642
3642
|
for (let i = 0; i < items.length; i++) {
|
|
3643
3643
|
const item = items[i];
|
|
3644
3644
|
const id = item.getAttribute("id") || "";
|
|
3645
|
-
const href =
|
|
3645
|
+
const href = _chunkZWPINXUXcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3646
3646
|
if (id && href) idToHref.set(id, href);
|
|
3647
3647
|
}
|
|
3648
3648
|
if (spine.length > 0) {
|
|
@@ -3653,7 +3653,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3653
3653
|
}
|
|
3654
3654
|
if (ordered.length > 0) return ordered;
|
|
3655
3655
|
}
|
|
3656
|
-
return Array.from(idToHref.values()).sort(
|
|
3656
|
+
return Array.from(idToHref.values()).sort(_chunkZWPINXUXcjs.compareSectionPaths);
|
|
3657
3657
|
}
|
|
3658
3658
|
|
|
3659
3659
|
// src/hwpx/metadata.ts
|
|
@@ -3665,7 +3665,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3665
3665
|
const xml = await file.async("text");
|
|
3666
3666
|
if (decompressed) {
|
|
3667
3667
|
decompressed.total += xml.length * 2;
|
|
3668
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3668
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkZWPINXUXcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3669
3669
|
}
|
|
3670
3670
|
return xml;
|
|
3671
3671
|
};
|
|
@@ -3687,7 +3687,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3687
3687
|
}
|
|
3688
3688
|
}
|
|
3689
3689
|
function parseOpfMetadata(xml, metadata) {
|
|
3690
|
-
const root = createXmlParser().parseFromString(
|
|
3690
|
+
const root = createXmlParser().parseFromString(_chunkZWPINXUXcjs.stripDtd.call(void 0, xml), "text/xml").documentElement;
|
|
3691
3691
|
const md2 = root ? findChildByLocalName(root, "metadata") : null;
|
|
3692
3692
|
if (!md2) return;
|
|
3693
3693
|
let title;
|
|
@@ -3720,7 +3720,7 @@ function isoDate(s) {
|
|
|
3720
3720
|
}
|
|
3721
3721
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3722
3722
|
const parser = createXmlParser();
|
|
3723
|
-
const doc = parser.parseFromString(
|
|
3723
|
+
const doc = parser.parseFromString(_chunkZWPINXUXcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3724
3724
|
if (!doc.documentElement) return;
|
|
3725
3725
|
const getText = (tagNames) => {
|
|
3726
3726
|
for (const tag of tagNames) {
|
|
@@ -3759,7 +3759,7 @@ function assignSectionPage(block, sectionNum) {
|
|
|
3759
3759
|
}
|
|
3760
3760
|
}
|
|
3761
3761
|
async function parseHwpxDocument(buffer, options) {
|
|
3762
|
-
|
|
3762
|
+
_chunkZWPINXUXcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3763
3763
|
let zip;
|
|
3764
3764
|
try {
|
|
3765
3765
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3768,7 +3768,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3768
3768
|
}
|
|
3769
3769
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3770
3770
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3771
|
-
throw new (0,
|
|
3771
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3772
3772
|
}
|
|
3773
3773
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3774
3774
|
if (manifestFile) {
|
|
@@ -3787,7 +3787,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3787
3787
|
}
|
|
3788
3788
|
}
|
|
3789
3789
|
const hpf = await _optionalChain([zip, 'access', _144 => _144.file, 'call', _145 => _145("Contents/content.hpf"), 'optionalAccess', _146 => _146.async, 'call', _147 => _147("text"), 'access', _148 => _148.catch, 'call', _149 => _149(() => "")]);
|
|
3790
|
-
throw new (0,
|
|
3790
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(
|
|
3791
3791
|
/\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."
|
|
3792
3792
|
);
|
|
3793
3793
|
}
|
|
@@ -3799,7 +3799,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3799
3799
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3800
3800
|
const warnings = [];
|
|
3801
3801
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3802
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3802
|
+
if (sectionPaths.length === 0) throw new (0, _chunkZWPINXUXcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3803
3803
|
let allBlocks = [];
|
|
3804
3804
|
const shared = createSectionShared();
|
|
3805
3805
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
@@ -3843,10 +3843,10 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3843
3843
|
const blocks = allBlocks;
|
|
3844
3844
|
applyPageText(blocks, shared);
|
|
3845
3845
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _156 => _156.pages]));
|
|
3846
|
-
const shown = _optionalChain([options, 'optionalAccess', _157 => _157.layoutTables]) === "keep" ? blocks :
|
|
3846
|
+
const shown = _optionalChain([options, 'optionalAccess', _157 => _157.layoutTables]) === "keep" ? blocks : _chunkHNPRQKLZcjs.unframeLayoutTables.call(void 0, blocks, !!_optionalChain([options, 'optionalAccess', _158 => _158.keepTrailingEmptyCols]));
|
|
3847
3847
|
detectHwpxHeadings(shown, styleMap);
|
|
3848
3848
|
const outline = shown.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3849
|
-
const markdown =
|
|
3849
|
+
const markdown = _chunkHNPRQKLZcjs.blocksToMarkdown.call(void 0, shown);
|
|
3850
3850
|
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 };
|
|
3851
3851
|
}
|
|
3852
3852
|
|
|
@@ -4613,7 +4613,7 @@ function decryptPasswordStream(raw, password) {
|
|
|
4613
4613
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4614
4614
|
var TAG_ID_MAPPINGS2 = 17;
|
|
4615
4615
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4616
|
-
const wrong = () => new (0,
|
|
4616
|
+
const wrong = () => new (0, _chunkZWPINXUXcjs.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.");
|
|
4617
4617
|
let records;
|
|
4618
4618
|
try {
|
|
4619
4619
|
records = readRecords3(data);
|
|
@@ -4625,7 +4625,7 @@ function assertDecryptedDocInfo(data, readRecords3) {
|
|
|
4625
4625
|
}
|
|
4626
4626
|
function assertSupportedEncryptVersion(version) {
|
|
4627
4627
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4628
|
-
throw new (0,
|
|
4628
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(
|
|
4629
4629
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4630
4630
|
);
|
|
4631
4631
|
}
|
|
@@ -5065,7 +5065,7 @@ function emitParagraphBlocks(p) {
|
|
|
5065
5065
|
return blocks;
|
|
5066
5066
|
}
|
|
5067
5067
|
function tableFlatText(table2) {
|
|
5068
|
-
const flat =
|
|
5068
|
+
const flat = _chunkHNPRQKLZcjs.convertTableToText.call(void 0, table2.cells);
|
|
5069
5069
|
return table2.caption ? table2.caption + (flat ? "\n" + flat : "") : flat;
|
|
5070
5070
|
}
|
|
5071
5071
|
function blocksPlainText(blocks, sep) {
|
|
@@ -5145,8 +5145,8 @@ ${cell2.text}` : cell2.text;
|
|
|
5145
5145
|
}
|
|
5146
5146
|
function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
5147
5147
|
for (const c of cells) {
|
|
5148
|
-
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1,
|
|
5149
|
-
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1,
|
|
5148
|
+
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1, _chunkHNPRQKLZcjs.MAX_ROWS));
|
|
5149
|
+
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1, _chunkHNPRQKLZcjs.MAX_COLS));
|
|
5150
5150
|
}
|
|
5151
5151
|
const placed = resolveCellOverlaps(cells, rows, cols);
|
|
5152
5152
|
const byRow = Array.from({ length: rows }, () => []);
|
|
@@ -5154,12 +5154,12 @@ function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
|
5154
5154
|
const r = _nullishCoalesce(c.rowAddr, () => ( 0));
|
|
5155
5155
|
if (r < rows && (_nullishCoalesce(c.colAddr, () => ( 0))) < cols) byRow[r].push(c);
|
|
5156
5156
|
}
|
|
5157
|
-
const table2 =
|
|
5157
|
+
const table2 = _chunkHNPRQKLZcjs.buildTable.call(void 0, byRow, { keepAnchoredEmptyCols });
|
|
5158
5158
|
if (table2.rows === 0) return null;
|
|
5159
5159
|
for (const c of placed) {
|
|
5160
5160
|
if (c.edges) {
|
|
5161
5161
|
const at = _optionalChain([table2, 'access', _165 => _165.cells, 'access', _166 => _166[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _167 => _167[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
5162
|
-
if (at)
|
|
5162
|
+
if (at) _chunkHNPRQKLZcjs.CELL_EDGES.set(at, c.edges);
|
|
5163
5163
|
}
|
|
5164
5164
|
if (!_optionalChain([c, 'access', _168 => _168.blocks, 'optionalAccess', _169 => _169.length]) && !c.isHeader) continue;
|
|
5165
5165
|
const target = _optionalChain([table2, 'access', _170 => _170.cells, 'access', _171 => _171[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _172 => _172[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
@@ -5359,7 +5359,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5359
5359
|
continue;
|
|
5360
5360
|
}
|
|
5361
5361
|
if (!ctrl.href) continue;
|
|
5362
|
-
const href =
|
|
5362
|
+
const href = _chunkZWPINXUXcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5363
5363
|
if (!href) continue;
|
|
5364
5364
|
if (!anchor.trim() || anchor.includes(INLINE_TABLE_MARK)) continue;
|
|
5365
5365
|
text = text.slice(0, r.start) + `[${anchor}](${href})` + text.slice(r.end);
|
|
@@ -5367,7 +5367,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5367
5367
|
}
|
|
5368
5368
|
}
|
|
5369
5369
|
if (text.includes(LITERAL_DOLLAR_MARK)) text = text.replaceAll(LITERAL_DOLLAR_MARK, "\\$");
|
|
5370
|
-
text =
|
|
5370
|
+
text = _chunkHNPRQKLZcjs.tidyScriptTags.call(void 0, text);
|
|
5371
5371
|
let headingLevel = 0;
|
|
5372
5372
|
let headMarker = null;
|
|
5373
5373
|
const ps = ctx.docInfo && paraShapeId >= 0 && paraShapeId < ctx.docInfo.paraShapes.length ? ctx.docInfo.paraShapes[paraShapeId] : null;
|
|
@@ -5571,7 +5571,7 @@ function hyperlinkUrlFromCommand(command) {
|
|
|
5571
5571
|
}
|
|
5572
5572
|
var A4_HEIGHT = 84188;
|
|
5573
5573
|
function keepUnlessPageSpanning(table2, cells) {
|
|
5574
|
-
if (!cells.some((c) => c.pageSpanning))
|
|
5574
|
+
if (!cells.some((c) => c.pageSpanning)) _chunkHNPRQKLZcjs.markNonLayoutTable.call(void 0, table2);
|
|
5575
5575
|
}
|
|
5576
5576
|
function parseTableControl(ctrl, records, ctx) {
|
|
5577
5577
|
if (ctx.depth >= MAX_NEST_DEPTH) return null;
|
|
@@ -5583,8 +5583,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5583
5583
|
let tableIdx = -1;
|
|
5584
5584
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5585
5585
|
if (records[i2].tagId === TAG_TABLE && records[i2].level === directLevel && records[i2].data.length >= 8) {
|
|
5586
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5587
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5586
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkHNPRQKLZcjs.MAX_ROWS);
|
|
5587
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkHNPRQKLZcjs.MAX_COLS);
|
|
5588
5588
|
tableIdx = i2;
|
|
5589
5589
|
break;
|
|
5590
5590
|
}
|
|
@@ -5628,11 +5628,11 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5628
5628
|
return table3;
|
|
5629
5629
|
}
|
|
5630
5630
|
if (rows === 0 || cols === 0) {
|
|
5631
|
-
rows = Math.min(cells.length,
|
|
5631
|
+
rows = Math.min(cells.length, _chunkHNPRQKLZcjs.MAX_ROWS);
|
|
5632
5632
|
cols = 1;
|
|
5633
5633
|
}
|
|
5634
5634
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5635
|
-
const table2 =
|
|
5635
|
+
const table2 = _chunkHNPRQKLZcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5636
5636
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5637
5637
|
if (sourceId && table2.rows > 0) table2.sourceId = sourceId;
|
|
5638
5638
|
keepUnlessPageSpanning(table2, cells);
|
|
@@ -5651,8 +5651,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5651
5651
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5652
5652
|
const cs = rec.data.readUInt16LE(12);
|
|
5653
5653
|
const rs = rec.data.readUInt16LE(14);
|
|
5654
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5655
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5654
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkHNPRQKLZcjs.MAX_COLS);
|
|
5655
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkHNPRQKLZcjs.MAX_ROWS);
|
|
5656
5656
|
}
|
|
5657
5657
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5658
5658
|
const { text, hasStructure } = cellTextFromBlocks(blocks);
|
|
@@ -5801,7 +5801,7 @@ function openHwp5Container(buffer, options) {
|
|
|
5801
5801
|
lenientCfb = parseLenientCfb(buffer);
|
|
5802
5802
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
5803
5803
|
} catch (e24) {
|
|
5804
|
-
throw new (0,
|
|
5804
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
5805
5805
|
}
|
|
5806
5806
|
}
|
|
5807
5807
|
const readRawStream = (path) => {
|
|
@@ -5812,14 +5812,14 @@ function openHwp5Container(buffer, options) {
|
|
|
5812
5812
|
return lenientCfb.findStream(path);
|
|
5813
5813
|
};
|
|
5814
5814
|
const headerData = readRawStream("/FileHeader");
|
|
5815
|
-
if (!headerData) throw new (0,
|
|
5815
|
+
if (!headerData) throw new (0, _chunkZWPINXUXcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
5816
5816
|
const header = parseFileHeader(headerData);
|
|
5817
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
5818
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
5817
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkZWPINXUXcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
5818
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkZWPINXUXcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
5819
5819
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
5820
5820
|
if (encrypted) {
|
|
5821
5821
|
if (!_optionalChain([options, 'optionalAccess', _196 => _196.password])) {
|
|
5822
|
-
throw new (0,
|
|
5822
|
+
throw new (0, _chunkZWPINXUXcjs.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.");
|
|
5823
5823
|
}
|
|
5824
5824
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
5825
5825
|
}
|
|
@@ -5833,12 +5833,12 @@ function openHwp5Container(buffer, options) {
|
|
|
5833
5833
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
5834
5834
|
if (encrypted) {
|
|
5835
5835
|
const rawDocInfo = findStream("/DocInfo");
|
|
5836
|
-
if (!rawDocInfo) throw new (0,
|
|
5836
|
+
if (!rawDocInfo) throw new (0, _chunkZWPINXUXcjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
5837
5837
|
let docInfoData;
|
|
5838
5838
|
try {
|
|
5839
5839
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
5840
5840
|
} catch (e25) {
|
|
5841
|
-
throw new (0,
|
|
5841
|
+
throw new (0, _chunkZWPINXUXcjs.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.");
|
|
5842
5842
|
}
|
|
5843
5843
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
5844
5844
|
}
|
|
@@ -5863,10 +5863,10 @@ function readHwp5SectionRecords(c, sections, warnings) {
|
|
|
5863
5863
|
try {
|
|
5864
5864
|
const data = !c.distribution && c.compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
5865
5865
|
totalDecompressed += data.length;
|
|
5866
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
5866
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkZWPINXUXcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
5867
5867
|
out.push(readRecords(data));
|
|
5868
5868
|
} catch (secErr) {
|
|
5869
|
-
if (secErr instanceof
|
|
5869
|
+
if (secErr instanceof _chunkZWPINXUXcjs.KordocError) throw secErr;
|
|
5870
5870
|
out.push(null);
|
|
5871
5871
|
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" });
|
|
5872
5872
|
}
|
|
@@ -5885,7 +5885,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
5885
5885
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
5886
5886
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
5887
5887
|
const sections = readHwp5SectionStreams(c);
|
|
5888
|
-
if (sections.length === 0) throw new (0,
|
|
5888
|
+
if (sections.length === 0) throw new (0, _chunkZWPINXUXcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
5889
5889
|
const sectionRecords = readHwp5SectionRecords(c, sections, warnings);
|
|
5890
5890
|
const sectionDetects = sectionRecords.map((r) => r ? detectHwp5SectionPages(r) : null);
|
|
5891
5891
|
const sectionTableIds = [];
|
|
@@ -5929,7 +5929,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
5929
5929
|
parsedSections++;
|
|
5930
5930
|
_optionalChain([options, 'optionalAccess', _201 => _201.onProgress, 'optionalCall', _202 => _202(parsedSections, sections.length)]);
|
|
5931
5931
|
} catch (secErr) {
|
|
5932
|
-
if (secErr instanceof
|
|
5932
|
+
if (secErr instanceof _chunkZWPINXUXcjs.KordocError) throw secErr;
|
|
5933
5933
|
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" });
|
|
5934
5934
|
} finally {
|
|
5935
5935
|
pageBase += detect2.pages;
|
|
@@ -5940,10 +5940,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
5940
5940
|
}
|
|
5941
5941
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
5942
5942
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter);
|
|
5943
|
-
let flatBlocks =
|
|
5944
|
-
if (_optionalChain([options, 'optionalAccess', _203 => _203.layoutTables]) !== "keep") flatBlocks =
|
|
5943
|
+
let flatBlocks = _chunkHNPRQKLZcjs.flattenLayoutTables.call(void 0, blocks);
|
|
5944
|
+
if (_optionalChain([options, 'optionalAccess', _203 => _203.layoutTables]) !== "keep") flatBlocks = _chunkHNPRQKLZcjs.unframeLayoutTables.call(void 0, flatBlocks, !!_optionalChain([options, 'optionalAccess', _204 => _204.keepTrailingEmptyCols]));
|
|
5945
5945
|
if (_optionalChain([options, 'optionalAccess', _205 => _205.dedupeRunningHeaders])) {
|
|
5946
|
-
const deduped =
|
|
5946
|
+
const deduped = _chunkHNPRQKLZcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
5947
5947
|
const removed = flatBlocks.length - deduped.length;
|
|
5948
5948
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
5949
5949
|
flatBlocks = deduped;
|
|
@@ -5952,10 +5952,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
5952
5952
|
detectHwp5Headings(flatBlocks, docInfo);
|
|
5953
5953
|
}
|
|
5954
5954
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
5955
|
-
let markdown =
|
|
5955
|
+
let markdown = _chunkHNPRQKLZcjs.blocksToMarkdown.call(void 0, flatBlocks);
|
|
5956
5956
|
if (_optionalChain([options, 'optionalAccess', _206 => _206.inlineImages]) && options.images !== false && images.length > 0) {
|
|
5957
5957
|
try {
|
|
5958
|
-
markdown =
|
|
5958
|
+
markdown = _chunkDUHHMIPScjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
5959
5959
|
} catch (inlineErr) {
|
|
5960
5960
|
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" });
|
|
5961
5961
|
}
|
|
@@ -6019,9 +6019,9 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
6019
6019
|
let level = 0;
|
|
6020
6020
|
if (_optionalChain([block, 'access', _211 => _211.style, 'optionalAccess', _212 => _212.fontSize]) && baseFontSize > 0) {
|
|
6021
6021
|
const ratio = block.style.fontSize / baseFontSize;
|
|
6022
|
-
if (ratio >=
|
|
6023
|
-
else if (ratio >=
|
|
6024
|
-
else if (ratio >=
|
|
6022
|
+
if (ratio >= _chunkHNPRQKLZcjs.HEADING_RATIO_H1) level = 1;
|
|
6023
|
+
else if (ratio >= _chunkHNPRQKLZcjs.HEADING_RATIO_H2) level = 2;
|
|
6024
|
+
else if (ratio >= _chunkHNPRQKLZcjs.HEADING_RATIO_H3) level = 3;
|
|
6025
6025
|
}
|
|
6026
6026
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
6027
6027
|
if (level === 0) level = 2;
|
|
@@ -6154,7 +6154,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
6154
6154
|
if (!raw) break;
|
|
6155
6155
|
const content = compressed ? decompressStream(raw) : raw;
|
|
6156
6156
|
totalDecompressed += content.length;
|
|
6157
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6157
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkZWPINXUXcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6158
6158
|
sections.push({ idx: i, content });
|
|
6159
6159
|
}
|
|
6160
6160
|
if (sections.length === 0) {
|
|
@@ -6166,7 +6166,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
6166
6166
|
if (raw) {
|
|
6167
6167
|
const content = compressed ? decompressStream(raw) : raw;
|
|
6168
6168
|
totalDecompressed += content.length;
|
|
6169
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6169
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkZWPINXUXcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6170
6170
|
sections.push({ idx, content });
|
|
6171
6171
|
}
|
|
6172
6172
|
}
|
|
@@ -6183,7 +6183,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
6183
6183
|
try {
|
|
6184
6184
|
const content = decryptViewText(raw, compressed);
|
|
6185
6185
|
totalDecompressed += content.length;
|
|
6186
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6186
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkZWPINXUXcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6187
6187
|
sections.push({ idx: i, content });
|
|
6188
6188
|
} catch (e32) {
|
|
6189
6189
|
break;
|
|
@@ -18661,25 +18661,25 @@ function desEcbDecrypt(data, key) {
|
|
|
18661
18661
|
}
|
|
18662
18662
|
function readLayout(data) {
|
|
18663
18663
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
18664
|
-
throw new (0,
|
|
18664
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
18665
18665
|
}
|
|
18666
18666
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
18667
18667
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
18668
18668
|
if (payloadOffset >= data.length) {
|
|
18669
|
-
throw new (0,
|
|
18669
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18670
18670
|
}
|
|
18671
18671
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
18672
18672
|
}
|
|
18673
18673
|
function decryptHwp3Document(input, password) {
|
|
18674
18674
|
const { payloadOffset, compressed } = readLayout(input);
|
|
18675
18675
|
if (!compressed) {
|
|
18676
|
-
throw new (0,
|
|
18676
|
+
throw new (0, _chunkZWPINXUXcjs.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)");
|
|
18677
18677
|
}
|
|
18678
18678
|
const source = Buffer.from(input);
|
|
18679
18679
|
const payload = source.subarray(payloadOffset);
|
|
18680
18680
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
18681
18681
|
if (aligned.length === 0) {
|
|
18682
|
-
throw new (0,
|
|
18682
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
18683
18683
|
}
|
|
18684
18684
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
18685
18685
|
let inflated;
|
|
@@ -18687,14 +18687,14 @@ function decryptHwp3Document(input, password) {
|
|
|
18687
18687
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
18688
18688
|
} catch (err) {
|
|
18689
18689
|
if (_optionalChain([err, 'optionalAccess', _227 => _227.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18690
|
-
throw new (0,
|
|
18690
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(
|
|
18691
18691
|
`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`
|
|
18692
18692
|
);
|
|
18693
18693
|
}
|
|
18694
|
-
throw new (0,
|
|
18694
|
+
throw new (0, _chunkZWPINXUXcjs.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.");
|
|
18695
18695
|
}
|
|
18696
18696
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
18697
|
-
throw new (0,
|
|
18697
|
+
throw new (0, _chunkZWPINXUXcjs.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.");
|
|
18698
18698
|
}
|
|
18699
18699
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
18700
18700
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -18751,9 +18751,9 @@ function hwp3CellGrid(info, count) {
|
|
|
18751
18751
|
const col = edgeAt(xs, g3.x), row = edgeAt(ys, g3.y);
|
|
18752
18752
|
const c2 = nextX[k] !== void 0 ? edgeAt(xs, nextX[k]) : xs.length - 1;
|
|
18753
18753
|
const r2 = nextY[k] !== void 0 ? edgeAt(ys, nextY[k]) : ys.length - 1;
|
|
18754
|
-
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row),
|
|
18754
|
+
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row), _chunkHNPRQKLZcjs.MAX_ROWS), colSpan: Math.min(Math.max(1, c2 - col), _chunkHNPRQKLZcjs.MAX_COLS) };
|
|
18755
18755
|
});
|
|
18756
|
-
return { rows: Math.min(Math.max(1, ys.length - 1),
|
|
18756
|
+
return { rows: Math.min(Math.max(1, ys.length - 1), _chunkHNPRQKLZcjs.MAX_ROWS), cols: Math.min(Math.max(1, xs.length - 1), _chunkHNPRQKLZcjs.MAX_COLS), cells };
|
|
18757
18757
|
}
|
|
18758
18758
|
|
|
18759
18759
|
// src/hwp3/parser.ts
|
|
@@ -18793,7 +18793,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
18793
18793
|
let source = Buffer.from(buffer);
|
|
18794
18794
|
if (isEncryptedHwp3(source)) {
|
|
18795
18795
|
if (!_optionalChain([options, 'optionalAccess', _228 => _228.password])) {
|
|
18796
|
-
throw new (0,
|
|
18796
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(
|
|
18797
18797
|
"\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."
|
|
18798
18798
|
);
|
|
18799
18799
|
}
|
|
@@ -18810,10 +18810,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
18810
18810
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
18811
18811
|
} catch (err) {
|
|
18812
18812
|
if (_optionalChain([err, 'optionalAccess', _229 => _229.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18813
|
-
throw new (0,
|
|
18813
|
+
throw new (0, _chunkZWPINXUXcjs.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`);
|
|
18814
18814
|
}
|
|
18815
18815
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
18816
|
-
throw new (0,
|
|
18816
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
18817
18817
|
}
|
|
18818
18818
|
} else {
|
|
18819
18819
|
body = tail;
|
|
@@ -18830,7 +18830,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
18830
18830
|
message: `HWP3 paragraph stream \uB3C4\uC911 \uD30C\uC2F1 \uC911\uB2E8: ${err instanceof Error ? err.message : String(err)}`
|
|
18831
18831
|
});
|
|
18832
18832
|
}
|
|
18833
|
-
const blocks =
|
|
18833
|
+
const blocks = _chunkHNPRQKLZcjs.flattenLayoutTables.call(void 0, [...ctx.headerBlocks, ...bodyBlocks, ...ctx.footerBlocks]);
|
|
18834
18834
|
const metadata = {
|
|
18835
18835
|
title: header.title || void 0,
|
|
18836
18836
|
author: header.author || void 0,
|
|
@@ -18839,7 +18839,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
18839
18839
|
version: "3.0"
|
|
18840
18840
|
};
|
|
18841
18841
|
return {
|
|
18842
|
-
markdown:
|
|
18842
|
+
markdown: _chunkHNPRQKLZcjs.blocksToMarkdown.call(void 0, blocks),
|
|
18843
18843
|
blocks,
|
|
18844
18844
|
metadata,
|
|
18845
18845
|
warnings: warnings.length ? warnings : void 0
|
|
@@ -18923,7 +18923,7 @@ function parseCharStream(reader, charCount, ctx, para2) {
|
|
|
18923
18923
|
continue;
|
|
18924
18924
|
}
|
|
18925
18925
|
if (ch >= 32) {
|
|
18926
|
-
para2.text +=
|
|
18926
|
+
para2.text += _chunkHNPRQKLZcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(decodeJohabText(ch), () => ( "")));
|
|
18927
18927
|
continue;
|
|
18928
18928
|
}
|
|
18929
18929
|
if (ch === 9) {
|
|
@@ -19151,7 +19151,7 @@ function isDistributionSentinel(markdown) {
|
|
|
19151
19151
|
|
|
19152
19152
|
// src/xlsx/sheet-blocks.ts
|
|
19153
19153
|
function sheetRowCap(cols) {
|
|
19154
|
-
return Math.max(
|
|
19154
|
+
return Math.max(_chunkHNPRQKLZcjs.MAX_ROWS, Math.floor(_chunkHNPRQKLZcjs.MAX_TABLE_CELLS / Math.max(1, cols)));
|
|
19155
19155
|
}
|
|
19156
19156
|
function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols) {
|
|
19157
19157
|
const blocks = [];
|
|
@@ -19182,7 +19182,7 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19182
19182
|
if (keepRows.length > rowCap) {
|
|
19183
19183
|
warnings.push({
|
|
19184
19184
|
page: sheetIndex + 1,
|
|
19185
|
-
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 ${
|
|
19185
|
+
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 ${_chunkHNPRQKLZcjs.MAX_TABLE_CELLS})`,
|
|
19186
19186
|
code: "TRUNCATED_TABLE"
|
|
19187
19187
|
});
|
|
19188
19188
|
keepRows.length = rowCap;
|
|
@@ -19216,14 +19216,14 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19216
19216
|
}
|
|
19217
19217
|
cellRows.push(row);
|
|
19218
19218
|
}
|
|
19219
|
-
const table2 =
|
|
19219
|
+
const table2 = _chunkHNPRQKLZcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols, maxRows: rowCap });
|
|
19220
19220
|
if (table2.rows > 0) blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
19221
19221
|
return blocks;
|
|
19222
19222
|
}
|
|
19223
19223
|
|
|
19224
19224
|
// src/xlsx/parser.ts
|
|
19225
19225
|
var MAX_SHEETS = 100;
|
|
19226
|
-
var MAX_DECOMPRESS_SIZE4 =
|
|
19226
|
+
var MAX_DECOMPRESS_SIZE4 = _chunkZWPINXUXcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
19227
19227
|
var MAX_SHEET_ROWS = 1048576;
|
|
19228
19228
|
function cleanNumericValue(raw) {
|
|
19229
19229
|
if (!/^-?\d+\.\d+$/.test(raw)) return raw;
|
|
@@ -19260,7 +19260,7 @@ function getTextContent(el) {
|
|
|
19260
19260
|
return _nullishCoalesce(_optionalChain([el, 'access', _245 => _245.textContent, 'optionalAccess', _246 => _246.trim, 'call', _247 => _247()]), () => ( ""));
|
|
19261
19261
|
}
|
|
19262
19262
|
function parseXml(text) {
|
|
19263
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19263
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkZWPINXUXcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19264
19264
|
}
|
|
19265
19265
|
function collectRichText(root) {
|
|
19266
19266
|
let out = "";
|
|
@@ -19424,7 +19424,7 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19424
19424
|
for (const cellEl of cells) {
|
|
19425
19425
|
const ref = cellEl.getAttribute("r");
|
|
19426
19426
|
const pos = ref !== null ? parseCellRef(ref) : { col: prevCol + 1, row: rowNum };
|
|
19427
|
-
if (!pos || !Number.isFinite(pos.row) || pos.row < 0 || pos.row >= MAX_SHEET_ROWS || pos.col >=
|
|
19427
|
+
if (!pos || !Number.isFinite(pos.row) || pos.row < 0 || pos.row >= MAX_SHEET_ROWS || pos.col >= _chunkHNPRQKLZcjs.MAX_COLS) continue;
|
|
19428
19428
|
prevCol = pos.col;
|
|
19429
19429
|
const type = cellEl.getAttribute("t");
|
|
19430
19430
|
const vElements = getElements(cellEl, "v");
|
|
@@ -19474,21 +19474,21 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19474
19474
|
if (m) {
|
|
19475
19475
|
merges.push({
|
|
19476
19476
|
r1: Math.min(m.startRow, MAX_SHEET_ROWS - 1),
|
|
19477
|
-
c1: Math.min(m.startCol,
|
|
19477
|
+
c1: Math.min(m.startCol, _chunkHNPRQKLZcjs.MAX_COLS - 1),
|
|
19478
19478
|
r2: Math.min(m.endRow, MAX_SHEET_ROWS - 1),
|
|
19479
|
-
c2: Math.min(m.endCol,
|
|
19479
|
+
c2: Math.min(m.endCol, _chunkHNPRQKLZcjs.MAX_COLS - 1)
|
|
19480
19480
|
});
|
|
19481
19481
|
}
|
|
19482
19482
|
}
|
|
19483
19483
|
return { rows, merges, maxCol };
|
|
19484
19484
|
}
|
|
19485
19485
|
async function parseXlsxDocument(buffer, options) {
|
|
19486
|
-
|
|
19486
|
+
_chunkZWPINXUXcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
19487
19487
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19488
19488
|
const warnings = [];
|
|
19489
19489
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
19490
19490
|
if (!workbookFile) {
|
|
19491
|
-
throw new (0,
|
|
19491
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19492
19492
|
}
|
|
19493
19493
|
let sharedStrings = [];
|
|
19494
19494
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -19497,7 +19497,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19497
19497
|
}
|
|
19498
19498
|
const { sheets, date1904 } = parseWorkbook(await workbookFile.async("text"));
|
|
19499
19499
|
if (sheets.length === 0) {
|
|
19500
|
-
throw new (0,
|
|
19500
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19501
19501
|
}
|
|
19502
19502
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
19503
19503
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -19581,7 +19581,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19581
19581
|
} catch (e35) {
|
|
19582
19582
|
}
|
|
19583
19583
|
}
|
|
19584
|
-
const markdown =
|
|
19584
|
+
const markdown = _chunkHNPRQKLZcjs.blocksToMarkdown.call(void 0, blocks);
|
|
19585
19585
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
19586
19586
|
}
|
|
19587
19587
|
|
|
@@ -20030,11 +20030,11 @@ function processGlobals(records) {
|
|
|
20030
20030
|
const xfFmtIds = [];
|
|
20031
20031
|
const firstBof = records[0];
|
|
20032
20032
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
20033
|
-
throw new (0,
|
|
20033
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
20034
20034
|
}
|
|
20035
20035
|
const bof = decodeBof(firstBof.data);
|
|
20036
20036
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
20037
|
-
throw new (0,
|
|
20037
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
20038
20038
|
}
|
|
20039
20039
|
let i = 1;
|
|
20040
20040
|
while (i < records.length) {
|
|
@@ -20100,14 +20100,14 @@ function rawSheetToBlocks(sheetName, sheet, sheetIndex, warnings, keepAnchoredEm
|
|
|
20100
20100
|
const rows = /* @__PURE__ */ new Map();
|
|
20101
20101
|
let maxCol = -1;
|
|
20102
20102
|
for (const c of sheet.cells) {
|
|
20103
|
-
if (c.col >=
|
|
20103
|
+
if (c.col >= _chunkHNPRQKLZcjs.MAX_COLS) continue;
|
|
20104
20104
|
let row = rows.get(c.row);
|
|
20105
20105
|
if (!row) rows.set(c.row, row = []);
|
|
20106
20106
|
while (row.length <= c.col) row.push("");
|
|
20107
20107
|
row[c.col] = cellValueToText(c.value);
|
|
20108
20108
|
if (c.col > maxCol) maxCol = c.col;
|
|
20109
20109
|
}
|
|
20110
|
-
const merges = sheet.merges.filter((m) => m.c1 <
|
|
20110
|
+
const merges = sheet.merges.filter((m) => m.c1 < _chunkHNPRQKLZcjs.MAX_COLS).map((m) => ({ r1: m.r1, c1: m.c1, r2: m.r2, c2: Math.min(m.c2, _chunkHNPRQKLZcjs.MAX_COLS - 1) }));
|
|
20111
20111
|
for (const m of merges) if (m.c2 > maxCol) maxCol = m.c2;
|
|
20112
20112
|
return sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols);
|
|
20113
20113
|
}
|
|
@@ -20117,28 +20117,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20117
20117
|
try {
|
|
20118
20118
|
cfb = parseLenientCfb(buf);
|
|
20119
20119
|
} catch (e) {
|
|
20120
|
-
throw new (0,
|
|
20120
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(
|
|
20121
20121
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
20122
20122
|
);
|
|
20123
20123
|
}
|
|
20124
20124
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
20125
20125
|
if (!wb) {
|
|
20126
|
-
throw new (0,
|
|
20126
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
20127
20127
|
}
|
|
20128
20128
|
const records = readRecords2(wb);
|
|
20129
20129
|
if (records.length === 0) {
|
|
20130
|
-
throw new (0,
|
|
20130
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
20131
20131
|
}
|
|
20132
20132
|
const firstBof = decodeBof(records[0].data);
|
|
20133
20133
|
if (firstBof && firstBof.vers !== 1536) {
|
|
20134
|
-
throw new (0,
|
|
20134
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(
|
|
20135
20135
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
20136
20136
|
);
|
|
20137
20137
|
}
|
|
20138
20138
|
const globals = processGlobals(records);
|
|
20139
20139
|
const warnings = [];
|
|
20140
20140
|
if (globals.encrypted) {
|
|
20141
|
-
throw new (0,
|
|
20141
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20142
20142
|
}
|
|
20143
20143
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
20144
20144
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -20189,7 +20189,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20189
20189
|
pageCount: totalSheets
|
|
20190
20190
|
};
|
|
20191
20191
|
return {
|
|
20192
|
-
markdown:
|
|
20192
|
+
markdown: _chunkHNPRQKLZcjs.blocksToMarkdown.call(void 0, allBlocks),
|
|
20193
20193
|
blocks: allBlocks,
|
|
20194
20194
|
metadata,
|
|
20195
20195
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -20628,7 +20628,7 @@ function isDisplayMath(el) {
|
|
|
20628
20628
|
}
|
|
20629
20629
|
|
|
20630
20630
|
// src/docx/parser.ts
|
|
20631
|
-
var MAX_DECOMPRESS_SIZE5 =
|
|
20631
|
+
var MAX_DECOMPRESS_SIZE5 = _chunkZWPINXUXcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
20632
20632
|
var MEDIA_PART_RE = /^word\/(?:media|embeddings)\//;
|
|
20633
20633
|
function matchesLocal(el, localName3) {
|
|
20634
20634
|
return el.localName === localName3 || (_nullishCoalesce(_optionalChain([el, 'access', _270 => _270.tagName, 'optionalAccess', _271 => _271.endsWith, 'call', _272 => _272(`:${localName3}`)]), () => ( false)));
|
|
@@ -20685,7 +20685,7 @@ function getAttr(el, localName3) {
|
|
|
20685
20685
|
return null;
|
|
20686
20686
|
}
|
|
20687
20687
|
function parseXml2(text) {
|
|
20688
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
20688
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkZWPINXUXcjs.stripDtd.call(void 0, text), "text/xml");
|
|
20689
20689
|
}
|
|
20690
20690
|
function parseStyles(xml) {
|
|
20691
20691
|
const doc = parseXml2(xml);
|
|
@@ -20865,7 +20865,7 @@ function extractRun(r) {
|
|
|
20865
20865
|
italic = getChildElements(rPrEls[0], "i").length > 0;
|
|
20866
20866
|
const va = getChildElements(rPrEls[0], "vertAlign")[0];
|
|
20867
20867
|
const v = va ? getAttr(va, "val") : null;
|
|
20868
|
-
if (v === "superscript" || v === "subscript") text =
|
|
20868
|
+
if (v === "superscript" || v === "subscript") text = _chunkHNPRQKLZcjs.wrapScript.call(void 0, text, v === "superscript" ? "sup" : "sub");
|
|
20869
20869
|
}
|
|
20870
20870
|
return { text, bold, italic };
|
|
20871
20871
|
}
|
|
@@ -20883,7 +20883,7 @@ var PAGE_FIELD_RE = /^\s*(?:PAGE|NUMPAGES|SECTIONPAGES)\b/i;
|
|
|
20883
20883
|
function makeLink(text, rawHref) {
|
|
20884
20884
|
if (!text) return "";
|
|
20885
20885
|
if (!rawHref) return text;
|
|
20886
|
-
const href =
|
|
20886
|
+
const href = _chunkZWPINXUXcjs.sanitizeHref.call(void 0, rawHref);
|
|
20887
20887
|
return href ? `[${text}](${href})` : text;
|
|
20888
20888
|
}
|
|
20889
20889
|
function collectInline(p, footnotes, rels) {
|
|
@@ -20974,7 +20974,7 @@ function collectInline(p, footnotes, rels) {
|
|
|
20974
20974
|
const m = mathText(om);
|
|
20975
20975
|
if (m) parts.push(isDisplayMath(om) ? m : " " + m + " ");
|
|
20976
20976
|
}
|
|
20977
|
-
const text =
|
|
20977
|
+
const text = _chunkHNPRQKLZcjs.tidyScriptTags.call(void 0, parts.join("")).replace(/[ \t]{2,}/g, " ").trim();
|
|
20978
20978
|
return { text, bold, italic, footnoteText };
|
|
20979
20979
|
}
|
|
20980
20980
|
var COUNTERS = /* @__PURE__ */ new WeakMap();
|
|
@@ -21099,7 +21099,7 @@ ${cell2.text}` : cell2.text;
|
|
|
21099
21099
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
21100
21100
|
})
|
|
21101
21101
|
);
|
|
21102
|
-
const table2 =
|
|
21102
|
+
const table2 = _chunkHNPRQKLZcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21103
21103
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21104
21104
|
return { type: "table", table: table2 };
|
|
21105
21105
|
}
|
|
@@ -21247,12 +21247,12 @@ async function parseHeaderFooterBlocks(zip, doc, rels, kind, styles, numbering,
|
|
|
21247
21247
|
}
|
|
21248
21248
|
async function parseDocxDocument(buffer, options) {
|
|
21249
21249
|
const readImages = _optionalChain([options, 'optionalAccess', _300 => _300.images]) !== false;
|
|
21250
|
-
|
|
21250
|
+
_chunkZWPINXUXcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5, void 0, { re: MEDIA_PART_RE, skip: !readImages });
|
|
21251
21251
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21252
21252
|
const warnings = [];
|
|
21253
21253
|
const docFile = zip.file("word/document.xml");
|
|
21254
21254
|
if (!docFile) {
|
|
21255
|
-
throw new (0,
|
|
21255
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21256
21256
|
}
|
|
21257
21257
|
let rels = /* @__PURE__ */ new Map();
|
|
21258
21258
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -21299,7 +21299,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21299
21299
|
const doc = parseXml2(docXml);
|
|
21300
21300
|
const body = findElements(doc, "body");
|
|
21301
21301
|
if (body.length === 0) {
|
|
21302
|
-
throw new (0,
|
|
21302
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21303
21303
|
}
|
|
21304
21304
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings, readImages);
|
|
21305
21305
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -21352,7 +21352,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21352
21352
|
}
|
|
21353
21353
|
}
|
|
21354
21354
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
21355
|
-
const markdown =
|
|
21355
|
+
const markdown = _chunkHNPRQKLZcjs.blocksToMarkdown.call(void 0, blocks);
|
|
21356
21356
|
return {
|
|
21357
21357
|
markdown,
|
|
21358
21358
|
blocks,
|
|
@@ -21370,11 +21370,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
21370
21370
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
21371
21371
|
function parseHwpmlDocument(buffer, options) {
|
|
21372
21372
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
21373
|
-
throw new (0,
|
|
21373
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
21374
21374
|
}
|
|
21375
21375
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
21376
21376
|
const normalized = text.replace(/ /g, " ");
|
|
21377
|
-
const xml =
|
|
21377
|
+
const xml = _chunkZWPINXUXcjs.stripDtd.call(void 0, normalized);
|
|
21378
21378
|
const warnings = [];
|
|
21379
21379
|
const parser = new (0, _xmldom.DOMParser)({
|
|
21380
21380
|
onError: (_level, msg2) => {
|
|
@@ -21414,7 +21414,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
21414
21414
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _308 => _308.keepTrailingEmptyCols]), () => ( false)));
|
|
21415
21415
|
}
|
|
21416
21416
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
21417
|
-
const markdown =
|
|
21417
|
+
const markdown = _chunkHNPRQKLZcjs.blocksToMarkdown.call(void 0, blocks);
|
|
21418
21418
|
return {
|
|
21419
21419
|
markdown,
|
|
21420
21420
|
blocks,
|
|
@@ -21581,7 +21581,7 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
21581
21581
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
21582
21582
|
cellRows[r].push(cell2);
|
|
21583
21583
|
}
|
|
21584
|
-
const table2 =
|
|
21584
|
+
const table2 = _chunkHNPRQKLZcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
21585
21585
|
if (structured.length > 0) {
|
|
21586
21586
|
const claimed = /* @__PURE__ */ new Set();
|
|
21587
21587
|
for (const { ctx, cellBlocks } of structured) {
|
|
@@ -23117,7 +23117,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
23117
23117
|
};
|
|
23118
23118
|
}
|
|
23119
23119
|
async function extractClickHereFields(hwpxBuffer) {
|
|
23120
|
-
|
|
23120
|
+
_chunkZWPINXUXcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
23121
23121
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
23122
23122
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
23123
23123
|
const fields = [];
|
|
@@ -23165,19 +23165,19 @@ function parseCentralDirectory(buf) {
|
|
|
23165
23165
|
}
|
|
23166
23166
|
}
|
|
23167
23167
|
}
|
|
23168
|
-
if (eocdOffset < 0) throw new (0,
|
|
23168
|
+
if (eocdOffset < 0) throw new (0, _chunkZWPINXUXcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
23169
23169
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
23170
23170
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
23171
23171
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
23172
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
23172
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkZWPINXUXcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
23173
23173
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
23174
|
-
throw new (0,
|
|
23174
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
23175
23175
|
}
|
|
23176
23176
|
const decoder = new TextDecoder("utf-8");
|
|
23177
23177
|
const entries = [];
|
|
23178
23178
|
let pos = cdOffset;
|
|
23179
23179
|
for (let i = 0; i < totalEntries; i++) {
|
|
23180
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
23180
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkZWPINXUXcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
23181
23181
|
const flags = view.getUint16(pos + 8, true);
|
|
23182
23182
|
const method = view.getUint16(pos + 10, true);
|
|
23183
23183
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -23188,7 +23188,7 @@ function parseCentralDirectory(buf) {
|
|
|
23188
23188
|
const commentLen = view.getUint16(pos + 32, true);
|
|
23189
23189
|
const localOffset = view.getUint32(pos + 42, true);
|
|
23190
23190
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
23191
|
-
throw new (0,
|
|
23191
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
23192
23192
|
}
|
|
23193
23193
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
23194
23194
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -23217,11 +23217,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23217
23217
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
23218
23218
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
23219
23219
|
for (const name of replacements.keys()) {
|
|
23220
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
23220
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkZWPINXUXcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
23221
23221
|
}
|
|
23222
23222
|
if (additions) {
|
|
23223
23223
|
for (const name of additions.keys()) {
|
|
23224
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
23224
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkZWPINXUXcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
23225
23225
|
}
|
|
23226
23226
|
}
|
|
23227
23227
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -23240,7 +23240,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23240
23240
|
offset += seg.length;
|
|
23241
23241
|
continue;
|
|
23242
23242
|
}
|
|
23243
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
23243
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkZWPINXUXcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
23244
23244
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
23245
23245
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
23246
23246
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -23248,7 +23248,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23248
23248
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
23249
23249
|
const method = e.method;
|
|
23250
23250
|
if (method !== 0 && method !== 8) {
|
|
23251
|
-
throw new (0,
|
|
23251
|
+
throw new (0, _chunkZWPINXUXcjs.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`);
|
|
23252
23252
|
}
|
|
23253
23253
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
23254
23254
|
const crc = crc32(newData);
|
|
@@ -23346,11 +23346,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23346
23346
|
// src/form/filler-hwpx.ts
|
|
23347
23347
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
23348
23348
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
23349
|
-
|
|
23349
|
+
_chunkZWPINXUXcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
23350
23350
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
23351
23351
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
23352
23352
|
if (sectionPaths.length === 0) {
|
|
23353
|
-
throw new (0,
|
|
23353
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
23354
23354
|
}
|
|
23355
23355
|
const warnings = [];
|
|
23356
23356
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -23800,7 +23800,7 @@ function classifyTableTree(blocks) {
|
|
|
23800
23800
|
return blocks;
|
|
23801
23801
|
}
|
|
23802
23802
|
function chooseTableRepresentation(table2, opts = {}) {
|
|
23803
|
-
const structured = hasMerged(table2) ||
|
|
23803
|
+
const structured = hasMerged(table2) || _chunkHNPRQKLZcjs.hasStructuredCellContent.call(void 0, table2);
|
|
23804
23804
|
if (opts.smartVisual && _optionalChain([table2, 'access', _405 => _405.classification, 'optionalAccess', _406 => _406.kind]) === "non-tabular-layout") return "visual";
|
|
23805
23805
|
return structured ? "html" : "gfm";
|
|
23806
23806
|
}
|
|
@@ -26479,7 +26479,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
26479
26479
|
}
|
|
26480
26480
|
function assertFiniteRange(name, value, min, max) {
|
|
26481
26481
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
26482
|
-
throw new (0,
|
|
26482
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
26483
26483
|
}
|
|
26484
26484
|
}
|
|
26485
26485
|
function validateGongmunOptions(opts) {
|
|
@@ -26494,10 +26494,10 @@ function validateGongmunOptions(opts) {
|
|
|
26494
26494
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
26495
26495
|
}
|
|
26496
26496
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
26497
|
-
throw new (0,
|
|
26497
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
26498
26498
|
}
|
|
26499
26499
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
26500
|
-
throw new (0,
|
|
26500
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
26501
26501
|
}
|
|
26502
26502
|
}
|
|
26503
26503
|
if (opts.sizes) {
|
|
@@ -26506,24 +26506,24 @@ function validateGongmunOptions(opts) {
|
|
|
26506
26506
|
}
|
|
26507
26507
|
}
|
|
26508
26508
|
if (opts.approval && opts.approval.length > 6) {
|
|
26509
|
-
throw new (0,
|
|
26509
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("approval must contain at most 6 labels");
|
|
26510
26510
|
}
|
|
26511
26511
|
if (opts.checklist && typeof opts.checklist === "object") {
|
|
26512
26512
|
const nums = [..._nullishCoalesce(opts.checklist.na, () => ( [])), ...Object.keys(_nullishCoalesce(opts.checklist.notes, () => ( {}))).map(Number)];
|
|
26513
26513
|
for (const n of nums) {
|
|
26514
|
-
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0,
|
|
26514
|
+
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0, _chunkZWPINXUXcjs.KordocError)(`checklist: item number must be an integer between 1 and ${CHECKLIST_ITEMS} (got ${n})`);
|
|
26515
26515
|
}
|
|
26516
26516
|
}
|
|
26517
26517
|
if (opts.levels) {
|
|
26518
26518
|
for (const [key, st] of Object.entries(opts.levels)) {
|
|
26519
26519
|
const depth = Number(key);
|
|
26520
26520
|
if (!Number.isInteger(depth) || depth < 0 || depth >= GONGMUN_LEVEL_COUNT) {
|
|
26521
|
-
throw new (0,
|
|
26521
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(`levels: depth must be an integer between 0 and ${GONGMUN_LEVEL_COUNT - 1} (got "${key}")`);
|
|
26522
26522
|
}
|
|
26523
|
-
if (!st || typeof st !== "object") throw new (0,
|
|
26523
|
+
if (!st || typeof st !== "object") throw new (0, _chunkZWPINXUXcjs.KordocError)(`levels.${key} must be an object {font, pt, bold}`);
|
|
26524
26524
|
if (st.pt !== void 0) assertFiniteRange(`levels.${key}.pt`, st.pt, 6, 60);
|
|
26525
26525
|
if (st.font !== void 0 && (typeof st.font !== "string" || !st.font.trim())) {
|
|
26526
|
-
throw new (0,
|
|
26526
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(`levels.${key}.font must be a non-empty string`);
|
|
26527
26527
|
}
|
|
26528
26528
|
}
|
|
26529
26529
|
}
|
|
@@ -26578,7 +26578,7 @@ function resolveChecklist(c, preset) {
|
|
|
26578
26578
|
function hexColorOption(name, value) {
|
|
26579
26579
|
if (value === void 0) return void 0;
|
|
26580
26580
|
const v = value.trim();
|
|
26581
|
-
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0,
|
|
26581
|
+
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0, _chunkZWPINXUXcjs.KordocError)(`${name} must be a #RRGGBB color (got "${value}")`);
|
|
26582
26582
|
return v.toUpperCase();
|
|
26583
26583
|
}
|
|
26584
26584
|
function resolveGongmun(opts) {
|
|
@@ -26965,7 +26965,7 @@ function parseInlineMarkdown(text) {
|
|
|
26965
26965
|
else spans.push(...emphasisSpans(m[0]));
|
|
26966
26966
|
} else {
|
|
26967
26967
|
const anchor = m[2] || m[3];
|
|
26968
|
-
const href = _nullishCoalesce(
|
|
26968
|
+
const href = _nullishCoalesce(_chunkZWPINXUXcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
26969
26969
|
const sub = emphasisSpans(anchor);
|
|
26970
26970
|
if (href) for (const s of sub) s.href = href;
|
|
26971
26971
|
spans.push(...sub);
|
|
@@ -27179,7 +27179,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
27179
27179
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
27180
27180
|
const got = m ? Number(m[1]) : NaN;
|
|
27181
27181
|
if (got !== startId + i) {
|
|
27182
|
-
throw new (0,
|
|
27182
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(
|
|
27183
27183
|
`\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)`
|
|
27184
27184
|
);
|
|
27185
27185
|
}
|
|
@@ -27270,7 +27270,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
27270
27270
|
}
|
|
27271
27271
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
27272
27272
|
if (rows.length !== expectedBase) {
|
|
27273
|
-
throw new (0,
|
|
27273
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(
|
|
27274
27274
|
`\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`
|
|
27275
27275
|
);
|
|
27276
27276
|
}
|
|
@@ -28182,7 +28182,7 @@ function bestSimInRange(arr, from, to, target) {
|
|
|
28182
28182
|
}
|
|
28183
28183
|
var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
|
|
28184
28184
|
function sanitizeText(text) {
|
|
28185
|
-
let result =
|
|
28185
|
+
let result = _chunkHNPRQKLZcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
28186
28186
|
if (result.length <= 30 && result.includes(" ")) {
|
|
28187
28187
|
const tokens = result.split(" ");
|
|
28188
28188
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -28215,7 +28215,7 @@ function replicateGfmTable(table2) {
|
|
|
28215
28215
|
const cell2 = _optionalChain([cells, 'access', _484 => _484[r], 'optionalAccess', _485 => _485[c]]);
|
|
28216
28216
|
if (!cell2) continue;
|
|
28217
28217
|
display[r][c] = {
|
|
28218
|
-
text:
|
|
28218
|
+
text: _chunkHNPRQKLZcjs.escapeGfm.call(void 0, sanitizeText(cell2.text)).replace(/(?<!\\)\|/g, "\\|").replace(/\n/g, "<br>"),
|
|
28219
28219
|
gridR: r,
|
|
28220
28220
|
gridC: c
|
|
28221
28221
|
};
|
|
@@ -28270,14 +28270,14 @@ function replicateCellInnerHtml(cell2) {
|
|
|
28270
28270
|
return cell2.blocks.map((b) => {
|
|
28271
28271
|
if (b.type === "table" && b.table) {
|
|
28272
28272
|
const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
|
|
28273
|
-
return (cap ?
|
|
28273
|
+
return (cap ? _chunkHNPRQKLZcjs.escapeHtmlCellText.call(void 0, cap) + "<br>" : "") + replicateTableToHtml(b.table);
|
|
28274
28274
|
}
|
|
28275
|
-
if (b.type === "image" && b.text) return `<img src="${
|
|
28275
|
+
if (b.type === "image" && b.text) return `<img src="${_chunkZWPINXUXcjs.escapeHtml.call(void 0, b.text, true)}" alt="image">`;
|
|
28276
28276
|
const t = sanitizeText(_nullishCoalesce(b.text, () => ( "")));
|
|
28277
|
-
return t ?
|
|
28277
|
+
return t ? _chunkHNPRQKLZcjs.escapeHtmlCellText.call(void 0, t + _chunkHNPRQKLZcjs.noteSuffix.call(void 0, b)).replace(/\n/g, "<br>") : "";
|
|
28278
28278
|
}).filter(Boolean).join("<br>");
|
|
28279
28279
|
}
|
|
28280
|
-
return
|
|
28280
|
+
return _chunkHNPRQKLZcjs.escapeHtmlCellText.call(void 0, sanitizeText(cell2.text)).replace(/\n/g, "<br>");
|
|
28281
28281
|
}
|
|
28282
28282
|
function replicateTableToHtml(table2) {
|
|
28283
28283
|
const rows = replicateHtmlTable(table2);
|
|
@@ -28354,7 +28354,7 @@ function parseHtmlTable(raw) {
|
|
|
28354
28354
|
const cs = parseInt(_optionalChain([attrs, 'access', _490 => _490.match, 'call', _491 => _491(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _492 => _492[1]]) || "1", 10);
|
|
28355
28355
|
const rs = parseInt(_optionalChain([attrs, 'access', _493 => _493.match, 'call', _494 => _494(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _495 => _495[1]]) || "1", 10);
|
|
28356
28356
|
cellStart = m.index + m[0].length;
|
|
28357
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
28357
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkHNPRQKLZcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkHNPRQKLZcjs.MAX_ROWS) };
|
|
28358
28358
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
28359
28359
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
28360
28360
|
cellStart = -1;
|
|
@@ -28379,11 +28379,11 @@ function htmlCellInnerToLines(inner) {
|
|
|
28379
28379
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
28380
28380
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
28381
28381
|
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _496 => _496[1]]), () => ( _optionalChain([m, 'optionalAccess', _497 => _497[2]])));
|
|
28382
|
-
if (src) imgSrcs.push(
|
|
28382
|
+
if (src) imgSrcs.push(_chunkZWPINXUXcjs.unescapeHtml.call(void 0, src));
|
|
28383
28383
|
return "";
|
|
28384
28384
|
});
|
|
28385
28385
|
}
|
|
28386
|
-
const lines = work.split(/<br\s*\/?>/gi).map((s) =>
|
|
28386
|
+
const lines = work.split(/<br\s*\/?>/gi).map((s) => _chunkZWPINXUXcjs.unescapeHtml.call(void 0, s).trim()).filter((s) => s.length > 0);
|
|
28387
28387
|
return { lines, hadNonText, imgSrcs };
|
|
28388
28388
|
}
|
|
28389
28389
|
function splitCellByTopLevelTables(html) {
|
|
@@ -29158,8 +29158,8 @@ function layoutHtmlRows(rows) {
|
|
|
29158
29158
|
let c = 0;
|
|
29159
29159
|
for (const cell2 of rows[r].cells) {
|
|
29160
29160
|
while (occupied.has(`${r},${c}`)) c++;
|
|
29161
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
29162
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
29161
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkHNPRQKLZcjs.MAX_COLS);
|
|
29162
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkHNPRQKLZcjs.MAX_ROWS);
|
|
29163
29163
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
29164
29164
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
29165
29165
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -31781,7 +31781,7 @@ function builtinTemplateDir() {
|
|
|
31781
31781
|
for (const c of candidates) {
|
|
31782
31782
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
31783
31783
|
}
|
|
31784
|
-
throw new (0,
|
|
31784
|
+
throw new (0, _chunkZWPINXUXcjs.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)");
|
|
31785
31785
|
}
|
|
31786
31786
|
function readBuiltinTemplate(t) {
|
|
31787
31787
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -32135,12 +32135,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
32135
32135
|
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>`;
|
|
32136
32136
|
}
|
|
32137
32137
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
32138
|
-
if (ops.length === 0) throw new (0,
|
|
32138
|
+
if (ops.length === 0) throw new (0, _chunkZWPINXUXcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
32139
32139
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
32140
|
-
|
|
32140
|
+
_chunkZWPINXUXcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
32141
32141
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
32142
32142
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _637 => _637.match, 'call', _638 => _638(/(\d+)\.xml$/i), 'optionalAccess', _639 => _639[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _640 => _640.match, 'call', _641 => _641(/(\d+)\.xml$/i), 'optionalAccess', _642 => _642[1]]), () => ( 0))));
|
|
32143
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
32143
|
+
if (sectionPaths.length === 0) throw new (0, _chunkZWPINXUXcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
32144
32144
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
32145
32145
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
32146
32146
|
const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
|
|
@@ -32181,11 +32181,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
32181
32181
|
const manifestItems = [];
|
|
32182
32182
|
const placed = [];
|
|
32183
32183
|
for (const op of ops) {
|
|
32184
|
-
if (!op.anchor) throw new (0,
|
|
32185
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
32184
|
+
if (!op.anchor) throw new (0, _chunkZWPINXUXcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
32185
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkZWPINXUXcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
32186
32186
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
32187
|
-
if (!MIME[ext]) throw new (0,
|
|
32188
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
32187
|
+
if (!MIME[ext]) throw new (0, _chunkZWPINXUXcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
32188
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkZWPINXUXcjs.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)`);
|
|
32189
32189
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
32190
32190
|
let found = null;
|
|
32191
32191
|
let total = 0;
|
|
@@ -32218,7 +32218,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
32218
32218
|
}
|
|
32219
32219
|
}
|
|
32220
32220
|
}
|
|
32221
|
-
throw new (0,
|
|
32221
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(
|
|
32222
32222
|
`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)})`
|
|
32223
32223
|
);
|
|
32224
32224
|
}
|
|
@@ -32226,7 +32226,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
32226
32226
|
const xml = sectionXmls[si];
|
|
32227
32227
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
32228
32228
|
if (!run) {
|
|
32229
|
-
throw new (0,
|
|
32229
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
32230
32230
|
}
|
|
32231
32231
|
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _643 => _643.charPr, 'access', _644 => _644.get, 'call', _645 => _645(run.charPr), 'optionalAccess', _646 => _646.height]), () => ( 1e3));
|
|
32232
32232
|
const fontPt = charPrHeight / 100;
|
|
@@ -32504,7 +32504,7 @@ function pick(map, keys) {
|
|
|
32504
32504
|
return out;
|
|
32505
32505
|
}
|
|
32506
32506
|
async function hwpxToProfile(input) {
|
|
32507
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
32507
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkZWPINXUXcjs.toArrayBuffer.call(void 0, input);
|
|
32508
32508
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
32509
32509
|
const parser = createXmlParser();
|
|
32510
32510
|
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _668 => _668.file, 'call', _669 => _669(/[Hh]eader\.xml$/), 'optionalAccess', _670 => _670[0]])));
|
|
@@ -33657,8 +33657,8 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
33657
33657
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
33658
33658
|
const t = line.trim();
|
|
33659
33659
|
if (!t) return "";
|
|
33660
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
33661
|
-
return
|
|
33660
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkHNPRQKLZcjs.escapeGfm.call(void 0, t)}**`;
|
|
33661
|
+
return _chunkHNPRQKLZcjs.escapeGfm.call(void 0, t);
|
|
33662
33662
|
}).filter(Boolean);
|
|
33663
33663
|
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");
|
|
33664
33664
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -33672,7 +33672,7 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
33672
33672
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
33673
33673
|
const replica = [];
|
|
33674
33674
|
for (let r = 0; r < table2.rows; r++) {
|
|
33675
|
-
const line =
|
|
33675
|
+
const line = _chunkHNPRQKLZcjs.escapeGfm.call(void 0, sanitizeText(table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
33676
33676
|
if (line) replica.push({ line, gridR: r });
|
|
33677
33677
|
}
|
|
33678
33678
|
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");
|
|
@@ -33837,7 +33837,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
33837
33837
|
const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
33838
33838
|
if (paths.length > 0) return paths;
|
|
33839
33839
|
}
|
|
33840
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
33840
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkZWPINXUXcjs.compareSectionPaths);
|
|
33841
33841
|
}
|
|
33842
33842
|
function sectionPathsFromManifest(xml) {
|
|
33843
33843
|
const attr = (tag, name) => {
|
|
@@ -33847,7 +33847,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
33847
33847
|
const idToHref = /* @__PURE__ */ new Map();
|
|
33848
33848
|
for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
|
|
33849
33849
|
const id = attr(m[1], "id");
|
|
33850
|
-
const href =
|
|
33850
|
+
const href = _chunkZWPINXUXcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
|
|
33851
33851
|
if (id && href) idToHref.set(id, href);
|
|
33852
33852
|
}
|
|
33853
33853
|
const ordered = [];
|
|
@@ -33856,7 +33856,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
33856
33856
|
if (href) ordered.push(href);
|
|
33857
33857
|
}
|
|
33858
33858
|
if (ordered.length > 0) return ordered;
|
|
33859
|
-
return Array.from(idToHref.values()).sort(
|
|
33859
|
+
return Array.from(idToHref.values()).sort(_chunkZWPINXUXcjs.compareSectionPaths);
|
|
33860
33860
|
}
|
|
33861
33861
|
|
|
33862
33862
|
// src/roundtrip/hwp5-patch.ts
|
|
@@ -34763,8 +34763,8 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
34763
34763
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
34764
34764
|
const t = line.trim();
|
|
34765
34765
|
if (!t) return "";
|
|
34766
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
34767
|
-
return
|
|
34766
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkHNPRQKLZcjs.escapeGfm.call(void 0, t)}**`;
|
|
34767
|
+
return _chunkHNPRQKLZcjs.escapeGfm.call(void 0, t);
|
|
34768
34768
|
}).filter(Boolean);
|
|
34769
34769
|
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");
|
|
34770
34770
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -34778,7 +34778,7 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
34778
34778
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
34779
34779
|
const replica = [];
|
|
34780
34780
|
for (let r = 0; r < table2.rows; r++) {
|
|
34781
|
-
const line =
|
|
34781
|
+
const line = _chunkHNPRQKLZcjs.escapeGfm.call(void 0, sanitizeText(table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
34782
34782
|
if (line) replica.push({ line, gridR: r });
|
|
34783
34783
|
}
|
|
34784
34784
|
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");
|
|
@@ -35179,9 +35179,9 @@ function buildOrigUnits(blocks) {
|
|
|
35179
35179
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
35180
35180
|
const next = blocks[i + 1];
|
|
35181
35181
|
if (_optionalChain([next, 'optionalAccess', _721 => _721.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
35182
|
-
chunk =
|
|
35182
|
+
chunk = _chunkHNPRQKLZcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
35183
35183
|
} else {
|
|
35184
|
-
chunk =
|
|
35184
|
+
chunk = _chunkHNPRQKLZcjs.blocksToMarkdown.call(void 0, [block]);
|
|
35185
35185
|
}
|
|
35186
35186
|
if (chunk) {
|
|
35187
35187
|
const subUnits = splitMarkdownUnits(chunk);
|
|
@@ -38036,12 +38036,12 @@ function blocksToChunks(blocks, options) {
|
|
|
38036
38036
|
let run = null;
|
|
38037
38037
|
const flushRun = () => {
|
|
38038
38038
|
if (!run) return;
|
|
38039
|
-
push("text", run.breadcrumb,
|
|
38039
|
+
push("text", run.breadcrumb, _chunkHNPRQKLZcjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
|
|
38040
38040
|
run = null;
|
|
38041
38041
|
};
|
|
38042
38042
|
for (let i = 0; i < blocks.length; i++) {
|
|
38043
38043
|
const block = blocks[i];
|
|
38044
|
-
const md2 =
|
|
38044
|
+
const md2 = _chunkHNPRQKLZcjs.blocksToMarkdown.call(void 0, [block]);
|
|
38045
38045
|
if (!md2) continue;
|
|
38046
38046
|
if (block.type === "heading") {
|
|
38047
38047
|
flushRun();
|
|
@@ -38484,7 +38484,7 @@ var md = new (0, _markdownit2.default)({
|
|
|
38484
38484
|
});
|
|
38485
38485
|
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;
|
|
38486
38486
|
function sanitizeRawHtml(raw) {
|
|
38487
|
-
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag :
|
|
38487
|
+
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag : _chunkZWPINXUXcjs.escapeHtml.call(void 0, tag));
|
|
38488
38488
|
}
|
|
38489
38489
|
md.renderer.rules.html_block = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
38490
38490
|
md.renderer.rules.html_inline = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
@@ -38492,7 +38492,7 @@ function renderHtml(markdown, options) {
|
|
|
38492
38492
|
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _788 => _788.preset]), () => ( "default"));
|
|
38493
38493
|
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _789 => _789.extraCss]), () => ( "")));
|
|
38494
38494
|
const body = md.render(markdown);
|
|
38495
|
-
const watermark = _optionalChain([options, 'optionalAccess', _790 => _790.watermark]) ? `<div class="watermark">${
|
|
38495
|
+
const watermark = _optionalChain([options, 'optionalAccess', _790 => _790.watermark]) ? `<div class="watermark">${_chunkZWPINXUXcjs.escapeHtml.call(void 0, options.watermark)}</div>` : "";
|
|
38496
38496
|
const watermarkCss = _optionalChain([options, 'optionalAccess', _791 => _791.watermark]) ? `
|
|
38497
38497
|
.watermark {
|
|
38498
38498
|
position: fixed;
|
|
@@ -38543,13 +38543,13 @@ async function htmlToPdf(html, options) {
|
|
|
38543
38543
|
try {
|
|
38544
38544
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
38545
38545
|
} catch (e40) {
|
|
38546
|
-
throw new (0,
|
|
38546
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(
|
|
38547
38547
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
38548
38548
|
);
|
|
38549
38549
|
}
|
|
38550
38550
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
38551
38551
|
if (!executablePath) {
|
|
38552
|
-
throw new (0,
|
|
38552
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(
|
|
38553
38553
|
"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."
|
|
38554
38554
|
);
|
|
38555
38555
|
}
|
|
@@ -38604,7 +38604,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
38604
38604
|
return htmlToPdf(html, options);
|
|
38605
38605
|
}
|
|
38606
38606
|
async function blocksToPdf(blocks, options) {
|
|
38607
|
-
const markdown =
|
|
38607
|
+
const markdown = _chunkHNPRQKLZcjs.blocksToMarkdown.call(void 0, blocks);
|
|
38608
38608
|
return markdownToPdf(markdown, options);
|
|
38609
38609
|
}
|
|
38610
38610
|
|
|
@@ -39653,22 +39653,22 @@ function renderSectionRoots(sections, input) {
|
|
|
39653
39653
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${index}` });
|
|
39654
39654
|
ctxBase.pageBase += pages.length;
|
|
39655
39655
|
}
|
|
39656
|
-
if (rendered.length === 0) throw new (0,
|
|
39656
|
+
if (rendered.length === 0) throw new (0, _chunkZWPINXUXcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
39657
39657
|
return { sections: rendered, defs: ctxBase.defs, warnings: input.warnings, stats: ctxBase.stats, regions: ctxBase.regions.regions };
|
|
39658
39658
|
}
|
|
39659
39659
|
var SVG_FONT_FAMILY = `'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif`;
|
|
39660
39660
|
async function renderHwpxInternal(input, options) {
|
|
39661
39661
|
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _835 => _835.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
39662
39662
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
39663
|
-
|
|
39663
|
+
_chunkZWPINXUXcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
39664
39664
|
let zip;
|
|
39665
39665
|
try {
|
|
39666
39666
|
zip = await _jszip2.default.loadAsync(input);
|
|
39667
39667
|
} catch (e41) {
|
|
39668
|
-
throw new (0,
|
|
39668
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
39669
39669
|
}
|
|
39670
39670
|
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
|
|
39671
|
-
if (secFiles.length === 0) throw new (0,
|
|
39671
|
+
if (secFiles.length === 0) throw new (0, _chunkZWPINXUXcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
39672
39672
|
const warnings = [];
|
|
39673
39673
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
39674
39674
|
const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
@@ -39676,7 +39676,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
39676
39676
|
const secXmls = [];
|
|
39677
39677
|
for (const f of secFiles) {
|
|
39678
39678
|
const xml = await f.async("string");
|
|
39679
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
39679
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkZWPINXUXcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
39680
39680
|
secXmls.push(xml);
|
|
39681
39681
|
}
|
|
39682
39682
|
const binmap = /* @__PURE__ */ new Map();
|
|
@@ -39737,9 +39737,9 @@ async function renderHwpxInternal(input, options) {
|
|
|
39737
39737
|
}
|
|
39738
39738
|
if (roots.length === 0) {
|
|
39739
39739
|
if (noCacheSkipped) {
|
|
39740
|
-
throw new (0,
|
|
39740
|
+
throw new (0, _chunkZWPINXUXcjs.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)");
|
|
39741
39741
|
}
|
|
39742
|
-
throw new (0,
|
|
39742
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
39743
39743
|
}
|
|
39744
39744
|
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _838 => _838.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _839 => _839.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _840 => _840.highlights]) });
|
|
39745
39745
|
}
|
|
@@ -39961,7 +39961,7 @@ var FOLD_END = 42124;
|
|
|
39961
39961
|
var FOLD_SHIFT = 983040 - 40960;
|
|
39962
39962
|
function textChar(ch) {
|
|
39963
39963
|
if (ch >= FOLD_START && ch <= FOLD_END) {
|
|
39964
|
-
const mapped =
|
|
39964
|
+
const mapped = _chunkHNPRQKLZcjs.mapPuaText.call(void 0, String.fromCodePoint(ch + FOLD_SHIFT));
|
|
39965
39965
|
return /[\u{F0000}-\u{FFFFF}]/u.test(mapped) ? "" : mapped;
|
|
39966
39966
|
}
|
|
39967
39967
|
if (ch === 65534 || ch === 65535 || ch >= 55296 && ch <= 57343) return "\uFFFD";
|
|
@@ -40333,7 +40333,7 @@ function renderHwp5Records(docInfo, styles, secRecords, binData, options, select
|
|
|
40333
40333
|
}
|
|
40334
40334
|
roots.push({ root, index: si });
|
|
40335
40335
|
}
|
|
40336
|
-
if (roots.length === 0) throw new (0,
|
|
40336
|
+
if (roots.length === 0) throw new (0, _chunkZWPINXUXcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP \uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
40337
40337
|
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _849 => _849.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _850 => _850.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _851 => _851.highlights]) });
|
|
40338
40338
|
return assemblePageSvgs(r, "hwp", select);
|
|
40339
40339
|
}
|
|
@@ -40346,7 +40346,7 @@ function renderHwp5Pages(input, options, select) {
|
|
|
40346
40346
|
const styles = buildHwp5RenderStyles(_nullishCoalesce(docInfoRecords, () => ( [])));
|
|
40347
40347
|
const docInfo = docInfoRecords ? parseDocInfo(docInfoRecords) : null;
|
|
40348
40348
|
const sections = readHwp5SectionStreams(c);
|
|
40349
|
-
if (sections.length === 0) throw new (0,
|
|
40349
|
+
if (sections.length === 0) throw new (0, _chunkZWPINXUXcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
40350
40350
|
const parseWarnings = [];
|
|
40351
40351
|
const secRecords = readHwp5SectionRecords(c, sections, parseWarnings);
|
|
40352
40352
|
for (const w of parseWarnings) warnings.push(w.message);
|
|
@@ -40431,14 +40431,14 @@ async function loadSharp() {
|
|
|
40431
40431
|
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("sharp")));
|
|
40432
40432
|
return _nullishCoalesce(mod.default, () => ( mod));
|
|
40433
40433
|
} catch (e44) {
|
|
40434
|
-
throw new (0,
|
|
40435
|
-
'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.' +
|
|
40434
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(
|
|
40435
|
+
'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.' + _chunkZWPINXUXcjs.OPTIONAL_DEP_INSTALL_HINT
|
|
40436
40436
|
);
|
|
40437
40437
|
}
|
|
40438
40438
|
}
|
|
40439
40439
|
async function rasterizePageSvg(svg, widthPt, heightPt, options = {}) {
|
|
40440
40440
|
const sharp = await loadSharp();
|
|
40441
|
-
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0,
|
|
40441
|
+
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0, _chunkZWPINXUXcjs.KordocError)(`\uC798\uBABB\uB41C \uD398\uC774\uC9C0 \uD06C\uAE30: ${widthPt}x${heightPt}pt`);
|
|
40442
40442
|
const maxW = _nullishCoalesce(options.maxWidthPx, () => ( 1400));
|
|
40443
40443
|
const maxH = _nullishCoalesce(options.maxHeightPx, () => ( 4e3));
|
|
40444
40444
|
const scale2 = Math.min(maxW / widthPt, maxH / heightPt, 2);
|
|
@@ -40456,11 +40456,11 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
40456
40456
|
try {
|
|
40457
40457
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
40458
40458
|
} catch (e45) {
|
|
40459
|
-
throw new (0,
|
|
40459
|
+
throw new (0, _chunkZWPINXUXcjs.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");
|
|
40460
40460
|
}
|
|
40461
40461
|
const executablePath = _nullishCoalesce(_nullishCoalesce(options.browserExecutablePath, () => ( process.env.PUPPETEER_EXECUTABLE_PATH)), () => ( findChromiumPath()));
|
|
40462
40462
|
if (!executablePath) {
|
|
40463
|
-
throw new (0,
|
|
40463
|
+
throw new (0, _chunkZWPINXUXcjs.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");
|
|
40464
40464
|
}
|
|
40465
40465
|
const { browser, page } = await launchLockedPage(puppeteer, executablePath);
|
|
40466
40466
|
try {
|
|
@@ -40476,13 +40476,13 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
40476
40476
|
async function loadBuffer(input) {
|
|
40477
40477
|
if (typeof input === "string") {
|
|
40478
40478
|
try {
|
|
40479
|
-
return
|
|
40479
|
+
return _chunkZWPINXUXcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input));
|
|
40480
40480
|
} catch (err) {
|
|
40481
40481
|
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
40482
|
-
throw new (0,
|
|
40482
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`);
|
|
40483
40483
|
}
|
|
40484
40484
|
}
|
|
40485
|
-
if (Buffer.isBuffer(input)) return
|
|
40485
|
+
if (Buffer.isBuffer(input)) return _chunkZWPINXUXcjs.toArrayBuffer.call(void 0, input);
|
|
40486
40486
|
if (input instanceof Uint8Array) return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
|
|
40487
40487
|
return input;
|
|
40488
40488
|
}
|
|
@@ -40491,17 +40491,17 @@ async function sourceFormatOf(buffer) {
|
|
|
40491
40491
|
if (format2 === "hwpx") {
|
|
40492
40492
|
const zip = await detectZipFormat(buffer);
|
|
40493
40493
|
if (zip === "hwpx" || zip === "unknown") return "hwpx";
|
|
40494
|
-
throw new (0,
|
|
40494
|
+
throw new (0, _chunkZWPINXUXcjs.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`);
|
|
40495
40495
|
}
|
|
40496
40496
|
if (format2 === "hwp") return "hwp";
|
|
40497
|
-
throw new (0,
|
|
40497
|
+
throw new (0, _chunkZWPINXUXcjs.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`);
|
|
40498
40498
|
}
|
|
40499
40499
|
async function renderDocumentToScene(input, options = {}) {
|
|
40500
40500
|
const buffer = await loadBuffer(input);
|
|
40501
40501
|
const source = await sourceFormatOf(buffer);
|
|
40502
40502
|
const select = options.pages !== void 0 ? (pageCount) => {
|
|
40503
40503
|
const set = _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, pageCount);
|
|
40504
|
-
if (set.size === 0) throw new (0,
|
|
40504
|
+
if (set.size === 0) throw new (0, _chunkZWPINXUXcjs.KordocError)(`\uC120\uD0DD\uD55C \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uBB38\uC11C\uB294 ${pageCount}\uCABD (pages: ${JSON.stringify(options.pages)})`);
|
|
40505
40505
|
return set;
|
|
40506
40506
|
} : void 0;
|
|
40507
40507
|
const renderOptions = { reflow: _nullishCoalesce(options.reflow, () => ( true)), reflowMode: options.reflowMode, highlights: options.highlights, maxImageBytes: options.maxImageBytes };
|
|
@@ -40537,7 +40537,7 @@ async function renderDocument(input, options) {
|
|
|
40537
40537
|
break;
|
|
40538
40538
|
}
|
|
40539
40539
|
default:
|
|
40540
|
-
throw new (0,
|
|
40540
|
+
throw new (0, _chunkZWPINXUXcjs.KordocError)(`\uC54C \uC218 \uC5C6\uB294 \uB80C\uB354 \uD3EC\uB9F7: ${String(options.format)} (svg|html|png|jpeg|pdf)`);
|
|
40541
40541
|
}
|
|
40542
40542
|
return { scene, assets };
|
|
40543
40543
|
}
|
|
@@ -40567,7 +40567,7 @@ async function extractRenderedRegions(input, options = {}) {
|
|
|
40567
40567
|
const out = [];
|
|
40568
40568
|
for (const [page, items] of [...byPage.entries()].sort((a, b) => a[0] - b[0])) {
|
|
40569
40569
|
const meta = scene.pages.find((p) => p.page === page);
|
|
40570
|
-
if (!meta) throw new (0,
|
|
40570
|
+
if (!meta) throw new (0, _chunkZWPINXUXcjs.KordocError)(`\uD398\uC774\uC9C0 ${page} \uBA54\uD0C0 \uC5C6\uC74C`);
|
|
40571
40571
|
const raster = await rasterizePageSvg(pageSvgs.get(page), meta.width, meta.height, { format: format2, maxWidthPx: options.maxWidthPx, quality: options.quality });
|
|
40572
40572
|
for (const { region, bbox } of items) {
|
|
40573
40573
|
const rect = cropRect(bbox, raster.scale, raster.widthPx, raster.heightPx, _nullishCoalesce(options.paddingPt, () => ( 0)));
|
|
@@ -40591,9 +40591,9 @@ function wantsCrop(kind, policy) {
|
|
|
40591
40591
|
}
|
|
40592
40592
|
async function extractTables(input, options = {}) {
|
|
40593
40593
|
const policy = _nullishCoalesce(options.policy, () => ( "non-tabular-and-uncertain"));
|
|
40594
|
-
const buffer = typeof input === "string" ?
|
|
40594
|
+
const buffer = typeof input === "string" ? _chunkZWPINXUXcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input)) : Buffer.isBuffer(input) ? _chunkZWPINXUXcjs.toArrayBuffer.call(void 0, input) : input;
|
|
40595
40595
|
const parsed = await parse(buffer, { classifyTables: true, layoutTables: "keep" });
|
|
40596
|
-
if (!parsed.success) throw new (0,
|
|
40596
|
+
if (!parsed.success) throw new (0, _chunkZWPINXUXcjs.KordocError)(`\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
40597
40597
|
const blocks = collectTableBlocks(parsed.blocks);
|
|
40598
40598
|
const out = blocks.map((b, i) => ({
|
|
40599
40599
|
id: _nullishCoalesce(b.table.sourceId, () => ( `tbl-${i + 1}`)),
|
|
@@ -40655,13 +40655,13 @@ async function parse(input, options) {
|
|
|
40655
40655
|
if (typeof input === "string") {
|
|
40656
40656
|
try {
|
|
40657
40657
|
const buf = await _promises.readFile.call(void 0, input);
|
|
40658
|
-
buffer =
|
|
40658
|
+
buffer = _chunkZWPINXUXcjs.toArrayBuffer.call(void 0, buf);
|
|
40659
40659
|
} catch (err) {
|
|
40660
40660
|
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}`;
|
|
40661
40661
|
return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
|
|
40662
40662
|
}
|
|
40663
40663
|
} else if (Buffer.isBuffer(input)) {
|
|
40664
|
-
buffer =
|
|
40664
|
+
buffer = _chunkZWPINXUXcjs.toArrayBuffer.call(void 0, input);
|
|
40665
40665
|
} else {
|
|
40666
40666
|
buffer = input;
|
|
40667
40667
|
}
|
|
@@ -40677,7 +40677,7 @@ async function parse(input, options) {
|
|
|
40677
40677
|
if (result.success && _optionalChain([opts, 'optionalAccess', _854 => _854.classifyTables])) classifyTableTree(result.blocks);
|
|
40678
40678
|
let out = result;
|
|
40679
40679
|
if (result.success && !result.pages) {
|
|
40680
|
-
const pages =
|
|
40680
|
+
const pages = _chunkDUHHMIPScjs.blocksToPages.call(void 0, result.blocks);
|
|
40681
40681
|
if (pages) out = { ...result, pages };
|
|
40682
40682
|
}
|
|
40683
40683
|
if (out.success && _optionalChain([opts, 'optionalAccess', _855 => _855.plain])) {
|
|
@@ -40728,23 +40728,23 @@ async function dispatch(format2, buffer, opts) {
|
|
|
40728
40728
|
}
|
|
40729
40729
|
}
|
|
40730
40730
|
function scriptsOff(r, off) {
|
|
40731
|
-
return off ?
|
|
40731
|
+
return off ? _chunkHNPRQKLZcjs.stripScriptTags.call(void 0, r) : r;
|
|
40732
40732
|
}
|
|
40733
40733
|
async function parseImage(buffer, options) {
|
|
40734
40734
|
try {
|
|
40735
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
40735
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-QYLWWB7R.cjs")));
|
|
40736
40736
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
40737
|
-
|
|
40737
|
+
_chunkHNPRQKLZcjs.stripScriptTags.call(void 0, { blocks });
|
|
40738
40738
|
return {
|
|
40739
40739
|
success: true,
|
|
40740
40740
|
fileType: "image",
|
|
40741
|
-
markdown:
|
|
40741
|
+
markdown: _chunkHNPRQKLZcjs.blocksToMarkdown.call(void 0, blocks),
|
|
40742
40742
|
blocks,
|
|
40743
40743
|
warnings: warnings.length ? warnings : void 0,
|
|
40744
40744
|
pageCount: 1
|
|
40745
40745
|
};
|
|
40746
40746
|
} catch (err) {
|
|
40747
|
-
return { success: false, fileType: "image", error:
|
|
40747
|
+
return { success: false, fileType: "image", error: _chunkZWPINXUXcjs.sanitizeError.call(void 0, err), code: _chunkZWPINXUXcjs.classifyError.call(void 0, err) };
|
|
40748
40748
|
}
|
|
40749
40749
|
}
|
|
40750
40750
|
async function parseHwp3(buffer, options) {
|
|
@@ -40752,7 +40752,7 @@ async function parseHwp3(buffer, options) {
|
|
|
40752
40752
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
40753
40753
|
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _857 => _857.pageCount]) };
|
|
40754
40754
|
} catch (err) {
|
|
40755
|
-
return { success: false, fileType: "hwp3", error:
|
|
40755
|
+
return { success: false, fileType: "hwp3", error: _chunkZWPINXUXcjs.sanitizeError.call(void 0, err), code: _chunkZWPINXUXcjs.classifyError.call(void 0, err) };
|
|
40756
40756
|
}
|
|
40757
40757
|
}
|
|
40758
40758
|
async function parseHwpx(buffer, options) {
|
|
@@ -40760,7 +40760,7 @@ async function parseHwpx(buffer, options) {
|
|
|
40760
40760
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
40761
40761
|
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _858 => _858.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _859 => _859.pageCount]) }, _optionalChain([options, 'optionalAccess', _860 => _860.scriptTags]) === false);
|
|
40762
40762
|
} catch (err) {
|
|
40763
|
-
return { success: false, fileType: "hwpx", error:
|
|
40763
|
+
return { success: false, fileType: "hwpx", error: _chunkZWPINXUXcjs.sanitizeError.call(void 0, err), code: _chunkZWPINXUXcjs.classifyError.call(void 0, err) };
|
|
40764
40764
|
}
|
|
40765
40765
|
}
|
|
40766
40766
|
async function parseHwp(buffer, options) {
|
|
@@ -40786,13 +40786,13 @@ async function parseHwp(buffer, options) {
|
|
|
40786
40786
|
}
|
|
40787
40787
|
return scriptsOff({ success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _862 => _862.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _863 => _863.pageCount]) }, _optionalChain([options, 'optionalAccess', _864 => _864.scriptTags]) === false);
|
|
40788
40788
|
} catch (err) {
|
|
40789
|
-
return { success: false, fileType: "hwp", error:
|
|
40789
|
+
return { success: false, fileType: "hwp", error: _chunkZWPINXUXcjs.sanitizeError.call(void 0, err), code: _chunkZWPINXUXcjs.classifyError.call(void 0, err) };
|
|
40790
40790
|
}
|
|
40791
40791
|
}
|
|
40792
40792
|
async function parsePdf(buffer, options) {
|
|
40793
40793
|
let parsePdfDocument;
|
|
40794
40794
|
try {
|
|
40795
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
40795
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-BEPVGAMI.cjs")));
|
|
40796
40796
|
parsePdfDocument = mod.parsePdfDocument;
|
|
40797
40797
|
} catch (e47) {
|
|
40798
40798
|
return {
|
|
@@ -40807,7 +40807,7 @@ async function parsePdf(buffer, options) {
|
|
|
40807
40807
|
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess', _865 => _865.pageCount]) }, _optionalChain([options, 'optionalAccess', _866 => _866.scriptTags]) !== true);
|
|
40808
40808
|
} catch (err) {
|
|
40809
40809
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
40810
|
-
return { success: false, fileType: "pdf", error:
|
|
40810
|
+
return { success: false, fileType: "pdf", error: _chunkZWPINXUXcjs.sanitizeError.call(void 0, err), code: _chunkZWPINXUXcjs.classifyError.call(void 0, err), isImageBased };
|
|
40811
40811
|
}
|
|
40812
40812
|
}
|
|
40813
40813
|
async function parseXlsx(buffer, options) {
|
|
@@ -40815,7 +40815,7 @@ async function parseXlsx(buffer, options) {
|
|
|
40815
40815
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
40816
40816
|
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _867 => _867.pageCount]) };
|
|
40817
40817
|
} catch (err) {
|
|
40818
|
-
return { success: false, fileType: "xlsx", error:
|
|
40818
|
+
return { success: false, fileType: "xlsx", error: _chunkZWPINXUXcjs.sanitizeError.call(void 0, err), code: _chunkZWPINXUXcjs.classifyError.call(void 0, err) };
|
|
40819
40819
|
}
|
|
40820
40820
|
}
|
|
40821
40821
|
async function parseXls(buffer, options) {
|
|
@@ -40823,7 +40823,7 @@ async function parseXls(buffer, options) {
|
|
|
40823
40823
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
40824
40824
|
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _868 => _868.pageCount]) };
|
|
40825
40825
|
} catch (err) {
|
|
40826
|
-
return { success: false, fileType: "xls", error:
|
|
40826
|
+
return { success: false, fileType: "xls", error: _chunkZWPINXUXcjs.sanitizeError.call(void 0, err), code: _chunkZWPINXUXcjs.classifyError.call(void 0, err) };
|
|
40827
40827
|
}
|
|
40828
40828
|
}
|
|
40829
40829
|
async function parseDocx(buffer, options) {
|
|
@@ -40831,7 +40831,7 @@ async function parseDocx(buffer, options) {
|
|
|
40831
40831
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
40832
40832
|
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _869 => _869.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _870 => _870.pageCount]) }, _optionalChain([options, 'optionalAccess', _871 => _871.scriptTags]) === false);
|
|
40833
40833
|
} catch (err) {
|
|
40834
|
-
return { success: false, fileType: "docx", error:
|
|
40834
|
+
return { success: false, fileType: "docx", error: _chunkZWPINXUXcjs.sanitizeError.call(void 0, err), code: _chunkZWPINXUXcjs.classifyError.call(void 0, err) };
|
|
40835
40835
|
}
|
|
40836
40836
|
}
|
|
40837
40837
|
async function parseHwpml(buffer, options) {
|
|
@@ -40839,16 +40839,16 @@ async function parseHwpml(buffer, options) {
|
|
|
40839
40839
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
40840
40840
|
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _872 => _872.pageCount]) };
|
|
40841
40841
|
} catch (err) {
|
|
40842
|
-
return { success: false, fileType: "hwpml", error:
|
|
40842
|
+
return { success: false, fileType: "hwpml", error: _chunkZWPINXUXcjs.sanitizeError.call(void 0, err), code: _chunkZWPINXUXcjs.classifyError.call(void 0, err) };
|
|
40843
40843
|
}
|
|
40844
40844
|
}
|
|
40845
40845
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
40846
40846
|
let buffer;
|
|
40847
40847
|
if (typeof input === "string") {
|
|
40848
40848
|
const buf = await _promises.readFile.call(void 0, input);
|
|
40849
|
-
buffer =
|
|
40849
|
+
buffer = _chunkZWPINXUXcjs.toArrayBuffer.call(void 0, buf);
|
|
40850
40850
|
} else if (Buffer.isBuffer(input)) {
|
|
40851
|
-
buffer =
|
|
40851
|
+
buffer = _chunkZWPINXUXcjs.toArrayBuffer.call(void 0, input);
|
|
40852
40852
|
} else {
|
|
40853
40853
|
buffer = input;
|
|
40854
40854
|
}
|
|
@@ -40874,7 +40874,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
40874
40874
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
40875
40875
|
}
|
|
40876
40876
|
const fill = fillFormFields(parsed.blocks, values);
|
|
40877
|
-
const markdown =
|
|
40877
|
+
const markdown = _chunkHNPRQKLZcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
40878
40878
|
if (outputFormat === "hwpx") {
|
|
40879
40879
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
40880
40880
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -40969,5 +40969,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
40969
40969
|
|
|
40970
40970
|
|
|
40971
40971
|
|
|
40972
|
-
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 =
|
|
40972
|
+
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 = _chunkZWPINXUXcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkHNPRQKLZcjs.blocksToMarkdown; exports.blocksToPages = _chunkDUHHMIPScjs.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 = _chunkHNPRQKLZcjs.flattenLayoutTables; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hasStructuredCellContent = _chunkHNPRQKLZcjs.hasStructuredCellContent; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintGongmunText = lintGongmunText; exports.lintMuncheText = lintMuncheText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.muncheLintWarnings = muncheLintWarnings; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.readBuiltinTemplate = readBuiltinTemplate; exports.readBuiltinTemplateSample = readBuiltinTemplateSample; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderDocument = renderDocument; exports.renderDocumentToScene = renderDocumentToScene; exports.renderHtml = renderHtml; exports.renderHwp5Pages = renderHwp5Pages; exports.renderHwpxToSvg = renderHwpxToSvg; exports.renderSceneToHtml = renderSceneToHtml; exports.resolveBuiltinTemplate = resolveBuiltinTemplate; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.usesGaejosikMunche = usesGaejosikMunche; exports.validateHwpx = validateHwpx;
|
|
40973
40973
|
//# sourceMappingURL=index.cjs.map
|