kordoc 4.16.2 → 4.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -6
- package/dist/{-4G6MA4X6.js → -5XQIJN3D.js} +10 -10
- package/dist/{chunk-UTP2WCHS.js → chunk-2EJ5YSFZ.js} +4 -4
- package/dist/{chunk-IQGIT2VX.js → chunk-3ZVZPYSA.js} +5 -5
- package/dist/{chunk-TXUKTOG2.js → chunk-46H2PPG7.js} +3 -3
- package/dist/{chunk-7KNGSQU7.js → chunk-4O5XQSCT.js} +2 -2
- package/dist/{chunk-MLIS253L.js → chunk-7NYRZI2Z.js} +2 -2
- package/dist/{chunk-GO5IFOUF.js → chunk-7USPM2VT.js} +2 -2
- package/dist/{chunk-XTFN5WKS.cjs → chunk-7WV3WETF.cjs} +6 -6
- package/dist/{chunk-XTFN5WKS.cjs.map → chunk-7WV3WETF.cjs.map} +1 -1
- package/dist/{chunk-KIOQ4N37.js → chunk-AL2WM6ZZ.js} +2 -2
- package/dist/{chunk-F4NRLLY4.js → chunk-AWWFGIBA.js} +2 -2
- package/dist/{chunk-QOCS7W7R.js → chunk-D2UGAEXY.js} +9 -9
- package/dist/{chunk-P6ZDXTV6.js → chunk-ENF34XNH.js} +2 -2
- package/dist/{chunk-5KS5PWJR.js → chunk-GGGO3OH2.js} +2 -2
- package/dist/{chunk-JFLAM3MM.js → chunk-GH2JGKWP.js} +2 -2
- package/dist/{chunk-S2PL227Q.js → chunk-IE6QX3T3.js} +2 -2
- package/dist/{chunk-LEIAEWZ7.js → chunk-JIFG35UT.js} +2 -2
- package/dist/{chunk-DES2LGFZ.js → chunk-LQAKDKSF.js} +2 -2
- package/dist/{chunk-SFEQYKYJ.js → chunk-MC2SRJXO.js} +2 -2
- package/dist/{chunk-STM3ORY7.cjs → chunk-PMULUMUF.cjs} +2 -2
- package/dist/{chunk-STM3ORY7.cjs.map → chunk-PMULUMUF.cjs.map} +1 -1
- package/dist/{chunk-FSDJLAOW.js → chunk-QPJXYJIK.js} +55 -1
- package/dist/chunk-QPJXYJIK.js.map +1 -0
- package/dist/{chunk-OXLPVQYK.js → chunk-T2QHY3S5.js} +3 -3
- package/dist/{chunk-4VODJKFL.js → chunk-UCGGVNTD.js} +3 -3
- package/dist/{chunk-AUWGDP4G.js → chunk-XPYK7Z73.js} +2 -2
- package/dist/{chunk-FKUDAIJI.cjs → chunk-YJECRT5Q.cjs} +12 -12
- package/dist/{chunk-FKUDAIJI.cjs.map → chunk-YJECRT5Q.cjs.map} +1 -1
- package/dist/{chunk-WDQTFAXY.cjs → chunk-YOCFY44Z.cjs} +11 -11
- package/dist/{chunk-WDQTFAXY.cjs.map → chunk-YOCFY44Z.cjs.map} +1 -1
- package/dist/{chunk-JELRWAZC.js → chunk-YUZZNS6E.js} +2 -2
- package/dist/{chunk-CEIATRDW.cjs → chunk-Z3RFAVZ2.cjs} +3 -3
- package/dist/{chunk-CEIATRDW.cjs.map → chunk-Z3RFAVZ2.cjs.map} +1 -1
- package/dist/chunks-GBPAQ6JM.js +10 -0
- package/dist/cli.js +31 -50
- package/dist/cli.js.map +1 -1
- package/dist/{formula-EPKLPDU7.js → formula-EUX2AHXG.js} +3 -3
- package/dist/{formula-NARUOXRX.js → formula-IMEE5OJR.js} +4 -4
- package/dist/{formula-WIMV5TUX.cjs → formula-NPOU4BSO.cjs} +9 -9
- package/dist/{formula-WIMV5TUX.cjs.map → formula-NPOU4BSO.cjs.map} +1 -1
- package/dist/{image-ocr-3WJ4QH3T.js → image-ocr-CCIE3SPX.js} +7 -7
- package/dist/{image-ocr-AXWXR6JV.cjs → image-ocr-LTSQRHCN.cjs} +14 -14
- package/dist/{image-ocr-AXWXR6JV.cjs.map → image-ocr-LTSQRHCN.cjs.map} +1 -1
- package/dist/{image-ocr-5BUJQ4TK.js → image-ocr-QLW5VL4M.js} +5 -5
- package/dist/index.cjs +237 -237
- package/dist/index.js +4 -4
- package/dist/mcp.js +30 -37
- package/dist/mcp.js.map +1 -1
- package/dist/{model-bundle-IMBW7D2Z.js → model-bundle-VRKRVD6Z.js} +5 -5
- package/dist/{models-SY75IBOE.js → models-GSZIPSV2.js} +5 -5
- package/dist/{parser-N6476XAC.js → parser-64C45UPQ.js} +10 -10
- package/dist/{parser-ZQM3664Z.js → parser-NARS2CF7.js} +7 -7
- package/dist/{parser-2LU4EVU3.cjs → parser-U52HRNOY.cjs} +81 -81
- package/dist/{parser-2LU4EVU3.cjs.map → parser-U52HRNOY.cjs.map} +1 -1
- package/dist/pdf-ocr-4QWLMFJQ.js +18 -0
- package/dist/pdf-ocr-C7RXT5YU.cjs +16 -0
- package/dist/{pdf-ocr-GHEJVPX2.cjs.map → pdf-ocr-C7RXT5YU.cjs.map} +1 -1
- package/dist/pdf-ocr-ZYRJLOWQ.js +15 -0
- package/dist/{profile-io-GJPKCYPT.js → profile-io-PZBOSV5X.js} +3 -3
- package/dist/{rasterize-UOALJQDS.js → rasterize-DXBWM6T2.js} +3 -3
- package/dist/{redact-doc-22SYW3KH.js → redact-doc-FLMBZ53F.js} +10 -10
- package/dist/{render-MJ4H3R23.js → render-QNWUOQXJ.js} +6 -6
- package/dist/seal-NNZUQPDJ.js +10 -0
- package/dist/{setup-2URYVUEO.js → setup-3OR4QZFF.js} +3 -3
- package/dist/visual-RDGSACGE.js +20 -0
- package/dist/{watch-ALXZGTOB.js → watch-5A52FP6G.js} +11 -11
- package/package.json +1 -1
- package/dist/chunk-FSDJLAOW.js.map +0 -1
- package/dist/chunks-NUNIKS2J.js +0 -10
- package/dist/pdf-ocr-6DEE23IP.js +0 -15
- package/dist/pdf-ocr-GHEJVPX2.cjs +0 -16
- package/dist/pdf-ocr-MQTWODVU.js +0 -18
- package/dist/seal-XWMRUTI4.js +0 -10
- package/dist/visual-USPS4QRC.js +0 -20
- /package/dist/{-4G6MA4X6.js.map → -5XQIJN3D.js.map} +0 -0
- /package/dist/{chunk-UTP2WCHS.js.map → chunk-2EJ5YSFZ.js.map} +0 -0
- /package/dist/{chunk-IQGIT2VX.js.map → chunk-3ZVZPYSA.js.map} +0 -0
- /package/dist/{chunk-TXUKTOG2.js.map → chunk-46H2PPG7.js.map} +0 -0
- /package/dist/{chunk-7KNGSQU7.js.map → chunk-4O5XQSCT.js.map} +0 -0
- /package/dist/{chunk-MLIS253L.js.map → chunk-7NYRZI2Z.js.map} +0 -0
- /package/dist/{chunk-GO5IFOUF.js.map → chunk-7USPM2VT.js.map} +0 -0
- /package/dist/{chunk-KIOQ4N37.js.map → chunk-AL2WM6ZZ.js.map} +0 -0
- /package/dist/{chunk-F4NRLLY4.js.map → chunk-AWWFGIBA.js.map} +0 -0
- /package/dist/{chunk-QOCS7W7R.js.map → chunk-D2UGAEXY.js.map} +0 -0
- /package/dist/{chunk-P6ZDXTV6.js.map → chunk-ENF34XNH.js.map} +0 -0
- /package/dist/{chunk-5KS5PWJR.js.map → chunk-GGGO3OH2.js.map} +0 -0
- /package/dist/{chunk-JFLAM3MM.js.map → chunk-GH2JGKWP.js.map} +0 -0
- /package/dist/{chunk-S2PL227Q.js.map → chunk-IE6QX3T3.js.map} +0 -0
- /package/dist/{chunk-LEIAEWZ7.js.map → chunk-JIFG35UT.js.map} +0 -0
- /package/dist/{chunk-DES2LGFZ.js.map → chunk-LQAKDKSF.js.map} +0 -0
- /package/dist/{chunk-SFEQYKYJ.js.map → chunk-MC2SRJXO.js.map} +0 -0
- /package/dist/{chunk-OXLPVQYK.js.map → chunk-T2QHY3S5.js.map} +0 -0
- /package/dist/{chunk-4VODJKFL.js.map → chunk-UCGGVNTD.js.map} +0 -0
- /package/dist/{chunk-AUWGDP4G.js.map → chunk-XPYK7Z73.js.map} +0 -0
- /package/dist/{chunk-JELRWAZC.js.map → chunk-YUZZNS6E.js.map} +0 -0
- /package/dist/{chunks-NUNIKS2J.js.map → chunks-GBPAQ6JM.js.map} +0 -0
- /package/dist/{formula-EPKLPDU7.js.map → formula-EUX2AHXG.js.map} +0 -0
- /package/dist/{formula-NARUOXRX.js.map → formula-IMEE5OJR.js.map} +0 -0
- /package/dist/{image-ocr-3WJ4QH3T.js.map → image-ocr-CCIE3SPX.js.map} +0 -0
- /package/dist/{image-ocr-5BUJQ4TK.js.map → image-ocr-QLW5VL4M.js.map} +0 -0
- /package/dist/{model-bundle-IMBW7D2Z.js.map → model-bundle-VRKRVD6Z.js.map} +0 -0
- /package/dist/{models-SY75IBOE.js.map → models-GSZIPSV2.js.map} +0 -0
- /package/dist/{parser-N6476XAC.js.map → parser-64C45UPQ.js.map} +0 -0
- /package/dist/{parser-ZQM3664Z.js.map → parser-NARS2CF7.js.map} +0 -0
- /package/dist/{pdf-ocr-6DEE23IP.js.map → pdf-ocr-4QWLMFJQ.js.map} +0 -0
- /package/dist/{pdf-ocr-MQTWODVU.js.map → pdf-ocr-ZYRJLOWQ.js.map} +0 -0
- /package/dist/{profile-io-GJPKCYPT.js.map → profile-io-PZBOSV5X.js.map} +0 -0
- /package/dist/{rasterize-UOALJQDS.js.map → rasterize-DXBWM6T2.js.map} +0 -0
- /package/dist/{redact-doc-22SYW3KH.js.map → redact-doc-FLMBZ53F.js.map} +0 -0
- /package/dist/{render-MJ4H3R23.js.map → render-QNWUOQXJ.js.map} +0 -0
- /package/dist/{seal-XWMRUTI4.js.map → seal-NNZUQPDJ.js.map} +0 -0
- /package/dist/{setup-2URYVUEO.js.map → setup-3OR4QZFF.js.map} +0 -0
- /package/dist/{visual-USPS4QRC.js.map → visual-RDGSACGE.js.map} +0 -0
- /package/dist/{watch-ALXZGTOB.js.map → watch-5A52FP6G.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunk7WV3WETFcjs = require('./chunk-7WV3WETF.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
@@ -45,7 +45,7 @@ var _chunk62W7QCEXcjs = require('./chunk-62W7QCEX.cjs');
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
var
|
|
48
|
+
var _chunkPMULUMUFcjs = require('./chunk-PMULUMUF.cjs');
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -569,9 +569,9 @@ function rawTextContent(node, depth = 0) {
|
|
|
569
569
|
}
|
|
570
570
|
|
|
571
571
|
// src/hwpx/parser-shared.ts
|
|
572
|
-
var MAX_DECOMPRESS_SIZE =
|
|
572
|
+
var MAX_DECOMPRESS_SIZE = _chunkPMULUMUFcjs.unzipLimitBytes.call(void 0, 256 * 1024 * 1024);
|
|
573
573
|
var MAX_ZIP_ENTRIES = 500;
|
|
574
|
-
var ZipBombError = class extends
|
|
574
|
+
var ZipBombError = class extends _chunkPMULUMUFcjs.KordocError {
|
|
575
575
|
constructor(message) {
|
|
576
576
|
super(message);
|
|
577
577
|
this.name = "ZipBombError";
|
|
@@ -591,7 +591,7 @@ function createSectionShared() {
|
|
|
591
591
|
function createXmlParser(warnings) {
|
|
592
592
|
return new (0, _xmldom.DOMParser)({
|
|
593
593
|
onError(level, msg2) {
|
|
594
|
-
if (level === "fatalError") throw new (0,
|
|
594
|
+
if (level === "fatalError") throw new (0, _chunkPMULUMUFcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
595
595
|
_optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
596
596
|
}
|
|
597
597
|
});
|
|
@@ -626,13 +626,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
626
626
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
627
627
|
const checksumType = attrOf(inner, "checksum-type");
|
|
628
628
|
if (algorithm !== AES256_CBC) {
|
|
629
|
-
throw new (0,
|
|
629
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
630
630
|
}
|
|
631
631
|
if (startKey !== START_KEY_SHA256) {
|
|
632
|
-
throw new (0,
|
|
632
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
633
633
|
}
|
|
634
634
|
if (!_optionalChain([checksumType, 'optionalAccess', _8 => _8.endsWith, 'call', _9 => _9(CHECKSUM_SHA256_1K)])) {
|
|
635
|
-
throw new (0,
|
|
635
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
636
636
|
}
|
|
637
637
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
638
638
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -640,10 +640,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
640
640
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
641
641
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
642
642
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
643
|
-
throw new (0,
|
|
643
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
644
644
|
}
|
|
645
645
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
646
|
-
throw new (0,
|
|
646
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
647
647
|
}
|
|
648
648
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
649
649
|
}
|
|
@@ -676,11 +676,11 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
676
676
|
for (const entry of entries) {
|
|
677
677
|
const file = zip.file(entry.path);
|
|
678
678
|
if (!file) {
|
|
679
|
-
throw new (0,
|
|
679
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
680
680
|
}
|
|
681
681
|
const plain4 = decryptEntry(await file.async("nodebuffer"), entry, startKey);
|
|
682
682
|
if (!plain4) {
|
|
683
|
-
throw new (0,
|
|
683
|
+
throw new (0, _chunkPMULUMUFcjs.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.");
|
|
684
684
|
}
|
|
685
685
|
decrypted.push({ path: entry.path, plain: plain4 });
|
|
686
686
|
}
|
|
@@ -728,10 +728,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
728
728
|
const xml = await file.async("text");
|
|
729
729
|
if (decompressed) {
|
|
730
730
|
decompressed.total += xml.length * 2;
|
|
731
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
731
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkPMULUMUFcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
732
732
|
}
|
|
733
733
|
const parser = createXmlParser();
|
|
734
|
-
const doc = parser.parseFromString(
|
|
734
|
+
const doc = parser.parseFromString(_chunkPMULUMUFcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
735
735
|
if (!doc.documentElement) continue;
|
|
736
736
|
const domDoc = doc;
|
|
737
737
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -1531,7 +1531,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1531
1531
|
|
|
1532
1532
|
// src/hwpx/table-build.ts
|
|
1533
1533
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1534
|
-
const table2 =
|
|
1534
|
+
const table2 = _chunk7WV3WETFcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1535
1535
|
if (state.caption) table2.caption = state.caption;
|
|
1536
1536
|
if (state.sourceId) table2.sourceId = state.sourceId;
|
|
1537
1537
|
if (_optionalChain([state, 'access', _21 => _21.captionBlocks, 'optionalAccess', _22 => _22.length])) table2.captionBlocks = state.captionBlocks;
|
|
@@ -1603,7 +1603,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1603
1603
|
const cell2 = parentTable.cell;
|
|
1604
1604
|
(cell2.blocks ??= []).push(block);
|
|
1605
1605
|
cell2.hasStructure = true;
|
|
1606
|
-
let flat =
|
|
1606
|
+
let flat = _chunk7WV3WETFcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1607
1607
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1608
1608
|
if (flat) {
|
|
1609
1609
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -1837,7 +1837,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
1837
1837
|
const tkids = rc.childNodes;
|
|
1838
1838
|
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _33 => _33.length]), () => ( 0))); k++) {
|
|
1839
1839
|
const tk = tkids[k];
|
|
1840
|
-
if (tk.nodeType === 3 || tk.nodeType === 4) text +=
|
|
1840
|
+
if (tk.nodeType === 3 || tk.nodeType === 4) text += _chunk7WV3WETFcjs.escapeLiteralDollar.call(void 0, tk.textContent || "");
|
|
1841
1841
|
else if (tk.nodeType === 1) {
|
|
1842
1842
|
const ttag = (tk.tagName || tk.localName || "").replace(/^[^:]+:/, "");
|
|
1843
1843
|
if (ttag === "tab" || ttag === "fwSpace" || ttag === "hwSpace" || ttag === "nbSpace") text += " ";
|
|
@@ -1904,7 +1904,7 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
1904
1904
|
// src/hwpx/section-walker.ts
|
|
1905
1905
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
1906
1906
|
const parser = createXmlParser(warnings);
|
|
1907
|
-
const doc = parser.parseFromString(
|
|
1907
|
+
const doc = parser.parseFromString(_chunkPMULUMUFcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
1908
1908
|
if (!doc.documentElement) return [];
|
|
1909
1909
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
1910
1910
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -2019,8 +2019,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2019
2019
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
2020
2020
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
2021
2021
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
2022
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
2023
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
2022
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunk7WV3WETFcjs.MAX_COLS);
|
|
2023
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunk7WV3WETFcjs.MAX_ROWS);
|
|
2024
2024
|
}
|
|
2025
2025
|
break;
|
|
2026
2026
|
case "p": {
|
|
@@ -2333,7 +2333,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
2333
2333
|
const sink = [];
|
|
2334
2334
|
const st = { rows: [], currentRow: [], cell: null, sourceId: _nullishCoalesce(el.getAttribute("id"), () => ( void 0)) };
|
|
2335
2335
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2336
|
-
let flat =
|
|
2336
|
+
let flat = _chunk7WV3WETFcjs.convertTableToText.call(void 0, st.rows);
|
|
2337
2337
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2338
2338
|
const built = [];
|
|
2339
2339
|
completeTable(st, [], built, ctx);
|
|
@@ -2519,7 +2519,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2519
2519
|
let url = (ch.textContent || "").trim();
|
|
2520
2520
|
if (!url) continue;
|
|
2521
2521
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2522
|
-
const safe =
|
|
2522
|
+
const safe = _chunkPMULUMUFcjs.sanitizeHref.call(void 0, url);
|
|
2523
2523
|
if (safe) return safe;
|
|
2524
2524
|
}
|
|
2525
2525
|
return void 0;
|
|
@@ -2663,7 +2663,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2663
2663
|
_optionalChain([ctx, 'access', _92 => _92.warnings, 'optionalAccess', _93 => _93.push, 'call', _94 => _94({ page: ctx.page, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
|
|
2664
2664
|
}
|
|
2665
2665
|
} else {
|
|
2666
|
-
text +=
|
|
2666
|
+
text += _chunk7WV3WETFcjs.escapeLiteralDollar.call(void 0, t.replace(/\x1E/g, ""));
|
|
2667
2667
|
}
|
|
2668
2668
|
continue;
|
|
2669
2669
|
}
|
|
@@ -2711,7 +2711,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2711
2711
|
case "hyperlink": {
|
|
2712
2712
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2713
2713
|
if (url) {
|
|
2714
|
-
const safe =
|
|
2714
|
+
const safe = _chunkPMULUMUFcjs.sanitizeHref.call(void 0, url);
|
|
2715
2715
|
if (safe) href = safe;
|
|
2716
2716
|
}
|
|
2717
2717
|
walk(child, depth + 1);
|
|
@@ -2939,7 +2939,7 @@ function decompressStream(data) {
|
|
|
2939
2939
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
2940
2940
|
}
|
|
2941
2941
|
function parseFileHeader(data) {
|
|
2942
|
-
if (data.length < 40) throw new (0,
|
|
2942
|
+
if (data.length < 40) throw new (0, _chunkPMULUMUFcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
2943
2943
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
2944
2944
|
return {
|
|
2945
2945
|
signature: sig,
|
|
@@ -3433,13 +3433,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3433
3433
|
}
|
|
3434
3434
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3435
3435
|
for (const path of allCandidates) {
|
|
3436
|
-
if (
|
|
3436
|
+
if (_chunkPMULUMUFcjs.isPathTraversal.call(void 0, path)) continue;
|
|
3437
3437
|
const file = zip.file(path);
|
|
3438
3438
|
if (!file) continue;
|
|
3439
3439
|
try {
|
|
3440
3440
|
const data = await file.async("uint8array");
|
|
3441
3441
|
decompressed.total += data.length;
|
|
3442
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3442
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkPMULUMUFcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3443
3443
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3444
3444
|
const mimeType = imageExtToMime(ext);
|
|
3445
3445
|
imageIndex++;
|
|
@@ -3449,7 +3449,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3449
3449
|
usedPaths.add(path);
|
|
3450
3450
|
break;
|
|
3451
3451
|
} catch (err) {
|
|
3452
|
-
if (err instanceof
|
|
3452
|
+
if (err instanceof _chunkPMULUMUFcjs.KordocError) throw err;
|
|
3453
3453
|
}
|
|
3454
3454
|
}
|
|
3455
3455
|
if (!img) _optionalChain([warnings, 'optionalAccess', _108 => _108.push, 'call', _109 => _109({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
@@ -3469,11 +3469,11 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3469
3469
|
if (sweepUnreferenced) {
|
|
3470
3470
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3471
3471
|
for (const file of binEntries) {
|
|
3472
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3472
|
+
if (file.dir || usedPaths.has(file.name) || _chunkPMULUMUFcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3473
3473
|
try {
|
|
3474
3474
|
const data = await file.async("uint8array");
|
|
3475
3475
|
decompressed.total += data.length;
|
|
3476
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3476
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkPMULUMUFcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3477
3477
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3478
3478
|
let mimeType = imageExtToMime(ext);
|
|
3479
3479
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3487,7 +3487,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3487
3487
|
images.push(img);
|
|
3488
3488
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3489
3489
|
} catch (err) {
|
|
3490
|
-
if (err instanceof
|
|
3490
|
+
if (err instanceof _chunkPMULUMUFcjs.KordocError) throw err;
|
|
3491
3491
|
_optionalChain([warnings, 'optionalAccess', _110 => _110.push, 'call', _111 => _111({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3492
3492
|
}
|
|
3493
3493
|
}
|
|
@@ -3538,7 +3538,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3538
3538
|
}
|
|
3539
3539
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3540
3540
|
const name = new TextDecoder().decode(nameBytes);
|
|
3541
|
-
if (
|
|
3541
|
+
if (_chunkPMULUMUFcjs.isPathTraversal.call(void 0, name)) {
|
|
3542
3542
|
pos = fileStart + compSize;
|
|
3543
3543
|
continue;
|
|
3544
3544
|
}
|
|
@@ -3556,7 +3556,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3556
3556
|
continue;
|
|
3557
3557
|
}
|
|
3558
3558
|
totalDecompressed += content.length * 2;
|
|
3559
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3559
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkPMULUMUFcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3560
3560
|
sectionNum++;
|
|
3561
3561
|
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3562
3562
|
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
@@ -3565,9 +3565,9 @@ function extractFromBrokenZip(buffer) {
|
|
|
3565
3565
|
continue;
|
|
3566
3566
|
}
|
|
3567
3567
|
}
|
|
3568
|
-
if (blocks.length === 0) throw new (0,
|
|
3568
|
+
if (blocks.length === 0) throw new (0, _chunkPMULUMUFcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3569
3569
|
applyPageText(blocks, shared);
|
|
3570
|
-
const markdown =
|
|
3570
|
+
const markdown = _chunk7WV3WETFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3571
3571
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3572
3572
|
}
|
|
3573
3573
|
async function readKordocLayout(zip) {
|
|
@@ -3592,18 +3592,18 @@ async function resolveSectionPaths(zip) {
|
|
|
3592
3592
|
if (paths.length > 0) return paths;
|
|
3593
3593
|
}
|
|
3594
3594
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3595
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3595
|
+
return sectionFiles.map((f) => f.name).sort(_chunkPMULUMUFcjs.compareSectionPaths);
|
|
3596
3596
|
}
|
|
3597
3597
|
function parseSectionPathsFromManifest(xml) {
|
|
3598
3598
|
const parser = createXmlParser();
|
|
3599
|
-
const doc = parser.parseFromString(
|
|
3599
|
+
const doc = parser.parseFromString(_chunkPMULUMUFcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3600
3600
|
const items = doc.getElementsByTagName("opf:item");
|
|
3601
3601
|
const spine = doc.getElementsByTagName("opf:itemref");
|
|
3602
3602
|
const idToHref = /* @__PURE__ */ new Map();
|
|
3603
3603
|
for (let i = 0; i < items.length; i++) {
|
|
3604
3604
|
const item = items[i];
|
|
3605
3605
|
const id = item.getAttribute("id") || "";
|
|
3606
|
-
const href =
|
|
3606
|
+
const href = _chunkPMULUMUFcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3607
3607
|
if (id && href) idToHref.set(id, href);
|
|
3608
3608
|
}
|
|
3609
3609
|
if (spine.length > 0) {
|
|
@@ -3614,7 +3614,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3614
3614
|
}
|
|
3615
3615
|
if (ordered.length > 0) return ordered;
|
|
3616
3616
|
}
|
|
3617
|
-
return Array.from(idToHref.values()).sort(
|
|
3617
|
+
return Array.from(idToHref.values()).sort(_chunkPMULUMUFcjs.compareSectionPaths);
|
|
3618
3618
|
}
|
|
3619
3619
|
|
|
3620
3620
|
// src/hwpx/metadata.ts
|
|
@@ -3626,7 +3626,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3626
3626
|
const xml = await file.async("text");
|
|
3627
3627
|
if (decompressed) {
|
|
3628
3628
|
decompressed.total += xml.length * 2;
|
|
3629
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3629
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkPMULUMUFcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3630
3630
|
}
|
|
3631
3631
|
return xml;
|
|
3632
3632
|
};
|
|
@@ -3648,7 +3648,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3648
3648
|
}
|
|
3649
3649
|
}
|
|
3650
3650
|
function parseOpfMetadata(xml, metadata) {
|
|
3651
|
-
const root = createXmlParser().parseFromString(
|
|
3651
|
+
const root = createXmlParser().parseFromString(_chunkPMULUMUFcjs.stripDtd.call(void 0, xml), "text/xml").documentElement;
|
|
3652
3652
|
const md2 = root ? findChildByLocalName(root, "metadata") : null;
|
|
3653
3653
|
if (!md2) return;
|
|
3654
3654
|
let title;
|
|
@@ -3681,7 +3681,7 @@ function isoDate(s) {
|
|
|
3681
3681
|
}
|
|
3682
3682
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3683
3683
|
const parser = createXmlParser();
|
|
3684
|
-
const doc = parser.parseFromString(
|
|
3684
|
+
const doc = parser.parseFromString(_chunkPMULUMUFcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3685
3685
|
if (!doc.documentElement) return;
|
|
3686
3686
|
const getText = (tagNames) => {
|
|
3687
3687
|
for (const tag of tagNames) {
|
|
@@ -3720,7 +3720,7 @@ function assignSectionPage(block, sectionNum) {
|
|
|
3720
3720
|
}
|
|
3721
3721
|
}
|
|
3722
3722
|
async function parseHwpxDocument(buffer, options) {
|
|
3723
|
-
|
|
3723
|
+
_chunkPMULUMUFcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3724
3724
|
let zip;
|
|
3725
3725
|
try {
|
|
3726
3726
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3729,7 +3729,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3729
3729
|
}
|
|
3730
3730
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3731
3731
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3732
|
-
throw new (0,
|
|
3732
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3733
3733
|
}
|
|
3734
3734
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3735
3735
|
if (manifestFile) {
|
|
@@ -3748,7 +3748,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3748
3748
|
}
|
|
3749
3749
|
}
|
|
3750
3750
|
const hpf = await _optionalChain([zip, 'access', _137 => _137.file, 'call', _138 => _138("Contents/content.hpf"), 'optionalAccess', _139 => _139.async, 'call', _140 => _140("text"), 'access', _141 => _141.catch, 'call', _142 => _142(() => "")]);
|
|
3751
|
-
throw new (0,
|
|
3751
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(
|
|
3752
3752
|
/\bdistribution="1"/.test(_nullishCoalesce(hpf, () => ( ""))) ? "\uBC30\uD3EC\uC6A9\uC73C\uB85C \uC554\uD638\uD654\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4 (\uBC30\uD3EC\uC6A9 \uBCF5\uD638\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC74C). \uD55C\uCEF4\uC624\uD53C\uC2A4\uC5D0\uC11C \uC77C\uBC18 \uBB38\uC11C\uB85C \uC800\uC7A5\uD55C \uB4A4 \uC5EC\uC138\uC694." : "\uC554\uD638\uB85C \uBCF4\uD638\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4. password \uC635\uC158\uC5D0 \uC5F4\uAE30 \uC554\uD638\uB97C \uC9C0\uC815\uD558\uC138\uC694."
|
|
3753
3753
|
);
|
|
3754
3754
|
}
|
|
@@ -3760,7 +3760,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3760
3760
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3761
3761
|
const warnings = [];
|
|
3762
3762
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3763
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3763
|
+
if (sectionPaths.length === 0) throw new (0, _chunkPMULUMUFcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3764
3764
|
let allBlocks = [];
|
|
3765
3765
|
const shared = createSectionShared();
|
|
3766
3766
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
@@ -3806,7 +3806,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3806
3806
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _149 => _149.pages]));
|
|
3807
3807
|
detectHwpxHeadings(blocks, styleMap);
|
|
3808
3808
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3809
|
-
const markdown =
|
|
3809
|
+
const markdown = _chunk7WV3WETFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3810
3810
|
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 };
|
|
3811
3811
|
}
|
|
3812
3812
|
|
|
@@ -4573,7 +4573,7 @@ function decryptPasswordStream(raw, password) {
|
|
|
4573
4573
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4574
4574
|
var TAG_ID_MAPPINGS2 = 17;
|
|
4575
4575
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4576
|
-
const wrong = () => new (0,
|
|
4576
|
+
const wrong = () => new (0, _chunkPMULUMUFcjs.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.");
|
|
4577
4577
|
let records;
|
|
4578
4578
|
try {
|
|
4579
4579
|
records = readRecords3(data);
|
|
@@ -4585,7 +4585,7 @@ function assertDecryptedDocInfo(data, readRecords3) {
|
|
|
4585
4585
|
}
|
|
4586
4586
|
function assertSupportedEncryptVersion(version) {
|
|
4587
4587
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4588
|
-
throw new (0,
|
|
4588
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(
|
|
4589
4589
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4590
4590
|
);
|
|
4591
4591
|
}
|
|
@@ -5025,7 +5025,7 @@ function emitParagraphBlocks(p) {
|
|
|
5025
5025
|
return blocks;
|
|
5026
5026
|
}
|
|
5027
5027
|
function tableFlatText(table2) {
|
|
5028
|
-
const flat =
|
|
5028
|
+
const flat = _chunk7WV3WETFcjs.convertTableToText.call(void 0, table2.cells);
|
|
5029
5029
|
return table2.caption ? table2.caption + (flat ? "\n" + flat : "") : flat;
|
|
5030
5030
|
}
|
|
5031
5031
|
function blocksPlainText(blocks, sep) {
|
|
@@ -5105,8 +5105,8 @@ ${cell2.text}` : cell2.text;
|
|
|
5105
5105
|
}
|
|
5106
5106
|
function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
5107
5107
|
for (const c of cells) {
|
|
5108
|
-
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1,
|
|
5109
|
-
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1,
|
|
5108
|
+
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1, _chunk7WV3WETFcjs.MAX_ROWS));
|
|
5109
|
+
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1, _chunk7WV3WETFcjs.MAX_COLS));
|
|
5110
5110
|
}
|
|
5111
5111
|
const placed = resolveCellOverlaps(cells, rows, cols);
|
|
5112
5112
|
const byRow = Array.from({ length: rows }, () => []);
|
|
@@ -5114,7 +5114,7 @@ function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
|
5114
5114
|
const r = _nullishCoalesce(c.rowAddr, () => ( 0));
|
|
5115
5115
|
if (r < rows && (_nullishCoalesce(c.colAddr, () => ( 0))) < cols) byRow[r].push(c);
|
|
5116
5116
|
}
|
|
5117
|
-
const table2 =
|
|
5117
|
+
const table2 = _chunk7WV3WETFcjs.buildTable.call(void 0, byRow, { keepAnchoredEmptyCols });
|
|
5118
5118
|
if (table2.rows === 0) return null;
|
|
5119
5119
|
for (const c of placed) {
|
|
5120
5120
|
if (!_optionalChain([c, 'access', _156 => _156.blocks, 'optionalAccess', _157 => _157.length]) && !c.isHeader) continue;
|
|
@@ -5316,7 +5316,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5316
5316
|
continue;
|
|
5317
5317
|
}
|
|
5318
5318
|
if (!ctrl.href) continue;
|
|
5319
|
-
const href =
|
|
5319
|
+
const href = _chunkPMULUMUFcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5320
5320
|
if (!href) continue;
|
|
5321
5321
|
if (!anchor.trim() || anchor.includes(INLINE_TABLE_MARK) || anchor.includes(LEADER_TAB_MARK)) continue;
|
|
5322
5322
|
text = text.slice(0, r.start) + `[${anchor}](${href})` + text.slice(r.end);
|
|
@@ -5530,7 +5530,7 @@ function hyperlinkUrlFromCommand(command) {
|
|
|
5530
5530
|
}
|
|
5531
5531
|
var A4_HEIGHT = 84188;
|
|
5532
5532
|
function keepUnlessPageSpanning(table2, cells) {
|
|
5533
|
-
if (!cells.some((c) => c.pageSpanning))
|
|
5533
|
+
if (!cells.some((c) => c.pageSpanning)) _chunk7WV3WETFcjs.markNonLayoutTable.call(void 0, table2);
|
|
5534
5534
|
}
|
|
5535
5535
|
function parseTableControl(ctrl, records, ctx) {
|
|
5536
5536
|
if (ctx.depth >= MAX_NEST_DEPTH) return null;
|
|
@@ -5542,8 +5542,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5542
5542
|
let tableIdx = -1;
|
|
5543
5543
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5544
5544
|
if (records[i2].tagId === TAG_TABLE && records[i2].level === directLevel && records[i2].data.length >= 8) {
|
|
5545
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5546
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5545
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunk7WV3WETFcjs.MAX_ROWS);
|
|
5546
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunk7WV3WETFcjs.MAX_COLS);
|
|
5547
5547
|
tableIdx = i2;
|
|
5548
5548
|
break;
|
|
5549
5549
|
}
|
|
@@ -5587,11 +5587,11 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5587
5587
|
return table3;
|
|
5588
5588
|
}
|
|
5589
5589
|
if (rows === 0 || cols === 0) {
|
|
5590
|
-
rows = Math.min(cells.length,
|
|
5590
|
+
rows = Math.min(cells.length, _chunk7WV3WETFcjs.MAX_ROWS);
|
|
5591
5591
|
cols = 1;
|
|
5592
5592
|
}
|
|
5593
5593
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5594
|
-
const table2 =
|
|
5594
|
+
const table2 = _chunk7WV3WETFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5595
5595
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5596
5596
|
if (sourceId && table2.rows > 0) table2.sourceId = sourceId;
|
|
5597
5597
|
keepUnlessPageSpanning(table2, cells);
|
|
@@ -5610,8 +5610,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5610
5610
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5611
5611
|
const cs = rec.data.readUInt16LE(12);
|
|
5612
5612
|
const rs = rec.data.readUInt16LE(14);
|
|
5613
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5614
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5613
|
+
if (cs > 0) colSpan = Math.min(cs, _chunk7WV3WETFcjs.MAX_COLS);
|
|
5614
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunk7WV3WETFcjs.MAX_ROWS);
|
|
5615
5615
|
}
|
|
5616
5616
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5617
5617
|
const { text, hasStructure } = cellTextFromBlocks(blocks);
|
|
@@ -5754,7 +5754,7 @@ function openHwp5Container(buffer, options) {
|
|
|
5754
5754
|
lenientCfb = parseLenientCfb(buffer);
|
|
5755
5755
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
5756
5756
|
} catch (e24) {
|
|
5757
|
-
throw new (0,
|
|
5757
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
5758
5758
|
}
|
|
5759
5759
|
}
|
|
5760
5760
|
const readRawStream = (path) => {
|
|
@@ -5765,14 +5765,14 @@ function openHwp5Container(buffer, options) {
|
|
|
5765
5765
|
return lenientCfb.findStream(path);
|
|
5766
5766
|
};
|
|
5767
5767
|
const headerData = readRawStream("/FileHeader");
|
|
5768
|
-
if (!headerData) throw new (0,
|
|
5768
|
+
if (!headerData) throw new (0, _chunkPMULUMUFcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
5769
5769
|
const header = parseFileHeader(headerData);
|
|
5770
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
5771
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
5770
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkPMULUMUFcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
5771
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkPMULUMUFcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
5772
5772
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
5773
5773
|
if (encrypted) {
|
|
5774
5774
|
if (!_optionalChain([options, 'optionalAccess', _180 => _180.password])) {
|
|
5775
|
-
throw new (0,
|
|
5775
|
+
throw new (0, _chunkPMULUMUFcjs.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.");
|
|
5776
5776
|
}
|
|
5777
5777
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
5778
5778
|
}
|
|
@@ -5786,12 +5786,12 @@ function openHwp5Container(buffer, options) {
|
|
|
5786
5786
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
5787
5787
|
if (encrypted) {
|
|
5788
5788
|
const rawDocInfo = findStream("/DocInfo");
|
|
5789
|
-
if (!rawDocInfo) throw new (0,
|
|
5789
|
+
if (!rawDocInfo) throw new (0, _chunkPMULUMUFcjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
5790
5790
|
let docInfoData;
|
|
5791
5791
|
try {
|
|
5792
5792
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
5793
5793
|
} catch (e25) {
|
|
5794
|
-
throw new (0,
|
|
5794
|
+
throw new (0, _chunkPMULUMUFcjs.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.");
|
|
5795
5795
|
}
|
|
5796
5796
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
5797
5797
|
}
|
|
@@ -5816,10 +5816,10 @@ function readHwp5SectionRecords(c, sections, warnings) {
|
|
|
5816
5816
|
try {
|
|
5817
5817
|
const data = !c.distribution && c.compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
5818
5818
|
totalDecompressed += data.length;
|
|
5819
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
5819
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkPMULUMUFcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
5820
5820
|
out.push(readRecords(data));
|
|
5821
5821
|
} catch (secErr) {
|
|
5822
|
-
if (secErr instanceof
|
|
5822
|
+
if (secErr instanceof _chunkPMULUMUFcjs.KordocError) throw secErr;
|
|
5823
5823
|
out.push(null);
|
|
5824
5824
|
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" });
|
|
5825
5825
|
}
|
|
@@ -5838,7 +5838,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
5838
5838
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
5839
5839
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
5840
5840
|
const sections = readHwp5SectionStreams(c);
|
|
5841
|
-
if (sections.length === 0) throw new (0,
|
|
5841
|
+
if (sections.length === 0) throw new (0, _chunkPMULUMUFcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
5842
5842
|
const sectionRecords = readHwp5SectionRecords(c, sections, warnings);
|
|
5843
5843
|
const sectionDetects = sectionRecords.map((r) => r ? detectHwp5SectionPages(r) : null);
|
|
5844
5844
|
const sectionTableIds = [];
|
|
@@ -5882,7 +5882,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
5882
5882
|
parsedSections++;
|
|
5883
5883
|
_optionalChain([options, 'optionalAccess', _185 => _185.onProgress, 'optionalCall', _186 => _186(parsedSections, sections.length)]);
|
|
5884
5884
|
} catch (secErr) {
|
|
5885
|
-
if (secErr instanceof
|
|
5885
|
+
if (secErr instanceof _chunkPMULUMUFcjs.KordocError) throw secErr;
|
|
5886
5886
|
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" });
|
|
5887
5887
|
} finally {
|
|
5888
5888
|
pageBase += detect2.pages;
|
|
@@ -5893,9 +5893,9 @@ function parseHwp5Document(buffer, options) {
|
|
|
5893
5893
|
}
|
|
5894
5894
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
5895
5895
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter);
|
|
5896
|
-
let flatBlocks =
|
|
5896
|
+
let flatBlocks = _chunk7WV3WETFcjs.flattenLayoutTables.call(void 0, blocks);
|
|
5897
5897
|
if (_optionalChain([options, 'optionalAccess', _187 => _187.dedupeRunningHeaders])) {
|
|
5898
|
-
const deduped =
|
|
5898
|
+
const deduped = _chunk7WV3WETFcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
5899
5899
|
const removed = flatBlocks.length - deduped.length;
|
|
5900
5900
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
5901
5901
|
flatBlocks = deduped;
|
|
@@ -5904,10 +5904,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
5904
5904
|
detectHwp5Headings(flatBlocks, docInfo);
|
|
5905
5905
|
}
|
|
5906
5906
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
5907
|
-
let markdown =
|
|
5907
|
+
let markdown = _chunk7WV3WETFcjs.blocksToMarkdown.call(void 0, flatBlocks);
|
|
5908
5908
|
if (_optionalChain([options, 'optionalAccess', _188 => _188.inlineImages]) && options.images !== false && images.length > 0) {
|
|
5909
5909
|
try {
|
|
5910
|
-
markdown =
|
|
5910
|
+
markdown = _chunk7WV3WETFcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
5911
5911
|
} catch (inlineErr) {
|
|
5912
5912
|
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" });
|
|
5913
5913
|
}
|
|
@@ -6106,7 +6106,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
6106
6106
|
if (!raw) break;
|
|
6107
6107
|
const content = compressed ? decompressStream(raw) : raw;
|
|
6108
6108
|
totalDecompressed += content.length;
|
|
6109
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6109
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkPMULUMUFcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6110
6110
|
sections.push({ idx: i, content });
|
|
6111
6111
|
}
|
|
6112
6112
|
if (sections.length === 0) {
|
|
@@ -6118,7 +6118,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
6118
6118
|
if (raw) {
|
|
6119
6119
|
const content = compressed ? decompressStream(raw) : raw;
|
|
6120
6120
|
totalDecompressed += content.length;
|
|
6121
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6121
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkPMULUMUFcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6122
6122
|
sections.push({ idx, content });
|
|
6123
6123
|
}
|
|
6124
6124
|
}
|
|
@@ -6135,7 +6135,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
6135
6135
|
try {
|
|
6136
6136
|
const content = decryptViewText(raw, compressed);
|
|
6137
6137
|
totalDecompressed += content.length;
|
|
6138
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6138
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkPMULUMUFcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6139
6139
|
sections.push({ idx: i, content });
|
|
6140
6140
|
} catch (e32) {
|
|
6141
6141
|
break;
|
|
@@ -18613,25 +18613,25 @@ function desEcbDecrypt(data, key) {
|
|
|
18613
18613
|
}
|
|
18614
18614
|
function readLayout(data) {
|
|
18615
18615
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
18616
|
-
throw new (0,
|
|
18616
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
18617
18617
|
}
|
|
18618
18618
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
18619
18619
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
18620
18620
|
if (payloadOffset >= data.length) {
|
|
18621
|
-
throw new (0,
|
|
18621
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18622
18622
|
}
|
|
18623
18623
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
18624
18624
|
}
|
|
18625
18625
|
function decryptHwp3Document(input, password) {
|
|
18626
18626
|
const { payloadOffset, compressed } = readLayout(input);
|
|
18627
18627
|
if (!compressed) {
|
|
18628
|
-
throw new (0,
|
|
18628
|
+
throw new (0, _chunkPMULUMUFcjs.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)");
|
|
18629
18629
|
}
|
|
18630
18630
|
const source = Buffer.from(input);
|
|
18631
18631
|
const payload = source.subarray(payloadOffset);
|
|
18632
18632
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
18633
18633
|
if (aligned.length === 0) {
|
|
18634
|
-
throw new (0,
|
|
18634
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
18635
18635
|
}
|
|
18636
18636
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
18637
18637
|
let inflated;
|
|
@@ -18639,14 +18639,14 @@ function decryptHwp3Document(input, password) {
|
|
|
18639
18639
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
18640
18640
|
} catch (err) {
|
|
18641
18641
|
if (_optionalChain([err, 'optionalAccess', _209 => _209.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18642
|
-
throw new (0,
|
|
18642
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(
|
|
18643
18643
|
`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`
|
|
18644
18644
|
);
|
|
18645
18645
|
}
|
|
18646
|
-
throw new (0,
|
|
18646
|
+
throw new (0, _chunkPMULUMUFcjs.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.");
|
|
18647
18647
|
}
|
|
18648
18648
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
18649
|
-
throw new (0,
|
|
18649
|
+
throw new (0, _chunkPMULUMUFcjs.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.");
|
|
18650
18650
|
}
|
|
18651
18651
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
18652
18652
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -18703,9 +18703,9 @@ function hwp3CellGrid(info, count) {
|
|
|
18703
18703
|
const col = edgeAt(xs, g3.x), row = edgeAt(ys, g3.y);
|
|
18704
18704
|
const c2 = nextX[k] !== void 0 ? edgeAt(xs, nextX[k]) : xs.length - 1;
|
|
18705
18705
|
const r2 = nextY[k] !== void 0 ? edgeAt(ys, nextY[k]) : ys.length - 1;
|
|
18706
|
-
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row),
|
|
18706
|
+
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row), _chunk7WV3WETFcjs.MAX_ROWS), colSpan: Math.min(Math.max(1, c2 - col), _chunk7WV3WETFcjs.MAX_COLS) };
|
|
18707
18707
|
});
|
|
18708
|
-
return { rows: Math.min(Math.max(1, ys.length - 1),
|
|
18708
|
+
return { rows: Math.min(Math.max(1, ys.length - 1), _chunk7WV3WETFcjs.MAX_ROWS), cols: Math.min(Math.max(1, xs.length - 1), _chunk7WV3WETFcjs.MAX_COLS), cells };
|
|
18709
18709
|
}
|
|
18710
18710
|
|
|
18711
18711
|
// src/hwp3/parser.ts
|
|
@@ -18746,7 +18746,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
18746
18746
|
let source = Buffer.from(buffer);
|
|
18747
18747
|
if (isEncryptedHwp3(source)) {
|
|
18748
18748
|
if (!_optionalChain([options, 'optionalAccess', _210 => _210.password])) {
|
|
18749
|
-
throw new (0,
|
|
18749
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(
|
|
18750
18750
|
"\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."
|
|
18751
18751
|
);
|
|
18752
18752
|
}
|
|
@@ -18763,10 +18763,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
18763
18763
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
18764
18764
|
} catch (err) {
|
|
18765
18765
|
if (_optionalChain([err, 'optionalAccess', _211 => _211.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18766
|
-
throw new (0,
|
|
18766
|
+
throw new (0, _chunkPMULUMUFcjs.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`);
|
|
18767
18767
|
}
|
|
18768
18768
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
18769
|
-
throw new (0,
|
|
18769
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
18770
18770
|
}
|
|
18771
18771
|
} else {
|
|
18772
18772
|
body = tail;
|
|
@@ -18783,7 +18783,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
18783
18783
|
message: `HWP3 paragraph stream \uB3C4\uC911 \uD30C\uC2F1 \uC911\uB2E8: ${err instanceof Error ? err.message : String(err)}`
|
|
18784
18784
|
});
|
|
18785
18785
|
}
|
|
18786
|
-
const blocks =
|
|
18786
|
+
const blocks = _chunk7WV3WETFcjs.flattenLayoutTables.call(void 0, [...ctx.headerBlocks, ...bodyBlocks, ...ctx.footerBlocks]);
|
|
18787
18787
|
const metadata = {
|
|
18788
18788
|
title: header.title || void 0,
|
|
18789
18789
|
author: header.author || void 0,
|
|
@@ -18792,7 +18792,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
18792
18792
|
version: "3.0"
|
|
18793
18793
|
};
|
|
18794
18794
|
return {
|
|
18795
|
-
markdown:
|
|
18795
|
+
markdown: _chunk7WV3WETFcjs.blocksToMarkdown.call(void 0, blocks),
|
|
18796
18796
|
blocks,
|
|
18797
18797
|
metadata,
|
|
18798
18798
|
warnings: warnings.length ? warnings : void 0
|
|
@@ -18878,7 +18878,7 @@ function parseCharStream(reader, charCount, ctx, para2) {
|
|
|
18878
18878
|
continue;
|
|
18879
18879
|
}
|
|
18880
18880
|
if (ch >= 32) {
|
|
18881
|
-
para2.text +=
|
|
18881
|
+
para2.text += _chunk7WV3WETFcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(decodeJohabText(ch), () => ( "")));
|
|
18882
18882
|
continue;
|
|
18883
18883
|
}
|
|
18884
18884
|
if (ch === 9) {
|
|
@@ -19108,7 +19108,7 @@ function isDistributionSentinel(markdown) {
|
|
|
19108
19108
|
|
|
19109
19109
|
// src/xlsx/sheet-blocks.ts
|
|
19110
19110
|
function sheetRowCap(cols) {
|
|
19111
|
-
return Math.max(
|
|
19111
|
+
return Math.max(_chunk7WV3WETFcjs.MAX_ROWS, Math.floor(_chunk7WV3WETFcjs.MAX_TABLE_CELLS / Math.max(1, cols)));
|
|
19112
19112
|
}
|
|
19113
19113
|
function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols) {
|
|
19114
19114
|
const blocks = [];
|
|
@@ -19139,7 +19139,7 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19139
19139
|
if (keepRows.length > rowCap) {
|
|
19140
19140
|
warnings.push({
|
|
19141
19141
|
page: sheetIndex + 1,
|
|
19142
|
-
message: `\uC2DC\uD2B8 "${sheetName}": ${keepRows.length}\uD589 \xD7 ${keepCols.length}\uC5F4 \uC911 \uC55E ${rowCap}\uD589\uB9CC \uD45C\uB85C \uB0C8\uC2B5\uB2C8\uB2E4 (\uD45C \uCE78 \uC0C1\uD55C ${
|
|
19142
|
+
message: `\uC2DC\uD2B8 "${sheetName}": ${keepRows.length}\uD589 \xD7 ${keepCols.length}\uC5F4 \uC911 \uC55E ${rowCap}\uD589\uB9CC \uD45C\uB85C \uB0C8\uC2B5\uB2C8\uB2E4 (\uD45C \uCE78 \uC0C1\uD55C ${_chunk7WV3WETFcjs.MAX_TABLE_CELLS})`,
|
|
19143
19143
|
code: "TRUNCATED_TABLE"
|
|
19144
19144
|
});
|
|
19145
19145
|
keepRows.length = rowCap;
|
|
@@ -19173,14 +19173,14 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19173
19173
|
}
|
|
19174
19174
|
cellRows.push(row);
|
|
19175
19175
|
}
|
|
19176
|
-
const table2 =
|
|
19176
|
+
const table2 = _chunk7WV3WETFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols, maxRows: rowCap });
|
|
19177
19177
|
if (table2.rows > 0) blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
19178
19178
|
return blocks;
|
|
19179
19179
|
}
|
|
19180
19180
|
|
|
19181
19181
|
// src/xlsx/parser.ts
|
|
19182
19182
|
var MAX_SHEETS = 100;
|
|
19183
|
-
var MAX_DECOMPRESS_SIZE4 =
|
|
19183
|
+
var MAX_DECOMPRESS_SIZE4 = _chunkPMULUMUFcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
19184
19184
|
var MAX_SHEET_ROWS = 1048576;
|
|
19185
19185
|
function cleanNumericValue(raw) {
|
|
19186
19186
|
if (!/^-?\d+\.\d+$/.test(raw)) return raw;
|
|
@@ -19217,7 +19217,7 @@ function getTextContent(el) {
|
|
|
19217
19217
|
return _nullishCoalesce(_optionalChain([el, 'access', _227 => _227.textContent, 'optionalAccess', _228 => _228.trim, 'call', _229 => _229()]), () => ( ""));
|
|
19218
19218
|
}
|
|
19219
19219
|
function parseXml(text) {
|
|
19220
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19220
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkPMULUMUFcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19221
19221
|
}
|
|
19222
19222
|
function collectRichText(root) {
|
|
19223
19223
|
let out = "";
|
|
@@ -19381,7 +19381,7 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19381
19381
|
for (const cellEl of cells) {
|
|
19382
19382
|
const ref = cellEl.getAttribute("r");
|
|
19383
19383
|
const pos = ref !== null ? parseCellRef(ref) : { col: prevCol + 1, row: rowNum };
|
|
19384
|
-
if (!pos || !Number.isFinite(pos.row) || pos.row < 0 || pos.row >= MAX_SHEET_ROWS || pos.col >=
|
|
19384
|
+
if (!pos || !Number.isFinite(pos.row) || pos.row < 0 || pos.row >= MAX_SHEET_ROWS || pos.col >= _chunk7WV3WETFcjs.MAX_COLS) continue;
|
|
19385
19385
|
prevCol = pos.col;
|
|
19386
19386
|
const type = cellEl.getAttribute("t");
|
|
19387
19387
|
const vElements = getElements(cellEl, "v");
|
|
@@ -19431,21 +19431,21 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19431
19431
|
if (m) {
|
|
19432
19432
|
merges.push({
|
|
19433
19433
|
r1: Math.min(m.startRow, MAX_SHEET_ROWS - 1),
|
|
19434
|
-
c1: Math.min(m.startCol,
|
|
19434
|
+
c1: Math.min(m.startCol, _chunk7WV3WETFcjs.MAX_COLS - 1),
|
|
19435
19435
|
r2: Math.min(m.endRow, MAX_SHEET_ROWS - 1),
|
|
19436
|
-
c2: Math.min(m.endCol,
|
|
19436
|
+
c2: Math.min(m.endCol, _chunk7WV3WETFcjs.MAX_COLS - 1)
|
|
19437
19437
|
});
|
|
19438
19438
|
}
|
|
19439
19439
|
}
|
|
19440
19440
|
return { rows, merges, maxCol };
|
|
19441
19441
|
}
|
|
19442
19442
|
async function parseXlsxDocument(buffer, options) {
|
|
19443
|
-
|
|
19443
|
+
_chunkPMULUMUFcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
19444
19444
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19445
19445
|
const warnings = [];
|
|
19446
19446
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
19447
19447
|
if (!workbookFile) {
|
|
19448
|
-
throw new (0,
|
|
19448
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19449
19449
|
}
|
|
19450
19450
|
let sharedStrings = [];
|
|
19451
19451
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -19454,7 +19454,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19454
19454
|
}
|
|
19455
19455
|
const { sheets, date1904 } = parseWorkbook(await workbookFile.async("text"));
|
|
19456
19456
|
if (sheets.length === 0) {
|
|
19457
|
-
throw new (0,
|
|
19457
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19458
19458
|
}
|
|
19459
19459
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
19460
19460
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -19538,7 +19538,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19538
19538
|
} catch (e35) {
|
|
19539
19539
|
}
|
|
19540
19540
|
}
|
|
19541
|
-
const markdown =
|
|
19541
|
+
const markdown = _chunk7WV3WETFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
19542
19542
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
19543
19543
|
}
|
|
19544
19544
|
|
|
@@ -19987,11 +19987,11 @@ function processGlobals(records) {
|
|
|
19987
19987
|
const xfFmtIds = [];
|
|
19988
19988
|
const firstBof = records[0];
|
|
19989
19989
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
19990
|
-
throw new (0,
|
|
19990
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
19991
19991
|
}
|
|
19992
19992
|
const bof = decodeBof(firstBof.data);
|
|
19993
19993
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
19994
|
-
throw new (0,
|
|
19994
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
19995
19995
|
}
|
|
19996
19996
|
let i = 1;
|
|
19997
19997
|
while (i < records.length) {
|
|
@@ -20057,14 +20057,14 @@ function rawSheetToBlocks(sheetName, sheet, sheetIndex, warnings, keepAnchoredEm
|
|
|
20057
20057
|
const rows = /* @__PURE__ */ new Map();
|
|
20058
20058
|
let maxCol = -1;
|
|
20059
20059
|
for (const c of sheet.cells) {
|
|
20060
|
-
if (c.col >=
|
|
20060
|
+
if (c.col >= _chunk7WV3WETFcjs.MAX_COLS) continue;
|
|
20061
20061
|
let row = rows.get(c.row);
|
|
20062
20062
|
if (!row) rows.set(c.row, row = []);
|
|
20063
20063
|
while (row.length <= c.col) row.push("");
|
|
20064
20064
|
row[c.col] = cellValueToText(c.value);
|
|
20065
20065
|
if (c.col > maxCol) maxCol = c.col;
|
|
20066
20066
|
}
|
|
20067
|
-
const merges = sheet.merges.filter((m) => m.c1 <
|
|
20067
|
+
const merges = sheet.merges.filter((m) => m.c1 < _chunk7WV3WETFcjs.MAX_COLS).map((m) => ({ r1: m.r1, c1: m.c1, r2: m.r2, c2: Math.min(m.c2, _chunk7WV3WETFcjs.MAX_COLS - 1) }));
|
|
20068
20068
|
for (const m of merges) if (m.c2 > maxCol) maxCol = m.c2;
|
|
20069
20069
|
return sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols);
|
|
20070
20070
|
}
|
|
@@ -20074,28 +20074,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20074
20074
|
try {
|
|
20075
20075
|
cfb = parseLenientCfb(buf);
|
|
20076
20076
|
} catch (e) {
|
|
20077
|
-
throw new (0,
|
|
20077
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(
|
|
20078
20078
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
20079
20079
|
);
|
|
20080
20080
|
}
|
|
20081
20081
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
20082
20082
|
if (!wb) {
|
|
20083
|
-
throw new (0,
|
|
20083
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
20084
20084
|
}
|
|
20085
20085
|
const records = readRecords2(wb);
|
|
20086
20086
|
if (records.length === 0) {
|
|
20087
|
-
throw new (0,
|
|
20087
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
20088
20088
|
}
|
|
20089
20089
|
const firstBof = decodeBof(records[0].data);
|
|
20090
20090
|
if (firstBof && firstBof.vers !== 1536) {
|
|
20091
|
-
throw new (0,
|
|
20091
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(
|
|
20092
20092
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
20093
20093
|
);
|
|
20094
20094
|
}
|
|
20095
20095
|
const globals = processGlobals(records);
|
|
20096
20096
|
const warnings = [];
|
|
20097
20097
|
if (globals.encrypted) {
|
|
20098
|
-
throw new (0,
|
|
20098
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20099
20099
|
}
|
|
20100
20100
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
20101
20101
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -20146,7 +20146,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20146
20146
|
pageCount: totalSheets
|
|
20147
20147
|
};
|
|
20148
20148
|
return {
|
|
20149
|
-
markdown:
|
|
20149
|
+
markdown: _chunk7WV3WETFcjs.blocksToMarkdown.call(void 0, allBlocks),
|
|
20150
20150
|
blocks: allBlocks,
|
|
20151
20151
|
metadata,
|
|
20152
20152
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -20560,7 +20560,7 @@ function isDisplayMath(el) {
|
|
|
20560
20560
|
}
|
|
20561
20561
|
|
|
20562
20562
|
// src/docx/parser.ts
|
|
20563
|
-
var MAX_DECOMPRESS_SIZE5 =
|
|
20563
|
+
var MAX_DECOMPRESS_SIZE5 = _chunkPMULUMUFcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
20564
20564
|
function matchesLocal(el, localName3) {
|
|
20565
20565
|
return el.localName === localName3 || (_nullishCoalesce(_optionalChain([el, 'access', _252 => _252.tagName, 'optionalAccess', _253 => _253.endsWith, 'call', _254 => _254(`:${localName3}`)]), () => ( false)));
|
|
20566
20566
|
}
|
|
@@ -20616,7 +20616,7 @@ function getAttr(el, localName3) {
|
|
|
20616
20616
|
return null;
|
|
20617
20617
|
}
|
|
20618
20618
|
function parseXml2(text) {
|
|
20619
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
20619
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkPMULUMUFcjs.stripDtd.call(void 0, text), "text/xml");
|
|
20620
20620
|
}
|
|
20621
20621
|
function parseStyles(xml) {
|
|
20622
20622
|
const doc = parseXml2(xml);
|
|
@@ -20813,7 +20813,7 @@ var PAGE_FIELD_RE = /^\s*(?:PAGE|NUMPAGES|SECTIONPAGES)\b/i;
|
|
|
20813
20813
|
function makeLink(text, rawHref) {
|
|
20814
20814
|
if (!text) return "";
|
|
20815
20815
|
if (!rawHref) return text;
|
|
20816
|
-
const href =
|
|
20816
|
+
const href = _chunkPMULUMUFcjs.sanitizeHref.call(void 0, rawHref);
|
|
20817
20817
|
return href ? `[${text}](${href})` : text;
|
|
20818
20818
|
}
|
|
20819
20819
|
function collectInline(p, footnotes, rels) {
|
|
@@ -21018,7 +21018,7 @@ ${cell2.text}` : cell2.text;
|
|
|
21018
21018
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
21019
21019
|
})
|
|
21020
21020
|
);
|
|
21021
|
-
const table2 =
|
|
21021
|
+
const table2 = _chunk7WV3WETFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21022
21022
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21023
21023
|
return { type: "table", table: table2 };
|
|
21024
21024
|
}
|
|
@@ -21162,12 +21162,12 @@ async function parseHeaderFooterBlocks(zip, doc, rels, kind, styles, numbering,
|
|
|
21162
21162
|
return out;
|
|
21163
21163
|
}
|
|
21164
21164
|
async function parseDocxDocument(buffer, options) {
|
|
21165
|
-
|
|
21165
|
+
_chunkPMULUMUFcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5);
|
|
21166
21166
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21167
21167
|
const warnings = [];
|
|
21168
21168
|
const docFile = zip.file("word/document.xml");
|
|
21169
21169
|
if (!docFile) {
|
|
21170
|
-
throw new (0,
|
|
21170
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21171
21171
|
}
|
|
21172
21172
|
let rels = /* @__PURE__ */ new Map();
|
|
21173
21173
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -21214,7 +21214,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21214
21214
|
const doc = parseXml2(docXml);
|
|
21215
21215
|
const body = findElements(doc, "body");
|
|
21216
21216
|
if (body.length === 0) {
|
|
21217
|
-
throw new (0,
|
|
21217
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21218
21218
|
}
|
|
21219
21219
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings);
|
|
21220
21220
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -21267,7 +21267,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21267
21267
|
}
|
|
21268
21268
|
}
|
|
21269
21269
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
21270
|
-
const markdown =
|
|
21270
|
+
const markdown = _chunk7WV3WETFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
21271
21271
|
return {
|
|
21272
21272
|
markdown,
|
|
21273
21273
|
blocks,
|
|
@@ -21285,11 +21285,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
21285
21285
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
21286
21286
|
function parseHwpmlDocument(buffer, options) {
|
|
21287
21287
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
21288
|
-
throw new (0,
|
|
21288
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
21289
21289
|
}
|
|
21290
21290
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
21291
21291
|
const normalized = text.replace(/ /g, " ");
|
|
21292
|
-
const xml =
|
|
21292
|
+
const xml = _chunkPMULUMUFcjs.stripDtd.call(void 0, normalized);
|
|
21293
21293
|
const warnings = [];
|
|
21294
21294
|
const parser = new (0, _xmldom.DOMParser)({
|
|
21295
21295
|
onError: (_level, msg2) => {
|
|
@@ -21329,7 +21329,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
21329
21329
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _289 => _289.keepTrailingEmptyCols]), () => ( false)));
|
|
21330
21330
|
}
|
|
21331
21331
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
21332
|
-
const markdown =
|
|
21332
|
+
const markdown = _chunk7WV3WETFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
21333
21333
|
return {
|
|
21334
21334
|
markdown,
|
|
21335
21335
|
blocks,
|
|
@@ -21494,7 +21494,7 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
21494
21494
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
21495
21495
|
cellRows[r].push(cell2);
|
|
21496
21496
|
}
|
|
21497
|
-
const table2 =
|
|
21497
|
+
const table2 = _chunk7WV3WETFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
21498
21498
|
if (structured.length > 0) {
|
|
21499
21499
|
const claimed = /* @__PURE__ */ new Set();
|
|
21500
21500
|
for (const { ctx, cellBlocks } of structured) {
|
|
@@ -23030,7 +23030,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
23030
23030
|
};
|
|
23031
23031
|
}
|
|
23032
23032
|
async function extractClickHereFields(hwpxBuffer) {
|
|
23033
|
-
|
|
23033
|
+
_chunkPMULUMUFcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
23034
23034
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
23035
23035
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
23036
23036
|
const fields = [];
|
|
@@ -23078,19 +23078,19 @@ function parseCentralDirectory(buf) {
|
|
|
23078
23078
|
}
|
|
23079
23079
|
}
|
|
23080
23080
|
}
|
|
23081
|
-
if (eocdOffset < 0) throw new (0,
|
|
23081
|
+
if (eocdOffset < 0) throw new (0, _chunkPMULUMUFcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
23082
23082
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
23083
23083
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
23084
23084
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
23085
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
23085
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkPMULUMUFcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
23086
23086
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
23087
|
-
throw new (0,
|
|
23087
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
23088
23088
|
}
|
|
23089
23089
|
const decoder = new TextDecoder("utf-8");
|
|
23090
23090
|
const entries = [];
|
|
23091
23091
|
let pos = cdOffset;
|
|
23092
23092
|
for (let i = 0; i < totalEntries; i++) {
|
|
23093
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
23093
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkPMULUMUFcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
23094
23094
|
const flags = view.getUint16(pos + 8, true);
|
|
23095
23095
|
const method = view.getUint16(pos + 10, true);
|
|
23096
23096
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -23101,7 +23101,7 @@ function parseCentralDirectory(buf) {
|
|
|
23101
23101
|
const commentLen = view.getUint16(pos + 32, true);
|
|
23102
23102
|
const localOffset = view.getUint32(pos + 42, true);
|
|
23103
23103
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
23104
|
-
throw new (0,
|
|
23104
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
23105
23105
|
}
|
|
23106
23106
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
23107
23107
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -23130,11 +23130,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23130
23130
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
23131
23131
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
23132
23132
|
for (const name of replacements.keys()) {
|
|
23133
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
23133
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkPMULUMUFcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
23134
23134
|
}
|
|
23135
23135
|
if (additions) {
|
|
23136
23136
|
for (const name of additions.keys()) {
|
|
23137
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
23137
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkPMULUMUFcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
23138
23138
|
}
|
|
23139
23139
|
}
|
|
23140
23140
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -23153,7 +23153,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23153
23153
|
offset += seg.length;
|
|
23154
23154
|
continue;
|
|
23155
23155
|
}
|
|
23156
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
23156
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkPMULUMUFcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
23157
23157
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
23158
23158
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
23159
23159
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -23161,7 +23161,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23161
23161
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
23162
23162
|
const method = e.method;
|
|
23163
23163
|
if (method !== 0 && method !== 8) {
|
|
23164
|
-
throw new (0,
|
|
23164
|
+
throw new (0, _chunkPMULUMUFcjs.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`);
|
|
23165
23165
|
}
|
|
23166
23166
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
23167
23167
|
const crc = crc32(newData);
|
|
@@ -23259,11 +23259,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
23259
23259
|
// src/form/filler-hwpx.ts
|
|
23260
23260
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
23261
23261
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
23262
|
-
|
|
23262
|
+
_chunkPMULUMUFcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
23263
23263
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
23264
23264
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
23265
23265
|
if (sectionPaths.length === 0) {
|
|
23266
|
-
throw new (0,
|
|
23266
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
23267
23267
|
}
|
|
23268
23268
|
const warnings = [];
|
|
23269
23269
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -23713,7 +23713,7 @@ function classifyTableTree(blocks) {
|
|
|
23713
23713
|
return blocks;
|
|
23714
23714
|
}
|
|
23715
23715
|
function chooseTableRepresentation(table2, opts = {}) {
|
|
23716
|
-
const structured = hasMerged(table2) ||
|
|
23716
|
+
const structured = hasMerged(table2) || _chunk7WV3WETFcjs.hasStructuredCellContent.call(void 0, table2);
|
|
23717
23717
|
if (opts.smartVisual && _optionalChain([table2, 'access', _386 => _386.classification, 'optionalAccess', _387 => _387.kind]) === "non-tabular-layout") return "visual";
|
|
23718
23718
|
return structured ? "html" : "gfm";
|
|
23719
23719
|
}
|
|
@@ -26371,7 +26371,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
26371
26371
|
}
|
|
26372
26372
|
function assertFiniteRange(name, value, min, max) {
|
|
26373
26373
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
26374
|
-
throw new (0,
|
|
26374
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
26375
26375
|
}
|
|
26376
26376
|
}
|
|
26377
26377
|
function validateGongmunOptions(opts) {
|
|
@@ -26386,10 +26386,10 @@ function validateGongmunOptions(opts) {
|
|
|
26386
26386
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
26387
26387
|
}
|
|
26388
26388
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
26389
|
-
throw new (0,
|
|
26389
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
26390
26390
|
}
|
|
26391
26391
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
26392
|
-
throw new (0,
|
|
26392
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
26393
26393
|
}
|
|
26394
26394
|
}
|
|
26395
26395
|
if (opts.sizes) {
|
|
@@ -26398,24 +26398,24 @@ function validateGongmunOptions(opts) {
|
|
|
26398
26398
|
}
|
|
26399
26399
|
}
|
|
26400
26400
|
if (opts.approval && opts.approval.length > 6) {
|
|
26401
|
-
throw new (0,
|
|
26401
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("approval must contain at most 6 labels");
|
|
26402
26402
|
}
|
|
26403
26403
|
if (opts.checklist && typeof opts.checklist === "object") {
|
|
26404
26404
|
const nums = [..._nullishCoalesce(opts.checklist.na, () => ( [])), ...Object.keys(_nullishCoalesce(opts.checklist.notes, () => ( {}))).map(Number)];
|
|
26405
26405
|
for (const n of nums) {
|
|
26406
|
-
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0,
|
|
26406
|
+
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0, _chunkPMULUMUFcjs.KordocError)(`checklist: item number must be an integer between 1 and ${CHECKLIST_ITEMS} (got ${n})`);
|
|
26407
26407
|
}
|
|
26408
26408
|
}
|
|
26409
26409
|
if (opts.levels) {
|
|
26410
26410
|
for (const [key, st] of Object.entries(opts.levels)) {
|
|
26411
26411
|
const depth = Number(key);
|
|
26412
26412
|
if (!Number.isInteger(depth) || depth < 0 || depth >= GONGMUN_LEVEL_COUNT) {
|
|
26413
|
-
throw new (0,
|
|
26413
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(`levels: depth must be an integer between 0 and ${GONGMUN_LEVEL_COUNT - 1} (got "${key}")`);
|
|
26414
26414
|
}
|
|
26415
|
-
if (!st || typeof st !== "object") throw new (0,
|
|
26415
|
+
if (!st || typeof st !== "object") throw new (0, _chunkPMULUMUFcjs.KordocError)(`levels.${key} must be an object {font, pt, bold}`);
|
|
26416
26416
|
if (st.pt !== void 0) assertFiniteRange(`levels.${key}.pt`, st.pt, 6, 60);
|
|
26417
26417
|
if (st.font !== void 0 && (typeof st.font !== "string" || !st.font.trim())) {
|
|
26418
|
-
throw new (0,
|
|
26418
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(`levels.${key}.font must be a non-empty string`);
|
|
26419
26419
|
}
|
|
26420
26420
|
}
|
|
26421
26421
|
}
|
|
@@ -26470,7 +26470,7 @@ function resolveChecklist(c, preset) {
|
|
|
26470
26470
|
function hexColorOption(name, value) {
|
|
26471
26471
|
if (value === void 0) return void 0;
|
|
26472
26472
|
const v = value.trim();
|
|
26473
|
-
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0,
|
|
26473
|
+
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0, _chunkPMULUMUFcjs.KordocError)(`${name} must be a #RRGGBB color (got "${value}")`);
|
|
26474
26474
|
return v.toUpperCase();
|
|
26475
26475
|
}
|
|
26476
26476
|
function resolveGongmun(opts) {
|
|
@@ -26857,7 +26857,7 @@ function parseInlineMarkdown(text) {
|
|
|
26857
26857
|
else spans.push(...emphasisSpans(m[0]));
|
|
26858
26858
|
} else {
|
|
26859
26859
|
const anchor = m[2] || m[3];
|
|
26860
|
-
const href = _nullishCoalesce(
|
|
26860
|
+
const href = _nullishCoalesce(_chunkPMULUMUFcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
26861
26861
|
const sub = emphasisSpans(anchor);
|
|
26862
26862
|
if (href) for (const s of sub) s.href = href;
|
|
26863
26863
|
spans.push(...sub);
|
|
@@ -27071,7 +27071,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
27071
27071
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
27072
27072
|
const got = m ? Number(m[1]) : NaN;
|
|
27073
27073
|
if (got !== startId + i) {
|
|
27074
|
-
throw new (0,
|
|
27074
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(
|
|
27075
27075
|
`\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)`
|
|
27076
27076
|
);
|
|
27077
27077
|
}
|
|
@@ -27162,7 +27162,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
27162
27162
|
}
|
|
27163
27163
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
27164
27164
|
if (rows.length !== expectedBase) {
|
|
27165
|
-
throw new (0,
|
|
27165
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(
|
|
27166
27166
|
`\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`
|
|
27167
27167
|
);
|
|
27168
27168
|
}
|
|
@@ -28074,7 +28074,7 @@ function bestSimInRange(arr, from, to, target) {
|
|
|
28074
28074
|
}
|
|
28075
28075
|
var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
|
|
28076
28076
|
function sanitizeText(text) {
|
|
28077
|
-
let result =
|
|
28077
|
+
let result = _chunk7WV3WETFcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
28078
28078
|
if (result.length <= 30 && result.includes(" ")) {
|
|
28079
28079
|
const tokens = result.split(" ");
|
|
28080
28080
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -28107,7 +28107,7 @@ function replicateGfmTable(table2) {
|
|
|
28107
28107
|
const cell2 = _optionalChain([cells, 'access', _465 => _465[r], 'optionalAccess', _466 => _466[c]]);
|
|
28108
28108
|
if (!cell2) continue;
|
|
28109
28109
|
display[r][c] = {
|
|
28110
|
-
text:
|
|
28110
|
+
text: _chunk7WV3WETFcjs.escapeGfm.call(void 0, sanitizeText(cell2.text)).replace(/(?<!\\)\|/g, "\\|").replace(/\n/g, "<br>"),
|
|
28111
28111
|
gridR: r,
|
|
28112
28112
|
gridC: c
|
|
28113
28113
|
};
|
|
@@ -28162,14 +28162,14 @@ function replicateCellInnerHtml(cell2) {
|
|
|
28162
28162
|
return cell2.blocks.map((b) => {
|
|
28163
28163
|
if (b.type === "table" && b.table) {
|
|
28164
28164
|
const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
|
|
28165
|
-
return (cap ?
|
|
28165
|
+
return (cap ? _chunk7WV3WETFcjs.escapeHtmlCellText.call(void 0, cap) + "<br>" : "") + replicateTableToHtml(b.table);
|
|
28166
28166
|
}
|
|
28167
|
-
if (b.type === "image" && b.text) return `<img src="${
|
|
28167
|
+
if (b.type === "image" && b.text) return `<img src="${_chunkPMULUMUFcjs.escapeHtml.call(void 0, b.text, true)}" alt="image">`;
|
|
28168
28168
|
const t = sanitizeText(_nullishCoalesce(b.text, () => ( "")));
|
|
28169
|
-
return t ?
|
|
28169
|
+
return t ? _chunk7WV3WETFcjs.escapeHtmlCellText.call(void 0, t + _chunk7WV3WETFcjs.noteSuffix.call(void 0, b)).replace(/\n/g, "<br>") : "";
|
|
28170
28170
|
}).filter(Boolean).join("<br>");
|
|
28171
28171
|
}
|
|
28172
|
-
return
|
|
28172
|
+
return _chunk7WV3WETFcjs.escapeHtmlCellText.call(void 0, sanitizeText(cell2.text)).replace(/\n/g, "<br>");
|
|
28173
28173
|
}
|
|
28174
28174
|
function replicateTableToHtml(table2) {
|
|
28175
28175
|
const rows = replicateHtmlTable(table2);
|
|
@@ -28246,7 +28246,7 @@ function parseHtmlTable(raw) {
|
|
|
28246
28246
|
const cs = parseInt(_optionalChain([attrs, 'access', _471 => _471.match, 'call', _472 => _472(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _473 => _473[1]]) || "1", 10);
|
|
28247
28247
|
const rs = parseInt(_optionalChain([attrs, 'access', _474 => _474.match, 'call', _475 => _475(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _476 => _476[1]]) || "1", 10);
|
|
28248
28248
|
cellStart = m.index + m[0].length;
|
|
28249
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
28249
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunk7WV3WETFcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunk7WV3WETFcjs.MAX_ROWS) };
|
|
28250
28250
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
28251
28251
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
28252
28252
|
cellStart = -1;
|
|
@@ -28271,11 +28271,11 @@ function htmlCellInnerToLines(inner) {
|
|
|
28271
28271
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
28272
28272
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
28273
28273
|
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _477 => _477[1]]), () => ( _optionalChain([m, 'optionalAccess', _478 => _478[2]])));
|
|
28274
|
-
if (src) imgSrcs.push(
|
|
28274
|
+
if (src) imgSrcs.push(_chunkPMULUMUFcjs.unescapeHtml.call(void 0, src));
|
|
28275
28275
|
return "";
|
|
28276
28276
|
});
|
|
28277
28277
|
}
|
|
28278
|
-
const lines = work.split(/<br\s*\/?>/gi).map((s) =>
|
|
28278
|
+
const lines = work.split(/<br\s*\/?>/gi).map((s) => _chunkPMULUMUFcjs.unescapeHtml.call(void 0, s).trim()).filter((s) => s.length > 0);
|
|
28279
28279
|
return { lines, hadNonText, imgSrcs };
|
|
28280
28280
|
}
|
|
28281
28281
|
function splitCellByTopLevelTables(html) {
|
|
@@ -29038,8 +29038,8 @@ function layoutHtmlRows(rows) {
|
|
|
29038
29038
|
let c = 0;
|
|
29039
29039
|
for (const cell2 of rows[r].cells) {
|
|
29040
29040
|
while (occupied.has(`${r},${c}`)) c++;
|
|
29041
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
29042
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
29041
|
+
const colSpan = clampSpan(cell2.colSpan, _chunk7WV3WETFcjs.MAX_COLS);
|
|
29042
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunk7WV3WETFcjs.MAX_ROWS);
|
|
29043
29043
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
29044
29044
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
29045
29045
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -31661,7 +31661,7 @@ function builtinTemplateDir() {
|
|
|
31661
31661
|
for (const c of candidates) {
|
|
31662
31662
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
31663
31663
|
}
|
|
31664
|
-
throw new (0,
|
|
31664
|
+
throw new (0, _chunkPMULUMUFcjs.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)");
|
|
31665
31665
|
}
|
|
31666
31666
|
function readBuiltinTemplate(t) {
|
|
31667
31667
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -32015,12 +32015,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
32015
32015
|
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>`;
|
|
32016
32016
|
}
|
|
32017
32017
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
32018
|
-
if (ops.length === 0) throw new (0,
|
|
32018
|
+
if (ops.length === 0) throw new (0, _chunkPMULUMUFcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
32019
32019
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
32020
|
-
|
|
32020
|
+
_chunkPMULUMUFcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
32021
32021
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
32022
32022
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _618 => _618.match, 'call', _619 => _619(/(\d+)\.xml$/i), 'optionalAccess', _620 => _620[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _621 => _621.match, 'call', _622 => _622(/(\d+)\.xml$/i), 'optionalAccess', _623 => _623[1]]), () => ( 0))));
|
|
32023
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
32023
|
+
if (sectionPaths.length === 0) throw new (0, _chunkPMULUMUFcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
32024
32024
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
32025
32025
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
32026
32026
|
const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
|
|
@@ -32061,11 +32061,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
32061
32061
|
const manifestItems = [];
|
|
32062
32062
|
const placed = [];
|
|
32063
32063
|
for (const op of ops) {
|
|
32064
|
-
if (!op.anchor) throw new (0,
|
|
32065
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
32064
|
+
if (!op.anchor) throw new (0, _chunkPMULUMUFcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
32065
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkPMULUMUFcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
32066
32066
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
32067
|
-
if (!MIME[ext]) throw new (0,
|
|
32068
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
32067
|
+
if (!MIME[ext]) throw new (0, _chunkPMULUMUFcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
32068
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkPMULUMUFcjs.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)`);
|
|
32069
32069
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
32070
32070
|
let found = null;
|
|
32071
32071
|
let total = 0;
|
|
@@ -32098,7 +32098,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
32098
32098
|
}
|
|
32099
32099
|
}
|
|
32100
32100
|
}
|
|
32101
|
-
throw new (0,
|
|
32101
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(
|
|
32102
32102
|
`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)})`
|
|
32103
32103
|
);
|
|
32104
32104
|
}
|
|
@@ -32106,7 +32106,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
32106
32106
|
const xml = sectionXmls[si];
|
|
32107
32107
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
32108
32108
|
if (!run) {
|
|
32109
|
-
throw new (0,
|
|
32109
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
32110
32110
|
}
|
|
32111
32111
|
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _624 => _624.charPr, 'access', _625 => _625.get, 'call', _626 => _626(run.charPr), 'optionalAccess', _627 => _627.height]), () => ( 1e3));
|
|
32112
32112
|
const fontPt = charPrHeight / 100;
|
|
@@ -32384,7 +32384,7 @@ function pick(map, keys) {
|
|
|
32384
32384
|
return out;
|
|
32385
32385
|
}
|
|
32386
32386
|
async function hwpxToProfile(input) {
|
|
32387
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
32387
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkPMULUMUFcjs.toArrayBuffer.call(void 0, input);
|
|
32388
32388
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
32389
32389
|
const parser = createXmlParser();
|
|
32390
32390
|
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _649 => _649.file, 'call', _650 => _650(/[Hh]eader\.xml$/), 'optionalAccess', _651 => _651[0]])));
|
|
@@ -33537,8 +33537,8 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
33537
33537
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
33538
33538
|
const t = line.trim();
|
|
33539
33539
|
if (!t) return "";
|
|
33540
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
33541
|
-
return
|
|
33540
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunk7WV3WETFcjs.escapeGfm.call(void 0, t)}**`;
|
|
33541
|
+
return _chunk7WV3WETFcjs.escapeGfm.call(void 0, t);
|
|
33542
33542
|
}).filter(Boolean);
|
|
33543
33543
|
if (replicaLines.join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
33544
33544
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -33552,7 +33552,7 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
33552
33552
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
33553
33553
|
const replica = [];
|
|
33554
33554
|
for (let r = 0; r < table2.rows; r++) {
|
|
33555
|
-
const line =
|
|
33555
|
+
const line = _chunk7WV3WETFcjs.escapeGfm.call(void 0, sanitizeText(table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
33556
33556
|
if (line) replica.push({ line, gridR: r });
|
|
33557
33557
|
}
|
|
33558
33558
|
if (replica.map((x) => x.line).join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
@@ -33717,7 +33717,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
33717
33717
|
const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
33718
33718
|
if (paths.length > 0) return paths;
|
|
33719
33719
|
}
|
|
33720
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
33720
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkPMULUMUFcjs.compareSectionPaths);
|
|
33721
33721
|
}
|
|
33722
33722
|
function sectionPathsFromManifest(xml) {
|
|
33723
33723
|
const attr = (tag, name) => {
|
|
@@ -33727,7 +33727,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
33727
33727
|
const idToHref = /* @__PURE__ */ new Map();
|
|
33728
33728
|
for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
|
|
33729
33729
|
const id = attr(m[1], "id");
|
|
33730
|
-
const href =
|
|
33730
|
+
const href = _chunkPMULUMUFcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
|
|
33731
33731
|
if (id && href) idToHref.set(id, href);
|
|
33732
33732
|
}
|
|
33733
33733
|
const ordered = [];
|
|
@@ -33736,7 +33736,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
33736
33736
|
if (href) ordered.push(href);
|
|
33737
33737
|
}
|
|
33738
33738
|
if (ordered.length > 0) return ordered;
|
|
33739
|
-
return Array.from(idToHref.values()).sort(
|
|
33739
|
+
return Array.from(idToHref.values()).sort(_chunkPMULUMUFcjs.compareSectionPaths);
|
|
33740
33740
|
}
|
|
33741
33741
|
|
|
33742
33742
|
// src/roundtrip/hwp5-patch.ts
|
|
@@ -34641,8 +34641,8 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
34641
34641
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
34642
34642
|
const t = line.trim();
|
|
34643
34643
|
if (!t) return "";
|
|
34644
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
34645
|
-
return
|
|
34644
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunk7WV3WETFcjs.escapeGfm.call(void 0, t)}**`;
|
|
34645
|
+
return _chunk7WV3WETFcjs.escapeGfm.call(void 0, t);
|
|
34646
34646
|
}).filter(Boolean);
|
|
34647
34647
|
if (replicaLines.join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
34648
34648
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -34656,7 +34656,7 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
34656
34656
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
34657
34657
|
const replica = [];
|
|
34658
34658
|
for (let r = 0; r < table2.rows; r++) {
|
|
34659
|
-
const line =
|
|
34659
|
+
const line = _chunk7WV3WETFcjs.escapeGfm.call(void 0, sanitizeText(table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
34660
34660
|
if (line) replica.push({ line, gridR: r });
|
|
34661
34661
|
}
|
|
34662
34662
|
if (replica.map((x) => x.line).join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
@@ -35055,9 +35055,9 @@ function buildOrigUnits(blocks) {
|
|
|
35055
35055
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
35056
35056
|
const next = blocks[i + 1];
|
|
35057
35057
|
if (_optionalChain([next, 'optionalAccess', _702 => _702.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
35058
|
-
chunk =
|
|
35058
|
+
chunk = _chunk7WV3WETFcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
35059
35059
|
} else {
|
|
35060
|
-
chunk =
|
|
35060
|
+
chunk = _chunk7WV3WETFcjs.blocksToMarkdown.call(void 0, [block]);
|
|
35061
35061
|
}
|
|
35062
35062
|
if (chunk) {
|
|
35063
35063
|
const subUnits = splitMarkdownUnits(chunk);
|
|
@@ -37912,12 +37912,12 @@ function blocksToChunks(blocks, options) {
|
|
|
37912
37912
|
let run = null;
|
|
37913
37913
|
const flushRun = () => {
|
|
37914
37914
|
if (!run) return;
|
|
37915
|
-
push("text", run.breadcrumb,
|
|
37915
|
+
push("text", run.breadcrumb, _chunk7WV3WETFcjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
|
|
37916
37916
|
run = null;
|
|
37917
37917
|
};
|
|
37918
37918
|
for (let i = 0; i < blocks.length; i++) {
|
|
37919
37919
|
const block = blocks[i];
|
|
37920
|
-
const md2 =
|
|
37920
|
+
const md2 = _chunk7WV3WETFcjs.blocksToMarkdown.call(void 0, [block]);
|
|
37921
37921
|
if (!md2) continue;
|
|
37922
37922
|
if (block.type === "heading") {
|
|
37923
37923
|
flushRun();
|
|
@@ -38360,7 +38360,7 @@ var md = new (0, _markdownit2.default)({
|
|
|
38360
38360
|
});
|
|
38361
38361
|
var SAFE_RAW_TAG = /^(?:<\/?(?:table|thead|tbody|tfoot|tr|th|td|u)>|<br\s*\/?>|<(?:th|td)(?: (?:colspan|rowspan)="[1-9]\d*"){1,2}>|<img src="(?:images\/(?:[^"'<>\/\s]+\/)?)?image_\d+\.(?:png|jpe?g|gif|webp|bmp)" alt="image">)$/i;
|
|
38362
38362
|
function sanitizeRawHtml(raw) {
|
|
38363
|
-
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag :
|
|
38363
|
+
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag : _chunkPMULUMUFcjs.escapeHtml.call(void 0, tag));
|
|
38364
38364
|
}
|
|
38365
38365
|
md.renderer.rules.html_block = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
38366
38366
|
md.renderer.rules.html_inline = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
@@ -38368,7 +38368,7 @@ function renderHtml(markdown, options) {
|
|
|
38368
38368
|
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _769 => _769.preset]), () => ( "default"));
|
|
38369
38369
|
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _770 => _770.extraCss]), () => ( "")));
|
|
38370
38370
|
const body = md.render(markdown);
|
|
38371
|
-
const watermark = _optionalChain([options, 'optionalAccess', _771 => _771.watermark]) ? `<div class="watermark">${
|
|
38371
|
+
const watermark = _optionalChain([options, 'optionalAccess', _771 => _771.watermark]) ? `<div class="watermark">${_chunkPMULUMUFcjs.escapeHtml.call(void 0, options.watermark)}</div>` : "";
|
|
38372
38372
|
const watermarkCss = _optionalChain([options, 'optionalAccess', _772 => _772.watermark]) ? `
|
|
38373
38373
|
.watermark {
|
|
38374
38374
|
position: fixed;
|
|
@@ -38419,13 +38419,13 @@ async function htmlToPdf(html, options) {
|
|
|
38419
38419
|
try {
|
|
38420
38420
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
38421
38421
|
} catch (e40) {
|
|
38422
|
-
throw new (0,
|
|
38422
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(
|
|
38423
38423
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
38424
38424
|
);
|
|
38425
38425
|
}
|
|
38426
38426
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
38427
38427
|
if (!executablePath) {
|
|
38428
|
-
throw new (0,
|
|
38428
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(
|
|
38429
38429
|
"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."
|
|
38430
38430
|
);
|
|
38431
38431
|
}
|
|
@@ -38480,7 +38480,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
38480
38480
|
return htmlToPdf(html, options);
|
|
38481
38481
|
}
|
|
38482
38482
|
async function blocksToPdf(blocks, options) {
|
|
38483
|
-
const markdown =
|
|
38483
|
+
const markdown = _chunk7WV3WETFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
38484
38484
|
return markdownToPdf(markdown, options);
|
|
38485
38485
|
}
|
|
38486
38486
|
|
|
@@ -39529,22 +39529,22 @@ function renderSectionRoots(sections, input) {
|
|
|
39529
39529
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${index}` });
|
|
39530
39530
|
ctxBase.pageBase += pages.length;
|
|
39531
39531
|
}
|
|
39532
|
-
if (rendered.length === 0) throw new (0,
|
|
39532
|
+
if (rendered.length === 0) throw new (0, _chunkPMULUMUFcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
39533
39533
|
return { sections: rendered, defs: ctxBase.defs, warnings: input.warnings, stats: ctxBase.stats, regions: ctxBase.regions.regions };
|
|
39534
39534
|
}
|
|
39535
39535
|
var SVG_FONT_FAMILY = `'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif`;
|
|
39536
39536
|
async function renderHwpxInternal(input, options) {
|
|
39537
39537
|
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _816 => _816.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
39538
39538
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
39539
|
-
|
|
39539
|
+
_chunkPMULUMUFcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
39540
39540
|
let zip;
|
|
39541
39541
|
try {
|
|
39542
39542
|
zip = await _jszip2.default.loadAsync(input);
|
|
39543
39543
|
} catch (e41) {
|
|
39544
|
-
throw new (0,
|
|
39544
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
39545
39545
|
}
|
|
39546
39546
|
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
|
|
39547
|
-
if (secFiles.length === 0) throw new (0,
|
|
39547
|
+
if (secFiles.length === 0) throw new (0, _chunkPMULUMUFcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
39548
39548
|
const warnings = [];
|
|
39549
39549
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
39550
39550
|
const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
@@ -39552,7 +39552,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
39552
39552
|
const secXmls = [];
|
|
39553
39553
|
for (const f of secFiles) {
|
|
39554
39554
|
const xml = await f.async("string");
|
|
39555
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
39555
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkPMULUMUFcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
39556
39556
|
secXmls.push(xml);
|
|
39557
39557
|
}
|
|
39558
39558
|
const binmap = /* @__PURE__ */ new Map();
|
|
@@ -39613,9 +39613,9 @@ async function renderHwpxInternal(input, options) {
|
|
|
39613
39613
|
}
|
|
39614
39614
|
if (roots.length === 0) {
|
|
39615
39615
|
if (noCacheSkipped) {
|
|
39616
|
-
throw new (0,
|
|
39616
|
+
throw new (0, _chunkPMULUMUFcjs.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)");
|
|
39617
39617
|
}
|
|
39618
|
-
throw new (0,
|
|
39618
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
39619
39619
|
}
|
|
39620
39620
|
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _819 => _819.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _820 => _820.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _821 => _821.highlights]) });
|
|
39621
39621
|
}
|
|
@@ -39837,7 +39837,7 @@ var FOLD_END = 42124;
|
|
|
39837
39837
|
var FOLD_SHIFT = 983040 - 40960;
|
|
39838
39838
|
function textChar(ch) {
|
|
39839
39839
|
if (ch >= FOLD_START && ch <= FOLD_END) {
|
|
39840
|
-
const mapped =
|
|
39840
|
+
const mapped = _chunk7WV3WETFcjs.mapPuaText.call(void 0, String.fromCodePoint(ch + FOLD_SHIFT));
|
|
39841
39841
|
return /[\u{F0000}-\u{FFFFF}]/u.test(mapped) ? "" : mapped;
|
|
39842
39842
|
}
|
|
39843
39843
|
if (ch === 65534 || ch === 65535 || ch >= 55296 && ch <= 57343) return "\uFFFD";
|
|
@@ -40209,7 +40209,7 @@ function renderHwp5Records(docInfo, styles, secRecords, binData, options, select
|
|
|
40209
40209
|
}
|
|
40210
40210
|
roots.push({ root, index: si });
|
|
40211
40211
|
}
|
|
40212
|
-
if (roots.length === 0) throw new (0,
|
|
40212
|
+
if (roots.length === 0) throw new (0, _chunkPMULUMUFcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP \uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
40213
40213
|
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _830 => _830.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _831 => _831.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _832 => _832.highlights]) });
|
|
40214
40214
|
return assemblePageSvgs(r, "hwp", select);
|
|
40215
40215
|
}
|
|
@@ -40222,7 +40222,7 @@ function renderHwp5Pages(input, options, select) {
|
|
|
40222
40222
|
const styles = buildHwp5RenderStyles(_nullishCoalesce(docInfoRecords, () => ( [])));
|
|
40223
40223
|
const docInfo = docInfoRecords ? parseDocInfo(docInfoRecords) : null;
|
|
40224
40224
|
const sections = readHwp5SectionStreams(c);
|
|
40225
|
-
if (sections.length === 0) throw new (0,
|
|
40225
|
+
if (sections.length === 0) throw new (0, _chunkPMULUMUFcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
40226
40226
|
const parseWarnings = [];
|
|
40227
40227
|
const secRecords = readHwp5SectionRecords(c, sections, parseWarnings);
|
|
40228
40228
|
for (const w of parseWarnings) warnings.push(w.message);
|
|
@@ -40307,14 +40307,14 @@ async function loadSharp() {
|
|
|
40307
40307
|
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("sharp")));
|
|
40308
40308
|
return _nullishCoalesce(mod.default, () => ( mod));
|
|
40309
40309
|
} catch (e44) {
|
|
40310
|
-
throw new (0,
|
|
40311
|
-
'PNG \uB798\uC2A4\uD130\uC5D0\uB294 sharp\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4 (npm install sharp). sharp \uC5C6\uC774 \uC4F0\uB824\uBA74 format: "svg" + output_path\uB85C SVG \uD30C\uC77C \uC800\uC7A5\uC744 \uC0AC\uC6A9\uD558\uC138\uC694.' +
|
|
40310
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(
|
|
40311
|
+
'PNG \uB798\uC2A4\uD130\uC5D0\uB294 sharp\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4 (npm install sharp). sharp \uC5C6\uC774 \uC4F0\uB824\uBA74 format: "svg" + output_path\uB85C SVG \uD30C\uC77C \uC800\uC7A5\uC744 \uC0AC\uC6A9\uD558\uC138\uC694.' + _chunkPMULUMUFcjs.OPTIONAL_DEP_INSTALL_HINT
|
|
40312
40312
|
);
|
|
40313
40313
|
}
|
|
40314
40314
|
}
|
|
40315
40315
|
async function rasterizePageSvg(svg, widthPt, heightPt, options = {}) {
|
|
40316
40316
|
const sharp = await loadSharp();
|
|
40317
|
-
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0,
|
|
40317
|
+
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0, _chunkPMULUMUFcjs.KordocError)(`\uC798\uBABB\uB41C \uD398\uC774\uC9C0 \uD06C\uAE30: ${widthPt}x${heightPt}pt`);
|
|
40318
40318
|
const maxW = _nullishCoalesce(options.maxWidthPx, () => ( 1400));
|
|
40319
40319
|
const maxH = _nullishCoalesce(options.maxHeightPx, () => ( 4e3));
|
|
40320
40320
|
const scale2 = Math.min(maxW / widthPt, maxH / heightPt, 2);
|
|
@@ -40332,11 +40332,11 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
40332
40332
|
try {
|
|
40333
40333
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
40334
40334
|
} catch (e45) {
|
|
40335
|
-
throw new (0,
|
|
40335
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("PDF \uB80C\uB354\uC5D0\uB294 puppeteer-core \uAC00 \uD544\uC694\uD569\uB2C8\uB2E4 (npm install puppeteer-core). SVG/HTML/PNG \uB294 Chromium \uC5C6\uC774 \uB429\uB2C8\uB2E4");
|
|
40336
40336
|
}
|
|
40337
40337
|
const executablePath = _nullishCoalesce(_nullishCoalesce(options.browserExecutablePath, () => ( process.env.PUPPETEER_EXECUTABLE_PATH)), () => ( findChromiumPath()));
|
|
40338
40338
|
if (!executablePath) {
|
|
40339
|
-
throw new (0,
|
|
40339
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)("Chromium \uC2E4\uD589 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 browserExecutablePath \uC635\uC158 \uB610\uB294 PUPPETEER_EXECUTABLE_PATH \uD658\uACBD\uBCC0\uC218\uB97C \uC9C0\uC815\uD558\uC138\uC694");
|
|
40340
40340
|
}
|
|
40341
40341
|
const { browser, page } = await launchLockedPage(puppeteer, executablePath);
|
|
40342
40342
|
try {
|
|
@@ -40352,13 +40352,13 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
40352
40352
|
async function loadBuffer(input) {
|
|
40353
40353
|
if (typeof input === "string") {
|
|
40354
40354
|
try {
|
|
40355
|
-
return
|
|
40355
|
+
return _chunkPMULUMUFcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input));
|
|
40356
40356
|
} catch (err) {
|
|
40357
40357
|
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
40358
|
-
throw new (0,
|
|
40358
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`);
|
|
40359
40359
|
}
|
|
40360
40360
|
}
|
|
40361
|
-
if (Buffer.isBuffer(input)) return
|
|
40361
|
+
if (Buffer.isBuffer(input)) return _chunkPMULUMUFcjs.toArrayBuffer.call(void 0, input);
|
|
40362
40362
|
if (input instanceof Uint8Array) return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
|
|
40363
40363
|
return input;
|
|
40364
40364
|
}
|
|
@@ -40367,17 +40367,17 @@ async function sourceFormatOf(buffer) {
|
|
|
40367
40367
|
if (format2 === "hwpx") {
|
|
40368
40368
|
const zip = await detectZipFormat(buffer);
|
|
40369
40369
|
if (zip === "hwpx" || zip === "unknown") return "hwpx";
|
|
40370
|
-
throw new (0,
|
|
40370
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(`\uB80C\uB354 \uBBF8\uC9C0\uC6D0 \uD615\uC2DD(${zip}) \u2014 \uB808\uC774\uC544\uC6C3 \uB80C\uB354\uB294 HWPX\xB7HWP \uB9CC \uC9C0\uC6D0\uD569\uB2C8\uB2E4`);
|
|
40371
40371
|
}
|
|
40372
40372
|
if (format2 === "hwp") return "hwp";
|
|
40373
|
-
throw new (0,
|
|
40373
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(`\uB80C\uB354 \uBBF8\uC9C0\uC6D0 \uD615\uC2DD(${format2}) \u2014 \uB808\uC774\uC544\uC6C3 \uB80C\uB354\uB294 HWPX\xB7HWP \uB9CC \uC9C0\uC6D0\uD569\uB2C8\uB2E4`);
|
|
40374
40374
|
}
|
|
40375
40375
|
async function renderDocumentToScene(input, options = {}) {
|
|
40376
40376
|
const buffer = await loadBuffer(input);
|
|
40377
40377
|
const source = await sourceFormatOf(buffer);
|
|
40378
40378
|
const select = options.pages !== void 0 ? (pageCount) => {
|
|
40379
40379
|
const set = _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, pageCount);
|
|
40380
|
-
if (set.size === 0) throw new (0,
|
|
40380
|
+
if (set.size === 0) throw new (0, _chunkPMULUMUFcjs.KordocError)(`\uC120\uD0DD\uD55C \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uBB38\uC11C\uB294 ${pageCount}\uCABD (pages: ${JSON.stringify(options.pages)})`);
|
|
40381
40381
|
return set;
|
|
40382
40382
|
} : void 0;
|
|
40383
40383
|
const renderOptions = { reflow: _nullishCoalesce(options.reflow, () => ( true)), reflowMode: options.reflowMode, highlights: options.highlights, maxImageBytes: options.maxImageBytes };
|
|
@@ -40413,7 +40413,7 @@ async function renderDocument(input, options) {
|
|
|
40413
40413
|
break;
|
|
40414
40414
|
}
|
|
40415
40415
|
default:
|
|
40416
|
-
throw new (0,
|
|
40416
|
+
throw new (0, _chunkPMULUMUFcjs.KordocError)(`\uC54C \uC218 \uC5C6\uB294 \uB80C\uB354 \uD3EC\uB9F7: ${String(options.format)} (svg|html|png|jpeg|pdf)`);
|
|
40417
40417
|
}
|
|
40418
40418
|
return { scene, assets };
|
|
40419
40419
|
}
|
|
@@ -40443,7 +40443,7 @@ async function extractRenderedRegions(input, options = {}) {
|
|
|
40443
40443
|
const out = [];
|
|
40444
40444
|
for (const [page, items] of [...byPage.entries()].sort((a, b) => a[0] - b[0])) {
|
|
40445
40445
|
const meta = scene.pages.find((p) => p.page === page);
|
|
40446
|
-
if (!meta) throw new (0,
|
|
40446
|
+
if (!meta) throw new (0, _chunkPMULUMUFcjs.KordocError)(`\uD398\uC774\uC9C0 ${page} \uBA54\uD0C0 \uC5C6\uC74C`);
|
|
40447
40447
|
const raster = await rasterizePageSvg(pageSvgs.get(page), meta.width, meta.height, { format: format2, maxWidthPx: options.maxWidthPx, quality: options.quality });
|
|
40448
40448
|
for (const { region, bbox } of items) {
|
|
40449
40449
|
const rect = cropRect(bbox, raster.scale, raster.widthPx, raster.heightPx, _nullishCoalesce(options.paddingPt, () => ( 0)));
|
|
@@ -40467,9 +40467,9 @@ function wantsCrop(kind, policy) {
|
|
|
40467
40467
|
}
|
|
40468
40468
|
async function extractTables(input, options = {}) {
|
|
40469
40469
|
const policy = _nullishCoalesce(options.policy, () => ( "non-tabular-and-uncertain"));
|
|
40470
|
-
const buffer = typeof input === "string" ?
|
|
40470
|
+
const buffer = typeof input === "string" ? _chunkPMULUMUFcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input)) : Buffer.isBuffer(input) ? _chunkPMULUMUFcjs.toArrayBuffer.call(void 0, input) : input;
|
|
40471
40471
|
const parsed = await parse(buffer, { classifyTables: true });
|
|
40472
|
-
if (!parsed.success) throw new (0,
|
|
40472
|
+
if (!parsed.success) throw new (0, _chunkPMULUMUFcjs.KordocError)(`\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
40473
40473
|
const blocks = collectTableBlocks(parsed.blocks);
|
|
40474
40474
|
const out = blocks.map((b, i) => ({
|
|
40475
40475
|
id: _nullishCoalesce(b.table.sourceId, () => ( `tbl-${i + 1}`)),
|
|
@@ -40531,13 +40531,13 @@ async function parse(input, options) {
|
|
|
40531
40531
|
if (typeof input === "string") {
|
|
40532
40532
|
try {
|
|
40533
40533
|
const buf = await _promises.readFile.call(void 0, input);
|
|
40534
|
-
buffer =
|
|
40534
|
+
buffer = _chunkPMULUMUFcjs.toArrayBuffer.call(void 0, buf);
|
|
40535
40535
|
} catch (err) {
|
|
40536
40536
|
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}`;
|
|
40537
40537
|
return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
|
|
40538
40538
|
}
|
|
40539
40539
|
} else if (Buffer.isBuffer(input)) {
|
|
40540
|
-
buffer =
|
|
40540
|
+
buffer = _chunkPMULUMUFcjs.toArrayBuffer.call(void 0, input);
|
|
40541
40541
|
} else {
|
|
40542
40542
|
buffer = input;
|
|
40543
40543
|
}
|
|
@@ -40553,7 +40553,7 @@ async function parse(input, options) {
|
|
|
40553
40553
|
if (result.success && _optionalChain([opts, 'optionalAccess', _835 => _835.classifyTables])) classifyTableTree(result.blocks);
|
|
40554
40554
|
let out = result;
|
|
40555
40555
|
if (result.success && !result.pages) {
|
|
40556
|
-
const pages =
|
|
40556
|
+
const pages = _chunk7WV3WETFcjs.blocksToPages.call(void 0, result.blocks);
|
|
40557
40557
|
if (pages) out = { ...result, pages };
|
|
40558
40558
|
}
|
|
40559
40559
|
if (out.success && _optionalChain([opts, 'optionalAccess', _836 => _836.plain])) {
|
|
@@ -40608,19 +40608,19 @@ function scriptsOff(r, off) {
|
|
|
40608
40608
|
}
|
|
40609
40609
|
async function parseImage(buffer, options) {
|
|
40610
40610
|
try {
|
|
40611
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
40611
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-LTSQRHCN.cjs")));
|
|
40612
40612
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
40613
40613
|
_chunk62W7QCEXcjs.stripScriptTags.call(void 0, { blocks });
|
|
40614
40614
|
return {
|
|
40615
40615
|
success: true,
|
|
40616
40616
|
fileType: "image",
|
|
40617
|
-
markdown:
|
|
40617
|
+
markdown: _chunk7WV3WETFcjs.blocksToMarkdown.call(void 0, blocks),
|
|
40618
40618
|
blocks,
|
|
40619
40619
|
warnings: warnings.length ? warnings : void 0,
|
|
40620
40620
|
pageCount: 1
|
|
40621
40621
|
};
|
|
40622
40622
|
} catch (err) {
|
|
40623
|
-
return { success: false, fileType: "image", error:
|
|
40623
|
+
return { success: false, fileType: "image", error: _chunkPMULUMUFcjs.sanitizeError.call(void 0, err), code: _chunkPMULUMUFcjs.classifyError.call(void 0, err) };
|
|
40624
40624
|
}
|
|
40625
40625
|
}
|
|
40626
40626
|
async function parseHwp3(buffer, options) {
|
|
@@ -40628,7 +40628,7 @@ async function parseHwp3(buffer, options) {
|
|
|
40628
40628
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
40629
40629
|
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _838 => _838.pageCount]) };
|
|
40630
40630
|
} catch (err) {
|
|
40631
|
-
return { success: false, fileType: "hwp3", error:
|
|
40631
|
+
return { success: false, fileType: "hwp3", error: _chunkPMULUMUFcjs.sanitizeError.call(void 0, err), code: _chunkPMULUMUFcjs.classifyError.call(void 0, err) };
|
|
40632
40632
|
}
|
|
40633
40633
|
}
|
|
40634
40634
|
async function parseHwpx(buffer, options) {
|
|
@@ -40636,7 +40636,7 @@ async function parseHwpx(buffer, options) {
|
|
|
40636
40636
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
40637
40637
|
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _839 => _839.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _840 => _840.pageCount]) }, _optionalChain([options, 'optionalAccess', _841 => _841.scriptTags]) === false);
|
|
40638
40638
|
} catch (err) {
|
|
40639
|
-
return { success: false, fileType: "hwpx", error:
|
|
40639
|
+
return { success: false, fileType: "hwpx", error: _chunkPMULUMUFcjs.sanitizeError.call(void 0, err), code: _chunkPMULUMUFcjs.classifyError.call(void 0, err) };
|
|
40640
40640
|
}
|
|
40641
40641
|
}
|
|
40642
40642
|
async function parseHwp(buffer, options) {
|
|
@@ -40662,13 +40662,13 @@ async function parseHwp(buffer, options) {
|
|
|
40662
40662
|
}
|
|
40663
40663
|
return scriptsOff({ success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _843 => _843.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _844 => _844.pageCount]) }, _optionalChain([options, 'optionalAccess', _845 => _845.scriptTags]) === false);
|
|
40664
40664
|
} catch (err) {
|
|
40665
|
-
return { success: false, fileType: "hwp", error:
|
|
40665
|
+
return { success: false, fileType: "hwp", error: _chunkPMULUMUFcjs.sanitizeError.call(void 0, err), code: _chunkPMULUMUFcjs.classifyError.call(void 0, err) };
|
|
40666
40666
|
}
|
|
40667
40667
|
}
|
|
40668
40668
|
async function parsePdf(buffer, options) {
|
|
40669
40669
|
let parsePdfDocument;
|
|
40670
40670
|
try {
|
|
40671
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
40671
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-U52HRNOY.cjs")));
|
|
40672
40672
|
parsePdfDocument = mod.parsePdfDocument;
|
|
40673
40673
|
} catch (e47) {
|
|
40674
40674
|
return {
|
|
@@ -40683,7 +40683,7 @@ async function parsePdf(buffer, options) {
|
|
|
40683
40683
|
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess', _846 => _846.pageCount]) }, _optionalChain([options, 'optionalAccess', _847 => _847.scriptTags]) !== true);
|
|
40684
40684
|
} catch (err) {
|
|
40685
40685
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
40686
|
-
return { success: false, fileType: "pdf", error:
|
|
40686
|
+
return { success: false, fileType: "pdf", error: _chunkPMULUMUFcjs.sanitizeError.call(void 0, err), code: _chunkPMULUMUFcjs.classifyError.call(void 0, err), isImageBased };
|
|
40687
40687
|
}
|
|
40688
40688
|
}
|
|
40689
40689
|
async function parseXlsx(buffer, options) {
|
|
@@ -40691,7 +40691,7 @@ async function parseXlsx(buffer, options) {
|
|
|
40691
40691
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
40692
40692
|
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _848 => _848.pageCount]) };
|
|
40693
40693
|
} catch (err) {
|
|
40694
|
-
return { success: false, fileType: "xlsx", error:
|
|
40694
|
+
return { success: false, fileType: "xlsx", error: _chunkPMULUMUFcjs.sanitizeError.call(void 0, err), code: _chunkPMULUMUFcjs.classifyError.call(void 0, err) };
|
|
40695
40695
|
}
|
|
40696
40696
|
}
|
|
40697
40697
|
async function parseXls(buffer, options) {
|
|
@@ -40699,7 +40699,7 @@ async function parseXls(buffer, options) {
|
|
|
40699
40699
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
40700
40700
|
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _849 => _849.pageCount]) };
|
|
40701
40701
|
} catch (err) {
|
|
40702
|
-
return { success: false, fileType: "xls", error:
|
|
40702
|
+
return { success: false, fileType: "xls", error: _chunkPMULUMUFcjs.sanitizeError.call(void 0, err), code: _chunkPMULUMUFcjs.classifyError.call(void 0, err) };
|
|
40703
40703
|
}
|
|
40704
40704
|
}
|
|
40705
40705
|
async function parseDocx(buffer, options) {
|
|
@@ -40707,7 +40707,7 @@ async function parseDocx(buffer, options) {
|
|
|
40707
40707
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
40708
40708
|
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _850 => _850.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _851 => _851.pageCount]) }, _optionalChain([options, 'optionalAccess', _852 => _852.scriptTags]) === false);
|
|
40709
40709
|
} catch (err) {
|
|
40710
|
-
return { success: false, fileType: "docx", error:
|
|
40710
|
+
return { success: false, fileType: "docx", error: _chunkPMULUMUFcjs.sanitizeError.call(void 0, err), code: _chunkPMULUMUFcjs.classifyError.call(void 0, err) };
|
|
40711
40711
|
}
|
|
40712
40712
|
}
|
|
40713
40713
|
async function parseHwpml(buffer, options) {
|
|
@@ -40715,16 +40715,16 @@ async function parseHwpml(buffer, options) {
|
|
|
40715
40715
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
40716
40716
|
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _853 => _853.pageCount]) };
|
|
40717
40717
|
} catch (err) {
|
|
40718
|
-
return { success: false, fileType: "hwpml", error:
|
|
40718
|
+
return { success: false, fileType: "hwpml", error: _chunkPMULUMUFcjs.sanitizeError.call(void 0, err), code: _chunkPMULUMUFcjs.classifyError.call(void 0, err) };
|
|
40719
40719
|
}
|
|
40720
40720
|
}
|
|
40721
40721
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
40722
40722
|
let buffer;
|
|
40723
40723
|
if (typeof input === "string") {
|
|
40724
40724
|
const buf = await _promises.readFile.call(void 0, input);
|
|
40725
|
-
buffer =
|
|
40725
|
+
buffer = _chunkPMULUMUFcjs.toArrayBuffer.call(void 0, buf);
|
|
40726
40726
|
} else if (Buffer.isBuffer(input)) {
|
|
40727
|
-
buffer =
|
|
40727
|
+
buffer = _chunkPMULUMUFcjs.toArrayBuffer.call(void 0, input);
|
|
40728
40728
|
} else {
|
|
40729
40729
|
buffer = input;
|
|
40730
40730
|
}
|
|
@@ -40750,7 +40750,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
40750
40750
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
40751
40751
|
}
|
|
40752
40752
|
const fill = fillFormFields(parsed.blocks, values);
|
|
40753
|
-
const markdown =
|
|
40753
|
+
const markdown = _chunk7WV3WETFcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
40754
40754
|
if (outputFormat === "hwpx") {
|
|
40755
40755
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
40756
40756
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -40845,5 +40845,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
40845
40845
|
|
|
40846
40846
|
|
|
40847
40847
|
|
|
40848
|
-
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 =
|
|
40848
|
+
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 = _chunkPMULUMUFcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunk7WV3WETFcjs.blocksToMarkdown; exports.blocksToPages = _chunk7WV3WETFcjs.blocksToPages; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; exports.chooseTableRepresentation = chooseTableRepresentation; exports.classifyTable = classifyTable; exports.classifyTableTree = classifyTableTree; exports.collectTableBlocks = collectTableBlocks; exports.compare = compare; exports.detectFormat = detectFormat; exports.detectOle2Format = detectOle2Format; exports.detectZipFormat = detectZipFormat; exports.diffBlocks = diffBlocks; exports.extractClickHereFields = extractClickHereFields; exports.extractFormFields = extractFormFields; exports.extractFormSchema = extractFormSchema; exports.extractRenderedRegions = extractRenderedRegions; exports.extractTables = extractTables; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.flattenLayoutTables = _chunk7WV3WETFcjs.flattenLayoutTables; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hasStructuredCellContent = _chunk7WV3WETFcjs.hasStructuredCellContent; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintGongmunText = lintGongmunText; exports.lintMuncheText = lintMuncheText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.muncheLintWarnings = muncheLintWarnings; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.readBuiltinTemplate = readBuiltinTemplate; exports.readBuiltinTemplateSample = readBuiltinTemplateSample; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderDocument = renderDocument; exports.renderDocumentToScene = renderDocumentToScene; exports.renderHtml = renderHtml; exports.renderHwp5Pages = renderHwp5Pages; exports.renderHwpxToSvg = renderHwpxToSvg; exports.renderSceneToHtml = renderSceneToHtml; exports.resolveBuiltinTemplate = resolveBuiltinTemplate; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.usesGaejosikMunche = usesGaejosikMunche; exports.validateHwpx = validateHwpx;
|
|
40849
40849
|
//# sourceMappingURL=index.cjs.map
|