kordoc 4.7.0 → 4.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/dist/{-MK2223RL.js → -CVPGGSAB.js} +9 -9
- package/dist/{chunk-W5KRKBYR.cjs → chunk-46VU6YXF.cjs} +13 -7
- package/dist/chunk-46VU6YXF.cjs.map +1 -0
- package/dist/{chunk-MVTX6ODZ.js → chunk-4VNUQYUE.js} +1 -1
- package/dist/chunk-4VNUQYUE.js.map +1 -0
- package/dist/{chunk-GIWKBPII.js → chunk-7CWNBDWQ.js} +5 -3
- package/dist/{chunk-GIWKBPII.js.map → chunk-7CWNBDWQ.js.map} +1 -1
- package/dist/{chunk-XZDJXYUC.js → chunk-BSWJCSG7.js} +2 -2
- package/dist/chunk-DCZVOIEO.cjs.map +1 -1
- package/dist/{chunk-TUU535RB.cjs → chunk-DZBMQC2N.cjs} +3 -11
- package/dist/chunk-DZBMQC2N.cjs.map +1 -0
- package/dist/{chunk-C27PPXRZ.cjs → chunk-E2XTVK7H.cjs} +12 -10
- package/dist/chunk-E2XTVK7H.cjs.map +1 -0
- package/dist/{chunk-PV2EXXGI.js → chunk-FJBOVJAG.js} +3 -3
- package/dist/{chunk-P2NWNJMR.js → chunk-GLZMUKYL.js} +3 -3
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/chunk-I4TP7HYB.js +11 -0
- package/dist/chunk-I4TP7HYB.js.map +1 -0
- package/dist/{chunk-GZDOWYJM.js → chunk-IMY4LQ3J.js} +2 -2
- package/dist/{chunk-IDHBO6AG.js → chunk-IN2AOMX6.js} +3 -3
- package/dist/{chunk-PEVPKD6Z.js → chunk-IVSEGHI2.js} +3 -3
- package/dist/{chunk-YUVKU5CW.js → chunk-JMWBMGNH.js} +3 -11
- package/dist/chunk-JMWBMGNH.js.map +1 -0
- package/dist/{chunk-AFPD74JJ.js → chunk-LJW5EQXS.js} +2 -2
- package/dist/{chunk-YXXHH6WC.js → chunk-O4VLHQVG.js} +2 -2
- package/dist/{chunk-3VTMSSDW.js → chunk-P7HPLWEP.js} +11 -5
- package/dist/chunk-P7HPLWEP.js.map +1 -0
- package/dist/{chunk-BCG2PKQU.js → chunk-PGDJUJ4L.js} +11 -5
- package/dist/chunk-PGDJUJ4L.js.map +1 -0
- package/dist/{chunk-ZV5OKQ3Z.cjs → chunk-PV6WSN6E.cjs} +28 -2
- package/dist/chunk-PV6WSN6E.cjs.map +1 -0
- package/dist/{chunk-UAFSPWU7.js → chunk-QKHN7LEV.js} +8 -1
- package/dist/chunk-QKHN7LEV.js.map +1 -0
- package/dist/{chunk-6PIR74EA.js → chunk-QXC5NPO2.js} +26 -14
- package/dist/chunk-QXC5NPO2.js.map +1 -0
- package/dist/chunk-TYIFZT5H.js +52 -0
- package/dist/chunk-TYIFZT5H.js.map +1 -0
- package/dist/chunk-URTDBXV6.cjs +11 -0
- package/dist/chunk-URTDBXV6.cjs.map +1 -0
- package/dist/{chunk-AEYNY6FG.js → chunk-VEBTOI3I.js} +3 -3
- package/dist/{chunk-ZYVULRYF.js → chunk-VXB52EWX.js} +2 -2
- package/dist/{chunk-3H5X63BQ.js → chunk-Y3VDFFAW.js} +27 -1
- package/dist/chunk-Y3VDFFAW.js.map +1 -0
- package/dist/{chunk-5QTHHQQE.cjs → chunk-YU3PLOX4.cjs} +6 -6
- package/dist/chunk-YU3PLOX4.cjs.map +1 -0
- package/dist/chunks-RNP6VLGK.js +10 -0
- package/dist/cli.js +56 -20
- package/dist/cli.js.map +1 -1
- package/dist/{formula-CG4S7TWO.cjs → formula-7D3MLOSV.cjs} +9 -8
- package/dist/formula-7D3MLOSV.cjs.map +1 -0
- package/dist/{formula-LIVQSCMM.js → formula-GHGK7T3S.js} +3 -2
- package/dist/{formula-JLYS73QL.js → formula-RTGCS55B.js} +4 -2
- package/dist/{formula-LIVQSCMM.js.map → formula-RTGCS55B.js.map} +1 -1
- package/dist/{image-ocr-4MHEX4MN.js → image-ocr-2UMWFGRS.js} +10 -9
- package/dist/{image-ocr-4MHEX4MN.js.map → image-ocr-2UMWFGRS.js.map} +1 -1
- package/dist/{image-ocr-OB5PCQUU.cjs → image-ocr-PRI2JKDW.cjs} +12 -11
- package/dist/image-ocr-PRI2JKDW.cjs.map +1 -0
- package/dist/{image-ocr-3A3HZX6O.js → image-ocr-TQ5THN35.js} +6 -5
- package/dist/{image-ocr-3A3HZX6O.js.map → image-ocr-TQ5THN35.js.map} +1 -1
- package/dist/index.cjs +481 -467
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +24 -10
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +33 -16
- package/dist/mcp.js.map +1 -1
- package/dist/model-bundle-5RLZV7P2.js +104 -0
- package/dist/model-bundle-5RLZV7P2.js.map +1 -0
- package/dist/{models-6SIKLKRH.js → models-RSHR2BY7.js} +5 -3
- package/dist/page-range-P7SDW6LR.cjs.map +1 -1
- package/dist/{parser-EQN4YKU4.js → parser-FXEIK3VJ.js} +51 -7
- package/dist/parser-FXEIK3VJ.js.map +1 -0
- package/dist/{parser-EIVCD4NS.js → parser-QPMTNRPU.js} +51 -8
- package/dist/parser-QPMTNRPU.js.map +1 -0
- package/dist/{parser-VACM3DFR.cjs → parser-SCQ7NJUJ.cjs} +71 -27
- package/dist/parser-SCQ7NJUJ.cjs.map +1 -0
- package/dist/pdf-ocr-HPRM24SP.js +16 -0
- package/dist/pdf-ocr-I6DISTBR.js +13 -0
- package/dist/pdf-ocr-JNWL65YW.cjs +14 -0
- package/dist/pdf-ocr-JNWL65YW.cjs.map +1 -0
- package/dist/{profile-io-L5EH4JAD.js → profile-io-I4UGTNP6.js} +3 -3
- package/dist/{rasterize-7AR662AL.js → rasterize-QY3XJKCH.js} +2 -2
- package/dist/render-HEQX5DII.js +10 -0
- package/dist/seal-NB2YJ5F4.js +10 -0
- package/dist/{setup-GUQT5ELJ.js → setup-T2BY3VME.js} +30 -7
- package/dist/setup-T2BY3VME.js.map +1 -0
- package/dist/{watch-MONT6CGI.js → watch-JJE2UGVK.js} +13 -9
- package/dist/watch-JJE2UGVK.js.map +1 -0
- package/package.json +7 -3
- package/dist/chunk-3H5X63BQ.js.map +0 -1
- package/dist/chunk-3VTMSSDW.js.map +0 -1
- package/dist/chunk-5QTHHQQE.cjs.map +0 -1
- package/dist/chunk-6PIR74EA.js.map +0 -1
- package/dist/chunk-BCG2PKQU.js.map +0 -1
- package/dist/chunk-C27PPXRZ.cjs.map +0 -1
- package/dist/chunk-MVTX6ODZ.js.map +0 -1
- package/dist/chunk-TUU535RB.cjs.map +0 -1
- package/dist/chunk-UAFSPWU7.js.map +0 -1
- package/dist/chunk-W5KRKBYR.cjs.map +0 -1
- package/dist/chunk-YUVKU5CW.js.map +0 -1
- package/dist/chunk-ZV5OKQ3Z.cjs.map +0 -1
- package/dist/chunks-4HEG6ZPG.js +0 -10
- package/dist/formula-CG4S7TWO.cjs.map +0 -1
- package/dist/image-ocr-OB5PCQUU.cjs.map +0 -1
- package/dist/parser-EIVCD4NS.js.map +0 -1
- package/dist/parser-EQN4YKU4.js.map +0 -1
- package/dist/parser-VACM3DFR.cjs.map +0 -1
- package/dist/pdf-ocr-N62EWEX4.js +0 -12
- package/dist/pdf-ocr-NPYDUIC5.js +0 -15
- package/dist/pdf-ocr-OBPQ4F4D.cjs +0 -13
- package/dist/pdf-ocr-OBPQ4F4D.cjs.map +0 -1
- package/dist/render-CAFQT7S4.js +0 -10
- package/dist/seal-ESAC3IZR.js +0 -10
- package/dist/setup-GUQT5ELJ.js.map +0 -1
- package/dist/watch-MONT6CGI.js.map +0 -1
- /package/dist/{-MK2223RL.js.map → -CVPGGSAB.js.map} +0 -0
- /package/dist/{chunk-XZDJXYUC.js.map → chunk-BSWJCSG7.js.map} +0 -0
- /package/dist/{chunk-PV2EXXGI.js.map → chunk-FJBOVJAG.js.map} +0 -0
- /package/dist/{chunk-P2NWNJMR.js.map → chunk-GLZMUKYL.js.map} +0 -0
- /package/dist/{chunk-GZDOWYJM.js.map → chunk-IMY4LQ3J.js.map} +0 -0
- /package/dist/{chunk-IDHBO6AG.js.map → chunk-IN2AOMX6.js.map} +0 -0
- /package/dist/{chunk-PEVPKD6Z.js.map → chunk-IVSEGHI2.js.map} +0 -0
- /package/dist/{chunk-AFPD74JJ.js.map → chunk-LJW5EQXS.js.map} +0 -0
- /package/dist/{chunk-YXXHH6WC.js.map → chunk-O4VLHQVG.js.map} +0 -0
- /package/dist/{chunk-AEYNY6FG.js.map → chunk-VEBTOI3I.js.map} +0 -0
- /package/dist/{chunk-ZYVULRYF.js.map → chunk-VXB52EWX.js.map} +0 -0
- /package/dist/{chunks-4HEG6ZPG.js.map → chunks-RNP6VLGK.js.map} +0 -0
- /package/dist/{formula-JLYS73QL.js.map → formula-GHGK7T3S.js.map} +0 -0
- /package/dist/{models-6SIKLKRH.js.map → models-RSHR2BY7.js.map} +0 -0
- /package/dist/{pdf-ocr-N62EWEX4.js.map → pdf-ocr-HPRM24SP.js.map} +0 -0
- /package/dist/{pdf-ocr-NPYDUIC5.js.map → pdf-ocr-I6DISTBR.js.map} +0 -0
- /package/dist/{profile-io-L5EH4JAD.js.map → profile-io-I4UGTNP6.js.map} +0 -0
- /package/dist/{rasterize-7AR662AL.js.map → rasterize-QY3XJKCH.js.map} +0 -0
- /package/dist/{render-CAFQT7S4.js.map → render-HEQX5DII.js.map} +0 -0
- /package/dist/{seal-ESAC3IZR.js.map → seal-NB2YJ5F4.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunk46VU6YXFcjs = require('./chunk-46VU6YXF.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
@@ -16,6 +16,7 @@ var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
var _chunkURTDBXV6cjs = require('./chunk-URTDBXV6.cjs');
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
|
|
@@ -27,7 +28,8 @@ var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
var _chunkDZBMQC2Ncjs = require('./chunk-DZBMQC2N.cjs');
|
|
31
33
|
|
|
32
34
|
|
|
33
35
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -482,7 +484,7 @@ function rawTextContent(node, depth = 0) {
|
|
|
482
484
|
// src/hwpx/parser-shared.ts
|
|
483
485
|
var MAX_DECOMPRESS_SIZE = 256 * 1024 * 1024;
|
|
484
486
|
var MAX_ZIP_ENTRIES = 500;
|
|
485
|
-
var ZipBombError = class extends
|
|
487
|
+
var ZipBombError = class extends _chunkDZBMQC2Ncjs.KordocError {
|
|
486
488
|
constructor(message) {
|
|
487
489
|
super(message);
|
|
488
490
|
this.name = "ZipBombError";
|
|
@@ -497,7 +499,7 @@ function createSectionShared() {
|
|
|
497
499
|
function createXmlParser(warnings) {
|
|
498
500
|
return new (0, _xmldom.DOMParser)({
|
|
499
501
|
onError(level, msg2) {
|
|
500
|
-
if (level === "fatalError") throw new (0,
|
|
502
|
+
if (level === "fatalError") throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
501
503
|
_optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
502
504
|
}
|
|
503
505
|
});
|
|
@@ -532,13 +534,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
532
534
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
533
535
|
const checksumType = attrOf(inner, "checksum-type");
|
|
534
536
|
if (algorithm !== AES256_CBC) {
|
|
535
|
-
throw new (0,
|
|
537
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
536
538
|
}
|
|
537
539
|
if (startKey !== START_KEY_SHA256) {
|
|
538
|
-
throw new (0,
|
|
540
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
539
541
|
}
|
|
540
542
|
if (!_optionalChain([checksumType, 'optionalAccess', _8 => _8.endsWith, 'call', _9 => _9(CHECKSUM_SHA256_1K)])) {
|
|
541
|
-
throw new (0,
|
|
543
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
542
544
|
}
|
|
543
545
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
544
546
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -546,10 +548,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
546
548
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
547
549
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
548
550
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
549
|
-
throw new (0,
|
|
551
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
550
552
|
}
|
|
551
553
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
552
|
-
throw new (0,
|
|
554
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
553
555
|
}
|
|
554
556
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
555
557
|
}
|
|
@@ -582,11 +584,11 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
582
584
|
for (const entry of entries) {
|
|
583
585
|
const file = zip.file(entry.path);
|
|
584
586
|
if (!file) {
|
|
585
|
-
throw new (0,
|
|
587
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
586
588
|
}
|
|
587
589
|
const plain = decryptEntry(await file.async("nodebuffer"), entry, startKey);
|
|
588
590
|
if (!plain) {
|
|
589
|
-
throw new (0,
|
|
591
|
+
throw new (0, _chunkDZBMQC2Ncjs.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.");
|
|
590
592
|
}
|
|
591
593
|
decrypted.push({ path: entry.path, plain });
|
|
592
594
|
}
|
|
@@ -634,10 +636,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
634
636
|
const xml = await file.async("text");
|
|
635
637
|
if (decompressed) {
|
|
636
638
|
decompressed.total += xml.length * 2;
|
|
637
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
639
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
638
640
|
}
|
|
639
641
|
const parser = createXmlParser();
|
|
640
|
-
const doc = parser.parseFromString(
|
|
642
|
+
const doc = parser.parseFromString(_chunkDZBMQC2Ncjs.stripDtd.call(void 0, xml), "text/xml");
|
|
641
643
|
if (!doc.documentElement) continue;
|
|
642
644
|
const domDoc = doc;
|
|
643
645
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -683,6 +685,8 @@ function parseCharProperties(doc, map) {
|
|
|
683
685
|
else if (localTag === "strikeout") {
|
|
684
686
|
const shape = k.getAttribute("shape") || "";
|
|
685
687
|
if (isRealStrikeShape(shape)) prop.strike = true;
|
|
688
|
+
} else if (localTag === "underline") {
|
|
689
|
+
if (k.getAttribute("type") === "BOTTOM") prop.underline = true;
|
|
686
690
|
}
|
|
687
691
|
}
|
|
688
692
|
const fontFaces = el.getElementsByTagName("*");
|
|
@@ -824,9 +828,9 @@ function detectHwpxHeadings(blocks, styleMap) {
|
|
|
824
828
|
let level = 0;
|
|
825
829
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _16 => _16.style, 'optionalAccess', _17 => _17.fontSize])) {
|
|
826
830
|
const ratio = block.style.fontSize / baseFontSize;
|
|
827
|
-
if (ratio >=
|
|
828
|
-
else if (ratio >=
|
|
829
|
-
else if (ratio >=
|
|
831
|
+
if (ratio >= _chunkURTDBXV6cjs.HEADING_RATIO_H1) level = 1;
|
|
832
|
+
else if (ratio >= _chunkURTDBXV6cjs.HEADING_RATIO_H2) level = 2;
|
|
833
|
+
else if (ratio >= _chunkURTDBXV6cjs.HEADING_RATIO_H3) level = 3;
|
|
830
834
|
}
|
|
831
835
|
const compactText = text.replace(/\s+/g, "");
|
|
832
836
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1419,7 +1423,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1419
1423
|
|
|
1420
1424
|
// src/hwpx/table-build.ts
|
|
1421
1425
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1422
|
-
const table2 =
|
|
1426
|
+
const table2 = _chunk46VU6YXFcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1423
1427
|
if (state.caption) table2.caption = state.caption;
|
|
1424
1428
|
if (_optionalChain([state, 'access', _21 => _21.captionBlocks, 'optionalAccess', _22 => _22.length])) table2.captionBlocks = state.captionBlocks;
|
|
1425
1429
|
const anchors = [];
|
|
@@ -1490,7 +1494,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1490
1494
|
const cell2 = parentTable.cell;
|
|
1491
1495
|
(cell2.blocks ??= []).push(block);
|
|
1492
1496
|
cell2.hasStructure = true;
|
|
1493
|
-
let flat =
|
|
1497
|
+
let flat = _chunk46VU6YXFcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1494
1498
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1495
1499
|
if (flat) {
|
|
1496
1500
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -1506,7 +1510,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1506
1510
|
// src/hwpx/section-walker.ts
|
|
1507
1511
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
1508
1512
|
const parser = createXmlParser(warnings);
|
|
1509
|
-
const doc = parser.parseFromString(
|
|
1513
|
+
const doc = parser.parseFromString(_chunkDZBMQC2Ncjs.stripDtd.call(void 0, xml), "text/xml");
|
|
1510
1514
|
if (!doc.documentElement) return [];
|
|
1511
1515
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
1512
1516
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -1613,8 +1617,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1613
1617
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
1614
1618
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
1615
1619
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
1616
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
1617
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
1620
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunk46VU6YXFcjs.MAX_COLS);
|
|
1621
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunk46VU6YXFcjs.MAX_ROWS);
|
|
1618
1622
|
}
|
|
1619
1623
|
break;
|
|
1620
1624
|
case "p": {
|
|
@@ -1885,7 +1889,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
1885
1889
|
const sink = [];
|
|
1886
1890
|
const st = { rows: [], currentRow: [], cell: null };
|
|
1887
1891
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
1888
|
-
let flat =
|
|
1892
|
+
let flat = _chunk46VU6YXFcjs.convertTableToText.call(void 0, st.rows);
|
|
1889
1893
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
1890
1894
|
const built = [];
|
|
1891
1895
|
completeTable(st, [], built, ctx);
|
|
@@ -2040,7 +2044,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2040
2044
|
let url = (ch.textContent || "").trim();
|
|
2041
2045
|
if (!url) continue;
|
|
2042
2046
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2043
|
-
const safe =
|
|
2047
|
+
const safe = _chunkDZBMQC2Ncjs.sanitizeHref.call(void 0, url);
|
|
2044
2048
|
if (safe) return safe;
|
|
2045
2049
|
}
|
|
2046
2050
|
return void 0;
|
|
@@ -2200,7 +2204,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2200
2204
|
case "hyperlink": {
|
|
2201
2205
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2202
2206
|
if (url) {
|
|
2203
|
-
const safe =
|
|
2207
|
+
const safe = _chunkDZBMQC2Ncjs.sanitizeHref.call(void 0, url);
|
|
2204
2208
|
if (safe) href = safe;
|
|
2205
2209
|
}
|
|
2206
2210
|
walk(child, depth + 1);
|
|
@@ -2381,21 +2385,22 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2381
2385
|
if (_optionalChain([cp, 'optionalAccess', _66 => _66.bold])) span.bold = true;
|
|
2382
2386
|
if (_optionalChain([cp, 'optionalAccess', _67 => _67.italic])) span.italic = true;
|
|
2383
2387
|
if (_optionalChain([cp, 'optionalAccess', _68 => _68.strike])) span.strike = true;
|
|
2388
|
+
if (_optionalChain([cp, 'optionalAccess', _69 => _69.underline])) span.underline = true;
|
|
2384
2389
|
}
|
|
2385
|
-
if (span.bold || span.italic || span.strike || span.code) styled = true;
|
|
2390
|
+
if (span.bold || span.italic || span.strike || span.underline || span.code) styled = true;
|
|
2386
2391
|
spans.push(span);
|
|
2387
2392
|
}
|
|
2388
2393
|
if (!styled || spans.length === 0) return null;
|
|
2389
2394
|
const merged = [];
|
|
2390
2395
|
for (const s of spans) {
|
|
2391
2396
|
const last = merged[merged.length - 1];
|
|
2392
|
-
if (last && !!last.bold === !!s.bold && !!last.italic === !!s.italic && !!last.strike === !!s.strike && !!last.code === !!s.code) {
|
|
2397
|
+
if (last && !!last.bold === !!s.bold && !!last.italic === !!s.italic && !!last.strike === !!s.strike && !!last.underline === !!s.underline && !!last.code === !!s.code) {
|
|
2393
2398
|
last.text += s.text;
|
|
2394
2399
|
} else {
|
|
2395
2400
|
merged.push(s);
|
|
2396
2401
|
}
|
|
2397
2402
|
}
|
|
2398
|
-
if (requireMixed && !merged.some((s) => s.strike) && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
|
|
2403
|
+
if (requireMixed && !merged.some((s) => s.strike || s.underline) && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
|
|
2399
2404
|
return merged;
|
|
2400
2405
|
}
|
|
2401
2406
|
function gongmunDepthFromIndent(para2, left, ctx) {
|
|
@@ -2403,12 +2408,12 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2403
2408
|
if (!styleMap) return null;
|
|
2404
2409
|
let unit = 0;
|
|
2405
2410
|
const kids = para2.childNodes;
|
|
2406
|
-
for (let i = 0; i < (_nullishCoalesce(_optionalChain([kids, 'optionalAccess',
|
|
2411
|
+
for (let i = 0; i < (_nullishCoalesce(_optionalChain([kids, 'optionalAccess', _70 => _70.length]), () => ( 0))); i++) {
|
|
2407
2412
|
const child = kids[i];
|
|
2408
2413
|
if (child.nodeType !== 1) continue;
|
|
2409
2414
|
const tag = (child.tagName || child.localName || "").replace(/^[^:]+:/, "");
|
|
2410
2415
|
if (tag !== "run" && tag !== "r") continue;
|
|
2411
|
-
const size = _optionalChain([styleMap, 'access',
|
|
2416
|
+
const size = _optionalChain([styleMap, 'access', _71 => _71.charProperties, 'access', _72 => _72.get, 'call', _73 => _73(_nullishCoalesce(child.getAttribute("charPrIDRef"), () => ( ""))), 'optionalAccess', _74 => _74.fontSize]);
|
|
2412
2417
|
if (size) unit = size * 100;
|
|
2413
2418
|
break;
|
|
2414
2419
|
}
|
|
@@ -2481,7 +2486,7 @@ function decompressStream(data) {
|
|
|
2481
2486
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
2482
2487
|
}
|
|
2483
2488
|
function parseFileHeader(data) {
|
|
2484
|
-
if (data.length < 40) throw new (0,
|
|
2489
|
+
if (data.length < 40) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
2485
2490
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
2486
2491
|
return {
|
|
2487
2492
|
signature: sig,
|
|
@@ -2614,7 +2619,7 @@ function appendParaText(state, data, resolveControl) {
|
|
|
2614
2619
|
const resolveAt = (byteOffset, extended) => {
|
|
2615
2620
|
const ctrlId = data.readUInt32LE(byteOffset);
|
|
2616
2621
|
const idx = extended ? state.ctrlIdx : -1;
|
|
2617
|
-
const replacement = _optionalChain([resolveControl, 'optionalCall',
|
|
2622
|
+
const replacement = _optionalChain([resolveControl, 'optionalCall', _75 => _75(idx, ctrlId)]);
|
|
2618
2623
|
if (replacement) result += replacement;
|
|
2619
2624
|
if (extended) state.ctrlIdx++;
|
|
2620
2625
|
};
|
|
@@ -2818,7 +2823,7 @@ function extractHwp5Images(fileIndex, blocks, warnings, sweepUnreferenced) {
|
|
|
2818
2823
|
const binDataMap = /* @__PURE__ */ new Map();
|
|
2819
2824
|
if (fileIndex) {
|
|
2820
2825
|
for (const entry of fileIndex) {
|
|
2821
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
2826
|
+
if (!_optionalChain([entry, 'optionalAccess', _76 => _76.name]) || !entry.content) continue;
|
|
2822
2827
|
const match = entry.name.match(BIN_ENTRY_RE);
|
|
2823
2828
|
if (!match) continue;
|
|
2824
2829
|
const idx = parseInt(match[1], 16);
|
|
@@ -2894,11 +2899,11 @@ function collectImageBlocks2(blocks, out, ownerCell, depth = 0) {
|
|
|
2894
2899
|
} else if (block.type === "table" && block.table) {
|
|
2895
2900
|
for (const row of block.table.cells) {
|
|
2896
2901
|
for (const cell2 of row) {
|
|
2897
|
-
if (_optionalChain([cell2, 'access',
|
|
2902
|
+
if (_optionalChain([cell2, 'access', _77 => _77.blocks, 'optionalAccess', _78 => _78.length])) collectImageBlocks2(cell2.blocks, out, cell2, depth + 1);
|
|
2898
2903
|
}
|
|
2899
2904
|
}
|
|
2900
2905
|
}
|
|
2901
|
-
if (_optionalChain([block, 'access',
|
|
2906
|
+
if (_optionalChain([block, 'access', _79 => _79.children, 'optionalAccess', _80 => _80.length])) collectImageBlocks2(block.children, out, ownerCell, depth + 1);
|
|
2902
2907
|
}
|
|
2903
2908
|
}
|
|
2904
2909
|
async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUnreferenced) {
|
|
@@ -2933,13 +2938,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
2933
2938
|
}
|
|
2934
2939
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
2935
2940
|
for (const path of allCandidates) {
|
|
2936
|
-
if (
|
|
2941
|
+
if (_chunkDZBMQC2Ncjs.isPathTraversal.call(void 0, path)) continue;
|
|
2937
2942
|
const file = zip.file(path);
|
|
2938
2943
|
if (!file) continue;
|
|
2939
2944
|
try {
|
|
2940
2945
|
const data = await file.async("uint8array");
|
|
2941
2946
|
decompressed.total += data.length;
|
|
2942
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
2947
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
2943
2948
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
2944
2949
|
const mimeType = imageExtToMime(ext);
|
|
2945
2950
|
imageIndex++;
|
|
@@ -2949,10 +2954,10 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
2949
2954
|
usedPaths.add(path);
|
|
2950
2955
|
break;
|
|
2951
2956
|
} catch (err) {
|
|
2952
|
-
if (err instanceof
|
|
2957
|
+
if (err instanceof _chunkDZBMQC2Ncjs.KordocError) throw err;
|
|
2953
2958
|
}
|
|
2954
2959
|
}
|
|
2955
|
-
if (!img) _optionalChain([warnings, 'optionalAccess',
|
|
2960
|
+
if (!img) _optionalChain([warnings, 'optionalAccess', _81 => _81.push, 'call', _82 => _82({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
2956
2961
|
resolved.set(ref, img);
|
|
2957
2962
|
}
|
|
2958
2963
|
if (!img) {
|
|
@@ -2969,11 +2974,11 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
2969
2974
|
if (sweepUnreferenced) {
|
|
2970
2975
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
2971
2976
|
for (const file of binEntries) {
|
|
2972
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
2977
|
+
if (file.dir || usedPaths.has(file.name) || _chunkDZBMQC2Ncjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
2973
2978
|
try {
|
|
2974
2979
|
const data = await file.async("uint8array");
|
|
2975
2980
|
decompressed.total += data.length;
|
|
2976
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
2981
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
2977
2982
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
2978
2983
|
let mimeType = imageExtToMime(ext);
|
|
2979
2984
|
if (mimeType === "application/octet-stream") {
|
|
@@ -2987,8 +2992,8 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
2987
2992
|
images.push(img);
|
|
2988
2993
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
2989
2994
|
} catch (err) {
|
|
2990
|
-
if (err instanceof
|
|
2991
|
-
_optionalChain([warnings, 'optionalAccess',
|
|
2995
|
+
if (err instanceof _chunkDZBMQC2Ncjs.KordocError) throw err;
|
|
2996
|
+
_optionalChain([warnings, 'optionalAccess', _83 => _83.push, 'call', _84 => _84({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
2992
2997
|
}
|
|
2993
2998
|
}
|
|
2994
2999
|
}
|
|
@@ -3038,7 +3043,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3038
3043
|
}
|
|
3039
3044
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3040
3045
|
const name = new TextDecoder().decode(nameBytes);
|
|
3041
|
-
if (
|
|
3046
|
+
if (_chunkDZBMQC2Ncjs.isPathTraversal.call(void 0, name)) {
|
|
3042
3047
|
pos = fileStart + compSize;
|
|
3043
3048
|
continue;
|
|
3044
3049
|
}
|
|
@@ -3056,16 +3061,16 @@ function extractFromBrokenZip(buffer) {
|
|
|
3056
3061
|
continue;
|
|
3057
3062
|
}
|
|
3058
3063
|
totalDecompressed += content.length * 2;
|
|
3059
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3064
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3060
3065
|
sectionNum++;
|
|
3061
3066
|
blocks.push(...parseSectionXml(content, void 0, warnings, sectionNum, shared));
|
|
3062
3067
|
} catch (e17) {
|
|
3063
3068
|
continue;
|
|
3064
3069
|
}
|
|
3065
3070
|
}
|
|
3066
|
-
if (blocks.length === 0) throw new (0,
|
|
3071
|
+
if (blocks.length === 0) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3067
3072
|
applyPageText(blocks, shared);
|
|
3068
|
-
const markdown =
|
|
3073
|
+
const markdown = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3069
3074
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3070
3075
|
}
|
|
3071
3076
|
async function readKordocLayout(zip) {
|
|
@@ -3074,7 +3079,7 @@ async function readKordocLayout(zip) {
|
|
|
3074
3079
|
try {
|
|
3075
3080
|
const xml = await file.async("text");
|
|
3076
3081
|
if (!/<opf:meta\b[^>]*name="generator"[^>]*content="kordoc"/.test(xml)) return null;
|
|
3077
|
-
return _nullishCoalesce(_optionalChain([xml, 'access',
|
|
3082
|
+
return _nullishCoalesce(_optionalChain([xml, 'access', _85 => _85.match, 'call', _86 => _86(/<opf:meta\b[^>]*name="kordoc-layout"[^>]*content="([^"]*)"/), 'optionalAccess', _87 => _87[1]]), () => ( null));
|
|
3078
3083
|
} catch (e18) {
|
|
3079
3084
|
return null;
|
|
3080
3085
|
}
|
|
@@ -3090,18 +3095,18 @@ async function resolveSectionPaths(zip) {
|
|
|
3090
3095
|
if (paths.length > 0) return paths;
|
|
3091
3096
|
}
|
|
3092
3097
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3093
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3098
|
+
return sectionFiles.map((f) => f.name).sort(_chunkDZBMQC2Ncjs.compareSectionPaths);
|
|
3094
3099
|
}
|
|
3095
3100
|
function parseSectionPathsFromManifest(xml) {
|
|
3096
3101
|
const parser = createXmlParser();
|
|
3097
|
-
const doc = parser.parseFromString(
|
|
3102
|
+
const doc = parser.parseFromString(_chunkDZBMQC2Ncjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3098
3103
|
const items = doc.getElementsByTagName("opf:item");
|
|
3099
3104
|
const spine = doc.getElementsByTagName("opf:itemref");
|
|
3100
3105
|
const idToHref = /* @__PURE__ */ new Map();
|
|
3101
3106
|
for (let i = 0; i < items.length; i++) {
|
|
3102
3107
|
const item = items[i];
|
|
3103
3108
|
const id = item.getAttribute("id") || "";
|
|
3104
|
-
const href =
|
|
3109
|
+
const href = _chunkDZBMQC2Ncjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3105
3110
|
if (id && href) idToHref.set(id, href);
|
|
3106
3111
|
}
|
|
3107
3112
|
if (spine.length > 0) {
|
|
@@ -3112,7 +3117,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3112
3117
|
}
|
|
3113
3118
|
if (ordered.length > 0) return ordered;
|
|
3114
3119
|
}
|
|
3115
|
-
return Array.from(idToHref.values()).sort(
|
|
3120
|
+
return Array.from(idToHref.values()).sort(_chunkDZBMQC2Ncjs.compareSectionPaths);
|
|
3116
3121
|
}
|
|
3117
3122
|
|
|
3118
3123
|
// src/hwpx/metadata.ts
|
|
@@ -3125,7 +3130,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3125
3130
|
const xml = await file.async("text");
|
|
3126
3131
|
if (decompressed) {
|
|
3127
3132
|
decompressed.total += xml.length * 2;
|
|
3128
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3133
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3129
3134
|
}
|
|
3130
3135
|
parseDublinCoreMetadata(xml, metadata);
|
|
3131
3136
|
if (metadata.title || metadata.author) return;
|
|
@@ -3135,13 +3140,13 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3135
3140
|
}
|
|
3136
3141
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3137
3142
|
const parser = createXmlParser();
|
|
3138
|
-
const doc = parser.parseFromString(
|
|
3143
|
+
const doc = parser.parseFromString(_chunkDZBMQC2Ncjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3139
3144
|
if (!doc.documentElement) return;
|
|
3140
3145
|
const getText = (tagNames) => {
|
|
3141
3146
|
for (const tag of tagNames) {
|
|
3142
3147
|
const els = doc.getElementsByTagName(tag);
|
|
3143
3148
|
if (els.length > 0) {
|
|
3144
|
-
const text = _optionalChain([els, 'access',
|
|
3149
|
+
const text = _optionalChain([els, 'access', _88 => _88[0], 'access', _89 => _89.textContent, 'optionalAccess', _90 => _90.trim, 'call', _91 => _91()]);
|
|
3145
3150
|
if (text) return text;
|
|
3146
3151
|
}
|
|
3147
3152
|
}
|
|
@@ -3160,7 +3165,7 @@ function parseDublinCoreMetadata(xml, metadata) {
|
|
|
3160
3165
|
|
|
3161
3166
|
// src/hwpx/parser.ts
|
|
3162
3167
|
async function parseHwpxDocument(buffer, options) {
|
|
3163
|
-
|
|
3168
|
+
_chunkDZBMQC2Ncjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3164
3169
|
let zip;
|
|
3165
3170
|
try {
|
|
3166
3171
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3169,22 +3174,22 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3169
3174
|
}
|
|
3170
3175
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3171
3176
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3172
|
-
throw new (0,
|
|
3177
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3173
3178
|
}
|
|
3174
3179
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3175
3180
|
if (manifestFile) {
|
|
3176
3181
|
const manifestXml = await manifestFile.async("text");
|
|
3177
3182
|
if (isEncryptedHwpx(manifestXml)) {
|
|
3178
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3183
|
+
if (_optionalChain([options, 'optionalAccess', _92 => _92.password])) {
|
|
3179
3184
|
await decryptHwpxInPlace(zip, manifestXml, options.password);
|
|
3180
3185
|
} else {
|
|
3181
|
-
if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
3186
|
+
if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _93 => _93.filePath])) {
|
|
3182
3187
|
const { pages, pageCount, warnings: warnings2 } = extractTextViaCom(options.filePath);
|
|
3183
3188
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
3184
3189
|
return comResultToParseResult(pages, pageCount, warnings2);
|
|
3185
3190
|
}
|
|
3186
3191
|
}
|
|
3187
|
-
throw new (0,
|
|
3192
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
3188
3193
|
"\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."
|
|
3189
3194
|
);
|
|
3190
3195
|
}
|
|
@@ -3196,15 +3201,15 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3196
3201
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3197
3202
|
const warnings = [];
|
|
3198
3203
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3199
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3204
|
+
if (sectionPaths.length === 0) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3200
3205
|
metadata.pageCount = sectionPaths.length;
|
|
3201
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
3206
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _94 => _94.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
|
|
3202
3207
|
const totalTarget = pageFilter ? pageFilter.size : sectionPaths.length;
|
|
3203
3208
|
const blocks = [];
|
|
3204
3209
|
const shared = createSectionShared();
|
|
3205
3210
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
3206
|
-
shared.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess',
|
|
3207
|
-
shared.keepEmptyParagraphs = _optionalChain([options, 'optionalAccess',
|
|
3211
|
+
shared.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _95 => _95.keepTrailingEmptyCols]);
|
|
3212
|
+
shared.keepEmptyParagraphs = _optionalChain([options, 'optionalAccess', _96 => _96.keepEmptyParagraphs]);
|
|
3208
3213
|
let parsedSections = 0;
|
|
3209
3214
|
for (let si = 0; si < sectionPaths.length; si++) {
|
|
3210
3215
|
if (pageFilter && !pageFilter.has(si + 1)) continue;
|
|
@@ -3216,7 +3221,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3216
3221
|
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new ZipBombError("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3217
3222
|
blocks.push(...parseSectionXml(xml, styleMap, warnings, si + 1, shared));
|
|
3218
3223
|
parsedSections++;
|
|
3219
|
-
_optionalChain([options, 'optionalAccess',
|
|
3224
|
+
_optionalChain([options, 'optionalAccess', _97 => _97.onProgress, 'optionalCall', _98 => _98(parsedSections, totalTarget)]);
|
|
3220
3225
|
} catch (secErr) {
|
|
3221
3226
|
if (secErr instanceof ZipBombError) throw secErr;
|
|
3222
3227
|
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" });
|
|
@@ -3226,7 +3231,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3226
3231
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !pageFilter);
|
|
3227
3232
|
detectHwpxHeadings(blocks, styleMap);
|
|
3228
3233
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3229
|
-
const markdown =
|
|
3234
|
+
const markdown = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3230
3235
|
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 };
|
|
3231
3236
|
}
|
|
3232
3237
|
|
|
@@ -4226,19 +4231,19 @@ function decryptPasswordStream(raw, password) {
|
|
|
4226
4231
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4227
4232
|
var TAG_ID_MAPPINGS = 17;
|
|
4228
4233
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4229
|
-
const wrong = () => new (0,
|
|
4234
|
+
const wrong = () => new (0, _chunkDZBMQC2Ncjs.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.");
|
|
4230
4235
|
let records;
|
|
4231
4236
|
try {
|
|
4232
4237
|
records = readRecords3(data);
|
|
4233
4238
|
} catch (e22) {
|
|
4234
4239
|
throw wrong();
|
|
4235
4240
|
}
|
|
4236
|
-
if (_optionalChain([records, 'access',
|
|
4241
|
+
if (_optionalChain([records, 'access', _99 => _99[0], 'optionalAccess', _100 => _100.tagId]) !== TAG_DOCUMENT_PROPERTIES) throw wrong();
|
|
4237
4242
|
if (!records.some((r) => r.tagId === TAG_ID_MAPPINGS)) throw wrong();
|
|
4238
4243
|
}
|
|
4239
4244
|
function assertSupportedEncryptVersion(version) {
|
|
4240
4245
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4241
|
-
throw new (0,
|
|
4246
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
4242
4247
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4243
4248
|
);
|
|
4244
4249
|
}
|
|
@@ -4321,25 +4326,25 @@ function parseHwp5Document(buffer, options) {
|
|
|
4321
4326
|
lenientCfb = parseLenientCfb(buffer);
|
|
4322
4327
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
4323
4328
|
} catch (e24) {
|
|
4324
|
-
throw new (0,
|
|
4329
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
4325
4330
|
}
|
|
4326
4331
|
}
|
|
4327
4332
|
const readRawStream = (path) => {
|
|
4328
4333
|
if (cfb) {
|
|
4329
4334
|
const entry = CFB.find(cfb, path);
|
|
4330
|
-
return _optionalChain([entry, 'optionalAccess',
|
|
4335
|
+
return _optionalChain([entry, 'optionalAccess', _101 => _101.content]) ? Buffer.from(entry.content) : null;
|
|
4331
4336
|
}
|
|
4332
4337
|
return lenientCfb.findStream(path);
|
|
4333
4338
|
};
|
|
4334
4339
|
const headerData = readRawStream("/FileHeader");
|
|
4335
|
-
if (!headerData) throw new (0,
|
|
4340
|
+
if (!headerData) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
4336
4341
|
const header = parseFileHeader(headerData);
|
|
4337
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
4338
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
4342
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkDZBMQC2Ncjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
4343
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
4339
4344
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
4340
4345
|
if (encrypted) {
|
|
4341
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
4342
|
-
throw new (0,
|
|
4346
|
+
if (!_optionalChain([options, 'optionalAccess', _102 => _102.password])) {
|
|
4347
|
+
throw new (0, _chunkDZBMQC2Ncjs.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.");
|
|
4343
4348
|
}
|
|
4344
4349
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
4345
4350
|
}
|
|
@@ -4357,24 +4362,24 @@ function parseHwp5Document(buffer, options) {
|
|
|
4357
4362
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
4358
4363
|
if (encrypted) {
|
|
4359
4364
|
const rawDocInfo = findStream("/DocInfo");
|
|
4360
|
-
if (!rawDocInfo) throw new (0,
|
|
4365
|
+
if (!rawDocInfo) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
4361
4366
|
let docInfoData;
|
|
4362
4367
|
try {
|
|
4363
4368
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
4364
4369
|
} catch (e25) {
|
|
4365
|
-
throw new (0,
|
|
4370
|
+
throw new (0, _chunkDZBMQC2Ncjs.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.");
|
|
4366
4371
|
}
|
|
4367
4372
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
4368
4373
|
}
|
|
4369
4374
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
4370
4375
|
const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : encrypted ? findSectionsVia(findStream) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
|
|
4371
|
-
if (sections.length === 0) throw new (0,
|
|
4376
|
+
if (sections.length === 0) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
4372
4377
|
metadata.pageCount = sections.length;
|
|
4373
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
4378
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _103 => _103.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
|
|
4374
4379
|
const totalTarget = pageFilter ? pageFilter.size : sections.length;
|
|
4375
4380
|
const bodyBlocks = [];
|
|
4376
4381
|
const doc = createHwp5DocState();
|
|
4377
|
-
doc.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess',
|
|
4382
|
+
doc.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _104 => _104.keepTrailingEmptyCols]);
|
|
4378
4383
|
let totalDecompressed = 0;
|
|
4379
4384
|
let parsedSections = 0;
|
|
4380
4385
|
for (let si = 0; si < sections.length; si++) {
|
|
@@ -4383,22 +4388,22 @@ function parseHwp5Document(buffer, options) {
|
|
|
4383
4388
|
const sectionData = sections[si];
|
|
4384
4389
|
const data = !distribution && compressed ? decompressStream(Buffer.from(sectionData)) : Buffer.from(sectionData);
|
|
4385
4390
|
totalDecompressed += data.length;
|
|
4386
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4391
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4387
4392
|
const records = readRecords(data);
|
|
4388
4393
|
const sectionBlocks = parseSection(records, docInfo, warnings, si + 1, doc);
|
|
4389
4394
|
bodyBlocks.push(...sectionBlocks);
|
|
4390
4395
|
parsedSections++;
|
|
4391
|
-
_optionalChain([options, 'optionalAccess',
|
|
4396
|
+
_optionalChain([options, 'optionalAccess', _105 => _105.onProgress, 'optionalCall', _106 => _106(parsedSections, totalTarget)]);
|
|
4392
4397
|
} catch (secErr) {
|
|
4393
|
-
if (secErr instanceof
|
|
4398
|
+
if (secErr instanceof _chunkDZBMQC2Ncjs.KordocError) throw secErr;
|
|
4394
4399
|
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" });
|
|
4395
4400
|
}
|
|
4396
4401
|
}
|
|
4397
4402
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
4398
4403
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter);
|
|
4399
|
-
let flatBlocks =
|
|
4400
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4401
|
-
const deduped =
|
|
4404
|
+
let flatBlocks = _chunk46VU6YXFcjs.flattenLayoutTables.call(void 0, blocks);
|
|
4405
|
+
if (_optionalChain([options, 'optionalAccess', _107 => _107.dedupeRunningHeaders])) {
|
|
4406
|
+
const deduped = _chunk46VU6YXFcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
4402
4407
|
const removed = flatBlocks.length - deduped.length;
|
|
4403
4408
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
4404
4409
|
flatBlocks = deduped;
|
|
@@ -4407,10 +4412,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
4407
4412
|
detectHwp5Headings(flatBlocks, docInfo);
|
|
4408
4413
|
}
|
|
4409
4414
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4410
|
-
let markdown =
|
|
4411
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4415
|
+
let markdown = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, flatBlocks);
|
|
4416
|
+
if (_optionalChain([options, 'optionalAccess', _108 => _108.inlineImages]) && images.length > 0) {
|
|
4412
4417
|
try {
|
|
4413
|
-
markdown =
|
|
4418
|
+
markdown = _chunk46VU6YXFcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
4414
4419
|
} catch (inlineErr) {
|
|
4415
4420
|
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" });
|
|
4416
4421
|
}
|
|
@@ -4420,7 +4425,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
4420
4425
|
function parseDocInfoStream(cfb, compressed) {
|
|
4421
4426
|
try {
|
|
4422
4427
|
const entry = CFB.find(cfb, "/DocInfo");
|
|
4423
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
4428
|
+
if (!_optionalChain([entry, 'optionalAccess', _109 => _109.content])) return null;
|
|
4424
4429
|
const data = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
4425
4430
|
const records = readRecords(data);
|
|
4426
4431
|
return parseDocInfo(records);
|
|
@@ -4441,7 +4446,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4441
4446
|
let baseFontSize = 0;
|
|
4442
4447
|
const sizeFreq = /* @__PURE__ */ new Map();
|
|
4443
4448
|
for (const b of blocks) {
|
|
4444
|
-
if (_optionalChain([b, 'access',
|
|
4449
|
+
if (_optionalChain([b, 'access', _110 => _110.style, 'optionalAccess', _111 => _111.fontSize]) && b.text) {
|
|
4445
4450
|
sizeFreq.set(b.style.fontSize, (sizeFreq.get(b.style.fontSize) || 0) + b.text.length);
|
|
4446
4451
|
}
|
|
4447
4452
|
}
|
|
@@ -4457,7 +4462,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4457
4462
|
const name = (style.nameKo || style.name).toLowerCase();
|
|
4458
4463
|
if (name.includes("\uBC14\uD0D5") || name.includes("\uBCF8\uBB38") || name === "normal" || name === "body") {
|
|
4459
4464
|
const cs = docInfo.charShapes[style.charShapeId];
|
|
4460
|
-
if (_optionalChain([cs, 'optionalAccess',
|
|
4465
|
+
if (_optionalChain([cs, 'optionalAccess', _112 => _112.fontSize]) > 0) {
|
|
4461
4466
|
baseFontSize = cs.fontSize / 10;
|
|
4462
4467
|
break;
|
|
4463
4468
|
}
|
|
@@ -4472,11 +4477,11 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4472
4477
|
if (text.length === 0 || text.length > 200) continue;
|
|
4473
4478
|
if (/^\d+$/.test(text)) continue;
|
|
4474
4479
|
let level = 0;
|
|
4475
|
-
if (_optionalChain([block, 'access',
|
|
4480
|
+
if (_optionalChain([block, 'access', _113 => _113.style, 'optionalAccess', _114 => _114.fontSize]) && baseFontSize > 0) {
|
|
4476
4481
|
const ratio = block.style.fontSize / baseFontSize;
|
|
4477
|
-
if (ratio >=
|
|
4478
|
-
else if (ratio >=
|
|
4479
|
-
else if (ratio >=
|
|
4482
|
+
if (ratio >= _chunkURTDBXV6cjs.HEADING_RATIO_H1) level = 1;
|
|
4483
|
+
else if (ratio >= _chunkURTDBXV6cjs.HEADING_RATIO_H2) level = 2;
|
|
4484
|
+
else if (ratio >= _chunkURTDBXV6cjs.HEADING_RATIO_H3) level = 3;
|
|
4480
4485
|
}
|
|
4481
4486
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
4482
4487
|
if (level === 0) level = 2;
|
|
@@ -4492,7 +4497,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4492
4497
|
function extractHwp5Metadata(cfb, metadata) {
|
|
4493
4498
|
try {
|
|
4494
4499
|
const summaryEntry = CFB.find(cfb, "/HwpSummaryInformation") || CFB.find(cfb, "/SummaryInformation");
|
|
4495
|
-
if (!_optionalChain([summaryEntry, 'optionalAccess',
|
|
4500
|
+
if (!_optionalChain([summaryEntry, 'optionalAccess', _115 => _115.content])) return;
|
|
4496
4501
|
const data = Buffer.from(summaryEntry.content);
|
|
4497
4502
|
if (data.length < 48) return;
|
|
4498
4503
|
const numSets = data.readUInt32LE(24);
|
|
@@ -4525,7 +4530,7 @@ function findViewTextSections(cfb, compressed) {
|
|
|
4525
4530
|
const sections = [];
|
|
4526
4531
|
for (let i = 0; i < MAX_SECTIONS; i++) {
|
|
4527
4532
|
const entry = CFB.find(cfb, `/ViewText/Section${i}`);
|
|
4528
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
4533
|
+
if (!_optionalChain([entry, 'optionalAccess', _116 => _116.content])) break;
|
|
4529
4534
|
try {
|
|
4530
4535
|
const decrypted = decryptViewText(Buffer.from(entry.content), compressed);
|
|
4531
4536
|
sections.push({ idx: i, content: decrypted });
|
|
@@ -4548,13 +4553,13 @@ function findSections(cfb) {
|
|
|
4548
4553
|
const sections = [];
|
|
4549
4554
|
for (let i = 0; i < MAX_SECTIONS; i++) {
|
|
4550
4555
|
const entry = CFB.find(cfb, `/BodyText/Section${i}`);
|
|
4551
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
4556
|
+
if (!_optionalChain([entry, 'optionalAccess', _117 => _117.content])) break;
|
|
4552
4557
|
sections.push({ idx: i, content: Buffer.from(entry.content) });
|
|
4553
4558
|
}
|
|
4554
4559
|
if (sections.length === 0 && cfb.FileIndex) {
|
|
4555
4560
|
for (const entry of cfb.FileIndex) {
|
|
4556
4561
|
if (sections.length >= MAX_SECTIONS) break;
|
|
4557
|
-
if (_optionalChain([entry, 'access',
|
|
4562
|
+
if (_optionalChain([entry, 'access', _118 => _118.name, 'optionalAccess', _119 => _119.startsWith, 'call', _120 => _120("Section")]) && entry.content) {
|
|
4558
4563
|
const idx = parseInt(entry.name.replace("Section", ""), 10) || 0;
|
|
4559
4564
|
sections.push({ idx, content: Buffer.from(entry.content) });
|
|
4560
4565
|
}
|
|
@@ -4570,7 +4575,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
4570
4575
|
if (!raw) break;
|
|
4571
4576
|
const content = compressed ? decompressStream(raw) : raw;
|
|
4572
4577
|
totalDecompressed += content.length;
|
|
4573
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4578
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4574
4579
|
sections.push({ idx: i, content });
|
|
4575
4580
|
}
|
|
4576
4581
|
if (sections.length === 0) {
|
|
@@ -4582,7 +4587,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
4582
4587
|
if (raw) {
|
|
4583
4588
|
const content = compressed ? decompressStream(raw) : raw;
|
|
4584
4589
|
totalDecompressed += content.length;
|
|
4585
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4590
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4586
4591
|
sections.push({ idx, content });
|
|
4587
4592
|
}
|
|
4588
4593
|
}
|
|
@@ -4599,7 +4604,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
4599
4604
|
try {
|
|
4600
4605
|
const content = decryptViewText(raw, compressed);
|
|
4601
4606
|
totalDecompressed += content.length;
|
|
4602
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4607
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4603
4608
|
sections.push({ idx: i, content });
|
|
4604
4609
|
} catch (e30) {
|
|
4605
4610
|
break;
|
|
@@ -4700,9 +4705,9 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
4700
4705
|
const applied = [];
|
|
4701
4706
|
for (const r of ranges) {
|
|
4702
4707
|
const ctrl = ctrls[r.ctrlIdx];
|
|
4703
|
-
if (!_optionalChain([ctrl, 'optionalAccess',
|
|
4708
|
+
if (!_optionalChain([ctrl, 'optionalAccess', _121 => _121.href]) || r.end <= r.start) continue;
|
|
4704
4709
|
if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
|
|
4705
|
-
const href =
|
|
4710
|
+
const href = _chunkDZBMQC2Ncjs.sanitizeHref.call(void 0, ctrl.href);
|
|
4706
4711
|
if (!href) continue;
|
|
4707
4712
|
const anchor = text.slice(r.start, r.end);
|
|
4708
4713
|
if (!anchor.trim()) continue;
|
|
@@ -4720,7 +4725,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
4720
4725
|
}
|
|
4721
4726
|
if (ps.headType === 1 || ps.headType === 2) {
|
|
4722
4727
|
const nid = ps.numberingId || (ps.headType === 1 ? ctx.doc.outlineNumberingId : 0);
|
|
4723
|
-
const numbering = nid >= 1 ? _optionalChain([ctx, 'access',
|
|
4728
|
+
const numbering = nid >= 1 ? _optionalChain([ctx, 'access', _122 => _122.docInfo, 'optionalAccess', _123 => _123.numberings, 'access', _124 => _124[nid - 1]]) : void 0;
|
|
4724
4729
|
if (numbering) {
|
|
4725
4730
|
const counters = ctx.doc.numbering.advance(nid, ps.paraLevel);
|
|
4726
4731
|
const fmt = numbering.levelFormats[Math.min(ps.paraLevel, 6)];
|
|
@@ -4730,7 +4735,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
4730
4735
|
}
|
|
4731
4736
|
}
|
|
4732
4737
|
} else if (ps.headType === 3) {
|
|
4733
|
-
const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access',
|
|
4738
|
+
const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access', _125 => _125.docInfo, 'optionalAccess', _126 => _126.bullets, 'access', _127 => _127[ps.numberingId - 1]]) : void 0;
|
|
4734
4739
|
if (bullet && bullet.char !== "\uFFFF") headMarker = bullet.char;
|
|
4735
4740
|
}
|
|
4736
4741
|
}
|
|
@@ -4747,7 +4752,11 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
4747
4752
|
const style = resolveCharStyle(charShapeIds, ctx.docInfo);
|
|
4748
4753
|
if (style) {
|
|
4749
4754
|
block.style = style;
|
|
4750
|
-
if (style.strike
|
|
4755
|
+
if (style.strike || style.underline) {
|
|
4756
|
+
let deco = style.strike ? `~~${trimmed}~~` : trimmed;
|
|
4757
|
+
if (style.underline) deco = `<u>${deco}</u>`;
|
|
4758
|
+
block.text = headMarker ? `${headMarker} ${deco}` : deco;
|
|
4759
|
+
}
|
|
4751
4760
|
}
|
|
4752
4761
|
}
|
|
4753
4762
|
if (footnotes.length > 0) block.footnoteText = footnotes.join("; ");
|
|
@@ -4938,8 +4947,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
4938
4947
|
let tableIdx = -1;
|
|
4939
4948
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
4940
4949
|
if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
|
|
4941
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
4942
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
4950
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunk46VU6YXFcjs.MAX_ROWS);
|
|
4951
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunk46VU6YXFcjs.MAX_COLS);
|
|
4943
4952
|
tableIdx = i2;
|
|
4944
4953
|
break;
|
|
4945
4954
|
}
|
|
@@ -4979,7 +4988,7 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
4979
4988
|
const cellRows2 = arrangeCells(rows, cols, cells);
|
|
4980
4989
|
const irCells = cellRows2.map((row) => row.map((c) => {
|
|
4981
4990
|
const ir = { text: c.text.trim(), colSpan: c.colSpan, rowSpan: c.rowSpan };
|
|
4982
|
-
if (_optionalChain([c, 'access',
|
|
4991
|
+
if (_optionalChain([c, 'access', _128 => _128.blocks, 'optionalAccess', _129 => _129.length])) ir.blocks = c.blocks;
|
|
4983
4992
|
if (c.isHeader) ir.isHeader = true;
|
|
4984
4993
|
return ir;
|
|
4985
4994
|
}));
|
|
@@ -4988,7 +4997,7 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
4988
4997
|
return table3;
|
|
4989
4998
|
}
|
|
4990
4999
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
4991
|
-
const table2 =
|
|
5000
|
+
const table2 = _chunk46VU6YXFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
4992
5001
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
4993
5002
|
return table2.rows > 0 ? table2 : null;
|
|
4994
5003
|
}
|
|
@@ -5005,8 +5014,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5005
5014
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5006
5015
|
const cs = rec.data.readUInt16LE(12);
|
|
5007
5016
|
const rs = rec.data.readUInt16LE(14);
|
|
5008
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5009
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5017
|
+
if (cs > 0) colSpan = Math.min(cs, _chunk46VU6YXFcjs.MAX_COLS);
|
|
5018
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunk46VU6YXFcjs.MAX_ROWS);
|
|
5010
5019
|
}
|
|
5011
5020
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5012
5021
|
const parts = [];
|
|
@@ -5016,7 +5025,7 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5016
5025
|
parts.push(``);
|
|
5017
5026
|
hasStructure = true;
|
|
5018
5027
|
} else if (b.type === "table" && b.table) {
|
|
5019
|
-
const flat =
|
|
5028
|
+
const flat = _chunk46VU6YXFcjs.convertTableToText.call(void 0, b.table.cells);
|
|
5020
5029
|
if (flat) parts.push(flat);
|
|
5021
5030
|
hasStructure = true;
|
|
5022
5031
|
} else if (b.text) {
|
|
@@ -5113,8 +5122,8 @@ function pictureToImageBlock(data, ctx) {
|
|
|
5113
5122
|
if (data.length < 73) return null;
|
|
5114
5123
|
const binDataId = data.readUInt16LE(71);
|
|
5115
5124
|
if (binDataId === 0) return null;
|
|
5116
|
-
const item = _optionalChain([ctx, 'access',
|
|
5117
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
5125
|
+
const item = _optionalChain([ctx, 'access', _130 => _130.docInfo, 'optionalAccess', _131 => _131.binData, 'access', _132 => _132[binDataId - 1]]);
|
|
5126
|
+
if (_optionalChain([item, 'optionalAccess', _133 => _133.kind]) === "link") {
|
|
5118
5127
|
ctx.warnings.push({ page: ctx.sectionNum, message: `\uC678\uBD80 \uC5F0\uACB0 \uC774\uBBF8\uC9C0 (binDataId ${binDataId})`, code: "SKIPPED_IMAGE" });
|
|
5119
5128
|
return null;
|
|
5120
5129
|
}
|
|
@@ -5140,13 +5149,17 @@ function resolveCharStyle(charShapeIds, docInfo) {
|
|
|
5140
5149
|
if (cs.attrFlags & 1) style.italic = true;
|
|
5141
5150
|
if (cs.attrFlags & 2) style.bold = true;
|
|
5142
5151
|
if (hasRealStrike(cs.attrFlags)) style.strike = true;
|
|
5143
|
-
|
|
5152
|
+
if (hasRealUnderline(cs.attrFlags)) style.underline = true;
|
|
5153
|
+
return style.fontSize || style.bold || style.italic || style.strike || style.underline ? style : void 0;
|
|
5144
5154
|
}
|
|
5145
5155
|
function hasRealStrike(attrFlags) {
|
|
5146
5156
|
const strikeBits = attrFlags >> 18 & 7;
|
|
5147
5157
|
const shapeId = attrFlags >> 26 & 15;
|
|
5148
5158
|
return strikeBits !== 0 && shapeId <= 12;
|
|
5149
5159
|
}
|
|
5160
|
+
function hasRealUnderline(attrFlags) {
|
|
5161
|
+
return (attrFlags >> 2 & 3) === 1;
|
|
5162
|
+
}
|
|
5150
5163
|
|
|
5151
5164
|
// src/hwp3/parser.ts
|
|
5152
5165
|
|
|
@@ -17287,40 +17300,40 @@ function desEcbDecrypt(data, key) {
|
|
|
17287
17300
|
}
|
|
17288
17301
|
function readLayout(data) {
|
|
17289
17302
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
17290
|
-
throw new (0,
|
|
17303
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
17291
17304
|
}
|
|
17292
17305
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
17293
17306
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
17294
17307
|
if (payloadOffset >= data.length) {
|
|
17295
|
-
throw new (0,
|
|
17308
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
17296
17309
|
}
|
|
17297
17310
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
17298
17311
|
}
|
|
17299
17312
|
function decryptHwp3Document(input, password) {
|
|
17300
17313
|
const { payloadOffset, compressed } = readLayout(input);
|
|
17301
17314
|
if (!compressed) {
|
|
17302
|
-
throw new (0,
|
|
17315
|
+
throw new (0, _chunkDZBMQC2Ncjs.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)");
|
|
17303
17316
|
}
|
|
17304
17317
|
const source = Buffer.from(input);
|
|
17305
17318
|
const payload = source.subarray(payloadOffset);
|
|
17306
17319
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
17307
17320
|
if (aligned.length === 0) {
|
|
17308
|
-
throw new (0,
|
|
17321
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
17309
17322
|
}
|
|
17310
17323
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
17311
17324
|
let inflated;
|
|
17312
17325
|
try {
|
|
17313
17326
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
17314
17327
|
} catch (err) {
|
|
17315
|
-
if (_optionalChain([err, 'optionalAccess',
|
|
17316
|
-
throw new (0,
|
|
17328
|
+
if (_optionalChain([err, 'optionalAccess', _134 => _134.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
17329
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
17317
17330
|
`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`
|
|
17318
17331
|
);
|
|
17319
17332
|
}
|
|
17320
|
-
throw new (0,
|
|
17333
|
+
throw new (0, _chunkDZBMQC2Ncjs.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.");
|
|
17321
17334
|
}
|
|
17322
17335
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
17323
|
-
throw new (0,
|
|
17336
|
+
throw new (0, _chunkDZBMQC2Ncjs.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.");
|
|
17324
17337
|
}
|
|
17325
17338
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
17326
17339
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -17354,8 +17367,8 @@ var SIMPLE_CTRL = /* @__PURE__ */ new Map([
|
|
|
17354
17367
|
function parseHwp3Document(buffer, options) {
|
|
17355
17368
|
let source = Buffer.from(buffer);
|
|
17356
17369
|
if (isEncryptedHwp3(source)) {
|
|
17357
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
17358
|
-
throw new (0,
|
|
17370
|
+
if (!_optionalChain([options, 'optionalAccess', _135 => _135.password])) {
|
|
17371
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
17359
17372
|
"\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."
|
|
17360
17373
|
);
|
|
17361
17374
|
}
|
|
@@ -17371,11 +17384,11 @@ function parseHwp3Document(buffer, options) {
|
|
|
17371
17384
|
try {
|
|
17372
17385
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
17373
17386
|
} catch (err) {
|
|
17374
|
-
if (_optionalChain([err, 'optionalAccess',
|
|
17375
|
-
throw new (0,
|
|
17387
|
+
if (_optionalChain([err, 'optionalAccess', _136 => _136.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
17388
|
+
throw new (0, _chunkDZBMQC2Ncjs.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`);
|
|
17376
17389
|
}
|
|
17377
17390
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
17378
|
-
throw new (0,
|
|
17391
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
17379
17392
|
}
|
|
17380
17393
|
} else {
|
|
17381
17394
|
body = tail;
|
|
@@ -17609,15 +17622,15 @@ function getElements(parent, tagName) {
|
|
|
17609
17622
|
const result = [];
|
|
17610
17623
|
for (let i = 0; i < nodes.length; i++) result.push(nodes[i]);
|
|
17611
17624
|
if (result.length > 0) return result;
|
|
17612
|
-
const nsNodes = _optionalChain([parent, 'access',
|
|
17625
|
+
const nsNodes = _optionalChain([parent, 'access', _137 => _137.getElementsByTagNameNS, 'optionalCall', _138 => _138("*", tagName)]);
|
|
17613
17626
|
if (nsNodes) for (let i = 0; i < nsNodes.length; i++) result.push(nsNodes[i]);
|
|
17614
17627
|
return result;
|
|
17615
17628
|
}
|
|
17616
17629
|
function getTextContent(el) {
|
|
17617
|
-
return _nullishCoalesce(_optionalChain([el, 'access',
|
|
17630
|
+
return _nullishCoalesce(_optionalChain([el, 'access', _139 => _139.textContent, 'optionalAccess', _140 => _140.trim, 'call', _141 => _141()]), () => ( ""));
|
|
17618
17631
|
}
|
|
17619
17632
|
function parseXml(text) {
|
|
17620
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
17633
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkDZBMQC2Ncjs.stripDtd.call(void 0, text), "text/xml");
|
|
17621
17634
|
}
|
|
17622
17635
|
function collectRichText(root) {
|
|
17623
17636
|
let out = "";
|
|
@@ -17626,7 +17639,7 @@ function collectRichText(root) {
|
|
|
17626
17639
|
for (let i = 0; i < children.length; i++) {
|
|
17627
17640
|
if (children[i].nodeType !== 1) continue;
|
|
17628
17641
|
const el = children[i];
|
|
17629
|
-
const local = el.localName || _optionalChain([el, 'access',
|
|
17642
|
+
const local = el.localName || _optionalChain([el, 'access', _142 => _142.tagName, 'optionalAccess', _143 => _143.replace, 'call', _144 => _144(/^[^:]+:/, "")]) || "";
|
|
17630
17643
|
if (local === "rPh") continue;
|
|
17631
17644
|
if (local === "t") out += _nullishCoalesce(el.textContent, () => ( ""));
|
|
17632
17645
|
else walk(el);
|
|
@@ -17845,14 +17858,14 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
|
|
|
17845
17858
|
const merge = mergeMap.get(key);
|
|
17846
17859
|
row.push({
|
|
17847
17860
|
text,
|
|
17848
|
-
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
17849
|
-
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
17861
|
+
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _145 => _145.colSpan]), () => ( 1)),
|
|
17862
|
+
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _146 => _146.rowSpan]), () => ( 1))
|
|
17850
17863
|
});
|
|
17851
17864
|
}
|
|
17852
17865
|
cellRows.push(row);
|
|
17853
17866
|
}
|
|
17854
17867
|
if (cellRows.length > 0) {
|
|
17855
|
-
const table2 =
|
|
17868
|
+
const table2 = _chunk46VU6YXFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
17856
17869
|
if (table2.rows > 0) {
|
|
17857
17870
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
17858
17871
|
}
|
|
@@ -17860,12 +17873,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
|
|
|
17860
17873
|
return blocks;
|
|
17861
17874
|
}
|
|
17862
17875
|
async function parseXlsxDocument(buffer, options) {
|
|
17863
|
-
|
|
17876
|
+
_chunkDZBMQC2Ncjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
17864
17877
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
17865
17878
|
const warnings = [];
|
|
17866
17879
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
17867
17880
|
if (!workbookFile) {
|
|
17868
|
-
throw new (0,
|
|
17881
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
17869
17882
|
}
|
|
17870
17883
|
let sharedStrings = [];
|
|
17871
17884
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -17874,7 +17887,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17874
17887
|
}
|
|
17875
17888
|
const { sheets, date1904 } = parseWorkbook(await workbookFile.async("text"));
|
|
17876
17889
|
if (sheets.length === 0) {
|
|
17877
|
-
throw new (0,
|
|
17890
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
17878
17891
|
}
|
|
17879
17892
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
17880
17893
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -17894,7 +17907,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17894
17907
|
relsMap = parseRels(await relsFile.async("text"));
|
|
17895
17908
|
}
|
|
17896
17909
|
let pageFilter = null;
|
|
17897
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
17910
|
+
if (_optionalChain([options, 'optionalAccess', _147 => _147.pages])) {
|
|
17898
17911
|
const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
|
|
17899
17912
|
pageFilter = parsePageRange2(options.pages, sheets.length);
|
|
17900
17913
|
}
|
|
@@ -17903,7 +17916,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17903
17916
|
for (let i = 0; i < processedSheets; i++) {
|
|
17904
17917
|
if (pageFilter && !pageFilter.has(i + 1)) continue;
|
|
17905
17918
|
const sheet = sheets[i];
|
|
17906
|
-
_optionalChain([options, 'optionalAccess',
|
|
17919
|
+
_optionalChain([options, 'optionalAccess', _148 => _148.onProgress, 'optionalCall', _149 => _149(i + 1, processedSheets)]);
|
|
17907
17920
|
let sheetPath = relsMap.get(sheet.rId);
|
|
17908
17921
|
if (sheetPath) {
|
|
17909
17922
|
if (!sheetPath.startsWith("xl/") && !sheetPath.startsWith("/")) {
|
|
@@ -17926,7 +17939,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17926
17939
|
try {
|
|
17927
17940
|
const sheetXml = await sheetFile.async("text");
|
|
17928
17941
|
const { grid, merges, maxRow, maxCol } = parseWorksheet(sheetXml, sharedStrings, dateXfs, date1904);
|
|
17929
|
-
const sheetBlocks = sheetToBlocks(sheet.name, grid, merges, maxRow, maxCol, i, _optionalChain([options, 'optionalAccess',
|
|
17942
|
+
const sheetBlocks = sheetToBlocks(sheet.name, grid, merges, maxRow, maxCol, i, _optionalChain([options, 'optionalAccess', _150 => _150.keepTrailingEmptyCols]));
|
|
17930
17943
|
blocks.push(...sheetBlocks);
|
|
17931
17944
|
} catch (err) {
|
|
17932
17945
|
warnings.push({
|
|
@@ -17958,7 +17971,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17958
17971
|
} catch (e32) {
|
|
17959
17972
|
}
|
|
17960
17973
|
}
|
|
17961
|
-
const markdown =
|
|
17974
|
+
const markdown = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
17962
17975
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
17963
17976
|
}
|
|
17964
17977
|
|
|
@@ -18409,11 +18422,11 @@ function processGlobals(records) {
|
|
|
18409
18422
|
const xfFmtIds = [];
|
|
18410
18423
|
const firstBof = records[0];
|
|
18411
18424
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
18412
|
-
throw new (0,
|
|
18425
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
18413
18426
|
}
|
|
18414
18427
|
const bof = decodeBof(firstBof.data);
|
|
18415
18428
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
18416
|
-
throw new (0,
|
|
18429
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
18417
18430
|
}
|
|
18418
18431
|
let i = 1;
|
|
18419
18432
|
while (i < records.length) {
|
|
@@ -18541,14 +18554,14 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex, keepAnchoredEmptyCols) {
|
|
|
18541
18554
|
const merge = mergeMap.get(key);
|
|
18542
18555
|
row.push({
|
|
18543
18556
|
text: grid[r][c],
|
|
18544
|
-
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
18545
|
-
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
18557
|
+
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _151 => _151.colSpan]), () => ( 1)),
|
|
18558
|
+
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _152 => _152.rowSpan]), () => ( 1))
|
|
18546
18559
|
});
|
|
18547
18560
|
}
|
|
18548
18561
|
cellRows.push(row);
|
|
18549
18562
|
}
|
|
18550
18563
|
if (cellRows.length > 0) {
|
|
18551
|
-
const table2 =
|
|
18564
|
+
const table2 = _chunk46VU6YXFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
18552
18565
|
if (table2.rows > 0) {
|
|
18553
18566
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
18554
18567
|
}
|
|
@@ -18561,28 +18574,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18561
18574
|
try {
|
|
18562
18575
|
cfb = parseLenientCfb(buf);
|
|
18563
18576
|
} catch (e) {
|
|
18564
|
-
throw new (0,
|
|
18577
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
18565
18578
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
18566
18579
|
);
|
|
18567
18580
|
}
|
|
18568
18581
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
18569
18582
|
if (!wb) {
|
|
18570
|
-
throw new (0,
|
|
18583
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
18571
18584
|
}
|
|
18572
18585
|
const records = readRecords2(wb);
|
|
18573
18586
|
if (records.length === 0) {
|
|
18574
|
-
throw new (0,
|
|
18587
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
18575
18588
|
}
|
|
18576
18589
|
const firstBof = decodeBof(records[0].data);
|
|
18577
18590
|
if (firstBof && firstBof.vers !== 1536) {
|
|
18578
|
-
throw new (0,
|
|
18591
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
18579
18592
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
18580
18593
|
);
|
|
18581
18594
|
}
|
|
18582
18595
|
const globals = processGlobals(records);
|
|
18583
18596
|
const warnings = [];
|
|
18584
18597
|
if (globals.encrypted) {
|
|
18585
|
-
throw new (0,
|
|
18598
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18586
18599
|
}
|
|
18587
18600
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
18588
18601
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -18594,7 +18607,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18594
18607
|
} : void 0;
|
|
18595
18608
|
const totalSheets = Math.min(globals.sheets.length, MAX_SHEETS2);
|
|
18596
18609
|
let pageFilter = null;
|
|
18597
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
18610
|
+
if (_optionalChain([options, 'optionalAccess', _153 => _153.pages])) {
|
|
18598
18611
|
const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
|
|
18599
18612
|
pageFilter = parsePageRange2(options.pages, totalSheets);
|
|
18600
18613
|
}
|
|
@@ -18603,7 +18616,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18603
18616
|
if (pageFilter && !pageFilter.has(i + 1)) continue;
|
|
18604
18617
|
const meta = globals.sheets[i];
|
|
18605
18618
|
if (meta.dt !== 0) continue;
|
|
18606
|
-
_optionalChain([options, 'optionalAccess',
|
|
18619
|
+
_optionalChain([options, 'optionalAccess', _154 => _154.onProgress, 'optionalCall', _155 => _155(i + 1, totalSheets)]);
|
|
18607
18620
|
const bofIdx = findSheetBofIndex(records, meta.lbPlyPos);
|
|
18608
18621
|
if (bofIdx < 0) {
|
|
18609
18622
|
warnings.push({
|
|
@@ -18619,7 +18632,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18619
18632
|
}
|
|
18620
18633
|
try {
|
|
18621
18634
|
const { sheet } = extractSheetCells(records, bofIdx, globals.sst, convertNum);
|
|
18622
|
-
const blocks = sheetToBlocks2(meta.name, sheet, i, _optionalChain([options, 'optionalAccess',
|
|
18635
|
+
const blocks = sheetToBlocks2(meta.name, sheet, i, _optionalChain([options, 'optionalAccess', _156 => _156.keepTrailingEmptyCols]));
|
|
18623
18636
|
allBlocks.push(...blocks);
|
|
18624
18637
|
} catch (e) {
|
|
18625
18638
|
warnings.push({
|
|
@@ -18633,7 +18646,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18633
18646
|
pageCount: totalSheets
|
|
18634
18647
|
};
|
|
18635
18648
|
return {
|
|
18636
|
-
markdown:
|
|
18649
|
+
markdown: _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, allBlocks),
|
|
18637
18650
|
blocks: allBlocks,
|
|
18638
18651
|
metadata,
|
|
18639
18652
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -19007,7 +19020,7 @@ function isDisplayMath(el) {
|
|
|
19007
19020
|
// src/docx/parser.ts
|
|
19008
19021
|
var MAX_DECOMPRESS_SIZE5 = 100 * 1024 * 1024;
|
|
19009
19022
|
function matchesLocal(el, localName2) {
|
|
19010
|
-
return el.localName === localName2 || (_nullishCoalesce(_optionalChain([el, 'access',
|
|
19023
|
+
return el.localName === localName2 || (_nullishCoalesce(_optionalChain([el, 'access', _157 => _157.tagName, 'optionalAccess', _158 => _158.endsWith, 'call', _159 => _159(`:${localName2}`)]), () => ( false)));
|
|
19011
19024
|
}
|
|
19012
19025
|
function effectiveChildElements(parent) {
|
|
19013
19026
|
const result = [];
|
|
@@ -19042,7 +19055,7 @@ function findElements(parent, localName2) {
|
|
|
19042
19055
|
const child = children[i];
|
|
19043
19056
|
if (child.nodeType === 1) {
|
|
19044
19057
|
const el = child;
|
|
19045
|
-
if (el.localName === localName2 || _optionalChain([el, 'access',
|
|
19058
|
+
if (el.localName === localName2 || _optionalChain([el, 'access', _160 => _160.tagName, 'optionalAccess', _161 => _161.endsWith, 'call', _162 => _162(`:${localName2}`)])) {
|
|
19046
19059
|
result.push(el);
|
|
19047
19060
|
}
|
|
19048
19061
|
walk(el);
|
|
@@ -19061,7 +19074,7 @@ function getAttr(el, localName2) {
|
|
|
19061
19074
|
return null;
|
|
19062
19075
|
}
|
|
19063
19076
|
function parseXml2(text) {
|
|
19064
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19077
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkDZBMQC2Ncjs.stripDtd.call(void 0, text), "text/xml");
|
|
19065
19078
|
}
|
|
19066
19079
|
function parseStyles(xml) {
|
|
19067
19080
|
const doc = parseXml2(xml);
|
|
@@ -19178,7 +19191,7 @@ function collectOmmlRoots(p) {
|
|
|
19178
19191
|
const child = children[i];
|
|
19179
19192
|
if (child.nodeType !== 1) continue;
|
|
19180
19193
|
const el = child;
|
|
19181
|
-
const tag = el.localName || _optionalChain([el, 'access',
|
|
19194
|
+
const tag = el.localName || _optionalChain([el, 'access', _163 => _163.tagName, 'optionalAccess', _164 => _164.replace, 'call', _165 => _165(/^[^:]+:/, "")]) || "";
|
|
19182
19195
|
if (tag === "oMath" || tag === "oMathPara") {
|
|
19183
19196
|
out.push(el);
|
|
19184
19197
|
} else if (tag === "txbxContent" || tag === "Fallback") {
|
|
@@ -19219,7 +19232,7 @@ function fieldUrlFromInstr(instr) {
|
|
|
19219
19232
|
function makeLink(text, rawHref) {
|
|
19220
19233
|
if (!text) return "";
|
|
19221
19234
|
if (!rawHref) return text;
|
|
19222
|
-
const href =
|
|
19235
|
+
const href = _chunkDZBMQC2Ncjs.sanitizeHref.call(void 0, rawHref);
|
|
19223
19236
|
return href ? `[${text}](${href})` : text;
|
|
19224
19237
|
}
|
|
19225
19238
|
function collectInline(p, footnotes, rels) {
|
|
@@ -19321,7 +19334,7 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
|
|
|
19321
19334
|
const { text, bold: hasBold, italic: hasItalic, footnoteText } = collectInline(p, footnotes, rels);
|
|
19322
19335
|
if (!text) return null;
|
|
19323
19336
|
const style = styles.get(styleId);
|
|
19324
|
-
if (_optionalChain([style, 'optionalAccess',
|
|
19337
|
+
if (_optionalChain([style, 'optionalAccess', _166 => _166.outlineLevel]) !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
|
|
19325
19338
|
return {
|
|
19326
19339
|
type: "heading",
|
|
19327
19340
|
text,
|
|
@@ -19330,8 +19343,8 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
|
|
|
19330
19343
|
}
|
|
19331
19344
|
if (numId && numId !== "0") {
|
|
19332
19345
|
const numDef = numbering.get(numId);
|
|
19333
|
-
const levelInfo = _optionalChain([numDef, 'optionalAccess',
|
|
19334
|
-
const listType = _optionalChain([levelInfo, 'optionalAccess',
|
|
19346
|
+
const levelInfo = _optionalChain([numDef, 'optionalAccess', _167 => _167.get, 'call', _168 => _168(ilvl)]);
|
|
19347
|
+
const listType = _optionalChain([levelInfo, 'optionalAccess', _169 => _169.numFmt]) === "bullet" ? "unordered" : "ordered";
|
|
19335
19348
|
return { type: "list", text, listType };
|
|
19336
19349
|
}
|
|
19337
19350
|
const block = { type: "paragraph", text };
|
|
@@ -19413,7 +19426,7 @@ ${cell2.text}` : cell2.text;
|
|
|
19413
19426
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
19414
19427
|
})
|
|
19415
19428
|
);
|
|
19416
|
-
const table2 =
|
|
19429
|
+
const table2 = _chunk46VU6YXFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
19417
19430
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
19418
19431
|
return { type: "table", table: table2 };
|
|
19419
19432
|
}
|
|
@@ -19423,10 +19436,10 @@ function collectCellText(tc2, styles, numbering, footnotes, rels, depth) {
|
|
|
19423
19436
|
for (const el of effectiveChildElements(tc2)) {
|
|
19424
19437
|
if (matchesLocal(el, "p")) {
|
|
19425
19438
|
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
19426
|
-
if (_optionalChain([block, 'optionalAccess',
|
|
19439
|
+
if (_optionalChain([block, 'optionalAccess', _170 => _170.text])) parts.push(block.text);
|
|
19427
19440
|
for (const tp of collectTextboxParagraphs(el)) {
|
|
19428
19441
|
const tb = parseParagraph2(tp, styles, numbering, footnotes, rels);
|
|
19429
|
-
if (_optionalChain([tb, 'optionalAccess',
|
|
19442
|
+
if (_optionalChain([tb, 'optionalAccess', _171 => _171.text])) parts.push(tb.text);
|
|
19430
19443
|
}
|
|
19431
19444
|
} else if (matchesLocal(el, "tbl")) {
|
|
19432
19445
|
for (const tr of getChildElements(el, "tr")) {
|
|
@@ -19461,7 +19474,7 @@ async function buildImageMap(zip, rels, doc, warnings) {
|
|
|
19461
19474
|
try {
|
|
19462
19475
|
const data = await imgFile.async("uint8array");
|
|
19463
19476
|
imgIdx++;
|
|
19464
|
-
const ext = _nullishCoalesce(_optionalChain([imgPath, 'access',
|
|
19477
|
+
const ext = _nullishCoalesce(_optionalChain([imgPath, 'access', _172 => _172.split, 'call', _173 => _173("."), 'access', _174 => _174.pop, 'call', _175 => _175(), 'optionalAccess', _176 => _176.toLowerCase, 'call', _177 => _177()]), () => ( "png"));
|
|
19465
19478
|
const mimeMap = {
|
|
19466
19479
|
png: "image/png",
|
|
19467
19480
|
jpg: "image/jpeg",
|
|
@@ -19515,12 +19528,12 @@ function emitParagraphImages(p, imageMap, linked, out) {
|
|
|
19515
19528
|
}
|
|
19516
19529
|
}
|
|
19517
19530
|
async function parseDocxDocument(buffer, options) {
|
|
19518
|
-
|
|
19531
|
+
_chunkDZBMQC2Ncjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5);
|
|
19519
19532
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19520
19533
|
const warnings = [];
|
|
19521
19534
|
const docFile = zip.file("word/document.xml");
|
|
19522
19535
|
if (!docFile) {
|
|
19523
|
-
throw new (0,
|
|
19536
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19524
19537
|
}
|
|
19525
19538
|
let rels = /* @__PURE__ */ new Map();
|
|
19526
19539
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -19567,7 +19580,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19567
19580
|
const doc = parseXml2(docXml);
|
|
19568
19581
|
const body = findElements(doc, "body");
|
|
19569
19582
|
if (body.length === 0) {
|
|
19570
|
-
throw new (0,
|
|
19583
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19571
19584
|
}
|
|
19572
19585
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings);
|
|
19573
19586
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -19575,7 +19588,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19575
19588
|
const bodyEl = body[0];
|
|
19576
19589
|
const topLevel = effectiveChildElements(bodyEl);
|
|
19577
19590
|
for (const el of topLevel) {
|
|
19578
|
-
const localName2 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access',
|
|
19591
|
+
const localName2 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access', _178 => _178.tagName, 'optionalAccess', _179 => _179.split, 'call', _180 => _180(":"), 'access', _181 => _181.pop, 'call', _182 => _182()])));
|
|
19579
19592
|
if (localName2 === "p") {
|
|
19580
19593
|
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
19581
19594
|
if (block) blocks.push(block);
|
|
@@ -19586,7 +19599,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19586
19599
|
if (imageMap.size > 0) emitParagraphImages(tp, imageMap, linkedImages, blocks);
|
|
19587
19600
|
}
|
|
19588
19601
|
} else if (localName2 === "tbl") {
|
|
19589
|
-
const block = parseTable(el, styles, numbering, footnotes, rels, _optionalChain([options, 'optionalAccess',
|
|
19602
|
+
const block = parseTable(el, styles, numbering, footnotes, rels, _optionalChain([options, 'optionalAccess', _183 => _183.keepTrailingEmptyCols]));
|
|
19590
19603
|
if (block) blocks.push(block);
|
|
19591
19604
|
}
|
|
19592
19605
|
}
|
|
@@ -19618,7 +19631,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19618
19631
|
}
|
|
19619
19632
|
}
|
|
19620
19633
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
19621
|
-
const markdown =
|
|
19634
|
+
const markdown = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
19622
19635
|
return {
|
|
19623
19636
|
markdown,
|
|
19624
19637
|
blocks,
|
|
@@ -19636,11 +19649,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
19636
19649
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
19637
19650
|
function parseHwpmlDocument(buffer, options) {
|
|
19638
19651
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
19639
|
-
throw new (0,
|
|
19652
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
19640
19653
|
}
|
|
19641
19654
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
19642
19655
|
const normalized = text.replace(/ /g, " ");
|
|
19643
|
-
const xml =
|
|
19656
|
+
const xml = _chunkDZBMQC2Ncjs.stripDtd.call(void 0, normalized);
|
|
19644
19657
|
const warnings = [];
|
|
19645
19658
|
const parser = new (0, _xmldom.DOMParser)({
|
|
19646
19659
|
onError: (_level, msg2) => {
|
|
@@ -19668,7 +19681,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
19668
19681
|
return { markdown: "", blocks: [], metadata, warnings };
|
|
19669
19682
|
}
|
|
19670
19683
|
const blocks = [];
|
|
19671
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
19684
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _184 => _184.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, countSections(body)) : null;
|
|
19672
19685
|
let sectionIdx = 0;
|
|
19673
19686
|
const children = body.childNodes;
|
|
19674
19687
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -19677,10 +19690,10 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
19677
19690
|
if (localName(el) !== "SECTION") continue;
|
|
19678
19691
|
sectionIdx++;
|
|
19679
19692
|
if (pageFilter && !pageFilter.has(sectionIdx)) continue;
|
|
19680
|
-
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
19693
|
+
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _185 => _185.keepTrailingEmptyCols]), () => ( false)));
|
|
19681
19694
|
}
|
|
19682
19695
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
19683
|
-
const markdown =
|
|
19696
|
+
const markdown = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
19684
19697
|
return {
|
|
19685
19698
|
markdown,
|
|
19686
19699
|
blocks,
|
|
@@ -19766,7 +19779,7 @@ function parseParagraph3(el, blocks, paraShapeMap, sectionNum) {
|
|
|
19766
19779
|
const shapeInfo = paraShapeMap.get(paraShapeId);
|
|
19767
19780
|
const text = extractParagraphText(el);
|
|
19768
19781
|
if (!text) return;
|
|
19769
|
-
if (_optionalChain([shapeInfo, 'optionalAccess',
|
|
19782
|
+
if (_optionalChain([shapeInfo, 'optionalAccess', _186 => _186.headingLevel]) != null) {
|
|
19770
19783
|
blocks.push({ type: "heading", text, level: shapeInfo.headingLevel, pageNumber: sectionNum });
|
|
19771
19784
|
} else {
|
|
19772
19785
|
blocks.push({ type: "paragraph", text, pageNumber: sectionNum });
|
|
@@ -19845,11 +19858,11 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
19845
19858
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
19846
19859
|
cellRows[r].push(cell2);
|
|
19847
19860
|
}
|
|
19848
|
-
const table2 =
|
|
19861
|
+
const table2 = _chunk46VU6YXFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
19849
19862
|
if (structured.length > 0) {
|
|
19850
19863
|
const claimed = /* @__PURE__ */ new Set();
|
|
19851
19864
|
for (const { ctx, cellBlocks } of structured) {
|
|
19852
|
-
let target = _optionalChain([table2, 'access',
|
|
19865
|
+
let target = _optionalChain([table2, 'access', _187 => _187.cells, 'access', _188 => _188[_nullishCoalesce(ctx.rowAddr, () => ( -1))], 'optionalAccess', _189 => _189[_nullishCoalesce(ctx.colAddr, () => ( -1))]]);
|
|
19853
19866
|
if (!target || claimed.has(target) || target.text !== ctx.text) {
|
|
19854
19867
|
target = void 0;
|
|
19855
19868
|
outer: for (const irRow of table2.cells) {
|
|
@@ -20153,7 +20166,7 @@ function fillInCellPatterns(cellText, values, matchedLabels, blockedLabels) {
|
|
|
20153
20166
|
(match, prefix, suffix) => {
|
|
20154
20167
|
const label = prefix + suffix;
|
|
20155
20168
|
const normalizedLabel = normalizeLabel(label);
|
|
20156
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20169
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _190 => _190.has, 'call', _191 => _191(normalizedLabel)])) return match;
|
|
20157
20170
|
const matchKey = values.available(normalizedLabel) ? normalizedLabel : values.available(normalizeLabel(prefix)) ? normalizeLabel(prefix) : void 0;
|
|
20158
20171
|
if (matchKey === void 0) return match;
|
|
20159
20172
|
const newValue = values.consume(matchKey);
|
|
@@ -20232,17 +20245,17 @@ function matchInlineSegment(seg, values, blockedLabels) {
|
|
|
20232
20245
|
const nlabel = normalizeLabel(seg.label);
|
|
20233
20246
|
if (seg.extLabel !== void 0) {
|
|
20234
20247
|
const nExt = normalizeLabel(seg.extLabel);
|
|
20235
|
-
if (nExt !== nlabel && !_optionalChain([blockedLabels, 'optionalAccess',
|
|
20248
|
+
if (nExt !== nlabel && !_optionalChain([blockedLabels, 'optionalAccess', _192 => _192.has, 'call', _193 => _193(nExt)]) && values.has(nExt)) {
|
|
20236
20249
|
return { key: nExt, label: seg.extLabel, viaExt: true };
|
|
20237
20250
|
}
|
|
20238
20251
|
}
|
|
20239
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20252
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _194 => _194.has, 'call', _195 => _195(nlabel)])) return void 0;
|
|
20240
20253
|
const key = findMatchingKey(nlabel, values);
|
|
20241
20254
|
return key !== void 0 ? { key, label: seg.label, viaExt: false } : void 0;
|
|
20242
20255
|
}
|
|
20243
20256
|
function clampSegmentEnd(text, seg, next, nextViaExt) {
|
|
20244
20257
|
let ve = seg.valueEnd;
|
|
20245
|
-
if (nextViaExt && _optionalChain([next, 'optionalAccess',
|
|
20258
|
+
if (nextViaExt && _optionalChain([next, 'optionalAccess', _196 => _196.extStart]) !== void 0 && next.extStart < ve) ve = next.extStart;
|
|
20246
20259
|
while (ve > seg.valueStart && /\s/.test(text[ve - 1])) ve--;
|
|
20247
20260
|
return ve;
|
|
20248
20261
|
}
|
|
@@ -20257,7 +20270,7 @@ function normalizeValues(values, warnings) {
|
|
|
20257
20270
|
const { value, format } = typeof raw === "object" && !Array.isArray(raw) ? raw : { value: raw, format: void 0 };
|
|
20258
20271
|
const key = normalizeLabel(label);
|
|
20259
20272
|
if (map.has(key)) {
|
|
20260
|
-
_optionalChain([warnings, 'optionalAccess',
|
|
20273
|
+
_optionalChain([warnings, 'optionalAccess', _197 => _197.push, 'call', _198 => _198(`\uC785\uB825 \uB77C\uBCA8 "${label}"\uC774 \uC815\uADDC\uD654 \uD0A4 "${key}"\uC5D0\uC11C \uB2E4\uB978 \uB77C\uBCA8\uACFC \uCDA9\uB3CC \u2014 \uB4A4 \uAC12\uC73C\uB85C \uB36E\uC5B4\uC500`)]);
|
|
20261
20274
|
}
|
|
20262
20275
|
map.set(key, Array.isArray(value) ? value.map((v) => formatFillValue(v, format)) : formatFillValue(value, format));
|
|
20263
20276
|
}
|
|
@@ -20434,8 +20447,8 @@ function extractFromTable(table2) {
|
|
|
20434
20447
|
if (table2.cols >= 2) {
|
|
20435
20448
|
for (let r = 0; r < table2.rows; r++) {
|
|
20436
20449
|
for (let c = 0; c < table2.cols - 1; c++) {
|
|
20437
|
-
const labelCell = _optionalChain([table2, 'access',
|
|
20438
|
-
const valueCell = _optionalChain([table2, 'access',
|
|
20450
|
+
const labelCell = _optionalChain([table2, 'access', _199 => _199.cells, 'access', _200 => _200[r], 'optionalAccess', _201 => _201[c]]);
|
|
20451
|
+
const valueCell = _optionalChain([table2, 'access', _202 => _202.cells, 'access', _203 => _203[r], 'optionalAccess', _204 => _204[c + 1]]);
|
|
20439
20452
|
if (!labelCell || !valueCell) continue;
|
|
20440
20453
|
if (isLabelCell(labelCell.text)) {
|
|
20441
20454
|
fields.push({
|
|
@@ -20450,15 +20463,15 @@ function extractFromTable(table2) {
|
|
|
20450
20463
|
}
|
|
20451
20464
|
if (fields.length === 0 && table2.rows >= 2 && table2.cols >= 2) {
|
|
20452
20465
|
const headerRow = table2.cells[0];
|
|
20453
|
-
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess',
|
|
20454
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
20466
|
+
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _205 => _205.every, 'call', _206 => _206((cell2) => {
|
|
20467
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _207 => _207.text, 'access', _208 => _208.trim, 'call', _209 => _209()]), () => ( ""));
|
|
20455
20468
|
return t.length > 0 && t.length <= 20;
|
|
20456
20469
|
})]), () => ( false));
|
|
20457
20470
|
if (allLabels) {
|
|
20458
20471
|
for (let r = 1; r < table2.rows; r++) {
|
|
20459
20472
|
for (let c = 0; c < table2.cols; c++) {
|
|
20460
|
-
const label = _nullishCoalesce(_optionalChain([headerRow, 'access',
|
|
20461
|
-
const value = _nullishCoalesce(_optionalChain([table2, 'access',
|
|
20473
|
+
const label = _nullishCoalesce(_optionalChain([headerRow, 'access', _210 => _210[c], 'optionalAccess', _211 => _211.text, 'access', _212 => _212.trim, 'call', _213 => _213()]), () => ( ""));
|
|
20474
|
+
const value = _nullishCoalesce(_optionalChain([table2, 'access', _214 => _214.cells, 'access', _215 => _215[r], 'optionalAccess', _216 => _216[c], 'optionalAccess', _217 => _217.text, 'access', _218 => _218.trim, 'call', _219 => _219()]), () => ( ""));
|
|
20462
20475
|
if (label && value) {
|
|
20463
20476
|
fields.push({ label, value, row: r, col: c });
|
|
20464
20477
|
}
|
|
@@ -20552,7 +20565,7 @@ function fillFormFields(blocks, values, blockedLabels) {
|
|
|
20552
20565
|
for (const table2 of allTables) {
|
|
20553
20566
|
for (let r = 0; r < table2.rows; r++) {
|
|
20554
20567
|
for (let c = 0; c < table2.cols; c++) {
|
|
20555
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
20568
|
+
const cell2 = _optionalChain([table2, 'access', _220 => _220.cells, 'access', _221 => _221[r], 'optionalAccess', _222 => _222[c]]);
|
|
20556
20569
|
if (!cell2) continue;
|
|
20557
20570
|
const result = fillInCellPatterns(cell2.text, cursor, matchedLabels, blockedLabels);
|
|
20558
20571
|
if (result) {
|
|
@@ -20584,7 +20597,7 @@ function collectIRTables(blocks, depth) {
|
|
|
20584
20597
|
out.push(block.table);
|
|
20585
20598
|
for (const row of block.table.cells) {
|
|
20586
20599
|
for (const cell2 of row) {
|
|
20587
|
-
if (_optionalChain([cell2, 'optionalAccess',
|
|
20600
|
+
if (_optionalChain([cell2, 'optionalAccess', _223 => _223.blocks, 'optionalAccess', _224 => _224.length])) out.push(...collectIRTables(cell2.blocks, depth + 1));
|
|
20588
20601
|
}
|
|
20589
20602
|
}
|
|
20590
20603
|
}
|
|
@@ -20595,7 +20608,7 @@ function coveredPositions(table2) {
|
|
|
20595
20608
|
for (let r = 0; r < table2.rows; r++) {
|
|
20596
20609
|
for (let c = 0; c < table2.cols; c++) {
|
|
20597
20610
|
if (covered.has(`${r},${c}`)) continue;
|
|
20598
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
20611
|
+
const cell2 = _optionalChain([table2, 'access', _225 => _225.cells, 'access', _226 => _226[r], 'optionalAccess', _227 => _227[c]]);
|
|
20599
20612
|
if (!cell2) continue;
|
|
20600
20613
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
20601
20614
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -20611,15 +20624,15 @@ function coveredPositions(table2) {
|
|
|
20611
20624
|
function isHeaderDataTable(table2, covered) {
|
|
20612
20625
|
if (table2.rows < 2) return false;
|
|
20613
20626
|
const headerRow = table2.cells[0];
|
|
20614
|
-
if (!_optionalChain([headerRow, 'optionalAccess',
|
|
20627
|
+
if (!_optionalChain([headerRow, 'optionalAccess', _228 => _228.length])) return false;
|
|
20615
20628
|
const allLabels = headerRow.every((cell2) => {
|
|
20616
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
20629
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _229 => _229.text, 'access', _230 => _230.trim, 'call', _231 => _231()]), () => ( ""));
|
|
20617
20630
|
return t.length > 0 && t.length <= 20 && isLabelCell(t);
|
|
20618
20631
|
});
|
|
20619
20632
|
if (!allLabels) return false;
|
|
20620
20633
|
for (let c = 0; c < table2.cols; c++) {
|
|
20621
20634
|
if (covered.has(`1,${c}`)) continue;
|
|
20622
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
20635
|
+
const cell2 = _optionalChain([table2, 'access', _232 => _232.cells, 'access', _233 => _233[1], 'optionalAccess', _234 => _234[c]]);
|
|
20623
20636
|
if (!cell2) break;
|
|
20624
20637
|
return !isLabelCell(cell2.text);
|
|
20625
20638
|
}
|
|
@@ -20632,7 +20645,7 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
20632
20645
|
for (let r = skipHeaderRow ? 1 : 0; r < table2.rows; r++) {
|
|
20633
20646
|
for (let c = 0; c < table2.cols; c++) {
|
|
20634
20647
|
if (covered.has(`${r},${c}`)) continue;
|
|
20635
|
-
const labelCell = _optionalChain([table2, 'access',
|
|
20648
|
+
const labelCell = _optionalChain([table2, 'access', _235 => _235.cells, 'access', _236 => _236[r], 'optionalAccess', _237 => _237[c]]);
|
|
20636
20649
|
if (!labelCell) continue;
|
|
20637
20650
|
if (!isLabelCell(labelCell.text)) continue;
|
|
20638
20651
|
let vc = c + labelCell.colSpan;
|
|
@@ -20643,12 +20656,12 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
20643
20656
|
if (isKeywordLabel(valueCell.text)) continue;
|
|
20644
20657
|
const normalizedCellLabel = normalizeLabel(labelCell.text);
|
|
20645
20658
|
if (!normalizedCellLabel) continue;
|
|
20646
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20659
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _238 => _238.has, 'call', _239 => _239(normalizedCellLabel)])) continue;
|
|
20647
20660
|
const matchKey = findMatchingKey(normalizedCellLabel, values);
|
|
20648
20661
|
if (matchKey === void 0) continue;
|
|
20649
20662
|
const newValue = values.consume(matchKey);
|
|
20650
20663
|
if (newValue === void 0) continue;
|
|
20651
|
-
if (_optionalChain([patternFilledCells, 'optionalAccess',
|
|
20664
|
+
if (_optionalChain([patternFilledCells, 'optionalAccess', _240 => _240.has, 'call', _241 => _241(valueCell)])) {
|
|
20652
20665
|
valueCell.text = newValue + " " + valueCell.text;
|
|
20653
20666
|
} else {
|
|
20654
20667
|
valueCell.text = newValue;
|
|
@@ -20665,8 +20678,8 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
20665
20678
|
}
|
|
20666
20679
|
if (table2.rows >= 2 && table2.cols >= 2) {
|
|
20667
20680
|
const headerRow = table2.cells[0];
|
|
20668
|
-
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess',
|
|
20669
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
20681
|
+
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _242 => _242.every, 'call', _243 => _243((cell2) => {
|
|
20682
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _244 => _244.text, 'access', _245 => _245.trim, 'call', _246 => _246()]), () => ( ""));
|
|
20670
20683
|
return t.length > 0 && t.length <= 20 && isLabelCell(t);
|
|
20671
20684
|
})]), () => ( false));
|
|
20672
20685
|
if (!allLabels) return;
|
|
@@ -20674,16 +20687,16 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
20674
20687
|
for (let c = 0; c < table2.cols; c++) {
|
|
20675
20688
|
if (covered.has(`${r},${c}`)) continue;
|
|
20676
20689
|
const headerCell = headerRow[c];
|
|
20677
|
-
const valueCell = _optionalChain([table2, 'access',
|
|
20690
|
+
const valueCell = _optionalChain([table2, 'access', _247 => _247.cells, 'access', _248 => _248[r], 'optionalAccess', _249 => _249[c]]);
|
|
20678
20691
|
if (!headerCell || !valueCell) continue;
|
|
20679
20692
|
const headerLabel = normalizeLabel(headerCell.text);
|
|
20680
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20693
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _250 => _250.has, 'call', _251 => _251(headerLabel)])) continue;
|
|
20681
20694
|
const matchKey = findMatchingKey(headerLabel, values);
|
|
20682
20695
|
if (matchKey === void 0) continue;
|
|
20683
20696
|
if (!values.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
|
|
20684
20697
|
const newValue = values.consume(matchKey);
|
|
20685
20698
|
if (newValue === void 0) continue;
|
|
20686
|
-
if (_optionalChain([patternFilledCells, 'optionalAccess',
|
|
20699
|
+
if (_optionalChain([patternFilledCells, 'optionalAccess', _252 => _252.has, 'call', _253 => _253(valueCell)])) {
|
|
20687
20700
|
valueCell.text = newValue + " " + valueCell.text;
|
|
20688
20701
|
} else {
|
|
20689
20702
|
valueCell.text = newValue;
|
|
@@ -20715,7 +20728,7 @@ function fillInlineFields(text, values, filled, matchedLabels, blockedLabels) {
|
|
|
20715
20728
|
if (newValue === void 0) continue;
|
|
20716
20729
|
matchedLabels.add(matchKey);
|
|
20717
20730
|
filled.push({ label: matched.label.trim(), value: newValue, row: -1, col: -1, key: matchKey });
|
|
20718
|
-
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access',
|
|
20731
|
+
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _254 => _254[i + 1], 'optionalAccess', _255 => _255.viaExt]), () => ( false)));
|
|
20719
20732
|
out += text.slice(pos, seg.valueStart);
|
|
20720
20733
|
out += seg.valueStart === ve ? padInsertion(text, seg.valueStart, newValue) : newValue;
|
|
20721
20734
|
pos = ve;
|
|
@@ -21338,7 +21351,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
21338
21351
|
const splices = [];
|
|
21339
21352
|
for (const region of scanClickHereRegions(xml)) {
|
|
21340
21353
|
const key = normalizeLabel(region.name);
|
|
21341
|
-
if (!key || _optionalChain([blockedLabels, 'optionalAccess',
|
|
21354
|
+
if (!key || _optionalChain([blockedLabels, 'optionalAccess', _256 => _256.has, 'call', _257 => _257(key)])) continue;
|
|
21342
21355
|
if (!cursor.has(key)) continue;
|
|
21343
21356
|
const value = cursor.consume(key);
|
|
21344
21357
|
if (value === void 0) continue;
|
|
@@ -21356,7 +21369,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
21356
21369
|
};
|
|
21357
21370
|
}
|
|
21358
21371
|
async function extractClickHereFields(hwpxBuffer) {
|
|
21359
|
-
|
|
21372
|
+
_chunkDZBMQC2Ncjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
21360
21373
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
21361
21374
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
21362
21375
|
const fields = [];
|
|
@@ -21404,19 +21417,19 @@ function parseCentralDirectory(buf) {
|
|
|
21404
21417
|
}
|
|
21405
21418
|
}
|
|
21406
21419
|
}
|
|
21407
|
-
if (eocdOffset < 0) throw new (0,
|
|
21420
|
+
if (eocdOffset < 0) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21408
21421
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
21409
21422
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
21410
21423
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
21411
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
21424
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21412
21425
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
21413
|
-
throw new (0,
|
|
21426
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21414
21427
|
}
|
|
21415
21428
|
const decoder = new TextDecoder("utf-8");
|
|
21416
21429
|
const entries = [];
|
|
21417
21430
|
let pos = cdOffset;
|
|
21418
21431
|
for (let i = 0; i < totalEntries; i++) {
|
|
21419
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
21432
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
21420
21433
|
const flags = view.getUint16(pos + 8, true);
|
|
21421
21434
|
const method = view.getUint16(pos + 10, true);
|
|
21422
21435
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -21427,7 +21440,7 @@ function parseCentralDirectory(buf) {
|
|
|
21427
21440
|
const commentLen = view.getUint16(pos + 32, true);
|
|
21428
21441
|
const localOffset = view.getUint32(pos + 42, true);
|
|
21429
21442
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
21430
|
-
throw new (0,
|
|
21443
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21431
21444
|
}
|
|
21432
21445
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
21433
21446
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -21456,11 +21469,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21456
21469
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
21457
21470
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
21458
21471
|
for (const name of replacements.keys()) {
|
|
21459
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
21472
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
21460
21473
|
}
|
|
21461
21474
|
if (additions) {
|
|
21462
21475
|
for (const name of additions.keys()) {
|
|
21463
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
21476
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
21464
21477
|
}
|
|
21465
21478
|
}
|
|
21466
21479
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -21479,7 +21492,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21479
21492
|
offset += seg.length;
|
|
21480
21493
|
continue;
|
|
21481
21494
|
}
|
|
21482
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
21495
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
21483
21496
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
21484
21497
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
21485
21498
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -21487,7 +21500,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21487
21500
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
21488
21501
|
const method = e.method;
|
|
21489
21502
|
if (method !== 0 && method !== 8) {
|
|
21490
|
-
throw new (0,
|
|
21503
|
+
throw new (0, _chunkDZBMQC2Ncjs.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`);
|
|
21491
21504
|
}
|
|
21492
21505
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
21493
21506
|
const crc = crc32(newData);
|
|
@@ -21585,11 +21598,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21585
21598
|
// src/form/filler-hwpx.ts
|
|
21586
21599
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
21587
21600
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
21588
|
-
|
|
21601
|
+
_chunkDZBMQC2Ncjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
21589
21602
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
21590
21603
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
21591
21604
|
if (sectionPaths.length === 0) {
|
|
21592
|
-
throw new (0,
|
|
21605
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21593
21606
|
}
|
|
21594
21607
|
const warnings = [];
|
|
21595
21608
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -21688,7 +21701,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21688
21701
|
if (isKeywordLabel(cellLabelText(valueCell))) continue;
|
|
21689
21702
|
const normalizedCellLabel = normalizeLabel(labelText);
|
|
21690
21703
|
if (!normalizedCellLabel) continue;
|
|
21691
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
21704
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _258 => _258.has, 'call', _259 => _259(normalizedCellLabel)])) continue;
|
|
21692
21705
|
const matchKey = findMatchingKey(normalizedCellLabel, cursor);
|
|
21693
21706
|
if (matchKey === void 0) continue;
|
|
21694
21707
|
if (patternApplied.has(valueCell)) {
|
|
@@ -21746,7 +21759,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21746
21759
|
const dataCells = table2.rows[rowIdx];
|
|
21747
21760
|
for (let colIdx = 0; colIdx < Math.min(headerCells.length, dataCells.length); colIdx++) {
|
|
21748
21761
|
const headerLabel = normalizeLabel(cellLabelText(headerCells[colIdx]));
|
|
21749
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
21762
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _260 => _260.has, 'call', _261 => _261(headerLabel)])) continue;
|
|
21750
21763
|
const matchKey = findMatchingKey(headerLabel, cursor);
|
|
21751
21764
|
if (matchKey === void 0) continue;
|
|
21752
21765
|
if (!cursor.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
|
|
@@ -21800,7 +21813,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21800
21813
|
}
|
|
21801
21814
|
for (const para2 of [...scan.bodyParagraphs, ...scan.excludedParagraphs]) {
|
|
21802
21815
|
const existing = ledger.get(para2);
|
|
21803
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
21816
|
+
if (_optionalChain([existing, 'optionalAccess', _262 => _262.fullText]) !== void 0) continue;
|
|
21804
21817
|
const text = matchText(para2);
|
|
21805
21818
|
const segments = scanInlineSegments(text);
|
|
21806
21819
|
const matches = segments.map((seg) => matchInlineSegment(seg, cursor, blockedLabels));
|
|
@@ -21811,7 +21824,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21811
21824
|
const matchKey = matched.key;
|
|
21812
21825
|
const newValue = cursor.consume(matchKey);
|
|
21813
21826
|
if (newValue === void 0) continue;
|
|
21814
|
-
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access',
|
|
21827
|
+
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _263 => _263[i + 1], 'optionalAccess', _264 => _264.viaExt]), () => ( false)));
|
|
21815
21828
|
const replacement = seg.valueStart === ve ? padInsertion(text, seg.valueStart, newValue) : newValue;
|
|
21816
21829
|
const l = led(para2);
|
|
21817
21830
|
l.ranges.push({ start: seg.valueStart, end: ve, replacement });
|
|
@@ -22052,9 +22065,9 @@ function fixedPitchWidthEm1000(cp) {
|
|
|
22052
22065
|
return cp < 128 ? 500 : 1e3;
|
|
22053
22066
|
}
|
|
22054
22067
|
function measureTextWidth(text, height, ratioPct, opts) {
|
|
22055
|
-
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
22056
|
-
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
22057
|
-
const widthEm = _optionalChain([opts, 'optionalAccess',
|
|
22068
|
+
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _265 => _265.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
22069
|
+
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _266 => _266.spacingPct]), () => ( 0));
|
|
22070
|
+
const widthEm = _optionalChain([opts, 'optionalAccess', _267 => _267.faceClass]) === "fixedPitch" ? fixedPitchWidthEm1000 : charWidthEm1000;
|
|
22058
22071
|
let em = 0;
|
|
22059
22072
|
for (const ch of text) {
|
|
22060
22073
|
const cp = ch.codePointAt(0);
|
|
@@ -22067,9 +22080,9 @@ var FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;?]}\xA2\xB0\u2032\u2033\u
|
|
|
22067
22080
|
var FORBID_END = /* @__PURE__ */ new Set([..."$([{\xA3\xA5\u3008\u300A\u300C\u300E\u3010\u3014$([{\u20A9"]);
|
|
22068
22081
|
function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "keep", opts) {
|
|
22069
22082
|
const EPS = 0.5;
|
|
22070
|
-
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
22071
|
-
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
22072
|
-
const widthEm = _optionalChain([opts, 'optionalAccess',
|
|
22083
|
+
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _268 => _268.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
22084
|
+
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _269 => _269.spacingPct]), () => ( 0));
|
|
22085
|
+
const widthEm = _optionalChain([opts, 'optionalAccess', _270 => _270.faceClass]) === "fixedPitch" ? fixedPitchWidthEm1000 : charWidthEm1000;
|
|
22073
22086
|
const k = height * ratioPct / 100 / 1e3;
|
|
22074
22087
|
const cwCp = (cp) => (cp === 32 ? spaceEm : widthEm(cp)) * (1 + spacing / 100) * k;
|
|
22075
22088
|
const charW2 = (ch) => cwCp(ch.codePointAt(0));
|
|
@@ -22331,7 +22344,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
22331
22344
|
}
|
|
22332
22345
|
function assertFiniteRange(name, value, min, max) {
|
|
22333
22346
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
22334
|
-
throw new (0,
|
|
22347
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
22335
22348
|
}
|
|
22336
22349
|
}
|
|
22337
22350
|
function validateGongmunOptions(opts) {
|
|
@@ -22346,10 +22359,10 @@ function validateGongmunOptions(opts) {
|
|
|
22346
22359
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
22347
22360
|
}
|
|
22348
22361
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
22349
|
-
throw new (0,
|
|
22362
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
22350
22363
|
}
|
|
22351
22364
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
22352
|
-
throw new (0,
|
|
22365
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
22353
22366
|
}
|
|
22354
22367
|
}
|
|
22355
22368
|
if (opts.sizes) {
|
|
@@ -22358,7 +22371,7 @@ function validateGongmunOptions(opts) {
|
|
|
22358
22371
|
}
|
|
22359
22372
|
}
|
|
22360
22373
|
if (opts.approval && opts.approval.length > 6) {
|
|
22361
|
-
throw new (0,
|
|
22374
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("approval must contain at most 6 labels");
|
|
22362
22375
|
}
|
|
22363
22376
|
}
|
|
22364
22377
|
function incompatibleGongmunWarnings(opts) {
|
|
@@ -22422,7 +22435,7 @@ function resolveGongmun(opts) {
|
|
|
22422
22435
|
suppressSingle: _nullishCoalesce(opts.suppressSingle, () => ( false)),
|
|
22423
22436
|
docHead: preset === "official" && opts.docHead ? opts.docHead : null,
|
|
22424
22437
|
docFoot: preset === "official" && opts.docFoot ? opts.docFoot : null,
|
|
22425
|
-
reportInfo: _optionalChain([opts, 'access',
|
|
22438
|
+
reportInfo: _optionalChain([opts, 'access', _271 => _271.reportInfo, 'optionalAccess', _272 => _272.trim, 'call', _273 => _273()]) || null,
|
|
22426
22439
|
noticeHead: preset === "notice" && opts.noticeHead ? opts.noticeHead : null,
|
|
22427
22440
|
// 보도자료 머리박스는 프리셋 자체가 요구 — 옵션 미지정이어도 빈 객체
|
|
22428
22441
|
press: preset === "press" ? _nullishCoalesce(opts.press, () => ( {})) : null
|
|
@@ -22531,16 +22544,16 @@ var PARA_LIST = 7;
|
|
|
22531
22544
|
var DEFAULT_TEXT_COLOR = "#000000";
|
|
22532
22545
|
function resolveTheme(theme) {
|
|
22533
22546
|
return {
|
|
22534
|
-
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22535
|
-
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22536
|
-
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22537
|
-
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22538
|
-
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22539
|
-
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22547
|
+
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _274 => _274.headingColors, 'optionalAccess', _275 => _275[1]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22548
|
+
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _276 => _276.headingColors, 'optionalAccess', _277 => _277[2]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22549
|
+
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _278 => _278.headingColors, 'optionalAccess', _279 => _279[3]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22550
|
+
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _280 => _280.headingColors, 'optionalAccess', _281 => _281[4]]), () => ( _optionalChain([theme, 'optionalAccess', _282 => _282.headingColors, 'optionalAccess', _283 => _283[3]]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
22551
|
+
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _284 => _284.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22552
|
+
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _285 => _285.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22540
22553
|
/** quoteColor가 명시되었는지 — blockquote charPr 분기에 사용 (baseline 호환) */
|
|
22541
|
-
hasQuoteOption: _optionalChain([theme, 'optionalAccess',
|
|
22542
|
-
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22543
|
-
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess',
|
|
22554
|
+
hasQuoteOption: _optionalChain([theme, 'optionalAccess', _286 => _286.quoteColor]) !== void 0,
|
|
22555
|
+
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _287 => _287.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _288 => _288.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
22556
|
+
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _289 => _289.tableHeaderBold])
|
|
22544
22557
|
};
|
|
22545
22558
|
}
|
|
22546
22559
|
function escapeXml(text) {
|
|
@@ -22881,6 +22894,7 @@ function parseInlineMarkdown(text) {
|
|
|
22881
22894
|
});
|
|
22882
22895
|
text = text.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1");
|
|
22883
22896
|
text = text.replace(/~~([^~]+)~~/g, "$1");
|
|
22897
|
+
text = text.replace(/<u>([^<]*)<\/u>/g, "$1");
|
|
22884
22898
|
let spans;
|
|
22885
22899
|
if (inlineDoc) {
|
|
22886
22900
|
spans = [];
|
|
@@ -22895,7 +22909,7 @@ function parseInlineMarkdown(text) {
|
|
|
22895
22909
|
else spans.push(...emphasisSpans(m[0]));
|
|
22896
22910
|
} else {
|
|
22897
22911
|
const anchor = m[2] || m[3];
|
|
22898
|
-
const href = _nullishCoalesce(
|
|
22912
|
+
const href = _nullishCoalesce(_chunkDZBMQC2Ncjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
22899
22913
|
const sub = emphasisSpans(anchor);
|
|
22900
22914
|
if (href) for (const s of sub) s.href = href;
|
|
22901
22915
|
spans.push(...sub);
|
|
@@ -23061,8 +23075,8 @@ function resolvePage(opts) {
|
|
|
23061
23075
|
// 실측: 용지 치수는 방향과 무관하게 유지, 방향은 landscape 속성만 바뀐다
|
|
23062
23076
|
landscape: orientation === "landscape" ? "NARROWLY" : "WIDELY",
|
|
23063
23077
|
columns: cols,
|
|
23064
|
-
header: _optionalChain([header, 'optionalAccess',
|
|
23065
|
-
footer: _optionalChain([footer, 'optionalAccess',
|
|
23078
|
+
header: _optionalChain([header, 'optionalAccess', _290 => _290.trim, 'call', _291 => _291()]) ? header.trim() : null,
|
|
23079
|
+
footer: _optionalChain([footer, 'optionalAccess', _292 => _292.trim, 'call', _293 => _293()]) ? footer.trim() : null
|
|
23066
23080
|
};
|
|
23067
23081
|
}
|
|
23068
23082
|
function columnColPrXml(columns) {
|
|
@@ -23109,7 +23123,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
23109
23123
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
23110
23124
|
const got = m ? Number(m[1]) : NaN;
|
|
23111
23125
|
if (got !== startId + i) {
|
|
23112
|
-
throw new (0,
|
|
23126
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
23113
23127
|
`\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)`
|
|
23114
23128
|
);
|
|
23115
23129
|
}
|
|
@@ -23193,7 +23207,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
23193
23207
|
}
|
|
23194
23208
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
23195
23209
|
if (rows.length !== expectedBase) {
|
|
23196
|
-
throw new (0,
|
|
23210
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
23197
23211
|
`\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`
|
|
23198
23212
|
);
|
|
23199
23213
|
}
|
|
@@ -23421,7 +23435,7 @@ function buildStyles(gongmun) {
|
|
|
23421
23435
|
</hh:styles>`;
|
|
23422
23436
|
}
|
|
23423
23437
|
function generateHeaderXml(theme, gongmun, ratioVariants = [], extraBorderFills = [], extraCharPrXmls = [], listIndentVariants = [], extraFonts = []) {
|
|
23424
|
-
const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess',
|
|
23438
|
+
const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess', _294 => _294.fonts, 'access', _295 => _295.body]), () => ( (_optionalChain([gongmun, 'optionalAccess', _296 => _296.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5")));
|
|
23425
23439
|
const charPropsXml = buildCharProperties(theme, gongmun, ratioVariants, extraCharPrXmls);
|
|
23426
23440
|
const paraPropsXml = buildParaProperties(gongmun, gongmun ? listIndentVariants : []);
|
|
23427
23441
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
@@ -23550,8 +23564,8 @@ function parseChartFence(text) {
|
|
|
23550
23564
|
const spec = chartSpec(type);
|
|
23551
23565
|
let finalSeries = spec.pie ? [series[0]] : series;
|
|
23552
23566
|
finalSeries = finalSeries.map((s) => ({ ...s }));
|
|
23553
|
-
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
23554
|
-
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
23567
|
+
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess', _297 => _297.length]), () => ( 0)), ...finalSeries.map((s) => s.values.length));
|
|
23568
|
+
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess', _298 => _298[i]]), () => ( `\uD56D\uBAA9 ${i + 1}`)));
|
|
23555
23569
|
if (!spec.scatter) {
|
|
23556
23570
|
finalSeries = finalSeries.map((s) => ({ ...s, values: catFinal.map((_, i) => _nullishCoalesce(s.values[i], () => ( 0))) }));
|
|
23557
23571
|
}
|
|
@@ -23593,7 +23607,7 @@ function serSpPr(color, stroke) {
|
|
|
23593
23607
|
return stroke ? `<c:spPr><a:ln w="28575" cap="flat" cmpd="sng" algn="ctr">${f}<a:prstDash val="solid"/><a:round/></a:ln></c:spPr>` : `<c:spPr>${f}</c:spPr>`;
|
|
23594
23608
|
}
|
|
23595
23609
|
function dPtXml(pointColors, pie) {
|
|
23596
|
-
if (!_optionalChain([pointColors, 'optionalAccess',
|
|
23610
|
+
if (!_optionalChain([pointColors, 'optionalAccess', _299 => _299.length])) return "";
|
|
23597
23611
|
return pointColors.map((col, i) => {
|
|
23598
23612
|
const f = chartColorFill(col);
|
|
23599
23613
|
if (!f) return "";
|
|
@@ -23832,8 +23846,8 @@ function buildGaejosikCover(title, gongmun, bodyWidth = GAEJOSIK_BASE_WIDTH) {
|
|
|
23832
23846
|
const botRow = cell({ bf: GJ_BF_BAR_DARK, col: 0, row: 2, w: g.botDarkW, h: g.botBarH, paras: barEmpty }) + cell({ bf: GJ_BF_BAR_LIGHT, col: 1, colSpan: 2, row: 2, w: g.botLightW, h: g.botBarH, paras: barEmpty });
|
|
23833
23847
|
const tbl2 = table([topRow, titleRow, botRow], g.totalW, g.barH + g.titleH + g.botBarH, 3, 1, bodyWidth);
|
|
23834
23848
|
const host = `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${tbl2}</hp:run></hp:p>`;
|
|
23835
|
-
const date = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
23836
|
-
const org = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
23849
|
+
const date = _nullishCoalesce(_optionalChain([gongmun, 'access', _300 => _300.cover, 'optionalAccess', _301 => _301.date]), () => ( formatGaejosikDate(/* @__PURE__ */ new Date())));
|
|
23850
|
+
const org = _nullishCoalesce(_optionalChain([gongmun, 'access', _302 => _302.cover, 'optionalAccess', _303 => _303.org]), () => ( ""));
|
|
23837
23851
|
const sub = (t) => `<hp:p paraPrIDRef="${GJ_PARA_COVER}" styleIDRef="0"><hp:run charPrIDRef="${GJ_CHAR_COVER_SUB}"><hp:t>${escapeXml(t)}</hp:t></hp:run></hp:p>`;
|
|
23838
23852
|
const subEmpty = emptyPara(GJ_PARA_COVER, false, GJ_CHAR_COVER_SUB);
|
|
23839
23853
|
return [
|
|
@@ -24089,7 +24103,7 @@ function escapeGfm(text) {
|
|
|
24089
24103
|
}
|
|
24090
24104
|
var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
|
|
24091
24105
|
function sanitizeText(text) {
|
|
24092
|
-
let result =
|
|
24106
|
+
let result = _chunk46VU6YXFcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
24093
24107
|
if (result.length <= 30 && result.includes(" ")) {
|
|
24094
24108
|
const tokens = result.split(" ");
|
|
24095
24109
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -24119,7 +24133,7 @@ function replicateGfmTable(table2) {
|
|
|
24119
24133
|
for (let r = 0; r < numRows; r++) {
|
|
24120
24134
|
for (let c = 0; c < numCols; c++) {
|
|
24121
24135
|
if (skip.has(`${r},${c}`)) continue;
|
|
24122
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
24136
|
+
const cell2 = _optionalChain([cells, 'access', _304 => _304[r], 'optionalAccess', _305 => _305[c]]);
|
|
24123
24137
|
if (!cell2) continue;
|
|
24124
24138
|
display[r][c] = {
|
|
24125
24139
|
text: escapeGfm(sanitizeText(cell2.text)).replace(/\|/g, "\\|").replace(/\n/g, "<br>"),
|
|
@@ -24173,7 +24187,7 @@ function unescapeGfmCell(text) {
|
|
|
24173
24187
|
return text.replace(/<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(/\\([~*_`])/g, "$1");
|
|
24174
24188
|
}
|
|
24175
24189
|
function replicateCellInnerHtml(cell2) {
|
|
24176
|
-
if (_optionalChain([cell2, 'access',
|
|
24190
|
+
if (_optionalChain([cell2, 'access', _306 => _306.blocks, 'optionalAccess', _307 => _307.length])) {
|
|
24177
24191
|
return cell2.blocks.map((b) => {
|
|
24178
24192
|
if (b.type === "table" && b.table) {
|
|
24179
24193
|
const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
|
|
@@ -24212,7 +24226,7 @@ function replicateHtmlTable(table2) {
|
|
|
24212
24226
|
const rowCells = [];
|
|
24213
24227
|
for (let c = 0; c < numCols; c++) {
|
|
24214
24228
|
if (skip.has(`${r},${c}`)) continue;
|
|
24215
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
24229
|
+
const cell2 = _optionalChain([cells, 'access', _308 => _308[r], 'optionalAccess', _309 => _309[c]]);
|
|
24216
24230
|
if (!cell2) continue;
|
|
24217
24231
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
24218
24232
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -24258,10 +24272,10 @@ function parseHtmlTable(raw) {
|
|
|
24258
24272
|
}
|
|
24259
24273
|
} else {
|
|
24260
24274
|
if (!isClose) {
|
|
24261
|
-
const cs = parseInt(_optionalChain([attrs, 'access',
|
|
24262
|
-
const rs = parseInt(_optionalChain([attrs, 'access',
|
|
24275
|
+
const cs = parseInt(_optionalChain([attrs, 'access', _310 => _310.match, 'call', _311 => _311(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _312 => _312[1]]) || "1", 10);
|
|
24276
|
+
const rs = parseInt(_optionalChain([attrs, 'access', _313 => _313.match, 'call', _314 => _314(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _315 => _315[1]]) || "1", 10);
|
|
24263
24277
|
cellStart = m.index + m[0].length;
|
|
24264
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
24278
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunk46VU6YXFcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunk46VU6YXFcjs.MAX_ROWS) };
|
|
24265
24279
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
24266
24280
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
24267
24281
|
cellStart = -1;
|
|
@@ -24285,7 +24299,7 @@ function htmlCellInnerToLines(inner) {
|
|
|
24285
24299
|
hadNonText = true;
|
|
24286
24300
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
24287
24301
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
24288
|
-
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess',
|
|
24302
|
+
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _316 => _316[1]]), () => ( _optionalChain([m, 'optionalAccess', _317 => _317[2]])));
|
|
24289
24303
|
if (src) imgSrcs.push(src);
|
|
24290
24304
|
return "";
|
|
24291
24305
|
});
|
|
@@ -24428,7 +24442,7 @@ function edgeXml(tag, d) {
|
|
|
24428
24442
|
return d ? `<hh:${tag} type="${escapeXml(d.type)}" width="${escapeXml(d.width)}" color="${escapeXml(d.color)}"/>` : `<hh:${tag} type="NONE" width="0.1 mm" color="#000000"/>`;
|
|
24429
24443
|
}
|
|
24430
24444
|
function borderFillDefToXml(id, def) {
|
|
24431
|
-
const fill = _optionalChain([def, 'access',
|
|
24445
|
+
const fill = _optionalChain([def, 'access', _318 => _318.fill, 'optionalAccess', _319 => _319.faceColor]) ? `<hh:fillBrush><hh:winBrush faceColor="${escapeXml(def.fill.faceColor)}" hatchColor="#000000" alpha="0"/></hh:fillBrush>` : "";
|
|
24432
24446
|
return ` <hh:borderFill id="${id}" threeD="0" shadow="0" centerLine="NONE" breakCellSeparateLine="0">
|
|
24433
24447
|
<hh:slash type="NONE" Crooked="0" isCounter="0"/>
|
|
24434
24448
|
<hh:backSlash type="NONE" Crooked="0" isCounter="0"/>
|
|
@@ -24744,7 +24758,7 @@ var ImageRegistry = (_class5 = class {
|
|
|
24744
24758
|
}
|
|
24745
24759
|
/** 실데이터 등록 — images 맵 바이트·data: URI. 포맷 미상(webp 등)은 null → placeholder 폴백 */
|
|
24746
24760
|
takeReal(url) {
|
|
24747
|
-
let bytes = _optionalChain([this, 'access',
|
|
24761
|
+
let bytes = _optionalChain([this, 'access', _320 => _320.supplied, 'optionalAccess', _321 => _321.get, 'call', _322 => _322(url)]);
|
|
24748
24762
|
if (!bytes && url.startsWith("data:")) {
|
|
24749
24763
|
const m = /^data:image\/[a-z+]+;base64,([A-Za-z0-9+/=\s]+)$/i.exec(url);
|
|
24750
24764
|
if (m) {
|
|
@@ -24919,11 +24933,11 @@ function estimateRowHeight(cells, widths, charHeight) {
|
|
|
24919
24933
|
function generateTable(rows, theme, style = null, remap = null, seq = 0, images = null) {
|
|
24920
24934
|
const rowCnt = rows.length;
|
|
24921
24935
|
const colCnt = Math.max(...rows.map((r) => r.length), 1);
|
|
24922
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
24936
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _323 => _323.bfRegistry]), () => ( null));
|
|
24923
24937
|
const totalW = style ? reg ? style.totalWidth - DATA_TABLE_INSET : style.totalWidth : 44e3;
|
|
24924
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
24938
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _324 => _324.charHeight]), () => ( 1e3));
|
|
24925
24939
|
const rowAnchor = normalizeRowAnchor((_nullishCoalesce(rows[0], () => ( []))).map((c) => c.replace(/!\[[^\]]*\]\([^)]*\)/g, "")));
|
|
24926
|
-
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access',
|
|
24940
|
+
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access', _325 => _325[0], 'optionalAccess', _326 => _326[0]]), () => ( ""))), seq, rowAnchor);
|
|
24927
24941
|
const colMax = Array(colCnt).fill(0);
|
|
24928
24942
|
const colMaxBody = Array(colCnt).fill(0);
|
|
24929
24943
|
const colMinWord = Array(colCnt).fill(0);
|
|
@@ -24951,7 +24965,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
24951
24965
|
const k = `${rowIdx},${colIdx}`;
|
|
24952
24966
|
const isLabelCell2 = labelCol0 && colIdx === 0;
|
|
24953
24967
|
const defaultCharPr = style ? reg && (isHeaderRow || isLabelCell2) ? style.boldCharPr : style.charPr : isHeaderRow ? headerCharPr : baseCharPr;
|
|
24954
|
-
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
24968
|
+
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _327 => _327.cellChar, 'access', _328 => _328.get, 'call', _329 => _329(k)]), () => ( defaultCharPr));
|
|
24955
24969
|
const centered = isHeaderRow || colCentered[colIdx];
|
|
24956
24970
|
const paraPrId = style ? centered ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
24957
24971
|
const p = cell2.split(/<br\s*\/?>/i).map((seg) => {
|
|
@@ -24969,11 +24983,11 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
24969
24983
|
}
|
|
24970
24984
|
}
|
|
24971
24985
|
}
|
|
24972
|
-
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess',
|
|
24986
|
+
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess', _330 => _330.cellChar, 'access', _331 => _331.has, 'call', _332 => _332(k)]) ? void 0 : mapId);
|
|
24973
24987
|
const body = (runs || (picRuns ? "" : `<hp:run charPrIDRef="${cellCharPr}"><hp:t></hp:t></hp:run>`)) + picRuns;
|
|
24974
24988
|
return `<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0">${body}</hp:p>`;
|
|
24975
24989
|
}).join("");
|
|
24976
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
24990
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _333 => _333.cellBf, 'access', _334 => _334.get, 'call', _335 => _335(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
24977
24991
|
row: rowIdx,
|
|
24978
24992
|
rowEnd: rowIdx,
|
|
24979
24993
|
col: colIdx,
|
|
@@ -24983,7 +24997,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
24983
24997
|
headerRows: 1,
|
|
24984
24998
|
fill: isHeaderRow ? _nullishCoalesce(style.headerFill, () => ( "#E6E6E6")) : isLabelCell2 ? _nullishCoalesce(style.labelFill, () => ( "#E7E7E7")) : void 0
|
|
24985
24999
|
})) : style && isHeaderRow ? style.headerBf : 2)));
|
|
24986
|
-
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25000
|
+
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _336 => _336.cellH, 'access', _337 => _337.get, 'call', _338 => _338(k)]), () => ( cellH));
|
|
24987
25001
|
return `<hp:tc name="" header="${isHeaderRow ? 1 : 0}" hasMargin="0" protect="0" editable="1" dirty="0" borderFillIDRef="${bf}"><hp:subList id="" textDirection="HORIZONTAL" lineWrap="BREAK" vertAlign="${style ? "CENTER" : "TOP"}" linkListIDRef="0" linkListNextIDRef="0" textWidth="0" textHeight="0" hasTextRef="0" hasNumRef="0">${p}</hp:subList><hp:cellAddr colAddr="${colIdx}" rowAddr="${rowIdx}"/><hp:cellSpan colSpan="1" rowSpan="1"/><hp:cellSz width="${colWidths[colIdx]}" height="${h}"/><hp:cellMargin left="141" right="141" top="141" bottom="141"/></hp:tc>`;
|
|
24988
25002
|
}).join("");
|
|
24989
25003
|
return `<hp:tr>${tdElements}</hp:tr>`;
|
|
@@ -24992,7 +25006,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
24992
25006
|
const tblH = rowHeights.reduce((a, b) => a + b, 0);
|
|
24993
25007
|
const tblInner = `<hp:sz width="${tblW}" widthRelTo="ABSOLUTE" height="${tblH}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="1" affectLSpacing="0" flowWithText="0" allowOverlap="0" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="PARA" vertAlign="TOP" horzAlign="LEFT" vertOffset="0" horzOffset="0"/><hp:outMargin left="0" right="0" top="0" bottom="0"/><hp:inMargin left="510" right="510" top="141" bottom="141"/>` + trElements;
|
|
24994
25008
|
const tbl2 = `<hp:tbl id="${tblId}" zOrder="0" numberingType="TABLE" pageBreak="CELL" repeatHeader="${style ? 1 : 0}" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="2" noShading="0">${tblInner}</hp:tbl>`;
|
|
24995
|
-
const hostPr = reg && _optionalChain([style, 'optionalAccess',
|
|
25009
|
+
const hostPr = reg && _optionalChain([style, 'optionalAccess', _339 => _339.rightParaPr]) !== void 0 ? style.rightParaPr : 0;
|
|
24996
25010
|
return `<hp:p paraPrIDRef="${hostPr}" styleIDRef="0"><hp:run charPrIDRef="0">${tbl2}</hp:run></hp:p>`;
|
|
24997
25011
|
}
|
|
24998
25012
|
function layoutHtmlRows(rows) {
|
|
@@ -25003,8 +25017,8 @@ function layoutHtmlRows(rows) {
|
|
|
25003
25017
|
let c = 0;
|
|
25004
25018
|
for (const cell2 of rows[r].cells) {
|
|
25005
25019
|
while (occupied.has(`${r},${c}`)) c++;
|
|
25006
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
25007
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
25020
|
+
const colSpan = clampSpan(cell2.colSpan, _chunk46VU6YXFcjs.MAX_COLS);
|
|
25021
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunk46VU6YXFcjs.MAX_ROWS);
|
|
25008
25022
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
25009
25023
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
25010
25024
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -25032,7 +25046,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25032
25046
|
if (!rows || rows.length === 0) return null;
|
|
25033
25047
|
const { placed, rowCnt, colCnt } = layoutHtmlRows(rows);
|
|
25034
25048
|
if (rowCnt === 0 || colCnt === 0) return null;
|
|
25035
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
25049
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _340 => _340.charHeight]), () => ( 1e3));
|
|
25036
25050
|
const first = _nullishCoalesce(placed.find((p) => p.r === 0 && p.c === 0), () => ( placed[0]));
|
|
25037
25051
|
const row0 = Array.from({ length: colCnt }, () => "");
|
|
25038
25052
|
for (const cell2 of placed) {
|
|
@@ -25061,7 +25075,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25061
25075
|
const tblId = nextTableId();
|
|
25062
25076
|
const useHeaderStyle = !style && (theme.tableHeader !== theme.body || theme.tableHeaderBold);
|
|
25063
25077
|
const spanW = (cell2) => colWidths.slice(cell2.c, cell2.c + cell2.colSpan).reduce((a, b) => a + b, 0);
|
|
25064
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
25078
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _341 => _341.bfRegistry]), () => ( null));
|
|
25065
25079
|
let htmlHeaderRows = 0;
|
|
25066
25080
|
while (htmlHeaderRows < rows.length && rows[htmlHeaderRows].tag === "th") htmlHeaderRows++;
|
|
25067
25081
|
const tableRowHeights = Array(rowCnt).fill(cellH);
|
|
@@ -25075,7 +25089,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25075
25089
|
const nestedW = Math.max(Math.min(Math.max(sw - 1020, 4e3), sw - 282), 500);
|
|
25076
25090
|
const nestedXml = generateHtmlTableXml(nested, theme, nestedW, style ? { ...style, totalWidth: nestedW } : null);
|
|
25077
25091
|
if (nestedXml) {
|
|
25078
|
-
const szH = _optionalChain([nestedXml, 'access',
|
|
25092
|
+
const szH = _optionalChain([nestedXml, 'access', _342 => _342.match, 'call', _343 => _343(/<hp:sz [^>]*height="(\d+)"/), 'optionalAccess', _344 => _344[1]]);
|
|
25079
25093
|
nestedH += (szH ? Number(szH) : (_nullishCoalesce(nested.match(/<tr[\s>]/gi), () => ( []))).length * cellH) + 300;
|
|
25080
25094
|
}
|
|
25081
25095
|
return nestedXml;
|
|
@@ -25086,7 +25100,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25086
25100
|
for (const line of lines) wrapLines += Math.max(1, Math.ceil(measureTextWidth(unescapeHtml(line).trim(), measureH, 100) / usable));
|
|
25087
25101
|
const lineH = style ? Math.round(measureH * 1.6) : 800;
|
|
25088
25102
|
const contentH = Math.max(cellH * rowSpan, Math.max(wrapLines, 1) * lineH + nestedH);
|
|
25089
|
-
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25103
|
+
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _345 => _345.cellH, 'access', _346 => _346.get, 'call', _347 => _347(`${cell2.r},${cell2.c}`)]), () => ( 0)), contentH);
|
|
25090
25104
|
const perRow = Math.ceil(cellHeight / rowSpan);
|
|
25091
25105
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) tableRowHeights[r] = Math.max(tableRowHeights[r], perRow);
|
|
25092
25106
|
return { cell: cell2, rowSpan, lines, nestedXmls, segLines, imgSrcs: cellParsed[i].imgSrcs };
|
|
@@ -25097,7 +25111,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25097
25111
|
const baseCharPr = style ? style.charPr : CHAR_NORMAL;
|
|
25098
25112
|
const headerCharPr = isHeader && useHeaderStyle ? CHAR_TABLE_HEADER : baseCharPr;
|
|
25099
25113
|
const defaultCharPr = style && reg && isHeader ? style.boldCharPr : isHeader ? headerCharPr : baseCharPr;
|
|
25100
|
-
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25114
|
+
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _348 => _348.cellChar, 'access', _349 => _349.get, 'call', _350 => _350(k)]), () => ( defaultCharPr));
|
|
25101
25115
|
const centered = isHeader || colCentered[cell2.c];
|
|
25102
25116
|
const paraPrId = style ? centered ? reg ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : style.centerParaPr : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
25103
25117
|
const picUrls = images ? [...imgSrcs] : [];
|
|
@@ -25137,7 +25151,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25137
25151
|
let cellHeight = 0;
|
|
25138
25152
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) cellHeight += tableRowHeights[r];
|
|
25139
25153
|
const rowEnd = cell2.r + rowSpan - 1;
|
|
25140
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25154
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _351 => _351.cellBf, 'access', _352 => _352.get, 'call', _353 => _353(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
25141
25155
|
row: cell2.r,
|
|
25142
25156
|
rowEnd,
|
|
25143
25157
|
col: cell2.c,
|
|
@@ -25307,7 +25321,7 @@ function buildPressHead(g, ids, bodyWidth, reg) {
|
|
|
25307
25321
|
return [`<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`, blank()];
|
|
25308
25322
|
}
|
|
25309
25323
|
function buildPressContact(g, ids, bodyWidth, reg) {
|
|
25310
|
-
const c = _optionalChain([g, 'access',
|
|
25324
|
+
const c = _optionalChain([g, 'access', _354 => _354.press, 'optionalAccess', _355 => _355.contact]);
|
|
25311
25325
|
if (!c || !c.dept && !c.manager && !c.phone) return [];
|
|
25312
25326
|
const w = bodyWidth - 280;
|
|
25313
25327
|
const cells = [["\uB2F4\uB2F9 \uBD80\uC11C", _nullishCoalesce(c.dept, () => ( ""))], ["\uB2F4\uB2F9\uC790", _nullishCoalesce(c.manager, () => ( ""))], ["\uC5F0\uB77D\uCC98", _nullishCoalesce(c.phone, () => ( ""))]];
|
|
@@ -25686,10 +25700,10 @@ function generateSecPr(gongmun, page = null) {
|
|
|
25686
25700
|
m.header = gongmun.headerFooter;
|
|
25687
25701
|
m.footer = gongmun.headerFooter;
|
|
25688
25702
|
}
|
|
25689
|
-
const secPr = `<hp:secPr textDirection="HORIZONTAL" spaceColumns="1134" tabStop="8000" outlineShapeIDRef="1" memoShapeIDRef="0" textVerticalWidthHead="0" masterPageCnt="0"><hp:grid lineGrid="0" charGrid="0" wonggojiFormat="0"/><hp:startNum pageStartsOn="BOTH" page="0" pic="0" tbl="0" equation="0"/><hp:visibility hideFirstHeader="0" hideFirstFooter="0" hideFirstMasterPage="0" border="SHOW_ALL" fill="SHOW_ALL" hideFirstPageNum="0" hideFirstEmptyLine="0" showLineNumber="0"/><hp:pagePr landscape="${_nullishCoalesce(_optionalChain([page, 'optionalAccess',
|
|
25690
|
-
const colPr = columnColPrXml(_nullishCoalesce(_optionalChain([page, 'optionalAccess',
|
|
25691
|
-
const hf = (_optionalChain([page, 'optionalAccess',
|
|
25692
|
-
return secPr + colPr + hf + (_optionalChain([gongmun, 'optionalAccess',
|
|
25703
|
+
const secPr = `<hp:secPr textDirection="HORIZONTAL" spaceColumns="1134" tabStop="8000" outlineShapeIDRef="1" memoShapeIDRef="0" textVerticalWidthHead="0" masterPageCnt="0"><hp:grid lineGrid="0" charGrid="0" wonggojiFormat="0"/><hp:startNum pageStartsOn="BOTH" page="0" pic="0" tbl="0" equation="0"/><hp:visibility hideFirstHeader="0" hideFirstFooter="0" hideFirstMasterPage="0" border="SHOW_ALL" fill="SHOW_ALL" hideFirstPageNum="0" hideFirstEmptyLine="0" showLineNumber="0"/><hp:pagePr landscape="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _356 => _356.landscape]), () => ( "WIDELY"))}" width="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _357 => _357.widthHU]), () => ( A4_W_HU))}" height="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _358 => _358.heightHU]), () => ( A4_H_HU))}" gutterType="LEFT_ONLY"><hp:margin header="${m.header}" footer="${m.footer}" gutter="0" left="${m.left}" right="${m.right}" top="${m.top}" bottom="${m.bottom}"/></hp:pagePr><hp:footNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="-1" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="283" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="EACH_COLUMN" beneathText="0"/></hp:footNotePr><hp:endNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="14692344" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="0" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="END_OF_DOCUMENT" beneathText="0"/></hp:endNotePr></hp:secPr>`;
|
|
25704
|
+
const colPr = columnColPrXml(_nullishCoalesce(_optionalChain([page, 'optionalAccess', _359 => _359.columns]), () => ( 1)));
|
|
25705
|
+
const hf = (_optionalChain([page, 'optionalAccess', _360 => _360.header]) ? headerFooterCtrl("header", page.header, 1) : "") + (_optionalChain([page, 'optionalAccess', _361 => _361.footer]) ? headerFooterCtrl("footer", page.footer, 2) : "");
|
|
25706
|
+
return secPr + colPr + hf + (_optionalChain([gongmun, 'optionalAccess', _362 => _362.pageNumbers]) ? pageNumCtrl() : "");
|
|
25693
25707
|
}
|
|
25694
25708
|
var SectionOpener = (_class6 = class {
|
|
25695
25709
|
constructor(gongmun, page = null) {;_class6.prototype.__init13.call(this);
|
|
@@ -25729,19 +25743,19 @@ function buildPreamble(blocks, ctx) {
|
|
|
25729
25743
|
const { gongmun, dfIds, bfReg, tableStyle, richAssets, gjBodyW } = ctx;
|
|
25730
25744
|
const preamble = [];
|
|
25731
25745
|
let hasFrontPages = false;
|
|
25732
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25746
|
+
if (_optionalChain([gongmun, 'optionalAccess', _363 => _363.reportInfo]) && dfIds) {
|
|
25733
25747
|
preamble.push(buildReportInfo(gongmun, dfIds));
|
|
25734
25748
|
}
|
|
25735
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25749
|
+
if (_optionalChain([gongmun, 'optionalAccess', _364 => _364.approval]) && bfReg) {
|
|
25736
25750
|
preamble.push(buildApprovalTable(gongmun.approval, bfReg, richAssets ? GJ_CHAR_APPROVAL : GONGMUN_APPROVAL_CHAR));
|
|
25737
25751
|
}
|
|
25738
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25752
|
+
if (_optionalChain([gongmun, 'optionalAccess', _365 => _365.docHead]) && dfIds) {
|
|
25739
25753
|
preamble.push(...buildDocHead(gongmun, dfIds));
|
|
25740
25754
|
}
|
|
25741
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25755
|
+
if (_optionalChain([gongmun, 'optionalAccess', _366 => _366.noticeHead]) && dfIds) {
|
|
25742
25756
|
preamble.push(...buildNoticeHead(gongmun));
|
|
25743
25757
|
}
|
|
25744
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25758
|
+
if (_optionalChain([gongmun, 'optionalAccess', _367 => _367.press]) && dfIds && bfReg && tableStyle) {
|
|
25745
25759
|
preamble.push(...buildPressHead(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
25746
25760
|
}
|
|
25747
25761
|
if (gongmun && (gongmun.cover || gongmun.toc)) {
|
|
@@ -25770,7 +25784,7 @@ function buildPreamble(blocks, ctx) {
|
|
|
25770
25784
|
}
|
|
25771
25785
|
if (gongmun && !ctx.gaejosik && ctx.coverH1Idx < 0 && bfReg && (gongmun.preset === "report" || gongmun.preset === "plan" || gongmun.preset === "notice")) {
|
|
25772
25786
|
ctx.titleBoxH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
25773
|
-
} else if (_optionalChain([gongmun, 'optionalAccess',
|
|
25787
|
+
} else if (_optionalChain([gongmun, 'optionalAccess', _368 => _368.press]) && ctx.coverH1Idx < 0 && dfIds) {
|
|
25774
25788
|
ctx.pressH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
25775
25789
|
}
|
|
25776
25790
|
if (preamble.length > 0) {
|
|
@@ -25785,7 +25799,7 @@ function renderHeading(block, blockIdx, ctx) {
|
|
|
25785
25799
|
if (gongmun && blockIdx === ctx.coverH1Idx) return "";
|
|
25786
25800
|
if (gongmun && blockIdx === ctx.pressH1Idx && dfIds) {
|
|
25787
25801
|
const parts = [generateParagraph((block.text || "").trim(), GONGMUN_CENTER, dfIds.pressTitle)];
|
|
25788
|
-
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
25802
|
+
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access', _369 => _369.press, 'optionalAccess', _370 => _370.sub]), () => ( []))) {
|
|
25789
25803
|
parts.push(generateParagraph(`- ${s} -`, GONGMUN_CENTER, dfIds.pressSub));
|
|
25790
25804
|
}
|
|
25791
25805
|
return parts.join("\n ");
|
|
@@ -25879,8 +25893,8 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
25879
25893
|
const { gongmun, gongmunList, measured, fit, vBase, dfIds } = ctx;
|
|
25880
25894
|
if (gongmun && gongmunList) {
|
|
25881
25895
|
const info = gongmunList.items.get(blockIdx);
|
|
25882
|
-
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
25883
|
-
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
25896
|
+
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _371 => _371.depth]), () => ( 0));
|
|
25897
|
+
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _372 => _372.marker]), () => ( ""));
|
|
25884
25898
|
const content = block.text || "";
|
|
25885
25899
|
if (measured && content.trimStart().startsWith("\u203B")) {
|
|
25886
25900
|
return generateParagraph(content.trim(), GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
|
|
@@ -25889,7 +25903,7 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
25889
25903
|
return generateParagraph(`* ${content.trim()}`, GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
|
|
25890
25904
|
}
|
|
25891
25905
|
const text = marker2 ? `${marker2} ${content}` : content;
|
|
25892
|
-
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess',
|
|
25906
|
+
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess', _373 => _373.indentVariant]) !== void 0 ? GONGMUN_LIST_VARIANT_BASE + info.indentVariant : GONGMUN_LIST_BASE + depth : GONGMUN_LIST_PLAIN_BASE + depth;
|
|
25893
25907
|
let listCharPr = gongmun.numbering === "report" && depth === 0 ? CHAR_BOLD : CHAR_NORMAL;
|
|
25894
25908
|
let mapId = fit ? variantMapper(fit, blockIdx, vBase) : void 0;
|
|
25895
25909
|
if (measured && depth === 0 && gongmun.numbering !== "standard") {
|
|
@@ -25948,18 +25962,18 @@ function renderHtmlTable(block, ctx) {
|
|
|
25948
25962
|
}
|
|
25949
25963
|
function appendPostamble(blocks, ctx) {
|
|
25950
25964
|
const { gongmun, dfIds, bfReg, tableStyle, paraXmls } = ctx;
|
|
25951
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25965
|
+
if (_optionalChain([gongmun, 'optionalAccess', _374 => _374.noticeHead]) && dfIds) {
|
|
25952
25966
|
paraXmls.push(...buildNoticeFoot(gongmun));
|
|
25953
25967
|
}
|
|
25954
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25955
|
-
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access',
|
|
25968
|
+
if (_optionalChain([gongmun, 'optionalAccess', _375 => _375.endMark]) && paraXmls.length > 0) {
|
|
25969
|
+
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access', _376 => _376.rows, 'optionalAccess', _377 => _377.length]));
|
|
25956
25970
|
const lastText = lastBlock && (lastBlock.type === "paragraph" || lastBlock.type === "list_item") ? lastBlock.text || "" : "";
|
|
25957
25971
|
if (!hasEndMark(lastText)) paraXmls.push(buildEndMark());
|
|
25958
25972
|
}
|
|
25959
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25973
|
+
if (_optionalChain([gongmun, 'optionalAccess', _378 => _378.docFoot]) && dfIds) {
|
|
25960
25974
|
paraXmls.push(...buildDocFoot(gongmun, dfIds));
|
|
25961
25975
|
}
|
|
25962
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25976
|
+
if (_optionalChain([gongmun, 'optionalAccess', _379 => _379.press]) && dfIds && bfReg && tableStyle) {
|
|
25963
25977
|
paraXmls.push(...buildPressContact(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
25964
25978
|
}
|
|
25965
25979
|
}
|
|
@@ -25979,7 +25993,7 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
25979
25993
|
remap,
|
|
25980
25994
|
dfIds,
|
|
25981
25995
|
images,
|
|
25982
|
-
gaejosik: _optionalChain([gongmun, 'optionalAccess',
|
|
25996
|
+
gaejosik: _optionalChain([gongmun, 'optionalAccess', _380 => _380.preset]) === "gaejosik",
|
|
25983
25997
|
measured,
|
|
25984
25998
|
richAssets,
|
|
25985
25999
|
vBase: charVariantBase(richAssets, !!gongmun),
|
|
@@ -26085,9 +26099,9 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
26085
26099
|
|
|
26086
26100
|
// src/hwpx/generator.ts
|
|
26087
26101
|
async function markdownToHwpx(markdown, options) {
|
|
26088
|
-
const theme = resolveTheme(_optionalChain([options, 'optionalAccess',
|
|
26089
|
-
const gongmun = _optionalChain([options, 'optionalAccess',
|
|
26090
|
-
const page = resolvePage(_optionalChain([options, 'optionalAccess',
|
|
26102
|
+
const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _381 => _381.theme]));
|
|
26103
|
+
const gongmun = _optionalChain([options, 'optionalAccess', _382 => _382.gongmun]) ? resolveGongmun(options.gongmun) : null;
|
|
26104
|
+
const page = resolvePage(_optionalChain([options, 'optionalAccess', _383 => _383.page]));
|
|
26091
26105
|
const { md: md2, defs } = extractFootnoteDefs(markdown);
|
|
26092
26106
|
beginInlineDoc(defs);
|
|
26093
26107
|
try {
|
|
@@ -26097,13 +26111,13 @@ async function markdownToHwpx(markdown, options) {
|
|
|
26097
26111
|
const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
|
|
26098
26112
|
const fit = gongmun && gongmunList ? computeGongmunFitPlan(blocks, gongmun, gongmunList) : null;
|
|
26099
26113
|
const staticBfEnd = staticBorderFillNext(gongmun);
|
|
26100
|
-
const remap = _optionalChain([options, 'optionalAccess',
|
|
26101
|
-
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26114
|
+
const remap = _optionalChain([options, 'optionalAccess', _384 => _384.profile]) ? buildProfileRemap(options.profile, charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _385 => _385.variants, 'optionalAccess', _386 => _386.length]), () => ( 0))) * 4, staticBfEnd, staticFontNext(gongmun)) : null;
|
|
26115
|
+
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _387 => _387.borderFillXmls, 'access', _388 => _388.length]), () => ( 0)))) : null;
|
|
26102
26116
|
const dfActive = !!gongmun && docframeActive(gongmun);
|
|
26103
|
-
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
26117
|
+
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _389 => _389.variants, 'optionalAccess', _390 => _390.length]), () => ( 0))) * 4 + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _391 => _391.charPrXmls, 'access', _392 => _392.length]), () => ( 0)));
|
|
26104
26118
|
const dfIds = dfActive ? docframeIds(dfBase) : null;
|
|
26105
26119
|
const chartParts = [];
|
|
26106
|
-
const supplied = _optionalChain([options, 'optionalAccess',
|
|
26120
|
+
const supplied = _optionalChain([options, 'optionalAccess', _393 => _393.images]) ? new Map(Object.entries(options.images).map(([k, v]) => [k, v instanceof Uint8Array ? v : new Uint8Array(v)])) : void 0;
|
|
26107
26121
|
const images = new ImageRegistry(supplied);
|
|
26108
26122
|
const sectionXml = blocksToSectionXml(blocks, theme, gongmun, gongmunList, fit, chartParts, bfReg, remap, dfIds, images, page);
|
|
26109
26123
|
if (remap && remap.tables.length > 0) {
|
|
@@ -26112,7 +26126,7 @@ async function markdownToHwpx(markdown, options) {
|
|
|
26112
26126
|
console.warn(`[kordoc] format profile: \uD504\uB85C\uD544 \uD45C ${unused}\uAC1C\uAC00 \uBB38\uC11C \uD45C\uC640 \uB9E4\uCE6D\uB418\uC9C0 \uC54A\uC544 \uBBF8\uC801\uC6A9 (\uD589\xB7\uC5F4/\uCCAB \uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)`);
|
|
26113
26127
|
}
|
|
26114
26128
|
}
|
|
26115
|
-
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26129
|
+
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _394 => _394.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _395 => _395.emit, 'call', _396 => _396()]), () => ( []))];
|
|
26116
26130
|
const zip = new (0, _jszip2.default)();
|
|
26117
26131
|
zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
|
|
26118
26132
|
zip.file("META-INF/container.xml", generateContainerXml());
|
|
@@ -26121,11 +26135,11 @@ async function markdownToHwpx(markdown, options) {
|
|
|
26121
26135
|
zip.file("Contents/header.xml", generateHeaderXml(
|
|
26122
26136
|
theme,
|
|
26123
26137
|
gongmun,
|
|
26124
|
-
_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
26138
|
+
_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _397 => _397.variants]), () => ( [])),
|
|
26125
26139
|
extraBorderFills,
|
|
26126
|
-
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26127
|
-
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess',
|
|
26128
|
-
_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26140
|
+
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _398 => _398.charPrXmls]), () => ( [])), ...dfActive ? docframeCharPrXmls(dfBase, richAssets) : []],
|
|
26141
|
+
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess', _399 => _399.indentVariants]), () => ( [])),
|
|
26142
|
+
_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _400 => _400.fontFaces]), () => ( []))
|
|
26129
26143
|
));
|
|
26130
26144
|
zip.file("Contents/section0.xml", sectionXml);
|
|
26131
26145
|
for (const part of chartParts) zip.file(part.name, part.xml);
|
|
@@ -26179,7 +26193,7 @@ function alignBlocks(a, b) {
|
|
|
26179
26193
|
const m = a.length, n = b.length;
|
|
26180
26194
|
if (m * n > 1e7) return fallbackAlign(a, b);
|
|
26181
26195
|
const lenOf = (blk) => {
|
|
26182
|
-
const t = blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
26196
|
+
const t = blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _401 => _401.text]), () => ( ""))).join(" ") : "";
|
|
26183
26197
|
return t.replace(/\s+/g, " ").trim().length;
|
|
26184
26198
|
};
|
|
26185
26199
|
const aLen = a.map(lenOf);
|
|
@@ -26252,8 +26266,8 @@ function blockSimilarity(a, b) {
|
|
|
26252
26266
|
}
|
|
26253
26267
|
function tableSimilarity(a, b) {
|
|
26254
26268
|
const dimSim = 1 - Math.abs(a.rows * a.cols - b.rows * b.cols) / Math.max(a.rows * a.cols, b.rows * b.cols, 1);
|
|
26255
|
-
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
26256
|
-
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
26269
|
+
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _402 => _402.text]), () => ( ""))).join(" ");
|
|
26270
|
+
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _403 => _403.text]), () => ( ""))).join(" ");
|
|
26257
26271
|
const contentSim = normalizedSimilarity(textsA, textsB);
|
|
26258
26272
|
return dimSim * 0.3 + contentSim * 0.7;
|
|
26259
26273
|
}
|
|
@@ -26264,8 +26278,8 @@ function diffTableCells(a, b) {
|
|
|
26264
26278
|
for (let r = 0; r < maxRows; r++) {
|
|
26265
26279
|
const row = [];
|
|
26266
26280
|
for (let c = 0; c < maxCols; c++) {
|
|
26267
|
-
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access',
|
|
26268
|
-
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access',
|
|
26281
|
+
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access', _404 => _404.cells, 'access', _405 => _405[r], 'optionalAccess', _406 => _406[c], 'optionalAccess', _407 => _407.text]) : void 0;
|
|
26282
|
+
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access', _408 => _408.cells, 'access', _409 => _409[r], 'optionalAccess', _410 => _410[c], 'optionalAccess', _411 => _411.text]) : void 0;
|
|
26269
26283
|
let type;
|
|
26270
26284
|
if (cellA === void 0) type = "added";
|
|
26271
26285
|
else if (cellB === void 0) type = "removed";
|
|
@@ -26315,7 +26329,7 @@ function builtinTemplateDir() {
|
|
|
26315
26329
|
for (const c of candidates) {
|
|
26316
26330
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
26317
26331
|
}
|
|
26318
|
-
throw new (0,
|
|
26332
|
+
throw new (0, _chunkDZBMQC2Ncjs.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)");
|
|
26319
26333
|
}
|
|
26320
26334
|
function readBuiltinTemplate(t) {
|
|
26321
26335
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -26478,7 +26492,7 @@ function parseRenderStyles(headXml) {
|
|
|
26478
26492
|
const underlineEl = findChildByLocalName(el, "underline");
|
|
26479
26493
|
const textColor = el.getAttribute("textColor");
|
|
26480
26494
|
const fontRef = findChildByLocalName(el, "fontRef");
|
|
26481
|
-
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess',
|
|
26495
|
+
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _412 => _412.getAttribute, 'call', _413 => _413("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _414 => _414.getAttribute, 'call', _415 => _415("latin")])));
|
|
26482
26496
|
const face = fontId != null ? hangulFonts.get(fontId) : void 0;
|
|
26483
26497
|
styles.charPr.set(id, {
|
|
26484
26498
|
height: Number(el.getAttribute("height")) || 1e3,
|
|
@@ -26486,8 +26500,8 @@ function parseRenderStyles(headXml) {
|
|
|
26486
26500
|
italic: findChildByLocalName(el, "italic") != null,
|
|
26487
26501
|
underline: underlineEl != null && (_nullishCoalesce(underlineEl.getAttribute("type"), () => ( "NONE"))) !== "NONE",
|
|
26488
26502
|
color: textColor && textColor !== "#000000" && textColor.toLowerCase() !== "none" ? textColor : void 0,
|
|
26489
|
-
ratio: Number(_optionalChain([ratioEl, 'optionalAccess',
|
|
26490
|
-
spacing: Number(_optionalChain([spacingEl, 'optionalAccess',
|
|
26503
|
+
ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _416 => _416.getAttribute, 'call', _417 => _417("hangul")])) || 100,
|
|
26504
|
+
spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _418 => _418.getAttribute, 'call', _419 => _419("hangul")])) || 0,
|
|
26491
26505
|
fontFamily: face ? hwpFaceToCssStack(face) : void 0,
|
|
26492
26506
|
face
|
|
26493
26507
|
});
|
|
@@ -26496,7 +26510,7 @@ function parseRenderStyles(headXml) {
|
|
|
26496
26510
|
const id = el.getAttribute("id");
|
|
26497
26511
|
if (id != null) {
|
|
26498
26512
|
const align = findChildByLocalName(el, "align");
|
|
26499
|
-
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess',
|
|
26513
|
+
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _420 => _420.getAttribute, 'call', _421 => _421("horizontal")]) || "JUSTIFY");
|
|
26500
26514
|
styles.paraGeom.set(id, parseParaGeom(el));
|
|
26501
26515
|
}
|
|
26502
26516
|
} else if (tag === "borderFill") {
|
|
@@ -26510,7 +26524,7 @@ function parseRenderStyles(headXml) {
|
|
|
26510
26524
|
};
|
|
26511
26525
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
26512
26526
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
26513
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
26527
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _422 => _422.getAttribute, 'call', _423 => _423("faceColor")]);
|
|
26514
26528
|
if (face && face.toLowerCase() !== "none") bf.fill = face;
|
|
26515
26529
|
styles.borderFill.set(id, bf);
|
|
26516
26530
|
}
|
|
@@ -26582,7 +26596,7 @@ function collectSites(scan) {
|
|
|
26582
26596
|
}
|
|
26583
26597
|
function attrOf3(openTag, name) {
|
|
26584
26598
|
const m = openTag.match(new RegExp(`\\b${name}="([^"]*)"`));
|
|
26585
|
-
return _optionalChain([m, 'optionalAccess',
|
|
26599
|
+
return _optionalChain([m, 'optionalAccess', _424 => _424[1]]);
|
|
26586
26600
|
}
|
|
26587
26601
|
function paraOpenTag(xml, para2) {
|
|
26588
26602
|
const end = xml.indexOf(">", para2.start);
|
|
@@ -26597,7 +26611,7 @@ function anchorRunInfo(xml, para2, anchor) {
|
|
|
26597
26611
|
if (!tr) return null;
|
|
26598
26612
|
const before = xml.slice(Math.max(0, para2.start), tr.contentStart);
|
|
26599
26613
|
const runOpen = [...before.matchAll(/<([A-Za-z0-9]+):run\b[^>]*>/g)].pop();
|
|
26600
|
-
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess',
|
|
26614
|
+
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _425 => _425[1]]), () => ( tr.prefix)), () => ( "hp"));
|
|
26601
26615
|
const charPr2 = runOpen && attrOf3(runOpen[0], "charPrIDRef") || "0";
|
|
26602
26616
|
const close = xml.indexOf(`</${prefix}:run>`, tr.contentEnd);
|
|
26603
26617
|
if (close === -1) return null;
|
|
@@ -26624,7 +26638,7 @@ function cellContentWidthMm(xml, cell2) {
|
|
|
26624
26638
|
if (width === null) return null;
|
|
26625
26639
|
let content = width;
|
|
26626
26640
|
const win = cellAddrWindow(xml, cell2);
|
|
26627
|
-
const mg = _optionalChain([win, 'optionalAccess',
|
|
26641
|
+
const mg = _optionalChain([win, 'optionalAccess', _426 => _426.match, 'call', _427 => _427(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
|
|
26628
26642
|
if (mg) {
|
|
26629
26643
|
content -= Number(_nullishCoalesce(attrOf3(mg[0], "left"), () => ( 0))) + Number(_nullishCoalesce(attrOf3(mg[0], "right"), () => ( 0)));
|
|
26630
26644
|
}
|
|
@@ -26658,12 +26672,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
26658
26672
|
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>`;
|
|
26659
26673
|
}
|
|
26660
26674
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
26661
|
-
if (ops.length === 0) throw new (0,
|
|
26675
|
+
if (ops.length === 0) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
26662
26676
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
26663
|
-
|
|
26677
|
+
_chunkDZBMQC2Ncjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
26664
26678
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
26665
|
-
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access',
|
|
26666
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
26679
|
+
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _428 => _428.match, 'call', _429 => _429(/(\d+)\.xml$/i), 'optionalAccess', _430 => _430[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _431 => _431.match, 'call', _432 => _432(/(\d+)\.xml$/i), 'optionalAccess', _433 => _433[1]]), () => ( 0))));
|
|
26680
|
+
if (sectionPaths.length === 0) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
26667
26681
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
26668
26682
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
26669
26683
|
const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
|
|
@@ -26704,11 +26718,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26704
26718
|
const manifestItems = [];
|
|
26705
26719
|
const placed = [];
|
|
26706
26720
|
for (const op of ops) {
|
|
26707
|
-
if (!op.anchor) throw new (0,
|
|
26708
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
26721
|
+
if (!op.anchor) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
26722
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
26709
26723
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
26710
|
-
if (!MIME[ext]) throw new (0,
|
|
26711
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
26724
|
+
if (!MIME[ext]) throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
26725
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkDZBMQC2Ncjs.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)`);
|
|
26712
26726
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
26713
26727
|
let found = null;
|
|
26714
26728
|
let total = 0;
|
|
@@ -26741,7 +26755,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26741
26755
|
}
|
|
26742
26756
|
}
|
|
26743
26757
|
}
|
|
26744
|
-
throw new (0,
|
|
26758
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
26745
26759
|
`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)})`
|
|
26746
26760
|
);
|
|
26747
26761
|
}
|
|
@@ -26749,9 +26763,9 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26749
26763
|
const xml = sectionXmls[si];
|
|
26750
26764
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
26751
26765
|
if (!run) {
|
|
26752
|
-
throw new (0,
|
|
26766
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
26753
26767
|
}
|
|
26754
|
-
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess',
|
|
26768
|
+
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _434 => _434.charPr, 'access', _435 => _435.get, 'call', _436 => _436(run.charPr), 'optionalAccess', _437 => _437.height]), () => ( 1e3));
|
|
26755
26769
|
const fontPt = charPrHeight / 100;
|
|
26756
26770
|
const emMm = fontPt * 25.4 / 72;
|
|
26757
26771
|
const lineHMm = emMm;
|
|
@@ -26760,7 +26774,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26760
26774
|
const sizeMm = op.sizeMm != null && Number.isFinite(op.sizeMm) && op.sizeMm > 0 ? op.sizeMm : Math.max(7, Math.min(18, lineHMm * 1.6));
|
|
26761
26775
|
const availMm = _nullishCoalesce((site.cell ? cellContentWidthMm(xml, site.cell) : null), () => ( bodyColumnWidthMm(xml)));
|
|
26762
26776
|
const paraPrId = _nullishCoalesce(attrOf3(paraOpenTag(xml, site.para), "paraPrIDRef"), () => ( "0"));
|
|
26763
|
-
const align = _optionalChain([styles, 'optionalAccess',
|
|
26777
|
+
const align = _optionalChain([styles, 'optionalAccess', _438 => _438.paraAlign, 'access', _439 => _439.get, 'call', _440 => _440(paraPrId)]);
|
|
26764
26778
|
let alignShiftMm = 0;
|
|
26765
26779
|
if (align === "CENTER" || align === "RIGHT") {
|
|
26766
26780
|
const paraWMm = measureMm(site.para.text, emMm);
|
|
@@ -26856,7 +26870,7 @@ function parseBorderFills(headerDoc) {
|
|
|
26856
26870
|
};
|
|
26857
26871
|
const fillBrush = findChildByLocalName(bf, "fillBrush");
|
|
26858
26872
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
26859
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
26873
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _441 => _441.getAttribute, 'call', _442 => _442("faceColor")]);
|
|
26860
26874
|
if (face && face !== "none") def.fill = { faceColor: face };
|
|
26861
26875
|
map.set(id, def);
|
|
26862
26876
|
}
|
|
@@ -26888,7 +26902,7 @@ function parseCharPrs(headerDoc, hangulFonts) {
|
|
|
26888
26902
|
if (cp.getAttribute("italic") === "1") def.italic = true;
|
|
26889
26903
|
if (findChildByLocalName(cp, "underline")) def.underline = true;
|
|
26890
26904
|
const fontRef = findChildByLocalName(cp, "fontRef");
|
|
26891
|
-
const hangul = _optionalChain([fontRef, 'optionalAccess',
|
|
26905
|
+
const hangul = _optionalChain([fontRef, 'optionalAccess', _443 => _443.getAttribute, 'call', _444 => _444("hangul")]);
|
|
26892
26906
|
if (hangul) {
|
|
26893
26907
|
def.fontRef_hangul = hangul;
|
|
26894
26908
|
const face = hangulFonts.get(hangul);
|
|
@@ -26916,7 +26930,7 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
26916
26930
|
const rows = _nullishCoalesce(num(tbl2.getAttribute("rowCnt")), () => ( 0));
|
|
26917
26931
|
const cols = _nullishCoalesce(num(tbl2.getAttribute("colCnt")), () => ( 0));
|
|
26918
26932
|
const sz = findChildByLocalName(tbl2, "sz");
|
|
26919
|
-
const width = _optionalChain([sz, 'optionalAccess',
|
|
26933
|
+
const width = _optionalChain([sz, 'optionalAccess', _445 => _445.getAttribute, 'call', _446 => _446("width")]) || void 0;
|
|
26920
26934
|
const cells = [];
|
|
26921
26935
|
const usedBf = /* @__PURE__ */ new Set();
|
|
26922
26936
|
const usedCp = /* @__PURE__ */ new Set();
|
|
@@ -26929,17 +26943,17 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
26929
26943
|
const addr = findChildByLocalName(tc2, "cellAddr");
|
|
26930
26944
|
const span = findChildByLocalName(tc2, "cellSpan");
|
|
26931
26945
|
const csz = findChildByLocalName(tc2, "cellSz");
|
|
26932
|
-
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
26933
|
-
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
26946
|
+
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _447 => _447.getAttribute, 'call', _448 => _448("rowAddr")])), () => ( 0));
|
|
26947
|
+
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _449 => _449.getAttribute, 'call', _450 => _450("colAddr")])), () => ( 0));
|
|
26934
26948
|
if (row === 0 && col === 0 && !anchorText) anchorText = directCellText(tc2);
|
|
26935
26949
|
if (row === 0) row0Texts.set(col, directCellText(tc2));
|
|
26936
|
-
const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess',
|
|
26937
|
-
const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess',
|
|
26950
|
+
const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _451 => _451.getAttribute, 'call', _452 => _452("colSpan")])), () => ( 1));
|
|
26951
|
+
const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _453 => _453.getAttribute, 'call', _454 => _454("rowSpan")])), () => ( 1));
|
|
26938
26952
|
const bfId = tc2.getAttribute("borderFillIDRef") || void 0;
|
|
26939
26953
|
const cpId = firstRunCharPr(tc2);
|
|
26940
26954
|
const cell2 = { row, col, rowSpan, colSpan };
|
|
26941
|
-
const w = _optionalChain([csz, 'optionalAccess',
|
|
26942
|
-
const hh = _optionalChain([csz, 'optionalAccess',
|
|
26955
|
+
const w = _optionalChain([csz, 'optionalAccess', _455 => _455.getAttribute, 'call', _456 => _456("width")]);
|
|
26956
|
+
const hh = _optionalChain([csz, 'optionalAccess', _457 => _457.getAttribute, 'call', _458 => _458("height")]);
|
|
26943
26957
|
if (w) cell2.width_hwpunit = w;
|
|
26944
26958
|
if (hh) cell2.height_hwpunit = hh;
|
|
26945
26959
|
if (bfId) {
|
|
@@ -27027,16 +27041,16 @@ function pick(map, keys) {
|
|
|
27027
27041
|
return out;
|
|
27028
27042
|
}
|
|
27029
27043
|
async function hwpxToProfile(input) {
|
|
27030
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
27044
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkDZBMQC2Ncjs.toArrayBuffer.call(void 0, input);
|
|
27031
27045
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
27032
27046
|
const parser = createXmlParser();
|
|
27033
|
-
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access',
|
|
27047
|
+
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _459 => _459.file, 'call', _460 => _460(/[Hh]eader\.xml$/), 'optionalAccess', _461 => _461[0]])));
|
|
27034
27048
|
let headerXml = "<root/>";
|
|
27035
27049
|
if (headerFile) headerXml = await headerFile.async("text");
|
|
27036
27050
|
const headerDoc = parser.parseFromString(headerXml, "text/xml");
|
|
27037
27051
|
const borderFills = parseBorderFills(headerDoc);
|
|
27038
27052
|
const charPrs = parseCharPrs(headerDoc, parseHangulFonts(headerDoc));
|
|
27039
|
-
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access',
|
|
27053
|
+
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _462 => _462.name, 'access', _463 => _463.match, 'call', _464 => _464(/(\d+)\.xml$/), 'optionalAccess', _465 => _465[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _466 => _466.name, 'access', _467 => _467.match, 'call', _468 => _468(/(\d+)\.xml$/), 'optionalAccess', _469 => _469[1]]), () => ( null))), () => ( 0))));
|
|
27040
27054
|
const tables = [];
|
|
27041
27055
|
let tableIndex = 0;
|
|
27042
27056
|
for (const f of sectionFiles) {
|
|
@@ -27350,7 +27364,7 @@ var ROW_OBJECT_RE = /<(?:[A-Za-z0-9_]+:)?(?:tbl|pic|equation|ole|container|shape
|
|
|
27350
27364
|
var TAG_AT_RE = /<[A-Za-z0-9_:]+(?:"[^"]*"|'[^']*'|[^>"'])*>/y;
|
|
27351
27365
|
function patchTableRows(input) {
|
|
27352
27366
|
const { table: table2, scanTable, ctx, skip, origKeys, editedKeys } = input;
|
|
27353
|
-
const xml = _optionalChain([ctx, 'access',
|
|
27367
|
+
const xml = _optionalChain([ctx, 'access', _470 => _470.scans, 'access', _471 => _471[scanTable.sectionIndex], 'optionalAccess', _472 => _472.xml]);
|
|
27354
27368
|
if (!xml) return skip("\uC139\uC158 XML \uB9E4\uD551 \uC2E4\uD328");
|
|
27355
27369
|
const numRows = table2.rows;
|
|
27356
27370
|
if (origKeys.length !== numRows) return skip("\uD45C \uD589 \uC88C\uD45C \uBD88\uC77C\uCE58 \u2014 \uD589 \uCD94\uAC00/\uC0AD\uC81C \uBBF8\uC9C0\uC6D0");
|
|
@@ -27517,7 +27531,7 @@ function buildRowFragment(xml, scanTable, template, cells, finalRow, hasExplicit
|
|
|
27517
27531
|
const rr = scanTable.rowRanges[template];
|
|
27518
27532
|
const wrapped = FRAG_OPEN + xml.slice(rr.start, rr.end) + FRAG_CLOSE;
|
|
27519
27533
|
const scan = scanSectionXml(wrapped, 0);
|
|
27520
|
-
const row = _optionalChain([scan, 'access',
|
|
27534
|
+
const row = _optionalChain([scan, 'access', _473 => _473.tables, 'access', _474 => _474[0], 'optionalAccess', _475 => _475.rows, 'access', _476 => _476[0]]);
|
|
27521
27535
|
if (!row || row.length !== cells.length) return null;
|
|
27522
27536
|
const splices = allLinesegRemovalSplices(wrapped);
|
|
27523
27537
|
for (let i = 0; i < cells.length; i++) {
|
|
@@ -27560,7 +27574,7 @@ function rowHeightOf(fragment) {
|
|
|
27560
27574
|
}
|
|
27561
27575
|
function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
|
|
27562
27576
|
const from = scanTable.start + tblOpenLen;
|
|
27563
|
-
const to = _nullishCoalesce(_optionalChain([scanTable, 'access',
|
|
27577
|
+
const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _477 => _477.rowRanges, 'access', _478 => _478[0], 'optionalAccess', _479 => _479.start]), () => ( from));
|
|
27564
27578
|
const slice = xml.slice(from, to);
|
|
27565
27579
|
const szM = slice.match(/<(?:[A-Za-z0-9_]+:)?sz\b(?:"[^"]*"|'[^']*'|[^>"'])*>/);
|
|
27566
27580
|
if (!szM || szM.index === void 0) return null;
|
|
@@ -27749,9 +27763,9 @@ function patchHtmlTableRows(table2, scanTable, replica, editedRows, ctx, skip, d
|
|
|
27749
27763
|
});
|
|
27750
27764
|
}
|
|
27751
27765
|
function patchNestedTables(table2, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
|
|
27752
|
-
const irCell = _optionalChain([table2, 'access',
|
|
27766
|
+
const irCell = _optionalChain([table2, 'access', _480 => _480.cells, 'access', _481 => _481[oc.gridR], 'optionalAccess', _482 => _482[oc.gridC]]);
|
|
27753
27767
|
const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
|
|
27754
|
-
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess',
|
|
27768
|
+
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _483 => _483.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
|
|
27755
27769
|
if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
|
|
27756
27770
|
return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
|
|
27757
27771
|
}
|
|
@@ -27819,7 +27833,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
27819
27833
|
};
|
|
27820
27834
|
const cell2 = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
|
|
27821
27835
|
if (!cell2) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
|
|
27822
|
-
const irCell = _optionalChain([table2, 'access',
|
|
27836
|
+
const irCell = _optionalChain([table2, 'access', _484 => _484.cells, 'access', _485 => _485[gridR], 'optionalAccess', _486 => _486[gridC]]);
|
|
27823
27837
|
const scanJoined = cell2.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
|
|
27824
27838
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
27825
27839
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -27843,7 +27857,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
27843
27857
|
const target = cell2.paragraphs[0];
|
|
27844
27858
|
if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
|
|
27845
27859
|
const value = newLines.join(" ");
|
|
27846
|
-
const xml = _optionalChain([ctx, 'access',
|
|
27860
|
+
const xml = _optionalChain([ctx, 'access', _487 => _487.scans, 'access', _488 => _488[target.sectionIndex], 'optionalAccess', _489 => _489.xml]);
|
|
27847
27861
|
const rawT = xml ? paraTText(target, xml) : null;
|
|
27848
27862
|
let sp;
|
|
27849
27863
|
if (xml && rawT === null) {
|
|
@@ -27877,7 +27891,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
27877
27891
|
}
|
|
27878
27892
|
for (let i = 0; i < nonEmpty.length; i++) {
|
|
27879
27893
|
if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
|
|
27880
|
-
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access',
|
|
27894
|
+
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _490 => _490.scans, 'access', _491 => _491[nonEmpty[i].sectionIndex], 'optionalAccess', _492 => _492.xml]));
|
|
27881
27895
|
if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
27882
27896
|
splices.push(...sp);
|
|
27883
27897
|
sectionIndex = nonEmpty[i].sectionIndex;
|
|
@@ -27958,7 +27972,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
27958
27972
|
const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
27959
27973
|
if (paths.length > 0) return paths;
|
|
27960
27974
|
}
|
|
27961
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
27975
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkDZBMQC2Ncjs.compareSectionPaths);
|
|
27962
27976
|
}
|
|
27963
27977
|
function sectionPathsFromManifest(xml) {
|
|
27964
27978
|
const attr = (tag, name) => {
|
|
@@ -27968,7 +27982,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
27968
27982
|
const idToHref = /* @__PURE__ */ new Map();
|
|
27969
27983
|
for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
|
|
27970
27984
|
const id = attr(m[1], "id");
|
|
27971
|
-
const href =
|
|
27985
|
+
const href = _chunkDZBMQC2Ncjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
|
|
27972
27986
|
if (id && href) idToHref.set(id, href);
|
|
27973
27987
|
}
|
|
27974
27988
|
const ordered = [];
|
|
@@ -27977,7 +27991,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
27977
27991
|
if (href) ordered.push(href);
|
|
27978
27992
|
}
|
|
27979
27993
|
if (ordered.length > 0) return ordered;
|
|
27980
|
-
return Array.from(idToHref.values()).sort(
|
|
27994
|
+
return Array.from(idToHref.values()).sort(_chunkDZBMQC2Ncjs.compareSectionPaths);
|
|
27981
27995
|
}
|
|
27982
27996
|
|
|
27983
27997
|
// src/roundtrip/patcher.ts
|
|
@@ -28069,7 +28083,7 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
28069
28083
|
}
|
|
28070
28084
|
}
|
|
28071
28085
|
let verification;
|
|
28072
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
28086
|
+
if (_optionalChain([options, 'optionalAccess', _493 => _493.verify]) !== false) {
|
|
28073
28087
|
try {
|
|
28074
28088
|
const reparsed = await parseHwpxDocument(u8ToArrayBuffer(data));
|
|
28075
28089
|
verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
|
|
@@ -28087,17 +28101,17 @@ function buildOrigUnits(blocks) {
|
|
|
28087
28101
|
let chunk;
|
|
28088
28102
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
28089
28103
|
const next = blocks[i + 1];
|
|
28090
|
-
if (_optionalChain([next, 'optionalAccess',
|
|
28091
|
-
chunk =
|
|
28104
|
+
if (_optionalChain([next, 'optionalAccess', _494 => _494.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
28105
|
+
chunk = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
28092
28106
|
} else {
|
|
28093
|
-
chunk =
|
|
28107
|
+
chunk = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, [block]);
|
|
28094
28108
|
}
|
|
28095
28109
|
if (chunk) {
|
|
28096
28110
|
const subUnits = splitMarkdownUnits(chunk);
|
|
28097
28111
|
const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
|
|
28098
28112
|
for (let s = 0; s < subUnits.length; s++) {
|
|
28099
28113
|
const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
|
|
28100
|
-
if (block.type === "table" && _optionalChain([block, 'access',
|
|
28114
|
+
if (block.type === "table" && _optionalChain([block, 'access', _495 => _495.table, 'optionalAccess', _496 => _496.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
|
|
28101
28115
|
u.role = "caption";
|
|
28102
28116
|
}
|
|
28103
28117
|
units.push(u);
|
|
@@ -28208,7 +28222,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
28208
28222
|
const ti = ctx.tableInsert;
|
|
28209
28223
|
if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
|
|
28210
28224
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
28211
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
28225
|
+
if (!_optionalChain([mapping, 'optionalAccess', _497 => _497.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED) \u2014 \uD45C \uBCC0\uD658 \uBD88\uAC00");
|
|
28212
28226
|
const para2 = mapping.para;
|
|
28213
28227
|
if (para2.kind !== "body") return skip("\uBCF8\uBB38 \uC678 \uC601\uC5ED(\uD45C \uC140/\uAE00\uC0C1\uC790) \uBB38\uB2E8\uC758 \uD45C \uBCC0\uD658\uC740 \uBBF8\uC9C0\uC6D0");
|
|
28214
28228
|
const scan = ctx.scans[para2.sectionIndex];
|
|
@@ -28236,7 +28250,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
28236
28250
|
}
|
|
28237
28251
|
function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
28238
28252
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
28239
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
28253
|
+
if (!_optionalChain([mapping, 'optionalAccess', _498 => _498.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
|
|
28240
28254
|
if (block.text && block.text.includes("\n")) {
|
|
28241
28255
|
return skip("\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)");
|
|
28242
28256
|
}
|
|
@@ -28267,7 +28281,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
28267
28281
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
28268
28282
|
return skip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uD328\uCE58 \uC2DC \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
|
|
28269
28283
|
}
|
|
28270
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access',
|
|
28284
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _499 => _499.scans, 'access', _500 => _500[mapping.para.sectionIndex], 'optionalAccess', _501 => _501.xml]));
|
|
28271
28285
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
28272
28286
|
ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
28273
28287
|
return 1;
|
|
@@ -28459,7 +28473,7 @@ var Surgeon = (_class7 = class {
|
|
|
28459
28473
|
/** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
|
|
28460
28474
|
findEntry(path) {
|
|
28461
28475
|
const parts = path.replace(/^\//, "").split("/");
|
|
28462
|
-
let scope = _nullishCoalesce(_optionalChain([this, 'access',
|
|
28476
|
+
let scope = _nullishCoalesce(_optionalChain([this, 'access', _502 => _502.entries, 'access', _503 => _503[0], 'optionalAccess', _504 => _504.child]), () => ( -1));
|
|
28463
28477
|
let current;
|
|
28464
28478
|
for (const part of parts) {
|
|
28465
28479
|
const search = (idx) => {
|
|
@@ -28712,8 +28726,8 @@ function serializeRecords(recs, repl, inserts) {
|
|
|
28712
28726
|
parts.push(header, data);
|
|
28713
28727
|
};
|
|
28714
28728
|
for (let i = 0; i < recs.length; i++) {
|
|
28715
|
-
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess',
|
|
28716
|
-
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess',
|
|
28729
|
+
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _505 => _505.get, 'call', _506 => _506(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
|
|
28730
|
+
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _507 => _507.get, 'call', _508 => _508(i)]), () => ( recs[i].data)));
|
|
28717
28731
|
}
|
|
28718
28732
|
return Buffer.concat(parts);
|
|
28719
28733
|
}
|
|
@@ -28831,7 +28845,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
28831
28845
|
return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
|
|
28832
28846
|
}
|
|
28833
28847
|
const fhEntry = CFB2.find(cfb, "/FileHeader");
|
|
28834
|
-
if (!_optionalChain([fhEntry, 'optionalAccess',
|
|
28848
|
+
if (!_optionalChain([fhEntry, 'optionalAccess', _509 => _509.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
|
|
28835
28849
|
let flags;
|
|
28836
28850
|
try {
|
|
28837
28851
|
flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
|
|
@@ -28853,7 +28867,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
28853
28867
|
const scans = [];
|
|
28854
28868
|
for (let i = 0; i < sectionPaths.length; i++) {
|
|
28855
28869
|
const entry = CFB2.find(cfb, sectionPaths[i]);
|
|
28856
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
28870
|
+
if (!_optionalChain([entry, 'optionalAccess', _510 => _510.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
|
|
28857
28871
|
let stream;
|
|
28858
28872
|
try {
|
|
28859
28873
|
stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
@@ -28904,7 +28918,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
28904
28918
|
}
|
|
28905
28919
|
}
|
|
28906
28920
|
let verification;
|
|
28907
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
28921
|
+
if (_optionalChain([options, 'optionalAccess', _511 => _511.verify]) !== false) {
|
|
28908
28922
|
try {
|
|
28909
28923
|
const reparsed = parseHwp5Document(Buffer.from(data));
|
|
28910
28924
|
const normBr = (u) => ({ ...u, raw: u.raw.replace(/<br\s*\/?\s*>/gi, "\n") });
|
|
@@ -28994,7 +29008,7 @@ function tableContentScore(irTable, scanTable) {
|
|
|
28994
29008
|
for (const [key, scanCell] of scanTable.cells) {
|
|
28995
29009
|
const comma = key.indexOf(",");
|
|
28996
29010
|
const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
|
|
28997
|
-
const irCell = _optionalChain([irTable, 'access',
|
|
29011
|
+
const irCell = _optionalChain([irTable, 'access', _512 => _512.cells, 'access', _513 => _513[r], 'optionalAccess', _514 => _514[c]]);
|
|
28998
29012
|
if (!irCell) continue;
|
|
28999
29013
|
const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
|
|
29000
29014
|
const b = normForMatch(stripCellTokens(irCell.text));
|
|
@@ -29030,7 +29044,7 @@ function handleModified(orig, edited, ctx) {
|
|
|
29030
29044
|
}
|
|
29031
29045
|
function patchParagraph(block, orig, edited, ctx, skip) {
|
|
29032
29046
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
29033
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
29047
|
+
if (!_optionalChain([mapping, 'optionalAccess', _515 => _515.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
|
|
29034
29048
|
const restoreBr = (s) => s.replace(/(?:\s*<br\s*\/?\s*>\s*)+/gi, "\n");
|
|
29035
29049
|
let newPlain = restoreBr(textUnitToPlain(edited.raw, block));
|
|
29036
29050
|
if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
|
|
@@ -29229,7 +29243,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before,
|
|
|
29229
29243
|
};
|
|
29230
29244
|
const cell2 = scanTable.cells.get(`${gridR},${gridC}`);
|
|
29231
29245
|
if (!cell2) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
|
|
29232
|
-
const irCell = _optionalChain([table2, 'access',
|
|
29246
|
+
const irCell = _optionalChain([table2, 'access', _516 => _516.cells, 'access', _517 => _517[gridR], 'optionalAccess', _518 => _518[gridC]]);
|
|
29233
29247
|
const scanJoined = cell2.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
|
|
29234
29248
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
29235
29249
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -29636,11 +29650,11 @@ var RULES2 = {
|
|
|
29636
29650
|
}
|
|
29637
29651
|
};
|
|
29638
29652
|
function redactText(text, options) {
|
|
29639
|
-
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29653
|
+
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _519 => _519.maskChar]), () => ( "\u25CF"));
|
|
29640
29654
|
if (maskChar.length !== 1 || /[0-9A-Za-z]/.test(maskChar)) {
|
|
29641
29655
|
throw new Error(`maskChar\uB294 \uC601\uC22B\uC790\uAC00 \uC544\uB2CC 1\uAE00\uC790\uC5EC\uC57C \uD568: ${JSON.stringify(maskChar)}`);
|
|
29642
29656
|
}
|
|
29643
|
-
const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29657
|
+
const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _520 => _520.rules]), () => ( DEFAULT_REDACT_RULES));
|
|
29644
29658
|
const hits = [];
|
|
29645
29659
|
if (text === "" || enabled.length === 0) return { text, hits };
|
|
29646
29660
|
const occupied = [];
|
|
@@ -29695,8 +29709,8 @@ function sameBreadcrumb(a, b) {
|
|
|
29695
29709
|
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
29696
29710
|
}
|
|
29697
29711
|
function blocksToChunks(blocks, options) {
|
|
29698
|
-
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29699
|
-
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29712
|
+
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _521 => _521.granularity]), () => ( "section"));
|
|
29713
|
+
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _522 => _522.includeTableCells]), () => ( false));
|
|
29700
29714
|
const chunks = [];
|
|
29701
29715
|
const headingStack = [];
|
|
29702
29716
|
const listStack = [];
|
|
@@ -29710,12 +29724,12 @@ function blocksToChunks(blocks, options) {
|
|
|
29710
29724
|
let run = null;
|
|
29711
29725
|
const flushRun = () => {
|
|
29712
29726
|
if (!run) return;
|
|
29713
|
-
push("text", run.breadcrumb,
|
|
29727
|
+
push("text", run.breadcrumb, _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
|
|
29714
29728
|
run = null;
|
|
29715
29729
|
};
|
|
29716
29730
|
for (let i = 0; i < blocks.length; i++) {
|
|
29717
29731
|
const block = blocks[i];
|
|
29718
|
-
const md2 =
|
|
29732
|
+
const md2 = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, [block]);
|
|
29719
29733
|
if (!md2) continue;
|
|
29720
29734
|
if (block.type === "heading") {
|
|
29721
29735
|
flushRun();
|
|
@@ -29831,7 +29845,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29831
29845
|
const block = st.blocks[blockIndex];
|
|
29832
29846
|
if (!block) return void 0;
|
|
29833
29847
|
if (block.type === "paragraph" || block.type === "heading") {
|
|
29834
|
-
const para2 = _optionalChain([st, 'access',
|
|
29848
|
+
const para2 = _optionalChain([st, 'access', _523 => _523.paraMap, 'access', _524 => _524.get, 'call', _525 => _525(blockIndex), 'optionalAccess', _526 => _526.para]);
|
|
29835
29849
|
if (!para2) return void 0;
|
|
29836
29850
|
return { kind: "paragraph", sectionIndex: para2.sectionIndex, xmlStart: para2.start };
|
|
29837
29851
|
}
|
|
@@ -29856,7 +29870,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29856
29870
|
if (block.text && block.text.includes("\n")) {
|
|
29857
29871
|
return { capability: "locked", reason: "\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)" };
|
|
29858
29872
|
}
|
|
29859
|
-
if (!_optionalChain([st, 'access',
|
|
29873
|
+
if (!_optionalChain([st, 'access', _527 => _527.paraMap, 'access', _528 => _528.get, 'call', _529 => _529(blockIndex), 'optionalAccess', _530 => _530.para])) {
|
|
29860
29874
|
return { capability: "locked", reason: "\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)" };
|
|
29861
29875
|
}
|
|
29862
29876
|
return { capability: "text" };
|
|
@@ -29922,7 +29936,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29922
29936
|
continue;
|
|
29923
29937
|
}
|
|
29924
29938
|
if (block.type === "table" && block.table) {
|
|
29925
|
-
if (!_optionalChain([edit, 'access',
|
|
29939
|
+
if (!_optionalChain([edit, 'access', _531 => _531.cells, 'optionalAccess', _532 => _532.length])) {
|
|
29926
29940
|
skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
|
|
29927
29941
|
continue;
|
|
29928
29942
|
}
|
|
@@ -29942,7 +29956,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29942
29956
|
skipped.push({ reason: "\uAC19\uC740 \uC140\uC5D0 \uC911\uBCF5 \uD3B8\uC9D1 \u2014 \uBA3C\uC800 \uC801\uC6A9\uB41C \uD3B8\uC9D1 \uC720\uC9C0", after: summarize(cellEdit.text) });
|
|
29943
29957
|
continue;
|
|
29944
29958
|
}
|
|
29945
|
-
const irCell = _optionalChain([block, 'access',
|
|
29959
|
+
const irCell = _optionalChain([block, 'access', _533 => _533.table, 'access', _534 => _534.cells, 'access', _535 => _535[cellEdit.row], 'optionalAccess', _536 => _536[cellEdit.col]]);
|
|
29946
29960
|
if (!irCell) {
|
|
29947
29961
|
skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
|
|
29948
29962
|
continue;
|
|
@@ -29998,7 +30012,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29998
30012
|
}
|
|
29999
30013
|
if (replacements.size === 0) {
|
|
30000
30014
|
let changes2;
|
|
30001
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
30015
|
+
if (_optionalChain([options, 'optionalAccess', _537 => _537.verify]) !== false) {
|
|
30002
30016
|
const units = splitMarkdownUnits(st.markdown);
|
|
30003
30017
|
changes2 = diffUnitLists(units, units);
|
|
30004
30018
|
}
|
|
@@ -30019,7 +30033,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30019
30033
|
}
|
|
30020
30034
|
this.state = newState;
|
|
30021
30035
|
let changes;
|
|
30022
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
30036
|
+
if (_optionalChain([options, 'optionalAccess', _538 => _538.verify]) !== false) {
|
|
30023
30037
|
changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
|
|
30024
30038
|
}
|
|
30025
30039
|
return { success: true, data: new Uint8Array(data), applied, skipped, changes };
|
|
@@ -30039,7 +30053,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30039
30053
|
return skip("\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)");
|
|
30040
30054
|
}
|
|
30041
30055
|
const mapping = st.paraMap.get(blockIndex);
|
|
30042
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
30056
|
+
if (!_optionalChain([mapping, 'optionalAccess', _539 => _539.para])) {
|
|
30043
30057
|
return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
|
|
30044
30058
|
}
|
|
30045
30059
|
let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
@@ -30059,14 +30073,14 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30059
30073
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
30060
30074
|
return skip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uD328\uCE58 \uC2DC \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
|
|
30061
30075
|
}
|
|
30062
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access',
|
|
30076
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _540 => _540.scans, 'access', _541 => _541[mapping.para.sectionIndex], 'optionalAccess', _542 => _542.xml]));
|
|
30063
30077
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
30064
30078
|
sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
30065
30079
|
return 1;
|
|
30066
30080
|
}
|
|
30067
30081
|
}, _class8);
|
|
30068
30082
|
function cellStaticCheck(table2, scanTable, r, c) {
|
|
30069
|
-
const irCell = _optionalChain([table2, 'access',
|
|
30083
|
+
const irCell = _optionalChain([table2, 'access', _543 => _543.cells, 'access', _544 => _544[r], 'optionalAccess', _545 => _545[c]]);
|
|
30070
30084
|
if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
|
|
30071
30085
|
const cell2 = scanTable.cellByAnchor.get(`${r},${c}`);
|
|
30072
30086
|
if (!cell2) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
|
|
@@ -30150,11 +30164,11 @@ var md = new (0, _markdownit2.default)({
|
|
|
30150
30164
|
breaks: false
|
|
30151
30165
|
});
|
|
30152
30166
|
function renderHtml(markdown, options) {
|
|
30153
|
-
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30154
|
-
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30167
|
+
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _546 => _546.preset]), () => ( "default"));
|
|
30168
|
+
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _547 => _547.extraCss]), () => ( "")));
|
|
30155
30169
|
const body = md.render(markdown);
|
|
30156
|
-
const watermark = _optionalChain([options, 'optionalAccess',
|
|
30157
|
-
const watermarkCss = _optionalChain([options, 'optionalAccess',
|
|
30170
|
+
const watermark = _optionalChain([options, 'optionalAccess', _548 => _548.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
|
|
30171
|
+
const watermarkCss = _optionalChain([options, 'optionalAccess', _549 => _549.watermark]) ? `
|
|
30158
30172
|
.watermark {
|
|
30159
30173
|
position: fixed;
|
|
30160
30174
|
top: 50%; left: 50%;
|
|
@@ -30185,13 +30199,13 @@ async function htmlToPdf(html, options) {
|
|
|
30185
30199
|
try {
|
|
30186
30200
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
30187
30201
|
} catch (e37) {
|
|
30188
|
-
throw new (0,
|
|
30202
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
30189
30203
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
30190
30204
|
);
|
|
30191
30205
|
}
|
|
30192
30206
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
30193
30207
|
if (!executablePath) {
|
|
30194
|
-
throw new (0,
|
|
30208
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
30195
30209
|
"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."
|
|
30196
30210
|
);
|
|
30197
30211
|
}
|
|
@@ -30203,10 +30217,10 @@ async function htmlToPdf(html, options) {
|
|
|
30203
30217
|
try {
|
|
30204
30218
|
const page = await browser.newPage();
|
|
30205
30219
|
await page.setContent(html, { waitUntil: "networkidle0" });
|
|
30206
|
-
const margin = _optionalChain([options, 'optionalAccess',
|
|
30220
|
+
const margin = _optionalChain([options, 'optionalAccess', _550 => _550.margin]);
|
|
30207
30221
|
const pdf = await page.pdf({
|
|
30208
|
-
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30209
|
-
landscape: _optionalChain([options, 'optionalAccess',
|
|
30222
|
+
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _551 => _551.pageSize]), () => ( "A4")),
|
|
30223
|
+
landscape: _optionalChain([options, 'optionalAccess', _552 => _552.orientation]) === "landscape",
|
|
30210
30224
|
printBackground: true,
|
|
30211
30225
|
margin: margin ? {
|
|
30212
30226
|
top: toCss(margin.top),
|
|
@@ -30214,9 +30228,9 @@ async function htmlToPdf(html, options) {
|
|
|
30214
30228
|
bottom: toCss(margin.bottom),
|
|
30215
30229
|
left: toCss(margin.left)
|
|
30216
30230
|
} : void 0,
|
|
30217
|
-
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess',
|
|
30218
|
-
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30219
|
-
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30231
|
+
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _553 => _553.header]) || _optionalChain([options, 'optionalAccess', _554 => _554.footer])),
|
|
30232
|
+
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _555 => _555.header]), () => ( "<div></div>")),
|
|
30233
|
+
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _556 => _556.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
|
|
30220
30234
|
});
|
|
30221
30235
|
return Buffer.from(pdf);
|
|
30222
30236
|
} finally {
|
|
@@ -30250,7 +30264,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
30250
30264
|
return htmlToPdf(html, options);
|
|
30251
30265
|
}
|
|
30252
30266
|
async function blocksToPdf(blocks, options) {
|
|
30253
|
-
const markdown =
|
|
30267
|
+
const markdown = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
30254
30268
|
return markdownToPdf(markdown, options);
|
|
30255
30269
|
}
|
|
30256
30270
|
|
|
@@ -30429,7 +30443,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode) {
|
|
|
30429
30443
|
}
|
|
30430
30444
|
const wrapAttr = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( ""));
|
|
30431
30445
|
if (wrapAttr === "BEHIND_TEXT" || wrapAttr === "IN_FRONT_OF_TEXT") continue;
|
|
30432
|
-
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
30446
|
+
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _557 => _557.getAttribute, 'call', _558 => _558("vertRelTo")]), () => ( "PARA"));
|
|
30433
30447
|
if (vertRel === "PAGE" || vertRel === "PAPER") continue;
|
|
30434
30448
|
const vo = Math.max(0, num2(pos, "vertOffset"));
|
|
30435
30449
|
if (wrapAttr === "TOP_AND_BOTTOM") {
|
|
@@ -30490,7 +30504,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
30490
30504
|
if (ln(p) !== "p") continue;
|
|
30491
30505
|
reflowTablesIn(p, doc, styles, mode, counter);
|
|
30492
30506
|
const g = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
|
|
30493
|
-
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess',
|
|
30507
|
+
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _559 => _559.spaceBefore]), () => ( 0)));
|
|
30494
30508
|
const res = reflowPara(p, doc, styles, areaW, startV, mode);
|
|
30495
30509
|
if (!res) {
|
|
30496
30510
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
@@ -30503,7 +30517,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
30503
30517
|
}
|
|
30504
30518
|
if (Number.isFinite(bottom)) {
|
|
30505
30519
|
cursorV = bottom;
|
|
30506
|
-
prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess',
|
|
30520
|
+
prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess', _560 => _560.spaceAfter]), () => ( 0));
|
|
30507
30521
|
}
|
|
30508
30522
|
}
|
|
30509
30523
|
continue;
|
|
@@ -30609,7 +30623,7 @@ function buildPara(p) {
|
|
|
30609
30623
|
const pos = findChildByLocalName(ch, "pos");
|
|
30610
30624
|
const w = num3(sz, "width") || num3(findChildByLocalName(ch, "curSz"), "width") || num3(findChildByLocalName(ch, "orgSz"), "width");
|
|
30611
30625
|
const h = num3(sz, "height") || num3(findChildByLocalName(ch, "curSz"), "height") || num3(findChildByLocalName(ch, "orgSz"), "height");
|
|
30612
|
-
const inline = _optionalChain([pos, 'optionalAccess',
|
|
30626
|
+
const inline = _optionalChain([pos, 'optionalAccess', _561 => _561.getAttribute, 'call', _562 => _562("treatAsChar")]) === "1";
|
|
30613
30627
|
const om = inline && cn === "tbl" ? findChildByLocalName(ch, "outMargin") : null;
|
|
30614
30628
|
objs.push({
|
|
30615
30629
|
el: ch,
|
|
@@ -30869,15 +30883,15 @@ function drawShape(o, x, y, ctx, depth) {
|
|
|
30869
30883
|
const sx = ow > 0 ? w / ow : 1;
|
|
30870
30884
|
const sy = oh > 0 ? h / oh : 1;
|
|
30871
30885
|
const lineShape = findChildByLocalName(el, "lineShape");
|
|
30872
|
-
const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess',
|
|
30873
|
-
const strokeCol = _optionalChain([lineShape, 'optionalAccess',
|
|
30886
|
+
const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _563 => _563.getAttribute, 'call', _564 => _564("style")]), () => ( "SOLID"));
|
|
30887
|
+
const strokeCol = _optionalChain([lineShape, 'optionalAccess', _565 => _565.getAttribute, 'call', _566 => _566("color")]) || "#000000";
|
|
30874
30888
|
const hasStroke = lstyle !== "NONE";
|
|
30875
30889
|
const strokeW = hasStroke ? shapeStrokePt(lineShape ? num3(lineShape, "width") : 33) : 0;
|
|
30876
30890
|
const dash = /DASH|DOT/.test(lstyle) ? ` stroke-dasharray="${lstyle.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
30877
30891
|
const strokeAttr = hasStroke ? ` stroke="${escapeXml3(strokeCol)}" stroke-width="${strokeW.toFixed(2)}"${dash}` : "";
|
|
30878
30892
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
30879
30893
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
30880
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
30894
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _567 => _567.getAttribute, 'call', _568 => _568("faceColor")]);
|
|
30881
30895
|
const fill = face && face.toLowerCase() !== "none" ? face : "none";
|
|
30882
30896
|
const fillAttr = ` fill="${fill === "none" ? "none" : escapeXml3(fill)}"`;
|
|
30883
30897
|
if (o.tag === "rect") {
|
|
@@ -30904,14 +30918,14 @@ function drawShape(o, x, y, ctx, depth) {
|
|
|
30904
30918
|
}
|
|
30905
30919
|
function cellContentExtent(cell2, memo) {
|
|
30906
30920
|
if (!cell2.sub) return 0;
|
|
30907
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
30921
|
+
const hit = _optionalChain([memo, 'optionalAccess', _569 => _569.cell, 'access', _570 => _570.get, 'call', _571 => _571(cell2.el)]);
|
|
30908
30922
|
if (hit !== void 0) return hit;
|
|
30909
30923
|
let ext = 0;
|
|
30910
30924
|
for (const p of elements2(cell2.sub)) {
|
|
30911
30925
|
if (ln2(p) !== "p") continue;
|
|
30912
30926
|
const m = buildPara(p);
|
|
30913
30927
|
for (const s of m.segs) ext = Math.max(ext, s.vertpos + s.textheight);
|
|
30914
|
-
const baseV = _nullishCoalesce(_optionalChain([m, 'access',
|
|
30928
|
+
const baseV = _nullishCoalesce(_optionalChain([m, 'access', _572 => _572.segs, 'access', _573 => _573[0], 'optionalAccess', _574 => _574.vertpos]), () => ( 0));
|
|
30915
30929
|
for (const o of m.objs) {
|
|
30916
30930
|
if (o.inline) {
|
|
30917
30931
|
const h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
|
|
@@ -30919,14 +30933,14 @@ function cellContentExtent(cell2, memo) {
|
|
|
30919
30933
|
continue;
|
|
30920
30934
|
}
|
|
30921
30935
|
const pos = findChildByLocalName(o.el, "pos");
|
|
30922
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
30936
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _575 => _575.getAttribute, 'call', _576 => _576("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
30923
30937
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
30924
30938
|
const pushed = baseV - (num3(om, "top") + o.height + num3(om, "bottom"));
|
|
30925
30939
|
const anchor = pushed >= -100 ? pushed : baseV;
|
|
30926
30940
|
ext = Math.max(ext, anchor + num3(om, "top") + num3(pos, "vertOffset") + o.height);
|
|
30927
30941
|
}
|
|
30928
30942
|
}
|
|
30929
|
-
_optionalChain([memo, 'optionalAccess',
|
|
30943
|
+
_optionalChain([memo, 'optionalAccess', _577 => _577.cell, 'access', _578 => _578.set, 'call', _579 => _579(cell2.el, ext)]);
|
|
30930
30944
|
return ext;
|
|
30931
30945
|
}
|
|
30932
30946
|
function edgeLine(x1, y1, x2, y2, e) {
|
|
@@ -30968,7 +30982,7 @@ function collectCells(tbl2) {
|
|
|
30968
30982
|
return cells;
|
|
30969
30983
|
}
|
|
30970
30984
|
function measureTableHeight(tbl2, memo) {
|
|
30971
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
30985
|
+
const hit = _optionalChain([memo, 'optionalAccess', _580 => _580.table, 'access', _581 => _581.get, 'call', _582 => _582(tbl2)]);
|
|
30972
30986
|
if (hit !== void 0) return hit;
|
|
30973
30987
|
const cells = collectCells(tbl2);
|
|
30974
30988
|
if (cells.length === 0 || cells.length > 4096) return 0;
|
|
@@ -30979,7 +30993,7 @@ function measureTableHeight(tbl2, memo) {
|
|
|
30979
30993
|
);
|
|
30980
30994
|
let sum = 0;
|
|
30981
30995
|
for (const h of rowH) sum += h;
|
|
30982
|
-
_optionalChain([memo, 'optionalAccess',
|
|
30996
|
+
_optionalChain([memo, 'optionalAccess', _583 => _583.table, 'access', _584 => _584.set, 'call', _585 => _585(tbl2, sum)]);
|
|
30983
30997
|
return sum;
|
|
30984
30998
|
}
|
|
30985
30999
|
function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
@@ -31010,7 +31024,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
31010
31024
|
}));
|
|
31011
31025
|
for (const g of geom) {
|
|
31012
31026
|
const bf = g.c.bfId != null ? ctx.styles.borderFill.get(g.c.bfId) : void 0;
|
|
31013
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
31027
|
+
if (_optionalChain([bf, 'optionalAccess', _586 => _586.fill])) emit(ctx, `<rect x="${pt(g.x)}" y="${pt(g.y)}" width="${pt(g.w)}" height="${pt(g.h)}" fill="${escapeXml3(bf.fill)}"/>`);
|
|
31014
31028
|
}
|
|
31015
31029
|
for (const g of geom) {
|
|
31016
31030
|
const { c } = g;
|
|
@@ -31048,7 +31062,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
31048
31062
|
const sz = findChildByLocalName(pic, "sz");
|
|
31049
31063
|
const w = num3(sz, "width", 5669), h = num3(sz, "height", 5669);
|
|
31050
31064
|
const img = findFirst(pic, "img");
|
|
31051
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
31065
|
+
const ref = _optionalChain([img, 'optionalAccess', _587 => _587.getAttribute, 'call', _588 => _588("binaryItemIDRef")]);
|
|
31052
31066
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
31053
31067
|
if (!loaded) {
|
|
31054
31068
|
emit(ctx, `<rect x="${pt(x)}" y="${pt(y)}" width="${pt(w)}" height="${pt(h)}" fill="#eee" stroke="#c00" stroke-width="0.5"/>`);
|
|
@@ -31088,7 +31102,7 @@ function readSectionGeom(root) {
|
|
|
31088
31102
|
const pagePr = findFirst(root, "pagePr");
|
|
31089
31103
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
31090
31104
|
let PW = num3(pagePr, "width", 59528), PH = num3(pagePr, "height", 84188);
|
|
31091
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
31105
|
+
if (_optionalChain([pagePr, 'optionalAccess', _589 => _589.getAttribute, 'call', _590 => _590("landscape")]) === "NARROWLY" && PW < PH) {
|
|
31092
31106
|
const t = PW;
|
|
31093
31107
|
PW = PH;
|
|
31094
31108
|
PH = t;
|
|
@@ -31146,17 +31160,17 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode) {
|
|
|
31146
31160
|
return { pages: ctx.pages, pageH };
|
|
31147
31161
|
}
|
|
31148
31162
|
async function renderHwpxToSvg(input, options) {
|
|
31149
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
31163
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _591 => _591.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
31150
31164
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
31151
|
-
|
|
31165
|
+
_chunkDZBMQC2Ncjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
31152
31166
|
let zip;
|
|
31153
31167
|
try {
|
|
31154
31168
|
zip = await _jszip2.default.loadAsync(input);
|
|
31155
31169
|
} catch (e38) {
|
|
31156
|
-
throw new (0,
|
|
31170
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
31157
31171
|
}
|
|
31158
31172
|
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
|
|
31159
|
-
if (secFiles.length === 0) throw new (0,
|
|
31173
|
+
if (secFiles.length === 0) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
31160
31174
|
const warnings = [];
|
|
31161
31175
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
31162
31176
|
const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
@@ -31164,7 +31178,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31164
31178
|
const secXmls = [];
|
|
31165
31179
|
for (const f of secFiles) {
|
|
31166
31180
|
const xml = await f.async("string");
|
|
31167
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
31181
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
31168
31182
|
secXmls.push(xml);
|
|
31169
31183
|
}
|
|
31170
31184
|
const binmap = /* @__PURE__ */ new Map();
|
|
@@ -31188,7 +31202,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31188
31202
|
let href = binmap.get(ref);
|
|
31189
31203
|
if (!href) {
|
|
31190
31204
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
31191
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
31205
|
+
href = _optionalChain([cand, 'optionalAccess', _592 => _592.name]);
|
|
31192
31206
|
}
|
|
31193
31207
|
if (!href) continue;
|
|
31194
31208
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -31209,7 +31223,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31209
31223
|
styles,
|
|
31210
31224
|
images,
|
|
31211
31225
|
defs: [],
|
|
31212
|
-
highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
31226
|
+
highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _593 => _593.highlights]), () => ( []))).map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0),
|
|
31213
31227
|
warnings,
|
|
31214
31228
|
warned: /* @__PURE__ */ new Set(),
|
|
31215
31229
|
stats: { texts: 0, images: 0, tables: 0 },
|
|
@@ -31220,7 +31234,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31220
31234
|
for (let si = 0; si < secXmls.length; si++) {
|
|
31221
31235
|
const secXml = secXmls[si];
|
|
31222
31236
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
31223
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
31237
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _594 => _594.reflow])) {
|
|
31224
31238
|
noCacheSkipped = true;
|
|
31225
31239
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
31226
31240
|
continue;
|
|
@@ -31232,14 +31246,14 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31232
31246
|
continue;
|
|
31233
31247
|
}
|
|
31234
31248
|
const geom = readSectionGeom(root);
|
|
31235
|
-
const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess',
|
|
31249
|
+
const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess', _595 => _595.reflow]), _nullishCoalesce(_optionalChain([options, 'optionalAccess', _596 => _596.reflowMode]), () => ( "keep")));
|
|
31236
31250
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${si}` });
|
|
31237
31251
|
}
|
|
31238
31252
|
if (rendered.length === 0) {
|
|
31239
31253
|
if (noCacheSkipped) {
|
|
31240
|
-
throw new (0,
|
|
31254
|
+
throw new (0, _chunkDZBMQC2Ncjs.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)");
|
|
31241
31255
|
}
|
|
31242
|
-
throw new (0,
|
|
31256
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
31243
31257
|
}
|
|
31244
31258
|
const GAP = 2400;
|
|
31245
31259
|
const clipDefs = [];
|
|
@@ -31271,17 +31285,17 @@ ${groups.join("\n")}
|
|
|
31271
31285
|
// src/index.ts
|
|
31272
31286
|
async function parse(input, options) {
|
|
31273
31287
|
let buffer;
|
|
31274
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
31288
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _597 => _597.filePath]) ? { ...options, filePath: input } : options;
|
|
31275
31289
|
if (typeof input === "string") {
|
|
31276
31290
|
try {
|
|
31277
31291
|
const buf = await _promises.readFile.call(void 0, input);
|
|
31278
|
-
buffer =
|
|
31292
|
+
buffer = _chunkDZBMQC2Ncjs.toArrayBuffer.call(void 0, buf);
|
|
31279
31293
|
} catch (err) {
|
|
31280
31294
|
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}`;
|
|
31281
31295
|
return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
|
|
31282
31296
|
}
|
|
31283
31297
|
} else if (Buffer.isBuffer(input)) {
|
|
31284
|
-
buffer =
|
|
31298
|
+
buffer = _chunkDZBMQC2Ncjs.toArrayBuffer.call(void 0, input);
|
|
31285
31299
|
} else {
|
|
31286
31300
|
buffer = input;
|
|
31287
31301
|
}
|
|
@@ -31315,40 +31329,40 @@ async function parse(input, options) {
|
|
|
31315
31329
|
}
|
|
31316
31330
|
async function parseImage(buffer, options) {
|
|
31317
31331
|
try {
|
|
31318
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
31332
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-PRI2JKDW.cjs")));
|
|
31319
31333
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
31320
31334
|
return {
|
|
31321
31335
|
success: true,
|
|
31322
31336
|
fileType: "image",
|
|
31323
|
-
markdown:
|
|
31337
|
+
markdown: _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, blocks),
|
|
31324
31338
|
blocks,
|
|
31325
31339
|
warnings: warnings.length ? warnings : void 0,
|
|
31326
31340
|
pageCount: 1
|
|
31327
31341
|
};
|
|
31328
31342
|
} catch (err) {
|
|
31329
|
-
return { success: false, fileType: "image", error:
|
|
31343
|
+
return { success: false, fileType: "image", error: _chunkDZBMQC2Ncjs.sanitizeError.call(void 0, err), code: _chunkDZBMQC2Ncjs.classifyError.call(void 0, err) };
|
|
31330
31344
|
}
|
|
31331
31345
|
}
|
|
31332
31346
|
async function parseHwp3(buffer, options) {
|
|
31333
31347
|
try {
|
|
31334
31348
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
31335
|
-
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31349
|
+
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _598 => _598.pageCount]) };
|
|
31336
31350
|
} catch (err) {
|
|
31337
|
-
return { success: false, fileType: "hwp3", error:
|
|
31351
|
+
return { success: false, fileType: "hwp3", error: _chunkDZBMQC2Ncjs.sanitizeError.call(void 0, err), code: _chunkDZBMQC2Ncjs.classifyError.call(void 0, err) };
|
|
31338
31352
|
}
|
|
31339
31353
|
}
|
|
31340
31354
|
async function parseHwpx(buffer, options) {
|
|
31341
31355
|
try {
|
|
31342
31356
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
31343
|
-
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
31357
|
+
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _599 => _599.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _600 => _600.pageCount]) };
|
|
31344
31358
|
} catch (err) {
|
|
31345
|
-
return { success: false, fileType: "hwpx", error:
|
|
31359
|
+
return { success: false, fileType: "hwpx", error: _chunkDZBMQC2Ncjs.sanitizeError.call(void 0, err), code: _chunkDZBMQC2Ncjs.classifyError.call(void 0, err) };
|
|
31346
31360
|
}
|
|
31347
31361
|
}
|
|
31348
31362
|
async function parseHwp(buffer, options) {
|
|
31349
31363
|
try {
|
|
31350
31364
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
31351
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
31365
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _601 => _601.filePath])) {
|
|
31352
31366
|
try {
|
|
31353
31367
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
31354
31368
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -31366,15 +31380,15 @@ async function parseHwp(buffer, options) {
|
|
|
31366
31380
|
} catch (e39) {
|
|
31367
31381
|
}
|
|
31368
31382
|
}
|
|
31369
|
-
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
31383
|
+
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _602 => _602.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _603 => _603.pageCount]) };
|
|
31370
31384
|
} catch (err) {
|
|
31371
|
-
return { success: false, fileType: "hwp", error:
|
|
31385
|
+
return { success: false, fileType: "hwp", error: _chunkDZBMQC2Ncjs.sanitizeError.call(void 0, err), code: _chunkDZBMQC2Ncjs.classifyError.call(void 0, err) };
|
|
31372
31386
|
}
|
|
31373
31387
|
}
|
|
31374
31388
|
async function parsePdf(buffer, options) {
|
|
31375
31389
|
let parsePdfDocument;
|
|
31376
31390
|
try {
|
|
31377
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
31391
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-SCQ7NJUJ.cjs")));
|
|
31378
31392
|
parsePdfDocument = mod.parsePdfDocument;
|
|
31379
31393
|
} catch (e40) {
|
|
31380
31394
|
return {
|
|
@@ -31386,51 +31400,51 @@ async function parsePdf(buffer, options) {
|
|
|
31386
31400
|
}
|
|
31387
31401
|
try {
|
|
31388
31402
|
const { markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images } = await parsePdfDocument(buffer, options);
|
|
31389
|
-
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31403
|
+
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pageCount: _optionalChain([metadata, 'optionalAccess', _604 => _604.pageCount]) };
|
|
31390
31404
|
} catch (err) {
|
|
31391
31405
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
31392
|
-
return { success: false, fileType: "pdf", error:
|
|
31406
|
+
return { success: false, fileType: "pdf", error: _chunkDZBMQC2Ncjs.sanitizeError.call(void 0, err), code: _chunkDZBMQC2Ncjs.classifyError.call(void 0, err), isImageBased };
|
|
31393
31407
|
}
|
|
31394
31408
|
}
|
|
31395
31409
|
async function parseXlsx(buffer, options) {
|
|
31396
31410
|
try {
|
|
31397
31411
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
31398
|
-
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31412
|
+
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _605 => _605.pageCount]) };
|
|
31399
31413
|
} catch (err) {
|
|
31400
|
-
return { success: false, fileType: "xlsx", error:
|
|
31414
|
+
return { success: false, fileType: "xlsx", error: _chunkDZBMQC2Ncjs.sanitizeError.call(void 0, err), code: _chunkDZBMQC2Ncjs.classifyError.call(void 0, err) };
|
|
31401
31415
|
}
|
|
31402
31416
|
}
|
|
31403
31417
|
async function parseXls(buffer, options) {
|
|
31404
31418
|
try {
|
|
31405
31419
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
31406
|
-
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31420
|
+
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _606 => _606.pageCount]) };
|
|
31407
31421
|
} catch (err) {
|
|
31408
|
-
return { success: false, fileType: "xls", error:
|
|
31422
|
+
return { success: false, fileType: "xls", error: _chunkDZBMQC2Ncjs.sanitizeError.call(void 0, err), code: _chunkDZBMQC2Ncjs.classifyError.call(void 0, err) };
|
|
31409
31423
|
}
|
|
31410
31424
|
}
|
|
31411
31425
|
async function parseDocx(buffer, options) {
|
|
31412
31426
|
try {
|
|
31413
31427
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
31414
|
-
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
31428
|
+
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _607 => _607.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _608 => _608.pageCount]) };
|
|
31415
31429
|
} catch (err) {
|
|
31416
|
-
return { success: false, fileType: "docx", error:
|
|
31430
|
+
return { success: false, fileType: "docx", error: _chunkDZBMQC2Ncjs.sanitizeError.call(void 0, err), code: _chunkDZBMQC2Ncjs.classifyError.call(void 0, err) };
|
|
31417
31431
|
}
|
|
31418
31432
|
}
|
|
31419
31433
|
async function parseHwpml(buffer, options) {
|
|
31420
31434
|
try {
|
|
31421
31435
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
31422
|
-
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31436
|
+
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _609 => _609.pageCount]) };
|
|
31423
31437
|
} catch (err) {
|
|
31424
|
-
return { success: false, fileType: "hwpml", error:
|
|
31438
|
+
return { success: false, fileType: "hwpml", error: _chunkDZBMQC2Ncjs.sanitizeError.call(void 0, err), code: _chunkDZBMQC2Ncjs.classifyError.call(void 0, err) };
|
|
31425
31439
|
}
|
|
31426
31440
|
}
|
|
31427
31441
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
31428
31442
|
let buffer;
|
|
31429
31443
|
if (typeof input === "string") {
|
|
31430
31444
|
const buf = await _promises.readFile.call(void 0, input);
|
|
31431
|
-
buffer =
|
|
31445
|
+
buffer = _chunkDZBMQC2Ncjs.toArrayBuffer.call(void 0, buf);
|
|
31432
31446
|
} else if (Buffer.isBuffer(input)) {
|
|
31433
|
-
buffer =
|
|
31447
|
+
buffer = _chunkDZBMQC2Ncjs.toArrayBuffer.call(void 0, input);
|
|
31434
31448
|
} else {
|
|
31435
31449
|
buffer = input;
|
|
31436
31450
|
}
|
|
@@ -31456,7 +31470,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
31456
31470
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
31457
31471
|
}
|
|
31458
31472
|
const fill = fillFormFields(parsed.blocks, values);
|
|
31459
|
-
const markdown =
|
|
31473
|
+
const markdown = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
31460
31474
|
if (outputFormat === "hwpx") {
|
|
31461
31475
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
31462
31476
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -31535,5 +31549,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
31535
31549
|
|
|
31536
31550
|
|
|
31537
31551
|
|
|
31538
|
-
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 =
|
|
31552
|
+
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 = _chunkDZBMQC2Ncjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunk46VU6YXFcjs.blocksToMarkdown; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; exports.compare = compare; exports.detectFormat = detectFormat; exports.detectOle2Format = detectOle2Format; exports.detectZipFormat = detectZipFormat; exports.diffBlocks = diffBlocks; exports.extractClickHereFields = extractClickHereFields; exports.extractFormFields = extractFormFields; exports.extractFormSchema = extractFormSchema; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintGongmunText = lintGongmunText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.readBuiltinTemplate = readBuiltinTemplate; exports.readBuiltinTemplateSample = readBuiltinTemplateSample; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.resolveBuiltinTemplate = resolveBuiltinTemplate; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.validateHwpx = validateHwpx;
|
|
31539
31553
|
//# sourceMappingURL=index.cjs.map
|