kordoc 4.9.2 → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -0
- package/dist/{-Z4LCTGQR.js → -AN4MKOOO.js} +9 -9
- package/dist/{chunk-BAJVZXC7.cjs → chunk-2FNQN23O.cjs} +3 -3
- package/dist/chunk-2FNQN23O.cjs.map +1 -0
- package/dist/{chunk-WLZX2HTC.js → chunk-34IBS3JN.js} +3 -3
- package/dist/{chunk-6WYMV73J.js → chunk-4EJLRZ7A.js} +50 -16
- package/dist/chunk-4EJLRZ7A.js.map +1 -0
- package/dist/{chunk-KATZTHWA.cjs → chunk-4SIKWOLQ.cjs} +2 -2
- package/dist/chunk-4SIKWOLQ.cjs.map +1 -0
- package/dist/{chunk-OOT54JF2.js → chunk-7UUQXASL.js} +2 -2
- package/dist/{chunk-OOT54JF2.js.map → chunk-7UUQXASL.js.map} +1 -1
- package/dist/{chunk-LJP3PK2S.js → chunk-AOTA4XTU.js} +2 -2
- package/dist/{chunk-LUY46O7O.js → chunk-B4MQXOU5.js} +2 -2
- package/dist/chunk-DCZVOIEO.cjs.map +1 -1
- package/dist/{chunk-JHPEDWJX.js → chunk-EWUFLCRP.js} +3 -3
- package/dist/{chunk-OYQL3D4B.js → chunk-F3OPGGQ2.js} +2 -2
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/{chunk-PIUPP3FL.js → chunk-HO7N6T36.js} +3 -3
- package/dist/{chunk-PKCDYIIJ.js → chunk-JAY6BXZ6.js} +2 -2
- package/dist/{chunk-TK7WUS47.js → chunk-KEF4UQYI.js} +2 -2
- package/dist/{chunk-XINP35F4.js → chunk-N3DLQ2YH.js} +1 -1
- package/dist/{chunk-XINP35F4.js.map → chunk-N3DLQ2YH.js.map} +1 -1
- package/dist/{chunk-GL6BCNJV.js → chunk-NE7GR65O.js} +3 -3
- package/dist/{chunk-5ZPXRDS2.js → chunk-NMXDXHHW.js} +2 -2
- package/dist/{chunk-5ZPXRDS2.js.map → chunk-NMXDXHHW.js.map} +1 -1
- package/dist/{chunk-BN33O25L.js → chunk-ONQHGZTS.js} +1 -1
- package/dist/{chunk-BN33O25L.js.map → chunk-ONQHGZTS.js.map} +1 -1
- package/dist/{chunk-NIQ4JCQF.cjs → chunk-OQNZCCJI.cjs} +6 -6
- package/dist/chunk-OQNZCCJI.cjs.map +1 -0
- package/dist/{chunk-Y7QB4IB6.js → chunk-PDXRLQD6.js} +2 -2
- package/dist/{chunk-NOEYLJGJ.js → chunk-QYXQJPB7.js} +3 -3
- package/dist/{chunk-NIBRVLGS.js → chunk-SV2YYPBO.js} +3 -3
- package/dist/{chunk-L5CDTOC3.cjs → chunk-T7GRHAIW.cjs} +1 -1
- package/dist/chunk-T7GRHAIW.cjs.map +1 -0
- package/dist/{chunk-V3Q6I2AQ.cjs → chunk-V7F5765M.cjs} +4 -4
- package/dist/chunk-V7F5765M.cjs.map +1 -0
- package/dist/{chunk-VYGNPB2X.js → chunk-VR3ECURZ.js} +2 -2
- package/dist/{chunk-LKZQ4564.js → chunk-WLUDCIOK.js} +2 -2
- package/dist/{chunk-LREEDIEF.js → chunk-YVPYCQOG.js} +2 -2
- package/dist/{chunk-SHBVD23C.cjs → chunk-ZOLKTMBS.cjs} +11 -11
- package/dist/chunk-ZOLKTMBS.cjs.map +1 -0
- package/dist/chunks-JUBR2TW7.js +10 -0
- package/dist/cli.js +37 -33
- package/dist/cli.js.map +1 -1
- package/dist/{formula-JVBJ6QRG.cjs → formula-4QA6ZSFP.cjs} +9 -9
- package/dist/formula-4QA6ZSFP.cjs.map +1 -0
- package/dist/{formula-LFWZG7T7.js → formula-LFDXPFQH.js} +4 -4
- package/dist/{formula-77TJPACH.js → formula-UYS7Z7IH.js} +3 -3
- package/dist/{image-ocr-YZ56O63S.js → image-ocr-3YP5I2H4.js} +6 -6
- package/dist/{image-ocr-6SY623KL.js → image-ocr-NOU6O7ZY.js} +8 -8
- package/dist/{image-ocr-YTGAUHEP.cjs → image-ocr-POPCJGL5.cjs} +12 -12
- package/dist/image-ocr-POPCJGL5.cjs.map +1 -0
- package/dist/index.cjs +222 -189
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +45 -12
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +16 -16
- package/dist/{model-bundle-W7B3BIYS.js → model-bundle-AUKJF6GA.js} +5 -5
- package/dist/{models-FUKPEVPE.js → models-QKSQSUWJ.js} +5 -5
- package/dist/page-range-P7SDW6LR.cjs.map +1 -1
- package/dist/{parser-6UL2HLDH.js → parser-6HKVNDZM.js} +7 -7
- package/dist/{parser-WIRWVN5E.cjs → parser-VAIMONF2.cjs} +27 -27
- package/dist/parser-VAIMONF2.cjs.map +1 -0
- package/dist/{parser-GDYZDBZI.js → parser-VVGAZIAX.js} +7 -7
- package/dist/pdf-ocr-4CWHKKTX.cjs +14 -0
- package/dist/pdf-ocr-4CWHKKTX.cjs.map +1 -0
- package/dist/pdf-ocr-D6HR23OB.js +13 -0
- package/dist/pdf-ocr-WIMNTEVH.js +16 -0
- package/dist/{profile-io-4EE64K6Y.js → profile-io-PYCSBITE.js} +3 -3
- package/dist/{rasterize-QW7SSKHB.js → rasterize-TUBHYALD.js} +2 -2
- package/dist/render-QW5Z4IMW.js +10 -0
- package/dist/seal-OTOP5CLA.js +10 -0
- package/dist/{setup-JS7E2HFM.js → setup-6EUKBDMC.js} +3 -3
- package/dist/{watch-YISVPGW3.js → watch-JVGXPTCI.js} +10 -10
- package/package.json +1 -1
- package/dist/chunk-6WYMV73J.js.map +0 -1
- package/dist/chunk-BAJVZXC7.cjs.map +0 -1
- package/dist/chunk-KATZTHWA.cjs.map +0 -1
- package/dist/chunk-L5CDTOC3.cjs.map +0 -1
- package/dist/chunk-NIQ4JCQF.cjs.map +0 -1
- package/dist/chunk-SHBVD23C.cjs.map +0 -1
- package/dist/chunk-V3Q6I2AQ.cjs.map +0 -1
- package/dist/chunks-TRJGNO4N.js +0 -10
- package/dist/formula-JVBJ6QRG.cjs.map +0 -1
- package/dist/image-ocr-YTGAUHEP.cjs.map +0 -1
- package/dist/parser-WIRWVN5E.cjs.map +0 -1
- package/dist/pdf-ocr-O373AAN6.cjs +0 -14
- package/dist/pdf-ocr-O373AAN6.cjs.map +0 -1
- package/dist/pdf-ocr-OHUAQQMN.js +0 -16
- package/dist/pdf-ocr-XTE234WC.js +0 -13
- package/dist/render-2NID54BX.js +0 -10
- package/dist/seal-PTP4TWYR.js +0 -10
- /package/dist/{-Z4LCTGQR.js.map → -AN4MKOOO.js.map} +0 -0
- /package/dist/{chunk-WLZX2HTC.js.map → chunk-34IBS3JN.js.map} +0 -0
- /package/dist/{chunk-LJP3PK2S.js.map → chunk-AOTA4XTU.js.map} +0 -0
- /package/dist/{chunk-LUY46O7O.js.map → chunk-B4MQXOU5.js.map} +0 -0
- /package/dist/{chunk-JHPEDWJX.js.map → chunk-EWUFLCRP.js.map} +0 -0
- /package/dist/{chunk-OYQL3D4B.js.map → chunk-F3OPGGQ2.js.map} +0 -0
- /package/dist/{chunk-PIUPP3FL.js.map → chunk-HO7N6T36.js.map} +0 -0
- /package/dist/{chunk-PKCDYIIJ.js.map → chunk-JAY6BXZ6.js.map} +0 -0
- /package/dist/{chunk-TK7WUS47.js.map → chunk-KEF4UQYI.js.map} +0 -0
- /package/dist/{chunk-GL6BCNJV.js.map → chunk-NE7GR65O.js.map} +0 -0
- /package/dist/{chunk-Y7QB4IB6.js.map → chunk-PDXRLQD6.js.map} +0 -0
- /package/dist/{chunk-NOEYLJGJ.js.map → chunk-QYXQJPB7.js.map} +0 -0
- /package/dist/{chunk-NIBRVLGS.js.map → chunk-SV2YYPBO.js.map} +0 -0
- /package/dist/{chunk-VYGNPB2X.js.map → chunk-VR3ECURZ.js.map} +0 -0
- /package/dist/{chunk-LKZQ4564.js.map → chunk-WLUDCIOK.js.map} +0 -0
- /package/dist/{chunk-LREEDIEF.js.map → chunk-YVPYCQOG.js.map} +0 -0
- /package/dist/{chunks-TRJGNO4N.js.map → chunks-JUBR2TW7.js.map} +0 -0
- /package/dist/{formula-LFWZG7T7.js.map → formula-LFDXPFQH.js.map} +0 -0
- /package/dist/{formula-77TJPACH.js.map → formula-UYS7Z7IH.js.map} +0 -0
- /package/dist/{image-ocr-YZ56O63S.js.map → image-ocr-3YP5I2H4.js.map} +0 -0
- /package/dist/{image-ocr-6SY623KL.js.map → image-ocr-NOU6O7ZY.js.map} +0 -0
- /package/dist/{model-bundle-W7B3BIYS.js.map → model-bundle-AUKJF6GA.js.map} +0 -0
- /package/dist/{models-FUKPEVPE.js.map → models-QKSQSUWJ.js.map} +0 -0
- /package/dist/{parser-6UL2HLDH.js.map → parser-6HKVNDZM.js.map} +0 -0
- /package/dist/{parser-GDYZDBZI.js.map → parser-VVGAZIAX.js.map} +0 -0
- /package/dist/{pdf-ocr-OHUAQQMN.js.map → pdf-ocr-D6HR23OB.js.map} +0 -0
- /package/dist/{pdf-ocr-XTE234WC.js.map → pdf-ocr-WIMNTEVH.js.map} +0 -0
- /package/dist/{profile-io-4EE64K6Y.js.map → profile-io-PYCSBITE.js.map} +0 -0
- /package/dist/{rasterize-QW7SSKHB.js.map → rasterize-TUBHYALD.js.map} +0 -0
- /package/dist/{render-2NID54BX.js.map → render-QW5Z4IMW.js.map} +0 -0
- /package/dist/{seal-PTP4TWYR.js.map → seal-OTOP5CLA.js.map} +0 -0
- /package/dist/{setup-JS7E2HFM.js.map → setup-6EUKBDMC.js.map} +0 -0
- /package/dist/{watch-YISVPGW3.js.map → watch-JVGXPTCI.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkV7F5765Mcjs = require('./chunk-V7F5765M.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
@@ -16,7 +16,7 @@ var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkT7GRHAIWcjs = require('./chunk-T7GRHAIW.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -29,7 +29,7 @@ var _chunkL5CDTOC3cjs = require('./chunk-L5CDTOC3.cjs');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunk4SIKWOLQcjs = require('./chunk-4SIKWOLQ.cjs');
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -484,7 +484,7 @@ function rawTextContent(node, depth = 0) {
|
|
|
484
484
|
// src/hwpx/parser-shared.ts
|
|
485
485
|
var MAX_DECOMPRESS_SIZE = 256 * 1024 * 1024;
|
|
486
486
|
var MAX_ZIP_ENTRIES = 500;
|
|
487
|
-
var ZipBombError = class extends
|
|
487
|
+
var ZipBombError = class extends _chunk4SIKWOLQcjs.KordocError {
|
|
488
488
|
constructor(message) {
|
|
489
489
|
super(message);
|
|
490
490
|
this.name = "ZipBombError";
|
|
@@ -504,7 +504,7 @@ function createSectionShared() {
|
|
|
504
504
|
function createXmlParser(warnings) {
|
|
505
505
|
return new (0, _xmldom.DOMParser)({
|
|
506
506
|
onError(level, msg2) {
|
|
507
|
-
if (level === "fatalError") throw new (0,
|
|
507
|
+
if (level === "fatalError") throw new (0, _chunk4SIKWOLQcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
508
508
|
_optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
509
509
|
}
|
|
510
510
|
});
|
|
@@ -539,13 +539,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
539
539
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
540
540
|
const checksumType = attrOf(inner, "checksum-type");
|
|
541
541
|
if (algorithm !== AES256_CBC) {
|
|
542
|
-
throw new (0,
|
|
542
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
543
543
|
}
|
|
544
544
|
if (startKey !== START_KEY_SHA256) {
|
|
545
|
-
throw new (0,
|
|
545
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
546
546
|
}
|
|
547
547
|
if (!_optionalChain([checksumType, 'optionalAccess', _8 => _8.endsWith, 'call', _9 => _9(CHECKSUM_SHA256_1K)])) {
|
|
548
|
-
throw new (0,
|
|
548
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
549
549
|
}
|
|
550
550
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
551
551
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -553,10 +553,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
553
553
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
554
554
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
555
555
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
556
|
-
throw new (0,
|
|
556
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
557
557
|
}
|
|
558
558
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
559
|
-
throw new (0,
|
|
559
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
560
560
|
}
|
|
561
561
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
562
562
|
}
|
|
@@ -589,11 +589,11 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
589
589
|
for (const entry of entries) {
|
|
590
590
|
const file = zip.file(entry.path);
|
|
591
591
|
if (!file) {
|
|
592
|
-
throw new (0,
|
|
592
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
593
593
|
}
|
|
594
594
|
const plain2 = decryptEntry(await file.async("nodebuffer"), entry, startKey);
|
|
595
595
|
if (!plain2) {
|
|
596
|
-
throw new (0,
|
|
596
|
+
throw new (0, _chunk4SIKWOLQcjs.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.");
|
|
597
597
|
}
|
|
598
598
|
decrypted.push({ path: entry.path, plain: plain2 });
|
|
599
599
|
}
|
|
@@ -641,10 +641,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
641
641
|
const xml = await file.async("text");
|
|
642
642
|
if (decompressed) {
|
|
643
643
|
decompressed.total += xml.length * 2;
|
|
644
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
644
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk4SIKWOLQcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
645
645
|
}
|
|
646
646
|
const parser = createXmlParser();
|
|
647
|
-
const doc = parser.parseFromString(
|
|
647
|
+
const doc = parser.parseFromString(_chunk4SIKWOLQcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
648
648
|
if (!doc.documentElement) continue;
|
|
649
649
|
const domDoc = doc;
|
|
650
650
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -833,9 +833,9 @@ function detectHwpxHeadings(blocks, styleMap) {
|
|
|
833
833
|
let level = 0;
|
|
834
834
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _16 => _16.style, 'optionalAccess', _17 => _17.fontSize])) {
|
|
835
835
|
const ratio = block.style.fontSize / baseFontSize;
|
|
836
|
-
if (ratio >=
|
|
837
|
-
else if (ratio >=
|
|
838
|
-
else if (ratio >=
|
|
836
|
+
if (ratio >= _chunkT7GRHAIWcjs.HEADING_RATIO_H1) level = 1;
|
|
837
|
+
else if (ratio >= _chunkT7GRHAIWcjs.HEADING_RATIO_H2) level = 2;
|
|
838
|
+
else if (ratio >= _chunkT7GRHAIWcjs.HEADING_RATIO_H3) level = 3;
|
|
839
839
|
}
|
|
840
840
|
const compactText = text.replace(/\s+/g, "");
|
|
841
841
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1428,7 +1428,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1428
1428
|
|
|
1429
1429
|
// src/hwpx/table-build.ts
|
|
1430
1430
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1431
|
-
const table2 =
|
|
1431
|
+
const table2 = _chunkV7F5765Mcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1432
1432
|
if (state.caption) table2.caption = state.caption;
|
|
1433
1433
|
if (_optionalChain([state, 'access', _21 => _21.captionBlocks, 'optionalAccess', _22 => _22.length])) table2.captionBlocks = state.captionBlocks;
|
|
1434
1434
|
const anchors = [];
|
|
@@ -1499,7 +1499,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1499
1499
|
const cell2 = parentTable.cell;
|
|
1500
1500
|
(cell2.blocks ??= []).push(block);
|
|
1501
1501
|
cell2.hasStructure = true;
|
|
1502
|
-
let flat =
|
|
1502
|
+
let flat = _chunkV7F5765Mcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1503
1503
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1504
1504
|
if (flat) {
|
|
1505
1505
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -1642,7 +1642,7 @@ function detectHwpxSectionPages(root) {
|
|
|
1642
1642
|
// src/hwpx/section-walker.ts
|
|
1643
1643
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
1644
1644
|
const parser = createXmlParser(warnings);
|
|
1645
|
-
const doc = parser.parseFromString(
|
|
1645
|
+
const doc = parser.parseFromString(_chunk4SIKWOLQcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
1646
1646
|
if (!doc.documentElement) return [];
|
|
1647
1647
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
1648
1648
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -1756,8 +1756,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1756
1756
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
1757
1757
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
1758
1758
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
1759
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
1760
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
1759
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunkV7F5765Mcjs.MAX_COLS);
|
|
1760
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkV7F5765Mcjs.MAX_ROWS);
|
|
1761
1761
|
}
|
|
1762
1762
|
break;
|
|
1763
1763
|
case "p": {
|
|
@@ -2030,7 +2030,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
2030
2030
|
const sink = [];
|
|
2031
2031
|
const st = { rows: [], currentRow: [], cell: null };
|
|
2032
2032
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2033
|
-
let flat =
|
|
2033
|
+
let flat = _chunkV7F5765Mcjs.convertTableToText.call(void 0, st.rows);
|
|
2034
2034
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2035
2035
|
const built = [];
|
|
2036
2036
|
completeTable(st, [], built, ctx);
|
|
@@ -2185,7 +2185,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2185
2185
|
let url = (ch.textContent || "").trim();
|
|
2186
2186
|
if (!url) continue;
|
|
2187
2187
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2188
|
-
const safe =
|
|
2188
|
+
const safe = _chunk4SIKWOLQcjs.sanitizeHref.call(void 0, url);
|
|
2189
2189
|
if (safe) return safe;
|
|
2190
2190
|
}
|
|
2191
2191
|
return void 0;
|
|
@@ -2345,7 +2345,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2345
2345
|
case "hyperlink": {
|
|
2346
2346
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2347
2347
|
if (url) {
|
|
2348
|
-
const safe =
|
|
2348
|
+
const safe = _chunk4SIKWOLQcjs.sanitizeHref.call(void 0, url);
|
|
2349
2349
|
if (safe) href = safe;
|
|
2350
2350
|
}
|
|
2351
2351
|
walk(child, depth + 1);
|
|
@@ -2628,7 +2628,7 @@ function decompressStream(data) {
|
|
|
2628
2628
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
2629
2629
|
}
|
|
2630
2630
|
function parseFileHeader(data) {
|
|
2631
|
-
if (data.length < 40) throw new (0,
|
|
2631
|
+
if (data.length < 40) throw new (0, _chunk4SIKWOLQcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
2632
2632
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
2633
2633
|
return {
|
|
2634
2634
|
signature: sig,
|
|
@@ -2930,7 +2930,7 @@ function resolveImageBlocks(binDataMap, blocks, warnings, sweepUnreferenced) {
|
|
|
2930
2930
|
const ext = mime.includes("jpeg") ? "jpg" : mime.includes("png") ? "png" : mime.includes("gif") ? "gif" : mime.includes("bmp") ? "bmp" : "bin";
|
|
2931
2931
|
img = { filename: `image_${String(imageIndex).padStart(3, "0")}.${ext}`, data: new Uint8Array(bin.data), mime };
|
|
2932
2932
|
resolved.set(storageId, img);
|
|
2933
|
-
images.push({ filename: img.filename, data: img.data, mimeType: img.mime });
|
|
2933
|
+
images.push({ filename: img.filename, data: img.data, mimeType: img.mime, source: bin.name });
|
|
2934
2934
|
renamed.set(storageId, img.filename);
|
|
2935
2935
|
}
|
|
2936
2936
|
}
|
|
@@ -2954,7 +2954,7 @@ function resolveImageBlocks(binDataMap, blocks, warnings, sweepUnreferenced) {
|
|
|
2954
2954
|
const ext = mime.includes("jpeg") ? "jpg" : mime.includes("png") ? "png" : mime.includes("gif") ? "gif" : mime.includes("bmp") ? "bmp" : "bin";
|
|
2955
2955
|
const filename = `image_${String(imageIndex).padStart(3, "0")}.${ext}`;
|
|
2956
2956
|
const data = new Uint8Array(bin.data);
|
|
2957
|
-
images.push({ filename, data, mimeType: mime });
|
|
2957
|
+
images.push({ filename, data, mimeType: mime, source: bin.name });
|
|
2958
2958
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType: mime, filename: bin.name } });
|
|
2959
2959
|
}
|
|
2960
2960
|
}
|
|
@@ -3080,23 +3080,23 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3080
3080
|
}
|
|
3081
3081
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3082
3082
|
for (const path of allCandidates) {
|
|
3083
|
-
if (
|
|
3083
|
+
if (_chunk4SIKWOLQcjs.isPathTraversal.call(void 0, path)) continue;
|
|
3084
3084
|
const file = zip.file(path);
|
|
3085
3085
|
if (!file) continue;
|
|
3086
3086
|
try {
|
|
3087
3087
|
const data = await file.async("uint8array");
|
|
3088
3088
|
decompressed.total += data.length;
|
|
3089
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3089
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk4SIKWOLQcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3090
3090
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3091
3091
|
const mimeType = imageExtToMime(ext);
|
|
3092
3092
|
imageIndex++;
|
|
3093
3093
|
const filename2 = `image_${String(imageIndex).padStart(3, "0")}.${mimeToExt(mimeType)}`;
|
|
3094
|
-
img = { filename: filename2, data, mimeType };
|
|
3094
|
+
img = { filename: filename2, data, mimeType, source: path };
|
|
3095
3095
|
images.push(img);
|
|
3096
3096
|
usedPaths.add(path);
|
|
3097
3097
|
break;
|
|
3098
3098
|
} catch (err) {
|
|
3099
|
-
if (err instanceof
|
|
3099
|
+
if (err instanceof _chunk4SIKWOLQcjs.KordocError) throw err;
|
|
3100
3100
|
}
|
|
3101
3101
|
}
|
|
3102
3102
|
if (!img) _optionalChain([warnings, 'optionalAccess', _84 => _84.push, 'call', _85 => _85({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
@@ -3116,11 +3116,11 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3116
3116
|
if (sweepUnreferenced) {
|
|
3117
3117
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3118
3118
|
for (const file of binEntries) {
|
|
3119
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3119
|
+
if (file.dir || usedPaths.has(file.name) || _chunk4SIKWOLQcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3120
3120
|
try {
|
|
3121
3121
|
const data = await file.async("uint8array");
|
|
3122
3122
|
decompressed.total += data.length;
|
|
3123
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3123
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk4SIKWOLQcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3124
3124
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3125
3125
|
let mimeType = imageExtToMime(ext);
|
|
3126
3126
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3130,11 +3130,11 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3130
3130
|
}
|
|
3131
3131
|
imageIndex++;
|
|
3132
3132
|
const filename = `image_${String(imageIndex).padStart(3, "0")}.${mimeToExt(mimeType)}`;
|
|
3133
|
-
const img = { filename, data, mimeType };
|
|
3133
|
+
const img = { filename, data, mimeType, source: file.name };
|
|
3134
3134
|
images.push(img);
|
|
3135
3135
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3136
3136
|
} catch (err) {
|
|
3137
|
-
if (err instanceof
|
|
3137
|
+
if (err instanceof _chunk4SIKWOLQcjs.KordocError) throw err;
|
|
3138
3138
|
_optionalChain([warnings, 'optionalAccess', _86 => _86.push, 'call', _87 => _87({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3139
3139
|
}
|
|
3140
3140
|
}
|
|
@@ -3185,7 +3185,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3185
3185
|
}
|
|
3186
3186
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3187
3187
|
const name = new TextDecoder().decode(nameBytes);
|
|
3188
|
-
if (
|
|
3188
|
+
if (_chunk4SIKWOLQcjs.isPathTraversal.call(void 0, name)) {
|
|
3189
3189
|
pos = fileStart + compSize;
|
|
3190
3190
|
continue;
|
|
3191
3191
|
}
|
|
@@ -3203,7 +3203,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3203
3203
|
continue;
|
|
3204
3204
|
}
|
|
3205
3205
|
totalDecompressed += content.length * 2;
|
|
3206
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3206
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunk4SIKWOLQcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3207
3207
|
sectionNum++;
|
|
3208
3208
|
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3209
3209
|
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
@@ -3212,9 +3212,9 @@ function extractFromBrokenZip(buffer) {
|
|
|
3212
3212
|
continue;
|
|
3213
3213
|
}
|
|
3214
3214
|
}
|
|
3215
|
-
if (blocks.length === 0) throw new (0,
|
|
3215
|
+
if (blocks.length === 0) throw new (0, _chunk4SIKWOLQcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3216
3216
|
applyPageText(blocks, shared);
|
|
3217
|
-
const markdown =
|
|
3217
|
+
const markdown = _chunkV7F5765Mcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3218
3218
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3219
3219
|
}
|
|
3220
3220
|
async function readKordocLayout(zip) {
|
|
@@ -3239,18 +3239,18 @@ async function resolveSectionPaths(zip) {
|
|
|
3239
3239
|
if (paths.length > 0) return paths;
|
|
3240
3240
|
}
|
|
3241
3241
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3242
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3242
|
+
return sectionFiles.map((f) => f.name).sort(_chunk4SIKWOLQcjs.compareSectionPaths);
|
|
3243
3243
|
}
|
|
3244
3244
|
function parseSectionPathsFromManifest(xml) {
|
|
3245
3245
|
const parser = createXmlParser();
|
|
3246
|
-
const doc = parser.parseFromString(
|
|
3246
|
+
const doc = parser.parseFromString(_chunk4SIKWOLQcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3247
3247
|
const items = doc.getElementsByTagName("opf:item");
|
|
3248
3248
|
const spine = doc.getElementsByTagName("opf:itemref");
|
|
3249
3249
|
const idToHref = /* @__PURE__ */ new Map();
|
|
3250
3250
|
for (let i = 0; i < items.length; i++) {
|
|
3251
3251
|
const item = items[i];
|
|
3252
3252
|
const id = item.getAttribute("id") || "";
|
|
3253
|
-
const href =
|
|
3253
|
+
const href = _chunk4SIKWOLQcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3254
3254
|
if (id && href) idToHref.set(id, href);
|
|
3255
3255
|
}
|
|
3256
3256
|
if (spine.length > 0) {
|
|
@@ -3261,7 +3261,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3261
3261
|
}
|
|
3262
3262
|
if (ordered.length > 0) return ordered;
|
|
3263
3263
|
}
|
|
3264
|
-
return Array.from(idToHref.values()).sort(
|
|
3264
|
+
return Array.from(idToHref.values()).sort(_chunk4SIKWOLQcjs.compareSectionPaths);
|
|
3265
3265
|
}
|
|
3266
3266
|
|
|
3267
3267
|
// src/hwpx/metadata.ts
|
|
@@ -3274,7 +3274,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3274
3274
|
const xml = await file.async("text");
|
|
3275
3275
|
if (decompressed) {
|
|
3276
3276
|
decompressed.total += xml.length * 2;
|
|
3277
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3277
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk4SIKWOLQcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3278
3278
|
}
|
|
3279
3279
|
parseDublinCoreMetadata(xml, metadata);
|
|
3280
3280
|
if (metadata.title || metadata.author) return;
|
|
@@ -3284,7 +3284,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3284
3284
|
}
|
|
3285
3285
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3286
3286
|
const parser = createXmlParser();
|
|
3287
|
-
const doc = parser.parseFromString(
|
|
3287
|
+
const doc = parser.parseFromString(_chunk4SIKWOLQcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3288
3288
|
if (!doc.documentElement) return;
|
|
3289
3289
|
const getText = (tagNames) => {
|
|
3290
3290
|
for (const tag of tagNames) {
|
|
@@ -3309,7 +3309,7 @@ function parseDublinCoreMetadata(xml, metadata) {
|
|
|
3309
3309
|
|
|
3310
3310
|
// src/hwpx/parser.ts
|
|
3311
3311
|
async function parseHwpxDocument(buffer, options) {
|
|
3312
|
-
|
|
3312
|
+
_chunk4SIKWOLQcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3313
3313
|
let zip;
|
|
3314
3314
|
try {
|
|
3315
3315
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3318,7 +3318,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3318
3318
|
}
|
|
3319
3319
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3320
3320
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3321
|
-
throw new (0,
|
|
3321
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3322
3322
|
}
|
|
3323
3323
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3324
3324
|
if (manifestFile) {
|
|
@@ -3333,7 +3333,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3333
3333
|
return comResultToParseResult(pages, pageCount, warnings2);
|
|
3334
3334
|
}
|
|
3335
3335
|
}
|
|
3336
|
-
throw new (0,
|
|
3336
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(
|
|
3337
3337
|
"\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."
|
|
3338
3338
|
);
|
|
3339
3339
|
}
|
|
@@ -3345,7 +3345,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3345
3345
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3346
3346
|
const warnings = [];
|
|
3347
3347
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3348
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3348
|
+
if (sectionPaths.length === 0) throw new (0, _chunk4SIKWOLQcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3349
3349
|
let allBlocks = [];
|
|
3350
3350
|
const shared = createSectionShared();
|
|
3351
3351
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
@@ -3390,7 +3390,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3390
3390
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _102 => _102.pages]));
|
|
3391
3391
|
detectHwpxHeadings(blocks, styleMap);
|
|
3392
3392
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3393
|
-
const markdown =
|
|
3393
|
+
const markdown = _chunkV7F5765Mcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3394
3394
|
return { markdown, blocks, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
|
|
3395
3395
|
}
|
|
3396
3396
|
|
|
@@ -4390,7 +4390,7 @@ function decryptPasswordStream(raw, password) {
|
|
|
4390
4390
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4391
4391
|
var TAG_ID_MAPPINGS = 17;
|
|
4392
4392
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4393
|
-
const wrong = () => new (0,
|
|
4393
|
+
const wrong = () => new (0, _chunk4SIKWOLQcjs.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.");
|
|
4394
4394
|
let records;
|
|
4395
4395
|
try {
|
|
4396
4396
|
records = readRecords3(data);
|
|
@@ -4402,7 +4402,7 @@ function assertDecryptedDocInfo(data, readRecords3) {
|
|
|
4402
4402
|
}
|
|
4403
4403
|
function assertSupportedEncryptVersion(version) {
|
|
4404
4404
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4405
|
-
throw new (0,
|
|
4405
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(
|
|
4406
4406
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4407
4407
|
);
|
|
4408
4408
|
}
|
|
@@ -4591,7 +4591,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
4591
4591
|
lenientCfb = parseLenientCfb(buffer);
|
|
4592
4592
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
4593
4593
|
} catch (e24) {
|
|
4594
|
-
throw new (0,
|
|
4594
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
4595
4595
|
}
|
|
4596
4596
|
}
|
|
4597
4597
|
const readRawStream = (path) => {
|
|
@@ -4602,14 +4602,14 @@ function parseHwp5Document(buffer, options) {
|
|
|
4602
4602
|
return lenientCfb.findStream(path);
|
|
4603
4603
|
};
|
|
4604
4604
|
const headerData = readRawStream("/FileHeader");
|
|
4605
|
-
if (!headerData) throw new (0,
|
|
4605
|
+
if (!headerData) throw new (0, _chunk4SIKWOLQcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
4606
4606
|
const header = parseFileHeader(headerData);
|
|
4607
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
4608
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
4607
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunk4SIKWOLQcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
4608
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunk4SIKWOLQcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
4609
4609
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
4610
4610
|
if (encrypted) {
|
|
4611
4611
|
if (!_optionalChain([options, 'optionalAccess', _106 => _106.password])) {
|
|
4612
|
-
throw new (0,
|
|
4612
|
+
throw new (0, _chunk4SIKWOLQcjs.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.");
|
|
4613
4613
|
}
|
|
4614
4614
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
4615
4615
|
}
|
|
@@ -4627,18 +4627,18 @@ function parseHwp5Document(buffer, options) {
|
|
|
4627
4627
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
4628
4628
|
if (encrypted) {
|
|
4629
4629
|
const rawDocInfo = findStream("/DocInfo");
|
|
4630
|
-
if (!rawDocInfo) throw new (0,
|
|
4630
|
+
if (!rawDocInfo) throw new (0, _chunk4SIKWOLQcjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
4631
4631
|
let docInfoData;
|
|
4632
4632
|
try {
|
|
4633
4633
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
4634
4634
|
} catch (e25) {
|
|
4635
|
-
throw new (0,
|
|
4635
|
+
throw new (0, _chunk4SIKWOLQcjs.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.");
|
|
4636
4636
|
}
|
|
4637
4637
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
4638
4638
|
}
|
|
4639
4639
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
4640
4640
|
const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : encrypted ? findSectionsVia(findStream) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
|
|
4641
|
-
if (sections.length === 0) throw new (0,
|
|
4641
|
+
if (sections.length === 0) throw new (0, _chunk4SIKWOLQcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
4642
4642
|
const sectionRecords = [];
|
|
4643
4643
|
const sectionDetects = [];
|
|
4644
4644
|
let totalDecompressed = 0;
|
|
@@ -4646,12 +4646,12 @@ function parseHwp5Document(buffer, options) {
|
|
|
4646
4646
|
try {
|
|
4647
4647
|
const data = !distribution && compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
4648
4648
|
totalDecompressed += data.length;
|
|
4649
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4649
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk4SIKWOLQcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4650
4650
|
const records = readRecords(data);
|
|
4651
4651
|
sectionRecords.push(records);
|
|
4652
4652
|
sectionDetects.push(detectHwp5SectionPages(records));
|
|
4653
4653
|
} catch (secErr) {
|
|
4654
|
-
if (secErr instanceof
|
|
4654
|
+
if (secErr instanceof _chunk4SIKWOLQcjs.KordocError) throw secErr;
|
|
4655
4655
|
sectionRecords.push(null);
|
|
4656
4656
|
sectionDetects.push(null);
|
|
4657
4657
|
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" });
|
|
@@ -4687,7 +4687,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
4687
4687
|
parsedSections++;
|
|
4688
4688
|
_optionalChain([options, 'optionalAccess', _110 => _110.onProgress, 'optionalCall', _111 => _111(parsedSections, sections.length)]);
|
|
4689
4689
|
} catch (secErr) {
|
|
4690
|
-
if (secErr instanceof
|
|
4690
|
+
if (secErr instanceof _chunk4SIKWOLQcjs.KordocError) throw secErr;
|
|
4691
4691
|
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" });
|
|
4692
4692
|
} finally {
|
|
4693
4693
|
pageBase += detect.pages;
|
|
@@ -4698,9 +4698,9 @@ function parseHwp5Document(buffer, options) {
|
|
|
4698
4698
|
}
|
|
4699
4699
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
4700
4700
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter);
|
|
4701
|
-
let flatBlocks =
|
|
4701
|
+
let flatBlocks = _chunkV7F5765Mcjs.flattenLayoutTables.call(void 0, blocks);
|
|
4702
4702
|
if (_optionalChain([options, 'optionalAccess', _112 => _112.dedupeRunningHeaders])) {
|
|
4703
|
-
const deduped =
|
|
4703
|
+
const deduped = _chunkV7F5765Mcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
4704
4704
|
const removed = flatBlocks.length - deduped.length;
|
|
4705
4705
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
4706
4706
|
flatBlocks = deduped;
|
|
@@ -4709,10 +4709,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
4709
4709
|
detectHwp5Headings(flatBlocks, docInfo);
|
|
4710
4710
|
}
|
|
4711
4711
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4712
|
-
let markdown =
|
|
4712
|
+
let markdown = _chunkV7F5765Mcjs.blocksToMarkdown.call(void 0, flatBlocks);
|
|
4713
4713
|
if (_optionalChain([options, 'optionalAccess', _113 => _113.inlineImages]) && images.length > 0) {
|
|
4714
4714
|
try {
|
|
4715
|
-
markdown =
|
|
4715
|
+
markdown = _chunkV7F5765Mcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
4716
4716
|
} catch (inlineErr) {
|
|
4717
4717
|
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" });
|
|
4718
4718
|
}
|
|
@@ -4776,9 +4776,9 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4776
4776
|
let level = 0;
|
|
4777
4777
|
if (_optionalChain([block, 'access', _118 => _118.style, 'optionalAccess', _119 => _119.fontSize]) && baseFontSize > 0) {
|
|
4778
4778
|
const ratio = block.style.fontSize / baseFontSize;
|
|
4779
|
-
if (ratio >=
|
|
4780
|
-
else if (ratio >=
|
|
4781
|
-
else if (ratio >=
|
|
4779
|
+
if (ratio >= _chunkT7GRHAIWcjs.HEADING_RATIO_H1) level = 1;
|
|
4780
|
+
else if (ratio >= _chunkT7GRHAIWcjs.HEADING_RATIO_H2) level = 2;
|
|
4781
|
+
else if (ratio >= _chunkT7GRHAIWcjs.HEADING_RATIO_H3) level = 3;
|
|
4782
4782
|
}
|
|
4783
4783
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
4784
4784
|
if (level === 0) level = 2;
|
|
@@ -4872,7 +4872,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
4872
4872
|
if (!raw) break;
|
|
4873
4873
|
const content = compressed ? decompressStream(raw) : raw;
|
|
4874
4874
|
totalDecompressed += content.length;
|
|
4875
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4875
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk4SIKWOLQcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4876
4876
|
sections.push({ idx: i, content });
|
|
4877
4877
|
}
|
|
4878
4878
|
if (sections.length === 0) {
|
|
@@ -4884,7 +4884,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
4884
4884
|
if (raw) {
|
|
4885
4885
|
const content = compressed ? decompressStream(raw) : raw;
|
|
4886
4886
|
totalDecompressed += content.length;
|
|
4887
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4887
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk4SIKWOLQcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4888
4888
|
sections.push({ idx, content });
|
|
4889
4889
|
}
|
|
4890
4890
|
}
|
|
@@ -4901,7 +4901,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
4901
4901
|
try {
|
|
4902
4902
|
const content = decryptViewText(raw, compressed);
|
|
4903
4903
|
totalDecompressed += content.length;
|
|
4904
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4904
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk4SIKWOLQcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4905
4905
|
sections.push({ idx: i, content });
|
|
4906
4906
|
} catch (e30) {
|
|
4907
4907
|
break;
|
|
@@ -5018,7 +5018,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5018
5018
|
const ctrl = ctrls[r.ctrlIdx];
|
|
5019
5019
|
if (!_optionalChain([ctrl, 'optionalAccess', _126 => _126.href]) || r.end <= r.start) continue;
|
|
5020
5020
|
if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
|
|
5021
|
-
const href =
|
|
5021
|
+
const href = _chunk4SIKWOLQcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5022
5022
|
if (!href) continue;
|
|
5023
5023
|
const anchor = text.slice(r.start, r.end);
|
|
5024
5024
|
if (!anchor.trim()) continue;
|
|
@@ -5258,8 +5258,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5258
5258
|
let tableIdx = -1;
|
|
5259
5259
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5260
5260
|
if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
|
|
5261
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5262
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5261
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkV7F5765Mcjs.MAX_ROWS);
|
|
5262
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkV7F5765Mcjs.MAX_COLS);
|
|
5263
5263
|
tableIdx = i2;
|
|
5264
5264
|
break;
|
|
5265
5265
|
}
|
|
@@ -5308,7 +5308,7 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5308
5308
|
return table3;
|
|
5309
5309
|
}
|
|
5310
5310
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5311
|
-
const table2 =
|
|
5311
|
+
const table2 = _chunkV7F5765Mcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5312
5312
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5313
5313
|
return table2.rows > 0 ? table2 : null;
|
|
5314
5314
|
}
|
|
@@ -5325,8 +5325,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5325
5325
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5326
5326
|
const cs = rec.data.readUInt16LE(12);
|
|
5327
5327
|
const rs = rec.data.readUInt16LE(14);
|
|
5328
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5329
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5328
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkV7F5765Mcjs.MAX_COLS);
|
|
5329
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkV7F5765Mcjs.MAX_ROWS);
|
|
5330
5330
|
}
|
|
5331
5331
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5332
5332
|
const parts = [];
|
|
@@ -5336,7 +5336,7 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5336
5336
|
parts.push(``);
|
|
5337
5337
|
hasStructure = true;
|
|
5338
5338
|
} else if (b.type === "table" && b.table) {
|
|
5339
|
-
const flat =
|
|
5339
|
+
const flat = _chunkV7F5765Mcjs.convertTableToText.call(void 0, b.table.cells);
|
|
5340
5340
|
if (flat) parts.push(flat);
|
|
5341
5341
|
hasStructure = true;
|
|
5342
5342
|
} else if (b.text) {
|
|
@@ -17611,25 +17611,25 @@ function desEcbDecrypt(data, key) {
|
|
|
17611
17611
|
}
|
|
17612
17612
|
function readLayout(data) {
|
|
17613
17613
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
17614
|
-
throw new (0,
|
|
17614
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
17615
17615
|
}
|
|
17616
17616
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
17617
17617
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
17618
17618
|
if (payloadOffset >= data.length) {
|
|
17619
|
-
throw new (0,
|
|
17619
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
17620
17620
|
}
|
|
17621
17621
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
17622
17622
|
}
|
|
17623
17623
|
function decryptHwp3Document(input, password) {
|
|
17624
17624
|
const { payloadOffset, compressed } = readLayout(input);
|
|
17625
17625
|
if (!compressed) {
|
|
17626
|
-
throw new (0,
|
|
17626
|
+
throw new (0, _chunk4SIKWOLQcjs.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)");
|
|
17627
17627
|
}
|
|
17628
17628
|
const source = Buffer.from(input);
|
|
17629
17629
|
const payload = source.subarray(payloadOffset);
|
|
17630
17630
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
17631
17631
|
if (aligned.length === 0) {
|
|
17632
|
-
throw new (0,
|
|
17632
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
17633
17633
|
}
|
|
17634
17634
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
17635
17635
|
let inflated;
|
|
@@ -17637,14 +17637,14 @@ function decryptHwp3Document(input, password) {
|
|
|
17637
17637
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
17638
17638
|
} catch (err) {
|
|
17639
17639
|
if (_optionalChain([err, 'optionalAccess', _139 => _139.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
17640
|
-
throw new (0,
|
|
17640
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(
|
|
17641
17641
|
`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`
|
|
17642
17642
|
);
|
|
17643
17643
|
}
|
|
17644
|
-
throw new (0,
|
|
17644
|
+
throw new (0, _chunk4SIKWOLQcjs.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.");
|
|
17645
17645
|
}
|
|
17646
17646
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
17647
|
-
throw new (0,
|
|
17647
|
+
throw new (0, _chunk4SIKWOLQcjs.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.");
|
|
17648
17648
|
}
|
|
17649
17649
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
17650
17650
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -17679,7 +17679,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
17679
17679
|
let source = Buffer.from(buffer);
|
|
17680
17680
|
if (isEncryptedHwp3(source)) {
|
|
17681
17681
|
if (!_optionalChain([options, 'optionalAccess', _140 => _140.password])) {
|
|
17682
|
-
throw new (0,
|
|
17682
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(
|
|
17683
17683
|
"\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."
|
|
17684
17684
|
);
|
|
17685
17685
|
}
|
|
@@ -17696,10 +17696,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
17696
17696
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
17697
17697
|
} catch (err) {
|
|
17698
17698
|
if (_optionalChain([err, 'optionalAccess', _141 => _141.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
17699
|
-
throw new (0,
|
|
17699
|
+
throw new (0, _chunk4SIKWOLQcjs.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`);
|
|
17700
17700
|
}
|
|
17701
17701
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
17702
|
-
throw new (0,
|
|
17702
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
17703
17703
|
}
|
|
17704
17704
|
} else {
|
|
17705
17705
|
body = tail;
|
|
@@ -17941,7 +17941,7 @@ function getTextContent(el) {
|
|
|
17941
17941
|
return _nullishCoalesce(_optionalChain([el, 'access', _144 => _144.textContent, 'optionalAccess', _145 => _145.trim, 'call', _146 => _146()]), () => ( ""));
|
|
17942
17942
|
}
|
|
17943
17943
|
function parseXml(text) {
|
|
17944
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
17944
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunk4SIKWOLQcjs.stripDtd.call(void 0, text), "text/xml");
|
|
17945
17945
|
}
|
|
17946
17946
|
function collectRichText(root) {
|
|
17947
17947
|
let out = "";
|
|
@@ -18176,7 +18176,7 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
|
|
|
18176
18176
|
cellRows.push(row);
|
|
18177
18177
|
}
|
|
18178
18178
|
if (cellRows.length > 0) {
|
|
18179
|
-
const table2 =
|
|
18179
|
+
const table2 = _chunkV7F5765Mcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
18180
18180
|
if (table2.rows > 0) {
|
|
18181
18181
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
18182
18182
|
}
|
|
@@ -18184,12 +18184,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
|
|
|
18184
18184
|
return blocks;
|
|
18185
18185
|
}
|
|
18186
18186
|
async function parseXlsxDocument(buffer, options) {
|
|
18187
|
-
|
|
18187
|
+
_chunk4SIKWOLQcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
18188
18188
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
18189
18189
|
const warnings = [];
|
|
18190
18190
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
18191
18191
|
if (!workbookFile) {
|
|
18192
|
-
throw new (0,
|
|
18192
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18193
18193
|
}
|
|
18194
18194
|
let sharedStrings = [];
|
|
18195
18195
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -18198,7 +18198,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18198
18198
|
}
|
|
18199
18199
|
const { sheets, date1904 } = parseWorkbook(await workbookFile.async("text"));
|
|
18200
18200
|
if (sheets.length === 0) {
|
|
18201
|
-
throw new (0,
|
|
18201
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18202
18202
|
}
|
|
18203
18203
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
18204
18204
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -18282,7 +18282,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18282
18282
|
} catch (e32) {
|
|
18283
18283
|
}
|
|
18284
18284
|
}
|
|
18285
|
-
const markdown =
|
|
18285
|
+
const markdown = _chunkV7F5765Mcjs.blocksToMarkdown.call(void 0, blocks);
|
|
18286
18286
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
18287
18287
|
}
|
|
18288
18288
|
|
|
@@ -18733,11 +18733,11 @@ function processGlobals(records) {
|
|
|
18733
18733
|
const xfFmtIds = [];
|
|
18734
18734
|
const firstBof = records[0];
|
|
18735
18735
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
18736
|
-
throw new (0,
|
|
18736
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
18737
18737
|
}
|
|
18738
18738
|
const bof = decodeBof(firstBof.data);
|
|
18739
18739
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
18740
|
-
throw new (0,
|
|
18740
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
18741
18741
|
}
|
|
18742
18742
|
let i = 1;
|
|
18743
18743
|
while (i < records.length) {
|
|
@@ -18872,7 +18872,7 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex, keepAnchoredEmptyCols) {
|
|
|
18872
18872
|
cellRows.push(row);
|
|
18873
18873
|
}
|
|
18874
18874
|
if (cellRows.length > 0) {
|
|
18875
|
-
const table2 =
|
|
18875
|
+
const table2 = _chunkV7F5765Mcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
18876
18876
|
if (table2.rows > 0) {
|
|
18877
18877
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
18878
18878
|
}
|
|
@@ -18885,28 +18885,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18885
18885
|
try {
|
|
18886
18886
|
cfb = parseLenientCfb(buf);
|
|
18887
18887
|
} catch (e) {
|
|
18888
|
-
throw new (0,
|
|
18888
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(
|
|
18889
18889
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
18890
18890
|
);
|
|
18891
18891
|
}
|
|
18892
18892
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
18893
18893
|
if (!wb) {
|
|
18894
|
-
throw new (0,
|
|
18894
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
18895
18895
|
}
|
|
18896
18896
|
const records = readRecords2(wb);
|
|
18897
18897
|
if (records.length === 0) {
|
|
18898
|
-
throw new (0,
|
|
18898
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
18899
18899
|
}
|
|
18900
18900
|
const firstBof = decodeBof(records[0].data);
|
|
18901
18901
|
if (firstBof && firstBof.vers !== 1536) {
|
|
18902
|
-
throw new (0,
|
|
18902
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(
|
|
18903
18903
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
18904
18904
|
);
|
|
18905
18905
|
}
|
|
18906
18906
|
const globals = processGlobals(records);
|
|
18907
18907
|
const warnings = [];
|
|
18908
18908
|
if (globals.encrypted) {
|
|
18909
|
-
throw new (0,
|
|
18909
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18910
18910
|
}
|
|
18911
18911
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
18912
18912
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -18957,7 +18957,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18957
18957
|
pageCount: totalSheets
|
|
18958
18958
|
};
|
|
18959
18959
|
return {
|
|
18960
|
-
markdown:
|
|
18960
|
+
markdown: _chunkV7F5765Mcjs.blocksToMarkdown.call(void 0, allBlocks),
|
|
18961
18961
|
blocks: allBlocks,
|
|
18962
18962
|
metadata,
|
|
18963
18963
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -19385,7 +19385,7 @@ function getAttr(el, localName3) {
|
|
|
19385
19385
|
return null;
|
|
19386
19386
|
}
|
|
19387
19387
|
function parseXml2(text) {
|
|
19388
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19388
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunk4SIKWOLQcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19389
19389
|
}
|
|
19390
19390
|
function parseStyles(xml) {
|
|
19391
19391
|
const doc = parseXml2(xml);
|
|
@@ -19543,7 +19543,7 @@ function fieldUrlFromInstr(instr) {
|
|
|
19543
19543
|
function makeLink(text, rawHref) {
|
|
19544
19544
|
if (!text) return "";
|
|
19545
19545
|
if (!rawHref) return text;
|
|
19546
|
-
const href =
|
|
19546
|
+
const href = _chunk4SIKWOLQcjs.sanitizeHref.call(void 0, rawHref);
|
|
19547
19547
|
return href ? `[${text}](${href})` : text;
|
|
19548
19548
|
}
|
|
19549
19549
|
function collectInline(p, footnotes, rels) {
|
|
@@ -19737,7 +19737,7 @@ ${cell2.text}` : cell2.text;
|
|
|
19737
19737
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
19738
19738
|
})
|
|
19739
19739
|
);
|
|
19740
|
-
const table2 =
|
|
19740
|
+
const table2 = _chunkV7F5765Mcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
19741
19741
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
19742
19742
|
return { type: "table", table: table2 };
|
|
19743
19743
|
}
|
|
@@ -19793,10 +19793,14 @@ async function buildImageMap(zip, rels, doc, warnings) {
|
|
|
19793
19793
|
gif: "image/gif",
|
|
19794
19794
|
bmp: "image/bmp",
|
|
19795
19795
|
wmf: "image/wmf",
|
|
19796
|
-
emf: "image/emf"
|
|
19796
|
+
emf: "image/emf",
|
|
19797
|
+
tif: "image/tiff",
|
|
19798
|
+
tiff: "image/tiff",
|
|
19799
|
+
svg: "image/svg+xml"
|
|
19797
19800
|
};
|
|
19798
19801
|
const filename = `image_${String(imgIdx).padStart(3, "0")}.${ext}`;
|
|
19799
|
-
|
|
19802
|
+
const mimeType = _nullishCoalesce(_nullishCoalesce(mimeMap[ext], () => ( detectImageMime(data))), () => ( "application/octet-stream"));
|
|
19803
|
+
images.push({ filename, data, mimeType, source: imgPath });
|
|
19800
19804
|
imageMap.set(embedId, filename);
|
|
19801
19805
|
} catch (err) {
|
|
19802
19806
|
warnings.push({
|
|
@@ -19839,12 +19843,12 @@ function emitParagraphImages(p, imageMap, linked, out) {
|
|
|
19839
19843
|
}
|
|
19840
19844
|
}
|
|
19841
19845
|
async function parseDocxDocument(buffer, options) {
|
|
19842
|
-
|
|
19846
|
+
_chunk4SIKWOLQcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5);
|
|
19843
19847
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19844
19848
|
const warnings = [];
|
|
19845
19849
|
const docFile = zip.file("word/document.xml");
|
|
19846
19850
|
if (!docFile) {
|
|
19847
|
-
throw new (0,
|
|
19851
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19848
19852
|
}
|
|
19849
19853
|
let rels = /* @__PURE__ */ new Map();
|
|
19850
19854
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -19891,7 +19895,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19891
19895
|
const doc = parseXml2(docXml);
|
|
19892
19896
|
const body = findElements(doc, "body");
|
|
19893
19897
|
if (body.length === 0) {
|
|
19894
|
-
throw new (0,
|
|
19898
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19895
19899
|
}
|
|
19896
19900
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings);
|
|
19897
19901
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -19942,7 +19946,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19942
19946
|
}
|
|
19943
19947
|
}
|
|
19944
19948
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
19945
|
-
const markdown =
|
|
19949
|
+
const markdown = _chunkV7F5765Mcjs.blocksToMarkdown.call(void 0, blocks);
|
|
19946
19950
|
return {
|
|
19947
19951
|
markdown,
|
|
19948
19952
|
blocks,
|
|
@@ -19960,11 +19964,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
19960
19964
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
19961
19965
|
function parseHwpmlDocument(buffer, options) {
|
|
19962
19966
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
19963
|
-
throw new (0,
|
|
19967
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
19964
19968
|
}
|
|
19965
19969
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
19966
19970
|
const normalized = text.replace(/ /g, " ");
|
|
19967
|
-
const xml =
|
|
19971
|
+
const xml = _chunk4SIKWOLQcjs.stripDtd.call(void 0, normalized);
|
|
19968
19972
|
const warnings = [];
|
|
19969
19973
|
const parser = new (0, _xmldom.DOMParser)({
|
|
19970
19974
|
onError: (_level, msg2) => {
|
|
@@ -20004,7 +20008,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
20004
20008
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _190 => _190.keepTrailingEmptyCols]), () => ( false)));
|
|
20005
20009
|
}
|
|
20006
20010
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
20007
|
-
const markdown =
|
|
20011
|
+
const markdown = _chunkV7F5765Mcjs.blocksToMarkdown.call(void 0, blocks);
|
|
20008
20012
|
return {
|
|
20009
20013
|
markdown,
|
|
20010
20014
|
blocks,
|
|
@@ -20169,7 +20173,7 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
20169
20173
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
20170
20174
|
cellRows[r].push(cell2);
|
|
20171
20175
|
}
|
|
20172
|
-
const table2 =
|
|
20176
|
+
const table2 = _chunkV7F5765Mcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
20173
20177
|
if (structured.length > 0) {
|
|
20174
20178
|
const claimed = /* @__PURE__ */ new Set();
|
|
20175
20179
|
for (const { ctx, cellBlocks } of structured) {
|
|
@@ -21680,7 +21684,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
21680
21684
|
};
|
|
21681
21685
|
}
|
|
21682
21686
|
async function extractClickHereFields(hwpxBuffer) {
|
|
21683
|
-
|
|
21687
|
+
_chunk4SIKWOLQcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
21684
21688
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
21685
21689
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
21686
21690
|
const fields = [];
|
|
@@ -21728,19 +21732,19 @@ function parseCentralDirectory(buf) {
|
|
|
21728
21732
|
}
|
|
21729
21733
|
}
|
|
21730
21734
|
}
|
|
21731
|
-
if (eocdOffset < 0) throw new (0,
|
|
21735
|
+
if (eocdOffset < 0) throw new (0, _chunk4SIKWOLQcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21732
21736
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
21733
21737
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
21734
21738
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
21735
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
21739
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunk4SIKWOLQcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21736
21740
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
21737
|
-
throw new (0,
|
|
21741
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21738
21742
|
}
|
|
21739
21743
|
const decoder = new TextDecoder("utf-8");
|
|
21740
21744
|
const entries = [];
|
|
21741
21745
|
let pos = cdOffset;
|
|
21742
21746
|
for (let i = 0; i < totalEntries; i++) {
|
|
21743
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
21747
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunk4SIKWOLQcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
21744
21748
|
const flags = view.getUint16(pos + 8, true);
|
|
21745
21749
|
const method = view.getUint16(pos + 10, true);
|
|
21746
21750
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -21751,7 +21755,7 @@ function parseCentralDirectory(buf) {
|
|
|
21751
21755
|
const commentLen = view.getUint16(pos + 32, true);
|
|
21752
21756
|
const localOffset = view.getUint32(pos + 42, true);
|
|
21753
21757
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
21754
|
-
throw new (0,
|
|
21758
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21755
21759
|
}
|
|
21756
21760
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
21757
21761
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -21780,11 +21784,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21780
21784
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
21781
21785
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
21782
21786
|
for (const name of replacements.keys()) {
|
|
21783
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
21787
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunk4SIKWOLQcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
21784
21788
|
}
|
|
21785
21789
|
if (additions) {
|
|
21786
21790
|
for (const name of additions.keys()) {
|
|
21787
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
21791
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunk4SIKWOLQcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
21788
21792
|
}
|
|
21789
21793
|
}
|
|
21790
21794
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -21803,7 +21807,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21803
21807
|
offset += seg.length;
|
|
21804
21808
|
continue;
|
|
21805
21809
|
}
|
|
21806
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
21810
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunk4SIKWOLQcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
21807
21811
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
21808
21812
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
21809
21813
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -21811,7 +21815,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21811
21815
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
21812
21816
|
const method = e.method;
|
|
21813
21817
|
if (method !== 0 && method !== 8) {
|
|
21814
|
-
throw new (0,
|
|
21818
|
+
throw new (0, _chunk4SIKWOLQcjs.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`);
|
|
21815
21819
|
}
|
|
21816
21820
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
21817
21821
|
const crc = crc32(newData);
|
|
@@ -21909,11 +21913,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21909
21913
|
// src/form/filler-hwpx.ts
|
|
21910
21914
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
21911
21915
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
21912
|
-
|
|
21916
|
+
_chunk4SIKWOLQcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
21913
21917
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
21914
21918
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
21915
21919
|
if (sectionPaths.length === 0) {
|
|
21916
|
-
throw new (0,
|
|
21920
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21917
21921
|
}
|
|
21918
21922
|
const warnings = [];
|
|
21919
21923
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -22226,7 +22230,7 @@ function blocksToPages(blocks) {
|
|
|
22226
22230
|
const pages = [];
|
|
22227
22231
|
for (let pageNumber = min; pageNumber <= max; pageNumber++) {
|
|
22228
22232
|
const pageBlocks = byPage.get(pageNumber);
|
|
22229
|
-
pages.push({ pageNumber, markdown: pageBlocks ?
|
|
22233
|
+
pages.push({ pageNumber, markdown: pageBlocks ? _chunkV7F5765Mcjs.blocksToMarkdown.call(void 0, pageBlocks) : "" });
|
|
22230
22234
|
}
|
|
22231
22235
|
return pages;
|
|
22232
22236
|
}
|
|
@@ -22678,7 +22682,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
22678
22682
|
}
|
|
22679
22683
|
function assertFiniteRange(name, value, min, max) {
|
|
22680
22684
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
22681
|
-
throw new (0,
|
|
22685
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
22682
22686
|
}
|
|
22683
22687
|
}
|
|
22684
22688
|
function validateGongmunOptions(opts) {
|
|
@@ -22693,10 +22697,10 @@ function validateGongmunOptions(opts) {
|
|
|
22693
22697
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
22694
22698
|
}
|
|
22695
22699
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
22696
|
-
throw new (0,
|
|
22700
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
22697
22701
|
}
|
|
22698
22702
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
22699
|
-
throw new (0,
|
|
22703
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
22700
22704
|
}
|
|
22701
22705
|
}
|
|
22702
22706
|
if (opts.sizes) {
|
|
@@ -22705,7 +22709,7 @@ function validateGongmunOptions(opts) {
|
|
|
22705
22709
|
}
|
|
22706
22710
|
}
|
|
22707
22711
|
if (opts.approval && opts.approval.length > 6) {
|
|
22708
|
-
throw new (0,
|
|
22712
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("approval must contain at most 6 labels");
|
|
22709
22713
|
}
|
|
22710
22714
|
}
|
|
22711
22715
|
function incompatibleGongmunWarnings(opts) {
|
|
@@ -23267,7 +23271,7 @@ function parseInlineMarkdown(text) {
|
|
|
23267
23271
|
else spans.push(...emphasisSpans(m[0]));
|
|
23268
23272
|
} else {
|
|
23269
23273
|
const anchor = m[2] || m[3];
|
|
23270
|
-
const href = _nullishCoalesce(
|
|
23274
|
+
const href = _nullishCoalesce(_chunk4SIKWOLQcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
23271
23275
|
const sub = emphasisSpans(anchor);
|
|
23272
23276
|
if (href) for (const s of sub) s.href = href;
|
|
23273
23277
|
spans.push(...sub);
|
|
@@ -23481,7 +23485,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
23481
23485
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
23482
23486
|
const got = m ? Number(m[1]) : NaN;
|
|
23483
23487
|
if (got !== startId + i) {
|
|
23484
|
-
throw new (0,
|
|
23488
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(
|
|
23485
23489
|
`\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)`
|
|
23486
23490
|
);
|
|
23487
23491
|
}
|
|
@@ -23572,7 +23576,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
23572
23576
|
}
|
|
23573
23577
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
23574
23578
|
if (rows.length !== expectedBase) {
|
|
23575
|
-
throw new (0,
|
|
23579
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(
|
|
23576
23580
|
`\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`
|
|
23577
23581
|
);
|
|
23578
23582
|
}
|
|
@@ -24474,7 +24478,7 @@ function escapeGfm(text) {
|
|
|
24474
24478
|
}
|
|
24475
24479
|
var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
|
|
24476
24480
|
function sanitizeText(text) {
|
|
24477
|
-
let result =
|
|
24481
|
+
let result = _chunkV7F5765Mcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
24478
24482
|
if (result.length <= 30 && result.includes(" ")) {
|
|
24479
24483
|
const tokens = result.split(" ");
|
|
24480
24484
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -24646,7 +24650,7 @@ function parseHtmlTable(raw) {
|
|
|
24646
24650
|
const cs = parseInt(_optionalChain([attrs, 'access', _318 => _318.match, 'call', _319 => _319(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _320 => _320[1]]) || "1", 10);
|
|
24647
24651
|
const rs = parseInt(_optionalChain([attrs, 'access', _321 => _321.match, 'call', _322 => _322(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _323 => _323[1]]) || "1", 10);
|
|
24648
24652
|
cellStart = m.index + m[0].length;
|
|
24649
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
24653
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkV7F5765Mcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkV7F5765Mcjs.MAX_ROWS) };
|
|
24650
24654
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
24651
24655
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
24652
24656
|
cellStart = -1;
|
|
@@ -25388,8 +25392,8 @@ function layoutHtmlRows(rows) {
|
|
|
25388
25392
|
let c = 0;
|
|
25389
25393
|
for (const cell2 of rows[r].cells) {
|
|
25390
25394
|
while (occupied.has(`${r},${c}`)) c++;
|
|
25391
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
25392
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
25395
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkV7F5765Mcjs.MAX_COLS);
|
|
25396
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkV7F5765Mcjs.MAX_ROWS);
|
|
25393
25397
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
25394
25398
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
25395
25399
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -26710,7 +26714,7 @@ function builtinTemplateDir() {
|
|
|
26710
26714
|
for (const c of candidates) {
|
|
26711
26715
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
26712
26716
|
}
|
|
26713
|
-
throw new (0,
|
|
26717
|
+
throw new (0, _chunk4SIKWOLQcjs.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)");
|
|
26714
26718
|
}
|
|
26715
26719
|
function readBuiltinTemplate(t) {
|
|
26716
26720
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -27053,12 +27057,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
27053
27057
|
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>`;
|
|
27054
27058
|
}
|
|
27055
27059
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
27056
|
-
if (ops.length === 0) throw new (0,
|
|
27060
|
+
if (ops.length === 0) throw new (0, _chunk4SIKWOLQcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
27057
27061
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
27058
|
-
|
|
27062
|
+
_chunk4SIKWOLQcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
27059
27063
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
27060
27064
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _436 => _436.match, 'call', _437 => _437(/(\d+)\.xml$/i), 'optionalAccess', _438 => _438[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _439 => _439.match, 'call', _440 => _440(/(\d+)\.xml$/i), 'optionalAccess', _441 => _441[1]]), () => ( 0))));
|
|
27061
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
27065
|
+
if (sectionPaths.length === 0) throw new (0, _chunk4SIKWOLQcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
27062
27066
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
27063
27067
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
27064
27068
|
const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
|
|
@@ -27099,11 +27103,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
27099
27103
|
const manifestItems = [];
|
|
27100
27104
|
const placed = [];
|
|
27101
27105
|
for (const op of ops) {
|
|
27102
|
-
if (!op.anchor) throw new (0,
|
|
27103
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
27106
|
+
if (!op.anchor) throw new (0, _chunk4SIKWOLQcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
27107
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunk4SIKWOLQcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
27104
27108
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
27105
|
-
if (!MIME[ext]) throw new (0,
|
|
27106
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
27109
|
+
if (!MIME[ext]) throw new (0, _chunk4SIKWOLQcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
27110
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunk4SIKWOLQcjs.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)`);
|
|
27107
27111
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
27108
27112
|
let found = null;
|
|
27109
27113
|
let total = 0;
|
|
@@ -27136,7 +27140,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
27136
27140
|
}
|
|
27137
27141
|
}
|
|
27138
27142
|
}
|
|
27139
|
-
throw new (0,
|
|
27143
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(
|
|
27140
27144
|
`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)})`
|
|
27141
27145
|
);
|
|
27142
27146
|
}
|
|
@@ -27144,7 +27148,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
27144
27148
|
const xml = sectionXmls[si];
|
|
27145
27149
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
27146
27150
|
if (!run) {
|
|
27147
|
-
throw new (0,
|
|
27151
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
27148
27152
|
}
|
|
27149
27153
|
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _442 => _442.charPr, 'access', _443 => _443.get, 'call', _444 => _444(run.charPr), 'optionalAccess', _445 => _445.height]), () => ( 1e3));
|
|
27150
27154
|
const fontPt = charPrHeight / 100;
|
|
@@ -27422,7 +27426,7 @@ function pick(map, keys) {
|
|
|
27422
27426
|
return out;
|
|
27423
27427
|
}
|
|
27424
27428
|
async function hwpxToProfile(input) {
|
|
27425
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
27429
|
+
const buf = input instanceof ArrayBuffer ? input : _chunk4SIKWOLQcjs.toArrayBuffer.call(void 0, input);
|
|
27426
27430
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
27427
27431
|
const parser = createXmlParser();
|
|
27428
27432
|
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _467 => _467.file, 'call', _468 => _468(/[Hh]eader\.xml$/), 'optionalAccess', _469 => _469[0]])));
|
|
@@ -28596,7 +28600,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
28596
28600
|
const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
28597
28601
|
if (paths.length > 0) return paths;
|
|
28598
28602
|
}
|
|
28599
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
28603
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunk4SIKWOLQcjs.compareSectionPaths);
|
|
28600
28604
|
}
|
|
28601
28605
|
function sectionPathsFromManifest(xml) {
|
|
28602
28606
|
const attr = (tag, name) => {
|
|
@@ -28606,7 +28610,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
28606
28610
|
const idToHref = /* @__PURE__ */ new Map();
|
|
28607
28611
|
for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
|
|
28608
28612
|
const id = attr(m[1], "id");
|
|
28609
|
-
const href =
|
|
28613
|
+
const href = _chunk4SIKWOLQcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
|
|
28610
28614
|
if (id && href) idToHref.set(id, href);
|
|
28611
28615
|
}
|
|
28612
28616
|
const ordered = [];
|
|
@@ -28615,7 +28619,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
28615
28619
|
if (href) ordered.push(href);
|
|
28616
28620
|
}
|
|
28617
28621
|
if (ordered.length > 0) return ordered;
|
|
28618
|
-
return Array.from(idToHref.values()).sort(
|
|
28622
|
+
return Array.from(idToHref.values()).sort(_chunk4SIKWOLQcjs.compareSectionPaths);
|
|
28619
28623
|
}
|
|
28620
28624
|
|
|
28621
28625
|
// src/roundtrip/patcher.ts
|
|
@@ -28726,9 +28730,9 @@ function buildOrigUnits(blocks) {
|
|
|
28726
28730
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
28727
28731
|
const next = blocks[i + 1];
|
|
28728
28732
|
if (_optionalChain([next, 'optionalAccess', _502 => _502.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
28729
|
-
chunk =
|
|
28733
|
+
chunk = _chunkV7F5765Mcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
28730
28734
|
} else {
|
|
28731
|
-
chunk =
|
|
28735
|
+
chunk = _chunkV7F5765Mcjs.blocksToMarkdown.call(void 0, [block]);
|
|
28732
28736
|
}
|
|
28733
28737
|
if (chunk) {
|
|
28734
28738
|
const subUnits = splitMarkdownUnits(chunk);
|
|
@@ -29533,7 +29537,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
29533
29537
|
for (let i = 0; i < scans.length; i++) {
|
|
29534
29538
|
if (scans[i].repl.size === 0 && scans[i].inserts.size === 0) continue;
|
|
29535
29539
|
const newStream = serializeRecords(scans[i].records, scans[i].repl, scans[i].inserts);
|
|
29536
|
-
const content = compressed ?
|
|
29540
|
+
const content = compressed ? compressWithTail(newStream) : newStream;
|
|
29537
29541
|
out = replaceOleStream(out, sectionPaths[i], content);
|
|
29538
29542
|
}
|
|
29539
29543
|
data = new Uint8Array(out);
|
|
@@ -30016,6 +30020,26 @@ function rebuildCharShape(csData, coreStartUnit) {
|
|
|
30016
30020
|
});
|
|
30017
30021
|
return { buf, count: kept.length };
|
|
30018
30022
|
}
|
|
30023
|
+
var CRC_TABLE2 = (() => {
|
|
30024
|
+
const t = new Uint32Array(256);
|
|
30025
|
+
for (let n = 0; n < 256; n++) {
|
|
30026
|
+
let c = n;
|
|
30027
|
+
for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
|
|
30028
|
+
t[n] = c >>> 0;
|
|
30029
|
+
}
|
|
30030
|
+
return t;
|
|
30031
|
+
})();
|
|
30032
|
+
function crc322(buf) {
|
|
30033
|
+
let c = 4294967295;
|
|
30034
|
+
for (let i = 0; i < buf.length; i++) c = CRC_TABLE2[(c ^ buf[i]) & 255] ^ c >>> 8;
|
|
30035
|
+
return (c ^ 4294967295) >>> 0;
|
|
30036
|
+
}
|
|
30037
|
+
function compressWithTail(raw) {
|
|
30038
|
+
const tail = Buffer.alloc(8);
|
|
30039
|
+
tail.writeUInt32LE(crc322(raw), 0);
|
|
30040
|
+
tail.writeUInt32LE(raw.length >>> 0, 4);
|
|
30041
|
+
return Buffer.concat([_zlib.deflateRawSync.call(void 0, raw), tail]);
|
|
30042
|
+
}
|
|
30019
30043
|
function synthesizeLineSegs(lineSegData, newRaw, startUnits) {
|
|
30020
30044
|
if (lineSegData.length < 36) return null;
|
|
30021
30045
|
const seg0 = lineSegData.subarray(0, 36);
|
|
@@ -30093,6 +30117,15 @@ function stageParaPatch(scan, para2, newPlain, skip) {
|
|
|
30093
30117
|
scan.repl.set(para2.lineSegIdx, synth.buf);
|
|
30094
30118
|
newHeader.writeUInt16LE(synth.count, 16);
|
|
30095
30119
|
}
|
|
30120
|
+
} else {
|
|
30121
|
+
const lineSegData = records[para2.lineSegIdx].data;
|
|
30122
|
+
const segCount = Math.floor(lineSegData.length / 36);
|
|
30123
|
+
let keep = 1;
|
|
30124
|
+
while (keep < segCount && lineSegData.readUInt32LE(keep * 36) < nChars) keep++;
|
|
30125
|
+
if (keep < segCount) {
|
|
30126
|
+
scan.repl.set(para2.lineSegIdx, Buffer.from(lineSegData.subarray(0, keep * 36)));
|
|
30127
|
+
newHeader.writeUInt16LE(keep, 16);
|
|
30128
|
+
}
|
|
30096
30129
|
}
|
|
30097
30130
|
scan.repl.set(para2.headerIdx, newHeader);
|
|
30098
30131
|
return 1;
|
|
@@ -30348,12 +30381,12 @@ function blocksToChunks(blocks, options) {
|
|
|
30348
30381
|
let run = null;
|
|
30349
30382
|
const flushRun = () => {
|
|
30350
30383
|
if (!run) return;
|
|
30351
|
-
push("text", run.breadcrumb,
|
|
30384
|
+
push("text", run.breadcrumb, _chunkV7F5765Mcjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
|
|
30352
30385
|
run = null;
|
|
30353
30386
|
};
|
|
30354
30387
|
for (let i = 0; i < blocks.length; i++) {
|
|
30355
30388
|
const block = blocks[i];
|
|
30356
|
-
const md2 =
|
|
30389
|
+
const md2 = _chunkV7F5765Mcjs.blocksToMarkdown.call(void 0, [block]);
|
|
30357
30390
|
if (!md2) continue;
|
|
30358
30391
|
if (block.type === "heading") {
|
|
30359
30392
|
flushRun();
|
|
@@ -30823,13 +30856,13 @@ async function htmlToPdf(html, options) {
|
|
|
30823
30856
|
try {
|
|
30824
30857
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
30825
30858
|
} catch (e37) {
|
|
30826
|
-
throw new (0,
|
|
30859
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(
|
|
30827
30860
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
30828
30861
|
);
|
|
30829
30862
|
}
|
|
30830
30863
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
30831
30864
|
if (!executablePath) {
|
|
30832
|
-
throw new (0,
|
|
30865
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)(
|
|
30833
30866
|
"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."
|
|
30834
30867
|
);
|
|
30835
30868
|
}
|
|
@@ -30888,7 +30921,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
30888
30921
|
return htmlToPdf(html, options);
|
|
30889
30922
|
}
|
|
30890
30923
|
async function blocksToPdf(blocks, options) {
|
|
30891
|
-
const markdown =
|
|
30924
|
+
const markdown = _chunkV7F5765Mcjs.blocksToMarkdown.call(void 0, blocks);
|
|
30892
30925
|
return markdownToPdf(markdown, options);
|
|
30893
30926
|
}
|
|
30894
30927
|
|
|
@@ -31787,15 +31820,15 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode) {
|
|
|
31787
31820
|
async function renderHwpxToSvg(input, options) {
|
|
31788
31821
|
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _599 => _599.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
31789
31822
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
31790
|
-
|
|
31823
|
+
_chunk4SIKWOLQcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
31791
31824
|
let zip;
|
|
31792
31825
|
try {
|
|
31793
31826
|
zip = await _jszip2.default.loadAsync(input);
|
|
31794
31827
|
} catch (e38) {
|
|
31795
|
-
throw new (0,
|
|
31828
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
31796
31829
|
}
|
|
31797
31830
|
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
|
|
31798
|
-
if (secFiles.length === 0) throw new (0,
|
|
31831
|
+
if (secFiles.length === 0) throw new (0, _chunk4SIKWOLQcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
31799
31832
|
const warnings = [];
|
|
31800
31833
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
31801
31834
|
const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
@@ -31803,7 +31836,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31803
31836
|
const secXmls = [];
|
|
31804
31837
|
for (const f of secFiles) {
|
|
31805
31838
|
const xml = await f.async("string");
|
|
31806
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
31839
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunk4SIKWOLQcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
31807
31840
|
secXmls.push(xml);
|
|
31808
31841
|
}
|
|
31809
31842
|
const binmap = /* @__PURE__ */ new Map();
|
|
@@ -31876,9 +31909,9 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31876
31909
|
}
|
|
31877
31910
|
if (rendered.length === 0) {
|
|
31878
31911
|
if (noCacheSkipped) {
|
|
31879
|
-
throw new (0,
|
|
31912
|
+
throw new (0, _chunk4SIKWOLQcjs.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)");
|
|
31880
31913
|
}
|
|
31881
|
-
throw new (0,
|
|
31914
|
+
throw new (0, _chunk4SIKWOLQcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
31882
31915
|
}
|
|
31883
31916
|
const GAP = 2400;
|
|
31884
31917
|
const clipDefs = [];
|
|
@@ -31914,13 +31947,13 @@ async function parse(input, options) {
|
|
|
31914
31947
|
if (typeof input === "string") {
|
|
31915
31948
|
try {
|
|
31916
31949
|
const buf = await _promises.readFile.call(void 0, input);
|
|
31917
|
-
buffer =
|
|
31950
|
+
buffer = _chunk4SIKWOLQcjs.toArrayBuffer.call(void 0, buf);
|
|
31918
31951
|
} catch (err) {
|
|
31919
31952
|
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}`;
|
|
31920
31953
|
return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
|
|
31921
31954
|
}
|
|
31922
31955
|
} else if (Buffer.isBuffer(input)) {
|
|
31923
|
-
buffer =
|
|
31956
|
+
buffer = _chunk4SIKWOLQcjs.toArrayBuffer.call(void 0, input);
|
|
31924
31957
|
} else {
|
|
31925
31958
|
buffer = input;
|
|
31926
31959
|
}
|
|
@@ -31962,18 +31995,18 @@ async function dispatch(format, buffer, opts) {
|
|
|
31962
31995
|
}
|
|
31963
31996
|
async function parseImage(buffer, options) {
|
|
31964
31997
|
try {
|
|
31965
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
31998
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-POPCJGL5.cjs")));
|
|
31966
31999
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
31967
32000
|
return {
|
|
31968
32001
|
success: true,
|
|
31969
32002
|
fileType: "image",
|
|
31970
|
-
markdown:
|
|
32003
|
+
markdown: _chunkV7F5765Mcjs.blocksToMarkdown.call(void 0, blocks),
|
|
31971
32004
|
blocks,
|
|
31972
32005
|
warnings: warnings.length ? warnings : void 0,
|
|
31973
32006
|
pageCount: 1
|
|
31974
32007
|
};
|
|
31975
32008
|
} catch (err) {
|
|
31976
|
-
return { success: false, fileType: "image", error:
|
|
32009
|
+
return { success: false, fileType: "image", error: _chunk4SIKWOLQcjs.sanitizeError.call(void 0, err), code: _chunk4SIKWOLQcjs.classifyError.call(void 0, err) };
|
|
31977
32010
|
}
|
|
31978
32011
|
}
|
|
31979
32012
|
async function parseHwp3(buffer, options) {
|
|
@@ -31981,7 +32014,7 @@ async function parseHwp3(buffer, options) {
|
|
|
31981
32014
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
31982
32015
|
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _606 => _606.pageCount]) };
|
|
31983
32016
|
} catch (err) {
|
|
31984
|
-
return { success: false, fileType: "hwp3", error:
|
|
32017
|
+
return { success: false, fileType: "hwp3", error: _chunk4SIKWOLQcjs.sanitizeError.call(void 0, err), code: _chunk4SIKWOLQcjs.classifyError.call(void 0, err) };
|
|
31985
32018
|
}
|
|
31986
32019
|
}
|
|
31987
32020
|
async function parseHwpx(buffer, options) {
|
|
@@ -31989,7 +32022,7 @@ async function parseHwpx(buffer, options) {
|
|
|
31989
32022
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
31990
32023
|
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _607 => _607.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _608 => _608.pageCount]) };
|
|
31991
32024
|
} catch (err) {
|
|
31992
|
-
return { success: false, fileType: "hwpx", error:
|
|
32025
|
+
return { success: false, fileType: "hwpx", error: _chunk4SIKWOLQcjs.sanitizeError.call(void 0, err), code: _chunk4SIKWOLQcjs.classifyError.call(void 0, err) };
|
|
31993
32026
|
}
|
|
31994
32027
|
}
|
|
31995
32028
|
async function parseHwp(buffer, options) {
|
|
@@ -32015,13 +32048,13 @@ async function parseHwp(buffer, options) {
|
|
|
32015
32048
|
}
|
|
32016
32049
|
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _610 => _610.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _611 => _611.pageCount]) };
|
|
32017
32050
|
} catch (err) {
|
|
32018
|
-
return { success: false, fileType: "hwp", error:
|
|
32051
|
+
return { success: false, fileType: "hwp", error: _chunk4SIKWOLQcjs.sanitizeError.call(void 0, err), code: _chunk4SIKWOLQcjs.classifyError.call(void 0, err) };
|
|
32019
32052
|
}
|
|
32020
32053
|
}
|
|
32021
32054
|
async function parsePdf(buffer, options) {
|
|
32022
32055
|
let parsePdfDocument;
|
|
32023
32056
|
try {
|
|
32024
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
32057
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-VAIMONF2.cjs")));
|
|
32025
32058
|
parsePdfDocument = mod.parsePdfDocument;
|
|
32026
32059
|
} catch (e40) {
|
|
32027
32060
|
return {
|
|
@@ -32036,7 +32069,7 @@ async function parsePdf(buffer, options) {
|
|
|
32036
32069
|
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pageCount: _optionalChain([metadata, 'optionalAccess', _612 => _612.pageCount]) };
|
|
32037
32070
|
} catch (err) {
|
|
32038
32071
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
32039
|
-
return { success: false, fileType: "pdf", error:
|
|
32072
|
+
return { success: false, fileType: "pdf", error: _chunk4SIKWOLQcjs.sanitizeError.call(void 0, err), code: _chunk4SIKWOLQcjs.classifyError.call(void 0, err), isImageBased };
|
|
32040
32073
|
}
|
|
32041
32074
|
}
|
|
32042
32075
|
async function parseXlsx(buffer, options) {
|
|
@@ -32044,7 +32077,7 @@ async function parseXlsx(buffer, options) {
|
|
|
32044
32077
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
32045
32078
|
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _613 => _613.pageCount]) };
|
|
32046
32079
|
} catch (err) {
|
|
32047
|
-
return { success: false, fileType: "xlsx", error:
|
|
32080
|
+
return { success: false, fileType: "xlsx", error: _chunk4SIKWOLQcjs.sanitizeError.call(void 0, err), code: _chunk4SIKWOLQcjs.classifyError.call(void 0, err) };
|
|
32048
32081
|
}
|
|
32049
32082
|
}
|
|
32050
32083
|
async function parseXls(buffer, options) {
|
|
@@ -32052,7 +32085,7 @@ async function parseXls(buffer, options) {
|
|
|
32052
32085
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
32053
32086
|
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _614 => _614.pageCount]) };
|
|
32054
32087
|
} catch (err) {
|
|
32055
|
-
return { success: false, fileType: "xls", error:
|
|
32088
|
+
return { success: false, fileType: "xls", error: _chunk4SIKWOLQcjs.sanitizeError.call(void 0, err), code: _chunk4SIKWOLQcjs.classifyError.call(void 0, err) };
|
|
32056
32089
|
}
|
|
32057
32090
|
}
|
|
32058
32091
|
async function parseDocx(buffer, options) {
|
|
@@ -32060,7 +32093,7 @@ async function parseDocx(buffer, options) {
|
|
|
32060
32093
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
32061
32094
|
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _615 => _615.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _616 => _616.pageCount]) };
|
|
32062
32095
|
} catch (err) {
|
|
32063
|
-
return { success: false, fileType: "docx", error:
|
|
32096
|
+
return { success: false, fileType: "docx", error: _chunk4SIKWOLQcjs.sanitizeError.call(void 0, err), code: _chunk4SIKWOLQcjs.classifyError.call(void 0, err) };
|
|
32064
32097
|
}
|
|
32065
32098
|
}
|
|
32066
32099
|
async function parseHwpml(buffer, options) {
|
|
@@ -32068,16 +32101,16 @@ async function parseHwpml(buffer, options) {
|
|
|
32068
32101
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
32069
32102
|
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _617 => _617.pageCount]) };
|
|
32070
32103
|
} catch (err) {
|
|
32071
|
-
return { success: false, fileType: "hwpml", error:
|
|
32104
|
+
return { success: false, fileType: "hwpml", error: _chunk4SIKWOLQcjs.sanitizeError.call(void 0, err), code: _chunk4SIKWOLQcjs.classifyError.call(void 0, err) };
|
|
32072
32105
|
}
|
|
32073
32106
|
}
|
|
32074
32107
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
32075
32108
|
let buffer;
|
|
32076
32109
|
if (typeof input === "string") {
|
|
32077
32110
|
const buf = await _promises.readFile.call(void 0, input);
|
|
32078
|
-
buffer =
|
|
32111
|
+
buffer = _chunk4SIKWOLQcjs.toArrayBuffer.call(void 0, buf);
|
|
32079
32112
|
} else if (Buffer.isBuffer(input)) {
|
|
32080
|
-
buffer =
|
|
32113
|
+
buffer = _chunk4SIKWOLQcjs.toArrayBuffer.call(void 0, input);
|
|
32081
32114
|
} else {
|
|
32082
32115
|
buffer = input;
|
|
32083
32116
|
}
|
|
@@ -32103,7 +32136,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
32103
32136
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
32104
32137
|
}
|
|
32105
32138
|
const fill = fillFormFields(parsed.blocks, values);
|
|
32106
|
-
const markdown =
|
|
32139
|
+
const markdown = _chunkV7F5765Mcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
32107
32140
|
if (outputFormat === "hwpx") {
|
|
32108
32141
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
32109
32142
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -32186,5 +32219,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
32186
32219
|
|
|
32187
32220
|
|
|
32188
32221
|
|
|
32189
|
-
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 =
|
|
32222
|
+
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 = _chunk4SIKWOLQcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkV7F5765Mcjs.blocksToMarkdown; exports.blocksToPages = blocksToPages; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; 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.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; 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.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.resolveBuiltinTemplate = resolveBuiltinTemplate; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.usesGaejosikMunche = usesGaejosikMunche; exports.validateHwpx = validateHwpx;
|
|
32190
32223
|
//# sourceMappingURL=index.cjs.map
|